@saas-support/react 0.7.5 → 0.7.6

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