@akshar-technosoft/ui 1.0.21 → 1.0.23
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/components/core/error.cjs.map +1 -1
- package/dist/components/core/error.js.map +1 -1
- package/dist/components/core/event-success.cjs.map +1 -1
- package/dist/components/core/event-success.js.map +1 -1
- package/dist/components/core/index.cjs.map +1 -1
- package/dist/components/core/index.js.map +1 -1
- package/dist/components/core/notfound.cjs.map +1 -1
- package/dist/components/core/notfound.js.map +1 -1
- package/dist/components/core/unauthorized.cjs.map +1 -1
- package/dist/components/core/unauthorized.js.map +1 -1
- package/dist/components/data/data-table/data-table-action-bar.cjs.map +1 -1
- package/dist/components/data/data-table/data-table-action-bar.js.map +1 -1
- package/dist/components/data/data-table/data-table-column-header.cjs.map +1 -1
- package/dist/components/data/data-table/data-table-column-header.js.map +1 -1
- package/dist/components/data/data-table/data-table-faceted-filter.cjs.map +1 -1
- package/dist/components/data/data-table/data-table-faceted-filter.js.map +1 -1
- package/dist/components/data/data-table/data-table-pagination.cjs.map +1 -1
- package/dist/components/data/data-table/data-table-pagination.js.map +1 -1
- package/dist/components/data/data-table/data-table-toolbar.cjs +1 -1
- package/dist/components/data/data-table/data-table-toolbar.cjs.map +1 -1
- package/dist/components/data/data-table/data-table-toolbar.d.cts +1 -4
- package/dist/components/data/data-table/data-table-toolbar.d.ts +1 -4
- package/dist/components/data/data-table/data-table-toolbar.js +1 -1
- package/dist/components/data/data-table/data-table-toolbar.js.map +1 -1
- package/dist/components/data/data-table/data-table-types.cjs.map +1 -1
- package/dist/components/data/data-table/data-table-types.d.cts +0 -1
- package/dist/components/data/data-table/data-table-types.d.ts +0 -1
- package/dist/components/data/data-table/data-table-view-options.cjs.map +1 -1
- package/dist/components/data/data-table/data-table-view-options.js.map +1 -1
- package/dist/components/data/data-table/data-table.cjs +1 -1
- package/dist/components/data/data-table/data-table.cjs.map +1 -1
- package/dist/components/data/data-table/data-table.js +1 -1
- package/dist/components/data/data-table/data-table.js.map +1 -1
- package/dist/components/data/data-table/index.cjs +1 -1
- package/dist/components/data/data-table/index.cjs.map +1 -1
- package/dist/components/data/data-table/index.js +1 -1
- package/dist/components/data/data-table/index.js.map +1 -1
- package/dist/components/data/data-template/data-template-action-bar.cjs.map +1 -1
- package/dist/components/data/data-template/data-template-action-bar.js.map +1 -1
- package/dist/components/data/data-template/data-template-pagination.cjs.map +1 -1
- package/dist/components/data/data-template/data-template-pagination.js.map +1 -1
- package/dist/components/data/data-template/data-template-toolbar.cjs.map +1 -1
- package/dist/components/data/data-template/data-template-toolbar.js.map +1 -1
- package/dist/components/data/data-template/data-template.cjs.map +1 -1
- package/dist/components/data/data-template/data-template.js.map +1 -1
- package/dist/components/data/data-template/index.cjs.map +1 -1
- package/dist/components/data/data-template/index.js.map +1 -1
- package/dist/components/general.cjs.map +1 -1
- package/dist/components/general.js.map +1 -1
- package/dist/components/helper/date-filter.cjs.map +1 -1
- package/dist/components/helper/date-filter.js.map +1 -1
- package/dist/components/layouts/app-content.cjs +1 -1
- package/dist/components/layouts/app-content.cjs.map +1 -1
- package/dist/components/layouts/app-content.js +1 -1
- package/dist/components/layouts/app-content.js.map +1 -1
- package/dist/components/layouts/app-header.cjs.map +1 -1
- package/dist/components/layouts/app-header.js.map +1 -1
- package/dist/components/layouts/factories.cjs +1 -1
- package/dist/components/layouts/factories.cjs.map +1 -1
- package/dist/components/layouts/factories.js +1 -1
- package/dist/components/layouts/factories.js.map +1 -1
- package/dist/components/layouts/index.cjs +1 -1
- package/dist/components/layouts/index.cjs.map +1 -1
- package/dist/components/layouts/index.js +1 -1
- package/dist/components/layouts/index.js.map +1 -1
- package/dist/components/ui/badge.cjs.map +1 -1
- package/dist/components/ui/badge.js.map +1 -1
- package/dist/components/ui/button.cjs.map +1 -1
- package/dist/components/ui/button.js.map +1 -1
- package/dist/components/ui/calendar.cjs.map +1 -1
- package/dist/components/ui/calendar.js.map +1 -1
- package/dist/components/ui/card.cjs.map +1 -1
- package/dist/components/ui/card.js.map +1 -1
- package/dist/components/ui/checkbox.cjs.map +1 -1
- package/dist/components/ui/checkbox.js.map +1 -1
- package/dist/components/ui/command.cjs.map +1 -1
- package/dist/components/ui/command.js.map +1 -1
- package/dist/components/ui/dialog.cjs.map +1 -1
- package/dist/components/ui/dialog.js.map +1 -1
- package/dist/components/ui/dropdown-menu.cjs.map +1 -1
- package/dist/components/ui/dropdown-menu.js.map +1 -1
- package/dist/components/ui/input.cjs.map +1 -1
- package/dist/components/ui/input.js.map +1 -1
- package/dist/components/ui/popover.cjs.map +1 -1
- package/dist/components/ui/popover.js.map +1 -1
- package/dist/components/ui/select.cjs.map +1 -1
- package/dist/components/ui/select.js.map +1 -1
- package/dist/components/ui/separator.cjs.map +1 -1
- package/dist/components/ui/separator.js.map +1 -1
- package/dist/components/ui/sheet.cjs.map +1 -1
- package/dist/components/ui/sheet.js.map +1 -1
- package/dist/components/ui/table.cjs.map +1 -1
- package/dist/components/ui/table.js.map +1 -1
- package/dist/components/ui/toggle.cjs.map +1 -1
- package/dist/components/ui/toggle.js.map +1 -1
- package/dist/components/ui/tooltip.cjs.map +1 -1
- package/dist/components/ui/tooltip.js.map +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
"use client"
|
|
2
|
-
import{flexRender as lo,getCoreRowModel as Xn,getFilteredRowModel as Kn,getPaginationRowModel as Jn,getSortedRowModel as Qn,useReactTable as Yn}from"@tanstack/react-table";import{Loader2 as Eo,ChevronUp as co,ChevronDown as mo,ChevronsUpDown as Zn,MoreHorizontal as ea,MoveRightIcon as ta,PinOffIcon as oa,Calculator as jo}from"lucide-react";import{Slot as bn}from"radix-ui";import{cva as vn}from"class-variance-authority";import{clsx as gn}from"clsx";import{twMerge as fn}from"tailwind-merge";function n(...e){return fn(gn(e))}import{jsx as hn}from"react/jsx-runtime";var ht=vn("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-all disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",{variants:{variant:{default:"bg-primary text-primary-foreground shadow-xs hover:bg-primary/90",destructive:"bg-destructive text-white shadow-xs hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",outline:"border bg-background shadow-xs hover:bg-accent hover:text-accent-foreground dark:bg-input/30 dark:border-input dark:hover:bg-input/50",secondary:"bg-secondary text-secondary-foreground shadow-xs hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2 has-[>svg]:px-3",sm:"h-8 rounded-md gap-1.5 px-3 has-[>svg]:px-2.5",lg:"h-10 rounded-md px-6 has-[>svg]:px-4",icon:"size-9"}},defaultVariants:{variant:"default",size:"default"}});function C({className:e,variant:o,size:r,asChild:g=!1,...v}){let p=g?bn.Slot:"button";return hn(p,{"data-slot":"button",className:n(ht({variant:o,size:r,className:e}),"transition-none"),...v})}import{jsx as ve}from"react/jsx-runtime";function qt({className:e,...o}){return ve("div",{"data-slot":"table-container",className:"relative w-full h-full max-h-full overflow-auto",children:ve("table",{"data-slot":"table",className:n("w-full caption-bottom text-sm",e),...o})})}function xo({className:e,...o}){return ve("thead",{"data-slot":"table-header",className:n("[&_tr]:border-b",e),...o})}function Co({className:e,...o}){return ve("tbody",{"data-slot":"table-body",className:n("[&_tr:last-child]:border-0",e),...o})}function Wt({className:e,...o}){return ve("tfoot",{"data-slot":"table-footer",className:n("bg-muted/50 border-t font-medium [&>tr]:last:border-b-0",e),...o})}function ce({className:e,...o}){return ve("tr",{"data-slot":"table-row",className:n("hover:bg-muted/50 data-[state=selected]:bg-muted border-b transition-colors",e),...o})}function yo({className:e,...o}){return ve("th",{"data-slot":"table-head",className:n("text-foreground h-10 px-2 text-left align-middle font-medium whitespace-nowrap",e),...o})}function me({className:e,...o}){return ve("td",{"data-slot":"table-cell",className:n("p-2 align-middle whitespace-nowrap",e),...o})}import{jsx as wo}from"react/jsx-runtime";function Xt({className:e,...o}){return wo("div",{"data-slot":"card",className:n("bg-card text-card-foreground flex flex-col gap-6 rounded-xl border py-6 shadow-sm",e),...o})}function Kt({className:e,...o}){return wo("div",{"data-slot":"card-content",className:n("px-6",e),...o})}import{Tooltip as Ve}from"radix-ui";import{jsx as Ae,jsxs as xn}from"react/jsx-runtime";function et({delayDuration:e=0,...o}){return Ae(Ve.Provider,{"data-slot":"tooltip-provider",delayDuration:e,...o})}function Jt({...e}){return Ae(et,{children:Ae(Ve.Root,{"data-slot":"tooltip",...e})})}function Qt({...e}){return Ae(Ve.Trigger,{"data-slot":"tooltip-trigger",...e})}function Yt({className:e,sideOffset:o=0,children:r,...g}){return Ae(Ve.Portal,{children:xn(Ve.Content,{"data-slot":"tooltip-content",sideOffset:o,className:n("bg-primary text-primary-foreground animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-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-fit origin-(--radix-tooltip-content-transform-origin) rounded-md px-3 py-1.5 text-xs text-balance",e),...g,children:[r,Ae(Ve.Arrow,{className:"bg-primary fill-primary z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px]"})]})})}import{Search as Io,RefreshCw as Fn,Download as _n,Settings2 as Vn,Filter as Fo,ArrowUpDown as An,PinOff as Bn,Pin as Ln,ChevronDown as Tt,Calculator as no,Check as ao}from"lucide-react";import{jsx as Cn}from"react/jsx-runtime";function Zt({className:e,type:o,...r}){return Cn("input",{type:o,"data-slot":"input",className:n("file:text-foreground placeholder:text-muted-foreground selection:bg-primary selection:text-primary-foreground dark:bg-input/30 border-input flex h-9 w-full min-w-0 rounded-md border bg-transparent px-3 py-1 text-base shadow-xs transition-[color,box-shadow] outline-none file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm","focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]","aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",e),...r})}import{Command as ke}from"cmdk";import{SearchIcon as yn}from"lucide-react";import{Dialog as Xa}from"radix-ui";import{XIcon as Ja}from"lucide-react";import{jsx as Za,jsxs as er}from"react/jsx-runtime";import{jsx as he,jsxs as wn}from"react/jsx-runtime";function xt({className:e,...o}){return he(ke,{"data-slot":"command",className:n("bg-popover text-popover-foreground flex h-full w-full flex-col overflow-hidden rounded-md",e),...o})}function Ct({className:e,...o}){return wn("div",{"data-slot":"command-input-wrapper",className:"flex h-9 items-center gap-2 border-b px-3",children:[he(yn,{className:"size-4 shrink-0 opacity-50"}),he(ke.Input,{"data-slot":"command-input",className:n("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",e),...o})]})}function yt({className:e,...o}){return he(ke.List,{"data-slot":"command-list",className:n("max-h-[300px] scroll-py-1 overflow-x-hidden overflow-y-auto",e),...o})}function wt({...e}){return he(ke.Empty,{"data-slot":"command-empty",className:"py-6 text-center text-sm",...e})}function tt({className:e,...o}){return he(ke.Group,{"data-slot":"command-group",className:n("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",e),...o})}function No({className:e,...o}){return he(ke.Separator,{"data-slot":"command-separator",className:n("bg-border -mx-1 h-px",e),...o})}function Be({className:e,...o}){return he(ke.Item,{"data-slot":"command-item",className:n("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",e),...o})}import{DropdownMenu as W}from"radix-ui";import{CheckIcon as Nn,ChevronRightIcon as Pn,CircleIcon as fr}from"lucide-react";import{jsx as G,jsxs as So}from"react/jsx-runtime";function ee({...e}){return G(W.Root,{"data-slot":"dropdown-menu",...e})}function te({...e}){return G(W.Trigger,{"data-slot":"dropdown-menu-trigger",...e})}function oe({className:e,sideOffset:o=4,...r}){return G(W.Portal,{children:G(W.Content,{"data-slot":"dropdown-menu-content",sideOffset:o,className:n("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-dropdown-menu-content-available-height) min-w-[8rem] origin-(--radix-dropdown-menu-content-transform-origin) rounded-md border p-1 shadow-md",e),...r})})}function eo({...e}){return G(W.Group,{"data-slot":"dropdown-menu-group",...e})}function I({className:e,inset:o,variant:r="default",...g}){return G(W.Item,{"data-slot":"dropdown-menu-item","data-inset":o,"data-variant":r,className:n("cursor-pointer 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 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",e),...g})}function Le({className:e,children:o,checked:r,...g}){return So(W.CheckboxItem,{"data-slot":"dropdown-menu-checkbox-item",className:n("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",e),checked:r,...g,children:[G("span",{className:"pointer-events-none absolute left-2 flex size-3.5 items-center justify-center",children:G(W.ItemIndicator,{children:G(Nn,{className:"size-4"})})}),o]})}function X({className:e,inset:o,...r}){return G(W.Label,{"data-slot":"dropdown-menu-label","data-inset":o,className:n("px-2 py-1.5 text-sm font-medium data-[inset]:pl-8",e),...r})}function J({className:e,...o}){return G(W.Separator,{"data-slot":"dropdown-menu-separator",className:n("bg-border -mx-1 my-1 h-px",e),...o})}function Po({...e}){return G(W.Sub,{"data-slot":"dropdown-menu-sub",...e})}function Do({className:e,inset:o,children:r,...g}){return So(W.SubTrigger,{"data-slot":"dropdown-menu-sub-trigger","data-inset":o,className:n("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",e),...g,children:[r,G(Pn,{className:"ml-auto size-4"})]})}function To({className:e,...o}){return G(W.SubContent,{"data-slot":"dropdown-menu-sub-content",className:n("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-dropdown-menu-content-transform-origin) overflow-hidden rounded-md border p-1 shadow-lg",e),...o})}import{useState as St}from"react";import{useEffect as zn,useState as to}from"react";import{Calendar as Mn}from"lucide-react";import{format as ot}from"date-fns";import{Popover as Nt}from"radix-ui";import{jsx as Pt}from"react/jsx-runtime";function He({...e}){return Pt(Nt.Root,{"data-slot":"popover",...e})}function Oe({...e}){return Pt(Nt.Trigger,{"data-slot":"popover-trigger",...e})}function Ge({className:e,align:o="center",sideOffset:r=4,...g}){return Pt(Nt.Portal,{children:Pt(Nt.Content,{"data-slot":"popover-content",align:o,sideOffset:r,className:n("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-72 origin-(--radix-popover-content-transform-origin) rounded-md border p-4 shadow-md outline-hidden",e),...g})})}import*as Dt from"react";import{ChevronDownIcon as Dn,ChevronLeftIcon as Tn,ChevronRightIcon as Sn}from"lucide-react";import{DayPicker as kn,getDefaultClassNames as ko}from"react-day-picker";import{jsx as xe}from"react/jsx-runtime";function Ro({className:e,classNames:o,showOutsideDays:r=!0,captionLayout:g="label",buttonVariant:v="ghost",formatters:p,components:k,...F}){let x=ko();return xe(kn,{showOutsideDays:r,className:n("bg-background group/calendar p-3 [--cell-size:--spacing(8)] [[data-slot=card-content]_&]:bg-transparent [[data-slot=popover-content]_&]:bg-transparent",String.raw`rtl:**:[.rdp-button\_next>svg]:rotate-180`,String.raw`rtl:**:[.rdp-button\_previous>svg]:rotate-180`,e),captionLayout:g,formatters:{formatMonthDropdown:P=>P.toLocaleString("default",{month:"short"}),...p},classNames:{root:n("w-fit",x.root),months:n("flex gap-4 flex-col md:flex-row relative",x.months),month:n("flex flex-col w-full gap-4",x.month),nav:n("flex items-center gap-1 w-full absolute top-0 inset-x-0 justify-between",x.nav),button_previous:n(ht({variant:v}),"size-(--cell-size) aria-disabled:opacity-50 p-0 select-none",x.button_previous),button_next:n(ht({variant:v}),"size-(--cell-size) aria-disabled:opacity-50 p-0 select-none",x.button_next),month_caption:n("flex items-center justify-center h-(--cell-size) w-full px-(--cell-size)",x.month_caption),dropdowns:n("w-full flex items-center text-sm font-medium justify-center h-(--cell-size) gap-1.5",x.dropdowns),dropdown_root:n("relative has-focus:border-ring border border-input shadow-xs has-focus:ring-ring/50 has-focus:ring-[3px] rounded-md",x.dropdown_root),dropdown:n("absolute bg-popover inset-0 opacity-0",x.dropdown),caption_label:n("select-none font-medium",g==="label"?"text-sm":"rounded-md pl-2 pr-1 flex items-center gap-1 text-sm h-8 [&>svg]:text-muted-foreground [&>svg]:size-3.5",x.caption_label),table:"w-full border-collapse",weekdays:n("flex",x.weekdays),weekday:n("text-muted-foreground rounded-md flex-1 font-normal text-[0.8rem] select-none",x.weekday),week:n("flex w-full mt-2",x.week),week_number_header:n("select-none w-(--cell-size)",x.week_number_header),week_number:n("text-[0.8rem] select-none text-muted-foreground",x.week_number),day:n("relative w-full h-full p-0 text-center [&:first-child[data-selected=true]_button]:rounded-l-md [&:last-child[data-selected=true]_button]:rounded-r-md group/day aspect-square select-none",x.day),range_start:n("rounded-l-md bg-accent",x.range_start),range_middle:n("rounded-none",x.range_middle),range_end:n("rounded-r-md bg-accent",x.range_end),today:n("bg-accent text-accent-foreground rounded-md data-[selected=true]:rounded-none",x.today),outside:n("text-muted-foreground aria-selected:text-muted-foreground",x.outside),disabled:n("text-muted-foreground opacity-50",x.disabled),hidden:n("invisible",x.hidden),...o},components:{Root:({className:P,rootRef:R,...H})=>xe("div",{"data-slot":"calendar",ref:R,className:n(P),...H}),Chevron:({className:P,orientation:R,...H})=>R==="left"?xe(Tn,{className:n("size-4",P),...H}):R==="right"?xe(Sn,{className:n("size-4",P),...H}):xe(Dn,{className:n("size-4",P),...H}),DayButton:Rn,WeekNumber:({children:P,...R})=>xe("td",{...R,children:xe("div",{className:"flex size-(--cell-size) items-center justify-center text-center",children:P})}),...k},...F})}function Rn({className:e,day:o,modifiers:r,...g}){let v=ko(),p=Dt.useRef(null);return Dt.useEffect(()=>{r.focused&&p.current?.focus()},[r.focused]),xe(C,{ref:p,variant:"ghost",size:"icon","data-day":o.date.toLocaleDateString(),"data-selected-single":r.selected&&!r.range_start&&!r.range_end&&!r.range_middle,"data-range-start":r.range_start,"data-range-end":r.range_end,"data-range-middle":r.range_middle,className:n("data-[selected-single=true]:bg-primary data-[selected-single=true]:text-primary-foreground data-[range-middle=true]:bg-accent data-[range-middle=true]:text-accent-foreground data-[range-start=true]:bg-primary data-[range-start=true]:text-primary-foreground data-[range-end=true]:bg-primary data-[range-end=true]:text-primary-foreground group-data-[focused=true]/day:border-ring group-data-[focused=true]/day:ring-ring/50 dark:hover:text-accent-foreground flex aspect-square size-auto w-full min-w-(--cell-size) flex-col gap-1 leading-none font-normal group-data-[focused=true]/day:relative group-data-[focused=true]/day:z-10 group-data-[focused=true]/day:ring-[3px] data-[range-end=true]:rounded-md data-[range-end=true]:rounded-r-md data-[range-middle=true]:rounded-none data-[range-start=true]:rounded-md data-[range-start=true]:rounded-l-md [&>span]:text-xs [&>span]:opacity-70",v.day,e),...g})}import{jsx as Re,jsxs as nt}from"react/jsx-runtime";function zo({value:e,onChange:o,placeholder:r,mode:g,externalSearch:v,onExternalChange:p,onlyExternal:k=!1}){let[F,x]=to(!1),[P,R]=to(e),[H,Y]=to(e);zn(()=>{k||Y(e)},[e,k]);let ue=()=>{k||o(P),Y(P),v&&p&&p(P),x(!1)},ae=()=>{R(H),x(!1)},K=()=>{let w=g==="single"?null:{from:null,to:null};R(w),k||o(w),Y(w),v&&p&&p(w),x(!1)},U=()=>{let w=k?H:e;return w?g==="single"?ot(w,"PPP"):w.from&&w.to?`${ot(w.from,"MMM dd")} - ${ot(w.to,"MMM dd, yyyy")}`:w.from?`From ${ot(w.from,"MMM dd, yyyy")}`:w.to?`To ${ot(w.to,"MMM dd, yyyy")}`:r:r},O=w=>{R(g==="single"?w:w||{from:null,to:null})};return nt(He,{open:F,onOpenChange:x,children:[Re(Oe,{className:"h-8",asChild:!0,children:nt(C,{variant:"outline",className:n("w-full justify-start text-left font-normal h-9",!U()&&"text-muted-foreground"),children:[Re(Mn,{className:"mr-2 h-4 w-4"}),U()]})}),nt(Ge,{className:"w-auto p-0",align:"start",children:[Re("div",{className:"p-3",children:Re(Ro,{mode:g,selected:P,onSelect:O,numberOfMonths:g==="range"?2:1,className:"rounded-md border",...g==="range"&&{required:!0}})}),nt("div",{className:"flex items-center justify-between p-3 border-t",children:[Re(C,{variant:"ghost",size:"sm",onClick:K,children:"Clear"}),nt("div",{className:"flex gap-2",children:[Re(C,{variant:"outline",size:"sm",onClick:ae,children:"Cancel"}),Re(C,{size:"sm",onClick:ue,disabled:g==="range"&&(!P?.from||!P?.to),children:"Apply"})]})]})]})]})}import{Checkbox as Mo}from"radix-ui";import{CheckIcon as In}from"lucide-react";import{jsx as oo}from"react/jsx-runtime";function at({className:e,...o}){return oo(Mo.Root,{"data-slot":"checkbox",className:n("peer border-input dark:bg-input/30 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground dark:data-[state=checked]:bg-primary data-[state=checked]:border-primary focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive size-4 shrink-0 rounded-[4px] border shadow-xs transition-shadow outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50",e),...o,children:oo(Mo.Indicator,{"data-slot":"checkbox-indicator",className:"flex items-center justify-center text-current transition-none",children:oo(In,{className:"size-3.5"})})})}import{Fragment as Hn,jsx as l,jsxs as b}from"react/jsx-runtime";var _o=[{value:"sum",label:"Sum",description:"Total of all values"},{value:"average",label:"Average",description:"Mean value"},{value:"min",label:"Minimum",description:"Smallest value"},{value:"max",label:"Maximum",description:"Largest value"},{value:"count",label:"Count",description:"Number of rows"},{value:"unique",label:"Unique",description:"Count of distinct values"},{value:"median",label:"Median",description:"Middle value"}];function ro({table:e,filters:o=[],globalFilter:r,onGlobalFilterChange:g,enableGlobalFilter:v=!0,onExport:p,onRefresh:k,loading:F=!1,enableColumnVisibility:x=!0,data:P,onClearSorting:R,onClearFilters:H,enableColumnPinning:Y=!1,onExternalSearch:ue,onCustomFilterChange:ae,aggregations:K={},onAggregationChange:U,enableGroupedGlobalFilter:O=!1,groupedFilterLabel:w="Search in",onGroupedFilterChange:ze}){let[re,dt]=St({}),[Me,ct]=St({}),[$e,It]=St({}),[we,Ft]=St("all"),qe=()=>e.getAllLeafColumns().filter(t=>t.getCanHide?.()!==!1),We=()=>e.getAllColumns().filter(t=>!e.getAllLeafColumns().includes(t)&&t.columns?.length&&t.columns.some(m=>m.getCanHide?.()!==!1)),mt=()=>{let t=new Set(We().flatMap(m=>m.columns?.filter(f=>f.getCanHide?.()!==!1).map(f=>f.id)||[]));return qe().filter(m=>!t.has(m.id))},ie=(t,m)=>m&&t.startsWith(`${m}.`)?t.replace(`${m}.`,"").split("_").map(D=>D.slice(1)).join(" "):t.split("_").map(f=>f.charAt(0).toUpperCase()+f.slice(1)).join(" "),le=(t,m)=>{let f={...re,[t]:m};dt(f)},_t=(t,m)=>{let f={...Me,[t]:m};ct(f),ae&&ae(t,m),o.find(D=>D.key===t)?.externalSearch&&le(t,m)},Vt=()=>{ue&&ue(re)},Xe=()=>{dt({}),ct({}),H(),ue&&ue({}),ae&&Object.keys(Me).forEach(t=>{ae(t,"")})},de=t=>o.find(f=>f.key===t)?.customFilter?Me[t]??"":e.getColumn(t)?.getFilterValue(),pe=(t,m)=>{let f=o.find(D=>D.key===t);f?.customFilter?_t(t,m):(e.getColumn(t)?.setFilterValue(m),f?.externalSearch&&le(t,m))},Ie=(t,m)=>{It(f=>({...f,[t]:m}))},Ke=t=>{if(U){let m=K[t],f={enabled:!m?.enabled,functions:m?.functions||["sum","average"]};U(t,f)}},ut=(t,m)=>{if(U){let D=K[t]?.functions||[],$=D.includes(m)?D.filter(Fe=>Fe!==m):[...D,m];U(t,{enabled:$.length>0,functions:$})}},ge=()=>{U&&Object.keys(K).forEach(t=>{let m=K[t];m&&U(t,{...m,enabled:!1,functions:[]})})},Ne=()=>qe().filter(t=>t.id==="select"||t.id==="serialNumber"?!1:t.columnDef.meta?.aggregatable?!0:e.getRowModel().rows.slice(0,5).some(D=>{let $=D.getValue(t.id);return typeof $=="number"||typeof $=="string"&&!isNaN(parseFloat(String($)))||typeof $=="object"&&$!==null&&"props"in $})),Pe=t=>{Ft(t),ze&&ze(t,r)},De=t=>{g(t),ze&&O&&ze(we,t)},pt=Ne(),Je=Object.values(K).some(t=>t?.enabled),Qe=[{value:"all",label:"All Fields"},...o.map(t=>({value:t.key,label:t.placeholder}))];return l("div",{className:"rounded-xl",children:l("div",{className:"px-2",children:l("div",{className:"flex flex-col gap-6",children:b("div",{className:"flex items-center justify-between",children:[l("div",{className:"flex items-center gap-3",children:o.length>0&&b("div",{className:"flex flex-wrap items-center gap-3",children:[l("div",{className:"flex items-center gap-2 text-sm font-medium text-muted-foreground",children:l(Fo,{className:"size-4"})}),o.map(t=>!e.getColumn(t.key)&&!t.customFilter&&!t.externalSearch?null:l("div",{className:n("relative min-w-[150px]",t.width),children:t.type==="select"?b(He,{open:$e[t.key],onOpenChange:f=>Ie(t.key,f),children:[l(Oe,{asChild:!0,children:b("div",{className:"relative w-full",children:[t.icon&&l(t.icon,{className:"absolute -translate-y-1/2 size-4 left-3 top-1/2 text-muted-foreground pointer-events-none z-10"}),b(C,{variant:"outline",role:"combobox","aria-expanded":$e[t.key],className:n("h-8 sm:h-8 rounded-lg w-full justify-between font-normal",!de(t.key)&&"text-muted-foreground"),children:[l("span",{className:n("truncate",t.icon&&"pl-6"),children:de(t.key)?t.options?.find(f=>f.value===de(t.key))?.label:t.placeholder}),l(Tt,{className:"ml-2 opacity-50 size-4 shrink-0"})]})]})}),l(Ge,{className:"w-[--radix-popover-trigger-width] p-0 rounded-lg",children:b(xt,{className:"rounded-lg",children:[l(Ct,{placeholder:`Search ${t.placeholder?.toLowerCase()}...`}),b(yt,{children:[l(wt,{children:"No option found."}),b(tt,{children:[b(Be,{value:"all",onSelect:()=>{pe(t.key,""),Ie(t.key,!1)},className:"flex items-center cursor-pointer",children:[l(ao,{className:n("mr-2 size-4 shrink-0",de(t.key)?"opacity-0":"opacity-100")}),l("span",{children:"All"})]}),t.options?.map(f=>b(Be,{value:f.label,onSelect:()=>{pe(t.key,f.value),Ie(t.key,!1)},className:"flex items-center cursor-pointer",children:[l(ao,{className:n("mr-2 size-4 shrink-0",de(t.key)===f.value?"opacity-100":"opacity-0")}),l("span",{children:f.label})]},f.label))]})]})]})})]}):t.type==="date"?l(zo,{value:de(t.key),onChange:f=>{t.onlyExternal||pe(t.key,f)},placeholder:t.placeholder,mode:t.dateMode||"single",externalSearch:t.externalSearch,onlyExternal:t.onlyExternal,onExternalChange:f=>le(t.key,f)}):b("div",{className:"relative",children:[t.icon&&l(t.icon,{className:"absolute -translate-y-1/2 size-4 left-3 top-1/2 text-muted-foreground"}),l(Zt,{placeholder:t.placeholder,value:de(t.key)??"",onChange:f=>{pe(t.key,f.target.value)},className:n("h-8 rounded-lg",t.icon&&"pl-9"),type:t.type==="number"?"number":"text"})]})},t.key)),(o.some(t=>t.externalSearch)||o.some(t=>t.customFilter))&&b(C,{variant:"default",size:"sm",onClick:Vt,className:"rounded-lg h-7",children:[l(Io,{className:"size-4"}),o.find(t=>t.externalSearch||t.customFilter)?.searchButtonText||"Search"]})]})}),b("div",{className:"flex items-center gap-2",children:[v&&b("div",{className:n("flex items-center",O?"bg-background border rounded-lg":""),children:[O&&b(ee,{children:[l(te,{asChild:!0,children:b(C,{variant:"ghost",size:"sm",className:"gap-1 border-0 border-r rounded-r-none hover:bg-transparent",children:[l("span",{className:"text-sm font-medium",children:w}),l(Tt,{className:"opacity-50 size-4"})]})}),l(oe,{align:"end",className:"w-48 rounded-lg",children:Qe.map(t=>b(I,{onClick:()=>Pe(t.value),className:"flex items-center justify-between",children:[l("span",{children:t.label}),we===t.value&&l(ao,{className:"size-4 text-primary"})]},t.value))})]}),b("div",{className:"relative flex-1",children:[l(Io,{className:"absolute -translate-y-1/2 size-4 left-3 top-1/2 text-muted-foreground"}),l(Zt,{placeholder:O&&we!=="all"?`Search in ${Qe.find(t=>t.value===we)?.label}...`:"Global search...",value:r??"",onChange:t=>De(t.target.value),className:n("pl-9 h-8 max-w-max",O&&"border-0 rounded-l-none")})]})]}),pt.length>0&&U&&b(ee,{children:[l(te,{asChild:!0,children:b(C,{variant:"outline",size:"sm",className:n("rounded-lg gap-1",Je&&"bg-primary/10 dark:bg-primary/10 border-primary/20 dark:border-primary/20"),children:[l(no,{className:"size-4"}),l("span",{children:"Aggregations"}),l(Tt,{className:"opacity-50 size-4"})]})}),b(oe,{align:"end",className:"w-64 rounded-lg max-h-[500px] overflow-y-auto",children:[b(X,{className:"flex items-center justify-between px-4 py-2",children:[l("span",{className:"text-sm font-medium",children:"Column Aggregations"}),Je&&l(C,{variant:"ghost",size:"sm",onClick:ge,className:"h-6 px-2 text-xs",children:"Clear All"})]}),l(J,{}),pt.map(t=>{let m=K[t.id],f=m?.enabled;return b(Po,{children:[l(Do,{className:"text-sm",children:b("div",{className:"flex items-center w-full gap-2",children:[l(at,{checked:f,onCheckedChange:()=>Ke(t.id),className:"data-[state=checked]:bg-primary"}),l("span",{className:n("flex-1",f&&"font-medium text-primary"),children:ie(t.id)}),f&&b("div",{className:"flex items-center gap-1",children:[m?.functions?.slice(0,2).map(D=>l("div",{className:"w-2 h-2 rounded-full bg-primary",title:_o.find($=>$.value===D)?.label},D)),m?.functions&&m.functions.length>2&&b("div",{className:"text-xs text-muted-foreground",children:["+",m.functions.length-2]})]})]})}),b(To,{className:"w-48 rounded-lg",children:[l(X,{className:"px-3 py-2 text-xs font-medium text-muted-foreground",children:"Select Functions"}),_o.map(D=>l(Le,{checked:m?.functions?.includes(D.value)||!1,onCheckedChange:()=>ut(t.id,D.value),className:"py-2 text-sm",children:b("div",{className:"flex flex-col",children:[l("span",{children:D.label}),l("span",{className:"text-xs text-muted-foreground",children:D.description})]})},D.value))]})]},t.id)}),pt.length===0&&b("div",{className:"px-3 py-4 text-center",children:[l(no,{className:"w-8 h-8 mx-auto mb-2 opacity-50 text-muted-foreground"}),l("p",{className:"text-sm text-muted-foreground",children:"No numeric columns available for aggregation"})]})]})]}),p&&b(C,{variant:"outline",size:"sm",onClick:()=>p(P),className:"rounded-lg",children:[l(_n,{className:"size-4"}),"Export"]}),x&&b(ee,{children:[l(te,{asChild:!0,className:"h-7",children:b(C,{variant:"outline",size:"sm",className:"gap-1 rounded-lg",children:[l("span",{children:"Columns"}),l(Tt,{className:"opacity-50 size-4"})]})}),b(oe,{align:"end",className:"w-[220px] rounded-lg max-h-[400px] overflow-y-auto",children:[l(X,{className:"px-4 py-2 text-sm font-medium",children:"Toggle Columns"}),l(J,{}),mt().length>0&&b(eo,{children:[l(X,{className:"px-4 py-1.5 text-sm font-medium text-muted-foreground",children:"General"}),mt().map(t=>l(Le,{className:"text-sm",checked:t.getIsVisible(),onCheckedChange:m=>t.toggleVisibility(!!m),children:ie(t.id)},t.id))]}),We().map(t=>b(eo,{children:[l(J,{}),l(X,{className:"px-4 py-1.5 text-sm font-medium text-muted-foreground",children:t.id}),t.columns?.filter(m=>m.getCanHide?.()!==!1).map(m=>l(Le,{className:"text-sm",checked:m.getIsVisible(),onCheckedChange:f=>m.toggleVisibility(!!f),children:ie(m.id,t.id)},m.id))]},t.id))]})]}),b(ee,{children:[l(te,{asChild:!0,className:"h-7",children:l(C,{variant:"outline",size:"sm",className:"rounded-lg h-7",children:l(Vn,{className:"size-4"})})}),b(oe,{align:"end",className:"w-[200px] rounded-lg",children:[l(X,{children:"Table Settings"}),l(J,{}),b(I,{onClick:R,children:[l(An,{className:"size-4"}),"Clear All Sorting"]}),b(I,{onClick:Xe,children:[l(Fo,{className:"size-4"}),"Clear All Filters"]}),Je&&b(I,{onClick:ge,children:[l(no,{className:"size-4"}),"Clear Aggregations"]}),Y&&b(Hn,{children:[l(J,{}),l(X,{children:"Column Pinning"}),b(I,{onClick:()=>e.setColumnPinning({left:[],right:[]}),children:[l(Bn,{className:"size-4"}),"Reset All Pinning"]}),b(I,{onClick:()=>{let t=qe().filter(m=>m.getCanPin?.()!==!1).map(m=>m.id);e.setColumnPinning({left:[],right:t})},children:[l(Ln,{className:"-rotate-90 size-4"}),"Pin All Right"]})]})]})]}),k&&l(C,{variant:"outline",size:"sm",onClick:k,disabled:F,className:"rounded-lg",children:l(Fn,{className:n("h-4 w-4",F&&"animate-spin")})})]})]})})})})}import{Select as Q}from"radix-ui";import{CheckIcon as On,ChevronDownIcon as Vo,ChevronUpIcon as Gn}from"lucide-react";import{jsx as A,jsxs as io}from"react/jsx-runtime";function Ao({...e}){return A(Q.Root,{"data-slot":"select",...e})}function Bo({...e}){return A(Q.Value,{"data-slot":"select-value",...e})}function Lo({className:e,size:o="default",children:r,...g}){return io(Q.Trigger,{"data-slot":"select-trigger","data-size":o,className:n("border-input data-[placeholder]:text-muted-foreground [&_svg:not([class*='text-'])]:text-muted-foreground focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 dark:hover:bg-input/50 flex w-fit items-center justify-between gap-2 rounded-md border bg-transparent px-3 py-2 text-sm whitespace-nowrap shadow-xs transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50 data-[size=default]:h-9 data-[size=sm]:h-8 *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-2 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",e),...g,children:[r,A(Q.Icon,{asChild:!0,children:A(Vo,{className:"size-4 opacity-50"})})]})}function Ho({className:e,children:o,position:r="popper",...g}){return A(Q.Portal,{children:io(Q.Content,{"data-slot":"select-content",className:n("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 relative z-50 max-h-(--radix-select-content-available-height) min-w-[8rem] origin-(--radix-select-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border shadow-md",r==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",e),position:r,...g,children:[A(En,{}),A(Q.Viewport,{className:n("p-1",r==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)] scroll-my-1"),children:o}),A(jn,{})]})})}function Oo({className:e,children:o,...r}){return io(Q.Item,{"data-slot":"select-item",className:n("focus:bg-accent focus:text-accent-foreground [&_svg:not([class*='text-'])]:text-muted-foreground relative flex w-full cursor-default items-center gap-2 rounded-sm py-1.5 pr-8 pl-2 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 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2",e),...r,children:[A("span",{className:"absolute right-2 flex size-3.5 items-center justify-center",children:A(Q.ItemIndicator,{children:A(On,{className:"size-4"})})}),A(Q.ItemText,{children:o})]})}function En({className:e,...o}){return A(Q.ScrollUpButton,{"data-slot":"select-scroll-up-button",className:n("flex cursor-default items-center justify-center py-1",e),...o,children:A(Gn,{className:"size-4"})})}function jn({className:e,...o}){return A(Q.ScrollDownButton,{"data-slot":"select-scroll-down-button",className:n("flex cursor-default items-center justify-center py-1",e),...o,children:A(Vo,{className:"size-4"})})}import{jsx as E,jsxs as Ee}from"react/jsx-runtime";function so({table:e,config:o}){return o.enabled?E("div",{className:"rounded-xl",children:E("div",{children:Ee("div",{className:"flex items-center justify-between",children:[E("div",{className:"flex items-center gap-6 text-sm text-muted-foreground",children:o.showInfo!==!1&&Ee("span",{children:["Showing ",e.getState().pagination.pageIndex*e.getState().pagination.pageSize+1," to"," ",Math.min((e.getState().pagination.pageIndex+1)*e.getState().pagination.pageSize,e.getFilteredRowModel().rows.length)," ","of ",e.getFilteredRowModel().rows.length," entries"]})}),Ee("div",{className:"flex items-center gap-4",children:[o.pageSizeOptions&&Ee("div",{className:"flex items-center gap-2",children:[E("span",{className:"text-sm font-medium",children:"Rows per page:"}),Ee(Ao,{value:`${e.getState().pagination.pageSize}`,onValueChange:r=>e.setPageSize(Number(r)),children:[E(Lo,{className:"h-9 w-[70px] rounded-lg",children:E(Bo,{})}),E(Ho,{side:"top",className:"rounded-lg",children:o.pageSizeOptions.map(r=>E(Oo,{value:`${r}`,children:r},r))})]})]}),Ee("div",{className:"flex items-center gap-2",children:[E(C,{variant:"outline",size:"sm",onClick:()=>e.setPageIndex(0),disabled:!e.getCanPreviousPage(),className:"rounded-lg",children:"First"}),E(C,{variant:"outline",size:"sm",onClick:()=>e.previousPage(),disabled:!e.getCanPreviousPage(),className:"rounded-lg",children:"Previous"}),o.showPageNumbers&&E("div",{className:"flex items-center gap-1",children:Array.from({length:Math.min(5,e.getPageCount())},(r,g)=>{let v=e.getState().pagination.pageIndex,p=v+g;return p<1||p>e.getPageCount()?null:E(C,{variant:p===v+1?"default":"outline",size:"sm",className:"size-8 p-0 rounded-lg",onClick:()=>e.setPageIndex(p-1),children:p},p)})}),E(C,{variant:"outline",size:"sm",onClick:()=>e.nextPage(),disabled:!e.getCanNextPage(),className:"rounded-lg",children:"Next"}),E(C,{variant:"outline",size:"sm",onClick:()=>e.setPageIndex(e.getPageCount()-1),disabled:!e.getCanNextPage(),className:"rounded-lg",children:"Last"})]})]})]})})}):null}import{Toggle as Un}from"radix-ui";import{cva as $n}from"class-variance-authority";import{jsx as Wn}from"react/jsx-runtime";var qn=$n("inline-flex cursor-pointer 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 [&_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",{variants:{variant:{default:"bg-transparent",outline:"border border-input bg-transparent shadow-xs hover:bg-accent hover:text-accent-foreground"},size:{sm:"h-7 px-0 min-w-7",default:"h-8 px-1 min-w-8",lg:"h-9 px-2 min-w-10"},bg:{enabled:"data-[state=on]:bg-accent data-[state=on]:text-accent-foreground",disabled:""}},defaultVariants:{variant:"default",size:"default",bg:"enabled"}});function Go({className:e,variant:o,size:r,noBg:g,...v}){return Wn(Un.Root,{"data-slot":"toggle",className:n(qn({className:e,variant:o,size:r,bg:g?"disabled":"enabled"})),...v})}import{useCallback as rt,useEffect as kt,useMemo as Rt,useRef as it,useState as j}from"react";import{Fragment as $o,jsx as s,jsxs as T}from"react/jsx-runtime";var Uo={sum:e=>e.reduce((o,r)=>o+r,0),average:e=>e.length>0?e.reduce((o,r)=>o+r,0)/e.length:0,min:e=>e.length>0?Math.min(...e):0,max:e=>e.length>0?Math.max(...e):0,count:e=>e.length,unique:e=>new Set(e).size,median:e=>{if(e.length===0)return 0;let o=[...e].sort((g,v)=>g-v),r=Math.floor(o.length/2);return o.length%2===0?(o[r-1]+o[r])/2:o[r]}};function na({data:e,columns:o,filters:r=[],pagination:g={enabled:!1},settings:v={},header:p,footer:k,className:F="",maxHeight:x="100%",loading:P=!1,error:R,emptyMessage:H="No data available",onRowSelectionChange:Y,onExport:ue,onRefresh:ae,onTableReady:K,children:U,isRowDisabled:O,isRowSelectable:w,onExternalSearch:ze,aggregations:re={},onAggregationChange:dt,rowClassName:Me}){let[ct,$e]=j([]),[It,we]=j([]),[Ft,qe]=j({}),[We,mt]=j({}),[ie,le]=j(""),[_t,Vt]=j([]),[Xe,de]=j(v.enableColumnPinning?{left:[],right:[]}:{}),[pe,Ie]=j({}),[Ke,ut]=j({group:"all",value:""}),ge=it(null),Ne=it(null),Pe=it(null),De=it(null),[pt,Je]=j(0),[Qe,t]=j(0),[m,f]=j(0),[D,$]=j(0),Fe=it(null),[At,Xo]=j(!1),{enableSorting:Bt=!0,enableFiltering:Lt=!0,enableGlobalFilter:po=!0,enableColumnVisibility:Ht=!0,enableRowSelection:q=!0,stickyHeader:Da=!0,toolbar:Ye=!1,disableHeaderCheckbox:Ko=!1,toolbarPosition:Te="default",showSerialNumbers:se=!0,fixedCheckboxColumn:gt=!0,striped:Jo=!0,hoverable:Qo=!0,compact:Ze=!0,bordered:go=!0,fullHeight:Yo=!1,enableColumnResizing:fo=!1,enableColumnPinning:B=!0,hideHeader:Zo=!1,selectionMode:fe="multiple",showCheckBox:en=!0,checkboxColumnPosition:bo=0,rounded:Ot=!0,enableGroupedGlobalFilter:Gt=!1,groupedFilterLabel:tn="Search in"}=v;kt(()=>{let d=()=>{Fe.current&&Xo(Fe.current.scrollTop>0)},c=Fe.current;if(c)return c.addEventListener("scroll",d),()=>c.removeEventListener("scroll",d)},[]),kt(()=>{let d=()=>{ge.current&&Je(ge.current.offsetHeight+16),Ne.current&&t(Ne.current.offsetHeight+16),Pe.current&&f(Pe.current.offsetHeight+16),De.current&&$(De.current.offsetHeight+16)};d();let c=new ResizeObserver(()=>{setTimeout(d,50)});return ge.current&&c.observe(ge.current),Ne.current&&c.observe(Ne.current),Pe.current&&c.observe(Pe.current),De.current&&c.observe(De.current),()=>{c.disconnect()}},[Ye,p,Te]);let Et=(d,c)=>c.split(".").reduce((i,a)=>i&&i[a],d),jt=Rt(()=>{let d=e;return Object.keys(pe).length>0&&(d=d.filter(c=>Object.entries(pe).every(([i,a])=>{if(!a||a==="")return!0;let u=Et(c,i);return typeof a=="string"?String(u).toLowerCase().includes(a.toLowerCase()):u===a}))),ie&&Gt&&(d=d.filter(c=>{if(Ke.group==="all")return Object.keys(c).some(i=>{let a=Et(c,i);if(a==null)return!1;let u=String(a).toLowerCase(),h=ie.toLowerCase();return u.includes(h)});{let i=Et(c,Ke.group);if(i==null)return!1;let a=String(i).toLowerCase(),u=ie.toLowerCase();return a.includes(u)}})),d},[e,pe,ie,Ke,Gt]),on=rt((d,c)=>{Ie(i=>{let a={...i};return c===""||c===null||c===void 0?delete a[d]:a[d]=c,a})},[]),nn=rt((d,c)=>{ut({group:d,value:c}),le(c)},[]),_e=Rt(()=>{let d=[...o],c=u=>u.map(h=>{if(h.id==="select"||h.id==="serialNumber")return h;let N={...h,enablePinning:!0};return h.columns&&(N.columns=c(h.columns)),N}),i=c(d),a={id:"select",header:({table:u})=>{if(fe==="single")return null;let h=u.getRowModel().rows.filter(z=>!O?.(z.original)&&(w?w(z.original):!0)),N=h.length>0&&h.every(z=>z.getIsSelected()),S=h.some(z=>z.getIsSelected());return s(at,{checked:N||S&&"indeterminate",onCheckedChange:z=>{h.forEach(_=>_.toggleSelected(!!z))},disabled:Ko||h.length===0,"aria-label":"Select all selectable rows"})},cell:({row:u})=>{let h=O?O(u.original):!1,N=w?w(u.original):!0;return s("div",{className:n("flex items-center justify-center",h&&"opacity-50"),children:fe==="multiple"?s(at,{checked:u.getIsSelected(),onCheckedChange:S=>N&&u.toggleSelected(!!S),"aria-label":"Select row",disabled:h||!N}):en?s("input",{type:"radio",checked:u.getIsSelected(),onChange:()=>N&&u.toggleSelected(!0),disabled:h||!N,className:"w-4 h-4 rounded-full border-primary text-primary focus:ring-primary"}):null})},enableSorting:!1,enableHiding:!1,enablePinning:!0,headerAlign:"center",size:fe==="multiple"?40:30};if(q){let u=bo;u<0&&(u=i.length+u+1),u=Math.max(0,Math.min(u,i.length)),i.splice(u,0,a)}if(se){let u={id:"serialNumber",header:"No.",cell:({row:h})=>s("div",{className:"font-medium text-center text-muted-foreground",children:h.index+1}),enableSorting:!0,enableHiding:!1,enablePinning:!0,size:60,headerAlign:"center"};i.unshift(u)}return i},[o,se,q,gt,O,w,fe,bo]),y=Yn({data:jt,columns:_e,onSortingChange:Bt?$e:void 0,onColumnFiltersChange:Lt?we:void 0,onGlobalFilterChange:po?le:void 0,getCoreRowModel:Xn(),getPaginationRowModel:g.enabled?Jn():void 0,getSortedRowModel:Bt?Qn():void 0,getFilteredRowModel:Lt?Kn():void 0,onColumnVisibilityChange:Ht?qe:void 0,onRowSelectionChange:q?mt:void 0,onColumnOrderChange:Vt,onColumnPinningChange:B?de:void 0,state:{sorting:Bt?ct:void 0,columnFilters:Lt?It:void 0,columnVisibility:Ht?Ft:void 0,rowSelection:q?We:{},globalFilter:ie,columnOrder:_t,columnPinning:B?Xe:{}},initialState:{pagination:g.enabled?{pageSize:g.pageSize||10}:void 0,columnPinning:B?{left:[...se?["serialNumber"]:[],...q?["select"]:[]],right:[]}:void 0},enableRowSelection:q,enableColumnResizing:fo,enableColumnPinning:B,columnResizeMode:"onChange"}),vo=Rt(()=>{if(!re||Object.keys(re).length===0)return{};let d={},c=y.getFilteredRowModel().rows;return Object.entries(re).forEach(([i,a])=>{if(!a?.enabled)return;let u=c.map(N=>{if(a.accessor)return a.accessor(N.original);{let S=N.getValue(i);return typeof S=="number"?S:parseFloat(String(S))||0}}).filter(N=>N!==null&&!isNaN(N)),h={};a.functions?.forEach(N=>{Uo[N]&&(h[N]=Uo[N](u))}),Object.keys(h).length>0&&(d[i]=h)}),d},[jt,re,y?.getFilteredRowModel().rows]);kt(()=>{if(q&&Y){let d=y.getFilteredSelectedRowModel().rows.filter(c=>!O?.(c.original)&&(w?w(c.original):!0)).map(c=>c.original);Y(d)}},[We,q,Y,y,O,w]);let an=rt(d=>{fe==="single"?(y.resetRowSelection(),d.toggleSelected(!0)):d.toggleSelected()},[fe,y]);kt(()=>{K&&K(y)},[y,K]);let rn=rt(()=>{$e([])},[]),sn=rt(()=>{we([]),le(""),ut({group:"all",value:""}),Ie({})},[]),ho=(d,c)=>{if(!B)return;let i=[...se?["serialNumber"]:[],...q&>?["select"]:[]],a={left:[...(Xe.left??[]).filter(u=>i.includes(u))],right:[...Xe.right??[]]};c===!1?(a.left=a.left.filter(u=>u!==d),a.right=a.right.filter(u=>u!==d)):c==="right"?(a.left=a.left.filter(u=>u!==d),a.right.includes(d)||a.right.push(d)):c==="left"&&(a.right=a.right.filter(u=>u!==d),!a.left.includes(d)&&!i.includes(d)&&a.left.push(d)),y.setColumnPinning(a)},ln=()=>{let d=Object.keys(vo).length>0,c=y.getHeaderGroups()[0]?.headers.some(a=>a.column.columnDef.customFooter),i=se&&y.getFilteredRowModel().rows.length>0&&(d||c);return!d&&!c&&!i?null:s(Wt,{className:"sticky bottom-0 border-t bg-sidebar z-20",children:s(ce,{className:"hover:bg-transparent bg-sidebar",children:y.getHeaderGroups()[0]?.headers.map((a,u)=>{let h=a.column.id,N=vo[h],S=B&&(a.column.getIsPinned()==="left"||a.column.id==="serialNumber"||a.column.id==="select"&&q),z=B&&a.column.getIsPinned()==="right",_=a.column.id==="serialNumber",be=a.column.id==="select",V=a.column.columnDef.customFooter;return N||V||_&&i?s(me,{className:n("font-semibold text-sm py-2 px-2 border-r",Ze&&"py-1",S&&"sticky left-0 z-30 bg-sidebar/95",z&&"sticky right-0 z-30 bg-sidebar/95",(_||be)&&"sticky left-0 z-30 bg-sidebar/95",V?.className),style:{width:a.getSize()!==150?a.getSize():"auto",minWidth:a.getSize()!==150?a.getSize():"auto",...S&&{left:_?0:be?se&&y.getColumn("serialNumber")?.getSize()||0:ft(a.column)},...z&&{right:bt(a.column)},..._&&{left:0}},children:(()=>{if(V?.content){let Se=typeof V.content=="function"?V.content(y):V.content;return s("div",{className:n("w-full h-full",V.align==="center"&&"text-center",V.align==="right"&&"text-right",V.align==="left"&&"text-left"),children:Se})}return N?s("div",{className:"flex flex-col gap-0.5 text-xs",children:Object.entries(N).map(([Se,pn])=>T("div",{className:"flex items-center justify-between text-muted-foreground",children:[T("span",{className:"text-xs capitalize",children:[Se,":"]}),s("span",{className:"font-medium text-foreground",children:dn(Se,pn)})]},Se))}):_&&i?T("div",{className:"text-xs text-center text-muted-foreground",children:["Total: ",y.getFilteredRowModel().rows.length]}):null})()},`agg-${a.id}`):s(me,{className:n("py-0 px-0 border-r",Ze&&"py-0",S&&"sticky left-0 z-30 bg-sidebar/95",z&&"sticky right-0 z-30 bg-sidebar/95",(_||be)&&"sticky left-0 z-30 bg-sidebar/95"),style:{width:a.getSize()!==150?a.getSize():"auto",minWidth:a.getSize()!==150?a.getSize():"auto",...S&&{left:_?0:be?se&&y.getColumn("serialNumber")?.getSize()||0:ft(a.column)},...z&&{right:bt(a.column)},..._&&{left:0}}},`agg-${a.id}`)})})})},dn=(d,c)=>typeof c=="number"?d==="count"||d==="unique"?c.toLocaleString():c.toLocaleString(void 0,{minimumFractionDigits:2,maximumFractionDigits:2}):c,cn=()=>y.getHeaderGroups().map((d,c)=>s(ce,{className:"hover:bg-transparent",children:d.headers.map((i,a)=>{let u=i.depth===0&&i.colSpan>1,h=B&&(i.column.getIsPinned()==="left"||i.column.id==="serialNumber"||i.column.id==="select"&&q),N=B&&i.column.getIsPinned()==="right",S=i.column.getCanSort(),z=B&&i.column.columnDef.enablePinning!==!1,_=i.column.id==="serialNumber",be=i.column.id==="select",$t=_||be&>,V=i.column.columnDef.headerAlign||"left",vt=re&&re[i.column.id]?.enabled,Se={left:"justify-start",center:"justify-center",right:"justify-end"}[V];return T(yo,{colSpan:i.colSpan,className:n("font-semibold text-foreground bg-sidebar group px-0",!Ze&&"py-2",go&&a<d.headers.length-1&&"border-r","relative",h&&"sticky left-0 z-25 bg-sidebar",N&&"sticky right-0 z-25 bg-sidebar",(_||be)&&"sticky left-0 z-25 bg-sidebar",u?"text-center":"text-left",vt&&"border-b-2 border-primary/30"),style:{width:i.getSize()!==150?i.getSize():"auto",minWidth:i.getSize()!==150?i.getSize():"auto",...h&&{left:_?0:be?se&&y.getColumn("serialNumber")?.getSize()||0:ft(i.column)},...N&&{right:bt(i.column)},..._&&{left:0}},children:[u?T("div",{className:"flex items-center justify-center",children:[lo(i.column.columnDef.header,i.getContext()),vt&&s(jo,{className:"w-3 h-3 ml-1 text-primary"})]}):T("div",{className:n("relative flex items-center w-full px-2",Se),children:[T("div",{className:"flex items-center gap-1",children:[vt&&s(jo,{className:"w-3 h-3 mr-1 text-primary"}),S&&V==="right"&&s("span",{className:"order-2 ml-1",children:i.column.getIsSorted()&&{asc:s(co,{className:"w-4 h-4"}),desc:s(mo,{className:"w-4 h-4"})}[i.column.getIsSorted()]}),i.isPlaceholder?null:lo(i.column.columnDef.header,i.getContext()),S&&V!=="right"&&i.column.getIsSorted()&&s("span",{className:"order-2 ml-1",children:i.column.getIsSorted()&&{asc:s(co,{className:"w-4 h-4"}),desc:s(mo,{className:"w-4 h-4"})}[i.column.getIsSorted()]})]}),(S||z&&!$t)&&T(ee,{children:[s(te,{asChild:!0,className:n("absolute",V==="left"&&"right-1",V==="center"&&"right-1",V==="right"&&"left-1"),children:s(Go,{variant:"default",size:"sm",noBg:!0,tabIndex:-1,className:"opacity-0 group-hover:opacity-70 hover:opacity-100 data-[state=open]:opacity-100",children:s(ea,{className:"w-4 h-4"})})}),T(oe,{align:"end",className:"w-48",children:[S&&T($o,{children:[s(X,{children:"Sorting"}),T(I,{onClick:()=>i.column.toggleSorting(!1),children:[s(co,{className:"w-4 h-4 mr-2"}),"Sort Ascending"]}),T(I,{onClick:()=>i.column.toggleSorting(!0),children:[s(mo,{className:"w-4 h-4 mr-2"}),"Sort Descending"]}),T(I,{onClick:()=>i.column.clearSorting(),disabled:!i.column.getIsSorted(),children:[s(Zn,{className:"w-4 h-4 mr-2"}),"Clear Sort"]}),s(J,{})]}),z&&!$t&&T($o,{children:[s(X,{children:"Pin Column"}),T(I,{onClick:()=>ho(i.column.id,"right"),disabled:i.column.getIsPinned()==="right",children:[s(ta,{}),"Pin Right"]}),T(I,{onClick:()=>ho(i.column.id,!1),disabled:!i.column.getIsPinned(),children:[s(oa,{}),"Unpin"]})]})]})]})]}),fo&&i.column.getCanResize()&&!u&&i.colSpan===1&&s("div",{className:"absolute top-0 right-0 w-1 h-full transition-opacity opacity-0 bg-border hover:bg-primary cursor-col-resize hover:opacity-100",onMouseDown:i.getResizeHandler()})]},i.id)})},d.id)),ft=d=>{if(!B)return;let c=0,i=y.getLeftHeaderGroups()[0]?.headers||[],a=[...se?["serialNumber"]:[],...q?["select"]:[]];for(let u of i){if(u.id===d.id)break;if(a.includes(u.id)){let h=y.getColumn(u.id);h&&(c+=h.getSize())}}return c},bt=d=>{if(!B)return;let c=y.getState().columnPinning.right||[],i=c.indexOf(d.id);if(i===-1)return;let a=0;for(let u=i+1;u<c.length;u++){let h=y.getColumn(c[u]);h&&(a+=h.getSize())}return a};if(R)return s(Xt,{className:"w-full shadow-sm rounded-xl",children:s(Kt,{className:"flex items-center justify-center",children:T("div",{className:"text-center",children:[s("div",{className:"mb-3 text-2xl text-red-500",children:"\u26A0\uFE0F"}),s("p",{className:"mb-4 text-sm text-muted-foreground",children:R}),ae&&T(C,{variant:"outline",size:"sm",onClick:ae,className:"rounded-lg",children:[s(Eo,{className:"w-4 h-4 mr-2"}),"Try Again"]})]})})});let mn=d=>d&&typeof d=="object"&&"content"in d,Z=Rt(()=>p?mn(p)?{content:p.content,align:p.align||"left",className:p.className||"",sticky:p.sticky!==void 0?p.sticky:!0,showOnEmpty:p.showOnEmpty!==void 0?p.showOnEmpty:!0}:{content:p,align:"left",className:"",sticky:!0,showOnEmpty:!0}:null,[p]),Ut=()=>Ye?s(ro,{table:y,filters:r,globalFilter:ie,onGlobalFilterChange:le,enableGlobalFilter:po,onExport:ue,onRefresh:ae,loading:P,enableColumnVisibility:Ht,enableColumnPinning:B,data:jt,onClearSorting:rn,onClearFilters:sn,onExternalSearch:ze,onCustomFilterChange:on,aggregations:re,onAggregationChange:dt,enableGroupedGlobalFilter:Gt,groupedFilterLabel:tn,onGroupedFilterChange:nn}):null,un=()=>{let d=0;return Te==="above-header"&&(d+=Qe),Z&&(d+=D),Te==="below-header"&&(d+=m),d};return s(et,{children:T("div",{className:n("w-full space-y-2 flex flex-col h-full",F),children:[Ye&&Te==="default"&&s("div",{ref:ge,className:"relative z-40",children:Ut()}),s(Xt,{className:n("shadow-sm overflow-hidden py-0",Yo&&"flex-1",!Ot&&"rounded-none"),children:s(Kt,{className:"h-full p-0",children:T("div",{className:"relative flex flex-col justify-between h-full",children:[P&&s("div",{className:"absolute inset-0 z-50 flex items-center justify-center bg-background/80 backdrop-blur-sm rounded-xl",children:T("div",{className:"flex items-center gap-3 px-4 py-3 rounded-lg shadow-sm bg-background/90",children:[s(Eo,{className:"size-5 animate-spin text-primary"}),s("span",{className:"text-sm font-medium text-muted-foreground",children:"Loading..."})]})}),s("div",{ref:Fe,className:n("relative overflow-auto border-b",y.getRowModel().rows?.length===0&&"h-full",Ot&&"rounded-t-xl"),style:{maxHeight:x},children:T(qt,{className:n("w-full border-collapse relative",y.getRowModel().rows?.length===0&&"h-full"),children:[Ye&&Te==="above-header"&&s("thead",{className:"sticky top-0 z-40 bg-sidebar border-b",children:s(ce,{className:"hover:bg-transparent",children:s(me,{colSpan:_e.length,className:n("p-2 bg-sidebar border-b shadow-sm",!Ot&&"rounded-none"),children:s("div",{ref:Ne,children:Ut()})})})}),Z&&(Z.showOnEmpty||y.getRowModel().rows?.length>0)&&s("thead",{className:n("sticky bg-sidebar border-b",At&&"shadow-sm"),style:{top:Te==="above-header"?`${Qe}px`:"0px",zIndex:35},children:s(ce,{className:"hover:bg-transparent",children:s(me,{colSpan:_e.length,className:n("p-2 font-semibold text-foreground bg-sidebar",Ze?"py-2":"py-4",Z.className),children:s("div",{ref:De,className:n("flex items-center w-full",Z.align==="center"&&"justify-center",Z.align==="right"&&"justify-end",Z.align==="left"&&"justify-start"),children:typeof Z.content=="string"?s("span",{className:"text-lg font-bold tracking-tight text-foreground",children:Z.content}):Z.content})})})}),Ye&&Te==="below-header"&&s("thead",{className:n("sticky bg-sidebar border-b",At&&"shadow-sm"),style:{top:Z?`${D}px`:"0px",zIndex:35},children:s(ce,{className:"hover:bg-transparent",children:s(me,{colSpan:_e.length,className:"p-2 bg-sidebar",children:s("div",{ref:Pe,children:Ut()})})})}),!Zo&&s(xo,{className:n("sticky bg-sidebar",At&&"shadow-sm"),style:{top:`${un()}px`,zIndex:30},children:cn()}),s(Co,{children:y.getRowModel().rows?.length?y.getRowModel().rows.map((d,c)=>{let i=Me?Me(d):"";return s(ce,{"data-state":d.getIsSelected()&&"selected",className:n(Qo&&"hover:bg-muted/50",Jo&&c%2===0&&"bg-muted/20",d.getIsSelected()&&"bg-muted","border-b last:border-b-0",fe==="single"&&"cursor-pointer",i),onClick:()=>{fe==="single"&&an(d)},children:d.getVisibleCells().map((a,u)=>{let h=B&&(a.column.getIsPinned()==="left"||a.column.id==="serialNumber"||a.column.id==="select"&&q),N=B&&a.column.getIsPinned()==="right",S=a.column.id==="serialNumber",z=a.column.id==="select",_=S||z&>return s(me,{className:n(Ze?"py-2":"py-4",go&&u<d.getVisibleCells().length&&"border-r",h&&"sticky left-0 z-20 bg-sidebar/95",N&&"sticky right-0 z-20 bg-sidebar/95",S&&"sticky left-0 z-20 bg-sidebar/95","p-1"),style:{width:a.column.getSize()!==150?a.column.getSize():"auto",minWidth:a.column.getSize()!==150?a.column.getSize():"auto",...h&&{left:S?0:z?se&&y.getColumn("serialNumber")?.getSize()||0:ft(a.column)},...N&&{right:bt(a.column)},...S&&{left:0}},children:lo(a.column.columnDef.cell,a.getContext())},a.id)})},d.id)}):s(ce,{children:s(me,{colSpan:_e.length,className:"h-32 text-center border-0",children:T("div",{className:"flex flex-col items-center gap-3",children:[s("div",{className:"text-6xl text-muted-foreground",children:"\u{1F4CB}"}),s("p",{className:"font-medium text-muted-foreground",children:H})]})})})}),ln()]})}),k&&s("div",{className:"sticky bottom-0 z-10 w-full bg-sidebar",style:{width:"100%",minWidth:"fit-content"},children:s(qt,{children:s(Wt,{children:s(ce,{className:"bg-sidebar",children:s(me,{colSpan:_e.length,className:"p-2",children:k})})})})})]})})}),s(so,{table:y,config:g}),U&&U(y)]})})}import{Separator as aa}from"radix-ui";import{jsx as ra}from"react/jsx-runtime";function zt({className:e,orientation:o="horizontal",decorative:r=!0,...g}){return ra(aa.Root,{"data-slot":"separator-root",decorative:r,orientation:o,className:n("bg-border shrink-0 data-[orientation=horizontal]:h-px data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-full data-[orientation=vertical]:w-px",e),...g})}import{Loader as ia,X as sa}from"lucide-react";import{AnimatePresence as la,motion as da}from"framer-motion";import*as Ce from"react";import*as qo from"react-dom";import{jsx as L,jsxs as st}from"react/jsx-runtime";function ca({table:e,visible:o,container:r,children:g,className:v,...p}){let[k,F]=Ce.useState(!1);Ce.useLayoutEffect(()=>{F(!0)},[]),Ce.useEffect(()=>{function R(H){H.key==="Escape"&&e&&e.toggleAllRowsSelected(!1)}return window.addEventListener("keydown",R),()=>window.removeEventListener("keydown",R)},[e]);let x=r??(k?globalThis.document?.body:null);if(!x||!e)return null;let P=o??e.getFilteredSelectedRowModel().rows.length>0;return qo.createPortal(L(la,{children:P&&L(da.div,{role:"toolbar","aria-orientation":"horizontal",initial:{opacity:0,y:20},animate:{opacity:1,y:0},exit:{opacity:0,y:20},transition:{duration:.3,ease:"easeInOut"},className:n("fixed inset-x-0 bottom-6 z-50 mx-auto flex w-fit flex-wrap items-center justify-center gap-2 rounded-xl border bg-primary/10 backdrop-blur-sm p-3 text-foreground ring-5 ring-primary/5",v),...p,children:L(et,{children:g})})}),x)}function ma({size:e="sm",tooltip:o,isPending:r,disabled:g,className:v,children:p,...k}){let F=L(C,{variant:"secondary",size:e,className:n("gap-1.5 rounded-lg border border-secondary bg-secondary/50 hover:bg-secondary/70 transition-all duration-200",e==="icon"?"size-8":"h-8 px-3",v),disabled:g||r,...k,children:r?L(ia,{className:"animate-spin"}):p});return o?st(Jt,{children:[L(Qt,{asChild:!0,children:F}),L(Yt,{sideOffset:8,className:"rounded-lg border font-semibold text-foreground bg-secondary [&>span]:hidden",children:L("p",{children:o})})]}):F}function ua({table:e}){let o=Ce.useCallback(()=>{e&&e.toggleAllRowsSelected(!1)},[e]);return e?st("div",{className:"flex h-8 items-center rounded-lg border bg-muted/50 pr-1 pl-3",children:[st("span",{className:"whitespace-nowrap text-sm font-medium",children:[e.getFilteredSelectedRowModel().rows.length," selected"]}),L(zt,{orientation:"vertical",className:"mr-2 ml-3 data-[orientation=vertical]:h-4"}),st(Jt,{children:[L(Qt,{asChild:!0,children:L(C,{variant:"ghost",size:"icon",className:"size-6 rounded-md",onClick:o,children:L(sa,{className:"size-3.5"})})}),st(Yt,{sideOffset:10,className:"flex items-center gap-2 rounded-lg border px-3 py-2 font-semibold text-foregroun bg-secondary [&>span]:hidden",children:[L("p",{children:"Clear selection"}),L("kbd",{className:"select-none rounded border bg-primary/50 px-2 py-1 font-mono font-normal text-[0.7rem] text-foreground shadow-sm",children:L("abbr",{title:"Escape",className:"no-underline",children:"Esc"})})]})]})]}):null}import{ArrowUpDown as lt,EyeOff as pa}from"lucide-react";import{jsx as ne,jsxs as je}from"react/jsx-runtime";function ga({column:e,title:o,className:r}){return e.getCanSort()?ne("div",{className:n("flex items-center space-x-2",r),children:je(ee,{children:[ne(te,{asChild:!0,children:je(C,{variant:"ghost",size:"sm",className:"-ml-3 h-8 data-[state=open]:bg-accent",children:[ne("span",{children:o}),e.getIsSorted()==="desc"?ne(lt,{className:"ml-2 h-4 w-4"}):e.getIsSorted()==="asc"?ne(lt,{className:"ml-2 h-4 w-4"}):ne(lt,{className:"ml-2 h-4 w-4"})]})}),je(oe,{align:"start",className:"rounded-lg",children:[je(I,{onClick:()=>e.toggleSorting(!1),children:[ne(lt,{className:"mr-2 h-3.5 w-3.5 text-muted-foreground/70"}),"Asc"]}),je(I,{onClick:()=>e.toggleSorting(!0),children:[ne(lt,{className:"mr-2 h-3.5 w-3.5 text-muted-foreground/70"}),"Desc"]}),ne(J,{}),je(I,{onClick:()=>e.toggleVisibility(!1),children:[ne(pa,{className:"mr-2 h-3.5 w-3.5 text-muted-foreground/70"}),"Hide"]})]})]})}):ne("div",{className:n(r),children:o})}import{ChevronDown as fa,Eye as ba}from"lucide-react";import{jsx as Ue,jsxs as uo}from"react/jsx-runtime";function va({table:e}){return uo(ee,{children:[Ue(te,{asChild:!0,children:uo(C,{variant:"outline",size:"sm",className:"rounded-lg",children:[Ue(ba,{className:"mr-2 h-4 w-4"}),"Columns ",Ue(fa,{className:"ml-2 h-4 w-4"})]})}),uo(oe,{align:"end",className:"w-[200px] rounded-lg",children:[Ue(X,{children:"Toggle Columns"}),Ue(J,{}),e.getAllColumns().filter(o=>typeof o.accessorFn<"u"&&o.getCanHide()).map(o=>Ue(Le,{className:"capitalize",checked:o.getIsVisible(),onCheckedChange:r=>o.toggleVisibility(!!r),children:o.id},o.id))]})]})}import{Slot as ha}from"radix-ui";import{cva as xa}from"class-variance-authority";import{jsx as ya}from"react/jsx-runtime";var Ca=xa("inline-flex items-center justify-center rounded-md border px-2 py-0.5 text-xs font-medium w-fit whitespace-nowrap shrink-0 [&>svg]:size-3 gap-1 [&>svg]:pointer-events-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive transition-[color,box-shadow] overflow-hidden",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground [a&]:hover:bg-primary/90",secondary:"border-transparent bg-secondary text-secondary-foreground [a&]:hover:bg-secondary/90",destructive:"border-transparent bg-destructive text-white [a&]:hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",outline:"text-foreground [a&]:hover:bg-accent [a&]:hover:text-accent-foreground"}},defaultVariants:{variant:"default"}});function Mt({className:e,variant:o,asChild:r=!1,...g}){let v=r?ha.Slot:"span";return ya(v,{"data-slot":"badge",className:n(Ca({variant:o}),e),...g})}import{CheckIcon as wa,PlusCircleIcon as Na}from"lucide-react";import{Fragment as Wo,jsx as M,jsxs as ye}from"react/jsx-runtime";function Pa({column:e,title:o,options:r}){let g=e?.getFacetedUniqueValues(),v=new Set(e?.getFilterValue());return ye(He,{children:[M(Oe,{asChild:!0,children:ye(C,{variant:"outline",size:"sm",className:"h-9 border-dashed rounded-lg",children:[M(Na,{className:"mr-2 h-4 w-4"}),o,v?.size>0&&ye(Wo,{children:[M(zt,{orientation:"vertical",className:"mx-2 h-4"}),M(Mt,{variant:"secondary",className:"rounded-sm px-1 font-normal lg:hidden",children:v.size}),M("div",{className:"hidden space-x-1 lg:flex",children:v.size>2?ye(Mt,{variant:"secondary",className:"rounded-sm px-1 font-normal",children:[v.size," selected"]}):r.filter(p=>v.has(p.value)).map(p=>M(Mt,{variant:"secondary",className:"rounded-sm px-1 font-normal",children:p.label},p.value))})]})]})}),M(Ge,{className:"w-[200px] p-0 rounded-lg",align:"start",children:ye(xt,{className:"rounded-lg",children:[M(Ct,{placeholder:o}),ye(yt,{children:[M(wt,{children:"No results found."}),M(tt,{children:r.map(p=>{let k=v.has(p.value);return ye(Be,{onSelect:()=>{k?v.delete(p.value):v.add(p.value);let F=Array.from(v);e?.setFilterValue(F.length?F:void 0)},children:[M("div",{className:n("mr-2 flex h-4 w-4 items-center justify-center rounded-sm border border-primary",k?"bg-primary text-primary-foreground":"opacity-50 [&_svg]:invisible"),children:M(wa,{className:n("h-4 w-4")})}),p.icon&&M(p.icon,{className:"mr-2 h-4 w-4 text-muted-foreground"}),M("span",{children:p.label}),g?.get(p.value)&&M("span",{className:"ml-auto flex h-4 w-4 items-center justify-center font-mono text-xs",children:g.get(p.value)})]},p.value)})}),v.size>0&&ye(Wo,{children:[M(No,{}),M(tt,{children:M(Be,{onSelect:()=>e?.setFilterValue(void 0),className:"justify-center text-center",children:"Clear filters"})})]})]})]})})]})}export{na as DataTable,ca as DataTableActionBar,ma as DataTableActionBarAction,ua as DataTableActionBarSelection,ga as DataTableColumnHeader,Pa as DataTableFacetedFilter,so as DataTablePagination,ro as DataTableToolbar,va as DataTableViewOptions};
|
|
2
|
+
import{flexRender as Qt,getCoreRowModel as Gn,getFilteredRowModel as jn,getPaginationRowModel as Un,getSortedRowModel as $n,useReactTable as qn}from"@tanstack/react-table";import{Loader2 as Fo,ChevronUp as Yt,ChevronDown as Zt,ChevronsUpDown as Wn,MoreHorizontal as Xn,MoveRightIcon as Kn,PinOffIcon as Jn,Calculator as _o}from"lucide-react";import{Slot as cn}from"radix-ui";import{cva as mn}from"class-variance-authority";import{clsx as ln}from"clsx";import{twMerge as dn}from"tailwind-merge";function n(...e){return dn(ln(e))}import{jsx as un}from"react/jsx-runtime";var mt=mn("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-all disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",{variants:{variant:{default:"bg-primary text-primary-foreground shadow-xs hover:bg-primary/90",destructive:"bg-destructive text-white shadow-xs hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",outline:"border bg-background shadow-xs hover:bg-accent hover:text-accent-foreground dark:bg-input/30 dark:border-input dark:hover:bg-input/50",secondary:"bg-secondary text-secondary-foreground shadow-xs hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2 has-[>svg]:px-3",sm:"h-8 rounded-md gap-1.5 px-3 has-[>svg]:px-2.5",lg:"h-10 rounded-md px-6 has-[>svg]:px-4",icon:"size-9"}},defaultVariants:{variant:"default",size:"default"}});function C({className:e,variant:t,size:a,asChild:u=!1,...v}){let m=u?cn.Slot:"button";return un(m,{"data-slot":"button",className:n(mt({variant:t,size:a,className:e}),"transition-none"),...v})}import{jsx as fe}from"react/jsx-runtime";function _t({className:e,...t}){return fe("div",{"data-slot":"table-container",className:"relative w-full h-full max-h-full overflow-auto",children:fe("table",{"data-slot":"table",className:n("w-full caption-bottom text-sm",e),...t})})}function lo({className:e,...t}){return fe("thead",{"data-slot":"table-header",className:n("[&_tr]:border-b",e),...t})}function co({className:e,...t}){return fe("tbody",{"data-slot":"table-body",className:n("[&_tr:last-child]:border-0",e),...t})}function Vt({className:e,...t}){return fe("tfoot",{"data-slot":"table-footer",className:n("bg-muted/50 border-t font-medium [&>tr]:last:border-b-0",e),...t})}function de({className:e,...t}){return fe("tr",{"data-slot":"table-row",className:n("hover:bg-muted/50 data-[state=selected]:bg-muted border-b transition-colors",e),...t})}function mo({className:e,...t}){return fe("th",{"data-slot":"table-head",className:n("text-foreground h-10 px-2 text-left align-middle font-medium whitespace-nowrap",e),...t})}function ce({className:e,...t}){return fe("td",{"data-slot":"table-cell",className:n("p-2 align-middle whitespace-nowrap",e),...t})}import{jsx as uo}from"react/jsx-runtime";function At({className:e,...t}){return uo("div",{"data-slot":"card",className:n("bg-card text-card-foreground flex flex-col gap-6 rounded-xl border py-6 shadow-sm",e),...t})}function Bt({className:e,...t}){return uo("div",{"data-slot":"card-content",className:n("px-6",e),...t})}import{Tooltip as Te}from"radix-ui";import{jsx as Se,jsxs as pn}from"react/jsx-runtime";function $e({delayDuration:e=0,...t}){return Se(Te.Provider,{"data-slot":"tooltip-provider",delayDuration:e,...t})}function Ht({...e}){return Se($e,{children:Se(Te.Root,{"data-slot":"tooltip",...e})})}function Lt({...e}){return Se(Te.Trigger,{"data-slot":"tooltip-trigger",...e})}function Ot({className:e,sideOffset:t=0,children:a,...u}){return Se(Te.Portal,{children:pn(Te.Content,{"data-slot":"tooltip-content",sideOffset:t,className:n("bg-primary text-primary-foreground animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-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-fit origin-(--radix-tooltip-content-transform-origin) rounded-md px-3 py-1.5 text-xs text-balance",e),...u,children:[a,Se(Te.Arrow,{className:"bg-primary fill-primary z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px]"})]})})}import{Search as wo,RefreshCw as Sn,Download as kn,Settings2 as Rn,Filter as No,ArrowUpDown as zn,PinOff as Mn,Pin as In,ChevronDown as $t,Calculator as qt,Check as Po}from"lucide-react";import{jsx as gn}from"react/jsx-runtime";function Et({className:e,type:t,...a}){return gn("input",{type:t,"data-slot":"input",className:n("file:text-foreground placeholder:text-muted-foreground selection:bg-primary selection:text-primary-foreground dark:bg-input/30 border-input flex h-9 w-full min-w-0 rounded-md border bg-transparent px-3 py-1 text-base shadow-xs transition-[color,box-shadow] outline-none file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm","focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]","aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",e),...a})}import{Command as we}from"cmdk";import{SearchIcon as fn}from"lucide-react";import{Dialog as Ga}from"radix-ui";import{XIcon as Ua}from"lucide-react";import{jsx as Wa,jsxs as Xa}from"react/jsx-runtime";import{jsx as be,jsxs as bn}from"react/jsx-runtime";function ut({className:e,...t}){return be(we,{"data-slot":"command",className:n("bg-popover text-popover-foreground flex h-full w-full flex-col overflow-hidden rounded-md",e),...t})}function pt({className:e,...t}){return bn("div",{"data-slot":"command-input-wrapper",className:"flex h-9 items-center gap-2 border-b px-3",children:[be(fn,{className:"size-4 shrink-0 opacity-50"}),be(we.Input,{"data-slot":"command-input",className:n("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",e),...t})]})}function gt({className:e,...t}){return be(we.List,{"data-slot":"command-list",className:n("max-h-[300px] scroll-py-1 overflow-x-hidden overflow-y-auto",e),...t})}function ft({...e}){return be(we.Empty,{"data-slot":"command-empty",className:"py-6 text-center text-sm",...e})}function qe({className:e,...t}){return be(we.Group,{"data-slot":"command-group",className:n("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",e),...t})}function po({className:e,...t}){return be(we.Separator,{"data-slot":"command-separator",className:n("bg-border -mx-1 h-px",e),...t})}function ke({className:e,...t}){return be(we.Item,{"data-slot":"command-item",className:n("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",e),...t})}import{DropdownMenu as $}from"radix-ui";import{CheckIcon as vn,ChevronRightIcon as hn,CircleIcon as dr}from"lucide-react";import{jsx as O,jsxs as vo}from"react/jsx-runtime";function re({...e}){return O($.Root,{"data-slot":"dropdown-menu",...e})}function ie({...e}){return O($.Trigger,{"data-slot":"dropdown-menu-trigger",...e})}function se({className:e,sideOffset:t=4,...a}){return O($.Portal,{children:O($.Content,{"data-slot":"dropdown-menu-content",sideOffset:t,className:n("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-dropdown-menu-content-available-height) min-w-[8rem] origin-(--radix-dropdown-menu-content-transform-origin) rounded-md border p-1 shadow-md",e),...a})})}function Gt({...e}){return O($.Group,{"data-slot":"dropdown-menu-group",...e})}function V({className:e,inset:t,variant:a="default",...u}){return O($.Item,{"data-slot":"dropdown-menu-item","data-inset":t,"data-variant":a,className:n("cursor-pointer 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 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",e),...u})}function Re({className:e,children:t,checked:a,...u}){return vo($.CheckboxItem,{"data-slot":"dropdown-menu-checkbox-item",className:n("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",e),checked:a,...u,children:[O("span",{className:"pointer-events-none absolute left-2 flex size-3.5 items-center justify-center",children:O($.ItemIndicator,{children:O(vn,{className:"size-4"})})}),t]})}function q({className:e,inset:t,...a}){return O($.Label,{"data-slot":"dropdown-menu-label","data-inset":t,className:n("px-2 py-1.5 text-sm font-medium data-[inset]:pl-8",e),...a})}function K({className:e,...t}){return O($.Separator,{"data-slot":"dropdown-menu-separator",className:n("bg-border -mx-1 my-1 h-px",e),...t})}function go({...e}){return O($.Sub,{"data-slot":"dropdown-menu-sub",...e})}function fo({className:e,inset:t,children:a,...u}){return vo($.SubTrigger,{"data-slot":"dropdown-menu-sub-trigger","data-inset":t,className:n("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",e),...u,children:[a,O(hn,{className:"ml-auto size-4"})]})}function bo({className:e,...t}){return O($.SubContent,{"data-slot":"dropdown-menu-sub-content",className:n("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-dropdown-menu-content-transform-origin) overflow-hidden rounded-md border p-1 shadow-lg",e),...t})}import{useState as Wt}from"react";import{useEffect as Pn,useState as jt}from"react";import{Calendar as Dn}from"lucide-react";import{format as We}from"date-fns";import{Popover as bt}from"radix-ui";import{jsx as vt}from"react/jsx-runtime";function ze({...e}){return vt(bt.Root,{"data-slot":"popover",...e})}function Me({...e}){return vt(bt.Trigger,{"data-slot":"popover-trigger",...e})}function Ie({className:e,align:t="center",sideOffset:a=4,...u}){return vt(bt.Portal,{children:vt(bt.Content,{"data-slot":"popover-content",align:t,sideOffset:a,className:n("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-72 origin-(--radix-popover-content-transform-origin) rounded-md border p-4 shadow-md outline-hidden",e),...u})})}import*as ht from"react";import{ChevronDownIcon as xn,ChevronLeftIcon as Cn,ChevronRightIcon as yn}from"lucide-react";import{DayPicker as wn,getDefaultClassNames as ho}from"react-day-picker";import{jsx as ve}from"react/jsx-runtime";function xo({className:e,classNames:t,showOutsideDays:a=!0,captionLayout:u="label",buttonVariant:v="ghost",formatters:m,components:k,...I}){let h=ho();return ve(wn,{showOutsideDays:a,className:n("bg-background group/calendar p-3 [--cell-size:--spacing(8)] [[data-slot=card-content]_&]:bg-transparent [[data-slot=popover-content]_&]:bg-transparent",String.raw`rtl:**:[.rdp-button\_next>svg]:rotate-180`,String.raw`rtl:**:[.rdp-button\_previous>svg]:rotate-180`,e),captionLayout:u,formatters:{formatMonthDropdown:P=>P.toLocaleString("default",{month:"short"}),...m},classNames:{root:n("w-fit",h.root),months:n("flex gap-4 flex-col md:flex-row relative",h.months),month:n("flex flex-col w-full gap-4",h.month),nav:n("flex items-center gap-1 w-full absolute top-0 inset-x-0 justify-between",h.nav),button_previous:n(mt({variant:v}),"size-(--cell-size) aria-disabled:opacity-50 p-0 select-none",h.button_previous),button_next:n(mt({variant:v}),"size-(--cell-size) aria-disabled:opacity-50 p-0 select-none",h.button_next),month_caption:n("flex items-center justify-center h-(--cell-size) w-full px-(--cell-size)",h.month_caption),dropdowns:n("w-full flex items-center text-sm font-medium justify-center h-(--cell-size) gap-1.5",h.dropdowns),dropdown_root:n("relative has-focus:border-ring border border-input shadow-xs has-focus:ring-ring/50 has-focus:ring-[3px] rounded-md",h.dropdown_root),dropdown:n("absolute bg-popover inset-0 opacity-0",h.dropdown),caption_label:n("select-none font-medium",u==="label"?"text-sm":"rounded-md pl-2 pr-1 flex items-center gap-1 text-sm h-8 [&>svg]:text-muted-foreground [&>svg]:size-3.5",h.caption_label),table:"w-full border-collapse",weekdays:n("flex",h.weekdays),weekday:n("text-muted-foreground rounded-md flex-1 font-normal text-[0.8rem] select-none",h.weekday),week:n("flex w-full mt-2",h.week),week_number_header:n("select-none w-(--cell-size)",h.week_number_header),week_number:n("text-[0.8rem] select-none text-muted-foreground",h.week_number),day:n("relative w-full h-full p-0 text-center [&:first-child[data-selected=true]_button]:rounded-l-md [&:last-child[data-selected=true]_button]:rounded-r-md group/day aspect-square select-none",h.day),range_start:n("rounded-l-md bg-accent",h.range_start),range_middle:n("rounded-none",h.range_middle),range_end:n("rounded-r-md bg-accent",h.range_end),today:n("bg-accent text-accent-foreground rounded-md data-[selected=true]:rounded-none",h.today),outside:n("text-muted-foreground aria-selected:text-muted-foreground",h.outside),disabled:n("text-muted-foreground opacity-50",h.disabled),hidden:n("invisible",h.hidden),...t},components:{Root:({className:P,rootRef:R,...L})=>ve("div",{"data-slot":"calendar",ref:R,className:n(P),...L}),Chevron:({className:P,orientation:R,...L})=>R==="left"?ve(Cn,{className:n("size-4",P),...L}):R==="right"?ve(yn,{className:n("size-4",P),...L}):ve(xn,{className:n("size-4",P),...L}),DayButton:Nn,WeekNumber:({children:P,...R})=>ve("td",{...R,children:ve("div",{className:"flex size-(--cell-size) items-center justify-center text-center",children:P})}),...k},...I})}function Nn({className:e,day:t,modifiers:a,...u}){let v=ho(),m=ht.useRef(null);return ht.useEffect(()=>{a.focused&&m.current?.focus()},[a.focused]),ve(C,{ref:m,variant:"ghost",size:"icon","data-day":t.date.toLocaleDateString(),"data-selected-single":a.selected&&!a.range_start&&!a.range_end&&!a.range_middle,"data-range-start":a.range_start,"data-range-end":a.range_end,"data-range-middle":a.range_middle,className:n("data-[selected-single=true]:bg-primary data-[selected-single=true]:text-primary-foreground data-[range-middle=true]:bg-accent data-[range-middle=true]:text-accent-foreground data-[range-start=true]:bg-primary data-[range-start=true]:text-primary-foreground data-[range-end=true]:bg-primary data-[range-end=true]:text-primary-foreground group-data-[focused=true]/day:border-ring group-data-[focused=true]/day:ring-ring/50 dark:hover:text-accent-foreground flex aspect-square size-auto w-full min-w-(--cell-size) flex-col gap-1 leading-none font-normal group-data-[focused=true]/day:relative group-data-[focused=true]/day:z-10 group-data-[focused=true]/day:ring-[3px] data-[range-end=true]:rounded-md data-[range-end=true]:rounded-r-md data-[range-middle=true]:rounded-none data-[range-start=true]:rounded-md data-[range-start=true]:rounded-l-md [&>span]:text-xs [&>span]:opacity-70",v.day,e),...u})}import{jsx as Ne,jsxs as Xe}from"react/jsx-runtime";function Co({value:e,onChange:t,placeholder:a,mode:u,externalSearch:v,onExternalChange:m,onlyExternal:k=!1}){let[I,h]=jt(!1),[P,R]=jt(e),[L,Q]=jt(e);Pn(()=>{k||Q(e)},[e,k]);let me=()=>{k||t(P),Q(P),v&&m&&m(P),h(!1)},te=()=>{R(L),h(!1)},X=()=>{let y=u==="single"?null:{from:null,to:null};R(y),k||t(y),Q(y),v&&m&&m(y),h(!1)},G=()=>{let y=k?L:e;return y?u==="single"?We(y,"PPP"):y.from&&y.to?`${We(y.from,"MMM dd")} - ${We(y.to,"MMM dd, yyyy")}`:y.from?`From ${We(y.from,"MMM dd, yyyy")}`:y.to?`To ${We(y.to,"MMM dd, yyyy")}`:a:a},Y=y=>{R(u==="single"?y:y||{from:null,to:null})};return Xe(ze,{open:I,onOpenChange:h,children:[Ne(Me,{className:"h-8",asChild:!0,children:Xe(C,{variant:"outline",className:n("w-full justify-start text-left font-normal h-9",!G()&&"text-muted-foreground"),children:[Ne(Dn,{className:"mr-2 h-4 w-4"}),G()]})}),Xe(Ie,{className:"w-auto p-0",align:"start",children:[Ne("div",{className:"p-3",children:Ne(xo,{mode:u,selected:P,onSelect:Y,numberOfMonths:u==="range"?2:1,className:"rounded-md border",...u==="range"&&{required:!0}})}),Xe("div",{className:"flex items-center justify-between p-3 border-t",children:[Ne(C,{variant:"ghost",size:"sm",onClick:X,children:"Clear"}),Xe("div",{className:"flex gap-2",children:[Ne(C,{variant:"outline",size:"sm",onClick:te,children:"Cancel"}),Ne(C,{size:"sm",onClick:me,disabled:u==="range"&&(!P?.from||!P?.to),children:"Apply"})]})]})]})]})}import{Checkbox as yo}from"radix-ui";import{CheckIcon as Tn}from"lucide-react";import{jsx as Ut}from"react/jsx-runtime";function Ke({className:e,...t}){return Ut(yo.Root,{"data-slot":"checkbox",className:n("peer border-input dark:bg-input/30 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground dark:data-[state=checked]:bg-primary data-[state=checked]:border-primary focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive size-4 shrink-0 rounded-[4px] border shadow-xs transition-shadow outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50",e),...t,children:Ut(yo.Indicator,{"data-slot":"checkbox-indicator",className:"flex items-center justify-center text-current transition-none",children:Ut(Tn,{className:"size-3.5"})})})}import{Fragment as Fn,jsx as l,jsxs as b}from"react/jsx-runtime";var Do=[{value:"sum",label:"Sum",description:"Total of all values"},{value:"average",label:"Average",description:"Mean value"},{value:"min",label:"Minimum",description:"Smallest value"},{value:"max",label:"Maximum",description:"Largest value"},{value:"count",label:"Count",description:"Number of rows"},{value:"unique",label:"Unique",description:"Count of distinct values"},{value:"median",label:"Median",description:"Middle value"}];function Xt({table:e,filters:t=[],globalFilter:a,onGlobalFilterChange:u,enableGlobalFilter:v=!0,onExport:m,onRefresh:k,loading:I=!1,enableColumnVisibility:h=!0,data:P,onClearSorting:R,onClearFilters:L,enableColumnPinning:Q=!1,onExternalSearch:me,onCustomFilterChange:te,aggregations:X={},onAggregationChange:G}){let[Y,y]=Wt({}),[Ae,oe]=Wt({}),[Ze,et]=Wt({}),Be=()=>e.getAllLeafColumns().filter(o=>o.getCanHide?.()!==!1),He=()=>e.getAllColumns().filter(o=>!e.getAllLeafColumns().includes(o)&&o.columns?.length&&o.columns.some(c=>c.getCanHide?.()!==!1)),tt=()=>{let o=new Set(He().flatMap(c=>c.columns?.filter(p=>p.getCanHide?.()!==!1).map(p=>p.id)||[]));return Be().filter(c=>!o.has(c.id))},Pe=(o,c)=>c&&o.startsWith(`${c}.`)?o.replace(`${c}.`,"").split("_").map(S=>S.slice(1)).join(" "):o.split("_").map(p=>p.charAt(0).toUpperCase()+p.slice(1)).join(" "),Le=(o,c)=>{let p={...Y,[o]:c};y(p)},Pt=(o,c)=>{let p={...Ae,[o]:c};oe(p),te&&te(o,c),t.find(S=>S.key===o)?.externalSearch&&Le(o,c)},ot=()=>{me&&me(Y)},Dt=()=>{y({}),oe({}),L(),me&&me({}),te&&Object.keys(Ae).forEach(o=>{te(o,"")})},ne=o=>t.find(p=>p.key===o)?.customFilter?Ae[o]??"":e.getColumn(o)?.getFilterValue(),ue=(o,c)=>{let p=t.find(S=>S.key===o);p?.customFilter?Pt(o,c):(e.getColumn(o)?.setFilterValue(c),p?.externalSearch&&Le(o,c))},Oe=(o,c)=>{et(p=>({...p,[o]:c}))},Tt=o=>{if(G){let c=X[o],p={enabled:!c?.enabled,functions:c?.functions||["sum","average"]};G(o,p)}},Ee=(o,c)=>{if(G){let S=X[o]?.functions||[],j=S.includes(c)?S.filter(rt=>rt!==c):[...S,c];G(o,{enabled:j.length>0,functions:j})}},nt=()=>{G&&Object.keys(X).forEach(o=>{let c=X[o];c&&G(o,{...c,enabled:!1,functions:[]})})},Ge=Be().filter(o=>o.id==="select"||o.id==="serialNumber"?!1:o.columnDef.meta?.aggregatable?!0:e.getRowModel().rows.slice(0,5).some(S=>{let j=S.getValue(o.id);return typeof j=="number"||typeof j=="string"&&!isNaN(parseFloat(String(j)))||typeof j=="object"&&j!==null&&"props"in j})),le=Object.values(X).some(o=>o?.enabled);return l("div",{className:"rounded-xl",children:l("div",{className:"px-2",children:l("div",{className:"flex flex-col gap-6",children:b("div",{className:"flex items-center justify-between",children:[l("div",{className:"flex items-center gap-3",children:t.length>0&&b("div",{className:"flex flex-wrap items-center gap-3",children:[l("div",{className:"flex items-center gap-2 text-sm font-medium text-muted-foreground",children:l(No,{className:"size-4"})}),t.map(o=>!e.getColumn(o.key)&&!o.customFilter&&!o.externalSearch?null:l("div",{className:n("relative min-w-[150px]",o.width),children:o.type==="select"?b(ze,{open:Ze[o.key],onOpenChange:p=>Oe(o.key,p),children:[l(Me,{asChild:!0,children:b("div",{className:"relative w-full",children:[o.icon&&l(o.icon,{className:"absolute -translate-y-1/2 size-4 left-3 top-1/2 text-muted-foreground pointer-events-none z-10"}),b(C,{variant:"outline",role:"combobox","aria-expanded":Ze[o.key],className:n("h-8 sm:h-8 rounded-lg w-full justify-between font-normal",!ne(o.key)&&"text-muted-foreground"),children:[l("span",{className:n("truncate",o.icon&&"pl-6"),children:ne(o.key)?o.options?.find(p=>p.value===ne(o.key))?.label:o.placeholder}),l($t,{className:"ml-2 opacity-50 size-4 shrink-0"})]})]})}),l(Ie,{className:"w-[--radix-popover-trigger-width] p-0 rounded-lg",children:b(ut,{className:"rounded-lg",children:[l(pt,{placeholder:`Search ${o.placeholder?.toLowerCase()}...`}),b(gt,{children:[l(ft,{children:"No option found."}),b(qe,{children:[b(ke,{value:"all",onSelect:()=>{ue(o.key,""),Oe(o.key,!1)},className:"flex items-center cursor-pointer",children:[l(Po,{className:n("mr-2 size-4 shrink-0",ne(o.key)?"opacity-0":"opacity-100")}),l("span",{children:"All"})]}),o.options?.map(p=>b(ke,{value:p.label,onSelect:()=>{ue(o.key,p.value),Oe(o.key,!1)},className:"flex items-center cursor-pointer",children:[l(Po,{className:n("mr-2 size-4 shrink-0",ne(o.key)===p.value?"opacity-100":"opacity-0")}),l("span",{children:p.label})]},p.label))]})]})]})})]}):o.type==="date"?l(Co,{value:ne(o.key),onChange:p=>{o.onlyExternal||ue(o.key,p)},placeholder:o.placeholder,mode:o.dateMode||"single",externalSearch:o.externalSearch,onlyExternal:o.onlyExternal,onExternalChange:p=>Le(o.key,p)}):b("div",{className:"relative",children:[o.icon&&l(o.icon,{className:"absolute -translate-y-1/2 size-4 left-3 top-1/2 text-muted-foreground"}),l(Et,{placeholder:o.placeholder,value:ne(o.key)??"",onChange:p=>{ue(o.key,p.target.value)},className:n("h-8 rounded-lg",o.icon&&"pl-9"),type:o.type==="number"?"number":"text"})]})},o.key)),(t.some(o=>o.externalSearch)||t.some(o=>o.customFilter))&&b(C,{variant:"default",size:"sm",onClick:ot,className:"rounded-lg h-7",children:[l(wo,{className:"size-4"}),t.find(o=>o.externalSearch||o.customFilter)?.searchButtonText||"Search"]})]})}),b("div",{className:"flex items-center gap-2",children:[v&&b("div",{className:"relative",children:[l(wo,{className:"absolute -translate-y-1/2 size-4 left-3 top-1/2 text-muted-foreground"}),l(Et,{placeholder:"Global search...",value:a??"",onChange:o=>u(o.target.value),className:"pl-9 h-8 max-w-max"})]}),Ge.length>0&&G&&b(re,{children:[l(ie,{asChild:!0,children:b(C,{variant:"outline",size:"sm",className:n("rounded-lg gap-1",le&&"bg-primary/10 dark:bg-primary/10 border-primary/20 dark:border-primary/20"),children:[l(qt,{className:"size-4"}),l("span",{children:"Aggregations"}),l($t,{className:"opacity-50 size-4"})]})}),b(se,{align:"end",className:"w-64 rounded-lg max-h-[500px] overflow-y-auto",children:[b(q,{className:"flex items-center justify-between px-4 py-2",children:[l("span",{className:"text-sm font-medium",children:"Column Aggregations"}),le&&l(C,{variant:"ghost",size:"sm",onClick:nt,className:"h-6 px-2 text-xs",children:"Clear All"})]}),l(K,{}),Ge.map(o=>{let c=X[o.id],p=c?.enabled;return b(go,{children:[l(fo,{className:"text-sm",children:b("div",{className:"flex items-center w-full gap-2",children:[l(Ke,{checked:p,onCheckedChange:()=>Tt(o.id),className:"data-[state=checked]:bg-primary"}),l("span",{className:n("flex-1",p&&"font-medium text-primary"),children:Pe(o.id)}),p&&b("div",{className:"flex items-center gap-1",children:[c?.functions?.slice(0,2).map(S=>l("div",{className:"w-2 h-2 rounded-full bg-primary",title:Do.find(j=>j.value===S)?.label},S)),c?.functions&&c.functions.length>2&&b("div",{className:"text-xs text-muted-foreground",children:["+",c.functions.length-2]})]})]})}),b(bo,{className:"w-48 rounded-lg",children:[l(q,{className:"px-3 py-2 text-xs font-medium text-muted-foreground",children:"Select Functions"}),Do.map(S=>l(Re,{checked:c?.functions?.includes(S.value)||!1,onCheckedChange:()=>Ee(o.id,S.value),className:"py-2 text-sm",children:b("div",{className:"flex flex-col",children:[l("span",{children:S.label}),l("span",{className:"text-xs text-muted-foreground",children:S.description})]})},S.value))]})]},o.id)}),Ge.length===0&&b("div",{className:"px-3 py-4 text-center",children:[l(qt,{className:"w-8 h-8 mx-auto mb-2 opacity-50 text-muted-foreground"}),l("p",{className:"text-sm text-muted-foreground",children:"No numeric columns available for aggregation"})]})]})]}),m&&b(C,{variant:"outline",size:"sm",onClick:()=>m(P),className:"rounded-lg",children:[l(kn,{className:"size-4"}),"Export"]}),h&&b(re,{children:[l(ie,{asChild:!0,className:"h-7",children:b(C,{variant:"outline",size:"sm",className:"gap-1 rounded-lg",children:[l("span",{children:"Columns"}),l($t,{className:"opacity-50 size-4"})]})}),b(se,{align:"end",className:"w-[220px] rounded-lg max-h-[400px] overflow-y-auto",children:[l(q,{className:"px-4 py-2 text-sm font-medium",children:"Toggle Columns"}),l(K,{}),tt().length>0&&b(Gt,{children:[l(q,{className:"px-4 py-1.5 text-sm font-medium text-muted-foreground",children:"General"}),tt().map(o=>l(Re,{className:"text-sm",checked:o.getIsVisible(),onCheckedChange:c=>o.toggleVisibility(!!c),children:Pe(o.id)},o.id))]}),He().map(o=>b(Gt,{children:[l(K,{}),l(q,{className:"px-4 py-1.5 text-sm font-medium text-muted-foreground",children:o.id}),o.columns?.filter(c=>c.getCanHide?.()!==!1).map(c=>l(Re,{className:"text-sm",checked:c.getIsVisible(),onCheckedChange:p=>c.toggleVisibility(!!p),children:Pe(c.id,o.id)},c.id))]},o.id))]})]}),b(re,{children:[l(ie,{asChild:!0,className:"h-7",children:l(C,{variant:"outline",size:"sm",className:"rounded-lg h-7",children:l(Rn,{className:"size-4"})})}),b(se,{align:"end",className:"w-[200px] rounded-lg",children:[l(q,{children:"Table Settings"}),l(K,{}),b(V,{onClick:R,children:[l(zn,{className:"size-4"}),"Clear All Sorting"]}),b(V,{onClick:Dt,children:[l(No,{className:"size-4"}),"Clear All Filters"]}),le&&b(V,{onClick:nt,children:[l(qt,{className:"size-4"}),"Clear Aggregations"]}),Q&&b(Fn,{children:[l(K,{}),l(q,{children:"Column Pinning"}),b(V,{onClick:()=>e.setColumnPinning({left:[],right:[]}),children:[l(Mn,{className:"size-4"}),"Reset All Pinning"]}),b(V,{onClick:()=>{let o=Be().filter(c=>c.getCanPin?.()!==!1).map(c=>c.id);e.setColumnPinning({left:[],right:o})},children:[l(In,{className:"-rotate-90 size-4"}),"Pin All Right"]})]})]})]}),k&&l(C,{variant:"outline",size:"sm",onClick:k,disabled:I,className:"rounded-lg",children:l(Sn,{className:n("h-4 w-4",I&&"animate-spin")})})]})]})})})})}import{Select as J}from"radix-ui";import{CheckIcon as _n,ChevronDownIcon as To,ChevronUpIcon as Vn}from"lucide-react";import{jsx as A,jsxs as Kt}from"react/jsx-runtime";function So({...e}){return A(J.Root,{"data-slot":"select",...e})}function ko({...e}){return A(J.Value,{"data-slot":"select-value",...e})}function Ro({className:e,size:t="default",children:a,...u}){return Kt(J.Trigger,{"data-slot":"select-trigger","data-size":t,className:n("border-input data-[placeholder]:text-muted-foreground [&_svg:not([class*='text-'])]:text-muted-foreground focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 dark:hover:bg-input/50 flex w-fit items-center justify-between gap-2 rounded-md border bg-transparent px-3 py-2 text-sm whitespace-nowrap shadow-xs transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50 data-[size=default]:h-9 data-[size=sm]:h-8 *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-2 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",e),...u,children:[a,A(J.Icon,{asChild:!0,children:A(To,{className:"size-4 opacity-50"})})]})}function zo({className:e,children:t,position:a="popper",...u}){return A(J.Portal,{children:Kt(J.Content,{"data-slot":"select-content",className:n("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 relative z-50 max-h-(--radix-select-content-available-height) min-w-[8rem] origin-(--radix-select-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border shadow-md",a==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",e),position:a,...u,children:[A(An,{}),A(J.Viewport,{className:n("p-1",a==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)] scroll-my-1"),children:t}),A(Bn,{})]})})}function Mo({className:e,children:t,...a}){return Kt(J.Item,{"data-slot":"select-item",className:n("focus:bg-accent focus:text-accent-foreground [&_svg:not([class*='text-'])]:text-muted-foreground relative flex w-full cursor-default items-center gap-2 rounded-sm py-1.5 pr-8 pl-2 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 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2",e),...a,children:[A("span",{className:"absolute right-2 flex size-3.5 items-center justify-center",children:A(J.ItemIndicator,{children:A(_n,{className:"size-4"})})}),A(J.ItemText,{children:t})]})}function An({className:e,...t}){return A(J.ScrollUpButton,{"data-slot":"select-scroll-up-button",className:n("flex cursor-default items-center justify-center py-1",e),...t,children:A(Vn,{className:"size-4"})})}function Bn({className:e,...t}){return A(J.ScrollDownButton,{"data-slot":"select-scroll-down-button",className:n("flex cursor-default items-center justify-center py-1",e),...t,children:A(To,{className:"size-4"})})}import{jsx as E,jsxs as Fe}from"react/jsx-runtime";function Jt({table:e,config:t}){return t.enabled?E("div",{className:"rounded-xl",children:E("div",{children:Fe("div",{className:"flex items-center justify-between",children:[E("div",{className:"flex items-center gap-6 text-sm text-muted-foreground",children:t.showInfo!==!1&&Fe("span",{children:["Showing ",e.getState().pagination.pageIndex*e.getState().pagination.pageSize+1," to"," ",Math.min((e.getState().pagination.pageIndex+1)*e.getState().pagination.pageSize,e.getFilteredRowModel().rows.length)," ","of ",e.getFilteredRowModel().rows.length," entries"]})}),Fe("div",{className:"flex items-center gap-4",children:[t.pageSizeOptions&&Fe("div",{className:"flex items-center gap-2",children:[E("span",{className:"text-sm font-medium",children:"Rows per page:"}),Fe(So,{value:`${e.getState().pagination.pageSize}`,onValueChange:a=>e.setPageSize(Number(a)),children:[E(Ro,{className:"h-9 w-[70px] rounded-lg",children:E(ko,{})}),E(zo,{side:"top",className:"rounded-lg",children:t.pageSizeOptions.map(a=>E(Mo,{value:`${a}`,children:a},a))})]})]}),Fe("div",{className:"flex items-center gap-2",children:[E(C,{variant:"outline",size:"sm",onClick:()=>e.setPageIndex(0),disabled:!e.getCanPreviousPage(),className:"rounded-lg",children:"First"}),E(C,{variant:"outline",size:"sm",onClick:()=>e.previousPage(),disabled:!e.getCanPreviousPage(),className:"rounded-lg",children:"Previous"}),t.showPageNumbers&&E("div",{className:"flex items-center gap-1",children:Array.from({length:Math.min(5,e.getPageCount())},(a,u)=>{let v=e.getState().pagination.pageIndex,m=v+u;return m<1||m>e.getPageCount()?null:E(C,{variant:m===v+1?"default":"outline",size:"sm",className:"size-8 p-0 rounded-lg",onClick:()=>e.setPageIndex(m-1),children:m},m)})}),E(C,{variant:"outline",size:"sm",onClick:()=>e.nextPage(),disabled:!e.getCanNextPage(),className:"rounded-lg",children:"Next"}),E(C,{variant:"outline",size:"sm",onClick:()=>e.setPageIndex(e.getPageCount()-1),disabled:!e.getCanNextPage(),className:"rounded-lg",children:"Last"})]})]})]})})}):null}import{Toggle as Hn}from"radix-ui";import{cva as Ln}from"class-variance-authority";import{jsx as En}from"react/jsx-runtime";var On=Ln("inline-flex cursor-pointer 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 [&_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",{variants:{variant:{default:"bg-transparent",outline:"border border-input bg-transparent shadow-xs hover:bg-accent hover:text-accent-foreground"},size:{sm:"h-7 px-0 min-w-7",default:"h-8 px-1 min-w-8",lg:"h-9 px-2 min-w-10"},bg:{enabled:"data-[state=on]:bg-accent data-[state=on]:text-accent-foreground",disabled:""}},defaultVariants:{variant:"default",size:"default",bg:"enabled"}});function Io({className:e,variant:t,size:a,noBg:u,...v}){return En(Hn.Root,{"data-slot":"toggle",className:n(On({className:e,variant:t,size:a,bg:u?"disabled":"enabled"})),...v})}import{useCallback as xt,useEffect as Ct,useMemo as yt,useRef as Je,useState as W}from"react";import{Fragment as Ao,jsx as s,jsxs as D}from"react/jsx-runtime";var Vo={sum:e=>e.reduce((t,a)=>t+a,0),average:e=>e.length>0?e.reduce((t,a)=>t+a,0)/e.length:0,min:e=>e.length>0?Math.min(...e):0,max:e=>e.length>0?Math.max(...e):0,count:e=>e.length,unique:e=>new Set(e).size,median:e=>{if(e.length===0)return 0;let t=[...e].sort((u,v)=>u-v),a=Math.floor(t.length/2);return t.length%2===0?(t[a-1]+t[a])/2:t[a]}};function Qn({data:e,columns:t,filters:a=[],pagination:u={enabled:!1},settings:v={},header:m,footer:k,className:I="",maxHeight:h="100%",loading:P=!1,error:R,emptyMessage:L="No data available",onRowSelectionChange:Q,onExport:me,onRefresh:te,onTableReady:X,children:G,isRowDisabled:Y,isRowSelectable:y,onExternalSearch:Ae,aggregations:oe={},onAggregationChange:Ze,rowClassName:et}){let[Be,He]=W([]),[tt,Pe]=W([]),[Le,Pt]=W({}),[ot,Dt]=W({}),[ne,ue]=W(""),[Oe,Tt]=W([]),[Ee,nt]=W(v.enableColumnPinning?{left:[],right:[]}:{}),[at,Ge]=W({}),le=Je(null),o=Je(null),c=Je(null),p=Je(null),[S,j]=W(0),[rt,Lo]=W(0),[Oo,Eo]=W(0),[to,Go]=W(0),it=Je(null),[St,jo]=W(!1),{enableSorting:kt=!0,enableFiltering:Rt=!0,enableGlobalFilter:oo=!0,enableColumnVisibility:zt=!0,enableRowSelection:U=!0,stickyHeader:xa=!0,toolbar:je=!1,disableHeaderCheckbox:Uo=!1,toolbarPosition:Ce="default",showSerialNumbers:ae=!0,fixedCheckboxColumn:st=!0,striped:$o=!0,hoverable:qo=!0,compact:Ue=!0,bordered:no=!0,fullHeight:Wo=!1,enableColumnResizing:ao=!1,enableColumnPinning:B=!0,hideHeader:Xo=!1,selectionMode:pe="multiple",showCheckBox:Ko=!0,checkboxColumnPosition:ro=0}=v;Ct(()=>{let d=()=>{it.current&&jo(it.current.scrollTop>0)},g=it.current;if(g)return g.addEventListener("scroll",d),()=>g.removeEventListener("scroll",d)},[]),Ct(()=>{let d=()=>{le.current&&j(le.current.offsetHeight+16),o.current&&Lo(o.current.offsetHeight+16),c.current&&Eo(c.current.offsetHeight+16),p.current&&Go(p.current.offsetHeight+16)};d();let g=new ResizeObserver(()=>{setTimeout(d,50)});return le.current&&g.observe(le.current),o.current&&g.observe(o.current),c.current&&g.observe(c.current),p.current&&g.observe(p.current),()=>{g.disconnect()}},[je,m,Ce]);let Jo=(d,g)=>g.split(".").reduce((i,r)=>i&&i[r],d),Mt=yt(()=>Object.keys(at).length===0?e:e.filter(d=>Object.entries(at).every(([g,i])=>{if(!i||i==="")return!0;let r=Jo(d,g);return typeof i=="string"?String(r).toLowerCase().includes(i.toLowerCase()):r===i})),[e,at]),Qo=xt((d,g)=>{Ge(i=>{let r={...i};return g===""||g===null||g===void 0?delete r[d]:r[d]=g,r})},[]),De=yt(()=>{let d=[...t],g=f=>f.map(x=>{if(x.id==="select"||x.id==="serialNumber")return x;let N={...x,enablePinning:!0};return x.columns&&(N.columns=g(x.columns)),N}),i=g(d),r={id:"select",header:({table:f})=>{if(pe==="single")return null;let x=f.getRowModel().rows.filter(z=>!Y?.(z.original)&&(y?y(z.original):!0)),N=x.length>0&&x.every(z=>z.getIsSelected()),T=x.some(z=>z.getIsSelected());return s(Ke,{checked:N||T&&"indeterminate",onCheckedChange:z=>{x.forEach(F=>F.toggleSelected(!!z))},disabled:Uo||x.length===0,"aria-label":"Select all selectable rows"})},cell:({row:f})=>{let x=Y?Y(f.original):!1,N=y?y(f.original):!0;return s("div",{className:n("flex items-center justify-center",x&&"opacity-50"),children:pe==="multiple"?s(Ke,{checked:f.getIsSelected(),onCheckedChange:T=>N&&f.toggleSelected(!!T),"aria-label":"Select row",disabled:x||!N}):Ko?s("input",{type:"radio",checked:f.getIsSelected(),onChange:()=>N&&f.toggleSelected(!0),disabled:x||!N,className:"w-4 h-4 rounded-full border-primary text-primary focus:ring-primary"}):null})},enableSorting:!1,enableHiding:!1,enablePinning:!0,headerAlign:"center",size:pe==="multiple"?40:30};if(U){let f=ro;f<0&&(f=i.length+f+1),f=Math.max(0,Math.min(f,i.length)),i.splice(f,0,r)}if(ae){let f={id:"serialNumber",header:"No.",cell:({row:x})=>s("div",{className:"font-medium text-center text-muted-foreground",children:x.index+1}),enableSorting:!0,enableHiding:!1,enablePinning:!0,size:60,headerAlign:"center"};i.unshift(f)}return i},[t,ae,U,st,Y,y,pe,ro]),w=qn({data:Mt,columns:De,onSortingChange:kt?He:void 0,onColumnFiltersChange:Rt?Pe:void 0,onGlobalFilterChange:oo?ue:void 0,getCoreRowModel:Gn(),getPaginationRowModel:u.enabled?Un():void 0,getSortedRowModel:kt?$n():void 0,getFilteredRowModel:Rt?jn():void 0,onColumnVisibilityChange:zt?Pt:void 0,onRowSelectionChange:U?Dt:void 0,onColumnOrderChange:Tt,onColumnPinningChange:B?nt:void 0,state:{sorting:kt?Be:void 0,columnFilters:Rt?tt:void 0,columnVisibility:zt?Le:void 0,rowSelection:U?ot:{},globalFilter:ne,columnOrder:Oe,columnPinning:B?Ee:{}},initialState:{pagination:u.enabled?{pageSize:u.pageSize||10}:void 0,columnPinning:B?{left:[...ae?["serialNumber"]:[],...U?["select"]:[]],right:[]}:void 0},enableRowSelection:U,enableColumnResizing:ao,enableColumnPinning:B,columnResizeMode:"onChange"}),io=yt(()=>{if(!oe||Object.keys(oe).length===0)return{};let d={},g=w.getFilteredRowModel().rows;return Object.entries(oe).forEach(([i,r])=>{if(!r?.enabled)return;let f=g.map(N=>{if(r.accessor)return r.accessor(N.original);{let T=N.getValue(i);return typeof T=="number"?T:parseFloat(String(T))||0}}).filter(N=>N!==null&&!isNaN(N)),x={};r.functions?.forEach(N=>{Vo[N]&&(x[N]=Vo[N](f))}),Object.keys(x).length>0&&(d[i]=x)}),d},[Mt,oe,w?.getFilteredRowModel().rows]);Ct(()=>{if(U&&Q){let d=w.getFilteredSelectedRowModel().rows.filter(g=>!Y?.(g.original)&&(y?y(g.original):!0)).map(g=>g.original);Q(d)}},[ot,U,Q,w,Y,y]);let Yo=xt(d=>{pe==="single"?(w.resetRowSelection(),d.toggleSelected(!0)):d.toggleSelected()},[pe,w]);Ct(()=>{X&&X(w)},[w,X]);let Zo=xt(()=>{He([])},[]),en=xt(()=>{Pe([]),ue("")},[]),so=(d,g)=>{if(!B)return;let i=[...ae?["serialNumber"]:[],...U&&st?["select"]:[]],r={left:[...(Ee.left??[]).filter(f=>i.includes(f))],right:[...Ee.right??[]]};g===!1?(r.left=r.left.filter(f=>f!==d),r.right=r.right.filter(f=>f!==d)):g==="right"?(r.left=r.left.filter(f=>f!==d),r.right.includes(d)||r.right.push(d)):g==="left"&&(r.right=r.right.filter(f=>f!==d),!r.left.includes(d)&&!i.includes(d)&&r.left.push(d)),w.setColumnPinning(r)},tn=()=>{let d=Object.keys(io).length>0,g=w.getHeaderGroups()[0]?.headers.some(r=>r.column.columnDef.customFooter),i=ae&&w.getFilteredRowModel().rows.length>0&&(d||g);return!d&&!g&&!i?null:s(Vt,{className:"sticky bottom-0 border-t bg-sidebar z-20",children:s(de,{className:"hover:bg-transparent bg-sidebar",children:w.getHeaderGroups()[0]?.headers.map((r,f)=>{let x=r.column.id,N=io[x],T=B&&(r.column.getIsPinned()==="left"||r.column.id==="serialNumber"||r.column.id==="select"&&U),z=B&&r.column.getIsPinned()==="right",F=r.column.id==="serialNumber",ge=r.column.id==="select",_=r.column.columnDef.customFooter;return N||_||F&&i?s(ce,{className:n("font-semibold text-sm py-2 px-2 border-r",Ue&&"py-1",T&&"sticky left-0 z-30 bg-sidebar/95",z&&"sticky right-0 z-30 bg-sidebar/95",(F||ge)&&"sticky left-0 z-30 bg-sidebar/95",_?.className),style:{width:r.getSize()!==150?r.getSize():"auto",minWidth:r.getSize()!==150?r.getSize():"auto",...T&&{left:F?0:ge?ae&&w.getColumn("serialNumber")?.getSize()||0:lt(r.column)},...z&&{right:dt(r.column)},...F&&{left:0}},children:(()=>{if(_?.content){let ye=typeof _.content=="function"?_.content(w):_.content;return s("div",{className:n("w-full h-full",_.align==="center"&&"text-center",_.align==="right"&&"text-right",_.align==="left"&&"text-left"),children:ye})}return N?s("div",{className:"flex flex-col gap-0.5 text-xs",children:Object.entries(N).map(([ye,sn])=>D("div",{className:"flex items-center justify-between text-muted-foreground",children:[D("span",{className:"text-xs capitalize",children:[ye,":"]}),s("span",{className:"font-medium text-foreground",children:on(ye,sn)})]},ye))}):F&&i?D("div",{className:"text-xs text-center text-muted-foreground",children:["Total: ",w.getFilteredRowModel().rows.length]}):null})()},`agg-${r.id}`):s(ce,{className:n("py-0 px-0 border-r",Ue&&"py-0",T&&"sticky left-0 z-30 bg-sidebar/95",z&&"sticky right-0 z-30 bg-sidebar/95",(F||ge)&&"sticky left-0 z-30 bg-sidebar/95"),style:{width:r.getSize()!==150?r.getSize():"auto",minWidth:r.getSize()!==150?r.getSize():"auto",...T&&{left:F?0:ge?ae&&w.getColumn("serialNumber")?.getSize()||0:lt(r.column)},...z&&{right:dt(r.column)},...F&&{left:0}}},`agg-${r.id}`)})})})},on=(d,g)=>typeof g=="number"?d==="count"||d==="unique"?g.toLocaleString():g.toLocaleString(void 0,{minimumFractionDigits:2,maximumFractionDigits:2}):g,nn=()=>w.getHeaderGroups().map((d,g)=>s(de,{className:"hover:bg-transparent",children:d.headers.map((i,r)=>{let f=i.depth===0&&i.colSpan>1,x=B&&(i.column.getIsPinned()==="left"||i.column.id==="serialNumber"||i.column.id==="select"&&U),N=B&&i.column.getIsPinned()==="right",T=i.column.getCanSort(),z=B&&i.column.columnDef.enablePinning!==!1,F=i.column.id==="serialNumber",ge=i.column.id==="select",Ft=F||ge&&st,_=i.column.columnDef.headerAlign||"left",ct=oe&&oe[i.column.id]?.enabled,ye={left:"justify-start",center:"justify-center",right:"justify-end"}[_];return D(mo,{colSpan:i.colSpan,className:n("font-semibold text-foreground bg-sidebar group px-0",!Ue&&"py-2",no&&r<d.headers.length-1&&"border-r","relative",x&&"sticky left-0 z-25 bg-sidebar",N&&"sticky right-0 z-25 bg-sidebar",(F||ge)&&"sticky left-0 z-25 bg-sidebar",f?"text-center":"text-left",ct&&"border-b-2 border-primary/30"),style:{width:i.getSize()!==150?i.getSize():"auto",minWidth:i.getSize()!==150?i.getSize():"auto",...x&&{left:F?0:ge?ae&&w.getColumn("serialNumber")?.getSize()||0:lt(i.column)},...N&&{right:dt(i.column)},...F&&{left:0}},children:[f?D("div",{className:"flex items-center justify-center",children:[Qt(i.column.columnDef.header,i.getContext()),ct&&s(_o,{className:"w-3 h-3 ml-1 text-primary"})]}):D("div",{className:n("relative flex items-center w-full px-2",ye),children:[D("div",{className:"flex items-center gap-1",children:[ct&&s(_o,{className:"w-3 h-3 mr-1 text-primary"}),T&&_==="right"&&s("span",{className:"order-2 ml-1",children:i.column.getIsSorted()&&{asc:s(Yt,{className:"w-4 h-4"}),desc:s(Zt,{className:"w-4 h-4"})}[i.column.getIsSorted()]}),i.isPlaceholder?null:Qt(i.column.columnDef.header,i.getContext()),T&&_!=="right"&&i.column.getIsSorted()&&s("span",{className:"order-2 ml-1",children:i.column.getIsSorted()&&{asc:s(Yt,{className:"w-4 h-4"}),desc:s(Zt,{className:"w-4 h-4"})}[i.column.getIsSorted()]})]}),(T||z&&!Ft)&&D(re,{children:[s(ie,{asChild:!0,className:n("absolute",_==="left"&&"right-1",_==="center"&&"right-1",_==="right"&&"left-1"),children:s(Io,{variant:"default",size:"sm",noBg:!0,tabIndex:-1,className:"opacity-0 group-hover:opacity-70 hover:opacity-100 data-[state=open]:opacity-100",children:s(Xn,{className:"w-4 h-4"})})}),D(se,{align:"end",className:"w-48",children:[T&&D(Ao,{children:[s(q,{children:"Sorting"}),D(V,{onClick:()=>i.column.toggleSorting(!1),children:[s(Yt,{className:"w-4 h-4 mr-2"}),"Sort Ascending"]}),D(V,{onClick:()=>i.column.toggleSorting(!0),children:[s(Zt,{className:"w-4 h-4 mr-2"}),"Sort Descending"]}),D(V,{onClick:()=>i.column.clearSorting(),disabled:!i.column.getIsSorted(),children:[s(Wn,{className:"w-4 h-4 mr-2"}),"Clear Sort"]}),s(K,{})]}),z&&!Ft&&D(Ao,{children:[s(q,{children:"Pin Column"}),D(V,{onClick:()=>so(i.column.id,"right"),disabled:i.column.getIsPinned()==="right",children:[s(Kn,{}),"Pin Right"]}),D(V,{onClick:()=>so(i.column.id,!1),disabled:!i.column.getIsPinned(),children:[s(Jn,{}),"Unpin"]})]})]})]})]}),ao&&i.column.getCanResize()&&!f&&i.colSpan===1&&s("div",{className:"absolute top-0 right-0 w-1 h-full transition-opacity opacity-0 bg-border hover:bg-primary cursor-col-resize hover:opacity-100",onMouseDown:i.getResizeHandler()})]},i.id)})},d.id)),lt=d=>{if(!B)return;let g=0,i=w.getLeftHeaderGroups()[0]?.headers||[],r=[...ae?["serialNumber"]:[],...U?["select"]:[]];for(let f of i){if(f.id===d.id)break;if(r.includes(f.id)){let x=w.getColumn(f.id);x&&(g+=x.getSize())}}return g},dt=d=>{if(!B)return;let g=w.getState().columnPinning.right||[],i=g.indexOf(d.id);if(i===-1)return;let r=0;for(let f=i+1;f<g.length;f++){let x=w.getColumn(g[f]);x&&(r+=x.getSize())}return r};if(R)return s(At,{className:"w-full shadow-sm rounded-xl",children:s(Bt,{className:"flex items-center justify-center",children:D("div",{className:"text-center",children:[s("div",{className:"mb-3 text-2xl text-red-500",children:"\u26A0\uFE0F"}),s("p",{className:"mb-4 text-sm text-muted-foreground",children:R}),te&&D(C,{variant:"outline",size:"sm",onClick:te,className:"rounded-lg",children:[s(Fo,{className:"w-4 h-4 mr-2"}),"Try Again"]})]})})});let an=d=>d&&typeof d=="object"&&"content"in d,Z=yt(()=>m?an(m)?{content:m.content,align:m.align||"left",className:m.className||"",sticky:m.sticky!==void 0?m.sticky:!0,showOnEmpty:m.showOnEmpty!==void 0?m.showOnEmpty:!0}:{content:m,align:"left",className:"",sticky:!0,showOnEmpty:!0}:null,[m]),It=()=>je?s(Xt,{table:w,filters:a,globalFilter:ne,onGlobalFilterChange:ue,enableGlobalFilter:oo,onExport:me,onRefresh:te,loading:P,enableColumnVisibility:zt,enableColumnPinning:B,data:Mt,onClearSorting:Zo,onClearFilters:en,onExternalSearch:Ae,onCustomFilterChange:Qo,aggregations:oe,onAggregationChange:Ze}):null,rn=()=>{let d=0;return Ce==="above-header"&&(d+=rt),Z&&(d+=to),Ce==="below-header"&&(d+=Oo),d};return s($e,{children:D("div",{className:n("w-full space-y-2 flex flex-col h-full",I),children:[je&&Ce==="default"&&s("div",{ref:le,className:"relative z-40",children:It()}),s(At,{className:n("shadow-sm overflow-hidden py-0",Wo&&"flex-1"),children:s(Bt,{className:"h-full p-0",children:D("div",{className:"relative flex flex-col justify-between h-full",children:[P&&s("div",{className:"absolute inset-0 z-50 flex items-center justify-center bg-background/80 backdrop-blur-sm rounded-xl",children:D("div",{className:"flex items-center gap-3 px-4 py-3 rounded-lg shadow-sm bg-background/90",children:[s(Fo,{className:"size-5 animate-spin text-primary"}),s("span",{className:"text-sm font-medium text-muted-foreground",children:"Loading..."})]})}),s("div",{ref:it,className:n("relative overflow-auto border-b rounded-t-xl",w.getRowModel().rows?.length===0&&"h-full"),style:{maxHeight:h},children:D(_t,{className:n("w-full border-collapse relative",w.getRowModel().rows?.length===0&&"h-full"),children:[je&&Ce==="above-header"&&s("thead",{className:"sticky top-0 z-40 bg-sidebar border-b",children:s(de,{className:"hover:bg-transparent",children:s(ce,{colSpan:De.length,className:"p-2 bg-sidebar border-b shadow-sm",children:s("div",{ref:o,children:It()})})})}),Z&&(Z.showOnEmpty||w.getRowModel().rows?.length>0)&&s("thead",{className:n("sticky bg-sidebar border-b",St&&"shadow-sm"),style:{top:Ce==="above-header"?`${rt}px`:"0px",zIndex:35},children:s(de,{className:"hover:bg-transparent",children:s(ce,{colSpan:De.length,className:n("p-2 font-semibold text-foreground bg-sidebar",Ue?"py-2":"py-4",Z.className),children:s("div",{ref:p,className:n("flex items-center w-full",Z.align==="center"&&"justify-center",Z.align==="right"&&"justify-end",Z.align==="left"&&"justify-start"),children:typeof Z.content=="string"?s("span",{className:"text-lg font-bold tracking-tight text-foreground",children:Z.content}):Z.content})})})}),je&&Ce==="below-header"&&s("thead",{className:n("sticky bg-sidebar border-b",St&&"shadow-sm"),style:{top:Z?`${to}px`:"0px",zIndex:35},children:s(de,{className:"hover:bg-transparent",children:s(ce,{colSpan:De.length,className:"p-2 bg-sidebar",children:s("div",{ref:c,children:It()})})})}),!Xo&&s(lo,{className:n("sticky bg-sidebar",St&&"shadow-sm"),style:{top:`${rn()}px`,zIndex:30},children:nn()}),s(co,{children:w.getRowModel().rows?.length?w.getRowModel().rows.map((d,g)=>{let i=et?et(d):"";return s(de,{"data-state":d.getIsSelected()&&"selected",className:n(qo&&"hover:bg-muted/50",$o&&g%2===0&&"bg-muted/20",d.getIsSelected()&&"bg-muted","border-b last:border-b-0",pe==="single"&&"cursor-pointer",i),onClick:()=>{pe==="single"&&Yo(d)},children:d.getVisibleCells().map((r,f)=>{let x=B&&(r.column.getIsPinned()==="left"||r.column.id==="serialNumber"||r.column.id==="select"&&U),N=B&&r.column.getIsPinned()==="right",T=r.column.id==="serialNumber",z=r.column.id==="select",F=T||z&&st;return s(ce,{className:n(Ue?"py-2":"py-4",no&&f<d.getVisibleCells().length&&"border-r",x&&"sticky left-0 z-20 bg-sidebar/95",N&&"sticky right-0 z-20 bg-sidebar/95",T&&"sticky left-0 z-20 bg-sidebar/95","p-1"),style:{width:r.column.getSize()!==150?r.column.getSize():"auto",minWidth:r.column.getSize()!==150?r.column.getSize():"auto",...x&&{left:T?0:z?ae&&w.getColumn("serialNumber")?.getSize()||0:lt(r.column)},...N&&{right:dt(r.column)},...T&&{left:0}},children:Qt(r.column.columnDef.cell,r.getContext())},r.id)})},d.id)}):s(de,{children:s(ce,{colSpan:De.length,className:"h-32 text-center border-0",children:D("div",{className:"flex flex-col items-center gap-3",children:[s("div",{className:"text-6xl text-muted-foreground",children:"\u{1F4CB}"}),s("p",{className:"font-medium text-muted-foreground",children:L})]})})})}),tn()]})}),k&&s("div",{className:"sticky bottom-0 z-10 w-full bg-sidebar",style:{width:"100%",minWidth:"fit-content"},children:s(_t,{children:s(Vt,{children:s(de,{className:"bg-sidebar",children:s(ce,{colSpan:De.length,className:"p-2",children:k})})})})})]})})}),s(Jt,{table:w,config:u}),G&&G(w)]})})}import{Separator as Yn}from"radix-ui";import{jsx as Zn}from"react/jsx-runtime";function wt({className:e,orientation:t="horizontal",decorative:a=!0,...u}){return Zn(Yn.Root,{"data-slot":"separator-root",decorative:a,orientation:t,className:n("bg-border shrink-0 data-[orientation=horizontal]:h-px data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-full data-[orientation=vertical]:w-px",e),...u})}import{Loader as ea,X as ta}from"lucide-react";import{AnimatePresence as oa,motion as na}from"framer-motion";import*as he from"react";import*as Bo from"react-dom";import{jsx as H,jsxs as Qe}from"react/jsx-runtime";function aa({table:e,visible:t,container:a,children:u,className:v,...m}){let[k,I]=he.useState(!1);he.useLayoutEffect(()=>{I(!0)},[]),he.useEffect(()=>{function R(L){L.key==="Escape"&&e&&e.toggleAllRowsSelected(!1)}return window.addEventListener("keydown",R),()=>window.removeEventListener("keydown",R)},[e]);let h=a??(k?globalThis.document?.body:null);if(!h||!e)return null;let P=t??e.getFilteredSelectedRowModel().rows.length>0;return Bo.createPortal(H(oa,{children:P&&H(na.div,{role:"toolbar","aria-orientation":"horizontal",initial:{opacity:0,y:20},animate:{opacity:1,y:0},exit:{opacity:0,y:20},transition:{duration:.3,ease:"easeInOut"},className:n("fixed inset-x-0 bottom-6 z-50 mx-auto flex w-fit flex-wrap items-center justify-center gap-2 rounded-xl border bg-primary/10 backdrop-blur-sm p-3 text-foreground ring-5 ring-primary/5",v),...m,children:H($e,{children:u})})}),h)}function ra({size:e="sm",tooltip:t,isPending:a,disabled:u,className:v,children:m,...k}){let I=H(C,{variant:"secondary",size:e,className:n("gap-1.5 rounded-lg border border-secondary bg-secondary/50 hover:bg-secondary/70 transition-all duration-200",e==="icon"?"size-8":"h-8 px-3",v),disabled:u||a,...k,children:a?H(ea,{className:"animate-spin"}):m});return t?Qe(Ht,{children:[H(Lt,{asChild:!0,children:I}),H(Ot,{sideOffset:8,className:"rounded-lg border font-semibold text-foreground bg-secondary [&>span]:hidden",children:H("p",{children:t})})]}):I}function ia({table:e}){let t=he.useCallback(()=>{e&&e.toggleAllRowsSelected(!1)},[e]);return e?Qe("div",{className:"flex h-8 items-center rounded-lg border bg-muted/50 pr-1 pl-3",children:[Qe("span",{className:"whitespace-nowrap text-sm font-medium",children:[e.getFilteredSelectedRowModel().rows.length," selected"]}),H(wt,{orientation:"vertical",className:"mr-2 ml-3 data-[orientation=vertical]:h-4"}),Qe(Ht,{children:[H(Lt,{asChild:!0,children:H(C,{variant:"ghost",size:"icon",className:"size-6 rounded-md",onClick:t,children:H(ta,{className:"size-3.5"})})}),Qe(Ot,{sideOffset:10,className:"flex items-center gap-2 rounded-lg border px-3 py-2 font-semibold text-foregroun bg-secondary [&>span]:hidden",children:[H("p",{children:"Clear selection"}),H("kbd",{className:"select-none rounded border bg-primary/50 px-2 py-1 font-mono font-normal text-[0.7rem] text-foreground shadow-sm",children:H("abbr",{title:"Escape",className:"no-underline",children:"Esc"})})]})]})]}):null}import{ArrowUpDown as Ye,EyeOff as sa}from"lucide-react";import{jsx as ee,jsxs as _e}from"react/jsx-runtime";function la({column:e,title:t,className:a}){return e.getCanSort()?ee("div",{className:n("flex items-center space-x-2",a),children:_e(re,{children:[ee(ie,{asChild:!0,children:_e(C,{variant:"ghost",size:"sm",className:"-ml-3 h-8 data-[state=open]:bg-accent",children:[ee("span",{children:t}),e.getIsSorted()==="desc"?ee(Ye,{className:"ml-2 h-4 w-4"}):e.getIsSorted()==="asc"?ee(Ye,{className:"ml-2 h-4 w-4"}):ee(Ye,{className:"ml-2 h-4 w-4"})]})}),_e(se,{align:"start",className:"rounded-lg",children:[_e(V,{onClick:()=>e.toggleSorting(!1),children:[ee(Ye,{className:"mr-2 h-3.5 w-3.5 text-muted-foreground/70"}),"Asc"]}),_e(V,{onClick:()=>e.toggleSorting(!0),children:[ee(Ye,{className:"mr-2 h-3.5 w-3.5 text-muted-foreground/70"}),"Desc"]}),ee(K,{}),_e(V,{onClick:()=>e.toggleVisibility(!1),children:[ee(sa,{className:"mr-2 h-3.5 w-3.5 text-muted-foreground/70"}),"Hide"]})]})]})}):ee("div",{className:n(a),children:t})}import{ChevronDown as da,Eye as ca}from"lucide-react";import{jsx as Ve,jsxs as eo}from"react/jsx-runtime";function ma({table:e}){return eo(re,{children:[Ve(ie,{asChild:!0,children:eo(C,{variant:"outline",size:"sm",className:"rounded-lg",children:[Ve(ca,{className:"mr-2 h-4 w-4"}),"Columns ",Ve(da,{className:"ml-2 h-4 w-4"})]})}),eo(se,{align:"end",className:"w-[200px] rounded-lg",children:[Ve(q,{children:"Toggle Columns"}),Ve(K,{}),e.getAllColumns().filter(t=>typeof t.accessorFn<"u"&&t.getCanHide()).map(t=>Ve(Re,{className:"capitalize",checked:t.getIsVisible(),onCheckedChange:a=>t.toggleVisibility(!!a),children:t.id},t.id))]})]})}import{Slot as ua}from"radix-ui";import{cva as pa}from"class-variance-authority";import{jsx as fa}from"react/jsx-runtime";var ga=pa("inline-flex items-center justify-center rounded-md border px-2 py-0.5 text-xs font-medium w-fit whitespace-nowrap shrink-0 [&>svg]:size-3 gap-1 [&>svg]:pointer-events-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive transition-[color,box-shadow] overflow-hidden",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground [a&]:hover:bg-primary/90",secondary:"border-transparent bg-secondary text-secondary-foreground [a&]:hover:bg-secondary/90",destructive:"border-transparent bg-destructive text-white [a&]:hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",outline:"text-foreground [a&]:hover:bg-accent [a&]:hover:text-accent-foreground"}},defaultVariants:{variant:"default"}});function Nt({className:e,variant:t,asChild:a=!1,...u}){let v=a?ua.Slot:"span";return fa(v,{"data-slot":"badge",className:n(ga({variant:t}),e),...u})}import{CheckIcon as ba,PlusCircleIcon as va}from"lucide-react";import{Fragment as Ho,jsx as M,jsxs as xe}from"react/jsx-runtime";function ha({column:e,title:t,options:a}){let u=e?.getFacetedUniqueValues(),v=new Set(e?.getFilterValue());return xe(ze,{children:[M(Me,{asChild:!0,children:xe(C,{variant:"outline",size:"sm",className:"h-9 border-dashed rounded-lg",children:[M(va,{className:"mr-2 h-4 w-4"}),t,v?.size>0&&xe(Ho,{children:[M(wt,{orientation:"vertical",className:"mx-2 h-4"}),M(Nt,{variant:"secondary",className:"rounded-sm px-1 font-normal lg:hidden",children:v.size}),M("div",{className:"hidden space-x-1 lg:flex",children:v.size>2?xe(Nt,{variant:"secondary",className:"rounded-sm px-1 font-normal",children:[v.size," selected"]}):a.filter(m=>v.has(m.value)).map(m=>M(Nt,{variant:"secondary",className:"rounded-sm px-1 font-normal",children:m.label},m.value))})]})]})}),M(Ie,{className:"w-[200px] p-0 rounded-lg",align:"start",children:xe(ut,{className:"rounded-lg",children:[M(pt,{placeholder:t}),xe(gt,{children:[M(ft,{children:"No results found."}),M(qe,{children:a.map(m=>{let k=v.has(m.value);return xe(ke,{onSelect:()=>{k?v.delete(m.value):v.add(m.value);let I=Array.from(v);e?.setFilterValue(I.length?I:void 0)},children:[M("div",{className:n("mr-2 flex h-4 w-4 items-center justify-center rounded-sm border border-primary",k?"bg-primary text-primary-foreground":"opacity-50 [&_svg]:invisible"),children:M(ba,{className:n("h-4 w-4")})}),m.icon&&M(m.icon,{className:"mr-2 h-4 w-4 text-muted-foreground"}),M("span",{children:m.label}),u?.get(m.value)&&M("span",{className:"ml-auto flex h-4 w-4 items-center justify-center font-mono text-xs",children:u.get(m.value)})]},m.value)})}),v.size>0&&xe(Ho,{children:[M(po,{}),M(qe,{children:M(ke,{onSelect:()=>e?.setFilterValue(void 0),className:"justify-center text-center",children:"Clear filters"})})]})]})]})})]})}export{Qn as DataTable,aa as DataTableActionBar,ra as DataTableActionBarAction,ia as DataTableActionBarSelection,la as DataTableColumnHeader,ha as DataTableFacetedFilter,Jt as DataTablePagination,Xt as DataTableToolbar,ma as DataTableViewOptions};
|
|
3
3
|
//# sourceMappingURL=index.js.map
|