@ciscode/ui-authentication-kit 1.0.4 → 1.0.5

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.mjs CHANGED
@@ -1,26 +1,26 @@
1
1
  import * as U from "react";
2
- import e, { createContext as pe, useContext as be, useEffect as R, forwardRef as le, createElement as q, useState as u, useMemo as Y } from "react";
3
- import _ from "axios";
4
- import { jwtDecode as we } from "jwt-decode";
5
- import ye from "react-dom";
6
- import { useT as H } from "@ciscode/ui-translate-core";
7
- import { useNavigate as te, useLocation as ae, Routes as Ee, Route as Z, Navigate as O } from "react-router";
8
- const ne = e.createContext(null);
9
- function se() {
10
- const t = e.useContext(ne);
2
+ import e, { createContext as ve, useContext as Me, useEffect as V, forwardRef as ie, createElement as ae, useState as m, useMemo as X } from "react";
3
+ import le from "axios";
4
+ import { jwtDecode as ke } from "jwt-decode";
5
+ import Ie from "react-dom";
6
+ import { useT as q } from "@ciscode/ui-translate-core";
7
+ import { useNavigate as se, useLocation as oe, Routes as Le, Route as Y, Navigate as J } from "react-router";
8
+ const me = e.createContext(null);
9
+ function de() {
10
+ const t = e.useContext(me);
11
11
  if (!t)
12
12
  throw new Error("useAuthConfig must be used within an AuthConfigProvider");
13
13
  return t;
14
14
  }
15
- const oe = pe(null);
15
+ const ue = ve(null);
16
16
  function z() {
17
- const t = be(oe);
17
+ const t = Me(ue);
18
18
  if (!t)
19
19
  throw new Error("useAuthState must be inside <AuthProvider>");
20
20
  return t;
21
21
  }
22
- function J(t) {
23
- const a = we(t);
22
+ function te(t) {
23
+ const a = ke(t);
24
24
  return {
25
25
  id: a.sub,
26
26
  email: a.email ?? "",
@@ -30,54 +30,54 @@ function J(t) {
30
30
  tenantId: a.tenantId ?? ""
31
31
  };
32
32
  }
33
- let K = !1;
34
- function Ne() {
35
- K = !1;
33
+ let re = !1;
34
+ function Ce() {
35
+ re = !1;
36
36
  }
37
- function ve(t, a) {
37
+ function je(t, a) {
38
38
  t.defaults.withCredentials = !0;
39
- const l = `${a.baseUrl}${a.refreshEndpoint ?? "/auth/refresh-token"}`;
39
+ const r = `${a.baseUrl}${a.refreshEndpoint ?? "/auth/refresh-token"}`;
40
40
  t.interceptors.request.use((n) => {
41
41
  const o = a.getAccessToken();
42
42
  return o && (n.headers.Authorization = `Bearer ${o}`), n;
43
43
  });
44
- let r = !1, s = [];
44
+ let l = !1, s = [];
45
45
  return t.interceptors.response.use(
46
46
  (n) => n,
47
47
  async (n) => {
48
- var c;
48
+ var i;
49
49
  const o = n.config;
50
- if (((c = n.response) == null ? void 0 : c.status) !== 401 || !o || o._retry)
50
+ if (((i = n.response) == null ? void 0 : i.status) !== 401 || !o || o._retry)
51
51
  return Promise.reject(n);
52
- if (o._retry = !0, !r) {
53
- r = !0;
52
+ if (o._retry = !0, !l) {
53
+ l = !0;
54
54
  try {
55
- const { data: i } = await _.post(l, {}, { withCredentials: !0 });
56
- return a.setAccessToken(i.accessToken), s.forEach((m) => m(i.accessToken)), s = [], t.request(o);
57
- } catch (i) {
58
- return !!a.getAccessToken() && !K && (K = !0, a.logout()), s.forEach((p) => p(null)), s = [], Promise.reject(i);
55
+ const { data: c } = await le.post(r, {}, { withCredentials: !0 });
56
+ return a.setAccessToken(c.accessToken), s.forEach((d) => d(c.accessToken)), s = [], t.request(o);
57
+ } catch (c) {
58
+ return !!a.getAccessToken() && !re && (re = !0, a.logout()), s.forEach((p) => p(null)), s = [], Promise.reject(c);
59
59
  } finally {
60
- r = !1;
60
+ l = !1;
61
61
  }
62
62
  }
63
- return new Promise((i, m) => {
63
+ return new Promise((c, d) => {
64
64
  s.push((p) => {
65
65
  if (!p)
66
- return m(n);
67
- (o.headers ?? (o.headers = {})).Authorization = `Bearer ${p}`, i(t.request(o));
66
+ return d(n);
67
+ (o.headers ?? (o.headers = {})).Authorization = `Bearer ${p}`, c(t.request(o));
68
68
  });
69
69
  });
70
70
  }
71
71
  ), t;
72
72
  }
73
- const Me = ({ onConfirm: t }) => {
74
- const a = H("authLib");
75
- return R(() => {
76
- const { body: l } = document, r = l.style.overflow, s = l.style.pointerEvents;
77
- return l.style.overflow = "hidden", l.style.pointerEvents = "none", () => {
78
- l.style.overflow = r, l.style.pointerEvents = s;
73
+ const Se = ({ onConfirm: t }) => {
74
+ const a = q("authLib");
75
+ return V(() => {
76
+ const { body: r } = document, l = r.style.overflow, s = r.style.pointerEvents;
77
+ return r.style.overflow = "hidden", r.style.pointerEvents = "none", () => {
78
+ r.style.overflow = l, r.style.pointerEvents = s;
79
79
  };
80
- }, []), ye.createPortal(
80
+ }, []), Ie.createPortal(
81
81
  /* @__PURE__ */ e.createElement("div", { className: "fixed inset-0 z-[9999] flex items-center justify-center bg-black/40 backdrop-blur-sm" }, /* @__PURE__ */ e.createElement("div", { className: "pointer-events-auto w-full max-w-sm rounded-xl bg-white p-6 shadow-xl" }, /* @__PURE__ */ e.createElement("h2", { className: "mb-4 text-xl font-semibold text-gray-800 ltr:text-left rtl:text-center" }, a("sessionExpired.title")), /* @__PURE__ */ e.createElement("p", { className: "mb-8 text-sm text-gray-600 ltr:text-left rtl:text-center" }, a("sessionExpired.message")), /* @__PURE__ */ e.createElement("div", { className: "flex justify-end" }, /* @__PURE__ */ e.createElement(
82
82
  "button",
83
83
  {
@@ -92,11 +92,11 @@ const Me = ({ onConfirm: t }) => {
92
92
  )))),
93
93
  document.body
94
94
  );
95
- }, G = ({
95
+ }, P = ({
96
96
  label: t,
97
97
  type: a = "text",
98
- placeholder: l,
99
- color: r = "",
98
+ placeholder: r,
99
+ color: l = "",
100
100
  value: s,
101
101
  onChange: n
102
102
  }) => {
@@ -113,17 +113,17 @@ const Me = ({ onConfirm: t }) => {
113
113
  {
114
114
  id: o,
115
115
  type: a,
116
- placeholder: l || void 0,
116
+ placeholder: r || void 0,
117
117
  value: s,
118
- onChange: (c) => n == null ? void 0 : n(c.target.value),
118
+ onChange: (i) => n == null ? void 0 : n(i.target.value),
119
119
  className: `
120
120
  px-4 py-4 mt-3.5 text-sm font-light rounded-lg border border-solid w-full
121
121
  ltr:text-left rtl:text-right
122
- ${r}
122
+ ${l}
123
123
  `
124
124
  }
125
125
  ));
126
- }, ie = ({ icon: t, label: a }) => /* @__PURE__ */ U.createElement("div", { className: "flex gap-5 px-8 py-3 items-center bg-indigo-50 rounded-lg max-md:px-5" }, /* @__PURE__ */ U.createElement(
126
+ }, ge = ({ icon: t, label: a }) => /* @__PURE__ */ U.createElement("div", { className: "flex gap-5 px-8 py-3 items-center bg-indigo-50 rounded-lg max-md:px-5" }, /* @__PURE__ */ U.createElement(
127
127
  "img",
128
128
  {
129
129
  loading: "lazy",
@@ -131,18 +131,18 @@ const Me = ({ onConfirm: t }) => {
131
131
  alt: a || "",
132
132
  className: "object-contain shrink-0 aspect-square w-[26px]"
133
133
  }
134
- ), a && /* @__PURE__ */ U.createElement("div", { className: "basis-auto text-sm hidden md:block ltr:text-left rtl:text-right" }, a)), ce = "data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz48IS0tIFVwbG9hZGVkIHRvOiBTVkcgUmVwbywgd3d3LnN2Z3JlcG8uY29tLCBHZW5lcmF0b3I6IFNWRyBSZXBvIE1peGVyIFRvb2xzIC0tPgo8c3ZnIHdpZHRoPSI4MDBweCIgaGVpZ2h0PSI4MDBweCIgdmlld0JveD0iLTMgMCAyNjIgMjYyIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHByZXNlcnZlQXNwZWN0UmF0aW89InhNaWRZTWlkIj48cGF0aCBkPSJNMjU1Ljg3OCAxMzMuNDUxYzAtMTAuNzM0LS44NzEtMTguNTY3LTIuNzU2LTI2LjY5SDEzMC41NXY0OC40NDhoNzEuOTQ3Yy0xLjQ1IDEyLjA0LTkuMjgzIDMwLjE3Mi0yNi42OSA0Mi4zNTZsLS4yNDQgMS42MjIgMzguNzU1IDMwLjAyMyAyLjY4NS4yNjhjMjQuNjU5LTIyLjc3NCAzOC44NzUtNTYuMjgyIDM4Ljg3NS05Ni4wMjciIGZpbGw9IiM0Mjg1RjQiLz48cGF0aCBkPSJNMTMwLjU1IDI2MS4xYzM1LjI0OCAwIDY0LjgzOS0xMS42MDUgODYuNDUzLTMxLjYyMmwtNDEuMTk2LTMxLjkxM2MtMTEuMDI0IDcuNjg4LTI1LjgyIDEzLjA1NS00NS4yNTcgMTMuMDU1LTM0LjUyMyAwLTYzLjgyNC0yMi43NzMtNzQuMjY5LTU0LjI1bC0xLjUzMS4xMy00MC4yOTggMzEuMTg3LS41MjcgMS40NjVDMzUuMzkzIDIzMS43OTggNzkuNDkgMjYxLjEgMTMwLjU1IDI2MS4xIiBmaWxsPSIjMzRBODUzIi8+PHBhdGggZD0iTTU2LjI4MSAxNTYuMzdjLTIuNzU2LTguMTIzLTQuMzUxLTE2LjgyNy00LjM1MS0yNS44MiAwLTguOTk0IDEuNTk1LTE3LjY5NyA0LjIwNi0yNS44MmwtLjA3My0xLjczTDE1LjI2IDcxLjMxMmwtMS4zMzUuNjM1QzUuMDc3IDg5LjY0NCAwIDEwOS41MTcgMCAxMzAuNTVzNS4wNzcgNDAuOTA1IDEzLjkyNSA1OC42MDJsNDIuMzU2LTMyLjc4MiIgZmlsbD0iI0ZCQkMwNSIvPjxwYXRoIGQ9Ik0xMzAuNTUgNTAuNDc5YzI0LjUxNCAwIDQxLjA1IDEwLjU4OSA1MC40NzkgMTkuNDM4bDM2Ljg0NC0zNS45NzRDMTk1LjI0NSAxMi45MSAxNjUuNzk4IDAgMTMwLjU1IDAgNzkuNDkgMCAzNS4zOTMgMjkuMzAxIDEzLjkyNSA3MS45NDdsNDIuMjExIDMyLjc4M2MxMC41OS0zMS40NzcgMzkuODkxLTU0LjI1MSA3NC40MTQtNTQuMjUxIiBmaWxsPSIjRUI0MzM1Ii8+PC9zdmc+", me = "data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz48IS0tIFVwbG9hZGVkIHRvOiBTVkcgUmVwbywgd3d3LnN2Z3JlcG8uY29tLCBHZW5lcmF0b3I6IFNWRyBSZXBvIE1peGVyIFRvb2xzIC0tPgo8c3ZnIHdpZHRoPSI4MDBweCIgaGVpZ2h0PSI4MDBweCIgdmlld0JveD0iMCAwIDE2IDE2IiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGZpbGw9Im5vbmUiPjxwYXRoIGZpbGw9IiNGMzUzMjUiIGQ9Ik0xIDFoNi41djYuNUgxVjF6Ii8+PHBhdGggZmlsbD0iIzgxQkMwNiIgZD0iTTguNSAxSDE1djYuNUg4LjVWMXoiLz48cGF0aCBmaWxsPSIjMDVBNkYwIiBkPSJNMSA4LjVoNi41VjE1SDFWOC41eiIvPjxwYXRoIGZpbGw9IiNGRkJBMDgiIGQ9Ik04LjUgOC41SDE1VjE1SDguNVY4LjV6Ii8+PC9zdmc+";
135
- function F(t, a, l) {
136
- return t ? t.startsWith(`${a}-`) ? t : t.startsWith("#") ? `${t}` : l : l;
134
+ ), a && /* @__PURE__ */ U.createElement("div", { className: "basis-auto text-sm hidden md:block ltr:text-left rtl:text-right" }, a)), fe = "data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz48IS0tIFVwbG9hZGVkIHRvOiBTVkcgUmVwbywgd3d3LnN2Z3JlcG8uY29tLCBHZW5lcmF0b3I6IFNWRyBSZXBvIE1peGVyIFRvb2xzIC0tPgo8c3ZnIHdpZHRoPSI4MDBweCIgaGVpZ2h0PSI4MDBweCIgdmlld0JveD0iLTMgMCAyNjIgMjYyIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHByZXNlcnZlQXNwZWN0UmF0aW89InhNaWRZTWlkIj48cGF0aCBkPSJNMjU1Ljg3OCAxMzMuNDUxYzAtMTAuNzM0LS44NzEtMTguNTY3LTIuNzU2LTI2LjY5SDEzMC41NXY0OC40NDhoNzEuOTQ3Yy0xLjQ1IDEyLjA0LTkuMjgzIDMwLjE3Mi0yNi42OSA0Mi4zNTZsLS4yNDQgMS42MjIgMzguNzU1IDMwLjAyMyAyLjY4NS4yNjhjMjQuNjU5LTIyLjc3NCAzOC44NzUtNTYuMjgyIDM4Ljg3NS05Ni4wMjciIGZpbGw9IiM0Mjg1RjQiLz48cGF0aCBkPSJNMTMwLjU1IDI2MS4xYzM1LjI0OCAwIDY0LjgzOS0xMS42MDUgODYuNDUzLTMxLjYyMmwtNDEuMTk2LTMxLjkxM2MtMTEuMDI0IDcuNjg4LTI1LjgyIDEzLjA1NS00NS4yNTcgMTMuMDU1LTM0LjUyMyAwLTYzLjgyNC0yMi43NzMtNzQuMjY5LTU0LjI1bC0xLjUzMS4xMy00MC4yOTggMzEuMTg3LS41MjcgMS40NjVDMzUuMzkzIDIzMS43OTggNzkuNDkgMjYxLjEgMTMwLjU1IDI2MS4xIiBmaWxsPSIjMzRBODUzIi8+PHBhdGggZD0iTTU2LjI4MSAxNTYuMzdjLTIuNzU2LTguMTIzLTQuMzUxLTE2LjgyNy00LjM1MS0yNS44MiAwLTguOTk0IDEuNTk1LTE3LjY5NyA0LjIwNi0yNS44MmwtLjA3My0xLjczTDE1LjI2IDcxLjMxMmwtMS4zMzUuNjM1QzUuMDc3IDg5LjY0NCAwIDEwOS41MTcgMCAxMzAuNTVzNS4wNzcgNDAuOTA1IDEzLjkyNSA1OC42MDJsNDIuMzU2LTMyLjc4MiIgZmlsbD0iI0ZCQkMwNSIvPjxwYXRoIGQ9Ik0xMzAuNTUgNTAuNDc5YzI0LjUxNCAwIDQxLjA1IDEwLjU4OSA1MC40NzkgMTkuNDM4bDM2Ljg0NC0zNS45NzRDMTk1LjI0NSAxMi45MSAxNjUuNzk4IDAgMTMwLjU1IDAgNzkuNDkgMCAzNS4zOTMgMjkuMzAxIDEzLjkyNSA3MS45NDdsNDIuMjExIDMyLjc4M2MxMC41OS0zMS40NzcgMzkuODkxLTU0LjI1MSA3NC40MTQtNTQuMjUxIiBmaWxsPSIjRUI0MzM1Ii8+PC9zdmc+", he = "data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz48IS0tIFVwbG9hZGVkIHRvOiBTVkcgUmVwbywgd3d3LnN2Z3JlcG8uY29tLCBHZW5lcmF0b3I6IFNWRyBSZXBvIE1peGVyIFRvb2xzIC0tPgo8c3ZnIHdpZHRoPSI4MDBweCIgaGVpZ2h0PSI4MDBweCIgdmlld0JveD0iMCAwIDE2IDE2IiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGZpbGw9Im5vbmUiPjxwYXRoIGZpbGw9IiNGMzUzMjUiIGQ9Ik0xIDFoNi41djYuNUgxVjF6Ii8+PHBhdGggZmlsbD0iIzgxQkMwNiIgZD0iTTguNSAxSDE1djYuNUg4LjVWMXoiLz48cGF0aCBmaWxsPSIjMDVBNkYwIiBkPSJNMSA4LjVoNi41VjE1SDFWOC41eiIvPjxwYXRoIGZpbGw9IiNGRkJBMDgiIGQ9Ik04LjUgOC41SDE1VjE1SDguNVY4LjV6Ii8+PC9zdmc+";
135
+ function O(t, a, r) {
136
+ return t ? t.startsWith(`${a}-`) ? t : t.startsWith("#") ? `${t}` : r : r;
137
137
  }
138
- function de(t, a) {
139
- const l = (a == null ? void 0 : a.bg) || "bg-sky-500", r = (a == null ? void 0 : a.text) || "text-gray-800", s = (a == null ? void 0 : a.border) || "border-gray-300", n = (a == null ? void 0 : a.fill) || "fill-current", o = (a == null ? void 0 : a.stroke) || "stroke-current";
138
+ function xe(t, a) {
139
+ const r = (a == null ? void 0 : a.bg) || "bg-sky-500", l = (a == null ? void 0 : a.text) || "text-gray-800", s = (a == null ? void 0 : a.border) || "border-gray-300", n = (a == null ? void 0 : a.fill) || "fill-current", o = (a == null ? void 0 : a.stroke) || "stroke-current";
140
140
  return {
141
- bgClass: F(t.bg ?? "", "bg", l),
142
- textClass: F(t.text ?? "", "text", r),
143
- borderClass: F(t.border ?? "", "border", s),
144
- fillClass: F(t.fill ?? "", "fill", n),
145
- strokeClass: F(t.stroke ?? "", "stroke", o)
141
+ bgClass: O(t.bg ?? "", "bg", r),
142
+ textClass: O(t.text ?? "", "text", l),
143
+ borderClass: O(t.border ?? "", "border", s),
144
+ fillClass: O(t.fill ?? "", "fill", n),
145
+ strokeClass: O(t.stroke ?? "", "stroke", o)
146
146
  };
147
147
  }
148
148
  /**
@@ -151,14 +151,14 @@ function de(t, a) {
151
151
  * This source code is licensed under the ISC license.
152
152
  * See the LICENSE file in the root directory of this source tree.
153
153
  */
154
- const Ie = (t) => t.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase(), ue = (...t) => t.filter((a, l, r) => !!a && a.trim() !== "" && r.indexOf(a) === l).join(" ").trim();
154
+ const Te = (t) => t.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase(), pe = (...t) => t.filter((a, r, l) => !!a && a.trim() !== "" && l.indexOf(a) === r).join(" ").trim();
155
155
  /**
156
156
  * @license lucide-react v0.481.0 - ISC
157
157
  *
158
158
  * This source code is licensed under the ISC license.
159
159
  * See the LICENSE file in the root directory of this source tree.
160
160
  */
161
- var ke = {
161
+ var Pe = {
162
162
  xmlns: "http://www.w3.org/2000/svg",
163
163
  width: 24,
164
164
  height: 24,
@@ -175,30 +175,30 @@ var ke = {
175
175
  * This source code is licensed under the ISC license.
176
176
  * See the LICENSE file in the root directory of this source tree.
177
177
  */
178
- const Le = le(
178
+ const Ue = ie(
179
179
  ({
180
180
  color: t = "currentColor",
181
181
  size: a = 24,
182
- strokeWidth: l = 2,
183
- absoluteStrokeWidth: r,
182
+ strokeWidth: r = 2,
183
+ absoluteStrokeWidth: l,
184
184
  className: s = "",
185
185
  children: n,
186
186
  iconNode: o,
187
- ...c
188
- }, i) => q(
187
+ ...i
188
+ }, c) => ae(
189
189
  "svg",
190
190
  {
191
- ref: i,
192
- ...ke,
191
+ ref: c,
192
+ ...Pe,
193
193
  width: a,
194
194
  height: a,
195
195
  stroke: t,
196
- strokeWidth: r ? Number(l) * 24 / Number(a) : l,
197
- className: ue("lucide", s),
198
- ...c
196
+ strokeWidth: l ? Number(r) * 24 / Number(a) : r,
197
+ className: pe("lucide", s),
198
+ ...i
199
199
  },
200
200
  [
201
- ...o.map(([m, p]) => q(m, p)),
201
+ ...o.map(([d, p]) => ae(d, p)),
202
202
  ...Array.isArray(n) ? n : [n]
203
203
  ]
204
204
  )
@@ -209,16 +209,16 @@ const Le = le(
209
209
  * This source code is licensed under the ISC license.
210
210
  * See the LICENSE file in the root directory of this source tree.
211
211
  */
212
- const ge = (t, a) => {
213
- const l = le(
214
- ({ className: r, ...s }, n) => q(Le, {
212
+ const be = (t, a) => {
213
+ const r = ie(
214
+ ({ className: l, ...s }, n) => ae(Ue, {
215
215
  ref: n,
216
216
  iconNode: a,
217
- className: ue(`lucide-${Ie(t)}`, r),
217
+ className: pe(`lucide-${Te(t)}`, l),
218
218
  ...s
219
219
  })
220
220
  );
221
- return l.displayName = `${t}`, l;
221
+ return r.displayName = `${t}`, r;
222
222
  };
223
223
  /**
224
224
  * @license lucide-react v0.481.0 - ISC
@@ -226,7 +226,7 @@ const ge = (t, a) => {
226
226
  * This source code is licensed under the ISC license.
227
227
  * See the LICENSE file in the root directory of this source tree.
228
228
  */
229
- const Ce = [
229
+ const ze = [
230
230
  [
231
231
  "path",
232
232
  {
@@ -236,27 +236,27 @@ const Ce = [
236
236
  ],
237
237
  ["path", { d: "M12 9v4", key: "juzpu7" }],
238
238
  ["path", { d: "M12 17h.01", key: "p32p05" }]
239
- ], je = ge("TriangleAlert", Ce);
239
+ ], De = be("TriangleAlert", ze);
240
240
  /**
241
241
  * @license lucide-react v0.481.0 - ISC
242
242
  *
243
243
  * This source code is licensed under the ISC license.
244
244
  * See the LICENSE file in the root directory of this source tree.
245
245
  */
246
- const Se = [
246
+ const Ae = [
247
247
  ["path", { d: "M18 6 6 18", key: "1bl5f8" }],
248
248
  ["path", { d: "m6 6 12 12", key: "d8bk6v" }]
249
- ], Te = ge("X", Se), fe = ({
249
+ ], Be = be("X", Ae), we = ({
250
250
  message: t,
251
251
  dismissAfterMs: a = 4e3
252
252
  }) => {
253
- const l = H("authLib"), [r, s] = u(!1);
254
- return R(() => {
253
+ const r = q("authLib"), [l, s] = m(!1);
254
+ return V(() => {
255
255
  if (s(!!t), t && a > 0) {
256
256
  const n = window.setTimeout(() => s(!1), a);
257
257
  return () => window.clearTimeout(n);
258
258
  }
259
- }, [t, a]), !r || !t ? null : /* @__PURE__ */ e.createElement(
259
+ }, [t, a]), !l || !t ? null : /* @__PURE__ */ e.createElement(
260
260
  "div",
261
261
  {
262
262
  role: "alert",
@@ -266,81 +266,81 @@ const Se = [
266
266
  rounded-lg border border-red-300 bg-red-50/80 p-4 pr-6 text-sm text-red-800
267
267
  shadow-lg backdrop-blur
268
268
  transition-all duration-300 ease-out
269
- ${r ? "translate-y-0 opacity-100" : "-translate-y-2 opacity-0"}
269
+ ${l ? "translate-y-0 opacity-100" : "-translate-y-2 opacity-0"}
270
270
  `
271
271
  },
272
272
  /* @__PURE__ */ e.createElement("span", { className: "absolute ltr:left-0 rtl:right-0 top-0 h-full w-1 bg-gradient-to-b from-red-500 to-red-400" }),
273
- /* @__PURE__ */ e.createElement(je, { className: "mt-0.5 h-5 w-5 flex-none" }),
273
+ /* @__PURE__ */ e.createElement(De, { className: "mt-0.5 h-5 w-5 flex-none" }),
274
274
  /* @__PURE__ */ e.createElement("span", { className: "grow leading-5 ltr:text-left rtl:text-right" }, t),
275
275
  /* @__PURE__ */ e.createElement(
276
276
  "button",
277
277
  {
278
278
  onClick: () => s(!1),
279
- "aria-label": l("inlineError.dismiss"),
279
+ "aria-label": r("inlineError.dismiss"),
280
280
  className: `
281
281
  absolute ltr:right-2 rtl:left-2 top-2 rounded p-1 text-red-600/70
282
282
  hover:bg-red-100 hover:text-red-700 focus:outline-none
283
283
  focus-visible:ring focus-visible:ring-red-500/50
284
284
  `
285
285
  },
286
- /* @__PURE__ */ e.createElement(Te, { className: "h-4 w-4" })
286
+ /* @__PURE__ */ e.createElement(Be, { className: "h-4 w-4" })
287
287
  )
288
288
  );
289
- }, Pe = () => {
290
- const t = H("authLib"), a = te(), l = ae(), {
291
- brandName: r = t("brandName", { defaultValue: "MyBrand" }),
289
+ }, $e = () => {
290
+ const t = q("authLib"), a = se(), r = oe(), {
291
+ brandName: l = t("brandName", { defaultValue: "MyBrand" }),
292
292
  colors: s = { bg: "bg-sky-500", text: "text-white", border: "border-sky-500" },
293
293
  logoUrl: n,
294
294
  oauthProviders: o = [],
295
- illustrationUrl: c = t("community.illustrationUrl", {
295
+ illustrationUrl: i = t("community.illustrationUrl", {
296
296
  defaultValue: "https://cdn.builder.io/api/v1/image/assets/TEMP/35ba84b8335fda2819c3a14ea3d00321a0fd0e79e571caa31108468010868ca5?placeholderIfAbsent=true&apiKey=a460e9a46e514356ac1106eada03046c"
297
297
  }),
298
- communityContent: i = {
298
+ communityContent: c = {
299
299
  title: t("community.title"),
300
300
  description: t("community.description")
301
301
  },
302
- baseUrl: m
302
+ baseUrl: d
303
303
  // IMPORTANT: used for Google OAuth redirect
304
- } = se(), { login: p } = z(), [b, E] = u(""), [C, N] = u(""), [h, g] = u(!1), [I, d] = u(null), v = {
305
- google: { icon: ce, label: t("social.google") },
306
- microsoft: { icon: me, label: t("social.microsoft") }
307
- }, w = o.filter((x) => x in v).map((x) => ({
308
- id: x,
309
- icon: v[x].icon,
310
- label: v[x].label
311
- })), { bgClass: M, textClass: j, borderClass: D } = de(s), T = `${M} bg-gradient-to-r from-white/10 via-white/0 to-white/0`;
312
- async function V(x) {
313
- var B;
314
- if (x.preventDefault(), !h) {
315
- d(null), g(!0);
304
+ } = de(), { login: p } = z(), [w, E] = m(""), [C, v] = m(""), [f, h] = m(!1), [M, g] = m(null), k = {
305
+ google: { icon: fe, label: t("social.google") },
306
+ microsoft: { icon: he, label: t("social.microsoft") }
307
+ }, b = o.filter((u) => u in k).map((u) => ({
308
+ id: u,
309
+ icon: k[u].icon,
310
+ label: k[u].label
311
+ })), { bgClass: j, textClass: N, borderClass: D } = xe(s), H = `${j} bg-gradient-to-r from-white/10 via-white/0 to-white/0`;
312
+ async function A(u) {
313
+ var S;
314
+ if (u.preventDefault(), !f) {
315
+ g(null), h(!0);
316
316
  try {
317
- await p({ email: b, password: C });
318
- } catch (S) {
319
- ((B = S == null ? void 0 : S.response) == null ? void 0 : B.status) === 401 ? d(t("errors.invalidCredentials")) : d(t("errors.generic"));
317
+ await p({ email: w, password: C });
318
+ } catch (y) {
319
+ ((S = y == null ? void 0 : y.response) == null ? void 0 : S.status) === 401 ? g(t("errors.invalidCredentials")) : g(t("errors.generic"));
320
320
  } finally {
321
- g(!1);
321
+ h(!1);
322
322
  }
323
323
  }
324
324
  }
325
- function A(x) {
326
- var S, f, P;
327
- if (!m) {
325
+ function _(u) {
326
+ var y, B, I;
327
+ if (!d) {
328
328
  console.error("Auth baseUrl is not configured.");
329
329
  return;
330
330
  }
331
- const B = ((f = (S = l.state) == null ? void 0 : S.from) == null ? void 0 : f.pathname) || ((P = l.state) == null ? void 0 : P.from) || "/";
332
- if (sessionStorage.setItem("postLoginRedirect", B), x === "google") {
333
- const k = "/oauth/google/callback", L = `${window.location.origin}${k}`, y = new URL(`${m}/auth/google`);
334
- y.searchParams.set("redirect", L), window.location.href = y.toString();
331
+ const S = ((B = (y = r.state) == null ? void 0 : y.from) == null ? void 0 : B.pathname) || ((I = r.state) == null ? void 0 : I.from) || "/";
332
+ if (sessionStorage.setItem("postLoginRedirect", S), u === "google") {
333
+ const R = "/oauth/google/callback", F = `${window.location.origin}${R}`, T = new URL(`${d}/auth/google`);
334
+ T.searchParams.set("redirect", F), window.location.href = T.toString();
335
335
  return;
336
336
  }
337
- if (x === "microsoft") {
338
- const k = "/oauth/microsoft/callback", L = `${window.location.origin}${k}`, y = new URL(`${m}/auth/microsoft`);
339
- y.searchParams.set("redirect", L), window.location.href = y.toString();
337
+ if (u === "microsoft") {
338
+ const R = "/oauth/microsoft/callback", F = `${window.location.origin}${R}`, T = new URL(`${d}/auth/microsoft`);
339
+ T.searchParams.set("redirect", F), window.location.href = T.toString();
340
340
  return;
341
341
  }
342
342
  }
343
- const Q = /* @__PURE__ */ e.createElement(
343
+ const K = /* @__PURE__ */ e.createElement(
344
344
  "svg",
345
345
  {
346
346
  className: "h-4 w-4 animate-spin stroke-current",
@@ -358,7 +358,7 @@ const Se = [
358
358
  }
359
359
  )
360
360
  );
361
- return /* @__PURE__ */ e.createElement("div", { className: `flex items-center justify-center min-h-screen p-4 ${T}` }, /* @__PURE__ */ e.createElement("div", { className: "flex w-full max-w-5xl bg-white rounded-2xl shadow-2xl overflow-hidden" }, /* @__PURE__ */ e.createElement("div", { className: `hidden md:flex md:w-1/2 p-12 flex-col justify-between text-white ${M}` }, /* @__PURE__ */ e.createElement("div", null, n ? /* @__PURE__ */ e.createElement("div", { className: "flex items-center gap-4" }, /* @__PURE__ */ e.createElement(
361
+ return /* @__PURE__ */ e.createElement("div", { className: `flex items-center justify-center min-h-screen p-4 ${H}` }, /* @__PURE__ */ e.createElement("div", { className: "flex w-full max-w-5xl bg-white rounded-2xl shadow-2xl overflow-hidden" }, /* @__PURE__ */ e.createElement("div", { className: `hidden md:flex md:w-1/2 p-12 flex-col justify-between text-white ${j}` }, /* @__PURE__ */ e.createElement("div", null, n ? /* @__PURE__ */ e.createElement("div", { className: "flex items-center gap-4" }, /* @__PURE__ */ e.createElement(
362
362
  "img",
363
363
  {
364
364
  loading: "lazy",
@@ -366,11 +366,11 @@ const Se = [
366
366
  alt: "Brand Logo",
367
367
  className: "bg-white h-8 md:h-22 rounded-lg"
368
368
  }
369
- ), /* @__PURE__ */ e.createElement("h2", { className: "text-sm md:text-2xl font-bold uppercase" }, r)) : /* @__PURE__ */ e.createElement("h2", { className: "text-sm md:text-2xl font-bold" }, r)), /* @__PURE__ */ e.createElement("div", { className: "flex-1 space-y-4 mt-6 py-4" }, /* @__PURE__ */ e.createElement("h3", { className: "text-2xl font-semibold leading-tight" }, i.title), /* @__PURE__ */ e.createElement("p", { className: "text-base leading-relaxed opacity-90 ltr:text-left rtl:text-right" }, i.description), /* @__PURE__ */ e.createElement("div", { className: "relative" }, /* @__PURE__ */ e.createElement("div", { className: "absolute -left-4 -top-4 w-20 h-20 bg-white/20 rounded-full blur-xl" }), /* @__PURE__ */ e.createElement("div", { className: "absolute -right-4 -bottom-4 w-20 h-20 bg-white/20 rounded-full blur-xl" }), /* @__PURE__ */ e.createElement(
369
+ ), /* @__PURE__ */ e.createElement("h2", { className: "text-sm md:text-2xl font-bold uppercase" }, l)) : /* @__PURE__ */ e.createElement("h2", { className: "text-sm md:text-2xl font-bold" }, l)), /* @__PURE__ */ e.createElement("div", { className: "flex-1 space-y-4 mt-6 py-4" }, /* @__PURE__ */ e.createElement("h3", { className: "text-2xl font-semibold leading-tight" }, c.title), /* @__PURE__ */ e.createElement("p", { className: "text-base leading-relaxed opacity-90 ltr:text-left rtl:text-right" }, c.description), /* @__PURE__ */ e.createElement("div", { className: "relative" }, /* @__PURE__ */ e.createElement("div", { className: "absolute -left-4 -top-4 w-20 h-20 bg-white/20 rounded-full blur-xl" }), /* @__PURE__ */ e.createElement("div", { className: "absolute -right-4 -bottom-4 w-20 h-20 bg-white/20 rounded-full blur-xl" }), /* @__PURE__ */ e.createElement(
370
370
  "img",
371
371
  {
372
372
  loading: "lazy",
373
- src: c,
373
+ src: i,
374
374
  alt: "Sign in illustration",
375
375
  className: "max-w-sm w-full mx-auto rounded-lg shadow-lg transform hover:scale-105 transition-transform duration-300 p-6"
376
376
  }
@@ -382,90 +382,91 @@ const Se = [
382
382
  alt: "Brand Logo",
383
383
  className: `h-22 rounded-full border ${D}`
384
384
  }
385
- ) : /* @__PURE__ */ e.createElement("h2", { className: "text-2xl font-bold" }, r)), /* @__PURE__ */ e.createElement("div", { className: "w-full md:w-auto mb-4 md:mb-0 text-center md:text-left ltr:text-center rtl:text-center md:ltr:text-left md:rtl:text-right" }, /* @__PURE__ */ e.createElement("p", { className: "text-sm md:text-lg" }, t("SignInPage.welcome"), " ", /* @__PURE__ */ e.createElement("span", { className: `font-semibold ${j} uppercase` }, r)), /* @__PURE__ */ e.createElement("h1", { className: "text-2xl md:text-4xl font-bold text-gray-800" }, t("SignInPage.signIn"))), /* @__PURE__ */ e.createElement("div", { className: "text-sm text-gray-500 text-center md:text-right" }, t("SignInPage.noAccount"), /* @__PURE__ */ e.createElement("br", null), /* @__PURE__ */ e.createElement(
385
+ ) : /* @__PURE__ */ e.createElement("h2", { className: "text-2xl font-bold" }, l)), /* @__PURE__ */ e.createElement("div", { className: "w-full md:w-auto mb-4 md:mb-0 text-center md:text-left ltr:text-center rtl:text-center md:ltr:text-left md:rtl:text-right" }, /* @__PURE__ */ e.createElement("p", { className: "text-sm md:text-lg" }, t("SignInPage.welcome"), " ", /* @__PURE__ */ e.createElement("span", { className: `font-semibold ${N} uppercase` }, l)), /* @__PURE__ */ e.createElement("h1", { className: "text-2xl md:text-4xl font-bold text-gray-800" }, t("SignInPage.signIn"))), /* @__PURE__ */ e.createElement("div", { className: "text-sm text-gray-500 text-center md:text-right" }, t("SignInPage.noAccount"), /* @__PURE__ */ e.createElement("br", null), /* @__PURE__ */ e.createElement(
386
386
  "button",
387
387
  {
388
388
  type: "button",
389
389
  onClick: () => a("/signup"),
390
- className: j
390
+ className: N
391
391
  },
392
392
  t("SignInPage.signUp")
393
- ))), I && /* @__PURE__ */ e.createElement(fe, { message: I }), /* @__PURE__ */ e.createElement("form", { className: "space-y-6", onSubmit: V }, /* @__PURE__ */ e.createElement(
394
- G,
393
+ ))), M && /* @__PURE__ */ e.createElement(we, { message: M }), /* @__PURE__ */ e.createElement("form", { className: "space-y-6", onSubmit: A }, /* @__PURE__ */ e.createElement(
394
+ P,
395
395
  {
396
396
  label: t("form.emailLabel"),
397
397
  type: "email",
398
398
  placeholder: t("form.emailPlaceholder"),
399
399
  color: D,
400
- value: b,
400
+ value: w,
401
401
  onChange: E
402
402
  }
403
403
  ), /* @__PURE__ */ e.createElement(
404
- G,
404
+ P,
405
405
  {
406
406
  label: t("form.passwordLabel"),
407
407
  type: "password",
408
408
  placeholder: t("form.passwordPlaceholder"),
409
409
  color: D,
410
410
  value: C,
411
- onChange: N
411
+ onChange: v
412
412
  }
413
- ), /* @__PURE__ */ e.createElement("div", { className: "ltr:text-right rtl:text-left" }, /* @__PURE__ */ e.createElement("button", { className: `text-sm ${j}` }, t("SignInPage.forgotPassword"))), /* @__PURE__ */ e.createElement(
413
+ ), /* @__PURE__ */ e.createElement("div", { className: "ltr:text-right rtl:text-left" }, /* @__PURE__ */ e.createElement("button", { className: `text-sm ${N}` }, t("SignInPage.forgotPassword"))), /* @__PURE__ */ e.createElement(
414
414
  "button",
415
415
  {
416
416
  type: "submit",
417
- disabled: h,
418
- className: `relative flex w-full items-center justify-center gap-2 py-3 rounded-lg font-medium transition-colors ${h ? "opacity-60 cursor-not-allowed" : ""} ${M} text-white`
417
+ disabled: f,
418
+ className: `relative flex w-full items-center justify-center gap-2 py-3 rounded-lg font-medium transition-colors ${f ? "opacity-60 cursor-not-allowed" : ""} ${j} text-white`
419
419
  },
420
- h && Q,
421
- t(h ? "SignInPage.signInSubmitting" : "SignInPage.signIn")
422
- ), w.length > 0 && /* @__PURE__ */ e.createElement(e.Fragment, null, /* @__PURE__ */ e.createElement("div", { className: "flex items-center pt-2" }, /* @__PURE__ */ e.createElement("div", { className: `flex-grow h-px ${M}` }), /* @__PURE__ */ e.createElement("span", { className: `${j} mx-3 text-sm` }, t("SignInPage.orLoginWith")), /* @__PURE__ */ e.createElement("div", { className: `flex-grow h-px ${M}` })), /* @__PURE__ */ e.createElement("div", { className: "flex gap-3 mb-6 justify-center md:justify-start" }, w.map((x) => /* @__PURE__ */ e.createElement(
420
+ f && K,
421
+ t(f ? "SignInPage.signInSubmitting" : "SignInPage.signIn")
422
+ ), b.length > 0 && /* @__PURE__ */ e.createElement(e.Fragment, null, /* @__PURE__ */ e.createElement("div", { className: "flex items-center pt-2" }, /* @__PURE__ */ e.createElement("div", { className: `flex-grow h-px ${j}` }), /* @__PURE__ */ e.createElement("span", { className: `${N} mx-3 text-sm` }, t("SignInPage.orLoginWith")), /* @__PURE__ */ e.createElement("div", { className: `flex-grow h-px ${j}` })), /* @__PURE__ */ e.createElement("div", { className: "flex gap-3 mb-6 justify-center md:justify-start" }, b.map((u) => /* @__PURE__ */ e.createElement(
423
423
  "button",
424
424
  {
425
- key: x.id,
425
+ key: u.id,
426
426
  type: "button",
427
- onClick: () => A(x.id),
427
+ onClick: () => _(u.id),
428
428
  className: "flex-1"
429
429
  },
430
- /* @__PURE__ */ e.createElement(ie, { icon: x.icon, label: x.label })
430
+ /* @__PURE__ */ e.createElement(ge, { icon: u.icon, label: u.label })
431
431
  ))))))));
432
- }, Ue = () => {
433
- const t = H("authLib"), a = te(), l = ae(), {
434
- brandName: r = t("brandName", { defaultValue: "MyBrand" }),
432
+ }, Ve = () => {
433
+ const t = q("authLib"), a = se(), r = oe(), {
434
+ brandName: l = t("brandName", { defaultValue: "MyBrand" }),
435
435
  colors: s = { bg: "bg-sky-500", text: "text-white", border: "border-sky-500" },
436
436
  logoUrl: n,
437
437
  oauthProviders: o = [],
438
- illustrationUrl: c = t("community.illustrationUrl", {
438
+ illustrationUrl: i = t("community.illustrationUrl", {
439
439
  defaultValue: "https://cdn.builder.io/api/v1/image/assets/TEMP/35ba84b8335fda2819c3a14ea3d00321a0fd0e79e571caa31108468010868ca5?placeholderIfAbsent=true&apiKey=a460e9a46e514356ac1106eada03046c"
440
440
  }),
441
- communityContent: i = {
441
+ communityContent: c = {
442
442
  title: t("community.title"),
443
443
  description: t("community.description")
444
444
  },
445
- baseUrl: m
445
+ baseUrl: d
446
446
  // IMPORTANT: used for OAuth redirect (same as SignIn)
447
- } = se(), { login: p, api: b } = z(), [E, C] = u(""), [N, h] = u(""), [g, I] = u(""), [d, v] = u(!1), [w, M] = u(null), j = {
448
- google: { icon: ce, label: t("social.google") },
449
- microsoft: { icon: me, label: t("social.microsoft") }
450
- }, D = o.filter((f) => f in j).map((f) => ({
451
- id: f,
452
- icon: j[f].icon,
453
- label: j[f].label
454
- })), { bgClass: T, textClass: V, borderClass: A } = de(s), Q = `${T} bg-gradient-to-r from-white/10 via-white/0 to-white/0`;
455
- async function x(f) {
456
- var P, k, L;
457
- if (f.preventDefault(), !d) {
458
- M(null), v(!0);
447
+ } = de(), { login: p, api: w } = z(), [E, C] = m(""), [v, f] = m(""), [h, M] = m(""), [g, k] = m(""), [b, j] = m(""), [N, D] = m(!1), [H, A] = m(null), [_, K] = m(!1), u = {
448
+ google: { icon: fe, label: t("social.google") },
449
+ microsoft: { icon: he, label: t("social.microsoft") }
450
+ }, S = o.filter((x) => x in u).map((x) => ({
451
+ id: x,
452
+ icon: u[x].icon,
453
+ label: u[x].label
454
+ })), { bgClass: y, textClass: B, borderClass: I } = xe(s), R = `${y} bg-gradient-to-r from-white/10 via-white/0 to-white/0`;
455
+ async function F(x) {
456
+ var Q, W, Z;
457
+ if (x.preventDefault(), !N) {
458
+ A(null), D(!0);
459
459
  try {
460
- await b.post("/auth/clients/register", {
461
- email: N,
462
- password: g,
463
- name: E || void 0
464
- }), await p({ email: N, password: g });
465
- } catch (y) {
466
- const $ = (P = y == null ? void 0 : y.response) == null ? void 0 : P.status;
467
- M(
468
- $ === 400 ? ((L = (k = y == null ? void 0 : y.response) == null ? void 0 : k.data) == null ? void 0 : L.message) || t("errors.invalidData", {
460
+ await w.post("/api/auth/register", {
461
+ fullname: { fname: E, lname: v },
462
+ username: h,
463
+ email: g,
464
+ password: b
465
+ }), await p({ email: g, password: b });
466
+ } catch (L) {
467
+ const $ = (Q = L == null ? void 0 : L.response) == null ? void 0 : Q.status;
468
+ A(
469
+ $ === 400 ? ((Z = (W = L == null ? void 0 : L.response) == null ? void 0 : W.data) == null ? void 0 : Z.message) || t("errors.invalidData", {
469
470
  defaultValue: "Please check the fields and try again."
470
471
  }) : $ === 409 ? t("errors.emailInUse", {
471
472
  defaultValue: "This email is already in use."
@@ -474,29 +475,29 @@ const Se = [
474
475
  })
475
476
  );
476
477
  } finally {
477
- v(!1);
478
+ D(!1);
478
479
  }
479
480
  }
480
481
  }
481
- function B(f) {
482
- var k, L, y;
483
- if (!m) {
482
+ function T(x) {
483
+ var W, Z, L;
484
+ if (!d) {
484
485
  console.error("Auth baseUrl is not configured.");
485
486
  return;
486
487
  }
487
- const P = ((L = (k = l.state) == null ? void 0 : k.from) == null ? void 0 : L.pathname) || ((y = l.state) == null ? void 0 : y.from) || "/";
488
- if (sessionStorage.setItem("postLoginRedirect", P), f === "google") {
489
- const $ = "/oauth/google/callback", X = `${window.location.origin}${$}`, W = new URL(`${m}/auth/google`);
490
- W.searchParams.set("redirect", X), window.location.href = W.toString();
488
+ const Q = ((Z = (W = r.state) == null ? void 0 : W.from) == null ? void 0 : Z.pathname) || ((L = r.state) == null ? void 0 : L.from) || "/";
489
+ if (sessionStorage.setItem("postLoginRedirect", Q), x === "google") {
490
+ const $ = "/oauth/google/callback", ee = `${window.location.origin}${$}`, G = new URL(`${d}/auth/google`);
491
+ G.searchParams.set("redirect", ee), window.location.href = G.toString();
491
492
  return;
492
493
  }
493
- if (f === "microsoft") {
494
- const $ = "/oauth/microsoft/callback", X = `${window.location.origin}${$}`, W = new URL(`${m}/auth/microsoft`);
495
- W.searchParams.set("redirect", X), window.location.href = W.toString();
494
+ if (x === "microsoft") {
495
+ const $ = "/oauth/microsoft/callback", ee = `${window.location.origin}${$}`, G = new URL(`${d}/auth/microsoft`);
496
+ G.searchParams.set("redirect", ee), window.location.href = G.toString();
496
497
  return;
497
498
  }
498
499
  }
499
- const S = /* @__PURE__ */ e.createElement(
500
+ const Ne = /* @__PURE__ */ e.createElement(
500
501
  "svg",
501
502
  {
502
503
  className: "h-4 w-4 animate-spin stroke-current",
@@ -514,7 +515,7 @@ const Se = [
514
515
  }
515
516
  )
516
517
  );
517
- return /* @__PURE__ */ e.createElement("div", { className: `flex items-center justify-center min-h-screen p-4 ${Q}` }, /* @__PURE__ */ e.createElement("div", { className: "flex w-full max-w-5xl bg-white rounded-2xl shadow-2xl overflow-hidden" }, /* @__PURE__ */ e.createElement("div", { className: `hidden md:flex md:w-1/2 p-12 flex-col justify-between text-white ${T}` }, /* @__PURE__ */ e.createElement("div", null, n ? /* @__PURE__ */ e.createElement("div", { className: "flex items-center gap-4" }, /* @__PURE__ */ e.createElement(
518
+ return /* @__PURE__ */ e.createElement("div", { className: `flex items-center justify-center min-h-screen p-4 ${R}` }, /* @__PURE__ */ e.createElement("div", { className: "flex w-full max-w-5xl bg-white rounded-2xl shadow-2xl overflow-hidden" }, /* @__PURE__ */ e.createElement("div", { className: `hidden md:flex md:w-1/2 p-12 flex-col justify-between text-white ${y}` }, /* @__PURE__ */ e.createElement("div", null, n ? /* @__PURE__ */ e.createElement("div", { className: "flex items-center gap-4" }, /* @__PURE__ */ e.createElement(
518
519
  "img",
519
520
  {
520
521
  loading: "lazy",
@@ -522,11 +523,11 @@ const Se = [
522
523
  alt: "Brand Logo",
523
524
  className: "bg-white h-8 md:h-22 rounded-lg"
524
525
  }
525
- ), /* @__PURE__ */ e.createElement("h2", { className: "text-sm md:text-2xl font-bold uppercase" }, r)) : /* @__PURE__ */ e.createElement("h2", { className: "text-sm md:text-2xl font-bold" }, r)), /* @__PURE__ */ e.createElement("div", { className: "flex-1 space-y-4 mt-6 py-4" }, /* @__PURE__ */ e.createElement("h3", { className: "text-2xl font-semibold leading-tight" }, i.title), /* @__PURE__ */ e.createElement("p", { className: "text-base leading-relaxed opacity-90 ltr:text-left rtl:text-right" }, i.description), /* @__PURE__ */ e.createElement("div", { className: "relative" }, /* @__PURE__ */ e.createElement("div", { className: "absolute -left-4 -top-4 w-20 h-20 bg-white/20 rounded-full blur-xl" }), /* @__PURE__ */ e.createElement("div", { className: "absolute -right-4 -bottom-4 w-20 h-20 bg-white/20 rounded-full blur-xl" }), /* @__PURE__ */ e.createElement(
526
+ ), /* @__PURE__ */ e.createElement("h2", { className: "text-sm md:text-2xl font-bold uppercase" }, l)) : /* @__PURE__ */ e.createElement("h2", { className: "text-sm md:text-2xl font-bold" }, l)), /* @__PURE__ */ e.createElement("div", { className: "flex-1 space-y-4 mt-6 py-4" }, /* @__PURE__ */ e.createElement("h3", { className: "text-2xl font-semibold leading-tight" }, c.title), /* @__PURE__ */ e.createElement("p", { className: "text-base leading-relaxed opacity-90 ltr:text-left rtl:text-right" }, c.description), /* @__PURE__ */ e.createElement("div", { className: "relative" }, /* @__PURE__ */ e.createElement("div", { className: "absolute -left-4 -top-4 w-20 h-20 bg-white/20 rounded-full blur-xl" }), /* @__PURE__ */ e.createElement("div", { className: "absolute -right-4 -bottom-4 w-20 h-20 bg-white/20 rounded-full blur-xl" }), /* @__PURE__ */ e.createElement(
526
527
  "img",
527
528
  {
528
529
  loading: "lazy",
529
- src: c,
530
+ src: i,
530
531
  alt: "Sign up illustration",
531
532
  className: "max-w-sm w-full mx-auto rounded-lg shadow-lg transform hover:scale-105 transition-transform duration-300 p-6"
532
533
  }
@@ -536,242 +537,269 @@ const Se = [
536
537
  loading: "lazy",
537
538
  src: n,
538
539
  alt: "Brand Logo",
539
- className: `h-22 rounded-full border ${A}`
540
+ className: `h-22 rounded-full border ${I}`
540
541
  }
541
- ) : /* @__PURE__ */ e.createElement("h2", { className: "text-2xl font-bold" }, r)), /* @__PURE__ */ e.createElement("div", { className: "w-full md:w-auto mb-4 md:mb-0 text-center md:text-left ltr:text-center rtl:text-center md:ltr:text-left md:rtl:text-right" }, /* @__PURE__ */ e.createElement("p", { className: "text-sm md:text-lg" }, t("SignUpPage.welcome", { defaultValue: "Join" }), " ", /* @__PURE__ */ e.createElement("span", { className: `font-semibold ${V} uppercase` }, r)), /* @__PURE__ */ e.createElement("h1", { className: "text-2xl md:text-4xl font-bold text-gray-800" }, t("SignUpPage.signUp", { defaultValue: "Sign up" }))), /* @__PURE__ */ e.createElement("div", { className: "text-sm text-gray-500 text-center md:text-right" }, t("SignUpPage.alreadyHaveAccount", {
542
+ ) : /* @__PURE__ */ e.createElement("h2", { className: "text-2xl font-bold" }, l)), /* @__PURE__ */ e.createElement("div", { className: "w-full md:w-auto mb-4 md:mb-0 text-center md:text-left ltr:text-center rtl:text-center md:ltr:text-left md:rtl:text-right" }, /* @__PURE__ */ e.createElement("p", { className: "text-sm md:text-lg" }, t("SignUpPage.welcome", { defaultValue: "Join" }), " ", /* @__PURE__ */ e.createElement("span", { className: `font-semibold ${B} uppercase` }, l)), /* @__PURE__ */ e.createElement("h1", { className: "text-2xl md:text-4xl font-bold text-gray-800" }, t("SignUpPage.signUp", { defaultValue: "Sign up" }))), /* @__PURE__ */ e.createElement("div", { className: "text-sm text-gray-500 text-center md:text-right" }, t("SignUpPage.alreadyHaveAccount", {
542
543
  defaultValue: "Already have an account?"
543
544
  }), /* @__PURE__ */ e.createElement("br", null), /* @__PURE__ */ e.createElement(
544
545
  "button",
545
546
  {
546
547
  type: "button",
547
548
  onClick: () => a("/login"),
548
- className: V
549
+ className: B
549
550
  },
550
551
  t("SignUpPage.signIn", { defaultValue: "Sign in" })
551
- ))), w && /* @__PURE__ */ e.createElement(fe, { message: w }), /* @__PURE__ */ e.createElement("form", { className: "space-y-6", onSubmit: x }, /* @__PURE__ */ e.createElement(
552
- G,
552
+ ))), H && /* @__PURE__ */ e.createElement(we, { message: H }), /* @__PURE__ */ e.createElement("form", { className: "space-y-6", onSubmit: F }, /* @__PURE__ */ e.createElement("div", { className: "flex gap-2" }, /* @__PURE__ */ e.createElement(
553
+ P,
553
554
  {
554
- label: t("form.nameLabel", { defaultValue: "Name" }),
555
+ label: t("form.fnameLabel", { defaultValue: "First Name" }),
555
556
  type: "text",
556
- placeholder: t("form.namePlaceholder", {
557
- defaultValue: "Enter your name"
558
- }),
559
- color: A,
557
+ placeholder: t("form.fnamePlaceholder", { defaultValue: "Enter your first name" }),
558
+ color: I,
560
559
  value: E,
561
560
  onChange: C
562
561
  }
563
562
  ), /* @__PURE__ */ e.createElement(
564
- G,
563
+ P,
564
+ {
565
+ label: t("form.lnameLabel", { defaultValue: "Last Name" }),
566
+ type: "text",
567
+ placeholder: t("form.lnamePlaceholder", { defaultValue: "Enter your last name" }),
568
+ color: I,
569
+ value: v,
570
+ onChange: f
571
+ }
572
+ )), /* @__PURE__ */ e.createElement(
573
+ P,
574
+ {
575
+ label: t("form.usernameLabel", { defaultValue: "Username" }),
576
+ type: "text",
577
+ placeholder: t("form.usernamePlaceholder", { defaultValue: "Choose a username" }),
578
+ color: I,
579
+ value: h,
580
+ onChange: M
581
+ }
582
+ ), /* @__PURE__ */ e.createElement(
583
+ P,
565
584
  {
566
585
  label: t("form.emailLabel"),
567
586
  type: "email",
568
587
  placeholder: t("form.emailPlaceholder"),
569
- color: A,
570
- value: N,
571
- onChange: h
588
+ color: I,
589
+ value: g,
590
+ onChange: k
572
591
  }
573
592
  ), /* @__PURE__ */ e.createElement(
574
- G,
593
+ P,
575
594
  {
576
595
  label: t("form.passwordLabel"),
577
596
  type: "password",
578
597
  placeholder: t("form.passwordPlaceholder"),
579
- color: A,
580
- value: g,
581
- onChange: I
598
+ color: I,
599
+ value: b,
600
+ onChange: j
582
601
  }
583
- ), /* @__PURE__ */ e.createElement(
602
+ ), /* @__PURE__ */ e.createElement("div", { className: "flex items-center gap-2" }, /* @__PURE__ */ e.createElement(
603
+ "input",
604
+ {
605
+ id: "agree",
606
+ type: "checkbox",
607
+ checked: _,
608
+ onChange: (x) => K(x.target.checked),
609
+ className: "form-checkbox"
610
+ }
611
+ ), /* @__PURE__ */ e.createElement("label", { htmlFor: "agree", className: "text-sm" }, "I agree to the ", /* @__PURE__ */ e.createElement("span", { className: "underline cursor-pointer" }, "terms and conditions"), " (placeholder)")), /* @__PURE__ */ e.createElement(
584
612
  "button",
585
613
  {
586
614
  type: "submit",
587
- disabled: d,
588
- className: `relative flex w-full items-center justify-center gap-2 py-3 rounded-lg font-medium transition-colors ${d ? "opacity-60 cursor-not-allowed" : ""} ${T} text-white`
615
+ disabled: N,
616
+ className: `relative flex w-full items-center justify-center gap-2 py-3 rounded-lg font-medium transition-colors ${N ? "opacity-60 cursor-not-allowed" : ""} ${y} text-white`
589
617
  },
590
- d && S,
591
- d ? t("SignUpPage.signUpSubmitting", {
618
+ N && Ne,
619
+ N ? t("SignUpPage.signUpSubmitting", {
592
620
  defaultValue: "Creating account..."
593
621
  }) : t("SignUpPage.signUp", { defaultValue: "Sign up" })
594
- ), D.length > 0 && /* @__PURE__ */ e.createElement(e.Fragment, null, /* @__PURE__ */ e.createElement("div", { className: "flex items-center pt-2" }, /* @__PURE__ */ e.createElement("div", { className: `flex-grow h-px ${T}` }), /* @__PURE__ */ e.createElement("span", { className: `${V} mx-3 text-sm` }, t("SignUpPage.orContinueWith", {
622
+ ), S.length > 0 && /* @__PURE__ */ e.createElement(e.Fragment, null, /* @__PURE__ */ e.createElement("div", { className: "flex items-center pt-2" }, /* @__PURE__ */ e.createElement("div", { className: `flex-grow h-px ${y}` }), /* @__PURE__ */ e.createElement("span", { className: `${B} mx-3 text-sm` }, t("SignUpPage.orContinueWith", {
595
623
  defaultValue: "Or continue with"
596
- })), /* @__PURE__ */ e.createElement("div", { className: `flex-grow h-px ${T}` })), /* @__PURE__ */ e.createElement("div", { className: "flex gap-3 mb-6 justify-center md:justify-start" }, D.map((f) => /* @__PURE__ */ e.createElement(
624
+ })), /* @__PURE__ */ e.createElement("div", { className: `flex-grow h-px ${y}` })), /* @__PURE__ */ e.createElement("div", { className: "flex gap-3 mb-6 justify-center md:justify-start" }, S.map((x) => /* @__PURE__ */ e.createElement(
597
625
  "button",
598
626
  {
599
- key: f.id,
627
+ key: x.id,
600
628
  type: "button",
601
- onClick: () => B(f.id),
629
+ onClick: () => T(x.id),
602
630
  className: "flex-1"
603
631
  },
604
- /* @__PURE__ */ e.createElement(ie, { icon: f.icon, label: f.label })
632
+ /* @__PURE__ */ e.createElement(ge, { icon: x.icon, label: x.label })
605
633
  ))))))));
606
- }, re = () => (R(() => {
607
- const t = new URLSearchParams(window.location.search), a = t.get("accessToken"), l = t.get("refreshToken");
608
- a && localStorage.setItem("authToken", a), l && localStorage.setItem("refreshToken", l);
609
- const r = sessionStorage.getItem("postLoginRedirect") || "/";
610
- sessionStorage.removeItem("postLoginRedirect"), window.location.replace(r);
611
- }, []), /* @__PURE__ */ e.createElement("div", { className: "flex items-center justify-center min-h-screen text-gray-700" }, "Finishing Google sign-in…")), ze = ({ children: t }) => {
612
- const { isAuthenticated: a } = z(), l = ae();
613
- return a ? t : /* @__PURE__ */ e.createElement(O, { to: "/login", state: { from: l }, replace: !0 });
614
- }, We = ({ config: t, children: a }) => {
615
- const l = te(), [r, s] = u(
634
+ }, ce = () => (V(() => {
635
+ const t = new URLSearchParams(window.location.search), a = t.get("accessToken"), r = t.get("refreshToken");
636
+ a && localStorage.setItem("authToken", a), r && localStorage.setItem("refreshToken", r);
637
+ const l = sessionStorage.getItem("postLoginRedirect") || "/";
638
+ sessionStorage.removeItem("postLoginRedirect"), window.location.replace(l);
639
+ }, []), /* @__PURE__ */ e.createElement("div", { className: "flex items-center justify-center min-h-screen text-gray-700" }, "Finishing Google sign-in…")), Re = ({ children: t }) => {
640
+ const { isAuthenticated: a } = z(), r = oe();
641
+ return a ? t : /* @__PURE__ */ e.createElement(J, { to: "/login", state: { from: r }, replace: !0 });
642
+ }, He = ({ config: t, children: a }) => {
643
+ const r = se(), [l, s] = m(
616
644
  () => localStorage.getItem("authToken")
617
- ), [n, o] = u(null), [c, i] = u(!0), [m, p] = u(!1);
618
- async function b() {
645
+ ), [n, o] = m(null), [i, c] = m(!0), [d, p] = m(!1);
646
+ async function w() {
619
647
  try {
620
648
  await E.post("/auth/logout");
621
- } catch (h) {
622
- console.warn("Logout endpoint failed, proceeding with local logout:", h);
649
+ } catch (f) {
650
+ console.warn("Logout endpoint failed, proceeding with local logout:", f);
623
651
  }
624
- s(null), o(null), localStorage.removeItem("authToken"), sessionStorage.clear(), p(!1), l("/login", { replace: !0 });
652
+ s(null), o(null), localStorage.removeItem("authToken"), sessionStorage.clear(), p(!1), r("/login", { replace: !0 });
625
653
  }
626
- const E = Y(() => {
627
- const h = _.create({
654
+ const E = X(() => {
655
+ const f = le.create({
628
656
  baseURL: t.baseUrl,
629
657
  withCredentials: !0
630
658
  });
631
- return ve(h, {
659
+ return je(f, {
632
660
  baseUrl: t.baseUrl,
633
- getAccessToken: () => r,
634
- setAccessToken: (g) => s(g),
661
+ getAccessToken: () => l,
662
+ setAccessToken: (h) => s(h),
635
663
  logout: () => p(!0)
636
- }), h;
637
- }, [t.baseUrl, r]);
638
- R(() => {
664
+ }), f;
665
+ }, [t.baseUrl, l]);
666
+ V(() => {
639
667
  (async () => {
640
- if (r) {
641
- o(J(r)), i(!1);
668
+ if (l) {
669
+ o(te(l)), c(!1);
642
670
  return;
643
671
  }
644
672
  try {
645
- const { data: g } = await _.post(
673
+ const { data: h } = await le.post(
646
674
  `${t.baseUrl}/auth/refresh-token`,
647
675
  {},
648
676
  { withCredentials: !0 }
649
677
  );
650
- s(g.accessToken), o(J(g.accessToken)), localStorage.setItem("authToken", g.accessToken);
678
+ s(h.accessToken), o(te(h.accessToken)), localStorage.setItem("authToken", h.accessToken);
651
679
  } catch {
652
680
  } finally {
653
- i(!1);
681
+ c(!1);
654
682
  }
655
683
  })();
656
- }, [r, t.baseUrl]);
657
- async function C(h) {
658
- const { data: g } = await E.post("/auth/clients/login", h);
659
- s(g.accessToken), o(J(g.accessToken)), localStorage.setItem("authToken", g.accessToken), Ne(), l("/", { replace: !0 });
684
+ }, [l, t.baseUrl]);
685
+ async function C(f) {
686
+ const { data: h } = await E.post("/api/auth/login", f);
687
+ s(h.accessToken), o(te(h.accessToken)), localStorage.setItem("authToken", h.accessToken), Ce(), r("/", { replace: !0 });
660
688
  }
661
- const N = Y(
689
+ const v = X(
662
690
  () => ({
663
- isAuthenticated: !!r,
664
- accessToken: r,
691
+ isAuthenticated: !!l,
692
+ accessToken: l,
665
693
  user: n,
666
694
  login: C,
667
- logout: b,
695
+ logout: w,
668
696
  api: E,
669
697
  setUser: o
670
698
  }),
671
- [r, n, E]
699
+ [l, n, E]
672
700
  );
673
- return /* @__PURE__ */ e.createElement(ne.Provider, { value: t }, /* @__PURE__ */ e.createElement(oe.Provider, { value: N }, /* @__PURE__ */ e.createElement(Ee, null, /* @__PURE__ */ e.createElement(
674
- Z,
701
+ return /* @__PURE__ */ e.createElement(me.Provider, { value: t }, /* @__PURE__ */ e.createElement(ue.Provider, { value: v }, /* @__PURE__ */ e.createElement(Le, null, /* @__PURE__ */ e.createElement(
702
+ Y,
675
703
  {
676
704
  path: "login",
677
- element: r ? /* @__PURE__ */ e.createElement(O, { to: "/", replace: !0 }) : /* @__PURE__ */ e.createElement(Pe, { baseUrl: t.baseUrl, colors: t.colors })
705
+ element: l ? /* @__PURE__ */ e.createElement(J, { to: "/", replace: !0 }) : /* @__PURE__ */ e.createElement($e, { baseUrl: t.baseUrl, colors: t.colors })
678
706
  }
679
707
  ), /* @__PURE__ */ e.createElement(
680
- Z,
708
+ Y,
681
709
  {
682
710
  path: "signup",
683
- element: r ? /* @__PURE__ */ e.createElement(O, { to: "/", replace: !0 }) : /* @__PURE__ */ e.createElement(Ue, null)
711
+ element: l ? /* @__PURE__ */ e.createElement(J, { to: "/", replace: !0 }) : /* @__PURE__ */ e.createElement(Ve, null)
684
712
  }
685
713
  ), /* @__PURE__ */ e.createElement(
686
- Z,
714
+ Y,
687
715
  {
688
716
  path: "oauth/google/callback",
689
- element: /* @__PURE__ */ e.createElement(re, null)
717
+ element: /* @__PURE__ */ e.createElement(ce, null)
690
718
  }
691
719
  ), /* @__PURE__ */ e.createElement(
692
- Z,
720
+ Y,
693
721
  {
694
722
  path: "/oauth/microsoft/callback",
695
- element: /* @__PURE__ */ e.createElement(re, null)
723
+ element: /* @__PURE__ */ e.createElement(ce, null)
696
724
  }
697
725
  ), /* @__PURE__ */ e.createElement(
698
- Z,
726
+ Y,
699
727
  {
700
728
  path: "*",
701
- element: /* @__PURE__ */ e.createElement(ze, null, a)
729
+ element: /* @__PURE__ */ e.createElement(Re, null, a)
702
730
  }
703
- )), m && /* @__PURE__ */ e.createElement(Me, { onConfirm: b })));
731
+ )), d && /* @__PURE__ */ e.createElement(Se, { onConfirm: w })));
704
732
  };
705
- function he(...t) {
706
- const { user: a } = z(), l = (a == null ? void 0 : a.roles) ?? [];
707
- return t.some((r) => l.includes(r));
733
+ function Ee(...t) {
734
+ const { user: a } = z(), r = (a == null ? void 0 : a.roles) ?? [];
735
+ return t.some((l) => r.includes(l));
708
736
  }
709
- function Ze(t) {
737
+ function Qe(t) {
710
738
  const { user: a } = z();
711
739
  return (a == null ? void 0 : a.modules.includes(t)) ?? !1;
712
740
  }
713
- function ee(...t) {
714
- const { user: a } = z(), l = (a == null ? void 0 : a.permissions) ?? [];
715
- return t.every((r) => l.includes(r));
741
+ function ne(...t) {
742
+ const { user: a } = z(), r = (a == null ? void 0 : a.permissions) ?? [];
743
+ return t.every((l) => r.includes(l));
716
744
  }
717
- const Fe = ({
745
+ const Xe = ({
718
746
  children: t,
719
747
  fallbackpermessions: a = [],
720
- anyPermessions: l = [],
721
- fallbackRoles: r = ["super-admin"],
748
+ anyPermessions: r = [],
749
+ fallbackRoles: l = ["super-admin"],
722
750
  redirectTo: s = "/dashboard"
723
751
  }) => {
724
- if (r.some((i) => he(i)))
752
+ if (l.some((c) => Ee(c)))
725
753
  return /* @__PURE__ */ e.createElement(e.Fragment, null, t);
726
- const o = a.length === 0 || a.every((i) => ee(i)), c = l.length === 0 || l.some((i) => ee(i));
727
- return o && c ? /* @__PURE__ */ e.createElement(e.Fragment, null, t) : /* @__PURE__ */ e.createElement(O, { to: s, replace: !0 });
728
- }, xe = e.createContext({}), Ge = xe.Provider;
729
- function Ye(t, a) {
754
+ const o = a.length === 0 || a.every((c) => ne(c)), i = r.length === 0 || r.some((c) => ne(c));
755
+ return o && i ? /* @__PURE__ */ e.createElement(e.Fragment, null, t) : /* @__PURE__ */ e.createElement(J, { to: s, replace: !0 });
756
+ }, ye = e.createContext({}), Je = ye.Provider;
757
+ function qe(t, a) {
730
758
  var s, n, o;
731
- const r = (s = e.useContext(xe)[t]) == null ? void 0 : s[a];
732
- return r ? !!((n = r.perms) != null && n.some((c) => ee(c)) || (o = r.fallbackRoles) != null && o.some((c) => he(c))) : !1;
759
+ const l = (s = e.useContext(ye)[t]) == null ? void 0 : s[a];
760
+ return l ? !!((n = l.perms) != null && n.some((i) => ne(i)) || (o = l.fallbackRoles) != null && o.some((i) => Ee(i))) : !1;
733
761
  }
734
- const Oe = () => {
735
- const { user: t, api: a, setUser: l } = z(), [r, s] = u((t == null ? void 0 : t.name) ?? ""), [n, o] = u((t == null ? void 0 : t.email) ?? ""), [c, i] = u(!1), [m, p] = u(!1), [b, E] = u({
762
+ const _e = () => {
763
+ const { user: t, api: a, setUser: r } = z(), [l, s] = m((t == null ? void 0 : t.name) ?? ""), [n, o] = m((t == null ? void 0 : t.email) ?? ""), [i, c] = m(!1), [d, p] = m(!1), [w, E] = m({
736
764
  open: !1,
737
765
  type: "success",
738
766
  title: "",
739
767
  message: ""
740
768
  }), C = "+971 50 827 8229";
741
- R(() => {
742
- if (!b.open)
769
+ V(() => {
770
+ if (!w.open)
743
771
  return;
744
- const d = window.setTimeout(() => E((v) => ({ ...v, open: !1 })), 3e3);
745
- return () => window.clearTimeout(d);
746
- }, [b.open]), R(() => {
747
- let d = !1;
748
- async function v() {
772
+ const g = window.setTimeout(() => E((k) => ({ ...k, open: !1 })), 3e3);
773
+ return () => window.clearTimeout(g);
774
+ }, [w.open]), V(() => {
775
+ let g = !1;
776
+ async function k() {
749
777
  try {
750
- const { data: w } = await a.get("/auth/client/me");
751
- if (d)
778
+ const { data: b } = await a.get("/auth/client/me");
779
+ if (g)
752
780
  return;
753
- l(w), s((w == null ? void 0 : w.name) ?? ""), o((w == null ? void 0 : w.email) ?? "");
754
- } catch (w) {
755
- console.error("Failed to load profile details:", w);
781
+ r(b), s((b == null ? void 0 : b.name) ?? ""), o((b == null ? void 0 : b.email) ?? "");
782
+ } catch (b) {
783
+ console.error("Failed to load profile details:", b);
756
784
  }
757
785
  }
758
- return v(), () => {
759
- d = !0;
786
+ return k(), () => {
787
+ g = !0;
760
788
  };
761
- }, [a, l]);
762
- const N = Y(() => (r || (t == null ? void 0 : t.name) || (t == null ? void 0 : t.email) || "").trim(), [r, t == null ? void 0 : t.name, t == null ? void 0 : t.email]), h = Y(() => N.charAt(0).toUpperCase() || "?", [N]);
763
- async function g() {
789
+ }, [a, r]);
790
+ const v = X(() => (l || (t == null ? void 0 : t.name) || (t == null ? void 0 : t.email) || "").trim(), [l, t == null ? void 0 : t.name, t == null ? void 0 : t.email]), f = X(() => v.charAt(0).toUpperCase() || "?", [v]);
791
+ async function h() {
764
792
  if (t) {
765
793
  p(!0);
766
794
  try {
767
- await a.patch("/auth/client/me", { name: r }), l({ ...t, name: r }), i(!1), E({
795
+ await a.patch("/auth/client/me", { name: l }), r({ ...t, name: l }), c(!1), E({
768
796
  open: !0,
769
797
  type: "success",
770
798
  title: "Changes saved",
771
799
  message: "Your profile was updated successfully."
772
800
  });
773
- } catch (d) {
774
- console.error("Failed to update profile:", d), E({
801
+ } catch (g) {
802
+ console.error("Failed to update profile:", g), E({
775
803
  open: !0,
776
804
  type: "error",
777
805
  title: "Save failed",
@@ -784,15 +812,15 @@ const Oe = () => {
784
812
  }
785
813
  if (!t)
786
814
  return /* @__PURE__ */ e.createElement("p", { className: "text-sm text-gray-500" }, "No user data available.");
787
- const I = b.type === "success";
788
- return /* @__PURE__ */ e.createElement("div", { className: "max-w-3xl mx-auto" }, b.open && /* @__PURE__ */ e.createElement(
815
+ const M = w.type === "success";
816
+ return /* @__PURE__ */ e.createElement("div", { className: "max-w-3xl mx-auto" }, w.open && /* @__PURE__ */ e.createElement(
789
817
  "div",
790
818
  {
791
819
  className: "fixed top-6 right-6 z-[999999] flex items-center gap-3 rounded-xl border bg-white px-4 py-3 shadow-lg",
792
820
  role: "status",
793
821
  "aria-live": "polite",
794
822
  style: {
795
- borderColor: I ? "#BBF7D0" : "#FECACA"
823
+ borderColor: M ? "#BBF7D0" : "#FECACA"
796
824
  }
797
825
  },
798
826
  /* @__PURE__ */ e.createElement(
@@ -800,10 +828,10 @@ const Oe = () => {
800
828
  {
801
829
  className: "flex h-9 w-9 items-center justify-center rounded-full",
802
830
  style: {
803
- backgroundColor: I ? "#ECFDF5" : "#FEF2F2"
831
+ backgroundColor: M ? "#ECFDF5" : "#FEF2F2"
804
832
  }
805
833
  },
806
- I ? /* @__PURE__ */ e.createElement(
834
+ M ? /* @__PURE__ */ e.createElement(
807
835
  "svg",
808
836
  {
809
837
  width: "18",
@@ -866,15 +894,15 @@ const Oe = () => {
866
894
  "span",
867
895
  {
868
896
  className: "text-sm font-semibold",
869
- style: { color: I ? "#15803D" : "#B91C1C" }
897
+ style: { color: M ? "#15803D" : "#B91C1C" }
870
898
  },
871
- b.title
872
- ), b.message && /* @__PURE__ */ e.createElement("span", { className: "text-xs text-gray-500" }, b.message)),
899
+ w.title
900
+ ), w.message && /* @__PURE__ */ e.createElement("span", { className: "text-xs text-gray-500" }, w.message)),
873
901
  /* @__PURE__ */ e.createElement(
874
902
  "button",
875
903
  {
876
904
  type: "button",
877
- onClick: () => E((d) => ({ ...d, open: !1 })),
905
+ onClick: () => E((g) => ({ ...g, open: !1 })),
878
906
  className: "ml-2 rounded-md px-2 py-1 text-gray-500 hover:bg-gray-100",
879
907
  "aria-label": "Close",
880
908
  title: "Close"
@@ -908,7 +936,7 @@ const Oe = () => {
908
936
  )
909
937
  )
910
938
  )
911
- ), /* @__PURE__ */ e.createElement("div", { className: "rounded-2xl border border-gray-200 bg-white shadow-sm" }, /* @__PURE__ */ e.createElement("div", { className: "px-6 pt-6 pb-4" }, /* @__PURE__ */ e.createElement("div", { className: "flex items-center justify-between" }, /* @__PURE__ */ e.createElement("div", { className: "flex items-center gap-4" }, /* @__PURE__ */ e.createElement("div", { className: "relative" }, /* @__PURE__ */ e.createElement("div", { className: "h-16 w-16 rounded-full bg-blue-600 flex items-center justify-center text-white text-2xl font-semibold" }, h), /* @__PURE__ */ e.createElement(
939
+ ), /* @__PURE__ */ e.createElement("div", { className: "rounded-2xl border border-gray-200 bg-white shadow-sm" }, /* @__PURE__ */ e.createElement("div", { className: "px-6 pt-6 pb-4" }, /* @__PURE__ */ e.createElement("div", { className: "flex items-center justify-between" }, /* @__PURE__ */ e.createElement("div", { className: "flex items-center gap-4" }, /* @__PURE__ */ e.createElement("div", { className: "relative" }, /* @__PURE__ */ e.createElement("div", { className: "h-16 w-16 rounded-full bg-blue-600 flex items-center justify-center text-white text-2xl font-semibold" }, f), /* @__PURE__ */ e.createElement(
912
940
  "button",
913
941
  {
914
942
  type: "button",
@@ -943,20 +971,20 @@ const Oe = () => {
943
971
  }
944
972
  )
945
973
  )
946
- )), /* @__PURE__ */ e.createElement("div", null, /* @__PURE__ */ e.createElement("h1", { className: "text-2xl font-semibold" }, "My Profile"), /* @__PURE__ */ e.createElement("p", { className: "text-sm text-gray-500" }, "Personal details"))), c ? /* @__PURE__ */ e.createElement(
974
+ )), /* @__PURE__ */ e.createElement("div", null, /* @__PURE__ */ e.createElement("h1", { className: "text-2xl font-semibold" }, "My Profile"), /* @__PURE__ */ e.createElement("p", { className: "text-sm text-gray-500" }, "Personal details"))), i ? /* @__PURE__ */ e.createElement(
947
975
  "button",
948
976
  {
949
977
  type: "button",
950
- onClick: g,
951
- disabled: m,
978
+ onClick: h,
979
+ disabled: d,
952
980
  className: "rounded-full border border-blue-200 bg-blue-50 px-4 py-2 text-sm font-medium text-blue-700 hover:bg-blue-100 disabled:opacity-60"
953
981
  },
954
- m ? "Saving…" : "Save changes"
982
+ d ? "Saving…" : "Save changes"
955
983
  ) : /* @__PURE__ */ e.createElement(
956
984
  "button",
957
985
  {
958
986
  type: "button",
959
- onClick: () => i(!0),
987
+ onClick: () => c(!0),
960
988
  title: "Edit profile",
961
989
  className: "h-9 w-9 rounded-full border border-gray-200 bg-white shadow-sm flex items-center justify-center hover:bg-gray-50"
962
990
  },
@@ -992,10 +1020,10 @@ const Oe = () => {
992
1020
  "input",
993
1021
  {
994
1022
  type: "text",
995
- value: r,
996
- disabled: !c || m,
997
- onChange: (d) => s(d.target.value),
998
- className: `w-full rounded-lg border px-3 py-2 text-sm outline-none ${c ? "border-gray-300 bg-white focus:border-blue-500 focus:ring-2 focus:ring-blue-100" : "border-gray-200 bg-gray-50 text-gray-700"}`
1023
+ value: l,
1024
+ disabled: !i || d,
1025
+ onChange: (g) => s(g.target.value),
1026
+ className: `w-full rounded-lg border px-3 py-2 text-sm outline-none ${i ? "border-gray-300 bg-white focus:border-blue-500 focus:ring-2 focus:ring-blue-100" : "border-gray-200 bg-gray-50 text-gray-700"}`
999
1027
  }
1000
1028
  )), /* @__PURE__ */ e.createElement("div", null, /* @__PURE__ */ e.createElement("label", { className: "block text-xs font-medium text-gray-500 mb-2" }, "Email ID"), /* @__PURE__ */ e.createElement(
1001
1029
  "input",
@@ -1013,13 +1041,13 @@ const Oe = () => {
1013
1041
  disabled: !0,
1014
1042
  className: "w-full rounded-lg border border-gray-200 bg-gray-50 px-3 py-2 text-sm text-gray-700 cursor-not-allowed"
1015
1043
  }
1016
- ))), c && /* @__PURE__ */ e.createElement(
1044
+ ))), i && /* @__PURE__ */ e.createElement(
1017
1045
  "button",
1018
1046
  {
1019
1047
  type: "button",
1020
- disabled: m,
1048
+ disabled: d,
1021
1049
  onClick: () => {
1022
- i(!1), s((t == null ? void 0 : t.name) ?? "");
1050
+ c(!1), s((t == null ? void 0 : t.name) ?? "");
1023
1051
  },
1024
1052
  className: "mt-6 text-sm font-medium text-gray-600 hover:text-gray-900"
1025
1053
  },
@@ -1027,14 +1055,14 @@ const Oe = () => {
1027
1055
  ))));
1028
1056
  };
1029
1057
  export {
1030
- We as AuthProvider,
1031
- Oe as ProfilePage,
1032
- xe as RbacContext,
1033
- Ge as RbacProvider,
1034
- Fe as RequirePermissions,
1058
+ He as AuthProvider,
1059
+ _e as ProfilePage,
1060
+ ye as RbacContext,
1061
+ Je as RbacProvider,
1062
+ Xe as RequirePermissions,
1035
1063
  z as useAuthState,
1036
- ee as useCan,
1037
- Ye as useGrant,
1038
- Ze as useHasModule,
1039
- he as useHasRole
1064
+ ne as useCan,
1065
+ qe as useGrant,
1066
+ Qe as useHasModule,
1067
+ Ee as useHasRole
1040
1068
  };