@akshar-technosoft/ui 1.0.23 → 1.0.24
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/data/data-table/data-table.cjs +1 -1
- package/dist/components/data/data-table/data-table.cjs.map +1 -1
- package/dist/components/data/data-table/data-table.js +1 -1
- package/dist/components/data/data-table/data-table.js.map +1 -1
- package/dist/components/data/data-table/index.cjs +1 -1
- package/dist/components/data/data-table/index.cjs.map +1 -1
- package/dist/components/data/data-table/index.js +1 -1
- package/dist/components/data/data-table/index.js.map +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
"use client"
|
|
2
|
-
import{flexRender as Lo,getCoreRowModel as Zn,getFilteredRowModel as Qn,getPaginationRowModel as er,getSortedRowModel as tr,useReactTable as or}from"@tanstack/react-table";import{Loader2 as xa,ChevronUp as Oo,ChevronDown as _o,ChevronsUpDown as ar,MoreHorizontal as nr,MoveRightIcon as rr,PinOffIcon as ir,Calculator as ya}from"lucide-react";import{Slot as yn}from"radix-ui";import{cva as Cn}from"class-variance-authority";import{clsx as hn}from"clsx";import{twMerge as xn}from"tailwind-merge";function o(...e){return xn(hn(e))}import{jsx as wn}from"react/jsx-runtime";var ao=Cn("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 h({className:e,variant:t,size:a,asChild:r=!1,...s}){let i=r?yn.Slot:"button";return wn(i,{"data-slot":"button",className:o(ao({variant:t,size:a,className:e}),"transition-none"),...s})}import{jsx as Ye}from"react/jsx-runtime";function yo({className:e,...t}){return Ye("div",{"data-slot":"table-container",className:"relative w-full h-full max-h-full overflow-auto",children:Ye("table",{"data-slot":"table",className:o("w-full caption-bottom text-sm",e),...t})})}function ta({className:e,...t}){return Ye("thead",{"data-slot":"table-header",className:o("[&_tr]:border-b",e),...t})}function oa({className:e,...t}){return Ye("tbody",{"data-slot":"table-body",className:o("[&_tr:last-child]:border-0",e),...t})}function Co({className:e,...t}){return Ye("tfoot",{"data-slot":"table-footer",className:o("bg-muted/50 border-t font-medium [&>tr]:last:border-b-0",e),...t})}function Ve({className:e,...t}){return Ye("tr",{"data-slot":"table-row",className:o("hover:bg-muted/50 data-[state=selected]:bg-muted border-b transition-colors",e),...t})}function aa({className:e,...t}){return Ye("th",{"data-slot":"table-head",className:o("text-foreground h-10 px-2 text-left align-middle font-medium whitespace-nowrap",e),...t})}function He({className:e,...t}){return Ye("td",{"data-slot":"table-cell",className:o("p-2 align-middle whitespace-nowrap",e),...t})}import{jsx as na}from"react/jsx-runtime";function Ee({className:e,...t}){return na("div",{"data-slot":"card",className:o("bg-card text-card-foreground flex flex-col gap-6 rounded-xl border py-6 shadow-sm",e),...t})}function Ge({className:e,...t}){return na("div",{"data-slot":"card-content",className:o("px-6",e),...t})}import{Tooltip as yt}from"radix-ui";import{jsx as Ct,jsxs as Nn}from"react/jsx-runtime";function lt({delayDuration:e=0,...t}){return Ct(yt.Provider,{"data-slot":"tooltip-provider",delayDuration:e,...t})}function Ze({...e}){return Ct(lt,{children:Ct(yt.Root,{"data-slot":"tooltip",...e})})}function Qe({...e}){return Ct(yt.Trigger,{"data-slot":"tooltip-trigger",...e})}function et({className:e,sideOffset:t=0,children:a,...r}){return Ct(yt.Portal,{children:Nn(yt.Content,{"data-slot":"tooltip-content",sideOffset:t,className:o("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),...r,children:[a,Ct(yt.Arrow,{className:"bg-primary fill-primary z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px]"})]})})}import{Search as ua,RefreshCw as On,Download as _n,Settings2 as Vn,Filter as ga,ArrowUpDown as Hn,PinOff as En,Pin as Gn,ChevronDown as Mo,Calculator as zo,Check as fa}from"lucide-react";import{jsx as Tn}from"react/jsx-runtime";function wt({className:e,type:t,...a}){return Tn("input",{type:t,"data-slot":"input",className:o("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 Nt}from"cmdk";import{SearchIcon as Sn}from"lucide-react";import{Dialog as _i}from"radix-ui";import{XIcon as Hi}from"lucide-react";import{jsx as ji,jsxs as $i}from"react/jsx-runtime";import{jsx as dt,jsxs as Pn}from"react/jsx-runtime";function wo({className:e,...t}){return dt(Nt,{"data-slot":"command",className:o("bg-popover text-popover-foreground flex h-full w-full flex-col overflow-hidden rounded-md",e),...t})}function No({className:e,...t}){return Pn("div",{"data-slot":"command-input-wrapper",className:"flex h-9 items-center gap-2 border-b px-3",children:[dt(Sn,{className:"size-4 shrink-0 opacity-50"}),dt(Nt.Input,{"data-slot":"command-input",className:o("placeholder:text-muted-foreground flex h-10 w-full rounded-md bg-transparent py-3 text-sm outline-hidden disabled:cursor-not-allowed disabled:opacity-50",e),...t})]})}function To({className:e,...t}){return dt(Nt.List,{"data-slot":"command-list",className:o("max-h-[300px] scroll-py-1 overflow-x-hidden overflow-y-auto",e),...t})}function So({...e}){return dt(Nt.Empty,{"data-slot":"command-empty",className:"py-6 text-center text-sm",...e})}function Po({className:e,...t}){return dt(Nt.Group,{"data-slot":"command-group",className:o("text-foreground [&_[cmdk-group-heading]]:text-muted-foreground overflow-hidden p-1 [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium",e),...t})}function no({className:e,...t}){return dt(Nt.Item,{"data-slot":"command-item",className:o("data-[selected=true]:bg-accent data-[selected=true]:text-accent-foreground [&_svg:not([class*='text-'])]:text-muted-foreground relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",e),...t})}import{DropdownMenu as Ce}from"radix-ui";import{CheckIcon as kn,ChevronRightIcon as Dn,CircleIcon as rs}from"lucide-react";import{jsx as be,jsxs as la}from"react/jsx-runtime";function ze({...e}){return be(Ce.Root,{"data-slot":"dropdown-menu",...e})}function Ae({...e}){return be(Ce.Trigger,{"data-slot":"dropdown-menu-trigger",...e})}function Ie({className:e,sideOffset:t=4,...a}){return be(Ce.Portal,{children:be(Ce.Content,{"data-slot":"dropdown-menu-content",sideOffset:t,className:o("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 ko({...e}){return be(Ce.Group,{"data-slot":"dropdown-menu-group",...e})}function K({className:e,inset:t,variant:a="default",...r}){return be(Ce.Item,{"data-slot":"dropdown-menu-item","data-inset":t,"data-variant":a,className:o("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),...r})}function Ht({className:e,children:t,checked:a,...r}){return la(Ce.CheckboxItem,{"data-slot":"dropdown-menu-checkbox-item",className:o("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,...r,children:[be("span",{className:"pointer-events-none absolute left-2 flex size-3.5 items-center justify-center",children:be(Ce.ItemIndicator,{children:be(kn,{className:"size-4"})})}),t]})}function ce({className:e,inset:t,...a}){return be(Ce.Label,{"data-slot":"dropdown-menu-label","data-inset":t,className:o("px-2 py-1.5 text-sm font-medium data-[inset]:pl-8",e),...a})}function ve({className:e,...t}){return be(Ce.Separator,{"data-slot":"dropdown-menu-separator",className:o("bg-border -mx-1 my-1 h-px",e),...t})}function ra({...e}){return be(Ce.Sub,{"data-slot":"dropdown-menu-sub",...e})}function ia({className:e,inset:t,children:a,...r}){return la(Ce.SubTrigger,{"data-slot":"dropdown-menu-sub-trigger","data-inset":t,className:o("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),...r,children:[a,be(Dn,{className:"ml-auto size-4"})]})}function sa({className:e,...t}){return be(Ce.SubContent,{"data-slot":"dropdown-menu-sub-content",className:o("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 min-w-[8rem] origin-(--radix-dropdown-menu-content-transform-origin) overflow-hidden rounded-md border p-1 shadow-lg",e),...t})}import{useState as Ao}from"react";import{useEffect as Fn,useState as Do}from"react";import{Calendar as Bn}from"lucide-react";import{format as $t}from"date-fns";import{Popover as ro}from"radix-ui";import{jsx as io}from"react/jsx-runtime";function Et({...e}){return io(ro.Root,{"data-slot":"popover",...e})}function Gt({...e}){return io(ro.Trigger,{"data-slot":"popover-trigger",...e})}function jt({className:e,align:t="center",sideOffset:a=4,...r}){return io(ro.Portal,{children:io(ro.Content,{"data-slot":"popover-content",align:t,sideOffset:a,className:o("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),...r})})}import*as so from"react";import{ChevronDownIcon as Rn,ChevronLeftIcon as Mn,ChevronRightIcon as zn}from"lucide-react";import{DayPicker as An,getDefaultClassNames as da}from"react-day-picker";import{jsx as tt}from"react/jsx-runtime";function ca({className:e,classNames:t,showOutsideDays:a=!0,captionLayout:r="label",buttonVariant:s="ghost",formatters:i,components:u,...w}){let m=da();return tt(An,{showOutsideDays:a,className:o("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:r,formatters:{formatMonthDropdown:v=>v.toLocaleString("default",{month:"short"}),...i},classNames:{root:o("w-fit",m.root),months:o("flex gap-4 flex-col md:flex-row relative",m.months),month:o("flex flex-col w-full gap-4",m.month),nav:o("flex items-center gap-1 w-full absolute top-0 inset-x-0 justify-between",m.nav),button_previous:o(ao({variant:s}),"size-(--cell-size) aria-disabled:opacity-50 p-0 select-none",m.button_previous),button_next:o(ao({variant:s}),"size-(--cell-size) aria-disabled:opacity-50 p-0 select-none",m.button_next),month_caption:o("flex items-center justify-center h-(--cell-size) w-full px-(--cell-size)",m.month_caption),dropdowns:o("w-full flex items-center text-sm font-medium justify-center h-(--cell-size) gap-1.5",m.dropdowns),dropdown_root:o("relative has-focus:border-ring border border-input shadow-xs has-focus:ring-ring/50 has-focus:ring-[3px] rounded-md",m.dropdown_root),dropdown:o("absolute bg-popover inset-0 opacity-0",m.dropdown),caption_label:o("select-none font-medium",r==="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",m.caption_label),table:"w-full border-collapse",weekdays:o("flex",m.weekdays),weekday:o("text-muted-foreground rounded-md flex-1 font-normal text-[0.8rem] select-none",m.weekday),week:o("flex w-full mt-2",m.week),week_number_header:o("select-none w-(--cell-size)",m.week_number_header),week_number:o("text-[0.8rem] select-none text-muted-foreground",m.week_number),day:o("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",m.day),range_start:o("rounded-l-md bg-accent",m.range_start),range_middle:o("rounded-none",m.range_middle),range_end:o("rounded-r-md bg-accent",m.range_end),today:o("bg-accent text-accent-foreground rounded-md data-[selected=true]:rounded-none",m.today),outside:o("text-muted-foreground aria-selected:text-muted-foreground",m.outside),disabled:o("text-muted-foreground opacity-50",m.disabled),hidden:o("invisible",m.hidden),...t},components:{Root:({className:v,rootRef:p,...T})=>tt("div",{"data-slot":"calendar",ref:p,className:o(v),...T}),Chevron:({className:v,orientation:p,...T})=>p==="left"?tt(Mn,{className:o("size-4",v),...T}):p==="right"?tt(zn,{className:o("size-4",v),...T}):tt(Rn,{className:o("size-4",v),...T}),DayButton:In,WeekNumber:({children:v,...p})=>tt("td",{...p,children:tt("div",{className:"flex size-(--cell-size) items-center justify-center text-center",children:v})}),...u},...w})}function In({className:e,day:t,modifiers:a,...r}){let s=da(),i=so.useRef(null);return so.useEffect(()=>{a.focused&&i.current?.focus()},[a.focused]),tt(h,{ref:i,variant:"ghost",size:"icon","data-day":t.date.toLocaleDateString(),"data-selected-single":a.selected&&!a.range_start&&!a.range_end&&!a.range_middle,"data-range-start":a.range_start,"data-range-end":a.range_end,"data-range-middle":a.range_middle,className:o("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",s.day,e),...r})}import{jsx as ct,jsxs as Ut}from"react/jsx-runtime";function ma({value:e,onChange:t,placeholder:a,mode:r,externalSearch:s,onExternalChange:i,onlyExternal:u=!1}){let[w,m]=Do(!1),[v,p]=Do(e),[T,L]=Do(e);Fn(()=>{u||L(e)},[e,u]);let F=()=>{u||t(v),L(v),s&&i&&i(v),m(!1)},A=()=>{p(T),m(!1)},k=()=>{let S=r==="single"?null:{from:null,to:null};p(S),u||t(S),L(S),s&&i&&i(S),m(!1)},O=()=>{let S=u?T:e;return S?r==="single"?$t(S,"PPP"):S.from&&S.to?`${$t(S.from,"MMM dd")} - ${$t(S.to,"MMM dd, yyyy")}`:S.from?`From ${$t(S.from,"MMM dd, yyyy")}`:S.to?`To ${$t(S.to,"MMM dd, yyyy")}`:a:a},H=S=>{p(r==="single"?S:S||{from:null,to:null})};return Ut(Et,{open:w,onOpenChange:m,children:[ct(Gt,{className:"h-8",asChild:!0,children:Ut(h,{variant:"outline",className:o("w-full justify-start text-left font-normal h-9",!O()&&"text-muted-foreground"),children:[ct(Bn,{className:"mr-2 h-4 w-4"}),O()]})}),Ut(jt,{className:"w-auto p-0",align:"start",children:[ct("div",{className:"p-3",children:ct(ca,{mode:r,selected:v,onSelect:H,numberOfMonths:r==="range"?2:1,className:"rounded-md border",...r==="range"&&{required:!0}})}),Ut("div",{className:"flex items-center justify-between p-3 border-t",children:[ct(h,{variant:"ghost",size:"sm",onClick:k,children:"Clear"}),Ut("div",{className:"flex gap-2",children:[ct(h,{variant:"outline",size:"sm",onClick:A,children:"Cancel"}),ct(h,{size:"sm",onClick:F,disabled:r==="range"&&(!v?.from||!v?.to),children:"Apply"})]})]})]})]})}import{Checkbox as pa}from"radix-ui";import{CheckIcon as Ln}from"lucide-react";import{jsx as Ro}from"react/jsx-runtime";function mt({className:e,...t}){return Ro(pa.Root,{"data-slot":"checkbox",className:o("peer border-input dark:bg-input/30 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground dark:data-[state=checked]:bg-primary data-[state=checked]:border-primary focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive size-4 shrink-0 rounded-[4px] border shadow-xs transition-shadow outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50",e),...t,children:Ro(pa.Indicator,{"data-slot":"checkbox-indicator",className:"flex items-center justify-center text-current transition-none",children:Ro(Ln,{className:"size-3.5"})})})}import{Fragment as jn,jsx as g,jsxs as P}from"react/jsx-runtime";var ba=[{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 Io({table:e,filters:t=[],globalFilter:a,onGlobalFilterChange:r,enableGlobalFilter:s=!0,onExport:i,onRefresh:u,loading:w=!1,enableColumnVisibility:m=!0,data:v,onClearSorting:p,onClearFilters:T,enableColumnPinning:L=!1,onExternalSearch:F,onCustomFilterChange:A,aggregations:k={},onAggregationChange:O}){let[H,S]=Ao({}),[J,C]=Ao({}),[_,De]=Ao({}),Te=()=>e.getAllLeafColumns().filter(n=>n.getCanHide?.()!==!1),ie=()=>e.getAllColumns().filter(n=>!e.getAllLeafColumns().includes(n)&&n.columns?.length&&n.columns.some(f=>f.getCanHide?.()!==!1)),Ue=()=>{let n=new Set(ie().flatMap(f=>f.columns?.filter(x=>x.getCanHide?.()!==!1).map(x=>x.id)||[]));return Te().filter(f=>!n.has(f.id))},Se=(n,f)=>f&&n.startsWith(`${f}.`)?n.replace(`${f}.`,"").split("_").map(E=>E.slice(1)).join(" "):n.split("_").map(x=>x.charAt(0).toUpperCase()+x.slice(1)).join(" "),Q=(n,f)=>{let x={...H,[n]:f};S(x)},We=(n,f)=>{let x={...J,[n]:f};C(x),A&&A(n,f),t.find(E=>E.key===n)?.externalSearch&&Q(n,f)},se=()=>{F&&F(H)},Pe=()=>{S({}),C({}),T(),F&&F({}),A&&Object.keys(J).forEach(n=>{A(n,"")})},ye=n=>t.find(x=>x.key===n)?.customFilter?J[n]??"":e.getColumn(n)?.getFilterValue(),ue=(n,f)=>{let x=t.find(E=>E.key===n);x?.customFilter?We(n,f):(e.getColumn(n)?.setFilterValue(f),x?.externalSearch&&Q(n,f))},qe=(n,f)=>{De(x=>({...x,[n]:f}))},Le=n=>{if(O){let f=k[n],x={enabled:!f?.enabled,functions:f?.functions||["sum","average"]};O(n,x)}},Je=(n,f)=>{if(O){let E=k[n]?.functions||[],te=E.includes(f)?E.filter(Lt=>Lt!==f):[...E,f];O(n,{enabled:te.length>0,functions:te})}},Oe=()=>{O&&Object.keys(k).forEach(n=>{let f=k[n];f&&O(n,{...f,enabled:!1,functions:[]})})},ge=Te().filter(n=>n.id==="select"||n.id==="serialNumber"?!1:n.columnDef.meta?.aggregatable?!0:e.getRowModel().rows.slice(0,5).some(E=>{let te=E.getValue(n.id);return typeof te=="number"||typeof te=="string"&&!isNaN(parseFloat(String(te)))||typeof te=="object"&&te!==null&&"props"in te})),fe=Object.values(k).some(n=>n?.enabled);return g("div",{className:"rounded-xl",children:g("div",{className:"px-2",children:g("div",{className:"flex flex-col gap-6",children:P("div",{className:"flex items-center justify-between",children:[g("div",{className:"flex items-center gap-3",children:t.length>0&&P("div",{className:"flex flex-wrap items-center gap-3",children:[g("div",{className:"flex items-center gap-2 text-sm font-medium text-muted-foreground",children:g(ga,{className:"size-4"})}),t.map(n=>!e.getColumn(n.key)&&!n.customFilter&&!n.externalSearch?null:g("div",{className:o("relative min-w-[150px]",n.width),children:n.type==="select"?P(Et,{open:_[n.key],onOpenChange:x=>qe(n.key,x),children:[g(Gt,{asChild:!0,children:P("div",{className:"relative w-full",children:[n.icon&&g(n.icon,{className:"absolute -translate-y-1/2 size-4 left-3 top-1/2 text-muted-foreground pointer-events-none z-10"}),P(h,{variant:"outline",role:"combobox","aria-expanded":_[n.key],className:o("h-8 sm:h-8 rounded-lg w-full justify-between font-normal",!ye(n.key)&&"text-muted-foreground"),children:[g("span",{className:o("truncate",n.icon&&"pl-6"),children:ye(n.key)?n.options?.find(x=>x.value===ye(n.key))?.label:n.placeholder}),g(Mo,{className:"ml-2 opacity-50 size-4 shrink-0"})]})]})}),g(jt,{className:"w-[--radix-popover-trigger-width] p-0 rounded-lg",children:P(wo,{className:"rounded-lg",children:[g(No,{placeholder:`Search ${n.placeholder?.toLowerCase()}...`}),P(To,{children:[g(So,{children:"No option found."}),P(Po,{children:[P(no,{value:"all",onSelect:()=>{ue(n.key,""),qe(n.key,!1)},className:"flex items-center cursor-pointer",children:[g(fa,{className:o("mr-2 size-4 shrink-0",ye(n.key)?"opacity-0":"opacity-100")}),g("span",{children:"All"})]}),n.options?.map(x=>P(no,{value:x.label,onSelect:()=>{ue(n.key,x.value),qe(n.key,!1)},className:"flex items-center cursor-pointer",children:[g(fa,{className:o("mr-2 size-4 shrink-0",ye(n.key)===x.value?"opacity-100":"opacity-0")}),g("span",{children:x.label})]},x.label))]})]})]})})]}):n.type==="date"?g(ma,{value:ye(n.key),onChange:x=>{n.onlyExternal||ue(n.key,x)},placeholder:n.placeholder,mode:n.dateMode||"single",externalSearch:n.externalSearch,onlyExternal:n.onlyExternal,onExternalChange:x=>Q(n.key,x)}):P("div",{className:"relative",children:[n.icon&&g(n.icon,{className:"absolute -translate-y-1/2 size-4 left-3 top-1/2 text-muted-foreground"}),g(wt,{placeholder:n.placeholder,value:ye(n.key)??"",onChange:x=>{ue(n.key,x.target.value)},className:o("h-8 rounded-lg",n.icon&&"pl-9"),type:n.type==="number"?"number":"text"})]})},n.key)),(t.some(n=>n.externalSearch)||t.some(n=>n.customFilter))&&P(h,{variant:"default",size:"sm",onClick:se,className:"rounded-lg h-7",children:[g(ua,{className:"size-4"}),t.find(n=>n.externalSearch||n.customFilter)?.searchButtonText||"Search"]})]})}),P("div",{className:"flex items-center gap-2",children:[s&&P("div",{className:"relative",children:[g(ua,{className:"absolute -translate-y-1/2 size-4 left-3 top-1/2 text-muted-foreground"}),g(wt,{placeholder:"Global search...",value:a??"",onChange:n=>r(n.target.value),className:"pl-9 h-8 max-w-max"})]}),ge.length>0&&O&&P(ze,{children:[g(Ae,{asChild:!0,children:P(h,{variant:"outline",size:"sm",className:o("rounded-lg gap-1",fe&&"bg-primary/10 dark:bg-primary/10 border-primary/20 dark:border-primary/20"),children:[g(zo,{className:"size-4"}),g("span",{children:"Aggregations"}),g(Mo,{className:"opacity-50 size-4"})]})}),P(Ie,{align:"end",className:"w-64 rounded-lg max-h-[500px] overflow-y-auto",children:[P(ce,{className:"flex items-center justify-between px-4 py-2",children:[g("span",{className:"text-sm font-medium",children:"Column Aggregations"}),fe&&g(h,{variant:"ghost",size:"sm",onClick:Oe,className:"h-6 px-2 text-xs",children:"Clear All"})]}),g(ve,{}),ge.map(n=>{let f=k[n.id],x=f?.enabled;return P(ra,{children:[g(ia,{className:"text-sm",children:P("div",{className:"flex items-center w-full gap-2",children:[g(mt,{checked:x,onCheckedChange:()=>Le(n.id),className:"data-[state=checked]:bg-primary"}),g("span",{className:o("flex-1",x&&"font-medium text-primary"),children:Se(n.id)}),x&&P("div",{className:"flex items-center gap-1",children:[f?.functions?.slice(0,2).map(E=>g("div",{className:"w-2 h-2 rounded-full bg-primary",title:ba.find(te=>te.value===E)?.label},E)),f?.functions&&f.functions.length>2&&P("div",{className:"text-xs text-muted-foreground",children:["+",f.functions.length-2]})]})]})}),P(sa,{className:"w-48 rounded-lg",children:[g(ce,{className:"px-3 py-2 text-xs font-medium text-muted-foreground",children:"Select Functions"}),ba.map(E=>g(Ht,{checked:f?.functions?.includes(E.value)||!1,onCheckedChange:()=>Je(n.id,E.value),className:"py-2 text-sm",children:P("div",{className:"flex flex-col",children:[g("span",{children:E.label}),g("span",{className:"text-xs text-muted-foreground",children:E.description})]})},E.value))]})]},n.id)}),ge.length===0&&P("div",{className:"px-3 py-4 text-center",children:[g(zo,{className:"w-8 h-8 mx-auto mb-2 opacity-50 text-muted-foreground"}),g("p",{className:"text-sm text-muted-foreground",children:"No numeric columns available for aggregation"})]})]})]}),i&&P(h,{variant:"outline",size:"sm",onClick:()=>i(v),className:"rounded-lg",children:[g(_n,{className:"size-4"}),"Export"]}),m&&P(ze,{children:[g(Ae,{asChild:!0,className:"h-7",children:P(h,{variant:"outline",size:"sm",className:"gap-1 rounded-lg",children:[g("span",{children:"Columns"}),g(Mo,{className:"opacity-50 size-4"})]})}),P(Ie,{align:"end",className:"w-[220px] rounded-lg max-h-[400px] overflow-y-auto",children:[g(ce,{className:"px-4 py-2 text-sm font-medium",children:"Toggle Columns"}),g(ve,{}),Ue().length>0&&P(ko,{children:[g(ce,{className:"px-4 py-1.5 text-sm font-medium text-muted-foreground",children:"General"}),Ue().map(n=>g(Ht,{className:"text-sm",checked:n.getIsVisible(),onCheckedChange:f=>n.toggleVisibility(!!f),children:Se(n.id)},n.id))]}),ie().map(n=>P(ko,{children:[g(ve,{}),g(ce,{className:"px-4 py-1.5 text-sm font-medium text-muted-foreground",children:n.id}),n.columns?.filter(f=>f.getCanHide?.()!==!1).map(f=>g(Ht,{className:"text-sm",checked:f.getIsVisible(),onCheckedChange:x=>f.toggleVisibility(!!x),children:Se(f.id,n.id)},f.id))]},n.id))]})]}),P(ze,{children:[g(Ae,{asChild:!0,className:"h-7",children:g(h,{variant:"outline",size:"sm",className:"rounded-lg h-7",children:g(Vn,{className:"size-4"})})}),P(Ie,{align:"end",className:"w-[200px] rounded-lg",children:[g(ce,{children:"Table Settings"}),g(ve,{}),P(K,{onClick:p,children:[g(Hn,{className:"size-4"}),"Clear All Sorting"]}),P(K,{onClick:Pe,children:[g(ga,{className:"size-4"}),"Clear All Filters"]}),fe&&P(K,{onClick:Oe,children:[g(zo,{className:"size-4"}),"Clear Aggregations"]}),L&&P(jn,{children:[g(ve,{}),g(ce,{children:"Column Pinning"}),P(K,{onClick:()=>e.setColumnPinning({left:[],right:[]}),children:[g(En,{className:"size-4"}),"Reset All Pinning"]}),P(K,{onClick:()=>{let n=Te().filter(f=>f.getCanPin?.()!==!1).map(f=>f.id);e.setColumnPinning({left:[],right:n})},children:[g(Gn,{className:"-rotate-90 size-4"}),"Pin All Right"]})]})]})]}),u&&g(h,{variant:"outline",size:"sm",onClick:u,disabled:w,className:"rounded-lg",children:g(On,{className:o("h-4 w-4",w&&"animate-spin")})})]})]})})})})}import{Select as ke}from"radix-ui";import{CheckIcon as $n,ChevronDownIcon as va,ChevronUpIcon as Un}from"lucide-react";import{jsx as re,jsxs as Fo}from"react/jsx-runtime";function Tt({...e}){return re(ke.Root,{"data-slot":"select",...e})}function St({...e}){return re(ke.Value,{"data-slot":"select-value",...e})}function Pt({className:e,size:t="default",children:a,...r}){return Fo(ke.Trigger,{"data-slot":"select-trigger","data-size":t,className:o("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),...r,children:[a,re(ke.Icon,{asChild:!0,children:re(va,{className:"size-4 opacity-50"})})]})}function kt({className:e,children:t,position:a="popper",...r}){return re(ke.Portal,{children:Fo(ke.Content,{"data-slot":"select-content",className:o("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,...r,children:[re(Wn,{}),re(ke.Viewport,{className:o("p-1",a==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)] scroll-my-1"),children:t}),re(qn,{})]})})}function pt({className:e,children:t,...a}){return Fo(ke.Item,{"data-slot":"select-item",className:o("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:[re("span",{className:"absolute right-2 flex size-3.5 items-center justify-center",children:re(ke.ItemIndicator,{children:re($n,{className:"size-4"})})}),re(ke.ItemText,{children:t})]})}function Wn({className:e,...t}){return re(ke.ScrollUpButton,{"data-slot":"select-scroll-up-button",className:o("flex cursor-default items-center justify-center py-1",e),...t,children:re(Un,{className:"size-4"})})}function qn({className:e,...t}){return re(ke.ScrollDownButton,{"data-slot":"select-scroll-down-button",className:o("flex cursor-default items-center justify-center py-1",e),...t,children:re(va,{className:"size-4"})})}import{jsx as he,jsxs as Dt}from"react/jsx-runtime";function Bo({table:e,config:t}){return t.enabled?he("div",{className:"rounded-xl",children:he("div",{children:Dt("div",{className:"flex items-center justify-between",children:[he("div",{className:"flex items-center gap-6 text-sm text-muted-foreground",children:t.showInfo!==!1&&Dt("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"]})}),Dt("div",{className:"flex items-center gap-4",children:[t.pageSizeOptions&&Dt("div",{className:"flex items-center gap-2",children:[he("span",{className:"text-sm font-medium",children:"Rows per page:"}),Dt(Tt,{value:`${e.getState().pagination.pageSize}`,onValueChange:a=>e.setPageSize(Number(a)),children:[he(Pt,{className:"h-9 w-[70px] rounded-lg",children:he(St,{})}),he(kt,{side:"top",className:"rounded-lg",children:t.pageSizeOptions.map(a=>he(pt,{value:`${a}`,children:a},a))})]})]}),Dt("div",{className:"flex items-center gap-2",children:[he(h,{variant:"outline",size:"sm",onClick:()=>e.setPageIndex(0),disabled:!e.getCanPreviousPage(),className:"rounded-lg",children:"First"}),he(h,{variant:"outline",size:"sm",onClick:()=>e.previousPage(),disabled:!e.getCanPreviousPage(),className:"rounded-lg",children:"Previous"}),t.showPageNumbers&&he("div",{className:"flex items-center gap-1",children:Array.from({length:Math.min(5,e.getPageCount())},(a,r)=>{let s=e.getState().pagination.pageIndex,i=s+r;return i<1||i>e.getPageCount()?null:he(h,{variant:i===s+1?"default":"outline",size:"sm",className:"size-8 p-0 rounded-lg",onClick:()=>e.setPageIndex(i-1),children:i},i)})}),he(h,{variant:"outline",size:"sm",onClick:()=>e.nextPage(),disabled:!e.getCanNextPage(),className:"rounded-lg",children:"Next"}),he(h,{variant:"outline",size:"sm",onClick:()=>e.setPageIndex(e.getPageCount()-1),disabled:!e.getCanNextPage(),className:"rounded-lg",children:"Last"})]})]})]})})}):null}import{Toggle as Jn}from"radix-ui";import{cva as Xn}from"class-variance-authority";import{jsx as Yn}from"react/jsx-runtime";var Kn=Xn("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 ha({className:e,variant:t,size:a,noBg:r,...s}){return Yn(Jn.Root,{"data-slot":"toggle",className:o(Kn({className:e,variant:t,size:a,bg:r?"disabled":"enabled"})),...s})}import{useCallback as lo,useEffect as co,useMemo as mo,useRef as Wt,useState as we}from"react";import{Fragment as wa,jsx as c,jsxs as G}from"react/jsx-runtime";var Ca={sum:e=>e.reduce((t,a)=>t+a,0),average:e=>e.length>0?e.reduce((t,a)=>t+a,0)/e.length:0,min:e=>e.length>0?Math.min(...e):0,max:e=>e.length>0?Math.max(...e):0,count:e=>e.length,unique:e=>new Set(e).size,median:e=>{if(e.length===0)return 0;let t=[...e].sort((r,s)=>r-s),a=Math.floor(t.length/2);return t.length%2===0?(t[a-1]+t[a])/2:t[a]}};function Na({data:e,columns:t,filters:a=[],pagination:r={enabled:!1},settings:s={},header:i,footer:u,className:w="",maxHeight:m="100%",loading:v=!1,error:p,emptyMessage:T="No data available",onRowSelectionChange:L,onExport:F,onRefresh:A,onTableReady:k,children:O,isRowDisabled:H,isRowSelectable:S,onExternalSearch:J,aggregations:C={},onAggregationChange:_,rowClassName:De}){let[Te,ie]=we([]),[Ue,Se]=we([]),[Q,We]=we({}),[se,Pe]=we({}),[ye,ue]=we(""),[qe,Le]=we([]),[Je,Oe]=we(s.enableColumnPinning?{left:[],right:[]}:{}),[rt,ge]=we({}),fe=Wt(null),n=Wt(null),f=Wt(null),x=Wt(null),[E,te]=we(0),[Lt,Z]=we(0),[Yt,bo]=we(0),[ft,Zt]=we(0),bt=Wt(null),[Ot,Qt]=we(!1),{enableSorting:_t=!0,enableFiltering:vt=!0,enableGlobalFilter:ht=!0,enableColumnVisibility:Vt=!0,enableRowSelection:le=!0,stickyHeader:Xo=!0,toolbar:M=!1,disableHeaderCheckbox:V=!1,toolbarPosition:D="default",showSerialNumbers:j=!0,fixedCheckboxColumn:oe=!0,striped:_e=!0,hoverable:it=!0,compact:Re=!0,bordered:Ko=!0,fullHeight:an=!1,enableColumnResizing:Yo=!1,enableColumnPinning:de=!0,hideHeader:nn=!1,selectionMode:Xe="multiple",showCheckBox:rn=!0,checkboxColumnPosition:Zo=0}=s;co(()=>{let b=()=>{bt.current&&Qt(bt.current.scrollTop>0)},y=bt.current;if(y)return y.addEventListener("scroll",b),()=>y.removeEventListener("scroll",b)},[]),co(()=>{let b=()=>{fe.current&&te(fe.current.offsetHeight+16),n.current&&Z(n.current.offsetHeight+16),f.current&&bo(f.current.offsetHeight+16),x.current&&Zt(x.current.offsetHeight+16)};b();let y=new ResizeObserver(()=>{setTimeout(b,50)});return fe.current&&y.observe(fe.current),n.current&&y.observe(n.current),f.current&&y.observe(f.current),x.current&&y.observe(x.current),()=>{y.disconnect()}},[M,i,D]);let sn=(b,y)=>y.split(".").reduce((d,l)=>d&&d[l],b),vo=mo(()=>Object.keys(rt).length===0?e:e.filter(b=>Object.entries(rt).every(([y,d])=>{if(!d||d==="")return!0;let l=sn(b,y);return typeof d=="string"?String(l).toLowerCase().includes(d.toLowerCase()):l===d})),[e,rt]),ln=lo((b,y)=>{ge(d=>{let l={...d};return y===""||y===null||y===void 0?delete l[b]:l[b]=y,l})},[]),xt=mo(()=>{let b=[...t],y=N=>N.map(R=>{if(R.id==="select"||R.id==="serialNumber")return R;let B={...R,enablePinning:!0};return R.columns&&(B.columns=y(R.columns)),B}),d=y(b),l={id:"select",header:({table:N})=>{if(Xe==="single")return null;let R=N.getRowModel().rows.filter(X=>!H?.(X.original)&&(S?S(X.original):!0)),B=R.length>0&&R.every(X=>X.getIsSelected()),$=R.some(X=>X.getIsSelected());return c(mt,{checked:B||$&&"indeterminate",onCheckedChange:X=>{R.forEach(ae=>ae.toggleSelected(!!X))},disabled:V||R.length===0,"aria-label":"Select all selectable rows"})},cell:({row:N})=>{let R=H?H(N.original):!1,B=S?S(N.original):!0;return c("div",{className:o("flex items-center justify-center",R&&"opacity-50"),children:Xe==="multiple"?c(mt,{checked:N.getIsSelected(),onCheckedChange:$=>B&&N.toggleSelected(!!$),"aria-label":"Select row",disabled:R||!B}):rn?c("input",{type:"radio",checked:N.getIsSelected(),onChange:()=>B&&N.toggleSelected(!0),disabled:R||!B,className:"w-4 h-4 rounded-full border-primary text-primary focus:ring-primary"}):null})},enableSorting:!1,enableHiding:!1,enablePinning:!0,headerAlign:"center",size:Xe==="multiple"?40:30};if(le){let N=Zo;N<0&&(N=d.length+N+1),N=Math.max(0,Math.min(N,d.length)),d.splice(N,0,l)}if(j){let N={id:"serialNumber",header:"No.",cell:({row:R})=>c("div",{className:"font-medium text-center text-muted-foreground",children:R.index+1}),enableSorting:!0,enableHiding:!1,enablePinning:!0,size:60,headerAlign:"center"};d.unshift(N)}return d},[t,j,le,oe,H,S,Xe,Zo]),I=or({data:vo,columns:xt,onSortingChange:_t?ie:void 0,onColumnFiltersChange:vt?Se:void 0,onGlobalFilterChange:ht?ue:void 0,getCoreRowModel:Zn(),getPaginationRowModel:r.enabled?er():void 0,getSortedRowModel:_t?tr():void 0,getFilteredRowModel:vt?Qn():void 0,onColumnVisibilityChange:Vt?We:void 0,onRowSelectionChange:le?Pe:void 0,onColumnOrderChange:Le,onColumnPinningChange:de?Oe:void 0,state:{sorting:_t?Te:void 0,columnFilters:vt?Ue:void 0,columnVisibility:Vt?Q:void 0,rowSelection:le?se:{},globalFilter:ye,columnOrder:qe,columnPinning:de?Je:{}},initialState:{pagination:r.enabled?{pageSize:r.pageSize||10}:void 0,columnPinning:de?{left:[...j?["serialNumber"]:[],...le?["select"]:[]],right:[]}:void 0},enableRowSelection:le,enableColumnResizing:Yo,enableColumnPinning:de,columnResizeMode:"onChange"}),Qo=mo(()=>{if(!C||Object.keys(C).length===0)return{};let b={},y=I.getFilteredRowModel().rows;return Object.entries(C).forEach(([d,l])=>{if(!l?.enabled)return;let N=y.map(B=>{if(l.accessor)return l.accessor(B.original);{let $=B.getValue(d);return typeof $=="number"?$:parseFloat(String($))||0}}).filter(B=>B!==null&&!isNaN(B)),R={};l.functions?.forEach(B=>{Ca[B]&&(R[B]=Ca[B](N))}),Object.keys(R).length>0&&(b[d]=R)}),b},[vo,C,I?.getFilteredRowModel().rows]);co(()=>{if(le&&L){let b=I.getFilteredSelectedRowModel().rows.filter(y=>!H?.(y.original)&&(S?S(y.original):!0)).map(y=>y.original);L(b)}},[se,le,L,I,H,S]);let dn=lo(b=>{Xe==="single"?(I.resetRowSelection(),b.toggleSelected(!0)):b.toggleSelected()},[Xe,I]);co(()=>{k&&k(I)},[I,k]);let cn=lo(()=>{ie([])},[]),mn=lo(()=>{Se([]),ue("")},[]),ea=(b,y)=>{if(!de)return;let d=[...j?["serialNumber"]:[],...le&&oe?["select"]:[]],l={left:[...(Je.left??[]).filter(N=>d.includes(N))],right:[...Je.right??[]]};y===!1?(l.left=l.left.filter(N=>N!==b),l.right=l.right.filter(N=>N!==b)):y==="right"?(l.left=l.left.filter(N=>N!==b),l.right.includes(b)||l.right.push(b)):y==="left"&&(l.right=l.right.filter(N=>N!==b),!l.left.includes(b)&&!d.includes(b)&&l.left.push(b)),I.setColumnPinning(l)},pn=()=>{let b=Object.keys(Qo).length>0,y=I.getHeaderGroups()[0]?.headers.some(l=>l.column.columnDef.customFooter),d=j&&I.getFilteredRowModel().rows.length>0&&(b||y);return!b&&!y&&!d?null:c(Co,{className:"sticky bottom-0 border-t bg-sidebar z-20",children:c(Ve,{className:"hover:bg-transparent bg-sidebar",children:I.getHeaderGroups()[0]?.headers.map((l,N)=>{let R=l.column.id,B=Qo[R],$=de&&(l.column.getIsPinned()==="left"||l.column.id==="serialNumber"||l.column.id==="select"&&le),X=de&&l.column.getIsPinned()==="right",ae=l.column.id==="serialNumber",Ke=l.column.id==="select",ne=l.column.columnDef.customFooter;return B||ne||ae&&d?c(He,{className:o("font-semibold text-sm py-2 px-2 border-r",Re&&"py-1",$&&"sticky left-0 z-30 bg-sidebar/95",X&&"sticky right-0 z-30 bg-sidebar/95",(ae||Ke)&&"sticky left-0 z-30 bg-sidebar/95",ne?.className),style:{width:l.getSize()!==150?l.getSize():"auto",minWidth:l.getSize()!==150?l.getSize():"auto",...$&&{left:ae?0:Ke?j&&I.getColumn("serialNumber")?.getSize()||0:eo(l.column)},...X&&{right:to(l.column)},...ae&&{left:0}},children:(()=>{if(ne?.content){let st=typeof ne.content=="function"?ne.content(I):ne.content;return c("div",{className:o("w-full h-full",ne.align==="center"&&"text-center",ne.align==="right"&&"text-right",ne.align==="left"&&"text-left"),children:st})}return B?c("div",{className:"flex flex-col gap-0.5 text-xs",children:Object.entries(B).map(([st,vn])=>G("div",{className:"flex items-center justify-between text-muted-foreground",children:[G("span",{className:"text-xs capitalize",children:[st,":"]}),c("span",{className:"font-medium text-foreground",children:un(st,vn)})]},st))}):ae&&d?G("div",{className:"text-xs text-center text-muted-foreground",children:["Total: ",I.getFilteredRowModel().rows.length]}):null})()},`agg-${l.id}`):c(He,{className:o("py-0 px-0 border-r",Re&&"py-0",$&&"sticky left-0 z-30 bg-sidebar/95",X&&"sticky right-0 z-30 bg-sidebar/95",(ae||Ke)&&"sticky left-0 z-30 bg-sidebar/95"),style:{width:l.getSize()!==150?l.getSize():"auto",minWidth:l.getSize()!==150?l.getSize():"auto",...$&&{left:ae?0:Ke?j&&I.getColumn("serialNumber")?.getSize()||0:eo(l.column)},...X&&{right:to(l.column)},...ae&&{left:0}}},`agg-${l.id}`)})})})},un=(b,y)=>typeof y=="number"?b==="count"||b==="unique"?y.toLocaleString():y.toLocaleString(void 0,{minimumFractionDigits:2,maximumFractionDigits:2}):y,gn=()=>I.getHeaderGroups().map((b,y)=>c(Ve,{className:"hover:bg-transparent",children:b.headers.map((d,l)=>{let N=d.depth===0&&d.colSpan>1,R=de&&(d.column.getIsPinned()==="left"||d.column.id==="serialNumber"||d.column.id==="select"&&le),B=de&&d.column.getIsPinned()==="right",$=d.column.getCanSort(),X=de&&d.column.columnDef.enablePinning!==!1,ae=d.column.id==="serialNumber",Ke=d.column.id==="select",xo=ae||Ke&&oe,ne=d.column.columnDef.headerAlign||"left",oo=C&&C[d.column.id]?.enabled,st={left:"justify-start",center:"justify-center",right:"justify-end"}[ne];return G(aa,{colSpan:d.colSpan,className:o("font-semibold text-foreground bg-sidebar group px-0",!Re&&"py-2",Ko&&l<b.headers.length-1&&"border-r","relative",R&&"sticky left-0 z-25 bg-sidebar",B&&"sticky right-0 z-25 bg-sidebar",(ae||Ke)&&"sticky left-0 z-25 bg-sidebar",N?"text-center":"text-left",oo&&"border-b-2 border-primary/30"),style:{width:d.getSize()!==150?d.getSize():"auto",minWidth:d.getSize()!==150?d.getSize():"auto",...R&&{left:ae?0:Ke?j&&I.getColumn("serialNumber")?.getSize()||0:eo(d.column)},...B&&{right:to(d.column)},...ae&&{left:0}},children:[N?G("div",{className:"flex items-center justify-center",children:[Lo(d.column.columnDef.header,d.getContext()),oo&&c(ya,{className:"w-3 h-3 ml-1 text-primary"})]}):G("div",{className:o("relative flex items-center w-full px-2",st),children:[G("div",{className:"flex items-center gap-1",children:[oo&&c(ya,{className:"w-3 h-3 mr-1 text-primary"}),$&&ne==="right"&&c("span",{className:"order-2 ml-1",children:d.column.getIsSorted()&&{asc:c(Oo,{className:"w-4 h-4"}),desc:c(_o,{className:"w-4 h-4"})}[d.column.getIsSorted()]}),d.isPlaceholder?null:Lo(d.column.columnDef.header,d.getContext()),$&&ne!=="right"&&d.column.getIsSorted()&&c("span",{className:"order-2 ml-1",children:d.column.getIsSorted()&&{asc:c(Oo,{className:"w-4 h-4"}),desc:c(_o,{className:"w-4 h-4"})}[d.column.getIsSorted()]})]}),($||X&&!xo)&&G(ze,{children:[c(Ae,{asChild:!0,className:o("absolute",ne==="left"&&"right-1",ne==="center"&&"right-1",ne==="right"&&"left-1"),children:c(ha,{variant:"default",size:"sm",noBg:!0,tabIndex:-1,className:"opacity-0 group-hover:opacity-70 hover:opacity-100 data-[state=open]:opacity-100",children:c(nr,{className:"w-4 h-4"})})}),G(Ie,{align:"end",className:"w-48",children:[$&&G(wa,{children:[c(ce,{children:"Sorting"}),G(K,{onClick:()=>d.column.toggleSorting(!1),children:[c(Oo,{className:"w-4 h-4 mr-2"}),"Sort Ascending"]}),G(K,{onClick:()=>d.column.toggleSorting(!0),children:[c(_o,{className:"w-4 h-4 mr-2"}),"Sort Descending"]}),G(K,{onClick:()=>d.column.clearSorting(),disabled:!d.column.getIsSorted(),children:[c(ar,{className:"w-4 h-4 mr-2"}),"Clear Sort"]}),c(ve,{})]}),X&&!xo&&G(wa,{children:[c(ce,{children:"Pin Column"}),G(K,{onClick:()=>ea(d.column.id,"right"),disabled:d.column.getIsPinned()==="right",children:[c(rr,{}),"Pin Right"]}),G(K,{onClick:()=>ea(d.column.id,!1),disabled:!d.column.getIsPinned(),children:[c(ir,{}),"Unpin"]})]})]})]})]}),Yo&&d.column.getCanResize()&&!N&&d.colSpan===1&&c("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:d.getResizeHandler()})]},d.id)})},b.id)),eo=b=>{if(!de)return;let y=0,d=I.getLeftHeaderGroups()[0]?.headers||[],l=[...j?["serialNumber"]:[],...le?["select"]:[]];for(let N of d){if(N.id===b.id)break;if(l.includes(N.id)){let R=I.getColumn(N.id);R&&(y+=R.getSize())}}return y},to=b=>{if(!de)return;let y=I.getState().columnPinning.right||[],d=y.indexOf(b.id);if(d===-1)return;let l=0;for(let N=d+1;N<y.length;N++){let R=I.getColumn(y[N]);R&&(l+=R.getSize())}return l};if(p)return c(Ee,{className:"w-full shadow-sm rounded-xl",children:c(Ge,{className:"flex items-center justify-center",children:G("div",{className:"text-center",children:[c("div",{className:"mb-3 text-2xl text-red-500",children:"\u26A0\uFE0F"}),c("p",{className:"mb-4 text-sm text-muted-foreground",children:p}),A&&G(h,{variant:"outline",size:"sm",onClick:A,className:"rounded-lg",children:[c(xa,{className:"w-4 h-4 mr-2"}),"Try Again"]})]})})});let fn=b=>b&&typeof b=="object"&&"content"in b,Me=mo(()=>i?fn(i)?{content:i.content,align:i.align||"left",className:i.className||"",sticky:i.sticky!==void 0?i.sticky:!0,showOnEmpty:i.showOnEmpty!==void 0?i.showOnEmpty:!0}:{content:i,align:"left",className:"",sticky:!0,showOnEmpty:!0}:null,[i]),ho=()=>M?c(Io,{table:I,filters:a,globalFilter:ye,onGlobalFilterChange:ue,enableGlobalFilter:ht,onExport:F,onRefresh:A,loading:v,enableColumnVisibility:Vt,enableColumnPinning:de,data:vo,onClearSorting:cn,onClearFilters:mn,onExternalSearch:J,onCustomFilterChange:ln,aggregations:C,onAggregationChange:_}):null,bn=()=>{let b=0;return D==="above-header"&&(b+=Lt),Me&&(b+=ft),D==="below-header"&&(b+=Yt),b};return c(lt,{children:G("div",{className:o("w-full space-y-2 flex flex-col h-full",w),children:[M&&D==="default"&&c("div",{ref:fe,className:"relative z-40",children:ho()}),c(Ee,{className:o("shadow-sm overflow-hidden py-0",an&&"flex-1"),children:c(Ge,{className:"h-full p-0",children:G("div",{className:"relative flex flex-col justify-between h-full",children:[v&&c("div",{className:"absolute inset-0 z-50 flex items-center justify-center bg-background/80 backdrop-blur-sm rounded-xl",children:G("div",{className:"flex items-center gap-3 px-4 py-3 rounded-lg shadow-sm bg-background/90",children:[c(xa,{className:"size-5 animate-spin text-primary"}),c("span",{className:"text-sm font-medium text-muted-foreground",children:"Loading..."})]})}),c("div",{ref:bt,className:o("relative overflow-auto border-b rounded-t-xl",I.getRowModel().rows?.length===0&&"h-full"),style:{maxHeight:m},children:G(yo,{className:o("w-full border-collapse relative",I.getRowModel().rows?.length===0&&"h-full"),children:[M&&D==="above-header"&&c("thead",{className:"sticky top-0 z-40 bg-sidebar border-b",children:c(Ve,{className:"hover:bg-transparent",children:c(He,{colSpan:xt.length,className:"p-2 bg-sidebar border-b shadow-sm",children:c("div",{ref:n,children:ho()})})})}),Me&&(Me.showOnEmpty||I.getRowModel().rows?.length>0)&&c("thead",{className:o("sticky bg-sidebar border-b",Ot&&"shadow-sm"),style:{top:D==="above-header"?`${Lt}px`:"0px",zIndex:35},children:c(Ve,{className:"hover:bg-transparent",children:c(He,{colSpan:xt.length,className:o("p-2 font-semibold text-foreground bg-sidebar",Re?"py-2":"py-4",Me.className),children:c("div",{ref:x,className:o("flex items-center w-full",Me.align==="center"&&"justify-center",Me.align==="right"&&"justify-end",Me.align==="left"&&"justify-start"),children:typeof Me.content=="string"?c("span",{className:"text-lg font-bold tracking-tight text-foreground",children:Me.content}):Me.content})})})}),M&&D==="below-header"&&c("thead",{className:o("sticky bg-sidebar border-b",Ot&&"shadow-sm"),style:{top:Me?`${ft}px`:"0px",zIndex:35},children:c(Ve,{className:"hover:bg-transparent",children:c(He,{colSpan:xt.length,className:"p-2 bg-sidebar",children:c("div",{ref:f,children:ho()})})})}),!nn&&c(ta,{className:o("sticky bg-sidebar",Ot&&"shadow-sm"),style:{top:`${bn()}px`,zIndex:30},children:gn()}),c(oa,{children:I.getRowModel().rows?.length?I.getRowModel().rows.map((b,y)=>{let d=De?De(b):"";return c(Ve,{"data-state":b.getIsSelected()&&"selected",className:o(it&&"hover:bg-muted/50",_e&&y%2===0&&"bg-muted/20",b.getIsSelected()&&"bg-muted","border-b last:border-b-0",Xe==="single"&&"cursor-pointer",d),onClick:()=>{Xe==="single"&&dn(b)},children:b.getVisibleCells().map((l,N)=>{let R=de&&(l.column.getIsPinned()==="left"||l.column.id==="serialNumber"||l.column.id==="select"&&le),B=de&&l.column.getIsPinned()==="right",$=l.column.id==="serialNumber",X=l.column.id==="select",ae=$||X&&oe;return c(He,{className:o(Re?"py-2":"py-4",Ko&&N<b.getVisibleCells().length&&"border-r",R&&"sticky left-0 z-20 bg-sidebar/95",B&&"sticky right-0 z-20 bg-sidebar/95",$&&"sticky left-0 z-20 bg-sidebar/95","p-1"),style:{width:l.column.getSize()!==150?l.column.getSize():"auto",minWidth:l.column.getSize()!==150?l.column.getSize():"auto",...R&&{left:$?0:X?j&&I.getColumn("serialNumber")?.getSize()||0:eo(l.column)},...B&&{right:to(l.column)},...$&&{left:0}},children:Lo(l.column.columnDef.cell,l.getContext())},l.id)})},b.id)}):c(Ve,{children:c(He,{colSpan:xt.length,className:"h-32 text-center border-0",children:G("div",{className:"flex flex-col items-center gap-3",children:[c("div",{className:"text-6xl text-muted-foreground",children:"\u{1F4CB}"}),c("p",{className:"font-medium text-muted-foreground",children:T})]})})})}),pn()]})}),u&&c("div",{className:"sticky bottom-0 z-10 w-full bg-sidebar",style:{width:"100%",minWidth:"fit-content"},children:c(yo,{children:c(Co,{children:c(Ve,{className:"bg-sidebar",children:c(He,{colSpan:xt.length,className:"p-2",children:u})})})})})]})})}),c(Bo,{table:I,config:r}),O&&O(I)]})})}import{Separator as sr}from"radix-ui";import{jsx as lr}from"react/jsx-runtime";function qt({className:e,orientation:t="horizontal",decorative:a=!0,...r}){return lr(sr.Root,{"data-slot":"separator-root",decorative:a,orientation:t,className:o("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),...r})}import{Loader as dr,X as cr}from"lucide-react";import{AnimatePresence as mr,motion as pr}from"framer-motion";import*as ot from"react";import*as Ta from"react-dom";import{jsx as me,jsxs as Jt}from"react/jsx-runtime";function Sa({table:e,visible:t,container:a,children:r,className:s,...i}){let[u,w]=ot.useState(!1);ot.useLayoutEffect(()=>{w(!0)},[]),ot.useEffect(()=>{function p(T){T.key==="Escape"&&e&&e.toggleAllRowsSelected(!1)}return window.addEventListener("keydown",p),()=>window.removeEventListener("keydown",p)},[e]);let m=a??(u?globalThis.document?.body:null);if(!m||!e)return null;let v=t??e.getFilteredSelectedRowModel().rows.length>0;return Ta.createPortal(me(mr,{children:v&&me(pr.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:o("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",s),...i,children:me(lt,{children:r})})}),m)}function Pa({size:e="sm",tooltip:t,isPending:a,disabled:r,className:s,children:i,...u}){let w=me(h,{variant:"secondary",size:e,className:o("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",s),disabled:r||a,...u,children:a?me(dr,{className:"animate-spin"}):i});return t?Jt(Ze,{children:[me(Qe,{asChild:!0,children:w}),me(et,{sideOffset:8,className:"rounded-lg border font-semibold text-foreground bg-secondary [&>span]:hidden",children:me("p",{children:t})})]}):w}function ka({table:e}){let t=ot.useCallback(()=>{e&&e.toggleAllRowsSelected(!1)},[e]);return e?Jt("div",{className:"flex h-8 items-center rounded-lg border bg-muted/50 pr-1 pl-3",children:[Jt("span",{className:"whitespace-nowrap text-sm font-medium",children:[e.getFilteredSelectedRowModel().rows.length," selected"]}),me(qt,{orientation:"vertical",className:"mr-2 ml-3 data-[orientation=vertical]:h-4"}),Jt(Ze,{children:[me(Qe,{asChild:!0,children:me(h,{variant:"ghost",size:"icon",className:"size-6 rounded-md",onClick:t,children:me(cr,{className:"size-3.5"})})}),Jt(et,{sideOffset:10,className:"flex items-center gap-2 rounded-lg border px-3 py-2 font-semibold text-foregroun bg-secondary [&>span]:hidden",children:[me("p",{children:"Clear selection"}),me("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:me("abbr",{title:"Escape",className:"no-underline",children:"Esc"})})]})]})]}):null}import{ArrowUpDown as _l,EyeOff as Vl}from"lucide-react";import{jsx as $l,jsxs as Ul}from"react/jsx-runtime";import{ChevronDown as Jl,Eye as Xl}from"lucide-react";import{jsx as Ql,jsxs as ed}from"react/jsx-runtime";import{Slot as ad}from"radix-ui";import{cva as ur}from"class-variance-authority";import{jsx as ld}from"react/jsx-runtime";var id=ur("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"}});import{CheckIcon as xd,PlusCircleIcon as yd}from"lucide-react";import{Fragment as Td,jsx as wd,jsxs as Nd}from"react/jsx-runtime";import{useState as at,useEffect as Ra,useMemo as Ho,useCallback as Rt,useRef as Sr}from"react";import{Loader2 as Ma}from"lucide-react";import{Search as gr,Download as fr,RefreshCw as br,Filter as vr,ChevronDown as hr,Settings2 as xr}from"lucide-react";import{Fragment as yr,jsx as z,jsxs as ee}from"react/jsx-runtime";function Vo({fields:e,filters:t,globalFilter:a,onGlobalFilterChange:r,fieldFilters:s,onFieldFilterChange:i,sortField:u,sortDirection:w,onSortChange:m,selectedCount:v,totalCount:p,visibleCount:T,onExport:L,onRefresh:F,loading:A,onClearFilters:k,onClearSorting:O}){let H=e.filter(C=>C.sortable),S=Object.values(s).some(C=>C!=null&&C!=="")||a!=="",J=u!=="";return z("div",{className:"rounded-xl p-0.5",children:z("div",{className:"px-2",children:z("div",{className:"flex flex-col gap-6",children:ee("div",{className:"flex items-center justify-between",children:[z("div",{className:"flex items-center gap-3",children:t.length>0&&ee("div",{className:"flex items-center gap-3 flex-wrap",children:[z("div",{className:"flex items-center gap-2 text-sm font-medium text-muted-foreground",children:z(vr,{className:"h-4 w-4"})}),t.map(C=>z("div",{className:"relative min-w-[150px]",children:C.type==="select"?ee(Tt,{value:s[C.key]||"all",onValueChange:_=>i(C.key,_),children:[C.icon&&z(C.icon,{className:"size-4 absolute left-3 top-1/2 -translate-y-1/2 text-muted-foreground"}),z(Pt,{className:o("h-9 rounded-lg w-full",C.icon&&"pl-9"),children:z(St,{placeholder:C.placeholder||"Select..."})}),ee(kt,{className:"rounded-lg",children:[z(pt,{value:"all",children:"All"}),C.options?.map(_=>z(pt,{value:_.value,children:_.label},_.value))]})]}):ee("div",{className:"relative",children:[C.icon&&z(C.icon,{className:"size-4 absolute left-3 top-1/2 -translate-y-1/2 text-muted-foreground"}),z(wt,{type:C.type,placeholder:C.placeholder,value:s[C.key]||"",onChange:_=>i(C.key,_.target.value),className:o("h-9 rounded-lg",C.icon&&"pl-9")})]})},String(C.key)))]})}),ee("div",{className:"flex items-center gap-2",children:[ee("div",{className:"relative",children:[z(gr,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"}),z(wt,{placeholder:"Global search...",value:a,onChange:C=>r(C.target.value),className:"pl-9 h-9 rounded-lg max-w-max"})]}),H.length>0&&ee(ze,{children:[z(Ae,{asChild:!0,children:ee(h,{variant:"outline",size:"sm",className:"rounded-lg gap-1",children:[z("span",{children:"Sort"}),z(hr,{className:"h-4 w-4 opacity-50"})]})}),ee(Ie,{align:"end",className:"w-[200px] rounded-lg",children:[z(ce,{children:"Sort By"}),z(ve,{}),H.map(C=>ee("div",{children:[ee(K,{onClick:()=>m(C.key,"asc"),children:[C.label," (A-Z)"]}),ee(K,{onClick:()=>m(C.key,"desc"),children:[C.label," (Z-A)"]})]},String(C.key))),J&&ee(yr,{children:[z(ve,{}),z(K,{onClick:O,children:"Clear All Sorting"})]})]})]}),ee(ze,{children:[z(Ae,{asChild:!0,children:z(h,{variant:"outline",size:"sm",className:"rounded-lg",children:z(xr,{className:"h-4 w-4"})})}),ee(Ie,{align:"end",className:"w-[200px] rounded-lg",children:[z(ce,{children:"Table Settings"}),z(ve,{}),z(K,{onClick:O,children:"Clear All Sorting"}),z(K,{onClick:k,children:"Clear All Filters"})]})]}),L&&ee(h,{variant:"outline",size:"sm",onClick:L,className:"rounded-lg",children:[z(fr,{className:"mr-2 h-4 w-4"}),"Export"]}),F&&z(h,{variant:"outline",size:"sm",onClick:F,disabled:A,className:"rounded-lg",children:z(br,{className:o("h-4 w-4",A&&"animate-spin")})})]})]})})})})}import{ChevronLeft as Cr,ChevronRight as wr,ChevronsLeft as Nr,ChevronsRight as Tr}from"lucide-react";import{jsx as W,jsxs as Fe}from"react/jsx-runtime";function Da({currentPage:e,totalPages:t,pageSize:a,totalItems:r,onPageChange:s,onPageSizeChange:i,config:u}){if(!u.enabled)return null;let w=u.pageSizeOptions||[10,20,50,100],m=(e-1)*a+1,v=Math.min(e*a,r),p=e>1,T=e<t,L=()=>{let A=[],k=[];for(let O=Math.max(2,e-2);O<=Math.min(t-1,e+2);O++)A.push(O);return e-2>2?k.push(1,"..."):k.push(1),k.push(...A),e+2<t-1?k.push("...",t):t>1&&k.push(t),k};return W("div",{className:"rounded-xl",children:Fe("div",{className:"flex flex-col sm:flex-row items-center justify-between gap-4",children:[W("div",{className:"flex items-center gap-6 text-sm text-muted-foreground",children:u.showInfo!==!1&&Fe("span",{children:["Showing ",m," to ",v," of ",r," entries"]})}),Fe("div",{className:"flex flex-col sm:flex-row items-center gap-4",children:[w&&Fe("div",{className:"flex items-center gap-2",children:[W("span",{className:"text-sm font-medium whitespace-nowrap",children:"Page size:"}),Fe(Tt,{value:`${a}`,onValueChange:F=>i(Number(F)),children:[W(Pt,{className:"h-9 w-[70px] rounded-lg",children:W(St,{})}),W(kt,{side:"top",className:"rounded-lg",children:w.map(F=>W(pt,{value:`${F}`,children:F},F))})]})]}),Fe("div",{className:"flex items-center gap-2",children:[Fe(h,{variant:"outline",size:"sm",onClick:()=>s(1),disabled:!p,className:"hidden sm:flex rounded-lg",children:[W(Nr,{className:"h-4 w-4"}),W("span",{className:"sr-only",children:"Go to first page"})]}),Fe(h,{variant:"outline",size:"sm",onClick:()=>s(e-1),disabled:!p,className:"rounded-lg",children:[W(Cr,{className:"h-4 w-4 sm:mr-2"}),W("span",{className:"hidden sm:inline",children:"Previous"}),W("span",{className:"sr-only sm:hidden",children:"Go to previous page"})]}),u.showPageNumbers&&t>1&&W("div",{className:"hidden sm:flex items-center gap-1",children:L().map((F,A)=>{if(F==="...")return W("span",{className:"px-2 py-1 text-sm text-muted-foreground",children:"..."},`dots-${A}`);let k=F;return W(h,{variant:k===e?"default":"outline",size:"sm",className:"w-9 h-9 p-0 rounded-lg",onClick:()=>s(k),children:k},k)})}),Fe("div",{className:"sm:hidden flex items-center gap-2 px-3 py-1 text-sm font-medium bg-muted rounded-lg",children:[e," of ",t]}),Fe(h,{variant:"outline",size:"sm",onClick:()=>s(e+1),disabled:!T,className:"rounded-lg",children:[W("span",{className:"hidden sm:inline",children:"Next"}),W(wr,{className:"h-4 w-4 sm:ml-2"}),W("span",{className:"sr-only sm:hidden",children:"Go to next page"})]}),Fe(h,{variant:"outline",size:"sm",onClick:()=>s(t),disabled:!T,className:"hidden sm:flex rounded-lg",children:[W(Tr,{className:"h-4 w-4"}),W("span",{className:"sr-only",children:"Go to last page"})]})]})]})]})})}import{jsx as U,jsxs as ut}from"react/jsx-runtime";function za({data:e,template:t,fields:a=[],filters:r=[],pagination:s={enabled:!1},settings:i={},header:u,footer:w,className:m="",loading:v=!1,error:p,emptyMessage:T="No items found",emptyIcon:L,onSelectionChange:F,onExport:A,onRefresh:k,onTemplateReady:O,children:H}){let{enableSorting:S=!0,enableFiltering:J=!0,enableGlobalSearch:C=!0,enableSelection:_=!1,enableExport:De=!1,toolbar:Te=!0,selectionMode:ie="multiple",gridCols:Ue={default:3,sm:1,md:2,lg:3,xl:4,"2xl":6},gap:Se=4,aspectRatio:Q="auto",minCardWidth:We=350,maxCardWidth:se=350}=i,[Pe,ye]=at(""),[ue,qe]=at({}),[Le,Je]=at(""),[Oe,rt]=at("asc"),[ge,fe]=at(new Set),[n,f]=at(1),[x,E]=at(s.pageSize||12),[te,Lt]=at(Ue.default),Z=Ho(()=>{let M=[...e];if(C&&Pe){let V=a.filter(D=>D.searchable!==!1);M=M.filter(D=>V.some(j=>D[j.key]?.toString().toLowerCase().includes(Pe.toLowerCase())))}if(J&&Object.keys(ue).forEach(V=>{let D=ue[V];if(D!=null&&D!==""){let j=a.find(oe=>oe.key===V);j&&(M=M.filter(oe=>{let _e=oe[V];return j.type==="boolean"?_e===(D==="true"):j.type==="number"?_e===Number(D):_e?.toString().toLowerCase().includes(String(D).toLowerCase())}))}}),S&&Le){let V=a.find(D=>D.key===Le);V&&M.sort((D,j)=>{let oe=D[Le],_e=j[Le];if(V.type==="number")return Oe==="asc"?Number(oe)-Number(_e):Number(_e)-Number(oe);if(V.type==="date"){let it=new Date(oe),Re=new Date(_e);return Oe==="asc"?it.getTime()-Re.getTime():Re.getTime()-it.getTime()}else{let it=String(oe).toLowerCase(),Re=String(_e).toLowerCase();return Oe==="asc"?it.localeCompare(Re):Re.localeCompare(it)}})}return M},[e,Pe,ue,Le,Oe,a,C,J,S]),Yt=Ho(()=>{if(!s.enabled)return Z;let M=(n-1)*x,V=M+x;return Z.slice(M,V)},[Z,n,x,s.enabled]),bo=Math.ceil(Z.length/x),ft=Rt(M=>{_&&fe(V=>{let D=new Set(V);return ie==="single"?(D.clear(),D.add(M)):D.has(M)?D.delete(M):D.add(M),D})},[_,ie]),Zt=Rt(()=>{!_||ie==="single"||(ge.size===Z.length?fe(new Set):fe(new Set(Z.map((M,V)=>V))))},[_,ie,ge.size,Z.length]),bt=Rt((M,V)=>{qe(D=>({...D,[M]:V})),f(1)},[]),Ot=Rt((M,V)=>{Je(M),rt(V)},[]),Qt=Rt(()=>{ye(""),qe({}),f(1)},[]),_t=Rt(()=>{Je(""),rt("asc")},[]),vt=Ho(()=>({getSelectedItems:()=>Array.from(ge).map(M=>Z[M]),clearSelection:()=>fe(new Set),selectAll:Zt,getFilteredData:()=>Z,getTotalCount:()=>e.length,getVisibleCount:()=>Z.length,refresh:()=>k?.(),exportData:()=>A?.(Z)}),[ge,Z,e.length,Zt,k,A]),ht=Sr(null);ht.current=vt,Ra(()=>{O&&ht.current&&O(ht.current)},[]),Ra(()=>{if(_&&F){let M=Array.from(ge).map(V=>Z[V]);F(M)}},[ge]);let Vt=o("w-full","overflow-hidden",m),le=o("grid",`gap-${Se}`,"w-full","mx-auto","items-start"),Xo={gridTemplateColumns:te===0?"repeat(auto-fill, 1fr)":`repeat(auto-fill, minmax(clamp(${We}px, calc(100%/${te} - ${Se*4}px), ${se}px), 1fr))`,justifyItems:"center",alignItems:"stretch",gridAutoRows:"1fr",gridAutoFlow:"dense"};return p?U(Ee,{className:"w-full",children:U(Ge,{className:"flex items-center justify-center py-12",children:ut("div",{className:"text-center",children:[U("div",{className:"text-red-500 mb-3 text-2xl",children:"\u26A0\uFE0F"}),U("p",{className:"text-sm text-muted-foreground mb-4",children:p}),k&&ut(h,{variant:"outline",size:"sm",onClick:k,children:[U(Ma,{className:"mr-2 h-4 w-4"}),"Try Again"]})]})})}):ut("div",{className:o("w-full flex gap-2 flex-col h-full",Vt),children:[u&&U(Ee,{className:"shadow-sm border-0 py-0 text-xl font-bold",children:U(Ge,{className:"p-2",children:u})}),Te&&U(Vo,{fields:a,filters:r,globalFilter:Pe,onGlobalFilterChange:ye,fieldFilters:ue,onFieldFilterChange:bt,sortField:Le,sortDirection:Oe,onSortChange:Ot,selectedCount:ge.size,totalCount:e.length,visibleCount:Z.length,onExport:De?()=>A?.(Z):void 0,onRefresh:k,loading:v,onClearFilters:Qt,onClearSorting:_t}),U(Ee,{className:"border-0 overflow-auto shadow-none py-0 p-2 flex-1",children:U(Ge,{className:"px-0",children:ut("div",{className:"relative",children:[v&&U("div",{className:"absolute inset-0 bg-background/80 backdrop-blur-sm z-50 flex items-center justify-center rounded-lg",children:ut("div",{className:"flex items-center gap-3 bg-background/90 px-4 py-3 rounded-lg shadow-sm",children:[U(Ma,{className:"size-5 animate-spin text-primary"}),U("span",{className:"text-sm font-medium text-muted-foreground",children:"Loading..."})]})}),Yt.length>0?U("div",{className:o(le),style:Xo,children:Yt.map((M,V)=>{let D=s.enabled?(n-1)*x+V:V,j=ge.has(D);return ut("div",{className:o("relative h-full w-full flex flex-col","transition-all duration-200 overflow-hidden","rounded-2xl","border border-border/20 hover:border-border/50",Q==="square"?"aspect-square":"",Q==="video"?"aspect-video":"",_?"cursor-pointer":"",j?"ring-2 ring-primary":""),onClick:()=>_&&ft(D),children:[_&&ie==="multiple"&&U("div",{className:"absolute top-2 right-2 z-10",children:U(mt,{checked:j,onCheckedChange:()=>ft(D),className:"bg-background/80 backdrop-blur-sm",onClick:oe=>oe.stopPropagation()})}),t(M,V,j,()=>ft(D))]},D)})}):ut("div",{className:"flex flex-col gap-4 items-center justify-center py-12 text-center",children:[U("div",{className:"text-6xl",children:L||"\u{1F4CB}"}),U("p",{className:"text-lg font-medium text-muted-foreground mb-2",children:T}),(Pe||Object.values(ue).some(M=>M))&&U(h,{variant:"outline",onClick:Qt,children:"Clear Filters"})]})]})})}),s.enabled&&U("div",{className:"pb-1",children:U(Da,{currentPage:n,totalPages:bo,pageSize:x,totalItems:Z.length,onPageChange:f,onPageSizeChange:M=>{E(M),f(1)},config:s})}),w&&U("div",{className:"p-2 m-0.5",children:w}),H&&H(vt)]})}import{Loader as Pr,X as kr}from"lucide-react";import{AnimatePresence as Dr,motion as Rr}from"framer-motion";import*as nt from"react";import*as Aa from"react-dom";import{jsx as pe,jsxs as Xt}from"react/jsx-runtime";function Ia({controller:e,visible:t,container:a,children:r,className:s,...i}){let[u,w]=nt.useState(!1);nt.useLayoutEffect(()=>{w(!0)},[]),nt.useEffect(()=>{function T(L){L.key==="Escape"&&e&&e.clearSelection()}return window.addEventListener("keydown",T),()=>window.removeEventListener("keydown",T)},[e]);let m=a??(u?globalThis.document?.body:null);if(!m||!e)return null;let v=e.getSelectedItems(),p=t??v.length>0;return Aa.createPortal(pe(Dr,{children:p&&pe(Rr.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:o("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-8 ring-primary/5",s),...i,children:pe(lt,{children:r})})}),m)}function Fa({size:e="sm",variant:t="secondary",tooltip:a,isPending:r,disabled:s,className:i,children:u,onClick:w,...m}){let v=pe(h,{variant:t,size:e,className:o("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",i),disabled:s||r,onClick:w,...m,children:r?pe(Pr,{className:"animate-spin"}):u});return a?Xt(Ze,{children:[pe(Qe,{asChild:!0,children:v}),pe(et,{sideOffset:8,className:"rounded-lg border font-semibold text-foreground bg-secondary [&>span]:hidden",children:pe("p",{children:a})})]}):v}function Ba({controller:e}){let t=nt.useCallback(()=>{e&&e.clearSelection()},[e]);if(!e)return null;let a=e.getSelectedItems();return Xt("div",{className:"flex h-8 items-center rounded-lg border bg-muted/50 pr-1 pl-3",children:[Xt("span",{className:"whitespace-nowrap text-sm font-medium",children:[a.length," selected"]}),pe(qt,{orientation:"vertical",className:"mr-2 ml-3 data-[orientation=vertical]:h-4"}),Xt(Ze,{children:[pe(Qe,{asChild:!0,children:pe(h,{variant:"ghost",size:"icon",className:"size-6 rounded-md",onClick:t,children:pe(kr,{className:"size-3.5"})})}),Xt(et,{sideOffset:10,className:"flex items-center gap-2 rounded-lg border px-3 py-2 font-semibold text-foreground bg-secondary [&>span]:hidden",children:[pe("p",{children:"Clear selection"}),pe("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:pe("abbr",{title:"Escape",className:"no-underline",children:"Esc"})})]})]})]})}import{jsx as Ar}from"react/jsx-runtime";var Mr={none:"gap-0",tight:"gap-2",default:"gap-4",loose:"gap-6","extra-loose":"gap-8"},zr={none:"p-0",tight:"p-2",default:"p-4",loose:"p-6"},La=({children:e,className:t,spacing:a="tight",padding:r="none"})=>Ar("div",{className:o("flex flex-col h-full",Mr[a],zr[r],t),children:e});import{ArrowLeftIcon as Oa,ChevronRight as Ir}from"lucide-react";import{NavLink as Fr}from"react-router";import{jsx as xe,jsxs as gt}from"react/jsx-runtime";var _a=({className:e,columns:t=[],showBackButton:a=!0,meta:r={title:""}})=>{let s=()=>{if(!r.backAction||!a)return null;let p={variant:"secondary",size:"icon",className:"hover:bg-primary/20 inline-flex"};return r.backAction.href?xe(Fr,{to:r.backAction.href,children:gt(h,{...p,children:[xe(Oa,{className:"size-6"}),r.backAction.content]})}):gt(h,{...p,onClick:r.backAction.onClick,children:[xe(Oa,{className:"size-6"}),r.backAction.content]})},i=()=>!r.metadata||r.metadata.length===0?null:xe("div",{className:"flex gap-4",children:r.metadata.map((p,T)=>p.value&>("div",{className:"text-sm",children:[gt("span",{className:"text-muted-foreground",children:[p.label," "]}),xe("span",{children:p.value})]},T))}),u=()=>r.status?xe("span",{className:o("inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium",{success:"bg-green-100 text-green-800",warning:"bg-yellow-100 text-yellow-800",critical:"bg-red-100 text-red-800",info:"bg-blue-100 text-blue-800",default:"bg-gray-100 text-gray-800"}[r.status.color]),children:r.status.content}):null,w={content:gt("div",{className:"flex gap-2 items-center",children:[s(),gt("div",{className:"flex flex-col gap-2 w-max",children:[xe("h1",{className:"text-2xl font-bold tracking-tight",children:r.title}),u(),r.description&&xe("p",{className:"text-muted-foreground",children:r.description}),i(),r.breadcrumbs&&r.breadcrumbs.length>0&&xe("div",{className:"flex items-center text-sm text-muted-foreground",children:r.breadcrumbs.map((p,T)=>gt("div",{className:"flex items-center",children:[p.href?xe("span",{className:"hover:text-primary hover:underline",children:p.label}):xe("span",{children:p.label}),T<r.breadcrumbs.length-1&&xe(Ir,{className:"mx-2 h-4 w-4"})]},T))})]})]}),align:"left",width:"fill"},m={content:r.primaryActions,align:"right",width:"auto"},v=[w,...t.filter(p=>p!==void 0),m];return xe("div",{className:o("flex items-center w-full gap-4 p-2",e),children:v.map((p,T)=>xe("div",{className:o("flex items-center h-full",p.className,{"justify-start":p.align==="left","justify-center":p.align==="center","justify-end":p.align==="right","flex-1":p.width==="fill"}),children:p.content},T))})};import Or,{useState as _r,createContext as Vr,useContext as Hr}from"react";import{Dialog as Kt}from"radix-ui";import{XIcon as Br}from"lucide-react";import{jsx as Mt,jsxs as Eo}from"react/jsx-runtime";function Va({...e}){return Mt(Kt.Root,{"data-slot":"sheet",...e})}function Go({...e}){return Mt(Kt.Portal,{"data-slot":"sheet-portal",...e})}function Lr({className:e,...t}){return Mt(Kt.Overlay,{"data-slot":"sheet-overlay",className:o("data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50",e),...t})}function Ha({className:e,children:t,side:a="right",...r}){return Eo(Go,{children:[Mt(Lr,{}),Eo(Kt.Content,{"data-slot":"sheet-content",className:o("bg-background data-[state=open]:animate-in data-[state=closed]:animate-out fixed z-50 flex flex-col gap-4 shadow-lg transition ease-in-out data-[state=closed]:duration-300 data-[state=open]:duration-500",a==="right"&&"data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right inset-y-0 right-0 h-full w-3/4 border-l sm:max-w-sm",a==="left"&&"data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left inset-y-0 left-0 h-full w-3/4 border-r sm:max-w-sm",a==="top"&&"data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top inset-x-0 top-0 h-auto border-b",a==="bottom"&&"data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom inset-x-0 bottom-0 h-auto border-t",e),...r,children:[t,Eo(Kt.Close,{className:"ring-offset-background focus:ring-ring data-[state=open]:bg-secondary absolute top-4 right-4 rounded-xs opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none",children:[Mt(Br,{className:"size-4"}),Mt("span",{className:"sr-only",children:"Close"})]})]})]})}import{Fragment as $r,jsx as Y,jsxs as At}from"react/jsx-runtime";var Ea=Vr(!1),po={"one-half":["w-1/2","w-1/2"],"one-third":["w-1/3","w-2/3"],"two-third":["w-2/3","w-1/3"],"one-fourth":["w-1/4","w-3/4"],"three-fourth":["w-3/4","w-1/4"],"one-fifth":["w-1/5","w-4/5"],"four-fifth":["w-4/5","w-1/5"]},zt={none:"p-0",tight:"p-2",default:"p-4",loose:"p-6"},Er=(e,t)=>{let[a,r]=po[t];return{container:"inset-y-0 z-50 transition-all duration-500 ease-in-out",content:o("h-full bg-background transition-all duration-500 ease-in-out",e==="right"?"border-l":"border-r"),transform:e==="right"?"translate-x-full":"-translate-x-full",transformOpen:"translate-x-0",contentPushClass:e==="right"?r:a,sheetPushClass:e==="right"?a:r}},Gr="flex flex-col overflow-hidden rounded-2xl relative",jr={default:"bg-background",card:"bg-background shadow-sm border",border:"bg-background border-2",transparent:"bg-transparent"},Ga=e=>{let{children:t,className:a,variant:r="default",layout:s="full",header:i,footer:u,headerClassName:w,contentClassName:m,footerClassName:v,parentContainer:p=!1,padding:T=p?"none":"tight"}=e,L=Hr(Ea),[F,A]=_r(!1),k=Or.useCallback(H=>Y("div",{className:o("flex-1 overflow-auto h-full no-scrollbar",p&&"flex",!p&&zt[T],m),children:H}),[T,p,m]),O=()=>{switch(s){case"split":{let{splitRatio:H="three-fourth",reverse:S=!1}=e;if(!Array.isArray(t)||t.length!==2)return Y("div",{className:"flex items-center justify-center h-full text-red-500",children:'Error: AppContent with layout="split" requires exactly 2 children'});let[J,C]=po[H],[_,De]=S?[t[1],t[0]]:[t[0],t[1]],[Te,ie]=S?[C,J]:[J,C];return At("div",{className:"flex h-full gap-2",children:[Y("div",{className:o(Te,"overflow-auto"),children:k(_)}),Y("div",{className:o(ie,"overflow-auto"),children:k(De)})]})}case"with-sheet":{let{sheetContent:H,sheetWidth:S="four-fifth",sheetSide:J="right",sheetMode:C="container",sheetClassName:_,isSheetOpen:De,onSheetOpenChange:Te,disableOverlay:ie=!0,showSheetOverlay:Ue=!0}=e,Se=De!==void 0&&Te,Q=Se?De:F,We=Se?Te:A;if(C==="container"){let se=Er(J,S),Pe=po[S][0];return ie?At("div",{className:o("flex relative flex-1 overflow-hidden",m),children:[Y("div",{className:o("h-full overflow-auto transition-all duration-500",Q?se.contentPushClass:"w-full",Q&&"overflow-y-auto overflow-x-hidden"),children:Y("div",{className:o("h-full",!p&&zt[T]),children:t})}),Y("div",{className:o(se.container,"transition-all duration-500 ease-in-out h-full",Pe,Q&&["left","right"].includes(J)?o(se.sheetPushClass,"overflow-y-auto"):Q?se.transformOpen:o(se.transform,"hidden"),"overflow-y-auto"),children:Y("div",{className:o(se.content,_,"h-full"),children:H})})]}):At("div",{className:o("flex relative flex-1 overflow-hidden",m),children:[Y("div",{className:o("h-full overflow-auto w-full transition-all duration-500 relative z-10"),children:Y("div",{className:o("h-full",!p&&zt[T]),children:t})}),At("div",{className:o("absolute inset-0 z-20",!Q&&"pointer-events-none"),children:[Ue&&Y("div",{className:o("absolute inset-0 bg-black/50 transition-opacity duration-500",Q?"opacity-100":"opacity-0 pointer-events-none"),onClick:()=>We(!1)}),Y("div",{className:o(se.container,"transition-all duration-500 backdrop-blur-2xl ease-in-out h-full absolute",Pe,Q?"translate-x-0 opacity-100":o(J==="right"?"translate-x-full":"-translate-x-full","opacity-0 pointer-events-none"),"overflow-y-auto"),style:{[J]:0},children:Y("div",{className:o(se.content,_,"h-full"),children:H})})]})]})}return At($r,{children:[t,Y(Va,{open:Q,onOpenChange:We,children:Y(Go,{children:Y(Ha,{side:J,className:o("fixed bg-background border sm:max-w-full","transition-all duration-500 ease-in-out",po[S][0],_),children:H})})})]})}default:return k(t)}};return Y(Ea.Provider,{value:!0,children:At("div",{className:o(Gr,jr[r],zt[T],L&&"flex-1",p&&"h-full",!p&&"rounded-2xl",a),children:[i&&Y("div",{className:o("border-b",w,r==="card"&&!p&&"rounded-t-2xl",r==="border"&&"border-b-2",zt[T]),children:i}),O(),u&&Y("div",{className:o("border-t",v,r==="card"&&!p&&"rounded-b-2xl",r==="border"&&"border-t-2",zt[T]),children:u})]})})};import{jsx as jo}from"react/jsx-runtime";var ja=({className:e,columns:t=[],meta:a={title:""}})=>{let r={content:jo("div",{className:"flex items-center gap-4 p-2",children:a.secondaryActions}),align:"right",width:"fill"},s=[...t.filter(i=>i!==void 0),r];return jo("div",{className:o("flex items-center w-full gap-4",e),children:s.map((i,u)=>jo("div",{className:o("flex items-center h-full",i.className,{"justify-start":i.align==="left","justify-center":i.align==="center","justify-end":i.align==="right","flex-1":i.width==="fill"}),children:i.content},u))})};import{jsx as uo}from"react/jsx-runtime";function Ur({useTypedAppMeta:e}){return{AppHeader:i=>{let{meta:u}=e();return uo(_a,{...i,meta:u})},AppFooter:i=>{let{meta:u}=e();return uo(ja,{...i,meta:u})},AppContent:i=>uo(Ga,{...i}),AppContainer:i=>uo(La,{...i})}}import{createContext as $a,useContext as Wr,useState as Ua,useCallback as go,useMemo as Wa}from"react";import{jsx as qa}from"react/jsx-runtime";var qr=$a(void 0),Jr=({children:e})=>{let[t,a]=Ua({title:"",description:"",breadcrumbs:[]}),r=go(u=>{a(w=>Object.keys(u).some(v=>JSON.stringify(w[v])!==JSON.stringify(u[v]))?{...w,...u}:w)},[]),s=go(()=>{a(u=>u.title===""&&u.description===""&&(u.breadcrumbs?.length??0)===0?u:{title:"",description:"",breadcrumbs:[]})},[]),i=Wa(()=>({meta:t,setMeta:r,resetMeta:s}),[t,r,s]);return qa(qr.Provider,{value:i,children:e})};function Xr(){let e=$a(void 0);return{TypedAppMetaProvider:({children:r})=>{let[s,i]=Ua({title:"",description:"",breadcrumbs:[]}),u=go(v=>{i(p=>Object.keys(v).some(L=>{let F=p[L],A=v[L];return JSON.stringify(F)!==JSON.stringify(A)})?{...p,...v}:p)},[]),w=go(()=>{i(v=>v.title===""&&v.description===""&&(v.breadcrumbs?.length??0)===0?v:{title:"",description:"",breadcrumbs:[]})},[]),m=Wa(()=>({meta:s,setMeta:u,resetMeta:w}),[s,u,w]);return qa(e.Provider,{value:m,children:r})},useTypedAppMeta:()=>{let r=Wr(e);if(!r)throw new Error("useTypedAppMeta must be used within a TypedAppMetaProvider");return r},TypedAppMetaContext:e}}import{useEffect as Kr,useMemo as $o}from"react";function Yr({useTypedAppMeta:e}){function t(a){let{setMeta:r,resetMeta:s}=e(),i=$o(()=>{if(a.backAction)return{...a.backAction,onClick:a.backAction.onClick}},[a.backAction?.content,a.backAction?.href,a.backAction?.onClick?.toString()]),u=$o(()=>a.metadata,[JSON.stringify(a.metadata)]),w=$o(()=>({...a,backAction:i,metadata:u}),[a.title,a.description,a.breadcrumbs,a.primaryActions,a.secondaryActions,a.pagination,a.status,i,u]);Kr(()=>(r(w),()=>s()),[w,r,s])}return{usePageTemplate:t}}import{useState as Ja}from"react";import{Copy as Zr,Check as Qr,Loader2Icon as ei}from"lucide-react";import{jsx as je,jsxs as Xa}from"react/jsx-runtime";var Uo=class{static currencyFormatter=new Intl.NumberFormat("en-IN",{style:"currency",currency:"INR",maximumFractionDigits:2});static compactFormatter=new Intl.NumberFormat("en-IN",{style:"currency",currency:"INR",notation:"compact",maximumFractionDigits:1});static MONTH_NAMES_SHORT=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];static async copyToClipboard(t){if(t)try{await navigator.clipboard.writeText(t)}catch(a){throw console.error("Failed to copy text:",a),a}}static CopyToClipboard=({text:t,children:a,className:r,size:s="icon",variant:i="ghost"})=>{let[u,w]=Ja(!1),[m,v]=Ja(!1),p=async()=>{if(!(!t||m)){v(!0);try{await this.copyToClipboard(t),w(!0),setTimeout(()=>w(!1),2e3)}catch(T){console.error("Failed to copy text:",T)}finally{v(!1)}}};return Xa(Ze,{children:[je(Qe,{asChild:!0,children:je(h,{variant:i,size:s,className:o(s==="icon"&&"size-6",r),onClick:p,disabled:m||!t,children:m?je(ei,{className:"animate-spin"}):u?je(Qr,{className:"h-3 w-3"}):a||je(Zr,{className:"h-3 w-3"})})}),je(et,{children:u?"Copied!":m?"Copying...":"Copy to clipboard"})]})};static formatINR(t,a={}){let{prefix:r="",suffix:s="",withSymbol:i=!0,compact:u=!1}=a;if(typeof t!="number"||isNaN(t))return`${r}${i?"\u20B9 ":""}0.00${s}`;let w=t<0,m=Math.abs(t),p=(u&&m>=1e5?this.compactFormatter:this.currencyFormatter).format(m).replace("\u20B9","");return`${r}${w?"- ":""}${i?"\u20B9 ":""}${p}${s}`}static formatDate(t,a={}){let{format:r="dd-mm-yyyy",separator:s="-"}=a,i=new Date(t);if(isNaN(i.getTime()))return"";let u=String(i.getDate()).padStart(2,"0"),w=String(i.getMonth()+1).padStart(2,"0"),m=this.MONTH_NAMES_SHORT[i.getMonth()],v=i.getFullYear();switch(r){case"dd-mmm-yyyy":return`${u}${s}${m}${s}${v}`;case"iso":return i.toISOString().split("T")[0];case"long":return i.toLocaleDateString("en-IN",{year:"numeric",month:"long",day:"numeric"});case"short":return i.toLocaleDateString("en-IN");default:return`${u}${s}${w}${s}${v}`}}static toProperCase(t){return t?t.toLowerCase().split(" ").map(a=>a.charAt(0).toUpperCase()+a.slice(1)).join(" "):""}static toProperCaseAdvanced(t){return t?t.toLowerCase().split(/(\s+|['-])/).map((a,r,s)=>["-","'"," "].includes(a)||r>0&&["-","'"].includes(s[r-1])?a:a.charAt(0).toUpperCase()+a.slice(1)).join(""):""}static StatusBadge=({status:t,className:a,showDot:r=!0,capitalize:s=!0,size:i="md",variant:u="outline",customColors:w,icon:m,trueMessage:v="active",falseMessage:p="inactive"})=>{let T=typeof t=="boolean"?t?v:p:typeof t=="number"?t>0?v:p:t.toLowerCase(),L={active:{label:"active",solid:{bg:"bg-emerald-500",text:"text-white",border:"border-emerald-600",dot:"bg-white"},outline:{bg:"bg-emerald-50",text:"text-emerald-700",border:"border-emerald-100",dot:"bg-emerald-500"},subtle:{bg:"bg-emerald-50",text:"text-emerald-700",border:"border-transparent",dot:"bg-emerald-500"}},pending:{label:"pending",solid:{bg:"bg-amber-500",text:"text-white",border:"border-amber-600",dot:"bg-white"},outline:{bg:"bg-amber-50",text:"text-amber-700",border:"border-amber-100",dot:"bg-amber-500"},subtle:{bg:"bg-amber-50",text:"text-amber-700",border:"border-transparent",dot:"bg-amber-500"}},inactive:{label:"inactive",solid:{bg:"bg-rose-500",text:"text-white",border:"border-rose-600",dot:"bg-white"},outline:{bg:"bg-rose-50",text:"text-rose-700",border:"border-rose-100",dot:"bg-rose-500"},subtle:{bg:"bg-rose-50",text:"text-rose-700",border:"border-transparent",dot:"bg-rose-500"}},draft:{label:"draft",solid:{bg:"bg-gray-500",text:"text-white",border:"border-gray-600",dot:"bg-white"},outline:{bg:"bg-gray-50",text:"text-gray-700",border:"border-gray-100",dot:"bg-gray-500"},subtle:{bg:"bg-gray-50",text:"text-gray-700",border:"border-transparent",dot:"bg-gray-500"}},completed:{label:"completed",solid:{bg:"bg-indigo-500",text:"text-white",border:"border-indigo-600",dot:"bg-white"},outline:{bg:"bg-indigo-50",text:"text-indigo-700",border:"border-indigo-100",dot:"bg-indigo-500"},subtle:{bg:"bg-indigo-50",text:"text-indigo-700",border:"border-transparent",dot:"bg-indigo-500"}}},F=L[T.toLowerCase()]||L.inactive,A=w||F[u],k={sm:"text-xs px-2 py-0.5",md:"text-xs px-2.5 py-0.5",lg:"text-sm px-3 py-1"},O=s?T.charAt(0).toUpperCase()+T.slice(1):T;return je("div",{className:"flex justify-center",children:Xa("span",{className:o("inline-flex items-center gap-1.5 rounded-full border font-medium",A.bg,A.text,A.border,k[i],a),children:[r&&(m?je("span",{className:"flex items-center",children:m}):je("span",{className:o("size-2 rounded-full",A.dot),"aria-hidden":"true"})),O]})})}};import{AlertTriangleIcon as ti}from"lucide-react";import{useRouteError as oi,isRouteErrorResponse as ai,useNavigate as ni}from"react-router";import{Fragment as Wo,jsx as Be,jsxs as It}from"react/jsx-runtime";var Ka=()=>{let e=oi(),t=ni();return Be("div",{className:"rounded-2xl flex justify-center items-center h-full bg-sidebar px-4",children:It("div",{className:"flex flex-col items-center space-y-4 text-center",children:[Be(ti,{className:"h-16 w-16 text-destructive"}),ai(e)?It(Wo,{children:[It("h2",{className:"text-3xl font-semibold text-destructive",children:["Error ",e.status,": ",e.statusText]}),typeof e.data=="string"?Be("pre",{className:"text-lg text-muted-foreground whitespace-pre-wrap max-w-4xl text-left",children:e.data}):e.data?.message&&Be("pre",{className:"text-lg text-muted-foreground whitespace-pre-wrap max-w-4xl text-left",children:e.data.message})]}):e instanceof Error?It(Wo,{children:[Be("h2",{className:"text-3xl font-semibold text-destructive",children:"Unexpected Error"}),Be("pre",{className:"text-lg text-muted-foreground whitespace-pre-wrap max-w-4xl text-left",children:e.message}),e.stack&&It("details",{className:"mt-2 text-sm text-muted-foreground max-w-4xl text-left",children:[Be("summary",{className:"cursor-pointer underline",children:"Stack Trace"}),Be("pre",{className:"whitespace-pre-wrap",children:e.stack})]})]}):It(Wo,{children:[Be("h2",{className:"text-3xl font-semibold text-destructive",children:"Unknown Error"}),Be("pre",{className:"text-lg text-muted-foreground whitespace-pre-wrap max-w-4xl text-left",children:typeof e=="string"?e:JSON.stringify(e,null,2)})]}),Be(h,{variant:"outline",onClick:()=>t(-1),children:"Go Back"})]})})};import{motion as $e}from"framer-motion";import{jsx as q,jsxs as Ne}from"react/jsx-runtime";function ri({size:e=100,strokeWidth:t=2,color:a="currentColor",className:r=""}){return Ne($e.svg,{width:e,height:e,viewBox:"0 0 100 100",initial:"hidden",animate:"visible",className:r,children:[q("title",{children:"Animated Checkmark"}),q($e.circle,{cx:"50",cy:"50",r:"40",stroke:a,custom:0,style:{strokeWidth:t,strokeLinecap:"round",fill:"transparent"}}),q($e.path,{d:"M30 50L45 65L70 35",stroke:a,custom:1,style:{strokeWidth:t,strokeLinecap:"round",strokeLinejoin:"round",fill:"transparent"}})]})}function Ya(){return q(Ee,{className:"w-full max-w-sm mx-auto p-6 min-h-[300px] flex flex-col justify-center bg-background",children:Ne(Ge,{className:"space-y-4 flex flex-col items-center justify-center",children:[q($e.div,{className:"flex justify-center",initial:{opacity:0,scale:.8},animate:{opacity:1,scale:1},transition:{duration:.4,ease:[.4,0,.2,1],scale:{type:"spring",damping:15,stiffness:200}},children:Ne("div",{className:"relative",children:[q($e.div,{className:"absolute inset-0 bg-primary/5 rounded-full",initial:{opacity:0,scale:.8},animate:{opacity:1,scale:1},transition:{delay:.2,duration:.8,ease:"circOut"}}),q(ri,{size:80,strokeWidth:4,color:"rgb(16 185 129)",className:"relative z-10 dark:drop-shadow-[0_0_10px_rgba(0,0,0,0.1)]"})]})}),Ne($e.div,{className:"space-y-2 text-center w-full",initial:{opacity:0,y:10},animate:{opacity:1,y:0},transition:{delay:.2,duration:.6,ease:[.4,0,.2,1]},children:[q($e.h2,{className:"text-lg text-zinc-100 dark:text-zinc-900 tracking-tighter font-semibold uppercase",initial:{opacity:0,y:5},animate:{opacity:1,y:0},transition:{delay:1,duration:.4},children:"Transfer Successful"}),q("div",{className:"flex items-center gap-4",children:q($e.div,{className:"flex-1 bg-zinc-800/50 dark:bg-zinc-50/50 rounded-xl p-3 border border-zinc-700/50 dark:border-zinc-200/50 backdrop-blur-md",initial:{opacity:0,scale:.95},animate:{opacity:1,scale:1},transition:{delay:1.2,duration:.4,ease:[.4,0,.2,1]},children:Ne("div",{className:"flex flex-col items-start gap-2",children:[Ne("div",{className:"space-y-1.5",children:[Ne("span",{className:"text-xs font-medium text-secondary-foreground flex items-center gap-1.5",children:[Ne("svg",{className:"w-3 h-3",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[q("title",{children:"From"}),q("path",{d:"M12 19V5M5 12l7-7 7 7"})]}),"From"]}),Ne("div",{className:"flex items-center gap-2.5 group transition-all",children:[q("span",{className:"inline-flex items-center justify-center w-7 h-7 rounded-lg bg-zinc-900 dark:bg-white shadow-lg border border-zinc-700 dark:border-zinc-300 text-sm font-medium text-zinc-100 dark:text-zinc-900 group-hover:scale-105 transition-transform",children:"$"}),q("span",{className:"font-medium text-zinc-100 dark:text-zinc-900 tracking-tight",children:"500.00 USD"})]})]}),q("div",{className:"w-full h-px bg-gradient-to-r from-transparent via-zinc-700 dark:via-zinc-300 to-transparent"}),Ne("div",{className:"space-y-1.5",children:[Ne("span",{className:"text-xs font-medium text-secondary-foreground flex items-center gap-1.5",children:[Ne("svg",{className:"w-3 h-3",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[q("title",{children:"To"}),q("path",{d:"M12 5v14M5 12l7 7 7-7"})]}),"To"]}),Ne("div",{className:"flex items-center gap-2.5 group transition-all",children:[q("span",{className:"inline-flex items-center justify-center w-7 h-7 rounded-lg bg-zinc-900 dark:bg-white shadow-lg border border-zinc-700 dark:border-zinc-300 text-sm font-medium text-zinc-100 dark:text-zinc-900 group-hover:scale-105 transition-transform",children:"\u20AC"}),q("span",{className:"font-medium text-zinc-100 dark:text-zinc-900 tracking-tight",children:"460.00 EUR"})]})]})]})})}),q($e.div,{className:"w-full text-xs text-secondary-foreground mt-2 text-center",initial:{opacity:0},animate:{opacity:1},transition:{delay:1.4,duration:.4},children:"Exchange Rate: 1 USD = 0.92 EUR"})]})]})})}import{jsx as fo,jsxs as ii}from"react/jsx-runtime";var Za=()=>fo("div",{className:"rounded-2xl flex justify-center items-center h-full bg-transparent",children:ii("div",{className:"flex flex-col items-center space-y-4",children:[fo("div",{className:"animate-spin rounded-full border-t-4 border-ring h-16 w-16 mb-4"}),fo("h2",{className:"text-xl font-semibold text-muted-foreground",children:"Loading, please wait..."}),fo("p",{className:"text-sm text-muted-foreground",children:"Your content is on its way."})]})});import{useLocation as si}from"react-router";import{GhostIcon as li}from"lucide-react";import{NavLink as di,useNavigate as ci}from"react-router";import{jsx as Ft,jsxs as qo}from"react/jsx-runtime";var Qa=()=>{let e=si(),t=ci(),a=()=>{window.history.length>2?t(-1):t("/")};return qo("div",{className:"rounded-2xl flex flex-col items-center justify-center h-full p-6 text-center bg-sidebar text-muted-foreground select-none",children:[Ft(li,{className:"h-15 w-15 text-destructive mb-4"}),Ft("h1",{className:"text-2xl font-bold text-destructive mb-2",children:"Page Not Found"}),qo("p",{className:"text-xl mb-4",children:["The page ",Ft("code",{className:"px-1 py-0.5 rounded bg-muted text-foreground",children:e.pathname})," doesn't exist or has been moved."]}),qo("div",{className:"flex space-x-4",children:[Ft(h,{variant:"outline",onClick:a,children:"Go Back"}),Ft(h,{variant:"ghost",children:Ft(di,{to:"/",children:"Return Home"})})]})]})};import{WifiOffIcon as mi}from"lucide-react";import{jsx as Jo,jsxs as pi}from"react/jsx-runtime";var en=()=>pi("div",{className:"rounded-2xl flex flex-col items-center justify-center h-screen p-6 text-center text-muted-foreground bg-background select-none",children:[Jo(mi,{className:"h-15 w-15 text-destructive mb-4"}),Jo("h1",{className:"text-3xl font-bold text-destructive mb-2",children:"You're offline"}),Jo("p",{className:"text-xl max-w-md",children:"We couldn't connect to the server."})]});import{ShieldOffIcon as ui}from"lucide-react";import{NavLink as gi,useNavigate as fi}from"react-router";import{jsx as Bt,jsxs as tn}from"react/jsx-runtime";var on=()=>{let e=fi();return tn("div",{className:"rounded-2xl flex flex-col items-center justify-center h-full p-6 text-center bg-sidebar text-muted-foreground select-none",children:[Bt(ui,{className:"h-15 w-15 text-destructive mb-4"}),Bt("h1",{className:"text-2xl font-bold text-destructive mb-2",children:"Access Denied"}),Bt("p",{className:"text-xl mb-4",children:"You don't have permission to view this page. Please sign in with an authorized account or contact your administrator."}),tn("div",{className:"flex space-x-4",children:[Bt(h,{variant:"outline",onClick:()=>{window.history.length>2?e(-1):e("/")},children:"Go Back"}),Bt(h,{variant:"ghost",children:Bt(gi,{to:"/",children:"Go to Home"})})]})]})};export{Jr as AppMetaProvider,Ya as CurrencyTransfer,Na as DataTable,Sa as DataTableActionBar,Pa as DataTableActionBarAction,ka as DataTableActionBarSelection,za as DataTemplate,Ia as DataTemplateActionBar,Fa as DataTemplateActionBarAction,Ba as DataTemplateActionBarSelection,Ka as ErrorComponent,Uo as GeneralHelper,Za as Loader,Qa as NotFound,en as OfflineUI,on as Unauthorized,Ur as createLayoutComponents,Yr as createPageTemplateHook,Xr as createTypedAppMetaContext};
|
|
2
|
+
import{flexRender as Lo,getCoreRowModel as Zn,getFilteredRowModel as Qn,getPaginationRowModel as er,getSortedRowModel as tr,useReactTable as or}from"@tanstack/react-table";import{Loader2 as xa,ChevronUp as Oo,ChevronDown as _o,ChevronsUpDown as ar,MoreHorizontal as nr,MoveRightIcon as rr,PinOffIcon as ir,Calculator as ya}from"lucide-react";import{Slot as yn}from"radix-ui";import{cva as Cn}from"class-variance-authority";import{clsx as hn}from"clsx";import{twMerge as xn}from"tailwind-merge";function o(...e){return xn(hn(e))}import{jsx as wn}from"react/jsx-runtime";var ao=Cn("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 h({className:e,variant:t,size:a,asChild:r=!1,...s}){let i=r?yn.Slot:"button";return wn(i,{"data-slot":"button",className:o(ao({variant:t,size:a,className:e}),"transition-none"),...s})}import{jsx as Ye}from"react/jsx-runtime";function yo({className:e,...t}){return Ye("div",{"data-slot":"table-container",className:"relative w-full h-full max-h-full overflow-auto",children:Ye("table",{"data-slot":"table",className:o("w-full caption-bottom text-sm",e),...t})})}function ta({className:e,...t}){return Ye("thead",{"data-slot":"table-header",className:o("[&_tr]:border-b",e),...t})}function oa({className:e,...t}){return Ye("tbody",{"data-slot":"table-body",className:o("[&_tr:last-child]:border-0",e),...t})}function Co({className:e,...t}){return Ye("tfoot",{"data-slot":"table-footer",className:o("bg-muted/50 border-t font-medium [&>tr]:last:border-b-0",e),...t})}function Ve({className:e,...t}){return Ye("tr",{"data-slot":"table-row",className:o("hover:bg-muted/50 data-[state=selected]:bg-muted border-b transition-colors",e),...t})}function aa({className:e,...t}){return Ye("th",{"data-slot":"table-head",className:o("text-foreground h-10 px-2 text-left align-middle font-medium whitespace-nowrap",e),...t})}function He({className:e,...t}){return Ye("td",{"data-slot":"table-cell",className:o("p-2 align-middle whitespace-nowrap",e),...t})}import{jsx as na}from"react/jsx-runtime";function Ee({className:e,...t}){return na("div",{"data-slot":"card",className:o("bg-card text-card-foreground flex flex-col gap-6 rounded-xl border py-6 shadow-sm",e),...t})}function Ge({className:e,...t}){return na("div",{"data-slot":"card-content",className:o("px-6",e),...t})}import{Tooltip as yt}from"radix-ui";import{jsx as Ct,jsxs as Nn}from"react/jsx-runtime";function lt({delayDuration:e=0,...t}){return Ct(yt.Provider,{"data-slot":"tooltip-provider",delayDuration:e,...t})}function Ze({...e}){return Ct(lt,{children:Ct(yt.Root,{"data-slot":"tooltip",...e})})}function Qe({...e}){return Ct(yt.Trigger,{"data-slot":"tooltip-trigger",...e})}function et({className:e,sideOffset:t=0,children:a,...r}){return Ct(yt.Portal,{children:Nn(yt.Content,{"data-slot":"tooltip-content",sideOffset:t,className:o("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),...r,children:[a,Ct(yt.Arrow,{className:"bg-primary fill-primary z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px]"})]})})}import{Search as ua,RefreshCw as On,Download as _n,Settings2 as Vn,Filter as ga,ArrowUpDown as Hn,PinOff as En,Pin as Gn,ChevronDown as Mo,Calculator as zo,Check as fa}from"lucide-react";import{jsx as Tn}from"react/jsx-runtime";function wt({className:e,type:t,...a}){return Tn("input",{type:t,"data-slot":"input",className:o("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 Nt}from"cmdk";import{SearchIcon as Sn}from"lucide-react";import{Dialog as _i}from"radix-ui";import{XIcon as Hi}from"lucide-react";import{jsx as ji,jsxs as $i}from"react/jsx-runtime";import{jsx as dt,jsxs as Pn}from"react/jsx-runtime";function wo({className:e,...t}){return dt(Nt,{"data-slot":"command",className:o("bg-popover text-popover-foreground flex h-full w-full flex-col overflow-hidden rounded-md",e),...t})}function No({className:e,...t}){return Pn("div",{"data-slot":"command-input-wrapper",className:"flex h-9 items-center gap-2 border-b px-3",children:[dt(Sn,{className:"size-4 shrink-0 opacity-50"}),dt(Nt.Input,{"data-slot":"command-input",className:o("placeholder:text-muted-foreground flex h-10 w-full rounded-md bg-transparent py-3 text-sm outline-hidden disabled:cursor-not-allowed disabled:opacity-50",e),...t})]})}function To({className:e,...t}){return dt(Nt.List,{"data-slot":"command-list",className:o("max-h-[300px] scroll-py-1 overflow-x-hidden overflow-y-auto",e),...t})}function So({...e}){return dt(Nt.Empty,{"data-slot":"command-empty",className:"py-6 text-center text-sm",...e})}function Po({className:e,...t}){return dt(Nt.Group,{"data-slot":"command-group",className:o("text-foreground [&_[cmdk-group-heading]]:text-muted-foreground overflow-hidden p-1 [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium",e),...t})}function no({className:e,...t}){return dt(Nt.Item,{"data-slot":"command-item",className:o("data-[selected=true]:bg-accent data-[selected=true]:text-accent-foreground [&_svg:not([class*='text-'])]:text-muted-foreground relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",e),...t})}import{DropdownMenu as Ce}from"radix-ui";import{CheckIcon as kn,ChevronRightIcon as Dn,CircleIcon as rs}from"lucide-react";import{jsx as be,jsxs as la}from"react/jsx-runtime";function ze({...e}){return be(Ce.Root,{"data-slot":"dropdown-menu",...e})}function Ae({...e}){return be(Ce.Trigger,{"data-slot":"dropdown-menu-trigger",...e})}function Ie({className:e,sideOffset:t=4,...a}){return be(Ce.Portal,{children:be(Ce.Content,{"data-slot":"dropdown-menu-content",sideOffset:t,className:o("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 ko({...e}){return be(Ce.Group,{"data-slot":"dropdown-menu-group",...e})}function K({className:e,inset:t,variant:a="default",...r}){return be(Ce.Item,{"data-slot":"dropdown-menu-item","data-inset":t,"data-variant":a,className:o("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),...r})}function Ht({className:e,children:t,checked:a,...r}){return la(Ce.CheckboxItem,{"data-slot":"dropdown-menu-checkbox-item",className:o("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,...r,children:[be("span",{className:"pointer-events-none absolute left-2 flex size-3.5 items-center justify-center",children:be(Ce.ItemIndicator,{children:be(kn,{className:"size-4"})})}),t]})}function ce({className:e,inset:t,...a}){return be(Ce.Label,{"data-slot":"dropdown-menu-label","data-inset":t,className:o("px-2 py-1.5 text-sm font-medium data-[inset]:pl-8",e),...a})}function ve({className:e,...t}){return be(Ce.Separator,{"data-slot":"dropdown-menu-separator",className:o("bg-border -mx-1 my-1 h-px",e),...t})}function ra({...e}){return be(Ce.Sub,{"data-slot":"dropdown-menu-sub",...e})}function ia({className:e,inset:t,children:a,...r}){return la(Ce.SubTrigger,{"data-slot":"dropdown-menu-sub-trigger","data-inset":t,className:o("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),...r,children:[a,be(Dn,{className:"ml-auto size-4"})]})}function sa({className:e,...t}){return be(Ce.SubContent,{"data-slot":"dropdown-menu-sub-content",className:o("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 min-w-[8rem] origin-(--radix-dropdown-menu-content-transform-origin) overflow-hidden rounded-md border p-1 shadow-lg",e),...t})}import{useState as Ao}from"react";import{useEffect as Fn,useState as Do}from"react";import{Calendar as Bn}from"lucide-react";import{format as $t}from"date-fns";import{Popover as ro}from"radix-ui";import{jsx as io}from"react/jsx-runtime";function Et({...e}){return io(ro.Root,{"data-slot":"popover",...e})}function Gt({...e}){return io(ro.Trigger,{"data-slot":"popover-trigger",...e})}function jt({className:e,align:t="center",sideOffset:a=4,...r}){return io(ro.Portal,{children:io(ro.Content,{"data-slot":"popover-content",align:t,sideOffset:a,className:o("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),...r})})}import*as so from"react";import{ChevronDownIcon as Rn,ChevronLeftIcon as Mn,ChevronRightIcon as zn}from"lucide-react";import{DayPicker as An,getDefaultClassNames as da}from"react-day-picker";import{jsx as tt}from"react/jsx-runtime";function ca({className:e,classNames:t,showOutsideDays:a=!0,captionLayout:r="label",buttonVariant:s="ghost",formatters:i,components:u,...w}){let m=da();return tt(An,{showOutsideDays:a,className:o("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:r,formatters:{formatMonthDropdown:v=>v.toLocaleString("default",{month:"short"}),...i},classNames:{root:o("w-fit",m.root),months:o("flex gap-4 flex-col md:flex-row relative",m.months),month:o("flex flex-col w-full gap-4",m.month),nav:o("flex items-center gap-1 w-full absolute top-0 inset-x-0 justify-between",m.nav),button_previous:o(ao({variant:s}),"size-(--cell-size) aria-disabled:opacity-50 p-0 select-none",m.button_previous),button_next:o(ao({variant:s}),"size-(--cell-size) aria-disabled:opacity-50 p-0 select-none",m.button_next),month_caption:o("flex items-center justify-center h-(--cell-size) w-full px-(--cell-size)",m.month_caption),dropdowns:o("w-full flex items-center text-sm font-medium justify-center h-(--cell-size) gap-1.5",m.dropdowns),dropdown_root:o("relative has-focus:border-ring border border-input shadow-xs has-focus:ring-ring/50 has-focus:ring-[3px] rounded-md",m.dropdown_root),dropdown:o("absolute bg-popover inset-0 opacity-0",m.dropdown),caption_label:o("select-none font-medium",r==="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",m.caption_label),table:"w-full border-collapse",weekdays:o("flex",m.weekdays),weekday:o("text-muted-foreground rounded-md flex-1 font-normal text-[0.8rem] select-none",m.weekday),week:o("flex w-full mt-2",m.week),week_number_header:o("select-none w-(--cell-size)",m.week_number_header),week_number:o("text-[0.8rem] select-none text-muted-foreground",m.week_number),day:o("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",m.day),range_start:o("rounded-l-md bg-accent",m.range_start),range_middle:o("rounded-none",m.range_middle),range_end:o("rounded-r-md bg-accent",m.range_end),today:o("bg-accent text-accent-foreground rounded-md data-[selected=true]:rounded-none",m.today),outside:o("text-muted-foreground aria-selected:text-muted-foreground",m.outside),disabled:o("text-muted-foreground opacity-50",m.disabled),hidden:o("invisible",m.hidden),...t},components:{Root:({className:v,rootRef:p,...T})=>tt("div",{"data-slot":"calendar",ref:p,className:o(v),...T}),Chevron:({className:v,orientation:p,...T})=>p==="left"?tt(Mn,{className:o("size-4",v),...T}):p==="right"?tt(zn,{className:o("size-4",v),...T}):tt(Rn,{className:o("size-4",v),...T}),DayButton:In,WeekNumber:({children:v,...p})=>tt("td",{...p,children:tt("div",{className:"flex size-(--cell-size) items-center justify-center text-center",children:v})}),...u},...w})}function In({className:e,day:t,modifiers:a,...r}){let s=da(),i=so.useRef(null);return so.useEffect(()=>{a.focused&&i.current?.focus()},[a.focused]),tt(h,{ref:i,variant:"ghost",size:"icon","data-day":t.date.toLocaleDateString(),"data-selected-single":a.selected&&!a.range_start&&!a.range_end&&!a.range_middle,"data-range-start":a.range_start,"data-range-end":a.range_end,"data-range-middle":a.range_middle,className:o("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",s.day,e),...r})}import{jsx as ct,jsxs as Ut}from"react/jsx-runtime";function ma({value:e,onChange:t,placeholder:a,mode:r,externalSearch:s,onExternalChange:i,onlyExternal:u=!1}){let[w,m]=Do(!1),[v,p]=Do(e),[T,L]=Do(e);Fn(()=>{u||L(e)},[e,u]);let F=()=>{u||t(v),L(v),s&&i&&i(v),m(!1)},A=()=>{p(T),m(!1)},k=()=>{let S=r==="single"?null:{from:null,to:null};p(S),u||t(S),L(S),s&&i&&i(S),m(!1)},O=()=>{let S=u?T:e;return S?r==="single"?$t(S,"PPP"):S.from&&S.to?`${$t(S.from,"MMM dd")} - ${$t(S.to,"MMM dd, yyyy")}`:S.from?`From ${$t(S.from,"MMM dd, yyyy")}`:S.to?`To ${$t(S.to,"MMM dd, yyyy")}`:a:a},H=S=>{p(r==="single"?S:S||{from:null,to:null})};return Ut(Et,{open:w,onOpenChange:m,children:[ct(Gt,{className:"h-8",asChild:!0,children:Ut(h,{variant:"outline",className:o("w-full justify-start text-left font-normal h-9",!O()&&"text-muted-foreground"),children:[ct(Bn,{className:"mr-2 h-4 w-4"}),O()]})}),Ut(jt,{className:"w-auto p-0",align:"start",children:[ct("div",{className:"p-3",children:ct(ca,{mode:r,selected:v,onSelect:H,numberOfMonths:r==="range"?2:1,className:"rounded-md border",...r==="range"&&{required:!0}})}),Ut("div",{className:"flex items-center justify-between p-3 border-t",children:[ct(h,{variant:"ghost",size:"sm",onClick:k,children:"Clear"}),Ut("div",{className:"flex gap-2",children:[ct(h,{variant:"outline",size:"sm",onClick:A,children:"Cancel"}),ct(h,{size:"sm",onClick:F,disabled:r==="range"&&(!v?.from||!v?.to),children:"Apply"})]})]})]})]})}import{Checkbox as pa}from"radix-ui";import{CheckIcon as Ln}from"lucide-react";import{jsx as Ro}from"react/jsx-runtime";function mt({className:e,...t}){return Ro(pa.Root,{"data-slot":"checkbox",className:o("peer border-input dark:bg-input/30 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground dark:data-[state=checked]:bg-primary data-[state=checked]:border-primary focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive size-4 shrink-0 rounded-[4px] border shadow-xs transition-shadow outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50",e),...t,children:Ro(pa.Indicator,{"data-slot":"checkbox-indicator",className:"flex items-center justify-center text-current transition-none",children:Ro(Ln,{className:"size-3.5"})})})}import{Fragment as jn,jsx as g,jsxs as P}from"react/jsx-runtime";var ba=[{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 Io({table:e,filters:t=[],globalFilter:a,onGlobalFilterChange:r,enableGlobalFilter:s=!0,onExport:i,onRefresh:u,loading:w=!1,enableColumnVisibility:m=!0,data:v,onClearSorting:p,onClearFilters:T,enableColumnPinning:L=!1,onExternalSearch:F,onCustomFilterChange:A,aggregations:k={},onAggregationChange:O}){let[H,S]=Ao({}),[J,C]=Ao({}),[_,De]=Ao({}),Te=()=>e.getAllLeafColumns().filter(n=>n.getCanHide?.()!==!1),ie=()=>e.getAllColumns().filter(n=>!e.getAllLeafColumns().includes(n)&&n.columns?.length&&n.columns.some(f=>f.getCanHide?.()!==!1)),Ue=()=>{let n=new Set(ie().flatMap(f=>f.columns?.filter(x=>x.getCanHide?.()!==!1).map(x=>x.id)||[]));return Te().filter(f=>!n.has(f.id))},Se=(n,f)=>f&&n.startsWith(`${f}.`)?n.replace(`${f}.`,"").split("_").map(E=>E.slice(1)).join(" "):n.split("_").map(x=>x.charAt(0).toUpperCase()+x.slice(1)).join(" "),Q=(n,f)=>{let x={...H,[n]:f};S(x)},We=(n,f)=>{let x={...J,[n]:f};C(x),A&&A(n,f),t.find(E=>E.key===n)?.externalSearch&&Q(n,f)},se=()=>{F&&F(H)},Pe=()=>{S({}),C({}),T(),F&&F({}),A&&Object.keys(J).forEach(n=>{A(n,"")})},ye=n=>t.find(x=>x.key===n)?.customFilter?J[n]??"":e.getColumn(n)?.getFilterValue(),ue=(n,f)=>{let x=t.find(E=>E.key===n);x?.customFilter?We(n,f):(e.getColumn(n)?.setFilterValue(f),x?.externalSearch&&Q(n,f))},qe=(n,f)=>{De(x=>({...x,[n]:f}))},Le=n=>{if(O){let f=k[n],x={enabled:!f?.enabled,functions:f?.functions||["sum","average"]};O(n,x)}},Je=(n,f)=>{if(O){let E=k[n]?.functions||[],te=E.includes(f)?E.filter(Lt=>Lt!==f):[...E,f];O(n,{enabled:te.length>0,functions:te})}},Oe=()=>{O&&Object.keys(k).forEach(n=>{let f=k[n];f&&O(n,{...f,enabled:!1,functions:[]})})},ge=Te().filter(n=>n.id==="select"||n.id==="serialNumber"?!1:n.columnDef.meta?.aggregatable?!0:e.getRowModel().rows.slice(0,5).some(E=>{let te=E.getValue(n.id);return typeof te=="number"||typeof te=="string"&&!isNaN(parseFloat(String(te)))||typeof te=="object"&&te!==null&&"props"in te})),fe=Object.values(k).some(n=>n?.enabled);return g("div",{className:"rounded-xl",children:g("div",{className:"px-2",children:g("div",{className:"flex flex-col gap-6",children:P("div",{className:"flex items-center justify-between",children:[g("div",{className:"flex items-center gap-3",children:t.length>0&&P("div",{className:"flex flex-wrap items-center gap-3",children:[g("div",{className:"flex items-center gap-2 text-sm font-medium text-muted-foreground",children:g(ga,{className:"size-4"})}),t.map(n=>!e.getColumn(n.key)&&!n.customFilter&&!n.externalSearch?null:g("div",{className:o("relative min-w-[150px]",n.width),children:n.type==="select"?P(Et,{open:_[n.key],onOpenChange:x=>qe(n.key,x),children:[g(Gt,{asChild:!0,children:P("div",{className:"relative w-full",children:[n.icon&&g(n.icon,{className:"absolute -translate-y-1/2 size-4 left-3 top-1/2 text-muted-foreground pointer-events-none z-10"}),P(h,{variant:"outline",role:"combobox","aria-expanded":_[n.key],className:o("h-8 sm:h-8 rounded-lg w-full justify-between font-normal",!ye(n.key)&&"text-muted-foreground"),children:[g("span",{className:o("truncate",n.icon&&"pl-6"),children:ye(n.key)?n.options?.find(x=>x.value===ye(n.key))?.label:n.placeholder}),g(Mo,{className:"ml-2 opacity-50 size-4 shrink-0"})]})]})}),g(jt,{className:"w-[--radix-popover-trigger-width] p-0 rounded-lg",children:P(wo,{className:"rounded-lg",children:[g(No,{placeholder:`Search ${n.placeholder?.toLowerCase()}...`}),P(To,{children:[g(So,{children:"No option found."}),P(Po,{children:[P(no,{value:"all",onSelect:()=>{ue(n.key,""),qe(n.key,!1)},className:"flex items-center cursor-pointer",children:[g(fa,{className:o("mr-2 size-4 shrink-0",ye(n.key)?"opacity-0":"opacity-100")}),g("span",{children:"All"})]}),n.options?.map(x=>P(no,{value:x.label,onSelect:()=>{ue(n.key,x.value),qe(n.key,!1)},className:"flex items-center cursor-pointer",children:[g(fa,{className:o("mr-2 size-4 shrink-0",ye(n.key)===x.value?"opacity-100":"opacity-0")}),g("span",{children:x.label})]},x.label))]})]})]})})]}):n.type==="date"?g(ma,{value:ye(n.key),onChange:x=>{n.onlyExternal||ue(n.key,x)},placeholder:n.placeholder,mode:n.dateMode||"single",externalSearch:n.externalSearch,onlyExternal:n.onlyExternal,onExternalChange:x=>Q(n.key,x)}):P("div",{className:"relative",children:[n.icon&&g(n.icon,{className:"absolute -translate-y-1/2 size-4 left-3 top-1/2 text-muted-foreground"}),g(wt,{placeholder:n.placeholder,value:ye(n.key)??"",onChange:x=>{ue(n.key,x.target.value)},className:o("h-8 rounded-lg",n.icon&&"pl-9"),type:n.type==="number"?"number":"text"})]})},n.key)),(t.some(n=>n.externalSearch)||t.some(n=>n.customFilter))&&P(h,{variant:"default",size:"sm",onClick:se,className:"rounded-lg h-7",children:[g(ua,{className:"size-4"}),t.find(n=>n.externalSearch||n.customFilter)?.searchButtonText||"Search"]})]})}),P("div",{className:"flex items-center gap-2",children:[s&&P("div",{className:"relative",children:[g(ua,{className:"absolute -translate-y-1/2 size-4 left-3 top-1/2 text-muted-foreground"}),g(wt,{placeholder:"Global search...",value:a??"",onChange:n=>r(n.target.value),className:"pl-9 h-8 max-w-max"})]}),ge.length>0&&O&&P(ze,{children:[g(Ae,{asChild:!0,children:P(h,{variant:"outline",size:"sm",className:o("rounded-lg gap-1",fe&&"bg-primary/10 dark:bg-primary/10 border-primary/20 dark:border-primary/20"),children:[g(zo,{className:"size-4"}),g("span",{children:"Aggregations"}),g(Mo,{className:"opacity-50 size-4"})]})}),P(Ie,{align:"end",className:"w-64 rounded-lg max-h-[500px] overflow-y-auto",children:[P(ce,{className:"flex items-center justify-between px-4 py-2",children:[g("span",{className:"text-sm font-medium",children:"Column Aggregations"}),fe&&g(h,{variant:"ghost",size:"sm",onClick:Oe,className:"h-6 px-2 text-xs",children:"Clear All"})]}),g(ve,{}),ge.map(n=>{let f=k[n.id],x=f?.enabled;return P(ra,{children:[g(ia,{className:"text-sm",children:P("div",{className:"flex items-center w-full gap-2",children:[g(mt,{checked:x,onCheckedChange:()=>Le(n.id),className:"data-[state=checked]:bg-primary"}),g("span",{className:o("flex-1",x&&"font-medium text-primary"),children:Se(n.id)}),x&&P("div",{className:"flex items-center gap-1",children:[f?.functions?.slice(0,2).map(E=>g("div",{className:"w-2 h-2 rounded-full bg-primary",title:ba.find(te=>te.value===E)?.label},E)),f?.functions&&f.functions.length>2&&P("div",{className:"text-xs text-muted-foreground",children:["+",f.functions.length-2]})]})]})}),P(sa,{className:"w-48 rounded-lg",children:[g(ce,{className:"px-3 py-2 text-xs font-medium text-muted-foreground",children:"Select Functions"}),ba.map(E=>g(Ht,{checked:f?.functions?.includes(E.value)||!1,onCheckedChange:()=>Je(n.id,E.value),className:"py-2 text-sm",children:P("div",{className:"flex flex-col",children:[g("span",{children:E.label}),g("span",{className:"text-xs text-muted-foreground",children:E.description})]})},E.value))]})]},n.id)}),ge.length===0&&P("div",{className:"px-3 py-4 text-center",children:[g(zo,{className:"w-8 h-8 mx-auto mb-2 opacity-50 text-muted-foreground"}),g("p",{className:"text-sm text-muted-foreground",children:"No numeric columns available for aggregation"})]})]})]}),i&&P(h,{variant:"outline",size:"sm",onClick:()=>i(v),className:"rounded-lg",children:[g(_n,{className:"size-4"}),"Export"]}),m&&P(ze,{children:[g(Ae,{asChild:!0,className:"h-7",children:P(h,{variant:"outline",size:"sm",className:"gap-1 rounded-lg",children:[g("span",{children:"Columns"}),g(Mo,{className:"opacity-50 size-4"})]})}),P(Ie,{align:"end",className:"w-[220px] rounded-lg max-h-[400px] overflow-y-auto",children:[g(ce,{className:"px-4 py-2 text-sm font-medium",children:"Toggle Columns"}),g(ve,{}),Ue().length>0&&P(ko,{children:[g(ce,{className:"px-4 py-1.5 text-sm font-medium text-muted-foreground",children:"General"}),Ue().map(n=>g(Ht,{className:"text-sm",checked:n.getIsVisible(),onCheckedChange:f=>n.toggleVisibility(!!f),children:Se(n.id)},n.id))]}),ie().map(n=>P(ko,{children:[g(ve,{}),g(ce,{className:"px-4 py-1.5 text-sm font-medium text-muted-foreground",children:n.id}),n.columns?.filter(f=>f.getCanHide?.()!==!1).map(f=>g(Ht,{className:"text-sm",checked:f.getIsVisible(),onCheckedChange:x=>f.toggleVisibility(!!x),children:Se(f.id,n.id)},f.id))]},n.id))]})]}),P(ze,{children:[g(Ae,{asChild:!0,className:"h-7",children:g(h,{variant:"outline",size:"sm",className:"rounded-lg h-7",children:g(Vn,{className:"size-4"})})}),P(Ie,{align:"end",className:"w-[200px] rounded-lg",children:[g(ce,{children:"Table Settings"}),g(ve,{}),P(K,{onClick:p,children:[g(Hn,{className:"size-4"}),"Clear All Sorting"]}),P(K,{onClick:Pe,children:[g(ga,{className:"size-4"}),"Clear All Filters"]}),fe&&P(K,{onClick:Oe,children:[g(zo,{className:"size-4"}),"Clear Aggregations"]}),L&&P(jn,{children:[g(ve,{}),g(ce,{children:"Column Pinning"}),P(K,{onClick:()=>e.setColumnPinning({left:[],right:[]}),children:[g(En,{className:"size-4"}),"Reset All Pinning"]}),P(K,{onClick:()=>{let n=Te().filter(f=>f.getCanPin?.()!==!1).map(f=>f.id);e.setColumnPinning({left:[],right:n})},children:[g(Gn,{className:"-rotate-90 size-4"}),"Pin All Right"]})]})]})]}),u&&g(h,{variant:"outline",size:"sm",onClick:u,disabled:w,className:"rounded-lg",children:g(On,{className:o("h-4 w-4",w&&"animate-spin")})})]})]})})})})}import{Select as ke}from"radix-ui";import{CheckIcon as $n,ChevronDownIcon as va,ChevronUpIcon as Un}from"lucide-react";import{jsx as re,jsxs as Fo}from"react/jsx-runtime";function Tt({...e}){return re(ke.Root,{"data-slot":"select",...e})}function St({...e}){return re(ke.Value,{"data-slot":"select-value",...e})}function Pt({className:e,size:t="default",children:a,...r}){return Fo(ke.Trigger,{"data-slot":"select-trigger","data-size":t,className:o("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),...r,children:[a,re(ke.Icon,{asChild:!0,children:re(va,{className:"size-4 opacity-50"})})]})}function kt({className:e,children:t,position:a="popper",...r}){return re(ke.Portal,{children:Fo(ke.Content,{"data-slot":"select-content",className:o("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,...r,children:[re(Wn,{}),re(ke.Viewport,{className:o("p-1",a==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)] scroll-my-1"),children:t}),re(qn,{})]})})}function pt({className:e,children:t,...a}){return Fo(ke.Item,{"data-slot":"select-item",className:o("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:[re("span",{className:"absolute right-2 flex size-3.5 items-center justify-center",children:re(ke.ItemIndicator,{children:re($n,{className:"size-4"})})}),re(ke.ItemText,{children:t})]})}function Wn({className:e,...t}){return re(ke.ScrollUpButton,{"data-slot":"select-scroll-up-button",className:o("flex cursor-default items-center justify-center py-1",e),...t,children:re(Un,{className:"size-4"})})}function qn({className:e,...t}){return re(ke.ScrollDownButton,{"data-slot":"select-scroll-down-button",className:o("flex cursor-default items-center justify-center py-1",e),...t,children:re(va,{className:"size-4"})})}import{jsx as he,jsxs as Dt}from"react/jsx-runtime";function Bo({table:e,config:t}){return t.enabled?he("div",{className:"rounded-xl",children:he("div",{children:Dt("div",{className:"flex items-center justify-between",children:[he("div",{className:"flex items-center gap-6 text-sm text-muted-foreground",children:t.showInfo!==!1&&Dt("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"]})}),Dt("div",{className:"flex items-center gap-4",children:[t.pageSizeOptions&&Dt("div",{className:"flex items-center gap-2",children:[he("span",{className:"text-sm font-medium",children:"Rows per page:"}),Dt(Tt,{value:`${e.getState().pagination.pageSize}`,onValueChange:a=>e.setPageSize(Number(a)),children:[he(Pt,{className:"h-9 w-[70px] rounded-lg",children:he(St,{})}),he(kt,{side:"top",className:"rounded-lg",children:t.pageSizeOptions.map(a=>he(pt,{value:`${a}`,children:a},a))})]})]}),Dt("div",{className:"flex items-center gap-2",children:[he(h,{variant:"outline",size:"sm",onClick:()=>e.setPageIndex(0),disabled:!e.getCanPreviousPage(),className:"rounded-lg",children:"First"}),he(h,{variant:"outline",size:"sm",onClick:()=>e.previousPage(),disabled:!e.getCanPreviousPage(),className:"rounded-lg",children:"Previous"}),t.showPageNumbers&&he("div",{className:"flex items-center gap-1",children:Array.from({length:Math.min(5,e.getPageCount())},(a,r)=>{let s=e.getState().pagination.pageIndex,i=s+r;return i<1||i>e.getPageCount()?null:he(h,{variant:i===s+1?"default":"outline",size:"sm",className:"size-8 p-0 rounded-lg",onClick:()=>e.setPageIndex(i-1),children:i},i)})}),he(h,{variant:"outline",size:"sm",onClick:()=>e.nextPage(),disabled:!e.getCanNextPage(),className:"rounded-lg",children:"Next"}),he(h,{variant:"outline",size:"sm",onClick:()=>e.setPageIndex(e.getPageCount()-1),disabled:!e.getCanNextPage(),className:"rounded-lg",children:"Last"})]})]})]})})}):null}import{Toggle as Jn}from"radix-ui";import{cva as Xn}from"class-variance-authority";import{jsx as Yn}from"react/jsx-runtime";var Kn=Xn("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 ha({className:e,variant:t,size:a,noBg:r,...s}){return Yn(Jn.Root,{"data-slot":"toggle",className:o(Kn({className:e,variant:t,size:a,bg:r?"disabled":"enabled"})),...s})}import{useCallback as lo,useEffect as co,useMemo as mo,useRef as Wt,useState as we}from"react";import{Fragment as wa,jsx as c,jsxs as G}from"react/jsx-runtime";var Ca={sum:e=>e.reduce((t,a)=>t+a,0),average:e=>e.length>0?e.reduce((t,a)=>t+a,0)/e.length:0,min:e=>e.length>0?Math.min(...e):0,max:e=>e.length>0?Math.max(...e):0,count:e=>e.length,unique:e=>new Set(e).size,median:e=>{if(e.length===0)return 0;let t=[...e].sort((r,s)=>r-s),a=Math.floor(t.length/2);return t.length%2===0?(t[a-1]+t[a])/2:t[a]}};function Na({data:e,columns:t,filters:a=[],pagination:r={enabled:!1},settings:s={},header:i,footer:u,className:w="",maxHeight:m="100%",loading:v=!1,error:p,emptyMessage:T="No data available",onRowSelectionChange:L,onExport:F,onRefresh:A,onTableReady:k,children:O,isRowDisabled:H,isRowSelectable:S,onExternalSearch:J,aggregations:C={},onAggregationChange:_,rowClassName:De}){let[Te,ie]=we([]),[Ue,Se]=we([]),[Q,We]=we({}),[se,Pe]=we({}),[ye,ue]=we(""),[qe,Le]=we([]),[Je,Oe]=we(s.enableColumnPinning?{left:[],right:[]}:{}),[rt,ge]=we({}),fe=Wt(null),n=Wt(null),f=Wt(null),x=Wt(null),[E,te]=we(0),[Lt,Z]=we(0),[Yt,bo]=we(0),[ft,Zt]=we(0),bt=Wt(null),[Ot,Qt]=we(!1),{enableSorting:_t=!0,enableFiltering:vt=!0,enableGlobalFilter:ht=!0,enableColumnVisibility:Vt=!0,enableRowSelection:le=!0,stickyHeader:Xo=!0,toolbar:M=!1,disableHeaderCheckbox:V=!1,toolbarPosition:D="default",showSerialNumbers:j=!0,fixedCheckboxColumn:oe=!0,striped:_e=!0,hoverable:it=!0,compact:Re=!0,bordered:Ko=!0,fullHeight:an=!1,enableColumnResizing:Yo=!1,enableColumnPinning:de=!0,hideHeader:nn=!1,selectionMode:Xe="multiple",showCheckBox:rn=!0,checkboxColumnPosition:Zo=0}=s;co(()=>{let b=()=>{bt.current&&Qt(bt.current.scrollTop>0)},y=bt.current;if(y)return y.addEventListener("scroll",b),()=>y.removeEventListener("scroll",b)},[]),co(()=>{let b=()=>{fe.current&&te(fe.current.offsetHeight+16),n.current&&Z(n.current.offsetHeight+16),f.current&&bo(f.current.offsetHeight+16),x.current&&Zt(x.current.offsetHeight+16)};b();let y=new ResizeObserver(()=>{setTimeout(b,50)});return fe.current&&y.observe(fe.current),n.current&&y.observe(n.current),f.current&&y.observe(f.current),x.current&&y.observe(x.current),()=>{y.disconnect()}},[M,i,D]);let sn=(b,y)=>y.split(".").reduce((d,l)=>d&&d[l],b),vo=mo(()=>Object.keys(rt).length===0?e:e.filter(b=>Object.entries(rt).every(([y,d])=>{if(!d||d==="")return!0;let l=sn(b,y);return typeof d=="string"?String(l).toLowerCase().includes(d.toLowerCase()):l===d})),[e,rt]),ln=lo((b,y)=>{ge(d=>{let l={...d};return y===""||y===null||y===void 0?delete l[b]:l[b]=y,l})},[]),xt=mo(()=>{let b=[...t],y=N=>N.map(R=>{if(R.id==="select"||R.id==="serialNumber")return R;let B={...R,enablePinning:!0};return R.columns&&(B.columns=y(R.columns)),B}),d=y(b),l={id:"select",header:({table:N})=>{if(Xe==="single")return null;let R=N.getRowModel().rows.filter(X=>!H?.(X.original)&&(S?S(X.original):!0)),B=R.length>0&&R.every(X=>X.getIsSelected()),$=R.some(X=>X.getIsSelected());return c(mt,{checked:B||$&&"indeterminate",onCheckedChange:X=>{R.forEach(ae=>ae.toggleSelected(!!X))},disabled:V||R.length===0,"aria-label":"Select all selectable rows"})},cell:({row:N})=>{let R=H?H(N.original):!1,B=S?S(N.original):!0;return c("div",{className:o("flex justify-center items-center",R&&"opacity-50"),children:Xe==="multiple"?c(mt,{checked:N.getIsSelected(),onCheckedChange:$=>B&&N.toggleSelected(!!$),"aria-label":"Select row",disabled:R||!B}):rn?c("input",{type:"radio",checked:N.getIsSelected(),onChange:()=>B&&N.toggleSelected(!0),disabled:R||!B,className:"border-primary rounded-full focus:ring-primary w-4 h-4 text-primary"}):null})},enableSorting:!1,enableHiding:!1,enablePinning:!0,headerAlign:"center",size:Xe==="multiple"?40:30};if(le){let N=Zo;N<0&&(N=d.length+N+1),N=Math.max(0,Math.min(N,d.length)),d.splice(N,0,l)}if(j){let N={id:"serialNumber",header:"No.",cell:({row:R})=>c("div",{className:"font-medium text-muted-foreground text-center",children:R.index+1}),enableSorting:!0,enableHiding:!1,enablePinning:!0,size:60,headerAlign:"center"};d.unshift(N)}return d},[t,j,le,oe,H,S,Xe,Zo]),I=or({data:vo,columns:xt,onSortingChange:_t?ie:void 0,onColumnFiltersChange:vt?Se:void 0,onGlobalFilterChange:ht?ue:void 0,getCoreRowModel:Zn(),getPaginationRowModel:r.enabled?er():void 0,getSortedRowModel:_t?tr():void 0,getFilteredRowModel:vt?Qn():void 0,onColumnVisibilityChange:Vt?We:void 0,onRowSelectionChange:le?Pe:void 0,onColumnOrderChange:Le,onColumnPinningChange:de?Oe:void 0,state:{sorting:_t?Te:void 0,columnFilters:vt?Ue:void 0,columnVisibility:Vt?Q:void 0,rowSelection:le?se:{},globalFilter:ye,columnOrder:qe,columnPinning:de?Je:{}},initialState:{pagination:r.enabled?{pageSize:r.pageSize||10}:void 0,columnPinning:de?{left:[...j?["serialNumber"]:[],...le?["select"]:[]],right:[]}:void 0},enableRowSelection:le,enableColumnResizing:Yo,enableColumnPinning:de,columnResizeMode:"onChange"}),Qo=mo(()=>{if(!C||Object.keys(C).length===0)return{};let b={},y=I.getFilteredRowModel().rows;return Object.entries(C).forEach(([d,l])=>{if(!l?.enabled)return;let N=y.map(B=>{if(l.accessor)return l.accessor(B.original);{let $=B.getValue(d);return typeof $=="number"?$:parseFloat(String($))||0}}).filter(B=>B!==null&&!isNaN(B)),R={};l.functions?.forEach(B=>{Ca[B]&&(R[B]=Ca[B](N))}),Object.keys(R).length>0&&(b[d]=R)}),b},[vo,C,I?.getFilteredRowModel().rows]);co(()=>{if(le&&L){let b=I.getFilteredSelectedRowModel().rows.filter(y=>!H?.(y.original)&&(S?S(y.original):!0)).map(y=>y.original);L(b)}},[se,le,L,I,H,S]);let dn=lo(b=>{Xe==="single"?(I.resetRowSelection(),b.toggleSelected(!0)):b.toggleSelected()},[Xe,I]);co(()=>{k&&k(I)},[I,k]);let cn=lo(()=>{ie([])},[]),mn=lo(()=>{Se([]),ue("")},[]),ea=(b,y)=>{if(!de)return;let d=[...j?["serialNumber"]:[],...le&&oe?["select"]:[]],l={left:[...(Je.left??[]).filter(N=>d.includes(N))],right:[...Je.right??[]]};y===!1?(l.left=l.left.filter(N=>N!==b),l.right=l.right.filter(N=>N!==b)):y==="right"?(l.left=l.left.filter(N=>N!==b),l.right.includes(b)||l.right.push(b)):y==="left"&&(l.right=l.right.filter(N=>N!==b),!l.left.includes(b)&&!d.includes(b)&&l.left.push(b)),I.setColumnPinning(l)},pn=()=>{let b=Object.keys(Qo).length>0,y=I.getHeaderGroups()[0]?.headers.some(l=>l.column.columnDef.customFooter),d=j&&I.getFilteredRowModel().rows.length>0&&(b||y);return!b&&!y&&!d?null:c(Co,{className:"bottom-0 z-20 sticky bg-sidebar border-t",children:c(Ve,{className:"bg-sidebar hover:bg-transparent",children:I.getHeaderGroups()[0]?.headers.map((l,N)=>{let R=l.column.id,B=Qo[R],$=de&&(l.column.getIsPinned()==="left"||l.column.id==="serialNumber"||l.column.id==="select"&&le),X=de&&l.column.getIsPinned()==="right",ae=l.column.id==="serialNumber",Ke=l.column.id==="select",ne=l.column.columnDef.customFooter;return B||ne||ae&&d?c(He,{className:o("px-2 py-2 border-r font-semibold text-sm",Re&&"py-1",$&&"sticky left-0 z-30 bg-sidebar/95",X&&"sticky right-0 z-30 bg-sidebar/95",(ae||Ke)&&"sticky left-0 z-30 bg-sidebar/95",ne?.className),style:{width:l.getSize()!==150?l.getSize():"auto",minWidth:l.getSize()!==150?l.getSize():"auto",...$&&{left:ae?0:Ke?j&&I.getColumn("serialNumber")?.getSize()||0:eo(l.column)},...X&&{right:to(l.column)},...ae&&{left:0}},children:(()=>{if(ne?.content){let st=typeof ne.content=="function"?ne.content(I):ne.content;return c("div",{className:o("w-full h-full",ne.align==="center"&&"text-center",ne.align==="right"&&"text-right",ne.align==="left"&&"text-left"),children:st})}return B?c("div",{className:"flex flex-col gap-0.5 text-xs",children:Object.entries(B).map(([st,vn])=>G("div",{className:"flex justify-between items-center text-muted-foreground",children:[G("span",{className:"text-xs capitalize",children:[st,":"]}),c("span",{className:"font-medium text-foreground",children:un(st,vn)})]},st))}):ae&&d?G("div",{className:"text-muted-foreground text-xs text-center",children:["Total: ",I.getFilteredRowModel().rows.length]}):null})()},`agg-${l.id}`):c(He,{className:o("px-0 py-0 border-r",Re&&"py-0",$&&"sticky left-0 z-30 bg-sidebar/95",X&&"sticky right-0 z-30 bg-sidebar/95",(ae||Ke)&&"sticky left-0 z-30 bg-sidebar/95"),style:{width:l.getSize()!==150?l.getSize():"auto",minWidth:l.getSize()!==150?l.getSize():"auto",...$&&{left:ae?0:Ke?j&&I.getColumn("serialNumber")?.getSize()||0:eo(l.column)},...X&&{right:to(l.column)},...ae&&{left:0}}},`agg-${l.id}`)})})})},un=(b,y)=>typeof y=="number"?b==="count"||b==="unique"?y.toLocaleString():y.toLocaleString(void 0,{minimumFractionDigits:2,maximumFractionDigits:2}):y,gn=()=>I.getHeaderGroups().map((b,y)=>c(Ve,{className:"hover:bg-transparent",children:b.headers.map((d,l)=>{let N=d.depth===0&&d.colSpan>1,R=de&&(d.column.getIsPinned()==="left"||d.column.id==="serialNumber"||d.column.id==="select"&&le),B=de&&d.column.getIsPinned()==="right",$=d.column.getCanSort(),X=de&&d.column.columnDef.enablePinning!==!1,ae=d.column.id==="serialNumber",Ke=d.column.id==="select",xo=ae||Ke&&oe,ne=d.column.columnDef.headerAlign||"left",oo=C&&C[d.column.id]?.enabled,st={left:"justify-start",center:"justify-center",right:"justify-end"}[ne];return G(aa,{colSpan:d.colSpan,className:o("group bg-sidebar px-0 font-semibold text-foreground",!Re&&"py-2",Ko&&l<b.headers.length-1&&"border-r","relative",R&&"sticky left-0 z-25 bg-sidebar",B&&"sticky right-0 z-25 bg-sidebar",(ae||Ke)&&"sticky left-0 z-25 bg-sidebar",N?"text-center":"text-left",oo&&"border-b-2 border-primary/30"),style:{width:d.getSize()!==150?d.getSize():"auto",minWidth:d.getSize()!==150?d.getSize():"auto",...R&&{left:ae?0:Ke?j&&I.getColumn("serialNumber")?.getSize()||0:eo(d.column)},...B&&{right:to(d.column)},...ae&&{left:0}},children:[N?G("div",{className:"flex justify-center items-center",children:[Lo(d.column.columnDef.header,d.getContext()),oo&&c(ya,{className:"ml-1 w-3 h-3 text-primary"})]}):G("div",{className:o("relative flex items-center px-2 w-full",st),children:[G("div",{className:"flex items-center gap-1",children:[oo&&c(ya,{className:"mr-1 w-3 h-3 text-primary"}),$&&ne==="right"&&c("span",{className:"order-2 ml-1",children:d.column.getIsSorted()&&{asc:c(Oo,{className:"w-4 h-4"}),desc:c(_o,{className:"w-4 h-4"})}[d.column.getIsSorted()]}),d.isPlaceholder?null:Lo(d.column.columnDef.header,d.getContext()),$&&ne!=="right"&&d.column.getIsSorted()&&c("span",{className:"order-2 ml-1",children:d.column.getIsSorted()&&{asc:c(Oo,{className:"w-4 h-4"}),desc:c(_o,{className:"w-4 h-4"})}[d.column.getIsSorted()]})]}),($||X&&!xo)&&G(ze,{children:[c(Ae,{asChild:!0,className:o("absolute",ne==="left"&&"right-1",ne==="center"&&"right-1",ne==="right"&&"left-1"),children:c(ha,{variant:"default",size:"sm",noBg:!0,tabIndex:-1,className:"opacity-0 data-[state=open]:opacity-100 hover:opacity-100 group-hover:opacity-70",children:c(nr,{className:"w-4 h-4"})})}),G(Ie,{align:"end",className:"w-48",children:[$&&G(wa,{children:[c(ce,{children:"Sorting"}),G(K,{onClick:()=>d.column.toggleSorting(!1),children:[c(Oo,{className:"mr-2 w-4 h-4"}),"Sort Ascending"]}),G(K,{onClick:()=>d.column.toggleSorting(!0),children:[c(_o,{className:"mr-2 w-4 h-4"}),"Sort Descending"]}),G(K,{onClick:()=>d.column.clearSorting(),disabled:!d.column.getIsSorted(),children:[c(ar,{className:"mr-2 w-4 h-4"}),"Clear Sort"]}),c(ve,{})]}),X&&!xo&&G(wa,{children:[c(ce,{children:"Pin Column"}),G(K,{onClick:()=>ea(d.column.id,"right"),disabled:d.column.getIsPinned()==="right",children:[c(rr,{}),"Pin Right"]}),G(K,{onClick:()=>ea(d.column.id,!1),disabled:!d.column.getIsPinned(),children:[c(ir,{}),"Unpin"]})]})]})]})]}),Yo&&d.column.getCanResize()&&!N&&d.colSpan===1&&c("div",{className:"top-0 right-0 absolute hover:bg-primary opacity-0 hover:opacity-100 bg-border w-1 h-full transition-opacity cursor-col-resize",onMouseDown:d.getResizeHandler()})]},d.id)})},b.id)),eo=b=>{if(!de)return;let y=0,d=I.getLeftHeaderGroups()[0]?.headers||[],l=[...j?["serialNumber"]:[],...le?["select"]:[]];for(let N of d){if(N.id===b.id)break;if(l.includes(N.id)){let R=I.getColumn(N.id);R&&(y+=R.getSize())}}return y},to=b=>{if(!de)return;let y=I.getState().columnPinning.right||[],d=y.indexOf(b.id);if(d===-1)return;let l=0;for(let N=d+1;N<y.length;N++){let R=I.getColumn(y[N]);R&&(l+=R.getSize())}return l};if(p)return c(Ee,{className:"shadow-sm rounded-xl w-full",children:c(Ge,{className:"flex justify-center items-center",children:G("div",{className:"text-center",children:[c("div",{className:"mb-3 text-red-500 text-2xl",children:"\u26A0\uFE0F"}),c("p",{className:"mb-4 text-muted-foreground text-sm",children:p}),A&&G(h,{variant:"outline",size:"sm",onClick:A,className:"rounded-lg",children:[c(xa,{className:"mr-2 w-4 h-4"}),"Try Again"]})]})})});let fn=b=>b&&typeof b=="object"&&"content"in b,Me=mo(()=>i?fn(i)?{content:i.content,align:i.align||"left",className:i.className||"",sticky:i.sticky!==void 0?i.sticky:!0,showOnEmpty:i.showOnEmpty!==void 0?i.showOnEmpty:!0}:{content:i,align:"left",className:"",sticky:!0,showOnEmpty:!0}:null,[i]),ho=()=>M?c(Io,{table:I,filters:a,globalFilter:ye,onGlobalFilterChange:ue,enableGlobalFilter:ht,onExport:F,onRefresh:A,loading:v,enableColumnVisibility:Vt,enableColumnPinning:de,data:vo,onClearSorting:cn,onClearFilters:mn,onExternalSearch:J,onCustomFilterChange:ln,aggregations:C,onAggregationChange:_}):null,bn=()=>{let b=0;return D==="above-header"&&(b+=Lt),Me&&(b+=ft),D==="below-header"&&(b+=Yt),b};return c(lt,{children:G("div",{className:o("flex flex-col space-y-2 w-full h-full",w),children:[M&&D==="default"&&c("div",{ref:fe,className:"z-40 relative",children:ho()}),c(Ee,{className:o("shadow-sm py-0 overflow-hidden",an&&"flex-1"),children:c(Ge,{className:"p-0 h-full",children:G("div",{className:"relative flex flex-col justify-between h-full",children:[v&&c("div",{className:"z-50 absolute inset-0 flex justify-center items-center bg-background/80 backdrop-blur-sm rounded-xl",children:G("div",{className:"flex items-center gap-3 bg-background/90 shadow-sm px-4 py-3 rounded-lg",children:[c(xa,{className:"size-5 text-primary animate-spin"}),c("span",{className:"font-medium text-muted-foreground text-sm",children:"Loading..."})]})}),c("div",{ref:bt,className:o("relative border-b rounded-t-xl overflow-auto",I.getRowModel().rows?.length===0&&"h-full"),style:{maxHeight:m},children:G(yo,{className:o("relative w-full border-collapse",I.getRowModel().rows?.length===0&&"h-full"),children:[M&&D==="above-header"&&c("thead",{className:"top-0 z-40 sticky bg-sidebar border-b",children:c(Ve,{className:"hover:bg-transparent",children:c(He,{colSpan:xt.length,className:"bg-sidebar shadow-sm p-2 border-b",children:c("div",{ref:n,children:ho()})})})}),Me&&(Me.showOnEmpty||I.getRowModel().rows?.length>0)&&c("thead",{className:o("sticky bg-sidebar border-b",Ot&&"shadow-sm"),style:{top:D==="above-header"?`${Lt}px`:"0px",zIndex:35},children:c(Ve,{className:"hover:bg-transparent",children:c(He,{colSpan:xt.length,className:o("bg-sidebar p-2 font-semibold text-foreground",Re?"py-2":"py-4",Me.className),children:c("div",{ref:x,className:o("flex items-center w-full",Me.align==="center"&&"justify-center",Me.align==="right"&&"justify-end",Me.align==="left"&&"justify-start"),children:typeof Me.content=="string"?c("span",{className:"font-bold text-foreground text-lg tracking-tight",children:Me.content}):Me.content})})})}),M&&D==="below-header"&&c("thead",{className:o("sticky bg-sidebar border-b",Ot&&"shadow-sm"),style:{top:Me?`${ft}px`:"0px",zIndex:35},children:c(Ve,{className:"hover:bg-transparent",children:c(He,{colSpan:xt.length,className:"bg-sidebar p-2",children:c("div",{ref:f,children:ho()})})})}),!nn&&c(ta,{className:o("sticky bg-sidebar",Ot&&"shadow-sm"),style:{top:`${bn()}px`,zIndex:30},children:gn()}),c(oa,{children:I.getRowModel().rows?.length?I.getRowModel().rows.map((b,y)=>{let d=De?De(b):"";return c(Ve,{"data-index":y,"data-state":b.getIsSelected()&&"selected",className:o(it&&"hover:bg-muted/50",_e&&y%2===0&&"bg-muted/20",b.getIsSelected()&&"bg-muted","border-b last:border-b-0",Xe==="single"&&"cursor-pointer",d),onClick:()=>{Xe==="single"&&dn(b)},children:b.getVisibleCells().map((l,N)=>{let R=de&&(l.column.getIsPinned()==="left"||l.column.id==="serialNumber"||l.column.id==="select"&&le),B=de&&l.column.getIsPinned()==="right",$=l.column.id==="serialNumber",X=l.column.id==="select",ae=$||X&&oe;return c(He,{className:o(Re?"py-2":"py-4",Ko&&N<b.getVisibleCells().length&&"border-r",R&&"sticky left-0 z-20 bg-sidebar/95",B&&"sticky right-0 z-20 bg-sidebar/95",$&&"sticky left-0 z-20 bg-sidebar/95","p-1"),style:{width:l.column.getSize()!==150?l.column.getSize():"auto",minWidth:l.column.getSize()!==150?l.column.getSize():"auto",...R&&{left:$?0:X?j&&I.getColumn("serialNumber")?.getSize()||0:eo(l.column)},...B&&{right:to(l.column)},...$&&{left:0}},children:Lo(l.column.columnDef.cell,l.getContext())},l.id)})},b.id)}):c(Ve,{children:c(He,{colSpan:xt.length,className:"border-0 h-32 text-center",children:G("div",{className:"flex flex-col items-center gap-3",children:[c("div",{className:"text-muted-foreground text-6xl",children:"\u{1F4CB}"}),c("p",{className:"font-medium text-muted-foreground",children:T})]})})})}),pn()]})}),u&&c("div",{className:"bottom-0 z-10 sticky bg-sidebar w-full",style:{width:"100%",minWidth:"fit-content"},children:c(yo,{children:c(Co,{children:c(Ve,{className:"bg-sidebar",children:c(He,{colSpan:xt.length,className:"p-2",children:u})})})})})]})})}),c(Bo,{table:I,config:r}),O&&O(I)]})})}import{Separator as sr}from"radix-ui";import{jsx as lr}from"react/jsx-runtime";function qt({className:e,orientation:t="horizontal",decorative:a=!0,...r}){return lr(sr.Root,{"data-slot":"separator-root",decorative:a,orientation:t,className:o("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),...r})}import{Loader as dr,X as cr}from"lucide-react";import{AnimatePresence as mr,motion as pr}from"framer-motion";import*as ot from"react";import*as Ta from"react-dom";import{jsx as me,jsxs as Jt}from"react/jsx-runtime";function Sa({table:e,visible:t,container:a,children:r,className:s,...i}){let[u,w]=ot.useState(!1);ot.useLayoutEffect(()=>{w(!0)},[]),ot.useEffect(()=>{function p(T){T.key==="Escape"&&e&&e.toggleAllRowsSelected(!1)}return window.addEventListener("keydown",p),()=>window.removeEventListener("keydown",p)},[e]);let m=a??(u?globalThis.document?.body:null);if(!m||!e)return null;let v=t??e.getFilteredSelectedRowModel().rows.length>0;return Ta.createPortal(me(mr,{children:v&&me(pr.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:o("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",s),...i,children:me(lt,{children:r})})}),m)}function Pa({size:e="sm",tooltip:t,isPending:a,disabled:r,className:s,children:i,...u}){let w=me(h,{variant:"secondary",size:e,className:o("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",s),disabled:r||a,...u,children:a?me(dr,{className:"animate-spin"}):i});return t?Jt(Ze,{children:[me(Qe,{asChild:!0,children:w}),me(et,{sideOffset:8,className:"rounded-lg border font-semibold text-foreground bg-secondary [&>span]:hidden",children:me("p",{children:t})})]}):w}function ka({table:e}){let t=ot.useCallback(()=>{e&&e.toggleAllRowsSelected(!1)},[e]);return e?Jt("div",{className:"flex h-8 items-center rounded-lg border bg-muted/50 pr-1 pl-3",children:[Jt("span",{className:"whitespace-nowrap text-sm font-medium",children:[e.getFilteredSelectedRowModel().rows.length," selected"]}),me(qt,{orientation:"vertical",className:"mr-2 ml-3 data-[orientation=vertical]:h-4"}),Jt(Ze,{children:[me(Qe,{asChild:!0,children:me(h,{variant:"ghost",size:"icon",className:"size-6 rounded-md",onClick:t,children:me(cr,{className:"size-3.5"})})}),Jt(et,{sideOffset:10,className:"flex items-center gap-2 rounded-lg border px-3 py-2 font-semibold text-foregroun bg-secondary [&>span]:hidden",children:[me("p",{children:"Clear selection"}),me("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:me("abbr",{title:"Escape",className:"no-underline",children:"Esc"})})]})]})]}):null}import{ArrowUpDown as _l,EyeOff as Vl}from"lucide-react";import{jsx as $l,jsxs as Ul}from"react/jsx-runtime";import{ChevronDown as Jl,Eye as Xl}from"lucide-react";import{jsx as Ql,jsxs as ed}from"react/jsx-runtime";import{Slot as ad}from"radix-ui";import{cva as ur}from"class-variance-authority";import{jsx as ld}from"react/jsx-runtime";var id=ur("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"}});import{CheckIcon as xd,PlusCircleIcon as yd}from"lucide-react";import{Fragment as Td,jsx as wd,jsxs as Nd}from"react/jsx-runtime";import{useState as at,useEffect as Ra,useMemo as Ho,useCallback as Rt,useRef as Sr}from"react";import{Loader2 as Ma}from"lucide-react";import{Search as gr,Download as fr,RefreshCw as br,Filter as vr,ChevronDown as hr,Settings2 as xr}from"lucide-react";import{Fragment as yr,jsx as z,jsxs as ee}from"react/jsx-runtime";function Vo({fields:e,filters:t,globalFilter:a,onGlobalFilterChange:r,fieldFilters:s,onFieldFilterChange:i,sortField:u,sortDirection:w,onSortChange:m,selectedCount:v,totalCount:p,visibleCount:T,onExport:L,onRefresh:F,loading:A,onClearFilters:k,onClearSorting:O}){let H=e.filter(C=>C.sortable),S=Object.values(s).some(C=>C!=null&&C!=="")||a!=="",J=u!=="";return z("div",{className:"rounded-xl p-0.5",children:z("div",{className:"px-2",children:z("div",{className:"flex flex-col gap-6",children:ee("div",{className:"flex items-center justify-between",children:[z("div",{className:"flex items-center gap-3",children:t.length>0&&ee("div",{className:"flex items-center gap-3 flex-wrap",children:[z("div",{className:"flex items-center gap-2 text-sm font-medium text-muted-foreground",children:z(vr,{className:"h-4 w-4"})}),t.map(C=>z("div",{className:"relative min-w-[150px]",children:C.type==="select"?ee(Tt,{value:s[C.key]||"all",onValueChange:_=>i(C.key,_),children:[C.icon&&z(C.icon,{className:"size-4 absolute left-3 top-1/2 -translate-y-1/2 text-muted-foreground"}),z(Pt,{className:o("h-9 rounded-lg w-full",C.icon&&"pl-9"),children:z(St,{placeholder:C.placeholder||"Select..."})}),ee(kt,{className:"rounded-lg",children:[z(pt,{value:"all",children:"All"}),C.options?.map(_=>z(pt,{value:_.value,children:_.label},_.value))]})]}):ee("div",{className:"relative",children:[C.icon&&z(C.icon,{className:"size-4 absolute left-3 top-1/2 -translate-y-1/2 text-muted-foreground"}),z(wt,{type:C.type,placeholder:C.placeholder,value:s[C.key]||"",onChange:_=>i(C.key,_.target.value),className:o("h-9 rounded-lg",C.icon&&"pl-9")})]})},String(C.key)))]})}),ee("div",{className:"flex items-center gap-2",children:[ee("div",{className:"relative",children:[z(gr,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"}),z(wt,{placeholder:"Global search...",value:a,onChange:C=>r(C.target.value),className:"pl-9 h-9 rounded-lg max-w-max"})]}),H.length>0&&ee(ze,{children:[z(Ae,{asChild:!0,children:ee(h,{variant:"outline",size:"sm",className:"rounded-lg gap-1",children:[z("span",{children:"Sort"}),z(hr,{className:"h-4 w-4 opacity-50"})]})}),ee(Ie,{align:"end",className:"w-[200px] rounded-lg",children:[z(ce,{children:"Sort By"}),z(ve,{}),H.map(C=>ee("div",{children:[ee(K,{onClick:()=>m(C.key,"asc"),children:[C.label," (A-Z)"]}),ee(K,{onClick:()=>m(C.key,"desc"),children:[C.label," (Z-A)"]})]},String(C.key))),J&&ee(yr,{children:[z(ve,{}),z(K,{onClick:O,children:"Clear All Sorting"})]})]})]}),ee(ze,{children:[z(Ae,{asChild:!0,children:z(h,{variant:"outline",size:"sm",className:"rounded-lg",children:z(xr,{className:"h-4 w-4"})})}),ee(Ie,{align:"end",className:"w-[200px] rounded-lg",children:[z(ce,{children:"Table Settings"}),z(ve,{}),z(K,{onClick:O,children:"Clear All Sorting"}),z(K,{onClick:k,children:"Clear All Filters"})]})]}),L&&ee(h,{variant:"outline",size:"sm",onClick:L,className:"rounded-lg",children:[z(fr,{className:"mr-2 h-4 w-4"}),"Export"]}),F&&z(h,{variant:"outline",size:"sm",onClick:F,disabled:A,className:"rounded-lg",children:z(br,{className:o("h-4 w-4",A&&"animate-spin")})})]})]})})})})}import{ChevronLeft as Cr,ChevronRight as wr,ChevronsLeft as Nr,ChevronsRight as Tr}from"lucide-react";import{jsx as W,jsxs as Fe}from"react/jsx-runtime";function Da({currentPage:e,totalPages:t,pageSize:a,totalItems:r,onPageChange:s,onPageSizeChange:i,config:u}){if(!u.enabled)return null;let w=u.pageSizeOptions||[10,20,50,100],m=(e-1)*a+1,v=Math.min(e*a,r),p=e>1,T=e<t,L=()=>{let A=[],k=[];for(let O=Math.max(2,e-2);O<=Math.min(t-1,e+2);O++)A.push(O);return e-2>2?k.push(1,"..."):k.push(1),k.push(...A),e+2<t-1?k.push("...",t):t>1&&k.push(t),k};return W("div",{className:"rounded-xl",children:Fe("div",{className:"flex flex-col sm:flex-row items-center justify-between gap-4",children:[W("div",{className:"flex items-center gap-6 text-sm text-muted-foreground",children:u.showInfo!==!1&&Fe("span",{children:["Showing ",m," to ",v," of ",r," entries"]})}),Fe("div",{className:"flex flex-col sm:flex-row items-center gap-4",children:[w&&Fe("div",{className:"flex items-center gap-2",children:[W("span",{className:"text-sm font-medium whitespace-nowrap",children:"Page size:"}),Fe(Tt,{value:`${a}`,onValueChange:F=>i(Number(F)),children:[W(Pt,{className:"h-9 w-[70px] rounded-lg",children:W(St,{})}),W(kt,{side:"top",className:"rounded-lg",children:w.map(F=>W(pt,{value:`${F}`,children:F},F))})]})]}),Fe("div",{className:"flex items-center gap-2",children:[Fe(h,{variant:"outline",size:"sm",onClick:()=>s(1),disabled:!p,className:"hidden sm:flex rounded-lg",children:[W(Nr,{className:"h-4 w-4"}),W("span",{className:"sr-only",children:"Go to first page"})]}),Fe(h,{variant:"outline",size:"sm",onClick:()=>s(e-1),disabled:!p,className:"rounded-lg",children:[W(Cr,{className:"h-4 w-4 sm:mr-2"}),W("span",{className:"hidden sm:inline",children:"Previous"}),W("span",{className:"sr-only sm:hidden",children:"Go to previous page"})]}),u.showPageNumbers&&t>1&&W("div",{className:"hidden sm:flex items-center gap-1",children:L().map((F,A)=>{if(F==="...")return W("span",{className:"px-2 py-1 text-sm text-muted-foreground",children:"..."},`dots-${A}`);let k=F;return W(h,{variant:k===e?"default":"outline",size:"sm",className:"w-9 h-9 p-0 rounded-lg",onClick:()=>s(k),children:k},k)})}),Fe("div",{className:"sm:hidden flex items-center gap-2 px-3 py-1 text-sm font-medium bg-muted rounded-lg",children:[e," of ",t]}),Fe(h,{variant:"outline",size:"sm",onClick:()=>s(e+1),disabled:!T,className:"rounded-lg",children:[W("span",{className:"hidden sm:inline",children:"Next"}),W(wr,{className:"h-4 w-4 sm:ml-2"}),W("span",{className:"sr-only sm:hidden",children:"Go to next page"})]}),Fe(h,{variant:"outline",size:"sm",onClick:()=>s(t),disabled:!T,className:"hidden sm:flex rounded-lg",children:[W(Tr,{className:"h-4 w-4"}),W("span",{className:"sr-only",children:"Go to last page"})]})]})]})]})})}import{jsx as U,jsxs as ut}from"react/jsx-runtime";function za({data:e,template:t,fields:a=[],filters:r=[],pagination:s={enabled:!1},settings:i={},header:u,footer:w,className:m="",loading:v=!1,error:p,emptyMessage:T="No items found",emptyIcon:L,onSelectionChange:F,onExport:A,onRefresh:k,onTemplateReady:O,children:H}){let{enableSorting:S=!0,enableFiltering:J=!0,enableGlobalSearch:C=!0,enableSelection:_=!1,enableExport:De=!1,toolbar:Te=!0,selectionMode:ie="multiple",gridCols:Ue={default:3,sm:1,md:2,lg:3,xl:4,"2xl":6},gap:Se=4,aspectRatio:Q="auto",minCardWidth:We=350,maxCardWidth:se=350}=i,[Pe,ye]=at(""),[ue,qe]=at({}),[Le,Je]=at(""),[Oe,rt]=at("asc"),[ge,fe]=at(new Set),[n,f]=at(1),[x,E]=at(s.pageSize||12),[te,Lt]=at(Ue.default),Z=Ho(()=>{let M=[...e];if(C&&Pe){let V=a.filter(D=>D.searchable!==!1);M=M.filter(D=>V.some(j=>D[j.key]?.toString().toLowerCase().includes(Pe.toLowerCase())))}if(J&&Object.keys(ue).forEach(V=>{let D=ue[V];if(D!=null&&D!==""){let j=a.find(oe=>oe.key===V);j&&(M=M.filter(oe=>{let _e=oe[V];return j.type==="boolean"?_e===(D==="true"):j.type==="number"?_e===Number(D):_e?.toString().toLowerCase().includes(String(D).toLowerCase())}))}}),S&&Le){let V=a.find(D=>D.key===Le);V&&M.sort((D,j)=>{let oe=D[Le],_e=j[Le];if(V.type==="number")return Oe==="asc"?Number(oe)-Number(_e):Number(_e)-Number(oe);if(V.type==="date"){let it=new Date(oe),Re=new Date(_e);return Oe==="asc"?it.getTime()-Re.getTime():Re.getTime()-it.getTime()}else{let it=String(oe).toLowerCase(),Re=String(_e).toLowerCase();return Oe==="asc"?it.localeCompare(Re):Re.localeCompare(it)}})}return M},[e,Pe,ue,Le,Oe,a,C,J,S]),Yt=Ho(()=>{if(!s.enabled)return Z;let M=(n-1)*x,V=M+x;return Z.slice(M,V)},[Z,n,x,s.enabled]),bo=Math.ceil(Z.length/x),ft=Rt(M=>{_&&fe(V=>{let D=new Set(V);return ie==="single"?(D.clear(),D.add(M)):D.has(M)?D.delete(M):D.add(M),D})},[_,ie]),Zt=Rt(()=>{!_||ie==="single"||(ge.size===Z.length?fe(new Set):fe(new Set(Z.map((M,V)=>V))))},[_,ie,ge.size,Z.length]),bt=Rt((M,V)=>{qe(D=>({...D,[M]:V})),f(1)},[]),Ot=Rt((M,V)=>{Je(M),rt(V)},[]),Qt=Rt(()=>{ye(""),qe({}),f(1)},[]),_t=Rt(()=>{Je(""),rt("asc")},[]),vt=Ho(()=>({getSelectedItems:()=>Array.from(ge).map(M=>Z[M]),clearSelection:()=>fe(new Set),selectAll:Zt,getFilteredData:()=>Z,getTotalCount:()=>e.length,getVisibleCount:()=>Z.length,refresh:()=>k?.(),exportData:()=>A?.(Z)}),[ge,Z,e.length,Zt,k,A]),ht=Sr(null);ht.current=vt,Ra(()=>{O&&ht.current&&O(ht.current)},[]),Ra(()=>{if(_&&F){let M=Array.from(ge).map(V=>Z[V]);F(M)}},[ge]);let Vt=o("w-full","overflow-hidden",m),le=o("grid",`gap-${Se}`,"w-full","mx-auto","items-start"),Xo={gridTemplateColumns:te===0?"repeat(auto-fill, 1fr)":`repeat(auto-fill, minmax(clamp(${We}px, calc(100%/${te} - ${Se*4}px), ${se}px), 1fr))`,justifyItems:"center",alignItems:"stretch",gridAutoRows:"1fr",gridAutoFlow:"dense"};return p?U(Ee,{className:"w-full",children:U(Ge,{className:"flex items-center justify-center py-12",children:ut("div",{className:"text-center",children:[U("div",{className:"text-red-500 mb-3 text-2xl",children:"\u26A0\uFE0F"}),U("p",{className:"text-sm text-muted-foreground mb-4",children:p}),k&&ut(h,{variant:"outline",size:"sm",onClick:k,children:[U(Ma,{className:"mr-2 h-4 w-4"}),"Try Again"]})]})})}):ut("div",{className:o("w-full flex gap-2 flex-col h-full",Vt),children:[u&&U(Ee,{className:"shadow-sm border-0 py-0 text-xl font-bold",children:U(Ge,{className:"p-2",children:u})}),Te&&U(Vo,{fields:a,filters:r,globalFilter:Pe,onGlobalFilterChange:ye,fieldFilters:ue,onFieldFilterChange:bt,sortField:Le,sortDirection:Oe,onSortChange:Ot,selectedCount:ge.size,totalCount:e.length,visibleCount:Z.length,onExport:De?()=>A?.(Z):void 0,onRefresh:k,loading:v,onClearFilters:Qt,onClearSorting:_t}),U(Ee,{className:"border-0 overflow-auto shadow-none py-0 p-2 flex-1",children:U(Ge,{className:"px-0",children:ut("div",{className:"relative",children:[v&&U("div",{className:"absolute inset-0 bg-background/80 backdrop-blur-sm z-50 flex items-center justify-center rounded-lg",children:ut("div",{className:"flex items-center gap-3 bg-background/90 px-4 py-3 rounded-lg shadow-sm",children:[U(Ma,{className:"size-5 animate-spin text-primary"}),U("span",{className:"text-sm font-medium text-muted-foreground",children:"Loading..."})]})}),Yt.length>0?U("div",{className:o(le),style:Xo,children:Yt.map((M,V)=>{let D=s.enabled?(n-1)*x+V:V,j=ge.has(D);return ut("div",{className:o("relative h-full w-full flex flex-col","transition-all duration-200 overflow-hidden","rounded-2xl","border border-border/20 hover:border-border/50",Q==="square"?"aspect-square":"",Q==="video"?"aspect-video":"",_?"cursor-pointer":"",j?"ring-2 ring-primary":""),onClick:()=>_&&ft(D),children:[_&&ie==="multiple"&&U("div",{className:"absolute top-2 right-2 z-10",children:U(mt,{checked:j,onCheckedChange:()=>ft(D),className:"bg-background/80 backdrop-blur-sm",onClick:oe=>oe.stopPropagation()})}),t(M,V,j,()=>ft(D))]},D)})}):ut("div",{className:"flex flex-col gap-4 items-center justify-center py-12 text-center",children:[U("div",{className:"text-6xl",children:L||"\u{1F4CB}"}),U("p",{className:"text-lg font-medium text-muted-foreground mb-2",children:T}),(Pe||Object.values(ue).some(M=>M))&&U(h,{variant:"outline",onClick:Qt,children:"Clear Filters"})]})]})})}),s.enabled&&U("div",{className:"pb-1",children:U(Da,{currentPage:n,totalPages:bo,pageSize:x,totalItems:Z.length,onPageChange:f,onPageSizeChange:M=>{E(M),f(1)},config:s})}),w&&U("div",{className:"p-2 m-0.5",children:w}),H&&H(vt)]})}import{Loader as Pr,X as kr}from"lucide-react";import{AnimatePresence as Dr,motion as Rr}from"framer-motion";import*as nt from"react";import*as Aa from"react-dom";import{jsx as pe,jsxs as Xt}from"react/jsx-runtime";function Ia({controller:e,visible:t,container:a,children:r,className:s,...i}){let[u,w]=nt.useState(!1);nt.useLayoutEffect(()=>{w(!0)},[]),nt.useEffect(()=>{function T(L){L.key==="Escape"&&e&&e.clearSelection()}return window.addEventListener("keydown",T),()=>window.removeEventListener("keydown",T)},[e]);let m=a??(u?globalThis.document?.body:null);if(!m||!e)return null;let v=e.getSelectedItems(),p=t??v.length>0;return Aa.createPortal(pe(Dr,{children:p&&pe(Rr.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:o("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-8 ring-primary/5",s),...i,children:pe(lt,{children:r})})}),m)}function Fa({size:e="sm",variant:t="secondary",tooltip:a,isPending:r,disabled:s,className:i,children:u,onClick:w,...m}){let v=pe(h,{variant:t,size:e,className:o("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",i),disabled:s||r,onClick:w,...m,children:r?pe(Pr,{className:"animate-spin"}):u});return a?Xt(Ze,{children:[pe(Qe,{asChild:!0,children:v}),pe(et,{sideOffset:8,className:"rounded-lg border font-semibold text-foreground bg-secondary [&>span]:hidden",children:pe("p",{children:a})})]}):v}function Ba({controller:e}){let t=nt.useCallback(()=>{e&&e.clearSelection()},[e]);if(!e)return null;let a=e.getSelectedItems();return Xt("div",{className:"flex h-8 items-center rounded-lg border bg-muted/50 pr-1 pl-3",children:[Xt("span",{className:"whitespace-nowrap text-sm font-medium",children:[a.length," selected"]}),pe(qt,{orientation:"vertical",className:"mr-2 ml-3 data-[orientation=vertical]:h-4"}),Xt(Ze,{children:[pe(Qe,{asChild:!0,children:pe(h,{variant:"ghost",size:"icon",className:"size-6 rounded-md",onClick:t,children:pe(kr,{className:"size-3.5"})})}),Xt(et,{sideOffset:10,className:"flex items-center gap-2 rounded-lg border px-3 py-2 font-semibold text-foreground bg-secondary [&>span]:hidden",children:[pe("p",{children:"Clear selection"}),pe("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:pe("abbr",{title:"Escape",className:"no-underline",children:"Esc"})})]})]})]})}import{jsx as Ar}from"react/jsx-runtime";var Mr={none:"gap-0",tight:"gap-2",default:"gap-4",loose:"gap-6","extra-loose":"gap-8"},zr={none:"p-0",tight:"p-2",default:"p-4",loose:"p-6"},La=({children:e,className:t,spacing:a="tight",padding:r="none"})=>Ar("div",{className:o("flex flex-col h-full",Mr[a],zr[r],t),children:e});import{ArrowLeftIcon as Oa,ChevronRight as Ir}from"lucide-react";import{NavLink as Fr}from"react-router";import{jsx as xe,jsxs as gt}from"react/jsx-runtime";var _a=({className:e,columns:t=[],showBackButton:a=!0,meta:r={title:""}})=>{let s=()=>{if(!r.backAction||!a)return null;let p={variant:"secondary",size:"icon",className:"hover:bg-primary/20 inline-flex"};return r.backAction.href?xe(Fr,{to:r.backAction.href,children:gt(h,{...p,children:[xe(Oa,{className:"size-6"}),r.backAction.content]})}):gt(h,{...p,onClick:r.backAction.onClick,children:[xe(Oa,{className:"size-6"}),r.backAction.content]})},i=()=>!r.metadata||r.metadata.length===0?null:xe("div",{className:"flex gap-4",children:r.metadata.map((p,T)=>p.value&>("div",{className:"text-sm",children:[gt("span",{className:"text-muted-foreground",children:[p.label," "]}),xe("span",{children:p.value})]},T))}),u=()=>r.status?xe("span",{className:o("inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium",{success:"bg-green-100 text-green-800",warning:"bg-yellow-100 text-yellow-800",critical:"bg-red-100 text-red-800",info:"bg-blue-100 text-blue-800",default:"bg-gray-100 text-gray-800"}[r.status.color]),children:r.status.content}):null,w={content:gt("div",{className:"flex gap-2 items-center",children:[s(),gt("div",{className:"flex flex-col gap-2 w-max",children:[xe("h1",{className:"text-2xl font-bold tracking-tight",children:r.title}),u(),r.description&&xe("p",{className:"text-muted-foreground",children:r.description}),i(),r.breadcrumbs&&r.breadcrumbs.length>0&&xe("div",{className:"flex items-center text-sm text-muted-foreground",children:r.breadcrumbs.map((p,T)=>gt("div",{className:"flex items-center",children:[p.href?xe("span",{className:"hover:text-primary hover:underline",children:p.label}):xe("span",{children:p.label}),T<r.breadcrumbs.length-1&&xe(Ir,{className:"mx-2 h-4 w-4"})]},T))})]})]}),align:"left",width:"fill"},m={content:r.primaryActions,align:"right",width:"auto"},v=[w,...t.filter(p=>p!==void 0),m];return xe("div",{className:o("flex items-center w-full gap-4 p-2",e),children:v.map((p,T)=>xe("div",{className:o("flex items-center h-full",p.className,{"justify-start":p.align==="left","justify-center":p.align==="center","justify-end":p.align==="right","flex-1":p.width==="fill"}),children:p.content},T))})};import Or,{useState as _r,createContext as Vr,useContext as Hr}from"react";import{Dialog as Kt}from"radix-ui";import{XIcon as Br}from"lucide-react";import{jsx as Mt,jsxs as Eo}from"react/jsx-runtime";function Va({...e}){return Mt(Kt.Root,{"data-slot":"sheet",...e})}function Go({...e}){return Mt(Kt.Portal,{"data-slot":"sheet-portal",...e})}function Lr({className:e,...t}){return Mt(Kt.Overlay,{"data-slot":"sheet-overlay",className:o("data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50",e),...t})}function Ha({className:e,children:t,side:a="right",...r}){return Eo(Go,{children:[Mt(Lr,{}),Eo(Kt.Content,{"data-slot":"sheet-content",className:o("bg-background data-[state=open]:animate-in data-[state=closed]:animate-out fixed z-50 flex flex-col gap-4 shadow-lg transition ease-in-out data-[state=closed]:duration-300 data-[state=open]:duration-500",a==="right"&&"data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right inset-y-0 right-0 h-full w-3/4 border-l sm:max-w-sm",a==="left"&&"data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left inset-y-0 left-0 h-full w-3/4 border-r sm:max-w-sm",a==="top"&&"data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top inset-x-0 top-0 h-auto border-b",a==="bottom"&&"data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom inset-x-0 bottom-0 h-auto border-t",e),...r,children:[t,Eo(Kt.Close,{className:"ring-offset-background focus:ring-ring data-[state=open]:bg-secondary absolute top-4 right-4 rounded-xs opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none",children:[Mt(Br,{className:"size-4"}),Mt("span",{className:"sr-only",children:"Close"})]})]})]})}import{Fragment as $r,jsx as Y,jsxs as At}from"react/jsx-runtime";var Ea=Vr(!1),po={"one-half":["w-1/2","w-1/2"],"one-third":["w-1/3","w-2/3"],"two-third":["w-2/3","w-1/3"],"one-fourth":["w-1/4","w-3/4"],"three-fourth":["w-3/4","w-1/4"],"one-fifth":["w-1/5","w-4/5"],"four-fifth":["w-4/5","w-1/5"]},zt={none:"p-0",tight:"p-2",default:"p-4",loose:"p-6"},Er=(e,t)=>{let[a,r]=po[t];return{container:"inset-y-0 z-50 transition-all duration-500 ease-in-out",content:o("h-full bg-background transition-all duration-500 ease-in-out",e==="right"?"border-l":"border-r"),transform:e==="right"?"translate-x-full":"-translate-x-full",transformOpen:"translate-x-0",contentPushClass:e==="right"?r:a,sheetPushClass:e==="right"?a:r}},Gr="flex flex-col overflow-hidden rounded-2xl relative",jr={default:"bg-background",card:"bg-background shadow-sm border",border:"bg-background border-2",transparent:"bg-transparent"},Ga=e=>{let{children:t,className:a,variant:r="default",layout:s="full",header:i,footer:u,headerClassName:w,contentClassName:m,footerClassName:v,parentContainer:p=!1,padding:T=p?"none":"tight"}=e,L=Hr(Ea),[F,A]=_r(!1),k=Or.useCallback(H=>Y("div",{className:o("flex-1 overflow-auto h-full no-scrollbar",p&&"flex",!p&&zt[T],m),children:H}),[T,p,m]),O=()=>{switch(s){case"split":{let{splitRatio:H="three-fourth",reverse:S=!1}=e;if(!Array.isArray(t)||t.length!==2)return Y("div",{className:"flex items-center justify-center h-full text-red-500",children:'Error: AppContent with layout="split" requires exactly 2 children'});let[J,C]=po[H],[_,De]=S?[t[1],t[0]]:[t[0],t[1]],[Te,ie]=S?[C,J]:[J,C];return At("div",{className:"flex h-full gap-2",children:[Y("div",{className:o(Te,"overflow-auto"),children:k(_)}),Y("div",{className:o(ie,"overflow-auto"),children:k(De)})]})}case"with-sheet":{let{sheetContent:H,sheetWidth:S="four-fifth",sheetSide:J="right",sheetMode:C="container",sheetClassName:_,isSheetOpen:De,onSheetOpenChange:Te,disableOverlay:ie=!0,showSheetOverlay:Ue=!0}=e,Se=De!==void 0&&Te,Q=Se?De:F,We=Se?Te:A;if(C==="container"){let se=Er(J,S),Pe=po[S][0];return ie?At("div",{className:o("flex relative flex-1 overflow-hidden",m),children:[Y("div",{className:o("h-full overflow-auto transition-all duration-500",Q?se.contentPushClass:"w-full",Q&&"overflow-y-auto overflow-x-hidden"),children:Y("div",{className:o("h-full",!p&&zt[T]),children:t})}),Y("div",{className:o(se.container,"transition-all duration-500 ease-in-out h-full",Pe,Q&&["left","right"].includes(J)?o(se.sheetPushClass,"overflow-y-auto"):Q?se.transformOpen:o(se.transform,"hidden"),"overflow-y-auto"),children:Y("div",{className:o(se.content,_,"h-full"),children:H})})]}):At("div",{className:o("flex relative flex-1 overflow-hidden",m),children:[Y("div",{className:o("h-full overflow-auto w-full transition-all duration-500 relative z-10"),children:Y("div",{className:o("h-full",!p&&zt[T]),children:t})}),At("div",{className:o("absolute inset-0 z-20",!Q&&"pointer-events-none"),children:[Ue&&Y("div",{className:o("absolute inset-0 bg-black/50 transition-opacity duration-500",Q?"opacity-100":"opacity-0 pointer-events-none"),onClick:()=>We(!1)}),Y("div",{className:o(se.container,"transition-all duration-500 backdrop-blur-2xl ease-in-out h-full absolute",Pe,Q?"translate-x-0 opacity-100":o(J==="right"?"translate-x-full":"-translate-x-full","opacity-0 pointer-events-none"),"overflow-y-auto"),style:{[J]:0},children:Y("div",{className:o(se.content,_,"h-full"),children:H})})]})]})}return At($r,{children:[t,Y(Va,{open:Q,onOpenChange:We,children:Y(Go,{children:Y(Ha,{side:J,className:o("fixed bg-background border sm:max-w-full","transition-all duration-500 ease-in-out",po[S][0],_),children:H})})})]})}default:return k(t)}};return Y(Ea.Provider,{value:!0,children:At("div",{className:o(Gr,jr[r],zt[T],L&&"flex-1",p&&"h-full",!p&&"rounded-2xl",a),children:[i&&Y("div",{className:o("border-b",w,r==="card"&&!p&&"rounded-t-2xl",r==="border"&&"border-b-2",zt[T]),children:i}),O(),u&&Y("div",{className:o("border-t",v,r==="card"&&!p&&"rounded-b-2xl",r==="border"&&"border-t-2",zt[T]),children:u})]})})};import{jsx as jo}from"react/jsx-runtime";var ja=({className:e,columns:t=[],meta:a={title:""}})=>{let r={content:jo("div",{className:"flex items-center gap-4 p-2",children:a.secondaryActions}),align:"right",width:"fill"},s=[...t.filter(i=>i!==void 0),r];return jo("div",{className:o("flex items-center w-full gap-4",e),children:s.map((i,u)=>jo("div",{className:o("flex items-center h-full",i.className,{"justify-start":i.align==="left","justify-center":i.align==="center","justify-end":i.align==="right","flex-1":i.width==="fill"}),children:i.content},u))})};import{jsx as uo}from"react/jsx-runtime";function Ur({useTypedAppMeta:e}){return{AppHeader:i=>{let{meta:u}=e();return uo(_a,{...i,meta:u})},AppFooter:i=>{let{meta:u}=e();return uo(ja,{...i,meta:u})},AppContent:i=>uo(Ga,{...i}),AppContainer:i=>uo(La,{...i})}}import{createContext as $a,useContext as Wr,useState as Ua,useCallback as go,useMemo as Wa}from"react";import{jsx as qa}from"react/jsx-runtime";var qr=$a(void 0),Jr=({children:e})=>{let[t,a]=Ua({title:"",description:"",breadcrumbs:[]}),r=go(u=>{a(w=>Object.keys(u).some(v=>JSON.stringify(w[v])!==JSON.stringify(u[v]))?{...w,...u}:w)},[]),s=go(()=>{a(u=>u.title===""&&u.description===""&&(u.breadcrumbs?.length??0)===0?u:{title:"",description:"",breadcrumbs:[]})},[]),i=Wa(()=>({meta:t,setMeta:r,resetMeta:s}),[t,r,s]);return qa(qr.Provider,{value:i,children:e})};function Xr(){let e=$a(void 0);return{TypedAppMetaProvider:({children:r})=>{let[s,i]=Ua({title:"",description:"",breadcrumbs:[]}),u=go(v=>{i(p=>Object.keys(v).some(L=>{let F=p[L],A=v[L];return JSON.stringify(F)!==JSON.stringify(A)})?{...p,...v}:p)},[]),w=go(()=>{i(v=>v.title===""&&v.description===""&&(v.breadcrumbs?.length??0)===0?v:{title:"",description:"",breadcrumbs:[]})},[]),m=Wa(()=>({meta:s,setMeta:u,resetMeta:w}),[s,u,w]);return qa(e.Provider,{value:m,children:r})},useTypedAppMeta:()=>{let r=Wr(e);if(!r)throw new Error("useTypedAppMeta must be used within a TypedAppMetaProvider");return r},TypedAppMetaContext:e}}import{useEffect as Kr,useMemo as $o}from"react";function Yr({useTypedAppMeta:e}){function t(a){let{setMeta:r,resetMeta:s}=e(),i=$o(()=>{if(a.backAction)return{...a.backAction,onClick:a.backAction.onClick}},[a.backAction?.content,a.backAction?.href,a.backAction?.onClick?.toString()]),u=$o(()=>a.metadata,[JSON.stringify(a.metadata)]),w=$o(()=>({...a,backAction:i,metadata:u}),[a.title,a.description,a.breadcrumbs,a.primaryActions,a.secondaryActions,a.pagination,a.status,i,u]);Kr(()=>(r(w),()=>s()),[w,r,s])}return{usePageTemplate:t}}import{useState as Ja}from"react";import{Copy as Zr,Check as Qr,Loader2Icon as ei}from"lucide-react";import{jsx as je,jsxs as Xa}from"react/jsx-runtime";var Uo=class{static currencyFormatter=new Intl.NumberFormat("en-IN",{style:"currency",currency:"INR",maximumFractionDigits:2});static compactFormatter=new Intl.NumberFormat("en-IN",{style:"currency",currency:"INR",notation:"compact",maximumFractionDigits:1});static MONTH_NAMES_SHORT=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];static async copyToClipboard(t){if(t)try{await navigator.clipboard.writeText(t)}catch(a){throw console.error("Failed to copy text:",a),a}}static CopyToClipboard=({text:t,children:a,className:r,size:s="icon",variant:i="ghost"})=>{let[u,w]=Ja(!1),[m,v]=Ja(!1),p=async()=>{if(!(!t||m)){v(!0);try{await this.copyToClipboard(t),w(!0),setTimeout(()=>w(!1),2e3)}catch(T){console.error("Failed to copy text:",T)}finally{v(!1)}}};return Xa(Ze,{children:[je(Qe,{asChild:!0,children:je(h,{variant:i,size:s,className:o(s==="icon"&&"size-6",r),onClick:p,disabled:m||!t,children:m?je(ei,{className:"animate-spin"}):u?je(Qr,{className:"h-3 w-3"}):a||je(Zr,{className:"h-3 w-3"})})}),je(et,{children:u?"Copied!":m?"Copying...":"Copy to clipboard"})]})};static formatINR(t,a={}){let{prefix:r="",suffix:s="",withSymbol:i=!0,compact:u=!1}=a;if(typeof t!="number"||isNaN(t))return`${r}${i?"\u20B9 ":""}0.00${s}`;let w=t<0,m=Math.abs(t),p=(u&&m>=1e5?this.compactFormatter:this.currencyFormatter).format(m).replace("\u20B9","");return`${r}${w?"- ":""}${i?"\u20B9 ":""}${p}${s}`}static formatDate(t,a={}){let{format:r="dd-mm-yyyy",separator:s="-"}=a,i=new Date(t);if(isNaN(i.getTime()))return"";let u=String(i.getDate()).padStart(2,"0"),w=String(i.getMonth()+1).padStart(2,"0"),m=this.MONTH_NAMES_SHORT[i.getMonth()],v=i.getFullYear();switch(r){case"dd-mmm-yyyy":return`${u}${s}${m}${s}${v}`;case"iso":return i.toISOString().split("T")[0];case"long":return i.toLocaleDateString("en-IN",{year:"numeric",month:"long",day:"numeric"});case"short":return i.toLocaleDateString("en-IN");default:return`${u}${s}${w}${s}${v}`}}static toProperCase(t){return t?t.toLowerCase().split(" ").map(a=>a.charAt(0).toUpperCase()+a.slice(1)).join(" "):""}static toProperCaseAdvanced(t){return t?t.toLowerCase().split(/(\s+|['-])/).map((a,r,s)=>["-","'"," "].includes(a)||r>0&&["-","'"].includes(s[r-1])?a:a.charAt(0).toUpperCase()+a.slice(1)).join(""):""}static StatusBadge=({status:t,className:a,showDot:r=!0,capitalize:s=!0,size:i="md",variant:u="outline",customColors:w,icon:m,trueMessage:v="active",falseMessage:p="inactive"})=>{let T=typeof t=="boolean"?t?v:p:typeof t=="number"?t>0?v:p:t.toLowerCase(),L={active:{label:"active",solid:{bg:"bg-emerald-500",text:"text-white",border:"border-emerald-600",dot:"bg-white"},outline:{bg:"bg-emerald-50",text:"text-emerald-700",border:"border-emerald-100",dot:"bg-emerald-500"},subtle:{bg:"bg-emerald-50",text:"text-emerald-700",border:"border-transparent",dot:"bg-emerald-500"}},pending:{label:"pending",solid:{bg:"bg-amber-500",text:"text-white",border:"border-amber-600",dot:"bg-white"},outline:{bg:"bg-amber-50",text:"text-amber-700",border:"border-amber-100",dot:"bg-amber-500"},subtle:{bg:"bg-amber-50",text:"text-amber-700",border:"border-transparent",dot:"bg-amber-500"}},inactive:{label:"inactive",solid:{bg:"bg-rose-500",text:"text-white",border:"border-rose-600",dot:"bg-white"},outline:{bg:"bg-rose-50",text:"text-rose-700",border:"border-rose-100",dot:"bg-rose-500"},subtle:{bg:"bg-rose-50",text:"text-rose-700",border:"border-transparent",dot:"bg-rose-500"}},draft:{label:"draft",solid:{bg:"bg-gray-500",text:"text-white",border:"border-gray-600",dot:"bg-white"},outline:{bg:"bg-gray-50",text:"text-gray-700",border:"border-gray-100",dot:"bg-gray-500"},subtle:{bg:"bg-gray-50",text:"text-gray-700",border:"border-transparent",dot:"bg-gray-500"}},completed:{label:"completed",solid:{bg:"bg-indigo-500",text:"text-white",border:"border-indigo-600",dot:"bg-white"},outline:{bg:"bg-indigo-50",text:"text-indigo-700",border:"border-indigo-100",dot:"bg-indigo-500"},subtle:{bg:"bg-indigo-50",text:"text-indigo-700",border:"border-transparent",dot:"bg-indigo-500"}}},F=L[T.toLowerCase()]||L.inactive,A=w||F[u],k={sm:"text-xs px-2 py-0.5",md:"text-xs px-2.5 py-0.5",lg:"text-sm px-3 py-1"},O=s?T.charAt(0).toUpperCase()+T.slice(1):T;return je("div",{className:"flex justify-center",children:Xa("span",{className:o("inline-flex items-center gap-1.5 rounded-full border font-medium",A.bg,A.text,A.border,k[i],a),children:[r&&(m?je("span",{className:"flex items-center",children:m}):je("span",{className:o("size-2 rounded-full",A.dot),"aria-hidden":"true"})),O]})})}};import{AlertTriangleIcon as ti}from"lucide-react";import{useRouteError as oi,isRouteErrorResponse as ai,useNavigate as ni}from"react-router";import{Fragment as Wo,jsx as Be,jsxs as It}from"react/jsx-runtime";var Ka=()=>{let e=oi(),t=ni();return Be("div",{className:"rounded-2xl flex justify-center items-center h-full bg-sidebar px-4",children:It("div",{className:"flex flex-col items-center space-y-4 text-center",children:[Be(ti,{className:"h-16 w-16 text-destructive"}),ai(e)?It(Wo,{children:[It("h2",{className:"text-3xl font-semibold text-destructive",children:["Error ",e.status,": ",e.statusText]}),typeof e.data=="string"?Be("pre",{className:"text-lg text-muted-foreground whitespace-pre-wrap max-w-4xl text-left",children:e.data}):e.data?.message&&Be("pre",{className:"text-lg text-muted-foreground whitespace-pre-wrap max-w-4xl text-left",children:e.data.message})]}):e instanceof Error?It(Wo,{children:[Be("h2",{className:"text-3xl font-semibold text-destructive",children:"Unexpected Error"}),Be("pre",{className:"text-lg text-muted-foreground whitespace-pre-wrap max-w-4xl text-left",children:e.message}),e.stack&&It("details",{className:"mt-2 text-sm text-muted-foreground max-w-4xl text-left",children:[Be("summary",{className:"cursor-pointer underline",children:"Stack Trace"}),Be("pre",{className:"whitespace-pre-wrap",children:e.stack})]})]}):It(Wo,{children:[Be("h2",{className:"text-3xl font-semibold text-destructive",children:"Unknown Error"}),Be("pre",{className:"text-lg text-muted-foreground whitespace-pre-wrap max-w-4xl text-left",children:typeof e=="string"?e:JSON.stringify(e,null,2)})]}),Be(h,{variant:"outline",onClick:()=>t(-1),children:"Go Back"})]})})};import{motion as $e}from"framer-motion";import{jsx as q,jsxs as Ne}from"react/jsx-runtime";function ri({size:e=100,strokeWidth:t=2,color:a="currentColor",className:r=""}){return Ne($e.svg,{width:e,height:e,viewBox:"0 0 100 100",initial:"hidden",animate:"visible",className:r,children:[q("title",{children:"Animated Checkmark"}),q($e.circle,{cx:"50",cy:"50",r:"40",stroke:a,custom:0,style:{strokeWidth:t,strokeLinecap:"round",fill:"transparent"}}),q($e.path,{d:"M30 50L45 65L70 35",stroke:a,custom:1,style:{strokeWidth:t,strokeLinecap:"round",strokeLinejoin:"round",fill:"transparent"}})]})}function Ya(){return q(Ee,{className:"w-full max-w-sm mx-auto p-6 min-h-[300px] flex flex-col justify-center bg-background",children:Ne(Ge,{className:"space-y-4 flex flex-col items-center justify-center",children:[q($e.div,{className:"flex justify-center",initial:{opacity:0,scale:.8},animate:{opacity:1,scale:1},transition:{duration:.4,ease:[.4,0,.2,1],scale:{type:"spring",damping:15,stiffness:200}},children:Ne("div",{className:"relative",children:[q($e.div,{className:"absolute inset-0 bg-primary/5 rounded-full",initial:{opacity:0,scale:.8},animate:{opacity:1,scale:1},transition:{delay:.2,duration:.8,ease:"circOut"}}),q(ri,{size:80,strokeWidth:4,color:"rgb(16 185 129)",className:"relative z-10 dark:drop-shadow-[0_0_10px_rgba(0,0,0,0.1)]"})]})}),Ne($e.div,{className:"space-y-2 text-center w-full",initial:{opacity:0,y:10},animate:{opacity:1,y:0},transition:{delay:.2,duration:.6,ease:[.4,0,.2,1]},children:[q($e.h2,{className:"text-lg text-zinc-100 dark:text-zinc-900 tracking-tighter font-semibold uppercase",initial:{opacity:0,y:5},animate:{opacity:1,y:0},transition:{delay:1,duration:.4},children:"Transfer Successful"}),q("div",{className:"flex items-center gap-4",children:q($e.div,{className:"flex-1 bg-zinc-800/50 dark:bg-zinc-50/50 rounded-xl p-3 border border-zinc-700/50 dark:border-zinc-200/50 backdrop-blur-md",initial:{opacity:0,scale:.95},animate:{opacity:1,scale:1},transition:{delay:1.2,duration:.4,ease:[.4,0,.2,1]},children:Ne("div",{className:"flex flex-col items-start gap-2",children:[Ne("div",{className:"space-y-1.5",children:[Ne("span",{className:"text-xs font-medium text-secondary-foreground flex items-center gap-1.5",children:[Ne("svg",{className:"w-3 h-3",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[q("title",{children:"From"}),q("path",{d:"M12 19V5M5 12l7-7 7 7"})]}),"From"]}),Ne("div",{className:"flex items-center gap-2.5 group transition-all",children:[q("span",{className:"inline-flex items-center justify-center w-7 h-7 rounded-lg bg-zinc-900 dark:bg-white shadow-lg border border-zinc-700 dark:border-zinc-300 text-sm font-medium text-zinc-100 dark:text-zinc-900 group-hover:scale-105 transition-transform",children:"$"}),q("span",{className:"font-medium text-zinc-100 dark:text-zinc-900 tracking-tight",children:"500.00 USD"})]})]}),q("div",{className:"w-full h-px bg-gradient-to-r from-transparent via-zinc-700 dark:via-zinc-300 to-transparent"}),Ne("div",{className:"space-y-1.5",children:[Ne("span",{className:"text-xs font-medium text-secondary-foreground flex items-center gap-1.5",children:[Ne("svg",{className:"w-3 h-3",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[q("title",{children:"To"}),q("path",{d:"M12 5v14M5 12l7 7 7-7"})]}),"To"]}),Ne("div",{className:"flex items-center gap-2.5 group transition-all",children:[q("span",{className:"inline-flex items-center justify-center w-7 h-7 rounded-lg bg-zinc-900 dark:bg-white shadow-lg border border-zinc-700 dark:border-zinc-300 text-sm font-medium text-zinc-100 dark:text-zinc-900 group-hover:scale-105 transition-transform",children:"\u20AC"}),q("span",{className:"font-medium text-zinc-100 dark:text-zinc-900 tracking-tight",children:"460.00 EUR"})]})]})]})})}),q($e.div,{className:"w-full text-xs text-secondary-foreground mt-2 text-center",initial:{opacity:0},animate:{opacity:1},transition:{delay:1.4,duration:.4},children:"Exchange Rate: 1 USD = 0.92 EUR"})]})]})})}import{jsx as fo,jsxs as ii}from"react/jsx-runtime";var Za=()=>fo("div",{className:"rounded-2xl flex justify-center items-center h-full bg-transparent",children:ii("div",{className:"flex flex-col items-center space-y-4",children:[fo("div",{className:"animate-spin rounded-full border-t-4 border-ring h-16 w-16 mb-4"}),fo("h2",{className:"text-xl font-semibold text-muted-foreground",children:"Loading, please wait..."}),fo("p",{className:"text-sm text-muted-foreground",children:"Your content is on its way."})]})});import{useLocation as si}from"react-router";import{GhostIcon as li}from"lucide-react";import{NavLink as di,useNavigate as ci}from"react-router";import{jsx as Ft,jsxs as qo}from"react/jsx-runtime";var Qa=()=>{let e=si(),t=ci(),a=()=>{window.history.length>2?t(-1):t("/")};return qo("div",{className:"rounded-2xl flex flex-col items-center justify-center h-full p-6 text-center bg-sidebar text-muted-foreground select-none",children:[Ft(li,{className:"h-15 w-15 text-destructive mb-4"}),Ft("h1",{className:"text-2xl font-bold text-destructive mb-2",children:"Page Not Found"}),qo("p",{className:"text-xl mb-4",children:["The page ",Ft("code",{className:"px-1 py-0.5 rounded bg-muted text-foreground",children:e.pathname})," doesn't exist or has been moved."]}),qo("div",{className:"flex space-x-4",children:[Ft(h,{variant:"outline",onClick:a,children:"Go Back"}),Ft(h,{variant:"ghost",children:Ft(di,{to:"/",children:"Return Home"})})]})]})};import{WifiOffIcon as mi}from"lucide-react";import{jsx as Jo,jsxs as pi}from"react/jsx-runtime";var en=()=>pi("div",{className:"rounded-2xl flex flex-col items-center justify-center h-screen p-6 text-center text-muted-foreground bg-background select-none",children:[Jo(mi,{className:"h-15 w-15 text-destructive mb-4"}),Jo("h1",{className:"text-3xl font-bold text-destructive mb-2",children:"You're offline"}),Jo("p",{className:"text-xl max-w-md",children:"We couldn't connect to the server."})]});import{ShieldOffIcon as ui}from"lucide-react";import{NavLink as gi,useNavigate as fi}from"react-router";import{jsx as Bt,jsxs as tn}from"react/jsx-runtime";var on=()=>{let e=fi();return tn("div",{className:"rounded-2xl flex flex-col items-center justify-center h-full p-6 text-center bg-sidebar text-muted-foreground select-none",children:[Bt(ui,{className:"h-15 w-15 text-destructive mb-4"}),Bt("h1",{className:"text-2xl font-bold text-destructive mb-2",children:"Access Denied"}),Bt("p",{className:"text-xl mb-4",children:"You don't have permission to view this page. Please sign in with an authorized account or contact your administrator."}),tn("div",{className:"flex space-x-4",children:[Bt(h,{variant:"outline",onClick:()=>{window.history.length>2?e(-1):e("/")},children:"Go Back"}),Bt(h,{variant:"ghost",children:Bt(gi,{to:"/",children:"Go to Home"})})]})]})};export{Jr as AppMetaProvider,Ya as CurrencyTransfer,Na as DataTable,Sa as DataTableActionBar,Pa as DataTableActionBarAction,ka as DataTableActionBarSelection,za as DataTemplate,Ia as DataTemplateActionBar,Fa as DataTemplateActionBarAction,Ba as DataTemplateActionBarSelection,Ka as ErrorComponent,Uo as GeneralHelper,Za as Loader,Qa as NotFound,en as OfflineUI,on as Unauthorized,Ur as createLayoutComponents,Yr as createPageTemplateHook,Xr as createTypedAppMetaContext};
|
|
3
3
|
//# sourceMappingURL=index.js.map
|