@archbase/security 3.0.3 → 3.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.js CHANGED
@@ -1,20 +1,20 @@
1
1
  import "reflect-metadata";
2
2
  import * as I from "inversify";
3
- import { decorate as vt, injectable as bt } from "inversify";
4
- import { compressString as At, decompressString as Et, IOCContainer as xt, ARCHBASE_IOC_API_TYPE as H, processErrorMessage as ee, IsNotEmpty as G, IsOptional as te, IsBoolean as K, IsEmail as St, getKeyByEnumValue as je, useArchbasePasswordRemember as kt, getI18nextInstance as x, useArchbaseTheme as It, isEmailValidate as Pt, useArchbaseAppContext as Tt } from "@archbase/core";
3
+ import { decorate as At, injectable as Et } from "inversify";
4
+ import { compressString as xt, decompressString as St, IOCContainer as kt, ARCHBASE_IOC_API_TYPE as G, processErrorMessage as ee, IsNotEmpty as J, IsOptional as re, IsBoolean as q, IsEmail as It, getKeyByEnumValue as Ve, useArchbasePasswordRemember as Pt, getI18nextInstance as S, useArchbaseTheme as Tt, isEmailValidate as Ct, useArchbaseAppContext as Ut } from "@archbase/core";
5
5
  import F from "crypto-js";
