@ciscode/ui-authentication-kit 1.0.3 → 1.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -1,1699 +1,148 @@
1
- import * as W 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 re } 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 Q, Navigate as ae } 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 ve, useContext as Me, useEffect as V, forwardRef as ie, createElement as ae, useState as m, useMemo as X } from "react";
3
+ import le from "axios";
4
+ import { jwtDecode as ke } from "jwt-decode";
5
+ import Ie from "react-dom";
6
+ import { useT as q } from "@ciscode/ui-translate-core";
7
+ import { useNavigate as se, useLocation as oe, Routes as Le, Route as Y, Navigate as J } from "react-router";
8
+ const me = e.createContext(null);
9
+ function de() {
10
+ const t = e.useContext(me);
11
+ 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 Z() {
16
- const r = Ke(Je);
17
- if (!r)
15
+ const ue = ve(null);
16
+ function z() {
17
+ const t = Me(ue);
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 te(t) {
23
+ const a = ke(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 re = !1;
34
+ function Ce() {
35
+ re = !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 je(t, a) {
38
+ t.defaults.withCredentials = !0;
39
+ const r = `${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;
53
- 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);
58
- } finally {
59
- s = !1;
60
- }
61
- }
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));
67
- });
68
- });
69
- }
70
- ), r;
71
- }
72
- const x = (r) => typeof r == "string", _ = () => {
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), q = (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
- } = q(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 = q(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 = q(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
- } = q(r, e, Object);
113
- n[a] = n[a] || [], n[a].push(t);
114
- }, ie = (r, e) => {
115
- const {
116
- obj: t,
117
- k: s
118
- } = q(r, e);
119
- if (t && Object.prototype.hasOwnProperty.call(t, s))
120
- return t[s];
121
- }, bt = (r, e, t) => {
122
- const s = ie(r, t);
123
- return s !== void 0 ? s : ie(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
- }, Y = (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
- }, se = (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 oe {
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 oe(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 oe(this.logger, e);
229
- }
230
- }
231
- var B = new oe();
232
- class ce {
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 ce {
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 = ie(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 = ie(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) => {
44
+ let l = !1, s = [];
45
+ return t.interceptors.response.use(
46
+ (n) => n,
47
+ async (n) => {
339
48
  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 le extends ce {
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 = le.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 $ = 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 = $, g.usedParams = this.getUsedParamsDetails(n), g) : $;
453
- }
454
- if (i) {
455
- const $ = Array.isArray(N), I = $ ? [] : {}, k = $ ? y : p;
456
- for (const R in N)
457
- if (Object.prototype.hasOwnProperty.call(N, R)) {
458
- const T = `${k}${i}${R}`;
459
- C && !h ? I[R] = this.translate(T, {
460
- ...n,
461
- defaultValue: fe(v) ? v[R] : void 0,
462
- joinArrays: !1,
463
- ns: u
464
- }) : I[R] = this.translate(T, {
465
- ...n,
466
- joinArrays: !1,
467
- ns: u
468
- }), I[R] === T && (I[R] = N[R]);
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 $ = !1, I = !1;
476
- !this.isValidLookup(h) && C && ($ = !0, h = v), this.isValidLookup(h) || (I = !0, h = o);
477
- const R = (n.missingKeyNoValueFallbackToKey || this.options.missingKeyNoValueFallbackToKey) && I ? void 0 : h, T = C && v !== h && this.options.updateMissing;
478
- if (I || $ || 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, J) => {
494
- var Ce;
495
- const Le = C && J !== h ? J : R;
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((J) => {
501
- H([D], o + J, n[`defaultValue${J}`] || 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 || $) && this.options.parseMissingKeyHandler && (h = this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey ? `${c}${d}${o}` : o, $ ? 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 = se(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 = se(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 Re = {
699
- zero: 0,
700
- one: 1,
701
- two: 2,
702
- few: 3,
703
- many: 4,
704
- other: 5
705
- }, $e = {
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 = se(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!"), $e;
733
- if (!e.match(/-|_/))
734
- return $e;
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) => Re[n] - Re[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 ? Y(a) : i || "{{", this.suffix = o ? Y(o) : u || "}}", this.formatSeparator = c || ",", this.unescapePrefix = d ? "" : f || "-", this.unescapeSuffix = this.unescapePrefix ? "" : d || "", this.nestingPrefix = m ? Y(m) : g || Y("$t("), this.nestingSuffix = h ? Y(h) : p || Y(")"), 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(se(s), n), e[i] = o), o(t);
912
- };
913
- }, jt = (r) => (e, t, s) => r(se(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;
49
+ const o = n.config;
50
+ if (((i = n.response) == null ? void 0 : i.status) !== 401 || !o || o._retry)
51
+ return Promise.reject(n);
52
+ if (o._retry = !0, !l) {
53
+ l = !0;
977
54
  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);
55
+ const { data: c } = await le.post(r, {}, { withCredentials: !0 });
56
+ return a.setAccessToken(c.accessToken), s.forEach((d) => d(c.accessToken)), s = [], t.request(o);
57
+ } catch (c) {
58
+ return !!a.getAccessToken() && !re && (re = !0, a.logout()), s.forEach((p) => p(null)), s = [], Promise.reject(c);
59
+ } finally {
60
+ l = !1;
986
61
  }
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 ce {
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
62
  }
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
- }, ne = () => {
1191
- }, Rt = (r) => {
1192
- Object.getOwnPropertyNames(Object.getPrototypeOf(r)).forEach((t) => {
1193
- typeof r[t] == "function" && (r[t] = r[t].bind(r));
1194
- });
1195
- };
1196
- class ee extends ce {
1197
- constructor(e = {}, t) {
1198
- if (super(), this.options = Fe(e), this.services = {}, this.logger = B, this.modules = {
1199
- external: []
1200
- }, Rt(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 le(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 = ne), 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 = _(), 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 = ne) {
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);
63
+ return new Promise((c, d) => {
64
+ s.push((p) => {
65
+ if (!p)
66
+ return d(n);
67
+ (o.headers ?? (o.headers = {})).Authorization = `Bearer ${p}`, c(t.request(o));
1271
68
  });
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
69
  });
1276
- } else
1277
- s(null);
1278
- }
1279
- reloadResources(e, t, s) {
1280
- const n = _();
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 = ne), 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 = _();
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
70
  }
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 = _();
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 = _();
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 ee(e, t);
1404
- return s.createInstance = ee.createInstance, s;
1405
- }
1406
- cloneInstance(e = {}, t = ne) {
1407
- const s = e.forkResourceStore;
1408
- s && delete e.forkResourceStore;
1409
- const n = {
1410
- ...this.options,
1411
- ...e,
1412
- isClone: !0
1413
- }, a = new ee(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 le(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
1452
- };
1453
- }
1454
- }
1455
- const z = ee.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 $t = (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
- G(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
- G(t) && ze[t] || (G(t) && (ze[t] = /* @__PURE__ */ new Date()), $t(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 (G(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
- }), G = (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
- }
71
+ ), t;
1555
72
  }
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) => G(U) ? U : At(U) && G(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 = G(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);
73
+ const Se = ({ onConfirm: t }) => {
74
+ const a = q("authLib");
75
+ return V(() => {
76
+ const { body: r } = document, l = r.style.overflow, s = r.style.pointerEvents;
77
+ return r.style.overflow = "hidden", r.style.pointerEvents = "none", () => {
78
+ r.style.overflow = l, r.style.pointerEvents = s;
1601
79
  };
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 ue(r) {
1621
- const { t: e } = Qt(r);
1622
- return e;
1623
- }
1624
- const Xt = ({ onConfirm: r }) => {
1625
- const e = ue("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
+ }, []), Ie.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
- }, te = ({
1647
- label: r,
1648
- type: e = "text",
1649
- placeholder: t,
1650
- color: s = "",
1651
- value: n,
1652
- onChange: a
95
+ }, P = ({
96
+ label: t,
97
+ type: a = "text",
98
+ placeholder: r,
99
+ color: l = "",
100
+ value: s,
101
+ onChange: n
1653
102
  }) => {
1654
- const i = W.useId();
1655
- return /* @__PURE__ */ W.createElement("div", { className: "mt-8 flex flex-col" }, r && /* @__PURE__ */ W.createElement(
103
+ const o = U.useId();
104
+ return /* @__PURE__ */ U.createElement("div", { className: "mt-8 flex flex-col" }, t && /* @__PURE__ */ U.createElement(
1656
105
  "label",
1657
106
  {
1658
- htmlFor: i,
107
+ htmlFor: o,
1659
108
  className: "self-start text-base text-black dark:text-white block ltr:text-left rtl:text-right"
1660
109
  },
1661
- r
1662
- ), /* @__PURE__ */ W.createElement(
110
+ t
111
+ ), /* @__PURE__ */ U.createElement(
1663
112
  "input",
1664
113
  {
1665
- id: i,
1666
- type: e,
1667
- placeholder: t || void 0,
1668
- value: n,
1669
- onChange: (o) => a == null ? void 0 : a(o.target.value),
114
+ id: o,
115
+ type: a,
116
+ placeholder: r || void 0,
117
+ value: s,
118
+ onChange: (i) => n == null ? void 0 : n(i.target.value),
1670
119
  className: `
1671
120
  px-4 py-4 mt-3.5 text-sm font-light rounded-lg border border-solid w-full
1672
121
  ltr:text-left rtl:text-right
1673
- ${s}
122
+ ${l}
1674
123
  `
1675
124
  }
1676
125
  ));
1677
- }, tt = ({ icon: r, label: e }) => /* @__PURE__ */ W.createElement("div", { className: "flex gap-5 px-8 py-3 items-center bg-indigo-50 rounded-lg max-md:px-5" }, /* @__PURE__ */ W.createElement(
126
+ }, ge = ({ icon: t, label: a }) => /* @__PURE__ */ U.createElement("div", { className: "flex gap-5 px-8 py-3 items-center bg-indigo-50 rounded-lg max-md:px-5" }, /* @__PURE__ */ U.createElement(
1678
127
  "img",
1679
128
  {
1680
129
  loading: "lazy",
1681
- src: r,
1682
- alt: e || "",
130
+ src: t,
131
+ alt: a || "",
1683
132
  className: "object-contain shrink-0 aspect-square w-[26px]"
1684
133
  }
1685
- ), e && /* @__PURE__ */ W.createElement("div", { className: "basis-auto text-sm hidden md:block ltr:text-left rtl:text-right" }, e)), st = "data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz48IS0tIFVwbG9hZGVkIHRvOiBTVkcgUmVwbywgd3d3LnN2Z3JlcG8uY29tLCBHZW5lcmF0b3I6IFNWRyBSZXBvIE1peGVyIFRvb2xzIC0tPgo8c3ZnIHdpZHRoPSI4MDBweCIgaGVpZ2h0PSI4MDBweCIgdmlld0JveD0iLTMgMCAyNjIgMjYyIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHByZXNlcnZlQXNwZWN0UmF0aW89InhNaWRZTWlkIj48cGF0aCBkPSJNMjU1Ljg3OCAxMzMuNDUxYzAtMTAuNzM0LS44NzEtMTguNTY3LTIuNzU2LTI2LjY5SDEzMC41NXY0OC40NDhoNzEuOTQ3Yy0xLjQ1IDEyLjA0LTkuMjgzIDMwLjE3Mi0yNi42OSA0Mi4zNTZsLS4yNDQgMS42MjIgMzguNzU1IDMwLjAyMyAyLjY4NS4yNjhjMjQuNjU5LTIyLjc3NCAzOC44NzUtNTYuMjgyIDM4Ljg3NS05Ni4wMjciIGZpbGw9IiM0Mjg1RjQiLz48cGF0aCBkPSJNMTMwLjU1IDI2MS4xYzM1LjI0OCAwIDY0LjgzOS0xMS42MDUgODYuNDUzLTMxLjYyMmwtNDEuMTk2LTMxLjkxM2MtMTEuMDI0IDcuNjg4LTI1LjgyIDEzLjA1NS00NS4yNTcgMTMuMDU1LTM0LjUyMyAwLTYzLjgyNC0yMi43NzMtNzQuMjY5LTU0LjI1bC0xLjUzMS4xMy00MC4yOTggMzEuMTg3LS41MjcgMS40NjVDMzUuMzkzIDIzMS43OTggNzkuNDkgMjYxLjEgMTMwLjU1IDI2MS4xIiBmaWxsPSIjMzRBODUzIi8+PHBhdGggZD0iTTU2LjI4MSAxNTYuMzdjLTIuNzU2LTguMTIzLTQuMzUxLTE2LjgyNy00LjM1MS0yNS44MiAwLTguOTk0IDEuNTk1LTE3LjY5NyA0LjIwNi0yNS44MmwtLjA3My0xLjczTDE1LjI2IDcxLjMxMmwtMS4zMzUuNjM1QzUuMDc3IDg5LjY0NCAwIDEwOS41MTcgMCAxMzAuNTVzNS4wNzcgNDAuOTA1IDEzLjkyNSA1OC42MDJsNDIuMzU2LTMyLjc4MiIgZmlsbD0iI0ZCQkMwNSIvPjxwYXRoIGQ9Ik0xMzAuNTUgNTAuNDc5YzI0LjUxNCAwIDQxLjA1IDEwLjU4OSA1MC40NzkgMTkuNDM4bDM2Ljg0NC0zNS45NzRDMTk1LjI0NSAxMi45MSAxNjUuNzk4IDAgMTMwLjU1IDAgNzkuNDkgMCAzNS4zOTMgMjkuMzAxIDEzLjkyNSA3MS45NDdsNDIuMjExIDMyLjc4M2MxMC41OS0zMS40NzcgMzkuODkxLTU0LjI1MSA3NC40MTQtNTQuMjUxIiBmaWxsPSIjRUI0MzM1Ii8+PC9zdmc+", nt = "data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz48IS0tIFVwbG9hZGVkIHRvOiBTVkcgUmVwbywgd3d3LnN2Z3JlcG8uY29tLCBHZW5lcmF0b3I6IFNWRyBSZXBvIE1peGVyIFRvb2xzIC0tPgo8c3ZnIHdpZHRoPSI4MDBweCIgaGVpZ2h0PSI4MDBweCIgdmlld0JveD0iMCAwIDE2IDE2IiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGZpbGw9Im5vbmUiPjxwYXRoIGZpbGw9IiNGMzUzMjUiIGQ9Ik0xIDFoNi41djYuNUgxVjF6Ii8+PHBhdGggZmlsbD0iIzgxQkMwNiIgZD0iTTguNSAxSDE1djYuNUg4LjVWMXoiLz48cGF0aCBmaWxsPSIjMDVBNkYwIiBkPSJNMSA4LjVoNi41VjE1SDFWOC41eiIvPjxwYXRoIGZpbGw9IiNGRkJBMDgiIGQ9Ik04LjUgOC41SDE1VjE1SDguNVY4LjV6Ii8+PC9zdmc+";
1686
- function X(r, e, t) {
1687
- return r ? r.startsWith(`${e}-`) ? r : r.startsWith("#") ? `${r}` : t : t;
134
+ ), a && /* @__PURE__ */ U.createElement("div", { className: "basis-auto text-sm hidden md:block ltr:text-left rtl:text-right" }, a)), fe = "data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz48IS0tIFVwbG9hZGVkIHRvOiBTVkcgUmVwbywgd3d3LnN2Z3JlcG8uY29tLCBHZW5lcmF0b3I6IFNWRyBSZXBvIE1peGVyIFRvb2xzIC0tPgo8c3ZnIHdpZHRoPSI4MDBweCIgaGVpZ2h0PSI4MDBweCIgdmlld0JveD0iLTMgMCAyNjIgMjYyIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHByZXNlcnZlQXNwZWN0UmF0aW89InhNaWRZTWlkIj48cGF0aCBkPSJNMjU1Ljg3OCAxMzMuNDUxYzAtMTAuNzM0LS44NzEtMTguNTY3LTIuNzU2LTI2LjY5SDEzMC41NXY0OC40NDhoNzEuOTQ3Yy0xLjQ1IDEyLjA0LTkuMjgzIDMwLjE3Mi0yNi42OSA0Mi4zNTZsLS4yNDQgMS42MjIgMzguNzU1IDMwLjAyMyAyLjY4NS4yNjhjMjQuNjU5LTIyLjc3NCAzOC44NzUtNTYuMjgyIDM4Ljg3NS05Ni4wMjciIGZpbGw9IiM0Mjg1RjQiLz48cGF0aCBkPSJNMTMwLjU1IDI2MS4xYzM1LjI0OCAwIDY0LjgzOS0xMS42MDUgODYuNDUzLTMxLjYyMmwtNDEuMTk2LTMxLjkxM2MtMTEuMDI0IDcuNjg4LTI1LjgyIDEzLjA1NS00NS4yNTcgMTMuMDU1LTM0LjUyMyAwLTYzLjgyNC0yMi43NzMtNzQuMjY5LTU0LjI1bC0xLjUzMS4xMy00MC4yOTggMzEuMTg3LS41MjcgMS40NjVDMzUuMzkzIDIzMS43OTggNzkuNDkgMjYxLjEgMTMwLjU1IDI2MS4xIiBmaWxsPSIjMzRBODUzIi8+PHBhdGggZD0iTTU2LjI4MSAxNTYuMzdjLTIuNzU2LTguMTIzLTQuMzUxLTE2LjgyNy00LjM1MS0yNS44MiAwLTguOTk0IDEuNTk1LTE3LjY5NyA0LjIwNi0yNS44MmwtLjA3My0xLjczTDE1LjI2IDcxLjMxMmwtMS4zMzUuNjM1QzUuMDc3IDg5LjY0NCAwIDEwOS41MTcgMCAxMzAuNTVzNS4wNzcgNDAuOTA1IDEzLjkyNSA1OC42MDJsNDIuMzU2LTMyLjc4MiIgZmlsbD0iI0ZCQkMwNSIvPjxwYXRoIGQ9Ik0xMzAuNTUgNTAuNDc5YzI0LjUxNCAwIDQxLjA1IDEwLjU4OSA1MC40NzkgMTkuNDM4bDM2Ljg0NC0zNS45NzRDMTk1LjI0NSAxMi45MSAxNjUuNzk4IDAgMTMwLjU1IDAgNzkuNDkgMCAzNS4zOTMgMjkuMzAxIDEzLjkyNSA3MS45NDdsNDIuMjExIDMyLjc4M2MxMC41OS0zMS40NzcgMzkuODkxLTU0LjI1MSA3NC40MTQtNTQuMjUxIiBmaWxsPSIjRUI0MzM1Ii8+PC9zdmc+", he = "data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz48IS0tIFVwbG9hZGVkIHRvOiBTVkcgUmVwbywgd3d3LnN2Z3JlcG8uY29tLCBHZW5lcmF0b3I6IFNWRyBSZXBvIE1peGVyIFRvb2xzIC0tPgo8c3ZnIHdpZHRoPSI4MDBweCIgaGVpZ2h0PSI4MDBweCIgdmlld0JveD0iMCAwIDE2IDE2IiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGZpbGw9Im5vbmUiPjxwYXRoIGZpbGw9IiNGMzUzMjUiIGQ9Ik0xIDFoNi41djYuNUgxVjF6Ii8+PHBhdGggZmlsbD0iIzgxQkMwNiIgZD0iTTguNSAxSDE1djYuNUg4LjVWMXoiLz48cGF0aCBmaWxsPSIjMDVBNkYwIiBkPSJNMSA4LjVoNi41VjE1SDFWOC41eiIvPjxwYXRoIGZpbGw9IiNGRkJBMDgiIGQ9Ik04LjUgOC41SDE1VjE1SDguNVY4LjV6Ii8+PC9zdmc+";
135
+ function O(t, a, r) {
136
+ return t ? t.startsWith(`${a}-`) ? t : t.startsWith("#") ? `${t}` : r : r;
1688
137
  }
1689
- function rt(r, e) {
1690
- 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 xe(t, a) {
139
+ const r = (a == null ? void 0 : a.bg) || "bg-sky-500", l = (a == null ? void 0 : a.text) || "text-gray-800", s = (a == null ? void 0 : a.border) || "border-gray-300", n = (a == null ? void 0 : a.fill) || "fill-current", o = (a == null ? void 0 : a.stroke) || "stroke-current";
1691
140
  return {
1692
- bgClass: X(r.bg ?? "", "bg", t),
1693
- textClass: X(r.text ?? "", "text", s),
1694
- borderClass: X(r.border ?? "", "border", n),
1695
- fillClass: X(r.fill ?? "", "fill", a),
1696
- strokeClass: X(r.stroke ?? "", "stroke", i)
141
+ bgClass: O(t.bg ?? "", "bg", r),
142
+ textClass: O(t.text ?? "", "text", l),
143
+ borderClass: O(t.border ?? "", "border", s),
144
+ fillClass: O(t.fill ?? "", "fill", n),
145
+ strokeClass: O(t.stroke ?? "", "stroke", o)
1697
146
  };
1698
147
  }
1699
148
  /**
@@ -1702,14 +151,14 @@ function rt(r, e) {
1702
151
  * This source code is licensed under the ISC license.
1703
152
  * See the LICENSE file in the root directory of this source tree.
1704
153
  */
1705
- 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 Te = (t) => t.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase(), pe = (...t) => t.filter((a, r, l) => !!a && a.trim() !== "" && l.indexOf(a) === r).join(" ").trim();
1706
155
  /**
1707
156
  * @license lucide-react v0.481.0 - ISC
1708
157
  *
1709
158
  * This source code is licensed under the ISC license.
1710
159
  * See the LICENSE file in the root directory of this source tree.
1711
160
  */
1712
- var es = {
161
+ var Pe = {
1713
162
  xmlns: "http://www.w3.org/2000/svg",
1714
163
  width: 24,
1715
164
  height: 24,
@@ -1726,31 +175,31 @@ var es = {
1726
175
  * This source code is licensed under the ISC license.
1727
176
  * See the LICENSE file in the root directory of this source tree.
1728
177
  */
1729
- const ts = Ge(
178
+ const Ue = ie(
1730
179
  ({
1731
- color: r = "currentColor",
1732
- size: e = 24,
1733
- strokeWidth: t = 2,
1734
- absoluteStrokeWidth: s,
1735
- className: n = "",
1736
- children: a,
1737
- iconNode: i,
1738
- ...o
1739
- }, u) => me(
180
+ color: t = "currentColor",
181
+ size: a = 24,
182
+ strokeWidth: r = 2,
183
+ absoluteStrokeWidth: l,
184
+ className: s = "",
185
+ children: n,
186
+ iconNode: o,
187
+ ...i
188
+ }, c) => ae(
1740
189
  "svg",
1741
190
  {
1742
- ref: u,
1743
- ...es,
1744
- width: e,
1745
- height: e,
1746
- stroke: r,
1747
- strokeWidth: s ? Number(t) * 24 / Number(e) : t,
1748
- className: at("lucide", n),
1749
- ...o
191
+ ref: c,
192
+ ...Pe,
193
+ width: a,
194
+ height: a,
195
+ stroke: t,
196
+ strokeWidth: l ? Number(r) * 24 / Number(a) : r,
197
+ className: pe("lucide", s),
198
+ ...i
1750
199
  },
1751
200
  [
1752
- ...i.map(([c, d]) => me(c, d)),
1753
- ...Array.isArray(a) ? a : [a]
201
+ ...o.map(([d, p]) => ae(d, p)),
202
+ ...Array.isArray(n) ? n : [n]
1754
203
  ]
1755
204
  )
1756
205
  );
@@ -1760,16 +209,16 @@ const ts = Ge(
1760
209
  * This source code is licensed under the ISC license.
1761
210
  * See the LICENSE file in the root directory of this source tree.
1762
211
  */
1763
- const it = (r, e) => {
1764
- const t = Ge(
1765
- ({ className: s, ...n }, a) => me(ts, {
1766
- ref: a,
1767
- iconNode: e,
1768
- className: at(`lucide-${qt(r)}`, s),
1769
- ...n
212
+ const be = (t, a) => {
213
+ const r = ie(
214
+ ({ className: l, ...s }, n) => ae(Ue, {
215
+ ref: n,
216
+ iconNode: a,
217
+ className: pe(`lucide-${Te(t)}`, l),
218
+ ...s
1770
219
  })
1771
220
  );
1772
- return t.displayName = `${r}`, t;
221
+ return r.displayName = `${t}`, r;
1773
222
  };
1774
223
  /**
1775
224
  * @license lucide-react v0.481.0 - ISC
@@ -1777,7 +226,7 @@ const it = (r, e) => {
1777
226
  * This source code is licensed under the ISC license.
1778
227
  * See the LICENSE file in the root directory of this source tree.
1779
228
  */
1780
- const ss = [
229
+ const ze = [
1781
230
  [
1782
231
  "path",
1783
232
  {
@@ -1787,27 +236,27 @@ const ss = [
1787
236
  ],
1788
237
  ["path", { d: "M12 9v4", key: "juzpu7" }],
1789
238
  ["path", { d: "M12 17h.01", key: "p32p05" }]
1790
- ], ns = it("TriangleAlert", ss);
239
+ ], De = be("TriangleAlert", ze);
1791
240
  /**
1792
241
  * @license lucide-react v0.481.0 - ISC
1793
242
  *
1794
243
  * This source code is licensed under the ISC license.
1795
244
  * See the LICENSE file in the root directory of this source tree.
1796
245
  */
1797
- const rs = [
246
+ const Ae = [
1798
247
  ["path", { d: "M18 6 6 18", key: "1bl5f8" }],
1799
248
  ["path", { d: "m6 6 12 12", key: "d8bk6v" }]
1800
- ], as = it("X", rs), ot = ({
1801
- message: r,
1802
- dismissAfterMs: e = 4e3
249
+ ], Be = be("X", Ae), we = ({
250
+ message: t,
251
+ dismissAfterMs: a = 4e3
1803
252
  }) => {
1804
- const t = ue("authLib"), [s, n] = j(!1);
1805
- return K(() => {
1806
- if (n(!!r), r && e > 0) {
1807
- const a = window.setTimeout(() => n(!1), e);
1808
- return () => window.clearTimeout(a);
253
+ const r = q("authLib"), [l, s] = m(!1);
254
+ return V(() => {
255
+ if (s(!!t), t && a > 0) {
256
+ const n = window.setTimeout(() => s(!1), a);
257
+ return () => window.clearTimeout(n);
1809
258
  }
1810
- }, [r, e]), !s || !r ? null : /* @__PURE__ */ l.createElement(
259
+ }, [t, a]), !l || !t ? null : /* @__PURE__ */ e.createElement(
1811
260
  "div",
1812
261
  {
1813
262
  role: "alert",
@@ -1817,89 +266,89 @@ const rs = [
1817
266
  rounded-lg border border-red-300 bg-red-50/80 p-4 pr-6 text-sm text-red-800
1818
267
  shadow-lg backdrop-blur
1819
268
  transition-all duration-300 ease-out
1820
- ${s ? "translate-y-0 opacity-100" : "-translate-y-2 opacity-0"}
269
+ ${l ? "translate-y-0 opacity-100" : "-translate-y-2 opacity-0"}
1821
270
  `
1822
271
  },
1823
- /* @__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" }),
1824
- /* @__PURE__ */ l.createElement(ns, { className: "mt-0.5 h-5 w-5 flex-none" }),
1825
- /* @__PURE__ */ l.createElement("span", { className: "grow leading-5 ltr:text-left rtl:text-right" }, r),
1826
- /* @__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(De, { 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(
1827
276
  "button",
1828
277
  {
1829
- onClick: () => n(!1),
1830
- "aria-label": t("inlineError.dismiss"),
278
+ onClick: () => s(!1),
279
+ "aria-label": r("inlineError.dismiss"),
1831
280
  className: `
1832
281
  absolute ltr:right-2 rtl:left-2 top-2 rounded p-1 text-red-600/70
1833
282
  hover:bg-red-100 hover:text-red-700 focus:outline-none
1834
283
  focus-visible:ring focus-visible:ring-red-500/50
1835
284
  `
1836
285
  },
1837
- /* @__PURE__ */ l.createElement(as, { className: "h-4 w-4" })
286
+ /* @__PURE__ */ e.createElement(Be, { className: "h-4 w-4" })
1838
287
  )
1839
288
  );
1840
- }, is = () => {
1841
- const r = ue("authLib"), e = Ee(), t = Se(), {
1842
- brandName: s = r("brandName", { defaultValue: "MyBrand" }),
1843
- colors: n = { bg: "bg-sky-500", text: "text-white", border: "border-sky-500" },
1844
- logoUrl: a,
1845
- oauthProviders: i = [],
1846
- illustrationUrl: o = r("community.illustrationUrl", {
289
+ }, $e = () => {
290
+ const t = q("authLib"), a = se(), r = oe(), {
291
+ brandName: l = 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: i = t("community.illustrationUrl", {
1847
296
  defaultValue: "https://cdn.builder.io/api/v1/image/assets/TEMP/35ba84b8335fda2819c3a14ea3d00321a0fd0e79e571caa31108468010868ca5?placeholderIfAbsent=true&apiKey=a460e9a46e514356ac1106eada03046c"
1848
297
  }),
1849
- communityContent: u = {
1850
- title: r("community.title"),
1851
- description: r("community.description")
298
+ communityContent: c = {
299
+ title: t("community.title"),
300
+ description: t("community.description")
1852
301
  },
1853
- baseUrl: c
302
+ baseUrl: d
1854
303
  // IMPORTANT: used for Google OAuth redirect
1855
- } = Ye(), { login: d } = Z(), [f, m] = j(""), [g, h] = j(""), [p, y] = j(!1), [L, b] = j(null), S = {
1856
- google: { icon: st, label: r("social.google") },
1857
- microsoft: { icon: nt, label: r("social.microsoft") }
1858
- }, w = i.filter((M) => M in S).map((M) => ({
1859
- id: M,
1860
- icon: S[M].icon,
1861
- label: S[M].label
1862
- })), { bgClass: C, textClass: A, borderClass: P } = rt(n), E = `${C} bg-gradient-to-r from-white/10 via-white/0 to-white/0`;
1863
- async function v(M) {
1864
- var $;
1865
- if (M.preventDefault(), !p) {
1866
- b(null), y(!0);
304
+ } = de(), { login: p } = z(), [w, E] = m(""), [C, v] = m(""), [f, h] = m(!1), [M, g] = m(null), k = {
305
+ google: { icon: fe, label: t("social.google") },
306
+ microsoft: { icon: he, label: t("social.microsoft") }
307
+ }, b = o.filter((u) => u in k).map((u) => ({
308
+ id: u,
309
+ icon: k[u].icon,
310
+ label: k[u].label
311
+ })), { bgClass: j, textClass: N, borderClass: D } = xe(s), H = `${j} bg-gradient-to-r from-white/10 via-white/0 to-white/0`;
312
+ async function A(u) {
313
+ var S;
314
+ if (u.preventDefault(), !f) {
315
+ g(null), h(!0);
1867
316
  try {
1868
- await d({ email: f, password: g });
1869
- } catch (I) {
1870
- (($ = I == null ? void 0 : I.response) == null ? void 0 : $.status) === 401 ? b(r("errors.invalidCredentials")) : b(r("errors.generic"));
317
+ await p({ email: w, password: C });
318
+ } catch (y) {
319
+ ((S = y == null ? void 0 : y.response) == null ? void 0 : S.status) === 401 ? g(t("errors.invalidCredentials")) : g(t("errors.generic"));
1871
320
  } finally {
1872
- y(!1);
321
+ h(!1);
1873
322
  }
1874
323
  }
1875
324
  }
1876
- function N(M) {
1877
- var I, k, R;
1878
- if (!c) {
325
+ function _(u) {
326
+ var y, B, I;
327
+ if (!d) {
1879
328
  console.error("Auth baseUrl is not configured.");
1880
329
  return;
1881
330
  }
1882
- const $ = ((k = (I = t.state) == null ? void 0 : I.from) == null ? void 0 : k.pathname) || ((R = t.state) == null ? void 0 : R.from) || "/";
1883
- if (sessionStorage.setItem("postLoginRedirect", $), M === "google") {
1884
- const T = "/oauth/google/callback", F = `${window.location.origin}${T}`, O = new URL(`${c}/auth/google`);
1885
- O.searchParams.set("redirect", F), window.location.href = O.toString();
331
+ const S = ((B = (y = r.state) == null ? void 0 : y.from) == null ? void 0 : B.pathname) || ((I = r.state) == null ? void 0 : I.from) || "/";
332
+ if (sessionStorage.setItem("postLoginRedirect", S), u === "google") {
333
+ const R = "/oauth/google/callback", F = `${window.location.origin}${R}`, T = new URL(`${d}/auth/google`);
334
+ T.searchParams.set("redirect", F), window.location.href = T.toString();
1886
335
  return;
1887
336
  }
1888
- if (M === "microsoft") {
1889
- const T = "/oauth/microsoft/callback", F = `${window.location.origin}${T}`, O = new URL(`${c}/auth/microsoft`);
1890
- O.searchParams.set("redirect", F), window.location.href = O.toString();
337
+ if (u === "microsoft") {
338
+ const R = "/oauth/microsoft/callback", F = `${window.location.origin}${R}`, T = new URL(`${d}/auth/microsoft`);
339
+ T.searchParams.set("redirect", F), window.location.href = T.toString();
1891
340
  return;
1892
341
  }
1893
342
  }
1894
- const U = /* @__PURE__ */ l.createElement(
343
+ const K = /* @__PURE__ */ e.createElement(
1895
344
  "svg",
1896
345
  {
1897
346
  className: "h-4 w-4 animate-spin stroke-current",
1898
347
  viewBox: "0 0 24 24",
1899
348
  fill: "none"
1900
349
  },
1901
- /* @__PURE__ */ l.createElement("circle", { className: "opacity-25", cx: "12", cy: "12", r: "10", strokeWidth: "4" }),
1902
- /* @__PURE__ */ l.createElement(
350
+ /* @__PURE__ */ e.createElement("circle", { className: "opacity-25", cx: "12", cy: "12", r: "10", strokeWidth: "4" }),
351
+ /* @__PURE__ */ e.createElement(
1903
352
  "path",
1904
353
  {
1905
354
  className: "opacity-75",
@@ -1909,153 +358,154 @@ const rs = [
1909
358
  }
1910
359
  )
1911
360
  );
1912
- 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 ${H}` }, /* @__PURE__ */ e.createElement("div", { className: "flex w-full max-w-5xl bg-white rounded-2xl shadow-2xl overflow-hidden" }, /* @__PURE__ */ e.createElement("div", { className: `hidden md:flex md:w-1/2 p-12 flex-col justify-between text-white ${j}` }, /* @__PURE__ */ e.createElement("div", null, n ? /* @__PURE__ */ e.createElement("div", { className: "flex items-center gap-4" }, /* @__PURE__ */ e.createElement(
1913
362
  "img",
1914
363
  {
1915
364
  loading: "lazy",
1916
- src: a,
365
+ src: n,
1917
366
  alt: "Brand Logo",
1918
367
  className: "bg-white h-8 md:h-22 rounded-lg"
1919
368
  }
1920
- ), /* @__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" }, l)) : /* @__PURE__ */ e.createElement("h2", { className: "text-sm md:text-2xl font-bold" }, l)), /* @__PURE__ */ e.createElement("div", { className: "flex-1 space-y-4 mt-6 py-4" }, /* @__PURE__ */ e.createElement("h3", { className: "text-2xl font-semibold leading-tight" }, c.title), /* @__PURE__ */ e.createElement("p", { className: "text-base leading-relaxed opacity-90 ltr:text-left rtl:text-right" }, c.description), /* @__PURE__ */ e.createElement("div", { className: "relative" }, /* @__PURE__ */ e.createElement("div", { className: "absolute -left-4 -top-4 w-20 h-20 bg-white/20 rounded-full blur-xl" }), /* @__PURE__ */ e.createElement("div", { className: "absolute -right-4 -bottom-4 w-20 h-20 bg-white/20 rounded-full blur-xl" }), /* @__PURE__ */ e.createElement(
1921
370
  "img",
1922
371
  {
1923
372
  loading: "lazy",
1924
- src: o,
373
+ src: i,
1925
374
  alt: "Sign in illustration",
1926
375
  className: "max-w-sm w-full mx-auto rounded-lg shadow-lg transform hover:scale-105 transition-transform duration-300 p-6"
1927
376
  }
1928
- )))), /* @__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(
1929
378
  "img",
1930
379
  {
1931
380
  loading: "lazy",
1932
- src: a,
381
+ src: n,
1933
382
  alt: "Brand Logo",
1934
- className: `h-22 rounded-full border ${P}`
383
+ className: `h-22 rounded-full border ${D}`
1935
384
  }
1936
- ) : /* @__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" }, l)), /* @__PURE__ */ e.createElement("div", { className: "w-full md:w-auto mb-4 md:mb-0 text-center md:text-left ltr:text-center rtl:text-center md:ltr:text-left md:rtl:text-right" }, /* @__PURE__ */ e.createElement("p", { className: "text-sm md:text-lg" }, t("SignInPage.welcome"), " ", /* @__PURE__ */ e.createElement("span", { className: `font-semibold ${N} uppercase` }, l)), /* @__PURE__ */ e.createElement("h1", { className: "text-2xl md:text-4xl font-bold text-gray-800" }, t("SignInPage.signIn"))), /* @__PURE__ */ e.createElement("div", { className: "text-sm text-gray-500 text-center md:text-right" }, t("SignInPage.noAccount"), /* @__PURE__ */ e.createElement("br", null), /* @__PURE__ */ e.createElement(
1937
386
  "button",
1938
387
  {
1939
388
  type: "button",
1940
- onClick: () => e("/signup"),
1941
- className: A
389
+ onClick: () => a("/signup"),
390
+ className: N
1942
391
  },
1943
- r("SignInPage.signUp")
1944
- ))), L && /* @__PURE__ */ l.createElement(ot, { message: L }), /* @__PURE__ */ l.createElement("form", { className: "space-y-6", onSubmit: v }, /* @__PURE__ */ l.createElement(
1945
- te,
392
+ t("SignInPage.signUp")
393
+ ))), M && /* @__PURE__ */ e.createElement(we, { message: M }), /* @__PURE__ */ e.createElement("form", { className: "space-y-6", onSubmit: A }, /* @__PURE__ */ e.createElement(
394
+ P,
1946
395
  {
1947
- label: r("form.emailLabel"),
396
+ label: t("form.emailLabel"),
1948
397
  type: "email",
1949
- placeholder: r("form.emailPlaceholder"),
1950
- color: P,
1951
- value: f,
1952
- onChange: m
398
+ placeholder: t("form.emailPlaceholder"),
399
+ color: D,
400
+ value: w,
401
+ onChange: E
1953
402
  }
1954
- ), /* @__PURE__ */ l.createElement(
1955
- te,
403
+ ), /* @__PURE__ */ e.createElement(
404
+ P,
1956
405
  {
1957
- label: r("form.passwordLabel"),
406
+ label: t("form.passwordLabel"),
1958
407
  type: "password",
1959
- placeholder: r("form.passwordPlaceholder"),
1960
- color: P,
1961
- value: g,
1962
- onChange: h
408
+ placeholder: t("form.passwordPlaceholder"),
409
+ color: D,
410
+ value: C,
411
+ onChange: v
1963
412
  }
1964
- ), /* @__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 ${N}` }, t("SignInPage.forgotPassword"))), /* @__PURE__ */ e.createElement(
1965
414
  "button",
1966
415
  {
1967
416
  type: "submit",
1968
- disabled: p,
1969
- 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: f,
418
+ className: `relative flex w-full items-center justify-center gap-2 py-3 rounded-lg font-medium transition-colors ${f ? "opacity-60 cursor-not-allowed" : ""} ${j} text-white`
1970
419
  },
1971
- p && U,
1972
- r(p ? "SignInPage.signInSubmitting" : "SignInPage.signIn")
1973
- ), 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
+ f && K,
421
+ t(f ? "SignInPage.signInSubmitting" : "SignInPage.signIn")
422
+ ), b.length > 0 && /* @__PURE__ */ e.createElement(e.Fragment, null, /* @__PURE__ */ e.createElement("div", { className: "flex items-center pt-2" }, /* @__PURE__ */ e.createElement("div", { className: `flex-grow h-px ${j}` }), /* @__PURE__ */ e.createElement("span", { className: `${N} mx-3 text-sm` }, t("SignInPage.orLoginWith")), /* @__PURE__ */ e.createElement("div", { className: `flex-grow h-px ${j}` })), /* @__PURE__ */ e.createElement("div", { className: "flex gap-3 mb-6 justify-center md:justify-start" }, b.map((u) => /* @__PURE__ */ e.createElement(
1974
423
  "button",
1975
424
  {
1976
- key: M.id,
425
+ key: u.id,
1977
426
  type: "button",
1978
- onClick: () => N(M.id),
427
+ onClick: () => _(u.id),
1979
428
  className: "flex-1"
1980
429
  },
1981
- /* @__PURE__ */ l.createElement(tt, { icon: M.icon, label: M.label })
430
+ /* @__PURE__ */ e.createElement(ge, { icon: u.icon, label: u.label })
1982
431
  ))))))));
1983
- }, os = () => {
1984
- const r = ue("authLib"), e = Ee(), t = Se(), {
1985
- brandName: s = r("brandName", { defaultValue: "MyBrand" }),
1986
- colors: n = { bg: "bg-sky-500", text: "text-white", border: "border-sky-500" },
1987
- logoUrl: a,
1988
- oauthProviders: i = [],
1989
- illustrationUrl: o = r("community.illustrationUrl", {
432
+ }, Ve = () => {
433
+ const t = q("authLib"), a = se(), r = oe(), {
434
+ brandName: l = 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: i = t("community.illustrationUrl", {
1990
439
  defaultValue: "https://cdn.builder.io/api/v1/image/assets/TEMP/35ba84b8335fda2819c3a14ea3d00321a0fd0e79e571caa31108468010868ca5?placeholderIfAbsent=true&apiKey=a460e9a46e514356ac1106eada03046c"
1991
440
  }),
1992
- communityContent: u = {
1993
- title: r("community.title"),
1994
- description: r("community.description")
441
+ communityContent: c = {
442
+ title: t("community.title"),
443
+ description: t("community.description")
1995
444
  },
1996
- baseUrl: c
445
+ baseUrl: d
1997
446
  // IMPORTANT: used for OAuth redirect (same as SignIn)
1998
- } = Ye(), { login: d, api: f } = Z(), [m, g] = j(""), [h, p] = j(""), [y, L] = j(""), [b, S] = j(!1), [w, C] = j(null), A = {
1999
- google: { icon: st, label: r("social.google") },
2000
- microsoft: { icon: nt, label: r("social.microsoft") }
2001
- }, P = i.filter((k) => k in A).map((k) => ({
2002
- id: k,
2003
- icon: A[k].icon,
2004
- label: A[k].label
2005
- })), { bgClass: E, textClass: v, borderClass: N } = rt(n), U = `${E} bg-gradient-to-r from-white/10 via-white/0 to-white/0`;
2006
- async function M(k) {
2007
- var R, T, F;
2008
- if (k.preventDefault(), !b) {
2009
- C(null), S(!0);
447
+ } = de(), { login: p, api: w } = z(), [E, C] = m(""), [v, f] = m(""), [h, M] = m(""), [g, k] = m(""), [b, j] = m(""), [N, D] = m(!1), [H, A] = m(null), [_, K] = m(!1), u = {
448
+ google: { icon: fe, label: t("social.google") },
449
+ microsoft: { icon: he, label: t("social.microsoft") }
450
+ }, S = o.filter((x) => x in u).map((x) => ({
451
+ id: x,
452
+ icon: u[x].icon,
453
+ label: u[x].label
454
+ })), { bgClass: y, textClass: B, borderClass: I } = xe(s), R = `${y} bg-gradient-to-r from-white/10 via-white/0 to-white/0`;
455
+ async function F(x) {
456
+ var Q, W, Z;
457
+ if (x.preventDefault(), !N) {
458
+ A(null), D(!0);
2010
459
  try {
2011
- await f.post("/auth/clients/register", {
2012
- email: h,
2013
- password: y,
2014
- name: m || void 0
2015
- }), await d({ email: h, password: y });
2016
- } catch (O) {
2017
- const H = (R = O == null ? void 0 : O.response) == null ? void 0 : R.status;
2018
- C(
2019
- 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 w.post("/api/auth/register", {
461
+ fullname: { fname: E, lname: v },
462
+ username: h,
463
+ email: g,
464
+ password: b
465
+ }), await p({ email: g, password: b });
466
+ } catch (L) {
467
+ const $ = (Q = L == null ? void 0 : L.response) == null ? void 0 : Q.status;
468
+ A(
469
+ $ === 400 ? ((Z = (W = L == null ? void 0 : L.response) == null ? void 0 : W.data) == null ? void 0 : Z.message) || t("errors.invalidData", {
2020
470
  defaultValue: "Please check the fields and try again."
2021
- }) : H === 409 ? r("errors.emailInUse", {
471
+ }) : $ === 409 ? t("errors.emailInUse", {
2022
472
  defaultValue: "This email is already in use."
2023
- }) : r("errors.generic", {
473
+ }) : t("errors.generic", {
2024
474
  defaultValue: "Something went wrong. Please try again."
2025
475
  })
2026
476
  );
2027
477
  } finally {
2028
- S(!1);
478
+ D(!1);
2029
479
  }
2030
480
  }
2031
481
  }
2032
- function $(k) {
2033
- var T, F, O;
2034
- if (!c) {
482
+ function T(x) {
483
+ var W, Z, L;
484
+ if (!d) {
2035
485
  console.error("Auth baseUrl is not configured.");
2036
486
  return;
2037
487
  }
2038
- const R = ((F = (T = t.state) == null ? void 0 : T.from) == null ? void 0 : F.pathname) || ((O = t.state) == null ? void 0 : O.from) || "/";
2039
- if (sessionStorage.setItem("postLoginRedirect", R), k === "google") {
2040
- const H = "/oauth/google/callback", D = `${window.location.origin}${H}`, V = new URL(`${c}/auth/google`);
2041
- V.searchParams.set("redirect", D), window.location.href = V.toString();
488
+ const Q = ((Z = (W = r.state) == null ? void 0 : W.from) == null ? void 0 : Z.pathname) || ((L = r.state) == null ? void 0 : L.from) || "/";
489
+ if (sessionStorage.setItem("postLoginRedirect", Q), x === "google") {
490
+ const $ = "/oauth/google/callback", ee = `${window.location.origin}${$}`, G = new URL(`${d}/auth/google`);
491
+ G.searchParams.set("redirect", ee), window.location.href = G.toString();
2042
492
  return;
2043
493
  }
2044
- if (k === "microsoft") {
2045
- const H = "/oauth/microsoft/callback", D = `${window.location.origin}${H}`, V = new URL(`${c}/auth/microsoft`);
2046
- V.searchParams.set("redirect", D), window.location.href = V.toString();
494
+ if (x === "microsoft") {
495
+ const $ = "/oauth/microsoft/callback", ee = `${window.location.origin}${$}`, G = new URL(`${d}/auth/microsoft`);
496
+ G.searchParams.set("redirect", ee), window.location.href = G.toString();
2047
497
  return;
2048
498
  }
2049
499
  }
2050
- const I = /* @__PURE__ */ l.createElement(
500
+ const Ne = /* @__PURE__ */ e.createElement(
2051
501
  "svg",
2052
502
  {
2053
503
  className: "h-4 w-4 animate-spin stroke-current",
2054
504
  viewBox: "0 0 24 24",
2055
505
  fill: "none"
2056
506
  },
2057
- /* @__PURE__ */ l.createElement("circle", { className: "opacity-25", cx: "12", cy: "12", r: "10", strokeWidth: "4" }),
2058
- /* @__PURE__ */ l.createElement(
507
+ /* @__PURE__ */ e.createElement("circle", { className: "opacity-25", cx: "12", cy: "12", r: "10", strokeWidth: "4" }),
508
+ /* @__PURE__ */ e.createElement(
2059
509
  "path",
2060
510
  {
2061
511
  className: "opacity-75",
@@ -2065,296 +515,323 @@ const rs = [
2065
515
  }
2066
516
  )
2067
517
  );
2068
- 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(
518
+ return /* @__PURE__ */ e.createElement("div", { className: `flex items-center justify-center min-h-screen p-4 ${R}` }, /* @__PURE__ */ e.createElement("div", { className: "flex w-full max-w-5xl bg-white rounded-2xl shadow-2xl overflow-hidden" }, /* @__PURE__ */ e.createElement("div", { className: `hidden md:flex md:w-1/2 p-12 flex-col justify-between text-white ${y}` }, /* @__PURE__ */ e.createElement("div", null, n ? /* @__PURE__ */ e.createElement("div", { className: "flex items-center gap-4" }, /* @__PURE__ */ e.createElement(
2069
519
  "img",
2070
520
  {
2071
521
  loading: "lazy",
2072
- src: a,
522
+ src: n,
2073
523
  alt: "Brand Logo",
2074
524
  className: "bg-white h-8 md:h-22 rounded-lg"
2075
525
  }
2076
- ), /* @__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(
526
+ ), /* @__PURE__ */ e.createElement("h2", { className: "text-sm md:text-2xl font-bold uppercase" }, l)) : /* @__PURE__ */ e.createElement("h2", { className: "text-sm md:text-2xl font-bold" }, l)), /* @__PURE__ */ e.createElement("div", { className: "flex-1 space-y-4 mt-6 py-4" }, /* @__PURE__ */ e.createElement("h3", { className: "text-2xl font-semibold leading-tight" }, c.title), /* @__PURE__ */ e.createElement("p", { className: "text-base leading-relaxed opacity-90 ltr:text-left rtl:text-right" }, c.description), /* @__PURE__ */ e.createElement("div", { className: "relative" }, /* @__PURE__ */ e.createElement("div", { className: "absolute -left-4 -top-4 w-20 h-20 bg-white/20 rounded-full blur-xl" }), /* @__PURE__ */ e.createElement("div", { className: "absolute -right-4 -bottom-4 w-20 h-20 bg-white/20 rounded-full blur-xl" }), /* @__PURE__ */ e.createElement(
2077
527
  "img",
2078
528
  {
2079
529
  loading: "lazy",
2080
- src: o,
530
+ src: i,
2081
531
  alt: "Sign up illustration",
2082
532
  className: "max-w-sm w-full mx-auto rounded-lg shadow-lg transform hover:scale-105 transition-transform duration-300 p-6"
2083
533
  }
2084
- )))), /* @__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(
534
+ )))), /* @__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(
2085
535
  "img",
2086
536
  {
2087
537
  loading: "lazy",
2088
- src: a,
538
+ src: n,
2089
539
  alt: "Brand Logo",
2090
- className: `h-22 rounded-full border ${N}`
540
+ className: `h-22 rounded-full border ${I}`
2091
541
  }
2092
- ) : /* @__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", {
542
+ ) : /* @__PURE__ */ e.createElement("h2", { className: "text-2xl font-bold" }, l)), /* @__PURE__ */ e.createElement("div", { className: "w-full md:w-auto mb-4 md:mb-0 text-center md:text-left ltr:text-center rtl:text-center md:ltr:text-left md:rtl:text-right" }, /* @__PURE__ */ e.createElement("p", { className: "text-sm md:text-lg" }, t("SignUpPage.welcome", { defaultValue: "Join" }), " ", /* @__PURE__ */ e.createElement("span", { className: `font-semibold ${B} uppercase` }, l)), /* @__PURE__ */ e.createElement("h1", { className: "text-2xl md:text-4xl font-bold text-gray-800" }, t("SignUpPage.signUp", { defaultValue: "Sign up" }))), /* @__PURE__ */ e.createElement("div", { className: "text-sm text-gray-500 text-center md:text-right" }, t("SignUpPage.alreadyHaveAccount", {
2093
543
  defaultValue: "Already have an account?"
2094
- }), /* @__PURE__ */ l.createElement("br", null), /* @__PURE__ */ l.createElement(
544
+ }), /* @__PURE__ */ e.createElement("br", null), /* @__PURE__ */ e.createElement(
2095
545
  "button",
2096
546
  {
2097
547
  type: "button",
2098
- onClick: () => e("/login"),
2099
- className: v
548
+ onClick: () => a("/login"),
549
+ className: B
2100
550
  },
2101
- r("SignUpPage.signIn", { defaultValue: "Sign in" })
2102
- ))), w && /* @__PURE__ */ l.createElement(ot, { message: w }), /* @__PURE__ */ l.createElement("form", { className: "space-y-6", onSubmit: M }, /* @__PURE__ */ l.createElement(
2103
- te,
551
+ t("SignUpPage.signIn", { defaultValue: "Sign in" })
552
+ ))), H && /* @__PURE__ */ e.createElement(we, { message: H }), /* @__PURE__ */ e.createElement("form", { className: "space-y-6", onSubmit: F }, /* @__PURE__ */ e.createElement("div", { className: "flex gap-2" }, /* @__PURE__ */ e.createElement(
553
+ P,
2104
554
  {
2105
- label: r("form.nameLabel", { defaultValue: "Name" }),
555
+ label: t("form.fnameLabel", { defaultValue: "First Name" }),
2106
556
  type: "text",
2107
- placeholder: r("form.namePlaceholder", {
2108
- defaultValue: "Enter your name"
2109
- }),
2110
- color: N,
2111
- value: m,
2112
- onChange: g
557
+ placeholder: t("form.fnamePlaceholder", { defaultValue: "Enter your first name" }),
558
+ color: I,
559
+ value: E,
560
+ onChange: C
2113
561
  }
2114
- ), /* @__PURE__ */ l.createElement(
2115
- te,
562
+ ), /* @__PURE__ */ e.createElement(
563
+ P,
2116
564
  {
2117
- label: r("form.emailLabel"),
2118
- type: "email",
2119
- placeholder: r("form.emailPlaceholder"),
2120
- color: N,
565
+ label: t("form.lnameLabel", { defaultValue: "Last Name" }),
566
+ type: "text",
567
+ placeholder: t("form.lnamePlaceholder", { defaultValue: "Enter your last name" }),
568
+ color: I,
569
+ value: v,
570
+ onChange: f
571
+ }
572
+ )), /* @__PURE__ */ e.createElement(
573
+ P,
574
+ {
575
+ label: t("form.usernameLabel", { defaultValue: "Username" }),
576
+ type: "text",
577
+ placeholder: t("form.usernamePlaceholder", { defaultValue: "Choose a username" }),
578
+ color: I,
2121
579
  value: h,
2122
- onChange: p
580
+ onChange: M
581
+ }
582
+ ), /* @__PURE__ */ e.createElement(
583
+ P,
584
+ {
585
+ label: t("form.emailLabel"),
586
+ type: "email",
587
+ placeholder: t("form.emailPlaceholder"),
588
+ color: I,
589
+ value: g,
590
+ onChange: k
2123
591
  }
2124
- ), /* @__PURE__ */ l.createElement(
2125
- te,
592
+ ), /* @__PURE__ */ e.createElement(
593
+ P,
2126
594
  {
2127
- label: r("form.passwordLabel"),
595
+ label: t("form.passwordLabel"),
2128
596
  type: "password",
2129
- placeholder: r("form.passwordPlaceholder"),
2130
- color: N,
2131
- value: y,
2132
- onChange: L
597
+ placeholder: t("form.passwordPlaceholder"),
598
+ color: I,
599
+ value: b,
600
+ onChange: j
2133
601
  }
2134
- ), /* @__PURE__ */ l.createElement(
602
+ ), /* @__PURE__ */ e.createElement("div", { className: "flex items-center gap-2" }, /* @__PURE__ */ e.createElement(
603
+ "input",
604
+ {
605
+ id: "agree",
606
+ type: "checkbox",
607
+ checked: _,
608
+ onChange: (x) => K(x.target.checked),
609
+ className: "form-checkbox"
610
+ }
611
+ ), /* @__PURE__ */ e.createElement("label", { htmlFor: "agree", className: "text-sm" }, "I agree to the ", /* @__PURE__ */ e.createElement("span", { className: "underline cursor-pointer" }, "terms and conditions"), " (placeholder)")), /* @__PURE__ */ e.createElement(
2135
612
  "button",
2136
613
  {
2137
614
  type: "submit",
2138
- disabled: b,
2139
- 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`
615
+ disabled: N,
616
+ className: `relative flex w-full items-center justify-center gap-2 py-3 rounded-lg font-medium transition-colors ${N ? "opacity-60 cursor-not-allowed" : ""} ${y} text-white`
2140
617
  },
2141
- b && I,
2142
- b ? r("SignUpPage.signUpSubmitting", {
618
+ N && Ne,
619
+ N ? t("SignUpPage.signUpSubmitting", {
2143
620
  defaultValue: "Creating account..."
2144
- }) : r("SignUpPage.signUp", { defaultValue: "Sign up" })
2145
- ), 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", {
621
+ }) : t("SignUpPage.signUp", { defaultValue: "Sign up" })
622
+ ), S.length > 0 && /* @__PURE__ */ e.createElement(e.Fragment, null, /* @__PURE__ */ e.createElement("div", { className: "flex items-center pt-2" }, /* @__PURE__ */ e.createElement("div", { className: `flex-grow h-px ${y}` }), /* @__PURE__ */ e.createElement("span", { className: `${B} mx-3 text-sm` }, t("SignUpPage.orContinueWith", {
2146
623
  defaultValue: "Or continue with"
2147
- })), /* @__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(
624
+ })), /* @__PURE__ */ e.createElement("div", { className: `flex-grow h-px ${y}` })), /* @__PURE__ */ e.createElement("div", { className: "flex gap-3 mb-6 justify-center md:justify-start" }, S.map((x) => /* @__PURE__ */ e.createElement(
2148
625
  "button",
2149
626
  {
2150
- key: k.id,
627
+ key: x.id,
2151
628
  type: "button",
2152
- onClick: () => $(k.id),
629
+ onClick: () => T(x.id),
2153
630
  className: "flex-1"
2154
631
  },
2155
- /* @__PURE__ */ l.createElement(tt, { icon: k.icon, label: k.label })
632
+ /* @__PURE__ */ e.createElement(ge, { icon: x.icon, label: x.label })
2156
633
  ))))))));
2157
- }, Be = () => (K(() => {
2158
- const r = new URLSearchParams(window.location.search), e = r.get("accessToken"), t = r.get("refreshToken");
2159
- e && localStorage.setItem("authToken", e), t && localStorage.setItem("refreshToken", t);
2160
- const s = sessionStorage.getItem("postLoginRedirect") || "/";
2161
- sessionStorage.removeItem("postLoginRedirect"), window.location.replace(s);
2162
- }, []), /* @__PURE__ */ l.createElement("div", { className: "flex items-center justify-center min-h-screen text-gray-700" }, "Finishing Google sign-in…")), ls = ({ children: r }) => {
2163
- const { isAuthenticated: e } = Z(), t = Se();
2164
- return e ? r : /* @__PURE__ */ l.createElement(ae, { to: "/login", state: { from: t }, replace: !0 });
2165
- }, gs = ({ config: r, children: e }) => {
2166
- const t = Ee(), [s, n] = j(
634
+ }, ce = () => (V(() => {
635
+ const t = new URLSearchParams(window.location.search), a = t.get("accessToken"), r = t.get("refreshToken");
636
+ a && localStorage.setItem("authToken", a), r && localStorage.setItem("refreshToken", r);
637
+ const l = sessionStorage.getItem("postLoginRedirect") || "/";
638
+ sessionStorage.removeItem("postLoginRedirect"), window.location.replace(l);
639
+ }, []), /* @__PURE__ */ e.createElement("div", { className: "flex items-center justify-center min-h-screen text-gray-700" }, "Finishing Google sign-in…")), Re = ({ children: t }) => {
640
+ const { isAuthenticated: a } = z(), r = oe();
641
+ return a ? t : /* @__PURE__ */ e.createElement(J, { to: "/login", state: { from: r }, replace: !0 });
642
+ }, He = ({ config: t, children: a }) => {
643
+ const r = se(), [l, s] = m(
2167
644
  () => localStorage.getItem("authToken")
2168
- ), [a, i] = j(null), [o, u] = j(!0), [c, d] = j(!1);
2169
- async function f() {
645
+ ), [n, o] = m(null), [i, c] = m(!0), [d, p] = m(!1);
646
+ async function w() {
2170
647
  try {
2171
- await m.post("/auth/logout");
2172
- } catch (p) {
2173
- console.warn("Logout endpoint failed, proceeding with local logout:", p);
648
+ await E.post("/auth/logout");
649
+ } catch (f) {
650
+ console.warn("Logout endpoint failed, proceeding with local logout:", f);
2174
651
  }
2175
- n(null), i(null), localStorage.removeItem("authToken"), sessionStorage.clear(), d(!1), t("/login", { replace: !0 });
652
+ s(null), o(null), localStorage.removeItem("authToken"), sessionStorage.clear(), p(!1), r("/login", { replace: !0 });
2176
653
  }
2177
- const m = re(() => {
2178
- const p = pe.create({
2179
- baseURL: r.baseUrl,
654
+ const E = X(() => {
655
+ const f = le.create({
656
+ baseURL: t.baseUrl,
2180
657
  withCredentials: !0
2181
658
  });
2182
- return mt(p, {
2183
- baseUrl: r.baseUrl,
2184
- getAccessToken: () => s,
2185
- setAccessToken: (y) => n(y),
2186
- logout: () => d(!0)
2187
- }), p;
2188
- }, [r.baseUrl, s]);
2189
- K(() => {
659
+ return je(f, {
660
+ baseUrl: t.baseUrl,
661
+ getAccessToken: () => l,
662
+ setAccessToken: (h) => s(h),
663
+ logout: () => p(!0)
664
+ }), f;
665
+ }, [t.baseUrl, l]);
666
+ V(() => {
2190
667
  (async () => {
2191
- if (s) {
2192
- i(de(s)), u(!1);
668
+ if (l) {
669
+ o(te(l)), c(!1);
2193
670
  return;
2194
671
  }
2195
672
  try {
2196
- const { data: y } = await pe.post(
2197
- `${r.baseUrl}/auth/refresh-token`,
673
+ const { data: h } = await le.post(
674
+ `${t.baseUrl}/auth/refresh-token`,
2198
675
  {},
2199
676
  { withCredentials: !0 }
2200
677
  );
2201
- n(y.accessToken), i(de(y.accessToken)), localStorage.setItem("authToken", y.accessToken);
678
+ s(h.accessToken), o(te(h.accessToken)), localStorage.setItem("authToken", h.accessToken);
2202
679
  } catch {
2203
680
  } finally {
2204
- u(!1);
681
+ c(!1);
2205
682
  }
2206
683
  })();
2207
- }, [s, r.baseUrl]);
2208
- async function g(p) {
2209
- const { data: y } = await m.post("/auth/clients/login", p);
2210
- n(y.accessToken), i(de(y.accessToken)), localStorage.setItem("authToken", y.accessToken), gt(), t("/", { replace: !0 });
684
+ }, [l, t.baseUrl]);
685
+ async function C(f) {
686
+ const { data: h } = await E.post("/api/auth/login", f);
687
+ s(h.accessToken), o(te(h.accessToken)), localStorage.setItem("authToken", h.accessToken), Ce(), r("/", { replace: !0 });
2211
688
  }
2212
- const h = re(
689
+ const v = X(
2213
690
  () => ({
2214
- isAuthenticated: !!s,
2215
- accessToken: s,
2216
- user: a,
2217
- login: g,
2218
- logout: f,
2219
- api: m,
2220
- setUser: i
691
+ isAuthenticated: !!l,
692
+ accessToken: l,
693
+ user: n,
694
+ login: C,
695
+ logout: w,
696
+ api: E,
697
+ setUser: o
2221
698
  }),
2222
- [s, a, m]
699
+ [l, n, E]
2223
700
  );
2224
- return /* @__PURE__ */ l.createElement(Ze.Provider, { value: r }, /* @__PURE__ */ l.createElement(Je.Provider, { value: h }, /* @__PURE__ */ l.createElement(ht, null, /* @__PURE__ */ l.createElement(
2225
- Q,
701
+ return /* @__PURE__ */ e.createElement(me.Provider, { value: t }, /* @__PURE__ */ e.createElement(ue.Provider, { value: v }, /* @__PURE__ */ e.createElement(Le, null, /* @__PURE__ */ e.createElement(
702
+ Y,
2226
703
  {
2227
704
  path: "login",
2228
- element: s ? /* @__PURE__ */ l.createElement(ae, { to: "/", replace: !0 }) : /* @__PURE__ */ l.createElement(is, { baseUrl: r.baseUrl, colors: r.colors })
705
+ element: l ? /* @__PURE__ */ e.createElement(J, { to: "/", replace: !0 }) : /* @__PURE__ */ e.createElement($e, { baseUrl: t.baseUrl, colors: t.colors })
2229
706
  }
2230
- ), /* @__PURE__ */ l.createElement(
2231
- Q,
707
+ ), /* @__PURE__ */ e.createElement(
708
+ Y,
2232
709
  {
2233
710
  path: "signup",
2234
- element: s ? /* @__PURE__ */ l.createElement(ae, { to: "/", replace: !0 }) : /* @__PURE__ */ l.createElement(os, null)
711
+ element: l ? /* @__PURE__ */ e.createElement(J, { to: "/", replace: !0 }) : /* @__PURE__ */ e.createElement(Ve, null)
2235
712
  }
2236
- ), /* @__PURE__ */ l.createElement(
2237
- Q,
713
+ ), /* @__PURE__ */ e.createElement(
714
+ Y,
2238
715
  {
2239
716
  path: "oauth/google/callback",
2240
- element: /* @__PURE__ */ l.createElement(Be, null)
717
+ element: /* @__PURE__ */ e.createElement(ce, null)
2241
718
  }
2242
- ), /* @__PURE__ */ l.createElement(
2243
- Q,
719
+ ), /* @__PURE__ */ e.createElement(
720
+ Y,
2244
721
  {
2245
722
  path: "/oauth/microsoft/callback",
2246
- element: /* @__PURE__ */ l.createElement(Be, null)
723
+ element: /* @__PURE__ */ e.createElement(ce, null)
2247
724
  }
2248
- ), /* @__PURE__ */ l.createElement(
2249
- Q,
725
+ ), /* @__PURE__ */ e.createElement(
726
+ Y,
2250
727
  {
2251
728
  path: "*",
2252
- element: /* @__PURE__ */ l.createElement(ls, null, e)
729
+ element: /* @__PURE__ */ e.createElement(Re, null, a)
2253
730
  }
2254
- )), c && /* @__PURE__ */ l.createElement(Xt, { onConfirm: f })));
731
+ )), d && /* @__PURE__ */ e.createElement(Se, { onConfirm: w })));
2255
732
  };
2256
- function lt(...r) {
2257
- const { user: e } = Z(), t = (e == null ? void 0 : e.roles) ?? [];
2258
- return r.some((s) => t.includes(s));
733
+ function Ee(...t) {
734
+ const { user: a } = z(), r = (a == null ? void 0 : a.roles) ?? [];
735
+ return t.some((l) => r.includes(l));
2259
736
  }
2260
- function ms(r) {
2261
- const { user: e } = Z();
2262
- return (e == null ? void 0 : e.modules.includes(r)) ?? !1;
737
+ function Qe(t) {
738
+ const { user: a } = z();
739
+ return (a == null ? void 0 : a.modules.includes(t)) ?? !1;
2263
740
  }
2264
- function ve(...r) {
2265
- const { user: e } = Z(), t = (e == null ? void 0 : e.permissions) ?? [];
2266
- return r.every((s) => t.includes(s));
741
+ function ne(...t) {
742
+ const { user: a } = z(), r = (a == null ? void 0 : a.permissions) ?? [];
743
+ return t.every((l) => r.includes(l));
2267
744
  }
2268
- const ps = ({
2269
- children: r,
2270
- fallbackpermessions: e = [],
2271
- anyPermessions: t = [],
2272
- fallbackRoles: s = ["super-admin"],
2273
- redirectTo: n = "/dashboard"
745
+ const Xe = ({
746
+ children: t,
747
+ fallbackpermessions: a = [],
748
+ anyPermessions: r = [],
749
+ fallbackRoles: l = ["super-admin"],
750
+ redirectTo: s = "/dashboard"
2274
751
  }) => {
2275
- if (s.some((u) => lt(u)))
2276
- return /* @__PURE__ */ l.createElement(l.Fragment, null, r);
2277
- const i = e.length === 0 || e.every((u) => ve(u)), o = t.length === 0 || t.some((u) => ve(u));
2278
- return i && o ? /* @__PURE__ */ l.createElement(l.Fragment, null, r) : /* @__PURE__ */ l.createElement(ae, { to: n, replace: !0 });
2279
- }, ct = l.createContext({}), xs = ct.Provider;
2280
- function ys(r, e) {
2281
- var n, a, i;
2282
- const s = (n = l.useContext(ct)[r]) == null ? void 0 : n[e];
2283
- return s ? !!((a = s.perms) != null && a.some((o) => ve(o)) || (i = s.fallbackRoles) != null && i.some((o) => lt(o))) : !1;
752
+ if (l.some((c) => Ee(c)))
753
+ return /* @__PURE__ */ e.createElement(e.Fragment, null, t);
754
+ const o = a.length === 0 || a.every((c) => ne(c)), i = r.length === 0 || r.some((c) => ne(c));
755
+ return o && i ? /* @__PURE__ */ e.createElement(e.Fragment, null, t) : /* @__PURE__ */ e.createElement(J, { to: s, replace: !0 });
756
+ }, ye = e.createContext({}), Je = ye.Provider;
757
+ function qe(t, a) {
758
+ var s, n, o;
759
+ const l = (s = e.useContext(ye)[t]) == null ? void 0 : s[a];
760
+ return l ? !!((n = l.perms) != null && n.some((i) => ne(i)) || (o = l.fallbackRoles) != null && o.some((i) => Ee(i))) : !1;
2284
761
  }
2285
- const bs = () => {
2286
- const { user: r, api: e, setUser: t } = Z(), [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({
762
+ const _e = () => {
763
+ const { user: t, api: a, setUser: r } = z(), [l, s] = m((t == null ? void 0 : t.name) ?? ""), [n, o] = m((t == null ? void 0 : t.email) ?? ""), [i, c] = m(!1), [d, p] = m(!1), [w, E] = m({
2287
764
  open: !1,
2288
765
  type: "success",
2289
766
  title: "",
2290
767
  message: ""
2291
- }), g = "+971 50 827 8229";
2292
- K(() => {
2293
- if (!f.open)
768
+ }), C = "+971 50 827 8229";
769
+ V(() => {
770
+ if (!w.open)
2294
771
  return;
2295
- const b = window.setTimeout(() => m((S) => ({ ...S, open: !1 })), 3e3);
2296
- return () => window.clearTimeout(b);
2297
- }, [f.open]), K(() => {
2298
- let b = !1;
2299
- async function S() {
772
+ const g = window.setTimeout(() => E((k) => ({ ...k, open: !1 })), 3e3);
773
+ return () => window.clearTimeout(g);
774
+ }, [w.open]), V(() => {
775
+ let g = !1;
776
+ async function k() {
2300
777
  try {
2301
- const { data: w } = await e.get("/auth/client/me");
2302
- if (b)
778
+ const { data: b } = await a.get("/auth/client/me");
779
+ if (g)
2303
780
  return;
2304
- t(w), n((w == null ? void 0 : w.name) ?? ""), i((w == null ? void 0 : w.email) ?? "");
2305
- } catch (w) {
2306
- console.error("Failed to load profile details:", w);
781
+ r(b), s((b == null ? void 0 : b.name) ?? ""), o((b == null ? void 0 : b.email) ?? "");
782
+ } catch (b) {
783
+ console.error("Failed to load profile details:", b);
2307
784
  }
2308
785
  }
2309
- return S(), () => {
2310
- b = !0;
786
+ return k(), () => {
787
+ g = !0;
2311
788
  };
2312
- }, [e, t]);
2313
- const h = re(() => (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 = re(() => h.charAt(0).toUpperCase() || "?", [h]);
2314
- async function y() {
2315
- if (r) {
2316
- d(!0);
789
+ }, [a, r]);
790
+ const v = X(() => (l || (t == null ? void 0 : t.name) || (t == null ? void 0 : t.email) || "").trim(), [l, t == null ? void 0 : t.name, t == null ? void 0 : t.email]), f = X(() => v.charAt(0).toUpperCase() || "?", [v]);
791
+ async function h() {
792
+ if (t) {
793
+ p(!0);
2317
794
  try {
2318
- await e.patch("/auth/client/me", { name: s }), t({ ...r, name: s }), u(!1), m({
795
+ await a.patch("/auth/client/me", { name: l }), r({ ...t, name: l }), c(!1), E({
2319
796
  open: !0,
2320
797
  type: "success",
2321
798
  title: "Changes saved",
2322
799
  message: "Your profile was updated successfully."
2323
800
  });
2324
- } catch (b) {
2325
- console.error("Failed to update profile:", b), m({
801
+ } catch (g) {
802
+ console.error("Failed to update profile:", g), E({
2326
803
  open: !0,
2327
804
  type: "error",
2328
805
  title: "Save failed",
2329
806
  message: "Failed to save changes. Please try again."
2330
807
  });
2331
808
  } finally {
2332
- d(!1);
809
+ p(!1);
2333
810
  }
2334
811
  }
2335
812
  }
2336
- if (!r)
2337
- return /* @__PURE__ */ l.createElement("p", { className: "text-sm text-gray-500" }, "No user data available.");
2338
- const L = f.type === "success";
2339
- return /* @__PURE__ */ l.createElement("div", { className: "max-w-3xl mx-auto" }, f.open && /* @__PURE__ */ l.createElement(
813
+ if (!t)
814
+ return /* @__PURE__ */ e.createElement("p", { className: "text-sm text-gray-500" }, "No user data available.");
815
+ const M = w.type === "success";
816
+ return /* @__PURE__ */ e.createElement("div", { className: "max-w-3xl mx-auto" }, w.open && /* @__PURE__ */ e.createElement(
2340
817
  "div",
2341
818
  {
2342
819
  className: "fixed top-6 right-6 z-[999999] flex items-center gap-3 rounded-xl border bg-white px-4 py-3 shadow-lg",
2343
820
  role: "status",
2344
821
  "aria-live": "polite",
2345
822
  style: {
2346
- borderColor: L ? "#BBF7D0" : "#FECACA"
823
+ borderColor: M ? "#BBF7D0" : "#FECACA"
2347
824
  }
2348
825
  },
2349
- /* @__PURE__ */ l.createElement(
826
+ /* @__PURE__ */ e.createElement(
2350
827
  "div",
2351
828
  {
2352
829
  className: "flex h-9 w-9 items-center justify-center rounded-full",
2353
830
  style: {
2354
- backgroundColor: L ? "#ECFDF5" : "#FEF2F2"
831
+ backgroundColor: M ? "#ECFDF5" : "#FEF2F2"
2355
832
  }
2356
833
  },
2357
- L ? /* @__PURE__ */ l.createElement(
834
+ M ? /* @__PURE__ */ e.createElement(
2358
835
  "svg",
2359
836
  {
2360
837
  width: "18",
@@ -2364,7 +841,7 @@ const bs = () => {
2364
841
  xmlns: "http://www.w3.org/2000/svg",
2365
842
  className: "text-green-600"
2366
843
  },
2367
- /* @__PURE__ */ l.createElement(
844
+ /* @__PURE__ */ e.createElement(
2368
845
  "path",
2369
846
  {
2370
847
  d: "M20 6L9 17L4 12",
@@ -2374,7 +851,7 @@ const bs = () => {
2374
851
  strokeLinejoin: "round"
2375
852
  }
2376
853
  )
2377
- ) : /* @__PURE__ */ l.createElement(
854
+ ) : /* @__PURE__ */ e.createElement(
2378
855
  "svg",
2379
856
  {
2380
857
  width: "18",
@@ -2384,7 +861,7 @@ const bs = () => {
2384
861
  xmlns: "http://www.w3.org/2000/svg",
2385
862
  className: "text-red-600"
2386
863
  },
2387
- /* @__PURE__ */ l.createElement(
864
+ /* @__PURE__ */ e.createElement(
2388
865
  "path",
2389
866
  {
2390
867
  d: "M12 9V13",
@@ -2393,7 +870,7 @@ const bs = () => {
2393
870
  strokeLinecap: "round"
2394
871
  }
2395
872
  ),
2396
- /* @__PURE__ */ l.createElement(
873
+ /* @__PURE__ */ e.createElement(
2397
874
  "path",
2398
875
  {
2399
876
  d: "M12 17H12.01",
@@ -2402,7 +879,7 @@ const bs = () => {
2402
879
  strokeLinecap: "round"
2403
880
  }
2404
881
  ),
2405
- /* @__PURE__ */ l.createElement(
882
+ /* @__PURE__ */ e.createElement(
2406
883
  "path",
2407
884
  {
2408
885
  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",
@@ -2413,24 +890,24 @@ const bs = () => {
2413
890
  )
2414
891
  )
2415
892
  ),
2416
- /* @__PURE__ */ l.createElement("div", { className: "flex flex-col" }, /* @__PURE__ */ l.createElement(
893
+ /* @__PURE__ */ e.createElement("div", { className: "flex flex-col" }, /* @__PURE__ */ e.createElement(
2417
894
  "span",
2418
895
  {
2419
896
  className: "text-sm font-semibold",
2420
- style: { color: L ? "#15803D" : "#B91C1C" }
897
+ style: { color: M ? "#15803D" : "#B91C1C" }
2421
898
  },
2422
- f.title
2423
- ), f.message && /* @__PURE__ */ l.createElement("span", { className: "text-xs text-gray-500" }, f.message)),
2424
- /* @__PURE__ */ l.createElement(
899
+ w.title
900
+ ), w.message && /* @__PURE__ */ e.createElement("span", { className: "text-xs text-gray-500" }, w.message)),
901
+ /* @__PURE__ */ e.createElement(
2425
902
  "button",
2426
903
  {
2427
904
  type: "button",
2428
- onClick: () => m((b) => ({ ...b, open: !1 })),
905
+ onClick: () => E((g) => ({ ...g, open: !1 })),
2429
906
  className: "ml-2 rounded-md px-2 py-1 text-gray-500 hover:bg-gray-100",
2430
907
  "aria-label": "Close",
2431
908
  title: "Close"
2432
909
  },
2433
- /* @__PURE__ */ l.createElement(
910
+ /* @__PURE__ */ e.createElement(
2434
911
  "svg",
2435
912
  {
2436
913
  width: "16",
@@ -2439,7 +916,7 @@ const bs = () => {
2439
916
  fill: "none",
2440
917
  xmlns: "http://www.w3.org/2000/svg"
2441
918
  },
2442
- /* @__PURE__ */ l.createElement(
919
+ /* @__PURE__ */ e.createElement(
2443
920
  "path",
2444
921
  {
2445
922
  d: "M18 6L6 18",
@@ -2448,7 +925,7 @@ const bs = () => {
2448
925
  strokeLinecap: "round"
2449
926
  }
2450
927
  ),
2451
- /* @__PURE__ */ l.createElement(
928
+ /* @__PURE__ */ e.createElement(
2452
929
  "path",
2453
930
  {
2454
931
  d: "M6 6L18 18",
@@ -2459,14 +936,14 @@ const bs = () => {
2459
936
  )
2460
937
  )
2461
938
  )
2462
- ), /* @__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(
939
+ ), /* @__PURE__ */ e.createElement("div", { className: "rounded-2xl border border-gray-200 bg-white shadow-sm" }, /* @__PURE__ */ e.createElement("div", { className: "px-6 pt-6 pb-4" }, /* @__PURE__ */ e.createElement("div", { className: "flex items-center justify-between" }, /* @__PURE__ */ e.createElement("div", { className: "flex items-center gap-4" }, /* @__PURE__ */ e.createElement("div", { className: "relative" }, /* @__PURE__ */ e.createElement("div", { className: "h-16 w-16 rounded-full bg-blue-600 flex items-center justify-center text-white text-2xl font-semibold" }, f), /* @__PURE__ */ e.createElement(
2463
940
  "button",
2464
941
  {
2465
942
  type: "button",
2466
943
  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",
2467
944
  title: "Change avatar"
2468
945
  },
2469
- /* @__PURE__ */ l.createElement(
946
+ /* @__PURE__ */ e.createElement(
2470
947
  "svg",
2471
948
  {
2472
949
  width: "16",
@@ -2475,7 +952,7 @@ const bs = () => {
2475
952
  fill: "none",
2476
953
  xmlns: "http://www.w3.org/2000/svg"
2477
954
  },
2478
- /* @__PURE__ */ l.createElement(
955
+ /* @__PURE__ */ e.createElement(
2479
956
  "path",
2480
957
  {
2481
958
  d: "M12 20H21",
@@ -2484,7 +961,7 @@ const bs = () => {
2484
961
  strokeLinecap: "round"
2485
962
  }
2486
963
  ),
2487
- /* @__PURE__ */ l.createElement(
964
+ /* @__PURE__ */ e.createElement(
2488
965
  "path",
2489
966
  {
2490
967
  d: "M16.5 3.5a2.1 2.1 0 0 1 3 3L7 19l-4 1 1-4 12.5-12.5Z",
@@ -2494,24 +971,24 @@ const bs = () => {
2494
971
  }
2495
972
  )
2496
973
  )
2497
- )), /* @__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(
974
+ )), /* @__PURE__ */ e.createElement("div", null, /* @__PURE__ */ e.createElement("h1", { className: "text-2xl font-semibold" }, "My Profile"), /* @__PURE__ */ e.createElement("p", { className: "text-sm text-gray-500" }, "Personal details"))), i ? /* @__PURE__ */ e.createElement(
2498
975
  "button",
2499
976
  {
2500
977
  type: "button",
2501
- onClick: y,
2502
- disabled: c,
978
+ onClick: h,
979
+ disabled: d,
2503
980
  className: "rounded-full border border-blue-200 bg-blue-50 px-4 py-2 text-sm font-medium text-blue-700 hover:bg-blue-100 disabled:opacity-60"
2504
981
  },
2505
- c ? "Saving…" : "Save changes"
2506
- ) : /* @__PURE__ */ l.createElement(
982
+ d ? "Saving…" : "Save changes"
983
+ ) : /* @__PURE__ */ e.createElement(
2507
984
  "button",
2508
985
  {
2509
986
  type: "button",
2510
- onClick: () => u(!0),
987
+ onClick: () => c(!0),
2511
988
  title: "Edit profile",
2512
989
  className: "h-9 w-9 rounded-full border border-gray-200 bg-white shadow-sm flex items-center justify-center hover:bg-gray-50"
2513
990
  },
2514
- /* @__PURE__ */ l.createElement(
991
+ /* @__PURE__ */ e.createElement(
2515
992
  "svg",
2516
993
  {
2517
994
  width: "18",
@@ -2520,7 +997,7 @@ const bs = () => {
2520
997
  fill: "none",
2521
998
  xmlns: "http://www.w3.org/2000/svg"
2522
999
  },
2523
- /* @__PURE__ */ l.createElement(
1000
+ /* @__PURE__ */ e.createElement(
2524
1001
  "path",
2525
1002
  {
2526
1003
  d: "M12 20H21",
@@ -2529,7 +1006,7 @@ const bs = () => {
2529
1006
  strokeLinecap: "round"
2530
1007
  }
2531
1008
  ),
2532
- /* @__PURE__ */ l.createElement(
1009
+ /* @__PURE__ */ e.createElement(
2533
1010
  "path",
2534
1011
  {
2535
1012
  d: "M16.5 3.5a2.1 2.1 0 0 1 3 3L7 19l-4 1 1-4 12.5-12.5Z",
@@ -2539,38 +1016,38 @@ const bs = () => {
2539
1016
  }
2540
1017
  )
2541
1018
  )
2542
- ))), /* @__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(
1019
+ ))), /* @__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(
2543
1020
  "input",
2544
1021
  {
2545
1022
  type: "text",
2546
- value: s,
2547
- disabled: !o || c,
2548
- onChange: (b) => n(b.target.value),
2549
- 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"}`
1023
+ value: l,
1024
+ disabled: !i || d,
1025
+ onChange: (g) => s(g.target.value),
1026
+ className: `w-full rounded-lg border px-3 py-2 text-sm outline-none ${i ? "border-gray-300 bg-white focus:border-blue-500 focus:ring-2 focus:ring-blue-100" : "border-gray-200 bg-gray-50 text-gray-700"}`
2550
1027
  }
2551
- )), /* @__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(
1028
+ )), /* @__PURE__ */ e.createElement("div", null, /* @__PURE__ */ e.createElement("label", { className: "block text-xs font-medium text-gray-500 mb-2" }, "Email ID"), /* @__PURE__ */ e.createElement(
2552
1029
  "input",
2553
1030
  {
2554
1031
  type: "email",
2555
- value: a,
1032
+ value: n,
2556
1033
  disabled: !0,
2557
1034
  className: "w-full rounded-lg border border-gray-200 bg-gray-50 px-3 py-2 text-sm text-gray-700 cursor-not-allowed"
2558
1035
  }
2559
- )), /* @__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(
1036
+ )), /* @__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(
2560
1037
  "input",
2561
1038
  {
2562
1039
  type: "text",
2563
- value: g,
1040
+ value: C,
2564
1041
  disabled: !0,
2565
1042
  className: "w-full rounded-lg border border-gray-200 bg-gray-50 px-3 py-2 text-sm text-gray-700 cursor-not-allowed"
2566
1043
  }
2567
- ))), o && /* @__PURE__ */ l.createElement(
1044
+ ))), i && /* @__PURE__ */ e.createElement(
2568
1045
  "button",
2569
1046
  {
2570
1047
  type: "button",
2571
- disabled: c,
1048
+ disabled: d,
2572
1049
  onClick: () => {
2573
- u(!1), n((r == null ? void 0 : r.name) ?? "");
1050
+ c(!1), s((t == null ? void 0 : t.name) ?? "");
2574
1051
  },
2575
1052
  className: "mt-6 text-sm font-medium text-gray-600 hover:text-gray-900"
2576
1053
  },
@@ -2578,14 +1055,14 @@ const bs = () => {
2578
1055
  ))));
2579
1056
  };
2580
1057
  export {
2581
- gs as AuthProvider,
2582
- bs as ProfilePage,
2583
- ct as RbacContext,
2584
- xs as RbacProvider,
2585
- ps as RequirePermissions,
2586
- Z as useAuthState,
2587
- ve as useCan,
2588
- ys as useGrant,
2589
- ms as useHasModule,
2590
- lt as useHasRole
1058
+ He as AuthProvider,
1059
+ _e as ProfilePage,
1060
+ ye as RbacContext,
1061
+ Je as RbacProvider,
1062
+ Xe as RequirePermissions,
1063
+ z as useAuthState,
1064
+ ne as useCan,
1065
+ qe as useGrant,
1066
+ Qe as useHasModule,
1067
+ Ee as useHasRole
2591
1068
  };