@archbase/security 4.2.6 → 4.3.1

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,15 +1,15 @@
1
1
  import "reflect-metadata";
2
2
  import * as I from "inversify";
3
- import { decorate as $t, injectable as Ot } from "inversify";
4
- import { compressString as Lt, decompressString as zt, IOCContainer as jt, ARCHBASE_IOC_API_TYPE as Y, processErrorMessage as oe, IsNotEmpty as Q, IsOptional as ae, IsBoolean as re, IsEmail as Ft, getKeyByEnumValue as Qe, useArchbasePasswordRemember as Vt, getI18nextInstance as x, useArchbaseTheme as Ht, resolveArchbasePasswordPolicy as Wt, isEmailValidate as Gt, validateArchbasePassword as Jt, useArchbaseAppContext as Kt } from "@archbase/core";
3
+ import { decorate as Bt, injectable as Lt } from "inversify";
4
+ import { compressString as Ot, decompressString as zt, IOCContainer as jt, ARCHBASE_IOC_API_TYPE as Y, processErrorMessage as ie, IsNotEmpty as Q, IsOptional as Z, IsBoolean as se, IsEmail as Ft, getKeyByEnumValue as Qe, useArchbasePasswordRemember as Ht, getI18nextInstance as S, useArchbaseTheme as Vt, resolveArchbasePasswordPolicy as Wt, isEmailValidate as Gt, validateArchbasePassword as Jt, useArchbaseAppContext as Kt } from "@archbase/core";
5
5
  import q from "crypto-js";
6
6
  import { jwtDecode as qt } from "jwt-decode";
7
- import { jsx as o, jsxs as C, Fragment as ie } from "react/jsx-runtime";
8
- import it, { useState as p, useEffect as X, createContext as Ve, useMemo as at, useRef as ct, useCallback as Ie, useContext as He } from "react";
7
+ import { jsx as o, jsxs as C, Fragment as ae } from "react/jsx-runtime";
8
+ import it, { useState as p, useEffect as X, createContext as He, useMemo as at, useRef as ct, useCallback as Ie, useContext as Ve } from "react";
9
9
  import { BehaviorSubject as Ze } from "rxjs";
10
10
  import { ArchbaseRemoteApiService as ge, useArchbaseStore as lt } from "@archbase/data";
11
- import { v4 as Z } from "uuid";
12
- import { Card as We, Text as j, Divider as Ue, Stack as Ee, TextInput as xe, Button as G, Anchor as et, Group as ue, Select as Yt, Tooltip as Xt, Loader as dt, PasswordInput as ze, Checkbox as Qt, Alert as tt, Code as rt, CopyButton as st, SimpleGrid as Zt, useMantineColorScheme as er, Box as tr, Skeleton as Ce } from "@mantine/core";
11
+ import { v4 as ee } from "uuid";
12
+ import { Card as We, Text as F, Divider as Ue, Stack as Ee, TextInput as xe, Button as G, Anchor as et, Group as ue, Select as Yt, Tooltip as Xt, Loader as dt, PasswordInput as ze, Checkbox as Qt, Alert as tt, Code as rt, CopyButton as st, SimpleGrid as Zt, useMantineColorScheme as er, Box as tr, Skeleton as Ce } from "@mantine/core";
13
13
  import { useFocusTrap as ut } from "@mantine/hooks";
14
14
  import { IconCopy as rr } from "@tabler/icons-react";
15
15
  import { ArchbaseQRCode as sr, ArchbasePasswordStrengthMeter as nr, ArchbaseDialog as nt } from "@archbase/components";
@@ -38,11 +38,11 @@ class pt {
38
38
  return new pt({});
39
39
  }
40
40
  }
