@schema-forms-data/renderer 4.0.6 → 4.0.7
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.cjs +4 -4
- package/dist/index.js +741 -715
- package/package.json +4 -4
package/dist/index.js
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
var Er = Object.defineProperty;
|
|
2
2
|
var Ar = (t, e, r) => e in t ? Er(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r;
|
|
3
|
-
var
|
|
3
|
+
var it = (t, e, r) => Ar(t, typeof e != "symbol" ? e + "" : e, r);
|
|
4
4
|
import { jsxs as f, jsx as o, Fragment as Oe } from "react/jsx-runtime";
|
|
5
|
-
import { createContext as nr, useContext as
|
|
5
|
+
import { createContext as nr, useContext as Ue, useState as j, useRef as Y, useEffect as Q, useCallback as J, useMemo as M, startTransition as Dt } from "react";
|
|
6
6
|
import { useTemplate as ir, getTemplateConfig as Tr, TemplateProvider as Et } from "@schema-forms-data/templates";
|
|
7
|
-
import { useController as
|
|
8
|
-
import * as
|
|
9
|
-
import { Loader2 as
|
|
10
|
-
import { cn as
|
|
11
|
-
import { validateStepData as ln, evaluateFieldCondition as
|
|
7
|
+
import { useController as V, useFormContext as et, useFieldArray as ar, useFormState as Br, useWatch as De, useForm as Ir, FormProvider as Rr } from "react-hook-form";
|
|
8
|
+
import * as tt from "lucide-react";
|
|
9
|
+
import { Loader2 as ze, Check as Be, AlertCircle as Xe, Trash2 as sr, Plus as or, CalendarCheck2 as Or, Users as Lr, CalendarDays as Pr, Info as cr, Smartphone as dt, Banknote as lr, CreditCard as dr, ScrollText as At, ExternalLink as zr, CheckCircle2 as $r, EyeOff as Mr, Eye as Ur, X as jr, ChevronDown as Vr, Star as _r, ChevronLeft as Wr, ChevronRight as qr, CircleDot as Ye } from "lucide-react";
|
|
10
|
+
import { cn as O, Input as be, Textarea as Zr, Select as Hr, SelectTrigger as Gr, SelectValue as Kr, SelectContent as Xr, SelectItem as Yr, Checkbox as ft, RadioGroup as Jr, RadioGroupItem as Qr, Button as $e, Dialog as en, DialogTrigger as tn, DialogContent as rn, DialogHeader as nn, DialogTitle as an, ScrollArea as sn, Switch as on, Slider as cn, Label as Tt } from "@schema-forms-data/ui";
|
|
11
|
+
import { validateStepData as ln, evaluateFieldCondition as ie, FieldType as y, stripHiddenFields as dn } from "@schema-forms-data/core";
|
|
12
12
|
import { evaluateFieldCondition as Oa } from "@schema-forms-data/core";
|
|
13
|
-
const
|
|
13
|
+
const mt = nr({}), ke = () => Ue(mt), Bt = /* @__PURE__ */ new Set(["__proto__", "constructor", "prototype"]), Ze = (t, e, r) => {
|
|
14
14
|
const n = e.split(".");
|
|
15
15
|
let i = t;
|
|
16
16
|
for (let s = 0; s < n.length - 1; s++) {
|
|
@@ -32,20 +32,20 @@ const dt = nr({}), ke = () => Me(dt), Bt = /* @__PURE__ */ new Set(["__proto__",
|
|
|
32
32
|
const i = {}, { errors: a } = ln(t, n, e);
|
|
33
33
|
for (const h of a) {
|
|
34
34
|
const g = h.campo.replace(/\[(\d+)\]/g, ".$1");
|
|
35
|
-
|
|
35
|
+
Ze(i, g, { type: "custom", message: h.message });
|
|
36
36
|
}
|
|
37
37
|
const s = [...t.containers].sort((h, g) => h.ordem - g.ordem);
|
|
38
38
|
for (const h of s)
|
|
39
|
-
if (!h.repeatable &&
|
|
39
|
+
if (!h.repeatable && ie(h.condicional, n, e))
|
|
40
40
|
for (const g of h.campos) {
|
|
41
|
-
if (g.tipo === y.HIDDEN || g.isDisabled || g.isReadOnly || !
|
|
41
|
+
if (g.tipo === y.HIDDEN || g.isDisabled || g.isReadOnly || !ie(g.condicional, n, e)) continue;
|
|
42
42
|
if (g.tipo === y.FIELD_ARRAY) {
|
|
43
43
|
const w = Array.isArray(n[g.nome]) ? n[g.nome] : [];
|
|
44
44
|
for (let v = 0; v < w.length; v++) {
|
|
45
45
|
const b = w[v];
|
|
46
46
|
for (const x of g.subFields ?? []) {
|
|
47
|
-
if (x.isDisabled || x.isReadOnly || !
|
|
48
|
-
const
|
|
47
|
+
if (x.isDisabled || x.isReadOnly || !ie(x.condicional, b, e) || !((m = x.validate) != null && m.length) || i[`${g.nome}.${v}.${x.nome}`]) continue;
|
|
48
|
+
const k = await Ae(
|
|
49
49
|
x.validate,
|
|
50
50
|
x.nome,
|
|
51
51
|
b[x.nome],
|
|
@@ -53,7 +53,7 @@ const dt = nr({}), ke = () => Me(dt), Bt = /* @__PURE__ */ new Set(["__proto__",
|
|
|
53
53
|
e,
|
|
54
54
|
r
|
|
55
55
|
);
|
|
56
|
-
|
|
56
|
+
k && Ze(i, `${g.nome}.${v}.${x.nome}`, { type: "custom", message: k });
|
|
57
57
|
}
|
|
58
58
|
}
|
|
59
59
|
continue;
|
|
@@ -70,12 +70,12 @@ const dt = nr({}), ke = () => Me(dt), Bt = /* @__PURE__ */ new Set(["__proto__",
|
|
|
70
70
|
e,
|
|
71
71
|
r
|
|
72
72
|
);
|
|
73
|
-
b &&
|
|
73
|
+
b && Ze(i, `${g.nome}.${v.nome}`, { type: "custom", message: b });
|
|
74
74
|
}
|
|
75
75
|
continue;
|
|
76
76
|
}
|
|
77
77
|
if (!((u = g.validate) != null && u.length) || i[g.nome]) continue;
|
|
78
|
-
const
|
|
78
|
+
const F = await Ae(
|
|
79
79
|
g.validate,
|
|
80
80
|
g.nome,
|
|
81
81
|
n[g.nome],
|
|
@@ -83,15 +83,15 @@ const dt = nr({}), ke = () => Me(dt), Bt = /* @__PURE__ */ new Set(["__proto__",
|
|
|
83
83
|
e,
|
|
84
84
|
r
|
|
85
85
|
);
|
|
86
|
-
|
|
86
|
+
F && (i[g.nome] = { type: "custom", message: F });
|
|
87
87
|
}
|
|
88
88
|
for (const h of s) {
|
|
89
|
-
if (!h.repeatable || !h.nome || !
|
|
89
|
+
if (!h.repeatable || !h.nome || !ie(h.condicional, n, e)) continue;
|
|
90
90
|
const g = Array.isArray(n[h.nome]) ? n[h.nome] : [];
|
|
91
|
-
for (let
|
|
92
|
-
const w = g[
|
|
91
|
+
for (let F = 0; F < g.length; F++) {
|
|
92
|
+
const w = g[F];
|
|
93
93
|
for (const v of h.campos) {
|
|
94
|
-
if (v.tipo === y.HIDDEN || v.isDisabled || v.isReadOnly || !
|
|
94
|
+
if (v.tipo === y.HIDDEN || v.isDisabled || v.isReadOnly || !ie(v.condicional, w, e) || !((p = v.validate) != null && p.length) || i[`${h.nome}.${F}.${v.nome}`]) continue;
|
|
95
95
|
const b = await Ae(
|
|
96
96
|
v.validate,
|
|
97
97
|
v.nome,
|
|
@@ -100,7 +100,7 @@ const dt = nr({}), ke = () => Me(dt), Bt = /* @__PURE__ */ new Set(["__proto__",
|
|
|
100
100
|
e,
|
|
101
101
|
r
|
|
102
102
|
);
|
|
103
|
-
b &&
|
|
103
|
+
b && Ze(i, `${h.nome}.${F}.${v.nome}`, { type: "custom", message: b });
|
|
104
104
|
}
|
|
105
105
|
}
|
|
106
106
|
}
|
|
@@ -109,13 +109,13 @@ const dt = nr({}), ke = () => Me(dt), Bt = /* @__PURE__ */ new Set(["__proto__",
|
|
|
109
109
|
var s, c;
|
|
110
110
|
const i = {}, a = [...t.containers].sort((m, d) => m.ordem - d.ordem);
|
|
111
111
|
for (const m of a)
|
|
112
|
-
if (!(m.condicional && !
|
|
112
|
+
if (!(m.condicional && !ie(m.condicional, n, e))) {
|
|
113
113
|
if (m.repeatable && m.nome) {
|
|
114
114
|
const d = Array.isArray(n[m.nome]) ? n[m.nome] : [];
|
|
115
115
|
for (let l = 0; l < d.length; l++) {
|
|
116
116
|
const u = d[l];
|
|
117
117
|
for (const p of [...m.campos].sort((h, g) => h.ordem - g.ordem)) {
|
|
118
|
-
if (!((s = p.warn) != null && s.length) || !
|
|
118
|
+
if (!((s = p.warn) != null && s.length) || !ie(p.condicional, u, e)) continue;
|
|
119
119
|
const g = await Ae(
|
|
120
120
|
p.warn,
|
|
121
121
|
p.nome,
|
|
@@ -130,7 +130,7 @@ const dt = nr({}), ke = () => Me(dt), Bt = /* @__PURE__ */ new Set(["__proto__",
|
|
|
130
130
|
continue;
|
|
131
131
|
}
|
|
132
132
|
for (const d of [...m.campos].sort((l, u) => l.ordem - u.ordem)) {
|
|
133
|
-
if (!((c = d.warn) != null && c.length) || !
|
|
133
|
+
if (!((c = d.warn) != null && c.length) || !ie(d.condicional, n, e)) continue;
|
|
134
134
|
const u = await Ae(
|
|
135
135
|
d.warn,
|
|
136
136
|
d.nome,
|
|
@@ -167,7 +167,7 @@ const dt = nr({}), ke = () => Me(dt), Bt = /* @__PURE__ */ new Set(["__proto__",
|
|
|
167
167
|
descricao: se(t.descricao, e),
|
|
168
168
|
containers: t.containers.map((r) => pt(r, e))
|
|
169
169
|
}), mr = () => {
|
|
170
|
-
const t = ir(), e = t.layout.containerStyle, r = t.layout.roundness ?? "rounded-xl", n =
|
|
170
|
+
const t = ir(), e = t.layout.containerStyle, r = t.layout.roundness ?? "rounded-xl", n = O(
|
|
171
171
|
"overflow-hidden",
|
|
172
172
|
r,
|
|
173
173
|
e === "card" ? "border" : "",
|
|
@@ -178,7 +178,7 @@ const dt = nr({}), ke = () => Me(dt), Bt = /* @__PURE__ */ new Set(["__proto__",
|
|
|
178
178
|
borderColor: "var(--t-border)",
|
|
179
179
|
borderWidth: "1px",
|
|
180
180
|
borderStyle: "solid"
|
|
181
|
-
} : {}, a =
|
|
181
|
+
} : {}, a = O(
|
|
182
182
|
"border-b px-6 py-4",
|
|
183
183
|
e === "flat" ? "border-transparent" : ""
|
|
184
184
|
);
|
|
@@ -192,7 +192,7 @@ const dt = nr({}), ke = () => Me(dt), Bt = /* @__PURE__ */ new Set(["__proto__",
|
|
|
192
192
|
readOnly: a
|
|
193
193
|
}) => {
|
|
194
194
|
var d;
|
|
195
|
-
const { field: s, fieldState: c } =
|
|
195
|
+
const { field: s, fieldState: c } = V({ name: t, control: e }), m = !!c.error;
|
|
196
196
|
return /* @__PURE__ */ f("div", { className: "space-y-1", children: [
|
|
197
197
|
/* @__PURE__ */ o(
|
|
198
198
|
be,
|
|
@@ -203,7 +203,7 @@ const dt = nr({}), ke = () => Me(dt), Bt = /* @__PURE__ */ new Set(["__proto__",
|
|
|
203
203
|
placeholder: r,
|
|
204
204
|
disabled: i,
|
|
205
205
|
readOnly: a,
|
|
206
|
-
className:
|
|
206
|
+
className: O(
|
|
207
207
|
m && "border-destructive focus-visible:ring-destructive"
|
|
208
208
|
)
|
|
209
209
|
}
|
|
@@ -218,7 +218,7 @@ const dt = nr({}), ke = () => Me(dt), Bt = /* @__PURE__ */ new Set(["__proto__",
|
|
|
218
218
|
readOnly: i
|
|
219
219
|
}) => {
|
|
220
220
|
var c;
|
|
221
|
-
const { field: a, fieldState: s } =
|
|
221
|
+
const { field: a, fieldState: s } = V({ name: t, control: e });
|
|
222
222
|
return /* @__PURE__ */ f("div", { className: "space-y-1", children: [
|
|
223
223
|
/* @__PURE__ */ o(
|
|
224
224
|
Zr,
|
|
@@ -229,7 +229,7 @@ const dt = nr({}), ke = () => Me(dt), Bt = /* @__PURE__ */ new Set(["__proto__",
|
|
|
229
229
|
disabled: n,
|
|
230
230
|
readOnly: i,
|
|
231
231
|
rows: 3,
|
|
232
|
-
className:
|
|
232
|
+
className: O(
|
|
233
233
|
s.error && "border-destructive focus-visible:ring-destructive"
|
|
234
234
|
)
|
|
235
235
|
}
|
|
@@ -245,7 +245,7 @@ const dt = nr({}), ke = () => Me(dt), Bt = /* @__PURE__ */ new Set(["__proto__",
|
|
|
245
245
|
readOnly: a
|
|
246
246
|
}) => {
|
|
247
247
|
var m;
|
|
248
|
-
const { field: s, fieldState: c } =
|
|
248
|
+
const { field: s, fieldState: c } = V({ name: t, control: e });
|
|
249
249
|
return /* @__PURE__ */ f("div", { className: "space-y-1", children: [
|
|
250
250
|
/* @__PURE__ */ f(
|
|
251
251
|
Hr,
|
|
@@ -257,7 +257,7 @@ const dt = nr({}), ke = () => Me(dt), Bt = /* @__PURE__ */ new Set(["__proto__",
|
|
|
257
257
|
/* @__PURE__ */ o(
|
|
258
258
|
Gr,
|
|
259
259
|
{
|
|
260
|
-
className:
|
|
260
|
+
className: O(c.error && "border-destructive focus:ring-destructive"),
|
|
261
261
|
onBlur: s.onBlur,
|
|
262
262
|
children: /* @__PURE__ */ o(Kr, { placeholder: r ?? "Selecione..." })
|
|
263
263
|
}
|
|
@@ -276,7 +276,7 @@ const dt = nr({}), ke = () => Me(dt), Bt = /* @__PURE__ */ new Set(["__proto__",
|
|
|
276
276
|
readOnly: i
|
|
277
277
|
}) => {
|
|
278
278
|
var c;
|
|
279
|
-
const { field: a, fieldState: s } =
|
|
279
|
+
const { field: a, fieldState: s } = V({ name: t, control: e });
|
|
280
280
|
return /* @__PURE__ */ f("div", { className: "space-y-1", children: [
|
|
281
281
|
/* @__PURE__ */ f("label", { className: "flex items-center gap-2 cursor-pointer", children: [
|
|
282
282
|
/* @__PURE__ */ o(
|
|
@@ -300,7 +300,7 @@ const dt = nr({}), ke = () => Me(dt), Bt = /* @__PURE__ */ new Set(["__proto__",
|
|
|
300
300
|
disabled: n
|
|
301
301
|
}) => {
|
|
302
302
|
var m;
|
|
303
|
-
const { field: i, fieldState: a } =
|
|
303
|
+
const { field: i, fieldState: a } = V({ name: t, control: e }), s = Array.isArray(i.value) ? i.value : [], c = (d) => {
|
|
304
304
|
const l = s.includes(d) ? s.filter((u) => u !== d) : [...s, d];
|
|
305
305
|
i.onChange(l);
|
|
306
306
|
};
|
|
@@ -333,20 +333,20 @@ const dt = nr({}), ke = () => Me(dt), Bt = /* @__PURE__ */ new Set(["__proto__",
|
|
|
333
333
|
disabled: i
|
|
334
334
|
}) => {
|
|
335
335
|
var m;
|
|
336
|
-
const { field: a, fieldState: s } =
|
|
336
|
+
const { field: a, fieldState: s } = V({ name: t, control: e }), c = n === "card";
|
|
337
337
|
return /* @__PURE__ */ f("div", { className: "space-y-1", onBlur: a.onBlur, children: [
|
|
338
338
|
/* @__PURE__ */ o(
|
|
339
339
|
Jr,
|
|
340
340
|
{
|
|
341
341
|
value: a.value ?? "",
|
|
342
342
|
onValueChange: a.onChange,
|
|
343
|
-
className:
|
|
343
|
+
className: O(
|
|
344
344
|
c ? "grid grid-cols-2 gap-2 sm:grid-cols-3" : "flex flex-col gap-2"
|
|
345
345
|
),
|
|
346
346
|
children: r.map((d) => /* @__PURE__ */ f(
|
|
347
347
|
"label",
|
|
348
348
|
{
|
|
349
|
-
className:
|
|
349
|
+
className: O(
|
|
350
350
|
"flex items-center gap-2 cursor-pointer",
|
|
351
351
|
c && "rounded-lg border p-3 transition-colors hover:bg-accent data-[selected=true]:border-primary data-[selected=true]:bg-primary/5",
|
|
352
352
|
(i || d.disabled) && "cursor-not-allowed opacity-50"
|
|
@@ -378,7 +378,7 @@ const dt = nr({}), ke = () => Me(dt), Bt = /* @__PURE__ */ new Set(["__proto__",
|
|
|
378
378
|
}, bn = (t) => {
|
|
379
379
|
const e = /* @__PURE__ */ new Date();
|
|
380
380
|
return e.setFullYear(e.getFullYear() - t), pr(e);
|
|
381
|
-
},
|
|
381
|
+
}, Me = ({
|
|
382
382
|
name: t,
|
|
383
383
|
control: e,
|
|
384
384
|
isDatetime: r,
|
|
@@ -387,7 +387,7 @@ const dt = nr({}), ke = () => Me(dt), Bt = /* @__PURE__ */ new Set(["__proto__",
|
|
|
387
387
|
validacao: a
|
|
388
388
|
}) => {
|
|
389
389
|
var p;
|
|
390
|
-
const { field: s, fieldState: c } =
|
|
390
|
+
const { field: s, fieldState: c } = V({ name: t, control: e }), m = r ? "datetime-local" : "date", d = (h) => r ? h + "T00:00" : h, l = (a == null ? void 0 : a.minAge) != null ? d(gn(a.minAge)) : (a == null ? void 0 : a.maxDate) != null ? d(a.maxDate) : void 0, u = (a == null ? void 0 : a.maxAge) != null ? d(bn(a.maxAge)) : (a == null ? void 0 : a.minDate) != null ? d(a.minDate) : void 0;
|
|
391
391
|
return /* @__PURE__ */ f("div", { className: "space-y-1", children: [
|
|
392
392
|
/* @__PURE__ */ o(
|
|
393
393
|
be,
|
|
@@ -401,7 +401,7 @@ const dt = nr({}), ke = () => Me(dt), Bt = /* @__PURE__ */ new Set(["__proto__",
|
|
|
401
401
|
max: l,
|
|
402
402
|
disabled: n,
|
|
403
403
|
readOnly: i,
|
|
404
|
-
className:
|
|
404
|
+
className: O(
|
|
405
405
|
c.error && "border-destructive focus-visible:ring-destructive"
|
|
406
406
|
)
|
|
407
407
|
}
|
|
@@ -443,10 +443,10 @@ const hr = {
|
|
|
443
443
|
};
|
|
444
444
|
for (const [t, e] of Object.entries(hr))
|
|
445
445
|
;
|
|
446
|
-
let
|
|
446
|
+
let He;
|
|
447
447
|
function yn() {
|
|
448
448
|
if (!(typeof globalThis.TextDecoder > "u"))
|
|
449
|
-
return
|
|
449
|
+
return He ?? (He = new globalThis.TextDecoder("utf-8"));
|
|
450
450
|
}
|
|
451
451
|
const Ie = 32 * 1024, fe = 65533;
|
|
452
452
|
function wn(t, e = "utf-8") {
|
|
@@ -473,15 +473,15 @@ function wn(t, e = "utf-8") {
|
|
|
473
473
|
function bt(t, e) {
|
|
474
474
|
e.length !== 0 && (t.push(String.fromCharCode.apply(null, e)), e.length = 0);
|
|
475
475
|
}
|
|
476
|
-
function
|
|
476
|
+
function K(t, e, r) {
|
|
477
477
|
e.push(r), e.length >= Ie && bt(t, e);
|
|
478
478
|
}
|
|
479
479
|
function Cn(t, e, r) {
|
|
480
480
|
if (r <= 65535) {
|
|
481
|
-
|
|
481
|
+
K(t, e, r);
|
|
482
482
|
return;
|
|
483
483
|
}
|
|
484
|
-
r -= 65536,
|
|
484
|
+
r -= 65536, K(t, e, 55296 + (r >> 10)), K(t, e, 56320 + (r & 1023));
|
|
485
485
|
}
|
|
486
486
|
function kn(t) {
|
|
487
487
|
const e = [], r = [];
|
|
@@ -489,50 +489,50 @@ function kn(t) {
|
|
|
489
489
|
for (t.length >= 3 && t[0] === 239 && t[1] === 187 && t[2] === 191 && (n = 3); n < t.length; ) {
|
|
490
490
|
const i = t[n];
|
|
491
491
|
if (i <= 127) {
|
|
492
|
-
|
|
492
|
+
K(e, r, i), n++;
|
|
493
493
|
continue;
|
|
494
494
|
}
|
|
495
495
|
if (i < 194 || i > 244) {
|
|
496
|
-
|
|
496
|
+
K(e, r, fe), n++;
|
|
497
497
|
continue;
|
|
498
498
|
}
|
|
499
499
|
if (i <= 223) {
|
|
500
500
|
if (n + 1 >= t.length) {
|
|
501
|
-
|
|
501
|
+
K(e, r, fe), n++;
|
|
502
502
|
continue;
|
|
503
503
|
}
|
|
504
504
|
const l = t[n + 1];
|
|
505
505
|
if ((l & 192) !== 128) {
|
|
506
|
-
|
|
506
|
+
K(e, r, fe), n++;
|
|
507
507
|
continue;
|
|
508
508
|
}
|
|
509
509
|
const u = (i & 31) << 6 | l & 63;
|
|
510
|
-
|
|
510
|
+
K(e, r, u), n += 2;
|
|
511
511
|
continue;
|
|
512
512
|
}
|
|
513
513
|
if (i <= 239) {
|
|
514
514
|
if (n + 2 >= t.length) {
|
|
515
|
-
|
|
515
|
+
K(e, r, fe), n++;
|
|
516
516
|
continue;
|
|
517
517
|
}
|
|
518
518
|
const l = t[n + 1], u = t[n + 2];
|
|
519
519
|
if (!((l & 192) === 128 && (u & 192) === 128 && !(i === 224 && l < 160) && // overlong
|
|
520
520
|
!(i === 237 && l >= 160))) {
|
|
521
|
-
|
|
521
|
+
K(e, r, fe), n++;
|
|
522
522
|
continue;
|
|
523
523
|
}
|
|
524
524
|
const h = (i & 15) << 12 | (l & 63) << 6 | u & 63;
|
|
525
|
-
|
|
525
|
+
K(e, r, h), n += 3;
|
|
526
526
|
continue;
|
|
527
527
|
}
|
|
528
528
|
if (n + 3 >= t.length) {
|
|
529
|
-
|
|
529
|
+
K(e, r, fe), n++;
|
|
530
530
|
continue;
|
|
531
531
|
}
|
|
532
532
|
const a = t[n + 1], s = t[n + 2], c = t[n + 3];
|
|
533
533
|
if (!((a & 192) === 128 && (s & 192) === 128 && (c & 192) === 128 && !(i === 240 && a < 144) && // overlong
|
|
534
534
|
!(i === 244 && a > 143))) {
|
|
535
|
-
|
|
535
|
+
K(e, r, fe), n++;
|
|
536
536
|
continue;
|
|
537
537
|
}
|
|
538
538
|
const d = (i & 7) << 18 | (a & 63) << 12 | (s & 63) << 6 | c & 63;
|
|
@@ -548,18 +548,18 @@ function Nn(t) {
|
|
|
548
548
|
if (i += 2, a >= 55296 && a <= 56319) {
|
|
549
549
|
if (i + 1 < n) {
|
|
550
550
|
const s = t[i] | t[i + 1] << 8;
|
|
551
|
-
s >= 56320 && s <= 57343 ? (
|
|
551
|
+
s >= 56320 && s <= 57343 ? (K(e, r, a), K(e, r, s), i += 2) : K(e, r, fe);
|
|
552
552
|
} else
|
|
553
|
-
|
|
553
|
+
K(e, r, fe);
|
|
554
554
|
continue;
|
|
555
555
|
}
|
|
556
556
|
if (a >= 56320 && a <= 57343) {
|
|
557
|
-
|
|
557
|
+
K(e, r, fe);
|
|
558
558
|
continue;
|
|
559
559
|
}
|
|
560
|
-
|
|
560
|
+
K(e, r, a);
|
|
561
561
|
}
|
|
562
|
-
return i < n &&
|
|
562
|
+
return i < n && K(e, r, fe), bt(e, r), e.join("");
|
|
563
563
|
}
|
|
564
564
|
function Fn(t) {
|
|
565
565
|
const e = [];
|
|
@@ -601,7 +601,7 @@ const En = {
|
|
|
601
601
|
put(t, e, r) {
|
|
602
602
|
return oe(t).setUint8(e, r), e + 1;
|
|
603
603
|
}
|
|
604
|
-
},
|
|
604
|
+
}, Z = {
|
|
605
605
|
len: 2,
|
|
606
606
|
get(t, e) {
|
|
607
607
|
return oe(t).getUint16(e, !0);
|
|
@@ -617,7 +617,7 @@ const En = {
|
|
|
617
617
|
put(t, e, r) {
|
|
618
618
|
return oe(t).setUint16(e, r), e + 2;
|
|
619
619
|
}
|
|
620
|
-
},
|
|
620
|
+
}, H = {
|
|
621
621
|
len: 4,
|
|
622
622
|
get(t, e) {
|
|
623
623
|
return oe(t).getUint32(e, !0);
|
|
@@ -660,7 +660,7 @@ class ye {
|
|
|
660
660
|
}
|
|
661
661
|
}
|
|
662
662
|
const Bn = "End-Of-Stream";
|
|
663
|
-
class
|
|
663
|
+
class X extends Error {
|
|
664
664
|
constructor() {
|
|
665
665
|
super(Bn), this.name = "EndOfStreamError";
|
|
666
666
|
}
|
|
@@ -683,7 +683,7 @@ class xr {
|
|
|
683
683
|
return 0;
|
|
684
684
|
let n = this.readFromPeekBuffer(e);
|
|
685
685
|
if (this.endOfStream || (n += await this.readRemainderFromStream(e.subarray(n), r)), n === 0 && !r)
|
|
686
|
-
throw new
|
|
686
|
+
throw new X();
|
|
687
687
|
return n;
|
|
688
688
|
}
|
|
689
689
|
/**
|
|
@@ -713,7 +713,7 @@ class xr {
|
|
|
713
713
|
n += i;
|
|
714
714
|
}
|
|
715
715
|
if (!r && n < e.length)
|
|
716
|
-
throw new
|
|
716
|
+
throw new X();
|
|
717
717
|
return n;
|
|
718
718
|
}
|
|
719
719
|
}
|
|
@@ -772,7 +772,7 @@ class Rt extends xr {
|
|
|
772
772
|
i.value && (n += this.writeChunk(e.subarray(n), i.value));
|
|
773
773
|
}
|
|
774
774
|
if (!r && n === 0 && this.endOfStream)
|
|
775
|
-
throw new
|
|
775
|
+
throw new X();
|
|
776
776
|
return n;
|
|
777
777
|
}
|
|
778
778
|
abort() {
|
|
@@ -812,7 +812,7 @@ class vt {
|
|
|
812
812
|
async readToken(e, r = this.position) {
|
|
813
813
|
const n = new Uint8Array(e.len);
|
|
814
814
|
if (await this.readBuffer(n, { position: r }) < e.len)
|
|
815
|
-
throw new
|
|
815
|
+
throw new X();
|
|
816
816
|
return e.get(n, 0);
|
|
817
817
|
}
|
|
818
818
|
/**
|
|
@@ -824,7 +824,7 @@ class vt {
|
|
|
824
824
|
async peekToken(e, r = this.position) {
|
|
825
825
|
const n = new Uint8Array(e.len);
|
|
826
826
|
if (await this.peekBuffer(n, { position: r }) < e.len)
|
|
827
|
-
throw new
|
|
827
|
+
throw new X();
|
|
828
828
|
return e.get(n, 0);
|
|
829
829
|
}
|
|
830
830
|
/**
|
|
@@ -834,7 +834,7 @@ class vt {
|
|
|
834
834
|
*/
|
|
835
835
|
async readNumber(e) {
|
|
836
836
|
if (await this.readBuffer(this.numBuffer, { length: e.len }) < e.len)
|
|
837
|
-
throw new
|
|
837
|
+
throw new X();
|
|
838
838
|
return e.get(this.numBuffer, 0);
|
|
839
839
|
}
|
|
840
840
|
/**
|
|
@@ -844,7 +844,7 @@ class vt {
|
|
|
844
844
|
*/
|
|
845
845
|
async peekNumber(e) {
|
|
846
846
|
if (await this.peekBuffer(this.numBuffer, { length: e.len }) < e.len)
|
|
847
|
-
throw new
|
|
847
|
+
throw new X();
|
|
848
848
|
return e.get(this.numBuffer, 0);
|
|
849
849
|
}
|
|
850
850
|
/**
|
|
@@ -907,7 +907,7 @@ class zn extends vt {
|
|
|
907
907
|
return 0;
|
|
908
908
|
const a = await this.streamReader.read(e.subarray(0, n.length), n.mayBeLess);
|
|
909
909
|
if (this.position += a, (!r || !r.mayBeLess) && a < n.length)
|
|
910
|
-
throw new
|
|
910
|
+
throw new X();
|
|
911
911
|
return a;
|
|
912
912
|
}
|
|
913
913
|
/**
|
|
@@ -932,12 +932,12 @@ class zn extends vt {
|
|
|
932
932
|
try {
|
|
933
933
|
i = await this.streamReader.peek(e.subarray(0, n.length), n.mayBeLess);
|
|
934
934
|
} catch (a) {
|
|
935
|
-
if (r != null && r.mayBeLess && a instanceof
|
|
935
|
+
if (r != null && r.mayBeLess && a instanceof X)
|
|
936
936
|
return 0;
|
|
937
937
|
throw a;
|
|
938
938
|
}
|
|
939
939
|
if (!n.mayBeLess && i < n.length)
|
|
940
|
-
throw new
|
|
940
|
+
throw new X();
|
|
941
941
|
}
|
|
942
942
|
return i;
|
|
943
943
|
}
|
|
@@ -996,7 +996,7 @@ class $n extends vt {
|
|
|
996
996
|
async peekBuffer(e, r) {
|
|
997
997
|
const n = this.normalizeOptions(e, r), i = Math.min(this.uint8Array.length - n.position, n.length);
|
|
998
998
|
if (!n.mayBeLess && i < n.length)
|
|
999
|
-
throw new
|
|
999
|
+
throw new X();
|
|
1000
1000
|
return e.set(this.uint8Array.subarray(n.position, n.position + i)), i;
|
|
1001
1001
|
}
|
|
1002
1002
|
close() {
|
|
@@ -1038,7 +1038,7 @@ class Mn extends vt {
|
|
|
1038
1038
|
async peekBuffer(e, r) {
|
|
1039
1039
|
const n = this.normalizeOptions(e, r), i = Math.min(this.blob.size - n.position, n.length);
|
|
1040
1040
|
if (!n.mayBeLess && i < n.length)
|
|
1041
|
-
throw new
|
|
1041
|
+
throw new X();
|
|
1042
1042
|
const a = await this.blob.slice(n.position, n.position + i).arrayBuffer();
|
|
1043
1043
|
return e.set(new Uint8Array(a)), i;
|
|
1044
1044
|
}
|
|
@@ -1052,25 +1052,25 @@ class Mn extends vt {
|
|
|
1052
1052
|
this.position = e;
|
|
1053
1053
|
}
|
|
1054
1054
|
}
|
|
1055
|
-
function
|
|
1055
|
+
function Un(t, e) {
|
|
1056
1056
|
const r = Ln(t), n = e ?? {}, i = n.onClose;
|
|
1057
1057
|
return n.onClose = async () => {
|
|
1058
1058
|
if (await r.close(), i)
|
|
1059
1059
|
return i();
|
|
1060
1060
|
}, new zn(r, n);
|
|
1061
1061
|
}
|
|
1062
|
-
function
|
|
1062
|
+
function jn(t, e) {
|
|
1063
1063
|
return new $n(t, e);
|
|
1064
1064
|
}
|
|
1065
1065
|
function Vn(t, e) {
|
|
1066
1066
|
return new Mn(t, e);
|
|
1067
1067
|
}
|
|
1068
|
-
var
|
|
1068
|
+
var ut = { exports: {} }, at, Ot;
|
|
1069
1069
|
function _n() {
|
|
1070
|
-
if (Ot) return
|
|
1070
|
+
if (Ot) return at;
|
|
1071
1071
|
Ot = 1;
|
|
1072
1072
|
var t = 1e3, e = t * 60, r = e * 60, n = r * 24, i = n * 7, a = n * 365.25;
|
|
1073
|
-
|
|
1073
|
+
at = function(l, u) {
|
|
1074
1074
|
u = u || {};
|
|
1075
1075
|
var p = typeof l;
|
|
1076
1076
|
if (p === "string" && l.length > 0)
|
|
@@ -1145,7 +1145,7 @@ function _n() {
|
|
|
1145
1145
|
var g = u >= p * 1.5;
|
|
1146
1146
|
return Math.round(l / p) + " " + h + (g ? "s" : "");
|
|
1147
1147
|
}
|
|
1148
|
-
return
|
|
1148
|
+
return at;
|
|
1149
1149
|
}
|
|
1150
1150
|
function Wn(t) {
|
|
1151
1151
|
r.debug = r, r.default = r, r.coerce = m, r.disable = s, r.enable = i, r.enabled = c, r.humanize = _n(), r.destroy = d, Object.keys(t).forEach((l) => {
|
|
@@ -1160,32 +1160,32 @@ function Wn(t) {
|
|
|
1160
1160
|
r.selectColor = e;
|
|
1161
1161
|
function r(l) {
|
|
1162
1162
|
let u, p = null, h, g;
|
|
1163
|
-
function
|
|
1164
|
-
if (!
|
|
1163
|
+
function F(...w) {
|
|
1164
|
+
if (!F.enabled)
|
|
1165
1165
|
return;
|
|
1166
|
-
const v =
|
|
1166
|
+
const v = F, b = Number(/* @__PURE__ */ new Date()), x = b - (u || b);
|
|
1167
1167
|
v.diff = x, v.prev = u, v.curr = b, u = b, w[0] = r.coerce(w[0]), typeof w[0] != "string" && w.unshift("%O");
|
|
1168
|
-
let
|
|
1169
|
-
w[0] = w[0].replace(/%([a-zA-Z%])/g, (E,
|
|
1168
|
+
let k = 0;
|
|
1169
|
+
w[0] = w[0].replace(/%([a-zA-Z%])/g, (E, T) => {
|
|
1170
1170
|
if (E === "%%")
|
|
1171
1171
|
return "%";
|
|
1172
|
-
|
|
1173
|
-
const
|
|
1174
|
-
if (typeof
|
|
1175
|
-
const
|
|
1176
|
-
E =
|
|
1172
|
+
k++;
|
|
1173
|
+
const C = r.formatters[T];
|
|
1174
|
+
if (typeof C == "function") {
|
|
1175
|
+
const S = w[k];
|
|
1176
|
+
E = C.call(v, S), w.splice(k, 1), k--;
|
|
1177
1177
|
}
|
|
1178
1178
|
return E;
|
|
1179
1179
|
}), r.formatArgs.call(v, w), (v.log || r.log).apply(v, w);
|
|
1180
1180
|
}
|
|
1181
|
-
return
|
|
1181
|
+
return F.namespace = l, F.useColors = r.useColors(), F.color = r.selectColor(l), F.extend = n, F.destroy = r.destroy, Object.defineProperty(F, "enabled", {
|
|
1182
1182
|
enumerable: !0,
|
|
1183
1183
|
configurable: !1,
|
|
1184
1184
|
get: () => p !== null ? p : (h !== r.namespaces && (h = r.namespaces, g = r.enabled(l)), g),
|
|
1185
1185
|
set: (w) => {
|
|
1186
1186
|
p = w;
|
|
1187
1187
|
}
|
|
1188
|
-
}), typeof r.init == "function" && r.init(
|
|
1188
|
+
}), typeof r.init == "function" && r.init(F), F;
|
|
1189
1189
|
}
|
|
1190
1190
|
function n(l, u) {
|
|
1191
1191
|
const p = r(this.namespace + (typeof u > "u" ? ":" : u) + l);
|
|
@@ -1198,12 +1198,12 @@ function Wn(t) {
|
|
|
1198
1198
|
p[0] === "-" ? r.skips.push(p.slice(1)) : r.names.push(p);
|
|
1199
1199
|
}
|
|
1200
1200
|
function a(l, u) {
|
|
1201
|
-
let p = 0, h = 0, g = -1,
|
|
1201
|
+
let p = 0, h = 0, g = -1, F = 0;
|
|
1202
1202
|
for (; p < l.length; )
|
|
1203
1203
|
if (h < u.length && (u[h] === l[p] || u[h] === "*"))
|
|
1204
|
-
u[h] === "*" ? (g = h,
|
|
1204
|
+
u[h] === "*" ? (g = h, F = p, h++) : (p++, h++);
|
|
1205
1205
|
else if (g !== -1)
|
|
1206
|
-
h = g + 1,
|
|
1206
|
+
h = g + 1, F++, p = F;
|
|
1207
1207
|
else
|
|
1208
1208
|
return !1;
|
|
1209
1209
|
for (; h < u.length && u[h] === "*"; )
|
|
@@ -1372,8 +1372,8 @@ var qn = Wn;
|
|
|
1372
1372
|
return "[UnexpectedJSONParseError]: " + d.message;
|
|
1373
1373
|
}
|
|
1374
1374
|
};
|
|
1375
|
-
})(
|
|
1376
|
-
var Zn =
|
|
1375
|
+
})(ut, ut.exports);
|
|
1376
|
+
var Zn = ut.exports;
|
|
1377
1377
|
const Hn = /* @__PURE__ */ vn(Zn), Te = {
|
|
1378
1378
|
LocalFileHeader: 67324752,
|
|
1379
1379
|
DataDescriptor: 134695760,
|
|
@@ -1382,24 +1382,24 @@ const Hn = /* @__PURE__ */ vn(Zn), Te = {
|
|
|
1382
1382
|
}, Lt = {
|
|
1383
1383
|
get(t) {
|
|
1384
1384
|
return {
|
|
1385
|
-
signature:
|
|
1386
|
-
compressedSize:
|
|
1387
|
-
uncompressedSize:
|
|
1385
|
+
signature: H.get(t, 0),
|
|
1386
|
+
compressedSize: H.get(t, 8),
|
|
1387
|
+
uncompressedSize: H.get(t, 12)
|
|
1388
1388
|
};
|
|
1389
1389
|
},
|
|
1390
1390
|
len: 16
|
|
1391
1391
|
}, Gn = {
|
|
1392
1392
|
get(t) {
|
|
1393
|
-
const e =
|
|
1393
|
+
const e = Z.get(t, 6);
|
|
1394
1394
|
return {
|
|
1395
|
-
signature:
|
|
1396
|
-
minVersion:
|
|
1395
|
+
signature: H.get(t, 0),
|
|
1396
|
+
minVersion: Z.get(t, 4),
|
|
1397
1397
|
dataDescriptor: !!(e & 8),
|
|
1398
|
-
compressedMethod:
|
|
1399
|
-
compressedSize:
|
|
1400
|
-
uncompressedSize:
|
|
1401
|
-
filenameLength:
|
|
1402
|
-
extraFieldLength:
|
|
1398
|
+
compressedMethod: Z.get(t, 8),
|
|
1399
|
+
compressedSize: H.get(t, 18),
|
|
1400
|
+
uncompressedSize: H.get(t, 22),
|
|
1401
|
+
filenameLength: Z.get(t, 26),
|
|
1402
|
+
extraFieldLength: Z.get(t, 28),
|
|
1403
1403
|
filename: null
|
|
1404
1404
|
};
|
|
1405
1405
|
},
|
|
@@ -1407,56 +1407,56 @@ const Hn = /* @__PURE__ */ vn(Zn), Te = {
|
|
|
1407
1407
|
}, Kn = {
|
|
1408
1408
|
get(t) {
|
|
1409
1409
|
return {
|
|
1410
|
-
signature:
|
|
1411
|
-
nrOfThisDisk:
|
|
1412
|
-
nrOfThisDiskWithTheStart:
|
|
1413
|
-
nrOfEntriesOnThisDisk:
|
|
1414
|
-
nrOfEntriesOfSize:
|
|
1415
|
-
sizeOfCd:
|
|
1416
|
-
offsetOfStartOfCd:
|
|
1417
|
-
zipFileCommentLength:
|
|
1410
|
+
signature: H.get(t, 0),
|
|
1411
|
+
nrOfThisDisk: Z.get(t, 4),
|
|
1412
|
+
nrOfThisDiskWithTheStart: Z.get(t, 6),
|
|
1413
|
+
nrOfEntriesOnThisDisk: Z.get(t, 8),
|
|
1414
|
+
nrOfEntriesOfSize: Z.get(t, 10),
|
|
1415
|
+
sizeOfCd: H.get(t, 12),
|
|
1416
|
+
offsetOfStartOfCd: H.get(t, 16),
|
|
1417
|
+
zipFileCommentLength: Z.get(t, 20)
|
|
1418
1418
|
};
|
|
1419
1419
|
},
|
|
1420
1420
|
len: 22
|
|
1421
1421
|
}, Xn = {
|
|
1422
1422
|
get(t) {
|
|
1423
|
-
const e =
|
|
1423
|
+
const e = Z.get(t, 8);
|
|
1424
1424
|
return {
|
|
1425
|
-
signature:
|
|
1426
|
-
minVersion:
|
|
1425
|
+
signature: H.get(t, 0),
|
|
1426
|
+
minVersion: Z.get(t, 6),
|
|
1427
1427
|
dataDescriptor: !!(e & 8),
|
|
1428
|
-
compressedMethod:
|
|
1429
|
-
compressedSize:
|
|
1430
|
-
uncompressedSize:
|
|
1431
|
-
filenameLength:
|
|
1432
|
-
extraFieldLength:
|
|
1433
|
-
fileCommentLength:
|
|
1434
|
-
relativeOffsetOfLocalHeader:
|
|
1428
|
+
compressedMethod: Z.get(t, 10),
|
|
1429
|
+
compressedSize: H.get(t, 20),
|
|
1430
|
+
uncompressedSize: H.get(t, 24),
|
|
1431
|
+
filenameLength: Z.get(t, 28),
|
|
1432
|
+
extraFieldLength: Z.get(t, 30),
|
|
1433
|
+
fileCommentLength: Z.get(t, 32),
|
|
1434
|
+
relativeOffsetOfLocalHeader: H.get(t, 42),
|
|
1435
1435
|
filename: null
|
|
1436
1436
|
};
|
|
1437
1437
|
},
|
|
1438
1438
|
len: 46
|
|
1439
1439
|
};
|
|
1440
1440
|
function gr(t) {
|
|
1441
|
-
const e = new Uint8Array(
|
|
1442
|
-
return
|
|
1441
|
+
const e = new Uint8Array(H.len);
|
|
1442
|
+
return H.put(e, 0, t), e;
|
|
1443
1443
|
}
|
|
1444
|
-
const xe = Hn("tokenizer:inflate"),
|
|
1444
|
+
const xe = Hn("tokenizer:inflate"), st = 256 * 1024, Yn = gr(Te.DataDescriptor), Ge = gr(Te.EndOfCentralDirectory);
|
|
1445
1445
|
class je {
|
|
1446
1446
|
constructor(e) {
|
|
1447
|
-
this.tokenizer = e, this.syncBuffer = new Uint8Array(
|
|
1447
|
+
this.tokenizer = e, this.syncBuffer = new Uint8Array(st);
|
|
1448
1448
|
}
|
|
1449
1449
|
async isZip() {
|
|
1450
1450
|
return await this.peekSignature() === Te.LocalFileHeader;
|
|
1451
1451
|
}
|
|
1452
1452
|
peekSignature() {
|
|
1453
|
-
return this.tokenizer.peekToken(
|
|
1453
|
+
return this.tokenizer.peekToken(H);
|
|
1454
1454
|
}
|
|
1455
1455
|
async findEndOfCentralDirectoryLocator() {
|
|
1456
1456
|
const e = this.tokenizer, r = Math.min(16 * 1024, e.fileInfo.size), n = this.syncBuffer.subarray(0, r);
|
|
1457
1457
|
await this.tokenizer.readBuffer(n, { position: e.fileInfo.size - r });
|
|
1458
1458
|
for (let i = n.length - 4; i >= 0; i--)
|
|
1459
|
-
if (n[i] ===
|
|
1459
|
+
if (n[i] === Ge[0] && n[i + 1] === Ge[1] && n[i + 2] === Ge[2] && n[i + 3] === Ge[3])
|
|
1460
1460
|
return e.fileInfo.size - r + i;
|
|
1461
1461
|
return -1;
|
|
1462
1462
|
}
|
|
@@ -1495,10 +1495,10 @@ class je {
|
|
|
1495
1495
|
let s;
|
|
1496
1496
|
if (await this.tokenizer.ignore(i.extraFieldLength), i.dataDescriptor && i.compressedSize === 0) {
|
|
1497
1497
|
const c = [];
|
|
1498
|
-
let m =
|
|
1498
|
+
let m = st;
|
|
1499
1499
|
xe("Compressed-file-size unknown, scanning for next data-descriptor-signature....");
|
|
1500
1500
|
let d = -1;
|
|
1501
|
-
for (; d < 0 && m ===
|
|
1501
|
+
for (; d < 0 && m === st; ) {
|
|
1502
1502
|
m = await this.tokenizer.peekBuffer(this.syncBuffer, { mayBeLess: !0 }), d = Jn(this.syncBuffer.subarray(0, m), Yn);
|
|
1503
1503
|
const l = d >= 0 ? d : m;
|
|
1504
1504
|
if (a.handler) {
|
|
@@ -1554,7 +1554,7 @@ class je {
|
|
|
1554
1554
|
}
|
|
1555
1555
|
}
|
|
1556
1556
|
async readLocalFileHeader() {
|
|
1557
|
-
const e = await this.tokenizer.peekToken(
|
|
1557
|
+
const e = await this.tokenizer.peekToken(H);
|
|
1558
1558
|
if (e === Te.LocalFileHeader) {
|
|
1559
1559
|
const r = await this.tokenizer.readToken(Gn);
|
|
1560
1560
|
return r.filename = await this.tokenizer.readToken(new ye(r.filenameLength, "utf-8")), r;
|
|
@@ -2020,7 +2020,7 @@ const ni = {
|
|
|
2020
2020
|
"application/x-ms-regedit",
|
|
2021
2021
|
"application/x-ft-windows-registry-hive",
|
|
2022
2022
|
"application/x-jmp-data"
|
|
2023
|
-
], Le = 4100, si = Le - 2, ve = 1024 * 1024, zt = 1024, oi = 2 ** 31 - 1, me = 16 * 1024 * 1024,
|
|
2023
|
+
], Le = 4100, si = Le - 2, ve = 1024 * 1024, zt = 1024, oi = 2 ** 31 - 1, me = 16 * 1024 * 1024, rt = ve, $t = ve, ci = me, li = 1, Mt = 100, ot = me, Ut = 64, jt = rt, di = 256, mi = 512, ui = me, fi = 512, pi = 512, Vt = 256, _t = rt, Wt = rt, hi = rt, qt = me, xi = /* @__PURE__ */ new Set([
|
|
2024
2024
|
"Unexpected signature",
|
|
2025
2025
|
"Encrypted ZIP",
|
|
2026
2026
|
"Expected Central-File-Header signature"
|
|
@@ -2058,7 +2058,7 @@ async function Ce(t, e, { maximumLength: r = me, reason: n = "skip" } = {}) {
|
|
|
2058
2058
|
const i = yt(e, r, n);
|
|
2059
2059
|
await t.ignore(i);
|
|
2060
2060
|
}
|
|
2061
|
-
async function
|
|
2061
|
+
async function ct(t, e, r, { maximumLength: n = e.length, reason: i = "read" } = {}) {
|
|
2062
2062
|
const a = e.length, s = yt(a, n, i);
|
|
2063
2063
|
return t.readBuffer(e, {
|
|
2064
2064
|
...r,
|
|
@@ -2090,13 +2090,13 @@ async function yi(t, { maximumLength: e = ve } = {}) {
|
|
|
2090
2090
|
c.set(d, m), m += d.length;
|
|
2091
2091
|
return c;
|
|
2092
2092
|
}
|
|
2093
|
-
const br = 134695760,
|
|
2093
|
+
const br = 134695760, Je = 16, wi = Je - 1;
|
|
2094
2094
|
function Ci(t, e) {
|
|
2095
|
-
if (t.length <
|
|
2095
|
+
if (t.length < Je)
|
|
2096
2096
|
return -1;
|
|
2097
|
-
const r = t.length -
|
|
2097
|
+
const r = t.length - Je;
|
|
2098
2098
|
for (let n = 0; n <= r; n++)
|
|
2099
|
-
if (
|
|
2099
|
+
if (H.get(t, n) === br && H.get(t, n + 8) === e + n)
|
|
2100
2100
|
return n;
|
|
2101
2101
|
return -1;
|
|
2102
2102
|
}
|
|
@@ -2127,11 +2127,11 @@ async function Fi(t, { shouldBuffer: e, maximumLength: r = ve } = {}) {
|
|
|
2127
2127
|
if (m >= 0)
|
|
2128
2128
|
break;
|
|
2129
2129
|
}
|
|
2130
|
-
if (
|
|
2130
|
+
if (ne(t.tokenizer) || (t.knownSizeDescriptorScannedBytes += s), !!e)
|
|
2131
2131
|
return Ni(a, s);
|
|
2132
2132
|
}
|
|
2133
2133
|
function Si(t, e) {
|
|
2134
|
-
return
|
|
2134
|
+
return ne(t.tokenizer) ? Math.max(0, me - (t.tokenizer.position - e)) : Math.max(0, ve - t.knownSizeDescriptorScannedBytes);
|
|
2135
2135
|
}
|
|
2136
2136
|
async function Di(t, e, { shouldBuffer: r, maximumDescriptorLength: n = ve } = {}) {
|
|
2137
2137
|
if (e.dataDescriptor && e.compressedSize === 0)
|
|
@@ -2141,7 +2141,7 @@ async function Di(t, e, { shouldBuffer: r, maximumDescriptorLength: n = ve } = {
|
|
|
2141
2141
|
});
|
|
2142
2142
|
if (!r) {
|
|
2143
2143
|
await Ce(t.tokenizer, e.compressedSize, {
|
|
2144
|
-
maximumLength:
|
|
2144
|
+
maximumLength: ne(t.tokenizer) ? ve : t.tokenizer.fileInfo.size,
|
|
2145
2145
|
reason: "ZIP entry compressed data"
|
|
2146
2146
|
});
|
|
2147
2147
|
return;
|
|
@@ -2179,8 +2179,8 @@ je.prototype.unzip = async function(t) {
|
|
|
2179
2179
|
maximumDescriptorLength: Math.min(ve, Si(this, n))
|
|
2180
2180
|
});
|
|
2181
2181
|
if (a.handler && await this.inflate(i, s, a.handler), i.dataDescriptor) {
|
|
2182
|
-
const c = new Uint8Array(
|
|
2183
|
-
if (await this.tokenizer.readBuffer(c),
|
|
2182
|
+
const c = new Uint8Array(Je);
|
|
2183
|
+
if (await this.tokenizer.readBuffer(c), H.get(c, 0) !== br)
|
|
2184
2184
|
throw new Error(`Expected data-descriptor-signature at position ${this.tokenizer.position - c.length}`);
|
|
2185
2185
|
}
|
|
2186
2186
|
if (Pe(this.tokenizer, n, me))
|
|
@@ -2393,19 +2393,19 @@ function Ii(t) {
|
|
|
2393
2393
|
function Ri(t) {
|
|
2394
2394
|
return Number.isFinite(t) ? Math.max(0, t) : Number.MAX_SAFE_INTEGER;
|
|
2395
2395
|
}
|
|
2396
|
-
function
|
|
2396
|
+
function ne(t) {
|
|
2397
2397
|
const e = t.fileInfo.size;
|
|
2398
2398
|
return !Number.isFinite(e) || e === Number.MAX_SAFE_INTEGER;
|
|
2399
2399
|
}
|
|
2400
2400
|
function Pe(t, e, r) {
|
|
2401
|
-
return
|
|
2401
|
+
return ne(t) && t.position - e > r;
|
|
2402
2402
|
}
|
|
2403
2403
|
function Oi(t) {
|
|
2404
2404
|
const e = t.fileInfo.size, r = Number.isFinite(e) ? Math.max(0, e - t.position) : Number.MAX_SAFE_INTEGER;
|
|
2405
2405
|
return Math.min(r, oi);
|
|
2406
2406
|
}
|
|
2407
2407
|
function Li(t) {
|
|
2408
|
-
if (t instanceof
|
|
2408
|
+
if (t instanceof X || t instanceof Fe)
|
|
2409
2409
|
return !0;
|
|
2410
2410
|
if (!(t instanceof Error))
|
|
2411
2411
|
return !1;
|
|
@@ -2474,8 +2474,8 @@ function $i(t) {
|
|
|
2474
2474
|
class wt {
|
|
2475
2475
|
constructor(e) {
|
|
2476
2476
|
// Detections with a high degree of certainty in identifying the correct file type
|
|
2477
|
-
|
|
2478
|
-
if (this.buffer = new Uint8Array(Le), e.fileInfo.size === void 0 && (e.fileInfo.size = Number.MAX_SAFE_INTEGER), this.tokenizer = e,
|
|
2477
|
+
it(this, "detectConfident", async (e) => {
|
|
2478
|
+
if (this.buffer = new Uint8Array(Le), e.fileInfo.size === void 0 && (e.fileInfo.size = Number.MAX_SAFE_INTEGER), this.tokenizer = e, ne(e) && (await e.peekBuffer(this.buffer, { length: 3, mayBeLess: !0 }), this.check([31, 139, 8])))
|
|
2479
2479
|
return this.detectGzip(e);
|
|
2480
2480
|
if (await e.peekBuffer(this.buffer, { length: 32, mayBeLess: !0 }), this.check([66, 77]))
|
|
2481
2481
|
return {
|
|
@@ -2544,8 +2544,8 @@ class wt {
|
|
|
2544
2544
|
maximumLength: 6,
|
|
2545
2545
|
reason: "ID3 header prefix"
|
|
2546
2546
|
});
|
|
2547
|
-
const r = await e.readToken(ni), n =
|
|
2548
|
-
if (!Number.isFinite(r) || r < 0 || n && (r >
|
|
2547
|
+
const r = await e.readToken(ni), n = ne(e);
|
|
2548
|
+
if (!Number.isFinite(r) || r < 0 || n && (r > ot || e.position + r > ot))
|
|
2549
2549
|
return;
|
|
2550
2550
|
if (e.position + r > e.fileInfo.size)
|
|
2551
2551
|
return n ? void 0 : {
|
|
@@ -2554,11 +2554,11 @@ class wt {
|
|
|
2554
2554
|
};
|
|
2555
2555
|
try {
|
|
2556
2556
|
await Ce(e, r, {
|
|
2557
|
-
maximumLength: n ?
|
|
2557
|
+
maximumLength: n ? ot : e.fileInfo.size,
|
|
2558
2558
|
reason: "ID3 payload"
|
|
2559
2559
|
});
|
|
2560
2560
|
} catch (i) {
|
|
2561
|
-
if (i instanceof
|
|
2561
|
+
if (i instanceof X)
|
|
2562
2562
|
return;
|
|
2563
2563
|
throw i;
|
|
2564
2564
|
}
|
|
@@ -2780,7 +2780,7 @@ class wt {
|
|
|
2780
2780
|
for (; !(m & d) && d !== 0; )
|
|
2781
2781
|
++l, d >>= 1;
|
|
2782
2782
|
const u = new Uint8Array(l + 1);
|
|
2783
|
-
return await
|
|
2783
|
+
return await ct(e, u, void 0, {
|
|
2784
2784
|
maximumLength: u.length,
|
|
2785
2785
|
reason: "EBML field"
|
|
2786
2786
|
}), u;
|
|
@@ -2801,13 +2801,13 @@ class wt {
|
|
|
2801
2801
|
return;
|
|
2802
2802
|
const l = e.position, u = await n();
|
|
2803
2803
|
if (u.id === 17026) {
|
|
2804
|
-
if (u.len >
|
|
2804
|
+
if (u.len > Ut)
|
|
2805
2805
|
return;
|
|
2806
|
-
const p = yt(u.len,
|
|
2806
|
+
const p = yt(u.len, Ut, "EBML DocType");
|
|
2807
2807
|
return (await e.readToken(new ye(p))).replaceAll(/\00.*$/g, "");
|
|
2808
2808
|
}
|
|
2809
|
-
if (
|
|
2810
|
-
maximumLength:
|
|
2809
|
+
if (ne(e) && (!Number.isFinite(u.len) || u.len < 0 || u.len > jt) || (await Ce(e, u.len, {
|
|
2810
|
+
maximumLength: ne(e) ? jt : e.fileInfo.size,
|
|
2811
2811
|
reason: "EBML payload"
|
|
2812
2812
|
}), --m, e.position <= l))
|
|
2813
2813
|
return;
|
|
@@ -3051,7 +3051,7 @@ class wt {
|
|
|
3051
3051
|
type: await e.readToken(new ye(4, "latin1"))
|
|
3052
3052
|
};
|
|
3053
3053
|
}
|
|
3054
|
-
const a =
|
|
3054
|
+
const a = ne(e), s = e.position;
|
|
3055
3055
|
let c = 0, m = !1;
|
|
3056
3056
|
do {
|
|
3057
3057
|
if (c++, c > mi || Pe(e, s, ui))
|
|
@@ -3080,7 +3080,7 @@ class wt {
|
|
|
3080
3080
|
reason: "PNG chunk payload"
|
|
3081
3081
|
});
|
|
3082
3082
|
} catch (u) {
|
|
3083
|
-
if (!a && (u instanceof Fe || u instanceof
|
|
3083
|
+
if (!a && (u instanceof Fe || u instanceof X))
|
|
3084
3084
|
return r;
|
|
3085
3085
|
throw u;
|
|
3086
3086
|
}
|
|
@@ -3195,7 +3195,7 @@ class wt {
|
|
|
3195
3195
|
try {
|
|
3196
3196
|
async function n() {
|
|
3197
3197
|
const c = new Uint8Array(16);
|
|
3198
|
-
return await
|
|
3198
|
+
return await ct(e, c, void 0, {
|
|
3199
3199
|
maximumLength: c.length,
|
|
3200
3200
|
reason: "ASF header GUID"
|
|
3201
3201
|
}), {
|
|
@@ -3207,7 +3207,7 @@ class wt {
|
|
|
3207
3207
|
maximumLength: 30,
|
|
3208
3208
|
reason: "ASF header prelude"
|
|
3209
3209
|
});
|
|
3210
|
-
const i =
|
|
3210
|
+
const i = ne(e), a = e.position;
|
|
3211
3211
|
let s = 0;
|
|
3212
3212
|
for (; e.position + 24 < e.fileInfo.size && (s++, !(s > fi || Pe(e, a, me))); ) {
|
|
3213
3213
|
const c = e.position, m = await n();
|
|
@@ -3218,7 +3218,7 @@ class wt {
|
|
|
3218
3218
|
}
|
|
3219
3219
|
if (ge(m.id, [145, 7, 220, 183, 183, 169, 207, 17, 142, 230, 0, 192, 12, 32, 83, 101])) {
|
|
3220
3220
|
const l = new Uint8Array(16);
|
|
3221
|
-
if (d -= await
|
|
3221
|
+
if (d -= await ct(e, l, void 0, {
|
|
3222
3222
|
maximumLength: l.length,
|
|
3223
3223
|
reason: "ASF stream type GUID"
|
|
3224
3224
|
}), ge(l, [64, 158, 105, 248, 77, 91, 207, 17, 168, 253, 0, 128, 95, 92, 68, 43]))
|
|
@@ -3246,8 +3246,8 @@ class wt {
|
|
|
3246
3246
|
}
|
|
3247
3247
|
}
|
|
3248
3248
|
} catch (n) {
|
|
3249
|
-
if (n instanceof
|
|
3250
|
-
|
|
3249
|
+
if (n instanceof X || n instanceof Fe)
|
|
3250
|
+
ne(e) && (r = !0);
|
|
3251
3251
|
else
|
|
3252
3252
|
throw n;
|
|
3253
3253
|
}
|
|
@@ -3455,7 +3455,7 @@ class wt {
|
|
|
3455
3455
|
};
|
|
3456
3456
|
});
|
|
3457
3457
|
// Detections with limited supporting data, resulting in a higher likelihood of false positives
|
|
3458
|
-
|
|
3458
|
+
it(this, "detectImprecise", async (e) => {
|
|
3459
3459
|
this.buffer = new Uint8Array(Le);
|
|
3460
3460
|
const r = Ri(e.fileInfo.size);
|
|
3461
3461
|
if (await e.peekBuffer(this.buffer, { length: Math.min(8, r), mayBeLess: !0 }), this.check([0, 0, 1, 186]) || this.check([0, 0, 1, 179]))
|
|
@@ -3503,7 +3503,7 @@ class wt {
|
|
|
3503
3503
|
};
|
|
3504
3504
|
}
|
|
3505
3505
|
createTokenizerFromWebStream(e) {
|
|
3506
|
-
return vi(
|
|
3506
|
+
return vi(Un(e, this.getTokenizerOptions()));
|
|
3507
3507
|
}
|
|
3508
3508
|
async parseTokenizer(e, r = 0) {
|
|
3509
3509
|
this.detectionReentryCount = r;
|
|
@@ -3513,7 +3513,7 @@ class wt {
|
|
|
3513
3513
|
try {
|
|
3514
3514
|
a = await i.detect(e);
|
|
3515
3515
|
} catch (s) {
|
|
3516
|
-
if (s instanceof
|
|
3516
|
+
if (s instanceof X || s instanceof Fe)
|
|
3517
3517
|
return;
|
|
3518
3518
|
throw s;
|
|
3519
3519
|
}
|
|
@@ -3535,7 +3535,7 @@ class wt {
|
|
|
3535
3535
|
throw new TypeError(`Expected the \`input\` argument to be of type \`Uint8Array\` or \`ArrayBuffer\`, got \`${typeof e}\``);
|
|
3536
3536
|
const r = e instanceof Uint8Array ? e : new Uint8Array(e);
|
|
3537
3537
|
if ((r == null ? void 0 : r.length) > 1)
|
|
3538
|
-
return this.fromTokenizer(
|
|
3538
|
+
return this.fromTokenizer(jn(r, this.getTokenizerOptions()));
|
|
3539
3539
|
}
|
|
3540
3540
|
async fromBlob(e) {
|
|
3541
3541
|
var n;
|
|
@@ -3559,7 +3559,7 @@ class wt {
|
|
|
3559
3559
|
try {
|
|
3560
3560
|
i = await this.fromBuffer(d.subarray(0, n));
|
|
3561
3561
|
} catch (u) {
|
|
3562
|
-
if (!(u instanceof
|
|
3562
|
+
if (!(u instanceof X))
|
|
3563
3563
|
throw u;
|
|
3564
3564
|
i = void 0;
|
|
3565
3565
|
}
|
|
@@ -3584,7 +3584,7 @@ class wt {
|
|
|
3584
3584
|
ext: "gz",
|
|
3585
3585
|
mime: "application/gzip"
|
|
3586
3586
|
};
|
|
3587
|
-
const r = new ei(e), n = Ei(r.inflate(), ci), i =
|
|
3587
|
+
const r = new ei(e), n = Ei(r.inflate(), ci), i = ne(e);
|
|
3588
3588
|
let a, s, c, m;
|
|
3589
3589
|
if (i) {
|
|
3590
3590
|
const l = new AbortController();
|
|
@@ -3619,7 +3619,7 @@ class wt {
|
|
|
3619
3619
|
return this.check(ti(e, r == null ? void 0 : r.encoding), r);
|
|
3620
3620
|
}
|
|
3621
3621
|
async readTiffTag(e) {
|
|
3622
|
-
const r = await this.tokenizer.readToken(e ? Ee :
|
|
3622
|
+
const r = await this.tokenizer.readToken(e ? Ee : Z);
|
|
3623
3623
|
switch (await this.tokenizer.ignore(10), r) {
|
|
3624
3624
|
case 50341:
|
|
3625
3625
|
return {
|
|
@@ -3634,8 +3634,8 @@ class wt {
|
|
|
3634
3634
|
}
|
|
3635
3635
|
}
|
|
3636
3636
|
async readTiffIFD(e) {
|
|
3637
|
-
const r = await this.tokenizer.readToken(e ? Ee :
|
|
3638
|
-
if (!(r > pi) && !(
|
|
3637
|
+
const r = await this.tokenizer.readToken(e ? Ee : Z);
|
|
3638
|
+
if (!(r > pi) && !(ne(this.tokenizer) && 2 + r * 12 > qt))
|
|
3639
3639
|
for (let n = 0; n < r; ++n) {
|
|
3640
3640
|
const i = await this.readTiffTag(e);
|
|
3641
3641
|
if (i)
|
|
@@ -3646,7 +3646,7 @@ class wt {
|
|
|
3646
3646
|
const r = {
|
|
3647
3647
|
ext: "tif",
|
|
3648
3648
|
mime: "image/tiff"
|
|
3649
|
-
}, n = (e ? Ee :
|
|
3649
|
+
}, n = (e ? Ee : Z).get(this.buffer, 2), i = (e ? It : H).get(this.buffer, 4);
|
|
3650
3650
|
if (n === 42) {
|
|
3651
3651
|
if (i >= 6) {
|
|
3652
3652
|
if (this.checkString("CR", { offset: 8 }))
|
|
@@ -3655,7 +3655,7 @@ class wt {
|
|
|
3655
3655
|
mime: "image/x-canon-cr2"
|
|
3656
3656
|
};
|
|
3657
3657
|
if (i >= 8) {
|
|
3658
|
-
const c = (e ? Ee :
|
|
3658
|
+
const c = (e ? Ee : Z).get(this.buffer, 8), m = (e ? Ee : Z).get(this.buffer, 10);
|
|
3659
3659
|
if (c === 28 && m === 254 || c === 31 && m === 11)
|
|
3660
3660
|
return {
|
|
3661
3661
|
ext: "nef",
|
|
@@ -3663,16 +3663,16 @@ class wt {
|
|
|
3663
3663
|
};
|
|
3664
3664
|
}
|
|
3665
3665
|
}
|
|
3666
|
-
if (
|
|
3666
|
+
if (ne(this.tokenizer) && i > hi)
|
|
3667
3667
|
return r;
|
|
3668
|
-
const a =
|
|
3668
|
+
const a = ne(this.tokenizer) ? qt : this.tokenizer.fileInfo.size;
|
|
3669
3669
|
try {
|
|
3670
3670
|
await Ce(this.tokenizer, i, {
|
|
3671
3671
|
maximumLength: a,
|
|
3672
3672
|
reason: "TIFF IFD offset"
|
|
3673
3673
|
});
|
|
3674
3674
|
} catch (c) {
|
|
3675
|
-
if (c instanceof
|
|
3675
|
+
if (c instanceof X)
|
|
3676
3676
|
return;
|
|
3677
3677
|
throw c;
|
|
3678
3678
|
}
|
|
@@ -3680,7 +3680,7 @@ class wt {
|
|
|
3680
3680
|
try {
|
|
3681
3681
|
s = await this.readTiffIFD(e);
|
|
3682
3682
|
} catch (c) {
|
|
3683
|
-
if (c instanceof
|
|
3683
|
+
if (c instanceof X)
|
|
3684
3684
|
return;
|
|
3685
3685
|
throw c;
|
|
3686
3686
|
}
|
|
@@ -3733,26 +3733,26 @@ const Kt = (t) => t < 1024 ? `${t} B` : t < 1024 * 1024 ? `${(t / 1024).toFixed(
|
|
|
3733
3733
|
fileTypes: i,
|
|
3734
3734
|
maxFileSize: a
|
|
3735
3735
|
}) => {
|
|
3736
|
-
var
|
|
3737
|
-
const { field: s, fieldState: c } =
|
|
3736
|
+
var D;
|
|
3737
|
+
const { field: s, fieldState: c } = V({ name: t, control: e }), { uploadFile: m, deleteUploadedFile: d, onUploadStart: l, onUploadEnd: u } = ke(), [p, h] = j({
|
|
3738
3738
|
status: "idle"
|
|
3739
|
-
}), g = Y(null), [
|
|
3739
|
+
}), g = Y(null), [F, w] = j(!1), v = Y(!0), b = Y(l);
|
|
3740
3740
|
b.current = l;
|
|
3741
3741
|
const x = Y(u);
|
|
3742
|
-
x.current = u,
|
|
3742
|
+
x.current = u, Q(
|
|
3743
3743
|
() => () => {
|
|
3744
3744
|
v.current = !1;
|
|
3745
3745
|
},
|
|
3746
3746
|
[]
|
|
3747
3747
|
);
|
|
3748
|
-
const
|
|
3749
|
-
async (
|
|
3750
|
-
var
|
|
3748
|
+
const k = typeof s.value == "string" && s.value ? s.value : null, R = J(
|
|
3749
|
+
async (N) => {
|
|
3750
|
+
var I, L, _;
|
|
3751
3751
|
if (i && i.length > 0) {
|
|
3752
|
-
const
|
|
3752
|
+
const $ = await Ai(N), z = ($ == null ? void 0 : $.ext) ?? "", ee = ($ == null ? void 0 : $.mime) ?? "", B = ((I = N.name.split(".").pop()) == null ? void 0 : I.toLowerCase()) ?? "", U = N.type.toLowerCase();
|
|
3753
3753
|
if (!i.some((Ne) => {
|
|
3754
3754
|
const ce = Ne.toLowerCase();
|
|
3755
|
-
return !!(
|
|
3755
|
+
return !!(z && (ce === z || ce === ee) || ee && ce.endsWith("/*") && ee.startsWith(ce.slice(0, -1)) || !z && (ce === B || ce === U || ce.endsWith("/*") && U.startsWith(ce.slice(0, -1))));
|
|
3756
3756
|
})) {
|
|
3757
3757
|
h({
|
|
3758
3758
|
status: "error",
|
|
@@ -3761,7 +3761,7 @@ const Kt = (t) => t < 1024 ? `${t} B` : t < 1024 * 1024 ? `${(t / 1024).toFixed(
|
|
|
3761
3761
|
return;
|
|
3762
3762
|
}
|
|
3763
3763
|
}
|
|
3764
|
-
if (a &&
|
|
3764
|
+
if (a && N.size > a) {
|
|
3765
3765
|
h({
|
|
3766
3766
|
status: "error",
|
|
3767
3767
|
message: `Arquivo muito grande. Tamanho máximo: ${Kt(a)}`
|
|
@@ -3775,24 +3775,24 @@ const Kt = (t) => t < 1024 ? `${t} B` : t < 1024 * 1024 ? `${(t / 1024).toFixed(
|
|
|
3775
3775
|
});
|
|
3776
3776
|
return;
|
|
3777
3777
|
}
|
|
3778
|
-
h({ status: "uploading", fileName:
|
|
3778
|
+
h({ status: "uploading", fileName: N.name, progress: 0 }), (L = b.current) == null || L.call(b);
|
|
3779
3779
|
try {
|
|
3780
|
-
if (
|
|
3780
|
+
if (k && d)
|
|
3781
3781
|
try {
|
|
3782
|
-
await d(
|
|
3782
|
+
await d(k);
|
|
3783
3783
|
} catch {
|
|
3784
3784
|
}
|
|
3785
|
-
const
|
|
3785
|
+
const $ = await m(N, n ?? t, (z) => {
|
|
3786
3786
|
v.current && h(
|
|
3787
|
-
(
|
|
3787
|
+
(ee) => ee.status === "uploading" ? { ...ee, progress: Math.min(100, z) } : ee
|
|
3788
3788
|
);
|
|
3789
3789
|
});
|
|
3790
3790
|
if (!v.current) return;
|
|
3791
|
-
s.onChange(
|
|
3791
|
+
s.onChange($), h({
|
|
3792
3792
|
status: "done",
|
|
3793
|
-
uploadId:
|
|
3794
|
-
fileName:
|
|
3795
|
-
size:
|
|
3793
|
+
uploadId: $,
|
|
3794
|
+
fileName: N.name,
|
|
3795
|
+
size: N.size
|
|
3796
3796
|
});
|
|
3797
3797
|
} catch {
|
|
3798
3798
|
if (!v.current) return;
|
|
@@ -3801,36 +3801,36 @@ const Kt = (t) => t < 1024 ? `${t} B` : t < 1024 * 1024 ? `${(t / 1024).toFixed(
|
|
|
3801
3801
|
message: "Falha no upload. Tente novamente."
|
|
3802
3802
|
});
|
|
3803
3803
|
} finally {
|
|
3804
|
-
v.current && ((
|
|
3804
|
+
v.current && ((_ = x.current) == null || _.call(x));
|
|
3805
3805
|
}
|
|
3806
3806
|
},
|
|
3807
3807
|
[
|
|
3808
3808
|
m,
|
|
3809
3809
|
d,
|
|
3810
|
-
|
|
3810
|
+
k,
|
|
3811
3811
|
n,
|
|
3812
3812
|
t,
|
|
3813
3813
|
s,
|
|
3814
3814
|
i,
|
|
3815
3815
|
a
|
|
3816
3816
|
]
|
|
3817
|
-
), E =
|
|
3818
|
-
(
|
|
3819
|
-
var
|
|
3820
|
-
const
|
|
3821
|
-
|
|
3817
|
+
), E = J(
|
|
3818
|
+
(N) => {
|
|
3819
|
+
var L;
|
|
3820
|
+
const I = (L = N.target.files) == null ? void 0 : L[0];
|
|
3821
|
+
I && R(I), N.target.value = "";
|
|
3822
3822
|
},
|
|
3823
3823
|
[R]
|
|
3824
|
-
),
|
|
3825
|
-
var
|
|
3826
|
-
|
|
3824
|
+
), T = J(() => {
|
|
3825
|
+
var N;
|
|
3826
|
+
k && d && ((N = b.current) == null || N.call(b), d(k).catch(() => {
|
|
3827
3827
|
}).finally(() => {
|
|
3828
|
-
var
|
|
3829
|
-
(
|
|
3828
|
+
var I;
|
|
3829
|
+
(I = x.current) == null || I.call(x);
|
|
3830
3830
|
})), s.onChange(""), h({ status: "idle" }), g.current && (g.current.value = "");
|
|
3831
|
-
}, [s,
|
|
3832
|
-
if (p.status === "done" || p.status === "idle" && !!
|
|
3833
|
-
const
|
|
3831
|
+
}, [s, k, d]);
|
|
3832
|
+
if (p.status === "done" || p.status === "idle" && !!k) {
|
|
3833
|
+
const N = p.status === "done" ? p.fileName : "Arquivo enviado", I = p.status === "done" ? p.size : null;
|
|
3834
3834
|
return /* @__PURE__ */ f("div", { className: "flex items-center justify-between rounded-lg border border-green-500 bg-green-500/5 px-4 py-3 gap-2", children: [
|
|
3835
3835
|
/* @__PURE__ */ f(
|
|
3836
3836
|
"svg",
|
|
@@ -3866,13 +3866,13 @@ const Kt = (t) => t < 1024 ? `${t} B` : t < 1024 * 1024 ? `${(t / 1024).toFixed(
|
|
|
3866
3866
|
]
|
|
3867
3867
|
}
|
|
3868
3868
|
),
|
|
3869
|
-
/* @__PURE__ */ o("span", { className: "text-sm font-medium truncate flex-1", children:
|
|
3870
|
-
|
|
3869
|
+
/* @__PURE__ */ o("span", { className: "text-sm font-medium truncate flex-1", children: N }),
|
|
3870
|
+
I !== null && /* @__PURE__ */ o("span", { className: "text-xs text-muted-foreground shrink-0", children: Kt(I) }),
|
|
3871
3871
|
!r && /* @__PURE__ */ o(
|
|
3872
3872
|
"button",
|
|
3873
3873
|
{
|
|
3874
3874
|
type: "button",
|
|
3875
|
-
onClick:
|
|
3875
|
+
onClick: T,
|
|
3876
3876
|
className: "ml-2 shrink-0 text-muted-foreground hover:text-destructive transition-colors",
|
|
3877
3877
|
"aria-label": "Remover arquivo",
|
|
3878
3878
|
children: "✕"
|
|
@@ -3881,12 +3881,12 @@ const Kt = (t) => t < 1024 ? `${t} B` : t < 1024 * 1024 ? `${(t / 1024).toFixed(
|
|
|
3881
3881
|
] });
|
|
3882
3882
|
}
|
|
3883
3883
|
if (p.status === "uploading") {
|
|
3884
|
-
const { fileName:
|
|
3884
|
+
const { fileName: N, progress: I } = p;
|
|
3885
3885
|
return /* @__PURE__ */ f("div", { className: "rounded-lg border border-input px-4 py-3 space-y-2", children: [
|
|
3886
3886
|
/* @__PURE__ */ f("div", { className: "flex items-center justify-between", children: [
|
|
3887
|
-
/* @__PURE__ */ o("span", { className: "text-sm font-medium truncate flex-1", children:
|
|
3887
|
+
/* @__PURE__ */ o("span", { className: "text-sm font-medium truncate flex-1", children: N }),
|
|
3888
3888
|
/* @__PURE__ */ f("span", { className: "text-xs text-muted-foreground ml-2", children: [
|
|
3889
|
-
|
|
3889
|
+
I,
|
|
3890
3890
|
"%"
|
|
3891
3891
|
] })
|
|
3892
3892
|
] }),
|
|
@@ -3894,12 +3894,12 @@ const Kt = (t) => t < 1024 ? `${t} B` : t < 1024 * 1024 ? `${(t / 1024).toFixed(
|
|
|
3894
3894
|
"div",
|
|
3895
3895
|
{
|
|
3896
3896
|
className: "h-full bg-primary transition-all duration-200 rounded-full",
|
|
3897
|
-
style: { width: `${
|
|
3897
|
+
style: { width: `${I}%` }
|
|
3898
3898
|
}
|
|
3899
3899
|
) })
|
|
3900
3900
|
] });
|
|
3901
3901
|
}
|
|
3902
|
-
const
|
|
3902
|
+
const S = p.status === "error";
|
|
3903
3903
|
return /* @__PURE__ */ f("div", { className: "space-y-1", children: [
|
|
3904
3904
|
/* @__PURE__ */ f(
|
|
3905
3905
|
"div",
|
|
@@ -3907,28 +3907,28 @@ const Kt = (t) => t < 1024 ? `${t} B` : t < 1024 * 1024 ? `${(t / 1024).toFixed(
|
|
|
3907
3907
|
role: "button",
|
|
3908
3908
|
tabIndex: r ? -1 : 0,
|
|
3909
3909
|
"aria-label": "Selecionar arquivo",
|
|
3910
|
-
className:
|
|
3910
|
+
className: O(
|
|
3911
3911
|
"flex items-center justify-center rounded-lg border-2 border-dashed px-4 py-6 transition-colors cursor-pointer",
|
|
3912
|
-
|
|
3912
|
+
F ? "border-primary bg-primary/5" : S || c.error ? "border-destructive bg-destructive/5" : "border-input hover:border-muted-foreground hover:bg-muted/20",
|
|
3913
3913
|
r && "opacity-50 cursor-not-allowed"
|
|
3914
3914
|
),
|
|
3915
3915
|
onClick: () => {
|
|
3916
|
-
var
|
|
3917
|
-
return !r && ((
|
|
3916
|
+
var N;
|
|
3917
|
+
return !r && ((N = g.current) == null ? void 0 : N.click());
|
|
3918
3918
|
},
|
|
3919
|
-
onKeyDown: (
|
|
3920
|
-
var
|
|
3921
|
-
(
|
|
3919
|
+
onKeyDown: (N) => {
|
|
3920
|
+
var I;
|
|
3921
|
+
(N.key === "Enter" || N.key === " ") && ((I = g.current) == null || I.click());
|
|
3922
3922
|
},
|
|
3923
|
-
onDragOver: (
|
|
3924
|
-
|
|
3923
|
+
onDragOver: (N) => {
|
|
3924
|
+
N.preventDefault(), r || w(!0);
|
|
3925
3925
|
},
|
|
3926
3926
|
onDragLeave: () => w(!1),
|
|
3927
|
-
onDrop: r ? void 0 : (
|
|
3928
|
-
var
|
|
3929
|
-
|
|
3930
|
-
const
|
|
3931
|
-
|
|
3927
|
+
onDrop: r ? void 0 : (N) => {
|
|
3928
|
+
var L;
|
|
3929
|
+
N.preventDefault(), w(!1);
|
|
3930
|
+
const I = (L = N.dataTransfer.files) == null ? void 0 : L[0];
|
|
3931
|
+
I && R(I);
|
|
3932
3932
|
},
|
|
3933
3933
|
onBlur: s.onBlur,
|
|
3934
3934
|
children: [
|
|
@@ -3942,11 +3942,11 @@ const Kt = (t) => t < 1024 ? `${t} B` : t < 1024 * 1024 ? `${(t / 1024).toFixed(
|
|
|
3942
3942
|
className: "sr-only"
|
|
3943
3943
|
}
|
|
3944
3944
|
),
|
|
3945
|
-
/* @__PURE__ */ o("span", { className: "text-sm text-muted-foreground", children:
|
|
3945
|
+
/* @__PURE__ */ o("span", { className: "text-sm text-muted-foreground", children: F ? "Solte o arquivo aqui" : "Clique ou arraste um arquivo" })
|
|
3946
3946
|
]
|
|
3947
3947
|
}
|
|
3948
3948
|
),
|
|
3949
|
-
|
|
3949
|
+
S && /* @__PURE__ */ f("p", { className: "text-sm text-destructive", children: [
|
|
3950
3950
|
p.message,
|
|
3951
3951
|
" · ",
|
|
3952
3952
|
/* @__PURE__ */ o(
|
|
@@ -3959,7 +3959,7 @@ const Kt = (t) => t < 1024 ? `${t} B` : t < 1024 * 1024 ? `${(t / 1024).toFixed(
|
|
|
3959
3959
|
}
|
|
3960
3960
|
)
|
|
3961
3961
|
] }),
|
|
3962
|
-
!
|
|
3962
|
+
!S && ((D = c.error) == null ? void 0 : D.message) && /* @__PURE__ */ o("p", { className: "text-sm text-destructive", children: c.error.message })
|
|
3963
3963
|
] });
|
|
3964
3964
|
}, Mi = {
|
|
3965
3965
|
cpf: (t) => t.replace(/\D/g, "").slice(0, 11).replace(/(\d{3})(\d)/, "$1.$2").replace(/(\d{3})(\d)/, "$1.$2").replace(/(\d{3})(\d{1,2})$/, "$1-$2"),
|
|
@@ -3977,7 +3977,7 @@ const Kt = (t) => t < 1024 ? `${t} B` : t < 1024 * 1024 ? `${(t / 1024).toFixed(
|
|
|
3977
3977
|
readOnly: a
|
|
3978
3978
|
}) => {
|
|
3979
3979
|
var l;
|
|
3980
|
-
const { field: s, fieldState: c } =
|
|
3980
|
+
const { field: s, fieldState: c } = V({ name: t, control: e }), m = Mi[n || ""], d = J(
|
|
3981
3981
|
(u) => {
|
|
3982
3982
|
s.onChange(m ? m(u.target.value) : u.target.value);
|
|
3983
3983
|
},
|
|
@@ -3994,7 +3994,7 @@ const Kt = (t) => t < 1024 ? `${t} B` : t < 1024 * 1024 ? `${(t / 1024).toFixed(
|
|
|
3994
3994
|
placeholder: r,
|
|
3995
3995
|
disabled: i,
|
|
3996
3996
|
readOnly: a,
|
|
3997
|
-
className:
|
|
3997
|
+
className: O(
|
|
3998
3998
|
c.error && "border-destructive focus-visible:ring-destructive"
|
|
3999
3999
|
)
|
|
4000
4000
|
}
|
|
@@ -4002,12 +4002,12 @@ const Kt = (t) => t < 1024 ? `${t} B` : t < 1024 * 1024 ? `${(t / 1024).toFixed(
|
|
|
4002
4002
|
((l = c.error) == null ? void 0 : l.message) && /* @__PURE__ */ o("p", { className: "text-sm text-destructive", children: c.error.message })
|
|
4003
4003
|
] });
|
|
4004
4004
|
}, Ct = ({ name: t, control: e }) => {
|
|
4005
|
-
const { field: r } =
|
|
4005
|
+
const { field: r } = V({ name: t, control: e });
|
|
4006
4006
|
return /* @__PURE__ */ o("input", { type: "hidden", ...r, value: r.value ?? "" });
|
|
4007
|
-
}, yr = (t) => t.replace(/\D/g, ""),
|
|
4007
|
+
}, yr = (t) => t.replace(/\D/g, ""), Ui = (t) => {
|
|
4008
4008
|
const e = yr(t).slice(0, 8);
|
|
4009
4009
|
return e.length <= 5 ? e : `${e.slice(0, 5)}-${e.slice(5)}`;
|
|
4010
|
-
},
|
|
4010
|
+
}, ji = async (t, e) => {
|
|
4011
4011
|
const r = await fetch(`https://viacep.com.br/ws/${t}/json/`, { signal: e });
|
|
4012
4012
|
if (!r.ok) throw new Error("Falha ao consultar CEP");
|
|
4013
4013
|
return r.json();
|
|
@@ -4020,58 +4020,58 @@ const Kt = (t) => t < 1024 ? `${t} B` : t < 1024 * 1024 ? `${(t / 1024).toFixed(
|
|
|
4020
4020
|
cepFillMap: a
|
|
4021
4021
|
}) => {
|
|
4022
4022
|
var b, x;
|
|
4023
|
-
const { field: s, fieldState: c } =
|
|
4024
|
-
|
|
4023
|
+
const { field: s, fieldState: c } = V({ name: t, control: e }), { setValue: m } = et(), { cepLookup: d } = ke(), [l, u] = j("idle"), [p, h] = j(null), g = Y(null), F = Y(!0);
|
|
4024
|
+
Q(
|
|
4025
4025
|
() => () => {
|
|
4026
|
-
var
|
|
4027
|
-
|
|
4026
|
+
var k;
|
|
4027
|
+
F.current = !1, (k = g.current) == null || k.abort();
|
|
4028
4028
|
},
|
|
4029
4029
|
[]
|
|
4030
4030
|
);
|
|
4031
|
-
const w =
|
|
4031
|
+
const w = J(async () => {
|
|
4032
4032
|
var R;
|
|
4033
4033
|
s.onBlur();
|
|
4034
|
-
const
|
|
4035
|
-
if (
|
|
4034
|
+
const k = yr(s.value ?? "");
|
|
4035
|
+
if (k.length === 8) {
|
|
4036
4036
|
(R = g.current) == null || R.abort(), g.current = new AbortController(), u("loading"), h(null);
|
|
4037
4037
|
try {
|
|
4038
4038
|
let E;
|
|
4039
4039
|
if (d) {
|
|
4040
|
-
const
|
|
4041
|
-
if (E = await d(
|
|
4040
|
+
const S = g.current;
|
|
4041
|
+
if (E = await d(k, S.signal), S.signal.aborted || !F.current) return;
|
|
4042
4042
|
} else {
|
|
4043
|
-
const
|
|
4044
|
-
if (!
|
|
4045
|
-
if (
|
|
4043
|
+
const S = await ji(k, g.current.signal);
|
|
4044
|
+
if (!F.current) return;
|
|
4045
|
+
if (S.erro) {
|
|
4046
4046
|
u("error"), h("CEP não encontrado");
|
|
4047
4047
|
return;
|
|
4048
4048
|
}
|
|
4049
4049
|
E = {
|
|
4050
|
-
logradouro:
|
|
4051
|
-
bairro:
|
|
4052
|
-
cidade:
|
|
4053
|
-
estado:
|
|
4050
|
+
logradouro: S.logradouro,
|
|
4051
|
+
bairro: S.bairro,
|
|
4052
|
+
cidade: S.localidade,
|
|
4053
|
+
estado: S.uf
|
|
4054
4054
|
};
|
|
4055
4055
|
}
|
|
4056
|
-
if (!
|
|
4056
|
+
if (!F.current) return;
|
|
4057
4057
|
if (E.erro) {
|
|
4058
4058
|
u("error"), h("CEP não encontrado");
|
|
4059
4059
|
return;
|
|
4060
4060
|
}
|
|
4061
|
-
const
|
|
4062
|
-
if (!
|
|
4063
|
-
const
|
|
4064
|
-
m(
|
|
4061
|
+
const T = t.includes(".") ? `${t.substring(0, t.lastIndexOf("."))}.` : "", C = (S, D, N) => {
|
|
4062
|
+
if (!N) return;
|
|
4063
|
+
const I = a != null && a[S] ? `${T}${a[S]}` : `${T}${D}`;
|
|
4064
|
+
m(I, N, { shouldDirty: !0, shouldValidate: !0 });
|
|
4065
4065
|
};
|
|
4066
|
-
|
|
4066
|
+
C("logradouro", "_address_logradouro", E.logradouro), C("bairro", "_address_bairro", E.bairro), C("cidade", "_address_cidade", E.cidade), C("estado", "_address_estado", E.estado), u("success");
|
|
4067
4067
|
} catch (E) {
|
|
4068
|
-
if (E instanceof Error && E.name === "AbortError" || !
|
|
4068
|
+
if (E instanceof Error && E.name === "AbortError" || !F.current) return;
|
|
4069
4069
|
u("error"), h("Erro ao buscar CEP");
|
|
4070
4070
|
}
|
|
4071
4071
|
}
|
|
4072
|
-
}, [s, d, m, t, a]), v =
|
|
4073
|
-
(
|
|
4074
|
-
s.onChange(
|
|
4072
|
+
}, [s, d, m, t, a]), v = J(
|
|
4073
|
+
(k) => {
|
|
4074
|
+
s.onChange(Ui(k.target.value));
|
|
4075
4075
|
},
|
|
4076
4076
|
[s]
|
|
4077
4077
|
);
|
|
@@ -4087,16 +4087,16 @@ const Kt = (t) => t < 1024 ? `${t} B` : t < 1024 * 1024 ? `${(t / 1024).toFixed(
|
|
|
4087
4087
|
placeholder: r,
|
|
4088
4088
|
disabled: n,
|
|
4089
4089
|
readOnly: i,
|
|
4090
|
-
className:
|
|
4090
|
+
className: O(
|
|
4091
4091
|
"pr-9",
|
|
4092
4092
|
c.error && "border-destructive focus-visible:ring-destructive"
|
|
4093
4093
|
)
|
|
4094
4094
|
}
|
|
4095
4095
|
),
|
|
4096
4096
|
/* @__PURE__ */ f("div", { className: "absolute right-3 top-1/2 -translate-y-1/2 pointer-events-none", children: [
|
|
4097
|
-
l === "loading" && /* @__PURE__ */ o(
|
|
4097
|
+
l === "loading" && /* @__PURE__ */ o(ze, { className: "h-4 w-4 animate-spin text-muted-foreground" }),
|
|
4098
4098
|
l === "success" && /* @__PURE__ */ o(Be, { className: "h-4 w-4 text-green-500" }),
|
|
4099
|
-
l === "error" && /* @__PURE__ */ o(
|
|
4099
|
+
l === "error" && /* @__PURE__ */ o(Xe, { className: "h-4 w-4 text-destructive" })
|
|
4100
4100
|
] })
|
|
4101
4101
|
] }),
|
|
4102
4102
|
(((b = c.error) == null ? void 0 : b.message) || p) && /* @__PURE__ */ o("p", { className: "text-sm text-destructive", children: ((x = c.error) == null ? void 0 : x.message) || p })
|
|
@@ -4129,9 +4129,9 @@ const Kt = (t) => t < 1024 ? `${t} B` : t < 1024 * 1024 ? `${(t / 1024).toFixed(
|
|
|
4129
4129
|
case y.CHECKBOX_GROUP:
|
|
4130
4130
|
return /* @__PURE__ */ o(ur, { ...n, options: t.opcoes ?? [] });
|
|
4131
4131
|
case y.DATE:
|
|
4132
|
-
return /* @__PURE__ */ o(
|
|
4132
|
+
return /* @__PURE__ */ o(Me, { ...n, validacao: t.validacao });
|
|
4133
4133
|
case y.DATETIME:
|
|
4134
|
-
return /* @__PURE__ */ o(
|
|
4134
|
+
return /* @__PURE__ */ o(Me, { ...n, isDatetime: !0, validacao: t.validacao });
|
|
4135
4135
|
case y.FILE:
|
|
4136
4136
|
return /* @__PURE__ */ o(vr, { name: r, control: e });
|
|
4137
4137
|
case y.TELEFONE:
|
|
@@ -4167,18 +4167,18 @@ const Kt = (t) => t < 1024 ? `${t} B` : t < 1024 * 1024 ? `${(t / 1024).toFixed(
|
|
|
4167
4167
|
const { fields: c, append: m, remove: d } = ar({
|
|
4168
4168
|
control: e,
|
|
4169
4169
|
name: t
|
|
4170
|
-
}), { errors: l } = Br({ control: e }), u = (w = l[t]) == null ? void 0 : w.message, p =
|
|
4170
|
+
}), { errors: l } = Br({ control: e }), u = (w = l[t]) == null ? void 0 : w.message, p = J(() => {
|
|
4171
4171
|
const v = {};
|
|
4172
4172
|
for (const b of r)
|
|
4173
4173
|
b.initialValue !== void 0 ? v[b.nome] = b.initialValue : b.defaultValue !== void 0 && (v[b.nome] = b.defaultValue);
|
|
4174
4174
|
return v;
|
|
4175
4175
|
}, [r]);
|
|
4176
|
-
|
|
4176
|
+
Q(() => {
|
|
4177
4177
|
if (c.length < n)
|
|
4178
4178
|
for (let v = c.length; v < n; v++)
|
|
4179
4179
|
m(p());
|
|
4180
4180
|
}, [n]);
|
|
4181
|
-
const h = [...r].sort((v, b) => v.ordem - b.ordem), g = !i || c.length < i,
|
|
4181
|
+
const h = [...r].sort((v, b) => v.ordem - b.ordem), g = !i || c.length < i, F = s ?? `Adicionar ${a.toLowerCase()}`;
|
|
4182
4182
|
return /* @__PURE__ */ f("div", { className: "space-y-3", children: [
|
|
4183
4183
|
c.map((v, b) => /* @__PURE__ */ f(
|
|
4184
4184
|
"div",
|
|
@@ -4196,7 +4196,7 @@ const Kt = (t) => t < 1024 ? `${t} B` : t < 1024 * 1024 ? `${(t / 1024).toFixed(
|
|
|
4196
4196
|
] })
|
|
4197
4197
|
] }),
|
|
4198
4198
|
c.length > n && /* @__PURE__ */ o(
|
|
4199
|
-
|
|
4199
|
+
$e,
|
|
4200
4200
|
{
|
|
4201
4201
|
type: "button",
|
|
4202
4202
|
variant: "ghost",
|
|
@@ -4209,12 +4209,12 @@ const Kt = (t) => t < 1024 ? `${t} B` : t < 1024 * 1024 ? `${(t / 1024).toFixed(
|
|
|
4209
4209
|
)
|
|
4210
4210
|
] }),
|
|
4211
4211
|
/* @__PURE__ */ o("div", { className: "grid grid-cols-12 gap-4", children: h.map((x) => {
|
|
4212
|
-
const
|
|
4212
|
+
const k = `${t}.${b}.${x.nome}`, E = `span ${x.tamanho ?? 12}`, T = /* @__PURE__ */ o(
|
|
4213
4213
|
Vi,
|
|
4214
4214
|
{
|
|
4215
4215
|
field: x,
|
|
4216
4216
|
control: e,
|
|
4217
|
-
nameOverride:
|
|
4217
|
+
nameOverride: k
|
|
4218
4218
|
}
|
|
4219
4219
|
);
|
|
4220
4220
|
return x.tipo === y.CHECKBOX || x.tipo === y.HIDDEN ? /* @__PURE__ */ o(
|
|
@@ -4222,7 +4222,7 @@ const Kt = (t) => t < 1024 ? `${t} B` : t < 1024 * 1024 ? `${(t / 1024).toFixed(
|
|
|
4222
4222
|
{
|
|
4223
4223
|
className: "max-sm:!col-span-12",
|
|
4224
4224
|
style: { gridColumn: E },
|
|
4225
|
-
children:
|
|
4225
|
+
children: T
|
|
4226
4226
|
},
|
|
4227
4227
|
x.id
|
|
4228
4228
|
) : /* @__PURE__ */ f(
|
|
@@ -4235,7 +4235,7 @@ const Kt = (t) => t < 1024 ? `${t} B` : t < 1024 * 1024 ? `${(t / 1024).toFixed(
|
|
|
4235
4235
|
x.label,
|
|
4236
4236
|
x.obrigatorio && /* @__PURE__ */ o("span", { className: "text-destructive", children: "*" })
|
|
4237
4237
|
] }),
|
|
4238
|
-
|
|
4238
|
+
T,
|
|
4239
4239
|
x.hint && /* @__PURE__ */ o("p", { className: "text-xs text-muted-foreground", children: x.hint })
|
|
4240
4240
|
]
|
|
4241
4241
|
},
|
|
@@ -4247,7 +4247,7 @@ const Kt = (t) => t < 1024 ? `${t} B` : t < 1024 * 1024 ? `${(t / 1024).toFixed(
|
|
|
4247
4247
|
v.id
|
|
4248
4248
|
)),
|
|
4249
4249
|
g && /* @__PURE__ */ f(
|
|
4250
|
-
|
|
4250
|
+
$e,
|
|
4251
4251
|
{
|
|
4252
4252
|
type: "button",
|
|
4253
4253
|
variant: "outline",
|
|
@@ -4255,7 +4255,7 @@ const Kt = (t) => t < 1024 ? `${t} B` : t < 1024 * 1024 ? `${(t / 1024).toFixed(
|
|
|
4255
4255
|
onClick: () => m(p()),
|
|
4256
4256
|
children: [
|
|
4257
4257
|
/* @__PURE__ */ o(or, { className: "w-4 h-4" }),
|
|
4258
|
-
|
|
4258
|
+
F
|
|
4259
4259
|
]
|
|
4260
4260
|
}
|
|
4261
4261
|
),
|
|
@@ -4267,7 +4267,7 @@ const Kt = (t) => t < 1024 ? `${t} B` : t < 1024 * 1024 ? `${(t / 1024).toFixed(
|
|
|
4267
4267
|
i > 1 ? "s" : ""
|
|
4268
4268
|
] }),
|
|
4269
4269
|
u && /* @__PURE__ */ f("p", { className: "text-sm text-destructive flex items-center gap-1", children: [
|
|
4270
|
-
/* @__PURE__ */ o(
|
|
4270
|
+
/* @__PURE__ */ o(Xe, { className: "w-4 h-4 shrink-0" }),
|
|
4271
4271
|
u
|
|
4272
4272
|
] })
|
|
4273
4273
|
] });
|
|
@@ -4293,83 +4293,83 @@ const Kt = (t) => t < 1024 ? `${t} B` : t < 1024 * 1024 ? `${(t / 1024).toFixed(
|
|
|
4293
4293
|
};
|
|
4294
4294
|
return `${r(t)} a ${r(e)}`;
|
|
4295
4295
|
}, Gi = ({ name: t, control: e }) => {
|
|
4296
|
-
var
|
|
4297
|
-
const { field: r, fieldState: n } =
|
|
4296
|
+
var ee;
|
|
4297
|
+
const { field: r, fieldState: n } = V({ name: t, control: e }), { externalData: i = {} } = ke(), a = r.value ?? null, s = (ee = n.error) == null ? void 0 : ee.message, c = (B) => i[`evento.${B}`] ?? i[B], m = c("dataInicioEvento") ?? "", d = c("dataFimEvento") ?? "", l = Number(c("valor") ?? 0), u = Number(c("valorPorDia") ?? 0), p = c("vagasTotal"), h = c("vagasPorDia"), g = c("vagasMasculinas"), F = c("vagasFemininas"), w = p != null ? Number(p) : null, v = h != null ? Number(h) : null, b = g != null ? Number(g) : null, x = F != null ? Number(F) : null, { dias: k, eventoMultiDia: R } = M(() => {
|
|
4298
4298
|
if (!m || !d) return { dias: [], eventoMultiDia: !1 };
|
|
4299
|
-
const
|
|
4300
|
-
return { dias:
|
|
4301
|
-
}, [m, d]), E =
|
|
4299
|
+
const B = qi(m, d), U = Wi(m, d);
|
|
4300
|
+
return { dias: B, eventoMultiDia: U > 1 };
|
|
4301
|
+
}, [m, d]), E = M(
|
|
4302
4302
|
() => b != null && b > 0 && x != null && x > 0,
|
|
4303
4303
|
[b, x]
|
|
4304
|
-
),
|
|
4304
|
+
), T = M(
|
|
4305
4305
|
() => b != null && x == null ? "masculino" : x != null && b == null ? "feminino" : null,
|
|
4306
4306
|
[b, x]
|
|
4307
|
-
),
|
|
4308
|
-
|
|
4309
|
-
const
|
|
4310
|
-
|
|
4311
|
-
var
|
|
4312
|
-
|
|
4313
|
-
tipo: ((
|
|
4314
|
-
data: ((ue =
|
|
4315
|
-
genero:
|
|
4307
|
+
), C = (a == null ? void 0 : a.tipo) ?? null, S = (a == null ? void 0 : a.data) ?? null, D = (a == null ? void 0 : a.genero) ?? null, N = Y(a);
|
|
4308
|
+
N.current = a;
|
|
4309
|
+
const I = Y(r.onChange);
|
|
4310
|
+
I.current = r.onChange, Q(() => {
|
|
4311
|
+
var B, U, ue;
|
|
4312
|
+
T && ((B = N.current) == null ? void 0 : B.genero) !== T && I.current({
|
|
4313
|
+
tipo: ((U = N.current) == null ? void 0 : U.tipo) ?? null,
|
|
4314
|
+
data: ((ue = N.current) == null ? void 0 : ue.data) ?? null,
|
|
4315
|
+
genero: T
|
|
4316
4316
|
});
|
|
4317
|
-
}, [
|
|
4318
|
-
const
|
|
4319
|
-
(
|
|
4320
|
-
const
|
|
4321
|
-
(E ||
|
|
4317
|
+
}, [T]);
|
|
4318
|
+
const L = J(
|
|
4319
|
+
(B) => {
|
|
4320
|
+
const U = { tipo: B, data: null };
|
|
4321
|
+
(E || T) && (U.genero = D ?? T ?? void 0), r.onChange(U);
|
|
4322
4322
|
},
|
|
4323
|
-
[r, E,
|
|
4324
|
-
),
|
|
4325
|
-
(
|
|
4326
|
-
const
|
|
4327
|
-
(E ||
|
|
4323
|
+
[r, E, T, D]
|
|
4324
|
+
), _ = J(
|
|
4325
|
+
(B) => {
|
|
4326
|
+
const U = { tipo: "por_dia", data: B };
|
|
4327
|
+
(E || T) && (U.genero = D ?? T ?? void 0), r.onChange(U);
|
|
4328
4328
|
},
|
|
4329
|
-
[r, E,
|
|
4330
|
-
),
|
|
4331
|
-
(
|
|
4332
|
-
r.onChange({ tipo:
|
|
4329
|
+
[r, E, T, D]
|
|
4330
|
+
), $ = J(
|
|
4331
|
+
(B) => {
|
|
4332
|
+
r.onChange({ tipo: C, data: S, genero: B });
|
|
4333
4333
|
},
|
|
4334
|
-
[r,
|
|
4335
|
-
),
|
|
4336
|
-
(
|
|
4337
|
-
[
|
|
4334
|
+
[r, C, S]
|
|
4335
|
+
), z = J(
|
|
4336
|
+
(B) => C === B,
|
|
4337
|
+
[C]
|
|
4338
4338
|
);
|
|
4339
4339
|
return /* @__PURE__ */ f("div", { className: "space-y-3", children: [
|
|
4340
4340
|
E && /* @__PURE__ */ f("div", { className: "flex items-center gap-2 px-1", children: [
|
|
4341
4341
|
/* @__PURE__ */ o("span", { className: "text-xs text-muted-foreground shrink-0", children: "Você é:" }),
|
|
4342
|
-
/* @__PURE__ */ o("div", { className: "flex gap-2", children: ["masculino", "feminino"].map((
|
|
4342
|
+
/* @__PURE__ */ o("div", { className: "flex gap-2", children: ["masculino", "feminino"].map((B) => /* @__PURE__ */ o(
|
|
4343
4343
|
"button",
|
|
4344
4344
|
{
|
|
4345
4345
|
type: "button",
|
|
4346
|
-
onClick: () =>
|
|
4347
|
-
className:
|
|
4346
|
+
onClick: () => $(B),
|
|
4347
|
+
className: O(
|
|
4348
4348
|
"px-3 py-1 rounded-full text-xs font-medium border transition-all",
|
|
4349
|
-
|
|
4349
|
+
D === B ? "border-primary bg-primary/10 text-primary" : "border-input text-muted-foreground hover:border-primary/50"
|
|
4350
4350
|
),
|
|
4351
|
-
children:
|
|
4351
|
+
children: B === "masculino" ? "Masculino" : "Feminino"
|
|
4352
4352
|
},
|
|
4353
|
-
|
|
4353
|
+
B
|
|
4354
4354
|
)) })
|
|
4355
4355
|
] }),
|
|
4356
4356
|
/* @__PURE__ */ f(
|
|
4357
4357
|
"button",
|
|
4358
4358
|
{
|
|
4359
4359
|
type: "button",
|
|
4360
|
-
onClick: () =>
|
|
4361
|
-
style:
|
|
4362
|
-
className:
|
|
4360
|
+
onClick: () => L("todos_os_dias"),
|
|
4361
|
+
style: z("todos_os_dias") ? void 0 : { borderColor: "var(--t-border)" },
|
|
4362
|
+
className: O(
|
|
4363
4363
|
"w-full text-left flex items-start gap-3 p-4 rounded-xl border-2 transition-all",
|
|
4364
|
-
|
|
4364
|
+
z("todos_os_dias") ? "border-primary bg-primary/5" : "hover:border-primary/50"
|
|
4365
4365
|
),
|
|
4366
4366
|
children: [
|
|
4367
4367
|
/* @__PURE__ */ o(
|
|
4368
4368
|
"div",
|
|
4369
4369
|
{
|
|
4370
|
-
className:
|
|
4370
|
+
className: O(
|
|
4371
4371
|
"mt-0.5 p-2 rounded-lg shrink-0 transition-colors",
|
|
4372
|
-
|
|
4372
|
+
z("todos_os_dias") ? "bg-primary/10 text-primary" : "bg-muted text-muted-foreground"
|
|
4373
4373
|
),
|
|
4374
4374
|
children: /* @__PURE__ */ o(Or, { className: "w-4 h-4" })
|
|
4375
4375
|
}
|
|
@@ -4382,9 +4382,9 @@ const Kt = (t) => t < 1024 ? `${t} B` : t < 1024 * 1024 ? `${(t / 1024).toFixed(
|
|
|
4382
4382
|
l > 0 && /* @__PURE__ */ o(
|
|
4383
4383
|
"p",
|
|
4384
4384
|
{
|
|
4385
|
-
className:
|
|
4385
|
+
className: O(
|
|
4386
4386
|
"font-bold text-sm",
|
|
4387
|
-
|
|
4387
|
+
z("todos_os_dias") ? "text-primary" : "text-foreground"
|
|
4388
4388
|
),
|
|
4389
4389
|
children: Xt(l)
|
|
4390
4390
|
}
|
|
@@ -4402,19 +4402,19 @@ const Kt = (t) => t < 1024 ? `${t} B` : t < 1024 * 1024 ? `${(t / 1024).toFixed(
|
|
|
4402
4402
|
"button",
|
|
4403
4403
|
{
|
|
4404
4404
|
type: "button",
|
|
4405
|
-
onClick: () =>
|
|
4406
|
-
style:
|
|
4407
|
-
className:
|
|
4405
|
+
onClick: () => L("por_dia"),
|
|
4406
|
+
style: z("por_dia") ? void 0 : { borderColor: "var(--t-border)" },
|
|
4407
|
+
className: O(
|
|
4408
4408
|
"w-full text-left flex items-start gap-3 p-4 rounded-xl border-2 transition-all",
|
|
4409
|
-
|
|
4409
|
+
z("por_dia") ? "border-primary bg-primary/5" : "hover:border-primary/50"
|
|
4410
4410
|
),
|
|
4411
4411
|
children: [
|
|
4412
4412
|
/* @__PURE__ */ o(
|
|
4413
4413
|
"div",
|
|
4414
4414
|
{
|
|
4415
|
-
className:
|
|
4415
|
+
className: O(
|
|
4416
4416
|
"mt-0.5 p-2 rounded-lg shrink-0 transition-colors",
|
|
4417
|
-
|
|
4417
|
+
z("por_dia") ? "bg-primary/10 text-primary" : "bg-muted text-muted-foreground"
|
|
4418
4418
|
),
|
|
4419
4419
|
children: /* @__PURE__ */ o(Pr, { className: "w-4 h-4" })
|
|
4420
4420
|
}
|
|
@@ -4427,9 +4427,9 @@ const Kt = (t) => t < 1024 ? `${t} B` : t < 1024 * 1024 ? `${(t / 1024).toFixed(
|
|
|
4427
4427
|
u > 0 && /* @__PURE__ */ o(
|
|
4428
4428
|
"p",
|
|
4429
4429
|
{
|
|
4430
|
-
className:
|
|
4430
|
+
className: O(
|
|
4431
4431
|
"font-bold text-sm",
|
|
4432
|
-
|
|
4432
|
+
z("por_dia") ? "text-primary" : "text-foreground"
|
|
4433
4433
|
),
|
|
4434
4434
|
children: Xt(u)
|
|
4435
4435
|
}
|
|
@@ -4442,32 +4442,32 @@ const Kt = (t) => t < 1024 ? `${t} B` : t < 1024 * 1024 ? `${(t / 1024).toFixed(
|
|
|
4442
4442
|
/* @__PURE__ */ o(cr, { className: "w-3.5 h-3.5 mt-0.5 shrink-0 text-muted-foreground" }),
|
|
4443
4443
|
/* @__PURE__ */ o("p", { className: "text-xs text-muted-foreground", children: 'Este evento ocorre em apenas 1 dia — a opção "Participar um dia" não é necessária.' })
|
|
4444
4444
|
] }) : null,
|
|
4445
|
-
|
|
4445
|
+
C === "por_dia" && /* @__PURE__ */ f("div", { className: "pl-2 space-y-2", children: [
|
|
4446
4446
|
/* @__PURE__ */ o("p", { className: "text-xs font-semibold uppercase tracking-wide text-primary", children: "Selecione o dia:" }),
|
|
4447
|
-
|
|
4447
|
+
k.length === 0 ? /* @__PURE__ */ o("p", { className: "text-xs text-muted-foreground italic", children: "Nenhuma data configurada no evento" }) : k.map((B) => /* @__PURE__ */ f(
|
|
4448
4448
|
"button",
|
|
4449
4449
|
{
|
|
4450
4450
|
type: "button",
|
|
4451
|
-
onClick: () =>
|
|
4452
|
-
style:
|
|
4453
|
-
className:
|
|
4451
|
+
onClick: () => _(B),
|
|
4452
|
+
style: S !== B ? { borderColor: "var(--t-border)" } : void 0,
|
|
4453
|
+
className: O(
|
|
4454
4454
|
"w-full text-left flex items-center justify-between px-4 py-3 rounded-lg border transition-all",
|
|
4455
|
-
|
|
4455
|
+
S === B ? "border-primary bg-primary/5" : "hover:border-primary/50"
|
|
4456
4456
|
),
|
|
4457
4457
|
children: [
|
|
4458
4458
|
/* @__PURE__ */ f("div", { className: "flex items-center gap-3", children: [
|
|
4459
4459
|
/* @__PURE__ */ o(
|
|
4460
4460
|
"span",
|
|
4461
4461
|
{
|
|
4462
|
-
className:
|
|
4462
|
+
className: O(
|
|
4463
4463
|
"w-4 h-4 rounded-full border-2 shrink-0 flex items-center justify-center transition-colors",
|
|
4464
|
-
|
|
4464
|
+
S === B ? "border-primary bg-primary" : ""
|
|
4465
4465
|
),
|
|
4466
|
-
style:
|
|
4467
|
-
children:
|
|
4466
|
+
style: S !== B ? { borderColor: "var(--t-border)" } : void 0,
|
|
4467
|
+
children: S === B && /* @__PURE__ */ o("span", { className: "w-2 h-2 rounded-full bg-white" })
|
|
4468
4468
|
}
|
|
4469
4469
|
),
|
|
4470
|
-
/* @__PURE__ */ o("span", { className: "text-sm", children: Zi(
|
|
4470
|
+
/* @__PURE__ */ o("span", { className: "text-sm", children: Zi(B) })
|
|
4471
4471
|
] }),
|
|
4472
4472
|
v != null && /* @__PURE__ */ f("span", { className: "text-xs text-muted-foreground", children: [
|
|
4473
4473
|
v,
|
|
@@ -4475,7 +4475,7 @@ const Kt = (t) => t < 1024 ? `${t} B` : t < 1024 * 1024 ? `${(t / 1024).toFixed(
|
|
|
4475
4475
|
] })
|
|
4476
4476
|
]
|
|
4477
4477
|
},
|
|
4478
|
-
|
|
4478
|
+
B
|
|
4479
4479
|
))
|
|
4480
4480
|
] }),
|
|
4481
4481
|
s && /* @__PURE__ */ o("p", { className: "text-sm text-destructive", children: s })
|
|
@@ -4485,7 +4485,7 @@ const Kt = (t) => t < 1024 ? `${t} B` : t < 1024 * 1024 ? `${(t / 1024).toFixed(
|
|
|
4485
4485
|
id: "pix",
|
|
4486
4486
|
label: "PIX",
|
|
4487
4487
|
description: "Transferência instantânea (à vista)",
|
|
4488
|
-
Icon:
|
|
4488
|
+
Icon: dt,
|
|
4489
4489
|
taxa: 0
|
|
4490
4490
|
},
|
|
4491
4491
|
{
|
|
@@ -4508,14 +4508,14 @@ const Kt = (t) => t < 1024 ? `${t} B` : t < 1024 * 1024 ? `${(t / 1024).toFixed(
|
|
|
4508
4508
|
id: "pix",
|
|
4509
4509
|
label: "PIX à Vista",
|
|
4510
4510
|
description: "Pagamento instantâneo sem parcelamento",
|
|
4511
|
-
Icon:
|
|
4511
|
+
Icon: dt,
|
|
4512
4512
|
taxa: 0
|
|
4513
4513
|
},
|
|
4514
4514
|
{
|
|
4515
4515
|
id: "pix_parcelado",
|
|
4516
4516
|
label: "PIX Parcelado",
|
|
4517
4517
|
description: `Parcelado em até ${Qt}x sem juros`,
|
|
4518
|
-
Icon:
|
|
4518
|
+
Icon: dt,
|
|
4519
4519
|
taxa: 0,
|
|
4520
4520
|
parcelas: Qt
|
|
4521
4521
|
},
|
|
@@ -4535,23 +4535,23 @@ const Kt = (t) => t < 1024 ? `${t} B` : t < 1024 * 1024 ? `${(t / 1024).toFixed(
|
|
|
4535
4535
|
Icon: lr,
|
|
4536
4536
|
taxa: 0
|
|
4537
4537
|
}
|
|
4538
|
-
],
|
|
4538
|
+
], Ke = (t) => `R$ ${(t / 100).toFixed(2).replace(".", ",")}`, tr = (t, e) => Math.round(t * (1 + e) * 100) / 100, Yi = (t, e) => Math.round(t / e * 100) / 100, Ji = ({
|
|
4539
4539
|
name: t,
|
|
4540
4540
|
control: e,
|
|
4541
4541
|
relatedFieldName: r = "tipo_participacao"
|
|
4542
4542
|
}) => {
|
|
4543
4543
|
var b;
|
|
4544
|
-
const { field: n, fieldState: i } =
|
|
4544
|
+
const { field: n, fieldState: i } = V({ name: t, control: e }), { externalData: a = {}, paymentMethodOptions: s } = ke(), c = n.value ?? null, m = (b = i.error) == null ? void 0 : b.message, d = De({ control: e, name: r }), l = (d == null ? void 0 : d.tipo) ?? null, u = (x) => a[`evento.${x}`] ?? a[x], p = Number(u("valor") ?? 0), h = Number(u("valorPorDia") ?? 0), g = l === "por_dia" && h > 0 ? h : p, F = l === "por_dia" ? (s == null ? void 0 : s.porDia) ?? Ki : (s == null ? void 0 : s.todosOsDias) ?? Xi, w = l === "por_dia" ? (() => {
|
|
4545
4545
|
if (!(d != null && d.data)) return "Um dia";
|
|
4546
4546
|
const x = d.data.split("-");
|
|
4547
4547
|
if (x.length === 3) {
|
|
4548
|
-
const [
|
|
4549
|
-
return `${E}/${R}/${
|
|
4548
|
+
const [k, R, E] = x;
|
|
4549
|
+
return `${E}/${R}/${k}`;
|
|
4550
4550
|
}
|
|
4551
4551
|
return d.data;
|
|
4552
4552
|
})() : "Todos os dias", v = (x) => {
|
|
4553
4553
|
if (x.disabled) return;
|
|
4554
|
-
const
|
|
4554
|
+
const k = tr(g, x.taxa), R = { metodo: x.id, valorTotal: k };
|
|
4555
4555
|
x.parcelas && (R.parcelas = x.parcelas), n.onChange(R);
|
|
4556
4556
|
};
|
|
4557
4557
|
return /* @__PURE__ */ f("div", { className: "space-y-4", children: [
|
|
@@ -4567,7 +4567,7 @@ const Kt = (t) => t < 1024 ? `${t} B` : t < 1024 * 1024 ? `${(t / 1024).toFixed(
|
|
|
4567
4567
|
] }),
|
|
4568
4568
|
/* @__PURE__ */ f("div", { className: "text-right", children: [
|
|
4569
4569
|
/* @__PURE__ */ o("p", { className: "text-xs text-muted-foreground", children: "Valor base" }),
|
|
4570
|
-
/* @__PURE__ */ o("p", { className: "text-lg font-bold text-primary", children:
|
|
4570
|
+
/* @__PURE__ */ o("p", { className: "text-lg font-bold text-primary", children: Ke(g) })
|
|
4571
4571
|
] })
|
|
4572
4572
|
]
|
|
4573
4573
|
}
|
|
@@ -4587,8 +4587,8 @@ const Kt = (t) => t < 1024 ? `${t} B` : t < 1024 * 1024 ? `${(t / 1024).toFixed(
|
|
|
4587
4587
|
}
|
|
4588
4588
|
),
|
|
4589
4589
|
/* @__PURE__ */ o("p", { className: "text-sm font-semibold text-primary", children: "Selecione a forma de pagamento:" }),
|
|
4590
|
-
/* @__PURE__ */ o("div", { className: "space-y-3", children:
|
|
4591
|
-
const { Icon:
|
|
4590
|
+
/* @__PURE__ */ o("div", { className: "space-y-3", children: F.map((x) => {
|
|
4591
|
+
const { Icon: k } = x, R = (c == null ? void 0 : c.metodo) === x.id, E = tr(g, x.taxa), T = !!x.parcelas && x.parcelas > 1, C = T ? Yi(E, x.parcelas) : null;
|
|
4592
4592
|
return /* @__PURE__ */ f(
|
|
4593
4593
|
"button",
|
|
4594
4594
|
{
|
|
@@ -4596,7 +4596,7 @@ const Kt = (t) => t < 1024 ? `${t} B` : t < 1024 * 1024 ? `${(t / 1024).toFixed(
|
|
|
4596
4596
|
disabled: x.disabled,
|
|
4597
4597
|
onClick: () => v(x),
|
|
4598
4598
|
style: R ? void 0 : { borderColor: "var(--t-border)" },
|
|
4599
|
-
className:
|
|
4599
|
+
className: O(
|
|
4600
4600
|
"w-full text-left flex items-center gap-4 px-4 py-3 rounded-xl border-2 transition-all",
|
|
4601
4601
|
R ? "border-primary bg-primary/5" : "hover:border-primary/50",
|
|
4602
4602
|
x.disabled && "opacity-50 cursor-not-allowed"
|
|
@@ -4605,11 +4605,11 @@ const Kt = (t) => t < 1024 ? `${t} B` : t < 1024 * 1024 ? `${(t / 1024).toFixed(
|
|
|
4605
4605
|
/* @__PURE__ */ o(
|
|
4606
4606
|
"div",
|
|
4607
4607
|
{
|
|
4608
|
-
className:
|
|
4608
|
+
className: O(
|
|
4609
4609
|
"flex items-center justify-center w-10 h-10 rounded-lg shrink-0 transition-colors",
|
|
4610
4610
|
R ? "bg-primary/10 text-primary" : "bg-muted text-muted-foreground"
|
|
4611
4611
|
),
|
|
4612
|
-
children: /* @__PURE__ */ o(
|
|
4612
|
+
children: /* @__PURE__ */ o(k, { className: "h-5 w-5" })
|
|
4613
4613
|
}
|
|
4614
4614
|
),
|
|
4615
4615
|
/* @__PURE__ */ f("div", { className: "flex-1 min-w-0", children: [
|
|
@@ -4621,16 +4621,16 @@ const Kt = (t) => t < 1024 ? `${t} B` : t < 1024 * 1024 ? `${(t / 1024).toFixed(
|
|
|
4621
4621
|
] }),
|
|
4622
4622
|
x.taxa > 0 && /* @__PURE__ */ f("p", { className: "text-xs text-muted-foreground", children: [
|
|
4623
4623
|
"Total com taxa: ",
|
|
4624
|
-
|
|
4624
|
+
Ke(E)
|
|
4625
4625
|
] })
|
|
4626
4626
|
] }),
|
|
4627
|
-
/* @__PURE__ */ o("div", { className: "text-right shrink-0", children:
|
|
4627
|
+
/* @__PURE__ */ o("div", { className: "text-right shrink-0", children: T ? /* @__PURE__ */ f(Oe, { children: [
|
|
4628
4628
|
/* @__PURE__ */ f("p", { className: "text-xs text-muted-foreground", children: [
|
|
4629
4629
|
x.parcelas,
|
|
4630
4630
|
"x de"
|
|
4631
4631
|
] }),
|
|
4632
|
-
/* @__PURE__ */ o("p", { className: "text-base font-bold text-primary", children:
|
|
4633
|
-
] }) : /* @__PURE__ */ o("p", { className: "text-base font-bold text-primary", children:
|
|
4632
|
+
/* @__PURE__ */ o("p", { className: "text-base font-bold text-primary", children: Ke(C) })
|
|
4633
|
+
] }) : /* @__PURE__ */ o("p", { className: "text-base font-bold text-primary", children: Ke(E) }) })
|
|
4634
4634
|
]
|
|
4635
4635
|
},
|
|
4636
4636
|
x.id
|
|
@@ -4646,32 +4646,54 @@ const Kt = (t) => t < 1024 ? `${t} B` : t < 1024 * 1024 ? `${(t / 1024).toFixed(
|
|
|
4646
4646
|
termoPdfUrl: i,
|
|
4647
4647
|
termoPdfUploadId: a
|
|
4648
4648
|
}) => {
|
|
4649
|
-
var
|
|
4650
|
-
const { field: s, fieldState: c } =
|
|
4651
|
-
|
|
4649
|
+
var I;
|
|
4650
|
+
const { field: s, fieldState: c } = V({ name: t, control: e }), { resolveTermsUploadUrl: m } = ke(), d = !!c.error, l = (I = c.error) == null ? void 0 : I.message, [u, p] = j(null), [h, g] = j(!1), [F, w] = j(!1), [v, b] = j(null), [x, k] = j(!1), [R, E] = j(null), T = Y(null);
|
|
4651
|
+
Q(() => {
|
|
4652
4652
|
if (!a || !m) {
|
|
4653
4653
|
p(null);
|
|
4654
4654
|
return;
|
|
4655
4655
|
}
|
|
4656
|
-
let
|
|
4657
|
-
return g(!0), m(a).then((
|
|
4658
|
-
|
|
4656
|
+
let L = !1;
|
|
4657
|
+
return g(!0), m(a).then((_) => {
|
|
4658
|
+
L || p(_);
|
|
4659
4659
|
}).catch(() => {
|
|
4660
|
-
|
|
4660
|
+
L || p(null);
|
|
4661
4661
|
}).finally(() => {
|
|
4662
|
-
|
|
4662
|
+
L || g(!1);
|
|
4663
4663
|
}), () => {
|
|
4664
|
-
|
|
4664
|
+
L = !0;
|
|
4665
4665
|
};
|
|
4666
4666
|
}, [a, m]);
|
|
4667
|
-
const
|
|
4668
|
-
return
|
|
4667
|
+
const C = s.value === "accepted", S = u || i || null, D = !!(n || S || a), N = !!S;
|
|
4668
|
+
return Q(() => {
|
|
4669
|
+
if (!F || !S)
|
|
4670
|
+
return;
|
|
4671
|
+
let L = !1;
|
|
4672
|
+
return k(!0), E(null), b(null), fetch(S).then((_) => {
|
|
4673
|
+
if (!_.ok) throw new Error("fetch failed");
|
|
4674
|
+
return _.blob();
|
|
4675
|
+
}).then((_) => {
|
|
4676
|
+
if (!L) {
|
|
4677
|
+
T.current && URL.revokeObjectURL(T.current);
|
|
4678
|
+
const $ = URL.createObjectURL(_);
|
|
4679
|
+
T.current = $, b($);
|
|
4680
|
+
}
|
|
4681
|
+
}).catch(() => {
|
|
4682
|
+
L || E("Não foi possível carregar o PDF.");
|
|
4683
|
+
}).finally(() => {
|
|
4684
|
+
L || k(!1);
|
|
4685
|
+
}), () => {
|
|
4686
|
+
L = !0;
|
|
4687
|
+
};
|
|
4688
|
+
}, [F, S]), Q(() => () => {
|
|
4689
|
+
T.current && URL.revokeObjectURL(T.current);
|
|
4690
|
+
}, []), /* @__PURE__ */ f("div", { className: "space-y-2", children: [
|
|
4669
4691
|
/* @__PURE__ */ f(
|
|
4670
4692
|
"div",
|
|
4671
4693
|
{
|
|
4672
|
-
className:
|
|
4694
|
+
className: O(
|
|
4673
4695
|
"rounded-lg border p-4 space-y-4 transition-colors",
|
|
4674
|
-
d ? "border-destructive bg-destructive/5" :
|
|
4696
|
+
d ? "border-destructive bg-destructive/5" : C ? "border-green-500 bg-green-500/5" : "border-input"
|
|
4675
4697
|
),
|
|
4676
4698
|
children: [
|
|
4677
4699
|
/* @__PURE__ */ f("div", { className: "flex items-center justify-between gap-2", children: [
|
|
@@ -4679,9 +4701,9 @@ const Kt = (t) => t < 1024 ? `${t} B` : t < 1024 * 1024 ? `${(t / 1024).toFixed(
|
|
|
4679
4701
|
/* @__PURE__ */ o(At, { className: "h-4 w-4 shrink-0" }),
|
|
4680
4702
|
/* @__PURE__ */ o("span", { className: "text-sm font-medium", children: r || "Termos e condições" })
|
|
4681
4703
|
] }),
|
|
4682
|
-
|
|
4704
|
+
D ? /* @__PURE__ */ f(en, { open: F, onOpenChange: w, children: [
|
|
4683
4705
|
/* @__PURE__ */ o(tn, { asChild: !0, children: /* @__PURE__ */ f(
|
|
4684
|
-
|
|
4706
|
+
$e,
|
|
4685
4707
|
{
|
|
4686
4708
|
type: "button",
|
|
4687
4709
|
variant: "outline",
|
|
@@ -4689,7 +4711,7 @@ const Kt = (t) => t < 1024 ? `${t} B` : t < 1024 * 1024 ? `${(t / 1024).toFixed(
|
|
|
4689
4711
|
className: "h-7 px-2 text-xs",
|
|
4690
4712
|
disabled: h,
|
|
4691
4713
|
children: [
|
|
4692
|
-
h ? /* @__PURE__ */ o(
|
|
4714
|
+
h ? /* @__PURE__ */ o(ze, { className: "h-3 w-3 animate-spin" }) : /* @__PURE__ */ o(zr, { className: "h-3 w-3" }),
|
|
4693
4715
|
"Ler termos"
|
|
4694
4716
|
]
|
|
4695
4717
|
}
|
|
@@ -4699,23 +4721,27 @@ const Kt = (t) => t < 1024 ? `${t} B` : t < 1024 * 1024 ? `${(t / 1024).toFixed(
|
|
|
4699
4721
|
/* @__PURE__ */ o(At, { className: "h-4 w-4" }),
|
|
4700
4722
|
"Termos e condições"
|
|
4701
4723
|
] }) }),
|
|
4702
|
-
|
|
4703
|
-
/* @__PURE__ */ o(
|
|
4724
|
+
N ? /* @__PURE__ */ f("div", { className: "flex-1 min-h-0 space-y-2", children: [
|
|
4725
|
+
x && /* @__PURE__ */ o("div", { className: "w-full h-[62vh] rounded border flex items-center justify-center bg-muted/20", children: /* @__PURE__ */ o(ze, { className: "h-6 w-6 animate-spin text-muted-foreground" }) }),
|
|
4726
|
+
!x && R && /* @__PURE__ */ f("div", { className: "w-full h-[62vh] rounded border flex flex-col items-center justify-center gap-2 bg-muted/20", children: [
|
|
4727
|
+
/* @__PURE__ */ o(Xe, { className: "h-6 w-6 text-muted-foreground" }),
|
|
4728
|
+
/* @__PURE__ */ o("p", { className: "text-sm text-muted-foreground", children: R })
|
|
4729
|
+
] }),
|
|
4730
|
+
!x && v && /* @__PURE__ */ o(
|
|
4704
4731
|
"iframe",
|
|
4705
4732
|
{
|
|
4706
|
-
src:
|
|
4733
|
+
src: v,
|
|
4707
4734
|
className: "w-full h-[62vh] rounded border",
|
|
4708
|
-
title: "Termos e condições"
|
|
4709
|
-
sandbox: "allow-same-origin allow-scripts allow-popups"
|
|
4735
|
+
title: "Termos e condições"
|
|
4710
4736
|
}
|
|
4711
4737
|
),
|
|
4712
4738
|
/* @__PURE__ */ f("p", { className: "text-xs text-muted-foreground text-center", children: [
|
|
4713
|
-
"
|
|
4739
|
+
"Prefere abrir fora?",
|
|
4714
4740
|
" ",
|
|
4715
4741
|
/* @__PURE__ */ o(
|
|
4716
4742
|
"a",
|
|
4717
4743
|
{
|
|
4718
|
-
href:
|
|
4744
|
+
href: S,
|
|
4719
4745
|
target: "_blank",
|
|
4720
4746
|
rel: "noopener noreferrer",
|
|
4721
4747
|
className: "underline text-primary",
|
|
@@ -4732,21 +4758,21 @@ const Kt = (t) => t < 1024 ? `${t} B` : t < 1024 * 1024 ? `${(t / 1024).toFixed(
|
|
|
4732
4758
|
ft,
|
|
4733
4759
|
{
|
|
4734
4760
|
className: "mt-0.5",
|
|
4735
|
-
checked:
|
|
4736
|
-
onCheckedChange: (
|
|
4761
|
+
checked: C,
|
|
4762
|
+
onCheckedChange: (L) => s.onChange(L ? "accepted" : "")
|
|
4737
4763
|
}
|
|
4738
4764
|
),
|
|
4739
4765
|
/* @__PURE__ */ f("span", { className: "text-sm leading-snug flex-1", children: [
|
|
4740
4766
|
"Li e aceito ",
|
|
4741
4767
|
r ? `"${r}"` : "os termos e condições"
|
|
4742
4768
|
] }),
|
|
4743
|
-
|
|
4769
|
+
C && /* @__PURE__ */ o($r, { className: "h-4 w-4 text-green-500 shrink-0 mt-0.5" })
|
|
4744
4770
|
] })
|
|
4745
4771
|
]
|
|
4746
4772
|
}
|
|
4747
4773
|
),
|
|
4748
4774
|
d && /* @__PURE__ */ f("div", { className: "flex items-center gap-1.5 text-xs text-destructive", children: [
|
|
4749
|
-
/* @__PURE__ */ o(
|
|
4775
|
+
/* @__PURE__ */ o(Xe, { className: "h-3.5 w-3.5 shrink-0" }),
|
|
4750
4776
|
l || "Você precisa aceitar os termos para continuar"
|
|
4751
4777
|
] })
|
|
4752
4778
|
] });
|
|
@@ -4758,7 +4784,7 @@ const Kt = (t) => t < 1024 ? `${t} B` : t < 1024 * 1024 ? `${(t / 1024).toFixed(
|
|
|
4758
4784
|
readOnly: i
|
|
4759
4785
|
}) => {
|
|
4760
4786
|
var l;
|
|
4761
|
-
const { field: a, fieldState: s } =
|
|
4787
|
+
const { field: a, fieldState: s } = V({ name: t, control: e }), [c, m] = j(!1), d = !!s.error;
|
|
4762
4788
|
return /* @__PURE__ */ f("div", { className: "space-y-1", children: [
|
|
4763
4789
|
/* @__PURE__ */ f("div", { className: "relative", children: [
|
|
4764
4790
|
/* @__PURE__ */ o(
|
|
@@ -4770,7 +4796,7 @@ const Kt = (t) => t < 1024 ? `${t} B` : t < 1024 * 1024 ? `${(t / 1024).toFixed(
|
|
|
4770
4796
|
placeholder: r,
|
|
4771
4797
|
disabled: n,
|
|
4772
4798
|
readOnly: i,
|
|
4773
|
-
className:
|
|
4799
|
+
className: O(
|
|
4774
4800
|
"pr-10",
|
|
4775
4801
|
d && "border-destructive focus-visible:ring-destructive"
|
|
4776
4802
|
)
|
|
@@ -4784,7 +4810,7 @@ const Kt = (t) => t < 1024 ? `${t} B` : t < 1024 * 1024 ? `${(t / 1024).toFixed(
|
|
|
4784
4810
|
onClick: () => m((u) => !u),
|
|
4785
4811
|
className: "absolute right-3 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground transition-colors",
|
|
4786
4812
|
"aria-label": c ? "Ocultar senha" : "Mostrar senha",
|
|
4787
|
-
children: c ? /* @__PURE__ */ o(Mr, { size: 16 }) : /* @__PURE__ */ o(
|
|
4813
|
+
children: c ? /* @__PURE__ */ o(Mr, { size: 16 }) : /* @__PURE__ */ o(Ur, { size: 16 })
|
|
4788
4814
|
}
|
|
4789
4815
|
)
|
|
4790
4816
|
] }),
|
|
@@ -4798,7 +4824,7 @@ const Kt = (t) => t < 1024 ? `${t} B` : t < 1024 * 1024 ? `${(t / 1024).toFixed(
|
|
|
4798
4824
|
readOnly: i
|
|
4799
4825
|
}) => {
|
|
4800
4826
|
var m;
|
|
4801
|
-
const { field: a, fieldState: s } =
|
|
4827
|
+
const { field: a, fieldState: s } = V({ name: t, control: e }), c = !!a.value;
|
|
4802
4828
|
return /* @__PURE__ */ f("div", { className: "space-y-1", children: [
|
|
4803
4829
|
/* @__PURE__ */ f("label", { className: "flex items-center gap-3 cursor-pointer select-none", children: [
|
|
4804
4830
|
/* @__PURE__ */ o(
|
|
@@ -4824,8 +4850,8 @@ const Kt = (t) => t < 1024 ? `${t} B` : t < 1024 * 1024 ? `${(t / 1024).toFixed(
|
|
|
4824
4850
|
readOnly: s
|
|
4825
4851
|
}) => {
|
|
4826
4852
|
var l;
|
|
4827
|
-
const { field: c, fieldState: m } =
|
|
4828
|
-
return
|
|
4853
|
+
const { field: c, fieldState: m } = V({ name: t, control: e }), d = c.value ?? r;
|
|
4854
|
+
return Q(() => {
|
|
4829
4855
|
(c.value === void 0 || c.value === null) && c.onChange(r);
|
|
4830
4856
|
}, []), /* @__PURE__ */ f("div", { className: "space-y-1", children: [
|
|
4831
4857
|
/* @__PURE__ */ f("div", { className: "flex items-center gap-3", children: [
|
|
@@ -4849,15 +4875,15 @@ const Kt = (t) => t < 1024 ? `${t} B` : t < 1024 * 1024 ? `${(t / 1024).toFixed(
|
|
|
4849
4875
|
] }),
|
|
4850
4876
|
((l = m.error) == null ? void 0 : l.message) && /* @__PURE__ */ o("p", { className: "text-sm text-destructive", children: m.error.message })
|
|
4851
4877
|
] });
|
|
4852
|
-
},
|
|
4878
|
+
}, lt = (t) => /^#([0-9a-fA-F]{3}|[0-9a-fA-F]{6})$/.test(t), ra = ({
|
|
4853
4879
|
name: t,
|
|
4854
4880
|
control: e,
|
|
4855
4881
|
disabled: r,
|
|
4856
4882
|
readOnly: n
|
|
4857
4883
|
}) => {
|
|
4858
4884
|
var d;
|
|
4859
|
-
const { field: i, fieldState: a } =
|
|
4860
|
-
return
|
|
4885
|
+
const { field: i, fieldState: a } = V({ name: t, control: e }), s = i.value || "#000000", [c, m] = j(s);
|
|
4886
|
+
return Q(() => {
|
|
4861
4887
|
m(s);
|
|
4862
4888
|
}, [s]), /* @__PURE__ */ f("div", { className: "space-y-1", children: [
|
|
4863
4889
|
/* @__PURE__ */ f("div", { className: "flex items-center gap-3", children: [
|
|
@@ -4865,7 +4891,7 @@ const Kt = (t) => t < 1024 ? `${t} B` : t < 1024 * 1024 ? `${(t / 1024).toFixed(
|
|
|
4865
4891
|
"input",
|
|
4866
4892
|
{
|
|
4867
4893
|
type: "color",
|
|
4868
|
-
value:
|
|
4894
|
+
value: lt(s) ? s : "#000000",
|
|
4869
4895
|
disabled: r || n,
|
|
4870
4896
|
onChange: (l) => i.onChange(l.target.value),
|
|
4871
4897
|
className: "h-10 w-14 cursor-pointer rounded-lg border border-input bg-transparent p-1 disabled:cursor-not-allowed disabled:opacity-50"
|
|
@@ -4880,12 +4906,12 @@ const Kt = (t) => t < 1024 ? `${t} B` : t < 1024 * 1024 ? `${(t / 1024).toFixed(
|
|
|
4880
4906
|
disabled: r,
|
|
4881
4907
|
onChange: (l) => {
|
|
4882
4908
|
const u = l.target.value;
|
|
4883
|
-
m(u),
|
|
4909
|
+
m(u), lt(u) && i.onChange(u.toUpperCase());
|
|
4884
4910
|
},
|
|
4885
4911
|
onBlur: () => {
|
|
4886
|
-
|
|
4912
|
+
lt(c) || m(s), i.onBlur();
|
|
4887
4913
|
},
|
|
4888
|
-
className:
|
|
4914
|
+
className: O(
|
|
4889
4915
|
"flex-1 font-mono uppercase",
|
|
4890
4916
|
a.error && "border-destructive focus-visible:ring-destructive"
|
|
4891
4917
|
),
|
|
@@ -4904,55 +4930,55 @@ const Kt = (t) => t < 1024 ? `${t} B` : t < 1024 * 1024 ? `${(t / 1024).toFixed(
|
|
|
4904
4930
|
disabled: i,
|
|
4905
4931
|
readOnly: a
|
|
4906
4932
|
}) => {
|
|
4907
|
-
var
|
|
4908
|
-
const { field: s, fieldState: c } =
|
|
4909
|
-
(
|
|
4933
|
+
var C, S;
|
|
4934
|
+
const { field: s, fieldState: c } = V({ name: t, control: e }), [m, d] = j(""), [l, u] = j(!1), [p, h] = j(-1), g = Y(null), F = Y(null), w = `autocomplete-${t}-listbox`, v = ((C = r.find((D) => D.valor === s.value)) == null ? void 0 : C.label) ?? "", b = m.length > 0 ? r.filter(
|
|
4935
|
+
(D) => D.label.toLowerCase().includes(m.toLowerCase())
|
|
4910
4936
|
) : r;
|
|
4911
|
-
|
|
4912
|
-
const
|
|
4913
|
-
g.current && !g.current.contains(
|
|
4937
|
+
Q(() => {
|
|
4938
|
+
const D = (N) => {
|
|
4939
|
+
g.current && !g.current.contains(N.target) && (u(!1), d(""), h(-1));
|
|
4914
4940
|
};
|
|
4915
|
-
return document.addEventListener("mousedown",
|
|
4941
|
+
return document.addEventListener("mousedown", D), () => document.removeEventListener("mousedown", D);
|
|
4916
4942
|
}, []);
|
|
4917
4943
|
const x = () => {
|
|
4918
4944
|
u(!1), d(""), h(-1);
|
|
4919
4945
|
};
|
|
4920
|
-
|
|
4921
|
-
if (p < 0 || !
|
|
4922
|
-
const
|
|
4946
|
+
Q(() => {
|
|
4947
|
+
if (p < 0 || !F.current) return;
|
|
4948
|
+
const D = F.current.querySelector(
|
|
4923
4949
|
`[id="${w}-option-${p}"]`
|
|
4924
4950
|
);
|
|
4925
|
-
|
|
4951
|
+
D == null || D.scrollIntoView({ block: "nearest" });
|
|
4926
4952
|
}, [p, w]);
|
|
4927
|
-
const
|
|
4928
|
-
|
|
4953
|
+
const k = (D) => {
|
|
4954
|
+
D.disabled || (s.onChange(D.valor), x());
|
|
4929
4955
|
}, R = () => {
|
|
4930
4956
|
s.onChange(""), d(""), h(-1);
|
|
4931
|
-
}, E = (
|
|
4957
|
+
}, E = (D) => {
|
|
4932
4958
|
if (!l) {
|
|
4933
|
-
(
|
|
4959
|
+
(D.key === "ArrowDown" || D.key === "ArrowUp") && (D.preventDefault(), u(!0), h(0));
|
|
4934
4960
|
return;
|
|
4935
4961
|
}
|
|
4936
|
-
switch (
|
|
4962
|
+
switch (D.key) {
|
|
4937
4963
|
case "ArrowDown":
|
|
4938
|
-
|
|
4939
|
-
(
|
|
4964
|
+
D.preventDefault(), h(
|
|
4965
|
+
(N) => N < b.length - 1 ? N + 1 : N
|
|
4940
4966
|
);
|
|
4941
4967
|
break;
|
|
4942
4968
|
case "ArrowUp":
|
|
4943
|
-
|
|
4969
|
+
D.preventDefault(), h((N) => N > 0 ? N - 1 : 0);
|
|
4944
4970
|
break;
|
|
4945
4971
|
case "Enter":
|
|
4946
|
-
|
|
4972
|
+
D.preventDefault(), p >= 0 && b[p] && !b[p].disabled && k(b[p]);
|
|
4947
4973
|
break;
|
|
4948
4974
|
case "Escape":
|
|
4949
|
-
|
|
4975
|
+
D.preventDefault(), x();
|
|
4950
4976
|
break;
|
|
4951
4977
|
case "Tab":
|
|
4952
4978
|
x();
|
|
4953
4979
|
break;
|
|
4954
4980
|
}
|
|
4955
|
-
},
|
|
4981
|
+
}, T = l && p >= 0 ? `${w}-option-${p}` : void 0;
|
|
4956
4982
|
return /* @__PURE__ */ f("div", { className: "space-y-1", ref: g, children: [
|
|
4957
4983
|
/* @__PURE__ */ f("div", { className: "relative", children: [
|
|
4958
4984
|
/* @__PURE__ */ o(
|
|
@@ -4964,17 +4990,17 @@ const Kt = (t) => t < 1024 ? `${t} B` : t < 1024 * 1024 ? `${(t / 1024).toFixed(
|
|
|
4964
4990
|
"aria-haspopup": "listbox",
|
|
4965
4991
|
"aria-autocomplete": "list",
|
|
4966
4992
|
"aria-controls": w,
|
|
4967
|
-
"aria-activedescendant":
|
|
4993
|
+
"aria-activedescendant": T,
|
|
4968
4994
|
value: l ? m : v,
|
|
4969
4995
|
placeholder: n ?? "Buscar...",
|
|
4970
4996
|
disabled: i,
|
|
4971
4997
|
readOnly: a,
|
|
4972
|
-
onChange: (
|
|
4973
|
-
d(
|
|
4998
|
+
onChange: (D) => {
|
|
4999
|
+
d(D.target.value), h(-1), u(!0);
|
|
4974
5000
|
},
|
|
4975
5001
|
onFocus: () => !a && u(!0),
|
|
4976
5002
|
onKeyDown: E,
|
|
4977
|
-
className:
|
|
5003
|
+
className: O(
|
|
4978
5004
|
"pr-8",
|
|
4979
5005
|
c.error && "border-destructive focus-visible:ring-destructive"
|
|
4980
5006
|
),
|
|
@@ -4989,7 +5015,7 @@ const Kt = (t) => t < 1024 ? `${t} B` : t < 1024 * 1024 ? `${(t / 1024).toFixed(
|
|
|
4989
5015
|
className: "text-[var(--t-text-muted)] hover:text-[var(--t-text)]",
|
|
4990
5016
|
tabIndex: -1,
|
|
4991
5017
|
"aria-label": "Limpar seleção",
|
|
4992
|
-
children: /* @__PURE__ */ o(
|
|
5018
|
+
children: /* @__PURE__ */ o(jr, { size: 14 })
|
|
4993
5019
|
}
|
|
4994
5020
|
) : /* @__PURE__ */ o(
|
|
4995
5021
|
Vr,
|
|
@@ -5004,7 +5030,7 @@ const Kt = (t) => t < 1024 ? `${t} B` : t < 1024 * 1024 ? `${(t / 1024).toFixed(
|
|
|
5004
5030
|
{
|
|
5005
5031
|
role: "listbox",
|
|
5006
5032
|
id: w,
|
|
5007
|
-
ref:
|
|
5033
|
+
ref: F,
|
|
5008
5034
|
"aria-label": "Opções disponíveis",
|
|
5009
5035
|
className: "absolute z-50 mt-1 max-h-60 w-full overflow-auto rounded-lg border border-input bg-popover shadow-lg",
|
|
5010
5036
|
children: b.length === 0 ? /* @__PURE__ */ o(
|
|
@@ -5015,27 +5041,27 @@ const Kt = (t) => t < 1024 ? `${t} B` : t < 1024 * 1024 ? `${(t / 1024).toFixed(
|
|
|
5015
5041
|
className: "px-3 py-2 text-sm text-muted-foreground",
|
|
5016
5042
|
children: "Nenhuma opção encontrada"
|
|
5017
5043
|
}
|
|
5018
|
-
) : b.map((
|
|
5044
|
+
) : b.map((D, N) => /* @__PURE__ */ o(
|
|
5019
5045
|
"li",
|
|
5020
5046
|
{
|
|
5021
|
-
id: `${w}-option-${
|
|
5047
|
+
id: `${w}-option-${N}`,
|
|
5022
5048
|
role: "option",
|
|
5023
|
-
"aria-selected": s.value ===
|
|
5024
|
-
"aria-disabled":
|
|
5025
|
-
onMouseDown: () =>
|
|
5049
|
+
"aria-selected": s.value === D.valor,
|
|
5050
|
+
"aria-disabled": D.disabled,
|
|
5051
|
+
onMouseDown: () => k(D),
|
|
5026
5052
|
className: [
|
|
5027
5053
|
"flex cursor-pointer items-center px-3 py-2 text-sm",
|
|
5028
|
-
|
|
5029
|
-
s.value ===
|
|
5054
|
+
D.disabled ? "cursor-not-allowed opacity-40" : N === p ? "bg-accent" : "hover:bg-accent",
|
|
5055
|
+
s.value === D.valor ? "font-medium text-primary" : "text-foreground"
|
|
5030
5056
|
].join(" "),
|
|
5031
|
-
children:
|
|
5057
|
+
children: D.label
|
|
5032
5058
|
},
|
|
5033
|
-
|
|
5059
|
+
D.valor
|
|
5034
5060
|
))
|
|
5035
5061
|
}
|
|
5036
5062
|
)
|
|
5037
5063
|
] }),
|
|
5038
|
-
((
|
|
5064
|
+
((S = c.error) == null ? void 0 : S.message) && /* @__PURE__ */ o("p", { className: "text-sm text-destructive", role: "alert", children: c.error.message })
|
|
5039
5065
|
] });
|
|
5040
5066
|
}, kr = ({
|
|
5041
5067
|
name: t,
|
|
@@ -5045,7 +5071,7 @@ const Kt = (t) => t < 1024 ? `${t} B` : t < 1024 * 1024 ? `${(t / 1024).toFixed(
|
|
|
5045
5071
|
readOnly: i
|
|
5046
5072
|
}) => {
|
|
5047
5073
|
var m;
|
|
5048
|
-
const { field: a, fieldState: s } =
|
|
5074
|
+
const { field: a, fieldState: s } = V({ name: t, control: e }), c = !!s.error;
|
|
5049
5075
|
return /* @__PURE__ */ f("div", { className: "space-y-1", children: [
|
|
5050
5076
|
/* @__PURE__ */ o(
|
|
5051
5077
|
be,
|
|
@@ -5056,7 +5082,7 @@ const Kt = (t) => t < 1024 ? `${t} B` : t < 1024 * 1024 ? `${(t / 1024).toFixed(
|
|
|
5056
5082
|
placeholder: r,
|
|
5057
5083
|
disabled: n,
|
|
5058
5084
|
readOnly: i,
|
|
5059
|
-
className:
|
|
5085
|
+
className: O(
|
|
5060
5086
|
c && "border-destructive focus-visible:ring-destructive"
|
|
5061
5087
|
)
|
|
5062
5088
|
}
|
|
@@ -5072,7 +5098,7 @@ const Kt = (t) => t < 1024 ? `${t} B` : t < 1024 * 1024 ? `${(t / 1024).toFixed(
|
|
|
5072
5098
|
readOnly: a
|
|
5073
5099
|
}) => {
|
|
5074
5100
|
var u;
|
|
5075
|
-
const { field: s, fieldState: c } =
|
|
5101
|
+
const { field: s, fieldState: c } = V({ name: t, control: e }), m = s.value ?? {}, d = (p, h) => {
|
|
5076
5102
|
s.onChange({ ...m, [p]: h });
|
|
5077
5103
|
}, l = !!c.error;
|
|
5078
5104
|
return /* @__PURE__ */ f("div", { className: "space-y-2", children: [
|
|
@@ -5088,7 +5114,7 @@ const Kt = (t) => t < 1024 ? `${t} B` : t < 1024 * 1024 ? `${(t / 1024).toFixed(
|
|
|
5088
5114
|
readOnly: a,
|
|
5089
5115
|
onChange: (p) => d("start", p.target.value),
|
|
5090
5116
|
max: m.end ?? void 0,
|
|
5091
|
-
className:
|
|
5117
|
+
className: O(l && "border-destructive focus-visible:ring-destructive")
|
|
5092
5118
|
}
|
|
5093
5119
|
)
|
|
5094
5120
|
] }),
|
|
@@ -5103,7 +5129,7 @@ const Kt = (t) => t < 1024 ? `${t} B` : t < 1024 * 1024 ? `${(t / 1024).toFixed(
|
|
|
5103
5129
|
readOnly: a,
|
|
5104
5130
|
onChange: (p) => d("end", p.target.value),
|
|
5105
5131
|
min: m.start ?? void 0,
|
|
5106
|
-
className:
|
|
5132
|
+
className: O(l && "border-destructive focus-visible:ring-destructive")
|
|
5107
5133
|
}
|
|
5108
5134
|
)
|
|
5109
5135
|
] })
|
|
@@ -5118,7 +5144,7 @@ const Kt = (t) => t < 1024 ? `${t} B` : t < 1024 * 1024 ? `${(t / 1024).toFixed(
|
|
|
5118
5144
|
readOnly: i
|
|
5119
5145
|
}) => {
|
|
5120
5146
|
var d;
|
|
5121
|
-
const { field: a, fieldState: s } =
|
|
5147
|
+
const { field: a, fieldState: s } = V({ name: t, control: e }), c = a.value ?? 0, m = Array.from({ length: r }, (l, u) => u + 1);
|
|
5122
5148
|
return /* @__PURE__ */ f("div", { className: "space-y-1", children: [
|
|
5123
5149
|
/* @__PURE__ */ f("div", { className: "flex items-center gap-1", children: [
|
|
5124
5150
|
m.map((l) => /* @__PURE__ */ o(
|
|
@@ -5277,7 +5303,7 @@ const Kt = (t) => t < 1024 ? `${t} B` : t < 1024 * 1024 ? `${(t / 1024).toFixed(
|
|
|
5277
5303
|
);
|
|
5278
5304
|
case y.DATE:
|
|
5279
5305
|
return /* @__PURE__ */ o(
|
|
5280
|
-
|
|
5306
|
+
Me,
|
|
5281
5307
|
{
|
|
5282
5308
|
name: e,
|
|
5283
5309
|
control: r,
|
|
@@ -5444,7 +5470,7 @@ const Kt = (t) => t < 1024 ? `${t} B` : t < 1024 * 1024 ? `${(t / 1024).toFixed(
|
|
|
5444
5470
|
return /* @__PURE__ */ o(ur, { ...s, options: t.opcoes ?? [] });
|
|
5445
5471
|
case y.DATE:
|
|
5446
5472
|
return /* @__PURE__ */ o(
|
|
5447
|
-
|
|
5473
|
+
Me,
|
|
5448
5474
|
{
|
|
5449
5475
|
name: n,
|
|
5450
5476
|
control: e,
|
|
@@ -5455,7 +5481,7 @@ const Kt = (t) => t < 1024 ? `${t} B` : t < 1024 * 1024 ? `${(t / 1024).toFixed(
|
|
|
5455
5481
|
);
|
|
5456
5482
|
case y.DATETIME:
|
|
5457
5483
|
return /* @__PURE__ */ o(
|
|
5458
|
-
|
|
5484
|
+
Me,
|
|
5459
5485
|
{
|
|
5460
5486
|
name: n,
|
|
5461
5487
|
control: e,
|
|
@@ -5548,37 +5574,37 @@ const Kt = (t) => t < 1024 ? `${t} B` : t < 1024 * 1024 ? `${(t / 1024).toFixed(
|
|
|
5548
5574
|
container: t,
|
|
5549
5575
|
control: e
|
|
5550
5576
|
}) => {
|
|
5551
|
-
var
|
|
5552
|
-
const { externalData: r = {}, fieldResolvers: n } = ke(), i = t.icone ?
|
|
5577
|
+
var F;
|
|
5578
|
+
const { externalData: r = {}, fieldResolvers: n } = ke(), i = t.icone ? tt[t.icone] : void 0, a = r, s = M(
|
|
5553
5579
|
() => pt(t, a),
|
|
5554
5580
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
5555
5581
|
[t, JSON.stringify(a)]
|
|
5556
|
-
), c =
|
|
5582
|
+
), c = M(
|
|
5557
5583
|
() => [...s.campos].sort((w, v) => w.ordem - v.ordem),
|
|
5558
5584
|
[s.campos]
|
|
5559
5585
|
), m = De({ control: e }), { wrapperClass: d, wrapperStyle: l, headerClass: u, headerStyle: p, tmpl: h } = mr(), g = (w) => {
|
|
5560
|
-
if (!
|
|
5586
|
+
if (!ie(
|
|
5561
5587
|
w.condicional,
|
|
5562
5588
|
m,
|
|
5563
5589
|
r
|
|
5564
5590
|
)) return null;
|
|
5565
5591
|
let b = w;
|
|
5566
5592
|
if (w.resolvePropsKey && (n != null && n[w.resolvePropsKey])) {
|
|
5567
|
-
const
|
|
5593
|
+
const T = n[w.resolvePropsKey](
|
|
5568
5594
|
w,
|
|
5569
5595
|
m,
|
|
5570
5596
|
r
|
|
5571
5597
|
);
|
|
5572
|
-
b = { ...w, ...
|
|
5598
|
+
b = { ...w, ...T };
|
|
5573
5599
|
}
|
|
5574
5600
|
if (b.opcoesFromVar) {
|
|
5575
|
-
const
|
|
5576
|
-
Array.isArray(
|
|
5601
|
+
const T = r[b.opcoesFromVar];
|
|
5602
|
+
Array.isArray(T) && (b = {
|
|
5577
5603
|
...b,
|
|
5578
|
-
opcoes:
|
|
5604
|
+
opcoes: T.map((C) => typeof C == "string" ? { valor: C, label: C } : C && typeof C == "object" && "valor" in C && "label" in C ? C : { valor: String(C), label: String(C) })
|
|
5579
5605
|
});
|
|
5580
5606
|
}
|
|
5581
|
-
const x = b.tamanho ?? 12,
|
|
5607
|
+
const x = b.tamanho ?? 12, k = b.inicioColuna, R = k ? `${k} / span ${x}` : `span ${x}`, E = /* @__PURE__ */ o(Nr, { field: b, control: e });
|
|
5582
5608
|
return b.tipo === y.CHECKBOX || b.tipo === y.HIDDEN || b.tipo === y.SWITCH ? /* @__PURE__ */ o(
|
|
5583
5609
|
"div",
|
|
5584
5610
|
{
|
|
@@ -5633,7 +5659,7 @@ const Kt = (t) => t < 1024 ? `${t} B` : t < 1024 * 1024 ? `${(t / 1024).toFixed(
|
|
|
5633
5659
|
/* @__PURE__ */ o(
|
|
5634
5660
|
"h3",
|
|
5635
5661
|
{
|
|
5636
|
-
className: ((
|
|
5662
|
+
className: ((F = h.typography) == null ? void 0 : F.stepTitleClass) ?? "text-lg font-semibold",
|
|
5637
5663
|
style: { color: "var(--t-text)" },
|
|
5638
5664
|
children: s.titulo
|
|
5639
5665
|
}
|
|
@@ -5647,65 +5673,65 @@ const Kt = (t) => t < 1024 ? `${t} B` : t < 1024 * 1024 ? `${(t / 1024).toFixed(
|
|
|
5647
5673
|
container: t,
|
|
5648
5674
|
control: e
|
|
5649
5675
|
}) => {
|
|
5650
|
-
var
|
|
5651
|
-
const { externalData: r = {} } = ke(), n = t.nome ?? "__invalid__", i = t.minItems ?? 1, a = t.maxItems, s = t.itemLabel ?? "Item", c = t.icone ?
|
|
5676
|
+
var T;
|
|
5677
|
+
const { externalData: r = {} } = ke(), n = t.nome ?? "__invalid__", i = t.minItems ?? 1, a = t.maxItems, s = t.itemLabel ?? "Item", c = t.icone ? tt[t.icone] : void 0, m = r, d = M(
|
|
5652
5678
|
() => pt(t, m),
|
|
5653
5679
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
5654
5680
|
[t, JSON.stringify(m)]
|
|
5655
|
-
), l =
|
|
5656
|
-
() => [...d.campos].sort((
|
|
5681
|
+
), l = M(
|
|
5682
|
+
() => [...d.campos].sort((C, S) => C.ordem - S.ordem),
|
|
5657
5683
|
[d.campos]
|
|
5658
|
-
), u =
|
|
5659
|
-
const
|
|
5660
|
-
for (const
|
|
5661
|
-
|
|
5662
|
-
return
|
|
5684
|
+
), u = J(() => {
|
|
5685
|
+
const C = {};
|
|
5686
|
+
for (const S of l)
|
|
5687
|
+
S.initialValue !== void 0 ? C[S.nome] = typeof S.initialValue == "string" ? se(S.initialValue, m) : S.initialValue : S.defaultValue !== void 0 && (C[S.nome] = S.defaultValue);
|
|
5688
|
+
return C;
|
|
5663
5689
|
}, [l, m]), { fields: p, append: h, remove: g } = ar({
|
|
5664
5690
|
control: e,
|
|
5665
5691
|
name: n
|
|
5666
5692
|
});
|
|
5667
|
-
|
|
5693
|
+
Q(() => {
|
|
5668
5694
|
if (t.nome && p.length < i)
|
|
5669
|
-
for (let
|
|
5695
|
+
for (let C = p.length; C < i; C++)
|
|
5670
5696
|
h(u());
|
|
5671
5697
|
}, [i]);
|
|
5672
|
-
const
|
|
5673
|
-
const
|
|
5674
|
-
return Array.isArray(
|
|
5675
|
-
}, [
|
|
5698
|
+
const F = De({ control: e }), w = M(() => {
|
|
5699
|
+
const C = F[n];
|
|
5700
|
+
return Array.isArray(C) ? C : [];
|
|
5701
|
+
}, [F, n]), { wrapperClass: v, wrapperStyle: b, headerClass: x, headerStyle: k, tmpl: R } = mr();
|
|
5676
5702
|
if (!t.nome)
|
|
5677
5703
|
return console.error(
|
|
5678
5704
|
"[RepeatableContainerRenderer] container.nome é obrigatório para containers repetíveis. Container id:",
|
|
5679
5705
|
t.id
|
|
5680
5706
|
), null;
|
|
5681
|
-
const E = (
|
|
5682
|
-
const
|
|
5683
|
-
if (!
|
|
5684
|
-
|
|
5685
|
-
|
|
5707
|
+
const E = (C, S) => {
|
|
5708
|
+
const D = w[S] ?? {};
|
|
5709
|
+
if (!ie(
|
|
5710
|
+
C.condicional,
|
|
5711
|
+
D,
|
|
5686
5712
|
r
|
|
5687
5713
|
)) return null;
|
|
5688
|
-
const
|
|
5714
|
+
const I = `${n}.${S}.${C.nome}`, L = C.tamanho ?? 12, _ = C.inicioColuna, $ = _ ? `${_} / span ${L}` : `span ${L}`, z = /* @__PURE__ */ o(
|
|
5689
5715
|
Nr,
|
|
5690
5716
|
{
|
|
5691
|
-
field:
|
|
5717
|
+
field: C,
|
|
5692
5718
|
control: e,
|
|
5693
|
-
nameOverride:
|
|
5719
|
+
nameOverride: I
|
|
5694
5720
|
}
|
|
5695
5721
|
);
|
|
5696
|
-
return
|
|
5722
|
+
return C.tipo === y.CHECKBOX || C.tipo === y.HIDDEN ? /* @__PURE__ */ o(
|
|
5697
5723
|
"div",
|
|
5698
5724
|
{
|
|
5699
5725
|
className: "max-sm:!col-span-12",
|
|
5700
|
-
style: { gridColumn:
|
|
5701
|
-
children:
|
|
5726
|
+
style: { gridColumn: $ },
|
|
5727
|
+
children: z
|
|
5702
5728
|
},
|
|
5703
|
-
`${
|
|
5729
|
+
`${C.id}-${S}`
|
|
5704
5730
|
) : /* @__PURE__ */ f(
|
|
5705
5731
|
"div",
|
|
5706
5732
|
{
|
|
5707
5733
|
className: "max-sm:!col-span-12 space-y-2",
|
|
5708
|
-
style: { gridColumn:
|
|
5734
|
+
style: { gridColumn: $ },
|
|
5709
5735
|
children: [
|
|
5710
5736
|
/* @__PURE__ */ f(
|
|
5711
5737
|
"label",
|
|
@@ -5713,20 +5739,20 @@ const Kt = (t) => t < 1024 ? `${t} B` : t < 1024 * 1024 ? `${(t / 1024).toFixed(
|
|
|
5713
5739
|
className: "font-medium flex items-center gap-1",
|
|
5714
5740
|
style: { color: "var(--t-text)" },
|
|
5715
5741
|
children: [
|
|
5716
|
-
|
|
5717
|
-
|
|
5742
|
+
C.label,
|
|
5743
|
+
C.obrigatorio && /* @__PURE__ */ o("span", { className: "text-destructive", children: "*" })
|
|
5718
5744
|
]
|
|
5719
5745
|
}
|
|
5720
5746
|
),
|
|
5721
|
-
|
|
5722
|
-
|
|
5747
|
+
z,
|
|
5748
|
+
C.hint && /* @__PURE__ */ o("p", { className: "text-xs text-muted-foreground", children: C.hint })
|
|
5723
5749
|
]
|
|
5724
5750
|
},
|
|
5725
|
-
`${
|
|
5751
|
+
`${C.id}-${S}`
|
|
5726
5752
|
);
|
|
5727
5753
|
};
|
|
5728
5754
|
return /* @__PURE__ */ f("div", { className: v, style: b, children: [
|
|
5729
|
-
(d.titulo || c) && /* @__PURE__ */ o("div", { className: x, style:
|
|
5755
|
+
(d.titulo || c) && /* @__PURE__ */ o("div", { className: x, style: k, children: /* @__PURE__ */ f("div", { className: "flex items-center gap-3", children: [
|
|
5730
5756
|
c && /* @__PURE__ */ o(
|
|
5731
5757
|
"div",
|
|
5732
5758
|
{
|
|
@@ -5747,7 +5773,7 @@ const Kt = (t) => t < 1024 ? `${t} B` : t < 1024 * 1024 ? `${(t / 1024).toFixed(
|
|
|
5747
5773
|
/* @__PURE__ */ o(
|
|
5748
5774
|
"h3",
|
|
5749
5775
|
{
|
|
5750
|
-
className: ((
|
|
5776
|
+
className: ((T = R.typography) == null ? void 0 : T.stepTitleClass) ?? "text-lg font-semibold",
|
|
5751
5777
|
style: { color: "var(--t-text)" },
|
|
5752
5778
|
children: d.titulo
|
|
5753
5779
|
}
|
|
@@ -5756,35 +5782,35 @@ const Kt = (t) => t < 1024 ? `${t} B` : t < 1024 * 1024 ? `${(t / 1024).toFixed(
|
|
|
5756
5782
|
] })
|
|
5757
5783
|
] }) }),
|
|
5758
5784
|
/* @__PURE__ */ f("div", { className: "p-6 space-y-4", children: [
|
|
5759
|
-
p.map((
|
|
5785
|
+
p.map((C, S) => /* @__PURE__ */ f(
|
|
5760
5786
|
"div",
|
|
5761
5787
|
{
|
|
5762
5788
|
className: "border border-input rounded-lg p-4 bg-muted/30",
|
|
5763
5789
|
children: [
|
|
5764
5790
|
/* @__PURE__ */ f("div", { className: "flex items-center justify-between mb-4", children: [
|
|
5765
5791
|
/* @__PURE__ */ f("div", { className: "flex items-center gap-2", children: [
|
|
5766
|
-
/* @__PURE__ */ o("div", { className: "w-6 h-6 rounded-full flex items-center justify-center text-xs font-bold shrink-0 bg-primary text-primary-foreground", children:
|
|
5792
|
+
/* @__PURE__ */ o("div", { className: "w-6 h-6 rounded-full flex items-center justify-center text-xs font-bold shrink-0 bg-primary text-primary-foreground", children: S + 1 }),
|
|
5767
5793
|
/* @__PURE__ */ f("span", { className: "text-sm font-semibold", children: [
|
|
5768
5794
|
s,
|
|
5769
5795
|
" ",
|
|
5770
|
-
|
|
5796
|
+
S + 1
|
|
5771
5797
|
] })
|
|
5772
5798
|
] }),
|
|
5773
5799
|
p.length > i && /* @__PURE__ */ o(
|
|
5774
5800
|
"button",
|
|
5775
5801
|
{
|
|
5776
5802
|
type: "button",
|
|
5777
|
-
onClick: () => g(
|
|
5803
|
+
onClick: () => g(S),
|
|
5778
5804
|
className: "inline-flex items-center justify-center rounded-md p-1.5 text-destructive hover:bg-destructive/10 transition-colors",
|
|
5779
5805
|
"aria-label": "Remover item",
|
|
5780
5806
|
children: /* @__PURE__ */ o(sr, { className: "w-4 h-4" })
|
|
5781
5807
|
}
|
|
5782
5808
|
)
|
|
5783
5809
|
] }),
|
|
5784
|
-
/* @__PURE__ */ o("div", { className: "grid grid-cols-12 gap-4", children: l.map((
|
|
5810
|
+
/* @__PURE__ */ o("div", { className: "grid grid-cols-12 gap-4", children: l.map((D) => E(D, S)) })
|
|
5785
5811
|
]
|
|
5786
5812
|
},
|
|
5787
|
-
|
|
5813
|
+
C.id
|
|
5788
5814
|
)),
|
|
5789
5815
|
(!a || p.length < a) && /* @__PURE__ */ f(
|
|
5790
5816
|
"button",
|
|
@@ -5813,12 +5839,12 @@ const Kt = (t) => t < 1024 ? `${t} B` : t < 1024 * 1024 ? `${(t / 1024).toFixed(
|
|
|
5813
5839
|
control: e,
|
|
5814
5840
|
externalData: r = {}
|
|
5815
5841
|
}) => {
|
|
5816
|
-
const n =
|
|
5842
|
+
const n = M(
|
|
5817
5843
|
() => [...t.containers].sort((a, s) => a.ordem - s.ordem),
|
|
5818
5844
|
[t.containers]
|
|
5819
5845
|
), i = De({ control: e });
|
|
5820
5846
|
return /* @__PURE__ */ o("div", { className: "grid grid-cols-12 gap-4", children: n.map((a) => {
|
|
5821
|
-
if (a.condicional && !
|
|
5847
|
+
if (a.condicional && !ie(
|
|
5822
5848
|
a.condicional,
|
|
5823
5849
|
i,
|
|
5824
5850
|
r
|
|
@@ -5835,13 +5861,13 @@ const Kt = (t) => t < 1024 ? `${t} B` : t < 1024 * 1024 ? `${(t / 1024).toFixed(
|
|
|
5835
5861
|
a.id
|
|
5836
5862
|
);
|
|
5837
5863
|
}) });
|
|
5838
|
-
},
|
|
5864
|
+
}, Ve = nr({
|
|
5839
5865
|
submitting: !1,
|
|
5840
5866
|
warnings: {},
|
|
5841
5867
|
requestSubmit: () => {
|
|
5842
5868
|
}
|
|
5843
|
-
}), ua =
|
|
5844
|
-
const t = Fr("useFormApi"), e =
|
|
5869
|
+
}), ua = Ve.Provider, Da = () => {
|
|
5870
|
+
const t = Fr("useFormApi"), e = Ue(Ve);
|
|
5845
5871
|
return {
|
|
5846
5872
|
change: (r, n) => t.setValue(r, n, {
|
|
5847
5873
|
shouldValidate: !0,
|
|
@@ -5867,7 +5893,7 @@ const Kt = (t) => t < 1024 ? `${t} B` : t < 1024 * 1024 ? `${(t / 1024).toFixed(
|
|
|
5867
5893
|
}
|
|
5868
5894
|
};
|
|
5869
5895
|
}, fa = () => {
|
|
5870
|
-
const t = Fr("useFormState"), e =
|
|
5896
|
+
const t = Fr("useFormState"), e = Ue(Ve), r = De({ control: t.control }), { errors: n, isDirty: i, isValid: a } = t.formState;
|
|
5871
5897
|
return {
|
|
5872
5898
|
values: r,
|
|
5873
5899
|
errors: Object.fromEntries(
|
|
@@ -5883,7 +5909,7 @@ const Kt = (t) => t < 1024 ? `${t} B` : t < 1024 * 1024 ? `${(t / 1024).toFixed(
|
|
|
5883
5909
|
};
|
|
5884
5910
|
}, Ea = (t) => {
|
|
5885
5911
|
var a;
|
|
5886
|
-
const e =
|
|
5912
|
+
const e = et(), { warnings: r } = Ue(Ve), n = De({ control: e.control, name: t }), i = e.getFieldState(t, e.formState);
|
|
5887
5913
|
return {
|
|
5888
5914
|
value: n,
|
|
5889
5915
|
error: (a = i.error) == null ? void 0 : a.message,
|
|
@@ -5894,7 +5920,7 @@ const Kt = (t) => t < 1024 ? `${t} B` : t < 1024 * 1024 ? `${(t / 1024).toFixed(
|
|
|
5894
5920
|
};
|
|
5895
5921
|
}, Aa = (t) => {
|
|
5896
5922
|
var a;
|
|
5897
|
-
const { control: e } =
|
|
5923
|
+
const { control: e } = et(), { warnings: r } = Ue(Ve), { field: n, fieldState: i } = V({ name: t, control: e });
|
|
5898
5924
|
return {
|
|
5899
5925
|
input: {
|
|
5900
5926
|
name: n.name,
|
|
@@ -5912,7 +5938,7 @@ const Kt = (t) => t < 1024 ? `${t} B` : t < 1024 * 1024 ? `${(t / 1024).toFixed(
|
|
|
5912
5938
|
}
|
|
5913
5939
|
};
|
|
5914
5940
|
}, Fr = (t) => {
|
|
5915
|
-
const e =
|
|
5941
|
+
const e = et();
|
|
5916
5942
|
if (!e)
|
|
5917
5943
|
throw new Error(
|
|
5918
5944
|
`[SchemaForms] O hook '${t}' foi chamado fora de um <FormRenderer />. Certifique-se de que o componente está dentro da árvore de renderização do formulário.`
|
|
@@ -5934,158 +5960,158 @@ const Kt = (t) => t < 1024 ? `${t} B` : t < 1024 * 1024 ? `${(t / 1024).toFixed(
|
|
|
5934
5960
|
onSubmit: p,
|
|
5935
5961
|
onBack: h
|
|
5936
5962
|
}) => {
|
|
5937
|
-
const g = t === e - 1,
|
|
5963
|
+
const g = t === e - 1, F = M(
|
|
5938
5964
|
() => JSON.stringify(i),
|
|
5939
5965
|
[i]
|
|
5940
|
-
), w =
|
|
5966
|
+
), w = M(
|
|
5941
5967
|
() => mn(r, i, d),
|
|
5942
5968
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
5943
|
-
[r.id,
|
|
5944
|
-
), v =
|
|
5969
|
+
[r.id, F]
|
|
5970
|
+
), v = M(
|
|
5945
5971
|
() => un(r, i, d),
|
|
5946
5972
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
5947
|
-
[r.id,
|
|
5948
|
-
), [b, x] =
|
|
5973
|
+
[r.id, F]
|
|
5974
|
+
), [b, x] = j(
|
|
5949
5975
|
{}
|
|
5950
|
-
),
|
|
5951
|
-
|
|
5952
|
-
const R = i, E =
|
|
5976
|
+
), k = Y(l);
|
|
5977
|
+
k.current = l;
|
|
5978
|
+
const R = i, E = M(
|
|
5953
5979
|
() => xn(r, R),
|
|
5954
5980
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
5955
|
-
[r,
|
|
5956
|
-
),
|
|
5981
|
+
[r, F]
|
|
5982
|
+
), T = Ir({
|
|
5957
5983
|
resolver: w,
|
|
5958
5984
|
defaultValues: n,
|
|
5959
5985
|
mode: "onTouched"
|
|
5960
|
-
}), { control:
|
|
5961
|
-
|
|
5962
|
-
|
|
5986
|
+
}), { control: C, handleSubmit: S, setError: D, clearErrors: N, setValue: I } = T;
|
|
5987
|
+
Q(() => {
|
|
5988
|
+
N();
|
|
5963
5989
|
for (const [A, le] of Object.entries(a))
|
|
5964
|
-
|
|
5965
|
-
}, [a,
|
|
5966
|
-
const
|
|
5990
|
+
D(A, { type: "server", message: le });
|
|
5991
|
+
}, [a, D, N]);
|
|
5992
|
+
const L = M(
|
|
5967
5993
|
() => r.containers.filter((A) => !A.repeatable).flatMap((A) => A.campos).filter((A) => !!A.condicional),
|
|
5968
5994
|
[r.containers]
|
|
5969
|
-
),
|
|
5995
|
+
), _ = M(
|
|
5970
5996
|
() => r.containers.filter((A) => !!A.condicional),
|
|
5971
5997
|
[r.containers]
|
|
5972
|
-
),
|
|
5998
|
+
), $ = M(
|
|
5973
5999
|
() => r.containers.filter((A) => !A.repeatable).flatMap((A) => A.campos).filter((A) => {
|
|
5974
6000
|
var le;
|
|
5975
6001
|
return A.condicional && ((le = A.setValues) == null ? void 0 : le.length);
|
|
5976
6002
|
}),
|
|
5977
6003
|
[r.containers]
|
|
5978
|
-
),
|
|
6004
|
+
), z = M(
|
|
5979
6005
|
() => r.containers.filter((A) => A.repeatable && !!A.nome).map((A) => ({
|
|
5980
6006
|
container: A,
|
|
5981
6007
|
fields: A.campos.filter((le) => !!le.condicional)
|
|
5982
6008
|
})).filter((A) => A.fields.length > 0),
|
|
5983
6009
|
[r.containers]
|
|
5984
|
-
),
|
|
5985
|
-
ue.current = u,
|
|
6010
|
+
), ee = Y({}), B = Y(!0), U = De({ control: C }), ue = Y(u);
|
|
6011
|
+
ue.current = u, Q(() => {
|
|
5986
6012
|
var A;
|
|
5987
|
-
(A = ue.current) == null || A.call(ue,
|
|
5988
|
-
}, [
|
|
6013
|
+
(A = ue.current) == null || A.call(ue, U);
|
|
6014
|
+
}, [U]), Q(() => {
|
|
5989
6015
|
let A = !1;
|
|
5990
|
-
return v(
|
|
5991
|
-
var
|
|
5992
|
-
A || (x(pe), (
|
|
6016
|
+
return v(U).then((pe) => {
|
|
6017
|
+
var P;
|
|
6018
|
+
A || (x(pe), (P = k.current) == null || P.call(k, pe));
|
|
5993
6019
|
}).catch((pe) => {
|
|
5994
6020
|
A || console.error("[StepForm] warnComputer error:", pe);
|
|
5995
6021
|
}), () => {
|
|
5996
6022
|
A = !0;
|
|
5997
6023
|
};
|
|
5998
|
-
}, [
|
|
6024
|
+
}, [U, v]), Q(() => {
|
|
5999
6025
|
var pe;
|
|
6000
|
-
if (!
|
|
6026
|
+
if (!L.length && !$.length && !_.length && !z.length)
|
|
6001
6027
|
return;
|
|
6002
|
-
const A =
|
|
6003
|
-
for (const
|
|
6004
|
-
if (!
|
|
6005
|
-
|
|
6028
|
+
const A = U;
|
|
6029
|
+
for (const P of L)
|
|
6030
|
+
if (!ie(
|
|
6031
|
+
P.condicional,
|
|
6006
6032
|
A,
|
|
6007
6033
|
i
|
|
6008
6034
|
)) {
|
|
6009
|
-
if (
|
|
6010
|
-
const
|
|
6011
|
-
Array.isArray(
|
|
6012
|
-
(
|
|
6013
|
-
(ae) =>
|
|
6035
|
+
if (N(P.nome), P.tipo === y.FIELD_ARRAY) {
|
|
6036
|
+
const W = A[P.nome];
|
|
6037
|
+
Array.isArray(W) && W.forEach((G, te) => {
|
|
6038
|
+
(P.subFields ?? []).forEach(
|
|
6039
|
+
(ae) => N(`${P.nome}.${te}.${ae.nome}`)
|
|
6014
6040
|
);
|
|
6015
6041
|
});
|
|
6016
6042
|
}
|
|
6017
|
-
if (
|
|
6018
|
-
const
|
|
6019
|
-
A[
|
|
6043
|
+
if (P.clearedValue !== void 0) {
|
|
6044
|
+
const W = P.clearedValue ?? "";
|
|
6045
|
+
A[P.nome] !== W && I(P.nome, W, { shouldValidate: !1 });
|
|
6020
6046
|
}
|
|
6021
6047
|
}
|
|
6022
|
-
for (const
|
|
6023
|
-
if (!
|
|
6024
|
-
|
|
6048
|
+
for (const P of _)
|
|
6049
|
+
if (!ie(
|
|
6050
|
+
P.condicional,
|
|
6025
6051
|
A,
|
|
6026
6052
|
i
|
|
6027
6053
|
))
|
|
6028
|
-
if (
|
|
6029
|
-
(Array.isArray(A[
|
|
6030
|
-
for (const ae of
|
|
6031
|
-
|
|
6054
|
+
if (P.repeatable && P.nome)
|
|
6055
|
+
(Array.isArray(A[P.nome]) ? A[P.nome] : []).forEach((G, te) => {
|
|
6056
|
+
for (const ae of P.campos)
|
|
6057
|
+
N(`${P.nome}.${te}.${ae.nome}`);
|
|
6032
6058
|
});
|
|
6033
6059
|
else
|
|
6034
|
-
for (const
|
|
6035
|
-
|
|
6036
|
-
const
|
|
6037
|
-
|
|
6060
|
+
for (const W of P.campos) {
|
|
6061
|
+
N(W.nome);
|
|
6062
|
+
const G = W.clearedValue !== void 0 ? W.clearedValue : void 0;
|
|
6063
|
+
G !== void 0 && A[W.nome] !== G && I(W.nome, G, { shouldValidate: !1 });
|
|
6038
6064
|
}
|
|
6039
|
-
for (const { container:
|
|
6040
|
-
const
|
|
6041
|
-
for (let
|
|
6042
|
-
const ae =
|
|
6043
|
-
for (const
|
|
6044
|
-
if (!
|
|
6045
|
-
|
|
6065
|
+
for (const { container: P, fields: he } of z) {
|
|
6066
|
+
const W = P.nome, G = Array.isArray(A[W]) ? A[W] : [];
|
|
6067
|
+
for (let te = 0; te < G.length; te++) {
|
|
6068
|
+
const ae = G[te];
|
|
6069
|
+
for (const re of he)
|
|
6070
|
+
if (!ie(
|
|
6071
|
+
re.condicional,
|
|
6046
6072
|
ae,
|
|
6047
6073
|
i
|
|
6048
|
-
) && (
|
|
6049
|
-
const Re =
|
|
6050
|
-
ae[
|
|
6074
|
+
) && (N(`${W}.${te}.${re.nome}`), re.clearedValue !== void 0)) {
|
|
6075
|
+
const Re = re.clearedValue ?? "";
|
|
6076
|
+
ae[re.nome] !== Re && I(`${W}.${te}.${re.nome}`, Re, {
|
|
6051
6077
|
shouldValidate: !1
|
|
6052
6078
|
});
|
|
6053
6079
|
}
|
|
6054
6080
|
}
|
|
6055
6081
|
}
|
|
6056
|
-
const le =
|
|
6057
|
-
for (const
|
|
6058
|
-
const he =
|
|
6059
|
-
|
|
6082
|
+
const le = B.current;
|
|
6083
|
+
for (const P of $) {
|
|
6084
|
+
const he = ie(
|
|
6085
|
+
P.condicional,
|
|
6060
6086
|
A,
|
|
6061
6087
|
i
|
|
6062
|
-
),
|
|
6063
|
-
if (he && !
|
|
6064
|
-
for (const
|
|
6065
|
-
const
|
|
6066
|
-
|
|
6088
|
+
), W = le ? he : ee.current[P.nome] ?? !1;
|
|
6089
|
+
if (he && !W && ((pe = P.setValues) != null && pe.length))
|
|
6090
|
+
for (const G of P.setValues) {
|
|
6091
|
+
const te = typeof G.valor == "string" ? se(G.valor, R) : G.valor;
|
|
6092
|
+
I(G.campo, te, { shouldValidate: !1 });
|
|
6067
6093
|
}
|
|
6068
|
-
|
|
6094
|
+
ee.current[P.nome] = he;
|
|
6069
6095
|
}
|
|
6070
|
-
|
|
6096
|
+
B.current = !1;
|
|
6071
6097
|
}, [
|
|
6072
|
-
$,
|
|
6073
|
-
j,
|
|
6074
6098
|
U,
|
|
6075
|
-
|
|
6076
|
-
|
|
6099
|
+
L,
|
|
6100
|
+
$,
|
|
6101
|
+
_,
|
|
6102
|
+
z,
|
|
6077
6103
|
i,
|
|
6078
|
-
|
|
6079
|
-
|
|
6104
|
+
I,
|
|
6105
|
+
N
|
|
6080
6106
|
]);
|
|
6081
|
-
const Ne = E.icone ?
|
|
6107
|
+
const Ne = E.icone ? tt[E.icone] : void 0, ce = M(
|
|
6082
6108
|
() => () => {
|
|
6083
|
-
|
|
6109
|
+
T.handleSubmit(p)();
|
|
6084
6110
|
},
|
|
6085
6111
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
6086
6112
|
[p]
|
|
6087
6113
|
);
|
|
6088
|
-
return /* @__PURE__ */ o(Rr, { ...
|
|
6114
|
+
return /* @__PURE__ */ o(Rr, { ...T, children: /* @__PURE__ */ o(
|
|
6089
6115
|
ua,
|
|
6090
6116
|
{
|
|
6091
6117
|
value: {
|
|
@@ -6096,7 +6122,7 @@ const Kt = (t) => t < 1024 ? `${t} B` : t < 1024 * 1024 ? `${(t / 1024).toFixed(
|
|
|
6096
6122
|
children: /* @__PURE__ */ o(
|
|
6097
6123
|
"form",
|
|
6098
6124
|
{
|
|
6099
|
-
onSubmit:
|
|
6125
|
+
onSubmit: S(p),
|
|
6100
6126
|
noValidate: !0,
|
|
6101
6127
|
onKeyDown: (A) => {
|
|
6102
6128
|
A.key === "Enter" && A.target.tagName === "INPUT" && A.preventDefault();
|
|
@@ -6133,19 +6159,19 @@ const Kt = (t) => t < 1024 ? `${t} B` : t < 1024 * 1024 ? `${(t / 1024).toFixed(
|
|
|
6133
6159
|
ma,
|
|
6134
6160
|
{
|
|
6135
6161
|
step: E,
|
|
6136
|
-
control:
|
|
6162
|
+
control: C,
|
|
6137
6163
|
externalData: i
|
|
6138
6164
|
}
|
|
6139
6165
|
),
|
|
6140
6166
|
/* @__PURE__ */ f("div", { className: "flex items-center justify-between gap-4 pt-6 pb-2", children: [
|
|
6141
6167
|
/* @__PURE__ */ f(
|
|
6142
|
-
|
|
6168
|
+
$e,
|
|
6143
6169
|
{
|
|
6144
6170
|
type: "button",
|
|
6145
6171
|
variant: "outline",
|
|
6146
6172
|
onClick: h,
|
|
6147
6173
|
disabled: t === 0 || c,
|
|
6148
|
-
className:
|
|
6174
|
+
className: O(
|
|
6149
6175
|
t > 0 && !c && "border-primary/40 text-primary hover:bg-primary/5"
|
|
6150
6176
|
),
|
|
6151
6177
|
children: [
|
|
@@ -6159,8 +6185,8 @@ const Kt = (t) => t < 1024 ? `${t} B` : t < 1024 * 1024 ? `${(t / 1024).toFixed(
|
|
|
6159
6185
|
"/",
|
|
6160
6186
|
e
|
|
6161
6187
|
] }),
|
|
6162
|
-
/* @__PURE__ */ f(
|
|
6163
|
-
s ? /* @__PURE__ */ o(
|
|
6188
|
+
/* @__PURE__ */ f($e, { type: "submit", disabled: s || c, children: [
|
|
6189
|
+
s ? /* @__PURE__ */ o(ze, { className: "w-4 h-4 animate-spin" }) : c ? /* @__PURE__ */ o(ze, { className: "w-4 h-4 animate-spin" }) : g ? /* @__PURE__ */ o(Be, { className: "w-4 h-4" }) : /* @__PURE__ */ o(qr, { className: "w-4 h-4" }),
|
|
6164
6190
|
/* @__PURE__ */ o("span", { className: "hidden sm:inline", children: g ? "Finalizar" : "Próximo" })
|
|
6165
6191
|
] })
|
|
6166
6192
|
] }),
|
|
@@ -6170,9 +6196,9 @@ const Kt = (t) => t < 1024 ? `${t} B` : t < 1024 * 1024 ? `${(t / 1024).toFixed(
|
|
|
6170
6196
|
)
|
|
6171
6197
|
}
|
|
6172
6198
|
) });
|
|
6173
|
-
},
|
|
6199
|
+
}, Qe = (t) => {
|
|
6174
6200
|
if (t)
|
|
6175
|
-
return
|
|
6201
|
+
return tt[t];
|
|
6176
6202
|
}, pa = ({
|
|
6177
6203
|
steps: t,
|
|
6178
6204
|
currentStep: e,
|
|
@@ -6184,7 +6210,7 @@ const Kt = (t) => t < 1024 ? `${t} B` : t < 1024 * 1024 ? `${(t / 1024).toFixed(
|
|
|
6184
6210
|
tabIndex: r ? 0 : void 0,
|
|
6185
6211
|
onClick: () => r == null ? void 0 : r(i),
|
|
6186
6212
|
onKeyDown: (a) => a.key === "Enter" && (r == null ? void 0 : r(i)),
|
|
6187
|
-
className:
|
|
6213
|
+
className: O(
|
|
6188
6214
|
"w-8 h-8 rounded-full flex items-center justify-center text-xs font-bold transition-all shrink-0",
|
|
6189
6215
|
r && "cursor-pointer hover:opacity-80"
|
|
6190
6216
|
),
|
|
@@ -6207,7 +6233,7 @@ const Kt = (t) => t < 1024 ? `${t} B` : t < 1024 * 1024 ? `${(t / 1024).toFixed(
|
|
|
6207
6233
|
currentStep: e,
|
|
6208
6234
|
onStepClick: r
|
|
6209
6235
|
}) => /* @__PURE__ */ o("div", { className: "flex items-center justify-center gap-2 flex-wrap", children: t.map((n, i) => {
|
|
6210
|
-
const a =
|
|
6236
|
+
const a = Qe(n.icone) ?? Ye;
|
|
6211
6237
|
return /* @__PURE__ */ o(
|
|
6212
6238
|
"div",
|
|
6213
6239
|
{
|
|
@@ -6215,7 +6241,7 @@ const Kt = (t) => t < 1024 ? `${t} B` : t < 1024 * 1024 ? `${(t / 1024).toFixed(
|
|
|
6215
6241
|
tabIndex: r ? 0 : void 0,
|
|
6216
6242
|
onClick: () => r == null ? void 0 : r(i),
|
|
6217
6243
|
onKeyDown: (s) => s.key === "Enter" && (r == null ? void 0 : r(i)),
|
|
6218
|
-
className:
|
|
6244
|
+
className: O(
|
|
6219
6245
|
"w-9 h-9 rounded-full flex items-center justify-center transition-all shrink-0",
|
|
6220
6246
|
r && "cursor-pointer hover:opacity-80"
|
|
6221
6247
|
),
|
|
@@ -6241,7 +6267,7 @@ const Kt = (t) => t < 1024 ? `${t} B` : t < 1024 * 1024 ? `${(t / 1024).toFixed(
|
|
|
6241
6267
|
orientation: n = "horizontal",
|
|
6242
6268
|
onStepClick: i
|
|
6243
6269
|
}) => n === "vertical" ? /* @__PURE__ */ o("div", { className: "flex flex-col gap-0", children: t.map((a, s) => {
|
|
6244
|
-
const c =
|
|
6270
|
+
const c = Qe(a.icone) ?? Ye, m = s === e, d = s < e, l = s === t.length - 1;
|
|
6245
6271
|
return /* @__PURE__ */ f("div", { className: "flex items-start gap-3", children: [
|
|
6246
6272
|
/* @__PURE__ */ f("div", { className: "flex flex-col items-center", children: [
|
|
6247
6273
|
/* @__PURE__ */ o(
|
|
@@ -6249,7 +6275,7 @@ const Kt = (t) => t < 1024 ? `${t} B` : t < 1024 * 1024 ? `${(t / 1024).toFixed(
|
|
|
6249
6275
|
{
|
|
6250
6276
|
type: "button",
|
|
6251
6277
|
onClick: () => i == null ? void 0 : i(s),
|
|
6252
|
-
className:
|
|
6278
|
+
className: O(
|
|
6253
6279
|
"w-8 h-8 rounded-full flex items-center justify-center transition-all shrink-0",
|
|
6254
6280
|
i && "cursor-pointer hover:opacity-80"
|
|
6255
6281
|
),
|
|
@@ -6286,11 +6312,11 @@ const Kt = (t) => t < 1024 ? `${t} B` : t < 1024 * 1024 ? `${(t / 1024).toFixed(
|
|
|
6286
6312
|
)
|
|
6287
6313
|
] }, a.id);
|
|
6288
6314
|
}) }) : /* @__PURE__ */ o("div", { className: "w-full flex items-start", children: t.map((a, s) => {
|
|
6289
|
-
const c =
|
|
6315
|
+
const c = Qe(a.icone) ?? Ye, m = s === e, d = s < e, l = s === t.length - 1;
|
|
6290
6316
|
return /* @__PURE__ */ f(
|
|
6291
6317
|
"div",
|
|
6292
6318
|
{
|
|
6293
|
-
className:
|
|
6319
|
+
className: O("flex items-start", !l && "flex-1"),
|
|
6294
6320
|
children: [
|
|
6295
6321
|
/* @__PURE__ */ f("div", { className: "flex flex-col items-center gap-1.5 w-[56px] shrink-0 mx-auto", children: [
|
|
6296
6322
|
/* @__PURE__ */ o(
|
|
@@ -6298,7 +6324,7 @@ const Kt = (t) => t < 1024 ? `${t} B` : t < 1024 * 1024 ? `${(t / 1024).toFixed(
|
|
|
6298
6324
|
{
|
|
6299
6325
|
type: "button",
|
|
6300
6326
|
onClick: () => i == null ? void 0 : i(s),
|
|
6301
|
-
className:
|
|
6327
|
+
className: O(
|
|
6302
6328
|
"w-10 h-10 rounded-full flex items-center justify-center transition-all shrink-0",
|
|
6303
6329
|
i && "cursor-pointer hover:opacity-80"
|
|
6304
6330
|
),
|
|
@@ -6349,7 +6375,7 @@ const Kt = (t) => t < 1024 ? `${t} B` : t < 1024 * 1024 ? `${(t / 1024).toFixed(
|
|
|
6349
6375
|
const a = ir(), { layout: s } = a;
|
|
6350
6376
|
if (!s.showStepIndicators || t.length <= 1 && !i)
|
|
6351
6377
|
return null;
|
|
6352
|
-
const c = s.stepIndicatorVariant ?? "numbers", m = s.stepIndicatorPosition ?? "top-center", d = s.stepIndicatorOrientation ?? "horizontal", l = (e + 1) / t.length * 100, u = t[e], p =
|
|
6378
|
+
const c = s.stepIndicatorVariant ?? "numbers", m = s.stepIndicatorPosition ?? "top-center", d = s.stepIndicatorOrientation ?? "horizontal", l = (e + 1) / t.length * 100, u = t[e], p = Qe(u == null ? void 0 : u.icone) ?? Ye, h = /* @__PURE__ */ o(
|
|
6353
6379
|
"div",
|
|
6354
6380
|
{
|
|
6355
6381
|
className: "h-1 rounded-full overflow-hidden",
|
|
@@ -6402,7 +6428,7 @@ const Kt = (t) => t < 1024 ? `${t} B` : t < 1024 * 1024 ? `${(t / 1024).toFixed(
|
|
|
6402
6428
|
] })
|
|
6403
6429
|
] }),
|
|
6404
6430
|
h
|
|
6405
|
-
] }),
|
|
6431
|
+
] }), F = /* @__PURE__ */ f("div", { className: "hidden sm:block", children: [
|
|
6406
6432
|
c === "numbers" && /* @__PURE__ */ o(
|
|
6407
6433
|
pa,
|
|
6408
6434
|
{
|
|
@@ -6430,16 +6456,16 @@ const Kt = (t) => t < 1024 ? `${t} B` : t < 1024 * 1024 ? `${(t / 1024).toFixed(
|
|
|
6430
6456
|
}
|
|
6431
6457
|
)
|
|
6432
6458
|
] }), w = s.showProgressBar ? /* @__PURE__ */ o("div", { className: "hidden sm:block", children: h }) : null;
|
|
6433
|
-
return d === "vertical" ? /* @__PURE__ */ f("div", { className:
|
|
6459
|
+
return d === "vertical" ? /* @__PURE__ */ f("div", { className: O("flex gap-6 items-start", n), children: [
|
|
6434
6460
|
g,
|
|
6435
6461
|
/* @__PURE__ */ f("div", { className: "hidden sm:flex gap-6 items-start shrink-0", children: [
|
|
6436
|
-
|
|
6462
|
+
F,
|
|
6437
6463
|
w && /* @__PURE__ */ o("div", { className: "flex-1 pt-4", children: w })
|
|
6438
6464
|
] })
|
|
6439
|
-
] }) : /* @__PURE__ */ f("div", { className:
|
|
6465
|
+
] }) : /* @__PURE__ */ f("div", { className: O("space-y-3", n), children: [
|
|
6440
6466
|
g,
|
|
6441
6467
|
/* @__PURE__ */ f("div", { className: "hidden sm:block space-y-3", children: [
|
|
6442
|
-
|
|
6468
|
+
F,
|
|
6443
6469
|
w
|
|
6444
6470
|
] })
|
|
6445
6471
|
] });
|
|
@@ -6484,149 +6510,149 @@ const Kt = (t) => t < 1024 ? `${t} B` : t < 1024 * 1024 ? `${(t / 1024).toFixed(
|
|
|
6484
6510
|
resolveTermsUploadUrl: p,
|
|
6485
6511
|
fieldResolvers: h,
|
|
6486
6512
|
validatorMapper: g,
|
|
6487
|
-
componentMapper:
|
|
6513
|
+
componentMapper: F,
|
|
6488
6514
|
paymentMethodOptions: w,
|
|
6489
6515
|
onValuesChange: v,
|
|
6490
6516
|
className: b,
|
|
6491
6517
|
StepIndicator: x = ga
|
|
6492
6518
|
}) => {
|
|
6493
|
-
const [
|
|
6519
|
+
const [k, R] = j(() => r), [E, T] = j({
|
|
6494
6520
|
...e
|
|
6495
|
-
}), [
|
|
6521
|
+
}), [C, S] = j(() => r), [D, N] = j(!1), [I, L] = j(null), [_, $] = j(
|
|
6496
6522
|
{}
|
|
6497
|
-
), [
|
|
6498
|
-
|
|
6499
|
-
}, []), ue =
|
|
6500
|
-
|
|
6523
|
+
), [z, ee] = j(!1), B = Y(0), U = J(() => {
|
|
6524
|
+
B.current += 1, B.current === 1 && Dt(() => ee(!0));
|
|
6525
|
+
}, []), ue = J(() => {
|
|
6526
|
+
B.current = Math.max(0, B.current - 1), B.current === 0 && Dt(() => ee(!1));
|
|
6501
6527
|
}, []), Ne = Y(p);
|
|
6502
6528
|
Ne.current = p;
|
|
6503
|
-
const ce =
|
|
6504
|
-
(
|
|
6529
|
+
const ce = J(
|
|
6530
|
+
(q) => Ne.current(q),
|
|
6505
6531
|
[]
|
|
6506
6532
|
), A = !!p, le = Y(l);
|
|
6507
6533
|
le.current = l;
|
|
6508
|
-
const pe =
|
|
6509
|
-
(
|
|
6534
|
+
const pe = J(
|
|
6535
|
+
(q) => le.current(q),
|
|
6510
6536
|
[]
|
|
6511
|
-
),
|
|
6537
|
+
), P = !!l, he = M(
|
|
6512
6538
|
() => JSON.stringify(c),
|
|
6513
6539
|
[c]
|
|
6514
|
-
),
|
|
6540
|
+
), W = M(
|
|
6515
6541
|
() => JSON.stringify(t.stepConfig),
|
|
6516
6542
|
[t.stepConfig]
|
|
6517
|
-
),
|
|
6518
|
-
const
|
|
6519
|
-
return t.stepConfig ? { ...
|
|
6520
|
-
}, [a,
|
|
6521
|
-
() => [...t.steps].sort((
|
|
6543
|
+
), G = M(() => {
|
|
6544
|
+
const q = Tr(a);
|
|
6545
|
+
return t.stepConfig ? { ...q, layout: { ...q.layout, ...t.stepConfig } } : q;
|
|
6546
|
+
}, [a, W]), te = M(
|
|
6547
|
+
() => [...t.steps].sort((q, we) => q.ordem - we.ordem),
|
|
6522
6548
|
[t.steps]
|
|
6523
|
-
), ae =
|
|
6524
|
-
() =>
|
|
6549
|
+
), ae = te.length, re = ae > 0 ? te[Math.min(k, ae - 1)] : null, nt = M(
|
|
6550
|
+
() => re ? ba(re, E, c) : {},
|
|
6525
6551
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
6526
|
-
[
|
|
6527
|
-
), Re =
|
|
6552
|
+
[re, E, he]
|
|
6553
|
+
), Re = M(
|
|
6528
6554
|
() => ({
|
|
6529
6555
|
uploadFile: d,
|
|
6530
|
-
deleteUploadedFile:
|
|
6556
|
+
deleteUploadedFile: P ? pe : void 0,
|
|
6531
6557
|
cepLookup: u,
|
|
6532
6558
|
resolveTermsUploadUrl: A ? ce : void 0,
|
|
6533
6559
|
externalData: c,
|
|
6534
6560
|
fieldResolvers: h,
|
|
6535
6561
|
validatorMapper: g,
|
|
6536
|
-
fieldWarnings:
|
|
6537
|
-
componentMapper:
|
|
6562
|
+
fieldWarnings: _,
|
|
6563
|
+
componentMapper: F,
|
|
6538
6564
|
paymentMethodOptions: w,
|
|
6539
|
-
onUploadStart:
|
|
6565
|
+
onUploadStart: U,
|
|
6540
6566
|
onUploadEnd: ue
|
|
6541
6567
|
}),
|
|
6542
6568
|
[
|
|
6543
6569
|
d,
|
|
6544
|
-
|
|
6570
|
+
P,
|
|
6545
6571
|
pe,
|
|
6546
6572
|
u,
|
|
6547
6573
|
ce,
|
|
6548
6574
|
A,
|
|
6549
6575
|
h,
|
|
6550
6576
|
g,
|
|
6551
|
-
|
|
6552
|
-
|
|
6577
|
+
_,
|
|
6578
|
+
F,
|
|
6553
6579
|
w,
|
|
6554
|
-
|
|
6580
|
+
U,
|
|
6555
6581
|
ue,
|
|
6556
6582
|
he
|
|
6557
6583
|
]
|
|
6558
|
-
), kt =
|
|
6559
|
-
async (
|
|
6560
|
-
if (!
|
|
6561
|
-
|
|
6584
|
+
), kt = J(
|
|
6585
|
+
async (q) => {
|
|
6586
|
+
if (!D) {
|
|
6587
|
+
N(!0), L(null);
|
|
6562
6588
|
try {
|
|
6563
|
-
const { cleaned: we, fileIdsToDelete:
|
|
6564
|
-
|
|
6565
|
-
|
|
6589
|
+
const { cleaned: we, fileIdsToDelete: We } = dn(
|
|
6590
|
+
re,
|
|
6591
|
+
q,
|
|
6566
6592
|
c
|
|
6567
6593
|
);
|
|
6568
|
-
|
|
6569
|
-
|
|
6594
|
+
We.length && l && await Promise.allSettled(
|
|
6595
|
+
We.map((qe) => l(qe))
|
|
6570
6596
|
);
|
|
6571
6597
|
const St = { ...E, ...we };
|
|
6572
|
-
if (
|
|
6598
|
+
if (T(St), n && await n(k, we), k === ae - 1)
|
|
6573
6599
|
i && await i(St);
|
|
6574
6600
|
else {
|
|
6575
|
-
const
|
|
6576
|
-
R(
|
|
6601
|
+
const qe = k + 1;
|
|
6602
|
+
R(qe), S((Dr) => Math.max(Dr, qe));
|
|
6577
6603
|
}
|
|
6578
6604
|
} catch (we) {
|
|
6579
6605
|
console.error("[FormRenderer] Submit error:", we);
|
|
6580
|
-
const
|
|
6581
|
-
|
|
6606
|
+
const We = we instanceof Error ? we.message : "Ocorreu um erro. Tente novamente.";
|
|
6607
|
+
L(We);
|
|
6582
6608
|
} finally {
|
|
6583
|
-
|
|
6609
|
+
N(!1);
|
|
6584
6610
|
}
|
|
6585
6611
|
}
|
|
6586
6612
|
},
|
|
6587
6613
|
[
|
|
6588
|
-
|
|
6614
|
+
k,
|
|
6589
6615
|
E,
|
|
6590
|
-
|
|
6616
|
+
D,
|
|
6591
6617
|
ae,
|
|
6592
6618
|
n,
|
|
6593
6619
|
i,
|
|
6594
|
-
|
|
6620
|
+
re,
|
|
6595
6621
|
c,
|
|
6596
6622
|
l
|
|
6597
6623
|
]
|
|
6598
|
-
), Nt =
|
|
6599
|
-
|
|
6600
|
-
}, [
|
|
6601
|
-
if (!
|
|
6602
|
-
return /* @__PURE__ */ o(
|
|
6624
|
+
), Nt = J(() => {
|
|
6625
|
+
k > 0 && R((q) => q - 1);
|
|
6626
|
+
}, [k]);
|
|
6627
|
+
if (!re)
|
|
6628
|
+
return /* @__PURE__ */ o(mt.Provider, { value: Re, children: /* @__PURE__ */ o(
|
|
6603
6629
|
Et,
|
|
6604
6630
|
{
|
|
6605
|
-
config:
|
|
6606
|
-
className: `min-h-dvh ${
|
|
6631
|
+
config: G,
|
|
6632
|
+
className: `min-h-dvh ${G.wrapperClass ?? ""} ${b ?? ""}`,
|
|
6607
6633
|
renderWrapper: !0,
|
|
6608
6634
|
children: /* @__PURE__ */ o("div", { className: "w-full max-w-4xl mx-auto px-4 py-6 sm:px-6 text-center text-muted-foreground", children: "Nenhum step configurado." })
|
|
6609
6635
|
}
|
|
6610
6636
|
) });
|
|
6611
|
-
const Ft =
|
|
6637
|
+
const Ft = G.layout.eventTitleStyle ?? "bar", Sr = (G.layout.stepIndicatorOrientation ?? "horizontal") === "vertical", _e = ae >= 1 ? /* @__PURE__ */ o(
|
|
6612
6638
|
x,
|
|
6613
6639
|
{
|
|
6614
|
-
steps:
|
|
6615
|
-
id:
|
|
6616
|
-
label:
|
|
6617
|
-
icone:
|
|
6640
|
+
steps: te.map((q) => ({
|
|
6641
|
+
id: q.id,
|
|
6642
|
+
label: q.titulo,
|
|
6643
|
+
icone: q.icone
|
|
6618
6644
|
})),
|
|
6619
|
-
currentStep:
|
|
6620
|
-
onStepClick: (
|
|
6621
|
-
!
|
|
6645
|
+
currentStep: k,
|
|
6646
|
+
onStepClick: (q) => {
|
|
6647
|
+
!z && q !== k && q <= C && R(q);
|
|
6622
6648
|
}
|
|
6623
6649
|
}
|
|
6624
6650
|
) : null;
|
|
6625
|
-
return /* @__PURE__ */ o(
|
|
6651
|
+
return /* @__PURE__ */ o(mt.Provider, { value: Re, children: /* @__PURE__ */ o(
|
|
6626
6652
|
Et,
|
|
6627
6653
|
{
|
|
6628
|
-
config:
|
|
6629
|
-
className: `min-h-dvh ${
|
|
6654
|
+
config: G,
|
|
6655
|
+
className: `min-h-dvh ${G.wrapperClass ?? ""} ${b ?? ""}`,
|
|
6630
6656
|
renderWrapper: !0,
|
|
6631
6657
|
children: /* @__PURE__ */ f("div", { className: "w-full max-w-4xl mx-auto px-4 py-6 sm:px-6", children: [
|
|
6632
6658
|
s && Ft === "bar" && /* @__PURE__ */ o("div", { className: "w-full text-center text-sm font-medium py-2.5 px-4 mb-6 rounded-lg border border-input text-muted-foreground bg-muted/30", children: s }),
|
|
@@ -6658,54 +6684,54 @@ const Kt = (t) => t < 1024 ? `${t} B` : t < 1024 * 1024 ? `${(t / 1024).toFixed(
|
|
|
6658
6684
|
Sr ? (
|
|
6659
6685
|
/* Sidebar layout — indicator on the left, form on the right */
|
|
6660
6686
|
/* @__PURE__ */ f("div", { className: "flex gap-6 items-start", children: [
|
|
6661
|
-
/* @__PURE__ */ o("div", { className: "hidden sm:block shrink-0 w-44 pt-1", children:
|
|
6687
|
+
/* @__PURE__ */ o("div", { className: "hidden sm:block shrink-0 w-44 pt-1", children: _e }),
|
|
6662
6688
|
/* @__PURE__ */ f("div", { className: "flex-1 min-w-0", children: [
|
|
6663
|
-
/* @__PURE__ */ o("div", { className: "sm:hidden mb-6", children:
|
|
6689
|
+
/* @__PURE__ */ o("div", { className: "sm:hidden mb-6", children: _e }),
|
|
6664
6690
|
/* @__PURE__ */ o(
|
|
6665
6691
|
rr,
|
|
6666
6692
|
{
|
|
6667
|
-
stepIndex:
|
|
6693
|
+
stepIndex: k,
|
|
6668
6694
|
totalSteps: ae,
|
|
6669
|
-
step:
|
|
6670
|
-
defaultValues:
|
|
6695
|
+
step: re,
|
|
6696
|
+
defaultValues: nt,
|
|
6671
6697
|
externalData: c,
|
|
6672
6698
|
fieldErrors: m,
|
|
6673
|
-
isSubmitting:
|
|
6674
|
-
isUploading:
|
|
6675
|
-
submitError:
|
|
6699
|
+
isSubmitting: D,
|
|
6700
|
+
isUploading: z,
|
|
6701
|
+
submitError: I,
|
|
6676
6702
|
validatorMapper: g,
|
|
6677
|
-
onWarningsChange:
|
|
6703
|
+
onWarningsChange: $,
|
|
6678
6704
|
onValuesChange: v,
|
|
6679
6705
|
onSubmit: kt,
|
|
6680
6706
|
onBack: Nt
|
|
6681
6707
|
},
|
|
6682
|
-
|
|
6708
|
+
k
|
|
6683
6709
|
)
|
|
6684
6710
|
] })
|
|
6685
6711
|
] })
|
|
6686
6712
|
) : (
|
|
6687
6713
|
/* Default top layout */
|
|
6688
6714
|
/* @__PURE__ */ f(Oe, { children: [
|
|
6689
|
-
|
|
6715
|
+
_e && /* @__PURE__ */ o("div", { className: "mb-8", children: _e }),
|
|
6690
6716
|
/* @__PURE__ */ o(
|
|
6691
6717
|
rr,
|
|
6692
6718
|
{
|
|
6693
|
-
stepIndex:
|
|
6719
|
+
stepIndex: k,
|
|
6694
6720
|
totalSteps: ae,
|
|
6695
|
-
step:
|
|
6696
|
-
defaultValues:
|
|
6721
|
+
step: re,
|
|
6722
|
+
defaultValues: nt,
|
|
6697
6723
|
externalData: c,
|
|
6698
6724
|
fieldErrors: m,
|
|
6699
|
-
isSubmitting:
|
|
6700
|
-
isUploading:
|
|
6701
|
-
submitError:
|
|
6725
|
+
isSubmitting: D,
|
|
6726
|
+
isUploading: z,
|
|
6727
|
+
submitError: I,
|
|
6702
6728
|
validatorMapper: g,
|
|
6703
|
-
onWarningsChange:
|
|
6729
|
+
onWarningsChange: $,
|
|
6704
6730
|
onValuesChange: v,
|
|
6705
6731
|
onSubmit: kt,
|
|
6706
6732
|
onBack: Nt
|
|
6707
6733
|
},
|
|
6708
|
-
|
|
6734
|
+
k
|
|
6709
6735
|
)
|
|
6710
6736
|
] })
|
|
6711
6737
|
)
|
|
@@ -6718,7 +6744,7 @@ const Kt = (t) => t < 1024 ? `${t} B` : t < 1024 * 1024 ? `${(t / 1024).toFixed(
|
|
|
6718
6744
|
onChange: r
|
|
6719
6745
|
}) => {
|
|
6720
6746
|
const n = fa(), i = Y(r);
|
|
6721
|
-
return i.current = r,
|
|
6747
|
+
return i.current = r, Q(() => {
|
|
6722
6748
|
var a;
|
|
6723
6749
|
(a = i.current) == null || a.call(i, n);
|
|
6724
6750
|
}, [
|
|
@@ -6738,7 +6764,7 @@ export {
|
|
|
6738
6764
|
wr as DFCepField,
|
|
6739
6765
|
gt as DFCheckbox,
|
|
6740
6766
|
ur as DFCheckboxGroup,
|
|
6741
|
-
|
|
6767
|
+
Me as DFDateField,
|
|
6742
6768
|
_i as DFFieldArray,
|
|
6743
6769
|
vr as DFFileUpload,
|
|
6744
6770
|
Ct as DFHidden,
|
|
@@ -6755,7 +6781,7 @@ export {
|
|
|
6755
6781
|
Ba as FormSpy,
|
|
6756
6782
|
Ki as OPCOES_POR_DIA,
|
|
6757
6783
|
Xi as OPCOES_TODOS_OS_DIAS,
|
|
6758
|
-
|
|
6784
|
+
mt as RendererContext,
|
|
6759
6785
|
ma as StepRenderer,
|
|
6760
6786
|
Oa as evaluateFieldCondition,
|
|
6761
6787
|
se as interpolate,
|