diefra_ecm_ui 1.2.3 → 1.2.4

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.
Files changed (3) hide show
  1. package/dist/index.cjs +11 -11
  2. package/dist/index.js +482 -495
  3. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -1,37 +1,37 @@
1
- import { jsx as e, jsxs as y, Fragment as de } from "react/jsx-runtime";
2
- import { useCallback as U, useEffect as P, memo as q, useState as Y, useMemo as J, useRef as ee, forwardRef as oe, createElement as te } from "react";
3
- import { useFormContext as W, useController as Z, useFormState as ae } from "react-hook-form";
1
+ import { jsx as e, jsxs as g, Fragment as de } from "react/jsx-runtime";
2
+ import { useCallback as U, useEffect as W, memo as G, useState as Y, useMemo as J, useRef as ee, forwardRef as oe, createElement as se } from "react";
3
+ import { useFormContext as z, useController as X, useFormState as ae } from "react-hook-form";
4
4
  import { IMaskInput as pe } from "react-imask";
5
- import { useSection as G, useFluigRuntime as z } from "@fluig-kit/ecm";
6
- import { isValid as ue, eachDayOfInterval as ve, endOfWeek as ye, endOfMonth as ge, startOfWeek as be, startOfMonth as Ne, getYear as ke, subMonths as we, setMonth as $e, setYear as Oe, addMonths as _e, isSameMonth as Re, isSameDay as Se, format as fe, isToday as Ae, parse as xe } from "date-fns";
7
- function Ie({ title: t, isOpen: n, onOpen: f, onClose: o, content: c, footer: a, width: m }) {
5
+ import { useSection as Q, useFluigRuntime as q } from "@fluig-kit/ecm";
6
+ import { isValid as ue, eachDayOfInterval as ve, endOfWeek as ye, endOfMonth as ge, startOfWeek as be, startOfMonth as Ne, getYear as ke, subMonths as we, setMonth as Se, setYear as $e, addMonths as _e, isSameMonth as Oe, isSameDay as Re, format as fe, isToday as Ae, parse as xe } from "date-fns";
7
+ function Ie({ title: t, isOpen: n, onOpen: f, onClose: a, content: c, footer: o, width: h }) {
8
8
  const d = U(
9
- (p) => {
10
- p.key === "Escape" && o();
9
+ (v) => {
10
+ v.key === "Escape" && a();
11
11
  },
12
- [o]
12
+ [a]
13
13
  );
14
- return P(() => (n && (document.addEventListener("keydown", d), f == null || f(), document.body.style.overflow = "hidden"), () => {
14
+ return W(() => (n && (document.addEventListener("keydown", d), f == null || f(), document.body.style.overflow = "hidden"), () => {
15
15
  document.removeEventListener("keydown", d), document.body.style.overflow = "auto";
16
- }), [n, d, f]), n ? /* @__PURE__ */ e("div", { className: "modal-overlay", onClick: o, "aria-modal": "true", role: "dialog", children: /* @__PURE__ */ y("div", { style: { maxWidth: m }, className: "modal-container", onClick: (p) => p.stopPropagation(), children: [
17
- /* @__PURE__ */ y("div", { className: "modal-header", children: [
16
+ }), [n, d, f]), n ? /* @__PURE__ */ e("div", { className: "modal-overlay", onClick: a, "aria-modal": "true", role: "dialog", children: /* @__PURE__ */ g("div", { style: { maxWidth: h }, className: "modal-container", onClick: (v) => v.stopPropagation(), children: [
17
+ /* @__PURE__ */ g("div", { className: "modal-header", children: [
18
18
  /* @__PURE__ */ e("h3", { children: t }),
19
- /* @__PURE__ */ e("div", { className: "btn-close-modal", onClick: o, role: "button", "aria-label": "Fechar modal", children: /* @__PURE__ */ e("i", { className: "flaticon flaticon-close icon-sm", "aria-hidden": "true" }) })
19
+ /* @__PURE__ */ e("div", { className: "btn-close-modal", onClick: a, role: "button", "aria-label": "Fechar modal", children: /* @__PURE__ */ e("i", { className: "flaticon flaticon-close icon-sm", "aria-hidden": "true" }) })
20
20
  ] }),
21
21
  /* @__PURE__ */ e("div", { className: "modal-content", children: c }),
22
- a && /* @__PURE__ */ e("div", { className: "modal-footer", children: a })
22
+ o && /* @__PURE__ */ e("div", { className: "modal-footer", children: o })
23
23
  ] }) }) : null;
24
24
  }
25
- function Ve({ text: t, title: n = "Ajuda & Informações", width: f = "500px", className: o = "" }) {
26
- const [c, a] = Y(!1), m = (d) => {
27
- d.preventDefault(), d.stopPropagation(), a(!0);
25
+ function Ve({ text: t, title: n = "Ajuda & Informações", width: f = "500px", className: a = "" }) {
26
+ const [c, o] = Y(!1), h = (d) => {
27
+ d.preventDefault(), d.stopPropagation(), o(!0);
28
28
  };
29
- return /* @__PURE__ */ y(de, { children: [
29
+ return /* @__PURE__ */ g(de, { children: [
30
30
  /* @__PURE__ */ e(
31
31
  "div",
32
32
  {
33
- className: `dfe-help-indicator ${o}`,
34
- onClick: m,
33
+ className: `dfe-help-indicator ${a}`,
34
+ onClick: h,
35
35
  role: "button",
36
36
  tabIndex: 0,
37
37
  "aria-label": "Botão de ajuda",
@@ -44,15 +44,15 @@ function Ve({ text: t, title: n = "Ajuda & Informações", width: f = "500px", c
44
44
  {
45
45
  title: n,
46
46
  isOpen: c,
47
- onClose: () => a(!1),
47
+ onClose: () => o(!1),
48
48
  width: f,
49
49
  content: /* @__PURE__ */ e("div", { className: "dfe-help-modal-body", children: t }),
50
- footer: /* @__PURE__ */ e("div", { className: "dfe-help-modal-footer", children: /* @__PURE__ */ e("button", { type: "button", className: "btn btn-info dfe-help-btn", onClick: () => a(!1), children: "Entendido" }) })
50
+ footer: /* @__PURE__ */ e("div", { className: "dfe-help-modal-footer", children: /* @__PURE__ */ e("button", { type: "button", className: "btn btn-info dfe-help-btn", onClick: () => o(!1), children: "Entendido" }) })
51
51
  }
52
52
  )
53
53
  ] });
54
54
  }
55
- const M = q(Ve), De = {
55
+ const M = G(Ve), De = {
56
56
  cpf: "000.000.000-00",
57
57
  cnpj: "00.000.000/0000-00",
58
58
  telefone: "(00) 00000-0000",
@@ -62,445 +62,432 @@ function Ee({
62
62
  name: t,
63
63
  label: n = "",
64
64
  placeholder: f = "",
65
- type: o = "text",
65
+ type: a = "text",
66
66
  mask: c,
67
- className: a = "",
68
- forceReadOnly: m = !1,
67
+ className: o = "",
68
+ forceReadOnly: h = !1,
69
69
  forceHidden: d = !1,
70
- prefix: p,
70
+ prefix: v,
71
71
  suffix: s,
72
- helpText: v,
73
- helpTitle: x,
74
- helpWidth: I,
75
- valueManual: F,
76
- onChangeManual: b,
77
- errorManual: _
72
+ helpText: p,
73
+ helpTitle: A,
74
+ helpWidth: x,
75
+ valueManual: T,
76
+ onChangeManual: y,
77
+ errorManual: O
78
78
  }) {
79
- var K, Q;
80
- const R = F !== void 0 && !!b, { isReadOnly: S, isHidden: N } = G(), r = m || !!S(t), i = d || !!N(t), { isView: l } = z();
79
+ var Z, K;
80
+ const _ = T !== void 0 && !!y, { isReadOnly: R, isHidden: k } = Q(), r = h || !!R(t), i = d || !!k(t), { isView: l } = q();
81
81
  let u = null;
82
82
  try {
83
- u = W();
83
+ u = z();
84
84
  } catch {
85
85
  }
86
- const h = !R && u ? Z({ name: t, control: u.control }) : null, E = !R && u ? ae({ name: t }) : null, H = R ? F : h == null ? void 0 : h.field.value, V = R ? _ : (Q = (K = E == null ? void 0 : E.errors) == null ? void 0 : K[t]) == null ? void 0 : Q.message, O = J(() => c ? De[c] ?? c : null, [c]), $ = U(
87
- (C) => {
88
- if (!C) return "";
89
- let w = C;
90
- if (s)
91
- if (w.endsWith(s))
92
- w = w.slice(0, -s.length);
93
- else {
94
- const L = w.lastIndexOf(s);
95
- L !== -1 && (w = w.substring(0, L) + w.substring(L + s.length));
96
- }
97
- if (p)
98
- if (w.startsWith(p))
99
- w = w.slice(p.length);
100
- else {
101
- const L = w.indexOf(p);
102
- L !== -1 && (w = w.substring(0, L) + w.substring(L + p.length));
103
- }
104
- if (o === "monetary") {
105
- const L = w.replace(/\D/g, "");
106
- return L ? (Number(L) / 100).toFixed(2) : "";
107
- }
108
- return o === "number" && (w = w.replace(/[^\d.,-]/g, ""), w = w.replace(/\./g, "").replace(",", ".")), w;
109
- },
110
- [p, s, o]
111
- ), k = U(
112
- (C) => {
113
- if (C === "" || C === null || C === void 0) return "";
114
- let w = String(C);
115
- if (o === "monetary") {
116
- const L = Number(C);
117
- return isNaN(L) ? "" : L.toLocaleString("pt-BR", { style: "currency", currency: "BRL" });
86
+ const m = !_ && u ? X({ name: t, control: u.control }) : null, B = !_ && u ? ae({ name: t }) : null, V = _ ? T : m == null ? void 0 : m.field.value, D = _ ? O : (K = (Z = B == null ? void 0 : B.errors) == null ? void 0 : Z[t]) == null ? void 0 : K.message, $ = J(() => c ? De[c] ?? c : null, [c]), S = U(
87
+ (j) => {
88
+ if (j === "" || j === null || j === void 0) return "";
89
+ let I = String(j);
90
+ if (a === "monetary") {
91
+ const F = Number(j);
92
+ return isNaN(F) ? "" : F.toLocaleString("pt-BR", { style: "currency", currency: "BRL" });
118
93
  }
119
- if (o === "number") {
120
- w = w.replace(".", ",");
121
- const L = w.split(",");
122
- L[0] = L[0].replace(/\B(?=(\d{3})+(?!\d))/g, "."), w = L.join(",");
94
+ if (a === "number") {
95
+ I = I.replace(".", ",");
96
+ const F = I.split(",");
97
+ F[0] = F[0].replace(/\B(?=(\d{3})+(?!\d))/g, "."), I = F.join(",");
123
98
  }
124
- return p && (w = `${p}${w}`), s && (w = `${w}${s}`), w;
99
+ return v && (I = `${v}${I}`), s && (I = `${I}${s}`), I;
125
100
  },
126
- [p, s, o]
127
- ), B = (C) => {
128
- const w = `${p || ""}${s || ""}`;
129
- if (!C || C === p || C === s || C === w) {
130
- R ? b == null || b("") : h == null || h.field.onChange("");
101
+ [v, s, a]
102
+ ), N = J(() => S(V), [V, S]), H = (j) => {
103
+ let I = j.target.value;
104
+ const F = N, te = `${v || ""}${s || ""}`;
105
+ if (!I || I === v || I === s || I === te) {
106
+ _ ? y == null || y("") : m == null || m.field.onChange("");
131
107
  return;
132
108
  }
133
- const L = $(C);
134
- R ? b == null || b(L) : h == null || h.field.onChange(L);
135
- }, g = () => {
136
- R || h == null || h.field.onBlur();
137
- }, D = J(() => k(H), [H, k]);
109
+ if (s && I.length > F.length && F && I.startsWith(F)) {
110
+ const w = I.slice(F.length);
111
+ I = String(V || "") + w;
112
+ }
113
+ v && I.length > F.length && F && I.endsWith(F) && (I = I.slice(0, I.length - F.length) + String(V || ""));
114
+ let L = I;
115
+ if (s && L.endsWith(s) && (L = L.slice(0, -s.length)), v && L.startsWith(v) && (L = L.slice(v.length)), a === "monetary") {
116
+ const w = L.replace(/\D/g, "");
117
+ L = w ? (Number(w) / 100).toFixed(2) : "";
118
+ } else a === "number" && (L = L.replace(/[^\d.,-]/g, ""), L = L.replace(/\./g, "").replace(",", "."));
119
+ I.length < F.length && L === String(V || "") && L.length > 0 && (L = L.slice(0, -1)), _ ? y == null || y(L) : m == null || m.field.onChange(L);
120
+ }, b = () => {
121
+ _ || m == null || m.field.onBlur();
122
+ };
138
123
  if (i) return null;
139
- const j = `form-control ${r ? "readOnly" : ""} ${V ? "border-red" : ""} ${a}`, X = () => O ? /* @__PURE__ */ e(
124
+ const E = `form-control ${r ? "readOnly" : ""} ${D ? "border-red" : ""} ${o}`, P = () => $ ? /* @__PURE__ */ e(
140
125
  pe,
141
126
  {
142
- mask: O,
143
- value: D,
127
+ mask: $,
128
+ value: N,
144
129
  unmask: !0,
145
- onAccept: (C) => B(C),
130
+ onAccept: (j) => {
131
+ _ ? y == null || y(j) : m == null || m.field.onChange(j);
132
+ },
146
133
  placeholder: f,
147
134
  readOnly: r,
148
- className: j,
149
- inputRef: R || h == null ? void 0 : h.field.ref,
150
- onBlur: g
135
+ className: E,
136
+ inputRef: _ || m == null ? void 0 : m.field.ref,
137
+ onBlur: b
151
138
  }
152
139
  ) : /* @__PURE__ */ e(
153
140
  "input",
154
141
  {
155
142
  type: "text",
156
- inputMode: o === "number" || o === "monetary" ? "numeric" : void 0,
157
- value: D,
158
- onChange: (C) => B(C.target.value),
159
- onBlur: g,
143
+ inputMode: a === "number" || a === "monetary" ? "numeric" : void 0,
144
+ value: N,
145
+ onChange: H,
146
+ onBlur: b,
160
147
  placeholder: f,
161
148
  readOnly: r,
162
- className: j
149
+ className: E
163
150
  }
164
151
  );
165
- return l ? /* @__PURE__ */ y("div", { className: "form-group", children: [
152
+ return l ? /* @__PURE__ */ g("div", { className: "form-group", children: [
166
153
  n && /* @__PURE__ */ e("label", { children: n }),
167
- /* @__PURE__ */ y("div", { className: v ? "dfe-flex-input-wrapper" : "", children: [
168
- /* @__PURE__ */ e("span", { className: j, children: D || "-" }),
169
- v && /* @__PURE__ */ e(M, { text: v, title: x, width: I })
154
+ /* @__PURE__ */ g("div", { className: p ? "dfe-flex-input-wrapper" : "", children: [
155
+ /* @__PURE__ */ e("span", { className: E, children: N || "-" }),
156
+ p && /* @__PURE__ */ e(M, { text: p, title: A, width: x })
170
157
  ] })
171
- ] }) : /* @__PURE__ */ y("div", { className: `form-group ${i ? "hidden" : ""}`, children: [
158
+ ] }) : /* @__PURE__ */ g("div", { className: `form-group ${i ? "hidden" : ""}`, children: [
172
159
  n && /* @__PURE__ */ e("label", { children: n }),
173
- /* @__PURE__ */ y("div", { className: v ? "dfe-flex-input-wrapper" : "", children: [
174
- X(),
175
- v && /* @__PURE__ */ e(M, { text: v, title: x, width: I })
160
+ /* @__PURE__ */ g("div", { className: p ? "dfe-flex-input-wrapper" : "", children: [
161
+ P(),
162
+ p && /* @__PURE__ */ e(M, { text: p, title: A, width: x })
176
163
  ] }),
177
- !R && /* @__PURE__ */ e("input", { type: "hidden", name: t, value: H || "" }),
178
- V && /* @__PURE__ */ e("p", { className: "text-danger", children: String(V) })
164
+ !_ && /* @__PURE__ */ e("input", { type: "hidden", name: t, value: V || "" }),
165
+ D && /* @__PURE__ */ e("p", { className: "text-danger", children: String(D) })
179
166
  ] });
180
167
  }
181
- const ot = q(Ee);
168
+ const ot = G(Ee);
182
169
  function Be({
183
170
  name: t,
184
171
  label: n = "",
185
172
  options: f = [],
186
- placeholder: o = "",
173
+ placeholder: a = "",
187
174
  labelKey: c = "label",
188
- valueKey: a = "value",
189
- enableSearch: m = !1,
175
+ valueKey: o = "value",
176
+ enableSearch: h = !1,
190
177
  searchPlaceholder: d = "Buscar...",
191
- loading: p = !1,
178
+ loading: v = !1,
192
179
  onSearchChange: s,
193
- debounceTime: v = 300,
194
- onSelect: x,
195
- forceReadOnly: I = !1,
196
- forceHidden: F = !1,
197
- helpText: b,
198
- helpTitle: _,
199
- helpWidth: R,
200
- valueManual: S,
201
- onChangeManual: N,
180
+ debounceTime: p = 300,
181
+ onSelect: A,
182
+ forceReadOnly: x = !1,
183
+ forceHidden: T = !1,
184
+ helpText: y,
185
+ helpTitle: O,
186
+ helpWidth: _,
187
+ valueManual: R,
188
+ onChangeManual: k,
202
189
  errorManual: r
203
190
  }) {
204
- var re;
205
- const i = S !== void 0 && !!N, { isReadOnly: l, isHidden: u } = G(), h = I || !!l(t), E = F || !!u(t), { isView: H } = z();
206
- let V = "", O = () => {
207
- }, $, k = null, B = () => {
191
+ var L;
192
+ const i = R !== void 0 && !!k, { isReadOnly: l, isHidden: u } = Q(), m = x || !!l(t), B = T || !!u(t), { isView: V } = q();
193
+ let D = "", $ = () => {
194
+ }, S, N = null, H = () => {
208
195
  };
209
196
  if (i)
210
- V = S;
197
+ D = R;
211
198
  else
212
199
  try {
213
- const A = W(), T = Z({ name: t, control: A.control });
214
- V = T.field.value, O = T.field.onChange, $ = T.field.ref, k = (re = T.fieldState) == null ? void 0 : re.error, B = A.clearErrors;
200
+ const w = z(), C = X({ name: t, control: w.control });
201
+ D = C.field.value, $ = C.field.onChange, S = C.field.ref, N = (L = C.fieldState) == null ? void 0 : L.error, H = w.clearErrors;
215
202
  } catch {
216
203
  }
217
- const [g, D] = Y(!1), [j, X] = Y(""), K = ee(null), Q = ee(s);
218
- P(() => {
219
- Q.current = s;
220
- }, [s]), P(() => {
221
- const A = (T) => {
222
- K.current && !K.current.contains(T.target) && D(!1);
204
+ const [b, E] = Y(!1), [P, Z] = Y(""), K = ee(null), j = ee(s);
205
+ W(() => {
206
+ j.current = s;
207
+ }, [s]), W(() => {
208
+ const w = (C) => {
209
+ K.current && !K.current.contains(C.target) && E(!1);
223
210
  };
224
- return document.addEventListener("mousedown", A), () => document.removeEventListener("mousedown", A);
225
- }, []), P(() => {
226
- g || X("");
227
- }, [g]), P(() => {
228
- if (!m) return;
229
- const A = setTimeout(() => {
230
- var T;
231
- (T = Q.current) == null || T.call(Q, j);
232
- }, v);
233
- return () => clearTimeout(A);
234
- }, [j, m, v]);
235
- const C = J(() => m && !s && j.trim() ? f.filter(
236
- (A) => String((A == null ? void 0 : A[c]) ?? "").toLowerCase().includes(j.toLowerCase())
237
- ) : f ?? [], [f, m, s, j, c]), w = J(() => {
238
- if (V == null) return "";
239
- if (typeof V == "object")
240
- return String(V[a] ?? "");
241
- const A = (f || []).find((T) => String(T == null ? void 0 : T[a]) === String(V));
242
- return String(A ? (A == null ? void 0 : A[c]) ?? "" : V);
243
- }, [V, f, a, c]), L = (A) => {
244
- h || (i ? N == null || N(A[a]) : (O(A[a]), B == null || B(t)), x == null || x(A), D(!1));
211
+ return document.addEventListener("mousedown", w), () => document.removeEventListener("mousedown", w);
212
+ }, []), W(() => {
213
+ b || Z("");
214
+ }, [b]), W(() => {
215
+ if (!h) return;
216
+ const w = setTimeout(() => {
217
+ var C;
218
+ (C = j.current) == null || C.call(j, P);
219
+ }, p);
220
+ return () => clearTimeout(w);
221
+ }, [P, h, p]);
222
+ const I = J(() => h && !s && P.trim() ? f.filter(
223
+ (w) => String((w == null ? void 0 : w[c]) ?? "").toLowerCase().includes(P.toLowerCase())
224
+ ) : f ?? [], [f, h, s, P, c]), F = J(() => {
225
+ if (D == null) return "";
226
+ if (typeof D == "object")
227
+ return String(D[o] ?? "");
228
+ const w = (f || []).find((C) => String(C == null ? void 0 : C[o]) === String(D));
229
+ return String(w ? (w == null ? void 0 : w[c]) ?? "" : D);
230
+ }, [D, f, o, c]), te = (w) => {
231
+ m || (i ? k == null || k(w[o]) : ($(w[o]), H == null || H(t)), A == null || A(w), E(!1));
245
232
  };
246
- return E ? null : /* @__PURE__ */ y("div", { className: `select-wrapper form-group ${E ? "hidden" : ""}`, ref: K, children: [
233
+ return B ? null : /* @__PURE__ */ g("div", { className: `select-wrapper form-group ${B ? "hidden" : ""}`, ref: K, children: [
247
234
  /* @__PURE__ */ e("label", { className: "control-label", children: n }),
248
- H ? /* @__PURE__ */ y("div", { className: b ? "dfe-flex-input-wrapper" : "", children: [
249
- /* @__PURE__ */ e("span", { className: "form-control", style: b ? { flex: 1 } : void 0, children: w || "-" }),
250
- b && /* @__PURE__ */ e(M, { text: b, title: _, width: R })
251
- ] }) : /* @__PURE__ */ y(de, { children: [
252
- /* @__PURE__ */ y("div", { className: b ? "dfe-flex-input-wrapper" : "", children: [
253
- /* @__PURE__ */ y(
235
+ V ? /* @__PURE__ */ g("div", { className: y ? "dfe-flex-input-wrapper" : "", children: [
236
+ /* @__PURE__ */ e("span", { className: "form-control", style: y ? { flex: 1 } : void 0, children: F || "-" }),
237
+ y && /* @__PURE__ */ e(M, { text: y, title: O, width: _ })
238
+ ] }) : /* @__PURE__ */ g(de, { children: [
239
+ /* @__PURE__ */ g("div", { className: y ? "dfe-flex-input-wrapper" : "", children: [
240
+ /* @__PURE__ */ g(
254
241
  "div",
255
242
  {
256
- className: `select-control ${k ? "border-red" : ""} ${h ? "readOnly" : ""}`,
257
- onClick: () => !h && D((A) => !A),
258
- ref: $,
259
- style: b ? { flex: 1 } : void 0,
243
+ className: `select-control ${N ? "border-red" : ""} ${m ? "readOnly" : ""}`,
244
+ onClick: () => !m && E((w) => !w),
245
+ ref: S,
246
+ style: y ? { flex: 1 } : void 0,
260
247
  children: [
261
- /* @__PURE__ */ e("span", { className: `select-display ${h ? "readOnly" : ""}`, children: w || o }),
248
+ /* @__PURE__ */ e("span", { className: `select-display ${m ? "readOnly" : ""}`, children: F || a }),
262
249
  /* @__PURE__ */ e("i", { className: "flaticon flaticon-chevron-down select-icon" })
263
250
  ]
264
251
  }
265
252
  ),
266
- b && /* @__PURE__ */ e(M, { text: b, title: _, width: R })
253
+ y && /* @__PURE__ */ e(M, { text: y, title: O, width: _ })
267
254
  ] }),
268
- g && !h && /* @__PURE__ */ y("div", { className: "select-dropdown", children: [
269
- m && /* @__PURE__ */ e("div", { className: "select-search", children: /* @__PURE__ */ e(
255
+ b && !m && /* @__PURE__ */ g("div", { className: "select-dropdown", children: [
256
+ h && /* @__PURE__ */ e("div", { className: "select-search", children: /* @__PURE__ */ e(
270
257
  "input",
271
258
  {
272
259
  type: "text",
273
260
  className: "select-search-input",
274
- value: j,
275
- onChange: (A) => X(A.target.value),
276
- placeholder: p ? "Carregando..." : d,
261
+ value: P,
262
+ onChange: (w) => Z(w.target.value),
263
+ placeholder: v ? "Carregando..." : d,
277
264
  autoFocus: !0,
278
- onClick: (A) => A.stopPropagation()
265
+ onClick: (w) => w.stopPropagation()
279
266
  }
280
267
  ) }),
281
- /* @__PURE__ */ e("ul", { className: "select-options", children: p ? /* @__PURE__ */ e("li", { className: "select-option readOnly", children: "Carregando..." }) : C.length > 0 ? C.map((A) => /* @__PURE__ */ e("li", { onClick: () => L(A), className: "select-option handleHover", children: A[c] }, A[a])) : /* @__PURE__ */ e("li", { className: "select-option readOnly", children: "Sem resultados" }) })
268
+ /* @__PURE__ */ e("ul", { className: "select-options", children: v ? /* @__PURE__ */ e("li", { className: "select-option readOnly", children: "Carregando..." }) : I.length > 0 ? I.map((w) => /* @__PURE__ */ e("li", { onClick: () => te(w), className: "select-option handleHover", children: w[c] }, w[o])) : /* @__PURE__ */ e("li", { className: "select-option readOnly", children: "Sem resultados" }) })
282
269
  ] })
283
270
  ] }),
284
- !i && /* @__PURE__ */ e("input", { type: "hidden", name: t, value: V || "" }),
285
- (k || r) && /* @__PURE__ */ e("p", { className: "text-danger", children: String((k == null ? void 0 : k.message) ?? r) })
271
+ !i && /* @__PURE__ */ e("input", { type: "hidden", name: t, value: D || "" }),
272
+ (N || r) && /* @__PURE__ */ e("p", { className: "text-danger", children: String((N == null ? void 0 : N.message) ?? r) })
286
273
  ] });
287
274
  }
288
- const ne = q(Be);
275
+ const ne = G(Be);
289
276
  function at({
290
277
  name: t,
291
278
  options: n = [],
292
279
  label: f = "",
293
- valueKey: o = "value",
280
+ valueKey: a = "value",
294
281
  labelKey: c = "label",
295
- forceReadOnly: a = !1,
296
- forceHidden: m = !1,
282
+ forceReadOnly: o = !1,
283
+ forceHidden: h = !1,
297
284
  valueManual: d,
298
- onChangeManual: p
285
+ onChangeManual: v
299
286
  }) {
300
- var H, V;
287
+ var V, D;
301
288
  let s = null;
302
289
  try {
303
- s = W();
290
+ s = z();
304
291
  } catch {
305
292
  }
306
- const v = d !== void 0 && !!p, { isView: x, isReadOnly: I } = z(), { isReadOnly: F, isHidden: b } = G(), _ = F ? F(t) : !1, R = b ? b(t) : !1, S = a || _, N = m || R, r = S || I || x, i = () => n ? n.reduce(
307
- (O, $) => {
308
- const k = String($[o]);
309
- if (v)
310
- O[k] = !!(d != null && d[k]);
293
+ const p = d !== void 0 && !!v, { isView: A, isReadOnly: x } = q(), { isReadOnly: T, isHidden: y } = Q(), O = T ? T(t) : !1, _ = y ? y(t) : !1, R = o || O, k = h || _, r = R || x || A, i = () => n ? n.reduce(
294
+ ($, S) => {
295
+ const N = String(S[a]);
296
+ if (p)
297
+ $[N] = !!(d != null && d[N]);
311
298
  else if (s) {
312
- const B = s.getValues(k);
313
- O[k] = B === "on";
299
+ const H = s.getValues(N);
300
+ $[N] = H === "on";
314
301
  } else
315
- O[k] = !1;
316
- return O;
302
+ $[N] = !1;
303
+ return $;
317
304
  },
318
305
  {}
319
- ) : {}, l = !v && s ? s.watch(t) : void 0, u = J(() => v && d ? d : l && typeof l == "object" ? l : i(), [l, d, n]);
320
- P(() => {
321
- if (v || !s) return;
322
- const O = s.getValues(t);
323
- (!O || typeof O != "object") && s.setValue(t, u, {
306
+ ) : {}, l = !p && s ? s.watch(t) : void 0, u = J(() => p && d ? d : l && typeof l == "object" ? l : i(), [l, d, n]);
307
+ W(() => {
308
+ if (p || !s) return;
309
+ const $ = s.getValues(t);
310
+ (!$ || typeof $ != "object") && s.setValue(t, u, {
324
311
  shouldDirty: !1,
325
312
  shouldValidate: !1
326
313
  });
327
- }, [u, t, s, v]);
328
- const h = (O, $) => {
314
+ }, [u, t, s, p]);
315
+ const m = ($, S) => {
329
316
  if (r) return;
330
- const k = { ...u, [O]: $ };
331
- if (v) {
332
- p && p(k);
317
+ const N = { ...u, [$]: S };
318
+ if (p) {
319
+ v && v(N);
333
320
  return;
334
321
  }
335
- s && (s.setValue(t, k, {
322
+ s && (s.setValue(t, N, {
336
323
  shouldDirty: !0,
337
324
  shouldValidate: !0
338
- }), s.setValue(O, $ ? "on" : "", { shouldValidate: !1 }));
339
- }, E = v ? null : (V = (H = s == null ? void 0 : s.formState) == null ? void 0 : H.errors) == null ? void 0 : V[t];
340
- return /* @__PURE__ */ y("div", { className: `form-group ${N ? "hidden" : ""}`, children: [
325
+ }), s.setValue($, S ? "on" : "", { shouldValidate: !1 }));
326
+ }, B = p ? null : (D = (V = s == null ? void 0 : s.formState) == null ? void 0 : V.errors) == null ? void 0 : D[t];
327
+ return /* @__PURE__ */ g("div", { className: `form-group ${k ? "hidden" : ""}`, children: [
341
328
  f && /* @__PURE__ */ e("label", { children: f }),
342
329
  /* @__PURE__ */ e(
343
330
  "div",
344
331
  {
345
332
  className: `checkbox-group-custom ${r ? "readOnly" : ""}`,
346
- children: n.map((O) => {
347
- const $ = String(O[o]), k = u[$] === !0;
348
- return /* @__PURE__ */ y("div", { children: [
349
- !v && s && /* @__PURE__ */ e("input", { type: "hidden", ...s.register($) }),
350
- /* @__PURE__ */ y(
333
+ children: n.map(($) => {
334
+ const S = String($[a]), N = u[S] === !0;
335
+ return /* @__PURE__ */ g("div", { children: [
336
+ !p && s && /* @__PURE__ */ e("input", { type: "hidden", ...s.register(S) }),
337
+ /* @__PURE__ */ g(
351
338
  "label",
352
339
  {
353
- className: `custom-checkbox ${k ? "checked" : ""} ${r ? "readOnly" : ""}`,
340
+ className: `custom-checkbox ${N ? "checked" : ""} ${r ? "readOnly" : ""}`,
354
341
  children: [
355
342
  /* @__PURE__ */ e(
356
343
  "input",
357
344
  {
358
345
  type: "checkbox",
359
- checked: k,
346
+ checked: N,
360
347
  disabled: r,
361
- onChange: (B) => h($, B.target.checked)
348
+ onChange: (H) => m(S, H.target.checked)
362
349
  }
363
350
  ),
364
351
  /* @__PURE__ */ e("span", { className: "checkmark" }),
365
- /* @__PURE__ */ e("span", { children: O[c] })
352
+ /* @__PURE__ */ e("span", { children: $[c] })
366
353
  ]
367
354
  }
368
355
  )
369
- ] }, $);
356
+ ] }, S);
370
357
  })
371
358
  }
372
359
  ),
373
- E && /* @__PURE__ */ e("p", { className: "text-danger", children: String(E.message) })
360
+ B && /* @__PURE__ */ e("p", { className: "text-danger", children: String(B.message) })
374
361
  ] });
375
362
  }
376
363
  function He({
377
364
  name: t,
378
365
  label: n = "",
379
366
  options: f = [],
380
- valueKey: o = "value",
367
+ valueKey: a = "value",
381
368
  labelKey: c = "label",
382
- iconKey: a = "icon",
383
- forceReadOnly: m = !1,
369
+ iconKey: o = "icon",
370
+ forceReadOnly: h = !1,
384
371
  forceHidden: d = !1,
385
- valueManual: p,
372
+ valueManual: v,
386
373
  onChangeManual: s,
387
- errorManual: v
374
+ errorManual: p
388
375
  }) {
389
- var H, V;
390
- const x = p !== void 0 && !!s, { isReadOnly: I, isHidden: F } = G(), b = m || !!I(t), _ = d || !!F(t), { isView: R, isReadOnly: S } = z();
391
- let N = null;
376
+ var V, D;
377
+ const A = v !== void 0 && !!s, { isReadOnly: x, isHidden: T } = Q(), y = h || !!x(t), O = d || !!T(t), { isView: _, isReadOnly: R } = q();
378
+ let k = null;
392
379
  try {
393
- N = W();
380
+ k = z();
394
381
  } catch {
395
382
  }
396
- const r = !x && N ? Z({ name: t, control: N.control, defaultValue: "" }) : null, i = !x && N ? ae({ name: t }) : null, l = x ? v : (V = (H = i == null ? void 0 : i.errors) == null ? void 0 : H[t]) == null ? void 0 : V.message, u = b || S || R, h = x ? p : (r == null ? void 0 : r.field.value) ?? "", E = U(
397
- (O) => {
398
- u || (x ? s == null || s(O) : (r == null || r.field.onChange(O), r == null || r.field.onBlur()));
383
+ const r = !A && k ? X({ name: t, control: k.control, defaultValue: "" }) : null, i = !A && k ? ae({ name: t }) : null, l = A ? p : (D = (V = i == null ? void 0 : i.errors) == null ? void 0 : V[t]) == null ? void 0 : D.message, u = y || R || _, m = A ? v : (r == null ? void 0 : r.field.value) ?? "", B = U(
384
+ ($) => {
385
+ u || (A ? s == null || s($) : (r == null || r.field.onChange($), r == null || r.field.onBlur()));
399
386
  },
400
- [u, x, s, r]
387
+ [u, A, s, r]
401
388
  );
402
- return /* @__PURE__ */ y("div", { className: `form-group column ${_ ? "hidden" : ""}`, children: [
389
+ return /* @__PURE__ */ g("div", { className: `form-group column ${O ? "hidden" : ""}`, children: [
403
390
  n && /* @__PURE__ */ e("label", { className: "control-label", children: n }),
404
- /* @__PURE__ */ e("div", { className: `btn-group ${u ? "view-mode" : ""}`, "data-field-name": t, children: f.map((O) => {
405
- const $ = O[o], k = h === $, B = O.color ? { "--customColor": O.color } : void 0;
391
+ /* @__PURE__ */ e("div", { className: `btn-group ${u ? "view-mode" : ""}`, "data-field-name": t, children: f.map(($) => {
392
+ const S = $[a], N = m === S, H = $.color ? { "--customColor": $.color } : void 0;
406
393
  return (
407
394
  // Trocado de <label> para <div> para evitar comportamentos nativos de clique do HTML
408
- /* @__PURE__ */ y(
395
+ /* @__PURE__ */ g(
409
396
  "div",
410
397
  {
411
- style: B,
412
- className: `btn fs-ellipsis ${k ? "active" : ""}`,
413
- onClick: () => E($),
398
+ style: H,
399
+ className: `btn fs-ellipsis ${N ? "active" : ""}`,
400
+ onClick: () => B(S),
414
401
  children: [
415
- O[a] && /* @__PURE__ */ e("i", { className: `${O[a]} icon-sm` }),
402
+ $[o] && /* @__PURE__ */ e("i", { className: `${$[o]} icon-sm` }),
416
403
  " ",
417
- O[c]
404
+ $[c]
418
405
  ]
419
406
  },
420
- $
407
+ S
421
408
  )
422
409
  );
423
410
  }) }),
424
- !x && /* @__PURE__ */ e("input", { type: "hidden", name: t, value: h || "", ref: r == null ? void 0 : r.field.ref }),
425
- (l || v) && /* @__PURE__ */ e("p", { className: "text-danger", children: String(l ?? v) })
411
+ !A && /* @__PURE__ */ e("input", { type: "hidden", name: t, value: m || "", ref: r == null ? void 0 : r.field.ref }),
412
+ (l || p) && /* @__PURE__ */ e("p", { className: "text-danger", children: String(l ?? p) })
426
413
  ] });
427
414
  }
428
- const ut = q(He), Le = ({
415
+ const ut = G(He), Le = ({
429
416
  name: t,
430
417
  label: n = "",
431
418
  placeholder: f = "",
432
- className: o = "",
419
+ className: a = "",
433
420
  rows: c = 4,
434
- maxLength: a,
435
- forceReadOnly: m = !1,
421
+ maxLength: o,
422
+ forceReadOnly: h = !1,
436
423
  forceHidden: d = !1,
437
- valueManual: p,
424
+ valueManual: v,
438
425
  onChangeManual: s,
439
- errorManual: v
426
+ errorManual: p
440
427
  }) => {
441
428
  var u;
442
- const x = p !== void 0 && !!s, { isReadOnly: I, isHidden: F } = G(), b = m || !!I(t), _ = d || !!F(t), { isView: R } = z(), S = ee(null);
443
- let N = {
444
- value: p ?? "",
445
- onChange: (h) => s == null ? void 0 : s(h)
429
+ const A = v !== void 0 && !!s, { isReadOnly: x, isHidden: T } = Q(), y = h || !!x(t), O = d || !!T(t), { isView: _ } = q(), R = ee(null);
430
+ let k = {
431
+ value: v ?? "",
432
+ onChange: (m) => s == null ? void 0 : s(m)
446
433
  }, r = null;
447
- if (!x)
434
+ if (!A)
448
435
  try {
449
- const { control: h } = W(), E = Z({ name: t, control: h });
450
- N = E.field, r = (u = E.fieldState) == null ? void 0 : u.error;
436
+ const { control: m } = z(), B = X({ name: t, control: m });
437
+ k = B.field, r = (u = B.fieldState) == null ? void 0 : u.error;
451
438
  } catch {
452
439
  }
453
440
  const i = () => {
454
- S.current && (S.current.style.height = "auto", S.current.style.height = `${S.current.scrollHeight}px`);
441
+ R.current && (R.current.style.height = "auto", R.current.style.height = `${R.current.scrollHeight}px`);
455
442
  };
456
- if (P(() => {
443
+ if (W(() => {
457
444
  i();
458
- }, [N.value]), R)
459
- return /* @__PURE__ */ y("div", { className: `form-group ${_ ? "hidden" : ""}`, children: [
445
+ }, [k.value]), _)
446
+ return /* @__PURE__ */ g("div", { className: `form-group ${O ? "hidden" : ""}`, children: [
460
447
  /* @__PURE__ */ e("label", { children: n }),
461
- /* @__PURE__ */ e("span", { className: "form-control", children: N.value || "-" })
448
+ /* @__PURE__ */ e("span", { className: "form-control", children: k.value || "-" })
462
449
  ] });
463
- const l = `form-control ${b ? "readOnly" : ""} ${r || v ? "border-red" : ""} ${o}`;
464
- return /* @__PURE__ */ y("div", { className: `form-group ${_ ? "hidden" : ""}`, children: [
450
+ const l = `form-control ${y ? "readOnly" : ""} ${r || p ? "border-red" : ""} ${a}`;
451
+ return /* @__PURE__ */ g("div", { className: `form-group ${O ? "hidden" : ""}`, children: [
465
452
  n && /* @__PURE__ */ e("label", { children: n }),
466
453
  /* @__PURE__ */ e(
467
454
  "textarea",
468
455
  {
469
- ref: S,
456
+ ref: R,
470
457
  rows: c,
471
- maxLength: a,
472
- value: N.value || "",
458
+ maxLength: o,
459
+ value: k.value || "",
473
460
  placeholder: f,
474
- readOnly: b,
461
+ readOnly: y,
475
462
  className: l,
476
463
  style: {
477
464
  resize: "none",
478
465
  maxHeight: "400px",
479
466
  overflowY: "auto"
480
467
  },
481
- onChange: (h) => {
482
- x ? s == null || s(h.target.value) : N.onChange(h);
468
+ onChange: (m) => {
469
+ A ? s == null || s(m.target.value) : k.onChange(m);
483
470
  },
484
471
  onInput: i
485
472
  }
486
473
  ),
487
- (r || v) && /* @__PURE__ */ e("p", { className: "text-danger", children: String((r == null ? void 0 : r.message) ?? v) })
474
+ (r || p) && /* @__PURE__ */ e("p", { className: "text-danger", children: String((r == null ? void 0 : r.message) ?? p) })
488
475
  ] });
489
- }, ft = q(Le);
476
+ }, ft = G(Le);
490
477
  /**
491
478
  * @license lucide-react v0.575.0 - ISC
492
479
  *
493
480
  * This source code is licensed under the ISC license.
494
481
  * See the LICENSE file in the root directory of this source tree.
495
482
  */
496
- const me = (...t) => t.filter((n, f, o) => !!n && n.trim() !== "" && o.indexOf(n) === f).join(" ").trim();
483
+ const me = (...t) => t.filter((n, f, a) => !!n && n.trim() !== "" && a.indexOf(n) === f).join(" ").trim();
497
484
  /**
498
485
  * @license lucide-react v0.575.0 - ISC
499
486
  *
500
487
  * This source code is licensed under the ISC license.
501
488
  * See the LICENSE file in the root directory of this source tree.
502
489
  */
503
- const Ce = (t) => t.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase();
490
+ const Te = (t) => t.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase();
504
491
  /**
505
492
  * @license lucide-react v0.575.0 - ISC
506
493
  *
@@ -509,7 +496,7 @@ const Ce = (t) => t.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase();
509
496
  */
510
497
  const Fe = (t) => t.replace(
511
498
  /^([A-Z])|[\s-_]+(\w)/g,
512
- (n, f, o) => o ? o.toUpperCase() : f.toLowerCase()
499
+ (n, f, a) => a ? a.toUpperCase() : f.toLowerCase()
513
500
  );
514
501
  /**
515
502
  * @license lucide-react v0.575.0 - ISC
@@ -544,7 +531,7 @@ var je = {
544
531
  * This source code is licensed under the ISC license.
545
532
  * See the LICENSE file in the root directory of this source tree.
546
533
  */
547
- const Te = (t) => {
534
+ const Pe = (t) => {
548
535
  for (const n in t)
549
536
  if (n.startsWith("aria-") || n === "role" || n === "title")
550
537
  return !0;
@@ -556,32 +543,32 @@ const Te = (t) => {
556
543
  * This source code is licensed under the ISC license.
557
544
  * See the LICENSE file in the root directory of this source tree.
558
545
  */
559
- const Pe = oe(
546
+ const Ce = oe(
560
547
  ({
561
548
  color: t = "currentColor",
562
549
  size: n = 24,
563
550
  strokeWidth: f = 2,
564
- absoluteStrokeWidth: o,
551
+ absoluteStrokeWidth: a,
565
552
  className: c = "",
566
- children: a,
567
- iconNode: m,
553
+ children: o,
554
+ iconNode: h,
568
555
  ...d
569
- }, p) => te(
556
+ }, v) => se(
570
557
  "svg",
571
558
  {
572
- ref: p,
559
+ ref: v,
573
560
  ...je,
574
561
  width: n,
575
562
  height: n,
576
563
  stroke: t,
577
- strokeWidth: o ? Number(f) * 24 / Number(n) : f,
564
+ strokeWidth: a ? Number(f) * 24 / Number(n) : f,
578
565
  className: me("lucide", c),
579
- ...!a && !Te(d) && { "aria-hidden": "true" },
566
+ ...!o && !Pe(d) && { "aria-hidden": "true" },
580
567
  ...d
581
568
  },
582
569
  [
583
- ...m.map(([s, v]) => te(s, v)),
584
- ...Array.isArray(a) ? a : [a]
570
+ ...h.map(([s, p]) => se(s, p)),
571
+ ...Array.isArray(o) ? o : [o]
585
572
  ]
586
573
  )
587
574
  );
@@ -591,15 +578,15 @@ const Pe = oe(
591
578
  * This source code is licensed under the ISC license.
592
579
  * See the LICENSE file in the root directory of this source tree.
593
580
  */
594
- const se = (t, n) => {
581
+ const re = (t, n) => {
595
582
  const f = oe(
596
- ({ className: o, ...c }, a) => te(Pe, {
597
- ref: a,
583
+ ({ className: a, ...c }, o) => se(Ce, {
584
+ ref: o,
598
585
  iconNode: n,
599
586
  className: me(
600
- `lucide-${Ce(ie(t))}`,
587
+ `lucide-${Te(ie(t))}`,
601
588
  `lucide-${t}`,
602
- o
589
+ a
603
590
  ),
604
591
  ...c
605
592
  })
@@ -612,26 +599,26 @@ const se = (t, n) => {
612
599
  * This source code is licensed under the ISC license.
613
600
  * See the LICENSE file in the root directory of this source tree.
614
601
  */
615
- const Ue = [
602
+ const We = [
616
603
  ["path", { d: "M8 2v4", key: "1cmpym" }],
617
604
  ["path", { d: "M16 2v4", key: "4m81vk" }],
618
605
  ["rect", { width: "18", height: "18", x: "3", y: "4", rx: "2", key: "1hopcy" }],
619
606
  ["path", { d: "M3 10h18", key: "8toen8" }]
620
- ], Ye = se("calendar", Ue);
607
+ ], Ue = re("calendar", We);
621
608
  /**
622
609
  * @license lucide-react v0.575.0 - ISC
623
610
  *
624
611
  * This source code is licensed under the ISC license.
625
612
  * See the LICENSE file in the root directory of this source tree.
626
613
  */
627
- const Je = [["path", { d: "m15 18-6-6 6-6", key: "1wnfg3" }]], We = se("chevron-left", Je);
614
+ const Ye = [["path", { d: "m15 18-6-6 6-6", key: "1wnfg3" }]], Je = re("chevron-left", Ye);
628
615
  /**
629
616
  * @license lucide-react v0.575.0 - ISC
630
617
  *
631
618
  * This source code is licensed under the ISC license.
632
619
  * See the LICENSE file in the root directory of this source tree.
633
620
  */
634
- const ze = [["path", { d: "m9 18 6-6-6-6", key: "mthhwq" }]], qe = se("chevron-right", ze), he = "dd/MM/yyyy", le = (t) => {
621
+ const ze = [["path", { d: "m9 18 6-6-6-6", key: "mthhwq" }]], qe = re("chevron-right", ze), he = "dd/MM/yyyy", le = (t) => {
635
622
  if (!t) return null;
636
623
  const n = xe(t, he, /* @__PURE__ */ new Date());
637
624
  return ue(n) ? n : null;
@@ -656,81 +643,81 @@ function Ke({
656
643
  name: t,
657
644
  label: n = "",
658
645
  placeholder: f = "dd/mm/aaaa",
659
- className: o = "",
646
+ className: a = "",
660
647
  forceReadOnly: c = !1,
661
- forceHidden: a = !1,
662
- valueManual: m,
648
+ forceHidden: o = !1,
649
+ valueManual: h,
663
650
  onChangeManual: d,
664
- errorManual: p
651
+ errorManual: v
665
652
  }) {
666
- var B;
667
- const s = m !== void 0 && !!d, { isReadOnly: v, isHidden: x } = G(), I = c || !!v(t), F = a || !!x(t), { isView: b } = z();
668
- let _ = "", R = () => {
669
- }, S, N = null, r = () => {
653
+ var H;
654
+ const s = h !== void 0 && !!d, { isReadOnly: p, isHidden: A } = Q(), x = c || !!p(t), T = o || !!A(t), { isView: y } = q();
655
+ let O = "", _ = () => {
656
+ }, R, k = null, r = () => {
670
657
  };
671
658
  if (s)
672
- _ = m;
659
+ O = h;
673
660
  else
674
661
  try {
675
- const g = W(), D = Z({ name: t, control: g.control });
676
- _ = D.field.value, R = D.field.onChange, S = D.field.ref, N = (B = D.fieldState) == null ? void 0 : B.error, r = g.clearErrors;
662
+ const b = z(), E = X({ name: t, control: b.control });
663
+ O = E.field.value, _ = E.field.onChange, R = E.field.ref, k = (H = E.fieldState) == null ? void 0 : H.error, r = b.clearErrors;
677
664
  } catch {
678
665
  }
679
- const [i, l] = Y(!1), [u, h] = Y(/* @__PURE__ */ new Date()), E = ee(null);
680
- P(() => {
666
+ const [i, l] = Y(!1), [u, m] = Y(/* @__PURE__ */ new Date()), B = ee(null);
667
+ W(() => {
681
668
  if (i) {
682
- const g = le(_);
683
- h(g && ue(g) ? g : /* @__PURE__ */ new Date());
669
+ const b = le(O);
670
+ m(b && ue(b) ? b : /* @__PURE__ */ new Date());
684
671
  }
685
- }, [i, _]), P(() => {
686
- const g = (D) => {
687
- E.current && !E.current.contains(D.target) && l(!1);
672
+ }, [i, O]), W(() => {
673
+ const b = (E) => {
674
+ B.current && !B.current.contains(E.target) && l(!1);
688
675
  };
689
- return document.addEventListener("mousedown", g), () => document.removeEventListener("mousedown", g);
676
+ return document.addEventListener("mousedown", b), () => document.removeEventListener("mousedown", b);
690
677
  }, []);
691
- const H = J(() => le(_), [_]), V = (g) => {
692
- if (I) return;
693
- const D = Ge(g);
694
- s ? d == null || d(D) : (R(D), r == null || r(t)), l(!1);
695
- }, O = J(() => ve({
678
+ const V = J(() => le(O), [O]), D = (b) => {
679
+ if (x) return;
680
+ const E = Ge(b);
681
+ s ? d == null || d(E) : (_(E), r == null || r(t)), l(!1);
682
+ }, $ = J(() => ve({
696
683
  start: be(Ne(u)),
697
684
  end: ye(ge(u))
698
- }), [u]), $ = u.getMonth(), k = ke(u);
699
- return /* @__PURE__ */ y("div", { className: `dfe-datepicker-wrapper form-group ${F ? "hidden" : ""} ${o}`, ref: E, children: [
685
+ }), [u]), S = u.getMonth(), N = ke(u);
686
+ return /* @__PURE__ */ g("div", { className: `dfe-datepicker-wrapper form-group ${T ? "hidden" : ""} ${a}`, ref: B, children: [
700
687
  /* @__PURE__ */ e("label", { className: "control-label", children: n }),
701
- b ? /* @__PURE__ */ e("span", { className: "form-control", children: _ || "-" }) : (
688
+ y ? /* @__PURE__ */ e("span", { className: "form-control", children: O || "-" }) : (
702
689
  /* Container isolador de contexto posicional */
703
- /* @__PURE__ */ y("div", { className: "dfe-datepicker-inner-container", children: [
704
- /* @__PURE__ */ y(
690
+ /* @__PURE__ */ g("div", { className: "dfe-datepicker-inner-container", children: [
691
+ /* @__PURE__ */ g(
705
692
  "div",
706
693
  {
707
- className: `dfe-datepicker-control ${N ? "border-red" : ""} ${I ? "readOnly" : ""}`,
708
- onClick: () => !I && l((g) => !g),
709
- ref: S,
694
+ className: `dfe-datepicker-control ${k ? "border-red" : ""} ${x ? "readOnly" : ""}`,
695
+ onClick: () => !x && l((b) => !b),
696
+ ref: R,
710
697
  children: [
711
- /* @__PURE__ */ e("span", { className: `dfe-datepicker-display ${I ? "readOnly" : ""}`, children: _ || f }),
712
- /* @__PURE__ */ e(Ye, { size: 16, className: "dfe-datepicker-icon" })
698
+ /* @__PURE__ */ e("span", { className: `dfe-datepicker-display ${x ? "readOnly" : ""}`, children: O || f }),
699
+ /* @__PURE__ */ e(Ue, { size: 16, className: "dfe-datepicker-icon" })
713
700
  ]
714
701
  }
715
702
  ),
716
- i && !I && /* @__PURE__ */ y("div", { className: "dfe-datepicker-dropdown", onClick: (g) => g.stopPropagation(), children: [
717
- /* @__PURE__ */ y("div", { className: "dfe-datepicker-header", children: [
703
+ i && !x && /* @__PURE__ */ g("div", { className: "dfe-datepicker-dropdown", onClick: (b) => b.stopPropagation(), children: [
704
+ /* @__PURE__ */ g("div", { className: "dfe-datepicker-header", children: [
718
705
  /* @__PURE__ */ e(
719
706
  "button",
720
707
  {
721
708
  type: "button",
722
- onClick: () => h(we(u, 1)),
709
+ onClick: () => m(we(u, 1)),
723
710
  className: "dfe-datepicker-nav-btn",
724
- children: /* @__PURE__ */ e(We, { size: 16 })
711
+ children: /* @__PURE__ */ e(Je, { size: 16 })
725
712
  }
726
713
  ),
727
- /* @__PURE__ */ y("div", { className: "dfe-datepicker-selectors", children: [
714
+ /* @__PURE__ */ g("div", { className: "dfe-datepicker-selectors", children: [
728
715
  /* @__PURE__ */ e(
729
716
  ne,
730
717
  {
731
718
  name: "datepicker_internal_month",
732
- valueManual: $,
733
- onChangeManual: (g) => h($e(u, Number(g))),
719
+ valueManual: S,
720
+ onChangeManual: (b) => m(Se(u, Number(b))),
734
721
  options: Qe,
735
722
  placeholder: "Mês"
736
723
  }
@@ -739,8 +726,8 @@ function Ke({
739
726
  ne,
740
727
  {
741
728
  name: "datepicker_internal_year",
742
- valueManual: k,
743
- onChangeManual: (g) => h(Oe(u, Number(g))),
729
+ valueManual: N,
730
+ onChangeManual: (b) => m($e(u, Number(b))),
744
731
  options: Xe,
745
732
  enableSearch: !0,
746
733
  searchPlaceholder: "Buscar ano...",
@@ -752,108 +739,108 @@ function Ke({
752
739
  "button",
753
740
  {
754
741
  type: "button",
755
- onClick: () => h(_e(u, 1)),
742
+ onClick: () => m(_e(u, 1)),
756
743
  className: "dfe-datepicker-nav-btn",
757
744
  children: /* @__PURE__ */ e(qe, { size: 16 })
758
745
  }
759
746
  )
760
747
  ] }),
761
- /* @__PURE__ */ e("div", { className: "dfe-datepicker-grid-header", children: ["D", "S", "T", "Q", "Q", "S", "S"].map((g, D) => /* @__PURE__ */ e("span", { children: g }, D)) }),
762
- /* @__PURE__ */ e("div", { className: "dfe-datepicker-grid", children: O.map((g, D) => {
763
- const j = !Re(g, u), X = H && Se(g, H);
748
+ /* @__PURE__ */ e("div", { className: "dfe-datepicker-grid-header", children: ["D", "S", "T", "Q", "Q", "S", "S"].map((b, E) => /* @__PURE__ */ e("span", { children: b }, E)) }),
749
+ /* @__PURE__ */ e("div", { className: "dfe-datepicker-grid", children: $.map((b, E) => {
750
+ const P = !Oe(b, u), Z = V && Re(b, V);
764
751
  return /* @__PURE__ */ e(
765
752
  "div",
766
753
  {
767
- onClick: () => !j && V(g),
754
+ onClick: () => !P && D(b),
768
755
  className: `dfe-datepicker-day
769
- ${X ? "selected" : "handleHover"}
770
- ${j ? "outside" : ""}
771
- ${Ae(g) ? "today" : ""}`,
772
- children: fe(g, "d")
756
+ ${Z ? "selected" : "handleHover"}
757
+ ${P ? "outside" : ""}
758
+ ${Ae(b) ? "today" : ""}`,
759
+ children: fe(b, "d")
773
760
  },
774
- D
761
+ E
775
762
  );
776
763
  }) })
777
764
  ] })
778
765
  ] })
779
766
  ),
780
- !s && /* @__PURE__ */ e("input", { type: "hidden", name: t, value: _ || "" }),
781
- (N || p) && /* @__PURE__ */ e("p", { className: "text-danger", children: String((N == null ? void 0 : N.message) ?? p) })
767
+ !s && /* @__PURE__ */ e("input", { type: "hidden", name: t, value: O || "" }),
768
+ (k || v) && /* @__PURE__ */ e("p", { className: "text-danger", children: String((k == null ? void 0 : k.message) ?? v) })
782
769
  ] });
783
770
  }
784
- const mt = q(Ke);
771
+ const mt = G(Ke);
785
772
  function Me({
786
773
  mapping: t = {},
787
774
  defaultLabel: n = "Não reconhecido",
788
775
  className: f = "",
789
- hidden: o = !1,
776
+ hidden: a = !1,
790
777
  label: c
791
778
  }) {
792
- const { activityId: a } = z(), m = J(() => !t || a === null || a === void 0 ? null : t[a], [a, t]);
793
- if (!m)
794
- return /* @__PURE__ */ y("div", { className: `form-group ${o ? "hidden" : ""}`, children: [
779
+ const { activityId: o } = q(), h = J(() => !t || o === null || o === void 0 ? null : t[o], [o, t]);
780
+ if (!h)
781
+ return /* @__PURE__ */ g("div", { className: `form-group ${a ? "hidden" : ""}`, children: [
795
782
  c && /* @__PURE__ */ e("label", { children: c }),
796
783
  /* @__PURE__ */ e("div", { className: `status-badge default ${f}`, children: n })
797
784
  ] });
798
785
  const d = {
799
- "--customColor": m.color
786
+ "--customColor": h.color
800
787
  };
801
- return /* @__PURE__ */ y("div", { className: `form-group ${o ? "hidden" : ""}`, children: [
788
+ return /* @__PURE__ */ g("div", { className: `form-group ${a ? "hidden" : ""}`, children: [
802
789
  c && /* @__PURE__ */ e("label", { children: c }),
803
- /* @__PURE__ */ y("div", { className: `status-badge ${f}`, style: d, children: [
804
- m.icon && /* @__PURE__ */ e("i", { className: m.icon }),
805
- /* @__PURE__ */ e("span", { children: m.label })
790
+ /* @__PURE__ */ g("div", { className: `status-badge ${f}`, style: d, children: [
791
+ h.icon && /* @__PURE__ */ e("i", { className: h.icon }),
792
+ /* @__PURE__ */ e("span", { children: h.label })
806
793
  ] })
807
794
  ] });
808
795
  }
809
- const ht = q(Me);
796
+ const ht = G(Me);
810
797
  function et({
811
798
  name: t,
812
799
  control: n,
813
800
  defaultRowValue: f,
814
- isView: o,
801
+ isView: a,
815
802
  isReadOnly: c,
816
- filters: a = []
803
+ filters: o = []
817
804
  }) {
818
- const { field: m } = Z({ name: t, control: n }), [d, p] = Y([]), [s, v] = Y([]), x = () => Date.now() + Math.random(), I = (i) => {
805
+ const { field: h } = X({ name: t, control: n }), [d, v] = Y([]), [s, p] = Y([]), A = () => Date.now() + Math.random(), x = (i) => {
819
806
  try {
820
807
  const l = JSON.parse(i);
821
808
  return Array.isArray(l) ? l.map((u) => ({
822
809
  ...u,
823
- _uid: u._uid || x()
810
+ _uid: u._uid || A()
824
811
  })) : [];
825
812
  } catch (l) {
826
813
  return console.error(`Erro ao ler dados da tabela "${t}":`, l), [];
827
814
  }
828
815
  };
829
- P(() => {
830
- if (!(d.length > 0 && !o) && m.value && typeof m.value == "string") {
816
+ W(() => {
817
+ if (!(d.length > 0 && !a) && h.value && typeof h.value == "string") {
831
818
  const i = JSON.stringify(d);
832
- if (m.value === i) return;
833
- const l = I(m.value);
834
- p(l);
819
+ if (h.value === i) return;
820
+ const l = x(h.value);
821
+ v(l);
835
822
  }
836
- }, [m.value, o]), P(() => {
823
+ }, [h.value, a]), W(() => {
837
824
  if (c) return;
838
825
  const i = JSON.stringify(d);
839
- m.value !== i && m.onChange(i);
840
- }, [d, m, c]);
841
- const F = U(() => {
842
- const i = { _uid: x(), ...f };
843
- p((l) => [...l, i]);
844
- }, [f]), b = U(() => {
845
- p((i) => i.filter((l) => !s.includes(l._uid))), v([]);
846
- }, [s]), _ = U((i, l, u) => {
847
- p((h) => h.map((E) => E._uid === i ? { ...E, [l]: u } : E));
848
- }, []), R = U((i) => {
849
- v((l) => l.includes(i) ? l.filter((u) => u !== i) : [...l, i]);
850
- }, []), S = U(
826
+ h.value !== i && h.onChange(i);
827
+ }, [d, h, c]);
828
+ const T = U(() => {
829
+ const i = { _uid: A(), ...f };
830
+ v((l) => [...l, i]);
831
+ }, [f]), y = U(() => {
832
+ v((i) => i.filter((l) => !s.includes(l._uid))), p([]);
833
+ }, [s]), O = U((i, l, u) => {
834
+ v((m) => m.map((B) => B._uid === i ? { ...B, [l]: u } : B));
835
+ }, []), _ = U((i) => {
836
+ p((l) => l.includes(i) ? l.filter((u) => u !== i) : [...l, i]);
837
+ }, []), R = U(
851
838
  (i) => {
852
- v(i ? d.map((l) => l._uid) : []);
839
+ p(i ? d.map((l) => l._uid) : []);
853
840
  },
854
841
  [d]
855
- ), N = d.length > 0 && s.length === d.length, r = J(() => !a || a.length === 0 ? d : d.filter(
856
- (i) => a.every((l) => {
842
+ ), k = d.length > 0 && s.length === d.length, r = J(() => !o || o.length === 0 ? d : d.filter(
843
+ (i) => o.every((l) => {
857
844
  if ("custom" in l)
858
845
  return l.custom(i);
859
846
  const u = i[l.field];
@@ -874,19 +861,19 @@ function et({
874
861
  return !0;
875
862
  }
876
863
  })
877
- ), [d, a]);
864
+ ), [d, o]);
878
865
  return {
879
- field: m,
866
+ field: h,
880
867
  tableRows: d,
881
868
  visibleRows: r,
882
869
  selectedRowIds: s,
883
- isAllSelected: N,
870
+ isAllSelected: k,
884
871
  handle: {
885
- addRow: F,
886
- removeRows: b,
887
- updateCellValue: _,
888
- toggleSelection: R,
889
- toggleSelectAll: S
872
+ addRow: T,
873
+ removeRows: y,
874
+ updateCellValue: O,
875
+ toggleSelection: _,
876
+ toggleSelectAll: R
890
877
  }
891
878
  };
892
879
  }
@@ -894,221 +881,221 @@ const pt = ({
894
881
  name: t,
895
882
  title: n = "Tabela Dinâmica",
896
883
  columns: f,
897
- defaultRowValue: o = {},
884
+ defaultRowValue: a = {},
898
885
  forceReadOnly: c = !1,
899
- layout: a = "fluid",
900
- actions: m = !0,
886
+ layout: o = "fluid",
887
+ actions: h = !0,
901
888
  filters: d = []
902
889
  }) => {
903
- const { control: p } = W(), { isView: s, isReadOnly: v } = z(), { isReadOnly: x } = G(), I = c || s || v || x && x(t), { field: F, visibleRows: b, selectedRowIds: _, isAllSelected: R, handle: S } = et({
890
+ const { control: v } = z(), { isView: s, isReadOnly: p } = q(), { isReadOnly: A } = Q(), x = c || s || p || A && A(t), { field: T, visibleRows: y, selectedRowIds: O, isAllSelected: _, handle: R } = et({
904
891
  name: t,
905
- control: p,
906
- defaultRowValue: o,
892
+ control: v,
893
+ defaultRowValue: a,
907
894
  isView: s,
908
- isReadOnly: !!I,
895
+ isReadOnly: !!x,
909
896
  filters: d
910
- }), N = a === "fixed";
911
- return /* @__PURE__ */ y("div", { className: `table-wrapper ${N ? "table-fixed" : "table-fluid"}`, children: [
912
- /* @__PURE__ */ e("input", { type: "hidden", ...F }),
913
- /* @__PURE__ */ y("div", { className: "header-handle", children: [
897
+ }), k = o === "fixed";
898
+ return /* @__PURE__ */ g("div", { className: `table-wrapper ${k ? "table-fixed" : "table-fluid"}`, children: [
899
+ /* @__PURE__ */ e("input", { type: "hidden", ...T }),
900
+ /* @__PURE__ */ g("div", { className: "header-handle", children: [
914
901
  /* @__PURE__ */ e("h3", { children: n }),
915
- !I && m && /* @__PURE__ */ y("div", { className: "handle-actions", children: [
916
- /* @__PURE__ */ y(
902
+ !x && h && /* @__PURE__ */ g("div", { className: "handle-actions", children: [
903
+ /* @__PURE__ */ g(
917
904
  "button",
918
905
  {
919
906
  type: "button",
920
- className: `btn ${_.length > 0 ? "btn-danger" : "btn-primary"}`,
921
- disabled: _.length === 0,
922
- onClick: S.removeRows,
907
+ className: `btn ${O.length > 0 ? "btn-danger" : "btn-primary"}`,
908
+ disabled: O.length === 0,
909
+ onClick: R.removeRows,
923
910
  children: [
924
911
  "Remover (",
925
- _.length,
912
+ O.length,
926
913
  ")"
927
914
  ]
928
915
  }
929
916
  ),
930
- /* @__PURE__ */ e("button", { type: "button", className: "btn-add", onClick: S.addRow, children: "Adicionar" })
917
+ /* @__PURE__ */ e("button", { type: "button", className: "btn-add", onClick: R.addRow, children: "Adicionar" })
931
918
  ] })
932
919
  ] }),
933
- /* @__PURE__ */ e("div", { className: "table-scroll", children: /* @__PURE__ */ y("table", { className: "table-custom", children: [
934
- /* @__PURE__ */ e("thead", { children: /* @__PURE__ */ y("tr", { children: [
935
- !I && /* @__PURE__ */ e("th", { style: { width: "50px" }, children: /* @__PURE__ */ e(
920
+ /* @__PURE__ */ e("div", { className: "table-scroll", children: /* @__PURE__ */ g("table", { className: "table-custom", children: [
921
+ /* @__PURE__ */ e("thead", { children: /* @__PURE__ */ g("tr", { children: [
922
+ !x && /* @__PURE__ */ e("th", { style: { width: "50px" }, children: /* @__PURE__ */ e(
936
923
  "input",
937
924
  {
938
925
  type: "checkbox",
939
- checked: R,
940
- onChange: (r) => S.toggleSelectAll(r.target.checked)
926
+ checked: _,
927
+ onChange: (r) => R.toggleSelectAll(r.target.checked)
941
928
  }
942
929
  ) }),
943
930
  f.map((r) => /* @__PURE__ */ e(
944
931
  "th",
945
932
  {
946
- style: r.width ? { minWidth: N ? r.width : "100%" } : { width: "max-content" },
933
+ style: r.width ? { minWidth: k ? r.width : "100%" } : { width: "max-content" },
947
934
  children: r.label
948
935
  },
949
936
  String(r.key)
950
937
  ))
951
938
  ] }) }),
952
- /* @__PURE__ */ y("tbody", { children: [
953
- b.map((r, i) => /* @__PURE__ */ y("tr", { children: [
954
- !I && /* @__PURE__ */ e("td", { children: /* @__PURE__ */ e(
939
+ /* @__PURE__ */ g("tbody", { children: [
940
+ y.map((r, i) => /* @__PURE__ */ g("tr", { children: [
941
+ !x && /* @__PURE__ */ e("td", { children: /* @__PURE__ */ e(
955
942
  "input",
956
943
  {
957
944
  type: "checkbox",
958
- checked: _.includes(r._uid),
959
- onChange: () => S.toggleSelection(r._uid)
945
+ checked: O.includes(r._uid),
946
+ onChange: () => R.toggleSelection(r._uid)
960
947
  }
961
948
  ) }),
962
949
  f.map((l) => /* @__PURE__ */ e("td", { children: l.render ? l.render.length <= 1 ? l.render({
963
950
  row: r,
964
951
  index: i,
965
- updateRow: (u, h) => S.updateCellValue(r._uid, String(u), h),
966
- isLocked: !!I,
952
+ updateRow: (u, m) => R.updateCellValue(r._uid, String(u), m),
953
+ isLocked: !!x,
967
954
  isView: !!s
968
955
  }) : l.render(
969
956
  r,
970
957
  i,
971
- (u, h) => S.updateCellValue(r._uid, u, h),
972
- !!I,
958
+ (u, m) => R.updateCellValue(r._uid, u, m),
959
+ !!x,
973
960
  !!s
974
961
  ) : r[l.key] }, `${r._uid}-${String(l.key)}`))
975
962
  ] }, r._uid)),
976
- b.length === 0 && /* @__PURE__ */ e("tr", { className: "empty-row", children: /* @__PURE__ */ e("td", { colSpan: 100, className: "text-center", children: I ? "Nenhum registro encontrado." : "Nenhum registro." }) })
963
+ y.length === 0 && /* @__PURE__ */ e("tr", { className: "empty-row", children: /* @__PURE__ */ e("td", { colSpan: 100, className: "text-center", children: x ? "Nenhum registro encontrado." : "Nenhum registro." }) })
977
964
  ] })
978
965
  ] }) })
979
966
  ] });
980
967
  }, tt = (t, n) => {
981
- const [f, o] = Y(null);
968
+ const [f, a] = Y(null);
982
969
  let c = null;
983
970
  try {
984
- c = W().watch;
971
+ c = z().watch;
985
972
  } catch {
986
973
  }
987
- const a = n !== void 0 ? n : c ? c(t) : void 0, m = U(() => {
974
+ const o = n !== void 0 ? n : c ? c(t) : void 0, h = U(() => {
988
975
  try {
989
- const p = window.top.__REACT_ATTACHMENT_BRIDGE__;
990
- if (p) {
991
- const s = p.getAttachment(t, a);
992
- o(s || (a ? { name: a, documentId: 0 } : null));
976
+ const v = window.top.__REACT_ATTACHMENT_BRIDGE__;
977
+ if (v) {
978
+ const s = v.getAttachment(t, o);
979
+ a(s || (o ? { name: o, documentId: 0 } : null));
993
980
  } else
994
- o(a ? { name: a, documentId: 0 } : null);
981
+ a(o ? { name: o, documentId: 0 } : null);
995
982
  } catch {
996
- o(a ? { name: a, documentId: 0 } : null);
983
+ a(o ? { name: o, documentId: 0 } : null);
997
984
  }
998
- }, [t, a, n]);
999
- return P(() => {
1000
- m();
1001
- const d = setInterval(m, 2e3);
985
+ }, [t, o, n]);
986
+ return W(() => {
987
+ h();
988
+ const d = setInterval(h, 2e3);
1002
989
  return () => clearInterval(d);
1003
- }, [m]), { attachment: f, sync: m };
990
+ }, [h]), { attachment: f, sync: h };
1004
991
  }, st = ({
1005
992
  name: t,
1006
993
  label: n,
1007
994
  help: f,
1008
- valueManual: o,
995
+ valueManual: a,
1009
996
  onChangeManual: c,
1010
- forceReadOnly: a = !1,
1011
- forceHidden: m = !1,
997
+ forceReadOnly: o = !1,
998
+ forceHidden: h = !1,
1012
999
  helpText: d,
1013
- helpTitle: p,
1000
+ helpTitle: v,
1014
1001
  helpWidth: s
1015
1002
  }) => {
1016
- const v = !!c, { isReadOnly: x, isHidden: I } = G(), { isView: F } = z(), b = a || F || !!x(t), _ = m || !!I(t), [R, S] = Y(!1);
1017
- let N = null;
1003
+ const p = !!c, { isReadOnly: A, isHidden: x } = Q(), { isView: T } = q(), y = o || T || !!A(t), O = h || !!x(t), [_, R] = Y(!1);
1004
+ let k = null;
1018
1005
  try {
1019
- N = W().control;
1006
+ k = z().control;
1020
1007
  } catch {
1021
1008
  }
1022
- const r = N && !v ? Z({ name: t, control: N }).field : {
1023
- value: o,
1024
- onChange: ($) => c == null ? void 0 : c($)
1025
- }, { attachment: i, sync: l } = tt(t, o), u = () => {
1026
- var $;
1009
+ const r = k && !p ? X({ name: t, control: k }).field : {
1010
+ value: a,
1011
+ onChange: (S) => c == null ? void 0 : c(S)
1012
+ }, { attachment: i, sync: l } = tt(t, a), u = () => {
1013
+ var S;
1027
1014
  try {
1028
- const k = window.top;
1015
+ const N = window.top;
1029
1016
  return {
1030
- bridge: k.__REACT_ATTACHMENT_BRIDGE__,
1031
- toast: ($ = k.FLUIGC) == null ? void 0 : $.toast
1017
+ bridge: N.__REACT_ATTACHMENT_BRIDGE__,
1018
+ toast: (S = N.FLUIGC) == null ? void 0 : S.toast
1032
1019
  };
1033
1020
  } catch {
1034
1021
  return { bridge: null, toast: null };
1035
1022
  }
1036
- }, h = U(() => {
1037
- if (b) return;
1038
- const $ = document.createElement("input");
1039
- $.type = "file", $.onchange = (k) => {
1040
- const B = k.target.files[0];
1041
- if (!B) return;
1042
- const { bridge: g, toast: D } = u();
1043
- S(!0), g ? g.upload(B, t, (j) => {
1044
- v ? c == null || c(j.name) : r.onChange(j.name), setTimeout(() => {
1045
- S(!1), l();
1046
- }, 1e3), D && D({
1023
+ }, m = U(() => {
1024
+ if (y) return;
1025
+ const S = document.createElement("input");
1026
+ S.type = "file", S.onchange = (N) => {
1027
+ const H = N.target.files[0];
1028
+ if (!H) return;
1029
+ const { bridge: b, toast: E } = u();
1030
+ R(!0), b ? b.upload(H, t, (P) => {
1031
+ p ? c == null || c(P.name) : r.onChange(P.name), setTimeout(() => {
1032
+ R(!1), l();
1033
+ }, 1e3), E && E({
1047
1034
  title: "Sucesso",
1048
1035
  message: "Arquivo enviado",
1049
1036
  type: "success"
1050
1037
  });
1051
- }) : (v ? c == null || c(B.name) : r.onChange(B.name), S(!1));
1052
- }, $.click();
1053
- }, [t, r, l, c, b, v]), E = ($) => {
1054
- if ($.stopPropagation(), b) return;
1055
- const k = (i == null ? void 0 : i.name) || o || r.value;
1056
- if (!k) return;
1057
- const { bridge: B, toast: g } = u();
1058
- B ? B.removeByFileName(k) ? (v ? c == null || c("") : r.onChange(""), l()) : g && g({
1038
+ }) : (p ? c == null || c(H.name) : r.onChange(H.name), R(!1));
1039
+ }, S.click();
1040
+ }, [t, r, l, c, y, p]), B = (S) => {
1041
+ if (S.stopPropagation(), y) return;
1042
+ const N = (i == null ? void 0 : i.name) || a || r.value;
1043
+ if (!N) return;
1044
+ const { bridge: H, toast: b } = u();
1045
+ H ? H.removeByFileName(N) ? (p ? c == null || c("") : r.onChange(""), l()) : b && b({
1059
1046
  title: "Erro",
1060
1047
  message: "Erro ao remover anexo",
1061
1048
  type: "danger"
1062
- }) : (v ? c == null || c("") : r.onChange(""), l());
1063
- }, H = !!i && !R, V = (i == null ? void 0 : i.name) || o || r.value, O = [
1049
+ }) : (p ? c == null || c("") : r.onChange(""), l());
1050
+ }, V = !!i && !_, D = (i == null ? void 0 : i.name) || a || r.value, $ = [
1064
1051
  "fluig-attachment__box",
1065
- H ? "fluig-attachment__box--has-file" : "",
1066
- R ? "fluig-attachment__box--uploading" : "",
1067
- b && !H ? "readOnly" : "",
1068
- b && H ? "fluig-attachment__box--readonly-view" : ""
1052
+ V ? "fluig-attachment__box--has-file" : "",
1053
+ _ ? "fluig-attachment__box--uploading" : "",
1054
+ y && !V ? "readOnly" : "",
1055
+ y && V ? "fluig-attachment__box--readonly-view" : ""
1069
1056
  ].join(" ");
1070
- return _ ? null : /* @__PURE__ */ y("div", { className: "form-group fluig-attachment", children: [
1057
+ return O ? null : /* @__PURE__ */ g("div", { className: "form-group fluig-attachment", children: [
1071
1058
  n && /* @__PURE__ */ e("label", { className: "fluig-attachment__label", children: n }),
1072
- /* @__PURE__ */ y("div", { className: d ? "dfe-flex-input-wrapper" : "", children: [
1073
- /* @__PURE__ */ y(
1059
+ /* @__PURE__ */ g("div", { className: d ? "dfe-flex-input-wrapper" : "", children: [
1060
+ /* @__PURE__ */ g(
1074
1061
  "div",
1075
1062
  {
1076
- className: O,
1063
+ className: $,
1077
1064
  style: d ? { flex: 1 } : void 0,
1078
1065
  onClick: () => {
1079
- if (H) {
1080
- const $ = u(), k = (i == null ? void 0 : i.physicalFileName) || (i == null ? void 0 : i.description) || (i == null ? void 0 : i.name) || V;
1081
- $.bridge && k && $.bridge.view(k);
1066
+ if (V) {
1067
+ const S = u(), N = (i == null ? void 0 : i.physicalFileName) || (i == null ? void 0 : i.description) || (i == null ? void 0 : i.name) || D;
1068
+ S.bridge && N && S.bridge.view(N);
1082
1069
  } else
1083
- h();
1070
+ m();
1084
1071
  },
1085
1072
  children: [
1086
- /* @__PURE__ */ y("span", { className: "fluig-attachment__content", children: [
1073
+ /* @__PURE__ */ g("span", { className: "fluig-attachment__content", children: [
1087
1074
  /* @__PURE__ */ e(
1088
1075
  "i",
1089
1076
  {
1090
- className: `flaticon icon-sm ${R ? "flaticon-loading" : H ? "flaticon-file" : "flaticon-paperclip"} fluig-attachment__icon`
1077
+ className: `flaticon icon-sm ${_ ? "flaticon-loading" : V ? "flaticon-file" : "flaticon-paperclip"} fluig-attachment__icon`
1091
1078
  }
1092
1079
  ),
1093
- /* @__PURE__ */ e("span", { className: "fluig-attachment__filename", children: R ? " Enviando..." : H ? V : b ? "Nenhum arquivo" : f || "Anexar" })
1080
+ /* @__PURE__ */ e("span", { className: "fluig-attachment__filename", children: _ ? " Enviando..." : V ? D : y ? "Nenhum arquivo" : f || "Anexar" })
1094
1081
  ] }),
1095
- H && !b && /* @__PURE__ */ e(
1082
+ V && !y && /* @__PURE__ */ e(
1096
1083
  "button",
1097
1084
  {
1098
1085
  type: "button",
1099
1086
  className: "fluig-attachment__btn-remove btn btn-link text-danger",
1100
- onClick: E,
1087
+ onClick: B,
1101
1088
  children: /* @__PURE__ */ e("i", { className: "flaticon flaticon-trash icon-sm" })
1102
1089
  }
1103
1090
  )
1104
1091
  ]
1105
1092
  }
1106
1093
  ),
1107
- d && /* @__PURE__ */ e(M, { text: d, title: p, width: s })
1094
+ d && /* @__PURE__ */ e(M, { text: d, title: v, width: s })
1108
1095
  ] }),
1109
- !v && N && /* @__PURE__ */ e("input", { type: "hidden", name: t, value: r.value || "" })
1096
+ !p && k && /* @__PURE__ */ e("input", { type: "hidden", name: t, value: r.value || "" })
1110
1097
  ] });
1111
- }, vt = q(st);
1098
+ }, vt = G(st);
1112
1099
  export {
1113
1100
  vt as Attachment,
1114
1101
  at as Checkbox,