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