@northslopetech/altitude-ui 2.6.4 → 2.7.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.
package/dist/index.mjs CHANGED
@@ -1721,6 +1721,124 @@ var Panel = ({
1721
1721
  )
1722
1722
  }
1723
1723
  );
1724
+ var ZoomIn = ({
1725
+ className,
1726
+ variant = "dark",
1727
+ ...props
1728
+ }) => /* @__PURE__ */ jsxs2(
1729
+ "svg",
1730
+ {
1731
+ width: "16",
1732
+ height: "16",
1733
+ viewBox: "0 0 16 16",
1734
+ fill: "none",
1735
+ xmlns: "http://www.w3.org/2000/svg",
1736
+ className: cn(getVariantStyles(variant), className),
1737
+ ...props,
1738
+ children: [
1739
+ /* @__PURE__ */ jsx2(
1740
+ "circle",
1741
+ {
1742
+ cx: "6.5",
1743
+ cy: "6.5",
1744
+ r: "4.5",
1745
+ stroke: "currentColor",
1746
+ strokeWidth: "1.5",
1747
+ fill: "none"
1748
+ }
1749
+ ),
1750
+ /* @__PURE__ */ jsx2(
1751
+ "line",
1752
+ {
1753
+ x1: "10",
1754
+ y1: "10",
1755
+ x2: "14",
1756
+ y2: "14",
1757
+ stroke: "currentColor",
1758
+ strokeWidth: "1.5",
1759
+ strokeLinecap: "round"
1760
+ }
1761
+ ),
1762
+ /* @__PURE__ */ jsx2(
1763
+ "line",
1764
+ {
1765
+ x1: "4.5",
1766
+ y1: "6.5",
1767
+ x2: "8.5",
1768
+ y2: "6.5",
1769
+ stroke: "currentColor",
1770
+ strokeWidth: "1.5",
1771
+ strokeLinecap: "round"
1772
+ }
1773
+ ),
1774
+ /* @__PURE__ */ jsx2(
1775
+ "line",
1776
+ {
1777
+ x1: "6.5",
1778
+ y1: "4.5",
1779
+ x2: "6.5",
1780
+ y2: "8.5",
1781
+ stroke: "currentColor",
1782
+ strokeWidth: "1.5",
1783
+ strokeLinecap: "round"
1784
+ }
1785
+ )
1786
+ ]
1787
+ }
1788
+ );
1789
+ var ZoomOut = ({
1790
+ className,
1791
+ variant = "dark",
1792
+ ...props
1793
+ }) => /* @__PURE__ */ jsxs2(
1794
+ "svg",
1795
+ {
1796
+ width: "16",
1797
+ height: "16",
1798
+ viewBox: "0 0 16 16",
1799
+ fill: "none",
1800
+ xmlns: "http://www.w3.org/2000/svg",
1801
+ className: cn(getVariantStyles(variant), className),
1802
+ ...props,
1803
+ children: [
1804
+ /* @__PURE__ */ jsx2(
1805
+ "circle",
1806
+ {
1807
+ cx: "6.5",
1808
+ cy: "6.5",
1809
+ r: "4.5",
1810
+ stroke: "currentColor",
1811
+ strokeWidth: "1.5",
1812
+ fill: "none"
1813
+ }
1814
+ ),
1815
+ /* @__PURE__ */ jsx2(
1816
+ "line",
1817
+ {
1818
+ x1: "10",
1819
+ y1: "10",
1820
+ x2: "14",
1821
+ y2: "14",
1822
+ stroke: "currentColor",
1823
+ strokeWidth: "1.5",
1824
+ strokeLinecap: "round"
1825
+ }
1826
+ ),
1827
+ /* @__PURE__ */ jsx2(
1828
+ "line",
1829
+ {
1830
+ x1: "4.5",
1831
+ y1: "6.5",
1832
+ x2: "8.5",
1833
+ y2: "6.5",
1834
+ stroke: "currentColor",
1835
+ strokeWidth: "1.5",
1836
+ strokeLinecap: "round"
1837
+ }
1838
+ )
1839
+ ]
1840
+ }
1841
+ );
1724
1842
 
1725
1843
  // src/components/ui/select.tsx
