bonsaif-ui 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (64) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/README.md +59 -0
  3. package/dist/bonsaif-ui.js +3331 -0
  4. package/dist/bonsaif-ui.umd.cjs +1 -0
  5. package/dist/components/BonsaifButton/BonsaifButton.d.ts +7 -0
  6. package/dist/components/BonsaifButton/BonsaifButton.d.ts.map +1 -0
  7. package/dist/components/BonsaifButton/index.d.ts +3 -0
  8. package/dist/components/BonsaifButton/index.d.ts.map +1 -0
  9. package/dist/components/index.d.ts +16 -0
  10. package/dist/components/index.d.ts.map +1 -0
  11. package/dist/components/layout/AuthShell.d.ts +33 -0
  12. package/dist/components/layout/AuthShell.d.ts.map +1 -0
  13. package/dist/components/layout/GlobalScrollbars.d.ts +2 -0
  14. package/dist/components/layout/GlobalScrollbars.d.ts.map +1 -0
  15. package/dist/components/layout/PageHeader.d.ts +29 -0
  16. package/dist/components/layout/PageHeader.d.ts.map +1 -0
  17. package/dist/components/layout/PageSearchInput.d.ts +9 -0
  18. package/dist/components/layout/PageSearchInput.d.ts.map +1 -0
  19. package/dist/components/layout/PrimeAuthRouteShell.d.ts +9 -0
  20. package/dist/components/layout/PrimeAuthRouteShell.d.ts.map +1 -0
  21. package/dist/components/messaging/PrimeSuiteChatFrame.d.ts +2 -0
  22. package/dist/components/messaging/PrimeSuiteChatFrame.d.ts.map +1 -0
  23. package/dist/components/microservices/MicroserviceFrame.d.ts +8 -0
  24. package/dist/components/microservices/MicroserviceFrame.d.ts.map +1 -0
  25. package/dist/components/notifications/PrimeAuthToaster.d.ts +2 -0
  26. package/dist/components/notifications/PrimeAuthToaster.d.ts.map +1 -0
  27. package/dist/components/ui/Button.d.ts +15 -0
  28. package/dist/components/ui/Button.d.ts.map +1 -0
  29. package/dist/components/ui/CalendarPicker.d.ts +9 -0
  30. package/dist/components/ui/CalendarPicker.d.ts.map +1 -0
  31. package/dist/components/ui/CompactFilters.d.ts +27 -0
  32. package/dist/components/ui/CompactFilters.d.ts.map +1 -0
  33. package/dist/components/ui/ConfirmDialog.d.ts +12 -0
  34. package/dist/components/ui/ConfirmDialog.d.ts.map +1 -0
  35. package/dist/components/ui/DataTable.d.ts +87 -0
  36. package/dist/components/ui/DataTable.d.ts.map +1 -0
  37. package/dist/components/ui/DateRangePicker.d.ts +17 -0
  38. package/dist/components/ui/DateRangePicker.d.ts.map +1 -0
  39. package/dist/components/ui/Drawer.d.ts +26 -0
  40. package/dist/components/ui/Drawer.d.ts.map +1 -0
  41. package/dist/components/ui/InputField.d.ts +13 -0
  42. package/dist/components/ui/InputField.d.ts.map +1 -0
  43. package/dist/components/ui/LoadingState.d.ts +11 -0
  44. package/dist/components/ui/LoadingState.d.ts.map +1 -0
  45. package/dist/components/ui/Modal.d.ts +29 -0
  46. package/dist/components/ui/Modal.d.ts.map +1 -0
  47. package/dist/components/ui/MouseTooltip.d.ts +12 -0
  48. package/dist/components/ui/MouseTooltip.d.ts.map +1 -0
  49. package/dist/components/ui/SearchableSelect.d.ts +25 -0
  50. package/dist/components/ui/SearchableSelect.d.ts.map +1 -0
  51. package/dist/components/ui/TextInput.d.ts +5 -0
  52. package/dist/components/ui/TextInput.d.ts.map +1 -0
  53. package/dist/components/ui/Toggle.d.ts +9 -0
  54. package/dist/components/ui/Toggle.d.ts.map +1 -0
  55. package/dist/components/ui/index.d.ts +18 -0
  56. package/dist/components/ui/index.d.ts.map +1 -0
  57. package/dist/components/users/UserAvatar.d.ts +12 -0
  58. package/dist/components/users/UserAvatar.d.ts.map +1 -0
  59. package/dist/index.d.ts +5 -0
  60. package/dist/index.d.ts.map +1 -0
  61. package/dist/lib/cn.d.ts +2 -0
  62. package/dist/lib/cn.d.ts.map +1 -0
  63. package/dist/styles.css +9 -0
  64. package/package.json +82 -0