41
- const le = "YngzI1guK3dGaElFcFY9MywqK3xgPzg/Ojg7eD8xRmg=", Ne = "c1ab58e7-c113-4225-a190-a9e59d1207fc", Be = "6faf6932-a0b5-457b-83b1-8d89ddbd91fd", $e = "602b05c5-ec46-451e-aba6-187e463bc245", Oe = "8b4a7c2d-9e5f-4163-b8a7-3f2c9d8e5a1b";
41
+ const le = "YngzI1guK3dGaElFcFY9MywqK3xgPzg/Ojg7eD8xRmg=", Ne = "c1ab58e7-c113-4225-a190-a9e59d1207fc", $e = "6faf6932-a0b5-457b-83b1-8d89ddbd91fd", Be = "602b05c5-ec46-451e-aba6-187e463bc245", Le = "8b4a7c2d-9e5f-4163-b8a7-3f2c9d8e5a1b";
42
42
  class or {
43
43
  getUsernameAndPassword() {
44
44
  try {
45
- const e = localStorage.getItem(Be);
45
+ const e = localStorage.getItem($e);
46
46
  if (e) {
47
47
  const t = q.AES.decrypt(e, le).toString(q.enc.Utf8), n = atob(t).split(":");
48
48
  return { username: n[0], password: n[1], remember: !0 };
@@ -54,11 +54,11 @@ class or {
54
54
  }
55
55
  saveUsernameAndPassword(e, t) {
56
56
  const s = btoa(`${e}:${t}`), n = q.AES.encrypt(s, le).toString();
57
- localStorage.setItem(Be, n);
57
+ localStorage.setItem($e, n);
58
58
  }
59
59
  getUsername() {
60
60
  try {
61
- const e = localStorage.getItem($e);
61
+ const e = localStorage.getItem(Be);
62
62
  if (e) {
63
63
  const t = q.AES.decrypt(e, le).toString(q.enc.Utf8);
64
64
  return atob(t);
@@ -70,7 +70,7 @@ class or {
70
70
  }
71
71
  saveUsername(e) {
72
72
  const t = btoa(e), s = q.AES.encrypt(t, le).toString();
73
- localStorage.setItem($e, s);
73
+ localStorage.setItem(Be, s);
74
74
  }
75
75
  isTokenExpired(e, t = 300) {
76
76
  let s = e;
@@ -88,13 +88,13 @@ class or {
88
88
  }
89
89
  saveToken(e) {
90
90
  if (e) {
91
- const t = JSON.stringify(e), s = q.AES.encrypt(t, le).toString(), n = Lt(s);
91
+ const t = JSON.stringify(e), s = q.AES.encrypt(t, le).toString(), n = Ot(s);
92
92
  localStorage.setItem(Ne, n);
93
93
  } else
94
94
  this.clearToken();
95
95
  }
96
96
  clearUsernameAndPassword() {
97
- localStorage.removeItem(Be), localStorage.removeItem($e);
97
+ localStorage.removeItem($e), localStorage.removeItem(Be);
98
98
  }
99
99
  clearToken() {
100
100
  localStorage.removeItem(Ne);
@@ -113,24 +113,24 @@ class or {
113
113
  saveContext(e) {
114
114
  try {
115
115
  const t = q.AES.encrypt(e, le).toString();
116
- localStorage.setItem(Oe, t);
116
+ localStorage.setItem(Le, 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(Oe);
123
+ const e = localStorage.getItem(Le);
124
124
  return e ? q.AES.decrypt(e, le).toString(q.enc.Utf8) : null;
125
125
  } catch {
126
126
  return null;
127
127
  }
128
128
  }
129
129
  clearContext() {
130
- localStorage.removeItem(Oe);
130
+ localStorage.removeItem(Le);
131
131
  }
132
132
  }
133
- $t(Ot(), or);
133
+ Bt(Lt(), or);
134
134
  function ft(r) {
135
135
  const t = new Uint8Array(1);
136
136
  return window.crypto.getRandomValues(t), t[0] >= Math.floor(256 / r) * r ? ft(r) : t[0] % r;
@@ -368,7 +368,7 @@ const Te = (r) => {
368
368
  Você pode desativar a decodificação JWT definindo o valor 'decodeToken' como 'falso' na configuração.`
369
369
  );
370
370
  }
371
- }, br = Ve({
371
+ }, br = He({
372
372
  token: "",
373
373
  login: () => null,
374
374
  logOut: () => null,
@@ -383,7 +383,7 @@ const Te = (r) => {
383
383
  "ROCP_refreshTokenExpire",
384
384
  pe(2 * fe),
385
385
  t.storage
386
- ), [i, d] = de("ROCP_token", "", t.storage), [y, S] = de(
386
+ ), [i, d] = de("ROCP_token", "", t.storage), [y, k] = de(
387
387
  "ROCP_tokenExpire",
388
388
  pe(fe),
389
389
  t.storage
@@ -395,20 +395,20 @@ const Te = (r) => {
395
395
  "ROCP_loginInProgress",
396
396
  !1,
397
397
  t.storage
398
- ), [E, P] = de(
398
+ ), [x, P] = de(
399
399
  "ROCP_refreshInProgress",
400
400
  !1,
401
401
  t.storage
402
- ), [M, $] = p(), [V, _] = p(), [b, m] = p(null);
402
+ ), [M, B] = p(), [H, _] = p(), [b, m] = p(null);
403
403
  let R;
404
- function H() {
405
- n(void 0), d(""), S(pe(fe)), c(pe(fe)), U(void 0), $(void 0), _(void 0), w(!1);
404
+ function V() {
405
+ n(void 0), d(""), k(pe(fe)), c(pe(fe)), U(void 0), B(void 0), _(void 0), w(!1);
406
406
  }
407
- function O(g, v) {
408
- H(), m(null), t?.logoutEndpoint && fr(t, i, s, h, g, v);
407
+ function L(g, v) {
408
+ V(), m(null), t?.logoutEndpoint && fr(t, i, s, h, g, v);
409
409
  }
410
410
  function N(g) {
411
- H(), w(!0);
411
+ V(), w(!0);
412
412
  let v = g;
413
413
  g && typeof g != "string" && (console.warn(
414
414
  `O estado de login aprovado deve ser do tipo 'string'. Recebido'${g}'. Ignorando o valor...`
@@ -419,7 +419,7 @@ const Te = (r) => {
419
419
  function T(g) {
420
420
  d(g.access_token), n(g.refresh_token);
421
421
  const v = t.tokenExpiresIn ?? g.expires_in ?? fe;
422
- S(pe(v));
422
+ k(pe(v));
423
423
  const K = t.refreshTokenExpiresIn ?? wr(v, g);
424
424
  c(pe(K)), U(g.id_token);
425
425
  try {
@@ -428,23 +428,23 @@ const Te = (r) => {
428
428
  console.warn(`Falha ao decodificar idToken: ${W.message}`);
429
429
  }
430
430
  try {
431
- t.decodeToken && $(Te(g.access_token));
431
+ t.decodeToken && B(Te(g.access_token));
432
432
  } catch (W) {
433
433
  console.warn(`Falha ao decodificar o token de acesso: ${W.message}`);
434
434
  }
435
435
  }
436
- function ee(g = !1) {
436
+ function te(g = !1) {
437
437
  return g || !t.onRefreshTokenExpire ? N() : t.onRefreshTokenExpire({ login: N });
438
438
  }
439
- function te(g = !1) {
440
- if (i && ot(y) && !(E && !g)) {
439
+ function re(g = !1) {
440
+ if (i && ot(y) && !(x && !g)) {
441
441
  if (ot(a))
442
- return ee(g);
442
+ return te(g);
443
443
  if (s) {
444
444
  P(!0), pr({ config: t, refreshToken: s }).then((v) => T(v)).catch((v) => {
445
445
  if (v instanceof mt) {
446
446
  if (v.status === 400)
447
- return ee(g);
447
+ return te(g);
448
448
  console.error(v), m(v.message), g && N();
449
449
  } else
450
450
  v instanceof Error && (console.error(v), m(v.message), g && N());
@@ -458,18 +458,18 @@ const Te = (r) => {
458
458
  );
459
459
  }
460
460
  }
461
- X(() => (R = setInterval(() => te(), 1e4), () => clearInterval(R)), [i, s, a, y]);
462
- const se = ct(!1);
461
+ X(() => (R = setInterval(() => re(), 1e4), () => clearInterval(R)), [i, s, a, y]);
462
+ const ne = ct(!1);
463
463
  return X(() => {
464
464
  if (A) {
465
465
  const g = new URLSearchParams(window.location.search);
466
466
  if (!g.get("code")) {
467
467
  const v = g.get("error_description") || "Estado de autorização inválido. Atualizar a página pode resolver o problema.";
468
- console.error(v), m(v), O();
468
+ console.error(v), m(v), L();
469
469
  return;
470
470
  }
471
- if (!se.current) {
472
- se.current = !0;
471
+ if (!ne.current) {
472
+ ne.current = !0;
473
473
  try {
474
474
  mr(g);
475
475
  } catch (v) {
@@ -493,15 +493,15 @@ const Te = (r) => {
493
493
  console.warn(`Falha ao decodificar idToken: ${g.message}`);
494
494
  }
495
495
  try {
496
- t.decodeToken && $(Te(i));
496
+ t.decodeToken && B(Te(i));
497
497
  } catch (g) {
498
498
  console.warn(`Falha ao decodificar o token de acesso: ${g.message}`);
499
499
  }
500
- te(!0);
500
+ re(!0);
501
501
  }, []), /* @__PURE__ */ o(
502
502
  br.Provider,
503
503
  {
504
- value: { token: i, tokenData: M, idToken: h, idTokenData: V, login: N, logOut: O, error: b, loginInProgress: A },
504
+ value: { token: i, tokenData: M, idToken: h, idTokenData: H, login: N, logOut: L, error: b, loginInProgress: A },
505
505
  children: e
506
506
  }
507
507
  );
@@ -524,7 +524,7 @@ class vt {
524
524
  this.alreadyApplied || (this.alreadyApplied = !0, this.resourceService.registerResource({ resource: this.resource, actions: this.actions }).then((t) => {
525
525
  this.permissions = t.permissions, this.error = "", e && e();
526
526
  }).catch((t) => {
527
- this.alreadyApplied = !1, this.error = oe(t);
527
+ this.alreadyApplied = !1, this.error = ie(t);
528
528
  }));
529
529
  }
530
530
  hasPermission(e) {
@@ -632,7 +632,7 @@ class J {
632
632
  function Jr() {
633
633
  return J.getInstance();
634
634
  }
635
- var me = /* @__PURE__ */ ((r) => (r.USER = "user", r.PROFILE = "profile", r.GROUP = "group", r))(me || {}), Ar = Object.defineProperty, k = (r, e, t, s) => {
635
+ var me = /* @__PURE__ */ ((r) => (r.USER = "user", r.PROFILE = "profile", r.GROUP = "group", r))(me || {}), Ar = Object.defineProperty, E = (r, e, t, s) => {
636
636
  for (var n = void 0, a = r.length - 1, c; a >= 0; a--)
637
637
  (c = r[a]) && (n = c(e, t, n) || n);
638
638
  return n && Ar(e, t, n), n;
@@ -651,11 +651,11 @@ const wt = class bt {
651
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 xr(t)) : [];
652
652
  }
653
653
  static newInstance = () => new bt({
654
- id: Z(),
654
+ id: ee(),
655
655
  intervals: []
656
656
  });
657
657
  };
658
- k([
658
+ E([
659
659
  Q({
660
660
  message: "archbase:Informe a descrição do cronograma de acesso"
661
661
  })
@@ -677,21 +677,21 @@ const _e = class Et {
677
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 At(e.accessSchedule) : void 0, this.dayOfWeek = e.dayOfWeek || 0, this.startTime = e.startTime || "", this.endTime = e.endTime || "";
678
678
  }
679
679
  static newInstance = () => new Et({
680
- id: Z(),
680
+ id: ee(),
681
681
  dayOfWeek: (/* @__PURE__ */ new Date()).getDay(),
682
682
  startTime: "08:00",
683
683
  endTime: "17:00"
684
684
  });
685
685
  };
686
- k([
687
- ae()
686
+ E([
687
+ Z()
688
688
  ], _e.prototype, "accessSchedule");
689
- k([
689
+ E([
690
690
  Q({
691
691
  message: "archbase:Informe a hora de início"
692
692
  })
693
693
  ], _e.prototype, "startTime");
694
- k([
694
+ E([
695
695
  Q({
696
696
  message: "archbase:Informe a hora de término"
697
697
  })
@@ -712,18 +712,18 @@ class ye {
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
- k([
715
+ E([
716
716
  Q({
717
717
  message: "archbase:Informe o nome"
718
718
  })
719
719
  ], ye.prototype, "name");
720
- k([
720
+ E([
721
721
  Q({
722
722
  message: "archbase:Informe a descrição"
723
723
  })
724
724
  ], ye.prototype, "description");
725
- k([
726
- ae()
725
+ E([
726
+ Z()
727
727
  ], ye.prototype, "actions");
728
728
  const ve = class xt {
729
729
  id;
@@ -741,44 +741,44 @@ const ve = class xt {
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 St(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 kt(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
746
  static newInstance = () => new xt({
747
- id: Z(),
747
+ id: ee(),
748
748
  active: !0,
749
749
  isNewAction: !0
750
750
  });
751
751
  };
752
- k([
752
+ E([
753
753
  Q({
754
754
  message: "archbase:Informe o nome para a ação"
755
755
  })
756
756
  ], ve.prototype, "name");
757
- k([
757
+ E([
758
758
  Q({
759
759
  message: "archbase:Informe a descrição para a ação"
760
760
  })
761
761
  ], ve.prototype, "description");
762
- k([
763
- ae()
762
+ E([
763
+ Z()
764
764
  ], ve.prototype, "resource");
765
- k([
765
+ E([
766
766
  Q({
767
767
  message: "archbase:Informe a categoria para a ação"
768
768
  })
769
769
  ], ve.prototype, "category");
770
- k([
771
- re()
770
+ E([
771
+ se()
772
772
  ], ve.prototype, "active");
773
- let kr = ve;
774
- class ke extends ye {
773
+ let Sr = ve;
774
+ class Se extends ye {
775
775
  type;
776
776
  isNewProfile;
777
777
  constructor(e) {
778
778
  super(e), this.type = me.PROFILE, this.isNewProfile = e.isNewProfile || !1;
779
779
  }
780
- static newInstance = () => new ke({
781
- id: Z(),
780
+ static newInstance = () => new Se({
781
+ id: ee(),
782
782
  isNewProfile: !0
783
783
  });
784
784
  }
@@ -792,25 +792,25 @@ class Ge {
792
792
  lastModifiedByUser;
793
793
  group;
794
794
  constructor(e) {
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 Se(e.group) : void 0;
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 ke(e.group) : void 0;
796
796
  }
797
797
  static newInstance = (e) => new Ge({
798
- id: Z(),
798
+ id: ee(),
799
799
  group: e
800
800
  });
801
801
  }
802
- class Se extends ye {
802
+ class ke extends ye {
803
803
  type;
804
804
  isNewGroup;
805
805
  constructor(e) {
806
806
  super(e), this.type = me.GROUP, this.isNewGroup = e.isNewGroup || !1;
807
807
  }
808
- static newInstance = () => new Se({
809
- id: Z(),
808
+ static newInstance = () => new ke({
809
+ id: ee(),
810
810
  isNewGroup: !0
811
811
  });
812
812
  }
813
- const Re = class kt {
813
+ const Re = class St {
814
814
  id;
815
815
  code;
816
816
  version;
@@ -827,28 +827,28 @@ const Re = class kt {
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 kt({
831
- id: Z(),
830
+ static newInstance = () => new St({
831
+ id: ee(),
832
832
  actions: [],
833
833
  active: !0,
834
834
  isNewResource: !0
835
835
  });
836
836
  };
837
- k([
837
+ E([
838
838
  Q({
839
839
  message: "archbase:Informe o nome para o recurso"
840
840
  })
841
841
  ], Re.prototype, "name");
842
- k([
842
+ E([
843
843
  Q({
844
844
  message: "archbase:Informe a descrição para o recurso"
845
845
  })
846
846
  ], Re.prototype, "description");
847
- k([
848
- re()
847
+ E([
848
+ se()
849
849
  ], Re.prototype, "active");
850
- let St = Re;
851
- const F = class It extends ye {
850
+ let kt = Re;
851
+ const O = class It extends ye {
852
852
  userName;
853
853
  password;
854
854
  changePasswordOnNextLogin;
@@ -868,11 +868,13 @@ const F = class It extends ye {
868
868
  email;
869
869
  type;
870
870
  isNewUser;
871
+ employeeId;
872
+ externalId;
871
873
  constructor(e) {
872
- super(e), this.type = me.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.passwordChangedAt = e.passwordChangedAt || void 0, 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 At(e.accessSchedule) : void 0, this.groups = e.groups ? e.groups.map((t) => new Ge(t)) : [], this.profile = e.profile ? new ke(e.profile) : void 0, this.email = e.email || "", this.avatar = e.avatar || void 0, this.isNewUser = e.isNewUser || !1, this.nickname = e.nickname;
874
+ super(e), this.type = me.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.passwordChangedAt = e.passwordChangedAt || void 0, 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 At(e.accessSchedule) : void 0, this.groups = e.groups ? e.groups.map((t) => new Ge(t)) : [], this.profile = e.profile ? new Se(e.profile) : void 0, this.email = e.email || "", this.avatar = e.avatar || void 0, this.isNewUser = e.isNewUser || !1, this.nickname = e.nickname, this.employeeId = e.employeeId || void 0, this.externalId = e.externalId || void 0;
873
875
  }
874
876
  static newInstance = () => new It({
875
- id: Z(),
877
+ id: ee(),
876
878
  userName: "",
877
879
  password: "",
878
880
  groups: [],
@@ -883,56 +885,62 @@ const F = class It extends ye {
883
885
  isNewUser: !0
884
886
  });
885
887
  };
886
- k([
888
+ E([
887
889
  Q({
888
890
  message: "archbase:Informe o nome de usuário"
889
891
  })
890
- ], F.prototype, "userName");
891
- k([
892
- re()
893
- ], F.prototype, "changePasswordOnNextLogin");
894
- k([
895
- re()
896
- ], F.prototype, "allowPasswordChange");
897
- k([
898
- re()
899
- ], F.prototype, "allowMultipleLogins");
900
- k([
901
- re()
902
- ], F.prototype, "passwordNeverExpires");
903
- k([
904
- ae()
905
- ], F.prototype, "passwordChangedAt");
906
- k([
907
- re()
908
- ], F.prototype, "accountDeactivated");
909
- k([
910
- re()
911
- ], F.prototype, "accountLocked");
912
- k([
913
- re()
914
- ], F.prototype, "unlimitedAccessHours");
915
- k([
916
- re()
917
- ], F.prototype, "isAdministrator");
918
- k([
919
- ae()
920
- ], F.prototype, "accessSchedule");
921
- k([
922
- ae()
923
- ], F.prototype, "groups");
924
- k([
925
- ae()
926
- ], F.prototype, "profile");
927
- k([
892
+ ], O.prototype, "userName");
893
+ E([
894
+ se()
895
+ ], O.prototype, "changePasswordOnNextLogin");
896
+ E([
897
+ se()
898
+ ], O.prototype, "allowPasswordChange");
899
+ E([
900
+ se()
901
+ ], O.prototype, "allowMultipleLogins");
902
+ E([
903
+ se()
904
+ ], O.prototype, "passwordNeverExpires");
905
+ E([
906
+ Z()
907
+ ], O.prototype, "passwordChangedAt");
908
+ E([
909
+ se()
910
+ ], O.prototype, "accountDeactivated");
911
+ E([
912
+ se()
913
+ ], O.prototype, "accountLocked");
914
+ E([
915
+ se()
916
+ ], O.prototype, "unlimitedAccessHours");
917
+ E([
918
+ se()
919
+ ], O.prototype, "isAdministrator");
920
+ E([
921
+ Z()
922
+ ], O.prototype, "accessSchedule");
923
+ E([
924
+ Z()
925
+ ], O.prototype, "groups");
926
+ E([
927
+ Z()
928
+ ], O.prototype, "profile");
929
+ E([
928
930
  Ft(
929
931
  {},
930
932
  {
931
933
  message: "archbase:Informe um email válido"
932
934
  }
933
935
  )
934
- ], F.prototype, "email");
935
- let Me = F;
936
+ ], O.prototype, "email");
937
+ E([
938
+ Z()
939
+ ], O.prototype, "employeeId");
940
+ E([
941
+ Z()
942
+ ], O.prototype, "externalId");
943
+ let Me = O;
936
944
  const Je = class Fe {
937
945
  id;
938
946
  code;
@@ -947,14 +955,14 @@ const Je = class Fe {
947
955
  companyId;
948
956
  projectId;
949
957
  constructor(e) {
950
- 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 ? Fe.createDtoFromJson(e.security) : void 0, this.action = e.action ? new kr(e.action) : void 0, this.tenantId = e.tenantId || "", this.companyId = e.companyId || "", this.projectId = e.projectId || "";
958
+ 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 ? Fe.createDtoFromJson(e.security) : void 0, this.action = e.action ? new Sr(e.action) : void 0, this.tenantId = e.tenantId || "", this.companyId = e.companyId || "", this.projectId = e.projectId || "";
951
959
  }
952
960
  static createDtoFromJson(e) {
953
961
  switch (e.type) {
954
962
  case "profile":
955
- return new ke(e);
956
- case "group":
957
963
  return new Se(e);
964
+ case "group":
965
+ return new ke(e);
958
966
  case "user":
959
967
  return new Me(e);
960
968
  default:
@@ -962,17 +970,17 @@ const Je = class Fe {
962
970
  }
963
971
  }
964
972
  static newInstance = () => new Fe({
965
- id: Z(),
973
+ id: ee(),
966
974
  tenantId: "",
967
975
  companyId: "",
968
976
  projectId: ""
969
977
  });
970
978
  };
971
- k([
972
- ae()
979
+ E([
980
+ Z()
973
981
  ], Je.prototype, "security");
974
- k([
975
- ae()
982
+ E([
983
+ Z()
976
984
  ], Je.prototype, "action");
977
985
  let Kr = Je;
978
986
  class Ke {
@@ -996,7 +1004,7 @@ class Ke {
996
1004
  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 Me(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;
997
1005
  }
998
1006
  static newInstance = () => new Ke({
999
- id: Z()
1007
+ id: ee()
1000
1008
  });
1001
1009
  }
1002
1010
  class qe {
@@ -1019,7 +1027,7 @@ class qe {
1019
1027
  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 Me(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;
1020
1028
  }
1021
1029
  static newInstance = () => new qe({
1022
- id: Z(),
1030
+ id: ee(),
1023
1031
  active: !0,
1024
1032
  isNewAccessToken: !0
1025
1033
  });
@@ -1061,7 +1069,7 @@ class Pt extends ge {
1061
1069
  return J.getInstance().getHeaders();
1062
1070
  }
1063
1071
  transform(e) {
1064
- return new Se(e);
1072
+ return new ke(e);
1065
1073
  }
1066
1074
  getEndpoint() {
1067
1075
  return "/api/v1/group";
@@ -1083,7 +1091,7 @@ class Tt extends ge {
1083
1091
  return J.getInstance().getHeaders();
1084
1092
  }
1085
1093
  transform(e) {
1086
- return new ke(e);
1094
+ return new Se(e);
1087
1095
  }
1088
1096
  getEndpoint() {
1089
1097
  return "/api/v1/userProfile";
@@ -1171,7 +1179,7 @@ class _t extends ge {
1171
1179
  return J.getInstance().getHeaders();
1172
1180
  }
1173
1181
  transform(e) {
1174
- return new St(e);
1182
+ return new kt(e);
1175
1183
  }
1176
1184
  getEndpoint() {
1177
1185
  return "/api/v1/resource";
@@ -1238,6 +1246,13 @@ class Rt {
1238
1246
  getEndpoint() {
1239
1247
  return "/api/v1/security/diagnostics";
1240
1248
  }
1249
+ /**
1250
+ * Base própria: a trilha vive fora do diagnóstico porque tem chave própria no backend
1251
+ * ({@code archbase.security.audit.enabled}) e some inteira quando ela está desligada.
1252
+ */
1253
+ getAuditEndpoint() {
1254
+ return "/api/v1/security/audit";
1255
+ }
1241
1256
  /** Retrato do tenant: contagens do catálogo e o estado das proteções configuráveis. */
1242
1257
  async getOverview() {
1243
1258
  return this.client.get(`${this.getEndpoint()}/overview`, this.configureHeaders());
@@ -1321,6 +1336,22 @@ class Rt {
1321
1336
  this.configureHeaders()
1322
1337
  );
1323
1338
  }
1339
+ /**
1340
+ * Os acontecimentos de segurança, do mais recente para o mais antigo.
1341
+ *
1342
+ * <p>Sem período informado o servidor assume os últimos trinta dias — a primeira consulta de
1343
+ * quem abre a tela não deve varrer a tabela inteira.
1344
+ *
1345
+ * <p>Devolve 403 para quem não é administrador, e 404 quando a trilha está desligada: os dois
1346
+ * casos precisam ser distinguidos na tela, porque significam coisas diferentes.
1347
+ */
1348
+ async getAuditEvents(e = {}) {
1349
+ const t = new URLSearchParams();
1350
+ return e.usuario && t.set("usuario", e.usuario), e.tipo && t.set("tipo", e.tipo), e.inicio && t.set("inicio", e.inicio), e.fim && t.set("fim", e.fim), t.set("page", String(e.page ?? 0)), t.set("size", String(e.size ?? 50)), this.client.get(
1351
+ `${this.getAuditEndpoint()}/events?${t.toString()}`,
1352
+ this.configureHeaders()
1353
+ );
1354
+ }
1324
1355
  }
1325
1356
  I.decorate(I.inject(Y.ApiClient), Rt, 0);
1326
1357
  I.decorate(I.injectable(), Rt);
@@ -1335,43 +1366,43 @@ function qr({
1335
1366
  mockUsers: i = [],
1336
1367
  mockUsersGroupMap: d,
1337
1368
  options: y = {},
1338
- onChangeUsername: S,
1369
+ onChangeUsername: k,
1339
1370
  disabledLogin: h = !1,
1340
1371
  isCheckingUsername: U = !1,
1341
1372
  showSignIn: A = !0,
1342
1373
  mfaRequired: w = !1,
1343
- onVerifyMfa: E,
1374
+ onVerifyMfa: x,
1344
1375
  mfaError: P,
1345
1376
  onCancelMfa: M,
1346
- isVerifyingMfa: $ = !1
1377
+ isVerifyingMfa: B = !1
1347
1378
  }) {
1348
- const V = ut(), {
1379
+ const H = ut(), {
1349
1380
  username: _,
1350
1381
  password: b,
1351
1382
  rememberMe: m,
1352
1383
  clearRememberMe: R
1353
- } = Vt(), [H, O] = p(_), [N, T] = p(b), [ee, te] = p(m), [se, g] = p(!1), [v, K] = p(null), [W, we] = p("");
1384
+ } = Ht(), [V, L] = p(_), [N, T] = p(b), [te, re] = p(m), [ne, g] = p(!1), [v, K] = p(null), [W, we] = p("");
1354
1385
  X(() => {
1355
1386
  g(!!e);
1356
1387
  }, [e]), X(() => {
1357
- _ !== H && (O(_), S?.(_)), b !== N && T(b), m !== ee && te(m);
1388
+ _ !== V && (L(_), k?.(_)), b !== N && T(b), m !== te && re(m);
1358
1389
  }, [_, b, m]);
1359
1390
  const he = () => {
1360
1391
  g(!1);
1361
- }, B = () => {
1362
- H && N && r(H, N, ee).finally(() => g(!0));
1392
+ }, $ = () => {
1393
+ V && N && r(V, N, te).finally(() => g(!0));
1363
1394
  }, ce = () => {
1364
1395
  const l = W.trim();
1365
- l && E && E(l);
1366
- }, ne = () => {
1396
+ l && x && x(l);
1397
+ }, oe = () => {
1367
1398
  if (!d)
1368
1399
  return i.map((f) => ({
1369
1400
  value: f.email,
1370
1401
  label: f.email
1371
1402
  }));
1372
1403
  const l = i.reduce((f, D) => {
1373
- const z = d[D.type];
1374
- return z && (f[z] || (f[z] = []), f[z].push({
1404
+ const j = d[D.type];
1405
+ return j && (f[j] || (f[j] = []), f[j].push({
1375
1406
  value: D.email,
1376
1407
  label: D.email
1377
1408
  })), f;
@@ -1383,7 +1414,7 @@ function qr({
1383
1414
  }, be = () => {
1384
1415
  if (v) {
1385
1416
  const l = i.find((f) => f.email === v);
1386
- l && (O(l.email), T(l.password), he());
1417
+ l && (L(l.email), T(l.password), he());
1387
1418
  }
1388
1419
  }, u = {
1389
1420
  withBorder: !0,
@@ -1399,18 +1430,18 @@ function qr({
1399
1430
  {
1400
1431
  ...u,
1401
1432
  pos: "relative",
1402
- ref: V,
1433
+ ref: H,
1403
1434
  children: [
1404
- A && /* @__PURE__ */ C(ie, { children: [
1435
+ A && /* @__PURE__ */ C(ae, { children: [
1405
1436
  /* @__PURE__ */ o(
1406
- j,
1437
+ F,
1407
1438
  {
1408
1439
  c: "light-dark(var(--mantine-color-black), var(--mantine-color-white))",
1409
1440
  fw: 800,
1410
1441
  fz: { base: "20px", md: "35px" },
1411
1442
  style: { textAlign: "center", letterSpacing: "-1px" },
1412
1443
  mt: "xs",
1413
- children: x().t("archbase:signIn")
1444
+ children: S().t("archbase:signIn")
1414
1445
  }
1415
1446
  ),
1416
1447
  /* @__PURE__ */ o(Ue, { m: "md" })
@@ -1418,8 +1449,8 @@ function qr({
1418
1449
  y?.customContentBefore,
1419
1450
  w && /* @__PURE__ */ C(Ee, { gap: "md", children: [
1420
1451
  /* @__PURE__ */ C("div", { children: [
1421
- /* @__PURE__ */ o(j, { fw: 700, fz: "lg", children: x().t("archbase:mfa.title", "Verificação em duas etapas") }),
1422
- /* @__PURE__ */ o(j, { c: "dimmed", fz: "sm", children: x().t(
1452
+ /* @__PURE__ */ o(F, { fw: 700, fz: "lg", children: S().t("archbase:mfa.title", "Verificação em duas etapas") }),
1453
+ /* @__PURE__ */ o(F, { c: "dimmed", fz: "sm", children: S().t(
1423
1454
  "archbase:mfa.subtitle",
1424
1455
  "Digite o código do seu aplicativo autenticador (ou um código de recuperação)."
1425
1456
  ) })
@@ -1427,7 +1458,7 @@ function qr({
1427
1458
  /* @__PURE__ */ o(
1428
1459
  xe,
1429
1460
  {
1430
- label: x().t("archbase:mfa.code", "Código de verificação"),
1461
+ label: S().t("archbase:mfa.code", "Código de verificação"),
1431
1462
  placeholder: "000000",
1432
1463
  value: W,
1433
1464
  autoFocus: !0,
@@ -1437,15 +1468,15 @@ function qr({
1437
1468
  }
1438
1469
  }
1439
1470
  ),
1440
- P && /* @__PURE__ */ o(j, { c: "red", fz: "sm", children: P }),
1471
+ P && /* @__PURE__ */ o(F, { c: "red", fz: "sm", children: P }),
1441
1472
  /* @__PURE__ */ o(
1442
1473
  G,
1443
1474
  {
1444
1475
  fullWidth: !0,
1445
- disabled: !W.trim() || $,
1446
- loading: $,
1476
+ disabled: !W.trim() || B,
1477
+ loading: B,
1447
1478
  onClick: ce,
1448
- children: x().t("archbase:mfa.verify", "Verificar")
1479
+ children: S().t("archbase:mfa.verify", "Verificar")
1449
1480
  }
1450
1481
  ),
1451
1482
  M && /* @__PURE__ */ o(
@@ -1457,18 +1488,18 @@ function qr({
1457
1488
  ta: "center",
1458
1489
  styles: { root: { cursor: "pointer" } },
1459
1490
  onClick: M,
1460
- children: x().t("archbase:mfa.back", "Voltar ao login")
1491
+ children: S().t("archbase:mfa.back", "Voltar ao login")
1461
1492
  }
1462
1493
  )
1463
1494
  ] }),
1464
- !w && /* @__PURE__ */ C(ie, { children: [
1465
- c && /* @__PURE__ */ C(ie, { children: [
1495
+ !w && /* @__PURE__ */ C(ae, { children: [
1496
+ c && /* @__PURE__ */ C(ae, { children: [
1466
1497
  /* @__PURE__ */ C(ue, { gap: "sm", mb: "md", children: [
1467
1498
  /* @__PURE__ */ o(
1468
1499
  Yt,
1469
1500
  {
1470
1501
  placeholder: "Selecione um usuário mock",
1471
- data: ne(),
1502
+ data: oe(),
1472
1503
  value: v,
1473
1504
  onChange: (l) => K(l ?? ""),
1474
1505
  searchable: !0,
@@ -1494,20 +1525,20 @@ function qr({
1494
1525
  xe,
1495
1526
  {
1496
1527
  label: s,
1497
- placeholder: n ?? x().t("archbase:usuario@email.com"),
1528
+ placeholder: n ?? S().t("archbase:usuario@email.com"),
1498
1529
  rightSection: U ? /* @__PURE__ */ o(dt, { size: "xs" }) : null,
1499
- value: H || "",
1530
+ value: V || "",
1500
1531
  required: !0,
1501
1532
  onChange: (l) => {
1502
- O(l.currentTarget.value), S?.(l.currentTarget.value), he();
1533
+ L(l.currentTarget.value), k?.(l.currentTarget.value), he();
1503
1534
  }
1504
1535
  }
1505
1536
  ),
1506
1537
  /* @__PURE__ */ o(
1507
1538
  ze,
1508
1539
  {
1509
- label: x().t("archbase:Password"),
1510
- placeholder: x().t("archbase:Sua senha"),
1540
+ label: S().t("archbase:Password"),
1541
+ placeholder: S().t("archbase:Sua senha"),
1511
1542
  onChange: (l) => {
1512
1543
  T(l.currentTarget.value), he();
1513
1544
  },
@@ -1520,11 +1551,11 @@ function qr({
1520
1551
  /* @__PURE__ */ o(
1521
1552
  Qt,
1522
1553
  {
1523
- label: x().t("archbase:Lembre-me"),
1524
- checked: ee,
1554
+ label: S().t("archbase:Lembre-me"),
1555
+ checked: te,
1525
1556
  onChange: (l) => {
1526
1557
  const f = l.currentTarget.checked;
1527
- te(f), f || R();
1558
+ re(f), f || R();
1528
1559
  }
1529
1560
  }
1530
1561
  ),
@@ -1537,7 +1568,7 @@ function qr({
1537
1568
  lh: "20px",
1538
1569
  styles: { root: { cursor: "pointer" } },
1539
1570
  onClick: t,
1540
- children: x().t("archbase:Esqueci minha senha")
1571
+ children: S().t("archbase:Esqueci minha senha")
1541
1572
  }
1542
1573
  )
1543
1574
  ] }),
@@ -1545,21 +1576,21 @@ function qr({
1545
1576
  /* @__PURE__ */ o(
1546
1577
  G,
1547
1578
  {
1548
- disabled: !N || !H || h,
1579
+ disabled: !N || !V || h,
1549
1580
  fullWidth: !0,
1550
1581
  mt: "xl",
1551
- onClick: B,
1552
- children: x().t("archbase:signIn")
1582
+ onClick: $,
1583
+ children: S().t("archbase:signIn")
1553
1584
  }
1554
1585
  )
1555
1586
  ] }),
1556
1587
  y?.customContentAfter,
1557
- se && e && /* @__PURE__ */ o(j, { c: "red", mt: "sm", children: e })
1588
+ ne && e && /* @__PURE__ */ o(F, { c: "red", mt: "sm", children: e })
1558
1589
  ]
1559
1590
  }
1560
1591
  );
1561
1592
  }
1562
- const L = (r, e) => x().t(r, e);
1593
+ const z = (r, e) => S().t(r, e);
1563
1594
  function Yr({
1564
1595
  enabled: r,
1565
1596
  onSetup: e,
@@ -1567,17 +1598,17 @@ function Yr({
1567
1598
  onDisable: s,
1568
1599
  onStatusChange: n
1569
1600
  }) {
1570
- const [a, c] = p("idle"), [i, d] = p(null), [y, S] = p(""), [h, U] = p([]), [A, w] = p(!1), [E, P] = p(null), M = async () => {
1601
+ const [a, c] = p("idle"), [i, d] = p(null), [y, k] = p(""), [h, U] = p([]), [A, w] = p(!1), [x, P] = p(null), M = async () => {
1571
1602
  w(!0), P(null);
1572
1603
  try {
1573
1604
  const b = await e();
1574
- d(b), S(""), c("setup");
1605
+ d(b), k(""), c("setup");
1575
1606
  } catch (b) {
1576
1607
  P(b?.message || String(b));
1577
1608
  } finally {
1578
1609
  w(!1);
1579
1610
  }
1580
- }, $ = async () => {
1611
+ }, B = async () => {
1581
1612
  const b = y.trim();
1582
1613
  if (b) {
1583
1614
  w(!0), P(null);
@@ -1590,7 +1621,7 @@ function Yr({
1590
1621
  w(!1);
1591
1622
  }
1592
1623
  }
1593
- }, V = async () => {
1624
+ }, H = async () => {
1594
1625
  w(!0), P(null);
1595
1626
  try {
1596
1627
  await s(), d(null), U([]), c("idle"), n?.(!1);
@@ -1600,95 +1631,95 @@ function Yr({
1600
1631
  w(!1);
1601
1632
  }
1602
1633
  }, _ = () => {
1603
- U([]), d(null), S(""), c("idle");
1634
+ U([]), d(null), k(""), c("idle");
1604
1635
  };
1605
1636
  return /* @__PURE__ */ o(We, { withBorder: !0, radius: "md", p: "lg", children: /* @__PURE__ */ C(Ee, { gap: "md", children: [
1606
1637
  /* @__PURE__ */ C("div", { children: [
1607
- /* @__PURE__ */ o(j, { fw: 700, fz: "lg", children: L("archbase:mfa.setup.title", "Autenticação em duas etapas (MFA)") }),
1608
- /* @__PURE__ */ o(j, { c: "dimmed", fz: "sm", children: L(
1638
+ /* @__PURE__ */ o(F, { fw: 700, fz: "lg", children: z("archbase:mfa.setup.title", "Autenticação em duas etapas (MFA)") }),
1639
+ /* @__PURE__ */ o(F, { c: "dimmed", fz: "sm", children: z(
1609
1640
  "archbase:mfa.setup.subtitle",
1610
1641
  "Proteja o acesso exigindo um código do seu aplicativo autenticador no login."
1611
1642
  ) })
1612
1643
  ] }),
1613
- E && /* @__PURE__ */ o(tt, { color: "red", children: E }),
1644
+ x && /* @__PURE__ */ o(tt, { color: "red", children: x }),
1614
1645
  r && a === "idle" && /* @__PURE__ */ C(ue, { justify: "space-between", children: [
1615
- /* @__PURE__ */ o(j, { c: "teal", fw: 600, children: L("archbase:mfa.setup.active", "MFA ativo") }),
1616
- /* @__PURE__ */ o(G, { color: "red", variant: "light", loading: A, onClick: V, children: L("archbase:mfa.setup.disable", "Desativar") })
1646
+ /* @__PURE__ */ o(F, { c: "teal", fw: 600, children: z("archbase:mfa.setup.active", "MFA ativo") }),
1647
+ /* @__PURE__ */ o(G, { color: "red", variant: "light", loading: A, onClick: H, children: z("archbase:mfa.setup.disable", "Desativar") })
1617
1648
  ] }),
1618
- !r && a === "idle" && /* @__PURE__ */ o(G, { loading: A, onClick: M, children: L("archbase:mfa.setup.enable", "Ativar MFA") }),
1649
+ !r && a === "idle" && /* @__PURE__ */ o(G, { loading: A, onClick: M, children: z("archbase:mfa.setup.enable", "Ativar MFA") }),
1619
1650
  a === "setup" && i && /* @__PURE__ */ C(Ee, { gap: "sm", align: "center", children: [
1620
- /* @__PURE__ */ o(j, { fz: "sm", ta: "center", children: L(
1651
+ /* @__PURE__ */ o(F, { fz: "sm", ta: "center", children: z(
1621
1652
  "archbase:mfa.setup.scan",
1622
1653
  "Escaneie o QR Code no seu app autenticador (Google Authenticator, Authy…):"
1623
1654
  ) }),
1624
1655
  /* @__PURE__ */ o(sr, { value: i.provisioningUri, size: 180, level: "M" }),
1625
- /* @__PURE__ */ o(j, { fz: "xs", c: "dimmed", ta: "center", children: L("archbase:mfa.setup.manual", "Ou informe o código manualmente:") }),
1656
+ /* @__PURE__ */ o(F, { fz: "xs", c: "dimmed", ta: "center", children: z("archbase:mfa.setup.manual", "Ou informe o código manualmente:") }),
1626
1657
  /* @__PURE__ */ C(ue, { gap: "xs", children: [
1627
1658
  /* @__PURE__ */ o(rt, { children: i.secret }),
1628
- /* @__PURE__ */ o(st, { value: i.secret, children: ({ copied: b, copy: m }) => /* @__PURE__ */ o(G, { size: "xs", variant: "subtle", onClick: m, children: b ? L("archbase:mfa.setup.copied", "Copiado") : L("archbase:mfa.setup.copy", "Copiar") }) })
1659
+ /* @__PURE__ */ o(st, { value: i.secret, children: ({ copied: b, copy: m }) => /* @__PURE__ */ o(G, { size: "xs", variant: "subtle", onClick: m, children: b ? z("archbase:mfa.setup.copied", "Copiado") : z("archbase:mfa.setup.copy", "Copiar") }) })
1629
1660
  ] }),
1630
1661
  /* @__PURE__ */ o(
1631
1662
  xe,
1632
1663
  {
1633
1664
  w: "100%",
1634
- label: L("archbase:mfa.setup.confirmCode", "Digite o código gerado para confirmar"),
1665
+ label: z("archbase:mfa.setup.confirmCode", "Digite o código gerado para confirmar"),
1635
1666
  placeholder: "000000",
1636
1667
  value: y,
1637
- onChange: (b) => S(b.currentTarget.value),
1668
+ onChange: (b) => k(b.currentTarget.value),
1638
1669
  onKeyDown: (b) => {
1639
- b.key === "Enter" && $();
1670
+ b.key === "Enter" && B();
1640
1671
  }
1641
1672
  }
1642
1673
  ),
1643
1674
  /* @__PURE__ */ C(ue, { w: "100%", justify: "flex-end", children: [
1644
- /* @__PURE__ */ o(G, { variant: "default", onClick: _, disabled: A, children: L("archbase:mfa.setup.cancel", "Cancelar") }),
1645
- /* @__PURE__ */ o(G, { onClick: $, loading: A, disabled: !y.trim(), children: L("archbase:mfa.setup.confirm", "Confirmar e ativar") })
1675
+ /* @__PURE__ */ o(G, { variant: "default", onClick: _, disabled: A, children: z("archbase:mfa.setup.cancel", "Cancelar") }),
1676
+ /* @__PURE__ */ o(G, { onClick: B, loading: A, disabled: !y.trim(), children: z("archbase:mfa.setup.confirm", "Confirmar e ativar") })
1646
1677
  ] })
1647
1678
  ] }),
1648
1679
  a === "recovery" && /* @__PURE__ */ C(Ee, { gap: "sm", children: [
1649
- /* @__PURE__ */ o(tt, { color: "yellow", children: L(
1680
+ /* @__PURE__ */ o(tt, { color: "yellow", children: z(
1650
1681
  "archbase:mfa.setup.recoveryWarning",
1651
1682
  "Guarde estes códigos de recuperação em local seguro. Cada um funciona uma única vez e permite entrar se você perder o acesso ao app autenticador. Eles não serão exibidos novamente."
1652
1683
  ) }),
1653
1684
  /* @__PURE__ */ o(Zt, { cols: 2, spacing: "xs", children: h.map((b) => /* @__PURE__ */ o(rt, { fz: "sm", children: b }, b)) }),
1654
1685
  /* @__PURE__ */ C(ue, { justify: "space-between", children: [
1655
1686
  /* @__PURE__ */ o(st, { value: h.join(`
1656
- `), children: ({ copied: b, copy: m }) => /* @__PURE__ */ o(G, { variant: "subtle", onClick: m, children: b ? L("archbase:mfa.setup.copied", "Copiado") : L("archbase:mfa.setup.copyAll", "Copiar todos") }) }),
1657
- /* @__PURE__ */ o(G, { onClick: _, children: L("archbase:mfa.setup.done", "Guardei os códigos") })
1687
+ `), children: ({ copied: b, copy: m }) => /* @__PURE__ */ o(G, { variant: "subtle", onClick: m, children: b ? z("archbase:mfa.setup.copied", "Copiado") : z("archbase:mfa.setup.copyAll", "Copiar todos") }) }),
1688
+ /* @__PURE__ */ o(G, { onClick: _, children: z("archbase:mfa.setup.done", "Guardei os códigos") })
1658
1689
  ] })
1659
1690
  ] })
1660
1691
  ] }) });
