@akshar-technosoft/ui 1.0.19 → 1.0.21

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