@oondemand/oon-core-front 0.3.11 → 0.3.12

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
@@ -3,7 +3,7 @@ import { StrictMode } from "react";
3
3
  import { createRoot } from "react-dom/client";
4
4
 
5
5
  // src/app/OonApp.tsx
6
- import { useMemo as useMemo4 } from "react";
6
+ import { useMemo as useMemo6 } from "react";
7
7
  import { RouterProvider } from "react-router-dom";
8
8
 
9
9
  // src/api/createRestClient.ts
@@ -640,9 +640,9 @@ function OonProviders({ config, http, storage, children }) {
640
640
  }
641
641
 
642
642
  // src/components/CoreCollection.tsx
643
- import { useState as useState6 } from "react";
644
- import { Box as Box5, Heading as Heading3, Stack as Stack3, Text as Text6 } from "@chakra-ui/react";
645
- import { useMutation, useQueryClient } from "@tanstack/react-query";
643
+ import { useState as useState10 } from "react";
644
+ import { Box as Box9, Heading as Heading4, Stack as Stack4, Text as Text11 } from "@chakra-ui/react";
645
+ import { useMutation as useMutation2, useQueryClient as useQueryClient3 } from "@tanstack/react-query";
646
646
 
647
647
  // src/components/internal/fieldUtils.ts
648
648
  var HIDDEN_FIELDS = /* @__PURE__ */ new Set(["__v", "_id", "createdAt", "updatedAt", "criadoEm", "atualizadoEm"]);
@@ -795,16 +795,21 @@ function DataGrid({
795
795
  onCreate,
796
796
  onEdit,
797
797
  onDelete,
798
- toolbarExtra
798
+ toolbarExtra,
799
+ filters = [],
800
+ queryExtra,
801
+ renderRowActions
799
802
  }) {
800
803
  const [pageIndex, setPageIndex] = useState3(0);
801
804
  const [pageSize, setPageSize] = useState3(20);
802
805
  const [searchTerm, setSearchTerm] = useState3("");
803
806
  const deferredSearch = useDeferredValue(searchTerm);
804
807
  const [sort, setSort] = useState3(void 0);
808
+ const [filterValues, setFilterValues] = useState3(() => Object.fromEntries(filters.map((filter) => [filter.field, filter.defaultValue ?? ""])));
809
+ const effectiveFilters = Object.fromEntries(Object.entries({ ...queryExtra, ...filterValues }).filter(([, value]) => value !== "" && value != null));
805
810
  const query = useQuery2({
806
- queryKey: ["oon", "list", resourceKey, { pageIndex, pageSize, searchTerm: deferredSearch, sort }],
807
- queryFn: () => resource.list({ pageIndex, pageSize, searchTerm: deferredSearch || void 0, sort }),
811
+ queryKey: ["oon", "list", resourceKey, { pageIndex, pageSize, searchTerm: deferredSearch, sort, filters: effectiveFilters }],
812
+ queryFn: () => resource.list({ pageIndex, pageSize, searchTerm: deferredSearch || void 0, sort, ...effectiveFilters }),
808
813
  placeholderData: keepPreviousData
809
814
  });
810
815
  const toggleSort = (field) => {
@@ -820,7 +825,7 @@ function DataGrid({
820
825
  const totalItems = pagination?.totalItems ?? rows.length;
821
826
  const totalPages = Math.max(1, pagination?.totalPages ?? 1);
822
827
  const currentPage = Math.min(pageIndex + 1, totalPages);
823
- const actionCount = onEdit || onDelete ? 1 : 0;
828
+ const actionCount = onEdit || onDelete || renderRowActions ? 1 : 0;
824
829
  return /* @__PURE__ */ jsxs3(Box2, { bg: "white", borderWidth: "1px", borderColor: "#E5E9ED", borderRadius: "10px", boxShadow: "0 1px 2px rgba(15,23,42,.06)", overflow: "hidden", children: [
825
830
  /* @__PURE__ */ jsxs3(Flex2, { minH: "60px", px: "14px", py: "12px", align: "center", gap: 4, borderBottomWidth: "1px", borderColor: "#E5E9ED", children: [
826
831
  search ? /* @__PURE__ */ jsxs3(Flex2, { minW: { base: "100%", md: "min(420px, 55vw)" }, maxW: "420px", h: "35px", px: "10px", align: "center", gap: 2, color: "#98A2B3", bg: "white", borderWidth: "1px", borderColor: "#D5DDE3", borderRadius: "6px", _focusWithin: { borderColor: "#0F8DD0", boxShadow: "0 0 0 3px rgba(15,141,208,.10)" }, children: [
@@ -847,6 +852,16 @@ function DataGrid({
847
852
  )
848
853
  ] }) : null,
849
854
  /* @__PURE__ */ jsx7(Spacer, {}),
855
+ filters.map((filter) => filter.type === "select" ? /* @__PURE__ */ jsxs3(NativeSelect.Root, { size: "xs", w: "180px", children: [
856
+ /* @__PURE__ */ jsx7(NativeSelect.Field, { value: String(filterValues[filter.field] ?? ""), onChange: (event) => {
857
+ setFilterValues((current) => ({ ...current, [filter.field]: event.currentTarget.value }));
858
+ setPageIndex(0);
859
+ }, children: (filter.options ?? []).map((option) => /* @__PURE__ */ jsx7("option", { value: String(option.value ?? ""), children: option.label }, String(option.value ?? ""))) }),
860
+ /* @__PURE__ */ jsx7(NativeSelect.Indicator, {})
861
+ ] }, filter.field) : /* @__PURE__ */ jsx7(Input, { w: "180px", h: "35px", fontSize: "11px", placeholder: filter.placeholder ?? filter.label ?? filter.field, type: filter.type === "date" ? "date" : filter.type === "boolean" ? "text" : "text", value: String(filterValues[filter.field] ?? ""), onChange: (event) => {
862
+ setFilterValues((current) => ({ ...current, [filter.field]: event.currentTarget.value }));
863
+ setPageIndex(0);
864
+ } }, filter.field)),
850
865
  /* @__PURE__ */ jsxs3(Flex2, { align: "center", gap: 3, color: "#98A2B3", fontSize: "10px", children: [
851
866
  query.isFetching ? /* @__PURE__ */ jsx7(Text3, { children: "Atualizando..." }) : null,
852
867
  /* @__PURE__ */ jsxs3(Text3, { as: "strong", color: "#667085", fontWeight: "600", children: [
@@ -892,7 +907,8 @@ function DataGrid({
892
907
  columns.map((column) => /* @__PURE__ */ jsx7(Table.Cell, { maxW: "250px", h: "42px", px: "10px", py: "8px", overflow: "hidden", color: "#52606D", borderBottomWidth: "1px", borderColor: "#EEF1F3", fontSize: "11px", textOverflow: "ellipsis", whiteSpace: "nowrap", children: renderCell(row[column.field], column.kind) }, column.field)),
893
908
  actionCount ? /* @__PURE__ */ jsx7(Table.Cell, { h: "42px", px: "10px", py: "5px", borderBottomWidth: "1px", borderColor: "#EEF1F3", textAlign: "center", children: /* @__PURE__ */ jsxs3(Flex2, { justify: "center", gap: "5px", children: [
894
909
  onEdit ? /* @__PURE__ */ jsx7(Button2, { type: "button", "aria-label": "Editar", w: "31px", minW: "31px", h: "31px", p: 0, color: "#667085", bg: "white", borderWidth: "1px", borderColor: "#E5E9ED", borderRadius: "6px", onClick: () => onEdit(row), _hover: { color: "#036491", bg: "#F0F7FF", borderColor: "#B8D9EB" }, children: /* @__PURE__ */ jsx7(EditIcon, {}) }) : null,
895
- onDelete ? /* @__PURE__ */ jsx7(Button2, { type: "button", "aria-label": "Excluir", w: "31px", minW: "31px", h: "31px", p: 0, color: "#667085", bg: "white", borderWidth: "1px", borderColor: "#E5E9ED", borderRadius: "6px", onClick: () => onDelete(row), _hover: { color: "#B42318", bg: "#FFF5F5", borderColor: "#FECACA" }, children: /* @__PURE__ */ jsx7(TrashIcon, {}) }) : null
910
+ onDelete ? /* @__PURE__ */ jsx7(Button2, { type: "button", "aria-label": "Excluir", w: "31px", minW: "31px", h: "31px", p: 0, color: "#667085", bg: "white", borderWidth: "1px", borderColor: "#E5E9ED", borderRadius: "6px", onClick: () => onDelete(row), _hover: { color: "#B42318", bg: "#FFF5F5", borderColor: "#FECACA" }, children: /* @__PURE__ */ jsx7(TrashIcon, {}) }) : null,
911
+ renderRowActions?.(row)
896
912
  ] }) }) : null
897
913
  ] }, row._id ?? index)) })
898
914
  ] }) }),
@@ -1554,21 +1570,362 @@ function DynamicForm({ title, eyebrow = "Cadastro", fields, initialValues, submi
1554
1570
  ] }) });
1555
1571
  }
1556
1572
 
1573
+ // src/components/internal/CoreDetailModal.tsx
1574
+ import { useEffect as useEffect6, useMemo as useMemo5, useState as useState9 } from "react";
1575
+ import { Box as Box8, Button as Button8, Flex as Flex7, Heading as Heading3, Text as Text10 } from "@chakra-ui/react";
1576
+ import { useQuery as useQuery6, useQueryClient as useQueryClient2 } from "@tanstack/react-query";
1577
+
1578
+ // src/components/internal/CoreTabbedDetail.tsx
1579
+ import { useEffect as useEffect5, useState as useState8 } from "react";
1580
+ 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 } from "@chakra-ui/react";
1581
+
1582
+ // src/components/internal/CoreSummaryCards.tsx
1583
+ import { SimpleGrid as SimpleGrid2, Box as Box5, Text as Text6, Badge as Badge2 } from "@chakra-ui/react";
1584
+ import { useQuery as useQuery4 } from "@tanstack/react-query";
1585
+
1586
+ // src/components/internal/manifestUtils.ts
1587
+ function normalizeColumn(column, schema) {
1588
+ if (typeof column !== "string") {
1589
+ const meta2 = schema?.fields.find((field) => field.name === column.field);
1590
+ return { label: meta2 ? fieldLabel(meta2) : column.field, kind: meta2?.kind, ...column };
1591
+ }
1592
+ const meta = schema?.fields.find((field) => field.name === column);
1593
+ return { field: column, label: meta ? fieldLabel(meta) : fieldLabel({ name: column }), kind: meta?.kind, sortable: true };
1594
+ }
1595
+ function fieldsForTab(fields, selected) {
1596
+ if (!selected?.length) return fields;
1597
+ const wanted = new Set(selected);
1598
+ return fields.filter((field) => wanted.has(field.field));
1599
+ }
1600
+ function relationFrom(input, relations) {
1601
+ return typeof input === "string" ? relations?.[input] : input;
1602
+ }
1603
+
1604
+ // src/components/internal/CoreSummaryCards.tsx
1605
+ import { Fragment, jsx as jsx10, jsxs as jsxs6 } from "react/jsx-runtime";
1606
+ function format(value, format2) {
1607
+ if (format2 === "currency") return new Intl.NumberFormat("pt-BR", { style: "currency", currency: "BRL" }).format(Number(value ?? 0));
1608
+ if (format2 === "percent") return `${Number(value ?? 0).toLocaleString("pt-BR")}%`;
1609
+ if (format2 === "date") return formatCell(value, "date");
1610
+ return value == null || value === "" ? "\u2014" : String(value);
1611
+ }
1612
+ function RelatedMetric({ card, relation, parent }) {
1613
+ const schema = useModelSchema(relation.model).data;
1614
+ const resource = useOonResource(schema?.basePath ?? `/${relation.model.toLowerCase()}s`);
1615
+ const parentValue = parent[relation.parentKey ?? "_id"];
1616
+ const query = useQuery4({ queryKey: ["oon", "summary", relation.model, relation.foreignKey, parentValue, card.source, card.field], queryFn: () => resource.list({ [relation.foreignKey]: parentValue, pageSize: 1e3 }) });
1617
+ const rows = query.data?.results ?? [];
1618
+ let value = rows.length;
1619
+ if (card.source === "relatedSum") value = rows.reduce((sum, row) => sum + Number(row[card.field ?? ""] ?? 0), 0);
1620
+ if (card.source === "relatedAvg") value = rows.length ? rows.reduce((sum, row) => sum + Number(row[card.field ?? ""] ?? 0), 0) / rows.length : 0;
1621
+ return /* @__PURE__ */ jsx10(Fragment, { children: query.isLoading ? "..." : format(value, card.format) });
1622
+ }
1623
+ function CoreSummaryCards({ cards = [], parent, relations }) {
1624
+ return /* @__PURE__ */ jsx10(SimpleGrid2, { columns: { base: 1, md: 3 }, gap: 3, children: cards.map((card, index) => {
1625
+ const relation = card.relation ? relationFrom(card.relation, relations) : void 0;
1626
+ const content = relation && card.source?.startsWith("related") ? /* @__PURE__ */ jsx10(RelatedMetric, { card, relation, parent }) : format(parent[card.field ?? ""], card.format);
1627
+ return /* @__PURE__ */ jsxs6(Box5, { p: "14px", bg: "white", borderWidth: "1px", borderColor: "#E5E9ED", borderRadius: "10px", children: [
1628
+ /* @__PURE__ */ jsx10(Text6, { color: "#667085", fontSize: "10px", fontWeight: "600", children: card.label }),
1629
+ /* @__PURE__ */ jsx10(Text6, { mt: "6px", color: "#24323A", fontSize: "20px", fontWeight: "700", children: card.format === "badge" ? /* @__PURE__ */ jsx10(Badge2, { children: content }) : content })
1630
+ ] }, `${card.label}-${index}`);
1631
+ }) });
1632
+ }
1633
+
1634
+ // src/components/internal/CoreRelatedGrid.tsx
1635
+ import { useMemo as useMemo4, useState as useState7 } from "react";
1636
+ import { Badge as Badge3, Box as Box6, Button as Button6, Flex as Flex5, Table as Table2, Text as Text8 } from "@chakra-ui/react";
1637
+ import { useMutation, useQuery as useQuery5, useQueryClient } from "@tanstack/react-query";
1638
+
1639
+ // src/components/internal/CoreInlineEditableCell.tsx
1640
+ import { Input as Input4, NativeSelect as NativeSelect3, Textarea as Textarea2 } from "@chakra-ui/react";
1641
+ import { jsx as jsx11, jsxs as jsxs7 } from "react/jsx-runtime";
1642
+ function CoreInlineEditableCell({ column, meta, value, onChange }) {
1643
+ const kind = column.editor ?? meta?.kind ?? column.kind ?? "string";
1644
+ const common = { size: "xs", fontSize: "11px", value: value == null ? "" : String(value), onChange: (event) => onChange(event.currentTarget.value) };
1645
+ if (kind === "boolean") return /* @__PURE__ */ jsxs7(NativeSelect3.Root, { size: "xs", children: [
1646
+ /* @__PURE__ */ jsxs7(NativeSelect3.Field, { ...common, children: [
1647
+ /* @__PURE__ */ jsx11("option", { value: "", children: "\u2014" }),
1648
+ /* @__PURE__ */ jsx11("option", { value: "true", children: "Sim" }),
1649
+ /* @__PURE__ */ jsx11("option", { value: "false", children: "N\xE3o" })
1650
+ ] }),
1651
+ /* @__PURE__ */ jsx11(NativeSelect3.Indicator, {})
1652
+ ] });
1653
+ if ((kind === "enum" || kind === "select") && meta?.options?.length) return /* @__PURE__ */ jsxs7(NativeSelect3.Root, { size: "xs", children: [
1654
+ /* @__PURE__ */ jsxs7(NativeSelect3.Field, { ...common, children: [
1655
+ /* @__PURE__ */ jsx11("option", { value: "", children: "\u2014" }),
1656
+ meta.options.map((option) => /* @__PURE__ */ jsx11("option", { value: option, children: option }, option))
1657
+ ] }),
1658
+ /* @__PURE__ */ jsx11(NativeSelect3.Indicator, {})
1659
+ ] });
1660
+ if (kind === "textarea") return /* @__PURE__ */ jsx11(Textarea2, { ...common, rows: 2 });
1661
+ const type = kind === "date" ? "date" : ["number", "currency"].includes(kind) ? "number" : "text";
1662
+ return /* @__PURE__ */ jsx11(Input4, { ...common, type, step: type === "number" ? "any" : void 0 });
1663
+ }
1664
+
1665
+ // src/components/internal/CoreRowAction.tsx
1666
+ import { useState as useState6 } from "react";
1667
+ import { Button as Button5, Text as Text7 } from "@chakra-ui/react";
1668
+
1669
+ // src/components/internal/conditions.ts
1670
+ function valueAt(source, path) {
1671
+ if (!source) return void 0;
1672
+ return path.split(".").reduce((current, part) => {
1673
+ if (current && typeof current === "object") return current[part];
1674
+ return void 0;
1675
+ }, source);
1676
+ }
1677
+ function evaluateCondition(condition, row) {
1678
+ if (!condition) return false;
1679
+ const value = valueAt(row, condition.field);
1680
+ if ("exists" in condition) return condition.exists ? value != null && value !== "" : value == null || value === "";
1681
+ if ("equals" in condition) return value === condition.equals;
1682
+ if ("notEquals" in condition) return value !== condition.notEquals;
1683
+ if ("in" in condition) return condition.in.includes(value);
1684
+ const numeric = Number(value);
1685
+ if (Number.isNaN(numeric)) return false;
1686
+ if ("gt" in condition) return numeric > condition.gt;
1687
+ if ("gte" in condition) return numeric >= condition.gte;
1688
+ if ("lt" in condition) return numeric < condition.lt;
1689
+ if ("lte" in condition) return numeric <= condition.lte;
1690
+ return false;
1691
+ }
1692
+ function interpolateEndpoint(endpoint, row, parent) {
1693
+ return endpoint.replace(/:([A-Za-z0-9_.]+)/g, (_, token) => {
1694
+ if (token === "id") return encodeURIComponent(String(row._id ?? row.id ?? ""));
1695
+ if (token === "parentId") return encodeURIComponent(String(parent?._id ?? parent?.id ?? ""));
1696
+ if (token.startsWith("parent.")) return encodeURIComponent(String(valueAt(parent, token.slice(7)) ?? ""));
1697
+ return encodeURIComponent(String(valueAt(row, token) ?? ""));
1698
+ });
1699
+ }
1700
+
1701
+ // src/components/internal/CoreRowAction.tsx
1702
+ import { jsx as jsx12, jsxs as jsxs8 } from "react/jsx-runtime";
1703
+ function messageOf2(error) {
1704
+ return error instanceof Error ? error.message : typeof error === "string" ? error : "N\xE3o foi poss\xEDvel executar a a\xE7\xE3o.";
1705
+ }
1706
+ function CoreRowAction({ action, row, parent, onOpenDetail, onRefresh }) {
1707
+ const { http } = useOonApi();
1708
+ const [loading, setLoading] = useState6(false);
1709
+ const [error, setError] = useState6(null);
1710
+ if (evaluateCondition(action.hiddenWhen, row)) return null;
1711
+ const disabled = evaluateCondition(action.disabledWhen, row) || loading;
1712
+ const run = async () => {
1713
+ setError(null);
1714
+ if (action.type === "openDetailModal") return onOpenDetail?.(row, action.initialTab);
1715
+ if (action.type === "navigate") {
1716
+ const href = action.href ?? action.endpoint;
1717
+ if (href) window.location.assign(interpolateEndpoint(href, row, parent));
1718
+ return;
1719
+ }
1720
+ if (action.type !== "apiAction" || !action.endpoint) return;
1721
+ const ok = action.confirm ? window.confirm(action.confirm.description ?? action.confirm.title ?? `Executar ${action.label}?`) : true;
1722
+ if (!ok) return;
1723
+ setLoading(true);
1724
+ try {
1725
+ const url = interpolateEndpoint(action.endpoint, row, parent);
1726
+ await http.request({ url, method: action.method ?? "POST" });
1727
+ onRefresh?.(action.refresh);
1728
+ } catch (err) {
1729
+ setError(err);
1730
+ } finally {
1731
+ setLoading(false);
1732
+ }
1733
+ };
1734
+ return /* @__PURE__ */ jsxs8("span", { children: [
1735
+ /* @__PURE__ */ jsx12(Button5, { type: "button", size: "xs", minH: "28px", px: "9px", borderRadius: "6px", fontSize: "10px", loading, disabled, onClick: run, children: action.label }),
1736
+ error ? /* @__PURE__ */ jsx12(Text7, { mt: "3px", color: "#B42318", fontSize: "9px", children: messageOf2(error) }) : null
1737
+ ] });
1738
+ }
1739
+
1740
+ // src/components/internal/CoreRelatedGrid.tsx
1741
+ import { Fragment as Fragment2, jsx as jsx13, jsxs as jsxs9 } from "react/jsx-runtime";
1742
+ function CoreRelatedGrid({ tab, parent, relations, refreshToken, onRefresh }) {
1743
+ const relation = relationFrom(tab.relation, relations);
1744
+ const schemaQuery = useModelSchema(relation?.model ?? "");
1745
+ const schema = schemaQuery.data;
1746
+ const resource = useOonResource(schema?.basePath ?? `/${relation?.model?.toLowerCase() ?? "related"}s`);
1747
+ const queryClient = useQueryClient();
1748
+ const parentValue = relation ? parent[relation.parentKey ?? "_id"] : void 0;
1749
+ const key = ["oon", "related", relation?.model, relation?.foreignKey, parentValue, refreshToken];
1750
+ const query = useQuery5({ queryKey: key, enabled: !!relation && parentValue != null, queryFn: () => resource.list({ [relation.foreignKey]: parentValue, pageSize: 1e3 }) });
1751
+ const columns = useMemo4(() => (tab.columns?.length ? tab.columns : schema?.fields.slice(0, 8).map((f) => f.name) ?? []).map((column) => normalizeColumn(column, schema)).filter((column) => !column.hidden), [tab.columns, schema]);
1752
+ const [drafts, setDrafts] = useState7({});
1753
+ const [errors, setErrors] = useState7({});
1754
+ const editable = tab.type === "relatedGrid" && tab.editable && tab.editMode === "inline";
1755
+ const mutation = useMutation({ mutationFn: ({ id, values }) => resource.update(id, values), onSuccess: () => {
1756
+ queryClient.invalidateQueries({ queryKey: key });
1757
+ onRefresh?.(["self"]);
1758
+ } });
1759
+ if (!relation) return /* @__PURE__ */ jsx13(Text8, { color: "#B42318", children: "Rela\xE7\xE3o n\xE3o encontrada." });
1760
+ if (query.isLoading) return /* @__PURE__ */ jsx13(Text8, { color: "#667085", children: "Carregando..." });
1761
+ const rows = query.data?.results ?? [];
1762
+ const setDraft = (id, field, value) => setDrafts((current) => ({ ...current, [id]: { ...current[id] ?? {}, [field]: value } }));
1763
+ return /* @__PURE__ */ jsx13(Box6, { overflowX: "auto", borderWidth: "1px", borderColor: "#E5E9ED", borderRadius: "10px", children: /* @__PURE__ */ jsxs9(Table2.Root, { size: "sm", minW: "760px", children: [
1764
+ /* @__PURE__ */ jsx13(Table2.Header, { children: /* @__PURE__ */ jsxs9(Table2.Row, { bg: "#F4F7F9", children: [
1765
+ columns.map((c) => /* @__PURE__ */ jsx13(Table2.ColumnHeader, { fontSize: "10px", children: c.label ?? c.field }, c.field)),
1766
+ editable || tab.rowActions?.length ? /* @__PURE__ */ jsx13(Table2.ColumnHeader, { children: "A\xE7\xF5es" }) : null
1767
+ ] }) }),
1768
+ /* @__PURE__ */ jsxs9(Table2.Body, { children: [
1769
+ rows.map((row, index) => {
1770
+ const id = String(row._id ?? row.id ?? index);
1771
+ const draft = drafts[id] ?? {};
1772
+ const dirty = Object.keys(draft).length > 0;
1773
+ return /* @__PURE__ */ jsxs9(Table2.Row, { bg: dirty ? "#FFFBEB" : index % 2 ? "#FBFCFD" : "white", children: [
1774
+ columns.map((column) => {
1775
+ const value = column.field in draft ? draft[column.field] : row[column.field];
1776
+ const meta = schema?.fields.find((f) => f.name === column.field);
1777
+ const canEdit = editable && column.readonly !== true && (column.editable === true || !column.readonly);
1778
+ 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);
1779
+ }),
1780
+ editable || tab.rowActions?.length ? /* @__PURE__ */ jsx13(Table2.Cell, { children: /* @__PURE__ */ jsxs9(Flex5, { gap: "5px", align: "center", wrap: "wrap", children: [
1781
+ dirty ? /* @__PURE__ */ jsxs9(Fragment2, { children: [
1782
+ /* @__PURE__ */ jsx13(Button6, { size: "xs", loading: mutation.isPending, onClick: () => {
1783
+ setErrors((e) => ({ ...e, [id]: void 0 }));
1784
+ mutation.mutate({ id, values: draft }, { onSuccess: () => setDrafts((d) => {
1785
+ const n = { ...d };
1786
+ delete n[id];
1787
+ return n;
1788
+ }), onError: (err) => setErrors((e) => ({ ...e, [id]: err })) });
1789
+ }, children: "Salvar" }),
1790
+ /* @__PURE__ */ jsx13(Button6, { size: "xs", variant: "outline", onClick: () => setDrafts((d) => {
1791
+ const n = { ...d };
1792
+ delete n[id];
1793
+ return n;
1794
+ }), children: "Cancelar" })
1795
+ ] }) : null,
1796
+ tab.rowActions?.map((action) => /* @__PURE__ */ jsx13(CoreRowAction, { action, row, parent, onRefresh }, action.id ?? action.label)),
1797
+ errors[id] ? /* @__PURE__ */ jsx13(Text8, { color: "#B42318", fontSize: "9px", children: "Erro ao salvar." }) : null
1798
+ ] }) }) : null
1799
+ ] }, id);
1800
+ }),
1801
+ rows.length === 0 ? /* @__PURE__ */ jsx13(Table2.Row, { children: /* @__PURE__ */ jsx13(Table2.Cell, { colSpan: columns.length + 1, children: /* @__PURE__ */ jsx13(Text8, { p: "8", textAlign: "center", color: "#98A2B3", children: "Nenhum registro relacionado." }) }) }) : null
1802
+ ] })
1803
+ ] }) });
1804
+ }
1805
+
1806
+ // src/components/internal/CoreTabbedDetail.tsx
1807
+ import { jsx as jsx14, jsxs as jsxs10 } from "react/jsx-runtime";
1808
+ function coerce2(value, kind) {
1809
+ if (value === "") return void 0;
1810
+ if (["number", "currency", "currencyConverted"].includes(kind ?? "")) return Number(value);
1811
+ if (kind === "boolean") return value === "true";
1812
+ return value;
1813
+ }
1814
+ function toValue2(value) {
1815
+ return value == null ? "" : String(typeof value === "object" ? value._id ?? "" : value);
1816
+ }
1817
+ function InlineParentForm({ fields, parent, resource, onSaved }) {
1818
+ const [values, setValues] = useState8({});
1819
+ const [saving, setSaving] = useState8(false);
1820
+ const [error, setError] = useState8(null);
1821
+ useEffect5(() => setValues(Object.fromEntries(fields.map((f) => [f.field, toValue2(parent[f.field])]))), [parent, fields]);
1822
+ return /* @__PURE__ */ jsx14("form", { onSubmit: async (event) => {
1823
+ event.preventDefault();
1824
+ setSaving(true);
1825
+ setError(null);
1826
+ try {
1827
+ const payload = Object.fromEntries(fields.map((f) => [f.field, coerce2(values[f.field] ?? "", f.kind)]).filter(([, v]) => v !== void 0));
1828
+ const saved = parent._id ? await resource.update(String(parent._id), payload) : await resource.create(payload);
1829
+ onSaved(saved);
1830
+ } catch (err) {
1831
+ setError(err);
1832
+ } finally {
1833
+ setSaving(false);
1834
+ }
1835
+ }, children: /* @__PURE__ */ jsxs10(Stack3, { gap: 4, children: [
1836
+ error ? /* @__PURE__ */ jsx14(Text9, { color: "#B42318", fontSize: "11px", children: "N\xE3o foi poss\xEDvel salvar." }) : null,
1837
+ /* @__PURE__ */ jsx14(SimpleGrid3, { columns: { base: 1, md: 2 }, gap: 3, children: fields.map((field) => /* @__PURE__ */ jsxs10(Box7, { children: [
1838
+ /* @__PURE__ */ jsx14(Text9, { as: "label", display: "block", mb: "5px", fontSize: "11px", fontWeight: "600", children: fieldLabel({ name: field.field, label: field.label }) }),
1839
+ field.kind === "boolean" ? /* @__PURE__ */ jsxs10(NativeSelect4.Root, { size: "sm", children: [
1840
+ /* @__PURE__ */ jsxs10(NativeSelect4.Field, { value: values[field.field] ?? "", onChange: (e) => setValues((v) => ({ ...v, [field.field]: e.currentTarget.value })), children: [
1841
+ /* @__PURE__ */ jsx14("option", { value: "", children: "\u2014" }),
1842
+ /* @__PURE__ */ jsx14("option", { value: "true", children: "Sim" }),
1843
+ /* @__PURE__ */ jsx14("option", { value: "false", children: "N\xE3o" })
1844
+ ] }),
1845
+ /* @__PURE__ */ jsx14(NativeSelect4.Indicator, {})
1846
+ ] }) : /* @__PURE__ */ jsx14(Input5, { size: "sm", type: field.kind === "date" ? "date" : ["number", "currency"].includes(field.kind ?? "") ? "number" : "text", value: values[field.field] ?? "", onChange: (e) => setValues((v) => ({ ...v, [field.field]: e.currentTarget.value })) })
1847
+ ] }, field.field)) }),
1848
+ /* @__PURE__ */ jsx14(Flex6, { justify: "flex-end", children: /* @__PURE__ */ jsx14(Button7, { type: "submit", colorPalette: "brand", loading: saving, children: "Salvar dados principais" }) })
1849
+ ] }) });
1850
+ }
1851
+ function CoreTabbedDetail({ tabs, activeTab, onTabChange, parent, formFields, resource, relations, refreshTokens, onRefresh, onParentSaved }) {
1852
+ const active = tabs.find((tab) => tab.id === activeTab) ?? tabs[0];
1853
+ return /* @__PURE__ */ jsxs10(Stack3, { gap: 4, children: [
1854
+ /* @__PURE__ */ jsx14(Flex6, { gap: 2, borderBottomWidth: "1px", borderColor: "#E5E9ED", overflowX: "auto", children: tabs.map((tab) => {
1855
+ const disabled = !parent?._id && (tab.type === "relatedGrid" || tab.type === "readonlyGrid" || tab.type === "summary");
1856
+ return /* @__PURE__ */ jsx14(Button7, { type: "button", variant: active?.id === tab.id ? "solid" : "ghost", colorPalette: active?.id === tab.id ? "brand" : void 0, disabled, onClick: () => onTabChange(tab.id), children: tab.label }, tab.id);
1857
+ }) }),
1858
+ /* @__PURE__ */ jsx14(Box7, { children: !active ? null : active.type === "summary" && parent ? /* @__PURE__ */ jsx14(CoreSummaryCards, { cards: active.cards, parent, relations }) : active.type === "form" ? /* @__PURE__ */ jsx14(InlineParentForm, { fields: fieldsForTab(formFields, active.fields ?? active.groups?.flatMap((g) => g.fields)), parent: parent ?? {}, resource, onSaved: onParentSaved }) : (active.type === "relatedGrid" || active.type === "readonlyGrid") && parent ? /* @__PURE__ */ jsx14(CoreRelatedGrid, { tab: active, parent, relations, refreshToken: refreshTokens[active.id], onRefresh }) : active.type === "customComponent" ? /* @__PURE__ */ jsxs10(Text9, { color: "#667085", children: [
1859
+ "Componente customizado: ",
1860
+ active.component
1861
+ ] }) : /* @__PURE__ */ jsx14(Text9, { color: "#667085", children: "Salve o registro principal para liberar esta aba." }) })
1862
+ ] });
1863
+ }
1864
+
1865
+ // src/components/internal/CoreDetailModal.tsx
1866
+ import { jsx as jsx15, jsxs as jsxs11 } from "react/jsx-runtime";
1867
+ function CoreDetailModal({ model, title, config, recordId, initialRecord, initialTab, relations, onClose, onSaved }) {
1868
+ const schemaQuery = useModelSchema(model);
1869
+ const schema = schemaQuery.data;
1870
+ const resource = useOonResource(schema?.basePath ?? `/${model.toLowerCase()}s`);
1871
+ const queryClient = useQueryClient2();
1872
+ const [parent, setParent] = useState9(initialRecord);
1873
+ const [activeTab, setActiveTab] = useState9(initialTab ?? config.defaultTab ?? config.tabs[0]?.id ?? "dados");
1874
+ const [refreshTokens, setRefreshTokens] = useState9({});
1875
+ const parentQuery = useQuery6({ queryKey: ["oon", "detail", model, recordId], enabled: !!recordId, queryFn: () => resource.get(recordId) });
1876
+ useEffect6(() => {
1877
+ if (parentQuery.data) setParent(parentQuery.data);
1878
+ }, [parentQuery.data]);
1879
+ const formFields = useMemo5(() => schema ? formFieldsFromMeta(schema.fields) : [], [schema]);
1880
+ const refresh = (targets) => {
1881
+ const list = targets?.length ? targets : ["self"];
1882
+ if (list.includes("parent") || list.includes("all")) {
1883
+ if (recordId) queryClient.invalidateQueries({ queryKey: ["oon", "detail", model, recordId] });
1884
+ onSaved?.();
1885
+ }
1886
+ setRefreshTokens((current) => {
1887
+ const next = { ...current };
1888
+ for (const target of list) {
1889
+ if (target === "all") config.tabs.forEach((tab) => next[tab.id] = (next[tab.id] ?? 0) + 1);
1890
+ else if (target !== "parent") next[target === "self" ? activeTab : target] = (next[target === "self" ? activeTab : target] ?? 0) + 1;
1891
+ }
1892
+ return next;
1893
+ });
1894
+ };
1895
+ const width = config.size === "full" ? "98vw" : config.size === "md" ? "760px" : config.size === "lg" ? "980px" : "1180px";
1896
+ const displayTitle = parent?.[config.titleField ?? ""] ? String(parent[config.titleField ?? ""]) : title;
1897
+ 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", w: `min(${width}, 98vw)`, maxH: "94vh", overflow: "hidden", bg: "white", borderRadius: "14px", boxShadow: "0 24px 70px rgba(15,23,42,.24)", children: [
1898
+ /* @__PURE__ */ jsxs11(Flex7, { minH: "72px", px: "20px", align: "center", justify: "space-between", borderBottomWidth: "1px", borderColor: "#E5E9ED", children: [
1899
+ /* @__PURE__ */ jsxs11(Box8, { children: [
1900
+ /* @__PURE__ */ jsx15(Text10, { color: "#0474AF", fontSize: "10px", fontWeight: "700", textTransform: "uppercase", children: "Detalhe" }),
1901
+ /* @__PURE__ */ jsx15(Heading3, { size: "md", children: recordId ? displayTitle : `Novo ${title}` })
1902
+ ] }),
1903
+ /* @__PURE__ */ jsx15(Button8, { onClick: onClose, children: "Fechar" })
1904
+ ] }),
1905
+ /* @__PURE__ */ jsx15(Box8, { maxH: "calc(94vh - 73px)", p: "20px", overflowY: "auto", children: schemaQuery.isLoading || parentQuery.isLoading ? /* @__PURE__ */ jsx15(Text10, { children: "Carregando..." }) : /* @__PURE__ */ jsx15(CoreTabbedDetail, { tabs: config.tabs, activeTab, onTabChange: setActiveTab, parent, formFields, resource, relations, refreshTokens, onRefresh: refresh, onParentSaved: (saved) => {
1906
+ setParent(saved);
1907
+ onSaved?.();
1908
+ refresh(["parent"]);
1909
+ } }) })
1910
+ ] }) });
1911
+ }
1912
+
1557
1913
  // src/components/CoreCollection.tsx