@@ -0,0 +1,3331 @@
1
+ import { jsx as e, jsxs as s, Fragment as le } from "react/jsx-runtime";
2
+ import Xe, { useState as E, useRef as J, useEffect as R, useCallback as Ve, useLayoutEffect as Dt, useMemo as Je, useSyncExternalStore as At } from "react";
3
+ import { HiChevronLeft as Se, HiChevronDown as ge, HiChevronRight as xe, HiCalendarDays as Ie, HiMagnifyingGlass as We, HiXMark as ce, HiExclamationTriangle as zt, HiChevronUp as Ot, HiChevronUpDown as It, HiEyeSlash as Ht, HiEye as Wt, HiBars3 as Pt, HiHome as Ce, HiArrowRightOnRectangle as _t, HiShieldCheck as De, HiInbox as Ft, HiListBullet as Ze, HiBriefcase as jt, HiCog6Tooth as Ke, HiUsers as Qe, HiDocumentText as Ut, HiBell as Yt, HiUser as qt, HiClipboardDocumentList as Gt, HiBuildingOffice2 as Xt, HiRectangleGroup as Vt, HiTicket as Jt, HiChartBar as Zt } from "react-icons/hi2";
4
+ import { OverlayScrollbars as et } from "overlayscrollbars";
5
+ import { createPortal as Ee } from "react-dom";
6
+ import { MdDragIndicator as Kt } from "react-icons/md";
7
+ import { OverlayScrollbarsComponent as tt } from "overlayscrollbars-react";
8
+ import { DayPicker as Qt, useDayPicker as er } from "react-day-picker";
9
+ import "react-day-picker/dist/style.css";
10
+ import { FiSave as tr } from "react-icons/fi";
11
+ import { Toaster as rr } from "sonner";
12
+ function nr(...t) {
13
+ return t.filter(Boolean).join(" ");
14
+ }
15
+ function Qr({
16
+ variant: t = "primary",
17
+ className: r,
18
+ type: n = "button",
19
+ children: a,
20
+ ...l
21
+ }) {
22
+ return /* @__PURE__ */ e(
23
+ "button",
24
+ {
25
+ className: nr("bonsaif-ui-button", `bonsaif-ui-button--${t}`, r),
26
+ type: n,
27
+ ...l,
28
+ children: a
29
+ }
30
+ );
31
+ }
32
+ function rt(t) {
33
+ if (t !== void 0)
34
+ return typeof t == "number" ? `${t}px` : t;
35
+ }
36
+ const ar = "inline-flex shrink-0 items-center justify-center gap-2 whitespace-nowrap leading-none font-medium transition-all duration-150 focus:outline-none disabled:opacity-50 rounded-lg", or = {
37
+ primary: "border border-[var(--border)] text-[var(--text-main)] hover:border-[var(--border)] hover:bg-[var(--bg-input)] active:scale-[0.98] transition-colors",
38
+ secondary: "border border-[var(--border)] text-[var(--text-main)] hover:border-[var(--border)] hover:bg-[var(--bg-input)] active:scale-[0.98] transition-colors",
39
+ danger: "border border-[var(--border)] text-[var(--danger)] hover:border-[var(--danger)] hover:bg-[var(--danger-bg)] active:scale-[0.98] transition-colors",
40
+ ghost: "text-[var(--text-secondary)] hover:opacity-70",
41
+ icon: "h-9 w-9 text-[var(--text-muted)] hover:text-[var(--primary)] hover:bg-primary/5"
42
+ }, ir = {
43
+ sm: "h-9 px-3.5 text-xs",
44
+ md: "h-11 px-4 text-sm",
45
+ lg: "h-12 px-5 text-sm font-semibold"
46
+ }, sr = {
47
+ primary: { background: "var(--bg-card)" },
48
+ secondary: { background: "var(--bg-card)" },
49
+ danger: { background: "var(--bg-card)" },
50
+ ghost: {},
51
+ icon: {}
52
+ };
53
+ function ne({
54
+ variant: t = "primary",
55
+ size: r = "md",
56
+ loading: n = !1,
57
+ icon: a,
58
+ height: l,
59
+ padding: u,
60
+ children: m,
61
+ className: p = "",
62
+ disabled: c,
63
+ style: d,
64
+ ...y
65
+ }) {
66
+ const C = t === "icon";
67
+ return /* @__PURE__ */ s(
68
+ "button",
69
+ {
70
+ ...y,
71
+ "data-variant": t,
72
+ "data-size": r,
73
+ "data-icon": C ? "true" : void 0,
74
+ disabled: c || n,
75
+ className: `${ar} ${or[t]} ${C ? "" : ir[r]} ${p}`,
76
+ style: {
77
+ ...sr[t],
78
+ height: rt(l),
79
+ padding: rt(u),
80
+ ...d
81
+ },
82
+ children: [
83
+ n ? /* @__PURE__ */ e("span", { className: "h-3.5 w-3.5 animate-spin rounded-full border-2 border-current border-t-transparent" }) : a,
84
+ m
85
+ ]
86
+ }
87
+ );
88
+ }
89
+ const pt = [
90
+ "Enero",
91
+ "Febrero",
92
+ "Marzo",
93
+ "Abril",
94
+ "Mayo",
95
+ "Junio",
96
+ "Julio",
97
+ "Agosto",
98
+ "Septiembre",
99
+ "Octubre",
100
+ "Noviembre",
101
+ "Diciembre"
102
+ ], lr = [
103
+ "Ene",
104
+ "Feb",
105
+ "Mar",
106
+ "Abr",
107
+ "May",
108
+ "Jun",
109
+ "Jul",
110
+ "Ago",
111
+ "Sep",
112
+ "Oct",
113
+ "Nov",
114
+ "Dic"
115
+ ], cr = ["Do", "Lu", "Ma", "Mi", "Ju", "Vi", "Sá"], Ae = 6;
116
+ function He(t, r, n) {
117
+ return `${t}-${String(r).padStart(2, "0")}-${String(n).padStart(2, "0")}`;
118
+ }
119
+ function dr() {
120
+ const t = /* @__PURE__ */ new Date();
121
+ return He(t.getFullYear(), t.getMonth() + 1, t.getDate());
122
+ }
123
+ function ht(t) {
124
+ const [r, n, a] = t.split("-").map(Number);
125
+ return { year: r, month: n, day: a };
126
+ }
127
+ function ur(t) {
128
+ if (!t) return "Seleccionar fecha";
129
+ const { year: r, month: n, day: a } = ht(t);
130
+ return !r || !n || !a ? "Seleccionar fecha" : `${String(a).padStart(2, "0")} ${pt[n - 1]} ${r}`;
131
+ }
132
+ function en({
133
+ value: t,
134
+ onChange: r,
135
+ minDate: n,
136
+ displayMode: a = "inline"
137
+ }) {
138
+ const l = dr(), m = ht(t || l), p = a === "popover", [c, d] = E(!1), y = J(null), [C, w] = E({
139
+ horizontal: "left",
140
+ vertical: "bottom"
141
+ }), [f, g] = E(m.year), [b, N] = E(m.month), [L, X] = E("days"), Y = 16, [k, M] = E(0), $ = f - 7 + k, B = Array.from({ length: Y }, (o, x) => $ + x);
142
+ R(() => {
143
+ if (!p || !c || !y.current) return;
144
+ const o = y.current.getBoundingClientRect(), x = 8, z = 280, j = 340, P = o.left + z > window.innerWidth - x, Z = o.right - z >= x, ee = o.bottom + 8 + j > window.innerHeight - x, ae = o.top - 8 - j >= x;
145
+ w({
146
+ horizontal: P && Z ? "right" : "left",
147
+ vertical: ee && ae ? "top" : "bottom"
148
+ });
149
+ }, [p, c]), R(() => {
150
+ if (!p || !c) return;
151
+ function o(z) {
152
+ y.current && (y.current.contains(z.target) || d(!1));
153
+ }
154
+ function x(z) {
155
+ z.key === "Escape" && d(!1);
156
+ }
157
+ return document.addEventListener("mousedown", o), document.addEventListener("keydown", x), () => {
158
+ document.removeEventListener("mousedown", o), document.removeEventListener("keydown", x);
159
+ };
160
+ }, [p, c]);
161
+ function W() {
162
+ b === 1 ? (g((o) => o - 1), N(12)) : N((o) => o - 1);
163
+ }
164
+ function I() {
165
+ b === 12 ? (g((o) => o + 1), N(1)) : N((o) => o + 1);
166
+ }
167
+ const T = new Date(f, b - 1, 1).getDay(), A = new Date(f, b, 0).getDate(), q = [
168
+ ...Array(T).fill(null),
169
+ ...Array.from({ length: A }, (o, x) => x + 1)
170
+ ];
171
+ for (; q.length < Ae * 7; ) q.push(null);
172
+ const O = q.slice(0, Ae * 7);
173
+ function G(o) {
174
+ const x = He(f, b, o);
175
+ n && x < n || (r(x), p && d(!1));
176
+ }
177
+ const F = {
178
+ background: "none",
179
+ border: "none",
180
+ cursor: "pointer",
181
+ color: "var(--text-muted)",
182
+ padding: 4,
183
+ borderRadius: 6,
184
+ display: "flex",
185
+ alignItems: "center"
186
+ }, U = /* @__PURE__ */ s(
187
+ "div",
188
+ {
189
+ style: {
190
+ background: "var(--bg-input)",
191
+ border: "1px solid var(--border)",
192
+ borderRadius: 10,
193
+ overflow: "hidden",
194
+ userSelect: "none",
195
+ width: 280
196
+ },
197
+ children: [
198
+ /* @__PURE__ */ e(
199
+ "div",
200
+ {
201
+ style: {
202
+ display: "flex",
203
+ alignItems: "center",
204
+ justifyContent: "space-between",
205
+ padding: "10px 12px",
206
+ borderBottom: "1px solid var(--border)"
207
+ },
208
+ children: L === "days" ? /* @__PURE__ */ s(le, { children: [
209
+ /* @__PURE__ */ e(
210
+ "button",
211
+ {
212
+ type: "button",
213
+ onClick: W,
214
+ style: F,
215
+ title: "Mes anterior",
216
+ children: /* @__PURE__ */ e(Se, { size: 16 })
217
+ }
218
+ ),
219
+ /* @__PURE__ */ s(
220
+ "button",
221
+ {
222
+ type: "button",
223
+ onClick: () => {
224
+ X("years"), M(0);
225
+ },
226
+ style: {
227
+ background: "none",
228
+ border: "none",
229
+ cursor: "pointer",
230
+ display: "flex",
231
+ alignItems: "center",
232
+ gap: 4,
233
+ fontSize: 13,
234
+ fontWeight: 700,
235
+ color: "var(--text-main)",
236
+ borderRadius: 6,
237
+ padding: "2px 6px"
238
+ },
239
+ children: [
240
+ pt[b - 1],
241
+ " ",
242
+ f,
243
+ /* @__PURE__ */ e(ge, { size: 13, style: { color: "var(--text-muted)" } })
244
+ ]
245
+ }
246
+ ),
247
+ /* @__PURE__ */ e(
248
+ "button",
249
+ {
250
+ type: "button",
251
+ onClick: I,
252
+ style: F,
253
+ title: "Mes siguiente",
254
+ children: /* @__PURE__ */ e(xe, { size: 16 })
255
+ }
256
+ )
257
+ ] }) : /* @__PURE__ */ s(le, { children: [
258
+ /* @__PURE__ */ e(
259
+ "button",
260
+ {
261
+ type: "button",
262
+ onClick: () => M((o) => o - Y),
263
+ style: F,
264
+ children: /* @__PURE__ */ e(Se, { size: 16 })
265
+ }
266
+ ),
267
+ /* @__PURE__ */ s(
268
+ "button",
269
+ {
270
+ type: "button",
271
+ onClick: () => X("days"),
272
+ style: {
273
+ background: "none",
274
+ border: "none",
275
+ cursor: "pointer",
276
+ fontSize: 13,
277
+ fontWeight: 700,
278
+ color: "var(--text-main)",
279
+ borderRadius: 6,
280
+ padding: "2px 6px"
281
+ },
282
+ children: [
283
+ B[0],
284
+ " – ",
285
+ B[B.length - 1]
286
+ ]
287
+ }
288
+ ),
289
+ /* @__PURE__ */ e(
290
+ "button",
291
+ {
292
+ type: "button",
293
+ onClick: () => M((o) => o + Y),
294
+ style: F,
295
+ children: /* @__PURE__ */ e(xe, { size: 16 })
296
+ }
297
+ )
298
+ ] })
299
+ }
300
+ ),
301
+ L === "years" && /* @__PURE__ */ s("div", { style: { padding: "8px 10px 10px" }, children: [
302
+ /* @__PURE__ */ e(
303
+ "div",
304
+ {
305
+ style: {
306
+ display: "grid",
307
+ gridTemplateColumns: "repeat(4,1fr)",
308
+ gap: 3,
309
+ marginBottom: 8
310
+ },
311
+ children: lr.map((o, x) => {
312
+ const z = x + 1 === b;
313
+ return /* @__PURE__ */ e(
314
+ "button",
315
+ {
316
+ type: "button",
317
+ onClick: () => N(x + 1),
318
+ style: {
319
+ border: "none",
320
+ cursor: "pointer",
321
+ borderRadius: 6,
322
+ fontSize: 11,
323
+ fontWeight: z ? 700 : 400,
324
+ padding: "4px 0",
325
+ background: z ? "var(--primary)" : "transparent",
326
+ color: z ? "var(--primary-fg, #ffffff)" : "var(--text-secondary)"
327
+ },
328
+ children: o
329
+ },
330
+ o
331
+ );
332
+ })
333
+ }
334
+ ),
335
+ /* @__PURE__ */ e(
336
+ "div",
337
+ {
338
+ style: { height: 1, background: "var(--border)", marginBottom: 8 }
339
+ }
340
+ ),
341
+ /* @__PURE__ */ e(
342
+ "div",
343
+ {
344
+ style: {
345
+ display: "grid",
346
+ gridTemplateColumns: "repeat(4,1fr)",
347
+ gap: 3
348
+ },
349
+ children: B.map((o) => {
350
+ const x = o === f;
351
+ return /* @__PURE__ */ e(
352
+ "button",
353
+ {
354
+ type: "button",
355
+ onClick: () => {
356
+ g(o), X("days");
357
+ },
358
+ style: {
359
+ border: "none",
360
+ cursor: "pointer",
361
+ borderRadius: 6,
362
+ fontSize: 12,
363
+ fontWeight: x ? 700 : 400,
364
+ padding: "6px 0",
365
+ background: x ? "var(--primary)" : "transparent",
366
+ color: x ? "var(--primary-fg, #ffffff)" : "var(--text-main)",
367
+ outline: o === (/* @__PURE__ */ new Date()).getFullYear() && !x ? "2px solid var(--primary)" : "none",
368
+ outlineOffset: "-2px"
369
+ },
370
+ children: o
371
+ },
372
+ o
373
+ );
374
+ })
375
+ }
376
+ )
377
+ ] }),
378
+ L === "days" && /* @__PURE__ */ s(le, { children: [
379
+ /* @__PURE__ */ e(
380
+ "div",
381
+ {
382
+ style: {
383
+ display: "grid",
384
+ gridTemplateColumns: "repeat(7,1fr)",
385
+ padding: "6px 8px 0"
386
+ },
387
+ children: cr.map((o) => /* @__PURE__ */ e(
388
+ "div",
389
+ {
390
+ style: {
391
+ textAlign: "center",
392
+ fontSize: 10,
393
+ fontWeight: 700,
394
+ color: "var(--text-muted)",
395
+ padding: "2px 0",
396
+ textTransform: "uppercase"
397
+ },
398
+ children: o
399
+ },
400
+ o
401
+ ))
402
+ }
403
+ ),
404
+ /* @__PURE__ */ e(
405
+ "div",
406
+ {
407
+ style: {
408
+ display: "grid",
409
+ gridTemplateColumns: "repeat(7,1fr)",
410
+ gridTemplateRows: `repeat(${Ae},1fr)`,
411
+ padding: "4px 8px 10px",
412
+ gap: 2
413
+ },
414
+ children: O.map((o, x) => {
415
+ if (o === null)
416
+ return /* @__PURE__ */ e("div", { style: { aspectRatio: "1" } }, x);
417
+ const z = He(f, b, o), j = z === t, P = z === l, Z = !!(n && z < n);
418
+ return /* @__PURE__ */ e(
419
+ "button",
420
+ {
421
+ type: "button",
422
+ onClick: () => !Z && G(o),
423
+ style: {
424
+ width: "100%",
425
+ aspectRatio: "1",
426
+ borderRadius: 6,
427
+ border: "none",
428
+ cursor: Z ? "not-allowed" : "pointer",
429
+ fontSize: 12,
430
+ fontWeight: j || P ? 700 : 400,
431
+ background: j ? "var(--primary)" : "transparent",
432
+ color: j ? "var(--primary-fg, #ffffff)" : Z ? "var(--text-muted)" : "var(--text-main)",
433
+ opacity: Z ? 0.4 : 1,
434
+ outline: P && !j ? "2px solid var(--primary)" : "none",
435
+ outlineOffset: "-2px"
436
+ },
437
+ children: o
438
+ },
439
+ x
440
+ );
441
+ })
442
+ }
443
+ )
444
+ ] })
445
+ ]
446
+ }
447
+ );
448
+ return p ? /* @__PURE__ */ s("div", { ref: y, className: "relative w-full", children: [
449
+ /* @__PURE__ */ s(
450
+ "button",
451
+ {
452
+ type: "button",
453
+ onClick: () => d((o) => !o),
454
+ className: "flex h-11 w-full items-center justify-between gap-2 rounded-lg px-3 py-0 text-sm transition-all duration-150 focus:outline-none",
455
+ style: {
456
+ background: "var(--bg-input)",
457
+ border: `1px solid ${c ? "var(--primary)" : "var(--border)"}`,
458
+ color: "var(--text-main)",
459
+ boxShadow: c ? "0 0 0 3px rgba(59,130,246,0.12)" : "none"
460
+ },
461
+ children: [
462
+ /* @__PURE__ */ s("span", { className: "inline-flex items-center gap-2 min-w-0", children: [
463
+ /* @__PURE__ */ e(Ie, { className: "w-4 h-4 text-[var(--text-muted)]" }),
464
+ /* @__PURE__ */ e("span", { className: "truncate", children: ur(t) })
465
+ ] }),
466
+ /* @__PURE__ */ e(
467
+ ge,
468
+ {
469
+ className: `w-4 h-4 text-[var(--text-muted)] transition-transform ${c ? "rotate-180" : ""}`
470
+ }
471
+ )
472
+ ]
473
+ }
474
+ ),
475
+ c && /* @__PURE__ */ e(
476
+ "div",
477
+ {
478
+ className: "absolute z-50",
479
+ style: {
480
+ ...C.horizontal === "left" ? { left: 0 } : { right: 0 },
481
+ ...C.vertical === "bottom" ? { top: "calc(100% + 8px)" } : { bottom: "calc(100% + 8px)" }
482
+ },
483
+ children: U
484
+ }
485
+ )
486
+ ] }) : U;
487
+ }
488
+ function nt(t) {
489
+ if (t !== void 0)
490
+ return typeof t == "number" ? `${t}px` : t;
491
+ }
492
+ function ft({
493
+ value: t,
494
+ onChange: r,
495
+ options: n,
496
+ placeholder: a = "Seleccionar…",
497
+ emptyLabel: l,
498
+ disabled: u = !1,
499
+ className: m = "",
500
+ style: p,
501
+ height: c = 44,
502
+ padding: d = "0 12px",
503
+ searchable: y = !0,
504
+ minOptionsForSearch: C = 6
505
+ }) {
506
+ const [w, f] = E(!1), [g, b] = E(""), [N, L] = E(-1), [X, Y] = E(!1), [k, M] = E({}), $ = J(null), B = J(null), W = J(null), I = J(null), T = y && n.length >= C, A = n.find((o) => o.value === t) ?? null, q = T && g.trim() ? n.filter(
507
+ (o) => {
508
+ var x;
509
+ return o.label.toLowerCase().includes(g.toLowerCase()) || ((x = o.sublabel) == null ? void 0 : x.toLowerCase().includes(g.toLowerCase()));
510
+ }
511
+ ) : n, O = Ve(() => {
512
+ const o = $.current;
513
+ if (!o) return;
514
+ const x = o.getBoundingClientRect(), z = T ? 272 : 212, j = window.innerHeight - x.bottom, P = j < z && x.top > j;
515
+ M({
516
+ position: "fixed",
517
+ left: x.left,
518
+ top: P ? void 0 : x.bottom + 4,
519
+ bottom: P ? window.innerHeight - x.top + 4 : void 0,
520
+ width: x.width,
521
+ zIndex: 9999
522
+ });
523
+ }, [T]);
524
+ R(() => Y(!0), []), R(() => {
525
+ if (!w) return;
526
+ function o(x) {
527
+ var j, P;
528
+ const z = x.target;
529
+ !((j = $.current) != null && j.contains(z)) && !((P = B.current) != null && P.contains(z)) && (f(!1), b(""));
530
+ }
531
+ return document.addEventListener("mousedown", o), () => document.removeEventListener("mousedown", o);
532
+ }, [w]), R(() => {
533
+ w && (L(-1), O(), T && setTimeout(() => {
534
+ var o;
535
+ return (o = W.current) == null ? void 0 : o.focus();
536
+ }, 0));
537
+ }, [w, T, O]), R(() => {
538
+ if (w)
539
+ return window.addEventListener("resize", O), window.addEventListener("scroll", O, !0), () => {
540
+ window.removeEventListener("resize", O), window.removeEventListener("scroll", O, !0);
541
+ };
542
+ }, [w, O]), R(() => {
543
+ if (N < 0 || !I.current) return;
544
+ const o = I.current.children[N];
545
+ o == null || o.scrollIntoView({ block: "nearest" });
546
+ }, [N]);
547
+ const G = Ve(
548
+ (o) => {
549
+ r(o), f(!1), b("");
550
+ },
551
+ [r]
552
+ );
553
+ function F(o) {
554
+ if (!w) {
555
+ (o.key === "Enter" || o.key === " " || o.key === "ArrowDown") && (o.preventDefault(), f(!0));
556
+ return;
557
+ }
558
+ o.key === "Escape" ? (o.preventDefault(), f(!1), b("")) : o.key === "ArrowDown" ? (o.preventDefault(), L((x) => Math.min(x + 1, q.length - 1))) : o.key === "ArrowUp" ? (o.preventDefault(), L((x) => Math.max(x - 1, l ? -1 : 0))) : o.key === "Enter" && (o.preventDefault(), N === -1 && l ? G("") : q[N] && G(q[N].value));
559
+ }
560
+ const U = /* @__PURE__ */ s(
561
+ "div",
562
+ {
563
+ ref: B,
564
+ className: "rounded-xl shadow-xl overflow-hidden",
565
+ style: {
566
+ ...k,
567
+ background: "var(--bg-card)",
568
+ border: "1px solid var(--border)"
569
+ },
570
+ children: [
571
+ T && /* @__PURE__ */ s(
572
+ "div",
573
+ {
574
+ className: "flex items-center gap-2 px-3 py-2",
575
+ style: { borderBottom: "1px solid var(--border)" },
576
+ children: [
577
+ /* @__PURE__ */ e(
578
+ We,
579
+ {
580
+ className: "w-3.5 h-3.5 flex-shrink-0",
581
+ style: { color: "var(--text-muted)" }
582
+ }
583
+ ),
584
+ /* @__PURE__ */ e(
585
+ "input",
586
+ {
587
+ ref: W,
588
+ value: g,
589
+ onChange: (o) => {
590
+ b(o.target.value), L(-1);
591
+ },
592
+ placeholder: "Buscar…",
593
+ className: "min-w-0 flex-1 text-sm bg-transparent outline-none",
594
+ style: { color: "var(--text-main)" }
595
+ }
596
+ ),
597
+ g && /* @__PURE__ */ e(
598
+ "button",
599
+ {
600
+ type: "button",
601
+ onMouseDown: (o) => {
602
+ o.preventDefault(), b("");
603
+ },
604
+ children: /* @__PURE__ */ e(
605
+ ce,
606
+ {
607
+ className: "w-3.5 h-3.5",
608
+ style: { color: "var(--text-muted)" }
609
+ }
610
+ )
611
+ }
612
+ )
613
+ ]
614
+ }
615
+ ),
616
+ /* @__PURE__ */ s(
617
+ "ul",
618
+ {
619
+ ref: I,
620
+ role: "listbox",
621
+ className: "overflow-y-auto",
622
+ style: {
623
+ maxHeight: T ? 220 : 180,
624
+ scrollbarWidth: "thin",
625
+ scrollbarColor: "var(--border) transparent",
626
+ overscrollBehavior: "contain"
627
+ },
628
+ children: [
629
+ l && /* @__PURE__ */ e(
630
+ "li",
631
+ {
632
+ role: "option",
633
+ "aria-selected": t === "",
634
+ onMouseDown: (o) => {
635
+ o.preventDefault(), G("");
636
+ },
637
+ onMouseEnter: () => L(-1),
638
+ className: "flex items-center gap-2 px-3 py-2 cursor-pointer text-sm transition-colors",
639
+ style: {
640
+ background: N === -1 ? "var(--bg-hover)" : "transparent",
641
+ color: "var(--text-muted)",
642
+ fontStyle: "italic"
643
+ },
644
+ children: l
645
+ }
646
+ ),
647
+ q.map((o, x) => {
648
+ const j = x === N, P = o.value === t;
649
+ return /* @__PURE__ */ s(
650
+ "li",
651
+ {
652
+ role: "option",
653
+ "aria-selected": P,
654
+ onMouseDown: (Z) => {
655
+ Z.preventDefault(), o.disabled || G(o.value);
656
+ },
657
+ onMouseEnter: () => !o.disabled && L(x),
658
+ className: "flex items-center gap-2 px-3 py-2 cursor-pointer text-sm transition-colors",
659
+ style: {
660
+ background: j ? "var(--bg-hover)" : P ? "color-mix(in srgb, var(--primary) 6%, transparent)" : "transparent",
661
+ color: o.disabled ? "var(--text-muted)" : "var(--text-main)",
662
+ cursor: o.disabled ? "not-allowed" : "pointer",
663
+ boxShadow: P ? "inset 2px 0 0 var(--primary)" : void 0
664
+ },
665
+ children: [
666
+ o.color && /* @__PURE__ */ e(
667
+ "span",
668
+ {
669
+ className: "flex-shrink-0 w-2.5 h-2.5 rounded-full",
670
+ style: { background: o.color }
671
+ }
672
+ ),
673
+ /* @__PURE__ */ s("span", { className: "min-w-0 flex flex-1 items-baseline gap-1 overflow-hidden", children: [
674
+ /* @__PURE__ */ e("span", { className: "truncate", children: o.label }),
675
+ o.sublabel && /* @__PURE__ */ e(
676
+ "span",
677
+ {
678
+ className: "min-w-0 flex-shrink truncate",
679
+ style: { color: "var(--text-muted)", fontSize: 12 },
680
+ children: o.sublabel
681
+ }
682
+ )
683
+ ] }),
684
+ o.badge && /* @__PURE__ */ e(
685
+ "span",
686
+ {
687
+ className: "text-xs flex-shrink-0",
688
+ style: { color: "var(--text-muted)" },
689
+ children: o.badge
690
+ }
691
+ )
692
+ ]
693
+ },
694
+ o.value
695
+ );
696
+ }),
697
+ q.length === 0 && /* @__PURE__ */ e(
698
+ "li",
699
+ {
700
+ className: "px-3 py-4 text-sm text-center",
701
+ style: { color: "var(--text-muted)" },
702
+ children: "Sin resultados"
703
+ }
704
+ )
705
+ ]
706
+ }
707
+ )
708
+ ]
709
+ }
710
+ );
711
+ return /* @__PURE__ */ s(
712
+ "div",
713
+ {
714
+ ref: $,
715
+ className: `relative ${m || "w-full"}`,
716
+ style: p,
717
+ onKeyDown: F,
718
+ children: [
719
+ /* @__PURE__ */ s(
720
+ "button",
721
+ {
722
+ type: "button",
723
+ disabled: u,
724
+ onClick: () => !u && f((o) => !o),
725
+ className: "flex w-full items-center gap-2 rounded-lg text-left text-sm transition-colors focus:outline-none",
726
+ style: {
727
+ height: nt(c),
728
+ padding: nt(d),
729
+ background: "var(--bg-input)",
730
+ color: A ? "var(--text-main)" : "var(--text-muted)",
731
+ border: w ? "1px solid var(--primary)" : "1px solid var(--border)",
732
+ opacity: u ? 0.5 : 1,
733
+ cursor: u ? "not-allowed" : "pointer"
734
+ },
735
+ "aria-haspopup": "listbox",
736
+ "aria-expanded": w,
737
+ children: [
738
+ (A == null ? void 0 : A.color) && /* @__PURE__ */ e(
739
+ "span",
740
+ {
741
+ className: "flex-shrink-0 w-2.5 h-2.5 rounded-full",
742
+ style: { background: A.color }
743
+ }
744
+ ),
745
+ /* @__PURE__ */ e("span", { className: "min-w-0 flex flex-1 items-baseline gap-1 overflow-hidden", children: A ? /* @__PURE__ */ s(le, { children: [
746
+ /* @__PURE__ */ e("span", { className: "truncate", children: A.label }),
747
+ A.sublabel && /* @__PURE__ */ e(
748
+ "span",
749
+ {
750
+ className: "min-w-0 flex-shrink truncate",
751
+ style: { color: "var(--text-muted)", fontSize: 12 },
752
+ children: A.sublabel
753
+ }
754
+ )
755
+ ] }) : /* @__PURE__ */ e("span", { className: "truncate", children: a }) }),
756
+ A && l ? /* @__PURE__ */ e(
757
+ "span",
758
+ {
759
+ role: "button",
760
+ tabIndex: -1,
761
+ onMouseDown: (o) => {
762
+ o.preventDefault(), o.stopPropagation(), G("");
763
+ },
764
+ className: "flex-shrink-0 rounded-full p-0.5 transition-colors hover:bg-black/10",
765
+ style: { color: "var(--text-muted)" },
766
+ children: /* @__PURE__ */ e(ce, { className: "w-3 h-3" })
767
+ }
768
+ ) : /* @__PURE__ */ e(
769
+ ge,
770
+ {
771
+ className: "flex-shrink-0 w-4 h-4 transition-transform",
772
+ style: {
773
+ color: "var(--text-muted)",
774
+ transform: w ? "rotate(180deg)" : "rotate(0deg)"
775
+ }
776
+ }
777
+ )
778
+ ]
779
+ }
780
+ ),
781
+ w && X && Ee(U, document.body)
782
+ ]
783
+ }
784
+ );
785
+ }
786
+ function ke(t) {
787
+ if (t !== void 0)
788
+ return typeof t == "number" ? `${t}px` : t;
789
+ }
790
+ function tn({
791
+ value: t,
792
+ onChange: r,
793
+ placeholder: n = "Buscar...",
794
+ className: a = "",
795
+ height: l = 44,
796
+ padding: u = "0 12px 0 34px",
797
+ iconLeft: m = 12
798
+ }) {
799
+ return /* @__PURE__ */ s("div", { className: `relative ${a}`, children: [
800
+ /* @__PURE__ */ e(
801
+ We,
802
+ {
803
+ className: "absolute top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-[var(--text-muted)] pointer-events-none",
804
+ style: { left: ke(m) }
805
+ }
806
+ ),
807
+ /* @__PURE__ */ e(
808
+ "input",
809
+ {
810
+ type: "text",
811
+ value: t,
812
+ onChange: (p) => r(p.target.value),
813
+ placeholder: n,
814
+ className: "w-full rounded-lg border border-[var(--border)] [background:var(--bg-card)] text-sm text-[var(--text-main)] placeholder:text-[var(--text-muted)] outline-none transition-[border-color,box-shadow] focus:border-primary focus:ring-2 focus:ring-primary/20",
815
+ style: { height: ke(l), padding: ke(u) }
816
+ }
817
+ )
818
+ ] });
819
+ }
820
+ function rn({
821
+ value: t,
822
+ onChange: r,
823
+ options: n,
824
+ placeholder: a,
825
+ icon: l,
826
+ className: u = "",
827
+ height: m = 44,
828
+ padding: p,
829
+ iconLeft: c = 12,
830
+ searchable: d = !0
831
+ }) {
832
+ const y = l ? n.map(
833
+ (C, w) => w === 0 && !C.color ? { ...C, sublabel: C.sublabel ?? void 0 } : C
834
+ ) : n;
835
+ return /* @__PURE__ */ s("div", { className: `relative ${u}`, children: [
836
+ l && /* @__PURE__ */ e(
837
+ "span",
838
+ {
839
+ className: "pointer-events-none absolute top-1/2 z-10 -translate-y-1/2 text-[var(--text-muted)]",
840
+ style: { left: ke(c) },
841
+ children: l
842
+ }
843
+ ),
844
+ /* @__PURE__ */ e(
845
+ ft,
846
+ {
847
+ value: t,
848
+ onChange: r,
849
+ options: y,
850
+ placeholder: a,
851
+ searchable: d,
852
+ minOptionsForSearch: 5,
853
+ height: m,
854
+ padding: p ?? (l ? "0 12px 0 34px" : "0 12px"),
855
+ className: "[&>button]:text-sm [&>button]:[background:var(--bg-card)]"
856
+ }
857
+ )
858
+ ] });
859
+ }
860
+ const mr = {
861
+ sm: "24rem",
862
+ md: "28rem",
863
+ lg: "32rem",
864
+ xl: "40rem",
865
+ "2xl": "48rem",
866
+ "4xl": "56rem",
867
+ "5xl": "64rem"
868
+ }, Ne = 180;
869
+ function pr({
870
+ open: t,
871
+ onClose: r,
872
+ title: n,
873
+ subtitle: a,
874
+ leadingIcon: l,
875
+ headerActions: u,
876
+ footer: m,
877
+ children: p,
878
+ size: c = "md",
879
+ maxWidth: d,
880
+ zIndex: y = 1e3,
881
+ closeOnBackdrop: C = !0,
882
+ closeOnEscape: w = !0,
883
+ showCloseButton: f = !0,
884
+ placement: g = "center",
885
+ bodyClassName: b = "px-6 py-5",
886
+ panelClassName: N = "",
887
+ backdropClassName: L = "bg-black/50 backdrop-blur-sm",
888
+ contentClassName: X = "p-4",
889
+ ariaLabel: Y,
890
+ frameless: k = !1
891
+ }) {
892
+ const [M, $] = E(!1), [B, W] = E(!1), I = J(null);
893
+ if (R(() => (t ? (I.current && clearTimeout(I.current), $(!0), requestAnimationFrame(() => requestAnimationFrame(() => W(!0)))) : (W(!1), I.current = setTimeout(
894
+ () => $(!1),
895
+ Ne + 40
896
+ )), () => {
897
+ I.current && clearTimeout(I.current);
898
+ }), [t]), R(() => {
899
+ if (t)
900
+ return document.body.style.overflow = "hidden", () => {
901
+ document.body.style.overflow = "";
902
+ };
903
+ }, [t]), R(() => {
904
+ if (!t || !w) return;
905
+ const F = (U) => {
906
+ U.key === "Escape" && r();
907
+ };
908
+ return window.addEventListener("keydown", F), () => window.removeEventListener("keydown", F);
909
+ }, [w, r, t]), !M) return null;
910
+ const T = n || a || l || u || f, A = d ?? mr[c], q = g === "bottom-mobile" ? "items-end sm:items-center justify-center p-0 sm:p-4" : "items-center justify-center", O = g === "bottom-mobile" ? "rounded-t-2xl sm:rounded-2xl" : "rounded-2xl", G = B ? "translateY(0) scale(1)" : g === "bottom-mobile" ? "translateY(16px) scale(0.98)" : "translateY(10px) scale(0.96)";
911
+ return Ee(
912
+ /* @__PURE__ */ s(
913
+ "div",
914
+ {
915
+ role: "dialog",
916
+ "aria-modal": "true",
917
+ "aria-label": Y ?? n,
918
+ className: `fixed inset-0 flex ${q} ${X}`,
919
+ style: { zIndex: y },
920
+ children: [
921
+ /* @__PURE__ */ e(
922
+ "div",
923
+ {
924
+ className: `absolute inset-0 ${L}`,
925
+ onClick: C ? r : void 0,
926
+ style: {
927
+ opacity: B ? 1 : 0,
928
+ transition: `opacity ${Ne}ms ease`
929
+ }
930
+ }
931
+ ),
932
+ /* @__PURE__ */ s(
933
+ "div",
934
+ {
935
+ className: `relative z-10 flex max-h-[92dvh] w-full flex-col overflow-hidden ${k ? "shadow-none" : "shadow-2xl"} ${O} ${N}`,
936
+ style: {
937
+ maxWidth: A,
938
+ background: k ? "transparent" : "var(--bg-card)",
939
+ border: k ? "none" : "1px solid var(--border)",
940
+ opacity: B ? 1 : 0,
941
+ transform: G,
942
+ transition: `opacity ${Ne}ms ease, transform ${Ne}ms ease`
943
+ },
944
+ onClick: (F) => F.stopPropagation(),
945
+ children: [
946
+ T && /* @__PURE__ */ s(
947
+ "div",
948
+ {
949
+ className: "flex flex-shrink-0 items-center justify-between gap-3 px-6 py-4",
950
+ style: { borderBottom: "1px solid var(--border)" },
951
+ children: [
952
+ /* @__PURE__ */ s("div", { className: "flex min-w-0 items-center gap-3", children: [
953
+ l && /* @__PURE__ */ e("div", { className: "flex-shrink-0", children: l }),
954
+ (n || a) && /* @__PURE__ */ s("div", { className: "min-w-0", children: [
955
+ n && /* @__PURE__ */ e(
956
+ "h2",
957
+ {
958
+ className: "truncate text-base font-semibold",
959
+ style: { color: "var(--text-main)" },
960
+ children: n
961
+ }
962
+ ),
963
+ a && /* @__PURE__ */ e(
964
+ "p",
965
+ {
966
+ className: "truncate text-xs",
967
+ style: { color: "var(--text-muted)" },
968
+ children: a
969
+ }
970
+ )
971
+ ] })
972
+ ] }),
973
+ /* @__PURE__ */ s("div", { className: "flex flex-shrink-0 items-center gap-2", children: [
974
+ u,
975
+ f && /* @__PURE__ */ e(ne, { variant: "icon", onClick: r, title: "Cerrar", children: /* @__PURE__ */ e(ce, { className: "h-5 w-5" }) })
976
+ ] })
977
+ ]
978
+ }
979
+ ),
980
+ /* @__PURE__ */ e("div", { className: `min-h-0 flex-1 overflow-y-auto ${b}`, children: p }),
981
+ m && /* @__PURE__ */ e(
982
+ "div",
983
+ {
984
+ className: "flex flex-shrink-0 justify-end gap-2 px-6 py-4",
985
+ style: { borderTop: "1px solid var(--border)" },
986
+ children: m
987
+ }
988
+ )
989
+ ]
990
+ }
991
+ )
992
+ ]
993
+ }
994
+ ),
995
+ document.body
996
+ );
997
+ }
998
+ const hr = {
999
+ danger: {
1000
+ iconBg: "rgba(239,68,68,0.12)",
1001
+ iconColor: "var(--danger)",
1002
+ btnBg: "var(--danger)",
1003
+ btnColor: "#fff"
1004
+ },
1005
+ warning: {
1006
+ iconBg: "rgba(245,158,11,0.12)",
1007
+ iconColor: "var(--warning)",
1008
+ btnBg: "var(--warning)",
1009
+ btnColor: "#fff"
1010
+ },
1011
+ primary: {
1012
+ iconBg: "rgba(59,130,246,0.12)",
1013
+ iconColor: "var(--primary)",
1014
+ btnBg: "var(--primary)",
1015
+ btnColor: "#fff"
1016
+ }
1017
+ };
1018
+ function nn({
1019
+ open: t,
1020
+ title: r,
1021
+ description: n,
1022
+ confirmLabel: a = "Confirmar",
1023
+ cancelLabel: l = "Cancelar",
1024
+ variant: u = "danger",
1025
+ onConfirm: m,
1026
+ onCancel: p
1027
+ }) {
1028
+ const c = hr[u];
1029
+ return /* @__PURE__ */ s(
1030
+ pr,
1031
+ {
1032
+ open: t,
1033
+ onClose: p,
1034
+ size: "sm",
1035
+ zIndex: 9998,
1036
+ showCloseButton: !1,
1037
+ bodyClassName: "p-6",
1038
+ panelClassName: "px-1",
1039
+ ariaLabel: r,
1040
+ children: [
1041
+ /* @__PURE__ */ e(
1042
+ ne,
1043
+ {
1044
+ variant: "icon",
1045
+ onClick: p,
1046
+ className: "absolute right-3 top-3 h-7 w-7 hover:opacity-70",
1047
+ style: { color: "var(--text-muted)" },
1048
+ "aria-label": "Cancelar",
1049
+ children: /* @__PURE__ */ e(ce, { className: "h-4 w-4" })
1050
+ }
1051
+ ),
1052
+ /* @__PURE__ */ e(
1053
+ "div",
1054
+ {
1055
+ className: "mb-4 flex h-11 w-11 items-center justify-center rounded-xl",
1056
+ style: {
1057
+ background: c.iconBg
1058
+ },
1059
+ children: /* @__PURE__ */ e(
1060
+ zt,
1061
+ {
1062
+ className: "h-5 w-5",
1063
+ style: { color: c.iconColor }
1064
+ }
1065
+ )
1066
+ }
1067
+ ),
1068
+ /* @__PURE__ */ e(
1069
+ "h2",
1070
+ {
1071
+ className: "mb-1 text-base font-semibold",
1072
+ style: { color: "var(--text-main)" },
1073
+ children: r
1074
+ }
1075
+ ),
1076
+ n && /* @__PURE__ */ e("p", { className: "text-sm", style: { color: "var(--text-muted)" }, children: n }),
1077
+ /* @__PURE__ */ s("div", { className: "mt-6 flex gap-2", children: [
1078
+ /* @__PURE__ */ e(
1079
+ ne,
1080
+ {
1081
+ variant: "secondary",
1082
+ onClick: p,
1083
+ className: "flex-1",
1084
+ style: { background: "var(--bg-input)" },
1085
+ children: l
1086
+ }
1087
+ ),
1088
+ /* @__PURE__ */ e(
1089
+ ne,
1090
+ {
1091
+ variant: "danger",
1092
+ onClick: m,
1093
+ className: "flex-1",
1094
+ style: {
1095
+ background: c.btnBg,
1096
+ color: c.btnColor,
1097
+ borderColor: "transparent"
1098
+ },
1099
+ children: a
1100
+ }
1101
+ )
1102
+ ] })
1103
+ ]
1104
+ }
1105
+ );
1106
+ }
1107
+ function fr(t) {
1108
+ var a;
1109
+ const r = Array.from(
1110
+ t.querySelectorAll("*")
1111
+ ).filter(
1112
+ (l) => {
1113
+ var u;
1114
+ return l.scrollWidth > l.clientWidth && !!((u = l.textContent) != null && u.trim()) && l.tagName.toLowerCase() !== "svg" && !l.closest("svg");
1115
+ }
1116
+ );
1117
+ return (t.scrollWidth > t.clientWidth || r.length > 0) && (((a = r[0]) == null ? void 0 : a.textContent) ?? t.textContent ?? "").trim() || null;
1118
+ }
1119
+ function br({
1120
+ children: t,
1121
+ content: r,
1122
+ onlyWhenOverflow: n = !1,
1123
+ className: a = "",
1124
+ style: l,
1125
+ as: u = "div"
1126
+ }) {
1127
+ const m = J(null), p = J(null), [c, d] = E(null), [y, C] = E("");
1128
+ R(() => {
1129
+ const g = m.current;
1130
+ g && (g.querySelectorAll("[title]").forEach((b) => {
1131
+ const N = b.getAttribute("title");
1132
+ N && (b.getAttribute("aria-label") || b.setAttribute("aria-label", N), b.removeAttribute("title"));
1133
+ }), g.querySelectorAll("svg title").forEach((b) => b.remove()));
1134
+ }), Dt(() => {
1135
+ if (!c) return;
1136
+ const g = p.current;
1137
+ if (!g) return;
1138
+ const b = 12, N = 14, L = g.getBoundingClientRect(), X = window.innerWidth - L.width - b, Y = window.innerHeight - L.height - b;
1139
+ let k = c.mouseX + N, M = c.mouseY + N;
1140
+ k > X && (k = c.mouseX - L.width - N), M > Y && (M = c.mouseY - L.height - N), k = Math.min(Math.max(b, k), Math.max(b, X)), M = Math.min(Math.max(b, M), Math.max(b, Y)), (Math.abs(k - c.x) > 0.5 || Math.abs(M - c.y) > 0.5) && d(
1141
+ ($) => $ && {
1142
+ ...$,
1143
+ x: k,
1144
+ y: M
1145
+ }
1146
+ );
1147
+ }, [c]);
1148
+ const w = (g, b) => {
1149
+ const N = m.current;
1150
+ if (N) {
1151
+ if (n) {
1152
+ const L = fr(N);
1153
+ if (!L) return;
1154
+ C(L);
1155
+ }
1156
+ !n && !r || d({ mouseX: g, mouseY: b, x: g + 14, y: b + 14 });
1157
+ }
1158
+ }, f = n ? y : r;
1159
+ return /* @__PURE__ */ s(le, { children: [
1160
+ /* @__PURE__ */ e(
1161
+ u,
1162
+ {
1163
+ ref: (g) => {
1164
+ m.current = g;
1165
+ },
1166
+ className: a,
1167
+ style: l,
1168
+ onMouseEnter: (g) => w(g.clientX, g.clientY),
1169
+ onMouseMove: (g) => {
1170
+ c && w(g.clientX, g.clientY);
1171
+ },
1172
+ onMouseLeave: () => d(null),
1173
+ children: t
1174
+ }
1175
+ ),
1176
+ c && f ? Ee(
1177
+ /* @__PURE__ */ e(
1178
+ "div",
1179
+ {
1180
+ ref: p,
1181
+ role: "tooltip",
1182
+ style: {
1183
+ position: "fixed",
1184
+ top: c.y,
1185
+ left: c.x,
1186
+ zIndex: 9999,
1187
+ background: "var(--bg-card)",
1188
+ border: "1px solid var(--border)",
1189
+ borderRadius: 6,
1190
+ padding: "5px 10px",
1191
+ fontSize: 12,
1192
+ color: "var(--text-main)",
1193
+ boxShadow: "0 4px 16px rgba(0,0,0,0.35)",
1194
+ pointerEvents: "none",
1195
+ maxWidth: "min(420px, calc(100vw - 24px))",
1196
+ whiteSpace: "normal",
1197
+ lineHeight: 1.6,
1198
+ overflowWrap: "anywhere"
1199
+ },
1200
+ children: f
1201
+ }
1202
+ ),
1203
+ document.body
1204
+ ) : null
1205
+ ] });
1206
+ }
1207
+ const gr = "[&_button]:h-7 [&_button]:min-h-0 [&_button]:gap-1 [&_button]:px-2 [&_button]:text-xs [&_button_svg]:h-3.5 [&_button_svg]:w-3.5 [&_button[data-icon=true]]:w-7 [&_button[data-icon=true]]:px-0";
1208
+ function fe(t) {
1209
+ if (!t) return 150;
1210
+ const r = parseInt(t, 10);
1211
+ return isNaN(r) || r <= 0 ? 150 : r;
1212
+ }
1213
+ function se(t, r) {
1214
+ const n = t.minWidth ?? 80, a = t.maxWidth ?? 1 / 0;
1215
+ return Math.min(a, Math.max(n, r));
1216
+ }
1217
+ function xr(t, r) {
1218
+ if (r <= 7) return Array.from({ length: r }, (a, l) => l + 1);
1219
+ const n = [1];
1220
+ t > 3 && n.push("...");
1221
+ for (let a = Math.max(2, t - 1); a <= Math.min(r - 1, t + 1); a++)
1222
+ n.push(a);
1223
+ return t < r - 2 && n.push("..."), n.push(r), n;
1224
+ }
1225
+ function at({
1226
+ children: t,
1227
+ className: r = "",
1228
+ style: n
1229
+ }) {
1230
+ return /* @__PURE__ */ e(
1231
+ br,
1232
+ {
1233
+ onlyWhenOverflow: !0,
1234
+ className: r,
1235
+ style: {
1236
+ overflow: "hidden",
1237
+ textOverflow: "ellipsis",
1238
+ whiteSpace: "nowrap",
1239
+ width: "100%",
1240
+ ...n
1241
+ },
1242
+ children: t
1243
+ }
1244
+ );
1245
+ }
1246
+ function an({
1247
+ columns: t,
1248
+ data: r,
1249
+ getRowId: n,
1250
+ loading: a = !1,
1251
+ skeletonRows: l = 8,
1252
+ emptyIcon: u,
1253
+ emptyText: m = "Sin resultados",
1254
+ onRowClick: p,
1255
+ selected: c,
1256
+ onToggleOne: d,
1257
+ onToggleAll: y,
1258
+ highlightSelected: C = !0,
1259
+ rowClassName: w,
1260
+ stickyHeader: f = !0,
1261
+ pageSize: g = 25,
1262
+ pageSizeOptions: b = [25, 50, 100],
1263
+ pageSizeSelectWidth: N = 62,
1264
+ pageSizeSelectHeight: L = 30,
1265
+ pageSizeSelectPadding: X = "0 7px",
1266
+ totalRows: Y,
1267
+ page: k,
1268
+ onPageChange: M,
1269
+ onPageSizeChange: $,
1270
+ storageKey: B,
1271
+ stickyFirstColumn: W = !1,
1272
+ bottomOffset: I = 0,
1273
+ compact: T = !0,
1274
+ restrictHeight: A = !0
1275
+ }) {
1276
+ const q = t.map((i) => i.key).join(","), [O, G] = E(!B), F = J(null), U = J(!B), o = (i, h) => 50 + (i * 17 + h * 13 + 7) % 40, x = J(null), [z, j] = E(
1277
+ void 0
1278
+ ), [P, Z] = E(!1);
1279
+ R(() => {
1280
+ const h = g !== !1 ? 32 : 0, v = 12;
1281
+ function S() {
1282
+ if (Z(window.innerWidth < 640), !x.current) return;
1283
+ const D = x.current.getBoundingClientRect().top;
1284
+ j(
1285
+ Math.max(
1286
+ 120,
1287
+ window.innerHeight - D - h - v - I
1288
+ )
1289
+ );
1290
+ }
1291
+ return S(), window.addEventListener("resize", S), () => window.removeEventListener("resize", S);
1292
+ }, [a, g, I]);
1293
+ const [ee, ae] = E(
1294
+ () => t.map((i) => i.key)
1295
+ ), [de, ve] = E(
1296
+ () => Object.fromEntries(
1297
+ t.map((i) => [i.key, se(i, fe(i.width))])
1298
+ )
1299
+ );
1300
+ R(() => {
1301
+ const i = t.map((v) => v.key);
1302
+ if (!B) {
1303
+ ae(i), U.current = !1, G(!0);
1304
+ return;
1305
+ }
1306
+ let h = !1;
1307
+ return U.current = !1, G(!1), fetch(
1308
+ `/api/user/preferences/datatables?key=${encodeURIComponent(B)}`,
1309
+ { cache: "no-store" }
1310
+ ).then((v) => v.ok ? v.json() : null).then((v) => {
1311
+ var qe, Ge;
1312
+ if (h) return;
1313
+ const S = (qe = v == null ? void 0 : v.settings) == null ? void 0 : qe.columnOrder, D = Array.isArray(S) ? S.filter((K) => i.includes(K)) : [], V = i.filter((K) => !D.includes(K)), H = D.length > 0 ? [...D, ...V] : i, me = Object.fromEntries(
1314
+ t.map((K) => [K.key, se(K, fe(K.width))])
1315
+ ), _ = ((Ge = v == null ? void 0 : v.settings) == null ? void 0 : Ge.columnWidths) ?? {}, Ye = Object.fromEntries(
1316
+ t.map((K) => [
1317
+ K.key,
1318
+ se(K, _[K.key] ?? me[K.key])
1319
+ ])
1320
+ );
1321
+ ae(H), ve(Ye), F.current = JSON.stringify({
1322
+ columnOrder: H,
1323
+ columnWidths: Ye
1324
+ }), U.current = !0;
1325
+ }).catch(() => {
1326
+ if (!h) {
1327
+ ae(i);
1328
+ const v = Object.fromEntries(
1329
+ t.map((S) => [
1330
+ S.key,
1331
+ se(S, fe(S.width))
1332
+ ])
1333
+ );
1334
+ ve(v), F.current = JSON.stringify({
1335
+ columnOrder: i,
1336
+ columnWidths: v
1337
+ }), U.current = !0;
1338
+ }
1339
+ }).finally(() => {
1340
+ h || G(!0);
1341
+ }), () => {
1342
+ h = !0;
1343
+ };
1344
+ }, [B, q, t]), R(() => {
1345
+ if (!B || !O || !U.current) return;
1346
+ const i = {
1347
+ columnOrder: ee,
1348
+ columnWidths: de
1349
+ }, h = JSON.stringify(i);
1350
+ if (h === F.current) return;
1351
+ const v = window.setTimeout(() => {
1352
+ fetch("/api/user/preferences/datatables", {
1353
+ method: "PATCH",
1354
+ headers: { "Content-Type": "application/json" },
1355
+ body: JSON.stringify({ key: B, settings: i })
1356
+ }).then((S) => {
1357
+ S.ok && (F.current = h);
1358
+ }).catch(() => {
1359
+ });
1360
+ }, 300);
1361
+ return () => window.clearTimeout(v);
1362
+ }, [ee, de, B, O]), R(() => {
1363
+ ae((i) => {
1364
+ const h = t.map((D) => D.key), v = i.filter((D) => h.includes(D)), S = h.filter((D) => !v.includes(D));
1365
+ return [...v, ...S];
1366
+ });
1367
+ }, [q, t]);
1368
+ const pe = ee.map((i) => t.find((h) => h.key === i)).filter((i) => !!i);
1369
+ R(() => {
1370
+ ve((i) => {
1371
+ const h = Object.fromEntries(
1372
+ t.map((v) => [v.key, se(v, fe(v.width))])
1373
+ );
1374
+ return Object.fromEntries(
1375
+ t.map((v) => [
1376
+ v.key,
1377
+ se(v, i[v.key] ?? h[v.key])
1378
+ ])
1379
+ );
1380
+ });
1381
+ }, [q, t]);
1382
+ const ye = J(null);
1383
+ R(() => {
1384
+ function i(v) {
1385
+ const S = ye.current;
1386
+ if (!S) return;
1387
+ const D = v.clientX - S.startX, V = t.find((H) => H.key === S.colKey);
1388
+ V && ve((H) => ({
1389
+ ...H,
1390
+ [S.colKey]: se(V, S.startWidth + D)
1391
+ }));
1392
+ }
1393
+ function h() {
1394
+ ye.current && (ye.current = null, document.body.style.cursor = "", document.body.style.userSelect = "");
1395
+ }
1396
+ return document.addEventListener("pointermove", i), document.addEventListener("pointerup", h), () => {
1397
+ document.removeEventListener("pointermove", i), document.removeEventListener("pointerup", h);
1398
+ };
1399
+ }, [t]);
1400
+ const we = J(null), [Pe, Me] = E(null);
1401
+ function xt(i, h) {
1402
+ we.current = i, h.dataTransfer.effectAllowed = "move";
1403
+ }
1404
+ function vt(i, h) {
1405
+ h.preventDefault(), h.dataTransfer.dropEffect = "move", Pe !== i && Me(i);
1406
+ }
1407
+ function yt(i, h) {
1408
+ h.preventDefault();
1409
+ const v = we.current;
1410
+ v !== null && v !== i && ae((S) => {
1411
+ const D = [...S], [V] = D.splice(v, 1);
1412
+ return D.splice(i, 0, V), D;
1413
+ }), we.current = null, Me(null);
1414
+ }
1415
+ function wt() {
1416
+ we.current = null, Me(null);
1417
+ }
1418
+ const [re, Nt] = E(null);
1419
+ function kt(i) {
1420
+ i.sortKey && Nt(
1421
+ (h) => (h == null ? void 0 : h.key) === i.key ? { key: i.key, dir: h.dir === "asc" ? "desc" : "asc" } : { key: i.key, dir: "asc" }
1422
+ );
1423
+ }
1424
+ const [St, $e] = E(1), [_e, Ct] = E(
1425
+ g === !1 ? 0 : g
1426
+ );
1427
+ R(() => {
1428
+ $e(1);
1429
+ }, [r]);
1430
+ const ue = !!(M && $), oe = g !== !1, Q = ue ? k ?? 1 : St, ie = ue || oe ? _e : r.length, te = !!c && !!d && !!y, Le = te ? 40 : 0, Et = te && r.length > 0 && c.size === r.length, Mt = te && c.size > 0 && c.size < r.length, Te = Xe.useMemo(() => {
1431
+ if (!re) return r;
1432
+ const i = t.find((h) => h.key === re.key && h.sortKey);
1433
+ return i != null && i.sortKey ? [...r].sort((h, v) => {
1434
+ const S = h[i.sortKey], D = v[i.sortKey], V = S === D ? 0 : S == null ? 1 : D == null || S < D ? -1 : 1;
1435
+ return re.dir === "asc" ? V : -V;
1436
+ }) : r;
1437
+ }, [r, re, t]), $t = Xe.useMemo(() => {
1438
+ if (ue || !oe) return Te;
1439
+ const i = (Q - 1) * ie;
1440
+ return Te.slice(i, i + ie);
1441
+ }, [Te, ue, oe, Q, ie]), he = Y ?? r.length, Be = oe ? Math.max(1, Math.ceil(he / ie)) : 1, Lt = oe ? (Q - 1) * ie + 1 : 1, Tt = oe ? Math.min(Q * ie, he) : he;
1442
+ function Re(i) {
1443
+ const h = Math.max(1, Math.min(i, Be));
1444
+ ue ? M(h) : $e(h);
1445
+ }
1446
+ function Bt(i) {
1447
+ Ct(i), ue ? ($(i), M(1)) : $e(1), $ && $(i);
1448
+ }
1449
+ const Fe = (i) => i === "center" ? "text-center" : i === "right" ? "text-right" : "text-left", Rt = "color-mix(in srgb, var(--primary) 6%, var(--bg-card))", je = () => /* @__PURE__ */ s(
1450
+ "tr",
1451
+ {
1452
+ style: {
1453
+ background: "color-mix(in srgb, var(--bg-input) 72%, transparent)"
1454
+ },
1455
+ children: [
1456
+ te && /* @__PURE__ */ e(
1457
+ "th",
1458
+ {
1459
+ className: `${T ? "px-2 py-1.5" : "px-3 py-2.5"} w-10`,
1460
+ style: W ? {
1461
+ position: "sticky",
1462
+ left: 0,
1463
+ zIndex: 12,
1464
+ background: "color-mix(in srgb, var(--bg-input) 72%, transparent)",
1465
+ backdropFilter: "blur(14px)",
1466
+ WebkitBackdropFilter: "blur(14px)",
1467
+ boxShadow: "inset 0 -2px 0 var(--border)",
1468
+ borderRight: "1px solid var(--border)"
1469
+ } : {
1470
+ borderBottom: "2px solid var(--border)",
1471
+ borderRight: "1px solid var(--border)"
1472
+ },
1473
+ children: /* @__PURE__ */ e(
1474
+ "input",
1475
+ {
1476
+ type: "checkbox",
1477
+ checked: Et,
1478
+ ref: (i) => {
1479
+ i && (i.indeterminate = Mt);
1480
+ },
1481
+ onChange: y,
1482
+ className: "rounded cursor-pointer accent-[var(--primary)]"
1483
+ }
1484
+ )
1485
+ }
1486
+ ),
1487
+ pe.map((i, h) => {
1488
+ const v = (re == null ? void 0 : re.key) === i.key, S = !!i.sortKey, D = W && !P && h === 0, V = Pe === h, me = (de[i.key] ?? fe(i.width)) < 120;
1489
+ return /* @__PURE__ */ s(
1490
+ "th",
1491
+ {
1492
+ className: `group select-none ${me ? "text-left" : Fe(i.align)}`,
1493
+ style: {
1494
+ ...D ? {
1495
+ position: "sticky",
1496
+ left: Le,
1497
+ zIndex: 12,
1498
+ background: "color-mix(in srgb, var(--bg-input) 72%, transparent)",
1499
+ backdropFilter: "blur(14px)",
1500
+ WebkitBackdropFilter: "blur(14px)",
1501
+ boxShadow: "3px 0 6px -2px rgba(0,0,0,0.12), inset 0 -2px 0 var(--border)",
1502
+ borderRight: "1px solid var(--border)"
1503
+ } : {
1504
+ position: "relative",
1505
+ borderBottom: "2px solid var(--border)",
1506
+ borderRight: "1px solid var(--border)"
1507
+ },
1508
+ color: v ? "var(--primary)" : "var(--text-muted)",
1509
+ whiteSpace: "nowrap",
1510
+ transition: "color 0.15s",
1511
+ borderLeft: V ? "2px solid var(--primary)" : "2px solid transparent",
1512
+ cursor: S ? "pointer" : "default",
1513
+ // Padding: room for grip icon left, resize handle right
1514
+ padding: T ? "5px 24px 5px 6px" : "7px 28px 7px 6px"
1515
+ },
1516
+ onDragOver: (_) => vt(h, _),
1517
+ onDrop: (_) => yt(h, _),
1518
+ onClick: S ? () => kt(i) : void 0,
1519
+ children: [
1520
+ /* @__PURE__ */ e(
1521
+ "span",
1522
+ {
1523
+ draggable: !0,
1524
+ onDragStart: (_) => {
1525
+ _.stopPropagation(), xt(h, _);
1526
+ },
1527
+ onDragEnd: (_) => {
1528
+ _.stopPropagation(), wt();
1529
+ },
1530
+ onClick: (_) => _.stopPropagation(),
1531
+ title: "Arrastrar para reordenar",
1532
+ className: "inline-flex items-center mr-1 opacity-0 group-hover:opacity-40 transition-opacity",
1533
+ style: {
1534
+ cursor: "grab",
1535
+ color: "var(--text-muted)",
1536
+ verticalAlign: "middle"
1537
+ },
1538
+ children: /* @__PURE__ */ e(Kt, { size: 15 })
1539
+ }
1540
+ ),
1541
+ /* @__PURE__ */ e(
1542
+ at,
1543
+ {
1544
+ className: "inline-block max-w-full align-middle",
1545
+ style: {
1546
+ width: "calc(100% - 22px)",
1547
+ textAlign: me ? "left" : i.align === "center" ? "center" : i.align === "right" ? "right" : "left"
1548
+ },
1549
+ children: /* @__PURE__ */ s(
1550
+ "span",
1551
+ {
1552
+ className: `inline-flex max-w-full items-center gap-1 font-semibold uppercase tracking-wider ${T ? "text-[11px]" : "text-xs"}`,
1553
+ children: [
1554
+ /* @__PURE__ */ e("span", { className: "min-w-0 truncate", children: i.header }),
1555
+ S && /* @__PURE__ */ e("span", { className: "flex-shrink-0 opacity-60", children: v ? re.dir === "asc" ? /* @__PURE__ */ e(Ot, { className: "w-3 h-3" }) : /* @__PURE__ */ e(ge, { className: "w-3 h-3" }) : /* @__PURE__ */ e(It, { className: "w-3 h-3 opacity-40" }) })
1556
+ ]
1557
+ }
1558
+ )
1559
+ }
1560
+ ),
1561
+ /* @__PURE__ */ e(
1562
+ "span",
1563
+ {
1564
+ role: "separator",
1565
+ "aria-orientation": "vertical",
1566
+ title: "Arrastrar para redimensionar",
1567
+ onPointerDown: (_) => {
1568
+ _.preventDefault(), _.stopPropagation(), ye.current = {
1569
+ colKey: i.key,
1570
+ startX: _.clientX,
1571
+ startWidth: de[i.key] ?? 150
1572
+ }, document.body.style.cursor = "col-resize", document.body.style.userSelect = "none";
1573
+ },
1574
+ onClick: (_) => _.stopPropagation(),
1575
+ className: "absolute right-0 top-0 h-full flex items-center justify-center opacity-0 group-hover:opacity-100 transition-opacity",
1576
+ style: { width: 12, cursor: "col-resize", zIndex: 3 },
1577
+ children: /* @__PURE__ */ e(
1578
+ "span",
1579
+ {
1580
+ style: {
1581
+ width: 3,
1582
+ height: "40%",
1583
+ borderRadius: 2,
1584
+ background: "var(--primary)",
1585
+ display: "block"
1586
+ }
1587
+ }
1588
+ )
1589
+ }
1590
+ )
1591
+ ]
1592
+ },
1593
+ i.key
1594
+ );
1595
+ })
1596
+ ]
1597
+ }
1598
+ ), Ue = () => {
1599
+ if (!oe || a) return null;
1600
+ const i = xr(Q, Be);
1601
+ return /* @__PURE__ */ s(
1602
+ "div",
1603
+ {
1604
+ className: `flex items-center justify-between gap-2 rounded-b-xl border-t text-xs select-none ${T ? "px-2 py-0.5" : "px-3 py-1"}`,
1605
+ style: { borderColor: "var(--border)", background: "var(--bg-input)" },
1606
+ children: [
1607
+ /* @__PURE__ */ s("div", { className: "flex min-w-0 items-center gap-2", children: [
1608
+ /* @__PURE__ */ e("span", { style: { color: "var(--text-muted)" }, children: he === 0 ? "0 filas" : `${Lt}–${Tt} de ${he}` }),
1609
+ /* @__PURE__ */ s("div", { className: "flex items-center gap-1", children: [
1610
+ /* @__PURE__ */ e("span", { style: { color: "var(--text-muted)" }, children: "Filas:" }),
1611
+ /* @__PURE__ */ e(
1612
+ ft,
1613
+ {
1614
+ value: String(ie),
1615
+ onChange: (h) => Bt(Number(h)),
1616
+ options: b.map((h) => ({
1617
+ value: String(h),
1618
+ label: String(h)
1619
+ })),
1620
+ placeholder: "Filas",
1621
+ searchable: !1,
1622
+ height: L,
1623
+ padding: X,
1624
+ className: "shrink-0 [&>button]:rounded-md [&>button]:text-xs [&_svg]:h-3.5 [&_svg]:w-3.5",
1625
+ style: { width: N }
1626
+ }
1627
+ )
1628
+ ] })
1629
+ ] }),
1630
+ /* @__PURE__ */ s("div", { className: "flex items-center gap-0.5", children: [
1631
+ /* @__PURE__ */ e(
1632
+ "button",
1633
+ {
1634
+ disabled: Q <= 1,
1635
+ onClick: () => Re(Q - 1),
1636
+ className: "rounded p-0.5 transition-colors disabled:opacity-30",
1637
+ style: { color: "var(--text-muted)", background: "transparent" },
1638
+ children: /* @__PURE__ */ e(Se, { className: "h-3.5 w-3.5" })
1639
+ }
1640
+ ),
1641
+ i.map(
1642
+ (h, v) => h === "..." ? /* @__PURE__ */ e(
1643
+ "span",
1644
+ {
1645
+ className: "px-1",
1646
+ style: { color: "var(--text-muted)" },
1647
+ children: "…"
1648
+ },
1649
+ `e${v}`
1650
+ ) : /* @__PURE__ */ e(
1651
+ "button",
1652
+ {
1653
+ onClick: () => Re(h),
1654
+ className: "h-5 w-5 rounded text-[11px] font-medium transition-colors",
1655
+ style: {
1656
+ background: h === Q ? "var(--primary)" : "transparent",
1657
+ color: h === Q ? "var(--primary-fg)" : "var(--text-muted)"
1658
+ },
1659
+ children: h
1660
+ },
1661
+ h
1662
+ )
1663
+ ),
1664
+ /* @__PURE__ */ e(
1665
+ "button",
1666
+ {
1667
+ disabled: Q >= Be,
1668
+ onClick: () => Re(Q + 1),
1669
+ className: "rounded p-0.5 transition-colors disabled:opacity-30",
1670
+ style: { color: "var(--text-muted)", background: "transparent" },
1671
+ children: /* @__PURE__ */ e(xe, { className: "h-3.5 w-3.5" })
1672
+ }
1673
+ )
1674
+ ] })
1675
+ ]
1676
+ }
1677
+ );
1678
+ };
1679
+ return a && r.length === 0 ? /* @__PURE__ */ s(
1680
+ "div",
1681
+ {
1682
+ className: "w-full flex flex-col rounded-xl overflow-visible",
1683
+ style: { border: "1px solid var(--border)" },
1684
+ children: [
1685
+ /* @__PURE__ */ e("div", { ref: x, className: "overflow-hidden rounded-t-xl", children: /* @__PURE__ */ e(
1686
+ tt,
1687
+ {
1688
+ options: { scrollbars: { autoHide: "leave", autoHideDelay: 200 } },
1689
+ className: "w-full",
1690
+ style: { maxHeight: A ? z : void 0 },
1691
+ defer: !0,
1692
+ children: /* @__PURE__ */ s(
1693
+ "table",
1694
+ {
1695
+ className: "text-sm",
1696
+ style: {
1697
+ tableLayout: "fixed",
1698
+ width: "100%",
1699
+ minWidth: "max-content",
1700
+ borderCollapse: "separate",
1701
+ borderSpacing: 0
1702
+ },
1703
+ children: [
1704
+ /* @__PURE__ */ s("colgroup", { children: [
1705
+ te && /* @__PURE__ */ e("col", { style: { width: 40 } }),
1706
+ pe.map((i) => /* @__PURE__ */ e(
1707
+ "col",
1708
+ {
1709
+ style: { width: de[i.key] ?? 150 }
1710
+ },
1711
+ i.key
1712
+ ))
1713
+ ] }),
1714
+ /* @__PURE__ */ e(
1715
+ "thead",
1716
+ {
1717
+ style: f ? {
1718
+ position: "sticky",
1719
+ top: 0,
1720
+ zIndex: 10,
1721
+ backdropFilter: "blur(14px)",
1722
+ WebkitBackdropFilter: "blur(14px)"
1723
+ } : void 0,
1724
+ children: je()
1725
+ }
1726
+ ),
1727
+ /* @__PURE__ */ e("tbody", { children: Array.from({ length: l }).map((i, h) => /* @__PURE__ */ s("tr", { children: [
1728
+ te && /* @__PURE__ */ e(
1729
+ "td",
1730
+ {
1731
+ className: `${T ? "px-2 py-1.5" : "px-3 py-2"} w-10`,
1732
+ style: {
1733
+ borderBottom: "1px solid var(--border)",
1734
+ borderRight: "1px solid var(--border)"
1735
+ }
1736
+ }
1737
+ ),
1738
+ pe.map((v, S) => /* @__PURE__ */ e(
1739
+ "td",
1740
+ {
1741
+ className: T ? "px-2 py-1.5" : "px-3 py-2",
1742
+ style: W && !P && S === 0 ? {
1743
+ position: "sticky",
1744
+ left: Le,
1745
+ zIndex: 1,
1746
+ background: "color-mix(in srgb, var(--bg-card) 72%, transparent)",
1747
+ backdropFilter: "blur(10px)",
1748
+ WebkitBackdropFilter: "blur(10px)",
1749
+ boxShadow: "3px 0 6px -2px rgba(0,0,0,0.12), inset 0 -1px 0 var(--border)",
1750
+ borderRight: "1px solid var(--border)"
1751
+ } : {
1752
+ borderBottom: "1px solid var(--border)",
1753
+ borderRight: "1px solid var(--border)"
1754
+ },
1755
+ children: /* @__PURE__ */ e(
1756
+ "div",
1757
+ {
1758
+ className: "h-3.5 rounded-full animate-pulse",
1759
+ style: {
1760
+ background: "var(--border)",
1761
+ width: `${o(h, S)}%`,
1762
+ minWidth: 32
1763
+ }
1764
+ }
1765
+ )
1766
+ },
1767
+ v.key
1768
+ ))
1769
+ ] }, h)) })
1770
+ ]
1771
+ }
1772
+ )
1773
+ }
1774
+ ) }),
1775
+ Ue()
1776
+ ]
1777
+ }
1778
+ ) : !a && r.length === 0 ? /* @__PURE__ */ s("div", { className: "py-20 flex flex-col items-center gap-3", children: [
1779
+ u && /* @__PURE__ */ e("div", { style: { color: "var(--text-muted)", opacity: 0.5 }, children: u }),
1780
+ /* @__PURE__ */ e("p", { className: "text-sm", style: { color: "var(--text-muted)" }, children: m })
1781
+ ] }) : /* @__PURE__ */ s(
1782
+ "div",
1783
+ {
1784
+ className: "w-full flex flex-col rounded-xl overflow-visible",
1785
+ style: { border: "1px solid var(--border)" },
1786
+ children: [
1787
+ /* @__PURE__ */ e("div", { ref: x, className: "overflow-hidden rounded-t-xl", children: /* @__PURE__ */ e(
1788
+ tt,
1789
+ {
1790
+ options: { scrollbars: { autoHide: "leave", autoHideDelay: 200 } },
1791
+ className: "w-full",
1792
+ style: { maxHeight: A ? z : void 0 },
1793
+ defer: !0,
1794
+ children: /* @__PURE__ */ s(
1795
+ "table",
1796
+ {
1797
+ className: "text-sm",
1798
+ style: {
1799
+ tableLayout: "fixed",
1800
+ width: "100%",
1801
+ minWidth: "max-content",
1802
+ borderCollapse: "separate",
1803
+ borderSpacing: 0
1804
+ },
1805
+ children: [
1806
+ /* @__PURE__ */ s("colgroup", { children: [
1807
+ te && /* @__PURE__ */ e("col", { style: { width: 40 } }),
1808
+ pe.map((i) => /* @__PURE__ */ e(
1809
+ "col",
1810
+ {
1811
+ style: { width: de[i.key] ?? 150 }
1812
+ },
1813
+ i.key
1814
+ ))
1815
+ ] }),
1816
+ /* @__PURE__ */ e(
1817
+ "thead",
1818
+ {
1819
+ style: f ? {
1820
+ position: "sticky",
1821
+ top: 0,
1822
+ zIndex: 10,
1823
+ backdropFilter: "blur(14px)",
1824
+ WebkitBackdropFilter: "blur(14px)"
1825
+ } : void 0,
1826
+ children: je()
1827
+ }
1828
+ ),
1829
+ /* @__PURE__ */ e("tbody", { children: $t.map((i, h) => {
1830
+ const v = n(i), S = te && c.has(v), D = !!p, V = S && C ? "color-mix(in srgb, var(--primary) 8%, var(--bg-card))" : h % 2 === 1 ? "color-mix(in srgb, var(--bg-input) 50%, var(--bg-card))" : "var(--bg-card)";
1831
+ return /* @__PURE__ */ s(
1832
+ "tr",
1833
+ {
1834
+ onClick: D ? () => p(i) : void 0,
1835
+ className: `transition-colors ${D ? "cursor-pointer" : ""} ${w ? w(i) : ""}`,
1836
+ style: {
1837
+ "--dt-row-bg": V,
1838
+ "--dt-sticky-bg": V,
1839
+ background: "var(--dt-row-bg)"
1840
+ },
1841
+ onMouseEnter: (H) => {
1842
+ S || (H.currentTarget.style.setProperty(
1843
+ "--dt-row-bg",
1844
+ "var(--bg-hover)"
1845
+ ), H.currentTarget.style.setProperty(
1846
+ "--dt-sticky-bg",
1847
+ Rt
1848
+ ));
1849
+ },
1850
+ onMouseLeave: (H) => {
1851
+ H.currentTarget.style.setProperty("--dt-row-bg", V), H.currentTarget.style.setProperty(
1852
+ "--dt-sticky-bg",
1853
+ V
1854
+ );
1855
+ },
1856
+ children: [
1857
+ te && /* @__PURE__ */ e(
1858
+ "td",
1859
+ {
1860
+ className: `${T ? "px-2 py-1.5" : "px-3 py-2"} w-10`,
1861
+ style: W ? {
1862
+ position: "sticky",
1863
+ left: 0,
1864
+ zIndex: 3,
1865
+ background: "var(--dt-sticky-bg)",
1866
+ boxShadow: "inset 0 -1px 0 var(--border)"
1867
+ } : {
1868
+ borderBottom: "1px solid var(--border)",
1869
+ borderRight: "1px solid var(--border)"
1870
+ },
1871
+ onClick: (H) => {
1872
+ H.stopPropagation(), d(v);
1873
+ },
1874
+ children: /* @__PURE__ */ e(
1875
+ "input",
1876
+ {
1877
+ type: "checkbox",
1878
+ checked: S,
1879
+ onClick: (H) => H.stopPropagation(),
1880
+ onChange: () => d(v),
1881
+ className: "rounded cursor-pointer accent-[var(--primary)]"
1882
+ }
1883
+ )
1884
+ }
1885
+ ),
1886
+ pe.map((H, me) => {
1887
+ const _ = W && !P && me === 0;
1888
+ return /* @__PURE__ */ e(
1889
+ "td",
1890
+ {
1891
+ className: `${T ? "px-2 py-1.5" : "px-3 py-2"} ${gr} ${Fe(H.align)} ${H.className ?? ""}`,
1892
+ style: {
1893
+ overflow: "hidden",
1894
+ whiteSpace: "nowrap",
1895
+ ..._ ? {
1896
+ position: "sticky",
1897
+ left: Le,
1898
+ zIndex: 3,
1899
+ background: "var(--dt-sticky-bg)",
1900
+ boxShadow: "3px 0 6px -2px rgba(0,0,0,0.12), inset 0 -1px 0 var(--border)",
1901
+ borderRight: "1px solid var(--border)"
1902
+ } : {
1903
+ borderBottom: "1px solid var(--border)",
1904
+ borderRight: "1px solid var(--border)"
1905
+ }
1906
+ },
1907
+ children: /* @__PURE__ */ e(at, { children: H.cell(i) })
1908
+ },
1909
+ H.key
1910
+ );
1911
+ })
1912
+ ]
1913
+ },
1914
+ v
1915
+ );
1916
+ }) })
1917
+ ]
1918
+ }
1919
+ )
1920
+ }
1921
+ ) }),
1922
+ Ue()
1923
+ ]
1924
+ }
1925
+ );
1926
+ }
1927
+ function be(t) {
1928
+ return t ? /* @__PURE__ */ new Date(`${t}T12:00:00`) : void 0;
1929
+ }
1930
+ function ot(t) {
1931
+ return t.toISOString().slice(0, 10);
1932
+ }
1933
+ function vr({
1934
+ calendarMonth: t,
1935
+ displayIndex: r
1936
+ }) {
1937
+ const { previousMonth: n, nextMonth: a, goToMonth: l, months: u, labels: m, formatters: p } = er(), c = !!n && r === 0, d = !!a && r === u.length - 1;
1938
+ return /* @__PURE__ */ s(
1939
+ "div",
1940
+ {
1941
+ style: {
1942
+ display: "flex",
1943
+ alignItems: "center",
1944
+ justifyContent: "center",
1945
+ gap: 8,
1946
+ width: "100%",
1947
+ color: "var(--text-main)",
1948
+ marginBottom: 6
1949
+ },
1950
+ children: [
1951
+ /* @__PURE__ */ e("span", { style: { fontWeight: 700 }, children: p.formatCaption(t.date) }),
1952
+ /* @__PURE__ */ e(
1953
+ "button",
1954
+ {
1955
+ type: "button",
1956
+ "aria-label": m.labelPrevious(n),
1957
+ onClick: () => n && l(n),
1958
+ disabled: !c,
1959
+ style: {
1960
+ height: 28,
1961
+ width: 28,
1962
+ borderRadius: 8,
1963
+ border: "1px solid var(--border)",
1964
+ background: "var(--bg-card)",
1965
+ display: "inline-flex",
1966
+ alignItems: "center",
1967
+ justifyContent: "center",
1968
+ color: "var(--text-main)",
1969
+ opacity: c ? 1 : 0.45,
1970
+ cursor: c ? "pointer" : "not-allowed"
1971
+ },
1972
+ children: /* @__PURE__ */ e(Se, { size: 16 })
1973
+ }
1974
+ ),
1975
+ /* @__PURE__ */ e(
1976
+ "button",
1977
+ {
1978
+ type: "button",
1979
+ "aria-label": m.labelNext(a),
1980
+ onClick: () => a && l(a),
1981
+ disabled: !d,
1982
+ style: {
1983
+ height: 28,
1984
+ width: 28,
1985
+ borderRadius: 8,
1986
+ border: "1px solid var(--border)",
1987
+ background: "var(--bg-card)",
1988
+ display: "inline-flex",
1989
+ alignItems: "center",
1990
+ justifyContent: "center",
1991
+ color: "var(--text-main)",
1992
+ opacity: d ? 1 : 0.45,
1993
+ cursor: d ? "pointer" : "not-allowed"
1994
+ },
1995
+ children: /* @__PURE__ */ e(xe, { size: 16 })
1996
+ }
1997
+ )
1998
+ ]
1999
+ }
2000
+ );
2001
+ }
2002
+ function yr(t) {
2003
+ return t.charAt(0).toUpperCase() + t.slice(1);
2004
+ }
2005
+ function on({
2006
+ startDate: t,
2007
+ endDate: r,
2008
+ onChange: n,
2009
+ minDate: a,
2010
+ viewMonth: l,
2011
+ numberOfMonths: u = 1,
2012
+ showSummary: m = !0,
2013
+ startLabel: p = "Inicio",
2014
+ endLabel: c = "Regreso"
2015
+ }) {
2016
+ const d = {
2017
+ from: be(t),
2018
+ to: be(r)
2019
+ }, y = be(a), [C, w] = E(
2020
+ be(l || t)
2021
+ );
2022
+ return R(() => {
2023
+ w(be(l || t));
2024
+ }, [l, t]), /* @__PURE__ */ s("div", { children: [
2025
+ /* @__PURE__ */ e(
2026
+ "div",
2027
+ {
2028
+ style: {
2029
+ borderRadius: 10,
2030
+ overflow: "hidden",
2031
+ border: "1px solid var(--border)",
2032
+ background: "var(--bg-input)",
2033
+ display: "flex",
2034
+ justifyContent: "center",
2035
+ padding: "10px 8px"
2036
+ },
2037
+ children: /* @__PURE__ */ e(
2038
+ Qt,
2039
+ {
2040
+ mode: "range",
2041
+ selected: d,
2042
+ month: C,
2043
+ onMonthChange: w,
2044
+ onSelect: (f) => {
2045
+ const g = f != null && f.from ? ot(f.from) : t, b = f != null && f.to ? ot(f.to) : "";
2046
+ n({ startDate: g, endDate: b });
2047
+ },
2048
+ numberOfMonths: u,
2049
+ hideNavigation: !0,
2050
+ disabled: y ? { before: y } : void 0,
2051
+ showOutsideDays: !1,
2052
+ components: {
2053
+ MonthCaption: vr
2054
+ },
2055
+ className: "text-sm",
2056
+ classNames: {
2057
+ root: "w-full",
2058
+ months: "flex gap-3 justify-center",
2059
+ month: "space-y-2",
2060
+ month_caption: "flex items-center justify-between px-1",
2061
+ caption_label: "capitalize",
2062
+ nav: "flex items-center gap-1",
2063
+ button_previous: "h-8 w-8 inline-flex items-center justify-center rounded-md transition-colors",
2064
+ button_next: "h-8 w-8 inline-flex items-center justify-center rounded-md transition-colors",
2065
+ month_grid: "w-full border-collapse",
2066
+ weekdays: "grid grid-cols-7 gap-1 mb-1",
2067
+ weekday: "text-[11px] font-semibold text-center",
2068
+ week: "grid grid-cols-7 gap-1",
2069
+ day: "h-9 w-9 p-0 flex items-center justify-center",
2070
+ day_button: "h-9 w-9 rounded-md text-sm font-medium transition-colors outline-none",
2071
+ selected: "font-semibold",
2072
+ range_start: "font-semibold",
2073
+ range_middle: "font-medium",
2074
+ range_end: "font-semibold",
2075
+ today: "font-bold",
2076
+ disabled: "opacity-40 cursor-not-allowed",
2077
+ hidden: "invisible"
2078
+ },
2079
+ styles: {
2080
+ month_caption: {
2081
+ color: "var(--text-main)",
2082
+ marginBottom: 6,
2083
+ display: "flex",
2084
+ alignItems: "center",
2085
+ justifyContent: "space-between"
2086
+ },
2087
+ caption_label: { color: "var(--text-main)", fontWeight: 700 },
2088
+ nav: {
2089
+ position: "static",
2090
+ display: "flex",
2091
+ alignItems: "center",
2092
+ gap: 6
2093
+ },
2094
+ weekday: {
2095
+ color: "var(--text-muted)",
2096
+ textTransform: "lowercase"
2097
+ },
2098
+ button_previous: {
2099
+ height: 32,
2100
+ width: 32,
2101
+ background: "var(--bg-card)",
2102
+ color: "var(--text-main)",
2103
+ border: "1px solid var(--border)"
2104
+ },
2105
+ button_next: {
2106
+ height: 32,
2107
+ width: 32,
2108
+ background: "var(--bg-card)",
2109
+ color: "var(--text-main)",
2110
+ border: "1px solid var(--border)"
2111
+ },
2112
+ day_button: {
2113
+ color: "var(--text-main)",
2114
+ borderRadius: 8
2115
+ },
2116
+ chevron: {
2117
+ fill: "var(--text-main)"
2118
+ },
2119
+ today: {
2120
+ border: "1px solid color-mix(in srgb, var(--primary) 35%, transparent)"
2121
+ },
2122
+ disabled: {
2123
+ color: "var(--text-muted)"
2124
+ }
2125
+ },
2126
+ modifiersStyles: {
2127
+ selected: {
2128
+ background: "var(--primary)",
2129
+ color: "var(--primary-fg, #ffffff)"
2130
+ },
2131
+ range_start: {
2132
+ background: "var(--primary)",
2133
+ color: "var(--primary-fg, #ffffff)"
2134
+ },
2135
+ range_end: {
2136
+ background: "var(--primary)",
2137
+ color: "var(--primary-fg, #ffffff)"
2138
+ },
2139
+ range_middle: {
2140
+ background: "color-mix(in srgb, var(--primary) 20%, transparent)",
2141
+ color: "var(--text-main)"
2142
+ }
2143
+ },
2144
+ formatters: {
2145
+ formatCaption: (f) => yr(
2146
+ new Intl.DateTimeFormat("es-MX", {
2147
+ month: "long",
2148
+ year: "numeric"
2149
+ }).format(f)
2150
+ ),
2151
+ formatWeekdayName: (f) => new Intl.DateTimeFormat("es-MX", {
2152
+ weekday: "short"
2153
+ }).format(f)
2154
+ },
2155
+ labels: {
2156
+ labelMonthDropdown: () => "Mes",
2157
+ labelYearDropdown: () => "Año"
2158
+ }
2159
+ }
2160
+ )
2161
+ }
2162
+ ),
2163
+ m && t && /* @__PURE__ */ s(
2164
+ "div",
2165
+ {
2166
+ style: {
2167
+ marginTop: 8,
2168
+ fontSize: 12,
2169
+ color: "var(--text-muted)",
2170
+ display: "flex",
2171
+ gap: 8,
2172
+ flexWrap: "wrap"
2173
+ },
2174
+ children: [
2175
+ /* @__PURE__ */ s("span", { children: [
2176
+ p,
2177
+ ":",
2178
+ " ",
2179
+ /* @__PURE__ */ e("strong", { style: { color: "var(--text-main)" }, children: t })
2180
+ ] }),
2181
+ r && /* @__PURE__ */ s("span", { children: [
2182
+ c,
2183
+ ":",
2184
+ " ",
2185
+ /* @__PURE__ */ e("strong", { style: { color: "var(--text-main)" }, children: r })
2186
+ ] })
2187
+ ]
2188
+ }
2189
+ )
2190
+ ] });
2191
+ }
2192
+ function sn({
2193
+ open: t,
2194
+ onClose: r,
2195
+ title: n,
2196
+ subtitle: a,
2197
+ leadingIcon: l,
2198
+ confirmLabel: u = "Guardar",
2199
+ onConfirm: m,
2200
+ loading: p = !1,
2201
+ confirmDisabled: c = !1,
2202
+ headerActions: d,
2203
+ bodyClassName: y = "flex-1 overflow-y-auto px-6 py-5",
2204
+ width: C = 440,
2205
+ children: w
2206
+ }) {
2207
+ const [f, g] = E(!1);
2208
+ return R(() => {
2209
+ g(!0);
2210
+ }, []), R(() => (document.body.style.overflow = t ? "hidden" : "", () => {
2211
+ document.body.style.overflow = "";
2212
+ }), [t]), R(() => {
2213
+ if (!t) return;
2214
+ const b = (N) => {
2215
+ N.key === "Escape" && r();
2216
+ };
2217
+ return window.addEventListener("keydown", b), () => window.removeEventListener("keydown", b);
2218
+ }, [t, r]), f ? Ee(
2219
+ /* @__PURE__ */ s(
2220
+ "div",
2221
+ {
2222
+ "aria-hidden": !t,
2223
+ className: `fixed inset-0 z-[1000] flex transition-opacity duration-300 ${t ? "opacity-100" : "opacity-0 pointer-events-none"}`,
2224
+ children: [
2225
+ /* @__PURE__ */ e(
2226
+ "div",
2227
+ {
2228
+ className: "absolute inset-0 bg-black/40 backdrop-blur-sm",
2229
+ onClick: r
2230
+ }
2231
+ ),
2232
+ /* @__PURE__ */ s(
2233
+ "div",
2234
+ {
2235
+ className: `absolute inset-y-0 right-0 flex flex-col shadow-2xl transition-transform duration-300 ${t ? "translate-x-0" : "translate-x-full"}`,
2236
+ style: {
2237
+ width: `min(100vw, ${C}px)`,
2238
+ background: "var(--bg-card)",
2239
+ borderLeft: "1px solid var(--border)"
2240
+ },
2241
+ children: [
2242
+ /* @__PURE__ */ s(
2243
+ "div",
2244
+ {
2245
+ className: "flex items-center justify-between px-6 py-4 flex-shrink-0",
2246
+ style: { borderBottom: "1px solid var(--border)" },
2247
+ children: [
2248
+ /* @__PURE__ */ s("div", { className: "flex items-center gap-3 min-w-0", children: [
2249
+ /* @__PURE__ */ e(ne, { variant: "icon", onClick: r, title: "Cerrar", children: /* @__PURE__ */ e(ce, { className: "w-5 h-5" }) }),
2250
+ l && /* @__PURE__ */ e("div", { className: "flex-shrink-0", children: l }),
2251
+ /* @__PURE__ */ s("div", { className: "min-w-0", children: [
2252
+ /* @__PURE__ */ e(
2253
+ "h3",
2254
+ {
2255
+ className: "text-base font-semibold truncate",
2256
+ style: { color: "var(--text-main)" },
2257
+ children: n
2258
+ }
2259
+ ),
2260
+ a && /* @__PURE__ */ e(
2261
+ "p",
2262
+ {
2263
+ className: "text-xs truncate",
2264
+ style: { color: "var(--text-muted)" },
2265
+ children: a
2266
+ }
2267
+ )
2268
+ ] })
2269
+ ] }),
2270
+ (d || m) && /* @__PURE__ */ s("div", { className: "flex items-center gap-2 flex-shrink-0", children: [
2271
+ d,
2272
+ m && /* @__PURE__ */ s(le, { children: [
2273
+ /* @__PURE__ */ e(
2274
+ ne,
2275
+ {
2276
+ variant: "secondary",
2277
+ size: "sm",
2278
+ onClick: r,
2279
+ style: { background: "var(--bg-input)" },
2280
+ children: "Cancelar"
2281
+ }
2282
+ ),
2283
+ /* @__PURE__ */ e(
2284
+ ne,
2285
+ {
2286
+ variant: "primary",
2287
+ size: "sm",
2288
+ icon: /* @__PURE__ */ e(tr, { className: "w-4 h-4" }),
2289
+ onClick: m,
2290
+ loading: p,
2291
+ disabled: c,
2292
+ title: u
2293
+ }
2294
+ )
2295
+ ] })
2296
+ ] })
2297
+ ]
2298
+ }
2299
+ ),
2300
+ /* @__PURE__ */ e("div", { "data-drawer-scroll": "true", className: y, children: w })
2301
+ ]
2302
+ }
2303
+ )
2304
+ ]
2305
+ }
2306
+ ),
2307
+ document.body
2308
+ ) : null;
2309
+ }
2310
+ function it({
2311
+ className: t = "",
2312
+ ...r
2313
+ }) {
2314
+ return /* @__PURE__ */ e(
2315
+ "input",
2316
+ {
2317
+ ...r,
2318
+ className: `h-11 rounded-lg border border-[var(--border)] bg-[var(--bg-input)] px-3 py-2 text-sm text-[var(--text-main)] outline-none placeholder:text-[var(--text-muted)] transition-colors focus:border-[var(--primary)] ${t}`
2319
+ }
2320
+ );
2321
+ }
2322
+ function ln({
2323
+ label: t,
2324
+ containerClassName: r = "",
2325
+ helperText: n,
2326
+ error: a,
2327
+ labelAction: l,
2328
+ floatingLabel: u = !1,
2329
+ showPasswordToggle: m = !0,
2330
+ className: p = "",
2331
+ required: c,
2332
+ ...d
2333
+ }) {
2334
+ const [y, C] = E(() => !!d.autoFocus), [w, f] = E(!1), g = d.type === "password" && m, b = g && w ? "text" : d.type, N = d.value !== void 0 ? String(d.value).length > 0 : d.defaultValue !== void 0 && String(d.defaultValue).length > 0, L = y || N, X = {
2335
+ top: L ? 8 : 15,
2336
+ color: y ? "var(--primary)" : "var(--text-muted)",
2337
+ fontSize: L ? 11 : 14,
2338
+ fontWeight: L ? 600 : 400,
2339
+ textTransform: L ? "uppercase" : "none"
2340
+ }, Y = (M) => {
2341
+ var $;
2342
+ C(!0), ($ = d.onFocus) == null || $.call(d, M);
2343
+ }, k = (M) => {
2344
+ var $;
2345
+ C(!1), ($ = d.onBlur) == null || $.call(d, M);
2346
+ };
2347
+ return u ? /* @__PURE__ */ s("label", { className: `flex flex-col gap-2 ${r}`, children: [
2348
+ /* @__PURE__ */ s("span", { className: "relative block", children: [
2349
+ /* @__PURE__ */ e(
2350
+ it,
2351
+ {
2352
+ ...d,
2353
+ type: b,
2354
+ required: c,
2355
+ placeholder: " ",
2356
+ "aria-invalid": !!a || d["aria-invalid"],
2357
+ "data-has-value": N ? "true" : void 0,
2358
+ className: `h-12 w-full pt-5 ${g ? "pr-10" : ""} ${p}`,
2359
+ onFocus: Y,
2360
+ onBlur: k
2361
+ }
2362
+ ),
2363
+ /* @__PURE__ */ s(
2364
+ "span",
2365
+ {
2366
+ className: "pointer-events-none absolute left-3 transition-all duration-150",
2367
+ style: X,
2368
+ children: [
2369
+ t,
2370
+ c && /* @__PURE__ */ e("span", { className: "ml-1 text-[var(--danger)]", children: "*" })
2371
+ ]
2372
+ }
2373
+ ),
2374
+ l && /* @__PURE__ */ e(
2375
+ "span",
2376
+ {
2377
+ className: "absolute right-2 transition-all duration-150",
2378
+ style: { top: L ? 8 : 15 },
2379
+ children: l
2380
+ }
2381
+ ),
2382
+ g && /* @__PURE__ */ e(
2383
+ "button",
2384
+ {
2385
+ type: "button",
2386
+ "aria-label": w ? "Ocultar contraseña" : "Mostrar contraseña",
2387
+ className: "absolute right-3 top-1/2 -translate-y-1/2 transition-colors",
2388
+ style: { color: "var(--text-muted)" },
2389
+ tabIndex: -1,
2390
+ onClick: () => f((M) => !M),
2391
+ children: w ? /* @__PURE__ */ e(Ht, { className: "h-[18px] w-[18px]" }) : /* @__PURE__ */ e(Wt, { className: "h-[18px] w-[18px]" })
2392
+ }
2393
+ )
2394
+ ] }),
2395
+ a ? /* @__PURE__ */ e("span", { className: "text-xs font-medium normal-case text-[var(--danger)]", children: a }) : n ? /* @__PURE__ */ e("span", { className: "text-xs font-medium normal-case text-[var(--text-muted)]", children: n }) : null
2396
+ ] }) : /* @__PURE__ */ s("label", { className: `flex flex-col gap-2 ${r}`, children: [
2397
+ /* @__PURE__ */ s("span", { className: "inline-flex items-center gap-1 text-xs font-semibold uppercase text-[var(--text-muted)]", children: [
2398
+ /* @__PURE__ */ e("span", { children: t }),
2399
+ c && /* @__PURE__ */ e("span", { className: "text-[var(--danger)]", children: "*" }),
2400
+ l && /* @__PURE__ */ e("span", { className: "ml-auto normal-case", children: l })
2401
+ ] }),
2402
+ /* @__PURE__ */ e(
2403
+ it,
2404
+ {
2405
+ ...d,
2406
+ required: c,
2407
+ "aria-invalid": !!a || d["aria-invalid"],
2408
+ className: p
2409
+ }
2410
+ ),
2411
+ a ? /* @__PURE__ */ e("span", { className: "text-xs font-medium normal-case text-[var(--danger)]", children: a }) : n ? /* @__PURE__ */ e("span", { className: "text-xs font-medium normal-case text-[var(--text-muted)]", children: n }) : null
2412
+ ] });
2413
+ }
2414
+ function cn({
2415
+ variant: t = "page",
2416
+ title: r = "Cargando...",
2417
+ rows: n = 6,
2418
+ children: a
2419
+ }) {
2420
+ return t === "table" ? /* @__PURE__ */ e(bt, { rows: n }) : t === "sections" ? /* @__PURE__ */ e(wr, { rows: n }) : t === "cards" ? /* @__PURE__ */ e(Nr, { rows: n }) : /* @__PURE__ */ e("div", { className: "flex min-h-[240px] items-center justify-center rounded-lg border border-[var(--border)] bg-[var(--bg-card)] p-6", children: /* @__PURE__ */ s("div", { className: "flex flex-col items-center gap-3 text-center", children: [
2421
+ /* @__PURE__ */ e("div", { className: "h-9 w-9 animate-spin rounded-full border-2 border-[var(--border)] border-t-[var(--primary)]" }),
2422
+ /* @__PURE__ */ s("div", { children: [
2423
+ /* @__PURE__ */ e("p", { className: "text-sm font-semibold text-[var(--text-main)]", children: r }),
2424
+ a && /* @__PURE__ */ e("div", { className: "mt-1 text-xs text-[var(--text-muted)]", children: a })
2425
+ ] })
2426
+ ] }) });
2427
+ }
2428
+ function wr({ rows: t }) {
2429
+ return /* @__PURE__ */ e("div", { className: "space-y-4", children: Array.from({ length: Math.max(2, Math.min(t, 4)) }).map(
2430
+ (r, n) => /* @__PURE__ */ s(
2431
+ "section",
2432
+ {
2433
+ className: "overflow-hidden rounded-lg border border-[var(--border)] bg-[var(--bg-card)]",
2434
+ children: [
2435
+ /* @__PURE__ */ s("div", { className: "flex items-center justify-between gap-3 border-b border-[var(--border)] px-3 py-3", children: [
2436
+ /* @__PURE__ */ s("div", { className: "flex items-center gap-2", children: [
2437
+ /* @__PURE__ */ e("div", { className: "h-4 w-4 animate-pulse rounded bg-[var(--bg-input)]" }),
2438
+ /* @__PURE__ */ e("div", { className: "h-4 w-32 animate-pulse rounded bg-[var(--bg-input)]" }),
2439
+ /* @__PURE__ */ e("div", { className: "h-5 w-20 animate-pulse rounded-full bg-[var(--bg-input)]" })
2440
+ ] }),
2441
+ /* @__PURE__ */ s("div", { className: "flex gap-1", children: [
2442
+ /* @__PURE__ */ e("div", { className: "h-8 w-8 animate-pulse rounded-md bg-[var(--bg-input)]" }),
2443
+ /* @__PURE__ */ e("div", { className: "h-8 w-8 animate-pulse rounded-md bg-[var(--bg-input)]" })
2444
+ ] })
2445
+ ] }),
2446
+ /* @__PURE__ */ e(
2447
+ bt,
2448
+ {
2449
+ rows: n === 0 ? t : Math.max(3, t - 2),
2450
+ compact: !0
2451
+ }
2452
+ )
2453
+ ]
2454
+ },
2455
+ n
2456
+ )
2457
+ ) });
2458
+ }
2459
+ function Nr({ rows: t }) {
2460
+ return /* @__PURE__ */ e("div", { className: "grid gap-3 md:grid-cols-2 xl:grid-cols-3", children: Array.from({ length: t }).map((r, n) => /* @__PURE__ */ s(
2461
+ "div",
2462
+ {
2463
+ className: "rounded-lg border border-[var(--border)] bg-[var(--bg-card)] p-4",
2464
+ children: [
2465
+ /* @__PURE__ */ e("div", { className: "h-4 w-2/3 animate-pulse rounded bg-[var(--bg-input)]" }),
2466
+ /* @__PURE__ */ e("div", { className: "mt-3 h-3 w-full animate-pulse rounded bg-[var(--bg-input)]" }),
2467
+ /* @__PURE__ */ e("div", { className: "mt-2 h-3 w-4/5 animate-pulse rounded bg-[var(--bg-input)]" })
2468
+ ]
2469
+ },
2470
+ n
2471
+ )) });
2472
+ }
2473
+ function bt({
2474
+ rows: t,
2475
+ compact: r = !1
2476
+ }) {
2477
+ const n = r ? 5 : 6;
2478
+ return /* @__PURE__ */ s("div", { className: "overflow-hidden rounded-lg border border-[var(--border)] bg-[var(--bg-card)]", children: [
2479
+ /* @__PURE__ */ e(
2480
+ "div",
2481
+ {
2482
+ className: "grid border-b border-[var(--border)]",
2483
+ style: { gridTemplateColumns: `repeat(${n}, minmax(0, 1fr))` },
2484
+ children: Array.from({ length: n }).map((a, l) => /* @__PURE__ */ e("div", { className: "px-3 py-3", children: /* @__PURE__ */ e("div", { className: "h-3 w-2/3 animate-pulse rounded bg-[var(--bg-input)]" }) }, l))
2485
+ }
2486
+ ),
2487
+ Array.from({ length: t }).map((a, l) => /* @__PURE__ */ e(
2488
+ "div",
2489
+ {
2490
+ className: "grid border-b border-[var(--border)] last:border-b-0",
2491
+ style: { gridTemplateColumns: `repeat(${n}, minmax(0, 1fr))` },
2492
+ children: Array.from({ length: n }).map((u, m) => /* @__PURE__ */ e("div", { className: "px-3 py-3", children: /* @__PURE__ */ e(
2493
+ "div",
2494
+ {
2495
+ className: "h-3.5 animate-pulse rounded-full bg-[var(--bg-input)]",
2496
+ style: {
2497
+ width: `${52 + (l * 13 + m * 11) % 36}%`
2498
+ }
2499
+ }
2500
+ ) }, m))
2501
+ },
2502
+ l
2503
+ ))
2504
+ ] });
2505
+ }
2506
+ const kr = {
2507
+ xs: {
2508
+ width: 28,
2509
+ height: 16,
2510
+ thumb: 12,
2511
+ padding: 2
2512
+ },
2513
+ sm: {
2514
+ width: 36,
2515
+ height: 20,
2516
+ thumb: 16,
2517
+ padding: 2
2518
+ }
2519
+ };
2520
+ function dn({
2521
+ checked: t,
2522
+ disabled: r,
2523
+ onCheckedChange: n,
2524
+ size: a = "sm",
2525
+ className: l = "",
2526
+ ...u
2527
+ }) {
2528
+ const m = kr[a], p = t ? m.width - m.thumb - m.padding * 2 : 0;
2529
+ return /* @__PURE__ */ e(
2530
+ "button",
2531
+ {
2532
+ ...u,
2533
+ type: "button",
2534
+ role: "switch",
2535
+ "aria-checked": t,
2536
+ disabled: r,
2537
+ onClick: () => !r && n(!t),
2538
+ className: `relative inline-flex shrink-0 items-center rounded-full transition-colors focus:outline-none focus-visible:ring-2 focus-visible:ring-[var(--primary)]/50 disabled:cursor-not-allowed disabled:opacity-50 ${l}`,
2539
+ style: {
2540
+ width: m.width,
2541
+ height: m.height,
2542
+ background: t ? "color-mix(in srgb, var(--primary) 85%, transparent)" : "var(--bg-input)",
2543
+ border: t ? "1px solid color-mix(in srgb, var(--primary) 55%, transparent)" : "1px solid var(--border)"
2544
+ },
2545
+ children: /* @__PURE__ */ e(
2546
+ "span",
2547
+ {
2548
+ className: "absolute inline-block rounded-full transition-transform",
2549
+ style: {
2550
+ width: m.thumb,
2551
+ height: m.thumb,
2552
+ left: m.padding,
2553
+ top: "50%",
2554
+ transform: `translate(${p}px, -50%)`,
2555
+ background: t ? "var(--primary-fg)" : "var(--text-muted)"
2556
+ }
2557
+ }
2558
+ )
2559
+ }
2560
+ );
2561
+ }
2562
+ const st = [
2563
+ ".sidebar-scroll",
2564
+ "[data-overlay-scroll='true']"
2565
+ ].join(",");
2566
+ function Sr(t) {
2567
+ if (!(t instanceof HTMLElement) || t.dataset.overlayScroll === "false" || t.closest("[data-overlayscrollbars]") || t.matches("textarea,input,select,[contenteditable='true']"))
2568
+ return !1;
2569
+ const r = window.getComputedStyle(t);
2570
+ return !(![
2571
+ r.overflow,
2572
+ r.overflowX,
2573
+ r.overflowY
2574
+ ].join(" ").match(/auto|scroll/) || t.clientWidth === 0 && t.clientHeight === 0);
2575
+ }
2576
+ function gt(t) {
2577
+ return t.classList.contains("sidebar-scroll");
2578
+ }
2579
+ function lt(t) {
2580
+ gt(t) && t.querySelectorAll(".os-scrollbar-horizontal").forEach((r) => {
2581
+ r.style.display = "none", r.style.height = "0", r.style.pointerEvents = "none";
2582
+ });
2583
+ }
2584
+ function Cr() {
2585
+ return R(() => {
2586
+ const t = /* @__PURE__ */ new WeakMap();
2587
+ let r = 0;
2588
+ const n = () => {
2589
+ r = 0, document.querySelectorAll(st).forEach((u) => {
2590
+ if (!Sr(u)) return;
2591
+ if (et(u)) {
2592
+ lt(u);
2593
+ return;
2594
+ }
2595
+ const p = et(u, {
2596
+ overflow: gt(u) ? { x: "hidden", y: "scroll" } : void 0,
2597
+ scrollbars: {
2598
+ autoHide: "leave",
2599
+ autoHideDelay: 180
2600
+ }
2601
+ });
2602
+ lt(u), t.set(u, p);
2603
+ });
2604
+ }, a = () => {
2605
+ r || (r = window.requestAnimationFrame(n));
2606
+ };
2607
+ n();
2608
+ const l = new MutationObserver(a);
2609
+ return l.observe(document.body, {
2610
+ childList: !0,
2611
+ subtree: !0,
2612
+ attributes: !0,
2613
+ attributeFilter: ["class", "data-overlay-scroll"]
2614
+ }), window.addEventListener("resize", a), () => {
2615
+ r && window.cancelAnimationFrame(r), l.disconnect(), window.removeEventListener("resize", a), document.querySelectorAll(st).forEach((u) => {
2616
+ var m;
2617
+ u instanceof HTMLElement && ((m = t.get(u)) == null || m.destroy());
2618
+ });
2619
+ };
2620
+ }, []), null;
2621
+ }
2622
+ const Er = {
2623
+ xs: { wh: "w-5 h-5", text: "text-[8px]" },
2624
+ sm: { wh: "w-7 h-7", text: "text-[11px]" },
2625
+ md: { wh: "w-9 h-9", text: "text-sm" },
2626
+ lg: { wh: "w-12 h-12", text: "text-base" },
2627
+ xl: { wh: "w-16 h-16", text: "text-xl" }
2628
+ }, ct = [
2629
+ "bg-emerald-600",
2630
+ "bg-teal-600",
2631
+ "bg-lime-600",
2632
+ "bg-cyan-700",
2633
+ "bg-slate-600"
2634
+ ];
2635
+ function dt(t) {
2636
+ return typeof t == "string" ? t.trim() : "";
2637
+ }
2638
+ function Mr(t) {
2639
+ return ct[[...t].reduce((r, n) => r + n.charCodeAt(0), 0) % ct.length];
2640
+ }
2641
+ function $r({
2642
+ userId: t,
2643
+ username: r,
2644
+ name: n,
2645
+ size: a = "md",
2646
+ className: l = "",
2647
+ style: u
2648
+ }) {
2649
+ const { wh: m, text: p } = Er[a], c = dt(n) || dt(r) || "Usuario";
2650
+ return /* @__PURE__ */ e(
2651
+ "span",
2652
+ {
2653
+ className: `${m} ${Mr(c)} ${p} rounded-full flex items-center justify-center font-black text-white uppercase flex-shrink-0 ${l}`,
2654
+ style: u,
2655
+ children: c[0]
2656
+ }
2657
+ );
2658
+ }
2659
+ function Lr({ href: t, className: r, children: n }) {
2660
+ return /* @__PURE__ */ e("a", { href: t, className: r, children: n });
2661
+ }
2662
+ function Tr(t) {
2663
+ return t.reduce((r, n) => {
2664
+ const a = n.section ?? "Principal";
2665
+ return r[a] = [...r[a] ?? [], n], r;
2666
+ }, {});
2667
+ }
2668
+ function Br({
2669
+ children: t,
2670
+ navItems: r = [],
2671
+ currentPath: n = typeof window > "u" ? "/" : window.location.pathname,
2672
+ user: a,
2673
+ appName: l = "Bonsaif",
2674
+ appLogo: u,
2675
+ header: m,
2676
+ footer: p,
2677
+ onLogout: c,
2678
+ LinkComponent: d = Lr
2679
+ }) {
2680
+ const [y, C] = E(!1), w = Tr(r);
2681
+ return /* @__PURE__ */ s("div", { className: "min-h-screen bg-[var(--bg-main)] text-[var(--text-main)]", children: [
2682
+ /* @__PURE__ */ e(Cr, {}),
2683
+ /* @__PURE__ */ e(
2684
+ "button",
2685
+ {
2686
+ type: "button",
2687
+ "aria-label": "Abrir navegación",
2688
+ className: "fixed left-3 top-3 z-50 inline-flex h-9 w-9 items-center justify-center rounded-md border border-white/10 bg-black/70 text-white lg:hidden",
2689
+ onClick: () => C(!0),
2690
+ children: /* @__PURE__ */ e(Pt, { className: "h-5 w-5" })
2691
+ }
2692
+ ),
2693
+ y && /* @__PURE__ */ e(
2694
+ "button",
2695
+ {
2696
+ type: "button",
2697
+ "aria-label": "Cerrar navegación",
2698
+ className: "fixed inset-0 z-40 bg-black/45 lg:hidden",
2699
+ onClick: () => C(!1)
2700
+ }
2701
+ ),
2702
+ /* @__PURE__ */ s(
2703
+ "aside",
2704
+ {
2705
+ className: `fixed inset-y-0 left-0 z-50 flex w-72 flex-col bg-[#071716] text-white shadow-2xl transition-transform duration-200 lg:translate-x-0 ${y ? "translate-x-0" : "-translate-x-full"}`,
2706
+ children: [
2707
+ /* @__PURE__ */ s("div", { className: "flex h-16 items-center gap-3 border-b border-white/10 px-4", children: [
2708
+ /* @__PURE__ */ e("div", { className: "flex h-9 w-9 items-center justify-center rounded-lg bg-white/10 text-white", children: u ?? /* @__PURE__ */ e(Ce, { className: "h-5 w-5" }) }),
2709
+ /* @__PURE__ */ e("div", { className: "min-w-0 flex-1 truncate text-sm font-semibold", children: l }),
2710
+ /* @__PURE__ */ e(
2711
+ "button",
2712
+ {
2713
+ type: "button",
2714
+ "aria-label": "Cerrar navegación",
2715
+ className: "inline-flex h-8 w-8 items-center justify-center rounded-md text-white/70 hover:bg-white/10 lg:hidden",
2716
+ onClick: () => C(!1),
2717
+ children: /* @__PURE__ */ e(ce, { className: "h-5 w-5" })
2718
+ }
2719
+ )
2720
+ ] }),
2721
+ /* @__PURE__ */ e(
2722
+ "nav",
2723
+ {
2724
+ className: "sidebar-scroll min-h-0 flex-1 overflow-y-auto px-3 py-4",
2725
+ "data-overlay-scroll": "true",
2726
+ children: Object.entries(w).map(([f, g]) => /* @__PURE__ */ s("div", { className: "mb-5", children: [
2727
+ /* @__PURE__ */ s("div", { className: "mb-2 flex items-center gap-2 px-2 text-[11px] font-semibold uppercase tracking-wide text-white/35", children: [
2728
+ /* @__PURE__ */ e(ge, { className: "h-3.5 w-3.5" }),
2729
+ f
2730
+ ] }),
2731
+ /* @__PURE__ */ e("div", { className: "space-y-1", children: g.map((b) => {
2732
+ const N = n === b.href || n.startsWith(`${b.href}/`);
2733
+ return /* @__PURE__ */ s(
2734
+ d,
2735
+ {
2736
+ href: b.href,
2737
+ className: `flex min-w-0 items-center gap-2 rounded-md px-2 py-2 text-sm transition-colors ${N ? "bg-white/10 text-white" : "text-white/55 hover:bg-white/[0.06] hover:text-white/85"}`,
2738
+ children: [
2739
+ /* @__PURE__ */ e("span", { className: "flex h-5 w-5 flex-shrink-0 items-center justify-center", children: b.icon ?? /* @__PURE__ */ e(Ce, { className: "h-4 w-4" }) }),
2740
+ /* @__PURE__ */ e("span", { className: "truncate", children: b.label })
2741
+ ]
2742
+ },
2743
+ b.href
2744
+ );
2745
+ }) })
2746
+ ] }, f))
2747
+ }
2748
+ ),
2749
+ /* @__PURE__ */ s("div", { className: "border-t border-white/10 p-3", children: [
2750
+ a && /* @__PURE__ */ s("div", { className: "mb-3 flex min-w-0 items-center gap-3 rounded-lg bg-white/[0.04] p-2", children: [
2751
+ /* @__PURE__ */ e(
2752
+ $r,
2753
+ {
2754
+ name: a.initials ?? a.name ?? a.email ?? "Usuario",
2755
+ size: "md"
2756
+ }
2757
+ ),
2758
+ /* @__PURE__ */ s("div", { className: "min-w-0 flex-1", children: [
2759
+ /* @__PURE__ */ e("div", { className: "truncate text-sm font-medium text-white", children: a.name ?? "Usuario" }),
2760
+ a.email && /* @__PURE__ */ e("div", { className: "truncate text-xs text-white/45", children: a.email })
2761
+ ] })
2762
+ ] }),
2763
+ c && /* @__PURE__ */ s(
2764
+ ne,
2765
+ {
2766
+ variant: "ghost",
2767
+ className: "w-full justify-start text-white hover:bg-white/10",
2768
+ onClick: c,
2769
+ children: [
2770
+ /* @__PURE__ */ e(_t, { className: "h-4 w-4" }),
2771
+ " Salir"
2772
+ ]
2773
+ }
2774
+ ),
2775
+ p
2776
+ ] })
2777
+ ]
2778
+ }
2779
+ ),
2780
+ /* @__PURE__ */ s("div", { className: "min-h-screen lg:pl-72", children: [
2781
+ m,
2782
+ /* @__PURE__ */ e("main", { className: "min-h-screen", children: t })
2783
+ ] })
2784
+ ] });
2785
+ }
2786
+ const Rr = {
2787
+ dashboard: "Dashboard",
2788
+ tickets: "Tickets",
2789
+ teams: "Equipos",
2790
+ projects: "Proyectos",
2791
+ clients: "Clientes",
2792
+ surveys: "Encuestas",
2793
+ profile: "Perfil",
2794
+ settings: "Configuración",
2795
+ notifications: "Notificaciones",
2796
+ changelog: "Historial",
2797
+ admin: "Inicio",
2798
+ users: "Usuarios",
2799
+ roles: "Roles",
2800
+ menus: "Menús",
2801
+ guards: "Guardias",
2802
+ vacations: "Vacaciones",
2803
+ audit: "Auditoría",
2804
+ positions: "Puestos",
2805
+ ranks: "Rangos",
2806
+ "email-inbox": "Buzones",
2807
+ "security-incidents": "Incidentes",
2808
+ "guard-schedule": "Guardias"
2809
+ }, ze = {
2810
+ dashboard: /* @__PURE__ */ e(Zt, { className: "h-5 w-5" }),
2811
+ tickets: /* @__PURE__ */ e(Jt, { className: "h-5 w-5" }),
2812
+ teams: /* @__PURE__ */ e(Qe, { className: "h-5 w-5" }),
2813
+ projects: /* @__PURE__ */ e(Vt, { className: "h-5 w-5" }),
2814
+ clients: /* @__PURE__ */ e(Xt, { className: "h-5 w-5" }),
2815
+ surveys: /* @__PURE__ */ e(Gt, { className: "h-5 w-5" }),
2816
+ profile: /* @__PURE__ */ e(qt, { className: "h-5 w-5" }),
2817
+ settings: /* @__PURE__ */ e(Ke, { className: "h-5 w-5" }),
2818
+ notifications: /* @__PURE__ */ e(Yt, { className: "h-5 w-5" }),
2819
+ changelog: /* @__PURE__ */ e(Ut, { className: "h-5 w-5" }),
2820
+ admin: /* @__PURE__ */ e(De, { className: "h-5 w-5" }),
2821
+ users: /* @__PURE__ */ e(Qe, { className: "h-5 w-5" }),
2822
+ roles: /* @__PURE__ */ e(De, { className: "h-5 w-5" }),
2823
+ menus: /* @__PURE__ */ e(Ke, { className: "h-5 w-5" }),
2824
+ guards: /* @__PURE__ */ e(Ie, { className: "h-5 w-5" }),
2825
+ vacations: /* @__PURE__ */ e(Ie, { className: "h-5 w-5" }),
2826
+ audit: /* @__PURE__ */ e(Ze, { className: "h-5 w-5" }),
2827
+ positions: /* @__PURE__ */ e(jt, { className: "h-5 w-5" }),
2828
+ ranks: /* @__PURE__ */ e(Ze, { className: "h-5 w-5" }),
2829
+ "email-inbox": /* @__PURE__ */ e(Ft, { className: "h-5 w-5" }),
2830
+ "security-incidents": /* @__PURE__ */ e(De, { className: "h-5 w-5" })
2831
+ };
2832
+ function Dr({
2833
+ href: t,
2834
+ className: r,
2835
+ style: n,
2836
+ children: a
2837
+ }) {
2838
+ return /* @__PURE__ */ e("a", { href: t, className: r, style: n, children: a });
2839
+ }
2840
+ function Ar(t) {
2841
+ return t.split("-").map((r) => r.charAt(0).toUpperCase() + r.slice(1)).join(" ");
2842
+ }
2843
+ function zr(t) {
2844
+ return /^\d+$/.test(t) || /^[a-f0-9]{8,}$/i.test(t);
2845
+ }
2846
+ function Or(t) {
2847
+ const r = t.split("/").filter(Boolean);
2848
+ if (r.length === 0 || r.length === 1 && r[0] === "dashboard")
2849
+ return [];
2850
+ const n = decodeURIComponent(r[r.length - 1]), a = r.length > 1 ? decodeURIComponent(r[r.length - 2]) : void 0, l = zr(n) && a ? a : n, u = Rr[l] ?? Ar(l);
2851
+ return [{ label: "Inicio", href: "/" }, { label: u }];
2852
+ }
2853
+ function Oe(t) {
2854
+ return (t == null ? void 0 : t.querySelector(":scope > .os-viewport")) ?? (t == null ? void 0 : t.querySelector(
2855
+ ":scope > [data-overlayscrollbars-viewport]"
2856
+ ));
2857
+ }
2858
+ function Ir(t) {
2859
+ const r = t.split("/").filter(Boolean), n = r[r.length - 1];
2860
+ if (!n) return /* @__PURE__ */ e(Ce, { className: "h-5 w-5" });
2861
+ if (ze[n]) return ze[n];
2862
+ const a = r.length > 1 ? r[r.length - 2] : "";
2863
+ return ze[a] ?? /* @__PURE__ */ e(Ce, { className: "h-5 w-5" });
2864
+ }
2865
+ function un({
2866
+ title: t,
2867
+ subtitle: r,
2868
+ action: n,
2869
+ meta: a,
2870
+ icon: l,
2871
+ className: u = "",
2872
+ contentClassName: m = "",
2873
+ breadcrumbs: p,
2874
+ currentPath: c = typeof window > "u" ? "/" : window.location.pathname,
2875
+ showBreadcrumbs: d = !0,
2876
+ contained: y = !1,
2877
+ LinkComponent: C = Dr
2878
+ }) {
2879
+ const w = J(null), [f, g] = E(!1), [b, N] = E(null), L = p ?? Or(c), X = l ?? Ir(c), Y = d && L.length > 1;
2880
+ return R(() => {
2881
+ if (y) {
2882
+ g(!1);
2883
+ return;
2884
+ }
2885
+ let k = null, M = 0, $ = 0;
2886
+ const B = () => {
2887
+ const T = w.current, A = document.querySelector(
2888
+ "[data-app-scroll='true']"
2889
+ );
2890
+ return (T == null ? void 0 : T.closest(".os-viewport")) ?? (T == null ? void 0 : T.closest(
2891
+ "[data-overlayscrollbars-viewport]"
2892
+ )) ?? Oe(A) ?? A ?? window;
2893
+ }, W = () => {
2894
+ const T = k && k !== window ? k.scrollTop : window.scrollY;
2895
+ g((A) => A ? T > 24 : T > 72);
2896
+ }, I = () => {
2897
+ k == null || k.removeEventListener("scroll", W), k = B(), k.addEventListener("scroll", W, { passive: !0 }), W();
2898
+ };
2899
+ return I(), M = window.requestAnimationFrame(I), $ = window.setTimeout(I, 120), () => {
2900
+ window.cancelAnimationFrame(M), window.clearTimeout($), k == null || k.removeEventListener("scroll", W);
2901
+ };
2902
+ }, [y]), R(() => {
2903
+ if (y) {
2904
+ N(null);
2905
+ return;
2906
+ }
2907
+ let k = 0;
2908
+ const M = [], $ = () => {
2909
+ const O = w.current, G = O == null ? void 0 : O.parentElement, F = document.querySelector(
2910
+ "[data-app-scroll='true']"
2911
+ ), U = Oe(F) ?? F;
2912
+ if (!O || !G || !U) {
2913
+ N(null);
2914
+ return;
2915
+ }
2916
+ const o = G.getBoundingClientRect(), x = window.getComputedStyle(G), z = U.getBoundingClientRect(), j = U instanceof HTMLElement && U.clientWidth > 0 ? U.clientWidth : z.width, P = o.left + parseFloat(x.paddingLeft || "0"), Z = {
2917
+ marginLeft: Math.round(z.left - P),
2918
+ width: Math.round(j)
2919
+ };
2920
+ N(
2921
+ (ee) => ee && ee.marginLeft === Z.marginLeft && ee.width === Z.width ? ee : Z
2922
+ );
2923
+ }, B = () => {
2924
+ window.cancelAnimationFrame(k), k = window.requestAnimationFrame($);
2925
+ };
2926
+ B(), window.addEventListener("resize", B);
2927
+ const W = new ResizeObserver(B), I = w.current, T = I == null ? void 0 : I.parentElement, A = document.querySelector(
2928
+ "[data-app-scroll='true']"
2929
+ ), q = Oe(A) ?? A;
2930
+ return [T, A, q].forEach((O) => {
2931
+ O && W.observe(O);
2932
+ }), M.push(window.setTimeout(B, 120)), M.push(window.setTimeout(B, 280)), () => {
2933
+ window.cancelAnimationFrame(k), window.removeEventListener("resize", B), W.disconnect(), M.forEach((O) => window.clearTimeout(O));
2934
+ };
2935
+ }, [y]), /* @__PURE__ */ e(
2936
+ "div",
2937
+ {
2938
+ ref: w,
2939
+ "data-page-header": "true",
2940
+ "data-compact": f ? "true" : "false",
2941
+ className: `sticky top-0 z-30 overflow-visible py-0 transition-[background-color,box-shadow,border-color] duration-300 ease-out ${y ? "mb-0 flex-shrink-0" : "mb-6 sm:mb-1"} ${u}`,
2942
+ style: {
2943
+ ...b ? { marginLeft: b.marginLeft, width: b.width } : null,
2944
+ background: y ? "var(--bg-card)" : f ? "var(--bg-main)" : "color-mix(in srgb, var(--bg-main) 44%, transparent)",
2945
+ backdropFilter: "saturate(1.2) blur(14px)",
2946
+ WebkitBackdropFilter: "saturate(1.2) blur(14px)",
2947
+ borderBottom: y || f ? "1px solid var(--border)" : "1px solid transparent",
2948
+ boxShadow: f ? "0 10px 28px rgba(12, 54, 53, 0.12)" : "none"
2949
+ },
2950
+ children: /* @__PURE__ */ s(
2951
+ "div",
2952
+ {
2953
+ className: `flex flex-wrap items-center justify-between px-4 pt-0.5 transition-[gap,min-height,padding] duration-300 ease-out ${f ? "min-h-10 gap-2 sm:min-h-11 sm:gap-3" : "min-h-11 gap-3 sm:min-h-12 sm:gap-4"} ${m}`,
2954
+ children: [
2955
+ /* @__PURE__ */ s(
2956
+ "div",
2957
+ {
2958
+ className: `min-w-0 flex flex-1 flex-col justify-center transition-[gap,transform] duration-300 ease-out ${f ? "gap-1" : "gap-1.5 sm:gap-2"}`,
2959
+ children: [
2960
+ Y && /* @__PURE__ */ e(
2961
+ "nav",
2962
+ {
2963
+ "aria-label": "Breadcrumb",
2964
+ className: "min-w-0 flex-shrink-0 transition-[opacity,transform] duration-300 ease-out",
2965
+ children: /* @__PURE__ */ e(
2966
+ "ol",
2967
+ {
2968
+ className: `flex flex-wrap items-center gap-1.5 leading-none transition-[font-size,line-height] duration-300 ease-out ${f ? "text-[10px] sm:text-[11px]" : "text-[11px] sm:text-xs"}`,
2969
+ children: L.map((k, M) => {
2970
+ const $ = M === L.length - 1;
2971
+ return /* @__PURE__ */ s(
2972
+ "li",
2973
+ {
2974
+ className: "flex min-w-0 items-center gap-1.5",
2975
+ children: [
2976
+ M > 0 && /* @__PURE__ */ e(
2977
+ xe,
2978
+ {
2979
+ className: "h-3.5 w-3.5 transition-[color,transform] duration-300 ease-out",
2980
+ style: { color: "var(--text-muted)" }
2981
+ }
2982
+ ),
2983
+ k.href && !$ ? /* @__PURE__ */ e(
2984
+ C,
2985
+ {
2986
+ href: k.href,
2987
+ className: "truncate transition-colors duration-300 hover:underline",
2988
+ style: { color: "var(--text-muted)" },
2989
+ children: k.label
2990
+ }
2991
+ ) : /* @__PURE__ */ e(
2992
+ "span",
2993
+ {
2994
+ "aria-current": $ ? "page" : void 0,
2995
+ className: $ ? "truncate font-semibold" : "truncate",
2996
+ style: {
2997
+ color: $ ? "var(--text-main)" : "var(--text-muted)"
2998
+ },
2999
+ children: k.label
3000
+ }
3001
+ )
3002
+ ]
3003
+ },
3004
+ `${k.label}-${M}`
3005
+ );
3006
+ })
3007
+ }
3008
+ )
3009
+ }
3010
+ ),
3011
+ /* @__PURE__ */ s(
3012
+ "div",
3013
+ {
3014
+ className: `flex min-w-0 items-center transition-[gap,transform] duration-300 ease-out ${f ? "gap-2" : "gap-2.5 sm:gap-3"}`,
3015
+ children: [
3016
+ /* @__PURE__ */ e(
3017
+ "span",
3018
+ {
3019
+ className: `flex-shrink-0 transition-[color,transform,opacity] duration-300 ease-out ${f ? "scale-90 opacity-80" : "scale-100 opacity-100"}`,
3020
+ style: {
3021
+ color: Y ? "var(--text-secondary)" : "var(--text-muted)"
3022
+ },
3023
+ children: X
3024
+ }
3025
+ ),
3026
+ /* @__PURE__ */ s(
3027
+ "div",
3028
+ {
3029
+ className: `flex min-w-0 flex-1 flex-wrap items-center transition-[gap] duration-300 ease-out ${f ? "gap-x-2 gap-y-1" : "gap-x-3 gap-y-2"}`,
3030
+ children: [
3031
+ /* @__PURE__ */ s("div", { className: "min-w-0 flex-shrink transition-[transform] duration-300 ease-out", children: [
3032
+ /* @__PURE__ */ e(
3033
+ "h1",
3034
+ {
3035
+ className: `truncate font-bold tracking-tight transition-[font-size,line-height,color] duration-300 ease-out ${f ? "text-lg sm:text-xl" : "text-xl sm:text-2xl"}`,
3036
+ style: { color: "var(--text-main)" },
3037
+ children: t
3038
+ }
3039
+ ),
3040
+ r && /* @__PURE__ */ e(
3041
+ "p",
3042
+ {
3043
+ "aria-hidden": f,
3044
+ className: `overflow-hidden text-sm transition-[max-height,opacity,transform,margin] duration-300 ease-out ${f ? "mt-0 max-h-0 -translate-y-1 opacity-0" : "mt-0.5 max-h-6 translate-y-0 opacity-100 sm:mt-1"}`,
3045
+ style: { color: "var(--text-muted)" },
3046
+ children: r
3047
+ }
3048
+ )
3049
+ ] }),
3050
+ a && /* @__PURE__ */ e(
3051
+ "div",
3052
+ {
3053
+ className: `page-header-meta flex min-w-0 flex-1 basis-full items-center overflow-visible transition-[gap,opacity,transform] duration-300 ease-out sm:basis-auto ${f ? "translate-y-0 gap-1.5 opacity-95" : "gap-2 opacity-100"}`,
3054
+ children: a
3055
+ }
3056
+ )
3057
+ ]
3058
+ }
3059
+ )
3060
+ ]
3061
+ }
3062
+ )
3063
+ ]
3064
+ }
3065
+ ),
3066
+ n && /* @__PURE__ */ e(
3067
+ "div",
3068
+ {
3069
+ className: `page-header-actions flex flex-shrink-0 items-center self-center overflow-visible transition-[gap,min-height,opacity,transform] duration-300 ease-out ${f ? "min-h-10 gap-1.5 opacity-95" : "min-h-11 gap-2 opacity-100"}`,
3070
+ children: n
3071
+ }
3072
+ )
3073
+ ]
3074
+ }
3075
+ )
3076
+ }
3077
+ );
3078
+ }
3079
+ function mn({
3080
+ value: t,
3081
+ onChange: r,
3082
+ placeholder: n,
3083
+ className: a = ""
3084
+ }) {
3085
+ const l = J(null), [u, m] = E(!1), p = u || t.trim().length > 0, c = () => {
3086
+ var d;
3087
+ m(!0), (d = l.current) == null || d.focus();
3088
+ };
3089
+ return /* @__PURE__ */ s(
3090
+ "div",
3091
+ {
3092
+ className: `relative flex-shrink-0 overflow-visible transition-[width] duration-200 ease-out ${p ? a || "w-full" : "w-28"}`,
3093
+ onMouseDown: (d) => {
3094
+ p || (d.preventDefault(), c());
3095
+ },
3096
+ children: [
3097
+ /* @__PURE__ */ e(
3098
+ We,
3099
+ {
3100
+ className: "absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 pointer-events-none transition-colors duration-200",
3101
+ style: { color: "var(--text-muted)" }
3102
+ }
3103
+ ),
3104
+ /* @__PURE__ */ e(
3105
+ "input",
3106
+ {
3107
+ ref: l,
3108
+ type: "text",
3109
+ "aria-label": n,
3110
+ value: t,
3111
+ onChange: (d) => r(d.target.value),
3112
+ placeholder: p ? n : "Buscar",
3113
+ className: `h-11 w-full rounded-lg py-0 text-sm placeholder:text-[var(--text-muted)] focus:outline-none transition-all duration-150 ${p ? "pl-9 pr-9" : "cursor-pointer pl-9 pr-3"}`,
3114
+ style: {
3115
+ background: "var(--bg-card)",
3116
+ border: "1px solid var(--border)",
3117
+ color: "var(--text-main)"
3118
+ },
3119
+ onFocus: (d) => {
3120
+ m(!0), d.currentTarget.style.borderColor = "var(--primary)", d.currentTarget.style.boxShadow = "0 0 0 3px rgba(59,130,246,0.12)";
3121
+ },
3122
+ onBlur: (d) => {
3123
+ m(!1), d.currentTarget.style.borderColor = "var(--border)", d.currentTarget.style.boxShadow = "none";
3124
+ }
3125
+ }
3126
+ ),
3127
+ t && /* @__PURE__ */ e(
3128
+ "button",
3129
+ {
3130
+ type: "button",
3131
+ onClick: () => r(""),
3132
+ className: "absolute right-2 top-1/2 flex !h-6 !w-6 -translate-y-1/2 items-center justify-center rounded-full !p-0 leading-none transition-colors hover:bg-black/5",
3133
+ style: { color: "var(--text-muted)" },
3134
+ "aria-label": "Limpiar búsqueda",
3135
+ children: /* @__PURE__ */ e(ce, { className: "h-3.5 w-3.5 flex-shrink-0" })
3136
+ }
3137
+ )
3138
+ ]
3139
+ }
3140
+ );
3141
+ }
3142
+ function pn({
3143
+ children: t,
3144
+ currentPath: r = typeof window > "u" ? "/" : window.location.pathname,
3145
+ publicRoutes: n = ["/", "/login", "/reset-password"],
3146
+ ...a
3147
+ }) {
3148
+ return n.includes(r) ? /* @__PURE__ */ e(le, { children: t }) : /* @__PURE__ */ e(Br, { currentPath: r, ...a, children: t });
3149
+ }
3150
+ function ut() {
3151
+ if (typeof window > "u") return "system";
3152
+ const t = localStorage.getItem("theme");
3153
+ return t === "light" || t === "dark" ? t : t === "system" ? "system" : document.documentElement.classList.contains("dark") ? "dark" : "light";
3154
+ }
3155
+ function Hr(t, r, n) {
3156
+ try {
3157
+ const a = new URL(t), l = a.searchParams.get("callbackUrl");
3158
+ if (l) {
3159
+ const u = new URL(l, a.origin);
3160
+ return u.searchParams.set("theme", r), n && (u.searchParams.set("primeAuthOrigin", window.location.origin), u.searchParams.set("primeAuthProjectKey", n)), a.searchParams.set(
3161
+ "callbackUrl",
3162
+ `${u.pathname}${u.search}${u.hash}`
3163
+ ), a.toString();
3164
+ }
3165
+ return a.searchParams.set("theme", r), n && (a.searchParams.set("primeAuthOrigin", window.location.origin), a.searchParams.set("primeAuthProjectKey", n)), a.toString();
3166
+ } catch {
3167
+ return t;
3168
+ }
3169
+ }
3170
+ function hn({
3171
+ name: t,
3172
+ src: r,
3173
+ projectKey: n
3174
+ }) {
3175
+ const [a, l] = E(
3176
+ () => ut()
3177
+ ), u = J(null);
3178
+ R(() => {
3179
+ const c = new MutationObserver(
3180
+ () => l(ut())
3181
+ );
3182
+ return c.observe(document.documentElement, {
3183
+ attributes: !0,
3184
+ attributeFilter: ["class"]
3185
+ }), () => c.disconnect();
3186
+ }, []);
3187
+ const m = Je(
3188
+ () => Hr(r, a, n),
3189
+ [n, r, a]
3190
+ ), p = Je(() => {
3191
+ try {
3192
+ return new URL(m).origin;
3193
+ } catch {
3194
+ return "";
3195
+ }
3196
+ }, [m]);
3197
+ return R(() => {
3198
+ if (!n) return;
3199
+ const c = n;
3200
+ function d(y) {
3201
+ var f, g, b;
3202
+ if (y.source !== ((f = u.current) == null ? void 0 : f.contentWindow) || p && y.origin !== p) return;
3203
+ if (((g = y.data) == null ? void 0 : g.type) === "prime-microservice:overlay") {
3204
+ window.dispatchEvent(
3205
+ new CustomEvent("prime-auth:microservice-overlay", {
3206
+ detail: { active: !!y.data.active }
3207
+ })
3208
+ );
3209
+ return;
3210
+ }
3211
+ if (((b = y.data) == null ? void 0 : b.type) !== "prime-microservice:navigation") return;
3212
+ const C = y.data.path;
3213
+ if (!C || !C.startsWith("/") || C.startsWith("//")) return;
3214
+ const w = `/apps/${encodeURIComponent(c)}${C}`;
3215
+ `${window.location.pathname}${window.location.search}${window.location.hash}` !== w && (window.history.replaceState(window.history.state, "", w), window.dispatchEvent(
3216
+ new CustomEvent("prime-auth:microservice-navigation")
3217
+ ));
3218
+ }
3219
+ return window.addEventListener("message", d), () => {
3220
+ window.removeEventListener("message", d), window.dispatchEvent(
3221
+ new CustomEvent("prime-auth:microservice-overlay", {
3222
+ detail: { active: !1 }
3223
+ })
3224
+ );
3225
+ };
3226
+ }, [p, n]), /* @__PURE__ */ e("div", { className: "flex h-full min-h-screen flex-col bg-[var(--bg-main)]", children: /* @__PURE__ */ e(
3227
+ "iframe",
3228
+ {
3229
+ ref: u,
3230
+ src: m,
3231
+ title: t,
3232
+ className: "min-h-0 flex-1 border-0 bg-[var(--bg-main)]",
3233
+ allow: "clipboard-write",
3234
+ sandbox: "allow-downloads allow-forms allow-modals allow-popups allow-same-origin allow-scripts",
3235
+ referrerPolicy: "strict-origin-when-cross-origin"
3236
+ }
3237
+ ) });
3238
+ }
3239
+ function fn() {
3240
+ const [t, r] = E(""), [n, a] = E(!1), [l, u] = E({ width: 96, height: 96 });
3241
+ return R(() => {
3242
+ let m = !1;
3243
+ return fetch("/api/microservices/prime-suite/chat-url", { cache: "no-store" }).then((p) => p.ok ? p.json() : null).then((p) => {
3244
+ !m && (p != null && p.src) && r(p.src);
3245
+ }).catch(() => {
3246
+ }), () => {
3247
+ m = !0;
3248
+ };
3249
+ }, []), R(() => {
3250
+ const m = (p) => {
3251
+ var d;
3252
+ if (((d = p.data) == null ? void 0 : d.type) !== "prime-suite-chat:state") return;
3253
+ const c = !!p.data.active;
3254
+ a(c), u({
3255
+ width: mt(p.data.width, 96, 720),
3256
+ height: mt(p.data.height, 96, 560)
3257
+ });
3258
+ };
3259
+ return window.addEventListener("message", m), () => window.removeEventListener("message", m);
3260
+ }, []), t ? /* @__PURE__ */ e(
3261
+ "iframe",
3262
+ {
3263
+ title: "Chat Bonsaif",
3264
+ src: t,
3265
+ allow: "clipboard-write",
3266
+ className: "fixed bottom-0 right-0 z-[70] border-0 bg-transparent transition-[width,height] duration-200",
3267
+ style: {
3268
+ width: n ? `min(${l.width}px, 100vw)` : 96,
3269
+ height: n ? `min(${l.height}px, 100vh)` : 96,
3270
+ background: "transparent",
3271
+ backgroundColor: "transparent",
3272
+ colorScheme: "normal"
3273
+ }
3274
+ }
3275
+ ) : null;
3276
+ }
3277
+ function mt(t, r, n) {
3278
+ const a = typeof t == "number" && Number.isFinite(t) ? t : r;
3279
+ return Math.max(r, Math.min(n, Math.ceil(a)));
3280
+ }
3281
+ function Wr(t) {
3282
+ const r = document.documentElement, n = new MutationObserver(t);
3283
+ n.observe(r, { attributes: !0, attributeFilter: ["class"] });
3284
+ const a = window.matchMedia("(prefers-color-scheme: dark)");
3285
+ return a.addEventListener("change", t), () => {
3286
+ n.disconnect(), a.removeEventListener("change", t);
3287
+ };
3288
+ }
3289
+ function Pr() {
3290
+ const t = localStorage.getItem("theme") || "system", r = window.matchMedia("(prefers-color-scheme: dark)").matches;
3291
+ return document.documentElement.classList.contains("dark") || t === "dark" || t === "system" && r ? "dark" : "light";
3292
+ }
3293
+ function _r() {
3294
+ return "light";
3295
+ }
3296
+ function bn() {
3297
+ const t = At(
3298
+ Wr,
3299
+ Pr,
3300
+ _r
3301
+ );
3302
+ return /* @__PURE__ */ e(rr, { position: "bottom-center", theme: t, richColors: !0, closeButton: !0 });
3303
+ }
3304
+ export {
3305
+ Br as AuthShell,
3306
+ Qr as BonsaifButton,
3307
+ ne as Button,
3308
+ en as CalendarPicker,
3309
+ rn as CompactFilterSelect,
3310
+ tn as CompactSearchInput,
3311
+ nn as ConfirmDialog,
3312
+ an as DataTable,
3313
+ on as DateRangePicker,
3314
+ sn as Drawer,
3315
+ Cr as GlobalScrollbars,
3316
+ ln as InputField,
3317
+ cn as LoadingState,
3318
+ hn as MicroserviceFrame,
3319
+ pr as Modal,
3320
+ br as MouseTooltip,
3321
+ un as PageHeader,
3322
+ mn as PageSearchInput,
3323
+ pn as PrimeAuthRouteShell,
3324
+ bn as PrimeAuthToaster,
3325
+ fn as PrimeSuiteChatFrame,
3326
+ ft as SearchableSelect,
3327
+ it as TextInput,
3328
+ dn as Toggle,
3329
+ $r as UserAvatar,
3330
+ nr as cn
3331
+ };