@schema-forms-data/renderer 0.3.21

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js ADDED
@@ -0,0 +1,4244 @@
1
+ import { jsxs as m, jsx as i, Fragment as Ee } from "react/jsx-runtime";
2
+ import { createContext as hr, useContext as ve, useState as F, useRef as te, useCallback as oe, useEffect as q, useMemo as R } from "react";
3
+ import { useController as P, useFormContext as be, useFieldArray as gr, useFormState as Kr, useWatch as de, useForm as Wr, FormProvider as Gr } from "react-hook-form";
4
+ import { useTemplate as qr, getTemplateConfig as Yr, TemplateProvider as Qr } from "@schema-forms-data/templates";
5
+ import { FieldType as h } from "@schema-forms-data/core";
6
+ import * as Te from "lucide-react";
7
+ import { Trash2 as yr, Plus as vr, AlertCircle as br, CalendarCheck2 as et, Users as rt, CalendarDays as tt, Info as Nr, Smartphone as De, Banknote as _r, CreditCard as xr, ScrollText as He, Loader2 as wr, ExternalLink as nt, CheckCircle2 as st, X as Cr, EyeOff as ot, Eye as at, ChevronDown as it, Star as ct, Check as zr, ChevronLeft as lt, ChevronRight as dt } from "lucide-react";
8
+ function S(e, r, n) {
9
+ function t(c, l) {
10
+ if (c._zod || Object.defineProperty(c, "_zod", {
11
+ value: {
12
+ def: l,
13
+ constr: a,
14
+ traits: /* @__PURE__ */ new Set()
15
+ },
16
+ enumerable: !1
17
+ }), c._zod.traits.has(e))
18
+ return;
19
+ c._zod.traits.add(e), r(c, l);
20
+ const d = a.prototype, f = Object.keys(d);
21
+ for (let u = 0; u < f.length; u++) {
22
+ const y = f[u];
23
+ y in c || (c[y] = d[y].bind(c));
24
+ }
25
+ }
26
+ const s = (n == null ? void 0 : n.Parent) ?? Object;
27
+ class o extends s {
28
+ }
29
+ Object.defineProperty(o, "name", { value: e });
30
+ function a(c) {
31
+ var l;
32
+ const d = n != null && n.Parent ? new o() : this;
33
+ t(d, c), (l = d._zod).deferred ?? (l.deferred = []);
34
+ for (const f of d._zod.deferred)
35
+ f();
36
+ return d;
37
+ }
38
+ return Object.defineProperty(a, "init", { value: t }), Object.defineProperty(a, Symbol.hasInstance, {
39
+ value: (c) => {
40
+ var l, d;
41
+ return n != null && n.Parent && c instanceof n.Parent ? !0 : (d = (l = c == null ? void 0 : c._zod) == null ? void 0 : l.traits) == null ? void 0 : d.has(e);
42
+ }
43
+ }), Object.defineProperty(a, "name", { value: e }), a;
44
+ }
45
+ class me extends Error {
46
+ constructor() {
47
+ super("Encountered Promise during synchronous parse. Use .parseAsync() instead.");
48
+ }
49
+ }
50
+ class Er extends Error {
51
+ constructor(r) {
52
+ super(`Encountered unidirectional transform during encode: ${r}`), this.name = "ZodEncodeError";
53
+ }
54
+ }
55
+ const ut = {};
56
+ function ce(e) {
57
+ return ut;
58
+ }
59
+ function Ae(e, r) {
60
+ return typeof r == "bigint" ? r.toString() : r;
61
+ }
62
+ function Fe(e) {
63
+ return e == null;
64
+ }
65
+ function je(e) {
66
+ const r = e.startsWith("^") ? 1 : 0, n = e.endsWith("$") ? e.length - 1 : e.length;
67
+ return e.slice(r, n);
68
+ }
69
+ const Ke = Symbol("evaluating");
70
+ function $(e, r, n) {
71
+ let t;
72
+ Object.defineProperty(e, r, {
73
+ get() {
74
+ if (t !== Ke)
75
+ return t === void 0 && (t = Ke, t = n()), t;
76
+ },
77
+ set(s) {
78
+ Object.defineProperty(e, r, {
79
+ value: s
80
+ // configurable: true,
81
+ });
82
+ },
83
+ configurable: !0
84
+ });
85
+ }
86
+ function ft(...e) {
87
+ const r = {};
88
+ for (const n of e) {
89
+ const t = Object.getOwnPropertyDescriptors(n);
90
+ Object.assign(r, t);
91
+ }
92
+ return Object.defineProperties({}, r);
93
+ }
94
+ const Sr = "captureStackTrace" in Error ? Error.captureStackTrace : (...e) => {
95
+ };
96
+ function We(e) {
97
+ return typeof e == "object" && e !== null && !Array.isArray(e);
98
+ }
99
+ function Ie(e) {
100
+ if (We(e) === !1)
101
+ return !1;
102
+ const r = e.constructor;
103
+ if (r === void 0 || typeof r != "function")
104
+ return !0;
105
+ const n = r.prototype;
106
+ return !(We(n) === !1 || Object.prototype.hasOwnProperty.call(n, "isPrototypeOf") === !1);
107
+ }
108
+ function Or(e) {
109
+ return Ie(e) ? { ...e } : Array.isArray(e) ? [...e] : e;
110
+ }
111
+ function mt(e, r, n) {
112
+ const t = new e._zod.constr(r ?? e._zod.def);
113
+ return (!r || n != null && n.parent) && (t._zod.parent = e), t;
114
+ }
115
+ function ae(e) {
116
+ const r = e;
117
+ if (!r)
118
+ return {};
119
+ if (typeof r == "string")
120
+ return { error: () => r };
121
+ if ((r == null ? void 0 : r.message) !== void 0) {
122
+ if ((r == null ? void 0 : r.error) !== void 0)
123
+ throw new Error("Cannot specify both `message` and `error` params");
124
+ r.error = r.message;
125
+ }
126
+ return delete r.message, typeof r.error == "string" ? { ...r, error: () => r.error } : r;
127
+ }
128
+ function fe(e, r = 0) {
129
+ var n;
130
+ if (e.aborted === !0)
131
+ return !0;
132
+ for (let t = r; t < e.issues.length; t++)
133
+ if (((n = e.issues[t]) == null ? void 0 : n.continue) !== !0)
134
+ return !0;
135
+ return !1;
136
+ }
137
+ function pt(e, r) {
138
+ return r.map((n) => {
139
+ var t;
140
+ return (t = n).path ?? (t.path = []), n.path.unshift(e), n;
141
+ });
142
+ }
143
+ function xe(e) {
144
+ return typeof e == "string" ? e : e == null ? void 0 : e.message;
145
+ }
146
+ function le(e, r, n) {
147
+ var s, o, a, c, l, d;
148
+ const t = { ...e, path: e.path ?? [] };
149
+ if (!e.message) {
150
+ const f = xe((a = (o = (s = e.inst) == null ? void 0 : s._zod.def) == null ? void 0 : o.error) == null ? void 0 : a.call(o, e)) ?? xe((c = r == null ? void 0 : r.error) == null ? void 0 : c.call(r, e)) ?? xe((l = n.customError) == null ? void 0 : l.call(n, e)) ?? xe((d = n.localeError) == null ? void 0 : d.call(n, e)) ?? "Invalid input";
151
+ t.message = f;
152
+ }
153
+ return delete t.inst, delete t.continue, r != null && r.reportInput || delete t.input, t;
154
+ }
155
+ function Ze(e) {
156
+ return Array.isArray(e) ? "array" : typeof e == "string" ? "string" : "unknown";
157
+ }
158
+ function ge(...e) {
159
+ const [r, n, t] = e;
160
+ return typeof r == "string" ? {
161
+ message: r,
162
+ code: "custom",
163
+ input: n,
164
+ inst: t
165
+ } : { ...r };
166
+ }
167
+ const Tr = (e, r) => {
168
+ e.name = "$ZodError", Object.defineProperty(e, "_zod", {
169
+ value: e._zod,
170
+ enumerable: !1
171
+ }), Object.defineProperty(e, "issues", {
172
+ value: r,
173
+ enumerable: !1
174
+ }), e.message = JSON.stringify(r, Ae, 2), Object.defineProperty(e, "toString", {
175
+ value: () => e.message,
176
+ enumerable: !1
177
+ });
178
+ }, $r = S("$ZodError", Tr), kr = S("$ZodError", Tr, { Parent: Error });
179
+ function ht(e, r = (n) => n.message) {
180
+ const n = {}, t = [];
181
+ for (const s of e.issues)
182
+ s.path.length > 0 ? (n[s.path[0]] = n[s.path[0]] || [], n[s.path[0]].push(r(s))) : t.push(r(s));
183
+ return { formErrors: t, fieldErrors: n };
184
+ }
185
+ function gt(e, r = (n) => n.message) {
186
+ const n = { _errors: [] }, t = (s) => {
187
+ for (const o of s.issues)
188
+ if (o.code === "invalid_union" && o.errors.length)
189
+ o.errors.map((a) => t({ issues: a }));
190
+ else if (o.code === "invalid_key")
191
+ t({ issues: o.issues });
192
+ else if (o.code === "invalid_element")
193
+ t({ issues: o.issues });
194
+ else if (o.path.length === 0)
195
+ n._errors.push(r(o));
196
+ else {
197
+ let a = n, c = 0;
198
+ for (; c < o.path.length; ) {
199
+ const l = o.path[c];
200
+ c === o.path.length - 1 ? (a[l] = a[l] || { _errors: [] }, a[l]._errors.push(r(o))) : a[l] = a[l] || { _errors: [] }, a = a[l], c++;
201
+ }
202
+ }
203
+ };
204
+ return t(e), n;
205
+ }
206
+ const Le = (e) => (r, n, t, s) => {
207
+ const o = t ? Object.assign(t, { async: !1 }) : { async: !1 }, a = r._zod.run({ value: n, issues: [] }, o);
208
+ if (a instanceof Promise)
209
+ throw new me();
210
+ if (a.issues.length) {
211
+ const c = new ((s == null ? void 0 : s.Err) ?? e)(a.issues.map((l) => le(l, o, ce())));
212
+ throw Sr(c, s == null ? void 0 : s.callee), c;
213
+ }
214
+ return a.value;
215
+ }, Me = (e) => async (r, n, t, s) => {
216
+ const o = t ? Object.assign(t, { async: !0 }) : { async: !0 };
217
+ let a = r._zod.run({ value: n, issues: [] }, o);
218
+ if (a instanceof Promise && (a = await a), a.issues.length) {
219
+ const c = new ((s == null ? void 0 : s.Err) ?? e)(a.issues.map((l) => le(l, o, ce())));
220
+ throw Sr(c, s == null ? void 0 : s.callee), c;
221
+ }
222
+ return a.value;
223
+ }, $e = (e) => (r, n, t) => {
224
+ const s = t ? { ...t, async: !1 } : { async: !1 }, o = r._zod.run({ value: n, issues: [] }, s);
225
+ if (o instanceof Promise)
226
+ throw new me();
227
+ return o.issues.length ? {
228
+ success: !1,
229
+ error: new (e ?? $r)(o.issues.map((a) => le(a, s, ce())))
230
+ } : { success: !0, data: o.value };
231
+ }, yt = /* @__PURE__ */ $e(kr), ke = (e) => async (r, n, t) => {
232
+ const s = t ? Object.assign(t, { async: !0 }) : { async: !0 };
233
+ let o = r._zod.run({ value: n, issues: [] }, s);
234
+ return o instanceof Promise && (o = await o), o.issues.length ? {
235
+ success: !1,
236
+ error: new e(o.issues.map((a) => le(a, s, ce())))
237
+ } : { success: !0, data: o.value };
238
+ }, vt = /* @__PURE__ */ ke(kr), bt = (e) => (r, n, t) => {
239
+ const s = t ? Object.assign(t, { direction: "backward" }) : { direction: "backward" };
240
+ return Le(e)(r, n, s);
241
+ }, Nt = (e) => (r, n, t) => Le(e)(r, n, t), _t = (e) => async (r, n, t) => {
242
+ const s = t ? Object.assign(t, { direction: "backward" }) : { direction: "backward" };
243
+ return Me(e)(r, n, s);
244
+ }, xt = (e) => async (r, n, t) => Me(e)(r, n, t), wt = (e) => (r, n, t) => {
245
+ const s = t ? Object.assign(t, { direction: "backward" }) : { direction: "backward" };
246
+ return $e(e)(r, n, s);
247
+ }, Ct = (e) => (r, n, t) => $e(e)(r, n, t), zt = (e) => async (r, n, t) => {
248
+ const s = t ? Object.assign(t, { direction: "backward" }) : { direction: "backward" };
249
+ return ke(e)(r, n, s);
250
+ }, Et = (e) => async (r, n, t) => ke(e)(r, n, t), pe = /* @__PURE__ */ S("$ZodCheck", (e, r) => {
251
+ var n;
252
+ e._zod ?? (e._zod = {}), e._zod.def = r, (n = e._zod).onattach ?? (n.onattach = []);
253
+ }), St = /* @__PURE__ */ S("$ZodCheckMaxLength", (e, r) => {
254
+ var n;
255
+ pe.init(e, r), (n = e._zod.def).when ?? (n.when = (t) => {
256
+ const s = t.value;
257
+ return !Fe(s) && s.length !== void 0;
258
+ }), e._zod.onattach.push((t) => {
259
+ const s = t._zod.bag.maximum ?? Number.POSITIVE_INFINITY;
260
+ r.maximum < s && (t._zod.bag.maximum = r.maximum);
261
+ }), e._zod.check = (t) => {
262
+ const s = t.value;
263
+ if (s.length <= r.maximum)
264
+ return;
265
+ const a = Ze(s);
266
+ t.issues.push({
267
+ origin: a,
268
+ code: "too_big",
269
+ maximum: r.maximum,
270
+ inclusive: !0,
271
+ input: s,
272
+ inst: e,
273
+ continue: !r.abort
274
+ });
275
+ };
276
+ }), Ot = /* @__PURE__ */ S("$ZodCheckMinLength", (e, r) => {
277
+ var n;
278
+ pe.init(e, r), (n = e._zod.def).when ?? (n.when = (t) => {
279
+ const s = t.value;
280
+ return !Fe(s) && s.length !== void 0;
281
+ }), e._zod.onattach.push((t) => {
282
+ const s = t._zod.bag.minimum ?? Number.NEGATIVE_INFINITY;
283
+ r.minimum > s && (t._zod.bag.minimum = r.minimum);
284
+ }), e._zod.check = (t) => {
285
+ const s = t.value;
286
+ if (s.length >= r.minimum)
287
+ return;
288
+ const a = Ze(s);
289
+ t.issues.push({
290
+ origin: a,
291
+ code: "too_small",
292
+ minimum: r.minimum,
293
+ inclusive: !0,
294
+ input: s,
295
+ inst: e,
296
+ continue: !r.abort
297
+ });
298
+ };
299
+ }), Tt = /* @__PURE__ */ S("$ZodCheckLengthEquals", (e, r) => {
300
+ var n;
301
+ pe.init(e, r), (n = e._zod.def).when ?? (n.when = (t) => {
302
+ const s = t.value;
303
+ return !Fe(s) && s.length !== void 0;
304
+ }), e._zod.onattach.push((t) => {
305
+ const s = t._zod.bag;
306
+ s.minimum = r.length, s.maximum = r.length, s.length = r.length;
307
+ }), e._zod.check = (t) => {
308
+ const s = t.value, o = s.length;
309
+ if (o === r.length)
310
+ return;
311
+ const a = Ze(s), c = o > r.length;
312
+ t.issues.push({
313
+ origin: a,
314
+ ...c ? { code: "too_big", maximum: r.length } : { code: "too_small", minimum: r.length },
315
+ inclusive: !0,
316
+ exact: !0,
317
+ input: t.value,
318
+ inst: e,
319
+ continue: !r.abort
320
+ });
321
+ };
322
+ }), $t = /* @__PURE__ */ S("$ZodCheckOverwrite", (e, r) => {
323
+ pe.init(e, r), e._zod.check = (n) => {
324
+ n.value = r.tx(n.value);
325
+ };
326
+ }), kt = {
327
+ major: 4,
328
+ minor: 3,
329
+ patch: 6
330
+ }, Z = /* @__PURE__ */ S("$ZodType", (e, r) => {
331
+ var s;
332
+ var n;
333
+ e ?? (e = {}), e._zod.def = r, e._zod.bag = e._zod.bag || {}, e._zod.version = kt;
334
+ const t = [...e._zod.def.checks ?? []];
335
+ e._zod.traits.has("$ZodCheck") && t.unshift(e);
336
+ for (const o of t)
337
+ for (const a of o._zod.onattach)
338
+ a(e);
339
+ if (t.length === 0)
340
+ (n = e._zod).deferred ?? (n.deferred = []), (s = e._zod.deferred) == null || s.push(() => {
341
+ e._zod.run = e._zod.parse;
342
+ });
343
+ else {
344
+ const o = (c, l, d) => {
345
+ let f = fe(c), u;
346
+ for (const y of l) {
347
+ if (y._zod.def.when) {
348
+ if (!y._zod.def.when(c))
349
+ continue;
350
+ } else if (f)
351
+ continue;
352
+ const v = c.issues.length, N = y._zod.check(c);
353
+ if (N instanceof Promise && (d == null ? void 0 : d.async) === !1)
354
+ throw new me();
355
+ if (u || N instanceof Promise)
356
+ u = (u ?? Promise.resolve()).then(async () => {
357
+ await N, c.issues.length !== v && (f || (f = fe(c, v)));
358
+ });
359
+ else {
360
+ if (c.issues.length === v)
361
+ continue;
362
+ f || (f = fe(c, v));
363
+ }
364
+ }
365
+ return u ? u.then(() => c) : c;
366
+ }, a = (c, l, d) => {
367
+ if (fe(c))
368
+ return c.aborted = !0, c;
369
+ const f = o(l, t, d);
370
+ if (f instanceof Promise) {
371
+ if (d.async === !1)
372
+ throw new me();
373
+ return f.then((u) => e._zod.parse(u, d));
374
+ }
375
+ return e._zod.parse(f, d);
376
+ };
377
+ e._zod.run = (c, l) => {
378
+ if (l.skipChecks)
379
+ return e._zod.parse(c, l);
380
+ if (l.direction === "backward") {
381
+ const f = e._zod.parse({ value: c.value, issues: [] }, { ...l, skipChecks: !0 });
382
+ return f instanceof Promise ? f.then((u) => a(u, c, l)) : a(f, c, l);
383
+ }
384
+ const d = e._zod.parse(c, l);
385
+ if (d instanceof Promise) {
386
+ if (l.async === !1)
387
+ throw new me();
388
+ return d.then((f) => o(f, t, l));
389
+ }
390
+ return o(d, t, l);
391
+ };
392
+ }
393
+ $(e, "~standard", () => ({
394
+ validate: (o) => {
395
+ var a;
396
+ try {
397
+ const c = yt(e, o);
398
+ return c.success ? { value: c.data } : { issues: (a = c.error) == null ? void 0 : a.issues };
399
+ } catch {
400
+ return vt(e, o).then((l) => {
401
+ var d;
402
+ return l.success ? { value: l.data } : { issues: (d = l.error) == null ? void 0 : d.issues };
403
+ });
404
+ }
405
+ },
406
+ vendor: "zod",
407
+ version: 1
408
+ }));
409
+ }), Pt = /* @__PURE__ */ S("$ZodUnknown", (e, r) => {
410
+ Z.init(e, r), e._zod.parse = (n) => n;
411
+ });
412
+ function Ge(e, r, n) {
413
+ e.issues.length && r.issues.push(...pt(n, e.issues)), r.value[n] = e.value;
414
+ }
415
+ const Dt = /* @__PURE__ */ S("$ZodArray", (e, r) => {
416
+ Z.init(e, r), e._zod.parse = (n, t) => {
417
+ const s = n.value;
418
+ if (!Array.isArray(s))
419
+ return n.issues.push({
420
+ expected: "array",
421
+ code: "invalid_type",
422
+ input: s,
423
+ inst: e
424
+ }), n;
425
+ n.value = Array(s.length);
426
+ const o = [];
427
+ for (let a = 0; a < s.length; a++) {
428
+ const c = s[a], l = r.element._zod.run({
429
+ value: c,
430
+ issues: []
431
+ }, t);
432
+ l instanceof Promise ? o.push(l.then((d) => Ge(d, n, a))) : Ge(l, n, a);
433
+ }
434
+ return o.length ? Promise.all(o).then(() => n) : n;
435
+ };
436
+ });
437
+ function qe(e, r, n, t) {
438
+ for (const o of e)
439
+ if (o.issues.length === 0)
440
+ return r.value = o.value, r;
441
+ const s = e.filter((o) => !fe(o));
442
+ return s.length === 1 ? (r.value = s[0].value, s[0]) : (r.issues.push({
443
+ code: "invalid_union",
444
+ input: r.value,
445
+ inst: n,
446
+ errors: e.map((o) => o.issues.map((a) => le(a, t, ce())))
447
+ }), r);
448
+ }
449
+ const At = /* @__PURE__ */ S("$ZodUnion", (e, r) => {
450
+ Z.init(e, r), $(e._zod, "optin", () => r.options.some((s) => s._zod.optin === "optional") ? "optional" : void 0), $(e._zod, "optout", () => r.options.some((s) => s._zod.optout === "optional") ? "optional" : void 0), $(e._zod, "values", () => {
451
+ if (r.options.every((s) => s._zod.values))
452
+ return new Set(r.options.flatMap((s) => Array.from(s._zod.values)));
453
+ }), $(e._zod, "pattern", () => {
454
+ if (r.options.every((s) => s._zod.pattern)) {
455
+ const s = r.options.map((o) => o._zod.pattern);
456
+ return new RegExp(`^(${s.map((o) => je(o.source)).join("|")})$`);
457
+ }
458
+ });
459
+ const n = r.options.length === 1, t = r.options[0]._zod.run;
460
+ e._zod.parse = (s, o) => {
461
+ if (n)
462
+ return t(s, o);
463
+ let a = !1;
464
+ const c = [];
465
+ for (const l of r.options) {
466
+ const d = l._zod.run({
467
+ value: s.value,
468
+ issues: []
469
+ }, o);
470
+ if (d instanceof Promise)
471
+ c.push(d), a = !0;
472
+ else {
473
+ if (d.issues.length === 0)
474
+ return d;
475
+ c.push(d);
476
+ }
477
+ }
478
+ return a ? Promise.all(c).then((l) => qe(l, s, e, o)) : qe(c, s, e, o);
479
+ };
480
+ }), It = /* @__PURE__ */ S("$ZodIntersection", (e, r) => {
481
+ Z.init(e, r), e._zod.parse = (n, t) => {
482
+ const s = n.value, o = r.left._zod.run({ value: s, issues: [] }, t), a = r.right._zod.run({ value: s, issues: [] }, t);
483
+ return o instanceof Promise || a instanceof Promise ? Promise.all([o, a]).then(([l, d]) => Ye(n, l, d)) : Ye(n, o, a);
484
+ };
485
+ });
486
+ function Re(e, r) {
487
+ if (e === r)
488
+ return { valid: !0, data: e };
489
+ if (e instanceof Date && r instanceof Date && +e == +r)
490
+ return { valid: !0, data: e };
491
+ if (Ie(e) && Ie(r)) {
492
+ const n = Object.keys(r), t = Object.keys(e).filter((o) => n.indexOf(o) !== -1), s = { ...e, ...r };
493
+ for (const o of t) {
494
+ const a = Re(e[o], r[o]);
495
+ if (!a.valid)
496
+ return {
497
+ valid: !1,
498
+ mergeErrorPath: [o, ...a.mergeErrorPath]
499
+ };
500
+ s[o] = a.data;
501
+ }
502
+ return { valid: !0, data: s };
503
+ }
504
+ if (Array.isArray(e) && Array.isArray(r)) {
505
+ if (e.length !== r.length)
506
+ return { valid: !1, mergeErrorPath: [] };
507
+ const n = [];
508
+ for (let t = 0; t < e.length; t++) {
509
+ const s = e[t], o = r[t], a = Re(s, o);
510
+ if (!a.valid)
511
+ return {
512
+ valid: !1,
513
+ mergeErrorPath: [t, ...a.mergeErrorPath]
514
+ };
515
+ n.push(a.data);
516
+ }
517
+ return { valid: !0, data: n };
518
+ }
519
+ return { valid: !1, mergeErrorPath: [] };
520
+ }
521
+ function Ye(e, r, n) {
522
+ const t = /* @__PURE__ */ new Map();
523
+ let s;
524
+ for (const c of r.issues)
525
+ if (c.code === "unrecognized_keys") {
526
+ s ?? (s = c);
527
+ for (const l of c.keys)
528
+ t.has(l) || t.set(l, {}), t.get(l).l = !0;
529
+ } else
530
+ e.issues.push(c);
531
+ for (const c of n.issues)
532
+ if (c.code === "unrecognized_keys")
533
+ for (const l of c.keys)
534
+ t.has(l) || t.set(l, {}), t.get(l).r = !0;
535
+ else
536
+ e.issues.push(c);
537
+ const o = [...t].filter(([, c]) => c.l && c.r).map(([c]) => c);
538
+ if (o.length && s && e.issues.push({ ...s, keys: o }), fe(e))
539
+ return e;
540
+ const a = Re(r.value, n.value);
541
+ if (!a.valid)
542
+ throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(a.mergeErrorPath)}`);
543
+ return e.value = a.data, e;
544
+ }
545
+ const Rt = /* @__PURE__ */ S("$ZodTransform", (e, r) => {
546
+ Z.init(e, r), e._zod.parse = (n, t) => {
547
+ if (t.direction === "backward")
548
+ throw new Er(e.constructor.name);
549
+ const s = r.transform(n.value, n);
550
+ if (t.async)
551
+ return (s instanceof Promise ? s : Promise.resolve(s)).then((a) => (n.value = a, n));
552
+ if (s instanceof Promise)
553
+ throw new me();
554
+ return n.value = s, n;
555
+ };
556
+ });
557
+ function Qe(e, r) {
558
+ return e.issues.length && r === void 0 ? { issues: [], value: void 0 } : e;
559
+ }
560
+ const Pr = /* @__PURE__ */ S("$ZodOptional", (e, r) => {
561
+ Z.init(e, r), e._zod.optin = "optional", e._zod.optout = "optional", $(e._zod, "values", () => r.innerType._zod.values ? /* @__PURE__ */ new Set([...r.innerType._zod.values, void 0]) : void 0), $(e._zod, "pattern", () => {
562
+ const n = r.innerType._zod.pattern;
563
+ return n ? new RegExp(`^(${je(n.source)})?$`) : void 0;
564
+ }), e._zod.parse = (n, t) => {
565
+ if (r.innerType._zod.optin === "optional") {
566
+ const s = r.innerType._zod.run(n, t);
567
+ return s instanceof Promise ? s.then((o) => Qe(o, n.value)) : Qe(s, n.value);
568
+ }
569
+ return n.value === void 0 ? n : r.innerType._zod.run(n, t);
570
+ };
571
+ }), Ft = /* @__PURE__ */ S("$ZodExactOptional", (e, r) => {
572
+ Pr.init(e, r), $(e._zod, "values", () => r.innerType._zod.values), $(e._zod, "pattern", () => r.innerType._zod.pattern), e._zod.parse = (n, t) => r.innerType._zod.run(n, t);
573
+ }), jt = /* @__PURE__ */ S("$ZodNullable", (e, r) => {
574
+ Z.init(e, r), $(e._zod, "optin", () => r.innerType._zod.optin), $(e._zod, "optout", () => r.innerType._zod.optout), $(e._zod, "pattern", () => {
575
+ const n = r.innerType._zod.pattern;
576
+ return n ? new RegExp(`^(${je(n.source)}|null)$`) : void 0;
577
+ }), $(e._zod, "values", () => r.innerType._zod.values ? /* @__PURE__ */ new Set([...r.innerType._zod.values, null]) : void 0), e._zod.parse = (n, t) => n.value === null ? n : r.innerType._zod.run(n, t);
578
+ }), Zt = /* @__PURE__ */ S("$ZodDefault", (e, r) => {
579
+ Z.init(e, r), e._zod.optin = "optional", $(e._zod, "values", () => r.innerType._zod.values), e._zod.parse = (n, t) => {
580
+ if (t.direction === "backward")
581
+ return r.innerType._zod.run(n, t);
582
+ if (n.value === void 0)
583
+ return n.value = r.defaultValue, n;
584
+ const s = r.innerType._zod.run(n, t);
585
+ return s instanceof Promise ? s.then((o) => er(o, r)) : er(s, r);
586
+ };
587
+ });
588
+ function er(e, r) {
589
+ return e.value === void 0 && (e.value = r.defaultValue), e;
590
+ }
591
+ const Lt = /* @__PURE__ */ S("$ZodPrefault", (e, r) => {
592
+ Z.init(e, r), e._zod.optin = "optional", $(e._zod, "values", () => r.innerType._zod.values), e._zod.parse = (n, t) => (t.direction === "backward" || n.value === void 0 && (n.value = r.defaultValue), r.innerType._zod.run(n, t));
593
+ }), Mt = /* @__PURE__ */ S("$ZodNonOptional", (e, r) => {
594
+ Z.init(e, r), $(e._zod, "values", () => {
595
+ const n = r.innerType._zod.values;
596
+ return n ? new Set([...n].filter((t) => t !== void 0)) : void 0;
597
+ }), e._zod.parse = (n, t) => {
598
+ const s = r.innerType._zod.run(n, t);
599
+ return s instanceof Promise ? s.then((o) => rr(o, e)) : rr(s, e);
600
+ };
601
+ });
602
+ function rr(e, r) {
603
+ return !e.issues.length && e.value === void 0 && e.issues.push({
604
+ code: "invalid_type",
605
+ expected: "nonoptional",
606
+ input: e.value,
607
+ inst: r
608
+ }), e;
609
+ }
610
+ const Vt = /* @__PURE__ */ S("$ZodCatch", (e, r) => {
611
+ Z.init(e, r), $(e._zod, "optin", () => r.innerType._zod.optin), $(e._zod, "optout", () => r.innerType._zod.optout), $(e._zod, "values", () => r.innerType._zod.values), e._zod.parse = (n, t) => {
612
+ if (t.direction === "backward")
613
+ return r.innerType._zod.run(n, t);
614
+ const s = r.innerType._zod.run(n, t);
615
+ return s instanceof Promise ? s.then((o) => (n.value = o.value, o.issues.length && (n.value = r.catchValue({
616
+ ...n,
617
+ error: {
618
+ issues: o.issues.map((a) => le(a, t, ce()))
619
+ },
620
+ input: n.value
621
+ }), n.issues = []), n)) : (n.value = s.value, s.issues.length && (n.value = r.catchValue({
622
+ ...n,
623
+ error: {
624
+ issues: s.issues.map((o) => le(o, t, ce()))
625
+ },
626
+ input: n.value
627
+ }), n.issues = []), n);
628
+ };
629
+ }), Jt = /* @__PURE__ */ S("$ZodPipe", (e, r) => {
630
+ Z.init(e, r), $(e._zod, "values", () => r.in._zod.values), $(e._zod, "optin", () => r.in._zod.optin), $(e._zod, "optout", () => r.out._zod.optout), $(e._zod, "propValues", () => r.in._zod.propValues), e._zod.parse = (n, t) => {
631
+ if (t.direction === "backward") {
632
+ const o = r.out._zod.run(n, t);
633
+ return o instanceof Promise ? o.then((a) => we(a, r.in, t)) : we(o, r.in, t);
634
+ }
635
+ const s = r.in._zod.run(n, t);
636
+ return s instanceof Promise ? s.then((o) => we(o, r.out, t)) : we(s, r.out, t);
637
+ };
638
+ });
639
+ function we(e, r, n) {
640
+ return e.issues.length ? (e.aborted = !0, e) : r._zod.run({ value: e.value, issues: e.issues }, n);
641
+ }
642
+ const Bt = /* @__PURE__ */ S("$ZodReadonly", (e, r) => {
643
+ Z.init(e, r), $(e._zod, "propValues", () => r.innerType._zod.propValues), $(e._zod, "values", () => r.innerType._zod.values), $(e._zod, "optin", () => {
644
+ var n, t;
645
+ return (t = (n = r.innerType) == null ? void 0 : n._zod) == null ? void 0 : t.optin;
646
+ }), $(e._zod, "optout", () => {
647
+ var n, t;
648
+ return (t = (n = r.innerType) == null ? void 0 : n._zod) == null ? void 0 : t.optout;
649
+ }), e._zod.parse = (n, t) => {
650
+ if (t.direction === "backward")
651
+ return r.innerType._zod.run(n, t);
652
+ const s = r.innerType._zod.run(n, t);
653
+ return s instanceof Promise ? s.then(tr) : tr(s);
654
+ };
655
+ });
656
+ function tr(e) {
657
+ return e.value = Object.freeze(e.value), e;
658
+ }
659
+ const Ut = /* @__PURE__ */ S("$ZodCustom", (e, r) => {
660
+ pe.init(e, r), Z.init(e, r), e._zod.parse = (n, t) => n, e._zod.check = (n) => {
661
+ const t = n.value, s = r.fn(t);
662
+ if (s instanceof Promise)
663
+ return s.then((o) => nr(o, n, t, e));
664
+ nr(s, n, t, e);
665
+ };
666
+ });
667
+ function nr(e, r, n, t) {
668
+ if (!e) {
669
+ const s = {
670
+ code: "custom",
671
+ input: n,
672
+ inst: t,
673
+ // incorporates params.error into issue reporting
674
+ path: [...t._zod.def.path ?? []],
675
+ // incorporates params.error into issue reporting
676
+ continue: !t._zod.def.abort
677
+ // params: inst._zod.def.params,
678
+ };
679
+ t._zod.def.params && (s.params = t._zod.def.params), r.issues.push(ge(s));
680
+ }
681
+ }
682
+ var sr;
683
+ class Xt {
684
+ constructor() {
685
+ this._map = /* @__PURE__ */ new WeakMap(), this._idmap = /* @__PURE__ */ new Map();
686
+ }
687
+ add(r, ...n) {
688
+ const t = n[0];
689
+ return this._map.set(r, t), t && typeof t == "object" && "id" in t && this._idmap.set(t.id, r), this;
690
+ }
691
+ clear() {
692
+ return this._map = /* @__PURE__ */ new WeakMap(), this._idmap = /* @__PURE__ */ new Map(), this;
693
+ }
694
+ remove(r) {
695
+ const n = this._map.get(r);
696
+ return n && typeof n == "object" && "id" in n && this._idmap.delete(n.id), this._map.delete(r), this;
697
+ }
698
+ get(r) {
699
+ const n = r._zod.parent;
700
+ if (n) {
701
+ const t = { ...this.get(n) ?? {} };
702
+ delete t.id;
703
+ const s = { ...t, ...this._map.get(r) };
704
+ return Object.keys(s).length ? s : void 0;
705
+ }
706
+ return this._map.get(r);
707
+ }
708
+ has(r) {
709
+ return this._map.has(r);
710
+ }
711
+ }
712
+ function Ht() {
713
+ return new Xt();
714
+ }
715
+ (sr = globalThis).__zod_globalRegistry ?? (sr.__zod_globalRegistry = Ht());
716
+ const he = globalThis.__zod_globalRegistry;
717
+ // @__NO_SIDE_EFFECTS__
718
+ function Kt(e) {
719
+ return new e({
720
+ type: "unknown"
721
+ });
722
+ }
723
+ // @__NO_SIDE_EFFECTS__
724
+ function Wt(e, r) {
725
+ return new St({
726
+ check: "max_length",
727
+ ...ae(r),
728
+ maximum: e
729
+ });
730
+ }
731
+ // @__NO_SIDE_EFFECTS__
732
+ function or(e, r) {
733
+ return new Ot({
734
+ check: "min_length",
735
+ ...ae(r),
736
+ minimum: e
737
+ });
738
+ }
739
+ // @__NO_SIDE_EFFECTS__
740
+ function Gt(e, r) {
741
+ return new Tt({
742
+ check: "length_equals",
743
+ ...ae(r),
744
+ length: e
745
+ });
746
+ }
747
+ // @__NO_SIDE_EFFECTS__
748
+ function qt(e) {
749
+ return new $t({
750
+ check: "overwrite",
751
+ tx: e
752
+ });
753
+ }
754
+ // @__NO_SIDE_EFFECTS__
755
+ function Yt(e, r, n) {
756
+ return new e({
757
+ type: "array",
758
+ element: r,
759
+ // get element() {
760
+ // return element;
761
+ // },
762
+ ...ae(n)
763
+ });
764
+ }
765
+ // @__NO_SIDE_EFFECTS__
766
+ function Qt(e, r, n) {
767
+ return new e({
768
+ type: "custom",
769
+ check: "custom",
770
+ fn: r,
771
+ ...ae(n)
772
+ });
773
+ }
774
+ // @__NO_SIDE_EFFECTS__
775
+ function en(e) {
776
+ const r = /* @__PURE__ */ rn((n) => (n.addIssue = (t) => {
777
+ if (typeof t == "string")
778
+ n.issues.push(ge(t, n.value, r._zod.def));
779
+ else {
780
+ const s = t;
781
+ s.fatal && (s.continue = !1), s.code ?? (s.code = "custom"), s.input ?? (s.input = n.value), s.inst ?? (s.inst = r), s.continue ?? (s.continue = !r._zod.def.abort), n.issues.push(ge(s));
782
+ }
783
+ }, e(n.value, n)));
784
+ return r;
785
+ }
786
+ // @__NO_SIDE_EFFECTS__
787
+ function rn(e, r) {
788
+ const n = new pe({
789
+ check: "custom",
790
+ ...ae(r)
791
+ });
792
+ return n._zod.check = e, n;
793
+ }
794
+ function Dr(e) {
795
+ let r = (e == null ? void 0 : e.target) ?? "draft-2020-12";
796
+ return r === "draft-4" && (r = "draft-04"), r === "draft-7" && (r = "draft-07"), {
797
+ processors: e.processors ?? {},
798
+ metadataRegistry: (e == null ? void 0 : e.metadata) ?? he,
799
+ target: r,
800
+ unrepresentable: (e == null ? void 0 : e.unrepresentable) ?? "throw",
801
+ override: (e == null ? void 0 : e.override) ?? (() => {
802
+ }),
803
+ io: (e == null ? void 0 : e.io) ?? "output",
804
+ counter: 0,
805
+ seen: /* @__PURE__ */ new Map(),
806
+ cycles: (e == null ? void 0 : e.cycles) ?? "ref",
807
+ reused: (e == null ? void 0 : e.reused) ?? "inline",
808
+ external: (e == null ? void 0 : e.external) ?? void 0
809
+ };
810
+ }
811
+ function j(e, r, n = { path: [], schemaPath: [] }) {
812
+ var f, u;
813
+ var t;
814
+ const s = e._zod.def, o = r.seen.get(e);
815
+ if (o)
816
+ return o.count++, n.schemaPath.includes(e) && (o.cycle = n.path), o.schema;
817
+ const a = { schema: {}, count: 1, cycle: void 0, path: n.path };
818
+ r.seen.set(e, a);
819
+ const c = (u = (f = e._zod).toJSONSchema) == null ? void 0 : u.call(f);
820
+ if (c)
821
+ a.schema = c;
822
+ else {
823
+ const y = {
824
+ ...n,
825
+ schemaPath: [...n.schemaPath, e],
826
+ path: n.path
827
+ };
828
+ if (e._zod.processJSONSchema)
829
+ e._zod.processJSONSchema(r, a.schema, y);
830
+ else {
831
+ const N = a.schema, b = r.processors[s.type];
832
+ if (!b)
833
+ throw new Error(`[toJSONSchema]: Non-representable type encountered: ${s.type}`);
834
+ b(e, r, N, y);
835
+ }
836
+ const v = e._zod.parent;
837
+ v && (a.ref || (a.ref = v), j(v, r, y), r.seen.get(v).isParent = !0);
838
+ }
839
+ const l = r.metadataRegistry.get(e);
840
+ return l && Object.assign(a.schema, l), r.io === "input" && I(e) && (delete a.schema.examples, delete a.schema.default), r.io === "input" && a.schema._prefault && ((t = a.schema).default ?? (t.default = a.schema._prefault)), delete a.schema._prefault, r.seen.get(e).schema;
841
+ }
842
+ function Ar(e, r) {
843
+ var a, c, l, d;
844
+ const n = e.seen.get(r);
845
+ if (!n)
846
+ throw new Error("Unprocessed schema. This is a bug in Zod.");
847
+ const t = /* @__PURE__ */ new Map();
848
+ for (const f of e.seen.entries()) {
849
+ const u = (a = e.metadataRegistry.get(f[0])) == null ? void 0 : a.id;
850
+ if (u) {
851
+ const y = t.get(u);
852
+ if (y && y !== f[0])
853
+ throw new Error(`Duplicate schema id "${u}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);
854
+ t.set(u, f[0]);
855
+ }
856
+ }
857
+ const s = (f) => {
858
+ var b;
859
+ const u = e.target === "draft-2020-12" ? "$defs" : "definitions";
860
+ if (e.external) {
861
+ const _ = (b = e.external.registry.get(f[0])) == null ? void 0 : b.id, x = e.external.uri ?? ((p) => p);
862
+ if (_)
863
+ return { ref: x(_) };
864
+ const g = f[1].defId ?? f[1].schema.id ?? `schema${e.counter++}`;
865
+ return f[1].defId = g, { defId: g, ref: `${x("__shared")}#/${u}/${g}` };
866
+ }
867
+ if (f[1] === n)
868
+ return { ref: "#" };
869
+ const v = `#/${u}/`, N = f[1].schema.id ?? `__schema${e.counter++}`;
870
+ return { defId: N, ref: v + N };
871
+ }, o = (f) => {
872
+ if (f[1].schema.$ref)
873
+ return;
874
+ const u = f[1], { ref: y, defId: v } = s(f);
875
+ u.def = { ...u.schema }, v && (u.defId = v);
876
+ const N = u.schema;
877
+ for (const b in N)
878
+ delete N[b];
879
+ N.$ref = y;
880
+ };
881
+ if (e.cycles === "throw")
882
+ for (const f of e.seen.entries()) {
883
+ const u = f[1];
884
+ if (u.cycle)
885
+ throw new Error(`Cycle detected: #/${(c = u.cycle) == null ? void 0 : c.join("/")}/<root>
886
+
887
+ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`);
888
+ }
889
+ for (const f of e.seen.entries()) {
890
+ const u = f[1];
891
+ if (r === f[0]) {
892
+ o(f);
893
+ continue;
894
+ }
895
+ if (e.external) {
896
+ const v = (l = e.external.registry.get(f[0])) == null ? void 0 : l.id;
897
+ if (r !== f[0] && v) {
898
+ o(f);
899
+ continue;
900
+ }
901
+ }
902
+ if ((d = e.metadataRegistry.get(f[0])) == null ? void 0 : d.id) {
903
+ o(f);
904
+ continue;
905
+ }
906
+ if (u.cycle) {
907
+ o(f);
908
+ continue;
909
+ }
910
+ if (u.count > 1 && e.reused === "ref") {
911
+ o(f);
912
+ continue;
913
+ }
914
+ }
915
+ }
916
+ function Ir(e, r) {
917
+ var a, c, l;
918
+ const n = e.seen.get(r);
919
+ if (!n)
920
+ throw new Error("Unprocessed schema. This is a bug in Zod.");
921
+ const t = (d) => {
922
+ const f = e.seen.get(d);
923
+ if (f.ref === null)
924
+ return;
925
+ const u = f.def ?? f.schema, y = { ...u }, v = f.ref;
926
+ if (f.ref = null, v) {
927
+ t(v);
928
+ const b = e.seen.get(v), _ = b.schema;
929
+ if (_.$ref && (e.target === "draft-07" || e.target === "draft-04" || e.target === "openapi-3.0") ? (u.allOf = u.allOf ?? [], u.allOf.push(_)) : Object.assign(u, _), Object.assign(u, y), d._zod.parent === v)
930
+ for (const g in u)
931
+ g === "$ref" || g === "allOf" || g in y || delete u[g];
932
+ if (_.$ref && b.def)
933
+ for (const g in u)
934
+ g === "$ref" || g === "allOf" || g in b.def && JSON.stringify(u[g]) === JSON.stringify(b.def[g]) && delete u[g];
935
+ }
936
+ const N = d._zod.parent;
937
+ if (N && N !== v) {
938
+ t(N);
939
+ const b = e.seen.get(N);
940
+ if (b != null && b.schema.$ref && (u.$ref = b.schema.$ref, b.def))
941
+ for (const _ in u)
942
+ _ === "$ref" || _ === "allOf" || _ in b.def && JSON.stringify(u[_]) === JSON.stringify(b.def[_]) && delete u[_];
943
+ }
944
+ e.override({
945
+ zodSchema: d,
946
+ jsonSchema: u,
947
+ path: f.path ?? []
948
+ });
949
+ };
950
+ for (const d of [...e.seen.entries()].reverse())
951
+ t(d[0]);
952
+ const s = {};
953
+ if (e.target === "draft-2020-12" ? s.$schema = "https://json-schema.org/draft/2020-12/schema" : e.target === "draft-07" ? s.$schema = "http://json-schema.org/draft-07/schema#" : e.target === "draft-04" ? s.$schema = "http://json-schema.org/draft-04/schema#" : e.target, (a = e.external) != null && a.uri) {
954
+ const d = (c = e.external.registry.get(r)) == null ? void 0 : c.id;
955
+ if (!d)
956
+ throw new Error("Schema is missing an `id` property");
957
+ s.$id = e.external.uri(d);
958
+ }
959
+ Object.assign(s, n.def ?? n.schema);
960
+ const o = ((l = e.external) == null ? void 0 : l.defs) ?? {};
961
+ for (const d of e.seen.entries()) {
962
+ const f = d[1];
963
+ f.def && f.defId && (o[f.defId] = f.def);
964
+ }
965
+ e.external || Object.keys(o).length > 0 && (e.target === "draft-2020-12" ? s.$defs = o : s.definitions = o);
966
+ try {
967
+ const d = JSON.parse(JSON.stringify(s));
968
+ return Object.defineProperty(d, "~standard", {
969
+ value: {
970
+ ...r["~standard"],
971
+ jsonSchema: {
972
+ input: Oe(r, "input", e.processors),
973
+ output: Oe(r, "output", e.processors)
974
+ }
975
+ },
976
+ enumerable: !1,
977
+ writable: !1
978
+ }), d;
979
+ } catch {
980
+ throw new Error("Error converting schema to JSON.");
981
+ }
982
+ }
983
+ function I(e, r) {
984
+ const n = r ?? { seen: /* @__PURE__ */ new Set() };
985
+ if (n.seen.has(e))
986
+ return !1;
987
+ n.seen.add(e);
988
+ const t = e._zod.def;
989
+ if (t.type === "transform")
990
+ return !0;
991
+ if (t.type === "array")
992
+ return I(t.element, n);
993
+ if (t.type === "set")
994
+ return I(t.valueType, n);
995
+ if (t.type === "lazy")
996
+ return I(t.getter(), n);
997
+ if (t.type === "promise" || t.type === "optional" || t.type === "nonoptional" || t.type === "nullable" || t.type === "readonly" || t.type === "default" || t.type === "prefault")
998
+ return I(t.innerType, n);
999
+ if (t.type === "intersection")
1000
+ return I(t.left, n) || I(t.right, n);
1001
+ if (t.type === "record" || t.type === "map")
1002
+ return I(t.keyType, n) || I(t.valueType, n);
1003
+ if (t.type === "pipe")
1004
+ return I(t.in, n) || I(t.out, n);
1005
+ if (t.type === "object") {
1006
+ for (const s in t.shape)
1007
+ if (I(t.shape[s], n))
1008
+ return !0;
1009
+ return !1;
1010
+ }
1011
+ if (t.type === "union") {
1012
+ for (const s of t.options)
1013
+ if (I(s, n))
1014
+ return !0;
1015
+ return !1;
1016
+ }
1017
+ if (t.type === "tuple") {
1018
+ for (const s of t.items)
1019
+ if (I(s, n))
1020
+ return !0;
1021
+ return !!(t.rest && I(t.rest, n));
1022
+ }
1023
+ return !1;
1024
+ }
1025
+ const tn = (e, r = {}) => (n) => {
1026
+ const t = Dr({ ...n, processors: r });
1027
+ return j(e, t), Ar(t, e), Ir(t, e);
1028
+ }, Oe = (e, r, n = {}) => (t) => {
1029
+ const { libraryOptions: s, target: o } = t ?? {}, a = Dr({ ...s ?? {}, target: o, io: r, processors: n });
1030
+ return j(e, a), Ar(a, e), Ir(a, e);
1031
+ }, nn = (e, r, n, t) => {
1032
+ }, sn = (e, r, n, t) => {
1033
+ if (r.unrepresentable === "throw")
1034
+ throw new Error("Custom types cannot be represented in JSON Schema");
1035
+ }, on = (e, r, n, t) => {
1036
+ if (r.unrepresentable === "throw")
1037
+ throw new Error("Transforms cannot be represented in JSON Schema");
1038
+ }, an = (e, r, n, t) => {
1039
+ const s = n, o = e._zod.def, { minimum: a, maximum: c } = e._zod.bag;
1040
+ typeof a == "number" && (s.minItems = a), typeof c == "number" && (s.maxItems = c), s.type = "array", s.items = j(o.element, r, { ...t, path: [...t.path, "items"] });
1041
+ }, cn = (e, r, n, t) => {
1042
+ const s = e._zod.def, o = s.inclusive === !1, a = s.options.map((c, l) => j(c, r, {
1043
+ ...t,
1044
+ path: [...t.path, o ? "oneOf" : "anyOf", l]
1045
+ }));
1046
+ o ? n.oneOf = a : n.anyOf = a;
1047
+ }, ln = (e, r, n, t) => {
1048
+ const s = e._zod.def, o = j(s.left, r, {
1049
+ ...t,
1050
+ path: [...t.path, "allOf", 0]
1051
+ }), a = j(s.right, r, {
1052
+ ...t,
1053
+ path: [...t.path, "allOf", 1]
1054
+ }), c = (d) => "allOf" in d && Object.keys(d).length === 1, l = [
1055
+ ...c(o) ? o.allOf : [o],
1056
+ ...c(a) ? a.allOf : [a]
1057
+ ];
1058
+ n.allOf = l;
1059
+ }, dn = (e, r, n, t) => {
1060
+ const s = e._zod.def, o = j(s.innerType, r, t), a = r.seen.get(e);
1061
+ r.target === "openapi-3.0" ? (a.ref = s.innerType, n.nullable = !0) : n.anyOf = [o, { type: "null" }];
1062
+ }, un = (e, r, n, t) => {
1063
+ const s = e._zod.def;
1064
+ j(s.innerType, r, t);
1065
+ const o = r.seen.get(e);
1066
+ o.ref = s.innerType;
1067
+ }, fn = (e, r, n, t) => {
1068
+ const s = e._zod.def;
1069
+ j(s.innerType, r, t);
1070
+ const o = r.seen.get(e);
1071
+ o.ref = s.innerType, n.default = JSON.parse(JSON.stringify(s.defaultValue));
1072
+ }, mn = (e, r, n, t) => {
1073
+ const s = e._zod.def;
1074
+ j(s.innerType, r, t);
1075
+ const o = r.seen.get(e);
1076
+ o.ref = s.innerType, r.io === "input" && (n._prefault = JSON.parse(JSON.stringify(s.defaultValue)));
1077
+ }, pn = (e, r, n, t) => {
1078
+ const s = e._zod.def;
1079
+ j(s.innerType, r, t);
1080
+ const o = r.seen.get(e);
1081
+ o.ref = s.innerType;
1082
+ let a;
1083
+ try {
1084
+ a = s.catchValue(void 0);
1085
+ } catch {
1086
+ throw new Error("Dynamic catch values are not supported in JSON Schema");
1087
+ }
1088
+ n.default = a;
1089
+ }, hn = (e, r, n, t) => {
1090
+ const s = e._zod.def, o = r.io === "input" ? s.in._zod.def.type === "transform" ? s.out : s.in : s.out;
1091
+ j(o, r, t);
1092
+ const a = r.seen.get(e);
1093
+ a.ref = o;
1094
+ }, gn = (e, r, n, t) => {
1095
+ const s = e._zod.def;
1096
+ j(s.innerType, r, t);
1097
+ const o = r.seen.get(e);
1098
+ o.ref = s.innerType, n.readOnly = !0;
1099
+ }, Rr = (e, r, n, t) => {
1100
+ const s = e._zod.def;
1101
+ j(s.innerType, r, t);
1102
+ const o = r.seen.get(e);
1103
+ o.ref = s.innerType;
1104
+ }, yn = (e, r) => {
1105
+ $r.init(e, r), e.name = "ZodError", Object.defineProperties(e, {
1106
+ format: {
1107
+ value: (n) => gt(e, n)
1108
+ // enumerable: false,
1109
+ },
1110
+ flatten: {
1111
+ value: (n) => ht(e, n)
1112
+ // enumerable: false,
1113
+ },
1114
+ addIssue: {
1115
+ value: (n) => {
1116
+ e.issues.push(n), e.message = JSON.stringify(e.issues, Ae, 2);
1117
+ }
1118
+ // enumerable: false,
1119
+ },
1120
+ addIssues: {
1121
+ value: (n) => {
1122
+ e.issues.push(...n), e.message = JSON.stringify(e.issues, Ae, 2);
1123
+ }
1124
+ // enumerable: false,
1125
+ },
1126
+ isEmpty: {
1127
+ get() {
1128
+ return e.issues.length === 0;
1129
+ }
1130
+ // enumerable: false,
1131
+ }
1132
+ });
1133
+ }, H = S("ZodError", yn, {
1134
+ Parent: Error
1135
+ }), vn = /* @__PURE__ */ Le(H), bn = /* @__PURE__ */ Me(H), Nn = /* @__PURE__ */ $e(H), _n = /* @__PURE__ */ ke(H), xn = /* @__PURE__ */ bt(H), wn = /* @__PURE__ */ Nt(H), Cn = /* @__PURE__ */ _t(H), zn = /* @__PURE__ */ xt(H), En = /* @__PURE__ */ wt(H), Sn = /* @__PURE__ */ Ct(H), On = /* @__PURE__ */ zt(H), Tn = /* @__PURE__ */ Et(H), L = /* @__PURE__ */ S("ZodType", (e, r) => (Z.init(e, r), Object.assign(e["~standard"], {
1136
+ jsonSchema: {
1137
+ input: Oe(e, "input"),
1138
+ output: Oe(e, "output")
1139
+ }
1140
+ }), e.toJSONSchema = tn(e, {}), e.def = r, e.type = r.type, Object.defineProperty(e, "_def", { value: r }), e.check = (...n) => e.clone(ft(r, {
1141
+ checks: [
1142
+ ...r.checks ?? [],
1143
+ ...n.map((t) => typeof t == "function" ? { _zod: { check: t, def: { check: "custom" }, onattach: [] } } : t)
1144
+ ]
1145
+ }), {
1146
+ parent: !0
1147
+ }), e.with = e.check, e.clone = (n, t) => mt(e, n, t), e.brand = () => e, e.register = (n, t) => (n.add(e, t), e), e.parse = (n, t) => vn(e, n, t, { callee: e.parse }), e.safeParse = (n, t) => Nn(e, n, t), e.parseAsync = async (n, t) => bn(e, n, t, { callee: e.parseAsync }), e.safeParseAsync = async (n, t) => _n(e, n, t), e.spa = e.safeParseAsync, e.encode = (n, t) => xn(e, n, t), e.decode = (n, t) => wn(e, n, t), e.encodeAsync = async (n, t) => Cn(e, n, t), e.decodeAsync = async (n, t) => zn(e, n, t), e.safeEncode = (n, t) => En(e, n, t), e.safeDecode = (n, t) => Sn(e, n, t), e.safeEncodeAsync = async (n, t) => On(e, n, t), e.safeDecodeAsync = async (n, t) => Tn(e, n, t), e.refine = (n, t) => e.check(ts(n, t)), e.superRefine = (n) => e.check(ns(n)), e.overwrite = (n) => e.check(/* @__PURE__ */ qt(n)), e.optional = () => ar(e), e.exactOptional = () => Vn(e), e.nullable = () => ir(e), e.nullish = () => ar(ir(e)), e.nonoptional = (n) => Wn(e, n), e.array = () => Dn(e), e.or = (n) => In([e, n]), e.and = (n) => Fn(e, n), e.transform = (n) => cr(e, Zn(n)), e.default = (n) => Un(e, n), e.prefault = (n) => Hn(e, n), e.catch = (n) => qn(e, n), e.pipe = (n) => cr(e, n), e.readonly = () => es(e), e.describe = (n) => {
1148
+ const t = e.clone();
1149
+ return he.add(t, { description: n }), t;
1150
+ }, Object.defineProperty(e, "description", {
1151
+ get() {
1152
+ var n;
1153
+ return (n = he.get(e)) == null ? void 0 : n.description;
1154
+ },
1155
+ configurable: !0
1156
+ }), e.meta = (...n) => {
1157
+ if (n.length === 0)
1158
+ return he.get(e);
1159
+ const t = e.clone();
1160
+ return he.add(t, n[0]), t;
1161
+ }, e.isOptional = () => e.safeParse(void 0).success, e.isNullable = () => e.safeParse(null).success, e.apply = (n) => n(e), e)), $n = /* @__PURE__ */ S("ZodUnknown", (e, r) => {
1162
+ Pt.init(e, r), L.init(e, r), e._zod.processJSONSchema = (n, t, s) => nn();
1163
+ });
1164
+ function kn() {
1165
+ return /* @__PURE__ */ Kt($n);
1166
+ }
1167
+ const Pn = /* @__PURE__ */ S("ZodArray", (e, r) => {
1168
+ Dt.init(e, r), L.init(e, r), e._zod.processJSONSchema = (n, t, s) => an(e, n, t, s), e.element = r.element, e.min = (n, t) => e.check(/* @__PURE__ */ or(n, t)), e.nonempty = (n) => e.check(/* @__PURE__ */ or(1, n)), e.max = (n, t) => e.check(/* @__PURE__ */ Wt(n, t)), e.length = (n, t) => e.check(/* @__PURE__ */ Gt(n, t)), e.unwrap = () => e.element;
1169
+ });
1170
+ function Dn(e, r) {
1171
+ return /* @__PURE__ */ Yt(Pn, e, r);
1172
+ }
1173
+ const An = /* @__PURE__ */ S("ZodUnion", (e, r) => {
1174
+ At.init(e, r), L.init(e, r), e._zod.processJSONSchema = (n, t, s) => cn(e, n, t, s), e.options = r.options;
1175
+ });
1176
+ function In(e, r) {
1177
+ return new An({
1178
+ type: "union",
1179
+ options: e,
1180
+ ...ae(r)
1181
+ });
1182
+ }
1183
+ const Rn = /* @__PURE__ */ S("ZodIntersection", (e, r) => {
1184
+ It.init(e, r), L.init(e, r), e._zod.processJSONSchema = (n, t, s) => ln(e, n, t, s);
1185
+ });
1186
+ function Fn(e, r) {
1187
+ return new Rn({
1188
+ type: "intersection",
1189
+ left: e,
1190
+ right: r
1191
+ });
1192
+ }
1193
+ const jn = /* @__PURE__ */ S("ZodTransform", (e, r) => {
1194
+ Rt.init(e, r), L.init(e, r), e._zod.processJSONSchema = (n, t, s) => on(e, n), e._zod.parse = (n, t) => {
1195
+ if (t.direction === "backward")
1196
+ throw new Er(e.constructor.name);
1197
+ n.addIssue = (o) => {
1198
+ if (typeof o == "string")
1199
+ n.issues.push(ge(o, n.value, r));
1200
+ else {
1201
+ const a = o;
1202
+ a.fatal && (a.continue = !1), a.code ?? (a.code = "custom"), a.input ?? (a.input = n.value), a.inst ?? (a.inst = e), n.issues.push(ge(a));
1203
+ }
1204
+ };
1205
+ const s = r.transform(n.value, n);
1206
+ return s instanceof Promise ? s.then((o) => (n.value = o, n)) : (n.value = s, n);
1207
+ };
1208
+ });
1209
+ function Zn(e) {
1210
+ return new jn({
1211
+ type: "transform",
1212
+ transform: e
1213
+ });
1214
+ }
1215
+ const Ln = /* @__PURE__ */ S("ZodOptional", (e, r) => {
1216
+ Pr.init(e, r), L.init(e, r), e._zod.processJSONSchema = (n, t, s) => Rr(e, n, t, s), e.unwrap = () => e._zod.def.innerType;
1217
+ });
1218
+ function ar(e) {
1219
+ return new Ln({
1220
+ type: "optional",
1221
+ innerType: e
1222
+ });
1223
+ }
1224
+ const Mn = /* @__PURE__ */ S("ZodExactOptional", (e, r) => {
1225
+ Ft.init(e, r), L.init(e, r), e._zod.processJSONSchema = (n, t, s) => Rr(e, n, t, s), e.unwrap = () => e._zod.def.innerType;
1226
+ });
1227
+ function Vn(e) {
1228
+ return new Mn({
1229
+ type: "optional",
1230
+ innerType: e
1231
+ });
1232
+ }
1233
+ const Jn = /* @__PURE__ */ S("ZodNullable", (e, r) => {
1234
+ jt.init(e, r), L.init(e, r), e._zod.processJSONSchema = (n, t, s) => dn(e, n, t, s), e.unwrap = () => e._zod.def.innerType;
1235
+ });
1236
+ function ir(e) {
1237
+ return new Jn({
1238
+ type: "nullable",
1239
+ innerType: e
1240
+ });
1241
+ }
1242
+ const Bn = /* @__PURE__ */ S("ZodDefault", (e, r) => {
1243
+ Zt.init(e, r), L.init(e, r), e._zod.processJSONSchema = (n, t, s) => fn(e, n, t, s), e.unwrap = () => e._zod.def.innerType, e.removeDefault = e.unwrap;
1244
+ });
1245
+ function Un(e, r) {
1246
+ return new Bn({
1247
+ type: "default",
1248
+ innerType: e,
1249
+ get defaultValue() {
1250
+ return typeof r == "function" ? r() : Or(r);
1251
+ }
1252
+ });
1253
+ }
1254
+ const Xn = /* @__PURE__ */ S("ZodPrefault", (e, r) => {
1255
+ Lt.init(e, r), L.init(e, r), e._zod.processJSONSchema = (n, t, s) => mn(e, n, t, s), e.unwrap = () => e._zod.def.innerType;
1256
+ });
1257
+ function Hn(e, r) {
1258
+ return new Xn({
1259
+ type: "prefault",
1260
+ innerType: e,
1261
+ get defaultValue() {
1262
+ return typeof r == "function" ? r() : Or(r);
1263
+ }
1264
+ });
1265
+ }
1266
+ const Kn = /* @__PURE__ */ S("ZodNonOptional", (e, r) => {
1267
+ Mt.init(e, r), L.init(e, r), e._zod.processJSONSchema = (n, t, s) => un(e, n, t, s), e.unwrap = () => e._zod.def.innerType;
1268
+ });
1269
+ function Wn(e, r) {
1270
+ return new Kn({
1271
+ type: "nonoptional",
1272
+ innerType: e,
1273
+ ...ae(r)
1274
+ });
1275
+ }
1276
+ const Gn = /* @__PURE__ */ S("ZodCatch", (e, r) => {
1277
+ Vt.init(e, r), L.init(e, r), e._zod.processJSONSchema = (n, t, s) => pn(e, n, t, s), e.unwrap = () => e._zod.def.innerType, e.removeCatch = e.unwrap;
1278
+ });
1279
+ function qn(e, r) {
1280
+ return new Gn({
1281
+ type: "catch",
1282
+ innerType: e,
1283
+ catchValue: typeof r == "function" ? r : () => r
1284
+ });
1285
+ }
1286
+ const Yn = /* @__PURE__ */ S("ZodPipe", (e, r) => {
1287
+ Jt.init(e, r), L.init(e, r), e._zod.processJSONSchema = (n, t, s) => hn(e, n, t, s), e.in = r.in, e.out = r.out;
1288
+ });
1289
+ function cr(e, r) {
1290
+ return new Yn({
1291
+ type: "pipe",
1292
+ in: e,
1293
+ out: r
1294
+ // ...util.normalizeParams(params),
1295
+ });
1296
+ }
1297
+ const Qn = /* @__PURE__ */ S("ZodReadonly", (e, r) => {
1298
+ Bt.init(e, r), L.init(e, r), e._zod.processJSONSchema = (n, t, s) => gn(e, n, t, s), e.unwrap = () => e._zod.def.innerType;
1299
+ });
1300
+ function es(e) {
1301
+ return new Qn({
1302
+ type: "readonly",
1303
+ innerType: e
1304
+ });
1305
+ }
1306
+ const rs = /* @__PURE__ */ S("ZodCustom", (e, r) => {
1307
+ Ut.init(e, r), L.init(e, r), e._zod.processJSONSchema = (n, t, s) => sn(e, n);
1308
+ });
1309
+ function ts(e, r = {}) {
1310
+ return /* @__PURE__ */ Qt(rs, e, r);
1311
+ }
1312
+ function ns(e) {
1313
+ return /* @__PURE__ */ en(e);
1314
+ }
1315
+ const ss = {
1316
+ custom: "custom"
1317
+ }, ee = (e, r, n = {}) => {
1318
+ if (!e) return !0;
1319
+ if ("and" in e || "or" in e)
1320
+ return "and" in e && Array.isArray(e.and) ? e.and.every((d) => ee(d, r, n)) : "or" in e && Array.isArray(e.or) ? e.or.some((d) => ee(d, r, n)) : !0;
1321
+ const t = e;
1322
+ if (!t.campoId) return !0;
1323
+ const s = t.source === "evento" ? n[t.campoId] : r[t.campoId], o = s != null ? String(s) : "", a = t.valor !== void 0 ? String(t.valor) : "", c = parseFloat(o), l = parseFloat(a);
1324
+ switch (t.operador) {
1325
+ case "igual":
1326
+ return o === a;
1327
+ case "diferente":
1328
+ return o !== a;
1329
+ case "vazio":
1330
+ return !o;
1331
+ case "naoVazio":
1332
+ return !!o;
1333
+ case "contem":
1334
+ return o.includes(a);
1335
+ case "naoContem":
1336
+ return !o.includes(a);
1337
+ case "maiorQue":
1338
+ return !isNaN(c) && !isNaN(l) && c > l;
1339
+ case "menorQue":
1340
+ return !isNaN(c) && !isNaN(l) && c < l;
1341
+ case "maiorOuIgual":
1342
+ return !isNaN(c) && !isNaN(l) && c >= l;
1343
+ case "menorOuIgual":
1344
+ return !isNaN(c) && !isNaN(l) && c <= l;
1345
+ default:
1346
+ return !0;
1347
+ }
1348
+ }, os = /^\d{3}\.?\d{3}\.?\d{3}-?\d{2}$/, as = /^\(?\d{2}\)?\s?\d{4,5}-?\d{4}$/, is = /^\d{5}-?\d{3}$/, cs = /^[^\s@]+@[^\s@]+\.[^\s@]+$/, Pe = (e, r, n = {}) => {
1349
+ const t = e.validacao;
1350
+ if (e.tipo === h.CHECKBOX || e.tipo === h.SWITCH)
1351
+ return e.obrigatorio && !r ? "Campo obrigatório" : void 0;
1352
+ if (e.tipo === h.SLIDER) {
1353
+ const o = r !== void 0 ? Number(r) : NaN;
1354
+ return e.obrigatorio && isNaN(o) ? "Campo obrigatório" : isNaN(o) ? void 0 : (t == null ? void 0 : t.min) !== void 0 && o < t.min ? `Valor mínimo: ${t.min}` : (t == null ? void 0 : t.max) !== void 0 && o > t.max ? `Valor máximo: ${t.max}` : void 0;
1355
+ }
1356
+ if (e.tipo === h.RATING) {
1357
+ const o = r !== void 0 ? Number(r) : 0;
1358
+ return e.obrigatorio && (!o || o < 1) ? "Avaliação obrigatória" : void 0;
1359
+ }
1360
+ if (e.tipo === h.DATE_RANGE) {
1361
+ const o = r;
1362
+ if (e.obrigatorio) {
1363
+ if (!(o != null && o.start)) return "Data inicial obrigatória";
1364
+ if (!(o != null && o.end)) return "Data final obrigatória";
1365
+ }
1366
+ return o != null && o.start && (o != null && o.end) && o.start > o.end ? "A data inicial deve ser menor ou igual à data final" : void 0;
1367
+ }
1368
+ if (e.tipo === h.PARTICIPATION_TYPE) {
1369
+ if (!e.obrigatorio) return;
1370
+ const o = r;
1371
+ return o != null && o.tipo ? o.tipo === "por_dia" && !o.data ? "Selecione um dia para participar" : "genero" in (o ?? {}) && !(o != null && o.genero) ? "Selecione o sexo" : void 0 : "Selecione o tipo de participação";
1372
+ }
1373
+ if (e.tipo === h.CHECKBOX_GROUP) {
1374
+ const o = Array.isArray(r) ? r : [];
1375
+ return e.obrigatorio && o.length === 0 ? "Selecione pelo menos uma opção" : void 0;
1376
+ }
1377
+ if (e.tipo === h.FILE)
1378
+ return e.obrigatorio && !r ? "Arquivo obrigatório" : void 0;
1379
+ if (e.tipo === h.NUMBER) {
1380
+ const o = r != null ? String(r) : "";
1381
+ if (e.obrigatorio && !o) return "Campo obrigatório";
1382
+ if (!o) return;
1383
+ const a = Number(o);
1384
+ return isNaN(a) ? "Deve ser um número" : (t == null ? void 0 : t.min) !== void 0 && a < t.min ? `Valor mínimo: ${t.min}` : (t == null ? void 0 : t.max) !== void 0 && a > t.max ? `Valor máximo: ${t.max}` : void 0;
1385
+ }
1386
+ const s = r != null ? String(r) : "";
1387
+ if (e.obrigatorio && !s.trim()) return "Campo obrigatório";
1388
+ if (s) {
1389
+ if (e.tipo === h.EMAIL && !cs.test(s)) return "E-mail inválido";
1390
+ if (e.tipo === h.CPF && !os.test(s)) return "CPF inválido";
1391
+ if (e.tipo === h.TELEFONE && !as.test(s)) return "Telefone inválido";
1392
+ if (e.tipo === h.CEP && !is.test(s)) return "CEP inválido";
1393
+ if (t != null && t.minLength && s.length < t.minLength) return `Mínimo ${t.minLength} caracteres`;
1394
+ if (t != null && t.maxLength && s.length > t.maxLength) return `Máximo ${t.maxLength} caracteres`;
1395
+ if ((e.tipo === h.DATE || e.tipo === h.DATETIME) && s) {
1396
+ if (t != null && t.minDate && s < t.minDate) return `Data mínima: ${t.minDate}`;
1397
+ if (t != null && t.maxDate && s > t.maxDate) return `Data máxima: ${t.maxDate}`;
1398
+ }
1399
+ if ((e.tipo === h.DATE || e.tipo === h.DATETIME) && s && ((t == null ? void 0 : t.minAge) != null || (t == null ? void 0 : t.maxAge) != null)) {
1400
+ const o = s.split("T")[0], a = /* @__PURE__ */ new Date(o + "T00:00:00"), c = n["evento.dataInicioEvento"], l = c ? /* @__PURE__ */ new Date(c.split("T")[0] + "T00:00:00") : /* @__PURE__ */ new Date();
1401
+ let d = l.getFullYear() - a.getFullYear();
1402
+ const f = l.getMonth() - a.getMonth();
1403
+ if ((f < 0 || f === 0 && l.getDate() < a.getDate()) && d--, t.minAge != null && d < t.minAge)
1404
+ return `Idade mínima: ${t.minAge} ano${t.minAge !== 1 ? "s" : ""}`;
1405
+ if (t.maxAge != null && d > t.maxAge)
1406
+ return `Idade máxima: ${t.maxAge} ano${t.maxAge !== 1 ? "s" : ""}`;
1407
+ }
1408
+ if (t != null && t.regex)
1409
+ try {
1410
+ if (!new RegExp(t.regex).test(s)) return t.regexMessage || "Formato inválido";
1411
+ } catch {
1412
+ }
1413
+ }
1414
+ }, Ce = (e, r, n) => {
1415
+ const t = r.split(".");
1416
+ let s = e;
1417
+ for (let o = 0; o < t.length - 1; o++) {
1418
+ const a = t[o];
1419
+ (s[a] == null || typeof s[a] != "object") && (s[a] = {}), s = s[a];
1420
+ }
1421
+ s[t[t.length - 1]] = n;
1422
+ }, ls = (e) => [...e.containers].sort((r, n) => r.ordem - n.ordem).filter((r) => !r.repeatable).flatMap((r) => [...r.campos].sort((n, t) => n.ordem - t.ordem)), ds = (e, r = {}, n = {}) => async (t) => {
1423
+ var l, d, f;
1424
+ const s = ls(e), o = {};
1425
+ for (const u of s) {
1426
+ if (!ee(u.condicional, t, r) || u.tipo === h.HIDDEN) continue;
1427
+ if (u.tipo === h.FIELD_ARRAY) {
1428
+ const N = Array.isArray(t[u.nome]) ? t[u.nome] : [];
1429
+ u.obrigatorio && N.length === 0 ? o[u.nome] = { type: "custom", message: "Adicione pelo menos um item" } : u.minItems && N.length < u.minItems && (o[u.nome] = {
1430
+ type: "custom",
1431
+ message: `Mínimo de ${u.minItems} item${u.minItems !== 1 ? "s" : ""}`
1432
+ });
1433
+ for (let b = 0; b < N.length; b++) {
1434
+ const _ = N[b];
1435
+ for (const x of u.subFields ?? []) {
1436
+ const g = Pe(x, _[x.nome], r);
1437
+ if (g) {
1438
+ Ce(o, `${u.nome}.${b}.${x.nome}`, {
1439
+ type: "custom",
1440
+ message: g
1441
+ });
1442
+ continue;
1443
+ }
1444
+ if ((l = x.validate) != null && l.length) {
1445
+ const p = await Se(
1446
+ x.validate,
1447
+ x.nome,
1448
+ _[x.nome],
1449
+ _,
1450
+ r,
1451
+ n
1452
+ );
1453
+ p && Ce(o, `${u.nome}.${b}.${x.nome}`, {
1454
+ type: "custom",
1455
+ message: p
1456
+ });
1457
+ }
1458
+ }
1459
+ }
1460
+ continue;
1461
+ }
1462
+ const v = Pe(u, t[u.nome], r);
1463
+ if (v && (o[u.nome] = { type: "custom", message: v }), !o[u.nome] && ((d = u.validate) != null && d.length)) {
1464
+ const N = await Se(
1465
+ u.validate,
1466
+ u.nome,
1467
+ t[u.nome],
1468
+ t,
1469
+ r,
1470
+ n
1471
+ );
1472
+ N && (o[u.nome] = { type: "custom", message: N });
1473
+ }
1474
+ }
1475
+ const a = e.containers.filter(
1476
+ (u) => u.repeatable && u.nome
1477
+ );
1478
+ for (const u of a) {
1479
+ const y = Array.isArray(t[u.nome]) ? t[u.nome] : [];
1480
+ for (let v = 0; v < y.length; v++) {
1481
+ const N = y[v];
1482
+ for (const b of u.campos) {
1483
+ if (!ee(b.condicional, N, r) || b.tipo === h.HIDDEN) continue;
1484
+ const x = Pe(b, N[b.nome], r);
1485
+ if (x) {
1486
+ Ce(o, `${u.nome}.${v}.${b.nome}`, {
1487
+ type: "custom",
1488
+ message: x
1489
+ });
1490
+ continue;
1491
+ }
1492
+ if ((f = b.validate) != null && f.length) {
1493
+ const g = await Se(
1494
+ b.validate,
1495
+ b.nome,
1496
+ N[b.nome],
1497
+ N,
1498
+ r,
1499
+ n
1500
+ );
1501
+ g && Ce(o, `${u.nome}.${v}.${b.nome}`, {
1502
+ type: "custom",
1503
+ message: g
1504
+ });
1505
+ }
1506
+ }
1507
+ }
1508
+ }
1509
+ const c = Object.keys(o).length > 0;
1510
+ return { values: c ? {} : t, errors: c ? o : {} };
1511
+ }, Se = async (e, r, n, t, s, o) => {
1512
+ var l;
1513
+ let a = kn();
1514
+ for (const d of e) {
1515
+ const f = o[d.type];
1516
+ if (!f) continue;
1517
+ const u = f, y = d;
1518
+ a = a.superRefine(async (v, N) => {
1519
+ const b = await u(v, t, y, s);
1520
+ b && N.addIssue({
1521
+ code: ss.custom,
1522
+ message: y.message ?? b
1523
+ });
1524
+ });
1525
+ }
1526
+ const c = await a.safeParseAsync(n);
1527
+ if (!c.success)
1528
+ return (l = c.error.issues[0]) == null ? void 0 : l.message;
1529
+ }, us = (e, r = {}, n = {}) => async (t) => {
1530
+ var a;
1531
+ const s = {}, o = [...e.containers].sort((c, l) => c.ordem - l.ordem).flatMap((c) => [...c.campos].sort((l, d) => l.ordem - d.ordem));
1532
+ for (const c of o) {
1533
+ if (!((a = c.warn) != null && a.length) || !ee(c.condicional, t, r)) continue;
1534
+ const d = await Se(
1535
+ c.warn,
1536
+ c.nome,
1537
+ t[c.nome],
1538
+ t,
1539
+ r,
1540
+ n
1541
+ );
1542
+ d && (s[c.nome] = d);
1543
+ }
1544
+ return s;
1545
+ }, fs = /\{\{\s*(?:event|evento)\.([a-zA-Z0-9_.]+)\s*\}\}/g, Y = (e, r) => e ? e.replace(fs, (n, t) => r[`evento.${t}`] ?? r[t] ?? n) : e ?? "", ms = (e, r) => ({
1546
+ ...e,
1547
+ label: Y(e.label, r)
1548
+ }), ps = (e, r) => {
1549
+ var n;
1550
+ return {
1551
+ ...e,
1552
+ label: Y(e.label, r),
1553
+ placeholder: Y(e.placeholder, r),
1554
+ hint: Y(e.hint, r),
1555
+ defaultValue: typeof e.defaultValue == "string" ? Y(e.defaultValue, r) : e.defaultValue,
1556
+ opcoes: (n = e.opcoes) == null ? void 0 : n.map((t) => ms(t, r))
1557
+ };
1558
+ }, Ve = (e, r) => ({
1559
+ ...e,
1560
+ titulo: Y(e.titulo, r),
1561
+ descricao: Y(e.descricao, r),
1562
+ campos: e.campos.map((n) => ps(n, r))
1563
+ }), hs = (e, r) => ({
1564
+ ...e,
1565
+ titulo: Y(e.titulo, r),
1566
+ descricao: Y(e.descricao, r),
1567
+ containers: e.containers.map((n) => Ve(n, r))
1568
+ }), Fr = hr({}), ne = () => ve(Fr), X = ({
1569
+ name: e,
1570
+ control: r,
1571
+ placeholder: n,
1572
+ type: t = "text",
1573
+ disabled: s,
1574
+ readOnly: o
1575
+ }) => {
1576
+ var d;
1577
+ const { field: a, fieldState: c } = P({ name: e, control: r }), l = !!c.error;
1578
+ return /* @__PURE__ */ m("div", { className: "space-y-1", children: [
1579
+ /* @__PURE__ */ i(
1580
+ "input",
1581
+ {
1582
+ ...a,
1583
+ value: a.value ?? "",
1584
+ type: t,
1585
+ placeholder: n,
1586
+ disabled: s,
1587
+ readOnly: o,
1588
+ className: `sfr-input${l ? " sfr-input--error" : ""}`,
1589
+ "data-sfr-field": "text"
1590
+ }
1591
+ ),
1592
+ ((d = c.error) == null ? void 0 : d.message) && /* @__PURE__ */ i("p", { className: "sfr-error", children: c.error.message })
1593
+ ] });
1594
+ }, Je = ({
1595
+ name: e,
1596
+ control: r,
1597
+ placeholder: n,
1598
+ disabled: t,
1599
+ readOnly: s
1600
+ }) => {
1601
+ var c;
1602
+ const { field: o, fieldState: a } = P({ name: e, control: r });
1603
+ return /* @__PURE__ */ m("div", { className: "space-y-1", children: [
1604
+ /* @__PURE__ */ i(
1605
+ "textarea",
1606
+ {
1607
+ ...o,
1608
+ value: o.value ?? "",
1609
+ placeholder: n,
1610
+ disabled: t,
1611
+ readOnly: s,
1612
+ rows: 3,
1613
+ className: `sfr-textarea${a.error ? " sfr-input--error" : ""}`,
1614
+ "data-sfr-field": "textarea"
1615
+ }
1616
+ ),
1617
+ ((c = a.error) == null ? void 0 : c.message) && /* @__PURE__ */ i("p", { className: "sfr-error", children: a.error.message })
1618
+ ] });
1619
+ }, Be = ({
1620
+ name: e,
1621
+ control: r,
1622
+ placeholder: n,
1623
+ options: t,
1624
+ disabled: s,
1625
+ readOnly: o
1626
+ }) => {
1627
+ var l;
1628
+ const { field: a, fieldState: c } = P({ name: e, control: r });
1629
+ return /* @__PURE__ */ m("div", { className: "space-y-1", children: [
1630
+ /* @__PURE__ */ m(
1631
+ "select",
1632
+ {
1633
+ ...a,
1634
+ value: a.value ?? "",
1635
+ disabled: s || o,
1636
+ className: `sfr-select${c.error ? " sfr-input--error" : ""}`,
1637
+ "data-sfr-field": "select",
1638
+ children: [
1639
+ n && /* @__PURE__ */ i("option", { value: "", children: n }),
1640
+ !n && /* @__PURE__ */ i("option", { value: "", children: "Selecione..." }),
1641
+ t.map((d) => /* @__PURE__ */ i("option", { value: d.valor, disabled: d.disabled, children: d.label }, d.valor))
1642
+ ]
1643
+ }
1644
+ ),
1645
+ ((l = c.error) == null ? void 0 : l.message) && /* @__PURE__ */ i("p", { className: "sfr-error", children: c.error.message })
1646
+ ] });
1647
+ }, Ue = ({
1648
+ name: e,
1649
+ control: r,
1650
+ label: n,
1651
+ disabled: t,
1652
+ readOnly: s
1653
+ }) => {
1654
+ var c;
1655
+ const { field: o, fieldState: a } = P({ name: e, control: r });
1656
+ return /* @__PURE__ */ m("div", { className: "space-y-1", children: [
1657
+ /* @__PURE__ */ m("label", { className: "sfr-checkbox-label", "data-sfr-field": "checkbox", children: [
1658
+ /* @__PURE__ */ i(
1659
+ "input",
1660
+ {
1661
+ type: "checkbox",
1662
+ name: o.name,
1663
+ checked: !!o.value,
1664
+ onChange: (l) => !s && o.onChange(l.target.checked),
1665
+ onBlur: o.onBlur,
1666
+ onKeyDown: (l) => {
1667
+ s && l.key === " " && l.preventDefault();
1668
+ },
1669
+ disabled: t,
1670
+ readOnly: s,
1671
+ className: "sfr-checkbox"
1672
+ }
1673
+ ),
1674
+ n && /* @__PURE__ */ i("span", { className: "sfr-checkbox-text", children: n })
1675
+ ] }),
1676
+ ((c = a.error) == null ? void 0 : c.message) && /* @__PURE__ */ i("p", { className: "sfr-error", children: a.error.message })
1677
+ ] });
1678
+ }, jr = ({
1679
+ name: e,
1680
+ control: r,
1681
+ options: n,
1682
+ disabled: t
1683
+ }) => {
1684
+ var l;
1685
+ const { field: s, fieldState: o } = P({ name: e, control: r }), a = Array.isArray(s.value) ? s.value : [], c = (d) => {
1686
+ const f = a.includes(d) ? a.filter((u) => u !== d) : [...a, d];
1687
+ s.onChange(f);
1688
+ };
1689
+ return /* @__PURE__ */ m("div", { className: "space-y-1", children: [
1690
+ /* @__PURE__ */ i("div", { className: "sfr-checkbox-group", "data-sfr-field": "checkbox-group", children: n.map((d) => /* @__PURE__ */ m("label", { className: "sfr-checkbox-label", children: [
1691
+ /* @__PURE__ */ i(
1692
+ "input",
1693
+ {
1694
+ type: "checkbox",
1695
+ checked: a.includes(d.valor),
1696
+ onChange: () => c(d.valor),
1697
+ disabled: t || d.disabled,
1698
+ className: "sfr-checkbox"
1699
+ }
1700
+ ),
1701
+ /* @__PURE__ */ i("span", { className: "sfr-checkbox-text", children: d.label })
1702
+ ] }, d.valor)) }),
1703
+ ((l = o.error) == null ? void 0 : l.message) && /* @__PURE__ */ i("p", { className: "sfr-error", children: o.error.message })
1704
+ ] });
1705
+ }, Zr = ({
1706
+ name: e,
1707
+ control: r,
1708
+ options: n,
1709
+ visualStyle: t = "default",
1710
+ disabled: s
1711
+ }) => {
1712
+ var l;
1713
+ const { field: o, fieldState: a } = P({ name: e, control: r }), c = t === "card";
1714
+ return /* @__PURE__ */ m("div", { className: "space-y-1", children: [
1715
+ /* @__PURE__ */ i(
1716
+ "div",
1717
+ {
1718
+ className: c ? "sfr-radio-cards" : "sfr-radio-group",
1719
+ "data-sfr-field": "radio",
1720
+ "data-style": t,
1721
+ children: n.map((d) => /* @__PURE__ */ m(
1722
+ "label",
1723
+ {
1724
+ className: c ? "sfr-radio-card" : "sfr-radio-label",
1725
+ "data-selected": o.value === d.valor ? "true" : void 0,
1726
+ children: [
1727
+ /* @__PURE__ */ i(
1728
+ "input",
1729
+ {
1730
+ type: "radio",
1731
+ name: o.name,
1732
+ value: d.valor,
1733
+ checked: o.value === d.valor,
1734
+ onChange: () => o.onChange(d.valor),
1735
+ onBlur: o.onBlur,
1736
+ disabled: s || d.disabled,
1737
+ className: c ? "sfr-radio-card-input" : "sfr-radio"
1738
+ }
1739
+ ),
1740
+ /* @__PURE__ */ i(
1741
+ "span",
1742
+ {
1743
+ className: c ? "sfr-radio-card-label" : "sfr-radio-text",
1744
+ children: d.label
1745
+ }
1746
+ )
1747
+ ]
1748
+ },
1749
+ d.valor
1750
+ ))
1751
+ }
1752
+ ),
1753
+ ((l = a.error) == null ? void 0 : l.message) && /* @__PURE__ */ i("p", { className: "sfr-error", children: a.error.message })
1754
+ ] });
1755
+ }, gs = (e) => {
1756
+ const r = /* @__PURE__ */ new Date();
1757
+ return r.setFullYear(r.getFullYear() - e), r.toISOString().split("T")[0];
1758
+ }, ys = (e) => {
1759
+ const r = /* @__PURE__ */ new Date();
1760
+ return r.setFullYear(r.getFullYear() - e), r.toISOString().split("T")[0];
1761
+ }, ye = ({
1762
+ name: e,
1763
+ control: r,
1764
+ isDatetime: n,
1765
+ disabled: t,
1766
+ readOnly: s,
1767
+ validacao: o
1768
+ }) => {
1769
+ var y;
1770
+ const { field: a, fieldState: c } = P({ name: e, control: r }), l = n ? "datetime-local" : "date", d = (v) => n ? v + "T00:00" : v, f = (o == null ? void 0 : o.minAge) != null ? d(gs(o.minAge)) : (o == null ? void 0 : o.maxDate) != null ? d(o.maxDate) : void 0, u = (o == null ? void 0 : o.maxAge) != null ? d(ys(o.maxAge)) : (o == null ? void 0 : o.minDate) != null ? d(o.minDate) : void 0;
1771
+ return /* @__PURE__ */ m("div", { className: "space-y-1", children: [
1772
+ /* @__PURE__ */ i(
1773
+ "input",
1774
+ {
1775
+ name: a.name,
1776
+ value: a.value ?? "",
1777
+ onChange: a.onChange,
1778
+ onBlur: a.onBlur,
1779
+ type: l,
1780
+ min: u,
1781
+ max: f,
1782
+ disabled: t,
1783
+ readOnly: s,
1784
+ className: `sfr-input${c.error ? " sfr-input--error" : ""}`,
1785
+ "data-sfr-field": "date"
1786
+ }
1787
+ ),
1788
+ ((y = c.error) == null ? void 0 : y.message) && /* @__PURE__ */ i("p", { className: "sfr-error", children: c.error.message })
1789
+ ] });
1790
+ }, vs = (e) => e < 1024 ? `${e} B` : e < 1024 * 1024 ? `${(e / 1024).toFixed(1)} KB` : `${(e / (1024 * 1024)).toFixed(1)} MB`, Lr = ({
1791
+ name: e,
1792
+ control: r,
1793
+ disabled: n,
1794
+ campo: t,
1795
+ fileTypes: s,
1796
+ maxFileSize: o
1797
+ }) => {
1798
+ var _;
1799
+ const { field: a, fieldState: c } = P({ name: e, control: r }), { uploadFile: l } = ne(), [d, f] = F({
1800
+ status: "idle"
1801
+ }), u = te(null), y = typeof a.value == "string" && a.value ? a.value : null, v = oe(
1802
+ async (x) => {
1803
+ var g;
1804
+ if (s && s.length > 0) {
1805
+ const p = ((g = x.name.split(".").pop()) == null ? void 0 : g.toLowerCase()) ?? "", O = x.type.toLowerCase();
1806
+ if (!s.some(
1807
+ (z) => z.toLowerCase() === p || z.toLowerCase() === O
1808
+ )) {
1809
+ f({
1810
+ status: "error",
1811
+ message: `Tipo de arquivo não permitido. Permitidos: ${s.join(", ")}`
1812
+ });
1813
+ return;
1814
+ }
1815
+ }
1816
+ if (o && x.size > o) {
1817
+ f({
1818
+ status: "error",
1819
+ message: `Arquivo muito grande. Tamanho máximo: ${vs(o)}`
1820
+ });
1821
+ return;
1822
+ }
1823
+ if (!l) {
1824
+ f({
1825
+ status: "error",
1826
+ message: "Preview: upload não disponível sem configuração."
1827
+ });
1828
+ return;
1829
+ }
1830
+ f({ status: "uploading", fileName: x.name, progress: 0 });
1831
+ try {
1832
+ const p = await l(x, t ?? e, (O) => {
1833
+ f(
1834
+ (E) => E.status === "uploading" ? { ...E, progress: Math.min(100, O) } : E
1835
+ );
1836
+ });
1837
+ a.onChange(p), f({ status: "done", uploadId: p, fileName: x.name });
1838
+ } catch {
1839
+ f({
1840
+ status: "error",
1841
+ message: "Falha no upload. Tente novamente."
1842
+ });
1843
+ }
1844
+ },
1845
+ [l, t, e, a, s, o]
1846
+ ), N = oe(
1847
+ (x) => {
1848
+ var p;
1849
+ const g = (p = x.target.files) == null ? void 0 : p[0];
1850
+ g && v(g);
1851
+ },
1852
+ [v]
1853
+ ), b = oe(() => {
1854
+ a.onChange(""), f({ status: "idle" }), u.current && (u.current.value = "");
1855
+ }, [a]);
1856
+ return /* @__PURE__ */ m(
1857
+ "div",
1858
+ {
1859
+ className: "sfr-file-upload",
1860
+ "data-sfr-field": "file",
1861
+ "data-status": d.status,
1862
+ children: [
1863
+ !y && d.status !== "done" && /* @__PURE__ */ m("label", { className: "sfr-file-drop", children: [
1864
+ /* @__PURE__ */ i(
1865
+ "input",
1866
+ {
1867
+ ref: u,
1868
+ type: "file",
1869
+ onChange: N,
1870
+ disabled: n || d.status === "uploading",
1871
+ className: "sfr-file-input"
1872
+ }
1873
+ ),
1874
+ /* @__PURE__ */ i("span", { className: "sfr-file-label", children: d.status === "uploading" ? `Enviando ${d.fileName}…` : "Clique ou arraste o arquivo" })
1875
+ ] }),
1876
+ (y || d.status === "done") && /* @__PURE__ */ m("div", { className: "sfr-file-done", children: [
1877
+ /* @__PURE__ */ i("span", { className: "sfr-file-name", children: d.status === "done" ? d.fileName : "Arquivo enviado" }),
1878
+ !n && /* @__PURE__ */ i(
1879
+ "button",
1880
+ {
1881
+ type: "button",
1882
+ onClick: b,
1883
+ className: "sfr-file-remove",
1884
+ children: "✕"
1885
+ }
1886
+ )
1887
+ ] }),
1888
+ d.status === "error" && /* @__PURE__ */ i("p", { className: "sfr-error", children: d.message }),
1889
+ ((_ = c.error) == null ? void 0 : _.message) && /* @__PURE__ */ i("p", { className: "sfr-error", children: c.error.message })
1890
+ ]
1891
+ }
1892
+ );
1893
+ }, bs = {
1894
+ cpf: (e) => e.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"),
1895
+ telefone: (e) => {
1896
+ const r = e.replace(/\D/g, "").slice(0, 11);
1897
+ return r.length <= 10 ? r.replace(/(\d{2})(\d)/, "($1) $2").replace(/(\d{4})(\d)/, "$1-$2") : r.replace(/(\d{2})(\d)/, "($1) $2").replace(/(\d{5})(\d)/, "$1-$2");
1898
+ },
1899
+ cep: (e) => e.replace(/\D/g, "").slice(0, 8).replace(/(\d{5})(\d)/, "$1-$2")
1900
+ }, ie = ({
1901
+ name: e,
1902
+ control: r,
1903
+ placeholder: n,
1904
+ maskType: t,
1905
+ disabled: s,
1906
+ readOnly: o
1907
+ }) => {
1908
+ var f;
1909
+ const { field: a, fieldState: c } = P({ name: e, control: r }), l = bs[t || ""], d = oe(
1910
+ (u) => {
1911
+ a.onChange(l ? l(u.target.value) : u.target.value);
1912
+ },
1913
+ [a, l]
1914
+ );
1915
+ return /* @__PURE__ */ m("div", { className: "space-y-1", children: [
1916
+ /* @__PURE__ */ i(
1917
+ "input",
1918
+ {
1919
+ name: a.name,
1920
+ value: a.value || "",
1921
+ onChange: d,
1922
+ onBlur: a.onBlur,
1923
+ placeholder: n,
1924
+ disabled: s,
1925
+ readOnly: o,
1926
+ className: `sfr-input${c.error ? " sfr-input--error" : ""}`,
1927
+ "data-sfr-field": "masked"
1928
+ }
1929
+ ),
1930
+ ((f = c.error) == null ? void 0 : f.message) && /* @__PURE__ */ i("p", { className: "sfr-error", children: c.error.message })
1931
+ ] });
1932
+ }, Xe = ({ name: e, control: r }) => {
1933
+ const { field: n } = P({ name: e, control: r });
1934
+ return /* @__PURE__ */ i("input", { type: "hidden", ...n, value: n.value ?? "" });
1935
+ }, Mr = (e) => e.replace(/\D/g, ""), Ns = (e) => {
1936
+ const r = Mr(e).slice(0, 8);
1937
+ return r.length <= 5 ? r : `${r.slice(0, 5)}-${r.slice(5)}`;
1938
+ }, _s = async (e, r) => {
1939
+ const n = await fetch(`https://viacep.com.br/ws/${e}/json/`, { signal: r });
1940
+ if (!n.ok) throw new Error("Falha ao consultar CEP");
1941
+ return n.json();
1942
+ }, Vr = ({
1943
+ name: e,
1944
+ control: r,
1945
+ placeholder: n = "00000-000",
1946
+ disabled: t,
1947
+ readOnly: s,
1948
+ cepFillMap: o
1949
+ }) => {
1950
+ var x, g;
1951
+ const { field: a, fieldState: c } = P({ name: e, control: r }), { setValue: l } = be(), { cepLookup: d } = ne(), [f, u] = F("idle"), [y, v] = F(null), N = te(null);
1952
+ q(
1953
+ () => () => {
1954
+ var p;
1955
+ (p = N.current) == null || p.abort();
1956
+ },
1957
+ []
1958
+ );
1959
+ const b = oe(async () => {
1960
+ var O;
1961
+ a.onBlur();
1962
+ const p = Mr(a.value ?? "");
1963
+ if (p.length === 8) {
1964
+ (O = N.current) == null || O.abort(), N.current = new AbortController(), u("loading"), v(null);
1965
+ try {
1966
+ let E;
1967
+ if (d) {
1968
+ const C = N.current;
1969
+ if (E = await d(p), C.signal.aborted) return;
1970
+ } else {
1971
+ const C = await _s(p, N.current.signal);
1972
+ if (C.erro) {
1973
+ u("error"), v("CEP não encontrado");
1974
+ return;
1975
+ }
1976
+ E = {
1977
+ logradouro: C.logradouro,
1978
+ bairro: C.bairro,
1979
+ cidade: C.localidade,
1980
+ estado: C.uf
1981
+ };
1982
+ }
1983
+ if (E.erro) {
1984
+ u("error"), v("CEP não encontrado");
1985
+ return;
1986
+ }
1987
+ const z = e.includes(".") ? `${e.substring(0, e.lastIndexOf("."))}.` : "", T = (C, K, A) => {
1988
+ if (!A) return;
1989
+ const M = o != null && o[C] ? `${z}${o[C]}` : `${z}${K}`;
1990
+ l(M, A);
1991
+ };
1992
+ T("logradouro", "_address_logradouro", E.logradouro), T("bairro", "_address_bairro", E.bairro), T("cidade", "_address_cidade", E.cidade), T("estado", "_address_estado", E.estado), u("success");
1993
+ } catch (E) {
1994
+ if (E instanceof Error && E.name === "AbortError") return;
1995
+ u("error"), v("Erro ao buscar CEP");
1996
+ }
1997
+ }
1998
+ }, [a, d, l, e, o]), _ = oe(
1999
+ (p) => {
2000
+ a.onChange(Ns(p.target.value));
2001
+ },
2002
+ [a]
2003
+ );
2004
+ return /* @__PURE__ */ m("div", { className: "space-y-1", children: [
2005
+ /* @__PURE__ */ m(
2006
+ "div",
2007
+ {
2008
+ className: "sfr-cep-wrapper",
2009
+ "data-sfr-field": "cep",
2010
+ "data-status": f,
2011
+ children: [
2012
+ /* @__PURE__ */ i(
2013
+ "input",
2014
+ {
2015
+ name: a.name,
2016
+ value: a.value || "",
2017
+ onChange: _,
2018
+ onBlur: b,
2019
+ placeholder: n,
2020
+ disabled: t,
2021
+ readOnly: s,
2022
+ className: `sfr-input${c.error ? " sfr-input--error" : ""}`
2023
+ }
2024
+ ),
2025
+ f === "loading" && /* @__PURE__ */ i("span", { className: "sfr-cep-indicator sfr-cep-loading" }),
2026
+ f === "success" && /* @__PURE__ */ i("span", { className: "sfr-cep-indicator sfr-cep-success" }),
2027
+ f === "error" && /* @__PURE__ */ i("span", { className: "sfr-cep-indicator sfr-cep-error" })
2028
+ ]
2029
+ }
2030
+ ),
2031
+ (((x = c.error) == null ? void 0 : x.message) || y) && /* @__PURE__ */ i("p", { className: "sfr-error", children: ((g = c.error) == null ? void 0 : g.message) || y })
2032
+ ] });
2033
+ }, xs = ({
2034
+ field: e,
2035
+ control: r,
2036
+ nameOverride: n
2037
+ }) => {
2038
+ const t = {
2039
+ name: n,
2040
+ control: r,
2041
+ placeholder: e.placeholder
2042
+ };
2043
+ switch (e.tipo) {
2044
+ case h.TEXTO:
2045
+ return /* @__PURE__ */ i(X, { ...t, type: "text" });
2046
+ case h.EMAIL:
2047
+ return /* @__PURE__ */ i(X, { ...t, type: "email" });
2048
+ case h.NUMBER:
2049
+ return /* @__PURE__ */ i(X, { ...t, type: "number" });
2050
+ case h.TEXTAREA:
2051
+ return /* @__PURE__ */ i(Je, { ...t });
2052
+ case h.SELECT:
2053
+ return /* @__PURE__ */ i(Be, { ...t, options: e.opcoes ?? [] });
2054
+ case h.RADIO:
2055
+ return /* @__PURE__ */ i(Zr, { ...t, options: e.opcoes ?? [] });
2056
+ case h.CHECKBOX:
2057
+ return /* @__PURE__ */ i(Ue, { name: n, control: r, label: e.label });
2058
+ case h.CHECKBOX_GROUP:
2059
+ return /* @__PURE__ */ i(jr, { ...t, options: e.opcoes ?? [] });
2060
+ case h.DATE:
2061
+ return /* @__PURE__ */ i(ye, { ...t, validacao: e.validacao });
2062
+ case h.DATETIME:
2063
+ return /* @__PURE__ */ i(ye, { ...t, isDatetime: !0, validacao: e.validacao });
2064
+ case h.FILE:
2065
+ return /* @__PURE__ */ i(Lr, { name: n, control: r });
2066
+ case h.TELEFONE:
2067
+ return /* @__PURE__ */ i(ie, { ...t, maskType: "telefone" });
2068
+ case h.CPF:
2069
+ return /* @__PURE__ */ i(ie, { ...t, maskType: "cpf" });
2070
+ case h.CEP:
2071
+ return /* @__PURE__ */ i(
2072
+ Vr,
2073
+ {
2074
+ name: n,
2075
+ control: r,
2076
+ placeholder: e.placeholder
2077
+ }
2078
+ );
2079
+ case h.HIDDEN:
2080
+ return /* @__PURE__ */ i(Xe, { name: n, control: r });
2081
+ default:
2082
+ return /* @__PURE__ */ i(X, { ...t, type: "text" });
2083
+ }
2084
+ }, ws = ({
2085
+ name: e,
2086
+ control: r,
2087
+ subFields: n = [],
2088
+ minItems: t = 1,
2089
+ maxItems: s,
2090
+ itemLabel: o = "Item",
2091
+ addLabel: a
2092
+ }) => {
2093
+ var b;
2094
+ const { fields: c, append: l, remove: d } = gr({
2095
+ control: r,
2096
+ name: e
2097
+ }), { errors: f } = Kr({ control: r }), u = (b = f[e]) == null ? void 0 : b.message;
2098
+ q(() => {
2099
+ if (c.length < t)
2100
+ for (let _ = c.length; _ < t; _++)
2101
+ l({});
2102
+ }, []);
2103
+ const y = [...n].sort((_, x) => _.ordem - x.ordem), v = !s || c.length < s, N = a ?? `Adicionar ${o.toLowerCase()}`;
2104
+ return /* @__PURE__ */ m("div", { className: "sfr-field-array space-y-3", children: [
2105
+ c.map((_, x) => /* @__PURE__ */ m(
2106
+ "div",
2107
+ {
2108
+ className: "sfr-field-array__item border rounded-lg p-4",
2109
+ children: [
2110
+ /* @__PURE__ */ m("div", { className: "sfr-field-array__item-header flex items-center justify-between mb-4", children: [
2111
+ /* @__PURE__ */ m("div", { className: "flex items-center gap-2", children: [
2112
+ /* @__PURE__ */ i("div", { className: "sfr-field-array__counter w-6 h-6 rounded-full flex items-center justify-center text-xs font-bold shrink-0", children: x + 1 }),
2113
+ /* @__PURE__ */ m("span", { className: "text-sm font-semibold", children: [
2114
+ o,
2115
+ " ",
2116
+ x + 1
2117
+ ] })
2118
+ ] }),
2119
+ c.length > t && /* @__PURE__ */ i(
2120
+ "button",
2121
+ {
2122
+ type: "button",
2123
+ onClick: () => d(x),
2124
+ className: "sfr-field-array__remove",
2125
+ "aria-label": `Remover ${o.toLowerCase()} ${x + 1}`,
2126
+ children: /* @__PURE__ */ i(yr, { className: "w-4 h-4" })
2127
+ }
2128
+ )
2129
+ ] }),
2130
+ /* @__PURE__ */ i("div", { className: "grid grid-cols-12 gap-4", children: y.map((g) => {
2131
+ const p = `${e}.${x}.${g.nome}`, E = `span ${g.tamanho ?? 12}`, z = /* @__PURE__ */ i(
2132
+ xs,
2133
+ {
2134
+ field: g,
2135
+ control: r,
2136
+ nameOverride: p
2137
+ }
2138
+ );
2139
+ return g.tipo === h.CHECKBOX || g.tipo === h.HIDDEN ? /* @__PURE__ */ i(
2140
+ "div",
2141
+ {
2142
+ className: "max-sm:!col-span-12",
2143
+ style: { gridColumn: E },
2144
+ children: z
2145
+ },
2146
+ g.id
2147
+ ) : /* @__PURE__ */ m(
2148
+ "div",
2149
+ {
2150
+ className: "max-sm:!col-span-12 space-y-2",
2151
+ style: { gridColumn: E },
2152
+ children: [
2153
+ /* @__PURE__ */ m("label", { className: "sfr-label font-medium flex items-center gap-1 text-sm", children: [
2154
+ g.label,
2155
+ g.obrigatorio && /* @__PURE__ */ i("span", { className: "sfr-required", children: "*" })
2156
+ ] }),
2157
+ z,
2158
+ g.hint && /* @__PURE__ */ i("p", { className: "sfr-hint text-xs", children: g.hint })
2159
+ ]
2160
+ },
2161
+ g.id
2162
+ );
2163
+ }) })
2164
+ ]
2165
+ },
2166
+ _.id
2167
+ )),
2168
+ v && /* @__PURE__ */ m(
2169
+ "button",
2170
+ {
2171
+ type: "button",
2172
+ className: "sfr-btn sfr-btn--outline w-full flex items-center justify-center gap-2 py-2 px-4 border rounded-lg text-sm",
2173
+ onClick: () => l({}),
2174
+ children: [
2175
+ /* @__PURE__ */ i(vr, { className: "w-4 h-4" }),
2176
+ N
2177
+ ]
2178
+ }
2179
+ ),
2180
+ s && /* @__PURE__ */ m("p", { className: "sfr-hint text-xs text-center", children: [
2181
+ "Máximo de ",
2182
+ s,
2183
+ " ",
2184
+ o.toLowerCase(),
2185
+ s > 1 ? "s" : ""
2186
+ ] }),
2187
+ u && /* @__PURE__ */ m("p", { className: "sfr-error text-sm flex items-center gap-1", children: [
2188
+ /* @__PURE__ */ i(br, { className: "w-4 h-4 shrink-0" }),
2189
+ u
2190
+ ] })
2191
+ ] });
2192
+ }, lr = (e) => `R$ ${(e / 100).toFixed(2).replace(".", ",")}`, Cs = (e, r) => {
2193
+ const n = /* @__PURE__ */ new Date(e.slice(0, 10) + "T00:00:00Z"), t = /* @__PURE__ */ new Date(r.slice(0, 10) + "T00:00:00Z");
2194
+ return Math.round((t.getTime() - n.getTime()) / 864e5) + 1;
2195
+ }, zs = (e, r) => {
2196
+ const n = [], t = /* @__PURE__ */ new Date(e.slice(0, 10) + "T00:00:00Z"), s = /* @__PURE__ */ new Date(r.slice(0, 10) + "T00:00:00Z");
2197
+ let o = 0;
2198
+ for (; t <= s && o < 60; )
2199
+ n.push(t.toISOString().slice(0, 10)), t.setUTCDate(t.getUTCDate() + 1), o++;
2200
+ return n;
2201
+ }, Es = (e) => {
2202
+ const [r, n, t] = e.split("-").map(Number), s = new Date(Date.UTC(r, n - 1, t)), o = String(t).padStart(2, "0"), a = String(n).padStart(2, "0"), c = new Intl.DateTimeFormat("pt-BR", {
2203
+ weekday: "long",
2204
+ timeZone: "UTC"
2205
+ }).format(s), l = c.charAt(0).toUpperCase() + c.slice(1);
2206
+ return `${o}/${a} - ${l}`;
2207
+ }, Ss = (e, r) => {
2208
+ const n = (t) => {
2209
+ const [s, o, a] = t.slice(0, 10).split("-");
2210
+ return `${a}/${o}/${s}`;
2211
+ };
2212
+ return `${n(e)} a ${n(r)}`;
2213
+ }, Os = ({ name: e, control: r }) => {
2214
+ var ue;
2215
+ const { field: n, fieldState: t } = P({ name: e, control: r }), { externalData: s = {} } = ne(), o = n.value ?? null, a = (ue = t.error) == null ? void 0 : ue.message, c = (w) => s[`evento.${w}`] ?? s[w], l = c("dataInicioEvento") ?? "", d = c("dataFimEvento") ?? "", f = Number(c("valor") ?? 0), u = Number(c("valorPorDia") ?? 0), y = c("vagasTotal"), v = c("vagasPorDia"), N = c("vagasMasculinas"), b = c("vagasFemininas"), _ = y != null ? Number(y) : null, x = v != null ? Number(v) : null, g = N != null ? Number(N) : null, p = b != null ? Number(b) : null, O = l && d ? zs(l, d) : [], z = (l && d ? Cs(l, d) : 0) > 1, T = g != null && g > 0 && p != null && p > 0, C = g != null && p == null ? "masculino" : p != null && g == null ? "feminino" : null, K = (o == null ? void 0 : o.tipo) ?? null, A = (o == null ? void 0 : o.data) ?? null, M = (o == null ? void 0 : o.genero) ?? null, J = te(o);
2216
+ J.current = o;
2217
+ const B = te(n.onChange);
2218
+ B.current = n.onChange, q(() => {
2219
+ var w, D, G;
2220
+ C && ((w = J.current) == null ? void 0 : w.genero) !== C && B.current({
2221
+ tipo: ((D = J.current) == null ? void 0 : D.tipo) ?? null,
2222
+ data: ((G = J.current) == null ? void 0 : G.data) ?? null,
2223
+ genero: C
2224
+ });
2225
+ }, [C]);
2226
+ const re = (w) => {
2227
+ const D = { tipo: w, data: null };
2228
+ (T || C) && (D.genero = M ?? C ?? void 0), n.onChange(D);
2229
+ }, V = (w) => {
2230
+ const D = { tipo: "por_dia", data: w };
2231
+ (T || C) && (D.genero = M ?? C ?? void 0), n.onChange(D);
2232
+ }, Q = (w) => {
2233
+ n.onChange({ tipo: K, data: A, genero: w });
2234
+ }, W = (w) => K === w;
2235
+ return /* @__PURE__ */ m("div", { className: "sfr-participation-type space-y-3", children: [
2236
+ T && /* @__PURE__ */ m("div", { className: "flex items-center gap-2 px-1", children: [
2237
+ /* @__PURE__ */ i("span", { className: "text-xs sfr-text-muted shrink-0", children: "Você é:" }),
2238
+ /* @__PURE__ */ i("div", { className: "flex gap-2", children: ["masculino", "feminino"].map((w) => /* @__PURE__ */ i(
2239
+ "button",
2240
+ {
2241
+ type: "button",
2242
+ onClick: () => Q(w),
2243
+ className: "sfr-participation-type__gender-btn px-3 py-1 rounded-full text-xs font-medium border transition-all",
2244
+ "data-selected": M === w ? "true" : void 0,
2245
+ children: w === "masculino" ? "Masculino" : "Feminino"
2246
+ },
2247
+ w
2248
+ )) })
2249
+ ] }),
2250
+ /* @__PURE__ */ m(
2251
+ "button",
2252
+ {
2253
+ type: "button",
2254
+ onClick: () => re("todos_os_dias"),
2255
+ className: "sfr-participation-type__card w-full text-left flex items-start gap-3 p-4 rounded-xl border-2 transition-all",
2256
+ "data-selected": W("todos_os_dias") ? "true" : void 0,
2257
+ children: [
2258
+ /* @__PURE__ */ i(
2259
+ "div",
2260
+ {
2261
+ className: "sfr-participation-type__card-icon mt-0.5 p-2 rounded-lg shrink-0",
2262
+ "data-selected": W("todos_os_dias") ? "true" : void 0,
2263
+ children: /* @__PURE__ */ i(et, { className: "w-4 h-4" })
2264
+ }
2265
+ ),
2266
+ /* @__PURE__ */ m("div", { className: "flex-1 min-w-0", children: [
2267
+ /* @__PURE__ */ i("p", { className: "font-semibold text-sm", children: "Participar todos os dias" }),
2268
+ l && d ? /* @__PURE__ */ i("p", { className: "text-xs sfr-text-muted", children: Ss(l, d) }) : /* @__PURE__ */ i("p", { className: "text-xs sfr-text-muted italic", children: "Datas do evento" })
2269
+ ] }),
2270
+ /* @__PURE__ */ m("div", { className: "text-right shrink-0", children: [
2271
+ f > 0 && /* @__PURE__ */ i(
2272
+ "p",
2273
+ {
2274
+ className: "font-bold text-sm sfr-participation-type__price",
2275
+ "data-selected": W("todos_os_dias") ? "true" : void 0,
2276
+ children: lr(f)
2277
+ }
2278
+ ),
2279
+ _ != null && _ > 0 && /* @__PURE__ */ m("p", { className: "text-xs flex items-center justify-end gap-1 sfr-participation-type__vagas", children: [
2280
+ /* @__PURE__ */ i(rt, { className: "w-3 h-3" }),
2281
+ _,
2282
+ " vagas disponíveis"
2283
+ ] })
2284
+ ] })
2285
+ ]
2286
+ }
2287
+ ),
2288
+ z ? /* @__PURE__ */ m(
2289
+ "button",
2290
+ {
2291
+ type: "button",
2292
+ onClick: () => re("por_dia"),
2293
+ className: "sfr-participation-type__card w-full text-left flex items-start gap-3 p-4 rounded-xl border-2 transition-all",
2294
+ "data-selected": W("por_dia") ? "true" : void 0,
2295
+ children: [
2296
+ /* @__PURE__ */ i(
2297
+ "div",
2298
+ {
2299
+ className: "sfr-participation-type__card-icon mt-0.5 p-2 rounded-lg shrink-0",
2300
+ "data-selected": W("por_dia") ? "true" : void 0,
2301
+ children: /* @__PURE__ */ i(tt, { className: "w-4 h-4" })
2302
+ }
2303
+ ),
2304
+ /* @__PURE__ */ m("div", { className: "flex-1 min-w-0", children: [
2305
+ /* @__PURE__ */ i("p", { className: "font-semibold text-sm", children: "Participar um dia" }),
2306
+ /* @__PURE__ */ i("p", { className: "text-xs sfr-text-muted", children: "Escolha o dia desejado abaixo" })
2307
+ ] }),
2308
+ /* @__PURE__ */ m("div", { className: "text-right shrink-0", children: [
2309
+ u > 0 && /* @__PURE__ */ i(
2310
+ "p",
2311
+ {
2312
+ className: "font-bold text-sm sfr-participation-type__price",
2313
+ "data-selected": W("por_dia") ? "true" : void 0,
2314
+ children: lr(u)
2315
+ }
2316
+ ),
2317
+ /* @__PURE__ */ i("p", { className: "text-xs sfr-text-muted", children: "por dia" })
2318
+ ] })
2319
+ ]
2320
+ }
2321
+ ) : l ? /* @__PURE__ */ m("div", { className: "flex items-start gap-2 px-3 py-2.5 rounded-lg border sfr-participation-type__notice", children: [
2322
+ /* @__PURE__ */ i(Nr, { className: "w-3.5 h-3.5 mt-0.5 shrink-0 sfr-text-muted" }),
2323
+ /* @__PURE__ */ i("p", { className: "text-xs sfr-text-muted", children: 'Este evento ocorre em apenas 1 dia — a opção "Participar um dia" não é necessária.' })
2324
+ ] }) : null,
2325
+ K === "por_dia" && /* @__PURE__ */ m("div", { className: "pl-2 space-y-2 sfr-participation-type__days", children: [
2326
+ /* @__PURE__ */ i("p", { className: "text-xs font-semibold uppercase tracking-wide sfr-primary-text", children: "Selecione o dia:" }),
2327
+ O.length === 0 ? /* @__PURE__ */ i("p", { className: "text-xs sfr-text-muted italic", children: "Nenhuma data configurada no evento" }) : O.map((w) => /* @__PURE__ */ m(
2328
+ "button",
2329
+ {
2330
+ type: "button",
2331
+ onClick: () => V(w),
2332
+ className: "sfr-participation-type__day-btn w-full text-left flex items-center justify-between px-4 py-3 rounded-lg border transition-all",
2333
+ "data-selected": A === w ? "true" : void 0,
2334
+ children: [
2335
+ /* @__PURE__ */ m("div", { className: "flex items-center gap-3", children: [
2336
+ /* @__PURE__ */ i(
2337
+ "span",
2338
+ {
2339
+ className: "w-4 h-4 rounded-full border-2 shrink-0 flex items-center justify-center sfr-participation-type__day-radio",
2340
+ "data-selected": A === w ? "true" : void 0,
2341
+ children: A === w && /* @__PURE__ */ i("span", { className: "w-2 h-2 rounded-full bg-white" })
2342
+ }
2343
+ ),
2344
+ /* @__PURE__ */ i("span", { className: "text-sm", children: Es(w) })
2345
+ ] }),
2346
+ x != null && /* @__PURE__ */ m("span", { className: "text-xs sfr-participation-type__vagas", children: [
2347
+ x,
2348
+ " vagas"
2349
+ ] })
2350
+ ]
2351
+ },
2352
+ w
2353
+ ))
2354
+ ] }),
2355
+ a && /* @__PURE__ */ i("p", { className: "text-sm sfr-error", children: a })
2356
+ ] });
2357
+ }, dr = 0.0315, ur = 0.124, fr = 7, mr = 12, Ts = [
2358
+ {
2359
+ id: "pix",
2360
+ label: "PIX",
2361
+ description: "Transferência instantânea (à vista)",
2362
+ Icon: De,
2363
+ taxa: 0
2364
+ },
2365
+ {
2366
+ id: "dinheiro",
2367
+ label: "Dinheiro",
2368
+ description: "Pagamento em espécie",
2369
+ Icon: _r,
2370
+ taxa: 0
2371
+ },
2372
+ {
2373
+ id: "cartao",
2374
+ label: "Cartão de Crédito",
2375
+ description: "Débito ou crédito na maquininha",
2376
+ Icon: xr,
2377
+ taxa: dr,
2378
+ taxaLabel: `Taxa: ${(dr * 100).toFixed(2).replace(".", ",")}%`
2379
+ }
2380
+ ], $s = [
2381
+ {
2382
+ id: "pix",
2383
+ label: "PIX à Vista",
2384
+ description: "Pagamento instantâneo sem parcelamento",
2385
+ Icon: De,
2386
+ taxa: 0
2387
+ },
2388
+ {
2389
+ id: "pix_parcelado",
2390
+ label: "PIX Parcelado",
2391
+ description: `Parcelado em até ${fr}x sem juros`,
2392
+ Icon: De,
2393
+ taxa: 0,
2394
+ parcelas: fr
2395
+ },
2396
+ {
2397
+ id: "cartao",
2398
+ label: "Cartão de Crédito",
2399
+ description: `Parcelado em até ${mr}x`,
2400
+ Icon: xr,
2401
+ taxa: ur,
2402
+ parcelas: mr,
2403
+ taxaLabel: `Taxa: ${(ur * 100).toFixed(2).replace(".", ",")}%`
2404
+ },
2405
+ {
2406
+ id: "dinheiro",
2407
+ label: "Dinheiro",
2408
+ description: "Pagamento em espécie",
2409
+ Icon: _r,
2410
+ taxa: 0
2411
+ }
2412
+ ], ze = (e) => `R$ ${(e / 100).toFixed(2).replace(".", ",")}`, pr = (e, r) => Math.round(e * (1 + r) * 100) / 100, ks = (e, r) => Math.round(e / r * 100) / 100, Ps = ({
2413
+ name: e,
2414
+ control: r,
2415
+ relatedFieldName: n = "tipo_participacao"
2416
+ }) => {
2417
+ var g;
2418
+ const { field: t, fieldState: s } = P({ name: e, control: r }), { externalData: o = {}, paymentMethodOptions: a } = ne(), c = t.value ?? null, l = (g = s.error) == null ? void 0 : g.message, d = de({ control: r, name: n }), f = (d == null ? void 0 : d.tipo) ?? null, u = (p) => o[`evento.${p}`] ?? o[p], y = Number(u("valor") ?? 0), v = Number(u("valorPorDia") ?? 0), N = f === "por_dia" && v > 0 ? v : y, b = f === "por_dia" ? (a == null ? void 0 : a.porDia) ?? Ts : (a == null ? void 0 : a.todosOsDias) ?? $s, _ = f === "por_dia" ? (() => {
2419
+ if (!(d != null && d.data)) return "Um dia";
2420
+ const [p, O, E] = d.data.split("-");
2421
+ return `${E}/${O}/${p}`;
2422
+ })() : "Todos os dias", x = (p) => {
2423
+ if (p.disabled) return;
2424
+ const O = pr(N, p.taxa), E = { metodo: p.id, valorTotal: O };
2425
+ p.parcelas && (E.parcelas = p.parcelas), t.onChange(E);
2426
+ };
2427
+ return /* @__PURE__ */ m("div", { className: "sfr-payment-method space-y-4", children: [
2428
+ /* @__PURE__ */ m("div", { className: "sfr-payment-method__summary flex items-center justify-between rounded-xl border px-4 py-3", children: [
2429
+ /* @__PURE__ */ m("div", { children: [
2430
+ /* @__PURE__ */ i("p", { className: "text-xs sfr-text-muted", children: "Tipo de participação" }),
2431
+ /* @__PURE__ */ i("p", { className: "font-semibold", children: _ })
2432
+ ] }),
2433
+ /* @__PURE__ */ m("div", { className: "text-right", children: [
2434
+ /* @__PURE__ */ i("p", { className: "text-xs sfr-text-muted", children: "Valor base" }),
2435
+ /* @__PURE__ */ i("p", { className: "text-lg font-bold sfr-primary-text", children: ze(N) })
2436
+ ] })
2437
+ ] }),
2438
+ /* @__PURE__ */ m("div", { className: "sfr-payment-method__notice flex items-start gap-2 rounded-lg border px-3 py-2.5", children: [
2439
+ /* @__PURE__ */ i(Nr, { className: "h-4 w-4 mt-0.5 shrink-0" }),
2440
+ /* @__PURE__ */ m("p", { className: "text-xs", children: [
2441
+ /* @__PURE__ */ i("span", { className: "font-bold", children: "Importante:" }),
2442
+ " Para validar a inscrição e garantir sua vaga, o pagamento deve ser realizado no ato da inscrição."
2443
+ ] })
2444
+ ] }),
2445
+ /* @__PURE__ */ i("p", { className: "text-sm font-semibold sfr-primary-text", children: "Selecione a forma de pagamento:" }),
2446
+ /* @__PURE__ */ i("div", { className: "space-y-3", children: b.map((p) => {
2447
+ const { Icon: O } = p, E = (c == null ? void 0 : c.metodo) === p.id, z = pr(N, p.taxa), T = !!p.parcelas && p.parcelas > 1, C = T ? ks(z, p.parcelas) : null;
2448
+ return /* @__PURE__ */ m(
2449
+ "button",
2450
+ {
2451
+ type: "button",
2452
+ disabled: p.disabled,
2453
+ onClick: () => x(p),
2454
+ className: "sfr-payment-method__card w-full text-left flex items-center gap-4 px-4 py-3 rounded-xl border-2 transition-all",
2455
+ "data-selected": E ? "true" : void 0,
2456
+ "data-disabled": p.disabled ? "true" : void 0,
2457
+ children: [
2458
+ /* @__PURE__ */ i(
2459
+ "div",
2460
+ {
2461
+ className: "sfr-payment-method__card-icon flex items-center justify-center w-10 h-10 rounded-lg shrink-0",
2462
+ "data-selected": E ? "true" : void 0,
2463
+ children: /* @__PURE__ */ i(O, { className: "h-5 w-5" })
2464
+ }
2465
+ ),
2466
+ /* @__PURE__ */ m("div", { className: "flex-1 min-w-0", children: [
2467
+ /* @__PURE__ */ i("p", { className: "font-semibold text-sm leading-tight", children: p.label }),
2468
+ /* @__PURE__ */ i("p", { className: "text-xs sfr-text-muted", children: p.description }),
2469
+ p.taxaLabel && /* @__PURE__ */ m("p", { className: "text-xs sfr-payment-method__taxa mt-0.5", children: [
2470
+ "* ",
2471
+ p.taxaLabel
2472
+ ] }),
2473
+ p.taxa > 0 && /* @__PURE__ */ m("p", { className: "text-xs sfr-text-muted", children: [
2474
+ "Total com taxa: ",
2475
+ ze(z)
2476
+ ] })
2477
+ ] }),
2478
+ /* @__PURE__ */ i("div", { className: "text-right shrink-0", children: T ? /* @__PURE__ */ m(Ee, { children: [
2479
+ /* @__PURE__ */ m("p", { className: "text-xs sfr-text-muted", children: [
2480
+ p.parcelas,
2481
+ "x de"
2482
+ ] }),
2483
+ /* @__PURE__ */ i("p", { className: "text-base font-bold sfr-primary-text", children: ze(C) })
2484
+ ] }) : /* @__PURE__ */ i("p", { className: "text-base font-bold sfr-primary-text", children: ze(z) }) })
2485
+ ]
2486
+ },
2487
+ p.id
2488
+ );
2489
+ }) }),
2490
+ l && /* @__PURE__ */ i("p", { className: "text-xs sfr-error", children: l })
2491
+ ] });
2492
+ }, Ds = ({
2493
+ name: e,
2494
+ control: r,
2495
+ label: n,
2496
+ termoTexto: t,
2497
+ termoPdfUrl: s,
2498
+ termoPdfUploadId: o
2499
+ }) => {
2500
+ var T;
2501
+ const { field: a, fieldState: c } = P({ name: e, control: r }), { resolveTermsUploadUrl: l } = ne(), d = !!c.error, f = (T = c.error) == null ? void 0 : T.message, [u, y] = F(null), [v, N] = F(!1), [b, _] = F(!1);
2502
+ q(() => {
2503
+ if (!o || !l) {
2504
+ y(null);
2505
+ return;
2506
+ }
2507
+ N(!0), l(o).then((C) => y(C)).catch(() => y(null)).finally(() => N(!1));
2508
+ }, [o, l]);
2509
+ const x = a.value === "accepted", g = u || s || null, p = !!(t || g || o), O = !!g;
2510
+ return /* @__PURE__ */ m("div", { className: "sfr-terms space-y-2", children: [
2511
+ /* @__PURE__ */ m(
2512
+ "div",
2513
+ {
2514
+ className: "sfr-terms__box rounded-lg border p-4 space-y-4",
2515
+ style: { borderColor: d ? "var(--sfr-error, #ef4444)" : x ? "var(--sfr-success, #22c55e)" : "var(--sfr-border, #e2e8f0)", background: d ? "color-mix(in srgb, var(--sfr-error, #ef4444) 5%, transparent)" : x ? "color-mix(in srgb, var(--sfr-success, #22c55e) 5%, transparent)" : "transparent" },
2516
+ children: [
2517
+ /* @__PURE__ */ m("div", { className: "flex items-center justify-between gap-2", children: [
2518
+ /* @__PURE__ */ m("div", { className: "flex items-center gap-2", children: [
2519
+ /* @__PURE__ */ i(He, { className: "h-4 w-4 sfr-terms__icon shrink-0" }),
2520
+ /* @__PURE__ */ i("span", { className: "text-sm font-medium", children: n || "Termos e condições" })
2521
+ ] }),
2522
+ p ? /* @__PURE__ */ m(
2523
+ "button",
2524
+ {
2525
+ type: "button",
2526
+ className: "sfr-btn sfr-btn--outline flex items-center gap-1.5 text-xs h-7 px-2 border rounded",
2527
+ disabled: v,
2528
+ onClick: () => _(!0),
2529
+ children: [
2530
+ v ? /* @__PURE__ */ i(wr, { className: "h-3 w-3 animate-spin" }) : /* @__PURE__ */ i(nt, { className: "h-3 w-3" }),
2531
+ "Ler termos"
2532
+ ]
2533
+ }
2534
+ ) : /* @__PURE__ */ i("span", { className: "text-xs sfr-text-muted italic", children: o && v ? "Carregando PDF..." : "Conteúdo não configurado" })
2535
+ ] }),
2536
+ /* @__PURE__ */ m("label", { className: "flex items-start gap-3 cursor-pointer select-none", children: [
2537
+ /* @__PURE__ */ i(
2538
+ "input",
2539
+ {
2540
+ type: "checkbox",
2541
+ className: "sfr-checkbox mt-0.5",
2542
+ checked: x,
2543
+ onChange: (C) => a.onChange(C.target.checked ? "accepted" : ""),
2544
+ style: d ? { outline: "1px solid var(--sfr-error, #ef4444)" } : {}
2545
+ }
2546
+ ),
2547
+ /* @__PURE__ */ m("span", { className: "text-sm leading-snug flex-1", children: [
2548
+ "Li e aceito ",
2549
+ n ? `"${n}"` : "os termos e condições"
2550
+ ] }),
2551
+ x && /* @__PURE__ */ i(st, { className: "h-4 w-4 sfr-terms__check shrink-0 mt-0.5" })
2552
+ ] })
2553
+ ]
2554
+ }
2555
+ ),
2556
+ d && /* @__PURE__ */ m("div", { className: "flex items-center gap-1.5 text-xs sfr-error", children: [
2557
+ /* @__PURE__ */ i(br, { className: "h-3.5 w-3.5 shrink-0" }),
2558
+ f || "Você precisa aceitar os termos para continuar"
2559
+ ] }),
2560
+ b && /* @__PURE__ */ i(
2561
+ "div",
2562
+ {
2563
+ className: "sfr-modal-backdrop fixed inset-0 z-50 flex items-center justify-center p-4",
2564
+ style: { background: "rgba(0,0,0,0.6)" },
2565
+ onClick: () => _(!1),
2566
+ children: /* @__PURE__ */ m(
2567
+ "div",
2568
+ {
2569
+ className: "sfr-modal relative w-full max-w-2xl max-h-[90vh] rounded-xl overflow-hidden flex flex-col",
2570
+ style: { background: "var(--sfr-surface, #ffffff)" },
2571
+ onClick: (C) => C.stopPropagation(),
2572
+ children: [
2573
+ /* @__PURE__ */ m("div", { className: "flex items-center justify-between px-6 py-4 border-b sfr-modal__header", children: [
2574
+ /* @__PURE__ */ m("div", { className: "flex items-center gap-2", children: [
2575
+ /* @__PURE__ */ i(He, { className: "h-4 w-4" }),
2576
+ /* @__PURE__ */ i("span", { className: "font-semibold", children: "Termos e condições" })
2577
+ ] }),
2578
+ /* @__PURE__ */ i(
2579
+ "button",
2580
+ {
2581
+ type: "button",
2582
+ className: "sfr-btn sfr-btn--ghost",
2583
+ onClick: () => _(!1),
2584
+ children: /* @__PURE__ */ i(Cr, { className: "h-4 w-4" })
2585
+ }
2586
+ )
2587
+ ] }),
2588
+ /* @__PURE__ */ i("div", { className: "flex-1 overflow-auto p-4", children: O ? /* @__PURE__ */ i(
2589
+ "iframe",
2590
+ {
2591
+ src: g,
2592
+ className: "w-full rounded border",
2593
+ style: { height: "62vh" },
2594
+ title: "Termos e condições",
2595
+ sandbox: "allow-scripts allow-same-origin"
2596
+ }
2597
+ ) : /* @__PURE__ */ i("p", { className: "text-sm whitespace-pre-wrap leading-relaxed", children: t }) })
2598
+ ]
2599
+ }
2600
+ )
2601
+ }
2602
+ )
2603
+ ] });
2604
+ }, As = ({
2605
+ name: e,
2606
+ control: r,
2607
+ placeholder: n,
2608
+ disabled: t,
2609
+ readOnly: s
2610
+ }) => {
2611
+ var f;
2612
+ const { field: o, fieldState: a } = P({ name: e, control: r }), [c, l] = F(!1), d = !!a.error;
2613
+ return /* @__PURE__ */ m("div", { className: "space-y-1", children: [
2614
+ /* @__PURE__ */ m("div", { className: "relative", children: [
2615
+ /* @__PURE__ */ i(
2616
+ "input",
2617
+ {
2618
+ ...o,
2619
+ value: o.value ?? "",
2620
+ type: c ? "text" : "password",
2621
+ placeholder: n,
2622
+ disabled: t,
2623
+ readOnly: s,
2624
+ className: `sfr-input pr-10${d ? " sfr-input--error" : ""}`,
2625
+ "data-sfr-field": "password"
2626
+ }
2627
+ ),
2628
+ /* @__PURE__ */ i(
2629
+ "button",
2630
+ {
2631
+ type: "button",
2632
+ tabIndex: -1,
2633
+ onClick: () => l((u) => !u),
2634
+ className: "absolute right-3 top-1/2 -translate-y-1/2 text-[var(--t-text-muted)] hover:text-[var(--t-text)] transition-colors",
2635
+ "aria-label": c ? "Ocultar senha" : "Mostrar senha",
2636
+ children: c ? /* @__PURE__ */ i(ot, { size: 16 }) : /* @__PURE__ */ i(at, { size: 16 })
2637
+ }
2638
+ )
2639
+ ] }),
2640
+ ((f = a.error) == null ? void 0 : f.message) && /* @__PURE__ */ i("p", { className: "sfr-error", children: a.error.message })
2641
+ ] });
2642
+ }, Jr = ({
2643
+ name: e,
2644
+ control: r,
2645
+ label: n,
2646
+ disabled: t,
2647
+ readOnly: s
2648
+ }) => {
2649
+ var l;
2650
+ const { field: o, fieldState: a } = P({ name: e, control: r }), c = !!o.value;
2651
+ return /* @__PURE__ */ m("div", { className: "space-y-1", children: [
2652
+ /* @__PURE__ */ m("label", { className: "flex items-center gap-3 cursor-pointer select-none", children: [
2653
+ /* @__PURE__ */ i(
2654
+ "button",
2655
+ {
2656
+ type: "button",
2657
+ role: "switch",
2658
+ "aria-checked": c,
2659
+ disabled: t || s,
2660
+ onClick: () => !s && o.onChange(!c),
2661
+ className: [
2662
+ "relative inline-flex h-6 w-11 shrink-0 items-center rounded-full border-2 border-transparent transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--t-primary)] focus-visible:ring-offset-2",
2663
+ c ? "bg-[var(--t-primary)]" : "bg-[var(--t-border)]",
2664
+ t ? "opacity-50 cursor-not-allowed" : "cursor-pointer"
2665
+ ].join(" "),
2666
+ children: /* @__PURE__ */ i(
2667
+ "span",
2668
+ {
2669
+ className: [
2670
+ "pointer-events-none inline-block h-4 w-4 rounded-full bg-white shadow-lg transition-transform",
2671
+ c ? "translate-x-5" : "translate-x-0.5"
2672
+ ].join(" ")
2673
+ }
2674
+ )
2675
+ }
2676
+ ),
2677
+ /* @__PURE__ */ i("span", { className: "sfr-label !mb-0", children: n })
2678
+ ] }),
2679
+ ((l = a.error) == null ? void 0 : l.message) && /* @__PURE__ */ i("p", { className: "sfr-error", children: a.error.message })
2680
+ ] });
2681
+ }, Is = ({
2682
+ name: e,
2683
+ control: r,
2684
+ minValue: n = 0,
2685
+ maxValue: t = 100,
2686
+ step: s = 1,
2687
+ disabled: o,
2688
+ readOnly: a
2689
+ }) => {
2690
+ var y;
2691
+ const { field: c, fieldState: l } = P({ name: e, control: r }), d = c.value ?? n, f = t - n, u = f > 0 ? (d - n) / f * 100 : 0;
2692
+ return /* @__PURE__ */ m("div", { className: "space-y-1", children: [
2693
+ /* @__PURE__ */ m("div", { className: "flex items-center gap-3", children: [
2694
+ /* @__PURE__ */ i("div", { className: "relative flex-1", children: /* @__PURE__ */ i(
2695
+ "input",
2696
+ {
2697
+ type: "range",
2698
+ min: n,
2699
+ max: t,
2700
+ step: s,
2701
+ value: d,
2702
+ disabled: o || a,
2703
+ onChange: (v) => c.onChange(Number(v.target.value)),
2704
+ className: "sfr-slider w-full",
2705
+ style: {
2706
+ "--slider-pct": `${u}%`
2707
+ }
2708
+ }
2709
+ ) }),
2710
+ /* @__PURE__ */ i(
2711
+ "span",
2712
+ {
2713
+ className: "sfr-label !mb-0 min-w-[3rem] text-right tabular-nums",
2714
+ style: { color: "var(--t-primary)" },
2715
+ children: d
2716
+ }
2717
+ )
2718
+ ] }),
2719
+ /* @__PURE__ */ m(
2720
+ "div",
2721
+ {
2722
+ className: "flex justify-between text-xs",
2723
+ style: { color: "var(--t-text-muted)" },
2724
+ children: [
2725
+ /* @__PURE__ */ i("span", { children: n }),
2726
+ /* @__PURE__ */ i("span", { children: t })
2727
+ ]
2728
+ }
2729
+ ),
2730
+ ((y = l.error) == null ? void 0 : y.message) && /* @__PURE__ */ i("p", { className: "sfr-error", children: l.error.message })
2731
+ ] });
2732
+ }, Rs = ({
2733
+ name: e,
2734
+ control: r,
2735
+ disabled: n,
2736
+ readOnly: t
2737
+ }) => {
2738
+ var c;
2739
+ const { field: s, fieldState: o } = P({ name: e, control: r }), a = s.value ?? "#000000";
2740
+ return /* @__PURE__ */ m("div", { className: "space-y-1", children: [
2741
+ /* @__PURE__ */ m("div", { className: "flex items-center gap-3", children: [
2742
+ /* @__PURE__ */ i(
2743
+ "input",
2744
+ {
2745
+ type: "color",
2746
+ value: a,
2747
+ disabled: n || t,
2748
+ onChange: (l) => s.onChange(l.target.value),
2749
+ className: "h-10 w-14 cursor-pointer rounded-lg border border-[var(--t-border)] bg-transparent p-1 disabled:cursor-not-allowed disabled:opacity-50",
2750
+ "data-sfr-field": "color"
2751
+ }
2752
+ ),
2753
+ /* @__PURE__ */ i(
2754
+ "input",
2755
+ {
2756
+ type: "text",
2757
+ value: a,
2758
+ readOnly: t,
2759
+ disabled: n,
2760
+ onChange: (l) => {
2761
+ const d = l.target.value;
2762
+ /^#[0-9a-fA-F]{0,6}$/.test(d) && s.onChange(d);
2763
+ },
2764
+ className: `sfr-input flex-1 font-mono uppercase${o.error ? " sfr-input--error" : ""}`,
2765
+ maxLength: 7,
2766
+ placeholder: "#000000"
2767
+ }
2768
+ )
2769
+ ] }),
2770
+ ((c = o.error) == null ? void 0 : c.message) && /* @__PURE__ */ i("p", { className: "sfr-error", children: o.error.message })
2771
+ ] });
2772
+ }, Fs = ({
2773
+ name: e,
2774
+ control: r,
2775
+ options: n,
2776
+ placeholder: t,
2777
+ disabled: s,
2778
+ readOnly: o
2779
+ }) => {
2780
+ var x, g;
2781
+ const { field: a, fieldState: c } = P({ name: e, control: r }), [l, d] = F(""), [f, u] = F(!1), y = te(null), v = ((x = n.find((p) => p.valor === a.value)) == null ? void 0 : x.label) ?? "", N = l.length > 0 ? n.filter(
2782
+ (p) => p.label.toLowerCase().includes(l.toLowerCase())
2783
+ ) : n;
2784
+ q(() => {
2785
+ const p = (O) => {
2786
+ y.current && !y.current.contains(O.target) && (u(!1), d(""));
2787
+ };
2788
+ return document.addEventListener("mousedown", p), () => document.removeEventListener("mousedown", p);
2789
+ }, []);
2790
+ const b = (p) => {
2791
+ p.disabled || (a.onChange(p.valor), u(!1), d(""));
2792
+ }, _ = () => {
2793
+ a.onChange(""), d("");
2794
+ };
2795
+ return /* @__PURE__ */ m("div", { className: "space-y-1", ref: y, children: [
2796
+ /* @__PURE__ */ m("div", { className: "relative", children: [
2797
+ /* @__PURE__ */ i(
2798
+ "input",
2799
+ {
2800
+ type: "text",
2801
+ value: f ? l : v,
2802
+ placeholder: t ?? "Buscar...",
2803
+ disabled: s,
2804
+ readOnly: o,
2805
+ onChange: (p) => {
2806
+ d(p.target.value), u(!0);
2807
+ },
2808
+ onFocus: () => !o && u(!0),
2809
+ className: `sfr-input pr-8${c.error ? " sfr-input--error" : ""}`,
2810
+ "data-sfr-field": "autocomplete",
2811
+ autoComplete: "off"
2812
+ }
2813
+ ),
2814
+ /* @__PURE__ */ i("div", { className: "absolute right-2 top-1/2 -translate-y-1/2 flex items-center gap-1", children: a.value ? /* @__PURE__ */ i(
2815
+ "button",
2816
+ {
2817
+ type: "button",
2818
+ onClick: _,
2819
+ className: "text-[var(--t-text-muted)] hover:text-[var(--t-text)]",
2820
+ tabIndex: -1,
2821
+ children: /* @__PURE__ */ i(Cr, { size: 14 })
2822
+ }
2823
+ ) : /* @__PURE__ */ i(
2824
+ it,
2825
+ {
2826
+ size: 16,
2827
+ className: "text-[var(--t-text-muted)] pointer-events-none"
2828
+ }
2829
+ ) }),
2830
+ f && !s && !o && /* @__PURE__ */ i("ul", { className: "absolute z-50 mt-1 max-h-60 w-full overflow-auto rounded-lg border border-[var(--t-border)] bg-[var(--t-surface)] shadow-lg", children: N.length === 0 ? /* @__PURE__ */ i("li", { className: "px-3 py-2 text-sm text-[var(--t-text-muted)]", children: "Nenhuma opção encontrada" }) : N.map((p) => /* @__PURE__ */ i(
2831
+ "li",
2832
+ {
2833
+ onMouseDown: () => b(p),
2834
+ className: [
2835
+ "flex cursor-pointer items-center px-3 py-2 text-sm",
2836
+ p.disabled ? "cursor-not-allowed opacity-40" : "hover:bg-[var(--t-accent)]",
2837
+ a.value === p.valor ? "font-medium text-[var(--t-primary)]" : "text-[var(--t-text)]"
2838
+ ].join(" "),
2839
+ children: p.label
2840
+ },
2841
+ p.valor
2842
+ )) })
2843
+ ] }),
2844
+ ((g = c.error) == null ? void 0 : g.message) && /* @__PURE__ */ i("p", { className: "sfr-error", children: c.error.message })
2845
+ ] });
2846
+ }, Br = ({
2847
+ name: e,
2848
+ control: r,
2849
+ placeholder: n,
2850
+ disabled: t,
2851
+ readOnly: s
2852
+ }) => {
2853
+ var l;
2854
+ const { field: o, fieldState: a } = P({ name: e, control: r }), c = !!a.error;
2855
+ return /* @__PURE__ */ m("div", { className: "space-y-1", children: [
2856
+ /* @__PURE__ */ i(
2857
+ "input",
2858
+ {
2859
+ ...o,
2860
+ value: o.value ?? "",
2861
+ type: "time",
2862
+ placeholder: n,
2863
+ disabled: t,
2864
+ readOnly: s,
2865
+ className: `sfr-input${c ? " sfr-input--error" : ""}`,
2866
+ "data-sfr-field": "time"
2867
+ }
2868
+ ),
2869
+ ((l = a.error) == null ? void 0 : l.message) && /* @__PURE__ */ i("p", { className: "sfr-error", children: a.error.message })
2870
+ ] });
2871
+ }, js = ({
2872
+ name: e,
2873
+ control: r,
2874
+ startLabel: n = "Data inicial",
2875
+ endLabel: t = "Data final",
2876
+ disabled: s,
2877
+ readOnly: o
2878
+ }) => {
2879
+ var u;
2880
+ const { field: a, fieldState: c } = P({ name: e, control: r }), l = a.value ?? {}, d = (y, v) => {
2881
+ a.onChange({ ...l, [y]: v });
2882
+ }, f = !!c.error;
2883
+ return /* @__PURE__ */ m("div", { className: "space-y-2", children: [
2884
+ /* @__PURE__ */ m("div", { className: "grid grid-cols-2 gap-3", children: [
2885
+ /* @__PURE__ */ m("div", { className: "space-y-1", children: [
2886
+ /* @__PURE__ */ i("label", { className: "sfr-label", children: n }),
2887
+ /* @__PURE__ */ i(
2888
+ "input",
2889
+ {
2890
+ type: "date",
2891
+ value: l.start ?? "",
2892
+ disabled: s,
2893
+ readOnly: o,
2894
+ onChange: (y) => d("start", y.target.value),
2895
+ max: l.end ?? void 0,
2896
+ className: `sfr-input${f ? " sfr-input--error" : ""}`,
2897
+ "data-sfr-field": "date-range-start"
2898
+ }
2899
+ )
2900
+ ] }),
2901
+ /* @__PURE__ */ m("div", { className: "space-y-1", children: [
2902
+ /* @__PURE__ */ i("label", { className: "sfr-label", children: t }),
2903
+ /* @__PURE__ */ i(
2904
+ "input",
2905
+ {
2906
+ type: "date",
2907
+ value: l.end ?? "",
2908
+ disabled: s,
2909
+ readOnly: o,
2910
+ onChange: (y) => d("end", y.target.value),
2911
+ min: l.start ?? void 0,
2912
+ className: `sfr-input${f ? " sfr-input--error" : ""}`,
2913
+ "data-sfr-field": "date-range-end"
2914
+ }
2915
+ )
2916
+ ] })
2917
+ ] }),
2918
+ ((u = c.error) == null ? void 0 : u.message) && /* @__PURE__ */ i("p", { className: "sfr-error", children: c.error.message })
2919
+ ] });
2920
+ }, Zs = ({
2921
+ name: e,
2922
+ control: r,
2923
+ maxRating: n = 5,
2924
+ disabled: t,
2925
+ readOnly: s
2926
+ }) => {
2927
+ var d;
2928
+ const { field: o, fieldState: a } = P({ name: e, control: r }), c = o.value ?? 0, l = Array.from({ length: n }, (f, u) => u + 1);
2929
+ return /* @__PURE__ */ m("div", { className: "space-y-1", children: [
2930
+ /* @__PURE__ */ m("div", { className: "flex items-center gap-1", children: [
2931
+ l.map((f) => /* @__PURE__ */ i(
2932
+ "button",
2933
+ {
2934
+ type: "button",
2935
+ disabled: t || s,
2936
+ onClick: () => o.onChange(f === c ? 0 : f),
2937
+ className: "transition-transform hover:scale-110 disabled:cursor-not-allowed disabled:opacity-50 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--t-primary)] rounded",
2938
+ "aria-label": `${f} estrela${f > 1 ? "s" : ""}`,
2939
+ children: /* @__PURE__ */ i(
2940
+ ct,
2941
+ {
2942
+ size: 24,
2943
+ className: "transition-colors",
2944
+ fill: f <= c ? "var(--t-primary)" : "transparent",
2945
+ stroke: f <= c ? "var(--t-primary)" : "var(--t-border)"
2946
+ }
2947
+ )
2948
+ },
2949
+ f
2950
+ )),
2951
+ c > 0 && /* @__PURE__ */ m(
2952
+ "span",
2953
+ {
2954
+ className: "ml-2 text-sm",
2955
+ style: { color: "var(--t-text-muted)" },
2956
+ children: [
2957
+ c,
2958
+ "/",
2959
+ n
2960
+ ]
2961
+ }
2962
+ )
2963
+ ] }),
2964
+ ((d = a.error) == null ? void 0 : d.message) && /* @__PURE__ */ i("p", { className: "sfr-error", children: a.error.message })
2965
+ ] });
2966
+ }, Ls = ({
2967
+ field: e,
2968
+ name: r,
2969
+ control: n,
2970
+ disabled: t,
2971
+ readOnly: s
2972
+ }) => {
2973
+ const o = t || e.isDisabled, a = s || e.isReadOnly;
2974
+ switch (e.tipo) {
2975
+ case h.EMAIL:
2976
+ return /* @__PURE__ */ i(
2977
+ X,
2978
+ {
2979
+ name: r,
2980
+ control: n,
2981
+ type: "email",
2982
+ placeholder: e.placeholder,
2983
+ disabled: o,
2984
+ readOnly: a
2985
+ }
2986
+ );
2987
+ case h.NUMBER:
2988
+ return /* @__PURE__ */ i(
2989
+ X,
2990
+ {
2991
+ name: r,
2992
+ control: n,
2993
+ type: "number",
2994
+ placeholder: e.placeholder,
2995
+ disabled: o,
2996
+ readOnly: a
2997
+ }
2998
+ );
2999
+ case h.PASSWORD:
3000
+ return /* @__PURE__ */ i(
3001
+ X,
3002
+ {
3003
+ name: r,
3004
+ control: n,
3005
+ type: "password",
3006
+ placeholder: e.placeholder,
3007
+ disabled: o,
3008
+ readOnly: a
3009
+ }
3010
+ );
3011
+ case h.TELEFONE:
3012
+ return /* @__PURE__ */ i(
3013
+ ie,
3014
+ {
3015
+ name: r,
3016
+ control: n,
3017
+ maskType: "telefone",
3018
+ placeholder: e.placeholder ?? "(00) 00000-0000",
3019
+ disabled: o,
3020
+ readOnly: a
3021
+ }
3022
+ );
3023
+ case h.CPF:
3024
+ return /* @__PURE__ */ i(
3025
+ ie,
3026
+ {
3027
+ name: r,
3028
+ control: n,
3029
+ maskType: "cpf",
3030
+ placeholder: e.placeholder ?? "000.000.000-00",
3031
+ disabled: o,
3032
+ readOnly: a
3033
+ }
3034
+ );
3035
+ case h.CEP:
3036
+ return /* @__PURE__ */ i(
3037
+ ie,
3038
+ {
3039
+ name: r,
3040
+ control: n,
3041
+ maskType: "cep",
3042
+ placeholder: e.placeholder ?? "00000-000",
3043
+ disabled: o,
3044
+ readOnly: a
3045
+ }
3046
+ );
3047
+ case h.TEXTAREA:
3048
+ return /* @__PURE__ */ i(
3049
+ Je,
3050
+ {
3051
+ name: r,
3052
+ control: n,
3053
+ placeholder: e.placeholder,
3054
+ disabled: o,
3055
+ readOnly: a
3056
+ }
3057
+ );
3058
+ case h.SELECT:
3059
+ return /* @__PURE__ */ i(
3060
+ Be,
3061
+ {
3062
+ name: r,
3063
+ control: n,
3064
+ options: e.opcoes ?? [],
3065
+ placeholder: e.placeholder,
3066
+ disabled: o,
3067
+ readOnly: a
3068
+ }
3069
+ );
3070
+ case h.CHECKBOX:
3071
+ return /* @__PURE__ */ i(
3072
+ Ue,
3073
+ {
3074
+ name: r,
3075
+ control: n,
3076
+ label: e.label ?? "",
3077
+ disabled: o,
3078
+ readOnly: a
3079
+ }
3080
+ );
3081
+ case h.SWITCH:
3082
+ return /* @__PURE__ */ i(
3083
+ Jr,
3084
+ {
3085
+ name: r,
3086
+ control: n,
3087
+ label: e.label ?? "",
3088
+ disabled: o,
3089
+ readOnly: a
3090
+ }
3091
+ );
3092
+ case h.DATE:
3093
+ return /* @__PURE__ */ i(
3094
+ ye,
3095
+ {
3096
+ name: r,
3097
+ control: n,
3098
+ disabled: o,
3099
+ readOnly: a
3100
+ }
3101
+ );
3102
+ case h.TIME:
3103
+ return /* @__PURE__ */ i(
3104
+ Br,
3105
+ {
3106
+ name: r,
3107
+ control: n,
3108
+ disabled: o,
3109
+ readOnly: a
3110
+ }
3111
+ );
3112
+ case h.HIDDEN:
3113
+ return /* @__PURE__ */ i(Xe, { name: r, control: n });
3114
+ default:
3115
+ return /* @__PURE__ */ i(
3116
+ X,
3117
+ {
3118
+ name: r,
3119
+ control: n,
3120
+ type: "text",
3121
+ placeholder: e.placeholder,
3122
+ disabled: o,
3123
+ readOnly: a
3124
+ }
3125
+ );
3126
+ }
3127
+ }, Ms = ({
3128
+ name: e,
3129
+ control: r,
3130
+ subSchema: n,
3131
+ disabled: t,
3132
+ readOnly: s
3133
+ }) => {
3134
+ if (!n || n.fields.length === 0) return null;
3135
+ const o = [...n.fields].sort((a, c) => a.ordem - c.ordem);
3136
+ return /* @__PURE__ */ m(
3137
+ "div",
3138
+ {
3139
+ className: "sfr-subform rounded-xl border p-4 space-y-4",
3140
+ style: {
3141
+ borderColor: "var(--t-border)",
3142
+ background: "color-mix(in srgb, var(--t-surface) 60%, transparent)"
3143
+ },
3144
+ children: [
3145
+ n.titulo && /* @__PURE__ */ i(
3146
+ "h4",
3147
+ {
3148
+ className: "sfr-subform__title text-sm font-semibold",
3149
+ style: { color: "var(--t-text-muted)" },
3150
+ children: n.titulo
3151
+ }
3152
+ ),
3153
+ /* @__PURE__ */ i("div", { className: "grid grid-cols-12 gap-4", children: o.map((a) => {
3154
+ const c = `${e}.${a.nome}`, l = a.tipo === h.CHECKBOX || a.tipo === h.SWITCH || a.tipo === h.HIDDEN, d = a.tamanho ?? 6;
3155
+ return /* @__PURE__ */ m("div", { className: `col-span-${d}`, children: [
3156
+ !l && /* @__PURE__ */ m("label", { className: "sfr-label mb-1 block", children: [
3157
+ a.label,
3158
+ a.obrigatorio && /* @__PURE__ */ i("span", { style: { color: "var(--t-error)" }, children: " *" })
3159
+ ] }),
3160
+ /* @__PURE__ */ i(
3161
+ Ls,
3162
+ {
3163
+ field: a,
3164
+ name: c,
3165
+ control: r,
3166
+ disabled: t,
3167
+ readOnly: s
3168
+ }
3169
+ )
3170
+ ] }, a.id);
3171
+ }) })
3172
+ ]
3173
+ }
3174
+ );
3175
+ }, Ur = ({
3176
+ field: e,
3177
+ control: r,
3178
+ nameOverride: n
3179
+ }) => {
3180
+ var c, l;
3181
+ const t = n ?? e.nome, { componentMapper: s } = ne(), o = s == null ? void 0 : s[e.tipo];
3182
+ if (o)
3183
+ return /* @__PURE__ */ i(o, { name: t, control: r, field: e });
3184
+ const a = {
3185
+ name: t,
3186
+ control: r,
3187
+ placeholder: e.placeholder,
3188
+ disabled: e.isDisabled,
3189
+ readOnly: e.isReadOnly
3190
+ };
3191
+ switch (e.tipo) {
3192
+ case h.TEXTO:
3193
+ return /* @__PURE__ */ i(X, { ...a, type: "text" });
3194
+ case h.EMAIL:
3195
+ return /* @__PURE__ */ i(X, { ...a, type: "email" });
3196
+ case h.NUMBER:
3197
+ return /* @__PURE__ */ i(X, { ...a, type: "number" });
3198
+ case h.PASSWORD:
3199
+ return /* @__PURE__ */ i(As, { ...a });
3200
+ case h.TEXTAREA:
3201
+ return /* @__PURE__ */ i(Je, { ...a });
3202
+ case h.SELECT:
3203
+ return /* @__PURE__ */ i(Be, { ...a, options: e.opcoes ?? [] });
3204
+ case h.AUTOCOMPLETE:
3205
+ return /* @__PURE__ */ i(Fs, { ...a, options: e.opcoes ?? [] });
3206
+ case h.SWITCH:
3207
+ return /* @__PURE__ */ i(
3208
+ Jr,
3209
+ {
3210
+ name: t,
3211
+ control: r,
3212
+ label: e.label,
3213
+ disabled: e.isDisabled,
3214
+ readOnly: e.isReadOnly
3215
+ }
3216
+ );
3217
+ case h.SLIDER:
3218
+ return /* @__PURE__ */ i(
3219
+ Is,
3220
+ {
3221
+ name: t,
3222
+ control: r,
3223
+ minValue: e.minValue,
3224
+ maxValue: e.maxValue,
3225
+ step: e.step,
3226
+ disabled: e.isDisabled,
3227
+ readOnly: e.isReadOnly
3228
+ }
3229
+ );
3230
+ case h.RATING:
3231
+ return /* @__PURE__ */ i(
3232
+ Zs,
3233
+ {
3234
+ name: t,
3235
+ control: r,
3236
+ maxRating: e.maxRating,
3237
+ disabled: e.isDisabled,
3238
+ readOnly: e.isReadOnly
3239
+ }
3240
+ );
3241
+ case h.COLOR:
3242
+ return /* @__PURE__ */ i(
3243
+ Rs,
3244
+ {
3245
+ name: t,
3246
+ control: r,
3247
+ disabled: e.isDisabled,
3248
+ readOnly: e.isReadOnly
3249
+ }
3250
+ );
3251
+ case h.TIME:
3252
+ return /* @__PURE__ */ i(Br, { ...a });
3253
+ case h.DATE_RANGE:
3254
+ return /* @__PURE__ */ i(
3255
+ js,
3256
+ {
3257
+ name: t,
3258
+ control: r,
3259
+ startLabel: e.dateRangeStartLabel,
3260
+ endLabel: e.dateRangeEndLabel,
3261
+ disabled: e.isDisabled,
3262
+ readOnly: e.isReadOnly
3263
+ }
3264
+ );
3265
+ case h.RADIO:
3266
+ return /* @__PURE__ */ i(Zr, { ...a, options: e.opcoes ?? [] });
3267
+ case h.CHECKBOX:
3268
+ return /* @__PURE__ */ i(
3269
+ Ue,
3270
+ {
3271
+ name: t,
3272
+ control: r,
3273
+ label: e.label,
3274
+ disabled: e.isDisabled,
3275
+ readOnly: e.isReadOnly
3276
+ }
3277
+ );
3278
+ case h.CHECKBOX_GROUP:
3279
+ return /* @__PURE__ */ i(jr, { ...a, options: e.opcoes ?? [] });
3280
+ case h.DATE:
3281
+ return /* @__PURE__ */ i(
3282
+ ye,
3283
+ {
3284
+ name: t,
3285
+ control: r,
3286
+ disabled: e.isDisabled,
3287
+ readOnly: e.isReadOnly,
3288
+ validacao: e.validacao
3289
+ }
3290
+ );
3291
+ case h.DATETIME:
3292
+ return /* @__PURE__ */ i(
3293
+ ye,
3294
+ {
3295
+ name: t,
3296
+ control: r,
3297
+ isDatetime: !0,
3298
+ disabled: e.isDisabled,
3299
+ readOnly: e.isReadOnly,
3300
+ validacao: e.validacao
3301
+ }
3302
+ );
3303
+ case h.FILE:
3304
+ return /* @__PURE__ */ i(
3305
+ Lr,
3306
+ {
3307
+ name: t,
3308
+ control: r,
3309
+ disabled: e.isDisabled,
3310
+ fileTypes: (c = e.validacao) == null ? void 0 : c.fileTypes,
3311
+ maxFileSize: (l = e.validacao) == null ? void 0 : l.maxFileSize
3312
+ }
3313
+ );
3314
+ case h.TELEFONE:
3315
+ return /* @__PURE__ */ i(ie, { ...a, maskType: "telefone" });
3316
+ case h.CPF:
3317
+ return /* @__PURE__ */ i(ie, { ...a, maskType: "cpf" });
3318
+ case h.CEP:
3319
+ return /* @__PURE__ */ i(
3320
+ Vr,
3321
+ {
3322
+ name: t,
3323
+ control: r,
3324
+ placeholder: e.placeholder,
3325
+ disabled: e.isDisabled,
3326
+ readOnly: e.isReadOnly,
3327
+ cepFillMap: e.cepFillMap
3328
+ }
3329
+ );
3330
+ case h.HIDDEN:
3331
+ return /* @__PURE__ */ i(Xe, { name: t, control: r });
3332
+ case h.PARTICIPATION_TYPE:
3333
+ return /* @__PURE__ */ i(Os, { name: t, control: r });
3334
+ case h.PAYMENT_METHOD:
3335
+ return /* @__PURE__ */ i(
3336
+ Ps,
3337
+ {
3338
+ name: t,
3339
+ control: r,
3340
+ relatedFieldName: e.relatedFieldName
3341
+ }
3342
+ );
3343
+ case h.TERMS:
3344
+ return /* @__PURE__ */ i(
3345
+ Ds,
3346
+ {
3347
+ name: t,
3348
+ control: r,
3349
+ label: e.label,
3350
+ termoTexto: e.termoTexto,
3351
+ termoPdfUrl: e.termoPdfUrl,
3352
+ termoPdfUploadId: e.termoPdfUploadId
3353
+ }
3354
+ );
3355
+ case h.FIELD_ARRAY:
3356
+ return /* @__PURE__ */ i(
3357
+ ws,
3358
+ {
3359
+ name: t,
3360
+ control: r,
3361
+ subFields: e.subFields,
3362
+ minItems: e.minItems,
3363
+ maxItems: e.maxItems,
3364
+ itemLabel: e.itemLabel,
3365
+ addLabel: e.addLabel
3366
+ }
3367
+ );
3368
+ case h.SUB_FORM:
3369
+ return /* @__PURE__ */ i(
3370
+ Ms,
3371
+ {
3372
+ name: t,
3373
+ control: r,
3374
+ subSchema: e.subSchema,
3375
+ disabled: e.isDisabled,
3376
+ readOnly: e.isReadOnly
3377
+ }
3378
+ );
3379
+ default:
3380
+ return /* @__PURE__ */ i(X, { ...a, type: "text" });
3381
+ }
3382
+ }, Xr = () => {
3383
+ const e = qr(), r = e.layout.containerStyle, t = [
3384
+ "sfr-container overflow-hidden",
3385
+ e.layout.roundness ?? "rounded-xl",
3386
+ r === "card" ? "sfr-container--card border" : "",
3387
+ r === "bordered" ? "sfr-container--bordered border" : "",
3388
+ r === "glassmorphism" ? "sfr-container--glass backdrop-blur-sm" : ""
3389
+ ].filter(Boolean).join(" "), s = r === "glassmorphism" ? {
3390
+ background: "var(--t-surface)",
3391
+ borderColor: "var(--t-border)",
3392
+ borderWidth: "1px",
3393
+ borderStyle: "solid"
3394
+ } : {}, o = [
3395
+ "sfr-container__header border-b px-6 py-4",
3396
+ r === "flat" ? "border-transparent" : ""
3397
+ ].filter(Boolean).join(" ");
3398
+ return { wrapperClass: t, wrapperStyle: s, headerClass: o, headerStyle: r === "glassmorphism" ? { borderColor: "var(--t-border)" } : {}, tmpl: e };
3399
+ }, Vs = ({
3400
+ container: e,
3401
+ control: r
3402
+ }) => {
3403
+ var b;
3404
+ const { externalData: n = {} } = ne(), t = e.icone ? Te[e.icone] : void 0, s = n, o = R(
3405
+ () => Ve(e, s),
3406
+ // eslint-disable-next-line react-hooks/exhaustive-deps
3407
+ [e, JSON.stringify(s)]
3408
+ ), a = R(
3409
+ () => [...o.campos].sort((_, x) => _.ordem - x.ordem),
3410
+ [o.campos]
3411
+ ), c = de({ control: r }), { fieldResolvers: l } = ne(), { wrapperClass: d, wrapperStyle: f, headerClass: u, headerStyle: y, tmpl: v } = Xr(), N = (_) => {
3412
+ if (!ee(
3413
+ _.condicional,
3414
+ c,
3415
+ n
3416
+ )) return null;
3417
+ let g = _;
3418
+ if (_.resolvePropsKey && (l != null && l[_.resolvePropsKey])) {
3419
+ const T = l[_.resolvePropsKey](
3420
+ _,
3421
+ c,
3422
+ n
3423
+ );
3424
+ g = { ..._, ...T };
3425
+ }
3426
+ if (g.opcoesFromVar) {
3427
+ const T = n[g.opcoesFromVar];
3428
+ Array.isArray(T) && (g = {
3429
+ ...g,
3430
+ 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) })
3431
+ });
3432
+ }
3433
+ const p = g.tamanho ?? 12, O = g.inicioColuna, E = O ? `${O} / span ${p}` : `span ${p}`, z = /* @__PURE__ */ i(Ur, { field: g, control: r });
3434
+ return g.tipo === h.CHECKBOX || g.tipo === h.HIDDEN || g.tipo === h.SWITCH ? /* @__PURE__ */ i(
3435
+ "div",
3436
+ {
3437
+ className: "max-sm:!col-span-12",
3438
+ style: { gridColumn: E },
3439
+ children: z
3440
+ },
3441
+ g.id
3442
+ ) : /* @__PURE__ */ m(
3443
+ "div",
3444
+ {
3445
+ className: "max-sm:!col-span-12 space-y-2",
3446
+ style: { gridColumn: E },
3447
+ children: [
3448
+ /* @__PURE__ */ m(
3449
+ "label",
3450
+ {
3451
+ className: "sfr-label font-medium flex items-center gap-1",
3452
+ style: { color: "var(--t-text)" },
3453
+ children: [
3454
+ g.label,
3455
+ g.obrigatorio && /* @__PURE__ */ i("span", { className: "sfr-required", children: "*" })
3456
+ ]
3457
+ }
3458
+ ),
3459
+ z,
3460
+ g.hint && /* @__PURE__ */ i(
3461
+ "p",
3462
+ {
3463
+ className: "sfr-hint text-xs",
3464
+ style: { color: "var(--t-text-muted)" },
3465
+ children: g.hint
3466
+ }
3467
+ )
3468
+ ]
3469
+ },
3470
+ g.id
3471
+ );
3472
+ };
3473
+ return /* @__PURE__ */ m("div", { className: d, style: f, children: [
3474
+ (o.titulo || t) && /* @__PURE__ */ i("div", { className: u, style: y, children: /* @__PURE__ */ m("div", { className: "flex items-center gap-3", children: [
3475
+ t && /* @__PURE__ */ i(
3476
+ "div",
3477
+ {
3478
+ className: "p-2 rounded-xl",
3479
+ style: {
3480
+ background: "color-mix(in srgb, var(--t-primary) 12%, transparent)"
3481
+ },
3482
+ children: /* @__PURE__ */ i(
3483
+ t,
3484
+ {
3485
+ className: "w-5 h-5",
3486
+ style: { color: "var(--t-primary)" }
3487
+ }
3488
+ )
3489
+ }
3490
+ ),
3491
+ /* @__PURE__ */ m("div", { children: [
3492
+ /* @__PURE__ */ i(
3493
+ "h3",
3494
+ {
3495
+ className: ((b = v.typography) == null ? void 0 : b.stepTitleClass) ?? "text-lg font-semibold",
3496
+ style: { color: "var(--t-text)" },
3497
+ children: o.titulo
3498
+ }
3499
+ ),
3500
+ o.descricao && /* @__PURE__ */ i("p", { className: "text-sm", style: { color: "var(--t-text-muted)" }, children: o.descricao })
3501
+ ] })
3502
+ ] }) }),
3503
+ /* @__PURE__ */ i("div", { className: "p-6 grid grid-cols-12 gap-4", children: a.map(N) })
3504
+ ] });
3505
+ }, Js = ({
3506
+ container: e,
3507
+ control: r
3508
+ }) => {
3509
+ var E;
3510
+ const { externalData: n = {} } = ne(), t = e.nome, s = e.minItems ?? 1, o = e.maxItems, a = e.itemLabel ?? "Item", { fields: c, append: l, remove: d } = gr({
3511
+ control: r,
3512
+ name: t
3513
+ });
3514
+ q(() => {
3515
+ if (c.length < s)
3516
+ for (let z = c.length; z < s; z++)
3517
+ l({});
3518
+ }, []);
3519
+ const f = e.icone ? Te[e.icone] : void 0, u = n, y = R(
3520
+ () => Ve(e, u),
3521
+ // eslint-disable-next-line react-hooks/exhaustive-deps
3522
+ [e, JSON.stringify(u)]
3523
+ ), v = R(
3524
+ () => [...y.campos].sort((z, T) => z.ordem - T.ordem),
3525
+ [y.campos]
3526
+ ), N = de({ control: r }), { wrapperClass: b, wrapperStyle: _, headerClass: x, headerStyle: g, tmpl: p } = Xr(), O = (z, T) => {
3527
+ if (!ee(
3528
+ z.condicional,
3529
+ N,
3530
+ n
3531
+ )) return null;
3532
+ const K = `${t}.${T}.${z.nome}`, A = z.tamanho ?? 12, M = z.inicioColuna, J = M ? `${M} / span ${A}` : `span ${A}`, B = /* @__PURE__ */ i(
3533
+ Ur,
3534
+ {
3535
+ field: z,
3536
+ control: r,
3537
+ nameOverride: K
3538
+ }
3539
+ );
3540
+ return z.tipo === h.CHECKBOX || z.tipo === h.HIDDEN ? /* @__PURE__ */ i(
3541
+ "div",
3542
+ {
3543
+ className: "max-sm:!col-span-12",
3544
+ style: { gridColumn: J },
3545
+ children: B
3546
+ },
3547
+ `${z.id}-${T}`
3548
+ ) : /* @__PURE__ */ m(
3549
+ "div",
3550
+ {
3551
+ className: "max-sm:!col-span-12 space-y-2",
3552
+ style: { gridColumn: J },
3553
+ children: [
3554
+ /* @__PURE__ */ m(
3555
+ "label",
3556
+ {
3557
+ className: "sfr-label font-medium flex items-center gap-1",
3558
+ style: { color: "var(--t-text)" },
3559
+ children: [
3560
+ z.label,
3561
+ z.obrigatorio && /* @__PURE__ */ i("span", { className: "sfr-required", children: "*" })
3562
+ ]
3563
+ }
3564
+ ),
3565
+ B,
3566
+ z.hint && /* @__PURE__ */ i(
3567
+ "p",
3568
+ {
3569
+ className: "sfr-hint text-xs",
3570
+ style: { color: "var(--t-text-muted)" },
3571
+ children: z.hint
3572
+ }
3573
+ )
3574
+ ]
3575
+ },
3576
+ `${z.id}-${T}`
3577
+ );
3578
+ };
3579
+ return /* @__PURE__ */ m("div", { className: b, style: _, children: [
3580
+ (y.titulo || f) && /* @__PURE__ */ i("div", { className: x, style: g, children: /* @__PURE__ */ m("div", { className: "flex items-center gap-3", children: [
3581
+ f && /* @__PURE__ */ i(
3582
+ "div",
3583
+ {
3584
+ className: "p-2 rounded-xl",
3585
+ style: {
3586
+ background: "color-mix(in srgb, var(--t-primary) 12%, transparent)"
3587
+ },
3588
+ children: /* @__PURE__ */ i(
3589
+ f,
3590
+ {
3591
+ className: "w-5 h-5",
3592
+ style: { color: "var(--t-primary)" }
3593
+ }
3594
+ )
3595
+ }
3596
+ ),
3597
+ /* @__PURE__ */ m("div", { children: [
3598
+ /* @__PURE__ */ i(
3599
+ "h3",
3600
+ {
3601
+ className: ((E = p.typography) == null ? void 0 : E.stepTitleClass) ?? "text-lg font-semibold",
3602
+ style: { color: "var(--t-text)" },
3603
+ children: y.titulo
3604
+ }
3605
+ ),
3606
+ y.descricao && /* @__PURE__ */ i("p", { className: "text-sm", style: { color: "var(--t-text-muted)" }, children: y.descricao })
3607
+ ] })
3608
+ ] }) }),
3609
+ /* @__PURE__ */ m("div", { className: "p-6 space-y-4", children: [
3610
+ c.map((z, T) => /* @__PURE__ */ m(
3611
+ "div",
3612
+ {
3613
+ className: "sfr-container__repeat-item border rounded-lg p-4",
3614
+ style: {
3615
+ borderColor: "var(--t-border)",
3616
+ background: "color-mix(in srgb, var(--t-surface) 60%, transparent)"
3617
+ },
3618
+ children: [
3619
+ /* @__PURE__ */ m("div", { className: "flex items-center justify-between mb-4", children: [
3620
+ /* @__PURE__ */ m("div", { className: "flex items-center gap-2", children: [
3621
+ /* @__PURE__ */ i(
3622
+ "div",
3623
+ {
3624
+ className: "w-6 h-6 rounded-full flex items-center justify-center text-xs font-bold shrink-0",
3625
+ style: { background: "var(--t-primary)", color: "#fff" },
3626
+ children: T + 1
3627
+ }
3628
+ ),
3629
+ /* @__PURE__ */ m(
3630
+ "span",
3631
+ {
3632
+ className: "text-sm font-semibold",
3633
+ style: { color: "var(--t-text)" },
3634
+ children: [
3635
+ a,
3636
+ " ",
3637
+ T + 1
3638
+ ]
3639
+ }
3640
+ )
3641
+ ] }),
3642
+ c.length > s && /* @__PURE__ */ i(
3643
+ "button",
3644
+ {
3645
+ type: "button",
3646
+ onClick: () => d(T),
3647
+ className: "sfr-btn sfr-btn--ghost sfr-error",
3648
+ "aria-label": "Remover item",
3649
+ children: /* @__PURE__ */ i(yr, { className: "w-4 h-4" })
3650
+ }
3651
+ )
3652
+ ] }),
3653
+ /* @__PURE__ */ i("div", { className: "grid grid-cols-12 gap-4", children: v.map((C) => O(C, T)) })
3654
+ ]
3655
+ },
3656
+ z.id
3657
+ )),
3658
+ (!o || c.length < o) && /* @__PURE__ */ m(
3659
+ "button",
3660
+ {
3661
+ type: "button",
3662
+ className: "sfr-btn sfr-btn--outline w-full flex items-center justify-center gap-2 py-2 px-4 border rounded-lg text-sm",
3663
+ onClick: () => l({}),
3664
+ children: [
3665
+ /* @__PURE__ */ i(vr, { className: "w-4 h-4" }),
3666
+ "Adicionar ",
3667
+ a.toLowerCase()
3668
+ ]
3669
+ }
3670
+ ),
3671
+ o && /* @__PURE__ */ m("p", { className: "text-xs text-center sfr-text-muted", children: [
3672
+ "Máximo de ",
3673
+ o,
3674
+ " ",
3675
+ a.toLowerCase(),
3676
+ o > 1 ? "s" : ""
3677
+ ] })
3678
+ ] })
3679
+ ] });
3680
+ }, Bs = (e) => e.container.repeatable && e.container.nome ? /* @__PURE__ */ i(Js, { ...e }) : /* @__PURE__ */ i(Vs, { ...e }), Us = ({
3681
+ step: e,
3682
+ control: r,
3683
+ externalData: n = {}
3684
+ }) => {
3685
+ const t = R(
3686
+ () => [...e.containers].sort((o, a) => o.ordem - a.ordem),
3687
+ [e.containers]
3688
+ ), s = de({ control: r });
3689
+ return /* @__PURE__ */ i("div", { className: "sfr-step grid grid-cols-12 gap-4 sfr-step--animate", children: t.map((o) => {
3690
+ if (o.condicional && !ee(
3691
+ o.condicional,
3692
+ s,
3693
+ n
3694
+ ))
3695
+ return null;
3696
+ const a = o.tamanho ?? 12, c = o.inicioColuna, l = c ? `${c} / span ${a}` : `span ${a}`;
3697
+ return /* @__PURE__ */ i(
3698
+ "div",
3699
+ {
3700
+ className: "max-sm:!col-span-12",
3701
+ style: { gridColumn: l },
3702
+ children: /* @__PURE__ */ i(Bs, { container: o, control: r })
3703
+ },
3704
+ o.id
3705
+ );
3706
+ }) });
3707
+ }, Ne = hr({
3708
+ submitting: !1,
3709
+ warnings: {},
3710
+ requestSubmit: () => {
3711
+ }
3712
+ }), Xs = Ne.Provider, no = () => {
3713
+ const e = be(), r = ve(Ne);
3714
+ return {
3715
+ change: (n, t) => e.setValue(n, t, {
3716
+ shouldValidate: !0,
3717
+ shouldDirty: !0
3718
+ }),
3719
+ reset: (n) => e.reset(n),
3720
+ submit: r.requestSubmit,
3721
+ getState: () => {
3722
+ const { errors: n, isDirty: t, isValid: s } = e.formState;
3723
+ return {
3724
+ values: e.getValues(),
3725
+ errors: Object.fromEntries(
3726
+ Object.entries(n).map(([o, a]) => [
3727
+ o,
3728
+ a == null ? void 0 : a.message
3729
+ ])
3730
+ ),
3731
+ warnings: r.warnings,
3732
+ dirty: t,
3733
+ valid: s,
3734
+ submitting: r.submitting
3735
+ };
3736
+ }
3737
+ };
3738
+ }, Hs = () => {
3739
+ const e = be(), r = ve(Ne), n = de({ control: e.control }), { errors: t, isDirty: s, isValid: o } = e.formState;
3740
+ return {
3741
+ values: n,
3742
+ errors: Object.fromEntries(
3743
+ Object.entries(t).map(([a, c]) => [
3744
+ a,
3745
+ c == null ? void 0 : c.message
3746
+ ])
3747
+ ),
3748
+ warnings: r.warnings,
3749
+ dirty: s,
3750
+ valid: o,
3751
+ submitting: r.submitting
3752
+ };
3753
+ }, so = (e) => {
3754
+ var o;
3755
+ const r = be(), { warnings: n } = ve(Ne), t = de({ control: r.control, name: e }), s = r.getFieldState(e, r.formState);
3756
+ return {
3757
+ value: t,
3758
+ error: (o = s.error) == null ? void 0 : o.message,
3759
+ warning: n[e],
3760
+ dirty: s.isDirty,
3761
+ touched: s.isTouched,
3762
+ valid: !s.error
3763
+ };
3764
+ }, oo = (e) => {
3765
+ var o;
3766
+ const { control: r } = be(), { warnings: n } = ve(Ne), { field: t, fieldState: s } = P({ name: e, control: r });
3767
+ return {
3768
+ input: {
3769
+ name: t.name,
3770
+ value: t.value,
3771
+ onChange: t.onChange,
3772
+ onBlur: t.onBlur,
3773
+ ref: t.ref
3774
+ },
3775
+ meta: {
3776
+ error: (o = s.error) == null ? void 0 : o.message,
3777
+ warning: n[e],
3778
+ touched: s.isTouched,
3779
+ dirty: s.isDirty,
3780
+ valid: !s.error
3781
+ }
3782
+ };
3783
+ }, Ks = ({
3784
+ steps: e,
3785
+ currentStep: r,
3786
+ onStepClick: n
3787
+ }) => /* @__PURE__ */ i("div", { className: "sfr-step-indicator flex items-center gap-2 justify-center flex-wrap", children: e.map((t, s) => {
3788
+ const o = s < r, a = s === r, c = t.icone ? Te[t.icone] : void 0;
3789
+ return /* @__PURE__ */ m("div", { className: "flex items-center gap-2", children: [
3790
+ /* @__PURE__ */ i(
3791
+ "button",
3792
+ {
3793
+ type: "button",
3794
+ onClick: () => o && (n == null ? void 0 : n(s)),
3795
+ disabled: !o,
3796
+ className: "sfr-step-indicator__dot flex items-center justify-center w-8 h-8 rounded-full text-xs font-bold transition-all",
3797
+ "data-active": a ? "true" : void 0,
3798
+ "data-done": o ? "true" : void 0,
3799
+ title: t.label,
3800
+ children: o ? /* @__PURE__ */ i(zr, { className: "w-4 h-4" }) : c ? /* @__PURE__ */ i(c, { className: "w-4 h-4" }) : s + 1
3801
+ }
3802
+ ),
3803
+ t.label && /* @__PURE__ */ i(
3804
+ "span",
3805
+ {
3806
+ className: "text-xs hidden sm:block sfr-step-indicator__label",
3807
+ "data-active": a ? "true" : void 0,
3808
+ children: t.label
3809
+ }
3810
+ ),
3811
+ s < e.length - 1 && /* @__PURE__ */ i(
3812
+ "div",
3813
+ {
3814
+ className: "sfr-step-indicator__line w-6 h-0.5",
3815
+ "data-done": o ? "true" : void 0
3816
+ }
3817
+ )
3818
+ ] }, t.id);
3819
+ }) }), Ws = ({
3820
+ stepIndex: e,
3821
+ totalSteps: r,
3822
+ step: n,
3823
+ defaultValues: t,
3824
+ externalData: s,
3825
+ fieldErrors: o,
3826
+ isSubmitting: a,
3827
+ submitError: c,
3828
+ validatorMapper: l = {},
3829
+ onWarningsChange: d,
3830
+ onValuesChange: f,
3831
+ onSubmit: u,
3832
+ onBack: y
3833
+ }) => {
3834
+ const v = e === r - 1, N = R(
3835
+ () => ds(n, s, l),
3836
+ // eslint-disable-next-line react-hooks/exhaustive-deps
3837
+ [n.id]
3838
+ ), b = R(
3839
+ () => us(n, s, l),
3840
+ // eslint-disable-next-line react-hooks/exhaustive-deps
3841
+ [n.id]
3842
+ ), [_, x] = F(
3843
+ {}
3844
+ ), g = te(d);
3845
+ g.current = d;
3846
+ const p = s, O = R(
3847
+ () => hs(n, p),
3848
+ // eslint-disable-next-line react-hooks/exhaustive-deps
3849
+ [n, JSON.stringify(p)]
3850
+ ), E = Wr({
3851
+ resolver: N,
3852
+ defaultValues: t,
3853
+ mode: "onTouched"
3854
+ }), { control: z, watch: T, setValue: C, handleSubmit: K, setError: A, clearErrors: M } = E;
3855
+ q(() => {
3856
+ M();
3857
+ for (const [w, D] of Object.entries(o))
3858
+ A(w, { type: "server", message: D });
3859
+ }, [o, A, M]);
3860
+ const J = R(
3861
+ () => n.containers.flatMap((w) => w.campos).filter((w) => w.condicional && w.clearedValue !== void 0),
3862
+ [n.containers]
3863
+ ), B = R(
3864
+ () => n.containers.flatMap((w) => w.campos).filter((w) => {
3865
+ var D;
3866
+ return w.condicional && ((D = w.setValues) == null ? void 0 : D.length);
3867
+ }),
3868
+ [n.containers]
3869
+ ), re = te({}), V = de({ control: z }), Q = te(f);
3870
+ Q.current = f, q(() => {
3871
+ var w;
3872
+ (w = Q.current) == null || w.call(Q, V);
3873
+ }, [V]), q(() => {
3874
+ let w = !1;
3875
+ return b(V).then((G) => {
3876
+ var k;
3877
+ w || (x(G), (k = g.current) == null || k.call(g, G));
3878
+ }), () => {
3879
+ w = !0;
3880
+ };
3881
+ }, [V, b]), q(() => {
3882
+ var G;
3883
+ if (!J.length && !B.length) return;
3884
+ const w = V, D = s;
3885
+ for (const k of J)
3886
+ if (!ee(
3887
+ k.condicional,
3888
+ w,
3889
+ s
3890
+ )) {
3891
+ const se = k.clearedValue ?? "";
3892
+ w[k.nome] !== se && C(k.nome, se, { shouldValidate: !1 });
3893
+ }
3894
+ for (const k of B) {
3895
+ const U = ee(
3896
+ k.condicional,
3897
+ w,
3898
+ s
3899
+ ), se = re.current[k.nome] ?? !1;
3900
+ if (U && !se && ((G = k.setValues) != null && G.length))
3901
+ for (const _e of k.setValues) {
3902
+ const Hr = typeof _e.valor == "string" ? Y(_e.valor, D) : _e.valor;
3903
+ C(_e.campo, Hr, { shouldValidate: !1 });
3904
+ }
3905
+ re.current[k.nome] = U;
3906
+ }
3907
+ }, [
3908
+ V,
3909
+ J,
3910
+ B,
3911
+ s,
3912
+ C
3913
+ ]);
3914
+ const W = O.icone ? Te[O.icone] : void 0, ue = R(
3915
+ () => () => {
3916
+ E.handleSubmit(u)();
3917
+ },
3918
+ // eslint-disable-next-line react-hooks/exhaustive-deps
3919
+ [u]
3920
+ );
3921
+ return /* @__PURE__ */ i(Gr, { ...E, children: /* @__PURE__ */ i(
3922
+ Xs,
3923
+ {
3924
+ value: {
3925
+ submitting: a,
3926
+ warnings: _,
3927
+ requestSubmit: ue
3928
+ },
3929
+ children: /* @__PURE__ */ i(
3930
+ "form",
3931
+ {
3932
+ onSubmit: K(u),
3933
+ noValidate: !0,
3934
+ onKeyDown: (w) => {
3935
+ w.key === "Enter" && w.target.tagName === "INPUT" && w.preventDefault();
3936
+ },
3937
+ children: /* @__PURE__ */ m("div", { className: "space-y-6", children: [
3938
+ O.showLabel !== !1 && /* @__PURE__ */ m("div", { className: "text-center space-y-2", children: [
3939
+ W && /* @__PURE__ */ i(
3940
+ "div",
3941
+ {
3942
+ className: "w-12 h-12 mx-auto rounded-xl flex items-center justify-center",
3943
+ style: {
3944
+ background: "color-mix(in srgb, var(--t-primary) 12%, transparent)"
3945
+ },
3946
+ children: /* @__PURE__ */ i(
3947
+ W,
3948
+ {
3949
+ className: "w-6 h-6",
3950
+ style: { color: "var(--t-primary)" }
3951
+ }
3952
+ )
3953
+ }
3954
+ ),
3955
+ /* @__PURE__ */ i(
3956
+ "h2",
3957
+ {
3958
+ className: "sfr-step__title text-2xl font-bold",
3959
+ style: { color: "var(--t-text)" },
3960
+ children: O.titulo
3961
+ }
3962
+ ),
3963
+ O.descricao && /* @__PURE__ */ i(
3964
+ "p",
3965
+ {
3966
+ className: "sfr-step__desc text-sm",
3967
+ style: { color: "var(--t-text-muted)" },
3968
+ children: O.descricao
3969
+ }
3970
+ )
3971
+ ] }),
3972
+ /* @__PURE__ */ i(
3973
+ Us,
3974
+ {
3975
+ step: O,
3976
+ control: z,
3977
+ externalData: s
3978
+ }
3979
+ ),
3980
+ /* @__PURE__ */ m("div", { className: "sfr-form__nav flex items-center justify-between gap-4 pt-6 pb-2", children: [
3981
+ /* @__PURE__ */ m(
3982
+ "button",
3983
+ {
3984
+ type: "button",
3985
+ className: "sfr-btn sfr-btn--outline flex items-center gap-1 px-4 py-2 border rounded-lg text-sm",
3986
+ onClick: y,
3987
+ disabled: e === 0,
3988
+ style: e > 0 ? {
3989
+ borderColor: "color-mix(in srgb, var(--t-primary) 40%, transparent)",
3990
+ color: "var(--t-primary)"
3991
+ } : {},
3992
+ children: [
3993
+ /* @__PURE__ */ i(lt, { className: "w-4 h-4" }),
3994
+ /* @__PURE__ */ i("span", { className: "hidden sm:inline", children: "Anterior" })
3995
+ ]
3996
+ }
3997
+ ),
3998
+ /* @__PURE__ */ m(
3999
+ "span",
4000
+ {
4001
+ className: "text-xs font-semibold tabular-nums sm:hidden",
4002
+ style: { color: "var(--t-text-muted)" },
4003
+ children: [
4004
+ e + 1,
4005
+ "/",
4006
+ r
4007
+ ]
4008
+ }
4009
+ ),
4010
+ /* @__PURE__ */ m(
4011
+ "button",
4012
+ {
4013
+ type: "submit",
4014
+ className: "sfr-btn sfr-btn--primary flex items-center gap-1 px-4 py-2 rounded-lg text-sm font-semibold",
4015
+ disabled: a,
4016
+ style: { background: "var(--t-primary)", color: "#ffffff" },
4017
+ children: [
4018
+ a ? /* @__PURE__ */ i(wr, { className: "w-4 h-4 animate-spin" }) : v ? /* @__PURE__ */ i(zr, { className: "w-4 h-4" }) : /* @__PURE__ */ i(dt, { className: "w-4 h-4" }),
4019
+ /* @__PURE__ */ i("span", { className: "hidden sm:inline", children: v ? "Finalizar" : "Próximo" })
4020
+ ]
4021
+ }
4022
+ )
4023
+ ] }),
4024
+ c && /* @__PURE__ */ i("p", { className: "sfr-error text-sm mt-2 text-center", children: c })
4025
+ ] })
4026
+ }
4027
+ )
4028
+ }
4029
+ ) });
4030
+ }, Gs = (e, r, n) => {
4031
+ const t = { ...r }, s = n;
4032
+ for (const o of e.containers)
4033
+ for (const a of o.campos)
4034
+ t[a.nome] === void 0 && (a.initialValue !== void 0 ? t[a.nome] = typeof a.initialValue == "string" ? Y(a.initialValue, s) : a.initialValue : a.defaultValue !== void 0 && (t[a.nome] = a.defaultValue));
4035
+ return t;
4036
+ }, ao = ({
4037
+ schema: e,
4038
+ initialValues: r = {},
4039
+ initialStep: n = 0,
4040
+ onSubmitStep: t,
4041
+ onComplete: s,
4042
+ template: o,
4043
+ formTitle: a,
4044
+ externalData: c = {},
4045
+ fieldErrors: l = {},
4046
+ uploadFile: d,
4047
+ cepLookup: f,
4048
+ resolveTermsUploadUrl: u,
4049
+ fieldResolvers: y,
4050
+ validatorMapper: v,
4051
+ componentMapper: N,
4052
+ paymentMethodOptions: b,
4053
+ onValuesChange: _,
4054
+ className: x,
4055
+ StepIndicator: g = Ks
4056
+ }) => {
4057
+ const [p, O] = F(() => n), [E, z] = F({
4058
+ ...r
4059
+ }), [T, C] = F(!1), [K, A] = F(null), [M, J] = F(
4060
+ {}
4061
+ ), B = R(() => Yr(o), [o]), re = R(
4062
+ () => [...e.steps].sort((k, U) => k.ordem - U.ordem),
4063
+ [e.steps]
4064
+ ), V = re.length, Q = re[Math.min(p, V - 1)], W = R(
4065
+ () => Gs(Q, E, c),
4066
+ // eslint-disable-next-line react-hooks/exhaustive-deps
4067
+ [Q, E, JSON.stringify(c)]
4068
+ ), ue = R(
4069
+ () => ({
4070
+ uploadFile: d,
4071
+ cepLookup: f,
4072
+ resolveTermsUploadUrl: u,
4073
+ externalData: c,
4074
+ fieldResolvers: y,
4075
+ validatorMapper: v,
4076
+ fieldWarnings: M,
4077
+ componentMapper: N,
4078
+ paymentMethodOptions: b
4079
+ }),
4080
+ // eslint-disable-next-line react-hooks/exhaustive-deps
4081
+ [
4082
+ d,
4083
+ f,
4084
+ u,
4085
+ y,
4086
+ v,
4087
+ M,
4088
+ N,
4089
+ b,
4090
+ JSON.stringify(c)
4091
+ ]
4092
+ ), w = oe(
4093
+ async (k) => {
4094
+ C(!0), A(null);
4095
+ try {
4096
+ const U = { ...E, ...k };
4097
+ z(U), t && await t(p, k), p === V - 1 ? s && await s(U) : O((se) => se + 1);
4098
+ } catch (U) {
4099
+ console.error("[FormRenderer] Submit error:", U);
4100
+ const se = U instanceof Error ? U.message : "Ocorreu um erro. Tente novamente.";
4101
+ A(se);
4102
+ } finally {
4103
+ C(!1);
4104
+ }
4105
+ },
4106
+ [p, E, V, t, s]
4107
+ ), D = oe(() => {
4108
+ p > 0 && O((k) => k - 1);
4109
+ }, [p]), G = B.layout.eventTitleStyle ?? "bar";
4110
+ return /* @__PURE__ */ i(Fr.Provider, { value: ue, children: /* @__PURE__ */ i(
4111
+ Qr,
4112
+ {
4113
+ config: B,
4114
+ className: `sfr-root min-h-dvh ${B.wrapperClass ?? ""} ${x ?? ""}`,
4115
+ renderWrapper: !0,
4116
+ children: /* @__PURE__ */ m("div", { className: "sfr-form w-full max-w-4xl mx-auto px-4 py-6 sm:px-6", children: [
4117
+ a && G === "bar" && /* @__PURE__ */ i(
4118
+ "div",
4119
+ {
4120
+ className: "sfr-form__title w-full text-center text-sm font-medium py-2.5 px-4 mb-6 rounded-lg border",
4121
+ style: {
4122
+ background: "color-mix(in srgb, var(--t-surface) 80%, transparent)",
4123
+ borderColor: "var(--t-border)",
4124
+ color: "var(--t-text-muted)"
4125
+ },
4126
+ children: a
4127
+ }
4128
+ ),
4129
+ a && G === "inline" && /* @__PURE__ */ m("div", { className: "text-center mb-6", children: [
4130
+ /* @__PURE__ */ i(
4131
+ "p",
4132
+ {
4133
+ className: "text-xs font-semibold uppercase tracking-widest mb-1",
4134
+ style: { color: "var(--t-text-muted)" },
4135
+ children: "Inscrição"
4136
+ }
4137
+ ),
4138
+ /* @__PURE__ */ i(
4139
+ "h1",
4140
+ {
4141
+ className: "text-2xl font-bold",
4142
+ style: { color: "var(--t-text)" },
4143
+ children: a
4144
+ }
4145
+ ),
4146
+ /* @__PURE__ */ i(
4147
+ "div",
4148
+ {
4149
+ className: "h-0.5 w-12 mx-auto mt-3 rounded-full",
4150
+ style: { background: "var(--t-primary)" }
4151
+ }
4152
+ )
4153
+ ] }),
4154
+ V > 1 && /* @__PURE__ */ i("div", { className: "mb-8", children: /* @__PURE__ */ i(
4155
+ g,
4156
+ {
4157
+ steps: re.map((k) => ({
4158
+ id: k.id,
4159
+ label: k.titulo,
4160
+ icone: k.icone
4161
+ })),
4162
+ currentStep: p,
4163
+ onStepClick: O
4164
+ }
4165
+ ) }),
4166
+ /* @__PURE__ */ i(
4167
+ Ws,
4168
+ {
4169
+ stepIndex: p,
4170
+ totalSteps: V,
4171
+ step: Q,
4172
+ defaultValues: W,
4173
+ externalData: c,
4174
+ fieldErrors: l,
4175
+ isSubmitting: T,
4176
+ submitError: K,
4177
+ validatorMapper: v,
4178
+ onWarningsChange: J,
4179
+ onValuesChange: _,
4180
+ onSubmit: w,
4181
+ onBack: D
4182
+ },
4183
+ p
4184
+ )
4185
+ ] })
4186
+ }
4187
+ ) });
4188
+ }, io = ({
4189
+ children: e,
4190
+ render: r,
4191
+ onChange: n
4192
+ }) => {
4193
+ const t = Hs(), s = te(n);
4194
+ return s.current = n, q(() => {
4195
+ var o;
4196
+ (o = s.current) == null || o.call(s, t);
4197
+ }, [
4198
+ // eslint-disable-next-line react-hooks/exhaustive-deps
4199
+ t.values,
4200
+ t.dirty,
4201
+ t.valid,
4202
+ t.submitting,
4203
+ // eslint-disable-next-line react-hooks/exhaustive-deps
4204
+ t.errors,
4205
+ // eslint-disable-next-line react-hooks/exhaustive-deps
4206
+ t.warnings
4207
+ ]), r ? /* @__PURE__ */ i(Ee, { children: r(t) }) : typeof e == "function" ? /* @__PURE__ */ i(Ee, { children: e(t) }) : e !== void 0 ? /* @__PURE__ */ i(Ee, { children: e }) : null;
4208
+ };
4209
+ export {
4210
+ Bs as ContainerRenderer,
4211
+ Vr as DFCepField,
4212
+ Ue as DFCheckbox,
4213
+ jr as DFCheckboxGroup,
4214
+ ye as DFDateField,
4215
+ ws as DFFieldArray,
4216
+ Lr as DFFileUpload,
4217
+ Xe as DFHidden,
4218
+ ie as DFMaskedInput,
4219
+ Os as DFParticipationType,
4220
+ Ps as DFPaymentMethod,
4221
+ Zr as DFRadioGroup,
4222
+ Be as DFSelect,
4223
+ Ds as DFTerms,
4224
+ X as DFTextField,
4225
+ Je as DFTextarea,
4226
+ ao as FormRenderer,
4227
+ io as FormSpy,
4228
+ Ts as OPCOES_POR_DIA,
4229
+ $s as OPCOES_TODOS_OS_DIAS,
4230
+ Fr as RendererContext,
4231
+ Us as StepRenderer,
4232
+ ee as evaluateFieldCondition,
4233
+ Y as interpolate,
4234
+ Ve as interpolateContainer,
4235
+ ps as interpolateField,
4236
+ hs as interpolateStep,
4237
+ ds as makeStepResolver,
4238
+ us as makeStepWarnComputer,
4239
+ so as useField,
4240
+ oo as useFieldApi,
4241
+ no as useFormApi,
4242
+ Hs as useFormState,
4243
+ ne as useRendererContext
4244
+ };