1558
- import { jsx as jsx10, jsxs as jsxs6 } from "react/jsx-runtime";
1559
- function CoreCollection({ model, label, section = "Cole\xE7\xE3o", mode = "dynamic", endpoint, columns, form, importExport }) {
1914
+ import { jsx as jsx16, jsxs as jsxs12 } from "react/jsx-runtime";
1915
+ function CoreCollection({ model, label, section = "Cole\xE7\xE3o", mode = "dynamic", endpoint, columns, form, importExport, list, relations, detailModal }) {
1560
1916
  const needsSchema = mode !== "full" || !columns || !form || !endpoint;
1561
1917
  const schemaQuery = useModelSchema(needsSchema ? model : "");
1562
1918
  const schema = schemaQuery.data;
1563
1919
  const basePath = endpoint ?? schema?.basePath ?? `/${model.toLowerCase()}s`;
1564
- const resolvedColumns = columns ?? (schema ? columnsFromMeta(schema.fields) : []);
1920
+ const resolvedColumns = (list?.columns?.length ? list.columns.map((column) => normalizeColumn(column, schema)) : columns) ?? (schema ? columnsFromMeta(schema.fields) : []);
1565
1921
  const resolvedForm = form ?? (schema ? formFieldsFromMeta(schema.fields) : []);
1566
1922
  const resource = useOonResource(basePath);
1567
- const queryClient = useQueryClient();
1568
- const [formState, setFormState] = useState6({ open: false });
1569
- const [formError, setFormError] = useState6(null);
1923
+ const queryClient = useQueryClient3();
1924
+ const [formState, setFormState] = useState10({ open: false });
1925
+ const [detailState, setDetailState] = useState10({ open: false });
1926
+ const [formError, setFormError] = useState10(null);
1570
1927
  const invalidate = () => queryClient.invalidateQueries({ queryKey: ["oon", "list", basePath] });
1571
- const saveMutation = useMutation({
1928
+ const saveMutation = useMutation2({
1572
1929
  mutationFn: (values) => {
1573
1930
  const editingRow = formState.open ? formState.row : void 0;
1574
1931
  const id = editingRow?._id;
@@ -1581,39 +1938,52 @@ function CoreCollection({ model, label, section = "Cole\xE7\xE3o", mode = "dynam
1581
1938
  },
1582
1939
  onError: (error) => setFormError(error)
1583
1940
  });
1584
- const deleteMutation = useMutation({
1941
+ const deleteMutation = useMutation2({
1585
1942
  mutationFn: (row) => resource.delete(row._id),
1586
1943
  onSuccess: invalidate
1587
1944
  });
1588
- if (needsSchema && schemaQuery.isLoading) return /* @__PURE__ */ jsx10(LoadingScreen, {});
1589
- if (needsSchema && schemaQuery.isError) return /* @__PURE__ */ jsx10(ErrorState, { error: schemaQuery.error });
1945
+ if (needsSchema && schemaQuery.isLoading) return /* @__PURE__ */ jsx16(LoadingScreen, {});
1946
+ if (needsSchema && schemaQuery.isError) return /* @__PURE__ */ jsx16(ErrorState, { error: schemaQuery.error });
1590
1947
  const title = label ?? schema?.name ?? model;
1591
- return /* @__PURE__ */ jsxs6(Stack3, { gap: 5, children: [
1592
- /* @__PURE__ */ jsxs6(Box5, { children: [
1593
- /* @__PURE__ */ jsx10(Text6, { fontSize: "11px", fontWeight: "700", color: "brand.500", textTransform: "uppercase", letterSpacing: "0.08em", mb: 1, children: section }),
1594
- /* @__PURE__ */ jsx10(Heading3, { size: "lg", color: "#24323A", letterSpacing: "-0.02em", children: title }),
1595
- /* @__PURE__ */ jsx10(Text6, { mt: 1, fontSize: "13px", color: "gray.500", children: "Consulte, filtre e mantenha os registros desta opera\xE7\xE3o." })
1948
+ return /* @__PURE__ */ jsxs12(Stack4, { gap: 5, children: [
1949
+ /* @__PURE__ */ jsxs12(Box9, { children: [
1950
+ /* @__PURE__ */ jsx16(Text11, { fontSize: "11px", fontWeight: "700", color: "brand.500", textTransform: "uppercase", letterSpacing: "0.08em", mb: 1, children: section }),
1951
+ /* @__PURE__ */ jsx16(Heading4, { size: "lg", color: "#24323A", letterSpacing: "-0.02em", children: title }),
1952
+ /* @__PURE__ */ jsx16(Text11, { mt: 1, fontSize: "13px", color: "gray.500", children: "Consulte, filtre e mantenha os registros desta opera\xE7\xE3o." })
1596
1953
  ] }),
1597
- /* @__PURE__ */ jsx10(
1954
+ /* @__PURE__ */ jsx16(
1598
1955
  DataGrid,
1599
1956
  {
1600
1957
  resource,
1601
1958
  resourceKey: basePath,
1602
1959
  columns: resolvedColumns,
1960
+ filters: list?.filters,
1603
1961
  onCreate: () => {
1604
1962
  setFormError(null);
1605
- setFormState({ open: true });
1963
+ if (detailModal?.enabled) setDetailState({ open: true });
1964
+ else setFormState({ open: true });
1606
1965
  },
1607
1966
  onEdit: (row) => {
1608
1967
  setFormError(null);
1609
- setFormState({ open: true, row });
1968
+ if (detailModal?.enabled) setDetailState({ open: true, row });
1969
+ else setFormState({ open: true, row });
1610
1970
  },
1611
1971
  onDelete: (row) => {
1612
1972
  if (window.confirm("Excluir este registro?")) deleteMutation.mutate(row);
1613
- }
1973
+ },
1974
+ renderRowActions: list?.rowActions?.length ? (row) => list.rowActions?.map((action) => /* @__PURE__ */ jsx16(
1975
+ CoreRowAction,
1976
+ {
1977
+ action,
1978
+ row,
1979
+ onOpenDetail: (selected, initialTab) => setDetailState({ open: true, row: selected, initialTab }),
1980
+ onRefresh: invalidate
1981
+ },
1982
+ action.id ?? action.label
1983
+ )) : void 0
1614
1984
  }
1615
1985
  ),
1616
- formState.open ? /* @__PURE__ */ jsx10(
1986
+ formState.open ? /* @__PURE__ */ jsx16(
1617
1987
  DynamicForm,
1618
1988
  {
1619
1989
  title: formState.row ? `Editar ${title}` : `Novo ${title}`,
@@ -1633,14 +2003,28 @@ function CoreCollection({ model, label, section = "Cole\xE7\xE3o", mode = "dynam
1633
2003
  }
1634
2004
  }
1635
2005
  ) : null,
1636
- importExport ? null : null
2006
+ importExport ? null : null,
2007
+ detailState.open && detailModal?.enabled ? /* @__PURE__ */ jsx16(
2008
+ CoreDetailModal,
2009
+ {
2010
+ model,
2011
+ title,
2012
+ config: detailModal,
2013
+ recordId: detailState.row?._id,
2014
+ initialRecord: detailState.row,
2015
+ initialTab: detailState.initialTab,
2016
+ relations,
2017
+ onClose: () => setDetailState({ open: false }),
2018
+ onSaved: invalidate
2019
+ }
2020
+ ) : null
1637
2021
  ] });
1638
2022
  }
1639
2023
 
1640
2024
  // src/components/CoreDocument.tsx
1641
- import { jsx as jsx11 } from "react/jsx-runtime";
2025
+ import { jsx as jsx17 } from "react/jsx-runtime";
1642
2026
  function CoreDocument({ model, label, endpoint, columns, form }) {
1643
- return /* @__PURE__ */ jsx11(
2027
+ return /* @__PURE__ */ jsx17(
1644
2028
  CoreCollection,
1645
2029
  {
1646
2030
  model,
@@ -1654,10 +2038,10 @@ function CoreDocument({ model, label, endpoint, columns, form }) {
1654
2038
  }
1655
2039
 
1656
2040
  // src/components/CorePipeline.tsx
1657
- import { useState as useState7 } from "react";
1658
- import { Badge as Badge2, Box as Box6, Button as Button5, Flex as Flex5, Heading as Heading4, Stack as Stack4, Text as Text7 } from "@chakra-ui/react";
1659
- import { useMutation as useMutation2, useQuery as useQuery4, useQueryClient as useQueryClient2 } from "@tanstack/react-query";
1660
- import { jsx as jsx12, jsxs as jsxs7 } from "react/jsx-runtime";
2041
+ import { useState as useState11 } from "react";
2042
+ import { Badge as Badge4, Box as Box10, Button as Button9, Flex as Flex8, Heading as Heading5, Stack as Stack5, Text as Text12 } from "@chakra-ui/react";
2043
+ import { useMutation as useMutation3, useQuery as useQuery7, useQueryClient as useQueryClient4 } from "@tanstack/react-query";
2044
+ import { jsx as jsx18, jsxs as jsxs13 } from "react/jsx-runtime";
1661
2045
  function ticketId(row) {
1662
2046
  const id = row._id ?? row.id;
1663
2047
  return id == null ? void 0 : String(id);
@@ -1667,15 +2051,15 @@ function CorePipeline({ model, label, endpoint, stageField = "status", stages, t
1667
2051
  const schema = schemaQuery.data;
1668
2052
  const basePath = endpoint ?? schema?.basePath ?? `/${model.toLowerCase()}s`;
1669
2053
  const resource = useOonResource(basePath);
1670
- const queryClient = useQueryClient2();
1671
- const [selectedTicket, setSelectedTicket] = useState7(null);
1672
- const [formError, setFormError] = useState7(null);
1673
- const listQuery = useQuery4({
2054
+ const queryClient = useQueryClient4();
2055
+ const [selectedTicket, setSelectedTicket] = useState11(null);
2056
+ const [formError, setFormError] = useState11(null);
2057
+ const listQuery = useQuery7({
1674
2058
  queryKey: ["oon", "pipeline", basePath],
1675
2059
  queryFn: () => resource.list({ pageSize: 200 }),
1676
2060
  enabled: !!schema
1677
2061
  });
1678
- const saveMutation = useMutation2({
2062
+ const saveMutation = useMutation3({
1679
2063
  mutationFn: (values) => {
1680
2064
  const id = selectedTicket ? ticketId(selectedTicket) : void 0;
1681
2065
  if (!id) throw new Error("N\xE3o foi poss\xEDvel identificar o ticket selecionado.");
@@ -1688,9 +2072,9 @@ function CorePipeline({ model, label, endpoint, stageField = "status", stages, t
1688
2072
  },
1689
2073
  onError: (error) => setFormError(error)
1690
2074
  });
1691
- if (schemaQuery.isLoading || listQuery.isLoading) return /* @__PURE__ */ jsx12(LoadingScreen, {});
1692
- if (schemaQuery.isError) return /* @__PURE__ */ jsx12(ErrorState, { error: schemaQuery.error });
1693
- if (listQuery.isError) return /* @__PURE__ */ jsx12(ErrorState, { error: listQuery.error });
2075
+ if (schemaQuery.isLoading || listQuery.isLoading) return /* @__PURE__ */ jsx18(LoadingScreen, {});
2076
+ if (schemaQuery.isError) return /* @__PURE__ */ jsx18(ErrorState, { error: schemaQuery.error });
2077
+ if (listQuery.isError) return /* @__PURE__ */ jsx18(ErrorState, { error: listQuery.error });
1694
2078
  const stageFieldMeta = schema?.fields.find((field) => field.name === stageField);
1695
2079
  const resolvedStages = stages ?? (stageFieldMeta?.options ?? []).map((option) => ({ id: option, label: option }));
1696
2080
  const title = titleField ?? schema?.fields.find((field) => field.kind === "string")?.name ?? schema?.searchable[0] ?? "_id";
@@ -1704,16 +2088,16 @@ function CorePipeline({ model, label, endpoint, stageField = "status", stages, t
1704
2088
  if (!byStage.has(key)) byStage.set(key, []);
1705
2089
  byStage.get(key).push(row);
1706
2090
  }
1707
- return /* @__PURE__ */ jsxs7(Stack4, { gap: 5, children: [
1708
- /* @__PURE__ */ jsxs7(Box6, { children: [
1709
- /* @__PURE__ */ jsx12(Text7, { fontSize: "11px", fontWeight: "700", color: "brand.500", textTransform: "uppercase", letterSpacing: "0.08em", mb: 1, children: "Esteira de processo" }),
1710
- /* @__PURE__ */ jsx12(Heading4, { size: "lg", color: "#24323A", letterSpacing: "-0.02em", children: label ?? schema?.name ?? model }),
1711
- /* @__PURE__ */ jsx12(Text7, { mt: 1, fontSize: "13px", color: "gray.500", children: "Acompanhe os tickets por etapa e visualize os principais dados de cada item." })
2091
+ return /* @__PURE__ */ jsxs13(Stack5, { gap: 5, children: [
2092
+ /* @__PURE__ */ jsxs13(Box10, { children: [
2093
+ /* @__PURE__ */ jsx18(Text12, { fontSize: "11px", fontWeight: "700", color: "brand.500", textTransform: "uppercase", letterSpacing: "0.08em", mb: 1, children: "Esteira de processo" }),
2094
+ /* @__PURE__ */ jsx18(Heading5, { size: "lg", color: "#24323A", letterSpacing: "-0.02em", children: label ?? schema?.name ?? model }),
2095
+ /* @__PURE__ */ jsx18(Text12, { mt: 1, fontSize: "13px", color: "gray.500", children: "Acompanhe os tickets por etapa e visualize os principais dados de cada item." })
1712
2096
  ] }),
1713
- /* @__PURE__ */ jsx12(Flex5, { gap: 4, align: "stretch", overflowX: "auto", pb: 3, minH: "420px", children: Array.from(byStage.entries()).map(([stageId, items]) => {
2097
+ /* @__PURE__ */ jsx18(Flex8, { gap: 4, align: "stretch", overflowX: "auto", pb: 3, minH: "420px", children: Array.from(byStage.entries()).map(([stageId, items]) => {
1714
2098
  const stageLabel = resolvedStages.find((stage) => stage.id === stageId)?.label ?? (stageId || "Sem etapa");
1715
- return /* @__PURE__ */ jsxs7(
1716
- Box6,
2099
+ return /* @__PURE__ */ jsxs13(
2100
+ Box10,
1717
2101
  {
1718
2102
  minW: "300px",
1719
2103
  maxW: "340px",
@@ -1724,14 +2108,14 @@ function CorePipeline({ model, label, endpoint, stageField = "status", stages, t
1724
2108
  borderWidth: "1px",
1725
2109
  borderColor: "#DDE3E7",
1726
2110
  children: [
1727
- /* @__PURE__ */ jsxs7(Flex5, { align: "center", justify: "space-between", mb: 3, px: 1, children: [
1728
- /* @__PURE__ */ jsx12(Text7, { fontWeight: "700", fontSize: "12px", color: "#33434C", textTransform: "uppercase", letterSpacing: "0.03em", children: stageLabel }),
1729
- /* @__PURE__ */ jsx12(Badge2, { colorPalette: "brand", variant: "solid", borderRadius: "full", minW: "24px", justifyContent: "center", children: items.length })
2111
+ /* @__PURE__ */ jsxs13(Flex8, { align: "center", justify: "space-between", mb: 3, px: 1, children: [
2112
+ /* @__PURE__ */ jsx18(Text12, { fontWeight: "700", fontSize: "12px", color: "#33434C", textTransform: "uppercase", letterSpacing: "0.03em", children: stageLabel }),
2113
+ /* @__PURE__ */ jsx18(Badge4, { colorPalette: "brand", variant: "solid", borderRadius: "full", minW: "24px", justifyContent: "center", children: items.length })
1730
2114
  ] }),
1731
- /* @__PURE__ */ jsx12(Stack4, { gap: 2, children: items.length === 0 ? /* @__PURE__ */ jsx12(Box6, { borderWidth: "1px", borderStyle: "dashed", borderColor: "#C8D0D5", borderRadius: "10px", p: 5, textAlign: "center", children: /* @__PURE__ */ jsx12(Text7, { fontSize: "12px", color: "gray.500", children: "Nenhum ticket nesta etapa." }) }) : items.map((row, index) => {
2115
+ /* @__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) => {
1732
2116
  const ticketTitle = formatCell(row[title], "string");
1733
- return /* @__PURE__ */ jsxs7(
1734
- Button5,
2117
+ return /* @__PURE__ */ jsxs13(
2118
+ Button9,
1735
2119
  {
1736
2120
  type: "button",
1737
2121
  variant: "plain",
@@ -1756,10 +2140,10 @@ function CorePipeline({ model, label, endpoint, stageField = "status", stages, t
1756
2140
  _hover: { borderColor: "brand.300", transform: "translateY(-1px)", boxShadow: "0 7px 18px rgba(7, 38, 46, 0.09)" },
1757
2141
  _focusVisible: { borderColor: "brand.500", boxShadow: "0 0 0 3px rgba(4, 116, 175, 0.16)" },
1758
2142
  children: [
1759
- /* @__PURE__ */ jsx12(Text7, { fontSize: "13px", fontWeight: "700", color: "#24323A", mb: 2, lineClamp: 2, children: ticketTitle }),
1760
- /* @__PURE__ */ jsx12(Stack4, { gap: 1, children: detailFields.map((field) => /* @__PURE__ */ jsxs7(Flex5, { gap: 2, align: "baseline", justify: "space-between", children: [
1761
- /* @__PURE__ */ jsx12(Text7, { fontSize: "10px", color: "gray.500", textTransform: "uppercase", letterSpacing: "0.03em", children: fieldLabel(field) }),
1762
- /* @__PURE__ */ jsx12(Text7, { fontSize: "11px", color: "#46545C", fontWeight: "500", textAlign: "right", lineClamp: 1, children: formatCell(row[field.name], field.kind) })
2143
+ /* @__PURE__ */ jsx18(Text12, { fontSize: "13px", fontWeight: "700", color: "#24323A", mb: 2, lineClamp: 2, children: ticketTitle }),
2144
+ /* @__PURE__ */ jsx18(Stack5, { gap: 1, children: detailFields.map((field) => /* @__PURE__ */ jsxs13(Flex8, { gap: 2, align: "baseline", justify: "space-between", children: [
2145
+ /* @__PURE__ */ jsx18(Text12, { fontSize: "10px", color: "gray.500", textTransform: "uppercase", letterSpacing: "0.03em", children: fieldLabel(field) }),
2146
+ /* @__PURE__ */ jsx18(Text12, { fontSize: "11px", color: "#46545C", fontWeight: "500", textAlign: "right", lineClamp: 1, children: formatCell(row[field.name], field.kind) })
1763
2147
  ] }, field.name)) })
1764
2148
  ]
1765
2149
  },
@@ -1771,7 +2155,7 @@ function CorePipeline({ model, label, endpoint, stageField = "status", stages, t
1771
2155
  stageId
1772
2156
  );
1773
2157
  }) }),
1774
- selectedTicket ? /* @__PURE__ */ jsx12(
2158
+ selectedTicket ? /* @__PURE__ */ jsx18(
1775
2159
  DynamicForm,
1776
2160
  {
1777
2161
  title: `Editar ${schema?.singular ?? label ?? model}`,
@@ -1796,9 +2180,9 @@ function CorePipeline({ model, label, endpoint, stageField = "status", stages, t
1796
2180
  }
1797
2181
 
1798
2182
  // src/components/CoreDashboard.tsx
1799
- import { Box as Box7, Heading as Heading5, SimpleGrid as SimpleGrid2, Stack as Stack5, Text as Text8 } from "@chakra-ui/react";
2183
+ import { Box as Box11, Heading as Heading6, SimpleGrid as SimpleGrid4, Stack as Stack6, Text as Text13 } from "@chakra-ui/react";
1800
2184
  import { useQueries } from "@tanstack/react-query";
1801
- import { jsx as jsx13, jsxs as jsxs8 } from "react/jsx-runtime";
2185
+ import { jsx as jsx19, jsxs as jsxs14 } from "react/jsx-runtime";
1802
2186
  function CoreDashboard({ label = "Dashboard", widgets = [] }) {
1803
2187
  const { resource } = useOonApi();
1804
2188
  const queries = useQueries({
@@ -1815,17 +2199,17 @@ function CoreDashboard({ label = "Dashboard", widgets = [] }) {
1815
2199
  }))
1816
2200
  });
1817
2201
  let queryIdx = 0;
1818
- return /* @__PURE__ */ jsxs8(Stack5, { gap: 6, children: [
1819
- /* @__PURE__ */ jsx13(Heading5, { size: "lg", children: label }),
1820
- /* @__PURE__ */ jsx13(SimpleGrid2, { columns: { base: 1, md: 2, lg: 3 }, gap: 4, children: widgets.map((w) => {
2202
+ return /* @__PURE__ */ jsxs14(Stack6, { gap: 6, children: [
2203
+ /* @__PURE__ */ jsx19(Heading6, { size: "lg", children: label }),
2204
+ /* @__PURE__ */ jsx19(SimpleGrid4, { columns: { base: 1, md: 2, lg: 3 }, gap: 4, children: widgets.map((w) => {
1821
2205
  if (w.kind === "custom" && w.render) {
1822
- return /* @__PURE__ */ jsx13(Box7, { borderWidth: "1px", borderColor: "gray.200", borderRadius: "md", bg: "white", p: 5, children: w.render() }, w.id);
2206
+ return /* @__PURE__ */ jsx19(Box11, { borderWidth: "1px", borderColor: "gray.200", borderRadius: "md", bg: "white", p: 5, children: w.render() }, w.id);
1823
2207
  }
1824
2208
  const q = queries[queryIdx++];
1825
2209
  const value = q?.isLoading ? "\u2026" : q?.isError ? "\u2014" : formatWidget(q?.data, w.kind, w.field);
1826
- return /* @__PURE__ */ jsxs8(Box7, { borderWidth: "1px", borderColor: "gray.200", borderRadius: "md", bg: "white", p: 5, children: [
1827
- /* @__PURE__ */ jsx13(Text8, { fontSize: "sm", color: "gray.500", children: w.label }),
1828
- /* @__PURE__ */ jsx13(Heading5, { size: "xl", mt: 1, children: value })
2210
+ return /* @__PURE__ */ jsxs14(Box11, { borderWidth: "1px", borderColor: "gray.200", borderRadius: "md", bg: "white", p: 5, children: [
2211
+ /* @__PURE__ */ jsx19(Text13, { fontSize: "sm", color: "gray.500", children: w.label }),
2212
+ /* @__PURE__ */ jsx19(Heading6, { size: "xl", mt: 1, children: value })
1829
2213
  ] }, w.id);
1830
2214
  }) })
1831
2215
  ] });
@@ -1839,22 +2223,22 @@ function formatWidget(value, kind, field) {
1839
2223
  }
1840
2224
 
1841
2225
  // src/components/ui-v2/CorePage.tsx
1842
- import { Box as Box10, Heading as Heading7, Stack as Stack6, Text as Text11 } from "@chakra-ui/react";
2226
+ import { Box as Box14, Heading as Heading8, Stack as Stack7, Text as Text16 } from "@chakra-ui/react";
1843
2227
 
1844
2228
  // src/security/PermissionGate.tsx
1845
- import { Fragment, jsx as jsx14 } from "react/jsx-runtime";
2229
+ import { Fragment as Fragment3, jsx as jsx20 } from "react/jsx-runtime";
1846
2230
  function PermissionGate({
1847
2231
  permission,
1848
2232
  fallback = null,
1849
2233
  children
1850
2234
  }) {
1851
2235
  const { hasPermission } = useOonAuth();
1852
- return /* @__PURE__ */ jsx14(Fragment, { children: hasPermission(permission) ? children : fallback });
2236
+ return /* @__PURE__ */ jsx20(Fragment3, { children: hasPermission(permission) ? children : fallback });
1853
2237
  }
1854
2238
 
1855
2239
  // src/app/componentRegistry.tsx
1856
- import { Box as Box8, Text as Text9 } from "@chakra-ui/react";
1857
- import { Fragment as Fragment2, jsx as jsx15, jsxs as jsxs9 } from "react/jsx-runtime";
2240
+ import { Box as Box12, Text as Text14 } from "@chakra-ui/react";
2241
+ import { Fragment as Fragment4, jsx as jsx21, jsxs as jsxs15 } from "react/jsx-runtime";
1858
2242
  var PREFIX_BUCKETS = {
1859
2243
  "custom": "pageComponents",
1860
2244
  "fields": "fieldRenderers",
@@ -1874,12 +2258,12 @@ function resolveComponent(registry, key, bucket) {
1874
2258
  return registry?.[targetBucket]?.[normalized] ?? registry?.[targetBucket]?.[key] ?? null;
1875
2259
  }
1876
2260
  function MissingRenderer({ renderer, children }) {
1877
- if (import.meta.env?.MODE === "production") return /* @__PURE__ */ jsx15(Fragment2, { children: children ?? null });
1878
- return /* @__PURE__ */ jsxs9(Box8, { borderWidth: "1px", borderStyle: "dashed", borderColor: "orange.300", bg: "orange.50", color: "orange.900", borderRadius: "md", p: 3, children: [
1879
- /* @__PURE__ */ jsx15(Text9, { fontSize: "sm", fontWeight: "600", children: "Renderer n\xE3o encontrado" }),
1880
- /* @__PURE__ */ jsxs9(Text9, { fontSize: "xs", children: [
2261
+ if (import.meta.env?.MODE === "production") return /* @__PURE__ */ jsx21(Fragment4, { children: children ?? null });
2262
+ return /* @__PURE__ */ jsxs15(Box12, { borderWidth: "1px", borderStyle: "dashed", borderColor: "orange.300", bg: "orange.50", color: "orange.900", borderRadius: "md", p: 3, children: [
2263
+ /* @__PURE__ */ jsx21(Text14, { fontSize: "sm", fontWeight: "600", children: "Renderer n\xE3o encontrado" }),
2264
+ /* @__PURE__ */ jsxs15(Text14, { fontSize: "xs", children: [
1881
2265
  "Registre a chave ",
1882
- renderer ? /* @__PURE__ */ jsx15("code", { children: renderer }) : "solicitada",
2266
+ renderer ? /* @__PURE__ */ jsx21("code", { children: renderer }) : "solicitada",
1883
2267
  " no registry da UI."
1884
2268
  ] }),
1885
2269
  children
@@ -1887,61 +2271,61 @@ function MissingRenderer({ renderer, children }) {
1887
2271
  }
1888
2272
 
1889
2273
  // src/components/ui-v2/CorePrimitives.tsx
1890
- import { Box as Box9, Button as Button6, Flex as Flex6, Heading as Heading6, Spinner as Spinner3, Text as Text10 } from "@chakra-ui/react";
1891
- import { jsx as jsx16, jsxs as jsxs10 } from "react/jsx-runtime";
2274
+ import { Box as Box13, Button as Button10, Flex as Flex9, Heading as Heading7, Spinner as Spinner3, Text as Text15 } from "@chakra-ui/react";
2275
+ import { jsx as jsx22, jsxs as jsxs16 } from "react/jsx-runtime";
1892
2276
  function CorePage({ children }) {
1893
- return /* @__PURE__ */ jsx16(Box9, { children });
2277
+ return /* @__PURE__ */ jsx22(Box13, { children });
1894
2278
  }
1895
2279
  function CorePageHeader({ title, description, actions }) {
1896
- return /* @__PURE__ */ jsxs10(Flex6, { align: "start", justify: "space-between", gap: 4, mb: 6, children: [
1897
- /* @__PURE__ */ jsxs10(Box9, { children: [
1898
- title ? /* @__PURE__ */ jsx16(Heading6, { size: "lg", children: title }) : null,
1899
- description ? /* @__PURE__ */ jsx16(Text10, { color: "gray.600", mt: 1, children: description }) : null
2280
+ return /* @__PURE__ */ jsxs16(Flex9, { align: "start", justify: "space-between", gap: 4, mb: 6, children: [
2281
+ /* @__PURE__ */ jsxs16(Box13, { children: [
2282
+ title ? /* @__PURE__ */ jsx22(Heading7, { size: "lg", children: title }) : null,
2283
+ description ? /* @__PURE__ */ jsx22(Text15, { color: "gray.600", mt: 1, children: description }) : null
1900
2284
  ] }),
1901
2285
  actions
1902
2286
  ] });
1903
2287
  }
1904
2288
  function CoreToolbar({ children }) {
1905
- return /* @__PURE__ */ jsx16(Flex6, { align: "center", gap: 2, mb: 4, children });
2289
+ return /* @__PURE__ */ jsx22(Flex9, { align: "center", gap: 2, mb: 4, children });
1906
2290
  }
1907
2291
  function CoreDataGrid(props) {
1908
- return /* @__PURE__ */ jsx16(CoreCollection, { ...props });
2292
+ return /* @__PURE__ */ jsx22(CoreCollection, { ...props });
1909
2293
  }
1910
2294
  function CoreCards(props) {
1911
- return /* @__PURE__ */ jsx16(CoreCollection, { model: props.model, mode: "minimal", label: props.model });
2295
+ return /* @__PURE__ */ jsx22(CoreCollection, { model: props.model, mode: "minimal", label: props.model });
1912
2296
  }
1913
2297
  function CoreForm(props) {
1914
- return /* @__PURE__ */ jsx16(Box9, { children: props.children });
2298
+ return /* @__PURE__ */ jsx22(Box13, { children: props.children });
1915
2299
  }
1916
2300
  function CoreField({ label, children }) {
1917
- return /* @__PURE__ */ jsxs10(Box9, { children: [
1918
- /* @__PURE__ */ jsx16(Text10, { fontSize: "sm", fontWeight: "600", children: label }),
2301
+ return /* @__PURE__ */ jsxs16(Box13, { children: [
2302
+ /* @__PURE__ */ jsx22(Text15, { fontSize: "sm", fontWeight: "600", children: label }),
1919
2303
  children
1920
2304
  ] });
1921
2305
  }
1922
2306
  function CoreRelationField(props) {
1923
- return /* @__PURE__ */ jsx16(CoreField, { ...props });
2307
+ return /* @__PURE__ */ jsx22(CoreField, { ...props });
1924
2308
  }
1925
2309
  function CoreActions({ children }) {
1926
- return /* @__PURE__ */ jsx16(Flex6, { gap: 2, children });
2310
+ return /* @__PURE__ */ jsx22(Flex9, { gap: 2, children });
1927
2311
  }
1928
2312
  function CoreEmptyState({ title = "Nenhum dado encontrado", actionLabel, onAction }) {
1929
- return /* @__PURE__ */ jsxs10(Box9, { textAlign: "center", py: 10, children: [
1930
- /* @__PURE__ */ jsx16(Text10, { children: title }),
1931
- actionLabel ? /* @__PURE__ */ jsx16(Button6, { mt: 3, onClick: onAction, children: actionLabel }) : null
2313
+ return /* @__PURE__ */ jsxs16(Box13, { textAlign: "center", py: 10, children: [
2314
+ /* @__PURE__ */ jsx22(Text15, { children: title }),
2315
+ actionLabel ? /* @__PURE__ */ jsx22(Button10, { mt: 3, onClick: onAction, children: actionLabel }) : null
1932
2316
  ] });
1933
2317
  }
1934
2318
  function CoreLoadingState({ label = "Carregando..." }) {
1935
- return /* @__PURE__ */ jsxs10(Flex6, { align: "center", gap: 3, children: [
1936
- /* @__PURE__ */ jsx16(Spinner3, { size: "sm" }),
1937
- /* @__PURE__ */ jsx16(Text10, { children: label })
2319
+ return /* @__PURE__ */ jsxs16(Flex9, { align: "center", gap: 3, children: [
2320
+ /* @__PURE__ */ jsx22(Spinner3, { size: "sm" }),
2321
+ /* @__PURE__ */ jsx22(Text15, { children: label })
1938
2322
  ] });
1939
2323
  }
1940
2324
 
1941
2325
  // src/components/ui-v2/CorePage.tsx
1942
- import { jsx as jsx17, jsxs as jsxs11 } from "react/jsx-runtime";
2326
+ import { jsx as jsx23, jsxs as jsxs17 } from "react/jsx-runtime";
1943
2327
  function renderMarkdown(content) {
1944
- return content.split(/\n{2,}/).map((paragraph, index) => /* @__PURE__ */ jsx17(Text11, { whiteSpace: "pre-wrap", children: paragraph }, index));
2328
+ return content.split(/\n{2,}/).map((paragraph, index) => /* @__PURE__ */ jsx23(Text16, { whiteSpace: "pre-wrap", children: paragraph }, index));
1945
2329
  }
1946
2330
  function requiredAccess(source) {
1947
2331
  const values = [...source.permissions ?? [], ...source.capabilities ?? []].filter(Boolean);
@@ -1953,38 +2337,38 @@ function CoreBlock({ block, registry }) {
1953
2337
  switch (block.type) {
1954
2338
  case "custom": {
1955
2339
  const Component = resolveComponent(registry, block.component, "pageComponents");
1956
- return Component ? /* @__PURE__ */ jsx17(Component, { block, ...block.props }) : /* @__PURE__ */ jsx17(MissingRenderer, { renderer: block.component });
2340
+ return Component ? /* @__PURE__ */ jsx23(Component, { block, ...block.props }) : /* @__PURE__ */ jsx23(MissingRenderer, { renderer: block.component });
1957
2341
  }
1958
2342
  case "collection.datagrid":
1959
- return /* @__PURE__ */ jsx17(CoreDataGrid, { model: block.model, mode: block.mode, columns: block.columns, form: block.form, label: block.title ?? block.model });
2343
+ return /* @__PURE__ */ jsx23(CoreDataGrid, { model: block.model, mode: block.mode, columns: block.columns, form: block.form, label: block.title ?? block.model });
1960
2344
  case "collection.cards": {
1961
2345
  const Component = resolveComponent(registry, block.renderer, "cardRenderers");
1962
- return Component ? /* @__PURE__ */ jsx17(Component, { block, model: block.model }) : /* @__PURE__ */ jsx17(CoreCards, { model: block.model, renderer: block.renderer });
2346
+ return Component ? /* @__PURE__ */ jsx23(Component, { block, model: block.model }) : /* @__PURE__ */ jsx23(CoreCards, { model: block.model, renderer: block.renderer });
1963
2347
  }
1964
2348
  case "section":
1965
- return /* @__PURE__ */ jsxs11(Box10, { children: [
1966
- /* @__PURE__ */ jsx17(Heading7, { size: "md", mb: block.description ? 1 : 4, children: block.title }),
1967
- block.description ? /* @__PURE__ */ jsx17(Text11, { color: "gray.600", mb: 4, children: block.description }) : null,
1968
- /* @__PURE__ */ jsx17(Stack6, { gap: 4, children: block.blocks?.map((child, index) => /* @__PURE__ */ jsx17(CoreBlock, { block: child, registry }, child.id ?? index)) })
2349
+ return /* @__PURE__ */ jsxs17(Box14, { children: [
2350
+ /* @__PURE__ */ jsx23(Heading8, { size: "md", mb: block.description ? 1 : 4, children: block.title }),
2351
+ block.description ? /* @__PURE__ */ jsx23(Text16, { color: "gray.600", mb: 4, children: block.description }) : null,
2352
+ /* @__PURE__ */ jsx23(Stack7, { gap: 4, children: block.blocks?.map((child, index) => /* @__PURE__ */ jsx23(CoreBlock, { block: child, registry }, child.id ?? index)) })
1969
2353
  ] });
1970
2354
  case "markdown":
1971
- return /* @__PURE__ */ jsx17(Stack6, { gap: 2, children: renderMarkdown(block.content) });
2355
+ return /* @__PURE__ */ jsx23(Stack7, { gap: 2, children: renderMarkdown(block.content) });
1972
2356
  default:
1973
- return /* @__PURE__ */ jsx17(MissingRenderer, { renderer: block.type });
2357
+ return /* @__PURE__ */ jsx23(MissingRenderer, { renderer: block.type });
1974
2358
  }
1975
2359
  })();
1976
- return /* @__PURE__ */ jsx17(PermissionGate, { permission: requiredAccess(block), children: content });
2360
+ return /* @__PURE__ */ jsx23(PermissionGate, { permission: requiredAccess(block), children: content });
1977
2361
  }
1978
2362
  function CorePage2({ page, registry }) {
1979
2363
  const Component = resolveComponent(registry, page.component, "pageComponents");
1980
- return /* @__PURE__ */ jsx17(PermissionGate, { permission: requiredAccess(page), children: Component ? /* @__PURE__ */ jsx17(Component, { page }) : /* @__PURE__ */ jsxs11(CorePage, { children: [
1981
- /* @__PURE__ */ jsx17(CorePageHeader, { title: page.title ?? page.label }),
1982
- /* @__PURE__ */ jsx17(Stack6, { gap: 6, children: page.blocks?.map((block, index) => /* @__PURE__ */ jsx17(CoreBlock, { block, registry }, block.id ?? index)) })
2364
+ return /* @__PURE__ */ jsx23(PermissionGate, { permission: requiredAccess(page), children: Component ? /* @__PURE__ */ jsx23(Component, { page }) : /* @__PURE__ */ jsxs17(CorePage, { children: [
2365
+ /* @__PURE__ */ jsx23(CorePageHeader, { title: page.title ?? page.label }),
2366
+ /* @__PURE__ */ jsx23(Stack7, { gap: 6, children: page.blocks?.map((block, index) => /* @__PURE__ */ jsx23(CoreBlock, { block, registry }, block.id ?? index)) })
1983
2367
  ] }) });
1984
2368
  }
1985
2369
 
1986
2370
  // src/app/moduleRegistry.tsx
1987
- import { jsx as jsx18 } from "react/jsx-runtime";
2371
+ import { jsx as jsx24 } from "react/jsx-runtime";
1988
2372
  function slug(value) {
1989
2373
  return value.normalize("NFD").replace(/[\u0300-\u036f]/g, "").toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "");
1990
2374
  }
@@ -2011,7 +2395,7 @@ function renderView(view) {
2011
2395
  switch (view.type) {
2012
2396
  case "collection": {
2013
2397
  const v = view;
2014
- return /* @__PURE__ */ jsx18(
2398
+ return /* @__PURE__ */ jsx24(
2015
2399
  CoreCollection,
2016
2400
  {
2017
2401
  model: v.model,
@@ -2019,17 +2403,21 @@ function renderView(view) {
2019
2403
  columns: v.columns,
2020
2404
  form: v.form,
2021
2405
  label: viewLabel(v),
2022
- importExport: v.importExport
2406
+ section: v.section,
2407
+ importExport: v.importExport,
2408
+ list: v.list,
2409
+ relations: v.relations,
2410
+ detailModal: v.detailModal
2023
2411
  }
2024
2412
  );
2025
2413
  }
2026
2414
  case "document": {
2027
2415
  const v = view;
2028
- return /* @__PURE__ */ jsx18(CoreDocument, { model: v.model, label: viewLabel(v), approval: v.approval, attachments: v.attachments });
2416
+ return /* @__PURE__ */ jsx24(CoreDocument, { model: v.model, label: viewLabel(v), approval: v.approval, attachments: v.attachments });
2029
2417
  }
2030
2418
  case "pipeline": {
2031
2419
  const v = view;
2032
- return /* @__PURE__ */ jsx18(
2420
+ return /* @__PURE__ */ jsx24(
2033
2421
  CorePipeline,
2034
2422
  {
2035
2423
  model: v.model,
@@ -2041,7 +2429,7 @@ function renderView(view) {
2041
2429
  }
2042
2430
  case "dashboard": {
2043
2431
  const v = view;
2044
- return /* @__PURE__ */ jsx18(CoreDashboard, { label: viewLabel(v), widgets: v.widgets });
2432
+ return /* @__PURE__ */ jsx24(CoreDashboard, { label: viewLabel(v), widgets: v.widgets });
2045
2433
  }
2046
2434
  default:
2047
2435
  return null;
@@ -2055,7 +2443,7 @@ function viewToRoute(view) {
2055
2443
  };
2056
2444
  }
2057
2445
  function pageToRoute(page, registry) {
2058
- return { path: page.path, element: /* @__PURE__ */ jsx18(CorePage2, { page, registry }), permissions: requiredAccess2(page) };
2446
+ return { path: page.path, element: /* @__PURE__ */ jsx24(CorePage2, { page, registry }), permissions: requiredAccess2(page) };
2059
2447
  }
2060
2448
  function pageToMenu(page) {
2061
2449
  if (page.hidden || !page.label) return null;
@@ -2116,13 +2504,13 @@ import {
2116
2504
  } from "react-router-dom";
2117
2505
 
2118
2506
  // src/shell/DefaultShell.tsx
2119
- import { Box as Box12, Button as Button7, Flex as Flex8, Spacer as Spacer2, Text as Text13 } from "@chakra-ui/react";
2507
+ import { Box as Box16, Button as Button11, Flex as Flex11, Spacer as Spacer2, Text as Text18 } from "@chakra-ui/react";
2120
2508
  import { Outlet } from "react-router-dom";
2121
2509
 
2122
2510
  // src/shell/Sidebar.tsx
2123
- import { Box as Box11, Flex as Flex7, Image, Stack as Stack7, Text as Text12 } from "@chakra-ui/react";
2511
+ import { Box as Box15, Flex as Flex10, Image, Stack as Stack8, Text as Text17 } from "@chakra-ui/react";
2124
2512
  import { NavLink } from "react-router-dom";
2125
- import { jsx as jsx19, jsxs as jsxs12 } from "react/jsx-runtime";
2513
+ import { jsx as jsx25, jsxs as jsxs18 } from "react/jsx-runtime";
2126
2514
  function groupBySection(items) {
2127
2515
  const groups = /* @__PURE__ */ new Map();
2128
2516
  for (const item of items) {
@@ -2135,8 +2523,8 @@ function groupBySection(items) {
2135
2523
  function Sidebar({ app, menu, registry }) {
2136
2524
  const { hasPermission } = useOonAuth();
2137
2525
  const visible = menu.filter((item) => !item.hidden && hasPermission(item.permissions));
2138
- return /* @__PURE__ */ jsxs12(
2139
- Box11,
2526
+ return /* @__PURE__ */ jsxs18(
2527
+ Box15,
2140
2528
  {
2141
2529
  as: "nav",
2142
2530
  w: { base: "76px", lg: "248px" },
@@ -2151,9 +2539,9 @@ function Sidebar({ app, menu, registry }) {
2151
2539
  alignSelf: "flex-start",
2152
2540
  overflowY: "auto",
2153
2541
  children: [
2154
- /* @__PURE__ */ jsxs12(Flex7, { align: "center", gap: 3, mb: 6, px: { base: 1, lg: 2 }, minH: "42px", children: [
2155
- app.logo ? /* @__PURE__ */ jsx19(Image, { src: app.logo, alt: app.name, maxH: "36px", maxW: { base: "44px", lg: "150px" }, objectFit: "contain" }) : /* @__PURE__ */ jsx19(
2156
- Flex7,
2542
+ /* @__PURE__ */ jsxs18(Flex10, { align: "center", gap: 3, mb: 6, px: { base: 1, lg: 2 }, minH: "42px", children: [
2543
+ app.logo ? /* @__PURE__ */ jsx25(Image, { src: app.logo, alt: app.name, maxH: "36px", maxW: { base: "44px", lg: "150px" }, objectFit: "contain" }) : /* @__PURE__ */ jsx25(
2544
+ Flex10,
2157
2545
  {
2158
2546
  w: "38px",
2159
2547
  h: "38px",
@@ -2168,14 +2556,14 @@ function Sidebar({ app, menu, registry }) {
2168
2556
  children: "O"
2169
2557
  }
2170
2558
  ),
2171
- /* @__PURE__ */ jsxs12(Box11, { display: { base: "none", lg: "block" }, minW: 0, children: [
2172
- /* @__PURE__ */ jsx19(Text12, { fontWeight: "700", fontSize: "sm", color: "#07262E", lineClamp: 1, children: app.name }),
2173
- /* @__PURE__ */ jsx19(Text12, { fontSize: "10px", color: "gray.500", textTransform: "uppercase", letterSpacing: "0.08em", children: "Opera\xE7\xE3o digital" })
2559
+ /* @__PURE__ */ jsxs18(Box15, { display: { base: "none", lg: "block" }, minW: 0, children: [
2560
+ /* @__PURE__ */ jsx25(Text17, { fontWeight: "700", fontSize: "sm", color: "#07262E", lineClamp: 1, children: app.name }),
2561
+ /* @__PURE__ */ jsx25(Text17, { fontSize: "10px", color: "gray.500", textTransform: "uppercase", letterSpacing: "0.08em", children: "Opera\xE7\xE3o digital" })
2174
2562
  ] })
2175
2563
  ] }),
2176
- /* @__PURE__ */ jsx19(Stack7, { gap: 5, children: groupBySection(visible).map(([section, items]) => /* @__PURE__ */ jsxs12(Stack7, { gap: 1, children: [
2177
- /* @__PURE__ */ jsx19(
2178
- Text12,
2564
+ /* @__PURE__ */ jsx25(Stack8, { gap: 5, children: groupBySection(visible).map(([section, items]) => /* @__PURE__ */ jsxs18(Stack8, { gap: 1, children: [
2565
+ /* @__PURE__ */ jsx25(
2566
+ Text17,
2179
2567
  {
2180
2568
  display: { base: "none", lg: "block" },
2181
2569
  fontSize: "10px",
@@ -2190,9 +2578,9 @@ function Sidebar({ app, menu, registry }) {
2190
2578
  ),
2191
2579
  items.map((item) => {
2192
2580
  const CustomMenuItem = resolveComponent(registry, item.renderer, "menuRenderers");
2193
- if (CustomMenuItem) return /* @__PURE__ */ jsx19(CustomMenuItem, { item }, item.href);
2194
- return /* @__PURE__ */ jsx19(NavLink, { to: item.href, end: item.href === "/", title: item.label, children: ({ isActive }) => /* @__PURE__ */ jsxs12(
2195
- Flex7,
2581
+ if (CustomMenuItem) return /* @__PURE__ */ jsx25(CustomMenuItem, { item }, item.href);
2582
+ return /* @__PURE__ */ jsx25(NavLink, { to: item.href, end: item.href === "/", title: item.label, children: ({ isActive }) => /* @__PURE__ */ jsxs18(
2583
+ Flex10,
2196
2584
  {
2197
2585
  align: "center",
2198
2586
  justify: { base: "center", lg: "flex-start" },
@@ -2209,8 +2597,8 @@ function Sidebar({ app, menu, registry }) {
2209
2597
  transition: "all 0.15s ease",
2210
2598
  _hover: { bg: isActive ? "brand.50" : "#F8F9FA", color: "brand.700" },
2211
2599
  children: [
2212
- item.icon ? /* @__PURE__ */ jsx19(Box11, { flex: "0 0 auto", children: item.icon }) : /* @__PURE__ */ jsx19(Box11, { w: "7px", h: "7px", borderRadius: "full", bg: isActive ? "brand.500" : "gray.300" }),
2213
- /* @__PURE__ */ jsx19(Text12, { display: { base: "none", lg: "block" }, lineClamp: 1, children: item.label })
2600
+ 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" }),
2601
+ /* @__PURE__ */ jsx25(Text17, { display: { base: "none", lg: "block" }, lineClamp: 1, children: item.label })
2214
2602
  ]
2215
2603
  }
2216
2604
  ) }, item.href);
@@ -2222,21 +2610,21 @@ function Sidebar({ app, menu, registry }) {
2222
2610
  }
2223
2611
 
2224
2612
  // src/shell/DefaultShell.tsx
2225
- import { jsx as jsx20, jsxs as jsxs13 } from "react/jsx-runtime";
2613
+ import { jsx as jsx26, jsxs as jsxs19 } from "react/jsx-runtime";
2226
2614
  function CoreTopbar({ app }) {
2227
2615
  const { user, logout } = useOonAuth();
2228
- return /* @__PURE__ */ jsxs13(Flex8, { 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: [
2229
- /* @__PURE__ */ jsxs13(Box12, { children: [
2230
- /* @__PURE__ */ jsx20(Text13, { fontSize: "xs", fontWeight: "600", color: "brand.500", textTransform: "uppercase", letterSpacing: "0.08em", children: "Central Oon" }),
2231
- /* @__PURE__ */ jsx20(Text13, { fontSize: "sm", fontWeight: "600", color: "#24323A", children: app.title ?? app.name })
2616
+ 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: [
2617
+ /* @__PURE__ */ jsxs19(Box16, { children: [
2618
+ /* @__PURE__ */ jsx26(Text18, { fontSize: "xs", fontWeight: "600", color: "brand.500", textTransform: "uppercase", letterSpacing: "0.08em", children: "Central Oon" }),
2619
+ /* @__PURE__ */ jsx26(Text18, { fontSize: "sm", fontWeight: "600", color: "#24323A", children: app.title ?? app.name })
2232
2620
  ] }),
2233
- /* @__PURE__ */ jsx20(Spacer2, {}),
2234
- user ? /* @__PURE__ */ jsxs13(Flex8, { align: "center", gap: 3, children: [
2235
- /* @__PURE__ */ jsxs13(Box12, { textAlign: "right", display: { base: "none", md: "block" }, children: [
2236
- /* @__PURE__ */ jsx20(Text13, { fontSize: "sm", fontWeight: "600", color: "#24323A", children: user.nome }),
2237
- user.email ? /* @__PURE__ */ jsx20(Text13, { fontSize: "xs", color: "gray.500", children: user.email }) : null
2621
+ /* @__PURE__ */ jsx26(Spacer2, {}),
2622
+ user ? /* @__PURE__ */ jsxs19(Flex11, { align: "center", gap: 3, children: [
2623
+ /* @__PURE__ */ jsxs19(Box16, { textAlign: "right", display: { base: "none", md: "block" }, children: [
2624
+ /* @__PURE__ */ jsx26(Text18, { fontSize: "sm", fontWeight: "600", color: "#24323A", children: user.nome }),
2625
+ user.email ? /* @__PURE__ */ jsx26(Text18, { fontSize: "xs", color: "gray.500", children: user.email }) : null
2238
2626
  ] }),
2239
- /* @__PURE__ */ jsx20(Button7, { size: "sm", variant: "outline", colorPalette: "brand", borderRadius: "8px", onClick: logout, children: "Sair" })
2627
+ /* @__PURE__ */ jsx26(Button11, { size: "sm", variant: "outline", colorPalette: "brand", borderRadius: "8px", onClick: logout, children: "Sair" })
2240
2628
  ] }) : null
2241
2629
  ] });
2242
2630
  }
@@ -2244,45 +2632,45 @@ function Slot({ name, slot, registry, app, menu }) {
2244
2632
  if (slot === "none") return null;
2245
2633
  if (slot?.startsWith("custom:")) {
2246
2634
  const C = resolveComponent(registry, slot, "layoutSlots");
2247
- return C ? /* @__PURE__ */ jsx20(C, { app, menu }) : /* @__PURE__ */ jsx20(MissingRenderer, { renderer: slot });
2635
+ return C ? /* @__PURE__ */ jsx26(C, { app, menu }) : /* @__PURE__ */ jsx26(MissingRenderer, { renderer: slot });
2248
2636
  }
2249
- if (name === "sidebar") return /* @__PURE__ */ jsx20(Sidebar, { app, menu, registry });
2250
- if (name === "topbar") return /* @__PURE__ */ jsx20(CoreTopbar, { app });
2251
- if (name === "footer" && slot === "core") return /* @__PURE__ */ jsx20(Box12, { as: "footer", px: 6, py: 4, color: "gray.500", fontSize: "xs", borderTopWidth: "1px", children: "OonCore" });
2637
+ if (name === "sidebar") return /* @__PURE__ */ jsx26(Sidebar, { app, menu, registry });
2638
+ if (name === "topbar") return /* @__PURE__ */ jsx26(CoreTopbar, { app });
2639
+ if (name === "footer" && slot === "core") return /* @__PURE__ */ jsx26(Box16, { as: "footer", px: 6, py: 4, color: "gray.500", fontSize: "xs", borderTopWidth: "1px", children: "OonCore" });
2252
2640
  return null;
2253
2641
  }
2254
2642
  function DefaultShell({ app, menu, layout, registry }) {
2255
2643
  const portal = layout?.shell === "portal" || layout?.shell === "content-only";
2256
2644
  const mainPadding = portal ? { base: 4, lg: 10 } : { base: 4, lg: 6 };
2257
- return /* @__PURE__ */ jsxs13(Flex8, { align: "stretch", minH: "100vh", bg: portal ? "white" : "#F8F9FA", children: [
2258
- /* @__PURE__ */ jsx20(Slot, { name: "sidebar", slot: layout?.sidebar ?? "core", registry, app, menu }),
2259
- /* @__PURE__ */ jsxs13(Flex8, { direction: "column", flex: "1", minW: 0, children: [
2260
- /* @__PURE__ */ jsx20(Slot, { name: "topbar", slot: layout?.topbar ?? "core", registry, app, menu }),
2261
- /* @__PURE__ */ jsx20(Slot, { name: "header", slot: layout?.header, registry, app, menu }),
2262
- /* @__PURE__ */ jsx20(Box12, { as: "main", flex: "1", p: mainPadding, minW: 0, children: /* @__PURE__ */ jsx20(Box12, { maxW: portal ? "1180px" : "1680px", mx: "auto", children: /* @__PURE__ */ jsx20(Outlet, {}) }) }),
2263
- /* @__PURE__ */ jsx20(Slot, { name: "footer", slot: layout?.footer ?? "none", registry, app, menu })
2645
+ return /* @__PURE__ */ jsxs19(Flex11, { align: "stretch", minH: "100vh", bg: portal ? "white" : "#F8F9FA", children: [
2646
+ /* @__PURE__ */ jsx26(Slot, { name: "sidebar", slot: layout?.sidebar ?? "core", registry, app, menu }),
2647
+ /* @__PURE__ */ jsxs19(Flex11, { direction: "column", flex: "1", minW: 0, children: [
2648
+ /* @__PURE__ */ jsx26(Slot, { name: "topbar", slot: layout?.topbar ?? "core", registry, app, menu }),
2649
+ /* @__PURE__ */ jsx26(Slot, { name: "header", slot: layout?.header, registry, app, menu }),
2650
+ /* @__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, {}) }) }),
2651
+ /* @__PURE__ */ jsx26(Slot, { name: "footer", slot: layout?.footer ?? "none", registry, app, menu })
2264
2652
  ] })
2265
2653
  ] });
2266
2654
  }
2267
2655
  function PortalShell(props) {
2268
- return /* @__PURE__ */ jsx20(DefaultShell, { ...props, layout: { ...props.layout, shell: "portal" } });
2656
+ return /* @__PURE__ */ jsx26(DefaultShell, { ...props, layout: { ...props.layout, shell: "portal" } });
2269
2657
  }
2270
2658
 
2271
2659
  // src/shell/AuthenticatedLayout.tsx
2272
- import { jsx as jsx21 } from "react/jsx-runtime";
2660
+ import { jsx as jsx27 } from "react/jsx-runtime";
2273
2661
  function AuthenticatedLayout({ app, menu, layout, registry }) {
2274
2662
  if (layout?.shell?.startsWith("custom:")) {
2275
2663
  const CustomShell = resolveComponent(registry, layout.shell, "layoutSlots");
2276
- return CustomShell ? /* @__PURE__ */ jsx21(CustomShell, { app, menu, layout }) : /* @__PURE__ */ jsx21(MissingRenderer, { renderer: layout.shell });
2664
+ return CustomShell ? /* @__PURE__ */ jsx27(CustomShell, { app, menu, layout }) : /* @__PURE__ */ jsx27(MissingRenderer, { renderer: layout.shell });
2277
2665
  }
2278
- if (layout?.shell === "portal") return /* @__PURE__ */ jsx21(PortalShell, { app, menu, layout, registry });
2279
- return /* @__PURE__ */ jsx21(DefaultShell, { app, menu, layout, registry });
2666
+ if (layout?.shell === "portal") return /* @__PURE__ */ jsx27(PortalShell, { app, menu, layout, registry });
2667
+ return /* @__PURE__ */ jsx27(DefaultShell, { app, menu, layout, registry });
2280
2668
  }
2281
2669
 
2282
2670
  // src/security/AccessDeniedPage.tsx
2283
- import { Box as Box13, Button as Button8, Flex as Flex9, Heading as Heading8, Text as Text14, VStack } from "@chakra-ui/react";
2671
+ import { Box as Box17, Button as Button12, Flex as Flex12, Heading as Heading9, Text as Text19, VStack } from "@chakra-ui/react";
2284
2672
  import { useNavigate } from "react-router-dom";
2285
- import { jsx as jsx22, jsxs as jsxs14 } from "react/jsx-runtime";
2673
+ import { jsx as jsx28, jsxs as jsxs20 } from "react/jsx-runtime";
2286
2674
  function AccessDeniedPage({ app }) {
2287
2675
  const { logout } = useOonAuth();
2288
2676
  const navigate = useNavigate();
@@ -2290,8 +2678,8 @@ function AccessDeniedPage({ app }) {
2290
2678
  logout();
2291
2679
  navigate("/login", { replace: true });
2292
2680
  }
2293
- return /* @__PURE__ */ jsx22(Flex9, { minH: "100vh", align: "center", justify: "center", bg: "#F5F8FA", px: 4, children: /* @__PURE__ */ jsx22(
2294
- Box13,
2681
+ return /* @__PURE__ */ jsx28(Flex12, { minH: "100vh", align: "center", justify: "center", bg: "#F5F8FA", px: 4, children: /* @__PURE__ */ jsx28(
2682
+ Box17,
2295
2683
  {
2296
2684
  width: "100%",
2297
2685
  maxW: "560px",
@@ -2301,9 +2689,9 @@ function AccessDeniedPage({ app }) {
2301
2689
  borderRadius: "18px",
2302
2690
  boxShadow: "0 24px 70px rgba(7, 38, 46, 0.10)",
2303
2691
  p: { base: 6, md: 10 },
2304
- children: /* @__PURE__ */ jsxs14(VStack, { align: "stretch", gap: 6, children: [
2305
- /* @__PURE__ */ jsx22(
2306
- Box13,
2692
+ children: /* @__PURE__ */ jsxs20(VStack, { align: "stretch", gap: 6, children: [
2693
+ /* @__PURE__ */ jsx28(
2694
+ Box17,
2307
2695
  {
2308
2696
  width: "56px",
2309
2697
  height: "56px",
@@ -2319,9 +2707,9 @@ function AccessDeniedPage({ app }) {
2319
2707
  children: "!"
2320
2708
  }
2321
2709
  ),
2322
- /* @__PURE__ */ jsxs14(Box13, { children: [
2323
- /* @__PURE__ */ jsx22(
2324
- Text14,
2710
+ /* @__PURE__ */ jsxs20(Box17, { children: [
2711
+ /* @__PURE__ */ jsx28(
2712
+ Text19,
2325
2713
  {
2326
2714
  color: "#39BFED",
2327
2715
  fontSize: "xs",
@@ -2331,15 +2719,15 @@ function AccessDeniedPage({ app }) {
2331
2719
  children: "Acesso negado"
2332
2720
  }
2333
2721
  ),
2334
- /* @__PURE__ */ jsx22(Heading8, { mt: 2, size: "lg", color: "#07262E", children: "Voc\xEA n\xE3o possui permiss\xE3o para este aplicativo" }),
2335
- /* @__PURE__ */ jsxs14(Text14, { mt: 3, color: "gray.600", children: [
2722
+ /* @__PURE__ */ jsx28(Heading9, { mt: 2, size: "lg", color: "#07262E", children: "Voc\xEA n\xE3o possui permiss\xE3o para este aplicativo" }),
2723
+ /* @__PURE__ */ jsxs20(Text19, { mt: 3, color: "gray.600", children: [
2336
2724
  "Seu usu\xE1rio foi autenticado, mas n\xE3o existe uma permiss\xE3o ativa para acessar ",
2337
2725
  app.title ?? app.name,
2338
2726
  ". Solicite o acesso ao administrador da sua organiza\xE7\xE3o."
2339
2727
  ] })
2340
2728
  ] }),
2341
- /* @__PURE__ */ jsx22(
2342
- Button8,
2729
+ /* @__PURE__ */ jsx28(
2730
+ Button12,
2343
2731
  {
2344
2732
  alignSelf: "flex-start",
2345
2733
  bg: "#07262E",
@@ -2356,7 +2744,7 @@ function AccessDeniedPage({ app }) {
2356
2744
 
2357
2745
  // src/security/AppAccessGuard.tsx
2358
2746
  import { Navigate, useLocation } from "react-router-dom";
2359
- import { Fragment as Fragment3, jsx as jsx23 } from "react/jsx-runtime";
2747
+ import { Fragment as Fragment5, jsx as jsx29 } from "react/jsx-runtime";
2360
2748
  function loginRedirect(pathname, search) {
2361
2749
  const destination = `${pathname}${search}`;
2362
2750
  return `/login?redirect=${encodeURIComponent(destination)}`;
@@ -2364,9 +2752,9 @@ function loginRedirect(pathname, search) {
2364
2752
  function AppAccessGuard({ children }) {
2365
2753
  const { status, retry } = useOonAuth();
2366
2754
  const location = useLocation();
2367
- if (status === "loading") return /* @__PURE__ */ jsx23(LoadingScreen, {});
2755
+ if (status === "loading") return /* @__PURE__ */ jsx29(LoadingScreen, {});
2368
2756
  if (status === "unauthenticated") {
2369
- return /* @__PURE__ */ jsx23(
2757
+ return /* @__PURE__ */ jsx29(
2370
2758
  Navigate,
2371
2759
  {
2372
2760
  to: loginRedirect(location.pathname, location.search),
@@ -2375,10 +2763,10 @@ function AppAccessGuard({ children }) {
2375
2763
  );
2376
2764
  }
2377
2765
  if (status === "forbidden") {
2378
- return /* @__PURE__ */ jsx23(Navigate, { to: "/acesso-negado", replace: true });
2766
+ return /* @__PURE__ */ jsx29(Navigate, { to: "/acesso-negado", replace: true });
2379
2767
  }
2380
2768
  if (status === "error") {
2381
- return /* @__PURE__ */ jsx23(
2769
+ return /* @__PURE__ */ jsx29(
2382
2770
  LoadingScreen,
2383
2771
  {
2384
2772
  message: "N\xE3o foi poss\xEDvel validar seu acesso. Tente novamente.",
@@ -2389,22 +2777,22 @@ function AppAccessGuard({ children }) {
2389
2777
  }
2390
2778
  );
2391
2779
  }
2392
- return /* @__PURE__ */ jsx23(Fragment3, { children });
2780
+ return /* @__PURE__ */ jsx29(Fragment5, { children });
2393
2781
  }
2394
2782
 
2395
2783
  // src/security/LoginPage.tsx
2396
- import { useState as useState8 } from "react";
2784
+ import { useState as useState12 } from "react";
2397
2785
  import {
2398
- Box as Box14,
2399
- Button as Button9,
2400
- Flex as Flex10,
2401
- Heading as Heading9,
2402
- Input as Input4,
2403
- Text as Text15,
2786
+ Box as Box18,
2787
+ Button as Button13,
2788
+ Flex as Flex13,
2789
+ Heading as Heading10,
2790
+ Input as Input6,
2791
+ Text as Text20,
2404
2792
  VStack as VStack2
2405
2793
  } from "@chakra-ui/react";
2406
2794
  import { Navigate as Navigate2, useLocation as useLocation2 } from "react-router-dom";
2407
- import { jsx as jsx24, jsxs as jsxs15 } from "react/jsx-runtime";
2795
+ import { jsx as jsx30, jsxs as jsxs21 } from "react/jsx-runtime";
2408
2796
  function safeRedirect(search) {
2409
2797
  const value = new URLSearchParams(search).get("redirect") || "/";
2410
2798
  if (!value.startsWith("/") || value.startsWith("//")) return "/";
@@ -2416,16 +2804,16 @@ function safeRedirect(search) {
2416
2804
  function LoginPage({ app }) {
2417
2805
  const { status, login } = useOonAuth();
2418
2806
  const location = useLocation2();
2419
- const [email, setEmail] = useState8("");
2420
- const [password, setPassword] = useState8("");
2421
- const [submitting, setSubmitting] = useState8(false);
2422
- const [message, setMessage] = useState8(null);
2807
+ const [email, setEmail] = useState12("");
2808
+ const [password, setPassword] = useState12("");
2809
+ const [submitting, setSubmitting] = useState12(false);
2810
+ const [message, setMessage] = useState12(null);
2423
2811
  const redirect = safeRedirect(location.search);
2424
2812
  if (status === "authenticated") {
2425
- return /* @__PURE__ */ jsx24(Navigate2, { to: redirect, replace: true });
2813
+ return /* @__PURE__ */ jsx30(Navigate2, { to: redirect, replace: true });
2426
2814
  }
2427
2815
  if (status === "forbidden") {
2428
- return /* @__PURE__ */ jsx24(Navigate2, { to: "/acesso-negado", replace: true });
2816
+ return /* @__PURE__ */ jsx30(Navigate2, { to: "/acesso-negado", replace: true });
2429
2817
  }
2430
2818
  async function handleSubmit(event) {
2431
2819
  event.preventDefault();
@@ -2443,8 +2831,8 @@ function LoginPage({ app }) {
2443
2831
  setSubmitting(false);
2444
2832
  }
2445
2833
  }
2446
- return /* @__PURE__ */ jsx24(Flex10, { minH: "100vh", align: "center", justify: "center", bg: "#F5F8FA", px: 4, children: /* @__PURE__ */ jsx24(
2447
- Box14,
2834
+ return /* @__PURE__ */ jsx30(Flex13, { minH: "100vh", align: "center", justify: "center", bg: "#F5F8FA", px: 4, children: /* @__PURE__ */ jsx30(
2835
+ Box18,
2448
2836
  {
2449
2837
  width: "100%",
2450
2838
  maxW: "440px",
@@ -2454,10 +2842,10 @@ function LoginPage({ app }) {
2454
2842
  borderRadius: "18px",
2455
2843
  boxShadow: "0 24px 70px rgba(7, 38, 46, 0.10)",
2456
2844
  p: { base: 6, md: 9 },
2457
- children: /* @__PURE__ */ jsx24("form", { onSubmit: handleSubmit, children: /* @__PURE__ */ jsxs15(VStack2, { align: "stretch", gap: 6, children: [
2458
- /* @__PURE__ */ jsxs15(Box14, { children: [
2459
- /* @__PURE__ */ jsx24(
2460
- Text15,
2845
+ children: /* @__PURE__ */ jsx30("form", { onSubmit: handleSubmit, children: /* @__PURE__ */ jsxs21(VStack2, { align: "stretch", gap: 6, children: [
2846
+ /* @__PURE__ */ jsxs21(Box18, { children: [
2847
+ /* @__PURE__ */ jsx30(
2848
+ Text20,
2461
2849
  {
2462
2850
  color: "#39BFED",
2463
2851
  fontSize: "xs",
@@ -2467,14 +2855,14 @@ function LoginPage({ app }) {
2467
2855
  children: "Central Oon"
2468
2856
  }
2469
2857
  ),
2470
- /* @__PURE__ */ jsx24(Heading9, { mt: 2, size: "lg", color: "#07262E", children: app.title ?? app.name }),
2471
- /* @__PURE__ */ jsx24(Text15, { mt: 2, color: "gray.600", fontSize: "sm", children: "Entre com seu usu\xE1rio autorizado para acessar este aplicativo." })
2858
+ /* @__PURE__ */ jsx30(Heading10, { mt: 2, size: "lg", color: "#07262E", children: app.title ?? app.name }),
2859
+ /* @__PURE__ */ jsx30(Text20, { mt: 2, color: "gray.600", fontSize: "sm", children: "Entre com seu usu\xE1rio autorizado para acessar este aplicativo." })
2472
2860
  ] }),
2473
- /* @__PURE__ */ jsxs15(VStack2, { align: "stretch", gap: 4, children: [
2474
- /* @__PURE__ */ jsxs15(Box14, { children: [
2475
- /* @__PURE__ */ jsx24(Text15, { mb: 2, fontSize: "sm", fontWeight: "600", color: "#24323A", children: "E-mail" }),
2476
- /* @__PURE__ */ jsx24(
2477
- Input4,
2861
+ /* @__PURE__ */ jsxs21(VStack2, { align: "stretch", gap: 4, children: [
2862
+ /* @__PURE__ */ jsxs21(Box18, { children: [
2863
+ /* @__PURE__ */ jsx30(Text20, { mb: 2, fontSize: "sm", fontWeight: "600", color: "#24323A", children: "E-mail" }),
2864
+ /* @__PURE__ */ jsx30(
2865
+ Input6,
2478
2866
  {
2479
2867
  type: "email",
2480
2868
  value: email,
@@ -2485,10 +2873,10 @@ function LoginPage({ app }) {
2485
2873
  }
2486
2874
  )
2487
2875
  ] }),
2488
- /* @__PURE__ */ jsxs15(Box14, { children: [
2489
- /* @__PURE__ */ jsx24(Text15, { mb: 2, fontSize: "sm", fontWeight: "600", color: "#24323A", children: "Senha" }),
2490
- /* @__PURE__ */ jsx24(
2491
- Input4,
2876
+ /* @__PURE__ */ jsxs21(Box18, { children: [
2877
+ /* @__PURE__ */ jsx30(Text20, { mb: 2, fontSize: "sm", fontWeight: "600", color: "#24323A", children: "Senha" }),
2878
+ /* @__PURE__ */ jsx30(
2879
+ Input6,
2492
2880
  {
2493
2881
  type: "password",
2494
2882
  value: password,
@@ -2500,8 +2888,8 @@ function LoginPage({ app }) {
2500
2888
  )
2501
2889
  ] })
2502
2890
  ] }),
2503
- message ? /* @__PURE__ */ jsx24(
2504
- Box14,
2891
+ message ? /* @__PURE__ */ jsx30(
2892
+ Box18,
2505
2893
  {
2506
2894
  role: "alert",
2507
2895
  borderRadius: "10px",
@@ -2513,8 +2901,8 @@ function LoginPage({ app }) {
2513
2901
  children: message
2514
2902
  }
2515
2903
  ) : null,
2516
- /* @__PURE__ */ jsx24(
2517
- Button9,
2904
+ /* @__PURE__ */ jsx30(
2905
+ Button13,
2518
2906
  {
2519
2907
  type: "submit",
2520
2908
  bg: "#07262E",
@@ -2530,9 +2918,9 @@ function LoginPage({ app }) {
2530
2918
  }
2531
2919
 
2532
2920
  // src/security/ActivationPage.tsx
2533
- import { useEffect as useEffect5, useState as useState9 } from "react";
2534
- import { Box as Box15, Button as Button10, Heading as Heading10, Input as Input5, Text as Text16, VStack as VStack3 } from "@chakra-ui/react";
2535
- import { Fragment as Fragment4, jsx as jsx25, jsxs as jsxs16 } from "react/jsx-runtime";
2921
+ import { useEffect as useEffect7, useState as useState13 } from "react";
2922
+ import { Box as Box19, Button as Button14, Heading as Heading11, Input as Input7, Text as Text21, VStack as VStack3 } from "@chakra-ui/react";
2923
+ import { Fragment as Fragment6, jsx as jsx31, jsxs as jsxs22 } from "react/jsx-runtime";
2536
2924
  function encodeBasicCredentials2(email, password) {
2537
2925
  const bytes = new TextEncoder().encode(`${email}:${password}`);
2538
2926
  let binary = "";
@@ -2542,22 +2930,22 @@ function encodeBasicCredentials2(email, password) {
2542
2930
  function ActivationPage() {
2543
2931
  const { http } = useOonApi();
2544
2932
  const activation = useActivation();
2545
- const [step, setStep] = useState9(1);
2546
- const [config, setConfig] = useState9(null);
2547
- const [code, setCode] = useState9("");
2548
- const [preview, setPreview] = useState9(null);
2549
- const [global, setGlobal] = useState9({});
2550
- const [app, setApp] = useState9({});
2551
- const [rootEmail, setRootEmail] = useState9("");
2552
- const [rootPassword, setRootPassword] = useState9("");
2553
- const [devName, setDevName] = useState9("");
2554
- const [devEmail, setDevEmail] = useState9("");
2555
- const [devPassword, setDevPassword] = useState9("");
2556
- const [showCodeFlow, setShowCodeFlow] = useState9(false);
2557
- const [devResult, setDevResult] = useState9(null);
2558
- const [error, setError] = useState9(null);
2559
- const [submitting, setSubmitting] = useState9(false);
2560
- useEffect5(() => {
2933
+ const [step, setStep] = useState13(1);
2934
+ const [config, setConfig] = useState13(null);
2935
+ const [code, setCode] = useState13("");
2936
+ const [preview, setPreview] = useState13(null);
2937
+ const [global, setGlobal] = useState13({});
2938
+ const [app, setApp] = useState13({});
2939
+ const [rootEmail, setRootEmail] = useState13("");
2940
+ const [rootPassword, setRootPassword] = useState13("");
2941
+ const [devName, setDevName] = useState13("");
2942
+ const [devEmail, setDevEmail] = useState13("");
2943
+ const [devPassword, setDevPassword] = useState13("");
2944
+ const [showCodeFlow, setShowCodeFlow] = useState13(false);
2945
+ const [devResult, setDevResult] = useState13(null);
2946
+ const [error, setError] = useState13(null);
2947
+ const [submitting, setSubmitting] = useState13(false);
2948
+ useEffect7(() => {
2561
2949
  http.get("/ativacao/configuracao").then((response) => {
2562
2950
  setConfig(response.data);
2563
2951
  setGlobal(response.data.defaults || {});
@@ -2565,7 +2953,7 @@ function ActivationPage() {
2565
2953
  () => setError("N\xE3o foi poss\xEDvel carregar a configura\xE7\xE3o de ativa\xE7\xE3o.")
2566
2954
  );
2567
2955
  }, [http]);
2568
- useEffect5(() => {
2956
+ useEffect7(() => {
2569
2957
  if (activation.status === "active") {
2570
2958
  window.location.replace("/login");
2571
2959
  }
@@ -2666,13 +3054,13 @@ function ActivationPage() {
2666
3054
  }
2667
3055
  }
2668
3056
  function renderField(field, values, setValues) {
2669
- return /* @__PURE__ */ jsxs16(Box15, { w: "100%", children: [
2670
- /* @__PURE__ */ jsxs16(Text16, { fontWeight: "medium", children: [
3057
+ return /* @__PURE__ */ jsxs22(Box19, { w: "100%", children: [
3058
+ /* @__PURE__ */ jsxs22(Text21, { fontWeight: "medium", children: [
2671
3059
  field.label,
2672
3060
  field.required ? " *" : ""
2673
3061
  ] }),
2674
- /* @__PURE__ */ jsx25(
2675
- Input5,
3062
+ /* @__PURE__ */ jsx31(
3063
+ Input7,
2676
3064
  {
2677
3065
  type: field.type === "password" || field.type === "secret" ? "password" : field.type === "email" ? "email" : field.type === "url" ? "url" : field.type === "number" || field.type === "integer" ? "number" : "text",
2678
3066
  value: String(values[field.name] ?? field.defaultValue ?? ""),
@@ -2683,16 +3071,16 @@ function ActivationPage() {
2683
3071
  onChange: (event) => setValues({ ...values, [field.name]: event.target.value })
2684
3072
  }
2685
3073
  ),
2686
- field.helpText ? /* @__PURE__ */ jsx25(Text16, { fontSize: "sm", color: "gray.500", children: field.helpText }) : null
3074
+ field.helpText ? /* @__PURE__ */ jsx31(Text21, { fontSize: "sm", color: "gray.500", children: field.helpText }) : null
2687
3075
  ] }, field.name);
2688
3076
  }
2689
3077
  function renderDevLocalActivation() {
2690
- return /* @__PURE__ */ jsxs16(Fragment4, { children: [
2691
- /* @__PURE__ */ jsx25(Text16, { 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." }),
2692
- /* @__PURE__ */ jsxs16(Box15, { w: "100%", children: [
2693
- /* @__PURE__ */ jsx25(Text16, { fontWeight: "medium", children: "Nome do usu\xE1rio" }),
2694
- /* @__PURE__ */ jsx25(
2695
- Input5,
3078
+ return /* @__PURE__ */ jsxs22(Fragment6, { children: [
3079
+ /* @__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." }),
3080
+ /* @__PURE__ */ jsxs22(Box19, { w: "100%", children: [
3081
+ /* @__PURE__ */ jsx31(Text21, { fontWeight: "medium", children: "Nome do usu\xE1rio" }),
3082
+ /* @__PURE__ */ jsx31(
3083
+ Input7,
2696
3084
  {
2697
3085
  value: devName,
2698
3086
  onChange: (event) => setDevName(event.target.value),
@@ -2701,10 +3089,10 @@ function ActivationPage() {
2701
3089
  }
2702
3090
  )
2703
3091
  ] }),
2704
- /* @__PURE__ */ jsxs16(Box15, { w: "100%", children: [
2705
- /* @__PURE__ */ jsx25(Text16, { fontWeight: "medium", children: "E-mail *" }),
2706
- /* @__PURE__ */ jsx25(
2707
- Input5,
3092
+ /* @__PURE__ */ jsxs22(Box19, { w: "100%", children: [
3093
+ /* @__PURE__ */ jsx31(Text21, { fontWeight: "medium", children: "E-mail *" }),
3094
+ /* @__PURE__ */ jsx31(
3095
+ Input7,
2708
3096
  {
2709
3097
  type: "email",
2710
3098
  value: devEmail,
@@ -2714,10 +3102,10 @@ function ActivationPage() {
2714
3102
  }
2715
3103
  )
2716
3104
  ] }),
2717
- /* @__PURE__ */ jsxs16(Box15, { w: "100%", children: [
2718
- /* @__PURE__ */ jsx25(Text16, { fontWeight: "medium", children: "Senha *" }),
2719
- /* @__PURE__ */ jsx25(
2720
- Input5,
3105
+ /* @__PURE__ */ jsxs22(Box19, { w: "100%", children: [
3106
+ /* @__PURE__ */ jsx31(Text21, { fontWeight: "medium", children: "Senha *" }),
3107
+ /* @__PURE__ */ jsx31(
3108
+ Input7,
2721
3109
  {
2722
3110
  type: "password",
2723
3111
  value: devPassword,
@@ -2728,8 +3116,8 @@ function ActivationPage() {
2728
3116
  }
2729
3117
  )
2730
3118
  ] }),
2731
- /* @__PURE__ */ jsx25(
2732
- Button10,
3119
+ /* @__PURE__ */ jsx31(
3120
+ Button14,
2733
3121
  {
2734
3122
  colorPalette: "blue",
2735
3123
  onClick: activateDevLocal,
@@ -2738,8 +3126,8 @@ function ActivationPage() {
2738
3126
  children: "Ativar ambiente de desenvolvimento"
2739
3127
  }
2740
3128
  ),
2741
- /* @__PURE__ */ jsx25(
2742
- Button10,
3129
+ /* @__PURE__ */ jsx31(
3130
+ Button14,
2743
3131
  {
2744
3132
  variant: "outline",
2745
3133
  onClick: () => setShowCodeFlow(true),
@@ -2752,7 +3140,7 @@ function ActivationPage() {
2752
3140
  const rootMode = config?.mode === "root-bootstrap" || activation.details?.role === "root";
2753
3141
  const isDevelopmentMember = !rootMode && config?.technical?.ambiente === "desenvolvimento";
2754
3142
  if (activation.status === "loading" || !config) {
2755
- return /* @__PURE__ */ jsx25(Box15, { minH: "100vh", bg: "gray.50", p: 8, children: /* @__PURE__ */ jsxs16(
3143
+ return /* @__PURE__ */ jsx31(Box19, { minH: "100vh", bg: "gray.50", p: 8, children: /* @__PURE__ */ jsxs22(
2756
3144
  VStack3,
2757
3145
  {
2758
3146
  maxW: "760px",
@@ -2763,14 +3151,14 @@ function ActivationPage() {
2763
3151
  align: "stretch",
2764
3152
  gap: 5,
2765
3153
  children: [
2766
- /* @__PURE__ */ jsx25(Heading10, { children: "Preparando ativa\xE7\xE3o..." }),
2767
- error ? /* @__PURE__ */ jsx25(Text16, { color: "red.600", children: error }) : null
3154
+ /* @__PURE__ */ jsx31(Heading11, { children: "Preparando ativa\xE7\xE3o..." }),
3155
+ error ? /* @__PURE__ */ jsx31(Text21, { color: "red.600", children: error }) : null
2768
3156
  ]
2769
3157
  }
2770
3158
  ) });
2771
3159
  }
2772
3160
  if (rootMode) {
2773
- return /* @__PURE__ */ jsx25(Box15, { minH: "100vh", bg: "gray.50", p: 8, children: /* @__PURE__ */ jsxs16(
3161
+ return /* @__PURE__ */ jsx31(Box19, { minH: "100vh", bg: "gray.50", p: 8, children: /* @__PURE__ */ jsxs22(
2774
3162
  VStack3,
2775
3163
  {
2776
3164
  maxW: "560px",
@@ -2781,21 +3169,21 @@ function ActivationPage() {
2781
3169
  align: "stretch",
2782
3170
  gap: 5,
2783
3171
  children: [
2784
- /* @__PURE__ */ jsx25(Heading10, { children: "Ativa\xE7\xE3o inicial do Ecossistema Oon" }),
2785
- /* @__PURE__ */ jsx25(Text16, { 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." }),
2786
- /* @__PURE__ */ jsxs16(Text16, { fontSize: "sm", color: "gray.500", children: [
3172
+ /* @__PURE__ */ jsx31(Heading11, { children: "Ativa\xE7\xE3o inicial do Ecossistema Oon" }),
3173
+ /* @__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." }),
3174
+ /* @__PURE__ */ jsxs22(Text21, { fontSize: "sm", color: "gray.500", children: [
2787
3175
  "App: ",
2788
3176
  config.technical.appCode,
2789
3177
  " \xB7 Ambiente:",
2790
3178
  " ",
2791
3179
  config.technical.ambiente
2792
3180
  ] }),
2793
- error ? /* @__PURE__ */ jsx25(Text16, { color: "red.600", children: error }) : null,
2794
- step !== 6 ? /* @__PURE__ */ jsxs16(Fragment4, { children: [
2795
- /* @__PURE__ */ jsxs16(Box15, { w: "100%", children: [
2796
- /* @__PURE__ */ jsx25(Text16, { fontWeight: "medium", children: "E-mail do administrador *" }),
2797
- /* @__PURE__ */ jsx25(
2798
- Input5,
3181
+ error ? /* @__PURE__ */ jsx31(Text21, { color: "red.600", children: error }) : null,
3182
+ step !== 6 ? /* @__PURE__ */ jsxs22(Fragment6, { children: [
3183
+ /* @__PURE__ */ jsxs22(Box19, { w: "100%", children: [
3184
+ /* @__PURE__ */ jsx31(Text21, { fontWeight: "medium", children: "E-mail do administrador *" }),
3185
+ /* @__PURE__ */ jsx31(
3186
+ Input7,
2799
3187
  {
2800
3188
  type: "email",
2801
3189
  autoComplete: "email",
@@ -2805,10 +3193,10 @@ function ActivationPage() {
2805
3193
  }
2806
3194
  )
2807
3195
  ] }),
2808
- /* @__PURE__ */ jsxs16(Box15, { w: "100%", children: [
2809
- /* @__PURE__ */ jsx25(Text16, { fontWeight: "medium", children: "Senha *" }),
2810
- /* @__PURE__ */ jsx25(
2811
- Input5,
3196
+ /* @__PURE__ */ jsxs22(Box19, { w: "100%", children: [
3197
+ /* @__PURE__ */ jsx31(Text21, { fontWeight: "medium", children: "Senha *" }),
3198
+ /* @__PURE__ */ jsx31(
3199
+ Input7,
2812
3200
  {
2813
3201
  type: "password",
2814
3202
  minLength: 8,
@@ -2819,8 +3207,8 @@ function ActivationPage() {
2819
3207
  }
2820
3208
  )
2821
3209
  ] }),
2822
- /* @__PURE__ */ jsx25(
2823
- Button10,
3210
+ /* @__PURE__ */ jsx31(
3211
+ Button14,
2824
3212
  {
2825
3213
  colorPalette: "blue",
2826
3214
  onClick: activateRoot,
@@ -2829,15 +3217,15 @@ function ActivationPage() {
2829
3217
  children: "Criar ecossistema e ativar"
2830
3218
  }
2831
3219
  )
2832
- ] }) : /* @__PURE__ */ jsxs16(Fragment4, { children: [
2833
- /* @__PURE__ */ jsx25(Heading10, { size: "md", children: "Ativa\xE7\xE3o conclu\xEDda" }),
2834
- /* @__PURE__ */ jsx25(Text16, { children: "Usu\xE1rio, tenant, aplicativo, licen\xE7a e permiss\xF5es foram preparados. Redirecionando para o primeiro login..." })
3220
+ ] }) : /* @__PURE__ */ jsxs22(Fragment6, { children: [
3221
+ /* @__PURE__ */ jsx31(Heading11, { size: "md", children: "Ativa\xE7\xE3o conclu\xEDda" }),
3222
+ /* @__PURE__ */ jsx31(Text21, { children: "Usu\xE1rio, tenant, aplicativo, licen\xE7a e permiss\xF5es foram preparados. Redirecionando para o primeiro login..." })
2835
3223
  ] })
2836
3224
  ]
2837
3225
  }
2838
3226
  ) });
2839
3227
  }
2840
- return /* @__PURE__ */ jsx25(Box15, { minH: "100vh", bg: "gray.50", p: 8, children: /* @__PURE__ */ jsxs16(
3228
+ return /* @__PURE__ */ jsx31(Box19, { minH: "100vh", bg: "gray.50", p: 8, children: /* @__PURE__ */ jsxs22(
2841
3229
  VStack3,
2842
3230
  {
2843
3231
  maxW: "760px",
@@ -2848,8 +3236,8 @@ function ActivationPage() {
2848
3236
  align: "stretch",
2849
3237
  gap: 5,
2850
3238
  children: [
2851
- /* @__PURE__ */ jsx25(Heading10, { children: "Ativa\xE7\xE3o da Central Oon" }),
2852
- /* @__PURE__ */ jsxs16(Text16, { children: [
3239
+ /* @__PURE__ */ jsx31(Heading11, { children: "Ativa\xE7\xE3o da Central Oon" }),
3240
+ /* @__PURE__ */ jsxs22(Text21, { children: [
2853
3241
  "App: ",
2854
3242
  config.technical.appCode,
2855
3243
  " \xB7 Ambiente:",
@@ -2859,12 +3247,12 @@ function ActivationPage() {
2859
3247
  " ",
2860
3248
  config.technical.centralAtivacaoUrl || config.technical.centralAtivacaoHost
2861
3249
  ] }),
2862
- error ? /* @__PURE__ */ jsx25(Text16, { color: "red.600", children: error }) : null,
3250
+ error ? /* @__PURE__ */ jsx31(Text21, { color: "red.600", children: error }) : null,
2863
3251
  step === 1 && isDevelopmentMember && !showCodeFlow ? renderDevLocalActivation() : null,
2864
- step === 1 && (!isDevelopmentMember || showCodeFlow) && /* @__PURE__ */ jsxs16(Fragment4, { children: [
2865
- /* @__PURE__ */ jsx25(Text16, { children: "Informe o c\xF3digo de ativa\xE7\xE3o para validar tenant, aplicativo e licen\xE7a antes de consumir o c\xF3digo." }),
2866
- /* @__PURE__ */ jsx25(
2867
- Input5,
3252
+ step === 1 && (!isDevelopmentMember || showCodeFlow) && /* @__PURE__ */ jsxs22(Fragment6, { children: [
3253
+ /* @__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." }),
3254
+ /* @__PURE__ */ jsx31(
3255
+ Input7,
2868
3256
  {
2869
3257
  "aria-label": "C\xF3digo de ativa\xE7\xE3o",
2870
3258
  value: code,
@@ -2872,8 +3260,8 @@ function ActivationPage() {
2872
3260
  placeholder: "OON-XXXX"
2873
3261
  }
2874
3262
  ),
2875
- /* @__PURE__ */ jsx25(
2876
- Button10,
3263
+ /* @__PURE__ */ jsx31(
3264
+ Button14,
2877
3265
  {
2878
3266
  onClick: validateCode,
2879
3267
  loading: submitting,
@@ -2881,8 +3269,8 @@ function ActivationPage() {
2881
3269
  children: "Validar c\xF3digo"
2882
3270
  }
2883
3271
  ),
2884
- isDevelopmentMember ? /* @__PURE__ */ jsx25(
2885
- Button10,
3272
+ isDevelopmentMember ? /* @__PURE__ */ jsx31(
3273
+ Button14,
2886
3274
  {
2887
3275
  variant: "outline",
2888
3276
  onClick: () => setShowCodeFlow(false),
@@ -2891,25 +3279,25 @@ function ActivationPage() {
2891
3279
  }
2892
3280
  ) : null
2893
3281
  ] }),
2894
- step === 2 && /* @__PURE__ */ jsxs16(Fragment4, { children: [
2895
- /* @__PURE__ */ jsx25(Heading10, { size: "md", children: "Confirma\xE7\xE3o" }),
2896
- /* @__PURE__ */ jsx25("pre", { children: JSON.stringify(preview, null, 2) }),
2897
- /* @__PURE__ */ jsx25(Button10, { onClick: () => setStep(3), children: "Continuar" })
3282
+ step === 2 && /* @__PURE__ */ jsxs22(Fragment6, { children: [
3283
+ /* @__PURE__ */ jsx31(Heading11, { size: "md", children: "Confirma\xE7\xE3o" }),
3284
+ /* @__PURE__ */ jsx31("pre", { children: JSON.stringify(preview, null, 2) }),
3285
+ /* @__PURE__ */ jsx31(Button14, { onClick: () => setStep(3), children: "Continuar" })
2898
3286
  ] }),
2899
- step === 3 && /* @__PURE__ */ jsxs16(Fragment4, { children: [
3287
+ step === 3 && /* @__PURE__ */ jsxs22(Fragment6, { children: [
2900
3288
  config.globalFields.map(
2901
3289
  (field) => renderField(field, global, setGlobal)
2902
3290
  ),
2903
- /* @__PURE__ */ jsx25(Button10, { onClick: () => setStep(4), children: "Continuar" })
3291
+ /* @__PURE__ */ jsx31(Button14, { onClick: () => setStep(4), children: "Continuar" })
2904
3292
  ] }),
2905
- step === 4 && /* @__PURE__ */ jsxs16(Fragment4, { children: [
2906
- config.appFields.length ? config.appFields.map((field) => renderField(field, app, setApp)) : /* @__PURE__ */ jsx25(Text16, { children: "Nenhum par\xE2metro adicional declarado." }),
2907
- /* @__PURE__ */ jsx25(Button10, { onClick: () => setStep(5), children: "Revisar" })
3293
+ step === 4 && /* @__PURE__ */ jsxs22(Fragment6, { children: [
3294
+ config.appFields.length ? config.appFields.map((field) => renderField(field, app, setApp)) : /* @__PURE__ */ jsx31(Text21, { children: "Nenhum par\xE2metro adicional declarado." }),
3295
+ /* @__PURE__ */ jsx31(Button14, { onClick: () => setStep(5), children: "Revisar" })
2908
3296
  ] }),
2909
- step === 5 && /* @__PURE__ */ jsxs16(Fragment4, { children: [
2910
- /* @__PURE__ */ jsx25(Text16, { children: "Ao confirmar, o c\xF3digo ser\xE1 consumido e a inst\xE2ncia ser\xE1 registrada no Ecossistema Oon." }),
2911
- /* @__PURE__ */ jsx25(
2912
- Button10,
3297
+ step === 5 && /* @__PURE__ */ jsxs22(Fragment6, { children: [
3298
+ /* @__PURE__ */ jsx31(Text21, { children: "Ao confirmar, o c\xF3digo ser\xE1 consumido e a inst\xE2ncia ser\xE1 registrada no Ecossistema Oon." }),
3299
+ /* @__PURE__ */ jsx31(
3300
+ Button14,
2913
3301
  {
2914
3302
  colorPalette: "blue",
2915
3303
  onClick: completeMemberActivation,
@@ -2919,14 +3307,14 @@ function ActivationPage() {
2919
3307
  }
2920
3308
  )
2921
3309
  ] }),
2922
- step === 6 && /* @__PURE__ */ jsxs16(Fragment4, { children: [
2923
- /* @__PURE__ */ jsx25(Heading10, { size: "md", children: "Ativa\xE7\xE3o conclu\xEDda" }),
2924
- devResult?.appCode ? /* @__PURE__ */ jsxs16(Text16, { children: [
3310
+ step === 6 && /* @__PURE__ */ jsxs22(Fragment6, { children: [
3311
+ /* @__PURE__ */ jsx31(Heading11, { size: "md", children: "Ativa\xE7\xE3o conclu\xEDda" }),
3312
+ devResult?.appCode ? /* @__PURE__ */ jsxs22(Text21, { children: [
2925
3313
  "C\xF3digo do app: ",
2926
3314
  devResult.appCode,
2927
3315
  ". Redirecionando para a Central em desenvolvimento..."
2928
- ] }) : /* @__PURE__ */ jsx25(Text16, { children: "Redirecionando para o login..." }),
2929
- devResult?.instrucoes?.env ? /* @__PURE__ */ jsx25(Text16, { fontSize: "sm", color: "gray.500", children: devResult.instrucoes.env }) : null
3316
+ ] }) : /* @__PURE__ */ jsx31(Text21, { children: "Redirecionando para o login..." }),
3317
+ devResult?.instrucoes?.env ? /* @__PURE__ */ jsx31(Text21, { fontSize: "sm", color: "gray.500", children: devResult.instrucoes.env }) : null
2930
3318
  ] })
2931
3319
  ]
2932
3320
  }
@@ -2936,47 +3324,47 @@ function InstanceBlockedPage({
2936
3324
  title,
2937
3325
  message
2938
3326
  }) {
2939
- return /* @__PURE__ */ jsxs16(Box15, { p: 8, children: [
2940
- /* @__PURE__ */ jsx25(Heading10, { children: title }),
2941
- /* @__PURE__ */ jsx25(Text16, { children: message })
3327
+ return /* @__PURE__ */ jsxs22(Box19, { p: 8, children: [
3328
+ /* @__PURE__ */ jsx31(Heading11, { children: title }),
3329
+ /* @__PURE__ */ jsx31(Text21, { children: message })
2942
3330
  ] });
2943
3331
  }
2944
3332
 
2945
3333
  // src/security/RouteGuard.tsx
2946
- import { Fragment as Fragment5, jsx as jsx26 } from "react/jsx-runtime";
3334
+ import { Fragment as Fragment7, jsx as jsx32 } from "react/jsx-runtime";
2947
3335
  function RouteGuard({
2948
3336
  permission,
2949
3337
  children
2950
3338
  }) {
2951
3339
  const { status, hasPermission } = useOonAuth();
2952
- if (status === "loading") return /* @__PURE__ */ jsx26(LoadingScreen, {});
2953
- if (status === "unauthenticated") return /* @__PURE__ */ jsx26(LoadingScreen, { message: "Redirecionando para o login..." });
3340
+ if (status === "loading") return /* @__PURE__ */ jsx32(LoadingScreen, {});
3341
+ if (status === "unauthenticated") return /* @__PURE__ */ jsx32(LoadingScreen, { message: "Redirecionando para o login..." });
2954
3342
  if (!hasPermission(permission)) {
2955
- return /* @__PURE__ */ jsx26(LoadingScreen, { message: "Voc\xEA n\xE3o tem acesso a esta tela." });
3343
+ return /* @__PURE__ */ jsx32(LoadingScreen, { message: "Voc\xEA n\xE3o tem acesso a esta tela." });
2956
3344
  }
2957
- return /* @__PURE__ */ jsx26(Fragment5, { children });
3345
+ return /* @__PURE__ */ jsx32(Fragment7, { children });
2958
3346
  }
2959
3347
 
2960
3348
  // src/security/ActivationGuard.tsx
2961
3349
  import { Navigate as Navigate3 } from "react-router-dom";
2962
- import { jsx as jsx27 } from "react/jsx-runtime";
3350
+ import { jsx as jsx33 } from "react/jsx-runtime";
2963
3351
  function ActivationGuard({ children }) {
2964
3352
  const { status } = useActivation();
2965
3353
  if (status === "loading") return null;
2966
- if (status === "suspended") return /* @__PURE__ */ jsx27(Navigate3, { to: "/instancia-suspensa", replace: true });
2967
- if (status === "revoked") return /* @__PURE__ */ jsx27(Navigate3, { to: "/instancia-revogada", replace: true });
2968
- if (status !== "active" && window.location.pathname !== "/ativacao") return /* @__PURE__ */ jsx27(Navigate3, { to: "/ativacao", replace: true });
3354
+ if (status === "suspended") return /* @__PURE__ */ jsx33(Navigate3, { to: "/instancia-suspensa", replace: true });
3355
+ if (status === "revoked") return /* @__PURE__ */ jsx33(Navigate3, { to: "/instancia-revogada", replace: true });
3356
+ if (status !== "active" && window.location.pathname !== "/ativacao") return /* @__PURE__ */ jsx33(Navigate3, { to: "/ativacao", replace: true });
2969
3357
  return children;
2970
3358
  }
2971
3359
 
2972
3360
  // src/app/createOonRouter.tsx
2973
- import { jsx as jsx28 } from "react/jsx-runtime";
3361
+ import { jsx as jsx34 } from "react/jsx-runtime";
2974
3362
  function createOonRouter({ app, menu, routes, security, layout, registry }) {
2975
3363
  const guardEnabled = security?.enableRouteGuard !== false;
2976
3364
  const publicRoutes = routes.filter((route) => route.public).map((route) => ({ path: route.path, element: route.element }));
2977
3365
  const privateSource = routes.filter((route) => !route.public);
2978
3366
  const privateRoutes = privateSource.map((route) => {
2979
- const element = guardEnabled ? /* @__PURE__ */ jsx28(RouteGuard, { permission: route.permissions, children: route.element }) : route.element;
3367
+ const element = guardEnabled ? /* @__PURE__ */ jsx34(RouteGuard, { permission: route.permissions, children: route.element }) : route.element;
2980
3368
  return route.path === "/" ? { index: true, element } : { path: route.path.replace(/^\//, ""), element };
2981
3369
  });
2982
3370
  const hasIndexRoute = privateSource.some((route) => route.path === "/");
@@ -2984,7 +3372,7 @@ function createOonRouter({ app, menu, routes, security, layout, registry }) {
2984
3372
  if (!hasIndexRoute && firstRoute) {
2985
3373
  privateRoutes.unshift({
2986
3374
  index: true,
2987
- element: /* @__PURE__ */ jsx28(Navigate4, { to: firstRoute.path, replace: true })
3375
+ element: /* @__PURE__ */ jsx34(Navigate4, { to: firstRoute.path, replace: true })
2988
3376
  });
2989
3377
  }
2990
3378
  const customPaths = new Set(publicRoutes.map((route) => route.path));
@@ -2992,19 +3380,19 @@ function createOonRouter({ app, menu, routes, security, layout, registry }) {
2992
3380
  if (!customPaths.has("/login")) {
2993
3381
  builtInPublicRoutes.push({
2994
3382
  path: "/login",
2995
- element: /* @__PURE__ */ jsx28(ActivationGuard, { children: /* @__PURE__ */ jsx28(LoginPage, { app }) })
3383
+ element: /* @__PURE__ */ jsx34(ActivationGuard, { children: /* @__PURE__ */ jsx34(LoginPage, { app }) })
2996
3384
  });
2997
3385
  }
2998
3386
  if (!customPaths.has("/ativacao")) {
2999
3387
  builtInPublicRoutes.push({
3000
3388
  path: "/ativacao",
3001
- element: /* @__PURE__ */ jsx28(ActivationPage, {})
3389
+ element: /* @__PURE__ */ jsx34(ActivationPage, {})
3002
3390
  });
3003
3391
  }
3004
3392
  if (!customPaths.has("/instancia-suspensa")) {
3005
3393
  builtInPublicRoutes.push({
3006
3394
  path: "/instancia-suspensa",
3007
- element: /* @__PURE__ */ jsx28(
3395
+ element: /* @__PURE__ */ jsx34(
3008
3396
  InstanceBlockedPage,
3009
3397
  {
3010
3398
  title: "Inst\xE2ncia suspensa",
@@ -3016,7 +3404,7 @@ function createOonRouter({ app, menu, routes, security, layout, registry }) {
3016
3404
  if (!customPaths.has("/instancia-revogada")) {
3017
3405
  builtInPublicRoutes.push({
3018
3406
  path: "/instancia-revogada",
3019
- element: /* @__PURE__ */ jsx28(
3407
+ element: /* @__PURE__ */ jsx34(
3020
3408
  InstanceBlockedPage,
3021
3409
  {
3022
3410
  title: "Inst\xE2ncia revogada",
@@ -3028,7 +3416,7 @@ function createOonRouter({ app, menu, routes, security, layout, registry }) {
3028
3416
  if (!customPaths.has("/acesso-negado")) {
3029
3417
  builtInPublicRoutes.push({
3030
3418
  path: "/acesso-negado",
3031
- element: /* @__PURE__ */ jsx28(AccessDeniedPage, { app })
3419
+ element: /* @__PURE__ */ jsx34(AccessDeniedPage, { app })
3032
3420
  });
3033
3421
  }
3034
3422
  const tree = [
@@ -3036,7 +3424,7 @@ function createOonRouter({ app, menu, routes, security, layout, registry }) {
3036
3424
  ...publicRoutes,
3037
3425
  {
3038
3426
  path: "/",
3039
- element: /* @__PURE__ */ jsx28(ActivationGuard, { children: /* @__PURE__ */ jsx28(AppAccessGuard, { children: /* @__PURE__ */ jsx28(AuthenticatedLayout, { app, menu, layout, registry }) }) }),
3427
+ element: /* @__PURE__ */ jsx34(ActivationGuard, { children: /* @__PURE__ */ jsx34(AppAccessGuard, { children: /* @__PURE__ */ jsx34(AuthenticatedLayout, { app, menu, layout, registry }) }) }),
3040
3428
  children: privateRoutes
3041
3429
  }
3042
3430
  ];
@@ -3044,13 +3432,13 @@ function createOonRouter({ app, menu, routes, security, layout, registry }) {
3044
3432
  }
3045
3433
 
3046
3434
  // src/app/OonApp.tsx
3047
- import { jsx as jsx29 } from "react/jsx-runtime";
3435
+ import { jsx as jsx35 } from "react/jsx-runtime";
3048
3436
  function localLoginUrl() {
3049
3437
  const current = `${window.location.pathname}${window.location.search}`;
3050
3438
  return `/login?redirect=${encodeURIComponent(current)}`;
3051
3439
  }
3052
3440
  function OonApp({ config }) {
3053
- const { http, storage, router } = useMemo4(() => {
3441
+ const { http, storage, router } = useMemo6(() => {
3054
3442
  const storage2 = createTokenStorage(config.app.id);
3055
3443
  const externalLoginUrl = config.auth?.loginUrl ?? config.api.meusAppsUrl;
3056
3444
  const http2 = createRestClient({
@@ -3079,11 +3467,11 @@ function OonApp({ config }) {
3079
3467
  });
3080
3468
  return { http: http2, storage: storage2, router: router2 };
3081
3469
  }, [config]);
3082
- return /* @__PURE__ */ jsx29(OonProviders, { config, http, storage, children: /* @__PURE__ */ jsx29(RouterProvider, { router }) });
3470
+ return /* @__PURE__ */ jsx35(OonProviders, { config, http, storage, children: /* @__PURE__ */ jsx35(RouterProvider, { router }) });
3083
3471
  }
3084
3472
 
3085
3473
  // src/start.tsx
3086
- import { jsx as jsx30 } from "react/jsx-runtime";
3474
+ import { jsx as jsx36 } from "react/jsx-runtime";
3087
3475
  function validateConfig(config) {
3088
3476
  if (!config?.app?.id) throw new Error("oonCoreFront.start: config.app.id \xE9 obrigat\xF3rio.");
3089
3477
  if (!config?.api?.baseUrl) throw new Error("oonCoreFront.start: config.api.baseUrl \xE9 obrigat\xF3rio.");
@@ -3117,7 +3505,7 @@ function start(config) {
3117
3505
  const el = document.getElementById(rootId);
3118
3506
  if (!el) throw new Error(`oonCoreFront.start: elemento #${rootId} n\xE3o encontrado no DOM.`);
3119
3507
  createRoot(el).render(
3120
- /* @__PURE__ */ jsx30(StrictMode, { children: /* @__PURE__ */ jsx30(OonApp, { config }) })
3508
+ /* @__PURE__ */ jsx36(StrictMode, { children: /* @__PURE__ */ jsx36(OonApp, { config }) })
3121
3509
  );
3122
3510
  }
3123
3511
  var oonCoreFront = { start };
@@ -3144,7 +3532,10 @@ function manifestToConfig(manifest, runtime) {
3144
3532
  mode: c.mode ?? "dynamic",
3145
3533
  path: c.path,
3146
3534
  label: c.label,
3147
- section: c.section
3535
+ section: c.section,
3536
+ list: c.list,
3537
+ relations: c.relations,
3538
+ detailModal: c.detailModal
3148
3539
  };
3149
3540
  views.push(view);
3150
3541
  }
@@ -3234,34 +3625,34 @@ function defineOonModule(mod) {
3234
3625
  }
3235
3626
 
3236
3627
  // src/components/CoreIntegration.tsx
3237
- import { Badge as Badge3, Box as Box16, Button as Button11, Flex as Flex11, Heading as Heading11, Stack as Stack8, Text as Text17 } from "@chakra-ui/react";
3238
- import { useMutation as useMutation3 } from "@tanstack/react-query";
3239
- import { jsx as jsx31, jsxs as jsxs17 } from "react/jsx-runtime";
3628
+ 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";
3629
+ import { useMutation as useMutation4 } from "@tanstack/react-query";
3630
+ import { jsx as jsx37, jsxs as jsxs23 } from "react/jsx-runtime";
3240
3631
  function CoreIntegration({ label = "Integra\xE7\xF5es" }) {
3241
3632
  const { http } = useOonApi();
3242
3633
  const metadata = useCoreMetadata();
3243
- const reprocess = useMutation3({
3634
+ const reprocess = useMutation4({
3244
3635
  mutationFn: () => http.post("/integrations/actions/process-active", {}, { headers: { "x-oon-origin": "integration" } })
3245
3636
  });
3246
- if (metadata.isLoading) return /* @__PURE__ */ jsx31(LoadingScreen, {});
3247
- if (metadata.isError) return /* @__PURE__ */ jsx31(ErrorState, { error: metadata.error });
3637
+ if (metadata.isLoading) return /* @__PURE__ */ jsx37(LoadingScreen, {});
3638
+ if (metadata.isError) return /* @__PURE__ */ jsx37(ErrorState, { error: metadata.error });
3248
3639
  const integrations = metadata.data?.integrations ?? [];
3249
- return /* @__PURE__ */ jsxs17(Stack8, { gap: 6, children: [
3250
- /* @__PURE__ */ jsxs17(Flex11, { align: "center", justify: "space-between", children: [
3251
- /* @__PURE__ */ jsx31(Heading11, { size: "lg", children: label }),
3252
- /* @__PURE__ */ jsx31(Button11, { size: "sm", variant: "outline", loading: reprocess.isPending, onClick: () => reprocess.mutate(), children: "Reprocessar ativos" })
3640
+ return /* @__PURE__ */ jsxs23(Stack9, { gap: 6, children: [
3641
+ /* @__PURE__ */ jsxs23(Flex14, { align: "center", justify: "space-between", children: [
3642
+ /* @__PURE__ */ jsx37(Heading12, { size: "lg", children: label }),
3643
+ /* @__PURE__ */ jsx37(Button15, { size: "sm", variant: "outline", loading: reprocess.isPending, onClick: () => reprocess.mutate(), children: "Reprocessar ativos" })
3253
3644
  ] }),
3254
- /* @__PURE__ */ jsx31(Stack8, { gap: 3, children: integrations.length === 0 ? /* @__PURE__ */ jsx31(Text17, { color: "gray.400", children: "Nenhuma integra\xE7\xE3o declarada." }) : integrations.map((it, idx) => /* @__PURE__ */ jsx31(
3255
- Box16,
3645
+ /* @__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(
3646
+ Box20,
3256
3647
  {
3257
3648
  borderWidth: "1px",
3258
3649
  borderColor: "gray.200",
3259
3650
  borderRadius: "md",
3260
3651
  bg: "white",
3261
3652
  p: 4,
3262
- children: /* @__PURE__ */ jsxs17(Flex11, { align: "center", justify: "space-between", children: [
3263
- /* @__PURE__ */ jsx31(Text17, { fontWeight: "medium", children: it.label ?? it.name ?? "Integra\xE7\xE3o" }),
3264
- /* @__PURE__ */ jsx31(Badge3, { colorPalette: it.status === "erro" ? "red" : it.status === "ativo" ? "green" : "gray", children: it.status ?? "\u2014" })
3653
+ children: /* @__PURE__ */ jsxs23(Flex14, { align: "center", justify: "space-between", children: [
3654
+ /* @__PURE__ */ jsx37(Text22, { fontWeight: "medium", children: it.label ?? it.name ?? "Integra\xE7\xE3o" }),
3655
+ /* @__PURE__ */ jsx37(Badge5, { colorPalette: it.status === "erro" ? "red" : it.status === "ativo" ? "green" : "gray", children: it.status ?? "\u2014" })
3265
3656
  ] })
3266
3657
  },
3267
3658
  it.id ?? it.name ?? idx
@@ -3270,36 +3661,36 @@ function CoreIntegration({ label = "Integra\xE7\xF5es" }) {
3270
3661
  }
3271
3662
 
3272
3663
  // src/components/CoreCurrency.tsx
3273
- import { Button as Button12, Flex as Flex12, Heading as Heading12, Stack as Stack9, Text as Text18 } from "@chakra-ui/react";
3274
- import { useMutation as useMutation4, useQueryClient as useQueryClient3 } from "@tanstack/react-query";
3275
- import { jsx as jsx32, jsxs as jsxs18 } from "react/jsx-runtime";
3664
+ import { Button as Button16, Flex as Flex15, Heading as Heading13, Stack as Stack10, Text as Text23 } from "@chakra-ui/react";
3665
+ import { useMutation as useMutation5, useQueryClient as useQueryClient5 } from "@tanstack/react-query";
3666
+ import { jsx as jsx38, jsxs as jsxs24 } from "react/jsx-runtime";
3276
3667
  function CoreCurrency({ model = "Moeda", label = "Multi-moedas", endpoint = "/moedas", columns }) {
3277
3668
  const { http } = useOonApi();
3278
- const queryClient = useQueryClient3();
3279
- const updateRates = useMutation4({
3669
+ const queryClient = useQueryClient5();
3670
+ const updateRates = useMutation5({
3280
3671
  mutationFn: () => http.post(`${endpoint}/actions/update-rates`, {}, { headers: { "x-oon-origin": "integration" } }),
3281
3672
  onSuccess: () => queryClient.invalidateQueries({ queryKey: ["oon", "list", endpoint] })
3282
3673
  });
3283
- return /* @__PURE__ */ jsxs18(Stack9, { gap: 6, children: [
3284
- /* @__PURE__ */ jsxs18(Flex12, { align: "center", justify: "space-between", children: [
3285
- /* @__PURE__ */ jsx32(Heading12, { size: "lg", children: label }),
3286
- /* @__PURE__ */ jsx32(Button12, { size: "sm", colorPalette: "blue", loading: updateRates.isPending, onClick: () => updateRates.mutate(), children: "Atualizar cota\xE7\xF5es" })
3674
+ return /* @__PURE__ */ jsxs24(Stack10, { gap: 6, children: [
3675
+ /* @__PURE__ */ jsxs24(Flex15, { align: "center", justify: "space-between", children: [
3676
+ /* @__PURE__ */ jsx38(Heading13, { size: "lg", children: label }),
3677
+ /* @__PURE__ */ jsx38(Button16, { size: "sm", colorPalette: "blue", loading: updateRates.isPending, onClick: () => updateRates.mutate(), children: "Atualizar cota\xE7\xF5es" })
3287
3678
  ] }),
3288
- updateRates.isError ? /* @__PURE__ */ jsx32(Text18, { fontSize: "sm", color: "red.600", children: updateRates.error?.message }) : null,
3289
- /* @__PURE__ */ jsx32(CoreCollection, { model, label: "", mode: columns ? "full" : "dynamic", endpoint, columns })
3679
+ updateRates.isError ? /* @__PURE__ */ jsx38(Text23, { fontSize: "sm", color: "red.600", children: updateRates.error?.message }) : null,
3680
+ /* @__PURE__ */ jsx38(CoreCollection, { model, label: "", mode: columns ? "full" : "dynamic", endpoint, columns })
3290
3681
  ] });
3291
3682
  }
3292
3683
 
3293
3684
  // src/components/CoreAssistant.tsx
3294
- import { useState as useState10 } from "react";
3295
- import { Box as Box17, Button as Button13, Flex as Flex13, Heading as Heading13, Input as Input6, Stack as Stack10, Text as Text19 } from "@chakra-ui/react";
3296
- import { useMutation as useMutation5 } from "@tanstack/react-query";
3297
- import { jsx as jsx33, jsxs as jsxs19 } from "react/jsx-runtime";
3685
+ import { useState as useState14 } from "react";
3686
+ import { Box as Box21, Button as Button17, Flex as Flex16, Heading as Heading14, Input as Input8, Stack as Stack11, Text as Text24 } from "@chakra-ui/react";
3687
+ import { useMutation as useMutation6 } from "@tanstack/react-query";
3688
+ import { jsx as jsx39, jsxs as jsxs25 } from "react/jsx-runtime";
3298
3689
  function CoreAssistant({ assistantCode, label = "Assistente", entity, endpoint = "/assistant-runs" }) {
3299
3690
  const { http } = useOonApi();
3300
- const [messages, setMessages] = useState10([]);
3301
- const [input, setInput] = useState10("");
3302
- const ask = useMutation5({
3691
+ const [messages, setMessages] = useState14([]);
3692
+ const [input, setInput] = useState14("");
3693
+ const ask = useMutation6({
3303
3694
  mutationFn: async (message) => {
3304
3695
  const { data } = await http.post(
3305
3696
  endpoint,
@@ -3323,11 +3714,11 @@ function CoreAssistant({ assistantCode, label = "Assistente", entity, endpoint =
3323
3714
  setInput("");
3324
3715
  ask.mutate(text);
3325
3716
  };
3326
- return /* @__PURE__ */ jsxs19(Stack10, { gap: 4, maxW: "560px", children: [
3327
- /* @__PURE__ */ jsx33(Heading13, { size: "md", children: label }),
3328
- /* @__PURE__ */ jsx33(Box17, { borderWidth: "1px", borderColor: "gray.200", borderRadius: "md", bg: "white", p: 4, minH: "240px", children: /* @__PURE__ */ jsxs19(Stack10, { gap: 3, children: [
3329
- messages.length === 0 ? /* @__PURE__ */ jsx33(Text19, { color: "gray.400", fontSize: "sm", children: "Fa\xE7a uma pergunta ao assistente." }) : messages.map((m, idx) => /* @__PURE__ */ jsx33(Flex13, { justify: m.role === "user" ? "flex-end" : "flex-start", children: /* @__PURE__ */ jsx33(
3330
- Box17,
3717
+ return /* @__PURE__ */ jsxs25(Stack11, { gap: 4, maxW: "560px", children: [
3718
+ /* @__PURE__ */ jsx39(Heading14, { size: "md", children: label }),
3719
+ /* @__PURE__ */ jsx39(Box21, { borderWidth: "1px", borderColor: "gray.200", borderRadius: "md", bg: "white", p: 4, minH: "240px", children: /* @__PURE__ */ jsxs25(Stack11, { gap: 3, children: [
3720
+ 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(
3721
+ Box21,
3331
3722
  {
3332
3723
  bg: m.role === "user" ? "brand.500" : "gray.100",
3333
3724
  color: m.role === "user" ? "white" : "gray.800",
@@ -3339,12 +3730,12 @@ function CoreAssistant({ assistantCode, label = "Assistente", entity, endpoint =
3339
3730
  children: m.content
3340
3731
  }
3341
3732
  ) }, idx)),
3342
- ask.isPending ? /* @__PURE__ */ jsx33(Text19, { color: "gray.400", fontSize: "sm", children: "Pensando\u2026" }) : null,
3343
- ask.isError ? /* @__PURE__ */ jsx33(Text19, { color: "red.600", fontSize: "sm", children: ask.error?.message }) : null
3733
+ ask.isPending ? /* @__PURE__ */ jsx39(Text24, { color: "gray.400", fontSize: "sm", children: "Pensando\u2026" }) : null,
3734
+ ask.isError ? /* @__PURE__ */ jsx39(Text24, { color: "red.600", fontSize: "sm", children: ask.error?.message }) : null
3344
3735
  ] }) }),
3345
- /* @__PURE__ */ jsxs19(Flex13, { gap: 2, children: [
3346
- /* @__PURE__ */ jsx33(
3347
- Input6,
3736
+ /* @__PURE__ */ jsxs25(Flex16, { gap: 2, children: [
3737
+ /* @__PURE__ */ jsx39(
3738
+ Input8,
3348
3739
  {
3349
3740
  size: "sm",
3350
3741
  value: input,
@@ -3355,7 +3746,7 @@ function CoreAssistant({ assistantCode, label = "Assistente", entity, endpoint =
3355
3746
  }
3356
3747
  }
3357
3748
  ),
3358
- /* @__PURE__ */ jsx33(Button13, { size: "sm", colorPalette: "blue", onClick: send, loading: ask.isPending, children: "Enviar" })
3749
+ /* @__PURE__ */ jsx39(Button17, { size: "sm", colorPalette: "blue", onClick: send, loading: ask.isPending, children: "Enviar" })
3359
3750
  ] })
3360
3751
  ] });
3361
3752
  }