xertica-ui 2.4.1 → 2.5.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 (52) hide show
  1. package/CHANGELOG.md +49 -0
  2. package/README.md +28 -2
  3. package/bin/generate-tokens.ts +9 -9
  4. package/components/brand/xertica-provider/XerticaProvider.tsx +4 -1
  5. package/components/layout/sidebar/sidebar.stories.tsx +201 -0
  6. package/components/layout/sidebar/sidebar.tsx +86 -1
  7. package/components/pages/template-page/TemplatePage.stories.tsx +8 -15
  8. package/components/ui/chart/chart.test.tsx +1 -1
  9. package/components/ui/chart/chart.tsx +13 -6
  10. package/contexts/BrandColorsContext.tsx +39 -8
  11. package/contexts/theme-data.ts +51 -0
  12. package/dist/AssistantChart-BZTPJ5dP.cjs +3551 -0
  13. package/dist/AssistantChart-DMJJ_Amf.js +3383 -0
  14. package/dist/BrandColorsContext-BMRJ04Wf.js +718 -0
  15. package/dist/BrandColorsContext-BwY-b6M4.cjs +725 -0
  16. package/dist/VerifyEmailPage-CGIwmWrm.js +3296 -0
  17. package/dist/VerifyEmailPage-CpqqpLpo.cjs +3305 -0
  18. package/dist/XerticaProvider-CeS5G_n5.cjs +45 -0
  19. package/dist/XerticaProvider-ra2NciRq.js +43 -0
  20. package/dist/assistant.cjs.js +1 -1
  21. package/dist/assistant.es.js +1 -1
  22. package/dist/brand.cjs.js +1 -1
  23. package/dist/brand.es.js +1 -1
  24. package/dist/cli.js +45 -9
  25. package/dist/components/brand/xertica-provider/XerticaProvider.d.ts +3 -1
  26. package/dist/components/ui/chart/chart.d.ts +12 -3
  27. package/dist/contexts/theme-data.d.ts +4 -0
  28. package/dist/hooks.cjs.js +1 -1
  29. package/dist/hooks.es.js +1 -1
  30. package/dist/index.cjs.js +6 -6
  31. package/dist/index.es.js +6 -6
  32. package/dist/layout.cjs.js +1 -1
  33. package/dist/layout.es.js +1 -1
  34. package/dist/pages.cjs.js +1 -1
  35. package/dist/pages.es.js +1 -1
  36. package/dist/rich-text-editor-B2CKz7nx.cjs +2903 -0
  37. package/dist/rich-text-editor-DloeW0wc.js +2832 -0
  38. package/dist/sidebar-0ocFLSks.js +878 -0
  39. package/dist/sidebar-CeTMuzOx.cjs +881 -0
  40. package/dist/ui.cjs.js +2 -2
  41. package/dist/ui.es.js +2 -2
  42. package/dist/xertica-assistant-CyikE3N_.js +2173 -0
  43. package/dist/xertica-assistant-QFUnv5I2.cjs +2180 -0
  44. package/dist/xertica-ui.css +1 -1
  45. package/docs/components/sidebar.md +19 -2
  46. package/llms-compact.txt +30 -1
  47. package/llms.txt +1 -1
  48. package/package.json +2 -2
  49. package/styles/xertica/tokens.css +9 -9
  50. package/templates/guidelines/Guidelines.md +643 -355
  51. package/templates/package.json +2 -2
  52. package/templates/src/styles/xertica/tokens.css +9 -9
