@ciscode/ui-authentication-kit 1.0.2 → 1.0.4

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,1704 +1,148 @@
1
- import * as Y from "react";
2
- import l, { createContext as He, useContext as Ke, useState as j, useRef as We, useEffect as K, useCallback as ut, forwardRef as Ge, createElement as me, useMemo as ae } from "react";
3
- import pe from "axios";
4
- import { jwtDecode as dt } from "jwt-decode";
5
- import ft from "react-dom";
6
- import { useNavigate as Ee, useLocation as Se, Routes as ht, Route as _, Navigate as ie } from "react-router";
7
- const Ze = l.createContext(null);
8
- function Ye() {
9
- const r = l.useContext(Ze);
10
- if (!r)
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);
11
+ if (!t)
11
12
  throw new Error("useAuthConfig must be used within an AuthConfigProvider");
12
- return r;
13
+ return t;
13
14
  }
14
- const Je = He(null);
15
- function G() {
16
- const r = Ke(Je);
17
- if (!r)
15
+ const oe = pe(null);
16
+ function z() {
17
+ const t = be(oe);
18
+ if (!t)
18
19
  throw new Error("useAuthState must be inside <AuthProvider>");
19
- return r;
20
+ return t;
20
21
  }
21
- function de(r) {
22
- const e = dt(r);
22
+ function J(t) {
23
+ const a = we(t);
23
24
  return {
24
- id: e.sub,
25
- email: e.email ?? "",
26
- roles: e.roles ?? [],
27
- permissions: e.permissions ?? [],
28
- modules: e.modules ?? [],
29
- tenantId: e.tenantId ?? ""
25
+ id: a.sub,
26
+ email: a.email ?? "",
27
+ roles: a.roles ?? [],
28
+ permissions: a.permissions ?? [],
29
+ modules: a.modules ?? [],
30
+ tenantId: a.tenantId ?? ""
30
31
  };
31
32
  }
32
- let xe = !1;
33
- function gt() {
34
- xe = !1;
33
+ let K = !1;
34
+ function Ne() {
35
+ K = !1;
35
36
  }
36
- function mt(r, e) {
37
- r.defaults.withCredentials = !0;
38
- const t = `${e.baseUrl}${e.refreshEndpoint ?? "/auth/refresh-token"}`;
39
- r.interceptors.request.use((a) => {
40
- const i = e.getAccessToken();
41
- return i && (a.headers.Authorization = `Bearer ${i}`), a;
37
+ function ve(t, a) {
38
+ t.defaults.withCredentials = !0;
39
+ const l = `${a.baseUrl}${a.refreshEndpoint ?? "/auth/refresh-token"}`;
40
+ t.interceptors.request.use((n) => {
41
+ const o = a.getAccessToken();
42
+ return o && (n.headers.Authorization = `Bearer ${o}`), n;
42
43
  });
43
- let s = !1, n = [];
44
- return r.interceptors.response.use(
45
- (a) => a,
46
- async (a) => {
47
- var o;
48
- const i = a.config;
49
- if (((o = a.response) == null ? void 0 : o.status) !== 401 || !i || i._retry)
50
- return Promise.reject(a);
51
- if (i._retry = !0, !s) {
52
- s = !0;
44
+ let r = !1, s = [];
45
+ return t.interceptors.response.use(
46
+ (n) => n,
47
+ async (n) => {
48
+ var c;
49
+ const o = n.config;
50
+ if (((c = n.response) == null ? void 0 : c.status) !== 401 || !o || o._retry)
51
+ return Promise.reject(n);
52
+ if (o._retry = !0, !r) {
53
+ r = !0;
53
54
  try {
54
- const { data: u } = await pe.post(t, {}, { withCredentials: !0 });
55
- return e.setAccessToken(u.accessToken), n.forEach((c) => c(u.accessToken)), n = [], r.request(i);
56
- } catch (u) {
57
- return !!e.getAccessToken() && !xe && (xe = !0, e.logout()), n.forEach((d) => d(null)), n = [], Promise.reject(u);
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);
58
59
  } finally {
59
- s = !1;
60
+ r = !1;
60
61
  }
61
62
  }
62
- return new Promise((u, c) => {
63
- n.push((d) => {
64
- if (!d)
65
- return c(a);
66
- (i.headers ?? (i.headers = {})).Authorization = `Bearer ${d}`, u(r.request(i));
63
+ return new Promise((i, m) => {
64
+ s.push((p) => {
65
+ if (!p)
66
+ return m(n);
67
+ (o.headers ?? (o.headers = {})).Authorization = `Bearer ${p}`, i(t.request(o));
67
68
  });
68
69
  });
69
70
  }
70
- ), r;
71
+ ), t;
71
72
  }
72
- const x = (r) => typeof r == "string", X = () => {
73
- let r, e;
74
- const t = new Promise((s, n) => {
75
- r = s, e = n;
76
- });
77
- return t.resolve = r, t.reject = e, t;
78
- }, ke = (r) => r == null ? "" : "" + r, pt = (r, e, t) => {
79
- r.forEach((s) => {
80
- e[s] && (t[s] = e[s]);
81
- });
82
- }, xt = /###/g, Ie = (r) => r && r.indexOf("###") > -1 ? r.replace(xt, ".") : r, Oe = (r) => !r || x(r), ee = (r, e, t) => {
83
- const s = x(e) ? e.split(".") : e;
84
- let n = 0;
85
- for (; n < s.length - 1; ) {
86
- if (Oe(r))
87
- return {};
88
- const a = Ie(s[n]);
89
- !r[a] && t && (r[a] = new t()), Object.prototype.hasOwnProperty.call(r, a) ? r = r[a] : r = {}, ++n;
90
- }
91
- return Oe(r) ? {} : {
92
- obj: r,
93
- k: Ie(s[n])
94
- };
95
- }, je = (r, e, t) => {
96
- const {
97
- obj: s,
98
- k: n
99
- } = ee(r, e, Object);
100
- if (s !== void 0 || e.length === 1) {
101
- s[n] = t;
102
- return;
103
- }
104
- let a = e[e.length - 1], i = e.slice(0, e.length - 1), o = ee(r, i, Object);
105
- for (; o.obj === void 0 && i.length; )
106
- a = `${i[i.length - 1]}.${a}`, i = i.slice(0, i.length - 1), o = ee(r, i, Object), o != null && o.obj && typeof o.obj[`${o.k}.${a}`] < "u" && (o.obj = void 0);
107
- o.obj[`${o.k}.${a}`] = t;
108
- }, yt = (r, e, t, s) => {
109
- const {
110
- obj: n,
111
- k: a
112
- } = ee(r, e, Object);
113
- n[a] = n[a] || [], n[a].push(t);
114
- }, oe = (r, e) => {
115
- const {
116
- obj: t,
117
- k: s
118
- } = ee(r, e);
119
- if (t && Object.prototype.hasOwnProperty.call(t, s))
120
- return t[s];
121
- }, bt = (r, e, t) => {
122
- const s = oe(r, t);
123
- return s !== void 0 ? s : oe(e, t);
124
- }, Qe = (r, e, t) => {
125
- for (const s in e)
126
- s !== "__proto__" && s !== "constructor" && (s in r ? x(r[s]) || r[s] instanceof String || x(e[s]) || e[s] instanceof String ? t && (r[s] = e[s]) : Qe(r[s], e[s], t) : r[s] = e[s]);
127
- return r;
128
- }, Z = (r) => r.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, "\\$&");
129
- var wt = {
130
- "&": "&amp;",
131
- "<": "&lt;",
132
- ">": "&gt;",
133
- '"': "&quot;",
134
- "'": "&#39;",
135
- "/": "&#x2F;"
136
- };
137
- const Nt = (r) => x(r) ? r.replace(/[&<>"'\/]/g, (e) => wt[e]) : r;
138
- class vt {
139
- constructor(e) {
140
- this.capacity = e, this.regExpMap = /* @__PURE__ */ new Map(), this.regExpQueue = [];
141
- }
142
- getRegExp(e) {
143
- const t = this.regExpMap.get(e);
144
- if (t !== void 0)
145
- return t;
146
- const s = new RegExp(e);
147
- return this.regExpQueue.length === this.capacity && this.regExpMap.delete(this.regExpQueue.shift()), this.regExpMap.set(e, s), this.regExpQueue.push(e), s;
148
- }
149
- }
150
- const Et = [" ", ",", "?", "!", ";"], St = new vt(20), Lt = (r, e, t) => {
151
- e = e || "", t = t || "";
152
- const s = Et.filter((i) => e.indexOf(i) < 0 && t.indexOf(i) < 0);
153
- if (s.length === 0)
154
- return !0;
155
- const n = St.getRegExp(`(${s.map((i) => i === "?" ? "\\?" : i).join("|")})`);
156
- let a = !n.test(r);
157
- if (!a) {
158
- const i = r.indexOf(t);
159
- i > 0 && !n.test(r.substring(0, i)) && (a = !0);
160
- }
161
- return a;
162
- }, ye = (r, e, t = ".") => {
163
- if (!r)
164
- return;
165
- if (r[e])
166
- return Object.prototype.hasOwnProperty.call(r, e) ? r[e] : void 0;
167
- const s = e.split(t);
168
- let n = r;
169
- for (let a = 0; a < s.length; ) {
170
- if (!n || typeof n != "object")
171
- return;
172
- let i, o = "";
173
- for (let u = a; u < s.length; ++u)
174
- if (u !== a && (o += t), o += s[u], i = n[o], i !== void 0) {
175
- if (["string", "number", "boolean"].indexOf(typeof i) > -1 && u < s.length - 1)
176
- continue;
177
- a += u - a + 1;
178
- break;
179
- }
180
- n = i;
181
- }
182
- return n;
183
- }, ne = (r) => r == null ? void 0 : r.replace("_", "-"), Ct = {
184
- type: "logger",
185
- log(r) {
186
- this.output("log", r);
187
- },
188
- warn(r) {
189
- this.output("warn", r);
190
- },
191
- error(r) {
192
- this.output("error", r);
193
- },
194
- output(r, e) {
195
- var t, s;
196
- (s = (t = console == null ? void 0 : console[r]) == null ? void 0 : t.apply) == null || s.call(t, console, e);
197
- }
198
- };
199
- class le {
200
- constructor(e, t = {}) {
201
- this.init(e, t);
202
- }
203
- init(e, t = {}) {
204
- this.prefix = t.prefix || "i18next:", this.logger = e || Ct, this.options = t, this.debug = t.debug;
205
- }
206
- log(...e) {
207
- return this.forward(e, "log", "", !0);
208
- }
209
- warn(...e) {
210
- return this.forward(e, "warn", "", !0);
211
- }
212
- error(...e) {
213
- return this.forward(e, "error", "");
214
- }
215
- deprecate(...e) {
216
- return this.forward(e, "warn", "WARNING DEPRECATED: ", !0);
217
- }
218
- forward(e, t, s, n) {
219
- return n && !this.debug ? null : (x(e[0]) && (e[0] = `${s}${this.prefix} ${e[0]}`), this.logger[t](e));
220
- }
221
- create(e) {
222
- return new le(this.logger, {
223
- prefix: `${this.prefix}:${e}:`,
224
- ...this.options
225
- });
226
- }
227
- clone(e) {
228
- return e = e || this.options, e.prefix = e.prefix || this.prefix, new le(this.logger, e);
229
- }
230
- }
231
- var B = new le();
232
- class ue {
233
- constructor() {
234
- this.observers = {};
235
- }
236
- on(e, t) {
237
- return e.split(" ").forEach((s) => {
238
- this.observers[s] || (this.observers[s] = /* @__PURE__ */ new Map());
239
- const n = this.observers[s].get(t) || 0;
240
- this.observers[s].set(t, n + 1);
241
- }), this;
242
- }
243
- off(e, t) {
244
- if (this.observers[e]) {
245
- if (!t) {
246
- delete this.observers[e];
247
- return;
248
- }
249
- this.observers[e].delete(t);
250
- }
251
- }
252
- emit(e, ...t) {
253
- this.observers[e] && Array.from(this.observers[e].entries()).forEach(([n, a]) => {
254
- for (let i = 0; i < a; i++)
255
- n(...t);
256
- }), this.observers["*"] && Array.from(this.observers["*"].entries()).forEach(([n, a]) => {
257
- for (let i = 0; i < a; i++)
258
- n.apply(n, [e, ...t]);
259
- });
260
- }
261
- }
262
- class Pe extends ue {
263
- constructor(e, t = {
264
- ns: ["translation"],
265
- defaultNS: "translation"
266
- }) {
267
- super(), this.data = e || {}, this.options = t, this.options.keySeparator === void 0 && (this.options.keySeparator = "."), this.options.ignoreJSONStructure === void 0 && (this.options.ignoreJSONStructure = !0);
268
- }
269
- addNamespaces(e) {
270
- this.options.ns.indexOf(e) < 0 && this.options.ns.push(e);
271
- }
272
- removeNamespaces(e) {
273
- const t = this.options.ns.indexOf(e);
274
- t > -1 && this.options.ns.splice(t, 1);
275
- }
276
- getResource(e, t, s, n = {}) {
277
- var c, d;
278
- const a = n.keySeparator !== void 0 ? n.keySeparator : this.options.keySeparator, i = n.ignoreJSONStructure !== void 0 ? n.ignoreJSONStructure : this.options.ignoreJSONStructure;
279
- let o;
280
- e.indexOf(".") > -1 ? o = e.split(".") : (o = [e, t], s && (Array.isArray(s) ? o.push(...s) : x(s) && a ? o.push(...s.split(a)) : o.push(s)));
281
- const u = oe(this.data, o);
282
- return !u && !t && !s && e.indexOf(".") > -1 && (e = o[0], t = o[1], s = o.slice(2).join(".")), u || !i || !x(s) ? u : ye((d = (c = this.data) == null ? void 0 : c[e]) == null ? void 0 : d[t], s, a);
283
- }
284
- addResource(e, t, s, n, a = {
285
- silent: !1
286
- }) {
287
- const i = a.keySeparator !== void 0 ? a.keySeparator : this.options.keySeparator;
288
- let o = [e, t];
289
- s && (o = o.concat(i ? s.split(i) : s)), e.indexOf(".") > -1 && (o = e.split("."), n = t, t = o[1]), this.addNamespaces(t), je(this.data, o, n), a.silent || this.emit("added", e, t, s, n);
290
- }
291
- addResources(e, t, s, n = {
292
- silent: !1
293
- }) {
294
- for (const a in s)
295
- (x(s[a]) || Array.isArray(s[a])) && this.addResource(e, t, a, s[a], {
296
- silent: !0
297
- });
298
- n.silent || this.emit("added", e, t, s);
299
- }
300
- addResourceBundle(e, t, s, n, a, i = {
301
- silent: !1,
302
- skipCopy: !1
303
- }) {
304
- let o = [e, t];
305
- e.indexOf(".") > -1 && (o = e.split("."), n = s, s = t, t = o[1]), this.addNamespaces(t);
306
- let u = oe(this.data, o) || {};
307
- i.skipCopy || (s = JSON.parse(JSON.stringify(s))), n ? Qe(u, s, a) : u = {
308
- ...u,
309
- ...s
310
- }, je(this.data, o, u), i.silent || this.emit("added", e, t, s);
311
- }
312
- removeResourceBundle(e, t) {
313
- this.hasResourceBundle(e, t) && delete this.data[e][t], this.removeNamespaces(t), this.emit("removed", e, t);
314
- }
315
- hasResourceBundle(e, t) {
316
- return this.getResource(e, t) !== void 0;
317
- }
318
- getResourceBundle(e, t) {
319
- return t || (t = this.options.defaultNS), this.getResource(e, t);
320
- }
321
- getDataByLanguage(e) {
322
- return this.data[e];
323
- }
324
- hasLanguageSomeTranslations(e) {
325
- const t = this.getDataByLanguage(e);
326
- return !!(t && Object.keys(t) || []).find((n) => t[n] && Object.keys(t[n]).length > 0);
327
- }
328
- toJSON() {
329
- return this.data;
330
- }
331
- }
332
- var _e = {
333
- processors: {},
334
- addPostProcessor(r) {
335
- this.processors[r.name] = r;
336
- },
337
- handle(r, e, t, s, n) {
338
- return r.forEach((a) => {
339
- var i;
340
- e = ((i = this.processors[a]) == null ? void 0 : i.process(e, t, s, n)) ?? e;
341
- }), e;
342
- }
343
- };
344
- const Xe = Symbol("i18next/PATH_KEY");
345
- function kt() {
346
- const r = [], e = /* @__PURE__ */ Object.create(null);
347
- let t;
348
- return e.get = (s, n) => {
349
- var a;
350
- return (a = t == null ? void 0 : t.revoke) == null || a.call(t), n === Xe ? r : (r.push(n), t = Proxy.revocable(s, e), t.proxy);
351
- }, Proxy.revocable(/* @__PURE__ */ Object.create(null), e).proxy;
352
- }
353
- function be(r, e) {
354
- const {
355
- [Xe]: t
356
- } = r(kt());
357
- return t.join((e == null ? void 0 : e.keySeparator) ?? ".");
358
- }
359
- const Me = {}, fe = (r) => !x(r) && typeof r != "boolean" && typeof r != "number";
360
- class ce extends ue {
361
- constructor(e, t = {}) {
362
- super(), pt(["resourceStore", "languageUtils", "pluralResolver", "interpolator", "backendConnector", "i18nFormat", "utils"], e, this), this.options = t, this.options.keySeparator === void 0 && (this.options.keySeparator = "."), this.logger = B.create("translator");
363
- }
364
- changeLanguage(e) {
365
- e && (this.language = e);
366
- }
367
- exists(e, t = {
368
- interpolation: {}
369
- }) {
370
- const s = {
371
- ...t
372
- };
373
- if (e == null)
374
- return !1;
375
- const n = this.resolve(e, s);
376
- if ((n == null ? void 0 : n.res) === void 0)
377
- return !1;
378
- const a = fe(n.res);
379
- return !(s.returnObjects === !1 && a);
380
- }
381
- extractFromKey(e, t) {
382
- let s = t.nsSeparator !== void 0 ? t.nsSeparator : this.options.nsSeparator;
383
- s === void 0 && (s = ":");
384
- const n = t.keySeparator !== void 0 ? t.keySeparator : this.options.keySeparator;
385
- let a = t.ns || this.options.defaultNS || [];
386
- const i = s && e.indexOf(s) > -1, o = !this.options.userDefinedKeySeparator && !t.keySeparator && !this.options.userDefinedNsSeparator && !t.nsSeparator && !Lt(e, s, n);
387
- if (i && !o) {
388
- const u = e.match(this.interpolator.nestingRegexp);
389
- if (u && u.length > 0)
390
- return {
391
- key: e,
392
- namespaces: x(a) ? [a] : a
393
- };
394
- const c = e.split(s);
395
- (s !== n || s === n && this.options.ns.indexOf(c[0]) > -1) && (a = c.shift()), e = c.join(n);
396
- }
397
- return {
398
- key: e,
399
- namespaces: x(a) ? [a] : a
400
- };
401
- }
402
- translate(e, t, s) {
403
- let n = typeof t == "object" ? {
404
- ...t
405
- } : t;
406
- if (typeof n != "object" && this.options.overloadTranslationOptionHandler && (n = this.options.overloadTranslationOptionHandler(arguments)), typeof n == "object" && (n = {
407
- ...n
408
- }), n || (n = {}), e == null)
409
- return "";
410
- typeof e == "function" && (e = be(e, {
411
- ...this.options,
412
- ...n
413
- })), Array.isArray(e) || (e = [String(e)]);
414
- const a = n.returnDetails !== void 0 ? n.returnDetails : this.options.returnDetails, i = n.keySeparator !== void 0 ? n.keySeparator : this.options.keySeparator, {
415
- key: o,
416
- namespaces: u
417
- } = this.extractFromKey(e[e.length - 1], n), c = u[u.length - 1];
418
- let d = n.nsSeparator !== void 0 ? n.nsSeparator : this.options.nsSeparator;
419
- d === void 0 && (d = ":");
420
- const f = n.lng || this.language, m = n.appendNamespaceToCIMode || this.options.appendNamespaceToCIMode;
421
- if ((f == null ? void 0 : f.toLowerCase()) === "cimode")
422
- return m ? a ? {
423
- res: `${c}${d}${o}`,
424
- usedKey: o,
425
- exactUsedKey: o,
426
- usedLng: f,
427
- usedNS: c,
428
- usedParams: this.getUsedParamsDetails(n)
429
- } : `${c}${d}${o}` : a ? {
430
- res: o,
431
- usedKey: o,
432
- exactUsedKey: o,
433
- usedLng: f,
434
- usedNS: c,
435
- usedParams: this.getUsedParamsDetails(n)
436
- } : o;
437
- const g = this.resolve(e, n);
438
- let h = g == null ? void 0 : g.res;
439
- const p = (g == null ? void 0 : g.usedKey) || o, y = (g == null ? void 0 : g.exactUsedKey) || o, L = ["[object Number]", "[object Function]", "[object RegExp]"], b = n.joinArrays !== void 0 ? n.joinArrays : this.options.joinArrays, S = !this.i18nFormat || this.i18nFormat.handleAsObject, w = n.count !== void 0 && !x(n.count), C = ce.hasDefaultValue(n), A = w ? this.pluralResolver.getSuffix(f, n.count, n) : "", P = n.ordinal && w ? this.pluralResolver.getSuffix(f, n.count, {
440
- ordinal: !1
441
- }) : "", E = w && !n.ordinal && n.count === 0, v = E && n[`defaultValue${this.options.pluralSeparator}zero`] || n[`defaultValue${A}`] || n[`defaultValue${P}`] || n.defaultValue;
442
- let N = h;
443
- S && !h && C && (N = v);
444
- const U = fe(N), M = Object.prototype.toString.apply(N);
445
- if (S && N && U && L.indexOf(M) < 0 && !(x(b) && Array.isArray(N))) {
446
- if (!n.returnObjects && !this.options.returnObjects) {
447
- this.options.returnedObjectHandler || this.logger.warn("accessing an object - but returnObjects options is not enabled!");
448
- const R = this.options.returnedObjectHandler ? this.options.returnedObjectHandler(p, N, {
449
- ...n,
450
- ns: u
451
- }) : `key '${o} (${this.language})' returned an object instead of string.`;
452
- return a ? (g.res = R, g.usedParams = this.getUsedParamsDetails(n), g) : R;
453
- }
454
- if (i) {
455
- const R = Array.isArray(N), I = R ? [] : {}, k = R ? y : p;
456
- for (const $ in N)
457
- if (Object.prototype.hasOwnProperty.call(N, $)) {
458
- const T = `${k}${i}${$}`;
459
- C && !h ? I[$] = this.translate(T, {
460
- ...n,
461
- defaultValue: fe(v) ? v[$] : void 0,
462
- joinArrays: !1,
463
- ns: u
464
- }) : I[$] = this.translate(T, {
465
- ...n,
466
- joinArrays: !1,
467
- ns: u
468
- }), I[$] === T && (I[$] = N[$]);
469
- }
470
- h = I;
471
- }
472
- } else if (S && x(b) && Array.isArray(h))
473
- h = h.join(b), h && (h = this.extendTranslation(h, e, n, s));
474
- else {
475
- let R = !1, I = !1;
476
- !this.isValidLookup(h) && C && (R = !0, h = v), this.isValidLookup(h) || (I = !0, h = o);
477
- const $ = (n.missingKeyNoValueFallbackToKey || this.options.missingKeyNoValueFallbackToKey) && I ? void 0 : h, T = C && v !== h && this.options.updateMissing;
478
- if (I || R || T) {
479
- if (this.logger.log(T ? "updateKey" : "missingKey", f, c, o, T ? v : h), i) {
480
- const D = this.resolve(o, {
481
- ...n,
482
- keySeparator: !1
483
- });
484
- D && D.res && this.logger.warn("Seems the loaded translations were in flat JSON format instead of nested. Either set keySeparator: false on init or make sure your translations are published in nested format.");
485
- }
486
- let F = [];
487
- const O = this.languageUtils.getFallbackCodes(this.options.fallbackLng, n.lng || this.language);
488
- if (this.options.saveMissingTo === "fallback" && O && O[0])
489
- for (let D = 0; D < O.length; D++)
490
- F.push(O[D]);
491
- else
492
- this.options.saveMissingTo === "all" ? F = this.languageUtils.toResolveHierarchy(n.lng || this.language) : F.push(n.lng || this.language);
493
- const H = (D, V, Q) => {
494
- var Ce;
495
- const Le = C && Q !== h ? Q : $;
496
- this.options.missingKeyHandler ? this.options.missingKeyHandler(D, c, V, Le, T, n) : (Ce = this.backendConnector) != null && Ce.saveMissing && this.backendConnector.saveMissing(D, c, V, Le, T, n), this.emit("missingKey", D, c, V, h);
497
- };
498
- this.options.saveMissing && (this.options.saveMissingPlurals && w ? F.forEach((D) => {
499
- const V = this.pluralResolver.getSuffixes(D, n);
500
- E && n[`defaultValue${this.options.pluralSeparator}zero`] && V.indexOf(`${this.options.pluralSeparator}zero`) < 0 && V.push(`${this.options.pluralSeparator}zero`), V.forEach((Q) => {
501
- H([D], o + Q, n[`defaultValue${Q}`] || v);
502
- });
503
- }) : H(F, o, v));
504
- }
505
- h = this.extendTranslation(h, e, n, g, s), I && h === o && this.options.appendNamespaceToMissingKey && (h = `${c}${d}${o}`), (I || R) && this.options.parseMissingKeyHandler && (h = this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey ? `${c}${d}${o}` : o, R ? h : void 0, n));
506
- }
507
- return a ? (g.res = h, g.usedParams = this.getUsedParamsDetails(n), g) : h;
508
- }
509
- extendTranslation(e, t, s, n, a) {
510
- var u, c;
511
- if ((u = this.i18nFormat) != null && u.parse)
512
- e = this.i18nFormat.parse(e, {
513
- ...this.options.interpolation.defaultVariables,
514
- ...s
515
- }, s.lng || this.language || n.usedLng, n.usedNS, n.usedKey, {
516
- resolved: n
517
- });
518
- else if (!s.skipInterpolation) {
519
- s.interpolation && this.interpolator.init({
520
- ...s,
521
- interpolation: {
522
- ...this.options.interpolation,
523
- ...s.interpolation
524
- }
525
- });
526
- const d = x(e) && (((c = s == null ? void 0 : s.interpolation) == null ? void 0 : c.skipOnVariables) !== void 0 ? s.interpolation.skipOnVariables : this.options.interpolation.skipOnVariables);
527
- let f;
528
- if (d) {
529
- const g = e.match(this.interpolator.nestingRegexp);
530
- f = g && g.length;
531
- }
532
- let m = s.replace && !x(s.replace) ? s.replace : s;
533
- if (this.options.interpolation.defaultVariables && (m = {
534
- ...this.options.interpolation.defaultVariables,
535
- ...m
536
- }), e = this.interpolator.interpolate(e, m, s.lng || this.language || n.usedLng, s), d) {
537
- const g = e.match(this.interpolator.nestingRegexp), h = g && g.length;
538
- f < h && (s.nest = !1);
539
- }
540
- !s.lng && n && n.res && (s.lng = this.language || n.usedLng), s.nest !== !1 && (e = this.interpolator.nest(e, (...g) => (a == null ? void 0 : a[0]) === g[0] && !s.context ? (this.logger.warn(`It seems you are nesting recursively key: ${g[0]} in key: ${t[0]}`), null) : this.translate(...g, t), s)), s.interpolation && this.interpolator.reset();
541
- }
542
- const i = s.postProcess || this.options.postProcess, o = x(i) ? [i] : i;
543
- return e != null && (o != null && o.length) && s.applyPostProcessor !== !1 && (e = _e.handle(o, e, t, this.options && this.options.postProcessPassResolved ? {
544
- i18nResolved: {
545
- ...n,
546
- usedParams: this.getUsedParamsDetails(s)
547
- },
548
- ...s
549
- } : s, this)), e;
550
- }
551
- resolve(e, t = {}) {
552
- let s, n, a, i, o;
553
- return x(e) && (e = [e]), e.forEach((u) => {
554
- if (this.isValidLookup(s))
555
- return;
556
- const c = this.extractFromKey(u, t), d = c.key;
557
- n = d;
558
- let f = c.namespaces;
559
- this.options.fallbackNS && (f = f.concat(this.options.fallbackNS));
560
- const m = t.count !== void 0 && !x(t.count), g = m && !t.ordinal && t.count === 0, h = t.context !== void 0 && (x(t.context) || typeof t.context == "number") && t.context !== "", p = t.lngs ? t.lngs : this.languageUtils.toResolveHierarchy(t.lng || this.language, t.fallbackLng);
561
- f.forEach((y) => {
562
- var L, b;
563
- this.isValidLookup(s) || (o = y, !Me[`${p[0]}-${y}`] && ((L = this.utils) != null && L.hasLoadedNamespace) && !((b = this.utils) != null && b.hasLoadedNamespace(o)) && (Me[`${p[0]}-${y}`] = !0, this.logger.warn(`key "${n}" for languages "${p.join(", ")}" won't get resolved as namespace "${o}" was not yet loaded`, "This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!")), p.forEach((S) => {
564
- var A;
565
- if (this.isValidLookup(s))
566
- return;
567
- i = S;
568
- const w = [d];
569
- if ((A = this.i18nFormat) != null && A.addLookupKeys)
570
- this.i18nFormat.addLookupKeys(w, d, S, y, t);
571
- else {
572
- let P;
573
- m && (P = this.pluralResolver.getSuffix(S, t.count, t));
574
- const E = `${this.options.pluralSeparator}zero`, v = `${this.options.pluralSeparator}ordinal${this.options.pluralSeparator}`;
575
- if (m && (t.ordinal && P.indexOf(v) === 0 && w.push(d + P.replace(v, this.options.pluralSeparator)), w.push(d + P), g && w.push(d + E)), h) {
576
- const N = `${d}${this.options.contextSeparator || "_"}${t.context}`;
577
- w.push(N), m && (t.ordinal && P.indexOf(v) === 0 && w.push(N + P.replace(v, this.options.pluralSeparator)), w.push(N + P), g && w.push(N + E));
578
- }
579
- }
580
- let C;
581
- for (; C = w.pop(); )
582
- this.isValidLookup(s) || (a = C, s = this.getResource(S, y, C, t));
583
- }));
584
- });
585
- }), {
586
- res: s,
587
- usedKey: n,
588
- exactUsedKey: a,
589
- usedLng: i,
590
- usedNS: o
591
- };
592
- }
593
- isValidLookup(e) {
594
- return e !== void 0 && !(!this.options.returnNull && e === null) && !(!this.options.returnEmptyString && e === "");
595
- }
596
- getResource(e, t, s, n = {}) {
597
- var a;
598
- return (a = this.i18nFormat) != null && a.getResource ? this.i18nFormat.getResource(e, t, s, n) : this.resourceStore.getResource(e, t, s, n);
599
- }
600
- getUsedParamsDetails(e = {}) {
601
- const t = ["defaultValue", "ordinal", "context", "replace", "lng", "lngs", "fallbackLng", "ns", "keySeparator", "nsSeparator", "returnObjects", "returnDetails", "joinArrays", "postProcess", "interpolation"], s = e.replace && !x(e.replace);
602
- let n = s ? e.replace : e;
603
- if (s && typeof e.count < "u" && (n.count = e.count), this.options.interpolation.defaultVariables && (n = {
604
- ...this.options.interpolation.defaultVariables,
605
- ...n
606
- }), !s) {
607
- n = {
608
- ...n
609
- };
610
- for (const a of t)
611
- delete n[a];
612
- }
613
- return n;
614
- }
615
- static hasDefaultValue(e) {
616
- const t = "defaultValue";
617
- for (const s in e)
618
- if (Object.prototype.hasOwnProperty.call(e, s) && t === s.substring(0, t.length) && e[s] !== void 0)
619
- return !0;
620
- return !1;
621
- }
622
- }
623
- class Te {
624
- constructor(e) {
625
- this.options = e, this.supportedLngs = this.options.supportedLngs || !1, this.logger = B.create("languageUtils");
626
- }
627
- getScriptPartFromCode(e) {
628
- if (e = ne(e), !e || e.indexOf("-") < 0)
629
- return null;
630
- const t = e.split("-");
631
- return t.length === 2 || (t.pop(), t[t.length - 1].toLowerCase() === "x") ? null : this.formatLanguageCode(t.join("-"));
632
- }
633
- getLanguagePartFromCode(e) {
634
- if (e = ne(e), !e || e.indexOf("-") < 0)
635
- return e;
636
- const t = e.split("-");
637
- return this.formatLanguageCode(t[0]);
638
- }
639
- formatLanguageCode(e) {
640
- if (x(e) && e.indexOf("-") > -1) {
641
- let t;
642
- try {
643
- t = Intl.getCanonicalLocales(e)[0];
644
- } catch {
645
- }
646
- return t && this.options.lowerCaseLng && (t = t.toLowerCase()), t || (this.options.lowerCaseLng ? e.toLowerCase() : e);
647
- }
648
- return this.options.cleanCode || this.options.lowerCaseLng ? e.toLowerCase() : e;
649
- }
650
- isSupportedCode(e) {
651
- return (this.options.load === "languageOnly" || this.options.nonExplicitSupportedLngs) && (e = this.getLanguagePartFromCode(e)), !this.supportedLngs || !this.supportedLngs.length || this.supportedLngs.indexOf(e) > -1;
652
- }
653
- getBestMatchFromCodes(e) {
654
- if (!e)
655
- return null;
656
- let t;
657
- return e.forEach((s) => {
658
- if (t)
659
- return;
660
- const n = this.formatLanguageCode(s);
661
- (!this.options.supportedLngs || this.isSupportedCode(n)) && (t = n);
662
- }), !t && this.options.supportedLngs && e.forEach((s) => {
663
- if (t)
664
- return;
665
- const n = this.getScriptPartFromCode(s);
666
- if (this.isSupportedCode(n))
667
- return t = n;
668
- const a = this.getLanguagePartFromCode(s);
669
- if (this.isSupportedCode(a))
670
- return t = a;
671
- t = this.options.supportedLngs.find((i) => {
672
- if (i === a)
673
- return i;
674
- if (!(i.indexOf("-") < 0 && a.indexOf("-") < 0) && (i.indexOf("-") > 0 && a.indexOf("-") < 0 && i.substring(0, i.indexOf("-")) === a || i.indexOf(a) === 0 && a.length > 1))
675
- return i;
676
- });
677
- }), t || (t = this.getFallbackCodes(this.options.fallbackLng)[0]), t;
678
- }
679
- getFallbackCodes(e, t) {
680
- if (!e)
681
- return [];
682
- if (typeof e == "function" && (e = e(t)), x(e) && (e = [e]), Array.isArray(e))
683
- return e;
684
- if (!t)
685
- return e.default || [];
686
- let s = e[t];
687
- return s || (s = e[this.getScriptPartFromCode(t)]), s || (s = e[this.formatLanguageCode(t)]), s || (s = e[this.getLanguagePartFromCode(t)]), s || (s = e.default), s || [];
688
- }
689
- toResolveHierarchy(e, t) {
690
- const s = this.getFallbackCodes((t === !1 ? [] : t) || this.options.fallbackLng || [], e), n = [], a = (i) => {
691
- i && (this.isSupportedCode(i) ? n.push(i) : this.logger.warn(`rejecting language code not found in supportedLngs: ${i}`));
692
- };
693
- return x(e) && (e.indexOf("-") > -1 || e.indexOf("_") > -1) ? (this.options.load !== "languageOnly" && a(this.formatLanguageCode(e)), this.options.load !== "languageOnly" && this.options.load !== "currentOnly" && a(this.getScriptPartFromCode(e)), this.options.load !== "currentOnly" && a(this.getLanguagePartFromCode(e))) : x(e) && a(this.formatLanguageCode(e)), s.forEach((i) => {
694
- n.indexOf(i) < 0 && a(this.formatLanguageCode(i));
695
- }), n;
696
- }
697
- }
698
- const $e = {
699
- zero: 0,
700
- one: 1,
701
- two: 2,
702
- few: 3,
703
- many: 4,
704
- other: 5
705
- }, Re = {
706
- select: (r) => r === 1 ? "one" : "other",
707
- resolvedOptions: () => ({
708
- pluralCategories: ["one", "other"]
709
- })
710
- };
711
- class It {
712
- constructor(e, t = {}) {
713
- this.languageUtils = e, this.options = t, this.logger = B.create("pluralResolver"), this.pluralRulesCache = {};
714
- }
715
- clearCache() {
716
- this.pluralRulesCache = {};
717
- }
718
- getRule(e, t = {}) {
719
- const s = ne(e === "dev" ? "en" : e), n = t.ordinal ? "ordinal" : "cardinal", a = JSON.stringify({
720
- cleanedCode: s,
721
- type: n
722
- });
723
- if (a in this.pluralRulesCache)
724
- return this.pluralRulesCache[a];
725
- let i;
726
- try {
727
- i = new Intl.PluralRules(s, {
728
- type: n
729
- });
730
- } catch {
731
- if (!Intl)
732
- return this.logger.error("No Intl support, please use an Intl polyfill!"), Re;
733
- if (!e.match(/-|_/))
734
- return Re;
735
- const u = this.languageUtils.getLanguagePartFromCode(e);
736
- i = this.getRule(u, t);
737
- }
738
- return this.pluralRulesCache[a] = i, i;
739
- }
740
- needsPlural(e, t = {}) {
741
- let s = this.getRule(e, t);
742
- return s || (s = this.getRule("dev", t)), (s == null ? void 0 : s.resolvedOptions().pluralCategories.length) > 1;
743
- }
744
- getPluralFormsOfKey(e, t, s = {}) {
745
- return this.getSuffixes(e, s).map((n) => `${t}${n}`);
746
- }
747
- getSuffixes(e, t = {}) {
748
- let s = this.getRule(e, t);
749
- return s || (s = this.getRule("dev", t)), s ? s.resolvedOptions().pluralCategories.sort((n, a) => $e[n] - $e[a]).map((n) => `${this.options.prepend}${t.ordinal ? `ordinal${this.options.prepend}` : ""}${n}`) : [];
750
- }
751
- getSuffix(e, t, s = {}) {
752
- const n = this.getRule(e, s);
753
- return n ? `${this.options.prepend}${s.ordinal ? `ordinal${this.options.prepend}` : ""}${n.select(t)}` : (this.logger.warn(`no plural rule found for: ${e}`), this.getSuffix("dev", t, s));
754
- }
755
- }
756
- const De = (r, e, t, s = ".", n = !0) => {
757
- let a = bt(r, e, t);
758
- return !a && n && x(t) && (a = ye(r, t, s), a === void 0 && (a = ye(e, t, s))), a;
759
- }, he = (r) => r.replace(/\$/g, "$$$$");
760
- class Ae {
761
- constructor(e = {}) {
762
- var t;
763
- this.logger = B.create("interpolator"), this.options = e, this.format = ((t = e == null ? void 0 : e.interpolation) == null ? void 0 : t.format) || ((s) => s), this.init(e);
764
- }
765
- init(e = {}) {
766
- e.interpolation || (e.interpolation = {
767
- escapeValue: !0
768
- });
769
- const {
770
- escape: t,
771
- escapeValue: s,
772
- useRawValueToEscape: n,
773
- prefix: a,
774
- prefixEscaped: i,
775
- suffix: o,
776
- suffixEscaped: u,
777
- formatSeparator: c,
778
- unescapeSuffix: d,
779
- unescapePrefix: f,
780
- nestingPrefix: m,
781
- nestingPrefixEscaped: g,
782
- nestingSuffix: h,
783
- nestingSuffixEscaped: p,
784
- nestingOptionsSeparator: y,
785
- maxReplaces: L,
786
- alwaysFormat: b
787
- } = e.interpolation;
788
- this.escape = t !== void 0 ? t : Nt, this.escapeValue = s !== void 0 ? s : !0, this.useRawValueToEscape = n !== void 0 ? n : !1, this.prefix = a ? Z(a) : i || "{{", this.suffix = o ? Z(o) : u || "}}", this.formatSeparator = c || ",", this.unescapePrefix = d ? "" : f || "-", this.unescapeSuffix = this.unescapePrefix ? "" : d || "", this.nestingPrefix = m ? Z(m) : g || Z("$t("), this.nestingSuffix = h ? Z(h) : p || Z(")"), this.nestingOptionsSeparator = y || ",", this.maxReplaces = L || 1e3, this.alwaysFormat = b !== void 0 ? b : !1, this.resetRegExp();
789
- }
790
- reset() {
791
- this.options && this.init(this.options);
792
- }
793
- resetRegExp() {
794
- const e = (t, s) => (t == null ? void 0 : t.source) === s ? (t.lastIndex = 0, t) : new RegExp(s, "g");
795
- this.regexp = e(this.regexp, `${this.prefix}(.+?)${this.suffix}`), this.regexpUnescape = e(this.regexpUnescape, `${this.prefix}${this.unescapePrefix}(.+?)${this.unescapeSuffix}${this.suffix}`), this.nestingRegexp = e(this.nestingRegexp, `${this.nestingPrefix}((?:[^()"']+|"[^"]*"|'[^']*'|\\((?:[^()]|"[^"]*"|'[^']*')*\\))*?)${this.nestingSuffix}`);
796
- }
797
- interpolate(e, t, s, n) {
798
- var g;
799
- let a, i, o;
800
- const u = this.options && this.options.interpolation && this.options.interpolation.defaultVariables || {}, c = (h) => {
801
- if (h.indexOf(this.formatSeparator) < 0) {
802
- const b = De(t, u, h, this.options.keySeparator, this.options.ignoreJSONStructure);
803
- return this.alwaysFormat ? this.format(b, void 0, s, {
804
- ...n,
805
- ...t,
806
- interpolationkey: h
807
- }) : b;
808
- }
809
- const p = h.split(this.formatSeparator), y = p.shift().trim(), L = p.join(this.formatSeparator).trim();
810
- return this.format(De(t, u, y, this.options.keySeparator, this.options.ignoreJSONStructure), L, s, {
811
- ...n,
812
- ...t,
813
- interpolationkey: y
814
- });
815
- };
816
- this.resetRegExp();
817
- const d = (n == null ? void 0 : n.missingInterpolationHandler) || this.options.missingInterpolationHandler, f = ((g = n == null ? void 0 : n.interpolation) == null ? void 0 : g.skipOnVariables) !== void 0 ? n.interpolation.skipOnVariables : this.options.interpolation.skipOnVariables;
818
- return [{
819
- regex: this.regexpUnescape,
820
- safeValue: (h) => he(h)
821
- }, {
822
- regex: this.regexp,
823
- safeValue: (h) => this.escapeValue ? he(this.escape(h)) : he(h)
824
- }].forEach((h) => {
825
- for (o = 0; a = h.regex.exec(e); ) {
826
- const p = a[1].trim();
827
- if (i = c(p), i === void 0)
828
- if (typeof d == "function") {
829
- const L = d(e, a, n);
830
- i = x(L) ? L : "";
831
- } else if (n && Object.prototype.hasOwnProperty.call(n, p))
832
- i = "";
833
- else if (f) {
834
- i = a[0];
835
- continue;
836
- } else
837
- this.logger.warn(`missed to pass in variable ${p} for interpolating ${e}`), i = "";
838
- else
839
- !x(i) && !this.useRawValueToEscape && (i = ke(i));
840
- const y = h.safeValue(i);
841
- if (e = e.replace(a[0], y), f ? (h.regex.lastIndex += i.length, h.regex.lastIndex -= a[0].length) : h.regex.lastIndex = 0, o++, o >= this.maxReplaces)
842
- break;
843
- }
844
- }), e;
845
- }
846
- nest(e, t, s = {}) {
847
- let n, a, i;
848
- const o = (u, c) => {
849
- const d = this.nestingOptionsSeparator;
850
- if (u.indexOf(d) < 0)
851
- return u;
852
- const f = u.split(new RegExp(`${d}[ ]*{`));
853
- let m = `{${f[1]}`;
854
- u = f[0], m = this.interpolate(m, i);
855
- const g = m.match(/'/g), h = m.match(/"/g);
856
- (((g == null ? void 0 : g.length) ?? 0) % 2 === 0 && !h || h.length % 2 !== 0) && (m = m.replace(/'/g, '"'));
857
- try {
858
- i = JSON.parse(m), c && (i = {
859
- ...c,
860
- ...i
861
- });
862
- } catch (p) {
863
- return this.logger.warn(`failed parsing options string in nesting for key ${u}`, p), `${u}${d}${m}`;
864
- }
865
- return i.defaultValue && i.defaultValue.indexOf(this.prefix) > -1 && delete i.defaultValue, u;
866
- };
867
- for (; n = this.nestingRegexp.exec(e); ) {
868
- let u = [];
869
- i = {
870
- ...s
871
- }, i = i.replace && !x(i.replace) ? i.replace : i, i.applyPostProcessor = !1, delete i.defaultValue;
872
- const c = /{.*}/.test(n[1]) ? n[1].lastIndexOf("}") + 1 : n[1].indexOf(this.formatSeparator);
873
- if (c !== -1 && (u = n[1].slice(c).split(this.formatSeparator).map((d) => d.trim()).filter(Boolean), n[1] = n[1].slice(0, c)), a = t(o.call(this, n[1].trim(), i), i), a && n[0] === e && !x(a))
874
- return a;
875
- x(a) || (a = ke(a)), a || (this.logger.warn(`missed to resolve ${n[1]} for nesting ${e}`), a = ""), u.length && (a = u.reduce((d, f) => this.format(d, f, s.lng, {
876
- ...s,
877
- interpolationkey: n[1].trim()
878
- }), a.trim())), e = e.replace(n[0], a), this.regexp.lastIndex = 0;
879
- }
880
- return e;
881
- }
882
- }
883
- const Ot = (r) => {
884
- let e = r.toLowerCase().trim();
885
- const t = {};
886
- if (r.indexOf("(") > -1) {
887
- const s = r.split("(");
888
- e = s[0].toLowerCase().trim();
889
- const n = s[1].substring(0, s[1].length - 1);
890
- e === "currency" && n.indexOf(":") < 0 ? t.currency || (t.currency = n.trim()) : e === "relativetime" && n.indexOf(":") < 0 ? t.range || (t.range = n.trim()) : n.split(";").forEach((i) => {
891
- if (i) {
892
- const [o, ...u] = i.split(":"), c = u.join(":").trim().replace(/^'+|'+$/g, ""), d = o.trim();
893
- t[d] || (t[d] = c), c === "false" && (t[d] = !1), c === "true" && (t[d] = !0), isNaN(c) || (t[d] = parseInt(c, 10));
894
- }
895
- });
896
- }
897
- return {
898
- formatName: e,
899
- formatOptions: t
900
- };
901
- }, Ue = (r) => {
902
- const e = {};
903
- return (t, s, n) => {
904
- let a = n;
905
- n && n.interpolationkey && n.formatParams && n.formatParams[n.interpolationkey] && n[n.interpolationkey] && (a = {
906
- ...a,
907
- [n.interpolationkey]: void 0
908
- });
909
- const i = s + JSON.stringify(a);
910
- let o = e[i];
911
- return o || (o = r(ne(s), n), e[i] = o), o(t);
912
- };
913
- }, jt = (r) => (e, t, s) => r(ne(t), s)(e);
914
- class Pt {
915
- constructor(e = {}) {
916
- this.logger = B.create("formatter"), this.options = e, this.init(e);
917
- }
918
- init(e, t = {
919
- interpolation: {}
920
- }) {
921
- this.formatSeparator = t.interpolation.formatSeparator || ",";
922
- const s = t.cacheInBuiltFormats ? Ue : jt;
923
- this.formats = {
924
- number: s((n, a) => {
925
- const i = new Intl.NumberFormat(n, {
926
- ...a
927
- });
928
- return (o) => i.format(o);
929
- }),
930
- currency: s((n, a) => {
931
- const i = new Intl.NumberFormat(n, {
932
- ...a,
933
- style: "currency"
934
- });
935
- return (o) => i.format(o);
936
- }),
937
- datetime: s((n, a) => {
938
- const i = new Intl.DateTimeFormat(n, {
939
- ...a
940
- });
941
- return (o) => i.format(o);
942
- }),
943
- relativetime: s((n, a) => {
944
- const i = new Intl.RelativeTimeFormat(n, {
945
- ...a
946
- });
947
- return (o) => i.format(o, a.range || "day");
948
- }),
949
- list: s((n, a) => {
950
- const i = new Intl.ListFormat(n, {
951
- ...a
952
- });
953
- return (o) => i.format(o);
954
- })
955
- };
956
- }
957
- add(e, t) {
958
- this.formats[e.toLowerCase().trim()] = t;
959
- }
960
- addCached(e, t) {
961
- this.formats[e.toLowerCase().trim()] = Ue(t);
962
- }
963
- format(e, t, s, n = {}) {
964
- const a = t.split(this.formatSeparator);
965
- if (a.length > 1 && a[0].indexOf("(") > 1 && a[0].indexOf(")") < 0 && a.find((o) => o.indexOf(")") > -1)) {
966
- const o = a.findIndex((u) => u.indexOf(")") > -1);
967
- a[0] = [a[0], ...a.splice(1, o)].join(this.formatSeparator);
968
- }
969
- return a.reduce((o, u) => {
970
- var f;
971
- const {
972
- formatName: c,
973
- formatOptions: d
974
- } = Ot(u);
975
- if (this.formats[c]) {
976
- let m = o;
977
- try {
978
- const g = ((f = n == null ? void 0 : n.formatParams) == null ? void 0 : f[n.interpolationkey]) || {}, h = g.locale || g.lng || n.locale || n.lng || s;
979
- m = this.formats[c](o, h, {
980
- ...d,
981
- ...n,
982
- ...g
983
- });
984
- } catch (g) {
985
- this.logger.warn(g);
986
- }
987
- return m;
988
- } else
989
- this.logger.warn(`there was no format function for ${c}`);
990
- return o;
991
- }, e);
992
- }
993
- }
994
- const Mt = (r, e) => {
995
- r.pending[e] !== void 0 && (delete r.pending[e], r.pendingCount--);
996
- };
997
- class Tt extends ue {
998
- constructor(e, t, s, n = {}) {
999
- var a, i;
1000
- super(), this.backend = e, this.store = t, this.services = s, this.languageUtils = s.languageUtils, this.options = n, this.logger = B.create("backendConnector"), this.waitingReads = [], this.maxParallelReads = n.maxParallelReads || 10, this.readingCalls = 0, this.maxRetries = n.maxRetries >= 0 ? n.maxRetries : 5, this.retryTimeout = n.retryTimeout >= 1 ? n.retryTimeout : 350, this.state = {}, this.queue = [], (i = (a = this.backend) == null ? void 0 : a.init) == null || i.call(a, s, n.backend, n);
1001
- }
1002
- queueLoad(e, t, s, n) {
1003
- const a = {}, i = {}, o = {}, u = {};
1004
- return e.forEach((c) => {
1005
- let d = !0;
1006
- t.forEach((f) => {
1007
- const m = `${c}|${f}`;
1008
- !s.reload && this.store.hasResourceBundle(c, f) ? this.state[m] = 2 : this.state[m] < 0 || (this.state[m] === 1 ? i[m] === void 0 && (i[m] = !0) : (this.state[m] = 1, d = !1, i[m] === void 0 && (i[m] = !0), a[m] === void 0 && (a[m] = !0), u[f] === void 0 && (u[f] = !0)));
1009
- }), d || (o[c] = !0);
1010
- }), (Object.keys(a).length || Object.keys(i).length) && this.queue.push({
1011
- pending: i,
1012
- pendingCount: Object.keys(i).length,
1013
- loaded: {},
1014
- errors: [],
1015
- callback: n
1016
- }), {
1017
- toLoad: Object.keys(a),
1018
- pending: Object.keys(i),
1019
- toLoadLanguages: Object.keys(o),
1020
- toLoadNamespaces: Object.keys(u)
1021
- };
1022
- }
1023
- loaded(e, t, s) {
1024
- const n = e.split("|"), a = n[0], i = n[1];
1025
- t && this.emit("failedLoading", a, i, t), !t && s && this.store.addResourceBundle(a, i, s, void 0, void 0, {
1026
- skipCopy: !0
1027
- }), this.state[e] = t ? -1 : 2, t && s && (this.state[e] = 0);
1028
- const o = {};
1029
- this.queue.forEach((u) => {
1030
- yt(u.loaded, [a], i), Mt(u, e), t && u.errors.push(t), u.pendingCount === 0 && !u.done && (Object.keys(u.loaded).forEach((c) => {
1031
- o[c] || (o[c] = {});
1032
- const d = u.loaded[c];
1033
- d.length && d.forEach((f) => {
1034
- o[c][f] === void 0 && (o[c][f] = !0);
1035
- });
1036
- }), u.done = !0, u.errors.length ? u.callback(u.errors) : u.callback());
1037
- }), this.emit("loaded", o), this.queue = this.queue.filter((u) => !u.done);
1038
- }
1039
- read(e, t, s, n = 0, a = this.retryTimeout, i) {
1040
- if (!e.length)
1041
- return i(null, {});
1042
- if (this.readingCalls >= this.maxParallelReads) {
1043
- this.waitingReads.push({
1044
- lng: e,
1045
- ns: t,
1046
- fcName: s,
1047
- tried: n,
1048
- wait: a,
1049
- callback: i
1050
- });
1051
- return;
1052
- }
1053
- this.readingCalls++;
1054
- const o = (c, d) => {
1055
- if (this.readingCalls--, this.waitingReads.length > 0) {
1056
- const f = this.waitingReads.shift();
1057
- this.read(f.lng, f.ns, f.fcName, f.tried, f.wait, f.callback);
1058
- }
1059
- if (c && d && n < this.maxRetries) {
1060
- setTimeout(() => {
1061
- this.read.call(this, e, t, s, n + 1, a * 2, i);
1062
- }, a);
1063
- return;
1064
- }
1065
- i(c, d);
1066
- }, u = this.backend[s].bind(this.backend);
1067
- if (u.length === 2) {
1068
- try {
1069
- const c = u(e, t);
1070
- c && typeof c.then == "function" ? c.then((d) => o(null, d)).catch(o) : o(null, c);
1071
- } catch (c) {
1072
- o(c);
1073
- }
1074
- return;
1075
- }
1076
- return u(e, t, o);
1077
- }
1078
- prepareLoading(e, t, s = {}, n) {
1079
- if (!this.backend)
1080
- return this.logger.warn("No backend was added via i18next.use. Will not load resources."), n && n();
1081
- x(e) && (e = this.languageUtils.toResolveHierarchy(e)), x(t) && (t = [t]);
1082
- const a = this.queueLoad(e, t, s, n);
1083
- if (!a.toLoad.length)
1084
- return a.pending.length || n(), null;
1085
- a.toLoad.forEach((i) => {
1086
- this.loadOne(i);
1087
- });
1088
- }
1089
- load(e, t, s) {
1090
- this.prepareLoading(e, t, {}, s);
1091
- }
1092
- reload(e, t, s) {
1093
- this.prepareLoading(e, t, {
1094
- reload: !0
1095
- }, s);
1096
- }
1097
- loadOne(e, t = "") {
1098
- const s = e.split("|"), n = s[0], a = s[1];
1099
- this.read(n, a, "read", void 0, void 0, (i, o) => {
1100
- i && this.logger.warn(`${t}loading namespace ${a} for language ${n} failed`, i), !i && o && this.logger.log(`${t}loaded namespace ${a} for language ${n}`, o), this.loaded(e, i, o);
1101
- });
1102
- }
1103
- saveMissing(e, t, s, n, a, i = {}, o = () => {
1104
- }) {
1105
- var u, c, d, f, m;
1106
- if ((c = (u = this.services) == null ? void 0 : u.utils) != null && c.hasLoadedNamespace && !((f = (d = this.services) == null ? void 0 : d.utils) != null && f.hasLoadedNamespace(t))) {
1107
- this.logger.warn(`did not save key "${s}" as the namespace "${t}" was not yet loaded`, "This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!");
1108
- return;
1109
- }
1110
- if (!(s == null || s === "")) {
1111
- if ((m = this.backend) != null && m.create) {
1112
- const g = {
1113
- ...i,
1114
- isUpdate: a
1115
- }, h = this.backend.create.bind(this.backend);
1116
- if (h.length < 6)
1117
- try {
1118
- let p;
1119
- h.length === 5 ? p = h(e, t, s, n, g) : p = h(e, t, s, n), p && typeof p.then == "function" ? p.then((y) => o(null, y)).catch(o) : o(null, p);
1120
- } catch (p) {
1121
- o(p);
1122
- }
1123
- else
1124
- h(e, t, s, n, o, g);
1125
- }
1126
- !e || !e[0] || this.store.addResource(e[0], t, s, n);
1127
- }
1128
- }
1129
- }
1130
- const ge = () => ({
1131
- debug: !1,
1132
- initAsync: !0,
1133
- ns: ["translation"],
1134
- defaultNS: ["translation"],
1135
- fallbackLng: ["dev"],
1136
- fallbackNS: !1,
1137
- supportedLngs: !1,
1138
- nonExplicitSupportedLngs: !1,
1139
- load: "all",
1140
- preload: !1,
1141
- simplifyPluralSuffix: !0,
1142
- keySeparator: ".",
1143
- nsSeparator: ":",
1144
- pluralSeparator: "_",
1145
- contextSeparator: "_",
1146
- partialBundledLanguages: !1,
1147
- saveMissing: !1,
1148
- updateMissing: !1,
1149
- saveMissingTo: "fallback",
1150
- saveMissingPlurals: !0,
1151
- missingKeyHandler: !1,
1152
- missingInterpolationHandler: !1,
1153
- postProcess: !1,
1154
- postProcessPassResolved: !1,
1155
- returnNull: !1,
1156
- returnEmptyString: !0,
1157
- returnObjects: !1,
1158
- joinArrays: !1,
1159
- returnedObjectHandler: !1,
1160
- parseMissingKeyHandler: !1,
1161
- appendNamespaceToMissingKey: !1,
1162
- appendNamespaceToCIMode: !1,
1163
- overloadTranslationOptionHandler: (r) => {
1164
- let e = {};
1165
- if (typeof r[1] == "object" && (e = r[1]), x(r[1]) && (e.defaultValue = r[1]), x(r[2]) && (e.tDescription = r[2]), typeof r[2] == "object" || typeof r[3] == "object") {
1166
- const t = r[3] || r[2];
1167
- Object.keys(t).forEach((s) => {
1168
- e[s] = t[s];
1169
- });
1170
- }
1171
- return e;
1172
- },
1173
- interpolation: {
1174
- escapeValue: !0,
1175
- format: (r) => r,
1176
- prefix: "{{",
1177
- suffix: "}}",
1178
- formatSeparator: ",",
1179
- unescapePrefix: "-",
1180
- nestingPrefix: "$t(",
1181
- nestingSuffix: ")",
1182
- nestingOptionsSeparator: ",",
1183
- maxReplaces: 1e3,
1184
- skipOnVariables: !0
1185
- },
1186
- cacheInBuiltFormats: !0
1187
- }), Fe = (r) => {
1188
- var e, t;
1189
- return x(r.ns) && (r.ns = [r.ns]), x(r.fallbackLng) && (r.fallbackLng = [r.fallbackLng]), x(r.fallbackNS) && (r.fallbackNS = [r.fallbackNS]), ((t = (e = r.supportedLngs) == null ? void 0 : e.indexOf) == null ? void 0 : t.call(e, "cimode")) < 0 && (r.supportedLngs = r.supportedLngs.concat(["cimode"])), typeof r.initImmediate == "boolean" && (r.initAsync = r.initImmediate), r;
1190
- }, re = () => {
1191
- }, $t = (r) => {
1192
- Object.getOwnPropertyNames(Object.getPrototypeOf(r)).forEach((t) => {
1193
- typeof r[t] == "function" && (r[t] = r[t].bind(r));
1194
- });
1195
- };
1196
- class te extends ue {
1197
- constructor(e = {}, t) {
1198
- if (super(), this.options = Fe(e), this.services = {}, this.logger = B, this.modules = {
1199
- external: []
1200
- }, $t(this), t && !this.isInitialized && !e.isClone) {
1201
- if (!this.options.initAsync)
1202
- return this.init(e, t), this;
1203
- setTimeout(() => {
1204
- this.init(e, t);
1205
- }, 0);
1206
- }
1207
- }
1208
- init(e = {}, t) {
1209
- this.isInitializing = !0, typeof e == "function" && (t = e, e = {}), e.defaultNS == null && e.ns && (x(e.ns) ? e.defaultNS = e.ns : e.ns.indexOf("translation") < 0 && (e.defaultNS = e.ns[0]));
1210
- const s = ge();
1211
- this.options = {
1212
- ...s,
1213
- ...this.options,
1214
- ...Fe(e)
1215
- }, this.options.interpolation = {
1216
- ...s.interpolation,
1217
- ...this.options.interpolation
1218
- }, e.keySeparator !== void 0 && (this.options.userDefinedKeySeparator = e.keySeparator), e.nsSeparator !== void 0 && (this.options.userDefinedNsSeparator = e.nsSeparator), typeof this.options.overloadTranslationOptionHandler != "function" && (this.options.overloadTranslationOptionHandler = s.overloadTranslationOptionHandler), this.options.debug === !0 && typeof console < "u" && console.warn("i18next is maintained with support from locize.com — consider powering your project with managed localization (AI, CDN, integrations): https://locize.com");
1219
- const n = (c) => c ? typeof c == "function" ? new c() : c : null;
1220
- if (!this.options.isClone) {
1221
- this.modules.logger ? B.init(n(this.modules.logger), this.options) : B.init(null, this.options);
1222
- let c;
1223
- this.modules.formatter ? c = this.modules.formatter : c = Pt;
1224
- const d = new Te(this.options);
1225
- this.store = new Pe(this.options.resources, this.options);
1226
- const f = this.services;
1227
- f.logger = B, f.resourceStore = this.store, f.languageUtils = d, f.pluralResolver = new It(d, {
1228
- prepend: this.options.pluralSeparator,
1229
- simplifyPluralSuffix: this.options.simplifyPluralSuffix
1230
- }), this.options.interpolation.format && this.options.interpolation.format !== s.interpolation.format && this.logger.deprecate("init: you are still using the legacy format function, please use the new approach: https://www.i18next.com/translation-function/formatting"), c && (!this.options.interpolation.format || this.options.interpolation.format === s.interpolation.format) && (f.formatter = n(c), f.formatter.init && f.formatter.init(f, this.options), this.options.interpolation.format = f.formatter.format.bind(f.formatter)), f.interpolator = new Ae(this.options), f.utils = {
1231
- hasLoadedNamespace: this.hasLoadedNamespace.bind(this)
1232
- }, f.backendConnector = new Tt(n(this.modules.backend), f.resourceStore, f, this.options), f.backendConnector.on("*", (g, ...h) => {
1233
- this.emit(g, ...h);
1234
- }), this.modules.languageDetector && (f.languageDetector = n(this.modules.languageDetector), f.languageDetector.init && f.languageDetector.init(f, this.options.detection, this.options)), this.modules.i18nFormat && (f.i18nFormat = n(this.modules.i18nFormat), f.i18nFormat.init && f.i18nFormat.init(this)), this.translator = new ce(this.services, this.options), this.translator.on("*", (g, ...h) => {
1235
- this.emit(g, ...h);
1236
- }), this.modules.external.forEach((g) => {
1237
- g.init && g.init(this);
1238
- });
1239
- }
1240
- if (this.format = this.options.interpolation.format, t || (t = re), this.options.fallbackLng && !this.services.languageDetector && !this.options.lng) {
1241
- const c = this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);
1242
- c.length > 0 && c[0] !== "dev" && (this.options.lng = c[0]);
1243
- }
1244
- !this.services.languageDetector && !this.options.lng && this.logger.warn("init: no languageDetector is used and no lng is defined"), ["getResource", "hasResourceBundle", "getResourceBundle", "getDataByLanguage"].forEach((c) => {
1245
- this[c] = (...d) => this.store[c](...d);
1246
- }), ["addResource", "addResources", "addResourceBundle", "removeResourceBundle"].forEach((c) => {
1247
- this[c] = (...d) => (this.store[c](...d), this);
1248
- });
1249
- const o = X(), u = () => {
1250
- const c = (d, f) => {
1251
- this.isInitializing = !1, this.isInitialized && !this.initializedStoreOnce && this.logger.warn("init: i18next is already initialized. You should call init just once!"), this.isInitialized = !0, this.options.isClone || this.logger.log("initialized", this.options), this.emit("initialized", this.options), o.resolve(f), t(d, f);
1252
- };
1253
- if (this.languages && !this.isInitialized)
1254
- return c(null, this.t.bind(this));
1255
- this.changeLanguage(this.options.lng, c);
1256
- };
1257
- return this.options.resources || !this.options.initAsync ? u() : setTimeout(u, 0), o;
1258
- }
1259
- loadResources(e, t = re) {
1260
- var a, i;
1261
- let s = t;
1262
- const n = x(e) ? e : this.language;
1263
- if (typeof e == "function" && (s = e), !this.options.resources || this.options.partialBundledLanguages) {
1264
- if ((n == null ? void 0 : n.toLowerCase()) === "cimode" && (!this.options.preload || this.options.preload.length === 0))
1265
- return s();
1266
- const o = [], u = (c) => {
1267
- if (!c || c === "cimode")
1268
- return;
1269
- this.services.languageUtils.toResolveHierarchy(c).forEach((f) => {
1270
- f !== "cimode" && o.indexOf(f) < 0 && o.push(f);
1271
- });
1272
- };
1273
- n ? u(n) : this.services.languageUtils.getFallbackCodes(this.options.fallbackLng).forEach((d) => u(d)), (i = (a = this.options.preload) == null ? void 0 : a.forEach) == null || i.call(a, (c) => u(c)), this.services.backendConnector.load(o, this.options.ns, (c) => {
1274
- !c && !this.resolvedLanguage && this.language && this.setResolvedLanguage(this.language), s(c);
1275
- });
1276
- } else
1277
- s(null);
1278
- }
1279
- reloadResources(e, t, s) {
1280
- const n = X();
1281
- return typeof e == "function" && (s = e, e = void 0), typeof t == "function" && (s = t, t = void 0), e || (e = this.languages), t || (t = this.options.ns), s || (s = re), this.services.backendConnector.reload(e, t, (a) => {
1282
- n.resolve(), s(a);
1283
- }), n;
1284
- }
1285
- use(e) {
1286
- if (!e)
1287
- throw new Error("You are passing an undefined module! Please check the object you are passing to i18next.use()");
1288
- if (!e.type)
1289
- throw new Error("You are passing a wrong module! Please check the object you are passing to i18next.use()");
1290
- return e.type === "backend" && (this.modules.backend = e), (e.type === "logger" || e.log && e.warn && e.error) && (this.modules.logger = e), e.type === "languageDetector" && (this.modules.languageDetector = e), e.type === "i18nFormat" && (this.modules.i18nFormat = e), e.type === "postProcessor" && _e.addPostProcessor(e), e.type === "formatter" && (this.modules.formatter = e), e.type === "3rdParty" && this.modules.external.push(e), this;
1291
- }
1292
- setResolvedLanguage(e) {
1293
- if (!(!e || !this.languages) && !(["cimode", "dev"].indexOf(e) > -1)) {
1294
- for (let t = 0; t < this.languages.length; t++) {
1295
- const s = this.languages[t];
1296
- if (!(["cimode", "dev"].indexOf(s) > -1) && this.store.hasLanguageSomeTranslations(s)) {
1297
- this.resolvedLanguage = s;
1298
- break;
1299
- }
1300
- }
1301
- !this.resolvedLanguage && this.languages.indexOf(e) < 0 && this.store.hasLanguageSomeTranslations(e) && (this.resolvedLanguage = e, this.languages.unshift(e));
1302
- }
1303
- }
1304
- changeLanguage(e, t) {
1305
- this.isLanguageChangingTo = e;
1306
- const s = X();
1307
- this.emit("languageChanging", e);
1308
- const n = (o) => {
1309
- this.language = o, this.languages = this.services.languageUtils.toResolveHierarchy(o), this.resolvedLanguage = void 0, this.setResolvedLanguage(o);
1310
- }, a = (o, u) => {
1311
- u ? this.isLanguageChangingTo === e && (n(u), this.translator.changeLanguage(u), this.isLanguageChangingTo = void 0, this.emit("languageChanged", u), this.logger.log("languageChanged", u)) : this.isLanguageChangingTo = void 0, s.resolve((...c) => this.t(...c)), t && t(o, (...c) => this.t(...c));
1312
- }, i = (o) => {
1313
- var d, f;
1314
- !e && !o && this.services.languageDetector && (o = []);
1315
- const u = x(o) ? o : o && o[0], c = this.store.hasLanguageSomeTranslations(u) ? u : this.services.languageUtils.getBestMatchFromCodes(x(o) ? [o] : o);
1316
- c && (this.language || n(c), this.translator.language || this.translator.changeLanguage(c), (f = (d = this.services.languageDetector) == null ? void 0 : d.cacheUserLanguage) == null || f.call(d, c)), this.loadResources(c, (m) => {
1317
- a(m, c);
1318
- });
1319
- };
1320
- return !e && this.services.languageDetector && !this.services.languageDetector.async ? i(this.services.languageDetector.detect()) : !e && this.services.languageDetector && this.services.languageDetector.async ? this.services.languageDetector.detect.length === 0 ? this.services.languageDetector.detect().then(i) : this.services.languageDetector.detect(i) : i(e), s;
1321
- }
1322
- getFixedT(e, t, s) {
1323
- const n = (a, i, ...o) => {
1324
- let u;
1325
- typeof i != "object" ? u = this.options.overloadTranslationOptionHandler([a, i].concat(o)) : u = {
1326
- ...i
1327
- }, u.lng = u.lng || n.lng, u.lngs = u.lngs || n.lngs, u.ns = u.ns || n.ns, u.keyPrefix !== "" && (u.keyPrefix = u.keyPrefix || s || n.keyPrefix);
1328
- const c = this.options.keySeparator || ".";
1329
- let d;
1330
- return u.keyPrefix && Array.isArray(a) ? d = a.map((f) => (typeof f == "function" && (f = be(f, {
1331
- ...this.options,
1332
- ...i
1333
- })), `${u.keyPrefix}${c}${f}`)) : (typeof a == "function" && (a = be(a, {
1334
- ...this.options,
1335
- ...i
1336
- })), d = u.keyPrefix ? `${u.keyPrefix}${c}${a}` : a), this.t(d, u);
1337
- };
1338
- return x(e) ? n.lng = e : n.lngs = e, n.ns = t, n.keyPrefix = s, n;
1339
- }
1340
- t(...e) {
1341
- var t;
1342
- return (t = this.translator) == null ? void 0 : t.translate(...e);
1343
- }
1344
- exists(...e) {
1345
- var t;
1346
- return (t = this.translator) == null ? void 0 : t.exists(...e);
1347
- }
1348
- setDefaultNamespace(e) {
1349
- this.options.defaultNS = e;
1350
- }
1351
- hasLoadedNamespace(e, t = {}) {
1352
- if (!this.isInitialized)
1353
- return this.logger.warn("hasLoadedNamespace: i18next was not initialized", this.languages), !1;
1354
- if (!this.languages || !this.languages.length)
1355
- return this.logger.warn("hasLoadedNamespace: i18n.languages were undefined or empty", this.languages), !1;
1356
- const s = t.lng || this.resolvedLanguage || this.languages[0], n = this.options ? this.options.fallbackLng : !1, a = this.languages[this.languages.length - 1];
1357
- if (s.toLowerCase() === "cimode")
1358
- return !0;
1359
- const i = (o, u) => {
1360
- const c = this.services.backendConnector.state[`${o}|${u}`];
1361
- return c === -1 || c === 0 || c === 2;
1362
- };
1363
- if (t.precheck) {
1364
- const o = t.precheck(this, i);
1365
- if (o !== void 0)
1366
- return o;
1367
- }
1368
- return !!(this.hasResourceBundle(s, e) || !this.services.backendConnector.backend || this.options.resources && !this.options.partialBundledLanguages || i(s, e) && (!n || i(a, e)));
1369
- }
1370
- loadNamespaces(e, t) {
1371
- const s = X();
1372
- return this.options.ns ? (x(e) && (e = [e]), e.forEach((n) => {
1373
- this.options.ns.indexOf(n) < 0 && this.options.ns.push(n);
1374
- }), this.loadResources((n) => {
1375
- s.resolve(), t && t(n);
1376
- }), s) : (t && t(), Promise.resolve());
1377
- }
1378
- loadLanguages(e, t) {
1379
- const s = X();
1380
- x(e) && (e = [e]);
1381
- const n = this.options.preload || [], a = e.filter((i) => n.indexOf(i) < 0 && this.services.languageUtils.isSupportedCode(i));
1382
- return a.length ? (this.options.preload = n.concat(a), this.loadResources((i) => {
1383
- s.resolve(), t && t(i);
1384
- }), s) : (t && t(), Promise.resolve());
1385
- }
1386
- dir(e) {
1387
- var n, a;
1388
- if (e || (e = this.resolvedLanguage || (((n = this.languages) == null ? void 0 : n.length) > 0 ? this.languages[0] : this.language)), !e)
1389
- return "rtl";
1390
- try {
1391
- const i = new Intl.Locale(e);
1392
- if (i && i.getTextInfo) {
1393
- const o = i.getTextInfo();
1394
- if (o && o.direction)
1395
- return o.direction;
1396
- }
1397
- } catch {
1398
- }
1399
- const t = ["ar", "shu", "sqr", "ssh", "xaa", "yhd", "yud", "aao", "abh", "abv", "acm", "acq", "acw", "acx", "acy", "adf", "ads", "aeb", "aec", "afb", "ajp", "apc", "apd", "arb", "arq", "ars", "ary", "arz", "auz", "avl", "ayh", "ayl", "ayn", "ayp", "bbz", "pga", "he", "iw", "ps", "pbt", "pbu", "pst", "prp", "prd", "ug", "ur", "ydd", "yds", "yih", "ji", "yi", "hbo", "men", "xmn", "fa", "jpr", "peo", "pes", "prs", "dv", "sam", "ckb"], s = ((a = this.services) == null ? void 0 : a.languageUtils) || new Te(ge());
1400
- return e.toLowerCase().indexOf("-latn") > 1 ? "ltr" : t.indexOf(s.getLanguagePartFromCode(e)) > -1 || e.toLowerCase().indexOf("-arab") > 1 ? "rtl" : "ltr";
1401
- }
1402
- static createInstance(e = {}, t) {
1403
- const s = new te(e, t);
1404
- return s.createInstance = te.createInstance, s;
1405
- }
1406
- cloneInstance(e = {}, t = re) {
1407
- const s = e.forkResourceStore;
1408
- s && delete e.forkResourceStore;
1409
- const n = {
1410
- ...this.options,
1411
- ...e,
1412
- isClone: !0
1413
- }, a = new te(n);
1414
- if ((e.debug !== void 0 || e.prefix !== void 0) && (a.logger = a.logger.clone(e)), ["store", "services", "language"].forEach((o) => {
1415
- a[o] = this[o];
1416
- }), a.services = {
1417
- ...this.services
1418
- }, a.services.utils = {
1419
- hasLoadedNamespace: a.hasLoadedNamespace.bind(a)
1420
- }, s) {
1421
- const o = Object.keys(this.store.data).reduce((u, c) => (u[c] = {
1422
- ...this.store.data[c]
1423
- }, u[c] = Object.keys(u[c]).reduce((d, f) => (d[f] = {
1424
- ...u[c][f]
1425
- }, d), u[c]), u), {});
1426
- a.store = new Pe(o, n), a.services.resourceStore = a.store;
1427
- }
1428
- if (e.interpolation) {
1429
- const u = {
1430
- ...ge().interpolation,
1431
- ...this.options.interpolation,
1432
- ...e.interpolation
1433
- }, c = {
1434
- ...n,
1435
- interpolation: u
1436
- };
1437
- a.services.interpolator = new Ae(c);
1438
- }
1439
- return a.translator = new ce(a.services, n), a.translator.on("*", (o, ...u) => {
1440
- a.emit(o, ...u);
1441
- }), a.init(n, t), a.translator.options = n, a.translator.backendConnector.services.utils = {
1442
- hasLoadedNamespace: a.hasLoadedNamespace.bind(a)
1443
- }, a;
1444
- }
1445
- toJSON() {
1446
- return {
1447
- options: this.options,
1448
- store: this.store,
1449
- language: this.language,
1450
- languages: this.languages,
1451
- resolvedLanguage: this.resolvedLanguage
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;
1452
79
  };
1453
- }
1454
- }
1455
- const z = te.createInstance();
1456
- z.createInstance;
1457
- z.dir;
1458
- z.init;
1459
- z.loadResources;
1460
- z.reloadResources;
1461
- z.use;
1462
- z.changeLanguage;
1463
- z.getFixedT;
1464
- z.t;
1465
- z.exists;
1466
- z.setDefaultNamespace;
1467
- z.hasLoadedNamespace;
1468
- z.loadNamespaces;
1469
- z.loadLanguages;
1470
- const Rt = (r, e, t, s) => {
1471
- var a, i, o, u;
1472
- const n = [t, {
1473
- code: e,
1474
- ...s || {}
1475
- }];
1476
- if ((i = (a = r == null ? void 0 : r.services) == null ? void 0 : a.logger) != null && i.forward)
1477
- return r.services.logger.forward(n, "warn", "react-i18next::", !0);
1478
- W(n[0]) && (n[0] = `react-i18next:: ${n[0]}`), (u = (o = r == null ? void 0 : r.services) == null ? void 0 : o.logger) != null && u.warn ? r.services.logger.warn(...n) : console != null && console.warn && console.warn(...n);
1479
- }, ze = {}, we = (r, e, t, s) => {
1480
- W(t) && ze[t] || (W(t) && (ze[t] = /* @__PURE__ */ new Date()), Rt(r, e, t, s));
1481
- }, qe = (r, e) => () => {
1482
- if (r.isInitialized)
1483
- e();
1484
- else {
1485
- const t = () => {
1486
- setTimeout(() => {
1487
- r.off("initialized", t);
1488
- }, 0), e();
1489
- };
1490
- r.on("initialized", t);
1491
- }
1492
- }, Ne = (r, e, t) => {
1493
- r.loadNamespaces(e, qe(r, t));
1494
- }, Ve = (r, e, t, s) => {
1495
- if (W(t) && (t = [t]), r.options.preload && r.options.preload.indexOf(e) > -1)
1496
- return Ne(r, t, s);
1497
- t.forEach((n) => {
1498
- r.options.ns.indexOf(n) < 0 && r.options.ns.push(n);
1499
- }), r.loadLanguages(e, qe(r, s));
1500
- }, Dt = (r, e, t = {}) => !e.languages || !e.languages.length ? (we(e, "NO_LANGUAGES", "i18n.languages were undefined or empty", {
1501
- languages: e.languages
1502
- }), !0) : e.hasLoadedNamespace(r, {
1503
- lng: t.lng,
1504
- precheck: (s, n) => {
1505
- if (t.bindI18n && t.bindI18n.indexOf("languageChanging") > -1 && s.services.backendConnector.backend && s.isLanguageChangingTo && !n(s.isLanguageChangingTo, r))
1506
- return !1;
1507
- }
1508
- }), W = (r) => typeof r == "string", At = (r) => typeof r == "object" && r !== null, Ut = /&(?:amp|#38|lt|#60|gt|#62|apos|#39|quot|#34|nbsp|#160|copy|#169|reg|#174|hellip|#8230|#x2F|#47);/g, Ft = {
1509
- "&amp;": "&",
1510
- "&#38;": "&",
1511
- "&lt;": "<",
1512
- "&#60;": "<",
1513
- "&gt;": ">",
1514
- "&#62;": ">",
1515
- "&apos;": "'",
1516
- "&#39;": "'",
1517
- "&quot;": '"',
1518
- "&#34;": '"',
1519
- "&nbsp;": " ",
1520
- "&#160;": " ",
1521
- "&copy;": "©",
1522
- "&#169;": "©",
1523
- "&reg;": "®",
1524
- "&#174;": "®",
1525
- "&hellip;": "…",
1526
- "&#8230;": "…",
1527
- "&#x2F;": "/",
1528
- "&#47;": "/"
1529
- }, zt = (r) => Ft[r], Vt = (r) => r.replace(Ut, zt);
1530
- let Bt = {
1531
- bindI18n: "languageChanged",
1532
- bindI18nStore: "",
1533
- transEmptyNodeValue: "",
1534
- transSupportBasicHtmlNodes: !0,
1535
- transWrapTextNodes: "",
1536
- transKeepBasicHtmlNodesFor: ["br", "strong", "i", "p"],
1537
- useSuspense: !0,
1538
- unescape: Vt
1539
- };
1540
- const Ht = () => Bt;
1541
- let Kt;
1542
- const Wt = () => Kt, Gt = He();
1543
- class Zt {
1544
- constructor() {
1545
- this.usedNamespaces = {};
1546
- }
1547
- addUsedNamespaces(e) {
1548
- e.forEach((t) => {
1549
- this.usedNamespaces[t] || (this.usedNamespaces[t] = !0);
1550
- });
1551
- }
1552
- getUsedNamespaces() {
1553
- return Object.keys(this.usedNamespaces);
1554
- }
1555
- }
1556
- const Yt = (r, e) => {
1557
- const t = We();
1558
- return K(() => {
1559
- t.current = e ? t.current : r;
1560
- }, [r, e]), t.current;
1561
- }, et = (r, e, t, s) => r.getFixedT(e, t, s), Jt = (r, e, t, s) => ut(et(r, e, t, s), [r, e, t, s]), Qt = (r, e = {}) => {
1562
- var w, C, A, P;
1563
- const {
1564
- i18n: t
1565
- } = e, {
1566
- i18n: s,
1567
- defaultNS: n
1568
- } = Ke(Gt) || {}, a = t || s || Wt();
1569
- if (a && !a.reportNamespaces && (a.reportNamespaces = new Zt()), !a) {
1570
- we(a, "NO_I18NEXT_INSTANCE", "useTranslation: You will need to pass in an i18next instance by using initReactI18next");
1571
- const E = (N, U) => W(U) ? U : At(U) && W(U.defaultValue) ? U.defaultValue : Array.isArray(N) ? N[N.length - 1] : N, v = [E, {}, !1];
1572
- return v.t = E, v.i18n = {}, v.ready = !1, v;
1573
- }
1574
- (w = a.options.react) != null && w.wait && we(a, "DEPRECATED_OPTION", "useTranslation: It seems you are still using the old wait option, you may migrate to the new useSuspense behaviour.");
1575
- const i = {
1576
- ...Ht(),
1577
- ...a.options.react,
1578
- ...e
1579
- }, {
1580
- useSuspense: o,
1581
- keyPrefix: u
1582
- } = i;
1583
- let c = r || n || ((C = a.options) == null ? void 0 : C.defaultNS);
1584
- c = W(c) ? [c] : c || ["translation"], (P = (A = a.reportNamespaces).addUsedNamespaces) == null || P.call(A, c);
1585
- const d = (a.isInitialized || a.initializedStoreOnce) && c.every((E) => Dt(E, a, i)), f = Jt(a, e.lng || null, i.nsMode === "fallback" ? c : c[0], u), m = () => f, g = () => et(a, e.lng || null, i.nsMode === "fallback" ? c : c[0], u), [h, p] = j(m);
1586
- let y = c.join();
1587
- e.lng && (y = `${e.lng}${y}`);
1588
- const L = Yt(y), b = We(!0);
1589
- K(() => {
1590
- const {
1591
- bindI18n: E,
1592
- bindI18nStore: v
1593
- } = i;
1594
- b.current = !0, !d && !o && (e.lng ? Ve(a, e.lng, c, () => {
1595
- b.current && p(g);
1596
- }) : Ne(a, c, () => {
1597
- b.current && p(g);
1598
- })), d && L && L !== y && b.current && p(g);
1599
- const N = () => {
1600
- b.current && p(g);
1601
- };
1602
- return E && (a == null || a.on(E, N)), v && (a == null || a.store.on(v, N)), () => {
1603
- b.current = !1, a && E && (E == null || E.split(" ").forEach((U) => a.off(U, N))), v && a && v.split(" ").forEach((U) => a.store.off(U, N));
1604
- };
1605
- }, [a, y]), K(() => {
1606
- b.current && d && p(m);
1607
- }, [a, u, d]);
1608
- const S = [h, a, d];
1609
- if (S.t = h, S.i18n = a, S.ready = d, d || !d && !o)
1610
- return S;
1611
- throw new Promise((E) => {
1612
- e.lng ? Ve(a, e.lng, c, () => E()) : Ne(a, c, () => E());
1613
- });
1614
- };
1615
- let _t = !1;
1616
- try {
1617
- document.cookie, _t = !0;
1618
- } catch {
1619
- }
1620
- function J(r) {
1621
- const { t: e } = Qt(r);
1622
- return e;
1623
- }
1624
- const Xt = ({ onConfirm: r }) => {
1625
- const e = J("authLib");
1626
- return K(() => {
1627
- const { body: t } = document, s = t.style.overflow, n = t.style.pointerEvents;
1628
- return t.style.overflow = "hidden", t.style.pointerEvents = "none", () => {
1629
- t.style.overflow = s, t.style.pointerEvents = n;
1630
- };
1631
- }, []), ft.createPortal(
1632
- /* @__PURE__ */ l.createElement("div", { className: "fixed inset-0 z-[9999] flex items-center justify-center bg-black/40 backdrop-blur-sm" }, /* @__PURE__ */ l.createElement("div", { className: "pointer-events-auto w-full max-w-sm rounded-xl bg-white p-6 shadow-xl" }, /* @__PURE__ */ l.createElement("h2", { className: "mb-4 text-xl font-semibold text-gray-800 ltr:text-left rtl:text-center" }, e("sessionExpired.title")), /* @__PURE__ */ l.createElement("p", { className: "mb-8 text-sm text-gray-600 ltr:text-left rtl:text-center" }, e("sessionExpired.message")), /* @__PURE__ */ l.createElement("div", { className: "flex justify-end" }, /* @__PURE__ */ l.createElement(
80
+ }, []), ye.createPortal(
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(
1633
82
  "button",
1634
83
  {
1635
- onClick: r,
84
+ onClick: t,
1636
85
  className: `
1637
86
  rounded-lg bg-red-600 px-4 py-2 text-sm font-medium text-white
1638
87
  hover:bg-red-700 focus-visible:outline focus-visible:outline-2
1639
88
  focus-visible:outline-offset-2 focus-visible:outline-red-600
1640
89
  `
1641
90
  },
1642
- e("sessionExpired.button")
91
+ a("sessionExpired.button")
1643
92
  )))),
1644
93
  document.body
1645
94
  );
1646
- }, se = ({
1647
- label: r,
1648
- // translation key for the label
1649
- type: e = "text",
1650
- placeholder: t,
1651
- // translation key for the placeholder
1652
- color: s = "",
1653
- value: n,
1654
- onChange: a
95
+ }, G = ({
96
+ label: t,
97
+ type: a = "text",
98
+ placeholder: l,
99
+ color: r = "",
100
+ value: s,
101
+ onChange: n
1655
102
  }) => {
1656
- const i = J("authLib");
1657
- return /* @__PURE__ */ Y.createElement("div", { className: "mt-8 flex flex-col" }, r && /* @__PURE__ */ Y.createElement(
103
+ const o = U.useId();
104
+ return /* @__PURE__ */ U.createElement("div", { className: "mt-8 flex flex-col" }, t && /* @__PURE__ */ U.createElement(
1658
105
  "label",
1659
106
  {
1660
- htmlFor: `input-${r}`,
107
+ htmlFor: o,
1661
108
  className: "self-start text-base text-black dark:text-white block ltr:text-left rtl:text-right"
1662
109
  },
1663
- i(r)
1664
- ), /* @__PURE__ */ Y.createElement(
110
+ t
111
+ ), /* @__PURE__ */ U.createElement(
1665
112
  "input",
1666
113
  {
1667
- id: `input-${r}`,
1668
- type: e,
1669
- placeholder: t ? i(t) : void 0,
1670
- value: n,
1671
- onChange: (o) => a == null ? void 0 : a(o.target.value),
114
+ id: o,
115
+ type: a,
116
+ placeholder: l || void 0,
117
+ value: s,
118
+ onChange: (c) => n == null ? void 0 : n(c.target.value),
1672
119
  className: `
1673
120
  px-4 py-4 mt-3.5 text-sm font-light rounded-lg border border-solid w-full
1674
121
  ltr:text-left rtl:text-right
1675
- ${s}
122
+ ${r}
1676
123
  `
1677
124
  }
1678
125
  ));
1679
- }, tt = ({ icon: r, label: e }) => {
1680
- const t = J("authLib");
1681
- return /* @__PURE__ */ Y.createElement("div", { className: "flex gap-5 px-8 py-3 items-center bg-indigo-50 rounded-lg max-md:px-5" }, /* @__PURE__ */ Y.createElement(
1682
- "img",
1683
- {
1684
- loading: "lazy",
1685
- src: r,
1686
- alt: e ? t(e) : "",
1687
- className: "object-contain shrink-0 aspect-square w-[26px]"
1688
- }
1689
- ), e && /* @__PURE__ */ Y.createElement("div", { className: "basis-auto text-sm hidden md:block ltr:text-left rtl:text-right" }, t(e)));
1690
- }, st = "data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz48IS0tIFVwbG9hZGVkIHRvOiBTVkcgUmVwbywgd3d3LnN2Z3JlcG8uY29tLCBHZW5lcmF0b3I6IFNWRyBSZXBvIE1peGVyIFRvb2xzIC0tPgo8c3ZnIHdpZHRoPSI4MDBweCIgaGVpZ2h0PSI4MDBweCIgdmlld0JveD0iLTMgMCAyNjIgMjYyIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHByZXNlcnZlQXNwZWN0UmF0aW89InhNaWRZTWlkIj48cGF0aCBkPSJNMjU1Ljg3OCAxMzMuNDUxYzAtMTAuNzM0LS44NzEtMTguNTY3LTIuNzU2LTI2LjY5SDEzMC41NXY0OC40NDhoNzEuOTQ3Yy0xLjQ1IDEyLjA0LTkuMjgzIDMwLjE3Mi0yNi42OSA0Mi4zNTZsLS4yNDQgMS42MjIgMzguNzU1IDMwLjAyMyAyLjY4NS4yNjhjMjQuNjU5LTIyLjc3NCAzOC44NzUtNTYuMjgyIDM4Ljg3NS05Ni4wMjciIGZpbGw9IiM0Mjg1RjQiLz48cGF0aCBkPSJNMTMwLjU1IDI2MS4xYzM1LjI0OCAwIDY0LjgzOS0xMS42MDUgODYuNDUzLTMxLjYyMmwtNDEuMTk2LTMxLjkxM2MtMTEuMDI0IDcuNjg4LTI1LjgyIDEzLjA1NS00NS4yNTcgMTMuMDU1LTM0LjUyMyAwLTYzLjgyNC0yMi43NzMtNzQuMjY5LTU0LjI1bC0xLjUzMS4xMy00MC4yOTggMzEuMTg3LS41MjcgMS40NjVDMzUuMzkzIDIzMS43OTggNzkuNDkgMjYxLjEgMTMwLjU1IDI2MS4xIiBmaWxsPSIjMzRBODUzIi8+PHBhdGggZD0iTTU2LjI4MSAxNTYuMzdjLTIuNzU2LTguMTIzLTQuMzUxLTE2LjgyNy00LjM1MS0yNS44MiAwLTguOTk0IDEuNTk1LTE3LjY5NyA0LjIwNi0yNS44MmwtLjA3My0xLjczTDE1LjI2IDcxLjMxMmwtMS4zMzUuNjM1QzUuMDc3IDg5LjY0NCAwIDEwOS41MTcgMCAxMzAuNTVzNS4wNzcgNDAuOTA1IDEzLjkyNSA1OC42MDJsNDIuMzU2LTMyLjc4MiIgZmlsbD0iI0ZCQkMwNSIvPjxwYXRoIGQ9Ik0xMzAuNTUgNTAuNDc5YzI0LjUxNCAwIDQxLjA1IDEwLjU4OSA1MC40NzkgMTkuNDM4bDM2Ljg0NC0zNS45NzRDMTk1LjI0NSAxMi45MSAxNjUuNzk4IDAgMTMwLjU1IDAgNzkuNDkgMCAzNS4zOTMgMjkuMzAxIDEzLjkyNSA3MS45NDdsNDIuMjExIDMyLjc4M2MxMC41OS0zMS40NzcgMzkuODkxLTU0LjI1MSA3NC40MTQtNTQuMjUxIiBmaWxsPSIjRUI0MzM1Ii8+PC9zdmc+", nt = "data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz48IS0tIFVwbG9hZGVkIHRvOiBTVkcgUmVwbywgd3d3LnN2Z3JlcG8uY29tLCBHZW5lcmF0b3I6IFNWRyBSZXBvIE1peGVyIFRvb2xzIC0tPgo8c3ZnIHdpZHRoPSI4MDBweCIgaGVpZ2h0PSI4MDBweCIgdmlld0JveD0iMCAwIDE2IDE2IiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGZpbGw9Im5vbmUiPjxwYXRoIGZpbGw9IiNGMzUzMjUiIGQ9Ik0xIDFoNi41djYuNUgxVjF6Ii8+PHBhdGggZmlsbD0iIzgxQkMwNiIgZD0iTTguNSAxSDE1djYuNUg4LjVWMXoiLz48cGF0aCBmaWxsPSIjMDVBNkYwIiBkPSJNMSA4LjVoNi41VjE1SDFWOC41eiIvPjxwYXRoIGZpbGw9IiNGRkJBMDgiIGQ9Ik04LjUgOC41SDE1VjE1SDguNVY4LjV6Ii8+PC9zdmc+";
1691
- function q(r, e, t) {
1692
- return r ? r.startsWith(`${e}-`) ? r : r.startsWith("#") ? `${r}` : t : t;
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(
127
+ "img",
128
+ {
129
+ loading: "lazy",
130
+ src: t,
131
+ alt: a || "",
132
+ className: "object-contain shrink-0 aspect-square w-[26px]"
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;
1693
137
  }
1694
- function rt(r, e) {
1695
- const t = (e == null ? void 0 : e.bg) || "bg-sky-500", s = (e == null ? void 0 : e.text) || "text-gray-800", n = (e == null ? void 0 : e.border) || "border-gray-300", a = (e == null ? void 0 : e.fill) || "fill-current", i = (e == null ? void 0 : e.stroke) || "stroke-current";
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";
1696
140
  return {
1697
- bgClass: q(r.bg ?? "", "bg", t),
1698
- textClass: q(r.text ?? "", "text", s),
1699
- borderClass: q(r.border ?? "", "border", n),
1700
- fillClass: q(r.fill ?? "", "fill", a),
1701
- strokeClass: q(r.stroke ?? "", "stroke", i)
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)
1702
146
  };
1703
147
  }
1704
148
  /**
@@ -1707,14 +151,14 @@ function rt(r, e) {
1707
151
  * This source code is licensed under the ISC license.
1708
152
  * See the LICENSE file in the root directory of this source tree.
1709
153
  */
1710
- const qt = (r) => r.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase(), at = (...r) => r.filter((e, t, s) => !!e && e.trim() !== "" && s.indexOf(e) === t).join(" ").trim();
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();
1711
155
  /**
1712
156
  * @license lucide-react v0.481.0 - ISC
1713
157
  *
1714
158
  * This source code is licensed under the ISC license.
1715
159
  * See the LICENSE file in the root directory of this source tree.
1716
160
  */
1717
- var es = {
161
+ var ke = {
1718
162
  xmlns: "http://www.w3.org/2000/svg",
1719
163
  width: 24,
1720
164
  height: 24,
@@ -1731,31 +175,31 @@ var es = {
1731
175
  * This source code is licensed under the ISC license.
1732
176
  * See the LICENSE file in the root directory of this source tree.
1733
177
  */
1734
- const ts = Ge(
178
+ const Le = le(
1735
179
  ({
1736
- color: r = "currentColor",
1737
- size: e = 24,
1738
- strokeWidth: t = 2,
1739
- absoluteStrokeWidth: s,
1740
- className: n = "",
1741
- children: a,
1742
- iconNode: i,
1743
- ...o
1744
- }, u) => me(
180
+ color: t = "currentColor",
181
+ size: a = 24,
182
+ strokeWidth: l = 2,
183
+ absoluteStrokeWidth: r,
184
+ className: s = "",
185
+ children: n,
186
+ iconNode: o,
187
+ ...c
188
+ }, i) => q(
1745
189
  "svg",
1746
190
  {
1747
- ref: u,
1748
- ...es,
1749
- width: e,
1750
- height: e,
1751
- stroke: r,
1752
- strokeWidth: s ? Number(t) * 24 / Number(e) : t,
1753
- className: at("lucide", n),
1754
- ...o
191
+ ref: i,
192
+ ...ke,
193
+ width: a,
194
+ height: a,
195
+ stroke: t,
196
+ strokeWidth: r ? Number(l) * 24 / Number(a) : l,
197
+ className: ue("lucide", s),
198
+ ...c
1755
199
  },
1756
200
  [
1757
- ...i.map(([c, d]) => me(c, d)),
1758
- ...Array.isArray(a) ? a : [a]
201
+ ...o.map(([m, p]) => q(m, p)),
202
+ ...Array.isArray(n) ? n : [n]
1759
203
  ]
1760
204
  )
1761
205
  );
@@ -1765,16 +209,16 @@ const ts = Ge(
1765
209
  * This source code is licensed under the ISC license.
1766
210
  * See the LICENSE file in the root directory of this source tree.
1767
211
  */
1768
- const it = (r, e) => {
1769
- const t = Ge(
1770
- ({ className: s, ...n }, a) => me(ts, {
1771
- ref: a,
1772
- iconNode: e,
1773
- className: at(`lucide-${qt(r)}`, s),
1774
- ...n
212
+ const ge = (t, a) => {
213
+ const l = le(
214
+ ({ className: r, ...s }, n) => q(Le, {
215
+ ref: n,
216
+ iconNode: a,
217
+ className: ue(`lucide-${Ie(t)}`, r),
218
+ ...s
1775
219
  })
1776
220
  );
1777
- return t.displayName = `${r}`, t;
221
+ return l.displayName = `${t}`, l;
1778
222
  };
1779
223
  /**
1780
224
  * @license lucide-react v0.481.0 - ISC
@@ -1782,7 +226,7 @@ const it = (r, e) => {
1782
226
  * This source code is licensed under the ISC license.
1783
227
  * See the LICENSE file in the root directory of this source tree.
1784
228
  */
1785
- const ss = [
229
+ const Ce = [
1786
230
  [
1787
231
  "path",
1788
232
  {
@@ -1792,27 +236,27 @@ const ss = [
1792
236
  ],
1793
237
  ["path", { d: "M12 9v4", key: "juzpu7" }],
1794
238
  ["path", { d: "M12 17h.01", key: "p32p05" }]
1795
- ], ns = it("TriangleAlert", ss);
239
+ ], je = ge("TriangleAlert", Ce);
1796
240
  /**
1797
241
  * @license lucide-react v0.481.0 - ISC
1798
242
  *
1799
243
  * This source code is licensed under the ISC license.
1800
244
  * See the LICENSE file in the root directory of this source tree.
1801
245
  */
1802
- const rs = [
246
+ const Se = [
1803
247
  ["path", { d: "M18 6 6 18", key: "1bl5f8" }],
1804
248
  ["path", { d: "m6 6 12 12", key: "d8bk6v" }]
1805
- ], as = it("X", rs), ot = ({
1806
- message: r,
1807
- dismissAfterMs: e = 4e3
249
+ ], Te = ge("X", Se), fe = ({
250
+ message: t,
251
+ dismissAfterMs: a = 4e3
1808
252
  }) => {
1809
- const t = J("authLib"), [s, n] = j(!1);
1810
- return K(() => {
1811
- if (n(!!r), r && e > 0) {
1812
- const a = window.setTimeout(() => n(!1), e);
1813
- return () => window.clearTimeout(a);
253
+ const l = H("authLib"), [r, s] = u(!1);
254
+ return R(() => {
255
+ if (s(!!t), t && a > 0) {
256
+ const n = window.setTimeout(() => s(!1), a);
257
+ return () => window.clearTimeout(n);
1814
258
  }
1815
- }, [r, e]), !s || !r ? null : /* @__PURE__ */ l.createElement(
259
+ }, [t, a]), !r || !t ? null : /* @__PURE__ */ e.createElement(
1816
260
  "div",
1817
261
  {
1818
262
  role: "alert",
@@ -1822,89 +266,89 @@ const rs = [
1822
266
  rounded-lg border border-red-300 bg-red-50/80 p-4 pr-6 text-sm text-red-800
1823
267
  shadow-lg backdrop-blur
1824
268
  transition-all duration-300 ease-out
1825
- ${s ? "translate-y-0 opacity-100" : "-translate-y-2 opacity-0"}
269
+ ${r ? "translate-y-0 opacity-100" : "-translate-y-2 opacity-0"}
1826
270
  `
1827
271
  },
1828
- /* @__PURE__ */ l.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" }),
1829
- /* @__PURE__ */ l.createElement(ns, { className: "mt-0.5 h-5 w-5 flex-none" }),
1830
- /* @__PURE__ */ l.createElement("span", { className: "grow leading-5 ltr:text-left rtl:text-right" }, r),
1831
- /* @__PURE__ */ l.createElement(
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" }),
274
+ /* @__PURE__ */ e.createElement("span", { className: "grow leading-5 ltr:text-left rtl:text-right" }, t),
275
+ /* @__PURE__ */ e.createElement(
1832
276
  "button",
1833
277
  {
1834
- onClick: () => n(!1),
1835
- "aria-label": t("inlineError.dismiss"),
278
+ onClick: () => s(!1),
279
+ "aria-label": l("inlineError.dismiss"),
1836
280
  className: `
1837
281
  absolute ltr:right-2 rtl:left-2 top-2 rounded p-1 text-red-600/70
1838
282
  hover:bg-red-100 hover:text-red-700 focus:outline-none
1839
283
  focus-visible:ring focus-visible:ring-red-500/50
1840
284
  `
1841
285
  },
1842
- /* @__PURE__ */ l.createElement(as, { className: "h-4 w-4" })
286
+ /* @__PURE__ */ e.createElement(Te, { className: "h-4 w-4" })
1843
287
  )
1844
288
  );
1845
- }, is = () => {
1846
- const r = J("authLib"), e = Ee(), t = Se(), {
1847
- brandName: s = r("brandName", { defaultValue: "MyBrand" }),
1848
- colors: n = { bg: "bg-sky-500", text: "text-white", border: "border-sky-500" },
1849
- logoUrl: a,
1850
- oauthProviders: i = [],
1851
- illustrationUrl: o = r("community.illustrationUrl", {
289
+ }, Pe = () => {
290
+ const t = H("authLib"), a = te(), l = ae(), {
291
+ brandName: r = t("brandName", { defaultValue: "MyBrand" }),
292
+ colors: s = { bg: "bg-sky-500", text: "text-white", border: "border-sky-500" },
293
+ logoUrl: n,
294
+ oauthProviders: o = [],
295
+ illustrationUrl: c = t("community.illustrationUrl", {
1852
296
  defaultValue: "https://cdn.builder.io/api/v1/image/assets/TEMP/35ba84b8335fda2819c3a14ea3d00321a0fd0e79e571caa31108468010868ca5?placeholderIfAbsent=true&apiKey=a460e9a46e514356ac1106eada03046c"
1853
297
  }),
1854
- communityContent: u = {
1855
- title: r("community.title"),
1856
- description: r("community.description")
298
+ communityContent: i = {
299
+ title: t("community.title"),
300
+ description: t("community.description")
1857
301
  },
1858
- baseUrl: c
302
+ baseUrl: m
1859
303
  // IMPORTANT: used for Google OAuth redirect
1860
- } = Ye(), { login: d } = G(), [f, m] = j(""), [g, h] = j(""), [p, y] = j(!1), [L, b] = j(null), S = {
1861
- google: { icon: st, label: "social.google" },
1862
- microsoft: { icon: nt, label: "social.microsoft" }
1863
- }, w = i.filter((M) => M in S).map((M) => ({
1864
- id: M,
1865
- icon: S[M].icon,
1866
- label: S[M].label
1867
- })), { bgClass: C, textClass: A, borderClass: P } = rt(n), E = `${C} bg-gradient-to-r from-white/10 via-white/0 to-white/0`;
1868
- async function v(M) {
1869
- var R;
1870
- if (M.preventDefault(), !p) {
1871
- b(null), y(!0);
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);
1872
316
  try {
1873
- await d({ email: f, password: g });
1874
- } catch (I) {
1875
- ((R = I == null ? void 0 : I.response) == null ? void 0 : R.status) === 401 ? b(r("errors.invalidCredentials")) : b(r("errors.generic"));
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"));
1876
320
  } finally {
1877
- y(!1);
321
+ g(!1);
1878
322
  }
1879
323
  }
1880
324
  }
1881
- function N(M) {
1882
- var I, k, $;
1883
- if (!c) {
325
+ function A(x) {
326
+ var S, f, P;
327
+ if (!m) {
1884
328
  console.error("Auth baseUrl is not configured.");
1885
329
  return;
1886
330
  }
1887
- const R = ((k = (I = t.state) == null ? void 0 : I.from) == null ? void 0 : k.pathname) || (($ = t.state) == null ? void 0 : $.from) || "/";
1888
- if (sessionStorage.setItem("postLoginRedirect", R), M === "google") {
1889
- const T = "/oauth/google/callback", F = `${window.location.origin}${T}`, O = new URL(`${c}/auth/google`);
1890
- O.searchParams.set("redirect", F), window.location.href = O.toString();
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();
1891
335
  return;
1892
336
  }
1893
- if (M === "microsoft") {
1894
- const T = "/oauth/microsoft/callback", F = `${window.location.origin}${T}`, O = new URL(`${c}/auth/microsoft`);
1895
- O.searchParams.set("redirect", F), window.location.href = O.toString();
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();
1896
340
  return;
1897
341
  }
1898
342
  }
1899
- const U = /* @__PURE__ */ l.createElement(
343
+ const Q = /* @__PURE__ */ e.createElement(
1900
344
  "svg",
1901
345
  {
1902
346
  className: "h-4 w-4 animate-spin stroke-current",
1903
347
  viewBox: "0 0 24 24",
1904
348
  fill: "none"
1905
349
  },
1906
- /* @__PURE__ */ l.createElement("circle", { className: "opacity-25", cx: "12", cy: "12", r: "10", strokeWidth: "4" }),
1907
- /* @__PURE__ */ l.createElement(
350
+ /* @__PURE__ */ e.createElement("circle", { className: "opacity-25", cx: "12", cy: "12", r: "10", strokeWidth: "4" }),
351
+ /* @__PURE__ */ e.createElement(
1908
352
  "path",
1909
353
  {
1910
354
  className: "opacity-75",
@@ -1914,153 +358,153 @@ const rs = [
1914
358
  }
1915
359
  )
1916
360
  );
1917
- return /* @__PURE__ */ l.createElement("div", { className: `flex items-center justify-center min-h-screen p-4 ${E}` }, /* @__PURE__ */ l.createElement("div", { className: "flex w-full max-w-5xl bg-white rounded-2xl shadow-2xl overflow-hidden" }, /* @__PURE__ */ l.createElement("div", { className: `hidden md:flex md:w-1/2 p-12 flex-col justify-between text-white ${C}` }, /* @__PURE__ */ l.createElement("div", null, a ? /* @__PURE__ */ l.createElement("div", { className: "flex items-center gap-4" }, /* @__PURE__ */ l.createElement(
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(
1918
362
  "img",
1919
363
  {
1920
364
  loading: "lazy",
1921
- src: a,
365
+ src: n,
1922
366
  alt: "Brand Logo",
1923
367
  className: "bg-white h-8 md:h-22 rounded-lg"
1924
368
  }
1925
- ), /* @__PURE__ */ l.createElement("h2", { className: "text-sm md:text-2xl font-bold uppercase" }, s)) : /* @__PURE__ */ l.createElement("h2", { className: "text-sm md:text-2xl font-bold" }, s)), /* @__PURE__ */ l.createElement("div", { className: "flex-1 space-y-4 mt-6 py-4" }, /* @__PURE__ */ l.createElement("h3", { className: "text-2xl font-semibold leading-tight" }, u.title), /* @__PURE__ */ l.createElement("p", { className: "text-base leading-relaxed opacity-90 ltr:text-left rtl:text-right" }, u.description), /* @__PURE__ */ l.createElement("div", { className: "relative" }, /* @__PURE__ */ l.createElement("div", { className: "absolute -left-4 -top-4 w-20 h-20 bg-white/20 rounded-full blur-xl" }), /* @__PURE__ */ l.createElement("div", { className: "absolute -right-4 -bottom-4 w-20 h-20 bg-white/20 rounded-full blur-xl" }), /* @__PURE__ */ l.createElement(
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(
1926
370
  "img",
1927
371
  {
1928
372
  loading: "lazy",
1929
- src: o,
373
+ src: c,
1930
374
  alt: "Sign in illustration",
1931
375
  className: "max-w-sm w-full mx-auto rounded-lg shadow-lg transform hover:scale-105 transition-transform duration-300 p-6"
1932
376
  }
1933
- )))), /* @__PURE__ */ l.createElement("div", { className: "w-full md:w-1/2 p-4 md:p-8 m-auto" }, /* @__PURE__ */ l.createElement("div", { className: "flex flex-col md:flex-row justify-between items-center mb-8" }, /* @__PURE__ */ l.createElement("div", { className: "flex items-center justify-center md:hidden mb-5" }, a ? /* @__PURE__ */ l.createElement(
377
+ )))), /* @__PURE__ */ e.createElement("div", { className: "w-full md:w-1/2 p-4 md:p-8 m-auto" }, /* @__PURE__ */ e.createElement("div", { className: "flex flex-col md:flex-row justify-between items-center mb-8" }, /* @__PURE__ */ e.createElement("div", { className: "flex items-center justify-center md:hidden mb-5" }, n ? /* @__PURE__ */ e.createElement(
1934
378
  "img",
1935
379
  {
1936
380
  loading: "lazy",
1937
- src: a,
381
+ src: n,
1938
382
  alt: "Brand Logo",
1939
- className: `h-22 rounded-full border ${P}`
383
+ className: `h-22 rounded-full border ${D}`
1940
384
  }
1941
- ) : /* @__PURE__ */ l.createElement("h2", { className: "text-2xl font-bold" }, s)), /* @__PURE__ */ l.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__ */ l.createElement("p", { className: "text-sm md:text-lg" }, r("SignInPage.welcome"), " ", /* @__PURE__ */ l.createElement("span", { className: `font-semibold ${A} uppercase` }, s)), /* @__PURE__ */ l.createElement("h1", { className: "text-2xl md:text-4xl font-bold text-gray-800" }, r("SignInPage.signIn"))), /* @__PURE__ */ l.createElement("div", { className: "text-sm text-gray-500 text-center md:text-right" }, r("SignInPage.noAccount"), /* @__PURE__ */ l.createElement("br", null), /* @__PURE__ */ l.createElement(
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(
1942
386
  "button",
1943
387
  {
1944
388
  type: "button",
1945
- onClick: () => e("/signup"),
1946
- className: A
389
+ onClick: () => a("/signup"),
390
+ className: j
1947
391
  },
1948
- r("SignInPage.signUp")
1949
- ))), L && /* @__PURE__ */ l.createElement(ot, { message: L }), /* @__PURE__ */ l.createElement("form", { className: "space-y-6", onSubmit: v }, /* @__PURE__ */ l.createElement(
1950
- se,
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,
1951
395
  {
1952
- label: r("form.emailLabel"),
396
+ label: t("form.emailLabel"),
1953
397
  type: "email",
1954
- placeholder: r("form.emailPlaceholder"),
1955
- color: P,
1956
- value: f,
1957
- onChange: m
398
+ placeholder: t("form.emailPlaceholder"),
399
+ color: D,
400
+ value: b,
401
+ onChange: E
1958
402
  }
1959
- ), /* @__PURE__ */ l.createElement(
1960
- se,
403
+ ), /* @__PURE__ */ e.createElement(
404
+ G,
1961
405
  {
1962
- label: r("form.passwordLabel"),
406
+ label: t("form.passwordLabel"),
1963
407
  type: "password",
1964
- placeholder: r("form.passwordPlaceholder"),
1965
- color: P,
1966
- value: g,
1967
- onChange: h
408
+ placeholder: t("form.passwordPlaceholder"),
409
+ color: D,
410
+ value: C,
411
+ onChange: N
1968
412
  }
1969
- ), /* @__PURE__ */ l.createElement("div", { className: "ltr:text-right rtl:text-left" }, /* @__PURE__ */ l.createElement("button", { className: `text-sm ${A}` }, r("SignInPage.forgotPassword"))), /* @__PURE__ */ l.createElement(
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(
1970
414
  "button",
1971
415
  {
1972
416
  type: "submit",
1973
- disabled: p,
1974
- className: `relative flex w-full items-center justify-center gap-2 py-3 rounded-lg font-medium transition-colors ${p ? "opacity-60 cursor-not-allowed" : ""} ${C} text-white`
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`
1975
419
  },
1976
- p && U,
1977
- r(p ? "SignInPage.signInSubmitting" : "SignInPage.signIn")
1978
- ), w.length > 0 && /* @__PURE__ */ l.createElement(l.Fragment, null, /* @__PURE__ */ l.createElement("div", { className: "flex items-center pt-2" }, /* @__PURE__ */ l.createElement("div", { className: `flex-grow h-px ${C}` }), /* @__PURE__ */ l.createElement("span", { className: `${A} mx-3 text-sm` }, r("SignInPage.orLoginWith")), /* @__PURE__ */ l.createElement("div", { className: `flex-grow h-px ${C}` })), /* @__PURE__ */ l.createElement("div", { className: "flex gap-3 mb-6 justify-center md:justify-start" }, w.map((M) => /* @__PURE__ */ l.createElement(
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(
1979
423
  "button",
1980
424
  {
1981
- key: M.id,
425
+ key: x.id,
1982
426
  type: "button",
1983
- onClick: () => N(M.id),
427
+ onClick: () => A(x.id),
1984
428
  className: "flex-1"
1985
429
  },
1986
- /* @__PURE__ */ l.createElement(tt, { icon: M.icon, label: M.label })
430
+ /* @__PURE__ */ e.createElement(ie, { icon: x.icon, label: x.label })
1987
431
  ))))))));
1988
- }, os = () => {
1989
- const r = J("authLib"), e = Ee(), t = Se(), {
1990
- brandName: s = r("brandName", { defaultValue: "MyBrand" }),
1991
- colors: n = { bg: "bg-sky-500", text: "text-white", border: "border-sky-500" },
1992
- logoUrl: a,
1993
- oauthProviders: i = [],
1994
- illustrationUrl: o = r("community.illustrationUrl", {
432
+ }, Ue = () => {
433
+ const t = H("authLib"), a = te(), l = ae(), {
434
+ brandName: r = t("brandName", { defaultValue: "MyBrand" }),
435
+ colors: s = { bg: "bg-sky-500", text: "text-white", border: "border-sky-500" },
436
+ logoUrl: n,
437
+ oauthProviders: o = [],
438
+ illustrationUrl: c = t("community.illustrationUrl", {
1995
439
  defaultValue: "https://cdn.builder.io/api/v1/image/assets/TEMP/35ba84b8335fda2819c3a14ea3d00321a0fd0e79e571caa31108468010868ca5?placeholderIfAbsent=true&apiKey=a460e9a46e514356ac1106eada03046c"
1996
440
  }),
1997
- communityContent: u = {
1998
- title: r("community.title"),
1999
- description: r("community.description")
441
+ communityContent: i = {
442
+ title: t("community.title"),
443
+ description: t("community.description")
2000
444
  },
2001
- baseUrl: c
445
+ baseUrl: m
2002
446
  // IMPORTANT: used for OAuth redirect (same as SignIn)
2003
- } = Ye(), { login: d, api: f } = G(), [m, g] = j(""), [h, p] = j(""), [y, L] = j(""), [b, S] = j(!1), [w, C] = j(null), A = {
2004
- google: { icon: st, label: "social.google" },
2005
- microsoft: { icon: nt, label: "social.microsoft" }
2006
- }, P = i.filter((k) => k in A).map((k) => ({
2007
- id: k,
2008
- icon: A[k].icon,
2009
- label: A[k].label
2010
- })), { bgClass: E, textClass: v, borderClass: N } = rt(n), U = `${E} bg-gradient-to-r from-white/10 via-white/0 to-white/0`;
2011
- async function M(k) {
2012
- var $, T, F;
2013
- if (k.preventDefault(), !b) {
2014
- C(null), S(!0);
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);
2015
459
  try {
2016
- await f.post("/auth/clients/register", {
2017
- email: h,
2018
- password: y,
2019
- name: m || void 0
2020
- }), await d({ email: h, password: y });
2021
- } catch (O) {
2022
- const H = ($ = O == null ? void 0 : O.response) == null ? void 0 : $.status;
2023
- C(
2024
- H === 400 ? ((F = (T = O == null ? void 0 : O.response) == null ? void 0 : T.data) == null ? void 0 : F.message) || r("errors.invalidData", {
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", {
2025
469
  defaultValue: "Please check the fields and try again."
2026
- }) : H === 409 ? r("errors.emailInUse", {
470
+ }) : $ === 409 ? t("errors.emailInUse", {
2027
471
  defaultValue: "This email is already in use."
2028
- }) : r("errors.generic", {
472
+ }) : t("errors.generic", {
2029
473
  defaultValue: "Something went wrong. Please try again."
2030
474
  })
2031
475
  );
2032
476
  } finally {
2033
- S(!1);
477
+ v(!1);
2034
478
  }
2035
479
  }
2036
480
  }
2037
- function R(k) {
2038
- var T, F, O;
2039
- if (!c) {
481
+ function B(f) {
482
+ var k, L, y;
483
+ if (!m) {
2040
484
  console.error("Auth baseUrl is not configured.");
2041
485
  return;
2042
486
  }
2043
- const $ = ((F = (T = t.state) == null ? void 0 : T.from) == null ? void 0 : F.pathname) || ((O = t.state) == null ? void 0 : O.from) || "/";
2044
- if (sessionStorage.setItem("postLoginRedirect", $), k === "google") {
2045
- const H = "/oauth/google/callback", D = `${window.location.origin}${H}`, V = new URL(`${c}/auth/google`);
2046
- V.searchParams.set("redirect", D), window.location.href = V.toString();
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();
2047
491
  return;
2048
492
  }
2049
- if (k === "microsoft") {
2050
- const H = "/oauth/microsoft/callback", D = `${window.location.origin}${H}`, V = new URL(`${c}/auth/microsoft`);
2051
- V.searchParams.set("redirect", D), window.location.href = V.toString();
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();
2052
496
  return;
2053
497
  }
2054
498
  }
2055
- const I = /* @__PURE__ */ l.createElement(
499
+ const S = /* @__PURE__ */ e.createElement(
2056
500
  "svg",
2057
501
  {
2058
502
  className: "h-4 w-4 animate-spin stroke-current",
2059
503
  viewBox: "0 0 24 24",
2060
504
  fill: "none"
2061
505
  },
2062
- /* @__PURE__ */ l.createElement("circle", { className: "opacity-25", cx: "12", cy: "12", r: "10", strokeWidth: "4" }),
2063
- /* @__PURE__ */ l.createElement(
506
+ /* @__PURE__ */ e.createElement("circle", { className: "opacity-25", cx: "12", cy: "12", r: "10", strokeWidth: "4" }),
507
+ /* @__PURE__ */ e.createElement(
2064
508
  "path",
2065
509
  {
2066
510
  className: "opacity-75",
@@ -2070,296 +514,296 @@ const rs = [
2070
514
  }
2071
515
  )
2072
516
  );
2073
- return /* @__PURE__ */ l.createElement("div", { className: `flex items-center justify-center min-h-screen p-4 ${U}` }, /* @__PURE__ */ l.createElement("div", { className: "flex w-full max-w-5xl bg-white rounded-2xl shadow-2xl overflow-hidden" }, /* @__PURE__ */ l.createElement("div", { className: `hidden md:flex md:w-1/2 p-12 flex-col justify-between text-white ${E}` }, /* @__PURE__ */ l.createElement("div", null, a ? /* @__PURE__ */ l.createElement("div", { className: "flex items-center gap-4" }, /* @__PURE__ */ l.createElement(
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(
2074
518
  "img",
2075
519
  {
2076
520
  loading: "lazy",
2077
- src: a,
521
+ src: n,
2078
522
  alt: "Brand Logo",
2079
523
  className: "bg-white h-8 md:h-22 rounded-lg"
2080
524
  }
2081
- ), /* @__PURE__ */ l.createElement("h2", { className: "text-sm md:text-2xl font-bold uppercase" }, s)) : /* @__PURE__ */ l.createElement("h2", { className: "text-sm md:text-2xl font-bold" }, s)), /* @__PURE__ */ l.createElement("div", { className: "flex-1 space-y-4 mt-6 py-4" }, /* @__PURE__ */ l.createElement("h3", { className: "text-2xl font-semibold leading-tight" }, u.title), /* @__PURE__ */ l.createElement("p", { className: "text-base leading-relaxed opacity-90 ltr:text-left rtl:text-right" }, u.description), /* @__PURE__ */ l.createElement("div", { className: "relative" }, /* @__PURE__ */ l.createElement("div", { className: "absolute -left-4 -top-4 w-20 h-20 bg-white/20 rounded-full blur-xl" }), /* @__PURE__ */ l.createElement("div", { className: "absolute -right-4 -bottom-4 w-20 h-20 bg-white/20 rounded-full blur-xl" }), /* @__PURE__ */ l.createElement(
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(
2082
526
  "img",
2083
527
  {
2084
528
  loading: "lazy",
2085
- src: o,
529
+ src: c,
2086
530
  alt: "Sign up illustration",
2087
531
  className: "max-w-sm w-full mx-auto rounded-lg shadow-lg transform hover:scale-105 transition-transform duration-300 p-6"
2088
532
  }
2089
- )))), /* @__PURE__ */ l.createElement("div", { className: "w-full md:w-1/2 p-4 md:p-8 m-auto" }, /* @__PURE__ */ l.createElement("div", { className: "flex flex-col md:flex-row justify-between items-center mb-8" }, /* @__PURE__ */ l.createElement("div", { className: "flex items-center justify-center md:hidden mb-5" }, a ? /* @__PURE__ */ l.createElement(
533
+ )))), /* @__PURE__ */ e.createElement("div", { className: "w-full md:w-1/2 p-4 md:p-8 m-auto" }, /* @__PURE__ */ e.createElement("div", { className: "flex flex-col md:flex-row justify-between items-center mb-8" }, /* @__PURE__ */ e.createElement("div", { className: "flex items-center justify-center md:hidden mb-5" }, n ? /* @__PURE__ */ e.createElement(
2090
534
  "img",
2091
535
  {
2092
536
  loading: "lazy",
2093
- src: a,
537
+ src: n,
2094
538
  alt: "Brand Logo",
2095
- className: `h-22 rounded-full border ${N}`
539
+ className: `h-22 rounded-full border ${A}`
2096
540
  }
2097
- ) : /* @__PURE__ */ l.createElement("h2", { className: "text-2xl font-bold" }, s)), /* @__PURE__ */ l.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__ */ l.createElement("p", { className: "text-sm md:text-lg" }, r("SignUpPage.welcome", { defaultValue: "Join" }), " ", /* @__PURE__ */ l.createElement("span", { className: `font-semibold ${v} uppercase` }, s)), /* @__PURE__ */ l.createElement("h1", { className: "text-2xl md:text-4xl font-bold text-gray-800" }, r("SignUpPage.signUp", { defaultValue: "Sign up" }))), /* @__PURE__ */ l.createElement("div", { className: "text-sm text-gray-500 text-center md:text-right" }, r("SignUpPage.alreadyHaveAccount", {
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", {
2098
542
  defaultValue: "Already have an account?"
2099
- }), /* @__PURE__ */ l.createElement("br", null), /* @__PURE__ */ l.createElement(
543
+ }), /* @__PURE__ */ e.createElement("br", null), /* @__PURE__ */ e.createElement(
2100
544
  "button",
2101
545
  {
2102
546
  type: "button",
2103
- onClick: () => e("/login"),
2104
- className: v
547
+ onClick: () => a("/login"),
548
+ className: V
2105
549
  },
2106
- r("SignUpPage.signIn", { defaultValue: "Sign in" })
2107
- ))), w && /* @__PURE__ */ l.createElement(ot, { message: w }), /* @__PURE__ */ l.createElement("form", { className: "space-y-6", onSubmit: M }, /* @__PURE__ */ l.createElement(
2108
- se,
550
+ 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,
2109
553
  {
2110
- label: r("form.nameLabel", { defaultValue: "Name" }),
554
+ label: t("form.nameLabel", { defaultValue: "Name" }),
2111
555
  type: "text",
2112
- placeholder: r("form.namePlaceholder", {
556
+ placeholder: t("form.namePlaceholder", {
2113
557
  defaultValue: "Enter your name"
2114
558
  }),
2115
- color: N,
2116
- value: m,
2117
- onChange: g
559
+ color: A,
560
+ value: E,
561
+ onChange: C
2118
562
  }
2119
- ), /* @__PURE__ */ l.createElement(
2120
- se,
563
+ ), /* @__PURE__ */ e.createElement(
564
+ G,
2121
565
  {
2122
- label: r("form.emailLabel"),
566
+ label: t("form.emailLabel"),
2123
567
  type: "email",
2124
- placeholder: r("form.emailPlaceholder"),
2125
- color: N,
2126
- value: h,
2127
- onChange: p
568
+ placeholder: t("form.emailPlaceholder"),
569
+ color: A,
570
+ value: N,
571
+ onChange: h
2128
572
  }
2129
- ), /* @__PURE__ */ l.createElement(
2130
- se,
573
+ ), /* @__PURE__ */ e.createElement(
574
+ G,
2131
575
  {
2132
- label: r("form.passwordLabel"),
576
+ label: t("form.passwordLabel"),
2133
577
  type: "password",
2134
- placeholder: r("form.passwordPlaceholder"),
2135
- color: N,
2136
- value: y,
2137
- onChange: L
578
+ placeholder: t("form.passwordPlaceholder"),
579
+ color: A,
580
+ value: g,
581
+ onChange: I
2138
582
  }
2139
- ), /* @__PURE__ */ l.createElement(
583
+ ), /* @__PURE__ */ e.createElement(
2140
584
  "button",
2141
585
  {
2142
586
  type: "submit",
2143
- disabled: b,
2144
- className: `relative flex w-full items-center justify-center gap-2 py-3 rounded-lg font-medium transition-colors ${b ? "opacity-60 cursor-not-allowed" : ""} ${E} text-white`
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`
2145
589
  },
2146
- b && I,
2147
- b ? r("SignUpPage.signUpSubmitting", {
590
+ d && S,
591
+ d ? t("SignUpPage.signUpSubmitting", {
2148
592
  defaultValue: "Creating account..."
2149
- }) : r("SignUpPage.signUp", { defaultValue: "Sign up" })
2150
- ), P.length > 0 && /* @__PURE__ */ l.createElement(l.Fragment, null, /* @__PURE__ */ l.createElement("div", { className: "flex items-center pt-2" }, /* @__PURE__ */ l.createElement("div", { className: `flex-grow h-px ${E}` }), /* @__PURE__ */ l.createElement("span", { className: `${v} mx-3 text-sm` }, r("SignUpPage.orContinueWith", {
593
+ }) : 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", {
2151
595
  defaultValue: "Or continue with"
2152
- })), /* @__PURE__ */ l.createElement("div", { className: `flex-grow h-px ${E}` })), /* @__PURE__ */ l.createElement("div", { className: "flex gap-3 mb-6 justify-center md:justify-start" }, P.map((k) => /* @__PURE__ */ l.createElement(
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(
2153
597
  "button",
2154
598
  {
2155
- key: k.id,
599
+ key: f.id,
2156
600
  type: "button",
2157
- onClick: () => R(k.id),
601
+ onClick: () => B(f.id),
2158
602
  className: "flex-1"
2159
603
  },
2160
- /* @__PURE__ */ l.createElement(tt, { icon: k.icon, label: k.label })
604
+ /* @__PURE__ */ e.createElement(ie, { icon: f.icon, label: f.label })
2161
605
  ))))))));
2162
- }, Be = () => (K(() => {
2163
- const r = new URLSearchParams(window.location.search), e = r.get("accessToken"), t = r.get("refreshToken");
2164
- e && localStorage.setItem("authToken", e), t && localStorage.setItem("refreshToken", t);
2165
- const s = sessionStorage.getItem("postLoginRedirect") || "/";
2166
- sessionStorage.removeItem("postLoginRedirect"), window.location.replace(s);
2167
- }, []), /* @__PURE__ */ l.createElement("div", { className: "flex items-center justify-center min-h-screen text-gray-700" }, "Finishing Google sign-in…")), ls = ({ children: r }) => {
2168
- const { isAuthenticated: e } = G(), t = Se();
2169
- return e ? r : /* @__PURE__ */ l.createElement(ie, { to: "/login", state: { from: t }, replace: !0 });
2170
- }, gs = ({ config: r, children: e }) => {
2171
- const t = Ee(), [s, n] = j(
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(
2172
616
  () => localStorage.getItem("authToken")
2173
- ), [a, i] = j(null), [o, u] = j(!0), [c, d] = j(!1);
2174
- async function f() {
617
+ ), [n, o] = u(null), [c, i] = u(!0), [m, p] = u(!1);
618
+ async function b() {
2175
619
  try {
2176
- await m.post("/auth/logout");
2177
- } catch (p) {
2178
- console.warn("Logout endpoint failed, proceeding with local logout:", p);
620
+ await E.post("/auth/logout");
621
+ } catch (h) {
622
+ console.warn("Logout endpoint failed, proceeding with local logout:", h);
2179
623
  }
2180
- n(null), i(null), localStorage.removeItem("authToken"), sessionStorage.clear(), d(!1), t("/login", { replace: !0 });
624
+ s(null), o(null), localStorage.removeItem("authToken"), sessionStorage.clear(), p(!1), l("/login", { replace: !0 });
2181
625
  }
2182
- const m = ae(() => {
2183
- const p = pe.create({
2184
- baseURL: r.baseUrl,
626
+ const E = Y(() => {
627
+ const h = _.create({
628
+ baseURL: t.baseUrl,
2185
629
  withCredentials: !0
2186
630
  });
2187
- return mt(p, {
2188
- baseUrl: r.baseUrl,
2189
- getAccessToken: () => s,
2190
- setAccessToken: (y) => n(y),
2191
- logout: () => d(!0)
2192
- }), p;
2193
- }, [r.baseUrl, s]);
2194
- K(() => {
631
+ return ve(h, {
632
+ baseUrl: t.baseUrl,
633
+ getAccessToken: () => r,
634
+ setAccessToken: (g) => s(g),
635
+ logout: () => p(!0)
636
+ }), h;
637
+ }, [t.baseUrl, r]);
638
+ R(() => {
2195
639
  (async () => {
2196
- if (s) {
2197
- i(de(s)), u(!1);
640
+ if (r) {
641
+ o(J(r)), i(!1);
2198
642
  return;
2199
643
  }
2200
644
  try {
2201
- const { data: y } = await pe.post(
2202
- `${r.baseUrl}/auth/refresh-token`,
645
+ const { data: g } = await _.post(
646
+ `${t.baseUrl}/auth/refresh-token`,
2203
647
  {},
2204
648
  { withCredentials: !0 }
2205
649
  );
2206
- n(y.accessToken), i(de(y.accessToken)), localStorage.setItem("authToken", y.accessToken);
650
+ s(g.accessToken), o(J(g.accessToken)), localStorage.setItem("authToken", g.accessToken);
2207
651
  } catch {
2208
652
  } finally {
2209
- u(!1);
653
+ i(!1);
2210
654
  }
2211
655
  })();
2212
- }, [s, r.baseUrl]);
2213
- async function g(p) {
2214
- const { data: y } = await m.post("/auth/clients/login", p);
2215
- n(y.accessToken), i(de(y.accessToken)), localStorage.setItem("authToken", y.accessToken), gt(), t("/", { replace: !0 });
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 });
2216
660
  }
2217
- const h = ae(
661
+ const N = Y(
2218
662
  () => ({
2219
- isAuthenticated: !!s,
2220
- accessToken: s,
2221
- user: a,
2222
- login: g,
2223
- logout: f,
2224
- api: m,
2225
- setUser: i
663
+ isAuthenticated: !!r,
664
+ accessToken: r,
665
+ user: n,
666
+ login: C,
667
+ logout: b,
668
+ api: E,
669
+ setUser: o
2226
670
  }),
2227
- [s, a, m]
671
+ [r, n, E]
2228
672
  );
2229
- return /* @__PURE__ */ l.createElement(Ze.Provider, { value: r }, /* @__PURE__ */ l.createElement(Je.Provider, { value: h }, /* @__PURE__ */ l.createElement(ht, null, /* @__PURE__ */ l.createElement(
2230
- _,
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,
2231
675
  {
2232
676
  path: "login",
2233
- element: s ? /* @__PURE__ */ l.createElement(ie, { to: "/", replace: !0 }) : /* @__PURE__ */ l.createElement(is, { baseUrl: r.baseUrl, colors: r.colors })
677
+ element: r ? /* @__PURE__ */ e.createElement(O, { to: "/", replace: !0 }) : /* @__PURE__ */ e.createElement(Pe, { baseUrl: t.baseUrl, colors: t.colors })
2234
678
  }
2235
- ), /* @__PURE__ */ l.createElement(
2236
- _,
679
+ ), /* @__PURE__ */ e.createElement(
680
+ Z,
2237
681
  {
2238
682
  path: "signup",
2239
- element: s ? /* @__PURE__ */ l.createElement(ie, { to: "/", replace: !0 }) : /* @__PURE__ */ l.createElement(os, null)
683
+ element: r ? /* @__PURE__ */ e.createElement(O, { to: "/", replace: !0 }) : /* @__PURE__ */ e.createElement(Ue, null)
2240
684
  }
2241
- ), /* @__PURE__ */ l.createElement(
2242
- _,
685
+ ), /* @__PURE__ */ e.createElement(
686
+ Z,
2243
687
  {
2244
688
  path: "oauth/google/callback",
2245
- element: /* @__PURE__ */ l.createElement(Be, null)
689
+ element: /* @__PURE__ */ e.createElement(re, null)
2246
690
  }
2247
- ), /* @__PURE__ */ l.createElement(
2248
- _,
691
+ ), /* @__PURE__ */ e.createElement(
692
+ Z,
2249
693
  {
2250
694
  path: "/oauth/microsoft/callback",
2251
- element: /* @__PURE__ */ l.createElement(Be, null)
695
+ element: /* @__PURE__ */ e.createElement(re, null)
2252
696
  }
2253
- ), /* @__PURE__ */ l.createElement(
2254
- _,
697
+ ), /* @__PURE__ */ e.createElement(
698
+ Z,
2255
699
  {
2256
700
  path: "*",
2257
- element: /* @__PURE__ */ l.createElement(ls, null, e)
701
+ element: /* @__PURE__ */ e.createElement(ze, null, a)
2258
702
  }
2259
- )), c && /* @__PURE__ */ l.createElement(Xt, { onConfirm: f })));
703
+ )), m && /* @__PURE__ */ e.createElement(Me, { onConfirm: b })));
2260
704
  };
2261
- function lt(...r) {
2262
- const { user: e } = G(), t = (e == null ? void 0 : e.roles) ?? [];
2263
- return r.some((s) => t.includes(s));
705
+ function he(...t) {
706
+ const { user: a } = z(), l = (a == null ? void 0 : a.roles) ?? [];
707
+ return t.some((r) => l.includes(r));
2264
708
  }
2265
- function ms(r) {
2266
- const { user: e } = G();
2267
- return (e == null ? void 0 : e.modules.includes(r)) ?? !1;
709
+ function Ze(t) {
710
+ const { user: a } = z();
711
+ return (a == null ? void 0 : a.modules.includes(t)) ?? !1;
2268
712
  }
2269
- function ve(...r) {
2270
- const { user: e } = G(), t = (e == null ? void 0 : e.permissions) ?? [];
2271
- return r.every((s) => t.includes(s));
713
+ function ee(...t) {
714
+ const { user: a } = z(), l = (a == null ? void 0 : a.permissions) ?? [];
715
+ return t.every((r) => l.includes(r));
2272
716
  }
2273
- const ps = ({
2274
- children: r,
2275
- fallbackpermessions: e = [],
2276
- anyPermessions: t = [],
2277
- fallbackRoles: s = ["super-admin"],
2278
- redirectTo: n = "/dashboard"
717
+ const Fe = ({
718
+ children: t,
719
+ fallbackpermessions: a = [],
720
+ anyPermessions: l = [],
721
+ fallbackRoles: r = ["super-admin"],
722
+ redirectTo: s = "/dashboard"
2279
723
  }) => {
2280
- if (s.some((u) => lt(u)))
2281
- return /* @__PURE__ */ l.createElement(l.Fragment, null, r);
2282
- const i = e.length === 0 || e.every((u) => ve(u)), o = t.length === 0 || t.some((u) => ve(u));
2283
- return i && o ? /* @__PURE__ */ l.createElement(l.Fragment, null, r) : /* @__PURE__ */ l.createElement(ie, { to: n, replace: !0 });
2284
- }, ct = l.createContext({}), xs = ct.Provider;
2285
- function ys(r, e) {
2286
- var n, a, i;
2287
- const s = (n = l.useContext(ct)[r]) == null ? void 0 : n[e];
2288
- return s ? !!((a = s.perms) != null && a.some((o) => ve(o)) || (i = s.fallbackRoles) != null && i.some((o) => lt(o))) : !1;
724
+ if (r.some((i) => he(i)))
725
+ 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) {
730
+ 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;
2289
733
  }
2290
- const bs = () => {
2291
- const { user: r, api: e, setUser: t } = G(), [s, n] = j((r == null ? void 0 : r.name) ?? ""), [a, i] = j((r == null ? void 0 : r.email) ?? ""), [o, u] = j(!1), [c, d] = j(!1), [f, m] = j({
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({
2292
736
  open: !1,
2293
737
  type: "success",
2294
738
  title: "",
2295
739
  message: ""
2296
- }), g = "+971 50 827 8229";
2297
- K(() => {
2298
- if (!f.open)
740
+ }), C = "+971 50 827 8229";
741
+ R(() => {
742
+ if (!b.open)
2299
743
  return;
2300
- const b = window.setTimeout(() => m((S) => ({ ...S, open: !1 })), 3e3);
2301
- return () => window.clearTimeout(b);
2302
- }, [f.open]), K(() => {
2303
- let b = !1;
2304
- async function S() {
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() {
2305
749
  try {
2306
- const { data: w } = await e.get("/auth/client/me");
2307
- if (b)
750
+ const { data: w } = await a.get("/auth/client/me");
751
+ if (d)
2308
752
  return;
2309
- t(w), n((w == null ? void 0 : w.name) ?? ""), i((w == null ? void 0 : w.email) ?? "");
753
+ l(w), s((w == null ? void 0 : w.name) ?? ""), o((w == null ? void 0 : w.email) ?? "");
2310
754
  } catch (w) {
2311
755
  console.error("Failed to load profile details:", w);
2312
756
  }
2313
757
  }
2314
- return S(), () => {
2315
- b = !0;
758
+ return v(), () => {
759
+ d = !0;
2316
760
  };
2317
- }, [e, t]);
2318
- const h = ae(() => (s || (r == null ? void 0 : r.name) || (r == null ? void 0 : r.email) || "").trim(), [s, r == null ? void 0 : r.name, r == null ? void 0 : r.email]), p = ae(() => h.charAt(0).toUpperCase() || "?", [h]);
2319
- async function y() {
2320
- if (r) {
2321
- d(!0);
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() {
764
+ if (t) {
765
+ p(!0);
2322
766
  try {
2323
- await e.patch("/auth/client/me", { name: s }), t({ ...r, name: s }), u(!1), m({
767
+ await a.patch("/auth/client/me", { name: r }), l({ ...t, name: r }), i(!1), E({
2324
768
  open: !0,
2325
769
  type: "success",
2326
770
  title: "Changes saved",
2327
771
  message: "Your profile was updated successfully."
2328
772
  });
2329
- } catch (b) {
2330
- console.error("Failed to update profile:", b), m({
773
+ } catch (d) {
774
+ console.error("Failed to update profile:", d), E({
2331
775
  open: !0,
2332
776
  type: "error",
2333
777
  title: "Save failed",
2334
778
  message: "Failed to save changes. Please try again."
2335
779
  });
2336
780
  } finally {
2337
- d(!1);
781
+ p(!1);
2338
782
  }
2339
783
  }
2340
784
  }
2341
- if (!r)
2342
- return /* @__PURE__ */ l.createElement("p", { className: "text-sm text-gray-500" }, "No user data available.");
2343
- const L = f.type === "success";
2344
- return /* @__PURE__ */ l.createElement("div", { className: "max-w-3xl mx-auto" }, f.open && /* @__PURE__ */ l.createElement(
785
+ if (!t)
786
+ 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(
2345
789
  "div",
2346
790
  {
2347
791
  className: "fixed top-6 right-6 z-[999999] flex items-center gap-3 rounded-xl border bg-white px-4 py-3 shadow-lg",
2348
792
  role: "status",
2349
793
  "aria-live": "polite",
2350
794
  style: {
2351
- borderColor: L ? "#BBF7D0" : "#FECACA"
795
+ borderColor: I ? "#BBF7D0" : "#FECACA"
2352
796
  }
2353
797
  },
2354
- /* @__PURE__ */ l.createElement(
798
+ /* @__PURE__ */ e.createElement(
2355
799
  "div",
2356
800
  {
2357
801
  className: "flex h-9 w-9 items-center justify-center rounded-full",
2358
802
  style: {
2359
- backgroundColor: L ? "#ECFDF5" : "#FEF2F2"
803
+ backgroundColor: I ? "#ECFDF5" : "#FEF2F2"
2360
804
  }
2361
805
  },
2362
- L ? /* @__PURE__ */ l.createElement(
806
+ I ? /* @__PURE__ */ e.createElement(
2363
807
  "svg",
2364
808
  {
2365
809
  width: "18",
@@ -2369,7 +813,7 @@ const bs = () => {
2369
813
  xmlns: "http://www.w3.org/2000/svg",
2370
814
  className: "text-green-600"
2371
815
  },
2372
- /* @__PURE__ */ l.createElement(
816
+ /* @__PURE__ */ e.createElement(
2373
817
  "path",
2374
818
  {
2375
819
  d: "M20 6L9 17L4 12",
@@ -2379,7 +823,7 @@ const bs = () => {
2379
823
  strokeLinejoin: "round"
2380
824
  }
2381
825
  )
2382
- ) : /* @__PURE__ */ l.createElement(
826
+ ) : /* @__PURE__ */ e.createElement(
2383
827
  "svg",
2384
828
  {
2385
829
  width: "18",
@@ -2389,7 +833,7 @@ const bs = () => {
2389
833
  xmlns: "http://www.w3.org/2000/svg",
2390
834
  className: "text-red-600"
2391
835
  },
2392
- /* @__PURE__ */ l.createElement(
836
+ /* @__PURE__ */ e.createElement(
2393
837
  "path",
2394
838
  {
2395
839
  d: "M12 9V13",
@@ -2398,7 +842,7 @@ const bs = () => {
2398
842
  strokeLinecap: "round"
2399
843
  }
2400
844
  ),
2401
- /* @__PURE__ */ l.createElement(
845
+ /* @__PURE__ */ e.createElement(
2402
846
  "path",
2403
847
  {
2404
848
  d: "M12 17H12.01",
@@ -2407,7 +851,7 @@ const bs = () => {
2407
851
  strokeLinecap: "round"
2408
852
  }
2409
853
  ),
2410
- /* @__PURE__ */ l.createElement(
854
+ /* @__PURE__ */ e.createElement(
2411
855
  "path",
2412
856
  {
2413
857
  d: "M10.29 3.86L1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0Z",
@@ -2418,24 +862,24 @@ const bs = () => {
2418
862
  )
2419
863
  )
2420
864
  ),
2421
- /* @__PURE__ */ l.createElement("div", { className: "flex flex-col" }, /* @__PURE__ */ l.createElement(
865
+ /* @__PURE__ */ e.createElement("div", { className: "flex flex-col" }, /* @__PURE__ */ e.createElement(
2422
866
  "span",
2423
867
  {
2424
868
  className: "text-sm font-semibold",
2425
- style: { color: L ? "#15803D" : "#B91C1C" }
869
+ style: { color: I ? "#15803D" : "#B91C1C" }
2426
870
  },
2427
- f.title
2428
- ), f.message && /* @__PURE__ */ l.createElement("span", { className: "text-xs text-gray-500" }, f.message)),
2429
- /* @__PURE__ */ l.createElement(
871
+ b.title
872
+ ), b.message && /* @__PURE__ */ e.createElement("span", { className: "text-xs text-gray-500" }, b.message)),
873
+ /* @__PURE__ */ e.createElement(
2430
874
  "button",
2431
875
  {
2432
876
  type: "button",
2433
- onClick: () => m((b) => ({ ...b, open: !1 })),
877
+ onClick: () => E((d) => ({ ...d, open: !1 })),
2434
878
  className: "ml-2 rounded-md px-2 py-1 text-gray-500 hover:bg-gray-100",
2435
879
  "aria-label": "Close",
2436
880
  title: "Close"
2437
881
  },
2438
- /* @__PURE__ */ l.createElement(
882
+ /* @__PURE__ */ e.createElement(
2439
883
  "svg",
2440
884
  {
2441
885
  width: "16",
@@ -2444,7 +888,7 @@ const bs = () => {
2444
888
  fill: "none",
2445
889
  xmlns: "http://www.w3.org/2000/svg"
2446
890
  },
2447
- /* @__PURE__ */ l.createElement(
891
+ /* @__PURE__ */ e.createElement(
2448
892
  "path",
2449
893
  {
2450
894
  d: "M18 6L6 18",
@@ -2453,7 +897,7 @@ const bs = () => {
2453
897
  strokeLinecap: "round"
2454
898
  }
2455
899
  ),
2456
- /* @__PURE__ */ l.createElement(
900
+ /* @__PURE__ */ e.createElement(
2457
901
  "path",
2458
902
  {
2459
903
  d: "M6 6L18 18",
@@ -2464,14 +908,14 @@ const bs = () => {
2464
908
  )
2465
909
  )
2466
910
  )
2467
- ), /* @__PURE__ */ l.createElement("div", { className: "rounded-2xl border border-gray-200 bg-white shadow-sm" }, /* @__PURE__ */ l.createElement("div", { className: "px-6 pt-6 pb-4" }, /* @__PURE__ */ l.createElement("div", { className: "flex items-center justify-between" }, /* @__PURE__ */ l.createElement("div", { className: "flex items-center gap-4" }, /* @__PURE__ */ l.createElement("div", { className: "relative" }, /* @__PURE__ */ l.createElement("div", { className: "h-16 w-16 rounded-full bg-blue-600 flex items-center justify-center text-white text-2xl font-semibold" }, p), /* @__PURE__ */ l.createElement(
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(
2468
912
  "button",
2469
913
  {
2470
914
  type: "button",
2471
915
  className: "absolute -bottom-1 -right-1 h-8 w-8 rounded-full border border-gray-200 bg-white shadow-sm flex items-center justify-center hover:bg-gray-50",
2472
916
  title: "Change avatar"
2473
917
  },
2474
- /* @__PURE__ */ l.createElement(
918
+ /* @__PURE__ */ e.createElement(
2475
919
  "svg",
2476
920
  {
2477
921
  width: "16",
@@ -2480,7 +924,7 @@ const bs = () => {
2480
924
  fill: "none",
2481
925
  xmlns: "http://www.w3.org/2000/svg"
2482
926
  },
2483
- /* @__PURE__ */ l.createElement(
927
+ /* @__PURE__ */ e.createElement(
2484
928
  "path",
2485
929
  {
2486
930
  d: "M12 20H21",
@@ -2489,7 +933,7 @@ const bs = () => {
2489
933
  strokeLinecap: "round"
2490
934
  }
2491
935
  ),
2492
- /* @__PURE__ */ l.createElement(
936
+ /* @__PURE__ */ e.createElement(
2493
937
  "path",
2494
938
  {
2495
939
  d: "M16.5 3.5a2.1 2.1 0 0 1 3 3L7 19l-4 1 1-4 12.5-12.5Z",
@@ -2499,24 +943,24 @@ const bs = () => {
2499
943
  }
2500
944
  )
2501
945
  )
2502
- )), /* @__PURE__ */ l.createElement("div", null, /* @__PURE__ */ l.createElement("h1", { className: "text-2xl font-semibold" }, "My Profile"), /* @__PURE__ */ l.createElement("p", { className: "text-sm text-gray-500" }, "Personal details"))), o ? /* @__PURE__ */ l.createElement(
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(
2503
947
  "button",
2504
948
  {
2505
949
  type: "button",
2506
- onClick: y,
2507
- disabled: c,
950
+ onClick: g,
951
+ disabled: m,
2508
952
  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"
2509
953
  },
2510
- c ? "Saving…" : "Save changes"
2511
- ) : /* @__PURE__ */ l.createElement(
954
+ m ? "Saving…" : "Save changes"
955
+ ) : /* @__PURE__ */ e.createElement(
2512
956
  "button",
2513
957
  {
2514
958
  type: "button",
2515
- onClick: () => u(!0),
959
+ onClick: () => i(!0),
2516
960
  title: "Edit profile",
2517
961
  className: "h-9 w-9 rounded-full border border-gray-200 bg-white shadow-sm flex items-center justify-center hover:bg-gray-50"
2518
962
  },
2519
- /* @__PURE__ */ l.createElement(
963
+ /* @__PURE__ */ e.createElement(
2520
964
  "svg",
2521
965
  {
2522
966
  width: "18",
@@ -2525,7 +969,7 @@ const bs = () => {
2525
969
  fill: "none",
2526
970
  xmlns: "http://www.w3.org/2000/svg"
2527
971
  },
2528
- /* @__PURE__ */ l.createElement(
972
+ /* @__PURE__ */ e.createElement(
2529
973
  "path",
2530
974
  {
2531
975
  d: "M12 20H21",
@@ -2534,7 +978,7 @@ const bs = () => {
2534
978
  strokeLinecap: "round"
2535
979
  }
2536
980
  ),
2537
- /* @__PURE__ */ l.createElement(
981
+ /* @__PURE__ */ e.createElement(
2538
982
  "path",
2539
983
  {
2540
984
  d: "M16.5 3.5a2.1 2.1 0 0 1 3 3L7 19l-4 1 1-4 12.5-12.5Z",
@@ -2544,38 +988,38 @@ const bs = () => {
2544
988
  }
2545
989
  )
2546
990
  )
2547
- ))), /* @__PURE__ */ l.createElement("div", { className: "px-6 pb-6 border-t border-gray-100 pt-6" }, /* @__PURE__ */ l.createElement("div", { className: "grid grid-cols-1 md:grid-cols-2 gap-5" }, /* @__PURE__ */ l.createElement("div", null, /* @__PURE__ */ l.createElement("label", { className: "block text-xs font-medium text-gray-500 mb-2" }, "Username"), /* @__PURE__ */ l.createElement(
991
+ ))), /* @__PURE__ */ e.createElement("div", { className: "px-6 pb-6 border-t border-gray-100 pt-6" }, /* @__PURE__ */ e.createElement("div", { className: "grid grid-cols-1 md:grid-cols-2 gap-5" }, /* @__PURE__ */ e.createElement("div", null, /* @__PURE__ */ e.createElement("label", { className: "block text-xs font-medium text-gray-500 mb-2" }, "Username"), /* @__PURE__ */ e.createElement(
2548
992
  "input",
2549
993
  {
2550
994
  type: "text",
2551
- value: s,
2552
- disabled: !o || c,
2553
- onChange: (b) => n(b.target.value),
2554
- className: `w-full rounded-lg border px-3 py-2 text-sm outline-none ${o ? "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"}`
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"}`
2555
999
  }
2556
- )), /* @__PURE__ */ l.createElement("div", null, /* @__PURE__ */ l.createElement("label", { className: "block text-xs font-medium text-gray-500 mb-2" }, "Email ID"), /* @__PURE__ */ l.createElement(
1000
+ )), /* @__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(
2557
1001
  "input",
2558
1002
  {
2559
1003
  type: "email",
2560
- value: a,
1004
+ value: n,
2561
1005
  disabled: !0,
2562
1006
  className: "w-full rounded-lg border border-gray-200 bg-gray-50 px-3 py-2 text-sm text-gray-700 cursor-not-allowed"
2563
1007
  }
2564
- )), /* @__PURE__ */ l.createElement("div", null, /* @__PURE__ */ l.createElement("label", { className: "block text-xs font-medium text-gray-500 mb-2" }, "Mobile number"), /* @__PURE__ */ l.createElement(
1008
+ )), /* @__PURE__ */ e.createElement("div", null, /* @__PURE__ */ e.createElement("label", { className: "block text-xs font-medium text-gray-500 mb-2" }, "Mobile number"), /* @__PURE__ */ e.createElement(
2565
1009
  "input",
2566
1010
  {
2567
1011
  type: "text",
2568
- value: g,
1012
+ value: C,
2569
1013
  disabled: !0,
2570
1014
  className: "w-full rounded-lg border border-gray-200 bg-gray-50 px-3 py-2 text-sm text-gray-700 cursor-not-allowed"
2571
1015
  }
2572
- ))), o && /* @__PURE__ */ l.createElement(
1016
+ ))), c && /* @__PURE__ */ e.createElement(
2573
1017
  "button",
2574
1018
  {
2575
1019
  type: "button",
2576
- disabled: c,
1020
+ disabled: m,
2577
1021
  onClick: () => {
2578
- u(!1), n((r == null ? void 0 : r.name) ?? "");
1022
+ i(!1), s((t == null ? void 0 : t.name) ?? "");
2579
1023
  },
2580
1024
  className: "mt-6 text-sm font-medium text-gray-600 hover:text-gray-900"
2581
1025
  },
@@ -2583,14 +1027,14 @@ const bs = () => {
2583
1027
  ))));
2584
1028
  };
2585
1029
  export {
2586
- gs as AuthProvider,
2587
- bs as ProfilePage,
2588
- ct as RbacContext,
2589
- xs as RbacProvider,
2590
- ps as RequirePermissions,
2591
- G as useAuthState,
2592
- ve as useCan,
2593
- ys as useGrant,
2594
- ms as useHasModule,
2595
- lt as useHasRole
1030
+ We as AuthProvider,
1031
+ Oe as ProfilePage,
1032
+ xe as RbacContext,
1033
+ Ge as RbacProvider,
1034
+ Fe as RequirePermissions,
1035
+ z as useAuthState,
1036
+ ee as useCan,
1037
+ Ye as useGrant,
1038
+ Ze as useHasModule,
1039
+ he as useHasRole
2596
1040
  };