1726
1844
  import { jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
@@ -3215,103 +3333,588 @@ var Badge = React11.forwardRef(
3215
3333
  Badge.displayName = "Badge";
3216
3334
 
3217
3335
  // src/components/pdf-viewer/index.tsx
3218
- import * as React16 from "react";
3336
+ import * as React19 from "react";
3219
3337
  import "react-pdf/dist/Page/TextLayer.css";
3220
3338
 
3221
- // src/components/pdf-viewer/components/PdfDocument.tsx
3339
+ // src/components/pdf-viewer/components/CustomScrollbar.tsx
3222
3340
  import * as React12 from "react";
3341
+ import { Fragment, jsx as jsx15, jsxs as jsxs10 } from "react/jsx-runtime";
3342
+ var scrollbarStyles = `
3343
+ .custom-scrollbar-content {
3344
+ overflow: auto;
3345
+ scrollbar-width: none;
3346
+ -ms-overflow-style: none;
3347
+ }
3348
+ .custom-scrollbar-content::-webkit-scrollbar {
3349
+ width: 0;
3350
+ height: 0;
3351
+ display: none;
3352
+ }
3353
+ .custom-scrollbar-wrapper {
3354
+ position: relative;
3355
+ }
3356
+ .custom-scrollbar-wrapper .scrollbar-track-vertical {
3357
+ position: absolute;
3358
+ top: 0;
3359
+ right: 0;
3360
+ width: 8px;
3361
+ height: 100%;
3362
+ pointer-events: none;
3363
+ z-index: 10;
3364
+ }
3365
+ .custom-scrollbar-wrapper .scrollbar-track-horizontal {
3366
+ position: absolute;
3367
+ bottom: 0;
3368
+ left: 0;
3369
+ width: 100%;
3370
+ height: 8px;
3371
+ pointer-events: none;
3372
+ z-index: 10;
3373
+ }
3374
+ .custom-scrollbar-wrapper .scrollbar-thumb-vertical {
3375
+ position: absolute;
3376
+ right: 0;
3377
+ width: 8px;
3378
+ border-radius: 4px;
3379
+ background: rgba(102, 102, 102, 0);
3380
+ transition: background 0.3s ease;
3381
+ pointer-events: auto;
3382
+ cursor: default;
3383
+ }
3384
+ .custom-scrollbar-wrapper .scrollbar-thumb-horizontal {
3385
+ position: absolute;
3386
+ bottom: 0;
3387
+ height: 8px;
3388
+ border-radius: 4px;
3389
+ background: rgba(102, 102, 102, 0);
3390
+ transition: background 0.3s ease;
3391
+ pointer-events: auto;
3392
+ cursor: default;
3393
+ }
3394
+ .custom-scrollbar-wrapper.scrolling-vertical .scrollbar-thumb-vertical {
3395
+ background: rgba(102, 102, 102, 0.7);
3396
+ }
3397
+ .custom-scrollbar-wrapper.scrolling-horizontal .scrollbar-thumb-horizontal {
3398
+ background: rgba(102, 102, 102, 0.7);
3399
+ }
3400
+ `;
3401
+ function CustomScrollbar({
3402
+ children,
3403
+ containerRef: externalContainerRef,
3404
+ autoHideDelay = 1e3,
3405
+ onScroll,
3406
+ backgroundColor = "#F5F5F5",
3407
+ className
3408
+ }) {
3409
+ const internalContainerRef = React12.useRef(null);
3410
+ const containerRef = externalContainerRef || internalContainerRef;
3411
+ const wrapperRef = React12.useRef(null);
3412
+ const thumbVerticalRef = React12.useRef(null);
3413
+ const thumbHorizontalRef = React12.useRef(null);
3414
+ const lastScrollPosRef = React12.useRef({ top: 0, left: 0 });
3415
+ const scrollTimeoutsRef = React12.useRef({ vertical: null, horizontal: null });
3416
+ const showScrollbar = React12.useCallback(
3417
+ (direction) => {
3418
+ const wrapper = wrapperRef.current;
3419
+ if (!wrapper) return;
3420
+ wrapper.classList.add(`scrolling-${direction}`);
3421
+ if (scrollTimeoutsRef.current[direction]) {
3422
+ clearTimeout(scrollTimeoutsRef.current[direction]);
3423
+ }
3424
+ scrollTimeoutsRef.current[direction] = setTimeout(() => {
3425
+ wrapper.classList.remove(`scrolling-${direction}`);
3426
+ }, autoHideDelay);
3427
+ },
3428
+ [autoHideDelay]
3429
+ );
3430
+ const updateScrollbarThumbPosition = React12.useCallback(() => {
3431
+ const container = containerRef.current;
3432
+ const thumbVertical = thumbVerticalRef.current;
3433
+ const thumbHorizontal = thumbHorizontalRef.current;
3434
+ if (!container) return;
3435
+ if (thumbVertical) {
3436
+ const { scrollTop, scrollHeight, clientHeight } = container;
3437
+ const scrollableHeight = scrollHeight - clientHeight;
3438
+ if (scrollableHeight <= 0) {
3439
+ thumbVertical.style.display = "none";
3440
+ } else {
3441
+ thumbVertical.style.display = "block";
3442
+ const thumbHeight = Math.max(
3443
+ clientHeight / scrollHeight * clientHeight,
3444
+ 30
3445
+ );
3446
+ const thumbTop = scrollTop / scrollableHeight * (clientHeight - thumbHeight);
3447
+ thumbVertical.style.height = `${thumbHeight}px`;
3448
+ thumbVertical.style.top = `${thumbTop}px`;
3449
+ }
3450
+ }
3451
+ if (thumbHorizontal) {
3452
+ const { scrollLeft, scrollWidth, clientWidth } = container;
3453
+ const scrollableWidth = scrollWidth - clientWidth;
3454
+ if (scrollableWidth <= 0) {
3455
+ thumbHorizontal.style.display = "none";
3456
+ } else {
3457
+ thumbHorizontal.style.display = "block";
3458
+ const thumbWidth = Math.max(
3459
+ clientWidth / scrollWidth * clientWidth,
3460
+ 30
3461
+ );
3462
+ const thumbLeft = scrollLeft / scrollableWidth * (clientWidth - thumbWidth);
3463
+ thumbHorizontal.style.width = `${thumbWidth}px`;
3464
+ thumbHorizontal.style.left = `${thumbLeft}px`;
3465
+ }
3466
+ }
3467
+ }, [containerRef]);
3468
+ React12.useEffect(() => {
3469
+ const container = containerRef.current;
3470
+ if (!container) return;
3471
+ lastScrollPosRef.current = {
3472
+ top: container.scrollTop,
3473
+ left: container.scrollLeft
3474
+ };
3475
+ let rafId = null;
3476
+ const handleScroll = () => {
3477
+ const currentScrollTop = container.scrollTop;
3478
+ const currentScrollLeft = container.scrollLeft;
3479
+ if (currentScrollTop !== lastScrollPosRef.current.top) {
3480
+ showScrollbar("vertical");
3481
+ }
3482
+ if (currentScrollLeft !== lastScrollPosRef.current.left) {
3483
+ showScrollbar("horizontal");
3484
+ }
3485
+ lastScrollPosRef.current = {
3486
+ top: currentScrollTop,
3487
+ left: currentScrollLeft
3488
+ };
3489
+ if (rafId) return;
3490
+ rafId = requestAnimationFrame(() => {
3491
+ updateScrollbarThumbPosition();
3492
+ rafId = null;
3493
+ });
3494
+ };
3495
+ container.addEventListener("scroll", handleScroll, { passive: true });
3496
+ return () => {
3497
+ container.removeEventListener("scroll", handleScroll);
3498
+ if (rafId) cancelAnimationFrame(rafId);
3499
+ };
3500
+ }, [containerRef, showScrollbar, updateScrollbarThumbPosition]);
3501
+ React12.useEffect(() => {
3502
+ const thumbVertical = thumbVerticalRef.current;
3503
+ const thumbHorizontal = thumbHorizontalRef.current;
3504
+ const container = containerRef.current;
3505
+ if (!container) return;
3506
+ let activeDrag = null;
3507
+ let startPos = 0;
3508
+ let startScroll = 0;
3509
+ const handleMouseDown = (direction) => {
3510
+ return (e) => {
3511
+ activeDrag = direction;
3512
+ startPos = direction === "vertical" ? e.clientY : e.clientX;
3513
+ startScroll = direction === "vertical" ? container.scrollTop : container.scrollLeft;
3514
+ showScrollbar(direction);
3515
+ document.body.style.userSelect = "none";
3516
+ e.preventDefault();
3517
+ };
3518
+ };
3519
+ const handleMouseMove = (e) => {
3520
+ if (!activeDrag) return;
3521
+ if (activeDrag === "vertical") {
3522
+ const { scrollHeight, clientHeight } = container;
3523
+ const scrollableHeight = scrollHeight - clientHeight;
3524
+ const thumbHeight = Math.max(
3525
+ clientHeight / scrollHeight * clientHeight,
3526
+ 30
3527
+ );
3528
+ const trackHeight = clientHeight - thumbHeight;
3529
+ const delta = e.clientY - startPos;
3530
+ container.scrollTop = startScroll + delta / trackHeight * scrollableHeight;
3531
+ } else {
3532
+ const { scrollWidth, clientWidth } = container;
3533
+ const scrollableWidth = scrollWidth - clientWidth;
3534
+ const thumbWidth = Math.max(
3535
+ clientWidth / scrollWidth * clientWidth,
3536
+ 30
3537
+ );
3538
+ const trackWidth = clientWidth - thumbWidth;
3539
+ const delta = e.clientX - startPos;
3540
+ container.scrollLeft = startScroll + delta / trackWidth * scrollableWidth;
3541
+ }
3542
+ };
3543
+ const handleMouseUp = () => {
3544
+ if (!activeDrag) return;
3545
+ activeDrag = null;
3546
+ document.body.style.userSelect = "";
3547
+ };
3548
+ const onVerticalMouseDown = handleMouseDown("vertical");
3549
+ const onHorizontalMouseDown = handleMouseDown("horizontal");
3550
+ thumbVertical?.addEventListener("mousedown", onVerticalMouseDown);
3551
+ thumbHorizontal?.addEventListener("mousedown", onHorizontalMouseDown);
3552
+ document.addEventListener("mousemove", handleMouseMove);
3553
+ document.addEventListener("mouseup", handleMouseUp);
3554
+ return () => {
3555
+ thumbVertical?.removeEventListener("mousedown", onVerticalMouseDown);
3556
+ thumbHorizontal?.removeEventListener("mousedown", onHorizontalMouseDown);
3557
+ document.removeEventListener("mousemove", handleMouseMove);
3558
+ document.removeEventListener("mouseup", handleMouseUp);
3559
+ };
3560
+ }, [containerRef, showScrollbar]);
3561
+ React12.useEffect(() => {
3562
+ updateScrollbarThumbPosition();
3563
+ }, [children, updateScrollbarThumbPosition]);
3564
+ return /* @__PURE__ */ jsxs10(Fragment, { children: [
3565
+ /* @__PURE__ */ jsx15("style", { children: scrollbarStyles }),
3566
+ /* @__PURE__ */ jsxs10(
3567
+ "div",
3568
+ {
3569
+ ref: wrapperRef,
3570
+ className: `flex-1 min-w-0 custom-scrollbar-wrapper ${className || ""}`,
3571
+ style: { background: backgroundColor },
3572
+ children: [
3573
+ /* @__PURE__ */ jsx15(
3574
+ "div",
3575
+ {
3576
+ ref: containerRef,
3577
+ className: "h-full custom-scrollbar-content",
3578
+ onScroll,
3579
+ children
3580
+ }
3581
+ ),
3582
+ /* @__PURE__ */ jsx15("div", { className: "scrollbar-track-vertical", children: /* @__PURE__ */ jsx15("div", { ref: thumbVerticalRef, className: "scrollbar-thumb-vertical" }) }),
3583
+ /* @__PURE__ */ jsx15("div", { className: "scrollbar-track-horizontal", children: /* @__PURE__ */ jsx15(
3584
+ "div",
3585
+ {
3586
+ ref: thumbHorizontalRef,
3587
+ className: "scrollbar-thumb-horizontal"
3588
+ }
3589
+ ) })
3590
+ ]
3591
+ }
3592
+ )
3593
+ ] });
3594
+ }
3595
+
3596
+ // src/components/pdf-viewer/components/PdfControls.tsx
3597
+ import * as React13 from "react";
3598
+
3599
+ // src/components/pdf-viewer/utils/types.ts
3600
+ var PDF_ZOOM = {
3601
+ MIN: 25,
3602
+ MAX: 300,
3603
+ DEFAULT: 100,
3604
+ STEP: 25
3605
+ };
3606
+
3607
+ // src/components/pdf-viewer/components/PdfControls.tsx
3608
+ import { jsx as jsx16, jsxs as jsxs11 } from "react/jsx-runtime";
3609
+ var PdfControls = ({
3610
+ currentPage,
3611
+ totalPages,
3612
+ onPageChange,
3613
+ onPreviousPage,
3614
+ onNextPage,
3615
+ zoom,
3616
+ onZoomChange
3617
+ }) => {
3618
+ const canGoPrevious = currentPage > 1;
3619
+ const canGoNext = currentPage < totalPages;
3620
+ const canZoomIn = zoom < PDF_ZOOM.MAX;
3621
+ const canZoomOut = zoom > PDF_ZOOM.MIN;
3622
+ const [pageInputValue, setPageInputValue] = React13.useState(
3623
+ String(currentPage)
3624
+ );
3625
+ const isEscapeRef = React13.useRef(false);
3626
+ React13.useEffect(() => {
3627
+ setPageInputValue(String(currentPage));
3628
+ }, [currentPage]);
3629
+ const handlePageInputChange = (e) => {
3630
+ setPageInputValue(e.target.value);
3631
+ };
3632
+ const handlePageInputBlur = () => {
3633
+ if (isEscapeRef.current) {
3634
+ isEscapeRef.current = false;
3635
+ return;
3636
+ }
3637
+ const pageNum = parseInt(pageInputValue, 10);
3638
+ if (!isNaN(pageNum) && pageNum >= 1 && pageNum <= totalPages) {
3639
+ onPageChange?.(pageNum);
3640
+ } else {
3641
+ setPageInputValue(String(currentPage));
3642
+ }
3643
+ };
3644
+ const handlePageKeyDown = (e) => {
3645
+ if (e.key === "Enter") {
3646
+ handlePageInputBlur();
3647
+ e.target.blur();
3648
+ } else if (e.key === "Escape") {
3649
+ isEscapeRef.current = true;
3650
+ setPageInputValue(String(currentPage));
3651
+ e.target.blur();
3652
+ }
3653
+ };
3654
+ const handleZoomIn = () => {
3655
+ const newZoom = Math.min(zoom + PDF_ZOOM.STEP, PDF_ZOOM.MAX);
3656
+ onZoomChange(newZoom);
3657
+ };
3658
+ const handleZoomOut = () => {
3659
+ const newZoom = Math.max(zoom - PDF_ZOOM.STEP, PDF_ZOOM.MIN);
3660
+ onZoomChange(newZoom);
3661
+ };
3662
+ return /* @__PURE__ */ jsxs11(
3663
+ "div",
3664
+ {
3665
+ className: "flex flex-col items-center justify-end py-2 px-1 gap-4",
3666
+ style: { background: "#DEDEDE" },
3667
+ children: [
3668
+ /* @__PURE__ */ jsxs11("div", { className: "flex flex-col items-center gap-1", children: [
3669
+ /* @__PURE__ */ jsx16(
3670
+ "button",
3671
+ {
3672
+ onClick: onPreviousPage,
3673
+ disabled: !canGoPrevious,
3674
+ className: "p-1.5 rounded transition-colors disabled:opacity-40 disabled:cursor-not-allowed",
3675
+ "aria-label": "Previous page",
3676
+ type: "button",
3677
+ children: /* @__PURE__ */ jsx16(ChevronUp, { className: "w-4 h-4", style: { color: "#666666" } })
3678
+ }
3679
+ ),
3680
+ /* @__PURE__ */ jsx16("div", { className: "flex flex-col items-center", children: totalPages > 0 ? /* @__PURE__ */ jsx16(
3681
+ "input",
3682
+ {
3683
+ type: "text",
3684
+ inputMode: "numeric",
3685
+ value: pageInputValue,
3686
+ onChange: handlePageInputChange,
3687
+ onBlur: handlePageInputBlur,
3688
+ onKeyDown: handlePageKeyDown,
3689
+ className: "w-8 px-1 py-0.5 text-center text-sm rounded focus:outline-none focus:ring-1 focus:ring-primary",
3690
+ style: {
3691
+ background: "white",
3692
+ border: "1px solid #CCCCCC"
3693
+ },
3694
+ "aria-label": "Current page"
3695
+ }
3696
+ ) : /* @__PURE__ */ jsx16("span", { className: "text-sm", style: { color: "#666666" }, children: "-" }) }),
3697
+ /* @__PURE__ */ jsx16(
3698
+ "button",
3699
+ {
3700
+ onClick: onNextPage,
3701
+ disabled: !canGoNext,
3702
+ className: "p-1.5 rounded transition-colors disabled:opacity-40 disabled:cursor-not-allowed",
3703
+ "aria-label": "Next page",
3704
+ type: "button",
3705
+ children: /* @__PURE__ */ jsx16(ChevronDown, { className: "w-4 h-4", style: { color: "#666666" } })
3706
+ }
3707
+ )
3708
+ ] }),
3709
+ /* @__PURE__ */ jsxs11("div", { className: "flex flex-col items-center gap-1", children: [
3710
+ /* @__PURE__ */ jsx16(
3711
+ "button",
3712
+ {
3713
+ onClick: handleZoomIn,
3714
+ disabled: !canZoomIn,
3715
+ className: "p-1.5 rounded transition-colors disabled:opacity-40 disabled:cursor-not-allowed",
3716
+ "aria-label": "Zoom in",
3717
+ type: "button",
3718
+ children: /* @__PURE__ */ jsx16(ZoomIn, { className: "w-4 h-4", style: { color: "#666666" } })
3719
+ }
3720
+ ),
3721
+ /* @__PURE__ */ jsx16(
3722
+ "button",
3723
+ {
3724
+ onClick: handleZoomOut,
3725
+ disabled: !canZoomOut,
3726
+ className: "p-1.5 rounded transition-colors disabled:opacity-40 disabled:cursor-not-allowed",
3727
+ "aria-label": "Zoom out",
3728
+ type: "button",
3729
+ children: /* @__PURE__ */ jsx16(ZoomOut, { className: "w-4 h-4", style: { color: "#666666" } })
3730
+ }
3731
+ )
3732
+ ] })
3733
+ ]
3734
+ }
3735
+ );
3736
+ };
3737
+ PdfControls.displayName = "PdfControls";
3738
+
3739
+ // src/components/pdf-viewer/components/PdfDocument.tsx
3223
3740
  import { Document, Page } from "react-pdf";
3224
- import { jsx as jsx15 } from "react/jsx-runtime";
3741
+ import { jsx as jsx17, jsxs as jsxs12 } from "react/jsx-runtime";
3742
+ var DEFAULT_ASPECT_RATIO = 11 / 8.5;
3225
3743
  var PdfDocument = ({
3226
3744
  file,
3227
3745
  pageWidth,
3228
3746
  enableTextLayer,
3229
3747
  onLoadSuccess,
3230
- onLoadError
3748
+ onLoadError,
3749
+ numPages,
3750
+ registerPageRef,
3751
+ visiblePages,
3752
+ viewMode,
3753
+ currentPage
3231
3754
  }) => {
3232
- const [numPages, setNumPages] = React12.useState();
3755
+ const placeholderHeight = pageWidth * DEFAULT_ASPECT_RATIO;
3233
3756
  function handleDocumentLoadSuccess({ numPages: numPages2 }) {
3234
- setNumPages(numPages2);
3235
3757
  onLoadSuccess?.(numPages2);
3236
3758
  }
3759
+ function renderCurrentPage() {
3760
+ return /* @__PURE__ */ jsx17(
3761
+ "div",
3762
+ {
3763
+ ref: (el) => registerPageRef(currentPage, el),
3764
+ className: "flex justify-center",
3765
+ children: /* @__PURE__ */ jsx17(
3766
+ Page,
3767
+ {
3768
+ pageNumber: currentPage,
3769
+ width: pageWidth,
3770
+ className: "shadow-sm",
3771
+ renderTextLayer: enableTextLayer,
3772
+ renderAnnotationLayer: false,
3773
+ loading: /* @__PURE__ */ jsx17(
3774
+ "div",
3775
+ {
3776
+ className: "flex items-center justify-center bg-white",
3777
+ style: { width: pageWidth, height: placeholderHeight },
3778
+ children: /* @__PURE__ */ jsxs12(Typography, { variant: "body-sm", className: "text-secondary", children: [
3779
+ "Loading page ",
3780
+ currentPage,
3781
+ "..."
3782
+ ] })
3783
+ }
3784
+ )
3785
+ }
3786
+ )
3787
+ },
3788
+ `page_${currentPage}`
3789
+ );
3790
+ }
3791
+ function renderPagesWithVirtualization() {
3792
+ return Array.from(new Array(numPages), (_, index) => {
3793
+ const pageNum = index + 1;
3794
+ const shouldRender = visiblePages.has(pageNum);
3795
+ return /* @__PURE__ */ jsx17(
3796
+ "div",
3797
+ {
3798
+ ref: (el) => registerPageRef(pageNum, el),
3799
+ className: "mb-4 flex justify-center",
3800
+ style: {
3801
+ minHeight: shouldRender ? void 0 : placeholderHeight
3802
+ },
3803
+ children: shouldRender ? /* @__PURE__ */ jsx17(
3804
+ Page,
3805
+ {
3806
+ pageNumber: pageNum,
3807
+ width: pageWidth,
3808
+ className: "shadow-sm",
3809
+ renderTextLayer: enableTextLayer,
3810
+ renderAnnotationLayer: false,
3811
+ loading: /* @__PURE__ */ jsx17(
3812
+ "div",
3813
+ {
3814
+ className: "flex items-center justify-center bg-white",
3815
+ style: { width: pageWidth, height: placeholderHeight },
3816
+ children: /* @__PURE__ */ jsxs12(Typography, { variant: "body-sm", className: "text-secondary", children: [
3817
+ "Loading page ",
3818
+ pageNum,
3819
+ "..."
3820
+ ] })
3821
+ }
3822
+ )
3823
+ }
3824
+ ) : /* @__PURE__ */ jsx17(
3825
+ "div",
3826
+ {
3827
+ className: "flex items-center justify-center bg-white shadow-sm",
3828
+ style: {
3829
+ width: pageWidth,
3830
+ height: placeholderHeight
3831
+ },
3832
+ children: /* @__PURE__ */ jsxs12(Typography, { variant: "body-sm", className: "text-secondary", children: [
3833
+ "Page ",
3834
+ pageNum
3835
+ ] })
3836
+ }
3837
+ )
3838
+ },
3839
+ `page_${pageNum}`
3840
+ );
3841
+ });
3842
+ }
3237
3843
  if (!file) {
3238
- return /* @__PURE__ */ jsx15("div", { className: "flex items-center justify-center h-64", children: /* @__PURE__ */ jsx15(Typography, { variant: "body-md", className: "text-secondary", children: "No PDF available" }) });
3844
+ return /* @__PURE__ */ jsx17("div", { className: "flex items-center justify-center h-64", children: /* @__PURE__ */ jsx17(Typography, { variant: "body-md", className: "text-secondary", children: "No PDF available" }) });
3239
3845
  }
3240
- return /* @__PURE__ */ jsx15(
3846
+ return /* @__PURE__ */ jsx17(
3241
3847
  Document,
3242
3848
  {
3243
3849
  file,
3244
3850
  onLoadSuccess: handleDocumentLoadSuccess,
3245
3851
  onLoadError,
3246
- loading: /* @__PURE__ */ jsx15("div", { className: "flex items-center justify-center h-64", children: /* @__PURE__ */ jsx15(Typography, { variant: "body-md", className: "text-secondary", children: "Rendering PDF..." }) }),
3247
- error: /* @__PURE__ */ jsx15("div", { className: "flex items-center justify-center h-64", children: /* @__PURE__ */ jsx15(Typography, { variant: "body-md", className: "text-error", children: "Failed to render PDF" }) }),
3248
- className: "flex flex-col items-center p-4",
3249
- children: numPages && pageWidth > 0 && Array.from(new Array(numPages), (_, index) => /* @__PURE__ */ jsx15(
3250
- Page,
3251
- {
3252
- pageNumber: index + 1,
3253
- width: pageWidth,
3254
- className: "mb-4 shadow-sm",
3255
- renderTextLayer: enableTextLayer,
3256
- renderAnnotationLayer: false
3257
- },
3258
- `page_${index + 1}`
3259
- ))
3852
+ loading: /* @__PURE__ */ jsx17("div", { className: "flex items-center justify-center h-64", children: /* @__PURE__ */ jsx17(Typography, { variant: "body-md", className: "text-secondary", children: "Rendering PDF..." }) }),
3853
+ error: /* @__PURE__ */ jsx17("div", { className: "flex items-center justify-center h-64", children: /* @__PURE__ */ jsx17(Typography, { variant: "body-md", className: "text-error", children: "Failed to render PDF" }) }),
3854
+ className: "flex flex-col items-center p-4 min-w-fit",
3855
+ children: numPages > 0 && pageWidth > 0 && (viewMode === "single" ? renderCurrentPage() : renderPagesWithVirtualization())
3260
3856
  }
3261
3857
  );
3262
3858
  };
3263
3859
  PdfDocument.displayName = "PdfDocument";
3264
3860
 
3265
3861
  // src/components/pdf-viewer/components/PdfHeader.tsx
3266
- import { jsx as jsx16, jsxs as jsxs10 } from "react/jsx-runtime";
3862
+ import { jsx as jsx18, jsxs as jsxs13 } from "react/jsx-runtime";
3267
3863
  var PdfHeader = ({
3268
3864
  title,
3269
3865
  onDownload,
3270
3866
  onPrint
3271
3867
  }) => {
3272
- return /* @__PURE__ */ jsxs10("div", { className: "flex items-center justify-between gap-4 px-4 py-3 bg-neutral-400 border-b border-subtle", children: [
3273
- /* @__PURE__ */ jsx16("div", { className: "flex-shrink min-w-0", children: /* @__PURE__ */ jsx16(
3274
- Typography,
3275
- {
3276
- variant: "label-md-bold",
3277
- className: "text-dark truncate",
3278
- title,
3279
- children: title || "Untitled Document"
3280
- }
3281
- ) }),
3282
- /* @__PURE__ */ jsxs10("div", { className: "flex items-center gap-2 flex-shrink-0", children: [
3283
- /* @__PURE__ */ jsx16(
3284
- "button",
3285
- {
3286
- onClick: onDownload,
3287
- className: "p-2 hover:bg-neutral-500 rounded transition-colors",
3288
- "aria-label": "Download PDF",
3289
- type: "button",
3290
- children: /* @__PURE__ */ jsx16(Download, { variant: "dark", className: "w-5 h-5" })
3291
- }
3292
- ),
3293
- /* @__PURE__ */ jsx16(
3294
- "button",
3295
- {
3296
- onClick: onPrint,
3297
- className: "p-2 hover:bg-neutral-500 rounded transition-colors",
3298
- "aria-label": "Print PDF",
3299
- type: "button",
3300
- children: /* @__PURE__ */ jsx16(Print, { variant: "dark", className: "w-5 h-5" })
3301
- }
3302
- )
3303
- ] })
3304
- ] });
3868
+ return /* @__PURE__ */ jsxs13(
3869
+ "div",
3870
+ {
3871
+ className: "flex items-center justify-between gap-4 px-4 py-3",
3872
+ style: { background: "#B5B5B5" },
3873
+ children: [
3874
+ /* @__PURE__ */ jsx18("div", { className: "flex-shrink min-w-0", children: /* @__PURE__ */ jsx18(
3875
+ Typography,
3876
+ {
3877
+ variant: "label-md-bold",
3878
+ className: "text-dark truncate",
3879
+ title,
3880
+ children: title || "Untitled Document"
3881
+ }
3882
+ ) }),
3883
+ /* @__PURE__ */ jsxs13("div", { className: "flex items-center gap-2 flex-shrink-0", children: [
3884
+ /* @__PURE__ */ jsx18(
3885
+ "button",
3886
+ {
3887
+ onClick: onDownload,
3888
+ className: "p-2 hover:bg-neutral-500 rounded transition-colors",
3889
+ "aria-label": "Download PDF",
3890
+ type: "button",
3891
+ children: /* @__PURE__ */ jsx18(Download, { variant: "dark", className: "w-5 h-5" })
3892
+ }
3893
+ ),
3894
+ /* @__PURE__ */ jsx18(
3895
+ "button",
3896
+ {
3897
+ onClick: onPrint,
3898
+ className: "p-2 hover:bg-neutral-500 rounded transition-colors",
3899
+ "aria-label": "Print PDF",
3900
+ type: "button",
3901
+ children: /* @__PURE__ */ jsx18(Print, { variant: "dark", className: "w-5 h-5" })
3902
+ }
3903
+ )
3904
+ ] })
3905
+ ]
3906
+ }
3907
+ );
3305
3908
  };
3306
3909
  PdfHeader.displayName = "PdfHeader";
3307
3910
 
3308
3911
  // src/components/pdf-viewer/hooks/useContainerWidth.ts
3309
- import * as React13 from "react";
3912
+ import * as React14 from "react";
3310
3913
  function useContainerWidth(padding = 32) {
3311
- const [containerWidth, setContainerWidth] = React13.useState(0);
3312
- const containerRef = React13.useRef(null);
3313
- const lastWidthRef = React13.useRef(0);
3314
- React13.useEffect(() => {
3914
+ const [containerWidth, setContainerWidth] = React14.useState(0);
3915
+ const containerRef = React14.useRef(null);
3916
+ const lastWidthRef = React14.useRef(0);
3917
+ React14.useEffect(() => {
3315
3918
  const element = containerRef.current;
3316
3919
  if (!element) return;
3317
3920
  const resizeObserver = new ResizeObserver((entries) => {
@@ -3334,10 +3937,142 @@ function useContainerWidth(padding = 32) {
3334
3937
  return { containerWidth, containerRef };
3335
3938
  }
3336
3939
 
3940
+ // src/components/pdf-viewer/hooks/usePageNavigation.ts
3941
+ import * as React15 from "react";
3942
+ function usePageNavigation({
3943
+ containerRef,
3944
+ numPages,
3945
+ onBeforeScroll,
3946
+ page: controlledPage,
3947
+ onPageChange,
3948
+ scrollBehavior = "smooth"
3949
+ }) {
3950
+ const [internalPage, setInternalPage] = React15.useState(1);
3951
+ const pageRefsMap = React15.useRef(/* @__PURE__ */ new Map());
3952
+ const isProgrammaticScroll = React15.useRef(false);
3953
+ const lastScrolledPageRef = React15.useRef(null);
3954
+ const scrollDebounceRef = React15.useRef(
3955
+ null
3956
+ );
3957
+ const isControlled = controlledPage !== void 0;
3958
+ const currentPage = isControlled ? controlledPage : internalPage;
3959
+ const registerPageRef = React15.useCallback(
3960
+ (pageNum, el) => {
3961
+ if (el) {
3962
+ pageRefsMap.current.set(pageNum, el);
3963
+ } else {
3964
+ pageRefsMap.current.delete(pageNum);
3965
+ }
3966
+ },
3967
+ []
3968
+ );
3969
+ const updateCurrentPageFromScroll = React15.useCallback(() => {
3970
+ if (isProgrammaticScroll.current) return;
3971
+ const container = containerRef.current;
3972
+ if (!container || numPages === 0) return;
3973
+ const containerRect = container.getBoundingClientRect();
3974
+ let mostVisiblePage = 1;
3975
+ let maxVisibleArea = 0;
3976
+ for (let pageNum = 1; pageNum <= numPages; pageNum++) {
3977
+ const pageElement = pageRefsMap.current.get(pageNum);
3978
+ if (!pageElement) continue;
3979
+ const pageRect = pageElement.getBoundingClientRect();
3980
+ if (pageRect.bottom > containerRect.top && pageRect.top < containerRect.bottom) {
3981
+ const visibleTop = Math.max(pageRect.top, containerRect.top);
3982
+ const visibleBottom = Math.min(pageRect.bottom, containerRect.bottom);
3983
+ const visibleArea = visibleBottom - visibleTop;
3984
+ if (visibleArea > maxVisibleArea) {
3985
+ maxVisibleArea = visibleArea;
3986
+ mostVisiblePage = pageNum;
3987
+ }
3988
+ }
3989
+ }
3990
+ if (maxVisibleArea > 0) {
3991
+ lastScrolledPageRef.current = mostVisiblePage;
3992
+ if (isControlled) {
3993
+ onPageChange?.(mostVisiblePage);
3994
+ } else {
3995
+ setInternalPage(mostVisiblePage);
3996
+ }
3997
+ }
3998
+ }, [containerRef, numPages, isControlled, onPageChange]);
3999
+ const scrollToPage = React15.useCallback(
4000
+ (pageNum) => {
4001
+ const container = containerRef.current;
4002
+ if (!container) return;
4003
+ onBeforeScroll?.(pageNum);
4004
+ if (scrollDebounceRef.current) {
4005
+ clearTimeout(scrollDebounceRef.current);
4006
+ }
4007
+ const performScroll = () => {
4008
+ isProgrammaticScroll.current = true;
4009
+ requestAnimationFrame(() => {
4010
+ requestAnimationFrame(() => {
4011
+ const pageElement = pageRefsMap.current.get(pageNum);
4012
+ if (container && pageElement) {
4013
+ const containerTop = container.getBoundingClientRect().top;
4014
+ const pageTop = pageElement.getBoundingClientRect().top;
4015
+ const scrollOffset = pageTop - containerTop + container.scrollTop;
4016
+ container.scrollTo({
4017
+ top: scrollOffset,
4018
+ behavior: scrollBehavior
4019
+ });
4020
+ }
4021
+ });
4022
+ });
4023
+ };
4024
+ if (scrollBehavior === "smooth") {
4025
+ scrollDebounceRef.current = setTimeout(performScroll, 100);
4026
+ } else {
4027
+ performScroll();
4028
+ }
4029
+ },
4030
+ [containerRef, onBeforeScroll, scrollBehavior]
4031
+ );
4032
+ const handlePageChange = React15.useCallback(
4033
+ (pageNum) => {
4034
+ const clampedPage = Math.max(1, Math.min(pageNum, numPages));
4035
+ lastScrolledPageRef.current = clampedPage;
4036
+ if (isControlled) {
4037
+ onPageChange?.(clampedPage);
4038
+ } else {
4039
+ setInternalPage(clampedPage);
4040
+ }
4041
+ scrollToPage(clampedPage);
4042
+ },
4043
+ [numPages, scrollToPage, isControlled, onPageChange]
4044
+ );
4045
+ React15.useEffect(() => {
4046
+ if (!isControlled || !controlledPage || numPages <= 0) {
4047
+ return;
4048
+ }
4049
+ if (lastScrolledPageRef.current !== controlledPage) {
4050
+ lastScrolledPageRef.current = controlledPage;
4051
+ scrollToPage(controlledPage);
4052
+ }
4053
+ }, [controlledPage, isControlled, numPages, scrollToPage]);
4054
+ React15.useEffect(() => {
4055
+ return () => {
4056
+ if (scrollDebounceRef.current) {
4057
+ clearTimeout(scrollDebounceRef.current);
4058
+ }
4059
+ };
4060
+ }, []);
4061
+ return {
4062
+ currentPage,
4063
+ registerPageRef,
4064
+ handlePageChange,
4065
+ updateCurrentPageFromScroll,
4066
+ isProgrammaticScroll,
4067
+ pageRefsMap,
4068
+ scrollToPage
4069
+ };
4070
+ }
4071
+
3337
4072
  // src/components/pdf-viewer/hooks/usePdfDownload.ts
3338
- import * as React14 from "react";
4073
+ import * as React16 from "react";
3339
4074
  function usePdfDownload(file, title) {
3340
- const download = React14.useCallback(async () => {
4075
+ const download = React16.useCallback(async () => {
3341
4076
  if (!file) return;
3342
4077
  try {
3343
4078
  let blob;
@@ -3369,11 +4104,11 @@ function usePdfDownload(file, title) {
3369
4104
  }
3370
4105
 
3371
4106
  // src/components/pdf-viewer/hooks/usePdfPrint.ts
3372
- import * as React15 from "react";
4107
+ import * as React17 from "react";
3373
4108
  function usePdfPrint(file) {
3374
- const [printBlobUrl, setPrintBlobUrl] = React15.useState(null);
3375
- const printFrameRef = React15.useRef(null);
3376
- const preparePrint = React15.useCallback(async () => {
4109
+ const [printBlobUrl, setPrintBlobUrl] = React17.useState(null);
4110
+ const printFrameRef = React17.useRef(null);
4111
+ const preparePrint = React17.useCallback(async () => {
3377
4112
  if (!file) return;
3378
4113
  try {
3379
4114
  let blob;
@@ -3389,14 +4124,14 @@ function usePdfPrint(file) {
3389
4124
  console.error("Failed to prepare PDF for printing:", error);
3390
4125
  }
3391
4126
  }, [file]);
3392
- React15.useEffect(() => {
4127
+ React17.useEffect(() => {
3393
4128
  return () => {
3394
4129
  if (printBlobUrl) {
3395
4130
  URL.revokeObjectURL(printBlobUrl);
3396
4131
  }
3397
4132
  };
3398
4133
  }, [printBlobUrl]);
3399
- const print = React15.useCallback(() => {
4134
+ const print = React17.useCallback(() => {
3400
4135
  if (printFrameRef.current?.contentWindow) {
3401
4136
  printFrameRef.current.contentWindow.print();
3402
4137
  }
@@ -3404,6 +4139,53 @@ function usePdfPrint(file) {
3404
4139
  return { printFrameRef, printBlobUrl, preparePrint, print };
3405
4140
  }
3406
4141
 
4142
+ // src/components/pdf-viewer/hooks/useZoomControl.ts
4143
+ import * as React18 from "react";
4144
+ function useZoomControl({
4145
+ containerRef,
4146
+ initialZoom = PDF_ZOOM.DEFAULT
4147
+ }) {
4148
+ const [zoom, setZoom] = React18.useState(initialZoom);
4149
+ const scrollRatioRef = React18.useRef({ x: 0.5, y: 0 });
4150
+ const handleZoomChange = React18.useCallback(
4151
+ (newZoom) => {
4152
+ const container = containerRef.current;
4153
+ if (container) {
4154
+ const {
4155
+ scrollLeft,
4156
+ scrollTop,
4157
+ scrollWidth,
4158
+ scrollHeight,
4159
+ clientWidth,
4160
+ clientHeight
4161
+ } = container;
4162
+ scrollRatioRef.current = {
4163
+ x: scrollWidth > clientWidth ? scrollLeft / (scrollWidth - clientWidth) : 0.5,
4164
+ y: scrollHeight > clientHeight ? scrollTop / (scrollHeight - clientHeight) : 0
4165
+ };
4166
+ }
4167
+ setZoom(newZoom);
4168
+ },
4169
+ [containerRef]
4170
+ );
4171
+ React18.useEffect(() => {
4172
+ const container = containerRef.current;
4173
+ if (!container) return;
4174
+ requestAnimationFrame(() => {
4175
+ const { scrollWidth, scrollHeight, clientWidth, clientHeight } = container;
4176
+ const maxScrollLeft = scrollWidth - clientWidth;
4177
+ const maxScrollTop = scrollHeight - clientHeight;
4178
+ if (maxScrollLeft > 0) {
4179
+ container.scrollLeft = scrollRatioRef.current.x * maxScrollLeft;
4180
+ }
4181
+ if (maxScrollTop > 0) {
4182
+ container.scrollTop = scrollRatioRef.current.y * maxScrollTop;
4183
+ }
4184
+ });
4185
+ }, [zoom, containerRef]);
4186
+ return { zoom, handleZoomChange };
4187
+ }
4188
+
3407
4189
  // src/components/pdf-viewer/utils/pdfWorker.ts
3408
4190
  import { pdfjs } from "react-pdf";
3409
4191
  function initializePdfWorker(workerUrl) {
@@ -3411,8 +4193,9 @@ function initializePdfWorker(workerUrl) {
3411
4193
  }
3412
4194
 
3413
4195
  // src/components/pdf-viewer/index.tsx
3414
- import { jsx as jsx17, jsxs as jsxs11 } from "react/jsx-runtime";
3415
- var PdfViewer = React16.forwardRef(
4196
+ import { jsx as jsx19, jsxs as jsxs14 } from "react/jsx-runtime";
4197
+ var DEFAULT_VIEWPORT_BUFFER = 1;
4198
+ var PdfViewer = React19.forwardRef(
3416
4199
  ({
3417
4200
  file,
3418
4201
  title,
@@ -3422,42 +4205,150 @@ var PdfViewer = React16.forwardRef(
3422
4205
  onLoadSuccess,
3423
4206
  onError,
3424
4207
  enableTextLayer = false,
4208
+ showControls = true,
4209
+ viewportBuffer = DEFAULT_VIEWPORT_BUFFER,
4210
+ page: controlledPage,
4211
+ onPageChange,
4212
+ scrollBehavior = "instant",
4213
+ viewMode = "continuous",
3425
4214
  className,
3426
4215
  ...props
3427
4216
  }, ref) => {
4217
+ const [numPages, setNumPages] = React19.useState(0);
4218
+ const [visiblePages, setVisiblePages] = React19.useState(
4219
+ () => /* @__PURE__ */ new Set([1, 2, 3])
4220
+ );
3428
4221
  const { containerWidth, containerRef } = useContainerWidth();
4222
+ const { zoom, handleZoomChange } = useZoomControl({ containerRef });
3429
4223
  const { printFrameRef, printBlobUrl, preparePrint, print } = usePdfPrint(file);
3430
4224
  const download = usePdfDownload(file, title);
3431
- const effectiveWidth = pageWidth || containerWidth;
3432
- const handleLoadSuccess = React16.useCallback(
3433
- async (numPages) => {
3434
- onLoadSuccess?.(numPages);
4225
+ const handleBeforeScroll = React19.useCallback(
4226
+ (pageNum) => {
4227
+ const bufferStart = Math.max(1, pageNum - viewportBuffer);
4228
+ const bufferEnd = Math.min(numPages, pageNum + viewportBuffer);
4229
+ setVisiblePages((prev) => {
4230
+ const merged = new Set(prev);
4231
+ for (let i = bufferStart; i <= bufferEnd; i++) {
4232
+ merged.add(i);
4233
+ }
4234
+ return merged;
4235
+ });
4236
+ },
4237
+ [numPages, viewportBuffer]
4238
+ );
4239
+ const {
4240
+ currentPage,
4241
+ registerPageRef,
4242
+ handlePageChange,
4243
+ updateCurrentPageFromScroll,
4244
+ isProgrammaticScroll,
4245
+ pageRefsMap
4246
+ } = usePageNavigation({
4247
+ containerRef,
4248
+ numPages,
4249
+ onBeforeScroll: handleBeforeScroll,
4250
+ page: controlledPage,
4251
+ onPageChange,
4252
+ scrollBehavior
4253
+ });
4254
+ const baseWidth = Math.min(pageWidth || containerWidth, 800);
4255
+ const effectiveWidth = Math.round(baseWidth * (zoom / 100));
4256
+ const updateVisiblePages = React19.useCallback(() => {
4257
+ if (isProgrammaticScroll.current) return;
4258
+ const container = containerRef.current;
4259
+ if (!container || numPages === 0) return;
4260
+ const containerRect = container.getBoundingClientRect();
4261
+ let firstVisiblePage = -1;
4262
+ let lastVisiblePage = -1;
4263
+ for (let pageNum = 1; pageNum <= numPages; pageNum++) {
4264
+ const pageElement = pageRefsMap.current.get(pageNum);
4265
+ if (!pageElement) continue;
4266
+ const pageRect = pageElement.getBoundingClientRect();
4267
+ if (pageRect.bottom > containerRect.top && pageRect.top < containerRect.bottom) {
4268
+ if (firstVisiblePage === -1) firstVisiblePage = pageNum;
4269
+ lastVisiblePage = pageNum;
4270
+ }
4271
+ }
4272
+ if (firstVisiblePage !== -1) {
4273
+ const bufferStart = Math.max(1, firstVisiblePage - viewportBuffer);
4274
+ const bufferEnd = Math.min(numPages, lastVisiblePage + viewportBuffer);
4275
+ const newVisiblePages = /* @__PURE__ */ new Set();
4276
+ for (let i = bufferStart; i <= bufferEnd; i++) {
4277
+ newVisiblePages.add(i);
4278
+ }
4279
+ setVisiblePages((prev) => {
4280
+ if (prev.size !== newVisiblePages.size) return newVisiblePages;
4281
+ for (const p of prev) {
4282
+ if (!newVisiblePages.has(p)) return newVisiblePages;
4283
+ }
4284
+ return prev;
4285
+ });
4286
+ }
4287
+ }, [
4288
+ containerRef,
4289
+ numPages,
4290
+ viewportBuffer,
4291
+ isProgrammaticScroll,
4292
+ pageRefsMap
4293
+ ]);
4294
+ React19.useEffect(() => {
4295
+ const container = containerRef.current;
4296
+ if (!container) return;
4297
+ let rafId = null;
4298
+ const handleScroll = () => {
4299
+ if (rafId) return;
4300
+ rafId = requestAnimationFrame(() => {
4301
+ updateCurrentPageFromScroll();
4302
+ updateVisiblePages();
4303
+ rafId = null;
4304
+ });
4305
+ };
4306
+ const handleScrollEnd = () => {
4307
+ isProgrammaticScroll.current = false;
4308
+ };
4309
+ container.addEventListener("scroll", handleScroll, { passive: true });
4310
+ container.addEventListener("scrollend", handleScrollEnd);
4311
+ return () => {
4312
+ container.removeEventListener("scroll", handleScroll);
4313
+ container.removeEventListener("scrollend", handleScrollEnd);
4314
+ if (rafId) cancelAnimationFrame(rafId);
4315
+ };
4316
+ }, [
4317
+ updateCurrentPageFromScroll,
4318
+ updateVisiblePages,
4319
+ containerRef,
4320
+ isProgrammaticScroll
4321
+ ]);
4322
+ const handleLoadSuccess = React19.useCallback(
4323
+ async (pages) => {
4324
+ setNumPages(pages);
4325
+ onLoadSuccess?.(pages);
3435
4326
  await preparePrint();
3436
4327
  },
3437
4328
  [onLoadSuccess, preparePrint]
3438
4329
  );
3439
- const handleDownload = React16.useCallback(() => {
4330
+ const handleDownload = React19.useCallback(() => {
3440
4331
  if (onDownload) {
3441
4332
  onDownload();
3442
4333
  return;
3443
4334
  }
3444
4335
  download();
3445
4336
  }, [onDownload, download]);
3446
- const handlePrint = React16.useCallback(() => {
4337
+ const handlePrint = React19.useCallback(() => {
3447
4338
  if (onPrint) {
3448
4339
  onPrint();
3449
4340
  return;
3450
4341
  }
3451
4342
  print();
3452
4343
  }, [onPrint, print]);
3453
- return /* @__PURE__ */ jsxs11(
4344
+ return /* @__PURE__ */ jsxs14(
3454
4345
  "div",
3455
4346
  {
3456
4347
  ref,
3457
4348
  className: cn("h-full flex flex-col", className),
3458
4349
  ...props,
3459
4350
  children: [
3460
- printBlobUrl && /* @__PURE__ */ jsx17(
4351
+ printBlobUrl && /* @__PURE__ */ jsx19(
3461
4352
  "iframe",
3462
4353
  {
3463
4354
  ref: printFrameRef,
@@ -3466,7 +4357,7 @@ var PdfViewer = React16.forwardRef(
3466
4357
  title: "PDF for printing"
3467
4358
  }
3468
4359
  ),
3469
- /* @__PURE__ */ jsx17(
4360
+ /* @__PURE__ */ jsx19(
3470
4361
  PdfHeader,
3471
4362
  {
3472
4363
  title,
@@ -3474,23 +4365,35 @@ var PdfViewer = React16.forwardRef(
3474
4365
  onPrint: handlePrint
3475
4366
  }
3476
4367
  ),
3477
- /* @__PURE__ */ jsx17(
3478
- "div",
3479
- {
3480
- ref: containerRef,
3481
- className: "flex-1 overflow-y-auto overflow-x-hidden bg-neutral-300",
3482
- children: /* @__PURE__ */ jsx17(
3483
- PdfDocument,
3484
- {
3485
- file,
3486
- pageWidth: effectiveWidth,
3487
- enableTextLayer,
3488
- onLoadSuccess: handleLoadSuccess,
3489
- onLoadError: onError
3490
- }
3491
- )
3492
- }
3493
- )
4368
+ /* @__PURE__ */ jsxs14("div", { className: "flex-1 flex overflow-hidden min-h-0", children: [
4369
+ /* @__PURE__ */ jsx19(CustomScrollbar, { containerRef, children: /* @__PURE__ */ jsx19(
4370
+ PdfDocument,
4371
+ {
4372
+ file,
4373
+ pageWidth: effectiveWidth,
4374
+ enableTextLayer,
4375
+ onLoadSuccess: handleLoadSuccess,
4376
+ onLoadError: onError,
4377
+ numPages,
4378
+ registerPageRef,
4379
+ visiblePages,
4380
+ viewMode,
4381
+ currentPage
4382
+ }
4383
+ ) }),
4384
+ showControls && /* @__PURE__ */ jsx19(
4385
+ PdfControls,
4386
+ {
4387
+ currentPage,
4388
+ totalPages: numPages,
4389
+ onPageChange: handlePageChange,
4390
+ onPreviousPage: () => handlePageChange(currentPage - 1),
4391
+ onNextPage: () => handlePageChange(currentPage + 1),
4392
+ zoom,
4393
+ onZoomChange: handleZoomChange
4394
+ }
4395
+ )
4396
+ ] })
3494
4397
  ]
3495
4398
  }
3496
4399
  );
@@ -3499,9 +4402,9 @@ var PdfViewer = React16.forwardRef(
3499
4402
  PdfViewer.displayName = "PdfViewer";
3500
4403
 
3501
4404
  // src/components/ui/tabs.tsx
3502
- import * as React17 from "react";
4405
+ import * as React20 from "react";
3503
4406
  import { cva as cva9 } from "class-variance-authority";
3504
- import { jsx as jsx18 } from "react/jsx-runtime";
4407
+ import { jsx as jsx20 } from "react/jsx-runtime";
3505
4408
  var tabsVariants = cva9(
3506
4409
  "inline-flex items-center justify-start whitespace-nowrap transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-border-interactive focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 h-10",
3507
4410
  {
@@ -3515,17 +4418,17 @@ var tabsVariants = cva9(
3515
4418
  }
3516
4419
  }
3517
4420
  );
3518
- var TabsContext = React17.createContext(
4421
+ var TabsContext = React20.createContext(
3519
4422
  void 0
3520
4423
  );
3521
4424
  function useTabsContext() {
3522
- const context = React17.useContext(TabsContext);
4425
+ const context = React20.useContext(TabsContext);
3523
4426
  if (!context) {
3524
4427
  throw new Error("Tabs components must be used within a Tabs provider");
3525
4428
  }
3526
4429
  return context;
3527
4430
  }
3528
- var Tabs = React17.forwardRef((props, ref) => {
4431
+ var Tabs = React20.forwardRef((props, ref) => {
3529
4432
  const {
3530
4433
  className,
3531
4434
  value,
@@ -3534,7 +4437,7 @@ var Tabs = React17.forwardRef((props, ref) => {
3534
4437
  children,
3535
4438
  ...restProps
3536
4439
  } = props;
3537
- const contextValue = React17.useMemo(
4440
+ const contextValue = React20.useMemo(
3538
4441
  () => ({
3539
4442
  activeTab: value,
3540
4443
  setActiveTab: onValueChange,
@@ -3542,13 +4445,13 @@ var Tabs = React17.forwardRef((props, ref) => {
3542
4445
  }),
3543
4446
  [value, onValueChange, variant]
3544
4447
  );
3545
- return /* @__PURE__ */ jsx18(TabsContext.Provider, { value: contextValue, children: /* @__PURE__ */ jsx18("div", { ref, className: cn("w-full", className), ...restProps, children }) });
4448
+ return /* @__PURE__ */ jsx20(TabsContext.Provider, { value: contextValue, children: /* @__PURE__ */ jsx20("div", { ref, className: cn("w-full", className), ...restProps, children }) });
3546
4449
  });
3547
4450
  Tabs.displayName = "Tabs";
3548
- var TabsList = React17.forwardRef(
4451
+ var TabsList = React20.forwardRef(
3549
4452
  (props, ref) => {
3550
4453
  const { className, children, ...restProps } = props;
3551
- return /* @__PURE__ */ jsx18(
4454
+ return /* @__PURE__ */ jsx20(
3552
4455
  "div",
3553
4456
  {
3554
4457
  ref,
@@ -3564,7 +4467,7 @@ TabsList.displayName = "TabsList";
3564
4467
  var getTabTypographyStyles = (isActive) => ({
3565
4468
  font: isActive ? "var(--typography-label-sm-bold)" : "var(--typography-label-sm-regular)"
3566
4469
  });
3567
- var TabsTrigger = React17.forwardRef(
4470
+ var TabsTrigger = React20.forwardRef(
3568
4471
  (props, ref) => {
3569
4472
  const { className, value, disabled, style, children, ...restProps } = props;
3570
4473
  const { activeTab, setActiveTab, variant } = useTabsContext();
@@ -3572,22 +4475,22 @@ var TabsTrigger = React17.forwardRef(
3572
4475
  throw new Error("TabsTrigger must have a value prop");
3573
4476
  }
3574
4477
  const isActive = activeTab === value;
3575
- const tokenStyles = React17.useMemo(
4478
+ const tokenStyles = React20.useMemo(
3576
4479
  () => ({
3577
4480
  ...getTabTypographyStyles(isActive),
3578
4481
  ...style
3579
4482
  }),
3580
4483
  [isActive, style]
3581
4484
  );
3582
- const triggerClassName = React17.useMemo(
4485
+ const triggerClassName = React20.useMemo(
3583
4486
  () => cn(tabsVariants({ variant }), className),
3584
4487
  [variant, className]
3585
4488
  );
3586
- const handleClick = React17.useCallback(() => {
4489
+ const handleClick = React20.useCallback(() => {
3587
4490
  if (disabled) return;
3588
4491
  setActiveTab(value);
3589
4492
  }, [disabled, setActiveTab, value]);
3590
- return /* @__PURE__ */ jsx18(
4493
+ return /* @__PURE__ */ jsx20(
3591
4494
  "button",
3592
4495
  {
3593
4496
  ref,
@@ -3601,13 +4504,13 @@ var TabsTrigger = React17.forwardRef(
3601
4504
  disabled,
3602
4505
  onClick: handleClick,
3603
4506
  ...restProps,
3604
- children: /* @__PURE__ */ jsx18("span", { className: "pl-3 pr-6 py-2", children })
4507
+ children: /* @__PURE__ */ jsx20("span", { className: "pl-3 pr-6 py-2", children })
3605
4508
  }
3606
4509
  );
3607
4510
  }
3608
4511
  );
3609
4512
  TabsTrigger.displayName = "TabsTrigger";
3610
- var TabsContent = React17.forwardRef(
4513
+ var TabsContent = React20.forwardRef(
3611
4514
  (props, ref) => {
3612
4515
  const { className, value, children, ...restProps } = props;
3613
4516
  const { activeTab } = useTabsContext();
@@ -3618,7 +4521,7 @@ var TabsContent = React17.forwardRef(
3618
4521
  if (!isActive) {
3619
4522
  return null;
3620
4523
  }
3621
- return /* @__PURE__ */ jsx18(
4524
+ return /* @__PURE__ */ jsx20(
3622
4525
  "div",
3623
4526
  {
3624
4527
  ref,
@@ -3636,11 +4539,11 @@ var TabsContent = React17.forwardRef(
3636
4539
  TabsContent.displayName = "TabsContent";
3637
4540
 
3638
4541
  // src/components/ui/dropdown-menu.tsx
3639
- import * as React18 from "react";
4542
+ import * as React21 from "react";
3640
4543
  import * as DropdownMenuPrimitive from "@radix-ui/react-dropdown-menu";
3641
- import { jsx as jsx19, jsxs as jsxs12 } from "react/jsx-runtime";
4544
+ import { jsx as jsx21, jsxs as jsxs15 } from "react/jsx-runtime";
3642
4545
  var DropdownMenu = DropdownMenuPrimitive.Root;
3643
- var DropdownMenuTrigger = React18.forwardRef(({ className, icon, children, ...props }, ref) => /* @__PURE__ */ jsxs12(
4546
+ var DropdownMenuTrigger = React21.forwardRef(({ className, icon, children, ...props }, ref) => /* @__PURE__ */ jsxs15(
3644
4547
  DropdownMenuPrimitive.Trigger,
3645
4548
  {
3646
4549
  ref,
@@ -3650,7 +4553,7 @@ var DropdownMenuTrigger = React18.forwardRef(({ className, icon, children, ...pr
3650
4553
  ),
3651
4554
  ...props,
3652
4555
  children: [
3653
- icon || /* @__PURE__ */ jsx19(MoreMenu, { className: "size-4" }),
4556
+ icon || /* @__PURE__ */ jsx21(MoreMenu, { className: "size-4" }),
3654
4557
  children
3655
4558
  ]
3656
4559
  }
@@ -3660,7 +4563,7 @@ var DropdownMenuGroup = DropdownMenuPrimitive.Group;
3660
4563
  var DropdownMenuPortal = DropdownMenuPrimitive.Portal;
3661
4564
  var DropdownMenuSub = DropdownMenuPrimitive.Sub;
3662
4565
  var DropdownMenuRadioGroup = DropdownMenuPrimitive.RadioGroup;
3663
- var DropdownMenuSubTrigger = React18.forwardRef(({ className, inset, children, ...props }, ref) => /* @__PURE__ */ jsxs12(
4566
+ var DropdownMenuSubTrigger = React21.forwardRef(({ className, inset, children, ...props }, ref) => /* @__PURE__ */ jsxs15(
3664
4567
  DropdownMenuPrimitive.SubTrigger,
3665
4568
  {
3666
4569
  ref,
@@ -3673,12 +4576,12 @@ var DropdownMenuSubTrigger = React18.forwardRef(({ className, inset, children, .
3673
4576
  ...props,
3674
4577
  children: [
3675
4578
  children,
3676
- /* @__PURE__ */ jsx19(ChevronRight, { className: "ml-auto" })
4579
+ /* @__PURE__ */ jsx21(ChevronRight, { className: "ml-auto" })
3677
4580
  ]
3678
4581
  }
3679
4582
  ));
3680
4583
  DropdownMenuSubTrigger.displayName = DropdownMenuPrimitive.SubTrigger.displayName;
3681
- var DropdownMenuSubContent = React18.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx19(
4584
+ var DropdownMenuSubContent = React21.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx21(
3682
4585
  DropdownMenuPrimitive.SubContent,
3683
4586
  {
3684
4587
  ref,
@@ -3690,7 +4593,7 @@ var DropdownMenuSubContent = React18.forwardRef(({ className, ...props }, ref) =
3690
4593
  }
3691
4594
  ));
3692
4595
  DropdownMenuSubContent.displayName = DropdownMenuPrimitive.SubContent.displayName;
3693
- var DropdownMenuContent = React18.forwardRef(({ className, sideOffset = 4, align = "end", ...props }, ref) => /* @__PURE__ */ jsx19(DropdownMenuPrimitive.Portal, { children: /* @__PURE__ */ jsx19(
4596
+ var DropdownMenuContent = React21.forwardRef(({ className, sideOffset = 4, align = "end", ...props }, ref) => /* @__PURE__ */ jsx21(DropdownMenuPrimitive.Portal, { children: /* @__PURE__ */ jsx21(
3694
4597
  DropdownMenuPrimitive.Content,
3695
4598
  {
3696
4599
  ref,
@@ -3704,7 +4607,7 @@ var DropdownMenuContent = React18.forwardRef(({ className, sideOffset = 4, align
3704
4607
  }
3705
4608
  ) }));
3706
4609
  DropdownMenuContent.displayName = DropdownMenuPrimitive.Content.displayName;
3707
- var DropdownMenuItem = React18.forwardRef(({ className, inset, style, ...props }, ref) => /* @__PURE__ */ jsx19(
4610
+ var DropdownMenuItem = React21.forwardRef(({ className, inset, style, ...props }, ref) => /* @__PURE__ */ jsx21(
3708
4611
  DropdownMenuPrimitive.Item,
3709
4612
  {
3710
4613
  ref,
@@ -3721,7 +4624,7 @@ var DropdownMenuItem = React18.forwardRef(({ className, inset, style, ...props }
3721
4624
  }
3722
4625
  ));
3723
4626
  DropdownMenuItem.displayName = DropdownMenuPrimitive.Item.displayName;
3724
- var DropdownMenuCheckboxItem = React18.forwardRef(({ className, children, style, checked, ...props }, ref) => /* @__PURE__ */ jsxs12(
4627
+ var DropdownMenuCheckboxItem = React21.forwardRef(({ className, children, style, checked, ...props }, ref) => /* @__PURE__ */ jsxs15(
3725
4628
  DropdownMenuPrimitive.CheckboxItem,
3726
4629
  {
3727
4630
  ref,
@@ -3736,7 +4639,7 @@ var DropdownMenuCheckboxItem = React18.forwardRef(({ className, children, style,
3736
4639
  },
3737
4640
  ...props,
3738
4641
  children: [
3739
- /* @__PURE__ */ jsx19(
4642
+ /* @__PURE__ */ jsx21(
3740
4643
  Checkbox,
3741
4644
  {
3742
4645
  checked: checked === true,
@@ -3744,12 +4647,12 @@ var DropdownMenuCheckboxItem = React18.forwardRef(({ className, children, style,
3744
4647
  "aria-hidden": "true"
3745
4648
  }
3746
4649
  ),
3747
- /* @__PURE__ */ jsx19("span", { className: "flex-1", children })
4650
+ /* @__PURE__ */ jsx21("span", { className: "flex-1", children })
3748
4651
  ]
3749
4652
  }
3750
4653
  ));
3751
4654
  DropdownMenuCheckboxItem.displayName = DropdownMenuPrimitive.CheckboxItem.displayName;
3752
- var DropdownMenuRadioItem = React18.forwardRef(({ className, children, style, ...props }, ref) => /* @__PURE__ */ jsxs12(
4655
+ var DropdownMenuRadioItem = React21.forwardRef(({ className, children, style, ...props }, ref) => /* @__PURE__ */ jsxs15(
3753
4656
  DropdownMenuPrimitive.RadioItem,
3754
4657
  {
3755
4658
  ref,
@@ -3763,13 +4666,13 @@ var DropdownMenuRadioItem = React18.forwardRef(({ className, children, style, ..
3763
4666
  },
3764
4667
  ...props,
3765
4668
  children: [
3766
- /* @__PURE__ */ jsx19("span", { className: "absolute left-2 flex h-3.5 w-3.5 items-center justify-center", children: /* @__PURE__ */ jsx19(DropdownMenuPrimitive.ItemIndicator, { children: /* @__PURE__ */ jsx19("span", { className: "h-2 w-2 rounded-full bg-current" }) }) }),
4669
+ /* @__PURE__ */ jsx21("span", { className: "absolute left-2 flex h-3.5 w-3.5 items-center justify-center", children: /* @__PURE__ */ jsx21(DropdownMenuPrimitive.ItemIndicator, { children: /* @__PURE__ */ jsx21("span", { className: "h-2 w-2 rounded-full bg-current" }) }) }),
3767
4670
  children
3768
4671
  ]
3769
4672
  }
3770
4673
  ));
3771
4674
  DropdownMenuRadioItem.displayName = DropdownMenuPrimitive.RadioItem.displayName;
3772
- var DropdownMenuLabel = React18.forwardRef(({ className, inset, ...props }, ref) => /* @__PURE__ */ jsx19(
4675
+ var DropdownMenuLabel = React21.forwardRef(({ className, inset, ...props }, ref) => /* @__PURE__ */ jsx21(
3773
4676
  DropdownMenuPrimitive.Label,
3774
4677
  {
3775
4678
  ref,
@@ -3782,7 +4685,7 @@ var DropdownMenuLabel = React18.forwardRef(({ className, inset, ...props }, ref)
3782
4685
  }
3783
4686
  ));
3784
4687
  DropdownMenuLabel.displayName = DropdownMenuPrimitive.Label.displayName;
3785
- var DropdownMenuSeparator = React18.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx19(
4688
+ var DropdownMenuSeparator = React21.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx21(
3786
4689
  DropdownMenuPrimitive.Separator,
3787
4690
  {
3788
4691
  ref,
@@ -3795,7 +4698,7 @@ var DropdownMenuShortcut = ({
3795
4698
  className,
3796
4699
  ...props
3797
4700
  }) => {
3798
- return /* @__PURE__ */ jsx19(
4701
+ return /* @__PURE__ */ jsx21(
3799
4702
  "span",
3800
4703
  {
3801
4704
  className: cn("ml-auto text-xs tracking-widest opacity-60", className),
@@ -3806,21 +4709,21 @@ var DropdownMenuShortcut = ({
3806
4709
  DropdownMenuShortcut.displayName = "DropdownMenuShortcut";
3807
4710
 
3808
4711
  // src/components/ui/charts/chart-legend.tsx
3809
- import { jsx as jsx20, jsxs as jsxs13 } from "react/jsx-runtime";
4712
+ import { jsx as jsx22, jsxs as jsxs16 } from "react/jsx-runtime";
3810
4713
  function ChartLegend({
3811
4714
  items,
3812
4715
  x = 0,
3813
4716
  y = 550,
3814
4717
  className = ""
3815
4718
  }) {
3816
- return /* @__PURE__ */ jsx20("foreignObject", { x, y, width: "100%", height: "40", children: /* @__PURE__ */ jsx20(
4719
+ return /* @__PURE__ */ jsx22("foreignObject", { x, y, width: "100%", height: "40", children: /* @__PURE__ */ jsx22(
3817
4720
  "div",
3818
4721
  {
3819
4722
  className: `flex justify-center items-center gap-6 ${className}`,
3820
4723
  style: { height: "100%" },
3821
- children: items.map(({ key, color, label }) => /* @__PURE__ */ jsxs13("div", { className: "flex items-center gap-2", children: [
3822
- /* @__PURE__ */ jsx20("div", { className: "w-3 h-3", style: { backgroundColor: color } }),
3823
- /* @__PURE__ */ jsx20(Typography, { variant: "body-xs", children: label || key })
4724
+ children: items.map(({ key, color, label }) => /* @__PURE__ */ jsxs16("div", { className: "flex items-center gap-2", children: [
4725
+ /* @__PURE__ */ jsx22("div", { className: "w-3 h-3", style: { backgroundColor: color } }),
4726
+ /* @__PURE__ */ jsx22(Typography, { variant: "body-xs", children: label || key })
3824
4727
  ] }, key))
3825
4728
  }
3826
4729
  ) });
@@ -3938,12 +4841,12 @@ var formatLargeNumber = (value) => {
3938
4841
  };
3939
4842
 
3940
4843
  // src/components/ui/charts/chart-labels.tsx
3941
- import { jsx as jsx21 } from "react/jsx-runtime";
4844
+ import { jsx as jsx23 } from "react/jsx-runtime";
3942
4845
  var createCustomXAxisLabel = (text, yOffset = 40) => {
3943
4846
  const CustomXAxisLabel = ({ viewBox }) => {
3944
4847
  if (!viewBox) return null;
3945
4848
  const { x, y, width } = viewBox;
3946
- return /* @__PURE__ */ jsx21("g", { children: /* @__PURE__ */ jsx21("foreignObject", { x, y: y + yOffset, width, height: 20, children: /* @__PURE__ */ jsx21("div", { className: "flex justify-center w-full", children: /* @__PURE__ */ jsx21(Typography, { variant: "label-xs-bold", className: "text-secondary", children: text }) }) }) });
4849
+ return /* @__PURE__ */ jsx23("g", { children: /* @__PURE__ */ jsx23("foreignObject", { x, y: y + yOffset, width, height: 20, children: /* @__PURE__ */ jsx23("div", { className: "flex justify-center w-full", children: /* @__PURE__ */ jsx23(Typography, { variant: "label-xs-bold", className: "text-secondary", children: text }) }) }) });
3947
4850
  };
3948
4851
  CustomXAxisLabel.displayName = "CustomXAxisLabel";
3949
4852
  return CustomXAxisLabel;
@@ -3953,7 +4856,7 @@ var createCustomYAxisLabel = (text, leftMargin) => {
3953
4856
  if (!viewBox) return null;
3954
4857
  const { x, y, height } = viewBox;
3955
4858
  const offset = leftMargin ? leftMargin + 10 : 110;
3956
- return /* @__PURE__ */ jsx21("g", { children: /* @__PURE__ */ jsx21("foreignObject", { x: x - offset, y, width: 100, height, children: /* @__PURE__ */ jsx21("div", { className: "flex items-center justify-center h-full transform -rotate-90 whitespace-nowrap", children: /* @__PURE__ */ jsx21(Typography, { variant: "label-xs-bold", className: "text-secondary", children: text }) }) }) });
4859
+ return /* @__PURE__ */ jsx23("g", { children: /* @__PURE__ */ jsx23("foreignObject", { x: x - offset, y, width: 100, height, children: /* @__PURE__ */ jsx23("div", { className: "flex items-center justify-center h-full transform -rotate-90 whitespace-nowrap", children: /* @__PURE__ */ jsx23(Typography, { variant: "label-xs-bold", className: "text-secondary", children: text }) }) }) });
3957
4860
  };
3958
4861
  CustomYAxisLabel.displayName = "CustomYAxisLabel";
3959
4862
  return CustomYAxisLabel;
@@ -3962,14 +4865,14 @@ var createCustomYAxisRightLabel = (text) => {
3962
4865
  const CustomYAxisRightLabel = ({ viewBox }) => {
3963
4866
  if (!viewBox) return null;
3964
4867
  const { x, y, width, height } = viewBox;
3965
- return /* @__PURE__ */ jsx21("g", { children: /* @__PURE__ */ jsx21("foreignObject", { x: x + width - 70, y, width: 120, height, children: /* @__PURE__ */ jsx21("div", { className: "flex items-center justify-center h-full transform rotate-90 whitespace-nowrap", children: /* @__PURE__ */ jsx21(Typography, { variant: "label-xs-bold", className: "text-secondary", children: text }) }) }) });
4868
+ return /* @__PURE__ */ jsx23("g", { children: /* @__PURE__ */ jsx23("foreignObject", { x: x + width - 70, y, width: 120, height, children: /* @__PURE__ */ jsx23("div", { className: "flex items-center justify-center h-full transform rotate-90 whitespace-nowrap", children: /* @__PURE__ */ jsx23(Typography, { variant: "label-xs-bold", className: "text-secondary", children: text }) }) }) });
3966
4869
  };
3967
4870
  CustomYAxisRightLabel.displayName = "CustomYAxisRightLabel";
3968
4871
  return CustomYAxisRightLabel;
3969
4872
  };
3970
4873
  var customXAxisTick = (props) => {
3971
4874
  const { x, y, payload } = props;
3972
- return /* @__PURE__ */ jsx21("g", { transform: `translate(${x},${y})`, children: /* @__PURE__ */ jsx21(
4875
+ return /* @__PURE__ */ jsx23("g", { transform: `translate(${x},${y})`, children: /* @__PURE__ */ jsx23(
3973
4876
  "foreignObject",
3974
4877
  {
3975
4878
  x: -20,
@@ -3977,12 +4880,12 @@ var customXAxisTick = (props) => {
3977
4880
  width: 40,
3978
4881
  height: 20,
3979
4882
  style: { overflow: "visible" },
3980
- children: /* @__PURE__ */ jsx21(
4883
+ children: /* @__PURE__ */ jsx23(
3981
4884
  "div",
3982
4885
  {
3983
4886
  className: "flex items-start justify-center h-full",
3984
4887
  style: { overflow: "visible" },
3985
- children: /* @__PURE__ */ jsx21(
4888
+ children: /* @__PURE__ */ jsx23(
3986
4889
  Typography,
3987
4890
  {
3988
4891
  variant: "body-xs",
@@ -3997,7 +4900,7 @@ var customXAxisTick = (props) => {
3997
4900
  };
3998
4901
  var customXAxisTickRotated = (props) => {
3999
4902
  const { x, y, payload } = props;
4000
- return /* @__PURE__ */ jsx21("g", { transform: `translate(${x},${y})`, children: /* @__PURE__ */ jsx21(
4903
+ return /* @__PURE__ */ jsx23("g", { transform: `translate(${x},${y})`, children: /* @__PURE__ */ jsx23(
4001
4904
  "text",
4002
4905
  {
4003
4906
  x: 0,
@@ -4016,25 +4919,25 @@ var customYAxisTick = (props) => {
4016
4919
  const { x, y, payload } = props;
4017
4920
  const text = String(payload.value);
4018
4921
  const estimatedWidth = Math.max(text.length * 8, 80);
4019
- return /* @__PURE__ */ jsx21(
4922
+ return /* @__PURE__ */ jsx23(
4020
4923
  "foreignObject",
4021
4924
  {
4022
4925
  x: x - estimatedWidth + 5,
4023
4926
  y: y - 6,
4024
4927
  width: estimatedWidth,
4025
4928
  height: 15,
4026
- children: /* @__PURE__ */ jsx21("div", { className: "flex justify-end w-full", children: /* @__PURE__ */ jsx21(Typography, { variant: "body-xs", className: "text-secondary", children: payload.value }) })
4929
+ children: /* @__PURE__ */ jsx23("div", { className: "flex justify-end w-full", children: /* @__PURE__ */ jsx23(Typography, { variant: "body-xs", className: "text-secondary", children: payload.value }) })
4027
4930
  }
4028
4931
  );
4029
4932
  };
4030
4933
 
4031
4934
  // src/components/ui/charts/chart-tooltip.tsx
4032
- import { Fragment, jsx as jsx22, jsxs as jsxs14 } from "react/jsx-runtime";
4935
+ import { Fragment as Fragment2, jsx as jsx24, jsxs as jsxs17 } from "react/jsx-runtime";
4033
4936
  function TooltipContainer({
4034
4937
  children,
4035
4938
  className = ""
4036
4939
  }) {
4037
- return /* @__PURE__ */ jsx22(
4940
+ return /* @__PURE__ */ jsx24(
4038
4941
  "div",
4039
4942
  {
4040
4943
  className: `bg-light border border-subtle rounded p-2.5 text-dark ${className}`,
@@ -4048,10 +4951,10 @@ function TooltipItem({
4048
4951
  value,
4049
4952
  className = ""
4050
4953
  }) {
4051
- return /* @__PURE__ */ jsxs14(Fragment, { children: [
4052
- /* @__PURE__ */ jsx22("br", {}),
4053
- /* @__PURE__ */ jsxs14(Typography, { variant: "label-sm", className, children: [
4054
- /* @__PURE__ */ jsx22(
4954
+ return /* @__PURE__ */ jsxs17(Fragment2, { children: [
4955
+ /* @__PURE__ */ jsx24("br", {}),
4956
+ /* @__PURE__ */ jsxs17(Typography, { variant: "label-sm", className, children: [
4957
+ /* @__PURE__ */ jsx24(
4055
4958
  "span",
4056
4959
  {
4057
4960
  className: "inline-block w-3 h-3 mr-1.5",
@@ -4069,9 +4972,9 @@ function GenericTooltip({
4069
4972
  items,
4070
4973
  className = ""
4071
4974
  }) {
4072
- return /* @__PURE__ */ jsxs14(TooltipContainer, { className, children: [
4073
- title && /* @__PURE__ */ jsx22(Typography, { variant: "label-sm-bold", children: title }),
4074
- items.map((item, index) => /* @__PURE__ */ jsx22(
4975
+ return /* @__PURE__ */ jsxs17(TooltipContainer, { className, children: [
4976
+ title && /* @__PURE__ */ jsx24(Typography, { variant: "label-sm-bold", children: title }),
4977
+ items.map((item, index) => /* @__PURE__ */ jsx24(
4075
4978
  TooltipItem,
4076
4979
  {
4077
4980
  color: item.color,
@@ -4093,7 +4996,7 @@ import {
4093
4996
  Tooltip as Tooltip2,
4094
4997
  ResponsiveContainer
4095
4998
  } from "recharts";
4096
- import { jsx as jsx23, jsxs as jsxs15 } from "react/jsx-runtime";
4999
+ import { jsx as jsx25, jsxs as jsxs18 } from "react/jsx-runtime";
4097
5000
  var BarChart = forwardRef15(
4098
5001
  ({
4099
5002
  data,
@@ -4120,19 +5023,19 @@ var BarChart = forwardRef15(
4120
5023
  };
4121
5024
  const defaultLegendItems = showLegend && legendItems.length === 0 ? [{ key: yAxisKey, color: barColor, label: yAxisKey }] : legendItems;
4122
5025
  const hasData = data && data.length > 0;
4123
- return /* @__PURE__ */ jsxs15(
5026
+ return /* @__PURE__ */ jsxs18(
4124
5027
  "div",
4125
5028
  {
4126
5029
  ref,
4127
5030
  className: `bg-light border border-subtle mx-6 ${className}`,
4128
5031
  children: [
4129
- /* @__PURE__ */ jsx23("div", { className: "flex items-center justify-between px-3 py-2 border-b border-subtle", children: /* @__PURE__ */ jsx23(Typography, { variant: "label-sm-bold", children: title }) }),
4130
- /* @__PURE__ */ jsx23("div", { className: "pt-2 px-2", children: hasData ? /* @__PURE__ */ jsx23(
5032
+ /* @__PURE__ */ jsx25("div", { className: "flex items-center justify-between px-3 py-2 border-b border-subtle", children: /* @__PURE__ */ jsx25(Typography, { variant: "label-sm-bold", children: title }) }),
5033
+ /* @__PURE__ */ jsx25("div", { className: "pt-2 px-2", children: hasData ? /* @__PURE__ */ jsx25(
4131
5034
  ResponsiveContainer,
4132
5035
  {
4133
5036
  width: "100%",
4134
5037
  height: CHART_CONSTANTS.STANDARD_HEIGHT,
4135
- children: /* @__PURE__ */ jsxs15(
5038
+ children: /* @__PURE__ */ jsxs18(
4136
5039
  RechartsBarChart,
4137
5040
  {
4138
5041
  data,
@@ -4144,7 +5047,7 @@ var BarChart = forwardRef15(
4144
5047
  onClick: handleClick,
4145
5048
  layout,
4146
5049
  children: [
4147
- /* @__PURE__ */ jsx23(
5050
+ /* @__PURE__ */ jsx25(
4148
5051
  XAxis,
4149
5052
  {
4150
5053
  dataKey: xAxisKey,
@@ -4158,7 +5061,7 @@ var BarChart = forwardRef15(
4158
5061
  label: xAxisLabel ? createCustomXAxisLabel(xAxisLabel, 80) : void 0
4159
5062
  }
4160
5063
  ),
4161
- /* @__PURE__ */ jsx23(
5064
+ /* @__PURE__ */ jsx25(
4162
5065
  YAxis,
4163
5066
  {
4164
5067
  axisLine: false,
@@ -4169,7 +5072,7 @@ var BarChart = forwardRef15(
4169
5072
  type: yAxisType
4170
5073
  }
4171
5074
  ),
4172
- /* @__PURE__ */ jsx23(
5075
+ /* @__PURE__ */ jsx25(
4173
5076
  Tooltip2,
4174
5077
  {
4175
5078
  content: ({
@@ -4178,7 +5081,7 @@ var BarChart = forwardRef15(
4178
5081
  label
4179
5082
  }) => {
4180
5083
  if (active && payload && payload.length) {
4181
- return /* @__PURE__ */ jsx23(
5084
+ return /* @__PURE__ */ jsx25(
4182
5085
  GenericTooltip,
4183
5086
  {
4184
5087
  title: label?.toString(),
@@ -4194,7 +5097,7 @@ var BarChart = forwardRef15(
4194
5097
  }
4195
5098
  }
4196
5099
  ),
4197
- /* @__PURE__ */ jsx23(
5100
+ /* @__PURE__ */ jsx25(
4198
5101
  Bar,
4199
5102
  {
4200
5103
  dataKey: barDataKey || yAxisKey,
@@ -4202,12 +5105,12 @@ var BarChart = forwardRef15(
4202
5105
  name: barDataKey || yAxisKey
4203
5106
  }
4204
5107
  ),
4205
- showLegend && defaultLegendItems.length > 0 && /* @__PURE__ */ jsx23(ChartLegend, { items: defaultLegendItems })
5108
+ showLegend && defaultLegendItems.length > 0 && /* @__PURE__ */ jsx25(ChartLegend, { items: defaultLegendItems })
4206
5109
  ]
4207
5110
  }
4208
5111
  )
4209
5112
  }
4210
- ) : /* @__PURE__ */ jsx23("div", { className: "flex items-center justify-center h-[500px]", children: /* @__PURE__ */ jsx23(Typography, { variant: "body-md", className: "text-secondary", children: "No data is available" }) }) })
5113
+ ) : /* @__PURE__ */ jsx25("div", { className: "flex items-center justify-center h-[500px]", children: /* @__PURE__ */ jsx25(Typography, { variant: "body-md", className: "text-secondary", children: "No data is available" }) }) })
4211
5114
  ]
4212
5115
  }
4213
5116
  );
@@ -4225,7 +5128,7 @@ import {
4225
5128
  Tooltip as Tooltip3,
4226
5129
  ResponsiveContainer as ResponsiveContainer2
4227
5130
  } from "recharts";
4228
- import { jsx as jsx24, jsxs as jsxs16 } from "react/jsx-runtime";
5131
+ import { jsx as jsx26, jsxs as jsxs19 } from "react/jsx-runtime";
4229
5132
  var LineChart = forwardRef16(
4230
5133
  ({
4231
5134
  data,
@@ -4254,19 +5157,19 @@ var LineChart = forwardRef16(
4254
5157
  )
4255
5158
  );
4256
5159
  const hasData = data && data.length > 0;
4257
- return /* @__PURE__ */ jsxs16(
5160
+ return /* @__PURE__ */ jsxs19(
4258
5161
  "div",
4259
5162
  {
4260
5163
  ref,
4261
5164
  className: `bg-light border border-subtle mx-6 ${className}`,
4262
5165
  children: [
4263
- /* @__PURE__ */ jsx24("div", { className: "flex items-center justify-between px-3 py-2 border-b border-subtle", children: /* @__PURE__ */ jsx24(Typography, { variant: "label-sm-bold", children: title }) }),
4264
- /* @__PURE__ */ jsx24("div", { className: "pt-2 px-2", children: hasData ? /* @__PURE__ */ jsx24(
5166
+ /* @__PURE__ */ jsx26("div", { className: "flex items-center justify-between px-3 py-2 border-b border-subtle", children: /* @__PURE__ */ jsx26(Typography, { variant: "label-sm-bold", children: title }) }),
5167
+ /* @__PURE__ */ jsx26("div", { className: "pt-2 px-2", children: hasData ? /* @__PURE__ */ jsx26(
4265
5168
  ResponsiveContainer2,
4266
5169
  {
4267
5170
  width: "100%",
4268
5171
  height: CHART_CONSTANTS.STANDARD_HEIGHT,
4269
- children: /* @__PURE__ */ jsxs16(
5172
+ children: /* @__PURE__ */ jsxs19(
4270
5173
  RechartsLineChart,
4271
5174
  {
4272
5175
  data,
@@ -4277,7 +5180,7 @@ var LineChart = forwardRef16(
4277
5180
  },
4278
5181
  onClick: handleClick,
4279
5182
  children: [
4280
- /* @__PURE__ */ jsx24(
5183
+ /* @__PURE__ */ jsx26(
4281
5184
  XAxis2,
4282
5185
  {
4283
5186
  dataKey: xAxisKey,
@@ -4289,7 +5192,7 @@ var LineChart = forwardRef16(
4289
5192
  label: xAxisLabel ? createCustomXAxisLabel(xAxisLabel) : void 0
4290
5193
  }
4291
5194
  ),
4292
- /* @__PURE__ */ jsx24(
5195
+ /* @__PURE__ */ jsx26(
4293
5196
  YAxis2,
4294
5197
  {
4295
5198
  axisLine: false,
@@ -4298,7 +5201,7 @@ var LineChart = forwardRef16(
4298
5201
  label: yAxisLabel ? createCustomYAxisLabel(yAxisLabel, 40) : void 0
4299
5202
  }
4300
5203
  ),
4301
- /* @__PURE__ */ jsx24(
5204
+ /* @__PURE__ */ jsx26(
4302
5205
  Tooltip3,
4303
5206
  {
4304
5207
  content: ({
@@ -4307,7 +5210,7 @@ var LineChart = forwardRef16(
4307
5210
  label
4308
5211
  }) => {
4309
5212
  if (active && payload && payload.length) {
4310
- return /* @__PURE__ */ jsx24(
5213
+ return /* @__PURE__ */ jsx26(
4311
5214
  GenericTooltip,
4312
5215
  {
4313
5216
  title: label?.toString(),
@@ -4323,7 +5226,7 @@ var LineChart = forwardRef16(
4323
5226
  }
4324
5227
  }
4325
5228
  ),
4326
- series.map((s, index) => /* @__PURE__ */ jsx24(
5229
+ series.map((s, index) => /* @__PURE__ */ jsx26(
4327
5230
  Line,
4328
5231
  {
4329
5232
  type: "monotone",
@@ -4335,12 +5238,12 @@ var LineChart = forwardRef16(
4335
5238
  },
4336
5239
  s.dataKey
4337
5240
  )),
4338
- showLegend && defaultLegendItems.length > 0 && /* @__PURE__ */ jsx24(ChartLegend, { items: defaultLegendItems })
5241
+ showLegend && defaultLegendItems.length > 0 && /* @__PURE__ */ jsx26(ChartLegend, { items: defaultLegendItems })
4339
5242
  ]
4340
5243
  }
4341
5244
  )
4342
5245
  }
4343
- ) : /* @__PURE__ */ jsx24("div", { className: "flex items-center justify-center h-[500px]", children: /* @__PURE__ */ jsx24(Typography, { variant: "body-md", className: "text-secondary", children: "No data is available" }) }) })
5246
+ ) : /* @__PURE__ */ jsx26("div", { className: "flex items-center justify-center h-[500px]", children: /* @__PURE__ */ jsx26(Typography, { variant: "body-md", className: "text-secondary", children: "No data is available" }) }) })
4344
5247
  ]
4345
5248
  }
4346
5249
  );
@@ -4351,7 +5254,7 @@ LineChart.displayName = "LineChart";
4351
5254
  // src/components/ui/charts/pie-chart.tsx
4352
5255
  import { forwardRef as forwardRef17 } from "react";
4353
5256
  import { PieChart as RechartsPieChart, Pie, Cell, Tooltip as Tooltip4 } from "recharts";
4354
- import { jsx as jsx25, jsxs as jsxs17 } from "react/jsx-runtime";
5257
+ import { jsx as jsx27, jsxs as jsxs20 } from "react/jsx-runtime";
4355
5258
  var PieChart = forwardRef17(
4356
5259
  ({
4357
5260
  data,
@@ -4379,20 +5282,20 @@ var PieChart = forwardRef17(
4379
5282
  )
4380
5283
  );
4381
5284
  const hasData = data && data.length > 0;
4382
- return /* @__PURE__ */ jsxs17(
5285
+ return /* @__PURE__ */ jsxs20(
4383
5286
  "div",
4384
5287
  {
4385
5288
  ref,
4386
5289
  className: `bg-light border border-subtle mx-6 ${className}`,
4387
5290
  children: [
4388
- /* @__PURE__ */ jsx25("div", { className: "flex items-center justify-between px-3 py-2 border-b border-subtle", children: /* @__PURE__ */ jsx25(Typography, { variant: "label-sm-bold", children: title }) }),
4389
- /* @__PURE__ */ jsx25("div", { className: "pt-2 px-2", children: hasData ? /* @__PURE__ */ jsx25("div", { className: "flex justify-center", children: /* @__PURE__ */ jsxs17(
5291
+ /* @__PURE__ */ jsx27("div", { className: "flex items-center justify-between px-3 py-2 border-b border-subtle", children: /* @__PURE__ */ jsx27(Typography, { variant: "label-sm-bold", children: title }) }),
5292
+ /* @__PURE__ */ jsx27("div", { className: "pt-2 px-2", children: hasData ? /* @__PURE__ */ jsx27("div", { className: "flex justify-center", children: /* @__PURE__ */ jsxs20(
4390
5293
  RechartsPieChart,
4391
5294
  {
4392
5295
  width: 600,
4393
5296
  height: CHART_CONSTANTS.LARGE_HEIGHT,
4394
5297
  children: [
4395
- /* @__PURE__ */ jsx25(
5298
+ /* @__PURE__ */ jsx27(
4396
5299
  Pie,
4397
5300
  {
4398
5301
  data,
@@ -4404,7 +5307,7 @@ var PieChart = forwardRef17(
4404
5307
  label: showLabels,
4405
5308
  labelLine: false,
4406
5309
  onClick: handleClick,
4407
- children: data.map((entry, index) => /* @__PURE__ */ jsx25(
5310
+ children: data.map((entry, index) => /* @__PURE__ */ jsx27(
4408
5311
  Cell,
4409
5312
  {
4410
5313
  fill: entry.color || getSeriesColor(index)
@@ -4413,7 +5316,7 @@ var PieChart = forwardRef17(
4413
5316
  ))
4414
5317
  }
4415
5318
  ),
4416
- /* @__PURE__ */ jsx25(
5319
+ /* @__PURE__ */ jsx27(
4417
5320
  Tooltip4,
4418
5321
  {
4419
5322
  content: ({
@@ -4422,7 +5325,7 @@ var PieChart = forwardRef17(
4422
5325
  }) => {
4423
5326
  if (active && payload && payload.length && payload[0]) {
4424
5327
  const data2 = payload[0].payload;
4425
- return /* @__PURE__ */ jsx25(
5328
+ return /* @__PURE__ */ jsx27(
4426
5329
  GenericTooltip,
4427
5330
  {
4428
5331
  title: data2.name,
@@ -4440,10 +5343,10 @@ var PieChart = forwardRef17(
4440
5343
  }
4441
5344
  }
4442
5345
  ),
4443
- showLegend && defaultLegendItems.length > 0 && /* @__PURE__ */ jsx25(ChartLegend, { items: defaultLegendItems, y: 400 })
5346
+ showLegend && defaultLegendItems.length > 0 && /* @__PURE__ */ jsx27(ChartLegend, { items: defaultLegendItems, y: 400 })
4444
5347
  ]
4445
5348
  }
4446
- ) }) : /* @__PURE__ */ jsx25("div", { className: "flex items-center justify-center h-[500px]", children: /* @__PURE__ */ jsx25(Typography, { variant: "body-md", className: "text-secondary", children: "No data is available" }) }) })
5349
+ ) }) : /* @__PURE__ */ jsx27("div", { className: "flex items-center justify-center h-[500px]", children: /* @__PURE__ */ jsx27(Typography, { variant: "body-md", className: "text-secondary", children: "No data is available" }) }) })
4447
5350
  ]
4448
5351
  }
4449
5352
  );
@@ -4452,11 +5355,11 @@ var PieChart = forwardRef17(
4452
5355
  PieChart.displayName = "PieChart";
4453
5356
 
4454
5357
  // src/components/ui/table.tsx
4455
- import { useCallback as useCallback6 } from "react";
5358
+ import { useCallback as useCallback9 } from "react";
4456
5359
  import {
4457
5360
  flexRender
4458
5361
  } from "@tanstack/react-table";
4459
- import { Fragment as Fragment2, jsx as jsx26, jsxs as jsxs18 } from "react/jsx-runtime";
5362
+ import { Fragment as Fragment3, jsx as jsx28, jsxs as jsxs21 } from "react/jsx-runtime";
4460
5363
  function Table({
4461
5364
  table,
4462
5365
  className,
@@ -4468,33 +5371,33 @@ function Table({
4468
5371
  const totalPages = table.getPageCount();
4469
5372
  const totalRows = table.getFilteredRowModel().rows.length;
4470
5373
  const showingText = totalRows > 0 ? "Showing " + (currentPage * pageSize + 1) + "-" + Math.min((currentPage + 1) * pageSize, totalRows) + " of " + totalRows + " results" : "No results found";
4471
- const handlePreviousPage = useCallback6(() => {
5374
+ const handlePreviousPage = useCallback9(() => {
4472
5375
  table.previousPage();
4473
5376
  }, [table]);
4474
- const handleNextPage = useCallback6(() => {
5377
+ const handleNextPage = useCallback9(() => {
4475
5378
  table.nextPage();
4476
5379
  }, [table]);
4477
- const handlePageChange = useCallback6(
5380
+ const handlePageChange = useCallback9(
4478
5381
  (pageIndex) => {
4479
5382
  table.setPageIndex(pageIndex);
4480
5383
  },
4481
5384
  [table]
4482
5385
  );
4483
- const handlePageSizeChange = useCallback6(
5386
+ const handlePageSizeChange = useCallback9(
4484
5387
  (value) => {
4485
5388
  table.setPageSize(Number(value));
4486
5389
  },
4487
5390
  [table]
4488
5391
  );
4489
- return /* @__PURE__ */ jsxs18("div", { children: [
4490
- /* @__PURE__ */ jsx26("div", { className: cn("overflow-x-auto", className), children: /* @__PURE__ */ jsxs18("table", { className: "min-w-full divide-y divide-border", children: [
4491
- /* @__PURE__ */ jsx26("thead", { className: "bg-dark text-light", children: table.getHeaderGroups().map((headerGroup) => /* @__PURE__ */ jsx26("tr", { children: headerGroup.headers.map((header) => /* @__PURE__ */ jsx26("th", { className: "px-6 py-3 text-left", children: /* @__PURE__ */ jsxs18(
5392
+ return /* @__PURE__ */ jsxs21("div", { children: [
5393
+ /* @__PURE__ */ jsx28("div", { className: cn("overflow-x-auto", className), children: /* @__PURE__ */ jsxs21("table", { className: "min-w-full divide-y divide-border", children: [
5394
+ /* @__PURE__ */ jsx28("thead", { className: "bg-dark text-light", children: table.getHeaderGroups().map((headerGroup) => /* @__PURE__ */ jsx28("tr", { children: headerGroup.headers.map((header) => /* @__PURE__ */ jsx28("th", { className: "px-6 py-3 text-left", children: /* @__PURE__ */ jsxs21(
4492
5395
  "div",
4493
5396
  {
4494
5397
  className: `flex items-center space-x-1 ${header.column.getCanSort() ? "cursor-pointer select-none" : ""}`,
4495
5398
  onClick: header.column.getToggleSortingHandler(),
4496
5399
  children: [
4497
- /* @__PURE__ */ jsx26(
5400
+ /* @__PURE__ */ jsx28(
4498
5401
  Typography,
4499
5402
  {
4500
5403
  variant: "label-xs",
@@ -4505,19 +5408,19 @@ function Table({
4505
5408
  )
4506
5409
  }
4507
5410
  ),
4508
- header.column.getCanSort() && /* @__PURE__ */ jsxs18("span", { className: "ml-1", children: [
4509
- header.column.getIsSorted() === "asc" && /* @__PURE__ */ jsx26(ChevronUp, { className: "w-4 h-4 text-light" }),
4510
- header.column.getIsSorted() === "desc" && /* @__PURE__ */ jsx26(ChevronDown, { className: "w-4 h-4 text-light" })
5411
+ header.column.getCanSort() && /* @__PURE__ */ jsxs21("span", { className: "ml-1", children: [
5412
+ header.column.getIsSorted() === "asc" && /* @__PURE__ */ jsx28(ChevronUp, { className: "w-4 h-4 text-light" }),
5413
+ header.column.getIsSorted() === "desc" && /* @__PURE__ */ jsx28(ChevronDown, { className: "w-4 h-4 text-light" })
4511
5414
  ] })
4512
5415
  ]
4513
5416
  }
4514
5417
  ) }, header.id)) }, headerGroup.id)) }),
4515
- /* @__PURE__ */ jsx26("tbody", { className: "bg-light divide-y divide-border", children: table.getRowModel().rows.map((row) => /* @__PURE__ */ jsx26("tr", { children: row.getVisibleCells().map((cell) => /* @__PURE__ */ jsx26("td", { className: "px-6 py-4 whitespace-nowrap", children: /* @__PURE__ */ jsx26(Typography, { variant: "body-sm", children: flexRender(
5418
+ /* @__PURE__ */ jsx28("tbody", { className: "bg-light divide-y divide-border", children: table.getRowModel().rows.map((row) => /* @__PURE__ */ jsx28("tr", { children: row.getVisibleCells().map((cell) => /* @__PURE__ */ jsx28("td", { className: "px-6 py-4 whitespace-nowrap", children: /* @__PURE__ */ jsx28(Typography, { variant: "body-sm", children: flexRender(
4516
5419
  cell.column.columnDef.cell,
4517
5420
  cell.getContext()
4518
5421
  ) }) }, cell.id)) }, row.id)) })
4519
5422
  ] }) }),
4520
- showPagination && /* @__PURE__ */ jsxs18(
5423
+ showPagination && /* @__PURE__ */ jsxs21(
4521
5424
  "div",
4522
5425
  {
4523
5426
  className: cn(
@@ -4525,9 +5428,9 @@ function Table({
4525
5428
  paginationClassName
4526
5429
  ),
4527
5430
  children: [
4528
- /* @__PURE__ */ jsx26("div", { className: "flex items-center", children: /* @__PURE__ */ jsx26(Typography, { variant: "body-sm", className: "text-secondary", children: showingText }) }),
4529
- /* @__PURE__ */ jsxs18("div", { className: "flex items-center space-x-1", children: [
4530
- /* @__PURE__ */ jsx26(
5431
+ /* @__PURE__ */ jsx28("div", { className: "flex items-center", children: /* @__PURE__ */ jsx28(Typography, { variant: "body-sm", className: "text-secondary", children: showingText }) }),
5432
+ /* @__PURE__ */ jsxs21("div", { className: "flex items-center space-x-1", children: [
5433
+ /* @__PURE__ */ jsx28(
4531
5434
  Button,
4532
5435
  {
4533
5436
  variant: "ghost",
@@ -4535,7 +5438,7 @@ function Table({
4535
5438
  onClick: handlePreviousPage,
4536
5439
  disabled: !table.getCanPreviousPage(),
4537
5440
  className: "p-2",
4538
- children: /* @__PURE__ */ jsx26(ChevronLeft, { className: "w-4 h-4" })
5441
+ children: /* @__PURE__ */ jsx28(ChevronLeft, { className: "w-4 h-4" })
4539
5442
  }
4540
5443
  ),
4541
5444
  Array.from(
@@ -4552,7 +5455,7 @@ function Table({
4552
5455
  pageNumber = currentPage - 2 + i;
4553
5456
  }
4554
5457
  const isActive = pageNumber === currentPage;
4555
- return /* @__PURE__ */ jsx26(
5458
+ return /* @__PURE__ */ jsx28(
4556
5459
  Button,
4557
5460
  {
4558
5461
  variant: isActive ? "default" : "ghost",
@@ -4565,11 +5468,11 @@ function Table({
4565
5468
  );
4566
5469
  }
4567
5470
  ),
4568
- table.getPageCount() > 5 && currentPage < totalPages - 3 && /* @__PURE__ */ jsxs18(Fragment2, { children: [
4569
- /* @__PURE__ */ jsx26("span", { className: "px-1 text-secondary", children: "..." }),
4570
- /* @__PURE__ */ jsx26(Typography, { variant: "body-sm", className: "text-secondary", children: totalPages })
5471
+ table.getPageCount() > 5 && currentPage < totalPages - 3 && /* @__PURE__ */ jsxs21(Fragment3, { children: [
5472
+ /* @__PURE__ */ jsx28("span", { className: "px-1 text-secondary", children: "..." }),
5473
+ /* @__PURE__ */ jsx28(Typography, { variant: "body-sm", className: "text-secondary", children: totalPages })
4571
5474
  ] }),
4572
- /* @__PURE__ */ jsx26(
5475
+ /* @__PURE__ */ jsx28(
4573
5476
  Button,
4574
5477
  {
4575
5478
  variant: "ghost",
@@ -4577,12 +5480,12 @@ function Table({
4577
5480
  onClick: handleNextPage,
4578
5481
  disabled: !table.getCanNextPage(),
4579
5482
  className: "p-2",
4580
- children: /* @__PURE__ */ jsx26(ChevronRight, { className: "w-4 h-4" })
5483
+ children: /* @__PURE__ */ jsx28(ChevronRight, { className: "w-4 h-4" })
4581
5484
  }
4582
5485
  )
4583
5486
  ] }),
4584
- /* @__PURE__ */ jsxs18("div", { className: "flex items-center gap-3 w-48", children: [
4585
- /* @__PURE__ */ jsx26(
5487
+ /* @__PURE__ */ jsxs21("div", { className: "flex items-center gap-3 w-48", children: [
5488
+ /* @__PURE__ */ jsx28(
4586
5489
  Typography,
4587
5490
  {
4588
5491
  variant: "body-sm",
@@ -4590,14 +5493,14 @@ function Table({
4590
5493
  children: "Rows per page:"
4591
5494
  }
4592
5495
  ),
4593
- /* @__PURE__ */ jsxs18(
5496
+ /* @__PURE__ */ jsxs21(
4594
5497
  Select,
4595
5498
  {
4596
5499
  value: table.getState().pagination.pageSize.toString(),
4597
5500
  onValueChange: handlePageSizeChange,
4598
5501
  children: [
4599
- /* @__PURE__ */ jsx26(SelectTrigger, { className: "min-w-0 h-8", children: /* @__PURE__ */ jsx26(SelectValue, {}) }),
4600
- /* @__PURE__ */ jsx26(SelectContent, { children: [10, 20, 50, 100].map((size) => /* @__PURE__ */ jsx26(SelectItem, { value: size.toString(), children: size }, size)) })
5502
+ /* @__PURE__ */ jsx28(SelectTrigger, { className: "min-w-0 h-8", children: /* @__PURE__ */ jsx28(SelectValue, {}) }),
5503
+ /* @__PURE__ */ jsx28(SelectContent, { children: [10, 20, 50, 100].map((size) => /* @__PURE__ */ jsx28(SelectItem, { value: size.toString(), children: size }, size)) })
4601
5504
  ]
4602
5505
  }
4603
5506
  )