6
- import { jwtDecode as Ct } from "jwt-decode";
7
- import { jsx as u, jsxs as L, Fragment as re } from "react/jsx-runtime";
8
- import He, { useState as m, useEffect as z, createContext as De, useMemo as Ut, useRef as Dt, useCallback as pe, useContext as _e } from "react";
9
- import { BehaviorSubject as Fe } from "rxjs";
10
- import { ArchbaseRemoteApiService as ce, useArchbaseStore as Ge } from "@archbase/data";
11
- import { v4 as J } from "uuid";
12
- import { Card as Je, Text as ne, Divider as ge, Group as Ve, Select as _t, Tooltip as Rt, Button as ie, TextInput as Pe, Loader as Nt, PasswordInput as Te, Checkbox as Mt, Anchor as Bt, useMantineColorScheme as Ot } from "@mantine/core";
13
- import { useFocusTrap as Ke } from "@mantine/hooks";
14
- import { IconCopy as Lt } from "@tabler/icons-react";
15
- import { ArchbaseDialog as ze } from "@archbase/components";
16
- import { useContainer as ye } from "inversify-react";
17
- class qe {
6
+ import { jwtDecode as Dt } from "jwt-decode";
7
+ import { jsx as l, jsxs as R, Fragment as te } from "react/jsx-runtime";
8
+ import Ge, { useState as f, useEffect as z, createContext as Re, useMemo as _t, useRef as Rt, useCallback as pe, useContext as Ne } from "react";
9
+ import { BehaviorSubject as ze } from "rxjs";
10
+ import { ArchbaseRemoteApiService as ce, useArchbaseStore as Je } from "@archbase/data";
11
+ import { v4 as K } from "uuid";
12
+ import { Card as Ke, Text as se, Divider as ye, Group as we, Select as Nt, Tooltip as Bt, Button as ie, TextInput as Ce, Loader as qe, PasswordInput as Ue, Checkbox as Mt, Anchor as Ot, useMantineColorScheme as Lt, Box as $t, Stack as jt, Skeleton as fe } from "@mantine/core";
13
+ import { useFocusTrap as Ye } from "@mantine/hooks";
14
+ import { IconCopy as Ft } from "@tabler/icons-react";
15
+ import { ArchbaseDialog as We } from "@archbase/components";
16
+ import { useContainer as ve } from "inversify-react";
17
+ class Xe {
18
18
  id;
19
19
  displayName;
20
20
  email;
@@ -24,10 +24,10 @@ class qe {
24
24
  this.id = e.id, this.displayName = e.displayName, this.email = e.email, this.photo = e.photo, this.isAdmin = e.isAdmin;
25
25
  }
26
26
  static newInstance() {
27
- return new qe({});
27
+ return new Xe({});
28
28
  }
29
29
  }
30
- class Ye {
30
+ class Qe {
31
31
  username;
32
32
  password;
33
33
  remember;
@@ -35,14 +35,14 @@ class Ye {
35
35
  this.username = e.username, this.password = e.password, this.remember = e.remember;
36
36
  }
37
37
  static newInstance() {
38
- return new Ye({});
38
+ return new Qe({});
39
39
  }
40
40
  }
41
- const Q = "YngzI1guK3dGaElFcFY9MywqK3xgPzg/Ojg7eD8xRmg=", xe = "c1ab58e7-c113-4225-a190-a9e59d1207fc", Se = "6faf6932-a0b5-457b-83b1-8d89ddbd91fd", ke = "602b05c5-ec46-451e-aba6-187e463bc245", Ie = "8b4a7c2d-9e5f-4163-b8a7-3f2c9d8e5a1b";
42
- class $t {
41
+ const Q = "YngzI1guK3dGaElFcFY9MywqK3xgPzg/Ojg7eD8xRmg=", ke = "c1ab58e7-c113-4225-a190-a9e59d1207fc", Ie = "6faf6932-a0b5-457b-83b1-8d89ddbd91fd", Pe = "602b05c5-ec46-451e-aba6-187e463bc245", Te = "8b4a7c2d-9e5f-4163-b8a7-3f2c9d8e5a1b";
42
+ class Vt {
43
43
  getUsernameAndPassword() {
44
44
  try {
45
- const e = localStorage.getItem(Se);
45
+ const e = localStorage.getItem(Ie);
46
46
  if (e) {
47
47
  const t = F.AES.decrypt(e, Q).toString(F.enc.Utf8), o = atob(t).split(":");
48
48
  return { username: o[0], password: o[1], remember: !0 };
@@ -54,11 +54,11 @@ class $t {
54
54
  }
55
55
  saveUsernameAndPassword(e, t) {
56
56
  const s = btoa(`${e}:${t}`), o = F.AES.encrypt(s, Q).toString();
57
- localStorage.setItem(Se, o);
57
+ localStorage.setItem(Ie, o);
58
58
  }
59
59
  getUsername() {
60
60
  try {
61
- const e = localStorage.getItem(ke);
61
+ const e = localStorage.getItem(Pe);
62
62
  if (e) {
63
63
  const t = F.AES.decrypt(e, Q).toString(F.enc.Utf8);
64
64
  return atob(t);
@@ -70,14 +70,14 @@ class $t {
70
70
  }
71
71
  saveUsername(e) {
72
72
  const t = btoa(e), s = F.AES.encrypt(t, Q).toString();
73
- localStorage.setItem(ke, s);
73
+ localStorage.setItem(Pe, s);
74
74
  }
75
75
  isTokenExpired(e, t = 300) {
76
76
  let s = e;
77
77
  if (!s && !this.getToken())
78
78
  return !0;
79
79
  try {
80
- const o = Ct(s.access_token);
80
+ const o = Dt(s.access_token);
81
81
  if (!o)
82
82
  return !0;
83
83
  const a = Math.floor(Date.now() / 1e3), d = o.exp;
@@ -88,23 +88,23 @@ class $t {
88
88
  }
89
89
  saveToken(e) {
90
90
  if (e) {
91
- const t = JSON.stringify(e), s = F.AES.encrypt(t, Q).toString(), o = At(s);
92
- localStorage.setItem(xe, o);
91
+ const t = JSON.stringify(e), s = F.AES.encrypt(t, Q).toString(), o = xt(s);
92
+ localStorage.setItem(ke, o);
93
93
  } else
94
94
  this.clearToken();
95
95
  }
96
96
  clearUsernameAndPassword() {
97
- localStorage.removeItem(Se), localStorage.removeItem(ke);
97
+ localStorage.removeItem(Ie), localStorage.removeItem(Pe);
98
98
  }
99
99
  clearToken() {
100
- localStorage.removeItem(xe);
100
+ localStorage.removeItem(ke);
101
101
  }
102
102
  getToken() {
103
103
  try {
104
- const e = localStorage.getItem(xe);
104
+ const e = localStorage.getItem(ke);
105
105
  if (!e)
106
106
  return null;
107
- const t = Et(e), s = F.AES.decrypt(t, Q).toString(F.enc.Utf8);
107
+ const t = St(e), s = F.AES.decrypt(t, Q).toString(F.enc.Utf8);
108
108
  return JSON.parse(s);
109
109
  } catch {
110
110
  return null;
@@ -113,36 +113,36 @@ class $t {
113
113
  saveContext(e) {
114
114
  try {
115
115
  const t = F.AES.encrypt(e, Q).toString();
116
- localStorage.setItem(Ie, t);
116
+ localStorage.setItem(Te, t);
117
117
  } catch (t) {
118
118
  console.warn("Erro ao salvar contexto:", t);
119
119
  }
120
120
  }
121
121
  getContext() {
122
122
  try {
123
- const e = localStorage.getItem(Ie);
123
+ const e = localStorage.getItem(Te);
124
124
  return e ? F.AES.decrypt(e, Q).toString(F.enc.Utf8) : null;
125
125
  } catch {
126
126
  return null;
127
127
  }
128
128
  }
129
129
  clearContext() {
130
- localStorage.removeItem(Ie);
130
+ localStorage.removeItem(Te);
131
131
  }
132
132
  }
133
- vt(bt(), $t);
134
- function Xe(r) {
133
+ At(Et(), Vt);
134
+ function Ze(r) {
135
135
  const t = new Uint8Array(1);
136
- return window.crypto.getRandomValues(t), t[0] >= Math.floor(256 / r) * r ? Xe(r) : t[0] % r;
136
+ return window.crypto.getRandomValues(t), t[0] >= Math.floor(256 / r) * r ? Ze(r) : t[0] % r;
137
137
  }
138
- function jt(r) {
138
+ function zt(r) {
139
139
  let e = "";
140
140
  const t = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
141
141
  for (let s = 0; s < r; s++)
142
- e += t.charAt(Xe(t.length - 1));
142
+ e += t.charAt(Ze(t.length - 1));
143
143
  return e;
144
144
  }
145
- async function Ft(r) {
145
+ async function Wt(r) {
146
146
  if (!window.crypto.subtle?.digest)
147
147
  throw new Error(
148
148
  "The context/environment is not secure, and does not support the 'crypto.subtle' module. See: https://developer.mozilla.org/en-US/docs/Web/API/Crypto/subtle for details"
@@ -150,36 +150,36 @@ async function Ft(r) {
150
150
  const t = new TextEncoder().encode(r), s = await window.crypto.subtle.digest("SHA-256", t), o = String.fromCharCode(...new Uint8Array(s));
151
151
  return btoa(o).replace(/=/g, "").replace(/\+/g, "-").replace(/\//g, "_");
152
152
  }
153
- class Qe extends Error {
153
+ class et extends Error {
154
154
  status;
155
155
  statusText;
156
156
  constructor(e, t, s) {
157
157
  super(s), this.name = "FetchError", this.status = e, this.statusText = t;
158
158
  }
159
159
  }
160
- function Vt(r) {
160
+ function Ht(r) {
161
161
  let e = "";
162
162
  return Object.entries(r).forEach(([t, s]) => {
163
163
  e += (e ? "&" : "") + t + "=" + encodeURIComponent(s);
164
164
  }), e;
165
165
  }
166
- async function zt(r, e) {
166
+ async function Gt(r, e) {
167
167
  return fetch(r, {
168
168
  method: "POST",
169
- body: Vt(e),
169
+ body: Ht(e),
170
170
  headers: { "Content-Type": "application/x-www-form-urlencoded" }
171
171
  }).then(async (t) => {
172
172
  if (!t.ok) {
173
173
  const s = await t.text();
174
- throw new Qe(t.status, t.statusText, s);
174
+ throw new et(t.status, t.statusText, s);
175
175
  }
176
176
  return t;
177
177
  });
178
178
  }
179
- const Ze = "PKCE_code_verifier", Ce = "ROCP_auth_state";
180
- async function Wt(r, e) {
181
- const t = jt(96);
182
- return sessionStorage.setItem(Ze, t), Ft(t).then((s) => {
179
+ const tt = "PKCE_code_verifier", De = "ROCP_auth_state";
180
+ async function Jt(r, e) {
181
+ const t = zt(96);
182
+ return sessionStorage.setItem(tt, t), Wt(t).then((s) => {
183
183
  const o = new URLSearchParams({
184
184
  response_type: "code",
185
185
  client_id: r.clientId,
@@ -188,23 +188,23 @@ async function Wt(r, e) {
188
188
  code_challenge_method: "S256",
189
189
  ...r.extraAuthParameters
190
190
  });
191
- r.scope !== void 0 && o.append("scope", r.scope), sessionStorage.removeItem(Ce);
191
+ r.scope !== void 0 && o.append("scope", r.scope), sessionStorage.removeItem(De);
192
192
  const a = e ?? r.state;
193
- a && (sessionStorage.setItem(Ce, a), o.append("state", a)), r?.preLogin && r.preLogin(), window.location.replace(`${r.authorizationEndpoint}?${o.toString()}`);
193
+ a && (sessionStorage.setItem(De, a), o.append("state", a)), r?.preLogin && r.preLogin(), window.location.replace(`${r.authorizationEndpoint}?${o.toString()}`);
194
194
  });
195
195
  }
196
- function Ht(r) {
196
+ function Kt(r) {
197
197
  return r.access_token !== void 0;
198
198
  }
199
- function et(r, e) {
200
- return zt(r, e).then((t) => t.json().then((s) => {
201
- if (Ht(s))
199
+ function rt(r, e) {
200
+ return Gt(r, e).then((t) => t.json().then((s) => {
201
+ if (Kt(s))
202
202
  return s;
203
203
  throw Error(s);
204
204
  }));
205
205
  }
206
- const Gt = (r) => {
207
- const t = new URLSearchParams(window.location.search).get("code"), s = window.sessionStorage.getItem(Ze);
206
+ const qt = (r) => {
207
+ const t = new URLSearchParams(window.location.search).get("code"), s = window.sessionStorage.getItem(tt);
208
208
  if (!t)
209
209
  throw Error(`Parâmetro 'código' não encontrado na URL.
210
210
  A autenticação ocorreu?`);
@@ -221,8 +221,8 @@ A autenticação ocorreu?`);
221
221
  ...r.extraTokenParameters,
222
222
  ...r.extraAuthParams
223
223
  };
224
- return et(r.tokenEndpoint, o);
225
- }, Jt = (r) => {
224
+ return rt(r.tokenEndpoint, o);
225
+ }, Yt = (r) => {
226
226
  const { config: e, refreshToken: t } = r, s = {
227
227
  grant_type: "refresh_token",
228
228
  refresh_token: t,
@@ -231,36 +231,36 @@ A autenticação ocorreu?`);
231
231
  redirect_uri: e.redirectUri,
232
232
  ...e.extraTokenParameters
233
233
  };
234
- return et(e.tokenEndpoint, s);
234
+ return rt(e.tokenEndpoint, s);
235
235
  };
236
- function Kt(r, e, t, s, o, a) {
236
+ function Xt(r, e, t, s, o, a) {
237
237
  const d = new URLSearchParams({
238
238
  token: t || e,
239
239
  token_type_hint: t ? "refresh_token" : "access_token",
240
240
  client_id: r.clientId,
241
241
  post_logout_redirect_uri: r.logoutRedirect ?? r.redirectUri,
242
- ui_locales: window.navigator.languages.reduce((i, l) => i + " " + l),
242
+ ui_locales: window.navigator.languages.reduce((i, u) => i + " " + u),
243
243
  ...r.extraLogoutParameters
244
244
  });
245
245
  s && d.append("id_token_hint", s), o && d.append("state", o), a && d.append("logout_hint", a), window.location.replace(`${r.logoutEndpoint}?${d.toString()}`);
246
246
  }
247
- function qt(r) {
248
- const e = r.get("state"), t = sessionStorage.getItem(Ce);
247
+ function Qt(r) {
248
+ const e = r.get("state"), t = sessionStorage.getItem(De);
249
249
  if (e !== t)
250
250
  throw new Error(
251
251
  '"state" valor recebido do servidor de autenticação não corresponde à solicitação do cliente. Possível falsificação de solicitação entre sites'
252
252
  );
253
253
  }
254
254
  function Z(r, e, t) {
255
- const s = t === "session" ? sessionStorage : localStorage, [o, a] = m(() => {
255
+ const s = t === "session" ? sessionStorage : localStorage, [o, a] = f(() => {
256
256
  const i = s.getItem(r);
257
257
  try {
258
258
  return i ? JSON.parse(i) : e;
259
- } catch (l) {
259
+ } catch (u) {
260
260
  return console.warn(
261
261
  `Falha ao analisar o valor armazenado para '${r}'.
262
262
  Continuando com o valor padrão.
263
- Error: ${l.message}`
263
+ Error: ${u.message}`
264
264
  ), e;
265
265
  }
266
266
  }), d = (i) => {
@@ -269,27 +269,27 @@ Error: ${l.message}`
269
269
  return;
270
270
  }
271
271
  try {
272
- const l = i instanceof Function ? i(o) : i;
273
- a(l), s.setItem(r, JSON.stringify(l));
272
+ const u = i instanceof Function ? i(o) : i;
273
+ a(u), s.setItem(r, JSON.stringify(u));
274
274
  } catch {
275
275
  console.log(`Falha ao armazenar valor '${i}' para chave '${r}'`);
276
276
  }
277
277
  };
278
278
  return z(() => {
279
- const i = (l) => {
280
- l.storageArea === s && l.key === r && a(JSON.parse(l.newValue ?? ""));
279
+ const i = (u) => {
280
+ u.storageArea === s && u.key === r && a(JSON.parse(u.newValue ?? ""));
281
281
  };
282
282
  return window.addEventListener("storage", i, !1), () => window.removeEventListener("storage", i, !1);
283
283
  }), [o, d];
284
284
  }
285
- const kr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
285
+ const Cr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
286
286
  __proto__: null,
287
287
  default: Z
288
288
  }, Symbol.toStringTag, { value: "Module" }));
289
- function fe(r) {
289
+ function me(r) {
290
290
  return ["", void 0, null].includes(r);
291
291
  }
292
- function Yt(r) {
292
+ function Zt(r) {
293
293
  const {
294
294
  autoLogin: e = !0,
295
295
  clearURL: t = !0,
@@ -298,8 +298,8 @@ function Yt(r) {
298
298
  preLogin: a = () => null,
299
299
  postLogin: d = () => null,
300
300
  onRefreshTokenExpire: i = void 0,
301
- storage: l = "local"
302
- } = r, w = {
301
+ storage: u = "local"
302
+ } = r, y = {
303
303
  ...r,
304
304
  autoLogin: e,
305
305
  clearURL: t,
@@ -308,24 +308,24 @@ function Yt(r) {
308
308
  preLogin: a,
309
309
  postLogin: d,
310
310
  onRefreshTokenExpire: i,
311
- storage: l
311
+ storage: u
312
312
  };
313
- return Xt(w), w;
313
+ return er(y), y;
314
314
  }
315
- function Xt(r) {
316
- if (fe(r?.clientId))
315
+ function er(r) {
316
+ if (me(r?.clientId))
317
317
  throw Error(
318
318
  "'clientId' deve ser definido no objeto 'ArchbaseAuthConfig' passado para ArchbaseAuthProvider"
319
319
  );
320
- if (fe(r?.authorizationEndpoint))
320
+ if (me(r?.authorizationEndpoint))
321
321
  throw Error(
322
322
  "'authorizationEndpoint' deve ser definido no objeto 'ArchbaseAuthConfig' passado para ArchbaseAuthProvider"
323
323
  );
324
- if (fe(r?.tokenEndpoint))
324
+ if (me(r?.tokenEndpoint))
325
325
  throw Error(
326
326
  "'tokenEndpoint' deve ser definido no objeto 'ArchbaseAuthConfig' passado para ArchbaseAuthProvider"
327
327
  );
328
- if (fe(r?.redirectUri))
328
+ if (me(r?.redirectUri))
329
329
  throw Error(
330
330
  "'redirectUri' deve ser definido no objeto 'ArchbaseAuthConfig' passado para ArchbaseAuthProvider"
331
331
  );
@@ -337,23 +337,23 @@ function Xt(r) {
337
337
  "Usar 'extraAuthParams' e 'extraTokenParameters' não é recomendado. Eles fazem a mesma coisa e você deve usar apenas 'extraTokenParameters'"
338
338
  );
339
339
  }
340
- const oe = 600, se = (r) => Math.round(Date.now() / 1e3 + r);
341
- function We(r) {
340
+ const ne = 600, oe = (r) => Math.round(Date.now() / 1e3 + r);
341
+ function He(r) {
342
342
  return Math.round(Date.now()) / 1e3 + 30 >= r;
343
343
  }
344
- const Qt = [
344
+ const tr = [
345
345
  "refresh_expires_in",
346
346
  // KeyCloak
347
347
  "refresh_token_expires_in"
348
348
  // Azure AD
349
349
  ];
350
- function Zt(r, e) {
351
- for (const t of Qt)
350
+ function rr(r, e) {
351
+ for (const t of tr)
352
352
  if (t in e)
353
353
  return e[t];
354
- return e.refresh_token ? r + oe : r;
354
+ return e.refresh_token ? r + ne : r;
355
355
  }
356
- const me = (r) => {
356
+ const ge = (r) => {
357
357
  try {
358
358
  const t = r.split(".")[1].replace(/-/g, "+").replace(/_/g, "/"), s = decodeURIComponent(
359
359
  atob(t).split("").map(function(o) {
@@ -368,88 +368,88 @@ const me = (r) => {
368
368
  Você pode desativar a decodificação JWT definindo o valor 'decodeToken' como 'falso' na configuração.`
369
369
  );
370
370
  }
371
- }, er = De({
371
+ }, sr = Re({
372
372
  token: "",
373
373
  login: () => null,
374
374
  logOut: () => null,
375
375
  error: null,
376
376
  loginInProgress: !1
377
- }), Ir = ({ authConfig: r, children: e }) => {
378
- const t = Ut(() => Yt(r), [r]), [s, o] = Z(
377
+ }), Ur = ({ authConfig: r, children: e }) => {
378
+ const t = _t(() => Zt(r), [r]), [s, o] = Z(
379
379
  "ROCP_refreshToken",
380
380
  void 0,
381
381
  t.storage
382
382
  ), [a, d] = Z(
383
383
  "ROCP_refreshTokenExpire",
384
- se(2 * oe),
384
+ oe(2 * ne),
385
385
  t.storage
386
- ), [i, l] = Z("ROCP_token", "", t.storage), [w, A] = Z(
386
+ ), [i, u] = Z("ROCP_token", "", t.storage), [y, k] = Z(
387
387
  "ROCP_tokenExpire",
388
- se(oe),
388
+ oe(ne),
389
389
  t.storage
390
- ), [p, P] = Z(
390
+ ), [h, C] = Z(
391
391
  "ROCP_idToken",
392
392
  void 0,
393
393
  t.storage
394
- ), [E, y] = Z(
394
+ ), [A, g] = Z(
395
395
  "ROCP_loginInProgress",
396
396
  !1,
397
397
  t.storage
398
- ), [S, _] = Z(
398
+ ), [E, U] = Z(
399
399
  "ROCP_refreshInProgress",
400
400
  !1,
401
401
  t.storage
402
- ), [C, B] = m(), [U, D] = m(), [f, k] = m(null);
403
- let N;
404
- function O() {
405
- o(void 0), l(""), A(se(oe)), d(se(oe)), P(void 0), B(void 0), D(void 0), y(!1);
406
- }
407
- function q(h, n) {
408
- O(), k(null), t?.logoutEndpoint && Kt(t, i, s, p, h, n);
409
- }
410
- function R(h) {
411
- O(), y(!0);
412
- let n = h;
413
- h && typeof h != "string" && (console.warn(
414
- `O estado de login aprovado deve ser do tipo 'string'. Recebido'${h}'. Ignorando o valor...`
415
- ), n = void 0), Wt(t, n).catch((v) => {
416
- console.error(v), k(v.message), y(!1);
402
+ ), [D, O] = f(), [_, N] = f(), [x, b] = f(null);
403
+ let P;
404
+ function W() {
405
+ o(void 0), u(""), k(oe(ne)), d(oe(ne)), C(void 0), O(void 0), N(void 0), g(!1);
406
+ }
407
+ function L(p, n) {
408
+ W(), b(null), t?.logoutEndpoint && Xt(t, i, s, h, p, n);
409
+ }
410
+ function B(p) {
411
+ W(), g(!0);
412
+ let n = p;
413
+ p && typeof p != "string" && (console.warn(
414
+ `O estado de login aprovado deve ser do tipo 'string'. Recebido'${p}'. Ignorando o valor...`
415
+ ), n = void 0), Jt(t, n).catch((w) => {
416
+ console.error(w), b(w.message), g(!1);
417
417
  });
418
418
  }
419
- function W(h) {
420
- l(h.access_token), o(h.refresh_token);
421
- const n = t.tokenExpiresIn ?? h.expires_in ?? oe;
422
- A(se(n));
423
- const v = t.refreshTokenExpiresIn ?? Zt(n, h);
424
- d(se(v)), P(h.id_token);
419
+ function H(p) {
420
+ u(p.access_token), o(p.refresh_token);
421
+ const n = t.tokenExpiresIn ?? p.expires_in ?? ne;
422
+ k(oe(n));
423
+ const w = t.refreshTokenExpiresIn ?? rr(n, p);
424
+ d(oe(w)), C(p.id_token);
425
425
  try {
426
- h.id_token && D(me(h.id_token));
426
+ p.id_token && N(ge(p.id_token));
427
427
  } catch (c) {
428
428
  console.warn(`Falha ao decodificar idToken: ${c.message}`);
429
429
  }
430
430
  try {
431
- t.decodeToken && B(me(h.access_token));
431
+ t.decodeToken && O(ge(p.access_token));
432
432
  } catch (c) {
433
433
  console.warn(`Falha ao decodificar o token de acesso: ${c.message}`);
434
434
  }
435
435
  }
436
- function Y(h = !1) {
437
- return h || !t.onRefreshTokenExpire ? R() : t.onRefreshTokenExpire({ login: R });
436
+ function Y(p = !1) {
437
+ return p || !t.onRefreshTokenExpire ? B() : t.onRefreshTokenExpire({ login: B });
438
438
  }
439
- function $(h = !1) {
440
- if (i && We(w) && !(S && !h)) {
441
- if (We(a))
442
- return Y(h);
439
+ function $(p = !1) {
440
+ if (i && He(y) && !(E && !p)) {
441
+ if (He(a))
442
+ return Y(p);
443
443
  if (s) {
444
- _(!0), Jt({ config: t, refreshToken: s }).then((n) => W(n)).catch((n) => {
445
- if (n instanceof Qe) {
444
+ U(!0), Yt({ config: t, refreshToken: s }).then((n) => H(n)).catch((n) => {
445
+ if (n instanceof et) {
446
446
  if (n.status === 400)
447
- return Y(h);
448
- console.error(n), k(n.message), h && R();
447
+ return Y(p);
448
+ console.error(n), b(n.message), p && B();
449
449
  } else
450
- n instanceof Error && (console.error(n), k(n.message), h && R());
450
+ n instanceof Error && (console.error(n), b(n.message), p && B());
451
451
  }).finally(() => {
452
- _(!1);
452
+ U(!1);
453
453
  });
454
454
  return;
455
455
  }
@@ -458,55 +458,55 @@ const me = (r) => {
458
458
  );
459
459
  }
460
460
  }
461
- z(() => (N = setInterval(() => $(), 1e4), () => clearInterval(N)), [i, s, a, w]);
462
- const X = Dt(!1);
461
+ z(() => (P = setInterval(() => $(), 1e4), () => clearInterval(P)), [i, s, a, y]);
462
+ const X = Rt(!1);
463
463
  return z(() => {
464
- if (E) {
465
- const h = new URLSearchParams(window.location.search);
466
- if (!h.get("code")) {
467
- const n = h.get("error_description") || "Estado de autorização inválido. Atualizar a página pode resolver o problema.";
468
- console.error(n), k(n), q();
464
+ if (A) {
465
+ const p = new URLSearchParams(window.location.search);
466
+ if (!p.get("code")) {
467
+ const n = p.get("error_description") || "Estado de autorização inválido. Atualizar a página pode resolver o problema.";
468
+ console.error(n), b(n), L();
469
469
  return;
470
470
  }
471
471
  if (!X.current) {
472
472
  X.current = !0;
473
473
  try {
474
- qt(h);
474
+ Qt(p);
475
475
  } catch (n) {
476
- console.error(n), k(n.message);
476
+ console.error(n), b(n.message);
477
477
  }
478
- Gt(t).then((n) => {
479
- W(n), t?.postLogin && t.postLogin();
478
+ qt(t).then((n) => {
479
+ H(n), t?.postLogin && t.postLogin();
480
480
  }).catch((n) => {
481
- console.error(n), k(n.message);
481
+ console.error(n), b(n.message);
482
482
  }).finally(() => {
483
- t.clearURL && window.history.replaceState(null, "", window.location.pathname), y(!1);
483
+ t.clearURL && window.history.replaceState(null, "", window.location.pathname), g(!1);
484
484
  });
485
485
  }
486
486
  return;
487
487
  }
488
488
  if (!i && t.autoLogin)
489
- return R();
489
+ return B();
490
490
  try {
491
- p && D(me(p));
492
- } catch (h) {
493
- console.warn(`Falha ao decodificar idToken: ${h.message}`);
491
+ h && N(ge(h));
492
+ } catch (p) {
493
+ console.warn(`Falha ao decodificar idToken: ${p.message}`);
494
494
  }
495
495
  try {
496
- t.decodeToken && B(me(i));
497
- } catch (h) {
498
- console.warn(`Falha ao decodificar o token de acesso: ${h.message}`);
496
+ t.decodeToken && O(ge(i));
497
+ } catch (p) {
498
+ console.warn(`Falha ao decodificar o token de acesso: ${p.message}`);
499
499
  }
500
500
  $(!0);
501
- }, []), /* @__PURE__ */ u(
502
- er.Provider,
501
+ }, []), /* @__PURE__ */ l(
502
+ sr.Provider,
503
503
  {
504
- value: { token: i, tokenData: C, idToken: p, idTokenData: U, login: R, logOut: q, error: f, loginInProgress: E },
504
+ value: { token: i, tokenData: D, idToken: h, idTokenData: _, login: B, logOut: L, error: x, loginInProgress: A },
505
505
  children: e
506
506
  }
507
507
  );
508
508
  };
509
- class tt {
509
+ class st {
510
510
  resourceService;
511
511
  resource;
512
512
  actions;
@@ -515,7 +515,7 @@ class tt {
515
515
  error;
516
516
  isAdmin;
517
517
  constructor(e, t, s) {
518
- this.resourceService = xt.getContainer().get(H.Resource), this.resource = { resourceName: e, resourceDescription: t }, this.alreadyApplied = !1, this.actions = [], this.permissions = [], this.error = "", this.isAdmin = s;
518
+ this.resourceService = kt.getContainer().get(G.Resource), this.resource = { resourceName: e, resourceDescription: t }, this.alreadyApplied = !1, this.actions = [], this.permissions = [], this.error = "", this.isAdmin = s;
519
519
  }
520
520
  registerAction(e, t) {
521
521
  !this.alreadyApplied && this.actions.findIndex((s) => s.actionName === e) < 0 && this.actions.push({ actionName: e, actionDescription: t });
@@ -588,8 +588,8 @@ class tt {
588
588
  }
589
589
  class V {
590
590
  static instance;
591
- _currentTenant = new Fe(null);
592
- _availableTenants = new Fe([]);
591
+ _currentTenant = new ze(null);
592
+ _availableTenants = new ze([]);
593
593
  constructor() {
594
594
  const e = localStorage.getItem("tenant_info");
595
595
  if (e)
@@ -629,15 +629,15 @@ class V {
629
629
  return t && (e["X-TENANT-ID"] = t.id), e;
630
630
  }
631
631
  }
632
- function Pr() {
632
+ function Dr() {
633
633
  return V.getInstance();
634
634
  }
635
- var ae = /* @__PURE__ */ ((r) => (r.USER = "user", r.PROFILE = "profile", r.GROUP = "group", r))(ae || {}), tr = Object.defineProperty, b = (r, e, t, s) => {
635
+ var ae = /* @__PURE__ */ ((r) => (r.USER = "user", r.PROFILE = "profile", r.GROUP = "group", r))(ae || {}), or = Object.defineProperty, v = (r, e, t, s) => {
636
636
  for (var o = void 0, a = r.length - 1, d; a >= 0; a--)
637
637
  (d = r[a]) && (o = d(e, t, o) || o);
638
- return o && tr(e, t, o), o;
639
- }, rr = /* @__PURE__ */ ((r) => (r.VIEW = "VIEW", r.API = "API", r))(rr || {});
640
- const rt = class st {
638
+ return o && or(e, t, o), o;
639
+ }, nr = /* @__PURE__ */ ((r) => (r.VIEW = "VIEW", r.API = "API", r))(nr || {});
640
+ const ot = class nt {
641
641
  id;
642
642
  code;
643
643
  version;
@@ -648,20 +648,20 @@ const rt = class st {
648
648
  description;
649
649
  intervals;
650
650
  constructor(e) {
651
- this.id = e.id || "", this.code = e.code || "", this.version = e.version || 0, this.createEntityDate = e.createEntityDate || "", this.updateEntityDate = e.updateEntityDate || "", this.createdByUser = e.createdByUser || "", this.lastModifiedByUser = e.lastModifiedByUser || "", this.description = e.description || "", this.intervals = e.intervals ? e.intervals.map((t) => new sr(t)) : [];
651
+ this.id = e.id || "", this.code = e.code || "", this.version = e.version || 0, this.createEntityDate = e.createEntityDate || "", this.updateEntityDate = e.updateEntityDate || "", this.createdByUser = e.createdByUser || "", this.lastModifiedByUser = e.lastModifiedByUser || "", this.description = e.description || "", this.intervals = e.intervals ? e.intervals.map((t) => new ir(t)) : [];
652
652
  }
653
- static newInstance = () => new st({
654
- id: J(),
653
+ static newInstance = () => new nt({
654
+ id: K(),
655
655
  intervals: []
656
656
  });
657
657
  };
658
- b([
659
- G({
658
+ v([
659
+ J({
660
660
  message: "archbase:Informe a descrição do cronograma de acesso"
661
661
  })
662
- ], rt.prototype, "description");
663
- let ot = rt;
664
- const we = class nt {
662
+ ], ot.prototype, "description");
663
+ let it = ot;
664
+ const be = class at {
665
665
  id;
666
666
  code;
667
667
  version;
@@ -674,29 +674,29 @@ const we = class nt {
674
674
  startTime;
675
675
  endTime;
676
676
  constructor(e) {
677
- this.id = e.id || "", this.code = e.code || "", this.version = e.version || 0, this.createEntityDate = e.createEntityDate || (/* @__PURE__ */ new Date()).toISOString(), this.updateEntityDate = e.updateEntityDate || (/* @__PURE__ */ new Date()).toISOString(), this.createdByUser = e.createdByUser || "", this.lastModifiedByUser = e.lastModifiedByUser || "", this.accessSchedule = e.accessSchedule ? new ot(e.accessSchedule) : void 0, this.dayOfWeek = e.dayOfWeek || 0, this.startTime = e.startTime || "", this.endTime = e.endTime || "";
677
+ this.id = e.id || "", this.code = e.code || "", this.version = e.version || 0, this.createEntityDate = e.createEntityDate || (/* @__PURE__ */ new Date()).toISOString(), this.updateEntityDate = e.updateEntityDate || (/* @__PURE__ */ new Date()).toISOString(), this.createdByUser = e.createdByUser || "", this.lastModifiedByUser = e.lastModifiedByUser || "", this.accessSchedule = e.accessSchedule ? new it(e.accessSchedule) : void 0, this.dayOfWeek = e.dayOfWeek || 0, this.startTime = e.startTime || "", this.endTime = e.endTime || "";
678
678
  }
679
- static newInstance = () => new nt({
680
- id: J(),
679
+ static newInstance = () => new at({
680
+ id: K(),
681
681
  dayOfWeek: (/* @__PURE__ */ new Date()).getDay(),
682
682
  startTime: "08:00",
683
683
  endTime: "17:00"
684
684
  });
685
685
  };
686
- b([
687
- te()
688
- ], we.prototype, "accessSchedule");
689
- b([
690
- G({
686
+ v([
687
+ re()
688
+ ], be.prototype, "accessSchedule");
689
+ v([
690
+ J({
691
691
  message: "archbase:Informe a hora de início"
692
692
  })
693
- ], we.prototype, "startTime");
694
- b([
695
- G({
693
+ ], be.prototype, "startTime");
694
+ v([
695
+ J({
696
696
  message: "archbase:Informe a hora de término"
697
697
  })
698
- ], we.prototype, "endTime");
699
- let sr = we;
698
+ ], be.prototype, "endTime");
699
+ let ir = be;
700
700
  class le {
701
701
  id;
702
702
  code;
@@ -712,20 +712,20 @@ class le {
712
712
  this.id = e.id || "", this.code = e.code || "", this.version = e.version || 0, this.createEntityDate = e.createEntityDate || "", this.updateEntityDate = e.updateEntityDate || "", this.createdByUser = e.createdByUser || "", this.lastModifiedByUser = e.lastModifiedByUser || "", this.name = e.name || "", this.description = e.description || "", this.actions = e.actions || [];
713
713
  }
714
714
  }
715
- b([
716
- G({
715
+ v([
716
+ J({
717
717
  message: "archbase:Informe o nome"
718
718
  })
719
719
  ], le.prototype, "name");
720
- b([
721
- G({
720
+ v([
721
+ J({
722
722
  message: "archbase:Informe a descrição"
723
723
  })
724
724
  ], le.prototype, "description");
725
- b([
726
- te()
725
+ v([
726
+ re()
727
727
  ], le.prototype, "actions");
728
- const de = class it {
728
+ const de = class ct {
729
729
  id;
730
730
  code;
731
731
  version;
@@ -741,36 +741,36 @@ const de = class it {
741
741
  actionVersion;
742
742
  isNewAction;
743
743
  constructor(e) {
744
- this.id = e.id || "", this.code = e.code || "", this.version = e.version || 0, this.createEntityDate = e.createEntityDate || (/* @__PURE__ */ new Date()).toISOString(), this.updateEntityDate = e.updateEntityDate || (/* @__PURE__ */ new Date()).toISOString(), this.createdByUser = e.createdByUser || "", this.lastModifiedByUser = e.lastModifiedByUser || "", this.name = e.name || "", this.description = e.description || "", this.resource = e.resource ? new ct(e.resource) : void 0, this.category = e.category || "", this.active = e.active || !1, this.actionVersion = e.actionVersion || "", this.isNewAction = e.isNewAction || !1;
744
+ this.id = e.id || "", this.code = e.code || "", this.version = e.version || 0, this.createEntityDate = e.createEntityDate || (/* @__PURE__ */ new Date()).toISOString(), this.updateEntityDate = e.updateEntityDate || (/* @__PURE__ */ new Date()).toISOString(), this.createdByUser = e.createdByUser || "", this.lastModifiedByUser = e.lastModifiedByUser || "", this.name = e.name || "", this.description = e.description || "", this.resource = e.resource ? new dt(e.resource) : void 0, this.category = e.category || "", this.active = e.active || !1, this.actionVersion = e.actionVersion || "", this.isNewAction = e.isNewAction || !1;
745
745
  }
746
- static newInstance = () => new it({
747
- id: J(),
746
+ static newInstance = () => new ct({
747
+ id: K(),
748
748
  active: !0,
749
749
  isNewAction: !0
750
750
  });
751
751
  };
752
- b([
753
- G({
752
+ v([
753
+ J({
754
754
  message: "archbase:Informe o nome para a ação"
755
755
  })
756
756
  ], de.prototype, "name");
757
- b([
758
- G({
757
+ v([
758
+ J({
759
759
  message: "archbase:Informe a descrição para a ação"
760
760
  })
761
761
  ], de.prototype, "description");
762
- b([
763
- te()
762
+ v([
763
+ re()
764
764
  ], de.prototype, "resource");
765
- b([
766
- G({
765
+ v([
766
+ J({
767
767
  message: "archbase:Informe a categoria para a ação"
768
768
  })
769
769
  ], de.prototype, "category");
770
- b([
771
- K()
770
+ v([
771
+ q()
772
772
  ], de.prototype, "active");
773
- let or = de;
773
+ let ar = de;
774
774
  class ue extends le {
775
775
  type;
776
776
  isNewProfile;
@@ -778,11 +778,11 @@ class ue extends le {
778
778
  super(e), this.type = ae.PROFILE, this.isNewProfile = e.isNewProfile || !1;
779
779
  }
780
780
  static newInstance = () => new ue({
781
- id: J(),
781
+ id: K(),
782
782
  isNewProfile: !0
783
783
  });
784
784
  }
785
- class Re {
785
+ class Be {
786
786
  id;
787
787
  code;
788
788
  version;
@@ -794,8 +794,8 @@ class Re {
794
794
  constructor(e) {
795
795
  this.id = e.id, this.code = e.code || "", this.version = e.version || 0, this.createEntityDate = e.createEntityDate || (/* @__PURE__ */ new Date()).toISOString(), this.updateEntityDate = e.updateEntityDate || (/* @__PURE__ */ new Date()).toISOString(), this.createdByUser = e.createdByUser || "", this.lastModifiedByUser = e.lastModifiedByUser || "", this.group = e.group ? new he(e.group) : void 0;
796
796
  }
797
- static newInstance = (e) => new Re({
798
- id: J(),
797
+ static newInstance = (e) => new Be({
798
+ id: K(),
799
799
  group: e
800
800
  });
801
801
  }
@@ -806,11 +806,11 @@ class he extends le {
806
806
  super(e), this.type = ae.GROUP, this.isNewGroup = e.isNewGroup || !1;
807
807
  }
808
808
  static newInstance = () => new he({
809
- id: J(),
809
+ id: K(),
810
810
  isNewGroup: !0
811
811
  });
812
812
  }
813
- const ve = class at {
813
+ const Ae = class lt {
814
814
  id;
815
815
  code;
816
816
  version;
@@ -827,28 +827,28 @@ const ve = class at {
827
827
  constructor(e) {
828
828
  this.id = e.id || "", this.code = e.code || "", this.version = e.version || 0, this.createEntityDate = e.createEntityDate || "", this.updateEntityDate = e.updateEntityDate || "", this.createdByUser = e.createdByUser || "", this.lastModifiedByUser = e.lastModifiedByUser || "", this.name = e.name || "", this.description = e.description || "", this.actions = e.actions || [], this.active = e.active || !1, this.type = e.type || "VIEW", this.isNewResource = e.isNewResource || !1;
829
829
  }
830
- static newInstance = () => new at({
831
- id: J(),
830
+ static newInstance = () => new lt({
831
+ id: K(),
832
832
  actions: [],
833
833
  active: !0,
834
834
  isNewResource: !0
835
835
  });
836
836
  };
837
- b([
838
- G({
837
+ v([
838
+ J({
839
839
  message: "archbase:Informe o nome para o recurso"
840
840
  })
841
- ], ve.prototype, "name");
842
- b([
843
- G({
841
+ ], Ae.prototype, "name");
842
+ v([
843
+ J({
844
844
  message: "archbase:Informe a descrição para o recurso"
845
845
  })
846
- ], ve.prototype, "description");
847
- b([
848
- K()
849
- ], ve.prototype, "active");
850
- let ct = ve;
851
- const M = class lt extends le {
846
+ ], Ae.prototype, "description");
847
+ v([
848
+ q()
849
+ ], Ae.prototype, "active");
850
+ let dt = Ae;
851
+ const M = class ut extends le {
852
852
  userName;
853
853
  password;
854
854
  changePasswordOnNextLogin;
@@ -868,10 +868,10 @@ const M = class lt extends le {
868
868
  type;
869
869
  isNewUser;
870
870
  constructor(e) {
871
- super(e), this.type = ae.USER, this.userName = e.userName || "", this.password = e.password || "", this.changePasswordOnNextLogin = e.changePasswordOnNextLogin || !1, this.allowPasswordChange = e.allowPasswordChange || !1, this.allowMultipleLogins = e.allowMultipleLogins || !1, this.passwordNeverExpires = e.passwordNeverExpires || !1, this.accountDeactivated = e.accountDeactivated || !1, this.accountLocked = e.accountLocked || !1, this.unlimitedAccessHours = e.unlimitedAccessHours || !1, this.isAdministrator = e.isAdministrator || !1, this.accessSchedule = e.accessSchedule ? new ot(e.accessSchedule) : void 0, this.groups = e.groups ? e.groups.map((t) => new Re(t)) : [], this.profile = e.profile ? new ue(e.profile) : void 0, this.email = e.email || "", this.avatar = e.avatar || void 0, this.isNewUser = e.isNewUser || !1, this.nickname = e.nickname;
871
+ super(e), this.type = ae.USER, this.userName = e.userName || "", this.password = e.password || "", this.changePasswordOnNextLogin = e.changePasswordOnNextLogin || !1, this.allowPasswordChange = e.allowPasswordChange || !1, this.allowMultipleLogins = e.allowMultipleLogins || !1, this.passwordNeverExpires = e.passwordNeverExpires || !1, this.accountDeactivated = e.accountDeactivated || !1, this.accountLocked = e.accountLocked || !1, this.unlimitedAccessHours = e.unlimitedAccessHours || !1, this.isAdministrator = e.isAdministrator || !1, this.accessSchedule = e.accessSchedule ? new it(e.accessSchedule) : void 0, this.groups = e.groups ? e.groups.map((t) => new Be(t)) : [], this.profile = e.profile ? new ue(e.profile) : void 0, this.email = e.email || "", this.avatar = e.avatar || void 0, this.isNewUser = e.isNewUser || !1, this.nickname = e.nickname;
872
872
  }
873
- static newInstance = () => new lt({
874
- id: J(),
873
+ static newInstance = () => new ut({
874
+ id: K(),
875
875
  userName: "",
876
876
  password: "",
877
877
  groups: [],
@@ -882,54 +882,54 @@ const M = class lt extends le {
882
882
  isNewUser: !0
883
883
  });
884
884
  };
885
- b([
886
- G({
885
+ v([
886
+ J({
887
887
  message: "archbase:Informe o nome de usuário"
888
888
  })
889
889
  ], M.prototype, "userName");
890
- b([
891
- K()
890
+ v([
891
+ q()
892
892
  ], M.prototype, "changePasswordOnNextLogin");
893
- b([
894
- K()
893
+ v([
894
+ q()
895
895
  ], M.prototype, "allowPasswordChange");
896
- b([
897
- K()
896
+ v([
897
+ q()
898
898
  ], M.prototype, "allowMultipleLogins");
899
- b([
900
- K()
899
+ v([
900
+ q()
901
901
  ], M.prototype, "passwordNeverExpires");
902
- b([
903
- K()
902
+ v([
903
+ q()
904
904
  ], M.prototype, "accountDeactivated");
905
- b([
906
- K()
905
+ v([
906
+ q()
907
907
  ], M.prototype, "accountLocked");
908
- b([
909
- K()
908
+ v([
909
+ q()
910
910
  ], M.prototype, "unlimitedAccessHours");
911
- b([
912
- K()
911
+ v([
912
+ q()
913
913
  ], M.prototype, "isAdministrator");
914
- b([
915
- te()
914
+ v([
915
+ re()
916
916
  ], M.prototype, "accessSchedule");
917
- b([
918
- te()
917
+ v([
918
+ re()
919
919
  ], M.prototype, "groups");
920
- b([
921
- te()
920
+ v([
921
+ re()
922
922
  ], M.prototype, "profile");
923
- b([
924
- St(
923
+ v([
924
+ It(
925
925
  {},
926
926
  {
927
927
  message: "archbase:Informe um email válido"
928
928
  }
929
929
  )
930
930
  ], M.prototype, "email");
931
- let be = M;
932
- const Ne = class Ue {
931
+ let Ee = M;
932
+ const Me = class _e {
933
933
  id;
934
934
  code;
935
935
  version;
@@ -943,7 +943,7 @@ const Ne = class Ue {
943
943
  companyId;
944
944
  projectId;
945
945
  constructor(e) {
946
- this.id = e.id || "", this.code = e.code || "", this.version = e.version || 0, this.createEntityDate = e.createEntityDate || "", this.updateEntityDate = e.updateEntityDate || "", this.createdByUser = e.createdByUser || "", this.lastModifiedByUser = e.lastModifiedByUser || "", this.security = e.security ? Ue.createDtoFromJson(e.security) : void 0, this.action = e.action ? new or(e.action) : void 0, this.tenantId = e.tenantId || "", this.companyId = e.companyId || "", this.projectId = e.projectId || "";
946
+ this.id = e.id || "", this.code = e.code || "", this.version = e.version || 0, this.createEntityDate = e.createEntityDate || "", this.updateEntityDate = e.updateEntityDate || "", this.createdByUser = e.createdByUser || "", this.lastModifiedByUser = e.lastModifiedByUser || "", this.security = e.security ? _e.createDtoFromJson(e.security) : void 0, this.action = e.action ? new ar(e.action) : void 0, this.tenantId = e.tenantId || "", this.companyId = e.companyId || "", this.projectId = e.projectId || "";
947
947
  }
948
948
  static createDtoFromJson(e) {
949
949
  switch (e.type) {
@@ -952,26 +952,26 @@ const Ne = class Ue {
952
952
  case "group":
953
953
  return new he(e);
954
954
  case "user":
955
- return new be(e);
955
+ return new Ee(e);
956
956
  default:
957
957
  throw new Error("Unknown DTO type");
958
958
  }
959
959
  }
960
- static newInstance = () => new Ue({
961
- id: J(),
960
+ static newInstance = () => new _e({
961
+ id: K(),
962
962
  tenantId: "",
963
963
  companyId: "",
964
964
  projectId: ""
965
965
  });
966
966
  };
967
- b([
968
- te()
969
- ], Ne.prototype, "security");
970
- b([
971
- te()
972
- ], Ne.prototype, "action");
973
- let Tr = Ne;
974
- class Me {
967
+ v([
968
+ re()
969
+ ], Me.prototype, "security");
970
+ v([
971
+ re()
972
+ ], Me.prototype, "action");
973
+ let _r = Me;
974
+ class Oe {
975
975
  id;
976
976
  code;
977
977
  version;
@@ -989,13 +989,13 @@ class Me {
989
989
  activated;
990
990
  isNovoToken;
991
991
  constructor(e) {
992
- this.id = e.id || "", this.code = e.code || "", this.version = e.version || 0, this.createEntityDate = e.createEntityDate || "", this.updateEntityDate = e.updateEntityDate || "", this.createdByUser = e.createdByUser || "", this.lastModifiedByUser = e.lastModifiedByUser || "", this.tenantId = e.tenantId || "", this.user = e.user ? new be(e.user) : void 0, this.name = e.name || "", this.description = e.description || "", this.token = e.token || "", this.expirationDate = e.expirationDate, this.revoked = e.revoked, this.activated = e.activated || !1;
992
+ this.id = e.id || "", this.code = e.code || "", this.version = e.version || 0, this.createEntityDate = e.createEntityDate || "", this.updateEntityDate = e.updateEntityDate || "", this.createdByUser = e.createdByUser || "", this.lastModifiedByUser = e.lastModifiedByUser || "", this.tenantId = e.tenantId || "", this.user = e.user ? new Ee(e.user) : void 0, this.name = e.name || "", this.description = e.description || "", this.token = e.token || "", this.expirationDate = e.expirationDate, this.revoked = e.revoked, this.activated = e.activated || !1;
993
993
  }
994
- static newInstance = () => new Me({
995
- id: J()
994
+ static newInstance = () => new Oe({
995
+ id: K()
996
996
  });
997
997
  }
998
- class Be {
998
+ class Le {
999
999
  id;
1000
1000
  code;
1001
1001
  version;
@@ -1012,15 +1012,15 @@ class Be {
1012
1012
  user;
1013
1013
  isNewAccessToken;
1014
1014
  constructor(e) {
1015
- this.id = e.id || "", this.code = e.code || "", this.version = e.version || 0, this.createEntityDate = e.createEntityDate || (/* @__PURE__ */ new Date()).toISOString(), this.updateEntityDate = e.updateEntityDate || (/* @__PURE__ */ new Date()).toISOString(), this.createdByUser = e.createdByUser || "", this.lastModifiedByUser = e.lastModifiedByUser || "", this.token = e.token || "", this.tokenType = e.tokenType || void 0, this.user = e.user ? new be(e.user) : void 0, this.revoked = e.revoked || !1, this.expired = e.expired || !1, this.expirationTime = e.expirationTime || 0, this.expirationDate = e.expirationDate || "", this.isNewAccessToken = e.isNewAccessToken || !1;
1015
+ this.id = e.id || "", this.code = e.code || "", this.version = e.version || 0, this.createEntityDate = e.createEntityDate || (/* @__PURE__ */ new Date()).toISOString(), this.updateEntityDate = e.updateEntityDate || (/* @__PURE__ */ new Date()).toISOString(), this.createdByUser = e.createdByUser || "", this.lastModifiedByUser = e.lastModifiedByUser || "", this.token = e.token || "", this.tokenType = e.tokenType || void 0, this.user = e.user ? new Ee(e.user) : void 0, this.revoked = e.revoked || !1, this.expired = e.expired || !1, this.expirationTime = e.expirationTime || 0, this.expirationDate = e.expirationDate || "", this.isNewAccessToken = e.isNewAccessToken || !1;
1016
1016
  }
1017
- static newInstance = () => new Be({
1018
- id: J(),
1017
+ static newInstance = () => new Le({
1018
+ id: K(),
1019
1019
  active: !0,
1020
1020
  isNewAccessToken: !0
1021
1021
  });
1022
1022
  }
1023
- class dt extends ce {
1023
+ class ht extends ce {
1024
1024
  constructor(e) {
1025
1025
  super(e);
1026
1026
  }
@@ -1028,7 +1028,7 @@ class dt extends ce {
1028
1028
  return V.getInstance().getHeaders();
1029
1029
  }
1030
1030
  transform(e) {
1031
- return new be(e);
1031
+ return new Ee(e);
1032
1032
  }
1033
1033
  getEndpoint() {
1034
1034
  return "/api/v1/user";
@@ -1047,9 +1047,9 @@ class dt extends ce {
1047
1047
  return this.transform(t);
1048
1048
  }
1049
1049
  }
1050
- I.decorate(I.inject(H.ApiClient), dt, 0);
1051
- I.decorate(I.injectable(), dt);
1052
- class ut extends ce {
1050
+ I.decorate(I.inject(G.ApiClient), ht, 0);
1051
+ I.decorate(I.injectable(), ht);
1052
+ class pt extends ce {
1053
1053
  constructor(e) {
1054
1054
  super(e);
1055
1055
  }
@@ -1069,9 +1069,9 @@ class ut extends ce {
1069
1069
  return e.isNewGroup;
1070
1070
  }
1071
1071
  }
1072
- I.decorate(I.inject(H.ApiClient), ut, 0);
1073
- I.decorate(I.injectable(), ut);
1074
- class ht extends ce {
1072
+ I.decorate(I.inject(G.ApiClient), pt, 0);
1073
+ I.decorate(I.injectable(), pt);
1074
+ class ft extends ce {
1075
1075
  constructor(e) {
1076
1076
  super(e);
1077
1077
  }
@@ -1091,9 +1091,9 @@ class ht extends ce {
1091
1091
  return e.isNewProfile;
1092
1092
  }
1093
1093
  }
1094
- I.decorate(I.inject(H.ApiClient), ht, 0);
1095
- I.decorate(I.injectable(), ht);
1096
- class pt extends ce {
1094
+ I.decorate(I.inject(G.ApiClient), ft, 0);
1095
+ I.decorate(I.injectable(), ft);
1096
+ class mt extends ce {
1097
1097
  constructor(e) {
1098
1098
  super(e);
1099
1099
  }
@@ -1101,7 +1101,7 @@ class pt extends ce {
1101
1101
  return V.getInstance().getHeaders();
1102
1102
  }
1103
1103
  transform(e) {
1104
- return new Me(e);
1104
+ return new Oe(e);
1105
1105
  }
1106
1106
  getEndpoint() {
1107
1107
  return "/api/v1/apiToken";
@@ -1128,9 +1128,9 @@ class pt extends ce {
1128
1128
  );
1129
1129
  }
1130
1130
  }
1131
- I.decorate(I.inject(H.ApiClient), pt, 0);
1132
- I.decorate(I.injectable(), pt);
1133
- class ft extends ce {
1131
+ I.decorate(I.inject(G.ApiClient), mt, 0);
1132
+ I.decorate(I.injectable(), mt);
1133
+ class gt extends ce {
1134
1134
  constructor(e) {
1135
1135
  super(e);
1136
1136
  }
@@ -1138,7 +1138,7 @@ class ft extends ce {
1138
1138
  return V.getInstance().getHeaders();
1139
1139
  }
1140
1140
  transform(e) {
1141
- return new Be(e);
1141
+ return new Le(e);
1142
1142
  }
1143
1143
  getEndpoint() {
1144
1144
  return "/api/v1/accessToken";
@@ -1157,9 +1157,9 @@ class ft extends ce {
1157
1157
  );
1158
1158
  }
1159
1159
  }
1160
- I.decorate(I.inject(H.ApiClient), ft, 0);
1161
- I.decorate(I.injectable(), ft);
1162
- class mt extends ce {
1160
+ I.decorate(I.inject(G.ApiClient), gt, 0);
1161
+ I.decorate(I.injectable(), gt);
1162
+ class yt extends ce {
1163
1163
  constructor(e) {
1164
1164
  super(e);
1165
1165
  }
@@ -1167,7 +1167,7 @@ class mt extends ce {
1167
1167
  return V.getInstance().getHeaders();
1168
1168
  }
1169
1169
  transform(e) {
1170
- return new ct(e);
1170
+ return new dt(e);
1171
1171
  }
1172
1172
  getEndpoint() {
1173
1173
  return "/api/v1/resource";
@@ -1191,7 +1191,7 @@ class mt extends ce {
1191
1191
  !1,
1192
1192
  {
1193
1193
  params: {
1194
- type: je(ae, t)
1194
+ type: Ve(ae, t)
1195
1195
  }
1196
1196
  }
1197
1197
  );
@@ -1202,7 +1202,7 @@ class mt extends ce {
1202
1202
  {
1203
1203
  securityId: e,
1204
1204
  actionId: t,
1205
- type: je(ae, s)
1205
+ type: Ve(ae, s)
1206
1206
  },
1207
1207
  this.configureHeaders()
1208
1208
  );
@@ -1221,9 +1221,9 @@ class mt extends ce {
1221
1221
  );
1222
1222
  }
1223
1223
  }
1224
- I.decorate(I.inject(H.ApiClient), mt, 0);
1225
- I.decorate(I.injectable(), mt);
1226
- function Cr({
1224
+ I.decorate(I.inject(G.ApiClient), yt, 0);
1225
+ I.decorate(I.injectable(), yt);
1226
+ function Rr({
1227
1227
  onLogin: r,
1228
1228
  error: e,
1229
1229
  onClickForgotPassword: t,
@@ -1232,149 +1232,149 @@ function Cr({
1232
1232
  afterInputs: a,
1233
1233
  showMockUsersSelector: d = !1,
1234
1234
  mockUsers: i = [],
1235
- mockUsersGroupMap: l,
1236
- options: w = {},
1237
- onChangeUsername: A,
1238
- disabledLogin: p = !1,
1239
- isCheckingUsername: P = !1,
1240
- showSignIn: E = !0
1235
+ mockUsersGroupMap: u,
1236
+ options: y = {},
1237
+ onChangeUsername: k,
1238
+ disabledLogin: h = !1,
1239
+ isCheckingUsername: C = !1,
1240
+ showSignIn: A = !0
1241
1241
  }) {
1242
- const y = Ke(), {
1243
- username: S,
1244
- password: _,
1245
- rememberMe: C,
1246
- clearRememberMe: B
1247
- } = kt(), [U, D] = m(S), [f, k] = m(_), [N, O] = m(C), [q, R] = m(!1), [W, Y] = m(null);
1242
+ const g = Ye(), {
1243
+ username: E,
1244
+ password: U,
1245
+ rememberMe: D,
1246
+ clearRememberMe: O
1247
+ } = Pt(), [_, N] = f(E), [x, b] = f(U), [P, W] = f(D), [L, B] = f(!1), [H, Y] = f(null);
1248
1248
  z(() => {
1249
- R(!!e);
1249
+ B(!!e);
1250
1250
  }, [e]), z(() => {
1251
- S !== U && (D(S), A?.(S)), _ !== f && k(_), C !== N && O(C);
1252
- }, [S, _, C]);
1251
+ E !== _ && (N(E), k?.(E)), U !== x && b(U), D !== P && W(D);
1252
+ }, [E, U, D]);
1253
1253
  const $ = () => {
1254
- R(!1);
1254
+ B(!1);
1255
1255
  }, X = () => {
1256
- U && f && r(U, f, N).finally(() => R(!0));
1257
- }, h = () => {
1258
- if (!l)
1259
- return i.map((g) => ({
1260
- value: g.email,
1261
- label: g.email
1256
+ _ && x && r(_, x, P).finally(() => B(!0));
1257
+ }, p = () => {
1258
+ if (!u)
1259
+ return i.map((m) => ({
1260
+ value: m.email,
1261
+ label: m.email
1262
1262
  }));
1263
- const c = i.reduce((g, T) => {
1264
- const j = l[T.type];
1265
- return j && (g[j] || (g[j] = []), g[j].push({
1263
+ const c = i.reduce((m, T) => {
1264
+ const j = u[T.type];
1265
+ return j && (m[j] || (m[j] = []), m[j].push({
1266
1266
  value: T.email,
1267
1267
  label: T.email
1268
- })), g;
1268
+ })), m;
1269
1269
  }, {});
1270
- return Object.entries(c).map(([g, T]) => ({
1271
- group: g,
1270
+ return Object.entries(c).map(([m, T]) => ({
1271
+ group: m,
1272
1272
  items: T
1273
1273
  }));
1274
1274
  }, n = () => {
1275
- if (W) {
1276
- const c = i.find((g) => g.email === W);
1277
- c && (D(c.email), k(c.password), $());
1275
+ if (H) {
1276
+ const c = i.find((m) => m.email === H);
1277
+ c && (N(c.email), b(c.password), $());
1278
1278
  }
1279
- }, v = {
1279
+ }, w = {
1280
1280
  withBorder: !0,
1281
1281
  shadow: "md",
1282
1282
  p: 30,
1283
1283
  mt: 30,
1284
1284
  radius: "md",
1285
1285
  w: 400,
1286
- ...w.cardProps
1286
+ ...y.cardProps
1287
1287
  };
1288
- return /* @__PURE__ */ L(
1289
- Je,
1288
+ return /* @__PURE__ */ R(
1289
+ Ke,
1290
1290
  {
1291
- ...v,
1291
+ ...w,
1292
1292
  pos: "relative",
1293
- ref: y,
1293
+ ref: g,
1294
1294
  children: [
1295
- E && /* @__PURE__ */ L(re, { children: [
1296
- /* @__PURE__ */ u(
1297
- ne,
1295
+ A && /* @__PURE__ */ R(te, { children: [
1296
+ /* @__PURE__ */ l(
1297
+ se,
1298
1298
  {
1299
1299
  c: "light-dark(var(--mantine-color-black), var(--mantine-color-white))",
1300
1300
  fw: 800,
1301
1301
  fz: { base: "20px", md: "35px" },
1302
1302
  style: { textAlign: "center", letterSpacing: "-1px" },
1303
1303
  mt: "xs",
1304
- children: x().t("archbase:signIn")
1304
+ children: S().t("archbase:signIn")
1305
1305
  }
1306
1306
  ),
1307
- /* @__PURE__ */ u(ge, { m: "md" })
1307
+ /* @__PURE__ */ l(ye, { m: "md" })
1308
1308
  ] }),
1309
- w?.customContentBefore,
1310
- d && /* @__PURE__ */ L(re, { children: [
1311
- /* @__PURE__ */ L(Ve, { gap: "sm", mb: "md", children: [
1312
- /* @__PURE__ */ u(
1313
- _t,
1309
+ y?.customContentBefore,
1310
+ d && /* @__PURE__ */ R(te, { children: [
1311
+ /* @__PURE__ */ R(we, { gap: "sm", mb: "md", children: [
1312
+ /* @__PURE__ */ l(
1313
+ Nt,
1314
1314
  {
1315
1315
  placeholder: "Selecione um usuário mock",
1316
- data: h(),
1317
- value: W,
1316
+ data: p(),
1317
+ value: H,
1318
1318
  onChange: Y,
1319
1319
  searchable: !0,
1320
1320
  clearable: !0,
1321
1321
  style: { flexGrow: 1 }
1322
1322
  }
1323
1323
  ),
1324
- /* @__PURE__ */ u(Rt, { label: "Aplicar", children: /* @__PURE__ */ u(
1324
+ /* @__PURE__ */ l(Bt, { label: "Aplicar", children: /* @__PURE__ */ l(
1325
1325
  ie,
1326
1326
  {
1327
1327
  variant: "light",
1328
1328
  size: "sm",
1329
1329
  onClick: n,
1330
- disabled: !W,
1330
+ disabled: !H,
1331
1331
  "aria-label": "Aplicar usuário mock selecionado",
1332
- children: /* @__PURE__ */ u(Lt, { size: 16 })
1332
+ children: /* @__PURE__ */ l(Ft, { size: 16 })
1333
1333
  }
1334
1334
  ) })
1335
1335
  ] }),
1336
- /* @__PURE__ */ u(ge, { mb: "md" })
1336
+ /* @__PURE__ */ l(ye, { mb: "md" })
1337
1337
  ] }),
1338
- /* @__PURE__ */ u(
1339
- Pe,
1338
+ /* @__PURE__ */ l(
1339
+ Ce,
1340
1340
  {
1341
1341
  label: s,
1342
- placeholder: o ?? x().t("archbase:usuario@email.com"),
1343
- rightSection: P ? /* @__PURE__ */ u(Nt, { size: "xs" }) : null,
1344
- value: U || "",
1342
+ placeholder: o ?? S().t("archbase:usuario@email.com"),
1343
+ rightSection: C ? /* @__PURE__ */ l(qe, { size: "xs" }) : null,
1344
+ value: _ || "",
1345
1345
  required: !0,
1346
1346
  onChange: (c) => {
1347
- D(c.currentTarget.value), A?.(c.currentTarget.value), $();
1347
+ N(c.currentTarget.value), k?.(c.currentTarget.value), $();
1348
1348
  }
1349
1349
  }
1350
1350
  ),
1351
- /* @__PURE__ */ u(
1352
- Te,
1351
+ /* @__PURE__ */ l(
1352
+ Ue,
1353
1353
  {
1354
- label: x().t("archbase:Password"),
1355
- placeholder: x().t("archbase:Sua senha"),
1354
+ label: S().t("archbase:Password"),
1355
+ placeholder: S().t("archbase:Sua senha"),
1356
1356
  onChange: (c) => {
1357
- k(c.currentTarget.value), $();
1357
+ b(c.currentTarget.value), $();
1358
1358
  },
1359
- value: f || "",
1359
+ value: x || "",
1360
1360
  required: !0,
1361
1361
  mt: "md"
1362
1362
  }
1363
1363
  ),
1364
- /* @__PURE__ */ L(Ve, { justify: "space-between", mt: "md", children: [
1365
- /* @__PURE__ */ u(
1364
+ /* @__PURE__ */ R(we, { justify: "space-between", mt: "md", children: [
1365
+ /* @__PURE__ */ l(
1366
1366
  Mt,
1367
1367
  {
1368
- label: x().t("archbase:Lembre-me"),
1369
- checked: N,
1368
+ label: S().t("archbase:Lembre-me"),
1369
+ checked: P,
1370
1370
  onChange: (c) => {
1371
- const g = c.currentTarget.checked;
1372
- O(g), g || B();
1371
+ const m = c.currentTarget.checked;
1372
+ W(m), m || O();
1373
1373
  }
1374
1374
  }
1375
1375
  ),
1376
- t && /* @__PURE__ */ u(
1377
- Bt,
1376
+ t && /* @__PURE__ */ l(
1377
+ Ot,
1378
1378
  {
1379
1379
  component: "button",
1380
1380
  c: "var(--mantine-text-color)",
@@ -1382,213 +1382,213 @@ function Cr({
1382
1382
  lh: "20px",
1383
1383
  styles: { root: { cursor: "pointer" } },
1384
1384
  onClick: t,
1385
- children: x().t("archbase:Esqueci minha senha")
1385
+ children: S().t("archbase:Esqueci minha senha")
1386
1386
  }
1387
1387
  )
1388
1388
  ] }),
1389
- w?.afterInputs || a,
1390
- /* @__PURE__ */ u(
1389
+ y?.afterInputs || a,
1390
+ /* @__PURE__ */ l(
1391
1391
  ie,
1392
1392
  {
1393
- disabled: !f || !U || p,
1393
+ disabled: !x || !_ || h,
1394
1394
  fullWidth: !0,
1395
1395
  mt: "xl",
1396
1396
  onClick: X,
1397
- children: x().t("archbase:signIn")
1397
+ children: S().t("archbase:signIn")
1398
1398
  }
1399
1399
  ),
1400
- w?.customContentAfter,
1401
- q && e && /* @__PURE__ */ u(ne, { c: "red", mt: "sm", children: e })
1400
+ y?.customContentAfter,
1401
+ L && e && /* @__PURE__ */ l(se, { c: "red", mt: "sm", children: e })
1402
1402
  ]
1403
1403
  }
1404
1404
  );
1405
1405
  }
1406
- const nr = {
1406
+ const cr = {
1407
1407
  position: "relative",
1408
1408
  width: "90%",
1409
1409
  maxWidth: 400,
1410
1410
  padding: 30,
1411
1411
  marginTop: 30
1412
1412
  };
1413
- function Ur({ error: r, onSendResetPasswordEmail: e, onResetPassword: t, onClickBackToLogin: s, validatePassword: o, validateToken: a, initialEmail: d = "", description: i, style: l }) {
1414
- const w = Ke(), A = It(), { colorScheme: p } = Ot(), [P, E] = m(r ?? ""), [y, S] = m(d), [_, C] = m(""), [B, U] = m(""), [D, f] = m(""), [k, N] = m(!1), [O, q] = m(""), [R, W] = m(""), [Y, $] = m(""), [X, h] = m("");
1413
+ function Nr({ error: r, onSendResetPasswordEmail: e, onResetPassword: t, onClickBackToLogin: s, validatePassword: o, validateToken: a, initialEmail: d = "", description: i, style: u }) {
1414
+ const y = Ye(), k = Tt(), { colorScheme: h } = Lt(), [C, A] = f(r ?? ""), [g, E] = f(d), [U, D] = f(""), [O, _] = f(""), [N, x] = f(""), [b, P] = f(!1), [W, L] = f(""), [B, H] = f(""), [Y, $] = f(""), [X, p] = f("");
1415
1415
  async function n(c) {
1416
- c && (Pt(c) ? await e(c).then(() => {
1417
- ze.showSuccess(`${x().t("archbase:Um e-mail com instruções para redefinir sua senha foi enviado. Verifique sua caixa de entrada.")}`), N(!0);
1416
+ c && (Ct(c) ? await e(c).then(() => {
1417
+ We.showSuccess(`${S().t("archbase:Um e-mail com instruções para redefinir sua senha foi enviado. Verifique sua caixa de entrada.")}`), P(!0);
1418
1418
  }).catch(() => {
1419
- }) : q(`${x().t("archbase:Email inválido")}`));
1419
+ }) : L(`${S().t("archbase:Email inválido")}`));
1420
1420
  }
1421
- async function v(c, g, T, j) {
1422
- if (c && g && T) {
1423
- let Ae = "", Ee = "", $e = "";
1424
- a && (Ae = a(), $(Ae)), o && (Ee = o(), $(Ee)), T !== j && ($e = `${x().t("archbase:A nova senha e a confirmação devem ser iguais.")}`, h($e)), !Ee && !Ae && await t(c, g, T).then(() => {
1425
- ze.showSuccess(`${x().t("archbase:Senha redefinida com sucesso.")}`), s(), N(!1);
1421
+ async function w(c, m, T, j) {
1422
+ if (c && m && T) {
1423
+ let xe = "", Se = "", Fe = "";
1424
+ a && (xe = a(), $(xe)), o && (Se = o(), $(Se)), T !== j && (Fe = `${S().t("archbase:A nova senha e a confirmação devem ser iguais.")}`, p(Fe)), !Se && !xe && await t(c, m, T).then(() => {
1425
+ We.showSuccess(`${S().t("archbase:Senha redefinida com sucesso.")}`), s(), P(!1);
1426
1426
  }).catch(() => {
1427
- E(r || `${x().t("archbase:Erro ao redefinir senha.")}`);
1427
+ A(r || `${S().t("archbase:Erro ao redefinir senha.")}`);
1428
1428
  });
1429
1429
  }
1430
1430
  }
1431
1431
  return z(() => {
1432
- r && E(r);
1432
+ r && A(r);
1433
1433
  }, [r]), z(() => {
1434
- E("");
1435
- }, [y, _, B, D]), /* @__PURE__ */ L(
1436
- Je,
1434
+ A("");
1435
+ }, [g, U, O, N]), /* @__PURE__ */ R(
1436
+ Ke,
1437
1437
  {
1438
1438
  withBorder: !0,
1439
1439
  shadow: "md",
1440
1440
  radius: "md",
1441
- ref: w,
1441
+ ref: y,
1442
1442
  style: {
1443
- ...nr,
1444
- ...l
1443
+ ...cr,
1444
+ ...u
1445
1445
  },
1446
1446
  children: [
1447
- k ? /* @__PURE__ */ L(re, { children: [
1448
- /* @__PURE__ */ u(
1449
- ne,
1447
+ b ? /* @__PURE__ */ R(te, { children: [
1448
+ /* @__PURE__ */ l(
1449
+ se,
1450
1450
  {
1451
1451
  c: "light-dark(var(--mantine-color-black), var(--mantine-color-white))",
1452
1452
  fw: 800,
1453
1453
  fz: { base: "20px", md: "35px" },
1454
1454
  style: { textAlign: "center", letterSpacing: "-1px" },
1455
1455
  mt: "xs",
1456
- children: x().t("archbase:Redefinir senha")
1456
+ children: S().t("archbase:Redefinir senha")
1457
1457
  }
1458
1458
  ),
1459
- /* @__PURE__ */ u(ge, { m: "xs" }),
1460
- /* @__PURE__ */ u(
1461
- Pe,
1459
+ /* @__PURE__ */ l(ye, { m: "xs" }),
1460
+ /* @__PURE__ */ l(
1461
+ Ce,
1462
1462
  {
1463
- label: x().t("archbase:Código de segurança"),
1464
- placeholder: `${x().t("archbase:Código enviado no seu e-mail")}`,
1465
- value: _ || "",
1463
+ label: S().t("archbase:Código de segurança"),
1464
+ placeholder: `${S().t("archbase:Código enviado no seu e-mail")}`,
1465
+ value: U || "",
1466
1466
  required: !0,
1467
1467
  onChange: (c) => {
1468
- C(c.currentTarget.value), W("");
1468
+ D(c.currentTarget.value), H("");
1469
1469
  },
1470
- error: R
1470
+ error: B
1471
1471
  }
1472
1472
  ),
1473
- /* @__PURE__ */ u(
1474
- Te,
1473
+ /* @__PURE__ */ l(
1474
+ Ue,
1475
1475
  {
1476
- label: x().t("archbase:Nova senha"),
1477
- placeholder: x().t("archbase:Nova senha"),
1476
+ label: S().t("archbase:Nova senha"),
1477
+ placeholder: S().t("archbase:Nova senha"),
1478
1478
  onChange: (c) => {
1479
- U(c.currentTarget.value), $(""), h("");
1479
+ _(c.currentTarget.value), $(""), p("");
1480
1480
  },
1481
- value: B,
1481
+ value: O,
1482
1482
  required: !0,
1483
1483
  error: Y
1484
1484
  }
1485
1485
  ),
1486
- /* @__PURE__ */ u(
1487
- Te,
1486
+ /* @__PURE__ */ l(
1487
+ Ue,
1488
1488
  {
1489
- label: x().t("archbase:Confirmar senha"),
1490
- placeholder: x().t("archbase:Confirmar senha"),
1489
+ label: S().t("archbase:Confirmar senha"),
1490
+ placeholder: S().t("archbase:Confirmar senha"),
1491
1491
  onChange: (c) => {
1492
- f(c.currentTarget.value), h("");
1492
+ x(c.currentTarget.value), p("");
1493
1493
  },
1494
- value: D || "",
1494
+ value: N || "",
1495
1495
  required: !0,
1496
1496
  error: X
1497
1497
  }
1498
1498
  ),
1499
- /* @__PURE__ */ u(
1499
+ /* @__PURE__ */ l(
1500
1500
  ie,
1501
1501
  {
1502
- disabled: !y || !_ || !B || !D,
1502
+ disabled: !g || !U || !O || !N,
1503
1503
  mt: "md",
1504
1504
  fullWidth: !0,
1505
- onClick: () => v(y, _, B, D),
1506
- children: `${x().t("archbase:Redefinir senha")}`
1505
+ onClick: () => w(g, U, O, N),
1506
+ children: `${S().t("archbase:Redefinir senha")}`
1507
1507
  }
1508
1508
  ),
1509
- /* @__PURE__ */ u(
1509
+ /* @__PURE__ */ l(
1510
1510
  ie,
1511
1511
  {
1512
1512
  mt: "6px",
1513
1513
  fullWidth: !0,
1514
- color: p === "dark" ? A.colors.dark[4] : A.colors.gray[7],
1514
+ color: h === "dark" ? k.colors.dark[4] : k.colors.gray[7],
1515
1515
  onClick: () => {
1516
- O || N(!1);
1516
+ W || P(!1);
1517
1517
  },
1518
- children: `${x().t("archbase:Voltar")}`
1518
+ children: `${S().t("archbase:Voltar")}`
1519
1519
  }
1520
1520
  )
1521
- ] }) : /* @__PURE__ */ L(re, { children: [
1522
- /* @__PURE__ */ u(
1523
- ne,
1521
+ ] }) : /* @__PURE__ */ R(te, { children: [
1522
+ /* @__PURE__ */ l(
1523
+ se,
1524
1524
  {
1525
1525
  c: "light-dark(var(--mantine-color-black), var(--mantine-color-white))",
1526
1526
  fw: 800,
1527
1527
  fz: { base: "20px", md: "35px" },
1528
1528
  style: { textAlign: "center", letterSpacing: "-1px" },
1529
1529
  mt: "xs",
1530
- children: x().t("archbase:Redefinir senha")
1530
+ children: S().t("archbase:Redefinir senha")
1531
1531
  }
1532
1532
  ),
1533
- /* @__PURE__ */ u(ne, { c: "dimmed", fz: 14, style: { textAlign: "justify" }, children: i }),
1534
- /* @__PURE__ */ u(ge, { m: "md" }),
1535
- /* @__PURE__ */ u(
1536
- Pe,
1533
+ /* @__PURE__ */ l(se, { c: "dimmed", fz: 14, style: { textAlign: "justify" }, children: i }),
1534
+ /* @__PURE__ */ l(ye, { m: "md" }),
1535
+ /* @__PURE__ */ l(
1536
+ Ce,
1537
1537
  {
1538
1538
  label: "Email",
1539
- placeholder: `${x().t("archbase:usuario@email.com")}`,
1540
- value: y || "",
1539
+ placeholder: `${S().t("archbase:usuario@email.com")}`,
1540
+ value: g || "",
1541
1541
  required: !0,
1542
1542
  onChange: (c) => {
1543
- S(c.currentTarget.value), q("");
1543
+ E(c.currentTarget.value), L("");
1544
1544
  },
1545
- error: O
1545
+ error: W
1546
1546
  }
1547
1547
  ),
1548
- /* @__PURE__ */ u(
1548
+ /* @__PURE__ */ l(
1549
1549
  ie,
1550
1550
  {
1551
- disabled: !y,
1551
+ disabled: !g,
1552
1552
  mt: "md",
1553
1553
  fullWidth: !0,
1554
- onClick: () => n(y),
1555
- children: `${x().t("archbase:Enviar")}`
1554
+ onClick: () => n(g),
1555
+ children: `${S().t("archbase:Enviar")}`
1556
1556
  }
1557
1557
  ),
1558
- /* @__PURE__ */ u(
1558
+ /* @__PURE__ */ l(
1559
1559
  ie,
1560
1560
  {
1561
1561
  mt: "6px",
1562
1562
  fullWidth: !0,
1563
- color: p === "dark" ? A.colors.dark[4] : A.colors.gray[7],
1563
+ color: h === "dark" ? k.colors.dark[4] : k.colors.gray[7],
1564
1564
  onClick: () => s && s(),
1565
- children: `${x().t("archbase:Voltar")}`
1565
+ children: `${S().t("archbase:Voltar")}`
1566
1566
  }
1567
1567
  )
1568
1568
  ] }),
1569
- P ? /* @__PURE__ */ u(ne, { c: "red", style: { textAlign: "justify" }, children: P }) : null
1569
+ C ? /* @__PURE__ */ l(se, { c: "red", style: { textAlign: "justify" }, children: C }) : null
1570
1570
  ]
1571
1571
  }
1572
1572
  );
1573
1573
  }
1574
- const ir = () => Tt().user, gt = "archbaseSecurityManagerStore", ar = (r, e, t, s) => r && r.existsValue(e) ? r.getValue(e) : new tt(e, t, s), Dr = ({ resourceName: r, resourceDescription: e, enableSecurity: t = !0 }) => {
1575
- const s = Ge(gt), o = ir(), [a, d] = m({
1576
- securityManager: t && ar(s, r, e, o.isAdmin)
1574
+ const lr = () => Ut().user, wt = "archbaseSecurityManagerStore", dr = (r, e, t, s) => r && r.existsValue(e) ? r.getValue(e) : new st(e, t, s), Br = ({ resourceName: r, resourceDescription: e, enableSecurity: t = !0 }) => {
1575
+ const s = Je(wt), o = lr(), [a, d] = f({
1576
+ securityManager: t && dr(s, r, e, o.isAdmin)
1577
1577
  });
1578
1578
  return z(() => {
1579
1579
  t && s.setValue(r, a.securityManager);
1580
1580
  }, [r]), { securityManager: a.securityManager };
1581
- }, _r = ({
1581
+ }, Mr = ({
1582
1582
  checkIntervalTokenHasExpired: r = 3e4,
1583
1583
  // Verificar a 30 segundos
1584
1584
  expirationThresholdOfToken: e = 300
1585
1585
  // Antecipar em 5 minutos
1586
1586
  }) => {
1587
- const t = ye(
1588
- (n) => n.get(H.TokenManager)
1589
- ), s = ye(
1590
- (n) => n.get(H.Authenticator)
1591
- ), [o, a] = m(null), [d, i] = m(!1), [l, w] = m(!0), [A, p] = m(!1), [P, E] = m(!1), [y, S] = m(""), [_, C] = m(""), [B, U] = m(null), D = Ge(gt), f = {
1587
+ const t = ve(
1588
+ (n) => n.get(G.TokenManager)
1589
+ ), s = ve(
1590
+ (n) => n.get(G.Authenticator)
1591
+ ), [o, a] = f(null), [d, i] = f(!1), [u, y] = f(!0), [k, h] = f(!1), [C, A] = f(!1), [g, E] = f(""), [U, D] = f(""), [O, _] = f(null), N = Je(wt), x = {
1592
1592
  hasContextualLogin: typeof s.loginWithContext == "function",
1593
1593
  hasFlexibleLogin: typeof s.loginFlexible == "function",
1594
1594
  hasSocialLogin: typeof s.loginSocial == "function",
@@ -1597,152 +1597,152 @@ const ir = () => Tt().user, gt = "archbaseSecurityManagerStore", ar = (r, e, t,
1597
1597
  };
1598
1598
  z(() => {
1599
1599
  const n = t.getUsername();
1600
- if (n && n != "" && C(n), f.hasContextSupport && t.getContext) {
1600
+ if (n && n != "" && D(n), x.hasContextSupport && t.getContext) {
1601
1601
  const c = t.getContext();
1602
1602
  if (c)
1603
1603
  try {
1604
- const g = typeof c == "string" ? JSON.parse(c) : c;
1605
- U(g);
1606
- } catch (g) {
1607
- console.warn("Erro ao carregar contexto salvo:", g);
1604
+ const m = typeof c == "string" ? JSON.parse(c) : c;
1605
+ _(m);
1606
+ } catch (m) {
1607
+ console.warn("Erro ao carregar contexto salvo:", m);
1608
1608
  }
1609
1609
  }
1610
- const v = t.getToken();
1611
- v && (p(!0), S(""), E(!1), a(v)), w(!1);
1610
+ const w = t.getToken();
1611
+ w && (h(!0), E(""), A(!1), a(w)), y(!1);
1612
1612
  }, []);
1613
- const k = () => {
1614
- E(!1), S("");
1615
- }, N = (n) => {
1616
- i(!1), p(!1), t.clearToken(), n && t.clearUsernameAndPassword(), f.hasContextSupport && t.clearContext && t.clearContext(), C(""), U(null), S(""), E(!1), D.clearAllValues();
1617
- }, O = async (n, v, c) => {
1613
+ const b = () => {
1614
+ A(!1), E("");
1615
+ }, P = (n) => {
1616
+ i(!1), h(!1), t.clearToken(), n && t.clearUsernameAndPassword(), x.hasContextSupport && t.clearContext && t.clearContext(), D(""), _(null), E(""), A(!1), N.clearAllValues();
1617
+ }, W = async (n, w, c) => {
1618
1618
  try {
1619
- i(!0), p(!1);
1620
- const g = await s.login(n, v);
1621
- t.saveToken(g), c && t.saveUsernameAndPassword(n, v), t.saveUsername(n), C(n), a(g), i(!1), p(!0);
1622
- } catch (g) {
1623
- i(!1), p(!1), S(ee(g)), E(!0);
1619
+ i(!0), h(!1);
1620
+ const m = await s.login(n, w);
1621
+ t.saveToken(m), c && t.saveUsernameAndPassword(n, w), t.saveUsername(n), D(n), a(m), i(!1), h(!0);
1622
+ } catch (m) {
1623
+ i(!1), h(!1), E(ee(m)), A(!0);
1624
1624
  }
1625
- }, q = async (n, v = !1) => {
1626
- if (!f.hasContextualLogin || !s.loginWithContext)
1625
+ }, L = async (n, w = !1) => {
1626
+ if (!x.hasContextualLogin || !s.loginWithContext)
1627
1627
  throw new Error("Login contextual não suportado por esta implementação do ArchbaseAuthenticator");
1628
1628
  try {
1629
- i(!0), p(!1);
1630
- const { context: c, user: g, ...T } = await s.loginWithContext(n), j = {
1629
+ i(!0), h(!1);
1630
+ const { context: c, user: m, ...T } = await s.loginWithContext(n), j = {
1631
1631
  scope: "",
1632
1632
  ext_expires_in: T.expires_in,
1633
1633
  ...T
1634
1634
  };
1635
- t.saveToken(j), v ? t.saveUsernameAndPassword(n.email, n.password) : t.clearUsernameAndPassword(), t.saveUsername(n.email), f.hasContextSupport && t.saveContext && c && (t.saveContext(JSON.stringify(c)), U(c)), C(n.email), a(j), i(!1), p(!0);
1635
+ t.saveToken(j), w ? t.saveUsernameAndPassword(n.email, n.password) : t.clearUsernameAndPassword(), t.saveUsername(n.email), x.hasContextSupport && t.saveContext && c && (t.saveContext(JSON.stringify(c)), _(c)), D(n.email), a(j), i(!1), h(!0);
1636
1636
  } catch (c) {
1637
- throw i(!1), p(!1), S(ee(c)), E(!0), c;
1637
+ throw i(!1), h(!1), E(ee(c)), A(!0), c;
1638
1638
  }
1639
- }, R = async (n, v = !1) => {
1640
- if (!f.hasFlexibleLogin || !s.loginFlexible)
1639
+ }, B = async (n, w = !1) => {
1640
+ if (!x.hasFlexibleLogin || !s.loginFlexible)
1641
1641
  throw new Error("Login flexível não suportado por esta implementação do ArchbaseAuthenticator");
1642
1642
  try {
1643
- i(!0), p(!1);
1644
- const { context: c, user: g, ...T } = await s.loginFlexible(n), j = {
1643
+ i(!0), h(!1);
1644
+ const { context: c, user: m, ...T } = await s.loginFlexible(n), j = {
1645
1645
  scope: "",
1646
1646
  ext_expires_in: T.expires_in,
1647
1647
  ...T
1648
1648
  };
1649
- t.saveToken(j), v && t.saveUsernameAndPassword(n.identifier, n.password), t.saveUsername(g.email || n.identifier), f.hasContextSupport && t.saveContext && c && (t.saveContext(JSON.stringify(c)), U(c)), C(g.email || n.identifier), a(j), i(!1), p(!0);
1649
+ t.saveToken(j), w && t.saveUsernameAndPassword(n.identifier, n.password), t.saveUsername(m.email || n.identifier), x.hasContextSupport && t.saveContext && c && (t.saveContext(JSON.stringify(c)), _(c)), D(m.email || n.identifier), a(j), i(!1), h(!0);
1650
1650
  } catch (c) {
1651
- throw i(!1), p(!1), S(ee(c)), E(!0), c;
1651
+ throw i(!1), h(!1), E(ee(c)), A(!0), c;
1652
1652
  }
1653
- }, W = async (n) => {
1654
- if (!f.hasSocialLogin || !s.loginSocial)
1653
+ }, H = async (n) => {
1654
+ if (!x.hasSocialLogin || !s.loginSocial)
1655
1655
  throw new Error("Login social não suportado por esta implementação do ArchbaseAuthenticator");
1656
1656
  try {
1657
- i(!0), p(!1);
1658
- const { context: v, user: c, ...g } = await s.loginSocial(n), T = {
1657
+ i(!0), h(!1);
1658
+ const { context: w, user: c, ...m } = await s.loginSocial(n), T = {
1659
1659
  scope: "",
1660
- ext_expires_in: g.expires_in,
1661
- ...g
1660
+ ext_expires_in: m.expires_in,
1661
+ ...m
1662
1662
  };
1663
- t.saveToken(T), t.saveUsername(c.email), f.hasContextSupport && t.saveContext && v && (t.saveContext(JSON.stringify(v)), U(v)), C(c.email), a(T), i(!1), p(!0);
1664
- } catch (v) {
1665
- throw i(!1), p(!1), S(ee(v)), E(!0), v;
1663
+ t.saveToken(T), t.saveUsername(c.email), x.hasContextSupport && t.saveContext && w && (t.saveContext(JSON.stringify(w)), _(w)), D(c.email), a(T), i(!1), h(!0);
1664
+ } catch (w) {
1665
+ throw i(!1), h(!1), E(ee(w)), A(!0), w;
1666
1666
  }
1667
1667
  }, Y = async (n) => {
1668
- if (!f.hasRegistration || !s.register)
1668
+ if (!x.hasRegistration || !s.register)
1669
1669
  throw new Error("Registro não suportado por esta implementação do ArchbaseAuthenticator");
1670
1670
  try {
1671
1671
  i(!0);
1672
- const v = await s.register(n);
1673
- return i(!1), v;
1674
- } catch (v) {
1675
- throw i(!1), S(ee(v)), E(!0), v;
1672
+ const w = await s.register(n);
1673
+ return i(!1), w;
1674
+ } catch (w) {
1675
+ throw i(!1), E(ee(w)), A(!0), w;
1676
1676
  }
1677
1677
  }, $ = async () => s.getSupportedContexts ? await s.getSupportedContexts() : { supportedContexts: ["DEFAULT"], defaultContext: "DEFAULT" }, X = async (n) => s.validateContext ? await s.validateContext(n) : { context: n, supported: n === "DEFAULT" };
1678
1678
  z(() => {
1679
1679
  const n = setInterval(() => {
1680
- o && o.access_token && t.isTokenExpired(o, e) && h();
1680
+ o && o.access_token && t.isTokenExpired(o, e) && p();
1681
1681
  }, r);
1682
1682
  return () => {
1683
1683
  clearInterval(n);
1684
1684
  };
1685
1685
  }, [o]);
1686
- const h = async () => {
1686
+ const p = async () => {
1687
1687
  if (o)
1688
1688
  try {
1689
1689
  const n = await s.refreshToken(o?.refresh_token);
1690
1690
  t.saveToken(n), a(n);
1691
1691
  } catch (n) {
1692
- console.error("Erro ao renovar o token:", n), N();
1692
+ console.error("Erro ao renovar o token:", n), P();
1693
1693
  }
1694
1694
  };
1695
1695
  return {
1696
1696
  // Métodos básicos (compatibilidade)
1697
- login: O,
1698
- logout: N,
1699
- username: _,
1700
- isAuthenticated: A,
1697
+ login: W,
1698
+ logout: P,
1699
+ username: U,
1700
+ isAuthenticated: k,
1701
1701
  isAuthenticating: d,
1702
- isInitializing: l,
1703
- isError: P,
1704
- error: y,
1705
- clearError: k,
1702
+ isInitializing: u,
1703
+ isError: C,
1704
+ error: g,
1705
+ clearError: b,
1706
1706
  accessToken: o ? o.access_token : null,
1707
1707
  // Métodos opcionais para autenticação avançada
1708
- loginWithContext: f.hasContextualLogin ? q : void 0,
1709
- loginFlexible: f.hasFlexibleLogin ? R : void 0,
1710
- loginSocial: f.hasSocialLogin ? W : void 0,
1711
- register: f.hasRegistration ? Y : void 0,
1708
+ loginWithContext: x.hasContextualLogin ? L : void 0,
1709
+ loginFlexible: x.hasFlexibleLogin ? B : void 0,
1710
+ loginSocial: x.hasSocialLogin ? H : void 0,
1711
+ register: x.hasRegistration ? Y : void 0,
1712
1712
  getSupportedContexts: $,
1713
1713
  validateContext: X,
1714
1714
  // Informações de contexto
1715
- context: B,
1715
+ context: O,
1716
1716
  // Detecção de capacidades
1717
- capabilities: f
1717
+ capabilities: x
1718
1718
  };
1719
- }, Rr = () => {
1720
- const r = ye(
1721
- (s) => s.get(H.TokenManager)
1722
- ), [e, t] = m(null);
1719
+ }, Or = () => {
1720
+ const r = ve(
1721
+ (s) => s.get(G.TokenManager)
1722
+ ), [e, t] = f(null);
1723
1723
  return z(() => {
1724
1724
  const s = r.getToken();
1725
1725
  s && t(s.access_token);
1726
1726
  }, []), {
1727
1727
  token: e
1728
1728
  };
1729
- }, Nr = () => {
1730
- const r = ye(
1731
- (l) => l.get(H.Authenticator)
1732
- ), [e, t] = m(!1), [s, o] = m("");
1729
+ }, Lr = () => {
1730
+ const r = ve(
1731
+ (u) => u.get(G.Authenticator)
1732
+ ), [e, t] = f(!1), [s, o] = f("");
1733
1733
  return {
1734
- sendResetPasswordEmail: async (l) => {
1734
+ sendResetPasswordEmail: async (u) => {
1735
1735
  try {
1736
- return await r.sendResetPasswordEmail(l);
1737
- } catch (w) {
1738
- throw o(ee(w)), t(!0), w;
1736
+ return await r.sendResetPasswordEmail(u);
1737
+ } catch (y) {
1738
+ throw o(ee(y)), t(!0), y;
1739
1739
  }
1740
1740
  },
1741
- resetPassword: async (l, w, A) => {
1741
+ resetPassword: async (u, y, k) => {
1742
1742
  try {
1743
- return await r.resetPassword(l, w, A);
1744
- } catch (p) {
1745
- throw o(ee(p)), t(!0), p;
1743
+ return await r.resetPassword(u, y, k);
1744
+ } catch (h) {
1745
+ throw o(ee(h)), t(!0), h;
1746
1746
  }
1747
1747
  },
1748
1748
  isError: e,
@@ -1751,98 +1751,110 @@ const ir = () => Tt().user, gt = "archbaseSecurityManagerStore", ar = (r, e, t,
1751
1751
  t(!1), o("");
1752
1752
  }
1753
1753
  };
1754
- }, Oe = De(null), Mr = ({
1754
+ }, ur = () => /* @__PURE__ */ l($t, { p: "xl", style: { width: "100%", height: "100%" }, children: /* @__PURE__ */ R(jt, { gap: "md", children: [
1755
+ /* @__PURE__ */ R(we, { gap: "sm", children: [
1756
+ /* @__PURE__ */ l(qe, { size: "sm" }),
1757
+ /* @__PURE__ */ l(se, { size: "sm", c: "dimmed", children: "Carregando permissões..." })
1758
+ ] }),
1759
+ /* @__PURE__ */ l(fe, { height: 40, radius: "sm" }),
1760
+ /* @__PURE__ */ l(fe, { height: 200, radius: "sm" }),
1761
+ /* @__PURE__ */ R(we, { gap: "md", children: [
1762
+ /* @__PURE__ */ l(fe, { height: 36, width: 100, radius: "sm" }),
1763
+ /* @__PURE__ */ l(fe, { height: 36, width: 100, radius: "sm" })
1764
+ ] })
1765
+ ] }) }), $e = Re(null), $r = ({
1755
1766
  children: r,
1756
1767
  user: e,
1757
1768
  onError: t
1758
1769
  }) => {
1759
- const [s, o] = m(!1), [a, d] = m(null), [i] = m([]), l = e?.isAdministrator || !1, w = pe((y) => l ? !0 : i.includes(y), [i, l]), A = pe((y) => l ? !0 : y.some((S) => i.includes(S)), [i, l]), p = pe((y) => l ? !0 : y.every((S) => i.includes(S)), [i, l]), P = pe((y) => {
1760
- d(y), y && t && t(y);
1761
- }, [t]), E = {
1770
+ const [s, o] = f(!1), [a, d] = f(null), [i] = f([]), u = e?.isAdministrator || !1, y = pe((g) => u ? !0 : i.includes(g), [i, u]), k = pe((g) => u ? !0 : g.some((E) => i.includes(E)), [i, u]), h = pe((g) => u ? !0 : g.every((E) => i.includes(E)), [i, u]), C = pe((g) => {
1771
+ d(g), g && t && t(g);
1772
+ }, [t]), A = {
1762
1773
  user: e,
1763
1774
  isLoading: s,
1764
- hasGlobalPermission: w,
1765
- hasAnyGlobalPermission: A,
1766
- hasAllGlobalPermissions: p,
1767
- isAdmin: l,
1775
+ hasGlobalPermission: y,
1776
+ hasAnyGlobalPermission: k,
1777
+ hasAllGlobalPermissions: h,
1778
+ isAdmin: u,
1768
1779
  error: a,
1769
- setError: P
1780
+ setError: C
1770
1781
  };
1771
- return /* @__PURE__ */ u(Oe.Provider, { value: E, children: r });
1772
- }, yt = De(null), cr = ({
1782
+ return /* @__PURE__ */ l($e.Provider, { value: A, children: r });
1783
+ }, vt = Re(null), hr = ({
1773
1784
  children: r,
1774
1785
  resourceName: e,
1775
1786
  resourceDescription: t,
1776
1787
  requiredPermissions: s = [],
1777
1788
  fallbackComponent: o,
1778
- onSecurityReady: a,
1779
- onError: d
1789
+ loadingComponent: a,
1790
+ onSecurityReady: d,
1791
+ onError: i
1780
1792
  }) => {
1781
- const i = _e(Oe);
1782
- if (!i)
1793
+ const u = Ne($e);
1794
+ if (!u)
1783
1795
  throw new Error("ArchbaseViewSecurityProvider deve ser usado dentro de um ArchbaseSecurityProvider");
1784
- const { user: l, isAdmin: w } = i, [A, p] = m(null), [P, E] = m(!0), [y, S] = m(null);
1785
- if (He.useEffect(() => {
1786
- if (!l) {
1787
- E(!1);
1796
+ const { user: y, isAdmin: k } = u, [h, C] = f(null), [A, g] = f(!0), [E, U] = f(null);
1797
+ if (Ge.useEffect(() => {
1798
+ if (!y) {
1799
+ g(!1);
1788
1800
  return;
1789
1801
  }
1790
- const f = new tt(e, t, w);
1802
+ const b = new st(e, t, k);
1791
1803
  (async () => {
1792
- E(!0);
1804
+ g(!0);
1793
1805
  try {
1794
- await f.apply(() => {
1795
- p(f), E(!1), a && a(f);
1806
+ await b.apply(() => {
1807
+ C(b), g(!1), d && d(b);
1796
1808
  });
1797
1809
  } catch {
1798
- const O = f.getError() || "Erro ao carregar permissões";
1799
- S(O), E(!1), d && d(O);
1810
+ const L = b.getError() || "Erro ao carregar permissões";
1811
+ U(L), g(!1), i && i(L);
1800
1812
  }
1801
1813
  })();
1802
- }, [e, t, l, w, a, d]), P)
1803
- return /* @__PURE__ */ u("div", { className: "archbase-security-loading", children: /* @__PURE__ */ u("div", { children: "Carregando permissões..." }) });
1804
- if (y)
1805
- return /* @__PURE__ */ u("div", { className: "archbase-security-error", children: /* @__PURE__ */ L("div", { children: [
1814
+ }, [e, t, y, k, d, i]), A)
1815
+ return a ? /* @__PURE__ */ l(te, { children: a }) : /* @__PURE__ */ l(ur, {});
1816
+ if (E)
1817
+ return /* @__PURE__ */ l("div", { className: "archbase-security-error", children: /* @__PURE__ */ R("div", { children: [
1806
1818
  "Erro ao carregar permissões: ",
1807
- y
1819
+ E
1808
1820
  ] }) });
1809
- if (!l)
1810
- return o || /* @__PURE__ */ u("div", { className: "archbase-security-no-user", children: /* @__PURE__ */ u("div", { children: "É necessário fazer login para acessar esta área" }) });
1811
- if (s.length > 0 && A && !s.every(
1812
- (k) => A.hasPermission(k)
1821
+ if (!y)
1822
+ return o || /* @__PURE__ */ l("div", { className: "archbase-security-no-user", children: /* @__PURE__ */ l("div", { children: "É necessário fazer login para acessar esta área" }) });
1823
+ if (s.length > 0 && h && !s.every(
1824
+ (P) => h.hasPermission(P)
1813
1825
  ))
1814
- return o || /* @__PURE__ */ L("div", { className: "archbase-security-access-denied", children: [
1815
- /* @__PURE__ */ u("div", { children: "Você não possui permissão para acessar esta área" }),
1816
- /* @__PURE__ */ L("small", { children: [
1826
+ return o || /* @__PURE__ */ R("div", { className: "archbase-security-access-denied", children: [
1827
+ /* @__PURE__ */ l("div", { children: "Você não possui permissão para acessar esta área" }),
1828
+ /* @__PURE__ */ R("small", { children: [
1817
1829
  "Permissões necessárias: ",
1818
1830
  s.join(", ")
1819
1831
  ] })
1820
1832
  ] });
1821
- const D = {
1822
- securityManager: A,
1823
- hasPermission: (f) => A?.hasPermission(f) || !1,
1824
- hasAnyPermission: (f) => f.some((k) => A?.hasPermission(k) || !1),
1825
- hasAllPermissions: (f) => f.every((k) => A?.hasPermission(k) || !1),
1826
- registerAction: (f, k) => {
1827
- A?.registerAction(f, k);
1833
+ const x = {
1834
+ securityManager: h,
1835
+ hasPermission: (b) => h?.hasPermission(b) || !1,
1836
+ hasAnyPermission: (b) => b.some((P) => h?.hasPermission(P) || !1),
1837
+ hasAllPermissions: (b) => b.every((P) => h?.hasPermission(P) || !1),
1838
+ registerAction: (b, P) => {
1839
+ h?.registerAction(b, P);
1828
1840
  },
1829
- isLoading: P,
1830
- error: y
1841
+ isLoading: A,
1842
+ error: E
1831
1843
  };
1832
- return /* @__PURE__ */ u(yt.Provider, { value: D, children: r });
1833
- }, lr = () => {
1834
- const r = _e(Oe);
1844
+ return /* @__PURE__ */ l(vt.Provider, { value: x, children: r });
1845
+ }, pr = () => {
1846
+ const r = Ne($e);
1835
1847
  if (!r)
1836
1848
  throw new Error("useArchbaseSecurity deve ser usado dentro de um ArchbaseSecurityProvider");
1837
1849
  return r;
1838
- }, Le = () => {
1839
- const r = _e(yt);
1850
+ }, je = () => {
1851
+ const r = Ne(vt);
1840
1852
  if (!r)
1841
1853
  throw new Error("useArchbaseViewSecurity deve ser usado dentro de um ArchbaseViewSecurityProvider");
1842
1854
  return r;
1843
- }, Br = (r, e) => {
1844
- const t = Le(), { hasPermission: s, hasAnyPermission: o, hasAllPermissions: a, registerAction: d, securityManager: i, isLoading: l, error: w } = t;
1845
- return He.useEffect(() => {
1855
+ }, jr = (r, e) => {
1856
+ const t = je(), { hasPermission: s, hasAnyPermission: o, hasAllPermissions: a, registerAction: d, securityManager: i, isLoading: u, error: y } = t;
1857
+ return Ge.useEffect(() => {
1846
1858
  r && e && (d("create", `Criar ${e}`), d("edit", `Editar ${e}`), d("delete", `Deletar ${e}`), d("view", `Visualizar ${e}`), d("list", `Listar ${e}`));
1847
1859
  }, [r, e, d]), {
1848
1860
  hasPermission: s,
@@ -1855,18 +1867,18 @@ const ir = () => Tt().user, gt = "archbaseSecurityManagerStore", ar = (r, e, t,
1855
1867
  canDelete: s("delete"),
1856
1868
  canView: s("view"),
1857
1869
  canList: s("list"),
1858
- isLoading: l,
1859
- error: w
1870
+ isLoading: u,
1871
+ error: y
1860
1872
  };
1861
- }, Or = () => {
1862
- const r = Le();
1873
+ }, Fr = () => {
1874
+ const r = je();
1863
1875
  return {
1864
1876
  check: r.hasPermission,
1865
1877
  checkAny: r.hasAnyPermission,
1866
1878
  checkAll: r.hasAllPermissions,
1867
- isAdmin: lr().isAdmin
1879
+ isAdmin: pr().isAdmin
1868
1880
  };
1869
- }, wt = ({
1881
+ }, bt = ({
1870
1882
  children: r,
1871
1883
  actionName: e,
1872
1884
  requiredPermissions: t = [],
@@ -1875,13 +1887,13 @@ const ir = () => Tt().user, gt = "archbaseSecurityManagerStore", ar = (r, e, t,
1875
1887
  fallback: a = null,
1876
1888
  autoRegister: d = !0
1877
1889
  }) => {
1878
- const { hasPermission: i, hasAnyPermission: l, hasAllPermissions: w, registerAction: A } = Le();
1890
+ const { hasPermission: i, hasAnyPermission: u, hasAllPermissions: y, registerAction: k } = je();
1879
1891
  z(() => {
1880
- d && e && o && A(e, o);
1881
- }, [e, o, d, A]);
1882
- let p = !1;
1883
- return e ? p = i(e) : t.length > 0 ? p = s ? w(t) : l(t) : p = !0, p ? /* @__PURE__ */ u(re, { children: r }) : /* @__PURE__ */ u(re, { children: a });
1884
- }, Lr = ({
1892
+ d && e && o && k(e, o);
1893
+ }, [e, o, d, k]);
1894
+ let h = !1;
1895
+ return e ? h = i(e) : t.length > 0 ? h = s ? y(t) : u(t) : h = !0, h ? /* @__PURE__ */ l(te, { children: r }) : /* @__PURE__ */ l(te, { children: a });
1896
+ }, Vr = ({
1885
1897
  actionName: r,
1886
1898
  actionDescription: e,
1887
1899
  children: t,
@@ -1890,18 +1902,18 @@ const ir = () => Tt().user, gt = "archbaseSecurityManagerStore", ar = (r, e, t,
1890
1902
  className: a = "",
1891
1903
  style: d = {},
1892
1904
  variant: i = "primary",
1893
- size: l = "medium",
1894
- type: w = "button"
1905
+ size: u = "medium",
1906
+ type: y = "button"
1895
1907
  }) => {
1896
- const A = () => {
1897
- const P = "archbase-secure-btn", E = `archbase-secure-btn--${i}`, y = `archbase-secure-btn--${l}`;
1898
- return `${P} ${E} ${y} ${a}`.trim();
1899
- }, p = () => {
1900
- const P = {
1908
+ const k = () => {
1909
+ const C = "archbase-secure-btn", A = `archbase-secure-btn--${i}`, g = `archbase-secure-btn--${u}`;
1910
+ return `${C} ${A} ${g} ${a}`.trim();
1911
+ }, h = () => {
1912
+ const C = {
1901
1913
  small: { padding: "4px 8px", fontSize: "12px" },
1902
1914
  medium: { padding: "8px 16px", fontSize: "14px" },
1903
1915
  large: { padding: "12px 24px", fontSize: "16px" }
1904
- }, E = {
1916
+ }, A = {
1905
1917
  primary: { backgroundColor: "#007bff", color: "white" },
1906
1918
  secondary: { backgroundColor: "#6c757d", color: "white" },
1907
1919
  danger: { backgroundColor: "#dc3545", color: "white" },
@@ -1914,31 +1926,31 @@ const ir = () => Tt().user, gt = "archbaseSecurityManagerStore", ar = (r, e, t,
1914
1926
  cursor: o ? "not-allowed" : "pointer",
1915
1927
  fontWeight: "500",
1916
1928
  opacity: o ? 0.6 : 1,
1917
- ...P[l],
1918
- ...E[i],
1929
+ ...C[u],
1930
+ ...A[i],
1919
1931
  ...d
1920
1932
  };
1921
1933
  };
1922
- return /* @__PURE__ */ u(
1923
- wt,
1934
+ return /* @__PURE__ */ l(
1935
+ bt,
1924
1936
  {
1925
1937
  actionName: r,
1926
1938
  actionDescription: e,
1927
1939
  fallback: null,
1928
- children: /* @__PURE__ */ u(
1940
+ children: /* @__PURE__ */ l(
1929
1941
  "button",
1930
1942
  {
1931
- type: w,
1943
+ type: y,
1932
1944
  onClick: s,
1933
1945
  disabled: o,
1934
- className: A(),
1935
- style: p(),
1946
+ className: k(),
1947
+ style: h(),
1936
1948
  children: t
1937
1949
  }
1938
1950
  )
1939
1951
  }
1940
1952
  );
1941
- }, $r = ({
1953
+ }, zr = ({
1942
1954
  children: r,
1943
1955
  actionName: e,
1944
1956
  actionDescription: t,
@@ -1946,12 +1958,12 @@ const ir = () => Tt().user, gt = "archbaseSecurityManagerStore", ar = (r, e, t,
1946
1958
  label: o,
1947
1959
  fallbackText: a = "Campo não disponível",
1948
1960
  fallbackComponent: d
1949
- }) => e ? /* @__PURE__ */ u(
1950
- wt,
1961
+ }) => e ? /* @__PURE__ */ l(
1962
+ bt,
1951
1963
  {
1952
1964
  actionName: e,
1953
1965
  actionDescription: t,
1954
- fallback: d || /* @__PURE__ */ L("div", { className: "archbase-secure-field-fallback", style: {
1966
+ fallback: d || /* @__PURE__ */ R("div", { className: "archbase-secure-field-fallback", style: {
1955
1967
  padding: "8px",
1956
1968
  color: "#666",
1957
1969
  fontStyle: "italic",
@@ -1959,7 +1971,7 @@ const ir = () => Tt().user, gt = "archbaseSecurityManagerStore", ar = (r, e, t,
1959
1971
  border: "1px dashed #dee2e6",
1960
1972
  borderRadius: "4px"
1961
1973
  }, children: [
1962
- s && o && /* @__PURE__ */ L("label", { style: { fontWeight: "bold" }, children: [
1974
+ s && o && /* @__PURE__ */ R("label", { style: { fontWeight: "bold" }, children: [
1963
1975
  o,
1964
1976
  ": "
1965
1977
  ] }),
@@ -1967,90 +1979,91 @@ const ir = () => Tt().user, gt = "archbaseSecurityManagerStore", ar = (r, e, t,
1967
1979
  ] }),
1968
1980
  children: r
1969
1981
  }
1970
- ) : /* @__PURE__ */ u(re, { children: r });
1971
- function jr(r, e) {
1982
+ ) : /* @__PURE__ */ l(te, { children: r });
1983
+ function Wr(r, e) {
1972
1984
  return function(s) {
1973
1985
  const { resourceName: o, resourceDescription: a, requiredPermissions: d, fallbackComponent: i } = e;
1974
- return /* @__PURE__ */ u(
1975
- cr,
1986
+ return /* @__PURE__ */ l(
1987
+ hr,
1976
1988
  {
1977
1989
  resourceName: o,
1978
1990
  resourceDescription: a,
1979
1991
  requiredPermissions: d,
1980
1992
  fallbackComponent: i,
1981
- children: /* @__PURE__ */ u(r, { ...s })
1993
+ children: /* @__PURE__ */ l(r, { ...s })
1982
1994
  }
1983
1995
  );
1984
1996
  };
1985
1997
  }
1986
1998
  export {
1987
- gt as ARCHBASE_SECURITY_MANAGER_STORE,
1988
- sr as AccessIntervalDto,
1989
- ot as AccessScheduleDto,
1990
- Be as AccessTokenDto,
1991
- or as ActionDto,
1992
- Me as ApiTokenDto,
1993
- ft as ArchbaseAccessTokenService,
1994
- pt as ArchbaseApiTokenService,
1995
- er as ArchbaseAuthContext,
1996
- Ir as ArchbaseAuthProvider,
1997
- ut as ArchbaseGroupService,
1998
- Cr as ArchbaseLogin,
1999
- ht as ArchbaseProfileService,
2000
- wt as ArchbaseProtectedComponent,
2001
- Ur as ArchbaseResetPassword,
2002
- mt as ArchbaseResourceService,
2003
- Lr as ArchbaseSecureActionButton,
2004
- $r as ArchbaseSecureFormField,
2005
- tt as ArchbaseSecurityManager,
2006
- Mr as ArchbaseSecurityProvider,
1999
+ wt as ARCHBASE_SECURITY_MANAGER_STORE,
2000
+ ir as AccessIntervalDto,
2001
+ it as AccessScheduleDto,
2002
+ Le as AccessTokenDto,
2003
+ ar as ActionDto,
2004
+ Oe as ApiTokenDto,
2005
+ gt as ArchbaseAccessTokenService,
2006
+ mt as ArchbaseApiTokenService,
2007
+ sr as ArchbaseAuthContext,
2008
+ Ur as ArchbaseAuthProvider,
2009
+ pt as ArchbaseGroupService,
2010
+ Rr as ArchbaseLogin,
2011
+ ft as ArchbaseProfileService,
2012
+ bt as ArchbaseProtectedComponent,
2013
+ Nr as ArchbaseResetPassword,
2014
+ yt as ArchbaseResourceService,
2015
+ Vr as ArchbaseSecureActionButton,
2016
+ zr as ArchbaseSecureFormField,
2017
+ st as ArchbaseSecurityManager,
2018
+ $r as ArchbaseSecurityProvider,
2007
2019
  V as ArchbaseTenantManager,
2008
- qe as ArchbaseUser,
2009
- dt as ArchbaseUserService,
2010
- Ye as ArchbaseUsernameAndPassword,
2011
- Ye as ArchbaseUsernameAndPasswordImpl,
2012
- cr as ArchbaseViewSecurityProvider,
2013
- Ie as CONTEXT_STORAGE_KEY,
2014
- $t as DefaultArchbaseTokenManager,
2020
+ Xe as ArchbaseUser,
2021
+ ht as ArchbaseUserService,
2022
+ Qe as ArchbaseUsernameAndPassword,
2023
+ Qe as ArchbaseUsernameAndPasswordImpl,
2024
+ hr as ArchbaseViewSecurityProvider,
2025
+ Te as CONTEXT_STORAGE_KEY,
2026
+ Vt as DefaultArchbaseTokenManager,
2027
+ ur as DefaultSecurityLoading,
2015
2028
  Q as ENCRYPTION_KEY,
2016
- Qe as FetchError,
2029
+ et as FetchError,
2017
2030
  he as GroupDto,
2018
- Tr as PermissionDto,
2031
+ _r as PermissionDto,
2019
2032
  ue as ProfileDto,
2020
- ct as ResourceDto,
2033
+ dt as ResourceDto,
2021
2034
  le as SecurityDto,
2022
2035
  ae as SecurityType,
2023
- xe as TOKEN_COOKIE_NAME,
2024
- rr as TipoRecurso,
2025
- ke as USER_NAME,
2026
- Se as USER_NAME_AND_PASSWORD,
2027
- be as UserDto,
2028
- Re as UserGroupDto,
2029
- Yt as createInternalConfig,
2030
- me as decodeJWT,
2031
- se as epochAtSecondsFromNow,
2032
- We as epochTimeIsPast,
2033
- Gt as fetchTokens,
2034
- Jt as fetchWithRefreshToken,
2035
- Ft as generateCodeChallenge,
2036
- jt as generateRandomString,
2037
- Xe as getRandomInteger,
2038
- Zt as getRefreshExpiresIn,
2039
- zt as postWithXForm,
2040
- Wt as redirectToLogin,
2041
- Kt as redirectToLogout,
2042
- _r as useArchbaseAuthenticationManager,
2043
- Rr as useArchbaseGetCurrentToken,
2044
- ir as useArchbaseGetLoggedUser,
2045
- Or as useArchbasePermissionCheck,
2046
- Nr as useArchbaseResetPassword,
2047
- Br as useArchbaseSecureForm,
2048
- lr as useArchbaseSecurity,
2049
- Dr as useArchbaseSecurityManager,
2050
- Pr as useArchbaseTenantManager,
2051
- Le as useArchbaseViewSecurity,
2052
- kr as useBrowserStorage,
2053
- Xt as validateConfig,
2054
- qt as validateState,
2055
- jr as withArchbaseSecurity
2036
+ ke as TOKEN_COOKIE_NAME,
2037
+ nr as TipoRecurso,
2038
+ Pe as USER_NAME,
2039
+ Ie as USER_NAME_AND_PASSWORD,
2040
+ Ee as UserDto,
2041
+ Be as UserGroupDto,
2042
+ Zt as createInternalConfig,
2043
+ ge as decodeJWT,
2044
+ oe as epochAtSecondsFromNow,
2045
+ He as epochTimeIsPast,
2046
+ qt as fetchTokens,
2047
+ Yt as fetchWithRefreshToken,
2048
+ Wt as generateCodeChallenge,
2049
+ zt as generateRandomString,
2050
+ Ze as getRandomInteger,
2051
+ rr as getRefreshExpiresIn,
2052
+ Gt as postWithXForm,
2053
+ Jt as redirectToLogin,
2054
+ Xt as redirectToLogout,
2055
+ Mr as useArchbaseAuthenticationManager,
2056
+ Or as useArchbaseGetCurrentToken,
2057
+ lr as useArchbaseGetLoggedUser,
2058
+ Fr as useArchbasePermissionCheck,
2059
+ Lr as useArchbaseResetPassword,
2060
+ jr as useArchbaseSecureForm,
2061
+ pr as useArchbaseSecurity,
2062
+ Br as useArchbaseSecurityManager,
2063
+ Dr as useArchbaseTenantManager,
2064
+ je as useArchbaseViewSecurity,
2065
+ Cr as useBrowserStorage,
2066
+ er as validateConfig,
2067
+ Qt as validateState,
2068
+ Wr as withArchbaseSecurity
2056
2069
  };