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