@oondemand/oon-core-front 0.3.36 → 0.3.38

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
@@ -642,7 +642,7 @@ function OonProviders({ config, http, storage, children }) {
642
642
 
643
643
  // src/components/CoreCollection.tsx
644
644
  import { useState as useState10 } from "react";
645
- import { Box as Box9, Heading as Heading4, Stack as Stack4, Text as Text11 } from "@chakra-ui/react";
645
+ import { Box as Box10, Heading as Heading4, Stack as Stack4, Text as Text11 } from "@chakra-ui/react";
646
646
  import { useMutation as useMutation2, useQueryClient as useQueryClient3 } from "@tanstack/react-query";
647
647
 
648
648
  // src/components/internal/fieldUtils.ts
@@ -1833,12 +1833,12 @@ function DynamicForm({ title, eyebrow = "Cadastro", fields, initialValues, submi
1833
1833
 
1834
1834
  // src/components/internal/CoreDetailModal.tsx
1835
1835
  import { useEffect as useEffect6, useMemo as useMemo7, useState as useState9 } from "react";
1836
- import { Box as Box8, Button as Button8, Flex as Flex7, Heading as Heading3, IconButton, Text as Text10 } from "@chakra-ui/react";
1836
+ import { Box as Box9, Button as Button8, Flex as Flex7, Heading as Heading3, IconButton, Text as Text10 } from "@chakra-ui/react";
1837
1837
  import { useQuery as useQuery6, useQueryClient as useQueryClient2 } from "@tanstack/react-query";
1838
1838
 
1839
1839
  // src/components/internal/CoreTabbedDetail.tsx
1840
1840
  import { useEffect as useEffect5, useMemo as useMemo6, useState as useState8 } from "react";
1841
- import { Box as Box7, Button as Button7, Flex as Flex6, Input as Input5, NativeSelect as NativeSelect4, SimpleGrid as SimpleGrid3, Stack as Stack3, Text as Text9, Textarea as Textarea3 } from "@chakra-ui/react";
1841
+ import { Box as Box8, Button as Button7, Flex as Flex6, Input as Input5, NativeSelect as NativeSelect4, SimpleGrid as SimpleGrid3, Stack as Stack3, Text as Text9, Textarea as Textarea3 } from "@chakra-ui/react";
1842
1842
 
1843
1843
  // src/components/internal/CoreSummaryCards.tsx
1844
1844
  import { SimpleGrid as SimpleGrid2, Box as Box5, Text as Text6, Badge as Badge2 } from "@chakra-ui/react";
@@ -1894,7 +1894,7 @@ function CoreSummaryCards({ cards = [], parent, relations }) {
1894
1894
 
1895
1895
  // src/components/internal/CoreRelatedGrid.tsx
1896
1896
  import { useMemo as useMemo5, useState as useState7 } from "react";
1897
- import { Badge as Badge3, Box as Box6, Button as Button6, Flex as Flex5, Table as Table2, Text as Text8 } from "@chakra-ui/react";
1897
+ import { Badge as Badge3, Box as Box7, Button as Button6, Flex as Flex5, Table as Table2, Text as Text8 } from "@chakra-ui/react";
1898
1898
  import { useMutation, useQuery as useQuery5, useQueryClient } from "@tanstack/react-query";
1899
1899
 
1900
1900
  // src/components/internal/CoreInlineEditableCell.tsx
@@ -1944,7 +1944,60 @@ function CoreInlineEditableCell({ column, meta, value, onChange }) {
1944
1944
 
1945
1945
  // src/components/internal/CoreRowAction.tsx
1946
1946
  import { useState as useState6 } from "react";
1947
- import { Button as Button5, Text as Text7 } from "@chakra-ui/react";
1947
+ import { Box as Box6, Button as Button5, Text as Text7 } from "@chakra-ui/react";
1948
+
1949
+ // src/components/internal/actionError.ts
1950
+ function asRecord(value) {
1951
+ return value && typeof value === "object" ? value : void 0;
1952
+ }
1953
+ function firstText(...values) {
1954
+ return values.find((value) => typeof value === "string" && value.trim().length > 0)?.trim();
1955
+ }
1956
+ function firstNumber(...values) {
1957
+ return values.find((value) => typeof value === "number" && Number.isFinite(value));
1958
+ }
1959
+ function collectDetailMessages(value, visited = /* @__PURE__ */ new WeakSet(), depth = 0) {
1960
+ if (depth > 4 || value == null) return [];
1961
+ if (typeof value === "string") return value.trim() ? [value.trim()] : [];
1962
+ if (Array.isArray(value)) {
1963
+ return value.flatMap((item) => collectDetailMessages(item, visited, depth + 1));
1964
+ }
1965
+ if (typeof value !== "object" || visited.has(value)) return [];
1966
+ visited.add(value);
1967
+ const record = value;
1968
+ const field = firstText(record.field, record.path, record.property, record.name);
1969
+ const message = firstText(record.message, record.msg, record.reason);
1970
+ const direct = message ? [field ? `${field}: ${message}` : message] : [];
1971
+ const nestedKeys = ["details", "errors", "validation", "fields"];
1972
+ const nested = nestedKeys.flatMap((key) => collectDetailMessages(record[key], visited, depth + 1));
1973
+ if (direct.length || nested.length) return [...direct, ...nested];
1974
+ return Object.entries(record).filter(([key]) => !["code", "status", "statusCode", "requestId"].includes(key)).flatMap(([, nestedValue]) => collectDetailMessages(nestedValue, visited, depth + 1));
1975
+ }
1976
+ function unique(values) {
1977
+ return [...new Set(values.map((value) => value.trim()).filter(Boolean))];
1978
+ }
1979
+ function describeActionError(error) {
1980
+ if (error instanceof Error) return { message: error.message };
1981
+ if (typeof error === "string") return { message: error };
1982
+ const record = asRecord(error);
1983
+ if (!record) return { message: "N\xE3o foi poss\xEDvel executar a a\xE7\xE3o." };
1984
+ const envelope = asRecord(record.error) ?? record;
1985
+ const message = firstText(envelope.message, record.message) ?? "N\xE3o foi poss\xEDvel executar a a\xE7\xE3o.";
1986
+ const details = unique(collectDetailMessages(envelope.details ?? record.details)).filter((detail) => detail !== message).slice(0, 3);
1987
+ const code = firstText(envelope.code, record.code);
1988
+ const status = firstNumber(envelope.status, envelope.statusCode, record.status, record.statusCode);
1989
+ const requestId = firstText(envelope.requestId, record.requestId);
1990
+ const technical = [
1991
+ code ? `C\xF3digo: ${code}` : void 0,
1992
+ status ? `HTTP: ${status}` : void 0,
1993
+ requestId ? `ID da requisi\xE7\xE3o: ${requestId}` : void 0
1994
+ ].filter((value) => Boolean(value));
1995
+ const contextParts = [...details, ...technical];
1996
+ return {
1997
+ message,
1998
+ ...contextParts.length ? { context: contextParts.join(" \u2022 ") } : {}
1999
+ };
2000
+ }
1948
2001
 
1949
2002
  // src/components/internal/conditions.ts
1950
2003
  function valueAt(source, path) {
@@ -1978,8 +2031,27 @@ function interpolateEndpoint(endpoint, row, parent) {
1978
2031
  });
1979
2032
  }
1980
2033
 
2034
+ // src/components/internal/DetailRecordContext.tsx
2035
+ import { createContext as createContext4, useContext as useContext4 } from "react";
2036
+ import { jsx as jsx12 } from "react/jsx-runtime";
2037
+ var DetailRecordContext = createContext4(null);
2038
+ function DetailRecordProvider({
2039
+ record,
2040
+ setRecord,
2041
+ children
2042
+ }) {
2043
+ return /* @__PURE__ */ jsx12(DetailRecordContext.Provider, { value: { record, setRecord }, children });
2044
+ }
2045
+ function useDetailRecord() {
2046
+ return useContext4(DetailRecordContext);
2047
+ }
2048
+ function mergeDetailRecord(current, saved, changes = {}) {
2049
+ const savedRecord = saved && typeof saved === "object" ? saved : {};
2050
+ return { ...current, ...savedRecord, ...changes };
2051
+ }
2052
+
1981
2053
  // src/components/internal/CoreRowAction.tsx
1982
- import { jsx as jsx12, jsxs as jsxs8 } from "react/jsx-runtime";
2054
+ import { jsx as jsx13, jsxs as jsxs8 } from "react/jsx-runtime";
1983
2055
  var ACTION_TONES = {
1984
2056
  success: { bg: "#DCFCE7", color: "#166534", border: "#BBF7D0", hover: "#D1FAE5" },
1985
2057
  danger: { bg: "#FEE2E2", color: "#991B1B", border: "#FECACA", hover: "#FDE2E2" },
@@ -1987,8 +2059,25 @@ var ACTION_TONES = {
1987
2059
  neutral: { bg: "#F1F5F9", color: "#334155", border: "#E2E8F0", hover: "#E8EEF5" },
1988
2060
  brand: { bg: "#E0F2FE", color: "#075985", border: "#BAE6FD", hover: "#D5EEFC" }
1989
2061
  };
1990
- function messageOf2(error) {
1991
- return error instanceof Error ? error.message : typeof error === "string" ? error : "N\xE3o foi poss\xEDvel executar a a\xE7\xE3o.";
2062
+ function ActionErrorMessage({ error }) {
2063
+ const description = describeActionError(error);
2064
+ return /* @__PURE__ */ jsxs8(
2065
+ Box6,
2066
+ {
2067
+ role: "alert",
2068
+ mt: "5px",
2069
+ maxW: "420px",
2070
+ p: "7px 9px",
2071
+ bg: "#FEF3F2",
2072
+ borderWidth: "1px",
2073
+ borderColor: "#FECDCA",
2074
+ borderRadius: "6px",
2075
+ children: [
2076
+ /* @__PURE__ */ jsx13(Text7, { color: "#B42318", fontSize: "10px", fontWeight: "600", lineHeight: "1.35", children: description.message }),
2077
+ description.context ? /* @__PURE__ */ jsx13(Text7, { mt: "2px", color: "#7A271A", fontSize: "9px", lineHeight: "1.35", children: description.context }) : null
2078
+ ]
2079
+ }
2080
+ );
1992
2081
  }
1993
2082
  function unwrap2(value) {
1994
2083
  if (!value || typeof value !== "object") return {};
@@ -2018,6 +2107,8 @@ function emitOperationalEvent(action, row, changes) {
2018
2107
  }
2019
2108
  function CoreRowAction({ action, row, parent, onOpenDetail, onRefresh, onUpdate }) {
2020
2109
  const { http } = useOonApi();
2110
+ const detailRecord = useDetailRecord();
2111
+ const effectiveRow = detailRecord?.record ?? row;
2021
2112
  const [loading, setLoading] = useState6(false);
2022
2113
  const [error, setError] = useState6(null);
2023
2114
  const [formOpen, setFormOpen] = useState6(false);
@@ -2025,16 +2116,16 @@ function CoreRowAction({ action, row, parent, onOpenDetail, onRefresh, onUpdate
2025
2116
  const pipelineAction = action;
2026
2117
  const tone = pipelineAction.tone ? ACTION_TONES[pipelineAction.tone] : void 0;
2027
2118
  const isWorkStatus = pipelineAction.group === "workStatus";
2028
- const isSelected = isWorkStatus && !!pipelineAction.field && row[pipelineAction.field] === pipelineAction.value;
2029
- if (evaluateCondition(action.hiddenWhen, row)) return null;
2030
- const disabled = evaluateCondition(action.disabledWhen, row) || loading;
2119
+ const isSelected = isWorkStatus && !!pipelineAction.field && effectiveRow[pipelineAction.field] === pipelineAction.value;
2120
+ if (evaluateCondition(action.hiddenWhen, effectiveRow)) return null;
2121
+ const disabled = evaluateCondition(action.disabledWhen, effectiveRow) || loading;
2031
2122
  const confirmAction = () => action.confirm ? window.confirm(action.confirm.description ?? action.confirm.title ?? `Executar ${action.label}?`) : true;
2032
2123
  const run = async () => {
2033
2124
  setError(null);
2034
- if (action.type === "openDetailModal") return onOpenDetail?.(row, action.initialTab);
2125
+ if (action.type === "openDetailModal") return onOpenDetail?.(effectiveRow, action.initialTab);
2035
2126
  if (action.type === "navigate") {
2036
2127
  const href = action.href ?? action.endpoint;
2037
- if (href) window.location.assign(interpolateEndpoint(href, row, parent));
2128
+ if (href) window.location.assign(interpolateEndpoint(href, effectiveRow, parent));
2038
2129
  return;
2039
2130
  }
2040
2131
  if (pipelineAction.type === "formAction") {
@@ -2043,7 +2134,7 @@ function CoreRowAction({ action, row, parent, onOpenDetail, onRefresh, onUpdate
2043
2134
  try {
2044
2135
  let loaded = {};
2045
2136
  if (pipelineAction.loadEndpoint) {
2046
- const url = interpolateEndpoint(pipelineAction.loadEndpoint, row, parent);
2137
+ const url = interpolateEndpoint(pipelineAction.loadEndpoint, effectiveRow, parent);
2047
2138
  loaded = unwrap2(await http.request({ url, method: "GET" }));
2048
2139
  }
2049
2140
  setFormInitialValues({ ...pipelineAction.initialValues ?? {}, ...loaded });
@@ -2060,8 +2151,9 @@ function CoreRowAction({ action, row, parent, onOpenDetail, onRefresh, onUpdate
2060
2151
  setLoading(true);
2061
2152
  try {
2062
2153
  const changes = { [pipelineAction.field]: pipelineAction.value };
2063
- await onUpdate(changes);
2064
- emitOperationalEvent(pipelineAction, row, changes);
2154
+ const saved = await onUpdate(changes);
2155
+ detailRecord?.setRecord(mergeDetailRecord(effectiveRow, saved, changes));
2156
+ emitOperationalEvent(pipelineAction, effectiveRow, changes);
2065
2157
  onRefresh?.(pipelineAction.refresh);
2066
2158
  } catch (err) {
2067
2159
  setError(err);
@@ -2073,9 +2165,9 @@ function CoreRowAction({ action, row, parent, onOpenDetail, onRefresh, onUpdate
2073
2165
  if (action.type !== "apiAction" || !action.endpoint || !confirmAction()) return;
2074
2166
  setLoading(true);
2075
2167
  try {
2076
- const url = interpolateEndpoint(action.endpoint, row, parent);
2168
+ const url = interpolateEndpoint(action.endpoint, effectiveRow, parent);
2077
2169
  await http.request({ url, method: action.method ?? "POST" });
2078
- emitOperationalEvent(pipelineAction, row);
2170
+ emitOperationalEvent(pipelineAction, effectiveRow);
2079
2171
  onRefresh?.(action.refresh);
2080
2172
  } catch (err) {
2081
2173
  setError(err);
@@ -2107,13 +2199,13 @@ function CoreRowAction({ action, row, parent, onOpenDetail, onRefresh, onUpdate
2107
2199
  _hover: tone ? { bg: tone.hover, borderColor: tone.border } : void 0,
2108
2200
  _disabled: tone ? { opacity: isSelected ? 1 : 0.55, cursor: "not-allowed" } : void 0,
2109
2201
  children: [
2110
- isWorkStatus ? /* @__PURE__ */ jsx12("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,
2202
+ isWorkStatus ? /* @__PURE__ */ jsx13("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,
2111
2203
  action.label
2112
2204
  ]
2113
2205
  }
2114
2206
  ),
2115
- error ? /* @__PURE__ */ jsx12(Text7, { mt: "3px", color: "#B42318", fontSize: "9px", children: messageOf2(error) }) : null,
2116
- formOpen && pipelineAction.type === "formAction" ? /* @__PURE__ */ jsx12(
2207
+ error ? /* @__PURE__ */ jsx13(ActionErrorMessage, { error }) : null,
2208
+ formOpen && pipelineAction.type === "formAction" ? /* @__PURE__ */ jsx13(
2117
2209
  DynamicForm,
2118
2210
  {
2119
2211
  title: pipelineAction.title ?? pipelineAction.label,
@@ -2127,9 +2219,9 @@ function CoreRowAction({ action, row, parent, onOpenDetail, onRefresh, onUpdate
2127
2219
  setLoading(true);
2128
2220
  setError(null);
2129
2221
  try {
2130
- const url = interpolateEndpoint(pipelineAction.endpoint, row, parent);
2222
+ const url = interpolateEndpoint(pipelineAction.endpoint, effectiveRow, parent);
2131
2223
  await http.request({ url, method: pipelineAction.method ?? "POST", data: values });
2132
- emitOperationalEvent(pipelineAction, row, values);
2224
+ emitOperationalEvent(pipelineAction, effectiveRow, values);
2133
2225
  setFormOpen(false);
2134
2226
  onRefresh?.(pipelineAction.refresh);
2135
2227
  } catch (err) {
@@ -2148,7 +2240,7 @@ function CoreRowAction({ action, row, parent, onOpenDetail, onRefresh, onUpdate
2148
2240
  }
2149
2241
 
2150
2242
  // src/components/internal/CoreRelatedGrid.tsx
2151
- import { Fragment as Fragment2, jsx as jsx13, jsxs as jsxs9 } from "react/jsx-runtime";
2243
+ import { Fragment as Fragment2, jsx as jsx14, jsxs as jsxs9 } from "react/jsx-runtime";
2152
2244
  function CoreRelatedGrid({
2153
2245
  tab: rawTab,
2154
2246
  parent,
@@ -2206,23 +2298,23 @@ function CoreRelatedGrid({
2206
2298
  mutationFn: (id) => resource.delete(id),
2207
2299
  onSuccess: invalidate
2208
2300
  });
2209
- if (!relation) return /* @__PURE__ */ jsx13(Text8, { color: "#B42318", children: "Rela\xE7\xE3o n\xE3o encontrada." });
2210
- if (query.isLoading || schemaQuery.isLoading) return /* @__PURE__ */ jsx13(Text8, { color: "#667085", children: "Carregando..." });
2301
+ if (!relation) return /* @__PURE__ */ jsx14(Text8, { color: "#B42318", children: "Rela\xE7\xE3o n\xE3o encontrada." });
2302
+ if (query.isLoading || schemaQuery.isLoading) return /* @__PURE__ */ jsx14(Text8, { color: "#667085", children: "Carregando..." });
2211
2303
  const rows = query.data?.results ?? [];
2212
2304
  const setDraft = (id, field, value) => setDrafts((current) => ({
2213
2305
  ...current,
2214
2306
  [id]: { ...current[id] ?? {}, [field]: value }
2215
2307
  }));
2216
2308
  const createFields = tab.create?.fields?.length ? tab.create.fields : formFieldsFromMeta(schema?.fields ?? []).filter((field) => ![relation.foreignKey, "_id", "createdAt", "updatedAt"].includes(field.field));
2217
- return /* @__PURE__ */ jsxs9(Box6, { children: [
2218
- canCreate ? /* @__PURE__ */ jsx13(Flex5, { justify: "flex-end", mb: "10px", children: /* @__PURE__ */ jsx13(Button6, { size: "sm", colorPalette: "brand", onClick: () => {
2309
+ return /* @__PURE__ */ jsxs9(Box7, { children: [
2310
+ canCreate ? /* @__PURE__ */ jsx14(Flex5, { justify: "flex-end", mb: "10px", children: /* @__PURE__ */ jsx14(Button6, { size: "sm", colorPalette: "brand", onClick: () => {
2219
2311
  setCreateError(null);
2220
2312
  setCreating(true);
2221
2313
  }, children: tab.create?.label ?? "Novo registro" }) }) : null,
2222
- /* @__PURE__ */ jsx13(Box6, { overflowX: "auto", borderWidth: "1px", borderColor: "#E5E9ED", borderRadius: "10px", children: /* @__PURE__ */ jsxs9(Table2.Root, { size: "sm", minW: "760px", children: [
2223
- /* @__PURE__ */ jsx13(Table2.Header, { children: /* @__PURE__ */ jsxs9(Table2.Row, { bg: "#F4F7F9", children: [
2224
- columns.map((column) => /* @__PURE__ */ jsx13(Table2.ColumnHeader, { fontSize: "10px", children: column.label ?? column.field }, column.field)),
2225
- hasActions ? /* @__PURE__ */ jsx13(Table2.ColumnHeader, { children: "A\xE7\xF5es" }) : null
2314
+ /* @__PURE__ */ jsx14(Box7, { overflowX: "auto", borderWidth: "1px", borderColor: "#E5E9ED", borderRadius: "10px", children: /* @__PURE__ */ jsxs9(Table2.Root, { size: "sm", minW: "760px", children: [
2315
+ /* @__PURE__ */ jsx14(Table2.Header, { children: /* @__PURE__ */ jsxs9(Table2.Row, { bg: "#F4F7F9", children: [
2316
+ columns.map((column) => /* @__PURE__ */ jsx14(Table2.ColumnHeader, { fontSize: "10px", children: column.label ?? column.field }, column.field)),
2317
+ hasActions ? /* @__PURE__ */ jsx14(Table2.ColumnHeader, { children: "A\xE7\xF5es" }) : null
2226
2318
  ] }) }),
2227
2319
  /* @__PURE__ */ jsxs9(Table2.Body, { children: [
2228
2320
  rows.map((row, index) => {
@@ -2234,11 +2326,11 @@ function CoreRelatedGrid({
2234
2326
  const value = column.field in draft ? draft[column.field] : row[column.field];
2235
2327
  const meta = schema?.fields.find((field) => field.name === column.field);
2236
2328
  const canEdit = editable && column.readonly !== true && (column.editable === true || !column.readonly);
2237
- return /* @__PURE__ */ jsx13(Table2.Cell, { fontSize: "11px", children: canEdit ? /* @__PURE__ */ jsx13(CoreInlineEditableCell, { column, meta, value, onChange: (next) => setDraft(id, column.field, next) }) : column.display === "badgeExists" ? /* @__PURE__ */ jsx13(Badge3, { colorPalette: value ? "green" : "gray", children: value ? "Sim" : "N\xE3o" }) : formatCell(value, column.kind) }, column.field);
2329
+ return /* @__PURE__ */ jsx14(Table2.Cell, { fontSize: "11px", children: canEdit ? /* @__PURE__ */ jsx14(CoreInlineEditableCell, { column, meta, value, onChange: (next) => setDraft(id, column.field, next) }) : column.display === "badgeExists" ? /* @__PURE__ */ jsx14(Badge3, { colorPalette: value ? "green" : "gray", children: value ? "Sim" : "N\xE3o" }) : formatCell(value, column.kind) }, column.field);
2238
2330
  }),
2239
- hasActions ? /* @__PURE__ */ jsx13(Table2.Cell, { children: /* @__PURE__ */ jsxs9(Flex5, { gap: "5px", align: "center", wrap: "wrap", children: [
2331
+ hasActions ? /* @__PURE__ */ jsx14(Table2.Cell, { children: /* @__PURE__ */ jsxs9(Flex5, { gap: "5px", align: "center", wrap: "wrap", children: [
2240
2332
  dirty ? /* @__PURE__ */ jsxs9(Fragment2, { children: [
2241
- /* @__PURE__ */ jsx13(
2333
+ /* @__PURE__ */ jsx14(
2242
2334
  Button6,
2243
2335
  {
2244
2336
  size: "xs",
@@ -2257,14 +2349,14 @@ function CoreRelatedGrid({
2257
2349
  children: "Salvar"
2258
2350
  }
2259
2351
  ),
2260
- /* @__PURE__ */ jsx13(Button6, { size: "xs", variant: "outline", onClick: () => setDrafts((current) => {
2352
+ /* @__PURE__ */ jsx14(Button6, { size: "xs", variant: "outline", onClick: () => setDrafts((current) => {
2261
2353
  const next = { ...current };
2262
2354
  delete next[id];
2263
2355
  return next;
2264
2356
  }), children: "Cancelar" })
2265
2357
  ] }) : null,
2266
- tab.rowActions?.map((action) => /* @__PURE__ */ jsx13(CoreRowAction, { action, row, parent, onRefresh }, action.id ?? action.label)),
2267
- canDelete ? /* @__PURE__ */ jsx13(
2358
+ tab.rowActions?.map((action) => /* @__PURE__ */ jsx14(CoreRowAction, { action, row, parent, onRefresh }, action.id ?? action.label)),
2359
+ canDelete ? /* @__PURE__ */ jsx14(
2268
2360
  Button6,
2269
2361
  {
2270
2362
  size: "xs",
@@ -2277,14 +2369,14 @@ function CoreRelatedGrid({
2277
2369
  children: "Excluir"
2278
2370
  }
2279
2371
  ) : null,
2280
- errors[id] ? /* @__PURE__ */ jsx13(Text8, { color: "#B42318", fontSize: "9px", children: "Erro ao salvar." }) : null
2372
+ errors[id] ? /* @__PURE__ */ jsx14(Text8, { color: "#B42318", fontSize: "9px", children: "Erro ao salvar." }) : null
2281
2373
  ] }) }) : null
2282
2374
  ] }, id);
2283
2375
  }),
2284
- rows.length === 0 ? /* @__PURE__ */ jsx13(Table2.Row, { children: /* @__PURE__ */ jsx13(Table2.Cell, { colSpan: columns.length + (hasActions ? 1 : 0), children: /* @__PURE__ */ jsx13(Text8, { p: "8", textAlign: "center", color: "#98A2B3", children: "Nenhum registro relacionado." }) }) }) : null
2376
+ rows.length === 0 ? /* @__PURE__ */ jsx14(Table2.Row, { children: /* @__PURE__ */ jsx14(Table2.Cell, { colSpan: columns.length + (hasActions ? 1 : 0), children: /* @__PURE__ */ jsx14(Text8, { p: "8", textAlign: "center", color: "#98A2B3", children: "Nenhum registro relacionado." }) }) }) : null
2285
2377
  ] })
2286
2378
  ] }) }),
2287
- creating ? /* @__PURE__ */ jsx13(
2379
+ creating ? /* @__PURE__ */ jsx14(
2288
2380
  DynamicForm,
2289
2381
  {
2290
2382
  title: tab.create?.label ?? `Novo ${schema?.singular ?? relation.model}`,
@@ -2304,7 +2396,7 @@ function CoreRelatedGrid({
2304
2396
  }
2305
2397
 
2306
2398
  // src/components/internal/CoreTabbedDetail.tsx
2307
- import { jsx as jsx14, jsxs as jsxs10 } from "react/jsx-runtime";
2399
+ import { jsx as jsx15, jsxs as jsxs10 } from "react/jsx-runtime";
2308
2400
  function coerce2(value, kind) {
2309
2401
  if (value === "") return void 0;
2310
2402
  if (["number", "currency", "currencyConverted"].includes(kind ?? "")) return Number(value);
@@ -2332,7 +2424,7 @@ function initialFieldValue2(field, value) {
2332
2424
  function isMultiline2(field) {
2333
2425
  return /observa|descricao|mensagem|detalhe|necessidade/i.test(field.field);
2334
2426
  }
2335
- function messageOf3(error) {
2427
+ function messageOf2(error) {
2336
2428
  if (!error) return null;
2337
2429
  if (typeof error === "string") return error;
2338
2430
  if (error instanceof Error) return error.message;
@@ -2391,13 +2483,13 @@ function resolveReference2(field, values) {
2391
2483
  }
2392
2484
  function FieldLabel({ field, htmlFor }) {
2393
2485
  const label = fieldLabel({ name: field.field, label: field.label });
2394
- return /* @__PURE__ */ jsx14("label", { htmlFor, children: /* @__PURE__ */ jsxs10(Text9, { as: "span", display: "block", mb: "5px", color: "#475467", fontSize: "11px", fontWeight: "600", children: [
2486
+ return /* @__PURE__ */ jsx15("label", { htmlFor, children: /* @__PURE__ */ jsxs10(Text9, { as: "span", display: "block", mb: "5px", color: "#475467", fontSize: "11px", fontWeight: "600", children: [
2395
2487
  label,
2396
- field.required ? /* @__PURE__ */ jsx14(Text9, { as: "span", color: "#DC2626", children: " *" }) : null
2488
+ field.required ? /* @__PURE__ */ jsx15(Text9, { as: "span", color: "#DC2626", children: " *" }) : null
2397
2489
  ] }) });
2398
2490
  }
2399
2491
  function ErrorText2({ id, message }) {
2400
- return message ? /* @__PURE__ */ jsx14(Text9, { id, role: "alert", mt: "5px", color: "#DC2626", fontSize: "10px", fontWeight: "500", children: message }) : null;
2492
+ return message ? /* @__PURE__ */ jsx15(Text9, { id, role: "alert", mt: "5px", color: "#DC2626", fontSize: "10px", fontWeight: "500", children: message }) : null;
2401
2493
  }
2402
2494
  function FieldControl({
2403
2495
  field,
@@ -2420,9 +2512,9 @@ function FieldControl({
2420
2512
  const checkedValue = String(field.checkedValue ?? true);
2421
2513
  const uncheckedValue = String(field.uncheckedValue ?? false);
2422
2514
  const checked = (value || uncheckedValue) === checkedValue;
2423
- return /* @__PURE__ */ jsxs10(Box7, { children: [
2515
+ return /* @__PURE__ */ jsxs10(Box8, { children: [
2424
2516
  /* @__PURE__ */ jsxs10(
2425
- Box7,
2517
+ Box8,
2426
2518
  {
2427
2519
  as: "label",
2428
2520
  display: "flex",
@@ -2437,7 +2529,7 @@ function FieldControl({
2437
2529
  borderRadius: "7px",
2438
2530
  cursor: "pointer",
2439
2531
  children: [
2440
- /* @__PURE__ */ jsx14(
2532
+ /* @__PURE__ */ jsx15(
2441
2533
  "input",
2442
2534
  {
2443
2535
  id: inputId,
@@ -2449,18 +2541,18 @@ function FieldControl({
2449
2541
  onChange: (event) => onChange(event.currentTarget.checked ? checkedValue : uncheckedValue)
2450
2542
  }
2451
2543
  ),
2452
- /* @__PURE__ */ jsx14(Text9, { as: "span", fontSize: "11px", fontWeight: "600", children: label })
2544
+ /* @__PURE__ */ jsx15(Text9, { as: "span", fontSize: "11px", fontWeight: "600", children: label })
2453
2545
  ]
2454
2546
  }
2455
2547
  ),
2456
- /* @__PURE__ */ jsx14(ErrorText2, { id: errorId, message: error })
2548
+ /* @__PURE__ */ jsx15(ErrorText2, { id: errorId, message: error })
2457
2549
  ] });
2458
2550
  }
2459
2551
  if (field.kind === "ref" && field.ref) {
2460
2552
  const reference = resolveReference2(field, values);
2461
- return /* @__PURE__ */ jsxs10(Box7, { children: [
2462
- /* @__PURE__ */ jsx14(FieldLabel, { field, htmlFor: inputId }),
2463
- /* @__PURE__ */ jsx14(
2553
+ return /* @__PURE__ */ jsxs10(Box8, { children: [
2554
+ /* @__PURE__ */ jsx15(FieldLabel, { field, htmlFor: inputId }),
2555
+ /* @__PURE__ */ jsx15(
2464
2556
  ReferenceSelect,
2465
2557
  {
2466
2558
  field: field.field,
@@ -2485,18 +2577,18 @@ function FieldControl({
2485
2577
  const mask = resolveInputMask(field);
2486
2578
  const control = field.kind === "enum" && field.options?.length ? /* @__PURE__ */ jsxs10(NativeSelect4.Root, { size: "sm", children: [
2487
2579
  /* @__PURE__ */ jsxs10(NativeSelect4.Field, { id: inputId, value, ...invalidProps, onChange: (event) => onChange(event.currentTarget.value), children: [
2488
- /* @__PURE__ */ jsx14("option", { value: "", children: "\u2014 Selecione \u2014" }),
2489
- field.options.map((option) => /* @__PURE__ */ jsx14("option", { value: option, children: option }, option))
2580
+ /* @__PURE__ */ jsx15("option", { value: "", children: "\u2014 Selecione \u2014" }),
2581
+ field.options.map((option) => /* @__PURE__ */ jsx15("option", { value: option, children: option }, option))
2490
2582
  ] }),
2491
- /* @__PURE__ */ jsx14(NativeSelect4.Indicator, {})
2583
+ /* @__PURE__ */ jsx15(NativeSelect4.Indicator, {})
2492
2584
  ] }) : field.kind === "boolean" ? /* @__PURE__ */ jsxs10(NativeSelect4.Root, { size: "sm", children: [
2493
2585
  /* @__PURE__ */ jsxs10(NativeSelect4.Field, { id: inputId, value, ...invalidProps, onChange: (event) => onChange(event.currentTarget.value), children: [
2494
- /* @__PURE__ */ jsx14("option", { value: "", children: "\u2014 Selecione \u2014" }),
2495
- /* @__PURE__ */ jsx14("option", { value: "true", children: "Sim" }),
2496
- /* @__PURE__ */ jsx14("option", { value: "false", children: "N\xE3o" })
2586
+ /* @__PURE__ */ jsx15("option", { value: "", children: "\u2014 Selecione \u2014" }),
2587
+ /* @__PURE__ */ jsx15("option", { value: "true", children: "Sim" }),
2588
+ /* @__PURE__ */ jsx15("option", { value: "false", children: "N\xE3o" })
2497
2589
  ] }),
2498
- /* @__PURE__ */ jsx14(NativeSelect4.Indicator, {})
2499
- ] }) : isMultiline2(field) ? /* @__PURE__ */ jsx14(Textarea3, { id: inputId, rows: 4, resize: "vertical", value, ...invalidProps, onChange: (event) => onChange(event.currentTarget.value) }) : /* @__PURE__ */ jsx14(
2590
+ /* @__PURE__ */ jsx15(NativeSelect4.Indicator, {})
2591
+ ] }) : isMultiline2(field) ? /* @__PURE__ */ jsx15(Textarea3, { id: inputId, rows: 4, resize: "vertical", value, ...invalidProps, onChange: (event) => onChange(event.currentTarget.value) }) : /* @__PURE__ */ jsx15(
2500
2592
  Input5,
2501
2593
  {
2502
2594
  id: inputId,
@@ -2510,10 +2602,10 @@ function FieldControl({
2510
2602
  onChange: (event) => onChange(parseMaskedInput(event.currentTarget.value, mask))
2511
2603
  }
2512
2604
  );
2513
- return /* @__PURE__ */ jsxs10(Box7, { children: [
2514
- /* @__PURE__ */ jsx14(FieldLabel, { field, htmlFor: inputId }),
2605
+ return /* @__PURE__ */ jsxs10(Box8, { children: [
2606
+ /* @__PURE__ */ jsx15(FieldLabel, { field, htmlFor: inputId }),
2515
2607
  control,
2516
- /* @__PURE__ */ jsx14(ErrorText2, { id: errorId, message: error })
2608
+ /* @__PURE__ */ jsx15(ErrorText2, { id: errorId, message: error })
2517
2609
  ] });
2518
2610
  }
2519
2611
  function GroupSection({
@@ -2526,10 +2618,10 @@ function GroupSection({
2526
2618
  }) {
2527
2619
  if (!fields.length) return null;
2528
2620
  const columns = group.columns ?? 2;
2529
- return /* @__PURE__ */ jsxs10(Box7, { p: { base: "12px", md: "14px" }, bg: "#FAFCFD", borderWidth: "1px", borderColor: "#E5E9ED", borderRadius: "9px", children: [
2530
- /* @__PURE__ */ jsx14(Text9, { color: "#344054", fontSize: "12px", fontWeight: "700", children: group.label }),
2531
- group.description ? /* @__PURE__ */ jsx14(Text9, { mt: "2px", mb: "12px", color: "#667085", fontSize: "10px", children: group.description }) : /* @__PURE__ */ jsx14(Box7, { h: "10px" }),
2532
- /* @__PURE__ */ jsx14(SimpleGrid3, { columns: { base: 1, md: Math.min(columns, 2), xl: columns }, gapX: "16px", gapY: "14px", children: fields.map((field) => /* @__PURE__ */ jsx14(
2621
+ return /* @__PURE__ */ jsxs10(Box8, { p: { base: "12px", md: "14px" }, bg: "#FAFCFD", borderWidth: "1px", borderColor: "#E5E9ED", borderRadius: "9px", children: [
2622
+ /* @__PURE__ */ jsx15(Text9, { color: "#344054", fontSize: "12px", fontWeight: "700", children: group.label }),
2623
+ group.description ? /* @__PURE__ */ jsx15(Text9, { mt: "2px", mb: "12px", color: "#667085", fontSize: "10px", children: group.description }) : /* @__PURE__ */ jsx15(Box8, { h: "10px" }),
2624
+ /* @__PURE__ */ jsx15(SimpleGrid3, { columns: { base: 1, md: Math.min(columns, 2), xl: columns }, gapX: "16px", gapY: "14px", children: fields.map((field) => /* @__PURE__ */ jsx15(
2533
2625
  FieldControl,
2534
2626
  {
2535
2627
  field,
@@ -2585,7 +2677,7 @@ function InlineParentForm({
2585
2677
  };
2586
2678
  const renderFields = () => {
2587
2679
  if (groups?.length) {
2588
- return /* @__PURE__ */ jsx14(Stack3, { gap: "14px", children: groups.map((group) => /* @__PURE__ */ jsx14(
2680
+ return /* @__PURE__ */ jsx15(Stack3, { gap: "14px", children: groups.map((group) => /* @__PURE__ */ jsx15(
2589
2681
  GroupSection,
2590
2682
  {
2591
2683
  group,
@@ -2598,7 +2690,7 @@ function InlineParentForm({
2598
2690
  `${group.label}-${group.fields.join("-")}`
2599
2691
  )) });
2600
2692
  }
2601
- return /* @__PURE__ */ jsx14(SimpleGrid3, { columns: { base: 1, md: 2 }, gap: "14px", children: fields.map((field) => /* @__PURE__ */ jsx14(
2693
+ return /* @__PURE__ */ jsx15(SimpleGrid3, { columns: { base: 1, md: 2 }, gap: "14px", children: fields.map((field) => /* @__PURE__ */ jsx15(
2602
2694
  FieldControl,
2603
2695
  {
2604
2696
  field,
@@ -2611,7 +2703,7 @@ function InlineParentForm({
2611
2703
  field.field
2612
2704
  )) });
2613
2705
  };
2614
- return /* @__PURE__ */ jsx14(
2706
+ return /* @__PURE__ */ jsx15(
2615
2707
  "form",
2616
2708
  {
2617
2709
  id: formId,
@@ -2641,9 +2733,9 @@ function InlineParentForm({
2641
2733
  }
2642
2734
  },
2643
2735
  children: /* @__PURE__ */ jsxs10(Stack3, { gap: "16px", children: [
2644
- error ? /* @__PURE__ */ jsx14(Box7, { role: "alert", p: "10px 12px", color: "#B42318", bg: "#FEF3F2", borderWidth: "1px", borderColor: "#FECDCA", borderRadius: "7px", fontSize: "11px", children: messageOf3(error) }) : null,
2736
+ error ? /* @__PURE__ */ jsx15(Box8, { role: "alert", p: "10px 12px", color: "#B42318", bg: "#FEF3F2", borderWidth: "1px", borderColor: "#FECDCA", borderRadius: "7px", fontSize: "11px", children: messageOf2(error) }) : null,
2645
2737
  renderFields(),
2646
- !externalSubmit ? /* @__PURE__ */ jsx14(Flex6, { justify: "flex-end", children: /* @__PURE__ */ jsx14(Button7, { type: "submit", colorPalette: "brand", loading: saving, children: "Salvar dados principais" }) }) : null
2738
+ !externalSubmit ? /* @__PURE__ */ jsx15(Flex6, { justify: "flex-end", children: /* @__PURE__ */ jsx15(Button7, { type: "submit", colorPalette: "brand", loading: saving, children: "Salvar dados principais" }) }) : null
2647
2739
  ] })
2648
2740
  }
2649
2741
  );
@@ -2664,9 +2756,9 @@ function CoreTabbedDetail({
2664
2756
  }) {
2665
2757
  const active = tabs.find((tab) => tab.id === activeTab) ?? tabs[0];
2666
2758
  return /* @__PURE__ */ jsxs10(Stack3, { gap: 4, children: [
2667
- /* @__PURE__ */ jsx14(Flex6, { gap: 2, borderBottomWidth: "1px", borderColor: "#E5E9ED", overflowX: "auto", children: tabs.map((tab) => {
2759
+ /* @__PURE__ */ jsx15(Flex6, { gap: 2, borderBottomWidth: "1px", borderColor: "#E5E9ED", overflowX: "auto", children: tabs.map((tab) => {
2668
2760
  const disabled = !parent?._id && (tab.type === "relatedGrid" || tab.type === "readonlyGrid" || tab.type === "summary");
2669
- return /* @__PURE__ */ jsx14(
2761
+ return /* @__PURE__ */ jsx15(
2670
2762
  Button7,
2671
2763
  {
2672
2764
  type: "button",
@@ -2679,7 +2771,7 @@ function CoreTabbedDetail({
2679
2771
  tab.id
2680
2772
  );
2681
2773
  }) }),
2682
- /* @__PURE__ */ jsx14(Box7, { children: !active ? null : active.type === "summary" && parent ? /* @__PURE__ */ jsx14(CoreSummaryCards, { cards: active.cards, parent, relations }) : active.type === "form" ? /* @__PURE__ */ jsx14(
2774
+ /* @__PURE__ */ jsx15(Box8, { children: !active ? null : active.type === "summary" && parent ? /* @__PURE__ */ jsx15(CoreSummaryCards, { cards: active.cards, parent, relations }) : active.type === "form" ? /* @__PURE__ */ jsx15(
2683
2775
  InlineParentForm,
2684
2776
  {
2685
2777
  fields: fieldsForTab(formFields, active.fields ?? active.groups?.flatMap((group) => group.fields)),
@@ -2690,7 +2782,7 @@ function CoreTabbedDetail({
2690
2782
  formId,
2691
2783
  externalSubmit
2692
2784
  }
2693
- ) : (active.type === "relatedGrid" || active.type === "readonlyGrid") && parent ? /* @__PURE__ */ jsx14(
2785
+ ) : (active.type === "relatedGrid" || active.type === "readonlyGrid") && parent ? /* @__PURE__ */ jsx15(
2694
2786
  CoreRelatedGrid,
2695
2787
  {
2696
2788
  tab: active,
@@ -2702,12 +2794,12 @@ function CoreTabbedDetail({
2702
2794
  ) : active.type === "customComponent" ? /* @__PURE__ */ jsxs10(Text9, { color: "#667085", children: [
2703
2795
  "Componente customizado: ",
2704
2796
  active.component
2705
- ] }) : /* @__PURE__ */ jsx14(Text9, { color: "#667085", children: "Salve o registro principal para liberar esta aba." }) })
2797
+ ] }) : /* @__PURE__ */ jsx15(Text9, { color: "#667085", children: "Salve o registro principal para liberar esta aba." }) })
2706
2798
  ] });
2707
2799
  }
2708
2800
 
2709
2801
  // src/components/internal/CoreDetailModal.tsx
2710
- import { jsx as jsx15, jsxs as jsxs11 } from "react/jsx-runtime";
2802
+ import { jsx as jsx16, jsxs as jsxs11 } from "react/jsx-runtime";
2711
2803
  function CoreDetailModal({
2712
2804
  model,
2713
2805
  title,
@@ -2765,15 +2857,15 @@ function CoreDetailModal({
2765
2857
  const displayTitle = parent?.[config.titleField ?? ""] ? String(parent[config.titleField ?? ""]) : title;
2766
2858
  const activeIsForm = (config.tabs.find((tab) => tab.id === activeTab) ?? config.tabs[0])?.type === "form";
2767
2859
  const formId = `oon-detail-form-${model.replace(/[^a-zA-Z0-9_-]/g, "-")}`;
2768
- return /* @__PURE__ */ jsx15(Flex7, { position: "fixed", inset: 0, zIndex: 1e3, align: "center", justify: "center", p: 4, bg: "rgba(15,23,42,.48)", children: /* @__PURE__ */ jsxs11(Box8, { 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: [
2860
+ return /* @__PURE__ */ jsx16(DetailRecordProvider, { record: parent, setRecord: setParent, children: /* @__PURE__ */ jsx16(Flex7, { position: "fixed", inset: 0, zIndex: 1e3, align: "center", justify: "center", p: 4, bg: "rgba(15,23,42,.48)", children: /* @__PURE__ */ jsxs11(Box9, { 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: [
2769
2861
  /* @__PURE__ */ jsxs11(Flex7, { minH: "72px", px: "20px", py: "10px", align: "center", justify: "space-between", gap: 4, borderBottomWidth: "1px", borderColor: "#E5E9ED", children: [
2770
- /* @__PURE__ */ jsxs11(Box8, { minW: "160px", children: [
2771
- /* @__PURE__ */ jsx15(Text10, { color: "#0474AF", fontSize: "10px", fontWeight: "700", textTransform: "uppercase", children: "Detalhe" }),
2772
- /* @__PURE__ */ jsx15(Heading3, { size: "md", children: recordId ? displayTitle : `Novo ${title}` })
2862
+ /* @__PURE__ */ jsxs11(Box9, { minW: "160px", children: [
2863
+ /* @__PURE__ */ jsx16(Text10, { color: "#0474AF", fontSize: "10px", fontWeight: "700", textTransform: "uppercase", children: "Detalhe" }),
2864
+ /* @__PURE__ */ jsx16(Heading3, { size: "md", children: recordId ? displayTitle : `Novo ${title}` })
2773
2865
  ] }),
2774
2866
  /* @__PURE__ */ jsxs11(Flex7, { flex: "1", align: "center", justify: "flex-end", gap: "8px", wrap: "wrap", children: [
2775
2867
  recordId ? topActions : null,
2776
- /* @__PURE__ */ jsx15(
2868
+ /* @__PURE__ */ jsx16(
2777
2869
  IconButton,
2778
2870
  {
2779
2871
  "aria-label": "Fechar",
@@ -2794,7 +2886,7 @@ function CoreDetailModal({
2794
2886
  )
2795
2887
  ] })
2796
2888
  ] }),
2797
- /* @__PURE__ */ jsx15(Box8, { flex: "1", minH: 0, p: "20px", overflowY: "auto", children: schemaQuery.isLoading || parentQuery.isLoading ? /* @__PURE__ */ jsx15(Text10, { children: "Carregando..." }) : /* @__PURE__ */ jsx15(
2889
+ /* @__PURE__ */ jsx16(Box9, { flex: "1", minH: 0, p: "20px", overflowY: "auto", children: schemaQuery.isLoading || parentQuery.isLoading ? /* @__PURE__ */ jsx16(Text10, { children: "Carregando..." }) : /* @__PURE__ */ jsx16(
2798
2890
  CoreTabbedDetail,
2799
2891
  {
2800
2892
  tabs: config.tabs,
@@ -2830,16 +2922,16 @@ function CoreDetailModal({
2830
2922
  borderColor: "#E5E9ED",
2831
2923
  boxShadow: "0 -8px 24px rgba(15,23,42,.06)",
2832
2924
  children: [
2833
- /* @__PURE__ */ jsx15(Box8, { children: recordId ? bottomActions : null }),
2834
- /* @__PURE__ */ jsx15(Button8, { type: "submit", form: formId, colorPalette: "brand", disabled: !activeIsForm || schemaQuery.isLoading || parentQuery.isLoading, children: "Salvar" })
2925
+ /* @__PURE__ */ jsx16(Box9, { children: recordId ? bottomActions : null }),
2926
+ /* @__PURE__ */ jsx16(Button8, { type: "submit", form: formId, colorPalette: "brand", disabled: !activeIsForm || schemaQuery.isLoading || parentQuery.isLoading, children: "Salvar" })
2835
2927
  ]
2836
2928
  }
2837
2929
  )
2838
- ] }) });
2930
+ ] }) }) });
2839
2931
  }
2840
2932
 
2841
2933
  // src/components/CoreCollection.tsx
2842
- import { jsx as jsx16, jsxs as jsxs12 } from "react/jsx-runtime";
2934
+ import { jsx as jsx17, jsxs as jsxs12 } from "react/jsx-runtime";
2843
2935
  function mergeFormFields(metadataFields, overrides) {
2844
2936
  if (!overrides?.length) return metadataFields;
2845
2937
  const byField = new Map(overrides.map((field) => [field.field, field]));
@@ -2881,16 +2973,16 @@ function CoreCollection({ model, label, section = "Cole\xE7\xE3o", mode = "dynam
2881
2973
  mutationFn: (row) => resource.delete(row._id),
2882
2974
  onSuccess: invalidate
2883
2975
  });
2884
- if (needsSchema && schemaQuery.isLoading) return /* @__PURE__ */ jsx16(LoadingScreen, {});
2885
- if (needsSchema && schemaQuery.isError) return /* @__PURE__ */ jsx16(ErrorState, { error: schemaQuery.error });
2976
+ if (needsSchema && schemaQuery.isLoading) return /* @__PURE__ */ jsx17(LoadingScreen, {});
2977
+ if (needsSchema && schemaQuery.isError) return /* @__PURE__ */ jsx17(ErrorState, { error: schemaQuery.error });
2886
2978
  const title = label ?? schema?.name ?? model;
2887
2979
  return /* @__PURE__ */ jsxs12(Stack4, { gap: 5, children: [
2888
- /* @__PURE__ */ jsxs12(Box9, { children: [
2889
- /* @__PURE__ */ jsx16(Text11, { fontSize: "11px", fontWeight: "700", color: "brand.500", textTransform: "uppercase", letterSpacing: "0.08em", mb: 1, children: section }),
2890
- /* @__PURE__ */ jsx16(Heading4, { size: "lg", color: "#24323A", letterSpacing: "-0.02em", children: title }),
2891
- /* @__PURE__ */ jsx16(Text11, { mt: 1, fontSize: "13px", color: "gray.500", children: "Consulte, filtre e mantenha os registros desta opera\xE7\xE3o." })
2980
+ /* @__PURE__ */ jsxs12(Box10, { children: [
2981
+ /* @__PURE__ */ jsx17(Text11, { fontSize: "11px", fontWeight: "700", color: "brand.500", textTransform: "uppercase", letterSpacing: "0.08em", mb: 1, children: section }),
2982
+ /* @__PURE__ */ jsx17(Heading4, { size: "lg", color: "#24323A", letterSpacing: "-0.02em", children: title }),
2983
+ /* @__PURE__ */ jsx17(Text11, { mt: 1, fontSize: "13px", color: "gray.500", children: "Consulte, filtre e mantenha os registros desta opera\xE7\xE3o." })
2892
2984
  ] }),
2893
- /* @__PURE__ */ jsx16(
2985
+ /* @__PURE__ */ jsx17(
2894
2986
  DataGrid,
2895
2987
  {
2896
2988
  resource,
@@ -2911,7 +3003,7 @@ function CoreCollection({ model, label, section = "Cole\xE7\xE3o", mode = "dynam
2911
3003
  onDelete: (row) => {
2912
3004
  if (window.confirm("Excluir este registro?")) deleteMutation.mutate(row);
2913
3005
  },
2914
- renderRowActions: list?.rowActions?.length ? (row) => list.rowActions?.map((action) => /* @__PURE__ */ jsx16(
3006
+ renderRowActions: list?.rowActions?.length ? (row) => list.rowActions?.map((action) => /* @__PURE__ */ jsx17(
2915
3007
  CoreRowAction,
2916
3008
  {
2917
3009
  action,
@@ -2923,7 +3015,7 @@ function CoreCollection({ model, label, section = "Cole\xE7\xE3o", mode = "dynam
2923
3015
  )) : void 0
2924
3016
  }
2925
3017
  ),
2926
- formState.open ? /* @__PURE__ */ jsx16(
3018
+ formState.open ? /* @__PURE__ */ jsx17(
2927
3019
  DynamicForm,
2928
3020
  {
2929
3021
  title: formState.row ? `Editar ${title}` : `Novo ${title}`,
@@ -2944,7 +3036,7 @@ function CoreCollection({ model, label, section = "Cole\xE7\xE3o", mode = "dynam
2944
3036
  }
2945
3037
  ) : null,
2946
3038
  importExport ? null : null,
2947
- detailState.open && detailModal?.enabled ? /* @__PURE__ */ jsx16(
3039
+ detailState.open && detailModal?.enabled ? /* @__PURE__ */ jsx17(
2948
3040
  CoreDetailModal,
2949
3041
  {
2950
3042
  model,
@@ -2963,9 +3055,9 @@ function CoreCollection({ model, label, section = "Cole\xE7\xE3o", mode = "dynam
2963
3055
  }
2964
3056
 
2965
3057
  // src/components/CoreDocument.tsx
2966
- import { jsx as jsx17 } from "react/jsx-runtime";
3058
+ import { jsx as jsx18 } from "react/jsx-runtime";
2967
3059
  function CoreDocument({ model, label, endpoint, columns, form }) {
2968
- return /* @__PURE__ */ jsx17(
3060
+ return /* @__PURE__ */ jsx18(
2969
3061
  CoreCollection,
2970
3062
  {
2971
3063
  model,
@@ -2980,7 +3072,7 @@ function CoreDocument({ model, label, endpoint, columns, form }) {
2980
3072
 
2981
3073
  // src/components/CorePipeline.tsx
2982
3074
  import { useEffect as useEffect7, useRef as useRef2, useState as useState11 } from "react";
2983
- import { Badge as Badge4, Box as Box10, Button as Button9, Flex as Flex8, Heading as Heading5, Input as Input6, NativeSelect as NativeSelect5, Stack as Stack5, Text as Text12 } from "@chakra-ui/react";
3075
+ import { Badge as Badge4, Box as Box11, Button as Button9, Flex as Flex8, Heading as Heading5, Input as Input6, NativeSelect as NativeSelect5, Stack as Stack5, Text as Text12 } from "@chakra-ui/react";
2984
3076
  import { useMutation as useMutation3, useQuery as useQuery7, useQueryClient as useQueryClient4 } from "@tanstack/react-query";
2985
3077
 
2986
3078
  // src/pipelineTicket.ts
@@ -3122,7 +3214,7 @@ function pipelineBoardScrollStep(clientWidth) {
3122
3214
  }
3123
3215
 
3124
3216
  // src/components/CorePipeline.tsx
3125
- import { jsx as jsx18, jsxs as jsxs13 } from "react/jsx-runtime";
3217
+ import { jsx as jsx19, jsxs as jsxs13 } from "react/jsx-runtime";
3126
3218
  function ticketId(row) {
3127
3219
  const id = row._id ?? row.id;
3128
3220
  return id == null ? void 0 : String(id);
@@ -3146,7 +3238,7 @@ function workStatusColor(value) {
3146
3238
  }
3147
3239
  function PipelineArrowIcon({ direction }) {
3148
3240
  const path = direction === "left" ? "M12.5 5 7.5 10l5 5" : "m7.5 5 5 5-5 5";
3149
- return /* @__PURE__ */ jsx18("svg", { viewBox: "0 0 20 20", width: "18", height: "18", "aria-hidden": "true", children: /* @__PURE__ */ jsx18("path", { d: path, fill: "none", stroke: "currentColor", strokeWidth: "1.8", strokeLinecap: "round", strokeLinejoin: "round" }) });
3241
+ return /* @__PURE__ */ jsx19("svg", { viewBox: "0 0 20 20", width: "18", height: "18", "aria-hidden": "true", children: /* @__PURE__ */ jsx19("path", { d: path, fill: "none", stroke: "currentColor", strokeWidth: "1.8", strokeLinecap: "round", strokeLinejoin: "round" }) });
3150
3242
  }
3151
3243
  function PipelineFilterControl({
3152
3244
  filter,
@@ -3155,7 +3247,7 @@ function PipelineFilterControl({
3155
3247
  onChange
3156
3248
  }) {
3157
3249
  if (filter.type === "ref" && meta?.ref) {
3158
- return /* @__PURE__ */ jsx18(Box10, { w: "220px", children: /* @__PURE__ */ jsx18(
3250
+ return /* @__PURE__ */ jsx19(Box11, { w: "220px", children: /* @__PURE__ */ jsx19(
3159
3251
  ReferenceSelect,
3160
3252
  {
3161
3253
  field: filter.field,
@@ -3174,11 +3266,11 @@ function PipelineFilterControl({
3174
3266
  }
3175
3267
  if (filter.type === "select") {
3176
3268
  return /* @__PURE__ */ jsxs13(NativeSelect5.Root, { size: "sm", w: "190px", children: [
3177
- /* @__PURE__ */ jsx18(NativeSelect5.Field, { value: String(value ?? ""), onChange: (event) => onChange(event.currentTarget.value), children: (filter.options ?? []).map((option) => /* @__PURE__ */ jsx18("option", { value: String(option.value ?? ""), children: option.label }, String(option.value ?? ""))) }),
3178
- /* @__PURE__ */ jsx18(NativeSelect5.Indicator, {})
3269
+ /* @__PURE__ */ jsx19(NativeSelect5.Field, { value: String(value ?? ""), onChange: (event) => onChange(event.currentTarget.value), children: (filter.options ?? []).map((option) => /* @__PURE__ */ jsx19("option", { value: String(option.value ?? ""), children: option.label }, String(option.value ?? ""))) }),
3270
+ /* @__PURE__ */ jsx19(NativeSelect5.Indicator, {})
3179
3271
  ] });
3180
3272
  }
3181
- return /* @__PURE__ */ jsx18(
3273
+ return /* @__PURE__ */ jsx19(
3182
3274
  Input6,
3183
3275
  {
3184
3276
  w: "190px",
@@ -3269,9 +3361,9 @@ function CorePipeline({
3269
3361
  },
3270
3362
  onError: (error) => setFormError(error)
3271
3363
  });
3272
- if (schemaQuery.isLoading || viewMode === "board" && listQuery.isLoading) return /* @__PURE__ */ jsx18(LoadingScreen, {});
3273
- if (schemaQuery.isError) return /* @__PURE__ */ jsx18(ErrorState, { error: schemaQuery.error });
3274
- if (viewMode === "board" && listQuery.isError) return /* @__PURE__ */ jsx18(ErrorState, { error: listQuery.error });
3364
+ if (schemaQuery.isLoading || viewMode === "board" && listQuery.isLoading) return /* @__PURE__ */ jsx19(LoadingScreen, {});
3365
+ if (schemaQuery.isError) return /* @__PURE__ */ jsx19(ErrorState, { error: schemaQuery.error });
3366
+ if (viewMode === "board" && listQuery.isError) return /* @__PURE__ */ jsx19(ErrorState, { error: listQuery.error });
3275
3367
  const stageFieldMeta = schema?.fields.find((field) => field.name === stageField);
3276
3368
  const resolvedStages = stages ?? (stageFieldMeta?.options ?? []).map((option) => ({ id: option, label: option }));
3277
3369
  const defaultActionsConfig = defaultActions === false ? void 0 : defaultActions;
@@ -3312,7 +3404,7 @@ function CorePipeline({
3312
3404
  const step = pipelineBoardScrollStep(board.clientWidth);
3313
3405
  board.scrollBy({ left: direction === "left" ? -step : step, behavior: "smooth" });
3314
3406
  };
3315
- const renderModalAction = (action, index) => selectedTicket ? /* @__PURE__ */ jsx18(
3407
+ const renderModalAction = (action, index) => selectedTicket ? /* @__PURE__ */ jsx19(
3316
3408
  CoreRowAction,
3317
3409
  {
3318
3410
  action,
@@ -3331,29 +3423,29 @@ function CorePipeline({
3331
3423
  },
3332
3424
  action.id ?? `${action.label}-${index}`
3333
3425
  ) : null;
3334
- const modalTopActions = selectedTicket && !creating && groupedTicketActions.workStatus.length ? /* @__PURE__ */ jsx18(Flex8, { role: "group", "aria-label": "Status da atividade", gap: "6px", align: "center", wrap: "wrap", children: groupedTicketActions.workStatus.map(renderModalAction) }) : null;
3426
+ const modalTopActions = selectedTicket && !creating && groupedTicketActions.workStatus.length ? /* @__PURE__ */ jsx19(Flex8, { role: "group", "aria-label": "Status da atividade", gap: "6px", align: "center", wrap: "wrap", children: groupedTicketActions.workStatus.map(renderModalAction) }) : null;
3335
3427
  const modalBottomActions = selectedTicket && !creating ? /* @__PURE__ */ jsxs13(Flex8, { gap: "8px", align: "center", wrap: "wrap", children: [
3336
- groupedTicketActions.approval.length ? /* @__PURE__ */ jsx18(Flex8, { role: "group", "aria-label": "Aprova\xE7\xE3o do ticket", gap: "6px", align: "center", wrap: "wrap", children: groupedTicketActions.approval.map(renderModalAction) }) : null,
3337
- groupedTicketActions.custom.length ? /* @__PURE__ */ jsx18(Flex8, { role: "group", "aria-label": "A\xE7\xF5es do neg\xF3cio", gap: "6px", align: "center", wrap: "wrap", children: groupedTicketActions.custom.map(renderModalAction) }) : null
3428
+ groupedTicketActions.approval.length ? /* @__PURE__ */ jsx19(Flex8, { role: "group", "aria-label": "Aprova\xE7\xE3o do ticket", gap: "6px", align: "center", wrap: "wrap", children: groupedTicketActions.approval.map(renderModalAction) }) : null,
3429
+ groupedTicketActions.custom.length ? /* @__PURE__ */ jsx19(Flex8, { role: "group", "aria-label": "A\xE7\xF5es do neg\xF3cio", gap: "6px", align: "center", wrap: "wrap", children: groupedTicketActions.custom.map(renderModalAction) }) : null
3338
3430
  ] }) : null;
3339
3431
  return /* @__PURE__ */ jsxs13(Stack5, { gap: 5, children: [
3340
3432
  /* @__PURE__ */ jsxs13(Flex8, { align: { base: "stretch", md: "flex-end" }, justify: "space-between", gap: 4, direction: { base: "column", md: "row" }, children: [
3341
- /* @__PURE__ */ jsxs13(Box10, { children: [
3342
- /* @__PURE__ */ jsx18(Text12, { fontSize: "11px", fontWeight: "700", color: "brand.500", textTransform: "uppercase", letterSpacing: "0.08em", mb: 1, children: "Esteira de processo" }),
3343
- /* @__PURE__ */ jsx18(Heading5, { size: "lg", color: "#24323A", letterSpacing: "-0.02em", children: label ?? schema?.name ?? model }),
3344
- /* @__PURE__ */ jsx18(Text12, { mt: 1, fontSize: "13px", color: "gray.500", children: "Acompanhe os tickets por etapa e visualize os principais dados de cada item." })
3433
+ /* @__PURE__ */ jsxs13(Box11, { children: [
3434
+ /* @__PURE__ */ jsx19(Text12, { fontSize: "11px", fontWeight: "700", color: "brand.500", textTransform: "uppercase", letterSpacing: "0.08em", mb: 1, children: "Esteira de processo" }),
3435
+ /* @__PURE__ */ jsx19(Heading5, { size: "lg", color: "#24323A", letterSpacing: "-0.02em", children: label ?? schema?.name ?? model }),
3436
+ /* @__PURE__ */ jsx19(Text12, { mt: 1, fontSize: "13px", color: "gray.500", children: "Acompanhe os tickets por etapa e visualize os principais dados de cada item." })
3345
3437
  ] }),
3346
3438
  /* @__PURE__ */ jsxs13(Flex8, { gap: "8px", align: "center", wrap: "wrap", children: [
3347
- allowedViewModes.length > 1 ? allowedViewModes.map((mode) => /* @__PURE__ */ jsx18(Button9, { size: "sm", variant: viewMode === mode ? "solid" : "outline", colorPalette: "brand", onClick: () => setViewMode(mode), children: mode === "board" ? "Quadro" : "Lista" }, mode)) : null,
3348
- create?.enabled ? /* @__PURE__ */ jsx18(Button9, { size: "sm", colorPalette: "brand", onClick: openCreate, children: create.label ?? "Novo ticket" }) : null
3439
+ allowedViewModes.length > 1 ? allowedViewModes.map((mode) => /* @__PURE__ */ jsx19(Button9, { size: "sm", variant: viewMode === mode ? "solid" : "outline", colorPalette: "brand", onClick: () => setViewMode(mode), children: mode === "board" ? "Quadro" : "Lista" }, mode)) : null,
3440
+ create?.enabled ? /* @__PURE__ */ jsx19(Button9, { size: "sm", colorPalette: "brand", onClick: openCreate, children: create.label ?? "Novo ticket" }) : null
3349
3441
  ] })
3350
3442
  ] }),
3351
3443
  filters.length ? /* @__PURE__ */ jsxs13(Flex8, { p: "12px", gap: "10px", align: "flex-end", wrap: "wrap", bg: "white", borderWidth: "1px", borderColor: "#E5E9ED", borderRadius: "10px", children: [
3352
3444
  filters.map((filter) => {
3353
3445
  const meta = schema?.fields.find((field) => field.name === filter.field);
3354
- return /* @__PURE__ */ jsxs13(Box10, { children: [
3355
- /* @__PURE__ */ jsx18(Text12, { mb: "4px", fontSize: "10px", color: "#667085", fontWeight: "600", children: filter.label ?? fieldLabel({ name: filter.field }) }),
3356
- /* @__PURE__ */ jsx18(
3446
+ return /* @__PURE__ */ jsxs13(Box11, { children: [
3447
+ /* @__PURE__ */ jsx19(Text12, { mb: "4px", fontSize: "10px", color: "#667085", fontWeight: "600", children: filter.label ?? fieldLabel({ name: filter.field }) }),
3448
+ /* @__PURE__ */ jsx19(
3357
3449
  PipelineFilterControl,
3358
3450
  {
3359
3451
  filter,
@@ -3364,7 +3456,7 @@ function CorePipeline({
3364
3456
  )
3365
3457
  ] }, filter.field);
3366
3458
  }),
3367
- /* @__PURE__ */ jsx18(
3459
+ /* @__PURE__ */ jsx19(
3368
3460
  Button9,
3369
3461
  {
3370
3462
  size: "sm",
@@ -3374,7 +3466,7 @@ function CorePipeline({
3374
3466
  }
3375
3467
  )
3376
3468
  ] }) : null,
3377
- viewMode === "list" ? /* @__PURE__ */ jsx18(
3469
+ viewMode === "list" ? /* @__PURE__ */ jsx19(
3378
3470
  DataGrid,
3379
3471
  {
3380
3472
  resource,
@@ -3387,8 +3479,8 @@ function CorePipeline({
3387
3479
  setSelectedTicket(row);
3388
3480
  }
3389
3481
  }
3390
- ) : /* @__PURE__ */ jsxs13(Box10, { position: "relative", children: [
3391
- /* @__PURE__ */ jsx18(
3482
+ ) : /* @__PURE__ */ jsxs13(Box11, { position: "relative", children: [
3483
+ /* @__PURE__ */ jsx19(
3392
3484
  Flex8,
3393
3485
  {
3394
3486
  ref: boardRef,
@@ -3406,12 +3498,12 @@ function CorePipeline({
3406
3498
  overscrollBehaviorX: "contain",
3407
3499
  children: Array.from(byStage.entries()).map(([stageId, items]) => {
3408
3500
  const stageLabel = resolvedStages.find((stage) => stage.id === stageId)?.label ?? (stageId || "Sem etapa");
3409
- return /* @__PURE__ */ jsxs13(Box10, { minW: "300px", maxW: "340px", flex: "1 0 300px", bg: "#E8ECEF", borderRadius: "12px", p: 3, borderWidth: "1px", borderColor: "#DDE3E7", children: [
3501
+ return /* @__PURE__ */ jsxs13(Box11, { minW: "300px", maxW: "340px", flex: "1 0 300px", bg: "#E8ECEF", borderRadius: "12px", p: 3, borderWidth: "1px", borderColor: "#DDE3E7", children: [
3410
3502
  /* @__PURE__ */ jsxs13(Flex8, { align: "center", justify: "space-between", mb: 3, px: 1, children: [
3411
- /* @__PURE__ */ jsx18(Text12, { fontWeight: "700", fontSize: "12px", color: "#33434C", textTransform: "uppercase", letterSpacing: "0.03em", children: stageLabel }),
3412
- /* @__PURE__ */ jsx18(Badge4, { colorPalette: "brand", variant: "solid", borderRadius: "full", minW: "24px", justifyContent: "center", children: items.length })
3503
+ /* @__PURE__ */ jsx19(Text12, { fontWeight: "700", fontSize: "12px", color: "#33434C", textTransform: "uppercase", letterSpacing: "0.03em", children: stageLabel }),
3504
+ /* @__PURE__ */ jsx19(Badge4, { colorPalette: "brand", variant: "solid", borderRadius: "full", minW: "24px", justifyContent: "center", children: items.length })
3413
3505
  ] }),
3414
- /* @__PURE__ */ jsx18(Stack5, { gap: 2, children: items.length === 0 ? /* @__PURE__ */ jsx18(Box10, { borderWidth: "1px", borderStyle: "dashed", borderColor: "#C8D0D5", borderRadius: "10px", p: 5, textAlign: "center", children: /* @__PURE__ */ jsx18(Text12, { fontSize: "12px", color: "gray.500", children: "Nenhum ticket nesta etapa." }) }) : items.map((row, index) => {
3506
+ /* @__PURE__ */ jsx19(Stack5, { gap: 2, children: items.length === 0 ? /* @__PURE__ */ jsx19(Box11, { borderWidth: "1px", borderStyle: "dashed", borderColor: "#C8D0D5", borderRadius: "10px", p: 5, textAlign: "center", children: /* @__PURE__ */ jsx19(Text12, { fontSize: "12px", color: "gray.500", children: "Nenhum ticket nesta etapa." }) }) : items.map((row, index) => {
3415
3507
  const ticketTitle = formatCell(row[resolvedTitleField], "string");
3416
3508
  return /* @__PURE__ */ jsxs13(
3417
3509
  Button9,
@@ -3439,9 +3531,9 @@ function CorePipeline({
3439
3531
  _hover: { borderColor: "brand.300", transform: "translateY(-1px)", boxShadow: "0 7px 18px rgba(7, 38, 46, 0.09)" },
3440
3532
  children: [
3441
3533
  /* @__PURE__ */ jsxs13(Flex8, { align: "flex-start", justify: "space-between", gap: "8px", mb: 2, children: [
3442
- /* @__PURE__ */ jsx18(Text12, { fontSize: "13px", fontWeight: "700", color: "#24323A", lineClamp: 2, children: ticketTitle }),
3443
- /* @__PURE__ */ jsx18(
3444
- Box10,
3534
+ /* @__PURE__ */ jsx19(Text12, { fontSize: "13px", fontWeight: "700", color: "#24323A", lineClamp: 2, children: ticketTitle }),
3535
+ /* @__PURE__ */ jsx19(
3536
+ Box11,
3445
3537
  {
3446
3538
  as: "span",
3447
3539
  title: `Status da atividade: ${String(row[workStatusField] ?? "N\xE3o informado")}`,
@@ -3456,9 +3548,9 @@ function CorePipeline({
3456
3548
  }
3457
3549
  )
3458
3550
  ] }),
3459
- /* @__PURE__ */ jsx18(Stack5, { gap: 1, children: detailFields.map((field) => /* @__PURE__ */ jsxs13(Flex8, { gap: 2, align: "baseline", justify: "space-between", children: [
3460
- /* @__PURE__ */ jsx18(Text12, { fontSize: "10px", color: "gray.500", textTransform: "uppercase", letterSpacing: "0.03em", children: fieldLabel(field) }),
3461
- /* @__PURE__ */ jsx18(Text12, { fontSize: "11px", color: "#46545C", fontWeight: "500", textAlign: "right", lineClamp: 1, children: formatCell(row[field.name], field.kind) })
3551
+ /* @__PURE__ */ jsx19(Stack5, { gap: 1, children: detailFields.map((field) => /* @__PURE__ */ jsxs13(Flex8, { gap: 2, align: "baseline", justify: "space-between", children: [
3552
+ /* @__PURE__ */ jsx19(Text12, { fontSize: "10px", color: "gray.500", textTransform: "uppercase", letterSpacing: "0.03em", children: fieldLabel(field) }),
3553
+ /* @__PURE__ */ jsx19(Text12, { fontSize: "11px", color: "#46545C", fontWeight: "500", textAlign: "right", lineClamp: 1, children: formatCell(row[field.name], field.kind) })
3462
3554
  ] }, field.name)) })
3463
3555
  ]
3464
3556
  },
@@ -3469,7 +3561,7 @@ function CorePipeline({
3469
3561
  })
3470
3562
  }
3471
3563
  ),
3472
- /* @__PURE__ */ jsx18(
3564
+ /* @__PURE__ */ jsx19(
3473
3565
  Button9,
3474
3566
  {
3475
3567
  type: "button",
@@ -3493,10 +3585,10 @@ function CorePipeline({
3493
3585
  onClick: () => scrollBoard("left"),
3494
3586
  _hover: { bg: "white", borderColor: "brand.400" },
3495
3587
  _disabled: { opacity: 0.25, cursor: "not-allowed" },
3496
- children: /* @__PURE__ */ jsx18(PipelineArrowIcon, { direction: "left" })
3588
+ children: /* @__PURE__ */ jsx19(PipelineArrowIcon, { direction: "left" })
3497
3589
  }
3498
3590
  ),
3499
- /* @__PURE__ */ jsx18(
3591
+ /* @__PURE__ */ jsx19(
3500
3592
  Button9,
3501
3593
  {
3502
3594
  type: "button",
@@ -3520,11 +3612,11 @@ function CorePipeline({
3520
3612
  onClick: () => scrollBoard("right"),
3521
3613
  _hover: { bg: "white", borderColor: "brand.400" },
3522
3614
  _disabled: { opacity: 0.25, cursor: "not-allowed" },
3523
- children: /* @__PURE__ */ jsx18(PipelineArrowIcon, { direction: "right" })
3615
+ children: /* @__PURE__ */ jsx19(PipelineArrowIcon, { direction: "right" })
3524
3616
  }
3525
3617
  )
3526
3618
  ] }),
3527
- selectedTicket && ticketModal && ticketModal.enabled !== false ? /* @__PURE__ */ jsx18(
3619
+ selectedTicket && ticketModal && ticketModal.enabled !== false ? /* @__PURE__ */ jsx19(
3528
3620
  CoreDetailModal,
3529
3621
  {
3530
3622
  model,
@@ -3550,7 +3642,7 @@ function CorePipeline({
3550
3642
  }
3551
3643
  }
3552
3644
  }
3553
- ) : selectedTicket ? /* @__PURE__ */ jsx18(
3645
+ ) : selectedTicket ? /* @__PURE__ */ jsx19(
3554
3646
  DynamicForm,
3555
3647
  {
3556
3648
  title: `${creating ? "Novo" : "Editar"} ${schema?.singular ?? label ?? model}`,
@@ -3577,9 +3669,9 @@ function CorePipeline({
3577
3669
  }
3578
3670
 
3579
3671
  // src/components/CoreDashboard.tsx
3580
- import { Box as Box11, Heading as Heading6, SimpleGrid as SimpleGrid4, Stack as Stack6, Text as Text13 } from "@chakra-ui/react";
3672
+ import { Box as Box12, Heading as Heading6, SimpleGrid as SimpleGrid4, Stack as Stack6, Text as Text13 } from "@chakra-ui/react";
3581
3673
  import { useQueries } from "@tanstack/react-query";
3582
- import { jsx as jsx19, jsxs as jsxs14 } from "react/jsx-runtime";
3674
+ import { jsx as jsx20, jsxs as jsxs14 } from "react/jsx-runtime";
3583
3675
  function CoreDashboard({ label = "Dashboard", widgets = [] }) {
3584
3676
  const { resource } = useOonApi();
3585
3677
  const queries = useQueries({
@@ -3597,16 +3689,16 @@ function CoreDashboard({ label = "Dashboard", widgets = [] }) {
3597
3689
  });
3598
3690
  let queryIdx = 0;
3599
3691
  return /* @__PURE__ */ jsxs14(Stack6, { gap: 6, children: [
3600
- /* @__PURE__ */ jsx19(Heading6, { size: "lg", children: label }),
3601
- /* @__PURE__ */ jsx19(SimpleGrid4, { columns: { base: 1, md: 2, lg: 3 }, gap: 4, children: widgets.map((w) => {
3692
+ /* @__PURE__ */ jsx20(Heading6, { size: "lg", children: label }),
3693
+ /* @__PURE__ */ jsx20(SimpleGrid4, { columns: { base: 1, md: 2, lg: 3 }, gap: 4, children: widgets.map((w) => {
3602
3694
  if (w.kind === "custom" && w.render) {
3603
- return /* @__PURE__ */ jsx19(Box11, { borderWidth: "1px", borderColor: "gray.200", borderRadius: "md", bg: "white", p: 5, children: w.render() }, w.id);
3695
+ return /* @__PURE__ */ jsx20(Box12, { borderWidth: "1px", borderColor: "gray.200", borderRadius: "md", bg: "white", p: 5, children: w.render() }, w.id);
3604
3696
  }
3605
3697
  const q = queries[queryIdx++];
3606
3698
  const value = q?.isLoading ? "\u2026" : q?.isError ? "\u2014" : formatWidget(q?.data, w.kind, w.field);
3607
- return /* @__PURE__ */ jsxs14(Box11, { borderWidth: "1px", borderColor: "gray.200", borderRadius: "md", bg: "white", p: 5, children: [
3608
- /* @__PURE__ */ jsx19(Text13, { fontSize: "sm", color: "gray.500", children: w.label }),
3609
- /* @__PURE__ */ jsx19(Heading6, { size: "xl", mt: 1, children: value })
3699
+ return /* @__PURE__ */ jsxs14(Box12, { borderWidth: "1px", borderColor: "gray.200", borderRadius: "md", bg: "white", p: 5, children: [
3700
+ /* @__PURE__ */ jsx20(Text13, { fontSize: "sm", color: "gray.500", children: w.label }),
3701
+ /* @__PURE__ */ jsx20(Heading6, { size: "xl", mt: 1, children: value })
3610
3702
  ] }, w.id);
3611
3703
  }) })
3612
3704
  ] });
@@ -3620,22 +3712,22 @@ function formatWidget(value, kind, field) {
3620
3712
  }
3621
3713
 
3622
3714
  // src/components/ui-v2/CorePage.tsx
3623
- import { Box as Box14, Heading as Heading8, Stack as Stack7, Text as Text16 } from "@chakra-ui/react";
3715
+ import { Box as Box15, Heading as Heading8, Stack as Stack7, Text as Text16 } from "@chakra-ui/react";
3624
3716
 
3625
3717
  // src/security/PermissionGate.tsx
3626
- import { Fragment as Fragment3, jsx as jsx20 } from "react/jsx-runtime";
3718
+ import { Fragment as Fragment3, jsx as jsx21 } from "react/jsx-runtime";
3627
3719
  function PermissionGate({
3628
3720
  permission,
3629
3721
  fallback = null,
3630
3722
  children
3631
3723
  }) {
3632
3724
  const { hasPermission } = useOonAuth();
3633
- return /* @__PURE__ */ jsx20(Fragment3, { children: hasPermission(permission) ? children : fallback });
3725
+ return /* @__PURE__ */ jsx21(Fragment3, { children: hasPermission(permission) ? children : fallback });
3634
3726
  }
3635
3727
 
3636
3728
  // src/app/componentRegistry.tsx
3637
- import { Box as Box12, Text as Text14 } from "@chakra-ui/react";
3638
- import { Fragment as Fragment4, jsx as jsx21, jsxs as jsxs15 } from "react/jsx-runtime";
3729
+ import { Box as Box13, Text as Text14 } from "@chakra-ui/react";
3730
+ import { Fragment as Fragment4, jsx as jsx22, jsxs as jsxs15 } from "react/jsx-runtime";
3639
3731
  var PREFIX_BUCKETS = {
3640
3732
  "custom": "pageComponents",
3641
3733
  "fields": "fieldRenderers",
@@ -3655,12 +3747,12 @@ function resolveComponent(registry, key, bucket) {
3655
3747
  return registry?.[targetBucket]?.[normalized2] ?? registry?.[targetBucket]?.[key] ?? null;
3656
3748
  }
3657
3749
  function MissingRenderer({ renderer, children }) {
3658
- if (import.meta.env?.MODE === "production") return /* @__PURE__ */ jsx21(Fragment4, { children: children ?? null });
3659
- return /* @__PURE__ */ jsxs15(Box12, { borderWidth: "1px", borderStyle: "dashed", borderColor: "orange.300", bg: "orange.50", color: "orange.900", borderRadius: "md", p: 3, children: [
3660
- /* @__PURE__ */ jsx21(Text14, { fontSize: "sm", fontWeight: "600", children: "Renderer n\xE3o encontrado" }),
3750
+ if (import.meta.env?.MODE === "production") return /* @__PURE__ */ jsx22(Fragment4, { children: children ?? null });
3751
+ return /* @__PURE__ */ jsxs15(Box13, { borderWidth: "1px", borderStyle: "dashed", borderColor: "orange.300", bg: "orange.50", color: "orange.900", borderRadius: "md", p: 3, children: [
3752
+ /* @__PURE__ */ jsx22(Text14, { fontSize: "sm", fontWeight: "600", children: "Renderer n\xE3o encontrado" }),
3661
3753
  /* @__PURE__ */ jsxs15(Text14, { fontSize: "xs", children: [
3662
3754
  "Registre a chave ",
3663
- renderer ? /* @__PURE__ */ jsx21("code", { children: renderer }) : "solicitada",
3755
+ renderer ? /* @__PURE__ */ jsx22("code", { children: renderer }) : "solicitada",
3664
3756
  " no registry da UI."
3665
3757
  ] }),
3666
3758
  children
@@ -3668,61 +3760,61 @@ function MissingRenderer({ renderer, children }) {
3668
3760
  }
3669
3761
 
3670
3762
  // src/components/ui-v2/CorePrimitives.tsx
3671
- import { Box as Box13, Button as Button10, Flex as Flex9, Heading as Heading7, Spinner as Spinner3, Text as Text15 } from "@chakra-ui/react";
3672
- import { jsx as jsx22, jsxs as jsxs16 } from "react/jsx-runtime";
3763
+ import { Box as Box14, Button as Button10, Flex as Flex9, Heading as Heading7, Spinner as Spinner3, Text as Text15 } from "@chakra-ui/react";
3764
+ import { jsx as jsx23, jsxs as jsxs16 } from "react/jsx-runtime";
3673
3765
  function CorePage({ children }) {
3674
- return /* @__PURE__ */ jsx22(Box13, { children });
3766
+ return /* @__PURE__ */ jsx23(Box14, { children });
3675
3767
  }
3676
3768
  function CorePageHeader({ title, description, actions }) {
3677
3769
  return /* @__PURE__ */ jsxs16(Flex9, { align: "start", justify: "space-between", gap: 4, mb: 6, children: [
3678
- /* @__PURE__ */ jsxs16(Box13, { children: [
3679
- title ? /* @__PURE__ */ jsx22(Heading7, { size: "lg", children: title }) : null,
3680
- description ? /* @__PURE__ */ jsx22(Text15, { color: "gray.600", mt: 1, children: description }) : null
3770
+ /* @__PURE__ */ jsxs16(Box14, { children: [
3771
+ title ? /* @__PURE__ */ jsx23(Heading7, { size: "lg", children: title }) : null,
3772
+ description ? /* @__PURE__ */ jsx23(Text15, { color: "gray.600", mt: 1, children: description }) : null
3681
3773
  ] }),
3682
3774
  actions
3683
3775
  ] });
3684
3776
  }
3685
3777
  function CoreToolbar({ children }) {
3686
- return /* @__PURE__ */ jsx22(Flex9, { align: "center", gap: 2, mb: 4, children });
3778
+ return /* @__PURE__ */ jsx23(Flex9, { align: "center", gap: 2, mb: 4, children });
3687
3779
  }
3688
3780
  function CoreDataGrid(props) {
3689
- return /* @__PURE__ */ jsx22(CoreCollection, { ...props });
3781
+ return /* @__PURE__ */ jsx23(CoreCollection, { ...props });
3690
3782
  }
3691
3783
  function CoreCards(props) {
3692
- return /* @__PURE__ */ jsx22(CoreCollection, { model: props.model, mode: "minimal", label: props.model });
3784
+ return /* @__PURE__ */ jsx23(CoreCollection, { model: props.model, mode: "minimal", label: props.model });
3693
3785
  }
3694
3786
  function CoreForm(props) {
3695
- return /* @__PURE__ */ jsx22(Box13, { children: props.children });
3787
+ return /* @__PURE__ */ jsx23(Box14, { children: props.children });
3696
3788
  }
3697
3789
  function CoreField({ label, children }) {
3698
- return /* @__PURE__ */ jsxs16(Box13, { children: [
3699
- /* @__PURE__ */ jsx22(Text15, { fontSize: "sm", fontWeight: "600", children: label }),
3790
+ return /* @__PURE__ */ jsxs16(Box14, { children: [
3791
+ /* @__PURE__ */ jsx23(Text15, { fontSize: "sm", fontWeight: "600", children: label }),
3700
3792
  children
3701
3793
  ] });
3702
3794
  }
3703
3795
  function CoreRelationField(props) {
3704
- return /* @__PURE__ */ jsx22(CoreField, { ...props });
3796
+ return /* @__PURE__ */ jsx23(CoreField, { ...props });
3705
3797
  }
3706
3798
  function CoreActions({ children }) {
3707
- return /* @__PURE__ */ jsx22(Flex9, { gap: 2, children });
3799
+ return /* @__PURE__ */ jsx23(Flex9, { gap: 2, children });
3708
3800
  }
3709
3801
  function CoreEmptyState({ title = "Nenhum dado encontrado", actionLabel, onAction }) {
3710
- return /* @__PURE__ */ jsxs16(Box13, { textAlign: "center", py: 10, children: [
3711
- /* @__PURE__ */ jsx22(Text15, { children: title }),
3712
- actionLabel ? /* @__PURE__ */ jsx22(Button10, { mt: 3, onClick: onAction, children: actionLabel }) : null
3802
+ return /* @__PURE__ */ jsxs16(Box14, { textAlign: "center", py: 10, children: [
3803
+ /* @__PURE__ */ jsx23(Text15, { children: title }),
3804
+ actionLabel ? /* @__PURE__ */ jsx23(Button10, { mt: 3, onClick: onAction, children: actionLabel }) : null
3713
3805
  ] });
3714
3806
  }
3715
3807
  function CoreLoadingState({ label = "Carregando..." }) {
3716
3808
  return /* @__PURE__ */ jsxs16(Flex9, { align: "center", gap: 3, children: [
3717
- /* @__PURE__ */ jsx22(Spinner3, { size: "sm" }),
3718
- /* @__PURE__ */ jsx22(Text15, { children: label })
3809
+ /* @__PURE__ */ jsx23(Spinner3, { size: "sm" }),
3810
+ /* @__PURE__ */ jsx23(Text15, { children: label })
3719
3811
  ] });
3720
3812
  }
3721
3813
 
3722
3814
  // src/components/ui-v2/CorePage.tsx
3723
- import { jsx as jsx23, jsxs as jsxs17 } from "react/jsx-runtime";
3815
+ import { jsx as jsx24, jsxs as jsxs17 } from "react/jsx-runtime";
3724
3816
  function renderMarkdown(content) {
3725
- return content.split(/\n{2,}/).map((paragraph, index) => /* @__PURE__ */ jsx23(Text16, { whiteSpace: "pre-wrap", children: paragraph }, index));
3817
+ return content.split(/\n{2,}/).map((paragraph, index) => /* @__PURE__ */ jsx24(Text16, { whiteSpace: "pre-wrap", children: paragraph }, index));
3726
3818
  }
3727
3819
  function requiredAccess(source) {
3728
3820
  const values = [...source.permissions ?? [], ...source.capabilities ?? []].filter(Boolean);
@@ -3734,38 +3826,38 @@ function CoreBlock({ block, registry }) {
3734
3826
  switch (block.type) {
3735
3827
  case "custom": {
3736
3828
  const Component = resolveComponent(registry, block.component, "pageComponents");
3737
- return Component ? /* @__PURE__ */ jsx23(Component, { block, ...block.props }) : /* @__PURE__ */ jsx23(MissingRenderer, { renderer: block.component });
3829
+ return Component ? /* @__PURE__ */ jsx24(Component, { block, ...block.props }) : /* @__PURE__ */ jsx24(MissingRenderer, { renderer: block.component });
3738
3830
  }
3739
3831
  case "collection.datagrid":
3740
- return /* @__PURE__ */ jsx23(CoreDataGrid, { model: block.model, mode: block.mode, columns: block.columns, form: block.form, label: block.title ?? block.model });
3832
+ return /* @__PURE__ */ jsx24(CoreDataGrid, { model: block.model, mode: block.mode, columns: block.columns, form: block.form, label: block.title ?? block.model });
3741
3833
  case "collection.cards": {
3742
3834
  const Component = resolveComponent(registry, block.renderer, "cardRenderers");
3743
- return Component ? /* @__PURE__ */ jsx23(Component, { block, model: block.model }) : /* @__PURE__ */ jsx23(CoreCards, { model: block.model, renderer: block.renderer });
3835
+ return Component ? /* @__PURE__ */ jsx24(Component, { block, model: block.model }) : /* @__PURE__ */ jsx24(CoreCards, { model: block.model, renderer: block.renderer });
3744
3836
  }
3745
3837
  case "section":
3746
- return /* @__PURE__ */ jsxs17(Box14, { children: [
3747
- /* @__PURE__ */ jsx23(Heading8, { size: "md", mb: block.description ? 1 : 4, children: block.title }),
3748
- block.description ? /* @__PURE__ */ jsx23(Text16, { color: "gray.600", mb: 4, children: block.description }) : null,
3749
- /* @__PURE__ */ jsx23(Stack7, { gap: 4, children: block.blocks?.map((child, index) => /* @__PURE__ */ jsx23(CoreBlock, { block: child, registry }, child.id ?? index)) })
3838
+ return /* @__PURE__ */ jsxs17(Box15, { children: [
3839
+ /* @__PURE__ */ jsx24(Heading8, { size: "md", mb: block.description ? 1 : 4, children: block.title }),
3840
+ block.description ? /* @__PURE__ */ jsx24(Text16, { color: "gray.600", mb: 4, children: block.description }) : null,
3841
+ /* @__PURE__ */ jsx24(Stack7, { gap: 4, children: block.blocks?.map((child, index) => /* @__PURE__ */ jsx24(CoreBlock, { block: child, registry }, child.id ?? index)) })
3750
3842
  ] });
3751
3843
  case "markdown":
3752
- return /* @__PURE__ */ jsx23(Stack7, { gap: 2, children: renderMarkdown(block.content) });
3844
+ return /* @__PURE__ */ jsx24(Stack7, { gap: 2, children: renderMarkdown(block.content) });
3753
3845
  default:
3754
- return /* @__PURE__ */ jsx23(MissingRenderer, { renderer: block.type });
3846
+ return /* @__PURE__ */ jsx24(MissingRenderer, { renderer: block.type });
3755
3847
  }
3756
3848
  })();
3757
- return /* @__PURE__ */ jsx23(PermissionGate, { permission: requiredAccess(block), children: content });
3849
+ return /* @__PURE__ */ jsx24(PermissionGate, { permission: requiredAccess(block), children: content });
3758
3850
  }
3759
3851
  function CorePage2({ page, registry }) {
3760
3852
  const Component = resolveComponent(registry, page.component, "pageComponents");
3761
- return /* @__PURE__ */ jsx23(PermissionGate, { permission: requiredAccess(page), children: Component ? /* @__PURE__ */ jsx23(Component, { page }) : /* @__PURE__ */ jsxs17(CorePage, { children: [
3762
- /* @__PURE__ */ jsx23(CorePageHeader, { title: page.title ?? page.label }),
3763
- /* @__PURE__ */ jsx23(Stack7, { gap: 6, children: page.blocks?.map((block, index) => /* @__PURE__ */ jsx23(CoreBlock, { block, registry }, block.id ?? index)) })
3853
+ return /* @__PURE__ */ jsx24(PermissionGate, { permission: requiredAccess(page), children: Component ? /* @__PURE__ */ jsx24(Component, { page }) : /* @__PURE__ */ jsxs17(CorePage, { children: [
3854
+ /* @__PURE__ */ jsx24(CorePageHeader, { title: page.title ?? page.label }),
3855
+ /* @__PURE__ */ jsx24(Stack7, { gap: 6, children: page.blocks?.map((block, index) => /* @__PURE__ */ jsx24(CoreBlock, { block, registry }, block.id ?? index)) })
3764
3856
  ] }) });
3765
3857
  }
3766
3858
 
3767
3859
  // src/app/moduleRegistry.tsx
3768
- import { jsx as jsx24 } from "react/jsx-runtime";
3860
+ import { jsx as jsx25 } from "react/jsx-runtime";
3769
3861
  function slug2(value) {
3770
3862
  return value.normalize("NFD").replace(/[\u0300-\u036f]/g, "").toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "");
3771
3863
  }
@@ -3792,7 +3884,7 @@ function renderView(view, registry) {
3792
3884
  switch (view.type) {
3793
3885
  case "collection": {
3794
3886
  const v = view;
3795
- return /* @__PURE__ */ jsx24(
3887
+ return /* @__PURE__ */ jsx25(
3796
3888
  CoreCollection,
3797
3889
  {
3798
3890
  model: v.model,
@@ -3811,11 +3903,11 @@ function renderView(view, registry) {
3811
3903
  }
3812
3904
  case "document": {
3813
3905
  const v = view;
3814
- return /* @__PURE__ */ jsx24(CoreDocument, { model: v.model, label: viewLabel(v), approval: v.approval, attachments: v.attachments });
3906
+ return /* @__PURE__ */ jsx25(CoreDocument, { model: v.model, label: viewLabel(v), approval: v.approval, attachments: v.attachments });
3815
3907
  }
3816
3908
  case "pipeline": {
3817
3909
  const v = view;
3818
- return /* @__PURE__ */ jsx24(
3910
+ return /* @__PURE__ */ jsx25(
3819
3911
  CorePipeline,
3820
3912
  {
3821
3913
  model: v.model,
@@ -3838,7 +3930,7 @@ function renderView(view, registry) {
3838
3930
  }
3839
3931
  case "dashboard": {
3840
3932
  const v = view;
3841
- return /* @__PURE__ */ jsx24(CoreDashboard, { label: viewLabel(v), widgets: v.widgets });
3933
+ return /* @__PURE__ */ jsx25(CoreDashboard, { label: viewLabel(v), widgets: v.widgets });
3842
3934
  }
3843
3935
  default:
3844
3936
  return null;
@@ -3852,7 +3944,7 @@ function viewToRoute(view, registry) {
3852
3944
  };
3853
3945
  }
3854
3946
  function pageToRoute(page, registry) {
3855
- return { path: page.path, element: /* @__PURE__ */ jsx24(CorePage2, { page, registry }), permissions: requiredAccess2(page) };
3947
+ return { path: page.path, element: /* @__PURE__ */ jsx25(CorePage2, { page, registry }), permissions: requiredAccess2(page) };
3856
3948
  }
3857
3949
  function pageToMenu(page) {
3858
3950
  if (page.hidden || !page.label) return null;
@@ -3914,13 +4006,13 @@ import {
3914
4006
  } from "react-router-dom";
3915
4007
 
3916
4008
  // src/shell/DefaultShell.tsx
3917
- import { Box as Box16, Button as Button11, Flex as Flex11, Spacer as Spacer2, Text as Text18 } from "@chakra-ui/react";
4009
+ import { Box as Box17, Button as Button11, Flex as Flex11, Spacer as Spacer2, Text as Text18 } from "@chakra-ui/react";
3918
4010
  import { Outlet } from "react-router-dom";
3919
4011
 
3920
4012
  // src/shell/Sidebar.tsx
3921
- import { Box as Box15, Flex as Flex10, Image, Stack as Stack8, Text as Text17 } from "@chakra-ui/react";
4013
+ import { Box as Box16, Flex as Flex10, Image, Stack as Stack8, Text as Text17 } from "@chakra-ui/react";
3922
4014
  import { NavLink } from "react-router-dom";
3923
- import { jsx as jsx25, jsxs as jsxs18 } from "react/jsx-runtime";
4015
+ import { jsx as jsx26, jsxs as jsxs18 } from "react/jsx-runtime";
3924
4016
  function groupBySection(items) {
3925
4017
  const groups = /* @__PURE__ */ new Map();
3926
4018
  for (const item of items) {
@@ -3934,7 +4026,7 @@ function Sidebar({ app, menu, registry }) {
3934
4026
  const { hasPermission } = useOonAuth();
3935
4027
  const visible = menu.filter((item) => !item.hidden && hasPermission(item.permissions));
3936
4028
  return /* @__PURE__ */ jsxs18(
3937
- Box15,
4029
+ Box16,
3938
4030
  {
3939
4031
  as: "nav",
3940
4032
  w: { base: "76px", lg: "248px" },
@@ -3950,7 +4042,7 @@ function Sidebar({ app, menu, registry }) {
3950
4042
  overflowY: "auto",
3951
4043
  children: [
3952
4044
  /* @__PURE__ */ jsxs18(Flex10, { align: "center", gap: 3, mb: 6, px: { base: 1, lg: 2 }, minH: "42px", children: [
3953
- app.logo ? /* @__PURE__ */ jsx25(Image, { src: app.logo, alt: app.name, maxH: "36px", maxW: { base: "44px", lg: "150px" }, objectFit: "contain" }) : /* @__PURE__ */ jsx25(
4045
+ app.logo ? /* @__PURE__ */ jsx26(Image, { src: app.logo, alt: app.name, maxH: "36px", maxW: { base: "44px", lg: "150px" }, objectFit: "contain" }) : /* @__PURE__ */ jsx26(
3954
4046
  Flex10,
3955
4047
  {
3956
4048
  w: "38px",
@@ -3966,13 +4058,13 @@ function Sidebar({ app, menu, registry }) {
3966
4058
  children: "O"
3967
4059
  }
3968
4060
  ),
3969
- /* @__PURE__ */ jsxs18(Box15, { display: { base: "none", lg: "block" }, minW: 0, children: [
3970
- /* @__PURE__ */ jsx25(Text17, { fontWeight: "700", fontSize: "sm", color: "#07262E", lineClamp: 1, children: app.name }),
3971
- /* @__PURE__ */ jsx25(Text17, { fontSize: "10px", color: "gray.500", textTransform: "uppercase", letterSpacing: "0.08em", children: "Opera\xE7\xE3o digital" })
4061
+ /* @__PURE__ */ jsxs18(Box16, { display: { base: "none", lg: "block" }, minW: 0, children: [
4062
+ /* @__PURE__ */ jsx26(Text17, { fontWeight: "700", fontSize: "sm", color: "#07262E", lineClamp: 1, children: app.name }),
4063
+ /* @__PURE__ */ jsx26(Text17, { fontSize: "10px", color: "gray.500", textTransform: "uppercase", letterSpacing: "0.08em", children: "Opera\xE7\xE3o digital" })
3972
4064
  ] })
3973
4065
  ] }),
3974
- /* @__PURE__ */ jsx25(Stack8, { gap: 5, children: groupBySection(visible).map(([section, items]) => /* @__PURE__ */ jsxs18(Stack8, { gap: 1, children: [
3975
- /* @__PURE__ */ jsx25(
4066
+ /* @__PURE__ */ jsx26(Stack8, { gap: 5, children: groupBySection(visible).map(([section, items]) => /* @__PURE__ */ jsxs18(Stack8, { gap: 1, children: [
4067
+ /* @__PURE__ */ jsx26(
3976
4068
  Text17,
3977
4069
  {
3978
4070
  display: { base: "none", lg: "block" },
@@ -3988,8 +4080,8 @@ function Sidebar({ app, menu, registry }) {
3988
4080
  ),
3989
4081
  items.map((item) => {
3990
4082
  const CustomMenuItem = resolveComponent(registry, item.renderer, "menuRenderers");
3991
- if (CustomMenuItem) return /* @__PURE__ */ jsx25(CustomMenuItem, { item }, item.href);
3992
- return /* @__PURE__ */ jsx25(NavLink, { to: item.href, end: item.href === "/", title: item.label, children: ({ isActive }) => /* @__PURE__ */ jsxs18(
4083
+ if (CustomMenuItem) return /* @__PURE__ */ jsx26(CustomMenuItem, { item }, item.href);
4084
+ return /* @__PURE__ */ jsx26(NavLink, { to: item.href, end: item.href === "/", title: item.label, children: ({ isActive }) => /* @__PURE__ */ jsxs18(
3993
4085
  Flex10,
3994
4086
  {
3995
4087
  align: "center",
@@ -4007,8 +4099,8 @@ function Sidebar({ app, menu, registry }) {
4007
4099
  transition: "all 0.15s ease",
4008
4100
  _hover: { bg: isActive ? "brand.50" : "#F8F9FA", color: "brand.700" },
4009
4101
  children: [
4010
- item.icon ? /* @__PURE__ */ jsx25(Box15, { flex: "0 0 auto", children: item.icon }) : /* @__PURE__ */ jsx25(Box15, { w: "7px", h: "7px", borderRadius: "full", bg: isActive ? "brand.500" : "gray.300" }),
4011
- /* @__PURE__ */ jsx25(Text17, { display: { base: "none", lg: "block" }, lineClamp: 1, children: item.label })
4102
+ item.icon ? /* @__PURE__ */ jsx26(Box16, { flex: "0 0 auto", children: item.icon }) : /* @__PURE__ */ jsx26(Box16, { w: "7px", h: "7px", borderRadius: "full", bg: isActive ? "brand.500" : "gray.300" }),
4103
+ /* @__PURE__ */ jsx26(Text17, { display: { base: "none", lg: "block" }, lineClamp: 1, children: item.label })
4012
4104
  ]
4013
4105
  }
4014
4106
  ) }, item.href);
@@ -4020,21 +4112,21 @@ function Sidebar({ app, menu, registry }) {
4020
4112
  }
4021
4113
 
4022
4114
  // src/shell/DefaultShell.tsx
4023
- import { jsx as jsx26, jsxs as jsxs19 } from "react/jsx-runtime";
4115
+ import { jsx as jsx27, jsxs as jsxs19 } from "react/jsx-runtime";
4024
4116
  function CoreTopbar({ app }) {
4025
4117
  const { user, logout } = useOonAuth();
4026
4118
  return /* @__PURE__ */ jsxs19(Flex11, { as: "header", align: "center", minH: "64px", px: { base: 4, lg: 6 }, py: 3, borderBottomWidth: "1px", borderColor: "#E8ECEF", bg: "rgba(255, 255, 255, 0.96)", backdropFilter: "blur(10px)", position: "sticky", top: 0, zIndex: 10, children: [
4027
- /* @__PURE__ */ jsxs19(Box16, { children: [
4028
- /* @__PURE__ */ jsx26(Text18, { fontSize: "xs", fontWeight: "600", color: "brand.500", textTransform: "uppercase", letterSpacing: "0.08em", children: "Central Oon" }),
4029
- /* @__PURE__ */ jsx26(Text18, { fontSize: "sm", fontWeight: "600", color: "#24323A", children: app.title ?? app.name })
4119
+ /* @__PURE__ */ jsxs19(Box17, { children: [
4120
+ /* @__PURE__ */ jsx27(Text18, { fontSize: "xs", fontWeight: "600", color: "brand.500", textTransform: "uppercase", letterSpacing: "0.08em", children: "Central Oon" }),
4121
+ /* @__PURE__ */ jsx27(Text18, { fontSize: "sm", fontWeight: "600", color: "#24323A", children: app.title ?? app.name })
4030
4122
  ] }),
4031
- /* @__PURE__ */ jsx26(Spacer2, {}),
4123
+ /* @__PURE__ */ jsx27(Spacer2, {}),
4032
4124
  user ? /* @__PURE__ */ jsxs19(Flex11, { align: "center", gap: 3, children: [
4033
- /* @__PURE__ */ jsxs19(Box16, { textAlign: "right", display: { base: "none", md: "block" }, children: [
4034
- /* @__PURE__ */ jsx26(Text18, { fontSize: "sm", fontWeight: "600", color: "#24323A", children: user.nome }),
4035
- user.email ? /* @__PURE__ */ jsx26(Text18, { fontSize: "xs", color: "gray.500", children: user.email }) : null
4125
+ /* @__PURE__ */ jsxs19(Box17, { textAlign: "right", display: { base: "none", md: "block" }, children: [
4126
+ /* @__PURE__ */ jsx27(Text18, { fontSize: "sm", fontWeight: "600", color: "#24323A", children: user.nome }),
4127
+ user.email ? /* @__PURE__ */ jsx27(Text18, { fontSize: "xs", color: "gray.500", children: user.email }) : null
4036
4128
  ] }),
4037
- /* @__PURE__ */ jsx26(Button11, { size: "sm", variant: "outline", colorPalette: "brand", borderRadius: "8px", onClick: logout, children: "Sair" })
4129
+ /* @__PURE__ */ jsx27(Button11, { size: "sm", variant: "outline", colorPalette: "brand", borderRadius: "8px", onClick: logout, children: "Sair" })
4038
4130
  ] }) : null
4039
4131
  ] });
4040
4132
  }
@@ -4042,45 +4134,45 @@ function Slot({ name, slot, registry, app, menu }) {
4042
4134
  if (slot === "none") return null;
4043
4135
  if (slot?.startsWith("custom:")) {
4044
4136
  const C = resolveComponent(registry, slot, "layoutSlots");
4045
- return C ? /* @__PURE__ */ jsx26(C, { app, menu }) : /* @__PURE__ */ jsx26(MissingRenderer, { renderer: slot });
4137
+ return C ? /* @__PURE__ */ jsx27(C, { app, menu }) : /* @__PURE__ */ jsx27(MissingRenderer, { renderer: slot });
4046
4138
  }
4047
- if (name === "sidebar") return /* @__PURE__ */ jsx26(Sidebar, { app, menu, registry });
4048
- if (name === "topbar") return /* @__PURE__ */ jsx26(CoreTopbar, { app });
4049
- if (name === "footer" && slot === "core") return /* @__PURE__ */ jsx26(Box16, { as: "footer", px: 6, py: 4, color: "gray.500", fontSize: "xs", borderTopWidth: "1px", children: "OonCore" });
4139
+ if (name === "sidebar") return /* @__PURE__ */ jsx27(Sidebar, { app, menu, registry });
4140
+ if (name === "topbar") return /* @__PURE__ */ jsx27(CoreTopbar, { app });
4141
+ if (name === "footer" && slot === "core") return /* @__PURE__ */ jsx27(Box17, { as: "footer", px: 6, py: 4, color: "gray.500", fontSize: "xs", borderTopWidth: "1px", children: "OonCore" });
4050
4142
  return null;
4051
4143
  }
4052
4144
  function DefaultShell({ app, menu, layout, registry }) {
4053
4145
  const portal = layout?.shell === "portal" || layout?.shell === "content-only";
4054
4146
  const mainPadding = portal ? { base: 4, lg: 10 } : { base: 4, lg: 6 };
4055
4147
  return /* @__PURE__ */ jsxs19(Flex11, { align: "stretch", minH: "100vh", bg: portal ? "white" : "#F8F9FA", children: [
4056
- /* @__PURE__ */ jsx26(Slot, { name: "sidebar", slot: layout?.sidebar ?? "core", registry, app, menu }),
4148
+ /* @__PURE__ */ jsx27(Slot, { name: "sidebar", slot: layout?.sidebar ?? "core", registry, app, menu }),
4057
4149
  /* @__PURE__ */ jsxs19(Flex11, { direction: "column", flex: "1", minW: 0, children: [
4058
- /* @__PURE__ */ jsx26(Slot, { name: "topbar", slot: layout?.topbar ?? "core", registry, app, menu }),
4059
- /* @__PURE__ */ jsx26(Slot, { name: "header", slot: layout?.header, registry, app, menu }),
4060
- /* @__PURE__ */ jsx26(Box16, { as: "main", flex: "1", p: mainPadding, minW: 0, children: /* @__PURE__ */ jsx26(Box16, { maxW: portal ? "1180px" : "1680px", mx: "auto", children: /* @__PURE__ */ jsx26(Outlet, {}) }) }),
4061
- /* @__PURE__ */ jsx26(Slot, { name: "footer", slot: layout?.footer ?? "none", registry, app, menu })
4150
+ /* @__PURE__ */ jsx27(Slot, { name: "topbar", slot: layout?.topbar ?? "core", registry, app, menu }),
4151
+ /* @__PURE__ */ jsx27(Slot, { name: "header", slot: layout?.header, registry, app, menu }),
4152
+ /* @__PURE__ */ jsx27(Box17, { as: "main", flex: "1", p: mainPadding, minW: 0, children: /* @__PURE__ */ jsx27(Box17, { maxW: portal ? "1180px" : "1680px", mx: "auto", children: /* @__PURE__ */ jsx27(Outlet, {}) }) }),
4153
+ /* @__PURE__ */ jsx27(Slot, { name: "footer", slot: layout?.footer ?? "none", registry, app, menu })
4062
4154
  ] })
4063
4155
  ] });
4064
4156
  }
4065
4157
  function PortalShell(props) {
4066
- return /* @__PURE__ */ jsx26(DefaultShell, { ...props, layout: { ...props.layout, shell: "portal" } });
4158
+ return /* @__PURE__ */ jsx27(DefaultShell, { ...props, layout: { ...props.layout, shell: "portal" } });
4067
4159
  }
4068
4160
 
4069
4161
  // src/shell/AuthenticatedLayout.tsx
4070
- import { jsx as jsx27 } from "react/jsx-runtime";
4162
+ import { jsx as jsx28 } from "react/jsx-runtime";
4071
4163
  function AuthenticatedLayout({ app, menu, layout, registry }) {
4072
4164
  if (layout?.shell?.startsWith("custom:")) {
4073
4165
  const CustomShell = resolveComponent(registry, layout.shell, "layoutSlots");
4074
- return CustomShell ? /* @__PURE__ */ jsx27(CustomShell, { app, menu, layout }) : /* @__PURE__ */ jsx27(MissingRenderer, { renderer: layout.shell });
4166
+ return CustomShell ? /* @__PURE__ */ jsx28(CustomShell, { app, menu, layout }) : /* @__PURE__ */ jsx28(MissingRenderer, { renderer: layout.shell });
4075
4167
  }
4076
- if (layout?.shell === "portal") return /* @__PURE__ */ jsx27(PortalShell, { app, menu, layout, registry });
4077
- return /* @__PURE__ */ jsx27(DefaultShell, { app, menu, layout, registry });
4168
+ if (layout?.shell === "portal") return /* @__PURE__ */ jsx28(PortalShell, { app, menu, layout, registry });
4169
+ return /* @__PURE__ */ jsx28(DefaultShell, { app, menu, layout, registry });
4078
4170
  }
4079
4171
 
4080
4172
  // src/security/AccessDeniedPage.tsx
4081
- import { Box as Box17, Button as Button12, Flex as Flex12, Heading as Heading9, Text as Text19, VStack } from "@chakra-ui/react";
4173
+ import { Box as Box18, Button as Button12, Flex as Flex12, Heading as Heading9, Text as Text19, VStack } from "@chakra-ui/react";
4082
4174
  import { useNavigate } from "react-router-dom";
4083
- import { jsx as jsx28, jsxs as jsxs20 } from "react/jsx-runtime";
4175
+ import { jsx as jsx29, jsxs as jsxs20 } from "react/jsx-runtime";
4084
4176
  function AccessDeniedPage({ app }) {
4085
4177
  const { logout } = useOonAuth();
4086
4178
  const navigate = useNavigate();
@@ -4088,8 +4180,8 @@ function AccessDeniedPage({ app }) {
4088
4180
  logout();
4089
4181
  navigate("/login", { replace: true });
4090
4182
  }
4091
- return /* @__PURE__ */ jsx28(Flex12, { minH: "100vh", align: "center", justify: "center", bg: "#F5F8FA", px: 4, children: /* @__PURE__ */ jsx28(
4092
- Box17,
4183
+ return /* @__PURE__ */ jsx29(Flex12, { minH: "100vh", align: "center", justify: "center", bg: "#F5F8FA", px: 4, children: /* @__PURE__ */ jsx29(
4184
+ Box18,
4093
4185
  {
4094
4186
  width: "100%",
4095
4187
  maxW: "560px",
@@ -4100,8 +4192,8 @@ function AccessDeniedPage({ app }) {
4100
4192
  boxShadow: "0 24px 70px rgba(7, 38, 46, 0.10)",
4101
4193
  p: { base: 6, md: 10 },
4102
4194
  children: /* @__PURE__ */ jsxs20(VStack, { align: "stretch", gap: 6, children: [
4103
- /* @__PURE__ */ jsx28(
4104
- Box17,
4195
+ /* @__PURE__ */ jsx29(
4196
+ Box18,
4105
4197
  {
4106
4198
  width: "56px",
4107
4199
  height: "56px",
@@ -4117,8 +4209,8 @@ function AccessDeniedPage({ app }) {
4117
4209
  children: "!"
4118
4210
  }
4119
4211
  ),
4120
- /* @__PURE__ */ jsxs20(Box17, { children: [
4121
- /* @__PURE__ */ jsx28(
4212
+ /* @__PURE__ */ jsxs20(Box18, { children: [
4213
+ /* @__PURE__ */ jsx29(
4122
4214
  Text19,
4123
4215
  {
4124
4216
  color: "#39BFED",
@@ -4129,14 +4221,14 @@ function AccessDeniedPage({ app }) {
4129
4221
  children: "Acesso negado"
4130
4222
  }
4131
4223
  ),
4132
- /* @__PURE__ */ jsx28(Heading9, { mt: 2, size: "lg", color: "#07262E", children: "Voc\xEA n\xE3o possui permiss\xE3o para este aplicativo" }),
4224
+ /* @__PURE__ */ jsx29(Heading9, { mt: 2, size: "lg", color: "#07262E", children: "Voc\xEA n\xE3o possui permiss\xE3o para este aplicativo" }),
4133
4225
  /* @__PURE__ */ jsxs20(Text19, { mt: 3, color: "gray.600", children: [
4134
4226
  "Seu usu\xE1rio foi autenticado, mas n\xE3o existe uma permiss\xE3o ativa para acessar ",
4135
4227
  app.title ?? app.name,
4136
4228
  ". Solicite o acesso ao administrador da sua organiza\xE7\xE3o."
4137
4229
  ] })
4138
4230
  ] }),
4139
- /* @__PURE__ */ jsx28(
4231
+ /* @__PURE__ */ jsx29(
4140
4232
  Button12,
4141
4233
  {
4142
4234
  alignSelf: "flex-start",
@@ -4154,7 +4246,7 @@ function AccessDeniedPage({ app }) {
4154
4246
 
4155
4247
  // src/security/AppAccessGuard.tsx
4156
4248
  import { Navigate, useLocation } from "react-router-dom";
4157
- import { Fragment as Fragment5, jsx as jsx29 } from "react/jsx-runtime";
4249
+ import { Fragment as Fragment5, jsx as jsx30 } from "react/jsx-runtime";
4158
4250
  function loginRedirect(pathname, search) {
4159
4251
  const destination = `${pathname}${search}`;
4160
4252
  return `/login?redirect=${encodeURIComponent(destination)}`;
@@ -4162,9 +4254,9 @@ function loginRedirect(pathname, search) {
4162
4254
  function AppAccessGuard({ children }) {
4163
4255
  const { status, retry } = useOonAuth();
4164
4256
  const location = useLocation();
4165
- if (status === "loading") return /* @__PURE__ */ jsx29(LoadingScreen, {});
4257
+ if (status === "loading") return /* @__PURE__ */ jsx30(LoadingScreen, {});
4166
4258
  if (status === "unauthenticated") {
4167
- return /* @__PURE__ */ jsx29(
4259
+ return /* @__PURE__ */ jsx30(
4168
4260
  Navigate,
4169
4261
  {
4170
4262
  to: loginRedirect(location.pathname, location.search),
@@ -4173,10 +4265,10 @@ function AppAccessGuard({ children }) {
4173
4265
  );
4174
4266
  }
4175
4267
  if (status === "forbidden") {
4176
- return /* @__PURE__ */ jsx29(Navigate, { to: "/acesso-negado", replace: true });
4268
+ return /* @__PURE__ */ jsx30(Navigate, { to: "/acesso-negado", replace: true });
4177
4269
  }
4178
4270
  if (status === "error") {
4179
- return /* @__PURE__ */ jsx29(
4271
+ return /* @__PURE__ */ jsx30(
4180
4272
  LoadingScreen,
4181
4273
  {
4182
4274
  message: "N\xE3o foi poss\xEDvel validar seu acesso. Tente novamente.",
@@ -4187,13 +4279,13 @@ function AppAccessGuard({ children }) {
4187
4279
  }
4188
4280
  );
4189
4281
  }
4190
- return /* @__PURE__ */ jsx29(Fragment5, { children });
4282
+ return /* @__PURE__ */ jsx30(Fragment5, { children });
4191
4283
  }
4192
4284
 
4193
4285
  // src/security/LoginPage.tsx
4194
4286
  import { useState as useState12 } from "react";
4195
4287
  import {
4196
- Box as Box18,
4288
+ Box as Box19,
4197
4289
  Button as Button13,
4198
4290
  Flex as Flex13,
4199
4291
  Heading as Heading10,
@@ -4202,7 +4294,7 @@ import {
4202
4294
  VStack as VStack2
4203
4295
  } from "@chakra-ui/react";
4204
4296
  import { Navigate as Navigate2, useLocation as useLocation2 } from "react-router-dom";
4205
- import { jsx as jsx30, jsxs as jsxs21 } from "react/jsx-runtime";
4297
+ import { jsx as jsx31, jsxs as jsxs21 } from "react/jsx-runtime";
4206
4298
  function safeRedirect(search) {
4207
4299
  const value = new URLSearchParams(search).get("redirect") || "/";
4208
4300
  if (!value.startsWith("/") || value.startsWith("//")) return "/";
@@ -4220,10 +4312,10 @@ function LoginPage({ app }) {
4220
4312
  const [message, setMessage] = useState12(null);
4221
4313
  const redirect = safeRedirect(location.search);
4222
4314
  if (status === "authenticated") {
4223
- return /* @__PURE__ */ jsx30(Navigate2, { to: redirect, replace: true });
4315
+ return /* @__PURE__ */ jsx31(Navigate2, { to: redirect, replace: true });
4224
4316
  }
4225
4317
  if (status === "forbidden") {
4226
- return /* @__PURE__ */ jsx30(Navigate2, { to: "/acesso-negado", replace: true });
4318
+ return /* @__PURE__ */ jsx31(Navigate2, { to: "/acesso-negado", replace: true });
4227
4319
  }
4228
4320
  async function handleSubmit(event) {
4229
4321
  event.preventDefault();
@@ -4241,8 +4333,8 @@ function LoginPage({ app }) {
4241
4333
  setSubmitting(false);
4242
4334
  }
4243
4335
  }
4244
- return /* @__PURE__ */ jsx30(Flex13, { minH: "100vh", align: "center", justify: "center", bg: "#F5F8FA", px: 4, children: /* @__PURE__ */ jsx30(
4245
- Box18,
4336
+ return /* @__PURE__ */ jsx31(Flex13, { minH: "100vh", align: "center", justify: "center", bg: "#F5F8FA", px: 4, children: /* @__PURE__ */ jsx31(
4337
+ Box19,
4246
4338
  {
4247
4339
  width: "100%",
4248
4340
  maxW: "440px",
@@ -4252,9 +4344,9 @@ function LoginPage({ app }) {
4252
4344
  borderRadius: "18px",
4253
4345
  boxShadow: "0 24px 70px rgba(7, 38, 46, 0.10)",
4254
4346
  p: { base: 6, md: 9 },
4255
- children: /* @__PURE__ */ jsx30("form", { onSubmit: handleSubmit, children: /* @__PURE__ */ jsxs21(VStack2, { align: "stretch", gap: 6, children: [
4256
- /* @__PURE__ */ jsxs21(Box18, { children: [
4257
- /* @__PURE__ */ jsx30(
4347
+ children: /* @__PURE__ */ jsx31("form", { onSubmit: handleSubmit, children: /* @__PURE__ */ jsxs21(VStack2, { align: "stretch", gap: 6, children: [
4348
+ /* @__PURE__ */ jsxs21(Box19, { children: [
4349
+ /* @__PURE__ */ jsx31(
4258
4350
  Text20,
4259
4351
  {
4260
4352
  color: "#39BFED",
@@ -4265,13 +4357,13 @@ function LoginPage({ app }) {
4265
4357
  children: "Central Oon"
4266
4358
  }
4267
4359
  ),
4268
- /* @__PURE__ */ jsx30(Heading10, { mt: 2, size: "lg", color: "#07262E", children: app.title ?? app.name }),
4269
- /* @__PURE__ */ jsx30(Text20, { mt: 2, color: "gray.600", fontSize: "sm", children: "Entre com seu usu\xE1rio autorizado para acessar este aplicativo." })
4360
+ /* @__PURE__ */ jsx31(Heading10, { mt: 2, size: "lg", color: "#07262E", children: app.title ?? app.name }),
4361
+ /* @__PURE__ */ jsx31(Text20, { mt: 2, color: "gray.600", fontSize: "sm", children: "Entre com seu usu\xE1rio autorizado para acessar este aplicativo." })
4270
4362
  ] }),
4271
4363
  /* @__PURE__ */ jsxs21(VStack2, { align: "stretch", gap: 4, children: [
4272
- /* @__PURE__ */ jsxs21(Box18, { children: [
4273
- /* @__PURE__ */ jsx30(Text20, { mb: 2, fontSize: "sm", fontWeight: "600", color: "#24323A", children: "E-mail" }),
4274
- /* @__PURE__ */ jsx30(
4364
+ /* @__PURE__ */ jsxs21(Box19, { children: [
4365
+ /* @__PURE__ */ jsx31(Text20, { mb: 2, fontSize: "sm", fontWeight: "600", color: "#24323A", children: "E-mail" }),
4366
+ /* @__PURE__ */ jsx31(
4275
4367
  Input7,
4276
4368
  {
4277
4369
  type: "email",
@@ -4283,9 +4375,9 @@ function LoginPage({ app }) {
4283
4375
  }
4284
4376
  )
4285
4377
  ] }),
4286
- /* @__PURE__ */ jsxs21(Box18, { children: [
4287
- /* @__PURE__ */ jsx30(Text20, { mb: 2, fontSize: "sm", fontWeight: "600", color: "#24323A", children: "Senha" }),
4288
- /* @__PURE__ */ jsx30(
4378
+ /* @__PURE__ */ jsxs21(Box19, { children: [
4379
+ /* @__PURE__ */ jsx31(Text20, { mb: 2, fontSize: "sm", fontWeight: "600", color: "#24323A", children: "Senha" }),
4380
+ /* @__PURE__ */ jsx31(
4289
4381
  Input7,
4290
4382
  {
4291
4383
  type: "password",
@@ -4298,8 +4390,8 @@ function LoginPage({ app }) {
4298
4390
  )
4299
4391
  ] })
4300
4392
  ] }),
4301
- message ? /* @__PURE__ */ jsx30(
4302
- Box18,
4393
+ message ? /* @__PURE__ */ jsx31(
4394
+ Box19,
4303
4395
  {
4304
4396
  role: "alert",
4305
4397
  borderRadius: "10px",
@@ -4311,7 +4403,7 @@ function LoginPage({ app }) {
4311
4403
  children: message
4312
4404
  }
4313
4405
  ) : null,
4314
- /* @__PURE__ */ jsx30(
4406
+ /* @__PURE__ */ jsx31(
4315
4407
  Button13,
4316
4408
  {
4317
4409
  type: "submit",
@@ -4329,8 +4421,8 @@ function LoginPage({ app }) {
4329
4421
 
4330
4422
  // src/security/ActivationPage.tsx
4331
4423
  import { useEffect as useEffect8, useState as useState13 } from "react";
4332
- import { Box as Box19, Button as Button14, Heading as Heading11, Input as Input8, Text as Text21, VStack as VStack3 } from "@chakra-ui/react";
4333
- import { Fragment as Fragment6, jsx as jsx31, jsxs as jsxs22 } from "react/jsx-runtime";
4424
+ import { Box as Box20, Button as Button14, Heading as Heading11, Input as Input8, Text as Text21, VStack as VStack3 } from "@chakra-ui/react";
4425
+ import { Fragment as Fragment6, jsx as jsx32, jsxs as jsxs22 } from "react/jsx-runtime";
4334
4426
  function encodeBasicCredentials2(email, password) {
4335
4427
  const bytes = new TextEncoder().encode(`${email}:${password}`);
4336
4428
  let binary = "";
@@ -4464,12 +4556,12 @@ function ActivationPage() {
4464
4556
  }
4465
4557
  }
4466
4558
  function renderField(field, values, setValues) {
4467
- return /* @__PURE__ */ jsxs22(Box19, { w: "100%", children: [
4559
+ return /* @__PURE__ */ jsxs22(Box20, { w: "100%", children: [
4468
4560
  /* @__PURE__ */ jsxs22(Text21, { fontWeight: "medium", children: [
4469
4561
  field.label,
4470
4562
  field.required ? " *" : ""
4471
4563
  ] }),
4472
- /* @__PURE__ */ jsx31(
4564
+ /* @__PURE__ */ jsx32(
4473
4565
  Input8,
4474
4566
  {
4475
4567
  type: field.type === "password" || field.type === "secret" ? "password" : field.type === "email" ? "email" : field.type === "url" ? "url" : field.type === "number" || field.type === "integer" ? "number" : "text",
@@ -4481,15 +4573,15 @@ function ActivationPage() {
4481
4573
  onChange: (event) => setValues({ ...values, [field.name]: event.target.value })
4482
4574
  }
4483
4575
  ),
4484
- field.helpText ? /* @__PURE__ */ jsx31(Text21, { fontSize: "sm", color: "gray.500", children: field.helpText }) : null
4576
+ field.helpText ? /* @__PURE__ */ jsx32(Text21, { fontSize: "sm", color: "gray.500", children: field.helpText }) : null
4485
4577
  ] }, field.name);
4486
4578
  }
4487
4579
  function renderDevLocalActivation() {
4488
4580
  return /* @__PURE__ */ jsxs22(Fragment6, { children: [
4489
- /* @__PURE__ */ jsx31(Text21, { 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." }),
4490
- /* @__PURE__ */ jsxs22(Box19, { w: "100%", children: [
4491
- /* @__PURE__ */ jsx31(Text21, { fontWeight: "medium", children: "Nome do usu\xE1rio" }),
4492
- /* @__PURE__ */ jsx31(
4581
+ /* @__PURE__ */ jsx32(Text21, { 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." }),
4582
+ /* @__PURE__ */ jsxs22(Box20, { w: "100%", children: [
4583
+ /* @__PURE__ */ jsx32(Text21, { fontWeight: "medium", children: "Nome do usu\xE1rio" }),
4584
+ /* @__PURE__ */ jsx32(
4493
4585
  Input8,
4494
4586
  {
4495
4587
  value: devName,
@@ -4499,9 +4591,9 @@ function ActivationPage() {
4499
4591
  }
4500
4592
  )
4501
4593
  ] }),
4502
- /* @__PURE__ */ jsxs22(Box19, { w: "100%", children: [
4503
- /* @__PURE__ */ jsx31(Text21, { fontWeight: "medium", children: "E-mail *" }),
4504
- /* @__PURE__ */ jsx31(
4594
+ /* @__PURE__ */ jsxs22(Box20, { w: "100%", children: [
4595
+ /* @__PURE__ */ jsx32(Text21, { fontWeight: "medium", children: "E-mail *" }),
4596
+ /* @__PURE__ */ jsx32(
4505
4597
  Input8,
4506
4598
  {
4507
4599
  type: "email",
@@ -4512,9 +4604,9 @@ function ActivationPage() {
4512
4604
  }
4513
4605
  )
4514
4606
  ] }),
4515
- /* @__PURE__ */ jsxs22(Box19, { w: "100%", children: [
4516
- /* @__PURE__ */ jsx31(Text21, { fontWeight: "medium", children: "Senha *" }),
4517
- /* @__PURE__ */ jsx31(
4607
+ /* @__PURE__ */ jsxs22(Box20, { w: "100%", children: [
4608
+ /* @__PURE__ */ jsx32(Text21, { fontWeight: "medium", children: "Senha *" }),
4609
+ /* @__PURE__ */ jsx32(
4518
4610
  Input8,
4519
4611
  {
4520
4612
  type: "password",
@@ -4526,7 +4618,7 @@ function ActivationPage() {
4526
4618
  }
4527
4619
  )
4528
4620
  ] }),
4529
- /* @__PURE__ */ jsx31(
4621
+ /* @__PURE__ */ jsx32(
4530
4622
  Button14,
4531
4623
  {
4532
4624
  colorPalette: "blue",
@@ -4536,7 +4628,7 @@ function ActivationPage() {
4536
4628
  children: "Ativar ambiente de desenvolvimento"
4537
4629
  }
4538
4630
  ),
4539
- /* @__PURE__ */ jsx31(
4631
+ /* @__PURE__ */ jsx32(
4540
4632
  Button14,
4541
4633
  {
4542
4634
  variant: "outline",
@@ -4550,7 +4642,7 @@ function ActivationPage() {
4550
4642
  const rootMode = config?.mode === "root-bootstrap" || activation.details?.role === "root";
4551
4643
  const isDevelopmentMember = !rootMode && config?.technical?.ambiente === "desenvolvimento";
4552
4644
  if (activation.status === "loading" || !config) {
4553
- return /* @__PURE__ */ jsx31(Box19, { minH: "100vh", bg: "gray.50", p: 8, children: /* @__PURE__ */ jsxs22(
4645
+ return /* @__PURE__ */ jsx32(Box20, { minH: "100vh", bg: "gray.50", p: 8, children: /* @__PURE__ */ jsxs22(
4554
4646
  VStack3,
4555
4647
  {
4556
4648
  maxW: "760px",
@@ -4561,14 +4653,14 @@ function ActivationPage() {
4561
4653
  align: "stretch",
4562
4654
  gap: 5,
4563
4655
  children: [
4564
- /* @__PURE__ */ jsx31(Heading11, { children: "Preparando ativa\xE7\xE3o..." }),
4565
- error ? /* @__PURE__ */ jsx31(Text21, { color: "red.600", children: error }) : null
4656
+ /* @__PURE__ */ jsx32(Heading11, { children: "Preparando ativa\xE7\xE3o..." }),
4657
+ error ? /* @__PURE__ */ jsx32(Text21, { color: "red.600", children: error }) : null
4566
4658
  ]
4567
4659
  }
4568
4660
  ) });
4569
4661
  }
4570
4662
  if (rootMode) {
4571
- return /* @__PURE__ */ jsx31(Box19, { minH: "100vh", bg: "gray.50", p: 8, children: /* @__PURE__ */ jsxs22(
4663
+ return /* @__PURE__ */ jsx32(Box20, { minH: "100vh", bg: "gray.50", p: 8, children: /* @__PURE__ */ jsxs22(
4572
4664
  VStack3,
4573
4665
  {
4574
4666
  maxW: "560px",
@@ -4579,8 +4671,8 @@ function ActivationPage() {
4579
4671
  align: "stretch",
4580
4672
  gap: 5,
4581
4673
  children: [
4582
- /* @__PURE__ */ jsx31(Heading11, { children: "Ativa\xE7\xE3o inicial do Ecossistema Oon" }),
4583
- /* @__PURE__ */ jsx31(Text21, { 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." }),
4674
+ /* @__PURE__ */ jsx32(Heading11, { children: "Ativa\xE7\xE3o inicial do Ecossistema Oon" }),
4675
+ /* @__PURE__ */ jsx32(Text21, { 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." }),
4584
4676
  /* @__PURE__ */ jsxs22(Text21, { fontSize: "sm", color: "gray.500", children: [
4585
4677
  "App: ",
4586
4678
  config.technical.appCode,
@@ -4588,11 +4680,11 @@ function ActivationPage() {
4588
4680
  " ",
4589
4681
  config.technical.ambiente
4590
4682
  ] }),
4591
- error ? /* @__PURE__ */ jsx31(Text21, { color: "red.600", children: error }) : null,
4683
+ error ? /* @__PURE__ */ jsx32(Text21, { color: "red.600", children: error }) : null,
4592
4684
  step !== 6 ? /* @__PURE__ */ jsxs22(Fragment6, { children: [
4593
- /* @__PURE__ */ jsxs22(Box19, { w: "100%", children: [
4594
- /* @__PURE__ */ jsx31(Text21, { fontWeight: "medium", children: "E-mail do administrador *" }),
4595
- /* @__PURE__ */ jsx31(
4685
+ /* @__PURE__ */ jsxs22(Box20, { w: "100%", children: [
4686
+ /* @__PURE__ */ jsx32(Text21, { fontWeight: "medium", children: "E-mail do administrador *" }),
4687
+ /* @__PURE__ */ jsx32(
4596
4688
  Input8,
4597
4689
  {
4598
4690
  type: "email",
@@ -4603,9 +4695,9 @@ function ActivationPage() {
4603
4695
  }
4604
4696
  )
4605
4697
  ] }),
4606
- /* @__PURE__ */ jsxs22(Box19, { w: "100%", children: [
4607
- /* @__PURE__ */ jsx31(Text21, { fontWeight: "medium", children: "Senha *" }),
4608
- /* @__PURE__ */ jsx31(
4698
+ /* @__PURE__ */ jsxs22(Box20, { w: "100%", children: [
4699
+ /* @__PURE__ */ jsx32(Text21, { fontWeight: "medium", children: "Senha *" }),
4700
+ /* @__PURE__ */ jsx32(
4609
4701
  Input8,
4610
4702
  {
4611
4703
  type: "password",
@@ -4617,7 +4709,7 @@ function ActivationPage() {
4617
4709
  }
4618
4710
  )
4619
4711
  ] }),
4620
- /* @__PURE__ */ jsx31(
4712
+ /* @__PURE__ */ jsx32(
4621
4713
  Button14,
4622
4714
  {
4623
4715
  colorPalette: "blue",
@@ -4628,14 +4720,14 @@ function ActivationPage() {
4628
4720
  }
4629
4721
  )
4630
4722
  ] }) : /* @__PURE__ */ jsxs22(Fragment6, { children: [
4631
- /* @__PURE__ */ jsx31(Heading11, { size: "md", children: "Ativa\xE7\xE3o conclu\xEDda" }),
4632
- /* @__PURE__ */ jsx31(Text21, { children: "Usu\xE1rio, tenant, aplicativo, licen\xE7a e permiss\xF5es foram preparados. Redirecionando para o primeiro login..." })
4723
+ /* @__PURE__ */ jsx32(Heading11, { size: "md", children: "Ativa\xE7\xE3o conclu\xEDda" }),
4724
+ /* @__PURE__ */ jsx32(Text21, { children: "Usu\xE1rio, tenant, aplicativo, licen\xE7a e permiss\xF5es foram preparados. Redirecionando para o primeiro login..." })
4633
4725
  ] })
4634
4726
  ]
4635
4727
  }
4636
4728
  ) });
4637
4729
  }
4638
- return /* @__PURE__ */ jsx31(Box19, { minH: "100vh", bg: "gray.50", p: 8, children: /* @__PURE__ */ jsxs22(
4730
+ return /* @__PURE__ */ jsx32(Box20, { minH: "100vh", bg: "gray.50", p: 8, children: /* @__PURE__ */ jsxs22(
4639
4731
  VStack3,
4640
4732
  {
4641
4733
  maxW: "760px",
@@ -4646,7 +4738,7 @@ function ActivationPage() {
4646
4738
  align: "stretch",
4647
4739
  gap: 5,
4648
4740
  children: [
4649
- /* @__PURE__ */ jsx31(Heading11, { children: "Ativa\xE7\xE3o da Central Oon" }),
4741
+ /* @__PURE__ */ jsx32(Heading11, { children: "Ativa\xE7\xE3o da Central Oon" }),
4650
4742
  /* @__PURE__ */ jsxs22(Text21, { children: [
4651
4743
  "App: ",
4652
4744
  config.technical.appCode,
@@ -4657,11 +4749,11 @@ function ActivationPage() {
4657
4749
  " ",
4658
4750
  config.technical.centralAtivacaoUrl || config.technical.centralAtivacaoHost
4659
4751
  ] }),
4660
- error ? /* @__PURE__ */ jsx31(Text21, { color: "red.600", children: error }) : null,
4752
+ error ? /* @__PURE__ */ jsx32(Text21, { color: "red.600", children: error }) : null,
4661
4753
  step === 1 && isDevelopmentMember && !showCodeFlow ? renderDevLocalActivation() : null,
4662
4754
  step === 1 && (!isDevelopmentMember || showCodeFlow) && /* @__PURE__ */ jsxs22(Fragment6, { children: [
4663
- /* @__PURE__ */ jsx31(Text21, { children: "Informe o c\xF3digo de ativa\xE7\xE3o para validar tenant, aplicativo e licen\xE7a antes de consumir o c\xF3digo." }),
4664
- /* @__PURE__ */ jsx31(
4755
+ /* @__PURE__ */ jsx32(Text21, { children: "Informe o c\xF3digo de ativa\xE7\xE3o para validar tenant, aplicativo e licen\xE7a antes de consumir o c\xF3digo." }),
4756
+ /* @__PURE__ */ jsx32(
4665
4757
  Input8,
4666
4758
  {
4667
4759
  "aria-label": "C\xF3digo de ativa\xE7\xE3o",
@@ -4670,7 +4762,7 @@ function ActivationPage() {
4670
4762
  placeholder: "OON-XXXX"
4671
4763
  }
4672
4764
  ),
4673
- /* @__PURE__ */ jsx31(
4765
+ /* @__PURE__ */ jsx32(
4674
4766
  Button14,
4675
4767
  {
4676
4768
  onClick: validateCode,
@@ -4679,7 +4771,7 @@ function ActivationPage() {
4679
4771
  children: "Validar c\xF3digo"
4680
4772
  }
4681
4773
  ),
4682
- isDevelopmentMember ? /* @__PURE__ */ jsx31(
4774
+ isDevelopmentMember ? /* @__PURE__ */ jsx32(
4683
4775
  Button14,
4684
4776
  {
4685
4777
  variant: "outline",
@@ -4690,23 +4782,23 @@ function ActivationPage() {
4690
4782
  ) : null
4691
4783
  ] }),
4692
4784
  step === 2 && /* @__PURE__ */ jsxs22(Fragment6, { children: [
4693
- /* @__PURE__ */ jsx31(Heading11, { size: "md", children: "Confirma\xE7\xE3o" }),
4694
- /* @__PURE__ */ jsx31("pre", { children: JSON.stringify(preview, null, 2) }),
4695
- /* @__PURE__ */ jsx31(Button14, { onClick: () => setStep(3), children: "Continuar" })
4785
+ /* @__PURE__ */ jsx32(Heading11, { size: "md", children: "Confirma\xE7\xE3o" }),
4786
+ /* @__PURE__ */ jsx32("pre", { children: JSON.stringify(preview, null, 2) }),
4787
+ /* @__PURE__ */ jsx32(Button14, { onClick: () => setStep(3), children: "Continuar" })
4696
4788
  ] }),
4697
4789
  step === 3 && /* @__PURE__ */ jsxs22(Fragment6, { children: [
4698
4790
  config.globalFields.map(
4699
4791
  (field) => renderField(field, global, setGlobal)
4700
4792
  ),
4701
- /* @__PURE__ */ jsx31(Button14, { onClick: () => setStep(4), children: "Continuar" })
4793
+ /* @__PURE__ */ jsx32(Button14, { onClick: () => setStep(4), children: "Continuar" })
4702
4794
  ] }),
4703
4795
  step === 4 && /* @__PURE__ */ jsxs22(Fragment6, { children: [
4704
- config.appFields.length ? config.appFields.map((field) => renderField(field, app, setApp)) : /* @__PURE__ */ jsx31(Text21, { children: "Nenhum par\xE2metro adicional declarado." }),
4705
- /* @__PURE__ */ jsx31(Button14, { onClick: () => setStep(5), children: "Revisar" })
4796
+ config.appFields.length ? config.appFields.map((field) => renderField(field, app, setApp)) : /* @__PURE__ */ jsx32(Text21, { children: "Nenhum par\xE2metro adicional declarado." }),
4797
+ /* @__PURE__ */ jsx32(Button14, { onClick: () => setStep(5), children: "Revisar" })
4706
4798
  ] }),
4707
4799
  step === 5 && /* @__PURE__ */ jsxs22(Fragment6, { children: [
4708
- /* @__PURE__ */ jsx31(Text21, { children: "Ao confirmar, o c\xF3digo ser\xE1 consumido e a inst\xE2ncia ser\xE1 registrada no Ecossistema Oon." }),
4709
- /* @__PURE__ */ jsx31(
4800
+ /* @__PURE__ */ jsx32(Text21, { children: "Ao confirmar, o c\xF3digo ser\xE1 consumido e a inst\xE2ncia ser\xE1 registrada no Ecossistema Oon." }),
4801
+ /* @__PURE__ */ jsx32(
4710
4802
  Button14,
4711
4803
  {
4712
4804
  colorPalette: "blue",
@@ -4718,13 +4810,13 @@ function ActivationPage() {
4718
4810
  )
4719
4811
  ] }),
4720
4812
  step === 6 && /* @__PURE__ */ jsxs22(Fragment6, { children: [
4721
- /* @__PURE__ */ jsx31(Heading11, { size: "md", children: "Ativa\xE7\xE3o conclu\xEDda" }),
4813
+ /* @__PURE__ */ jsx32(Heading11, { size: "md", children: "Ativa\xE7\xE3o conclu\xEDda" }),
4722
4814
  devResult?.appCode ? /* @__PURE__ */ jsxs22(Text21, { children: [
4723
4815
  "C\xF3digo do app: ",
4724
4816
  devResult.appCode,
4725
4817
  ". Redirecionando para a Central em desenvolvimento..."
4726
- ] }) : /* @__PURE__ */ jsx31(Text21, { children: "Redirecionando para o login..." }),
4727
- devResult?.instrucoes?.env ? /* @__PURE__ */ jsx31(Text21, { fontSize: "sm", color: "gray.500", children: devResult.instrucoes.env }) : null
4818
+ ] }) : /* @__PURE__ */ jsx32(Text21, { children: "Redirecionando para o login..." }),
4819
+ devResult?.instrucoes?.env ? /* @__PURE__ */ jsx32(Text21, { fontSize: "sm", color: "gray.500", children: devResult.instrucoes.env }) : null
4728
4820
  ] })
4729
4821
  ]
4730
4822
  }
@@ -4734,47 +4826,47 @@ function InstanceBlockedPage({
4734
4826
  title,
4735
4827
  message
4736
4828
  }) {
4737
- return /* @__PURE__ */ jsxs22(Box19, { p: 8, children: [
4738
- /* @__PURE__ */ jsx31(Heading11, { children: title }),
4739
- /* @__PURE__ */ jsx31(Text21, { children: message })
4829
+ return /* @__PURE__ */ jsxs22(Box20, { p: 8, children: [
4830
+ /* @__PURE__ */ jsx32(Heading11, { children: title }),
4831
+ /* @__PURE__ */ jsx32(Text21, { children: message })
4740
4832
  ] });
4741
4833
  }
4742
4834
 
4743
4835
  // src/security/RouteGuard.tsx
4744
- import { Fragment as Fragment7, jsx as jsx32 } from "react/jsx-runtime";
4836
+ import { Fragment as Fragment7, jsx as jsx33 } from "react/jsx-runtime";
4745
4837
  function RouteGuard({
4746
4838
  permission,
4747
4839
  children
4748
4840
  }) {
4749
4841
  const { status, hasPermission } = useOonAuth();
4750
- if (status === "loading") return /* @__PURE__ */ jsx32(LoadingScreen, {});
4751
- if (status === "unauthenticated") return /* @__PURE__ */ jsx32(LoadingScreen, { message: "Redirecionando para o login..." });
4842
+ if (status === "loading") return /* @__PURE__ */ jsx33(LoadingScreen, {});
4843
+ if (status === "unauthenticated") return /* @__PURE__ */ jsx33(LoadingScreen, { message: "Redirecionando para o login..." });
4752
4844
  if (!hasPermission(permission)) {
4753
- return /* @__PURE__ */ jsx32(LoadingScreen, { message: "Voc\xEA n\xE3o tem acesso a esta tela." });
4845
+ return /* @__PURE__ */ jsx33(LoadingScreen, { message: "Voc\xEA n\xE3o tem acesso a esta tela." });
4754
4846
  }
4755
- return /* @__PURE__ */ jsx32(Fragment7, { children });
4847
+ return /* @__PURE__ */ jsx33(Fragment7, { children });
4756
4848
  }
4757
4849
 
4758
4850
  // src/security/ActivationGuard.tsx
4759
4851
  import { Navigate as Navigate3 } from "react-router-dom";
4760
- import { jsx as jsx33 } from "react/jsx-runtime";
4852
+ import { jsx as jsx34 } from "react/jsx-runtime";
4761
4853
  function ActivationGuard({ children }) {
4762
4854
  const { status } = useActivation();
4763
4855
  if (status === "loading") return null;
4764
- if (status === "suspended") return /* @__PURE__ */ jsx33(Navigate3, { to: "/instancia-suspensa", replace: true });
4765
- if (status === "revoked") return /* @__PURE__ */ jsx33(Navigate3, { to: "/instancia-revogada", replace: true });
4766
- if (status !== "active" && window.location.pathname !== "/ativacao") return /* @__PURE__ */ jsx33(Navigate3, { to: "/ativacao", replace: true });
4856
+ if (status === "suspended") return /* @__PURE__ */ jsx34(Navigate3, { to: "/instancia-suspensa", replace: true });
4857
+ if (status === "revoked") return /* @__PURE__ */ jsx34(Navigate3, { to: "/instancia-revogada", replace: true });
4858
+ if (status !== "active" && window.location.pathname !== "/ativacao") return /* @__PURE__ */ jsx34(Navigate3, { to: "/ativacao", replace: true });
4767
4859
  return children;
4768
4860
  }
4769
4861
 
4770
4862
  // src/app/createOonRouter.tsx
4771
- import { jsx as jsx34 } from "react/jsx-runtime";
4863
+ import { jsx as jsx35 } from "react/jsx-runtime";
4772
4864
  function createOonRouter({ app, menu, routes, security, layout, registry }) {
4773
4865
  const guardEnabled = security?.enableRouteGuard !== false;
4774
4866
  const publicRoutes = routes.filter((route) => route.public).map((route) => ({ path: route.path, element: route.element }));
4775
4867
  const privateSource = routes.filter((route) => !route.public);
4776
4868
  const privateRoutes = privateSource.map((route) => {
4777
- const element = guardEnabled ? /* @__PURE__ */ jsx34(RouteGuard, { permission: route.permissions, children: route.element }) : route.element;
4869
+ const element = guardEnabled ? /* @__PURE__ */ jsx35(RouteGuard, { permission: route.permissions, children: route.element }) : route.element;
4778
4870
  return route.path === "/" ? { index: true, element } : { path: route.path.replace(/^\//, ""), element };
4779
4871
  });
4780
4872
  const hasIndexRoute = privateSource.some((route) => route.path === "/");
@@ -4782,7 +4874,7 @@ function createOonRouter({ app, menu, routes, security, layout, registry }) {
4782
4874
  if (!hasIndexRoute && firstRoute) {
4783
4875
  privateRoutes.unshift({
4784
4876
  index: true,
4785
- element: /* @__PURE__ */ jsx34(Navigate4, { to: firstRoute.path, replace: true })
4877
+ element: /* @__PURE__ */ jsx35(Navigate4, { to: firstRoute.path, replace: true })
4786
4878
  });
4787
4879
  }
4788
4880
  const customPaths = new Set(publicRoutes.map((route) => route.path));
@@ -4790,19 +4882,19 @@ function createOonRouter({ app, menu, routes, security, layout, registry }) {
4790
4882
  if (!customPaths.has("/login")) {
4791
4883
  builtInPublicRoutes.push({
4792
4884
  path: "/login",
4793
- element: /* @__PURE__ */ jsx34(ActivationGuard, { children: /* @__PURE__ */ jsx34(LoginPage, { app }) })
4885
+ element: /* @__PURE__ */ jsx35(ActivationGuard, { children: /* @__PURE__ */ jsx35(LoginPage, { app }) })
4794
4886
  });
4795
4887
  }
4796
4888
  if (!customPaths.has("/ativacao")) {
4797
4889
  builtInPublicRoutes.push({
4798
4890
  path: "/ativacao",
4799
- element: /* @__PURE__ */ jsx34(ActivationPage, {})
4891
+ element: /* @__PURE__ */ jsx35(ActivationPage, {})
4800
4892
  });
4801
4893
  }
4802
4894
  if (!customPaths.has("/instancia-suspensa")) {
4803
4895
  builtInPublicRoutes.push({
4804
4896
  path: "/instancia-suspensa",
4805
- element: /* @__PURE__ */ jsx34(
4897
+ element: /* @__PURE__ */ jsx35(
4806
4898
  InstanceBlockedPage,
4807
4899
  {
4808
4900
  title: "Inst\xE2ncia suspensa",
@@ -4814,7 +4906,7 @@ function createOonRouter({ app, menu, routes, security, layout, registry }) {
4814
4906
  if (!customPaths.has("/instancia-revogada")) {
4815
4907
  builtInPublicRoutes.push({
4816
4908
  path: "/instancia-revogada",
4817
- element: /* @__PURE__ */ jsx34(
4909
+ element: /* @__PURE__ */ jsx35(
4818
4910
  InstanceBlockedPage,
4819
4911
  {
4820
4912
  title: "Inst\xE2ncia revogada",
@@ -4826,7 +4918,7 @@ function createOonRouter({ app, menu, routes, security, layout, registry }) {
4826
4918
  if (!customPaths.has("/acesso-negado")) {
4827
4919
  builtInPublicRoutes.push({
4828
4920
  path: "/acesso-negado",
4829
- element: /* @__PURE__ */ jsx34(AccessDeniedPage, { app })
4921
+ element: /* @__PURE__ */ jsx35(AccessDeniedPage, { app })
4830
4922
  });
4831
4923
  }
4832
4924
  const tree = [
@@ -4834,7 +4926,7 @@ function createOonRouter({ app, menu, routes, security, layout, registry }) {
4834
4926
  ...publicRoutes,
4835
4927
  {
4836
4928
  path: "/",
4837
- element: /* @__PURE__ */ jsx34(ActivationGuard, { children: /* @__PURE__ */ jsx34(AppAccessGuard, { children: /* @__PURE__ */ jsx34(AuthenticatedLayout, { app, menu, layout, registry }) }) }),
4929
+ element: /* @__PURE__ */ jsx35(ActivationGuard, { children: /* @__PURE__ */ jsx35(AppAccessGuard, { children: /* @__PURE__ */ jsx35(AuthenticatedLayout, { app, menu, layout, registry }) }) }),
4838
4930
  children: privateRoutes
4839
4931
  }
4840
4932
  ];
@@ -4842,7 +4934,7 @@ function createOonRouter({ app, menu, routes, security, layout, registry }) {
4842
4934
  }
4843
4935
 
4844
4936
  // src/app/OonApp.tsx
4845
- import { jsx as jsx35 } from "react/jsx-runtime";
4937
+ import { jsx as jsx36 } from "react/jsx-runtime";
4846
4938
  function localLoginUrl() {
4847
4939
  const current = `${window.location.pathname}${window.location.search}`;
4848
4940
  return `/login?redirect=${encodeURIComponent(current)}`;
@@ -4877,11 +4969,11 @@ function OonApp({ config }) {
4877
4969
  });
4878
4970
  return { http: http2, storage: storage2, router: router2 };
4879
4971
  }, [config]);
4880
- return /* @__PURE__ */ jsx35(OonProviders, { config, http, storage, children: /* @__PURE__ */ jsx35(RouterProvider, { router }) });
4972
+ return /* @__PURE__ */ jsx36(OonProviders, { config, http, storage, children: /* @__PURE__ */ jsx36(RouterProvider, { router }) });
4881
4973
  }
4882
4974
 
4883
4975
  // src/start.tsx
4884
- import { jsx as jsx36 } from "react/jsx-runtime";
4976
+ import { jsx as jsx37 } from "react/jsx-runtime";
4885
4977
  function validateConfig(config) {
4886
4978
  if (!config?.app?.id) throw new Error("oonCoreFront.start: config.app.id \xE9 obrigat\xF3rio.");
4887
4979
  if (!config?.api?.baseUrl) throw new Error("oonCoreFront.start: config.api.baseUrl \xE9 obrigat\xF3rio.");
@@ -4915,7 +5007,7 @@ function start(config) {
4915
5007
  const el = document.getElementById(rootId);
4916
5008
  if (!el) throw new Error(`oonCoreFront.start: elemento #${rootId} n\xE3o encontrado no DOM.`);
4917
5009
  createRoot(el).render(
4918
- /* @__PURE__ */ jsx36(StrictMode, { children: /* @__PURE__ */ jsx36(OonApp, { config }) })
5010
+ /* @__PURE__ */ jsx37(StrictMode, { children: /* @__PURE__ */ jsx37(OonApp, { config }) })
4919
5011
  );
4920
5012
  }
4921
5013
  var oonCoreFront = { start };
@@ -5048,25 +5140,25 @@ function defineOonModule(mod) {
5048
5140
  }
5049
5141
 
5050
5142
  // src/components/CoreIntegration.tsx
5051
- import { Badge as Badge5, Box as Box20, Button as Button15, Flex as Flex14, Heading as Heading12, Stack as Stack9, Text as Text22 } from "@chakra-ui/react";
5143
+ import { Badge as Badge5, Box as Box21, Button as Button15, Flex as Flex14, Heading as Heading12, Stack as Stack9, Text as Text22 } from "@chakra-ui/react";
5052
5144
  import { useMutation as useMutation4 } from "@tanstack/react-query";
5053
- import { jsx as jsx37, jsxs as jsxs23 } from "react/jsx-runtime";
5145
+ import { jsx as jsx38, jsxs as jsxs23 } from "react/jsx-runtime";
5054
5146
  function CoreIntegration({ label = "Integra\xE7\xF5es" }) {
5055
5147
  const { http } = useOonApi();
5056
5148
  const metadata = useCoreMetadata();
5057
5149
  const reprocess = useMutation4({
5058
5150
  mutationFn: () => http.post("/integrations/actions/process-active", {}, { headers: { "x-oon-origin": "integration" } })
5059
5151
  });
5060
- if (metadata.isLoading) return /* @__PURE__ */ jsx37(LoadingScreen, {});
5061
- if (metadata.isError) return /* @__PURE__ */ jsx37(ErrorState, { error: metadata.error });
5152
+ if (metadata.isLoading) return /* @__PURE__ */ jsx38(LoadingScreen, {});
5153
+ if (metadata.isError) return /* @__PURE__ */ jsx38(ErrorState, { error: metadata.error });
5062
5154
  const integrations = metadata.data?.integrations ?? [];
5063
5155
  return /* @__PURE__ */ jsxs23(Stack9, { gap: 6, children: [
5064
5156
  /* @__PURE__ */ jsxs23(Flex14, { align: "center", justify: "space-between", children: [
5065
- /* @__PURE__ */ jsx37(Heading12, { size: "lg", children: label }),
5066
- /* @__PURE__ */ jsx37(Button15, { size: "sm", variant: "outline", loading: reprocess.isPending, onClick: () => reprocess.mutate(), children: "Reprocessar ativos" })
5157
+ /* @__PURE__ */ jsx38(Heading12, { size: "lg", children: label }),
5158
+ /* @__PURE__ */ jsx38(Button15, { size: "sm", variant: "outline", loading: reprocess.isPending, onClick: () => reprocess.mutate(), children: "Reprocessar ativos" })
5067
5159
  ] }),
5068
- /* @__PURE__ */ jsx37(Stack9, { gap: 3, children: integrations.length === 0 ? /* @__PURE__ */ jsx37(Text22, { color: "gray.400", children: "Nenhuma integra\xE7\xE3o declarada." }) : integrations.map((it, idx) => /* @__PURE__ */ jsx37(
5069
- Box20,
5160
+ /* @__PURE__ */ jsx38(Stack9, { gap: 3, children: integrations.length === 0 ? /* @__PURE__ */ jsx38(Text22, { color: "gray.400", children: "Nenhuma integra\xE7\xE3o declarada." }) : integrations.map((it, idx) => /* @__PURE__ */ jsx38(
5161
+ Box21,
5070
5162
  {
5071
5163
  borderWidth: "1px",
5072
5164
  borderColor: "gray.200",
@@ -5074,8 +5166,8 @@ function CoreIntegration({ label = "Integra\xE7\xF5es" }) {
5074
5166
  bg: "white",
5075
5167
  p: 4,
5076
5168
  children: /* @__PURE__ */ jsxs23(Flex14, { align: "center", justify: "space-between", children: [
5077
- /* @__PURE__ */ jsx37(Text22, { fontWeight: "medium", children: it.label ?? it.name ?? "Integra\xE7\xE3o" }),
5078
- /* @__PURE__ */ jsx37(Badge5, { colorPalette: it.status === "erro" ? "red" : it.status === "ativo" ? "green" : "gray", children: it.status ?? "\u2014" })
5169
+ /* @__PURE__ */ jsx38(Text22, { fontWeight: "medium", children: it.label ?? it.name ?? "Integra\xE7\xE3o" }),
5170
+ /* @__PURE__ */ jsx38(Badge5, { colorPalette: it.status === "erro" ? "red" : it.status === "ativo" ? "green" : "gray", children: it.status ?? "\u2014" })
5079
5171
  ] })
5080
5172
  },
5081
5173
  it.id ?? it.name ?? idx
@@ -5086,7 +5178,7 @@ function CoreIntegration({ label = "Integra\xE7\xF5es" }) {
5086
5178
  // src/components/CoreCurrency.tsx
5087
5179
  import { Button as Button16, Flex as Flex15, Heading as Heading13, Stack as Stack10, Text as Text23 } from "@chakra-ui/react";
5088
5180
  import { useMutation as useMutation5, useQueryClient as useQueryClient5 } from "@tanstack/react-query";
5089
- import { jsx as jsx38, jsxs as jsxs24 } from "react/jsx-runtime";
5181
+ import { jsx as jsx39, jsxs as jsxs24 } from "react/jsx-runtime";
5090
5182
  function CoreCurrency({ model = "Moeda", label = "Multi-moedas", endpoint = "/moedas", columns }) {
5091
5183
  const { http } = useOonApi();
5092
5184
  const queryClient = useQueryClient5();
@@ -5096,19 +5188,19 @@ function CoreCurrency({ model = "Moeda", label = "Multi-moedas", endpoint = "/mo
5096
5188
  });
5097
5189
  return /* @__PURE__ */ jsxs24(Stack10, { gap: 6, children: [
5098
5190
  /* @__PURE__ */ jsxs24(Flex15, { align: "center", justify: "space-between", children: [
5099
- /* @__PURE__ */ jsx38(Heading13, { size: "lg", children: label }),
5100
- /* @__PURE__ */ jsx38(Button16, { size: "sm", colorPalette: "blue", loading: updateRates.isPending, onClick: () => updateRates.mutate(), children: "Atualizar cota\xE7\xF5es" })
5191
+ /* @__PURE__ */ jsx39(Heading13, { size: "lg", children: label }),
5192
+ /* @__PURE__ */ jsx39(Button16, { size: "sm", colorPalette: "blue", loading: updateRates.isPending, onClick: () => updateRates.mutate(), children: "Atualizar cota\xE7\xF5es" })
5101
5193
  ] }),
5102
- updateRates.isError ? /* @__PURE__ */ jsx38(Text23, { fontSize: "sm", color: "red.600", children: updateRates.error?.message }) : null,
5103
- /* @__PURE__ */ jsx38(CoreCollection, { model, label: "", mode: columns ? "full" : "dynamic", endpoint, columns })
5194
+ updateRates.isError ? /* @__PURE__ */ jsx39(Text23, { fontSize: "sm", color: "red.600", children: updateRates.error?.message }) : null,
5195
+ /* @__PURE__ */ jsx39(CoreCollection, { model, label: "", mode: columns ? "full" : "dynamic", endpoint, columns })
5104
5196
  ] });
5105
5197
  }
5106
5198
 
5107
5199
  // src/components/CoreAssistant.tsx
5108
5200
  import { useState as useState14 } from "react";
5109
- import { Box as Box21, Button as Button17, Flex as Flex16, Heading as Heading14, Input as Input9, Stack as Stack11, Text as Text24 } from "@chakra-ui/react";
5201
+ import { Box as Box22, Button as Button17, Flex as Flex16, Heading as Heading14, Input as Input9, Stack as Stack11, Text as Text24 } from "@chakra-ui/react";
5110
5202
  import { useMutation as useMutation6 } from "@tanstack/react-query";
5111
- import { jsx as jsx39, jsxs as jsxs25 } from "react/jsx-runtime";
5203
+ import { jsx as jsx40, jsxs as jsxs25 } from "react/jsx-runtime";
5112
5204
  function CoreAssistant({ assistantCode, label = "Assistente", entity, endpoint = "/assistant-runs" }) {
5113
5205
  const { http } = useOonApi();
5114
5206
  const [messages, setMessages] = useState14([]);
@@ -5138,10 +5230,10 @@ function CoreAssistant({ assistantCode, label = "Assistente", entity, endpoint =
5138
5230
  ask.mutate(text);
5139
5231
  };
5140
5232
  return /* @__PURE__ */ jsxs25(Stack11, { gap: 4, maxW: "560px", children: [
5141
- /* @__PURE__ */ jsx39(Heading14, { size: "md", children: label }),
5142
- /* @__PURE__ */ jsx39(Box21, { borderWidth: "1px", borderColor: "gray.200", borderRadius: "md", bg: "white", p: 4, minH: "240px", children: /* @__PURE__ */ jsxs25(Stack11, { gap: 3, children: [
5143
- messages.length === 0 ? /* @__PURE__ */ jsx39(Text24, { color: "gray.400", fontSize: "sm", children: "Fa\xE7a uma pergunta ao assistente." }) : messages.map((m, idx) => /* @__PURE__ */ jsx39(Flex16, { justify: m.role === "user" ? "flex-end" : "flex-start", children: /* @__PURE__ */ jsx39(
5144
- Box21,
5233
+ /* @__PURE__ */ jsx40(Heading14, { size: "md", children: label }),
5234
+ /* @__PURE__ */ jsx40(Box22, { borderWidth: "1px", borderColor: "gray.200", borderRadius: "md", bg: "white", p: 4, minH: "240px", children: /* @__PURE__ */ jsxs25(Stack11, { gap: 3, children: [
5235
+ messages.length === 0 ? /* @__PURE__ */ jsx40(Text24, { color: "gray.400", fontSize: "sm", children: "Fa\xE7a uma pergunta ao assistente." }) : messages.map((m, idx) => /* @__PURE__ */ jsx40(Flex16, { justify: m.role === "user" ? "flex-end" : "flex-start", children: /* @__PURE__ */ jsx40(
5236
+ Box22,
5145
5237
  {
5146
5238
  bg: m.role === "user" ? "brand.500" : "gray.100",
5147
5239
  color: m.role === "user" ? "white" : "gray.800",
@@ -5153,11 +5245,11 @@ function CoreAssistant({ assistantCode, label = "Assistente", entity, endpoint =
5153
5245
  children: m.content
5154
5246
  }
5155
5247
  ) }, idx)),
5156
- ask.isPending ? /* @__PURE__ */ jsx39(Text24, { color: "gray.400", fontSize: "sm", children: "Pensando\u2026" }) : null,
5157
- ask.isError ? /* @__PURE__ */ jsx39(Text24, { color: "red.600", fontSize: "sm", children: ask.error?.message }) : null
5248
+ ask.isPending ? /* @__PURE__ */ jsx40(Text24, { color: "gray.400", fontSize: "sm", children: "Pensando\u2026" }) : null,
5249
+ ask.isError ? /* @__PURE__ */ jsx40(Text24, { color: "red.600", fontSize: "sm", children: ask.error?.message }) : null
5158
5250
  ] }) }),
5159
5251
  /* @__PURE__ */ jsxs25(Flex16, { gap: 2, children: [
5160
- /* @__PURE__ */ jsx39(
5252
+ /* @__PURE__ */ jsx40(
5161
5253
  Input9,
5162
5254
  {
5163
5255
  size: "sm",
@@ -5169,7 +5261,7 @@ function CoreAssistant({ assistantCode, label = "Assistente", entity, endpoint =
5169
5261
  }
5170
5262
  }
5171
5263
  ),
5172
- /* @__PURE__ */ jsx39(Button17, { size: "sm", colorPalette: "blue", onClick: send, loading: ask.isPending, children: "Enviar" })
5264
+ /* @__PURE__ */ jsx40(Button17, { size: "sm", colorPalette: "blue", onClick: send, loading: ask.isPending, children: "Enviar" })
5173
5265
  ] })
5174
5266
  ] });
5175
5267
  }