@skylabs-digital/react-identity-access 2.6.0 → 2.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.es.js CHANGED
@@ -1,5 +1,5 @@
1
- import { jsx as n, Fragment as W, jsxs as l } from "react/jsx-runtime";
2
- import { createContext as ue, useMemo as X, useState as k, useCallback as se, useEffect as te, useContext as ne, useRef as Ve } from "react";
1
+ import { jsx as n, Fragment as j, jsxs as l } from "react/jsx-runtime";
2
+ import { createContext as ue, useMemo as X, useState as S, useCallback as se, useEffect as te, useContext as ne, useRef as Ge } from "react";
3
3
  import { useLocation as Se, Navigate as pe } from "react-router-dom";
4
4
  class re {
5
5
  // SessionManager instance
@@ -16,7 +16,7 @@ class re {
16
16
  return this.executeRequest(e, t, r, s, !1);
17
17
  }
18
18
  async executeRequest(e, t, r, s, o = !1) {
19
- const a = `${this.baseUrl}${t.startsWith("/") ? t : `/${t}`}`, p = (s == null ? void 0 : s.timeout) || this.timeout;
19
+ const a = `${this.baseUrl}${t.startsWith("/") ? t : `/${t}`}`, g = (s == null ? void 0 : s.timeout) || this.timeout;
20
20
  let w = {
21
21
  "Content-Type": "application/json",
22
22
  ...s == null ? void 0 : s.headers
@@ -28,15 +28,15 @@ class re {
28
28
  } catch (b) {
29
29
  console.warn("Failed to inject auth headers:", b);
30
30
  }
31
- const y = new AbortController(), x = setTimeout(() => y.abort(), p);
31
+ const m = new AbortController(), k = setTimeout(() => m.abort(), g);
32
32
  try {
33
33
  const b = await fetch(a, {
34
34
  method: e,
35
35
  headers: w,
36
36
  body: r ? JSON.stringify(r) : void 0,
37
- signal: y.signal
37
+ signal: m.signal
38
38
  });
39
- if (clearTimeout(x), b.status === 401 && !(s != null && s.skipRetry) && !o && this.sessionManager)
39
+ if (clearTimeout(k), b.status === 401 && !(s != null && s.skipRetry) && !o && this.sessionManager)
40
40
  try {
41
41
  const A = this.sessionManager.getTokens();
42
42
  if (A != null && A.refreshToken)
@@ -49,7 +49,7 @@ class re {
49
49
  const f = b.headers.get("content-type");
50
50
  return !f || !f.includes("application/json") ? {} : await b.json();
51
51
  } catch (b) {
52
- throw clearTimeout(x), b instanceof Error && b.name === "AbortError" ? new Error(`Request timeout after ${p}ms`) : b;
52
+ throw clearTimeout(k), b instanceof Error && b.name === "AbortError" ? new Error(`Request timeout after ${g}ms`) : b;
53
53
  }
54
54
  }
55
55
  async get(e, t) {
@@ -125,7 +125,7 @@ class Pe {
125
125
  }
126
126
  }
127
127
  const ve = ue(null);
128
- function Nt({ config: i, children: e }) {
128
+ function Bt({ config: i, children: e }) {
129
129
  const t = X(
130
130
  () => {
131
131
  var f, A, L;
@@ -137,7 +137,7 @@ function Nt({ config: i, children: e }) {
137
137
  };
138
138
  },
139
139
  [i.cache, i.appId]
140
- ), [r, s] = k(() => {
140
+ ), [r, s] = S(() => {
141
141
  if (!t.enabled) return null;
142
142
  try {
143
143
  const f = localStorage.getItem(t.storageKey);
@@ -147,9 +147,9 @@ function Nt({ config: i, children: e }) {
147
147
  } catch {
148
148
  return null;
149
149
  }
150
- }), [o, a] = k(!r), [p, w] = k(null), y = X(() => {
150
+ }), [o, a] = S(!r), [g, w] = S(null), m = X(() => {
151
151
  const f = () => {
152
- x();
152
+ k();
153
153
  };
154
154
  return {
155
155
  appId: i.appId,
@@ -157,10 +157,10 @@ function Nt({ config: i, children: e }) {
157
157
  // App info
158
158
  appInfo: r,
159
159
  isAppLoading: o,
160
- appError: p,
160
+ appError: g,
161
161
  retryApp: f
162
162
  };
163
- }, [i, r, o, p]), x = se(
163
+ }, [i, r, o, g]), k = se(
164
164
  async (f = !1) => {
165
165
  if (!(!f && t.enabled && r))
166
166
  try {
@@ -168,14 +168,14 @@ function Nt({ config: i, children: e }) {
168
168
  const A = new re(i.baseUrl), D = await new Pe(A, {}).getPublicAppInfo(i.appId);
169
169
  if (s(D), t.enabled)
170
170
  try {
171
- const I = {
171
+ const R = {
172
172
  data: D,
173
173
  timestamp: Date.now(),
174
174
  appId: i.appId
175
175
  };
176
- localStorage.setItem(t.storageKey, JSON.stringify(I));
177
- } catch (I) {
178
- console.warn("Failed to cache app info:", I);
176
+ localStorage.setItem(t.storageKey, JSON.stringify(R));
177
+ } catch (R) {
178
+ console.warn("Failed to cache app info:", R);
179
179
  }
180
180
  } catch (A) {
181
181
  const L = A instanceof Error ? A : new Error("Failed to load app information");
@@ -192,10 +192,10 @@ function Nt({ config: i, children: e }) {
192
192
  if (!f) return;
193
193
  const A = JSON.parse(f);
194
194
  if (Date.now() - A.timestamp > t.ttl * 0.5) {
195
- const D = new re(i.baseUrl), M = await new Pe(D, {}).getPublicAppInfo(i.appId);
196
- s(M);
195
+ const D = new re(i.baseUrl), P = await new Pe(D, {}).getPublicAppInfo(i.appId);
196
+ s(P);
197
197
  const u = {
198
- data: M,
198
+ data: P,
199
199
  timestamp: Date.now(),
200
200
  appId: i.appId
201
201
  };
@@ -206,8 +206,8 @@ function Nt({ config: i, children: e }) {
206
206
  }
207
207
  }, [i, t, r]);
208
208
  return te(() => {
209
- r ? b() : x();
210
- }, []), /* @__PURE__ */ n(ve.Provider, { value: y, children: e });
209
+ r ? b() : k();
210
+ }, []), /* @__PURE__ */ n(ve.Provider, { value: m, children: e });
211
211
  }
212
212
  function he() {
213
213
  const i = ne(ve);
@@ -218,7 +218,7 @@ function he() {
218
218
  function Ee() {
219
219
  return ne(ve);
220
220
  }
221
- const Ut = he;
221
+ const qt = he;
222
222
  class be {
223
223
  constructor(e = {}) {
224
224
  this.refreshPromise = null, this.refreshQueue = [], e.tenantSlug !== void 0 ? this.storageKey = e.tenantSlug ? `auth_tokens_${e.tenantSlug}` : "auth_tokens" : this.storageKey = e.storageKey || "auth_tokens", this.autoRefresh = e.autoRefresh ?? !0, this.refreshThreshold = e.refreshThreshold || 3e5, this.onRefreshFailed = e.onRefreshFailed, this.baseUrl = e.baseUrl || "", this.tokenStorage = e.tokenStorage || this.createTokenStorage(this.storageKey);
@@ -372,7 +372,7 @@ class be {
372
372
  return e !== null && !this.isTokenExpired(e);
373
373
  }
374
374
  }
375
- class _e {
375
+ class Ke {
376
376
  constructor(e) {
377
377
  this.httpService = e;
378
378
  }
@@ -493,7 +493,7 @@ class Me {
493
493
  };
494
494
  }
495
495
  }
496
- class Ge {
496
+ class Je {
497
497
  constructor(e, t) {
498
498
  this.httpService = e, this.sessionManager = t;
499
499
  }
@@ -611,7 +611,7 @@ class de {
611
611
  )).data;
612
612
  }
613
613
  }
614
- function Ke(i, e) {
614
+ function Ye(i, e) {
615
615
  if (i === "localhost" || i.startsWith("127.") || i.startsWith("192.168."))
616
616
  return null;
617
617
  if (e) {
@@ -627,26 +627,26 @@ function Ke(i, e) {
627
627
  const r = i.split(".");
628
628
  return r.length >= 3 && r[0] !== "www" ? r[0] : null;
629
629
  }
630
- function Je(i, e = "tenant", t) {
630
+ function Qe(i, e = "tenant", t) {
631
631
  const s = new URLSearchParams(i).get(e);
632
632
  return s ? (t && t.setItem("tenant", s), s) : t ? t.getItem("tenant") : null;
633
633
  }
634
- function Ye(i, e, t) {
634
+ function Xe(i, e, t) {
635
635
  const { tenantMode: r, baseDomain: s, selectorParam: o } = i;
636
- return r === "subdomain" ? Ke(e.hostname, s) : r === "selector" ? Je(e.search, o, t) : null;
636
+ return r === "subdomain" ? Ye(e.hostname, s) : r === "selector" ? Qe(e.search, o, t) : null;
637
637
  }
638
- function Qe(i, e, t) {
638
+ function Ze(i, e, t) {
639
639
  if (t)
640
640
  return `${i}.${t}`;
641
641
  const r = e.split(".");
642
642
  return r.length === 2 ? `${i}.${e}` : r.length >= 3 ? (r[0] = i, r.join(".")) : null;
643
643
  }
644
644
  const fe = "_auth";
645
- function Xe(i) {
645
+ function et(i) {
646
646
  const e = JSON.stringify(i);
647
647
  return btoa(e).replace(/\+/g, "-").replace(/\//g, "_").replace(/=/g, "");
648
648
  }
649
- function Ze(i) {
649
+ function tt(i) {
650
650
  try {
651
651
  let e = i.replace(/-/g, "+").replace(/_/g, "/");
652
652
  for (; e.length % 4; )
@@ -657,7 +657,7 @@ function Ze(i) {
657
657
  return null;
658
658
  }
659
659
  }
660
- function et() {
660
+ function rt() {
661
661
  if (typeof window > "u")
662
662
  return console.log("[CrossDomainAuth] SSR environment, skipping URL token extraction"), null;
663
663
  const e = new URLSearchParams(window.location.search).get(fe);
@@ -666,7 +666,7 @@ function et() {
666
666
  searchParams: window.location.search,
667
667
  encodedLength: e == null ? void 0 : e.length
668
668
  }), !e) return null;
669
- const t = Ze(e);
669
+ const t = tt(e);
670
670
  return console.log("[CrossDomainAuth] Token decode result:", {
671
671
  success: !!t,
672
672
  hasAccessToken: !!(t != null && t.accessToken),
@@ -674,7 +674,7 @@ function et() {
674
674
  expiresIn: t == null ? void 0 : t.expiresIn
675
675
  }), t;
676
676
  }
677
- function tt() {
677
+ function nt() {
678
678
  if (typeof window > "u") return;
679
679
  const i = new URL(window.location.href);
680
680
  i.searchParams.delete(fe), console.log("[CrossDomainAuth] Clearing auth tokens from URL", {
@@ -683,8 +683,8 @@ function tt() {
683
683
  }), window.history.replaceState({}, "", i.toString());
684
684
  }
685
685
  const ke = ue(null);
686
- function Bt({ config: i, children: e }) {
687
- const { baseUrl: t, appInfo: r, appId: s } = he(), o = se(() => typeof window > "u" ? null : Ye(
686
+ function zt({ config: i, children: e }) {
687
+ const { baseUrl: t, appInfo: r, appId: s } = he(), o = se(() => typeof window > "u" ? null : Xe(
688
688
  {
689
689
  tenantMode: i.tenantMode || "selector",
690
690
  baseDomain: i.baseDomain,
@@ -695,118 +695,118 @@ function Bt({ config: i, children: e }) {
695
695
  search: window.location.search
696
696
  },
697
697
  window.localStorage
698
- ), [i.tenantMode, i.baseDomain, i.selectorParam]), [a, p] = k(() => o()), w = X(
698
+ ), [i.tenantMode, i.baseDomain, i.selectorParam]), [a, g] = S(() => o()), w = X(
699
699
  () => {
700
- var d, F, v;
700
+ var c, I, T;
701
701
  return {
702
- enabled: ((d = i.cache) == null ? void 0 : d.enabled) ?? !0,
703
- ttl: ((F = i.cache) == null ? void 0 : F.ttl) ?? 5 * 60 * 1e3,
702
+ enabled: ((c = i.cache) == null ? void 0 : c.enabled) ?? !0,
703
+ ttl: ((I = i.cache) == null ? void 0 : I.ttl) ?? 5 * 60 * 1e3,
704
704
  // 5 minutes default
705
- storageKey: ((v = i.cache) == null ? void 0 : v.storageKey) ?? `tenant_cache_${a || "default"}`
705
+ storageKey: ((T = i.cache) == null ? void 0 : T.storageKey) ?? `tenant_cache_${a || "default"}`
706
706
  };
707
707
  },
708
708
  [i.cache, a]
709
- ), [y, x] = k(() => {
709
+ ), [m, k] = S(() => {
710
710
  if (i.initialTenant) return i.initialTenant;
711
711
  if (!w.enabled || !a) return null;
712
712
  try {
713
- const d = localStorage.getItem(w.storageKey);
714
- if (!d) return null;
715
- const F = JSON.parse(d);
716
- return Date.now() - F.timestamp < w.ttl && F.tenantSlug === a ? F.data : (localStorage.removeItem(w.storageKey), null);
713
+ const c = localStorage.getItem(w.storageKey);
714
+ if (!c) return null;
715
+ const I = JSON.parse(c);
716
+ return Date.now() - I.timestamp < w.ttl && I.tenantSlug === a ? I.data : (localStorage.removeItem(w.storageKey), null);
717
717
  } catch {
718
718
  return null;
719
719
  }
720
- }), [b, f] = k(!y && !i.initialTenant), [A, L] = k(null), [D, I] = k(null), [M, u] = k(!1), [R, m] = k(null);
720
+ }), [b, f] = S(!m && !i.initialTenant), [A, L] = S(null), [D, R] = S(null), [P, u] = S(!1), [N, z] = S(null);
721
721
  te(() => {
722
- const d = o();
723
- p(d);
722
+ const c = o();
723
+ g(c);
724
724
  }, [o]);
725
- const H = (r == null ? void 0 : r.settingsSchema) || null, $ = se(
726
- async (d, F = !1) => {
727
- if (!(!F && w.enabled && y && y.domain === d))
725
+ const E = (r == null ? void 0 : r.settingsSchema) || null, p = se(
726
+ async (c, I = !1) => {
727
+ if (!(!I && w.enabled && m && m.domain === c))
728
728
  try {
729
729
  f(!0), L(null);
730
- const v = new re(t), g = await new de(v, s).getPublicTenantInfo(d);
731
- if (x(g), w.enabled)
730
+ const T = new re(t), d = await new de(T, s).getPublicTenantInfo(c);
731
+ if (k(d), w.enabled)
732
732
  try {
733
- const c = {
734
- data: g,
733
+ const y = {
734
+ data: d,
735
735
  timestamp: Date.now(),
736
- tenantSlug: d
736
+ tenantSlug: c
737
737
  };
738
- localStorage.setItem(w.storageKey, JSON.stringify(c));
739
- } catch (c) {
740
- console.warn("Failed to cache tenant info:", c);
738
+ localStorage.setItem(w.storageKey, JSON.stringify(y));
739
+ } catch (y) {
740
+ console.warn("Failed to cache tenant info:", y);
741
741
  }
742
- } catch (v) {
743
- const h = v instanceof Error ? v : new Error("Failed to load tenant information");
744
- L(h), x(null);
742
+ } catch (T) {
743
+ const h = T instanceof Error ? T : new Error("Failed to load tenant information");
744
+ L(h), k(null);
745
745
  } finally {
746
746
  f(!1);
747
747
  }
748
748
  },
749
- [t, s, w, y]
750
- ), C = se(async () => {
751
- if (!(!w.enabled || !y || !a))
749
+ [t, s, w, m]
750
+ ), O = se(async () => {
751
+ if (!(!w.enabled || !m || !a))
752
752
  try {
753
- const d = localStorage.getItem(w.storageKey);
754
- if (!d) return;
755
- const F = JSON.parse(d);
756
- if (Date.now() - F.timestamp > w.ttl * 0.5) {
757
- const h = new re(t), c = await new de(h, s).getPublicTenantInfo(a);
758
- x(c);
759
- const j = {
760
- data: c,
753
+ const c = localStorage.getItem(w.storageKey);
754
+ if (!c) return;
755
+ const I = JSON.parse(c);
756
+ if (Date.now() - I.timestamp > w.ttl * 0.5) {
757
+ const h = new re(t), y = await new de(h, s).getPublicTenantInfo(a);
758
+ k(y);
759
+ const G = {
760
+ data: y,
761
761
  timestamp: Date.now(),
762
762
  tenantSlug: a
763
763
  };
764
- localStorage.setItem(w.storageKey, JSON.stringify(j));
764
+ localStorage.setItem(w.storageKey, JSON.stringify(G));
765
765
  }
766
- } catch (d) {
767
- console.warn("Background tenant refresh failed:", d);
766
+ } catch (c) {
767
+ console.warn("Background tenant refresh failed:", c);
768
768
  }
769
- }, [t, s, w, y, a]), T = se(async () => {
770
- if (y != null && y.id)
769
+ }, [t, s, w, m, a]), v = se(async () => {
770
+ if (m != null && m.id)
771
771
  try {
772
- u(!0), m(null);
773
- const d = new re(t), v = await new de(d, y.appId).getTenantSettings(y.id);
774
- I(v);
775
- } catch (d) {
776
- const F = d instanceof Error ? d : new Error("Failed to load tenant settings");
777
- m(F), I(null);
772
+ u(!0), z(null);
773
+ const c = new re(t), T = await new de(c, m.appId).getTenantSettings(m.id);
774
+ R(T);
775
+ } catch (c) {
776
+ const I = c instanceof Error ? c : new Error("Failed to load tenant settings");
777
+ z(I), R(null);
778
778
  } finally {
779
779
  u(!1);
780
780
  }
781
- }, [t, y]), q = se(() => {
782
- T();
783
- }, [T]), S = se(
784
- (d) => {
785
- if (!H)
781
+ }, [t, m]), C = se(() => {
782
+ v();
783
+ }, [v]), x = se(
784
+ (c) => {
785
+ if (!E)
786
786
  return { isValid: !0, errors: [] };
787
- const F = [];
787
+ const I = [];
788
788
  try {
789
- return H.properties && Object.entries(H.properties).forEach(([v, h]) => {
790
- var c;
791
- const g = d[v];
792
- if ((c = H.required) != null && c.includes(v) && g == null) {
793
- F.push(`Field '${v}' is required`);
789
+ return E.properties && Object.entries(E.properties).forEach(([T, h]) => {
790
+ var y;
791
+ const d = c[T];
792
+ if ((y = E.required) != null && y.includes(T) && d == null) {
793
+ I.push(`Field '${T}' is required`);
794
794
  return;
795
795
  }
796
- if (g != null) {
796
+ if (d != null) {
797
797
  if (h.type) {
798
- const j = h.type, K = typeof g;
799
- j === "string" && K !== "string" ? F.push(`Field '${v}' must be a string`) : (j === "number" || j === "integer") && K !== "number" ? F.push(`Field '${v}' must be a number`) : j === "boolean" && K !== "boolean" ? F.push(`Field '${v}' must be a boolean`) : j === "array" && !Array.isArray(g) && F.push(`Field '${v}' must be an array`);
798
+ const G = h.type, $ = typeof d;
799
+ G === "string" && $ !== "string" ? I.push(`Field '${T}' must be a string`) : (G === "number" || G === "integer") && $ !== "number" ? I.push(`Field '${T}' must be a number`) : G === "boolean" && $ !== "boolean" ? I.push(`Field '${T}' must be a boolean`) : G === "array" && !Array.isArray(d) && I.push(`Field '${T}' must be an array`);
800
800
  }
801
- h.minLength !== void 0 && typeof g == "string" && g.length < h.minLength && F.push(
802
- `Field '${v}' must be at least ${h.minLength} characters long`
803
- ), h.maxLength !== void 0 && typeof g == "string" && g.length > h.maxLength && F.push(
804
- `Field '${v}' must be no more than ${h.maxLength} characters long`
805
- ), h.minimum !== void 0 && typeof g == "number" && g < h.minimum && F.push(`Field '${v}' must be at least ${h.minimum}`), h.maximum !== void 0 && typeof g == "number" && g > h.maximum && F.push(`Field '${v}' must be no more than ${h.maximum}`), h.pattern && typeof g == "string" && (new RegExp(h.pattern).test(g) || F.push(`Field '${v}' does not match the required pattern`)), h.enum && !h.enum.includes(g) && F.push(`Field '${v}' must be one of: ${h.enum.join(", ")}`);
801
+ h.minLength !== void 0 && typeof d == "string" && d.length < h.minLength && I.push(
802
+ `Field '${T}' must be at least ${h.minLength} characters long`
803
+ ), h.maxLength !== void 0 && typeof d == "string" && d.length > h.maxLength && I.push(
804
+ `Field '${T}' must be no more than ${h.maxLength} characters long`
805
+ ), h.minimum !== void 0 && typeof d == "number" && d < h.minimum && I.push(`Field '${T}' must be at least ${h.minimum}`), h.maximum !== void 0 && typeof d == "number" && d > h.maximum && I.push(`Field '${T}' must be no more than ${h.maximum}`), h.pattern && typeof d == "string" && (new RegExp(h.pattern).test(d) || I.push(`Field '${T}' does not match the required pattern`)), h.enum && !h.enum.includes(d) && I.push(`Field '${T}' must be one of: ${h.enum.join(", ")}`);
806
806
  }
807
807
  }), {
808
- isValid: F.length === 0,
809
- errors: F
808
+ isValid: I.length === 0,
809
+ errors: I
810
810
  };
811
811
  } catch {
812
812
  return {
@@ -815,78 +815,78 @@ function Bt({ config: i, children: e }) {
815
815
  };
816
816
  }
817
817
  },
818
- [H]
818
+ [E]
819
819
  );
820
820
  te(() => {
821
- !i.initialTenant && a ? y ? C() : $(a) : !i.initialTenant && !a && (x(null), L(null), f(!1));
822
- }, [i.initialTenant, a, y, $, C]), te(() => {
823
- y != null && y.id ? T() : (I(null), m(null), u(!1));
824
- }, [y == null ? void 0 : y.id, T]);
825
- const P = se(
826
- (d, F) => {
827
- const { mode: v = "reload", tokens: h, redirectPath: g } = F || {}, c = i.tenantMode || "selector";
828
- if (localStorage.setItem("tenant", d), c === "subdomain") {
829
- const j = window.location.hostname, K = Qe(
830
- d,
831
- j,
821
+ !i.initialTenant && a ? m ? O() : p(a) : !i.initialTenant && !a && (k(null), L(null), f(!1));
822
+ }, [i.initialTenant, a, m, p, O]), te(() => {
823
+ m != null && m.id ? v() : (R(null), z(null), u(!1));
824
+ }, [m == null ? void 0 : m.id, v]);
825
+ const M = se(
826
+ (c, I) => {
827
+ const { mode: T = "reload", tokens: h, redirectPath: d } = I || {}, y = i.tenantMode || "selector";
828
+ if (localStorage.setItem("tenant", c), y === "subdomain") {
829
+ const G = window.location.hostname, $ = Ze(
830
+ c,
831
+ G,
832
832
  i.baseDomain
833
833
  );
834
- if (!K) {
834
+ if (!$) {
835
835
  console.warn(
836
836
  "[TenantProvider] Cannot switch subdomain, invalid hostname:",
837
- j
837
+ G
838
838
  );
839
839
  return;
840
840
  }
841
- const N = g || window.location.pathname, z = new URL(`${window.location.protocol}//${K}${N}`);
842
- new URLSearchParams(window.location.search).forEach((U, J) => {
843
- J !== fe && z.searchParams.set(J, U);
844
- }), h && z.searchParams.set(fe, Xe(h)), window.location.href = z.toString();
845
- } else if (c === "selector") {
846
- const j = g || window.location.pathname, K = new URLSearchParams(window.location.search);
847
- if (K.set(i.selectorParam || "tenant", d), v === "reload") {
848
- const N = `${j}?${K.toString()}${window.location.hash}`;
849
- window.location.href = N;
841
+ const H = d || window.location.pathname, U = new URL(`${window.location.protocol}//${$}${H}`);
842
+ new URLSearchParams(window.location.search).forEach((B, J) => {
843
+ J !== fe && U.searchParams.set(J, B);
844
+ }), h && U.searchParams.set(fe, et(h)), window.location.href = U.toString();
845
+ } else if (y === "selector") {
846
+ const G = d || window.location.pathname, $ = new URLSearchParams(window.location.search);
847
+ if ($.set(i.selectorParam || "tenant", c), T === "reload") {
848
+ const H = `${G}?${$.toString()}${window.location.hash}`;
849
+ window.location.href = H;
850
850
  } else {
851
- const N = `${j}?${K.toString()}${window.location.hash}`;
852
- window.history.pushState({}, "", N), p(d), $(d);
851
+ const H = `${G}?${$.toString()}${window.location.hash}`;
852
+ window.history.pushState({}, "", H), g(c), p(c);
853
853
  }
854
854
  }
855
855
  },
856
- [i.tenantMode, i.selectorParam, i.baseDomain, $]
857
- ), E = X(() => ({
856
+ [i.tenantMode, i.selectorParam, i.baseDomain, p]
857
+ ), F = X(() => ({
858
858
  // Tenant info
859
- tenant: y,
859
+ tenant: m,
860
860
  tenantSlug: a,
861
861
  isTenantLoading: b,
862
862
  tenantError: A,
863
863
  retryTenant: () => {
864
- a && $(a);
864
+ a && p(a);
865
865
  },
866
866
  // Settings
867
867
  settings: D,
868
- settingsSchema: H,
869
- isSettingsLoading: M,
870
- settingsError: R,
868
+ settingsSchema: E,
869
+ isSettingsLoading: P,
870
+ settingsError: N,
871
871
  // Actions
872
- refreshSettings: q,
873
- switchTenant: P,
872
+ refreshSettings: C,
873
+ switchTenant: M,
874
874
  // Validation
875
- validateSettings: S
875
+ validateSettings: x
876
876
  }), [
877
- y,
877
+ m,
878
878
  a,
879
879
  b,
880
880
  A,
881
881
  D,
882
- H,
883
- M,
884
- R,
885
- q,
882
+ E,
886
883
  P,
887
- S
884
+ N,
885
+ C,
886
+ M,
887
+ x
888
888
  ]);
889
- return /* @__PURE__ */ n(ke.Provider, { value: E, children: e });
889
+ return /* @__PURE__ */ n(ke.Provider, { value: F, children: e });
890
890
  }
891
891
  function me() {
892
892
  const i = ne(ke);
@@ -897,8 +897,8 @@ function me() {
897
897
  function ye() {
898
898
  return ne(ke);
899
899
  }
900
- const qt = me;
901
- function zt() {
900
+ const Ot = me;
901
+ function Wt() {
902
902
  const { settings: i, settingsSchema: e, isSettingsLoading: t, settingsError: r, validateSettings: s } = me();
903
903
  return {
904
904
  settings: i,
@@ -919,53 +919,53 @@ function le() {
919
919
  };
920
920
  }
921
921
  const xe = ue(null);
922
- function Ot({ config: i = {}, children: e }) {
923
- const { appId: t, baseUrl: r } = he(), { tenant: s, tenantSlug: o, switchTenant: a } = me(), [p, w] = k(i.initialRoles || []), [y, x] = k(!i.initialRoles), [b, f] = k(null), [A, L] = k(!1), [D, I] = k(null), [M, u] = k(0), R = Ve({ done: !1, urlTokens: null });
924
- R.current.done || (R.current.done = !0, R.current.urlTokens = et(), R.current.urlTokens && console.log("[AuthProvider] SYNC: URL tokens found"));
925
- const m = X(() => {
926
- const c = new be({
922
+ function jt({ config: i = {}, children: e }) {
923
+ const { appId: t, baseUrl: r } = he(), { tenant: s, tenantSlug: o, switchTenant: a } = me(), [g, w] = S(i.initialRoles || []), [m, k] = S(!i.initialRoles), [b, f] = S(null), [A, L] = S(!1), [D, R] = S(null), [P, u] = S(0), [N, z] = S(!1), E = Ge({ done: !1, urlTokens: null });
924
+ E.current.done || (E.current.done = !0, E.current.urlTokens = rt(), E.current.urlTokens && console.log("[AuthProvider] SYNC: URL tokens found"));
925
+ const p = X(() => {
926
+ const $ = new be({
927
927
  tenantSlug: o,
928
928
  onRefreshFailed: i.onRefreshFailed,
929
929
  baseUrl: r
930
930
  });
931
- return R.current.urlTokens && (console.log("[AuthProvider] SYNC: Saving URL tokens to session manager"), c.setTokens({
932
- accessToken: R.current.urlTokens.accessToken,
933
- refreshToken: R.current.urlTokens.refreshToken,
934
- expiresIn: R.current.urlTokens.expiresIn
935
- }), console.log("[AuthProvider] SYNC: Session valid:", c.hasValidSession())), c;
936
- }, [o, r, i.onRefreshFailed]), H = R.current.done, $ = X(() => {
937
- const c = new re(r);
938
- return c.setSessionManager(m), c;
939
- }, [r, m]), C = X(() => new _e(new re(r)), [r]), T = X(() => new Ge($, m), [$, m]), q = X(() => new Me(new re(r)), [r]), S = X(() => b || m.getUser(), [b, m]), P = X(() => S != null && S.roleId && p.find((c) => c.id === S.roleId) || null, [S, p]), E = X(() => (P == null ? void 0 : P.permissions) || [], [P]), d = X(() => m.hasValidSession() && b !== null, [m, b]), F = 5 * 60 * 1e3, v = X(() => {
940
- const c = async (B = !1) => {
931
+ return E.current.urlTokens && (console.log("[AuthProvider] SYNC: Saving URL tokens to session manager"), $.setTokens({
932
+ accessToken: E.current.urlTokens.accessToken,
933
+ refreshToken: E.current.urlTokens.refreshToken,
934
+ expiresIn: E.current.urlTokens.expiresIn
935
+ }), console.log("[AuthProvider] SYNC: Session valid:", $.hasValidSession())), $;
936
+ }, [o, r, i.onRefreshFailed]), O = E.current.done && !N, v = X(() => {
937
+ const $ = new re(r);
938
+ return $.setSessionManager(p), $;
939
+ }, [r, p]), C = X(() => new Ke(new re(r)), [r]), x = X(() => new Je(v, p), [v, p]), M = X(() => new Me(new re(r)), [r]), F = X(() => b || p.getUser(), [b, p]), c = X(() => F != null && F.roleId && g.find(($) => $.id === F.roleId) || null, [F, g]), I = X(() => (c == null ? void 0 : c.permissions) || [], [c]), T = X(() => p.hasValidSession() && b !== null, [p, b]), h = 5 * 60 * 1e3, d = X(() => {
940
+ const $ = async (q = !1) => {
941
941
  try {
942
- if (!m.hasValidSession())
942
+ if (!p.hasValidSession())
943
943
  return;
944
- const O = Date.now();
945
- if (!B && O - M < F && b)
944
+ const W = Date.now();
945
+ if (!q && W - P < h && b)
946
946
  return;
947
- const _ = m.getUserId();
947
+ const _ = p.getUserId();
948
948
  if (!_) {
949
949
  console.warn("[AuthProvider] No userId available in token or storage");
950
950
  return;
951
951
  }
952
- L(!0), I(null);
953
- const Z = await T.getUserById(_);
954
- f(Z), m.setUser(Z), u(Date.now());
955
- } catch (O) {
956
- const Y = O instanceof Error ? O : new Error("Failed to load user data");
957
- I(Y), console.error("[AuthProvider] Failed to load user data:", Y);
952
+ L(!0), R(null);
953
+ const Z = await x.getUserById(_);
954
+ f(Z), p.setUser(Z), u(Date.now());
955
+ } catch (W) {
956
+ const Y = W instanceof Error ? W : new Error("Failed to load user data");
957
+ R(Y), console.error("[AuthProvider] Failed to load user data:", Y);
958
958
  } finally {
959
959
  L(!1);
960
960
  }
961
- }, j = async () => {
962
- await c();
963
- }, K = async (B) => {
964
- const { username: O, password: Y, tenantSlug: _ } = B;
965
- let Z = s == null ? void 0 : s.id, Q = o, ee = m;
966
- _ && (Z = (await new de($, t).getPublicTenantInfo(_)).id, Q = _);
967
- const G = await C.login({
968
- username: O,
961
+ }, H = async () => {
962
+ await $();
963
+ }, U = async (q) => {
964
+ const { username: W, password: Y, tenantSlug: _ } = q;
965
+ let Z = s == null ? void 0 : s.id, Q = o, ee = p;
966
+ _ && (Z = (await new de(v, t).getPublicTenantInfo(_)).id, Q = _);
967
+ const K = await C.login({
968
+ username: W,
969
969
  password: Y,
970
970
  appId: t,
971
971
  tenantId: Z
@@ -974,48 +974,48 @@ function Ot({ config: i = {}, children: e }) {
974
974
  tenantSlug: Q,
975
975
  baseUrl: r
976
976
  })), ee.setTokens({
977
- accessToken: G.accessToken,
978
- refreshToken: G.refreshToken,
979
- expiresIn: G.expiresIn
980
- }), G.user) {
981
- ee.setUser(G.user), f(G.user);
977
+ accessToken: K.accessToken,
978
+ refreshToken: K.refreshToken,
979
+ expiresIn: K.expiresIn
980
+ }), K.user) {
981
+ ee.setUser(K.user), f(K.user);
982
982
  try {
983
- await c();
983
+ await $();
984
984
  } catch (ce) {
985
985
  console.warn("Failed to load complete user data after login:", ce);
986
986
  }
987
987
  }
988
988
  return ae && Q && Q !== o && a(Q, {
989
989
  tokens: {
990
- accessToken: G.accessToken,
991
- refreshToken: G.refreshToken,
992
- expiresIn: G.expiresIn
990
+ accessToken: K.accessToken,
991
+ refreshToken: K.refreshToken,
992
+ expiresIn: K.expiresIn
993
993
  }
994
- }), G;
995
- }, N = async (B) => {
996
- const { email: O, phoneNumber: Y, name: _, password: Z, lastName: Q, tenantId: ee } = B;
997
- if (!O && !Y)
994
+ }), K;
995
+ }, V = async (q) => {
996
+ const { email: W, phoneNumber: Y, name: _, password: Z, lastName: Q, tenantId: ee } = q;
997
+ if (!W && !Y)
998
998
  throw new Error("Either email or phoneNumber is required");
999
999
  if (!_ || !Z)
1000
1000
  throw new Error("Name and password are required");
1001
- const G = ee ?? (s == null ? void 0 : s.id);
1001
+ const K = ee ?? (s == null ? void 0 : s.id);
1002
1002
  return await C.signup({
1003
- email: O,
1003
+ email: W,
1004
1004
  phoneNumber: Y,
1005
1005
  name: _,
1006
1006
  password: Z,
1007
- tenantId: G,
1007
+ tenantId: K,
1008
1008
  lastName: Q,
1009
1009
  appId: t
1010
1010
  });
1011
- }, z = async (B) => {
1012
- const { email: O, phoneNumber: Y, name: _, password: Z, tenantName: Q, lastName: ee } = B;
1013
- if (!O && !Y)
1011
+ }, B = async (q) => {
1012
+ const { email: W, phoneNumber: Y, name: _, password: Z, tenantName: Q, lastName: ee } = q;
1013
+ if (!W && !Y)
1014
1014
  throw new Error("Either email or phoneNumber is required");
1015
1015
  if (!_ || !Z || !Q)
1016
1016
  throw new Error("Name, password, and tenantName are required");
1017
1017
  return await C.signupTenantAdmin({
1018
- email: O,
1018
+ email: W,
1019
1019
  phoneNumber: Y,
1020
1020
  name: _,
1021
1021
  password: Z,
@@ -1023,35 +1023,35 @@ function Ot({ config: i = {}, children: e }) {
1023
1023
  appId: t,
1024
1024
  lastName: ee
1025
1025
  });
1026
- }, V = async (B) => {
1027
- const { currentPassword: O, newPassword: Y } = B, _ = await m.getAuthHeaders();
1028
- await C.changePassword({ currentPassword: O, newPassword: Y }, _);
1029
- }, U = async (B) => {
1030
- const { email: O, tenantId: Y } = B, _ = Y ?? (s == null ? void 0 : s.id);
1026
+ }, J = async (q) => {
1027
+ const { currentPassword: W, newPassword: Y } = q, _ = await p.getAuthHeaders();
1028
+ await C.changePassword({ currentPassword: W, newPassword: Y }, _);
1029
+ }, ge = async (q) => {
1030
+ const { email: W, tenantId: Y } = q, _ = Y ?? (s == null ? void 0 : s.id);
1031
1031
  if (!_)
1032
1032
  throw new Error("tenantId is required for password reset");
1033
- await C.requestPasswordReset({ email: O, tenantId: _ });
1034
- }, J = async (B) => {
1035
- const { token: O, newPassword: Y } = B;
1036
- await C.confirmPasswordReset({ token: O, newPassword: Y });
1037
- }, ge = async (B) => {
1038
- const { email: O, frontendUrl: Y, name: _, lastName: Z, tenantId: Q } = B, ee = Q ?? (s == null ? void 0 : s.id);
1033
+ await C.requestPasswordReset({ email: W, tenantId: _ });
1034
+ }, He = async (q) => {
1035
+ const { token: W, newPassword: Y } = q;
1036
+ await C.confirmPasswordReset({ token: W, newPassword: Y });
1037
+ }, Ne = async (q) => {
1038
+ const { email: W, frontendUrl: Y, name: _, lastName: Z, tenantId: Q } = q, ee = Q ?? (s == null ? void 0 : s.id);
1039
1039
  if (!ee)
1040
1040
  throw new Error("tenantId is required for magic link authentication");
1041
1041
  return await C.sendMagicLink({
1042
- email: O,
1042
+ email: W,
1043
1043
  tenantId: ee,
1044
1044
  frontendUrl: Y,
1045
1045
  name: _,
1046
1046
  lastName: Z,
1047
1047
  appId: t
1048
1048
  });
1049
- }, He = async (B) => {
1050
- const { token: O, email: Y, tenantSlug: _ } = B;
1051
- let Z = s == null ? void 0 : s.id, Q = o, ee = m;
1052
- _ && (Z = (await new de($, t).getPublicTenantInfo(_)).id, Q = _);
1053
- const G = await C.verifyMagicLink({
1054
- token: O,
1049
+ }, Ue = async (q) => {
1050
+ const { token: W, email: Y, tenantSlug: _ } = q;
1051
+ let Z = s == null ? void 0 : s.id, Q = o, ee = p;
1052
+ _ && (Z = (await new de(v, t).getPublicTenantInfo(_)).id, Q = _);
1053
+ const K = await C.verifyMagicLink({
1054
+ token: W,
1055
1055
  email: Y,
1056
1056
  appId: t,
1057
1057
  tenantId: Z
@@ -1060,152 +1060,154 @@ function Ot({ config: i = {}, children: e }) {
1060
1060
  tenantSlug: Q,
1061
1061
  baseUrl: r
1062
1062
  })), ee.setTokens({
1063
- accessToken: G.accessToken,
1064
- refreshToken: G.refreshToken,
1065
- expiresIn: G.expiresIn
1066
- }), G.user) {
1067
- ee.setUser(G.user), f(G.user);
1063
+ accessToken: K.accessToken,
1064
+ refreshToken: K.refreshToken,
1065
+ expiresIn: K.expiresIn
1066
+ }), K.user) {
1067
+ ee.setUser(K.user), f(K.user);
1068
1068
  try {
1069
- await c();
1069
+ await $();
1070
1070
  } catch (ce) {
1071
1071
  console.warn("Failed to load complete user data after magic link login:", ce);
1072
1072
  }
1073
1073
  }
1074
1074
  return ae && Q && Q !== o && a(Q, {
1075
1075
  tokens: {
1076
- accessToken: G.accessToken,
1077
- refreshToken: G.refreshToken,
1078
- expiresIn: G.expiresIn
1076
+ accessToken: K.accessToken,
1077
+ refreshToken: K.refreshToken,
1078
+ expiresIn: K.expiresIn
1079
1079
  }
1080
- }), G;
1081
- }, Ne = async () => {
1082
- const B = m.getTokens();
1083
- if (!(B != null && B.refreshToken))
1080
+ }), K;
1081
+ }, Be = async () => {
1082
+ const q = p.getTokens();
1083
+ if (!(q != null && q.refreshToken))
1084
1084
  throw new Error("No refresh token available");
1085
- const O = await C.refreshToken({
1086
- refreshToken: B.refreshToken
1085
+ const W = await C.refreshToken({
1086
+ refreshToken: q.refreshToken
1087
1087
  });
1088
- m.setTokens({
1089
- accessToken: O.accessToken,
1090
- refreshToken: O.refreshToken || B.refreshToken,
1091
- expiresIn: O.expiresIn
1088
+ p.setTokens({
1089
+ accessToken: W.accessToken,
1090
+ refreshToken: W.refreshToken || q.refreshToken,
1091
+ expiresIn: W.expiresIn
1092
1092
  });
1093
- }, Ue = () => {
1094
- m.clearSession(), f(null), I(null);
1095
- }, Be = (B) => {
1096
- m.setTokens(B);
1097
- }, qe = () => m.hasValidSession(), ze = () => {
1098
- m.clearSession(), f(null), I(null);
1099
- }, Oe = async () => {
1093
+ }, qe = () => {
1094
+ p.clearSession(), f(null), R(null);
1095
+ }, ze = (q) => {
1096
+ p.setTokens(q);
1097
+ }, Oe = () => p.hasValidSession(), We = () => {
1098
+ p.clearSession(), f(null), R(null);
1099
+ }, je = async () => {
1100
1100
  if (t)
1101
1101
  try {
1102
- x(!0);
1103
- const { roles: B } = await q.getRolesByApp(t);
1104
- w(B);
1105
- } catch (B) {
1106
- console.error("Failed to fetch roles:", B);
1102
+ k(!0);
1103
+ const { roles: q } = await M.getRolesByApp(t);
1104
+ w(q);
1105
+ } catch (q) {
1106
+ console.error("Failed to fetch roles:", q);
1107
1107
  } finally {
1108
- x(!1);
1108
+ k(!1);
1109
1109
  }
1110
- }, We = async () => {
1111
- await Oe();
1112
- }, we = (B) => {
1113
- if (!E || E.length === 0)
1110
+ }, Ve = async () => {
1111
+ await je();
1112
+ }, we = (q) => {
1113
+ if (!I || I.length === 0)
1114
1114
  return !1;
1115
- if (typeof B == "string")
1116
- return E.includes(B);
1117
- const O = `${B.resource}.${B.action}`;
1118
- return E.includes(O);
1115
+ if (typeof q == "string")
1116
+ return I.includes(q);
1117
+ const W = `${q.resource}.${q.action}`;
1118
+ return I.includes(W);
1119
1119
  };
1120
1120
  return {
1121
1121
  // RFC-003: Authentication state
1122
- isAuthenticated: d,
1123
- sessionManager: m,
1124
- authenticatedHttpService: $,
1125
- login: K,
1126
- signup: N,
1127
- signupTenantAdmin: z,
1128
- sendMagicLink: ge,
1129
- verifyMagicLink: He,
1130
- changePassword: V,
1131
- requestPasswordReset: U,
1132
- confirmPasswordReset: J,
1133
- refreshToken: Ne,
1134
- logout: Ue,
1135
- setTokens: Be,
1136
- hasValidSession: qe,
1137
- clearSession: ze,
1122
+ isAuthenticated: T,
1123
+ sessionManager: p,
1124
+ authenticatedHttpService: v,
1125
+ login: U,
1126
+ signup: V,
1127
+ signupTenantAdmin: B,
1128
+ sendMagicLink: Ne,
1129
+ verifyMagicLink: Ue,
1130
+ changePassword: J,
1131
+ requestPasswordReset: ge,
1132
+ confirmPasswordReset: He,
1133
+ refreshToken: Be,
1134
+ logout: qe,
1135
+ setTokens: ze,
1136
+ hasValidSession: Oe,
1137
+ clearSession: We,
1138
1138
  currentUser: b,
1139
1139
  isUserLoading: A,
1140
1140
  userError: D,
1141
- loadUserData: c,
1142
- refreshUser: j,
1143
- isAuthInitializing: !H,
1144
- isAuthReady: H,
1145
- userRole: P,
1146
- userPermissions: E,
1147
- availableRoles: p,
1148
- rolesLoading: y,
1141
+ loadUserData: $,
1142
+ refreshUser: H,
1143
+ isAuthInitializing: !O,
1144
+ isAuthReady: O,
1145
+ userRole: c,
1146
+ userPermissions: I,
1147
+ availableRoles: g,
1148
+ rolesLoading: m,
1149
1149
  hasPermission: we,
1150
- hasAnyPermission: (B) => B.some((O) => we(O)),
1151
- hasAllPermissions: (B) => B.every((O) => we(O)),
1152
- getUserPermissionStrings: () => E || [],
1153
- refreshRoles: We
1150
+ hasAnyPermission: (q) => q.some((W) => we(W)),
1151
+ hasAllPermissions: (q) => q.every((W) => we(W)),
1152
+ getUserPermissionStrings: () => I || [],
1153
+ refreshRoles: Ve
1154
1154
  };
1155
1155
  }, [
1156
- d,
1157
- m,
1158
- $,
1159
- C,
1160
1156
  T,
1161
- q,
1157
+ p,
1158
+ v,
1159
+ C,
1160
+ x,
1161
+ M,
1162
1162
  t,
1163
1163
  s,
1164
1164
  o,
1165
1165
  a,
1166
- p,
1166
+ g,
1167
1167
  b,
1168
1168
  A,
1169
1169
  D,
1170
- H,
1170
+ O,
1171
+ c,
1172
+ I,
1171
1173
  P,
1172
- E,
1173
- M,
1174
- F
1174
+ h
1175
1175
  ]);
1176
1176
  te(() => {
1177
1177
  !i.initialRoles && t && (async () => {
1178
1178
  try {
1179
- x(!0);
1180
- const j = new re(r), K = new Me(j), { roles: N } = await K.getRolesByApp(t);
1181
- w(N);
1182
- } catch (j) {
1183
- console.error("Failed to fetch roles:", j);
1179
+ k(!0);
1180
+ const H = new re(r), U = new Me(H), { roles: V } = await U.getRolesByApp(t);
1181
+ w(V);
1182
+ } catch (H) {
1183
+ console.error("Failed to fetch roles:", H);
1184
1184
  } finally {
1185
- x(!1);
1185
+ k(!1);
1186
1186
  }
1187
1187
  })();
1188
1188
  }, [t, r, i.initialRoles]);
1189
- const [h, g] = k(!1);
1189
+ const [y, G] = S(!1);
1190
1190
  return te(() => {
1191
- h || (g(!0), R.current.urlTokens && (console.log("[AuthProvider] EFFECT: Cleaning up URL after sync token processing"), tt(), console.log("[AuthProvider] EFFECT: Loading user data..."), v.loadUserData().catch((c) => {
1192
- console.error("[AuthProvider] Failed to load user data:", c);
1191
+ y || (G(!0), E.current.urlTokens && (console.log("[AuthProvider] EFFECT: Cleaning up URL after sync token processing"), nt(), z(!0), console.log("[AuthProvider] EFFECT: Loading user data (blocking isAuthReady)..."), d.loadUserData().catch(($) => {
1192
+ console.error("[AuthProvider] Failed to load user data:", $);
1193
+ }).finally(() => {
1194
+ console.log("[AuthProvider] EFFECT: User data loaded, releasing isAuthReady"), z(!1);
1193
1195
  })));
1194
- }, [v, h]), te(() => {
1195
- const c = m.getUser();
1196
- c && m.hasValidSession() && f(c);
1197
- }, [m]), te(() => {
1198
- h && (R.current.urlTokens || !b && !A && m.hasValidSession() && (console.log("[AuthProvider] Auto-loading user data..."), v.loadUserData().catch(() => {
1196
+ }, [d, y]), te(() => {
1197
+ const $ = p.getUser();
1198
+ $ && p.hasValidSession() && f($);
1199
+ }, [p]), te(() => {
1200
+ y && (E.current.urlTokens || !b && !A && p.hasValidSession() && (console.log("[AuthProvider] Auto-loading user data..."), d.loadUserData().catch(() => {
1199
1201
  })));
1200
- }, [b, A, v, m, h]), te(() => {
1201
- if (!m.hasValidSession() || !b)
1202
+ }, [b, A, d, p, y]), te(() => {
1203
+ if (!p.hasValidSession() || !b)
1202
1204
  return;
1203
- const c = setInterval(() => {
1204
- v.loadUserData().catch(() => {
1205
+ const $ = setInterval(() => {
1206
+ d.loadUserData().catch(() => {
1205
1207
  });
1206
- }, F);
1207
- return () => clearInterval(c);
1208
- }, [m, b, v, F]), /* @__PURE__ */ n(xe.Provider, { value: v, children: e });
1208
+ }, h);
1209
+ return () => clearInterval($);
1210
+ }, [p, b, d, h]), /* @__PURE__ */ n(xe.Provider, { value: d, children: e });
1209
1211
  }
1210
1212
  function oe() {
1211
1213
  const i = ne(xe);
@@ -1216,7 +1218,7 @@ function oe() {
1216
1218
  function Fe() {
1217
1219
  return ne(xe);
1218
1220
  }
1219
- class rt {
1221
+ class st {
1220
1222
  constructor(e, t) {
1221
1223
  this.httpService = e, this.sessionManager = t;
1222
1224
  }
@@ -1297,56 +1299,56 @@ class rt {
1297
1299
  }
1298
1300
  }
1299
1301
  const Ae = ue(null);
1300
- function Wt({ config: i = {}, children: e }) {
1301
- const t = Ee(), r = ye(), s = (t == null ? void 0 : t.baseUrl) ?? "", o = (t == null ? void 0 : t.appId) ?? "", a = (r == null ? void 0 : r.tenant) ?? null, [p, w] = k([]), [y, x] = k(!1), [b, f] = k(null), [A, L] = k(!1), D = X(() => {
1302
+ function Vt({ config: i = {}, children: e }) {
1303
+ const t = Ee(), r = ye(), s = (t == null ? void 0 : t.baseUrl) ?? "", o = (t == null ? void 0 : t.appId) ?? "", a = (r == null ? void 0 : r.tenant) ?? null, [g, w] = S([]), [m, k] = S(!1), [b, f] = S(null), [A, L] = S(!1), D = X(() => {
1302
1304
  const u = new re(s);
1303
- return new rt(u);
1304
- }, [s]), I = async () => {
1305
+ return new st(u);
1306
+ }, [s]), R = async () => {
1305
1307
  if (!(a != null && a.id)) {
1306
1308
  w([]);
1307
1309
  return;
1308
1310
  }
1309
- x(!0), f(null);
1311
+ k(!0), f(null);
1310
1312
  try {
1311
1313
  const u = await D.getTenantFeatureFlags(a.id, o);
1312
1314
  w(u);
1313
1315
  } catch (u) {
1314
- const R = u instanceof Error ? u.message : "Failed to fetch feature flags";
1315
- f(R), i.onError && i.onError(u instanceof Error ? u : new Error(R));
1316
+ const N = u instanceof Error ? u.message : "Failed to fetch feature flags";
1317
+ f(N), i.onError && i.onError(u instanceof Error ? u : new Error(N));
1316
1318
  } finally {
1317
- x(!1);
1319
+ k(!1);
1318
1320
  }
1319
1321
  };
1320
1322
  te(() => {
1321
1323
  if (!s || !o) return;
1322
- I().finally(() => L(!0));
1323
- const u = i.refreshInterval || 5 * 60 * 1e3, R = setInterval(I, u);
1324
- return () => clearInterval(R);
1324
+ R().finally(() => L(!0));
1325
+ const u = i.refreshInterval || 5 * 60 * 1e3, N = setInterval(R, u);
1326
+ return () => clearInterval(N);
1325
1327
  }, [a == null ? void 0 : a.id, s, o, i.refreshInterval]);
1326
- const M = X(() => {
1327
- const u = (C) => {
1328
- const T = p.find((q) => q.key === C);
1329
- return (T == null ? void 0 : T.value) === !0;
1330
- }, R = (C) => p.find((T) => T.key === C), m = (C) => {
1331
- const T = p.find((q) => q.key === C);
1332
- return T ? T.value ? "enabled" : "disabled" : "not_found";
1333
- }, H = async () => {
1334
- await I();
1335
- }, $ = !!(s && o) && (A || !(a != null && a.id));
1328
+ const P = X(() => {
1329
+ const u = (O) => {
1330
+ const v = g.find((C) => C.key === O);
1331
+ return (v == null ? void 0 : v.value) === !0;
1332
+ }, N = (O) => g.find((v) => v.key === O), z = (O) => {
1333
+ const v = g.find((C) => C.key === O);
1334
+ return v ? v.value ? "enabled" : "disabled" : "not_found";
1335
+ }, E = async () => {
1336
+ await R();
1337
+ }, p = !!(s && o) && (A || !(a != null && a.id));
1336
1338
  return {
1337
- featureFlags: p,
1338
- loading: y,
1339
+ featureFlags: g,
1340
+ loading: m,
1339
1341
  error: b,
1340
- isReady: $,
1342
+ isReady: p,
1341
1343
  isEnabled: u,
1342
- getFlag: R,
1343
- getFlagState: m,
1344
- refresh: H
1344
+ getFlag: N,
1345
+ getFlagState: z,
1346
+ refresh: E
1345
1347
  };
1346
- }, [p, y, b, s, o, a == null ? void 0 : a.id, A]);
1347
- return /* @__PURE__ */ n(Ae.Provider, { value: M, children: e });
1348
+ }, [g, m, b, s, o, a == null ? void 0 : a.id, A]);
1349
+ return /* @__PURE__ */ n(Ae.Provider, { value: P, children: e });
1348
1350
  }
1349
- function nt() {
1351
+ function it() {
1350
1352
  const i = ne(Ae);
1351
1353
  if (!i)
1352
1354
  throw new Error("useFeatureFlags must be used within a FeatureFlagProvider");
@@ -1355,7 +1357,7 @@ function nt() {
1355
1357
  function Ce() {
1356
1358
  return ne(Ae);
1357
1359
  }
1358
- class st {
1360
+ class ot {
1359
1361
  constructor(e, t) {
1360
1362
  this.httpService = e, this.sessionManager = t;
1361
1363
  }
@@ -1422,57 +1424,57 @@ class st {
1422
1424
  }
1423
1425
  }
1424
1426
  const Te = ue(void 0);
1425
- function jt({ config: i = {}, children: e }) {
1426
- const t = Ee(), r = ye(), s = (t == null ? void 0 : t.baseUrl) ?? "", o = (r == null ? void 0 : r.tenant) ?? null, [a, p] = k(null), [w, y] = k(!1), [x, b] = k(null), [f, A] = k(!1), L = X(() => {
1427
- const M = new re(s);
1428
- return new st(M);
1427
+ function _t({ config: i = {}, children: e }) {
1428
+ const t = Ee(), r = ye(), s = (t == null ? void 0 : t.baseUrl) ?? "", o = (r == null ? void 0 : r.tenant) ?? null, [a, g] = S(null), [w, m] = S(!1), [k, b] = S(null), [f, A] = S(!1), L = X(() => {
1429
+ const P = new re(s);
1430
+ return new ot(P);
1429
1431
  }, [s]), D = async () => {
1430
1432
  if (!(o != null && o.id)) {
1431
- p(null);
1433
+ g(null);
1432
1434
  return;
1433
1435
  }
1434
- y(!0), b(null);
1436
+ m(!0), b(null);
1435
1437
  try {
1436
- const M = await L.getTenantSubscriptionFeatures(o.id);
1437
- p(M);
1438
- } catch (M) {
1439
- const u = M instanceof Error ? M.message : "Failed to fetch subscription";
1440
- b(u), i.onError && i.onError(M instanceof Error ? M : new Error(u));
1438
+ const P = await L.getTenantSubscriptionFeatures(o.id);
1439
+ g(P);
1440
+ } catch (P) {
1441
+ const u = P instanceof Error ? P.message : "Failed to fetch subscription";
1442
+ b(u), i.onError && i.onError(P instanceof Error ? P : new Error(u));
1441
1443
  } finally {
1442
- y(!1);
1444
+ m(!1);
1443
1445
  }
1444
1446
  };
1445
1447
  te(() => {
1446
1448
  if (!s || (D().finally(() => A(!0)), !i.refreshInterval)) return;
1447
- const M = i.refreshInterval || 10 * 60 * 1e3, u = setInterval(D, M);
1449
+ const P = i.refreshInterval || 10 * 60 * 1e3, u = setInterval(D, P);
1448
1450
  return () => clearInterval(u);
1449
1451
  }, [o == null ? void 0 : o.id, s, i.refreshInterval]);
1450
- const I = X(() => {
1451
- const M = (a == null ? void 0 : a.features) || [], u = (T) => {
1452
- const q = M.find((S) => S.key === T);
1453
- return q ? q.type === "BOOLEAN" || q.type === "boolean" ? q.value === !0 : !!q.value : !1;
1454
- }, R = (T) => M.find((q) => q.key === T), m = (T, q) => {
1455
- const S = M.find((P) => P.key === T);
1456
- return S ? S.value : q;
1457
- }, H = (T) => !a || !a.isActive ? !1 : T.includes(a.planId), $ = async () => {
1452
+ const R = X(() => {
1453
+ const P = (a == null ? void 0 : a.features) || [], u = (v) => {
1454
+ const C = P.find((x) => x.key === v);
1455
+ return C ? C.type === "BOOLEAN" || C.type === "boolean" ? C.value === !0 : !!C.value : !1;
1456
+ }, N = (v) => P.find((C) => C.key === v), z = (v, C) => {
1457
+ const x = P.find((M) => M.key === v);
1458
+ return x ? x.value : C;
1459
+ }, E = (v) => !a || !a.isActive ? !1 : v.includes(a.planId), p = async () => {
1458
1460
  await D();
1459
- }, C = !!s && (f || !(o != null && o.id));
1461
+ }, O = !!s && (f || !(o != null && o.id));
1460
1462
  return {
1461
1463
  subscription: a,
1462
- features: M,
1464
+ features: P,
1463
1465
  loading: w,
1464
- error: x,
1465
- isReady: C,
1466
+ error: k,
1467
+ isReady: O,
1466
1468
  isFeatureEnabled: u,
1467
- getFeature: R,
1468
- getFeatureValue: m,
1469
- hasAllowedPlan: H,
1470
- refresh: $
1469
+ getFeature: N,
1470
+ getFeatureValue: z,
1471
+ hasAllowedPlan: E,
1472
+ refresh: p
1471
1473
  };
1472
- }, [a, w, x, s, o == null ? void 0 : o.id, f]);
1473
- return /* @__PURE__ */ n(Te.Provider, { value: I, children: e });
1474
+ }, [a, w, k, s, o == null ? void 0 : o.id, f]);
1475
+ return /* @__PURE__ */ n(Te.Provider, { value: R, children: e });
1474
1476
  }
1475
- function it() {
1477
+ function at() {
1476
1478
  const i = ne(Te);
1477
1479
  if (i === void 0)
1478
1480
  throw new Error("useSubscription must be used within a SubscriptionProvider");
@@ -1541,7 +1543,7 @@ const Ie = () => /* @__PURE__ */ l(
1541
1543
  children: [
1542
1544
  /* @__PURE__ */ n("div", { style: { fontSize: "2rem", marginBottom: "10px" }, children: "⚠️" }),
1543
1545
  /* @__PURE__ */ n("h3", { style: { color: "#856404", marginBottom: "10px" }, children: "Insufficient Permissions" }),
1544
- e && i ? /* @__PURE__ */ l(W, { children: [
1546
+ e && i ? /* @__PURE__ */ l(j, { children: [
1545
1547
  /* @__PURE__ */ l("p", { style: { color: "#856404", fontSize: "14px", marginBottom: "10px" }, children: [
1546
1548
  "This content requires ",
1547
1549
  /* @__PURE__ */ n("strong", { children: e }),
@@ -1551,7 +1553,7 @@ const Ie = () => /* @__PURE__ */ l(
1551
1553
  "Your current access level: ",
1552
1554
  /* @__PURE__ */ n("strong", { children: i })
1553
1555
  ] })
1554
- ] }) : /* @__PURE__ */ l(W, { children: [
1556
+ ] }) : /* @__PURE__ */ l(j, { children: [
1555
1557
  /* @__PURE__ */ n("p", { style: { color: "#856404", fontSize: "14px", marginBottom: "10px" }, children: "You don't have the required permissions to view this content." }),
1556
1558
  t && t.length > 0 && /* @__PURE__ */ l("p", { style: { color: "#6c757d", fontSize: "12px" }, children: [
1557
1559
  "Required permissions: ",
@@ -1560,7 +1562,7 @@ const Ie = () => /* @__PURE__ */ l(
1560
1562
  ] })
1561
1563
  ]
1562
1564
  }
1563
- ), ot = (i, e) => {
1565
+ ), lt = (i, e) => {
1564
1566
  const t = {
1565
1567
  [ie.USER]: 1,
1566
1568
  [ie.TENANT_ADMIN]: 2,
@@ -1568,28 +1570,28 @@ const Ie = () => /* @__PURE__ */ l(
1568
1570
  };
1569
1571
  return t[i] >= t[e];
1570
1572
  };
1571
- function Vt({
1573
+ function Gt({
1572
1574
  children: i,
1573
1575
  fallback: e,
1574
1576
  minUserType: t,
1575
1577
  requiredPermissions: r,
1576
1578
  requireAllPermissions: s = !1
1577
1579
  }) {
1578
- const { hasValidSession: o, sessionManager: a, hasPermission: p, hasAnyPermission: w, hasAllPermissions: y } = oe();
1580
+ const { hasValidSession: o, sessionManager: a, hasPermission: g, hasAnyPermission: w, hasAllPermissions: m } = oe();
1579
1581
  if (!o())
1580
- return /* @__PURE__ */ n(W, { children: e || /* @__PURE__ */ n(Ie, {}) });
1581
- const x = a.getUser();
1582
- if (!x)
1583
- return /* @__PURE__ */ n(W, { children: e || /* @__PURE__ */ n(Ie, {}) });
1584
- if (t && !ot(x.userType, t))
1585
- return /* @__PURE__ */ n(Re, { userType: x.userType, minUserType: t });
1586
- if (r && r.length > 0 && !(s ? y(r) : w(r))) {
1587
- const f = r.filter((A) => !p(A)).map((A) => typeof A == "string" ? A : A.name);
1582
+ return /* @__PURE__ */ n(j, { children: e || /* @__PURE__ */ n(Ie, {}) });
1583
+ const k = a.getUser();
1584
+ if (!k)
1585
+ return /* @__PURE__ */ n(j, { children: e || /* @__PURE__ */ n(Ie, {}) });
1586
+ if (t && !lt(k.userType, t))
1587
+ return /* @__PURE__ */ n(Re, { userType: k.userType, minUserType: t });
1588
+ if (r && r.length > 0 && !(s ? m(r) : w(r))) {
1589
+ const f = r.filter((A) => !g(A)).map((A) => typeof A == "string" ? A : A.name);
1588
1590
  return /* @__PURE__ */ n(Re, { missingPermissions: f });
1589
1591
  }
1590
- return /* @__PURE__ */ n(W, { children: i });
1592
+ return /* @__PURE__ */ n(j, { children: i });
1591
1593
  }
1592
- const at = ({ redirectPath: i }) => /* @__PURE__ */ n(
1594
+ const ct = ({ redirectPath: i }) => /* @__PURE__ */ n(
1593
1595
  "div",
1594
1596
  {
1595
1597
  style: {
@@ -1655,7 +1657,7 @@ const at = ({ redirectPath: i }) => /* @__PURE__ */ n(
1655
1657
  children: [
1656
1658
  /* @__PURE__ */ n("div", { style: { fontSize: "3rem", marginBottom: "1rem" }, children: "⚠️" }),
1657
1659
  /* @__PURE__ */ n("h2", { style: { color: "#374151", marginBottom: "1rem" }, children: "Insufficient Permissions" }),
1658
- e && i ? /* @__PURE__ */ l(W, { children: [
1660
+ e && i ? /* @__PURE__ */ l(j, { children: [
1659
1661
  /* @__PURE__ */ l("p", { style: { color: "#6b7280", marginBottom: "1rem" }, children: [
1660
1662
  "This page requires ",
1661
1663
  /* @__PURE__ */ n("strong", { children: e }),
@@ -1665,7 +1667,7 @@ const at = ({ redirectPath: i }) => /* @__PURE__ */ n(
1665
1667
  "Your current access level: ",
1666
1668
  /* @__PURE__ */ n("strong", { children: i })
1667
1669
  ] })
1668
- ] }) : /* @__PURE__ */ l(W, { children: [
1670
+ ] }) : /* @__PURE__ */ l(j, { children: [
1669
1671
  /* @__PURE__ */ n("p", { style: { color: "#6b7280", marginBottom: "1rem" }, children: "You don't have the required permissions to access this page." }),
1670
1672
  t && t.length > 0 && /* @__PURE__ */ l("p", { style: { color: "#9ca3af", fontSize: "0.875rem" }, children: [
1671
1673
  "Required permissions: ",
@@ -1676,7 +1678,7 @@ const at = ({ redirectPath: i }) => /* @__PURE__ */ n(
1676
1678
  }
1677
1679
  )
1678
1680
  }
1679
- ), lt = (i, e) => {
1681
+ ), dt = (i, e) => {
1680
1682
  const t = {
1681
1683
  [ie.USER]: 1,
1682
1684
  [ie.TENANT_ADMIN]: 2,
@@ -1684,7 +1686,7 @@ const at = ({ redirectPath: i }) => /* @__PURE__ */ n(
1684
1686
  };
1685
1687
  return t[i] >= t[e];
1686
1688
  };
1687
- function _t({
1689
+ function Kt({
1688
1690
  children: i,
1689
1691
  redirectTo: e = "/login",
1690
1692
  minUserType: t,
@@ -1692,24 +1694,24 @@ function _t({
1692
1694
  requireAllPermissions: s = !1,
1693
1695
  fallback: o
1694
1696
  }) {
1695
- const { hasValidSession: a, sessionManager: p, hasPermission: w, hasAnyPermission: y, hasAllPermissions: x } = oe(), b = Se();
1697
+ const { hasValidSession: a, sessionManager: g, hasPermission: w, hasAnyPermission: m, hasAllPermissions: k } = oe(), b = Se();
1696
1698
  if (!a())
1697
- return o ? /* @__PURE__ */ n(W, { children: o }) : /* @__PURE__ */ l(W, { children: [
1698
- /* @__PURE__ */ n(at, { redirectPath: e }),
1699
+ return o ? /* @__PURE__ */ n(j, { children: o }) : /* @__PURE__ */ l(j, { children: [
1700
+ /* @__PURE__ */ n(ct, { redirectPath: e }),
1699
1701
  /* @__PURE__ */ n(pe, { to: e, state: { from: b.pathname }, replace: !0 })
1700
1702
  ] });
1701
- const f = p.getUser();
1703
+ const f = g.getUser();
1702
1704
  if (!f)
1703
1705
  return /* @__PURE__ */ n(pe, { to: e, state: { from: b.pathname }, replace: !0 });
1704
- if (t && !lt(f.userType, t))
1706
+ if (t && !dt(f.userType, t))
1705
1707
  return /* @__PURE__ */ n(Le, { userType: f.userType, minUserType: t });
1706
- if (r && r.length > 0 && !(s ? x(r) : y(r))) {
1708
+ if (r && r.length > 0 && !(s ? k(r) : m(r))) {
1707
1709
  const L = r.filter((D) => !w(D)).map((D) => typeof D == "string" ? D : D.name);
1708
1710
  return /* @__PURE__ */ n(Le, { missingPermissions: L });
1709
1711
  }
1710
- return /* @__PURE__ */ n(W, { children: i });
1712
+ return /* @__PURE__ */ n(j, { children: i });
1711
1713
  }
1712
- const ct = ({ redirectPath: i }) => /* @__PURE__ */ n(
1714
+ const ut = ({ redirectPath: i }) => /* @__PURE__ */ n(
1713
1715
  "div",
1714
1716
  {
1715
1717
  style: {
@@ -1746,14 +1748,14 @@ const ct = ({ redirectPath: i }) => /* @__PURE__ */ n(
1746
1748
  )
1747
1749
  }
1748
1750
  );
1749
- function Gt({ children: i, redirectTo: e = "/", fallback: t }) {
1751
+ function Jt({ children: i, redirectTo: e = "/", fallback: t }) {
1750
1752
  const { tenant: r, isLoading: s, error: o } = le(), a = Se();
1751
- return s || o ? null : r ? /* @__PURE__ */ n(W, { children: i }) : t ? /* @__PURE__ */ n(W, { children: t }) : /* @__PURE__ */ l(W, { children: [
1752
- /* @__PURE__ */ n(ct, { redirectPath: e }),
1753
+ return s || o ? null : r ? /* @__PURE__ */ n(j, { children: i }) : t ? /* @__PURE__ */ n(j, { children: t }) : /* @__PURE__ */ l(j, { children: [
1754
+ /* @__PURE__ */ n(ut, { redirectPath: e }),
1753
1755
  /* @__PURE__ */ n(pe, { to: e, state: { from: a.pathname }, replace: !0 })
1754
1756
  ] });
1755
1757
  }
1756
- const dt = ({ redirectPath: i }) => /* @__PURE__ */ n(
1758
+ const ht = ({ redirectPath: i }) => /* @__PURE__ */ n(
1757
1759
  "div",
1758
1760
  {
1759
1761
  style: {
@@ -1790,14 +1792,14 @@ const dt = ({ redirectPath: i }) => /* @__PURE__ */ n(
1790
1792
  )
1791
1793
  }
1792
1794
  );
1793
- function Kt({ children: i, redirectTo: e = "/dashboard", fallback: t }) {
1795
+ function Yt({ children: i, redirectTo: e = "/dashboard", fallback: t }) {
1794
1796
  const { tenant: r, isLoading: s, error: o } = le(), a = Se();
1795
- return s || o ? null : r ? t ? /* @__PURE__ */ n(W, { children: t }) : /* @__PURE__ */ l(W, { children: [
1796
- /* @__PURE__ */ n(dt, { redirectPath: e }),
1797
+ return s || o ? null : r ? t ? /* @__PURE__ */ n(j, { children: t }) : /* @__PURE__ */ l(j, { children: [
1798
+ /* @__PURE__ */ n(ht, { redirectPath: e }),
1797
1799
  /* @__PURE__ */ n(pe, { to: e, state: { from: a.pathname }, replace: !0 })
1798
- ] }) : /* @__PURE__ */ n(W, { children: i });
1800
+ ] }) : /* @__PURE__ */ n(j, { children: i });
1799
1801
  }
1800
- const ut = () => /* @__PURE__ */ l(
1802
+ const gt = () => /* @__PURE__ */ l(
1801
1803
  "div",
1802
1804
  {
1803
1805
  style: {
@@ -1814,14 +1816,14 @@ const ut = () => /* @__PURE__ */ l(
1814
1816
  ]
1815
1817
  }
1816
1818
  );
1817
- function Jt({
1819
+ function Qt({
1818
1820
  children: i,
1819
- fallback: e = /* @__PURE__ */ n(ut, {}),
1821
+ fallback: e = /* @__PURE__ */ n(gt, {}),
1820
1822
  allowedPlans: t,
1821
1823
  requiredFeature: r
1822
1824
  }) {
1823
- const { subscription: s, hasAllowedPlan: o, isFeatureEnabled: a, loading: p } = it();
1824
- return p ? /* @__PURE__ */ n(
1825
+ const { subscription: s, hasAllowedPlan: o, isFeatureEnabled: a, loading: g } = at();
1826
+ return g ? /* @__PURE__ */ n(
1825
1827
  "div",
1826
1828
  {
1827
1829
  style: {
@@ -1831,9 +1833,9 @@ function Jt({
1831
1833
  },
1832
1834
  children: "Loading subscription..."
1833
1835
  }
1834
- ) : s ? s.isActive ? t && t.length > 0 && !o(t) ? /* @__PURE__ */ n(W, { children: e }) : r && !a(r) ? /* @__PURE__ */ n(W, { children: e }) : /* @__PURE__ */ n(W, { children: i }) : /* @__PURE__ */ n(W, { children: e }) : /* @__PURE__ */ n(W, { children: e });
1836
+ ) : s ? s.isActive ? t && t.length > 0 && !o(t) ? /* @__PURE__ */ n(j, { children: e }) : r && !a(r) ? /* @__PURE__ */ n(j, { children: e }) : /* @__PURE__ */ n(j, { children: i }) : /* @__PURE__ */ n(j, { children: e }) : /* @__PURE__ */ n(j, { children: e });
1835
1837
  }
1836
- const ht = ({ flagName: i }) => /* @__PURE__ */ l(
1838
+ const pt = ({ flagName: i }) => /* @__PURE__ */ l(
1837
1839
  "div",
1838
1840
  {
1839
1841
  style: {
@@ -1860,8 +1862,8 @@ const ht = ({ flagName: i }) => /* @__PURE__ */ l(
1860
1862
  ]
1861
1863
  }
1862
1864
  );
1863
- function Yt({ name: i, children: e, fallback: t }) {
1864
- const { isEnabled: r, loading: s } = nt();
1865
+ function Xt({ name: i, children: e, fallback: t }) {
1866
+ const { isEnabled: r, loading: s } = it();
1865
1867
  return s ? /* @__PURE__ */ n(
1866
1868
  "div",
1867
1869
  {
@@ -1875,9 +1877,9 @@ function Yt({ name: i, children: e, fallback: t }) {
1875
1877
  },
1876
1878
  children: "Loading feature flags..."
1877
1879
  }
1878
- ) : r(i) ? /* @__PURE__ */ n(W, { children: e }) : /* @__PURE__ */ n(W, { children: t || /* @__PURE__ */ n(ht, { flagName: i }) });
1880
+ ) : r(i) ? /* @__PURE__ */ n(j, { children: e }) : /* @__PURE__ */ n(j, { children: t || /* @__PURE__ */ n(pt, { flagName: i }) });
1879
1881
  }
1880
- const gt = () => /* @__PURE__ */ l(
1882
+ const ft = () => /* @__PURE__ */ l(
1881
1883
  "svg",
1882
1884
  {
1883
1885
  width: "16",
@@ -1894,7 +1896,7 @@ const gt = () => /* @__PURE__ */ l(
1894
1896
  /* @__PURE__ */ n("circle", { cx: "12", cy: "12", r: "3" })
1895
1897
  ]
1896
1898
  }
1897
- ), pt = () => /* @__PURE__ */ l(
1899
+ ), mt = () => /* @__PURE__ */ l(
1898
1900
  "svg",
1899
1901
  {
1900
1902
  width: "16",
@@ -1911,10 +1913,10 @@ const gt = () => /* @__PURE__ */ l(
1911
1913
  /* @__PURE__ */ n("line", { x1: "1", y1: "1", x2: "23", y2: "23" })
1912
1914
  ]
1913
1915
  }
1914
- ), ft = {
1915
- showPassword: /* @__PURE__ */ n(gt, {}),
1916
- hidePassword: /* @__PURE__ */ n(pt, {})
1917
- }, mt = {
1916
+ ), yt = {
1917
+ showPassword: /* @__PURE__ */ n(ft, {}),
1918
+ hidePassword: /* @__PURE__ */ n(mt, {})
1919
+ }, wt = {
1918
1920
  title: "Sign In",
1919
1921
  usernameLabel: "Email or Phone",
1920
1922
  usernamePlaceholder: "Enter your email or phone number",
@@ -1928,7 +1930,7 @@ const gt = () => /* @__PURE__ */ l(
1928
1930
  magicLinkLink: "Use Magic Link",
1929
1931
  errorMessage: "Invalid credentials",
1930
1932
  loadingText: "Signing in..."
1931
- }, yt = {
1933
+ }, bt = {
1932
1934
  container: {
1933
1935
  maxWidth: "400px",
1934
1936
  width: "100%",
@@ -2035,7 +2037,7 @@ const gt = () => /* @__PURE__ */ l(
2035
2037
  fontSize: "0.875rem"
2036
2038
  }
2037
2039
  };
2038
- function Qt({
2040
+ function Zt({
2039
2041
  copy: i = {},
2040
2042
  styles: e = {},
2041
2043
  icons: t = {},
@@ -2043,49 +2045,49 @@ function Qt({
2043
2045
  onError: s,
2044
2046
  onForgotPassword: o,
2045
2047
  onSignupClick: a,
2046
- onMagicLinkClick: p,
2048
+ onMagicLinkClick: g,
2047
2049
  showForgotPassword: w = !0,
2048
- showSignupLink: y = !0,
2049
- showMagicLinkOption: x = !0,
2050
+ showSignupLink: m = !0,
2051
+ showMagicLinkOption: k = !0,
2050
2052
  className: b
2051
2053
  }) {
2052
- const [f, A] = k(""), [L, D] = k(""), [I, M] = k(!1), [u, R] = k(!1), [m, H] = k(""), [$, C] = k({}), { login: T } = oe(), { tenant: q } = le(), S = { ...mt, ...i }, P = { ...yt, ...e }, E = { ...ft, ...t }, d = () => {
2053
- const g = {};
2054
- return f.trim() || (g.username = !0), L.trim() || (g.password = !0), C(g), Object.keys(g).length === 0;
2055
- }, F = async (g) => {
2056
- if (g.preventDefault(), !!d()) {
2057
- if (!(q != null && q.id)) {
2058
- H("Tenant not found");
2054
+ const [f, A] = S(""), [L, D] = S(""), [R, P] = S(!1), [u, N] = S(!1), [z, E] = S(""), [p, O] = S({}), { login: v } = oe(), { tenant: C } = le(), x = { ...wt, ...i }, M = { ...bt, ...e }, F = { ...yt, ...t }, c = () => {
2055
+ const d = {};
2056
+ return f.trim() || (d.username = !0), L.trim() || (d.password = !0), O(d), Object.keys(d).length === 0;
2057
+ }, I = async (d) => {
2058
+ if (d.preventDefault(), !!c()) {
2059
+ if (!(C != null && C.id)) {
2060
+ E("Tenant not found");
2059
2061
  return;
2060
2062
  }
2061
- R(!0), H("");
2063
+ N(!0), E("");
2062
2064
  try {
2063
- const c = await T({
2065
+ const y = await v({
2064
2066
  username: f,
2065
2067
  password: L
2066
2068
  // tenantId inferred from context automatically
2067
2069
  });
2068
- r == null || r(c);
2069
- } catch (c) {
2070
- const j = c.message || S.errorMessage;
2071
- H(j), s == null || s(j);
2070
+ r == null || r(y);
2071
+ } catch (y) {
2072
+ const G = y.message || x.errorMessage;
2073
+ E(G), s == null || s(G);
2072
2074
  } finally {
2073
- R(!1);
2075
+ N(!1);
2074
2076
  }
2075
2077
  }
2076
- }, v = (g) => ({
2077
- ...P.input,
2078
- ...$[g] ? P.inputError : {}
2078
+ }, T = (d) => ({
2079
+ ...M.input,
2080
+ ...p[d] ? M.inputError : {}
2079
2081
  }), h = () => ({
2080
- ...P.button,
2081
- ...u ? P.buttonLoading : {},
2082
- ...!f || !L || u ? P.buttonDisabled : {}
2082
+ ...M.button,
2083
+ ...u ? M.buttonLoading : {},
2084
+ ...!f || !L || u ? M.buttonDisabled : {}
2083
2085
  });
2084
- return /* @__PURE__ */ l("div", { className: b, style: P.container, children: [
2085
- /* @__PURE__ */ n("h2", { style: P.title, children: S.title }),
2086
- /* @__PURE__ */ l("form", { onSubmit: F, style: P.form, children: [
2087
- /* @__PURE__ */ l("div", { style: P.fieldGroup, children: [
2088
- /* @__PURE__ */ n("label", { style: P.label, children: S.usernameLabel }),
2086
+ return /* @__PURE__ */ l("div", { className: b, style: M.container, children: [
2087
+ /* @__PURE__ */ n("h2", { style: M.title, children: x.title }),
2088
+ /* @__PURE__ */ l("form", { onSubmit: I, style: M.form, children: [
2089
+ /* @__PURE__ */ l("div", { style: M.fieldGroup, children: [
2090
+ /* @__PURE__ */ n("label", { style: M.label, children: x.usernameLabel }),
2089
2091
  /* @__PURE__ */ n(
2090
2092
  "input",
2091
2093
  {
@@ -2093,31 +2095,31 @@ function Qt({
2093
2095
  name: "username",
2094
2096
  type: "text",
2095
2097
  value: f,
2096
- onChange: (g) => {
2097
- A(g.target.value), $.username && C((c) => ({ ...c, username: !1 }));
2098
+ onChange: (d) => {
2099
+ A(d.target.value), p.username && O((y) => ({ ...y, username: !1 }));
2098
2100
  },
2099
- placeholder: S.usernamePlaceholder,
2100
- style: v("username"),
2101
+ placeholder: x.usernamePlaceholder,
2102
+ style: T("username"),
2101
2103
  disabled: u
2102
2104
  }
2103
2105
  )
2104
2106
  ] }),
2105
- /* @__PURE__ */ l("div", { style: P.fieldGroup, children: [
2106
- /* @__PURE__ */ n("label", { style: P.label, children: S.passwordLabel }),
2107
- /* @__PURE__ */ l("div", { style: P.inputContainer, children: [
2107
+ /* @__PURE__ */ l("div", { style: M.fieldGroup, children: [
2108
+ /* @__PURE__ */ n("label", { style: M.label, children: x.passwordLabel }),
2109
+ /* @__PURE__ */ l("div", { style: M.inputContainer, children: [
2108
2110
  /* @__PURE__ */ n(
2109
2111
  "input",
2110
2112
  {
2111
2113
  id: "password",
2112
2114
  name: "password",
2113
- type: I ? "text" : "password",
2115
+ type: R ? "text" : "password",
2114
2116
  value: L,
2115
- onChange: (g) => {
2116
- D(g.target.value), $.password && C((c) => ({ ...c, password: !1 }));
2117
+ onChange: (d) => {
2118
+ D(d.target.value), p.password && O((y) => ({ ...y, password: !1 }));
2117
2119
  },
2118
- placeholder: S.passwordPlaceholder,
2120
+ placeholder: x.passwordPlaceholder,
2119
2121
  style: {
2120
- ...v("password"),
2122
+ ...T("password"),
2121
2123
  paddingRight: "2.5rem"
2122
2124
  // Make room for the icon
2123
2125
  },
@@ -2128,40 +2130,40 @@ function Qt({
2128
2130
  "button",
2129
2131
  {
2130
2132
  type: "button",
2131
- onClick: () => M(!I),
2132
- style: P.passwordToggle,
2133
+ onClick: () => P(!R),
2134
+ style: M.passwordToggle,
2133
2135
  disabled: u,
2134
- "aria-label": I ? "Hide password" : "Show password",
2135
- children: I ? E.hidePassword : E.showPassword
2136
+ "aria-label": R ? "Hide password" : "Show password",
2137
+ children: R ? F.hidePassword : F.showPassword
2136
2138
  }
2137
2139
  )
2138
2140
  ] })
2139
2141
  ] }),
2140
- /* @__PURE__ */ n("button", { type: "submit", disabled: !f || !L || u, style: h(), children: u ? S.loadingText : S.submitButton }),
2141
- m && /* @__PURE__ */ n("div", { style: P.errorText, children: m })
2142
+ /* @__PURE__ */ n("button", { type: "submit", disabled: !f || !L || u, style: h(), children: u ? x.loadingText : x.submitButton }),
2143
+ z && /* @__PURE__ */ n("div", { style: M.errorText, children: z })
2142
2144
  ] }),
2143
- (w || y || x) && /* @__PURE__ */ l("div", { style: P.linkContainer, children: [
2144
- x && /* @__PURE__ */ l("div", { children: [
2145
- /* @__PURE__ */ l("span", { style: P.divider, children: [
2146
- S.magicLinkText,
2145
+ (w || m || k) && /* @__PURE__ */ l("div", { style: M.linkContainer, children: [
2146
+ k && /* @__PURE__ */ l("div", { children: [
2147
+ /* @__PURE__ */ l("span", { style: M.divider, children: [
2148
+ x.magicLinkText,
2147
2149
  " "
2148
2150
  ] }),
2149
- /* @__PURE__ */ n("a", { onClick: p, style: P.link, children: S.magicLinkLink })
2151
+ /* @__PURE__ */ n("a", { onClick: g, style: M.link, children: x.magicLinkLink })
2150
2152
  ] }),
2151
- x && (w || y) && /* @__PURE__ */ n("div", { style: P.divider, children: "•" }),
2152
- w && /* @__PURE__ */ n("a", { onClick: o, style: P.link, children: S.forgotPasswordLink }),
2153
- w && y && /* @__PURE__ */ n("div", { style: P.divider, children: "•" }),
2154
- y && /* @__PURE__ */ l("div", { children: [
2155
- /* @__PURE__ */ l("span", { style: P.divider, children: [
2156
- S.signupText,
2153
+ k && (w || m) && /* @__PURE__ */ n("div", { style: M.divider, children: "•" }),
2154
+ w && /* @__PURE__ */ n("a", { onClick: o, style: M.link, children: x.forgotPasswordLink }),
2155
+ w && m && /* @__PURE__ */ n("div", { style: M.divider, children: "•" }),
2156
+ m && /* @__PURE__ */ l("div", { children: [
2157
+ /* @__PURE__ */ l("span", { style: M.divider, children: [
2158
+ x.signupText,
2157
2159
  " "
2158
2160
  ] }),
2159
- /* @__PURE__ */ n("a", { onClick: a, style: P.link, children: S.signupLink })
2161
+ /* @__PURE__ */ n("a", { onClick: a, style: M.link, children: x.signupLink })
2160
2162
  ] })
2161
2163
  ] })
2162
2164
  ] });
2163
2165
  }
2164
- const wt = {
2166
+ const St = {
2165
2167
  title: "Create Account",
2166
2168
  nameLabel: "First Name",
2167
2169
  namePlaceholder: "Enter your first name",
@@ -2187,7 +2189,7 @@ const wt = {
2187
2189
  passwordMismatchError: "Passwords do not match",
2188
2190
  isAdminLabel: "Create new organization",
2189
2191
  isAdminDescription: "Check this if you want to create a new organization"
2190
- }, bt = {
2192
+ }, vt = {
2191
2193
  container: {
2192
2194
  maxWidth: "400px",
2193
2195
  width: "100%",
@@ -2286,7 +2288,7 @@ const wt = {
2286
2288
  fontSize: "0.875rem"
2287
2289
  }
2288
2290
  };
2289
- function Xt({
2291
+ function er({
2290
2292
  copy: i = {},
2291
2293
  styles: e = {},
2292
2294
  signupType: t = "user",
@@ -2294,79 +2296,79 @@ function Xt({
2294
2296
  onError: s,
2295
2297
  onLoginClick: o,
2296
2298
  onMagicLinkClick: a,
2297
- showLoginLink: p = !0,
2299
+ showLoginLink: g = !0,
2298
2300
  showMagicLinkOption: w = !0,
2299
- className: y
2301
+ className: m
2300
2302
  }) {
2301
- const [x, b] = k(""), [f, A] = k(""), [L, D] = k(""), [I, M] = k(""), [u, R] = k(""), [m, H] = k(""), [$, C] = k(""), [T, q] = k(!1), [S, P] = k(""), [E, d] = k({}), { signup: F, signupTenantAdmin: v } = oe(), { tenant: h } = le(), g = { ...wt, ...i }, c = { ...bt, ...e }, j = () => {
2302
- const U = {};
2303
- return x.trim() || (U.name = !0), !L.trim() && !I.trim() && (U.email = !0, U.phoneNumber = !0), u.trim() || (U.password = !0), m.trim() || (U.confirmPassword = !0), t === "tenant" && !$.trim() && (U.tenantName = !0), d(U), Object.keys(U).length === 0;
2304
- }, K = async (U) => {
2305
- if (U.preventDefault(), !!j()) {
2306
- if (u !== m) {
2307
- P(g.passwordMismatchError), d({ confirmPassword: !0 });
2303
+ const [k, b] = S(""), [f, A] = S(""), [L, D] = S(""), [R, P] = S(""), [u, N] = S(""), [z, E] = S(""), [p, O] = S(""), [v, C] = S(!1), [x, M] = S(""), [F, c] = S({}), { signup: I, signupTenantAdmin: T } = oe(), { tenant: h } = le(), d = { ...St, ...i }, y = { ...vt, ...e }, G = () => {
2304
+ const B = {};
2305
+ return k.trim() || (B.name = !0), !L.trim() && !R.trim() && (B.email = !0, B.phoneNumber = !0), u.trim() || (B.password = !0), z.trim() || (B.confirmPassword = !0), t === "tenant" && !p.trim() && (B.tenantName = !0), c(B), Object.keys(B).length === 0;
2306
+ }, $ = async (B) => {
2307
+ if (B.preventDefault(), !!G()) {
2308
+ if (u !== z) {
2309
+ M(d.passwordMismatchError), c({ confirmPassword: !0 });
2308
2310
  return;
2309
2311
  }
2310
2312
  if (t === "user" && !(h != null && h.id)) {
2311
- P("Tenant not found");
2313
+ M("Tenant not found");
2312
2314
  return;
2313
2315
  }
2314
- q(!0), P("");
2316
+ C(!0), M("");
2315
2317
  try {
2316
2318
  let J;
2317
- t === "tenant" ? J = await v({
2319
+ t === "tenant" ? J = await T({
2318
2320
  email: L || void 0,
2319
- phoneNumber: I || void 0,
2320
- name: x,
2321
+ phoneNumber: R || void 0,
2322
+ name: k,
2321
2323
  password: u,
2322
- tenantName: $,
2324
+ tenantName: p,
2323
2325
  lastName: f || void 0
2324
- }) : J = await F({
2326
+ }) : J = await I({
2325
2327
  email: L || void 0,
2326
- phoneNumber: I || void 0,
2327
- name: x,
2328
+ phoneNumber: R || void 0,
2329
+ name: k,
2328
2330
  password: u,
2329
2331
  tenantId: h.id,
2330
2332
  lastName: f || void 0
2331
2333
  }), r == null || r(J);
2332
2334
  } catch (J) {
2333
- const ge = J.message || g.errorMessage;
2334
- P(ge), s == null || s(ge);
2335
+ const ge = J.message || d.errorMessage;
2336
+ M(ge), s == null || s(ge);
2335
2337
  } finally {
2336
- q(!1);
2338
+ C(!1);
2337
2339
  }
2338
2340
  }
2339
- }, N = (U) => ({
2340
- ...c.input,
2341
- ...E[U] ? c.inputError : {}
2342
- }), z = () => ({
2343
- ...c.button,
2344
- ...T ? c.buttonLoading : {},
2345
- ...!x || !L && !I || !u || !m || T || t === "tenant" && !$ ? c.buttonDisabled : {}
2346
- }), V = x && (L || I) && u && m && (t === "user" || $);
2347
- return /* @__PURE__ */ l("div", { className: y, style: c.container, children: [
2348
- /* @__PURE__ */ n("h2", { style: c.title, children: g.title }),
2349
- /* @__PURE__ */ l("form", { onSubmit: K, style: c.form, children: [
2350
- /* @__PURE__ */ l("div", { style: c.fieldGroup, children: [
2351
- /* @__PURE__ */ n("label", { style: c.label, children: g.nameLabel }),
2341
+ }, H = (B) => ({
2342
+ ...y.input,
2343
+ ...F[B] ? y.inputError : {}
2344
+ }), U = () => ({
2345
+ ...y.button,
2346
+ ...v ? y.buttonLoading : {},
2347
+ ...!k || !L && !R || !u || !z || v || t === "tenant" && !p ? y.buttonDisabled : {}
2348
+ }), V = k && (L || R) && u && z && (t === "user" || p);
2349
+ return /* @__PURE__ */ l("div", { className: m, style: y.container, children: [
2350
+ /* @__PURE__ */ n("h2", { style: y.title, children: d.title }),
2351
+ /* @__PURE__ */ l("form", { onSubmit: $, style: y.form, children: [
2352
+ /* @__PURE__ */ l("div", { style: y.fieldGroup, children: [
2353
+ /* @__PURE__ */ n("label", { style: y.label, children: d.nameLabel }),
2352
2354
  /* @__PURE__ */ n(
2353
2355
  "input",
2354
2356
  {
2355
2357
  id: "name",
2356
2358
  name: "name",
2357
2359
  type: "text",
2358
- value: x,
2359
- onChange: (U) => {
2360
- b(U.target.value), E.name && d((J) => ({ ...J, name: !1 }));
2360
+ value: k,
2361
+ onChange: (B) => {
2362
+ b(B.target.value), F.name && c((J) => ({ ...J, name: !1 }));
2361
2363
  },
2362
- placeholder: g.namePlaceholder,
2363
- style: N("name"),
2364
- disabled: T
2364
+ placeholder: d.namePlaceholder,
2365
+ style: H("name"),
2366
+ disabled: v
2365
2367
  }
2366
2368
  )
2367
2369
  ] }),
2368
- /* @__PURE__ */ l("div", { style: c.fieldGroup, children: [
2369
- /* @__PURE__ */ n("label", { style: c.label, children: g.lastNameLabel }),
2370
+ /* @__PURE__ */ l("div", { style: y.fieldGroup, children: [
2371
+ /* @__PURE__ */ n("label", { style: y.label, children: d.lastNameLabel }),
2370
2372
  /* @__PURE__ */ n(
2371
2373
  "input",
2372
2374
  {
@@ -2374,15 +2376,15 @@ function Xt({
2374
2376
  name: "lastName",
2375
2377
  type: "text",
2376
2378
  value: f,
2377
- onChange: (U) => A(U.target.value),
2378
- placeholder: g.lastNamePlaceholder,
2379
- style: c.input,
2380
- disabled: T
2379
+ onChange: (B) => A(B.target.value),
2380
+ placeholder: d.lastNamePlaceholder,
2381
+ style: y.input,
2382
+ disabled: v
2381
2383
  }
2382
2384
  )
2383
2385
  ] }),
2384
- /* @__PURE__ */ l("div", { style: c.fieldGroup, children: [
2385
- /* @__PURE__ */ n("label", { style: c.label, children: g.emailLabel }),
2386
+ /* @__PURE__ */ l("div", { style: y.fieldGroup, children: [
2387
+ /* @__PURE__ */ n("label", { style: y.label, children: d.emailLabel }),
2386
2388
  /* @__PURE__ */ n(
2387
2389
  "input",
2388
2390
  {
@@ -2390,30 +2392,30 @@ function Xt({
2390
2392
  name: "email",
2391
2393
  type: "email",
2392
2394
  value: L,
2393
- onChange: (U) => {
2394
- D(U.target.value), E.email && d((J) => ({ ...J, email: !1, phoneNumber: !1 }));
2395
+ onChange: (B) => {
2396
+ D(B.target.value), F.email && c((J) => ({ ...J, email: !1, phoneNumber: !1 }));
2395
2397
  },
2396
- placeholder: g.emailPlaceholder,
2397
- style: N("email"),
2398
- disabled: T
2398
+ placeholder: d.emailPlaceholder,
2399
+ style: H("email"),
2400
+ disabled: v
2399
2401
  }
2400
2402
  )
2401
2403
  ] }),
2402
- /* @__PURE__ */ l("div", { style: c.fieldGroup, children: [
2403
- /* @__PURE__ */ n("label", { style: c.label, children: g.phoneNumberLabel }),
2404
+ /* @__PURE__ */ l("div", { style: y.fieldGroup, children: [
2405
+ /* @__PURE__ */ n("label", { style: y.label, children: d.phoneNumberLabel }),
2404
2406
  /* @__PURE__ */ n(
2405
2407
  "input",
2406
2408
  {
2407
2409
  id: "phoneNumber",
2408
2410
  name: "phoneNumber",
2409
2411
  type: "tel",
2410
- value: I,
2411
- onChange: (U) => {
2412
- M(U.target.value), E.phoneNumber && d((J) => ({ ...J, email: !1, phoneNumber: !1 }));
2412
+ value: R,
2413
+ onChange: (B) => {
2414
+ P(B.target.value), F.phoneNumber && c((J) => ({ ...J, email: !1, phoneNumber: !1 }));
2413
2415
  },
2414
- placeholder: g.phoneNumberPlaceholder,
2415
- style: N("phoneNumber"),
2416
- disabled: T
2416
+ placeholder: d.phoneNumberPlaceholder,
2417
+ style: H("phoneNumber"),
2418
+ disabled: v
2417
2419
  }
2418
2420
  )
2419
2421
  ] }),
@@ -2429,8 +2431,8 @@ function Xt({
2429
2431
  children: "At least one contact method (email or phone) is required"
2430
2432
  }
2431
2433
  ),
2432
- /* @__PURE__ */ l("div", { style: c.fieldGroup, children: [
2433
- /* @__PURE__ */ n("label", { style: c.label, children: g.passwordLabel }),
2434
+ /* @__PURE__ */ l("div", { style: y.fieldGroup, children: [
2435
+ /* @__PURE__ */ n("label", { style: y.label, children: d.passwordLabel }),
2434
2436
  /* @__PURE__ */ n(
2435
2437
  "input",
2436
2438
  {
@@ -2438,74 +2440,74 @@ function Xt({
2438
2440
  name: "password",
2439
2441
  type: "password",
2440
2442
  value: u,
2441
- onChange: (U) => {
2442
- R(U.target.value), E.password && d((J) => ({ ...J, password: !1 }));
2443
+ onChange: (B) => {
2444
+ N(B.target.value), F.password && c((J) => ({ ...J, password: !1 }));
2443
2445
  },
2444
- placeholder: g.passwordPlaceholder,
2445
- style: N("password"),
2446
- disabled: T
2446
+ placeholder: d.passwordPlaceholder,
2447
+ style: H("password"),
2448
+ disabled: v
2447
2449
  }
2448
2450
  )
2449
2451
  ] }),
2450
- /* @__PURE__ */ l("div", { style: c.fieldGroup, children: [
2451
- /* @__PURE__ */ n("label", { style: c.label, children: g.confirmPasswordLabel }),
2452
+ /* @__PURE__ */ l("div", { style: y.fieldGroup, children: [
2453
+ /* @__PURE__ */ n("label", { style: y.label, children: d.confirmPasswordLabel }),
2452
2454
  /* @__PURE__ */ n(
2453
2455
  "input",
2454
2456
  {
2455
2457
  id: "confirmPassword",
2456
2458
  name: "confirmPassword",
2457
2459
  type: "password",
2458
- value: m,
2459
- onChange: (U) => {
2460
- H(U.target.value), E.confirmPassword && d((J) => ({ ...J, confirmPassword: !1 })), S === g.passwordMismatchError && P("");
2460
+ value: z,
2461
+ onChange: (B) => {
2462
+ E(B.target.value), F.confirmPassword && c((J) => ({ ...J, confirmPassword: !1 })), x === d.passwordMismatchError && M("");
2461
2463
  },
2462
- placeholder: g.confirmPasswordPlaceholder,
2463
- style: N("confirmPassword"),
2464
- disabled: T
2464
+ placeholder: d.confirmPasswordPlaceholder,
2465
+ style: H("confirmPassword"),
2466
+ disabled: v
2465
2467
  }
2466
2468
  )
2467
2469
  ] }),
2468
- t === "tenant" && /* @__PURE__ */ l("div", { style: c.fieldGroup, children: [
2469
- /* @__PURE__ */ n("label", { style: c.label, children: g.tenantNameLabel }),
2470
+ t === "tenant" && /* @__PURE__ */ l("div", { style: y.fieldGroup, children: [
2471
+ /* @__PURE__ */ n("label", { style: y.label, children: d.tenantNameLabel }),
2470
2472
  /* @__PURE__ */ n(
2471
2473
  "input",
2472
2474
  {
2473
2475
  id: "tenantName",
2474
2476
  name: "tenantName",
2475
2477
  type: "text",
2476
- value: $,
2477
- onChange: (U) => {
2478
- C(U.target.value), E.tenantName && d((J) => ({ ...J, tenantName: !1 }));
2478
+ value: p,
2479
+ onChange: (B) => {
2480
+ O(B.target.value), F.tenantName && c((J) => ({ ...J, tenantName: !1 }));
2479
2481
  },
2480
- placeholder: g.tenantNamePlaceholder,
2481
- style: N("tenantName"),
2482
- disabled: T
2482
+ placeholder: d.tenantNamePlaceholder,
2483
+ style: H("tenantName"),
2484
+ disabled: v
2483
2485
  }
2484
2486
  )
2485
2487
  ] }),
2486
- /* @__PURE__ */ n("button", { type: "submit", disabled: !V || T, style: z(), children: T ? g.loadingText : g.submitButton }),
2487
- S && /* @__PURE__ */ n("div", { style: c.errorText, children: S })
2488
+ /* @__PURE__ */ n("button", { type: "submit", disabled: !V || v, style: U(), children: v ? d.loadingText : d.submitButton }),
2489
+ x && /* @__PURE__ */ n("div", { style: y.errorText, children: x })
2488
2490
  ] }),
2489
- (p || w) && /* @__PURE__ */ l("div", { style: c.linkContainer, children: [
2491
+ (g || w) && /* @__PURE__ */ l("div", { style: y.linkContainer, children: [
2490
2492
  w && /* @__PURE__ */ l("div", { children: [
2491
- /* @__PURE__ */ l("span", { style: c.divider, children: [
2492
- g.magicLinkText,
2493
+ /* @__PURE__ */ l("span", { style: y.divider, children: [
2494
+ d.magicLinkText,
2493
2495
  " "
2494
2496
  ] }),
2495
- /* @__PURE__ */ n("a", { onClick: a, style: c.link, children: g.magicLinkLink })
2497
+ /* @__PURE__ */ n("a", { onClick: a, style: y.link, children: d.magicLinkLink })
2496
2498
  ] }),
2497
- w && p && /* @__PURE__ */ n("div", { style: c.divider, children: "•" }),
2498
- p && /* @__PURE__ */ l("div", { children: [
2499
- /* @__PURE__ */ l("span", { style: c.divider, children: [
2500
- g.loginText,
2499
+ w && g && /* @__PURE__ */ n("div", { style: y.divider, children: "•" }),
2500
+ g && /* @__PURE__ */ l("div", { children: [
2501
+ /* @__PURE__ */ l("span", { style: y.divider, children: [
2502
+ d.loginText,
2501
2503
  " "
2502
2504
  ] }),
2503
- /* @__PURE__ */ n("a", { onClick: o, style: c.link, children: g.loginLink })
2505
+ /* @__PURE__ */ n("a", { onClick: o, style: y.link, children: d.loginLink })
2504
2506
  ] })
2505
2507
  ] })
2506
2508
  ] });
2507
2509
  }
2508
- const St = {
2510
+ const kt = {
2509
2511
  title: "Sign In with Magic Link",
2510
2512
  emailLabel: "Email",
2511
2513
  emailPlaceholder: "Enter your email",
@@ -2523,7 +2525,7 @@ const St = {
2523
2525
  loadingText: "Sending magic link...",
2524
2526
  verifyingText: "Verifying magic link...",
2525
2527
  description: "Enter your email to receive a magic link. If you don't have an account, we'll create one for you."
2526
- }, vt = {
2528
+ }, xt = {
2527
2529
  container: {
2528
2530
  maxWidth: "400px",
2529
2531
  width: "100%",
@@ -2626,7 +2628,7 @@ const St = {
2626
2628
  fontSize: "0.875rem"
2627
2629
  }
2628
2630
  };
2629
- function Zt({
2631
+ function tr({
2630
2632
  copy: i = {},
2631
2633
  styles: e = {},
2632
2634
  onSuccess: t,
@@ -2634,97 +2636,97 @@ function Zt({
2634
2636
  onLoginClick: s,
2635
2637
  onSignupClick: o,
2636
2638
  showTraditionalLinks: a = !0,
2637
- className: p,
2639
+ className: g,
2638
2640
  verifyToken: w,
2639
- frontendUrl: y
2641
+ frontendUrl: m
2640
2642
  }) {
2641
- const [x, b] = k(""), [f, A] = k(""), [L, D] = k(""), [I, M] = k(!1), [u, R] = k(!1), [m, H] = k(""), [$, C] = k(""), [T, q] = k({}), [S, P] = k(!1), { sendMagicLink: E, verifyMagicLink: d } = oe(), { tenant: F } = le(), v = { ...St, ...i }, h = { ...vt, ...e };
2643
+ const [k, b] = S(""), [f, A] = S(""), [L, D] = S(""), [R, P] = S(!1), [u, N] = S(!1), [z, E] = S(""), [p, O] = S(""), [v, C] = S({}), [x, M] = S(!1), { sendMagicLink: F, verifyMagicLink: c } = oe(), { tenant: I } = le(), T = { ...kt, ...i }, h = { ...xt, ...e };
2642
2644
  te(() => {
2643
- w && g(w);
2645
+ w && d(w);
2644
2646
  }, [w]);
2645
- const g = async (z) => {
2646
- if (!F || !x) {
2647
- H("Missing tenant or email");
2647
+ const d = async (U) => {
2648
+ if (!I || !k) {
2649
+ E("Missing tenant or email");
2648
2650
  return;
2649
2651
  }
2650
- R(!0), H("");
2652
+ N(!0), E("");
2651
2653
  try {
2652
- const V = await d({
2653
- token: z,
2654
- email: x
2654
+ const V = await c({
2655
+ token: U,
2656
+ email: k
2655
2657
  // tenantId inferred from context automatically
2656
2658
  });
2657
2659
  t == null || t(V);
2658
2660
  } catch (V) {
2659
- const U = V.message || "Failed to verify magic link";
2660
- H(U), r == null || r(U);
2661
+ const B = V.message || "Failed to verify magic link";
2662
+ E(B), r == null || r(B);
2661
2663
  } finally {
2662
- R(!1);
2664
+ N(!1);
2663
2665
  }
2664
- }, c = () => {
2665
- const z = {};
2666
- return x.trim() || (z.email = !0), S && !f.trim() && (z.name = !0), q(z), Object.keys(z).length === 0;
2667
- }, j = async (z) => {
2668
- if (z.preventDefault(), !!c()) {
2669
- if (!(F != null && F.id)) {
2670
- H("Tenant not found");
2666
+ }, y = () => {
2667
+ const U = {};
2668
+ return k.trim() || (U.email = !0), x && !f.trim() && (U.name = !0), C(U), Object.keys(U).length === 0;
2669
+ }, G = async (U) => {
2670
+ if (U.preventDefault(), !!y()) {
2671
+ if (!(I != null && I.id)) {
2672
+ E("Tenant not found");
2671
2673
  return;
2672
2674
  }
2673
- M(!0), H(""), C("");
2675
+ P(!0), E(""), O("");
2674
2676
  try {
2675
- const V = y || (typeof window < "u" ? window.location.origin : ""), U = await E({
2676
- email: x,
2677
- tenantId: F.id,
2677
+ const V = m || (typeof window < "u" ? window.location.origin : ""), B = await F({
2678
+ email: k,
2679
+ tenantId: I.id,
2678
2680
  frontendUrl: V,
2679
- name: S ? f : void 0,
2680
- lastName: S ? L : void 0
2681
+ name: x ? f : void 0,
2682
+ lastName: x ? L : void 0
2681
2683
  });
2682
- C(v.successMessage), t == null || t(U);
2684
+ O(T.successMessage), t == null || t(B);
2683
2685
  } catch (V) {
2684
- const U = V.message || v.errorMessage;
2685
- H(U), r == null || r(U);
2686
+ const B = V.message || T.errorMessage;
2687
+ E(B), r == null || r(B);
2686
2688
  } finally {
2687
- M(!1);
2689
+ P(!1);
2688
2690
  }
2689
2691
  }
2690
- }, K = (z) => ({
2692
+ }, $ = (U) => ({
2691
2693
  ...h.input,
2692
- ...T[z] ? h.inputError : {}
2693
- }), N = () => ({
2694
+ ...v[U] ? h.inputError : {}
2695
+ }), H = () => ({
2694
2696
  ...h.button,
2695
- ...I || u ? h.buttonLoading : {},
2696
- ...!x || I || u ? h.buttonDisabled : {}
2697
+ ...R || u ? h.buttonLoading : {},
2698
+ ...!k || R || u ? h.buttonDisabled : {}
2697
2699
  });
2698
- return u ? /* @__PURE__ */ l("div", { className: p, style: h.container, children: [
2699
- /* @__PURE__ */ n("h2", { style: h.title, children: v.verifyingText }),
2700
+ return u ? /* @__PURE__ */ l("div", { className: g, style: h.container, children: [
2701
+ /* @__PURE__ */ n("h2", { style: h.title, children: T.verifyingText }),
2700
2702
  /* @__PURE__ */ n("div", { style: { textAlign: "center", padding: "2rem" }, children: /* @__PURE__ */ n("div", { style: { fontSize: "1rem", color: "#6b7280" }, children: "Please wait while we verify your magic link..." }) })
2701
- ] }) : /* @__PURE__ */ l("div", { className: p, style: h.container, children: [
2702
- /* @__PURE__ */ n("h2", { style: h.title, children: v.title }),
2703
- /* @__PURE__ */ n("p", { style: h.description, children: v.description }),
2704
- /* @__PURE__ */ l("form", { onSubmit: j, style: h.form, children: [
2703
+ ] }) : /* @__PURE__ */ l("div", { className: g, style: h.container, children: [
2704
+ /* @__PURE__ */ n("h2", { style: h.title, children: T.title }),
2705
+ /* @__PURE__ */ n("p", { style: h.description, children: T.description }),
2706
+ /* @__PURE__ */ l("form", { onSubmit: G, style: h.form, children: [
2705
2707
  /* @__PURE__ */ l("div", { style: h.fieldGroup, children: [
2706
- /* @__PURE__ */ n("label", { style: h.label, children: v.emailLabel }),
2708
+ /* @__PURE__ */ n("label", { style: h.label, children: T.emailLabel }),
2707
2709
  /* @__PURE__ */ n(
2708
2710
  "input",
2709
2711
  {
2710
2712
  id: "email",
2711
2713
  name: "email",
2712
2714
  type: "email",
2713
- value: x,
2714
- onChange: (z) => {
2715
- b(z.target.value), T.email && q((V) => ({ ...V, email: !1 }));
2715
+ value: k,
2716
+ onChange: (U) => {
2717
+ b(U.target.value), v.email && C((V) => ({ ...V, email: !1 }));
2716
2718
  },
2717
- placeholder: v.emailPlaceholder,
2718
- style: K("email"),
2719
- disabled: I || u
2719
+ placeholder: T.emailPlaceholder,
2720
+ style: $("email"),
2721
+ disabled: R || u
2720
2722
  }
2721
2723
  )
2722
2724
  ] }),
2723
- !S && /* @__PURE__ */ n("div", { style: { textAlign: "center", marginTop: "0.5rem" }, children: /* @__PURE__ */ n(
2725
+ !x && /* @__PURE__ */ n("div", { style: { textAlign: "center", marginTop: "0.5rem" }, children: /* @__PURE__ */ n(
2724
2726
  "button",
2725
2727
  {
2726
2728
  type: "button",
2727
- onClick: () => P(!0),
2729
+ onClick: () => M(!0),
2728
2730
  style: {
2729
2731
  background: "none",
2730
2732
  border: "none",
@@ -2736,9 +2738,9 @@ function Zt({
2736
2738
  children: "New user? Add your name"
2737
2739
  }
2738
2740
  ) }),
2739
- S && /* @__PURE__ */ l(W, { children: [
2741
+ x && /* @__PURE__ */ l(j, { children: [
2740
2742
  /* @__PURE__ */ l("div", { style: h.fieldGroup, children: [
2741
- /* @__PURE__ */ n("label", { style: h.label, children: v.nameLabel }),
2743
+ /* @__PURE__ */ n("label", { style: h.label, children: T.nameLabel }),
2742
2744
  /* @__PURE__ */ n(
2743
2745
  "input",
2744
2746
  {
@@ -2746,17 +2748,17 @@ function Zt({
2746
2748
  name: "name",
2747
2749
  type: "text",
2748
2750
  value: f,
2749
- onChange: (z) => {
2750
- A(z.target.value), T.name && q((V) => ({ ...V, name: !1 }));
2751
+ onChange: (U) => {
2752
+ A(U.target.value), v.name && C((V) => ({ ...V, name: !1 }));
2751
2753
  },
2752
- placeholder: v.namePlaceholder,
2753
- style: K("name"),
2754
- disabled: I || u
2754
+ placeholder: T.namePlaceholder,
2755
+ style: $("name"),
2756
+ disabled: R || u
2755
2757
  }
2756
2758
  )
2757
2759
  ] }),
2758
2760
  /* @__PURE__ */ l("div", { style: h.fieldGroup, children: [
2759
- /* @__PURE__ */ n("label", { style: h.label, children: v.lastNameLabel }),
2761
+ /* @__PURE__ */ n("label", { style: h.label, children: T.lastNameLabel }),
2760
2762
  /* @__PURE__ */ n(
2761
2763
  "input",
2762
2764
  {
@@ -2764,10 +2766,10 @@ function Zt({
2764
2766
  name: "lastName",
2765
2767
  type: "text",
2766
2768
  value: L,
2767
- onChange: (z) => D(z.target.value),
2768
- placeholder: v.lastNamePlaceholder,
2769
+ onChange: (U) => D(U.target.value),
2770
+ placeholder: T.lastNamePlaceholder,
2769
2771
  style: h.input,
2770
- disabled: I || u
2772
+ disabled: R || u
2771
2773
  }
2772
2774
  )
2773
2775
  ] }),
@@ -2776,7 +2778,7 @@ function Zt({
2776
2778
  {
2777
2779
  type: "button",
2778
2780
  onClick: () => {
2779
- P(!1), A(""), D("");
2781
+ M(!1), A(""), D("");
2780
2782
  },
2781
2783
  style: {
2782
2784
  background: "none",
@@ -2790,30 +2792,30 @@ function Zt({
2790
2792
  }
2791
2793
  ) })
2792
2794
  ] }),
2793
- /* @__PURE__ */ n("button", { type: "submit", disabled: !x || I || u, style: N(), children: I ? v.loadingText : v.submitButton }),
2794
- m && /* @__PURE__ */ n("div", { style: h.errorText, children: m }),
2795
- $ && /* @__PURE__ */ n("div", { style: h.successText, children: $ })
2795
+ /* @__PURE__ */ n("button", { type: "submit", disabled: !k || R || u, style: H(), children: R ? T.loadingText : T.submitButton }),
2796
+ z && /* @__PURE__ */ n("div", { style: h.errorText, children: z }),
2797
+ p && /* @__PURE__ */ n("div", { style: h.successText, children: p })
2796
2798
  ] }),
2797
2799
  a && /* @__PURE__ */ l("div", { style: h.linkContainer, children: [
2798
2800
  /* @__PURE__ */ l("div", { children: [
2799
2801
  /* @__PURE__ */ l("span", { style: h.divider, children: [
2800
- v.loginText,
2802
+ T.loginText,
2801
2803
  " "
2802
2804
  ] }),
2803
- /* @__PURE__ */ n("a", { onClick: s, style: h.link, children: v.loginLink })
2805
+ /* @__PURE__ */ n("a", { onClick: s, style: h.link, children: T.loginLink })
2804
2806
  ] }),
2805
2807
  /* @__PURE__ */ n("div", { style: h.divider, children: "•" }),
2806
2808
  /* @__PURE__ */ l("div", { children: [
2807
2809
  /* @__PURE__ */ l("span", { style: h.divider, children: [
2808
- v.signupText,
2810
+ T.signupText,
2809
2811
  " "
2810
2812
  ] }),
2811
- /* @__PURE__ */ n("a", { onClick: o, style: h.link, children: v.signupLink })
2813
+ /* @__PURE__ */ n("a", { onClick: o, style: h.link, children: T.signupLink })
2812
2814
  ] })
2813
2815
  ] })
2814
2816
  ] });
2815
2817
  }
2816
- const kt = {
2818
+ const At = {
2817
2819
  title: "Verifying Magic Link",
2818
2820
  verifyingMessage: "Please wait while we verify your magic link...",
2819
2821
  successMessage: "Magic link verified successfully! You are now logged in.",
@@ -2908,7 +2910,7 @@ const kt = {
2908
2910
  cursor: "pointer",
2909
2911
  transition: "all 0.15s ease-in-out"
2910
2912
  }
2911
- }, xt = () => /* @__PURE__ */ n("div", { style: $e.spinner }), At = () => /* @__PURE__ */ l(
2913
+ }, Tt = () => /* @__PURE__ */ n("div", { style: $e.spinner }), Pt = () => /* @__PURE__ */ l(
2912
2914
  "svg",
2913
2915
  {
2914
2916
  width: "48",
@@ -2925,7 +2927,7 @@ const kt = {
2925
2927
  /* @__PURE__ */ n("polyline", { points: "22,4 12,14.01 9,11.01" })
2926
2928
  ]
2927
2929
  }
2928
- ), Tt = () => /* @__PURE__ */ l(
2930
+ ), Mt = () => /* @__PURE__ */ l(
2929
2931
  "svg",
2930
2932
  {
2931
2933
  width: "48",
@@ -2943,12 +2945,12 @@ const kt = {
2943
2945
  /* @__PURE__ */ n("line", { x1: "9", y1: "9", x2: "15", y2: "15" })
2944
2946
  ]
2945
2947
  }
2946
- ), Pt = {
2947
- loading: /* @__PURE__ */ n(xt, {}),
2948
- success: /* @__PURE__ */ n(At, {}),
2949
- error: /* @__PURE__ */ n(Tt, {})
2948
+ ), It = {
2949
+ loading: /* @__PURE__ */ n(Tt, {}),
2950
+ success: /* @__PURE__ */ n(Pt, {}),
2951
+ error: /* @__PURE__ */ n(Mt, {})
2950
2952
  };
2951
- function er({
2953
+ function rr({
2952
2954
  copy: i = {},
2953
2955
  styles: e = {},
2954
2956
  icons: t = {},
@@ -2956,80 +2958,80 @@ function er({
2956
2958
  onError: s,
2957
2959
  onRetry: o,
2958
2960
  onBackToLogin: a,
2959
- className: p,
2961
+ className: g,
2960
2962
  token: w,
2961
- email: y,
2962
- appId: x,
2963
+ email: m,
2964
+ appId: k,
2963
2965
  tenantSlug: b,
2964
2966
  autoRedirectDelay: f = 3e3
2965
2967
  }) {
2966
- const [A, L] = k("verifying"), [D, I] = k(""), { verifyMagicLink: M } = oe(), u = { ...kt, ...i }, R = { ...$e, ...e }, m = { ...Pt, ...t }, H = () => {
2968
+ const [A, L] = S("verifying"), [D, R] = S(""), { verifyMagicLink: P } = oe(), u = { ...At, ...i }, N = { ...$e, ...e }, z = { ...It, ...t }, E = () => {
2967
2969
  if (typeof window > "u") return {};
2968
- const S = new URLSearchParams(window.location.search);
2970
+ const x = new URLSearchParams(window.location.search);
2969
2971
  return {
2970
- token: w || S.get("token") || "",
2971
- email: y || S.get("email") || "",
2972
- appId: x || S.get("appId") || "",
2973
- tenantSlug: b || S.get("tenantSlug") || void 0
2972
+ token: w || x.get("token") || "",
2973
+ email: m || x.get("email") || "",
2974
+ appId: k || x.get("appId") || "",
2975
+ tenantSlug: b || x.get("tenantSlug") || void 0
2974
2976
  };
2975
- }, $ = async () => {
2976
- L("verifying"), I("");
2977
+ }, p = async () => {
2978
+ L("verifying"), R("");
2977
2979
  try {
2978
- const S = H();
2979
- if (!S.token || !S.email)
2980
+ const x = E();
2981
+ if (!x.token || !x.email)
2980
2982
  throw new Error("Missing required parameters: token or email");
2981
- const P = await M({
2982
- token: S.token,
2983
- email: S.email,
2984
- tenantSlug: S.tenantSlug
2983
+ const M = await P({
2984
+ token: x.token,
2985
+ email: x.email,
2986
+ tenantSlug: x.tenantSlug
2985
2987
  });
2986
- L("success"), r == null || r(P), f > 0 && setTimeout(() => {
2988
+ L("success"), r == null || r(M), f > 0 && setTimeout(() => {
2987
2989
  L("redirecting");
2988
2990
  }, f);
2989
- } catch (S) {
2990
- const P = S.message || u.errorMessage;
2991
- I(P), L("error"), s == null || s(P);
2991
+ } catch (x) {
2992
+ const M = x.message || u.errorMessage;
2993
+ R(M), L("error"), s == null || s(M);
2992
2994
  }
2993
- }, C = () => {
2994
- o == null || o(), $();
2995
- }, T = () => {
2995
+ }, O = () => {
2996
+ o == null || o(), p();
2997
+ }, v = () => {
2996
2998
  a == null || a();
2997
2999
  };
2998
3000
  te(() => {
2999
- $();
3001
+ p();
3000
3002
  }, []);
3001
- const q = () => {
3003
+ const C = () => {
3002
3004
  switch (A) {
3003
3005
  case "verifying":
3004
- return /* @__PURE__ */ l("div", { style: R.message, children: [
3005
- m.loading,
3006
+ return /* @__PURE__ */ l("div", { style: N.message, children: [
3007
+ z.loading,
3006
3008
  u.verifyingMessage
3007
3009
  ] });
3008
3010
  case "success":
3009
- return /* @__PURE__ */ l(W, { children: [
3010
- m.success,
3011
- /* @__PURE__ */ n("div", { style: R.successMessage, children: u.successMessage })
3011
+ return /* @__PURE__ */ l(j, { children: [
3012
+ z.success,
3013
+ /* @__PURE__ */ n("div", { style: N.successMessage, children: u.successMessage })
3012
3014
  ] });
3013
3015
  case "redirecting":
3014
- return /* @__PURE__ */ l(W, { children: [
3015
- m.loading,
3016
- /* @__PURE__ */ n("div", { style: R.message, children: u.redirectingMessage })
3016
+ return /* @__PURE__ */ l(j, { children: [
3017
+ z.loading,
3018
+ /* @__PURE__ */ n("div", { style: N.message, children: u.redirectingMessage })
3017
3019
  ] });
3018
3020
  case "error":
3019
- return /* @__PURE__ */ l(W, { children: [
3020
- m.error,
3021
- /* @__PURE__ */ n("div", { style: R.errorMessage, children: D || u.errorMessage }),
3022
- /* @__PURE__ */ l("div", { style: R.buttonContainer, children: [
3021
+ return /* @__PURE__ */ l(j, { children: [
3022
+ z.error,
3023
+ /* @__PURE__ */ n("div", { style: N.errorMessage, children: D || u.errorMessage }),
3024
+ /* @__PURE__ */ l("div", { style: N.buttonContainer, children: [
3023
3025
  /* @__PURE__ */ n(
3024
3026
  "button",
3025
3027
  {
3026
- onClick: C,
3027
- style: R.retryButton,
3028
- onMouseOver: (S) => {
3029
- S.currentTarget.style.backgroundColor = "#2563eb";
3028
+ onClick: O,
3029
+ style: N.retryButton,
3030
+ onMouseOver: (x) => {
3031
+ x.currentTarget.style.backgroundColor = "#2563eb";
3030
3032
  },
3031
- onMouseOut: (S) => {
3032
- S.currentTarget.style.backgroundColor = "#3b82f6";
3033
+ onMouseOut: (x) => {
3034
+ x.currentTarget.style.backgroundColor = "#3b82f6";
3033
3035
  },
3034
3036
  children: u.retryButton
3035
3037
  }
@@ -3037,13 +3039,13 @@ function er({
3037
3039
  /* @__PURE__ */ n(
3038
3040
  "button",
3039
3041
  {
3040
- onClick: T,
3041
- style: R.backButton,
3042
- onMouseOver: (S) => {
3043
- S.currentTarget.style.backgroundColor = "#e5e7eb";
3042
+ onClick: v,
3043
+ style: N.backButton,
3044
+ onMouseOver: (x) => {
3045
+ x.currentTarget.style.backgroundColor = "#e5e7eb";
3044
3046
  },
3045
- onMouseOut: (S) => {
3046
- S.currentTarget.style.backgroundColor = "#f3f4f6";
3047
+ onMouseOut: (x) => {
3048
+ x.currentTarget.style.backgroundColor = "#f3f4f6";
3047
3049
  },
3048
3050
  children: u.backToLoginButton
3049
3051
  }
@@ -3054,18 +3056,18 @@ function er({
3054
3056
  return null;
3055
3057
  }
3056
3058
  };
3057
- return /* @__PURE__ */ l("div", { style: R.container, className: p, children: [
3059
+ return /* @__PURE__ */ l("div", { style: N.container, className: g, children: [
3058
3060
  /* @__PURE__ */ n("style", { children: `
3059
3061
  @keyframes spin {
3060
3062
  0% { transform: rotate(0deg); }
3061
3063
  100% { transform: rotate(360deg); }
3062
3064
  }
3063
3065
  ` }),
3064
- /* @__PURE__ */ n("h1", { style: R.title, children: u.title }),
3065
- q()
3066
+ /* @__PURE__ */ n("h1", { style: N.title, children: u.title }),
3067
+ C()
3066
3068
  ] });
3067
3069
  }
3068
- const Mt = {
3070
+ const Rt = {
3069
3071
  title: "Reset Password",
3070
3072
  subtitle: "Enter your email address and we'll send you a link to reset your password.",
3071
3073
  emailLabel: "Email",
@@ -3087,7 +3089,7 @@ const Mt = {
3087
3089
  resetLoadingText: "Resetting...",
3088
3090
  resetSuccessMessage: "Password reset successfully!",
3089
3091
  passwordMismatchError: "Passwords do not match"
3090
- }, It = {
3092
+ }, Lt = {
3091
3093
  container: {
3092
3094
  maxWidth: "400px",
3093
3095
  margin: "0 auto",
@@ -3179,7 +3181,7 @@ const Mt = {
3179
3181
  cursor: "pointer"
3180
3182
  }
3181
3183
  };
3182
- function tr({
3184
+ function nr({
3183
3185
  copy: i = {},
3184
3186
  styles: e = {},
3185
3187
  mode: t = "request",
@@ -3187,105 +3189,105 @@ function tr({
3187
3189
  onSuccess: s,
3188
3190
  onError: o,
3189
3191
  onBackToLogin: a,
3190
- onModeChange: p,
3192
+ onModeChange: g,
3191
3193
  className: w
3192
3194
  }) {
3193
- const [y, x] = k(""), [b, f] = k(r), [A, L] = k(""), [D, I] = k(""), [M, u] = k(!1), [R, m] = k(""), [H, $] = k(""), [C, T] = k({}), { requestPasswordReset: q, confirmPasswordReset: S } = oe(), { tenant: P } = le(), E = { ...Mt, ...i }, d = { ...It, ...e }, F = () => {
3194
- const N = {};
3195
- return y.trim() || (N.email = !0), T(N), Object.keys(N).length === 0;
3196
- }, v = () => {
3197
- const N = {};
3198
- return b.trim() || (N.token = !0), A.trim() || (N.newPassword = !0), D.trim() || (N.confirmPassword = !0), T(N), Object.keys(N).length === 0;
3199
- }, h = async (N) => {
3200
- if (N.preventDefault(), !!F()) {
3201
- if (!(P != null && P.id)) {
3202
- m("Tenant not found");
3195
+ const [m, k] = S(""), [b, f] = S(r), [A, L] = S(""), [D, R] = S(""), [P, u] = S(!1), [N, z] = S(""), [E, p] = S(""), [O, v] = S({}), { requestPasswordReset: C, confirmPasswordReset: x } = oe(), { tenant: M } = le(), F = { ...Rt, ...i }, c = { ...Lt, ...e }, I = () => {
3196
+ const H = {};
3197
+ return m.trim() || (H.email = !0), v(H), Object.keys(H).length === 0;
3198
+ }, T = () => {
3199
+ const H = {};
3200
+ return b.trim() || (H.token = !0), A.trim() || (H.newPassword = !0), D.trim() || (H.confirmPassword = !0), v(H), Object.keys(H).length === 0;
3201
+ }, h = async (H) => {
3202
+ if (H.preventDefault(), !!I()) {
3203
+ if (!(M != null && M.id)) {
3204
+ z("Tenant not found");
3203
3205
  return;
3204
3206
  }
3205
- u(!0), m(""), $("");
3207
+ u(!0), z(""), p("");
3206
3208
  try {
3207
- await q({ email: y, tenantId: P.id }), $(E.successMessage), s == null || s();
3208
- } catch (z) {
3209
- const V = z.message || E.errorMessage;
3210
- m(V), o == null || o(V);
3209
+ await C({ email: m, tenantId: M.id }), p(F.successMessage), s == null || s();
3210
+ } catch (U) {
3211
+ const V = U.message || F.errorMessage;
3212
+ z(V), o == null || o(V);
3211
3213
  } finally {
3212
3214
  u(!1);
3213
3215
  }
3214
3216
  }
3215
- }, g = async (N) => {
3216
- if (N.preventDefault(), !!v()) {
3217
+ }, d = async (H) => {
3218
+ if (H.preventDefault(), !!T()) {
3217
3219
  if (A !== D) {
3218
- m(E.passwordMismatchError), T({ confirmPassword: !0 });
3220
+ z(F.passwordMismatchError), v({ confirmPassword: !0 });
3219
3221
  return;
3220
3222
  }
3221
- u(!0), m(""), $("");
3223
+ u(!0), z(""), p("");
3222
3224
  try {
3223
- await S({ token: b, newPassword: A }), $(E.resetSuccessMessage), s == null || s();
3224
- } catch (z) {
3225
- const V = z.message || E.errorMessage;
3226
- m(V), o == null || o(V);
3225
+ await x({ token: b, newPassword: A }), p(F.resetSuccessMessage), s == null || s();
3226
+ } catch (U) {
3227
+ const V = U.message || F.errorMessage;
3228
+ z(V), o == null || o(V);
3227
3229
  } finally {
3228
3230
  u(!1);
3229
3231
  }
3230
3232
  }
3231
- }, c = (N) => ({
3232
- ...d.input,
3233
- ...C[N] ? d.inputError : {}
3234
- }), j = () => ({
3235
- ...d.button,
3236
- ...M ? d.buttonLoading : {}
3233
+ }, y = (H) => ({
3234
+ ...c.input,
3235
+ ...O[H] ? c.inputError : {}
3236
+ }), G = () => ({
3237
+ ...c.button,
3238
+ ...P ? c.buttonLoading : {}
3237
3239
  });
3238
3240
  if (t === "reset") {
3239
- const N = b && A && D;
3240
- return /* @__PURE__ */ l("div", { className: w, style: d.container, children: [
3241
- /* @__PURE__ */ n("h2", { style: d.title, children: E.resetTitle }),
3242
- /* @__PURE__ */ n("p", { style: d.subtitle, children: E.resetSubtitle }),
3243
- /* @__PURE__ */ l("form", { onSubmit: g, style: d.form, children: [
3244
- /* @__PURE__ */ l("div", { style: d.fieldGroup, children: [
3245
- /* @__PURE__ */ n("label", { style: d.label, children: E.tokenLabel }),
3241
+ const H = b && A && D;
3242
+ return /* @__PURE__ */ l("div", { className: w, style: c.container, children: [
3243
+ /* @__PURE__ */ n("h2", { style: c.title, children: F.resetTitle }),
3244
+ /* @__PURE__ */ n("p", { style: c.subtitle, children: F.resetSubtitle }),
3245
+ /* @__PURE__ */ l("form", { onSubmit: d, style: c.form, children: [
3246
+ /* @__PURE__ */ l("div", { style: c.fieldGroup, children: [
3247
+ /* @__PURE__ */ n("label", { style: c.label, children: F.tokenLabel }),
3246
3248
  /* @__PURE__ */ n(
3247
3249
  "input",
3248
3250
  {
3249
3251
  type: "text",
3250
3252
  value: b,
3251
- onChange: (z) => {
3252
- f(z.target.value), C.token && T((V) => ({ ...V, token: !1 }));
3253
+ onChange: (U) => {
3254
+ f(U.target.value), O.token && v((V) => ({ ...V, token: !1 }));
3253
3255
  },
3254
- placeholder: E.tokenPlaceholder,
3255
- style: c("token"),
3256
- disabled: M
3256
+ placeholder: F.tokenPlaceholder,
3257
+ style: y("token"),
3258
+ disabled: P
3257
3259
  }
3258
3260
  )
3259
3261
  ] }),
3260
- /* @__PURE__ */ l("div", { style: d.fieldGroup, children: [
3261
- /* @__PURE__ */ n("label", { style: d.label, children: E.newPasswordLabel }),
3262
+ /* @__PURE__ */ l("div", { style: c.fieldGroup, children: [
3263
+ /* @__PURE__ */ n("label", { style: c.label, children: F.newPasswordLabel }),
3262
3264
  /* @__PURE__ */ n(
3263
3265
  "input",
3264
3266
  {
3265
3267
  type: "password",
3266
3268
  value: A,
3267
- onChange: (z) => {
3268
- L(z.target.value), C.newPassword && T((V) => ({ ...V, newPassword: !1 }));
3269
+ onChange: (U) => {
3270
+ L(U.target.value), O.newPassword && v((V) => ({ ...V, newPassword: !1 }));
3269
3271
  },
3270
- placeholder: E.newPasswordPlaceholder,
3271
- style: c("newPassword"),
3272
- disabled: M
3272
+ placeholder: F.newPasswordPlaceholder,
3273
+ style: y("newPassword"),
3274
+ disabled: P
3273
3275
  }
3274
3276
  )
3275
3277
  ] }),
3276
- /* @__PURE__ */ l("div", { style: d.fieldGroup, children: [
3277
- /* @__PURE__ */ n("label", { style: d.label, children: E.confirmPasswordLabel }),
3278
+ /* @__PURE__ */ l("div", { style: c.fieldGroup, children: [
3279
+ /* @__PURE__ */ n("label", { style: c.label, children: F.confirmPasswordLabel }),
3278
3280
  /* @__PURE__ */ n(
3279
3281
  "input",
3280
3282
  {
3281
3283
  type: "password",
3282
3284
  value: D,
3283
- onChange: (z) => {
3284
- I(z.target.value), C.confirmPassword && T((V) => ({ ...V, confirmPassword: !1 })), R === E.passwordMismatchError && m("");
3285
+ onChange: (U) => {
3286
+ R(U.target.value), O.confirmPassword && v((V) => ({ ...V, confirmPassword: !1 })), N === F.passwordMismatchError && z("");
3285
3287
  },
3286
- placeholder: E.confirmPasswordPlaceholder,
3287
- style: c("confirmPassword"),
3288
- disabled: M
3288
+ placeholder: F.confirmPasswordPlaceholder,
3289
+ style: y("confirmPassword"),
3290
+ disabled: P
3289
3291
  }
3290
3292
  )
3291
3293
  ] }),
@@ -3293,44 +3295,44 @@ function tr({
3293
3295
  "button",
3294
3296
  {
3295
3297
  type: "submit",
3296
- disabled: !N || M,
3298
+ disabled: !H || P,
3297
3299
  style: {
3298
- ...j(),
3299
- ...!N || M ? d.buttonDisabled : {}
3300
+ ...G(),
3301
+ ...!H || P ? c.buttonDisabled : {}
3300
3302
  },
3301
- children: M ? E.resetLoadingText : E.resetSubmitButton
3303
+ children: P ? F.resetLoadingText : F.resetSubmitButton
3302
3304
  }
3303
3305
  ),
3304
- R && /* @__PURE__ */ n("div", { style: d.errorText, children: R }),
3305
- H && /* @__PURE__ */ n("div", { style: d.successText, children: H })
3306
+ N && /* @__PURE__ */ n("div", { style: c.errorText, children: N }),
3307
+ E && /* @__PURE__ */ n("div", { style: c.successText, children: E })
3306
3308
  ] }),
3307
- /* @__PURE__ */ l("div", { style: d.linkContainer, children: [
3308
- /* @__PURE__ */ n("a", { onClick: a, style: d.link, children: E.backToLoginLink }),
3309
- p && /* @__PURE__ */ l(W, { children: [
3309
+ /* @__PURE__ */ l("div", { style: c.linkContainer, children: [
3310
+ /* @__PURE__ */ n("a", { onClick: a, style: c.link, children: F.backToLoginLink }),
3311
+ g && /* @__PURE__ */ l(j, { children: [
3310
3312
  /* @__PURE__ */ n("span", { style: { margin: "0 0.5rem", color: "#6b7280" }, children: "•" }),
3311
- /* @__PURE__ */ n("a", { onClick: () => p("request"), style: d.link, children: "Request New Link" })
3313
+ /* @__PURE__ */ n("a", { onClick: () => g("request"), style: c.link, children: "Request New Link" })
3312
3314
  ] })
3313
3315
  ] })
3314
3316
  ] });
3315
3317
  }
3316
- const K = y;
3317
- return /* @__PURE__ */ l("div", { className: w, style: d.container, children: [
3318
- /* @__PURE__ */ n("h2", { style: d.title, children: E.title }),
3319
- /* @__PURE__ */ n("p", { style: d.subtitle, children: E.subtitle }),
3320
- /* @__PURE__ */ l("form", { onSubmit: h, style: d.form, children: [
3321
- /* @__PURE__ */ l("div", { style: d.fieldGroup, children: [
3322
- /* @__PURE__ */ n("label", { style: d.label, children: E.emailLabel }),
3318
+ const $ = m;
3319
+ return /* @__PURE__ */ l("div", { className: w, style: c.container, children: [
3320
+ /* @__PURE__ */ n("h2", { style: c.title, children: F.title }),
3321
+ /* @__PURE__ */ n("p", { style: c.subtitle, children: F.subtitle }),
3322
+ /* @__PURE__ */ l("form", { onSubmit: h, style: c.form, children: [
3323
+ /* @__PURE__ */ l("div", { style: c.fieldGroup, children: [
3324
+ /* @__PURE__ */ n("label", { style: c.label, children: F.emailLabel }),
3323
3325
  /* @__PURE__ */ n(
3324
3326
  "input",
3325
3327
  {
3326
3328
  type: "email",
3327
- value: y,
3328
- onChange: (N) => {
3329
- x(N.target.value), C.email && T((z) => ({ ...z, email: !1 }));
3329
+ value: m,
3330
+ onChange: (H) => {
3331
+ k(H.target.value), O.email && v((U) => ({ ...U, email: !1 }));
3330
3332
  },
3331
- placeholder: E.emailPlaceholder,
3332
- style: c("email"),
3333
- disabled: M
3333
+ placeholder: F.emailPlaceholder,
3334
+ style: y("email"),
3335
+ disabled: P
3334
3336
  }
3335
3337
  )
3336
3338
  ] }),
@@ -3338,27 +3340,27 @@ function tr({
3338
3340
  "button",
3339
3341
  {
3340
3342
  type: "submit",
3341
- disabled: !K || M,
3343
+ disabled: !$ || P,
3342
3344
  style: {
3343
- ...j(),
3344
- ...!K || M ? d.buttonDisabled : {}
3345
+ ...G(),
3346
+ ...!$ || P ? c.buttonDisabled : {}
3345
3347
  },
3346
- children: M ? E.loadingText : E.submitButton
3348
+ children: P ? F.loadingText : F.submitButton
3347
3349
  }
3348
3350
  ),
3349
- R && /* @__PURE__ */ n("div", { style: d.errorText, children: R }),
3350
- H && /* @__PURE__ */ n("div", { style: d.successText, children: H })
3351
+ N && /* @__PURE__ */ n("div", { style: c.errorText, children: N }),
3352
+ E && /* @__PURE__ */ n("div", { style: c.successText, children: E })
3351
3353
  ] }),
3352
- /* @__PURE__ */ l("div", { style: d.linkContainer, children: [
3353
- /* @__PURE__ */ n("a", { onClick: a, style: d.link, children: E.backToLoginLink }),
3354
- p && /* @__PURE__ */ l(W, { children: [
3354
+ /* @__PURE__ */ l("div", { style: c.linkContainer, children: [
3355
+ /* @__PURE__ */ n("a", { onClick: a, style: c.link, children: F.backToLoginLink }),
3356
+ g && /* @__PURE__ */ l(j, { children: [
3355
3357
  /* @__PURE__ */ n("span", { style: { margin: "0 0.5rem", color: "#6b7280" }, children: "•" }),
3356
- /* @__PURE__ */ n("a", { onClick: () => p("reset"), style: d.link, children: "I have a token" })
3358
+ /* @__PURE__ */ n("a", { onClick: () => g("reset"), style: c.link, children: "I have a token" })
3357
3359
  ] })
3358
3360
  ] })
3359
3361
  ] });
3360
3362
  }
3361
- const Rt = () => /* @__PURE__ */ n(
3363
+ const Et = () => /* @__PURE__ */ n(
3362
3364
  "div",
3363
3365
  {
3364
3366
  style: {
@@ -3370,7 +3372,7 @@ const Rt = () => /* @__PURE__ */ n(
3370
3372
  },
3371
3373
  children: /* @__PURE__ */ n("div", { children: "Loading..." })
3372
3374
  }
3373
- ), Lt = ({ error: i, retry: e }) => /* @__PURE__ */ l(
3375
+ ), Ft = ({ error: i, retry: e }) => /* @__PURE__ */ l(
3374
3376
  "div",
3375
3377
  {
3376
3378
  style: {
@@ -3404,43 +3406,43 @@ const Rt = () => /* @__PURE__ */ n(
3404
3406
  ]
3405
3407
  }
3406
3408
  );
3407
- function rr({
3409
+ function sr({
3408
3410
  children: i,
3409
3411
  loadingFallback: e,
3410
3412
  errorFallback: t,
3411
3413
  requireTenant: r = !0
3412
3414
  }) {
3413
- const { isAppLoading: s, appError: o, retryApp: a } = he(), p = ye(), w = Fe(), y = Ce(), x = De(), b = (p == null ? void 0 : p.isTenantLoading) ?? !1, f = (p == null ? void 0 : p.tenantError) ?? null, A = (p == null ? void 0 : p.tenantSlug) ?? null, L = (p == null ? void 0 : p.retryTenant) ?? (() => {
3414
- }), D = (w == null ? void 0 : w.isAuthReady) ?? !0, I = (y == null ? void 0 : y.isReady) ?? !0, M = (x == null ? void 0 : x.isReady) ?? !0, u = r && p && A, $ = s || u && b || w && !D || y && !I || x && !M, C = o || (u ? f : null), T = () => {
3415
- o && a(), f && p && L();
3415
+ const { isAppLoading: s, appError: o, retryApp: a } = he(), g = ye(), w = Fe(), m = Ce(), k = De(), b = (g == null ? void 0 : g.isTenantLoading) ?? !1, f = (g == null ? void 0 : g.tenantError) ?? null, A = (g == null ? void 0 : g.tenantSlug) ?? null, L = (g == null ? void 0 : g.retryTenant) ?? (() => {
3416
+ }), D = (w == null ? void 0 : w.isAuthReady) ?? !0, R = (m == null ? void 0 : m.isReady) ?? !0, P = (k == null ? void 0 : k.isReady) ?? !0, u = r && g && A, p = s || u && b || w && !D || m && !R || k && !P, O = o || (u ? f : null), v = () => {
3417
+ o && a(), f && g && L();
3416
3418
  };
3417
- if ($)
3418
- return /* @__PURE__ */ n(W, { children: e || /* @__PURE__ */ n(Rt, {}) });
3419
- if (C) {
3420
- const q = typeof t == "function" ? t(C, T) : t || /* @__PURE__ */ n(Lt, { error: C, retry: T });
3421
- return /* @__PURE__ */ n(W, { children: q });
3419
+ if (p)
3420
+ return /* @__PURE__ */ n(j, { children: e || /* @__PURE__ */ n(Et, {}) });
3421
+ if (O) {
3422
+ const C = typeof t == "function" ? t(O, v) : t || /* @__PURE__ */ n(Ft, { error: O, retry: v });
3423
+ return /* @__PURE__ */ n(j, { children: C });
3422
3424
  }
3423
- return /* @__PURE__ */ n(W, { children: i });
3425
+ return /* @__PURE__ */ n(j, { children: i });
3424
3426
  }
3425
- function nr(i = !0) {
3426
- const { isAppLoading: e, appError: t, retryApp: r, appInfo: s } = he(), o = ye(), a = Fe(), p = Ce(), w = De(), y = (o == null ? void 0 : o.isTenantLoading) ?? !1, x = (o == null ? void 0 : o.tenantError) ?? null, b = (o == null ? void 0 : o.tenant) ?? null, f = (o == null ? void 0 : o.tenantSlug) ?? null, A = (o == null ? void 0 : o.retryTenant) ?? (() => {
3427
- }), L = (a == null ? void 0 : a.isAuthReady) ?? !0, D = (p == null ? void 0 : p.isReady) ?? !0, I = (w == null ? void 0 : w.isReady) ?? !0, M = i && o && f, H = e || M && y || a && !L || p && !D || w && !I, $ = t || (M ? x : null);
3427
+ function ir(i = !0) {
3428
+ const { isAppLoading: e, appError: t, retryApp: r, appInfo: s } = he(), o = ye(), a = Fe(), g = Ce(), w = De(), m = (o == null ? void 0 : o.isTenantLoading) ?? !1, k = (o == null ? void 0 : o.tenantError) ?? null, b = (o == null ? void 0 : o.tenant) ?? null, f = (o == null ? void 0 : o.tenantSlug) ?? null, A = (o == null ? void 0 : o.retryTenant) ?? (() => {
3429
+ }), L = (a == null ? void 0 : a.isAuthReady) ?? !0, D = (g == null ? void 0 : g.isReady) ?? !0, R = (w == null ? void 0 : w.isReady) ?? !0, P = i && o && f, E = e || P && m || a && !L || g && !D || w && !R, p = t || (P ? k : null);
3428
3430
  return {
3429
- isLoading: H,
3430
- error: $,
3431
- isReady: !H && !$ && s !== null && (!M || b !== null),
3431
+ isLoading: E,
3432
+ error: p,
3433
+ isReady: !E && !p && s !== null && (!P || b !== null),
3432
3434
  retry: () => {
3433
- t && r(), x && o && A();
3435
+ t && r(), k && o && A();
3434
3436
  },
3435
3437
  // Individual states
3436
3438
  app: { isLoading: e, error: t, data: s },
3437
- tenant: o ? { isLoading: y, error: x, data: b } : null,
3439
+ tenant: o ? { isLoading: m, error: k, data: b } : null,
3438
3440
  auth: a ? { isReady: L } : null,
3439
- featureFlags: p ? { isReady: D } : null,
3440
- subscription: w ? { isReady: I } : null
3441
+ featureFlags: g ? { isReady: D } : null,
3442
+ subscription: w ? { isReady: R } : null
3441
3443
  };
3442
3444
  }
3443
- class sr {
3445
+ class or {
3444
3446
  constructor(e, t) {
3445
3447
  this.httpService = e, this.sessionManager = t;
3446
3448
  }
@@ -3508,7 +3510,7 @@ class sr {
3508
3510
  };
3509
3511
  }
3510
3512
  }
3511
- class ir {
3513
+ class ar {
3512
3514
  constructor(e, t) {
3513
3515
  this.httpService = e, this.sessionManager = t;
3514
3516
  }
@@ -3559,7 +3561,7 @@ class ir {
3559
3561
  });
3560
3562
  }
3561
3563
  }
3562
- class or {
3564
+ class lr {
3563
3565
  constructor(e) {
3564
3566
  this.httpService = e;
3565
3567
  }
@@ -3568,7 +3570,7 @@ class or {
3568
3570
  return await this.httpService.get("/health");
3569
3571
  }
3570
3572
  }
3571
- class ar {
3573
+ class cr {
3572
3574
  // Date string to Date object
3573
3575
  static toDate(e) {
3574
3576
  return new Date(e);
@@ -3691,47 +3693,47 @@ class ar {
3691
3693
  }
3692
3694
  }
3693
3695
  export {
3694
- ar as ApiMappers,
3696
+ cr as ApiMappers,
3695
3697
  Pe as AppApiService,
3696
- rr as AppLoader,
3697
- Nt as AppProvider,
3698
- _e as AuthApiService,
3699
- Ot as AuthProvider,
3700
- Yt as FeatureFlag,
3701
- rt as FeatureFlagApiService,
3702
- Wt as FeatureFlagProvider,
3703
- or as HealthApiService,
3698
+ sr as AppLoader,
3699
+ Bt as AppProvider,
3700
+ Ke as AuthApiService,
3701
+ jt as AuthProvider,
3702
+ Xt as FeatureFlag,
3703
+ st as FeatureFlagApiService,
3704
+ Vt as FeatureFlagProvider,
3705
+ lr as HealthApiService,
3704
3706
  re as HttpService,
3705
- Kt as LandingRoute,
3706
- Qt as LoginForm,
3707
- Zt as MagicLinkForm,
3708
- er as MagicLinkVerify,
3709
- tr as PasswordRecoveryForm,
3710
- sr as PermissionApiService,
3711
- Vt as Protected,
3712
- _t as ProtectedRoute,
3707
+ Yt as LandingRoute,
3708
+ Zt as LoginForm,
3709
+ tr as MagicLinkForm,
3710
+ rr as MagicLinkVerify,
3711
+ nr as PasswordRecoveryForm,
3712
+ or as PermissionApiService,
3713
+ Gt as Protected,
3714
+ Kt as ProtectedRoute,
3713
3715
  Me as RoleApiService,
3714
3716
  be as SessionManager,
3715
- Xt as SignupForm,
3716
- st as SubscriptionApiService,
3717
- Jt as SubscriptionGuard,
3718
- ir as SubscriptionPlanApiService,
3719
- jt as SubscriptionProvider,
3717
+ er as SignupForm,
3718
+ ot as SubscriptionApiService,
3719
+ Qt as SubscriptionGuard,
3720
+ ar as SubscriptionPlanApiService,
3721
+ _t as SubscriptionProvider,
3720
3722
  de as TenantApiService,
3721
- Bt as TenantProvider,
3722
- Gt as TenantRoute,
3723
- Ge as UserApiService,
3723
+ zt as TenantProvider,
3724
+ Jt as TenantRoute,
3725
+ Je as UserApiService,
3724
3726
  ie as UserType,
3725
- Ut as useApi,
3727
+ qt as useApi,
3726
3728
  he as useApp,
3727
- nr as useAppLoaderState,
3729
+ ir as useAppLoaderState,
3728
3730
  oe as useAuth,
3729
- nt as useFeatureFlags,
3730
- zt as useSettings,
3731
- it as useSubscription,
3731
+ it as useFeatureFlags,
3732
+ Wt as useSettings,
3733
+ at as useSubscription,
3732
3734
  me as useTenant,
3733
3735
  le as useTenantInfo,
3734
3736
  ye as useTenantOptional,
3735
- qt as useTenantSettings
3737
+ Ot as useTenantSettings
3736
3738
  };
3737
3739
  //# sourceMappingURL=index.es.js.map