@saas-support/react 0.6.2 → 0.7.1

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 r, Fragment as G } from "react/jsx-runtime";
2
- import { createContext as ma, useContext as ba, useState as g, useEffect as V, useRef as W, useCallback as $, useMemo as _ } from "react";
3
- import { SaaSSupport as xa, isMfaRequired as ya, BillingClient as va, Transport as J, ReportClient as ea } from "./index.js";
4
- import { SaaSError as ye } from "./index.js";
5
- import { createPortal as wa } from "react-dom";
1
+ import { jsx as e, jsxs as t, Fragment as j } from "react/jsx-runtime";
2
+ import { createContext as ma, useContext as fa, useState as g, useEffect as U, useRef as _, useCallback as $, useMemo as G } from "react";
3
+ import { SaaSSupport as ba, isMfaRequired as xa, BillingClient as ya, Transport as Q, ReportClient as ta } from "./index.js";
4
+ import { SaaSError as Ne } from "./index.js";
5
+ import { createPortal as va } from "react-dom";
6
6
  const ra = ma(null);
7
- function L() {
8
- const a = ba(ra);
7
+ function A() {
8
+ const a = fa(ra);
9
9
  if (!a)
10
10
  throw new Error("useSaaSContext must be used within a <SaaSProvider>");
11
11
  return a;
12
12
  }
13
- function Xa({ publishableKey: a, apiKey: s, baseUrl: t, appearance: o, children: n }) {
14
- const [u] = g(() => new xa({ publishableKey: a, apiKey: s, baseUrl: t })), [l, c] = g(null), [d, i] = g(!1), [f, p] = g(null);
15
- return V(() => {
13
+ function te({ publishableKey: a, apiKey: s, baseUrl: r, appearance: o, children: n }) {
14
+ const [u] = g(() => new ba({ publishableKey: a, apiKey: s, baseUrl: r })), [i, l] = g(null), [d, c] = g(!1), [f, p] = g(null);
15
+ return U(() => {
16
16
  let m = !1;
17
17
  u.load().then(async () => {
18
18
  if (m) return;
19
- const w = await u.auth.getUser(), y = await u.auth.getSettings();
20
- c(w), p(y), i(!0);
19
+ const N = await u.auth.getUser(), y = await u.auth.getSettings();
20
+ l(N), p(y), c(!0);
21
21
  });
22
- const b = u.auth.onAuthStateChange((w) => {
23
- m || c(w);
22
+ const b = u.auth.onAuthStateChange((N) => {
23
+ m || l(N);
24
24
  });
25
25
  return () => {
26
26
  m = !0, b(), u.destroy();
27
27
  };
28
- }, [u]), /* @__PURE__ */ e(ra.Provider, { value: { client: u, user: l, isLoaded: d, appearance: o, settings: f }, children: n });
28
+ }, [u]), /* @__PURE__ */ e(ra.Provider, { value: { client: u, user: i, isLoaded: d, appearance: o, settings: f }, children: n });
29
29
  }
30
- const Na = {
30
+ const wa = {
31
31
  // Legacy (unchanged)
32
32
  colorPrimary: "#6366f1",
33
33
  colorPrimaryHover: "#4f46e5",
@@ -61,7 +61,7 @@ const Na = {
61
61
  authSuccess: "#22c55e",
62
62
  authFontHeadline: "'Manrope', sans-serif",
63
63
  authFontBody: "'Inter', sans-serif"
64
- }, $a = {
64
+ }, Na = {
65
65
  // Legacy (unchanged)
66
66
  colorPrimary: "#818cf8",
67
67
  colorPrimaryHover: "#6366f1",
@@ -96,53 +96,53 @@ const Na = {
96
96
  authFontHeadline: "'Manrope', sans-serif",
97
97
  authFontBody: "'Inter', sans-serif"
98
98
  };
99
- function X(a) {
100
- const s = (a == null ? void 0 : a.baseTheme) === "dark" ? $a : Na, t = a == null ? void 0 : a.variables, o = (t == null ? void 0 : t.colorPrimary) ?? s.authPrimary;
99
+ function aa(a) {
100
+ const s = (a == null ? void 0 : a.baseTheme) === "dark" ? Na : wa, r = a == null ? void 0 : a.variables, o = (r == null ? void 0 : r.colorPrimary) ?? s.authPrimary;
101
101
  return {
102
102
  // Legacy
103
- colorPrimary: (t == null ? void 0 : t.colorPrimary) ?? s.colorPrimary,
104
- colorPrimaryHover: t != null && t.colorPrimary ? Sa(t.colorPrimary, 10) : s.colorPrimaryHover,
105
- colorBackground: (t == null ? void 0 : t.colorBackground) ?? s.colorBackground,
106
- colorText: (t == null ? void 0 : t.colorText) ?? s.colorText,
103
+ colorPrimary: (r == null ? void 0 : r.colorPrimary) ?? s.colorPrimary,
104
+ colorPrimaryHover: r != null && r.colorPrimary ? Sa(r.colorPrimary, 10) : s.colorPrimaryHover,
105
+ colorBackground: (r == null ? void 0 : r.colorBackground) ?? s.colorBackground,
106
+ colorText: (r == null ? void 0 : r.colorText) ?? s.colorText,
107
107
  colorTextSecondary: s.colorTextSecondary,
108
- colorInputBackground: (t == null ? void 0 : t.colorInputBackground) ?? s.colorInputBackground,
109
- colorInputBorder: (t == null ? void 0 : t.colorInputBorder) ?? s.colorInputBorder,
110
- colorError: (t == null ? void 0 : t.colorError) ?? s.colorError,
111
- colorSuccess: (t == null ? void 0 : t.colorSuccess) ?? s.colorSuccess,
112
- colorWarning: (t == null ? void 0 : t.colorWarning) ?? s.colorWarning,
113
- fontFamily: (t == null ? void 0 : t.fontFamily) ?? s.fontFamily,
114
- borderRadius: (t == null ? void 0 : t.borderRadius) ?? s.borderRadius,
108
+ colorInputBackground: (r == null ? void 0 : r.colorInputBackground) ?? s.colorInputBackground,
109
+ colorInputBorder: (r == null ? void 0 : r.colorInputBorder) ?? s.colorInputBorder,
110
+ colorError: (r == null ? void 0 : r.colorError) ?? s.colorError,
111
+ colorSuccess: (r == null ? void 0 : r.colorSuccess) ?? s.colorSuccess,
112
+ colorWarning: (r == null ? void 0 : r.colorWarning) ?? s.colorWarning,
113
+ fontFamily: (r == null ? void 0 : r.fontFamily) ?? s.fontFamily,
114
+ borderRadius: (r == null ? void 0 : r.borderRadius) ?? s.borderRadius,
115
115
  // MD3 auth — derive from user overrides where applicable
116
116
  authPrimary: o,
117
- authPrimaryContainer: t != null && t.colorPrimary ? ka(o, 15) : s.authPrimaryContainer,
117
+ authPrimaryContainer: r != null && r.colorPrimary ? $a(o, 15) : s.authPrimaryContainer,
118
118
  authOnPrimary: s.authOnPrimary,
119
119
  authPrimaryFixed: s.authPrimaryFixed,
120
- authSurface: (t == null ? void 0 : t.colorBackground) ?? s.authSurface,
120
+ authSurface: (r == null ? void 0 : r.colorBackground) ?? s.authSurface,
121
121
  authSurfaceContainerLowest: s.authSurfaceContainerLowest,
122
- authSurfaceContainerLow: (t == null ? void 0 : t.colorInputBackground) ?? s.authSurfaceContainerLow,
122
+ authSurfaceContainerLow: (r == null ? void 0 : r.colorInputBackground) ?? s.authSurfaceContainerLow,
123
123
  authSurfaceContainer: s.authSurfaceContainer,
124
124
  authSurfaceContainerHigh: s.authSurfaceContainerHigh,
125
125
  authSurfaceContainerHighest: s.authSurfaceContainerHighest,
126
- authOnSurface: (t == null ? void 0 : t.colorText) ?? s.authOnSurface,
126
+ authOnSurface: (r == null ? void 0 : r.colorText) ?? s.authOnSurface,
127
127
  authOnSurfaceVariant: s.authOnSurfaceVariant,
128
128
  authOutline: s.authOutline,
129
- authOutlineVariant: (t == null ? void 0 : t.colorInputBorder) ?? s.authOutlineVariant,
130
- authError: (t == null ? void 0 : t.colorError) ?? s.authError,
129
+ authOutlineVariant: (r == null ? void 0 : r.colorInputBorder) ?? s.authOutlineVariant,
130
+ authError: (r == null ? void 0 : r.colorError) ?? s.authError,
131
131
  authErrorContainer: s.authErrorContainer,
132
- authSuccess: (t == null ? void 0 : t.colorSuccess) ?? s.authSuccess,
133
- authFontHeadline: (t == null ? void 0 : t.fontFamily) ?? s.authFontHeadline,
134
- authFontBody: (t == null ? void 0 : t.fontFamily) ?? s.authFontBody
132
+ authSuccess: (r == null ? void 0 : r.colorSuccess) ?? s.authSuccess,
133
+ authFontHeadline: (r == null ? void 0 : r.fontFamily) ?? s.authFontHeadline,
134
+ authFontBody: (r == null ? void 0 : r.fontFamily) ?? s.authFontBody
135
135
  };
136
136
  }
137
137
  function Sa(a, s) {
138
- const t = parseInt(a.replace("#", ""), 16), o = Math.max(0, (t >> 16) - Math.round(2.55 * s)), n = Math.max(0, (t >> 8 & 255) - Math.round(2.55 * s)), u = Math.max(0, (t & 255) - Math.round(2.55 * s));
138
+ const r = parseInt(a.replace("#", ""), 16), o = Math.max(0, (r >> 16) - Math.round(2.55 * s)), n = Math.max(0, (r >> 8 & 255) - Math.round(2.55 * s)), u = Math.max(0, (r & 255) - Math.round(2.55 * s));
139
139
  return `#${(o << 16 | n << 8 | u).toString(16).padStart(6, "0")}`;
140
140
  }
141
- function ka(a, s) {
142
- const t = parseInt(a.replace("#", ""), 16), o = Math.min(255, (t >> 16) + Math.round(2.55 * s)), n = Math.min(255, (t >> 8 & 255) + Math.round(2.55 * s)), u = Math.min(255, (t & 255) + Math.round(2.55 * s));
141
+ function $a(a, s) {
142
+ const r = parseInt(a.replace("#", ""), 16), o = Math.min(255, (r >> 16) + Math.round(2.55 * s)), n = Math.min(255, (r >> 8 & 255) + Math.round(2.55 * s)), u = Math.min(255, (r & 255) + Math.round(2.55 * s));
143
143
  return `#${(o << 16 | n << 8 | u).toString(16).padStart(6, "0")}`;
144
144
  }
145
- function aa(a) {
145
+ function ea(a) {
146
146
  return `
147
147
  :host {
148
148
  all: initial;
@@ -1412,6 +1412,38 @@ function aa(a) {
1412
1412
  overflow: hidden;
1413
1413
  }
1414
1414
 
1415
+ /* User Trigger (avatar + org name pill) */
1416
+ .ss-auth-user-trigger {
1417
+ display: inline-flex;
1418
+ align-items: center;
1419
+ gap: 8px;
1420
+ padding: 4px 12px 4px 4px;
1421
+ border-radius: 999px;
1422
+ border: 1px solid ${a.authOutlineVariant}33;
1423
+ background: ${a.authSurfaceContainerLow};
1424
+ cursor: pointer;
1425
+ transition: background 0.15s, box-shadow 0.15s;
1426
+ font-family: ${a.authFontBody};
1427
+ }
1428
+
1429
+ .ss-auth-user-trigger:hover {
1430
+ background: ${a.authSurfaceContainer};
1431
+ box-shadow: 0 0 0 2px ${a.authPrimary}33;
1432
+ }
1433
+
1434
+ .ss-auth-user-trigger:active { transform: scale(0.98); }
1435
+
1436
+ .ss-auth-trigger-org-name {
1437
+ font-size: 13px;
1438
+ font-weight: 600;
1439
+ color: ${a.authOnSurface};
1440
+ max-width: 140px;
1441
+ overflow: hidden;
1442
+ text-overflow: ellipsis;
1443
+ white-space: nowrap;
1444
+ letter-spacing: -0.01em;
1445
+ }
1446
+
1415
1447
  /* Avatar Trigger */
1416
1448
  .ss-auth-avatar-trigger {
1417
1449
  width: 40px;
@@ -1419,20 +1451,12 @@ function aa(a) {
1419
1451
  border-radius: 50%;
1420
1452
  border: 2px solid ${a.authPrimary};
1421
1453
  overflow: hidden;
1422
- cursor: pointer;
1423
1454
  transition: transform 0.15s, box-shadow 0.15s;
1424
1455
  padding: 0;
1425
1456
  background: none;
1426
1457
  flex-shrink: 0;
1427
1458
  }
1428
1459
 
1429
- .ss-auth-avatar-trigger:hover {
1430
- transform: scale(1.05);
1431
- box-shadow: 0 0 0 3px ${a.authPrimary}33;
1432
- }
1433
-
1434
- .ss-auth-avatar-trigger:active { transform: scale(0.95); }
1435
-
1436
1460
  .ss-auth-avatar-trigger img {
1437
1461
  width: 100%;
1438
1462
  height: 100%;
@@ -1600,6 +1624,24 @@ function aa(a) {
1600
1624
  font-variation-settings: 'FILL' 1;
1601
1625
  }
1602
1626
 
1627
+ /* Plan Badge */
1628
+ .ss-auth-plan-badge {
1629
+ display: inline-block;
1630
+ font-size: 10px;
1631
+ font-weight: 700;
1632
+ text-transform: uppercase;
1633
+ letter-spacing: 0.05em;
1634
+ padding: 2px 8px;
1635
+ border-radius: 999px;
1636
+ background: ${a.authPrimary}1a;
1637
+ color: ${a.authPrimary};
1638
+ border: 1px solid ${a.authPrimary}33;
1639
+ margin-left: auto;
1640
+ white-space: nowrap;
1641
+ flex-shrink: 0;
1642
+ font-family: ${a.authFontBody};
1643
+ }
1644
+
1603
1645
  /* Modal Overlay */
1604
1646
  .ss-auth-modal-overlay {
1605
1647
  position: fixed;
@@ -2171,6 +2213,249 @@ function aa(a) {
2171
2213
  animation: ss-spin 0.6s linear infinite;
2172
2214
  }
2173
2215
 
2216
+ /* Settings Panel (full-page overlay) */
2217
+ .ss-auth-settings-page {
2218
+ width: 100%;
2219
+ height: 100%;
2220
+ display: flex;
2221
+ flex-direction: column;
2222
+ background: ${a.authSurface};
2223
+ animation: ss-auth-scale-in 0.2s ease-out;
2224
+ }
2225
+
2226
+ .ss-auth-settings-header {
2227
+ display: flex;
2228
+ align-items: center;
2229
+ justify-content: space-between;
2230
+ padding: 20px 32px;
2231
+ border-bottom: 1px solid ${a.authOutlineVariant}1a;
2232
+ background: ${a.authSurfaceContainerHigh}80;
2233
+ flex-shrink: 0;
2234
+ }
2235
+
2236
+ .ss-auth-settings-header h2 {
2237
+ font-family: ${a.authFontHeadline};
2238
+ font-size: 20px;
2239
+ font-weight: 700;
2240
+ letter-spacing: -0.02em;
2241
+ color: ${a.authOnSurface};
2242
+ margin: 0;
2243
+ }
2244
+
2245
+ .ss-auth-settings-layout {
2246
+ display: flex;
2247
+ flex: 1;
2248
+ overflow: hidden;
2249
+ }
2250
+
2251
+ .ss-auth-settings-nav {
2252
+ width: 220px;
2253
+ padding: 16px;
2254
+ border-right: 1px solid ${a.authOutlineVariant}1a;
2255
+ display: flex;
2256
+ flex-direction: column;
2257
+ gap: 4px;
2258
+ flex-shrink: 0;
2259
+ background: ${a.authSurfaceContainerLow};
2260
+ }
2261
+
2262
+ .ss-auth-settings-nav-item {
2263
+ display: flex;
2264
+ align-items: center;
2265
+ gap: 10px;
2266
+ padding: 10px 14px;
2267
+ border-radius: 8px;
2268
+ cursor: pointer;
2269
+ transition: background 0.15s, color 0.15s;
2270
+ background: none;
2271
+ border: none;
2272
+ width: 100%;
2273
+ font-family: ${a.authFontBody};
2274
+ font-size: 14px;
2275
+ font-weight: 500;
2276
+ color: ${a.authOnSurfaceVariant};
2277
+ text-align: left;
2278
+ }
2279
+
2280
+ .ss-auth-settings-nav-item:hover {
2281
+ background: ${a.authSurfaceContainer};
2282
+ color: ${a.authOnSurface};
2283
+ }
2284
+
2285
+ .ss-auth-settings-nav-item-active {
2286
+ background: ${a.authPrimaryFixed}4d;
2287
+ color: ${a.authPrimary};
2288
+ font-weight: 600;
2289
+ }
2290
+
2291
+ .ss-auth-settings-nav-item-active:hover {
2292
+ background: ${a.authPrimaryFixed}4d;
2293
+ }
2294
+
2295
+ .ss-auth-settings-nav-item .material-symbols-outlined {
2296
+ font-size: 20px;
2297
+ }
2298
+
2299
+ .ss-auth-settings-content {
2300
+ flex: 1;
2301
+ overflow-y: auto;
2302
+ padding: 32px;
2303
+ }
2304
+
2305
+ .ss-auth-settings-content h3 {
2306
+ font-family: ${a.authFontHeadline};
2307
+ font-size: 18px;
2308
+ font-weight: 700;
2309
+ color: ${a.authOnSurface};
2310
+ letter-spacing: -0.01em;
2311
+ margin: 0 0 24px 0;
2312
+ }
2313
+
2314
+ .ss-auth-settings-card {
2315
+ background: ${a.authSurfaceContainer};
2316
+ border: 1px solid ${a.authOutlineVariant}1a;
2317
+ border-radius: 12px;
2318
+ padding: 24px;
2319
+ margin-bottom: 24px;
2320
+ }
2321
+
2322
+ .ss-auth-settings-card h4 {
2323
+ font-family: ${a.authFontHeadline};
2324
+ font-size: 15px;
2325
+ font-weight: 700;
2326
+ color: ${a.authOnSurface};
2327
+ margin: 0 0 16px 0;
2328
+ display: flex;
2329
+ align-items: center;
2330
+ gap: 8px;
2331
+ }
2332
+
2333
+ .ss-auth-settings-card h4 .material-symbols-outlined {
2334
+ color: ${a.authPrimary};
2335
+ font-size: 20px;
2336
+ }
2337
+
2338
+ /* Settings Table */
2339
+ .ss-auth-settings-table {
2340
+ width: 100%;
2341
+ border-collapse: collapse;
2342
+ font-family: ${a.authFontBody};
2343
+ font-size: 14px;
2344
+ }
2345
+
2346
+ .ss-auth-settings-table th {
2347
+ text-align: left;
2348
+ padding: 8px 12px;
2349
+ font-size: 11px;
2350
+ font-weight: 700;
2351
+ text-transform: uppercase;
2352
+ letter-spacing: 0.08em;
2353
+ color: ${a.authOnSurfaceVariant};
2354
+ border-bottom: 1px solid ${a.authOutlineVariant}33;
2355
+ }
2356
+
2357
+ .ss-auth-settings-table td {
2358
+ padding: 10px 12px;
2359
+ color: ${a.authOnSurface};
2360
+ border-bottom: 1px solid ${a.authOutlineVariant}1a;
2361
+ }
2362
+
2363
+ .ss-auth-settings-table tr:last-child td {
2364
+ border-bottom: none;
2365
+ }
2366
+
2367
+ .ss-auth-settings-table tr:hover td {
2368
+ background: ${a.authSurfaceContainerLow};
2369
+ }
2370
+
2371
+ /* Settings Role Badges */
2372
+ .ss-auth-role-badge {
2373
+ display: inline-block;
2374
+ font-size: 10px;
2375
+ font-weight: 700;
2376
+ text-transform: uppercase;
2377
+ letter-spacing: 0.05em;
2378
+ padding: 2px 8px;
2379
+ border-radius: 999px;
2380
+ font-family: ${a.authFontBody};
2381
+ }
2382
+
2383
+ .ss-auth-role-badge-owner {
2384
+ background: #8b5cf633;
2385
+ color: #8b5cf6;
2386
+ border: 1px solid #8b5cf64d;
2387
+ }
2388
+
2389
+ .ss-auth-role-badge-admin {
2390
+ background: #3b82f633;
2391
+ color: #3b82f6;
2392
+ border: 1px solid #3b82f64d;
2393
+ }
2394
+
2395
+ .ss-auth-role-badge-member {
2396
+ background: ${a.authOnSurfaceVariant}1a;
2397
+ color: ${a.authOnSurfaceVariant};
2398
+ border: 1px solid ${a.authOutlineVariant}33;
2399
+ }
2400
+
2401
+ /* Settings icon buttons */
2402
+ .ss-auth-icon-btn {
2403
+ background: none;
2404
+ border: none;
2405
+ cursor: pointer;
2406
+ padding: 4px;
2407
+ border-radius: 6px;
2408
+ color: ${a.authOnSurfaceVariant};
2409
+ display: inline-flex;
2410
+ align-items: center;
2411
+ justify-content: center;
2412
+ transition: background 0.15s, color 0.15s;
2413
+ }
2414
+
2415
+ .ss-auth-icon-btn:hover {
2416
+ background: ${a.authSurfaceContainerHigh};
2417
+ color: ${a.authOnSurface};
2418
+ }
2419
+
2420
+ .ss-auth-icon-btn-danger:hover {
2421
+ background: ${a.authError}1a;
2422
+ color: ${a.authError};
2423
+ }
2424
+
2425
+ .ss-auth-icon-btn .material-symbols-outlined {
2426
+ font-size: 18px;
2427
+ }
2428
+
2429
+ /* Settings Empty State */
2430
+ .ss-auth-settings-empty {
2431
+ text-align: center;
2432
+ padding: 40px 20px;
2433
+ color: ${a.authOnSurfaceVariant};
2434
+ font-size: 14px;
2435
+ }
2436
+
2437
+ .ss-auth-settings-empty .material-symbols-outlined {
2438
+ font-size: 40px;
2439
+ margin-bottom: 12px;
2440
+ opacity: 0.4;
2441
+ }
2442
+
2443
+ /* Settings action row */
2444
+ .ss-auth-settings-actions {
2445
+ display: flex;
2446
+ align-items: center;
2447
+ gap: 8px;
2448
+ }
2449
+
2450
+ /* Settings Danger Card */
2451
+ .ss-auth-settings-danger {
2452
+ border-color: ${a.authError}33;
2453
+ }
2454
+
2455
+ .ss-auth-settings-danger h4 {
2456
+ color: ${a.authError};
2457
+ }
2458
+
2174
2459
  /* Responsive overrides */
2175
2460
  @media (max-width: 640px) {
2176
2461
  .ss-auth-profile-header {
@@ -2184,18 +2469,23 @@ function aa(a) {
2184
2469
 
2185
2470
  .ss-auth-signout-row { flex-direction: column; text-align: center; }
2186
2471
  .ss-auth-signout-info { flex-direction: column; }
2472
+
2473
+ .ss-auth-settings-nav { width: 180px; padding: 12px; }
2474
+ .ss-auth-settings-content { padding: 24px; }
2475
+ .ss-auth-trigger-org-name { display: none; }
2476
+ .ss-auth-user-trigger { padding: 0; border: none; background: none; }
2187
2477
  }
2188
2478
  `;
2189
2479
  }
2190
- function q({ children: a, appearance: s }) {
2191
- const t = W(null), [o, n] = g(null);
2192
- V(() => {
2480
+ function H({ children: a, appearance: s }) {
2481
+ const r = _(null), [o, n] = g(null);
2482
+ U(() => {
2193
2483
  var f;
2194
- if (!t.current || t.current.shadowRoot) {
2195
- n(((f = t.current) == null ? void 0 : f.shadowRoot) ?? null);
2484
+ if (!r.current || r.current.shadowRoot) {
2485
+ n(((f = r.current) == null ? void 0 : f.shadowRoot) ?? null);
2196
2486
  return;
2197
2487
  }
2198
- const l = t.current.attachShadow({ mode: "open" });
2488
+ const i = r.current.attachShadow({ mode: "open" });
2199
2489
  if ((s == null ? void 0 : s.fontUrl) !== null) {
2200
2490
  const p = (s == null ? void 0 : s.fontUrl) ?? "https://fonts.googleapis.com/css2?family=Manrope:wght@400;500;600;700;800&family=Inter:wght@400;500;600&family=Material+Symbols+Outlined:opsz,wght,FILL,GRAD@20..48,100..700,0..1,-50..200&display=swap";
2201
2491
  if (!document.querySelector(`link[href="${p}"]`)) {
@@ -2203,182 +2493,183 @@ function q({ children: a, appearance: s }) {
2203
2493
  b.rel = "stylesheet", b.href = p, document.head.appendChild(b);
2204
2494
  }
2205
2495
  const m = document.createElement("link");
2206
- m.rel = "stylesheet", m.href = p, l.appendChild(m);
2496
+ m.rel = "stylesheet", m.href = p, i.appendChild(m);
2207
2497
  }
2208
- const c = X(s), d = document.createElement("style");
2209
- d.textContent = aa(c), l.appendChild(d);
2210
- const i = document.createElement("div");
2211
- l.appendChild(i), n(l);
2212
- }, []), V(() => {
2498
+ const l = aa(s), d = document.createElement("style");
2499
+ d.textContent = ea(l), i.appendChild(d);
2500
+ const c = document.createElement("div");
2501
+ i.appendChild(c), n(i);
2502
+ }, []), U(() => {
2213
2503
  if (!o) return;
2214
- const l = o.querySelector("style");
2215
- if (l) {
2216
- const c = X(s);
2217
- l.textContent = aa(c);
2504
+ const i = o.querySelector("style");
2505
+ if (i) {
2506
+ const l = aa(s);
2507
+ i.textContent = ea(l);
2218
2508
  }
2219
2509
  }, [s, o]);
2220
2510
  const u = (o == null ? void 0 : o.querySelector("div")) ?? null;
2221
- return /* @__PURE__ */ e("div", { ref: t, style: { display: "contents" }, children: u && wa(a, u) });
2511
+ return /* @__PURE__ */ e("div", { ref: r, style: { display: "contents" }, children: u && va(a, u) });
2222
2512
  }
2223
- function ta() {
2224
- const { client: a, user: s, isLoaded: t } = L();
2513
+ function sa() {
2514
+ const { client: a, user: s, isLoaded: r } = A();
2225
2515
  return {
2226
- isLoaded: t,
2516
+ isLoaded: r,
2227
2517
  isSignedIn: !!s,
2228
2518
  user: s,
2229
2519
  signOut: $(() => a.auth.signOut(), [a]),
2230
- getToken: $(() => a.auth.getToken(), [a])
2520
+ getToken: $(() => a.auth.getToken(), [a]),
2521
+ refreshUser: $(() => a.auth.refreshUser(), [a])
2231
2522
  };
2232
2523
  }
2233
- function ae() {
2234
- const { user: a, isLoaded: s } = L();
2524
+ function se() {
2525
+ const { user: a, isLoaded: s } = A();
2235
2526
  return { user: a, isLoaded: s };
2236
2527
  }
2237
- function sa() {
2238
- const { client: a } = L(), [s, t] = g(!1), [o, n] = g(null), u = $(
2239
- async (d, i) => {
2240
- t(!0), n(null);
2528
+ function na() {
2529
+ const { client: a } = A(), [s, r] = g(!1), [o, n] = g(null), u = $(
2530
+ async (d, c) => {
2531
+ r(!0), n(null);
2241
2532
  try {
2242
- return await a.auth.signIn(d, i);
2533
+ return await a.auth.signIn(d, c);
2243
2534
  } catch (f) {
2244
2535
  return n(f instanceof Error ? f.message : "Sign in failed"), null;
2245
2536
  } finally {
2246
- t(!1);
2537
+ r(!1);
2247
2538
  }
2248
2539
  },
2249
2540
  [a]
2250
- ), l = $(
2541
+ ), i = $(
2251
2542
  async (d) => {
2252
- t(!0), n(null);
2543
+ r(!0), n(null);
2253
2544
  try {
2254
2545
  return await a.auth.signInWithOAuth(d);
2255
- } catch (i) {
2256
- return n(i instanceof Error ? i.message : "OAuth sign in failed"), null;
2546
+ } catch (c) {
2547
+ return n(c instanceof Error ? c.message : "OAuth sign in failed"), null;
2257
2548
  } finally {
2258
- t(!1);
2549
+ r(!1);
2259
2550
  }
2260
2551
  },
2261
2552
  [a]
2262
- ), c = $(
2263
- async (d, i) => {
2264
- t(!0), n(null);
2553
+ ), l = $(
2554
+ async (d, c) => {
2555
+ r(!0), n(null);
2265
2556
  try {
2266
- return await a.auth.submitMfaCode(d, i);
2557
+ return await a.auth.submitMfaCode(d, c);
2267
2558
  } catch (f) {
2268
2559
  return n(f instanceof Error ? f.message : "MFA verification failed"), null;
2269
2560
  } finally {
2270
- t(!1);
2561
+ r(!1);
2271
2562
  }
2272
2563
  },
2273
2564
  [a]
2274
2565
  );
2275
- return { signIn: u, signInWithOAuth: l, submitMfaCode: c, isLoading: s, error: o, setError: n };
2566
+ return { signIn: u, signInWithOAuth: i, submitMfaCode: l, isLoading: s, error: o, setError: n };
2276
2567
  }
2277
- function Ca() {
2278
- const { client: a } = L(), [s, t] = g(!1), [o, n] = g(null);
2568
+ function ka() {
2569
+ const { client: a } = A(), [s, r] = g(!1), [o, n] = g(null);
2279
2570
  return { signUp: $(
2280
- async (l, c) => {
2281
- t(!0), n(null);
2571
+ async (i, l) => {
2572
+ r(!0), n(null);
2282
2573
  try {
2283
- return await a.auth.signUp(l, c);
2574
+ return await a.auth.signUp(i, l);
2284
2575
  } catch (d) {
2285
2576
  return n(d instanceof Error ? d.message : "Sign up failed"), null;
2286
2577
  } finally {
2287
- t(!1);
2578
+ r(!1);
2288
2579
  }
2289
2580
  },
2290
2581
  [a]
2291
2582
  ), isLoading: s, error: o, setError: n };
2292
2583
  }
2293
- function na() {
2294
- const { client: a } = L(), [s, t] = g([]), [o, n] = g(null), [u, l] = g([]), [c, d] = g([]), [i, f] = g(!1), [p, m] = g(null), b = $(async () => {
2584
+ function Y() {
2585
+ const { client: a } = A(), [s, r] = g([]), [o, n] = g(null), [u, i] = g([]), [l, d] = g([]), [c, f] = g(!1), [p, m] = g(null), b = $(async () => {
2295
2586
  f(!0), m(null);
2296
2587
  try {
2297
- const S = await a.auth.listOrgs();
2298
- t(S);
2588
+ const C = await a.auth.listOrgs();
2589
+ r(C);
2299
2590
  const x = typeof window < "u" ? localStorage.getItem("ss_selected_org") : null;
2300
- if (x && S.some((v) => v.id === x) && !o) {
2301
- const v = S.find((O) => O.id === x);
2591
+ if (x && C.some((v) => v.id === x) && !o) {
2592
+ const v = C.find((E) => E.id === x);
2302
2593
  n(v);
2303
2594
  try {
2304
- const O = await a.auth.listMembers(v.id);
2305
- l(O);
2595
+ const E = await a.auth.listMembers(v.id);
2596
+ i(E);
2306
2597
  } catch {
2307
2598
  }
2308
2599
  }
2309
- } catch (S) {
2310
- m(S instanceof Error ? S.message : "Failed to load organizations");
2600
+ } catch (C) {
2601
+ m(C instanceof Error ? C.message : "Failed to load organizations");
2311
2602
  } finally {
2312
2603
  f(!1);
2313
2604
  }
2314
2605
  }, [a, o]);
2315
- V(() => {
2606
+ U(() => {
2316
2607
  b();
2317
2608
  }, [b]);
2318
- const w = $(async (S) => {
2609
+ const N = $(async (C) => {
2319
2610
  try {
2320
- const x = await a.auth.getOrg(S);
2321
- n(x), typeof window < "u" && localStorage.setItem("ss_selected_org", S);
2322
- const v = await a.auth.listMembers(S);
2323
- l(v);
2611
+ const x = await a.auth.getOrg(C);
2612
+ n(x), typeof window < "u" && localStorage.setItem("ss_selected_org", C);
2613
+ const v = await a.auth.listMembers(C);
2614
+ i(v);
2324
2615
  } catch (x) {
2325
2616
  m(x instanceof Error ? x.message : "Failed to load organization");
2326
2617
  }
2327
- }, [a]), y = $(async (S, x) => {
2618
+ }, [a]), y = $(async (C, x) => {
2328
2619
  try {
2329
- const v = await a.auth.createOrg(S, x);
2330
- return t((O) => [...O, v]), v;
2620
+ const v = await a.auth.createOrg(C, x);
2621
+ return r((E) => [...E, v]), v;
2331
2622
  } catch (v) {
2332
2623
  return m(v instanceof Error ? v.message : "Failed to create organization"), null;
2333
2624
  }
2334
- }, [a]), C = $(async (S, x) => {
2625
+ }, [a]), O = $(async (C, x) => {
2335
2626
  try {
2336
- const v = await a.auth.updateOrg(S, x);
2337
- return t((O) => O.map((D) => D.id === S ? v : D)), (o == null ? void 0 : o.id) === S && n(v), v;
2627
+ const v = await a.auth.updateOrg(C, x);
2628
+ return r((E) => E.map((M) => M.id === C ? v : M)), (o == null ? void 0 : o.id) === C && n(v), v;
2338
2629
  } catch (v) {
2339
2630
  return m(v instanceof Error ? v.message : "Failed to update organization"), null;
2340
2631
  }
2341
- }, [a, o]), h = $(async (S) => {
2632
+ }, [a, o]), h = $(async (C) => {
2342
2633
  try {
2343
- return await a.auth.deleteOrg(S), t((x) => x.filter((v) => v.id !== S)), (o == null ? void 0 : o.id) === S && (n(null), l([]), d([]), typeof window < "u" && localStorage.removeItem("ss_selected_org")), !0;
2634
+ return await a.auth.deleteOrg(C), r((x) => x.filter((v) => v.id !== C)), (o == null ? void 0 : o.id) === C && (n(null), i([]), d([]), typeof window < "u" && localStorage.removeItem("ss_selected_org")), !0;
2344
2635
  } catch (x) {
2345
2636
  return m(x instanceof Error ? x.message : "Failed to delete organization"), !1;
2346
2637
  }
2347
- }, [a, o]), N = $(async (S, x, v) => {
2638
+ }, [a, o]), S = $(async (C, x, v) => {
2348
2639
  try {
2349
- return await a.auth.sendInvite(S, x, v);
2350
- } catch (O) {
2351
- return m(O instanceof Error ? O.message : "Failed to send invite"), null;
2640
+ return await a.auth.sendInvite(C, x, v);
2641
+ } catch (E) {
2642
+ return m(E instanceof Error ? E.message : "Failed to send invite"), null;
2352
2643
  }
2353
- }, [a]), k = $(async (S) => {
2644
+ }, [a]), k = $(async (C) => {
2354
2645
  try {
2355
- const x = await a.auth.listInvites(S);
2646
+ const x = await a.auth.listInvites(C);
2356
2647
  d(x);
2357
2648
  } catch (x) {
2358
2649
  m(x instanceof Error ? x.message : "Failed to load invites");
2359
2650
  }
2360
- }, [a]), z = $(async (S, x) => {
2651
+ }, [a]), P = $(async (C, x) => {
2361
2652
  try {
2362
- return await a.auth.revokeInvite(S, x), d((v) => v.filter((O) => O.id !== x)), !0;
2653
+ return await a.auth.revokeInvite(C, x), d((v) => v.filter((E) => E.id !== x)), !0;
2363
2654
  } catch (v) {
2364
2655
  return m(v instanceof Error ? v.message : "Failed to revoke invite"), !1;
2365
2656
  }
2366
- }, [a]), E = $(async (S, x, v) => {
2657
+ }, [a]), I = $(async (C, x, v) => {
2367
2658
  try {
2368
- return await a.auth.updateMemberRole(S, x, v), l((O) => O.map((D) => D.userId === x ? { ...D, role: v } : D)), !0;
2369
- } catch (O) {
2370
- return m(O instanceof Error ? O.message : "Failed to update member role"), !1;
2659
+ return await a.auth.updateMemberRole(C, x, v), i((E) => E.map((M) => M.userId === x ? { ...M, role: v } : M)), !0;
2660
+ } catch (E) {
2661
+ return m(E instanceof Error ? E.message : "Failed to update member role"), !1;
2371
2662
  }
2372
- }, [a]), I = $(async (S, x) => {
2663
+ }, [a]), F = $(async (C, x) => {
2373
2664
  try {
2374
- return await a.auth.removeMember(S, x), l((v) => v.filter((O) => O.userId !== x)), !0;
2665
+ return await a.auth.removeMember(C, x), i((v) => v.filter((E) => E.userId !== x)), !0;
2375
2666
  } catch (v) {
2376
2667
  return m(v instanceof Error ? v.message : "Failed to remove member"), !1;
2377
2668
  }
2378
- }, [a]), A = $(async (S) => {
2669
+ }, [a]), B = $(async (C) => {
2379
2670
  try {
2380
- const x = await a.auth.listMembers(S);
2381
- l(x);
2671
+ const x = await a.auth.listMembers(C);
2672
+ i(x);
2382
2673
  } catch (x) {
2383
2674
  m(x instanceof Error ? x.message : "Failed to load members");
2384
2675
  }
@@ -2387,43 +2678,43 @@ function na() {
2387
2678
  orgs: s,
2388
2679
  selectedOrg: o,
2389
2680
  members: u,
2390
- invites: c,
2391
- isLoading: i,
2681
+ invites: l,
2682
+ isLoading: c,
2392
2683
  error: p,
2393
2684
  setError: m,
2394
2685
  refresh: b,
2395
- selectOrg: w,
2686
+ selectOrg: N,
2396
2687
  createOrg: y,
2397
- updateOrg: C,
2688
+ updateOrg: O,
2398
2689
  deleteOrg: h,
2399
- sendInvite: N,
2690
+ sendInvite: S,
2400
2691
  refreshInvites: k,
2401
- revokeInvite: z,
2402
- updateMemberRole: E,
2403
- removeMember: I,
2404
- refreshMembers: A
2692
+ revokeInvite: P,
2693
+ updateMemberRole: I,
2694
+ removeMember: F,
2695
+ refreshMembers: B
2405
2696
  };
2406
2697
  }
2407
- function za() {
2408
- const { client: a } = L(), [s, t] = g(!1), [o, n] = g(null);
2698
+ function Ca() {
2699
+ const { client: a } = A(), [s, r] = g(!1), [o, n] = g(null);
2409
2700
  return { deleteAccount: $(async () => {
2410
- t(!0), n(null);
2701
+ r(!0), n(null);
2411
2702
  try {
2412
2703
  return await a.auth.deleteAccount(), !0;
2413
- } catch (l) {
2414
- return n(l instanceof Error ? l.message : "Failed to delete account"), !1;
2704
+ } catch (i) {
2705
+ return n(i instanceof Error ? i.message : "Failed to delete account"), !1;
2415
2706
  } finally {
2416
- t(!1);
2707
+ r(!1);
2417
2708
  }
2418
2709
  }, [a]), isLoading: s, error: o, setError: n };
2419
2710
  }
2420
2711
  function oa() {
2421
- const { client: a, user: s } = L(), [t, o] = g(!1), [n, u] = g(null), [l, c] = g(null), d = $(
2712
+ const { client: a, user: s } = A(), [r, o] = g(!1), [n, u] = g(null), [i, l] = g(null), d = $(
2422
2713
  async (p) => {
2423
- o(!0), u(null), c(null);
2714
+ o(!0), u(null), l(null);
2424
2715
  try {
2425
2716
  const m = await a.auth.updateProfile(p);
2426
- return c("Profile updated"), m;
2717
+ return l("Profile updated"), m;
2427
2718
  } catch (m) {
2428
2719
  return u(m instanceof Error ? m.message : "Failed to update profile"), null;
2429
2720
  } finally {
@@ -2431,11 +2722,11 @@ function oa() {
2431
2722
  }
2432
2723
  },
2433
2724
  [a]
2434
- ), i = $(
2725
+ ), c = $(
2435
2726
  async (p, m) => {
2436
- o(!0), u(null), c(null);
2727
+ o(!0), u(null), l(null);
2437
2728
  try {
2438
- return await a.auth.changePassword(p, m), c("Password changed successfully"), !0;
2729
+ return await a.auth.changePassword(p, m), l("Password changed successfully"), !0;
2439
2730
  } catch (b) {
2440
2731
  return u(b instanceof Error ? b.message : "Failed to change password"), !1;
2441
2732
  } finally {
@@ -2445,10 +2736,10 @@ function oa() {
2445
2736
  [a]
2446
2737
  ), f = $(
2447
2738
  async (p) => {
2448
- o(!0), u(null), c(null);
2739
+ o(!0), u(null), l(null);
2449
2740
  try {
2450
2741
  const m = await a.auth.uploadAvatar(p);
2451
- return c("Avatar updated"), m;
2742
+ return l("Avatar updated"), m;
2452
2743
  } catch (m) {
2453
2744
  return u(m instanceof Error ? m.message : "Failed to upload avatar"), null;
2454
2745
  } finally {
@@ -2457,9 +2748,9 @@ function oa() {
2457
2748
  },
2458
2749
  [a]
2459
2750
  );
2460
- return { user: s, updateProfile: d, uploadAvatar: f, changePassword: i, isLoading: t, error: n, success: l, setError: u, setSuccess: c };
2751
+ return { user: s, updateProfile: d, uploadAvatar: f, changePassword: c, isLoading: r, error: n, success: i, setError: u, setSuccess: l };
2461
2752
  }
2462
- const ia = '<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>', la = '<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>', P = {
2753
+ const ia = '<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>', la = '<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>', w = {
2463
2754
  close: "close",
2464
2755
  person: "person",
2465
2756
  logout: "logout",
@@ -2484,45 +2775,51 @@ const ia = '<svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path d=
2484
2775
  corporateFare: "corporate_fare",
2485
2776
  cloudDone: "cloud_done",
2486
2777
  check: "check",
2487
- image: "image"
2778
+ image: "image",
2779
+ settings: "settings",
2780
+ group: "group",
2781
+ creditCard: "credit_card",
2782
+ edit: "edit",
2783
+ send: "send",
2784
+ personRemove: "person_remove"
2488
2785
  };
2489
- function ee({ appearance: a, signUpUrl: s, onSignUp: t }) {
2490
- const { appearance: o, settings: n } = L(), { signIn: u, signInWithOAuth: l, submitMfaCode: c, isLoading: d, error: i, setError: f } = sa(), p = a ?? o, [m, b] = g(""), [w, y] = g(""), [C, h] = g(!1), [N, k] = g(!1), [z, E] = g(""), [I, A] = g(["", "", "", "", "", ""]), S = W([]), x = $(
2491
- async (T) => {
2492
- if (T.preventDefault(), N) {
2493
- await c(z, I.join(""));
2786
+ function re({ appearance: a, signUpUrl: s, onSignUp: r }) {
2787
+ const { appearance: o, settings: n } = A(), { signIn: u, signInWithOAuth: i, submitMfaCode: l, isLoading: d, error: c, setError: f } = na(), p = a ?? o, [m, b] = g(""), [N, y] = g(""), [O, h] = g(!1), [S, k] = g(!1), [P, I] = g(""), [F, B] = g(["", "", "", "", "", ""]), C = _([]), x = $(
2788
+ async (D) => {
2789
+ if (D.preventDefault(), S) {
2790
+ await l(P, F.join(""));
2494
2791
  return;
2495
2792
  }
2496
- const M = await u(m, w);
2497
- M && ya(M) && (E(M.mfaToken), k(!0), f(null));
2793
+ const z = await u(m, N);
2794
+ z && xa(z) && (I(z.mfaToken), k(!0), f(null));
2498
2795
  },
2499
- [m, w, N, z, I, u, c, f]
2796
+ [m, N, S, P, F, u, l, f]
2500
2797
  ), v = $(
2501
- async (T) => {
2502
- await l(T);
2798
+ async (D) => {
2799
+ await i(D);
2503
2800
  },
2504
- [l]
2505
- ), O = $((T, M) => {
2506
- var R;
2507
- if (!/^\d*$/.test(M)) return;
2508
- const F = M.slice(-1);
2509
- A((Z) => {
2510
- const Y = [...Z];
2511
- return Y[T] = F, Y;
2512
- }), F && T < 5 && ((R = S.current[T + 1]) == null || R.focus());
2513
- }, []), D = $((T, M) => {
2514
- var F;
2515
- M.key === "Backspace" && !I[T] && T > 0 && ((F = S.current[T - 1]) == null || F.focus());
2516
- }, [I]), H = (n == null ? void 0 : n.googleEnabled) || (n == null ? void 0 : n.githubEnabled);
2517
- return /* @__PURE__ */ e(q, { appearance: p, children: /* @__PURE__ */ e("div", { className: "ss-auth-card", children: /* @__PURE__ */ r("div", { className: "ss-auth-card-body", children: [
2518
- /* @__PURE__ */ r("div", { className: "ss-auth-header", children: [
2519
- /* @__PURE__ */ e("div", { className: "ss-auth-brand-icon", children: /* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: P.token }) }),
2801
+ [i]
2802
+ ), E = $((D, z) => {
2803
+ var W;
2804
+ if (!/^\d*$/.test(z)) return;
2805
+ const L = z.slice(-1);
2806
+ B((K) => {
2807
+ const J = [...K];
2808
+ return J[D] = L, J;
2809
+ }), L && D < 5 && ((W = C.current[D + 1]) == null || W.focus());
2810
+ }, []), M = $((D, z) => {
2811
+ var L;
2812
+ z.key === "Backspace" && !F[D] && D > 0 && ((L = C.current[D - 1]) == null || L.focus());
2813
+ }, [F]), V = (n == null ? void 0 : n.googleEnabled) || (n == null ? void 0 : n.githubEnabled);
2814
+ return /* @__PURE__ */ e(H, { appearance: p, children: /* @__PURE__ */ e("div", { className: "ss-auth-card", children: /* @__PURE__ */ t("div", { className: "ss-auth-card-body", children: [
2815
+ /* @__PURE__ */ t("div", { className: "ss-auth-header", children: [
2816
+ /* @__PURE__ */ e("div", { className: "ss-auth-brand-icon", children: /* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: w.token }) }),
2520
2817
  /* @__PURE__ */ e("h1", { className: "ss-auth-title", children: "Sign in to your account" }),
2521
2818
  /* @__PURE__ */ e("p", { className: "ss-auth-subtitle", children: "Welcome back to your workspace" })
2522
2819
  ] }),
2523
- !N && H && /* @__PURE__ */ r(G, { children: [
2524
- /* @__PURE__ */ r("div", { className: "ss-auth-oauth-grid", children: [
2525
- (n == null ? void 0 : n.googleEnabled) && /* @__PURE__ */ r(
2820
+ !S && V && /* @__PURE__ */ t(j, { children: [
2821
+ /* @__PURE__ */ t("div", { className: "ss-auth-oauth-grid", children: [
2822
+ (n == null ? void 0 : n.googleEnabled) && /* @__PURE__ */ t(
2526
2823
  "button",
2527
2824
  {
2528
2825
  type: "button",
@@ -2535,7 +2832,7 @@ function ee({ appearance: a, signUpUrl: s, onSignUp: t }) {
2535
2832
  ]
2536
2833
  }
2537
2834
  ),
2538
- (n == null ? void 0 : n.githubEnabled) && /* @__PURE__ */ r(
2835
+ (n == null ? void 0 : n.githubEnabled) && /* @__PURE__ */ t(
2539
2836
  "button",
2540
2837
  {
2541
2838
  type: "button",
@@ -2551,36 +2848,36 @@ function ee({ appearance: a, signUpUrl: s, onSignUp: t }) {
2551
2848
  ] }),
2552
2849
  /* @__PURE__ */ e("div", { className: "ss-auth-divider", children: "or continue with" })
2553
2850
  ] }),
2554
- i && /* @__PURE__ */ r("div", { className: "ss-auth-error", children: [
2555
- /* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: P.errorOutline }),
2556
- /* @__PURE__ */ e("span", { children: i })
2851
+ c && /* @__PURE__ */ t("div", { className: "ss-auth-error", children: [
2852
+ /* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: w.errorOutline }),
2853
+ /* @__PURE__ */ e("span", { children: c })
2557
2854
  ] }),
2558
- /* @__PURE__ */ r("form", { onSubmit: x, children: [
2559
- N ? /* @__PURE__ */ r(G, { children: [
2855
+ /* @__PURE__ */ t("form", { onSubmit: x, children: [
2856
+ S ? /* @__PURE__ */ t(j, { children: [
2560
2857
  /* @__PURE__ */ e("div", { className: "ss-auth-mfa-divider", children: /* @__PURE__ */ e("span", { children: "Verification Required" }) }),
2561
- /* @__PURE__ */ r("div", { className: "ss-auth-field", children: [
2858
+ /* @__PURE__ */ t("div", { className: "ss-auth-field", children: [
2562
2859
  /* @__PURE__ */ e("label", { className: "ss-auth-label", children: "6-Digit Code" }),
2563
- /* @__PURE__ */ e("div", { className: "ss-auth-mfa-group", children: I.map((T, M) => /* @__PURE__ */ e(
2860
+ /* @__PURE__ */ e("div", { className: "ss-auth-mfa-group", children: F.map((D, z) => /* @__PURE__ */ e(
2564
2861
  "input",
2565
2862
  {
2566
- ref: (F) => {
2567
- S.current[M] = F;
2863
+ ref: (L) => {
2864
+ C.current[z] = L;
2568
2865
  },
2569
2866
  className: "ss-auth-mfa-digit",
2570
2867
  type: "text",
2571
2868
  inputMode: "numeric",
2572
2869
  maxLength: 1,
2573
- value: T,
2574
- onChange: (F) => O(M, F.target.value),
2575
- onKeyDown: (F) => D(M, F),
2576
- autoFocus: M === 0
2870
+ value: D,
2871
+ onChange: (L) => E(z, L.target.value),
2872
+ onKeyDown: (L) => M(z, L),
2873
+ autoFocus: z === 0
2577
2874
  },
2578
- M
2875
+ z
2579
2876
  )) }),
2580
2877
  /* @__PURE__ */ e("p", { className: "ss-auth-mfa-hint", children: "We sent a 6-digit code to your registered email." })
2581
2878
  ] })
2582
- ] }) : /* @__PURE__ */ r(G, { children: [
2583
- /* @__PURE__ */ r("div", { className: "ss-auth-field", children: [
2879
+ ] }) : /* @__PURE__ */ t(j, { children: [
2880
+ /* @__PURE__ */ t("div", { className: "ss-auth-field", children: [
2584
2881
  /* @__PURE__ */ e("label", { className: "ss-auth-label", htmlFor: "ss-email", children: "Email Address" }),
2585
2882
  /* @__PURE__ */ e(
2586
2883
  "input",
@@ -2591,27 +2888,27 @@ function ee({ appearance: a, signUpUrl: s, onSignUp: t }) {
2591
2888
  autoComplete: "email",
2592
2889
  placeholder: "name@company.com",
2593
2890
  value: m,
2594
- onChange: (T) => b(T.target.value),
2891
+ onChange: (D) => b(D.target.value),
2595
2892
  required: !0
2596
2893
  }
2597
2894
  )
2598
2895
  ] }),
2599
- /* @__PURE__ */ r("div", { className: "ss-auth-field", children: [
2600
- /* @__PURE__ */ r("div", { className: "ss-auth-field-row", children: [
2896
+ /* @__PURE__ */ t("div", { className: "ss-auth-field", children: [
2897
+ /* @__PURE__ */ t("div", { className: "ss-auth-field-row", children: [
2601
2898
  /* @__PURE__ */ e("label", { className: "ss-auth-label", htmlFor: "ss-password", style: { marginBottom: 0 }, children: "Password" }),
2602
2899
  /* @__PURE__ */ e("span", { className: "ss-auth-link", style: { fontSize: "12px" }, children: "Forgot?" })
2603
2900
  ] }),
2604
- /* @__PURE__ */ r("div", { style: { position: "relative" }, children: [
2901
+ /* @__PURE__ */ t("div", { style: { position: "relative" }, children: [
2605
2902
  /* @__PURE__ */ e(
2606
2903
  "input",
2607
2904
  {
2608
2905
  id: "ss-password",
2609
2906
  className: "ss-auth-input",
2610
- type: C ? "text" : "password",
2907
+ type: O ? "text" : "password",
2611
2908
  autoComplete: "current-password",
2612
2909
  placeholder: "••••••••",
2613
- value: w,
2614
- onChange: (T) => y(T.target.value),
2910
+ value: N,
2911
+ onChange: (D) => y(D.target.value),
2615
2912
  required: !0
2616
2913
  }
2617
2914
  ),
@@ -2620,85 +2917,85 @@ function ee({ appearance: a, signUpUrl: s, onSignUp: t }) {
2620
2917
  {
2621
2918
  type: "button",
2622
2919
  className: "ss-auth-visibility-toggle",
2623
- onClick: () => h(!C),
2624
- children: /* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: C ? P.visibilityOff : P.visibility })
2920
+ onClick: () => h(!O),
2921
+ children: /* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: O ? w.visibilityOff : w.visibility })
2625
2922
  }
2626
2923
  )
2627
2924
  ] })
2628
2925
  ] })
2629
2926
  ] }),
2630
- /* @__PURE__ */ r("button", { type: "submit", className: "ss-auth-btn-primary", disabled: d, children: [
2927
+ /* @__PURE__ */ t("button", { type: "submit", className: "ss-auth-btn-primary", disabled: d, children: [
2631
2928
  d && /* @__PURE__ */ e("span", { className: "ss-auth-spinner" }),
2632
- N ? "Verify" : "Sign in",
2633
- !d && /* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: P.arrowForward })
2929
+ S ? "Verify" : "Sign in",
2930
+ !d && /* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: w.arrowForward })
2634
2931
  ] })
2635
2932
  ] }),
2636
- N ? /* @__PURE__ */ e("div", { className: "ss-auth-footer", children: /* @__PURE__ */ e(
2933
+ S ? /* @__PURE__ */ e("div", { className: "ss-auth-footer", children: /* @__PURE__ */ e(
2637
2934
  "span",
2638
2935
  {
2639
2936
  className: "ss-auth-link",
2640
2937
  onClick: () => {
2641
- k(!1), A(["", "", "", "", "", ""]), f(null);
2938
+ k(!1), B(["", "", "", "", "", ""]), f(null);
2642
2939
  },
2643
2940
  children: "Back to sign in"
2644
2941
  }
2645
- ) }) : /* @__PURE__ */ r("div", { className: "ss-auth-footer", children: [
2942
+ ) }) : /* @__PURE__ */ t("div", { className: "ss-auth-footer", children: [
2646
2943
  "Don't have an account?",
2647
2944
  " ",
2648
- t ? /* @__PURE__ */ e("span", { className: "ss-auth-link", onClick: t, children: "Sign up" }) : s ? /* @__PURE__ */ e("a", { className: "ss-auth-link", href: s, children: "Sign up" }) : /* @__PURE__ */ e("span", { className: "ss-auth-link", children: "Sign up" })
2945
+ r ? /* @__PURE__ */ e("span", { className: "ss-auth-link", onClick: r, children: "Sign up" }) : s ? /* @__PURE__ */ e("a", { className: "ss-auth-link", href: s, children: "Sign up" }) : /* @__PURE__ */ e("span", { className: "ss-auth-link", children: "Sign up" })
2649
2946
  ] })
2650
2947
  ] }) }) });
2651
2948
  }
2652
- function te({ appearance: a, signInUrl: s, onSignIn: t }) {
2653
- const { appearance: o, settings: n } = L(), { signUp: u, isLoading: l, error: c, setError: d } = Ca(), { signInWithOAuth: i } = sa(), f = a ?? o, [p, m] = g(""), [b, w] = g(""), [y, C] = g(""), [h, N] = g(!1), [k, z] = g(null), E = $(
2949
+ function ne({ appearance: a, signInUrl: s, onSignIn: r }) {
2950
+ const { appearance: o, settings: n } = A(), { signUp: u, isLoading: i, error: l, setError: d } = ka(), { signInWithOAuth: c } = na(), f = a ?? o, [p, m] = g(""), [b, N] = g(""), [y, O] = g(""), [h, S] = g(!1), [k, P] = g(null), I = $(
2654
2951
  async (x) => {
2655
- if (x.preventDefault(), z(null), b !== y) {
2656
- z("Passwords do not match");
2952
+ if (x.preventDefault(), P(null), b !== y) {
2953
+ P("Passwords do not match");
2657
2954
  return;
2658
2955
  }
2659
2956
  const v = (n == null ? void 0 : n.passwordMinLength) ?? 8;
2660
2957
  if (b.length < v) {
2661
- z(`Password must be at least ${v} characters`);
2958
+ P(`Password must be at least ${v} characters`);
2662
2959
  return;
2663
2960
  }
2664
2961
  await u(p, b);
2665
2962
  },
2666
2963
  [p, b, y, n, u]
2667
- ), I = $(
2964
+ ), F = $(
2668
2965
  async (x) => {
2669
- await i(x);
2966
+ await c(x);
2670
2967
  },
2671
- [i]
2672
- ), A = (n == null ? void 0 : n.googleEnabled) || (n == null ? void 0 : n.githubEnabled), S = k || c;
2673
- return /* @__PURE__ */ e(q, { appearance: f, children: /* @__PURE__ */ r("div", { style: { display: "flex", flexDirection: "column", alignItems: "center", width: "100%", maxWidth: "520px" }, children: [
2674
- /* @__PURE__ */ r("div", { className: "ss-auth-header", children: [
2675
- /* @__PURE__ */ e("div", { className: "ss-auth-brand-icon-gradient", children: /* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: P.autoAwesome }) }),
2968
+ [c]
2969
+ ), B = (n == null ? void 0 : n.googleEnabled) || (n == null ? void 0 : n.githubEnabled), C = k || l;
2970
+ return /* @__PURE__ */ e(H, { appearance: f, children: /* @__PURE__ */ t("div", { style: { display: "flex", flexDirection: "column", alignItems: "center", width: "100%", maxWidth: "520px" }, children: [
2971
+ /* @__PURE__ */ t("div", { className: "ss-auth-header", children: [
2972
+ /* @__PURE__ */ e("div", { className: "ss-auth-brand-icon-gradient", children: /* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: w.autoAwesome }) }),
2676
2973
  /* @__PURE__ */ e("h1", { className: "ss-auth-title ss-auth-title-lg", children: "Create your account" }),
2677
2974
  /* @__PURE__ */ e("p", { className: "ss-auth-subtitle", children: "Join the ecosystem" })
2678
2975
  ] }),
2679
- /* @__PURE__ */ e("div", { className: "ss-auth-card", children: /* @__PURE__ */ r("div", { className: "ss-auth-card-body", children: [
2680
- A && /* @__PURE__ */ r(G, { children: [
2681
- /* @__PURE__ */ r("div", { className: "ss-auth-oauth-grid", children: [
2682
- (n == null ? void 0 : n.googleEnabled) && /* @__PURE__ */ r(
2976
+ /* @__PURE__ */ e("div", { className: "ss-auth-card", children: /* @__PURE__ */ t("div", { className: "ss-auth-card-body", children: [
2977
+ B && /* @__PURE__ */ t(j, { children: [
2978
+ /* @__PURE__ */ t("div", { className: "ss-auth-oauth-grid", children: [
2979
+ (n == null ? void 0 : n.googleEnabled) && /* @__PURE__ */ t(
2683
2980
  "button",
2684
2981
  {
2685
2982
  type: "button",
2686
2983
  className: "ss-auth-btn-social",
2687
- onClick: () => I("google"),
2688
- disabled: l,
2984
+ onClick: () => F("google"),
2985
+ disabled: i,
2689
2986
  children: [
2690
2987
  /* @__PURE__ */ e("span", { dangerouslySetInnerHTML: { __html: ia } }),
2691
2988
  "Google"
2692
2989
  ]
2693
2990
  }
2694
2991
  ),
2695
- (n == null ? void 0 : n.githubEnabled) && /* @__PURE__ */ r(
2992
+ (n == null ? void 0 : n.githubEnabled) && /* @__PURE__ */ t(
2696
2993
  "button",
2697
2994
  {
2698
2995
  type: "button",
2699
2996
  className: "ss-auth-btn-social",
2700
- onClick: () => I("github"),
2701
- disabled: l,
2997
+ onClick: () => F("github"),
2998
+ disabled: i,
2702
2999
  children: [
2703
3000
  /* @__PURE__ */ e("span", { dangerouslySetInnerHTML: { __html: la } }),
2704
3001
  "GitHub"
@@ -2708,12 +3005,12 @@ function te({ appearance: a, signInUrl: s, onSignIn: t }) {
2708
3005
  ] }),
2709
3006
  /* @__PURE__ */ e("div", { className: "ss-auth-divider", children: "or sign up with email" })
2710
3007
  ] }),
2711
- S && /* @__PURE__ */ r("div", { className: "ss-auth-error", children: [
2712
- /* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: P.errorOutline }),
2713
- /* @__PURE__ */ e("span", { children: S })
3008
+ C && /* @__PURE__ */ t("div", { className: "ss-auth-error", children: [
3009
+ /* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: w.errorOutline }),
3010
+ /* @__PURE__ */ e("span", { children: C })
2714
3011
  ] }),
2715
- /* @__PURE__ */ r("form", { onSubmit: E, children: [
2716
- /* @__PURE__ */ r("div", { className: "ss-auth-field", children: [
3012
+ /* @__PURE__ */ t("form", { onSubmit: I, children: [
3013
+ /* @__PURE__ */ t("div", { className: "ss-auth-field", children: [
2717
3014
  /* @__PURE__ */ e("label", { className: "ss-auth-label", htmlFor: "ss-signup-email", children: "Email" }),
2718
3015
  /* @__PURE__ */ e(
2719
3016
  "input",
@@ -2729,9 +3026,9 @@ function te({ appearance: a, signInUrl: s, onSignIn: t }) {
2729
3026
  }
2730
3027
  )
2731
3028
  ] }),
2732
- /* @__PURE__ */ r("div", { className: "ss-auth-field", children: [
3029
+ /* @__PURE__ */ t("div", { className: "ss-auth-field", children: [
2733
3030
  /* @__PURE__ */ e("label", { className: "ss-auth-label", htmlFor: "ss-signup-password", children: "Password" }),
2734
- /* @__PURE__ */ r("div", { style: { position: "relative" }, children: [
3031
+ /* @__PURE__ */ t("div", { style: { position: "relative" }, children: [
2735
3032
  /* @__PURE__ */ e(
2736
3033
  "input",
2737
3034
  {
@@ -2742,7 +3039,7 @@ function te({ appearance: a, signInUrl: s, onSignIn: t }) {
2742
3039
  placeholder: "••••••••",
2743
3040
  value: b,
2744
3041
  onChange: (x) => {
2745
- w(x.target.value), z(null);
3042
+ N(x.target.value), P(null);
2746
3043
  },
2747
3044
  required: !0
2748
3045
  }
@@ -2752,13 +3049,13 @@ function te({ appearance: a, signInUrl: s, onSignIn: t }) {
2752
3049
  {
2753
3050
  type: "button",
2754
3051
  className: "ss-auth-visibility-toggle",
2755
- onClick: () => N(!h),
2756
- children: /* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: h ? P.visibilityOff : P.visibility })
3052
+ onClick: () => S(!h),
3053
+ children: /* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: h ? w.visibilityOff : w.visibility })
2757
3054
  }
2758
3055
  )
2759
3056
  ] })
2760
3057
  ] }),
2761
- /* @__PURE__ */ r("div", { className: "ss-auth-field", children: [
3058
+ /* @__PURE__ */ t("div", { className: "ss-auth-field", children: [
2762
3059
  /* @__PURE__ */ e("label", { className: "ss-auth-label", htmlFor: "ss-signup-confirm", children: "Confirm Password" }),
2763
3060
  /* @__PURE__ */ e(
2764
3061
  "input",
@@ -2770,85 +3067,85 @@ function te({ appearance: a, signInUrl: s, onSignIn: t }) {
2770
3067
  placeholder: "••••••••",
2771
3068
  value: y,
2772
3069
  onChange: (x) => {
2773
- C(x.target.value), z(null);
3070
+ O(x.target.value), P(null);
2774
3071
  },
2775
3072
  required: !0
2776
3073
  }
2777
3074
  )
2778
3075
  ] }),
2779
- /* @__PURE__ */ r("button", { type: "submit", className: "ss-auth-btn-primary", disabled: l, children: [
2780
- l && /* @__PURE__ */ e("span", { className: "ss-auth-spinner" }),
3076
+ /* @__PURE__ */ t("button", { type: "submit", className: "ss-auth-btn-primary", disabled: i, children: [
3077
+ i && /* @__PURE__ */ e("span", { className: "ss-auth-spinner" }),
2781
3078
  "Sign up",
2782
- !l && /* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: P.arrowForward })
3079
+ !i && /* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: w.arrowForward })
2783
3080
  ] })
2784
3081
  ] }),
2785
- /* @__PURE__ */ r("div", { className: "ss-auth-footer", children: [
3082
+ /* @__PURE__ */ t("div", { className: "ss-auth-footer", children: [
2786
3083
  "Already have an account?",
2787
3084
  " ",
2788
- t ? /* @__PURE__ */ e("span", { className: "ss-auth-link", onClick: t, children: "Sign in" }) : s ? /* @__PURE__ */ e("a", { className: "ss-auth-link", href: s, children: "Sign in" }) : /* @__PURE__ */ e("span", { className: "ss-auth-link", children: "Sign in" })
3085
+ r ? /* @__PURE__ */ e("span", { className: "ss-auth-link", onClick: r, children: "Sign in" }) : s ? /* @__PURE__ */ e("a", { className: "ss-auth-link", href: s, children: "Sign in" }) : /* @__PURE__ */ e("span", { className: "ss-auth-link", children: "Sign in" })
2789
3086
  ] })
2790
3087
  ] }) })
2791
3088
  ] }) });
2792
3089
  }
2793
- const B = 320, j = 128;
2794
- function Pa({ file: a, onCrop: s, onCancel: t }) {
2795
- const o = W(null), n = W(null), [u, l] = g(1), [c, d] = g({ x: 0, y: 0 }), [i, f] = g(!1), p = W({ x: 0, y: 0, ox: 0, oy: 0 }), [m, b] = g(!1);
2796
- V(() => {
2797
- const h = new Image(), N = URL.createObjectURL(a);
3090
+ const T = 320, q = 128;
3091
+ function za({ file: a, onCrop: s, onCancel: r }) {
3092
+ const o = _(null), n = _(null), [u, i] = g(1), [l, d] = g({ x: 0, y: 0 }), [c, f] = g(!1), p = _({ x: 0, y: 0, ox: 0, oy: 0 }), [m, b] = g(!1);
3093
+ U(() => {
3094
+ const h = new Image(), S = URL.createObjectURL(a);
2798
3095
  return h.onload = () => {
2799
- n.current = h, b(!0), d({ x: 0, y: 0 }), l(1);
2800
- }, h.src = N, () => URL.revokeObjectURL(N);
2801
- }, [a]), V(() => {
3096
+ n.current = h, b(!0), d({ x: 0, y: 0 }), i(1);
3097
+ }, h.src = S, () => URL.revokeObjectURL(S);
3098
+ }, [a]), U(() => {
2802
3099
  if (!m || !n.current || !o.current) return;
2803
3100
  const h = o.current.getContext("2d");
2804
3101
  if (!h) return;
2805
- const N = n.current;
2806
- h.clearRect(0, 0, B, B), h.fillStyle = "#111", h.fillRect(0, 0, B, B);
2807
- const k = Math.max(B / N.width, B / N.height) * u, z = N.width * k, E = N.height * k, I = (B - z) / 2 + c.x, A = (B - E) / 2 + c.y;
2808
- h.save(), h.beginPath(), h.arc(B / 2, B / 2, j, 0, Math.PI * 2), h.clip(), h.drawImage(N, I, A, z, E), 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, j, 0, Math.PI * 2), h.fill(), h.restore(), h.save(), h.beginPath(), h.arc(B / 2, B / 2, j, 0, Math.PI * 2), h.clip(), h.drawImage(N, I, A, z, E), h.restore(), h.strokeStyle = "rgba(255, 255, 255, 0.4)", h.lineWidth = 2, h.beginPath(), h.arc(B / 2, B / 2, j, 0, Math.PI * 2), h.stroke();
2809
- }, [u, c, m]);
2810
- const w = $(
3102
+ const S = n.current;
3103
+ h.clearRect(0, 0, T, T), h.fillStyle = "#111", h.fillRect(0, 0, T, T);
3104
+ const k = Math.max(T / S.width, T / S.height) * u, P = S.width * k, I = S.height * k, F = (T - P) / 2 + l.x, B = (T - I) / 2 + l.y;
3105
+ h.save(), h.beginPath(), h.arc(T / 2, T / 2, q, 0, Math.PI * 2), h.clip(), h.drawImage(S, F, B, P, I), h.restore(), h.save(), h.fillStyle = "rgba(0, 0, 0, 0.6)", h.fillRect(0, 0, T, T), h.globalCompositeOperation = "destination-out", h.beginPath(), h.arc(T / 2, T / 2, q, 0, Math.PI * 2), h.fill(), h.restore(), h.save(), h.beginPath(), h.arc(T / 2, T / 2, q, 0, Math.PI * 2), h.clip(), h.drawImage(S, F, B, P, I), h.restore(), h.strokeStyle = "rgba(255, 255, 255, 0.4)", h.lineWidth = 2, h.beginPath(), h.arc(T / 2, T / 2, q, 0, Math.PI * 2), h.stroke();
3106
+ }, [u, l, m]);
3107
+ const N = $(
2811
3108
  (h) => {
2812
- f(!0), p.current = { x: h.clientX, y: h.clientY, ox: c.x, oy: c.y }, h.target.setPointerCapture(h.pointerId);
3109
+ f(!0), p.current = { x: h.clientX, y: h.clientY, ox: l.x, oy: l.y }, h.target.setPointerCapture(h.pointerId);
2813
3110
  },
2814
- [c]
3111
+ [l]
2815
3112
  ), y = $(
2816
3113
  (h) => {
2817
- i && d({
3114
+ c && d({
2818
3115
  x: p.current.ox + (h.clientX - p.current.x),
2819
3116
  y: p.current.oy + (h.clientY - p.current.y)
2820
3117
  });
2821
3118
  },
2822
- [i]
2823
- ), C = $(() => f(!1), []);
3119
+ [c]
3120
+ ), O = $(() => f(!1), []);
2824
3121
  return $(() => {
2825
3122
  if (!n.current) return;
2826
- const h = document.createElement("canvas"), N = j * 2;
2827
- h.width = N, h.height = N;
3123
+ const h = document.createElement("canvas"), S = q * 2;
3124
+ h.width = S, h.height = S;
2828
3125
  const k = h.getContext("2d");
2829
3126
  if (!k) return;
2830
- const z = n.current, E = Math.max(B / z.width, B / z.height) * u, I = z.width * E, A = z.height * E, S = (B - I) / 2 + c.x - (B / 2 - j), x = (B - A) / 2 + c.y - (B / 2 - j);
2831
- k.beginPath(), k.arc(j, j, j, 0, Math.PI * 2), k.clip(), k.drawImage(z, S, x, I, A), h.toBlob((v) => {
3127
+ const P = n.current, I = Math.max(T / P.width, T / P.height) * u, F = P.width * I, B = P.height * I, C = (T - F) / 2 + l.x - (T / 2 - q), x = (T - B) / 2 + l.y - (T / 2 - q);
3128
+ k.beginPath(), k.arc(q, q, q, 0, Math.PI * 2), k.clip(), k.drawImage(P, C, x, F, B), h.toBlob((v) => {
2832
3129
  v && s(v);
2833
3130
  }, "image/png");
2834
- }, [u, c, s]), /* @__PURE__ */ r("div", { style: { display: "flex", flexDirection: "column", alignItems: "center", gap: "24px" }, children: [
2835
- /* @__PURE__ */ r("div", { className: "ss-auth-crop-area", children: [
3131
+ }, [u, l, s]), /* @__PURE__ */ t("div", { style: { display: "flex", flexDirection: "column", alignItems: "center", gap: "24px" }, children: [
3132
+ /* @__PURE__ */ t("div", { className: "ss-auth-crop-area", children: [
2836
3133
  /* @__PURE__ */ e(
2837
3134
  "canvas",
2838
3135
  {
2839
3136
  ref: o,
2840
- width: B,
2841
- height: B,
2842
- style: { cursor: i ? "grabbing" : "grab", width: "100%", height: "100%" },
2843
- onPointerDown: w,
3137
+ width: T,
3138
+ height: T,
3139
+ style: { cursor: c ? "grabbing" : "grab", width: "100%", height: "100%" },
3140
+ onPointerDown: N,
2844
3141
  onPointerMove: y,
2845
- onPointerUp: C
3142
+ onPointerUp: O
2846
3143
  }
2847
3144
  ),
2848
3145
  /* @__PURE__ */ e("div", { className: "ss-auth-crop-size-badge", children: "256 x 256 px" })
2849
3146
  ] }),
2850
- /* @__PURE__ */ r("div", { className: "ss-auth-zoom-control", style: { width: "100%", maxWidth: "280px" }, children: [
2851
- /* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: P.zoomOut }),
3147
+ /* @__PURE__ */ t("div", { className: "ss-auth-zoom-control", style: { width: "100%", maxWidth: "280px" }, children: [
3148
+ /* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: w.zoomOut }),
2852
3149
  /* @__PURE__ */ e(
2853
3150
  "input",
2854
3151
  {
@@ -2857,16 +3154,16 @@ function Pa({ file: a, onCrop: s, onCancel: t }) {
2857
3154
  max: "3",
2858
3155
  step: "0.01",
2859
3156
  value: u,
2860
- onChange: (h) => l(parseFloat(h.target.value)),
3157
+ onChange: (h) => i(parseFloat(h.target.value)),
2861
3158
  className: "ss-auth-zoom-slider"
2862
3159
  }
2863
3160
  ),
2864
- /* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: P.zoomIn })
3161
+ /* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: w.zoomIn })
2865
3162
  ] })
2866
3163
  ] });
2867
3164
  }
2868
- function ca({ onUpload: a, onClose: s, isLoading: t }) {
2869
- const [o, n] = g(null), [u, l] = g(!1), [c, d] = g(null), i = W(null), f = $((b) => {
3165
+ function ca({ onUpload: a, onClose: s, isLoading: r }) {
3166
+ const [o, n] = g(null), [u, i] = g(!1), [l, d] = g(null), c = _(null), f = $((b) => {
2870
3167
  if (!b.type.startsWith("image/")) {
2871
3168
  d("Please select an image file");
2872
3169
  return;
@@ -2878,9 +3175,9 @@ function ca({ onUpload: a, onClose: s, isLoading: t }) {
2878
3175
  d(null), n(b);
2879
3176
  }, []), p = $(
2880
3177
  (b) => {
2881
- b.preventDefault(), l(!1);
2882
- const w = b.dataTransfer.files[0];
2883
- w && f(w);
3178
+ b.preventDefault(), i(!1);
3179
+ const N = b.dataTransfer.files[0];
3180
+ N && f(N);
2884
3181
  },
2885
3182
  [f]
2886
3183
  ), m = $(
@@ -2891,18 +3188,18 @@ function ca({ onUpload: a, onClose: s, isLoading: t }) {
2891
3188
  );
2892
3189
  return /* @__PURE__ */ e("div", { className: "ss-auth-modal-overlay", onClick: (b) => {
2893
3190
  b.target === b.currentTarget && s();
2894
- }, children: /* @__PURE__ */ r("div", { className: "ss-auth-modal ss-auth-card-wide", children: [
2895
- /* @__PURE__ */ r("div", { className: "ss-auth-modal-header", children: [
3191
+ }, children: /* @__PURE__ */ t("div", { className: "ss-auth-modal ss-auth-card-wide", children: [
3192
+ /* @__PURE__ */ t("div", { className: "ss-auth-modal-header", children: [
2896
3193
  /* @__PURE__ */ e("h2", { children: "Upload avatar" }),
2897
- /* @__PURE__ */ e("button", { type: "button", className: "ss-auth-modal-close", onClick: s, children: /* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: P.close }) })
3194
+ /* @__PURE__ */ e("button", { type: "button", className: "ss-auth-modal-close", onClick: s, children: /* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: w.close }) })
2898
3195
  ] }),
2899
- /* @__PURE__ */ r("div", { className: "ss-auth-modal-body", children: [
2900
- c && /* @__PURE__ */ r("div", { className: "ss-auth-error", style: { marginBottom: "24px" }, children: [
2901
- /* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: P.errorOutline }),
2902
- /* @__PURE__ */ e("span", { children: c })
3196
+ /* @__PURE__ */ t("div", { className: "ss-auth-modal-body", children: [
3197
+ l && /* @__PURE__ */ t("div", { className: "ss-auth-error", style: { marginBottom: "24px" }, children: [
3198
+ /* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: w.errorOutline }),
3199
+ /* @__PURE__ */ e("span", { children: l })
2903
3200
  ] }),
2904
- /* @__PURE__ */ r("div", { className: "ss-auth-upload-grid", children: [
2905
- /* @__PURE__ */ e("div", { children: o ? /* @__PURE__ */ e(Pa, { file: o, onCrop: m, onCancel: () => n(null) }) : /* @__PURE__ */ r(
3201
+ /* @__PURE__ */ t("div", { className: "ss-auth-upload-grid", children: [
3202
+ /* @__PURE__ */ e("div", { children: o ? /* @__PURE__ */ e(za, { file: o, onCrop: m, onCancel: () => n(null) }) : /* @__PURE__ */ t(
2906
3203
  "div",
2907
3204
  {
2908
3205
  className: "ss-auth-crop-area",
@@ -2916,30 +3213,30 @@ function ca({ onUpload: a, onClose: s, isLoading: t }) {
2916
3213
  aspectRatio: "1"
2917
3214
  },
2918
3215
  children: [
2919
- /* @__PURE__ */ e("span", { className: "material-symbols-outlined", style: { fontSize: "48px", opacity: 0.3 }, children: P.image }),
3216
+ /* @__PURE__ */ e("span", { className: "material-symbols-outlined", style: { fontSize: "48px", opacity: 0.3 }, children: w.image }),
2920
3217
  /* @__PURE__ */ e("span", { style: { fontSize: "12px", opacity: 0.4 }, children: "No image selected" })
2921
3218
  ]
2922
3219
  }
2923
3220
  ) }),
2924
- /* @__PURE__ */ r("div", { style: { display: "flex", flexDirection: "column", gap: "16px" }, children: [
2925
- /* @__PURE__ */ r(
3221
+ /* @__PURE__ */ t("div", { style: { display: "flex", flexDirection: "column", gap: "16px" }, children: [
3222
+ /* @__PURE__ */ t(
2926
3223
  "div",
2927
3224
  {
2928
3225
  className: `ss-auth-dropzone${u ? " ss-auth-dropzone-active" : ""}`,
2929
3226
  onDragOver: (b) => {
2930
- b.preventDefault(), l(!0);
3227
+ b.preventDefault(), i(!0);
2931
3228
  },
2932
- onDragLeave: () => l(!1),
3229
+ onDragLeave: () => i(!1),
2933
3230
  onDrop: p,
2934
3231
  onClick: () => {
2935
3232
  var b;
2936
- return (b = i.current) == null ? void 0 : b.click();
3233
+ return (b = c.current) == null ? void 0 : b.click();
2937
3234
  },
2938
3235
  style: { minHeight: "180px" },
2939
3236
  children: [
2940
- /* @__PURE__ */ e("div", { className: "ss-auth-dropzone-icon", children: /* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: P.cloudUpload }) }),
3237
+ /* @__PURE__ */ e("div", { className: "ss-auth-dropzone-icon", children: /* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: w.cloudUpload }) }),
2941
3238
  /* @__PURE__ */ e("span", { className: "ss-auth-dropzone-title", children: "Drag and drop" }),
2942
- /* @__PURE__ */ r("span", { className: "ss-auth-dropzone-desc", children: [
3239
+ /* @__PURE__ */ t("span", { className: "ss-auth-dropzone-desc", children: [
2943
3240
  "JPG, PNG or WEBP",
2944
3241
  /* @__PURE__ */ e("br", {}),
2945
3242
  "Max file size 5 MB"
@@ -2948,105 +3245,697 @@ function ca({ onUpload: a, onClose: s, isLoading: t }) {
2948
3245
  /* @__PURE__ */ e(
2949
3246
  "input",
2950
3247
  {
2951
- ref: i,
3248
+ ref: c,
2952
3249
  type: "file",
2953
3250
  accept: "image/*",
2954
3251
  style: { display: "none" },
2955
3252
  onChange: (b) => {
2956
- var w;
2957
- (w = b.target.files) != null && w[0] && f(b.target.files[0]);
3253
+ var N;
3254
+ (N = b.target.files) != null && N[0] && f(b.target.files[0]);
2958
3255
  }
2959
3256
  }
2960
3257
  )
2961
3258
  ]
2962
3259
  }
2963
3260
  ),
2964
- /* @__PURE__ */ r("div", { className: "ss-auth-info-box", children: [
2965
- /* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: P.info }),
3261
+ /* @__PURE__ */ t("div", { className: "ss-auth-info-box", children: [
3262
+ /* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: w.info }),
2966
3263
  /* @__PURE__ */ e("span", { children: "Your profile photo will be visible to all members of your organization." })
2967
3264
  ] })
2968
3265
  ] })
2969
3266
  ] })
2970
3267
  ] }),
2971
- /* @__PURE__ */ r("div", { className: "ss-auth-modal-footer", children: [
3268
+ /* @__PURE__ */ t("div", { className: "ss-auth-modal-footer", children: [
2972
3269
  /* @__PURE__ */ e("button", { type: "button", className: "ss-auth-btn-ghost", onClick: s, children: "Cancel" }),
2973
- /* @__PURE__ */ r(
3270
+ /* @__PURE__ */ t(
2974
3271
  "button",
2975
3272
  {
2976
3273
  type: "button",
2977
3274
  className: "ss-auth-btn-primary ss-auth-btn-sm",
2978
3275
  onClick: () => {
2979
3276
  },
2980
- disabled: !o || t,
3277
+ disabled: !o || r,
2981
3278
  style: { width: "auto" },
2982
3279
  children: [
2983
- t && /* @__PURE__ */ e("span", { className: "ss-auth-spinner" }),
3280
+ r && /* @__PURE__ */ e("span", { className: "ss-auth-spinner" }),
2984
3281
  "Save Profile",
2985
- !t && /* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: P.check })
3282
+ !r && /* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: w.check })
2986
3283
  ]
2987
3284
  }
2988
3285
  )
2989
3286
  ] })
2990
3287
  ] }) });
2991
3288
  }
2992
- function re({
2993
- appearance: a,
2994
- afterSignOutUrl: s,
2995
- afterDeleteAccountUrl: t,
2996
- showOrgSwitcher: o = !0,
2997
- onOrgChange: n,
2998
- onOrgSettingsClick: u
2999
- }) {
3000
- const { appearance: l } = L(), { user: c, signOut: d } = ta(), i = a ?? l, [f, p] = g(!1), [m, b] = g(!1), [w, y] = g(""), [C, h] = g(null), [N, k] = g(!1), z = W(null), { orgs: E, selectedOrg: I, selectOrg: A, createOrg: S } = na(), x = $((O) => {
3001
- z.current && !O.composedPath().includes(z.current) && p(!1);
3002
- }, []);
3003
- V(() => {
3289
+ function Pa({ onClose: a, afterDeleteAccountUrl: s, defaultTab: r = "profile" }) {
3290
+ const [o, n] = g(r), u = [
3291
+ { key: "profile", label: "Profile", icon: w.person },
3292
+ { key: "organization", label: "Organization", icon: w.corporateFare },
3293
+ { key: "people", label: "People", icon: w.group },
3294
+ { key: "billing", label: "Billing", icon: w.creditCard }
3295
+ ];
3296
+ return /* @__PURE__ */ e("div", { className: "ss-auth-modal-overlay", onClick: (i) => {
3297
+ i.target === i.currentTarget && a();
3298
+ }, children: /* @__PURE__ */ t("div", { className: "ss-auth-settings-page", children: [
3299
+ /* @__PURE__ */ t("div", { className: "ss-auth-settings-header", children: [
3300
+ /* @__PURE__ */ e("h2", { children: "Settings" }),
3301
+ /* @__PURE__ */ e("button", { type: "button", className: "ss-auth-modal-close", onClick: a, children: /* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: w.close }) })
3302
+ ] }),
3303
+ /* @__PURE__ */ t("div", { className: "ss-auth-settings-layout", children: [
3304
+ /* @__PURE__ */ e("nav", { className: "ss-auth-settings-nav", children: u.map((i) => /* @__PURE__ */ t(
3305
+ "button",
3306
+ {
3307
+ type: "button",
3308
+ className: `ss-auth-settings-nav-item${o === i.key ? " ss-auth-settings-nav-item-active" : ""}`,
3309
+ onClick: () => n(i.key),
3310
+ children: [
3311
+ /* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: i.icon }),
3312
+ i.label
3313
+ ]
3314
+ },
3315
+ i.key
3316
+ )) }),
3317
+ /* @__PURE__ */ t("div", { className: "ss-auth-settings-content", children: [
3318
+ o === "profile" && /* @__PURE__ */ e(Oa, { afterDeleteAccountUrl: s }),
3319
+ o === "organization" && /* @__PURE__ */ e(Ea, {}),
3320
+ o === "people" && /* @__PURE__ */ e(Ia, {}),
3321
+ o === "billing" && /* @__PURE__ */ e(Fa, {})
3322
+ ] })
3323
+ ] })
3324
+ ] }) });
3325
+ }
3326
+ function Oa({ afterDeleteAccountUrl: a }) {
3327
+ const { user: s, updateProfile: r, uploadAvatar: o, changePassword: n, isLoading: u, error: i, success: l, setError: d, setSuccess: c } = oa(), { signOut: f } = sa(), { deleteAccount: p, isLoading: m, error: b, setError: N } = Ca(), [y, O] = g((s == null ? void 0 : s.name) ?? ""), [h, S] = g((s == null ? void 0 : s.avatarUrl) ?? ""), [k, P] = g(!1), [I, F] = g(""), [B, C] = g(""), [x, v] = g(""), [E, M] = g(null), [V, D] = g(!1), [z, L] = g(""), W = $(
3328
+ async (R) => {
3329
+ R.preventDefault(), d(null), c(null), await r({ name: y, avatarUrl: h || void 0 });
3330
+ },
3331
+ [y, h, r, d, c]
3332
+ ), K = $(
3333
+ async (R) => {
3334
+ const X = await o(R);
3335
+ X && (S(X.avatarUrl), P(!1));
3336
+ },
3337
+ [o]
3338
+ ), J = $(
3339
+ async (R) => {
3340
+ if (R.preventDefault(), M(null), d(null), c(null), B !== x) {
3341
+ M("Passwords do not match");
3342
+ return;
3343
+ }
3344
+ if (B.length < 8) {
3345
+ M("Password must be at least 8 characters");
3346
+ return;
3347
+ }
3348
+ await n(I, B) && (F(""), C(""), v(""));
3349
+ },
3350
+ [I, B, x, n, d, c]
3351
+ ), ua = $(async () => {
3352
+ await p() && (await f(), a && (window.location.href = a));
3353
+ }, [p, f, a]), pa = (s == null ? void 0 : s.provider) === "email", ha = z === (s == null ? void 0 : s.email), ga = ((s == null ? void 0 : s.name) || (s == null ? void 0 : s.email) || "?").charAt(0).toUpperCase();
3354
+ return /* @__PURE__ */ t(j, { children: [
3355
+ /* @__PURE__ */ e("h3", { children: "Profile" }),
3356
+ /* @__PURE__ */ t("div", { className: "ss-auth-settings-card", children: [
3357
+ /* @__PURE__ */ t("div", { className: "ss-auth-profile-header", style: { border: "none", background: "none", padding: 0, marginBottom: 16 }, children: [
3358
+ /* @__PURE__ */ t("div", { className: "ss-auth-avatar-lg", onClick: () => P(!0), children: [
3359
+ h ? /* @__PURE__ */ e("img", { src: h, alt: "" }) : /* @__PURE__ */ e("div", { style: {
3360
+ width: "100%",
3361
+ height: "100%",
3362
+ display: "flex",
3363
+ alignItems: "center",
3364
+ justifyContent: "center",
3365
+ fontSize: "48px",
3366
+ fontWeight: 800,
3367
+ opacity: 0.4
3368
+ }, children: ga }),
3369
+ /* @__PURE__ */ t("div", { className: "ss-auth-avatar-overlay", children: [
3370
+ /* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: w.camera }),
3371
+ /* @__PURE__ */ e("span", { children: "Edit" })
3372
+ ] })
3373
+ ] }),
3374
+ /* @__PURE__ */ t("div", { className: "ss-auth-profile-info", children: [
3375
+ /* @__PURE__ */ t("h2", { className: "ss-auth-profile-name", children: [
3376
+ (s == null ? void 0 : s.name) || "Unnamed User",
3377
+ (s == null ? void 0 : s.emailVerified) && /* @__PURE__ */ t("span", { className: "ss-auth-badge ss-auth-badge-success", children: [
3378
+ /* @__PURE__ */ e("span", { className: "material-symbols-outlined", style: { fontSize: "12px", fontVariationSettings: "'FILL' 1" }, children: w.verified }),
3379
+ "Verified"
3380
+ ] })
3381
+ ] }),
3382
+ /* @__PURE__ */ e("p", { className: "ss-auth-profile-desc", children: s == null ? void 0 : s.email })
3383
+ ] })
3384
+ ] }),
3385
+ i && /* @__PURE__ */ t("div", { className: "ss-auth-error", children: [
3386
+ /* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: w.errorOutline }),
3387
+ /* @__PURE__ */ e("span", { children: i })
3388
+ ] }),
3389
+ l && /* @__PURE__ */ t("div", { className: "ss-auth-info-box", style: { marginBottom: "16px" }, children: [
3390
+ /* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: w.check }),
3391
+ /* @__PURE__ */ e("span", { children: l })
3392
+ ] }),
3393
+ /* @__PURE__ */ t("form", { onSubmit: W, children: [
3394
+ /* @__PURE__ */ t("div", { className: "ss-auth-field", children: [
3395
+ /* @__PURE__ */ e("label", { className: "ss-auth-label", children: "Full Name" }),
3396
+ /* @__PURE__ */ e(
3397
+ "input",
3398
+ {
3399
+ className: "ss-auth-input",
3400
+ type: "text",
3401
+ placeholder: "Your name",
3402
+ value: y,
3403
+ onChange: (R) => O(R.target.value)
3404
+ }
3405
+ )
3406
+ ] }),
3407
+ /* @__PURE__ */ t("div", { className: "ss-auth-profile-grid", style: { marginBottom: "16px" }, children: [
3408
+ /* @__PURE__ */ t("div", { children: [
3409
+ /* @__PURE__ */ e("label", { className: "ss-auth-label", children: "Email Address" }),
3410
+ /* @__PURE__ */ t("div", { style: { position: "relative" }, children: [
3411
+ /* @__PURE__ */ e("input", { className: "ss-auth-input ss-auth-input-readonly", type: "email", value: (s == null ? void 0 : s.email) ?? "", readOnly: !0 }),
3412
+ /* @__PURE__ */ e("span", { className: "ss-auth-visibility-toggle", style: { cursor: "default" }, children: /* @__PURE__ */ e("span", { className: "material-symbols-outlined", style: { fontSize: "18px" }, children: w.lock }) })
3413
+ ] })
3414
+ ] }),
3415
+ /* @__PURE__ */ t("div", { children: [
3416
+ /* @__PURE__ */ e("label", { className: "ss-auth-label", children: "Auth Provider" }),
3417
+ /* @__PURE__ */ e("input", { className: "ss-auth-input ss-auth-input-readonly", type: "text", value: (s == null ? void 0 : s.provider) ?? "", readOnly: !0 })
3418
+ ] })
3419
+ ] }),
3420
+ /* @__PURE__ */ e("div", { style: { display: "flex", justifyContent: "flex-end" }, children: /* @__PURE__ */ t("button", { type: "submit", className: "ss-auth-btn-primary ss-auth-btn-sm", disabled: u, style: { width: "auto" }, children: [
3421
+ u && /* @__PURE__ */ e("span", { className: "ss-auth-spinner" }),
3422
+ "Save changes"
3423
+ ] }) })
3424
+ ] })
3425
+ ] }),
3426
+ pa && /* @__PURE__ */ t("div", { className: "ss-auth-settings-card", children: [
3427
+ /* @__PURE__ */ t("h4", { children: [
3428
+ /* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: w.security }),
3429
+ "Security Credentials"
3430
+ ] }),
3431
+ E && /* @__PURE__ */ t("div", { className: "ss-auth-error", style: { marginBottom: "16px" }, children: [
3432
+ /* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: w.errorOutline }),
3433
+ /* @__PURE__ */ e("span", { children: E })
3434
+ ] }),
3435
+ /* @__PURE__ */ t("form", { onSubmit: J, children: [
3436
+ /* @__PURE__ */ t("div", { className: "ss-auth-field", children: [
3437
+ /* @__PURE__ */ e("label", { className: "ss-auth-label", children: "Current Password" }),
3438
+ /* @__PURE__ */ e("input", { className: "ss-auth-input", type: "password", placeholder: "••••••••••••", value: I, onChange: (R) => F(R.target.value), required: !0 })
3439
+ ] }),
3440
+ /* @__PURE__ */ t("div", { className: "ss-auth-profile-grid", style: { marginBottom: "16px" }, children: [
3441
+ /* @__PURE__ */ t("div", { children: [
3442
+ /* @__PURE__ */ e("label", { className: "ss-auth-label", children: "New Password" }),
3443
+ /* @__PURE__ */ e("input", { className: "ss-auth-input", type: "password", placeholder: "Min. 8 characters", value: B, onChange: (R) => C(R.target.value), required: !0 })
3444
+ ] }),
3445
+ /* @__PURE__ */ t("div", { children: [
3446
+ /* @__PURE__ */ e("label", { className: "ss-auth-label", children: "Confirm New Password" }),
3447
+ /* @__PURE__ */ e("input", { className: "ss-auth-input", type: "password", placeholder: "Repeat new password", value: x, onChange: (R) => v(R.target.value), required: !0 })
3448
+ ] })
3449
+ ] }),
3450
+ /* @__PURE__ */ e("div", { style: { display: "flex", justifyContent: "flex-end" }, children: /* @__PURE__ */ e("button", { type: "submit", className: "ss-auth-btn-ghost", disabled: u, children: "Update Security" }) })
3451
+ ] })
3452
+ ] }),
3453
+ /* @__PURE__ */ t("div", { className: "ss-auth-settings-card ss-auth-settings-danger", children: [
3454
+ /* @__PURE__ */ e("h4", { children: "Danger Zone" }),
3455
+ /* @__PURE__ */ e("p", { className: "ss-auth-section-desc", style: { marginBottom: "16px" }, children: "Deleting your account is permanent. All organizations you own will also be deleted." }),
3456
+ b && /* @__PURE__ */ t("div", { className: "ss-auth-error", children: [
3457
+ /* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: w.errorOutline }),
3458
+ /* @__PURE__ */ e("span", { children: b })
3459
+ ] }),
3460
+ V ? /* @__PURE__ */ t("div", { children: [
3461
+ /* @__PURE__ */ t("div", { className: "ss-auth-field", children: [
3462
+ /* @__PURE__ */ e("label", { className: "ss-auth-label", children: "Type your email to confirm" }),
3463
+ /* @__PURE__ */ e(
3464
+ "input",
3465
+ {
3466
+ className: "ss-auth-input",
3467
+ type: "email",
3468
+ placeholder: s == null ? void 0 : s.email,
3469
+ value: z,
3470
+ onChange: (R) => L(R.target.value),
3471
+ autoFocus: !0
3472
+ }
3473
+ )
3474
+ ] }),
3475
+ /* @__PURE__ */ t("div", { style: { display: "flex", gap: "8px", justifyContent: "flex-end" }, children: [
3476
+ /* @__PURE__ */ e(
3477
+ "button",
3478
+ {
3479
+ type: "button",
3480
+ className: "ss-auth-btn-ghost",
3481
+ onClick: () => {
3482
+ D(!1), L(""), N(null);
3483
+ },
3484
+ children: "Cancel"
3485
+ }
3486
+ ),
3487
+ /* @__PURE__ */ t(
3488
+ "button",
3489
+ {
3490
+ type: "button",
3491
+ className: "ss-auth-btn-primary ss-auth-btn-sm",
3492
+ style: { width: "auto", background: "linear-gradient(135deg, #ef4444, #dc2626)" },
3493
+ disabled: !ha || m,
3494
+ onClick: ua,
3495
+ children: [
3496
+ m && /* @__PURE__ */ e("span", { className: "ss-auth-spinner" }),
3497
+ "Delete account"
3498
+ ]
3499
+ }
3500
+ )
3501
+ ] })
3502
+ ] }) : /* @__PURE__ */ e(
3503
+ "button",
3504
+ {
3505
+ type: "button",
3506
+ className: "ss-auth-btn-outline",
3507
+ style: { borderColor: "currentColor", width: "auto" },
3508
+ onClick: () => D(!0),
3509
+ children: "Delete my account"
3510
+ }
3511
+ )
3512
+ ] }),
3513
+ k && /* @__PURE__ */ e(
3514
+ ca,
3515
+ {
3516
+ onUpload: K,
3517
+ onClose: () => P(!1),
3518
+ isLoading: u
3519
+ }
3520
+ )
3521
+ ] });
3522
+ }
3523
+ function Ea() {
3524
+ const { selectedOrg: a, updateOrg: s, deleteOrg: r, isLoading: o, error: n, setError: u } = Y(), [i, l] = g((a == null ? void 0 : a.name) ?? ""), [d, c] = g(!1), [f, p] = g(!1), [m, b] = g(!1), [N, y] = g("");
3525
+ if (U(() => {
3526
+ a && l(a.name);
3527
+ }, [a]), !a)
3528
+ return /* @__PURE__ */ t(j, { children: [
3529
+ /* @__PURE__ */ e("h3", { children: "Organization" }),
3530
+ /* @__PURE__ */ t("div", { className: "ss-auth-settings-empty", children: [
3531
+ /* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: w.corporateFare }),
3532
+ /* @__PURE__ */ e("div", { children: "Select an organization from the user menu to manage its settings." })
3533
+ ] })
3534
+ ] });
3535
+ const O = async (S) => {
3536
+ if (S.preventDefault(), !i.trim()) return;
3537
+ c(!0), p(!1);
3538
+ const k = await s(a.id, { name: i.trim() });
3539
+ c(!1), k && p(!0);
3540
+ }, h = async () => {
3541
+ await r(a.id) && b(!1);
3542
+ };
3543
+ return /* @__PURE__ */ t(j, { children: [
3544
+ /* @__PURE__ */ e("h3", { children: "Organization" }),
3545
+ /* @__PURE__ */ t("div", { className: "ss-auth-settings-card", children: [
3546
+ /* @__PURE__ */ t("h4", { children: [
3547
+ /* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: w.corporateFare }),
3548
+ "General"
3549
+ ] }),
3550
+ n && /* @__PURE__ */ t("div", { className: "ss-auth-error", style: { marginBottom: "16px" }, children: [
3551
+ /* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: w.errorOutline }),
3552
+ /* @__PURE__ */ e("span", { children: n })
3553
+ ] }),
3554
+ f && /* @__PURE__ */ t("div", { className: "ss-auth-info-box", style: { marginBottom: "16px" }, children: [
3555
+ /* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: w.check }),
3556
+ /* @__PURE__ */ e("span", { children: "Organization updated" })
3557
+ ] }),
3558
+ /* @__PURE__ */ t("form", { onSubmit: O, children: [
3559
+ /* @__PURE__ */ t("div", { className: "ss-auth-field", children: [
3560
+ /* @__PURE__ */ e("label", { className: "ss-auth-label", children: "Organization Name" }),
3561
+ /* @__PURE__ */ e(
3562
+ "input",
3563
+ {
3564
+ className: "ss-auth-input",
3565
+ type: "text",
3566
+ value: i,
3567
+ onChange: (S) => {
3568
+ l(S.target.value), p(!1);
3569
+ }
3570
+ }
3571
+ )
3572
+ ] }),
3573
+ /* @__PURE__ */ t("div", { className: "ss-auth-field", children: [
3574
+ /* @__PURE__ */ e("label", { className: "ss-auth-label", children: "Slug" }),
3575
+ /* @__PURE__ */ e("input", { className: "ss-auth-input ss-auth-input-readonly", type: "text", value: a.slug, readOnly: !0 })
3576
+ ] }),
3577
+ /* @__PURE__ */ e("div", { style: { display: "flex", justifyContent: "flex-end" }, children: /* @__PURE__ */ t("button", { type: "submit", className: "ss-auth-btn-primary ss-auth-btn-sm", disabled: d, style: { width: "auto" }, children: [
3578
+ d && /* @__PURE__ */ e("span", { className: "ss-auth-spinner" }),
3579
+ "Save"
3580
+ ] }) })
3581
+ ] })
3582
+ ] }),
3583
+ /* @__PURE__ */ t("div", { className: "ss-auth-settings-card ss-auth-settings-danger", children: [
3584
+ /* @__PURE__ */ e("h4", { children: "Danger Zone" }),
3585
+ /* @__PURE__ */ e("p", { className: "ss-auth-section-desc", style: { marginBottom: "16px" }, children: "Deleting this organization is permanent and will remove all members." }),
3586
+ m ? /* @__PURE__ */ t("div", { children: [
3587
+ /* @__PURE__ */ t("div", { className: "ss-auth-field", children: [
3588
+ /* @__PURE__ */ e("label", { className: "ss-auth-label", children: "Type the organization name to confirm" }),
3589
+ /* @__PURE__ */ e(
3590
+ "input",
3591
+ {
3592
+ className: "ss-auth-input",
3593
+ type: "text",
3594
+ placeholder: a.name,
3595
+ value: N,
3596
+ onChange: (S) => y(S.target.value),
3597
+ autoFocus: !0
3598
+ }
3599
+ )
3600
+ ] }),
3601
+ /* @__PURE__ */ t("div", { style: { display: "flex", gap: "8px", justifyContent: "flex-end" }, children: [
3602
+ /* @__PURE__ */ e("button", { type: "button", className: "ss-auth-btn-ghost", onClick: () => {
3603
+ b(!1), y("");
3604
+ }, children: "Cancel" }),
3605
+ /* @__PURE__ */ t(
3606
+ "button",
3607
+ {
3608
+ type: "button",
3609
+ className: "ss-auth-btn-primary ss-auth-btn-sm",
3610
+ style: { width: "auto", background: "linear-gradient(135deg, #ef4444, #dc2626)" },
3611
+ disabled: N !== a.name || o,
3612
+ onClick: h,
3613
+ children: [
3614
+ o && /* @__PURE__ */ e("span", { className: "ss-auth-spinner" }),
3615
+ "Delete organization"
3616
+ ]
3617
+ }
3618
+ )
3619
+ ] })
3620
+ ] }) : /* @__PURE__ */ e(
3621
+ "button",
3622
+ {
3623
+ type: "button",
3624
+ className: "ss-auth-btn-outline",
3625
+ style: { borderColor: "currentColor", width: "auto" },
3626
+ onClick: () => b(!0),
3627
+ children: "Delete this organization"
3628
+ }
3629
+ )
3630
+ ] })
3631
+ ] });
3632
+ }
3633
+ function Ia() {
3634
+ const {
3635
+ selectedOrg: a,
3636
+ members: s,
3637
+ invites: r,
3638
+ isLoading: o,
3639
+ error: n,
3640
+ setError: u,
3641
+ sendInvite: i,
3642
+ refreshInvites: l,
3643
+ revokeInvite: d,
3644
+ updateMemberRole: c,
3645
+ removeMember: f,
3646
+ refreshMembers: p
3647
+ } = Y(), [m, b] = g(""), [N, y] = g("member"), [O, h] = g(!1), [S, k] = g(!1), [P, I] = g(null), [F, B] = g(""), [C, x] = g(null);
3648
+ if (U(() => {
3649
+ a && (p(a.id), l(a.id));
3650
+ }, [a, p, l]), !a)
3651
+ return /* @__PURE__ */ t(j, { children: [
3652
+ /* @__PURE__ */ e("h3", { children: "People" }),
3653
+ /* @__PURE__ */ t("div", { className: "ss-auth-settings-empty", children: [
3654
+ /* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: w.group }),
3655
+ /* @__PURE__ */ e("div", { children: "Select an organization from the user menu to manage members." })
3656
+ ] })
3657
+ ] });
3658
+ const v = async (z) => {
3659
+ z.preventDefault(), k(!1), await i(a.id, m, N) && (b(""), y("member"), k(!0), h(!1), l(a.id));
3660
+ }, E = async () => {
3661
+ if (!P) return;
3662
+ await c(a.id, P.userId, F) && I(null);
3663
+ }, M = async () => {
3664
+ if (!C) return;
3665
+ await f(a.id, C.userId) && x(null);
3666
+ }, V = async (z) => {
3667
+ await d(a.id, z);
3668
+ }, D = (z) => z === "owner" ? "ss-auth-role-badge ss-auth-role-badge-owner" : z === "admin" ? "ss-auth-role-badge ss-auth-role-badge-admin" : "ss-auth-role-badge ss-auth-role-badge-member";
3669
+ return /* @__PURE__ */ t(j, { children: [
3670
+ /* @__PURE__ */ e("h3", { children: "People" }),
3671
+ n && /* @__PURE__ */ t("div", { className: "ss-auth-error", style: { marginBottom: "16px" }, children: [
3672
+ /* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: w.errorOutline }),
3673
+ /* @__PURE__ */ e("span", { children: n })
3674
+ ] }),
3675
+ S && /* @__PURE__ */ t("div", { className: "ss-auth-info-box", style: { marginBottom: "16px" }, children: [
3676
+ /* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: w.check }),
3677
+ /* @__PURE__ */ e("span", { children: "Invitation sent" })
3678
+ ] }),
3679
+ /* @__PURE__ */ t("div", { className: "ss-auth-settings-card", children: [
3680
+ /* @__PURE__ */ t("div", { style: { display: "flex", alignItems: "center", justifyContent: "space-between", marginBottom: "16px" }, children: [
3681
+ /* @__PURE__ */ t("h4", { style: { margin: 0 }, children: [
3682
+ /* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: w.group }),
3683
+ "Members"
3684
+ ] }),
3685
+ /* @__PURE__ */ t(
3686
+ "button",
3687
+ {
3688
+ type: "button",
3689
+ className: "ss-auth-btn-primary ss-auth-btn-sm",
3690
+ style: { width: "auto" },
3691
+ onClick: () => h(!O),
3692
+ children: [
3693
+ /* @__PURE__ */ e("span", { className: "material-symbols-outlined", style: { fontSize: "16px" }, children: w.add }),
3694
+ "Invite"
3695
+ ]
3696
+ }
3697
+ )
3698
+ ] }),
3699
+ O && /* @__PURE__ */ e("form", { onSubmit: v, style: { marginBottom: "16px", padding: "16px", background: "rgba(0,0,0,0.05)", borderRadius: "8px" }, children: /* @__PURE__ */ t("div", { style: { display: "flex", gap: "8px", alignItems: "flex-end" }, children: [
3700
+ /* @__PURE__ */ t("div", { style: { flex: 1 }, children: [
3701
+ /* @__PURE__ */ e("label", { className: "ss-auth-label", children: "Email" }),
3702
+ /* @__PURE__ */ e(
3703
+ "input",
3704
+ {
3705
+ className: "ss-auth-input",
3706
+ type: "email",
3707
+ placeholder: "member@example.com",
3708
+ value: m,
3709
+ onChange: (z) => b(z.target.value),
3710
+ required: !0
3711
+ }
3712
+ )
3713
+ ] }),
3714
+ /* @__PURE__ */ t("div", { style: { width: "120px" }, children: [
3715
+ /* @__PURE__ */ e("label", { className: "ss-auth-label", children: "Role" }),
3716
+ /* @__PURE__ */ t(
3717
+ "select",
3718
+ {
3719
+ className: "ss-auth-input",
3720
+ value: N,
3721
+ onChange: (z) => y(z.target.value),
3722
+ style: { cursor: "pointer" },
3723
+ children: [
3724
+ /* @__PURE__ */ e("option", { value: "admin", children: "Admin" }),
3725
+ /* @__PURE__ */ e("option", { value: "member", children: "Member" })
3726
+ ]
3727
+ }
3728
+ )
3729
+ ] }),
3730
+ /* @__PURE__ */ e("button", { type: "submit", className: "ss-auth-btn-primary ss-auth-btn-sm", disabled: o, style: { width: "auto", marginBottom: "0" }, children: "Send" })
3731
+ ] }) }),
3732
+ s.length === 0 ? /* @__PURE__ */ e("div", { className: "ss-auth-settings-empty", style: { padding: "20px" }, children: /* @__PURE__ */ e("div", { children: "No members yet." }) }) : /* @__PURE__ */ t("table", { className: "ss-auth-settings-table", children: [
3733
+ /* @__PURE__ */ e("thead", { children: /* @__PURE__ */ t("tr", { children: [
3734
+ /* @__PURE__ */ e("th", { children: "Email" }),
3735
+ /* @__PURE__ */ e("th", { children: "Role" }),
3736
+ /* @__PURE__ */ e("th", { style: { width: "80px" }, children: "Actions" })
3737
+ ] }) }),
3738
+ /* @__PURE__ */ e("tbody", { children: s.map((z) => /* @__PURE__ */ t("tr", { children: [
3739
+ /* @__PURE__ */ e("td", { children: z.email }),
3740
+ /* @__PURE__ */ e("td", { children: /* @__PURE__ */ e("span", { className: D(z.role), children: z.role }) }),
3741
+ /* @__PURE__ */ e("td", { children: z.role === "owner" ? /* @__PURE__ */ e("span", { style: { fontSize: "12px", opacity: 0.4 }, children: "—" }) : /* @__PURE__ */ t("div", { className: "ss-auth-settings-actions", children: [
3742
+ /* @__PURE__ */ e(
3743
+ "button",
3744
+ {
3745
+ type: "button",
3746
+ className: "ss-auth-icon-btn",
3747
+ title: "Edit role",
3748
+ onClick: () => {
3749
+ I(z), B(z.role);
3750
+ },
3751
+ children: /* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: w.edit })
3752
+ }
3753
+ ),
3754
+ /* @__PURE__ */ e(
3755
+ "button",
3756
+ {
3757
+ type: "button",
3758
+ className: "ss-auth-icon-btn ss-auth-icon-btn-danger",
3759
+ title: "Remove member",
3760
+ onClick: () => x(z),
3761
+ children: /* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: w.personRemove })
3762
+ }
3763
+ )
3764
+ ] }) })
3765
+ ] }, z.userId)) })
3766
+ ] })
3767
+ ] }),
3768
+ r.length > 0 && /* @__PURE__ */ t("div", { className: "ss-auth-settings-card", children: [
3769
+ /* @__PURE__ */ t("h4", { children: [
3770
+ /* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: w.send }),
3771
+ "Pending Invites"
3772
+ ] }),
3773
+ /* @__PURE__ */ t("table", { className: "ss-auth-settings-table", children: [
3774
+ /* @__PURE__ */ e("thead", { children: /* @__PURE__ */ t("tr", { children: [
3775
+ /* @__PURE__ */ e("th", { children: "Email" }),
3776
+ /* @__PURE__ */ e("th", { children: "Role" }),
3777
+ /* @__PURE__ */ e("th", { style: { width: "80px" }, children: "Actions" })
3778
+ ] }) }),
3779
+ /* @__PURE__ */ e("tbody", { children: r.map((z) => /* @__PURE__ */ t("tr", { children: [
3780
+ /* @__PURE__ */ e("td", { children: z.email }),
3781
+ /* @__PURE__ */ e("td", { children: /* @__PURE__ */ e("span", { className: D(z.role), children: z.role }) }),
3782
+ /* @__PURE__ */ e("td", { children: /* @__PURE__ */ e(
3783
+ "button",
3784
+ {
3785
+ type: "button",
3786
+ className: "ss-auth-icon-btn ss-auth-icon-btn-danger",
3787
+ title: "Revoke invite",
3788
+ onClick: () => V(z.id),
3789
+ children: /* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: w.close })
3790
+ }
3791
+ ) })
3792
+ ] }, z.id)) })
3793
+ ] })
3794
+ ] }),
3795
+ P && /* @__PURE__ */ e("div", { className: "ss-auth-modal-overlay", onClick: (z) => {
3796
+ z.target === z.currentTarget && I(null);
3797
+ }, children: /* @__PURE__ */ t("div", { className: "ss-auth-modal", style: { maxWidth: "400px" }, children: [
3798
+ /* @__PURE__ */ t("div", { className: "ss-auth-modal-header", children: [
3799
+ /* @__PURE__ */ e("h2", { children: "Edit Role" }),
3800
+ /* @__PURE__ */ e("button", { type: "button", className: "ss-auth-modal-close", onClick: () => I(null), children: /* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: w.close }) })
3801
+ ] }),
3802
+ /* @__PURE__ */ t("div", { className: "ss-auth-modal-body", children: [
3803
+ /* @__PURE__ */ t("p", { style: { fontSize: "14px", marginBottom: "16px", margin: "0 0 16px 0" }, children: [
3804
+ "Change role for ",
3805
+ /* @__PURE__ */ e("strong", { children: P.email })
3806
+ ] }),
3807
+ /* @__PURE__ */ t("div", { className: "ss-auth-field", children: [
3808
+ /* @__PURE__ */ e("label", { className: "ss-auth-label", children: "Role" }),
3809
+ /* @__PURE__ */ t(
3810
+ "select",
3811
+ {
3812
+ className: "ss-auth-input",
3813
+ value: F,
3814
+ onChange: (z) => B(z.target.value),
3815
+ style: { cursor: "pointer" },
3816
+ children: [
3817
+ /* @__PURE__ */ e("option", { value: "admin", children: "Admin" }),
3818
+ /* @__PURE__ */ e("option", { value: "member", children: "Member" })
3819
+ ]
3820
+ }
3821
+ )
3822
+ ] }),
3823
+ /* @__PURE__ */ t("div", { style: { display: "flex", gap: "8px", justifyContent: "flex-end" }, children: [
3824
+ /* @__PURE__ */ e("button", { type: "button", className: "ss-auth-btn-ghost", onClick: () => I(null), children: "Cancel" }),
3825
+ /* @__PURE__ */ e("button", { type: "button", className: "ss-auth-btn-primary ss-auth-btn-sm", style: { width: "auto" }, onClick: E, children: "Save" })
3826
+ ] })
3827
+ ] })
3828
+ ] }) }),
3829
+ C && /* @__PURE__ */ e("div", { className: "ss-auth-modal-overlay", onClick: (z) => {
3830
+ z.target === z.currentTarget && x(null);
3831
+ }, children: /* @__PURE__ */ t("div", { className: "ss-auth-modal", style: { maxWidth: "400px" }, children: [
3832
+ /* @__PURE__ */ t("div", { className: "ss-auth-modal-header", children: [
3833
+ /* @__PURE__ */ e("h2", { children: "Remove Member" }),
3834
+ /* @__PURE__ */ e("button", { type: "button", className: "ss-auth-modal-close", onClick: () => x(null), children: /* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: w.close }) })
3835
+ ] }),
3836
+ /* @__PURE__ */ t("div", { className: "ss-auth-modal-body", children: [
3837
+ /* @__PURE__ */ t("p", { style: { fontSize: "14px", margin: "0 0 16px 0" }, children: [
3838
+ "Are you sure you want to remove ",
3839
+ /* @__PURE__ */ e("strong", { children: C.email }),
3840
+ " from the organization?"
3841
+ ] }),
3842
+ /* @__PURE__ */ t("div", { style: { display: "flex", gap: "8px", justifyContent: "flex-end" }, children: [
3843
+ /* @__PURE__ */ e("button", { type: "button", className: "ss-auth-btn-ghost", onClick: () => x(null), children: "Cancel" }),
3844
+ /* @__PURE__ */ e(
3845
+ "button",
3846
+ {
3847
+ type: "button",
3848
+ className: "ss-auth-btn-primary ss-auth-btn-sm",
3849
+ style: { width: "auto", background: "linear-gradient(135deg, #ef4444, #dc2626)" },
3850
+ onClick: M,
3851
+ children: "Remove"
3852
+ }
3853
+ )
3854
+ ] })
3855
+ ] })
3856
+ ] }) })
3857
+ ] });
3858
+ }
3859
+ function Fa() {
3860
+ const { selectedOrg: a } = Y();
3861
+ return a ? /* @__PURE__ */ t(j, { children: [
3862
+ /* @__PURE__ */ e("h3", { children: "Billing" }),
3863
+ /* @__PURE__ */ t("div", { className: "ss-auth-settings-card", children: [
3864
+ /* @__PURE__ */ t("h4", { children: [
3865
+ /* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: w.creditCard }),
3866
+ "Plan & Billing"
3867
+ ] }),
3868
+ /* @__PURE__ */ e("div", { className: "ss-auth-settings-empty", style: { padding: "20px" }, children: /* @__PURE__ */ e("div", { children: "No billing plan configured for this organization." }) })
3869
+ ] })
3870
+ ] }) : /* @__PURE__ */ t(j, { children: [
3871
+ /* @__PURE__ */ e("h3", { children: "Billing" }),
3872
+ /* @__PURE__ */ t("div", { className: "ss-auth-settings-empty", children: [
3873
+ /* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: w.creditCard }),
3874
+ /* @__PURE__ */ e("div", { children: "Select an organization from the user menu to manage billing." })
3875
+ ] })
3876
+ ] });
3877
+ }
3878
+ function oe({
3879
+ appearance: a,
3880
+ afterSignOutUrl: s,
3881
+ afterDeleteAccountUrl: r,
3882
+ showOrgSwitcher: o = !0,
3883
+ onOrgChange: n,
3884
+ onOrgSettingsClick: u
3885
+ }) {
3886
+ const { appearance: i } = A(), { user: l, signOut: d } = sa(), c = a ?? i, [f, p] = g(!1), [m, b] = g(!1), [N, y] = g(""), [O, h] = g(null), [S, k] = g(!1), P = _(null), { orgs: I, selectedOrg: F, selectOrg: B, createOrg: C } = Y(), x = $((E) => {
3887
+ P.current && !E.composedPath().includes(P.current) && p(!1);
3888
+ }, []);
3889
+ U(() => {
3004
3890
  if (f) {
3005
- const O = setTimeout(() => {
3891
+ const E = setTimeout(() => {
3006
3892
  document.addEventListener("click", x);
3007
3893
  }, 0);
3008
3894
  return () => {
3009
- clearTimeout(O), document.removeEventListener("click", x);
3895
+ clearTimeout(E), document.removeEventListener("click", x);
3010
3896
  };
3011
3897
  }
3012
3898
  }, [f, x]);
3013
3899
  const v = $(
3014
- async (O) => {
3015
- O.preventDefault(), h(null), k(!0);
3016
- const D = w.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-|-$/g, "");
3900
+ async (E) => {
3901
+ E.preventDefault(), h(null), k(!0);
3902
+ const M = N.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-|-$/g, "");
3017
3903
  try {
3018
- const H = await S(w, D);
3019
- H && (await A(H.id), n == null || n(H), y(""), p(!1));
3020
- } catch (H) {
3021
- h(H instanceof Error ? H.message : "Failed to create organization");
3904
+ const V = await C(N, M);
3905
+ V && (await B(V.id), n == null || n(V), y(""), p(!1));
3906
+ } catch (V) {
3907
+ h(V instanceof Error ? V.message : "Failed to create organization");
3022
3908
  } finally {
3023
3909
  k(!1);
3024
3910
  }
3025
3911
  },
3026
- [w, S, A, n]
3912
+ [N, C, B, n]
3027
3913
  );
3028
- return c ? /* @__PURE__ */ e(q, { appearance: i, children: /* @__PURE__ */ r("div", { style: { position: "relative", display: "inline-block" }, ref: z, children: [
3029
- /* @__PURE__ */ e(
3914
+ return l ? /* @__PURE__ */ e(H, { appearance: c, children: /* @__PURE__ */ t("div", { style: { position: "relative", display: "inline-block" }, ref: P, children: [
3915
+ /* @__PURE__ */ t(
3030
3916
  "button",
3031
3917
  {
3032
3918
  type: "button",
3033
- className: "ss-auth-avatar-trigger",
3919
+ className: "ss-auth-user-trigger",
3034
3920
  onClick: () => p(!f),
3035
3921
  "aria-label": "User menu",
3036
- children: c.avatarUrl ? /* @__PURE__ */ e("img", { src: c.avatarUrl, alt: "" }) : /* @__PURE__ */ e("div", { style: {
3037
- width: "100%",
3038
- height: "100%",
3039
- display: "flex",
3040
- alignItems: "center",
3041
- justifyContent: "center",
3042
- fontSize: "16px",
3043
- fontWeight: 700
3044
- }, children: (c.name || c.email).charAt(0).toUpperCase() })
3922
+ children: [
3923
+ /* @__PURE__ */ e("span", { className: "ss-auth-avatar-trigger", children: l.avatarUrl ? /* @__PURE__ */ e("img", { src: l.avatarUrl, alt: "" }) : /* @__PURE__ */ e("div", { style: {
3924
+ width: "100%",
3925
+ height: "100%",
3926
+ display: "flex",
3927
+ alignItems: "center",
3928
+ justifyContent: "center",
3929
+ fontSize: "16px",
3930
+ fontWeight: 700
3931
+ }, children: (l.name || l.email).charAt(0).toUpperCase() }) }),
3932
+ F && /* @__PURE__ */ e("span", { className: "ss-auth-trigger-org-name", children: F.name })
3933
+ ]
3045
3934
  }
3046
3935
  ),
3047
- f && /* @__PURE__ */ r("div", { className: "ss-auth-dropdown ss-auth-glass-panel", style: { minWidth: "320px" }, children: [
3048
- /* @__PURE__ */ r("div", { className: "ss-auth-dropdown-header", children: [
3049
- /* @__PURE__ */ e("div", { className: "ss-auth-dropdown-avatar", children: c.avatarUrl ? /* @__PURE__ */ e("img", { src: c.avatarUrl, alt: "" }) : /* @__PURE__ */ e("div", { style: {
3936
+ f && /* @__PURE__ */ t("div", { className: "ss-auth-dropdown ss-auth-glass-panel", style: { minWidth: "320px" }, children: [
3937
+ /* @__PURE__ */ t("div", { className: "ss-auth-dropdown-header", children: [
3938
+ /* @__PURE__ */ e("div", { className: "ss-auth-dropdown-avatar", children: l.avatarUrl ? /* @__PURE__ */ e("img", { src: l.avatarUrl, alt: "" }) : /* @__PURE__ */ e("div", { style: {
3050
3939
  width: "100%",
3051
3940
  height: "100%",
3052
3941
  display: "flex",
@@ -3054,13 +3943,13 @@ function re({
3054
3943
  justifyContent: "center",
3055
3944
  fontSize: "20px",
3056
3945
  fontWeight: 800
3057
- }, children: (c.name || c.email).charAt(0).toUpperCase() }) }),
3058
- /* @__PURE__ */ r("div", { children: [
3059
- c.name && /* @__PURE__ */ e("div", { className: "ss-auth-dropdown-name", children: c.name }),
3060
- /* @__PURE__ */ e("div", { className: "ss-auth-dropdown-email", children: c.email })
3946
+ }, children: (l.name || l.email).charAt(0).toUpperCase() }) }),
3947
+ /* @__PURE__ */ t("div", { children: [
3948
+ l.name && /* @__PURE__ */ e("div", { className: "ss-auth-dropdown-name", children: l.name }),
3949
+ /* @__PURE__ */ e("div", { className: "ss-auth-dropdown-email", children: l.email })
3061
3950
  ] })
3062
3951
  ] }),
3063
- /* @__PURE__ */ e("div", { style: { padding: "4px 8px" }, children: /* @__PURE__ */ r(
3952
+ /* @__PURE__ */ e("div", { style: { padding: "4px 8px" }, children: /* @__PURE__ */ t(
3064
3953
  "button",
3065
3954
  {
3066
3955
  type: "button",
@@ -3069,45 +3958,46 @@ function re({
3069
3958
  p(!1), b(!0);
3070
3959
  },
3071
3960
  children: [
3072
- /* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: P.person }),
3073
- "Profile"
3961
+ /* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: w.settings }),
3962
+ "Settings"
3074
3963
  ]
3075
3964
  }
3076
3965
  ) }),
3077
- o && /* @__PURE__ */ r(G, { children: [
3966
+ o && /* @__PURE__ */ t(j, { children: [
3078
3967
  /* @__PURE__ */ e("div", { className: "ss-auth-section-label", children: "Organizations" }),
3079
- /* @__PURE__ */ e("div", { style: { padding: "0 8px 4px" }, children: E.map((O) => {
3080
- const D = (I == null ? void 0 : I.id) === O.id, H = O.name.split(" ").map((T) => T[0]).join("").slice(0, 2).toUpperCase();
3081
- return /* @__PURE__ */ r(
3968
+ /* @__PURE__ */ e("div", { style: { padding: "0 8px 4px" }, children: I.map((E) => {
3969
+ const M = (F == null ? void 0 : F.id) === E.id, V = E.name.split(" ").map((D) => D[0]).join("").slice(0, 2).toUpperCase();
3970
+ return /* @__PURE__ */ t(
3082
3971
  "button",
3083
3972
  {
3084
3973
  type: "button",
3085
- className: `ss-auth-org-item${D ? " ss-auth-org-item-active" : ""}`,
3974
+ className: `ss-auth-org-item${M ? " ss-auth-org-item-active" : ""}`,
3086
3975
  onClick: async () => {
3087
- p(!1), await A(O.id), n == null || n(O);
3976
+ p(!1), await B(E.id), n == null || n(E);
3088
3977
  },
3089
3978
  children: [
3090
- /* @__PURE__ */ r("div", { className: "ss-auth-org-item-inner", children: [
3091
- /* @__PURE__ */ e("div", { className: `ss-auth-org-avatar${D ? "" : " ss-auth-org-avatar-inactive"}`, children: H }),
3092
- /* @__PURE__ */ e("span", { style: { fontFamily: "'Manrope', sans-serif", letterSpacing: "-0.01em" }, children: O.name })
3979
+ /* @__PURE__ */ t("div", { className: "ss-auth-org-item-inner", children: [
3980
+ /* @__PURE__ */ e("div", { className: `ss-auth-org-avatar${M ? "" : " ss-auth-org-avatar-inactive"}`, children: V }),
3981
+ /* @__PURE__ */ e("span", { style: { fontFamily: "'Manrope', sans-serif", letterSpacing: "-0.01em" }, children: E.name }),
3982
+ E.planName && /* @__PURE__ */ e("span", { className: "ss-auth-plan-badge", children: E.planName })
3093
3983
  ] }),
3094
- D && /* @__PURE__ */ e("span", { className: "material-symbols-outlined ss-auth-org-check", style: { fontSize: "18px" }, children: P.checkCircle })
3984
+ M && /* @__PURE__ */ e("span", { className: "material-symbols-outlined ss-auth-org-check", style: { fontSize: "18px" }, children: w.checkCircle })
3095
3985
  ]
3096
3986
  },
3097
- O.id
3987
+ E.id
3098
3988
  );
3099
3989
  }) }),
3100
- /* @__PURE__ */ r("div", { className: "ss-auth-inline-create", children: [
3101
- C && /* @__PURE__ */ e("div", { className: "ss-auth-error", style: { marginBottom: "8px", fontSize: "12px" }, children: /* @__PURE__ */ e("span", { children: C }) }),
3102
- /* @__PURE__ */ e("form", { onSubmit: v, children: /* @__PURE__ */ r("div", { className: "ss-auth-inline-create-input", children: [
3990
+ /* @__PURE__ */ t("div", { className: "ss-auth-inline-create", children: [
3991
+ O && /* @__PURE__ */ e("div", { className: "ss-auth-error", style: { marginBottom: "8px", fontSize: "12px" }, children: /* @__PURE__ */ e("span", { children: O }) }),
3992
+ /* @__PURE__ */ e("form", { onSubmit: v, children: /* @__PURE__ */ t("div", { className: "ss-auth-inline-create-input", children: [
3103
3993
  /* @__PURE__ */ e(
3104
3994
  "input",
3105
3995
  {
3106
3996
  className: "ss-auth-input",
3107
3997
  type: "text",
3108
3998
  placeholder: "New organization name",
3109
- value: w,
3110
- onChange: (O) => y(O.target.value),
3999
+ value: N,
4000
+ onChange: (E) => y(E.target.value),
3111
4001
  required: !0,
3112
4002
  style: { fontSize: "13px", padding: "10px 40px 10px 12px" }
3113
4003
  }
@@ -3117,28 +4007,28 @@ function re({
3117
4007
  {
3118
4008
  type: "submit",
3119
4009
  className: "ss-auth-inline-create-btn",
3120
- disabled: N || !w.trim(),
3121
- children: /* @__PURE__ */ e("span", { className: "material-symbols-outlined", style: { fontSize: "20px" }, children: P.add })
4010
+ disabled: S || !N.trim(),
4011
+ children: /* @__PURE__ */ e("span", { className: "material-symbols-outlined", style: { fontSize: "20px" }, children: w.add })
3122
4012
  }
3123
4013
  )
3124
4014
  ] }) })
3125
4015
  ] }),
3126
- I && u && /* @__PURE__ */ e("div", { style: { padding: "0 8px 4px" }, children: /* @__PURE__ */ r(
4016
+ F && u && /* @__PURE__ */ e("div", { style: { padding: "0 8px 4px" }, children: /* @__PURE__ */ t(
3127
4017
  "button",
3128
4018
  {
3129
4019
  type: "button",
3130
4020
  className: "ss-auth-dropdown-action",
3131
4021
  onClick: () => {
3132
- p(!1), u(I);
4022
+ p(!1), u(F);
3133
4023
  },
3134
4024
  children: [
3135
- /* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: P.corporateFare }),
4025
+ /* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: w.corporateFare }),
3136
4026
  "Org settings"
3137
4027
  ]
3138
4028
  }
3139
4029
  ) })
3140
4030
  ] }),
3141
- /* @__PURE__ */ e("div", { className: "ss-auth-signout-section", style: { padding: "8px" }, children: /* @__PURE__ */ r(
4031
+ /* @__PURE__ */ e("div", { className: "ss-auth-signout-section", style: { padding: "8px" }, children: /* @__PURE__ */ t(
3142
4032
  "button",
3143
4033
  {
3144
4034
  type: "button",
@@ -3148,254 +4038,52 @@ function re({
3148
4038
  },
3149
4039
  style: { color: "inherit" },
3150
4040
  children: [
3151
- /* @__PURE__ */ e("span", { className: "material-symbols-outlined", style: { color: "inherit" }, children: P.logout }),
4041
+ /* @__PURE__ */ e("span", { className: "material-symbols-outlined", style: { color: "inherit" }, children: w.logout }),
3152
4042
  "Sign out"
3153
4043
  ]
3154
4044
  }
3155
4045
  ) })
3156
4046
  ] }),
3157
4047
  m && /* @__PURE__ */ e(
3158
- Oa,
4048
+ Pa,
3159
4049
  {
3160
4050
  onClose: () => b(!1),
3161
- afterDeleteAccountUrl: t
4051
+ afterDeleteAccountUrl: r
3162
4052
  }
3163
4053
  )
3164
4054
  ] }) }) : null;
3165
4055
  }
3166
- function Oa({ onClose: a, afterDeleteAccountUrl: s }) {
3167
- const { user: t, updateProfile: o, uploadAvatar: n, changePassword: u, isLoading: l, error: c, success: d, setError: i, setSuccess: f } = oa(), { signOut: p } = ta(), { deleteAccount: m, isLoading: b, error: w, setError: y } = za(), [C, h] = g((t == null ? void 0 : t.name) ?? ""), [N, k] = g((t == null ? void 0 : t.avatarUrl) ?? ""), [z, E] = g(!1), [I, A] = g(""), [S, x] = g(""), [v, O] = g(""), [D, H] = g(null), [T, M] = g(!1), [F, R] = g(""), Z = $(
3168
- async (U) => {
3169
- U.preventDefault(), i(null), f(null), await o({ name: C, avatarUrl: N || void 0 });
3170
- },
3171
- [C, N, o, i, f]
3172
- ), Y = $(
3173
- async (U) => {
3174
- const K = await n(U);
3175
- K && (k(K.avatarUrl), E(!1));
3176
- },
3177
- [n]
3178
- ), ua = $(
3179
- async (U) => {
3180
- if (U.preventDefault(), H(null), i(null), f(null), S !== v) {
3181
- H("Passwords do not match");
3182
- return;
3183
- }
3184
- if (S.length < 8) {
3185
- H("Password must be at least 8 characters");
3186
- return;
3187
- }
3188
- await u(I, S) && (A(""), x(""), O(""));
3189
- },
3190
- [I, S, v, u, i, f]
3191
- ), pa = $(async () => {
3192
- await m() && (await p(), s && (window.location.href = s));
3193
- }, [m, p, s]), ha = (t == null ? void 0 : t.provider) === "email", ga = F === (t == null ? void 0 : t.email), fa = ((t == null ? void 0 : t.name) || (t == null ? void 0 : t.email) || "?").charAt(0).toUpperCase();
3194
- return /* @__PURE__ */ e("div", { className: "ss-auth-modal-overlay", onClick: (U) => {
3195
- U.target === U.currentTarget && a();
3196
- }, children: /* @__PURE__ */ r("div", { className: "ss-auth-modal", style: { maxWidth: "640px" }, children: [
3197
- /* @__PURE__ */ r("div", { className: "ss-auth-modal-header", children: [
3198
- /* @__PURE__ */ e("h2", { children: "Profile" }),
3199
- /* @__PURE__ */ e("button", { type: "button", className: "ss-auth-modal-close", onClick: a, children: /* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: P.close }) })
3200
- ] }),
3201
- /* @__PURE__ */ r("div", { className: "ss-auth-profile-header", children: [
3202
- /* @__PURE__ */ r("div", { className: "ss-auth-avatar-lg", onClick: () => E(!0), children: [
3203
- N ? /* @__PURE__ */ e("img", { src: N, alt: "" }) : /* @__PURE__ */ e("div", { style: {
3204
- width: "100%",
3205
- height: "100%",
3206
- display: "flex",
3207
- alignItems: "center",
3208
- justifyContent: "center",
3209
- fontSize: "48px",
3210
- fontWeight: 800,
3211
- opacity: 0.4
3212
- }, children: fa }),
3213
- /* @__PURE__ */ r("div", { className: "ss-auth-avatar-overlay", children: [
3214
- /* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: P.camera }),
3215
- /* @__PURE__ */ e("span", { children: "Edit" })
3216
- ] })
3217
- ] }),
3218
- /* @__PURE__ */ r("div", { className: "ss-auth-profile-info", children: [
3219
- /* @__PURE__ */ r("h2", { className: "ss-auth-profile-name", children: [
3220
- (t == null ? void 0 : t.name) || "Unnamed User",
3221
- (t == null ? void 0 : t.emailVerified) && /* @__PURE__ */ r("span", { className: "ss-auth-badge ss-auth-badge-success", children: [
3222
- /* @__PURE__ */ e("span", { className: "material-symbols-outlined", style: { fontSize: "12px", fontVariationSettings: "'FILL' 1" }, children: P.verified }),
3223
- "Verified"
3224
- ] })
3225
- ] }),
3226
- /* @__PURE__ */ e("p", { className: "ss-auth-profile-desc", children: t == null ? void 0 : t.email })
3227
- ] })
3228
- ] }),
3229
- /* @__PURE__ */ r("div", { className: "ss-auth-modal-body", children: [
3230
- c && /* @__PURE__ */ r("div", { className: "ss-auth-error", children: [
3231
- /* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: P.errorOutline }),
3232
- /* @__PURE__ */ e("span", { children: c })
3233
- ] }),
3234
- d && /* @__PURE__ */ r("div", { className: "ss-auth-info-box", style: { marginBottom: "16px" }, children: [
3235
- /* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: P.check }),
3236
- /* @__PURE__ */ e("span", { children: d })
3237
- ] }),
3238
- /* @__PURE__ */ r("form", { onSubmit: Z, children: [
3239
- /* @__PURE__ */ r("div", { className: "ss-auth-field", children: [
3240
- /* @__PURE__ */ e("label", { className: "ss-auth-label", children: "Full Name" }),
3241
- /* @__PURE__ */ e(
3242
- "input",
3243
- {
3244
- className: "ss-auth-input",
3245
- type: "text",
3246
- placeholder: "Your name",
3247
- value: C,
3248
- onChange: (U) => h(U.target.value)
3249
- }
3250
- )
3251
- ] }),
3252
- /* @__PURE__ */ r("div", { className: "ss-auth-profile-grid", style: { marginBottom: "16px" }, children: [
3253
- /* @__PURE__ */ r("div", { children: [
3254
- /* @__PURE__ */ e("label", { className: "ss-auth-label", children: "Email Address" }),
3255
- /* @__PURE__ */ r("div", { style: { position: "relative" }, children: [
3256
- /* @__PURE__ */ e("input", { className: "ss-auth-input ss-auth-input-readonly", type: "email", value: (t == null ? void 0 : t.email) ?? "", readOnly: !0 }),
3257
- /* @__PURE__ */ e("span", { className: "ss-auth-visibility-toggle", style: { cursor: "default" }, children: /* @__PURE__ */ e("span", { className: "material-symbols-outlined", style: { fontSize: "18px" }, children: P.lock }) })
3258
- ] })
3259
- ] }),
3260
- /* @__PURE__ */ r("div", { children: [
3261
- /* @__PURE__ */ e("label", { className: "ss-auth-label", children: "Auth Provider" }),
3262
- /* @__PURE__ */ e("input", { className: "ss-auth-input ss-auth-input-readonly", type: "text", value: (t == null ? void 0 : t.provider) ?? "", readOnly: !0 })
3263
- ] })
3264
- ] }),
3265
- /* @__PURE__ */ e("div", { style: { display: "flex", justifyContent: "flex-end" }, children: /* @__PURE__ */ r("button", { type: "submit", className: "ss-auth-btn-primary ss-auth-btn-sm", disabled: l, style: { width: "auto" }, children: [
3266
- l && /* @__PURE__ */ e("span", { className: "ss-auth-spinner" }),
3267
- "Save changes"
3268
- ] }) })
3269
- ] }),
3270
- ha && /* @__PURE__ */ r("div", { className: "ss-auth-section", children: [
3271
- /* @__PURE__ */ r("div", { className: "ss-auth-section-title", children: [
3272
- /* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: P.security }),
3273
- "Security Credentials"
3274
- ] }),
3275
- D && /* @__PURE__ */ r("div", { className: "ss-auth-error", style: { marginTop: "16px" }, children: [
3276
- /* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: P.errorOutline }),
3277
- /* @__PURE__ */ e("span", { children: D })
3278
- ] }),
3279
- /* @__PURE__ */ r("form", { onSubmit: ua, style: { marginTop: "16px" }, children: [
3280
- /* @__PURE__ */ r("div", { className: "ss-auth-field", children: [
3281
- /* @__PURE__ */ e("label", { className: "ss-auth-label", children: "Current Password" }),
3282
- /* @__PURE__ */ e("input", { className: "ss-auth-input", type: "password", placeholder: "••••••••••••", value: I, onChange: (U) => A(U.target.value), required: !0 })
3283
- ] }),
3284
- /* @__PURE__ */ r("div", { className: "ss-auth-profile-grid", style: { marginBottom: "16px" }, children: [
3285
- /* @__PURE__ */ r("div", { children: [
3286
- /* @__PURE__ */ e("label", { className: "ss-auth-label", children: "New Password" }),
3287
- /* @__PURE__ */ e("input", { className: "ss-auth-input", type: "password", placeholder: "Min. 8 characters", value: S, onChange: (U) => x(U.target.value), required: !0 })
3288
- ] }),
3289
- /* @__PURE__ */ r("div", { children: [
3290
- /* @__PURE__ */ e("label", { className: "ss-auth-label", children: "Confirm New Password" }),
3291
- /* @__PURE__ */ e("input", { className: "ss-auth-input", type: "password", placeholder: "Repeat new password", value: v, onChange: (U) => O(U.target.value), required: !0 })
3292
- ] })
3293
- ] }),
3294
- /* @__PURE__ */ e("div", { style: { display: "flex", justifyContent: "flex-end" }, children: /* @__PURE__ */ e("button", { type: "submit", className: "ss-auth-btn-ghost", disabled: l, children: "Update Security" }) })
3295
- ] })
3296
- ] }),
3297
- /* @__PURE__ */ r("div", { className: "ss-auth-section", children: [
3298
- /* @__PURE__ */ e("div", { className: "ss-auth-section-title", style: { color: "inherit" }, children: "Danger Zone" }),
3299
- /* @__PURE__ */ e("p", { className: "ss-auth-section-desc", style: { marginBottom: "16px" }, children: "Deleting your account is permanent. All organizations you own will also be deleted." }),
3300
- w && /* @__PURE__ */ r("div", { className: "ss-auth-error", children: [
3301
- /* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: P.errorOutline }),
3302
- /* @__PURE__ */ e("span", { children: w })
3303
- ] }),
3304
- T ? /* @__PURE__ */ r("div", { children: [
3305
- /* @__PURE__ */ r("div", { className: "ss-auth-field", children: [
3306
- /* @__PURE__ */ e("label", { className: "ss-auth-label", children: "Type your email to confirm" }),
3307
- /* @__PURE__ */ e(
3308
- "input",
3309
- {
3310
- className: "ss-auth-input",
3311
- type: "email",
3312
- placeholder: t == null ? void 0 : t.email,
3313
- value: F,
3314
- onChange: (U) => R(U.target.value),
3315
- autoFocus: !0
3316
- }
3317
- )
3318
- ] }),
3319
- /* @__PURE__ */ r("div", { style: { display: "flex", gap: "8px", justifyContent: "flex-end" }, children: [
3320
- /* @__PURE__ */ e(
3321
- "button",
3322
- {
3323
- type: "button",
3324
- className: "ss-auth-btn-ghost",
3325
- onClick: () => {
3326
- M(!1), R(""), y(null);
3327
- },
3328
- children: "Cancel"
3329
- }
3330
- ),
3331
- /* @__PURE__ */ r(
3332
- "button",
3333
- {
3334
- type: "button",
3335
- className: "ss-auth-btn-primary ss-auth-btn-sm",
3336
- style: { width: "auto", background: "linear-gradient(135deg, #ef4444, #dc2626)" },
3337
- disabled: !ga || b,
3338
- onClick: pa,
3339
- children: [
3340
- b && /* @__PURE__ */ e("span", { className: "ss-auth-spinner" }),
3341
- "Delete account"
3342
- ]
3343
- }
3344
- )
3345
- ] })
3346
- ] }) : /* @__PURE__ */ e(
3347
- "button",
3348
- {
3349
- type: "button",
3350
- className: "ss-auth-btn-outline",
3351
- style: { borderColor: "currentColor", width: "auto" },
3352
- onClick: () => M(!0),
3353
- children: "Delete my account"
3354
- }
3355
- )
3356
- ] })
3357
- ] }),
3358
- z && /* @__PURE__ */ e(
3359
- ca,
3360
- {
3361
- onUpload: Y,
3362
- onClose: () => E(!1),
3363
- isLoading: l
3364
- }
3365
- )
3366
- ] }) });
3367
- }
3368
- function se({ appearance: a }) {
3369
- const { appearance: s } = L(), { user: t, signOut: o } = ta(), { updateProfile: n, uploadAvatar: u, changePassword: l, isLoading: c, error: d, success: i, setError: f, setSuccess: p } = oa(), m = a ?? s, [b, w] = g((t == null ? void 0 : t.name) ?? ""), [y, C] = g((t == null ? void 0 : t.avatarUrl) ?? ""), [h, N] = g(!1), [k, z] = g(""), [E, I] = g(""), [A, S] = g(""), [x, v] = g(null), O = $(
3370
- async (F) => {
3371
- F.preventDefault(), f(null), p(null), await n({ name: b, avatarUrl: y || void 0 });
4056
+ function ie({ appearance: a }) {
4057
+ const { appearance: s } = A(), { user: r, signOut: o } = sa(), { updateProfile: n, uploadAvatar: u, changePassword: i, isLoading: l, error: d, success: c, setError: f, setSuccess: p } = oa(), m = a ?? s, [b, N] = g((r == null ? void 0 : r.name) ?? ""), [y, O] = g((r == null ? void 0 : r.avatarUrl) ?? ""), [h, S] = g(!1), [k, P] = g(""), [I, F] = g(""), [B, C] = g(""), [x, v] = g(null), E = $(
4058
+ async (L) => {
4059
+ L.preventDefault(), f(null), p(null), await n({ name: b, avatarUrl: y || void 0 });
3372
4060
  },
3373
4061
  [b, y, n, f, p]
3374
- ), D = $(
3375
- async (F) => {
3376
- const R = await u(F);
3377
- R && (C(R.avatarUrl), N(!1));
4062
+ ), M = $(
4063
+ async (L) => {
4064
+ const W = await u(L);
4065
+ W && (O(W.avatarUrl), S(!1));
3378
4066
  },
3379
4067
  [u]
3380
- ), H = $(
3381
- async (F) => {
3382
- if (F.preventDefault(), v(null), f(null), p(null), E !== A) {
4068
+ ), V = $(
4069
+ async (L) => {
4070
+ if (L.preventDefault(), v(null), f(null), p(null), I !== B) {
3383
4071
  v("Passwords do not match");
3384
4072
  return;
3385
4073
  }
3386
- if (E.length < 8) {
4074
+ if (I.length < 8) {
3387
4075
  v("Password must be at least 8 characters");
3388
4076
  return;
3389
4077
  }
3390
- await l(k, E) && (z(""), I(""), S(""));
4078
+ await i(k, I) && (P(""), F(""), C(""));
3391
4079
  },
3392
- [k, E, A, l, f, p]
4080
+ [k, I, B, i, f, p]
3393
4081
  );
3394
- if (!t) return null;
3395
- const T = t.provider === "email", M = (t.name || t.email).charAt(0).toUpperCase();
3396
- return /* @__PURE__ */ e(q, { appearance: m, children: /* @__PURE__ */ r("div", { className: "ss-auth-card", style: { maxWidth: "640px" }, children: [
3397
- /* @__PURE__ */ r("div", { className: "ss-auth-profile-header", children: [
3398
- /* @__PURE__ */ r("div", { className: "ss-auth-avatar-lg", onClick: () => N(!0), children: [
4082
+ if (!r) return null;
4083
+ const D = r.provider === "email", z = (r.name || r.email).charAt(0).toUpperCase();
4084
+ return /* @__PURE__ */ e(H, { appearance: m, children: /* @__PURE__ */ t("div", { className: "ss-auth-card", style: { maxWidth: "640px" }, children: [
4085
+ /* @__PURE__ */ t("div", { className: "ss-auth-profile-header", children: [
4086
+ /* @__PURE__ */ t("div", { className: "ss-auth-avatar-lg", onClick: () => S(!0), children: [
3399
4087
  y ? /* @__PURE__ */ e("img", { src: y, alt: "" }) : /* @__PURE__ */ e("div", { style: {
3400
4088
  width: "100%",
3401
4089
  height: "100%",
@@ -3405,34 +4093,34 @@ function se({ appearance: a }) {
3405
4093
  fontSize: "48px",
3406
4094
  fontWeight: 800,
3407
4095
  opacity: 0.4
3408
- }, children: M }),
3409
- /* @__PURE__ */ r("div", { className: "ss-auth-avatar-overlay", children: [
3410
- /* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: P.camera }),
4096
+ }, children: z }),
4097
+ /* @__PURE__ */ t("div", { className: "ss-auth-avatar-overlay", children: [
4098
+ /* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: w.camera }),
3411
4099
  /* @__PURE__ */ e("span", { children: "Edit" })
3412
4100
  ] })
3413
4101
  ] }),
3414
- /* @__PURE__ */ r("div", { className: "ss-auth-profile-info", children: [
3415
- /* @__PURE__ */ r("h2", { className: "ss-auth-profile-name", children: [
3416
- t.name || "Unnamed User",
3417
- t.emailVerified && /* @__PURE__ */ r("span", { className: "ss-auth-badge ss-auth-badge-success", children: [
3418
- /* @__PURE__ */ e("span", { className: "material-symbols-outlined", style: { fontSize: "12px", fontVariationSettings: "'FILL' 1" }, children: P.verified }),
4102
+ /* @__PURE__ */ t("div", { className: "ss-auth-profile-info", children: [
4103
+ /* @__PURE__ */ t("h2", { className: "ss-auth-profile-name", children: [
4104
+ r.name || "Unnamed User",
4105
+ r.emailVerified && /* @__PURE__ */ t("span", { className: "ss-auth-badge ss-auth-badge-success", children: [
4106
+ /* @__PURE__ */ e("span", { className: "material-symbols-outlined", style: { fontSize: "12px", fontVariationSettings: "'FILL' 1" }, children: w.verified }),
3419
4107
  "Verified"
3420
4108
  ] })
3421
4109
  ] }),
3422
- /* @__PURE__ */ e("p", { className: "ss-auth-profile-desc", children: t.email })
4110
+ /* @__PURE__ */ e("p", { className: "ss-auth-profile-desc", children: r.email })
3423
4111
  ] })
3424
4112
  ] }),
3425
- /* @__PURE__ */ r("div", { className: "ss-auth-card-body", children: [
3426
- d && /* @__PURE__ */ r("div", { className: "ss-auth-error", children: [
3427
- /* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: P.errorOutline }),
4113
+ /* @__PURE__ */ t("div", { className: "ss-auth-card-body", children: [
4114
+ d && /* @__PURE__ */ t("div", { className: "ss-auth-error", children: [
4115
+ /* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: w.errorOutline }),
3428
4116
  /* @__PURE__ */ e("span", { children: d })
3429
4117
  ] }),
3430
- i && /* @__PURE__ */ r("div", { className: "ss-auth-info-box", style: { marginBottom: "16px" }, children: [
3431
- /* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: P.check }),
3432
- /* @__PURE__ */ e("span", { children: i })
4118
+ c && /* @__PURE__ */ t("div", { className: "ss-auth-info-box", style: { marginBottom: "16px" }, children: [
4119
+ /* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: w.check }),
4120
+ /* @__PURE__ */ e("span", { children: c })
3433
4121
  ] }),
3434
- /* @__PURE__ */ r("form", { onSubmit: O, children: [
3435
- /* @__PURE__ */ r("div", { className: "ss-auth-field", children: [
4122
+ /* @__PURE__ */ t("form", { onSubmit: E, children: [
4123
+ /* @__PURE__ */ t("div", { className: "ss-auth-field", children: [
3436
4124
  /* @__PURE__ */ e("label", { className: "ss-auth-label", children: "Full Name" }),
3437
4125
  /* @__PURE__ */ e(
3438
4126
  "input",
@@ -3441,43 +4129,43 @@ function se({ appearance: a }) {
3441
4129
  type: "text",
3442
4130
  placeholder: "Your name",
3443
4131
  value: b,
3444
- onChange: (F) => w(F.target.value)
4132
+ onChange: (L) => N(L.target.value)
3445
4133
  }
3446
4134
  )
3447
4135
  ] }),
3448
- /* @__PURE__ */ r("div", { className: "ss-auth-profile-grid", style: { marginBottom: "16px" }, children: [
3449
- /* @__PURE__ */ r("div", { children: [
4136
+ /* @__PURE__ */ t("div", { className: "ss-auth-profile-grid", style: { marginBottom: "16px" }, children: [
4137
+ /* @__PURE__ */ t("div", { children: [
3450
4138
  /* @__PURE__ */ e("label", { className: "ss-auth-label", children: "Email Address" }),
3451
- /* @__PURE__ */ r("div", { style: { position: "relative" }, children: [
3452
- /* @__PURE__ */ e("input", { className: "ss-auth-input ss-auth-input-readonly", type: "email", value: t.email, readOnly: !0 }),
3453
- /* @__PURE__ */ e("span", { className: "ss-auth-visibility-toggle", style: { cursor: "default" }, children: /* @__PURE__ */ e("span", { className: "material-symbols-outlined", style: { fontSize: "18px" }, children: P.lock }) })
4139
+ /* @__PURE__ */ t("div", { style: { position: "relative" }, children: [
4140
+ /* @__PURE__ */ e("input", { className: "ss-auth-input ss-auth-input-readonly", type: "email", value: r.email, readOnly: !0 }),
4141
+ /* @__PURE__ */ e("span", { className: "ss-auth-visibility-toggle", style: { cursor: "default" }, children: /* @__PURE__ */ e("span", { className: "material-symbols-outlined", style: { fontSize: "18px" }, children: w.lock }) })
3454
4142
  ] })
3455
4143
  ] }),
3456
- /* @__PURE__ */ r("div", { children: [
4144
+ /* @__PURE__ */ t("div", { children: [
3457
4145
  /* @__PURE__ */ e("label", { className: "ss-auth-label", children: "Auth Provider" }),
3458
- /* @__PURE__ */ r("div", { style: { position: "relative" }, children: [
3459
- /* @__PURE__ */ e("input", { className: "ss-auth-input ss-auth-input-readonly", type: "text", value: t.provider, readOnly: !0 }),
3460
- /* @__PURE__ */ e("span", { className: "ss-auth-visibility-toggle", style: { cursor: "default" }, children: /* @__PURE__ */ e("span", { className: "material-symbols-outlined", style: { fontSize: "18px" }, children: P.cloudDone }) })
4146
+ /* @__PURE__ */ t("div", { style: { position: "relative" }, children: [
4147
+ /* @__PURE__ */ e("input", { className: "ss-auth-input ss-auth-input-readonly", type: "text", value: r.provider, readOnly: !0 }),
4148
+ /* @__PURE__ */ e("span", { className: "ss-auth-visibility-toggle", style: { cursor: "default" }, children: /* @__PURE__ */ e("span", { className: "material-symbols-outlined", style: { fontSize: "18px" }, children: w.cloudDone }) })
3461
4149
  ] })
3462
4150
  ] })
3463
4151
  ] }),
3464
- /* @__PURE__ */ e("div", { style: { display: "flex", justifyContent: "flex-end" }, children: /* @__PURE__ */ r("button", { type: "submit", className: "ss-auth-btn-primary ss-auth-btn-sm", disabled: c, style: { width: "auto" }, children: [
3465
- c && /* @__PURE__ */ e("span", { className: "ss-auth-spinner" }),
4152
+ /* @__PURE__ */ e("div", { style: { display: "flex", justifyContent: "flex-end" }, children: /* @__PURE__ */ t("button", { type: "submit", className: "ss-auth-btn-primary ss-auth-btn-sm", disabled: l, style: { width: "auto" }, children: [
4153
+ l && /* @__PURE__ */ e("span", { className: "ss-auth-spinner" }),
3466
4154
  "Save changes"
3467
4155
  ] }) })
3468
4156
  ] }),
3469
- T && /* @__PURE__ */ r("div", { className: "ss-auth-section", children: [
3470
- /* @__PURE__ */ r("div", { className: "ss-auth-section-title", children: [
3471
- /* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: P.security }),
4157
+ D && /* @__PURE__ */ t("div", { className: "ss-auth-section", children: [
4158
+ /* @__PURE__ */ t("div", { className: "ss-auth-section-title", children: [
4159
+ /* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: w.security }),
3472
4160
  "Security Credentials"
3473
4161
  ] }),
3474
4162
  /* @__PURE__ */ e("p", { className: "ss-auth-section-desc", style: { marginBottom: "24px" }, children: "Update your password to keep your account secure." }),
3475
- x && /* @__PURE__ */ r("div", { className: "ss-auth-error", children: [
3476
- /* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: P.errorOutline }),
4163
+ x && /* @__PURE__ */ t("div", { className: "ss-auth-error", children: [
4164
+ /* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: w.errorOutline }),
3477
4165
  /* @__PURE__ */ e("span", { children: x })
3478
4166
  ] }),
3479
- /* @__PURE__ */ r("form", { onSubmit: H, children: [
3480
- /* @__PURE__ */ r("div", { className: "ss-auth-field", children: [
4167
+ /* @__PURE__ */ t("form", { onSubmit: V, children: [
4168
+ /* @__PURE__ */ t("div", { className: "ss-auth-field", children: [
3481
4169
  /* @__PURE__ */ e("label", { className: "ss-auth-label", children: "Current Password" }),
3482
4170
  /* @__PURE__ */ e(
3483
4171
  "input",
@@ -3486,13 +4174,13 @@ function se({ appearance: a }) {
3486
4174
  type: "password",
3487
4175
  placeholder: "••••••••••••",
3488
4176
  value: k,
3489
- onChange: (F) => z(F.target.value),
4177
+ onChange: (L) => P(L.target.value),
3490
4178
  required: !0
3491
4179
  }
3492
4180
  )
3493
4181
  ] }),
3494
- /* @__PURE__ */ r("div", { className: "ss-auth-profile-grid", style: { marginBottom: "16px" }, children: [
3495
- /* @__PURE__ */ r("div", { children: [
4182
+ /* @__PURE__ */ t("div", { className: "ss-auth-profile-grid", style: { marginBottom: "16px" }, children: [
4183
+ /* @__PURE__ */ t("div", { children: [
3496
4184
  /* @__PURE__ */ e("label", { className: "ss-auth-label", children: "New Password" }),
3497
4185
  /* @__PURE__ */ e(
3498
4186
  "input",
@@ -3500,13 +4188,13 @@ function se({ appearance: a }) {
3500
4188
  className: "ss-auth-input",
3501
4189
  type: "password",
3502
4190
  placeholder: "Min. 8 characters",
3503
- value: E,
3504
- onChange: (F) => I(F.target.value),
4191
+ value: I,
4192
+ onChange: (L) => F(L.target.value),
3505
4193
  required: !0
3506
4194
  }
3507
4195
  )
3508
4196
  ] }),
3509
- /* @__PURE__ */ r("div", { children: [
4197
+ /* @__PURE__ */ t("div", { children: [
3510
4198
  /* @__PURE__ */ e("label", { className: "ss-auth-label", children: "Confirm New Password" }),
3511
4199
  /* @__PURE__ */ e(
3512
4200
  "input",
@@ -3514,24 +4202,24 @@ function se({ appearance: a }) {
3514
4202
  className: "ss-auth-input",
3515
4203
  type: "password",
3516
4204
  placeholder: "Repeat new password",
3517
- value: A,
3518
- onChange: (F) => S(F.target.value),
4205
+ value: B,
4206
+ onChange: (L) => C(L.target.value),
3519
4207
  required: !0
3520
4208
  }
3521
4209
  )
3522
4210
  ] })
3523
4211
  ] }),
3524
- /* @__PURE__ */ r("div", { className: "ss-auth-info-box", style: { marginBottom: "16px" }, children: [
3525
- /* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: P.info }),
4212
+ /* @__PURE__ */ t("div", { className: "ss-auth-info-box", style: { marginBottom: "16px" }, children: [
4213
+ /* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: w.info }),
3526
4214
  /* @__PURE__ */ e("span", { children: "Password must be at least 8 characters long." })
3527
4215
  ] }),
3528
- /* @__PURE__ */ e("div", { style: { display: "flex", justifyContent: "flex-end" }, children: /* @__PURE__ */ e("button", { type: "submit", className: "ss-auth-btn-ghost", disabled: c, children: "Update Security" }) })
4216
+ /* @__PURE__ */ e("div", { style: { display: "flex", justifyContent: "flex-end" }, children: /* @__PURE__ */ e("button", { type: "submit", className: "ss-auth-btn-ghost", disabled: l, children: "Update Security" }) })
3529
4217
  ] })
3530
4218
  ] }),
3531
- /* @__PURE__ */ e("div", { className: "ss-auth-section", style: { borderTop: "none", paddingTop: 0, marginTop: "24px" }, children: /* @__PURE__ */ e("div", { className: "ss-auth-signout-section", style: { borderRadius: "12px", padding: "16px 20px" }, children: /* @__PURE__ */ r("div", { className: "ss-auth-signout-row", children: [
3532
- /* @__PURE__ */ r("div", { className: "ss-auth-signout-info", children: [
3533
- /* @__PURE__ */ e("div", { className: "ss-auth-signout-icon", children: /* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: P.logout }) }),
3534
- /* @__PURE__ */ r("div", { children: [
4219
+ /* @__PURE__ */ e("div", { className: "ss-auth-section", style: { borderTop: "none", paddingTop: 0, marginTop: "24px" }, children: /* @__PURE__ */ e("div", { className: "ss-auth-signout-section", style: { borderRadius: "12px", padding: "16px 20px" }, children: /* @__PURE__ */ t("div", { className: "ss-auth-signout-row", children: [
4220
+ /* @__PURE__ */ t("div", { className: "ss-auth-signout-info", children: [
4221
+ /* @__PURE__ */ e("div", { className: "ss-auth-signout-icon", children: /* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: w.logout }) }),
4222
+ /* @__PURE__ */ t("div", { children: [
3535
4223
  /* @__PURE__ */ e("div", { className: "ss-auth-signout-title", children: "End Session" }),
3536
4224
  /* @__PURE__ */ e("div", { className: "ss-auth-signout-desc", children: "Terminate your active session" })
3537
4225
  ] })
@@ -3551,69 +4239,69 @@ function se({ appearance: a }) {
3551
4239
  h && /* @__PURE__ */ e(
3552
4240
  ca,
3553
4241
  {
3554
- onUpload: D,
3555
- onClose: () => N(!1),
3556
- isLoading: c
4242
+ onUpload: M,
4243
+ onClose: () => S(!1),
4244
+ isLoading: l
3557
4245
  }
3558
4246
  )
3559
4247
  ] }) });
3560
4248
  }
3561
- function ne({ appearance: a, onOrgChange: s }) {
3562
- const { appearance: t } = L(), { orgs: o, selectedOrg: n, selectOrg: u, createOrg: l, isLoading: c } = na(), d = a ?? t, [i, f] = g(!1), [p, m] = g(""), [b, w] = g(""), [y, C] = g(null), [h, N] = g(!1), k = W(null), z = $((x) => {
4249
+ function le({ appearance: a, onOrgChange: s }) {
4250
+ const { appearance: r } = A(), { orgs: o, selectedOrg: n, selectOrg: u, createOrg: i, isLoading: l } = Y(), d = a ?? r, [c, f] = g(!1), [p, m] = g(""), [b, N] = g(""), [y, O] = g(null), [h, S] = g(!1), k = _(null), P = $((x) => {
3563
4251
  k.current && !x.composedPath().includes(k.current) && f(!1);
3564
4252
  }, []);
3565
- V(() => {
3566
- if (i) {
4253
+ U(() => {
4254
+ if (c) {
3567
4255
  const x = setTimeout(() => {
3568
- document.addEventListener("click", z);
4256
+ document.addEventListener("click", P);
3569
4257
  }, 0);
3570
4258
  return () => {
3571
- clearTimeout(x), document.removeEventListener("click", z);
4259
+ clearTimeout(x), document.removeEventListener("click", P);
3572
4260
  };
3573
4261
  }
3574
- }, [i, z]);
3575
- const E = $((x) => {
3576
- m(x), w(x.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-|-$/g, ""));
3577
- }, []), I = $(
4262
+ }, [c, P]);
4263
+ const I = $((x) => {
4264
+ m(x), N(x.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-|-$/g, ""));
4265
+ }, []), F = $(
3578
4266
  async (x) => {
3579
- x.preventDefault(), C(null), N(!0);
4267
+ x.preventDefault(), O(null), S(!0);
3580
4268
  try {
3581
- const v = await l(p, b);
3582
- v && (await u(v.id), s == null || s(v), m(""), w(""), f(!1));
4269
+ const v = await i(p, b);
4270
+ v && (await u(v.id), s == null || s(v), m(""), N(""), f(!1));
3583
4271
  } catch (v) {
3584
- C(v instanceof Error ? v.message : "Failed to create organization");
4272
+ O(v instanceof Error ? v.message : "Failed to create organization");
3585
4273
  } finally {
3586
- N(!1);
4274
+ S(!1);
3587
4275
  }
3588
4276
  },
3589
- [p, b, l, u, s]
4277
+ [p, b, i, u, s]
3590
4278
  );
3591
- if (c) return null;
3592
- const A = (n == null ? void 0 : n.name) ?? (o.length === 0 ? "No organization" : "Select organization"), S = n ? n.name.split(" ").map((x) => x[0]).join("").slice(0, 2).toUpperCase() : "--";
3593
- return /* @__PURE__ */ e(q, { appearance: d, children: /* @__PURE__ */ r("div", { style: { position: "relative", display: "inline-block", width: "100%", maxWidth: "360px" }, ref: k, children: [
3594
- /* @__PURE__ */ r(
4279
+ if (l) return null;
4280
+ const B = (n == null ? void 0 : n.name) ?? (o.length === 0 ? "No organization" : "Select organization"), C = n ? n.name.split(" ").map((x) => x[0]).join("").slice(0, 2).toUpperCase() : "--";
4281
+ return /* @__PURE__ */ e(H, { appearance: d, children: /* @__PURE__ */ t("div", { style: { position: "relative", display: "inline-block", width: "100%", maxWidth: "360px" }, ref: k, children: [
4282
+ /* @__PURE__ */ t(
3595
4283
  "button",
3596
4284
  {
3597
4285
  type: "button",
3598
4286
  className: "ss-auth-org-trigger",
3599
- onClick: () => f(!i),
4287
+ onClick: () => f(!c),
3600
4288
  children: [
3601
- /* @__PURE__ */ r("div", { className: "ss-auth-org-trigger-inner", children: [
3602
- /* @__PURE__ */ e("div", { className: "ss-auth-org-avatar", children: S }),
3603
- /* @__PURE__ */ r("div", { style: { textAlign: "left" }, children: [
4289
+ /* @__PURE__ */ t("div", { className: "ss-auth-org-trigger-inner", children: [
4290
+ /* @__PURE__ */ e("div", { className: "ss-auth-org-avatar", children: C }),
4291
+ /* @__PURE__ */ t("div", { style: { textAlign: "left" }, children: [
3604
4292
  /* @__PURE__ */ e("div", { className: "ss-auth-org-trigger-label", children: "Current Organization" }),
3605
- /* @__PURE__ */ e("div", { className: "ss-auth-org-trigger-name", children: A })
4293
+ /* @__PURE__ */ e("div", { className: "ss-auth-org-trigger-name", children: B })
3606
4294
  ] })
3607
4295
  ] }),
3608
- /* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: P.unfoldMore })
4296
+ /* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: w.unfoldMore })
3609
4297
  ]
3610
4298
  }
3611
4299
  ),
3612
- i && /* @__PURE__ */ r("div", { className: "ss-auth-dropdown ss-auth-dropdown-left ss-auth-glass-panel", style: { width: "100%" }, children: [
4300
+ c && /* @__PURE__ */ t("div", { className: "ss-auth-dropdown ss-auth-dropdown-left ss-auth-glass-panel", style: { width: "100%" }, children: [
3613
4301
  /* @__PURE__ */ e("div", { className: "ss-auth-section-label", children: "Your Organizations" }),
3614
4302
  /* @__PURE__ */ e("div", { style: { padding: "0 8px 4px" }, children: o.map((x) => {
3615
- const v = (n == null ? void 0 : n.id) === x.id, O = x.name.split(" ").map((D) => D[0]).join("").slice(0, 2).toUpperCase();
3616
- return /* @__PURE__ */ r(
4303
+ const v = (n == null ? void 0 : n.id) === x.id, E = x.name.split(" ").map((M) => M[0]).join("").slice(0, 2).toUpperCase();
4304
+ return /* @__PURE__ */ t(
3617
4305
  "button",
3618
4306
  {
3619
4307
  type: "button",
@@ -3622,24 +4310,24 @@ function ne({ appearance: a, onOrgChange: s }) {
3622
4310
  f(!1), await u(x.id), s == null || s(x);
3623
4311
  },
3624
4312
  children: [
3625
- /* @__PURE__ */ r("div", { className: "ss-auth-org-item-inner", children: [
3626
- /* @__PURE__ */ e("div", { className: `ss-auth-org-avatar${v ? "" : " ss-auth-org-avatar-inactive"}`, children: O }),
4313
+ /* @__PURE__ */ t("div", { className: "ss-auth-org-item-inner", children: [
4314
+ /* @__PURE__ */ e("div", { className: `ss-auth-org-avatar${v ? "" : " ss-auth-org-avatar-inactive"}`, children: E }),
3627
4315
  /* @__PURE__ */ e("span", { style: { fontFamily: "'Manrope', sans-serif", letterSpacing: "-0.01em" }, children: x.name })
3628
4316
  ] }),
3629
- v && /* @__PURE__ */ e("span", { className: "material-symbols-outlined ss-auth-org-check", style: { fontSize: "18px" }, children: P.checkCircle })
4317
+ v && /* @__PURE__ */ e("span", { className: "material-symbols-outlined ss-auth-org-check", style: { fontSize: "18px" }, children: w.checkCircle })
3630
4318
  ]
3631
4319
  },
3632
4320
  x.id
3633
4321
  );
3634
4322
  }) }),
3635
- /* @__PURE__ */ r("div", { className: "ss-auth-org-create", children: [
3636
- /* @__PURE__ */ r("div", { className: "ss-auth-org-create-header", children: [
3637
- /* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: P.addCircle }),
4323
+ /* @__PURE__ */ t("div", { className: "ss-auth-org-create", children: [
4324
+ /* @__PURE__ */ t("div", { className: "ss-auth-org-create-header", children: [
4325
+ /* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: w.addCircle }),
3638
4326
  /* @__PURE__ */ e("span", { children: "Create organization" })
3639
4327
  ] }),
3640
4328
  y && /* @__PURE__ */ e("div", { className: "ss-auth-error", style: { marginBottom: "12px", fontSize: "12px" }, children: /* @__PURE__ */ e("span", { children: y }) }),
3641
- /* @__PURE__ */ r("form", { onSubmit: I, children: [
3642
- /* @__PURE__ */ r("div", { className: "ss-auth-field", children: [
4329
+ /* @__PURE__ */ t("form", { onSubmit: F, children: [
4330
+ /* @__PURE__ */ t("div", { className: "ss-auth-field", children: [
3643
4331
  /* @__PURE__ */ e("label", { className: "ss-auth-label", style: { fontSize: "10px" }, children: "Org Name" }),
3644
4332
  /* @__PURE__ */ e(
3645
4333
  "input",
@@ -3648,15 +4336,15 @@ function ne({ appearance: a, onOrgChange: s }) {
3648
4336
  type: "text",
3649
4337
  placeholder: "e.g. Nexus Dynamics",
3650
4338
  value: p,
3651
- onChange: (x) => E(x.target.value),
4339
+ onChange: (x) => I(x.target.value),
3652
4340
  required: !0,
3653
4341
  style: { fontSize: "13px", padding: "10px 12px" }
3654
4342
  }
3655
4343
  )
3656
4344
  ] }),
3657
- /* @__PURE__ */ r("div", { className: "ss-auth-field", children: [
4345
+ /* @__PURE__ */ t("div", { className: "ss-auth-field", children: [
3658
4346
  /* @__PURE__ */ e("label", { className: "ss-auth-label", style: { fontSize: "10px" }, children: "Workspace Slug" }),
3659
- /* @__PURE__ */ r("div", { style: { position: "relative" }, children: [
4347
+ /* @__PURE__ */ t("div", { style: { position: "relative" }, children: [
3660
4348
  /* @__PURE__ */ e("span", { className: "ss-auth-org-slug-prefix", children: "/" }),
3661
4349
  /* @__PURE__ */ e(
3662
4350
  "input",
@@ -3665,14 +4353,14 @@ function ne({ appearance: a, onOrgChange: s }) {
3665
4353
  type: "text",
3666
4354
  placeholder: "nexus-dynamics",
3667
4355
  value: b,
3668
- onChange: (x) => w(x.target.value),
4356
+ onChange: (x) => N(x.target.value),
3669
4357
  required: !0,
3670
4358
  style: { fontSize: "13px", padding: "10px 12px 10px 22px" }
3671
4359
  }
3672
4360
  )
3673
4361
  ] })
3674
4362
  ] }),
3675
- /* @__PURE__ */ r(
4363
+ /* @__PURE__ */ t(
3676
4364
  "button",
3677
4365
  {
3678
4366
  type: "submit",
@@ -3690,35 +4378,35 @@ function ne({ appearance: a, onOrgChange: s }) {
3690
4378
  ] })
3691
4379
  ] }) });
3692
4380
  }
3693
- function Ea(a, s = "USD") {
4381
+ function Ba(a, s = "USD") {
3694
4382
  return new Intl.NumberFormat("en-US", {
3695
4383
  style: "currency",
3696
4384
  currency: s,
3697
4385
  minimumFractionDigits: a % 100 === 0 ? 0 : 2
3698
4386
  }).format(a / 100);
3699
4387
  }
3700
- function oe({ plans: a, currentPlanId: s, onSelectPlan: t, interval: o, appearance: n }) {
3701
- const { appearance: u } = L(), l = n ?? u, c = o ? a.filter((d) => d.interval === o || d.isFree) : a;
3702
- return /* @__PURE__ */ e(q, { appearance: l, children: /* @__PURE__ */ e("div", { className: "ss-pricing-grid", children: c.map((d) => {
3703
- const i = d.id === s;
3704
- return /* @__PURE__ */ r("div", { className: `ss-pricing-card ${i ? "ss-pricing-card-current" : ""}`, children: [
3705
- /* @__PURE__ */ r("div", { className: "ss-pricing-header", children: [
4388
+ function ce({ plans: a, currentPlanId: s, onSelectPlan: r, interval: o, appearance: n }) {
4389
+ const { appearance: u } = A(), i = n ?? u, l = o ? a.filter((d) => d.interval === o || d.isFree) : a;
4390
+ return /* @__PURE__ */ e(H, { appearance: i, children: /* @__PURE__ */ e("div", { className: "ss-pricing-grid", children: l.map((d) => {
4391
+ const c = d.id === s;
4392
+ return /* @__PURE__ */ t("div", { className: `ss-pricing-card ${c ? "ss-pricing-card-current" : ""}`, children: [
4393
+ /* @__PURE__ */ t("div", { className: "ss-pricing-header", children: [
3706
4394
  /* @__PURE__ */ e("h3", { className: "ss-pricing-name", children: d.name }),
3707
- d.trialDays > 0 && /* @__PURE__ */ r("span", { className: "ss-badge ss-badge-trialing", children: [
4395
+ d.trialDays > 0 && /* @__PURE__ */ t("span", { className: "ss-badge ss-badge-trialing", children: [
3708
4396
  d.trialDays,
3709
4397
  "-day trial"
3710
4398
  ] }),
3711
4399
  d.isFree && /* @__PURE__ */ e("span", { className: "ss-badge ss-badge-active", children: "Free" })
3712
4400
  ] }),
3713
- /* @__PURE__ */ e("div", { className: "ss-pricing-price", children: d.isFree ? /* @__PURE__ */ e("span", { className: "ss-pricing-amount", children: "Free" }) : /* @__PURE__ */ r(G, { children: [
3714
- /* @__PURE__ */ e("span", { className: "ss-pricing-amount", children: Ea(d.amountCents, d.currency) }),
3715
- /* @__PURE__ */ r("span", { className: "ss-pricing-interval", children: [
4401
+ /* @__PURE__ */ e("div", { className: "ss-pricing-price", children: d.isFree ? /* @__PURE__ */ e("span", { className: "ss-pricing-amount", children: "Free" }) : /* @__PURE__ */ t(j, { children: [
4402
+ /* @__PURE__ */ e("span", { className: "ss-pricing-amount", children: Ba(d.amountCents, d.currency) }),
4403
+ /* @__PURE__ */ t("span", { className: "ss-pricing-interval", children: [
3716
4404
  "/",
3717
4405
  d.interval
3718
4406
  ] })
3719
4407
  ] }) }),
3720
4408
  d.description && /* @__PURE__ */ e("p", { className: "ss-pricing-desc", children: d.description }),
3721
- d.features.length > 0 && /* @__PURE__ */ e("ul", { className: "ss-pricing-features", children: d.features.map((f, p) => /* @__PURE__ */ r("li", { className: "ss-pricing-feature", children: [
4409
+ d.features.length > 0 && /* @__PURE__ */ e("ul", { className: "ss-pricing-features", children: d.features.map((f, p) => /* @__PURE__ */ t("li", { className: "ss-pricing-feature", children: [
3722
4410
  /* @__PURE__ */ e("span", { className: "ss-check", children: "✓" }),
3723
4411
  " ",
3724
4412
  f
@@ -3727,167 +4415,167 @@ function oe({ plans: a, currentPlanId: s, onSelectPlan: t, interval: o, appearan
3727
4415
  "button",
3728
4416
  {
3729
4417
  type: "button",
3730
- className: `ss-btn ${i ? "ss-btn-current" : "ss-btn-primary"}`,
3731
- disabled: i,
3732
- onClick: () => t(d.id),
3733
- children: i ? "Current plan" : "Select plan"
4418
+ className: `ss-btn ${c ? "ss-btn-current" : "ss-btn-primary"}`,
4419
+ disabled: c,
4420
+ onClick: () => r(d.id),
4421
+ children: c ? "Current plan" : "Select plan"
3734
4422
  }
3735
4423
  )
3736
4424
  ] }, d.id);
3737
4425
  }) }) });
3738
4426
  }
3739
- function ie() {
3740
- const { client: a } = L();
4427
+ function de() {
4428
+ const { client: a } = A();
3741
4429
  return { billing: a.billing };
3742
4430
  }
3743
- function Q(a) {
3744
- const { client: s } = L();
3745
- return _(() => {
4431
+ function Z(a) {
4432
+ const { client: s } = A();
4433
+ return G(() => {
3746
4434
  if (a) {
3747
- const t = new J("https://api.saas-support.com/v1", { type: "portalToken", token: a });
3748
- return new va(t);
4435
+ const r = new Q("https://api.saas-support.com/v1", { type: "portalToken", token: a });
4436
+ return new ya(r);
3749
4437
  }
3750
4438
  return s.billing;
3751
4439
  }, [s, a]);
3752
4440
  }
3753
- function Ia(a, s) {
3754
- const t = Q(s), [o, n] = g(null), [u, l] = g(!0), [c, d] = g(null), i = $(async () => {
3755
- l(!0), d(null);
4441
+ function La(a, s) {
4442
+ const r = Z(s), [o, n] = g(null), [u, i] = g(!0), [l, d] = g(null), c = $(async () => {
4443
+ i(!0), d(null);
3756
4444
  try {
3757
- const f = await t.getCustomer(a);
4445
+ const f = await r.getCustomer(a);
3758
4446
  n(f);
3759
4447
  } catch (f) {
3760
4448
  d(f instanceof Error ? f.message : "Failed to load subscription");
3761
4449
  } finally {
3762
- l(!1);
4450
+ i(!1);
3763
4451
  }
3764
- }, [t, a]);
3765
- return V(() => {
3766
- i();
3767
- }, [i]), { customer: o, isLoading: u, error: c, refresh: i };
4452
+ }, [r, a]);
4453
+ return U(() => {
4454
+ c();
4455
+ }, [c]), { customer: o, isLoading: u, error: l, refresh: c };
3768
4456
  }
3769
- function La(a, s) {
3770
- const t = Q(s), [o, n] = g([]), [u, l] = g(!0), [c, d] = g(null), i = $(async () => {
3771
- l(!0), d(null);
4457
+ function Aa(a, s) {
4458
+ const r = Z(s), [o, n] = g([]), [u, i] = g(!0), [l, d] = g(null), c = $(async () => {
4459
+ i(!0), d(null);
3772
4460
  try {
3773
- const f = await t.getInvoices(a);
4461
+ const f = await r.getInvoices(a);
3774
4462
  n(f);
3775
4463
  } catch (f) {
3776
4464
  d(f instanceof Error ? f.message : "Failed to load invoices");
3777
4465
  } finally {
3778
- l(!1);
4466
+ i(!1);
3779
4467
  }
3780
- }, [t, a]);
3781
- return V(() => {
3782
- i();
3783
- }, [i]), { invoices: o, isLoading: u, error: c, refresh: i };
4468
+ }, [r, a]);
4469
+ return U(() => {
4470
+ c();
4471
+ }, [c]), { invoices: o, isLoading: u, error: l, refresh: c };
3784
4472
  }
3785
- function Fa(a, s) {
3786
- const t = Q(s), [o, n] = g([]), [u, l] = g(!0), [c, d] = g(null), i = $(async () => {
3787
- l(!0), d(null);
4473
+ function Da(a, s) {
4474
+ const r = Z(s), [o, n] = g([]), [u, i] = g(!0), [l, d] = g(null), c = $(async () => {
4475
+ i(!0), d(null);
3788
4476
  try {
3789
- const f = await t.getCurrentUsage(a);
4477
+ const f = await r.getCurrentUsage(a);
3790
4478
  n(f);
3791
4479
  } catch (f) {
3792
4480
  d(f instanceof Error ? f.message : "Failed to load usage");
3793
4481
  } finally {
3794
- l(!1);
4482
+ i(!1);
3795
4483
  }
3796
- }, [t, a]);
3797
- return V(() => {
3798
- i();
3799
- }, [i]), { usage: o, isLoading: u, error: c, refresh: i };
4484
+ }, [r, a]);
4485
+ return U(() => {
4486
+ c();
4487
+ }, [c]), { usage: o, isLoading: u, error: l, refresh: c };
3800
4488
  }
3801
- const Ba = {
4489
+ const Ta = {
3802
4490
  active: "ss-badge-active"
3803
4491
  };
3804
- function Aa({
4492
+ function Ma({
3805
4493
  customerId: a,
3806
4494
  portalToken: s,
3807
- onChangePlan: t,
4495
+ onChangePlan: r,
3808
4496
  onCancel: o,
3809
4497
  appearance: n
3810
4498
  }) {
3811
- const { appearance: u } = L(), { customer: l, isLoading: c, error: d } = Ia(a, s);
3812
- return /* @__PURE__ */ e(q, { appearance: n ?? u, children: /* @__PURE__ */ r("div", { className: "ss-card", children: [
4499
+ const { appearance: u } = A(), { customer: i, isLoading: l, error: d } = La(a, s);
4500
+ return /* @__PURE__ */ e(H, { appearance: n ?? u, children: /* @__PURE__ */ t("div", { className: "ss-card", children: [
3813
4501
  /* @__PURE__ */ e("h2", { className: "ss-title", children: "Subscription" }),
3814
- c && /* @__PURE__ */ r("div", { className: "ss-loading", children: [
4502
+ l && /* @__PURE__ */ t("div", { className: "ss-loading", children: [
3815
4503
  /* @__PURE__ */ e("span", { className: "ss-spinner" }),
3816
4504
  " Loading..."
3817
4505
  ] }),
3818
4506
  d && /* @__PURE__ */ e("div", { className: "ss-global-error", children: d }),
3819
- l && !c && /* @__PURE__ */ r(G, { children: [
3820
- /* @__PURE__ */ r("div", { className: "ss-field", children: [
4507
+ i && !l && /* @__PURE__ */ t(j, { children: [
4508
+ /* @__PURE__ */ t("div", { className: "ss-field", children: [
3821
4509
  /* @__PURE__ */ e("label", { className: "ss-label", children: "Customer" }),
3822
- /* @__PURE__ */ e("input", { className: "ss-input", value: l.name || l.email, disabled: !0, readOnly: !0 })
4510
+ /* @__PURE__ */ e("input", { className: "ss-input", value: i.name || i.email, disabled: !0, readOnly: !0 })
3823
4511
  ] }),
3824
- /* @__PURE__ */ r("div", { className: "ss-field", children: [
4512
+ /* @__PURE__ */ t("div", { className: "ss-field", children: [
3825
4513
  /* @__PURE__ */ e("label", { className: "ss-label", children: "Status" }),
3826
- /* @__PURE__ */ e("div", { children: /* @__PURE__ */ e("span", { className: `ss-badge ${Ba.active}`, children: "Active" }) })
4514
+ /* @__PURE__ */ e("div", { children: /* @__PURE__ */ e("span", { className: `ss-badge ${Ta.active}`, children: "Active" }) })
3827
4515
  ] }),
3828
- /* @__PURE__ */ r("div", { className: "ss-btn-group", children: [
3829
- t && /* @__PURE__ */ e("button", { type: "button", className: "ss-btn ss-btn-primary", onClick: t, children: "Change plan" }),
4516
+ /* @__PURE__ */ t("div", { className: "ss-btn-group", children: [
4517
+ r && /* @__PURE__ */ e("button", { type: "button", className: "ss-btn ss-btn-primary", onClick: r, children: "Change plan" }),
3830
4518
  o && /* @__PURE__ */ e("button", { type: "button", className: "ss-btn ss-btn-danger", onClick: o, children: "Cancel subscription" })
3831
4519
  ] })
3832
4520
  ] })
3833
4521
  ] }) });
3834
4522
  }
3835
- const Ta = {
4523
+ const Ua = {
3836
4524
  paid: "ss-badge-active",
3837
4525
  open: "ss-badge-trialing",
3838
4526
  draft: "ss-badge-paused",
3839
4527
  void: "ss-badge-canceled",
3840
4528
  uncollectible: "ss-badge-past-due"
3841
4529
  };
3842
- function Da(a) {
4530
+ function Va(a) {
3843
4531
  return new Date(a).toLocaleDateString("en-US", { year: "numeric", month: "short", day: "numeric" });
3844
4532
  }
3845
- function Ma(a) {
4533
+ function Ra(a) {
3846
4534
  return new Intl.NumberFormat("en-US", { style: "currency", currency: "USD", minimumFractionDigits: 2 }).format(a / 100);
3847
4535
  }
3848
- function Ua({ customerId: a, portalToken: s, appearance: t }) {
3849
- const { appearance: o } = L(), { invoices: n, isLoading: u, error: l } = La(a, s), c = t ?? o, d = [...n].sort((i, f) => new Date(f.createdAt).getTime() - new Date(i.createdAt).getTime());
3850
- return /* @__PURE__ */ e(q, { appearance: c, children: /* @__PURE__ */ r("div", { className: "ss-card ss-card-wide", children: [
4536
+ function Ha({ customerId: a, portalToken: s, appearance: r }) {
4537
+ const { appearance: o } = A(), { invoices: n, isLoading: u, error: i } = Aa(a, s), l = r ?? o, d = [...n].sort((c, f) => new Date(f.createdAt).getTime() - new Date(c.createdAt).getTime());
4538
+ return /* @__PURE__ */ e(H, { appearance: l, children: /* @__PURE__ */ t("div", { className: "ss-card ss-card-wide", children: [
3851
4539
  /* @__PURE__ */ e("h2", { className: "ss-title", children: "Invoices" }),
3852
- u && /* @__PURE__ */ r("div", { className: "ss-loading", children: [
4540
+ u && /* @__PURE__ */ t("div", { className: "ss-loading", children: [
3853
4541
  /* @__PURE__ */ e("span", { className: "ss-spinner" }),
3854
4542
  " Loading..."
3855
4543
  ] }),
3856
- l && /* @__PURE__ */ e("div", { className: "ss-global-error", children: l }),
4544
+ i && /* @__PURE__ */ e("div", { className: "ss-global-error", children: i }),
3857
4545
  !u && d.length === 0 && /* @__PURE__ */ e("p", { className: "ss-empty", children: "No invoices yet." }),
3858
- !u && d.length > 0 && /* @__PURE__ */ r("table", { className: "ss-table", children: [
3859
- /* @__PURE__ */ e("thead", { children: /* @__PURE__ */ r("tr", { children: [
4546
+ !u && d.length > 0 && /* @__PURE__ */ t("table", { className: "ss-table", children: [
4547
+ /* @__PURE__ */ e("thead", { children: /* @__PURE__ */ t("tr", { children: [
3860
4548
  /* @__PURE__ */ e("th", { className: "ss-th", children: "Date" }),
3861
4549
  /* @__PURE__ */ e("th", { className: "ss-th", children: "Amount" }),
3862
4550
  /* @__PURE__ */ e("th", { className: "ss-th", children: "Status" }),
3863
4551
  /* @__PURE__ */ e("th", { className: "ss-th", children: "PDF" })
3864
4552
  ] }) }),
3865
- /* @__PURE__ */ e("tbody", { children: d.map((i) => /* @__PURE__ */ r("tr", { className: "ss-tr", children: [
3866
- /* @__PURE__ */ e("td", { className: "ss-td", children: Da(i.createdAt) }),
3867
- /* @__PURE__ */ e("td", { className: "ss-td", children: Ma(i.amountCents) }),
3868
- /* @__PURE__ */ e("td", { className: "ss-td", children: /* @__PURE__ */ e("span", { className: `ss-badge ${Ta[i.status] || ""}`, children: i.status }) }),
3869
- /* @__PURE__ */ e("td", { className: "ss-td", children: i.pdfUrl ? /* @__PURE__ */ e("a", { className: "ss-link", href: i.pdfUrl, target: "_blank", rel: "noopener noreferrer", children: "Download" }) : "—" })
3870
- ] }, i.id)) })
4553
+ /* @__PURE__ */ e("tbody", { children: d.map((c) => /* @__PURE__ */ t("tr", { className: "ss-tr", children: [
4554
+ /* @__PURE__ */ e("td", { className: "ss-td", children: Va(c.createdAt) }),
4555
+ /* @__PURE__ */ e("td", { className: "ss-td", children: Ra(c.amountCents) }),
4556
+ /* @__PURE__ */ e("td", { className: "ss-td", children: /* @__PURE__ */ e("span", { className: `ss-badge ${Ua[c.status] || ""}`, children: c.status }) }),
4557
+ /* @__PURE__ */ e("td", { className: "ss-td", children: c.pdfUrl ? /* @__PURE__ */ e("a", { className: "ss-link", href: c.pdfUrl, target: "_blank", rel: "noopener noreferrer", children: "Download" }) : "—" })
4558
+ ] }, c.id)) })
3871
4559
  ] })
3872
4560
  ] }) });
3873
4561
  }
3874
- function Va({ customerId: a, limits: s, portalToken: t, appearance: o }) {
3875
- const { appearance: n } = L(), { usage: u, isLoading: l, error: c } = Fa(a, t);
3876
- return /* @__PURE__ */ e(q, { appearance: o ?? n, children: /* @__PURE__ */ r("div", { className: "ss-card", children: [
4562
+ function ja({ customerId: a, limits: s, portalToken: r, appearance: o }) {
4563
+ const { appearance: n } = A(), { usage: u, isLoading: i, error: l } = Da(a, r);
4564
+ return /* @__PURE__ */ e(H, { appearance: o ?? n, children: /* @__PURE__ */ t("div", { className: "ss-card", children: [
3877
4565
  /* @__PURE__ */ e("h2", { className: "ss-title", children: "Usage" }),
3878
- l && /* @__PURE__ */ r("div", { className: "ss-loading", children: [
4566
+ i && /* @__PURE__ */ t("div", { className: "ss-loading", children: [
3879
4567
  /* @__PURE__ */ e("span", { className: "ss-spinner" }),
3880
4568
  " Loading..."
3881
4569
  ] }),
3882
- c && /* @__PURE__ */ e("div", { className: "ss-global-error", children: c }),
3883
- !l && u.length === 0 && /* @__PURE__ */ e("p", { className: "ss-empty", children: "No usage data." }),
3884
- !l && u.map((i) => {
3885
- const f = s == null ? void 0 : s[i.metric], p = f ? Math.min(100, i.total / f * 100) : null;
3886
- return /* @__PURE__ */ r("div", { className: "ss-usage-item", children: [
3887
- /* @__PURE__ */ r("div", { className: "ss-usage-header", children: [
3888
- /* @__PURE__ */ e("span", { className: "ss-usage-metric", children: i.metric }),
3889
- /* @__PURE__ */ r("span", { className: "ss-usage-value", children: [
3890
- i.total.toLocaleString(),
4570
+ l && /* @__PURE__ */ e("div", { className: "ss-global-error", children: l }),
4571
+ !i && u.length === 0 && /* @__PURE__ */ e("p", { className: "ss-empty", children: "No usage data." }),
4572
+ !i && u.map((c) => {
4573
+ const f = s == null ? void 0 : s[c.metric], p = f ? Math.min(100, c.total / f * 100) : null;
4574
+ return /* @__PURE__ */ t("div", { className: "ss-usage-item", children: [
4575
+ /* @__PURE__ */ t("div", { className: "ss-usage-header", children: [
4576
+ /* @__PURE__ */ e("span", { className: "ss-usage-metric", children: c.metric }),
4577
+ /* @__PURE__ */ t("span", { className: "ss-usage-value", children: [
4578
+ c.total.toLocaleString(),
3891
4579
  f ? ` / ${f.toLocaleString()}` : ""
3892
4580
  ] })
3893
4581
  ] }),
@@ -3898,20 +4586,20 @@ function Va({ customerId: a, limits: s, portalToken: t, appearance: o }) {
3898
4586
  style: { width: `${p}%` }
3899
4587
  }
3900
4588
  ) })
3901
- ] }, i.metric);
4589
+ ] }, c.metric);
3902
4590
  })
3903
4591
  ] }) });
3904
4592
  }
3905
- function le({
4593
+ function ue({
3906
4594
  customerId: a,
3907
4595
  portalToken: s,
3908
- limits: t,
4596
+ limits: r,
3909
4597
  onChangePlan: o,
3910
4598
  onCancel: n,
3911
4599
  appearance: u
3912
4600
  }) {
3913
- const { appearance: l } = L(), c = u ?? l, [d, i] = g("subscription");
3914
- return /* @__PURE__ */ e(q, { appearance: c, children: /* @__PURE__ */ r("div", { className: "ss-card ss-card-wide", children: [
4601
+ const { appearance: i } = A(), l = u ?? i, [d, c] = g("subscription");
4602
+ return /* @__PURE__ */ e(H, { appearance: l, children: /* @__PURE__ */ t("div", { className: "ss-card ss-card-wide", children: [
3915
4603
  /* @__PURE__ */ e("h2", { className: "ss-title", children: "Billing" }),
3916
4604
  /* @__PURE__ */ e("div", { className: "ss-tab-group", children: [
3917
4605
  { id: "subscription", label: "Subscription" },
@@ -3922,14 +4610,14 @@ function le({
3922
4610
  {
3923
4611
  type: "button",
3924
4612
  className: `ss-tab ${d === p.id ? "ss-tab-active" : ""}`,
3925
- onClick: () => i(p.id),
4613
+ onClick: () => c(p.id),
3926
4614
  children: p.label
3927
4615
  },
3928
4616
  p.id
3929
4617
  )) }),
3930
- /* @__PURE__ */ r("div", { className: "ss-tab-content", children: [
4618
+ /* @__PURE__ */ t("div", { className: "ss-tab-content", children: [
3931
4619
  d === "subscription" && /* @__PURE__ */ e(
3932
- Aa,
4620
+ Ma,
3933
4621
  {
3934
4622
  customerId: a,
3935
4623
  portalToken: s,
@@ -3937,31 +4625,31 @@ function le({
3937
4625
  onCancel: n
3938
4626
  }
3939
4627
  ),
3940
- d === "invoices" && /* @__PURE__ */ e(Ua, { customerId: a, portalToken: s }),
3941
- d === "usage" && /* @__PURE__ */ e(Va, { customerId: a, portalToken: s, limits: t })
4628
+ d === "invoices" && /* @__PURE__ */ e(Ha, { customerId: a, portalToken: s }),
4629
+ d === "usage" && /* @__PURE__ */ e(ja, { customerId: a, portalToken: s, limits: r })
3942
4630
  ] })
3943
4631
  ] }) });
3944
4632
  }
3945
- function ce({ customerId: a, portalToken: s, onApplied: t, appearance: o }) {
3946
- const { appearance: n } = L(), u = Q(s), l = o ?? n, [c, d] = g(""), [i, f] = g(!1), [p, m] = g(null), [b, w] = g(null), y = $(async (C) => {
3947
- if (C.preventDefault(), !!c.trim()) {
3948
- f(!0), m(null), w(null);
4633
+ function pe({ customerId: a, portalToken: s, onApplied: r, appearance: o }) {
4634
+ const { appearance: n } = A(), u = Z(s), i = o ?? n, [l, d] = g(""), [c, f] = g(!1), [p, m] = g(null), [b, N] = g(null), y = $(async (O) => {
4635
+ if (O.preventDefault(), !!l.trim()) {
4636
+ f(!0), m(null), N(null);
3949
4637
  try {
3950
- const h = await u.applyCoupon(a, c.trim());
3951
- w(`Coupon applied! ${h.discountType === "percent" ? `${h.amount}% off` : `$${(h.amount / 100).toFixed(2)} off`}`), d(""), t == null || t(h);
4638
+ const h = await u.applyCoupon(a, l.trim());
4639
+ N(`Coupon applied! ${h.discountType === "percent" ? `${h.amount}% off` : `$${(h.amount / 100).toFixed(2)} off`}`), d(""), r == null || r(h);
3952
4640
  } catch (h) {
3953
4641
  m(h instanceof Error ? h.message : "Invalid coupon code");
3954
4642
  } finally {
3955
4643
  f(!1);
3956
4644
  }
3957
4645
  }
3958
- }, [u, a, c, t]);
3959
- return /* @__PURE__ */ e(q, { appearance: l, children: /* @__PURE__ */ r("div", { className: "ss-card", children: [
4646
+ }, [u, a, l, r]);
4647
+ return /* @__PURE__ */ e(H, { appearance: i, children: /* @__PURE__ */ t("div", { className: "ss-card", children: [
3960
4648
  /* @__PURE__ */ e("h2", { className: "ss-title", children: "Apply coupon" }),
3961
4649
  p && /* @__PURE__ */ e("div", { className: "ss-global-error", children: p }),
3962
4650
  b && /* @__PURE__ */ e("div", { className: "ss-success-msg", children: b }),
3963
- /* @__PURE__ */ r("form", { onSubmit: y, children: [
3964
- /* @__PURE__ */ r("div", { className: "ss-field", children: [
4651
+ /* @__PURE__ */ t("form", { onSubmit: y, children: [
4652
+ /* @__PURE__ */ t("div", { className: "ss-field", children: [
3965
4653
  /* @__PURE__ */ e("label", { className: "ss-label", htmlFor: "ss-coupon-code", children: "Coupon code" }),
3966
4654
  /* @__PURE__ */ e(
3967
4655
  "input",
@@ -3970,96 +4658,96 @@ function ce({ customerId: a, portalToken: s, onApplied: t, appearance: o }) {
3970
4658
  className: "ss-input",
3971
4659
  type: "text",
3972
4660
  placeholder: "Enter coupon code",
3973
- value: c,
3974
- onChange: (C) => d(C.target.value),
4661
+ value: l,
4662
+ onChange: (O) => d(O.target.value),
3975
4663
  required: !0
3976
4664
  }
3977
4665
  )
3978
4666
  ] }),
3979
- /* @__PURE__ */ r("button", { type: "submit", className: "ss-btn ss-btn-primary", disabled: i || !c.trim(), children: [
3980
- i && /* @__PURE__ */ e("span", { className: "ss-spinner" }),
4667
+ /* @__PURE__ */ t("button", { type: "submit", className: "ss-btn ss-btn-primary", disabled: c || !l.trim(), children: [
4668
+ c && /* @__PURE__ */ e("span", { className: "ss-spinner" }),
3981
4669
  "Apply"
3982
4670
  ] })
3983
4671
  ] })
3984
4672
  ] }) });
3985
4673
  }
3986
- function de() {
3987
- const { client: a } = L();
4674
+ function he() {
4675
+ const { client: a } = A();
3988
4676
  return { report: a.report };
3989
4677
  }
3990
4678
  function da() {
3991
- const { client: a } = L(), [s, t] = g(null), [o, n] = g(!1), [u, l] = g(null), c = $(async (d) => {
3992
- n(!0), l(null);
4679
+ const { client: a } = A(), [s, r] = g(null), [o, n] = g(!1), [u, i] = g(null), l = $(async (d) => {
4680
+ n(!0), i(null);
3993
4681
  try {
3994
- const i = await a.report.executeQuery(d);
3995
- return t(i), i;
3996
- } catch (i) {
3997
- return l(i instanceof Error ? i.message : "Query failed"), null;
4682
+ const c = await a.report.executeQuery(d);
4683
+ return r(c), c;
4684
+ } catch (c) {
4685
+ return i(c instanceof Error ? c.message : "Query failed"), null;
3998
4686
  } finally {
3999
4687
  n(!1);
4000
4688
  }
4001
4689
  }, [a]);
4002
- return { result: s, execute: c, isLoading: o, error: u };
4690
+ return { result: s, execute: l, isLoading: o, error: u };
4003
4691
  }
4004
- function Ha(a) {
4005
- const { client: s } = L(), [t, o] = g(null), [n, u] = g(!0), [l, c] = g(null), d = $(async () => {
4006
- u(!0), c(null);
4692
+ function qa(a) {
4693
+ const { client: s } = A(), [r, o] = g(null), [n, u] = g(!0), [i, l] = g(null), d = $(async () => {
4694
+ u(!0), l(null);
4007
4695
  try {
4008
- const i = await s.report.listQueries(a);
4009
- o(i);
4010
- } catch (i) {
4011
- c(i instanceof Error ? i.message : "Failed to load queries");
4696
+ const c = await s.report.listQueries(a);
4697
+ o(c);
4698
+ } catch (c) {
4699
+ l(c instanceof Error ? c.message : "Failed to load queries");
4012
4700
  } finally {
4013
4701
  u(!1);
4014
4702
  }
4015
4703
  }, [s, a]);
4016
- return V(() => {
4704
+ return U(() => {
4017
4705
  d();
4018
- }, [d]), { queries: (t == null ? void 0 : t.data) ?? [], meta: t == null ? void 0 : t.meta, isLoading: n, error: l, refresh: d };
4706
+ }, [d]), { queries: (r == null ? void 0 : r.data) ?? [], meta: r == null ? void 0 : r.meta, isLoading: n, error: i, refresh: d };
4019
4707
  }
4020
- function ue(a) {
4021
- const { client: s } = L(), [t, o] = g(null), [n, u] = g(!0), [l, c] = g(null), d = $(async () => {
4022
- u(!0), c(null);
4708
+ function ge(a) {
4709
+ const { client: s } = A(), [r, o] = g(null), [n, u] = g(!0), [i, l] = g(null), d = $(async () => {
4710
+ u(!0), l(null);
4023
4711
  try {
4024
- const i = await s.report.getDashboard(a);
4025
- o(i);
4026
- } catch (i) {
4027
- c(i instanceof Error ? i.message : "Failed to load dashboard");
4712
+ const c = await s.report.getDashboard(a);
4713
+ o(c);
4714
+ } catch (c) {
4715
+ l(c instanceof Error ? c.message : "Failed to load dashboard");
4028
4716
  } finally {
4029
4717
  u(!1);
4030
4718
  }
4031
4719
  }, [s, a]);
4032
- return V(() => {
4720
+ return U(() => {
4033
4721
  d();
4034
- }, [d]), { dashboard: t, isLoading: n, error: l, refresh: d };
4722
+ }, [d]), { dashboard: r, isLoading: n, error: i, refresh: d };
4035
4723
  }
4036
- function pe(a, s, t = "https://api.saas-support.com/v1") {
4037
- const o = _(() => {
4038
- const p = new J(t, { type: "embedToken", token: a });
4039
- return new ea(p);
4040
- }, [a, t]), [n, u] = g(null), [l, c] = g(!0), [d, i] = g(null), f = $(async () => {
4041
- c(!0), i(null);
4724
+ function me(a, s, r = "https://api.saas-support.com/v1") {
4725
+ const o = G(() => {
4726
+ const p = new Q(r, { type: "embedToken", token: a });
4727
+ return new ta(p);
4728
+ }, [a, r]), [n, u] = g(null), [i, l] = g(!0), [d, c] = g(null), f = $(async () => {
4729
+ l(!0), c(null);
4042
4730
  try {
4043
4731
  const p = await o.getDashboard(s);
4044
4732
  u(p);
4045
4733
  } catch (p) {
4046
- i(p instanceof Error ? p.message : "Failed to load dashboard");
4734
+ c(p instanceof Error ? p.message : "Failed to load dashboard");
4047
4735
  } finally {
4048
- c(!1);
4736
+ l(!1);
4049
4737
  }
4050
4738
  }, [o, s]);
4051
- return V(() => {
4739
+ return U(() => {
4052
4740
  f();
4053
- }, [f]), { dashboard: n, reportClient: o, isLoading: l, error: d, refresh: f };
4741
+ }, [f]), { dashboard: n, reportClient: o, isLoading: i, error: d, refresh: f };
4054
4742
  }
4055
- function he({ onResult: a, mode: s = "both", placeholder: t, appearance: o }) {
4056
- const { appearance: n } = L(), { execute: u, isLoading: l, error: c } = da(), d = o ?? n, [i, f] = g(""), [p, m] = g(s === "sql" ? "sql" : "nl"), b = $(async (w) => {
4057
- if (w.preventDefault(), !i.trim()) return;
4058
- const C = await u(p === "sql" ? { sql: i } : { naturalLanguage: i });
4059
- C && (a == null || a(C));
4060
- }, [i, p, u, a]);
4061
- return /* @__PURE__ */ e(q, { appearance: d, children: /* @__PURE__ */ r("div", { className: "ss-card ss-card-wide", children: [
4062
- s === "both" && /* @__PURE__ */ r("div", { className: "ss-tab-group ss-tab-group-sm", children: [
4743
+ function fe({ onResult: a, mode: s = "both", placeholder: r, appearance: o }) {
4744
+ const { appearance: n } = A(), { execute: u, isLoading: i, error: l } = da(), d = o ?? n, [c, f] = g(""), [p, m] = g(s === "sql" ? "sql" : "nl"), b = $(async (N) => {
4745
+ if (N.preventDefault(), !c.trim()) return;
4746
+ const O = await u(p === "sql" ? { sql: c } : { naturalLanguage: c });
4747
+ O && (a == null || a(O));
4748
+ }, [c, p, u, a]);
4749
+ return /* @__PURE__ */ e(H, { appearance: d, children: /* @__PURE__ */ t("div", { className: "ss-card ss-card-wide", children: [
4750
+ s === "both" && /* @__PURE__ */ t("div", { className: "ss-tab-group ss-tab-group-sm", children: [
4063
4751
  /* @__PURE__ */ e(
4064
4752
  "button",
4065
4753
  {
@@ -4079,58 +4767,58 @@ function he({ onResult: a, mode: s = "both", placeholder: t, appearance: o }) {
4079
4767
  }
4080
4768
  )
4081
4769
  ] }),
4082
- c && /* @__PURE__ */ e("div", { className: "ss-global-error", children: c }),
4083
- /* @__PURE__ */ r("form", { onSubmit: b, children: [
4770
+ l && /* @__PURE__ */ e("div", { className: "ss-global-error", children: l }),
4771
+ /* @__PURE__ */ t("form", { onSubmit: b, children: [
4084
4772
  /* @__PURE__ */ e("div", { className: "ss-field", children: /* @__PURE__ */ e(
4085
4773
  "textarea",
4086
4774
  {
4087
4775
  className: "ss-input ss-query-textarea",
4088
- placeholder: t ?? (p === "sql" ? "SELECT ..." : "Ask a question about your data..."),
4089
- value: i,
4090
- onChange: (w) => f(w.target.value),
4776
+ placeholder: r ?? (p === "sql" ? "SELECT ..." : "Ask a question about your data..."),
4777
+ value: c,
4778
+ onChange: (N) => f(N.target.value),
4091
4779
  rows: 3
4092
4780
  }
4093
4781
  ) }),
4094
- /* @__PURE__ */ r("button", { type: "submit", className: "ss-btn ss-btn-primary", disabled: l || !i.trim(), children: [
4095
- l && /* @__PURE__ */ e("span", { className: "ss-spinner" }),
4782
+ /* @__PURE__ */ t("button", { type: "submit", className: "ss-btn ss-btn-primary", disabled: i || !c.trim(), children: [
4783
+ i && /* @__PURE__ */ e("span", { className: "ss-spinner" }),
4096
4784
  "Run query"
4097
4785
  ] })
4098
4786
  ] })
4099
4787
  ] }) });
4100
4788
  }
4101
- function qa({ columns: a, rows: s, sortable: t = !0, maxRows: o, appearance: n }) {
4102
- const { appearance: u } = L(), l = n ?? u, [c, d] = g(null), [i, f] = g("asc"), p = _(() => c ? [...s].sort((y, C) => {
4103
- const h = y[c], N = C[c];
4104
- if (h == null && N == null) return 0;
4789
+ function Wa({ columns: a, rows: s, sortable: r = !0, maxRows: o, appearance: n }) {
4790
+ const { appearance: u } = A(), i = n ?? u, [l, d] = g(null), [c, f] = g("asc"), p = G(() => l ? [...s].sort((y, O) => {
4791
+ const h = y[l], S = O[l];
4792
+ if (h == null && S == null) return 0;
4105
4793
  if (h == null) return 1;
4106
- if (N == null) return -1;
4107
- if (typeof h == "number" && typeof N == "number")
4108
- return i === "asc" ? h - N : N - h;
4109
- const k = String(h), z = String(N);
4110
- return i === "asc" ? k.localeCompare(z) : z.localeCompare(k);
4111
- }) : s, [s, c, i]), m = o ? p.slice(0, o) : p, b = (y) => {
4112
- t && (c === y ? f((C) => C === "asc" ? "desc" : "asc") : (d(y), f("asc")));
4794
+ if (S == null) return -1;
4795
+ if (typeof h == "number" && typeof S == "number")
4796
+ return c === "asc" ? h - S : S - h;
4797
+ const k = String(h), P = String(S);
4798
+ return c === "asc" ? k.localeCompare(P) : P.localeCompare(k);
4799
+ }) : s, [s, l, c]), m = o ? p.slice(0, o) : p, b = (y) => {
4800
+ r && (l === y ? f((O) => O === "asc" ? "desc" : "asc") : (d(y), f("asc")));
4113
4801
  };
4114
- function w(y) {
4802
+ function N(y) {
4115
4803
  return y == null ? "" : typeof y == "object" ? JSON.stringify(y) : String(y);
4116
4804
  }
4117
- return /* @__PURE__ */ e(q, { appearance: l, children: /* @__PURE__ */ r("div", { className: "ss-table-container", children: [
4118
- /* @__PURE__ */ r("table", { className: "ss-table", children: [
4119
- /* @__PURE__ */ e("thead", { children: /* @__PURE__ */ e("tr", { children: a.map((y) => /* @__PURE__ */ r(
4805
+ return /* @__PURE__ */ e(H, { appearance: i, children: /* @__PURE__ */ t("div", { className: "ss-table-container", children: [
4806
+ /* @__PURE__ */ t("table", { className: "ss-table", children: [
4807
+ /* @__PURE__ */ e("thead", { children: /* @__PURE__ */ e("tr", { children: a.map((y) => /* @__PURE__ */ t(
4120
4808
  "th",
4121
4809
  {
4122
- className: `ss-th ${t ? "ss-th-sortable" : ""} ${c === y ? i === "asc" ? "ss-sorted-asc" : "ss-sorted-desc" : ""}`,
4810
+ className: `ss-th ${r ? "ss-th-sortable" : ""} ${l === y ? c === "asc" ? "ss-sorted-asc" : "ss-sorted-desc" : ""}`,
4123
4811
  onClick: () => b(y),
4124
4812
  children: [
4125
4813
  y,
4126
- c === y && /* @__PURE__ */ e("span", { className: "ss-sort-indicator", children: i === "asc" ? " ▲" : " ▼" })
4814
+ l === y && /* @__PURE__ */ e("span", { className: "ss-sort-indicator", children: c === "asc" ? " ▲" : " ▼" })
4127
4815
  ]
4128
4816
  },
4129
4817
  y
4130
4818
  )) }) }),
4131
- /* @__PURE__ */ e("tbody", { children: m.map((y, C) => /* @__PURE__ */ e("tr", { className: "ss-tr", children: a.map((h) => /* @__PURE__ */ e("td", { className: "ss-td", children: w(y[h]) }, h)) }, C)) })
4819
+ /* @__PURE__ */ e("tbody", { children: m.map((y, O) => /* @__PURE__ */ e("tr", { className: "ss-tr", children: a.map((h) => /* @__PURE__ */ e("td", { className: "ss-td", children: N(y[h]) }, h)) }, O)) })
4132
4820
  ] }),
4133
- o && s.length > o && /* @__PURE__ */ r("div", { className: "ss-table-footer", children: [
4821
+ o && s.length > o && /* @__PURE__ */ t("div", { className: "ss-table-footer", children: [
4134
4822
  "Showing ",
4135
4823
  o,
4136
4824
  " of ",
@@ -4139,103 +4827,103 @@ function qa({ columns: a, rows: s, sortable: t = !0, maxRows: o, appearance: n }
4139
4827
  ] })
4140
4828
  ] }) });
4141
4829
  }
4142
- function ja(a, s = "#6366f1") {
4143
- const t = parseInt(s.replace("#", "").slice(0, 2), 16), o = [];
4830
+ function _a(a, s = "#6366f1") {
4831
+ const r = parseInt(s.replace("#", "").slice(0, 2), 16), o = [];
4144
4832
  for (let n = 0; n < a; n++) {
4145
- const u = (t + n * Math.floor(360 / Math.max(a, 1))) % 360;
4833
+ const u = (r + n * Math.floor(360 / Math.max(a, 1))) % 360;
4146
4834
  o.push(`hsl(${u}, 65%, 55%)`);
4147
4835
  }
4148
4836
  return o;
4149
4837
  }
4150
- function Ra({ labels: a, values: s, w: t, h: o, colors: n }) {
4151
- const u = Math.max(...s, 1), l = 40, c = t - l * 2, d = o - l * 2, i = Math.max(1, c / a.length - 4);
4152
- return /* @__PURE__ */ r("g", { children: [
4153
- /* @__PURE__ */ e("line", { x1: l, y1: o - l, x2: t - l, y2: o - l, stroke: "#ccc", strokeWidth: 1 }),
4838
+ function Ga({ labels: a, values: s, w: r, h: o, colors: n }) {
4839
+ const u = Math.max(...s, 1), i = 40, l = r - i * 2, d = o - i * 2, c = Math.max(1, l / a.length - 4);
4840
+ return /* @__PURE__ */ t("g", { children: [
4841
+ /* @__PURE__ */ e("line", { x1: i, y1: o - i, x2: r - i, y2: o - i, stroke: "#ccc", strokeWidth: 1 }),
4154
4842
  s.map((f, p) => {
4155
- const m = f / u * d, b = l + c / a.length * p + 2, w = o - l - m;
4156
- return /* @__PURE__ */ r("g", { children: [
4157
- /* @__PURE__ */ e("rect", { x: b, y: w, width: i, height: m, fill: n[p % n.length], rx: 2 }),
4158
- /* @__PURE__ */ e("text", { x: b + i / 2, y: o - l + 14, textAnchor: "middle", fontSize: 10, fill: "#666", children: a[p].length > 8 ? a[p].slice(0, 8) + "..." : a[p] })
4843
+ const m = f / u * d, b = i + l / a.length * p + 2, N = o - i - m;
4844
+ return /* @__PURE__ */ t("g", { children: [
4845
+ /* @__PURE__ */ e("rect", { x: b, y: N, width: c, height: m, fill: n[p % n.length], rx: 2 }),
4846
+ /* @__PURE__ */ e("text", { x: b + c / 2, y: o - i + 14, textAnchor: "middle", fontSize: 10, fill: "#666", children: a[p].length > 8 ? a[p].slice(0, 8) + "..." : a[p] })
4159
4847
  ] }, p);
4160
4848
  })
4161
4849
  ] });
4162
4850
  }
4163
- function Wa({ labels: a, values: s, w: t, h: o, colors: n }) {
4164
- const u = Math.max(...s, 1), l = 40, c = t - l * 2, d = o - l * 2, i = a.length > 1 ? c / (a.length - 1) : 0, f = s.map((p, m) => {
4165
- const b = l + i * m, w = o - l - p / u * d;
4166
- return `${b},${w}`;
4851
+ function Ya({ labels: a, values: s, w: r, h: o, colors: n }) {
4852
+ const u = Math.max(...s, 1), i = 40, l = r - i * 2, d = o - i * 2, c = a.length > 1 ? l / (a.length - 1) : 0, f = s.map((p, m) => {
4853
+ const b = i + c * m, N = o - i - p / u * d;
4854
+ return `${b},${N}`;
4167
4855
  });
4168
- return /* @__PURE__ */ r("g", { children: [
4856
+ return /* @__PURE__ */ t("g", { children: [
4169
4857
  [0.25, 0.5, 0.75, 1].map((p) => {
4170
- const m = o - l - p * d;
4171
- return /* @__PURE__ */ e("line", { x1: l, y1: m, x2: t - l, y2: m, stroke: "#eee", strokeWidth: 1 }, p);
4858
+ const m = o - i - p * d;
4859
+ return /* @__PURE__ */ e("line", { x1: i, y1: m, x2: r - i, y2: m, stroke: "#eee", strokeWidth: 1 }, p);
4172
4860
  }),
4173
4861
  /* @__PURE__ */ e("polyline", { points: f.join(" "), fill: "none", stroke: n[0], strokeWidth: 2 }),
4174
4862
  s.map((p, m) => {
4175
- const b = l + i * m, w = o - l - p / u * d;
4176
- return /* @__PURE__ */ e("circle", { cx: b, cy: w, r: 4, fill: n[0] }, m);
4863
+ const b = i + c * m, N = o - i - p / u * d;
4864
+ return /* @__PURE__ */ e("circle", { cx: b, cy: N, r: 4, fill: n[0] }, m);
4177
4865
  })
4178
4866
  ] });
4179
4867
  }
4180
- function _a({ labels: a, values: s, w: t, h: o, colors: n }) {
4181
- const u = s.reduce((m, b) => m + b, 0) || 1, l = t / 2, c = o / 2 - 20, d = Math.min(t, o) / 2 - 40, i = 2 * Math.PI * d;
4868
+ function Ja({ labels: a, values: s, w: r, h: o, colors: n }) {
4869
+ const u = s.reduce((m, b) => m + b, 0) || 1, i = r / 2, l = o / 2 - 20, d = Math.min(r, o) / 2 - 40, c = 2 * Math.PI * d;
4182
4870
  let f = 0;
4183
4871
  const p = s.map((m, b) => {
4184
- const w = m / u, y = w * i, C = { dash: y, offset: f, color: n[b % n.length], label: a[b], pct: w };
4185
- return f += y, C;
4872
+ const N = m / u, y = N * c, O = { dash: y, offset: f, color: n[b % n.length], label: a[b], pct: N };
4873
+ return f += y, O;
4186
4874
  });
4187
- return /* @__PURE__ */ r("g", { children: [
4875
+ return /* @__PURE__ */ t("g", { children: [
4188
4876
  p.map((m, b) => /* @__PURE__ */ e(
4189
4877
  "circle",
4190
4878
  {
4191
- cx: l,
4192
- cy: c,
4879
+ cx: i,
4880
+ cy: l,
4193
4881
  r: d,
4194
4882
  fill: "none",
4195
4883
  stroke: m.color,
4196
4884
  strokeWidth: d * 0.6,
4197
- strokeDasharray: `${m.dash} ${i - m.dash}`,
4885
+ strokeDasharray: `${m.dash} ${c - m.dash}`,
4198
4886
  strokeDashoffset: -m.offset,
4199
- transform: `rotate(-90 ${l} ${c})`
4887
+ transform: `rotate(-90 ${i} ${l})`
4200
4888
  },
4201
4889
  b
4202
4890
  )),
4203
- /* @__PURE__ */ e("g", { transform: `translate(${l - a.length * 30}, ${o - 20})`, children: p.slice(0, 6).map((m, b) => /* @__PURE__ */ r("g", { transform: `translate(${b * 60}, 0)`, children: [
4891
+ /* @__PURE__ */ e("g", { transform: `translate(${i - a.length * 30}, ${o - 20})`, children: p.slice(0, 6).map((m, b) => /* @__PURE__ */ t("g", { transform: `translate(${b * 60}, 0)`, children: [
4204
4892
  /* @__PURE__ */ e("rect", { width: 10, height: 10, fill: m.color, rx: 2 }),
4205
4893
  /* @__PURE__ */ e("text", { x: 14, y: 9, fontSize: 9, fill: "#666", children: m.label.length > 6 ? m.label.slice(0, 6) + ".." : m.label })
4206
4894
  ] }, b)) })
4207
4895
  ] });
4208
4896
  }
4209
- function Ga({ type: a, data: s, title: t, width: o = 400, height: n = 300, appearance: u }) {
4210
- const { appearance: l } = L(), c = u ?? l, d = _(() => ja(s.labels.length), [s.labels.length]);
4211
- return /* @__PURE__ */ e(q, { appearance: c, children: /* @__PURE__ */ r("div", { className: "ss-chart-container", children: [
4212
- t && /* @__PURE__ */ e("h3", { className: "ss-chart-title", children: t }),
4213
- /* @__PURE__ */ r("svg", { viewBox: `0 0 ${o} ${n}`, width: "100%", style: { maxWidth: o }, children: [
4214
- a === "bar" && /* @__PURE__ */ e(Ra, { labels: s.labels, values: s.values, w: o, h: n, colors: d }),
4215
- a === "line" && /* @__PURE__ */ e(Wa, { labels: s.labels, values: s.values, w: o, h: n, colors: d }),
4216
- a === "pie" && /* @__PURE__ */ e(_a, { labels: s.labels, values: s.values, w: o, h: n, colors: d })
4897
+ function Qa({ type: a, data: s, title: r, width: o = 400, height: n = 300, appearance: u }) {
4898
+ const { appearance: i } = A(), l = u ?? i, d = G(() => _a(s.labels.length), [s.labels.length]);
4899
+ return /* @__PURE__ */ e(H, { appearance: l, children: /* @__PURE__ */ t("div", { className: "ss-chart-container", children: [
4900
+ r && /* @__PURE__ */ e("h3", { className: "ss-chart-title", children: r }),
4901
+ /* @__PURE__ */ t("svg", { viewBox: `0 0 ${o} ${n}`, width: "100%", style: { maxWidth: o }, children: [
4902
+ a === "bar" && /* @__PURE__ */ e(Ga, { labels: s.labels, values: s.values, w: o, h: n, colors: d }),
4903
+ a === "line" && /* @__PURE__ */ e(Ya, { labels: s.labels, values: s.values, w: o, h: n, colors: d }),
4904
+ a === "pie" && /* @__PURE__ */ e(Ja, { labels: s.labels, values: s.values, w: o, h: n, colors: d })
4217
4905
  ] })
4218
4906
  ] }) });
4219
4907
  }
4220
- function ge({ dashboardId: a, embedToken: s, baseUrl: t, refreshInterval: o, appearance: n }) {
4221
- const u = L(), l = n ?? (u == null ? void 0 : u.appearance), c = _(() => {
4908
+ function be({ dashboardId: a, embedToken: s, baseUrl: r, refreshInterval: o, appearance: n }) {
4909
+ const u = A(), i = n ?? (u == null ? void 0 : u.appearance), l = G(() => {
4222
4910
  if (s) {
4223
- const h = t ?? "https://api.saas-support.com/v1", N = new J(h, { type: "embedToken", token: s });
4224
- return new ea(N);
4911
+ const h = r ?? "https://api.saas-support.com/v1", S = new Q(h, { type: "embedToken", token: s });
4912
+ return new ta(S);
4225
4913
  }
4226
4914
  return u.client.report;
4227
- }, [s, t, u]), [d, i] = g([]), [f, p] = g({}), [m, b] = g(!0), [w, y] = g(null), C = $(async () => {
4915
+ }, [s, r, u]), [d, c] = g([]), [f, p] = g({}), [m, b] = g(!0), [N, y] = g(null), O = $(async () => {
4228
4916
  b(!0), y(null);
4229
4917
  try {
4230
- const h = await c.getDashboard(a), N = JSON.parse(h.layoutJson || "[]");
4231
- i(N);
4918
+ const h = await l.getDashboard(a), S = JSON.parse(h.layoutJson || "[]");
4919
+ c(S);
4232
4920
  const k = {};
4233
- for (const z of N)
4921
+ for (const P of S)
4234
4922
  try {
4235
- const E = await c.listQueries({ search: z.queryId, perPage: 1 });
4236
- if (E.data.length > 0 && E.data[0].generatedSql) {
4237
- const I = await c.executeQuery({ sql: E.data[0].generatedSql });
4238
- k[z.queryId] = I;
4923
+ const I = await l.listQueries({ search: P.queryId, perPage: 1 });
4924
+ if (I.data.length > 0 && I.data[0].generatedSql) {
4925
+ const F = await l.executeQuery({ sql: I.data[0].generatedSql });
4926
+ k[P.queryId] = F;
4239
4927
  }
4240
4928
  } catch {
4241
4929
  }
@@ -4245,71 +4933,71 @@ function ge({ dashboardId: a, embedToken: s, baseUrl: t, refreshInterval: o, app
4245
4933
  } finally {
4246
4934
  b(!1);
4247
4935
  }
4248
- }, [c, a]);
4249
- return V(() => {
4250
- C();
4251
- }, [C]), V(() => {
4936
+ }, [l, a]);
4937
+ return U(() => {
4938
+ O();
4939
+ }, [O]), U(() => {
4252
4940
  if (!o || o <= 0) return;
4253
- const h = setInterval(C, o * 1e3);
4941
+ const h = setInterval(O, o * 1e3);
4254
4942
  return () => clearInterval(h);
4255
- }, [o, C]), /* @__PURE__ */ e(q, { appearance: l, children: /* @__PURE__ */ r("div", { className: "ss-dashboard-grid", children: [
4256
- m && /* @__PURE__ */ r("div", { className: "ss-loading", children: [
4943
+ }, [o, O]), /* @__PURE__ */ e(H, { appearance: i, children: /* @__PURE__ */ t("div", { className: "ss-dashboard-grid", children: [
4944
+ m && /* @__PURE__ */ t("div", { className: "ss-loading", children: [
4257
4945
  /* @__PURE__ */ e("span", { className: "ss-spinner" }),
4258
4946
  " Loading dashboard..."
4259
4947
  ] }),
4260
- w && /* @__PURE__ */ e("div", { className: "ss-global-error", children: w }),
4261
- !m && d.map((h, N) => {
4948
+ N && /* @__PURE__ */ e("div", { className: "ss-global-error", children: N }),
4949
+ !m && d.map((h, S) => {
4262
4950
  const k = f[h.queryId];
4263
4951
  if (!k) return null;
4264
- const z = k.columns.length >= 2 ? {
4265
- labels: k.rows.map((E) => String(E[k.columns[0]] ?? "")),
4266
- values: k.rows.map((E) => Number(E[k.columns[1]] ?? 0))
4952
+ const P = k.columns.length >= 2 ? {
4953
+ labels: k.rows.map((I) => String(I[k.columns[0]] ?? "")),
4954
+ values: k.rows.map((I) => Number(I[k.columns[1]] ?? 0))
4267
4955
  } : { labels: [], values: [] };
4268
- return /* @__PURE__ */ r("div", { className: "ss-widget", children: [
4956
+ return /* @__PURE__ */ t("div", { className: "ss-widget", children: [
4269
4957
  h.title && /* @__PURE__ */ e("h4", { className: "ss-widget-header", children: h.title }),
4270
- h.chartType === "table" ? /* @__PURE__ */ e(qa, { columns: k.columns, rows: k.rows, maxRows: 50 }) : /* @__PURE__ */ e(
4271
- Ga,
4958
+ h.chartType === "table" ? /* @__PURE__ */ e(Wa, { columns: k.columns, rows: k.rows, maxRows: 50 }) : /* @__PURE__ */ e(
4959
+ Qa,
4272
4960
  {
4273
4961
  type: h.chartType || "bar",
4274
- data: z,
4962
+ data: P,
4275
4963
  width: h.w,
4276
4964
  height: h.h
4277
4965
  }
4278
4966
  )
4279
- ] }, N);
4967
+ ] }, S);
4280
4968
  })
4281
4969
  ] }) });
4282
4970
  }
4283
- function Ya(a) {
4971
+ function Za(a) {
4284
4972
  return new Date(a).toLocaleDateString("en-US", { year: "numeric", month: "short", day: "numeric" });
4285
4973
  }
4286
- function fe({ onSelectQuery: a, onRunQuery: s, appearance: t }) {
4287
- const { appearance: o } = L(), { queries: n, isLoading: u, error: l } = Ha(), { execute: c, isLoading: d } = da(), i = t ?? o, f = $(async (p) => {
4974
+ function xe({ onSelectQuery: a, onRunQuery: s, appearance: r }) {
4975
+ const { appearance: o } = A(), { queries: n, isLoading: u, error: i } = qa(), { execute: l, isLoading: d } = da(), c = r ?? o, f = $(async (p) => {
4288
4976
  if (!p.generatedSql) return;
4289
- const m = await c({ sql: p.generatedSql });
4977
+ const m = await l({ sql: p.generatedSql });
4290
4978
  m && (s == null || s(m));
4291
- }, [c, s]);
4292
- return /* @__PURE__ */ e(q, { appearance: i, children: /* @__PURE__ */ r("div", { className: "ss-card ss-card-wide", children: [
4979
+ }, [l, s]);
4980
+ return /* @__PURE__ */ e(H, { appearance: c, children: /* @__PURE__ */ t("div", { className: "ss-card ss-card-wide", children: [
4293
4981
  /* @__PURE__ */ e("h2", { className: "ss-title", children: "Saved Queries" }),
4294
- u && /* @__PURE__ */ r("div", { className: "ss-loading", children: [
4982
+ u && /* @__PURE__ */ t("div", { className: "ss-loading", children: [
4295
4983
  /* @__PURE__ */ e("span", { className: "ss-spinner" }),
4296
4984
  " Loading..."
4297
4985
  ] }),
4298
- l && /* @__PURE__ */ e("div", { className: "ss-global-error", children: l }),
4986
+ i && /* @__PURE__ */ e("div", { className: "ss-global-error", children: i }),
4299
4987
  !u && n.length === 0 && /* @__PURE__ */ e("p", { className: "ss-empty", children: "No saved queries." }),
4300
- !u && n.map((p) => /* @__PURE__ */ r(
4988
+ !u && n.map((p) => /* @__PURE__ */ t(
4301
4989
  "div",
4302
4990
  {
4303
4991
  className: "ss-saved-query-card",
4304
4992
  onClick: () => a == null ? void 0 : a(p),
4305
4993
  children: [
4306
- /* @__PURE__ */ r("div", { className: "ss-saved-query-header", children: [
4994
+ /* @__PURE__ */ t("div", { className: "ss-saved-query-header", children: [
4307
4995
  /* @__PURE__ */ e("span", { className: "ss-saved-query-name", children: p.name }),
4308
4996
  p.chartType && /* @__PURE__ */ e("span", { className: "ss-badge", children: p.chartType })
4309
4997
  ] }),
4310
4998
  p.naturalLanguage && /* @__PURE__ */ e("p", { className: "ss-saved-query-desc", children: p.naturalLanguage }),
4311
- /* @__PURE__ */ r("div", { className: "ss-saved-query-footer", children: [
4312
- /* @__PURE__ */ e("span", { className: "ss-saved-query-date", children: Ya(p.createdAt) }),
4999
+ /* @__PURE__ */ t("div", { className: "ss-saved-query-footer", children: [
5000
+ /* @__PURE__ */ e("span", { className: "ss-saved-query-date", children: Za(p.createdAt) }),
4313
5001
  /* @__PURE__ */ e(
4314
5002
  "button",
4315
5003
  {
@@ -4329,106 +5017,107 @@ function fe({ onSelectQuery: a, onRunQuery: s, appearance: t }) {
4329
5017
  ))
4330
5018
  ] }) });
4331
5019
  }
4332
- function me({ embedToken: a, dashboardId: s, baseUrl: t = "https://api.saas-support.com/v1", refreshInterval: o, appearance: n }) {
4333
- const u = _(() => {
4334
- const y = new J(t, { type: "embedToken", token: a });
4335
- return new ea(y);
4336
- }, [a, t]), [l, c] = g([]), [d, i] = g(!0), [f, p] = g(null), m = _(() => X(n), [n]), b = _(() => aa(m), [m]), w = $(async () => {
4337
- i(!0), p(null);
5020
+ function ye({ embedToken: a, dashboardId: s, baseUrl: r = "https://api.saas-support.com/v1", refreshInterval: o, appearance: n }) {
5021
+ const u = G(() => {
5022
+ const y = new Q(r, { type: "embedToken", token: a });
5023
+ return new ta(y);
5024
+ }, [a, r]), [i, l] = g([]), [d, c] = g(!0), [f, p] = g(null), m = G(() => aa(n), [n]), b = G(() => ea(m), [m]), N = $(async () => {
5025
+ c(!0), p(null);
4338
5026
  try {
4339
- const y = await u.getDashboard(s), C = JSON.parse(y.layoutJson || "[]"), h = await Promise.all(
4340
- C.map(async (N) => {
5027
+ const y = await u.getDashboard(s), O = JSON.parse(y.layoutJson || "[]"), h = await Promise.all(
5028
+ O.map(async (S) => {
4341
5029
  try {
4342
- const k = await u.listQueries({ search: N.queryId, perPage: 1 });
5030
+ const k = await u.listQueries({ search: S.queryId, perPage: 1 });
4343
5031
  if (k.data.length > 0 && k.data[0].generatedSql) {
4344
- const z = await u.executeQuery({ sql: k.data[0].generatedSql });
4345
- return { ...N, result: z };
5032
+ const P = await u.executeQuery({ sql: k.data[0].generatedSql });
5033
+ return { ...S, result: P };
4346
5034
  }
4347
5035
  } catch {
4348
5036
  }
4349
- return N;
5037
+ return S;
4350
5038
  })
4351
5039
  );
4352
- c(h);
5040
+ l(h);
4353
5041
  } catch (y) {
4354
5042
  p(y instanceof Error ? y.message : "Failed to load dashboard");
4355
5043
  } finally {
4356
- i(!1);
5044
+ c(!1);
4357
5045
  }
4358
5046
  }, [u, s]);
4359
- return V(() => {
4360
- w();
4361
- }, [w]), V(() => {
5047
+ return U(() => {
5048
+ N();
5049
+ }, [N]), U(() => {
4362
5050
  if (!o || o <= 0) return;
4363
- const y = setInterval(w, o * 1e3);
5051
+ const y = setInterval(N, o * 1e3);
4364
5052
  return () => clearInterval(y);
4365
- }, [o, w]), /* @__PURE__ */ e(
5053
+ }, [o, N]), /* @__PURE__ */ e(
4366
5054
  "div",
4367
5055
  {
4368
5056
  ref: (y) => {
4369
5057
  if (!y || y.shadowRoot) return;
4370
- const C = y.attachShadow({ mode: "open" }), h = document.createElement("style");
4371
- h.textContent = b, C.appendChild(h);
4372
- const N = document.createElement("div");
4373
- C.appendChild(N);
5058
+ const O = y.attachShadow({ mode: "open" }), h = document.createElement("style");
5059
+ h.textContent = b, O.appendChild(h);
5060
+ const S = document.createElement("div");
5061
+ O.appendChild(S);
4374
5062
  },
4375
5063
  style: { display: "contents" },
4376
- children: /* @__PURE__ */ r("div", { className: "ss-dashboard-grid", children: [
5064
+ children: /* @__PURE__ */ t("div", { className: "ss-dashboard-grid", children: [
4377
5065
  d && /* @__PURE__ */ e("div", { className: "ss-loading", children: "Loading dashboard..." }),
4378
5066
  f && /* @__PURE__ */ e("div", { className: "ss-global-error", children: f }),
4379
- !d && l.map((y, C) => {
5067
+ !d && i.map((y, O) => {
4380
5068
  if (!y.result) return null;
4381
- const { columns: h, rows: N } = y.result;
4382
- return /* @__PURE__ */ r("div", { className: "ss-widget", children: [
5069
+ const { columns: h, rows: S } = y.result;
5070
+ return /* @__PURE__ */ t("div", { className: "ss-widget", children: [
4383
5071
  y.title && /* @__PURE__ */ e("h4", { className: "ss-widget-header", children: y.title }),
4384
- /* @__PURE__ */ r("table", { className: "ss-table", children: [
5072
+ /* @__PURE__ */ t("table", { className: "ss-table", children: [
4385
5073
  /* @__PURE__ */ e("thead", { children: /* @__PURE__ */ e("tr", { children: h.map((k) => /* @__PURE__ */ e("th", { className: "ss-th", children: k }, k)) }) }),
4386
- /* @__PURE__ */ e("tbody", { children: N.slice(0, 50).map((k, z) => /* @__PURE__ */ e("tr", { className: "ss-tr", children: h.map((E) => /* @__PURE__ */ e("td", { className: "ss-td", children: String(k[E] ?? "") }, E)) }, z)) })
5074
+ /* @__PURE__ */ e("tbody", { children: S.slice(0, 50).map((k, P) => /* @__PURE__ */ e("tr", { className: "ss-tr", children: h.map((I) => /* @__PURE__ */ e("td", { className: "ss-td", children: String(k[I] ?? "") }, I)) }, P)) })
4387
5075
  ] })
4388
- ] }, C);
5076
+ ] }, O);
4389
5077
  })
4390
5078
  ] })
4391
5079
  }
4392
5080
  );
4393
5081
  }
4394
5082
  export {
4395
- Ga as Chart,
4396
- ce as CouponInput,
4397
- ge as DashboardView,
4398
- qa as DataTable,
4399
- Ua as InvoiceHistory,
4400
- ne as OrgSwitcher,
4401
- le as PaymentPortal,
4402
- oe as PricingTable,
4403
- he as QueryInput,
4404
- me as ReportEmbed,
5083
+ Qa as Chart,
5084
+ pe as CouponInput,
5085
+ be as DashboardView,
5086
+ Wa as DataTable,
5087
+ Ha as InvoiceHistory,
5088
+ le as OrgSwitcher,
5089
+ ue as PaymentPortal,
5090
+ ce as PricingTable,
5091
+ fe as QueryInput,
5092
+ ye as ReportEmbed,
4405
5093
  ra as SaaSContext,
4406
- ye as SaaSError,
4407
- Xa as SaaSProvider,
4408
- xa as SaaSSupport,
4409
- fe as SavedQueryList,
4410
- ee as SignIn,
4411
- te as SignUp,
4412
- Aa as SubscriptionStatus,
4413
- Va as UsageDisplay,
4414
- re as UserButton,
4415
- se as UserProfile,
4416
- ya as isMfaRequired,
4417
- ta as useAuth,
4418
- ie as useBilling,
4419
- ue as useDashboard,
4420
- za as useDeleteAccount,
4421
- pe as useEmbedDashboard,
4422
- La as useInvoices,
4423
- na as useOrg,
5094
+ Ne as SaaSError,
5095
+ te as SaaSProvider,
5096
+ ba as SaaSSupport,
5097
+ xe as SavedQueryList,
5098
+ Pa as SettingsPanel,
5099
+ re as SignIn,
5100
+ ne as SignUp,
5101
+ Ma as SubscriptionStatus,
5102
+ ja as UsageDisplay,
5103
+ oe as UserButton,
5104
+ ie as UserProfile,
5105
+ xa as isMfaRequired,
5106
+ sa as useAuth,
5107
+ de as useBilling,
5108
+ ge as useDashboard,
5109
+ Ca as useDeleteAccount,
5110
+ me as useEmbedDashboard,
5111
+ Aa as useInvoices,
5112
+ Y as useOrg,
4424
5113
  oa as useProfile,
4425
5114
  da as useQuery,
4426
- de as useReport,
4427
- L as useSaaSContext,
4428
- Ha as useSavedQueries,
4429
- sa as useSignIn,
4430
- Ca as useSignUp,
4431
- Ia as useSubscription,
4432
- Fa as useUsage,
4433
- ae as useUser
5115
+ he as useReport,
5116
+ A as useSaaSContext,
5117
+ qa as useSavedQueries,
5118
+ na as useSignIn,
5119
+ ka as useSignUp,
5120
+ La as useSubscription,
5121
+ Da as useUsage,
5122
+ se as useUser
4434
5123
  };