@oondemand/oon-core-front 0.3.75 → 0.4.0

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
@@ -7,7 +7,7 @@ import { StrictMode } from "react";
7
7
  import { createRoot } from "react-dom/client";
8
8
 
9
9
  // src/app/OonApp.tsx
10
- import { useMemo as useMemo9 } from "react";
10
+ import { useMemo as useMemo10 } from "react";
11
11
  import { RouterProvider } from "react-router-dom";
12
12
 
13
13
  // src/api/createRestClient.ts
@@ -78,7 +78,7 @@ function codeFromStatus(status) {
78
78
 
79
79
  // src/api/createRestClient.ts
80
80
  function createRestClient(deps) {
81
- const { api, getToken, onUnauthorized, appId } = deps;
81
+ const { api, getToken, getTenantId, onUnauthorized, appId } = deps;
82
82
  const prefix = api.versionPrefix ?? "";
83
83
  const instance = axios2.create({
84
84
  baseURL: `${api.baseUrl.replace(/\/$/, "")}${prefix}`,
@@ -89,6 +89,9 @@ function createRestClient(deps) {
89
89
  if (token && !config.headers.Authorization) {
90
90
  config.headers.Authorization = `Bearer ${token}`;
91
91
  }
92
+ const tenantId = getTenantId?.();
93
+ if (tenantId) config.headers["x-oon-tenant-id"] = tenantId;
94
+ else delete config.headers["x-oon-tenant-id"];
92
95
  if (appId) config.headers["x-oon-app"] = appId;
93
96
  return config;
94
97
  });
@@ -152,6 +155,33 @@ function captureTokenFromUrl(tokenParam = "code") {
152
155
  }
153
156
  }
154
157
 
158
+ // src/security/tenantStorage.ts
159
+ function normalize(value2) {
160
+ const normalized2 = String(value2 ?? "").trim();
161
+ return normalized2 || null;
162
+ }
163
+ function createTenantStorage(appId) {
164
+ const key = `oon:${appId}:tenant`;
165
+ return {
166
+ get() {
167
+ if (typeof window === "undefined") return null;
168
+ return normalize(window.localStorage.getItem(key));
169
+ },
170
+ set(tenantId) {
171
+ if (typeof window === "undefined") return;
172
+ const value2 = normalize(tenantId);
173
+ if (!value2) {
174
+ window.localStorage.removeItem(key);
175
+ return;
176
+ }
177
+ window.localStorage.setItem(key, value2);
178
+ },
179
+ clear() {
180
+ if (typeof window !== "undefined") window.localStorage.removeItem(key);
181
+ }
182
+ };
183
+ }
184
+
155
185
  // src/security/AcceptInviteCentralPage.tsx
156
186
  import { useEffect as useEffect2, useState as useState2 } from "react";
157
187
  import { Box as Box2, Text as Text2 } from "@chakra-ui/react";
@@ -404,7 +434,7 @@ function AcceptInviteCentralPage() {
404
434
  }
405
435
 
406
436
  // src/app/OonProviders.tsx
407
- import { useMemo as useMemo2 } from "react";
437
+ import { useMemo as useMemo3 } from "react";
408
438
  import { ChakraProvider } from "@chakra-ui/react";
409
439
  import { QueryClientProvider } from "@tanstack/react-query";
410
440
 
@@ -753,19 +783,78 @@ function useOonAuth() {
753
783
  return context;
754
784
  }
755
785
 
756
- // src/app/OonProviders.tsx
786
+ // src/security/TenantProvider.tsx
787
+ import {
788
+ createContext as createContext4,
789
+ useCallback as useCallback3,
790
+ useContext as useContext4,
791
+ useMemo as useMemo2,
792
+ useState as useState5
793
+ } from "react";
794
+ import { useQueryClient } from "@tanstack/react-query";
757
795
  import { jsx as jsx6 } from "react/jsx-runtime";
758
- function OonProviders({ config, http, storage, children }) {
759
- const queryClient = useMemo2(() => createOonQueryClient(), []);
760
- const system = useMemo2(() => createOonSystem(config.theme), [config.theme]);
796
+ var TenantContext = createContext4(null);
797
+ function applyHeader(http, tenantId) {
798
+ if (tenantId) {
799
+ http.defaults.headers.common["x-oon-tenant-id"] = tenantId;
800
+ return;
801
+ }
802
+ delete http.defaults.headers.common["x-oon-tenant-id"];
803
+ }
804
+ function TenantProvider({ http, storage, children }) {
805
+ const queryClient = useQueryClient();
806
+ const [activeTenantId, setActiveTenantId] = useState5(() => storage.get());
807
+ const replaceTenant = useCallback3(
808
+ (tenantId) => {
809
+ const normalized2 = String(tenantId ?? "").trim() || null;
810
+ if (normalized2) storage.set(normalized2);
811
+ else storage.clear();
812
+ applyHeader(http, normalized2);
813
+ setActiveTenantId(normalized2);
814
+ queryClient.clear();
815
+ },
816
+ [http, queryClient, storage]
817
+ );
818
+ const value2 = useMemo2(
819
+ () => ({
820
+ activeTenantId,
821
+ switchTenant(tenantId) {
822
+ if (!tenantId?.trim()) throw new Error("tenantId \xE9 obrigat\xF3rio.");
823
+ replaceTenant(tenantId);
824
+ },
825
+ clearTenant() {
826
+ replaceTenant(null);
827
+ }
828
+ }),
829
+ [activeTenantId, replaceTenant]
830
+ );
831
+ return /* @__PURE__ */ jsx6(TenantContext.Provider, { value: value2, children });
832
+ }
833
+ function useOonTenant() {
834
+ const value2 = useContext4(TenantContext);
835
+ if (!value2) throw new Error("useOonTenant deve ser usado dentro de TenantProvider.");
836
+ return value2;
837
+ }
838
+
839
+ // src/app/OonProviders.tsx
840
+ import { jsx as jsx7 } from "react/jsx-runtime";
841
+ function OonProviders({
842
+ config,
843
+ http,
844
+ storage,
845
+ tenantStorage,
846
+ children
847
+ }) {
848
+ const queryClient = useMemo3(() => createOonQueryClient(), []);
849
+ const system = useMemo3(() => createOonSystem(config.theme), [config.theme]);
761
850
  const loginUrl = config.auth?.loginUrl ?? config.api.meusAppsUrl;
762
- return /* @__PURE__ */ jsx6(QueryClientProvider, { client: queryClient, children: /* @__PURE__ */ jsx6(ChakraProvider, { value: system, children: /* @__PURE__ */ jsx6(ApiProvider, { http, children: /* @__PURE__ */ jsx6(ActivationProvider, { http, children: /* @__PURE__ */ jsx6(AuthProvider, { http, storage, auth: config.auth, loginUrl, children }) }) }) }) });
851
+ return /* @__PURE__ */ jsx7(QueryClientProvider, { client: queryClient, children: /* @__PURE__ */ jsx7(ChakraProvider, { value: system, children: /* @__PURE__ */ jsx7(ApiProvider, { http, children: /* @__PURE__ */ jsx7(ActivationProvider, { http, children: /* @__PURE__ */ jsx7(TenantProvider, { http, storage: tenantStorage, children: /* @__PURE__ */ jsx7(AuthProvider, { http, storage, auth: config.auth, loginUrl, children }) }) }) }) }) });
763
852
  }
764
853
 
765
854
  // src/components/CoreCollection.tsx
766
- import { useState as useState12 } from "react";
855
+ import { useState as useState13 } from "react";
767
856
  import { Box as Box13, Heading as Heading5, Stack as Stack4, Text as Text14 } from "@chakra-ui/react";
768
- import { useMutation as useMutation2, useQueryClient as useQueryClient3 } from "@tanstack/react-query";
857
+ import { useMutation as useMutation2, useQueryClient as useQueryClient4 } from "@tanstack/react-query";
769
858
 
770
859
  // src/components/internal/referenceUtils.ts
771
860
  var COMMON_LABEL_FIELDS = [
@@ -892,35 +981,35 @@ function formatCell(value2, kind) {
892
981
  }
893
982
 
894
983
  // src/components/internal/DataGrid.tsx
895
- import { useDeferredValue, useState as useState5 } from "react";
984
+ import { useDeferredValue, useState as useState6 } from "react";
896
985
  import { Badge, Box as Box4, Button as Button3, Flex as Flex3, Input as Input2, NativeSelect, Spacer, Table, Text as Text5 } from "@chakra-ui/react";
897
986
  import { keepPreviousData, useQuery as useQuery2 } from "@tanstack/react-query";
898
987
 
899
988
  // src/shell/LoadingScreen.tsx
900
989
  import { Button as Button2, Flex as Flex2, Spinner, Text as Text3 } from "@chakra-ui/react";
901
- import { jsx as jsx7, jsxs as jsxs3 } from "react/jsx-runtime";
990
+ import { jsx as jsx8, jsxs as jsxs3 } from "react/jsx-runtime";
902
991
  function LoadingScreen({
903
992
  message,
904
993
  actionLabel,
905
994
  onAction
906
995
  }) {
907
996
  return /* @__PURE__ */ jsxs3(Flex2, { direction: "column", align: "center", justify: "center", minH: "60vh", gap: 4, children: [
908
- /* @__PURE__ */ jsx7(Spinner, { size: "lg" }),
909
- message ? /* @__PURE__ */ jsx7(Text3, { color: "gray.500", fontSize: "sm", textAlign: "center", children: message }) : null,
910
- actionLabel && onAction ? /* @__PURE__ */ jsx7(Button2, { size: "sm", variant: "outline", onClick: onAction, children: actionLabel }) : null
997
+ /* @__PURE__ */ jsx8(Spinner, { size: "lg" }),
998
+ message ? /* @__PURE__ */ jsx8(Text3, { color: "gray.500", fontSize: "sm", textAlign: "center", children: message }) : null,
999
+ actionLabel && onAction ? /* @__PURE__ */ jsx8(Button2, { size: "sm", variant: "outline", onClick: onAction, children: actionLabel }) : null
911
1000
  ] });
912
1001
  }
913
1002
 
914
1003
  // src/shell/ErrorState.tsx
915
1004
  import { Box as Box3, Heading as Heading2, Text as Text4 } from "@chakra-ui/react";
916
- import { jsx as jsx8, jsxs as jsxs4 } from "react/jsx-runtime";
1005
+ import { jsx as jsx9, jsxs as jsxs4 } from "react/jsx-runtime";
917
1006
  function ErrorState({
918
1007
  error,
919
1008
  title = "N\xE3o foi poss\xEDvel carregar"
920
1009
  }) {
921
1010
  return /* @__PURE__ */ jsxs4(Box3, { borderWidth: "1px", borderColor: "red.200", bg: "red.50", borderRadius: "md", p: 4, children: [
922
- /* @__PURE__ */ jsx8(Heading2, { size: "sm", color: "red.700", children: title }),
923
- /* @__PURE__ */ jsx8(Text4, { mt: 1, fontSize: "sm", color: "red.600", children: error?.message ?? "Erro inesperado." }),
1011
+ /* @__PURE__ */ jsx9(Heading2, { size: "sm", color: "red.700", children: title }),
1012
+ /* @__PURE__ */ jsx9(Text4, { mt: 1, fontSize: "sm", color: "red.600", children: error?.message ?? "Erro inesperado." }),
924
1013
  error?.requestId ? /* @__PURE__ */ jsxs4(Text4, { mt: 2, fontSize: "xs", color: "red.400", children: [
925
1014
  "requestId: ",
926
1015
  error.requestId
@@ -929,48 +1018,48 @@ function ErrorState({
929
1018
  }
930
1019
 
931
1020
  // src/components/internal/DataGrid.tsx
932
- import { jsx as jsx9, jsxs as jsxs5 } from "react/jsx-runtime";
1021
+ import { jsx as jsx10, jsxs as jsxs5 } from "react/jsx-runtime";
933
1022
  function SearchIcon() {
934
1023
  return /* @__PURE__ */ jsxs5("svg", { viewBox: "0 0 20 20", width: "17", height: "17", "aria-hidden": "true", children: [
935
- /* @__PURE__ */ jsx9("circle", { cx: "8.5", cy: "8.5", r: "5.25", fill: "none", stroke: "currentColor", strokeWidth: "1.5" }),
936
- /* @__PURE__ */ jsx9("path", { d: "m12.4 12.4 4 4", fill: "none", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round" })
1024
+ /* @__PURE__ */ jsx10("circle", { cx: "8.5", cy: "8.5", r: "5.25", fill: "none", stroke: "currentColor", strokeWidth: "1.5" }),
1025
+ /* @__PURE__ */ jsx10("path", { d: "m12.4 12.4 4 4", fill: "none", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round" })
937
1026
  ] });
938
1027
  }
939
1028
  function EditIcon() {
940
1029
  return /* @__PURE__ */ jsxs5("svg", { viewBox: "0 0 20 20", width: "15", height: "15", "aria-hidden": "true", children: [
941
- /* @__PURE__ */ jsx9("path", { d: "M4 14.5V16h1.5L14.7 6.8l-1.5-1.5L4 14.5Z", fill: "none", stroke: "currentColor", strokeWidth: "1.45", strokeLinejoin: "round" }),
942
- /* @__PURE__ */ jsx9("path", { d: "m12.5 6 1.5-1.5a1.05 1.05 0 0 1 1.5 0l.1.1a1.05 1.05 0 0 1 0 1.5L14.1 7.6", fill: "none", stroke: "currentColor", strokeWidth: "1.45", strokeLinecap: "round" })
1030
+ /* @__PURE__ */ jsx10("path", { d: "M4 14.5V16h1.5L14.7 6.8l-1.5-1.5L4 14.5Z", fill: "none", stroke: "currentColor", strokeWidth: "1.45", strokeLinejoin: "round" }),
1031
+ /* @__PURE__ */ jsx10("path", { d: "m12.5 6 1.5-1.5a1.05 1.05 0 0 1 1.5 0l.1.1a1.05 1.05 0 0 1 0 1.5L14.1 7.6", fill: "none", stroke: "currentColor", strokeWidth: "1.45", strokeLinecap: "round" })
943
1032
  ] });
944
1033
  }
945
1034
  function TrashIcon() {
946
1035
  return /* @__PURE__ */ jsxs5("svg", { viewBox: "0 0 20 20", width: "15", height: "15", "aria-hidden": "true", children: [
947
- /* @__PURE__ */ jsx9("path", { d: "M5.5 6.5h9l-.6 9H6.1l-.6-9Zm2-2h5l.7 2H6.8l.7-2Z", fill: "none", stroke: "currentColor", strokeWidth: "1.35", strokeLinejoin: "round" }),
948
- /* @__PURE__ */ jsx9("path", { d: "M4.5 6.5h11", fill: "none", stroke: "currentColor", strokeWidth: "1.35", strokeLinecap: "round" })
1036
+ /* @__PURE__ */ jsx10("path", { d: "M5.5 6.5h9l-.6 9H6.1l-.6-9Zm2-2h5l.7 2H6.8l.7-2Z", fill: "none", stroke: "currentColor", strokeWidth: "1.35", strokeLinejoin: "round" }),
1037
+ /* @__PURE__ */ jsx10("path", { d: "M4.5 6.5h11", fill: "none", stroke: "currentColor", strokeWidth: "1.35", strokeLinecap: "round" })
949
1038
  ] });
950
1039
  }
951
1040
  function ChevronIcon({ direction }) {
952
- return /* @__PURE__ */ jsx9("svg", { viewBox: "0 0 20 20", width: "17", height: "17", "aria-hidden": "true", style: { transform: direction === "right" ? "rotate(180deg)" : void 0 }, children: /* @__PURE__ */ jsx9("path", { d: "m12 5-5 5 5 5", fill: "none", stroke: "currentColor", strokeWidth: "1.6", strokeLinecap: "round", strokeLinejoin: "round" }) });
1041
+ return /* @__PURE__ */ jsx10("svg", { viewBox: "0 0 20 20", width: "17", height: "17", "aria-hidden": "true", style: { transform: direction === "right" ? "rotate(180deg)" : void 0 }, children: /* @__PURE__ */ jsx10("path", { d: "m12 5-5 5 5 5", fill: "none", stroke: "currentColor", strokeWidth: "1.6", strokeLinecap: "round", strokeLinejoin: "round" }) });
953
1042
  }
954
1043
  function PlusIcon() {
955
- return /* @__PURE__ */ jsx9("svg", { viewBox: "0 0 20 20", width: "17", height: "17", "aria-hidden": "true", children: /* @__PURE__ */ jsx9("path", { d: "M10 4v12M4 10h12", fill: "none", stroke: "currentColor", strokeWidth: "1.6", strokeLinecap: "round" }) });
1044
+ return /* @__PURE__ */ jsx10("svg", { viewBox: "0 0 20 20", width: "17", height: "17", "aria-hidden": "true", children: /* @__PURE__ */ jsx10("path", { d: "M10 4v12M4 10h12", fill: "none", stroke: "currentColor", strokeWidth: "1.6", strokeLinecap: "round" }) });
956
1045
  }
957
1046
  function renderCell(value2, kind) {
958
1047
  const formatted = formatCell(value2, kind);
959
1048
  if (kind === "enum") {
960
1049
  const normalized2 = String(value2 ?? "").toLowerCase();
961
1050
  const palette = /erro|cancel|inativo|recus|critica/.test(normalized2) ? "red" : /pendente|aguardando|rascunho/.test(normalized2) ? "orange" : /processando|conferencia|integrando|validando/.test(normalized2) ? "blue" : /ativo|sucesso|conclu|aplicada|disponivel|aprov/.test(normalized2) ? "green" : "gray";
962
- return /* @__PURE__ */ jsx9(Badge, { colorPalette: palette, variant: "subtle", borderRadius: "full", px: "7px", py: "3px", fontSize: "9px", fontWeight: "600", textTransform: "capitalize", children: formatted });
1051
+ return /* @__PURE__ */ jsx10(Badge, { colorPalette: palette, variant: "subtle", borderRadius: "full", px: "7px", py: "3px", fontSize: "9px", fontWeight: "600", textTransform: "capitalize", children: formatted });
963
1052
  }
964
1053
  if (kind === "boolean") {
965
1054
  const active = value2 === true || value2 === "true";
966
- return /* @__PURE__ */ jsx9(Badge, { colorPalette: active ? "green" : "gray", variant: "subtle", borderRadius: "full", px: "7px", py: "3px", fontSize: "9px", fontWeight: "600", children: formatted });
1055
+ return /* @__PURE__ */ jsx10(Badge, { colorPalette: active ? "green" : "gray", variant: "subtle", borderRadius: "full", px: "7px", py: "3px", fontSize: "9px", fontWeight: "600", children: formatted });
967
1056
  }
968
1057
  return formatted;
969
1058
  }
970
1059
  function renderColumnCell(row, column, cellRenderers) {
971
1060
  const value2 = row[column.field];
972
1061
  const Renderer = column.renderer ? cellRenderers?.[column.renderer] : void 0;
973
- if (Renderer) return /* @__PURE__ */ jsx9(Renderer, { value: value2, row, column });
1062
+ if (Renderer) return /* @__PURE__ */ jsx10(Renderer, { value: value2, row, column });
974
1063
  return renderCell(value2, column.kind);
975
1064
  }
976
1065
  function DataGrid({
@@ -987,12 +1076,12 @@ function DataGrid({
987
1076
  renderRowActions,
988
1077
  cellRenderers
989
1078
  }) {
990
- const [pageIndex, setPageIndex] = useState5(0);
991
- const [pageSize, setPageSize] = useState5(20);
992
- const [searchTerm, setSearchTerm] = useState5("");
1079
+ const [pageIndex, setPageIndex] = useState6(0);
1080
+ const [pageSize, setPageSize] = useState6(20);
1081
+ const [searchTerm, setSearchTerm] = useState6("");
993
1082
  const deferredSearch = useDeferredValue(searchTerm);
994
- const [sort, setSort] = useState5(void 0);
995
- const [filterValues, setFilterValues] = useState5(() => Object.fromEntries(filters.map((filter) => [filter.field, filter.defaultValue ?? ""])));
1083
+ const [sort, setSort] = useState6(void 0);
1084
+ const [filterValues, setFilterValues] = useState6(() => Object.fromEntries(filters.map((filter) => [filter.field, filter.defaultValue ?? ""])));
996
1085
  const effectiveFilters = Object.fromEntries(Object.entries({ ...queryExtra, ...filterValues }).filter(([, value2]) => value2 !== "" && value2 != null));
997
1086
  const query = useQuery2({
998
1087
  queryKey: ["oon", "list", resourceKey, { pageIndex, pageSize, searchTerm: deferredSearch, sort, filters: effectiveFilters }],
@@ -1016,8 +1105,8 @@ function DataGrid({
1016
1105
  return /* @__PURE__ */ jsxs5(Box4, { bg: "white", borderWidth: "1px", borderColor: "#E5E9ED", borderRadius: "10px", boxShadow: "0 1px 2px rgba(15,23,42,.06)", overflow: "hidden", children: [
1017
1106
  /* @__PURE__ */ jsxs5(Flex3, { minH: "60px", px: "14px", py: "12px", align: "center", gap: 4, borderBottomWidth: "1px", borderColor: "#E5E9ED", children: [
1018
1107
  search ? /* @__PURE__ */ jsxs5(Flex3, { minW: { base: "100%", md: "min(420px, 55vw)" }, maxW: "420px", h: "35px", px: "10px", align: "center", gap: 2, color: "#98A2B3", bg: "white", borderWidth: "1px", borderColor: "#D5DDE3", borderRadius: "6px", _focusWithin: { borderColor: "#0F8DD0", boxShadow: "0 0 0 3px rgba(15,141,208,.10)" }, children: [
1019
- /* @__PURE__ */ jsx9(SearchIcon, {}),
1020
- /* @__PURE__ */ jsx9(
1108
+ /* @__PURE__ */ jsx10(SearchIcon, {}),
1109
+ /* @__PURE__ */ jsx10(
1021
1110
  Input2,
1022
1111
  {
1023
1112
  value: searchTerm,
@@ -1038,19 +1127,19 @@ function DataGrid({
1038
1127
  }
1039
1128
  )
1040
1129
  ] }) : null,
1041
- /* @__PURE__ */ jsx9(Spacer, {}),
1130
+ /* @__PURE__ */ jsx10(Spacer, {}),
1042
1131
  filters.map((filter) => filter.type === "select" ? /* @__PURE__ */ jsxs5(NativeSelect.Root, { size: "xs", w: "180px", children: [
1043
- /* @__PURE__ */ jsx9(NativeSelect.Field, { value: String(filterValues[filter.field] ?? ""), onChange: (event) => {
1132
+ /* @__PURE__ */ jsx10(NativeSelect.Field, { value: String(filterValues[filter.field] ?? ""), onChange: (event) => {
1044
1133
  setFilterValues((current) => ({ ...current, [filter.field]: event.currentTarget.value }));
1045
1134
  setPageIndex(0);
1046
- }, children: (filter.options ?? []).map((option) => /* @__PURE__ */ jsx9("option", { value: String(option.value ?? ""), children: option.label }, String(option.value ?? ""))) }),
1047
- /* @__PURE__ */ jsx9(NativeSelect.Indicator, {})
1048
- ] }, filter.field) : /* @__PURE__ */ jsx9(Input2, { w: "180px", h: "35px", fontSize: "11px", placeholder: filter.placeholder ?? filter.label ?? filter.field, type: filter.type === "date" ? "date" : filter.type === "boolean" ? "text" : "text", value: String(filterValues[filter.field] ?? ""), onChange: (event) => {
1135
+ }, children: (filter.options ?? []).map((option) => /* @__PURE__ */ jsx10("option", { value: String(option.value ?? ""), children: option.label }, String(option.value ?? ""))) }),
1136
+ /* @__PURE__ */ jsx10(NativeSelect.Indicator, {})
1137
+ ] }, filter.field) : /* @__PURE__ */ jsx10(Input2, { w: "180px", h: "35px", fontSize: "11px", placeholder: filter.placeholder ?? filter.label ?? filter.field, type: filter.type === "date" ? "date" : filter.type === "boolean" ? "text" : "text", value: String(filterValues[filter.field] ?? ""), onChange: (event) => {
1049
1138
  setFilterValues((current) => ({ ...current, [filter.field]: event.currentTarget.value }));
1050
1139
  setPageIndex(0);
1051
1140
  } }, filter.field)),
1052
1141
  /* @__PURE__ */ jsxs5(Flex3, { align: "center", gap: 3, color: "#98A2B3", fontSize: "10px", children: [
1053
- query.isFetching ? /* @__PURE__ */ jsx9(Text5, { children: "Atualizando..." }) : null,
1142
+ query.isFetching ? /* @__PURE__ */ jsx10(Text5, { children: "Atualizando..." }) : null,
1054
1143
  /* @__PURE__ */ jsxs5(Text5, { as: "strong", color: "#667085", fontWeight: "600", children: [
1055
1144
  totalItems,
1056
1145
  " registro",
@@ -1059,13 +1148,13 @@ function DataGrid({
1059
1148
  ] }),
1060
1149
  toolbarExtra,
1061
1150
  onCreate ? /* @__PURE__ */ jsxs5(Button3, { minH: "35px", px: "13px", colorPalette: "brand", borderRadius: "6px", fontSize: "11px", fontWeight: "600", onClick: onCreate, children: [
1062
- /* @__PURE__ */ jsx9(PlusIcon, {}),
1151
+ /* @__PURE__ */ jsx10(PlusIcon, {}),
1063
1152
  " Novo registro"
1064
1153
  ] }) : null
1065
1154
  ] }),
1066
- query.isLoading ? /* @__PURE__ */ jsx9(LoadingScreen, {}) : query.isError ? /* @__PURE__ */ jsx9(ErrorState, { error: query.error }) : /* @__PURE__ */ jsx9(Box4, { overflowX: "auto", children: /* @__PURE__ */ jsxs5(Table.Root, { size: "sm", minW: "900px", borderCollapse: "collapse", children: [
1067
- /* @__PURE__ */ jsx9(Table.Header, { children: /* @__PURE__ */ jsxs5(Table.Row, { bg: "#F4F7F9", children: [
1068
- actionCount ? /* @__PURE__ */ jsx9(Table.ColumnHeader, { w: "84px", h: "39px", px: "10px", py: "8px", color: "#667085", borderBottomWidth: "1px", borderColor: "#D5DDE3", fontSize: "10px", fontWeight: "600", textAlign: "center", children: "A\xE7\xF5es" }) : null,
1155
+ query.isLoading ? /* @__PURE__ */ jsx10(LoadingScreen, {}) : query.isError ? /* @__PURE__ */ jsx10(ErrorState, { error: query.error }) : /* @__PURE__ */ jsx10(Box4, { overflowX: "auto", children: /* @__PURE__ */ jsxs5(Table.Root, { size: "sm", minW: "900px", borderCollapse: "collapse", children: [
1156
+ /* @__PURE__ */ jsx10(Table.Header, { children: /* @__PURE__ */ jsxs5(Table.Row, { bg: "#F4F7F9", children: [
1157
+ actionCount ? /* @__PURE__ */ jsx10(Table.ColumnHeader, { w: "84px", h: "39px", px: "10px", py: "8px", color: "#667085", borderBottomWidth: "1px", borderColor: "#D5DDE3", fontSize: "10px", fontWeight: "600", textAlign: "center", children: "A\xE7\xF5es" }) : null,
1069
1158
  columns.map((column) => /* @__PURE__ */ jsxs5(
1070
1159
  Table.ColumnHeader,
1071
1160
  {
@@ -1090,20 +1179,20 @@ function DataGrid({
1090
1179
  column.field
1091
1180
  ))
1092
1181
  ] }) }),
1093
- /* @__PURE__ */ jsx9(Table.Body, { children: rows.length === 0 ? /* @__PURE__ */ jsx9(Table.Row, { children: /* @__PURE__ */ jsx9(Table.Cell, { colSpan: columns.length + actionCount, children: /* @__PURE__ */ jsx9(Text5, { minH: "140px", display: "grid", placeItems: "center", color: "#98A2B3", fontSize: "12px", children: "Nenhum registro encontrado." }) }) }) : rows.map((row, index) => /* @__PURE__ */ jsxs5(Table.Row, { bg: index % 2 ? "#FBFCFD" : "white", _hover: { bg: "#F0F7FF" }, children: [
1094
- actionCount ? /* @__PURE__ */ jsx9(Table.Cell, { h: "42px", px: "10px", py: "5px", borderBottomWidth: "1px", borderColor: "#EEF1F3", textAlign: "center", children: /* @__PURE__ */ jsxs5(Flex3, { justify: "center", gap: "5px", children: [
1095
- onEdit ? /* @__PURE__ */ jsx9(Button3, { type: "button", "aria-label": "Editar", w: "31px", minW: "31px", h: "31px", p: 0, color: "#667085", bg: "white", borderWidth: "1px", borderColor: "#E5E9ED", borderRadius: "6px", onClick: () => onEdit(row), _hover: { color: "#036491", bg: "#F0F7FF", borderColor: "#B8D9EB" }, children: /* @__PURE__ */ jsx9(EditIcon, {}) }) : null,
1096
- onDelete ? /* @__PURE__ */ jsx9(Button3, { type: "button", "aria-label": "Excluir", w: "31px", minW: "31px", h: "31px", p: 0, color: "#667085", bg: "white", borderWidth: "1px", borderColor: "#E5E9ED", borderRadius: "6px", onClick: () => onDelete(row), _hover: { color: "#B42318", bg: "#FFF5F5", borderColor: "#FECACA" }, children: /* @__PURE__ */ jsx9(TrashIcon, {}) }) : null,
1182
+ /* @__PURE__ */ jsx10(Table.Body, { children: rows.length === 0 ? /* @__PURE__ */ jsx10(Table.Row, { children: /* @__PURE__ */ jsx10(Table.Cell, { colSpan: columns.length + actionCount, children: /* @__PURE__ */ jsx10(Text5, { minH: "140px", display: "grid", placeItems: "center", color: "#98A2B3", fontSize: "12px", children: "Nenhum registro encontrado." }) }) }) : rows.map((row, index) => /* @__PURE__ */ jsxs5(Table.Row, { bg: index % 2 ? "#FBFCFD" : "white", _hover: { bg: "#F0F7FF" }, children: [
1183
+ actionCount ? /* @__PURE__ */ jsx10(Table.Cell, { h: "42px", px: "10px", py: "5px", borderBottomWidth: "1px", borderColor: "#EEF1F3", textAlign: "center", children: /* @__PURE__ */ jsxs5(Flex3, { justify: "center", gap: "5px", children: [
1184
+ onEdit ? /* @__PURE__ */ jsx10(Button3, { type: "button", "aria-label": "Editar", w: "31px", minW: "31px", h: "31px", p: 0, color: "#667085", bg: "white", borderWidth: "1px", borderColor: "#E5E9ED", borderRadius: "6px", onClick: () => onEdit(row), _hover: { color: "#036491", bg: "#F0F7FF", borderColor: "#B8D9EB" }, children: /* @__PURE__ */ jsx10(EditIcon, {}) }) : null,
1185
+ onDelete ? /* @__PURE__ */ jsx10(Button3, { type: "button", "aria-label": "Excluir", w: "31px", minW: "31px", h: "31px", p: 0, color: "#667085", bg: "white", borderWidth: "1px", borderColor: "#E5E9ED", borderRadius: "6px", onClick: () => onDelete(row), _hover: { color: "#B42318", bg: "#FFF5F5", borderColor: "#FECACA" }, children: /* @__PURE__ */ jsx10(TrashIcon, {}) }) : null,
1097
1186
  renderRowActions?.(row)
1098
1187
  ] }) }) : null,
1099
- columns.map((column) => /* @__PURE__ */ jsx9(Table.Cell, { maxW: "250px", h: "42px", px: "10px", py: "8px", overflow: "hidden", color: "#52606D", borderBottomWidth: "1px", borderColor: "#EEF1F3", fontSize: "11px", textOverflow: "ellipsis", whiteSpace: "nowrap", children: renderColumnCell(row, column, cellRenderers) }, column.field))
1188
+ columns.map((column) => /* @__PURE__ */ jsx10(Table.Cell, { maxW: "250px", h: "42px", px: "10px", py: "8px", overflow: "hidden", color: "#52606D", borderBottomWidth: "1px", borderColor: "#EEF1F3", fontSize: "11px", textOverflow: "ellipsis", whiteSpace: "nowrap", children: renderColumnCell(row, column, cellRenderers) }, column.field))
1100
1189
  ] }, row._id ?? index)) })
1101
1190
  ] }) }),
1102
1191
  /* @__PURE__ */ jsxs5(Flex3, { minH: "56px", px: "14px", py: "10px", align: "center", justify: "flex-end", gap: "18px", color: "#7B8794", borderTopWidth: "1px", borderColor: "#E5E9ED", fontSize: "10px", flexWrap: "wrap", children: [
1103
1192
  /* @__PURE__ */ jsxs5(Flex3, { align: "center", gap: 2, children: [
1104
- /* @__PURE__ */ jsx9(Text5, { children: "Linhas por p\xE1gina" }),
1193
+ /* @__PURE__ */ jsx10(Text5, { children: "Linhas por p\xE1gina" }),
1105
1194
  /* @__PURE__ */ jsxs5(NativeSelect.Root, { size: "xs", w: "68px", children: [
1106
- /* @__PURE__ */ jsx9(
1195
+ /* @__PURE__ */ jsx10(
1107
1196
  NativeSelect.Field,
1108
1197
  {
1109
1198
  value: pageSize,
@@ -1119,10 +1208,10 @@ function DataGrid({
1119
1208
  setPageSize(Number(event.currentTarget.value));
1120
1209
  setPageIndex(0);
1121
1210
  },
1122
- children: [10, 20, 50, 100].map((size) => /* @__PURE__ */ jsx9("option", { value: size, children: size }, size))
1211
+ children: [10, 20, 50, 100].map((size) => /* @__PURE__ */ jsx10("option", { value: size, children: size }, size))
1123
1212
  }
1124
1213
  ),
1125
- /* @__PURE__ */ jsx9(NativeSelect.Indicator, {})
1214
+ /* @__PURE__ */ jsx10(NativeSelect.Indicator, {})
1126
1215
  ] })
1127
1216
  ] }),
1128
1217
  /* @__PURE__ */ jsxs5(Text5, { children: [
@@ -1132,15 +1221,15 @@ function DataGrid({
1132
1221
  totalPages
1133
1222
  ] }),
1134
1223
  /* @__PURE__ */ jsxs5(Flex3, { gap: "5px", children: [
1135
- /* @__PURE__ */ jsx9(Button3, { type: "button", "aria-label": "P\xE1gina anterior", w: "31px", minW: "31px", h: "31px", p: 0, color: "#667085", bg: "white", borderWidth: "1px", borderColor: "#E5E9ED", borderRadius: "6px", disabled: pageIndex <= 0, onClick: () => setPageIndex((current) => Math.max(0, current - 1)), _hover: { color: "#036491", bg: "#F0F7FF", borderColor: "#B8D9EB" }, children: /* @__PURE__ */ jsx9(ChevronIcon, { direction: "left" }) }),
1136
- /* @__PURE__ */ jsx9(Button3, { type: "button", "aria-label": "Pr\xF3xima p\xE1gina", w: "31px", minW: "31px", h: "31px", p: 0, color: "#667085", bg: "white", borderWidth: "1px", borderColor: "#E5E9ED", borderRadius: "6px", disabled: currentPage >= totalPages, onClick: () => setPageIndex((current) => Math.min(totalPages - 1, current + 1)), _hover: { color: "#036491", bg: "#F0F7FF", borderColor: "#B8D9EB" }, children: /* @__PURE__ */ jsx9(ChevronIcon, { direction: "right" }) })
1224
+ /* @__PURE__ */ jsx10(Button3, { type: "button", "aria-label": "P\xE1gina anterior", w: "31px", minW: "31px", h: "31px", p: 0, color: "#667085", bg: "white", borderWidth: "1px", borderColor: "#E5E9ED", borderRadius: "6px", disabled: pageIndex <= 0, onClick: () => setPageIndex((current) => Math.max(0, current - 1)), _hover: { color: "#036491", bg: "#F0F7FF", borderColor: "#B8D9EB" }, children: /* @__PURE__ */ jsx10(ChevronIcon, { direction: "left" }) }),
1225
+ /* @__PURE__ */ jsx10(Button3, { type: "button", "aria-label": "Pr\xF3xima p\xE1gina", w: "31px", minW: "31px", h: "31px", p: 0, color: "#667085", bg: "white", borderWidth: "1px", borderColor: "#E5E9ED", borderRadius: "6px", disabled: currentPage >= totalPages, onClick: () => setPageIndex((current) => Math.min(totalPages - 1, current + 1)), _hover: { color: "#036491", bg: "#F0F7FF", borderColor: "#B8D9EB" }, children: /* @__PURE__ */ jsx10(ChevronIcon, { direction: "right" }) })
1137
1226
  ] })
1138
1227
  ] })
1139
1228
  ] });
1140
1229
  }
1141
1230
 
1142
1231
  // src/components/internal/DynamicForm.tsx
1143
- import { useEffect as useEffect6, useMemo as useMemo4, useState as useState7 } from "react";
1232
+ import { useEffect as useEffect6, useMemo as useMemo5, useState as useState8 } from "react";
1144
1233
  import { Box as Box7, Button as Button5, Flex as Flex5, Heading as Heading3, Input as Input4, NativeSelect as NativeSelect2, SimpleGrid, Stack as Stack2, Text as Text8, Textarea } from "@chakra-ui/react";
1145
1234
 
1146
1235
  // src/domain/domainExpressions.ts
@@ -1404,18 +1493,18 @@ function buildDomainMutationPayload(fields, values) {
1404
1493
  }
1405
1494
 
1406
1495
  // src/components/internal/ReferenceSelect.tsx
1407
- import { useEffect as useEffect5, useMemo as useMemo3, useRef, useState as useState6 } from "react";
1496
+ import { useEffect as useEffect5, useMemo as useMemo4, useRef, useState as useState7 } from "react";
1408
1497
  import { Box as Box5, Button as Button4, Flex as Flex4, Input as Input3, Spinner as Spinner2, Stack, Text as Text6 } from "@chakra-ui/react";
1409
1498
  import { useQuery as useQuery3 } from "@tanstack/react-query";
1410
- import { jsx as jsx10, jsxs as jsxs6 } from "react/jsx-runtime";
1499
+ import { jsx as jsx11, jsxs as jsxs6 } from "react/jsx-runtime";
1411
1500
  function SearchIcon2() {
1412
1501
  return /* @__PURE__ */ jsxs6("svg", { viewBox: "0 0 20 20", width: "15", height: "15", "aria-hidden": "true", children: [
1413
- /* @__PURE__ */ jsx10("circle", { cx: "8.5", cy: "8.5", r: "5.25", fill: "none", stroke: "currentColor", strokeWidth: "1.5" }),
1414
- /* @__PURE__ */ jsx10("path", { d: "m12.4 12.4 4 4", fill: "none", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round" })
1502
+ /* @__PURE__ */ jsx11("circle", { cx: "8.5", cy: "8.5", r: "5.25", fill: "none", stroke: "currentColor", strokeWidth: "1.5" }),
1503
+ /* @__PURE__ */ jsx11("path", { d: "m12.4 12.4 4 4", fill: "none", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round" })
1415
1504
  ] });
1416
1505
  }
1417
1506
  function ChevronIcon2({ open }) {
1418
- return /* @__PURE__ */ jsx10(
1507
+ return /* @__PURE__ */ jsx11(
1419
1508
  "svg",
1420
1509
  {
1421
1510
  viewBox: "0 0 20 20",
@@ -1423,12 +1512,12 @@ function ChevronIcon2({ open }) {
1423
1512
  height: "16",
1424
1513
  "aria-hidden": "true",
1425
1514
  style: { display: "block", transition: "transform .15s ease", transform: open ? "rotate(180deg)" : "rotate(0deg)" },
1426
- children: /* @__PURE__ */ jsx10("path", { d: "M5.5 7.5 10 12l4.5-4.5", fill: "none", stroke: "currentColor", strokeWidth: "1.7", strokeLinecap: "round", strokeLinejoin: "round" })
1515
+ children: /* @__PURE__ */ jsx11("path", { d: "M5.5 7.5 10 12l4.5-4.5", fill: "none", stroke: "currentColor", strokeWidth: "1.7", strokeLinecap: "round", strokeLinejoin: "round" })
1427
1516
  }
1428
1517
  );
1429
1518
  }
1430
1519
  function ClearIcon() {
1431
- return /* @__PURE__ */ jsx10("svg", { viewBox: "0 0 20 20", width: "14", height: "14", "aria-hidden": "true", children: /* @__PURE__ */ jsx10("path", { d: "m6 6 8 8M14 6l-8 8", fill: "none", stroke: "currentColor", strokeWidth: "1.7", strokeLinecap: "round" }) });
1520
+ return /* @__PURE__ */ jsx11("svg", { viewBox: "0 0 20 20", width: "14", height: "14", "aria-hidden": "true", children: /* @__PURE__ */ jsx11("path", { d: "m6 6 8 8M14 6l-8 8", fill: "none", stroke: "currentColor", strokeWidth: "1.7", strokeLinecap: "round" }) });
1432
1521
  }
1433
1522
  function cleanFilters(filters) {
1434
1523
  return Object.fromEntries(
@@ -1452,21 +1541,21 @@ function ReferenceSelect({
1452
1541
  disabledMessage,
1453
1542
  onChange
1454
1543
  }) {
1455
- const initialLabel = useMemo3(() => initialReferenceLabel(initialValue), [initialValue]);
1456
- const initialId = useMemo3(() => {
1544
+ const initialLabel = useMemo4(() => initialReferenceLabel(initialValue), [initialValue]);
1545
+ const initialId = useMemo4(() => {
1457
1546
  if (initialValue && typeof initialValue === "object") {
1458
1547
  return referenceId(initialValue);
1459
1548
  }
1460
1549
  return String(initialValue ?? "");
1461
1550
  }, [initialValue]);
1462
- const resolvedFilters = useMemo3(() => cleanFilters(filters), [filters]);
1463
- const filtersKey = useMemo3(() => JSON.stringify(resolvedFilters), [resolvedFilters]);
1464
- const emptyFieldsKey = useMemo3(() => JSON.stringify(emptyFields), [emptyFields]);
1465
- const [selectedLabel, setSelectedLabel] = useState6(initialLabel);
1466
- const [search, setSearch] = useState6("");
1467
- const [debouncedSearch, setDebouncedSearch] = useState6("");
1468
- const [open, setOpen] = useState6(false);
1469
- const [activeIndex, setActiveIndex] = useState6(-1);
1551
+ const resolvedFilters = useMemo4(() => cleanFilters(filters), [filters]);
1552
+ const filtersKey = useMemo4(() => JSON.stringify(resolvedFilters), [resolvedFilters]);
1553
+ const emptyFieldsKey = useMemo4(() => JSON.stringify(emptyFields), [emptyFields]);
1554
+ const [selectedLabel, setSelectedLabel] = useState7(initialLabel);
1555
+ const [search, setSearch] = useState7("");
1556
+ const [debouncedSearch, setDebouncedSearch] = useState7("");
1557
+ const [open, setOpen] = useState7(false);
1558
+ const [activeIndex, setActiveIndex] = useState7(-1);
1470
1559
  const rootRef = useRef(null);
1471
1560
  const searchRef = useRef(null);
1472
1561
  const optionRefs = useRef([]);
@@ -1634,9 +1723,9 @@ function ReferenceSelect({
1634
1723
  _focusVisible: { borderColor: invalid ? "#DC2626" : "#0F8DD0", boxShadow: invalid ? "0 0 0 3px rgba(220,38,38,.08)" : "0 0 0 3px rgba(15,141,208,.10)" },
1635
1724
  _disabled: { cursor: "not-allowed", color: "#98A2B3", bg: "#F8FAFC", opacity: 1 },
1636
1725
  children: [
1637
- /* @__PURE__ */ jsx10(Text6, { as: "span", minW: 0, flex: "1", overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap", color: selectedLabel || value2 ? "#475467" : "#98A2B3", children: selectedLabel || (value2 ? String(value2) : placeholder) }),
1726
+ /* @__PURE__ */ jsx11(Text6, { as: "span", minW: 0, flex: "1", overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap", color: selectedLabel || value2 ? "#475467" : "#98A2B3", children: selectedLabel || (value2 ? String(value2) : placeholder) }),
1638
1727
  /* @__PURE__ */ jsxs6(Flex4, { as: "span", align: "center", gap: 1, flex: "0 0 auto", color: "#98A2B3", children: [
1639
- value2 && !disabled ? /* @__PURE__ */ jsx10(
1728
+ value2 && !disabled ? /* @__PURE__ */ jsx11(
1640
1729
  Box5,
1641
1730
  {
1642
1731
  as: "span",
@@ -1653,10 +1742,10 @@ function ReferenceSelect({
1653
1742
  if (event.key === "Enter" || event.key === " ") clear(event);
1654
1743
  },
1655
1744
  _hover: { color: "#B42318", bg: "#FFF1F1" },
1656
- children: /* @__PURE__ */ jsx10(ClearIcon, {})
1745
+ children: /* @__PURE__ */ jsx11(ClearIcon, {})
1657
1746
  }
1658
1747
  ) : null,
1659
- /* @__PURE__ */ jsx10(ChevronIcon2, { open })
1748
+ /* @__PURE__ */ jsx11(ChevronIcon2, { open })
1660
1749
  ] })
1661
1750
  ]
1662
1751
  }
@@ -1677,8 +1766,8 @@ function ReferenceSelect({
1677
1766
  boxShadow: "0 10px 30px rgba(15,23,42,.10)",
1678
1767
  children: [
1679
1768
  /* @__PURE__ */ jsxs6(Flex4, { h: "38px", px: "10px", align: "center", gap: "7px", color: "#98A2B3", borderBottomWidth: "1px", borderColor: "#E5E9ED", children: [
1680
- /* @__PURE__ */ jsx10(SearchIcon2, {}),
1681
- /* @__PURE__ */ jsx10(
1769
+ /* @__PURE__ */ jsx11(SearchIcon2, {}),
1770
+ /* @__PURE__ */ jsx11(
1682
1771
  Input3,
1683
1772
  {
1684
1773
  ref: searchRef,
@@ -1715,10 +1804,10 @@ function ReferenceSelect({
1715
1804
  }
1716
1805
  )
1717
1806
  ] }),
1718
- /* @__PURE__ */ jsx10(Stack, { id: listId, role: "listbox", gap: 0, maxH: "230px", p: "5px", overflowY: "auto", children: schemaQuery.isLoading || listQuery.isLoading ? /* @__PURE__ */ jsxs6(Flex4, { minH: "54px", align: "center", justify: "center", gap: 2, color: "#98A2B3", fontSize: "10px", children: [
1719
- /* @__PURE__ */ jsx10(Spinner2, { size: "xs" }),
1807
+ /* @__PURE__ */ jsx11(Stack, { id: listId, role: "listbox", gap: 0, maxH: "230px", p: "5px", overflowY: "auto", children: schemaQuery.isLoading || listQuery.isLoading ? /* @__PURE__ */ jsxs6(Flex4, { minH: "54px", align: "center", justify: "center", gap: 2, color: "#98A2B3", fontSize: "10px", children: [
1808
+ /* @__PURE__ */ jsx11(Spinner2, { size: "xs" }),
1720
1809
  " Carregando..."
1721
- ] }) : schemaQuery.isError || listQuery.isError ? /* @__PURE__ */ jsx10(Text6, { py: "18px", px: "10px", color: "#B42318", fontSize: "10px", textAlign: "center", children: "N\xE3o foi poss\xEDvel carregar as op\xE7\xF5es." }) : items.length === 0 ? /* @__PURE__ */ jsx10(Text6, { py: "18px", px: "10px", color: "#98A2B3", fontSize: "10px", textAlign: "center", children: "Nenhum registro encontrado." }) : items.map((record, index) => {
1810
+ ] }) : schemaQuery.isError || listQuery.isError ? /* @__PURE__ */ jsx11(Text6, { py: "18px", px: "10px", color: "#B42318", fontSize: "10px", textAlign: "center", children: "N\xE3o foi poss\xEDvel carregar as op\xE7\xF5es." }) : items.length === 0 ? /* @__PURE__ */ jsx11(Text6, { py: "18px", px: "10px", color: "#98A2B3", fontSize: "10px", textAlign: "center", children: "Nenhum registro encontrado." }) : items.map((record, index) => {
1722
1811
  const id = referenceId(record);
1723
1812
  if (!id) return null;
1724
1813
  const selected = String(id) === String(value2);
@@ -1755,8 +1844,8 @@ function ReferenceSelect({
1755
1844
  onClick: () => choose(record),
1756
1845
  _hover: { color: "#014364", bg: "#F0F7FF" },
1757
1846
  children: [
1758
- /* @__PURE__ */ jsx10(Text6, { as: "strong", fontSize: "10px", fontWeight: "600", children: optionLabel }),
1759
- status ? /* @__PURE__ */ jsx10(Text6, { as: "small", color: "#98A2B3", fontSize: "9px", textTransform: "capitalize", children: String(status).replace(/_/g, " ") }) : null
1847
+ /* @__PURE__ */ jsx11(Text6, { as: "strong", fontSize: "10px", fontWeight: "600", children: optionLabel }),
1848
+ status ? /* @__PURE__ */ jsx11(Text6, { as: "small", color: "#98A2B3", fontSize: "9px", textTransform: "capitalize", children: String(status).replace(/_/g, " ") }) : null
1760
1849
  ]
1761
1850
  },
1762
1851
  id
@@ -1765,7 +1854,7 @@ function ReferenceSelect({
1765
1854
  ]
1766
1855
  }
1767
1856
  ) : null,
1768
- error ? /* @__PURE__ */ jsx10(Text6, { id: errorId, role: "alert", mt: "5px", color: "#DC2626", fontSize: "10px", fontWeight: "500", children: error }) : null
1857
+ error ? /* @__PURE__ */ jsx11(Text6, { id: errorId, role: "alert", mt: "5px", color: "#DC2626", fontSize: "10px", fontWeight: "500", children: error }) : null
1769
1858
  ] });
1770
1859
  }
1771
1860
 
@@ -1834,7 +1923,7 @@ function describeActionError(error) {
1834
1923
  }
1835
1924
 
1836
1925
  // src/components/internal/CoreErrorAlert.tsx
1837
- import { jsx as jsx11, jsxs as jsxs7 } from "react/jsx-runtime";
1926
+ import { jsx as jsx12, jsxs as jsxs7 } from "react/jsx-runtime";
1838
1927
  function CoreErrorAlert({
1839
1928
  error,
1840
1929
  mt
@@ -1854,9 +1943,9 @@ function CoreErrorAlert({
1854
1943
  borderRadius: "7px",
1855
1944
  fontSize: "11px",
1856
1945
  children: [
1857
- /* @__PURE__ */ jsx11(Text7, { fontSize: "11px", fontWeight: "500", children: description.message }),
1946
+ /* @__PURE__ */ jsx12(Text7, { fontSize: "11px", fontWeight: "500", children: description.message }),
1858
1947
  details.length ? /* @__PURE__ */ jsxs7(Box6, { as: "details", mt: "5px", children: [
1859
- /* @__PURE__ */ jsx11(
1948
+ /* @__PURE__ */ jsx12(
1860
1949
  Box6,
1861
1950
  {
1862
1951
  as: "summary",
@@ -1869,7 +1958,7 @@ function CoreErrorAlert({
1869
1958
  children: "Detalhes"
1870
1959
  }
1871
1960
  ),
1872
- /* @__PURE__ */ jsx11(
1961
+ /* @__PURE__ */ jsx12(
1873
1962
  Box6,
1874
1963
  {
1875
1964
  as: "ul",
@@ -1881,7 +1970,7 @@ function CoreErrorAlert({
1881
1970
  fontSize: "9px",
1882
1971
  lineHeight: "1.45",
1883
1972
  overflowWrap: "anywhere",
1884
- children: details.map((detail) => /* @__PURE__ */ jsx11("li", { children: detail }, detail))
1973
+ children: details.map((detail) => /* @__PURE__ */ jsx12("li", { children: detail }, detail))
1885
1974
  }
1886
1975
  )
1887
1976
  ] }) : null
@@ -1996,23 +2085,23 @@ function maxLengthForMask(mask) {
1996
2085
  }
1997
2086
 
1998
2087
  // src/components/internal/DynamicForm.tsx
1999
- import { jsx as jsx12, jsxs as jsxs8 } from "react/jsx-runtime";
2088
+ import { jsx as jsx13, jsxs as jsxs8 } from "react/jsx-runtime";
2000
2089
  var idFor = (field) => `oon-form-field-${field.replace(/[^a-zA-Z0-9_-]/g, "-")}`;
2001
2090
  var errorIdFor = (field) => `${idFor(field)}-error`;
2002
- var normalize = (value2) => String(value2 ?? "").normalize("NFD").replace(/[\u0300-\u036f]/g, "").toLowerCase();
2091
+ var normalize2 = (value2) => String(value2 ?? "").normalize("NFD").replace(/[\u0300-\u036f]/g, "").toLowerCase();
2003
2092
  function CloseIcon() {
2004
- return /* @__PURE__ */ jsx12("svg", { viewBox: "0 0 20 20", width: "18", height: "18", "aria-hidden": "true", children: /* @__PURE__ */ jsx12("path", { d: "m6 6 8 8M14 6l-8 8", fill: "none", stroke: "currentColor", strokeWidth: "1.6", strokeLinecap: "round" }) });
2093
+ return /* @__PURE__ */ jsx13("svg", { viewBox: "0 0 20 20", width: "18", height: "18", "aria-hidden": "true", children: /* @__PURE__ */ jsx13("path", { d: "m6 6 8 8M14 6l-8 8", fill: "none", stroke: "currentColor", strokeWidth: "1.6", strokeLinecap: "round" }) });
2005
2094
  }
2006
2095
  function CheckIcon() {
2007
2096
  return /* @__PURE__ */ jsxs8("svg", { viewBox: "0 0 20 20", width: "16", height: "16", "aria-hidden": "true", children: [
2008
- /* @__PURE__ */ jsx12("circle", { cx: "10", cy: "10", r: "7", fill: "none", stroke: "currentColor", strokeWidth: "1.4" }),
2009
- /* @__PURE__ */ jsx12("path", { d: "m6.8 10.1 2 2 4.3-4.4", fill: "none", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" })
2097
+ /* @__PURE__ */ jsx13("circle", { cx: "10", cy: "10", r: "7", fill: "none", stroke: "currentColor", strokeWidth: "1.4" }),
2098
+ /* @__PURE__ */ jsx13("path", { d: "m6.8 10.1 2 2 4.3-4.4", fill: "none", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" })
2010
2099
  ] });
2011
2100
  }
2012
2101
  function AlertIcon() {
2013
2102
  return /* @__PURE__ */ jsxs8("svg", { viewBox: "0 0 20 20", width: "17", height: "17", "aria-hidden": "true", children: [
2014
- /* @__PURE__ */ jsx12("circle", { cx: "10", cy: "10", r: "7", fill: "none", stroke: "currentColor", strokeWidth: "1.4" }),
2015
- /* @__PURE__ */ jsx12("path", { d: "M10 6.5v4.2M10 13.5v.1", fill: "none", stroke: "currentColor", strokeWidth: "1.6", strokeLinecap: "round" })
2103
+ /* @__PURE__ */ jsx13("circle", { cx: "10", cy: "10", r: "7", fill: "none", stroke: "currentColor", strokeWidth: "1.4" }),
2104
+ /* @__PURE__ */ jsx13("path", { d: "M10 6.5v4.2M10 13.5v.1", fill: "none", stroke: "currentColor", strokeWidth: "1.6", strokeLinecap: "round" })
2016
2105
  ] });
2017
2106
  }
2018
2107
  function toValue(value2, kind) {
@@ -2059,7 +2148,7 @@ function messageOf(error) {
2059
2148
  }
2060
2149
  function detailErrors(error, fields) {
2061
2150
  const result = {};
2062
- const lookup = new Map(fields.flatMap((field) => [[normalize(field.field), field], [normalize(field.label), field]]));
2151
+ const lookup = new Map(fields.flatMap((field) => [[normalize2(field.field), field], [normalize2(field.label), field]]));
2063
2152
  const seen = /* @__PURE__ */ new WeakSet();
2064
2153
  const visit = (value2, hint) => {
2065
2154
  if (value2 == null) return;
@@ -2068,11 +2157,11 @@ function detailErrors(error, fields) {
2068
2157
  seen.add(value2);
2069
2158
  const record = value2;
2070
2159
  const candidate = String(record.field ?? record.path ?? record.property ?? record.name ?? hint ?? "");
2071
- const field = lookup.get(normalize(candidate.split(/[.[\]]+/).filter(Boolean).pop() ?? candidate));
2160
+ const field = lookup.get(normalize2(candidate.split(/[.[\]]+/).filter(Boolean).pop() ?? candidate));
2072
2161
  const raw = record.message ?? record.msg ?? record.reason;
2073
2162
  if (field && typeof raw === "string") result[field.field] = /required|obrigat/i.test(raw) ? `${fieldLabel({ name: field.field, label: field.label })} \xE9 obrigat\xF3rio.` : raw;
2074
2163
  Object.entries(record).forEach(([key, nested]) => {
2075
- const direct = lookup.get(normalize(key));
2164
+ const direct = lookup.get(normalize2(key));
2076
2165
  if (direct && typeof nested === "string") result[direct.field] = nested;
2077
2166
  visit(nested, key);
2078
2167
  });
@@ -2094,14 +2183,14 @@ function isMultiline(field) {
2094
2183
  return field.multiline === true || /observa|descricao|mensagem|detalhe|necessidade/i.test(field.field);
2095
2184
  }
2096
2185
  function Label({ id, label, required, readonly }) {
2097
- return /* @__PURE__ */ jsx12("label", { htmlFor: id, children: /* @__PURE__ */ jsxs8(Text8, { as: "span", display: "block", mb: "6px", color: "#475467", fontSize: "11px", fontWeight: "600", children: [
2186
+ return /* @__PURE__ */ jsx13("label", { htmlFor: id, children: /* @__PURE__ */ jsxs8(Text8, { as: "span", display: "block", mb: "6px", color: "#475467", fontSize: "11px", fontWeight: "600", children: [
2098
2187
  label,
2099
- required && !readonly ? /* @__PURE__ */ jsx12(Text8, { as: "span", color: "#DC2626", children: " *" }) : null,
2100
- readonly ? /* @__PURE__ */ jsx12(Text8, { as: "span", ml: "5px", color: "#98A2B3", fontSize: "9px", fontWeight: "500", children: "somente leitura" }) : null
2188
+ required && !readonly ? /* @__PURE__ */ jsx13(Text8, { as: "span", color: "#DC2626", children: " *" }) : null,
2189
+ readonly ? /* @__PURE__ */ jsx13(Text8, { as: "span", ml: "5px", color: "#98A2B3", fontSize: "9px", fontWeight: "500", children: "somente leitura" }) : null
2101
2190
  ] }) });
2102
2191
  }
2103
2192
  function ErrorText({ id, text }) {
2104
- return text ? /* @__PURE__ */ jsx12(Text8, { id, role: "alert", mt: "5px", color: "#DC2626", fontSize: "10px", fontWeight: "500", children: text }) : null;
2193
+ return text ? /* @__PURE__ */ jsx13(Text8, { id, role: "alert", mt: "5px", color: "#DC2626", fontSize: "10px", fontWeight: "500", children: text }) : null;
2105
2194
  }
2106
2195
  var controlProps = (invalid, readonly = false) => ({
2107
2196
  minH: "37px",
@@ -2141,11 +2230,11 @@ function resolveReference(field, values) {
2141
2230
  function DynamicForm({ title, eyebrow = "Cadastro", fields: rawFields, initialValues, submitting, error, onSubmit, onCancel, onFieldChange }) {
2142
2231
  const fields = rawFields;
2143
2232
  const initial = initialReactiveValues(fields, initialValues);
2144
- const [values, setValues] = useState7(initial.values);
2145
- const [formulaErrors, setFormulaErrors] = useState7(initial.errors);
2146
- const [errors, setErrors] = useState7({});
2147
- const [dismissed, setDismissed] = useState7(false);
2148
- const items = useMemo4(() => buildItems(fields), [rawFields]);
2233
+ const [values, setValues] = useState8(initial.values);
2234
+ const [formulaErrors, setFormulaErrors] = useState8(initial.errors);
2235
+ const [errors, setErrors] = useState8({});
2236
+ const [dismissed, setDismissed] = useState8(false);
2237
+ const items = useMemo5(() => buildItems(fields), [rawFields]);
2149
2238
  useEffect6(() => {
2150
2239
  const listener = (event) => {
2151
2240
  if (event.key !== "Escape" || event.defaultPrevented || submitting) return;
@@ -2159,7 +2248,7 @@ function DynamicForm({ title, eyebrow = "Cadastro", fields: rawFields, initialVa
2159
2248
  setDismissed(false);
2160
2249
  if (!error) return;
2161
2250
  const detailed = detailErrors(error, fields);
2162
- const fallback = /validacao|validation/i.test(normalize(messageOf(error))) ? validate(fields, values) : {};
2251
+ const fallback = /validacao|validation/i.test(normalize2(messageOf(error))) ? validate(fields, values) : {};
2163
2252
  const next = Object.keys(detailed).length ? detailed : fallback;
2164
2253
  if (!Object.keys(next).length) return;
2165
2254
  setErrors((current) => ({ ...current, ...next }));
@@ -2213,9 +2302,9 @@ function DynamicForm({ title, eyebrow = "Cadastro", fields: rawFields, initialVa
2213
2302
  const span = field.span === 2 || multiline;
2214
2303
  const readonly = Boolean(field.readonly || field.computed);
2215
2304
  const wrap = (control, showLabel = true) => /* @__PURE__ */ jsxs8(Box7, { minW: grouped ? "150px" : void 0, flex: grouped ? "0 1 auto" : void 0, gridColumn: !grouped && span ? "1 / -1" : void 0, children: [
2216
- showLabel ? /* @__PURE__ */ jsx12(Label, { id, label, required: field.required, readonly }) : null,
2305
+ showLabel ? /* @__PURE__ */ jsx13(Label, { id, label, required: field.required, readonly }) : null,
2217
2306
  control,
2218
- /* @__PURE__ */ jsx12(ErrorText, { id: errorId, text: message })
2307
+ /* @__PURE__ */ jsx13(ErrorText, { id: errorId, text: message })
2219
2308
  ] }, field.field);
2220
2309
  if (field.widget === "checkbox") {
2221
2310
  const checkedValue = String(field.checkedValue ?? true);
@@ -2223,10 +2312,10 @@ function DynamicForm({ title, eyebrow = "Cadastro", fields: rawFields, initialVa
2223
2312
  const checked = (values[field.field] ?? uncheckedValue) === checkedValue;
2224
2313
  return wrap(
2225
2314
  /* @__PURE__ */ jsxs8(Box7, { as: "label", display: "flex", minH: "37px", px: "11px", alignItems: "center", gap: "8px", color: "#344054", bg: readonly ? "#F8FAFC" : checked ? "#F0F7FF" : "white", borderWidth: "1px", borderColor: message ? "#DC2626" : checked ? "#8FC9E7" : "#D5DDE3", borderRadius: "7px", cursor: readonly ? "not-allowed" : "pointer", transition: "background .15s ease, border-color .15s ease", children: [
2226
- /* @__PURE__ */ jsx12("input", { id, type: "checkbox", checked, disabled: readonly, "aria-invalid": !!message, "aria-describedby": errorId, style: { width: 16, height: 16, accentColor: "#0474AF", cursor: readonly ? "not-allowed" : "pointer" }, onChange: (event) => change(field.field, event.currentTarget.checked ? checkedValue : uncheckedValue) }),
2315
+ /* @__PURE__ */ jsx13("input", { id, type: "checkbox", checked, disabled: readonly, "aria-invalid": !!message, "aria-describedby": errorId, style: { width: 16, height: 16, accentColor: "#0474AF", cursor: readonly ? "not-allowed" : "pointer" }, onChange: (event) => change(field.field, event.currentTarget.checked ? checkedValue : uncheckedValue) }),
2227
2316
  /* @__PURE__ */ jsxs8(Text8, { as: "span", fontSize: "11px", fontWeight: "600", children: [
2228
2317
  label,
2229
- field.required && !readonly ? /* @__PURE__ */ jsx12(Text8, { as: "span", color: "#DC2626", children: " *" }) : null
2318
+ field.required && !readonly ? /* @__PURE__ */ jsx13(Text8, { as: "span", color: "#DC2626", children: " *" }) : null
2230
2319
  ] })
2231
2320
  ] }),
2232
2321
  false
@@ -2234,74 +2323,74 @@ function DynamicForm({ title, eyebrow = "Cadastro", fields: rawFields, initialVa
2234
2323
  }
2235
2324
  if (field.kind === "ref" && field.ref) {
2236
2325
  const reference = resolveReference(field, values);
2237
- return wrap(/* @__PURE__ */ jsx12(ReferenceSelect, { field: field.field, inputId: id, errorId, label, refModel: field.ref, value: values[field.field] ?? "", initialValue: initialValues?.[field.field], required: field.required && !readonly, invalid: !!message, error: message, filters: reference.filters, emptyFields: field.referenceEmptyFields, disabled: readonly || reference.disabled, disabledMessage: field.referenceDisabledMessage, onChange: (value3) => change(field.field, value3) }));
2326
+ return wrap(/* @__PURE__ */ jsx13(ReferenceSelect, { field: field.field, inputId: id, errorId, label, refModel: field.ref, value: values[field.field] ?? "", initialValue: initialValues?.[field.field], required: field.required && !readonly, invalid: !!message, error: message, filters: reference.filters, emptyFields: field.referenceEmptyFields, disabled: readonly || reference.disabled, disabledMessage: field.referenceDisabledMessage, onChange: (value3) => change(field.field, value3) }));
2238
2327
  }
2239
2328
  if (field.kind === "enum" && field.options?.length) return wrap(/* @__PURE__ */ jsxs8(NativeSelect2.Root, { size: "sm", disabled: readonly, children: [
2240
2329
  /* @__PURE__ */ jsxs8(NativeSelect2.Field, { id, "aria-invalid": !!message, "aria-describedby": errorId, value: values[field.field] ?? "", ...controlProps(!!message, readonly), onChange: (event) => change(field.field, event.currentTarget.value), children: [
2241
- /* @__PURE__ */ jsx12("option", { value: "", children: "\u2014 Selecione \u2014" }),
2242
- field.options.map((option) => /* @__PURE__ */ jsx12("option", { value: option, children: option }, option))
2330
+ /* @__PURE__ */ jsx13("option", { value: "", children: "\u2014 Selecione \u2014" }),
2331
+ field.options.map((option) => /* @__PURE__ */ jsx13("option", { value: option, children: option }, option))
2243
2332
  ] }),
2244
- /* @__PURE__ */ jsx12(NativeSelect2.Indicator, {})
2333
+ /* @__PURE__ */ jsx13(NativeSelect2.Indicator, {})
2245
2334
  ] }));
2246
2335
  if (field.kind === "boolean") return wrap(/* @__PURE__ */ jsxs8(NativeSelect2.Root, { size: "sm", disabled: readonly, children: [
2247
2336
  /* @__PURE__ */ jsxs8(NativeSelect2.Field, { id, "aria-invalid": !!message, "aria-describedby": errorId, value: values[field.field] ?? "", ...controlProps(!!message, readonly), onChange: (event) => change(field.field, event.currentTarget.value), children: [
2248
- /* @__PURE__ */ jsx12("option", { value: "", children: "\u2014 Selecione \u2014" }),
2249
- /* @__PURE__ */ jsx12("option", { value: "true", children: "Sim" }),
2250
- /* @__PURE__ */ jsx12("option", { value: "false", children: "N\xE3o" })
2337
+ /* @__PURE__ */ jsx13("option", { value: "", children: "\u2014 Selecione \u2014" }),
2338
+ /* @__PURE__ */ jsx13("option", { value: "true", children: "Sim" }),
2339
+ /* @__PURE__ */ jsx13("option", { value: "false", children: "N\xE3o" })
2251
2340
  ] }),
2252
- /* @__PURE__ */ jsx12(NativeSelect2.Indicator, {})
2341
+ /* @__PURE__ */ jsx13(NativeSelect2.Indicator, {})
2253
2342
  ] }));
2254
- if (multiline) return wrap(/* @__PURE__ */ jsx12(Textarea, { id, rows: field.rows ?? 4, resize: "vertical", readOnly: readonly, "aria-invalid": !!message, "aria-describedby": errorId, value: values[field.field] ?? "", ...controlProps(!!message, readonly), lineHeight: "1.5", onChange: (event) => change(field.field, event.currentTarget.value) }));
2343
+ if (multiline) return wrap(/* @__PURE__ */ jsx13(Textarea, { id, rows: field.rows ?? 4, resize: "vertical", readOnly: readonly, "aria-invalid": !!message, "aria-describedby": errorId, value: values[field.field] ?? "", ...controlProps(!!message, readonly), lineHeight: "1.5", onChange: (event) => change(field.field, event.currentTarget.value) }));
2255
2344
  const mask = resolveInputMask(field);
2256
2345
  const numeric = ["number", "currency", "currencyConverted"].includes(field.kind ?? "");
2257
2346
  const type = mask ? "text" : field.kind === "date" ? "date" : numeric ? "number" : "text";
2258
2347
  const value2 = values[field.field] ?? "";
2259
2348
  return wrap(
2260
- /* @__PURE__ */ jsx12(Input4, { id, type, step: type === "number" ? "any" : void 0, inputMode: inputModeForMask(mask), maxLength: maxLengthForMask(mask), autoComplete: "off", readOnly: readonly, "aria-invalid": !!message, "aria-describedby": errorId, value: mask ? formatMaskedValue(value2, mask) : value2, ...controlProps(!!message, readonly), onChange: (event) => change(field.field, parseMaskedInput(event.currentTarget.value, mask)) })
2349
+ /* @__PURE__ */ jsx13(Input4, { id, type, step: type === "number" ? "any" : void 0, inputMode: inputModeForMask(mask), maxLength: maxLengthForMask(mask), autoComplete: "off", readOnly: readonly, "aria-invalid": !!message, "aria-describedby": errorId, value: mask ? formatMaskedValue(value2, mask) : value2, ...controlProps(!!message, readonly), onChange: (event) => change(field.field, parseMaskedInput(event.currentTarget.value, mask)) })
2261
2350
  );
2262
2351
  };
2263
2352
  const combinedErrors = { ...formulaErrors, ...errors };
2264
2353
  const invalid = fields.filter((field) => combinedErrors[field.field]);
2265
2354
  const generic = dismissed ? null : messageOf(error);
2266
- return /* @__PURE__ */ jsx12(Flex5, { position: "fixed", inset: 0, zIndex: 1e3, align: "center", justify: "center", p: { base: 2, md: 6 }, bg: "rgba(15,23,42,.48)", backdropFilter: "blur(2px)", onMouseDown: (event) => {
2355
+ return /* @__PURE__ */ jsx13(Flex5, { position: "fixed", inset: 0, zIndex: 1e3, align: "center", justify: "center", p: { base: 2, md: 6 }, bg: "rgba(15,23,42,.48)", backdropFilter: "blur(2px)", onMouseDown: (event) => {
2267
2356
  if (event.currentTarget === event.target && !submitting) onCancel();
2268
2357
  }, children: /* @__PURE__ */ jsxs8(Box7, { role: "dialog", "aria-modal": "true", "aria-label": title, w: "min(860px, 96vw)", maxH: "min(880px, 94vh)", overflow: "hidden", bg: "white", borderWidth: "1px", borderColor: "#E5E9ED", borderRadius: "14px", boxShadow: "0 24px 70px rgba(15,23,42,.24)", children: [
2269
2358
  /* @__PURE__ */ jsxs8(Flex5, { minH: "76px", px: "20px", py: "16px", align: "center", justify: "space-between", borderBottomWidth: "1px", borderColor: "#E5E9ED", children: [
2270
2359
  /* @__PURE__ */ jsxs8(Box7, { children: [
2271
- /* @__PURE__ */ jsx12(Text8, { color: "#0474AF", fontSize: "10px", fontWeight: "600", letterSpacing: ".07em", textTransform: "uppercase", children: eyebrow }),
2272
- /* @__PURE__ */ jsx12(Heading3, { mt: "3px", color: "#344054", fontSize: "18px", fontWeight: "600", children: title })
2360
+ /* @__PURE__ */ jsx13(Text8, { color: "#0474AF", fontSize: "10px", fontWeight: "600", letterSpacing: ".07em", textTransform: "uppercase", children: eyebrow }),
2361
+ /* @__PURE__ */ jsx13(Heading3, { mt: "3px", color: "#344054", fontSize: "18px", fontWeight: "600", children: title })
2273
2362
  ] }),
2274
- /* @__PURE__ */ jsx12(Button5, { type: "button", "aria-label": "Fechar", w: "31px", minW: "31px", h: "31px", p: 0, color: "#667085", bg: "white", borderWidth: "1px", borderColor: "#E5E9ED", borderRadius: "6px", disabled: submitting, onClick: onCancel, _hover: { color: "#036491", bg: "#F0F7FF", borderColor: "#B8D9EB" }, children: /* @__PURE__ */ jsx12(CloseIcon, {}) })
2363
+ /* @__PURE__ */ jsx13(Button5, { type: "button", "aria-label": "Fechar", w: "31px", minW: "31px", h: "31px", p: 0, color: "#667085", bg: "white", borderWidth: "1px", borderColor: "#E5E9ED", borderRadius: "6px", disabled: submitting, onClick: onCancel, _hover: { color: "#036491", bg: "#F0F7FF", borderColor: "#B8D9EB" }, children: /* @__PURE__ */ jsx13(CloseIcon, {}) })
2275
2364
  ] }),
2276
2365
  /* @__PURE__ */ jsxs8("form", { noValidate: true, onSubmit: submit, children: [
2277
- /* @__PURE__ */ jsx12(Box7, { maxH: "calc(94vh - 148px)", px: "20px", pt: "18px", pb: "24px", overflowY: "auto", children: /* @__PURE__ */ jsxs8(Stack2, { gap: 4, children: [
2366
+ /* @__PURE__ */ jsx13(Box7, { maxH: "calc(94vh - 148px)", px: "20px", pt: "18px", pb: "24px", overflowY: "auto", children: /* @__PURE__ */ jsxs8(Stack2, { gap: 4, children: [
2278
2367
  invalid.length ? /* @__PURE__ */ jsxs8(Box7, { role: "alert", p: "11px 13px", color: "#9B1C1C", bg: "#FFF5F5", borderWidth: "1px", borderColor: "#FECACA", borderLeftWidth: "4px", borderLeftColor: "#DC2626", borderRadius: "8px", fontSize: "11px", children: [
2279
2368
  /* @__PURE__ */ jsxs8(Flex5, { align: "center", gap: "7px", children: [
2280
- /* @__PURE__ */ jsx12(AlertIcon, {}),
2281
- /* @__PURE__ */ jsx12(Text8, { as: "strong", children: "Revise os campos abaixo:" })
2369
+ /* @__PURE__ */ jsx13(AlertIcon, {}),
2370
+ /* @__PURE__ */ jsx13(Text8, { as: "strong", children: "Revise os campos abaixo:" })
2282
2371
  ] }),
2283
- /* @__PURE__ */ jsx12(Box7, { as: "ul", mt: "7px", mb: 0, pl: "20px", display: "grid", gap: "3px", children: invalid.map((field) => /* @__PURE__ */ jsx12("li", { children: /* @__PURE__ */ jsxs8(Button5, { type: "button", variant: "plain", minH: "auto", h: "auto", p: 0, color: "#B42318", fontSize: "10px", fontWeight: "400", textDecoration: "underline", onClick: () => focusField(field.field), children: [
2372
+ /* @__PURE__ */ jsx13(Box7, { as: "ul", mt: "7px", mb: 0, pl: "20px", display: "grid", gap: "3px", children: invalid.map((field) => /* @__PURE__ */ jsx13("li", { children: /* @__PURE__ */ jsxs8(Button5, { type: "button", variant: "plain", minH: "auto", h: "auto", p: 0, color: "#B42318", fontSize: "10px", fontWeight: "400", textDecoration: "underline", onClick: () => focusField(field.field), children: [
2284
2373
  fieldLabel({ name: field.field, label: field.label }),
2285
2374
  ": ",
2286
2375
  combinedErrors[field.field]
2287
2376
  ] }) }, field.field)) })
2288
2377
  ] }) : null,
2289
- generic && !invalid.length ? /* @__PURE__ */ jsx12(CoreErrorAlert, { error }) : null,
2290
- /* @__PURE__ */ jsx12(SimpleGrid, { columns: { base: 1, lg: 2 }, gapX: "16px", gapY: "15px", children: items.map((item) => {
2378
+ generic && !invalid.length ? /* @__PURE__ */ jsx13(CoreErrorAlert, { error }) : null,
2379
+ /* @__PURE__ */ jsx13(SimpleGrid, { columns: { base: 1, lg: 2 }, gapX: "16px", gapY: "15px", children: items.map((item) => {
2291
2380
  if (item.type === "field") return renderField(item.field);
2292
2381
  const first = item.fields[0];
2293
2382
  const inline = item.fields.some((field) => field.inline !== false);
2294
2383
  return /* @__PURE__ */ jsxs8(Box7, { gridColumn: "1 / -1", p: "12px", bg: "#FAFCFD", borderWidth: "1px", borderColor: "#E5E9ED", borderRadius: "9px", children: [
2295
- /* @__PURE__ */ jsx12(Text8, { color: "#344054", fontSize: "11px", fontWeight: "700", children: first.groupLabel ?? item.id }),
2296
- first.groupDescription ? /* @__PURE__ */ jsx12(Text8, { mt: "2px", mb: "10px", color: "#667085", fontSize: "10px", children: first.groupDescription }) : /* @__PURE__ */ jsx12(Box7, { h: "8px" }),
2297
- /* @__PURE__ */ jsx12(Flex5, { direction: inline ? "row" : "column", wrap: "wrap", gap: "9px", children: item.fields.map((field) => renderField(field, true)) })
2384
+ /* @__PURE__ */ jsx13(Text8, { color: "#344054", fontSize: "11px", fontWeight: "700", children: first.groupLabel ?? item.id }),
2385
+ first.groupDescription ? /* @__PURE__ */ jsx13(Text8, { mt: "2px", mb: "10px", color: "#667085", fontSize: "10px", children: first.groupDescription }) : /* @__PURE__ */ jsx13(Box7, { h: "8px" }),
2386
+ /* @__PURE__ */ jsx13(Flex5, { direction: inline ? "row" : "column", wrap: "wrap", gap: "9px", children: item.fields.map((field) => renderField(field, true)) })
2298
2387
  ] }, item.id);
2299
2388
  }) })
2300
2389
  ] }) }),
2301
2390
  /* @__PURE__ */ jsxs8(Flex5, { minH: "68px", px: "20px", py: "14px", justify: "flex-end", gap: "9px", borderTopWidth: "1px", borderColor: "#E5E9ED", children: [
2302
- /* @__PURE__ */ jsx12(Button5, { type: "button", minH: "35px", px: "13px", color: "#475467", bg: "white", borderWidth: "1px", borderColor: "#D5DDE3", borderRadius: "6px", fontSize: "11px", fontWeight: "600", disabled: submitting, onClick: onCancel, children: "Cancelar" }),
2391
+ /* @__PURE__ */ jsx13(Button5, { type: "button", minH: "35px", px: "13px", color: "#475467", bg: "white", borderWidth: "1px", borderColor: "#D5DDE3", borderRadius: "6px", fontSize: "11px", fontWeight: "600", disabled: submitting, onClick: onCancel, children: "Cancelar" }),
2303
2392
  /* @__PURE__ */ jsxs8(Button5, { type: "submit", minH: "35px", px: "13px", colorPalette: "brand", borderRadius: "6px", fontSize: "11px", fontWeight: "600", loading: submitting, children: [
2304
- /* @__PURE__ */ jsx12(CheckIcon, {}),
2393
+ /* @__PURE__ */ jsx13(CheckIcon, {}),
2305
2394
  " Salvar"
2306
2395
  ] })
2307
2396
  ] })
@@ -2310,12 +2399,12 @@ function DynamicForm({ title, eyebrow = "Cadastro", fields: rawFields, initialVa
2310
2399
  }
2311
2400
 
2312
2401
  // src/components/internal/CoreDetailModal.tsx
2313
- import { useEffect as useEffect8, useMemo as useMemo7, useRef as useRef2, useState as useState11 } from "react";
2402
+ import { useEffect as useEffect8, useMemo as useMemo8, useRef as useRef2, useState as useState12 } from "react";
2314
2403
  import { Box as Box12, Button as Button9, Flex as Flex8, Heading as Heading4, IconButton as IconButton2, Text as Text13 } from "@chakra-ui/react";
2315
- import { useQuery as useQuery6, useQueryClient as useQueryClient2 } from "@tanstack/react-query";
2404
+ import { useQuery as useQuery6, useQueryClient as useQueryClient3 } from "@tanstack/react-query";
2316
2405
 
2317
2406
  // src/components/internal/CoreTabbedDetail.tsx
2318
- import { useEffect as useEffect7, useMemo as useMemo6, useState as useState10 } from "react";
2407
+ import { useEffect as useEffect7, useMemo as useMemo7, useState as useState11 } from "react";
2319
2408
  import { Box as Box11, Button as Button8, Flex as Flex7, Input as Input5, NativeSelect as NativeSelect3, SimpleGrid as SimpleGrid3, Stack as Stack3, Text as Text12, Textarea as Textarea2 } from "@chakra-ui/react";
2320
2409
 
2321
2410
  // src/components/internal/CoreSummaryCards.tsx
@@ -2349,7 +2438,7 @@ function resolveInitialDetailTab(config, recordId, initialTab) {
2349
2438
  }
2350
2439
 
2351
2440
  // src/components/internal/CoreSummaryCards.tsx
2352
- import { Fragment as Fragment2, jsx as jsx13, jsxs as jsxs9 } from "react/jsx-runtime";
2441
+ import { Fragment as Fragment2, jsx as jsx14, jsxs as jsxs9 } from "react/jsx-runtime";
2353
2442
  function format(value2, format2) {
2354
2443
  if (format2 === "currency") return new Intl.NumberFormat("pt-BR", { style: "currency", currency: "BRL" }).format(Number(value2 ?? 0));
2355
2444
  if (format2 === "percent") return `${Number(value2 ?? 0).toLocaleString("pt-BR")}%`;
@@ -2365,26 +2454,26 @@ function RelatedMetric({ card, relation, parent }) {
2365
2454
  let value2 = rows.length;
2366
2455
  if (card.source === "relatedSum") value2 = rows.reduce((sum, row) => sum + Number(row[card.field ?? ""] ?? 0), 0);
2367
2456
  if (card.source === "relatedAvg") value2 = rows.length ? rows.reduce((sum, row) => sum + Number(row[card.field ?? ""] ?? 0), 0) / rows.length : 0;
2368
- return /* @__PURE__ */ jsx13(Fragment2, { children: query.isLoading ? "..." : format(value2, card.format) });
2457
+ return /* @__PURE__ */ jsx14(Fragment2, { children: query.isLoading ? "..." : format(value2, card.format) });
2369
2458
  }
2370
2459
  function CoreSummaryCards({ cards = [], parent, relations }) {
2371
- return /* @__PURE__ */ jsx13(SimpleGrid2, { columns: { base: 1, md: 3 }, gap: 3, children: cards.map((card, index) => {
2460
+ return /* @__PURE__ */ jsx14(SimpleGrid2, { columns: { base: 1, md: 3 }, gap: 3, children: cards.map((card, index) => {
2372
2461
  const relation = card.relation ? relationFrom(card.relation, relations) : void 0;
2373
- const content = relation && card.source?.startsWith("related") ? /* @__PURE__ */ jsx13(RelatedMetric, { card, relation, parent }) : format(parent[card.field ?? ""], card.format);
2462
+ const content = relation && card.source?.startsWith("related") ? /* @__PURE__ */ jsx14(RelatedMetric, { card, relation, parent }) : format(parent[card.field ?? ""], card.format);
2374
2463
  return /* @__PURE__ */ jsxs9(Box8, { p: "14px", bg: "white", borderWidth: "1px", borderColor: "#E5E9ED", borderRadius: "10px", children: [
2375
- /* @__PURE__ */ jsx13(Text9, { color: "#667085", fontSize: "10px", fontWeight: "600", children: card.label }),
2376
- /* @__PURE__ */ jsx13(Text9, { mt: "6px", color: "#24323A", fontSize: "20px", fontWeight: "700", children: card.format === "badge" ? /* @__PURE__ */ jsx13(Badge2, { children: content }) : content })
2464
+ /* @__PURE__ */ jsx14(Text9, { color: "#667085", fontSize: "10px", fontWeight: "600", children: card.label }),
2465
+ /* @__PURE__ */ jsx14(Text9, { mt: "6px", color: "#24323A", fontSize: "20px", fontWeight: "700", children: card.format === "badge" ? /* @__PURE__ */ jsx14(Badge2, { children: content }) : content })
2377
2466
  ] }, `${card.label}-${index}`);
2378
2467
  }) });
2379
2468
  }
2380
2469
 
2381
2470
  // src/components/internal/CoreRelatedGrid.tsx
2382
- import { useMemo as useMemo5, useState as useState9 } from "react";
2471
+ import { useMemo as useMemo6, useState as useState10 } from "react";
2383
2472
  import { Badge as Badge3, Box as Box10, Button as Button7, Flex as Flex6, IconButton, Table as Table2, Text as Text11 } from "@chakra-ui/react";
2384
- import { useMutation, useQuery as useQuery5, useQueryClient } from "@tanstack/react-query";
2473
+ import { useMutation, useQuery as useQuery5, useQueryClient as useQueryClient2 } from "@tanstack/react-query";
2385
2474
 
2386
2475
  // src/components/internal/CoreRowAction.tsx
2387
- import { useState as useState8 } from "react";
2476
+ import { useState as useState9 } from "react";
2388
2477
  import { Box as Box9, Button as Button6, Text as Text10 } from "@chakra-ui/react";
2389
2478
 
2390
2479
  // src/components/internal/conditions.ts
@@ -2420,18 +2509,18 @@ function interpolateEndpoint(endpoint, row, parent) {
2420
2509
  }
2421
2510
 
2422
2511
  // src/components/internal/DetailRecordContext.tsx
2423
- import { createContext as createContext4, useContext as useContext4 } from "react";
2424
- import { jsx as jsx14 } from "react/jsx-runtime";
2425
- var DetailRecordContext = createContext4(null);
2512
+ import { createContext as createContext5, useContext as useContext5 } from "react";
2513
+ import { jsx as jsx15 } from "react/jsx-runtime";
2514
+ var DetailRecordContext = createContext5(null);
2426
2515
  function DetailRecordProvider({
2427
2516
  record,
2428
2517
  setRecord,
2429
2518
  children
2430
2519
  }) {
2431
- return /* @__PURE__ */ jsx14(DetailRecordContext.Provider, { value: { record, setRecord }, children });
2520
+ return /* @__PURE__ */ jsx15(DetailRecordContext.Provider, { value: { record, setRecord }, children });
2432
2521
  }
2433
2522
  function useDetailRecord() {
2434
- return useContext4(DetailRecordContext);
2523
+ return useContext5(DetailRecordContext);
2435
2524
  }
2436
2525
  function mergeDetailRecord(current, saved, changes = {}) {
2437
2526
  const savedRecord = saved && typeof saved === "object" ? saved : {};
@@ -2439,7 +2528,7 @@ function mergeDetailRecord(current, saved, changes = {}) {
2439
2528
  }
2440
2529
 
2441
2530
  // src/components/internal/CoreRowAction.tsx
2442
- import { jsx as jsx15, jsxs as jsxs10 } from "react/jsx-runtime";
2531
+ import { jsx as jsx16, jsxs as jsxs10 } from "react/jsx-runtime";
2443
2532
  var ACTION_TONES = {
2444
2533
  success: { bg: "#DCFCE7", color: "#166534", border: "#BBF7D0", hover: "#D1FAE5" },
2445
2534
  danger: { bg: "#FEE2E2", color: "#991B1B", border: "#FECACA", hover: "#FDE2E2" },
@@ -2461,8 +2550,8 @@ function ActionErrorMessage({ error }) {
2461
2550
  borderColor: "#FECDCA",
2462
2551
  borderRadius: "6px",
2463
2552
  children: [
2464
- /* @__PURE__ */ jsx15(Text10, { color: "#B42318", fontSize: "10px", fontWeight: "600", lineHeight: "1.35", children: description.message }),
2465
- description.context ? /* @__PURE__ */ jsx15(Text10, { mt: "2px", color: "#7A271A", fontSize: "9px", lineHeight: "1.35", children: description.context }) : null
2553
+ /* @__PURE__ */ jsx16(Text10, { color: "#B42318", fontSize: "10px", fontWeight: "600", lineHeight: "1.35", children: description.message }),
2554
+ description.context ? /* @__PURE__ */ jsx16(Text10, { mt: "2px", color: "#7A271A", fontSize: "9px", lineHeight: "1.35", children: description.context }) : null
2466
2555
  ]
2467
2556
  }
2468
2557
  );
@@ -2490,11 +2579,11 @@ function RowActionIcon({ name }) {
2490
2579
  strokeLinecap: "round",
2491
2580
  strokeLinejoin: "round",
2492
2581
  children: [
2493
- /* @__PURE__ */ jsx15("path", { d: "M3 6h18" }),
2494
- /* @__PURE__ */ jsx15("path", { d: "M8 6V4h8v2" }),
2495
- /* @__PURE__ */ jsx15("path", { d: "M19 6l-1 14H6L5 6" }),
2496
- /* @__PURE__ */ jsx15("path", { d: "M10 11v5" }),
2497
- /* @__PURE__ */ jsx15("path", { d: "M14 11v5" })
2582
+ /* @__PURE__ */ jsx16("path", { d: "M3 6h18" }),
2583
+ /* @__PURE__ */ jsx16("path", { d: "M8 6V4h8v2" }),
2584
+ /* @__PURE__ */ jsx16("path", { d: "M19 6l-1 14H6L5 6" }),
2585
+ /* @__PURE__ */ jsx16("path", { d: "M10 11v5" }),
2586
+ /* @__PURE__ */ jsx16("path", { d: "M14 11v5" })
2498
2587
  ]
2499
2588
  }
2500
2589
  );
@@ -2524,15 +2613,15 @@ function CoreRowAction({ action, row, parent, onOpenDetail, onRefresh, onUpdate
2524
2613
  const { http } = useOonApi();
2525
2614
  const detailRecord = useDetailRecord();
2526
2615
  const effectiveRow = detailRecord?.record ?? row;
2527
- const [loading, setLoading] = useState8(false);
2528
- const [error, setError] = useState8(null);
2529
- const [formOpen, setFormOpen] = useState8(false);
2530
- const [formInitialValues, setFormInitialValues] = useState8({});
2616
+ const [loading, setLoading] = useState9(false);
2617
+ const [error, setError] = useState9(null);
2618
+ const [formOpen, setFormOpen] = useState9(false);
2619
+ const [formInitialValues, setFormInitialValues] = useState9({});
2531
2620
  const pipelineAction = action;
2532
2621
  const tone = pipelineAction.tone ? ACTION_TONES[pipelineAction.tone] : void 0;
2533
2622
  const isWorkStatus = pipelineAction.group === "workStatus";
2534
2623
  const isSelected = isWorkStatus && !!pipelineAction.field && effectiveRow[pipelineAction.field] === pipelineAction.value;
2535
- const icon = /* @__PURE__ */ jsx15(RowActionIcon, { name: action.icon });
2624
+ const icon = /* @__PURE__ */ jsx16(RowActionIcon, { name: action.icon });
2536
2625
  const iconOnly = Boolean(action.iconOnly && icon);
2537
2626
  if (evaluateCondition(action.hiddenWhen, effectiveRow)) return null;
2538
2627
  const disabled = evaluateCondition(action.disabledWhen, effectiveRow) || loading;
@@ -2619,14 +2708,14 @@ function CoreRowAction({ action, row, parent, onOpenDetail, onRefresh, onUpdate
2619
2708
  _hover: tone ? { bg: tone.hover, borderColor: tone.border } : void 0,
2620
2709
  _disabled: tone ? { opacity: isSelected ? 1 : 0.55, cursor: "not-allowed" } : void 0,
2621
2710
  children: [
2622
- isWorkStatus ? /* @__PURE__ */ jsx15("span", { "aria-hidden": "true", style: { width: 8, height: 8, display: "inline-block", marginRight: 7, borderRadius: "999px", background: tone?.color ?? "#64748B", boxShadow: isSelected ? "0 0 0 2px rgba(255,255,255,.9)" : "none" } }) : null,
2711
+ isWorkStatus ? /* @__PURE__ */ jsx16("span", { "aria-hidden": "true", style: { width: 8, height: 8, display: "inline-block", marginRight: 7, borderRadius: "999px", background: tone?.color ?? "#64748B", boxShadow: isSelected ? "0 0 0 2px rgba(255,255,255,.9)" : "none" } }) : null,
2623
2712
  icon,
2624
2713
  iconOnly ? null : action.label
2625
2714
  ]
2626
2715
  }
2627
2716
  ),
2628
- error ? /* @__PURE__ */ jsx15(ActionErrorMessage, { error }) : null,
2629
- formOpen && pipelineAction.type === "formAction" ? /* @__PURE__ */ jsx15(
2717
+ error ? /* @__PURE__ */ jsx16(ActionErrorMessage, { error }) : null,
2718
+ formOpen && pipelineAction.type === "formAction" ? /* @__PURE__ */ jsx16(
2630
2719
  DynamicForm,
2631
2720
  {
2632
2721
  title: pipelineAction.title ?? pipelineAction.label,
@@ -2661,17 +2750,17 @@ function CoreRowAction({ action, row, parent, onOpenDetail, onRefresh, onUpdate
2661
2750
  }
2662
2751
 
2663
2752
  // src/components/internal/CoreRelatedGrid.tsx
2664
- import { jsx as jsx16, jsxs as jsxs11 } from "react/jsx-runtime";
2753
+ import { jsx as jsx17, jsxs as jsxs11 } from "react/jsx-runtime";
2665
2754
  function EditIcon2() {
2666
2755
  return /* @__PURE__ */ jsxs11("svg", { viewBox: "0 0 20 20", width: "15", height: "15", "aria-hidden": "true", children: [
2667
- /* @__PURE__ */ jsx16("path", { d: "M4 14.5V16h1.5L14.7 6.8l-1.5-1.5L4 14.5Z", fill: "none", stroke: "currentColor", strokeWidth: "1.45", strokeLinejoin: "round" }),
2668
- /* @__PURE__ */ jsx16("path", { d: "m12.5 6 1.5-1.5a1.05 1.05 0 0 1 1.5 0l.1.1a1.05 1.05 0 0 1 0 1.5L14.1 7.6", fill: "none", stroke: "currentColor", strokeWidth: "1.45", strokeLinecap: "round" })
2756
+ /* @__PURE__ */ jsx17("path", { d: "M4 14.5V16h1.5L14.7 6.8l-1.5-1.5L4 14.5Z", fill: "none", stroke: "currentColor", strokeWidth: "1.45", strokeLinejoin: "round" }),
2757
+ /* @__PURE__ */ jsx17("path", { d: "m12.5 6 1.5-1.5a1.05 1.05 0 0 1 1.5 0l.1.1a1.05 1.05 0 0 1 0 1.5L14.1 7.6", fill: "none", stroke: "currentColor", strokeWidth: "1.45", strokeLinecap: "round" })
2669
2758
  ] });
2670
2759
  }
2671
2760
  function TrashIcon2() {
2672
2761
  return /* @__PURE__ */ jsxs11("svg", { viewBox: "0 0 20 20", width: "15", height: "15", "aria-hidden": "true", children: [
2673
- /* @__PURE__ */ jsx16("path", { d: "M5.5 6.5h9l-.6 9H6.1l-.6-9Zm2-2h5l.7 2H6.8l.7-2Z", fill: "none", stroke: "currentColor", strokeWidth: "1.35", strokeLinejoin: "round" }),
2674
- /* @__PURE__ */ jsx16("path", { d: "M4.5 6.5h11", fill: "none", stroke: "currentColor", strokeWidth: "1.35", strokeLinecap: "round" })
2762
+ /* @__PURE__ */ jsx17("path", { d: "M5.5 6.5h9l-.6 9H6.1l-.6-9Zm2-2h5l.7 2H6.8l.7-2Z", fill: "none", stroke: "currentColor", strokeWidth: "1.35", strokeLinejoin: "round" }),
2763
+ /* @__PURE__ */ jsx17("path", { d: "M4.5 6.5h11", fill: "none", stroke: "currentColor", strokeWidth: "1.35", strokeLinecap: "round" })
2675
2764
  ] });
2676
2765
  }
2677
2766
  function parentValueAt(parent, path) {
@@ -2714,7 +2803,7 @@ function CoreRelatedGrid({
2714
2803
  const schemaQuery = useModelSchema(relation?.model ?? "");
2715
2804
  const schema = schemaQuery.data;
2716
2805
  const resource = useOonResource(schema?.basePath ?? `/${relation?.model?.toLowerCase() ?? "related"}s`);
2717
- const queryClient = useQueryClient();
2806
+ const queryClient = useQueryClient2();
2718
2807
  const parentValue = relation ? parent[relation.parentKey ?? "_id"] : void 0;
2719
2808
  const key = ["oon", "related", relation?.model, relation?.foreignKey, parentValue, refreshToken];
2720
2809
  const query = useQuery5({
@@ -2722,29 +2811,29 @@ function CoreRelatedGrid({
2722
2811
  enabled: !!relation && parentValue != null,
2723
2812
  queryFn: () => resource.list({ [relation.foreignKey]: parentValue, pageSize: 1e3 })
2724
2813
  });
2725
- const columns = useMemo5(
2814
+ const columns = useMemo6(
2726
2815
  () => (tab.columns?.length ? tab.columns : schema?.fields.slice(0, 8).map((field) => field.name) ?? []).map((column) => normalizeColumn(column, schema)).filter((column) => !column.hidden),
2727
2816
  [tab.columns, schema]
2728
2817
  );
2729
- const schemaFormFields = useMemo5(() => formFieldsFromMeta(schema?.fields ?? []), [schema?.fields]);
2730
- const createFields = useMemo5(
2818
+ const schemaFormFields = useMemo6(() => formFieldsFromMeta(schema?.fields ?? []), [schema?.fields]);
2819
+ const createFields = useMemo6(
2731
2820
  () => mergeCreateFields(schemaFormFields, tab.create?.fields, relation?.foreignKey),
2732
2821
  [schemaFormFields, tab.create?.fields, relation?.foreignKey]
2733
2822
  );
2734
- const editFields = useMemo5(
2823
+ const editFields = useMemo6(
2735
2824
  () => modalEditFields(schemaFormFields, tab, createFields, relation?.foreignKey),
2736
2825
  [schemaFormFields, tab, createFields, relation?.foreignKey]
2737
2826
  );
2738
- const createInitialValues = useMemo5(() => {
2827
+ const createInitialValues = useMemo6(() => {
2739
2828
  const inherited = Object.fromEntries(
2740
2829
  Object.entries(tab.create?.initialValuesFromParent ?? {}).map(([field, path]) => [field, parentValueAt(parent, path)])
2741
2830
  );
2742
2831
  return { ...tab.create?.initialValues ?? {}, ...inherited };
2743
2832
  }, [tab.create?.initialValues, tab.create?.initialValuesFromParent, parent]);
2744
- const [creating, setCreating] = useState9(false);
2745
- const [createError, setCreateError] = useState9(null);
2746
- const [editing, setEditing] = useState9(null);
2747
- const [editError, setEditError] = useState9(null);
2833
+ const [creating, setCreating] = useState10(false);
2834
+ const [createError, setCreateError] = useState10(null);
2835
+ const [editing, setEditing] = useState10(null);
2836
+ const [editError, setEditError] = useState10(null);
2748
2837
  const canEdit = tab.type === "relatedGrid" && tab.editable === true;
2749
2838
  const canCreate = tab.type === "relatedGrid" && tab.create?.enabled !== false && !!tab.create;
2750
2839
  const canDelete = tab.type === "relatedGrid" && tab.delete?.enabled === true;
@@ -2779,18 +2868,18 @@ function CoreRelatedGrid({
2779
2868
  mutationFn: (id) => resource.delete(id),
2780
2869
  onSuccess: invalidate
2781
2870
  });
2782
- if (!relation) return /* @__PURE__ */ jsx16(Text11, { color: "#B42318", children: "Rela\xE7\xE3o n\xE3o encontrada." });
2783
- if (query.isLoading || schemaQuery.isLoading) return /* @__PURE__ */ jsx16(Text11, { color: "#667085", children: "Carregando..." });
2871
+ if (!relation) return /* @__PURE__ */ jsx17(Text11, { color: "#B42318", children: "Rela\xE7\xE3o n\xE3o encontrada." });
2872
+ if (query.isLoading || schemaQuery.isLoading) return /* @__PURE__ */ jsx17(Text11, { color: "#667085", children: "Carregando..." });
2784
2873
  const rows = query.data?.results ?? [];
2785
2874
  return /* @__PURE__ */ jsxs11(Box10, { children: [
2786
- canCreate ? /* @__PURE__ */ jsx16(Flex6, { justify: "flex-end", mb: "10px", children: /* @__PURE__ */ jsx16(Button7, { size: "sm", colorPalette: "brand", onClick: () => {
2875
+ canCreate ? /* @__PURE__ */ jsx17(Flex6, { justify: "flex-end", mb: "10px", children: /* @__PURE__ */ jsx17(Button7, { size: "sm", colorPalette: "brand", onClick: () => {
2787
2876
  setCreateError(null);
2788
2877
  setCreating(true);
2789
2878
  }, children: tab.create?.label ?? "Novo registro" }) }) : null,
2790
- /* @__PURE__ */ jsx16(Box10, { overflowX: "auto", borderWidth: "1px", borderColor: "#E5E9ED", borderRadius: "10px", children: /* @__PURE__ */ jsxs11(Table2.Root, { size: "sm", minW: "760px", children: [
2791
- /* @__PURE__ */ jsx16(Table2.Header, { children: /* @__PURE__ */ jsxs11(Table2.Row, { bg: "#F4F7F9", children: [
2792
- columns.map((column) => /* @__PURE__ */ jsx16(Table2.ColumnHeader, { fontSize: "10px", children: column.label ?? column.field }, column.field)),
2793
- hasActions ? /* @__PURE__ */ jsx16(Table2.ColumnHeader, { w: "92px", textAlign: "center", children: "A\xE7\xF5es" }) : null
2879
+ /* @__PURE__ */ jsx17(Box10, { overflowX: "auto", borderWidth: "1px", borderColor: "#E5E9ED", borderRadius: "10px", children: /* @__PURE__ */ jsxs11(Table2.Root, { size: "sm", minW: "760px", children: [
2880
+ /* @__PURE__ */ jsx17(Table2.Header, { children: /* @__PURE__ */ jsxs11(Table2.Row, { bg: "#F4F7F9", children: [
2881
+ columns.map((column) => /* @__PURE__ */ jsx17(Table2.ColumnHeader, { fontSize: "10px", children: column.label ?? column.field }, column.field)),
2882
+ hasActions ? /* @__PURE__ */ jsx17(Table2.ColumnHeader, { w: "92px", textAlign: "center", children: "A\xE7\xF5es" }) : null
2794
2883
  ] }) }),
2795
2884
  /* @__PURE__ */ jsxs11(Table2.Body, { children: [
2796
2885
  rows.map((row, index) => {
@@ -2798,10 +2887,10 @@ function CoreRelatedGrid({
2798
2887
  return /* @__PURE__ */ jsxs11(Table2.Row, { bg: index % 2 ? "#FBFCFD" : "white", _hover: { bg: "#F0F7FF" }, children: [
2799
2888
  columns.map((column) => {
2800
2889
  const value2 = row[column.field];
2801
- return /* @__PURE__ */ jsx16(Table2.Cell, { fontSize: "11px", children: column.display === "badgeExists" ? /* @__PURE__ */ jsx16(Badge3, { colorPalette: value2 ? "green" : "gray", children: value2 ? "Sim" : "N\xE3o" }) : formatCell(value2, column.kind) }, column.field);
2890
+ return /* @__PURE__ */ jsx17(Table2.Cell, { fontSize: "11px", children: column.display === "badgeExists" ? /* @__PURE__ */ jsx17(Badge3, { colorPalette: value2 ? "green" : "gray", children: value2 ? "Sim" : "N\xE3o" }) : formatCell(value2, column.kind) }, column.field);
2802
2891
  }),
2803
- hasActions ? /* @__PURE__ */ jsx16(Table2.Cell, { children: /* @__PURE__ */ jsxs11(Flex6, { gap: "4px", align: "center", justify: "center", wrap: "wrap", children: [
2804
- canEdit ? /* @__PURE__ */ jsx16(
2892
+ hasActions ? /* @__PURE__ */ jsx17(Table2.Cell, { children: /* @__PURE__ */ jsxs11(Flex6, { gap: "4px", align: "center", justify: "center", wrap: "wrap", children: [
2893
+ canEdit ? /* @__PURE__ */ jsx17(
2805
2894
  IconButton,
2806
2895
  {
2807
2896
  "aria-label": "Editar registro",
@@ -2813,11 +2902,11 @@ function CoreRelatedGrid({
2813
2902
  setEditError(null);
2814
2903
  setEditing(row);
2815
2904
  },
2816
- children: /* @__PURE__ */ jsx16(EditIcon2, {})
2905
+ children: /* @__PURE__ */ jsx17(EditIcon2, {})
2817
2906
  }
2818
2907
  ) : null,
2819
- tab.rowActions?.map((action) => /* @__PURE__ */ jsx16(CoreRowAction, { action, row, parent, onRefresh }, action.id ?? action.label)),
2820
- canDelete ? /* @__PURE__ */ jsx16(
2908
+ tab.rowActions?.map((action) => /* @__PURE__ */ jsx17(CoreRowAction, { action, row, parent, onRefresh }, action.id ?? action.label)),
2909
+ canDelete ? /* @__PURE__ */ jsx17(
2821
2910
  IconButton,
2822
2911
  {
2823
2912
  "aria-label": "Excluir registro",
@@ -2830,16 +2919,16 @@ function CoreRelatedGrid({
2830
2919
  const message = tab.delete?.confirm ?? "Excluir este registro relacionado?";
2831
2920
  if (window.confirm(message)) deleteMutation.mutate(id);
2832
2921
  },
2833
- children: /* @__PURE__ */ jsx16(TrashIcon2, {})
2922
+ children: /* @__PURE__ */ jsx17(TrashIcon2, {})
2834
2923
  }
2835
2924
  ) : null
2836
2925
  ] }) }) : null
2837
2926
  ] }, id);
2838
2927
  }),
2839
- rows.length === 0 ? /* @__PURE__ */ jsx16(Table2.Row, { children: /* @__PURE__ */ jsx16(Table2.Cell, { colSpan: columns.length + (hasActions ? 1 : 0), children: /* @__PURE__ */ jsx16(Text11, { p: "8", textAlign: "center", color: "#98A2B3", children: "Nenhum registro relacionado." }) }) }) : null
2928
+ rows.length === 0 ? /* @__PURE__ */ jsx17(Table2.Row, { children: /* @__PURE__ */ jsx17(Table2.Cell, { colSpan: columns.length + (hasActions ? 1 : 0), children: /* @__PURE__ */ jsx17(Text11, { p: "8", textAlign: "center", color: "#98A2B3", children: "Nenhum registro relacionado." }) }) }) : null
2840
2929
  ] })
2841
2930
  ] }) }),
2842
- creating ? /* @__PURE__ */ jsx16(
2931
+ creating ? /* @__PURE__ */ jsx17(
2843
2932
  DynamicForm,
2844
2933
  {
2845
2934
  title: tab.create?.label ?? `Novo ${schema?.singular ?? relation.model}`,
@@ -2855,7 +2944,7 @@ function CoreRelatedGrid({
2855
2944
  }
2856
2945
  }
2857
2946
  ) : null,
2858
- editing ? /* @__PURE__ */ jsx16(
2947
+ editing ? /* @__PURE__ */ jsx17(
2859
2948
  DynamicForm,
2860
2949
  {
2861
2950
  title: `Editar ${schema?.singular ?? relation.model}`,
@@ -2878,7 +2967,7 @@ function CoreRelatedGrid({
2878
2967
  }
2879
2968
 
2880
2969
  // src/components/internal/CoreTabbedDetail.tsx
2881
- import { jsx as jsx17, jsxs as jsxs12 } from "react/jsx-runtime";
2970
+ import { jsx as jsx18, jsxs as jsxs12 } from "react/jsx-runtime";
2882
2971
  function toValue2(value2, kind) {
2883
2972
  if (value2 == null) return "";
2884
2973
  if (kind === "date") {
@@ -2950,14 +3039,14 @@ function resolveReference2(field, values) {
2950
3039
  function FieldLabel({ field, htmlFor }) {
2951
3040
  const label = fieldLabel({ name: field.field, label: field.label });
2952
3041
  const readonly = Boolean(field.readonly || field.computed);
2953
- return /* @__PURE__ */ jsx17("label", { htmlFor, children: /* @__PURE__ */ jsxs12(Text12, { as: "span", display: "block", mb: "5px", color: "#475467", fontSize: "11px", fontWeight: "600", children: [
3042
+ return /* @__PURE__ */ jsx18("label", { htmlFor, children: /* @__PURE__ */ jsxs12(Text12, { as: "span", display: "block", mb: "5px", color: "#475467", fontSize: "11px", fontWeight: "600", children: [
2954
3043
  label,
2955
- field.required && !readonly ? /* @__PURE__ */ jsx17(Text12, { as: "span", color: "#DC2626", children: " *" }) : null,
2956
- readonly ? /* @__PURE__ */ jsx17(Text12, { as: "span", ml: "5px", color: "#98A2B3", fontSize: "9px", fontWeight: "500", children: "somente leitura" }) : null
3044
+ field.required && !readonly ? /* @__PURE__ */ jsx18(Text12, { as: "span", color: "#DC2626", children: " *" }) : null,
3045
+ readonly ? /* @__PURE__ */ jsx18(Text12, { as: "span", ml: "5px", color: "#98A2B3", fontSize: "9px", fontWeight: "500", children: "somente leitura" }) : null
2957
3046
  ] }) });
2958
3047
  }
2959
3048
  function ErrorText2({ id, message }) {
2960
- return message ? /* @__PURE__ */ jsx17(Text12, { id, role: "alert", mt: "5px", color: "#DC2626", fontSize: "10px", fontWeight: "500", children: message }) : null;
3049
+ return message ? /* @__PURE__ */ jsx18(Text12, { id, role: "alert", mt: "5px", color: "#DC2626", fontSize: "10px", fontWeight: "500", children: message }) : null;
2961
3050
  }
2962
3051
  function FieldControl({
2963
3052
  field,
@@ -2999,7 +3088,7 @@ function FieldControl({
2999
3088
  borderRadius: "7px",
3000
3089
  cursor: readonly ? "not-allowed" : "pointer",
3001
3090
  children: [
3002
- /* @__PURE__ */ jsx17(
3091
+ /* @__PURE__ */ jsx18(
3003
3092
  "input",
3004
3093
  {
3005
3094
  id: inputId,
@@ -3012,18 +3101,18 @@ function FieldControl({
3012
3101
  onChange: (event) => onChange(event.currentTarget.checked ? checkedValue : uncheckedValue)
3013
3102
  }
3014
3103
  ),
3015
- /* @__PURE__ */ jsx17(Text12, { as: "span", fontSize: "11px", fontWeight: "600", children: label })
3104
+ /* @__PURE__ */ jsx18(Text12, { as: "span", fontSize: "11px", fontWeight: "600", children: label })
3016
3105
  ]
3017
3106
  }
3018
3107
  ),
3019
- /* @__PURE__ */ jsx17(ErrorText2, { id: errorId, message: error })
3108
+ /* @__PURE__ */ jsx18(ErrorText2, { id: errorId, message: error })
3020
3109
  ] });
3021
3110
  }
3022
3111
  if (field.kind === "ref" && field.ref) {
3023
3112
  const reference = resolveReference2(field, values);
3024
3113
  return /* @__PURE__ */ jsxs12(Box11, { children: [
3025
- /* @__PURE__ */ jsx17(FieldLabel, { field, htmlFor: inputId }),
3026
- /* @__PURE__ */ jsx17(
3114
+ /* @__PURE__ */ jsx18(FieldLabel, { field, htmlFor: inputId }),
3115
+ /* @__PURE__ */ jsx18(
3027
3116
  ReferenceSelect,
3028
3117
  {
3029
3118
  field: field.field,
@@ -3048,18 +3137,18 @@ function FieldControl({
3048
3137
  const mask = resolveInputMask(field);
3049
3138
  const control = field.kind === "enum" && field.options?.length ? /* @__PURE__ */ jsxs12(NativeSelect3.Root, { size: "sm", disabled: readonly, children: [
3050
3139
  /* @__PURE__ */ jsxs12(NativeSelect3.Field, { id: inputId, value: value2, ...invalidProps, onChange: (event) => onChange(event.currentTarget.value), children: [
3051
- /* @__PURE__ */ jsx17("option", { value: "", children: "\u2014 Selecione \u2014" }),
3052
- field.options.map((option) => /* @__PURE__ */ jsx17("option", { value: option, children: option }, option))
3140
+ /* @__PURE__ */ jsx18("option", { value: "", children: "\u2014 Selecione \u2014" }),
3141
+ field.options.map((option) => /* @__PURE__ */ jsx18("option", { value: option, children: option }, option))
3053
3142
  ] }),
3054
- /* @__PURE__ */ jsx17(NativeSelect3.Indicator, {})
3143
+ /* @__PURE__ */ jsx18(NativeSelect3.Indicator, {})
3055
3144
  ] }) : field.kind === "boolean" ? /* @__PURE__ */ jsxs12(NativeSelect3.Root, { size: "sm", disabled: readonly, children: [
3056
3145
  /* @__PURE__ */ jsxs12(NativeSelect3.Field, { id: inputId, value: value2, ...invalidProps, onChange: (event) => onChange(event.currentTarget.value), children: [
3057
- /* @__PURE__ */ jsx17("option", { value: "", children: "\u2014 Selecione \u2014" }),
3058
- /* @__PURE__ */ jsx17("option", { value: "true", children: "Sim" }),
3059
- /* @__PURE__ */ jsx17("option", { value: "false", children: "N\xE3o" })
3146
+ /* @__PURE__ */ jsx18("option", { value: "", children: "\u2014 Selecione \u2014" }),
3147
+ /* @__PURE__ */ jsx18("option", { value: "true", children: "Sim" }),
3148
+ /* @__PURE__ */ jsx18("option", { value: "false", children: "N\xE3o" })
3060
3149
  ] }),
3061
- /* @__PURE__ */ jsx17(NativeSelect3.Indicator, {})
3062
- ] }) : isMultiline2(field) ? /* @__PURE__ */ jsx17(Textarea2, { id: inputId, rows: 4, resize: "vertical", readOnly: readonly, value: value2, ...invalidProps, onChange: (event) => onChange(event.currentTarget.value) }) : /* @__PURE__ */ jsx17(
3150
+ /* @__PURE__ */ jsx18(NativeSelect3.Indicator, {})
3151
+ ] }) : isMultiline2(field) ? /* @__PURE__ */ jsx18(Textarea2, { id: inputId, rows: 4, resize: "vertical", readOnly: readonly, value: value2, ...invalidProps, onChange: (event) => onChange(event.currentTarget.value) }) : /* @__PURE__ */ jsx18(
3063
3152
  Input5,
3064
3153
  {
3065
3154
  id: inputId,
@@ -3075,9 +3164,9 @@ function FieldControl({
3075
3164
  }
3076
3165
  );
3077
3166
  return /* @__PURE__ */ jsxs12(Box11, { children: [
3078
- /* @__PURE__ */ jsx17(FieldLabel, { field, htmlFor: inputId }),
3167
+ /* @__PURE__ */ jsx18(FieldLabel, { field, htmlFor: inputId }),
3079
3168
  control,
3080
- /* @__PURE__ */ jsx17(ErrorText2, { id: errorId, message: error })
3169
+ /* @__PURE__ */ jsx18(ErrorText2, { id: errorId, message: error })
3081
3170
  ] });
3082
3171
  }
3083
3172
  function GroupSection({
@@ -3091,9 +3180,9 @@ function GroupSection({
3091
3180
  if (!fields.length) return null;
3092
3181
  const columns = group.columns ?? 2;
3093
3182
  return /* @__PURE__ */ jsxs12(Box11, { p: { base: "12px", md: "14px" }, bg: "#FAFCFD", borderWidth: "1px", borderColor: "#E5E9ED", borderRadius: "9px", children: [
3094
- /* @__PURE__ */ jsx17(Text12, { color: "#344054", fontSize: "12px", fontWeight: "700", children: group.label }),
3095
- group.description ? /* @__PURE__ */ jsx17(Text12, { mt: "2px", mb: "12px", color: "#667085", fontSize: "10px", children: group.description }) : /* @__PURE__ */ jsx17(Box11, { h: "10px" }),
3096
- /* @__PURE__ */ jsx17(SimpleGrid3, { columns: { base: 1, md: Math.min(columns, 2), xl: columns }, gapX: "16px", gapY: "14px", children: fields.map((field) => /* @__PURE__ */ jsx17(
3183
+ /* @__PURE__ */ jsx18(Text12, { color: "#344054", fontSize: "12px", fontWeight: "700", children: group.label }),
3184
+ group.description ? /* @__PURE__ */ jsx18(Text12, { mt: "2px", mb: "12px", color: "#667085", fontSize: "10px", children: group.description }) : /* @__PURE__ */ jsx18(Box11, { h: "10px" }),
3185
+ /* @__PURE__ */ jsx18(SimpleGrid3, { columns: { base: 1, md: Math.min(columns, 2), xl: columns }, gapX: "16px", gapY: "14px", children: fields.map((field) => /* @__PURE__ */ jsx18(
3097
3186
  FieldControl,
3098
3187
  {
3099
3188
  field,
@@ -3133,12 +3222,12 @@ function InlineParentForm({
3133
3222
  }) {
3134
3223
  const fields = rawFields;
3135
3224
  const visibleFields = rawVisibleFields ?? rawFields;
3136
- const initial = useMemo6(() => initialReactiveValues2(fields, parent), [rawFields, parent]);
3137
- const [values, setValues] = useState10(initial.values);
3138
- const [formulaErrors, setFormulaErrors] = useState10(initial.errors);
3139
- const [saving, setSaving] = useState10(false);
3140
- const [error, setError] = useState10(null);
3141
- const [fieldErrors, setFieldErrors] = useState10({});
3225
+ const initial = useMemo7(() => initialReactiveValues2(fields, parent), [rawFields, parent]);
3226
+ const [values, setValues] = useState11(initial.values);
3227
+ const [formulaErrors, setFormulaErrors] = useState11(initial.errors);
3228
+ const [saving, setSaving] = useState11(false);
3229
+ const [error, setError] = useState11(null);
3230
+ const [fieldErrors, setFieldErrors] = useState11({});
3142
3231
  useEffect7(() => {
3143
3232
  setValues(initial.values);
3144
3233
  setFormulaErrors(initial.errors);
@@ -3146,14 +3235,14 @@ function InlineParentForm({
3146
3235
  setFieldErrors({});
3147
3236
  onDirtyChange?.(false);
3148
3237
  }, [initial, onDirtyChange]);
3149
- const dirty = useMemo6(
3238
+ const dirty = useMemo7(
3150
3239
  () => !formValuesEqual(fields, values, initial.values),
3151
3240
  [fields, values, initial.values]
3152
3241
  );
3153
3242
  useEffect7(() => {
3154
3243
  onDirtyChange?.(dirty);
3155
3244
  }, [dirty, onDirtyChange]);
3156
- const fieldsByName = useMemo6(() => new Map(fields.map((field) => [field.field, field])), [rawFields]);
3245
+ const fieldsByName = useMemo7(() => new Map(fields.map((field) => [field.field, field])), [rawFields]);
3157
3246
  const change = (fieldName, value2) => {
3158
3247
  const selected = fieldsByName.get(fieldName);
3159
3248
  if (selected?.readonly || selected?.computed) return;
@@ -3181,7 +3270,7 @@ function InlineParentForm({
3181
3270
  const combinedErrors = { ...formulaErrors, ...fieldErrors };
3182
3271
  const renderFields = () => {
3183
3272
  if (groups?.length) {
3184
- return /* @__PURE__ */ jsx17(Stack3, { gap: "14px", children: groups.map((group) => /* @__PURE__ */ jsx17(
3273
+ return /* @__PURE__ */ jsx18(Stack3, { gap: "14px", children: groups.map((group) => /* @__PURE__ */ jsx18(
3185
3274
  GroupSection,
3186
3275
  {
3187
3276
  group,
@@ -3194,7 +3283,7 @@ function InlineParentForm({
3194
3283
  `${group.label}-${group.fields.join("-")}`
3195
3284
  )) });
3196
3285
  }
3197
- return /* @__PURE__ */ jsx17(SimpleGrid3, { columns: { base: 1, md: 2 }, gap: "14px", children: visibleFields.map((field) => /* @__PURE__ */ jsx17(
3286
+ return /* @__PURE__ */ jsx18(SimpleGrid3, { columns: { base: 1, md: 2 }, gap: "14px", children: visibleFields.map((field) => /* @__PURE__ */ jsx18(
3198
3287
  FieldControl,
3199
3288
  {
3200
3289
  field,
@@ -3207,7 +3296,7 @@ function InlineParentForm({
3207
3296
  field.field
3208
3297
  )) });
3209
3298
  };
3210
- return /* @__PURE__ */ jsx17(
3299
+ return /* @__PURE__ */ jsx18(
3211
3300
  "form",
3212
3301
  {
3213
3302
  id: formId,
@@ -3238,9 +3327,9 @@ function InlineParentForm({
3238
3327
  }
3239
3328
  },
3240
3329
  children: /* @__PURE__ */ jsxs12(Stack3, { gap: "16px", children: [
3241
- error ? /* @__PURE__ */ jsx17(CoreErrorAlert, { error }) : null,
3330
+ error ? /* @__PURE__ */ jsx18(CoreErrorAlert, { error }) : null,
3242
3331
  renderFields(),
3243
- !externalSubmit ? /* @__PURE__ */ jsx17(Flex7, { justify: "flex-end", children: /* @__PURE__ */ jsx17(Button8, { type: "submit", colorPalette: "brand", loading: saving, children: "Salvar dados principais" }) }) : null
3332
+ !externalSubmit ? /* @__PURE__ */ jsx18(Flex7, { justify: "flex-end", children: /* @__PURE__ */ jsx18(Button8, { type: "submit", colorPalette: "brand", loading: saving, children: "Salvar dados principais" }) }) : null
3244
3333
  ] })
3245
3334
  }
3246
3335
  );
@@ -3263,13 +3352,13 @@ function CoreTabbedDetail({
3263
3352
  }) {
3264
3353
  const active = tabs.find((tab) => tab.id === activeTab) ?? tabs[0];
3265
3354
  const activeForm = active?.type === "form" ? active : void 0;
3266
- const draftFields = useMemo6(() => fieldsForFormTabs(formFields, tabs), [formFields, tabs]);
3267
- const formParent = useMemo6(() => parent ?? {}, [parent]);
3355
+ const draftFields = useMemo7(() => fieldsForFormTabs(formFields, tabs), [formFields, tabs]);
3356
+ const formParent = useMemo7(() => parent ?? {}, [parent]);
3268
3357
  const hasFormTab = draftFields.length > 0;
3269
3358
  return /* @__PURE__ */ jsxs12(Stack3, { gap: 4, children: [
3270
- /* @__PURE__ */ jsx17(Flex7, { gap: 2, borderBottomWidth: "1px", borderColor: "#E5E9ED", overflowX: "auto", children: tabs.map((tab) => {
3359
+ /* @__PURE__ */ jsx18(Flex7, { gap: 2, borderBottomWidth: "1px", borderColor: "#E5E9ED", overflowX: "auto", children: tabs.map((tab) => {
3271
3360
  const disabled = !parent?._id && (tab.type === "relatedGrid" || tab.type === "readonlyGrid" || tab.type === "summary");
3272
- return /* @__PURE__ */ jsx17(
3361
+ return /* @__PURE__ */ jsx18(
3273
3362
  Button8,
3274
3363
  {
3275
3364
  type: "button",
@@ -3283,7 +3372,7 @@ function CoreTabbedDetail({
3283
3372
  );
3284
3373
  }) }),
3285
3374
  /* @__PURE__ */ jsxs12(Box11, { children: [
3286
- hasFormTab ? /* @__PURE__ */ jsx17(Box11, { display: activeForm ? "block" : "none", children: /* @__PURE__ */ jsx17(
3375
+ hasFormTab ? /* @__PURE__ */ jsx18(Box11, { display: activeForm ? "block" : "none", children: /* @__PURE__ */ jsx18(
3287
3376
  InlineParentForm,
3288
3377
  {
3289
3378
  fields: draftFields,
@@ -3298,7 +3387,7 @@ function CoreTabbedDetail({
3298
3387
  externalSubmit
3299
3388
  }
3300
3389
  ) }) : null,
3301
- !active || active.type === "form" ? null : active.type === "summary" && parent ? /* @__PURE__ */ jsx17(CoreSummaryCards, { cards: active.cards, parent, relations }) : (active.type === "relatedGrid" || active.type === "readonlyGrid") && parent ? /* @__PURE__ */ jsx17(
3390
+ !active || active.type === "form" ? null : active.type === "summary" && parent ? /* @__PURE__ */ jsx18(CoreSummaryCards, { cards: active.cards, parent, relations }) : (active.type === "relatedGrid" || active.type === "readonlyGrid") && parent ? /* @__PURE__ */ jsx18(
3302
3391
  CoreRelatedGrid,
3303
3392
  {
3304
3393
  tab: active,
@@ -3310,23 +3399,23 @@ function CoreTabbedDetail({
3310
3399
  ) : active.type === "customComponent" ? /* @__PURE__ */ jsxs12(Text12, { color: "#667085", children: [
3311
3400
  "Componente customizado: ",
3312
3401
  active.component
3313
- ] }) : /* @__PURE__ */ jsx17(Text12, { color: "#667085", children: "Salve o registro principal para liberar esta aba." })
3402
+ ] }) : /* @__PURE__ */ jsx18(Text12, { color: "#667085", children: "Salve o registro principal para liberar esta aba." })
3314
3403
  ] })
3315
3404
  ] });
3316
3405
  }
3317
3406
 
3318
3407
  // src/components/internal/CoreDetailModal.tsx
3319
- import { jsx as jsx18, jsxs as jsxs13 } from "react/jsx-runtime";
3408
+ import { jsx as jsx19, jsxs as jsxs13 } from "react/jsx-runtime";
3320
3409
  function CoreDetailModal({ model, title, config, formFields, recordId, initialRecord, initialTab, relations, topActions, bottomActions, onClose, onSaved }) {
3321
3410
  const schemaQuery = useModelSchema(model);
3322
3411
  const schema = schemaQuery.data;
3323
3412
  const resource = useOonResource(schema?.basePath ?? `/${model.toLowerCase()}s`);
3324
- const queryClient = useQueryClient2();
3325
- const [parent, setParent] = useState11(initialRecord);
3326
- const [activeTab, setActiveTab] = useState11(resolveInitialDetailTab(config, recordId, initialTab));
3327
- const [refreshTokens, setRefreshTokens] = useState11({});
3328
- const [dirty, setDirty] = useState11(false);
3329
- const [confirmingClose, setConfirmingClose] = useState11(false);
3413
+ const queryClient = useQueryClient3();
3414
+ const [parent, setParent] = useState12(initialRecord);
3415
+ const [activeTab, setActiveTab] = useState12(resolveInitialDetailTab(config, recordId, initialTab));
3416
+ const [refreshTokens, setRefreshTokens] = useState12({});
3417
+ const [dirty, setDirty] = useState12(false);
3418
+ const [confirmingClose, setConfirmingClose] = useState12(false);
3330
3419
  const closeAfterSaveRef = useRef2(false);
3331
3420
  const parentQuery = useQuery6({
3332
3421
  queryKey: ["oon", "detail", model, recordId],
@@ -3336,7 +3425,7 @@ function CoreDetailModal({ model, title, config, formFields, recordId, initialRe
3336
3425
  useEffect8(() => {
3337
3426
  if (parentQuery.data) setParent(parentQuery.data);
3338
3427
  }, [parentQuery.data]);
3339
- const resolvedFormFields = useMemo7(
3428
+ const resolvedFormFields = useMemo8(
3340
3429
  () => formFields?.length ? formFields : schema ? formFieldsFromMeta(schema.fields) : [],
3341
3430
  [formFields, schema]
3342
3431
  );
@@ -3378,19 +3467,19 @@ function CoreDetailModal({ model, title, config, formFields, recordId, initialRe
3378
3467
  setConfirmingClose(false);
3379
3468
  form.requestSubmit();
3380
3469
  };
3381
- return /* @__PURE__ */ jsx18(DetailRecordProvider, { record: parent, setRecord: setParent, children: /* @__PURE__ */ jsxs13(Flex8, { position: "fixed", inset: 0, zIndex: 1e3, align: "center", justify: "center", p: 4, bg: "rgba(15,23,42,.48)", children: [
3470
+ return /* @__PURE__ */ jsx19(DetailRecordProvider, { record: parent, setRecord: setParent, children: /* @__PURE__ */ jsxs13(Flex8, { position: "fixed", inset: 0, zIndex: 1e3, align: "center", justify: "center", p: 4, bg: "rgba(15,23,42,.48)", children: [
3382
3471
  /* @__PURE__ */ jsxs13(Box12, { role: "dialog", "aria-modal": "true", display: "flex", flexDirection: "column", w: `min(${width}, 98vw)`, h: "94vh", maxH: "94vh", overflow: "hidden", bg: "white", borderRadius: "14px", boxShadow: "0 24px 70px rgba(15,23,42,.24)", children: [
3383
3472
  /* @__PURE__ */ jsxs13(Flex8, { minH: "72px", px: "20px", py: "10px", align: "center", justify: "space-between", gap: 4, borderBottomWidth: "1px", borderColor: "#E5E9ED", children: [
3384
3473
  /* @__PURE__ */ jsxs13(Box12, { minW: "160px", children: [
3385
- /* @__PURE__ */ jsx18(Text13, { color: "#0474AF", fontSize: "10px", fontWeight: "700", textTransform: "uppercase", children: "Detalhe" }),
3386
- /* @__PURE__ */ jsx18(Heading4, { size: "md", children: recordId ? displayTitle : `Novo ${title}` })
3474
+ /* @__PURE__ */ jsx19(Text13, { color: "#0474AF", fontSize: "10px", fontWeight: "700", textTransform: "uppercase", children: "Detalhe" }),
3475
+ /* @__PURE__ */ jsx19(Heading4, { size: "md", children: recordId ? displayTitle : `Novo ${title}` })
3387
3476
  ] }),
3388
3477
  /* @__PURE__ */ jsxs13(Flex8, { flex: "1", align: "center", justify: "flex-end", gap: "8px", wrap: "wrap", children: [
3389
3478
  recordId ? topActions : null,
3390
- /* @__PURE__ */ jsx18(IconButton2, { "aria-label": "Fechar", title: "Fechar", size: "sm", minW: "32px", h: "32px", borderRadius: "full", variant: "ghost", color: "#475569", fontSize: "21px", fontWeight: "400", lineHeight: "1", onClick: requestClose, _hover: { bg: "#F1F5F9", color: "#0F172A" }, children: "\xD7" })
3479
+ /* @__PURE__ */ jsx19(IconButton2, { "aria-label": "Fechar", title: "Fechar", size: "sm", minW: "32px", h: "32px", borderRadius: "full", variant: "ghost", color: "#475569", fontSize: "21px", fontWeight: "400", lineHeight: "1", onClick: requestClose, _hover: { bg: "#F1F5F9", color: "#0F172A" }, children: "\xD7" })
3391
3480
  ] })
3392
3481
  ] }),
3393
- /* @__PURE__ */ jsx18(Box12, { flex: "1", minH: 0, p: "20px", overflowY: "auto", children: schemaQuery.isLoading || parentQuery.isLoading ? /* @__PURE__ */ jsx18(Text13, { children: "Carregando..." }) : /* @__PURE__ */ jsx18(
3482
+ /* @__PURE__ */ jsx19(Box12, { flex: "1", minH: 0, p: "20px", overflowY: "auto", children: schemaQuery.isLoading || parentQuery.isLoading ? /* @__PURE__ */ jsx19(Text13, { children: "Carregando..." }) : /* @__PURE__ */ jsx19(
3394
3483
  CoreTabbedDetail,
3395
3484
  {
3396
3485
  tabs: config.tabs,
@@ -3421,31 +3510,31 @@ function CoreDetailModal({ model, title, config, formFields, recordId, initialRe
3421
3510
  }
3422
3511
  ) }),
3423
3512
  /* @__PURE__ */ jsxs13(Flex8, { flex: "0 0 auto", minH: "64px", px: "20px", py: "10px", align: "center", justify: "space-between", gap: "12px", bg: "white", borderTopWidth: "1px", borderColor: "#E5E9ED", boxShadow: "0 -8px 24px rgba(15,23,42,.06)", children: [
3424
- /* @__PURE__ */ jsx18(Box12, { children: recordId ? bottomActions : null }),
3425
- /* @__PURE__ */ jsx18(Button9, { type: "submit", form: formId, colorPalette: "brand", disabled: !hasFormTab || !activeIsForm && !dirty || schemaQuery.isLoading || parentQuery.isLoading, children: "Salvar" })
3513
+ /* @__PURE__ */ jsx19(Box12, { children: recordId ? bottomActions : null }),
3514
+ /* @__PURE__ */ jsx19(Button9, { type: "submit", form: formId, colorPalette: "brand", disabled: !hasFormTab || !activeIsForm && !dirty || schemaQuery.isLoading || parentQuery.isLoading, children: "Salvar" })
3426
3515
  ] })
3427
3516
  ] }),
3428
- confirmingClose ? /* @__PURE__ */ jsx18(Flex8, { position: "fixed", inset: 0, zIndex: 1100, align: "center", justify: "center", p: 4, bg: "rgba(15,23,42,.58)", children: /* @__PURE__ */ jsxs13(Box12, { role: "alertdialog", "aria-modal": "true", "aria-labelledby": "oon-unsaved-title", w: "min(520px, 94vw)", p: "22px", bg: "white", borderRadius: "12px", boxShadow: "0 24px 70px rgba(15,23,42,.28)", children: [
3429
- /* @__PURE__ */ jsx18(Heading4, { id: "oon-unsaved-title", size: "md", children: "Altera\xE7\xF5es n\xE3o salvas" }),
3430
- /* @__PURE__ */ jsx18(Text13, { mt: "8px", color: "#667085", fontSize: "13px", children: "As informa\xE7\xF5es preenchidas ainda n\xE3o foram salvas. Voc\xEA pode continuar editando, sair sem salvar ou salvar antes de fechar." }),
3517
+ confirmingClose ? /* @__PURE__ */ jsx19(Flex8, { position: "fixed", inset: 0, zIndex: 1100, align: "center", justify: "center", p: 4, bg: "rgba(15,23,42,.58)", children: /* @__PURE__ */ jsxs13(Box12, { role: "alertdialog", "aria-modal": "true", "aria-labelledby": "oon-unsaved-title", w: "min(520px, 94vw)", p: "22px", bg: "white", borderRadius: "12px", boxShadow: "0 24px 70px rgba(15,23,42,.28)", children: [
3518
+ /* @__PURE__ */ jsx19(Heading4, { id: "oon-unsaved-title", size: "md", children: "Altera\xE7\xF5es n\xE3o salvas" }),
3519
+ /* @__PURE__ */ jsx19(Text13, { mt: "8px", color: "#667085", fontSize: "13px", children: "As informa\xE7\xF5es preenchidas ainda n\xE3o foram salvas. Voc\xEA pode continuar editando, sair sem salvar ou salvar antes de fechar." }),
3431
3520
  /* @__PURE__ */ jsxs13(Flex8, { mt: "22px", justify: "flex-end", gap: "10px", wrap: "wrap", children: [
3432
- /* @__PURE__ */ jsx18(Button9, { variant: "ghost", onClick: () => {
3521
+ /* @__PURE__ */ jsx19(Button9, { variant: "ghost", onClick: () => {
3433
3522
  closeAfterSaveRef.current = false;
3434
3523
  setConfirmingClose(false);
3435
3524
  }, children: "Continuar editando" }),
3436
- /* @__PURE__ */ jsx18(Button9, { variant: "outline", colorPalette: "red", onClick: () => {
3525
+ /* @__PURE__ */ jsx19(Button9, { variant: "outline", colorPalette: "red", onClick: () => {
3437
3526
  closeAfterSaveRef.current = false;
3438
3527
  setConfirmingClose(false);
3439
3528
  onClose();
3440
3529
  }, children: "Sair sem salvar" }),
3441
- /* @__PURE__ */ jsx18(Button9, { colorPalette: "brand", onClick: saveAndClose, children: "Salvar e sair" })
3530
+ /* @__PURE__ */ jsx19(Button9, { colorPalette: "brand", onClick: saveAndClose, children: "Salvar e sair" })
3442
3531
  ] })
3443
3532
  ] }) }) : null
3444
3533
  ] }) });
3445
3534
  }
3446
3535
 
3447
3536
  // src/components/CoreCollection.tsx
3448
- import { jsx as jsx19, jsxs as jsxs14 } from "react/jsx-runtime";
3537
+ import { jsx as jsx20, jsxs as jsxs14 } from "react/jsx-runtime";
3449
3538
  function mergeFormFields(metadataFields, overrides) {
3450
3539
  if (!overrides?.length) return metadataFields;
3451
3540
  const byField = new Map(overrides.map((field) => [field.field, field]));
@@ -3465,10 +3554,10 @@ function CoreCollection({ model, label, section = "Cole\xE7\xE3o", mode = "dynam
3465
3554
  const metadataForm = schema ? formFieldsFromMeta(schema.fields) : [];
3466
3555
  const resolvedForm = mode === "full" && form?.length ? form : mergeFormFields(metadataForm, form);
3467
3556
  const resource = useOonResource(basePath);
3468
- const queryClient = useQueryClient3();
3469
- const [formState, setFormState] = useState12({ open: false });
3470
- const [detailState, setDetailState] = useState12({ open: false });
3471
- const [formError, setFormError] = useState12(null);
3557
+ const queryClient = useQueryClient4();
3558
+ const [formState, setFormState] = useState13({ open: false });
3559
+ const [detailState, setDetailState] = useState13({ open: false });
3560
+ const [formError, setFormError] = useState13(null);
3472
3561
  const invalidate = () => queryClient.invalidateQueries({ queryKey: ["oon", "list", basePath] });
3473
3562
  const saveMutation = useMutation2({
3474
3563
  mutationFn: (values) => {
@@ -3487,16 +3576,16 @@ function CoreCollection({ model, label, section = "Cole\xE7\xE3o", mode = "dynam
3487
3576
  mutationFn: (row) => resource.delete(row._id),
3488
3577
  onSuccess: invalidate
3489
3578
  });
3490
- if (needsSchema && schemaQuery.isLoading) return /* @__PURE__ */ jsx19(LoadingScreen, {});
3491
- if (needsSchema && schemaQuery.isError) return /* @__PURE__ */ jsx19(ErrorState, { error: schemaQuery.error });
3579
+ if (needsSchema && schemaQuery.isLoading) return /* @__PURE__ */ jsx20(LoadingScreen, {});
3580
+ if (needsSchema && schemaQuery.isError) return /* @__PURE__ */ jsx20(ErrorState, { error: schemaQuery.error });
3492
3581
  const title = label ?? schema?.name ?? model;
3493
3582
  return /* @__PURE__ */ jsxs14(Stack4, { gap: 5, children: [
3494
3583
  /* @__PURE__ */ jsxs14(Box13, { children: [
3495
- /* @__PURE__ */ jsx19(Text14, { fontSize: "11px", fontWeight: "700", color: "brand.500", textTransform: "uppercase", letterSpacing: "0.08em", mb: 1, children: section }),
3496
- /* @__PURE__ */ jsx19(Heading5, { size: "lg", color: "#24323A", letterSpacing: "-0.02em", children: title }),
3497
- /* @__PURE__ */ jsx19(Text14, { mt: 1, fontSize: "13px", color: "gray.500", children: "Consulte, filtre e mantenha os registros desta opera\xE7\xE3o." })
3584
+ /* @__PURE__ */ jsx20(Text14, { fontSize: "11px", fontWeight: "700", color: "brand.500", textTransform: "uppercase", letterSpacing: "0.08em", mb: 1, children: section }),
3585
+ /* @__PURE__ */ jsx20(Heading5, { size: "lg", color: "#24323A", letterSpacing: "-0.02em", children: title }),
3586
+ /* @__PURE__ */ jsx20(Text14, { mt: 1, fontSize: "13px", color: "gray.500", children: "Consulte, filtre e mantenha os registros desta opera\xE7\xE3o." })
3498
3587
  ] }),
3499
- /* @__PURE__ */ jsx19(
3588
+ /* @__PURE__ */ jsx20(
3500
3589
  DataGrid,
3501
3590
  {
3502
3591
  resource,
@@ -3517,7 +3606,7 @@ function CoreCollection({ model, label, section = "Cole\xE7\xE3o", mode = "dynam
3517
3606
  onDelete: list?.builtInActions?.delete === false ? void 0 : (row) => {
3518
3607
  if (window.confirm("Excluir este registro?")) deleteMutation.mutate(row);
3519
3608
  },
3520
- renderRowActions: list?.rowActions?.length ? (row) => list.rowActions?.map((action) => /* @__PURE__ */ jsx19(
3609
+ renderRowActions: list?.rowActions?.length ? (row) => list.rowActions?.map((action) => /* @__PURE__ */ jsx20(
3521
3610
  CoreRowAction,
3522
3611
  {
3523
3612
  action,
@@ -3529,7 +3618,7 @@ function CoreCollection({ model, label, section = "Cole\xE7\xE3o", mode = "dynam
3529
3618
  )) : void 0
3530
3619
  }
3531
3620
  ),
3532
- formState.open ? /* @__PURE__ */ jsx19(
3621
+ formState.open ? /* @__PURE__ */ jsx20(
3533
3622
  DynamicForm,
3534
3623
  {
3535
3624
  title: formState.row ? `Editar ${title}` : `Novo ${title}`,
@@ -3550,7 +3639,7 @@ function CoreCollection({ model, label, section = "Cole\xE7\xE3o", mode = "dynam
3550
3639
  }
3551
3640
  ) : null,
3552
3641
  importExport ? null : null,
3553
- detailState.open && detailModal?.enabled ? /* @__PURE__ */ jsx19(
3642
+ detailState.open && detailModal?.enabled ? /* @__PURE__ */ jsx20(
3554
3643
  CoreDetailModal,
3555
3644
  {
3556
3645
  model,
@@ -3569,9 +3658,9 @@ function CoreCollection({ model, label, section = "Cole\xE7\xE3o", mode = "dynam
3569
3658
  }
3570
3659
 
3571
3660
  // src/components/CoreDocument.tsx
3572
- import { jsx as jsx20 } from "react/jsx-runtime";
3661
+ import { jsx as jsx21 } from "react/jsx-runtime";
3573
3662
  function CoreDocument({ model, label, endpoint, columns, form }) {
3574
- return /* @__PURE__ */ jsx20(
3663
+ return /* @__PURE__ */ jsx21(
3575
3664
  CoreCollection,
3576
3665
  {
3577
3666
  model,
@@ -3585,9 +3674,9 @@ function CoreDocument({ model, label, endpoint, columns, form }) {
3585
3674
  }
3586
3675
 
3587
3676
  // src/components/CorePipeline.tsx
3588
- import { useEffect as useEffect9, useRef as useRef3, useState as useState13 } from "react";
3677
+ import { useEffect as useEffect9, useRef as useRef3, useState as useState14 } from "react";
3589
3678
  import { Badge as Badge4, Box as Box14, Button as Button10, Flex as Flex9, Heading as Heading6, Input as Input6, NativeSelect as NativeSelect4, Stack as Stack5, Text as Text15 } from "@chakra-ui/react";
3590
- import { useMutation as useMutation3, useQuery as useQuery7, useQueryClient as useQueryClient4 } from "@tanstack/react-query";
3679
+ import { useMutation as useMutation3, useQuery as useQuery7, useQueryClient as useQueryClient5 } from "@tanstack/react-query";
3591
3680
 
3592
3681
  // src/pipelineTicket.ts
3593
3682
  var DEFAULT_EXCLUDED_STAGES = [
@@ -3728,7 +3817,7 @@ function pipelineBoardScrollStep(clientWidth) {
3728
3817
  }
3729
3818
 
3730
3819
  // src/components/CorePipeline.tsx
3731
- import { jsx as jsx21, jsxs as jsxs15 } from "react/jsx-runtime";
3820
+ import { jsx as jsx22, jsxs as jsxs15 } from "react/jsx-runtime";
3732
3821
  function ticketId(row) {
3733
3822
  const id = row._id ?? row.id;
3734
3823
  return id == null ? void 0 : String(id);
@@ -3752,7 +3841,7 @@ function workStatusColor(value2) {
3752
3841
  }
3753
3842
  function PipelineArrowIcon({ direction }) {
3754
3843
  const path = direction === "left" ? "M12.5 5 7.5 10l5 5" : "m7.5 5 5 5-5 5";
3755
- return /* @__PURE__ */ jsx21("svg", { viewBox: "0 0 20 20", width: "18", height: "18", "aria-hidden": "true", children: /* @__PURE__ */ jsx21("path", { d: path, fill: "none", stroke: "currentColor", strokeWidth: "1.8", strokeLinecap: "round", strokeLinejoin: "round" }) });
3844
+ return /* @__PURE__ */ jsx22("svg", { viewBox: "0 0 20 20", width: "18", height: "18", "aria-hidden": "true", children: /* @__PURE__ */ jsx22("path", { d: path, fill: "none", stroke: "currentColor", strokeWidth: "1.8", strokeLinecap: "round", strokeLinejoin: "round" }) });
3756
3845
  }
3757
3846
  function PipelineFilterControl({
3758
3847
  filter,
@@ -3761,7 +3850,7 @@ function PipelineFilterControl({
3761
3850
  onChange
3762
3851
  }) {
3763
3852
  if (filter.type === "ref" && meta?.ref) {
3764
- return /* @__PURE__ */ jsx21(Box14, { w: "220px", children: /* @__PURE__ */ jsx21(
3853
+ return /* @__PURE__ */ jsx22(Box14, { w: "220px", children: /* @__PURE__ */ jsx22(
3765
3854
  ReferenceSelect,
3766
3855
  {
3767
3856
  field: filter.field,
@@ -3780,11 +3869,11 @@ function PipelineFilterControl({
3780
3869
  }
3781
3870
  if (filter.type === "select") {
3782
3871
  return /* @__PURE__ */ jsxs15(NativeSelect4.Root, { size: "sm", w: "190px", children: [
3783
- /* @__PURE__ */ jsx21(NativeSelect4.Field, { value: String(value2 ?? ""), onChange: (event) => onChange(event.currentTarget.value), children: (filter.options ?? []).map((option) => /* @__PURE__ */ jsx21("option", { value: String(option.value ?? ""), children: option.label }, String(option.value ?? ""))) }),
3784
- /* @__PURE__ */ jsx21(NativeSelect4.Indicator, {})
3872
+ /* @__PURE__ */ jsx22(NativeSelect4.Field, { value: String(value2 ?? ""), onChange: (event) => onChange(event.currentTarget.value), children: (filter.options ?? []).map((option) => /* @__PURE__ */ jsx22("option", { value: String(option.value ?? ""), children: option.label }, String(option.value ?? ""))) }),
3873
+ /* @__PURE__ */ jsx22(NativeSelect4.Indicator, {})
3785
3874
  ] });
3786
3875
  }
3787
- return /* @__PURE__ */ jsx21(
3876
+ return /* @__PURE__ */ jsx22(
3788
3877
  Input6,
3789
3878
  {
3790
3879
  w: "190px",
@@ -3819,18 +3908,18 @@ function CorePipeline({
3819
3908
  const schema = schemaQuery.data;
3820
3909
  const basePath = endpoint ?? schema?.basePath ?? `/${model.toLowerCase()}s`;
3821
3910
  const resource = useOonResource(basePath);
3822
- const queryClient = useQueryClient4();
3911
+ const queryClient = useQueryClient5();
3823
3912
  const allowedViewModes = viewModes.length ? viewModes : ["board"];
3824
3913
  const initialView = defaultView && allowedViewModes.includes(defaultView) ? defaultView : allowedViewModes[0] ?? "board";
3825
- const [viewMode, setViewMode] = useState13(initialView);
3826
- const [filterValues, setFilterValues] = useState13(
3914
+ const [viewMode, setViewMode] = useState14(initialView);
3915
+ const [filterValues, setFilterValues] = useState14(
3827
3916
  () => Object.fromEntries(filters.map((filter) => [filter.field, filter.defaultValue ?? ""]))
3828
3917
  );
3829
- const [selectedTicket, setSelectedTicket] = useState13(null);
3830
- const [creating, setCreating] = useState13(false);
3831
- const [formError, setFormError] = useState13(null);
3918
+ const [selectedTicket, setSelectedTicket] = useState14(null);
3919
+ const [creating, setCreating] = useState14(false);
3920
+ const [formError, setFormError] = useState14(null);
3832
3921
  const boardRef = useRef3(null);
3833
- const [boardScrollState, setBoardScrollState] = useState13({ canScrollLeft: false, canScrollRight: false });
3922
+ const [boardScrollState, setBoardScrollState] = useState14({ canScrollLeft: false, canScrollRight: false });
3834
3923
  const effectiveFilters = Object.fromEntries(
3835
3924
  Object.entries(filterValues).filter(([, value2]) => value2 !== "" && value2 != null)
3836
3925
  );
@@ -3875,9 +3964,9 @@ function CorePipeline({
3875
3964
  },
3876
3965
  onError: (error) => setFormError(error)
3877
3966
  });
3878
- if (schemaQuery.isLoading || viewMode === "board" && listQuery.isLoading) return /* @__PURE__ */ jsx21(LoadingScreen, {});
3879
- if (schemaQuery.isError) return /* @__PURE__ */ jsx21(ErrorState, { error: schemaQuery.error });
3880
- if (viewMode === "board" && listQuery.isError) return /* @__PURE__ */ jsx21(ErrorState, { error: listQuery.error });
3967
+ if (schemaQuery.isLoading || viewMode === "board" && listQuery.isLoading) return /* @__PURE__ */ jsx22(LoadingScreen, {});
3968
+ if (schemaQuery.isError) return /* @__PURE__ */ jsx22(ErrorState, { error: schemaQuery.error });
3969
+ if (viewMode === "board" && listQuery.isError) return /* @__PURE__ */ jsx22(ErrorState, { error: listQuery.error });
3881
3970
  const stageFieldMeta = schema?.fields.find((field) => field.name === stageField);
3882
3971
  const resolvedStages = stages ?? (stageFieldMeta?.options ?? []).map((option) => ({ id: option, label: option }));
3883
3972
  const defaultActionsConfig = defaultActions === false ? void 0 : defaultActions;
@@ -3919,7 +4008,7 @@ function CorePipeline({
3919
4008
  const step = pipelineBoardScrollStep(board.clientWidth);
3920
4009
  board.scrollBy({ left: direction === "left" ? -step : step, behavior: "smooth" });
3921
4010
  };
3922
- const renderModalAction = (action, index) => selectedTicket ? /* @__PURE__ */ jsx21(
4011
+ const renderModalAction = (action, index) => selectedTicket ? /* @__PURE__ */ jsx22(
3923
4012
  CoreRowAction,
3924
4013
  {
3925
4014
  action,
@@ -3938,29 +4027,29 @@ function CorePipeline({
3938
4027
  },
3939
4028
  action.id ?? `${action.label}-${index}`
3940
4029
  ) : null;
3941
- const modalTopActions = selectedTicket && !creating && groupedTicketActions.workStatus.length ? /* @__PURE__ */ jsx21(Flex9, { role: "group", "aria-label": "Status da atividade", gap: "6px", align: "center", wrap: "wrap", children: groupedTicketActions.workStatus.map(renderModalAction) }) : null;
4030
+ const modalTopActions = selectedTicket && !creating && groupedTicketActions.workStatus.length ? /* @__PURE__ */ jsx22(Flex9, { role: "group", "aria-label": "Status da atividade", gap: "6px", align: "center", wrap: "wrap", children: groupedTicketActions.workStatus.map(renderModalAction) }) : null;
3942
4031
  const modalBottomActions = selectedTicket && !creating ? /* @__PURE__ */ jsxs15(Flex9, { gap: "8px", align: "center", wrap: "wrap", children: [
3943
- groupedTicketActions.approval.length ? /* @__PURE__ */ jsx21(Flex9, { role: "group", "aria-label": "Aprova\xE7\xE3o do ticket", gap: "6px", align: "center", wrap: "wrap", children: groupedTicketActions.approval.map(renderModalAction) }) : null,
3944
- groupedTicketActions.custom.length ? /* @__PURE__ */ jsx21(Flex9, { role: "group", "aria-label": "A\xE7\xF5es do neg\xF3cio", gap: "6px", align: "center", wrap: "wrap", children: groupedTicketActions.custom.map(renderModalAction) }) : null
4032
+ groupedTicketActions.approval.length ? /* @__PURE__ */ jsx22(Flex9, { role: "group", "aria-label": "Aprova\xE7\xE3o do ticket", gap: "6px", align: "center", wrap: "wrap", children: groupedTicketActions.approval.map(renderModalAction) }) : null,
4033
+ groupedTicketActions.custom.length ? /* @__PURE__ */ jsx22(Flex9, { role: "group", "aria-label": "A\xE7\xF5es do neg\xF3cio", gap: "6px", align: "center", wrap: "wrap", children: groupedTicketActions.custom.map(renderModalAction) }) : null
3945
4034
  ] }) : null;
3946
4035
  return /* @__PURE__ */ jsxs15(Stack5, { gap: 5, children: [
3947
4036
  /* @__PURE__ */ jsxs15(Flex9, { align: { base: "stretch", md: "flex-end" }, justify: "space-between", gap: 4, direction: { base: "column", md: "row" }, children: [
3948
4037
  /* @__PURE__ */ jsxs15(Box14, { children: [
3949
- /* @__PURE__ */ jsx21(Text15, { fontSize: "11px", fontWeight: "700", color: "brand.500", textTransform: "uppercase", letterSpacing: "0.08em", mb: 1, children: "Esteira de processo" }),
3950
- /* @__PURE__ */ jsx21(Heading6, { size: "lg", color: "#24323A", letterSpacing: "-0.02em", children: label ?? schema?.name ?? model }),
3951
- /* @__PURE__ */ jsx21(Text15, { mt: 1, fontSize: "13px", color: "gray.500", children: "Acompanhe os tickets por etapa e visualize os principais dados de cada item." })
4038
+ /* @__PURE__ */ jsx22(Text15, { fontSize: "11px", fontWeight: "700", color: "brand.500", textTransform: "uppercase", letterSpacing: "0.08em", mb: 1, children: "Esteira de processo" }),
4039
+ /* @__PURE__ */ jsx22(Heading6, { size: "lg", color: "#24323A", letterSpacing: "-0.02em", children: label ?? schema?.name ?? model }),
4040
+ /* @__PURE__ */ jsx22(Text15, { mt: 1, fontSize: "13px", color: "gray.500", children: "Acompanhe os tickets por etapa e visualize os principais dados de cada item." })
3952
4041
  ] }),
3953
4042
  /* @__PURE__ */ jsxs15(Flex9, { gap: "8px", align: "center", wrap: "wrap", children: [
3954
- allowedViewModes.length > 1 ? allowedViewModes.map((mode) => /* @__PURE__ */ jsx21(Button10, { size: "sm", variant: viewMode === mode ? "solid" : "outline", colorPalette: "brand", onClick: () => setViewMode(mode), children: mode === "board" ? "Quadro" : "Lista" }, mode)) : null,
3955
- create?.enabled ? /* @__PURE__ */ jsx21(Button10, { size: "sm", colorPalette: "brand", onClick: openCreate, children: create.label ?? "Novo ticket" }) : null
4043
+ allowedViewModes.length > 1 ? allowedViewModes.map((mode) => /* @__PURE__ */ jsx22(Button10, { size: "sm", variant: viewMode === mode ? "solid" : "outline", colorPalette: "brand", onClick: () => setViewMode(mode), children: mode === "board" ? "Quadro" : "Lista" }, mode)) : null,
4044
+ create?.enabled ? /* @__PURE__ */ jsx22(Button10, { size: "sm", colorPalette: "brand", onClick: openCreate, children: create.label ?? "Novo ticket" }) : null
3956
4045
  ] })
3957
4046
  ] }),
3958
4047
  filters.length ? /* @__PURE__ */ jsxs15(Flex9, { p: "12px", gap: "10px", align: "flex-end", wrap: "wrap", bg: "white", borderWidth: "1px", borderColor: "#E5E9ED", borderRadius: "10px", children: [
3959
4048
  filters.map((filter) => {
3960
4049
  const meta = schema?.fields.find((field) => field.name === filter.field);
3961
4050
  return /* @__PURE__ */ jsxs15(Box14, { children: [
3962
- /* @__PURE__ */ jsx21(Text15, { mb: "4px", fontSize: "10px", color: "#667085", fontWeight: "600", children: filter.label ?? fieldLabel({ name: filter.field }) }),
3963
- /* @__PURE__ */ jsx21(
4051
+ /* @__PURE__ */ jsx22(Text15, { mb: "4px", fontSize: "10px", color: "#667085", fontWeight: "600", children: filter.label ?? fieldLabel({ name: filter.field }) }),
4052
+ /* @__PURE__ */ jsx22(
3964
4053
  PipelineFilterControl,
3965
4054
  {
3966
4055
  filter,
@@ -3971,7 +4060,7 @@ function CorePipeline({
3971
4060
  )
3972
4061
  ] }, filter.field);
3973
4062
  }),
3974
- /* @__PURE__ */ jsx21(
4063
+ /* @__PURE__ */ jsx22(
3975
4064
  Button10,
3976
4065
  {
3977
4066
  size: "sm",
@@ -3981,7 +4070,7 @@ function CorePipeline({
3981
4070
  }
3982
4071
  )
3983
4072
  ] }) : null,
3984
- viewMode === "list" ? /* @__PURE__ */ jsx21(
4073
+ viewMode === "list" ? /* @__PURE__ */ jsx22(
3985
4074
  DataGrid,
3986
4075
  {
3987
4076
  resource,
@@ -3995,7 +4084,7 @@ function CorePipeline({
3995
4084
  }
3996
4085
  }
3997
4086
  ) : /* @__PURE__ */ jsxs15(Box14, { position: "relative", children: [
3998
- /* @__PURE__ */ jsx21(
4087
+ /* @__PURE__ */ jsx22(
3999
4088
  Flex9,
4000
4089
  {
4001
4090
  ref: boardRef,
@@ -4015,10 +4104,10 @@ function CorePipeline({
4015
4104
  const stageLabel = resolvedStages.find((stage) => stage.id === stageId)?.label ?? (stageId || "Sem etapa");
4016
4105
  return /* @__PURE__ */ jsxs15(Box14, { minW: "300px", maxW: "340px", flex: "1 0 300px", bg: "#E8ECEF", borderRadius: "12px", p: 3, borderWidth: "1px", borderColor: "#DDE3E7", children: [
4017
4106
  /* @__PURE__ */ jsxs15(Flex9, { align: "center", justify: "space-between", mb: 3, px: 1, children: [
4018
- /* @__PURE__ */ jsx21(Text15, { fontWeight: "700", fontSize: "12px", color: "#33434C", textTransform: "uppercase", letterSpacing: "0.03em", children: stageLabel }),
4019
- /* @__PURE__ */ jsx21(Badge4, { colorPalette: "brand", variant: "solid", borderRadius: "full", minW: "24px", justifyContent: "center", children: items.length })
4107
+ /* @__PURE__ */ jsx22(Text15, { fontWeight: "700", fontSize: "12px", color: "#33434C", textTransform: "uppercase", letterSpacing: "0.03em", children: stageLabel }),
4108
+ /* @__PURE__ */ jsx22(Badge4, { colorPalette: "brand", variant: "solid", borderRadius: "full", minW: "24px", justifyContent: "center", children: items.length })
4020
4109
  ] }),
4021
- /* @__PURE__ */ jsx21(Stack5, { gap: 2, children: items.length === 0 ? /* @__PURE__ */ jsx21(Box14, { borderWidth: "1px", borderStyle: "dashed", borderColor: "#C8D0D5", borderRadius: "10px", p: 5, textAlign: "center", children: /* @__PURE__ */ jsx21(Text15, { fontSize: "12px", color: "gray.500", children: "Nenhum ticket nesta etapa." }) }) : items.map((row, index) => {
4110
+ /* @__PURE__ */ jsx22(Stack5, { gap: 2, children: items.length === 0 ? /* @__PURE__ */ jsx22(Box14, { borderWidth: "1px", borderStyle: "dashed", borderColor: "#C8D0D5", borderRadius: "10px", p: 5, textAlign: "center", children: /* @__PURE__ */ jsx22(Text15, { fontSize: "12px", color: "gray.500", children: "Nenhum ticket nesta etapa." }) }) : items.map((row, index) => {
4022
4111
  const ticketTitle = formatCell(row[resolvedTitleField], resolvedTitleFieldMeta?.kind);
4023
4112
  return /* @__PURE__ */ jsxs15(
4024
4113
  Button10,
@@ -4046,8 +4135,8 @@ function CorePipeline({
4046
4135
  _hover: { borderColor: "brand.300", transform: "translateY(-1px)", boxShadow: "0 7px 18px rgba(7, 38, 46, 0.09)" },
4047
4136
  children: [
4048
4137
  /* @__PURE__ */ jsxs15(Flex9, { align: "flex-start", justify: "space-between", gap: "8px", mb: 2, children: [
4049
- /* @__PURE__ */ jsx21(Text15, { fontSize: "13px", fontWeight: "700", color: "#24323A", lineClamp: 2, children: ticketTitle }),
4050
- /* @__PURE__ */ jsx21(
4138
+ /* @__PURE__ */ jsx22(Text15, { fontSize: "13px", fontWeight: "700", color: "#24323A", lineClamp: 2, children: ticketTitle }),
4139
+ /* @__PURE__ */ jsx22(
4051
4140
  Box14,
4052
4141
  {
4053
4142
  as: "span",
@@ -4063,9 +4152,9 @@ function CorePipeline({
4063
4152
  }
4064
4153
  )
4065
4154
  ] }),
4066
- /* @__PURE__ */ jsx21(Stack5, { gap: 1, children: detailFields.map((field) => /* @__PURE__ */ jsxs15(Flex9, { gap: 2, align: "baseline", justify: "space-between", children: [
4067
- /* @__PURE__ */ jsx21(Text15, { fontSize: "10px", color: "gray.500", textTransform: "uppercase", letterSpacing: "0.03em", children: fieldLabel(field) }),
4068
- /* @__PURE__ */ jsx21(Text15, { fontSize: "11px", color: "#46545C", fontWeight: "500", textAlign: "right", lineClamp: 1, children: formatCell(row[field.name], field.kind) })
4155
+ /* @__PURE__ */ jsx22(Stack5, { gap: 1, children: detailFields.map((field) => /* @__PURE__ */ jsxs15(Flex9, { gap: 2, align: "baseline", justify: "space-between", children: [
4156
+ /* @__PURE__ */ jsx22(Text15, { fontSize: "10px", color: "gray.500", textTransform: "uppercase", letterSpacing: "0.03em", children: fieldLabel(field) }),
4157
+ /* @__PURE__ */ jsx22(Text15, { fontSize: "11px", color: "#46545C", fontWeight: "500", textAlign: "right", lineClamp: 1, children: formatCell(row[field.name], field.kind) })
4069
4158
  ] }, field.name)) })
4070
4159
  ]
4071
4160
  },
@@ -4076,7 +4165,7 @@ function CorePipeline({
4076
4165
  })
4077
4166
  }
4078
4167
  ),
4079
- /* @__PURE__ */ jsx21(
4168
+ /* @__PURE__ */ jsx22(
4080
4169
  Button10,
4081
4170
  {
4082
4171
  type: "button",
@@ -4100,10 +4189,10 @@ function CorePipeline({
4100
4189
  onClick: () => scrollBoard("left"),
4101
4190
  _hover: { bg: "white", borderColor: "brand.400" },
4102
4191
  _disabled: { opacity: 0.25, cursor: "not-allowed" },
4103
- children: /* @__PURE__ */ jsx21(PipelineArrowIcon, { direction: "left" })
4192
+ children: /* @__PURE__ */ jsx22(PipelineArrowIcon, { direction: "left" })
4104
4193
  }
4105
4194
  ),
4106
- /* @__PURE__ */ jsx21(
4195
+ /* @__PURE__ */ jsx22(
4107
4196
  Button10,
4108
4197
  {
4109
4198
  type: "button",
@@ -4127,11 +4216,11 @@ function CorePipeline({
4127
4216
  onClick: () => scrollBoard("right"),
4128
4217
  _hover: { bg: "white", borderColor: "brand.400" },
4129
4218
  _disabled: { opacity: 0.25, cursor: "not-allowed" },
4130
- children: /* @__PURE__ */ jsx21(PipelineArrowIcon, { direction: "right" })
4219
+ children: /* @__PURE__ */ jsx22(PipelineArrowIcon, { direction: "right" })
4131
4220
  }
4132
4221
  )
4133
4222
  ] }),
4134
- selectedTicket && ticketModal && ticketModal.enabled !== false ? /* @__PURE__ */ jsx21(
4223
+ selectedTicket && ticketModal && ticketModal.enabled !== false ? /* @__PURE__ */ jsx22(
4135
4224
  CoreDetailModal,
4136
4225
  {
4137
4226
  model,
@@ -4157,7 +4246,7 @@ function CorePipeline({
4157
4246
  }
4158
4247
  }
4159
4248
  }
4160
- ) : selectedTicket ? /* @__PURE__ */ jsx21(
4249
+ ) : selectedTicket ? /* @__PURE__ */ jsx22(
4161
4250
  DynamicForm,
4162
4251
  {
4163
4252
  title: `${creating ? "Novo" : "Editar"} ${schema?.singular ?? label ?? model}`,
@@ -4186,7 +4275,7 @@ function CorePipeline({
4186
4275
  // src/components/CoreDashboard.tsx
4187
4276
  import { Box as Box15, Heading as Heading7, SimpleGrid as SimpleGrid4, Stack as Stack6, Text as Text16 } from "@chakra-ui/react";
4188
4277
  import { useQuery as useQuery8 } from "@tanstack/react-query";
4189
- import { jsx as jsx22, jsxs as jsxs16 } from "react/jsx-runtime";
4278
+ import { jsx as jsx23, jsxs as jsxs16 } from "react/jsx-runtime";
4190
4279
  function metricFormat(widget) {
4191
4280
  if (widget.format) return widget.format;
4192
4281
  return ["sum", "groupSum"].includes(widget.kind || "") ? "currency" : "number";
@@ -4222,13 +4311,13 @@ function CoreDashboard({ label = "Dashboard", widgets = [] }) {
4222
4311
  const results = new Map((metricsQuery.data ?? []).map((result) => [result.id, result]));
4223
4312
  return /* @__PURE__ */ jsxs16(Stack6, { gap: 6, children: [
4224
4313
  /* @__PURE__ */ jsxs16(Box15, { children: [
4225
- /* @__PURE__ */ jsx22(Text16, { fontSize: "xs", fontWeight: "600", color: "brand.600", textTransform: "uppercase", letterSpacing: "0.08em", children: "Vis\xE3o geral" }),
4226
- /* @__PURE__ */ jsx22(Heading7, { size: "lg", children: label })
4314
+ /* @__PURE__ */ jsx23(Text16, { fontSize: "xs", fontWeight: "600", color: "brand.600", textTransform: "uppercase", letterSpacing: "0.08em", children: "Vis\xE3o geral" }),
4315
+ /* @__PURE__ */ jsx23(Heading7, { size: "lg", children: label })
4227
4316
  ] }),
4228
- !widgets.length ? /* @__PURE__ */ jsx22(Text16, { color: "gray.500", children: "Nenhum indicador declarado." }) : null,
4229
- /* @__PURE__ */ jsx22(SimpleGrid4, { columns: { base: 1, md: 2, lg: 3 }, gap: 4, children: widgets.map((widget) => {
4317
+ !widgets.length ? /* @__PURE__ */ jsx23(Text16, { color: "gray.500", children: "Nenhum indicador declarado." }) : null,
4318
+ /* @__PURE__ */ jsx23(SimpleGrid4, { columns: { base: 1, md: 2, lg: 3 }, gap: 4, children: widgets.map((widget) => {
4230
4319
  if (widget.kind === "custom" && widget.render) {
4231
- return /* @__PURE__ */ jsx22(Box15, { borderWidth: "1px", borderColor: "gray.200", borderRadius: "lg", bg: "white", p: 5, children: widget.render() }, widget.id);
4320
+ return /* @__PURE__ */ jsx23(Box15, { borderWidth: "1px", borderColor: "gray.200", borderRadius: "lg", bg: "white", p: 5, children: widget.render() }, widget.id);
4232
4321
  }
4233
4322
  const result = results.get(widget.id);
4234
4323
  const grouped = ["groupCount", "groupSum"].includes(widget.kind || "");
@@ -4244,15 +4333,15 @@ function CoreDashboard({ label = "Dashboard", widgets = [] }) {
4244
4333
  p: 5,
4245
4334
  minH: grouped ? void 0 : "126px",
4246
4335
  children: [
4247
- /* @__PURE__ */ jsx22(Text16, { fontSize: "sm", color: "gray.500", children: widget.label }),
4248
- widget.description ? /* @__PURE__ */ jsx22(Text16, { fontSize: "xs", color: "gray.400", mt: 1, children: widget.description }) : null,
4249
- metricsQuery.isLoading ? /* @__PURE__ */ jsx22(Heading7, { size: "xl", mt: 2, children: "\u2026" }) : null,
4250
- metricsQuery.isError ? /* @__PURE__ */ jsx22(Text16, { color: "red.600", mt: 3, children: "N\xE3o foi poss\xEDvel carregar este indicador." }) : null,
4251
- !metricsQuery.isLoading && !metricsQuery.isError && grouped ? /* @__PURE__ */ jsx22(SimpleGrid4, { columns: { base: 1, md: 2, lg: 3 }, gap: 3, mt: 4, children: (result?.groups ?? []).length ? result?.groups?.map((group) => /* @__PURE__ */ jsxs16(Box15, { borderWidth: "1px", borderColor: "gray.100", borderRadius: "md", p: 3, children: [
4252
- /* @__PURE__ */ jsx22(Text16, { fontSize: "xs", color: "gray.500", children: group.key }),
4253
- /* @__PURE__ */ jsx22(Heading7, { size: "md", mt: 1, children: formatMetric(group.value, format2) })
4254
- ] }, group.key)) : /* @__PURE__ */ jsx22(Text16, { color: "gray.500", children: "Nenhum ticket encontrado." }) }) : null,
4255
- !metricsQuery.isLoading && !metricsQuery.isError && !grouped ? /* @__PURE__ */ jsx22(Heading7, { size: "xl", mt: 2, children: formatMetric(result?.value, format2) }) : null
4336
+ /* @__PURE__ */ jsx23(Text16, { fontSize: "sm", color: "gray.500", children: widget.label }),
4337
+ widget.description ? /* @__PURE__ */ jsx23(Text16, { fontSize: "xs", color: "gray.400", mt: 1, children: widget.description }) : null,
4338
+ metricsQuery.isLoading ? /* @__PURE__ */ jsx23(Heading7, { size: "xl", mt: 2, children: "\u2026" }) : null,
4339
+ metricsQuery.isError ? /* @__PURE__ */ jsx23(Text16, { color: "red.600", mt: 3, children: "N\xE3o foi poss\xEDvel carregar este indicador." }) : null,
4340
+ !metricsQuery.isLoading && !metricsQuery.isError && grouped ? /* @__PURE__ */ jsx23(SimpleGrid4, { columns: { base: 1, md: 2, lg: 3 }, gap: 3, mt: 4, children: (result?.groups ?? []).length ? result?.groups?.map((group) => /* @__PURE__ */ jsxs16(Box15, { borderWidth: "1px", borderColor: "gray.100", borderRadius: "md", p: 3, children: [
4341
+ /* @__PURE__ */ jsx23(Text16, { fontSize: "xs", color: "gray.500", children: group.key }),
4342
+ /* @__PURE__ */ jsx23(Heading7, { size: "md", mt: 1, children: formatMetric(group.value, format2) })
4343
+ ] }, group.key)) : /* @__PURE__ */ jsx23(Text16, { color: "gray.500", children: "Nenhum ticket encontrado." }) }) : null,
4344
+ !metricsQuery.isLoading && !metricsQuery.isError && !grouped ? /* @__PURE__ */ jsx23(Heading7, { size: "xl", mt: 2, children: formatMetric(result?.value, format2) }) : null
4256
4345
  ]
4257
4346
  },
4258
4347
  widget.id
@@ -4262,7 +4351,7 @@ function CoreDashboard({ label = "Dashboard", widgets = [] }) {
4262
4351
  }
4263
4352
 
4264
4353
  // src/components/CoreUsersAccess.tsx
4265
- import { useMemo as useMemo8, useState as useState14 } from "react";
4354
+ import { useMemo as useMemo9, useState as useState15 } from "react";
4266
4355
  import {
4267
4356
  Box as Box16,
4268
4357
  Button as Button11,
@@ -4272,22 +4361,22 @@ import {
4272
4361
  Text as Text17,
4273
4362
  VStack as VStack2
4274
4363
  } from "@chakra-ui/react";
4275
- import { useMutation as useMutation4, useQuery as useQuery9, useQueryClient as useQueryClient5 } from "@tanstack/react-query";
4364
+ import { useMutation as useMutation4, useQuery as useQuery9, useQueryClient as useQueryClient6 } from "@tanstack/react-query";
4276
4365
 
4277
4366
  // src/security/PermissionGate.tsx
4278
- import { Fragment as Fragment3, jsx as jsx23 } from "react/jsx-runtime";
4367
+ import { Fragment as Fragment3, jsx as jsx24 } from "react/jsx-runtime";
4279
4368
  function PermissionGate({
4280
4369
  permission,
4281
4370
  fallback = null,
4282
4371
  children
4283
4372
  }) {
4284
4373
  const { hasPermission } = useOonAuth();
4285
- return /* @__PURE__ */ jsx23(Fragment3, { children: hasPermission(permission) ? children : fallback });
4374
+ return /* @__PURE__ */ jsx24(Fragment3, { children: hasPermission(permission) ? children : fallback });
4286
4375
  }
4287
4376
  var Can = PermissionGate;
4288
4377
 
4289
4378
  // src/components/CoreUsersAccess.tsx
4290
- import { jsx as jsx24, jsxs as jsxs17 } from "react/jsx-runtime";
4379
+ import { jsx as jsx25, jsxs as jsxs17 } from "react/jsx-runtime";
4291
4380
  var selectStyle = {
4292
4381
  height: "40px",
4293
4382
  border: "1px solid #E2E8F0",
@@ -4305,12 +4394,12 @@ function fmt(value2) {
4305
4394
  }
4306
4395
  function CoreUsersAccess() {
4307
4396
  const { http } = useOonApi();
4308
- const queryClient = useQueryClient5();
4309
- const [email, setEmail] = useState14("");
4310
- const [name, setName] = useState14("");
4311
- const [roleCode, setRoleCode] = useState14("");
4312
- const [inviteUrl, setInviteUrl] = useState14(null);
4313
- const [message, setMessage] = useState14(null);
4397
+ const queryClient = useQueryClient6();
4398
+ const [email, setEmail] = useState15("");
4399
+ const [name, setName] = useState15("");
4400
+ const [roleCode, setRoleCode] = useState15("");
4401
+ const [inviteUrl, setInviteUrl] = useState15(null);
4402
+ const [message, setMessage] = useState15(null);
4314
4403
  const rbac = useQuery9({
4315
4404
  queryKey: ["oon", "rbac"],
4316
4405
  queryFn: async () => (await http.get("/core/rbac")).data,
@@ -4322,7 +4411,7 @@ function CoreUsersAccess() {
4322
4411
  queryFn: async () => (await http.get("/core/users")).data.results,
4323
4412
  enabled: rbac.data?.enabled === true
4324
4413
  });
4325
- const defaultRole = useMemo8(() => roles.find((role) => !role.admin)?.code || roles[0]?.code || "", [roles]);
4414
+ const defaultRole = useMemo9(() => roles.find((role) => !role.admin)?.code || roles[0]?.code || "", [roles]);
4326
4415
  const selectedRole = roleCode || defaultRole;
4327
4416
  const invite = useMutation4({
4328
4417
  mutationFn: async () => (await http.post("/core/users/invitations", {
@@ -4368,49 +4457,49 @@ function CoreUsersAccess() {
4368
4457
  setInviteUrl(null);
4369
4458
  await invite.mutateAsync();
4370
4459
  }
4371
- if (rbac.isLoading) return /* @__PURE__ */ jsx24(Box16, { p: 6, children: "Carregando acessos\u2026" });
4460
+ if (rbac.isLoading) return /* @__PURE__ */ jsx25(Box16, { p: 6, children: "Carregando acessos\u2026" });
4372
4461
  if (rbac.data?.enabled === false) {
4373
4462
  return /* @__PURE__ */ jsxs17(Box16, { p: 6, children: [
4374
- /* @__PURE__ */ jsx24(Heading8, { size: "lg", children: "Usu\xE1rios e Acessos" }),
4463
+ /* @__PURE__ */ jsx25(Heading8, { size: "lg", children: "Usu\xE1rios e Acessos" }),
4375
4464
  /* @__PURE__ */ jsxs17(Text17, { mt: 3, color: "gray.600", children: [
4376
4465
  "Esta Central est\xE1 em modo de acesso legado. Declare ",
4377
- /* @__PURE__ */ jsx24("code", { children: "rbac" }),
4466
+ /* @__PURE__ */ jsx25("code", { children: "rbac" }),
4378
4467
  " no central.app.json para habilitar a gest\xE3o nativa."
4379
4468
  ] })
4380
4469
  ] });
4381
4470
  }
4382
4471
  return /* @__PURE__ */ jsxs17(Box16, { p: { base: 4, md: 7 }, children: [
4383
- /* @__PURE__ */ jsx24(Flex10, { justify: "space-between", align: "start", gap: 6, wrap: "wrap", children: /* @__PURE__ */ jsxs17(Box16, { children: [
4384
- /* @__PURE__ */ jsx24(Heading8, { size: "lg", children: "Usu\xE1rios e Acessos" }),
4385
- /* @__PURE__ */ jsx24(Text17, { mt: 2, color: "gray.600", children: "Perfis e permiss\xF5es s\xE3o definidos pela Central; a seguran\xE7a efetiva \xE9 aplicada no backend." })
4472
+ /* @__PURE__ */ jsx25(Flex10, { justify: "space-between", align: "start", gap: 6, wrap: "wrap", children: /* @__PURE__ */ jsxs17(Box16, { children: [
4473
+ /* @__PURE__ */ jsx25(Heading8, { size: "lg", children: "Usu\xE1rios e Acessos" }),
4474
+ /* @__PURE__ */ jsx25(Text17, { mt: 2, color: "gray.600", children: "Perfis e permiss\xF5es s\xE3o definidos pela Central; a seguran\xE7a efetiva \xE9 aplicada no backend." })
4386
4475
  ] }) }),
4387
- /* @__PURE__ */ jsx24(Can, { permission: "users.invite", children: /* @__PURE__ */ jsxs17(Box16, { mt: 7, borderWidth: "1px", borderRadius: "14px", p: 5, bg: "white", children: [
4388
- /* @__PURE__ */ jsx24(Heading8, { size: "md", children: "Convidar usu\xE1rio" }),
4389
- /* @__PURE__ */ jsx24("form", { onSubmit: (event) => void submit(event), children: /* @__PURE__ */ jsxs17(Flex10, { mt: 4, gap: 3, wrap: "wrap", align: "end", children: [
4476
+ /* @__PURE__ */ jsx25(Can, { permission: "users.invite", children: /* @__PURE__ */ jsxs17(Box16, { mt: 7, borderWidth: "1px", borderRadius: "14px", p: 5, bg: "white", children: [
4477
+ /* @__PURE__ */ jsx25(Heading8, { size: "md", children: "Convidar usu\xE1rio" }),
4478
+ /* @__PURE__ */ jsx25("form", { onSubmit: (event) => void submit(event), children: /* @__PURE__ */ jsxs17(Flex10, { mt: 4, gap: 3, wrap: "wrap", align: "end", children: [
4390
4479
  /* @__PURE__ */ jsxs17(Box16, { minW: "220px", flex: "1", children: [
4391
- /* @__PURE__ */ jsx24(Text17, { mb: 1, fontSize: "sm", fontWeight: "600", children: "Nome" }),
4392
- /* @__PURE__ */ jsx24(Input7, { value: name, onChange: (event) => setName(event.target.value), placeholder: "Nome do usu\xE1rio" })
4480
+ /* @__PURE__ */ jsx25(Text17, { mb: 1, fontSize: "sm", fontWeight: "600", children: "Nome" }),
4481
+ /* @__PURE__ */ jsx25(Input7, { value: name, onChange: (event) => setName(event.target.value), placeholder: "Nome do usu\xE1rio" })
4393
4482
  ] }),
4394
4483
  /* @__PURE__ */ jsxs17(Box16, { minW: "260px", flex: "1", children: [
4395
- /* @__PURE__ */ jsx24(Text17, { mb: 1, fontSize: "sm", fontWeight: "600", children: "E-mail" }),
4396
- /* @__PURE__ */ jsx24(Input7, { type: "email", required: true, value: email, onChange: (event) => setEmail(event.target.value), placeholder: "usuario@empresa.com.br" })
4484
+ /* @__PURE__ */ jsx25(Text17, { mb: 1, fontSize: "sm", fontWeight: "600", children: "E-mail" }),
4485
+ /* @__PURE__ */ jsx25(Input7, { type: "email", required: true, value: email, onChange: (event) => setEmail(event.target.value), placeholder: "usuario@empresa.com.br" })
4397
4486
  ] }),
4398
4487
  /* @__PURE__ */ jsxs17(Box16, { minW: "190px", children: [
4399
- /* @__PURE__ */ jsx24(Text17, { mb: 1, fontSize: "sm", fontWeight: "600", children: "Perfil" }),
4400
- /* @__PURE__ */ jsx24("select", { style: { ...selectStyle, width: "100%" }, value: selectedRole, onChange: (event) => setRoleCode(event.target.value), children: roles.map((role) => /* @__PURE__ */ jsx24("option", { value: role.code, children: role.name }, role.code)) })
4488
+ /* @__PURE__ */ jsx25(Text17, { mb: 1, fontSize: "sm", fontWeight: "600", children: "Perfil" }),
4489
+ /* @__PURE__ */ jsx25("select", { style: { ...selectStyle, width: "100%" }, value: selectedRole, onChange: (event) => setRoleCode(event.target.value), children: roles.map((role) => /* @__PURE__ */ jsx25("option", { value: role.code, children: role.name }, role.code)) })
4401
4490
  ] }),
4402
- /* @__PURE__ */ jsx24(Button11, { type: "submit", disabled: invite.isPending || !email.trim() || !selectedRole, children: "Gerar convite" })
4491
+ /* @__PURE__ */ jsx25(Button11, { type: "submit", disabled: invite.isPending || !email.trim() || !selectedRole, children: "Gerar convite" })
4403
4492
  ] }) }),
4404
- message ? /* @__PURE__ */ jsx24(Text17, { mt: 4, fontSize: "sm", children: message }) : null,
4493
+ message ? /* @__PURE__ */ jsx25(Text17, { mt: 4, fontSize: "sm", children: message }) : null,
4405
4494
  inviteUrl ? /* @__PURE__ */ jsxs17(Flex10, { mt: 2, gap: 2, align: "center", wrap: "wrap", children: [
4406
- /* @__PURE__ */ jsx24(Input7, { value: inviteUrl, readOnly: true, flex: "1", minW: "280px" }),
4407
- /* @__PURE__ */ jsx24(Button11, { type: "button", onClick: () => void navigator.clipboard.writeText(inviteUrl), children: "Copiar link" })
4495
+ /* @__PURE__ */ jsx25(Input7, { value: inviteUrl, readOnly: true, flex: "1", minW: "280px" }),
4496
+ /* @__PURE__ */ jsx25(Button11, { type: "button", onClick: () => void navigator.clipboard.writeText(inviteUrl), children: "Copiar link" })
4408
4497
  ] }) : null
4409
4498
  ] }) }),
4410
- /* @__PURE__ */ jsx24(VStack2, { mt: 7, align: "stretch", gap: 3, children: (users.data ?? []).map((user) => /* @__PURE__ */ jsx24(Box16, { borderWidth: "1px", borderRadius: "14px", p: 4, bg: "white", children: /* @__PURE__ */ jsxs17(Flex10, { justify: "space-between", gap: 4, align: "center", wrap: "wrap", children: [
4499
+ /* @__PURE__ */ jsx25(VStack2, { mt: 7, align: "stretch", gap: 3, children: (users.data ?? []).map((user) => /* @__PURE__ */ jsx25(Box16, { borderWidth: "1px", borderRadius: "14px", p: 4, bg: "white", children: /* @__PURE__ */ jsxs17(Flex10, { justify: "space-between", gap: 4, align: "center", wrap: "wrap", children: [
4411
4500
  /* @__PURE__ */ jsxs17(Box16, { minW: "220px", flex: "1", children: [
4412
- /* @__PURE__ */ jsx24(Text17, { fontWeight: "700", children: user.name || user.email }),
4413
- /* @__PURE__ */ jsx24(Text17, { fontSize: "sm", color: "gray.600", children: user.email }),
4501
+ /* @__PURE__ */ jsx25(Text17, { fontWeight: "700", children: user.name || user.email }),
4502
+ /* @__PURE__ */ jsx25(Text17, { fontSize: "sm", color: "gray.600", children: user.email }),
4414
4503
  /* @__PURE__ */ jsxs17(Text17, { fontSize: "xs", color: "gray.500", mt: 1, children: [
4415
4504
  "Status: ",
4416
4505
  user.status,
@@ -4418,12 +4507,12 @@ function CoreUsersAccess() {
4418
4507
  fmt(user.lastAccessAt)
4419
4508
  ] })
4420
4509
  ] }),
4421
- /* @__PURE__ */ jsx24(Can, { permission: "users.update", children: /* @__PURE__ */ jsx24("select", { style: selectStyle, value: user.roleCode, onChange: (event) => updateUser.mutate({ id: user.id, payload: { roleCode: event.target.value } }), children: roles.map((role) => /* @__PURE__ */ jsx24("option", { value: role.code, children: role.name }, role.code)) }) }),
4422
- user.invitation?.status === "pending" ? /* @__PURE__ */ jsx24(Can, { permission: "users.invite", children: /* @__PURE__ */ jsxs17(Flex10, { gap: 2, wrap: "wrap", children: [
4423
- /* @__PURE__ */ jsx24(Button11, { size: "sm", variant: "outline", onClick: () => copyInvitation.mutate(user.invitation.id), children: "Copiar link" }),
4424
- /* @__PURE__ */ jsx24(Button11, { size: "sm", onClick: () => regenerate.mutate(user.invitation.id), children: "Gerar novo link" })
4510
+ /* @__PURE__ */ jsx25(Can, { permission: "users.update", children: /* @__PURE__ */ jsx25("select", { style: selectStyle, value: user.roleCode, onChange: (event) => updateUser.mutate({ id: user.id, payload: { roleCode: event.target.value } }), children: roles.map((role) => /* @__PURE__ */ jsx25("option", { value: role.code, children: role.name }, role.code)) }) }),
4511
+ user.invitation?.status === "pending" ? /* @__PURE__ */ jsx25(Can, { permission: "users.invite", children: /* @__PURE__ */ jsxs17(Flex10, { gap: 2, wrap: "wrap", children: [
4512
+ /* @__PURE__ */ jsx25(Button11, { size: "sm", variant: "outline", onClick: () => copyInvitation.mutate(user.invitation.id), children: "Copiar link" }),
4513
+ /* @__PURE__ */ jsx25(Button11, { size: "sm", onClick: () => regenerate.mutate(user.invitation.id), children: "Gerar novo link" })
4425
4514
  ] }) }) : null,
4426
- /* @__PURE__ */ jsx24(Can, { permission: "users.disable", children: user.status === "active" ? /* @__PURE__ */ jsx24(Button11, { size: "sm", variant: "outline", onClick: () => updateUser.mutate({ id: user.id, payload: { status: "disabled" } }), children: "Desabilitar" }) : user.status === "disabled" ? /* @__PURE__ */ jsx24(Button11, { size: "sm", variant: "outline", onClick: () => updateUser.mutate({ id: user.id, payload: { status: "active" } }), children: "Habilitar" }) : null })
4515
+ /* @__PURE__ */ jsx25(Can, { permission: "users.disable", children: user.status === "active" ? /* @__PURE__ */ jsx25(Button11, { size: "sm", variant: "outline", onClick: () => updateUser.mutate({ id: user.id, payload: { status: "disabled" } }), children: "Desabilitar" }) : user.status === "disabled" ? /* @__PURE__ */ jsx25(Button11, { size: "sm", variant: "outline", onClick: () => updateUser.mutate({ id: user.id, payload: { status: "active" } }), children: "Habilitar" }) : null })
4427
4516
  ] }) }, user.id)) })
4428
4517
  ] });
4429
4518
  }
@@ -4434,7 +4523,7 @@ import { useNavigate } from "react-router-dom";
4434
4523
 
4435
4524
  // src/app/componentRegistry.tsx
4436
4525
  import { Box as Box17, Text as Text18 } from "@chakra-ui/react";
4437
- import { Fragment as Fragment4, jsx as jsx25, jsxs as jsxs18 } from "react/jsx-runtime";
4526
+ import { Fragment as Fragment4, jsx as jsx26, jsxs as jsxs18 } from "react/jsx-runtime";
4438
4527
  var PREFIX_BUCKETS = {
4439
4528
  "custom": "pageComponents",
4440
4529
  "fields": "fieldRenderers",
@@ -4454,12 +4543,12 @@ function resolveComponent(registry, key, bucket) {
4454
4543
  return registry?.[targetBucket]?.[normalized2] ?? registry?.[targetBucket]?.[key] ?? null;
4455
4544
  }
4456
4545
  function MissingRenderer({ renderer, children }) {
4457
- if (import.meta.env?.MODE === "production") return /* @__PURE__ */ jsx25(Fragment4, { children: children ?? null });
4546
+ if (import.meta.env?.MODE === "production") return /* @__PURE__ */ jsx26(Fragment4, { children: children ?? null });
4458
4547
  return /* @__PURE__ */ jsxs18(Box17, { borderWidth: "1px", borderStyle: "dashed", borderColor: "orange.300", bg: "orange.50", color: "orange.900", borderRadius: "md", p: 3, children: [
4459
- /* @__PURE__ */ jsx25(Text18, { fontSize: "sm", fontWeight: "600", children: "Renderer n\xE3o encontrado" }),
4548
+ /* @__PURE__ */ jsx26(Text18, { fontSize: "sm", fontWeight: "600", children: "Renderer n\xE3o encontrado" }),
4460
4549
  /* @__PURE__ */ jsxs18(Text18, { fontSize: "xs", children: [
4461
4550
  "Registre a chave ",
4462
- renderer ? /* @__PURE__ */ jsx25("code", { children: renderer }) : "solicitada",
4551
+ renderer ? /* @__PURE__ */ jsx26("code", { children: renderer }) : "solicitada",
4463
4552
  " no registry da UI."
4464
4553
  ] }),
4465
4554
  children
@@ -4468,60 +4557,60 @@ function MissingRenderer({ renderer, children }) {
4468
4557
 
4469
4558
  // src/components/ui-v2/CorePrimitives.tsx
4470
4559
  import { Box as Box18, Button as Button12, Flex as Flex11, Heading as Heading9, Spinner as Spinner3, Text as Text19 } from "@chakra-ui/react";
4471
- import { jsx as jsx26, jsxs as jsxs19 } from "react/jsx-runtime";
4560
+ import { jsx as jsx27, jsxs as jsxs19 } from "react/jsx-runtime";
4472
4561
  function CorePage({ children }) {
4473
- return /* @__PURE__ */ jsx26(Box18, { children });
4562
+ return /* @__PURE__ */ jsx27(Box18, { children });
4474
4563
  }
4475
4564
  function CorePageHeader({ title, description, actions }) {
4476
4565
  return /* @__PURE__ */ jsxs19(Flex11, { align: "start", justify: "space-between", gap: 4, mb: 6, children: [
4477
4566
  /* @__PURE__ */ jsxs19(Box18, { children: [
4478
- title ? /* @__PURE__ */ jsx26(Heading9, { size: "lg", children: title }) : null,
4479
- description ? /* @__PURE__ */ jsx26(Text19, { color: "gray.600", mt: 1, children: description }) : null
4567
+ title ? /* @__PURE__ */ jsx27(Heading9, { size: "lg", children: title }) : null,
4568
+ description ? /* @__PURE__ */ jsx27(Text19, { color: "gray.600", mt: 1, children: description }) : null
4480
4569
  ] }),
4481
4570
  actions
4482
4571
  ] });
4483
4572
  }
4484
4573
  function CoreToolbar({ children }) {
4485
- return /* @__PURE__ */ jsx26(Flex11, { align: "center", gap: 2, mb: 4, children });
4574
+ return /* @__PURE__ */ jsx27(Flex11, { align: "center", gap: 2, mb: 4, children });
4486
4575
  }
4487
4576
  function CoreDataGrid(props) {
4488
- return /* @__PURE__ */ jsx26(CoreCollection, { ...props });
4577
+ return /* @__PURE__ */ jsx27(CoreCollection, { ...props });
4489
4578
  }
4490
4579
  function CoreCards(props) {
4491
- return /* @__PURE__ */ jsx26(CoreCollection, { model: props.model, mode: "minimal", label: props.model });
4580
+ return /* @__PURE__ */ jsx27(CoreCollection, { model: props.model, mode: "minimal", label: props.model });
4492
4581
  }
4493
4582
  function CoreForm(props) {
4494
- return /* @__PURE__ */ jsx26(Box18, { children: props.children });
4583
+ return /* @__PURE__ */ jsx27(Box18, { children: props.children });
4495
4584
  }
4496
4585
  function CoreField({ label, children }) {
4497
4586
  return /* @__PURE__ */ jsxs19(Box18, { children: [
4498
- /* @__PURE__ */ jsx26(Text19, { fontSize: "sm", fontWeight: "600", children: label }),
4587
+ /* @__PURE__ */ jsx27(Text19, { fontSize: "sm", fontWeight: "600", children: label }),
4499
4588
  children
4500
4589
  ] });
4501
4590
  }
4502
4591
  function CoreRelationField(props) {
4503
- return /* @__PURE__ */ jsx26(CoreField, { ...props });
4592
+ return /* @__PURE__ */ jsx27(CoreField, { ...props });
4504
4593
  }
4505
4594
  function CoreActions({ children }) {
4506
- return /* @__PURE__ */ jsx26(Flex11, { gap: 2, children });
4595
+ return /* @__PURE__ */ jsx27(Flex11, { gap: 2, children });
4507
4596
  }
4508
4597
  function CoreEmptyState({ title = "Nenhum dado encontrado", actionLabel, onAction }) {
4509
4598
  return /* @__PURE__ */ jsxs19(Box18, { textAlign: "center", py: 10, children: [
4510
- /* @__PURE__ */ jsx26(Text19, { children: title }),
4511
- actionLabel ? /* @__PURE__ */ jsx26(Button12, { mt: 3, onClick: onAction, children: actionLabel }) : null
4599
+ /* @__PURE__ */ jsx27(Text19, { children: title }),
4600
+ actionLabel ? /* @__PURE__ */ jsx27(Button12, { mt: 3, onClick: onAction, children: actionLabel }) : null
4512
4601
  ] });
4513
4602
  }
4514
4603
  function CoreLoadingState({ label = "Carregando..." }) {
4515
4604
  return /* @__PURE__ */ jsxs19(Flex11, { align: "center", gap: 3, children: [
4516
- /* @__PURE__ */ jsx26(Spinner3, { size: "sm" }),
4517
- /* @__PURE__ */ jsx26(Text19, { children: label })
4605
+ /* @__PURE__ */ jsx27(Spinner3, { size: "sm" }),
4606
+ /* @__PURE__ */ jsx27(Text19, { children: label })
4518
4607
  ] });
4519
4608
  }
4520
4609
 
4521
4610
  // src/components/ui-v2/CorePage.tsx
4522
- import { jsx as jsx27, jsxs as jsxs20 } from "react/jsx-runtime";
4611
+ import { jsx as jsx28, jsxs as jsxs20 } from "react/jsx-runtime";
4523
4612
  function renderMarkdown(content) {
4524
- return content.split(/\n{2,}/).map((paragraph, index) => /* @__PURE__ */ jsx27(Text20, { whiteSpace: "pre-wrap", children: paragraph }, index));
4613
+ return content.split(/\n{2,}/).map((paragraph, index) => /* @__PURE__ */ jsx28(Text20, { whiteSpace: "pre-wrap", children: paragraph }, index));
4525
4614
  }
4526
4615
  function requiredAccess(source) {
4527
4616
  const values = [...source.permissions ?? [], ...source.capabilities ?? []].filter(Boolean);
@@ -4534,16 +4623,16 @@ function CoreBlock({ block, registry }) {
4534
4623
  switch (block.type) {
4535
4624
  case "custom": {
4536
4625
  const Component = resolveComponent(registry, block.component, "pageComponents");
4537
- return Component ? /* @__PURE__ */ jsx27(Component, { block, ...block.props }) : /* @__PURE__ */ jsx27(MissingRenderer, { renderer: block.component });
4626
+ return Component ? /* @__PURE__ */ jsx28(Component, { block, ...block.props }) : /* @__PURE__ */ jsx28(MissingRenderer, { renderer: block.component });
4538
4627
  }
4539
4628
  case "collection.datagrid":
4540
- return /* @__PURE__ */ jsx27(CoreDataGrid, { model: block.model, mode: block.mode, columns: block.columns, form: block.form, label: block.title ?? block.model });
4629
+ return /* @__PURE__ */ jsx28(CoreDataGrid, { model: block.model, mode: block.mode, columns: block.columns, form: block.form, label: block.title ?? block.model });
4541
4630
  case "collection.cards": {
4542
4631
  const Component = resolveComponent(registry, block.renderer, "cardRenderers");
4543
- return Component ? /* @__PURE__ */ jsx27(Component, { block, model: block.model }) : /* @__PURE__ */ jsx27(CoreCards, { model: block.model, renderer: block.renderer });
4632
+ return Component ? /* @__PURE__ */ jsx28(Component, { block, model: block.model }) : /* @__PURE__ */ jsx28(CoreCards, { model: block.model, renderer: block.renderer });
4544
4633
  }
4545
4634
  case "navigation.cards":
4546
- return /* @__PURE__ */ jsx27(Flex12, { gap: 4, wrap: "wrap", children: block.cards.map((card) => /* @__PURE__ */ jsx27(
4635
+ return /* @__PURE__ */ jsx28(Flex12, { gap: 4, wrap: "wrap", children: block.cards.map((card) => /* @__PURE__ */ jsx28(
4547
4636
  Box19,
4548
4637
  {
4549
4638
  minW: "260px",
@@ -4554,10 +4643,10 @@ function CoreBlock({ block, registry }) {
4554
4643
  p: 5,
4555
4644
  children: /* @__PURE__ */ jsxs20(Stack7, { gap: 3, height: "100%", children: [
4556
4645
  /* @__PURE__ */ jsxs20(Box19, { flex: "1", children: [
4557
- /* @__PURE__ */ jsx27(Heading10, { size: "md", mb: 2, children: card.title }),
4558
- card.description ? /* @__PURE__ */ jsx27(Text20, { color: "gray.600", children: card.description }) : null
4646
+ /* @__PURE__ */ jsx28(Heading10, { size: "md", mb: 2, children: card.title }),
4647
+ card.description ? /* @__PURE__ */ jsx28(Text20, { color: "gray.600", children: card.description }) : null
4559
4648
  ] }),
4560
- /* @__PURE__ */ jsx27(
4649
+ /* @__PURE__ */ jsx28(
4561
4650
  Button13,
4562
4651
  {
4563
4652
  alignSelf: "flex-start",
@@ -4578,28 +4667,28 @@ function CoreBlock({ block, registry }) {
4578
4667
  )) });
4579
4668
  case "section":
4580
4669
  return /* @__PURE__ */ jsxs20(Box19, { children: [
4581
- /* @__PURE__ */ jsx27(Heading10, { size: "md", mb: block.description ? 1 : 4, children: block.title }),
4582
- block.description ? /* @__PURE__ */ jsx27(Text20, { color: "gray.600", mb: 4, children: block.description }) : null,
4583
- /* @__PURE__ */ jsx27(Stack7, { gap: 4, children: block.blocks?.map((child, index) => /* @__PURE__ */ jsx27(CoreBlock, { block: child, registry }, child.id ?? index)) })
4670
+ /* @__PURE__ */ jsx28(Heading10, { size: "md", mb: block.description ? 1 : 4, children: block.title }),
4671
+ block.description ? /* @__PURE__ */ jsx28(Text20, { color: "gray.600", mb: 4, children: block.description }) : null,
4672
+ /* @__PURE__ */ jsx28(Stack7, { gap: 4, children: block.blocks?.map((child, index) => /* @__PURE__ */ jsx28(CoreBlock, { block: child, registry }, child.id ?? index)) })
4584
4673
  ] });
4585
4674
  case "markdown":
4586
- return /* @__PURE__ */ jsx27(Stack7, { gap: 2, children: renderMarkdown(block.content) });
4675
+ return /* @__PURE__ */ jsx28(Stack7, { gap: 2, children: renderMarkdown(block.content) });
4587
4676
  default:
4588
- return /* @__PURE__ */ jsx27(MissingRenderer, { renderer: block.type });
4677
+ return /* @__PURE__ */ jsx28(MissingRenderer, { renderer: block.type });
4589
4678
  }
4590
4679
  })();
4591
- return /* @__PURE__ */ jsx27(PermissionGate, { permission: requiredAccess(block), children: content });
4680
+ return /* @__PURE__ */ jsx28(PermissionGate, { permission: requiredAccess(block), children: content });
4592
4681
  }
4593
4682
  function CorePage2({ page, registry }) {
4594
4683
  const Component = resolveComponent(registry, page.component, "pageComponents");
4595
- return /* @__PURE__ */ jsx27(PermissionGate, { permission: requiredAccess(page), children: Component ? /* @__PURE__ */ jsx27(Component, { page }) : /* @__PURE__ */ jsxs20(CorePage, { children: [
4596
- /* @__PURE__ */ jsx27(CorePageHeader, { title: page.title ?? page.label }),
4597
- /* @__PURE__ */ jsx27(Stack7, { gap: 6, children: page.blocks?.map((block, index) => /* @__PURE__ */ jsx27(CoreBlock, { block, registry }, block.id ?? index)) })
4684
+ return /* @__PURE__ */ jsx28(PermissionGate, { permission: requiredAccess(page), children: Component ? /* @__PURE__ */ jsx28(Component, { page }) : /* @__PURE__ */ jsxs20(CorePage, { children: [
4685
+ /* @__PURE__ */ jsx28(CorePageHeader, { title: page.title ?? page.label }),
4686
+ /* @__PURE__ */ jsx28(Stack7, { gap: 6, children: page.blocks?.map((block, index) => /* @__PURE__ */ jsx28(CoreBlock, { block, registry }, block.id ?? index)) })
4598
4687
  ] }) });
4599
4688
  }
4600
4689
 
4601
4690
  // src/app/moduleRegistry.tsx
4602
- import { jsx as jsx28 } from "react/jsx-runtime";
4691
+ import { jsx as jsx29 } from "react/jsx-runtime";
4603
4692
  function slug2(value2) {
4604
4693
  return value2.normalize("NFD").replace(/[\u0300-\u036f]/g, "").toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "");
4605
4694
  }
@@ -4637,19 +4726,19 @@ function renderView(view, registry) {
4637
4726
  switch (view.type) {
4638
4727
  case "collection": {
4639
4728
  const v = view;
4640
- return /* @__PURE__ */ jsx28(CoreCollection, { model: v.model, mode: v.mode, columns: v.columns, form: v.form, label: viewLabel(v), section: v.section, importExport: v.importExport, list: v.list, relations: v.relations, detailModal: v.detailModal, cellRenderers: registry?.cellRenderers });
4729
+ return /* @__PURE__ */ jsx29(CoreCollection, { model: v.model, mode: v.mode, columns: v.columns, form: v.form, label: viewLabel(v), section: v.section, importExport: v.importExport, list: v.list, relations: v.relations, detailModal: v.detailModal, cellRenderers: registry?.cellRenderers });
4641
4730
  }
4642
4731
  case "document": {
4643
4732
  const v = view;
4644
- return /* @__PURE__ */ jsx28(CoreDocument, { model: v.model, label: viewLabel(v), approval: v.approval, attachments: v.attachments });
4733
+ return /* @__PURE__ */ jsx29(CoreDocument, { model: v.model, label: viewLabel(v), approval: v.approval, attachments: v.attachments });
4645
4734
  }
4646
4735
  case "pipeline": {
4647
4736
  const v = view;
4648
- return /* @__PURE__ */ jsx28(CorePipeline, { model: v.model, label: viewLabel(v), stageField: v.stageField, stages: v.stages, titleField: v.titleField, form: v.form, relations: v.relations, ticketModal: v.ticketModal, filters: v.filters, create: v.create, viewModes: v.viewModes, defaultView: v.defaultView, list: v.list, defaultActions: v.defaultActions, ticketActions: v.ticketActions });
4737
+ return /* @__PURE__ */ jsx29(CorePipeline, { model: v.model, label: viewLabel(v), stageField: v.stageField, stages: v.stages, titleField: v.titleField, form: v.form, relations: v.relations, ticketModal: v.ticketModal, filters: v.filters, create: v.create, viewModes: v.viewModes, defaultView: v.defaultView, list: v.list, defaultActions: v.defaultActions, ticketActions: v.ticketActions });
4649
4738
  }
4650
4739
  case "dashboard": {
4651
4740
  const v = view;
4652
- return /* @__PURE__ */ jsx28(CoreDashboard, { label: viewLabel(v), widgets: v.widgets });
4741
+ return /* @__PURE__ */ jsx29(CoreDashboard, { label: viewLabel(v), widgets: v.widgets });
4653
4742
  }
4654
4743
  default:
4655
4744
  return null;
@@ -4659,7 +4748,7 @@ function viewToRoute(view, registry) {
4659
4748
  return { path: viewPath(view), element: renderView(view, registry), permissions: requiredPermissions(view), capabilities: "capabilities" in view ? view.capabilities : void 0 };
4660
4749
  }
4661
4750
  function pageToRoute(page, registry) {
4662
- return { path: page.path, element: /* @__PURE__ */ jsx28(CorePage2, { page, registry }), permissions: requiredPermissions(page), capabilities: page.capabilities };
4751
+ return { path: page.path, element: /* @__PURE__ */ jsx29(CorePage2, { page, registry }), permissions: requiredPermissions(page), capabilities: page.capabilities };
4663
4752
  }
4664
4753
  function pageToMenu(page) {
4665
4754
  if (!page.label) return null;
@@ -4692,7 +4781,7 @@ function resolveRegistry(config) {
4692
4781
  }
4693
4782
  }
4694
4783
  if (["root-central", "member-central"].includes(String(config.app.kind || ""))) {
4695
- pushRoute({ path: "/usuarios-acessos", element: /* @__PURE__ */ jsx28(CoreUsersAccess, {}), permissions: ["users.read"] });
4784
+ pushRoute({ path: "/usuarios-acessos", element: /* @__PURE__ */ jsx29(CoreUsersAccess, {}), permissions: ["users.read"] });
4696
4785
  pushMenu({ label: "Usu\xE1rios e Acessos", href: "/usuarios-acessos", section: "Configura\xE7\xF5es", order: 900, permissions: ["users.read"] });
4697
4786
  }
4698
4787
  const navMode = config.ui?.navigation?.mode ?? "auto";
@@ -4727,7 +4816,7 @@ import { Outlet, useNavigate as useNavigate2 } from "react-router-dom";
4727
4816
  // src/shell/Sidebar.tsx
4728
4817
  import { Box as Box20, Flex as Flex13, Image, Stack as Stack8, Text as Text21 } from "@chakra-ui/react";
4729
4818
  import { NavLink } from "react-router-dom";
4730
- import { jsx as jsx29, jsxs as jsxs21 } from "react/jsx-runtime";
4819
+ import { jsx as jsx30, jsxs as jsxs21 } from "react/jsx-runtime";
4731
4820
  function groupBySection(items) {
4732
4821
  const groups = /* @__PURE__ */ new Map();
4733
4822
  for (const item of items) {
@@ -4757,7 +4846,7 @@ function Sidebar({ app, menu, registry }) {
4757
4846
  overflowY: "auto",
4758
4847
  children: [
4759
4848
  /* @__PURE__ */ jsxs21(Flex13, { align: "center", gap: 3, mb: 6, px: { base: 1, lg: 2 }, minH: "42px", children: [
4760
- app.logo ? /* @__PURE__ */ jsx29(Image, { src: app.logo, alt: app.name, maxH: "36px", maxW: { base: "44px", lg: "150px" }, objectFit: "contain" }) : /* @__PURE__ */ jsx29(
4849
+ app.logo ? /* @__PURE__ */ jsx30(Image, { src: app.logo, alt: app.name, maxH: "36px", maxW: { base: "44px", lg: "150px" }, objectFit: "contain" }) : /* @__PURE__ */ jsx30(
4761
4850
  Flex13,
4762
4851
  {
4763
4852
  w: "38px",
@@ -4774,12 +4863,12 @@ function Sidebar({ app, menu, registry }) {
4774
4863
  }
4775
4864
  ),
4776
4865
  /* @__PURE__ */ jsxs21(Box20, { display: { base: "none", lg: "block" }, minW: 0, children: [
4777
- /* @__PURE__ */ jsx29(Text21, { fontWeight: "700", fontSize: "sm", color: "#07262E", lineClamp: 1, children: app.name }),
4778
- /* @__PURE__ */ jsx29(Text21, { fontSize: "10px", color: "gray.500", textTransform: "uppercase", letterSpacing: "0.08em", children: "Opera\xE7\xE3o digital" })
4866
+ /* @__PURE__ */ jsx30(Text21, { fontWeight: "700", fontSize: "sm", color: "#07262E", lineClamp: 1, children: app.name }),
4867
+ /* @__PURE__ */ jsx30(Text21, { fontSize: "10px", color: "gray.500", textTransform: "uppercase", letterSpacing: "0.08em", children: "Opera\xE7\xE3o digital" })
4779
4868
  ] })
4780
4869
  ] }),
4781
- /* @__PURE__ */ jsx29(Stack8, { gap: 5, children: groupBySection(visible).map(([section, items]) => /* @__PURE__ */ jsxs21(Stack8, { gap: 1, children: [
4782
- /* @__PURE__ */ jsx29(
4870
+ /* @__PURE__ */ jsx30(Stack8, { gap: 5, children: groupBySection(visible).map(([section, items]) => /* @__PURE__ */ jsxs21(Stack8, { gap: 1, children: [
4871
+ /* @__PURE__ */ jsx30(
4783
4872
  Text21,
4784
4873
  {
4785
4874
  display: { base: "none", lg: "block" },
@@ -4795,8 +4884,8 @@ function Sidebar({ app, menu, registry }) {
4795
4884
  ),
4796
4885
  items.map((item) => {
4797
4886
  const CustomMenuItem = resolveComponent(registry, item.renderer, "menuRenderers");
4798
- if (CustomMenuItem) return /* @__PURE__ */ jsx29(CustomMenuItem, { item }, item.href);
4799
- return /* @__PURE__ */ jsx29(NavLink, { to: item.href, end: item.href === "/", title: item.label, children: ({ isActive }) => /* @__PURE__ */ jsxs21(
4887
+ if (CustomMenuItem) return /* @__PURE__ */ jsx30(CustomMenuItem, { item }, item.href);
4888
+ return /* @__PURE__ */ jsx30(NavLink, { to: item.href, end: item.href === "/", title: item.label, children: ({ isActive }) => /* @__PURE__ */ jsxs21(
4800
4889
  Flex13,
4801
4890
  {
4802
4891
  align: "center",
@@ -4814,8 +4903,8 @@ function Sidebar({ app, menu, registry }) {
4814
4903
  transition: "all 0.15s ease",
4815
4904
  _hover: { bg: isActive ? "brand.50" : "#F8F9FA", color: "brand.700" },
4816
4905
  children: [
4817
- item.icon ? /* @__PURE__ */ jsx29(Box20, { flex: "0 0 auto", children: item.icon }) : /* @__PURE__ */ jsx29(Box20, { w: "7px", h: "7px", borderRadius: "full", bg: isActive ? "brand.500" : "gray.300" }),
4818
- /* @__PURE__ */ jsx29(Text21, { display: { base: "none", lg: "block" }, lineClamp: 1, children: item.label })
4906
+ item.icon ? /* @__PURE__ */ jsx30(Box20, { flex: "0 0 auto", children: item.icon }) : /* @__PURE__ */ jsx30(Box20, { w: "7px", h: "7px", borderRadius: "full", bg: isActive ? "brand.500" : "gray.300" }),
4907
+ /* @__PURE__ */ jsx30(Text21, { display: { base: "none", lg: "block" }, lineClamp: 1, children: item.label })
4819
4908
  ]
4820
4909
  }
4821
4910
  ) }, item.href);
@@ -4829,7 +4918,7 @@ function Sidebar({ app, menu, registry }) {
4829
4918
  // package.json
4830
4919
  var package_default = {
4831
4920
  name: "@oondemand/oon-core-front",
4832
- version: "0.3.75",
4921
+ version: "0.4.0",
4833
4922
  repository: {
4834
4923
  type: "git",
4835
4924
  url: "git+https://github.com/oondemand/oon-platform.git",
@@ -4948,7 +5037,7 @@ function shortCommit(commit) {
4948
5037
  }
4949
5038
 
4950
5039
  // src/shell/DefaultShell.tsx
4951
- import { jsx as jsx30, jsxs as jsxs22 } from "react/jsx-runtime";
5040
+ import { jsx as jsx31, jsxs as jsxs22 } from "react/jsx-runtime";
4952
5041
  function SettingsIcon() {
4953
5042
  return /* @__PURE__ */ jsxs22(
4954
5043
  "svg",
@@ -4960,7 +5049,7 @@ function SettingsIcon() {
4960
5049
  fill: "none",
4961
5050
  xmlns: "http://www.w3.org/2000/svg",
4962
5051
  children: [
4963
- /* @__PURE__ */ jsx30(
5052
+ /* @__PURE__ */ jsx31(
4964
5053
  "path",
4965
5054
  {
4966
5055
  d: "M12 15.25a3.25 3.25 0 1 0 0-6.5 3.25 3.25 0 0 0 0 6.5Z",
@@ -4968,7 +5057,7 @@ function SettingsIcon() {
4968
5057
  strokeWidth: "1.8"
4969
5058
  }
4970
5059
  ),
4971
- /* @__PURE__ */ jsx30(
5060
+ /* @__PURE__ */ jsx31(
4972
5061
  "path",
4973
5062
  {
4974
5063
  d: "M19.43 12.98c.04-.32.07-.65.07-.98s-.03-.66-.08-.98l2.12-1.66-2-3.46-2.5 1a7.64 7.64 0 0 0-1.7-.98L15 3.25h-4l-.35 2.67c-.61.25-1.18.58-1.7.98l-2.5-1-2 3.46 2.12 1.66c-.04.32-.07.65-.07.98s.03.66.08.98l-2.12 1.66 2 3.46 2.5-1c.52.4 1.09.73 1.7.98l.34 2.67h4l.35-2.67a7.64 7.64 0 0 0 1.7-.98l2.5 1 2-3.46-2.12-1.66Z",
@@ -5033,7 +5122,7 @@ function CoreTopbar({ app, menu }) {
5033
5122
  zIndex: 10,
5034
5123
  children: [
5035
5124
  /* @__PURE__ */ jsxs22(Box21, { minW: 0, title: details, children: [
5036
- /* @__PURE__ */ jsx30(
5125
+ /* @__PURE__ */ jsx31(
5037
5126
  Text22,
5038
5127
  {
5039
5128
  fontSize: "xs",
@@ -5044,7 +5133,7 @@ function CoreTopbar({ app, menu }) {
5044
5133
  children: "Central Oon"
5045
5134
  }
5046
5135
  ),
5047
- /* @__PURE__ */ jsx30(Text22, { fontSize: "sm", fontWeight: "600", color: "#24323A", children: app.title ?? app.name }),
5136
+ /* @__PURE__ */ jsx31(Text22, { fontSize: "sm", fontWeight: "600", color: "#24323A", children: app.title ?? app.name }),
5048
5137
  /* @__PURE__ */ jsxs22(Text22, { fontSize: "10px", color: "gray.600", lineHeight: "1.35", children: [
5049
5138
  "Central ",
5050
5139
  centralVersion,
@@ -5053,15 +5142,15 @@ function CoreTopbar({ app, menu }) {
5053
5142
  " \xB7 Back ",
5054
5143
  backendVersion
5055
5144
  ] }),
5056
- publicationParts.length ? /* @__PURE__ */ jsx30(Text22, { fontSize: "10px", color: "gray.500", lineHeight: "1.35", children: publicationParts.join(" \xB7 ") }) : null
5145
+ publicationParts.length ? /* @__PURE__ */ jsx31(Text22, { fontSize: "10px", color: "gray.500", lineHeight: "1.35", children: publicationParts.join(" \xB7 ") }) : null
5057
5146
  ] }),
5058
- /* @__PURE__ */ jsx30(Spacer2, {}),
5147
+ /* @__PURE__ */ jsx31(Spacer2, {}),
5059
5148
  user ? /* @__PURE__ */ jsxs22(Flex14, { align: "center", gap: 3, children: [
5060
5149
  /* @__PURE__ */ jsxs22(Box21, { textAlign: "right", display: { base: "none", md: "block" }, children: [
5061
- /* @__PURE__ */ jsx30(Text22, { fontSize: "sm", fontWeight: "600", color: "#24323A", children: user.nome }),
5062
- user.email ? /* @__PURE__ */ jsx30(Text22, { fontSize: "xs", color: "gray.500", children: user.email }) : null
5150
+ /* @__PURE__ */ jsx31(Text22, { fontSize: "sm", fontWeight: "600", color: "#24323A", children: user.nome }),
5151
+ user.email ? /* @__PURE__ */ jsx31(Text22, { fontSize: "xs", color: "gray.500", children: user.email }) : null
5063
5152
  ] }),
5064
- settingsHref ? /* @__PURE__ */ jsx30(
5153
+ settingsHref ? /* @__PURE__ */ jsx31(
5065
5154
  Button14,
5066
5155
  {
5067
5156
  size: "sm",
@@ -5073,10 +5162,10 @@ function CoreTopbar({ app, menu }) {
5073
5162
  "aria-label": "Abrir configura\xE7\xF5es",
5074
5163
  title: "Configura\xE7\xF5es",
5075
5164
  onClick: () => navigate(settingsHref),
5076
- children: /* @__PURE__ */ jsx30(SettingsIcon, {})
5165
+ children: /* @__PURE__ */ jsx31(SettingsIcon, {})
5077
5166
  }
5078
5167
  ) : null,
5079
- /* @__PURE__ */ jsx30(
5168
+ /* @__PURE__ */ jsx31(
5080
5169
  Button14,
5081
5170
  {
5082
5171
  size: "sm",
@@ -5102,12 +5191,12 @@ function Slot({
5102
5191
  if (slot === "none") return null;
5103
5192
  if (slot?.startsWith("custom:")) {
5104
5193
  const Component = resolveComponent(registry, slot, "layoutSlots");
5105
- return Component ? /* @__PURE__ */ jsx30(Component, { app, menu }) : /* @__PURE__ */ jsx30(MissingRenderer, { renderer: slot });
5194
+ return Component ? /* @__PURE__ */ jsx31(Component, { app, menu }) : /* @__PURE__ */ jsx31(MissingRenderer, { renderer: slot });
5106
5195
  }
5107
- if (name === "sidebar") return /* @__PURE__ */ jsx30(Sidebar, { app, menu, registry });
5108
- if (name === "topbar") return /* @__PURE__ */ jsx30(CoreTopbar, { app, menu });
5196
+ if (name === "sidebar") return /* @__PURE__ */ jsx31(Sidebar, { app, menu, registry });
5197
+ if (name === "topbar") return /* @__PURE__ */ jsx31(CoreTopbar, { app, menu });
5109
5198
  if (name === "footer" && slot === "core") {
5110
- return /* @__PURE__ */ jsx30(Box21, { as: "footer", px: 6, py: 4, color: "gray.500", fontSize: "xs", borderTopWidth: "1px", children: "OonCore" });
5199
+ return /* @__PURE__ */ jsx31(Box21, { as: "footer", px: 6, py: 4, color: "gray.500", fontSize: "xs", borderTopWidth: "1px", children: "OonCore" });
5111
5200
  }
5112
5201
  return null;
5113
5202
  }
@@ -5120,7 +5209,7 @@ function DefaultShell({
5120
5209
  const portal = layout?.shell === "portal" || layout?.shell === "content-only";
5121
5210
  const mainPadding = portal ? { base: 4, lg: 10 } : { base: 4, lg: 6 };
5122
5211
  return /* @__PURE__ */ jsxs22(Flex14, { align: "stretch", minH: "100vh", bg: portal ? "white" : "#F8F9FA", children: [
5123
- /* @__PURE__ */ jsx30(
5212
+ /* @__PURE__ */ jsx31(
5124
5213
  Slot,
5125
5214
  {
5126
5215
  name: "sidebar",
@@ -5131,7 +5220,7 @@ function DefaultShell({
5131
5220
  }
5132
5221
  ),
5133
5222
  /* @__PURE__ */ jsxs22(Flex14, { direction: "column", flex: "1", minW: 0, children: [
5134
- /* @__PURE__ */ jsx30(
5223
+ /* @__PURE__ */ jsx31(
5135
5224
  Slot,
5136
5225
  {
5137
5226
  name: "topbar",
@@ -5141,9 +5230,9 @@ function DefaultShell({
5141
5230
  menu
5142
5231
  }
5143
5232
  ),
5144
- /* @__PURE__ */ jsx30(Slot, { name: "header", slot: layout?.header, registry, app, menu }),
5145
- /* @__PURE__ */ jsx30(Box21, { as: "main", flex: "1", p: mainPadding, minW: 0, children: /* @__PURE__ */ jsx30(Box21, { maxW: portal ? "1180px" : "1680px", mx: "auto", children: /* @__PURE__ */ jsx30(Outlet, {}) }) }),
5146
- /* @__PURE__ */ jsx30(
5233
+ /* @__PURE__ */ jsx31(Slot, { name: "header", slot: layout?.header, registry, app, menu }),
5234
+ /* @__PURE__ */ jsx31(Box21, { as: "main", flex: "1", p: mainPadding, minW: 0, children: /* @__PURE__ */ jsx31(Box21, { maxW: portal ? "1180px" : "1680px", mx: "auto", children: /* @__PURE__ */ jsx31(Outlet, {}) }) }),
5235
+ /* @__PURE__ */ jsx31(
5147
5236
  Slot,
5148
5237
  {
5149
5238
  name: "footer",
@@ -5157,24 +5246,24 @@ function DefaultShell({
5157
5246
  ] });
5158
5247
  }
5159
5248
  function PortalShell(props) {
5160
- return /* @__PURE__ */ jsx30(DefaultShell, { ...props, layout: { ...props.layout, shell: "portal" } });
5249
+ return /* @__PURE__ */ jsx31(DefaultShell, { ...props, layout: { ...props.layout, shell: "portal" } });
5161
5250
  }
5162
5251
 
5163
5252
  // src/shell/AuthenticatedLayout.tsx
5164
- import { jsx as jsx31 } from "react/jsx-runtime";
5253
+ import { jsx as jsx32 } from "react/jsx-runtime";
5165
5254
  function AuthenticatedLayout({ app, menu, layout, registry }) {
5166
5255
  if (layout?.shell?.startsWith("custom:")) {
5167
5256
  const CustomShell = resolveComponent(registry, layout.shell, "layoutSlots");
5168
- return CustomShell ? /* @__PURE__ */ jsx31(CustomShell, { app, menu, layout }) : /* @__PURE__ */ jsx31(MissingRenderer, { renderer: layout.shell });
5257
+ return CustomShell ? /* @__PURE__ */ jsx32(CustomShell, { app, menu, layout }) : /* @__PURE__ */ jsx32(MissingRenderer, { renderer: layout.shell });
5169
5258
  }
5170
- if (layout?.shell === "portal") return /* @__PURE__ */ jsx31(PortalShell, { app, menu, layout, registry });
5171
- return /* @__PURE__ */ jsx31(DefaultShell, { app, menu, layout, registry });
5259
+ if (layout?.shell === "portal") return /* @__PURE__ */ jsx32(PortalShell, { app, menu, layout, registry });
5260
+ return /* @__PURE__ */ jsx32(DefaultShell, { app, menu, layout, registry });
5172
5261
  }
5173
5262
 
5174
5263
  // src/security/AccessDeniedPage.tsx
5175
5264
  import { Box as Box22, Button as Button15, Flex as Flex15, Heading as Heading11, Text as Text23, VStack as VStack3 } from "@chakra-ui/react";
5176
5265
  import { useNavigate as useNavigate3 } from "react-router-dom";
5177
- import { jsx as jsx32, jsxs as jsxs23 } from "react/jsx-runtime";
5266
+ import { jsx as jsx33, jsxs as jsxs23 } from "react/jsx-runtime";
5178
5267
  function AccessDeniedPage({ app }) {
5179
5268
  const { logout } = useOonAuth();
5180
5269
  const navigate = useNavigate3();
@@ -5182,7 +5271,7 @@ function AccessDeniedPage({ app }) {
5182
5271
  logout();
5183
5272
  navigate("/login", { replace: true });
5184
5273
  }
5185
- return /* @__PURE__ */ jsx32(Flex15, { minH: "100vh", align: "center", justify: "center", bg: "#F5F8FA", px: 4, children: /* @__PURE__ */ jsx32(
5274
+ return /* @__PURE__ */ jsx33(Flex15, { minH: "100vh", align: "center", justify: "center", bg: "#F5F8FA", px: 4, children: /* @__PURE__ */ jsx33(
5186
5275
  Box22,
5187
5276
  {
5188
5277
  width: "100%",
@@ -5194,7 +5283,7 @@ function AccessDeniedPage({ app }) {
5194
5283
  boxShadow: "0 24px 70px rgba(7, 38, 46, 0.10)",
5195
5284
  p: { base: 6, md: 10 },
5196
5285
  children: /* @__PURE__ */ jsxs23(VStack3, { align: "stretch", gap: 6, children: [
5197
- /* @__PURE__ */ jsx32(
5286
+ /* @__PURE__ */ jsx33(
5198
5287
  Box22,
5199
5288
  {
5200
5289
  width: "56px",
@@ -5212,7 +5301,7 @@ function AccessDeniedPage({ app }) {
5212
5301
  }
5213
5302
  ),
5214
5303
  /* @__PURE__ */ jsxs23(Box22, { children: [
5215
- /* @__PURE__ */ jsx32(
5304
+ /* @__PURE__ */ jsx33(
5216
5305
  Text23,
5217
5306
  {
5218
5307
  color: "#39BFED",
@@ -5223,14 +5312,14 @@ function AccessDeniedPage({ app }) {
5223
5312
  children: "Acesso negado"
5224
5313
  }
5225
5314
  ),
5226
- /* @__PURE__ */ jsx32(Heading11, { mt: 2, size: "lg", color: "#07262E", children: "Voc\xEA n\xE3o possui permiss\xE3o para este aplicativo" }),
5315
+ /* @__PURE__ */ jsx33(Heading11, { mt: 2, size: "lg", color: "#07262E", children: "Voc\xEA n\xE3o possui permiss\xE3o para este aplicativo" }),
5227
5316
  /* @__PURE__ */ jsxs23(Text23, { mt: 3, color: "gray.600", children: [
5228
5317
  "Seu usu\xE1rio foi autenticado, mas n\xE3o existe uma permiss\xE3o ativa para acessar ",
5229
5318
  app.title ?? app.name,
5230
5319
  ". Solicite o acesso ao administrador da sua organiza\xE7\xE3o."
5231
5320
  ] })
5232
5321
  ] }),
5233
- /* @__PURE__ */ jsx32(
5322
+ /* @__PURE__ */ jsx33(
5234
5323
  Button15,
5235
5324
  {
5236
5325
  alignSelf: "flex-start",
@@ -5248,7 +5337,7 @@ function AccessDeniedPage({ app }) {
5248
5337
 
5249
5338
  // src/security/AppAccessGuard.tsx
5250
5339
  import { Navigate, useLocation as useLocation2 } from "react-router-dom";
5251
- import { Fragment as Fragment5, jsx as jsx33 } from "react/jsx-runtime";
5340
+ import { Fragment as Fragment5, jsx as jsx34 } from "react/jsx-runtime";
5252
5341
  function loginRedirect(pathname, search) {
5253
5342
  const destination = `${pathname}${search}`;
5254
5343
  return `/login?redirect=${encodeURIComponent(destination)}`;
@@ -5256,14 +5345,14 @@ function loginRedirect(pathname, search) {
5256
5345
  function AppAccessGuard({ children }) {
5257
5346
  const { status, retry } = useOonAuth();
5258
5347
  const location = useLocation2();
5259
- if (status === "loading") return /* @__PURE__ */ jsx33(LoadingScreen, {});
5348
+ if (status === "loading") return /* @__PURE__ */ jsx34(LoadingScreen, {});
5260
5349
  if (status === "unauthenticated") {
5261
- return /* @__PURE__ */ jsx33(Navigate, { to: loginRedirect(location.pathname, location.search), replace: true });
5350
+ return /* @__PURE__ */ jsx34(Navigate, { to: loginRedirect(location.pathname, location.search), replace: true });
5262
5351
  }
5263
- if (status === "first-access") return /* @__PURE__ */ jsx33(Navigate, { to: "/first-access", replace: true });
5264
- if (status === "forbidden") return /* @__PURE__ */ jsx33(Navigate, { to: "/acesso-negado", replace: true });
5352
+ if (status === "first-access") return /* @__PURE__ */ jsx34(Navigate, { to: "/first-access", replace: true });
5353
+ if (status === "forbidden") return /* @__PURE__ */ jsx34(Navigate, { to: "/acesso-negado", replace: true });
5265
5354
  if (status === "error") {
5266
- return /* @__PURE__ */ jsx33(
5355
+ return /* @__PURE__ */ jsx34(
5267
5356
  LoadingScreen,
5268
5357
  {
5269
5358
  message: "N\xE3o foi poss\xEDvel validar seu acesso. Tente novamente.",
@@ -5274,11 +5363,11 @@ function AppAccessGuard({ children }) {
5274
5363
  }
5275
5364
  );
5276
5365
  }
5277
- return /* @__PURE__ */ jsx33(Fragment5, { children });
5366
+ return /* @__PURE__ */ jsx34(Fragment5, { children });
5278
5367
  }
5279
5368
 
5280
5369
  // src/security/LoginPage.tsx
5281
- import { useState as useState15 } from "react";
5370
+ import { useState as useState16 } from "react";
5282
5371
  import {
5283
5372
  Box as Box23,
5284
5373
  Button as Button16,
@@ -5289,7 +5378,7 @@ import {
5289
5378
  VStack as VStack4
5290
5379
  } from "@chakra-ui/react";
5291
5380
  import { Navigate as Navigate2, useLocation as useLocation3 } from "react-router-dom";
5292
- import { jsx as jsx34, jsxs as jsxs24 } from "react/jsx-runtime";
5381
+ import { jsx as jsx35, jsxs as jsxs24 } from "react/jsx-runtime";
5293
5382
  function safeRedirect(search) {
5294
5383
  const value2 = new URLSearchParams(search).get("redirect") || "/";
5295
5384
  if (!value2.startsWith("/") || value2.startsWith("//")) return "/";
@@ -5301,16 +5390,16 @@ function safeRedirect(search) {
5301
5390
  function LoginPage({ app }) {
5302
5391
  const { status, login } = useOonAuth();
5303
5392
  const location = useLocation3();
5304
- const [email, setEmail] = useState15("");
5305
- const [password, setPassword] = useState15("");
5306
- const [submitting, setSubmitting] = useState15(false);
5307
- const [message, setMessage] = useState15(null);
5393
+ const [email, setEmail] = useState16("");
5394
+ const [password, setPassword] = useState16("");
5395
+ const [submitting, setSubmitting] = useState16(false);
5396
+ const [message, setMessage] = useState16(null);
5308
5397
  const redirect = safeRedirect(location.search);
5309
5398
  if (status === "authenticated") {
5310
- return /* @__PURE__ */ jsx34(Navigate2, { to: redirect, replace: true });
5399
+ return /* @__PURE__ */ jsx35(Navigate2, { to: redirect, replace: true });
5311
5400
  }
5312
5401
  if (status === "forbidden") {
5313
- return /* @__PURE__ */ jsx34(Navigate2, { to: "/acesso-negado", replace: true });
5402
+ return /* @__PURE__ */ jsx35(Navigate2, { to: "/acesso-negado", replace: true });
5314
5403
  }
5315
5404
  async function handleSubmit(event) {
5316
5405
  event.preventDefault();
@@ -5328,7 +5417,7 @@ function LoginPage({ app }) {
5328
5417
  setSubmitting(false);
5329
5418
  }
5330
5419
  }
5331
- return /* @__PURE__ */ jsx34(Flex16, { minH: "100vh", align: "center", justify: "center", bg: "#F5F8FA", px: 4, children: /* @__PURE__ */ jsx34(
5420
+ return /* @__PURE__ */ jsx35(Flex16, { minH: "100vh", align: "center", justify: "center", bg: "#F5F8FA", px: 4, children: /* @__PURE__ */ jsx35(
5332
5421
  Box23,
5333
5422
  {
5334
5423
  width: "100%",
@@ -5339,9 +5428,9 @@ function LoginPage({ app }) {
5339
5428
  borderRadius: "18px",
5340
5429
  boxShadow: "0 24px 70px rgba(7, 38, 46, 0.10)",
5341
5430
  p: { base: 6, md: 9 },
5342
- children: /* @__PURE__ */ jsx34("form", { onSubmit: handleSubmit, children: /* @__PURE__ */ jsxs24(VStack4, { align: "stretch", gap: 6, children: [
5431
+ children: /* @__PURE__ */ jsx35("form", { onSubmit: handleSubmit, children: /* @__PURE__ */ jsxs24(VStack4, { align: "stretch", gap: 6, children: [
5343
5432
  /* @__PURE__ */ jsxs24(Box23, { children: [
5344
- /* @__PURE__ */ jsx34(
5433
+ /* @__PURE__ */ jsx35(
5345
5434
  Text24,
5346
5435
  {
5347
5436
  color: "#39BFED",
@@ -5352,13 +5441,13 @@ function LoginPage({ app }) {
5352
5441
  children: "Central Oon"
5353
5442
  }
5354
5443
  ),
5355
- /* @__PURE__ */ jsx34(Heading12, { mt: 2, size: "lg", color: "#07262E", children: app.title ?? app.name }),
5356
- /* @__PURE__ */ jsx34(Text24, { mt: 2, color: "gray.600", fontSize: "sm", children: "Entre com seu usu\xE1rio autorizado para acessar este aplicativo." })
5444
+ /* @__PURE__ */ jsx35(Heading12, { mt: 2, size: "lg", color: "#07262E", children: app.title ?? app.name }),
5445
+ /* @__PURE__ */ jsx35(Text24, { mt: 2, color: "gray.600", fontSize: "sm", children: "Entre com seu usu\xE1rio autorizado para acessar este aplicativo." })
5357
5446
  ] }),
5358
5447
  /* @__PURE__ */ jsxs24(VStack4, { align: "stretch", gap: 4, children: [
5359
5448
  /* @__PURE__ */ jsxs24(Box23, { children: [
5360
- /* @__PURE__ */ jsx34(Text24, { mb: 2, fontSize: "sm", fontWeight: "600", color: "#24323A", children: "E-mail" }),
5361
- /* @__PURE__ */ jsx34(
5449
+ /* @__PURE__ */ jsx35(Text24, { mb: 2, fontSize: "sm", fontWeight: "600", color: "#24323A", children: "E-mail" }),
5450
+ /* @__PURE__ */ jsx35(
5362
5451
  Input8,
5363
5452
  {
5364
5453
  type: "email",
@@ -5371,8 +5460,8 @@ function LoginPage({ app }) {
5371
5460
  )
5372
5461
  ] }),
5373
5462
  /* @__PURE__ */ jsxs24(Box23, { children: [
5374
- /* @__PURE__ */ jsx34(Text24, { mb: 2, fontSize: "sm", fontWeight: "600", color: "#24323A", children: "Senha" }),
5375
- /* @__PURE__ */ jsx34(
5463
+ /* @__PURE__ */ jsx35(Text24, { mb: 2, fontSize: "sm", fontWeight: "600", color: "#24323A", children: "Senha" }),
5464
+ /* @__PURE__ */ jsx35(
5376
5465
  Input8,
5377
5466
  {
5378
5467
  type: "password",
@@ -5385,7 +5474,7 @@ function LoginPage({ app }) {
5385
5474
  )
5386
5475
  ] })
5387
5476
  ] }),
5388
- message ? /* @__PURE__ */ jsx34(
5477
+ message ? /* @__PURE__ */ jsx35(
5389
5478
  Box23,
5390
5479
  {
5391
5480
  role: "alert",
@@ -5398,7 +5487,7 @@ function LoginPage({ app }) {
5398
5487
  children: message
5399
5488
  }
5400
5489
  ) : null,
5401
- /* @__PURE__ */ jsx34(
5490
+ /* @__PURE__ */ jsx35(
5402
5491
  Button16,
5403
5492
  {
5404
5493
  type: "submit",
@@ -5415,19 +5504,19 @@ function LoginPage({ app }) {
5415
5504
  }
5416
5505
 
5417
5506
  // src/security/FirstAccessPage.tsx
5418
- import { useState as useState16 } from "react";
5507
+ import { useState as useState17 } from "react";
5419
5508
  import { Box as Box24, Button as Button17, Flex as Flex17, Heading as Heading13, Input as Input9, Text as Text25, VStack as VStack5 } from "@chakra-ui/react";
5420
5509
  import { Navigate as Navigate3 } from "react-router-dom";
5421
- import { jsx as jsx35, jsxs as jsxs25 } from "react/jsx-runtime";
5510
+ import { jsx as jsx36, jsxs as jsxs25 } from "react/jsx-runtime";
5422
5511
  function FirstAccessPage() {
5423
5512
  const { status, completeFirstAccess } = useOonAuth();
5424
- const [password, setPassword] = useState16("");
5425
- const [confirm, setConfirm] = useState16("");
5426
- const [submitting, setSubmitting] = useState16(false);
5427
- const [message, setMessage] = useState16(null);
5428
- if (status === "authenticated") return /* @__PURE__ */ jsx35(Navigate3, { to: "/", replace: true });
5429
- if (status === "unauthenticated") return /* @__PURE__ */ jsx35(Navigate3, { to: "/login", replace: true });
5430
- if (status === "forbidden") return /* @__PURE__ */ jsx35(Navigate3, { to: "/acesso-negado", replace: true });
5513
+ const [password, setPassword] = useState17("");
5514
+ const [confirm, setConfirm] = useState17("");
5515
+ const [submitting, setSubmitting] = useState17(false);
5516
+ const [message, setMessage] = useState17(null);
5517
+ if (status === "authenticated") return /* @__PURE__ */ jsx36(Navigate3, { to: "/", replace: true });
5518
+ if (status === "unauthenticated") return /* @__PURE__ */ jsx36(Navigate3, { to: "/login", replace: true });
5519
+ if (status === "forbidden") return /* @__PURE__ */ jsx36(Navigate3, { to: "/acesso-negado", replace: true });
5431
5520
  async function submit(event) {
5432
5521
  event.preventDefault();
5433
5522
  setMessage(null);
@@ -5448,29 +5537,29 @@ function FirstAccessPage() {
5448
5537
  setSubmitting(false);
5449
5538
  }
5450
5539
  }
5451
- return /* @__PURE__ */ jsx35(Flex17, { minH: "100vh", align: "center", justify: "center", bg: "#F5F8FA", px: 4, children: /* @__PURE__ */ jsx35(Box24, { width: "100%", maxW: "460px", bg: "white", borderWidth: "1px", borderRadius: "18px", p: { base: 6, md: 9 }, children: /* @__PURE__ */ jsx35("form", { onSubmit: (event) => void submit(event), children: /* @__PURE__ */ jsxs25(VStack5, { align: "stretch", gap: 5, children: [
5540
+ return /* @__PURE__ */ jsx36(Flex17, { minH: "100vh", align: "center", justify: "center", bg: "#F5F8FA", px: 4, children: /* @__PURE__ */ jsx36(Box24, { width: "100%", maxW: "460px", bg: "white", borderWidth: "1px", borderRadius: "18px", p: { base: 6, md: 9 }, children: /* @__PURE__ */ jsx36("form", { onSubmit: (event) => void submit(event), children: /* @__PURE__ */ jsxs25(VStack5, { align: "stretch", gap: 5, children: [
5452
5541
  /* @__PURE__ */ jsxs25(Box24, { children: [
5453
- /* @__PURE__ */ jsx35(Text25, { color: "#39BFED", fontSize: "xs", fontWeight: "700", textTransform: "uppercase", children: "Primeiro acesso" }),
5454
- /* @__PURE__ */ jsx35(Heading13, { mt: 2, size: "lg", children: "Defina sua nova senha" }),
5455
- /* @__PURE__ */ jsx35(Text25, { mt: 2, fontSize: "sm", color: "gray.600", children: "O acesso \xE0 Central s\xF3 ser\xE1 liberado depois desta etapa." })
5542
+ /* @__PURE__ */ jsx36(Text25, { color: "#39BFED", fontSize: "xs", fontWeight: "700", textTransform: "uppercase", children: "Primeiro acesso" }),
5543
+ /* @__PURE__ */ jsx36(Heading13, { mt: 2, size: "lg", children: "Defina sua nova senha" }),
5544
+ /* @__PURE__ */ jsx36(Text25, { mt: 2, fontSize: "sm", color: "gray.600", children: "O acesso \xE0 Central s\xF3 ser\xE1 liberado depois desta etapa." })
5456
5545
  ] }),
5457
5546
  /* @__PURE__ */ jsxs25(Box24, { children: [
5458
- /* @__PURE__ */ jsx35(Text25, { mb: 1, fontSize: "sm", fontWeight: "600", children: "Nova senha" }),
5459
- /* @__PURE__ */ jsx35(Input9, { type: "password", autoComplete: "new-password", value: password, onChange: (event) => setPassword(event.target.value), required: true })
5547
+ /* @__PURE__ */ jsx36(Text25, { mb: 1, fontSize: "sm", fontWeight: "600", children: "Nova senha" }),
5548
+ /* @__PURE__ */ jsx36(Input9, { type: "password", autoComplete: "new-password", value: password, onChange: (event) => setPassword(event.target.value), required: true })
5460
5549
  ] }),
5461
5550
  /* @__PURE__ */ jsxs25(Box24, { children: [
5462
- /* @__PURE__ */ jsx35(Text25, { mb: 1, fontSize: "sm", fontWeight: "600", children: "Confirmar senha" }),
5463
- /* @__PURE__ */ jsx35(Input9, { type: "password", autoComplete: "new-password", value: confirm, onChange: (event) => setConfirm(event.target.value), required: true })
5551
+ /* @__PURE__ */ jsx36(Text25, { mb: 1, fontSize: "sm", fontWeight: "600", children: "Confirmar senha" }),
5552
+ /* @__PURE__ */ jsx36(Input9, { type: "password", autoComplete: "new-password", value: confirm, onChange: (event) => setConfirm(event.target.value), required: true })
5464
5553
  ] }),
5465
- message ? /* @__PURE__ */ jsx35(Box24, { role: "alert", bg: "red.50", borderRadius: "md", p: 3, children: /* @__PURE__ */ jsx35(Text25, { fontSize: "sm", children: message }) }) : null,
5466
- /* @__PURE__ */ jsx35(Button17, { type: "submit", disabled: submitting, children: submitting ? "Salvando\u2026" : "Definir nova senha" })
5554
+ message ? /* @__PURE__ */ jsx36(Box24, { role: "alert", bg: "red.50", borderRadius: "md", p: 3, children: /* @__PURE__ */ jsx36(Text25, { fontSize: "sm", children: message }) }) : null,
5555
+ /* @__PURE__ */ jsx36(Button17, { type: "submit", disabled: submitting, children: submitting ? "Salvando\u2026" : "Definir nova senha" })
5467
5556
  ] }) }) }) });
5468
5557
  }
5469
5558
 
5470
5559
  // src/security/ActivationPage.tsx
5471
- import { useEffect as useEffect10, useState as useState17 } from "react";
5560
+ import { useEffect as useEffect10, useState as useState18 } from "react";
5472
5561
  import { Box as Box25, Button as Button18, Heading as Heading14, Input as Input10, Text as Text26, VStack as VStack6 } from "@chakra-ui/react";
5473
- import { Fragment as Fragment6, jsx as jsx36, jsxs as jsxs26 } from "react/jsx-runtime";
5562
+ import { Fragment as Fragment6, jsx as jsx37, jsxs as jsxs26 } from "react/jsx-runtime";
5474
5563
  function encodeBasicCredentials2(email, password) {
5475
5564
  const bytes = new TextEncoder().encode(`${email}:${password}`);
5476
5565
  let binary = "";
@@ -5480,21 +5569,21 @@ function encodeBasicCredentials2(email, password) {
5480
5569
  function ActivationPage() {
5481
5570
  const { http } = useOonApi();
5482
5571
  const activation = useActivation();
5483
- const [step, setStep] = useState17(1);
5484
- const [config, setConfig] = useState17(null);
5485
- const [code, setCode] = useState17("");
5486
- const [preview, setPreview] = useState17(null);
5487
- const [global, setGlobal] = useState17({});
5488
- const [app, setApp] = useState17({});
5489
- const [rootEmail, setRootEmail] = useState17("");
5490
- const [rootPassword, setRootPassword] = useState17("");
5491
- const [devName, setDevName] = useState17("");
5492
- const [devEmail, setDevEmail] = useState17("");
5493
- const [devPassword, setDevPassword] = useState17("");
5494
- const [showCodeFlow, setShowCodeFlow] = useState17(false);
5495
- const [devResult, setDevResult] = useState17(null);
5496
- const [error, setError] = useState17(null);
5497
- const [submitting, setSubmitting] = useState17(false);
5572
+ const [step, setStep] = useState18(1);
5573
+ const [config, setConfig] = useState18(null);
5574
+ const [code, setCode] = useState18("");
5575
+ const [preview, setPreview] = useState18(null);
5576
+ const [global, setGlobal] = useState18({});
5577
+ const [app, setApp] = useState18({});
5578
+ const [rootEmail, setRootEmail] = useState18("");
5579
+ const [rootPassword, setRootPassword] = useState18("");
5580
+ const [devName, setDevName] = useState18("");
5581
+ const [devEmail, setDevEmail] = useState18("");
5582
+ const [devPassword, setDevPassword] = useState18("");
5583
+ const [showCodeFlow, setShowCodeFlow] = useState18(false);
5584
+ const [devResult, setDevResult] = useState18(null);
5585
+ const [error, setError] = useState18(null);
5586
+ const [submitting, setSubmitting] = useState18(false);
5498
5587
  useEffect10(() => {
5499
5588
  http.get("/ativacao/configuracao").then((response) => {
5500
5589
  setConfig(response.data);
@@ -5609,7 +5698,7 @@ function ActivationPage() {
5609
5698
  field.label,
5610
5699
  field.required ? " *" : ""
5611
5700
  ] }),
5612
- /* @__PURE__ */ jsx36(
5701
+ /* @__PURE__ */ jsx37(
5613
5702
  Input10,
5614
5703
  {
5615
5704
  type: field.type === "password" || field.type === "secret" ? "password" : field.type === "email" ? "email" : field.type === "url" ? "url" : field.type === "number" || field.type === "integer" ? "number" : "text",
@@ -5621,15 +5710,15 @@ function ActivationPage() {
5621
5710
  onChange: (event) => setValues({ ...values, [field.name]: event.target.value })
5622
5711
  }
5623
5712
  ),
5624
- field.helpText ? /* @__PURE__ */ jsx36(Text26, { fontSize: "sm", color: "gray.500", children: field.helpText }) : null
5713
+ field.helpText ? /* @__PURE__ */ jsx37(Text26, { fontSize: "sm", color: "gray.500", children: field.helpText }) : null
5625
5714
  ] }, field.name);
5626
5715
  }
5627
5716
  function renderDevLocalActivation() {
5628
5717
  return /* @__PURE__ */ jsxs26(Fragment6, { children: [
5629
- /* @__PURE__ */ jsx36(Text26, { color: "gray.700", children: "Entre com seu e-mail e senha para ativar esta Central em ambiente de desenvolvimento. Se o e-mail ainda n\xE3o existir na Central de Ativa\xE7\xF5es, o usu\xE1rio ser\xE1 criado automaticamente com perfil de desenvolvedor." }),
5718
+ /* @__PURE__ */ jsx37(Text26, { color: "gray.700", children: "Entre com seu e-mail e senha para ativar esta Central em ambiente de desenvolvimento. Se o e-mail ainda n\xE3o existir na Central de Ativa\xE7\xF5es, o usu\xE1rio ser\xE1 criado automaticamente com perfil de desenvolvedor." }),
5630
5719
  /* @__PURE__ */ jsxs26(Box25, { w: "100%", children: [
5631
- /* @__PURE__ */ jsx36(Text26, { fontWeight: "medium", children: "Nome do usu\xE1rio" }),
5632
- /* @__PURE__ */ jsx36(
5720
+ /* @__PURE__ */ jsx37(Text26, { fontWeight: "medium", children: "Nome do usu\xE1rio" }),
5721
+ /* @__PURE__ */ jsx37(
5633
5722
  Input10,
5634
5723
  {
5635
5724
  value: devName,
@@ -5640,8 +5729,8 @@ function ActivationPage() {
5640
5729
  )
5641
5730
  ] }),
5642
5731
  /* @__PURE__ */ jsxs26(Box25, { w: "100%", children: [
5643
- /* @__PURE__ */ jsx36(Text26, { fontWeight: "medium", children: "E-mail *" }),
5644
- /* @__PURE__ */ jsx36(
5732
+ /* @__PURE__ */ jsx37(Text26, { fontWeight: "medium", children: "E-mail *" }),
5733
+ /* @__PURE__ */ jsx37(
5645
5734
  Input10,
5646
5735
  {
5647
5736
  type: "email",
@@ -5653,8 +5742,8 @@ function ActivationPage() {
5653
5742
  )
5654
5743
  ] }),
5655
5744
  /* @__PURE__ */ jsxs26(Box25, { w: "100%", children: [
5656
- /* @__PURE__ */ jsx36(Text26, { fontWeight: "medium", children: "Senha *" }),
5657
- /* @__PURE__ */ jsx36(
5745
+ /* @__PURE__ */ jsx37(Text26, { fontWeight: "medium", children: "Senha *" }),
5746
+ /* @__PURE__ */ jsx37(
5658
5747
  Input10,
5659
5748
  {
5660
5749
  type: "password",
@@ -5666,7 +5755,7 @@ function ActivationPage() {
5666
5755
  }
5667
5756
  )
5668
5757
  ] }),
5669
- /* @__PURE__ */ jsx36(
5758
+ /* @__PURE__ */ jsx37(
5670
5759
  Button18,
5671
5760
  {
5672
5761
  colorPalette: "blue",
@@ -5676,7 +5765,7 @@ function ActivationPage() {
5676
5765
  children: "Ativar ambiente de desenvolvimento"
5677
5766
  }
5678
5767
  ),
5679
- /* @__PURE__ */ jsx36(
5768
+ /* @__PURE__ */ jsx37(
5680
5769
  Button18,
5681
5770
  {
5682
5771
  variant: "outline",
@@ -5690,7 +5779,7 @@ function ActivationPage() {
5690
5779
  const rootMode = config?.mode === "root-bootstrap" || activation.details?.role === "root";
5691
5780
  const isDevelopmentMember = !rootMode && config?.technical?.ambiente === "desenvolvimento";
5692
5781
  if (activation.status === "loading" || !config) {
5693
- return /* @__PURE__ */ jsx36(Box25, { minH: "100vh", bg: "gray.50", p: 8, children: /* @__PURE__ */ jsxs26(
5782
+ return /* @__PURE__ */ jsx37(Box25, { minH: "100vh", bg: "gray.50", p: 8, children: /* @__PURE__ */ jsxs26(
5694
5783
  VStack6,
5695
5784
  {
5696
5785
  maxW: "760px",
@@ -5701,14 +5790,14 @@ function ActivationPage() {
5701
5790
  align: "stretch",
5702
5791
  gap: 5,
5703
5792
  children: [
5704
- /* @__PURE__ */ jsx36(Heading14, { children: "Preparando ativa\xE7\xE3o..." }),
5705
- error ? /* @__PURE__ */ jsx36(Text26, { color: "red.600", children: error }) : null
5793
+ /* @__PURE__ */ jsx37(Heading14, { children: "Preparando ativa\xE7\xE3o..." }),
5794
+ error ? /* @__PURE__ */ jsx37(Text26, { color: "red.600", children: error }) : null
5706
5795
  ]
5707
5796
  }
5708
5797
  ) });
5709
5798
  }
5710
5799
  if (rootMode) {
5711
- return /* @__PURE__ */ jsx36(Box25, { minH: "100vh", bg: "gray.50", p: 8, children: /* @__PURE__ */ jsxs26(
5800
+ return /* @__PURE__ */ jsx37(Box25, { minH: "100vh", bg: "gray.50", p: 8, children: /* @__PURE__ */ jsxs26(
5712
5801
  VStack6,
5713
5802
  {
5714
5803
  maxW: "560px",
@@ -5719,8 +5808,8 @@ function ActivationPage() {
5719
5808
  align: "stretch",
5720
5809
  gap: 5,
5721
5810
  children: [
5722
- /* @__PURE__ */ jsx36(Heading14, { children: "Ativa\xE7\xE3o inicial do Ecossistema Oon" }),
5723
- /* @__PURE__ */ jsx36(Text26, { color: "gray.600", children: "Esta \xE9 a aplica\xE7\xE3o root do ecossistema. Informe somente o e-mail e a senha do primeiro administrador. O Core criar\xE1 a estrutura m\xEDnima necess\xE1ria para liberar o primeiro login." }),
5811
+ /* @__PURE__ */ jsx37(Heading14, { children: "Ativa\xE7\xE3o inicial do Ecossistema Oon" }),
5812
+ /* @__PURE__ */ jsx37(Text26, { color: "gray.600", children: "Esta \xE9 a aplica\xE7\xE3o root do ecossistema. Informe somente o e-mail e a senha do primeiro administrador. O Core criar\xE1 a estrutura m\xEDnima necess\xE1ria para liberar o primeiro login." }),
5724
5813
  /* @__PURE__ */ jsxs26(Text26, { fontSize: "sm", color: "gray.500", children: [
5725
5814
  "App: ",
5726
5815
  config.technical.appCode,
@@ -5728,11 +5817,11 @@ function ActivationPage() {
5728
5817
  " ",
5729
5818
  config.technical.ambiente
5730
5819
  ] }),
5731
- error ? /* @__PURE__ */ jsx36(Text26, { color: "red.600", children: error }) : null,
5820
+ error ? /* @__PURE__ */ jsx37(Text26, { color: "red.600", children: error }) : null,
5732
5821
  step !== 6 ? /* @__PURE__ */ jsxs26(Fragment6, { children: [
5733
5822
  /* @__PURE__ */ jsxs26(Box25, { w: "100%", children: [
5734
- /* @__PURE__ */ jsx36(Text26, { fontWeight: "medium", children: "E-mail do administrador *" }),
5735
- /* @__PURE__ */ jsx36(
5823
+ /* @__PURE__ */ jsx37(Text26, { fontWeight: "medium", children: "E-mail do administrador *" }),
5824
+ /* @__PURE__ */ jsx37(
5736
5825
  Input10,
5737
5826
  {
5738
5827
  type: "email",
@@ -5744,8 +5833,8 @@ function ActivationPage() {
5744
5833
  )
5745
5834
  ] }),
5746
5835
  /* @__PURE__ */ jsxs26(Box25, { w: "100%", children: [
5747
- /* @__PURE__ */ jsx36(Text26, { fontWeight: "medium", children: "Senha *" }),
5748
- /* @__PURE__ */ jsx36(
5836
+ /* @__PURE__ */ jsx37(Text26, { fontWeight: "medium", children: "Senha *" }),
5837
+ /* @__PURE__ */ jsx37(
5749
5838
  Input10,
5750
5839
  {
5751
5840
  type: "password",
@@ -5757,7 +5846,7 @@ function ActivationPage() {
5757
5846
  }
5758
5847
  )
5759
5848
  ] }),
5760
- /* @__PURE__ */ jsx36(
5849
+ /* @__PURE__ */ jsx37(
5761
5850
  Button18,
5762
5851
  {
5763
5852
  colorPalette: "blue",
@@ -5768,14 +5857,14 @@ function ActivationPage() {
5768
5857
  }
5769
5858
  )
5770
5859
  ] }) : /* @__PURE__ */ jsxs26(Fragment6, { children: [
5771
- /* @__PURE__ */ jsx36(Heading14, { size: "md", children: "Ativa\xE7\xE3o conclu\xEDda" }),
5772
- /* @__PURE__ */ jsx36(Text26, { children: "Usu\xE1rio, tenant, aplicativo, licen\xE7a e permiss\xF5es foram preparados. Redirecionando para o primeiro login..." })
5860
+ /* @__PURE__ */ jsx37(Heading14, { size: "md", children: "Ativa\xE7\xE3o conclu\xEDda" }),
5861
+ /* @__PURE__ */ jsx37(Text26, { children: "Usu\xE1rio, tenant, aplicativo, licen\xE7a e permiss\xF5es foram preparados. Redirecionando para o primeiro login..." })
5773
5862
  ] })
5774
5863
  ]
5775
5864
  }
5776
5865
  ) });
5777
5866
  }
5778
- return /* @__PURE__ */ jsx36(Box25, { minH: "100vh", bg: "gray.50", p: 8, children: /* @__PURE__ */ jsxs26(
5867
+ return /* @__PURE__ */ jsx37(Box25, { minH: "100vh", bg: "gray.50", p: 8, children: /* @__PURE__ */ jsxs26(
5779
5868
  VStack6,
5780
5869
  {
5781
5870
  maxW: "760px",
@@ -5786,7 +5875,7 @@ function ActivationPage() {
5786
5875
  align: "stretch",
5787
5876
  gap: 5,
5788
5877
  children: [
5789
- /* @__PURE__ */ jsx36(Heading14, { children: "Ativa\xE7\xE3o da Central Oon" }),
5878
+ /* @__PURE__ */ jsx37(Heading14, { children: "Ativa\xE7\xE3o da Central Oon" }),
5790
5879
  /* @__PURE__ */ jsxs26(Text26, { children: [
5791
5880
  "App: ",
5792
5881
  config.technical.appCode,
@@ -5797,11 +5886,11 @@ function ActivationPage() {
5797
5886
  " ",
5798
5887
  config.technical.centralAtivacaoUrl || config.technical.centralAtivacaoHost
5799
5888
  ] }),
5800
- error ? /* @__PURE__ */ jsx36(Text26, { color: "red.600", children: error }) : null,
5889
+ error ? /* @__PURE__ */ jsx37(Text26, { color: "red.600", children: error }) : null,
5801
5890
  step === 1 && isDevelopmentMember && !showCodeFlow ? renderDevLocalActivation() : null,
5802
5891
  step === 1 && (!isDevelopmentMember || showCodeFlow) && /* @__PURE__ */ jsxs26(Fragment6, { children: [
5803
- /* @__PURE__ */ jsx36(Text26, { children: "Informe o c\xF3digo de ativa\xE7\xE3o para validar tenant, aplicativo e licen\xE7a antes de consumir o c\xF3digo." }),
5804
- /* @__PURE__ */ jsx36(
5892
+ /* @__PURE__ */ jsx37(Text26, { children: "Informe o c\xF3digo de ativa\xE7\xE3o para validar tenant, aplicativo e licen\xE7a antes de consumir o c\xF3digo." }),
5893
+ /* @__PURE__ */ jsx37(
5805
5894
  Input10,
5806
5895
  {
5807
5896
  "aria-label": "C\xF3digo de ativa\xE7\xE3o",
@@ -5810,7 +5899,7 @@ function ActivationPage() {
5810
5899
  placeholder: "OON-XXXX"
5811
5900
  }
5812
5901
  ),
5813
- /* @__PURE__ */ jsx36(
5902
+ /* @__PURE__ */ jsx37(
5814
5903
  Button18,
5815
5904
  {
5816
5905
  onClick: validateCode,
@@ -5819,7 +5908,7 @@ function ActivationPage() {
5819
5908
  children: "Validar c\xF3digo"
5820
5909
  }
5821
5910
  ),
5822
- isDevelopmentMember ? /* @__PURE__ */ jsx36(
5911
+ isDevelopmentMember ? /* @__PURE__ */ jsx37(
5823
5912
  Button18,
5824
5913
  {
5825
5914
  variant: "outline",
@@ -5830,23 +5919,23 @@ function ActivationPage() {
5830
5919
  ) : null
5831
5920
  ] }),
5832
5921
  step === 2 && /* @__PURE__ */ jsxs26(Fragment6, { children: [
5833
- /* @__PURE__ */ jsx36(Heading14, { size: "md", children: "Confirma\xE7\xE3o" }),
5834
- /* @__PURE__ */ jsx36("pre", { children: JSON.stringify(preview, null, 2) }),
5835
- /* @__PURE__ */ jsx36(Button18, { onClick: () => setStep(3), children: "Continuar" })
5922
+ /* @__PURE__ */ jsx37(Heading14, { size: "md", children: "Confirma\xE7\xE3o" }),
5923
+ /* @__PURE__ */ jsx37("pre", { children: JSON.stringify(preview, null, 2) }),
5924
+ /* @__PURE__ */ jsx37(Button18, { onClick: () => setStep(3), children: "Continuar" })
5836
5925
  ] }),
5837
5926
  step === 3 && /* @__PURE__ */ jsxs26(Fragment6, { children: [
5838
5927
  config.globalFields.map(
5839
5928
  (field) => renderField(field, global, setGlobal)
5840
5929
  ),
5841
- /* @__PURE__ */ jsx36(Button18, { onClick: () => setStep(4), children: "Continuar" })
5930
+ /* @__PURE__ */ jsx37(Button18, { onClick: () => setStep(4), children: "Continuar" })
5842
5931
  ] }),
5843
5932
  step === 4 && /* @__PURE__ */ jsxs26(Fragment6, { children: [
5844
- config.appFields.length ? config.appFields.map((field) => renderField(field, app, setApp)) : /* @__PURE__ */ jsx36(Text26, { children: "Nenhum par\xE2metro adicional declarado." }),
5845
- /* @__PURE__ */ jsx36(Button18, { onClick: () => setStep(5), children: "Revisar" })
5933
+ config.appFields.length ? config.appFields.map((field) => renderField(field, app, setApp)) : /* @__PURE__ */ jsx37(Text26, { children: "Nenhum par\xE2metro adicional declarado." }),
5934
+ /* @__PURE__ */ jsx37(Button18, { onClick: () => setStep(5), children: "Revisar" })
5846
5935
  ] }),
5847
5936
  step === 5 && /* @__PURE__ */ jsxs26(Fragment6, { children: [
5848
- /* @__PURE__ */ jsx36(Text26, { children: "Ao confirmar, o c\xF3digo ser\xE1 consumido e a inst\xE2ncia ser\xE1 registrada no Ecossistema Oon." }),
5849
- /* @__PURE__ */ jsx36(
5937
+ /* @__PURE__ */ jsx37(Text26, { children: "Ao confirmar, o c\xF3digo ser\xE1 consumido e a inst\xE2ncia ser\xE1 registrada no Ecossistema Oon." }),
5938
+ /* @__PURE__ */ jsx37(
5850
5939
  Button18,
5851
5940
  {
5852
5941
  colorPalette: "blue",
@@ -5858,13 +5947,13 @@ function ActivationPage() {
5858
5947
  )
5859
5948
  ] }),
5860
5949
  step === 6 && /* @__PURE__ */ jsxs26(Fragment6, { children: [
5861
- /* @__PURE__ */ jsx36(Heading14, { size: "md", children: "Ativa\xE7\xE3o conclu\xEDda" }),
5950
+ /* @__PURE__ */ jsx37(Heading14, { size: "md", children: "Ativa\xE7\xE3o conclu\xEDda" }),
5862
5951
  devResult?.appCode ? /* @__PURE__ */ jsxs26(Text26, { children: [
5863
5952
  "C\xF3digo do app: ",
5864
5953
  devResult.appCode,
5865
5954
  ". Redirecionando para a Central em desenvolvimento..."
5866
- ] }) : /* @__PURE__ */ jsx36(Text26, { children: "Redirecionando para o login..." }),
5867
- devResult?.instrucoes?.env ? /* @__PURE__ */ jsx36(Text26, { fontSize: "sm", color: "gray.500", children: devResult.instrucoes.env }) : null
5955
+ ] }) : /* @__PURE__ */ jsx37(Text26, { children: "Redirecionando para o login..." }),
5956
+ devResult?.instrucoes?.env ? /* @__PURE__ */ jsx37(Text26, { fontSize: "sm", color: "gray.500", children: devResult.instrucoes.env }) : null
5868
5957
  ] })
5869
5958
  ]
5870
5959
  }
@@ -5875,95 +5964,95 @@ function InstanceBlockedPage({
5875
5964
  message
5876
5965
  }) {
5877
5966
  return /* @__PURE__ */ jsxs26(Box25, { p: 8, children: [
5878
- /* @__PURE__ */ jsx36(Heading14, { children: title }),
5879
- /* @__PURE__ */ jsx36(Text26, { children: message })
5967
+ /* @__PURE__ */ jsx37(Heading14, { children: title }),
5968
+ /* @__PURE__ */ jsx37(Text26, { children: message })
5880
5969
  ] });
5881
5970
  }
5882
5971
 
5883
5972
  // src/security/RouteGuard.tsx
5884
- import { Fragment as Fragment7, jsx as jsx37 } from "react/jsx-runtime";
5973
+ import { Fragment as Fragment7, jsx as jsx38 } from "react/jsx-runtime";
5885
5974
  function RouteGuard({
5886
5975
  permission,
5887
5976
  children
5888
5977
  }) {
5889
5978
  const { status, hasPermission } = useOonAuth();
5890
- if (status === "loading") return /* @__PURE__ */ jsx37(LoadingScreen, {});
5891
- if (status === "unauthenticated") return /* @__PURE__ */ jsx37(LoadingScreen, { message: "Redirecionando para o login..." });
5979
+ if (status === "loading") return /* @__PURE__ */ jsx38(LoadingScreen, {});
5980
+ if (status === "unauthenticated") return /* @__PURE__ */ jsx38(LoadingScreen, { message: "Redirecionando para o login..." });
5892
5981
  if (!hasPermission(permission)) {
5893
- return /* @__PURE__ */ jsx37(LoadingScreen, { message: "Voc\xEA n\xE3o tem acesso a esta tela." });
5982
+ return /* @__PURE__ */ jsx38(LoadingScreen, { message: "Voc\xEA n\xE3o tem acesso a esta tela." });
5894
5983
  }
5895
- return /* @__PURE__ */ jsx37(Fragment7, { children });
5984
+ return /* @__PURE__ */ jsx38(Fragment7, { children });
5896
5985
  }
5897
5986
 
5898
5987
  // src/security/ActivationGuard.tsx
5899
5988
  import { Navigate as Navigate4 } from "react-router-dom";
5900
- import { jsx as jsx38 } from "react/jsx-runtime";
5989
+ import { jsx as jsx39 } from "react/jsx-runtime";
5901
5990
  function ActivationGuard({ children }) {
5902
5991
  const { status } = useActivation();
5903
5992
  if (status === "loading") return null;
5904
- if (status === "suspended") return /* @__PURE__ */ jsx38(Navigate4, { to: "/instancia-suspensa", replace: true });
5905
- if (status === "revoked") return /* @__PURE__ */ jsx38(Navigate4, { to: "/instancia-revogada", replace: true });
5906
- if (status !== "active" && window.location.pathname !== "/ativacao") return /* @__PURE__ */ jsx38(Navigate4, { to: "/ativacao", replace: true });
5993
+ if (status === "suspended") return /* @__PURE__ */ jsx39(Navigate4, { to: "/instancia-suspensa", replace: true });
5994
+ if (status === "revoked") return /* @__PURE__ */ jsx39(Navigate4, { to: "/instancia-revogada", replace: true });
5995
+ if (status !== "active" && window.location.pathname !== "/ativacao") return /* @__PURE__ */ jsx39(Navigate4, { to: "/ativacao", replace: true });
5907
5996
  return children;
5908
5997
  }
5909
5998
 
5910
5999
  // src/app/createOonRouter.tsx
5911
- import { jsx as jsx39 } from "react/jsx-runtime";
6000
+ import { jsx as jsx40 } from "react/jsx-runtime";
5912
6001
  function createOonRouter({ app, menu, routes, security, layout, registry }) {
5913
6002
  const guardEnabled = security?.enableRouteGuard !== false;
5914
6003
  const publicRoutes = routes.filter((route) => route.public).map((route) => ({ path: route.path, element: route.element }));
5915
6004
  const privateSource = routes.filter((route) => !route.public);
5916
6005
  const privateRoutes = privateSource.map((route) => {
5917
- const element = guardEnabled ? /* @__PURE__ */ jsx39(RouteGuard, { permission: route.permissions, children: route.element }) : route.element;
6006
+ const element = guardEnabled ? /* @__PURE__ */ jsx40(RouteGuard, { permission: route.permissions, children: route.element }) : route.element;
5918
6007
  return route.path === "/" ? { index: true, element } : { path: route.path.replace(/^\//, ""), element };
5919
6008
  });
5920
6009
  const hasIndexRoute = privateSource.some((route) => route.path === "/");
5921
6010
  const firstRoute = privateSource.find((route) => route.path !== "/");
5922
6011
  if (!hasIndexRoute && firstRoute) {
5923
- privateRoutes.unshift({ index: true, element: /* @__PURE__ */ jsx39(Navigate5, { to: firstRoute.path, replace: true }) });
6012
+ privateRoutes.unshift({ index: true, element: /* @__PURE__ */ jsx40(Navigate5, { to: firstRoute.path, replace: true }) });
5924
6013
  }
5925
6014
  const customPaths = new Set(publicRoutes.map((route) => route.path));
5926
6015
  const builtInPublicRoutes = [];
5927
6016
  if (!customPaths.has("/login")) {
5928
6017
  builtInPublicRoutes.push({
5929
6018
  path: "/login",
5930
- element: /* @__PURE__ */ jsx39(ActivationGuard, { children: /* @__PURE__ */ jsx39(LoginPage, { app }) })
6019
+ element: /* @__PURE__ */ jsx40(ActivationGuard, { children: /* @__PURE__ */ jsx40(LoginPage, { app }) })
5931
6020
  });
5932
6021
  }
5933
6022
  if (!customPaths.has("/accept-invite")) {
5934
6023
  builtInPublicRoutes.push({
5935
6024
  path: "/accept-invite",
5936
- element: /* @__PURE__ */ jsx39(ActivationGuard, { children: /* @__PURE__ */ jsx39(AcceptInvitePage, {}) })
6025
+ element: /* @__PURE__ */ jsx40(ActivationGuard, { children: /* @__PURE__ */ jsx40(AcceptInvitePage, {}) })
5937
6026
  });
5938
6027
  }
5939
6028
  if (!customPaths.has("/first-access")) {
5940
6029
  builtInPublicRoutes.push({
5941
6030
  path: "/first-access",
5942
- element: /* @__PURE__ */ jsx39(ActivationGuard, { children: /* @__PURE__ */ jsx39(FirstAccessPage, {}) })
6031
+ element: /* @__PURE__ */ jsx40(ActivationGuard, { children: /* @__PURE__ */ jsx40(FirstAccessPage, {}) })
5943
6032
  });
5944
6033
  }
5945
- if (!customPaths.has("/ativacao")) builtInPublicRoutes.push({ path: "/ativacao", element: /* @__PURE__ */ jsx39(ActivationPage, {}) });
6034
+ if (!customPaths.has("/ativacao")) builtInPublicRoutes.push({ path: "/ativacao", element: /* @__PURE__ */ jsx40(ActivationPage, {}) });
5946
6035
  if (!customPaths.has("/instancia-suspensa")) {
5947
6036
  builtInPublicRoutes.push({
5948
6037
  path: "/instancia-suspensa",
5949
- element: /* @__PURE__ */ jsx39(InstanceBlockedPage, { title: "Inst\xE2ncia suspensa", message: "Esta Central est\xE1 suspensa." })
6038
+ element: /* @__PURE__ */ jsx40(InstanceBlockedPage, { title: "Inst\xE2ncia suspensa", message: "Esta Central est\xE1 suspensa." })
5950
6039
  });
5951
6040
  }
5952
6041
  if (!customPaths.has("/instancia-revogada")) {
5953
6042
  builtInPublicRoutes.push({
5954
6043
  path: "/instancia-revogada",
5955
- element: /* @__PURE__ */ jsx39(InstanceBlockedPage, { title: "Inst\xE2ncia revogada", message: "Esta Central foi revogada." })
6044
+ element: /* @__PURE__ */ jsx40(InstanceBlockedPage, { title: "Inst\xE2ncia revogada", message: "Esta Central foi revogada." })
5956
6045
  });
5957
6046
  }
5958
6047
  if (!customPaths.has("/acesso-negado")) {
5959
- builtInPublicRoutes.push({ path: "/acesso-negado", element: /* @__PURE__ */ jsx39(AccessDeniedPage, { app }) });
6048
+ builtInPublicRoutes.push({ path: "/acesso-negado", element: /* @__PURE__ */ jsx40(AccessDeniedPage, { app }) });
5960
6049
  }
5961
6050
  const tree = [
5962
6051
  ...builtInPublicRoutes,
5963
6052
  ...publicRoutes,
5964
6053
  {
5965
6054
  path: "/",
5966
- element: /* @__PURE__ */ jsx39(ActivationGuard, { children: /* @__PURE__ */ jsx39(AppAccessGuard, { children: /* @__PURE__ */ jsx39(AuthenticatedLayout, { app, menu, layout, registry }) }) }),
6055
+ element: /* @__PURE__ */ jsx40(ActivationGuard, { children: /* @__PURE__ */ jsx40(AppAccessGuard, { children: /* @__PURE__ */ jsx40(AuthenticatedLayout, { app, menu, layout, registry }) }) }),
5967
6056
  children: privateRoutes
5968
6057
  }
5969
6058
  ];
@@ -5971,19 +6060,21 @@ function createOonRouter({ app, menu, routes, security, layout, registry }) {
5971
6060
  }
5972
6061
 
5973
6062
  // src/app/OonApp.tsx
5974
- import { jsx as jsx40 } from "react/jsx-runtime";
6063
+ import { jsx as jsx41 } from "react/jsx-runtime";
5975
6064
  function localLoginUrl() {
5976
6065
  const current = `${window.location.pathname}${window.location.search}`;
5977
6066
  return `/login?redirect=${encodeURIComponent(current)}`;
5978
6067
  }
5979
6068
  function OonApp({ config }) {
5980
- const { http, storage, router } = useMemo9(() => {
6069
+ const { http, storage, tenantStorage, router } = useMemo10(() => {
5981
6070
  const storage2 = createTokenStorage(config.app.id);
6071
+ const tenantStorage2 = createTenantStorage(config.app.id);
5982
6072
  const externalLoginUrl = config.auth?.loginUrl ?? config.api.meusAppsUrl;
5983
6073
  const http2 = createRestClient({
5984
6074
  api: config.api,
5985
6075
  appId: config.app.id,
5986
6076
  getToken: () => storage2.get(),
6077
+ getTenantId: () => tenantStorage2.get(),
5987
6078
  onUnauthorized: () => {
5988
6079
  storage2.clear();
5989
6080
  if (externalLoginUrl) {
@@ -6001,7 +6092,7 @@ function OonApp({ config }) {
6001
6092
  routes.push({
6002
6093
  path: "/accept-invite",
6003
6094
  public: true,
6004
- element: /* @__PURE__ */ jsx40(AcceptInviteCentralPage, {})
6095
+ element: /* @__PURE__ */ jsx41(AcceptInviteCentralPage, {})
6005
6096
  });
6006
6097
  }
6007
6098
  const router2 = createOonRouter({
@@ -6012,9 +6103,18 @@ function OonApp({ config }) {
6012
6103
  layout: config.layout ?? config.ui?.layout,
6013
6104
  registry: config.registry ?? config.ui?.registry
6014
6105
  });
6015
- return { http: http2, storage: storage2, router: router2 };
6106
+ return { http: http2, storage: storage2, tenantStorage: tenantStorage2, router: router2 };
6016
6107
  }, [config]);
6017
- return /* @__PURE__ */ jsx40(OonProviders, { config, http, storage, children: /* @__PURE__ */ jsx40(RouterProvider, { router }) });
6108
+ return /* @__PURE__ */ jsx41(
6109
+ OonProviders,
6110
+ {
6111
+ config,
6112
+ http,
6113
+ storage,
6114
+ tenantStorage,
6115
+ children: /* @__PURE__ */ jsx41(RouterProvider, { router })
6116
+ }
6117
+ );
6018
6118
  }
6019
6119
 
6020
6120
  // src/components/internal/pipelineBoardLayout.ts
@@ -6072,7 +6172,7 @@ function installPipelineBoardLayoutStyles(targetDocument = document) {
6072
6172
  }
6073
6173
 
6074
6174
  // src/start.tsx
6075
- import { jsx as jsx41 } from "react/jsx-runtime";
6175
+ import { jsx as jsx42 } from "react/jsx-runtime";
6076
6176
  function validateConfig(config) {
6077
6177
  if (!config?.app?.id) throw new Error("oonCoreFront.start: config.app.id \xE9 obrigat\xF3rio.");
6078
6178
  if (!config?.api?.baseUrl) throw new Error("oonCoreFront.start: config.api.baseUrl \xE9 obrigat\xF3rio.");
@@ -6107,7 +6207,7 @@ function start(config) {
6107
6207
  const el = document.getElementById(rootId);
6108
6208
  if (!el) throw new Error(`oonCoreFront.start: elemento #${rootId} n\xE3o encontrado no DOM.`);
6109
6209
  createRoot(el).render(
6110
- /* @__PURE__ */ jsx41(StrictMode, { children: /* @__PURE__ */ jsx41(OonApp, { config }) })
6210
+ /* @__PURE__ */ jsx42(StrictMode, { children: /* @__PURE__ */ jsx42(OonApp, { config }) })
6111
6211
  );
6112
6212
  }
6113
6213
  var oonCoreFront = { start };
@@ -6240,10 +6340,10 @@ function startFromManifest(manifest, runtime) {
6240
6340
  import { Stack as Stack14 } from "@chakra-ui/react";
6241
6341
 
6242
6342
  // src/components/CoreIntegration.tsx
6243
- import { useEffect as useEffect11, useState as useState18 } from "react";
6343
+ import { useEffect as useEffect11, useState as useState19 } from "react";
6244
6344
  import { Badge as Badge5, Box as Box26, Button as Button19, Flex as Flex18, Heading as Heading15, Input as Input11, Stack as Stack9, Text as Text27 } from "@chakra-ui/react";
6245
6345
  import { useMutation as useMutation5, useQuery as useQuery10 } from "@tanstack/react-query";
6246
- import { jsx as jsx42, jsxs as jsxs27 } from "react/jsx-runtime";
6346
+ import { jsx as jsx43, jsxs as jsxs27 } from "react/jsx-runtime";
6247
6347
  function dateTime(value2) {
6248
6348
  if (!value2) return "\u2014";
6249
6349
  const date = new Date(value2);
@@ -6317,7 +6417,7 @@ function JsonDiagnosticDetails({
6317
6417
  count !== void 0 ? ` (${count})` : "",
6318
6418
  limited ? " \xB7 visualiza\xE7\xE3o limitada" : ""
6319
6419
  ] }),
6320
- /* @__PURE__ */ jsx42(
6420
+ /* @__PURE__ */ jsx43(
6321
6421
  Box26,
6322
6422
  {
6323
6423
  as: "pre",
@@ -6339,10 +6439,10 @@ function ExecutionDetails({ execution }) {
6339
6439
  const diagnostics = executionDiagnostics(execution);
6340
6440
  const summary = isRecord(execution.summary) ? execution.summary : {};
6341
6441
  const summaryEntries = Object.entries(summary).filter(([, value2]) => value2 === null || ["string", "number", "boolean"].includes(typeof value2));
6342
- return /* @__PURE__ */ jsx42(Box26, { mt: 3, pt: 3, borderTopWidth: "1px", borderColor: "gray.100", children: /* @__PURE__ */ jsxs27(Stack9, { gap: 3, children: [
6442
+ return /* @__PURE__ */ jsx43(Box26, { mt: 3, pt: 3, borderTopWidth: "1px", borderColor: "gray.100", children: /* @__PURE__ */ jsxs27(Stack9, { gap: 3, children: [
6343
6443
  summaryEntries.length ? /* @__PURE__ */ jsxs27(Box26, { children: [
6344
- /* @__PURE__ */ jsx42(Text27, { fontSize: "sm", fontWeight: "semibold", mb: 2, children: "Resumo da execu\xE7\xE3o" }),
6345
- /* @__PURE__ */ jsx42(Flex18, { gap: 2, wrap: "wrap", children: summaryEntries.map(([key, value2]) => /* @__PURE__ */ jsxs27(
6444
+ /* @__PURE__ */ jsx43(Text27, { fontSize: "sm", fontWeight: "semibold", mb: 2, children: "Resumo da execu\xE7\xE3o" }),
6445
+ /* @__PURE__ */ jsx43(Flex18, { gap: 2, wrap: "wrap", children: summaryEntries.map(([key, value2]) => /* @__PURE__ */ jsxs27(
6346
6446
  Badge5,
6347
6447
  {
6348
6448
  variant: "outline",
@@ -6358,14 +6458,14 @@ function ExecutionDetails({ execution }) {
6358
6458
  ] }) : null,
6359
6459
  diagnostics.length ? /* @__PURE__ */ jsxs27(Box26, { children: [
6360
6460
  /* @__PURE__ */ jsxs27(Flex18, { align: "center", justify: "space-between", gap: 2, mb: 2, wrap: "wrap", children: [
6361
- /* @__PURE__ */ jsx42(Text27, { fontSize: "sm", fontWeight: "semibold", children: "Erros por registro" }),
6461
+ /* @__PURE__ */ jsx43(Text27, { fontSize: "sm", fontWeight: "semibold", children: "Erros por registro" }),
6362
6462
  /* @__PURE__ */ jsxs27(Text27, { fontSize: "xs", color: "gray.500", children: [
6363
6463
  execution.errorCount ?? diagnostics.length,
6364
6464
  " erro(s)",
6365
6465
  execution.errorsLimited ? " \xB7 lista limitada" : ""
6366
6466
  ] })
6367
6467
  ] }),
6368
- /* @__PURE__ */ jsx42(Stack9, { gap: 2, children: diagnostics.map((diagnostic, index) => /* @__PURE__ */ jsxs27(
6468
+ /* @__PURE__ */ jsx43(Stack9, { gap: 2, children: diagnostics.map((diagnostic, index) => /* @__PURE__ */ jsxs27(
6369
6469
  Box26,
6370
6470
  {
6371
6471
  p: 3,
@@ -6374,15 +6474,15 @@ function ExecutionDetails({ execution }) {
6374
6474
  borderRadius: "md",
6375
6475
  bg: "red.50",
6376
6476
  children: [
6377
- /* @__PURE__ */ jsx42(Text27, { fontSize: "xs", color: "gray.600", fontWeight: "semibold", children: diagnosticIdentity(diagnostic, index) }),
6378
- /* @__PURE__ */ jsx42(Text27, { fontSize: "sm", color: "red.700", children: diagnosticMessage(diagnostic) }),
6379
- diagnostic.error?.details ? /* @__PURE__ */ jsx42(Text27, { fontSize: "xs", color: "gray.600", mt: 1, children: primitiveText2(diagnostic.error.details) }) : null
6477
+ /* @__PURE__ */ jsx43(Text27, { fontSize: "xs", color: "gray.600", fontWeight: "semibold", children: diagnosticIdentity(diagnostic, index) }),
6478
+ /* @__PURE__ */ jsx43(Text27, { fontSize: "sm", color: "red.700", children: diagnosticMessage(diagnostic) }),
6479
+ diagnostic.error?.details ? /* @__PURE__ */ jsx43(Text27, { fontSize: "xs", color: "gray.600", mt: 1, children: primitiveText2(diagnostic.error.details) }) : null
6380
6480
  ]
6381
6481
  },
6382
6482
  `${diagnostic.index ?? index}:${diagnosticMessage(diagnostic)}`
6383
6483
  )) })
6384
- ] }) : execution.status.toLowerCase().includes("erro") ? /* @__PURE__ */ jsx42(Text27, { fontSize: "sm", color: "red.600", children: execution.message || execution.error?.message || "A execu\xE7\xE3o terminou com erro, mas n\xE3o registrou detalhes adicionais." }) : null,
6385
- /* @__PURE__ */ jsx42(
6484
+ ] }) : execution.status.toLowerCase().includes("erro") ? /* @__PURE__ */ jsx43(Text27, { fontSize: "sm", color: "red.600", children: execution.message || execution.error?.message || "A execu\xE7\xE3o terminou com erro, mas n\xE3o registrou detalhes adicionais." }) : null,
6485
+ /* @__PURE__ */ jsx43(
6386
6486
  JsonDiagnosticDetails,
6387
6487
  {
6388
6488
  label: "Itens processados",
@@ -6391,7 +6491,7 @@ function ExecutionDetails({ execution }) {
6391
6491
  limited: execution.itemsLimited
6392
6492
  }
6393
6493
  ),
6394
- /* @__PURE__ */ jsx42(
6494
+ /* @__PURE__ */ jsx43(
6395
6495
  JsonDiagnosticDetails,
6396
6496
  {
6397
6497
  label: "Chamadas sanitizadas",
@@ -6400,12 +6500,12 @@ function ExecutionDetails({ execution }) {
6400
6500
  limited: execution.requestsLimited
6401
6501
  }
6402
6502
  ),
6403
- /* @__PURE__ */ jsx42(JsonDiagnosticDetails, { label: "Metadados", value: execution.metadata })
6503
+ /* @__PURE__ */ jsx43(JsonDiagnosticDetails, { label: "Metadados", value: execution.metadata })
6404
6504
  ] }) });
6405
6505
  }
6406
6506
  function ProviderConfigurationPanel({ provider }) {
6407
6507
  const { http } = useOonApi();
6408
- const [draft, setDraft] = useState18({
6508
+ const [draft, setDraft] = useState19({
6409
6509
  instanceId: "default",
6410
6510
  label: provider.label,
6411
6511
  active: true,
@@ -6471,11 +6571,11 @@ function ProviderConfigurationPanel({ provider }) {
6471
6571
  listas: mappings.data?.lists?.length ?? 0,
6472
6572
  webhooks: mappings.data?.webhooks?.length ?? 0
6473
6573
  };
6474
- return /* @__PURE__ */ jsx42(Box26, { borderTopWidth: "1px", borderColor: "gray.100", pt: 4, children: /* @__PURE__ */ jsxs27(Stack9, { gap: 3, children: [
6574
+ return /* @__PURE__ */ jsx43(Box26, { borderTopWidth: "1px", borderColor: "gray.100", pt: 4, children: /* @__PURE__ */ jsxs27(Stack9, { gap: 3, children: [
6475
6575
  /* @__PURE__ */ jsxs27(Flex18, { align: "center", justify: "space-between", gap: 3, wrap: "wrap", children: [
6476
6576
  /* @__PURE__ */ jsxs27(Box26, { children: [
6477
- /* @__PURE__ */ jsx42(Text27, { fontWeight: "semibold", children: "Configura\xE7\xE3o" }),
6478
- /* @__PURE__ */ jsx42(Text27, { fontSize: "sm", color: "gray.500", children: "Credenciais protegidas por inst\xE2ncia. Segredos gravados nunca s\xE3o devolvidos ao navegador." })
6577
+ /* @__PURE__ */ jsx43(Text27, { fontWeight: "semibold", children: "Configura\xE7\xE3o" }),
6578
+ /* @__PURE__ */ jsx43(Text27, { fontSize: "sm", color: "gray.500", children: "Credenciais protegidas por inst\xE2ncia. Segredos gravados nunca s\xE3o devolvidos ao navegador." })
6479
6579
  ] }),
6480
6580
  /* @__PURE__ */ jsxs27(Flex18, { gap: 2, wrap: "wrap", children: [
6481
6581
  /* @__PURE__ */ jsxs27(Badge5, { variant: "outline", children: [
@@ -6494,8 +6594,8 @@ function ProviderConfigurationPanel({ provider }) {
6494
6594
  ] }),
6495
6595
  /* @__PURE__ */ jsxs27(Flex18, { gap: 3, wrap: "wrap", children: [
6496
6596
  /* @__PURE__ */ jsxs27(Box26, { minW: "180px", flex: "1", children: [
6497
- /* @__PURE__ */ jsx42(Text27, { fontSize: "xs", color: "gray.500", mb: 1, children: "Inst\xE2ncia" }),
6498
- /* @__PURE__ */ jsx42(
6597
+ /* @__PURE__ */ jsx43(Text27, { fontSize: "xs", color: "gray.500", mb: 1, children: "Inst\xE2ncia" }),
6598
+ /* @__PURE__ */ jsx43(
6499
6599
  Input11,
6500
6600
  {
6501
6601
  size: "sm",
@@ -6506,8 +6606,8 @@ function ProviderConfigurationPanel({ provider }) {
6506
6606
  )
6507
6607
  ] }),
6508
6608
  /* @__PURE__ */ jsxs27(Box26, { minW: "220px", flex: "2", children: [
6509
- /* @__PURE__ */ jsx42(Text27, { fontSize: "xs", color: "gray.500", mb: 1, children: "Nome" }),
6510
- /* @__PURE__ */ jsx42(
6609
+ /* @__PURE__ */ jsx43(Text27, { fontSize: "xs", color: "gray.500", mb: 1, children: "Nome" }),
6610
+ /* @__PURE__ */ jsx43(
6511
6611
  Input11,
6512
6612
  {
6513
6613
  size: "sm",
@@ -6517,7 +6617,7 @@ function ProviderConfigurationPanel({ provider }) {
6517
6617
  )
6518
6618
  ] }),
6519
6619
  /* @__PURE__ */ jsxs27(Box26, { minW: "180px", flex: "1", children: [
6520
- /* @__PURE__ */ jsx42(Text27, { fontSize: "xs", color: "gray.500", mb: 1, children: "Ambiente" }),
6620
+ /* @__PURE__ */ jsx43(Text27, { fontSize: "xs", color: "gray.500", mb: 1, children: "Ambiente" }),
6521
6621
  /* @__PURE__ */ jsxs27(
6522
6622
  "select",
6523
6623
  {
@@ -6535,16 +6635,16 @@ function ProviderConfigurationPanel({ provider }) {
6535
6635
  environment: event.currentTarget.value
6536
6636
  })),
6537
6637
  children: [
6538
- /* @__PURE__ */ jsx42("option", { value: "production", children: "Produ\xE7\xE3o" }),
6539
- /* @__PURE__ */ jsx42("option", { value: "homologation", children: "Homologa\xE7\xE3o" })
6638
+ /* @__PURE__ */ jsx43("option", { value: "production", children: "Produ\xE7\xE3o" }),
6639
+ /* @__PURE__ */ jsx43("option", { value: "homologation", children: "Homologa\xE7\xE3o" })
6540
6640
  ]
6541
6641
  }
6542
6642
  )
6543
6643
  ] })
6544
6644
  ] }),
6545
6645
  /* @__PURE__ */ jsxs27(Box26, { children: [
6546
- /* @__PURE__ */ jsx42(Text27, { fontSize: "xs", color: "gray.500", mb: 1, children: "URL base" }),
6547
- /* @__PURE__ */ jsx42(
6646
+ /* @__PURE__ */ jsx43(Text27, { fontSize: "xs", color: "gray.500", mb: 1, children: "URL base" }),
6647
+ /* @__PURE__ */ jsx43(
6548
6648
  Input11,
6549
6649
  {
6550
6650
  size: "sm",
@@ -6560,7 +6660,7 @@ function ProviderConfigurationPanel({ provider }) {
6560
6660
  "App Key ",
6561
6661
  selected?.appKeyMasked ? `(${selected.appKeyMasked})` : ""
6562
6662
  ] }),
6563
- /* @__PURE__ */ jsx42(
6663
+ /* @__PURE__ */ jsx43(
6564
6664
  Input11,
6565
6665
  {
6566
6666
  size: "sm",
@@ -6572,8 +6672,8 @@ function ProviderConfigurationPanel({ provider }) {
6572
6672
  )
6573
6673
  ] }),
6574
6674
  /* @__PURE__ */ jsxs27(Box26, { minW: "220px", flex: "1", children: [
6575
- /* @__PURE__ */ jsx42(Text27, { fontSize: "xs", color: "gray.500", mb: 1, children: "App Secret" }),
6576
- /* @__PURE__ */ jsx42(
6675
+ /* @__PURE__ */ jsx43(Text27, { fontSize: "xs", color: "gray.500", mb: 1, children: "App Secret" }),
6676
+ /* @__PURE__ */ jsx43(
6577
6677
  Input11,
6578
6678
  {
6579
6679
  size: "sm",
@@ -6585,8 +6685,8 @@ function ProviderConfigurationPanel({ provider }) {
6585
6685
  )
6586
6686
  ] }),
6587
6687
  /* @__PURE__ */ jsxs27(Box26, { minW: "220px", flex: "1", children: [
6588
- /* @__PURE__ */ jsx42(Text27, { fontSize: "xs", color: "gray.500", mb: 1, children: "Token do webhook" }),
6589
- /* @__PURE__ */ jsx42(
6688
+ /* @__PURE__ */ jsx43(Text27, { fontSize: "xs", color: "gray.500", mb: 1, children: "Token do webhook" }),
6689
+ /* @__PURE__ */ jsx43(
6590
6690
  Input11,
6591
6691
  {
6592
6692
  size: "sm",
@@ -6601,7 +6701,7 @@ function ProviderConfigurationPanel({ provider }) {
6601
6701
  /* @__PURE__ */ jsxs27(Flex18, { align: "center", justify: "space-between", gap: 3, wrap: "wrap", children: [
6602
6702
  /* @__PURE__ */ jsxs27(Flex18, { align: "center", gap: 2, wrap: "wrap", children: [
6603
6703
  /* @__PURE__ */ jsxs27("label", { children: [
6604
- /* @__PURE__ */ jsx42(
6704
+ /* @__PURE__ */ jsx43(
6605
6705
  "input",
6606
6706
  {
6607
6707
  type: "checkbox",
@@ -6622,17 +6722,17 @@ function ProviderConfigurationPanel({ provider }) {
6622
6722
  ] })
6623
6723
  ] }),
6624
6724
  /* @__PURE__ */ jsxs27(Flex18, { gap: 2, children: [
6625
- /* @__PURE__ */ jsx42(Button19, { size: "xs", variant: "outline", loading: testConnection.isPending, onClick: () => testConnection.mutate(), children: "Testar conex\xE3o" }),
6626
- /* @__PURE__ */ jsx42(Button19, { size: "xs", loading: save.isPending, onClick: () => save.mutate(), children: "Salvar configura\xE7\xE3o" })
6725
+ /* @__PURE__ */ jsx43(Button19, { size: "xs", variant: "outline", loading: testConnection.isPending, onClick: () => testConnection.mutate(), children: "Testar conex\xE3o" }),
6726
+ /* @__PURE__ */ jsx43(Button19, { size: "xs", loading: save.isPending, onClick: () => save.mutate(), children: "Salvar configura\xE7\xE3o" })
6627
6727
  ] })
6628
6728
  ] }),
6629
- selected?.lastConnectionError ? /* @__PURE__ */ jsx42(Text27, { fontSize: "sm", color: "red.600", children: selected.lastConnectionError }) : null,
6630
- error ? /* @__PURE__ */ jsx42(Text27, { fontSize: "sm", color: "red.600", children: integrationErrorMessage(error) }) : null
6729
+ selected?.lastConnectionError ? /* @__PURE__ */ jsx43(Text27, { fontSize: "sm", color: "red.600", children: selected.lastConnectionError }) : null,
6730
+ error ? /* @__PURE__ */ jsx43(Text27, { fontSize: "sm", color: "red.600", children: integrationErrorMessage(error) }) : null
6631
6731
  ] }) });
6632
6732
  }
6633
6733
  function CoreIntegration({ label = "Integra\xE7\xF5es" }) {
6634
6734
  const { http } = useOonApi();
6635
- const [expandedExecutionId, setExpandedExecutionId] = useState18(null);
6735
+ const [expandedExecutionId, setExpandedExecutionId] = useState19(null);
6636
6736
  const providers = useQuery10({
6637
6737
  queryKey: ["core-integrations", "health"],
6638
6738
  queryFn: async () => (await http.get("/integrations/health")).data?.results ?? []
@@ -6688,27 +6788,27 @@ function CoreIntegration({ label = "Integra\xE7\xF5es" }) {
6688
6788
  ),
6689
6789
  onSuccess: refresh
6690
6790
  });
6691
- if (providers.isLoading || queue.isLoading || history.isLoading) return /* @__PURE__ */ jsx42(LoadingScreen, {});
6791
+ if (providers.isLoading || queue.isLoading || history.isLoading) return /* @__PURE__ */ jsx43(LoadingScreen, {});
6692
6792
  const error = providers.error || queue.error || history.error;
6693
- if (error) return /* @__PURE__ */ jsx42(ErrorState, { error });
6793
+ if (error) return /* @__PURE__ */ jsx43(ErrorState, { error });
6694
6794
  return /* @__PURE__ */ jsxs27(Stack9, { gap: 6, children: [
6695
6795
  /* @__PURE__ */ jsxs27(Flex18, { align: "center", justify: "space-between", gap: 4, wrap: "wrap", children: [
6696
6796
  /* @__PURE__ */ jsxs27(Box26, { children: [
6697
- /* @__PURE__ */ jsx42(Heading15, { size: "lg", children: label }),
6698
- /* @__PURE__ */ jsx42(Text27, { color: "gray.500", children: "Configura\xE7\xE3o, sa\xFAde, filas, eventos e diagn\xF3stico sanitizado por provedor." })
6797
+ /* @__PURE__ */ jsx43(Heading15, { size: "lg", children: label }),
6798
+ /* @__PURE__ */ jsx43(Text27, { color: "gray.500", children: "Configura\xE7\xE3o, sa\xFAde, filas, eventos e diagn\xF3stico sanitizado por provedor." })
6699
6799
  ] }),
6700
- /* @__PURE__ */ jsx42(Button19, { size: "sm", variant: "outline", loading: process.isPending, onClick: () => process.mutate(), children: "Processar pend\xEAncias" })
6800
+ /* @__PURE__ */ jsx43(Button19, { size: "sm", variant: "outline", loading: process.isPending, onClick: () => process.mutate(), children: "Processar pend\xEAncias" })
6701
6801
  ] }),
6702
- /* @__PURE__ */ jsx42(Stack9, { gap: 3, children: (providers.data ?? []).length === 0 ? /* @__PURE__ */ jsx42(Text27, { color: "gray.400", children: "Nenhum provedor registrado." }) : providers.data?.map((provider) => /* @__PURE__ */ jsx42(Box26, { borderWidth: "1px", borderColor: "gray.200", borderRadius: "md", bg: "white", p: 4, children: /* @__PURE__ */ jsxs27(Stack9, { gap: 3, children: [
6802
+ /* @__PURE__ */ jsx43(Stack9, { gap: 3, children: (providers.data ?? []).length === 0 ? /* @__PURE__ */ jsx43(Text27, { color: "gray.400", children: "Nenhum provedor registrado." }) : providers.data?.map((provider) => /* @__PURE__ */ jsx43(Box26, { borderWidth: "1px", borderColor: "gray.200", borderRadius: "md", bg: "white", p: 4, children: /* @__PURE__ */ jsxs27(Stack9, { gap: 3, children: [
6703
6803
  /* @__PURE__ */ jsxs27(Flex18, { align: "center", justify: "space-between", gap: 3, wrap: "wrap", children: [
6704
6804
  /* @__PURE__ */ jsxs27(Box26, { children: [
6705
6805
  /* @__PURE__ */ jsxs27(Flex18, { align: "center", gap: 2, children: [
6706
- /* @__PURE__ */ jsx42(Text27, { fontWeight: "semibold", children: provider.label }),
6707
- /* @__PURE__ */ jsx42(Badge5, { colorPalette: statusPalette(provider.status), children: provider.status ?? "\u2014" })
6806
+ /* @__PURE__ */ jsx43(Text27, { fontWeight: "semibold", children: provider.label }),
6807
+ /* @__PURE__ */ jsx43(Badge5, { colorPalette: statusPalette(provider.status), children: provider.status ?? "\u2014" })
6708
6808
  ] }),
6709
- provider.description ? /* @__PURE__ */ jsx42(Text27, { color: "gray.500", fontSize: "sm", children: provider.description }) : null
6809
+ provider.description ? /* @__PURE__ */ jsx43(Text27, { color: "gray.500", fontSize: "sm", children: provider.description }) : null
6710
6810
  ] }),
6711
- /* @__PURE__ */ jsx42(Button19, { size: "xs", variant: "outline", loading: syncAll.isPending, onClick: () => syncAll.mutate(provider.key), children: "Sincronizar tudo" })
6811
+ /* @__PURE__ */ jsx43(Button19, { size: "xs", variant: "outline", loading: syncAll.isPending, onClick: () => syncAll.mutate(provider.key), children: "Sincronizar tudo" })
6712
6812
  ] }),
6713
6813
  /* @__PURE__ */ jsxs27(Flex18, { gap: 3, wrap: "wrap", children: [
6714
6814
  /* @__PURE__ */ jsxs27(Badge5, { colorPalette: countActive(provider.queue) ? "yellow" : "green", children: [
@@ -6728,7 +6828,7 @@ function CoreIntegration({ label = "Integra\xE7\xF5es" }) {
6728
6828
  "Pend\xEAncia mais antiga: ",
6729
6829
  dateTime(provider.oldestPendingAt)
6730
6830
  ] }),
6731
- /* @__PURE__ */ jsx42(Flex18, { gap: 2, wrap: "wrap", children: (provider.resources ?? []).map((resource) => /* @__PURE__ */ jsx42(
6831
+ /* @__PURE__ */ jsx43(Flex18, { gap: 2, wrap: "wrap", children: (provider.resources ?? []).map((resource) => /* @__PURE__ */ jsx43(
6732
6832
  Button19,
6733
6833
  {
6734
6834
  size: "xs",
@@ -6739,16 +6839,16 @@ function CoreIntegration({ label = "Integra\xE7\xF5es" }) {
6739
6839
  },
6740
6840
  resource.key
6741
6841
  )) }),
6742
- provider.configuration?.enabled ? /* @__PURE__ */ jsx42(ProviderConfigurationPanel, { provider }) : null
6842
+ provider.configuration?.enabled ? /* @__PURE__ */ jsx43(ProviderConfigurationPanel, { provider }) : null
6743
6843
  ] }) }, provider.key)) }),
6744
6844
  /* @__PURE__ */ jsxs27(Box26, { children: [
6745
- /* @__PURE__ */ jsx42(Heading15, { size: "md", mb: 3, children: "Fila recente" }),
6746
- /* @__PURE__ */ jsx42(Stack9, { gap: 2, children: (queue.data ?? []).length === 0 ? /* @__PURE__ */ jsx42(Text27, { color: "gray.400", children: "Nenhum ticket de integra\xE7\xE3o." }) : queue.data?.map((ticket) => /* @__PURE__ */ jsx42(Box26, { borderWidth: "1px", borderRadius: "md", p: 3, bg: "white", children: /* @__PURE__ */ jsxs27(Flex18, { align: "center", justify: "space-between", gap: 3, wrap: "wrap", children: [
6845
+ /* @__PURE__ */ jsx43(Heading15, { size: "md", mb: 3, children: "Fila recente" }),
6846
+ /* @__PURE__ */ jsx43(Stack9, { gap: 2, children: (queue.data ?? []).length === 0 ? /* @__PURE__ */ jsx43(Text27, { color: "gray.400", children: "Nenhum ticket de integra\xE7\xE3o." }) : queue.data?.map((ticket) => /* @__PURE__ */ jsx43(Box26, { borderWidth: "1px", borderRadius: "md", p: 3, bg: "white", children: /* @__PURE__ */ jsxs27(Flex18, { align: "center", justify: "space-between", gap: 3, wrap: "wrap", children: [
6747
6847
  /* @__PURE__ */ jsxs27(Box26, { children: [
6748
6848
  /* @__PURE__ */ jsxs27(Flex18, { align: "center", gap: 2, wrap: "wrap", children: [
6749
- /* @__PURE__ */ jsx42(Text27, { fontWeight: "medium", children: ticket.handler }),
6750
- /* @__PURE__ */ jsx42(Badge5, { colorPalette: statusPalette(ticket.status), children: ticket.status }),
6751
- /* @__PURE__ */ jsx42(Badge5, { variant: "outline", children: ticket.provider })
6849
+ /* @__PURE__ */ jsx43(Text27, { fontWeight: "medium", children: ticket.handler }),
6850
+ /* @__PURE__ */ jsx43(Badge5, { colorPalette: statusPalette(ticket.status), children: ticket.status }),
6851
+ /* @__PURE__ */ jsx43(Badge5, { variant: "outline", children: ticket.provider })
6752
6852
  ] }),
6753
6853
  /* @__PURE__ */ jsxs27(Text27, { fontSize: "sm", color: "gray.500", children: [
6754
6854
  ticket.resource || "sem recurso",
@@ -6757,23 +6857,23 @@ function CoreIntegration({ label = "Integra\xE7\xF5es" }) {
6757
6857
  " \xB7 pr\xF3xima ",
6758
6858
  dateTime(ticket.nextAttemptAt)
6759
6859
  ] }),
6760
- ticket.lastError?.message ? /* @__PURE__ */ jsx42(Text27, { fontSize: "sm", color: "red.600", children: ticket.lastError.message }) : null
6860
+ ticket.lastError?.message ? /* @__PURE__ */ jsx43(Text27, { fontSize: "sm", color: "red.600", children: ticket.lastError.message }) : null
6761
6861
  ] }),
6762
6862
  /* @__PURE__ */ jsxs27(Flex18, { gap: 2, children: [
6763
- ["Erro tempor\xE1rio", "Erro definitivo", "Arquivado"].includes(ticket.status) ? /* @__PURE__ */ jsx42(Button19, { size: "xs", variant: "outline", loading: reprocess.isPending, onClick: () => reprocess.mutate(ticket._id), children: "Reprocessar" }) : null,
6764
- ["Erro tempor\xE1rio", "Erro definitivo"].includes(ticket.status) ? /* @__PURE__ */ jsx42(Button19, { size: "xs", variant: "outline", loading: archive.isPending, onClick: () => archive.mutate(ticket._id), children: "Arquivar" }) : null
6863
+ ["Erro tempor\xE1rio", "Erro definitivo", "Arquivado"].includes(ticket.status) ? /* @__PURE__ */ jsx43(Button19, { size: "xs", variant: "outline", loading: reprocess.isPending, onClick: () => reprocess.mutate(ticket._id), children: "Reprocessar" }) : null,
6864
+ ["Erro tempor\xE1rio", "Erro definitivo"].includes(ticket.status) ? /* @__PURE__ */ jsx43(Button19, { size: "xs", variant: "outline", loading: archive.isPending, onClick: () => archive.mutate(ticket._id), children: "Arquivar" }) : null
6765
6865
  ] })
6766
6866
  ] }) }, ticket._id)) })
6767
6867
  ] }),
6768
6868
  /* @__PURE__ */ jsxs27(Box26, { children: [
6769
- /* @__PURE__ */ jsx42(Heading15, { size: "md", mb: 3, children: "Hist\xF3rico" }),
6770
- /* @__PURE__ */ jsx42(Stack9, { gap: 2, children: (history.data ?? []).length === 0 ? /* @__PURE__ */ jsx42(Text27, { color: "gray.400", children: "Nenhuma execu\xE7\xE3o registrada." }) : history.data?.map((execution) => {
6869
+ /* @__PURE__ */ jsx43(Heading15, { size: "md", mb: 3, children: "Hist\xF3rico" }),
6870
+ /* @__PURE__ */ jsx43(Stack9, { gap: 2, children: (history.data ?? []).length === 0 ? /* @__PURE__ */ jsx43(Text27, { color: "gray.400", children: "Nenhuma execu\xE7\xE3o registrada." }) : history.data?.map((execution) => {
6771
6871
  const expanded = expandedExecutionId === execution._id;
6772
6872
  const diagnosticCount = execution.errorCount ?? execution.errors?.length ?? (execution.error?.message ? 1 : 0);
6773
6873
  return /* @__PURE__ */ jsxs27(Box26, { borderWidth: "1px", borderRadius: "md", p: 3, bg: "white", children: [
6774
6874
  /* @__PURE__ */ jsxs27(Flex18, { align: "center", justify: "space-between", gap: 3, wrap: "wrap", children: [
6775
6875
  /* @__PURE__ */ jsxs27(Box26, { children: [
6776
- /* @__PURE__ */ jsx42(Text27, { fontWeight: "medium", children: execution.title }),
6876
+ /* @__PURE__ */ jsx43(Text27, { fontWeight: "medium", children: execution.title }),
6777
6877
  /* @__PURE__ */ jsxs27(Text27, { fontSize: "sm", color: "gray.500", children: [
6778
6878
  execution.provider,
6779
6879
  " \xB7 ",
@@ -6784,15 +6884,15 @@ function CoreIntegration({ label = "Integra\xE7\xF5es" }) {
6784
6884
  execution.durationMs ?? 0,
6785
6885
  " ms"
6786
6886
  ] }),
6787
- execution.error?.message ? /* @__PURE__ */ jsx42(Text27, { fontSize: "sm", color: "red.600", children: execution.error.message }) : null
6887
+ execution.error?.message ? /* @__PURE__ */ jsx43(Text27, { fontSize: "sm", color: "red.600", children: execution.error.message }) : null
6788
6888
  ] }),
6789
6889
  /* @__PURE__ */ jsxs27(Flex18, { align: "center", gap: 2, wrap: "wrap", children: [
6790
6890
  diagnosticCount > 0 ? /* @__PURE__ */ jsxs27(Badge5, { colorPalette: "red", children: [
6791
6891
  diagnosticCount,
6792
6892
  " erro(s)"
6793
6893
  ] }) : null,
6794
- /* @__PURE__ */ jsx42(Badge5, { colorPalette: statusPalette(execution.status), children: execution.status }),
6795
- /* @__PURE__ */ jsx42(
6894
+ /* @__PURE__ */ jsx43(Badge5, { colorPalette: statusPalette(execution.status), children: execution.status }),
6895
+ /* @__PURE__ */ jsx43(
6796
6896
  Button19,
6797
6897
  {
6798
6898
  size: "xs",
@@ -6804,7 +6904,7 @@ function CoreIntegration({ label = "Integra\xE7\xF5es" }) {
6804
6904
  )
6805
6905
  ] })
6806
6906
  ] }),
6807
- expanded ? /* @__PURE__ */ jsx42(ExecutionDetails, { execution }) : null
6907
+ expanded ? /* @__PURE__ */ jsx43(ExecutionDetails, { execution }) : null
6808
6908
  ] }, execution._id);
6809
6909
  }) })
6810
6910
  ] })
@@ -6814,7 +6914,7 @@ function CoreIntegration({ label = "Integra\xE7\xF5es" }) {
6814
6914
  // src/components/CoreIntegrationMappings.tsx
6815
6915
  import { Badge as Badge6, Box as Box27, Flex as Flex19, Heading as Heading16, Stack as Stack10, Text as Text28 } from "@chakra-ui/react";
6816
6916
  import { useQuery as useQuery11 } from "@tanstack/react-query";
6817
- import { jsx as jsx43, jsxs as jsxs28 } from "react/jsx-runtime";
6917
+ import { jsx as jsx44, jsxs as jsxs28 } from "react/jsx-runtime";
6818
6918
  function dateTime2(value2) {
6819
6919
  if (!value2) return "sem execu\xE7\xE3o";
6820
6920
  const date = new Date(value2);
@@ -6836,33 +6936,33 @@ function CoreIntegrationMappings() {
6836
6936
  })))
6837
6937
  });
6838
6938
  if (providers.isLoading || summaries.isLoading) {
6839
- return /* @__PURE__ */ jsx43(Text28, { color: "gray.500", children: "Carregando contratos declarados\u2026" });
6939
+ return /* @__PURE__ */ jsx44(Text28, { color: "gray.500", children: "Carregando contratos declarados\u2026" });
6840
6940
  }
6841
6941
  if (providers.error || summaries.error) {
6842
- return /* @__PURE__ */ jsx43(Text28, { color: "red.600", children: "N\xE3o foi poss\xEDvel carregar os contratos declarados." });
6942
+ return /* @__PURE__ */ jsx44(Text28, { color: "red.600", children: "N\xE3o foi poss\xEDvel carregar os contratos declarados." });
6843
6943
  }
6844
6944
  if (!(summaries.data ?? []).length) return null;
6845
6945
  return /* @__PURE__ */ jsxs28(Box27, { children: [
6846
- /* @__PURE__ */ jsx43(Heading16, { size: "md", mb: 1, children: "Contratos declarados" }),
6847
- /* @__PURE__ */ jsx43(Text28, { color: "gray.500", mb: 3, children: "Chamadas, listas e mappings pertencem \xE0 Central; o Core exibe somente metadados sanitizados." }),
6848
- /* @__PURE__ */ jsx43(Stack10, { gap: 3, children: summaries.data?.map(({ provider, mappings }) => /* @__PURE__ */ jsx43(Box27, { borderWidth: "1px", borderRadius: "md", bg: "white", p: 4, children: /* @__PURE__ */ jsxs28(Stack10, { gap: 4, children: [
6849
- /* @__PURE__ */ jsx43(Heading16, { size: "sm", children: provider.label }),
6946
+ /* @__PURE__ */ jsx44(Heading16, { size: "md", mb: 1, children: "Contratos declarados" }),
6947
+ /* @__PURE__ */ jsx44(Text28, { color: "gray.500", mb: 3, children: "Chamadas, listas e mappings pertencem \xE0 Central; o Core exibe somente metadados sanitizados." }),
6948
+ /* @__PURE__ */ jsx44(Stack10, { gap: 3, children: summaries.data?.map(({ provider, mappings }) => /* @__PURE__ */ jsx44(Box27, { borderWidth: "1px", borderRadius: "md", bg: "white", p: 4, children: /* @__PURE__ */ jsxs28(Stack10, { gap: 4, children: [
6949
+ /* @__PURE__ */ jsx44(Heading16, { size: "sm", children: provider.label }),
6850
6950
  /* @__PURE__ */ jsxs28(Box27, { children: [
6851
- /* @__PURE__ */ jsx43(Text28, { fontWeight: "semibold", mb: 2, children: "Chamadas Omie" }),
6852
- /* @__PURE__ */ jsx43(Flex19, { gap: 2, wrap: "wrap", children: (mappings.calls ?? []).length ? mappings.calls?.map((call) => /* @__PURE__ */ jsxs28(Badge6, { variant: "outline", children: [
6951
+ /* @__PURE__ */ jsx44(Text28, { fontWeight: "semibold", mb: 2, children: "Chamadas Omie" }),
6952
+ /* @__PURE__ */ jsx44(Flex19, { gap: 2, wrap: "wrap", children: (mappings.calls ?? []).length ? mappings.calls?.map((call) => /* @__PURE__ */ jsxs28(Badge6, { variant: "outline", children: [
6853
6953
  call.label || call.key,
6854
6954
  " \xB7 ",
6855
6955
  call.call || "opera\xE7\xE3o",
6856
6956
  call.paginated ? " \xB7 paginada" : ""
6857
- ] }, call.key)) : /* @__PURE__ */ jsx43(Text28, { fontSize: "sm", color: "gray.400", children: "Nenhuma chamada declarada." }) })
6957
+ ] }, call.key)) : /* @__PURE__ */ jsx44(Text28, { fontSize: "sm", color: "gray.400", children: "Nenhuma chamada declarada." }) })
6858
6958
  ] }),
6859
6959
  /* @__PURE__ */ jsxs28(Box27, { children: [
6860
- /* @__PURE__ */ jsx43(Text28, { fontWeight: "semibold", mb: 2, children: "Listas Omie" }),
6861
- /* @__PURE__ */ jsx43(Stack10, { gap: 2, children: (mappings.lists ?? []).length ? mappings.lists?.map((list) => {
6960
+ /* @__PURE__ */ jsx44(Text28, { fontWeight: "semibold", mb: 2, children: "Listas Omie" }),
6961
+ /* @__PURE__ */ jsx44(Stack10, { gap: 2, children: (mappings.lists ?? []).length ? mappings.lists?.map((list) => {
6862
6962
  const latest = list.executions?.[0];
6863
- return /* @__PURE__ */ jsx43(Box27, { borderWidth: "1px", borderColor: "gray.100", borderRadius: "md", p: 3, children: /* @__PURE__ */ jsxs28(Flex19, { align: "center", justify: "space-between", gap: 2, wrap: "wrap", children: [
6963
+ return /* @__PURE__ */ jsx44(Box27, { borderWidth: "1px", borderColor: "gray.100", borderRadius: "md", p: 3, children: /* @__PURE__ */ jsxs28(Flex19, { align: "center", justify: "space-between", gap: 2, wrap: "wrap", children: [
6864
6964
  /* @__PURE__ */ jsxs28(Box27, { children: [
6865
- /* @__PURE__ */ jsx43(Text28, { fontSize: "sm", fontWeight: "medium", children: list.label || list.key }),
6965
+ /* @__PURE__ */ jsx44(Text28, { fontSize: "sm", fontWeight: "medium", children: list.label || list.key }),
6866
6966
  /* @__PURE__ */ jsxs28(Text28, { fontSize: "xs", color: "gray.500", children: [
6867
6967
  list.mode || "modo padr\xE3o",
6868
6968
  " \xB7 ",
@@ -6872,29 +6972,29 @@ function CoreIntegrationMappings() {
6872
6972
  ] })
6873
6973
  ] }),
6874
6974
  /* @__PURE__ */ jsxs28(Flex19, { gap: 2, wrap: "wrap", children: [
6875
- /* @__PURE__ */ jsx43(Badge6, { variant: "outline", children: latest?.status || "n\xE3o executada" }),
6876
- /* @__PURE__ */ jsx43(Badge6, { variant: "outline", children: dateTime2(latest?.lastCompletedAt) })
6975
+ /* @__PURE__ */ jsx44(Badge6, { variant: "outline", children: latest?.status || "n\xE3o executada" }),
6976
+ /* @__PURE__ */ jsx44(Badge6, { variant: "outline", children: dateTime2(latest?.lastCompletedAt) })
6877
6977
  ] })
6878
6978
  ] }) }, list.key);
6879
- }) : /* @__PURE__ */ jsx43(Text28, { fontSize: "sm", color: "gray.400", children: "Nenhuma lista declarada." }) })
6979
+ }) : /* @__PURE__ */ jsx44(Text28, { fontSize: "sm", color: "gray.400", children: "Nenhuma lista declarada." }) })
6880
6980
  ] }),
6881
6981
  /* @__PURE__ */ jsxs28(Box27, { children: [
6882
- /* @__PURE__ */ jsx43(Text28, { fontWeight: "semibold", mb: 2, children: "Mappings de webhook" }),
6883
- /* @__PURE__ */ jsx43(Stack10, { gap: 1, children: (mappings.webhooks ?? []).length ? mappings.webhooks?.map((webhook) => /* @__PURE__ */ jsxs28(Text28, { fontSize: "sm", color: "gray.600", children: [
6982
+ /* @__PURE__ */ jsx44(Text28, { fontWeight: "semibold", mb: 2, children: "Mappings de webhook" }),
6983
+ /* @__PURE__ */ jsx44(Stack10, { gap: 1, children: (mappings.webhooks ?? []).length ? mappings.webhooks?.map((webhook) => /* @__PURE__ */ jsxs28(Text28, { fontSize: "sm", color: "gray.600", children: [
6884
6984
  webhook.eventType,
6885
6985
  " \u2192 ",
6886
6986
  (webhook.actions ?? []).map((action) => action.handler).filter(Boolean).join(", ") || "sem a\xE7\xE3o declarada"
6887
- ] }, `${webhook.eventType}:${webhook.resource || ""}`)) : /* @__PURE__ */ jsx43(Text28, { fontSize: "sm", color: "gray.400", children: "Nenhum mapping de webhook declarado." }) })
6987
+ ] }, `${webhook.eventType}:${webhook.resource || ""}`)) : /* @__PURE__ */ jsx44(Text28, { fontSize: "sm", color: "gray.400", children: "Nenhum mapping de webhook declarado." }) })
6888
6988
  ] })
6889
6989
  ] }) }, provider.key)) })
6890
6990
  ] });
6891
6991
  }
6892
6992
 
6893
6993
  // src/components/CoreIntegrationTickets.tsx
6894
- import { useEffect as useEffect12, useMemo as useMemo10, useState as useState19 } from "react";
6994
+ import { useEffect as useEffect12, useMemo as useMemo11, useState as useState20 } from "react";
6895
6995
  import { Badge as Badge7, Box as Box28, Button as Button20, Flex as Flex20, Heading as Heading17, Input as Input12, Stack as Stack11, Text as Text29 } from "@chakra-ui/react";
6896
6996
  import { useMutation as useMutation6, useQuery as useQuery12 } from "@tanstack/react-query";
6897
- import { jsx as jsx44, jsxs as jsxs29 } from "react/jsx-runtime";
6997
+ import { jsx as jsx45, jsxs as jsxs29 } from "react/jsx-runtime";
6898
6998
  var TICKET_STATUSES = [
6899
6999
  "Pendente",
6900
7000
  "Processando",
@@ -6942,7 +7042,7 @@ function NativeSelect5({
6942
7042
  children,
6943
7043
  ariaLabel
6944
7044
  }) {
6945
- return /* @__PURE__ */ jsx44(
7045
+ return /* @__PURE__ */ jsx45(
6946
7046
  "select",
6947
7047
  {
6948
7048
  "aria-label": ariaLabel,
@@ -6964,8 +7064,8 @@ function JsonDetails({ label, value: value2 }) {
6964
7064
  if (value2 === void 0 || value2 === null) return null;
6965
7065
  if (typeof value2 === "object" && !Array.isArray(value2) && !Object.keys(value2).length) return null;
6966
7066
  return /* @__PURE__ */ jsxs29("details", { children: [
6967
- /* @__PURE__ */ jsx44("summary", { style: { cursor: "pointer", fontWeight: 600 }, children: label }),
6968
- /* @__PURE__ */ jsx44(
7067
+ /* @__PURE__ */ jsx45("summary", { style: { cursor: "pointer", fontWeight: 600 }, children: label }),
7068
+ /* @__PURE__ */ jsx45(
6969
7069
  Box28,
6970
7070
  {
6971
7071
  as: "pre",
@@ -6986,53 +7086,53 @@ function TicketDetails({ ticket }) {
6986
7086
  return /* @__PURE__ */ jsxs29(Stack11, { gap: 3, pt: 3, mt: 3, borderTopWidth: "1px", children: [
6987
7087
  /* @__PURE__ */ jsxs29(Box28, { display: "grid", gridTemplateColumns: { base: "1fr", md: "repeat(3, minmax(0, 1fr))" }, gap: 3, children: [
6988
7088
  /* @__PURE__ */ jsxs29(Box28, { children: [
6989
- /* @__PURE__ */ jsx44(Text29, { fontSize: "xs", color: "gray.500", children: "ID completo" }),
6990
- /* @__PURE__ */ jsx44(Text29, { fontSize: "sm", wordBreak: "break-all", children: ticket._id })
7089
+ /* @__PURE__ */ jsx45(Text29, { fontSize: "xs", color: "gray.500", children: "ID completo" }),
7090
+ /* @__PURE__ */ jsx45(Text29, { fontSize: "sm", wordBreak: "break-all", children: ticket._id })
6991
7091
  ] }),
6992
7092
  /* @__PURE__ */ jsxs29(Box28, { children: [
6993
- /* @__PURE__ */ jsx44(Text29, { fontSize: "xs", color: "gray.500", children: "Chave de idempot\xEAncia" }),
6994
- /* @__PURE__ */ jsx44(Text29, { fontSize: "sm", wordBreak: "break-all", children: ticket.idempotencyKey || "\u2014" })
7093
+ /* @__PURE__ */ jsx45(Text29, { fontSize: "xs", color: "gray.500", children: "Chave de idempot\xEAncia" }),
7094
+ /* @__PURE__ */ jsx45(Text29, { fontSize: "sm", wordBreak: "break-all", children: ticket.idempotencyKey || "\u2014" })
6995
7095
  ] }),
6996
7096
  /* @__PURE__ */ jsxs29(Box28, { children: [
6997
- /* @__PURE__ */ jsx44(Text29, { fontSize: "xs", color: "gray.500", children: "Status anterior" }),
6998
- /* @__PURE__ */ jsx44(Text29, { fontSize: "sm", children: ticket.previousStatus || "\u2014" })
7097
+ /* @__PURE__ */ jsx45(Text29, { fontSize: "xs", color: "gray.500", children: "Status anterior" }),
7098
+ /* @__PURE__ */ jsx45(Text29, { fontSize: "sm", children: ticket.previousStatus || "\u2014" })
6999
7099
  ] }),
7000
7100
  /* @__PURE__ */ jsxs29(Box28, { children: [
7001
- /* @__PURE__ */ jsx44(Text29, { fontSize: "xs", color: "gray.500", children: "Criado" }),
7002
- /* @__PURE__ */ jsx44(Text29, { fontSize: "sm", children: dateTime3(ticket.createdAt) })
7101
+ /* @__PURE__ */ jsx45(Text29, { fontSize: "xs", color: "gray.500", children: "Criado" }),
7102
+ /* @__PURE__ */ jsx45(Text29, { fontSize: "sm", children: dateTime3(ticket.createdAt) })
7003
7103
  ] }),
7004
7104
  /* @__PURE__ */ jsxs29(Box28, { children: [
7005
- /* @__PURE__ */ jsx44(Text29, { fontSize: "xs", color: "gray.500", children: "Atualizado" }),
7006
- /* @__PURE__ */ jsx44(Text29, { fontSize: "sm", children: dateTime3(ticket.updatedAt) })
7105
+ /* @__PURE__ */ jsx45(Text29, { fontSize: "xs", color: "gray.500", children: "Atualizado" }),
7106
+ /* @__PURE__ */ jsx45(Text29, { fontSize: "sm", children: dateTime3(ticket.updatedAt) })
7007
7107
  ] }),
7008
7108
  /* @__PURE__ */ jsxs29(Box28, { children: [
7009
- /* @__PURE__ */ jsx44(Text29, { fontSize: "xs", color: "gray.500", children: "Conclu\xEDdo" }),
7010
- /* @__PURE__ */ jsx44(Text29, { fontSize: "sm", children: dateTime3(ticket.completedAt) })
7109
+ /* @__PURE__ */ jsx45(Text29, { fontSize: "xs", color: "gray.500", children: "Conclu\xEDdo" }),
7110
+ /* @__PURE__ */ jsx45(Text29, { fontSize: "sm", children: dateTime3(ticket.completedAt) })
7011
7111
  ] }),
7012
7112
  /* @__PURE__ */ jsxs29(Box28, { children: [
7013
- /* @__PURE__ */ jsx44(Text29, { fontSize: "xs", color: "gray.500", children: "Worker" }),
7014
- /* @__PURE__ */ jsx44(Text29, { fontSize: "sm", children: ticket.lockedBy || "\u2014" })
7113
+ /* @__PURE__ */ jsx45(Text29, { fontSize: "xs", color: "gray.500", children: "Worker" }),
7114
+ /* @__PURE__ */ jsx45(Text29, { fontSize: "sm", children: ticket.lockedBy || "\u2014" })
7015
7115
  ] }),
7016
7116
  /* @__PURE__ */ jsxs29(Box28, { children: [
7017
- /* @__PURE__ */ jsx44(Text29, { fontSize: "xs", color: "gray.500", children: "Lease expira" }),
7018
- /* @__PURE__ */ jsx44(Text29, { fontSize: "sm", children: dateTime3(ticket.leaseExpiresAt) })
7117
+ /* @__PURE__ */ jsx45(Text29, { fontSize: "xs", color: "gray.500", children: "Lease expira" }),
7118
+ /* @__PURE__ */ jsx45(Text29, { fontSize: "sm", children: dateTime3(ticket.leaseExpiresAt) })
7019
7119
  ] }),
7020
7120
  /* @__PURE__ */ jsxs29(Box28, { children: [
7021
- /* @__PURE__ */ jsx44(Text29, { fontSize: "xs", color: "gray.500", children: "Heartbeat" }),
7022
- /* @__PURE__ */ jsx44(Text29, { fontSize: "sm", children: dateTime3(ticket.heartbeatAt) })
7121
+ /* @__PURE__ */ jsx45(Text29, { fontSize: "xs", color: "gray.500", children: "Heartbeat" }),
7122
+ /* @__PURE__ */ jsx45(Text29, { fontSize: "sm", children: dateTime3(ticket.heartbeatAt) })
7023
7123
  ] })
7024
7124
  ] }),
7025
7125
  error ? /* @__PURE__ */ jsxs29(Box28, { borderWidth: "1px", borderColor: "red.100", borderRadius: "md", bg: "red.50", p: 3, children: [
7026
- /* @__PURE__ */ jsx44(Text29, { fontSize: "xs", color: "gray.600", children: "\xDAltimo erro" }),
7027
- /* @__PURE__ */ jsx44(Text29, { color: "red.700", children: error })
7126
+ /* @__PURE__ */ jsx45(Text29, { fontSize: "xs", color: "gray.600", children: "\xDAltimo erro" }),
7127
+ /* @__PURE__ */ jsx45(Text29, { color: "red.700", children: error })
7028
7128
  ] }) : null,
7029
7129
  ticket.archiveReason ? /* @__PURE__ */ jsxs29(Box28, { borderWidth: "1px", borderRadius: "md", p: 3, children: [
7030
- /* @__PURE__ */ jsx44(Text29, { fontSize: "xs", color: "gray.500", children: "Motivo do arquivamento" }),
7031
- /* @__PURE__ */ jsx44(Text29, { children: ticket.archiveReason })
7130
+ /* @__PURE__ */ jsx45(Text29, { fontSize: "xs", color: "gray.500", children: "Motivo do arquivamento" }),
7131
+ /* @__PURE__ */ jsx45(Text29, { children: ticket.archiveReason })
7032
7132
  ] }) : null,
7033
- /* @__PURE__ */ jsx44(JsonDetails, { label: "Payload sanitizado", value: ticket.payload }),
7034
- /* @__PURE__ */ jsx44(JsonDetails, { label: "Resposta sanitizada", value: ticket.responseSummary }),
7035
- /* @__PURE__ */ jsx44(JsonDetails, { label: "Erro sanitizado", value: ticket.lastError })
7133
+ /* @__PURE__ */ jsx45(JsonDetails, { label: "Payload sanitizado", value: ticket.payload }),
7134
+ /* @__PURE__ */ jsx45(JsonDetails, { label: "Resposta sanitizada", value: ticket.responseSummary }),
7135
+ /* @__PURE__ */ jsx45(JsonDetails, { label: "Erro sanitizado", value: ticket.lastError })
7036
7136
  ] });
7037
7137
  }
7038
7138
  function canReprocess(status) {
@@ -7049,8 +7149,8 @@ function TicketActions({
7049
7149
  }) {
7050
7150
  const pending = mutation.isPending && mutation.variables?.id === ticket._id;
7051
7151
  return /* @__PURE__ */ jsxs29(Flex20, { gap: 2, wrap: "wrap", justify: "flex-end", children: [
7052
- /* @__PURE__ */ jsx44(Button20, { size: "xs", variant: "outline", onClick: onToggle, "aria-expanded": expanded, children: expanded ? "Ocultar" : "Detalhes" }),
7053
- canReprocess(ticket.status) ? /* @__PURE__ */ jsx44(
7152
+ /* @__PURE__ */ jsx45(Button20, { size: "xs", variant: "outline", onClick: onToggle, "aria-expanded": expanded, children: expanded ? "Ocultar" : "Detalhes" }),
7153
+ canReprocess(ticket.status) ? /* @__PURE__ */ jsx45(
7054
7154
  Button20,
7055
7155
  {
7056
7156
  size: "xs",
@@ -7060,7 +7160,7 @@ function TicketActions({
7060
7160
  children: "Reprocessar"
7061
7161
  }
7062
7162
  ) : null,
7063
- canArchive(ticket.status) ? /* @__PURE__ */ jsx44(
7163
+ canArchive(ticket.status) ? /* @__PURE__ */ jsx45(
7064
7164
  Button20,
7065
7165
  {
7066
7166
  size: "xs",
@@ -7087,9 +7187,9 @@ function TicketCard({
7087
7187
  "#",
7088
7188
  shortId(ticket._id)
7089
7189
  ] }),
7090
- /* @__PURE__ */ jsx44(Text29, { fontWeight: "semibold", wordBreak: "break-word", children: ticket.handler })
7190
+ /* @__PURE__ */ jsx45(Text29, { fontWeight: "semibold", wordBreak: "break-word", children: ticket.handler })
7091
7191
  ] }),
7092
- /* @__PURE__ */ jsx44(Badge7, { colorPalette: statusPalette2(ticket.status), children: ticket.status })
7192
+ /* @__PURE__ */ jsx45(Badge7, { colorPalette: statusPalette2(ticket.status), children: ticket.status })
7093
7193
  ] }),
7094
7194
  /* @__PURE__ */ jsxs29(Text29, { fontSize: "sm", color: "gray.600", mt: 2, children: [
7095
7195
  ticket.resource || "sem recurso",
@@ -7110,19 +7210,19 @@ function TicketCard({
7110
7210
  dateTime3(ticket.createdAt)
7111
7211
  ] })
7112
7212
  ] }),
7113
- error ? /* @__PURE__ */ jsx44(Text29, { fontSize: "xs", color: "red.600", mt: 2, children: error }) : null,
7114
- /* @__PURE__ */ jsx44(Box28, { mt: 3, children: /* @__PURE__ */ jsx44(TicketActions, { ticket, mutation, onToggle, expanded }) }),
7115
- expanded ? /* @__PURE__ */ jsx44(TicketDetails, { ticket }) : null
7213
+ error ? /* @__PURE__ */ jsx45(Text29, { fontSize: "xs", color: "red.600", mt: 2, children: error }) : null,
7214
+ /* @__PURE__ */ jsx45(Box28, { mt: 3, children: /* @__PURE__ */ jsx45(TicketActions, { ticket, mutation, onToggle, expanded }) }),
7215
+ expanded ? /* @__PURE__ */ jsx45(TicketDetails, { ticket }) : null
7116
7216
  ] });
7117
7217
  }
7118
7218
  function CoreIntegrationTickets({ provider = "omie" }) {
7119
7219
  const { http } = useOonApi();
7120
- const [view, setView] = useState19("list");
7121
- const [status, setStatus] = useState19("");
7122
- const [searchInput, setSearchInput] = useState19("");
7123
- const [search, setSearch] = useState19("");
7124
- const [page, setPage] = useState19(1);
7125
- const [expandedId, setExpandedId] = useState19(null);
7220
+ const [view, setView] = useState20("list");
7221
+ const [status, setStatus] = useState20("");
7222
+ const [searchInput, setSearchInput] = useState20("");
7223
+ const [search, setSearch] = useState20("");
7224
+ const [page, setPage] = useState20(1);
7225
+ const [expandedId, setExpandedId] = useState20(null);
7126
7226
  const limit = view === "board" ? 200 : 25;
7127
7227
  useEffect12(() => {
7128
7228
  const timeout = window.setTimeout(() => {
@@ -7172,11 +7272,11 @@ function CoreIntegrationTickets({ provider = "omie" }) {
7172
7272
  if (page > totalPages2) setPage(Math.max(1, totalPages2));
7173
7273
  }, [page, queue.data?.pagination?.totalPages]);
7174
7274
  const tickets = queue.data?.results ?? [];
7175
- const grouped = useMemo10(() => Object.fromEntries(
7275
+ const grouped = useMemo11(() => Object.fromEntries(
7176
7276
  TICKET_STATUSES.map((ticketStatus) => [ticketStatus, tickets.filter((ticket) => ticket.status === ticketStatus)])
7177
7277
  ), [tickets]);
7178
- if (queue.isLoading) return /* @__PURE__ */ jsx44(LoadingScreen, {});
7179
- if (queue.error && !queue.data) return /* @__PURE__ */ jsx44(ErrorState, { error: queue.error });
7278
+ if (queue.isLoading) return /* @__PURE__ */ jsx45(LoadingScreen, {});
7279
+ if (queue.error && !queue.data) return /* @__PURE__ */ jsx45(ErrorState, { error: queue.error });
7180
7280
  const pagination = queue.data?.pagination;
7181
7281
  const totalPages = Math.max(1, pagination?.totalPages ?? 1);
7182
7282
  const totalItems = pagination?.totalItems ?? 0;
@@ -7185,19 +7285,19 @@ function CoreIntegrationTickets({ provider = "omie" }) {
7185
7285
  return /* @__PURE__ */ jsxs29(Stack11, { gap: 5, children: [
7186
7286
  /* @__PURE__ */ jsxs29(Flex20, { align: "start", justify: "space-between", gap: 3, wrap: "wrap", children: [
7187
7287
  /* @__PURE__ */ jsxs29(Box28, { children: [
7188
- /* @__PURE__ */ jsx44(Heading17, { size: "md", children: "Tickets de integra\xE7\xE3o" }),
7189
- /* @__PURE__ */ jsx44(Text29, { color: "gray.500", children: "Acompanhe cada opera\xE7\xE3o da fila, seus par\xE2metros sanitizados, tentativas, erros e resultado." })
7288
+ /* @__PURE__ */ jsx45(Heading17, { size: "md", children: "Tickets de integra\xE7\xE3o" }),
7289
+ /* @__PURE__ */ jsx45(Text29, { color: "gray.500", children: "Acompanhe cada opera\xE7\xE3o da fila, seus par\xE2metros sanitizados, tentativas, erros e resultado." })
7190
7290
  ] }),
7191
7291
  /* @__PURE__ */ jsxs29(Flex20, { gap: 2, children: [
7192
- /* @__PURE__ */ jsx44(Button20, { size: "sm", variant: view === "list" ? "solid" : "outline", onClick: () => {
7292
+ /* @__PURE__ */ jsx45(Button20, { size: "sm", variant: view === "list" ? "solid" : "outline", onClick: () => {
7193
7293
  setView("list");
7194
7294
  setPage(1);
7195
7295
  }, children: "Lista" }),
7196
- /* @__PURE__ */ jsx44(Button20, { size: "sm", variant: view === "board" ? "solid" : "outline", onClick: () => {
7296
+ /* @__PURE__ */ jsx45(Button20, { size: "sm", variant: view === "board" ? "solid" : "outline", onClick: () => {
7197
7297
  setView("board");
7198
7298
  setPage(1);
7199
7299
  }, children: "Quadro" }),
7200
- /* @__PURE__ */ jsx44(
7300
+ /* @__PURE__ */ jsx45(
7201
7301
  Button20,
7202
7302
  {
7203
7303
  size: "sm",
@@ -7208,12 +7308,12 @@ function CoreIntegrationTickets({ provider = "omie" }) {
7208
7308
  children: "Processar pendentes"
7209
7309
  }
7210
7310
  ),
7211
- /* @__PURE__ */ jsx44(Button20, { size: "sm", variant: "outline", loading: queue.isFetching, onClick: () => queue.refetch(), children: "Atualizar" })
7311
+ /* @__PURE__ */ jsx45(Button20, { size: "sm", variant: "outline", loading: queue.isFetching, onClick: () => queue.refetch(), children: "Atualizar" })
7212
7312
  ] })
7213
7313
  ] }),
7214
7314
  /* @__PURE__ */ jsxs29(Box28, { borderWidth: "1px", borderRadius: "md", p: 3, children: [
7215
7315
  /* @__PURE__ */ jsxs29(Flex20, { gap: 3, align: "center", wrap: "wrap", children: [
7216
- /* @__PURE__ */ jsx44(
7316
+ /* @__PURE__ */ jsx45(
7217
7317
  Input12,
7218
7318
  {
7219
7319
  size: "sm",
@@ -7234,8 +7334,8 @@ function CoreIntegrationTickets({ provider = "omie" }) {
7234
7334
  setPage(1);
7235
7335
  },
7236
7336
  children: [
7237
- /* @__PURE__ */ jsx44("option", { value: "", children: "Todos os status" }),
7238
- TICKET_STATUSES.map((ticketStatus) => /* @__PURE__ */ jsx44("option", { value: ticketStatus, children: ticketStatus }, ticketStatus))
7337
+ /* @__PURE__ */ jsx45("option", { value: "", children: "Todos os status" }),
7338
+ TICKET_STATUSES.map((ticketStatus) => /* @__PURE__ */ jsx45("option", { value: ticketStatus, children: ticketStatus }, ticketStatus))
7239
7339
  ]
7240
7340
  }
7241
7341
  ),
@@ -7244,7 +7344,7 @@ function CoreIntegrationTickets({ provider = "omie" }) {
7244
7344
  " ticket(s)"
7245
7345
  ] })
7246
7346
  ] }),
7247
- /* @__PURE__ */ jsx44(Flex20, { gap: 2, wrap: "wrap", mt: 3, children: TICKET_STATUSES.map((ticketStatus) => /* @__PURE__ */ jsxs29(
7347
+ /* @__PURE__ */ jsx45(Flex20, { gap: 2, wrap: "wrap", mt: 3, children: TICKET_STATUSES.map((ticketStatus) => /* @__PURE__ */ jsxs29(
7248
7348
  Button20,
7249
7349
  {
7250
7350
  size: "xs",
@@ -7263,8 +7363,8 @@ function CoreIntegrationTickets({ provider = "omie" }) {
7263
7363
  ticketStatus
7264
7364
  )) })
7265
7365
  ] }),
7266
- view === "list" ? /* @__PURE__ */ jsx44(Box28, { borderWidth: "1px", borderRadius: "md", overflowX: "auto", children: /* @__PURE__ */ jsxs29(Box28, { minW: "1080px", children: [
7267
- /* @__PURE__ */ jsx44(
7366
+ view === "list" ? /* @__PURE__ */ jsx45(Box28, { borderWidth: "1px", borderRadius: "md", overflowX: "auto", children: /* @__PURE__ */ jsxs29(Box28, { minW: "1080px", children: [
7367
+ /* @__PURE__ */ jsx45(
7268
7368
  Box28,
7269
7369
  {
7270
7370
  display: "grid",
@@ -7274,7 +7374,7 @@ function CoreIntegrationTickets({ provider = "omie" }) {
7274
7374
  py: 2,
7275
7375
  bg: "gray.50",
7276
7376
  borderBottomWidth: "1px",
7277
- children: ["Ticket", "Opera\xE7\xE3o", "Agregado", "Tentativas", "Datas", "Status", "A\xE7\xF5es"].map((label) => /* @__PURE__ */ jsx44(Text29, { fontSize: "xs", fontWeight: "semibold", color: "gray.600", children: label }, label))
7377
+ children: ["Ticket", "Opera\xE7\xE3o", "Agregado", "Tentativas", "Datas", "Status", "A\xE7\xF5es"].map((label) => /* @__PURE__ */ jsx45(Text29, { fontSize: "xs", fontWeight: "semibold", color: "gray.600", children: label }, label))
7278
7378
  }
7279
7379
  ),
7280
7380
  tickets.length ? tickets.map((ticket) => {
@@ -7294,23 +7394,23 @@ function CoreIntegrationTickets({ provider = "omie" }) {
7294
7394
  "#",
7295
7395
  shortId(ticket._id)
7296
7396
  ] }),
7297
- /* @__PURE__ */ jsx44(Text29, { fontSize: "xs", color: "gray.500", children: ticket.provider })
7397
+ /* @__PURE__ */ jsx45(Text29, { fontSize: "xs", color: "gray.500", children: ticket.provider })
7298
7398
  ] }),
7299
7399
  /* @__PURE__ */ jsxs29(Box28, { minW: 0, children: [
7300
- /* @__PURE__ */ jsx44(Text29, { fontSize: "sm", fontWeight: "medium", wordBreak: "break-word", children: ticket.handler }),
7400
+ /* @__PURE__ */ jsx45(Text29, { fontSize: "sm", fontWeight: "medium", wordBreak: "break-word", children: ticket.handler }),
7301
7401
  /* @__PURE__ */ jsxs29(Text29, { fontSize: "xs", color: "gray.500", children: [
7302
7402
  ticket.resource || "\u2014",
7303
7403
  " \xB7 ",
7304
7404
  ticket.operation || "execute"
7305
7405
  ] }),
7306
- error ? /* @__PURE__ */ jsx44(Text29, { fontSize: "xs", color: "red.600", mt: 1, children: error }) : null
7406
+ error ? /* @__PURE__ */ jsx45(Text29, { fontSize: "xs", color: "red.600", mt: 1, children: error }) : null
7307
7407
  ] }),
7308
7408
  /* @__PURE__ */ jsxs29(Box28, { minW: 0, children: [
7309
- /* @__PURE__ */ jsx44(Text29, { fontSize: "sm", children: ticket.aggregateType || "\u2014" }),
7310
- /* @__PURE__ */ jsx44(Text29, { fontSize: "xs", color: "gray.500", wordBreak: "break-all", children: ticket.aggregateId || "\u2014" })
7409
+ /* @__PURE__ */ jsx45(Text29, { fontSize: "sm", children: ticket.aggregateType || "\u2014" }),
7410
+ /* @__PURE__ */ jsx45(Text29, { fontSize: "xs", color: "gray.500", wordBreak: "break-all", children: ticket.aggregateId || "\u2014" })
7311
7411
  ] }),
7312
7412
  /* @__PURE__ */ jsxs29(Box28, { children: [
7313
- /* @__PURE__ */ jsx44(Text29, { fontSize: "sm", children: ticket.attempts ?? 0 }),
7413
+ /* @__PURE__ */ jsx45(Text29, { fontSize: "sm", children: ticket.attempts ?? 0 }),
7314
7414
  /* @__PURE__ */ jsxs29(Text29, { fontSize: "xs", color: "gray.500", children: [
7315
7415
  "Pr\xF3xima: ",
7316
7416
  dateTime3(ticket.nextAttemptAt)
@@ -7330,8 +7430,8 @@ function CoreIntegrationTickets({ provider = "omie" }) {
7330
7430
  dateTime3(ticket.completedAt)
7331
7431
  ] })
7332
7432
  ] }),
7333
- /* @__PURE__ */ jsx44(Badge7, { colorPalette: statusPalette2(ticket.status), width: "fit-content", children: ticket.status }),
7334
- /* @__PURE__ */ jsx44(
7433
+ /* @__PURE__ */ jsx45(Badge7, { colorPalette: statusPalette2(ticket.status), width: "fit-content", children: ticket.status }),
7434
+ /* @__PURE__ */ jsx45(
7335
7435
  TicketActions,
7336
7436
  {
7337
7437
  ticket,
@@ -7343,15 +7443,15 @@ function CoreIntegrationTickets({ provider = "omie" }) {
7343
7443
  ]
7344
7444
  }
7345
7445
  ),
7346
- expanded ? /* @__PURE__ */ jsx44(TicketDetails, { ticket }) : null
7446
+ expanded ? /* @__PURE__ */ jsx45(TicketDetails, { ticket }) : null
7347
7447
  ] }, ticket._id);
7348
- }) : /* @__PURE__ */ jsx44(Text29, { p: 5, color: "gray.400", children: "Nenhum ticket encontrado com os filtros informados." })
7349
- ] }) }) : /* @__PURE__ */ jsx44(Box28, { overflowX: "auto", pb: 2, children: /* @__PURE__ */ jsx44(Flex20, { align: "start", gap: 3, minW: `${TICKET_STATUSES.length * 290}px`, children: TICKET_STATUSES.map((ticketStatus) => /* @__PURE__ */ jsxs29(Box28, { width: "280px", flex: "0 0 280px", bg: "gray.50", borderRadius: "md", p: 2, children: [
7448
+ }) : /* @__PURE__ */ jsx45(Text29, { p: 5, color: "gray.400", children: "Nenhum ticket encontrado com os filtros informados." })
7449
+ ] }) }) : /* @__PURE__ */ jsx45(Box28, { overflowX: "auto", pb: 2, children: /* @__PURE__ */ jsx45(Flex20, { align: "start", gap: 3, minW: `${TICKET_STATUSES.length * 290}px`, children: TICKET_STATUSES.map((ticketStatus) => /* @__PURE__ */ jsxs29(Box28, { width: "280px", flex: "0 0 280px", bg: "gray.50", borderRadius: "md", p: 2, children: [
7350
7450
  /* @__PURE__ */ jsxs29(Flex20, { align: "center", justify: "space-between", mb: 2, children: [
7351
- /* @__PURE__ */ jsx44(Badge7, { colorPalette: statusPalette2(ticketStatus), children: ticketStatus }),
7352
- /* @__PURE__ */ jsx44(Text29, { fontSize: "xs", color: "gray.500", children: statuses[ticketStatus] ?? 0 })
7451
+ /* @__PURE__ */ jsx45(Badge7, { colorPalette: statusPalette2(ticketStatus), children: ticketStatus }),
7452
+ /* @__PURE__ */ jsx45(Text29, { fontSize: "xs", color: "gray.500", children: statuses[ticketStatus] ?? 0 })
7353
7453
  ] }),
7354
- /* @__PURE__ */ jsx44(Stack11, { gap: 2, children: grouped[ticketStatus].length ? grouped[ticketStatus].map((ticket) => /* @__PURE__ */ jsx44(
7454
+ /* @__PURE__ */ jsx45(Stack11, { gap: 2, children: grouped[ticketStatus].length ? grouped[ticketStatus].map((ticket) => /* @__PURE__ */ jsx45(
7355
7455
  TicketCard,
7356
7456
  {
7357
7457
  ticket,
@@ -7360,7 +7460,7 @@ function CoreIntegrationTickets({ provider = "omie" }) {
7360
7460
  onToggle: () => setExpandedId((current) => current === ticket._id ? null : ticket._id)
7361
7461
  },
7362
7462
  ticket._id
7363
- )) : /* @__PURE__ */ jsx44(Text29, { fontSize: "xs", color: "gray.400", p: 2, children: "Nenhum ticket nesta p\xE1gina." }) })
7463
+ )) : /* @__PURE__ */ jsx45(Text29, { fontSize: "xs", color: "gray.400", p: 2, children: "Nenhum ticket nesta p\xE1gina." }) })
7364
7464
  ] }, ticketStatus)) }) }),
7365
7465
  /* @__PURE__ */ jsxs29(Flex20, { align: "center", justify: "space-between", gap: 3, wrap: "wrap", children: [
7366
7466
  /* @__PURE__ */ jsxs29(Text29, { fontSize: "sm", color: "gray.500", children: [
@@ -7374,23 +7474,23 @@ function CoreIntegrationTickets({ provider = "omie" }) {
7374
7474
  view === "board" && totalItems > limit ? " \xB7 o quadro \xE9 paginado" : ""
7375
7475
  ] }),
7376
7476
  /* @__PURE__ */ jsxs29(Flex20, { gap: 2, children: [
7377
- /* @__PURE__ */ jsx44(Button20, { size: "sm", variant: "outline", disabled: page <= 1, onClick: () => setPage((current) => Math.max(1, current - 1)), children: "Anterior" }),
7378
- /* @__PURE__ */ jsx44(Button20, { size: "sm", variant: "outline", disabled: page >= totalPages, onClick: () => setPage((current) => Math.min(totalPages, current + 1)), children: "Pr\xF3xima" })
7477
+ /* @__PURE__ */ jsx45(Button20, { size: "sm", variant: "outline", disabled: page <= 1, onClick: () => setPage((current) => Math.max(1, current - 1)), children: "Anterior" }),
7478
+ /* @__PURE__ */ jsx45(Button20, { size: "sm", variant: "outline", disabled: page >= totalPages, onClick: () => setPage((current) => Math.min(totalPages, current + 1)), children: "Pr\xF3xima" })
7379
7479
  ] })
7380
7480
  ] }),
7381
- operationError ? /* @__PURE__ */ jsx44(Text29, { color: "red.600", children: integrationErrorMessage2(operationError) }) : null
7481
+ operationError ? /* @__PURE__ */ jsx45(Text29, { color: "red.600", children: integrationErrorMessage2(operationError) }) : null
7382
7482
  ] });
7383
7483
  }
7384
7484
 
7385
7485
  // src/components/CoreOmieIntegrationWorkspace.tsx
7386
- import { useState as useState21 } from "react";
7486
+ import { useState as useState22 } from "react";
7387
7487
  import { Button as Button22, Flex as Flex22, Stack as Stack13 } from "@chakra-ui/react";
7388
7488
 
7389
7489
  // src/components/CoreOmieIntegration.tsx
7390
- import { useEffect as useEffect13, useState as useState20 } from "react";
7490
+ import { useEffect as useEffect13, useState as useState21 } from "react";
7391
7491
  import { Badge as Badge8, Box as Box29, Button as Button21, Flex as Flex21, Heading as Heading18, Input as Input13, Stack as Stack12, Text as Text30 } from "@chakra-ui/react";
7392
7492
  import { useMutation as useMutation7, useQuery as useQuery13 } from "@tanstack/react-query";
7393
- import { jsx as jsx45, jsxs as jsxs30 } from "react/jsx-runtime";
7493
+ import { jsx as jsx46, jsxs as jsxs30 } from "react/jsx-runtime";
7394
7494
  function dateTime4(value2) {
7395
7495
  if (!value2) return "\u2014";
7396
7496
  const date = new Date(value2);
@@ -7436,7 +7536,7 @@ function NativeSelect6({
7436
7536
  onChange,
7437
7537
  children
7438
7538
  }) {
7439
- return /* @__PURE__ */ jsx45(
7539
+ return /* @__PURE__ */ jsx46(
7440
7540
  "select",
7441
7541
  {
7442
7542
  style: {
@@ -7459,7 +7559,7 @@ function OmieConfigurationTab() {
7459
7559
  queryKey: ["core-omie", "configuration"],
7460
7560
  queryFn: async () => (await http.get("/integrations/providers/omie/configuration")).data?.instances ?? []
7461
7561
  });
7462
- const [draft, setDraft] = useState20({
7562
+ const [draft, setDraft] = useState21({
7463
7563
  instanceId: "default",
7464
7564
  label: "Omie",
7465
7565
  active: true,
@@ -7508,29 +7608,29 @@ function OmieConfigurationTab() {
7508
7608
  ),
7509
7609
  onSuccess: () => configuration.refetch()
7510
7610
  });
7511
- if (configuration.isLoading) return /* @__PURE__ */ jsx45(LoadingScreen, {});
7512
- if (configuration.error) return /* @__PURE__ */ jsx45(ErrorState, { error: configuration.error });
7611
+ if (configuration.isLoading) return /* @__PURE__ */ jsx46(LoadingScreen, {});
7612
+ if (configuration.error) return /* @__PURE__ */ jsx46(ErrorState, { error: configuration.error });
7513
7613
  const error = save.error || testConnection.error;
7514
7614
  return /* @__PURE__ */ jsxs30(Stack12, { gap: 4, children: [
7515
7615
  /* @__PURE__ */ jsxs30(Box29, { children: [
7516
- /* @__PURE__ */ jsx45(Heading18, { size: "md", children: "Configura\xE7\xF5es" }),
7517
- /* @__PURE__ */ jsx45(Text30, { color: "gray.500", children: "Credenciais protegidas por inst\xE2ncia. O token do webhook \xE9 gerado e administrado automaticamente." })
7616
+ /* @__PURE__ */ jsx46(Heading18, { size: "md", children: "Configura\xE7\xF5es" }),
7617
+ /* @__PURE__ */ jsx46(Text30, { color: "gray.500", children: "Credenciais protegidas por inst\xE2ncia. O token do webhook \xE9 gerado e administrado automaticamente." })
7518
7618
  ] }),
7519
7619
  /* @__PURE__ */ jsxs30(Flex21, { gap: 3, wrap: "wrap", children: [
7520
7620
  /* @__PURE__ */ jsxs30(Box29, { minW: "180px", flex: "1", children: [
7521
- /* @__PURE__ */ jsx45(Text30, { fontSize: "xs", color: "gray.500", mb: 1, children: "Inst\xE2ncia" }),
7522
- /* @__PURE__ */ jsx45(
7621
+ /* @__PURE__ */ jsx46(Text30, { fontSize: "xs", color: "gray.500", mb: 1, children: "Inst\xE2ncia" }),
7622
+ /* @__PURE__ */ jsx46(
7523
7623
  NativeSelect6,
7524
7624
  {
7525
7625
  value: draft.instanceId,
7526
7626
  onChange: (instanceId) => setDraft((current) => ({ ...current, instanceId })),
7527
- children: (configuration.data ?? []).map((instance) => /* @__PURE__ */ jsx45("option", { value: instance.instanceId, children: instance.label || instance.instanceId }, instance.instanceId))
7627
+ children: (configuration.data ?? []).map((instance) => /* @__PURE__ */ jsx46("option", { value: instance.instanceId, children: instance.label || instance.instanceId }, instance.instanceId))
7528
7628
  }
7529
7629
  )
7530
7630
  ] }),
7531
7631
  /* @__PURE__ */ jsxs30(Box29, { minW: "240px", flex: "2", children: [
7532
- /* @__PURE__ */ jsx45(Text30, { fontSize: "xs", color: "gray.500", mb: 1, children: "Nome" }),
7533
- /* @__PURE__ */ jsx45(
7632
+ /* @__PURE__ */ jsx46(Text30, { fontSize: "xs", color: "gray.500", mb: 1, children: "Nome" }),
7633
+ /* @__PURE__ */ jsx46(
7534
7634
  Input13,
7535
7635
  {
7536
7636
  size: "sm",
@@ -7540,23 +7640,23 @@ function OmieConfigurationTab() {
7540
7640
  )
7541
7641
  ] }),
7542
7642
  /* @__PURE__ */ jsxs30(Box29, { minW: "180px", flex: "1", children: [
7543
- /* @__PURE__ */ jsx45(Text30, { fontSize: "xs", color: "gray.500", mb: 1, children: "Ambiente" }),
7643
+ /* @__PURE__ */ jsx46(Text30, { fontSize: "xs", color: "gray.500", mb: 1, children: "Ambiente" }),
7544
7644
  /* @__PURE__ */ jsxs30(
7545
7645
  NativeSelect6,
7546
7646
  {
7547
7647
  value: draft.environment,
7548
7648
  onChange: (environment) => setDraft((current) => ({ ...current, environment })),
7549
7649
  children: [
7550
- /* @__PURE__ */ jsx45("option", { value: "production", children: "Produ\xE7\xE3o" }),
7551
- /* @__PURE__ */ jsx45("option", { value: "homologation", children: "Homologa\xE7\xE3o" })
7650
+ /* @__PURE__ */ jsx46("option", { value: "production", children: "Produ\xE7\xE3o" }),
7651
+ /* @__PURE__ */ jsx46("option", { value: "homologation", children: "Homologa\xE7\xE3o" })
7552
7652
  ]
7553
7653
  }
7554
7654
  )
7555
7655
  ] })
7556
7656
  ] }),
7557
7657
  /* @__PURE__ */ jsxs30(Box29, { children: [
7558
- /* @__PURE__ */ jsx45(Text30, { fontSize: "xs", color: "gray.500", mb: 1, children: "URL base" }),
7559
- /* @__PURE__ */ jsx45(
7658
+ /* @__PURE__ */ jsx46(Text30, { fontSize: "xs", color: "gray.500", mb: 1, children: "URL base" }),
7659
+ /* @__PURE__ */ jsx46(
7560
7660
  Input13,
7561
7661
  {
7562
7662
  size: "sm",
@@ -7571,7 +7671,7 @@ function OmieConfigurationTab() {
7571
7671
  "App Key ",
7572
7672
  selected?.appKeyMasked ? `(${selected.appKeyMasked})` : ""
7573
7673
  ] }),
7574
- /* @__PURE__ */ jsx45(
7674
+ /* @__PURE__ */ jsx46(
7575
7675
  Input13,
7576
7676
  {
7577
7677
  size: "sm",
@@ -7583,8 +7683,8 @@ function OmieConfigurationTab() {
7583
7683
  )
7584
7684
  ] }),
7585
7685
  /* @__PURE__ */ jsxs30(Box29, { minW: "260px", flex: "1", children: [
7586
- /* @__PURE__ */ jsx45(Text30, { fontSize: "xs", color: "gray.500", mb: 1, children: "App Secret" }),
7587
- /* @__PURE__ */ jsx45(
7686
+ /* @__PURE__ */ jsx46(Text30, { fontSize: "xs", color: "gray.500", mb: 1, children: "App Secret" }),
7687
+ /* @__PURE__ */ jsx46(
7588
7688
  Input13,
7589
7689
  {
7590
7690
  size: "sm",
@@ -7599,7 +7699,7 @@ function OmieConfigurationTab() {
7599
7699
  /* @__PURE__ */ jsxs30(Flex21, { align: "center", justify: "space-between", gap: 3, wrap: "wrap", children: [
7600
7700
  /* @__PURE__ */ jsxs30(Flex21, { align: "center", gap: 2, wrap: "wrap", children: [
7601
7701
  /* @__PURE__ */ jsxs30("label", { children: [
7602
- /* @__PURE__ */ jsx45(
7702
+ /* @__PURE__ */ jsx46(
7603
7703
  "input",
7604
7704
  {
7605
7705
  type: "checkbox",
@@ -7624,7 +7724,7 @@ function OmieConfigurationTab() {
7624
7724
  ] })
7625
7725
  ] }),
7626
7726
  /* @__PURE__ */ jsxs30(Flex21, { gap: 2, children: [
7627
- /* @__PURE__ */ jsx45(
7727
+ /* @__PURE__ */ jsx46(
7628
7728
  Button21,
7629
7729
  {
7630
7730
  size: "sm",
@@ -7634,11 +7734,11 @@ function OmieConfigurationTab() {
7634
7734
  children: "Testar conex\xE3o"
7635
7735
  }
7636
7736
  ),
7637
- /* @__PURE__ */ jsx45(Button21, { size: "sm", loading: save.isPending, onClick: () => save.mutate(), children: "Salvar configura\xE7\xF5es" })
7737
+ /* @__PURE__ */ jsx46(Button21, { size: "sm", loading: save.isPending, onClick: () => save.mutate(), children: "Salvar configura\xE7\xF5es" })
7638
7738
  ] })
7639
7739
  ] }),
7640
- selected?.lastConnectionError ? /* @__PURE__ */ jsx45(Text30, { color: "red.600", children: selected.lastConnectionError }) : null,
7641
- error ? /* @__PURE__ */ jsx45(Text30, { color: "red.600", children: integrationErrorMessage3(error) }) : null
7740
+ selected?.lastConnectionError ? /* @__PURE__ */ jsx46(Text30, { color: "red.600", children: selected.lastConnectionError }) : null,
7741
+ error ? /* @__PURE__ */ jsx46(Text30, { color: "red.600", children: integrationErrorMessage3(error) }) : null
7642
7742
  ] });
7643
7743
  }
7644
7744
  function OmieSynchronizationTab() {
@@ -7685,24 +7785,24 @@ function OmieSynchronizationTab() {
7685
7785
  ),
7686
7786
  onSuccess: refresh
7687
7787
  });
7688
- if (health.isLoading || mappings.isLoading || queue.isLoading) return /* @__PURE__ */ jsx45(LoadingScreen, {});
7788
+ if (health.isLoading || mappings.isLoading || queue.isLoading) return /* @__PURE__ */ jsx46(LoadingScreen, {});
7689
7789
  const error = health.error || mappings.error || queue.error || syncAll.error || syncResource.error || process.error;
7690
- if ((health.error || mappings.error || queue.error) && !health.data) return /* @__PURE__ */ jsx45(ErrorState, { error });
7790
+ if ((health.error || mappings.error || queue.error) && !health.data) return /* @__PURE__ */ jsx46(ErrorState, { error });
7691
7791
  const provider = health.data;
7692
7792
  return /* @__PURE__ */ jsxs30(Stack12, { gap: 5, children: [
7693
7793
  /* @__PURE__ */ jsxs30(Flex21, { align: "start", justify: "space-between", gap: 3, wrap: "wrap", children: [
7694
7794
  /* @__PURE__ */ jsxs30(Box29, { children: [
7695
- /* @__PURE__ */ jsx45(Heading18, { size: "md", children: "Sincroniza\xE7\xE3o" }),
7696
- /* @__PURE__ */ jsx45(Text30, { color: "gray.500", children: "Execute listas declaradas e acompanhe o processamento da fila Omie." })
7795
+ /* @__PURE__ */ jsx46(Heading18, { size: "md", children: "Sincroniza\xE7\xE3o" }),
7796
+ /* @__PURE__ */ jsx46(Text30, { color: "gray.500", children: "Execute listas declaradas e acompanhe o processamento da fila Omie." })
7697
7797
  ] }),
7698
7798
  /* @__PURE__ */ jsxs30(Flex21, { gap: 2, children: [
7699
- /* @__PURE__ */ jsx45(Button21, { size: "sm", variant: "outline", loading: process.isPending, onClick: () => process.mutate(), children: "Processar pend\xEAncias" }),
7700
- /* @__PURE__ */ jsx45(Button21, { size: "sm", loading: syncAll.isPending, onClick: () => syncAll.mutate(), children: "Sincronizar tudo" })
7799
+ /* @__PURE__ */ jsx46(Button21, { size: "sm", variant: "outline", loading: process.isPending, onClick: () => process.mutate(), children: "Processar pend\xEAncias" }),
7800
+ /* @__PURE__ */ jsx46(Button21, { size: "sm", loading: syncAll.isPending, onClick: () => syncAll.mutate(), children: "Sincronizar tudo" })
7701
7801
  ] })
7702
7802
  ] }),
7703
7803
  provider ? /* @__PURE__ */ jsxs30(Box29, { borderWidth: "1px", borderRadius: "md", p: 4, children: [
7704
7804
  /* @__PURE__ */ jsxs30(Flex21, { gap: 2, wrap: "wrap", mb: 3, children: [
7705
- /* @__PURE__ */ jsx45(Badge8, { colorPalette: statusPalette3(provider.status), children: provider.status || "\u2014" }),
7805
+ /* @__PURE__ */ jsx46(Badge8, { colorPalette: statusPalette3(provider.status), children: provider.status || "\u2014" }),
7706
7806
  /* @__PURE__ */ jsxs30(Badge8, { colorPalette: countActive2(provider.queue) ? "yellow" : "green", children: [
7707
7807
  "Fila ativa: ",
7708
7808
  countActive2(provider.queue)
@@ -7720,7 +7820,7 @@ function OmieSynchronizationTab() {
7720
7820
  "Pend\xEAncia mais antiga: ",
7721
7821
  dateTime4(provider.oldestPendingAt)
7722
7822
  ] }),
7723
- /* @__PURE__ */ jsx45(Flex21, { gap: 2, wrap: "wrap", children: (provider.resources ?? []).map((resource) => /* @__PURE__ */ jsx45(
7823
+ /* @__PURE__ */ jsx46(Flex21, { gap: 2, wrap: "wrap", children: (provider.resources ?? []).map((resource) => /* @__PURE__ */ jsx46(
7724
7824
  Button21,
7725
7825
  {
7726
7826
  size: "sm",
@@ -7731,14 +7831,14 @@ function OmieSynchronizationTab() {
7731
7831
  },
7732
7832
  resource.key
7733
7833
  )) })
7734
- ] }) : /* @__PURE__ */ jsx45(Text30, { color: "gray.500", children: "Provider Omie n\xE3o registrado." }),
7834
+ ] }) : /* @__PURE__ */ jsx46(Text30, { color: "gray.500", children: "Provider Omie n\xE3o registrado." }),
7735
7835
  /* @__PURE__ */ jsxs30(Box29, { children: [
7736
- /* @__PURE__ */ jsx45(Heading18, { size: "sm", mb: 3, children: "Listas declaradas" }),
7737
- /* @__PURE__ */ jsx45(Stack12, { gap: 2, children: (mappings.data?.lists ?? []).map((list) => {
7836
+ /* @__PURE__ */ jsx46(Heading18, { size: "sm", mb: 3, children: "Listas declaradas" }),
7837
+ /* @__PURE__ */ jsx46(Stack12, { gap: 2, children: (mappings.data?.lists ?? []).map((list) => {
7738
7838
  const latest = list.executions?.[0];
7739
- return /* @__PURE__ */ jsx45(Box29, { borderWidth: "1px", borderRadius: "md", p: 3, children: /* @__PURE__ */ jsxs30(Flex21, { align: "center", justify: "space-between", gap: 3, wrap: "wrap", children: [
7839
+ return /* @__PURE__ */ jsx46(Box29, { borderWidth: "1px", borderRadius: "md", p: 3, children: /* @__PURE__ */ jsxs30(Flex21, { align: "center", justify: "space-between", gap: 3, wrap: "wrap", children: [
7740
7840
  /* @__PURE__ */ jsxs30(Box29, { children: [
7741
- /* @__PURE__ */ jsx45(Text30, { fontWeight: "semibold", children: list.label || list.key }),
7841
+ /* @__PURE__ */ jsx46(Text30, { fontWeight: "semibold", children: list.label || list.key }),
7742
7842
  /* @__PURE__ */ jsxs30(Text30, { fontSize: "sm", color: "gray.500", children: [
7743
7843
  list.mode || "modo padr\xE3o",
7744
7844
  " \xB7 ",
@@ -7748,17 +7848,17 @@ function OmieSynchronizationTab() {
7748
7848
  ] })
7749
7849
  ] }),
7750
7850
  /* @__PURE__ */ jsxs30(Flex21, { gap: 2, wrap: "wrap", children: [
7751
- /* @__PURE__ */ jsx45(Badge8, { colorPalette: statusPalette3(latest?.status), children: latest?.status || "n\xE3o executada" }),
7752
- /* @__PURE__ */ jsx45(Badge8, { variant: "outline", children: dateTime4(latest?.lastCompletedAt) })
7851
+ /* @__PURE__ */ jsx46(Badge8, { colorPalette: statusPalette3(latest?.status), children: latest?.status || "n\xE3o executada" }),
7852
+ /* @__PURE__ */ jsx46(Badge8, { variant: "outline", children: dateTime4(latest?.lastCompletedAt) })
7753
7853
  ] })
7754
7854
  ] }) }, list.key);
7755
7855
  }) })
7756
7856
  ] }),
7757
7857
  /* @__PURE__ */ jsxs30(Box29, { children: [
7758
- /* @__PURE__ */ jsx45(Heading18, { size: "sm", mb: 3, children: "Fila recente" }),
7759
- /* @__PURE__ */ jsx45(Stack12, { gap: 2, children: (queue.data ?? []).length ? queue.data?.map((ticket) => /* @__PURE__ */ jsx45(Box29, { borderWidth: "1px", borderRadius: "md", p: 3, children: /* @__PURE__ */ jsxs30(Flex21, { align: "center", justify: "space-between", gap: 3, wrap: "wrap", children: [
7858
+ /* @__PURE__ */ jsx46(Heading18, { size: "sm", mb: 3, children: "Fila recente" }),
7859
+ /* @__PURE__ */ jsx46(Stack12, { gap: 2, children: (queue.data ?? []).length ? queue.data?.map((ticket) => /* @__PURE__ */ jsx46(Box29, { borderWidth: "1px", borderRadius: "md", p: 3, children: /* @__PURE__ */ jsxs30(Flex21, { align: "center", justify: "space-between", gap: 3, wrap: "wrap", children: [
7760
7860
  /* @__PURE__ */ jsxs30(Box29, { children: [
7761
- /* @__PURE__ */ jsx45(Text30, { fontWeight: "medium", children: ticket.handler }),
7861
+ /* @__PURE__ */ jsx46(Text30, { fontWeight: "medium", children: ticket.handler }),
7762
7862
  /* @__PURE__ */ jsxs30(Text30, { fontSize: "sm", color: "gray.500", children: [
7763
7863
  ticket.resource || "sem recurso",
7764
7864
  " \xB7 tentativas ",
@@ -7766,18 +7866,18 @@ function OmieSynchronizationTab() {
7766
7866
  " \xB7 pr\xF3xima ",
7767
7867
  dateTime4(ticket.nextAttemptAt)
7768
7868
  ] }),
7769
- ticket.lastError?.message ? /* @__PURE__ */ jsx45(Text30, { fontSize: "sm", color: "red.600", children: ticket.lastError.message }) : null
7869
+ ticket.lastError?.message ? /* @__PURE__ */ jsx46(Text30, { fontSize: "sm", color: "red.600", children: ticket.lastError.message }) : null
7770
7870
  ] }),
7771
- /* @__PURE__ */ jsx45(Badge8, { colorPalette: statusPalette3(ticket.status), children: ticket.status })
7772
- ] }) }, ticket._id)) : /* @__PURE__ */ jsx45(Text30, { color: "gray.400", children: "Nenhuma pend\xEAncia Omie." }) })
7871
+ /* @__PURE__ */ jsx46(Badge8, { colorPalette: statusPalette3(ticket.status), children: ticket.status })
7872
+ ] }) }, ticket._id)) : /* @__PURE__ */ jsx46(Text30, { color: "gray.400", children: "Nenhuma pend\xEAncia Omie." }) })
7773
7873
  ] }),
7774
- error ? /* @__PURE__ */ jsx45(Text30, { color: "red.600", children: integrationErrorMessage3(error) }) : null
7874
+ error ? /* @__PURE__ */ jsx46(Text30, { color: "red.600", children: integrationErrorMessage3(error) }) : null
7775
7875
  ] });
7776
7876
  }
7777
7877
  function OmieWebhooksTab() {
7778
7878
  const { http } = useOonApi();
7779
- const [instanceId, setInstanceId] = useState20("default");
7780
- const [copied, setCopied] = useState20(false);
7879
+ const [instanceId, setInstanceId] = useState21("default");
7880
+ const [copied, setCopied] = useState21(false);
7781
7881
  const configuration = useQuery13({
7782
7882
  queryKey: ["core-omie", "configuration"],
7783
7883
  queryFn: async () => (await http.get("/integrations/providers/omie/configuration")).data?.instances ?? []
@@ -7814,25 +7914,25 @@ function OmieWebhooksTab() {
7814
7914
  const first = configuration.data?.[0]?.instanceId;
7815
7915
  if (first && !configuration.data?.some((item) => item.instanceId === instanceId)) setInstanceId(first);
7816
7916
  }, [configuration.data, instanceId]);
7817
- if (configuration.isLoading || mappings.isLoading || events.isLoading) return /* @__PURE__ */ jsx45(LoadingScreen, {});
7917
+ if (configuration.isLoading || mappings.isLoading || events.isLoading) return /* @__PURE__ */ jsx46(LoadingScreen, {});
7818
7918
  const blockingError = configuration.error || mappings.error || events.error;
7819
- if (blockingError) return /* @__PURE__ */ jsx45(ErrorState, { error: blockingError });
7919
+ if (blockingError) return /* @__PURE__ */ jsx46(ErrorState, { error: blockingError });
7820
7920
  const url = absoluteWebhookUrl(access.data?.webhookPath);
7821
7921
  const operationError = access.error || rotate.error;
7822
7922
  return /* @__PURE__ */ jsxs30(Stack12, { gap: 5, children: [
7823
7923
  /* @__PURE__ */ jsxs30(Box29, { children: [
7824
- /* @__PURE__ */ jsx45(Heading18, { size: "md", children: "Webhooks e gatilhos" }),
7825
- /* @__PURE__ */ jsx45(Text30, { color: "gray.500", children: "Copie a URL completa para o cadastro de webhook no Omie. O token \xE9 gerado automaticamente e pode ser rotacionado." })
7924
+ /* @__PURE__ */ jsx46(Heading18, { size: "md", children: "Webhooks e gatilhos" }),
7925
+ /* @__PURE__ */ jsx46(Text30, { color: "gray.500", children: "Copie a URL completa para o cadastro de webhook no Omie. O token \xE9 gerado automaticamente e pode ser rotacionado." })
7826
7926
  ] }),
7827
- /* @__PURE__ */ jsx45(Box29, { borderWidth: "1px", borderRadius: "md", p: 4, children: /* @__PURE__ */ jsxs30(Stack12, { gap: 3, children: [
7927
+ /* @__PURE__ */ jsx46(Box29, { borderWidth: "1px", borderRadius: "md", p: 4, children: /* @__PURE__ */ jsxs30(Stack12, { gap: 3, children: [
7828
7928
  /* @__PURE__ */ jsxs30(Box29, { maxW: "360px", children: [
7829
- /* @__PURE__ */ jsx45(Text30, { fontSize: "xs", color: "gray.500", mb: 1, children: "Inst\xE2ncia" }),
7830
- /* @__PURE__ */ jsx45(NativeSelect6, { value: instanceId, onChange: setInstanceId, children: (configuration.data ?? []).map((instance) => /* @__PURE__ */ jsx45("option", { value: instance.instanceId, children: instance.label || instance.instanceId }, instance.instanceId)) })
7929
+ /* @__PURE__ */ jsx46(Text30, { fontSize: "xs", color: "gray.500", mb: 1, children: "Inst\xE2ncia" }),
7930
+ /* @__PURE__ */ jsx46(NativeSelect6, { value: instanceId, onChange: setInstanceId, children: (configuration.data ?? []).map((instance) => /* @__PURE__ */ jsx46("option", { value: instance.instanceId, children: instance.label || instance.instanceId }, instance.instanceId)) })
7831
7931
  ] }),
7832
7932
  /* @__PURE__ */ jsxs30(Box29, { children: [
7833
- /* @__PURE__ */ jsx45(Text30, { fontSize: "xs", color: "gray.500", mb: 1, children: "URL do webhook" }),
7933
+ /* @__PURE__ */ jsx46(Text30, { fontSize: "xs", color: "gray.500", mb: 1, children: "URL do webhook" }),
7834
7934
  /* @__PURE__ */ jsxs30(Flex21, { gap: 2, align: "center", wrap: "wrap", children: [
7835
- /* @__PURE__ */ jsx45(
7935
+ /* @__PURE__ */ jsx46(
7836
7936
  Input13,
7837
7937
  {
7838
7938
  size: "sm",
@@ -7843,7 +7943,7 @@ function OmieWebhooksTab() {
7843
7943
  placeholder: access.isLoading ? "Gerando URL segura\u2026" : "URL indispon\xEDvel"
7844
7944
  }
7845
7945
  ),
7846
- /* @__PURE__ */ jsx45(
7946
+ /* @__PURE__ */ jsx46(
7847
7947
  Button21,
7848
7948
  {
7849
7949
  size: "sm",
@@ -7856,7 +7956,7 @@ function OmieWebhooksTab() {
7856
7956
  children: copied ? "Link copiado" : "Copiar link"
7857
7957
  }
7858
7958
  ),
7859
- /* @__PURE__ */ jsx45(
7959
+ /* @__PURE__ */ jsx46(
7860
7960
  Button21,
7861
7961
  {
7862
7962
  size: "sm",
@@ -7872,25 +7972,25 @@ function OmieWebhooksTab() {
7872
7972
  }
7873
7973
  )
7874
7974
  ] }),
7875
- /* @__PURE__ */ jsx45(Text30, { fontSize: "xs", color: "gray.500", mt: 2, children: "A rota\xE7\xE3o invalida imediatamente a URL anterior. Atualize o cadastro no Omie ap\xF3s gerar um novo token." })
7975
+ /* @__PURE__ */ jsx46(Text30, { fontSize: "xs", color: "gray.500", mt: 2, children: "A rota\xE7\xE3o invalida imediatamente a URL anterior. Atualize o cadastro no Omie ap\xF3s gerar um novo token." })
7876
7976
  ] })
7877
7977
  ] }) }),
7878
7978
  /* @__PURE__ */ jsxs30(Box29, { children: [
7879
- /* @__PURE__ */ jsx45(Heading18, { size: "sm", mb: 3, children: "Gatilhos declarados" }),
7880
- /* @__PURE__ */ jsx45(Stack12, { gap: 2, children: (mappings.data?.webhooks ?? []).length ? mappings.data?.webhooks?.map((webhook) => /* @__PURE__ */ jsxs30(Box29, { borderWidth: "1px", borderRadius: "md", p: 3, children: [
7881
- /* @__PURE__ */ jsx45(Text30, { fontWeight: "semibold", children: webhook.eventType }),
7979
+ /* @__PURE__ */ jsx46(Heading18, { size: "sm", mb: 3, children: "Gatilhos declarados" }),
7980
+ /* @__PURE__ */ jsx46(Stack12, { gap: 2, children: (mappings.data?.webhooks ?? []).length ? mappings.data?.webhooks?.map((webhook) => /* @__PURE__ */ jsxs30(Box29, { borderWidth: "1px", borderRadius: "md", p: 3, children: [
7981
+ /* @__PURE__ */ jsx46(Text30, { fontWeight: "semibold", children: webhook.eventType }),
7882
7982
  /* @__PURE__ */ jsxs30(Text30, { fontSize: "sm", color: "gray.500", children: [
7883
7983
  webhook.resource || "recurso gen\xE9rico",
7884
7984
  " \u2192 ",
7885
7985
  (webhook.actions ?? []).map((action) => action.handler).filter(Boolean).join(", ") || "sem a\xE7\xE3o declarada"
7886
7986
  ] })
7887
- ] }, `${webhook.eventType}:${webhook.resource || ""}`)) : /* @__PURE__ */ jsx45(Text30, { color: "gray.400", children: "Nenhum gatilho declarado pela Central." }) })
7987
+ ] }, `${webhook.eventType}:${webhook.resource || ""}`)) : /* @__PURE__ */ jsx46(Text30, { color: "gray.400", children: "Nenhum gatilho declarado pela Central." }) })
7888
7988
  ] }),
7889
7989
  /* @__PURE__ */ jsxs30(Box29, { children: [
7890
- /* @__PURE__ */ jsx45(Heading18, { size: "sm", mb: 3, children: "Eventos recebidos" }),
7891
- /* @__PURE__ */ jsx45(Stack12, { gap: 2, children: (events.data ?? []).length ? events.data?.map((event) => /* @__PURE__ */ jsx45(Box29, { borderWidth: "1px", borderRadius: "md", p: 3, children: /* @__PURE__ */ jsxs30(Flex21, { align: "center", justify: "space-between", gap: 3, wrap: "wrap", children: [
7990
+ /* @__PURE__ */ jsx46(Heading18, { size: "sm", mb: 3, children: "Eventos recebidos" }),
7991
+ /* @__PURE__ */ jsx46(Stack12, { gap: 2, children: (events.data ?? []).length ? events.data?.map((event) => /* @__PURE__ */ jsx46(Box29, { borderWidth: "1px", borderRadius: "md", p: 3, children: /* @__PURE__ */ jsxs30(Flex21, { align: "center", justify: "space-between", gap: 3, wrap: "wrap", children: [
7892
7992
  /* @__PURE__ */ jsxs30(Box29, { children: [
7893
- /* @__PURE__ */ jsx45(Text30, { fontWeight: "medium", children: event.eventType || "Evento Omie" }),
7993
+ /* @__PURE__ */ jsx46(Text30, { fontWeight: "medium", children: event.eventType || "Evento Omie" }),
7894
7994
  /* @__PURE__ */ jsxs30(Text30, { fontSize: "sm", color: "gray.500", children: [
7895
7995
  event.resource || "sem recurso",
7896
7996
  " \xB7 recebido em ",
@@ -7898,12 +7998,12 @@ function OmieWebhooksTab() {
7898
7998
  " \xB7 tentativas ",
7899
7999
  event.attempts ?? 0
7900
8000
  ] }),
7901
- event.lastError?.message ? /* @__PURE__ */ jsx45(Text30, { fontSize: "sm", color: "red.600", children: event.lastError.message }) : null
8001
+ event.lastError?.message ? /* @__PURE__ */ jsx46(Text30, { fontSize: "sm", color: "red.600", children: event.lastError.message }) : null
7902
8002
  ] }),
7903
- /* @__PURE__ */ jsx45(Badge8, { colorPalette: statusPalette3(event.status), children: event.status })
7904
- ] }) }, event._id)) : /* @__PURE__ */ jsx45(Text30, { color: "gray.400", children: "Nenhum webhook recebido." }) })
8003
+ /* @__PURE__ */ jsx46(Badge8, { colorPalette: statusPalette3(event.status), children: event.status })
8004
+ ] }) }, event._id)) : /* @__PURE__ */ jsx46(Text30, { color: "gray.400", children: "Nenhum webhook recebido." }) })
7905
8005
  ] }),
7906
- operationError ? /* @__PURE__ */ jsx45(Text30, { color: "red.600", children: integrationErrorMessage3(operationError) }) : null
8006
+ operationError ? /* @__PURE__ */ jsx46(Text30, { color: "red.600", children: integrationErrorMessage3(operationError) }) : null
7907
8007
  ] });
7908
8008
  }
7909
8009
  function diagnosticMessage3(value2) {
@@ -7911,21 +8011,21 @@ function diagnosticMessage3(value2) {
7911
8011
  }
7912
8012
  function OmieHistoryTab() {
7913
8013
  const { http } = useOonApi();
7914
- const [expandedId, setExpandedId] = useState20(null);
8014
+ const [expandedId, setExpandedId] = useState21(null);
7915
8015
  const history = useQuery13({
7916
8016
  queryKey: ["core-omie", "history"],
7917
8017
  queryFn: async () => (await http.get("/integrations/history", {
7918
8018
  params: { provider: "omie", limit: 30 }
7919
8019
  })).data?.results ?? []
7920
8020
  });
7921
- if (history.isLoading) return /* @__PURE__ */ jsx45(LoadingScreen, {});
7922
- if (history.error) return /* @__PURE__ */ jsx45(ErrorState, { error: history.error });
8021
+ if (history.isLoading) return /* @__PURE__ */ jsx46(LoadingScreen, {});
8022
+ if (history.error) return /* @__PURE__ */ jsx46(ErrorState, { error: history.error });
7923
8023
  return /* @__PURE__ */ jsxs30(Stack12, { gap: 4, children: [
7924
8024
  /* @__PURE__ */ jsxs30(Box29, { children: [
7925
- /* @__PURE__ */ jsx45(Heading18, { size: "md", children: "Hist\xF3rico" }),
7926
- /* @__PURE__ */ jsx45(Text30, { color: "gray.500", children: "Execu\xE7\xF5es, erros por registro e diagn\xF3stico t\xE9cnico sanitizado." })
8025
+ /* @__PURE__ */ jsx46(Heading18, { size: "md", children: "Hist\xF3rico" }),
8026
+ /* @__PURE__ */ jsx46(Text30, { color: "gray.500", children: "Execu\xE7\xF5es, erros por registro e diagn\xF3stico t\xE9cnico sanitizado." })
7927
8027
  ] }),
7928
- /* @__PURE__ */ jsx45(Stack12, { gap: 2, children: (history.data ?? []).length ? history.data?.map((execution) => {
8028
+ /* @__PURE__ */ jsx46(Stack12, { gap: 2, children: (history.data ?? []).length ? history.data?.map((execution) => {
7929
8029
  const expanded = expandedId === execution._id;
7930
8030
  const diagnostics = [...execution.errors ?? []];
7931
8031
  if (execution.error?.message && !diagnostics.some((item) => diagnosticMessage3(item) === execution.error?.message)) {
@@ -7934,7 +8034,7 @@ function OmieHistoryTab() {
7934
8034
  return /* @__PURE__ */ jsxs30(Box29, { borderWidth: "1px", borderRadius: "md", p: 3, children: [
7935
8035
  /* @__PURE__ */ jsxs30(Flex21, { align: "center", justify: "space-between", gap: 3, wrap: "wrap", children: [
7936
8036
  /* @__PURE__ */ jsxs30(Box29, { children: [
7937
- /* @__PURE__ */ jsx45(Text30, { fontWeight: "semibold", children: execution.title }),
8037
+ /* @__PURE__ */ jsx46(Text30, { fontWeight: "semibold", children: execution.title }),
7938
8038
  /* @__PURE__ */ jsxs30(Text30, { fontSize: "sm", color: "gray.500", children: [
7939
8039
  execution.resource || "sem recurso",
7940
8040
  " \xB7 ",
@@ -7949,8 +8049,8 @@ function OmieHistoryTab() {
7949
8049
  execution.errorCount ?? diagnostics.length,
7950
8050
  " erro(s)"
7951
8051
  ] }) : null,
7952
- /* @__PURE__ */ jsx45(Badge8, { colorPalette: statusPalette3(execution.status), children: execution.status }),
7953
- /* @__PURE__ */ jsx45(
8052
+ /* @__PURE__ */ jsx46(Badge8, { colorPalette: statusPalette3(execution.status), children: execution.status }),
8053
+ /* @__PURE__ */ jsx46(
7954
8054
  Button21,
7955
8055
  {
7956
8056
  size: "sm",
@@ -7964,8 +8064,8 @@ function OmieHistoryTab() {
7964
8064
  ] }),
7965
8065
  expanded ? /* @__PURE__ */ jsxs30(Stack12, { gap: 3, mt: 3, pt: 3, borderTopWidth: "1px", children: [
7966
8066
  execution.summary && Object.keys(execution.summary).length ? /* @__PURE__ */ jsxs30(Box29, { children: [
7967
- /* @__PURE__ */ jsx45(Text30, { fontWeight: "semibold", fontSize: "sm", mb: 2, children: "Resumo" }),
7968
- /* @__PURE__ */ jsx45(Flex21, { gap: 2, wrap: "wrap", children: Object.entries(execution.summary).map(([key, value2]) => /* @__PURE__ */ jsxs30(Badge8, { variant: "outline", children: [
8067
+ /* @__PURE__ */ jsx46(Text30, { fontWeight: "semibold", fontSize: "sm", mb: 2, children: "Resumo" }),
8068
+ /* @__PURE__ */ jsx46(Flex21, { gap: 2, wrap: "wrap", children: Object.entries(execution.summary).map(([key, value2]) => /* @__PURE__ */ jsxs30(Badge8, { variant: "outline", children: [
7969
8069
  key,
7970
8070
  ": ",
7971
8071
  String(value2 ?? "\u2014")
@@ -7976,7 +8076,7 @@ function OmieHistoryTab() {
7976
8076
  "Erros por registro",
7977
8077
  execution.errorsLimited ? " \xB7 visualiza\xE7\xE3o limitada" : ""
7978
8078
  ] }),
7979
- /* @__PURE__ */ jsx45(Stack12, { gap: 2, children: diagnostics.map((diagnostic, index) => /* @__PURE__ */ jsxs30(
8079
+ /* @__PURE__ */ jsx46(Stack12, { gap: 2, children: diagnostics.map((diagnostic, index) => /* @__PURE__ */ jsxs30(
7980
8080
  Box29,
7981
8081
  {
7982
8082
  borderWidth: "1px",
@@ -7991,7 +8091,7 @@ function OmieHistoryTab() {
7991
8091
  diagnostic.externalKey !== void 0 ? ` \xB7 chave ${String(diagnostic.externalKey)}` : "",
7992
8092
  diagnostic.error?.code || diagnostic.code || diagnostic.error?.statusCode || diagnostic.statusCode ? ` \xB7 c\xF3digo ${String(diagnostic.error?.code || diagnostic.code || diagnostic.error?.statusCode || diagnostic.statusCode)}` : ""
7993
8093
  ] }),
7994
- /* @__PURE__ */ jsx45(Text30, { color: "red.700", children: diagnosticMessage3(diagnostic) })
8094
+ /* @__PURE__ */ jsx46(Text30, { color: "red.700", children: diagnosticMessage3(diagnostic) })
7995
8095
  ]
7996
8096
  },
7997
8097
  `${diagnostic.index ?? index}:${diagnosticMessage3(diagnostic)}`
@@ -8007,7 +8107,7 @@ function OmieHistoryTab() {
8007
8107
  typeof count === "number" ? ` (${count})` : "",
8008
8108
  limited ? " \xB7 visualiza\xE7\xE3o limitada" : ""
8009
8109
  ] }),
8010
- /* @__PURE__ */ jsx45(
8110
+ /* @__PURE__ */ jsx46(
8011
8111
  Box29,
8012
8112
  {
8013
8113
  as: "pre",
@@ -8024,7 +8124,7 @@ function OmieHistoryTab() {
8024
8124
  ] }, String(label)) : null)
8025
8125
  ] }) : null
8026
8126
  ] }, execution._id);
8027
- }) : /* @__PURE__ */ jsx45(Text30, { color: "gray.400", children: "Nenhuma execu\xE7\xE3o Omie registrada." }) })
8127
+ }) : /* @__PURE__ */ jsx46(Text30, { color: "gray.400", children: "Nenhuma execu\xE7\xE3o Omie registrada." }) })
8028
8128
  ] });
8029
8129
  }
8030
8130
  var TABS = [
@@ -8034,13 +8134,13 @@ var TABS = [
8034
8134
  { id: "history", label: "Hist\xF3rico" }
8035
8135
  ];
8036
8136
  function CoreOmieIntegration() {
8037
- const [tab, setTab] = useState20("configuration");
8137
+ const [tab, setTab] = useState21("configuration");
8038
8138
  return /* @__PURE__ */ jsxs30(Stack12, { gap: 5, children: [
8039
8139
  /* @__PURE__ */ jsxs30(Box29, { children: [
8040
- /* @__PURE__ */ jsx45(Heading18, { size: "lg", children: "Integra\xE7\xE3o Omie" }),
8041
- /* @__PURE__ */ jsx45(Text30, { color: "gray.500", children: "Configure credenciais, sincroniza\xE7\xF5es, webhooks, gatilhos e diagn\xF3sticos da inst\xE2ncia Omie." })
8140
+ /* @__PURE__ */ jsx46(Heading18, { size: "lg", children: "Integra\xE7\xE3o Omie" }),
8141
+ /* @__PURE__ */ jsx46(Text30, { color: "gray.500", children: "Configure credenciais, sincroniza\xE7\xF5es, webhooks, gatilhos e diagn\xF3sticos da inst\xE2ncia Omie." })
8042
8142
  ] }),
8043
- /* @__PURE__ */ jsx45(Flex21, { gap: 2, wrap: "wrap", borderBottomWidth: "1px", pb: 2, children: TABS.map((item) => /* @__PURE__ */ jsx45(
8143
+ /* @__PURE__ */ jsx46(Flex21, { gap: 2, wrap: "wrap", borderBottomWidth: "1px", pb: 2, children: TABS.map((item) => /* @__PURE__ */ jsx46(
8044
8144
  Button21,
8045
8145
  {
8046
8146
  size: "sm",
@@ -8050,20 +8150,20 @@ function CoreOmieIntegration() {
8050
8150
  },
8051
8151
  item.id
8052
8152
  )) }),
8053
- tab === "configuration" ? /* @__PURE__ */ jsx45(OmieConfigurationTab, {}) : null,
8054
- tab === "synchronization" ? /* @__PURE__ */ jsx45(OmieSynchronizationTab, {}) : null,
8055
- tab === "webhooks" ? /* @__PURE__ */ jsx45(OmieWebhooksTab, {}) : null,
8056
- tab === "history" ? /* @__PURE__ */ jsx45(OmieHistoryTab, {}) : null
8153
+ tab === "configuration" ? /* @__PURE__ */ jsx46(OmieConfigurationTab, {}) : null,
8154
+ tab === "synchronization" ? /* @__PURE__ */ jsx46(OmieSynchronizationTab, {}) : null,
8155
+ tab === "webhooks" ? /* @__PURE__ */ jsx46(OmieWebhooksTab, {}) : null,
8156
+ tab === "history" ? /* @__PURE__ */ jsx46(OmieHistoryTab, {}) : null
8057
8157
  ] });
8058
8158
  }
8059
8159
 
8060
8160
  // src/components/CoreOmieIntegrationWorkspace.tsx
8061
- import { jsx as jsx46, jsxs as jsxs31 } from "react/jsx-runtime";
8161
+ import { jsx as jsx47, jsxs as jsxs31 } from "react/jsx-runtime";
8062
8162
  function CoreOmieIntegrationWorkspace() {
8063
- const [view, setView] = useState21("integration");
8163
+ const [view, setView] = useState22("integration");
8064
8164
  return /* @__PURE__ */ jsxs31(Stack13, { gap: 4, children: [
8065
8165
  /* @__PURE__ */ jsxs31(Flex22, { gap: 2, wrap: "wrap", borderBottomWidth: "1px", pb: 2, children: [
8066
- /* @__PURE__ */ jsx46(
8166
+ /* @__PURE__ */ jsx47(
8067
8167
  Button22,
8068
8168
  {
8069
8169
  size: "sm",
@@ -8072,7 +8172,7 @@ function CoreOmieIntegrationWorkspace() {
8072
8172
  children: "Integra\xE7\xE3o Omie"
8073
8173
  }
8074
8174
  ),
8075
- /* @__PURE__ */ jsx46(
8175
+ /* @__PURE__ */ jsx47(
8076
8176
  Button22,
8077
8177
  {
8078
8178
  size: "sm",
@@ -8082,17 +8182,17 @@ function CoreOmieIntegrationWorkspace() {
8082
8182
  }
8083
8183
  )
8084
8184
  ] }),
8085
- view === "integration" ? /* @__PURE__ */ jsx46(CoreOmieIntegration, {}) : null,
8086
- view === "tickets" ? /* @__PURE__ */ jsx46(CoreIntegrationTickets, { provider: "omie" }) : null
8185
+ view === "integration" ? /* @__PURE__ */ jsx47(CoreOmieIntegration, {}) : null,
8186
+ view === "tickets" ? /* @__PURE__ */ jsx47(CoreIntegrationTickets, { provider: "omie" }) : null
8087
8187
  ] });
8088
8188
  }
8089
8189
 
8090
8190
  // src/modules/integrations.tsx
8091
- import { jsx as jsx47, jsxs as jsxs32 } from "react/jsx-runtime";
8191
+ import { jsx as jsx48, jsxs as jsxs32 } from "react/jsx-runtime";
8092
8192
  function CoreIntegrationPage() {
8093
8193
  return /* @__PURE__ */ jsxs32(Stack14, { gap: 8, children: [
8094
- /* @__PURE__ */ jsx47(CoreIntegration, {}),
8095
- /* @__PURE__ */ jsx47(CoreIntegrationMappings, {})
8194
+ /* @__PURE__ */ jsx48(CoreIntegration, {}),
8195
+ /* @__PURE__ */ jsx48(CoreIntegrationMappings, {})
8096
8196
  ] });
8097
8197
  }
8098
8198
  function createIntegrationModule() {
@@ -8102,17 +8202,17 @@ function createIntegrationModule() {
8102
8202
  routes: [
8103
8203
  {
8104
8204
  path: "/integracoes",
8105
- element: /* @__PURE__ */ jsx47(CoreIntegrationPage, {}),
8205
+ element: /* @__PURE__ */ jsx48(CoreIntegrationPage, {}),
8106
8206
  capabilities: ["core.integrations"]
8107
8207
  },
8108
8208
  {
8109
8209
  path: "/configuracoes/integracao-omie",
8110
- element: /* @__PURE__ */ jsx47(CoreOmieIntegrationWorkspace, {}),
8210
+ element: /* @__PURE__ */ jsx48(CoreOmieIntegrationWorkspace, {}),
8111
8211
  capabilities: ["core.integrations", "core.integrations.omie"]
8112
8212
  },
8113
8213
  {
8114
8214
  path: "/configuracoes/integracao-omie/tickets",
8115
- element: /* @__PURE__ */ jsx47(CoreIntegrationTickets, { provider: "omie" }),
8215
+ element: /* @__PURE__ */ jsx48(CoreIntegrationTickets, { provider: "omie" }),
8116
8216
  capabilities: ["core.integrations", "core.integrations.omie"]
8117
8217
  }
8118
8218
  ],
@@ -8167,34 +8267,34 @@ function defineOonModule(mod) {
8167
8267
 
8168
8268
  // src/components/CoreCurrency.tsx
8169
8269
  import { Button as Button23, Flex as Flex23, Heading as Heading19, Stack as Stack15, Text as Text31 } from "@chakra-ui/react";
8170
- import { useMutation as useMutation8, useQueryClient as useQueryClient6 } from "@tanstack/react-query";
8171
- import { jsx as jsx48, jsxs as jsxs33 } from "react/jsx-runtime";
8270
+ import { useMutation as useMutation8, useQueryClient as useQueryClient7 } from "@tanstack/react-query";
8271
+ import { jsx as jsx49, jsxs as jsxs33 } from "react/jsx-runtime";
8172
8272
  function CoreCurrency({ model = "Moeda", label = "Multi-moedas", endpoint = "/moedas", columns }) {
8173
8273
  const { http } = useOonApi();
8174
- const queryClient = useQueryClient6();
8274
+ const queryClient = useQueryClient7();
8175
8275
  const updateRates = useMutation8({
8176
8276
  mutationFn: () => http.post(`${endpoint}/actions/update-rates`, {}, { headers: { "x-oon-origin": "integration" } }),
8177
8277
  onSuccess: () => queryClient.invalidateQueries({ queryKey: ["oon", "list", endpoint] })
8178
8278
  });
8179
8279
  return /* @__PURE__ */ jsxs33(Stack15, { gap: 6, children: [
8180
8280
  /* @__PURE__ */ jsxs33(Flex23, { align: "center", justify: "space-between", children: [
8181
- /* @__PURE__ */ jsx48(Heading19, { size: "lg", children: label }),
8182
- /* @__PURE__ */ jsx48(Button23, { size: "sm", colorPalette: "blue", loading: updateRates.isPending, onClick: () => updateRates.mutate(), children: "Atualizar cota\xE7\xF5es" })
8281
+ /* @__PURE__ */ jsx49(Heading19, { size: "lg", children: label }),
8282
+ /* @__PURE__ */ jsx49(Button23, { size: "sm", colorPalette: "blue", loading: updateRates.isPending, onClick: () => updateRates.mutate(), children: "Atualizar cota\xE7\xF5es" })
8183
8283
  ] }),
8184
- updateRates.isError ? /* @__PURE__ */ jsx48(Text31, { fontSize: "sm", color: "red.600", children: updateRates.error?.message }) : null,
8185
- /* @__PURE__ */ jsx48(CoreCollection, { model, label: "", mode: columns ? "full" : "dynamic", endpoint, columns })
8284
+ updateRates.isError ? /* @__PURE__ */ jsx49(Text31, { fontSize: "sm", color: "red.600", children: updateRates.error?.message }) : null,
8285
+ /* @__PURE__ */ jsx49(CoreCollection, { model, label: "", mode: columns ? "full" : "dynamic", endpoint, columns })
8186
8286
  ] });
8187
8287
  }
8188
8288
 
8189
8289
  // src/components/CoreAssistant.tsx
8190
- import { useState as useState22 } from "react";
8290
+ import { useState as useState23 } from "react";
8191
8291
  import { Box as Box30, Button as Button24, Flex as Flex24, Heading as Heading20, Input as Input14, Stack as Stack16, Text as Text32 } from "@chakra-ui/react";
8192
8292
  import { useMutation as useMutation9 } from "@tanstack/react-query";
8193
- import { jsx as jsx49, jsxs as jsxs34 } from "react/jsx-runtime";
8293
+ import { jsx as jsx50, jsxs as jsxs34 } from "react/jsx-runtime";
8194
8294
  function CoreAssistant({ assistantCode, label = "Assistente", entity, endpoint = "/assistant-runs" }) {
8195
8295
  const { http } = useOonApi();
8196
- const [messages, setMessages] = useState22([]);
8197
- const [input, setInput] = useState22("");
8296
+ const [messages, setMessages] = useState23([]);
8297
+ const [input, setInput] = useState23("");
8198
8298
  const ask = useMutation9({
8199
8299
  mutationFn: async (message) => {
8200
8300
  const { data } = await http.post(
@@ -8220,9 +8320,9 @@ function CoreAssistant({ assistantCode, label = "Assistente", entity, endpoint =
8220
8320
  ask.mutate(text);
8221
8321
  };
8222
8322
  return /* @__PURE__ */ jsxs34(Stack16, { gap: 4, maxW: "560px", children: [
8223
- /* @__PURE__ */ jsx49(Heading20, { size: "md", children: label }),
8224
- /* @__PURE__ */ jsx49(Box30, { borderWidth: "1px", borderColor: "gray.200", borderRadius: "md", bg: "white", p: 4, minH: "240px", children: /* @__PURE__ */ jsxs34(Stack16, { gap: 3, children: [
8225
- messages.length === 0 ? /* @__PURE__ */ jsx49(Text32, { color: "gray.400", fontSize: "sm", children: "Fa\xE7a uma pergunta ao assistente." }) : messages.map((m, idx) => /* @__PURE__ */ jsx49(Flex24, { justify: m.role === "user" ? "flex-end" : "flex-start", children: /* @__PURE__ */ jsx49(
8323
+ /* @__PURE__ */ jsx50(Heading20, { size: "md", children: label }),
8324
+ /* @__PURE__ */ jsx50(Box30, { borderWidth: "1px", borderColor: "gray.200", borderRadius: "md", bg: "white", p: 4, minH: "240px", children: /* @__PURE__ */ jsxs34(Stack16, { gap: 3, children: [
8325
+ messages.length === 0 ? /* @__PURE__ */ jsx50(Text32, { color: "gray.400", fontSize: "sm", children: "Fa\xE7a uma pergunta ao assistente." }) : messages.map((m, idx) => /* @__PURE__ */ jsx50(Flex24, { justify: m.role === "user" ? "flex-end" : "flex-start", children: /* @__PURE__ */ jsx50(
8226
8326
  Box30,
8227
8327
  {
8228
8328
  bg: m.role === "user" ? "brand.500" : "gray.100",
@@ -8235,11 +8335,11 @@ function CoreAssistant({ assistantCode, label = "Assistente", entity, endpoint =
8235
8335
  children: m.content
8236
8336
  }
8237
8337
  ) }, idx)),
8238
- ask.isPending ? /* @__PURE__ */ jsx49(Text32, { color: "gray.400", fontSize: "sm", children: "Pensando\u2026" }) : null,
8239
- ask.isError ? /* @__PURE__ */ jsx49(Text32, { color: "red.600", fontSize: "sm", children: ask.error?.message }) : null
8338
+ ask.isPending ? /* @__PURE__ */ jsx50(Text32, { color: "gray.400", fontSize: "sm", children: "Pensando\u2026" }) : null,
8339
+ ask.isError ? /* @__PURE__ */ jsx50(Text32, { color: "red.600", fontSize: "sm", children: ask.error?.message }) : null
8240
8340
  ] }) }),
8241
8341
  /* @__PURE__ */ jsxs34(Flex24, { gap: 2, children: [
8242
- /* @__PURE__ */ jsx49(
8342
+ /* @__PURE__ */ jsx50(
8243
8343
  Input14,
8244
8344
  {
8245
8345
  size: "sm",
@@ -8251,7 +8351,7 @@ function CoreAssistant({ assistantCode, label = "Assistente", entity, endpoint =
8251
8351
  }
8252
8352
  }
8253
8353
  ),
8254
- /* @__PURE__ */ jsx49(Button24, { size: "sm", colorPalette: "blue", onClick: send, loading: ask.isPending, children: "Enviar" })
8354
+ /* @__PURE__ */ jsx50(Button24, { size: "sm", colorPalette: "blue", onClick: send, loading: ask.isPending, children: "Enviar" })
8255
8355
  ] })
8256
8356
  ] });
8257
8357
  }
@@ -8283,6 +8383,7 @@ export {
8283
8383
  can,
8284
8384
  coerceDomainFormValue,
8285
8385
  createIntegrationModule,
8386
+ createTenantStorage,
8286
8387
  defineCollectionView,
8287
8388
  defineDashboard,
8288
8389
  defineDocumentView,
@@ -8298,6 +8399,7 @@ export {
8298
8399
  useModelSchema,
8299
8400
  useOonApi,
8300
8401
  useOonAuth,
8301
- useOonResource
8402
+ useOonResource,
8403
+ useOonTenant
8302
8404
  };
8303
8405
  //# sourceMappingURL=index.js.map