@yenio-pld/blocks 1.2.0-rc.8 → 1.2.0-rc.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,9 +1,9 @@
1
1
  "use client";
2
- import * as React2 from 'react';
3
- import { createContext, useContext, cloneElement, useState, useRef, useEffect, useId, useCallback, useLayoutEffect } from 'react';
2
+ import * as React3 from 'react';
3
+ import { createContext, useContext, cloneElement, useRef, useEffect, useState, useId, useCallback, useLayoutEffect } from 'react';
4
4
  import { Skeleton } from './ui/skeleton.js';
5
5
  import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
6
- import { Loader2, AlertTriangle, Inbox, ChevronsUpDown, UserRound, LogOut, Bell, Moon, Sun, Monitor, Languages, XIcon, ChevronDownIcon, CheckIcon, Loader2Icon, Upload, Move, ZoomOut, ZoomIn, RotateCcw, RotateCw, Grid3X3, RefreshCw, X, User, Pencil, Check, Pause, Play, BarChart3 } from 'lucide-react';
6
+ import { Loader2, AlertTriangle, Inbox, ChevronsUpDown, UserRound, LogOut, Bell, Moon, Sun, Monitor, Languages, XIcon, ChevronDownIcon, CheckIcon, Loader2Icon, Upload, Move, ZoomOut, ZoomIn, RotateCcw, RotateCw, Grid3X3, RefreshCw, X, User, Pencil, Check, Pause, Play, BarChart3, ChevronRight, MoreHorizontal, ChevronDown } from 'lucide-react';
7
7
  import { clsx } from 'clsx';
8
8
  import { twMerge } from 'tailwind-merge';
9
9
  import { Avatar, AvatarImage, AvatarFallback } from './ui/avatar.js';
@@ -11,19 +11,22 @@ import { Button } from './ui/button.js';
11
11
  import { DropdownMenu, DropdownMenuTrigger, DropdownMenuContent, DropdownMenuLabel, DropdownMenuSeparator, DropdownMenuItem, miniMenuContentClassName, miniMenuContentDefaults } from './ui/dropdown-menu.js';
12
12
  import { Empty, EmptyHeader, EmptyMedia, EmptyTitle, EmptyDescription, EmptyContent } from './ui/empty.js';
13
13
  import { Separator } from './ui/separator.js';
14
+ import { Collapsible, CollapsibleTrigger, CollapsibleContent } from './ui/collapsible.js';
14
15
  import { SidebarProvider, Sidebar, SidebarHeader, SidebarContent, SidebarFooter, SidebarRail, SidebarInset, SidebarTrigger, useSidebar, SidebarMenu, SidebarMenuItem, SidebarMenuButton, SidebarGroup, SidebarGroupLabel, SidebarGroupContent } from './ui/sidebar.js';
15
16
  import { Table, TableHeader, TableRow, TableHead, TableBody, TableCell } from './ui/table.js';
16
17
  import { TooltipProvider } from './ui/tooltip.js';
17
- import { Card, CardHeader, CardContent } from './ui/card.js';
18
+ import { Card, CardHeader, CardContent, CardTitle, CardDescription } from './ui/card.js';
18
19
  import { cva } from 'class-variance-authority';
19
20
  import { AlertDialog, AlertDialogContent, AlertDialogHeader, AlertDialogTitle, AlertDialogDescription, AlertDialogFooter, AlertDialogCancel, AlertDialogAction } from './ui/alert-dialog.js';
20
21
  import { useTheme } from 'next-themes';
21
22
  import { Combobox } from './ui/combobox.js';
23
+ import { Drawer, DrawerContent, DrawerHeader, DrawerTitle, DrawerClose, DrawerFooter } from './ui/drawer.js';
24
+ import { Input } from './ui/input.js';
22
25
  import { Slider } from './ui/slider.js';
23
26
  import { Toggle } from './ui/toggle.js';
24
27
  import { DialogClose, Dialog, DialogContent, DialogHeader, DialogTitle, DialogFooter } from './ui/dialog.js';
25
- import { DrawerClose, Drawer, DrawerContent, DrawerHeader, DrawerTitle, DrawerFooter } from './ui/drawer.js';
26
- import { AnimatePresence, motion } from 'framer-motion';
28
+ import { AnimatePresence, motion, useReducedMotion } from 'framer-motion';
29
+ import { Badge } from './ui/badge.js';
27
30
 
28
31
  var LanguageContext = createContext(null);
29
32
  function useLanguageContext() {
@@ -155,7 +158,7 @@ function cn(...inputs) {
155
158
  return twMerge(clsx(inputs));
156
159
  }
157
160
  function LoadingState({
158
- label = "Loading\u2026",
161
+ label,
159
162
  className
160
163
  }) {
161
164
  return /* @__PURE__ */ jsxs(
@@ -163,13 +166,20 @@ function LoadingState({
163
166
  {
164
167
  role: "status",
165
168
  "aria-live": "polite",
169
+ "aria-busy": "true",
166
170
  className: cn(
167
171
  "flex items-center justify-center gap-2 py-12 text-sm text-muted-foreground",
168
172
  className
169
173
  ),
170
174
  children: [
171
- /* @__PURE__ */ jsx(Loader2, { className: "size-4 animate-spin", "aria-hidden": "true" }),
172
- /* @__PURE__ */ jsx("span", { children: label })
175
+ /* @__PURE__ */ jsx(
176
+ Loader2,
177
+ {
178
+ className: "size-4 animate-spin motion-reduce:animate-none",
179
+ "aria-hidden": "true"
180
+ }
181
+ ),
182
+ label ? /* @__PURE__ */ jsx("span", { children: label }) : /* @__PURE__ */ jsx("span", { className: "sr-only", children: "\u2026" })
173
183
  ]
174
184
  }
175
185
  );
@@ -213,7 +223,7 @@ function EmptyState({
213
223
  {
214
224
  className: cn(
215
225
  "gap-3",
216
- isCompact ? "flex-none rounded-none px-4 py-6" : "flex-none rounded-xl border border-dashed px-6 py-12",
226
+ isCompact ? "flex-none rounded-none px-4 py-8" : "flex-none rounded-xl border border-dashed px-6 py-12",
217
227
  className
218
228
  ),
219
229
  children: [
@@ -239,9 +249,9 @@ function EmptyState({
239
249
  children: title
240
250
  }
241
251
  ),
242
- description ? /* @__PURE__ */ jsx(EmptyDescription, { className: "mt-0", children: description }) : null
252
+ description ? /* @__PURE__ */ jsx(EmptyDescription, { className: "mt-0 max-w-sm", children: description }) : null
243
253
  ] }),
244
- action ? /* @__PURE__ */ jsx(EmptyContent, { className: "gap-0", children: action }) : null
254
+ action ? /* @__PURE__ */ jsx(EmptyContent, { className: "mt-1 gap-0", children: action }) : null
245
255
  ]
246
256
  }
247
257
  );
@@ -265,42 +275,98 @@ function DismissMobileSidebar({ pathname }) {
265
275
  }, [pathname, setOpenMobile]);
266
276
  return null;
267
277
  }
278
+ function AppNavItems({
279
+ group,
280
+ renderLink,
281
+ setOpenMobile
282
+ }) {
283
+ return /* @__PURE__ */ jsx(SidebarMenu, { children: group.items.map((item) => {
284
+ const Icon = item.icon;
285
+ return /* @__PURE__ */ jsx(SidebarMenuItem, { children: /* @__PURE__ */ jsx(
286
+ SidebarMenuButton,
287
+ {
288
+ isActive: item.active === true,
289
+ tooltip: item.label,
290
+ render: renderLink({
291
+ href: item.href,
292
+ onClick: () => setOpenMobile(false),
293
+ "aria-current": item.active ? "page" : void 0,
294
+ // Children live on the link. The button's render element
295
+ // wins the merge, so a childless anchor would wipe the label.
296
+ children: /* @__PURE__ */ jsxs(Fragment, { children: [
297
+ /* @__PURE__ */ jsx(Icon, { "aria-hidden": "true" }),
298
+ /* @__PURE__ */ jsx("span", { children: item.label })
299
+ ] })
300
+ })
301
+ }
302
+ ) }, `${group.label}:${item.href}`);
303
+ }) });
304
+ }
268
305
  function AppNav({
269
306
  nav,
270
307
  navLabel,
271
308
  renderLink
272
309
  }) {
273
310
  const { setOpenMobile } = useSidebar();
274
- return /* @__PURE__ */ jsx("nav", { "aria-label": navLabel, children: nav.map((group) => /* @__PURE__ */ jsxs(SidebarGroup, { children: [
275
- /* @__PURE__ */ jsx(SidebarGroupLabel, { children: group.label }),
276
- /* @__PURE__ */ jsx(SidebarGroupContent, { children: /* @__PURE__ */ jsx(SidebarMenu, { children: group.items.map((item) => {
277
- const Icon = item.icon;
278
- return /* @__PURE__ */ jsx(SidebarMenuItem, { children: /* @__PURE__ */ jsx(
279
- SidebarMenuButton,
280
- {
281
- isActive: item.active === true,
282
- tooltip: item.label,
283
- render: renderLink({
284
- href: item.href,
285
- onClick: () => setOpenMobile(false),
286
- "aria-current": item.active ? "page" : void 0,
287
- // Children live on the link. The button's render element
288
- // wins the merge, so a childless anchor would wipe the label.
289
- children: /* @__PURE__ */ jsxs(Fragment, { children: [
290
- /* @__PURE__ */ jsx(Icon, { "aria-hidden": "true" }),
291
- /* @__PURE__ */ jsx("span", { children: item.label })
292
- ] })
293
- })
294
- }
295
- ) }, `${group.label}:${item.href}`);
296
- }) }) })
297
- ] }, group.label)) });
311
+ return /* @__PURE__ */ jsx("nav", { "aria-label": navLabel, children: nav.map((group) => {
312
+ if (!group.collapsible) {
313
+ return /* @__PURE__ */ jsxs(SidebarGroup, { children: [
314
+ /* @__PURE__ */ jsx(SidebarGroupLabel, { children: group.label }),
315
+ /* @__PURE__ */ jsx(SidebarGroupContent, { children: /* @__PURE__ */ jsx(
316
+ AppNavItems,
317
+ {
318
+ group,
319
+ renderLink,
320
+ setOpenMobile
321
+ }
322
+ ) })
323
+ ] }, group.label);
324
+ }
325
+ const anyActive = group.items.some((item) => item.active === true);
326
+ return /* @__PURE__ */ jsx(
327
+ Collapsible,
328
+ {
329
+ defaultOpen: group.defaultOpen ?? anyActive,
330
+ className: "group/collapsible",
331
+ children: /* @__PURE__ */ jsxs(SidebarGroup, { children: [
332
+ /* @__PURE__ */ jsxs(
333
+ SidebarGroupLabel,
334
+ {
335
+ render: /* @__PURE__ */ jsx(CollapsibleTrigger, { className: "flex w-full items-center gap-1" }),
336
+ children: [
337
+ /* @__PURE__ */ jsx("span", { className: "flex-1 truncate text-left", children: group.label }),
338
+ group.badge !== void 0 && group.badge !== "" ? /* @__PURE__ */ jsx("span", { className: "rounded-md bg-sidebar-accent px-1.5 text-[0.65rem] font-medium tabular-nums text-sidebar-accent-foreground", children: group.badge }) : null,
339
+ /* @__PURE__ */ jsx(
340
+ ChevronDown,
341
+ {
342
+ "aria-hidden": "true",
343
+ className: "size-3.5 shrink-0 transition-transform group-data-[panel-open]/collapsible:rotate-180"
344
+ }
345
+ )
346
+ ]
347
+ }
348
+ ),
349
+ /* @__PURE__ */ jsx(CollapsibleContent, { children: /* @__PURE__ */ jsx(SidebarGroupContent, { children: /* @__PURE__ */ jsx(
350
+ AppNavItems,
351
+ {
352
+ group,
353
+ renderLink,
354
+ setOpenMobile
355
+ }
356
+ ) }) })
357
+ ] })
358
+ },
359
+ group.label
360
+ );
361
+ }) });
298
362
  }
