mantine-datatable 8.1.3 → 8.3.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -1,2 +1,2 @@
1
- "use client";import{Box as $r,Table as Qr}from"@mantine/core";import{useDebouncedCallback as Ur,useMergedRef as zo}from"@mantine/hooks";import _o from"clsx";import{useCallback as ke,useMemo as Vo,useState as Ke}from"react";import{useState as kt}from"react";import{createSafeContext as Yn}from"@mantine/core";var[Rt,ue]=Yn("useDataTableColumnsContext must be used within DataTableColumnProvider");import{jsx as qn}from"react/jsx-runtime";var nt=e=>{let{children:t,columnsOrder:o,setColumnsOrder:n,columnsToggle:a,setColumnsToggle:l,resetColumnsOrder:r,resetColumnsToggle:s,setColumnWidth:c,setMultipleColumnWidths:p,resetColumnsWidth:d}=e,[T,b]=kt(""),[f,g]=kt("");return qn(Rt,{value:{sourceColumn:T,setSourceColumn:b,targetColumn:f,setTargetColumn:g,columnsToggle:a,setColumnsToggle:l,swapColumns:()=>{if(!o||!n||!T||!f)return;let C=o.indexOf(T),w=o.indexOf(f);if(C!==-1&&w!==-1){let M=o.splice(C,1)[0];o.splice(w,0,M),n([...o])}},resetColumnsOrder:r,resetColumnsToggle:s,setColumnWidth:c,setMultipleColumnWidths:p,resetColumnsWidth:d},children:t})};import{jsx as Et}from"react/jsx-runtime";function Nt(){return Et("tr",{className:"mantine-datatable-empty-row",children:Et("td",{})})}import{Center as ea,Text as ta}from"@mantine/core";import{jsx as ve,jsxs as jn}from"react/jsx-runtime";function Lt(){return jn("svg",{width:"24",height:"24",viewBox:"0 0 24 24",strokeWidth:"2",stroke:"currentColor",fill:"none",strokeLinecap:"round",strokeLinejoin:"round",children:[ve("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),ve("path",{d:"M12.983 8.978c3.955 -.182 7.017 -1.446 7.017 -2.978c0 -1.657 -3.582 -3 -8 -3c-1.661 0 -3.204 .19 -4.483 .515m-2.783 1.228c-.471 .382 -.734 .808 -.734 1.257c0 1.22 1.944 2.271 4.734 2.74"}),ve("path",{d:"M4 6v6c0 1.657 3.582 3 8 3c.986 0 1.93 -.067 2.802 -.19m3.187 -.82c1.251 -.53 2.011 -1.228 2.011 -1.99v-6"}),ve("path",{d:"M4 12v6c0 1.657 3.582 3 8 3c3.217 0 5.991 -.712 7.261 -1.74m.739 -3.26v-4"}),ve("path",{d:"M3 3l18 18"})]})}import{Fragment as oa,jsx as Ie,jsxs as na}from"react/jsx-runtime";function Wt({icon:e,text:t,pt:o,pb:n,active:a,children:l}){return Ie(ea,{pt:o,pb:n,className:"mantine-datatable-empty-state","data-active":a||void 0,children:l||na(oa,{children:[e||Ie("div",{className:"mantine-datatable-empty-state-icon",children:Ie(Lt,{})}),Ie(ta,{component:"div",size:"sm",c:"dimmed",children:t})]})})}import{TableTfoot as Pa,TableTr as va,rem as Ma}from"@mantine/core";import Ra from"clsx";import{TableTh as ya}from"@mantine/core";import xa from"clsx";import{useCallback as Tl,useRef as gl,useState as hl}from"react";import{useLocalStorage as at}from"@mantine/hooks";import{useMemo as aa}from"react";var Ht=({key:e,columns:t=[],getInitialValueInEffect:o=!0})=>{function n(u,y){let m=[];return u.forEach(i=>{y.find(h=>h.accessor===i)&&m.push(i)}),y.forEach(i=>{m.includes(i.accessor)||m.push(i.accessor)}),m}function a(u,y){let m=[];return u.forEach(i=>{y.find(h=>h.accessor===i.accessor)&&m.push(i)}),y.forEach(i=>{m.find(h=>h.accessor===i.accessor)||m.push({accessor:i.accessor,defaultToggle:i.defaultToggle||!0,toggleable:i.toggleable,toggled:i.defaultToggle===void 0?!0:i.defaultToggle})}),m}function l(u,y){let m=[];return u.forEach(i=>{let h=Object.keys(i)[0];y.find(P=>P.accessor===h)&&m.push(i)}),y.forEach(i=>{let h=i.accessor;if(!m.find(P=>Object.keys(P)[0]===h)){let P={};P[h]="",m.push(P)}}),m}function r(){let[u,y]=at({key:e?`${e}-columns-order`:"",defaultValue:e?p:void 0,getInitialValueInEffect:o});function m(P){e&&y(P)}if(!e)return[u,m];let i=n(u,t),h=JSON.stringify(u);return JSON.stringify(i)!==h&&m(i),[i,m]}function s(){let[u,y]=at({key:e?`${e}-columns-toggle`:"",defaultValue:e?T:void 0,getInitialValueInEffect:o});function m(P){e&&y(P)}if(!e)return[u,m];let i=a(u,t),h=JSON.stringify(u);return JSON.stringify(i)!==h&&m(i),[a(u,t),m]}function c(){let[u,y]=at({key:e?`${e}-columns-width`:"",defaultValue:e?d:void 0,getInitialValueInEffect:o});function m(P){e&&y(P)}if(!e)return[u,m];let i=l(u,t),h=JSON.stringify(u);return JSON.stringify(i)!==h&&m(i),[l(u,t),m]}let p=t&&t.map(u=>u.accessor)||[],d=t&&t.map(u=>({[u.accessor]:u.width??"initial"}))||[],T=t&&t.map(u=>({accessor:u.accessor,defaultToggle:u.defaultToggle||!0,toggleable:u.toggleable,toggled:u.defaultToggle===void 0?!0:u.defaultToggle})),[b,f]=r(),[g,R]=s(),[C,w]=c(),M=()=>f(p),D=()=>{R(T)},S=()=>w(d);return{effectiveColumns:aa(()=>b?b.map(m=>t.find(i=>i.accessor===m)).map(m=>({...m,hidden:m?.hidden||!g.find(i=>i.accessor===m?.accessor)?.toggled})).map(m=>({...m,width:C.find(i=>i[m?.accessor])?.[m?.accessor]})):t,[t,b,g,C]),setColumnsOrder:f,columnsOrder:b,resetColumnsOrder:M,columnsToggle:g,setColumnsToggle:R,resetColumnsToggle:D,columnsWidth:C,setColumnsWidth:w,setColumnWidth:(u,y)=>{let m=C.map(i=>i[u]?{[u]:y}:i);w(m)},setMultipleColumnWidths:u=>{let y=C.map(m=>{let i=Object.keys(m)[0],h=u.find(P=>P.accessor===i);return h?{[i]:h.width}:m});w(y)},resetColumnsWidth:S}};import{useResizeObserver as ra}from"@mantine/hooks";function le(){let[e]=ra(),{width:t,height:o}=e.current?.getBoundingClientRect()||{width:0,height:0};return{ref:e,width:t,height:o}}import{useEffect as la,useLayoutEffect as ia}from"react";var It=typeof window<"u"?ia:la;import{useEffect as sa,useState as ca}from"react";function Ot(e){let[t,o]=ca(null),n=e?.join(":")||"";return sa(()=>{o(null)},[n]),{lastSelectionChangeIndex:t,setLastSelectionChangeIndex:o}}import{useEffect as da,useRef as ua,useState as ma}from"react";function pa(e,t){let o=()=>{t(e.map(a=>a.matches))},n=e.map(a=>{try{return a.addEventListener("change",o),()=>a.removeEventListener("change",o)}catch{return a.addListener(o),()=>a.removeListener(o)}});return()=>{n.forEach(a=>a())}}function fa(e,t){return t||(typeof window<"u"&&"matchMedia"in window?e.map(o=>window.matchMedia(o).matches):e.map(()=>!1))}function At(e,t,{getInitialValueInEffect:o}={getInitialValueInEffect:!0}){let[n,a]=ma(o?t:fa(e,t)),l=ua(null);return da(()=>{if("matchMedia"in window)return l.current=e.map(r=>window.matchMedia(r)),a(l.current.map(r=>r.matches)),pa(l.current,r=>{a(r)})},[e]),n}import{useMantineTheme as ba}from"@mantine/core";import{useMemo as zt}from"react";function _t(e){let t=ba(),o=zt(()=>e.map(a=>(typeof a=="function"?a(t):a)??""),[e,t]),n=zt(()=>e.map(()=>!0),[e]);return At(o,n)}import{useMantineTheme as Ta}from"@mantine/core";import{useMediaQuery as ga}from"@mantine/hooks";function K(e){let t=Ta(),o=typeof e=="function"?e(t):e;return ga(o||"",!0)}import{useState as ha}from"react";function me(e){let t=e.replace(/([a-z\d])([A-Z]+)/g,"$1 $2").replace(/\W|_/g," ").trim().toLowerCase();return`${t.charAt(0).toUpperCase()}${t.slice(1)}`}function Vt(e,t,o){return e.filter(n=>!t.map(o).includes(o(n)))}function Oe(e,t){return e.filter((o,n,a)=>n===a.findIndex(l=>t(o)===t(l)))}function rt(e,t){return t?t.match(/([^[.\]])+/g).reduce((n,a)=>n&&n[a],e):void 0}function L(e,t){return typeof t=="string"?rt(e,t):t(e)}function zl(e,t){let o=structuredClone(t),n=o[e.source.index];return e.destination&&(o.splice(e.source.index,1),o.splice(e.destination.index,0,n)),o}function _l(e,t){let o=structuredClone(t),n=e.destination;if(!n)return o;let a=o[e.source.index],l=o[n.index];return o.splice(n.index,1,a),o.splice(e.source.index,1,l),o}function Bt({rowExpansion:e,records:t,idAccessor:o}){let n=[];if(e&&t){let{trigger:s,allowMultiple:c,initiallyExpanded:p}=e;t&&s==="always"?n=t.map(d=>L(d,o)):p&&(n=t.filter((d,T)=>p({record:d,index:T})).map(d=>L(d,o)),c||(n=[n[0]]))}let a,l,r=ha(n);if(e){let{expandable:s,trigger:c,allowMultiple:p,collapseProps:d,content:T}=e;e.expanded?{recordIds:a,onRecordIdsChange:l}=e.expanded:[a,l]=r;let b=f=>l?.(a.filter(g=>g!==L(f,o)));return{expandOnClick:c!=="always"&&c!=="never",isRowExpanded:f=>c==="always"?!0:a.includes(L(f,o)),isExpandable:({record:f,index:g})=>s?s({record:f,index:g}):!0,expandRow:f=>{let g=L(f,o);l?.(p?[...a,g]:[g])},collapseRow:b,collapseProps:d,content:({record:f,index:g})=>()=>T({record:f,index:g,collapse:()=>b(f)})}}}import{useTimeout as Ft}from"@mantine/hooks";import{useEffect as Ca,useState as Gt}from"react";function Xt(e,t){let[o,n]=Gt(e),[a,l]=Gt(e),r=Ft(()=>n(!0),0),s=Ft(()=>l(!1),t||200);return Ca(()=>{e?(s.clear(),l(!0),r.start()):(r.clear(),n(!1),s.start())},[r,s,e]),{expanded:o,visible:a}}var pe="mantine-datatable-nowrap",fe="mantine-datatable-ellipsis",F="mantine-datatable-pointer-cursor",Ae="mantine-datatable-context-menu-cursor",$t="mantine-datatable-text-selection-disabled",J="mantine-datatable-text-align-left",Z="mantine-datatable-text-align-center",Y="mantine-datatable-text-align-right";import{jsx as Da}from"react/jsx-runtime";function Qt({className:e,style:t,visibleMediaQuery:o,title:n,noWrap:a,ellipsis:l,textAlign:r,width:s}){return K(o)?Da(ya,{className:xa({[pe]:a||l,[fe]:l,[J]:r==="left",[Z]:r==="center",[Y]:r==="right"},e),style:[{width:s,minWidth:s,maxWidth:s},t],children:n}):null}import{TableTh as wa}from"@mantine/core";import{jsx as Sa}from"react/jsx-runtime";function Ut({shadowVisible:e}){return Sa(wa,{className:"mantine-datatable-footer-selector-placeholder-cell","data-shadow-visible":e||void 0})}import{jsx as lt,jsxs as ka}from"react/jsx-runtime";function Kt({className:e,style:t,columns:o,defaultColumnProps:n,selectionVisible:a,selectorCellShadowVisible:l,scrollDiff:r,ref:s}){let c=r<0;return lt(Pa,{ref:s,className:Ra("mantine-datatable-footer",e),style:[{position:c?"relative":"sticky",bottom:Ma(c?r:0)},t],children:ka(va,{children:[a&&lt(Ut,{shadowVisible:l}),o.map(({hidden:p,...d})=>{if(p)return null;let{accessor:T,visibleMediaQuery:b,textAlign:f,width:g,footer:R,footerClassName:C,footerStyle:w,noWrap:M,ellipsis:D}={...n,...d};return lt(Qt,{className:C,style:w,visibleMediaQuery:b,textAlign:f,width:g,title:R,noWrap:M,ellipsis:D},T)})]})})}import{Checkbox as ar,Group as rr,Popover as lr,PopoverDropdown as ir,PopoverTarget as sr,Stack as cr,TableThead as dr,TableTr as fo}from"@mantine/core";import ur from"clsx";import{useState as mr}from"react";import{TableTh as Ea}from"@mantine/core";import Na from"clsx";import{useMemo as Jt}from"react";import{jsx as La}from"react/jsx-runtime";function Zt({group:{id:e,columns:t,title:o,textAlign:n,className:a,style:l}}){let r=Jt(()=>t.map(({visibleMediaQuery:p})=>p),[t]),s=_t(r),c=Jt(()=>t.filter(({hidden:p},d)=>!p&&s?.[d]).length,[t,s]);return c>0?La(Ea,{colSpan:c,className:Na("mantine-datatable-column-group-header-cell",{[J]:n==="left",[Z]:n==="center",[Y]:n==="right"},a),style:l,children:o??me(e)}):null}import{ActionIcon as co,Box as Ka,Center as Be,Flex as Ja,Group as Za,TableTh as Ya}from"@mantine/core";import Fe from"clsx";import{useRef as qa,useState as ja}from"react";import{ActionIcon as Ia,Popover as Oa,PopoverDropdown as Aa,PopoverTarget as za}from"@mantine/core";import{useClickOutside as _a,useDisclosure as Va}from"@mantine/hooks";import{jsx as Yt,jsxs as Wa}from"react/jsx-runtime";function qt(){return Wa("svg",{width:"14",height:"14",viewBox:"0 0 24 24",strokeWidth:"2",stroke:"currentColor",fill:"none",strokeLinecap:"round",strokeLinejoin:"round",children:[Yt("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),Yt("path",{d:"M4 4h16v2.172a2 2 0 0 1 -.586 1.414l-4.414 4.414v7l-6 2v-8.5l-4.48 -4.928a2 2 0 0 1 -.52 -1.345v-2.227z"})]})}import{jsx as jt,jsxs as Ha}from"react/jsx-runtime";function eo(){return Ha("svg",{width:"14",height:"14",viewBox:"0 0 24 24",strokeWidth:"2",stroke:"currentColor",fill:"none",strokeLinecap:"round",strokeLinejoin:"round",children:[jt("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),jt("path",{d:"M20 3h-16a1 1 0 0 0 -1 1v2.227l.008 .223a3 3 0 0 0 .772 1.795l4.22 4.641v8.114a1 1 0 0 0 1.316 .949l6 -2l.108 -.043a1 1 0 0 0 .576 -.906v-6.586l4.121 -4.12a3 3 0 0 0 .879 -2.123v-2.171a1 1 0 0 0 -1 -1z",strokeWidth:"0",fill:"currentColor"})]})}import{jsx as ze,jsxs as Ba}from"react/jsx-runtime";function to({children:e,isActive:t,filterPopoverProps:o,filterPopoverDisableClickOutside:n}){let[a,{close:l,toggle:r}]=Va(!1),s=t?eo:qt,c=_a(l);return n&&(c=void 0),Ba(Oa,{withArrow:!0,shadow:"md",opened:a,onClose:l,trapFocus:!0,...o,children:[ze(za,{children:ze(Ia,{className:"mantine-datatable-header-cell-filter-action-icon","data-active":t||void 0,size:"sm",variant:"default",onClick:p=>{p.preventDefault(),r()},onKeyDown:p=>p.stopPropagation(),children:ze(s,{})})}),ze(Aa,{ref:c,onClick:p=>p.stopPropagation(),onKeyDown:p=>p.stopPropagation(),children:typeof e=="function"?e({close:l}):e})]})}import{useCallback as oo,useRef as no,useState as Fa}from"react";import{jsx as Ga}from"react/jsx-runtime";var ao=e=>{let{accessor:t,columnRef:o}=e,[n,a]=Fa(!1),l=no(0),r=no({current:0,next:0}),{setMultipleColumnWidths:s}=ue(),c=oo(d=>{if(d.preventDefault(),d.stopPropagation(),!o.current)return;let T=o.current,b=T.nextElementSibling;for(;b;){let D=b.getAttribute("data-accessor");if(D&&D!=="__selection__")break;b=b.nextElementSibling}if(!b)return;let f=b.getAttribute("data-accessor");if(!f)return;let g=f==="__selection__";a(!0),l.current=d.clientX;let R=T.offsetWidth,C=b.offsetWidth;r.current={current:R,next:C};let w=D=>{if(!o.current)return;let S=o.current,E=S.nextElementSibling;if(!E)return;let W=D.clientX-l.current,v=50,u=r.current.current-v,y=r.current.next-v,m=Math.max(-u,Math.min(W,y)),i=r.current.current+m,h=r.current.next-m;S.style.width=`${i}px`,E.style.width=`${h}px`,S.style.minWidth=`${i}px`,S.style.maxWidth=`${i}px`,E.style.minWidth=`${h}px`,E.style.maxWidth=`${h}px`},M=()=>{if(!o.current)return;let D=o.current,S=D.nextElementSibling;a(!1),document.body.style.cursor="initial",document.body.style.userSelect="initial";let E=parseInt(D.style.width)||D.offsetWidth,W=S?parseInt(S.style.width)||S.offsetWidth:0,v=[{accessor:t,width:`${E}px`}];if(S&&!g){let u=S.getAttribute("data-accessor");u&&v.push({accessor:u,width:`${W}px`})}setTimeout(()=>{s(v)},0),document.removeEventListener("mousemove",w),document.removeEventListener("mouseup",M)};document.body.style.cursor="col-resize",document.body.style.userSelect="none",document.addEventListener("mousemove",w),document.addEventListener("mouseup",M)},[t,s]),p=oo(()=>{if(!o.current)return;let d=o.current,T=d.nextElementSibling;d.style.width="",d.style.minWidth="",d.style.maxWidth="";let b=[{accessor:t,width:"initial"}];if(T){T.style.width="",T.style.minWidth="",T.style.maxWidth="";let f=T.getAttribute("data-accessor");f&&f!=="__selection__"&&b.push({accessor:f,width:"initial"})}setTimeout(()=>{s(b)},0)},[t,s]);return Ga("div",{className:"mantine-datatable-header-resizable-handle",style:{cursor:n?"col-resize":void 0},onMouseDown:c,onDoubleClick:p,onClick:d=>d.stopPropagation(),title:"Drag to resize column, double-click to reset"})};import{jsx as _e,jsxs as Xa}from"react/jsx-runtime";function ro(){return Xa("svg",{width:"14",height:"14",viewBox:"0 0 24 24",strokeWidth:"2",stroke:"currentColor",fill:"none",strokeLinecap:"round",strokeLinejoin:"round",children:[_e("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),_e("path",{d:"M12 5l0 14"}),_e("path",{d:"M16 9l-4 -4"}),_e("path",{d:"M8 9l4 -4"})]})}import{jsx as Ve,jsxs as $a}from"react/jsx-runtime";function lo(){return $a("svg",{width:"14",height:"14",viewBox:"0 0 24 24",strokeWidth:"2",stroke:"currentColor",fill:"none",strokeLinecap:"round",strokeLinejoin:"round",children:[Ve("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),Ve("path",{d:"M8 7l4 -4l4 4"}),Ve("path",{d:"M8 17l4 4l4 -4"}),Ve("path",{d:"M12 3l0 18"})]})}import{jsx as ie,jsxs as Qa}from"react/jsx-runtime";function io(){return Qa("svg",{width:"14",height:"14",viewBox:"0 0 24 24",strokeWidth:"2",stroke:"currentColor",fill:"none",strokeLinecap:"round",strokeLinejoin:"round",children:[ie("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),ie("path",{d:"M9 5m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0"}),ie("path",{d:"M9 12m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0"}),ie("path",{d:"M9 19m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0"}),ie("path",{d:"M15 5m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0"}),ie("path",{d:"M15 12m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0"}),ie("path",{d:"M15 19m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0"})]})}import{jsx as it,jsxs as Ua}from"react/jsx-runtime";function so(){return Ua("svg",{width:"14",height:"14",viewBox:"0 0 24 24",strokeWidth:"2",stroke:"currentColor",fill:"none",strokeLinecap:"round",strokeLinejoin:"round",children:[it("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),it("path",{d:"M18 6l-12 12"}),it("path",{d:"M6 6l12 12"})]})}import{Fragment as er,jsx as H,jsxs as st}from"react/jsx-runtime";function uo({className:e,style:t,accessor:o,visibleMediaQuery:n,title:a,sortable:l,draggable:r,toggleable:s,resizable:c,sortIcons:p,textAlign:d,width:T,sortStatus:b,onSortStatusChange:f,filter:g,filterPopoverProps:R,filterPopoverDisableClickOutside:C,filtering:w,sortKey:M}){let{setSourceColumn:D,setTargetColumn:S,swapColumns:E,setColumnsToggle:W}=ue(),[v,u]=ja(!1),y=qa(null);if(!K(n))return null;let m=a??me(o),i=typeof m=="string"?m:void 0,h=l&&f?N=>{N?.defaultPrevented||f({sortKey:M,columnAccessor:o,direction:b?.columnAccessor===o?b.direction==="asc"?"desc":"asc":b?.direction??"asc"})}:void 0,P=N=>{N.stopPropagation(),D(o),u(!1)},_=N=>{N.preventDefault(),S(o),u(!0)},V=()=>{S(o),u(!1),E()},Q=()=>{u(!0)},B=()=>{u(!1)},G=N=>{N.stopPropagation(),W(j=>j.map(X=>X.accessor===o?{...X,toggled:!1}:X))};return st(Ya,{"data-accessor":o,className:Fe({"mantine-datatable-header-cell-sortable":l,"mantine-datatable-header-cell-toggleable":s,"mantine-datatable-header-cell-resizable":c},e),style:[{width:T,...c?{minWidth:"1px"}:{minWidth:T,maxWidth:T}},t],role:l?"button":void 0,tabIndex:l?0:void 0,onClick:h,onKeyDown:N=>N.key==="Enter"&&h?.(),ref:y,children:[st(Za,{className:"mantine-datatable-header-cell-sortable-group",justify:"space-between",wrap:"nowrap",children:[st(Ja,{align:"center",w:"100%",className:Fe({"mantine-datatable-header-cell-draggable":r,"mantine-datatable-header-cell-drag-over":v}),draggable:r,onDragStart:r?P:void 0,onDragEnter:r?Q:void 0,onDragOver:r?_:void 0,onDrop:r?V:void 0,onDragLeave:r?B:void 0,children:[r?H(Be,{role:"img","aria-label":"Drag column",children:H(co,{className:"mantine-datatable-header-cell-draggable-action-icon",variant:"subtle",size:"xs",onClick:N=>{N.stopPropagation()},children:H(io,{})})}):null,H(Ka,{className:Fe("mantine-datatable-header-cell-sortable-text",{[J]:d==="left",[Z]:d==="center",[Y]:d==="right"},pe,fe),title:i,children:m})]}),s?H(Be,{className:"mantine-datatable-header-cell-toggleable-icon",role:"img","aria-label":"Toggle column",children:H(co,{size:"xs",variant:"light",onClick:G,children:H(so,{})})}):null,l||b?.columnAccessor===o?H(er,{children:b?.columnAccessor===o?H(Be,{className:Fe("mantine-datatable-header-cell-sortable-icon",{"mantine-datatable-header-cell-sortable-icon-reversed":b.direction==="desc"}),role:"img","aria-label":`Sorted ${b.direction==="desc"?"descending":"ascending"}`,children:p?.sorted||H(ro,{})}):H(Be,{className:"mantine-datatable-header-cell-sortable-unsorted-icon",role:"img","aria-label":"Not sorted",children:p?.unsorted||H(lo,{})})}):null,g?H(to,{filterPopoverProps:R,isActive:!!w,filterPopoverDisableClickOutside:C,children:g}):null]}),c&&o!=="__selection__"?H(ao,{accessor:o,columnRef:y}):null]})}import{Checkbox as tr,TableTh as or}from"@mantine/core";import nr from"clsx";import{jsx as mo}from"react/jsx-runtime";function po({className:e,style:t,trigger:o,shadowVisible:n,checked:a,indeterminate:l,checkboxProps:r,onChange:s,rowSpan:c,ref:p}){let d=!r.disabled;return mo(or,{ref:p,className:nr("mantine-datatable-header-selector-cell",{[F]:o==="cell"&&d},e),style:t,rowSpan:c,"data-shadow-visible":n||void 0,"data-accessor":"__selection__",onClick:o==="cell"&&d?s:void 0,children:mo(tr,{classNames:d?{input:F}:void 0,checked:a,indeterminate:l,onChange:s,...r,disabled:!(s||r.onChange)||r.disabled})})}import{jsx as q,jsxs as Ge}from"react/jsx-runtime";function bo({selectionColumnHeaderRef:e,className:t,style:o,sortStatus:n,sortIcons:a,onSortStatusChange:l,columns:r,defaultColumnProps:s,groups:c,selectionTrigger:p,selectionVisible:d,selectionChecked:T,selectionIndeterminate:b,onSelectionChange:f,selectionCheckboxProps:g,selectorCellShadowVisible:R,selectionColumnClassName:C,selectionColumnStyle:w,ref:M}){let D=d?q(po,{ref:e,className:C,style:w,trigger:p,shadowVisible:R,checked:T,indeterminate:b,checkboxProps:g,onChange:f,rowSpan:c?2:void 0}):null,{columnsToggle:S,setColumnsToggle:E}=ue(),[W,v]=mr(!1),u=r.some(i=>i.toggleable),y=u?Object.fromEntries(r.map(({accessor:i,title:h})=>[i,h??me(String(i))])):void 0,m=Ge(dr,{className:ur("mantine-datatable-header",t),style:o,ref:M,onContextMenu:u?i=>{i.preventDefault(),v(h=>!h)}:void 0,children:[c&&Ge(fo,{children:[D,c.map(i=>q(Zt,{group:i},i.id))]}),Ge(fo,{children:[!c&&D,r.map(({hidden:i,...h},P)=>{if(i)return null;let{accessor:_,visibleMediaQuery:V,textAlign:Q,width:B,title:G,sortable:N,draggable:j,toggleable:X,resizable:be,titleClassName:Te,titleStyle:ge,filter:he,filterPopoverProps:ee,filterPopoverDisableClickOutside:Ce,filtering:ye,sortKey:$}={...s,...h};return q(uo,{accessor:_,className:Te,style:ge,visibleMediaQuery:V,textAlign:Q,width:B,title:G,sortable:N,draggable:j,toggleable:X,resizable:be&&P<r.length-1,sortStatus:n,sortIcons:a,sortKey:$,onSortStatusChange:l,filter:he,filterPopoverProps:ee,filterPopoverDisableClickOutside:Ce,filtering:ye},_)})]})]});return u?Ge(lr,{position:"bottom",withArrow:!0,shadow:"md",opened:W,onChange:v,children:[q(sr,{children:m}),q(ir,{children:q(cr,{children:S.filter(i=>i.toggleable).map(i=>q(rr,{children:q(ar,{classNames:{label:"mantine-datatable-header-column-toggle-checkbox-label"},size:"xs",label:y[i.accessor],checked:i.toggled,onChange:h=>{E(S.map(P=>P.accessor===i.accessor?{...P,toggled:h.currentTarget.checked}:P))}})},i.accessor))})})]}):m}import{Center as pr,Loader as fr}from"@mantine/core";import br from"clsx";import{jsx as To}from"react/jsx-runtime";function go({pt:e,pb:t,fetching:o,customContent:n,backgroundBlur:a,size:l,type:r,color:s}){return To(pr,{pt:e,pb:t,className:br("mantine-datatable-loader",{"mantine-datatable-loader-fetching":o}),style:[{backdropFilter:a?`blur(${a}px)`:void 0}],children:o&&(n||To(fr,{size:l,type:r,color:s}))})}import{Box as Pr,Pagination as vr,Text as Mr,rem as Rr}from"@mantine/core";import Po from"clsx";import{Button as hr,Group as Cr,Menu as yr,MenuDropdown as xr,MenuItem as Dr,MenuTarget as wr,Text as xo,rem as Me}from"@mantine/core";import Sr from"clsx";import{parseThemeColor as Tr}from"@mantine/core";function k(e,t,o){return e?Tr({color:typeof e=="object"?e[o]:e,theme:t}).value:void 0}function ho({theme:e,c:t,backgroundColor:o,borderColor:n,rowBorderColor:a,stripedColor:l,highlightOnHoverColor:r}){return{"--mantine-datatable-color-light":k(t,e,"light"),"--mantine-datatable-color-dark":k(t,e,"dark"),"--mantine-datatable-background-color-light":k(o,e,"light"),"--mantine-datatable-background-color-dark":k(o,e,"dark"),"--mantine-datatable-border-color-light":k(n,e,"light"),"--mantine-datatable-border-color-dark":k(n,e,"dark"),"--mantine-datatable-row-border-color-light":k(a,e,"light"),"--mantine-datatable-row-border-color-dark":k(a,e,"dark"),"--mantine-datatable-striped-color-light":k(l,e,"light"),"--mantine-datatable-striped-color-dark":k(l,e,"dark"),"--mantine-datatable-highlight-on-hover-color-light":k(r,e,"light"),"--mantine-datatable-highlight-on-hover-color-dark":k(r,e,"dark")}}function Xe({theme:e,paginationActiveTextColor:t,paginationActiveBackgroundColor:o}){return{"--mantine-datatable-pagination-active-text-color-light":k(t,e,"light"),"--mantine-datatable-pagination-active-text-color-dark":k(t,e,"dark"),"--mantine-datatable-pagination-active-background-color-light":k(o,e,"light"),"--mantine-datatable-pagination-active-background-color-dark":k(o,e,"dark")}}function Co({theme:e,color:t,backgroundColor:o}){return{"--mantine-datatable-row-color-light":k(t,e,"light"),"--mantine-datatable-row-color-dark":k(t,e,"dark"),"--mantine-datatable-row-background-color-light":k(o,e,"light"),"--mantine-datatable-row-background-color-dark":k(o,e,"dark")}}import{jsx as ct,jsxs as gr}from"react/jsx-runtime";function yo(){return gr("svg",{width:"14",height:"14",viewBox:"0 0 24 24",strokeWidth:"2",stroke:"currentColor",fill:"none",strokeLinecap:"round",strokeLinejoin:"round",children:[ct("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),ct("path",{d:"M8 9l4 -4l4 4"}),ct("path",{d:"M16 15l-4 4l-4 -4"})]})}import{jsx as se,jsxs as wo}from"react/jsx-runtime";var Do={xs:Me(22),sm:Me(26),md:Me(32),lg:Me(38),xl:Me(44)};function So({size:e,label:t,values:o,value:n,activeTextColor:a,activeBackgroundColor:l,onChange:r}){return wo(Cr,{gap:"xs",children:[se(xo,{component:"div",size:e,children:t}),wo(yr,{withinPortal:!0,withArrow:!0,offset:2,classNames:{arrow:"mantine-datatable-page-size-selector-menu-arrow"},children:[se(wr,{children:se(hr,{size:e,variant:"default",classNames:{section:"mantine-datatable-page-size-selector-button-icon"},rightSection:se(yo,{}),style:[{fontWeight:"normal"},s=>({height:Do[e],paddingLeft:s.spacing[e],paddingRight:s.spacing[e]})],children:n})}),se(xr,{children:o.map(s=>{let c=s===n;return se(Dr,{className:Sr({"mantine-datatable-page-size-selector-active":c}),style:[{height:Do[e]},c&&(a||l)?p=>Xe({theme:p,paginationActiveTextColor:a,paginationActiveBackgroundColor:l}):void 0],disabled:c,onClick:()=>r(s),children:se(xo,{component:"div",size:e,children:s})},s)})})]})]})}import{jsx as dt,jsxs as kr}from"react/jsx-runtime";function vo({className:e,style:t,fetching:o,page:n,onPageChange:a,paginationWithEdges:l,paginationWithControls:r,paginationActiveTextColor:s,paginationActiveBackgroundColor:c,paginationSize:p,loadingText:d,noRecordsText:T,paginationText:b,totalRecords:f,recordsPerPage:g,onRecordsPerPageChange:R,recordsPerPageLabel:C,recordsPerPageOptions:w,recordsLength:M,horizontalSpacing:D,paginationWrapBreakpoint:S,getPaginationControlProps:E,ref:W}){let v;if(f){let y=(n-1)*g+1,m=y+(M||0)-1;v=b({from:y,to:m,totalRecords:f})}else v=o?d:T;let u=K(({breakpoints:y})=>`(min-width: ${typeof S=="number"?`${Rr(S)}rem`:y[S]||S})`);return kr(Pr,{ref:W,px:D??"xs",py:"xs",className:Po("mantine-datatable-pagination",e),style:[{flexDirection:u?"row":"column"},t],children:[dt(Mr,{component:"div",className:"mantine-datatable-pagination-text",size:p,children:v}),w&&dt(So,{activeTextColor:s,activeBackgroundColor:c,size:p,label:C,values:w,value:g,onChange:R}),dt(vr,{classNames:{root:Po("mantine-datatable-pagination-pages",{"mantine-datatable-pagination-pages-fetching":o||!M}),control:"mantine-datatable-pagination-pages-control"},style:s||c?y=>Xe({theme:y,paginationActiveTextColor:s,paginationActiveBackgroundColor:c}):void 0,withEdges:l,withControls:r,value:n,onChange:a,size:p,total:Math.ceil(f/g),getControlProps:E})]})}import{TableTr as Vr}from"@mantine/core";import Br from"clsx";import{TableTd as Er}from"@mantine/core";import Nr from"clsx";import{jsx as Lr}from"react/jsx-runtime";function Mo({className:e,style:t,visibleMediaQuery:o,record:n,index:a,onClick:l,onDoubleClick:r,onContextMenu:s,noWrap:c,ellipsis:p,textAlign:d,width:T,accessor:b,render:f,defaultRender:g,customCellAttributes:R}){return K(o)?Lr(Er,{className:Nr({[pe]:c||p,[fe]:p,[F]:l||r,[Ae]:s,[J]:d==="left",[Z]:d==="center",[Y]:d==="right"},e),style:[{width:T,minWidth:T,maxWidth:T},t],onClick:l,onDoubleClick:r,onContextMenu:s,...R?.(n,a),children:f?f(n,a):g?g(n,a,b):rt(n,b)}):null}import{Collapse as Wr,TableTd as Hr,TableTr as Ro}from"@mantine/core";import{Fragment as Ir,jsx as Re,jsxs as Or}from"react/jsx-runtime";function ko({open:e,colSpan:t,content:o,collapseProps:n}){let{expanded:a,visible:l}=Xt(e,n?.transitionDuration);return l?Or(Ir,{children:[Re(Ro,{}),Re(Ro,{children:Re(Hr,{className:"mantine-datatable-row-expansion-cell",colSpan:t,children:Re(Wr,{in:a,...n,children:Re("div",{className:"mantine-datatable-row-expansion-cell-content",children:o()})})})})]}):null}import{Checkbox as Ar,TableTd as zr}from"@mantine/core";import _r from"clsx";import{jsx as Eo}from"react/jsx-runtime";function No({className:e,style:t,record:o,index:n,trigger:a,onChange:l,withRightShadow:r,checkboxProps:s,getCheckboxProps:c,...p}){let d={...s,...c(o,n)},T=!p.disabled&&!d.disabled,b=f=>{f.stopPropagation(),a==="cell"&&T&&l?.(f)};return Eo(zr,{className:_r("mantine-datatable-row-selector-cell",{[F]:a==="cell"&&T},e),style:t,"data-shadow-visible":r||void 0,onClick:b,children:Eo(Ar,{classNames:T?{input:F}:void 0,onChange:l,...p,...d})})}import{Fragment as Lo,jsx as $e,jsxs as Wo}from"react/jsx-runtime";function Ho({record:e,index:t,columns:o,defaultColumnProps:n,defaultColumnRender:a,selectionTrigger:l,selectionVisible:r,selectionChecked:s,onSelectionChange:c,isRecordSelectable:p,selectionCheckboxProps:d,getSelectionCheckboxProps:T,onClick:b,onDoubleClick:f,onContextMenu:g,onCellClick:R,onCellDoubleClick:C,onCellContextMenu:w,expansion:M,customAttributes:D,color:S,backgroundColor:E,className:W,style:v,selectorCellShadowVisible:u,selectionColumnClassName:y,selectionColumnStyle:m,rowFactory:i}){let h=Wo(Lo,{children:[r&&$e(No,{className:y,style:m,record:e,index:t,trigger:l,withRightShadow:u,checked:s,disabled:!c||(p?!p(e,t):!1),onChange:c,checkboxProps:d,getCheckboxProps:T}),o.map(({hidden:V,hiddenContent:Q,...B},G)=>{if(V||Q)return null;let{accessor:N,visibleMediaQuery:j,textAlign:X,noWrap:be,ellipsis:Te,width:ge,render:he,cellsClassName:ee,cellsStyle:Ce,customCellAttributes:ye}={...n,...B};return $e(Mo,{className:typeof ee=="function"?ee(e,t):ee,style:Ce?.(e,t),visibleMediaQuery:j,record:e,index:t,onClick:R?$=>R({event:$,record:e,index:t,column:B,columnIndex:G}):void 0,onDoubleClick:C?$=>C({event:$,record:e,index:t,column:B,columnIndex:G}):void 0,onContextMenu:w?$=>w({event:$,record:e,index:t,column:B,columnIndex:G}):void 0,accessor:N,textAlign:X,noWrap:be,ellipsis:Te,width:ge,render:he,defaultRender:a,customCellAttributes:ye},N)})]}),P=M&&$e(ko,{colSpan:o.filter(({hidden:V})=>!V).length+(r?1:0),open:M.isRowExpanded(e),content:M.content({record:e,index:t}),collapseProps:M.collapseProps}),_=Fr({record:e,index:t,selectionChecked:s,onClick:b,onDoubleClick:f,onContextMenu:g,expansion:M,customAttributes:D,color:S,backgroundColor:E,className:W,style:v});return i?i({record:e,index:t,rowProps:_,children:h,expandedElement:P}):Wo(Lo,{children:[$e(Vr,{..._,children:h}),P]})}function Fr({record:e,index:t,selectionChecked:o,onClick:n,onDoubleClick:a,onContextMenu:l,expansion:r,customAttributes:s,color:c,backgroundColor:p,className:d,style:T}){return{className:Br("mantine-datatable-row",{[F]:n||a||r?.isExpandable({record:e,index:t})&&r?.expandOnClick},{[Ae]:l},typeof d=="function"?d(e,t):d),"data-selected":o||void 0,onClick:b=>{if(r){let{isExpandable:f,isRowExpanded:g,expandOnClick:R,expandRow:C,collapseRow:w}=r;f({record:e,index:t})&&R&&(g(e)?w(e):C(e))}n?.({event:b,record:e,index:t})},onDoubleClick:a?b=>a({event:b,record:e,index:t}):void 0,onContextMenu:l?b=>l({event:b,record:e,index:t}):void 0,style:[c||p?b=>{let f=c?.(e,t),g=p?.(e,t);return Co({theme:b,color:f,backgroundColor:g})}:void 0,T?.(e,t)],...s?.(e,t)??{}}}import{Box as Io,ScrollArea as Gr,rem as Oo}from"@mantine/core";import Qe from"clsx";import{jsx as Ue,jsxs as Xr}from"react/jsx-runtime";function Ao({topShadowVisible:e,leftShadowVisible:t,leftShadowBehind:o,rightShadowVisible:n,rightShadowBehind:a,bottomShadowVisible:l,headerHeight:r,footerHeight:s,onScrollPositionChange:c,children:p,viewportRef:d,scrollAreaProps:T}){return Xr(Gr,{...T,viewportRef:d,classNames:{root:"mantine-datatable-scroll-area",scrollbar:"mantine-datatable-scroll-area-scrollbar",thumb:"mantine-datatable-scroll-area-thumb",corner:"mantine-datatable-scroll-area-corner"},onScrollPositionChange:c,children:[p,Ue(Io,{className:Qe("mantine-datatable-scroll-area-shadow","mantine-datatable-scroll-area-top-shadow",{"mantine-datatable-scroll-area-shadow-visible":e}),style:{top:r?Oo(r):0}}),Ue("div",{className:Qe("mantine-datatable-scroll-area-shadow","mantine-datatable-scroll-area-left-shadow",{"mantine-datatable-scroll-area-shadow-visible":t,"mantine-datatable-scroll-area-shadow-behind":o})}),Ue("div",{className:Qe("mantine-datatable-scroll-area-shadow","mantine-datatable-scroll-area-right-shadow",{"mantine-datatable-scroll-area-shadow-visible":n,"mantine-datatable-scroll-area-shadow-behind":a})}),Ue(Io,{className:Qe("mantine-datatable-scroll-area-shadow","mantine-datatable-scroll-area-bottom-shadow",{"mantine-datatable-scroll-area-shadow-visible":l}),style:{bottom:s?Oo(s+1):0}})]})}import{jsx as O,jsxs as Bo}from"react/jsx-runtime";function Kr({withTableBorder:e,borderRadius:t,textSelectionDisabled:o,height:n="100%",minHeight:a,maxHeight:l,shadow:r,verticalAlign:s="center",fetching:c,columns:p,storeColumnsKey:d,groups:T,pinFirstColumn:b,pinLastColumn:f,defaultColumnProps:g,defaultColumnRender:R,idAccessor:C="id",records:w,selectionTrigger:M="checkbox",selectedRecords:D,onSelectedRecordsChange:S,selectionColumnClassName:E,selectionColumnStyle:W,isRecordSelectable:v,selectionCheckboxProps:u,allRecordsSelectionCheckboxProps:y={"aria-label":"Select all records"},getRecordSelectionCheckboxProps:m=(I,te)=>({"aria-label":`Select record ${te+1}`}),sortStatus:i,sortIcons:h,onSortStatusChange:P,horizontalSpacing:_,page:V,onPageChange:Q,totalRecords:B,recordsPerPage:G,onRecordsPerPageChange:N,recordsPerPageOptions:j,recordsPerPageLabel:X="Records per page",paginationWithEdges:be,paginationWithControls:Te,paginationActiveTextColor:ge,paginationActiveBackgroundColor:he,paginationSize:ee="sm",paginationText:Ce=({from:I,to:te,totalRecords:oe})=>`${I} - ${te} / ${oe}`,paginationWrapBreakpoint:ye="sm",getPaginationControlProps:$=I=>I==="previous"?{"aria-label":"Previous page"}:I==="next"?{"aria-label":"Next page"}:{},loaderBackgroundBlur:Fo,customLoader:Go,loaderSize:Xo,loaderType:$o,loaderColor:Qo,loadingText:Uo="...",emptyState:Ko,noRecordsText:ut="No records",noRecordsIcon:Jo,highlightOnHover:Zo,striped:Yo,noHeader:qo,onRowClick:jo,onRowDoubleClick:en,onRowContextMenu:tn,onCellClick:on,onCellDoubleClick:nn,onCellContextMenu:an,onScroll:mt,onScrollToTop:pt,onScrollToBottom:ft,onScrollToLeft:bt,onScrollToRight:Tt,c:rn,backgroundColor:ln,borderColor:sn,rowBorderColor:cn,stripedColor:dn,highlightOnHoverColor:un,rowColor:mn,rowBackgroundColor:pn,rowExpansion:fn,rowClassName:bn,rowStyle:Tn,customRowAttributes:gn,scrollViewportRef:hn,scrollAreaProps:Cn,tableRef:yn,bodyRef:xn,m:Dn,my:wn,mx:Sn,mt:Pn,mb:vn,ml:Mn,mr:Rn,className:kn,classNames:xe,style:En,styles:De,rowFactory:Nn,tableWrapper:Je,...gt}){let{ref:I,width:te,height:oe}=le(),ne=Vo(()=>T?.flatMap(x=>x.columns)??p,[p,T]),Ln=Vo(()=>ne.some(x=>x.resizable),[ne]),ht=Ht({key:d,columns:ne}),{ref:Wn,height:Ze}=le(),{ref:Hn,width:Ye,height:we}=le(),{ref:In,height:On}=le(),{ref:An,height:Ct}=le(),{ref:zn,width:_n}=le(),Vn=zo(Hn,yn),Bn=zo(I,hn),[qe,yt]=Ke(!0),[je,xt]=Ke(!0),[Se,Dt]=Ke(!0),[Ee,wt]=Ke(!0),Fn=Bt({rowExpansion:fn,records:w,idAccessor:C}),et=ke(()=>{let x=I.current?.scrollTop??0,U=I.current?.scrollLeft??0;if(c||we<=oe)yt(!0),xt(!0);else{let A=x===0,z=we-x-oe<1;yt(A),xt(z),A&&A!==qe&&pt?.(),z&&z!==je&&ft?.()}if(c||Ye===te)Dt(!0),wt(!0);else{let A=U===0,z=Ye-U-te<1;Dt(A),wt(z),A&&A!==Se&&bt?.(),z&&z!==Ee&&Tt?.()}},[c,ft,bt,Tt,pt,oe,I,te,je,Se,Ee,qe,we,Ye]);It(et,[et]);let St=Ur(et,50),Gn=ke(x=>{mt?.(x),St()},[St,mt]),Xn=ke(x=>{I.current?.scrollTo({top:0,left:0}),Q(x)},[Q,I]),Ne=w?.length,Pt=w?.map(x=>L(x,C)),ce=!!D,Pe=D?.map(x=>L(x,C)),vt=Pt!==void 0&&Pe!==void 0&&Pe.length>0,tt=v?w?.filter(v):w,Le=tt?.map(x=>L(x,C)),We=vt&&Le.every(x=>Pe.includes(x)),$n=vt&&Le.some(x=>Pe.includes(x)),Qn=ke(()=>{D&&S&&S(We?D.filter(x=>!Le.includes(L(x,C))):Oe([...D,...tt],x=>L(x,C)))},[We,C,S,Le,tt,D]),{lastSelectionChangeIndex:He,setLastSelectionChangeIndex:Un}=Ot(Pt),ot=ce&&!Se&&!b,Kn={m:Dn,my:wn,mx:Sn,mt:Pn,mb:vn,ml:Mn,mr:Rn},Jn=ke(({children:x})=>Je?Je({children:x}):x,[Je]);return O(nt,{...ht,children:Bo($r,{...Kn,className:_o("mantine-datatable",{"mantine-datatable-with-border":e},kn,xe?.root),style:[x=>({...ho({theme:x,c:rn,backgroundColor:ln,borderColor:sn,rowBorderColor:cn,stripedColor:dn,highlightOnHoverColor:un}),borderRadius:x.radius[t]||t,boxShadow:x.shadows[r]||r,height:n,minHeight:a,maxHeight:l}),En,De?.root,{position:"relative"}],children:[O(Ao,{viewportRef:Bn,topShadowVisible:!qe,leftShadowVisible:!Se,leftShadowBehind:ce||!!b,rightShadowVisible:!Ee,rightShadowBehind:f,bottomShadowVisible:!je,headerHeight:Ze,footerHeight:On,onScrollPositionChange:Gn,scrollAreaProps:Cn,children:O(Jn,{children:Bo(Qr,{ref:Vn,horizontalSpacing:_,className:_o("mantine-datatable-table",{[$t]:o,"mantine-datatable-vertical-align-top":s==="top","mantine-datatable-vertical-align-bottom":s==="bottom","mantine-datatable-last-row-border-bottom-visible":gt.withRowBorders&&we<oe,"mantine-datatable-pin-last-column":f,"mantine-datatable-pin-last-column-scrolled":!Ee&&f,"mantine-datatable-selection-column-visible":ce,"mantine-datatable-pin-first-column":b,"mantine-datatable-pin-first-column-scrolled":!Se&&b,"mantine-datatable-resizable-columns":Ln},xe?.table),style:{...De?.table,"--mantine-datatable-selection-column-width":`${_n}px`},"data-striped":Ne&&Yo||void 0,"data-highlight-on-hover":Zo||void 0,...gt,children:[qo?null:O(nt,{...ht,children:O(bo,{ref:Wn,selectionColumnHeaderRef:zn,className:xe?.header,style:De?.header,columns:ne,defaultColumnProps:g,groups:T,sortStatus:i,sortIcons:h,onSortStatusChange:P,selectionTrigger:M,selectionVisible:ce,selectionChecked:We,selectionIndeterminate:$n&&!We,onSelectionChange:Qn,selectionCheckboxProps:{...u,...y},selectorCellShadowVisible:ot,selectionColumnClassName:E,selectionColumnStyle:W})}),O("tbody",{ref:xn,children:Ne?w.map((x,U)=>{let A=L(x,C),z=Pe?.includes(A)||!1,Mt;return S&&D&&(Mt=Zn=>{if(Zn.nativeEvent.shiftKey&&He!==null){let de=w.filter(U>He?(ae,re)=>re>=He&&re<=U&&(v?v(ae,re):!0):(ae,re)=>re>=U&&re<=He&&(v?v(ae,re):!0));S(z?Vt(D,de,ae=>L(ae,C)):Oe([...D,...de],ae=>L(ae,C)))}else S(z?D.filter(de=>L(de,C)!==A):Oe([...D,x],de=>L(de,C)));Un(U)}),O(Ho,{record:x,index:U,columns:ne,defaultColumnProps:g,defaultColumnRender:R,selectionTrigger:M,selectionVisible:ce,selectionChecked:z,onSelectionChange:Mt,isRecordSelectable:v,selectionCheckboxProps:u,getSelectionCheckboxProps:m,onClick:jo,onDoubleClick:en,onCellClick:on,onCellDoubleClick:nn,onContextMenu:tn,onCellContextMenu:an,expansion:Fn,color:mn,backgroundColor:pn,className:bn,style:Tn,customAttributes:gn,selectorCellShadowVisible:ot,selectionColumnClassName:E,selectionColumnStyle:W,idAccessor:C,rowFactory:Nn},A)}):O(Nt,{})}),ne.some(({footer:x})=>x)&&O(Kt,{ref:In,className:xe?.footer,style:De?.footer,columns:ne,defaultColumnProps:g,selectionVisible:ce,selectorCellShadowVisible:ot,scrollDiff:we-oe})]})})}),V&&O(vo,{ref:An,className:xe?.pagination,style:De?.pagination,horizontalSpacing:_,fetching:c,page:V,onPageChange:Xn,totalRecords:B,recordsPerPage:G,onRecordsPerPageChange:N,recordsPerPageOptions:j,recordsPerPageLabel:X,paginationWithEdges:be,paginationWithControls:Te,paginationActiveTextColor:ge,paginationActiveBackgroundColor:he,paginationSize:ee,paginationText:Ce,paginationWrapBreakpoint:ye,getPaginationControlProps:$,noRecordsText:ut,loadingText:Uo,recordsLength:Ne}),O(go,{pt:Ze,pb:Ct,fetching:c,backgroundBlur:Fo,customContent:Go,size:Xo,type:$o,color:Qo}),O(Wt,{pt:Ze,pb:Ct,icon:Jo,text:ut,active:!c&&!Ne,children:Ko})]})})}import{TableTr as Jr}from"@mantine/core";import{useMergedRef as Zr}from"@mantine/hooks";import{useEffect as Yr,useRef as qr}from"react";import{jsx as el}from"react/jsx-runtime";function jr({className:e,children:t,isDragging:o,ref:n,...a}){let l=qr(null),r=Zr(l,n);return Yr(()=>{if(!l.current||!o)return;let d=l.current.parentElement.parentElement.children[0].children[0];for(let T=0;T<d.children.length;T++){let f=d.children[T].getBoundingClientRect(),g=l.current.children[T];g.style.height=f.height+"px",g.style.width=f.width+"px",g.style.minWidth=f.width+"px",g.style.maxWidth=f.width+"px"}},[o,t]),el(Jr,{"data-is-dragging":o,ref:r,...a,className:e,children:t})}export{Kr as DataTable,jr as DataTableDraggableRow,Vt as differenceBy,L as getRecordId,rt as getValueAtPath,me as humanize,zl as reorderRecords,_l as swapRecords,Oe as uniqBy,Ht as useDataTableColumns};
1
+ "use client";import{Box as qr,Table as el}from"@mantine/core";import{useMergedRef as Qo}from"@mantine/hooks";import Ko from"clsx";import{useCallback as Dt,useEffect as tl,useLayoutEffect as ol,useMemo as nl,useRef as xt,useState as al}from"react";import{useState as kt}from"react";import{createSafeContext as ea}from"@mantine/core";var[Mt,ue]=ea("useDataTableColumnsContext must be used within DataTableColumnProvider");import{jsx as ta}from"react/jsx-runtime";var it=e=>{let{children:t,columnsOrder:o,setColumnsOrder:n,columnsToggle:r,setColumnsToggle:a,resetColumnsOrder:l,resetColumnsToggle:c,setColumnWidth:u,setMultipleColumnWidths:m,resetColumnsWidth:f}=e,[d,p]=kt(""),[s,i]=kt("");return ta(Mt,{value:{sourceColumn:d,setSourceColumn:p,targetColumn:s,setTargetColumn:i,columnsToggle:r,setColumnsToggle:a,swapColumns:()=>{if(!o||!n||!d||!s)return;let C=o.indexOf(d),y=o.indexOf(s);if(C!==-1&&y!==-1){let L=o.splice(C,1)[0];o.splice(y,0,L),n([...o])}},resetColumnsOrder:l,resetColumnsToggle:c,setColumnWidth:u,setMultipleColumnWidths:m,resetColumnsWidth:f},children:t})};import{jsx as Et}from"react/jsx-runtime";function Nt(){return Et("tr",{className:"mantine-datatable-empty-row",children:Et("td",{})})}import{Center as na,Text as aa}from"@mantine/core";import{jsx as Re,jsxs as oa}from"react/jsx-runtime";function Lt(){return oa("svg",{width:"24",height:"24",viewBox:"0 0 24 24",strokeWidth:"2",stroke:"currentColor",fill:"none",strokeLinecap:"round",strokeLinejoin:"round",children:[Re("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),Re("path",{d:"M12.983 8.978c3.955 -.182 7.017 -1.446 7.017 -2.978c0 -1.657 -3.582 -3 -8 -3c-1.661 0 -3.204 .19 -4.483 .515m-2.783 1.228c-.471 .382 -.734 .808 -.734 1.257c0 1.22 1.944 2.271 4.734 2.74"}),Re("path",{d:"M4 6v6c0 1.657 3.582 3 8 3c.986 0 1.93 -.067 2.802 -.19m3.187 -.82c1.251 -.53 2.011 -1.228 2.011 -1.99v-6"}),Re("path",{d:"M4 12v6c0 1.657 3.582 3 8 3c3.217 0 5.991 -.712 7.261 -1.74m.739 -3.26v-4"}),Re("path",{d:"M3 3l18 18"})]})}import{Fragment as ra,jsx as We,jsxs as la}from"react/jsx-runtime";function Wt({icon:e,text:t,active:o,children:n}){return We(na,{className:"mantine-datatable-empty-state","data-active":o||void 0,children:n||la(ra,{children:[e||We("div",{className:"mantine-datatable-empty-state-icon",children:We(Lt,{})}),We(aa,{component:"div",size:"sm",c:"dimmed",children:t})]})})}import{TableTfoot as Wa,TableTr as Ia}from"@mantine/core";import Ha from"clsx";import{TableTh as Ma}from"@mantine/core";import ka from"clsx";import{useCallback as vl,useRef as Ml,useState as kl}from"react";import{useLocalStorage as ia}from"@mantine/hooks";function It({key:e,columns:t=[],getInitialValueInEffect:o=!0}){function n(d,p){let s=[];return d.forEach(i=>{p.find(h=>h.accessor===i)&&s.push(i)}),p.forEach(i=>{s.includes(i.accessor)||s.push(i.accessor)}),s}let r=t&&t.map(d=>d.accessor)||[],[a,l]=ia({key:e?`${e}-columns-order`:"",defaultValue:e?r:void 0,getInitialValueInEffect:o});function c(d){e&&l(d)}let u=()=>{c(r)};if(!e)return{columnsOrder:a,setColumnsOrder:c,resetColumnsOrder:u};let m=n(a,t),f=JSON.stringify(a);return JSON.stringify(m)!==f&&c(m),{columnsOrder:m,setColumnsOrder:c,resetColumnsOrder:u}}import{useLocalStorage as sa}from"@mantine/hooks";import{useCallback as re,useEffect as st,useMemo as Ie,useRef as Ht,useState as _t}from"react";function Ot({key:e,columns:t=[],getInitialValueInEffect:o=!0,headerRef:n,scrollViewportRef:r,onFixedLayoutChange:a}){let l=Ht(!1),c=Ht({}),[u,m]=_t(!0),f=Ie(()=>t.some(b=>b.resizable&&!b.hidden&&b.accessor!=="__selection__"),[t]),d=Ie(()=>t.filter(b=>b.resizable&&!b.hidden&&b.accessor!=="__selection__"),[t]),p=Ie(()=>d.some(b=>b.width===void 0||b.width===""||b.width==="initial"),[d]),s=re(()=>t.filter(b=>b.accessor!=="__selection__").map(b=>({[b.accessor]:b.width??"auto"})),[t]),[i,h]=sa({key:e?`${e}-columns-width`:"",defaultValue:e?s():void 0,getInitialValueInEffect:!1}),[C,y]=_t(()=>s());st(()=>{m(!1)},[]);let L=re(()=>{if(!n?.current||u)return{};let b=n.current,P=Array.from(b.querySelectorAll("th[data-accessor]")),E={};return P.forEach(w=>{let D=w.getAttribute("data-accessor");if(!D||D==="__selection__")return;let g=d.find(N=>N.accessor===D);if(g&&(g.width===void 0||g.width===""||g.width==="initial")){let N=w.getBoundingClientRect();E[D]=Math.round(N.width)}}),E},[n,d,u]),R=re(b=>{let P=b.filter(w=>w.accessor!=="__selection__"),E=C.map(w=>{let D=Object.keys(w)[0],g=P.find(N=>N.accessor===D);return g?{[D]:g.width}:w});y(E),e&&h(E)},[C,e,h]),v=re(b=>{R(b)},[R]),M=re(()=>{if(!(!n?.current||!a||u))if(p)a(!1),requestAnimationFrame(()=>{requestAnimationFrame(()=>{let b=L();c.current={...c.current,...b};let P=t.filter(E=>E.accessor!=="__selection__").map(E=>{let w=E.accessor,D=i?.find(N=>Object.keys(N)[0]===w);if(D&&D[w]!=="auto")return{[w]:D[w]};let g=b[w];return g?{[w]:`${g}px`}:{[w]:E.width??"auto"}});y(P),setTimeout(()=>{a(!0),l.current=!0},10)})});else{let b=t.filter(P=>P.accessor!=="__selection__").map(P=>({[P.accessor]:P.width??"auto"}));y(b),a(!0),l.current=!0}},[n,a,u,p,L,t,i]),x=M;st(()=>{if(!f||!a||u){a?.(!1);return}l.current=!1;let b=setTimeout(()=>{M()},50);return()=>clearTimeout(b)},[f,a,u,M]),st(()=>{u||!e||!o||i&&i.length>0&&y(i)},[u,e,o,i]);let T=re(()=>{e&&h(s()),c.current={},l.current=!1,a&&(a(!1),setTimeout(()=>{M()},10))},[e,h,s,a,M]),S=re((b,P)=>{R([{accessor:b,width:P}])},[R]),W=Ie(()=>f?C.filter(b=>{let P=Object.keys(b)[0];return d.some(E=>E.accessor===P)}).every(b=>{let P=Object.values(b)[0];return P==="auto"||P==="initial"}):!1,[f,C,d]);return{columnsWidth:C,setColumnsWidth:R,setColumnWidth:S,setMultipleColumnWidths:v,resetColumnsWidth:T,hasResizableColumns:f,allResizableWidthsInitial:W,measureAndSetColumnWidths:x}}import{useMemo as ua}from"react";import{useLocalStorage as ca}from"@mantine/hooks";function At({key:e,columns:t=[],getInitialValueInEffect:o=!0}){function n(d,p){let s=[];return d.forEach(i=>{p.find(h=>h.accessor===i.accessor)&&s.push(i)}),p.forEach(i=>{s.find(h=>h.accessor===i.accessor)||s.push({accessor:i.accessor,defaultToggle:i.defaultToggle||!0,toggleable:i.toggleable,toggled:i.defaultToggle===void 0?!0:i.defaultToggle})}),s}let r=t&&t.map(d=>({accessor:d.accessor,defaultToggle:d.defaultToggle||!0,toggleable:d.toggleable,toggled:d.defaultToggle===void 0?!0:d.defaultToggle})),[a,l]=ca({key:e?`${e}-columns-toggle`:"",defaultValue:e?r:void 0,getInitialValueInEffect:o});function c(d){e&&l(d)}let u=()=>{c(r)};if(!e)return{columnsToggle:a,setColumnsToggle:c,resetColumnsToggle:u};let m=n(a,t),f=JSON.stringify(a);return JSON.stringify(m)!==f&&c(m),{columnsToggle:m,setColumnsToggle:c,resetColumnsToggle:u}}var zt=({key:e,columns:t=[],getInitialValueInEffect:o=!0,headerRef:n,scrollViewportRef:r,onFixedLayoutChange:a})=>{let{columnsOrder:l,setColumnsOrder:c,resetColumnsOrder:u}=It({key:e,columns:t,getInitialValueInEffect:o}),{columnsToggle:m,setColumnsToggle:f,resetColumnsToggle:d}=At({key:e,columns:t,getInitialValueInEffect:o}),{columnsWidth:p,setColumnsWidth:s,setColumnWidth:i,setMultipleColumnWidths:h,resetColumnsWidth:C,hasResizableColumns:y,allResizableWidthsInitial:L,measureAndSetColumnWidths:R}=Ot({key:e,columns:t,getInitialValueInEffect:o,headerRef:n,scrollViewportRef:r,onFixedLayoutChange:a});return{effectiveColumns:ua(()=>l?l.map(T=>t.find(S=>S.accessor===T)).map(T=>({...T,hidden:T?.hidden||!m.find(S=>S.accessor===T?.accessor)?.toggled})).map(T=>T?.accessor==="__selection__"?T:{...T,width:p.find(S=>S[T?.accessor])?.[T?.accessor]}):t,[t,l,m,p]),setColumnsOrder:c,columnsOrder:l,resetColumnsOrder:u,columnsToggle:m,setColumnsToggle:f,resetColumnsToggle:d,columnsWidth:p,setColumnsWidth:s,setColumnWidth:i,setMultipleColumnWidths:h,resetColumnsWidth:C,hasResizableColumns:y,allResizableWidthsInitial:L,measureAndSetColumnWidths:R}};import{rem as fa}from"@mantine/core";import{useCallback as ba,useEffect as dt,useRef as Q}from"react";import{useEffect as da,useLayoutEffect as ma}from"react";var ct=typeof window<"u"?ma:da;import{useRef as pa}from"react";function ut(e){let t=pa(e);return t.current=e,t}var Vt="--mantine-datatable-header-height",Bt="--mantine-datatable-footer-height",Gt="--mantine-datatable-selection-column-width",Ft="--mantine-datatable-last-row-border-bottom";function G(e,t,o){e?.style.setProperty(t,o)}function pt(e){let t=e.borderBoxSize?.[0]||e.contentBoxSize?.[0];return t?{width:t.inlineSize,height:t.blockSize}:{width:e.contentRect.width,height:e.contentRect.height}}function mt(e,t,o){if(e){let n=new ResizeObserver(r=>{let a=r[0];a&&t(pt(a))});return n.observe(e),()=>{n.disconnect(),o()}}}function $t({scrollCallbacks:e,withRowBorders:t}){let o={root:Q(null),table:Q(null),scrollViewport:Q(null),header:Q(null),footer:Q(null),selectionColumnHeader:Q(null)},{root:n,table:r,scrollViewport:a,header:l,footer:c,selectionColumnHeader:u}=o,m=ut({withRowBorders:t}),f=ut(e),d=Q(()=>{}),p=Q(()=>{}),s=ba(i=>{f.current.onScroll?.(i),d.current()},[]);return dt(()=>mt(l.current,i=>{G(n.current,Vt,`${i.height}px`)},()=>G(n.current,Vt,"0")),[l.current]),dt(()=>mt(c.current,i=>{G(n.current,Bt,`${i.height}px`)},()=>G(n.current,Bt,"0")),[c.current]),dt(()=>mt(u.current,i=>{G(n.current,Gt,`${i.width}px`)},()=>G(n.current,Gt,"0")),[u.current]),ct(()=>{if(typeof window===void 0)return;let i={top:!0,bottom:!0,left:!0,right:!0},h={width:0,height:0},C={width:0,height:0};function y(x,T){let S=i[x];return i[x]=T,G(n.current,`--mantine-datatable-${x}-shadow-opacity`,T?"0":"1"),S}function L(){let x=h.height-C.height,T=x<0;G(n.current,"--mantine-datatable-footer-position",T?"relative":"sticky"),G(n.current,"--mantine-datatable-footer-bottom",T?`${x}px`:"0")}function R(){m.current.withRowBorders&&h.height<C.height?G(n.current,Ft,`${fa("1px")} solid var(--mantine-datatable-border-color)`):G(n.current,Ft,"unset")}p.current=R;function v(){let x=f.current,T=a.current?.scrollTop??0,S=a.current?.scrollLeft??0,W=T===0,b=h.height-T-C.height<1,P=y("top",W),E=y("bottom",b);W&&W!==P&&x.onScrollToTop?.(),b&&b!==E&&x.onScrollToBottom?.();let w=S===0,D=h.width-S-C.width<1,g=y("left",w),N=y("right",D);w&&w!==g&&x.onScrollToLeft?.(),D&&D!==N&&x.onScrollToRight?.()}d.current=v;let M=new ResizeObserver(x=>{for(let T of x)switch(T.target.tagName){case"TABLE":{h=pt(T);break}case"DIV":{C=pt(T);break}}v(),L(),R()});return M.observe(r.current),M.observe(a.current),()=>{M.disconnect()}},[]),ct(()=>{p.current()},[t]),{refs:o,onScroll:s}}import{useEffect as Ta,useState as ga}from"react";function Xt(e){let[t,o]=ga(null),n=e?.join(":")||"";return Ta(()=>{o(null)},[n]),{lastSelectionChangeIndex:t,setLastSelectionChangeIndex:o}}import{useEffect as ha,useRef as Ca,useState as ya}from"react";function Da(e,t){let o=()=>{t(e.map(r=>r.matches))},n=e.map(r=>{try{return r.addEventListener("change",o),()=>r.removeEventListener("change",o)}catch{return r.addListener(o),()=>r.removeListener(o)}});return()=>{n.forEach(r=>r())}}function xa(e,t){return t||(typeof window<"u"&&"matchMedia"in window?e.map(o=>window.matchMedia(o).matches):e.map(()=>!1))}function Ut(e,t,{getInitialValueInEffect:o}={getInitialValueInEffect:!0}){let[n,r]=ya(o?t:xa(e,t)),a=Ca(null);return ha(()=>{if("matchMedia"in window)return a.current=e.map(l=>window.matchMedia(l)),r(a.current.map(l=>l.matches)),Da(a.current,l=>{r(l)})},[e]),n}import{useMantineTheme as wa}from"@mantine/core";import{useMemo as Qt}from"react";function Kt(e){let t=wa(),o=Qt(()=>e.map(r=>(typeof r=="function"?r(t):r)??""),[e,t]),n=Qt(()=>e.map(()=>!0),[e]);return Ut(o,n)}import{useMantineTheme as Ra}from"@mantine/core";import{useMediaQuery as Sa}from"@mantine/hooks";function K(e){let t=Ra(),o=typeof e=="function"?e(t):e;return Sa(o||"",!0)}import{useState as Pa}from"react";function de(e){let t=e.replace(/([a-z\d])([A-Z]+)/g,"$1 $2").replace(/\W|_/g," ").trim().toLowerCase();return`${t.charAt(0).toUpperCase()}${t.slice(1)}`}function Jt(e,t,o){return e.filter(n=>!t.map(o).includes(o(n)))}function He(e,t){return e.filter((o,n,r)=>n===r.findIndex(a=>t(o)===t(a)))}function ft(e,t){return t?t.match(/([^[.\]])+/g).reduce((n,r)=>n&&n[r],e):void 0}function _(e,t){return typeof t=="string"?ft(e,t):t(e)}function ci(e,t){let o=structuredClone(t),n=o[e.source.index];return e.destination&&(o.splice(e.source.index,1),o.splice(e.destination.index,0,n)),o}function ui(e,t){let o=structuredClone(t),n=e.destination;if(!n)return o;let r=o[e.source.index],a=o[n.index];return o.splice(n.index,1,r),o.splice(e.source.index,1,a),o}function bt(e){return!e||e.length===0?0:Math.max(...e.map(t=>t.groups&&t.groups.length>0?1+bt(t.groups):1))}function Se(e){let t=[];for(let o of e)o.columns&&o.columns.length>0?t.push(...o.columns.filter(n=>n!=null)):o.groups&&o.groups.length>0&&t.push(...Se(o.groups));return t.filter(o=>o!=null)}function _e(e,t){return e.columns&&e.columns.length>0?e.columns.filter((o,n)=>o.hidden?!1:t?t[n]!==!1:!0).length:e.groups&&e.groups.length>0?e.groups.reduce((o,n)=>o+_e(n,t),0):0}function Tt(e,t,o=0){if(o===t)return[...e];let n=[];for(let r of e)r.groups&&r.groups.length>0&&n.push(...Tt(r.groups,t,o+1));return n}function Zt(e,t,o){return o?!e||t:!1}function Yt({rowExpansion:e,records:t,idAccessor:o}){let n=[];if(e&&t){let{trigger:c,allowMultiple:u,initiallyExpanded:m}=e;t&&c==="always"?n=t.map(f=>_(f,o)):m&&(n=t.filter((f,d)=>m({record:f,index:d})).map(f=>_(f,o)),u||(n=[n[0]]))}let r,a,l=Pa(n);if(e){let{expandable:c,trigger:u,allowMultiple:m,collapseProps:f,content:d}=e;e.expanded?{recordIds:r,onRecordIdsChange:a}=e.expanded:[r,a]=l;let p=s=>a?.(r.filter(i=>i!==_(s,o)));return{expandOnClick:u!=="always"&&u!=="never",isRowExpanded:s=>u==="always"?!0:r.includes(_(s,o)),isExpandable:({record:s,index:i})=>c?c({record:s,index:i}):!0,expandRow:s=>{let i=_(s,o);a?.(m?[...r,i]:[i])},collapseRow:p,collapseProps:f,content:({record:s,index:i})=>()=>d({record:s,index:i,collapse:()=>p(s)})}}}import{useTimeout as jt}from"@mantine/hooks";import{useEffect as va,useState as qt}from"react";function eo(e,t){let[o,n]=qt(e),[r,a]=qt(e),l=jt(()=>n(!0),0),c=jt(()=>a(!1),t||200);return va(()=>{e?(c.clear(),a(!0),l.start()):(l.clear(),n(!1),c.start())},[l,c,e]),{expanded:o,visible:r}}var me="mantine-datatable-nowrap",pe="mantine-datatable-ellipsis",$="mantine-datatable-pointer-cursor",Oe="mantine-datatable-context-menu-cursor",to="mantine-datatable-text-selection-disabled",J="mantine-datatable-text-align-left",Z="mantine-datatable-text-align-center",Y="mantine-datatable-text-align-right";import{jsx as Ea}from"react/jsx-runtime";function oo({className:e,style:t,visibleMediaQuery:o,title:n,noWrap:r,ellipsis:a,textAlign:l,width:c}){return K(o)?Ea(Ma,{className:ka({[me]:r||a,[pe]:a,[J]:l==="left",[Z]:l==="center",[Y]:l==="right"},e),style:[{width:c,minWidth:c,maxWidth:c},t],children:n}):null}import{TableTh as Na}from"@mantine/core";import{jsx as La}from"react/jsx-runtime";function no({shadowVisible:e}){return La(Na,{className:"mantine-datatable-footer-selector-placeholder-cell","data-shadow-visible":e||void 0})}import{jsx as gt,jsxs as _a}from"react/jsx-runtime";function ao({className:e,style:t,columns:o,defaultColumnProps:n,selectionVisible:r,selectorCellShadowVisible:a,ref:l}){return gt(Wa,{ref:l,className:Ha("mantine-datatable-footer",e),style:t,children:_a(Ia,{children:[r&&gt(no,{shadowVisible:a}),o.map(({hidden:c,...u})=>{if(c)return null;let{accessor:m,visibleMediaQuery:f,textAlign:d,width:p,footer:s,footerClassName:i,footerStyle:h,noWrap:C,ellipsis:y}={...n,...u};return gt(oo,{className:i,style:h,visibleMediaQuery:f,textAlign:d,width:p,title:s,noWrap:C,ellipsis:y},m)})]})})}import{Checkbox as mr,Group as pr,Popover as fr,PopoverDropdown as br,PopoverTarget as Tr,Stack as gr,TableThead as hr,TableTr as wo}from"@mantine/core";import Cr from"clsx";import{useState as yr}from"react";import{TableTh as Oa}from"@mantine/core";import Aa from"clsx";import{useMemo as Ae}from"react";import{jsx as za}from"react/jsx-runtime";function ro({group:{id:e,columns:t,groups:o,title:n,textAlign:r,className:a,style:l},maxDepth:c,currentDepth:u,previousGroups:m,isLastGroup:f,withColumnBorders:d=!1,totalTableColumns:p}){let s=Ae(()=>t&&t.length>0?t:o&&o.length>0?Se([{id:e,columns:t,groups:o}]):[],[t,o]),i=Ae(()=>s.map(({visibleMediaQuery:x})=>x),[s]),h=Kt(i),C=Ae(()=>_e({id:e,columns:t,groups:o},h),[e,t,o,h]),y=Ae(()=>m.reduce((x,T)=>x+_e(T,h),0),[m,h]),R=o&&o.length>0?1:c-u,v=y+C<p,M=Zt(f,v,d);return C>0?za(Oa,{colSpan:C,rowSpan:R>1?R:void 0,className:Aa("mantine-datatable-column-group-header-cell",{[J]:r==="left",[Z]:r==="center",[Y]:r==="right","mantine-datatable-column-group-header-cell--needs-border":M},a),style:l,children:n??de(e)}):null}import{ActionIcon as Co,Box as or,Center as Ge,Flex as nr,Group as ar,TableTh as rr}from"@mantine/core";import Fe from"clsx";import{useRef as lr,useState as ir}from"react";import{ActionIcon as Ga,Popover as Fa,PopoverDropdown as $a,PopoverTarget as Xa}from"@mantine/core";import{useClickOutside as Ua,useDisclosure as Qa}from"@mantine/hooks";import{jsx as lo,jsxs as Va}from"react/jsx-runtime";function io(){return Va("svg",{width:"14",height:"14",viewBox:"0 0 24 24",strokeWidth:"2",stroke:"currentColor",fill:"none",strokeLinecap:"round",strokeLinejoin:"round",children:[lo("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),lo("path",{d:"M4 4h16v2.172a2 2 0 0 1 -.586 1.414l-4.414 4.414v7l-6 2v-8.5l-4.48 -4.928a2 2 0 0 1 -.52 -1.345v-2.227z"})]})}import{jsx as so,jsxs as Ba}from"react/jsx-runtime";function co(){return Ba("svg",{width:"14",height:"14",viewBox:"0 0 24 24",strokeWidth:"2",stroke:"currentColor",fill:"none",strokeLinecap:"round",strokeLinejoin:"round",children:[so("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),so("path",{d:"M20 3h-16a1 1 0 0 0 -1 1v2.227l.008 .223a3 3 0 0 0 .772 1.795l4.22 4.641v8.114a1 1 0 0 0 1.316 .949l6 -2l.108 -.043a1 1 0 0 0 .576 -.906v-6.586l4.121 -4.12a3 3 0 0 0 .879 -2.123v-2.171a1 1 0 0 0 -1 -1z",strokeWidth:"0",fill:"currentColor"})]})}import{jsx as ze,jsxs as Ka}from"react/jsx-runtime";function uo({children:e,isActive:t,filterPopoverProps:o,filterPopoverDisableClickOutside:n}){let[r,{close:a,toggle:l}]=Qa(!1),c=t?co:io,u=Ua(a);return n&&(u=void 0),Ka(Fa,{withArrow:!0,shadow:"md",opened:r,onClose:a,trapFocus:!0,...o,children:[ze(Xa,{children:ze(Ga,{className:"mantine-datatable-header-cell-filter-action-icon","data-active":t||void 0,size:"sm",variant:"default",onClick:m=>{m.preventDefault(),l()},onKeyDown:m=>m.stopPropagation(),children:ze(c,{})})}),ze($a,{ref:u,onClick:m=>m.stopPropagation(),onKeyDown:m=>m.stopPropagation(),children:typeof e=="function"?e({close:a}):e})]})}import{useDirection as Ja}from"@mantine/core";import{useCallback as mo,useRef as po,useState as Za}from"react";import{jsx as Ya}from"react/jsx-runtime";var fo=e=>{let{accessor:t,columnRef:o}=e,[n,r]=Za(!1),a=po(0),l=po({current:0,next:0}),{dir:c}=Ja(),u=c==="rtl",{setMultipleColumnWidths:m}=ue(),f=mo(p=>{if(p.preventDefault(),p.stopPropagation(),!o.current)return;let s=o.current,i=s.nextElementSibling;for(;i;){let M=i.getAttribute("data-accessor");if(M&&M!=="__selection__")break;i=i.nextElementSibling}if(!i)return;let h=i.getAttribute("data-accessor");if(!h)return;let C=h==="__selection__";r(!0),a.current=p.clientX;let y=s.offsetWidth,L=i.offsetWidth;l.current={current:y,next:L};let R=M=>{if(!o.current)return;let x=o.current,T=x.nextElementSibling;if(!T)return;let S=M.clientX-a.current;u&&(S=-S);let W=50,b=l.current.current-W,P=l.current.next-W,E=Math.max(-b,Math.min(S,P)),w=l.current.current+E,D=l.current.next-E;x.style.width=`${w}px`,T.style.width=`${D}px`,x.style.minWidth=`${w}px`,x.style.maxWidth=`${w}px`,T.style.minWidth=`${D}px`,T.style.maxWidth=`${D}px`},v=()=>{if(!o.current)return;let M=o.current,x=M.nextElementSibling;r(!1),document.body.style.cursor="initial",document.body.style.userSelect="initial";let T=parseInt(M.style.width)||M.offsetWidth,S=x?parseInt(x.style.width)||x.offsetWidth:0,W=[{accessor:t,width:`${T}px`}];if(x&&!C){let b=x.getAttribute("data-accessor");b&&W.push({accessor:b,width:`${S}px`})}setTimeout(()=>{m(W)},0),document.removeEventListener("mousemove",R),document.removeEventListener("mouseup",v)};document.body.style.cursor="col-resize",document.body.style.userSelect="none",document.addEventListener("mousemove",R),document.addEventListener("mouseup",v)},[t,o,u,m]),d=mo(()=>{if(!o.current)return;let p=o.current,s=p.nextElementSibling;p.style.width="",p.style.minWidth="",p.style.maxWidth="";let i=[{accessor:t,width:"auto"}];if(s){s.style.width="",s.style.minWidth="",s.style.maxWidth="";let h=s.getAttribute("data-accessor");h&&h!=="__selection__"&&i.push({accessor:h,width:"auto"})}setTimeout(()=>{m(i)},0)},[t,o,m]);return Ya("div",{className:"mantine-datatable-header-resizable-handle",style:{cursor:n?"col-resize":void 0},onMouseDown:f,onDoubleClick:d,onClick:p=>p.stopPropagation(),title:"Drag to resize column, double-click to reset"})};import{jsx as Ve,jsxs as ja}from"react/jsx-runtime";function bo(){return ja("svg",{width:"14",height:"14",viewBox:"0 0 24 24",strokeWidth:"2",stroke:"currentColor",fill:"none",strokeLinecap:"round",strokeLinejoin:"round",children:[Ve("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),Ve("path",{d:"M12 5l0 14"}),Ve("path",{d:"M16 9l-4 -4"}),Ve("path",{d:"M8 9l4 -4"})]})}import{jsx as Be,jsxs as qa}from"react/jsx-runtime";function To(){return qa("svg",{width:"14",height:"14",viewBox:"0 0 24 24",strokeWidth:"2",stroke:"currentColor",fill:"none",strokeLinecap:"round",strokeLinejoin:"round",children:[Be("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),Be("path",{d:"M8 7l4 -4l4 4"}),Be("path",{d:"M8 17l4 4l4 -4"}),Be("path",{d:"M12 3l0 18"})]})}import{jsx as le,jsxs as er}from"react/jsx-runtime";function go(){return er("svg",{width:"14",height:"14",viewBox:"0 0 24 24",strokeWidth:"2",stroke:"currentColor",fill:"none",strokeLinecap:"round",strokeLinejoin:"round",children:[le("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),le("path",{d:"M9 5m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0"}),le("path",{d:"M9 12m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0"}),le("path",{d:"M9 19m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0"}),le("path",{d:"M15 5m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0"}),le("path",{d:"M15 12m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0"}),le("path",{d:"M15 19m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0"})]})}import{jsx as ht,jsxs as tr}from"react/jsx-runtime";function ho(){return tr("svg",{width:"14",height:"14",viewBox:"0 0 24 24",strokeWidth:"2",stroke:"currentColor",fill:"none",strokeLinecap:"round",strokeLinejoin:"round",children:[ht("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),ht("path",{d:"M18 6l-12 12"}),ht("path",{d:"M6 6l12 12"})]})}import{Fragment as sr,jsx as A,jsxs as Ct}from"react/jsx-runtime";function yo({className:e,style:t,accessor:o,visibleMediaQuery:n,title:r,sortable:a,draggable:l,toggleable:c,resizable:u,sortIcons:m,textAlign:f,width:d,sortStatus:p,onSortStatusChange:s,filter:i,filterPopoverProps:h,filterPopoverDisableClickOutside:C,filtering:y,sortKey:L}){let{setSourceColumn:R,setTargetColumn:v,swapColumns:M,setColumnsToggle:x}=ue(),[T,S]=ir(!1),W=lr(null);if(!K(n))return null;let b=r??de(o),P=typeof b=="string"?b:void 0,E=a&&s?H=>{H?.defaultPrevented||s({sortKey:L,columnAccessor:o,direction:p?.columnAccessor===o?p.direction==="asc"?"desc":"asc":p?.direction??"asc"})}:void 0,w=H=>{H.stopPropagation(),R(o),S(!1)},D=H=>{H.preventDefault(),v(o),S(!0)},g=()=>{v(o),S(!1),M()},N=()=>{S(!0)},O=()=>{S(!1)},z=H=>{H.stopPropagation(),x(ee=>ee.map(X=>X.accessor===o?{...X,toggled:!1}:X))};return Ct(rr,{"data-accessor":o,className:Fe({"mantine-datatable-header-cell-sortable":a,"mantine-datatable-header-cell-toggleable":c,"mantine-datatable-header-cell-resizable":u},e),style:[{width:d,...u?{}:{minWidth:d,maxWidth:d}},t],role:a?"button":void 0,tabIndex:a?0:void 0,onClick:E,onKeyDown:H=>H.key==="Enter"&&E?.(),ref:W,children:[Ct(ar,{className:"mantine-datatable-header-cell-sortable-group",justify:"space-between",wrap:"nowrap",children:[Ct(nr,{align:"center",w:"100%",className:Fe({"mantine-datatable-header-cell-draggable":l,"mantine-datatable-header-cell-drag-over":T}),draggable:l,onDragStart:l?w:void 0,onDragEnter:l?N:void 0,onDragOver:l?D:void 0,onDrop:l?g:void 0,onDragLeave:l?O:void 0,children:[l?A(Ge,{role:"img","aria-label":"Drag column",children:A(Co,{className:"mantine-datatable-header-cell-draggable-action-icon",variant:"subtle",size:"xs",onClick:H=>{H.stopPropagation()},children:A(go,{})})}):null,A(or,{className:Fe("mantine-datatable-header-cell-sortable-text",{[J]:f==="left",[Z]:f==="center",[Y]:f==="right"},me,pe),title:P,children:b})]}),c?A(Ge,{className:"mantine-datatable-header-cell-toggleable-icon",role:"img","aria-label":"Toggle column",children:A(Co,{size:"xs",variant:"light",onClick:z,children:A(ho,{})})}):null,a||p?.columnAccessor===o?A(sr,{children:p?.columnAccessor===o?A(Ge,{className:Fe("mantine-datatable-header-cell-sortable-icon",{"mantine-datatable-header-cell-sortable-icon-reversed":p.direction==="desc"}),role:"img","aria-label":`Sorted ${p.direction==="desc"?"descending":"ascending"}`,children:m?.sorted||A(bo,{})}):A(Ge,{className:"mantine-datatable-header-cell-sortable-unsorted-icon",role:"img","aria-label":"Not sorted",children:m?.unsorted||A(To,{})})}):null,i?A(uo,{filterPopoverProps:h,isActive:!!y,filterPopoverDisableClickOutside:C,children:i}):null]}),u&&o!=="__selection__"?A(fo,{accessor:o,columnRef:W}):null]})}import{Checkbox as cr,TableTh as ur}from"@mantine/core";import dr from"clsx";import{jsx as Do}from"react/jsx-runtime";function xo({className:e,style:t,trigger:o,shadowVisible:n,checked:r,indeterminate:a,checkboxProps:l,onChange:c,rowSpan:u,ref:m}){let f=!l.disabled;return Do(ur,{ref:m,className:dr("mantine-datatable-header-selector-cell",{[$]:o==="cell"&&f},e),style:t,rowSpan:u,"data-shadow-visible":n||void 0,"data-accessor":"__selection__",onClick:o==="cell"&&f?c:void 0,children:Do(cr,{classNames:f?{input:$}:void 0,checked:r,indeterminate:a,onChange:c,...l,disabled:!(c||l.onChange)||l.disabled})})}import{jsx as j,jsxs as $e}from"react/jsx-runtime";function Ro({selectionColumnHeaderRef:e,className:t,style:o,sortStatus:n,sortIcons:r,onSortStatusChange:a,columns:l,defaultColumnProps:c,groups:u,selectionTrigger:m,selectionVisible:f,selectionChecked:d,selectionIndeterminate:p,onSelectionChange:s,selectionCheckboxProps:i,selectorCellShadowVisible:h,selectionColumnClassName:C,selectionColumnStyle:y,withColumnBorders:L=!1,ref:R}){let v=u?bt(u):0,M=v>0?v+1:1,x=f?j(xo,{ref:e,className:C,style:y,trigger:m,shadowVisible:h,checked:d,indeterminate:p,checkboxProps:i,onChange:s,rowSpan:u?M:void 0}):null,{columnsToggle:T,setColumnsToggle:S}=ue(),[W,b]=yr(!1),P=l.some(D=>D.toggleable),E=P?Object.fromEntries(l.map(({accessor:D,title:g})=>[D,g??de(String(D))])):void 0,w=$e(hr,{className:Cr("mantine-datatable-header",t),style:o,ref:R,onContextMenu:P?D=>{D.preventDefault(),b(g=>!g)}:void 0,children:[u&&Array.from({length:v},(D,g)=>{let N=Tt(u,g);return $e(wo,{children:[g===0&&x,N.map((O,z)=>j(ro,{group:O,maxDepth:v,currentDepth:g,previousGroups:N.slice(0,z),isLastGroup:z===N.length-1,withColumnBorders:L,totalTableColumns:l.length},O.id))]},`group-depth-${g}`)}),$e(wo,{children:[!u&&x,l.map(({hidden:D,...g},N)=>{if(D)return null;let{accessor:O,visibleMediaQuery:z,textAlign:H,width:ee,title:X,sortable:fe,draggable:be,toggleable:Te,resizable:ge,titleClassName:te,titleStyle:he,filter:Ce,filterPopoverProps:U,filterPopoverDisableClickOutside:Je,filtering:Ze,sortKey:Ye}={...c,...g};return j(yo,{accessor:O,className:te,style:he,visibleMediaQuery:z,textAlign:H,width:ee,title:X,sortable:fe,draggable:be,toggleable:Te,resizable:ge&&N<l.length-1,sortStatus:n,sortIcons:r,sortKey:Ye,onSortStatusChange:a,filter:Ce,filterPopoverProps:U,filterPopoverDisableClickOutside:Je,filtering:Ze},O)})]})]});return P?$e(fr,{position:"bottom",withArrow:!0,shadow:"md",opened:W,onChange:b,children:[j(Tr,{children:w}),j(br,{children:j(gr,{children:T.filter(D=>D.toggleable).map(D=>j(pr,{children:j(mr,{classNames:{label:"mantine-datatable-header-column-toggle-checkbox-label"},size:"xs",label:E[D.accessor],checked:D.toggled,onChange:g=>{S(T.map(N=>N.accessor===D.accessor?{...N,toggled:g.currentTarget.checked}:N))}})},D.accessor))})})]}):w}import{Center as Dr,Loader as xr}from"@mantine/core";import wr from"clsx";import{jsx as So}from"react/jsx-runtime";function Po({fetching:e,customContent:t,backgroundBlur:o,size:n,type:r,color:a}){return So(Dr,{className:wr("mantine-datatable-loader",{"mantine-datatable-loader-fetching":e}),style:[{backdropFilter:o?`blur(${o}px)`:void 0}],children:e&&(t||So(xr,{size:n,type:r,color:a}))})}import{Box as Wr,Pagination as Ir,Text as Hr,rem as _r}from"@mantine/core";import Io from"clsx";import{Button as Pr,Group as vr,Menu as Mr,MenuDropdown as kr,MenuItem as Er,MenuTarget as Nr,Text as Eo,rem as Pe}from"@mantine/core";import Lr from"clsx";import{parseThemeColor as Rr}from"@mantine/core";function I(e,t,o){return e?Rr({color:typeof e=="object"?e[o]:e,theme:t}).value:void 0}function vo({theme:e,c:t,backgroundColor:o,borderColor:n,rowBorderColor:r,stripedColor:a,highlightOnHoverColor:l}){return{"--mantine-datatable-color-light":I(t,e,"light"),"--mantine-datatable-color-dark":I(t,e,"dark"),"--mantine-datatable-background-color-light":I(o,e,"light"),"--mantine-datatable-background-color-dark":I(o,e,"dark"),"--mantine-datatable-border-color-light":I(n,e,"light"),"--mantine-datatable-border-color-dark":I(n,e,"dark"),"--mantine-datatable-row-border-color-light":I(r,e,"light"),"--mantine-datatable-row-border-color-dark":I(r,e,"dark"),"--mantine-datatable-striped-color-light":I(a,e,"light"),"--mantine-datatable-striped-color-dark":I(a,e,"dark"),"--mantine-datatable-highlight-on-hover-color-light":I(l,e,"light"),"--mantine-datatable-highlight-on-hover-color-dark":I(l,e,"dark")}}function Xe({theme:e,paginationActiveTextColor:t,paginationActiveBackgroundColor:o}){return{"--mantine-datatable-pagination-active-text-color-light":I(t,e,"light"),"--mantine-datatable-pagination-active-text-color-dark":I(t,e,"dark"),"--mantine-datatable-pagination-active-background-color-light":I(o,e,"light"),"--mantine-datatable-pagination-active-background-color-dark":I(o,e,"dark")}}function Mo({theme:e,color:t,backgroundColor:o}){return{"--mantine-datatable-row-color-light":I(t,e,"light"),"--mantine-datatable-row-color-dark":I(t,e,"dark"),"--mantine-datatable-row-background-color-light":I(o,e,"light"),"--mantine-datatable-row-background-color-dark":I(o,e,"dark")}}import{jsx as yt,jsxs as Sr}from"react/jsx-runtime";function ko(){return Sr("svg",{width:"14",height:"14",viewBox:"0 0 24 24",strokeWidth:"2",stroke:"currentColor",fill:"none",strokeLinecap:"round",strokeLinejoin:"round",children:[yt("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),yt("path",{d:"M8 9l4 -4l4 4"}),yt("path",{d:"M16 15l-4 4l-4 -4"})]})}import{jsx as ie,jsxs as Lo}from"react/jsx-runtime";var No={xs:Pe(22),sm:Pe(26),md:Pe(32),lg:Pe(38),xl:Pe(44)};function Wo({size:e,label:t,values:o,value:n,activeTextColor:r,activeBackgroundColor:a,onChange:l}){return Lo(vr,{gap:"xs",children:[ie(Eo,{component:"div",size:e,children:t}),Lo(Mr,{withinPortal:!0,withArrow:!0,offset:2,classNames:{arrow:"mantine-datatable-page-size-selector-menu-arrow"},children:[ie(Nr,{children:ie(Pr,{size:e,variant:"default",classNames:{section:"mantine-datatable-page-size-selector-button-icon"},rightSection:ie(ko,{}),style:[{fontWeight:"normal"},c=>({height:No[e],paddingLeft:c.spacing[e],paddingRight:c.spacing[e]})],children:n})}),ie(kr,{children:o.map(c=>{let u=c===n;return ie(Er,{className:Lr({"mantine-datatable-page-size-selector-active":u}),style:[{height:No[e]},u&&(r||a)?m=>Xe({theme:m,paginationActiveTextColor:r,paginationActiveBackgroundColor:a}):void 0],disabled:u,onClick:()=>l(c),children:ie(Eo,{component:"div",size:e,children:c})},c)})})]})]})}import{Fragment as Ho,jsx as q,jsxs as Or}from"react/jsx-runtime";function _o({className:e,style:t,fetching:o,page:n,onPageChange:r,paginationWithEdges:a,paginationWithControls:l,paginationActiveTextColor:c,paginationActiveBackgroundColor:u,paginationSize:m,loadingText:f,noRecordsText:d,paginationText:p,totalRecords:s,recordsPerPage:i,onRecordsPerPageChange:h,recordsPerPageLabel:C,recordsPerPageOptions:y,recordsLength:L,horizontalSpacing:R,paginationWrapBreakpoint:v,getPaginationControlProps:M,renderPagination:x}){let T;if(s){let g=(n-1)*i+1,N=g+(L||0)-1;T=p({from:g,to:N,totalRecords:s})}else T=o?f:d;let S=s&&i?Math.max(1,Math.ceil(s/i)):1,W=s?(n-1)*(i??0)+1:void 0,b=s?(W??1)+(L??0)-1:void 0,E=!K(({breakpoints:g})=>`(min-width: ${typeof v=="number"?`${_r(v)}rem`:g[v]||v})`),w={Text:g=>q(Hr,{component:"div",className:"mantine-datatable-pagination-text",size:m,...g,children:T}),PageSizeSelector:g=>y?q(Wo,{activeTextColor:c,activeBackgroundColor:u,size:m,label:C,values:y,value:i,onChange:h,...g}):q(Ho,{}),Pagination:g=>q(Ir,{classNames:{root:Io("mantine-datatable-pagination-pages",{"mantine-datatable-pagination-pages-fetching":o||!L}),control:"mantine-datatable-pagination-pages-control"},style:c||u?N=>Xe({theme:N,paginationActiveTextColor:c,paginationActiveBackgroundColor:u}):void 0,withEdges:a,withControls:l,value:n,onChange:r,size:m,total:S,getControlProps:M,...g})},D={state:{paginationSize:m,page:n,totalPages:S,totalRecords:s,recordsPerPage:i,recordsLength:L,fetching:o,from:W,to:b,isWrapped:E},actions:{setPage:g=>r?.(g),setRecordsPerPage:h?g=>h(g):void 0},Controls:w};return q(Wr,{px:R??"xs",py:"xs",className:Io("mantine-datatable-pagination",e),style:[{flexDirection:E?"column":"row"},t],children:typeof x=="function"?x(D):Or(Ho,{children:[q(w.Text,{}),q(w.PageSizeSelector,{}),q(w.Pagination,{})]})})}import{TableTr as Kr}from"@mantine/core";import Jr from"clsx";import{TableTd as Ar}from"@mantine/core";import zr from"clsx";import{jsx as Vr}from"react/jsx-runtime";function Oo({className:e,style:t,visibleMediaQuery:o,record:n,index:r,onClick:a,onDoubleClick:l,onContextMenu:c,noWrap:u,ellipsis:m,textAlign:f,width:d,accessor:p,render:s,defaultRender:i,customCellAttributes:h}){return K(o)?Vr(Ar,{className:zr({[me]:u||m,[pe]:m,[$]:a||l,[Oe]:c,[J]:f==="left",[Z]:f==="center",[Y]:f==="right"},e),style:[{width:d,minWidth:d,maxWidth:d},t],onClick:a,onDoubleClick:l,onContextMenu:c,...h?.(n,r),children:s?s(n,r):i?i(n,r,p):ft(n,p)}):null}import{Collapse as Br,TableTd as Gr,TableTr as Ao}from"@mantine/core";import{Fragment as Fr,jsx as ve,jsxs as $r}from"react/jsx-runtime";function zo({open:e,colSpan:t,content:o,collapseProps:n}){let{expanded:r,visible:a}=eo(e,n?.transitionDuration);return a?$r(Fr,{children:[ve(Ao,{}),ve(Ao,{children:ve(Gr,{className:"mantine-datatable-row-expansion-cell",colSpan:t,children:ve(Br,{in:r,...n,children:ve("div",{className:"mantine-datatable-row-expansion-cell-content",children:o()})})})})]}):null}import{Checkbox as Xr,TableTd as Ur}from"@mantine/core";import Qr from"clsx";import{jsx as Vo}from"react/jsx-runtime";function Bo({className:e,style:t,record:o,index:n,trigger:r,onChange:a,withRightShadow:l,checkboxProps:c,getCheckboxProps:u,...m}){let f={...c,...u(o,n)},d=!m.disabled&&!f.disabled,p=s=>{s.stopPropagation(),r==="cell"&&d&&a?.(s)};return Vo(Ur,{className:Qr("mantine-datatable-row-selector-cell",{[$]:r==="cell"&&d},e),style:t,"data-shadow-visible":l||void 0,onClick:p,children:Vo(Xr,{classNames:d?{input:$}:void 0,onChange:a,...m,...f})})}import{Fragment as Go,jsx as Ue,jsxs as Fo}from"react/jsx-runtime";function $o({record:e,index:t,columns:o,defaultColumnProps:n,defaultColumnRender:r,selectionTrigger:a,selectionVisible:l,selectionChecked:c,onSelectionChange:u,isRecordSelectable:m,selectionCheckboxProps:f,getSelectionCheckboxProps:d,onClick:p,onDoubleClick:s,onContextMenu:i,onCellClick:h,onCellDoubleClick:C,onCellContextMenu:y,expansion:L,customAttributes:R,color:v,backgroundColor:M,className:x,style:T,selectorCellShadowVisible:S,selectionColumnClassName:W,selectionColumnStyle:b,rowFactory:P}){let E=Fo(Go,{children:[l&&Ue(Bo,{className:W,style:b,record:e,index:t,trigger:a,withRightShadow:S,checked:c,disabled:!u||(m?!m(e,t):!1),onChange:u,checkboxProps:f,getCheckboxProps:d}),o.map(({hidden:g,hiddenContent:N,...O},z)=>{if(g||N)return null;let{accessor:H,visibleMediaQuery:ee,textAlign:X,noWrap:fe,ellipsis:be,width:Te,render:ge,cellsClassName:te,cellsStyle:he,customCellAttributes:Ce}={...n,...O};return Ue(Oo,{className:typeof te=="function"?te(e,t):te,style:he?.(e,t),visibleMediaQuery:ee,record:e,index:t,onClick:h?U=>h({event:U,record:e,index:t,column:O,columnIndex:z}):void 0,onDoubleClick:C?U=>C({event:U,record:e,index:t,column:O,columnIndex:z}):void 0,onContextMenu:y?U=>y({event:U,record:e,index:t,column:O,columnIndex:z}):void 0,accessor:H,textAlign:X,noWrap:fe,ellipsis:be,width:Te,render:ge,defaultRender:r,customCellAttributes:Ce},H)})]}),w=L&&Ue(zo,{colSpan:o.filter(({hidden:g})=>!g).length+(l?1:0),open:L.isRowExpanded(e),content:L.content({record:e,index:t}),collapseProps:L.collapseProps}),D=Zr({record:e,index:t,selectionChecked:c,onClick:p,onDoubleClick:s,onContextMenu:i,expansion:L,customAttributes:R,color:v,backgroundColor:M,className:x,style:T});return P?P({record:e,index:t,rowProps:D,children:E,expandedElement:w}):Fo(Go,{children:[Ue(Kr,{...D,children:E}),w]})}function Zr({record:e,index:t,selectionChecked:o,onClick:n,onDoubleClick:r,onContextMenu:a,expansion:l,customAttributes:c,color:u,backgroundColor:m,className:f,style:d}){return{className:Jr("mantine-datatable-row",{[$]:n||r||l?.isExpandable({record:e,index:t})&&l?.expandOnClick},{[Oe]:a},typeof f=="function"?f(e,t):f),"data-selected":o||void 0,onClick:p=>{if(l){let{isExpandable:s,isRowExpanded:i,expandOnClick:h,expandRow:C,collapseRow:y}=l;s({record:e,index:t})&&h&&(i(e)?y(e):C(e))}n?.({event:p,record:e,index:t})},onDoubleClick:r?p=>r({event:p,record:e,index:t}):void 0,onContextMenu:a?p=>a({event:p,record:e,index:t}):void 0,style:[u||m?p=>{let s=u?.(e,t),i=m?.(e,t);return Mo({theme:p,color:s,backgroundColor:i})}:void 0,d?.(e,t)],...c?.(e,t)??{}}}import{Box as Xo,ScrollArea as Yr}from"@mantine/core";import Qe from"clsx";import{jsx as Ke,jsxs as jr}from"react/jsx-runtime";function Uo({leftShadowBehind:e,rightShadowBehind:t,onScrollPositionChange:o,children:n,viewportRef:r,scrollAreaProps:a}){return jr(Yr,{...a,viewportRef:r,classNames:{root:"mantine-datatable-scroll-area",scrollbar:"mantine-datatable-scroll-area-scrollbar",thumb:"mantine-datatable-scroll-area-thumb",corner:"mantine-datatable-scroll-area-corner"},onScrollPositionChange:o,children:[n,Ke(Xo,{className:Qe("mantine-datatable-scroll-area-shadow","mantine-datatable-scroll-area-top-shadow")}),Ke("div",{className:Qe("mantine-datatable-scroll-area-shadow","mantine-datatable-scroll-area-left-shadow",{"mantine-datatable-scroll-area-shadow-behind":e})}),Ke("div",{className:Qe("mantine-datatable-scroll-area-shadow","mantine-datatable-scroll-area-right-shadow",{"mantine-datatable-scroll-area-shadow-behind":t})}),Ke(Xo,{className:Qe("mantine-datatable-scroll-area-shadow","mantine-datatable-scroll-area-bottom-shadow")})]})}import{jsx as V,jsxs as Jo}from"react/jsx-runtime";function rl({withTableBorder:e,borderRadius:t,textSelectionDisabled:o,height:n="100%",minHeight:r,maxHeight:a,shadow:l,verticalAlign:c="center",fetching:u,columns:m,storeColumnsKey:f,groups:d,pinFirstColumn:p,pinLastColumn:s,defaultColumnProps:i,defaultColumnRender:h,idAccessor:C="id",records:y,selectionTrigger:L="checkbox",selectedRecords:R,onSelectedRecordsChange:v,selectionColumnClassName:M,selectionColumnStyle:x,isRecordSelectable:T,selectionCheckboxProps:S,allRecordsSelectionCheckboxProps:W={"aria-label":"Select all records"},getRecordSelectionCheckboxProps:b=(B,xe)=>({"aria-label":`Select record ${xe+1}`}),sortStatus:P,sortIcons:E,onSortStatusChange:w,horizontalSpacing:D,page:g,onPageChange:N,totalRecords:O,recordsPerPage:z,onRecordsPerPageChange:H,recordsPerPageOptions:ee,recordsPerPageLabel:X="Records per page",paginationWithEdges:fe,paginationWithControls:be,paginationActiveTextColor:Te,paginationActiveBackgroundColor:ge,paginationSize:te="sm",paginationText:he=({from:B,to:xe,totalRecords:et})=>`${B} - ${xe} / ${et}`,paginationWrapBreakpoint:Ce="sm",getPaginationControlProps:U=B=>B==="previous"?{"aria-label":"Previous page"}:B==="next"?{"aria-label":"Next page"}:{},renderPagination:Je,loaderBackgroundBlur:Ze,customLoader:Ye,loaderSize:Zo,loaderType:Yo,loaderColor:jo,loadingText:qo="...",emptyState:en,noRecordsText:wt="No records",noRecordsIcon:tn,highlightOnHover:on,striped:nn,noHeader:an,onRowClick:rn,onRowDoubleClick:ln,onRowContextMenu:sn,onCellClick:cn,onCellDoubleClick:un,onCellContextMenu:dn,onScroll:mn,onScrollToTop:pn,onScrollToBottom:fn,onScrollToLeft:bn,onScrollToRight:Tn,c:gn,backgroundColor:hn,borderColor:Cn,rowBorderColor:yn,stripedColor:Dn,highlightOnHoverColor:xn,rowColor:wn,rowBackgroundColor:Rn,rowExpansion:Sn,rowClassName:Pn,rowStyle:vn,customRowAttributes:Mn,scrollViewportRef:kn,scrollAreaProps:En,tableRef:Nn,bodyRef:Ln,m:Wn,my:In,mx:Hn,mt:_n,mb:On,ml:An,mr:zn,className:Vn,classNames:ye,style:Bn,styles:De,rowFactory:Gn,tableWrapper:je,...qe}){let B=nl(()=>d?Se(d):m,[m,d]),[xe,et]=al(!1),{refs:F,onScroll:Fn}=$t({scrollCallbacks:{onScroll:mn,onScrollToTop:pn,onScrollToBottom:fn,onScrollToLeft:bn,onScrollToRight:Tn},withRowBorders:qe.withRowBorders}),tt=zt({key:f,columns:B,headerRef:F.header,scrollViewportRef:F.scrollViewport,onFixedLayoutChange:et}),$n=Qo(F.table,Nn),Xn=Qo(F.scrollViewport,kn),Un=Yt({rowExpansion:Sn,records:y,idAccessor:C}),Me=xt(!1),Rt=xt(g),ot=xt(y),Qn=Dt(k=>{Me.current=!0,ot.current=y,N(k)},[N,y]);tl(()=>{Rt.current!==g&&(Me.current=!0,ot.current=y,Rt.current=g)},[g,y]);let ke=y?.length;ol(()=>{if(!Me.current||u||y===ot.current)return;let k=F.scrollViewport.current;if(!k)return;let oe=requestAnimationFrame(()=>{k.scrollTo({top:0,left:0}),Me.current=!1});return()=>cancelAnimationFrame(oe)},[u,y,F.scrollViewport]);let St=y?.map(k=>_(k,C)),se=!!R,we=R?.map(k=>_(k,C)),Pt=St!==void 0&&we!==void 0&&we.length>0,nt=T?y?.filter(T):y,Ee=nt?.map(k=>_(k,C)),Ne=Pt&&Ee.every(k=>we.includes(k)),Kn=Pt&&Ee.some(k=>we.includes(k)),Jn=Dt(()=>{R&&v&&v(Ne?R.filter(k=>!Ee.includes(_(k,C))):He([...R,...nt],k=>_(k,C)))},[Ne,C,v,Ee,nt,R]),{lastSelectionChangeIndex:Le,setLastSelectionChangeIndex:Zn}=Xt(St),at=se&&!p,Yn={m:Wn,my:In,mx:Hn,mt:_n,mb:On,ml:An,mr:zn},jn=Dt(({children:k})=>je?je({children:k}):k,[je]);return V(it,{...tt,children:Jo(qr,{ref:F.root,...Yn,className:Ko("mantine-datatable",{"mantine-datatable-with-border":e},Vn,ye?.root),style:[k=>({...vo({theme:k,c:gn,backgroundColor:hn,borderColor:Cn,rowBorderColor:yn,stripedColor:Dn,highlightOnHoverColor:xn}),borderRadius:k.radius[t]||t,boxShadow:k.shadows[l]||l,height:n,minHeight:r,maxHeight:a}),Bn,De?.root,{position:"relative"}],children:[V(Uo,{viewportRef:Xn,leftShadowBehind:se||!!p,rightShadowBehind:s,onScrollPositionChange:Fn,scrollAreaProps:En,children:V(jn,{children:Jo(el,{ref:$n,horizontalSpacing:D,className:Ko("mantine-datatable-table",{[to]:o,"mantine-datatable-vertical-align-top":c==="top","mantine-datatable-vertical-align-bottom":c==="bottom","mantine-datatable-pin-last-column":s,"mantine-datatable-selection-column-visible":se,"mantine-datatable-pin-first-column":p,"mantine-datatable-resizable-columns":tt.hasResizableColumns&&xe},ye?.table),style:{...De?.table},"data-striped":ke&&nn||void 0,"data-highlight-on-hover":on||void 0,...qe,children:[an?null:V(it,{...tt,children:V(Ro,{ref:F.header,selectionColumnHeaderRef:F.selectionColumnHeader,className:ye?.header,style:De?.header,columns:B,defaultColumnProps:i,groups:d,sortStatus:P,sortIcons:E,onSortStatusChange:w,selectionTrigger:L,selectionVisible:se,selectionChecked:Ne,selectionIndeterminate:Kn&&!Ne,onSelectionChange:Jn,selectionCheckboxProps:{...S,...W},selectorCellShadowVisible:at,selectionColumnClassName:M,selectionColumnStyle:x,withColumnBorders:qe.withColumnBorders})}),V("tbody",{ref:Ln,children:ke?y.map((k,oe)=>{let rt=_(k,C),lt=we?.includes(rt)||!1,vt;return v&&R&&(vt=qn=>{if(qn.nativeEvent.shiftKey&&Le!==null){let ce=y.filter(oe>Le?(ne,ae)=>ae>=Le&&ae<=oe&&(T?T(ne,ae):!0):(ne,ae)=>ae>=oe&&ae<=Le&&(T?T(ne,ae):!0));v(lt?Jt(R,ce,ne=>_(ne,C)):He([...R,...ce],ne=>_(ne,C)))}else v(lt?R.filter(ce=>_(ce,C)!==rt):He([...R,k],ce=>_(ce,C)));Zn(oe)}),V($o,{record:k,index:oe,columns:B,defaultColumnProps:i,defaultColumnRender:h,selectionTrigger:L,selectionVisible:se,selectionChecked:lt,onSelectionChange:vt,isRecordSelectable:T,selectionCheckboxProps:S,getSelectionCheckboxProps:b,onClick:rn,onDoubleClick:ln,onCellClick:cn,onCellDoubleClick:un,onContextMenu:sn,onCellContextMenu:dn,expansion:Un,color:wn,backgroundColor:Rn,className:Pn,style:vn,customAttributes:Mn,selectorCellShadowVisible:at,selectionColumnClassName:M,selectionColumnStyle:x,idAccessor:C,rowFactory:Gn},rt)}):V(Nt,{})}),B.some(({footer:k})=>k)&&V(ao,{ref:F.footer,className:ye?.footer,style:De?.footer,columns:B,defaultColumnProps:i,selectionVisible:se,selectorCellShadowVisible:at})]})})}),g&&V(_o,{className:ye?.pagination,style:De?.pagination,horizontalSpacing:D,fetching:u,page:g,onPageChange:Qn,totalRecords:O,recordsPerPage:z,onRecordsPerPageChange:H,recordsPerPageOptions:ee,recordsPerPageLabel:X,paginationWithEdges:fe,paginationWithControls:be,paginationActiveTextColor:Te,paginationActiveBackgroundColor:ge,paginationSize:te,paginationText:he,paginationWrapBreakpoint:Ce,getPaginationControlProps:U,noRecordsText:wt,loadingText:qo,recordsLength:ke,renderPagination:Je}),V(Po,{fetching:u,backgroundBlur:Ze,customContent:Ye,size:Zo,type:Yo,color:jo}),V(Wt,{icon:tn,text:wt,active:!u&&!ke,children:en})]})})}import{TableTr as ll}from"@mantine/core";import{useMergedRef as il}from"@mantine/hooks";import{useEffect as sl,useRef as cl}from"react";import{jsx as dl}from"react/jsx-runtime";function ul({className:e,children:t,isDragging:o,ref:n,...r}){let a=cl(null),l=il(a,n);return sl(()=>{if(!a.current||!o)return;let f=a.current.parentElement.parentElement.children[0].children[0];for(let d=0;d<f.children.length;d++){let s=f.children[d].getBoundingClientRect(),i=a.current.children[d];i.style.height=s.height+"px",i.style.width=s.width+"px",i.style.minWidth=s.width+"px",i.style.maxWidth=s.width+"px"}},[o,t]),dl(ll,{"data-is-dragging":o,ref:l,...r,className:e,children:t})}export{rl as DataTable,ul as DataTableDraggableRow,_e as calculateColSpan,Jt as differenceBy,Se as flattenColumns,Tt as getGroupsAtDepth,bt as getMaxGroupDepth,_ as getRecordId,ft as getValueAtPath,de as humanize,Zt as needsRightBorder,ci as reorderRecords,ui as swapRecords,He as uniqBy,zt as useDataTableColumns};
2
2
  //# sourceMappingURL=index.mjs.map