react-hook-form-next-ui 3.0.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js ADDED
@@ -0,0 +1,1417 @@
1
+ import c, { useState as B, useEffect as ne, useCallback as R, useMemo as P } from "react";
2
+ import { Table as ke, TableHeader as Ne, TableColumn as Fe, TableBody as Se, TableRow as Ie, TableCell as Pe, Skeleton as Je, Pagination as Qe, Button as Q, Input as Ze, Divider as He, Card as Xe, CardHeader as Ke, CardBody as et, DatePicker as oe, InputOtp as tt, Select as nt, SelectItem as rt, TimeInput as le, Textarea as at, Autocomplete as st, AutocompleteItem as ot, RadioGroup as lt, Radio as it, Checkbox as Re, CheckboxGroup as ct, Modal as ut, ModalContent as mt, ModalHeader as dt, ModalBody as ft, ModalFooter as ht } from "@heroui/react";
3
+ import { useFormContext as I, Controller as C, useWatch as X } from "react-hook-form";
4
+ import { mixed as J } from "yup";
5
+ const gt = ({
6
+ size: e = 10,
7
+ columns: n = []
8
+ }) => /* @__PURE__ */ c.createElement(ke, { "aria-label": "Tabla de resultados" }, /* @__PURE__ */ c.createElement(Ne, null, n.map(
9
+ (t) => /* @__PURE__ */ c.createElement(Fe, { ...n, key: t.key }, t.title)
10
+ )), /* @__PURE__ */ c.createElement(Se, null, Array.from(
11
+ { length: e },
12
+ (t, r) => /* @__PURE__ */ c.createElement(Ie, { key: r }, () => /* @__PURE__ */ c.createElement(Pe, null, /* @__PURE__ */ c.createElement(Je, { className: "h-5 w-4/5 rounded-lg" })))
13
+ ))), pt = (e, n) => {
14
+ const [t, r] = B(e);
15
+ return ne(() => {
16
+ const a = setTimeout(() => {
17
+ r(e);
18
+ }, n);
19
+ return () => {
20
+ clearTimeout(a);
21
+ };
22
+ }, [e, n]), t;
23
+ };
24
+ var Ve = /^([0-9]{4})-([0-1][0-9])(?:-([0-3][0-9]))?(?:[T ]?([0-2][0-9])(?::([0-5][0-9]))?(?::([0-5][0-9]))?)?(?:\.[0-9]+)?(Z|(?:\+|\-)[0-9]{2}:?[0-9]{2})?$/;
25
+ function Mt(e) {
26
+ const n = e.match(Ve);
27
+ if (n) {
28
+ const t = Number(n[2]);
29
+ if (t < 1 || t > 12)
30
+ return !1;
31
+ if (typeof n[3] !== void 0) {
32
+ const r = Number(n[3]);
33
+ if (r < 1 || r > 31)
34
+ return !1;
35
+ }
36
+ if (typeof n[4] !== void 0) {
37
+ const r = Number(n[4]);
38
+ if (r < 0 || r > 23)
39
+ return !1;
40
+ }
41
+ return !0;
42
+ }
43
+ return !1;
44
+ }
45
+ function vt(e) {
46
+ const n = e.match(Ve);
47
+ return n && typeof n[4] > "u" ? e += "T00:00:00" : e;
48
+ }
49
+ function T(e) {
50
+ if (e || (e = /* @__PURE__ */ new Date()), e instanceof Date) {
51
+ const n = new Date(e);
52
+ return n.setMilliseconds(0), n;
53
+ }
54
+ if (e = e.trim(), Mt(e))
55
+ return new Date(vt(e));
56
+ throw new Error(`Non ISO 8601 compliant date (${e}).`);
57
+ }
58
+ function Et(e) {
59
+ const n = T(e);
60
+ return n.setDate(1), n.setMonth(n.getMonth() + 1), n.setDate(0), n;
61
+ }
62
+ function je(e) {
63
+ return Et(e).getDate();
64
+ }
65
+ var ie = "1999-03-04T02:05:01.000Z", ae = /* @__PURE__ */ new Map(), ce = [
66
+ ["YYYY", { year: "numeric" }],
67
+ ["YY", { year: "2-digit" }],
68
+ ["MMMM", { month: "long" }],
69
+ ["MMM", { month: "short" }],
70
+ ["MM", { month: "2-digit" }],
71
+ ["M", { month: "numeric" }],
72
+ ["DD", { day: "2-digit" }],
73
+ ["D", { day: "numeric" }],
74
+ ["dddd", { weekday: "long" }],
75
+ ["ddd", { weekday: "short" }],
76
+ ["d", { weekday: "narrow" }],
77
+ ["mm", { minute: "2-digit" }],
78
+ ["m", { minute: "numeric" }],
79
+ ["ss", { second: "2-digit" }],
80
+ ["s", { second: "numeric" }],
81
+ ["ZZ", { timeZoneName: "long" }],
82
+ ["Z", { timeZoneName: "short" }]
83
+ ], ue = [
84
+ ["HH", { hour: "2-digit" }],
85
+ ["H", { hour: "numeric" }]
86
+ ], me = [
87
+ ["hh", { hour: "2-digit" }],
88
+ ["h", { hour: "numeric" }],
89
+ ["a", { dayPeriod: "narrow" }],
90
+ ["A", { dayPeriod: "narrow" }]
91
+ ], K = {
92
+ DD: 2,
93
+ HH: 2,
94
+ MM: 2,
95
+ YY: 2,
96
+ YYYY: 4,
97
+ hh: 2,
98
+ mm: 2,
99
+ ss: 2
100
+ };
101
+ function Le(e) {
102
+ if (/^[+-]\d{2}:\d{2}/.test(e))
103
+ return 6;
104
+ if (/^[+-]\d{4}/.test(e))
105
+ return 5;
106
+ throw new Error("Invalid offset format");
107
+ }
108
+ var wt = ["MMMM", "MMM", "dddd", "ddd"], v = /* @__PURE__ */ new Map(
109
+ /* @__PURE__ */ [...ce, ...ue, ...me].map((e) => [e[0], e])
110
+ ), xe = /* @__PURE__ */ new Map(), Ae = [
111
+ "full",
112
+ "long",
113
+ "medium",
114
+ "short"
115
+ ], L = (e) => String(e).padStart(2, "0"), se = (e) => String(e).padStart(2, "0");
116
+ function V(e) {
117
+ return e.type === "literal" && (e.value = e.value.normalize("NFKC")), e;
118
+ }
119
+ function yt(e, n, t, r = !1, a = null) {
120
+ const s = bt(e, n, t, r), i = T(e);
121
+ function o({ partName: m, partValue: d, token: l }) {
122
+ if (m === "literal")
123
+ return d;
124
+ const u = s[m];
125
+ if (m === "hour" && l === "H")
126
+ return u.replace(/^0/, "") || "0";
127
+ if (["mm", "ss", "MM"].includes(l) && u.length === 1)
128
+ return `0${u}`;
129
+ if (m === "dayPeriod") {
130
+ const f = z(i.getUTCHours() < 12 ? "am" : "pm", t);
131
+ return l === "A" ? f.toUpperCase() : f.toLowerCase();
132
+ }
133
+ return m === "timeZoneName" ? a ?? Be(-1 * i.getTimezoneOffset(), l) : u;
134
+ }
135
+ return n.map((m) => ({
136
+ ...m,
137
+ value: o(m)
138
+ }));
139
+ }
140
+ function bt(e, n, t, r = !1) {
141
+ const a = T(e), s = n.filter((l) => l.hour12), i = n.filter((l) => !l.hour12), o = [], m = [];
142
+ function d(l, u = !1) {
143
+ const f = `${t}-u-hc-${u ? "h12" : "h23"}`;
144
+ if (o.push(
145
+ ...new Intl.DateTimeFormat(
146
+ f,
147
+ l.reduce(
148
+ (h, p) => p.partName === "literal" ? h : (r && wt.includes(p.token) && m.push(p), Object.assign(h, p.option)),
149
+ { timeZone: "UTC" }
150
+ )
151
+ ).formatToParts(a).map(V)
152
+ ), r && m.length)
153
+ for (const h of m) {
154
+ let p = [];
155
+ switch (h.token) {
156
+ case "MMMM":
157
+ p = new Intl.DateTimeFormat(f, {
158
+ dateStyle: "long",
159
+ timeZone: "UTC"
160
+ }).formatToParts(a).map(V);
161
+ break;
162
+ case "MMM":
163
+ p = new Intl.DateTimeFormat(f, {
164
+ dateStyle: "medium",
165
+ timeZone: "UTC"
166
+ }).formatToParts(a).map(V);
167
+ break;
168
+ }
169
+ const w = p.find(
170
+ (M) => M.type === h.partName
171
+ ), k = o.findIndex((M) => M.type === h.partName);
172
+ w && k > -1 && (o[k] = w);
173
+ }
174
+ }
175
+ return s.length && d(s, !0), i.length && d(i), o.reduce((l, u) => (l[u.type] = u.value, l), {});
176
+ }
177
+ function Be(e, n = "Z") {
178
+ const t = String(Math.floor(Math.abs(e / 60))).padStart(
179
+ 2,
180
+ "0"
181
+ ), r = String(Math.abs(e % 60)).padStart(2, "0"), a = e < 0 ? "-" : "+";
182
+ return n === "ZZ" ? `${a}${t}${r}` : `${a}${t}:${r}`;
183
+ }
184
+ function xt(e, n) {
185
+ Ue(e, n);
186
+ const [t, r, a, s] = e.match(
187
+ /([+-])([0-3][0-9]):?([0-6][0-9])/
188
+ ), i = Number(a) * 60 + Number(s);
189
+ return r === "+" ? i : -i;
190
+ }
191
+ function Ue(e, n = "Z") {
192
+ if (!((r) => {
193
+ switch (r) {
194
+ case "Z":
195
+ return /^([+-])[0-3][0-9]:[0-6][0-9]$/.test(e);
196
+ case "ZZ":
197
+ return /^([+-])[0-3][0-9][0-6][0-9]$/.test(e);
198
+ }
199
+ })(n))
200
+ throw new Error(`Invalid offset: ${e}`);
201
+ return e;
202
+ }
203
+ function $t(e) {
204
+ return ce.concat(ue).concat(me).sort((n, t) => n[0].length > t[0].length ? 1 : -1).reduce((n, t) => n.replace(t[0], `\\${t[0]}`), e);
205
+ }
206
+ function Dt(e) {
207
+ return ["numeric", "2-digit"].includes(e.partValue);
208
+ }
209
+ function Tt(e) {
210
+ let n;
211
+ for (const t of e) {
212
+ if (t.partName === "literal" && !isNaN(parseFloat(t.partValue)))
213
+ throw new Error(`Numbers in format (${t.partValue}).`);
214
+ if (n && n.partName !== "literal" && t.partName !== "literal" && !(n.token in K) && !(t.token in K) && !(Dt(n) && t.token.toLowerCase() === "a"))
215
+ throw new Error(
216
+ `Illegal adjacent tokens (${n.token}, ${t.token})`
217
+ );
218
+ n = t;
219
+ }
220
+ return e;
221
+ }
222
+ function Ct(e) {
223
+ return typeof e == "string" ? e.includes("ZZ") ? "ZZ" : "Z" : "time" in e && e.time === "full" ? "Z" : "ZZ";
224
+ }
225
+ function z(e, n) {
226
+ const t = xe.get(n);
227
+ if (t && t[e])
228
+ return t[e];
229
+ const r = new Date(ie);
230
+ r.setUTCHours(e === "am" ? 5 : 20);
231
+ const s = new Intl.DateTimeFormat(n, {
232
+ timeStyle: "full",
233
+ timeZone: "UTC",
234
+ hour12: !0
235
+ }).formatToParts(r).map(V).find((i) => i.type === "dayPeriod");
236
+ if (s) {
237
+ const i = t || {};
238
+ return xe.set(
239
+ n,
240
+ Object.assign(i, { [e]: s.value })
241
+ ), s.value;
242
+ }
243
+ return e;
244
+ }
245
+ function Yt(e, n = "+00:00") {
246
+ const t = T(e), r = (() => {
247
+ switch (Le(n)) {
248
+ case 5:
249
+ return "ZZ";
250
+ case 6:
251
+ return "Z";
252
+ }
253
+ })(), a = xt(n, r);
254
+ return new Date(t.getTime() + a * 1e3 * 60);
255
+ }
256
+ function We() {
257
+ return Intl.DateTimeFormat().resolvedOptions().timeZone;
258
+ }
259
+ function $e(e, n) {
260
+ const t = new Intl.DateTimeFormat("en-US", {
261
+ year: "numeric",
262
+ month: "2-digit",
263
+ day: "2-digit",
264
+ hour: "2-digit",
265
+ minute: "2-digit",
266
+ second: "2-digit",
267
+ timeZone: n,
268
+ hourCycle: "h23"
269
+ }).formatToParts(e).map(V), r = {};
270
+ return t.forEach((a) => {
271
+ r[a.type] = a.value;
272
+ }), /* @__PURE__ */ new Date(
273
+ `${r.year}-${r.month}-${r.day}T${r.hour}:${r.minute}:${r.second}Z`
274
+ );
275
+ }
276
+ function De(e, n = "UTC", t = "device", r = "Z") {
277
+ var a;
278
+ t = t === "device" ? (a = We()) != null ? a : "utc" : t;
279
+ const s = T(e), i = $e(s, n), o = $e(s, t), m = Math.round(
280
+ (o.getTime() - i.getTime()) / 1e3 / 60
281
+ );
282
+ return Be(m, r);
283
+ }
284
+ function de(e, n) {
285
+ if (Ae.includes(e) || typeof e == "object")
286
+ return kt(e, n);
287
+ let t = e, r = 0;
288
+ const a = (l) => {
289
+ if (l[2] || (l[2] = new RegExp(`(.)?(${l[0]})`, "g")), l[2].test(t)) {
290
+ let u = 0;
291
+ return t = t.replace(l[2], (f, h, p) => h === "\\" ? p : `${typeof h == "string" ? h : ""}{!${u++ ? r : r++}!}`), !!u;
292
+ }
293
+ return !1;
294
+ };
295
+ function s(l) {
296
+ const u = l.map((h) => h.partName), f = new Set(u);
297
+ if (u.length > f.size)
298
+ throw new Error("Cannot reuse format tokens.");
299
+ return l;
300
+ }
301
+ function i(l, [u, f, h]) {
302
+ const p = Object.keys(f)[0], w = f[p];
303
+ return {
304
+ option: f,
305
+ partName: p,
306
+ partValue: w,
307
+ token: u,
308
+ pattern: h,
309
+ hour12: l
310
+ };
311
+ }
312
+ const o = ce.filter(a).concat(ue.filter(a)).map(i.bind(null, !1)), m = s(
313
+ o.concat(
314
+ me.filter(a).map(i.bind(null, !0))
315
+ )
316
+ ), d = /^\{!(\d+)!\}$/;
317
+ return t.split(/(\{!\d+!\})/).map((l) => {
318
+ const u = l.match(d);
319
+ return u ? m[Number(u[1])] : {
320
+ option: { literal: l },
321
+ partName: "literal",
322
+ partValue: l,
323
+ token: l,
324
+ pattern: new RegExp(""),
325
+ hour12: !1
326
+ };
327
+ }).filter((l) => !(l.partName === "literal" && l.partValue === ""));
328
+ }
329
+ function kt(e, n) {
330
+ const t = {
331
+ timeZone: "UTC"
332
+ };
333
+ typeof e == "string" ? t.dateStyle = e : ("date" in e && (t.dateStyle = e.date), "time" in e && (t.timeStyle = e.time));
334
+ const r = new Intl.DateTimeFormat(n, t), a = r.formatToParts(new Date(ie)).map(V), i = r.formatToParts(/* @__PURE__ */ new Date("1999-04-05T23:05:01.000Z")).map(V).find((m) => m.type === "hour"), o = i && i.value === "23" ? 24 : 12;
335
+ return a.map((m) => {
336
+ const d = m.type, l = Nt(
337
+ m.type,
338
+ m.value,
339
+ n,
340
+ m.type === "hour" ? o : void 0,
341
+ t
342
+ );
343
+ if (l === void 0)
344
+ return;
345
+ const u = l[1][d];
346
+ if (u)
347
+ return l[2] || (l[2] = new RegExp(`${l[0]}`, "g")), {
348
+ option: { [d]: u },
349
+ partName: d,
350
+ partValue: u,
351
+ token: l[0],
352
+ pattern: l[2],
353
+ hour12: o === 12
354
+ };
355
+ }).filter((m) => !!m);
356
+ }
357
+ function Nt(e, n, t, r, a) {
358
+ const s = n.length, i = !isNaN(Number(n));
359
+ let o;
360
+ switch (e) {
361
+ case "year":
362
+ return s === 2 ? v.get("YY") : v.get("YYYY");
363
+ case "month":
364
+ if (i)
365
+ return s === 1 ? v.get("M") : v.get("MM");
366
+ switch (o = Te(t, e, n), o) {
367
+ case "long":
368
+ return v.get("MMMM");
369
+ default:
370
+ return v.get("MMM");
371
+ }
372
+ case "day":
373
+ return s === 1 ? v.get("D") : v.get("DD");
374
+ case "weekday":
375
+ switch (o = Te(t, e, n), o) {
376
+ case "narrow":
377
+ return v.get("d");
378
+ case "short":
379
+ return v.get("ddd");
380
+ default:
381
+ return v.get("dddd");
382
+ }
383
+ case "hour":
384
+ return r === 12 ? s === 1 ? v.get("h") : v.get("hh") : s === 1 ? v.get("H") : v.get("HH");
385
+ case "minute":
386
+ return s === 1 ? v.get("m") : v.get("mm");
387
+ case "second":
388
+ return s === 1 ? v.get("s") : v.get("ss");
389
+ case "dayPeriod":
390
+ return /^[A-Z]+$/u.test(n) ? v.get("A") : v.get("a");
391
+ case "literal":
392
+ return [n, { literal: n }, new RegExp("")];
393
+ case "timeZoneName":
394
+ return a.timeStyle === "full" ? v.get("Z") : v.get("ZZ");
395
+ default:
396
+ return;
397
+ }
398
+ }
399
+ function Te(e, n, t) {
400
+ if (!ae.has(e)) {
401
+ const a = new Date(ie), s = [3, 8, 9, 7, 6, 4, 3], i = ["weekday", "month", "dayPeriod"], o = ["long", "short", "narrow"], m = {};
402
+ for (let d = 0; d < 12; d++) {
403
+ a.setMonth(0 + d), d in s && a.setDate(s[d]), a.setUTCHours(8 + d);
404
+ for (const l of o) {
405
+ const u = new Intl.DateTimeFormat(
406
+ e,
407
+ i.reduce(
408
+ (f, h) => Object.assign(f, { [h]: l }),
409
+ { hour12: !0, timeZone: "UTC" }
410
+ )
411
+ ).formatToParts(a).map(V);
412
+ if (l === "long" || l === "short") {
413
+ const h = new Intl.DateTimeFormat(e, {
414
+ dateStyle: l === "short" ? "medium" : "long",
415
+ timeZone: "UTC"
416
+ }).formatToParts(a).map(V).find(
417
+ (w) => w.type === "month"
418
+ ), p = u.findIndex((w) => w.type === "month");
419
+ p > -1 && h && (u[p] = h);
420
+ }
421
+ u.forEach((f) => {
422
+ if (f.type === "literal")
423
+ return;
424
+ const h = f.type;
425
+ m[h] = Object.assign(m[h] || {}, {
426
+ [f.value]: l
427
+ });
428
+ });
429
+ }
430
+ }
431
+ ae.set(e, m);
432
+ }
433
+ const r = ae.get(e);
434
+ return r ? r[n][t] : void 0;
435
+ }
436
+ function Ft(e, n = "+00:00") {
437
+ const t = n.slice(0, 1) === "+";
438
+ return Yt(
439
+ e,
440
+ n.replace(t ? "+" : "-", t ? "-" : "+")
441
+ );
442
+ }
443
+ function St() {
444
+ return Intl.DateTimeFormat().resolvedOptions().locale;
445
+ }
446
+ function Z(e, n = "long", t = "device", r = !1, a) {
447
+ let s, i;
448
+ return typeof e == "object" && !(e instanceof Date) && ({
449
+ date: e,
450
+ format: n,
451
+ locale: t,
452
+ genitive: r,
453
+ partFilter: a,
454
+ tz: s
455
+ } = e), n === "ISO8601" ? T(e).toISOString() : (s && (i = De(e, "utc", s, Ct(n))), s ?? (s = We()), (s == null ? void 0 : s.toLowerCase()) !== "utc" && (e = Ft(
456
+ e,
457
+ De(e, s, "utc")
458
+ )), (!t || t === "device") && (t = St()), yt(
459
+ e,
460
+ de(n, t).filter(a ?? (() => !0)),
461
+ t,
462
+ r,
463
+ i
464
+ ).map((o) => o.value).join(""));
465
+ }
466
+ function It(e, n = "en", t = !1, r = () => !0) {
467
+ return de(e, n).filter(r).reduce(
468
+ (a, s) => a += t && s.partName === "literal" ? $t(s.token) : s.token,
469
+ ""
470
+ ).normalize("NFKC");
471
+ }
472
+ function Pt(e) {
473
+ const n = (/* @__PURE__ */ new Date()).getFullYear(), t = n % 100, r = Math.floor(n / 100), a = Number(e);
474
+ return (r + (a > t + 20 ? -1 : 0)) * 100 + a;
475
+ }
476
+ function _e(e, n = "en", t = !1) {
477
+ const r = (a, s) => Array(a).fill("").map((i, o) => `${s(o)}`);
478
+ if (e === "M")
479
+ return r(12, (a) => a + 1);
480
+ if (e === "MM")
481
+ return r(12, (a) => {
482
+ const s = a + 1;
483
+ return s < 10 ? `0${s}` : s;
484
+ });
485
+ if (e.startsWith("M"))
486
+ return _e("MM").map(
487
+ (a) => Z(`2000-${a}-05`, e, n, t)
488
+ );
489
+ if (e.startsWith("d"))
490
+ return r(7, (a) => `0${a + 2}`).map(
491
+ (a) => Z(`2022-10-${a}`, e, n)
492
+ );
493
+ if (e === "a")
494
+ return [z("am", n).toLowerCase(), z("pm", n).toLowerCase()];
495
+ if (e === "A")
496
+ return [z("am", n).toUpperCase(), z("pm", n).toUpperCase()];
497
+ if (e.startsWith("Y")) {
498
+ const a = (/* @__PURE__ */ new Date()).getFullYear();
499
+ return r(120, (s) => s + 1).reduce(
500
+ (s, i) => (i !== "120" && s.push(Z(`${a + Number(i)}-06-06`, e, n)), s.unshift(Z(`${a - Number(i)}-06-06`, e, n)), s),
501
+ [Z(`${a}-06-06`, e, n)]
502
+ );
503
+ }
504
+ return e.startsWith("D") ? r(31, (a) => `${e === "DD" && a < 9 ? "0" : ""}${a + 1}`) : e.startsWith("H") ? r(24, (a) => `${e === "HH" && a < 10 ? "0" : ""}${a}`) : e.startsWith("h") ? r(12, (a) => `${e === "hh" && a < 9 ? "0" : ""}${a + 1}`) : e.startsWith("m") || e.startsWith("s") ? r(60, (a) => `${e.length > 1 && a < 10 ? "0" : ""}${a}`) : [];
505
+ }
506
+ function A(e, n = "ISO8601", t = "device") {
507
+ let r = () => !0, a, s = "backward";
508
+ if (typeof e == "object" ? {
509
+ date: a,
510
+ format: n = "ISO8601",
511
+ locale: t = "device",
512
+ dateOverflow: s = "backward",
513
+ partFilter: r = () => !0
514
+ } = e : a = e, !a)
515
+ throw new Error("parse() requires a date string.");
516
+ const i = () => {
517
+ throw new Error(
518
+ `Date (${a}) does not match format (${It(n, t)})`
519
+ );
520
+ };
521
+ if (n === "ISO8601")
522
+ return T(a);
523
+ const o = Ae.includes(n) || typeof n == "object", m = Tt(de(n, t).filter(r));
524
+ if (!m.length)
525
+ throw new Error("parse() requires a pattern.");
526
+ let d;
527
+ try {
528
+ d = Zt(a, m);
529
+ } catch {
530
+ return i();
531
+ }
532
+ const l = /* @__PURE__ */ new Date(), u = /* @__PURE__ */ new Map([
533
+ ["YYYY", l.getFullYear()],
534
+ ["MM", l.getMonth() + 1],
535
+ ["DD", l.getDate()],
536
+ ["HH", 0],
537
+ ["mm", 0],
538
+ ["ss", 0]
539
+ ]);
540
+ let f = null, h = "";
541
+ d.forEach((b) => {
542
+ if (b.partName === "literal")
543
+ return;
544
+ if (b.token === b.value)
545
+ return i();
546
+ const q = Number(b.value);
547
+ if (u.has(b.token))
548
+ u.set(b.token, q);
549
+ else if (b.token === "YY")
550
+ u.set("YYYY", Pt(b.value));
551
+ else {
552
+ const D = b.token;
553
+ if (D.startsWith("d"))
554
+ return;
555
+ if (D === "D")
556
+ u.set("DD", q);
557
+ else if (D === "H" || D.startsWith("h"))
558
+ u.set("HH", q);
559
+ else if (D === "M")
560
+ u.set("MM", q);
561
+ else if (D === "a" || D === "A")
562
+ f = b.value.toLowerCase() === z("am", t).toLowerCase();
563
+ else if (D === "Z" || D === "ZZ")
564
+ h = Ue(b.value, D);
565
+ else {
566
+ const W = _e(D, t, o).indexOf(b.value);
567
+ if (W !== -1)
568
+ switch (D) {
569
+ case "MMM":
570
+ case "MMMM":
571
+ u.set("MM", W + 1);
572
+ break;
573
+ }
574
+ }
575
+ }
576
+ });
577
+ let p = u.get("HH") || 0;
578
+ f === !1 ? (p += p === 12 ? 0 : 12, u.set("HH", p === 24 ? 0 : p)) : f === !0 && p === 12 && u.set("HH", 0), u.set("MM", (u.get("MM") || 1) - 1);
579
+ let [w, k, M, Y, y, $] = Array.from(u.values());
580
+ const N = je(/* @__PURE__ */ new Date(`${se(w)}-${L(k + 1)}-10`));
581
+ if (N < M && s === "throw")
582
+ throw new Error(`Invalid date ${se(w)}-${L(k + 1)}-${L(M)}`);
583
+ M = s === "backward" ? Math.min(M, N) : M;
584
+ const U = `${se(w)}-${L(k + 1)}-${L(M)}T${L(Y)}:${L(
585
+ y
586
+ )}:${L($)}${h}`, F = new Date(U);
587
+ return isFinite(+F) ? F : i();
588
+ }
589
+ function Zt(e, n) {
590
+ let t = 0;
591
+ const r = (o) => [
592
+ o[t++],
593
+ o[t]
594
+ ];
595
+ let a = 0;
596
+ const s = [];
597
+ let i;
598
+ do {
599
+ const [o, m] = r(n);
600
+ i = m;
601
+ let d = 1;
602
+ if (o.partName === "literal")
603
+ d = o.partValue.length;
604
+ else if (o.partName === "timeZoneName")
605
+ d = Le(e.substring(a));
606
+ else if (o.token in K)
607
+ d = K[o.token];
608
+ else if (m)
609
+ if (m.partName === "literal") {
610
+ if (d = e.indexOf(m.partValue, a) - a, d < 0)
611
+ throw new Error();
612
+ } else if (m.partName === "dayPeriod") {
613
+ for (let l = 1; l <= 4; l++)
614
+ if (isNaN(Number(e.charAt(a + l)))) {
615
+ d = l;
616
+ break;
617
+ }
618
+ } else {
619
+ const l = e.substring(a).search(/\d/);
620
+ l !== -1 && (d = a + l);
621
+ }
622
+ else
623
+ d = e.length;
624
+ s.push({ ...o, value: e.substring(a, a + d) }), a += d;
625
+ } while (i);
626
+ return s;
627
+ }
628
+ function Ht(e, n) {
629
+ const t = T(e), r = T(n);
630
+ return +t > +r;
631
+ }
632
+ function Rt(e, n) {
633
+ const t = T(e), r = T(n);
634
+ return +t == +r;
635
+ }
636
+ function fe(e, n) {
637
+ const t = T(e), r = T(n);
638
+ return +t - +r;
639
+ }
640
+ function he(e, n = "trunc") {
641
+ const t = Math[n](e);
642
+ return t == 0 ? 0 : t;
643
+ }
644
+ function Vt(e, n, t) {
645
+ return he(fe(e, n) / 6e4, t);
646
+ }
647
+ function jt(e, n, t) {
648
+ return he(
649
+ fe(e, n) / 36e5,
650
+ // 1000 * 60 * 60
651
+ t
652
+ );
653
+ }
654
+ function Lt(e, n, t) {
655
+ return he(
656
+ fe(e, n) / 864e5,
657
+ // hour * 24
658
+ t
659
+ );
660
+ }
661
+ function ge(e, n) {
662
+ const t = T(e), r = T(n);
663
+ if (t < r) {
664
+ const o = ge(r, t);
665
+ return o == 0 ? 0 : -o;
666
+ }
667
+ let a = (t.getFullYear() - r.getFullYear()) * 12 + (t.getMonth() - r.getMonth());
668
+ const s = t.getDate(), i = r.getDate();
669
+ if (s < i) {
670
+ const o = je(t);
671
+ o == s && o < i || a--;
672
+ }
673
+ return a == 0 ? 0 : a;
674
+ }
675
+ function At(e, n) {
676
+ const t = Math.trunc(ge(e, n) / 12);
677
+ return t == 0 ? 0 : t;
678
+ }
679
+ const Bt = () => /* @__PURE__ */ c.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 24 24", strokeWidth: 1.5, stroke: "currentColor", className: "size-5" }, /* @__PURE__ */ c.createElement("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "m21 21-5.197-5.197m0 0A7.5 7.5 0 1 0 5.196 5.196a7.5 7.5 0 0 0 10.607 10.607Z" })), Xt = ({
680
+ hideFilterSearch: e,
681
+ loading: n,
682
+ isVirtualized: t,
683
+ onSelect: r,
684
+ selectionMode: a,
685
+ inputSearch: s,
686
+ hideRowsPerPageOptions: i,
687
+ extraTopContent: o,
688
+ cellClass: m,
689
+ rows: d = [],
690
+ columns: l = [],
691
+ keyRow: u = "id",
692
+ itemsName: f = "datos",
693
+ rowsPerPageOptions: h = { default: 10, options: [5, 10, 15] },
694
+ ...p
695
+ }) => {
696
+ const [w, k] = B(""), [M, Y] = B(h.default), [y, $] = B(1), [N, U] = B(/* @__PURE__ */ new Set()), [F, b] = B(p.sortDescriptor ?? { column: "", direction: "ascending" });
697
+ ne(() => {
698
+ const g = Math.ceil(d.length / M);
699
+ y > g && $(1), U(/* @__PURE__ */ new Set());
700
+ }, [d]);
701
+ const D = !!pt(w, 500), pe = R((g) => {
702
+ U(g);
703
+ let x = [];
704
+ a === "single" ? x = d.find((E) => E[u] == [...g][0]) : g === "all" ? (x = d, U(new Set(d.map((E) => E[u])))) : x = d.filter((E) => [...g].includes(E[u])), r && r(x);
705
+ }, [r, d, a, u]), W = P(() => {
706
+ let g = [...d];
707
+ return D && (g = g.filter(
708
+ (x) => Object.values(x).some(
709
+ (E, S) => {
710
+ const H = Object.keys(x)[S];
711
+ return !l.map((j) => j.key).includes(H) || E == null || !E ? !1 : E.toString().toLowerCase().includes(w.toLowerCase());
712
+ }
713
+ )
714
+ )), g;
715
+ }, [w, D, d, l]), _ = Math.ceil(W.length / M) || 1, re = P(() => [...W].sort((g, x) => {
716
+ const E = g[F.column], S = x[F.column];
717
+ let H = 0;
718
+ if (!E && !S && (H = 0), E || (H = -1), S || (H = 1), typeof E == "number" && typeof S == "number" && (H = E - S), typeof E == "string" && typeof S == "string") {
719
+ const O = l.find((j) => j.key === F.column);
720
+ if (E && S && (O != null && O.dateFormat))
721
+ try {
722
+ const j = A(E, O.dateFormat), be = A(S, O.dateFormat);
723
+ H = j > be ? 1 : j < be ? -1 : 0;
724
+ } catch (j) {
725
+ console.warn("date format is not correct", j);
726
+ }
727
+ else
728
+ H = E.localeCompare(S);
729
+ }
730
+ return F.direction === "descending" ? -H : H;
731
+ }), [F, W, l]), Oe = P(() => {
732
+ if (t) return re;
733
+ const g = (y - 1) * M, x = g + M;
734
+ return re.slice(g, x);
735
+ }, [re, y, M, t]), Me = R(() => {
736
+ k(""), $(1);
737
+ }, []), ve = R(() => {
738
+ y < _ && $(y + 1);
739
+ }, [y, _]), Ee = R(() => {
740
+ y > 1 && $(y - 1);
741
+ }, [y]), we = R((g) => {
742
+ Y(Number(g.target.value)), $(1);
743
+ }, []), ye = R((g) => {
744
+ g ? (k(g), $(1)) : k("");
745
+ }, []), ze = R((g, x) => {
746
+ const E = l.find((S) => S.key === x);
747
+ return E.format ? /* @__PURE__ */ c.createElement("div", null, E.format({
748
+ value: g[x],
749
+ row: g
750
+ })) : /* @__PURE__ */ c.createElement("p", { title: g[x] }, g[x]);
751
+ }, [l]), Ge = P(() => /* @__PURE__ */ c.createElement("div", { className: "py-2 px-2 mt-2 flex justify-between items-center" }, /* @__PURE__ */ c.createElement("span", { className: "w-[30%] text-small text-default-400" }, [...N].length > 0 && /* @__PURE__ */ c.createElement(c.Fragment, null, [...N].length, " ", [...N].length === 1 ? "fila seleccionada" : "filas seleccionadas")), !t && /* @__PURE__ */ c.createElement(c.Fragment, null, /* @__PURE__ */ c.createElement(
752
+ Qe,
753
+ {
754
+ isCompact: !0,
755
+ showControls: !0,
756
+ showShadow: !0,
757
+ page: y,
758
+ total: _,
759
+ onChange: $,
760
+ color: p.color
761
+ }
762
+ ), /* @__PURE__ */ c.createElement("div", { className: "hidden sm:flex w-[30%] justify-end gap-2" }, /* @__PURE__ */ c.createElement(Q, { isDisabled: _ === 1, size: "sm", variant: "flat", onPress: Ee }, "Atrás"), /* @__PURE__ */ c.createElement(Q, { isDisabled: _ === 1, size: "sm", variant: "flat", onPress: ve }, "Siguiente")))), [y, _, ve, Ee, N, p.color, t]), qe = P(() => /* @__PURE__ */ c.createElement("div", { className: "flex flex-col gap-4 relative pb-2" }, /* @__PURE__ */ c.createElement("div", { className: "flex justify-between gap-3 items-end" }, !e && /* @__PURE__ */ c.createElement(
763
+ Ze,
764
+ {
765
+ ...s,
766
+ className: (s == null ? void 0 : s.className) ?? "w-full sm:max-w-[44%]",
767
+ placeholder: (s == null ? void 0 : s.placeholder) ?? "Buscar...",
768
+ startContent: /* @__PURE__ */ c.createElement(Bt, null),
769
+ value: w,
770
+ onClear: () => Me(),
771
+ onValueChange: ye,
772
+ isClearable: !0
773
+ }
774
+ ), o), /* @__PURE__ */ c.createElement("div", { className: "flex justify-between items-center" }, /* @__PURE__ */ c.createElement("span", { className: "text-default-400 text-small" }, "Total ", d.length, " ", f), !i && !t && /* @__PURE__ */ c.createElement("label", { className: "flex items-center text-default-400 text-small" }, "Filas por página:", /* @__PURE__ */ c.createElement(
775
+ "select",
776
+ {
777
+ className: "bg-transparent outline-none text-default-400 text-small",
778
+ onChange: we,
779
+ defaultValue: M
780
+ },
781
+ h.options.map(
782
+ (g) => /* @__PURE__ */ c.createElement("option", { key: g, value: g }, g)
783
+ )
784
+ )))), [
785
+ w,
786
+ d.length,
787
+ Me,
788
+ we,
789
+ s,
790
+ o,
791
+ ye,
792
+ M,
793
+ t,
794
+ e,
795
+ i,
796
+ h,
797
+ f
798
+ ]);
799
+ return /* @__PURE__ */ c.createElement(c.Fragment, null, n ? /* @__PURE__ */ c.createElement(gt, { columns: l, size: M }) : /* @__PURE__ */ c.createElement(c.Fragment, null, qe, /* @__PURE__ */ c.createElement(
800
+ ke,
801
+ {
802
+ ...p,
803
+ "aria-label": "Tabla de datos",
804
+ isVirtualized: t,
805
+ sortDescriptor: F,
806
+ onSortChange: b,
807
+ selectedKeys: N,
808
+ onSelectionChange: pe,
809
+ selectionMode: a
810
+ },
811
+ /* @__PURE__ */ c.createElement(Ne, { columns: l }, (g) => /* @__PURE__ */ c.createElement(Fe, { ...g, children: void 0, key: g.key })),
812
+ /* @__PURE__ */ c.createElement(Se, { emptyContent: "No hay datos.", items: Oe }, (g) => /* @__PURE__ */ c.createElement(Ie, { key: g[u] }, (x) => /* @__PURE__ */ c.createElement(Pe, { className: m }, ze(g, x))))
813
+ ), Ge));
814
+ }, Kt = ({ children: e, title: n, color: t = "primary" }) => /* @__PURE__ */ c.createElement(c.Fragment, null, /* @__PURE__ */ c.createElement("header", { className: `bg-${t} w-full text-center text-white py-5` }, /* @__PURE__ */ c.createElement("h1", { className: "font-bold text-lg" }, n)), /* @__PURE__ */ c.createElement(He, null), /* @__PURE__ */ c.createElement("main", { className: "p-5 2xl:px-16 2xl:py-5 mx-auto" }, e)), Ut = () => /* @__PURE__ */ c.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 24 24", strokeWidth: 1.5, stroke: "currentColor", className: "size-6" }, /* @__PURE__ */ c.createElement("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "m4.5 18.75 7.5-7.5 7.5 7.5" }), /* @__PURE__ */ c.createElement("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "m4.5 12.75 7.5-7.5 7.5 7.5" })), Wt = () => /* @__PURE__ */ c.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 24 24", strokeWidth: 1.5, stroke: "currentColor", className: "size-6" }, /* @__PURE__ */ c.createElement("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "m4.5 5.25 7.5 7.5 7.5-7.5m-15 6 7.5 7.5 7.5-7.5" })), en = ({ title: e, color: n = "default", children: t, collapse: r = !1 }) => {
815
+ const [a, s] = B(!0);
816
+ return /* @__PURE__ */ c.createElement(Xe, { className: "mb-5" }, /* @__PURE__ */ c.createElement(Ke, { className: `bg-${n} px-5 text-white flex justify-between` }, e, r && /* @__PURE__ */ c.createElement("div", { onClick: () => s(!a), className: "cursor-pointer" }, a ? /* @__PURE__ */ c.createElement(Ut, null) : /* @__PURE__ */ c.createElement(Wt, null))), /* @__PURE__ */ c.createElement(He, null), /* @__PURE__ */ c.createElement(et, { className: `p-5 ${a ? "" : "hidden"}` }, t));
817
+ }, tn = ({ name: e, rules: n, defaultValue: t = null, ...r }) => {
818
+ const { control: a } = I();
819
+ return /* @__PURE__ */ c.createElement(
820
+ C,
821
+ {
822
+ control: a,
823
+ name: e,
824
+ rules: n,
825
+ defaultValue: t,
826
+ render: ({ field: s, formState: { errors: i } }) => {
827
+ var o;
828
+ return /* @__PURE__ */ c.createElement(
829
+ oe,
830
+ {
831
+ ...r,
832
+ ...s,
833
+ value: s.value,
834
+ errorMessage: i[e] ? (o = i[e]) == null ? void 0 : o.message : "",
835
+ isInvalid: !!i[e]
836
+ }
837
+ );
838
+ }
839
+ }
840
+ );
841
+ }, nn = ({ startDate: e, endDate: n }) => {
842
+ const { control: t, trigger: r, getValues: a, formState: s } = I(), i = P(() => e.name, [e.name]), o = P(() => n.name, [n.name]), m = X({ control: t, name: [i] }), d = X({ control: t, name: [o] });
843
+ return ne(() => {
844
+ if (!s.isSubmitted) return;
845
+ const l = a();
846
+ l[i] && l[o] && (r([i]), r([o]));
847
+ }, [d, m, r, a, s.isSubmitted, o, i]), /* @__PURE__ */ c.createElement(c.Fragment, null, /* @__PURE__ */ c.createElement(
848
+ C,
849
+ {
850
+ control: t,
851
+ name: i,
852
+ rules: e.rules,
853
+ defaultValue: e.defaultValue ?? null,
854
+ render: ({ field: l, formState: { errors: u } }) => {
855
+ var f;
856
+ return /* @__PURE__ */ c.createElement(
857
+ oe,
858
+ {
859
+ ...e,
860
+ ...l,
861
+ value: l.value,
862
+ errorMessage: u[i] ? (f = u[i]) == null ? void 0 : f.message : "",
863
+ isInvalid: !!u[i]
864
+ }
865
+ );
866
+ }
867
+ }
868
+ ), /* @__PURE__ */ c.createElement(
869
+ C,
870
+ {
871
+ control: t,
872
+ name: o,
873
+ rules: n.rules,
874
+ defaultValue: n.defaultValue ?? null,
875
+ render: ({ field: l, formState: { errors: u } }) => {
876
+ var f;
877
+ return /* @__PURE__ */ c.createElement(
878
+ oe,
879
+ {
880
+ ...n,
881
+ ...l,
882
+ value: l.value,
883
+ errorMessage: u[o] ? (f = u[o]) == null ? void 0 : f.message : "",
884
+ isInvalid: !!u[o]
885
+ }
886
+ );
887
+ }
888
+ }
889
+ ));
890
+ }, rn = ({ defaultValue: e = "", rules: n, name: t, classNames: r, ...a }) => {
891
+ const { control: s } = I();
892
+ return /* @__PURE__ */ c.createElement(
893
+ C,
894
+ {
895
+ control: s,
896
+ defaultValue: e,
897
+ name: t,
898
+ rules: n,
899
+ render: ({ field: i, formState: { errors: o } }) => {
900
+ var m;
901
+ return /* @__PURE__ */ c.createElement(
902
+ Ze,
903
+ {
904
+ ...a,
905
+ ...i,
906
+ isInvalid: !!o[t],
907
+ errorMessage: o[t] ? (m = o[t]) == null ? void 0 : m.message : "",
908
+ classNames: {
909
+ ...r,
910
+ input: `${(r == null ? void 0 : r.input) || ""} ${o[t] ? "placeholder:text-danger" : ""}`
911
+ }
912
+ }
913
+ );
914
+ }
915
+ }
916
+ );
917
+ }, an = ({ defaultValue: e = "", rules: n, name: t, classNames: r, ...a }) => {
918
+ const { control: s } = I();
919
+ return /* @__PURE__ */ c.createElement(
920
+ C,
921
+ {
922
+ control: s,
923
+ defaultValue: e,
924
+ name: t,
925
+ rules: n,
926
+ render: ({ field: i, formState: { errors: o } }) => {
927
+ var m;
928
+ return /* @__PURE__ */ c.createElement(
929
+ tt,
930
+ {
931
+ ...a,
932
+ ...i,
933
+ isInvalid: !!o[t],
934
+ errorMessage: o[t] ? (m = o[t]) == null ? void 0 : m.message : "",
935
+ classNames: {
936
+ ...r,
937
+ input: `${(r == null ? void 0 : r.input) || ""} ${o[t] ? "placeholder:text-danger" : ""}`
938
+ }
939
+ }
940
+ );
941
+ }
942
+ }
943
+ );
944
+ }, sn = ({ name: e, data: n, rules: t, defaultSelectedKeys: r, disabledKeys: a, renderValue: s, allOptions: i, allSelectText: o, onSelectionChange: m, selectionMode: d, ...l }) => {
945
+ const { control: u, setValue: f } = I(), h = P(() => d === "multiple", [d]), p = P(
946
+ () => i && h ? [
947
+ {
948
+ key: "all",
949
+ children: i.children,
950
+ textValue: i.textValue
951
+ },
952
+ ...n
953
+ ] : n,
954
+ [n, i, h]
955
+ ), w = R((M) => {
956
+ setTimeout(() => {
957
+ const Y = new Set(M), y = new Set(a), $ = Y.has("all");
958
+ let N = M;
959
+ if ($ && h)
960
+ if (Y.size - 1 === n.length)
961
+ f(e, ""), N = /* @__PURE__ */ new Set();
962
+ else {
963
+ const F = n.filter((b) => !y.has(b.key)).map((b) => b.key);
964
+ f(e, F.toString()), N = new Set(F);
965
+ }
966
+ m == null || m(N);
967
+ }, 250);
968
+ }, [n, e, m, f, a, h]), k = R((M) => /* @__PURE__ */ c.createElement("span", null, M.length >= n.length ? o ?? "Todas las opciones" : M.filter((Y) => Y.key !== "all").map((Y) => Y.textValue).join(", ")), [o, n]);
969
+ return /* @__PURE__ */ c.createElement(
970
+ C,
971
+ {
972
+ control: u,
973
+ rules: t,
974
+ name: e,
975
+ defaultValue: (r == null ? void 0 : r.toString()) ?? void 0,
976
+ render: ({ field: M, formState: { errors: Y } }) => {
977
+ var y;
978
+ return /* @__PURE__ */ c.createElement(
979
+ nt,
980
+ {
981
+ ...l,
982
+ ...M,
983
+ items: p,
984
+ selectedKeys: M.value ? M.value.split(",") : [],
985
+ errorMessage: ((y = Y[e]) == null ? void 0 : y.message) || "",
986
+ selectionMode: d,
987
+ onSelectionChange: ($) => w($),
988
+ isInvalid: !!Y[e],
989
+ renderValue: s ?? h ? k : void 0,
990
+ disabledKeys: a
991
+ },
992
+ ($) => /* @__PURE__ */ c.createElement(rt, { ...$, key: $.key })
993
+ );
994
+ }
995
+ }
996
+ );
997
+ }, on = ({ name: e, rules: n, defaultValue: t, ...r }) => {
998
+ const { control: a } = I();
999
+ return /* @__PURE__ */ c.createElement(
1000
+ C,
1001
+ {
1002
+ control: a,
1003
+ name: e,
1004
+ rules: n,
1005
+ defaultValue: t ?? null,
1006
+ render: ({ field: s, formState: { errors: i } }) => {
1007
+ var o;
1008
+ return /* @__PURE__ */ c.createElement(
1009
+ le,
1010
+ {
1011
+ ...r,
1012
+ ...s,
1013
+ value: s.value,
1014
+ isInvalid: !!i[e],
1015
+ errorMessage: i[e] ? (o = i[e]) == null ? void 0 : o.message : ""
1016
+ }
1017
+ );
1018
+ }
1019
+ }
1020
+ );
1021
+ }, ln = ({ startTime: e, endTime: n }) => {
1022
+ const { control: t, trigger: r, getValues: a, formState: s } = I(), i = P(() => e.name, [e.name]), o = P(() => n.name, [n.name]), m = X({ control: t, name: [i] }), d = X({ control: t, name: [o] });
1023
+ return ne(() => {
1024
+ if (!s.isSubmitted) return;
1025
+ const l = a();
1026
+ l[i] && l[o] && (r([i]), r([o]));
1027
+ }, [d, m, r, a, s.isSubmitted, o, i]), /* @__PURE__ */ c.createElement(c.Fragment, null, /* @__PURE__ */ c.createElement(
1028
+ C,
1029
+ {
1030
+ control: t,
1031
+ name: i,
1032
+ rules: e.rules,
1033
+ defaultValue: e.defaultValue ?? null,
1034
+ render: ({ field: l, formState: { errors: u } }) => {
1035
+ var f;
1036
+ return /* @__PURE__ */ c.createElement(
1037
+ le,
1038
+ {
1039
+ ...e,
1040
+ ...l,
1041
+ value: l.value,
1042
+ isInvalid: !!u[i],
1043
+ errorMessage: u[i] ? (f = u[i]) == null ? void 0 : f.message : ""
1044
+ }
1045
+ );
1046
+ }
1047
+ }
1048
+ ), /* @__PURE__ */ c.createElement(
1049
+ C,
1050
+ {
1051
+ control: t,
1052
+ name: o,
1053
+ rules: n.rules,
1054
+ defaultValue: n.defaultValue ?? null,
1055
+ render: ({ field: l, formState: { errors: u } }) => {
1056
+ var f;
1057
+ return /* @__PURE__ */ c.createElement(
1058
+ le,
1059
+ {
1060
+ ...n,
1061
+ ...l,
1062
+ value: l.value,
1063
+ isInvalid: !!u[o],
1064
+ errorMessage: u[o] ? (f = u[o]) == null ? void 0 : f.message : ""
1065
+ }
1066
+ );
1067
+ }
1068
+ }
1069
+ ));
1070
+ }, cn = ({ defaultValue: e = "", rules: n, name: t, classNames: r, ...a }) => {
1071
+ const { control: s } = I();
1072
+ return /* @__PURE__ */ c.createElement(
1073
+ C,
1074
+ {
1075
+ control: s,
1076
+ defaultValue: e,
1077
+ name: t,
1078
+ rules: n,
1079
+ render: ({ field: i, formState: { errors: o } }) => {
1080
+ var m;
1081
+ return /* @__PURE__ */ c.createElement(
1082
+ at,
1083
+ {
1084
+ ...a,
1085
+ ...i,
1086
+ isInvalid: !!o[t],
1087
+ errorMessage: o[t] ? (m = o[t]) == null ? void 0 : m.message : "",
1088
+ classNames: {
1089
+ ...r,
1090
+ input: `${(r == null ? void 0 : r.input) || ""} ${o[t] ? "placeholder:text-danger" : ""}`
1091
+ }
1092
+ }
1093
+ );
1094
+ }
1095
+ }
1096
+ );
1097
+ }, un = ({ onSelectionChange: e, defaultSelectedKey: n, name: t, data: r, rules: a, ...s }) => {
1098
+ const { control: i } = I(), o = (m) => {
1099
+ e && e(m);
1100
+ };
1101
+ return /* @__PURE__ */ c.createElement(
1102
+ C,
1103
+ {
1104
+ control: i,
1105
+ defaultValue: n,
1106
+ name: t,
1107
+ rules: a,
1108
+ render: ({ field: m, formState: { errors: d } }) => {
1109
+ var l;
1110
+ return /* @__PURE__ */ c.createElement(
1111
+ st,
1112
+ {
1113
+ ...s,
1114
+ ...m,
1115
+ selectedKey: m.value ?? "",
1116
+ defaultItems: r,
1117
+ onSelectionChange: (u) => {
1118
+ m.onChange(u), o(u);
1119
+ },
1120
+ isInvalid: !!d[t],
1121
+ errorMessage: d[t] ? (l = d[t]) == null ? void 0 : l.message : "",
1122
+ inputProps: {
1123
+ classNames: {
1124
+ input: d[t] ? "placeholder:text-danger" : ""
1125
+ }
1126
+ }
1127
+ },
1128
+ r.map((u) => /* @__PURE__ */ c.createElement(ot, { ...u, key: u.key }))
1129
+ );
1130
+ }
1131
+ }
1132
+ );
1133
+ }, mn = ({ data: e, rules: n, name: t, defaultValue: r, ...a }) => {
1134
+ const { control: s } = I();
1135
+ return /* @__PURE__ */ c.createElement(
1136
+ C,
1137
+ {
1138
+ control: s,
1139
+ rules: n,
1140
+ name: t,
1141
+ defaultValue: r ?? "",
1142
+ render: ({ field: i, formState: { errors: o } }) => {
1143
+ var m;
1144
+ return /* @__PURE__ */ c.createElement(
1145
+ lt,
1146
+ {
1147
+ ...i,
1148
+ ...a,
1149
+ isInvalid: !!o[t],
1150
+ errorMessage: o[t] ? (m = o[t]) == null ? void 0 : m.message : ""
1151
+ },
1152
+ e.map((d, l) => /* @__PURE__ */ c.createElement(it, { ...d, key: l }))
1153
+ );
1154
+ }
1155
+ }
1156
+ );
1157
+ }, dn = ({ rules: e, name: n, ...t }) => {
1158
+ const { control: r } = I();
1159
+ return /* @__PURE__ */ c.createElement(
1160
+ C,
1161
+ {
1162
+ control: r,
1163
+ rules: e,
1164
+ name: n,
1165
+ render: ({ field: a, formState: { errors: s } }) => /* @__PURE__ */ c.createElement(
1166
+ Re,
1167
+ {
1168
+ ...a,
1169
+ ...t,
1170
+ isSelected: !!a.value,
1171
+ isInvalid: !!s[n]
1172
+ },
1173
+ t.children
1174
+ )
1175
+ }
1176
+ );
1177
+ }, fn = ({ defaultValue: e, rules: n, name: t, data: r, ...a }) => {
1178
+ const { control: s } = I();
1179
+ return /* @__PURE__ */ c.createElement(
1180
+ C,
1181
+ {
1182
+ control: s,
1183
+ rules: n,
1184
+ name: t,
1185
+ defaultValue: e ?? [],
1186
+ render: ({ field: i, formState: { errors: o } }) => {
1187
+ var m;
1188
+ return /* @__PURE__ */ c.createElement(
1189
+ ct,
1190
+ {
1191
+ ...i,
1192
+ ...a,
1193
+ isInvalid: !!o[t]
1194
+ },
1195
+ r.map((d) => /* @__PURE__ */ c.createElement(Re, { ...d, key: d.value }, d.children)),
1196
+ !!o[t] && /* @__PURE__ */ c.createElement("div", { "data-slot": "error-message", className: "text-tiny text-danger w-full" }, o[t] ? (m = o[t]) == null ? void 0 : m.message : "")
1197
+ );
1198
+ }
1199
+ }
1200
+ );
1201
+ };
1202
+ function hn({
1203
+ display: e = !1,
1204
+ onClose: n,
1205
+ children: t,
1206
+ title: r = "",
1207
+ cancelButton: a,
1208
+ acceptButton: s,
1209
+ ...i
1210
+ }) {
1211
+ return /* @__PURE__ */ c.createElement(ut, { isOpen: e, onOpenChange: n, ...i }, /* @__PURE__ */ c.createElement(mt, null, /* @__PURE__ */ c.createElement(dt, { className: "flex flex-col gap-1" }, r), /* @__PURE__ */ c.createElement(ft, null, t), /* @__PURE__ */ c.createElement(ht, null, a && /* @__PURE__ */ c.createElement(Q, { ...a, onPress: n }), s && /* @__PURE__ */ c.createElement(Q, { ...s }))));
1212
+ }
1213
+ const Ce = ({ value: e, context: n, name: t, range: r, rangeDate: a, type: s }) => {
1214
+ const i = n.parent[t];
1215
+ if (!i || !e || !r || r === 0 || !a) return !0;
1216
+ const o = A(s == "min" ? i.toString() : e.toString()), m = A(s == "max" ? i.toString() : e.toString());
1217
+ let d;
1218
+ switch (a) {
1219
+ case "days":
1220
+ d = Lt(o, m);
1221
+ break;
1222
+ case "months":
1223
+ d = ge(o, m);
1224
+ break;
1225
+ case "years":
1226
+ d = At(o, m);
1227
+ break;
1228
+ default:
1229
+ d = 0;
1230
+ break;
1231
+ }
1232
+ return d < r;
1233
+ }, ee = ({ context: e, name: n, type: t, value: r }) => {
1234
+ const a = e.parent[n];
1235
+ if (!a || !r) return !0;
1236
+ const s = r.compare(a);
1237
+ return t == "max" ? s >= 0 : s <= 0;
1238
+ }, G = ({ value: e, date: n, type: t }) => {
1239
+ if (!e || !n) return !0;
1240
+ let r, a;
1241
+ try {
1242
+ r = A(n), a = A(e.toString());
1243
+ } catch {
1244
+ return !1;
1245
+ }
1246
+ if (Rt(a, r)) return !0;
1247
+ const s = Ht(a, r);
1248
+ return t === "min" ? s : !s;
1249
+ }, Ye = ({ value: e, context: n, name: t, range: r, rangeDate: a, type: s }) => {
1250
+ const i = n.parent[t];
1251
+ if (!i || !e || !r || r === 0 || !a) return !0;
1252
+ const o = e.toString(), m = i.toString(), d = A(s == "max" ? m : o, "HH:mm:ss"), l = A(s == "min" ? m : o, "HH:mm:ss");
1253
+ let u = 0;
1254
+ return a === "hours" ? u = jt(l, d) : u = Vt(l, d), u < r;
1255
+ }, te = (e, n) => {
1256
+ switch (e) {
1257
+ case "days":
1258
+ return n === 1 ? "El rango es de 1 dia" : `El rango es de ${n} dias`;
1259
+ case "months":
1260
+ return n === 1 ? "El rango es de 1 mes" : `El rango es de ${n} meses`;
1261
+ case "years":
1262
+ return n === 1 ? "El rango es de 1 año" : `El rango es de ${n} años`;
1263
+ case "hours":
1264
+ return n === 1 ? "El rango es de 1 hora" : `El rango es de ${n} horas`;
1265
+ case "minutes":
1266
+ return n === 1 ? "El rango es de 1 minuto" : `El rango es de ${n} minutos`;
1267
+ default:
1268
+ return "Custom Test";
1269
+ }
1270
+ }, _t = ({
1271
+ endDate: e,
1272
+ startDate: n,
1273
+ range: t = 0,
1274
+ type: r,
1275
+ maxEndDate: a,
1276
+ maxStartDate: s,
1277
+ minEndDate: i,
1278
+ minStartDate: o
1279
+ }) => {
1280
+ const m = J().test(
1281
+ "Menor",
1282
+ "Este campo debe ser menor a la fecha final",
1283
+ (l, u) => ee({ value: l, context: u, name: e, type: "min" })
1284
+ ).when([], {
1285
+ is: t && t > 0 && r,
1286
+ then: (l) => l.test(
1287
+ "Rango de tiempo",
1288
+ te(r, t),
1289
+ (u, f) => Ce({
1290
+ context: f,
1291
+ value: u,
1292
+ range: t,
1293
+ name: e,
1294
+ rangeDate: r,
1295
+ type: "min"
1296
+ })
1297
+ )
1298
+ }).when([], {
1299
+ is: s,
1300
+ then: (l) => l.test(
1301
+ "Max Date",
1302
+ `Fecha maxima ${Z(s, "DD/MM/YYYY")}`,
1303
+ (u) => G({ value: u, date: s, type: "max" })
1304
+ )
1305
+ }).when([], {
1306
+ is: o,
1307
+ then: (l) => l.test(
1308
+ "Min Date",
1309
+ `Fecha minima ${Z(o, "DD/MM/YYYY")}`,
1310
+ (u) => G({ value: u, date: o, type: "min" })
1311
+ )
1312
+ }), d = J().test(
1313
+ "Mayor",
1314
+ "Este campo debe ser mayor a la fecha inicial",
1315
+ (l, u) => ee({ value: l, context: u, name: n, type: "max" })
1316
+ ).when([], {
1317
+ is: t && t > 0 && r,
1318
+ then: (l) => l.test(
1319
+ "Rango de tiempo",
1320
+ te(r, t),
1321
+ (u, f) => Ce({
1322
+ context: f,
1323
+ value: u,
1324
+ range: t,
1325
+ name: n,
1326
+ rangeDate: r,
1327
+ type: "max"
1328
+ })
1329
+ )
1330
+ }).when([], {
1331
+ is: a,
1332
+ then: (l) => l.test(
1333
+ "Max Date",
1334
+ `Fecha maxima ${Z(a, "DD/MM/YYYY")}`,
1335
+ (u) => G({ value: u, date: a, type: "max" })
1336
+ )
1337
+ }).when([], {
1338
+ is: i,
1339
+ then: (l) => l.test(
1340
+ "Min Date",
1341
+ `Fecha minima ${Z(i, "DD/MM/YYYY")}`,
1342
+ (u) => G({ value: u, date: i, type: "min" })
1343
+ )
1344
+ });
1345
+ return { startDateRule: m, endDateRule: d };
1346
+ }, Ot = ({ minDate: e, maxDate: n }) => J().test(
1347
+ "Min Date",
1348
+ `Fecha minima ${Z(e, "DD/MM/YYYY")}`,
1349
+ (t) => G({ value: t, date: e, type: "min" })
1350
+ ).test(
1351
+ "Max Date",
1352
+ `Fecha maxima ${Z(n, "DD/MM/YYYY")}`,
1353
+ (t) => G({ value: t, date: n, type: "max" })
1354
+ ), zt = ({ endTime: e, startTime: n, range: t = 0, type: r }) => {
1355
+ const a = J().test(
1356
+ "Menor",
1357
+ "Este campo debe ser menor a la hora final",
1358
+ (i, o) => ee({ value: i, context: o, name: e, type: "min" })
1359
+ ).when([], {
1360
+ is: t && t > 0 && r,
1361
+ then: (i) => i.test(
1362
+ "Rango de tiempo",
1363
+ te(r, t),
1364
+ (o, m) => Ye({
1365
+ value: o,
1366
+ context: m,
1367
+ name: e,
1368
+ type: "min",
1369
+ range: t,
1370
+ rangeDate: r
1371
+ })
1372
+ )
1373
+ }), s = J().test(
1374
+ "Mayor",
1375
+ "Este campo debe ser mayor a la hora inicial",
1376
+ (i, o) => ee({ value: i, context: o, name: n, type: "max" })
1377
+ ).when([], {
1378
+ is: t && t > 0 && r,
1379
+ then: (i) => i.test(
1380
+ "Rango de tiempo",
1381
+ te(r, t),
1382
+ (o, m) => Ye({
1383
+ value: o,
1384
+ context: m,
1385
+ name: n,
1386
+ type: "max",
1387
+ range: t,
1388
+ rangeDate: r
1389
+ })
1390
+ )
1391
+ });
1392
+ return { startTimeRule: a, endTimeRule: s };
1393
+ }, gn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1394
+ __proto__: null,
1395
+ dateMinMaxValidate: Ot,
1396
+ dualDateValidate: _t,
1397
+ dualTimeValidate: zt
1398
+ }, Symbol.toStringTag, { value: "Module" }));
1399
+ export {
1400
+ Xt as DataTable,
1401
+ Kt as Layout,
1402
+ hn as Modal,
1403
+ en as Panel,
1404
+ un as RHFAutocomplete,
1405
+ dn as RHFCheckbox,
1406
+ fn as RHFCheckboxGroup,
1407
+ tn as RHFDate,
1408
+ nn as RHFDualDate,
1409
+ ln as RHFDualTime,
1410
+ rn as RHFInput,
1411
+ an as RHFInputOtp,
1412
+ mn as RHFRadioGroup,
1413
+ sn as RHFSelect,
1414
+ cn as RHFTextArea,
1415
+ on as RHFTime,
1416
+ gn as validation
1417
+ };