299
363
  function AppShell({
300
364
  brand,
301
365
  nav,
302
366
  navLabel = "Main",
303
367
  sidebarFooter,
368
+ headerStart,
369
+ headerMiddle,
304
370
  headerEnd,
305
371
  defaultOpen = true,
306
372
  pathname,
@@ -322,7 +388,7 @@ function AppShell({
322
388
  /* @__PURE__ */ jsx(SidebarRail, {})
323
389
  ] }),
324
390
  /* @__PURE__ */ jsxs(SidebarInset, { className: "h-svh min-h-0 overflow-hidden", children: [
325
- /* @__PURE__ */ jsxs("header", { className: "sticky top-0 z-10 flex h-14 shrink-0 items-center gap-2 border-b bg-background/95 px-4 backdrop-blur", children: [
391
+ /* @__PURE__ */ jsxs("header", { className: "sticky top-0 z-10 flex h-14 shrink-0 items-center gap-2 border-b bg-background/95 px-4 backdrop-blur supports-[backdrop-filter]:bg-background/80", children: [
326
392
  /* @__PURE__ */ jsx(SidebarTrigger, { className: "-ml-1" }),
327
393
  /* @__PURE__ */ jsx(
328
394
  Separator,
@@ -331,7 +397,18 @@ function AppShell({
331
397
  className: "mr-1 data-[orientation=vertical]:h-4"
332
398
  }
333
399
  ),
334
- /* @__PURE__ */ jsx("div", { className: "ml-auto flex min-w-0 items-center gap-2", children: headerEnd })
400
+ headerStart ? /* @__PURE__ */ jsx("div", { className: "flex shrink-0 items-center gap-2", children: headerStart }) : null,
401
+ headerMiddle ? /* @__PURE__ */ jsx("div", { className: "flex min-w-0 flex-1 items-center gap-2", children: headerMiddle }) : null,
402
+ /* @__PURE__ */ jsx(
403
+ "div",
404
+ {
405
+ className: cn(
406
+ "flex items-center gap-2",
407
+ headerMiddle ? "shrink-0" : "min-w-0 flex-1"
408
+ ),
409
+ children: headerEnd
410
+ }
411
+ )
335
412
  ] }),
336
413
  /* @__PURE__ */ jsx("div", { className: "min-h-0 flex-1 overflow-y-auto", children })
337
414
  ] })
@@ -367,6 +444,10 @@ function NavTabs({
367
444
  className: cn("flex items-stretch gap-1 border-b", className),
368
445
  children: tabs.map((tab) => {
369
446
  const active = tab.active === true;
447
+ const label2 = typeof tab.count === "number" ? /* @__PURE__ */ jsxs("span", { className: "inline-flex items-center gap-1.5", children: [
448
+ /* @__PURE__ */ jsx("span", { children: tab.label }),
449
+ /* @__PURE__ */ jsx("span", { className: "rounded-md bg-muted px-1.5 py-0.5 text-xs font-medium tabular-nums text-muted-foreground", children: tab.count })
450
+ ] }) : tab.label;
370
451
  const link = renderLink({
371
452
  href: tab.href,
372
453
  className: cn(
@@ -374,7 +455,7 @@ function NavTabs({
374
455
  active ? "border-primary text-primary" : "border-transparent text-muted-foreground hover:text-foreground"
375
456
  ),
376
457
  "aria-current": active ? "page" : void 0,
377
- children: tab.label
458
+ children: label2
378
459
  });
379
460
  return cloneElement(link, { key: tab.href });
380
461
  })
@@ -560,18 +641,76 @@ function DataTable({
560
641
  }
561
642
  ) })
562
643
  ] }) }),
563
- loadMore ? /* @__PURE__ */ jsx("div", { className: "flex min-h-8 justify-center", children: /* @__PURE__ */ jsx(
644
+ loadMore ? /* @__PURE__ */ jsx(
645
+ LoadMoreControls,
646
+ {
647
+ label: loadMore.label,
648
+ pending: loadMore.pending === true,
649
+ onLoadMore: loadMore.onLoadMore
650
+ }
651
+ ) : null
652
+ ] });
653
+ }
654
+ function LoadMoreControls({
655
+ label,
656
+ pending,
657
+ onLoadMore
658
+ }) {
659
+ const sentinelRef = useRef(null);
660
+ const pendingRef = useRef(pending);
661
+ const onLoadMoreRef = useRef(onLoadMore);
662
+ const armedRef = useRef(true);
663
+ const wasPendingRef = useRef(false);
664
+ pendingRef.current = pending;
665
+ onLoadMoreRef.current = onLoadMore;
666
+ useEffect(() => {
667
+ const node = sentinelRef.current;
668
+ if (!node || typeof IntersectionObserver === "undefined") return;
669
+ function maybeLoad() {
670
+ if (pendingRef.current || !armedRef.current) return;
671
+ armedRef.current = false;
672
+ onLoadMoreRef.current();
673
+ }
674
+ const observer = new IntersectionObserver(
675
+ (entries) => {
676
+ if (!entries.some((entry) => entry.isIntersecting)) return;
677
+ maybeLoad();
678
+ },
679
+ { root: null, rootMargin: "240px 0px", threshold: 0 }
680
+ );
681
+ observer.observe(node);
682
+ return () => observer.disconnect();
683
+ }, []);
684
+ useEffect(() => {
685
+ if (pending) {
686
+ wasPendingRef.current = true;
687
+ return;
688
+ }
689
+ if (!wasPendingRef.current) return;
690
+ wasPendingRef.current = false;
691
+ armedRef.current = true;
692
+ const node = sentinelRef.current;
693
+ if (!node) return;
694
+ const rect = node.getBoundingClientRect();
695
+ if (rect.top < (typeof window !== "undefined" ? window.innerHeight : 0) + 240) {
696
+ armedRef.current = false;
697
+ onLoadMoreRef.current();
698
+ }
699
+ }, [pending]);
700
+ return /* @__PURE__ */ jsxs("div", { className: "flex min-h-8 flex-col items-center gap-3", children: [
701
+ /* @__PURE__ */ jsx("div", { ref: sentinelRef, className: "h-px w-full", "aria-hidden": true }),
702
+ /* @__PURE__ */ jsx(
564
703
  Button,
565
704
  {
566
705
  type: "button",
567
706
  variant: "outline",
568
707
  className: "min-w-36",
569
- disabled: loadMore.pending === true,
570
- "aria-busy": loadMore.pending || void 0,
571
- onClick: loadMore.onLoadMore,
572
- children: loadMore.label
708
+ disabled: pending,
709
+ "aria-busy": pending || void 0,
710
+ onClick: onLoadMore,
711
+ children: label
573
712
  }
574
- ) }) : null
713
+ )
575
714
  ] });
576
715
  }
577
716
  var MIN_VISIBLE_MS = 200;