@@ -0,0 +1,3383 @@
1
+ import { jsx, jsxs } from 'react/jsx-runtime';
2
+ import * as AspectRatioPrimitive from '@radix-ui/react-aspect-ratio';
3
+ import { GripVerticalIcon, ChevronDownIcon, MoreHorizontalIcon, ChevronRightIcon, ChevronLeftIcon, MinusIcon, ChevronLeft, ChevronRight, ChevronDown, XIcon, CheckIcon, CircleIcon, SearchIcon, TrendingUp, TrendingDown, Minus, ArrowRight, ArrowLeft, X, Check, Upload, AlertCircle, FileIcon, Star, Search as Search$1 } from 'lucide-react';
4
+ import * as React from 'react';
5
+ import React__default, { useState, useCallback, useMemo, useRef, useEffect } from 'react';
6
+ import { c as cn, b as buttonVariants, B as Button } from './button-DZHzN1Gd.js';
7
+ import * as NavigationMenuPrimitive from '@radix-ui/react-navigation-menu';
8
+ import { cva } from 'class-variance-authority';
9
+ import * as ToggleGroupPrimitive from '@radix-ui/react-toggle-group';
10
+ import * as TogglePrimitive from '@radix-ui/react-toggle';
11
+ import { OTPInput, OTPInputContext } from 'input-otp';
12
+ import { Slot } from '@radix-ui/react-slot';
13
+ import { FormProvider, Controller, useFormContext, useFormState } from 'react-hook-form';
14
+ import { L as Label, M as Map$1 } from './alert-dialog-DqlRW_An.js';
15
+ import { getDefaultClassNames, DayPicker } from 'react-day-picker';
16
+ import * as DialogPrimitive from '@radix-ui/react-dialog';
17
+ import { Drawer as Drawer$1 } from 'vaul';
18
+ import * as HoverCardPrimitive from '@radix-ui/react-hover-card';
19
+ import * as ContextMenuPrimitive from '@radix-ui/react-context-menu';
20
+ import * as MenubarPrimitive from '@radix-ui/react-menubar';
21
+ import { Command as Command$1 } from 'cmdk';
22
+ import { k as Dialog, q as DialogHeader, t as DialogTitle, o as DialogDescription, n as DialogContent, c as ChartContainer, g as ChartTooltip, h as ChartTooltipContent } from './rich-text-editor-DloeW0wc.js';
23
+ import { C as Card, b as CardContent, S as Skeleton } from './skeleton-DtR5tkYe.js';
24
+ import * as CollapsiblePrimitive from '@radix-ui/react-collapsible';
25
+ import * as AccordionPrimitive from '@radix-ui/react-accordion';
26
+ import useEmblaCarousel from 'embla-carousel-react';
27
+ import { u as useGoogleMapsLoader } from './google-maps-loader-BCe58h9D.js';
28
+ import { BarChart, CartesianGrid, XAxis, Bar } from 'recharts';
29
+
30
+ function AspectRatio({ ...props }) {
31
+ return /* @__PURE__ */ jsx(AspectRatioPrimitive.Root, { "data-slot": "aspect-ratio", ...props });
32
+ }
33
+
34
+ const ResizableContext = React.createContext(null);
35
+ const ResizablePanelGroup = ({
36
+ children,
37
+ className,
38
+ direction = "horizontal",
39
+ id,
40
+ autoSaveId,
41
+ storage,
42
+ onLayout,
43
+ ...props
44
+ }) => {
45
+ const [panels, setPanels] = React.useState(/* @__PURE__ */ new Map());
46
+ const [handles, setHandles] = React.useState(/* @__PURE__ */ new Map());
47
+ const [sizes, setSizes] = React.useState(/* @__PURE__ */ new Map());
48
+ const [isDragging, setIsDragging] = React.useState(false);
49
+ const containerRef = React.useRef(null);
50
+ const getSortedItems = React.useCallback(
51
+ (items) => {
52
+ if (!containerRef.current) return [];
53
+ return Array.from(items.values()).sort((a, b) => {
54
+ if (!a.ref.current || !b.ref.current) return 0;
55
+ const position = a.ref.current.compareDocumentPosition(b.ref.current);
56
+ if (position & Node.DOCUMENT_POSITION_FOLLOWING) return -1;
57
+ if (position & Node.DOCUMENT_POSITION_PRECEDING) return 1;
58
+ return 0;
59
+ });
60
+ },
61
+ []
62
+ );
63
+ React.useEffect(() => {
64
+ const sortedPanels = getSortedItems(panels);
65
+ if (sortedPanels.length === 0) return;
66
+ const uninitialized = sortedPanels.some((p) => !sizes.has(p.id));
67
+ if (uninitialized) {
68
+ const newSizes = new Map(sizes);
69
+ const remainingSpace = 100;
70
+ const defaultSizeCount = sortedPanels.filter((p) => p.defaultSize).length;
71
+ let usedSpace = 0;
72
+ sortedPanels.forEach((p) => {
73
+ if (p.defaultSize) usedSpace += p.defaultSize;
74
+ });
75
+ const spaceForOthers = Math.max(0, remainingSpace - usedSpace);
76
+ const countOthers = sortedPanels.length - defaultSizeCount;
77
+ const sizeForOthers = countOthers > 0 ? spaceForOthers / countOthers : 0;
78
+ sortedPanels.forEach((p) => {
79
+ if (!newSizes.has(p.id)) {
80
+ newSizes.set(p.id, p.defaultSize ?? sizeForOthers);
81
+ }
82
+ });
83
+ setSizes(newSizes);
84
+ }
85
+ }, [panels, sizes, getSortedItems]);
86
+ const registerPanel = React.useCallback((data) => {
87
+ setPanels((prev) => {
88
+ const next = new Map(prev);
89
+ next.set(data.id, data);
90
+ return next;
91
+ });
92
+ }, []);
93
+ const unregisterPanel = React.useCallback((id2) => {
94
+ setPanels((prev) => {
95
+ const next = new Map(prev);
96
+ next.delete(id2);
97
+ return next;
98
+ });
99
+ setSizes((prev) => {
100
+ const next = new Map(prev);
101
+ next.delete(id2);
102
+ return next;
103
+ });
104
+ }, []);
105
+ const registerHandle = React.useCallback((data) => {
106
+ setHandles((prev) => {
107
+ const next = new Map(prev);
108
+ next.set(data.id, data);
109
+ return next;
110
+ });
111
+ }, []);
112
+ const unregisterHandle = React.useCallback((id2) => {
113
+ setHandles((prev) => {
114
+ const next = new Map(prev);
115
+ next.delete(id2);
116
+ return next;
117
+ });
118
+ }, []);
119
+ const startDragging = React.useCallback(
120
+ (handleId, event) => {
121
+ event.preventDefault();
122
+ setIsDragging(true);
123
+ const sortedPanels = getSortedItems(panels);
124
+ const sortedHandles = getSortedItems(handles);
125
+ const handleIndex = sortedHandles.findIndex((h) => h.id === handleId);
126
+ if (handleIndex === -1) return;
127
+ const leftPanel = sortedPanels[handleIndex];
128
+ const rightPanel = sortedPanels[handleIndex + 1];
129
+ if (!leftPanel || !rightPanel) return;
130
+ const startX = "touches" in event ? event.touches[0].clientX : event.clientX;
131
+ const startY = "touches" in event ? event.touches[0].clientY : event.clientY;
132
+ const startSizeLeft = sizes.get(leftPanel.id) || 0;
133
+ const startSizeRight = sizes.get(rightPanel.id) || 0;
134
+ const containerSize = direction === "horizontal" ? containerRef.current?.offsetWidth || 1 : containerRef.current?.offsetHeight || 1;
135
+ const onMove = (e) => {
136
+ const currentX = "touches" in e ? e.touches[0].clientX : e.clientX;
137
+ const currentY = "touches" in e ? e.touches[0].clientY : e.clientY;
138
+ const deltaPixels = direction === "horizontal" ? currentX - startX : currentY - startY;
139
+ const deltaPercent = deltaPixels / containerSize * 100;
140
+ let finalLeft = startSizeLeft + deltaPercent;
141
+ let finalRight = startSizeRight - deltaPercent;
142
+ if (leftPanel.minSize !== void 0 && finalLeft < leftPanel.minSize) {
143
+ const diff = leftPanel.minSize - finalLeft;
144
+ finalLeft = leftPanel.minSize;
145
+ finalRight -= diff;
146
+ }
147
+ if (rightPanel.minSize !== void 0 && finalRight < rightPanel.minSize) {
148
+ const diff = rightPanel.minSize - finalRight;
149
+ finalRight = rightPanel.minSize;
150
+ finalLeft -= diff;
151
+ }
152
+ if (leftPanel.maxSize !== void 0 && finalLeft > leftPanel.maxSize) {
153
+ const diff = finalLeft - leftPanel.maxSize;
154
+ finalLeft = leftPanel.maxSize;
155
+ finalRight += diff;
156
+ }
157
+ if (rightPanel.maxSize !== void 0 && finalRight > rightPanel.maxSize) {
158
+ const diff = finalRight - rightPanel.maxSize;
159
+ finalRight = rightPanel.maxSize;
160
+ finalLeft -= diff;
161
+ }
162
+ finalLeft = Math.max(0, Math.min(100, finalLeft));
163
+ finalRight = Math.max(0, Math.min(100, finalRight));
164
+ setSizes((prev) => {
165
+ const next = new Map(prev);
166
+ next.set(leftPanel.id, finalLeft);
167
+ next.set(rightPanel.id, finalRight);
168
+ return next;
169
+ });
170
+ leftPanel.onResize?.(finalLeft);
171
+ rightPanel.onResize?.(finalRight);
172
+ };
173
+ const onUp = () => {
174
+ setIsDragging(false);
175
+ window.removeEventListener("mousemove", onMove);
176
+ window.removeEventListener("mouseup", onUp);
177
+ window.removeEventListener("touchmove", onMove);
178
+ window.removeEventListener("touchend", onUp);
179
+ if (onLayout) {
180
+ onLayout(sortedPanels.map((p) => sizes.get(p.id) || 0));
181
+ }
182
+ };
183
+ window.addEventListener("mousemove", onMove);
184
+ window.addEventListener("mouseup", onUp);
185
+ window.addEventListener("touchmove", onMove);
186
+ window.addEventListener("touchend", onUp);
187
+ },
188
+ [panels, handles, sizes, direction, getSortedItems, onLayout]
189
+ );
190
+ const getPanelStyle = React.useCallback(
191
+ (id2) => {
192
+ const size = sizes.get(id2);
193
+ if (size === void 0) return { flex: "1 1 0%", overflow: "hidden" };
194
+ return { flex: `${size} 1 0%`, overflow: "hidden" };
195
+ },
196
+ [sizes]
197
+ );
198
+ const contextValue = React.useMemo(
199
+ () => ({
200
+ direction,
201
+ registerPanel,
202
+ unregisterPanel,
203
+ registerHandle,
204
+ unregisterHandle,
205
+ isDragging,
206
+ startDragging,
207
+ getPanelStyle
208
+ }),
209
+ [
210
+ direction,
211
+ registerPanel,
212
+ unregisterPanel,
213
+ registerHandle,
214
+ unregisterHandle,
215
+ isDragging,
216
+ startDragging,
217
+ getPanelStyle
218
+ ]
219
+ );
220
+ return /* @__PURE__ */ jsx(ResizableContext.Provider, { value: contextValue, children: /* @__PURE__ */ jsx(
221
+ "div",
222
+ {
223
+ ref: containerRef,
224
+ "data-slot": "resizable-panel-group",
225
+ "data-panel-group-direction": direction,
226
+ className: cn(
227
+ "flex h-full w-full data-[panel-group-direction=vertical]:flex-col",
228
+ className
229
+ ),
230
+ ...props,
231
+ children
232
+ }
233
+ ) });
234
+ };
235
+ const ResizablePanel = ({
236
+ className,
237
+ defaultSize,
238
+ minSize = 0,
239
+ maxSize = 100,
240
+ collapsible,
241
+ collapsedSize,
242
+ onCollapse,
243
+ onExpand,
244
+ onResize,
245
+ order,
246
+ tagName,
247
+ id: propId,
248
+ children,
249
+ ...props
250
+ }) => {
251
+ const context = React.useContext(ResizableContext);
252
+ const ref = React.useRef(null);
253
+ const [generatedId] = React.useState(() => Math.random().toString(36).substr(2, 9));
254
+ const id = propId || generatedId;
255
+ const registerPanel = context?.registerPanel;
256
+ const unregisterPanel = context?.unregisterPanel;
257
+ React.useLayoutEffect(() => {
258
+ if (!registerPanel || !unregisterPanel) return;
259
+ registerPanel({
260
+ id,
261
+ ref,
262
+ defaultSize,
263
+ minSize,
264
+ maxSize,
265
+ collapsible,
266
+ onCollapse,
267
+ onExpand,
268
+ onResize
269
+ });
270
+ return () => unregisterPanel(id);
271
+ }, [
272
+ registerPanel,
273
+ unregisterPanel,
274
+ id,
275
+ defaultSize,
276
+ minSize,
277
+ maxSize,
278
+ collapsible,
279
+ onCollapse,
280
+ onExpand,
281
+ onResize
282
+ ]);
283
+ if (!context) {
284
+ return /* @__PURE__ */ jsx("div", { className: cn("flex-1", className), ...props, children });
285
+ }
286
+ return /* @__PURE__ */ jsx(
287
+ "div",
288
+ {
289
+ ref,
290
+ "data-slot": "resizable-panel",
291
+ className: cn("relative transition-[flex-grow] duration-0", className),
292
+ style: context.getPanelStyle(id),
293
+ ...props,
294
+ children
295
+ }
296
+ );
297
+ };
298
+ const ResizableHandle = ({
299
+ withHandle,
300
+ className,
301
+ id: propId,
302
+ tagName,
303
+ ...props
304
+ }) => {
305
+ const context = React.useContext(ResizableContext);
306
+ const ref = React.useRef(null);
307
+ const [generatedId] = React.useState(() => Math.random().toString(36).substr(2, 9));
308
+ const id = propId || generatedId;
309
+ const registerHandle = context?.registerHandle;
310
+ const unregisterHandle = context?.unregisterHandle;
311
+ React.useLayoutEffect(() => {
312
+ if (!registerHandle || !unregisterHandle) return;
313
+ registerHandle({ id, ref });
314
+ return () => unregisterHandle(id);
315
+ }, [registerHandle, unregisterHandle, id]);
316
+ const handleMouseDown = (e) => {
317
+ if (context) {
318
+ context.startDragging(id, e);
319
+ }
320
+ };
321
+ if (!context) return null;
322
+ return /* @__PURE__ */ jsx(
323
+ "div",
324
+ {
325
+ ref,
326
+ "data-slot": "resizable-handle",
327
+ className: cn(
328
+ "bg-border relative flex items-center justify-center focus-visible:outline-hidden",
329
+ "touch-none select-none",
330
+ context.direction === "vertical" ? "h-px w-full cursor-row-resize after:left-0 after:h-1 after:w-full after:-translate-y-1/2 hover:after:h-4" : "w-px h-full cursor-col-resize after:top-0 after:w-1 after:h-full after:-translate-x-1/2 hover:after:w-4",
331
+ "after:absolute after:z-10",
332
+ className
333
+ ),
334
+ onMouseDown: handleMouseDown,
335
+ onTouchStart: handleMouseDown,
336
+ ...props,
337
+ children: withHandle && /* @__PURE__ */ jsx("div", { className: "bg-border z-10 flex h-4 w-3 items-center justify-center rounded-xs border", children: /* @__PURE__ */ jsx(GripVerticalIcon, { className: "size-2.5" }) })
338
+ }
339
+ );
340
+ };
341
+
342
+ function NavigationMenu({
343
+ className,
344
+ children,
345
+ viewport = true,
346
+ ...props
347
+ }) {
348
+ return /* @__PURE__ */ jsxs(
349
+ NavigationMenuPrimitive.Root,
350
+ {
351
+ "data-slot": "navigation-menu",
352
+ className: cn("relative z-10 flex w-full flex-1 items-center justify-center", className),
353
+ ...props,
354
+ children: [
355
+ children,
356
+ viewport && /* @__PURE__ */ jsx(NavigationMenuViewport, {})
357
+ ]
358
+ }
359
+ );
360
+ }
361
+ function NavigationMenuList({
362
+ className,
363
+ ...props
364
+ }) {
365
+ return /* @__PURE__ */ jsx(
366
+ NavigationMenuPrimitive.List,
367
+ {
368
+ "data-slot": "navigation-menu-list",
369
+ className: cn("group flex flex-1 list-none items-center justify-center gap-1", className),
370
+ ...props
371
+ }
372
+ );
373
+ }
374
+ function NavigationMenuItem({
375
+ className,
376
+ ...props
377
+ }) {
378
+ return /* @__PURE__ */ jsx(
379
+ NavigationMenuPrimitive.Item,
380
+ {
381
+ "data-slot": "navigation-menu-item",
382
+ className: cn("relative", className),
383
+ ...props
384
+ }
385
+ );
386
+ }
387
+ const navigationMenuTriggerStyle = cva(
388
+ "group inline-flex h-10 w-max items-center justify-center rounded-[var(--radius)] bg-background px-4 py-2 text-[var(--text-p)] font-[var(--font-weight-medium)] hover:bg-accent hover:text-accent-foreground focus:bg-accent focus:text-accent-foreground disabled:pointer-events-none disabled:opacity-50 data-[state=open]:bg-accent/50 outline-none focus-visible:ring-2 focus-visible:ring-ring"
389
+ );
390
+ function NavigationMenuTrigger({
391
+ className,
392
+ children,
393
+ ...props
394
+ }) {
395
+ return /* @__PURE__ */ jsxs(
396
+ NavigationMenuPrimitive.Trigger,
397
+ {
398
+ "data-slot": "navigation-menu-trigger",
399
+ className: cn(navigationMenuTriggerStyle(), "group", className),
400
+ ...props,
401
+ children: [
402
+ children,
403
+ " ",
404
+ /* @__PURE__ */ jsx(
405
+ ChevronDownIcon,
406
+ {
407
+ className: "relative top-[1px] ml-1 size-3 group-data-[state=open]:rotate-180",
408
+ "aria-hidden": "true"
409
+ }
410
+ )
411
+ ]
412
+ }
413
+ );
414
+ }
415
+ function NavigationMenuContent({
416
+ className,
417
+ ...props
418
+ }) {
419
+ return /* @__PURE__ */ jsx(
420
+ NavigationMenuPrimitive.Content,
421
+ {
422
+ "data-slot": "navigation-menu-content",
423
+ className: cn("left-0 top-0 w-full md:w-auto", className),
424
+ ...props
425
+ }
426
+ );
427
+ }
428
+ function NavigationMenuViewport({
429
+ className,
430
+ ...props
431
+ }) {
432
+ return /* @__PURE__ */ jsx("div", { className: cn("absolute left-0 top-full flex justify-center w-full"), children: /* @__PURE__ */ jsx(
433
+ NavigationMenuPrimitive.Viewport,
434
+ {
435
+ "data-slot": "navigation-menu-viewport",
436
+ className: cn(
437
+ "origin-top-center relative mt-1.5 overflow-hidden rounded-[var(--radius)] border border-border bg-popover text-popover-foreground shadow-lg",
438
+ className
439
+ ),
440
+ ...props
441
+ }
442
+ ) });
443
+ }
444
+ function NavigationMenuLink({
445
+ className,
446
+ ...props
447
+ }) {
448
+ return /* @__PURE__ */ jsx(
449
+ NavigationMenuPrimitive.Link,
450
+ {
451
+ "data-slot": "navigation-menu-link",
452
+ className: cn(
453
+ "block select-none space-y-1 rounded-[var(--radius)] p-3 leading-none no-underline outline-none hover:bg-accent hover:text-accent-foreground focus:bg-accent focus:text-accent-foreground",
454
+ className
455
+ ),
456
+ ...props
457
+ }
458
+ );
459
+ }
460
+ function NavigationMenuIndicator({
461
+ className,
462
+ ...props
463
+ }) {
464
+ return /* @__PURE__ */ jsx(
465
+ NavigationMenuPrimitive.Indicator,
466
+ {
467
+ "data-slot": "navigation-menu-indicator",
468
+ className: cn(
469
+ "top-full z-[1] flex h-1.5 items-end justify-center overflow-hidden",
470
+ className
471
+ ),
472
+ ...props,
473
+ children: /* @__PURE__ */ jsx("div", { className: "bg-border relative top-[60%] h-2 w-2 rotate-45 rounded-tl-sm shadow-md" })
474
+ }
475
+ );
476
+ }
477
+
478
+ function Pagination({ className, ...props }) {
479
+ return /* @__PURE__ */ jsx(
480
+ "nav",
481
+ {
482
+ role: "navigation",
483
+ "aria-label": "pagination",
484
+ "data-slot": "pagination",
485
+ className: cn("mx-auto flex w-full justify-center", className),
486
+ ...props
487
+ }
488
+ );
489
+ }
490
+ function PaginationContent({ className, ...props }) {
491
+ return /* @__PURE__ */ jsx(
492
+ "ul",
493
+ {
494
+ "data-slot": "pagination-content",
495
+ className: cn("flex flex-row items-center gap-1", className),
496
+ ...props
497
+ }
498
+ );
499
+ }
500
+ function PaginationItem({ ...props }) {
501
+ return /* @__PURE__ */ jsx("li", { "data-slot": "pagination-item", ...props });
502
+ }
503
+ function PaginationLink({
504
+ className,
505
+ isActive,
506
+ disabled,
507
+ size = "icon",
508
+ href,
509
+ ...props
510
+ }) {
511
+ return /* @__PURE__ */ jsx(
512
+ "a",
513
+ {
514
+ "aria-current": isActive ? "page" : void 0,
515
+ "aria-disabled": disabled || void 0,
516
+ tabIndex: disabled ? -1 : void 0,
517
+ "data-slot": "pagination-link",
518
+ "data-active": isActive,
519
+ href: disabled ? void 0 : href ?? "#",
520
+ className: cn(
521
+ buttonVariants({
522
+ variant: isActive ? "outline" : "ghost",
523
+ size
524
+ }),
525
+ disabled && "pointer-events-none opacity-50",
526
+ className
527
+ ),
528
+ ...props
529
+ }
530
+ );
531
+ }
532
+ function PaginationPrevious({
533
+ className,
534
+ disabled,
535
+ ...props
536
+ }) {
537
+ return /* @__PURE__ */ jsxs(
538
+ PaginationLink,
539
+ {
540
+ "aria-label": "Go to previous page",
541
+ size: "default",
542
+ disabled,
543
+ className: cn("gap-1 px-2.5 sm:pl-2.5", className),
544
+ ...props,
545
+ children: [
546
+ /* @__PURE__ */ jsx(ChevronLeftIcon, {}),
547
+ /* @__PURE__ */ jsx("span", { className: "hidden sm:block", children: "Previous" })
548
+ ]
549
+ }
550
+ );
551
+ }
552
+ function PaginationNext({
553
+ className,
554
+ disabled,
555
+ ...props
556
+ }) {
557
+ return /* @__PURE__ */ jsxs(
558
+ PaginationLink,
559
+ {
560
+ "aria-label": "Go to next page",
561
+ size: "default",
562
+ disabled,
563
+ className: cn("gap-1 px-2.5 sm:pr-2.5", className),
564
+ ...props,
565
+ children: [
566
+ /* @__PURE__ */ jsx("span", { className: "hidden sm:block", children: "Next" }),
567
+ /* @__PURE__ */ jsx(ChevronRightIcon, {})
568
+ ]
569
+ }
570
+ );
571
+ }
572
+ function PaginationEllipsis({ className, ...props }) {
573
+ return /* @__PURE__ */ jsxs(
574
+ "span",
575
+ {
576
+ "aria-hidden": true,
577
+ "data-slot": "pagination-ellipsis",
578
+ className: cn("flex size-9 items-center justify-center", className),
579
+ ...props,
580
+ children: [
581
+ /* @__PURE__ */ jsx(MoreHorizontalIcon, { className: "size-4" }),
582
+ /* @__PURE__ */ jsx("span", { className: "sr-only", children: "More pages" })
583
+ ]
584
+ }
585
+ );
586
+ }
587
+
588
+ function usePagination({
589
+ totalItems,
590
+ pageSize = 10,
591
+ initialPage = 1,
592
+ page: controlledPage,
593
+ onPageChange,
594
+ siblingCount = 1
595
+ }) {
596
+ const [internalPage, setInternalPage] = useState(initialPage);
597
+ const isControlled = controlledPage !== void 0;
598
+ const currentPage = isControlled ? controlledPage : internalPage;
599
+ const totalPages = Math.max(1, Math.ceil(totalItems / pageSize));
600
+ const setPage = useCallback(
601
+ (p) => {
602
+ const clamped = Math.min(Math.max(1, p), totalPages);
603
+ if (!isControlled) setInternalPage(clamped);
604
+ onPageChange?.(clamped);
605
+ },
606
+ [isControlled, onPageChange, totalPages]
607
+ );
608
+ const startIndex = (currentPage - 1) * pageSize;
609
+ const endIndex = Math.min(startIndex + pageSize, totalItems);
610
+ const canGoPrev = currentPage > 1;
611
+ const canGoNext = currentPage < totalPages;
612
+ const isFirstPage = currentPage === 1;
613
+ const isLastPage = currentPage === totalPages;
614
+ const items = useMemo(() => {
615
+ const pageSet = /* @__PURE__ */ new Set();
616
+ pageSet.add(1);
617
+ if (totalPages > 1) pageSet.add(totalPages);
618
+ for (let p = Math.max(2, currentPage - siblingCount); p <= Math.min(totalPages - 1, currentPage + siblingCount); p++) {
619
+ pageSet.add(p);
620
+ }
621
+ const sorted = Array.from(pageSet).sort((a, b) => a - b);
622
+ const result = [];
623
+ for (let i = 0; i < sorted.length; i++) {
624
+ result.push({ type: "page", page: sorted[i] });
625
+ if (i < sorted.length - 1 && sorted[i + 1] - sorted[i] > 1) {
626
+ result.push({ type: "ellipsis", key: `ellipsis-${sorted[i]}` });
627
+ }
628
+ }
629
+ return result;
630
+ }, [currentPage, siblingCount, totalPages]);
631
+ const goTo = useCallback((p) => setPage(p), [setPage]);
632
+ const next = useCallback(() => setPage(currentPage + 1), [currentPage, setPage]);
633
+ const prev = useCallback(() => setPage(currentPage - 1), [currentPage, setPage]);
634
+ const first = useCallback(() => setPage(1), [setPage]);
635
+ const last = useCallback(() => setPage(totalPages), [setPage, totalPages]);
636
+ return {
637
+ currentPage,
638
+ totalPages,
639
+ startIndex,
640
+ endIndex,
641
+ canGoPrev,
642
+ canGoNext,
643
+ isFirstPage,
644
+ isLastPage,
645
+ items,
646
+ goTo,
647
+ next,
648
+ prev,
649
+ first,
650
+ last
651
+ };
652
+ }
653
+
654
+ const toggleVariants = cva(
655
+ "inline-flex items-center justify-center gap-2 rounded-md text-sm font-medium hover:bg-muted hover:text-muted-foreground disabled:pointer-events-none disabled:opacity-50 data-[state=on]:bg-accent data-[state=on]:text-accent-foreground [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 [&_svg]:shrink-0 focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] outline-none transition-[color,box-shadow] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive whitespace-nowrap",
656
+ {
657
+ variants: {
658
+ variant: {
659
+ default: "bg-transparent",
660
+ outline: "border border-input bg-transparent hover:bg-accent hover:text-accent-foreground"
661
+ },
662
+ size: {
663
+ default: "h-9 px-2 min-w-9",
664
+ sm: "h-8 px-1.5 min-w-8",
665
+ lg: "h-10 px-2.5 min-w-10"
666
+ }
667
+ },
668
+ defaultVariants: {
669
+ variant: "default",
670
+ size: "default"
671
+ }
672
+ }
673
+ );
674
+ const Toggle = React.forwardRef(({ className, variant, size, ...props }, ref) => /* @__PURE__ */ jsx(
675
+ TogglePrimitive.Root,
676
+ {
677
+ ref,
678
+ "data-slot": "toggle",
679
+ className: cn(toggleVariants({ variant, size, className })),
680
+ ...props
681
+ }
682
+ ));
683
+ Toggle.displayName = TogglePrimitive.Root.displayName;
684
+
685
+ const ToggleGroupContext = React.createContext({
686
+ size: "default",
687
+ variant: "default"
688
+ });
689
+ const ToggleGroup = React.forwardRef(({ className, variant, size, children, ...props }, ref) => /* @__PURE__ */ jsx(
690
+ ToggleGroupPrimitive.Root,
691
+ {
692
+ ref,
693
+ "data-slot": "toggle-group",
694
+ "data-variant": variant,
695
+ "data-size": size,
696
+ className: cn(
697
+ "group/toggle-group flex w-fit items-center rounded-md data-[variant=outline]:shadow-xs",
698
+ className
699
+ ),
700
+ ...props,
701
+ children: /* @__PURE__ */ jsx(ToggleGroupContext.Provider, { value: { variant, size }, children })
702
+ }
703
+ ));
704
+ ToggleGroup.displayName = ToggleGroupPrimitive.Root.displayName;
705
+ const ToggleGroupItem = React.forwardRef(({ className, children, variant, size, ...props }, ref) => {
706
+ const context = React.useContext(ToggleGroupContext);
707
+ return /* @__PURE__ */ jsx(
708
+ ToggleGroupPrimitive.Item,
709
+ {
710
+ ref,
711
+ "data-slot": "toggle-group-item",
712
+ "data-variant": context.variant || variant,
713
+ "data-size": context.size || size,
714
+ className: cn(
715
+ toggleVariants({
716
+ variant: context.variant || variant,
717
+ size: context.size || size
718
+ }),
719
+ "min-w-0 flex-1 shrink-0 rounded-none shadow-none first:rounded-l-md last:rounded-r-md focus:z-10 focus-visible:z-10 data-[variant=outline]:border-l-0 data-[variant=outline]:first:border-l",
720
+ className
721
+ ),
722
+ ...props,
723
+ children
724
+ }
725
+ );
726
+ });
727
+ ToggleGroupItem.displayName = ToggleGroupPrimitive.Item.displayName;
728
+
729
+ function InputOTP({
730
+ className,
731
+ containerClassName,
732
+ ...props
733
+ }) {
734
+ return /* @__PURE__ */ jsx(
735
+ OTPInput,
736
+ {
737
+ "data-slot": "input-otp",
738
+ containerClassName: cn("flex items-center gap-2 has-disabled:opacity-50", containerClassName),
739
+ className: cn("disabled:cursor-not-allowed", className),
740
+ ...props
741
+ }
742
+ );
743
+ }
744
+ function InputOTPGroup({ className, ...props }) {
745
+ return /* @__PURE__ */ jsx(
746
+ "div",
747
+ {
748
+ "data-slot": "input-otp-group",
749
+ className: cn("flex items-center gap-1", className),
750
+ ...props
751
+ }
752
+ );
753
+ }
754
+ function InputOTPSlot({
755
+ index,
756
+ className,
757
+ size = "md",
758
+ ...props
759
+ }) {
760
+ const inputOTPContext = React.useContext(OTPInputContext);
761
+ const { char, hasFakeCaret, isActive } = inputOTPContext?.slots[index] ?? {};
762
+ const sizeClasses = {
763
+ sm: "h-8 w-8 text-sm",
764
+ md: "h-10 w-10 text-base",
765
+ lg: "h-12 w-12 text-lg"
766
+ };
767
+ return /* @__PURE__ */ jsxs(
768
+ "div",
769
+ {
770
+ "data-slot": "input-otp-slot",
771
+ "data-active": isActive,
772
+ className: cn(
773
+ "data-[active=true]:border-primary data-[active=true]:ring-primary/20 data-[active=true]:aria-invalid:ring-destructive/20 aria-invalid:border-destructive data-[active=true]:aria-invalid:border-destructive relative flex items-center justify-center border border-border rounded-[var(--radius)] bg-background transition-all outline-none data-[active=true]:z-10 data-[active=true]:ring-2",
774
+ sizeClasses[size],
775
+ className
776
+ ),
777
+ ...props,
778
+ children: [
779
+ char,
780
+ hasFakeCaret && /* @__PURE__ */ jsx("div", { className: "pointer-events-none absolute inset-0 flex items-center justify-center", children: /* @__PURE__ */ jsx("div", { className: "animate-caret-blink bg-foreground h-4 w-px duration-1000" }) })
781
+ ]
782
+ }
783
+ );
784
+ }
785
+ function InputOTPSeparator({ ...props }) {
786
+ return /* @__PURE__ */ jsx("div", { "data-slot": "input-otp-separator", role: "separator", ...props, children: /* @__PURE__ */ jsx(MinusIcon, {}) });
787
+ }
788
+
789
+ const Form = FormProvider;
790
+ const FormFieldContext = React.createContext({});
791
+ const FormField = ({
792
+ ...props
793
+ }) => {
794
+ return /* @__PURE__ */ jsx(FormFieldContext.Provider, { value: { name: props.name }, children: /* @__PURE__ */ jsx(Controller, { ...props }) });
795
+ };
796
+ const useFormField = () => {
797
+ const fieldContext = React.useContext(FormFieldContext);
798
+ const itemContext = React.useContext(FormItemContext);
799
+ const { getFieldState } = useFormContext();
800
+ const formState = useFormState({ name: fieldContext.name });
801
+ const fieldState = getFieldState(fieldContext.name, formState);
802
+ if (!fieldContext) {
803
+ throw new Error("useFormField should be used within <FormField>");
804
+ }
805
+ const { id } = itemContext;
806
+ return {
807
+ id,
808
+ name: fieldContext.name,
809
+ formItemId: `${id}-form-item`,
810
+ formDescriptionId: `${id}-form-item-description`,
811
+ formMessageId: `${id}-form-item-message`,
812
+ ...fieldState
813
+ };
814
+ };
815
+ const FormItemContext = React.createContext({});
816
+ function FormItem({ className, ...props }) {
817
+ const id = React.useId();
818
+ return /* @__PURE__ */ jsx(FormItemContext.Provider, { value: { id }, children: /* @__PURE__ */ jsx("div", { "data-slot": "form-item", className: cn("grid gap-2", className), ...props }) });
819
+ }
820
+ function FormLabel({ className, ...props }) {
821
+ const { error, formItemId } = useFormField();
822
+ return /* @__PURE__ */ jsx(
823
+ Label,
824
+ {
825
+ "data-slot": "form-label",
826
+ "data-error": !!error,
827
+ className: cn("data-[error=true]:text-destructive", className),
828
+ htmlFor: formItemId,
829
+ ...props
830
+ }
831
+ );
832
+ }
833
+ function FormControl({ ...props }) {
834
+ const { error, formItemId, formDescriptionId, formMessageId } = useFormField();
835
+ return /* @__PURE__ */ jsx(
836
+ Slot,
837
+ {
838
+ "data-slot": "form-control",
839
+ id: formItemId,
840
+ "aria-describedby": !error ? `${formDescriptionId}` : `${formDescriptionId} ${formMessageId}`,
841
+ "aria-invalid": !!error,
842
+ ...props
843
+ }
844
+ );
845
+ }
846
+ function FormDescription({ className, ...props }) {
847
+ const { formDescriptionId } = useFormField();
848
+ return /* @__PURE__ */ jsx(
849
+ "p",
850
+ {
851
+ "data-slot": "form-description",
852
+ id: formDescriptionId,
853
+ className: cn("text-muted-foreground text-sm", className),
854
+ ...props
855
+ }
856
+ );
857
+ }
858
+ function FormMessage({ className, ...props }) {
859
+ const { error, formMessageId } = useFormField();
860
+ const body = error ? String(error?.message ?? "") : props.children;
861
+ if (!body) {
862
+ return null;
863
+ }
864
+ return /* @__PURE__ */ jsx(
865
+ "p",
866
+ {
867
+ "data-slot": "form-message",
868
+ id: formMessageId,
869
+ className: cn("text-destructive text-sm", className),
870
+ ...props,
871
+ children: body
872
+ }
873
+ );
874
+ }
875
+
876
+ function Calendar({
877
+ className,
878
+ classNames,
879
+ showOutsideDays = true,
880
+ captionLayout = "label",
881
+ buttonVariant = "ghost",
882
+ formatters,
883
+ components,
884
+ ...props
885
+ }) {
886
+ const defaultClassNames = getDefaultClassNames();
887
+ const isDropdownCaption = captionLayout.startsWith("dropdown");
888
+ return /* @__PURE__ */ jsx(
889
+ DayPicker,
890
+ {
891
+ showOutsideDays,
892
+ className: cn(
893
+ "bg-background group/calendar p-4 [[data-slot=card-content]_&]:bg-transparent [[data-slot=popover-content]_&]:bg-transparent font-sans",
894
+ String.raw`rtl:**:[.rdp-button\_next>svg]:rotate-180`,
895
+ String.raw`rtl:**:[.rdp-button\_previous>svg]:rotate-180`,
896
+ className
897
+ ),
898
+ captionLayout,
899
+ formatters,
900
+ classNames: {
901
+ root: cn("w-fit", defaultClassNames.root),
902
+ months: cn("flex gap-6 flex-col md:flex-row relative", defaultClassNames.months),
903
+ month: cn("flex flex-col w-full gap-5", defaultClassNames.month),
904
+ nav: cn(
905
+ "flex items-center gap-2 w-full absolute top-0 inset-x-0 justify-between",
906
+ defaultClassNames.nav
907
+ ),
908
+ button_previous: cn(
909
+ buttonVariants({ variant: buttonVariant }),
910
+ "size-(--cell-size) aria-disabled:opacity-40 p-0 select-none hover:bg-accent/50 transition-colors duration-200",
911
+ defaultClassNames.button_previous
912
+ ),
913
+ button_next: cn(
914
+ buttonVariants({ variant: buttonVariant }),
915
+ "size-(--cell-size) aria-disabled:opacity-40 p-0 select-none hover:bg-accent/50 transition-colors duration-200",
916
+ defaultClassNames.button_next
917
+ ),
918
+ month_caption: cn(
919
+ "flex items-center justify-center w-full",
920
+ isDropdownCaption ? "h-auto px-0" : "h-(--cell-size) px-(--cell-size)",
921
+ defaultClassNames.month_caption
922
+ ),
923
+ dropdowns: cn(
924
+ "w-full flex items-center justify-center gap-2",
925
+ isDropdownCaption ? "h-auto" : "h-(--cell-size)",
926
+ defaultClassNames.dropdowns
927
+ ),
928
+ dropdown_root: cn(
929
+ isDropdownCaption ? "relative flex min-w-[7rem] items-center rounded-[var(--radius)] border border-border bg-background text-foreground transition-colors outline-none focus-within:ring-2 focus-within:ring-primary focus-within:border-transparent data-[disabled=true]:cursor-not-allowed data-[disabled=true]:opacity-50 px-2.5 py-1" : "relative rounded-[var(--radius)] hover:bg-accent transition-colors",
930
+ defaultClassNames.dropdown_root
931
+ ),
932
+ dropdown: cn(
933
+ isDropdownCaption ? "absolute inset-0 cursor-pointer opacity-0" : "absolute bg-popover inset-0 opacity-0 cursor-pointer",
934
+ defaultClassNames.dropdown
935
+ ),
936
+ caption_label: cn(
937
+ "select-none font-[family-name:var(--font-family,Roboto)] tracking-tight transition-all duration-200",
938
+ captionLayout === "label" ? "rounded-[var(--radius)] px-2 py-1 text-[length:var(--calendar-caption-size)] font-[number:var(--font-weight-semibold)] hover:bg-accent hover:text-accent-foreground" : "flex h-full w-full items-center justify-between gap-2 rounded-[var(--radius)] text-[length:var(--calendar-caption-size)] font-[number:var(--font-weight-semibold)] [&>svg]:text-muted-foreground [&>svg]:size-4",
939
+ defaultClassNames.caption_label
940
+ ),
941
+ table: "w-full border-collapse mt-1",
942
+ weekdays: cn("flex gap-1", defaultClassNames.weekdays),
943
+ weekday: cn(
944
+ "text-muted-foreground rounded-(--cell-radius) flex-1 select-none text-[length:var(--calendar-weekday-size)] font-[number:var(--font-weight-medium)] uppercase tracking-wider",
945
+ defaultClassNames.weekday
946
+ ),
947
+ week: cn("flex w-full gap-1", defaultClassNames.week),
948
+ week_number_header: cn("select-none w-(--cell-size)", defaultClassNames.week_number_header),
949
+ week_number: cn(
950
+ "select-none text-muted-foreground text-[length:var(--calendar-weekday-size)]",
951
+ defaultClassNames.week_number
952
+ ),
953
+ day: cn(
954
+ "relative w-full rounded-(--cell-radius) h-full p-0 text-center [&:last-child[data-selected=true]_button]:rounded-r-(--cell-radius) group/day aspect-square select-none",
955
+ props.showWeekNumber ? "[&:nth-child(2)[data-selected=true]_button]:rounded-l-(--cell-radius)" : "[&:first-child[data-selected=true]_button]:rounded-l-(--cell-radius)",
956
+ defaultClassNames.day
957
+ ),
958
+ range_start: cn(
959
+ "rounded-l-(--cell-radius) bg-accent/50 relative after:bg-accent/50 after:absolute after:inset-y-0 after:w-2 after:right-0 -z-0 isolate",
960
+ defaultClassNames.range_start
961
+ ),
962
+ range_middle: cn("rounded-none bg-accent/30", defaultClassNames.range_middle),
963
+ range_end: cn(
964
+ "rounded-r-(--cell-radius) bg-accent/50 relative after:bg-accent/50 after:absolute after:inset-y-0 after:w-2 after:left-0 -z-0 isolate",
965
+ defaultClassNames.range_end
966
+ ),
967
+ today: cn(
968
+ "bg-accent/60 text-accent-foreground rounded-(--cell-radius) data-[selected=true]:rounded-none font-[number:var(--font-weight-semibold)]",
969
+ defaultClassNames.today
970
+ ),
971
+ outside: cn(
972
+ "text-muted-foreground aria-selected:text-muted-foreground",
973
+ defaultClassNames.outside
974
+ ),
975
+ disabled: cn("text-muted-foreground/30 opacity-40", defaultClassNames.disabled),
976
+ hidden: cn("invisible", defaultClassNames.hidden),
977
+ ...classNames
978
+ },
979
+ components: {
980
+ Root: ({ className: className2, rootRef, ...props2 }) => {
981
+ return /* @__PURE__ */ jsx("div", { "data-slot": "calendar", ref: rootRef, className: cn(className2), ...props2 });
982
+ },
983
+ Chevron: ({ className: className2, orientation, ...props2 }) => {
984
+ if (orientation === "left") {
985
+ return /* @__PURE__ */ jsx(
986
+ ChevronLeft,
987
+ {
988
+ className: cn("size-5 transition-transform group-hover:scale-110", className2),
989
+ ...props2
990
+ }
991
+ );
992
+ }
993
+ if (orientation === "right") {
994
+ return /* @__PURE__ */ jsx(
995
+ ChevronRight,
996
+ {
997
+ className: cn("size-5 transition-transform group-hover:scale-110", className2),
998
+ ...props2
999
+ }
1000
+ );
1001
+ }
1002
+ return /* @__PURE__ */ jsx(ChevronDown, { className: cn("size-4", className2), ...props2 });
1003
+ },
1004
+ DayButton: CalendarDayButton,
1005
+ WeekNumber: ({ children, ...props2 }) => {
1006
+ return /* @__PURE__ */ jsx("td", { ...props2, children: /* @__PURE__ */ jsx("div", { className: "flex size-(--cell-size) items-center justify-center text-center font-[number:var(--font-weight-medium)]", children }) });
1007
+ },
1008
+ ...components
1009
+ },
1010
+ ...props
1011
+ }
1012
+ );
1013
+ }
1014
+ function CalendarDayButton({
1015
+ className,
1016
+ day,
1017
+ modifiers,
1018
+ ...props
1019
+ }) {
1020
+ const defaultClassNames = getDefaultClassNames();
1021
+ const ref = React.useRef(null);
1022
+ React.useEffect(() => {
1023
+ if (modifiers.focused) ref.current?.focus();
1024
+ }, [modifiers.focused]);
1025
+ return /* @__PURE__ */ jsx(
1026
+ Button,
1027
+ {
1028
+ ref,
1029
+ variant: "ghost",
1030
+ size: "icon",
1031
+ "data-day": day.date.toLocaleDateString(),
1032
+ "data-selected-single": modifiers.selected && !modifiers.range_start && !modifiers.range_end && !modifiers.range_middle,
1033
+ "data-range-start": modifiers.range_start,
1034
+ "data-range-end": modifiers.range_end,
1035
+ "data-range-middle": modifiers.range_middle,
1036
+ className: cn(
1037
+ "relative isolate z-10 flex aspect-square size-auto w-full min-w-(--cell-size) flex-col items-center justify-center gap-1 border-0 leading-none transition-all duration-200 cursor-pointer disabled:cursor-not-allowed",
1038
+ "text-[length:var(--calendar-day-size)] font-[number:var(--font-weight-regular)]",
1039
+ "hover:bg-accent/70 hover:text-accent-foreground hover:scale-105",
1040
+ "data-[selected-single=true]:bg-primary data-[selected-single=true]:text-primary-foreground data-[selected-single=true]:font-[number:var(--font-weight-semibold)] data-[selected-single=true]:shadow-sm",
1041
+ "data-[range-middle=true]:bg-accent/50 data-[range-middle=true]:text-foreground",
1042
+ "data-[range-start=true]:bg-primary data-[range-start=true]:text-primary-foreground data-[range-start=true]:font-[number:var(--font-weight-semibold)] data-[range-start=true]:shadow-sm",
1043
+ "data-[range-end=true]:bg-primary data-[range-end=true]:text-primary-foreground data-[range-end=true]:font-[number:var(--font-weight-semibold)] data-[range-end=true]:shadow-sm",
1044
+ "group-data-[focused=true]/day:border-ring group-data-[focused=true]/day:ring-ring/50 group-data-[focused=true]/day:ring-2 group-data-[focused=true]/day:ring-offset-2 group-data-[focused=true]/day:ring-offset-background",
1045
+ "data-[range-end=true]:rounded-(--cell-radius) data-[range-end=true]:rounded-r-(--cell-radius)",
1046
+ "data-[range-middle=true]:rounded-none",
1047
+ "data-[range-start=true]:rounded-(--cell-radius) data-[range-start=true]:rounded-l-(--cell-radius)",
1048
+ "[&>span]:opacity-80",
1049
+ defaultClassNames.day,
1050
+ className
1051
+ ),
1052
+ ...props,
1053
+ children: day.date.getDate()
1054
+ }
1055
+ );
1056
+ }
1057
+
1058
+ function Sheet({ ...props }) {
1059
+ return /* @__PURE__ */ jsx(DialogPrimitive.Root, { "data-slot": "sheet", ...props });
1060
+ }
1061
+ function SheetTrigger({ ...props }) {
1062
+ return /* @__PURE__ */ jsx(DialogPrimitive.Trigger, { "data-slot": "sheet-trigger", ...props });
1063
+ }
1064
+ function SheetClose({ ...props }) {
1065
+ return /* @__PURE__ */ jsx(DialogPrimitive.Close, { "data-slot": "sheet-close", ...props });
1066
+ }
1067
+ function SheetPortal({ ...props }) {
1068
+ return /* @__PURE__ */ jsx(DialogPrimitive.Portal, { "data-slot": "sheet-portal", ...props });
1069
+ }
1070
+ const SheetOverlay = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
1071
+ DialogPrimitive.Overlay,
1072
+ {
1073
+ className: cn(
1074
+ "data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50",
1075
+ className
1076
+ ),
1077
+ ...props,
1078
+ ref
1079
+ }
1080
+ ));
1081
+ SheetOverlay.displayName = DialogPrimitive.Overlay.displayName;
1082
+ function SheetContent({
1083
+ className,
1084
+ children,
1085
+ side = "right",
1086
+ ...props
1087
+ }) {
1088
+ return /* @__PURE__ */ jsxs(SheetPortal, { children: [
1089
+ /* @__PURE__ */ jsx(SheetOverlay, {}),
1090
+ /* @__PURE__ */ jsxs(
1091
+ DialogPrimitive.Content,
1092
+ {
1093
+ "data-slot": "sheet-content",
1094
+ className: cn(
1095
+ "bg-background data-[state=open]:animate-in data-[state=closed]:animate-out fixed z-50 flex flex-col gap-4 shadow-lg transition ease-in-out data-[state=closed]:duration-300 data-[state=open]:duration-500",
1096
+ side === "right" && "data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right inset-y-0 right-0 h-full w-3/4 border-l sm:max-w-sm",
1097
+ side === "left" && "data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left inset-y-0 left-0 h-full w-3/4 border-r sm:max-w-sm",
1098
+ side === "top" && "data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top inset-x-0 top-0 h-auto border-b",
1099
+ side === "bottom" && "data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom inset-x-0 bottom-0 h-auto border-t",
1100
+ className
1101
+ ),
1102
+ ...props,
1103
+ children: [
1104
+ children,
1105
+ /* @__PURE__ */ jsxs(DialogPrimitive.Close, { className: "ring-offset-background focus:ring-ring data-[state=open]:bg-secondary absolute top-4 right-4 rounded-xs opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none", children: [
1106
+ /* @__PURE__ */ jsx(XIcon, { className: "size-4" }),
1107
+ /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Close" })
1108
+ ] })
1109
+ ]
1110
+ }
1111
+ )
1112
+ ] });
1113
+ }
1114
+ function SheetHeader({ className, ...props }) {
1115
+ return /* @__PURE__ */ jsx(
1116
+ "div",
1117
+ {
1118
+ "data-slot": "sheet-header",
1119
+ className: cn("flex flex-col gap-1.5 px-6 pt-6", className),
1120
+ ...props
1121
+ }
1122
+ );
1123
+ }
1124
+ function SheetBody({ className, ...props }) {
1125
+ return /* @__PURE__ */ jsx("div", { "data-slot": "sheet-body", className: cn("flex-1 overflow-auto px-6", className), ...props });
1126
+ }
1127
+ function SheetFooter({ className, ...props }) {
1128
+ return /* @__PURE__ */ jsx(
1129
+ "div",
1130
+ {
1131
+ "data-slot": "sheet-footer",
1132
+ className: cn("mt-auto flex flex-col gap-2 px-6 pb-6", className),
1133
+ ...props
1134
+ }
1135
+ );
1136
+ }
1137
+ function SheetTitle({ className, ...props }) {
1138
+ return /* @__PURE__ */ jsx(
1139
+ DialogPrimitive.Title,
1140
+ {
1141
+ "data-slot": "sheet-title",
1142
+ className: cn("text-foreground font-semibold", className),
1143
+ ...props
1144
+ }
1145
+ );
1146
+ }
1147
+ function SheetDescription({
1148
+ className,
1149
+ ...props
1150
+ }) {
1151
+ return /* @__PURE__ */ jsx(
1152
+ DialogPrimitive.Description,
1153
+ {
1154
+ "data-slot": "sheet-description",
1155
+ className: cn("text-muted-foreground text-sm", className),
1156
+ ...props
1157
+ }
1158
+ );
1159
+ }
1160
+
1161
+ function Drawer({ ...props }) {
1162
+ return /* @__PURE__ */ jsx(Drawer$1.Root, { "data-slot": "drawer", ...props });
1163
+ }
1164
+ function DrawerTrigger({ ...props }) {
1165
+ return /* @__PURE__ */ jsx(Drawer$1.Trigger, { "data-slot": "drawer-trigger", ...props });
1166
+ }
1167
+ function DrawerPortal({ ...props }) {
1168
+ return /* @__PURE__ */ jsx(Drawer$1.Portal, { "data-slot": "drawer-portal", ...props });
1169
+ }
1170
+ function DrawerClose({ ...props }) {
1171
+ return /* @__PURE__ */ jsx(Drawer$1.Close, { "data-slot": "drawer-close", ...props });
1172
+ }
1173
+ const DrawerOverlay = React.forwardRef(({ className, ...props }, ref) => {
1174
+ return /* @__PURE__ */ jsx(
1175
+ Drawer$1.Overlay,
1176
+ {
1177
+ ref,
1178
+ "data-slot": "drawer-overlay",
1179
+ className: cn(
1180
+ "data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50",
1181
+ className
1182
+ ),
1183
+ ...props
1184
+ }
1185
+ );
1186
+ });
1187
+ DrawerOverlay.displayName = Drawer$1.Overlay.displayName;
1188
+ function DrawerContent({
1189
+ className,
1190
+ children,
1191
+ ...props
1192
+ }) {
1193
+ return /* @__PURE__ */ jsxs(DrawerPortal, { "data-slot": "drawer-portal", children: [
1194
+ /* @__PURE__ */ jsx(DrawerOverlay, {}),
1195
+ /* @__PURE__ */ jsxs(
1196
+ Drawer$1.Content,
1197
+ {
1198
+ "data-slot": "drawer-content",
1199
+ className: cn(
1200
+ "group/drawer-content bg-background fixed z-50 flex h-auto flex-col",
1201
+ "data-[vaul-drawer-direction=top]:inset-x-0 data-[vaul-drawer-direction=top]:top-0 data-[vaul-drawer-direction=top]:mb-24 data-[vaul-drawer-direction=top]:max-h-[80vh] data-[vaul-drawer-direction=top]:rounded-b-lg data-[vaul-drawer-direction=top]:border-b",
1202
+ "data-[vaul-drawer-direction=bottom]:inset-x-0 data-[vaul-drawer-direction=bottom]:bottom-0 data-[vaul-drawer-direction=bottom]:mt-24 data-[vaul-drawer-direction=bottom]:max-h-[80vh] data-[vaul-drawer-direction=bottom]:rounded-t-lg data-[vaul-drawer-direction=bottom]:border-t",
1203
+ "data-[vaul-drawer-direction=right]:inset-y-0 data-[vaul-drawer-direction=right]:right-0 data-[vaul-drawer-direction=right]:w-3/4 data-[vaul-drawer-direction=right]:border-l data-[vaul-drawer-direction=right]:sm:max-w-sm",
1204
+ "data-[vaul-drawer-direction=left]:inset-y-0 data-[vaul-drawer-direction=left]:left-0 data-[vaul-drawer-direction=left]:w-3/4 data-[vaul-drawer-direction=left]:border-r data-[vaul-drawer-direction=left]:sm:max-w-sm",
1205
+ className
1206
+ ),
1207
+ ...props,
1208
+ children: [
1209
+ /* @__PURE__ */ jsx("div", { className: "bg-muted mx-auto mt-4 hidden h-2 w-[100px] shrink-0 rounded-full group-data-[vaul-drawer-direction=bottom]/drawer-content:block" }),
1210
+ children
1211
+ ]
1212
+ }
1213
+ )
1214
+ ] });
1215
+ }
1216
+ function DrawerHeader({ className, ...props }) {
1217
+ return /* @__PURE__ */ jsx(
1218
+ "div",
1219
+ {
1220
+ "data-slot": "drawer-header",
1221
+ className: cn("flex flex-col gap-1.5 p-4", className),
1222
+ ...props
1223
+ }
1224
+ );
1225
+ }
1226
+ function DrawerFooter({ className, ...props }) {
1227
+ return /* @__PURE__ */ jsx(
1228
+ "div",
1229
+ {
1230
+ "data-slot": "drawer-footer",
1231
+ className: cn("mt-auto flex flex-col gap-2 p-4", className),
1232
+ ...props
1233
+ }
1234
+ );
1235
+ }
1236
+ function DrawerTitle({ className, ...props }) {
1237
+ return /* @__PURE__ */ jsx(
1238
+ Drawer$1.Title,
1239
+ {
1240
+ "data-slot": "drawer-title",
1241
+ className: cn("text-foreground font-semibold", className),
1242
+ ...props
1243
+ }
1244
+ );
1245
+ }
1246
+ function DrawerDescription({
1247
+ className,
1248
+ ...props
1249
+ }) {
1250
+ return /* @__PURE__ */ jsx(
1251
+ Drawer$1.Description,
1252
+ {
1253
+ "data-slot": "drawer-description",
1254
+ className: cn("text-muted-foreground text-sm", className),
1255
+ ...props
1256
+ }
1257
+ );
1258
+ }
1259
+ function DrawerHandle({ className, ...props }) {
1260
+ return /* @__PURE__ */ jsx(
1261
+ "div",
1262
+ {
1263
+ "data-slot": "drawer-handle",
1264
+ className: cn("bg-muted mx-auto mt-4 h-2 w-[100px] shrink-0 rounded-full", className),
1265
+ ...props
1266
+ }
1267
+ );
1268
+ }
1269
+
1270
+ function HoverCard({ ...props }) {
1271
+ return /* @__PURE__ */ jsx(HoverCardPrimitive.Root, { "data-slot": "hover-card", ...props });
1272
+ }
1273
+ function HoverCardTrigger({ ...props }) {
1274
+ return /* @__PURE__ */ jsx(HoverCardPrimitive.Trigger, { "data-slot": "hover-card-trigger", ...props });
1275
+ }
1276
+ function HoverCardContent({
1277
+ className,
1278
+ align = "center",
1279
+ sideOffset = 4,
1280
+ ...props
1281
+ }) {
1282
+ return /* @__PURE__ */ jsx(HoverCardPrimitive.Portal, { "data-slot": "hover-card-portal", children: /* @__PURE__ */ jsx(
1283
+ HoverCardPrimitive.Content,
1284
+ {
1285
+ "data-slot": "hover-card-content",
1286
+ align,
1287
+ sideOffset,
1288
+ className: cn(
1289
+ "bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-64 origin-(--radix-hover-card-content-transform-origin) rounded-md border p-4 shadow-md outline-hidden",
1290
+ className
1291
+ ),
1292
+ ...props
1293
+ }
1294
+ ) });
1295
+ }
1296
+
1297
+ function ContextMenu({ ...props }) {
1298
+ return /* @__PURE__ */ jsx(ContextMenuPrimitive.Root, { "data-slot": "context-menu", ...props });
1299
+ }
1300
+ function ContextMenuTrigger({
1301
+ ...props
1302
+ }) {
1303
+ return /* @__PURE__ */ jsx(ContextMenuPrimitive.Trigger, { "data-slot": "context-menu-trigger", ...props });
1304
+ }
1305
+ function ContextMenuGroup({ ...props }) {
1306
+ return /* @__PURE__ */ jsx(ContextMenuPrimitive.Group, { "data-slot": "context-menu-group", ...props });
1307
+ }
1308
+ function ContextMenuPortal({ ...props }) {
1309
+ return /* @__PURE__ */ jsx(ContextMenuPrimitive.Portal, { "data-slot": "context-menu-portal", ...props });
1310
+ }
1311
+ function ContextMenuSub({ ...props }) {
1312
+ return /* @__PURE__ */ jsx(ContextMenuPrimitive.Sub, { "data-slot": "context-menu-sub", ...props });
1313
+ }
1314
+ function ContextMenuRadioGroup({
1315
+ ...props
1316
+ }) {
1317
+ return /* @__PURE__ */ jsx(ContextMenuPrimitive.RadioGroup, { "data-slot": "context-menu-radio-group", ...props });
1318
+ }
1319
+ function ContextMenuSubTrigger({
1320
+ className,
1321
+ inset,
1322
+ children,
1323
+ ...props
1324
+ }) {
1325
+ return /* @__PURE__ */ jsxs(
1326
+ ContextMenuPrimitive.SubTrigger,
1327
+ {
1328
+ "data-slot": "context-menu-sub-trigger",
1329
+ "data-inset": inset,
1330
+ className: cn(
1331
+ "focus:bg-accent focus:text-accent-foreground data-[state=open]:bg-accent data-[state=open]:text-accent-foreground flex cursor-default items-center rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[inset]:pl-8 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
1332
+ className
1333
+ ),
1334
+ ...props,
1335
+ children: [
1336
+ children,
1337
+ /* @__PURE__ */ jsx(ChevronRightIcon, { className: "ml-auto" })
1338
+ ]
1339
+ }
1340
+ );
1341
+ }
1342
+ function ContextMenuSubContent({
1343
+ className,
1344
+ ...props
1345
+ }) {
1346
+ return /* @__PURE__ */ jsx(
1347
+ ContextMenuPrimitive.SubContent,
1348
+ {
1349
+ "data-slot": "context-menu-sub-content",
1350
+ className: cn(
1351
+ "bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 min-w-[8rem] origin-(--radix-context-menu-content-transform-origin) overflow-hidden rounded-md border p-1 shadow-lg",
1352
+ className
1353
+ ),
1354
+ ...props
1355
+ }
1356
+ );
1357
+ }
1358
+ function ContextMenuContent({
1359
+ className,
1360
+ ...props
1361
+ }) {
1362
+ return /* @__PURE__ */ jsx(ContextMenuPrimitive.Portal, { children: /* @__PURE__ */ jsx(
1363
+ ContextMenuPrimitive.Content,
1364
+ {
1365
+ "data-slot": "context-menu-content",
1366
+ className: cn(
1367
+ "bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 max-h-(--radix-context-menu-content-available-height) min-w-[8rem] origin-(--radix-context-menu-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border p-1 shadow-md",
1368
+ className
1369
+ ),
1370
+ ...props
1371
+ }
1372
+ ) });
1373
+ }
1374
+ function ContextMenuItem({
1375
+ className,
1376
+ inset,
1377
+ variant = "default",
1378
+ ...props
1379
+ }) {
1380
+ return /* @__PURE__ */ jsx(
1381
+ ContextMenuPrimitive.Item,
1382
+ {
1383
+ "data-slot": "context-menu-item",
1384
+ "data-inset": inset,
1385
+ "data-variant": variant,
1386
+ className: cn(
1387
+ "focus:bg-accent focus:text-accent-foreground data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 dark:data-[variant=destructive]:focus:bg-destructive/20 data-[variant=destructive]:focus:text-destructive data-[variant=destructive]:*:[svg]:!text-destructive [&_svg:not([class*='text-'])]:text-muted-foreground relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 data-[inset]:pl-8 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
1388
+ className
1389
+ ),
1390
+ ...props
1391
+ }
1392
+ );
1393
+ }
1394
+ function ContextMenuCheckboxItem({
1395
+ className,
1396
+ children,
1397
+ checked,
1398
+ ...props
1399
+ }) {
1400
+ return /* @__PURE__ */ jsxs(
1401
+ ContextMenuPrimitive.CheckboxItem,
1402
+ {
1403
+ "data-slot": "context-menu-checkbox-item",
1404
+ className: cn(
1405
+ "focus:bg-accent focus:text-accent-foreground relative flex cursor-default items-center gap-2 rounded-sm py-1.5 pr-2 pl-8 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
1406
+ className
1407
+ ),
1408
+ checked,
1409
+ ...props,
1410
+ children: [
1411
+ /* @__PURE__ */ jsx("span", { className: "pointer-events-none absolute left-2 flex size-3.5 items-center justify-center", children: /* @__PURE__ */ jsx(ContextMenuPrimitive.ItemIndicator, { children: /* @__PURE__ */ jsx(CheckIcon, { className: "size-4" }) }) }),
1412
+ children
1413
+ ]
1414
+ }
1415
+ );
1416
+ }
1417
+ function ContextMenuRadioItem({
1418
+ className,
1419
+ children,
1420
+ ...props
1421
+ }) {
1422
+ return /* @__PURE__ */ jsxs(
1423
+ ContextMenuPrimitive.RadioItem,
1424
+ {
1425
+ "data-slot": "context-menu-radio-item",
1426
+ className: cn(
1427
+ "focus:bg-accent focus:text-accent-foreground relative flex cursor-default items-center gap-2 rounded-sm py-1.5 pr-2 pl-8 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
1428
+ className
1429
+ ),
1430
+ ...props,
1431
+ children: [
1432
+ /* @__PURE__ */ jsx("span", { className: "pointer-events-none absolute left-2 flex size-3.5 items-center justify-center", children: /* @__PURE__ */ jsx(ContextMenuPrimitive.ItemIndicator, { children: /* @__PURE__ */ jsx(CircleIcon, { className: "size-2 fill-current" }) }) }),
1433
+ children
1434
+ ]
1435
+ }
1436
+ );
1437
+ }
1438
+ function ContextMenuLabel({
1439
+ className,
1440
+ inset,
1441
+ ...props
1442
+ }) {
1443
+ return /* @__PURE__ */ jsx(
1444
+ ContextMenuPrimitive.Label,
1445
+ {
1446
+ "data-slot": "context-menu-label",
1447
+ "data-inset": inset,
1448
+ className: cn("text-foreground px-2 py-1.5 text-sm font-medium data-[inset]:pl-8", className),
1449
+ ...props
1450
+ }
1451
+ );
1452
+ }
1453
+ function ContextMenuSeparator({
1454
+ className,
1455
+ ...props
1456
+ }) {
1457
+ return /* @__PURE__ */ jsx(
1458
+ ContextMenuPrimitive.Separator,
1459
+ {
1460
+ "data-slot": "context-menu-separator",
1461
+ className: cn("bg-border -mx-1 my-1 h-px", className),
1462
+ ...props
1463
+ }
1464
+ );
1465
+ }
1466
+ function ContextMenuShortcut({ className, ...props }) {
1467
+ return /* @__PURE__ */ jsx(
1468
+ "span",
1469
+ {
1470
+ "data-slot": "context-menu-shortcut",
1471
+ className: cn("text-muted-foreground ml-auto text-xs tracking-widest", className),
1472
+ ...props
1473
+ }
1474
+ );
1475
+ }
1476
+
1477
+ function Menubar({ className, ...props }) {
1478
+ return /* @__PURE__ */ jsx(
1479
+ MenubarPrimitive.Root,
1480
+ {
1481
+ "data-slot": "menubar",
1482
+ className: cn(
1483
+ "bg-background flex h-9 items-center gap-1 rounded-md border p-1 shadow-xs",
1484
+ className
1485
+ ),
1486
+ ...props
1487
+ }
1488
+ );
1489
+ }
1490
+ function MenubarMenu({ ...props }) {
1491
+ return /* @__PURE__ */ jsx(MenubarPrimitive.Menu, { "data-slot": "menubar-menu", ...props });
1492
+ }
1493
+ function MenubarGroup({ ...props }) {
1494
+ return /* @__PURE__ */ jsx(MenubarPrimitive.Group, { "data-slot": "menubar-group", ...props });
1495
+ }
1496
+ function MenubarPortal({ ...props }) {
1497
+ return /* @__PURE__ */ jsx(MenubarPrimitive.Portal, { "data-slot": "menubar-portal", ...props });
1498
+ }
1499
+ function MenubarRadioGroup({ ...props }) {
1500
+ return /* @__PURE__ */ jsx(MenubarPrimitive.RadioGroup, { "data-slot": "menubar-radio-group", ...props });
1501
+ }
1502
+ function MenubarTrigger({
1503
+ className,
1504
+ ...props
1505
+ }) {
1506
+ return /* @__PURE__ */ jsx(
1507
+ MenubarPrimitive.Trigger,
1508
+ {
1509
+ "data-slot": "menubar-trigger",
1510
+ className: cn(
1511
+ "focus:bg-accent focus:text-accent-foreground data-[state=open]:bg-accent data-[state=open]:text-accent-foreground flex items-center rounded-sm px-2 py-1 text-sm font-medium outline-hidden select-none",
1512
+ className
1513
+ ),
1514
+ ...props
1515
+ }
1516
+ );
1517
+ }
1518
+ function MenubarContent({
1519
+ className,
1520
+ align = "start",
1521
+ alignOffset = -4,
1522
+ sideOffset = 8,
1523
+ ...props
1524
+ }) {
1525
+ return /* @__PURE__ */ jsx(MenubarPortal, { children: /* @__PURE__ */ jsx(
1526
+ MenubarPrimitive.Content,
1527
+ {
1528
+ "data-slot": "menubar-content",
1529
+ align,
1530
+ alignOffset,
1531
+ sideOffset,
1532
+ className: cn(
1533
+ "bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 min-w-[12rem] origin-(--radix-menubar-content-transform-origin) overflow-hidden rounded-md border p-1 shadow-md",
1534
+ className
1535
+ ),
1536
+ ...props
1537
+ }
1538
+ ) });
1539
+ }
1540
+ function MenubarItem({
1541
+ className,
1542
+ inset,
1543
+ variant = "default",
1544
+ ...props
1545
+ }) {
1546
+ return /* @__PURE__ */ jsx(
1547
+ MenubarPrimitive.Item,
1548
+ {
1549
+ "data-slot": "menubar-item",
1550
+ "data-inset": inset,
1551
+ "data-variant": variant,
1552
+ className: cn(
1553
+ "focus:bg-accent focus:text-accent-foreground data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 dark:data-[variant=destructive]:focus:bg-destructive/20 data-[variant=destructive]:focus:text-destructive data-[variant=destructive]:*:[svg]:!text-destructive [&_svg:not([class*='text-'])]:text-muted-foreground relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 data-[inset]:pl-8 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
1554
+ className
1555
+ ),
1556
+ ...props
1557
+ }
1558
+ );
1559
+ }
1560
+ function MenubarCheckboxItem({
1561
+ className,
1562
+ children,
1563
+ checked,
1564
+ ...props
1565
+ }) {
1566
+ return /* @__PURE__ */ jsxs(
1567
+ MenubarPrimitive.CheckboxItem,
1568
+ {
1569
+ "data-slot": "menubar-checkbox-item",
1570
+ className: cn(
1571
+ "focus:bg-accent focus:text-accent-foreground relative flex cursor-default items-center gap-2 rounded-xs py-1.5 pr-2 pl-8 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
1572
+ className
1573
+ ),
1574
+ checked,
1575
+ ...props,
1576
+ children: [
1577
+ /* @__PURE__ */ jsx("span", { className: "pointer-events-none absolute left-2 flex size-3.5 items-center justify-center", children: /* @__PURE__ */ jsx(MenubarPrimitive.ItemIndicator, { children: /* @__PURE__ */ jsx(CheckIcon, { className: "size-4" }) }) }),
1578
+ children
1579
+ ]
1580
+ }
1581
+ );
1582
+ }
1583
+ function MenubarRadioItem({
1584
+ className,
1585
+ children,
1586
+ ...props
1587
+ }) {
1588
+ return /* @__PURE__ */ jsxs(
1589
+ MenubarPrimitive.RadioItem,
1590
+ {
1591
+ "data-slot": "menubar-radio-item",
1592
+ className: cn(
1593
+ "focus:bg-accent focus:text-accent-foreground relative flex cursor-default items-center gap-2 rounded-xs py-1.5 pr-2 pl-8 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
1594
+ className
1595
+ ),
1596
+ ...props,
1597
+ children: [
1598
+ /* @__PURE__ */ jsx("span", { className: "pointer-events-none absolute left-2 flex size-3.5 items-center justify-center", children: /* @__PURE__ */ jsx(MenubarPrimitive.ItemIndicator, { children: /* @__PURE__ */ jsx(CircleIcon, { className: "size-2 fill-current" }) }) }),
1599
+ children
1600
+ ]
1601
+ }
1602
+ );
1603
+ }
1604
+ function MenubarLabel({
1605
+ className,
1606
+ inset,
1607
+ ...props
1608
+ }) {
1609
+ return /* @__PURE__ */ jsx(
1610
+ MenubarPrimitive.Label,
1611
+ {
1612
+ "data-slot": "menubar-label",
1613
+ "data-inset": inset,
1614
+ className: cn("px-2 py-1.5 text-sm font-medium data-[inset]:pl-8", className),
1615
+ ...props
1616
+ }
1617
+ );
1618
+ }
1619
+ function MenubarSeparator({
1620
+ className,
1621
+ ...props
1622
+ }) {
1623
+ return /* @__PURE__ */ jsx(
1624
+ MenubarPrimitive.Separator,
1625
+ {
1626
+ "data-slot": "menubar-separator",
1627
+ className: cn("bg-border -mx-1 my-1 h-px", className),
1628
+ ...props
1629
+ }
1630
+ );
1631
+ }
1632
+ function MenubarShortcut({ className, ...props }) {
1633
+ return /* @__PURE__ */ jsx(
1634
+ "span",
1635
+ {
1636
+ "data-slot": "menubar-shortcut",
1637
+ className: cn("text-muted-foreground ml-auto text-xs tracking-widest", className),
1638
+ ...props
1639
+ }
1640
+ );
1641
+ }
1642
+ function MenubarSub({ ...props }) {
1643
+ return /* @__PURE__ */ jsx(MenubarPrimitive.Sub, { "data-slot": "menubar-sub", ...props });
1644
+ }
1645
+ function MenubarSubTrigger({
1646
+ className,
1647
+ inset,
1648
+ children,
1649
+ ...props
1650
+ }) {
1651
+ return /* @__PURE__ */ jsxs(
1652
+ MenubarPrimitive.SubTrigger,
1653
+ {
1654
+ "data-slot": "menubar-sub-trigger",
1655
+ "data-inset": inset,
1656
+ className: cn(
1657
+ "focus:bg-accent focus:text-accent-foreground data-[state=open]:bg-accent data-[state=open]:text-accent-foreground flex cursor-default items-center rounded-sm px-2 py-1.5 text-sm outline-none select-none data-[inset]:pl-8",
1658
+ className
1659
+ ),
1660
+ ...props,
1661
+ children: [
1662
+ children,
1663
+ /* @__PURE__ */ jsx(ChevronRightIcon, { className: "ml-auto h-4 w-4" })
1664
+ ]
1665
+ }
1666
+ );
1667
+ }
1668
+ function MenubarSubContent({
1669
+ className,
1670
+ ...props
1671
+ }) {
1672
+ return /* @__PURE__ */ jsx(
1673
+ MenubarPrimitive.SubContent,
1674
+ {
1675
+ "data-slot": "menubar-sub-content",
1676
+ className: cn(
1677
+ "bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 min-w-[8rem] origin-(--radix-menubar-content-transform-origin) overflow-hidden rounded-md border p-1 shadow-lg",
1678
+ className
1679
+ ),
1680
+ ...props
1681
+ }
1682
+ );
1683
+ }
1684
+
1685
+ function Command({ className, ...props }) {
1686
+ return /* @__PURE__ */ jsx(
1687
+ Command$1,
1688
+ {
1689
+ "data-slot": "command",
1690
+ className: cn(
1691
+ "bg-popover text-popover-foreground flex h-full w-full flex-col overflow-hidden rounded-md",
1692
+ className
1693
+ ),
1694
+ ...props
1695
+ }
1696
+ );
1697
+ }
1698
+ function CommandDialog({
1699
+ title = "Command Palette",
1700
+ description = "Search for a command to run...",
1701
+ children,
1702
+ ...props
1703
+ }) {
1704
+ return /* @__PURE__ */ jsxs(Dialog, { ...props, children: [
1705
+ /* @__PURE__ */ jsxs(DialogHeader, { className: "sr-only", children: [
1706
+ /* @__PURE__ */ jsx(DialogTitle, { children: title }),
1707
+ /* @__PURE__ */ jsx(DialogDescription, { children: description })
1708
+ ] }),
1709
+ /* @__PURE__ */ jsx(DialogContent, { className: "overflow-hidden p-0", children: /* @__PURE__ */ jsx(Command, { className: "[&_[cmdk-group-heading]]:text-muted-foreground **:data-[slot=command-input-wrapper]:h-12 [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group]]:px-2 [&_[cmdk-group]:not([hidden])_~[cmdk-group]]:pt-0 [&_[cmdk-input-wrapper]_svg]:h-5 [&_[cmdk-input-wrapper]_svg]:w-5 [&_[cmdk-input]]:h-12 [&_[cmdk-item]]:px-2 [&_[cmdk-item]]:py-3 [&_[cmdk-item]_svg]:h-5 [&_[cmdk-item]_svg]:w-5", children }) })
1710
+ ] });
1711
+ }
1712
+ function CommandInput({
1713
+ className,
1714
+ ...props
1715
+ }) {
1716
+ return /* @__PURE__ */ jsxs("div", { "data-slot": "command-input-wrapper", className: "flex h-9 items-center gap-2 border-b px-3", children: [
1717
+ /* @__PURE__ */ jsx(SearchIcon, { className: "size-4 shrink-0 opacity-50" }),
1718
+ /* @__PURE__ */ jsx(
1719
+ Command$1.Input,
1720
+ {
1721
+ "data-slot": "command-input",
1722
+ className: cn(
1723
+ "placeholder:text-muted-foreground flex h-10 w-full rounded-md bg-transparent py-3 text-sm outline-hidden disabled:cursor-not-allowed disabled:opacity-50",
1724
+ className
1725
+ ),
1726
+ ...props
1727
+ }
1728
+ )
1729
+ ] });
1730
+ }
1731
+ function CommandList({ className, ...props }) {
1732
+ return /* @__PURE__ */ jsx(
1733
+ Command$1.List,
1734
+ {
1735
+ "data-slot": "command-list",
1736
+ role: "listbox",
1737
+ className: cn("max-h-[300px] scroll-py-1 overflow-x-hidden overflow-y-auto", className),
1738
+ ...props
1739
+ }
1740
+ );
1741
+ }
1742
+ function CommandEmpty({ ...props }) {
1743
+ return /* @__PURE__ */ jsx(
1744
+ Command$1.Empty,
1745
+ {
1746
+ "data-slot": "command-empty",
1747
+ className: "py-6 text-center text-sm",
1748
+ ...props
1749
+ }
1750
+ );
1751
+ }
1752
+ function CommandGroup({
1753
+ className,
1754
+ ...props
1755
+ }) {
1756
+ return /* @__PURE__ */ jsx(
1757
+ Command$1.Group,
1758
+ {
1759
+ "data-slot": "command-group",
1760
+ className: cn(
1761
+ "text-foreground [&_[cmdk-group-heading]]:text-muted-foreground overflow-hidden p-1 [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium",
1762
+ className
1763
+ ),
1764
+ ...props
1765
+ }
1766
+ );
1767
+ }
1768
+ function CommandSeparator({
1769
+ className,
1770
+ ...props
1771
+ }) {
1772
+ return /* @__PURE__ */ jsx(
1773
+ Command$1.Separator,
1774
+ {
1775
+ "data-slot": "command-separator",
1776
+ className: cn("bg-border -mx-1 h-px", className),
1777
+ ...props
1778
+ }
1779
+ );
1780
+ }
1781
+ function CommandItem({ className, ...props }) {
1782
+ return /* @__PURE__ */ jsx(
1783
+ Command$1.Item,
1784
+ {
1785
+ "data-slot": "command-item",
1786
+ role: "option",
1787
+ className: cn(
1788
+ "data-[selected=true]:bg-accent data-[selected=true]:text-accent-foreground [&_svg:not([class*='text-'])]:text-muted-foreground relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
1789
+ className
1790
+ ),
1791
+ ...props
1792
+ }
1793
+ );
1794
+ }
1795
+ function CommandShortcut({ className, ...props }) {
1796
+ return /* @__PURE__ */ jsx(
1797
+ "span",
1798
+ {
1799
+ "data-slot": "command-shortcut",
1800
+ className: cn("text-muted-foreground ml-auto text-xs tracking-widest", className),
1801
+ ...props
1802
+ }
1803
+ );
1804
+ }
1805
+
1806
+ const variantStyles = {
1807
+ default: "bg-primary text-primary-foreground",
1808
+ secondary: "bg-secondary text-secondary-foreground",
1809
+ destructive: "bg-destructive text-destructive-foreground",
1810
+ outline: "border-2 border-primary bg-background text-primary",
1811
+ success: "bg-success text-success-foreground",
1812
+ info: "bg-info text-info-foreground",
1813
+ warning: "bg-warning text-warning-foreground"
1814
+ };
1815
+ const NotificationBadge = React.forwardRef(
1816
+ ({
1817
+ className,
1818
+ count = 0,
1819
+ max = 99,
1820
+ showZero = false,
1821
+ dot = false,
1822
+ variant = "destructive",
1823
+ children,
1824
+ ...props
1825
+ }, ref) => {
1826
+ const displayCount = count > max ? `${max}+` : count;
1827
+ const shouldShow = count > 0 || showZero;
1828
+ if (!shouldShow && !dot) {
1829
+ return /* @__PURE__ */ jsx("div", { ref, className, ...props, children });
1830
+ }
1831
+ return /* @__PURE__ */ jsxs("div", { ref, className: cn("relative inline-block", className), ...props, children: [
1832
+ children,
1833
+ /* @__PURE__ */ jsx(
1834
+ "span",
1835
+ {
1836
+ className: cn(
1837
+ "absolute -right-1 -top-1 flex items-center justify-center rounded-full",
1838
+ variantStyles[variant],
1839
+ dot ? "h-2 w-2" : "min-w-[1.25rem] h-5 px-1.5"
1840
+ ),
1841
+ children: !dot && shouldShow && /* @__PURE__ */ jsx("span", { className: "text-[10px] font-medium leading-none", children: displayCount })
1842
+ }
1843
+ )
1844
+ ] });
1845
+ }
1846
+ );
1847
+ NotificationBadge.displayName = "NotificationBadge";
1848
+
1849
+ const StatsCard = React.forwardRef(
1850
+ ({ className, title, value, description, trend, icon, iconColor, iconBg, ...props }, ref) => {
1851
+ const getTrendIcon = () => {
1852
+ if (!trend) return null;
1853
+ if (trend.value > 0) {
1854
+ return /* @__PURE__ */ jsx(TrendingUp, { className: "h-4 w-4 text-success" });
1855
+ } else if (trend.value < 0) {
1856
+ return /* @__PURE__ */ jsx(TrendingDown, { className: "h-4 w-4 text-destructive" });
1857
+ } else {
1858
+ return /* @__PURE__ */ jsx(Minus, { className: "h-4 w-4 text-muted-foreground" });
1859
+ }
1860
+ };
1861
+ const getTrendColor = () => {
1862
+ if (!trend) return "";
1863
+ if (trend.value > 0) {
1864
+ return "text-success";
1865
+ } else if (trend.value < 0) {
1866
+ return "text-destructive";
1867
+ } else {
1868
+ return "text-muted-foreground";
1869
+ }
1870
+ };
1871
+ return /* @__PURE__ */ jsx(Card, { ref, className: cn("", className), ...props, children: /* @__PURE__ */ jsx(CardContent, { className: "p-4 sm:p-6", children: /* @__PURE__ */ jsxs("div", { className: "flex items-start justify-between gap-3", children: [
1872
+ /* @__PURE__ */ jsxs("div", { className: "flex-1 min-w-0", children: [
1873
+ /* @__PURE__ */ jsx("p", { className: "text-muted-foreground mb-1 text-sm", children: title }),
1874
+ /* @__PURE__ */ jsxs("div", { className: "flex flex-wrap items-baseline gap-2", children: [
1875
+ /* @__PURE__ */ jsx("h3", { className: "text-foreground text-xl sm:text-2xl", children: value }),
1876
+ trend && /* @__PURE__ */ jsxs("div", { className: cn("flex items-center gap-1 text-sm", getTrendColor()), children: [
1877
+ getTrendIcon(),
1878
+ /* @__PURE__ */ jsxs("span", { children: [
1879
+ Math.abs(trend.value),
1880
+ "%"
1881
+ ] })
1882
+ ] })
1883
+ ] }),
1884
+ (description || trend?.label) && /* @__PURE__ */ jsx("p", { className: "text-muted-foreground mt-1 text-xs sm:text-sm", children: trend?.label || description })
1885
+ ] }),
1886
+ icon && /* @__PURE__ */ jsx(
1887
+ "div",
1888
+ {
1889
+ className: cn(
1890
+ "rounded-[var(--radius)] p-2 sm:p-3 flex-shrink-0",
1891
+ iconBg || "bg-muted",
1892
+ iconColor || "text-muted-foreground"
1893
+ ),
1894
+ children: icon
1895
+ }
1896
+ )
1897
+ ] }) }) });
1898
+ }
1899
+ );
1900
+ StatsCard.displayName = "StatsCard";
1901
+
1902
+ function StatsCardSkeleton({
1903
+ showIcon = true,
1904
+ showTrend = true,
1905
+ className,
1906
+ ...props
1907
+ }) {
1908
+ return /* @__PURE__ */ jsx(Card, { className: cn("", className), ...props, children: /* @__PURE__ */ jsx(CardContent, { className: "p-4 sm:p-6", children: /* @__PURE__ */ jsxs("div", { className: "flex items-start justify-between gap-3", children: [
1909
+ /* @__PURE__ */ jsxs("div", { className: "flex-1 min-w-0", children: [
1910
+ /* @__PURE__ */ jsx(Skeleton, { className: "h-3.5 w-28 mb-2" }),
1911
+ /* @__PURE__ */ jsxs("div", { className: "flex flex-wrap items-baseline gap-2", children: [
1912
+ /* @__PURE__ */ jsx(Skeleton, { className: "h-7 w-24" }),
1913
+ showTrend && /* @__PURE__ */ jsx(Skeleton, { className: "h-4 w-14 rounded-full" })
1914
+ ] }),
1915
+ /* @__PURE__ */ jsx(Skeleton, { className: "h-3 w-32 mt-2" })
1916
+ ] }),
1917
+ showIcon && /* @__PURE__ */ jsx(Skeleton, { className: "size-9 sm:size-11 rounded-[var(--radius)] shrink-0" })
1918
+ ] }) }) });
1919
+ }
1920
+ StatsCardSkeleton.displayName = "StatsCardSkeleton";
1921
+
1922
+ const Timeline = React.forwardRef(
1923
+ ({ className, ...props }, ref) => /* @__PURE__ */ jsx("ol", { ref, className: cn("relative border-l border-border", className), ...props })
1924
+ );
1925
+ Timeline.displayName = "Timeline";
1926
+ const TimelineItem = React.forwardRef(
1927
+ ({ className, ...props }, ref) => /* @__PURE__ */ jsx("li", { ref, className: cn("mb-10 ml-6", className), ...props })
1928
+ );
1929
+ TimelineItem.displayName = "TimelineItem";
1930
+ const TimelineDot = React.forwardRef(({ className, variant = "default", icon, children, ...props }, ref) => {
1931
+ const variantStyles = {
1932
+ default: "bg-muted border-border",
1933
+ primary: "bg-primary border-primary",
1934
+ success: "bg-success border-success",
1935
+ info: "bg-info border-info",
1936
+ warning: "bg-warning border-warning",
1937
+ destructive: "bg-destructive border-destructive",
1938
+ outline: "bg-background border-border"
1939
+ };
1940
+ const iconColorStyles = {
1941
+ default: "text-muted-foreground",
1942
+ primary: "text-primary-foreground",
1943
+ success: "text-success-foreground",
1944
+ info: "text-info-foreground",
1945
+ warning: "text-warning-foreground",
1946
+ destructive: "text-destructive-foreground",
1947
+ outline: "text-foreground"
1948
+ };
1949
+ if (icon || children) {
1950
+ return /* @__PURE__ */ jsx(
1951
+ "div",
1952
+ {
1953
+ ref,
1954
+ className: cn(
1955
+ "absolute -left-[17px] mt-0.5 h-8 w-8 rounded-full border-2 flex items-center justify-center",
1956
+ variantStyles[variant],
1957
+ className
1958
+ ),
1959
+ ...props,
1960
+ children: /* @__PURE__ */ jsx("span", { className: cn("h-4 w-4", iconColorStyles[variant]), children: icon || children })
1961
+ }
1962
+ );
1963
+ }
1964
+ return /* @__PURE__ */ jsx(
1965
+ "div",
1966
+ {
1967
+ ref,
1968
+ className: cn(
1969
+ "absolute -left-[9px] mt-1.5 h-4 w-4 rounded-full border-2",
1970
+ variantStyles[variant],
1971
+ className
1972
+ ),
1973
+ ...props
1974
+ }
1975
+ );
1976
+ });
1977
+ TimelineDot.displayName = "TimelineDot";
1978
+ const TimelineContent = React.forwardRef(
1979
+ ({ className, ...props }, ref) => /* @__PURE__ */ jsx("div", { ref, className: cn("", className), ...props })
1980
+ );
1981
+ TimelineContent.displayName = "TimelineContent";
1982
+ const TimelineHeading = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("h3", { ref, className: cn("mb-1 text-foreground", className), ...props }));
1983
+ TimelineHeading.displayName = "TimelineHeading";
1984
+ const TimelineTime = React.forwardRef(
1985
+ ({ className, ...props }, ref) => /* @__PURE__ */ jsx("time", { ref, className: cn("mb-2 block text-muted-foreground", className), ...props })
1986
+ );
1987
+ TimelineTime.displayName = "TimelineTime";
1988
+ const TimelineDescription = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("p", { ref, className: cn("text-muted-foreground", className), ...props }));
1989
+ TimelineDescription.displayName = "TimelineDescription";
1990
+
1991
+ function useTreeView({
1992
+ data,
1993
+ defaultExpanded = [],
1994
+ selectedNodeId,
1995
+ onNodeClick,
1996
+ onNodeSelect
1997
+ }) {
1998
+ const [expanded, setExpanded] = useState(new Set(defaultExpanded));
1999
+ const [internalSelectedId, setInternalSelectedId] = useState(void 0);
2000
+ const nodeRefs = useRef(/* @__PURE__ */ new Map());
2001
+ const isControlled = selectedNodeId !== void 0;
2002
+ const effectiveSelectedId = isControlled ? selectedNodeId : internalSelectedId;
2003
+ const getNodeRef = useCallback(
2004
+ (nodeId) => (el) => {
2005
+ if (el) nodeRefs.current.set(nodeId, el);
2006
+ else nodeRefs.current.delete(nodeId);
2007
+ },
2008
+ []
2009
+ );
2010
+ const getVisibleNodes = useCallback(() => {
2011
+ const result = [];
2012
+ const traverse = (nodes) => {
2013
+ for (const node of nodes) {
2014
+ result.push(node);
2015
+ if (node.children?.length && expanded.has(node.id)) traverse(node.children);
2016
+ }
2017
+ };
2018
+ traverse(data);
2019
+ return result;
2020
+ }, [data, expanded]);
2021
+ const findParent = useCallback(
2022
+ (nodes, targetId) => {
2023
+ for (const n of nodes) {
2024
+ if (n.children?.some((c) => c.id === targetId)) return n;
2025
+ if (n.children) {
2026
+ const found = findParent(n.children, targetId);
2027
+ if (found) return found;
2028
+ }
2029
+ }
2030
+ return null;
2031
+ },
2032
+ // findParent is a pure recursive function over `data` — no reactive deps needed
2033
+ // eslint-disable-next-line react-hooks/exhaustive-deps
2034
+ []
2035
+ );
2036
+ const toggleExpand = useCallback((nodeId) => {
2037
+ setExpanded((prev) => {
2038
+ const next = new Set(prev);
2039
+ next.has(nodeId) ? next.delete(nodeId) : next.add(nodeId);
2040
+ return next;
2041
+ });
2042
+ }, []);
2043
+ const handleSelect = useCallback(
2044
+ (node) => {
2045
+ if (!isControlled) setInternalSelectedId(node.id);
2046
+ onNodeSelect?.(node);
2047
+ onNodeClick?.(node);
2048
+ },
2049
+ [isControlled, onNodeClick, onNodeSelect]
2050
+ );
2051
+ const handleKeyDown = useCallback(
2052
+ (e, node) => {
2053
+ const visibleNodes = getVisibleNodes();
2054
+ const idx = visibleNodes.findIndex((n) => n.id === node.id);
2055
+ const hasChildren = !!node.children?.length;
2056
+ const isExpanded = expanded.has(node.id);
2057
+ const focusNode = (id) => {
2058
+ nodeRefs.current.get(id)?.focus();
2059
+ };
2060
+ switch (e.key) {
2061
+ case "ArrowDown": {
2062
+ e.preventDefault();
2063
+ const next = visibleNodes[idx + 1];
2064
+ if (next) focusNode(next.id);
2065
+ break;
2066
+ }
2067
+ case "ArrowUp": {
2068
+ e.preventDefault();
2069
+ const prev = visibleNodes[idx - 1];
2070
+ if (prev) focusNode(prev.id);
2071
+ break;
2072
+ }
2073
+ case "ArrowRight": {
2074
+ e.preventDefault();
2075
+ if (hasChildren && !isExpanded) {
2076
+ toggleExpand(node.id);
2077
+ } else if (hasChildren && isExpanded && node.children?.length) {
2078
+ focusNode(node.children[0].id);
2079
+ }
2080
+ break;
2081
+ }
2082
+ case "ArrowLeft": {
2083
+ e.preventDefault();
2084
+ if (hasChildren && isExpanded) {
2085
+ toggleExpand(node.id);
2086
+ } else {
2087
+ const parent = findParent(data, node.id);
2088
+ if (parent) focusNode(parent.id);
2089
+ }
2090
+ break;
2091
+ }
2092
+ case "Home": {
2093
+ e.preventDefault();
2094
+ if (visibleNodes.length > 0) focusNode(visibleNodes[0].id);
2095
+ break;
2096
+ }
2097
+ case "End": {
2098
+ e.preventDefault();
2099
+ const last = visibleNodes[visibleNodes.length - 1];
2100
+ if (last) focusNode(last.id);
2101
+ break;
2102
+ }
2103
+ case " ": {
2104
+ e.preventDefault();
2105
+ if (hasChildren) {
2106
+ toggleExpand(node.id);
2107
+ } else {
2108
+ handleSelect(node);
2109
+ }
2110
+ break;
2111
+ }
2112
+ case "Enter": {
2113
+ e.preventDefault();
2114
+ if (hasChildren) toggleExpand(node.id);
2115
+ handleSelect(node);
2116
+ break;
2117
+ }
2118
+ }
2119
+ },
2120
+ [data, expanded, findParent, getVisibleNodes, handleSelect, toggleExpand]
2121
+ );
2122
+ return {
2123
+ expanded,
2124
+ effectiveSelectedId,
2125
+ nodeRefs,
2126
+ getNodeRef,
2127
+ toggleExpand,
2128
+ handleSelect,
2129
+ handleKeyDown,
2130
+ getVisibleNodes
2131
+ };
2132
+ }
2133
+
2134
+ const TreeView = React.forwardRef(
2135
+ ({
2136
+ className,
2137
+ data,
2138
+ onNodeClick,
2139
+ onNodeSelect,
2140
+ defaultExpanded = [],
2141
+ selectedNodeId,
2142
+ ariaLabel,
2143
+ ...props
2144
+ }, ref) => {
2145
+ const { expanded, effectiveSelectedId, getNodeRef, toggleExpand, handleSelect, handleKeyDown } = useTreeView({ data, defaultExpanded, selectedNodeId, onNodeClick, onNodeSelect });
2146
+ const focusableId = effectiveSelectedId ?? data[0]?.id;
2147
+ return /* @__PURE__ */ jsx(
2148
+ "div",
2149
+ {
2150
+ ref,
2151
+ className: cn("w-full", className),
2152
+ role: "tree",
2153
+ "aria-label": ariaLabel ?? "Navegação em árvore",
2154
+ ...props,
2155
+ children: data.map((node) => /* @__PURE__ */ jsx(
2156
+ TreeNodeComponent,
2157
+ {
2158
+ node,
2159
+ level: 0,
2160
+ expanded,
2161
+ selectedId: effectiveSelectedId,
2162
+ focusableId,
2163
+ onToggle: toggleExpand,
2164
+ onSelect: handleSelect,
2165
+ onKeyDown: handleKeyDown,
2166
+ getNodeRef
2167
+ },
2168
+ node.id
2169
+ ))
2170
+ }
2171
+ );
2172
+ }
2173
+ );
2174
+ TreeView.displayName = "TreeView";
2175
+ const TreeNodeComponent = ({
2176
+ node,
2177
+ level,
2178
+ expanded,
2179
+ selectedId,
2180
+ focusableId,
2181
+ onToggle,
2182
+ onSelect,
2183
+ onKeyDown,
2184
+ getNodeRef
2185
+ }) => {
2186
+ const hasChildren = !!node.children?.length;
2187
+ const isExpanded = expanded.has(node.id);
2188
+ const isSelected = node.id === selectedId;
2189
+ const handleClick = () => {
2190
+ if (hasChildren) onToggle(node.id);
2191
+ onSelect(node);
2192
+ };
2193
+ return /* @__PURE__ */ jsxs("div", { role: "none", children: [
2194
+ /* @__PURE__ */ jsxs(
2195
+ "button",
2196
+ {
2197
+ ref: getNodeRef(node.id),
2198
+ role: "treeitem",
2199
+ "aria-expanded": hasChildren ? isExpanded : void 0,
2200
+ "aria-selected": isSelected,
2201
+ tabIndex: node.id === focusableId ? 0 : -1,
2202
+ onClick: handleClick,
2203
+ onKeyDown: (e) => onKeyDown(e, node),
2204
+ className: cn(
2205
+ "flex w-full items-center gap-2 rounded-[var(--radius)] px-2 py-1.5 text-left transition-colors",
2206
+ "hover:bg-muted focus:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1",
2207
+ isSelected && "bg-primary/10 text-primary font-medium"
2208
+ ),
2209
+ style: { paddingLeft: `${level * 1.5 + 0.5}rem` },
2210
+ children: [
2211
+ hasChildren ? /* @__PURE__ */ jsx("span", { className: "flex-shrink-0 text-muted-foreground", children: isExpanded ? /* @__PURE__ */ jsx(ChevronDown, { className: "h-4 w-4" }) : /* @__PURE__ */ jsx(ChevronRight, { className: "h-4 w-4" }) }) : /* @__PURE__ */ jsx("span", { className: "w-4 flex-shrink-0", "aria-hidden": "true" }),
2212
+ node.icon && /* @__PURE__ */ jsx("span", { className: "flex-shrink-0 text-muted-foreground", children: node.icon }),
2213
+ /* @__PURE__ */ jsx("span", { className: "flex-1 text-foreground", children: node.label })
2214
+ ]
2215
+ }
2216
+ ),
2217
+ hasChildren && isExpanded && /* @__PURE__ */ jsx("div", { role: "group", children: node.children.map((child) => /* @__PURE__ */ jsx(
2218
+ TreeNodeComponent,
2219
+ {
2220
+ node: child,
2221
+ level: level + 1,
2222
+ expanded,
2223
+ selectedId,
2224
+ focusableId,
2225
+ onToggle,
2226
+ onSelect,
2227
+ onKeyDown,
2228
+ getNodeRef
2229
+ },
2230
+ child.id
2231
+ )) })
2232
+ ] });
2233
+ };
2234
+
2235
+ function Collapsible({ ...props }) {
2236
+ return /* @__PURE__ */ jsx(CollapsiblePrimitive.Root, { "data-slot": "collapsible", ...props });
2237
+ }
2238
+ function CollapsibleTrigger({
2239
+ ...props
2240
+ }) {
2241
+ return /* @__PURE__ */ jsx(CollapsiblePrimitive.CollapsibleTrigger, { "data-slot": "collapsible-trigger", ...props });
2242
+ }
2243
+ function CollapsibleContent({
2244
+ ...props
2245
+ }) {
2246
+ return /* @__PURE__ */ jsx(CollapsiblePrimitive.CollapsibleContent, { "data-slot": "collapsible-content", ...props });
2247
+ }
2248
+
2249
+ function Accordion({ ...props }) {
2250
+ return /* @__PURE__ */ jsx(AccordionPrimitive.Root, { "data-slot": "accordion", ...props });
2251
+ }
2252
+ function AccordionItem({
2253
+ className,
2254
+ ...props
2255
+ }) {
2256
+ return /* @__PURE__ */ jsx(
2257
+ AccordionPrimitive.Item,
2258
+ {
2259
+ "data-slot": "accordion-item",
2260
+ className: cn("border-b last:border-b-0", className),
2261
+ ...props
2262
+ }
2263
+ );
2264
+ }
2265
+ function AccordionTrigger({
2266
+ className,
2267
+ children,
2268
+ ...props
2269
+ }) {
2270
+ return /* @__PURE__ */ jsx(AccordionPrimitive.Header, { className: "flex", children: /* @__PURE__ */ jsxs(
2271
+ AccordionPrimitive.Trigger,
2272
+ {
2273
+ "data-slot": "accordion-trigger",
2274
+ className: cn(
2275
+ "focus-visible:border-ring focus-visible:ring-ring/50 flex flex-1 items-start justify-between gap-4 rounded-md py-4 text-left text-sm font-medium transition-all outline-none hover:underline focus-visible:ring-[3px] disabled:pointer-events-none disabled:opacity-50 [&[data-state=open]>svg]:rotate-180",
2276
+ className
2277
+ ),
2278
+ ...props,
2279
+ children: [
2280
+ children,
2281
+ /* @__PURE__ */ jsx(ChevronDownIcon, { className: "text-muted-foreground pointer-events-none size-4 shrink-0 translate-y-0.5 transition-transform duration-200" })
2282
+ ]
2283
+ }
2284
+ ) });
2285
+ }
2286
+ function AccordionContent({
2287
+ className,
2288
+ children,
2289
+ ...props
2290
+ }) {
2291
+ return /* @__PURE__ */ jsx(
2292
+ AccordionPrimitive.Content,
2293
+ {
2294
+ "data-slot": "accordion-content",
2295
+ className: "data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down overflow-hidden text-sm",
2296
+ ...props,
2297
+ children: /* @__PURE__ */ jsx("div", { className: cn("pt-0 pb-4", className), children })
2298
+ }
2299
+ );
2300
+ }
2301
+
2302
+ const CarouselContext = React.createContext(null);
2303
+ function useCarousel() {
2304
+ const context = React.useContext(CarouselContext);
2305
+ if (!context) {
2306
+ throw new Error("useCarousel must be used within a <Carousel />");
2307
+ }
2308
+ return context;
2309
+ }
2310
+ function Carousel({
2311
+ orientation = "horizontal",
2312
+ opts,
2313
+ setApi,
2314
+ plugins,
2315
+ className,
2316
+ children,
2317
+ ...props
2318
+ }) {
2319
+ const [carouselRef, api] = useEmblaCarousel(
2320
+ {
2321
+ ...opts,
2322
+ axis: orientation === "horizontal" ? "x" : "y"
2323
+ },
2324
+ plugins
2325
+ );
2326
+ const [canScrollPrev, setCanScrollPrev] = React.useState(false);
2327
+ const [canScrollNext, setCanScrollNext] = React.useState(false);
2328
+ const onSelect = React.useCallback((api2) => {
2329
+ if (!api2) return;
2330
+ setCanScrollPrev(api2.canScrollPrev());
2331
+ setCanScrollNext(api2.canScrollNext());
2332
+ }, []);
2333
+ const scrollPrev = React.useCallback(() => {
2334
+ api?.scrollPrev();
2335
+ }, [api]);
2336
+ const scrollNext = React.useCallback(() => {
2337
+ api?.scrollNext();
2338
+ }, [api]);
2339
+ const handleKeyDown = React.useCallback(
2340
+ (event) => {
2341
+ if (event.key === "ArrowLeft") {
2342
+ event.preventDefault();
2343
+ scrollPrev();
2344
+ } else if (event.key === "ArrowRight") {
2345
+ event.preventDefault();
2346
+ scrollNext();
2347
+ }
2348
+ },
2349
+ [scrollPrev, scrollNext]
2350
+ );
2351
+ React.useEffect(() => {
2352
+ if (!api || !setApi) return;
2353
+ setApi(api);
2354
+ }, [api, setApi]);
2355
+ React.useEffect(() => {
2356
+ if (!api) return;
2357
+ onSelect(api);
2358
+ api.on("reInit", onSelect);
2359
+ api.on("select", onSelect);
2360
+ return () => {
2361
+ api?.off("select", onSelect);
2362
+ };
2363
+ }, [api, onSelect]);
2364
+ return /* @__PURE__ */ jsx(
2365
+ CarouselContext.Provider,
2366
+ {
2367
+ value: {
2368
+ carouselRef,
2369
+ api,
2370
+ opts,
2371
+ orientation: orientation || (opts?.axis === "y" ? "vertical" : "horizontal"),
2372
+ scrollPrev,
2373
+ scrollNext,
2374
+ canScrollPrev,
2375
+ canScrollNext
2376
+ },
2377
+ children: /* @__PURE__ */ jsx(
2378
+ "div",
2379
+ {
2380
+ onKeyDownCapture: handleKeyDown,
2381
+ className: cn("relative", className),
2382
+ role: "region",
2383
+ "aria-roledescription": "carousel",
2384
+ "data-slot": "carousel",
2385
+ ...props,
2386
+ children
2387
+ }
2388
+ )
2389
+ }
2390
+ );
2391
+ }
2392
+ function CarouselContent({ className, ...props }) {
2393
+ const { carouselRef, orientation } = useCarousel();
2394
+ return /* @__PURE__ */ jsx("div", { ref: carouselRef, className: "overflow-hidden", "data-slot": "carousel-content", children: /* @__PURE__ */ jsx(
2395
+ "div",
2396
+ {
2397
+ className: cn("flex", orientation === "horizontal" ? "-ml-4" : "-mt-4 flex-col", className),
2398
+ ...props
2399
+ }
2400
+ ) });
2401
+ }
2402
+ function CarouselItem({ className, ...props }) {
2403
+ const { orientation } = useCarousel();
2404
+ return /* @__PURE__ */ jsx(
2405
+ "div",
2406
+ {
2407
+ role: "group",
2408
+ "aria-roledescription": "slide",
2409
+ "data-slot": "carousel-item",
2410
+ className: cn(
2411
+ "min-w-0 shrink-0 grow-0 basis-full",
2412
+ orientation === "horizontal" ? "pl-4" : "pt-4",
2413
+ className
2414
+ ),
2415
+ ...props
2416
+ }
2417
+ );
2418
+ }
2419
+ function CarouselPrevious({
2420
+ className,
2421
+ variant = "outline",
2422
+ size = "icon",
2423
+ ...props
2424
+ }) {
2425
+ const { orientation, scrollPrev, canScrollPrev } = useCarousel();
2426
+ return /* @__PURE__ */ jsxs(
2427
+ Button,
2428
+ {
2429
+ "data-slot": "carousel-previous",
2430
+ variant,
2431
+ size,
2432
+ className: cn(
2433
+ "absolute size-8 rounded-full",
2434
+ orientation === "horizontal" ? "top-1/2 -left-12 -translate-y-1/2" : "-top-12 left-1/2 -translate-x-1/2 rotate-90",
2435
+ className
2436
+ ),
2437
+ disabled: !canScrollPrev,
2438
+ onClick: scrollPrev,
2439
+ ...props,
2440
+ children: [
2441
+ /* @__PURE__ */ jsx(ArrowLeft, {}),
2442
+ /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Previous slide" })
2443
+ ]
2444
+ }
2445
+ );
2446
+ }
2447
+ function CarouselNext({
2448
+ className,
2449
+ variant = "outline",
2450
+ size = "icon",
2451
+ ...props
2452
+ }) {
2453
+ const { orientation, scrollNext, canScrollNext } = useCarousel();
2454
+ return /* @__PURE__ */ jsxs(
2455
+ Button,
2456
+ {
2457
+ "data-slot": "carousel-next",
2458
+ variant,
2459
+ size,
2460
+ className: cn(
2461
+ "absolute size-8 rounded-full",
2462
+ orientation === "horizontal" ? "top-1/2 -right-12 -translate-y-1/2" : "-bottom-12 left-1/2 -translate-x-1/2 rotate-90",
2463
+ className
2464
+ ),
2465
+ disabled: !canScrollNext,
2466
+ onClick: scrollNext,
2467
+ ...props,
2468
+ children: [
2469
+ /* @__PURE__ */ jsx(ArrowRight, {}),
2470
+ /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Next slide" })
2471
+ ]
2472
+ }
2473
+ );
2474
+ }
2475
+
2476
+ const StepperContext = React.createContext(void 0);
2477
+ const useStepperContext = () => {
2478
+ const context = React.useContext(StepperContext);
2479
+ if (!context) throw new Error("useStepperContext must be used within a Stepper");
2480
+ return context;
2481
+ };
2482
+ const Stepper = React.forwardRef(
2483
+ ({ currentStep, orientation = "horizontal", className, children, ...props }, ref) => {
2484
+ const totalSteps = React.Children.count(children);
2485
+ return /* @__PURE__ */ jsx(StepperContext.Provider, { value: { currentStep, totalSteps, orientation }, children: /* @__PURE__ */ jsx("div", { ref, className: cn("w-full", className), ...props, children: /* @__PURE__ */ jsx(
2486
+ "div",
2487
+ {
2488
+ className: cn(
2489
+ orientation === "horizontal" ? "flex items-start justify-between" : "flex flex-col gap-0"
2490
+ ),
2491
+ role: "list",
2492
+ "aria-label": `Progresso: etapa ${currentStep} de ${totalSteps}`,
2493
+ children
2494
+ }
2495
+ ) }) });
2496
+ }
2497
+ );
2498
+ Stepper.displayName = "Stepper";
2499
+ const Step = React.forwardRef(
2500
+ ({ step, label, description, error = false, className, ...props }, ref) => {
2501
+ const { currentStep, totalSteps, orientation } = useStepperContext();
2502
+ const isActive = step === currentStep;
2503
+ const isCompleted = step < currentStep && !error;
2504
+ const isFirst = step === 1;
2505
+ const isLast = step === totalSteps;
2506
+ const circleClasses = cn(
2507
+ "relative flex h-10 w-10 flex-shrink-0 items-center justify-center rounded-full border-2 transition-colors",
2508
+ isActive && !error && "border-primary bg-primary text-primary-foreground",
2509
+ isCompleted && "border-primary bg-primary text-primary-foreground",
2510
+ error && "border-destructive bg-destructive text-destructive-foreground",
2511
+ !isActive && !isCompleted && !error && "border-muted bg-background text-muted-foreground"
2512
+ );
2513
+ const connectorClasses = (filled) => cn("transition-colors", filled ? "bg-primary" : "bg-muted");
2514
+ if (orientation === "vertical") {
2515
+ return /* @__PURE__ */ jsxs(
2516
+ "div",
2517
+ {
2518
+ ref,
2519
+ className: cn("flex gap-4", className),
2520
+ role: "listitem",
2521
+ "aria-current": isActive ? "step" : void 0,
2522
+ "aria-label": `Etapa ${step}: ${label}${isCompleted ? ", concluída" : isActive ? ", atual" : ""}`,
2523
+ ...props,
2524
+ children: [
2525
+ /* @__PURE__ */ jsxs("div", { className: "flex flex-col items-center", children: [
2526
+ /* @__PURE__ */ jsx("div", { className: circleClasses, children: error ? /* @__PURE__ */ jsx(X, { className: "h-5 w-5" }) : isCompleted ? /* @__PURE__ */ jsx(Check, { className: "h-5 w-5" }) : /* @__PURE__ */ jsx("span", { children: step }) }),
2527
+ !isLast && /* @__PURE__ */ jsx(
2528
+ "div",
2529
+ {
2530
+ className: cn(
2531
+ "w-0.5 flex-1 min-h-[2rem] mt-1",
2532
+ connectorClasses(step < currentStep)
2533
+ )
2534
+ }
2535
+ )
2536
+ ] }),
2537
+ /* @__PURE__ */ jsxs("div", { className: cn("pb-6", isLast && "pb-0"), children: [
2538
+ /* @__PURE__ */ jsx(
2539
+ "div",
2540
+ {
2541
+ className: cn(
2542
+ "transition-colors",
2543
+ isActive || error ? "text-foreground" : "text-muted-foreground"
2544
+ ),
2545
+ children: label
2546
+ }
2547
+ ),
2548
+ description && /* @__PURE__ */ jsx("div", { className: "mt-1 text-xs text-muted-foreground", children: description })
2549
+ ] })
2550
+ ]
2551
+ }
2552
+ );
2553
+ }
2554
+ return /* @__PURE__ */ jsxs(
2555
+ "div",
2556
+ {
2557
+ ref,
2558
+ className: cn("flex flex-1 flex-col items-center", className),
2559
+ role: "listitem",
2560
+ "aria-current": isActive ? "step" : void 0,
2561
+ "aria-label": `Etapa ${step}: ${label}${isCompleted ? ", concluída" : isActive ? ", atual" : ""}`,
2562
+ ...props,
2563
+ children: [
2564
+ /* @__PURE__ */ jsxs("div", { className: "flex w-full items-start", children: [
2565
+ step > 1 && /* @__PURE__ */ jsx("div", { className: cn("h-0.5 flex-1 mt-[18px]", connectorClasses(step <= currentStep)) }),
2566
+ /* @__PURE__ */ jsx("div", { className: circleClasses, children: error ? /* @__PURE__ */ jsx(X, { className: "h-5 w-5" }) : isCompleted ? /* @__PURE__ */ jsx(Check, { className: "h-5 w-5" }) : /* @__PURE__ */ jsx("span", { children: step }) }),
2567
+ step < totalSteps && /* @__PURE__ */ jsx("div", { className: cn("h-0.5 flex-1 mt-[18px]", connectorClasses(step < currentStep)) })
2568
+ ] }),
2569
+ /* @__PURE__ */ jsxs(
2570
+ "div",
2571
+ {
2572
+ className: cn(
2573
+ "mt-2 px-1",
2574
+ isFirst && "text-left self-start",
2575
+ isLast && "text-right self-end",
2576
+ !isFirst && !isLast && "text-center w-full"
2577
+ ),
2578
+ children: [
2579
+ /* @__PURE__ */ jsx(
2580
+ "div",
2581
+ {
2582
+ className: cn(
2583
+ "transition-colors",
2584
+ isActive || error ? "text-foreground" : "text-muted-foreground"
2585
+ ),
2586
+ children: label
2587
+ }
2588
+ ),
2589
+ description && /* @__PURE__ */ jsx("div", { className: "mt-1 text-xs text-muted-foreground", children: description })
2590
+ ]
2591
+ }
2592
+ )
2593
+ ]
2594
+ }
2595
+ );
2596
+ }
2597
+ );
2598
+ Step.displayName = "Step";
2599
+
2600
+ function useStepper({
2601
+ totalSteps,
2602
+ initialStep = 1,
2603
+ step: controlledStep,
2604
+ onStepChange,
2605
+ onBeforeNext
2606
+ }) {
2607
+ const [internalStep, setInternalStep] = useState(
2608
+ () => Math.min(Math.max(1, initialStep), totalSteps)
2609
+ );
2610
+ const isControlled = controlledStep !== void 0;
2611
+ const currentStep = isControlled ? controlledStep : internalStep;
2612
+ const setStep = useCallback(
2613
+ (s) => {
2614
+ const clamped = Math.min(Math.max(1, s), totalSteps);
2615
+ if (!isControlled) setInternalStep(clamped);
2616
+ onStepChange?.(clamped);
2617
+ },
2618
+ [isControlled, onStepChange, totalSteps]
2619
+ );
2620
+ const isFirstStep = currentStep === 1;
2621
+ const isLastStep = currentStep === totalSteps;
2622
+ const canGoPrev = currentStep > 1;
2623
+ const canGoNext = currentStep < totalSteps;
2624
+ const next = useCallback(async () => {
2625
+ if (!canGoNext) return;
2626
+ if (onBeforeNext) {
2627
+ const allowed = await onBeforeNext(currentStep);
2628
+ if (!allowed) return;
2629
+ }
2630
+ setStep(currentStep + 1);
2631
+ }, [canGoNext, currentStep, onBeforeNext, setStep]);
2632
+ const prev = useCallback(() => {
2633
+ if (!canGoPrev) return;
2634
+ setStep(currentStep - 1);
2635
+ }, [canGoPrev, currentStep, setStep]);
2636
+ const goTo = useCallback((s) => setStep(s), [setStep]);
2637
+ const reset = useCallback(() => setStep(1), [setStep]);
2638
+ return {
2639
+ currentStep,
2640
+ totalSteps,
2641
+ isFirstStep,
2642
+ isLastStep,
2643
+ canGoPrev,
2644
+ canGoNext,
2645
+ next,
2646
+ prev,
2647
+ goTo,
2648
+ reset
2649
+ };
2650
+ }
2651
+
2652
+ function useFileUpload({
2653
+ maxFiles = 1,
2654
+ maxSize = 5 * 1024 * 1024,
2655
+ onFilesChange,
2656
+ onError,
2657
+ disabled = false
2658
+ } = {}) {
2659
+ const [files, setFiles] = useState([]);
2660
+ const [dragActive, setDragActive] = useState(false);
2661
+ const [errorMessage, setErrorMessage] = useState(null);
2662
+ const inputRef = useRef(null);
2663
+ const handleFiles = useCallback(
2664
+ (newFiles) => {
2665
+ if (!newFiles) return;
2666
+ setErrorMessage(null);
2667
+ const filesArray = Array.from(newFiles);
2668
+ const oversized = filesArray.filter((f) => f.size > maxSize);
2669
+ const validFiles = filesArray.filter((f) => f.size <= maxSize);
2670
+ if (oversized.length > 0) {
2671
+ const limitMB = (maxSize / 1024 / 1024).toFixed(0);
2672
+ setErrorMessage(
2673
+ `${oversized.length} file(s) exceed the ${limitMB}MB limit and were not added.`
2674
+ );
2675
+ onError?.(oversized, "size");
2676
+ }
2677
+ const merged = maxFiles === 1 ? validFiles.slice(0, 1) : [...files, ...validFiles].slice(0, maxFiles);
2678
+ const countRejected = maxFiles === 1 ? validFiles.slice(1) : [...files, ...validFiles].slice(maxFiles);
2679
+ if (countRejected.length > 0) {
2680
+ setErrorMessage(
2681
+ `Only ${maxFiles} file(s) allowed. ${countRejected.length} file(s) were not added.`
2682
+ );
2683
+ onError?.(countRejected, "count");
2684
+ }
2685
+ setFiles(merged);
2686
+ onFilesChange?.(merged);
2687
+ },
2688
+ // eslint-disable-next-line react-hooks/exhaustive-deps
2689
+ [files, maxFiles, maxSize, onError, onFilesChange]
2690
+ );
2691
+ const handleDrag = useCallback((e) => {
2692
+ e.preventDefault();
2693
+ e.stopPropagation();
2694
+ if (e.type === "dragenter" || e.type === "dragover") {
2695
+ setDragActive(true);
2696
+ } else if (e.type === "dragleave") {
2697
+ setDragActive(false);
2698
+ }
2699
+ }, []);
2700
+ const handleDrop = useCallback(
2701
+ (e) => {
2702
+ e.preventDefault();
2703
+ e.stopPropagation();
2704
+ setDragActive(false);
2705
+ if (disabled) return;
2706
+ handleFiles(e.dataTransfer.files);
2707
+ },
2708
+ [disabled, handleFiles]
2709
+ );
2710
+ const handleChange = useCallback(
2711
+ (e) => {
2712
+ e.preventDefault();
2713
+ if (disabled) return;
2714
+ handleFiles(e.target.files);
2715
+ },
2716
+ [disabled, handleFiles]
2717
+ );
2718
+ const removeFile = useCallback(
2719
+ (index) => {
2720
+ setFiles((prev) => {
2721
+ const updated = prev.filter((_, i) => i !== index);
2722
+ onFilesChange?.(updated);
2723
+ if (updated.length === 0) setErrorMessage(null);
2724
+ return updated;
2725
+ });
2726
+ },
2727
+ [onFilesChange]
2728
+ );
2729
+ const openFileDialog = useCallback(() => {
2730
+ if (!disabled) {
2731
+ setErrorMessage(null);
2732
+ inputRef.current?.click();
2733
+ }
2734
+ }, [disabled]);
2735
+ return {
2736
+ files,
2737
+ dragActive,
2738
+ errorMessage,
2739
+ inputRef,
2740
+ handleFiles,
2741
+ handleDrag,
2742
+ handleDrop,
2743
+ handleChange,
2744
+ removeFile,
2745
+ openFileDialog
2746
+ };
2747
+ }
2748
+
2749
+ const FileUpload = React.forwardRef(
2750
+ ({
2751
+ className,
2752
+ onFilesChange,
2753
+ maxFiles = 1,
2754
+ maxSize = 5 * 1024 * 1024,
2755
+ // 5MB default
2756
+ showPreview = true,
2757
+ onError,
2758
+ accept,
2759
+ disabled,
2760
+ ...props
2761
+ }, ref) => {
2762
+ const {
2763
+ files,
2764
+ dragActive,
2765
+ errorMessage,
2766
+ inputRef,
2767
+ handleDrag,
2768
+ handleDrop,
2769
+ handleChange,
2770
+ removeFile,
2771
+ openFileDialog
2772
+ } = useFileUpload({ maxFiles, maxSize, onFilesChange, onError, disabled });
2773
+ return /* @__PURE__ */ jsxs("div", { ref, className: cn("w-full", className), children: [
2774
+ /* @__PURE__ */ jsxs(
2775
+ "div",
2776
+ {
2777
+ onDragEnter: handleDrag,
2778
+ onDragLeave: handleDrag,
2779
+ onDragOver: handleDrag,
2780
+ onDrop: handleDrop,
2781
+ onClick: openFileDialog,
2782
+ className: cn(
2783
+ "relative flex cursor-pointer flex-col items-center justify-center rounded-[var(--radius)] border-2 border-dashed border-border bg-background p-8 transition-colors hover:bg-muted/50",
2784
+ dragActive && "border-primary bg-primary/5",
2785
+ errorMessage && "border-destructive/50",
2786
+ disabled && "cursor-not-allowed opacity-50"
2787
+ ),
2788
+ children: [
2789
+ /* @__PURE__ */ jsx(Upload, { className: "mb-4 h-10 w-10 text-muted-foreground" }),
2790
+ /* @__PURE__ */ jsxs("p", { className: "mb-2 text-foreground", children: [
2791
+ /* @__PURE__ */ jsx("span", { className: "text-primary", children: "Click to upload" }),
2792
+ " or drag and drop"
2793
+ ] }),
2794
+ /* @__PURE__ */ jsxs("p", { className: "text-muted-foreground", children: [
2795
+ maxFiles > 1 ? `Up to ${maxFiles} files` : "1 file",
2796
+ " • Max",
2797
+ " ",
2798
+ (maxSize / 1024 / 1024).toFixed(0),
2799
+ "MB"
2800
+ ] }),
2801
+ /* @__PURE__ */ jsx(
2802
+ "input",
2803
+ {
2804
+ ...props,
2805
+ ref: inputRef,
2806
+ type: "file",
2807
+ className: "hidden",
2808
+ onChange: handleChange,
2809
+ multiple: maxFiles > 1,
2810
+ accept,
2811
+ disabled
2812
+ }
2813
+ )
2814
+ ]
2815
+ }
2816
+ ),
2817
+ errorMessage && /* @__PURE__ */ jsxs("div", { className: "mt-2 flex items-center gap-2 rounded-[var(--radius)] border border-destructive/30 bg-destructive/5 px-3 py-2 text-sm text-destructive", children: [
2818
+ /* @__PURE__ */ jsx(AlertCircle, { className: "h-4 w-4 shrink-0" }),
2819
+ /* @__PURE__ */ jsx("span", { children: errorMessage })
2820
+ ] }),
2821
+ showPreview && files.length > 0 && /* @__PURE__ */ jsx("div", { className: "mt-4 space-y-2", children: files.map((file, index) => /* @__PURE__ */ jsxs(
2822
+ "div",
2823
+ {
2824
+ className: "flex items-center justify-between rounded-[var(--radius)] border border-border bg-card p-3",
2825
+ children: [
2826
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-3", children: [
2827
+ /* @__PURE__ */ jsx(FileIcon, { className: "h-5 w-5 text-muted-foreground" }),
2828
+ /* @__PURE__ */ jsxs("div", { children: [
2829
+ /* @__PURE__ */ jsx("p", { className: "text-foreground", children: file.name }),
2830
+ /* @__PURE__ */ jsxs("p", { className: "text-muted-foreground", children: [
2831
+ (file.size / 1024).toFixed(2),
2832
+ " KB"
2833
+ ] })
2834
+ ] })
2835
+ ] }),
2836
+ /* @__PURE__ */ jsx(
2837
+ Button,
2838
+ {
2839
+ type: "button",
2840
+ variant: "ghost",
2841
+ size: "sm",
2842
+ onClick: (e) => {
2843
+ e.stopPropagation();
2844
+ removeFile(index);
2845
+ },
2846
+ disabled,
2847
+ children: /* @__PURE__ */ jsx(X, { className: "h-4 w-4" })
2848
+ }
2849
+ )
2850
+ ]
2851
+ },
2852
+ index
2853
+ )) })
2854
+ ] });
2855
+ }
2856
+ );
2857
+ FileUpload.displayName = "FileUpload";
2858
+
2859
+ const Rating = React.forwardRef(
2860
+ ({
2861
+ className,
2862
+ value = 0,
2863
+ onChange,
2864
+ max = 5,
2865
+ readonly = false,
2866
+ disabled = false,
2867
+ size = "md",
2868
+ showValue = false,
2869
+ allowHalf = false,
2870
+ getAriaLabel,
2871
+ ...props
2872
+ }, ref) => {
2873
+ const [hoverValue, setHoverValue] = React.useState(null);
2874
+ const isInteractive = !readonly && !disabled;
2875
+ const sizeStyles = {
2876
+ sm: "h-4 w-4",
2877
+ md: "h-5 w-5",
2878
+ lg: "h-6 w-6"
2879
+ };
2880
+ const handleClick = (rating) => {
2881
+ if (isInteractive) onChange?.(rating);
2882
+ };
2883
+ const handleMouseMove = (e, rating) => {
2884
+ if (!isInteractive) return;
2885
+ if (allowHalf) {
2886
+ const rect = e.currentTarget.getBoundingClientRect();
2887
+ setHoverValue(e.clientX - rect.left < rect.width / 2 ? rating - 0.5 : rating);
2888
+ } else {
2889
+ setHoverValue(rating);
2890
+ }
2891
+ };
2892
+ const handleMouseLeave = () => {
2893
+ if (isInteractive) setHoverValue(null);
2894
+ };
2895
+ const handleClickWithHalf = (e, rating) => {
2896
+ if (!isInteractive) return;
2897
+ if (allowHalf) {
2898
+ const rect = e.currentTarget.getBoundingClientRect();
2899
+ const half = e.clientX - rect.left < rect.width / 2 ? rating - 0.5 : rating;
2900
+ onChange?.(half);
2901
+ } else {
2902
+ handleClick(rating);
2903
+ }
2904
+ };
2905
+ const displayValue = hoverValue ?? value;
2906
+ return /* @__PURE__ */ jsxs(
2907
+ "div",
2908
+ {
2909
+ ref,
2910
+ className: cn("flex items-center gap-1", disabled && "opacity-50", className),
2911
+ ...props,
2912
+ children: [
2913
+ /* @__PURE__ */ jsx("div", { className: "flex items-center gap-0.5", role: "group", "aria-label": "Rating", children: Array.from({ length: max }, (_, index) => {
2914
+ const rating = index + 1;
2915
+ const isFull = rating <= displayValue;
2916
+ const isHalf = allowHalf && !isFull && rating - 0.5 <= displayValue;
2917
+ return /* @__PURE__ */ jsxs(
2918
+ "button",
2919
+ {
2920
+ type: "button",
2921
+ onClick: (e) => handleClickWithHalf(e, rating),
2922
+ onMouseMove: (e) => handleMouseMove(e, rating),
2923
+ onMouseLeave: handleMouseLeave,
2924
+ disabled: readonly || disabled,
2925
+ "aria-label": getAriaLabel ? getAriaLabel(rating, max) : `${rating} / ${max}`,
2926
+ className: cn(
2927
+ "relative transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
2928
+ isInteractive && "cursor-pointer hover:scale-110",
2929
+ !isInteractive && "cursor-default"
2930
+ ),
2931
+ children: [
2932
+ /* @__PURE__ */ jsx(Star, { className: cn(sizeStyles[size], "fill-none text-muted-foreground") }),
2933
+ (isFull || isHalf) && /* @__PURE__ */ jsx(
2934
+ "span",
2935
+ {
2936
+ className: cn("absolute inset-0 overflow-hidden", isHalf ? "w-1/2" : "w-full"),
2937
+ children: /* @__PURE__ */ jsx(Star, { className: cn(sizeStyles[size], "fill-warning text-warning") })
2938
+ }
2939
+ )
2940
+ ]
2941
+ },
2942
+ index
2943
+ );
2944
+ }) }),
2945
+ showValue && /* @__PURE__ */ jsx("span", { className: "ml-2 text-sm text-muted-foreground", children: value % 1 === 0 ? value.toFixed(0) : value.toFixed(1) })
2946
+ ]
2947
+ }
2948
+ );
2949
+ }
2950
+ );
2951
+ Rating.displayName = "Rating";
2952
+
2953
+ const Search = React.forwardRef(
2954
+ ({
2955
+ className,
2956
+ containerClassName,
2957
+ onSearch,
2958
+ onClear,
2959
+ onChange,
2960
+ size = "md",
2961
+ searchLabel = "Search",
2962
+ clearLabel = "Clear search",
2963
+ value: controlledValue,
2964
+ defaultValue,
2965
+ ...props
2966
+ }, ref) => {
2967
+ const isControlled = controlledValue !== void 0;
2968
+ const [internalValue, setInternalValue] = React.useState(
2969
+ isControlled ? "" : defaultValue ?? ""
2970
+ );
2971
+ const displayValue = isControlled ? controlledValue : internalValue;
2972
+ const sizeClasses = {
2973
+ sm: "h-8 px-8 py-1 text-sm",
2974
+ md: "h-10 px-10 py-2 text-base",
2975
+ lg: "h-12 px-12 py-3 text-base"
2976
+ };
2977
+ const iconSizeClasses = {
2978
+ sm: "left-2 h-3.5 w-3.5",
2979
+ md: "left-3 h-4 w-4",
2980
+ lg: "left-4 h-5 w-5"
2981
+ };
2982
+ const clearSizeClasses = {
2983
+ sm: "right-2",
2984
+ md: "right-3",
2985
+ lg: "right-4"
2986
+ };
2987
+ const handleChange = (e) => {
2988
+ const newValue = e.target.value;
2989
+ if (!isControlled) setInternalValue(newValue);
2990
+ onChange?.(e);
2991
+ onSearch?.(newValue);
2992
+ };
2993
+ const handleClear = () => {
2994
+ if (!isControlled) setInternalValue("");
2995
+ onClear?.();
2996
+ onSearch?.("");
2997
+ };
2998
+ const handleKeyDown = (e) => {
2999
+ if (e.key === "Escape") {
3000
+ handleClear();
3001
+ }
3002
+ props.onKeyDown?.(e);
3003
+ };
3004
+ return /* @__PURE__ */ jsxs("div", { className: cn("relative w-full", containerClassName), children: [
3005
+ /* @__PURE__ */ jsx(
3006
+ Search$1,
3007
+ {
3008
+ "aria-hidden": "true",
3009
+ className: cn(
3010
+ "absolute top-1/2 -translate-y-1/2 text-muted-foreground",
3011
+ iconSizeClasses[size]
3012
+ )
3013
+ }
3014
+ ),
3015
+ /* @__PURE__ */ jsx(
3016
+ "input",
3017
+ {
3018
+ ref,
3019
+ type: "text",
3020
+ value: displayValue,
3021
+ onChange: handleChange,
3022
+ onKeyDown: handleKeyDown,
3023
+ className: cn(
3024
+ "flex w-full rounded-[var(--radius)] border border-border bg-background text-foreground transition-colors outline-none",
3025
+ "placeholder:text-muted-foreground",
3026
+ "focus:ring-2 focus:ring-primary focus:border-transparent",
3027
+ "disabled:cursor-not-allowed disabled:opacity-50",
3028
+ sizeClasses[size],
3029
+ className
3030
+ ),
3031
+ "aria-label": props.placeholder || searchLabel,
3032
+ ...props
3033
+ }
3034
+ ),
3035
+ displayValue && /* @__PURE__ */ jsx(
3036
+ "button",
3037
+ {
3038
+ type: "button",
3039
+ onClick: handleClear,
3040
+ "aria-label": clearLabel,
3041
+ className: cn(
3042
+ "absolute top-1/2 -translate-y-1/2 text-muted-foreground transition-colors hover:text-foreground focus:outline-none",
3043
+ clearSizeClasses[size]
3044
+ ),
3045
+ children: /* @__PURE__ */ jsx(X, { className: "h-4 w-4" })
3046
+ }
3047
+ )
3048
+ ] });
3049
+ }
3050
+ );
3051
+ Search.displayName = "Search";
3052
+
3053
+ const __vite_import_meta_env__ = {"BASE_URL": "/", "DEV": false, "MODE": "production", "PROD": true, "SSR": false, "VITE_GEMINI_API_KEY": "AIzaSyBnoWKe4LjQzlIklON_dVXMXNUl2gvfH6U", "VITE_GOOGLE_MAPS_API_KEY": "AIzaSyCj19NndSgZOb8057q24UbJtSsfVJiyVdo"};
3054
+ const RouteMapContent = React__default.forwardRef(
3055
+ ({ apiKey, ...props }, ref) => {
3056
+ const { isLoaded, loadError, load } = useGoogleMapsLoader();
3057
+ const {
3058
+ origin,
3059
+ destination,
3060
+ waypoints = [],
3061
+ travelMode = "DRIVING",
3062
+ height = "450px",
3063
+ mapContainerClassName,
3064
+ disableDefaultUI = false,
3065
+ zoomControl = true,
3066
+ streetViewControl = false,
3067
+ mapTypeControl = false,
3068
+ fullscreenControl = true,
3069
+ onRouteCalculated,
3070
+ className,
3071
+ ...divProps
3072
+ } = props;
3073
+ const mapRef = useRef(null);
3074
+ const gmpMapRef = useRef(null);
3075
+ const directionsRendererRef = useRef(null);
3076
+ useRef(false);
3077
+ const isCalculatingRef = useRef(false);
3078
+ useEffect(() => {
3079
+ if (!isLoaded && apiKey && !loadError && load) {
3080
+ load(apiKey).catch(console.error);
3081
+ }
3082
+ }, [isLoaded, apiKey, loadError, load]);
3083
+ useEffect(() => {
3084
+ if (!isLoaded || !gmpMapRef.current) return;
3085
+ const setupMap = (map) => {
3086
+ mapRef.current = map;
3087
+ const computedStyle = getComputedStyle(document.documentElement);
3088
+ const primaryColor = computedStyle.getPropertyValue("--primary").trim() || "#4F46E5";
3089
+ if (!directionsRendererRef.current) {
3090
+ directionsRendererRef.current = new google.maps.DirectionsRenderer({
3091
+ map,
3092
+ suppressMarkers: false,
3093
+ polylineOptions: {
3094
+ strokeColor: primaryColor,
3095
+ strokeWeight: 5,
3096
+ strokeOpacity: 0.8
3097
+ }
3098
+ });
3099
+ } else {
3100
+ directionsRendererRef.current.setMap(map);
3101
+ }
3102
+ };
3103
+ const gmpMap = gmpMapRef.current;
3104
+ if (gmpMap.innerMap) {
3105
+ setupMap(gmpMap.innerMap);
3106
+ } else {
3107
+ const interval = setInterval(() => {
3108
+ if (gmpMap.innerMap) {
3109
+ setupMap(gmpMap.innerMap);
3110
+ clearInterval(interval);
3111
+ }
3112
+ }, 100);
3113
+ return () => clearInterval(interval);
3114
+ }
3115
+ return () => {
3116
+ if (directionsRendererRef.current) {
3117
+ directionsRendererRef.current.setMap(null);
3118
+ }
3119
+ mapRef.current = null;
3120
+ };
3121
+ }, [isLoaded]);
3122
+ useEffect(() => {
3123
+ if (gmpMapRef.current && origin) {
3124
+ gmpMapRef.current.center = origin;
3125
+ }
3126
+ }, [origin.lat, origin.lng]);
3127
+ useEffect(() => {
3128
+ if (gmpMapRef.current) {
3129
+ gmpMapRef.current.zoom = 13;
3130
+ }
3131
+ }, []);
3132
+ useEffect(() => {
3133
+ const map = mapRef.current;
3134
+ const renderer = directionsRendererRef.current;
3135
+ if (!map || !renderer || !isLoaded || isCalculatingRef.current) return;
3136
+ if (!origin || !destination) return;
3137
+ isCalculatingRef.current = true;
3138
+ const directionsService = new google.maps.DirectionsService();
3139
+ const request = {
3140
+ origin,
3141
+ destination,
3142
+ waypoints: waypoints.map((wp) => ({
3143
+ location: wp,
3144
+ stopover: true
3145
+ })),
3146
+ travelMode: google.maps.TravelMode[travelMode]
3147
+ };
3148
+ directionsService.route(request, (result, status) => {
3149
+ isCalculatingRef.current = false;
3150
+ if (status === "OK" && result) {
3151
+ renderer.setDirections(result);
3152
+ const route = result.routes[0];
3153
+ if (route?.legs?.length > 0 && onRouteCalculated) {
3154
+ let totalDistance = 0;
3155
+ let totalDuration = 0;
3156
+ route.legs.forEach((leg) => {
3157
+ if (leg.distance) totalDistance += leg.distance.value;
3158
+ if (leg.duration) totalDuration += leg.duration.value;
3159
+ });
3160
+ const distanceKm = (totalDistance / 1e3).toFixed(1);
3161
+ const distanceText = `${distanceKm} km`;
3162
+ const hours = Math.floor(totalDuration / 3600);
3163
+ const minutes = Math.floor(totalDuration % 3600 / 60);
3164
+ const durationText = hours > 0 ? `${hours}h ${minutes}min` : `${minutes} min`;
3165
+ onRouteCalculated(distanceText, durationText);
3166
+ }
3167
+ }
3168
+ });
3169
+ }, [
3170
+ isLoaded,
3171
+ origin.lat,
3172
+ origin.lng,
3173
+ destination.lat,
3174
+ destination.lng,
3175
+ travelMode,
3176
+ mapRef.current
3177
+ ]);
3178
+ if (loadError) {
3179
+ return /* @__PURE__ */ jsx(
3180
+ "div",
3181
+ {
3182
+ ref,
3183
+ className: cn(
3184
+ "relative rounded-[var(--radius-card)] border border-destructive/50 overflow-hidden bg-destructive/5",
3185
+ className
3186
+ ),
3187
+ style: { height },
3188
+ ...divProps,
3189
+ children: /* @__PURE__ */ jsx("div", { className: "absolute inset-0 flex items-center justify-center", children: /* @__PURE__ */ jsxs("div", { className: "text-center space-y-2 p-6", children: [
3190
+ /* @__PURE__ */ jsx("div", { className: "text-destructive", children: /* @__PURE__ */ jsx(
3191
+ "svg",
3192
+ {
3193
+ className: "w-12 h-12 mx-auto",
3194
+ fill: "none",
3195
+ stroke: "currentColor",
3196
+ viewBox: "0 0 24 24",
3197
+ children: /* @__PURE__ */ jsx(
3198
+ "path",
3199
+ {
3200
+ strokeLinecap: "round",
3201
+ strokeLinejoin: "round",
3202
+ strokeWidth: 2,
3203
+ d: "M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"
3204
+ }
3205
+ )
3206
+ }
3207
+ ) }),
3208
+ /* @__PURE__ */ jsx("p", { className: "text-sm font-medium text-foreground", children: "Failed to load Google Maps" }),
3209
+ /* @__PURE__ */ jsx("p", { className: "text-xs text-muted-foreground", children: "Check API key in Settings" })
3210
+ ] }) })
3211
+ }
3212
+ );
3213
+ }
3214
+ if (!isLoaded) {
3215
+ return /* @__PURE__ */ jsx(
3216
+ "div",
3217
+ {
3218
+ ref,
3219
+ className: cn(
3220
+ "relative rounded-[var(--radius-card)] border border-border overflow-hidden bg-muted animate-pulse",
3221
+ className
3222
+ ),
3223
+ style: { height },
3224
+ ...divProps
3225
+ }
3226
+ );
3227
+ }
3228
+ return /* @__PURE__ */ jsx(
3229
+ "div",
3230
+ {
3231
+ ref,
3232
+ className: cn(
3233
+ "relative rounded-[var(--radius-card)] border border-border overflow-hidden",
3234
+ className
3235
+ ),
3236
+ style: { height },
3237
+ ...divProps,
3238
+ children: /* @__PURE__ */ jsx(
3239
+ "gmp-map",
3240
+ {
3241
+ ref: gmpMapRef,
3242
+ style: { height: "100%", width: "100%", display: "block" },
3243
+ "map-id": props.mapId || "xertica-route-map"
3244
+ }
3245
+ )
3246
+ }
3247
+ );
3248
+ }
3249
+ );
3250
+ RouteMapContent.displayName = "RouteMapContent";
3251
+ const RouteMap = React__default.forwardRef((props, ref) => {
3252
+ const { isLoaded, loadError } = useGoogleMapsLoader();
3253
+ const effectiveApiKey = props.apiKey || typeof import.meta !== "undefined" && __vite_import_meta_env__ && "AIzaSyCj19NndSgZOb8057q24UbJtSsfVJiyVdo" || "";
3254
+ const isValidKey = effectiveApiKey && effectiveApiKey !== "YOUR_GOOGLE_MAPS_API_KEY_HERE" && effectiveApiKey.startsWith("AIza");
3255
+ if (isLoaded || isValidKey || loadError) {
3256
+ return /* @__PURE__ */ jsx(RouteMapContent, { ref, ...props, apiKey: effectiveApiKey });
3257
+ }
3258
+ const isScriptInjected = typeof document !== "undefined" && !!document.querySelector('script[src*="maps.googleapis.com/maps/api/js"]');
3259
+ if (isScriptInjected) {
3260
+ return /* @__PURE__ */ jsx(RouteMapContent, { ref, ...props, apiKey: effectiveApiKey });
3261
+ }
3262
+ const {
3263
+ origin,
3264
+ destination,
3265
+ waypoints,
3266
+ travelMode,
3267
+ height,
3268
+ apiKey,
3269
+ mapContainerClassName,
3270
+ disableDefaultUI,
3271
+ zoomControl,
3272
+ streetViewControl,
3273
+ mapTypeControl,
3274
+ fullscreenControl,
3275
+ onRouteCalculated,
3276
+ ...divProps
3277
+ } = props;
3278
+ return /* @__PURE__ */ jsx(
3279
+ "div",
3280
+ {
3281
+ ref,
3282
+ className: cn(
3283
+ "relative rounded-[var(--radius-card)] border border-border overflow-hidden bg-muted",
3284
+ props.className
3285
+ ),
3286
+ style: { height: props.height || "450px" },
3287
+ ...divProps,
3288
+ children: /* @__PURE__ */ jsx("div", { className: "absolute inset-0 flex items-center justify-center bg-gradient-to-br from-muted/50 to-muted", children: /* @__PURE__ */ jsxs("div", { className: "text-center space-y-3 p-6", children: [
3289
+ /* @__PURE__ */ jsx("div", { className: "w-16 h-16 mx-auto bg-primary/10 rounded-full flex items-center justify-center", children: /* @__PURE__ */ jsxs(
3290
+ "svg",
3291
+ {
3292
+ className: "w-8 h-8 text-primary",
3293
+ fill: "none",
3294
+ stroke: "currentColor",
3295
+ viewBox: "0 0 24 24",
3296
+ children: [
3297
+ /* @__PURE__ */ jsx(
3298
+ "path",
3299
+ {
3300
+ strokeLinecap: "round",
3301
+ strokeLinejoin: "round",
3302
+ strokeWidth: 2,
3303
+ d: "M17.657 16.657L13.414 20.9a1.998 1.998 0 01-2.827 0l-4.244-4.243a8 8 0 1111.314 0z"
3304
+ }
3305
+ ),
3306
+ /* @__PURE__ */ jsx(
3307
+ "path",
3308
+ {
3309
+ strokeLinecap: "round",
3310
+ strokeLinejoin: "round",
3311
+ strokeWidth: 2,
3312
+ d: "M15 11a3 3 0 11-6 0 3 3 0 016 0z"
3313
+ }
3314
+ )
3315
+ ]
3316
+ }
3317
+ ) }),
3318
+ /* @__PURE__ */ jsx("p", { className: "text-sm text-muted-foreground", children: "Configure Google Maps API Key in Settings" })
3319
+ ] }) })
3320
+ }
3321
+ );
3322
+ });
3323
+ RouteMap.displayName = "RouteMap";
3324
+
3325
+ const SimpleMap = React__default.forwardRef(
3326
+ ({
3327
+ center,
3328
+ address,
3329
+ markerTitle,
3330
+ markerInfo,
3331
+ showMarker = true,
3332
+ zoom = 15,
3333
+ height = "350px",
3334
+ ...props
3335
+ }, ref) => {
3336
+ const markers = showMarker && center ? [
3337
+ {
3338
+ position: center,
3339
+ title: markerTitle || address || "Location",
3340
+ info: markerInfo || address
3341
+ }
3342
+ ] : [];
3343
+ return /* @__PURE__ */ jsx(Map$1, { ref, center, zoom, height, markers, ...props });
3344
+ }
3345
+ );
3346
+ SimpleMap.displayName = "SimpleMap";
3347
+
3348
+ function AssistantChart({
3349
+ data,
3350
+ config,
3351
+ categoryKey = "month",
3352
+ bars,
3353
+ xAxisFormatter,
3354
+ className
3355
+ }) {
3356
+ const resolvedBars = bars ?? Object.keys(config).map((key) => ({ dataKey: key }));
3357
+ const formatTick = xAxisFormatter ?? ((value) => value.slice(0, 3));
3358
+ return /* @__PURE__ */ jsx(ChartContainer, { config, className: cn("min-h-[200px] w-full", className), children: /* @__PURE__ */ jsxs(BarChart, { accessibilityLayer: true, data, children: [
3359
+ /* @__PURE__ */ jsx(CartesianGrid, { vertical: false }),
3360
+ /* @__PURE__ */ jsx(
3361
+ XAxis,
3362
+ {
3363
+ dataKey: categoryKey,
3364
+ tickLine: false,
3365
+ tickMargin: 10,
3366
+ axisLine: false,
3367
+ tickFormatter: formatTick
3368
+ }
3369
+ ),
3370
+ /* @__PURE__ */ jsx(ChartTooltip, { cursor: false, content: /* @__PURE__ */ jsx(ChartTooltipContent, { indicator: "dashed" }) }),
3371
+ resolvedBars.map((bar) => /* @__PURE__ */ jsx(
3372
+ Bar,
3373
+ {
3374
+ dataKey: bar.dataKey,
3375
+ fill: bar.fill ?? `var(--color-${bar.dataKey})`,
3376
+ radius: bar.radius ?? 4
3377
+ },
3378
+ bar.dataKey
3379
+ ))
3380
+ ] }) });
3381
+ }
3382
+
3383
+ export { FormControl as $, Accordion as A, ContextMenuGroup as B, Calendar as C, ContextMenuItem as D, ContextMenuLabel as E, ContextMenuPortal as F, ContextMenuRadioGroup as G, ContextMenuRadioItem as H, ContextMenuSeparator as I, ContextMenuShortcut as J, ContextMenuSub as K, ContextMenuSubContent as L, ContextMenuSubTrigger as M, ContextMenuTrigger as N, Drawer as O, DrawerClose as P, DrawerContent as Q, DrawerDescription as R, DrawerFooter as S, DrawerHandle as T, DrawerHeader as U, DrawerOverlay as V, DrawerPortal as W, DrawerTitle as X, DrawerTrigger as Y, FileUpload as Z, Form as _, AccordionContent as a, Step as a$, FormDescription as a0, FormField as a1, FormItem as a2, FormLabel as a3, FormMessage as a4, HoverCard as a5, HoverCardContent as a6, HoverCardTrigger as a7, InputOTP as a8, InputOTPGroup as a9, NotificationBadge as aA, Pagination as aB, PaginationContent as aC, PaginationEllipsis as aD, PaginationItem as aE, PaginationLink as aF, PaginationNext as aG, PaginationPrevious as aH, Rating as aI, ResizableHandle as aJ, ResizablePanel as aK, ResizablePanelGroup as aL, RouteMap as aM, Search as aN, Sheet as aO, SheetBody as aP, SheetClose as aQ, SheetContent as aR, SheetDescription as aS, SheetFooter as aT, SheetHeader as aU, SheetPortal as aV, SheetTitle as aW, SheetTrigger as aX, SimpleMap as aY, StatsCard as aZ, StatsCardSkeleton as a_, InputOTPSeparator as aa, InputOTPSlot as ab, Menubar as ac, MenubarCheckboxItem as ad, MenubarContent as ae, MenubarGroup as af, MenubarItem as ag, MenubarLabel as ah, MenubarMenu as ai, MenubarPortal as aj, MenubarRadioGroup as ak, MenubarRadioItem as al, MenubarSeparator as am, MenubarShortcut as an, MenubarSub as ao, MenubarSubContent as ap, MenubarSubTrigger as aq, MenubarTrigger as ar, NavigationMenu as as, NavigationMenuContent as at, NavigationMenuIndicator as au, NavigationMenuItem as av, NavigationMenuLink as aw, NavigationMenuList as ax, NavigationMenuTrigger as ay, NavigationMenuViewport as az, AccordionItem as b, Stepper as b0, Timeline as b1, TimelineContent as b2, TimelineDescription as b3, TimelineDot as b4, TimelineHeading as b5, TimelineItem as b6, TimelineTime as b7, Toggle as b8, ToggleGroup as b9, ToggleGroupItem as ba, TreeView as bb, navigationMenuTriggerStyle as bc, toggleVariants as bd, useFileUpload as be, useFormField as bf, usePagination as bg, useStepper as bh, useStepperContext as bi, useTreeView as bj, AccordionTrigger as c, AspectRatio as d, AssistantChart as e, CalendarDayButton as f, Carousel as g, CarouselContent as h, CarouselItem as i, CarouselNext as j, CarouselPrevious as k, Collapsible as l, CollapsibleContent as m, CollapsibleTrigger as n, Command as o, CommandDialog as p, CommandEmpty as q, CommandGroup as r, CommandInput as s, CommandItem as t, CommandList as u, CommandSeparator as v, CommandShortcut as w, ContextMenu as x, ContextMenuCheckboxItem as y, ContextMenuContent as z };