1661
1692
  }
1662
- const Sr = {
1693
+ const kr = {
1663
1694
  position: "relative",
1664
1695
  width: "90%",
1665
1696
  maxWidth: 400,
1666
1697
  padding: 30,
1667
1698
  marginTop: 30
1668
1699
  };
1669
- function Xr({ error: r, onSendResetPasswordEmail: e, onResetPassword: t, onClickBackToLogin: s, validatePassword: n, validateToken: a, initialEmail: c = "", description: i, style: d, passwordPolicy: y, showPasswordRequirements: S = !0 }) {
1670
- const h = ut(), U = Ht(), { colorScheme: A } = er(), [w, E] = p(r ?? ""), [P, M] = p(c), [$, V] = p(""), [_, b] = p(""), [m, R] = p(""), [H, O] = p(!1), [N, T] = p(""), [ee, te] = p(""), [se, g] = p(""), [v, K] = p(""), W = Wt(y);
1671
- async function we(B) {
1672
- B && (Gt(B) ? await e(B).then(() => {
1673
- nt.showSuccess(`${x().t("archbase:Um e-mail com instruções para redefinir sua senha foi enviado. Verifique sua caixa de entrada.")}`), O(!0);
1700
+ function Xr({ error: r, onSendResetPasswordEmail: e, onResetPassword: t, onClickBackToLogin: s, validatePassword: n, validateToken: a, initialEmail: c = "", description: i, style: d, passwordPolicy: y, showPasswordRequirements: k = !0 }) {
1701
+ const h = ut(), U = Vt(), { colorScheme: A } = er(), [w, x] = p(r ?? ""), [P, M] = p(c), [B, H] = p(""), [_, b] = p(""), [m, R] = p(""), [V, L] = p(!1), [N, T] = p(""), [te, re] = p(""), [ne, g] = p(""), [v, K] = p(""), W = Wt(y);
1702
+ async function we($) {
1703
+ $ && (Gt($) ? await e($).then(() => {
1704
+ nt.showSuccess(`${S().t("archbase:Um e-mail com instruções para redefinir sua senha foi enviado. Verifique sua caixa de entrada.")}`), L(!0);
1674
1705
  }).catch(() => {
1675
- }) : T(`${x().t("archbase:Email inválido")}`));
1706
+ }) : T(`${S().t("archbase:Email inválido")}`));
1676
1707
  }
1677
- async function he(B, ce, ne, be) {
1678
- if (B && ce && ne) {
1708
+ async function he($, ce, oe, be) {
1709
+ if ($ && ce && oe) {
1679
1710
  let u = "", l = "", f = "";
1680
- a && (u = a(ce), te(u)), W && (l = Jt(ne, W).error ?? ""), !l && n && (l = n(ne)), g(l), ne !== be && (f = `${x().t("archbase:A nova senha e a confirmação devem ser iguais.")}`, K(f)), !l && !u && !f && await t(B, ce, ne).then(() => {
1681
- nt.showSuccess(`${x().t("archbase:Senha redefinida com sucesso.")}`), s(), O(!1);
1711
+ a && (u = a(ce), re(u)), W && (l = Jt(oe, W).error ?? ""), !l && n && (l = n(oe)), g(l), oe !== be && (f = `${S().t("archbase:A nova senha e a confirmação devem ser iguais.")}`, K(f)), !l && !u && !f && await t($, ce, oe).then(() => {
1712
+ nt.showSuccess(`${S().t("archbase:Senha redefinida com sucesso.")}`), s(), L(!1);
1682
1713
  }).catch(() => {
1683
- E(r || `${x().t("archbase:Erro ao redefinir senha.")}`);
1714
+ x(r || `${S().t("archbase:Erro ao redefinir senha.")}`);
1684
1715
  });
1685
1716
  }
1686
1717
  }
1687
1718
  return X(() => {
1688
- r && E(r);
1719
+ r && x(r);
1689
1720
  }, [r]), X(() => {
1690
- E("");
1691
- }, [P, $, _, m]), /* @__PURE__ */ C(
1721
+ x("");
1722
+ }, [P, B, _, m]), /* @__PURE__ */ C(
1692
1723
  We,
1693
1724
  {
1694
1725
  withBorder: !0,
@@ -1696,47 +1727,47 @@ function Xr({ error: r, onSendResetPasswordEmail: e, onResetPassword: t, onClick
1696
1727
  radius: "md",
1697
1728
  ref: h,
1698
1729
  style: {
1699
- ...Sr,
1730
+ ...kr,
1700
1731
  ...d
1701
1732
  },
1702
1733
  children: [
1703
- H ? /* @__PURE__ */ C(ie, { children: [
1734
+ V ? /* @__PURE__ */ C(ae, { children: [
1704
1735
  /* @__PURE__ */ o(
1705
- j,
1736
+ F,
1706
1737
  {
1707
1738
  c: "light-dark(var(--mantine-color-black), var(--mantine-color-white))",
1708
1739
  fw: 800,
1709
1740
  fz: { base: "20px", md: "35px" },
1710
1741
  style: { textAlign: "center", letterSpacing: "-1px" },
1711
1742
  mt: "xs",
1712
- children: x().t("archbase:Redefinir senha")
1743
+ children: S().t("archbase:Redefinir senha")
1713
1744
  }
1714
1745
  ),
1715
1746
  /* @__PURE__ */ o(Ue, { m: "xs" }),
1716
1747
  /* @__PURE__ */ o(
1717
1748
  xe,
1718
1749
  {
1719
- label: x().t("archbase:Código de segurança"),
1720
- placeholder: `${x().t("archbase:Código enviado no seu e-mail")}`,
1721
- value: $ || "",
1750
+ label: S().t("archbase:Código de segurança"),
1751
+ placeholder: `${S().t("archbase:Código enviado no seu e-mail")}`,
1752
+ value: B || "",
1722
1753
  required: !0,
1723
- onChange: (B) => {
1724
- V(B.currentTarget.value), te("");
1754
+ onChange: ($) => {
1755
+ H($.currentTarget.value), re("");
1725
1756
  },
1726
- error: ee
1757
+ error: te
1727
1758
  }
1728
1759
  ),
1729
1760
  /* @__PURE__ */ o(
1730
1761
  ze,
1731
1762
  {
1732
- label: x().t("archbase:Nova senha"),
1733
- placeholder: x().t("archbase:Nova senha"),
1734
- onChange: (B) => {
1735
- b(B.currentTarget.value), g(""), K("");
1763
+ label: S().t("archbase:Nova senha"),
1764
+ placeholder: S().t("archbase:Nova senha"),
1765
+ onChange: ($) => {
1766
+ b($.currentTarget.value), g(""), K("");
1736
1767
  },
1737
1768
  value: _,
1738
1769
  required: !0,
1739
- error: se
1770
+ error: ne
1740
1771
  }
1741
1772
  ),
1742
1773
  W && /* @__PURE__ */ o(
@@ -1744,16 +1775,16 @@ function Xr({ error: r, onSendResetPasswordEmail: e, onResetPassword: t, onClick
1744
1775
  {
1745
1776
  value: _,
1746
1777
  policy: W,
1747
- showRequirements: S
1778
+ showRequirements: k
1748
1779
  }
1749
1780
  ),
1750
1781
  /* @__PURE__ */ o(
1751
1782
  ze,
1752
1783
  {
1753
- label: x().t("archbase:Confirmar senha"),
1754
- placeholder: x().t("archbase:Confirmar senha"),
1755
- onChange: (B) => {
1756
- R(B.currentTarget.value), K("");
1784
+ label: S().t("archbase:Confirmar senha"),
1785
+ placeholder: S().t("archbase:Confirmar senha"),
1786
+ onChange: ($) => {
1787
+ R($.currentTarget.value), K("");
1757
1788
  },
1758
1789
  value: m || "",
1759
1790
  required: !0,
@@ -1763,11 +1794,11 @@ function Xr({ error: r, onSendResetPasswordEmail: e, onResetPassword: t, onClick
1763
1794
  /* @__PURE__ */ o(
1764
1795
  G,
1765
1796
  {
1766
- disabled: !P || !$ || !_ || !m,
1797
+ disabled: !P || !B || !_ || !m,
1767
1798
  mt: "md",
1768
1799
  fullWidth: !0,
1769
- onClick: () => he(P, $, _, m),
1770
- children: `${x().t("archbase:Redefinir senha")}`
1800
+ onClick: () => he(P, B, _, m),
1801
+ children: `${S().t("archbase:Redefinir senha")}`
1771
1802
  }
1772
1803
  ),
1773
1804
  /* @__PURE__ */ o(
@@ -1777,34 +1808,34 @@ function Xr({ error: r, onSendResetPasswordEmail: e, onResetPassword: t, onClick
1777
1808
  fullWidth: !0,
1778
1809
  color: A === "dark" ? U.colors.dark[4] : U.colors.gray[7],
1779
1810
  onClick: () => {
1780
- N || O(!1);
1811
+ N || L(!1);
1781
1812
  },
1782
- children: `${x().t("archbase:Voltar")}`
1813
+ children: `${S().t("archbase:Voltar")}`
1783
1814
  }
1784
1815
  )
1785
- ] }) : /* @__PURE__ */ C(ie, { children: [
1816
+ ] }) : /* @__PURE__ */ C(ae, { children: [
1786
1817
  /* @__PURE__ */ o(
1787
- j,
1818
+ F,
1788
1819
  {
1789
1820
  c: "light-dark(var(--mantine-color-black), var(--mantine-color-white))",
1790
1821
  fw: 800,
1791
1822
  fz: { base: "20px", md: "35px" },
1792
1823
  style: { textAlign: "center", letterSpacing: "-1px" },
1793
1824
  mt: "xs",
1794
- children: x().t("archbase:Redefinir senha")
1825
+ children: S().t("archbase:Redefinir senha")
1795
1826
  }
1796
1827
  ),
1797
- /* @__PURE__ */ o(j, { c: "dimmed", fz: 14, style: { textAlign: "justify" }, children: i }),
1828
+ /* @__PURE__ */ o(F, { c: "dimmed", fz: 14, style: { textAlign: "justify" }, children: i }),
1798
1829
  /* @__PURE__ */ o(Ue, { m: "md" }),
1799
1830
  /* @__PURE__ */ o(
1800
1831
  xe,
1801
1832
  {
1802
1833
  label: "Email",
1803
- placeholder: `${x().t("archbase:usuario@email.com")}`,
1834
+ placeholder: `${S().t("archbase:usuario@email.com")}`,
1804
1835
  value: P || "",
1805
1836
  required: !0,
1806
- onChange: (B) => {
1807
- M(B.currentTarget.value), T("");
1837
+ onChange: ($) => {
1838
+ M($.currentTarget.value), T("");
1808
1839
  },
1809
1840
  error: N
1810
1841
  }
@@ -1816,7 +1847,7 @@ function Xr({ error: r, onSendResetPasswordEmail: e, onResetPassword: t, onClick
1816
1847
  mt: "md",
1817
1848
  fullWidth: !0,
1818
1849
  onClick: () => we(P),
1819
- children: `${x().t("archbase:Enviar")}`
1850
+ children: `${S().t("archbase:Enviar")}`
1820
1851
  }
1821
1852
  ),
1822
1853
  /* @__PURE__ */ o(
@@ -1826,11 +1857,11 @@ function Xr({ error: r, onSendResetPasswordEmail: e, onResetPassword: t, onClick
1826
1857
  fullWidth: !0,
1827
1858
  color: A === "dark" ? U.colors.dark[4] : U.colors.gray[7],
1828
1859
  onClick: () => s && s(),
1829
- children: `${x().t("archbase:Voltar")}`
1860
+ children: `${S().t("archbase:Voltar")}`
1830
1861
  }
1831
1862
  )
1832
1863
  ] }),
1833
- w ? /* @__PURE__ */ o(j, { c: "red", style: { textAlign: "justify" }, children: w }) : null
1864
+ w ? /* @__PURE__ */ o(F, { c: "red", style: { textAlign: "justify" }, children: w }) : null
1834
1865
  ]
1835
1866
  }
1836
1867
  );
@@ -1845,14 +1876,14 @@ const Ir = () => Kt().user, Mt = "archbaseSecurityManagerStore", Qr = ({ resourc
1845
1876
  if (h && h.isAdmin === a)
1846
1877
  return h;
1847
1878
  }
1848
- const S = new vt(r, e, a);
1849
- return s && c && s.setValue(y, S), S;
1879
+ const k = new vt(r, e, a);
1880
+ return s && c && s.setValue(y, k), k;
1850
1881
  }, [t, r, e, a, c]);
1851
1882
  return X(() => {
1852
1883
  i.current = c;
1853
1884
  }, [c]), { securityManager: d };
1854
1885
  };
1855
- function Le(r) {
1886
+ function Oe(r) {
1856
1887
  const e = r?.response?.data ?? r?.data ?? r;
1857
1888
  return e?.error === "CREDENTIALS_EXPIRED" || e?.requirePasswordChange === !0;
1858
1889
  }
@@ -1866,7 +1897,7 @@ const Zr = ({
1866
1897
  (u) => u.get(Y.TokenManager)
1867
1898
  ), s = De(
1868
1899
  (u) => u.get(Y.Authenticator)
1869
- ), [n, a] = p(null), [c, i] = p(!1), [d, y] = p(!0), [S, h] = p(!1), [U, A] = p(!1), [w, E] = p(""), [P, M] = p(""), [$, V] = p(null), [_, b] = p(!1), [m, R] = p(!1), [H, O] = p(null), N = lt(Mt), T = {
1900
+ ), [n, a] = p(null), [c, i] = p(!1), [d, y] = p(!0), [k, h] = p(!1), [U, A] = p(!1), [w, x] = p(""), [P, M] = p(""), [B, H] = p(null), [_, b] = p(!1), [m, R] = p(!1), [V, L] = p(null), N = lt(Mt), T = {
1870
1901
  hasContextualLogin: typeof s.loginWithContext == "function",
1871
1902
  hasFlexibleLogin: typeof s.loginFlexible == "function",
1872
1903
  hasSocialLogin: typeof s.loginSocial == "function",
@@ -1880,90 +1911,90 @@ const Zr = ({
1880
1911
  if (f)
1881
1912
  try {
1882
1913
  const D = typeof f == "string" ? JSON.parse(f) : f;
1883
- V(D);
1914
+ H(D);
1884
1915
  } catch (D) {
1885
1916
  console.warn("Erro ao carregar contexto salvo:", D);
1886
1917
  }
1887
1918
  }
1888
1919
  const l = t.getToken();
1889
- l && (h(!0), E(""), A(!1), a(l)), y(!1);
1920
+ l && (h(!0), x(""), A(!1), a(l)), y(!1);
1890
1921
  }, []);
1891
- const ee = () => {
1892
- A(!1), E("");
1893
- }, te = () => {
1922
+ const te = () => {
1923
+ A(!1), x("");
1924
+ }, re = () => {
1894
1925
  R(!1);
1895
- }, se = (u) => {
1896
- i(!1), h(!1), t.clearToken(), u && t.clearUsernameAndPassword(), T.hasContextSupport && t.clearContext && t.clearContext(), M(""), V(null), E(""), A(!1), R(!1), N.clearAllValues();
1926
+ }, ne = (u) => {
1927
+ i(!1), h(!1), t.clearToken(), u && t.clearUsernameAndPassword(), T.hasContextSupport && t.clearContext && t.clearContext(), M(""), H(null), x(""), A(!1), R(!1), N.clearAllValues();
1897
1928
  }, g = async (u, l, f) => {
1898
1929
  try {
1899
1930
  i(!0), h(!1);
1900
1931
  const D = await s.login(u, l);
1901
1932
  t.saveToken(D), f && t.saveUsernameAndPassword(u, l), t.saveUsername(u), M(u), a(D), i(!1), h(!0);
1902
1933
  } catch (D) {
1903
- i(!1), h(!1), Le(D) && (M(u), R(!0)), E(oe(D)), A(!0);
1934
+ i(!1), h(!1), Oe(D) && (M(u), R(!0)), x(ie(D)), A(!0);
1904
1935
  }
1905
1936
  }, v = async (u, l = !1) => {
1906
1937
  if (!T.hasContextualLogin || !s.loginWithContext)
1907
1938
  throw new Error("Login contextual não suportado por esta implementação do ArchbaseAuthenticator");
1908
1939
  try {
1909
1940
  i(!0), h(!1);
1910
- const { context: f, user: D, ...z } = await s.loginWithContext(u);
1911
- if (z.mfa_required) {
1912
- O(z.challenge_token ?? null), b(!0), M(u.email), i(!1);
1941
+ const { context: f, user: D, ...j } = await s.loginWithContext(u);
1942
+ if (j.mfa_required) {
1943
+ L(j.challenge_token ?? null), b(!0), M(u.email), i(!1);
1913
1944
  return;
1914
1945
  }
1915
1946
  const Ae = {
1916
1947
  scope: "",
1917
- ext_expires_in: z.expires_in,
1918
- ...z
1948
+ ext_expires_in: j.expires_in,
1949
+ ...j
1919
1950
  };
1920
- t.saveToken(Ae), l ? t.saveUsernameAndPassword(u.email, u.password) : t.clearUsernameAndPassword(), t.saveUsername(u.email), T.hasContextSupport && t.saveContext && f && (t.saveContext(JSON.stringify(f)), V(f)), M(u.email), a(Ae), i(!1), h(!0);
1951
+ t.saveToken(Ae), l ? t.saveUsernameAndPassword(u.email, u.password) : t.clearUsernameAndPassword(), t.saveUsername(u.email), T.hasContextSupport && t.saveContext && f && (t.saveContext(JSON.stringify(f)), H(f)), M(u.email), a(Ae), i(!1), h(!0);
1921
1952
  } catch (f) {
1922
- throw i(!1), h(!1), Le(f) && (M(u.email), R(!0)), E(oe(f)), A(!0), f;
1953
+ throw i(!1), h(!1), Oe(f) && (M(u.email), R(!0)), x(ie(f)), A(!0), f;
1923
1954
  }
1924
1955
  }, K = async (u) => {
1925
1956
  if (!s.verifyMfa)
1926
1957
  throw new Error("verifyMfa não suportado por esta implementação do ArchbaseAuthenticator");
1927
- if (!H)
1958
+ if (!V)
1928
1959
  throw new Error("Nenhum desafio de MFA pendente");
1929
1960
  try {
1930
- i(!0), E(""), A(!1);
1931
- const l = await s.verifyMfa(H, u);
1932
- t.saveToken(l), t.saveUsername(P), a(l), b(!1), O(null), i(!1), h(!0);
1961
+ i(!0), x(""), A(!1);
1962
+ const l = await s.verifyMfa(V, u);
1963
+ t.saveToken(l), t.saveUsername(P), a(l), b(!1), L(null), i(!1), h(!0);
1933
1964
  } catch (l) {
1934
- throw i(!1), E(oe(l)), A(!0), l;
1965
+ throw i(!1), x(ie(l)), A(!0), l;
1935
1966
  }
1936
1967
  }, W = () => {
1937
- b(!1), O(null), E(""), A(!1);
1968
+ b(!1), L(null), x(""), A(!1);
1938
1969
  }, we = async (u, l = !1) => {
1939
1970
  if (!T.hasFlexibleLogin || !s.loginFlexible)
1940
1971
  throw new Error("Login flexível não suportado por esta implementação do ArchbaseAuthenticator");
1941
1972
  try {
1942
1973
  i(!0), h(!1);
1943
- const { context: f, user: D, ...z } = await s.loginFlexible(u), Ae = {
1974
+ const { context: f, user: D, ...j } = await s.loginFlexible(u), Ae = {
1944
1975
  scope: "",
1945
- ext_expires_in: z.expires_in,
1946
- ...z
1976
+ ext_expires_in: j.expires_in,
1977
+ ...j
1947
1978
  };
1948
- t.saveToken(Ae), l && t.saveUsernameAndPassword(u.identifier, u.password), t.saveUsername(D.email || u.identifier), T.hasContextSupport && t.saveContext && f && (t.saveContext(JSON.stringify(f)), V(f)), M(D.email || u.identifier), a(Ae), i(!1), h(!0);
1979
+ t.saveToken(Ae), l && t.saveUsernameAndPassword(u.identifier, u.password), t.saveUsername(D.email || u.identifier), T.hasContextSupport && t.saveContext && f && (t.saveContext(JSON.stringify(f)), H(f)), M(D.email || u.identifier), a(Ae), i(!1), h(!0);
1949
1980
  } catch (f) {
1950
- throw i(!1), h(!1), Le(f) && (M(u.identifier), R(!0)), E(oe(f)), A(!0), f;
1981
+ throw i(!1), h(!1), Oe(f) && (M(u.identifier), R(!0)), x(ie(f)), A(!0), f;
1951
1982
  }
1952
1983
  }, he = async (u) => {
1953
1984
  if (!T.hasSocialLogin || !s.loginSocial)
1954
1985
  throw new Error("Login social não suportado por esta implementação do ArchbaseAuthenticator");
1955
1986
  try {
1956
1987
  i(!0), h(!1);
1957
- const { context: l, user: f, ...D } = await s.loginSocial(u), z = {
1988
+ const { context: l, user: f, ...D } = await s.loginSocial(u), j = {
1958
1989
  scope: "",
1959
1990
  ext_expires_in: D.expires_in,
1960
1991
  ...D
1961
1992
  };
1962
- t.saveToken(z), t.saveUsername(f.email), T.hasContextSupport && t.saveContext && l && (t.saveContext(JSON.stringify(l)), V(l)), M(f.email), a(z), i(!1), h(!0);
1993
+ t.saveToken(j), t.saveUsername(f.email), T.hasContextSupport && t.saveContext && l && (t.saveContext(JSON.stringify(l)), H(l)), M(f.email), a(j), i(!1), h(!0);
1963
1994
  } catch (l) {
1964
- throw i(!1), h(!1), E(oe(l)), A(!0), l;
1995
+ throw i(!1), h(!1), x(ie(l)), A(!0), l;
1965
1996
  }
1966
- }, B = async (u) => {
1997
+ }, $ = async (u) => {
1967
1998
  if (!T.hasRegistration || !s.register)
1968
1999
  throw new Error("Registro não suportado por esta implementação do ArchbaseAuthenticator");
1969
2000
  try {
@@ -1971,9 +2002,9 @@ const Zr = ({
1971
2002
  const l = await s.register(u);
1972
2003
  return i(!1), l;
1973
2004
  } catch (l) {
1974
- throw i(!1), E(oe(l)), A(!0), l;
2005
+ throw i(!1), x(ie(l)), A(!0), l;
1975
2006
  }
1976
- }, ce = async () => s.getSupportedContexts ? await s.getSupportedContexts() : { supportedContexts: ["DEFAULT"], defaultContext: "DEFAULT" }, ne = async (u) => s.validateContext ? await s.validateContext(u) : { context: u, supported: u === "DEFAULT" };
2007
+ }, ce = async () => s.getSupportedContexts ? await s.getSupportedContexts() : { supportedContexts: ["DEFAULT"], defaultContext: "DEFAULT" }, oe = async (u) => s.validateContext ? await s.validateContext(u) : { context: u, supported: u === "DEFAULT" };
1977
2008
  X(() => {
1978
2009
  const u = setInterval(() => {
1979
2010
  n && n.access_token && t.isTokenExpired(n, e) && be();
@@ -1988,37 +2019,37 @@ const Zr = ({
1988
2019
  const u = await s.refreshToken(n?.refresh_token);
1989
2020
  t.saveToken(u), a(u);
1990
2021
  } catch (u) {
1991
- console.error("Erro ao renovar o token:", u), se();
2022
+ console.error("Erro ao renovar o token:", u), ne();
1992
2023
  }
1993
2024
  };
1994
2025
  return {
1995
2026
  // Métodos básicos (compatibilidade)
1996
2027
  login: g,
1997
- logout: se,
2028
+ logout: ne,
1998
2029
  username: P,
1999
- isAuthenticated: S,
2030
+ isAuthenticated: k,
2000
2031
  isAuthenticating: c,
2001
2032
  isInitializing: d,
2002
2033
  isError: U,
2003
2034
  error: w,
2004
- clearError: ee,
2035
+ clearError: te,
2005
2036
  accessToken: n ? n.access_token : null,
2006
2037
  // Métodos opcionais para autenticação avançada
2007
2038
  loginWithContext: T.hasContextualLogin ? v : void 0,
2008
2039
  loginFlexible: T.hasFlexibleLogin ? we : void 0,
2009
2040
  loginSocial: T.hasSocialLogin ? he : void 0,
2010
- register: T.hasRegistration ? B : void 0,
2041
+ register: T.hasRegistration ? $ : void 0,
2011
2042
  getSupportedContexts: ce,
2012
- validateContext: ne,
2043
+ validateContext: oe,
2013
2044
  // MFA / segundo fator (2 passos)
2014
2045
  mfaRequired: _,
2015
2046
  verifyMfa: typeof s.verifyMfa == "function" ? K : void 0,
2016
2047
  cancelMfa: W,
2017
2048
  // Troca de senha obrigatória (CREDENTIALS_EXPIRED)
2018
2049
  passwordChangeRequired: m,
2019
- clearPasswordChangeRequired: te,
2050
+ clearPasswordChangeRequired: re,
2020
2051
  // Informações de contexto
2021
- context: $,
2052
+ context: B,
2022
2053
  // Detecção de capacidades
2023
2054
  capabilities: T
2024
2055
  };
@@ -2041,14 +2072,14 @@ const Zr = ({
2041
2072
  try {
2042
2073
  return await r.sendResetPasswordEmail(d);
2043
2074
  } catch (y) {
2044
- throw n(oe(y)), t(!0), y;
2075
+ throw n(ie(y)), t(!0), y;
2045
2076
  }
2046
2077
  },
2047
- resetPassword: async (d, y, S) => {
2078
+ resetPassword: async (d, y, k) => {
2048
2079
  try {
2049
- return await r.resetPassword(d, y, S);
2080
+ return await r.resetPassword(d, y, k);
2050
2081
  } catch (h) {
2051
- throw n(oe(h)), t(!0), h;
2082
+ throw n(ie(h)), t(!0), h;
2052
2083
  }
2053
2084
  },
2054
2085
  isError: e,
@@ -2060,7 +2091,7 @@ const Zr = ({
2060
2091
  }, Cr = () => /* @__PURE__ */ o(tr, { p: "xl", style: { width: "100%", height: "100%" }, children: /* @__PURE__ */ C(Ee, { gap: "md", children: [
2061
2092
  /* @__PURE__ */ C(ue, { gap: "sm", children: [
2062
2093
  /* @__PURE__ */ o(dt, { size: "sm" }),
2063
- /* @__PURE__ */ o(j, { size: "sm", c: "dimmed", children: "Carregando permissões..." })
2094
+ /* @__PURE__ */ o(F, { size: "sm", c: "dimmed", children: "Carregando permissões..." })
2064
2095
  ] }),
2065
2096
  /* @__PURE__ */ o(Ce, { height: 40, radius: "sm" }),
2066
2097
  /* @__PURE__ */ o(Ce, { height: 200, radius: "sm" }),
@@ -2068,25 +2099,25 @@ const Zr = ({
2068
2099
  /* @__PURE__ */ o(Ce, { height: 36, width: 100, radius: "sm" }),
2069
2100
  /* @__PURE__ */ o(Ce, { height: 36, width: 100, radius: "sm" })
2070
2101
  ] })
2071
- ] }) }), Ye = Ve(null), rs = ({
2102
+ ] }) }), Ye = He(null), rs = ({
2072
2103
  children: r,
2073
2104
  user: e,
2074
2105
  onError: t
2075
2106
  }) => {
2076
- const [s, n] = p(!1), [a, c] = p(null), [i] = p([]), d = e?.isAdministrator || !1, y = Ie((w) => d ? !0 : i.includes(w), [i, d]), S = Ie((w) => d ? !0 : w.some((E) => i.includes(E)), [i, d]), h = Ie((w) => d ? !0 : w.every((E) => i.includes(E)), [i, d]), U = Ie((w) => {
2107
+ const [s, n] = p(!1), [a, c] = p(null), [i] = p([]), d = e?.isAdministrator || !1, y = Ie((w) => d ? !0 : i.includes(w), [i, d]), k = Ie((w) => d ? !0 : w.some((x) => i.includes(x)), [i, d]), h = Ie((w) => d ? !0 : w.every((x) => i.includes(x)), [i, d]), U = Ie((w) => {
2077
2108
  c(w), w && t && t(w);
2078
2109
  }, [t]), A = {
2079
2110
  user: e,
2080
2111
  isLoading: s,
2081
2112
  hasGlobalPermission: y,
2082
- hasAnyGlobalPermission: S,
2113
+ hasAnyGlobalPermission: k,
2083
2114
  hasAllGlobalPermissions: h,
2084
2115
  isAdmin: d,
2085
2116
  error: a,
2086
2117
  setError: U
2087
2118
  };
2088
2119
  return /* @__PURE__ */ o(Ye.Provider, { value: A, children: r });
2089
- }, Nt = Ve(null), Pr = ({
2120
+ }, Nt = He(null), Pr = ({
2090
2121
  children: r,
2091
2122
  resourceName: e,
2092
2123
  resourceDescription: t,
@@ -2096,16 +2127,16 @@ const Zr = ({
2096
2127
  onSecurityReady: c,
2097
2128
  onError: i
2098
2129
  }) => {
2099
- const d = He(Ye);
2130
+ const d = Ve(Ye);
2100
2131
  if (!d)
2101
2132
  throw new Error("ArchbaseViewSecurityProvider deve ser usado dentro de um ArchbaseSecurityProvider");
2102
- const { user: y, isAdmin: S } = d, [h, U] = p(null), [A, w] = p(!0), [E, P] = p(null);
2133
+ const { user: y, isAdmin: k } = d, [h, U] = p(null), [A, w] = p(!0), [x, P] = p(null);
2103
2134
  if (it.useEffect(() => {
2104
2135
  if (!y) {
2105
2136
  w(!1);
2106
2137
  return;
2107
2138
  }
2108
- const m = new vt(e, t, S);
2139
+ const m = new vt(e, t, k);
2109
2140
  (async () => {
2110
2141
  w(!0);
2111
2142
  try {
@@ -2113,16 +2144,16 @@ const Zr = ({
2113
2144
  U(m), w(!1), c && c(m);
2114
2145
  });
2115
2146
  } catch {
2116
- const O = m.getError() || "Erro ao carregar permissões";
2117
- P(O), w(!1), i && i(O);
2147
+ const L = m.getError() || "Erro ao carregar permissões";
2148
+ P(L), w(!1), i && i(L);
2118
2149
  }
2119
2150
  })();
2120
- }, [e, t, y, S, c, i]), A)
2121
- return a ? /* @__PURE__ */ o(ie, { children: a }) : /* @__PURE__ */ o(Cr, {});
2122
- if (E)
2151
+ }, [e, t, y, k, c, i]), A)
2152
+ return a ? /* @__PURE__ */ o(ae, { children: a }) : /* @__PURE__ */ o(Cr, {});
2153
+ if (x)
2123
2154
  return /* @__PURE__ */ o("div", { className: "archbase-security-error", children: /* @__PURE__ */ C("div", { children: [
2124
2155
  "Erro ao carregar permissões: ",
2125
- E
2156
+ x
2126
2157
  ] }) });
2127
2158
  if (!y)
2128
2159
  return n || /* @__PURE__ */ o("div", { className: "archbase-security-no-user", children: /* @__PURE__ */ o("div", { children: "É necessário fazer login para acessar esta área" }) });
@@ -2145,16 +2176,16 @@ const Zr = ({
2145
2176
  h?.registerAction(m, R);
2146
2177
  },
2147
2178
  isLoading: A,
2148
- error: E
2179
+ error: x
2149
2180
  };
2150
2181
  return /* @__PURE__ */ o(Nt.Provider, { value: b, children: r });
2151
2182
  }, Tr = () => {
2152
- const r = He(Ye);
2183
+ const r = Ve(Ye);
2153
2184
  if (!r)
2154
2185
  throw new Error("useArchbaseSecurity deve ser usado dentro de um ArchbaseSecurityProvider");
2155
2186
  return r;
2156
2187
  }, Xe = () => {
2157
- const r = He(Nt);
2188
+ const r = Ve(Nt);
2158
2189
  if (!r)
2159
2190
  throw new Error("useArchbaseViewSecurity deve ser usado dentro de um ArchbaseViewSecurityProvider");
2160
2191
  return r;
@@ -2184,7 +2215,7 @@ const Zr = ({
2184
2215
  checkAll: r.hasAllPermissions,
2185
2216
  isAdmin: Tr().isAdmin
2186
2217
  };
2187
- }, Bt = ({
2218
+ }, $t = ({
2188
2219
  children: r,
2189
2220
  actionName: e,
2190
2221
  requiredPermissions: t = [],
@@ -2193,12 +2224,12 @@ const Zr = ({
2193
2224
  fallback: a = null,
2194
2225
  autoRegister: c = !0
2195
2226
  }) => {
2196
- const { hasPermission: i, hasAnyPermission: d, hasAllPermissions: y, registerAction: S } = Xe();
2227
+ const { hasPermission: i, hasAnyPermission: d, hasAllPermissions: y, registerAction: k } = Xe();
2197
2228
  X(() => {
2198
- c && e && n && S(e, n);
2199
- }, [e, n, c, S]);
2229
+ c && e && n && k(e, n);
2230
+ }, [e, n, c, k]);
2200
2231
  let h = !1;
2201
- return e ? h = i(e) : t.length > 0 ? h = s ? y(t) : d(t) : h = !0, h ? /* @__PURE__ */ o(ie, { children: r }) : /* @__PURE__ */ o(ie, { children: a });
2232
+ return e ? h = i(e) : t.length > 0 ? h = s ? y(t) : d(t) : h = !0, h ? /* @__PURE__ */ o(ae, { children: r }) : /* @__PURE__ */ o(ae, { children: a });
2202
2233
  }, os = ({
2203
2234
  actionName: r,
2204
2235
  actionDescription: e,
@@ -2211,7 +2242,7 @@ const Zr = ({
2211
2242
  size: d = "medium",
2212
2243
  type: y = "button"
2213
2244
  }) => {
2214
- const S = () => {
2245
+ const k = () => {
2215
2246
  const U = "archbase-secure-btn", A = `archbase-secure-btn--${i}`, w = `archbase-secure-btn--${d}`;
2216
2247
  return `${U} ${A} ${w} ${a}`.trim();
2217
2248
  }, h = () => {
@@ -2238,7 +2269,7 @@ const Zr = ({
2238
2269
  };
2239
2270
  };
2240
2271
  return /* @__PURE__ */ o(
2241
- Bt,
2272
+ $t,
2242
2273
  {
2243
2274
  actionName: r,
2244
2275
  actionDescription: e,
@@ -2249,7 +2280,7 @@ const Zr = ({
2249
2280
  type: y,
2250
2281
  onClick: s,
2251
2282
  disabled: n,
2252
- className: S(),
2283
+ className: k(),
2253
2284
  style: h(),
2254
2285
  children: t
2255
2286
  }
@@ -2265,7 +2296,7 @@ const Zr = ({
2265
2296
  fallbackText: a = "Campo não disponível",
2266
2297
  fallbackComponent: c
2267
2298
  }) => e ? /* @__PURE__ */ o(
2268
- Bt,
2299
+ $t,
2269
2300
  {
2270
2301
  actionName: e,
2271
2302
  actionDescription: t,
@@ -2285,7 +2316,7 @@ const Zr = ({
2285
2316
  ] }),
2286
2317
  children: r
2287
2318
  }
2288
- ) : /* @__PURE__ */ o(ie, { children: r });
2319
+ ) : /* @__PURE__ */ o(ae, { children: r });
2289
2320
  function as(r, e) {
2290
2321
  return function(s) {
2291
2322
  const { resourceName: n, resourceDescription: a, requiredPermissions: c, fallbackComponent: i } = e;
@@ -2306,7 +2337,7 @@ export {
2306
2337
  xr as AccessIntervalDto,
2307
2338
  At as AccessScheduleDto,
2308
2339
  qe as AccessTokenDto,
2309
- kr as ActionDto,
2340
+ Sr as ActionDto,
2310
2341
  Ke as ApiTokenDto,
2311
2342
  Dt as ArchbaseAccessTokenService,
2312
2343
  Ut as ArchbaseApiTokenService,
@@ -2316,7 +2347,7 @@ export {
2316
2347
  qr as ArchbaseLogin,
2317
2348
  Yr as ArchbaseMfaSetup,
2318
2349
  Tt as ArchbaseProfileService,
2319
- Bt as ArchbaseProtectedComponent,
2350
+ $t as ArchbaseProtectedComponent,
2320
2351
  Xr as ArchbaseResetPassword,
2321
2352
  _t as ArchbaseResourceService,
2322
2353
  os as ArchbaseSecureActionButton,
@@ -2330,21 +2361,21 @@ export {
2330
2361
  pt as ArchbaseUsernameAndPassword,
2331
2362
  pt as ArchbaseUsernameAndPasswordImpl,
2332
2363
  Pr as ArchbaseViewSecurityProvider,
2333
- Oe as CONTEXT_STORAGE_KEY,
2364
+ Le as CONTEXT_STORAGE_KEY,
2334
2365
  or as DefaultArchbaseTokenManager,
2335
2366
  Cr as DefaultSecurityLoading,
2336
2367
  le as ENCRYPTION_KEY,
2337
2368
  mt as FetchError,
2338
- Se as GroupDto,
2369
+ ke as GroupDto,
2339
2370
  Kr as PermissionDto,
2340
- ke as ProfileDto,
2341
- St as ResourceDto,
2371
+ Se as ProfileDto,
2372
+ kt as ResourceDto,
2342
2373
  ye as SecurityDto,
2343
2374
  me as SecurityType,
2344
2375
  Ne as TOKEN_COOKIE_NAME,
2345
2376
  Er as TipoRecurso,
2346
- $e as USER_NAME,
2347
- Be as USER_NAME_AND_PASSWORD,
2377
+ Be as USER_NAME,
2378
+ $e as USER_NAME_AND_PASSWORD,
2348
2379
  Me as UserDto,
2349
2380
  Ge as UserGroupDto,
2350
2381
  gr as createInternalConfig,
@@ -2357,7 +2388,7 @@ export {
2357
2388
  ir as generateRandomString,
2358
2389
  ft as getRandomInteger,
2359
2390
  wr as getRefreshExpiresIn,
2360
- Le as isCredentialsExpiredError,
2391
+ Oe as isCredentialsExpiredError,
2361
2392
  lr as postWithXForm,
2362
2393
  dr as redirectToLogin,
2363
2394
  fr as redirectToLogout,