@@ -827,22 +966,30 @@ function DataTableSkeleton({
827
966
  return /* @__PURE__ */ jsx("div", { role: "status", "aria-label": label, children: /* @__PURE__ */ jsx(DataTableSkeletonBody, { rows }) });
828
967
  }
829
968
  function DetailPageSkeleton({ label }) {
830
- return /* @__PURE__ */ jsxs(
831
- "div",
832
- {
833
- role: "status",
834
- "aria-label": label,
835
- className: "grid gap-6 lg:grid-cols-[minmax(0,1fr)_320px]",
836
- children: [
837
- /* @__PURE__ */ jsxs("div", { className: "flex min-w-0 flex-col gap-4", children: [
838
- /* @__PURE__ */ jsx(Skeleton, { className: "h-8 w-64 max-w-full" }),
839
- /* @__PURE__ */ jsx(Skeleton, { className: "h-4 w-80 max-w-full" }),
840
- /* @__PURE__ */ jsx(Skeleton, { className: "h-40 w-full" })
969
+ return /* @__PURE__ */ jsxs("div", { role: "status", "aria-label": label, className: "flex flex-col gap-6", children: [
970
+ /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-3 sm:flex-row sm:items-start sm:justify-between", children: [
971
+ /* @__PURE__ */ jsxs("div", { className: "flex min-w-0 flex-col gap-2", children: [
972
+ /* @__PURE__ */ jsxs("div", { className: "flex flex-wrap items-center gap-2", children: [
973
+ /* @__PURE__ */ jsx(Skeleton, { className: "h-8 w-56 max-w-full" }),
974
+ /* @__PURE__ */ jsx(Skeleton, { className: "h-5 w-16 rounded-full" })
841
975
  ] }),
842
- /* @__PURE__ */ jsx(Skeleton, { className: "h-48 w-full lg:w-[320px]" })
843
- ]
844
- }
845
- );
976
+ /* @__PURE__ */ jsx(Skeleton, { className: "h-4 w-72 max-w-full" })
977
+ ] }),
978
+ /* @__PURE__ */ jsxs("div", { className: "flex gap-2", children: [
979
+ /* @__PURE__ */ jsx(Skeleton, { className: "h-9 w-24" }),
980
+ /* @__PURE__ */ jsx(Skeleton, { className: "h-9 w-28" })
981
+ ] })
982
+ ] }),
983
+ /* @__PURE__ */ jsxs("div", { className: "grid gap-4 sm:grid-cols-2 lg:grid-cols-3", children: [
984
+ /* @__PURE__ */ jsx(Skeleton, { className: "h-12 w-full" }),
985
+ /* @__PURE__ */ jsx(Skeleton, { className: "h-12 w-full" }),
986
+ /* @__PURE__ */ jsx(Skeleton, { className: "h-12 w-full" })
987
+ ] }),
988
+ /* @__PURE__ */ jsxs("div", { className: "grid gap-6 lg:grid-cols-[minmax(0,1fr)_320px]", children: [
989
+ /* @__PURE__ */ jsx("div", { className: "flex min-w-0 flex-col gap-4", children: /* @__PURE__ */ jsx(Skeleton, { className: "h-40 w-full" }) }),
990
+ /* @__PURE__ */ jsx(Skeleton, { className: "h-48 w-full lg:w-[320px]" })
991
+ ] })
992
+ ] });
846
993
  }
847
994
  function FormCardSkeleton({
848
995
  label,
@@ -967,6 +1114,7 @@ function ConfirmDestructiveDialog({
967
1114
  description,
968
1115
  confirmLabel = "Delete",
969
1116
  cancelLabel = "Cancel",
1117
+ destructive = true,
970
1118
  onConfirm
971
1119
  }) {
972
1120
  return /* @__PURE__ */ jsx(AlertDialog, { open, onOpenChange, children: /* @__PURE__ */ jsxs(AlertDialogContent, { size: "sm", children: [
@@ -979,7 +1127,7 @@ function ConfirmDestructiveDialog({
979
1127
  /* @__PURE__ */ jsx(
980
1128
  AlertDialogAction,
981
1129
  {
982
- variant: "destructive",
1130
+ variant: destructive ? "destructive" : "default",
983
1131
  onClick: () => {
984
1132
  onConfirm();
985
1133
  onOpenChange(false);
@@ -1462,39 +1610,97 @@ function FieldMessage({
1462
1610
  function isBrokenImage(img) {
1463
1611
  return img.complete && img.naturalWidth === 0;
1464
1612
  }
1613
+ function resolveBlurDataUrl(value) {
1614
+ return typeof value === "string" && value.length > 0 ? value : null;
1615
+ }
1465
1616
  function SafeImage({
1466
1617
  src,
1467
1618
  fallback,
1468
1619
  alt = "",
1469
1620
  onError,
1621
+ onLoad,
1622
+ blurDataUrl,
1623
+ style,
1624
+ className,
1470
1625
  ...imgProps
1471
1626
  }) {
1472
1627
  const [failed, setFailed] = useState(false);
1628
+ const [loaded, setLoaded] = useState(false);
1473
1629
  const imgRef = useRef(null);
1474
1630
  const resolvedSrc = typeof src === "string" && src.length > 0 ? src : null;
1631
+ const resolvedBlur = resolveBlurDataUrl(blurDataUrl);
1475
1632
  useLayoutEffect(() => {
1476
1633
  setFailed(false);
1634
+ setLoaded(false);
1477
1635
  }, [resolvedSrc]);
1478
1636
  useLayoutEffect(() => {
1479
1637
  const img = imgRef.current;
1480
- if (img && isBrokenImage(img)) {
1638
+ if (!img) return;
1639
+ if (isBrokenImage(img)) {
1481
1640
  setFailed(true);
1641
+ return;
1642
+ }
1643
+ if (resolvedBlur && img.complete && img.naturalWidth > 0) {
1644
+ setLoaded(true);
1482
1645
  }
1483
- }, [resolvedSrc, failed]);
1646
+ }, [resolvedSrc, failed, resolvedBlur]);
1484
1647
  if (!resolvedSrc || failed) {
1485
1648
  return /* @__PURE__ */ jsx(Fragment, { children: fallback });
1486
1649
  }
1650
+ const onImgLoad = (event) => {
1651
+ if (resolvedBlur) setLoaded(true);
1652
+ onLoad?.(event);
1653
+ };
1654
+ const onImgError = (event) => {
1655
+ setFailed(true);
1656
+ onError?.(event);
1657
+ };
1658
+ if (resolvedBlur === null) {
1659
+ return /* @__PURE__ */ jsx(
1660
+ "img",
1661
+ {
1662
+ ...imgProps,
1663
+ ref: imgRef,
1664
+ src: resolvedSrc,
1665
+ alt,
1666
+ className,
1667
+ style,
1668
+ onLoad: onImgLoad,
1669
+ onError: onImgError
1670
+ }
1671
+ );
1672
+ }
1673
+ const lqipStyle = loaded ? void 0 : {
1674
+ backgroundImage: `url(${JSON.stringify(resolvedBlur)})`,
1675
+ backgroundSize: "cover",
1676
+ backgroundPosition: "center",
1677
+ backgroundRepeat: "no-repeat"
1678
+ };
1487
1679
  return /* @__PURE__ */ jsx(
1488
- "img",
1680
+ "span",
1489
1681
  {
1490
- ...imgProps,
1491
- ref: imgRef,
1492
- src: resolvedSrc,
1493
- alt,
1494
- onError: (event) => {
1495
- setFailed(true);
1496
- onError?.(event);
1497
- }
1682
+ className: cn("inline-block overflow-hidden", className),
1683
+ style: {
1684
+ lineHeight: 0,
1685
+ ...style,
1686
+ ...lqipStyle
1687
+ },
1688
+ children: /* @__PURE__ */ jsx(
1689
+ "img",
1690
+ {
1691
+ ...imgProps,
1692
+ ref: imgRef,
1693
+ src: resolvedSrc,
1694
+ alt,
1695
+ className: cn(
1696
+ "block size-full max-w-none",
1697
+ className,
1698
+ !loaded && "opacity-0"
1699
+ ),
1700
+ onLoad: onImgLoad,
1701
+ onError: onImgError
1702
+ }
1703
+ )
1498
1704
  }
1499
1705
  );
1500
1706
  }
@@ -2796,8 +3002,8 @@ function CountryPicker({
2796
3002
  "aria-invalid": ariaInvalid
2797
3003
  }) {
2798
3004
  const labels = { ...defaultLabels2(purpose, locale), ...labelsProp };
2799
- const items = React2.useMemo(() => countryPickerItems(locale), [locale]);
2800
- const selected = React2.useMemo(() => findItem(items, value), [items, value]);
3005
+ const items = React3.useMemo(() => countryPickerItems(locale), [locale]);
3006
+ const selected = React3.useMemo(() => findItem(items, value), [items, value]);
2801
3007
  return /* @__PURE__ */ jsxs(Fragment, { children: [
2802
3008
  name ? /* @__PURE__ */ jsx("input", { type: "hidden", name, value: value.trim().toUpperCase() }) : null,
2803
3009
  /* @__PURE__ */ jsxs(
@@ -2896,6 +3102,331 @@ function CountryPicker({
2896
3102
  )
2897
3103
  ] });
2898
3104
  }
3105
+ function useMediaQuery(query) {
3106
+ const [matches, setMatches] = useState(false);
3107
+ useEffect(() => {
3108
+ if (typeof window === "undefined" || !window.matchMedia) return;
3109
+ const mql = window.matchMedia(query);
3110
+ const onChange = () => setMatches(mql.matches);
3111
+ onChange();
3112
+ mql.addEventListener("change", onChange);
3113
+ return () => mql.removeEventListener("change", onChange);
3114
+ }, [query]);
3115
+ return matches;
3116
+ }
3117
+ var TRIGGER_CLASS = "flex h-8 w-full min-w-0 items-center justify-between gap-2 rounded-lg border border-input bg-transparent px-2.5 py-1 text-left text-base transition-colors outline-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:pointer-events-none disabled:cursor-not-allowed disabled:bg-input/50 disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 md:text-sm dark:bg-input/30 dark:disabled:bg-input/80 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40";
3118
+ var SEARCH_CLASS = "h-8 w-full min-w-0 rounded-lg border border-input bg-transparent px-2.5 py-1 text-base transition-colors outline-none placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 md:text-sm dark:bg-input/30";
3119
+ var MD_UP = "(min-width: 768px)";
3120
+ function LoadingRows() {
3121
+ return /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-1 p-2", role: "status", children: [
3122
+ /* @__PURE__ */ jsx(Skeleton, { className: "h-8 w-full motion-reduce:animate-none" }),
3123
+ /* @__PURE__ */ jsx(Skeleton, { className: "h-8 w-full motion-reduce:animate-none" })
3124
+ ] });
3125
+ }
3126
+ function OptionBody({ option }) {
3127
+ return /* @__PURE__ */ jsxs("span", { className: "flex min-w-0 flex-1 flex-col", children: [
3128
+ /* @__PURE__ */ jsx("span", { className: "truncate font-medium", children: option.label }),
3129
+ option.sublabel ? /* @__PURE__ */ jsx("span", { className: "truncate text-xs text-muted-foreground", children: option.sublabel }) : null
3130
+ ] });
3131
+ }
3132
+ function SearchablePicker({
3133
+ value,
3134
+ selectedLabel,
3135
+ onChange,
3136
+ options,
3137
+ query,
3138
+ onQueryChange,
3139
+ loading = false,
3140
+ loadingMore = false,
3141
+ hasMore = false,
3142
+ onLoadMore,
3143
+ placeholder = "Search\u2026",
3144
+ emptyLabel = "No matches",
3145
+ loadMoreLabel = "Load more",
3146
+ clearLabel = "Clear",
3147
+ searchPlaceholder,
3148
+ openLabel = "Open list",
3149
+ disabled,
3150
+ allowClear,
3151
+ title,
3152
+ id,
3153
+ className,
3154
+ "aria-invalid": ariaInvalid,
3155
+ onOpenChange
3156
+ }) {
3157
+ const isMdUp = useMediaQuery(MD_UP);
3158
+ const [open, setOpen] = React3.useState(false);
3159
+ const searchRef = React3.useRef(null);
3160
+ function setOpenState(next) {
3161
+ setOpen(next);
3162
+ onOpenChange?.(next);
3163
+ if (!next) onQueryChange("");
3164
+ }
3165
+ const selected = React3.useMemo(() => {
3166
+ if (!value) return null;
3167
+ return options.find((option) => option.id === value) ?? {
3168
+ id: value,
3169
+ label: selectedLabel || value
3170
+ };
3171
+ }, [options, selectedLabel, value]);
3172
+ React3.useEffect(() => {
3173
+ if (!open || isMdUp) return;
3174
+ const handle = window.setTimeout(() => searchRef.current?.focus(), 0);
3175
+ return () => window.clearTimeout(handle);
3176
+ }, [isMdUp, open]);
3177
+ function selectOption(option) {
3178
+ onChange(option.id, option);
3179
+ onQueryChange("");
3180
+ setOpenState(false);
3181
+ }
3182
+ function clearSelection() {
3183
+ onChange("");
3184
+ onQueryChange("");
3185
+ }
3186
+ const display = selectedLabel || selected?.label || "";
3187
+ const sheetTitle = title || placeholder;
3188
+ const searchLabel = searchPlaceholder || placeholder;
3189
+ const loadMoreButton = hasMore && onLoadMore ? /* @__PURE__ */ jsx(
3190
+ Button,
3191
+ {
3192
+ className: "mt-1 w-full",
3193
+ disabled: loadingMore || disabled,
3194
+ size: "sm",
3195
+ type: "button",
3196
+ variant: "ghost",
3197
+ onClick: () => onLoadMore(),
3198
+ children: loadMoreLabel
3199
+ }
3200
+ ) : null;
3201
+ if (isMdUp) {
3202
+ return /* @__PURE__ */ jsx("div", { className: cn("relative w-full", className), children: /* @__PURE__ */ jsxs(
3203
+ Combobox.Root,
3204
+ {
3205
+ items: options,
3206
+ value: selected,
3207
+ open,
3208
+ onOpenChange: setOpenState,
3209
+ inputValue: query,
3210
+ onInputValueChange: (next) => onQueryChange(next),
3211
+ onValueChange: (item) => {
3212
+ if (!item) {
3213
+ clearSelection();
3214
+ return;
3215
+ }
3216
+ selectOption(item);
3217
+ },
3218
+ disabled,
3219
+ filter: null,
3220
+ autoComplete: "none",
3221
+ itemToStringLabel: (item) => item.label,
3222
+ itemToStringValue: (item) => item.id,
3223
+ isItemEqualToValue: (item, current) => item.id === current.id,
3224
+ children: [
3225
+ /* @__PURE__ */ jsxs("div", { className: "relative flex w-full items-center gap-1", children: [
3226
+ /* @__PURE__ */ jsxs(
3227
+ Combobox.Trigger,
3228
+ {
3229
+ id,
3230
+ "aria-invalid": ariaInvalid,
3231
+ "aria-label": openLabel,
3232
+ className: cn(TRIGGER_CLASS, allowClear && value ? "pr-1" : null),
3233
+ disabled,
3234
+ children: [
3235
+ /* @__PURE__ */ jsx(
3236
+ "span",
3237
+ {
3238
+ className: cn(
3239
+ "min-w-0 flex-1 truncate",
3240
+ display ? "text-foreground" : "text-muted-foreground"
3241
+ ),
3242
+ children: display || placeholder
3243
+ }
3244
+ ),
3245
+ /* @__PURE__ */ jsx(
3246
+ ChevronDownIcon,
3247
+ {
3248
+ "aria-hidden": true,
3249
+ className: "size-4 shrink-0 text-muted-foreground"
3250
+ }
3251
+ )
3252
+ ]
3253
+ }
3254
+ ),
3255
+ allowClear && value ? /* @__PURE__ */ jsx(
3256
+ Combobox.Clear,
3257
+ {
3258
+ "aria-label": clearLabel,
3259
+ className: "inline-flex size-8 shrink-0 items-center justify-center rounded-md text-muted-foreground hover:bg-muted hover:text-foreground",
3260
+ disabled,
3261
+ children: /* @__PURE__ */ jsx(XIcon, { className: "size-4", "aria-hidden": true })
3262
+ }
3263
+ ) : null
3264
+ ] }),
3265
+ /* @__PURE__ */ jsx(Combobox.Portal, { children: /* @__PURE__ */ jsx(
3266
+ Combobox.Positioner,
3267
+ {
3268
+ className: "pointer-events-auto isolate z-[60] outline-none",
3269
+ sideOffset: 4,
3270
+ children: /* @__PURE__ */ jsxs(
3271
+ Combobox.Popup,
3272
+ {
3273
+ className: cn(
3274
+ "pointer-events-auto z-[60] flex w-(--anchor-width) min-w-[16rem] flex-col overflow-hidden rounded-lg bg-popover text-popover-foreground shadow-md ring-1 ring-foreground/10",
3275
+ "motion-safe:data-open:animate-in motion-safe:data-open:fade-in-0 motion-safe:data-open:zoom-in-95"
3276
+ ),
3277
+ children: [
3278
+ /* @__PURE__ */ jsx("div", { className: "sticky top-0 z-10 border-b border-border bg-popover p-2", children: /* @__PURE__ */ jsx(
3279
+ Combobox.Input,
3280
+ {
3281
+ "aria-label": searchLabel,
3282
+ className: SEARCH_CLASS,
3283
+ placeholder: searchLabel
3284
+ }
3285
+ ) }),
3286
+ loading ? /* @__PURE__ */ jsx(LoadingRows, {}) : /* @__PURE__ */ jsxs(Fragment, { children: [
3287
+ /* @__PURE__ */ jsx(Combobox.Empty, { className: "px-3 py-3 text-sm text-muted-foreground", children: emptyLabel }),
3288
+ /* @__PURE__ */ jsx(
3289
+ Combobox.List,
3290
+ {
3291
+ className: "max-h-60 overflow-y-auto p-1 outline-none",
3292
+ onWheel: (event) => event.stopPropagation(),
3293
+ children: (item) => /* @__PURE__ */ jsxs(
3294
+ Combobox.Item,
3295
+ {
3296
+ value: item,
3297
+ className: cn(
3298
+ "relative flex cursor-default items-center gap-2 rounded-md py-2 pr-2 pl-8 text-sm outline-none select-none",
3299
+ "data-highlighted:bg-accent data-highlighted:text-accent-foreground"
3300
+ ),
3301
+ children: [
3302
+ /* @__PURE__ */ jsx(Combobox.ItemIndicator, { className: "absolute left-2 flex size-4 items-center justify-center", children: /* @__PURE__ */ jsx(CheckIcon, { className: "size-4", "aria-hidden": true }) }),
3303
+ /* @__PURE__ */ jsx(OptionBody, { option: item })
3304
+ ]
3305
+ },
3306
+ item.id
3307
+ )
3308
+ }
3309
+ ),
3310
+ loadMoreButton ? /* @__PURE__ */ jsx("div", { className: "border-t border-border p-1", children: loadMoreButton }) : null
3311
+ ] })
3312
+ ]
3313
+ }
3314
+ )
3315
+ }
3316
+ ) })
3317
+ ]
3318
+ }
3319
+ ) });
3320
+ }
3321
+ return /* @__PURE__ */ jsxs("div", { className: cn("relative w-full", className), children: [
3322
+ /* @__PURE__ */ jsxs("div", { className: "flex w-full items-center gap-1", children: [
3323
+ /* @__PURE__ */ jsxs(
3324
+ "button",
3325
+ {
3326
+ "aria-expanded": open,
3327
+ "aria-haspopup": "dialog",
3328
+ "aria-invalid": ariaInvalid,
3329
+ "aria-label": openLabel,
3330
+ className: TRIGGER_CLASS,
3331
+ disabled,
3332
+ id,
3333
+ type: "button",
3334
+ onClick: () => setOpenState(true),
3335
+ children: [
3336
+ /* @__PURE__ */ jsx(
3337
+ "span",
3338
+ {
3339
+ className: cn(
3340
+ "min-w-0 flex-1 truncate",
3341
+ display ? "text-foreground" : "text-muted-foreground"
3342
+ ),
3343
+ children: display || placeholder
3344
+ }
3345
+ ),
3346
+ /* @__PURE__ */ jsx(
3347
+ ChevronDownIcon,
3348
+ {
3349
+ "aria-hidden": true,
3350
+ className: "size-4 shrink-0 text-muted-foreground"
3351
+ }
3352
+ )
3353
+ ]
3354
+ }
3355
+ ),
3356
+ allowClear && value ? /* @__PURE__ */ jsx(
3357
+ Button,
3358
+ {
3359
+ "aria-label": clearLabel,
3360
+ disabled,
3361
+ size: "icon",
3362
+ type: "button",
3363
+ variant: "ghost",
3364
+ onClick: clearSelection,
3365
+ children: /* @__PURE__ */ jsx(XIcon, { className: "size-4", "aria-hidden": true })
3366
+ }
3367
+ ) : null
3368
+ ] }),
3369
+ /* @__PURE__ */ jsx(Drawer, { open, onOpenChange: setOpenState, children: /* @__PURE__ */ jsxs(DrawerContent, { className: "max-h-[85vh]", children: [
3370
+ /* @__PURE__ */ jsxs(DrawerHeader, { className: "flex flex-row items-center justify-between gap-2 text-left md:text-left", children: [
3371
+ /* @__PURE__ */ jsx(DrawerTitle, { children: sheetTitle }),
3372
+ allowClear && value ? /* @__PURE__ */ jsx(
3373
+ Button,
3374
+ {
3375
+ size: "sm",
3376
+ type: "button",
3377
+ variant: "ghost",
3378
+ onClick: () => {
3379
+ clearSelection();
3380
+ setOpenState(false);
3381
+ },
3382
+ children: clearLabel
3383
+ }
3384
+ ) : null
3385
+ ] }),
3386
+ /* @__PURE__ */ jsx("div", { className: "sticky top-0 z-10 border-b border-border bg-background px-4 pb-3", children: /* @__PURE__ */ jsx(
3387
+ Input,
3388
+ {
3389
+ ref: searchRef,
3390
+ "aria-label": searchLabel,
3391
+ disabled,
3392
+ placeholder: searchLabel,
3393
+ value: query,
3394
+ onChange: (event) => onQueryChange(event.target.value)
3395
+ }
3396
+ ) }),
3397
+ /* @__PURE__ */ jsxs("div", { className: "overflow-y-auto px-2 pb-4", children: [
3398
+ loading ? /* @__PURE__ */ jsx(LoadingRows, {}) : options.length === 0 ? /* @__PURE__ */ jsx("p", { className: "px-2 py-3 text-sm text-muted-foreground", children: emptyLabel }) : /* @__PURE__ */ jsx("ul", { className: "flex flex-col gap-1 p-1", children: options.map((option) => {
3399
+ const isSelected = option.id === value;
3400
+ return /* @__PURE__ */ jsx("li", { children: /* @__PURE__ */ jsxs(
3401
+ "button",
3402
+ {
3403
+ "aria-selected": isSelected,
3404
+ className: cn(
3405
+ "flex w-full items-center gap-2 rounded-lg px-3 py-3 text-left text-sm outline-none transition-colors",
3406
+ "hover:bg-muted/60 focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50",
3407
+ isSelected ? "bg-accent" : null
3408
+ ),
3409
+ role: "option",
3410
+ type: "button",
3411
+ onClick: () => selectOption(option),
3412
+ children: [
3413
+ /* @__PURE__ */ jsx(OptionBody, { option }),
3414
+ isSelected ? /* @__PURE__ */ jsx(
3415
+ CheckIcon,
3416
+ {
3417
+ "aria-hidden": true,
3418
+ className: "size-4 shrink-0 text-foreground"
3419
+ }
3420
+ ) : null
3421
+ ]
3422
+ }
3423
+ ) }, option.id);
3424
+ }) }),
3425
+ loadMoreButton
3426
+ ] })
3427
+ ] }) })
3428
+ ] });
3429
+ }
2899
3430
  var INPUT_CLASS2 = "h-8 w-full min-w-0 rounded-lg border border-input bg-transparent px-2.5 py-1 text-base transition-colors outline-none placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:pointer-events-none disabled:cursor-not-allowed disabled:bg-input/50 disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 md:text-sm dark:bg-input/30 dark:disabled:bg-input/80 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40";
2900
3431
  var DEFAULT_LABELS = {
2901
3432
  placeholder: "Search\u2026",
@@ -2933,18 +3464,18 @@ function PaginatedCombobox({
2933
3464
  "aria-invalid": ariaInvalid
2934
3465
  }) {
2935
3466
  const labels = { ...DEFAULT_LABELS, ...labelsProp };
2936
- const selected = React2.useMemo(
3467
+ const selected = React3.useMemo(
2937
3468
  () => resolveSelected(value, items, selectedItem),
2938
3469
  [value, items, selectedItem]
2939
3470
  );
2940
- const listItems = React2.useMemo(() => {
3471
+ const listItems = React3.useMemo(() => {
2941
3472
  if (!selected) return items;
2942
3473
  if (items.some((item) => item.value === selected.value)) return items;
2943
3474
  return [selected, ...items];
2944
3475
  }, [items, selected]);
2945
- const queryRef = React2.useRef("");
2946
- const debounceRef = React2.useRef(null);
2947
- React2.useEffect(() => {
3476
+ const queryRef = React3.useRef("");
3477
+ const debounceRef = React3.useRef(null);
3478
+ React3.useEffect(() => {
2948
3479
  return () => {
2949
3480
  if (debounceRef.current) clearTimeout(debounceRef.current);
2950
3481
  };
@@ -3096,18 +3627,132 @@ function PaginatedCombobox({
3096
3627
  )
3097
3628
  ] });
3098
3629
  }
3099
- var DEFAULT_LABELS2 = {
3100
- uploadAria: "Upload image",
3101
- uploadHint: "Click to upload",
3102
- uploadFormats: "PNG, JPG up to 10MB",
3103
- dragging: "Dragging",
3104
- zoomOut: "Zoom out",
3105
- zoomIn: "Zoom in",
3106
- zoomLevel: "Zoom level",
3107
- rotateLeft: "Rotate left 15 degrees",
3108
- rotateRight: "Rotate right 15 degrees",
3109
- toggleGrid: "Toggle grid overlay",
3110
- reset: "Reset all transforms",
3630
+
3631
+ // src/lib/mx-tax-id.ts
3632
+ var RFC_MORAL = /^[A-ZÑ&]{3}\d{6}[A-Z0-9]{3}$/;
3633
+ var RFC_NATURAL = /^[A-ZÑ&]{4}\d{6}[A-Z0-9]{3}$/;
3634
+ var CURP_REGEX = /^[A-Z][AEIOUX][A-Z]{2}\d{6}[HMX][A-Z]{2}[B-DF-HJ-NP-TV-Z]{3}[0-9A-Z]\d$/;
3635
+ var CURP_DICT = "0123456789ABCDEFGHIJKLMN\xD1OPQRSTUVWXYZ";
3636
+ var NATURAL_KINDS = /* @__PURE__ */ new Set([
3637
+ "natural_person_mx",
3638
+ "natural_person_foreign"
3639
+ ]);
3640
+ var LEGAL_KINDS = /* @__PURE__ */ new Set([
3641
+ "legal_entity_mx",
3642
+ "legal_entity_foreign",
3643
+ "trust"
3644
+ ]);
3645
+ function normalizeRfc(raw) {
3646
+ return raw.trim().toUpperCase().replace(/ñ/g, "\xD1");
3647
+ }
3648
+ function rfcMaxLengthForPersonKind(personKind) {
3649
+ if (personKind && LEGAL_KINDS.has(personKind)) return 12;
3650
+ return 13;
3651
+ }
3652
+ function validateRfcForPersonKind(rfc, personKind) {
3653
+ const normalized = normalizeRfc(rfc);
3654
+ if (normalized.length === 0) {
3655
+ return { ok: false, code: "length" };
3656
+ }
3657
+ if (NATURAL_KINDS.has(personKind)) {
3658
+ if (normalized.length !== 13) return { ok: false, code: "length" };
3659
+ return RFC_NATURAL.test(normalized) ? { ok: true } : { ok: false, code: "natural" };
3660
+ }
3661
+ if (LEGAL_KINDS.has(personKind)) {
3662
+ if (normalized.length !== 12) return { ok: false, code: "length" };
3663
+ return RFC_MORAL.test(normalized) ? { ok: true } : { ok: false, code: "moral" };
3664
+ }
3665
+ if (normalized.length === 12) {
3666
+ return RFC_MORAL.test(normalized) ? { ok: true } : { ok: false, code: "moral" };
3667
+ }
3668
+ if (normalized.length === 13) {
3669
+ return RFC_NATURAL.test(normalized) ? { ok: true } : { ok: false, code: "natural" };
3670
+ }
3671
+ return { ok: false, code: "length" };
3672
+ }
3673
+ function normalizeCurpInput(raw) {
3674
+ return raw.trim().toUpperCase().replace(/ñ/g, "\xD1");
3675
+ }
3676
+ function curpCheckDigit(curp17) {
3677
+ let sum = 0;
3678
+ for (let i = 0; i < 17; i++) {
3679
+ const ch = curp17[i] ?? "";
3680
+ const idx = CURP_DICT.indexOf(ch);
3681
+ sum += (idx >= 0 ? idx : 0) * (18 - i);
3682
+ }
3683
+ return (10 - sum % 10) % 10;
3684
+ }
3685
+ function validateCurp(curp) {
3686
+ const normalized = normalizeCurpInput(curp);
3687
+ if (!CURP_REGEX.test(normalized)) {
3688
+ return { ok: false, code: "format" };
3689
+ }
3690
+ const expected = curpCheckDigit(normalized.slice(0, 17));
3691
+ if (expected !== Number(normalized[17])) {
3692
+ return { ok: false, code: "check_digit" };
3693
+ }
3694
+ return { ok: true };
3695
+ }
3696
+ function RfcInput({
3697
+ value,
3698
+ onValueChange,
3699
+ personKind,
3700
+ className,
3701
+ ...props
3702
+ }) {
3703
+ const maxLength = rfcMaxLengthForPersonKind(personKind);
3704
+ return /* @__PURE__ */ jsx(
3705
+ Input,
3706
+ {
3707
+ ...props,
3708
+ autoCapitalize: "characters",
3709
+ className: cn("font-mono uppercase tracking-wide", className),
3710
+ inputMode: "text",
3711
+ maxLength,
3712
+ spellCheck: false,
3713
+ type: "text",
3714
+ value,
3715
+ onChange: (event) => {
3716
+ onValueChange(normalizeRfc(event.target.value));
3717
+ }
3718
+ }
3719
+ );
3720
+ }
3721
+ function CurpInput({
3722
+ value,
3723
+ onValueChange,
3724
+ className,
3725
+ ...props
3726
+ }) {
3727
+ return /* @__PURE__ */ jsx(
3728
+ Input,
3729
+ {
3730
+ ...props,
3731
+ autoCapitalize: "characters",
3732
+ className: cn("font-mono uppercase tracking-wide", className),
3733
+ inputMode: "text",
3734
+ maxLength: 18,
3735
+ spellCheck: false,
3736
+ type: "text",
3737
+ value,
3738
+ onChange: (event) => {
3739
+ onValueChange(normalizeCurpInput(event.target.value));
3740
+ }
3741
+ }
3742
+ );
3743
+ }
3744
+ var DEFAULT_LABELS2 = {
3745
+ uploadAria: "Upload image",
3746
+ uploadHint: "Click to upload",
3747
+ uploadFormats: "PNG, JPG up to 10MB",
3748
+ dragging: "Dragging",
3749
+ zoomOut: "Zoom out",
3750
+ zoomIn: "Zoom in",
3751
+ zoomLevel: "Zoom level",
3752
+ rotateLeft: "Rotate left 15 degrees",
3753
+ rotateRight: "Rotate right 15 degrees",
3754
+ toggleGrid: "Toggle grid overlay",
3755
+ reset: "Reset all transforms",
3111
3756
  replace: "Upload new image",
3112
3757
  discard: "Discard image"
3113
3758
  };
@@ -3628,7 +4273,7 @@ function AvatarEditor({
3628
4273
  }
3629
4274
  );
3630
4275
  }
3631
- function useMediaQuery(query) {
4276
+ function useMediaQuery2(query) {
3632
4277
  const [matches, setMatches] = useState(false);
3633
4278
  useEffect(() => {
3634
4279
  const media = window.matchMedia(query);
@@ -3668,7 +4313,7 @@ function AvatarEditorDialog({
3668
4313
  useEffect(() => {
3669
4314
  setDisplaySrc(value ?? null);
3670
4315
  }, [value]);
3671
- const isMobile = useMediaQuery("(max-width: 640px)");
4316
+ const isMobile = useMediaQuery2("(max-width: 640px)");
3672
4317
  const caption = (placeholder ?? "").trim();
3673
4318
  const handleOpenChange = useCallback(
3674
4319
  (open) => {
@@ -3939,6 +4584,7 @@ var DEFAULT_FILE_UPLOAD_LABELS = {
3939
4584
  function FileDropzone({
3940
4585
  accept,
3941
4586
  maxSize,
4587
+ multiple = false,
3942
4588
  disabled = false,
3943
4589
  labels: labelOverrides,
3944
4590
  onFile,
@@ -3965,10 +4611,15 @@ function FileDropzone({
3965
4611
  setMessage(null);
3966
4612
  onFile(file);
3967
4613
  }
4614
+ function takeFiles(list) {
4615
+ if (!list || list.length === 0 || disabled) return;
4616
+ const files = multiple ? Array.from(list) : [list[0]];
4617
+ for (const file of files) takeFile(file);
4618
+ }
3968
4619
  function onDrop(event) {
3969
4620
  event.preventDefault();
3970
4621
  setDragging(false);
3971
- takeFile(event.dataTransfer.files[0]);
4622
+ takeFiles(event.dataTransfer.files);
3972
4623
  }
3973
4624
  function onKeyDown(event) {
3974
4625
  if (disabled) return;
@@ -4035,11 +4686,12 @@ function FileDropzone({
4035
4686
  ref: inputRef,
4036
4687
  type: "file",
4037
4688
  accept,
4689
+ multiple,
4038
4690
  disabled,
4039
4691
  "aria-label": labels.browse,
4040
4692
  className: "sr-only",
4041
4693
  onChange: (event) => {
4042
- takeFile(event.target.files?.[0]);
4694
+ takeFiles(event.target.files);
4043
4695
  event.target.value = "";
4044
4696
  }
4045
4697
  }
@@ -4453,18 +5105,6 @@ function createMultipartUploadController(options) {
4453
5105
  getStatus: () => state.status
4454
5106
  };
4455
5107
  }
4456
- function useMediaQuery2(query) {
4457
- const [matches, setMatches] = useState(false);
4458
- useEffect(() => {
4459
- if (typeof window === "undefined" || !window.matchMedia) return;
4460
- const mql = window.matchMedia(query);
4461
- const onChange = () => setMatches(mql.matches);
4462
- onChange();
4463
- mql.addEventListener("change", onChange);
4464
- return () => mql.removeEventListener("change", onChange);
4465
- }, [query]);
4466
- return matches;
4467
- }
4468
5108
  function StatHighlightCard({
4469
5109
  label,
4470
5110
  value,
@@ -4544,7 +5184,7 @@ function SparklineStat({
4544
5184
  points,
4545
5185
  className
4546
5186
  }) {
4547
- const reduced = useMediaQuery2("(prefers-reduced-motion: reduce)");
5187
+ const reduced = useMediaQuery("(prefers-reduced-motion: reduce)");
4548
5188
  const path = polyline(points);
4549
5189
  return /* @__PURE__ */ jsxs(
4550
5190
  "div",
@@ -4701,7 +5341,7 @@ function MetricEmptyState({
4701
5341
  );
4702
5342
  }
4703
5343
  function MetricSkeleton({ className, bars = 4 }) {
4704
- const reduced = useMediaQuery2("(prefers-reduced-motion: reduce)");
5344
+ const reduced = useMediaQuery("(prefers-reduced-motion: reduce)");
4705
5345
  const count = Math.max(1, bars);
4706
5346
  return /* @__PURE__ */ jsxs(
4707
5347
  "div",
@@ -5056,6 +5696,654 @@ function LegalAcceptCheckbox({
5056
5696
  ) })
5057
5697
  ] });
5058
5698
  }
5699
+ function StepProgress({
5700
+ segments,
5701
+ current,
5702
+ className,
5703
+ "aria-label": ariaLabel
5704
+ }) {
5705
+ const safeCurrent = Math.max(
5706
+ 0,
5707
+ Math.min(current, Math.max(segments.length - 1, 0))
5708
+ );
5709
+ const active = segments[safeCurrent];
5710
+ return /* @__PURE__ */ jsxs(
5711
+ "div",
5712
+ {
5713
+ "aria-label": ariaLabel,
5714
+ "aria-valuemax": Math.max(segments.length, 1),
5715
+ "aria-valuemin": 1,
5716
+ "aria-valuenow": safeCurrent + 1,
5717
+ "aria-valuetext": active?.label,
5718
+ className: cn("flex min-w-0 flex-col gap-1.5", className),
5719
+ role: "progressbar",
5720
+ children: [
5721
+ /* @__PURE__ */ jsx("div", { className: "flex gap-1", "aria-hidden": true, children: segments.map((segment, index) => {
5722
+ const done = index < safeCurrent;
5723
+ const isCurrent = index === safeCurrent;
5724
+ return /* @__PURE__ */ jsx(
5725
+ "span",
5726
+ {
5727
+ className: cn(
5728
+ "h-1 flex-1 rounded-full",
5729
+ done || isCurrent ? "bg-primary" : "bg-muted",
5730
+ isCurrent ? "opacity-100" : done ? "opacity-80" : "opacity-100"
5731
+ )
5732
+ },
5733
+ segment.id
5734
+ );
5735
+ }) }),
5736
+ active ? /* @__PURE__ */ jsx("p", { className: "truncate text-center text-xs font-medium text-muted-foreground", children: active.label }) : null
5737
+ ]
5738
+ }
5739
+ );
5740
+ }
5741
+ function OptionRow({
5742
+ icon,
5743
+ title,
5744
+ description,
5745
+ badge,
5746
+ badgeVariant = "secondary",
5747
+ showChevron = true,
5748
+ className,
5749
+ type = "button",
5750
+ ...props
5751
+ }) {
5752
+ return /* @__PURE__ */ jsxs(
5753
+ "button",
5754
+ {
5755
+ type,
5756
+ className: cn(
5757
+ "flex w-full items-center gap-3 rounded-xl border border-border bg-background px-4 py-3 text-left transition-colors hover:bg-muted/50 focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 focus-visible:outline-none disabled:pointer-events-none disabled:opacity-50",
5758
+ className
5759
+ ),
5760
+ ...props,
5761
+ children: [
5762
+ icon ? /* @__PURE__ */ jsx("span", { className: "flex size-10 shrink-0 items-center justify-center rounded-lg bg-muted text-foreground [&_svg]:size-5", children: icon }) : null,
5763
+ /* @__PURE__ */ jsxs("span", { className: "min-w-0 flex-1", children: [
5764
+ /* @__PURE__ */ jsxs("span", { className: "flex flex-wrap items-center gap-2", children: [
5765
+ /* @__PURE__ */ jsx("span", { className: "text-sm font-medium text-foreground", children: title }),
5766
+ badge ? /* @__PURE__ */ jsx(Badge, { variant: badgeVariant, className: "font-medium", children: badge }) : null
5767
+ ] }),
5768
+ description ? /* @__PURE__ */ jsx("span", { className: "mt-0.5 block text-sm text-muted-foreground", children: description }) : null
5769
+ ] }),
5770
+ showChevron ? /* @__PURE__ */ jsx(
5771
+ ChevronRight,
5772
+ {
5773
+ "aria-hidden": true,
5774
+ className: "size-4 shrink-0 text-muted-foreground"
5775
+ }
5776
+ ) : null
5777
+ ]
5778
+ }
5779
+ );
5780
+ }
5781
+ function StickyActionBar({
5782
+ children,
5783
+ secondary,
5784
+ className,
5785
+ ...props
5786
+ }) {
5787
+ return /* @__PURE__ */ jsx(
5788
+ "div",
5789
+ {
5790
+ "data-slot": "sticky-action-bar",
5791
+ className: cn(
5792
+ "sticky bottom-0 z-30 -mx-4 mt-auto border-t border-border bg-background/95 px-4 py-3 backdrop-blur supports-[backdrop-filter]:bg-background/80",
5793
+ "pb-[max(0.75rem,env(safe-area-inset-bottom))]",
5794
+ className
5795
+ ),
5796
+ ...props,
5797
+ children: /* @__PURE__ */ jsxs("div", { className: "mx-auto flex w-full max-w-xl flex-col gap-2 sm:flex-row-reverse sm:items-center sm:justify-start", children: [
5798
+ /* @__PURE__ */ jsx("div", { className: "flex flex-col gap-2 sm:flex-row sm:items-center", children }),
5799
+ secondary ? /* @__PURE__ */ jsx("div", { className: "flex flex-col gap-2 sm:mr-auto", children: secondary }) : null
5800
+ ] })
5801
+ }
5802
+ );
5803
+ }
5804
+ var toneVariant = {
5805
+ neutral: "secondary",
5806
+ info: "default",
5807
+ success: "success",
5808
+ warning: "warning",
5809
+ danger: "destructive"
5810
+ };
5811
+ function badgeVariantFor(tone2) {
5812
+ switch (tone2) {
5813
+ case "neutral":
5814
+ return toneVariant.neutral;
5815
+ case "info":
5816
+ return toneVariant.info;
5817
+ case "success":
5818
+ return toneVariant.success;
5819
+ case "warning":
5820
+ return toneVariant.warning;
5821
+ case "danger":
5822
+ return toneVariant.danger;
5823
+ default: {
5824
+ const exhaustive = tone2;
5825
+ return exhaustive;
5826
+ }
5827
+ }
5828
+ }
5829
+ function StatusBadge({
5830
+ label,
5831
+ tone: tone2 = "neutral",
5832
+ className,
5833
+ ...props
5834
+ }) {
5835
+ return /* @__PURE__ */ jsx(
5836
+ Badge,
5837
+ {
5838
+ "data-slot": "status-badge",
5839
+ "data-tone": tone2,
5840
+ variant: badgeVariantFor(tone2),
5841
+ className: cn("font-medium", className),
5842
+ ...props,
5843
+ children: label
5844
+ }
5845
+ );
5846
+ }
5847
+ function DetailHeader({
5848
+ title,
5849
+ badge,
5850
+ subtitle,
5851
+ facts,
5852
+ factsEmpty = "\u2014",
5853
+ primaryAction,
5854
+ secondaryActions = [],
5855
+ moreMenu,
5856
+ moreLabel = "More actions",
5857
+ tabs,
5858
+ className
5859
+ }) {
5860
+ const hasActions = Boolean(primaryAction) || secondaryActions.length > 0 || Boolean(moreMenu);
5861
+ return /* @__PURE__ */ jsxs(
5862
+ "header",
5863
+ {
5864
+ "data-slot": "detail-header",
5865
+ className: cn("flex flex-col gap-4", className),
5866
+ children: [
5867
+ /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-3 sm:flex-row sm:items-start sm:justify-between sm:gap-4", children: [
5868
+ /* @__PURE__ */ jsxs("div", { className: "flex min-w-0 flex-col gap-1", children: [
5869
+ /* @__PURE__ */ jsxs("div", { className: "flex flex-wrap items-center gap-2", children: [
5870
+ /* @__PURE__ */ jsx("h1", { className: "text-2xl font-semibold tracking-tight", children: title }),
5871
+ badge
5872
+ ] }),
5873
+ subtitle ? /* @__PURE__ */ jsx("div", { className: "text-sm text-muted-foreground", children: subtitle }) : null
5874
+ ] }),
5875
+ hasActions ? /* @__PURE__ */ jsxs("div", { className: "flex w-full flex-wrap items-center gap-2 sm:w-auto sm:justify-end", children: [
5876
+ secondaryActions,
5877
+ primaryAction,
5878
+ moreMenu ? /* @__PURE__ */ jsxs(DropdownMenu, { children: [
5879
+ /* @__PURE__ */ jsx(
5880
+ DropdownMenuTrigger,
5881
+ {
5882
+ render: /* @__PURE__ */ jsx(
5883
+ Button,
5884
+ {
5885
+ type: "button",
5886
+ variant: "outline",
5887
+ size: "icon",
5888
+ "aria-label": moreLabel
5889
+ }
5890
+ ),
5891
+ children: /* @__PURE__ */ jsx(MoreHorizontal, { className: "size-4" })
5892
+ }
5893
+ ),
5894
+ /* @__PURE__ */ jsx(DropdownMenuContent, { align: "end", children: moreMenu })
5895
+ ] }) : null
5896
+ ] }) : null
5897
+ ] }),
5898
+ facts && facts.length > 0 ? /* @__PURE__ */ jsx(DataList, { className: "sm:grid-cols-2 lg:grid-cols-3", children: facts.map((fact) => /* @__PURE__ */ jsx(
5899
+ DataListItem,
5900
+ {
5901
+ label: fact.label,
5902
+ empty: factsEmpty,
5903
+ children: fact.value
5904
+ },
5905
+ fact.label
5906
+ )) }) : null,
5907
+ tabs
5908
+ ]
5909
+ }
5910
+ );
5911
+ }
5912
+ function FormSection({
5913
+ title,
5914
+ description,
5915
+ children,
5916
+ aside,
5917
+ className,
5918
+ ...props
5919
+ }) {
5920
+ return /* @__PURE__ */ jsxs(
5921
+ "section",
5922
+ {
5923
+ "data-slot": "form-section",
5924
+ className: cn(
5925
+ "flex flex-col gap-4 rounded-xl border border-border bg-card p-4 sm:p-6",
5926
+ className
5927
+ ),
5928
+ ...props,
5929
+ children: [
5930
+ /* @__PURE__ */ jsxs("div", { className: "flex flex-wrap items-start justify-between gap-2", children: [
5931
+ /* @__PURE__ */ jsxs("div", { className: "min-w-0 space-y-1", children: [
5932
+ /* @__PURE__ */ jsx("h2", { className: "text-base font-semibold tracking-tight", children: title }),
5933
+ description ? /* @__PURE__ */ jsx("p", { className: "text-sm text-muted-foreground", children: description }) : null
5934
+ ] }),
5935
+ aside ? /* @__PURE__ */ jsx("div", { className: "shrink-0", children: aside }) : null
5936
+ ] }),
5937
+ /* @__PURE__ */ jsx("div", { className: "grid gap-4 md:grid-cols-2", children })
5938
+ ]
5939
+ }
5940
+ );
5941
+ }
5942
+ function useDirtyGuard(dirty) {
5943
+ useEffect(() => {
5944
+ if (!dirty) return;
5945
+ function onBeforeUnload(event) {
5946
+ event.preventDefault();
5947
+ event.returnValue = "";
5948
+ }
5949
+ window.addEventListener("beforeunload", onBeforeUnload);
5950
+ return () => window.removeEventListener("beforeunload", onBeforeUnload);
5951
+ }, [dirty]);
5952
+ }
5953
+ function WizardLayout({
5954
+ steps,
5955
+ current,
5956
+ children,
5957
+ onBack,
5958
+ onNext,
5959
+ backLabel = "Back",
5960
+ nextLabel = "Continue",
5961
+ nextDisabled = false,
5962
+ pending = false,
5963
+ secondary,
5964
+ primary,
5965
+ progressLabel: progressLabel2,
5966
+ className
5967
+ }) {
5968
+ const showBack = current > 0 && (onBack || secondary);
5969
+ return /* @__PURE__ */ jsxs(
5970
+ "div",
5971
+ {
5972
+ "data-slot": "wizard-layout",
5973
+ className: cn("flex min-h-0 flex-1 flex-col gap-4", className),
5974
+ children: [
5975
+ /* @__PURE__ */ jsx(
5976
+ StepProgress,
5977
+ {
5978
+ segments: steps,
5979
+ current,
5980
+ "aria-label": progressLabel2
5981
+ }
5982
+ ),
5983
+ /* @__PURE__ */ jsx("div", { className: "flex min-h-0 flex-1 flex-col gap-4", children }),
5984
+ /* @__PURE__ */ jsx(
5985
+ StickyActionBar,
5986
+ {
5987
+ secondary: secondary ?? (showBack && onBack ? /* @__PURE__ */ jsx(
5988
+ Button,
5989
+ {
5990
+ type: "button",
5991
+ variant: "outline",
5992
+ disabled: pending,
5993
+ onClick: onBack,
5994
+ children: backLabel
5995
+ }
5996
+ ) : void 0),
5997
+ children: primary ?? /* @__PURE__ */ jsx(
5998
+ Button,
5999
+ {
6000
+ type: "button",
6001
+ disabled: nextDisabled || pending || !onNext,
6002
+ onClick: onNext,
6003
+ children: pending ? "\u2026" : nextLabel
6004
+ }
6005
+ )
6006
+ }
6007
+ )
6008
+ ]
6009
+ }
6010
+ );
6011
+ }
6012
+ function SectionSummary({
6013
+ title,
6014
+ children,
6015
+ editLabel = "Edit",
6016
+ onEdit,
6017
+ className
6018
+ }) {
6019
+ return /* @__PURE__ */ jsxs(
6020
+ "section",
6021
+ {
6022
+ "data-slot": "section-summary",
6023
+ className: cn(
6024
+ "flex flex-col gap-3 rounded-xl border border-border bg-card p-4",
6025
+ className
6026
+ ),
6027
+ children: [
6028
+ /* @__PURE__ */ jsxs("div", { className: "flex items-start justify-between gap-3", children: [
6029
+ /* @__PURE__ */ jsx("h3", { className: "text-sm font-semibold", children: title }),
6030
+ onEdit ? /* @__PURE__ */ jsx(Button, { type: "button", variant: "ghost", size: "sm", onClick: onEdit, children: editLabel }) : null
6031
+ ] }),
6032
+ /* @__PURE__ */ jsx("div", { className: "text-sm text-muted-foreground", children })
6033
+ ]
6034
+ }
6035
+ );
6036
+ }
6037
+ function QueueLayout({
6038
+ list,
6039
+ review,
6040
+ emptyReview,
6041
+ selectedId,
6042
+ "aria-label": ariaLabel = "Review queue",
6043
+ className,
6044
+ shortcutHint
6045
+ }) {
6046
+ const hasSelection = Boolean(selectedId);
6047
+ return /* @__PURE__ */ jsxs(
6048
+ "div",
6049
+ {
6050
+ "data-slot": "queue-layout",
6051
+ "aria-label": ariaLabel,
6052
+ className: cn(
6053
+ "grid min-h-0 flex-1 gap-4 lg:grid-cols-[minmax(0,22rem)_minmax(0,1fr)] xl:grid-cols-[minmax(0,26rem)_minmax(0,1fr)]",
6054
+ className
6055
+ ),
6056
+ children: [
6057
+ /* @__PURE__ */ jsxs(
6058
+ "aside",
6059
+ {
6060
+ "data-slot": "queue-list",
6061
+ className: cn("min-w-0", hasSelection ? "hidden lg:block" : "block"),
6062
+ children: [
6063
+ list,
6064
+ shortcutHint ? /* @__PURE__ */ jsx("p", { className: "mt-2 text-xs text-muted-foreground", children: shortcutHint }) : null
6065
+ ]
6066
+ }
6067
+ ),
6068
+ /* @__PURE__ */ jsx(
6069
+ "section",
6070
+ {
6071
+ "data-slot": "queue-review",
6072
+ className: cn("min-w-0", hasSelection ? "block" : "hidden lg:block"),
6073
+ children: hasSelection ? review : emptyReview ?? review
6074
+ }
6075
+ )
6076
+ ]
6077
+ }
6078
+ );
6079
+ }
6080
+ function isTypingTarget(target) {
6081
+ if (!(target instanceof HTMLElement)) return false;
6082
+ const tag = target.tagName;
6083
+ if (tag === "INPUT" || tag === "TEXTAREA" || tag === "SELECT") return true;
6084
+ if (target.isContentEditable) return true;
6085
+ if (target.closest('[role="dialog"]')) return true;
6086
+ if (target.closest('[role="listbox"]')) return true;
6087
+ return false;
6088
+ }
6089
+ function useQueueKeys({
6090
+ enabled = true,
6091
+ ids,
6092
+ selectedId,
6093
+ onSelect
6094
+ }) {
6095
+ const move = useCallback(
6096
+ (delta) => {
6097
+ if (ids.length === 0) return;
6098
+ const currentIndex = selectedId ? ids.indexOf(selectedId) : -1;
6099
+ let nextIndex;
6100
+ if (currentIndex < 0) {
6101
+ nextIndex = delta > 0 ? 0 : ids.length - 1;
6102
+ } else {
6103
+ nextIndex = Math.max(0, Math.min(ids.length - 1, currentIndex + delta));
6104
+ }
6105
+ const nextId = ids[nextIndex];
6106
+ if (nextId) onSelect(nextId);
6107
+ },
6108
+ [ids, onSelect, selectedId]
6109
+ );
6110
+ useEffect(() => {
6111
+ if (!enabled) return;
6112
+ function onKeyDown(event) {
6113
+ if (isTypingTarget(event.target)) return;
6114
+ if (event.metaKey || event.ctrlKey || event.altKey) return;
6115
+ switch (event.key) {
6116
+ case "j":
6117
+ case "J":
6118
+ event.preventDefault();
6119
+ move(1);
6120
+ break;
6121
+ case "k":
6122
+ case "K":
6123
+ event.preventDefault();
6124
+ move(-1);
6125
+ break;
6126
+ case "Escape":
6127
+ if (selectedId) {
6128
+ event.preventDefault();
6129
+ onSelect(null);
6130
+ }
6131
+ break;
6132
+ }
6133
+ }
6134
+ window.addEventListener("keydown", onKeyDown);
6135
+ return () => window.removeEventListener("keydown", onKeyDown);
6136
+ }, [enabled, move, onSelect, selectedId]);
6137
+ }
6138
+ function queueRowKeyDown(event, onOpen) {
6139
+ if (event.key !== "Enter" && event.key !== " ") return;
6140
+ if (isTypingTarget(event.target)) return;
6141
+ event.preventDefault();
6142
+ onOpen();
6143
+ }
6144
+ function SectionCard({
6145
+ id,
6146
+ title,
6147
+ description,
6148
+ badge,
6149
+ headerAction,
6150
+ footer,
6151
+ children,
6152
+ tone: tone2 = "default",
6153
+ className,
6154
+ animate = true
6155
+ }) {
6156
+ const reduceMotion = useReducedMotion();
6157
+ const skipMotion = !animate || reduceMotion;
6158
+ return /* @__PURE__ */ jsx(
6159
+ motion.section,
6160
+ {
6161
+ id,
6162
+ "data-slot": "section-card",
6163
+ "data-tone": tone2,
6164
+ className: cn(
6165
+ "scroll-mt-24 rounded-xl",
6166
+ tone2 === "danger" && "ring-1 ring-destructive/30",
6167
+ className
6168
+ ),
6169
+ initial: skipMotion ? false : { opacity: 0, y: 8 },
6170
+ whileInView: skipMotion ? void 0 : { opacity: 1, y: 0 },
6171
+ viewport: { once: true, margin: "-40px" },
6172
+ transition: { duration: 0.25, ease: "easeOut" },
6173
+ children: /* @__PURE__ */ jsxs(
6174
+ Card,
6175
+ {
6176
+ className: cn(
6177
+ tone2 === "danger" && "border-destructive/40 bg-destructive/5"
6178
+ ),
6179
+ children: [
6180
+ /* @__PURE__ */ jsxs(CardHeader, { className: "flex flex-row flex-wrap items-start justify-between gap-3 space-y-0", children: [
6181
+ /* @__PURE__ */ jsxs("div", { className: "min-w-0 space-y-1.5", children: [
6182
+ /* @__PURE__ */ jsxs("div", { className: "flex flex-wrap items-center gap-2", children: [
6183
+ /* @__PURE__ */ jsx(
6184
+ CardTitle,
6185
+ {
6186
+ className: cn(
6187
+ "text-lg",
6188
+ tone2 === "danger" && "text-destructive"
6189
+ ),
6190
+ children: title
6191
+ }
6192
+ ),
6193
+ badge
6194
+ ] }),
6195
+ description ? /* @__PURE__ */ jsx(CardDescription, { children: description }) : null
6196
+ ] }),
6197
+ headerAction ? /* @__PURE__ */ jsx("div", { className: "shrink-0", children: headerAction }) : null
6198
+ ] }),
6199
+ /* @__PURE__ */ jsx(CardContent, { children }),
6200
+ footer ? /* @__PURE__ */ jsx("div", { className: "flex justify-end border-t border-border/60 px-6 pb-6 pt-4", children: footer }) : null
6201
+ ]
6202
+ }
6203
+ )
6204
+ }
6205
+ );
6206
+ }
6207
+
6208
+ // src/lib/prefers-reduced-motion.ts
6209
+ function prefersReducedMotion() {
6210
+ if (typeof window === "undefined" || !window.matchMedia) return false;
6211
+ return window.matchMedia("(prefers-reduced-motion: reduce)").matches;
6212
+ }
6213
+ function useSectionNav(sections) {
6214
+ const [active, setActive] = useState(sections[0]?.id ?? "");
6215
+ useEffect(() => {
6216
+ const elements = sections.map((section) => document.getElementById(section.id)).filter((node) => node !== null);
6217
+ if (elements.length === 0) return;
6218
+ const observer = new IntersectionObserver(
6219
+ (entries) => {
6220
+ const visible = entries.filter((entry) => entry.isIntersecting).sort((a, b) => b.intersectionRatio - a.intersectionRatio);
6221
+ const top = visible[0]?.target.id;
6222
+ if (top) setActive(top);
6223
+ },
6224
+ { rootMargin: "-20% 0px -55% 0px", threshold: [0, 0.25, 0.5, 1] }
6225
+ );
6226
+ for (const element of elements) observer.observe(element);
6227
+ return () => observer.disconnect();
6228
+ }, [sections]);
6229
+ function scrollToSection(id) {
6230
+ document.getElementById(id)?.scrollIntoView({
6231
+ behavior: prefersReducedMotion() ? "auto" : "smooth",
6232
+ block: "start"
6233
+ });
6234
+ setActive(id);
6235
+ }
6236
+ return { active, scrollToSection };
6237
+ }
6238
+ function SectionNavList({
6239
+ sections,
6240
+ active,
6241
+ onSelect,
6242
+ ariaLabel,
6243
+ className,
6244
+ layout
6245
+ }) {
6246
+ if (layout === "mobile") {
6247
+ return /* @__PURE__ */ jsx(
6248
+ "nav",
6249
+ {
6250
+ "data-slot": "section-nav",
6251
+ className: cn("flex gap-2 overflow-x-auto pb-1", className),
6252
+ "aria-label": ariaLabel,
6253
+ children: sections.map((section) => /* @__PURE__ */ jsx(
6254
+ "button",
6255
+ {
6256
+ type: "button",
6257
+ onClick: () => onSelect(section.id),
6258
+ className: cn(
6259
+ "shrink-0 rounded-full border px-4 py-1.5 text-sm font-medium transition-colors",
6260
+ active === section.id ? "border-primary/30 bg-primary/10 text-foreground" : "border-border bg-background/60 text-muted-foreground"
6261
+ ),
6262
+ "aria-current": active === section.id ? "true" : void 0,
6263
+ children: section.label
6264
+ },
6265
+ section.id
6266
+ ))
6267
+ }
6268
+ );
6269
+ }
6270
+ return /* @__PURE__ */ jsx("nav", { "data-slot": "section-nav", className, "aria-label": ariaLabel, children: /* @__PURE__ */ jsx("ul", { className: "sticky top-20 space-y-1", children: sections.map((section) => /* @__PURE__ */ jsx("li", { children: /* @__PURE__ */ jsx(
6271
+ "button",
6272
+ {
6273
+ type: "button",
6274
+ onClick: () => onSelect(section.id),
6275
+ className: cn(
6276
+ "w-full rounded-lg px-3 py-2 text-left text-sm font-medium transition-colors",
6277
+ active === section.id ? "bg-primary/10 text-foreground" : "text-muted-foreground hover:bg-muted/60 hover:text-foreground"
6278
+ ),
6279
+ "aria-current": active === section.id ? "true" : void 0,
6280
+ children: section.label
6281
+ }
6282
+ ) }, section.id)) }) });
6283
+ }
6284
+ function SectionNav({
6285
+ sections,
6286
+ ariaLabel,
6287
+ className
6288
+ }) {
6289
+ const { active, scrollToSection } = useSectionNav(sections);
6290
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
6291
+ /* @__PURE__ */ jsx(
6292
+ SectionNavList,
6293
+ {
6294
+ sections,
6295
+ active,
6296
+ onSelect: scrollToSection,
6297
+ ariaLabel,
6298
+ layout: "mobile",
6299
+ className: cn("md:hidden", className)
6300
+ }
6301
+ ),
6302
+ /* @__PURE__ */ jsx(
6303
+ SectionNavList,
6304
+ {
6305
+ sections,
6306
+ active,
6307
+ onSelect: scrollToSection,
6308
+ ariaLabel,
6309
+ layout: "desktop",
6310
+ className: cn("hidden md:block", className)
6311
+ }
6312
+ )
6313
+ ] });
6314
+ }
6315
+ function SettingRow({
6316
+ label,
6317
+ description,
6318
+ control,
6319
+ className,
6320
+ htmlFor
6321
+ }) {
6322
+ return /* @__PURE__ */ jsxs(
6323
+ "div",
6324
+ {
6325
+ "data-slot": "setting-row",
6326
+ className: cn(
6327
+ "flex flex-col gap-3 border-b border-border py-4 last:border-b-0 sm:flex-row sm:items-center sm:justify-between sm:gap-6",
6328
+ className
6329
+ ),
6330
+ children: [
6331
+ /* @__PURE__ */ jsxs("div", { className: "min-w-0 space-y-1", children: [
6332
+ /* @__PURE__ */ jsx(
6333
+ "label",
6334
+ {
6335
+ htmlFor,
6336
+ className: "text-sm font-medium text-foreground",
6337
+ children: label
6338
+ }
6339
+ ),
6340
+ description ? /* @__PURE__ */ jsx("p", { className: "text-sm text-muted-foreground", children: description }) : null
6341
+ ] }),
6342
+ /* @__PURE__ */ jsx("div", { className: "shrink-0 sm:text-right", children: control })
6343
+ ]
6344
+ }
6345
+ );
6346
+ }
5059
6347
  function sanitizeHref(href) {
5060
6348
  const trimmed = href.trim();
5061
6349
  if (/^https?:\/\//i.test(trimmed) || /^mailto:/i.test(trimmed)) {
@@ -5163,10 +6451,10 @@ var DEFAULT_AUDIT_TIMELINE_LABELS = {
5163
6451
  actor: "Actor",
5164
6452
  subject: "Subject"
5165
6453
  };
5166
- function formatOccurredAt(occurredAt) {
6454
+ function formatOccurredAt(occurredAt, locale = "en") {
5167
6455
  const date = new Date(occurredAt);
5168
6456
  if (Number.isNaN(date.getTime())) return String(occurredAt);
5169
- return new Intl.DateTimeFormat("en", {
6457
+ return new Intl.DateTimeFormat(locale, {
5170
6458
  dateStyle: "medium",
5171
6459
  timeStyle: "short",
5172
6460
  timeZone: "America/Mexico_City"
@@ -5181,9 +6469,11 @@ function AuditTimeline({
5181
6469
  labels,
5182
6470
  emptyAction,
5183
6471
  className,
5184
- formatOccurredAt: format = formatOccurredAt
6472
+ locale = "en",
6473
+ formatOccurredAt: format
5185
6474
  }) {
5186
6475
  const copy = { ...DEFAULT_AUDIT_TIMELINE_LABELS, ...labels };
6476
+ const formatTime = format ?? ((occurredAt) => formatOccurredAt(occurredAt, locale));
5187
6477
  if (items.length === 0) {
5188
6478
  return /* @__PURE__ */ jsx(
5189
6479
  EmptyState,
@@ -5205,7 +6495,7 @@ function AuditTimeline({
5205
6495
  children: [
5206
6496
  /* @__PURE__ */ jsxs("div", { className: "flex flex-wrap items-baseline justify-between gap-2", children: [
5207
6497
  /* @__PURE__ */ jsx("p", { className: "font-mono text-sm font-medium", children: item.type }),
5208
- /* @__PURE__ */ jsx("time", { className: "text-xs text-muted-foreground", dateTime: iso, children: format(item.occurredAt) })
6498
+ /* @__PURE__ */ jsx("time", { className: "text-xs text-muted-foreground", dateTime: iso, children: formatTime(item.occurredAt) })
5209
6499
  ] }),
5210
6500
  /* @__PURE__ */ jsx("p", { className: "mt-2 text-sm", children: item.summary }),
5211
6501
  /* @__PURE__ */ jsxs("p", { className: "mt-2 text-xs text-muted-foreground", children: [
@@ -5505,6 +6795,6 @@ function MatchReview({
5505
6795
  );
5506
6796
  }
5507
6797
 
5508
- export { AccountMenu, AppShell, AuditTimeline, AvatarEditor, AvatarEditorDialog, COOKIE_CONSENT_MAX_AGE, COOKIE_CONSENT_NAME, COOKIE_CONSENT_VALUES, COUNTRY_OPTIONS, ConfirmDestructiveDialog, CookieConsentBanner, CostBreakdownCard, CountryPicker, DATA_TABLE_ROW_CLASS, DEFAULT_AUDIT_TIMELINE_LABELS, DEFAULT_COOKIE_CONSENT_BANNER_LABELS, DEFAULT_EDITABLE_SECTION_LABELS, DEFAULT_ENTITY_GRAPH_LABELS, DEFAULT_FILE_DROPZONE_LABELS, DEFAULT_FILE_UPLOAD_LABELS, DEFAULT_FILE_UPLOAD_TRAY_LABELS, DEFAULT_LEGAL_ACCEPT_CHECKBOX_LABELS, DEFAULT_LEGAL_ACCEPT_DIALOG_LABELS, DEFAULT_MATCH_REVIEW_LABELS, DEFAULT_NOTIFICATION_BELL_LABELS, DEFAULT_RISK_BADGE_LABELS, DashboardSkeleton, DataList, DataListItem, DataTable, DataTableSkeleton, DetailPageSkeleton, DimensionBreakdownTable, EditableSection, Empty2 as Empty, EmptyContent2 as EmptyContent, EmptyDescription2 as EmptyDescription, EmptyHeader2 as EmptyHeader, EmptyMedia2 as EmptyMedia, EmptyState, EmptyTitle2 as EmptyTitle, EntityGraph, ErrorState, Field, FieldMessage, FileDropzone, FileUploadMenu, FileUploadTray, FormCardSkeleton, LanguageContext, LanguageSwitcher, LegalAcceptCheckbox, LegalAcceptDialog, LegalMarkdown, ListSkeleton, LoadingState, MatchReview, MetricChartCard, MetricEmptyState, MetricSkeleton, NavTabs, NavigationProgress, NotificationBell, PageContainer, PageTitle, PageTitleSkeleton, PaginatedCombobox, RiskBadge, RouteLoading, SafeImage, SparklineStat, StatHighlightCard, THEME_INIT_SCRIPT, THEME_INIT_SCRIPT_ID, THEME_STORAGE_KEY, TIME_RANGE_OPTIONS, TableSkeleton, ThemeSwitcher, TimeRangePicker, avatarFallbackStyle, cn, cookieConsentAllowsReplay, cookieDomainFromHostname, countryLabel, countryPickerItems, createMultipartUploadController, defaultLanguages, fileMatchesAccept, filterCountries, formatCountryOptionLabel, getAvatarColors, getInitials, isCookieConsentValue, isEmbeddedWindow, isKnownCountryCode, matchClaimIsUnverified, parseCookieConsent, partRanges, progressFromBytes, readCookieConsent, renderShellLink, serializeCookieConsent, signalNavigationStart, sourceUrlIsHttps, suppressNavigationProgress, useEditableSection, useLanguageContext, useMediaQuery2 as useMediaQuery, writeCookieConsent };
6798
+ export { AccountMenu, AppShell, AuditTimeline, AvatarEditor, AvatarEditorDialog, COOKIE_CONSENT_MAX_AGE, COOKIE_CONSENT_NAME, COOKIE_CONSENT_VALUES, COUNTRY_OPTIONS, CURP_REGEX, ConfirmDestructiveDialog, CookieConsentBanner, CostBreakdownCard, CountryPicker, CurpInput, DATA_TABLE_ROW_CLASS, DEFAULT_AUDIT_TIMELINE_LABELS, DEFAULT_COOKIE_CONSENT_BANNER_LABELS, DEFAULT_EDITABLE_SECTION_LABELS, DEFAULT_ENTITY_GRAPH_LABELS, DEFAULT_FILE_DROPZONE_LABELS, DEFAULT_FILE_UPLOAD_LABELS, DEFAULT_FILE_UPLOAD_TRAY_LABELS, DEFAULT_LEGAL_ACCEPT_CHECKBOX_LABELS, DEFAULT_LEGAL_ACCEPT_DIALOG_LABELS, DEFAULT_MATCH_REVIEW_LABELS, DEFAULT_NOTIFICATION_BELL_LABELS, DEFAULT_RISK_BADGE_LABELS, DashboardSkeleton, DataList, DataListItem, DataTable, DataTableSkeleton, DetailHeader, DetailPageSkeleton, DimensionBreakdownTable, EditableSection, Empty2 as Empty, EmptyContent2 as EmptyContent, EmptyDescription2 as EmptyDescription, EmptyHeader2 as EmptyHeader, EmptyMedia2 as EmptyMedia, EmptyState, EmptyTitle2 as EmptyTitle, EntityGraph, ErrorState, Field, FieldMessage, FileDropzone, FileUploadMenu, FileUploadTray, FormCardSkeleton, FormSection, LanguageContext, LanguageSwitcher, LegalAcceptCheckbox, LegalAcceptDialog, LegalMarkdown, ListSkeleton, LoadingState, MatchReview, MetricChartCard, MetricEmptyState, MetricSkeleton, NavTabs, NavigationProgress, NotificationBell, OptionRow, PageContainer, PageTitle, PageTitleSkeleton, PaginatedCombobox, QueueLayout, RfcInput, RiskBadge, RouteLoading, SafeImage, SearchablePicker, SectionCard, SectionNav, SectionNavList, SectionSummary, SettingRow, SparklineStat, StatHighlightCard, StatusBadge, StepProgress, StickyActionBar, THEME_INIT_SCRIPT, THEME_INIT_SCRIPT_ID, THEME_STORAGE_KEY, TIME_RANGE_OPTIONS, TableSkeleton, ThemeSwitcher, TimeRangePicker, WizardLayout, avatarFallbackStyle, cn, cookieConsentAllowsReplay, cookieDomainFromHostname, countryLabel, countryPickerItems, createMultipartUploadController, curpCheckDigit, defaultLanguages, fileMatchesAccept, filterCountries, formatCountryOptionLabel, getAvatarColors, getInitials, isCookieConsentValue, isEmbeddedWindow, isKnownCountryCode, matchClaimIsUnverified, normalizeCurpInput, normalizeRfc, parseCookieConsent, partRanges, progressFromBytes, queueRowKeyDown, readCookieConsent, renderShellLink, rfcMaxLengthForPersonKind, serializeCookieConsent, signalNavigationStart, sourceUrlIsHttps, suppressNavigationProgress, useDirtyGuard, useEditableSection, useLanguageContext, useMediaQuery, useQueueKeys, useSectionNav, validateCurp, validateRfcForPersonKind, writeCookieConsent };
5509
6799
  //# sourceMappingURL=index.js.map
5510
6800
  //# sourceMappingURL=index.js.map