mgh-components 1.1.2 → 1.2.1

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.cjs CHANGED
@@ -1,2 +1,2 @@
1
- "use strict";var e=require("react"),t=require("@mui/material"),r=require("@mui/x-data-grid-premium"),n=require("@mui/material/useMediaQuery"),o=require("@mui/material/styles"),i=require("@emotion/styled"),l=require("@mui/material/Button"),a=require("@mui/material/Dialog"),d=require("@mui/material/DialogTitle"),s=require("@mui/material/DialogActions"),c=require("@mui/material/DialogContent"),g=require("@iconify/react"),m=require("@mui/material/Box"),u=require("dayjs"),p=require("react-dom");function h(e,t,r){const i=o.useTheme(),l=n(i.breakpoints.up(t)),a=n(i.breakpoints.down(t)),d=n(i.breakpoints.between(t,r)),s=n(i.breakpoints.only(t));return"up"===e?l:"down"===e?a:"between"===e?d:s}function f({text:r,useSettingsContext:n}){const l=o.useTheme(),a=n?.()?.themeMode??l.palette.mode??"light",d=i("div")(()=>({display:"flex",alignItems:"center",justifyContent:"center",height:"100%","& .ant-empty-img-1":{fill:"light"===a?"#aeb8c2":"#262626"},"& .ant-empty-img-2":{fill:"light"===a?"#f5f5f7":"#595959"},"& .ant-empty-img-3":{fill:"light"===a?"#dce0e6":"#434343"},"& .ant-empty-img-4":{fill:"light"===a?"#fff":"#1c1c1c"},"& .ant-empty-img-5":{fillOpacity:"light"===a?"0.8":"0.08",fill:"light"===a?"#f5f5f5":"#fff"}}));return e.createElement(d,null,e.createElement(t.Box,{component:"img",alt:"empty content",src:"/assets/icons/empty/ic_content.svg",sx:{width:50,maxWidth:160}}),e.createElement(t.Box,{sx:{mb:0}},r))}const b=()=>"undefined"!=typeof window&&void 0!==window.localStorage,x=e=>{if(!b())return null;try{const t=window.localStorage.getItem(e);return t?JSON.parse(t):null}catch{return null}},w=(e,t)=>{if(b())try{window.localStorage.setItem(e,JSON.stringify(t))}catch{return}};function v({showColumnsButton:n=!0,showFilterButton:o=!0,showExportButton:i=!0,showQuickFilter:l=!0,renderOtherButtons:a,renderDateRange:d,customMenuItem:s,showCsvOption:c=!0}){return e.createElement(r.Toolbar,{style:{display:"flex",justifyContent:"space-between"}},e.createElement("div",null,n&&e.createElement(t.Tooltip,{title:"Columns"},e.createElement(r.ColumnsPanelTrigger,{render:e.createElement(r.ToolbarButton,null)},e.createElement(r.GridViewColumnIcon,{fontSize:"small"}))),o&&e.createElement(t.Tooltip,{title:"Filters"},e.createElement(r.FilterPanelTrigger,{render:(n,o)=>e.createElement(r.ToolbarButton,{...n,color:"default"},e.createElement(t.Badge,{badgeContent:o.filterCount,color:"primary",variant:"dot"},e.createElement(r.GridFilterListIcon,{fontSize:"small"})))})),i&&e.createElement(y,{customMenuItem:s,showCsvOption:c})),d,e.createElement("div",null,a,l&&e.createElement(E,null)))}const y=({csvOptions:t={allColumns:!0},excelOptions:n={allColumns:!0},printOptions:o,customMenuItem:i,showCsvOption:l=!0,...a})=>e.createElement(r.GridToolbarExportContainer,{...a},i?.map(e=>e),l&&e.createElement(r.GridCsvExportMenuItem,{options:t}),e.createElement(r.GridExcelExportMenuItem,{options:n}),e.createElement(r.GridPrintExportMenuItem,{options:o}));function E(){const n=t.styled(r.QuickFilter)({display:"grid",alignItems:"center"}),o=t.styled(r.ToolbarButton)(({theme:e,ownerState:t})=>({gridArea:"1 / 1",width:"min-content",height:"min-content",zIndex:1,opacity:t.expanded?0:1,pointerEvents:t.expanded?"none":"auto",transition:e.transitions.create(["opacity"])})),i=t.styled(t.TextField)(({theme:e,ownerState:t})=>({gridArea:"1 / 1",overflowX:"clip",width:t.expanded?260:"var(--trigger-width)",opacity:t.expanded?1:0,transition:e.transitions.create(["width","opacity"])}));return e.createElement(n,null,e.createElement(r.QuickFilterTrigger,{render:(n,i)=>e.createElement(t.Tooltip,{title:"Search",enterDelay:0},e.createElement(o,{...n,ownerState:{expanded:i.expanded},color:"default","aria-disabled":i.expanded},e.createElement(r.GridSearchIcon,{fontSize:"small"})))}),e.createElement(r.QuickFilterControl,{render:({ref:n,...o},l)=>e.createElement(i,{...o,ownerState:{expanded:l.expanded},inputRef:n,"aria-label":"Search",placeholder:"Search...",size:"small",slotProps:{input:{startAdornment:e.createElement(t.InputAdornment,{position:"start"},e.createElement(r.GridSearchIcon,{fontSize:"small"})),endAdornment:l.value?e.createElement(t.InputAdornment,{position:"end"},e.createElement(r.QuickFilterClear,{edge:"end",size:"small","aria-label":"Clear search",material:{sx:{marginRight:-.75}}},e.createElement(r.GridCloseIcon,{fontSize:"small"}))):null,...o.slotProps?.input},...o.slotProps}})}))}const C=e.forwardRef(({icon:t,width:r=20,sx:n,...o},i)=>e.createElement(g.Icon,{icon:t,style:{width:20,height:r??20,...n}})),M=o.styled(m)(({ownerState:e})=>{const t=o.useTheme(),r="light"===t.palette.mode,n="filled"===e.variant,i="outlined"===e.variant,l="soft"===e.variant,a={..."default"===e.color&&{...n&&{color:r?t.palette.common.white:t.palette.grey[800],backgroundColor:t.palette.text.primary},...i&&{backgroundColor:"transparent",color:t.palette.text.primary,border:`2px solid ${t.palette.text.primary}`},...l&&{color:t.palette.text.secondary,backgroundColor:o.alpha(t.palette.grey[500],.16)}}},d={..."default"!==e.color&&{...n&&{color:t.palette[e.color].contrastText,backgroundColor:t.palette[e.color].main},...i&&{backgroundColor:"transparent",color:t.palette[e.color].main,border:`2px solid ${t.palette[e.color].main}`},...l&&{color:t.palette[e.color][r?"dark":"light"],backgroundColor:o.alpha(t.palette[e.color].main,.16)}}};return{height:24,minWidth:24,lineHeight:0,borderRadius:6,cursor:"default",alignItems:"center",whiteSpace:"nowrap",display:"inline-flex",justifyContent:"center",textTransform:"capitalize",padding:t.spacing(0,.75),fontSize:t.typography.pxToRem(12),fontWeight:t.typography.fontWeightBold,transition:t.transitions.create("all",{duration:t.transitions.duration.shorter}),...a,...d}}),k=e.forwardRef(({children:t,color:r="default",variant:n="soft",startIcon:o,endIcon:i,sx:l,...a},d)=>{const s={width:16,height:16,"& svg, img":{width:1,height:1,objectFit:"cover"}};return e.createElement(M,{ref:d,ownerState:{color:r,variant:n},sx:{...o&&{pl:.75},...i&&{pr:.75},...l},...a},o&&e.createElement(m,{sx:{mr:.75,...s}}," ",o," "),t,i&&e.createElement(m,{sx:{ml:.75,...s}}," ",i," "))}),S="__row_group_by_columns_group__",I="__check__",F="__detail_panel_toggle__",P="__aggregation_footer__",R=new Set([I,F]),N={compact:.7,standard:1,comfortable:1.3},D=52,z=56,G=50,O=e=>R.has(e)||e===S,T=e=>null==e,A=e=>T(e)||""===e||Array.isArray(e)&&0===e.length,L=(e,t,r)=>Math.min(Math.max(e,t),r),H=(...e)=>e.filter(Boolean).join(" "),V=(()=>{let e=0;return(t="mgh")=>(e+=1,`${t}-${e}`)})(),$=()=>"undefined"!=typeof window&&void 0!==window.localStorage,B=e=>{if(!$())return null;try{const t=window.localStorage.getItem(e);return t?JSON.parse(t):null}catch{return null}},U=(e,t)=>{if($())try{window.localStorage.setItem(e,JSON.stringify(t))}catch{}},_=(e,t)=>t?t(e):e.id,W=(e,t)=>{if(!e)return{type:"include",ids:new Set};if(Array.isArray(e))return{type:"include",ids:new Set(e)};if(e instanceof Set)return{type:"include",ids:new Set(e)};if("exclude"===e.type&&t){const r=new Set;return t.forEach(t=>{e.ids.has(t)||r.add(t)}),{type:"include",ids:r}}return{type:"include",ids:new Set(e.ids)}},q=e=>{if(T(e)||""===e)return null;if(e instanceof Date)return Number.isNaN(e.getTime())?null:e;if(u.isDayjs(e))return e.isValid()?e.toDate():null;if("number"==typeof e){const t=new Date(e);return Number.isNaN(t.getTime())?null:t}if("string"==typeof e){const t=u(e);return t.isValid()?t.toDate():null}return null},j=(e,t)=>{const r=q(e);return r?u(r).format(t?"M/D/YYYY h:mm A":"M/D/YYYY"):""},K=(e,t)=>t?u(e).startOf("minute").valueOf():u(e).startOf("day").valueOf(),Q=e=>"object"==typeof e&&null!==e,X=(e,t)=>e.getOptionValue?e.getOptionValue(t):Q(t)?t.value:t,Y=(e,t)=>e.getOptionLabel?e.getOptionLabel(t):Q(t)?t.label:String(t),J=(e,t,r)=>e.valueOptions?"function"==typeof e.valueOptions?e.valueOptions({field:e.field,row:t,id:r}):e.valueOptions:[],Z=(e,t,r)=>{const n=e?e[t.field]:void 0;return t.valueGetter?t.valueGetter(n,e,t,r):n},ee=(e,t,r,n)=>{if(T(e))return"";switch(t.type){case"date":return j(e,!1);case"dateTime":return j(e,!0);case"boolean":return e?"Yes":"No";case"singleSelect":{const o=J(t,r,n).find(r=>X(t,r)===e);return void 0!==o?Y(t,o):String(e)}case"number":return"number"==typeof e?Number.isFinite(e)?String(e):"":String(e);default:if(e instanceof Date)return j(e,!0);if("object"==typeof e)try{return JSON.stringify(e)}catch{return String(e)}return String(e)}},te=(e,t,r,n,o)=>r.valueFormatter?r.valueFormatter(e,t,r,n):ee(e,r,t,o),re=e=>T(e)?"":"string"==typeof e?e:"number"==typeof e||"boolean"==typeof e?String(e):e instanceof Date?j(e,!0):"object"==typeof e&&"props"in e?"":String(e),ne="undefined"!=typeof Intl?new Intl.Collator(void 0,{numeric:!0,sensitivity:"base"}):null,oe=(e,t)=>{const r=T(e)||""===e,n=T(t)||""===t;return r&&n?0:r?-1:n?1:null},ie=(e,t)=>{const r=oe(e,t);return null!==r?r:Number(e)-Number(t)},le=(e,t)=>{const r=oe(e,t);if(null!==r)return r;const n=String(e),o=String(t);return ne?ne.compare(n,o):n<o?-1:n>o?1:0},ae=(e,t,r,n)=>"number"==typeof e&&"number"==typeof t?ie(e,t):le(e,t),de=(e,t)=>{const r=q(e),n=q(t),o=oe(r,n);return null!==o?o:r.getTime()-n.getTime()},se=(e,t)=>{const r=oe(e,t);return null!==r?r:Number(Boolean(e))-Number(Boolean(t))},ce=e=>{switch(e){case"number":return ie;case"date":case"dateTime":return de;case"boolean":return se;default:return ae}},ge=e=>T(e)?"":String(e).toLowerCase(),me=e=>!A(e.value),ue=[{value:"contains",label:"contains",inputType:"text",getApplyFilterFn:e=>{if(!me(e))return null;const t=ge(e.value);return e=>-1!==ge(e).indexOf(t)}},{value:"doesNotContain",label:"does not contain",inputType:"text",getApplyFilterFn:e=>{if(!me(e))return null;const t=ge(e.value);return e=>-1===ge(e).indexOf(t)}},{value:"equals",label:"equals",inputType:"text",getApplyFilterFn:e=>{if(!me(e))return null;const t=ge(e.value);return e=>ge(e)===t}},{value:"doesNotEqual",label:"does not equal",inputType:"text",getApplyFilterFn:e=>{if(!me(e))return null;const t=ge(e.value);return e=>ge(e)!==t}},{value:"startsWith",label:"starts with",inputType:"text",getApplyFilterFn:e=>{if(!me(e))return null;const t=ge(e.value);return e=>0===ge(e).indexOf(t)}},{value:"endsWith",label:"ends with",inputType:"text",getApplyFilterFn:e=>{if(!me(e))return null;const t=ge(e.value);return e=>{const r=ge(e);return r.length>=t.length&&r.lastIndexOf(t)===r.length-t.length}}},{value:"isEmpty",label:"is empty",inputType:"none",requiresFilterValue:!1,getApplyFilterFn:()=>e=>A(e)},{value:"isNotEmpty",label:"is not empty",inputType:"none",requiresFilterValue:!1,getApplyFilterFn:()=>e=>!A(e)},{value:"isAnyOf",label:"is any of",inputType:"multiselect",getApplyFilterFn:e=>{if(!Array.isArray(e.value)||0===e.value.length)return null;const t=new Set(e.value.map(ge));return e=>t.has(ge(e))}}],pe=(e,t,r)=>({value:e,label:t,inputType:"number",getApplyFilterFn:e=>{if(!me(e))return null;const t=Number(e.value);return Number.isNaN(t)?null:e=>{if(T(e)||""===e)return!1;const n=Number(e);return!Number.isNaN(n)&&r(n,t)}}}),he=[pe("=","=",(e,t)=>e===t),pe("!=","!=",(e,t)=>e!==t),pe(">",">",(e,t)=>e>t),pe(">=",">=",(e,t)=>e>=t),pe("<","<",(e,t)=>e<t),pe("<=","<=",(e,t)=>e<=t),{value:"isEmpty",label:"is empty",inputType:"none",requiresFilterValue:!1,getApplyFilterFn:()=>e=>A(e)},{value:"isNotEmpty",label:"is not empty",inputType:"none",requiresFilterValue:!1,getApplyFilterFn:()=>e=>!A(e)},{value:"isAnyOf",label:"is any of",inputType:"multiselect",getApplyFilterFn:e=>{if(!Array.isArray(e.value)||0===e.value.length)return null;const t=new Set(e.value.map(e=>Number(e)));return e=>!T(e)&&t.has(Number(e))}}],fe=(e,t,r,n)=>({value:e,label:t,inputType:r?"datetime-local":"date",getApplyFilterFn:e=>{if(!me(e))return null;const t=q(e.value);if(!t)return null;const o=K(t,r);return e=>{const t=q(e);return!!t&&n(K(t,r),o)}}}),be=e=>[fe("is","is",e,(e,t)=>e===t),fe("not","is not",e,(e,t)=>e!==t),fe("after","is after",e,(e,t)=>e>t),fe("onOrAfter","is on or after",e,(e,t)=>e>=t),fe("before","is before",e,(e,t)=>e<t),fe("onOrBefore","is on or before",e,(e,t)=>e<=t),{value:"isEmpty",label:"is empty",inputType:"none",requiresFilterValue:!1,getApplyFilterFn:()=>e=>null===q(e)},{value:"isNotEmpty",label:"is not empty",inputType:"none",requiresFilterValue:!1,getApplyFilterFn:()=>e=>null!==q(e)}],xe=[{value:"is",label:"is",inputType:"boolean",getApplyFilterFn:e=>{if(T(e.value)||""===e.value||"any"===e.value)return null;const t=!0===e.value||"true"===e.value;return e=>Boolean(e)===t}}],we=[{value:"is",label:"is",inputType:"select",getApplyFilterFn:e=>T(e.value)||""===e.value?null:t=>String(t)===String(e.value)},{value:"not",label:"is not",inputType:"select",getApplyFilterFn:e=>T(e.value)||""===e.value?null:t=>String(t)!==String(e.value)},{value:"isAnyOf",label:"is any of",inputType:"multiselect",getApplyFilterFn:e=>{if(!Array.isArray(e.value)||0===e.value.length)return null;const t=new Set(e.value.map(String));return e=>t.has(String(e))}}],ve=e=>e.filterOperators??(e=>{switch(e){case"number":return he;case"date":return be(!1);case"dateTime":return be(!0);case"boolean":return xe;case"singleSelect":return we;case"actions":return[];default:return ue}})(e.type),ye=e=>{const t=e.type??"string",r="number"===t,n="boolean"===t,o="actions"===t;return{...e,type:t,headerName:e.headerName??e.field,width:e.width??100,minWidth:e.minWidth??G,align:e.align??(r?"right":n||o?"center":"left"),headerAlign:e.headerAlign??e.align??(r?"right":n||o?"center":"left"),sortable:!o&&(e.sortable??!0),filterable:!o&&(e.filterable??!0),hideable:e.hideable??!0,resizable:e.resizable??!0,pinnable:e.pinnable??!0,groupable:!o&&(e.groupable??!0),aggregable:!o&&(e.aggregable??!0),editable:e.editable??!1,disableColumnMenu:e.disableColumnMenu??o,disableExport:e.disableExport??o}},Ee=(e,t)=>ye({field:e,headerName:"",width:t,minWidth:t,maxWidth:t,sortable:!1,filterable:!1,hideable:!1,resizable:!1,pinnable:!1,groupable:!1,aggregable:!1,disableColumnMenu:!0,disableExport:!0,disableReorder:!0,align:"center",headerAlign:"center"}),Ce=Ee(I,50),Me=Ee(F,50),ke=new Set(["animationIterationCount","borderImageOutset","borderImageSlice","borderImageWidth","boxFlex","boxFlexGroup","boxOrdinalGroup","columnCount","columns","flex","flexGrow","flexPositive","flexShrink","flexNegative","flexOrder","gridArea","gridRow","gridRowEnd","gridRowSpan","gridRowStart","gridColumn","gridColumnEnd","gridColumnSpan","gridColumnStart","fontWeight","lineClamp","lineHeight","opacity","order","orphans","tabSize","widows","zIndex","zoom","fillOpacity","floodOpacity","stopOpacity","strokeDasharray","strokeDashoffset","strokeMiterlimit","strokeOpacity","strokeWidth"]),Se=e=>/[&.:#>\[\s*~+,@]/.test(e),Ie=e=>Object.keys(e).filter(t=>{const r=e[t];return!Se(t)&&("string"==typeof r||"number"==typeof r)}).map(t=>{return`${(e=>{if(0===e.indexOf("--"))return e;const t=e.replace(/[A-Z]/g,e=>`-${e.toLowerCase()}`);return 0===t.indexOf("ms-")?`-${t}`:t})(t)}:${r=t,n=e[t],"number"!=typeof n||0===n||ke.has(r)||0===r.indexOf("--")?String(n):`${n}px`}`;var r,n}).join(";"),Fe=(e,t,r=[])=>t?(Object.keys(t).forEach(n=>{const o=t[n];if(!o||"object"!=typeof o)return;const i=o;if("@"===n.charAt(0)){const t=[],o=Ie(i);return o&&t.push(`${e}{${o}}`),Fe(e,i,t),void(t.length&&r.push(`${n}{${t.join("")}}`))}const l=((e,t)=>t.split(",").map(e=>e.trim()).filter(Boolean).map(t=>-1!==t.indexOf("&")?t.replace(/&/g,e):`${e} ${t}`).join(","))(e,n),a=Ie(i);a&&r.push(`${l}{${a}}`),Fe(l,i,r)}),r):r,Pe=e=>e.map(e=>"number"==typeof e?e:Number(e)).filter(e=>!Number.isNaN(e)&&null!==e),Re={sum:{label:"sum",columnTypes:["number"],apply:({values:e})=>{const t=Pe(e.filter(e=>!T(e)&&""!==e));return 0===t.length?null:t.reduce((e,t)=>e+t,0)}},avg:{label:"avg",columnTypes:["number"],apply:({values:e})=>{const t=Pe(e.filter(e=>!T(e)&&""!==e));return 0===t.length?null:t.reduce((e,t)=>e+t,0)/t.length}},min:{label:"min",columnTypes:["number","date","dateTime"],apply:({values:e})=>{const t=e.filter(e=>!T(e)&&""!==e);if(0===t.length)return null;if(t.every(e=>"number"==typeof e))return Math.min(...t);const r=t.map(q);return r.every(e=>null!==e)?new Date(Math.min(...r.map(e=>e.getTime()))):t.slice().sort((e,t)=>le(e,t))[0]}},max:{label:"max",columnTypes:["number","date","dateTime"],apply:({values:e})=>{const t=e.filter(e=>!T(e)&&""!==e);if(0===t.length)return null;if(t.every(e=>"number"==typeof e))return Math.max(...t);const r=t.map(q);if(r.every(e=>null!==e))return new Date(Math.max(...r.map(e=>e.getTime())));const n=t.slice().sort((e,t)=>le(e,t));return n[n.length-1]}},size:{label:"size",apply:({values:e})=>e.length}},Ne={noRowsLabel:"No rows",loadingLabel:"Loading…",toolbarColumns:"Columns",toolbarFilters:"Filters",toolbarExport:"Export",toolbarDensity:"Density",toolbarQuickFilterPlaceholder:"Search...",toolbarQuickFilterLabel:"Search",toolbarExportCSV:"Download as CSV",toolbarExportExcel:"Download as Excel",toolbarExportPrint:"Print",densityCompact:"Compact",densityStandard:"Standard",densityComfortable:"Comfortable",columnsPanelSearchPlaceholder:"Search",columnsPanelShowAll:"Show all",columnsPanelHideAll:"Hide all",columnsPanelReset:"Reset",filterPanelAddFilter:"Add filter",filterPanelRemoveAll:"Remove all",filterPanelDeleteIcon:"Delete",filterPanelColumns:"Columns",filterPanelOperator:"Operator",filterPanelValue:"Value",filterPanelInputPlaceholder:"Filter value",filterPanelLogicOperator:"Logic operator",filterPanelOperatorAnd:"And",filterPanelOperatorOr:"Or",columnMenuSortAsc:"Sort by ASC",columnMenuSortDesc:"Sort by DESC",columnMenuUnsort:"Unsort",columnMenuFilter:"Filter",columnMenuHideColumn:"Hide column",columnMenuManageColumns:"Manage columns",columnMenuPinLeft:"Pin to left",columnMenuPinRight:"Pin to right",columnMenuUnpin:"Unpin",columnMenuGroup:e=>`Group by ${e}`,columnMenuUngroup:e=>`Stop grouping by ${e}`,columnMenuAggregation:"Aggregation",aggregationMenuItemHeader:"Aggregation",aggregationFunctionLabelNone:"none",aggregationFunctionLabelSum:"sum",aggregationFunctionLabelAvg:"avg",aggregationFunctionLabelMin:"min",aggregationFunctionLabelMax:"max",aggregationFunctionLabelSize:"size",footerRowSelected:e=>1===e?"1 row selected":`${e.toLocaleString()} rows selected`,footerTotalRows:"Total Rows:",footerPaginationRowsPerPage:"Rows per page:",footerPaginationDisplayedRows:(e,t,r)=>`${e}–${t} of ${r.toLocaleString()}`,footerPaginationFirstPage:"First page",footerPaginationPreviousPage:"Previous page",footerPaginationNextPage:"Next page",footerPaginationLastPage:"Last page",checkboxSelectionHeaderName:"Checkbox selection",checkboxSelectionSelectAllRows:"Select all rows",checkboxSelectionUnselectAllRows:"Unselect all rows",checkboxSelectionSelectRow:"Select row",checkboxSelectionUnselectRow:"Unselect row",booleanCellTrueLabel:"yes",booleanCellFalseLabel:"no",detailPanelToggle:"Detail panel toggle",expandDetailPanel:"Expand",collapseDetailPanel:"Collapse",groupingColumnHeaderName:"Group",groupColumn:e=>`Group by ${e}`,unGroupColumn:e=>`Stop grouping by ${e}`,actionsCellMore:"more",columnHeaderSortIconLabel:"Sort",columnMenuLabel:"Menu",clearSearch:"Clear search"};let De;const ze=(e,t)=>{if("undefined"==typeof document)return 8*e.length;if(void 0===De){const e=document.createElement("canvas");De=e.getContext("2d")}return De?(De.font=t,De.measureText(e).width):8*e.length},Ge=(e,t)=>{if("undefined"==typeof document)return;const r=URL.createObjectURL(e),n=document.createElement("a");n.href=r,n.download=t,n.style.display="none",document.body.appendChild(n),n.click(),window.setTimeout(()=>{document.body.removeChild(n),URL.revokeObjectURL(r)},0)},Oe="mgh-grid-styles",Te='\n.mgh-grid-card {\n --mgh-grid-font-family: inherit;\n --mgh-grid-font-size: 14px;\n --mgh-grid-radius: 16px;\n --mgh-grid-inner-radius: 4px;\n --mgh-grid-paper: #ffffff;\n --mgh-grid-bg: #ffffff;\n --mgh-grid-fg: rgba(0, 0, 0, 0.87);\n --mgh-grid-fg-secondary: rgba(0, 0, 0, 0.6);\n --mgh-grid-fg-disabled: rgba(0, 0, 0, 0.38);\n --mgh-grid-border: rgba(224, 224, 224, 1);\n --mgh-grid-header-bg: #ffffff;\n --mgh-grid-header-fg: rgba(0, 0, 0, 0.87);\n --mgh-grid-hover: rgba(0, 0, 0, 0.04);\n --mgh-grid-hover-strong: rgba(0, 0, 0, 0.08);\n --mgh-grid-selected: rgba(25, 118, 210, 0.08);\n --mgh-grid-selected-hover: rgba(25, 118, 210, 0.12);\n --mgh-grid-primary: #1976d2;\n --mgh-grid-primary-contrast: #ffffff;\n --mgh-grid-focus: #1976d2;\n --mgh-grid-shadow: 0 0 2px rgba(145, 158, 171, 0.2), 0 12px 24px -4px rgba(145, 158, 171, 0.12);\n --mgh-grid-popover-shadow: 0 5px 5px -3px rgba(0,0,0,.2), 0 8px 10px 1px rgba(0,0,0,.14), 0 3px 14px 2px rgba(0,0,0,.12);\n --mgh-grid-overlay: rgba(255, 255, 255, 0.6);\n --mgh-grid-input-bg: transparent;\n --mgh-grid-input-border: rgba(0, 0, 0, 0.23);\n --mgh-grid-pinned-shadow: rgba(0, 0, 0, 0.12);\n --mgh-grid-group-bg: rgba(0, 0, 0, 0.02);\n --mgh-grid-footer-bg: rgba(0, 0, 0, 0.02);\n --mgh-grid-badge: #1976d2;\n --mgh-grid-scrollbar: rgba(0, 0, 0, 0.3);\n\n position: relative;\n display: flex;\n flex-direction: column;\n min-width: 0;\n background: var(--mgh-grid-paper);\n color: var(--mgh-grid-fg);\n border-radius: var(--mgh-grid-radius);\n box-shadow: var(--mgh-grid-shadow);\n font-family: var(--mgh-grid-font-family);\n font-size: var(--mgh-grid-font-size);\n line-height: 1.5;\n overflow: hidden;\n box-sizing: border-box;\n}\n.mgh-grid-card[data-mgh-theme="dark"] {\n --mgh-grid-paper: #212b36;\n --mgh-grid-bg: #212b36;\n --mgh-grid-fg: #ffffff;\n --mgh-grid-fg-secondary: rgba(255, 255, 255, 0.7);\n --mgh-grid-fg-disabled: rgba(255, 255, 255, 0.5);\n --mgh-grid-border: rgba(81, 81, 81, 1);\n --mgh-grid-header-bg: #212b36;\n --mgh-grid-header-fg: #ffffff;\n --mgh-grid-hover: rgba(255, 255, 255, 0.08);\n --mgh-grid-hover-strong: rgba(255, 255, 255, 0.16);\n --mgh-grid-selected: rgba(144, 202, 249, 0.16);\n --mgh-grid-selected-hover: rgba(144, 202, 249, 0.24);\n --mgh-grid-primary: #90caf9;\n --mgh-grid-primary-contrast: rgba(0, 0, 0, 0.87);\n --mgh-grid-focus: #90caf9;\n --mgh-grid-shadow: 0 0 2px rgba(0, 0, 0, 0.2), 0 12px 24px -4px rgba(0, 0, 0, 0.12);\n --mgh-grid-overlay: rgba(33, 43, 54, 0.6);\n --mgh-grid-input-border: rgba(255, 255, 255, 0.23);\n --mgh-grid-pinned-shadow: rgba(0, 0, 0, 0.5);\n --mgh-grid-group-bg: rgba(255, 255, 255, 0.03);\n --mgh-grid-footer-bg: rgba(255, 255, 255, 0.03);\n --mgh-grid-badge: #90caf9;\n --mgh-grid-scrollbar: rgba(255, 255, 255, 0.3);\n}\n/* Only our own elements get the border-box reset. A blanket descendant reset would leak into\n consumer content rendered through slots (e.g. MUI TextField inputs rely on content-box). */\n[class*="mgh-grid"], [class*="mgh-grid"]::before, [class*="mgh-grid"]::after { box-sizing: border-box; }\n.mgh-grid-card--plain { box-shadow: none; border-radius: 0; background: transparent; }\n\n/* ---- card header ---- */\n/* Title stays on its row; only the end-content group wraps internally (like the legacy MUI card). */\n.mgh-grid-card-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding: 16px 16px 16px 0; flex-wrap: nowrap; }\n.mgh-grid-card-title { flex: 0 0 auto; padding: 8px 24px; margin: 0; font-size: 1.125rem; font-weight: 700; line-height: 1.5556; }\n.mgh-grid-card-header-center { flex: 0 1 auto; min-width: 0; display: flex; align-items: center; }\n.mgh-grid-card-header-end { flex: 1 1 auto; min-width: 0; margin-left: auto; display: flex; align-items: center; gap: 16px; flex-wrap: wrap; justify-content: flex-end; }\n@media (max-width: 599.95px) {\n .mgh-grid-card-header { flex-wrap: wrap; }\n .mgh-grid-card-header-end { gap: 8px; }\n}\n\n/* ---- box + root ---- */\n.mgh-grid-box { display: flex; flex-direction: column; flex-grow: 1; min-height: 0; min-width: 0; }\n.mgh-grid {\n position: relative;\n display: flex;\n flex-direction: column;\n flex: 1 1 auto;\n min-height: 0;\n min-width: 0;\n border: 1px solid var(--mgh-grid-border);\n border-radius: var(--mgh-grid-inner-radius);\n background: var(--mgh-grid-bg);\n color: var(--mgh-grid-fg);\n outline: none;\n}\n.mgh-grid--auto-height { flex: 0 0 auto; }\n\n/* ---- toolbar ---- */\n.mgh-grid-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 45px; padding: 4px 8px; border-bottom: 1px solid var(--mgh-grid-border); flex-wrap: wrap; }\n.mgh-grid-toolbar-group { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }\n.mgh-grid-toolbar-center { display: flex; align-items: center; flex: 1 1 auto; justify-content: center; }\n\n/* ---- buttons ---- */\n.mgh-grid-btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 0; margin: 0; background: transparent; color: var(--mgh-grid-fg-secondary); font: inherit; font-size: 0.8125rem; font-weight: 500; line-height: 1.75; letter-spacing: .02em; padding: 4px 8px; border-radius: 4px; cursor: pointer; user-select: none; transition: background-color .15s, color .15s; text-transform: none; white-space: nowrap; }\n.mgh-grid-btn:hover { background: var(--mgh-grid-hover); color: var(--mgh-grid-fg); }\n.mgh-grid-btn:focus-visible { outline: 2px solid var(--mgh-grid-focus); outline-offset: 1px; }\n.mgh-grid-btn:disabled { color: var(--mgh-grid-fg-disabled); cursor: default; background: transparent; }\n.mgh-grid-btn--icon { padding: 6px; border-radius: 50%; width: 32px; height: 32px; }\n.mgh-grid-btn--icon.mgh-grid-btn--small { width: 26px; height: 26px; padding: 3px; }\n.mgh-grid-btn--icon.mgh-grid-btn--small .mgh-grid-icon { width: 18px; height: 18px; }\n.mgh-grid-btn--primary { color: var(--mgh-grid-primary); }\n.mgh-grid-btn--primary:hover { background: var(--mgh-grid-selected); color: var(--mgh-grid-primary); }\n.mgh-grid-btn--contained { background: var(--mgh-grid-primary); color: var(--mgh-grid-primary-contrast); }\n.mgh-grid-btn--contained:hover { background: var(--mgh-grid-primary); color: var(--mgh-grid-primary-contrast); filter: brightness(0.92); }\n.mgh-grid-btn--active { color: var(--mgh-grid-primary); }\n\n/* ---- badge ---- */\n.mgh-grid-badge { position: relative; display: inline-flex; }\n.mgh-grid-badge-dot { position: absolute; top: 0; right: 0; min-width: 8px; height: 8px; border-radius: 4px; background: var(--mgh-grid-badge); transform: translate(50%, -50%); }\n.mgh-grid-badge-count { position: absolute; top: 0; right: 0; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 8px; background: var(--mgh-grid-badge); color: var(--mgh-grid-primary-contrast); font-size: 10px; font-weight: 600; line-height: 16px; text-align: center; transform: translate(50%, -50%); }\n\n/* ---- inputs ---- */\n.mgh-grid-input, .mgh-grid-select { font: inherit; font-size: 0.875rem; color: var(--mgh-grid-fg); background: var(--mgh-grid-input-bg); border: 1px solid var(--mgh-grid-input-border); border-radius: 6px; padding: 6px 10px; height: 36px; min-width: 0; outline: none; transition: border-color .15s, box-shadow .15s; }\n.mgh-grid-input:hover, .mgh-grid-select:hover { border-color: var(--mgh-grid-fg); }\n.mgh-grid-input:focus, .mgh-grid-select:focus { border-color: var(--mgh-grid-focus); box-shadow: 0 0 0 1px var(--mgh-grid-focus); }\n.mgh-grid-input::placeholder { color: var(--mgh-grid-fg-disabled); }\n.mgh-grid-input--small, .mgh-grid-select--small { height: 32px; padding: 4px 8px; font-size: 0.8125rem; }\n.mgh-grid-select { appearance: none; -webkit-appearance: none; padding-right: 28px; background-image: url("data:image/svg+xml;utf8,<svg xmlns=\'http://www.w3.org/2000/svg\' viewBox=\'0 0 24 24\' fill=\'%23888\'><path d=\'M7 10l5 5 5-5z\'/></svg>"); background-repeat: no-repeat; background-position: right 6px center; background-size: 18px; cursor: pointer; }\n.mgh-grid-select option { color: initial; background: initial; }\n.mgh-grid-card[data-mgh-theme="dark"] .mgh-grid-select option, .mgh-grid-popover[data-mgh-theme="dark"] .mgh-grid-select option { color: #fff; background: #212b36; }\n.mgh-grid-select[multiple] { height: auto; min-height: 36px; background-image: none; padding-right: 10px; }\n.mgh-grid-field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }\n.mgh-grid-field-label { font-size: 0.75rem; color: var(--mgh-grid-fg-secondary); }\n.mgh-grid-input-adorned { position: relative; display: flex; align-items: center; }\n.mgh-grid-input-adorned .mgh-grid-input { width: 100%; padding-left: 34px; }\n.mgh-grid-input-adorned--clearable .mgh-grid-input { padding-right: 34px; }\n.mgh-grid-input-adornment { position: absolute; left: 10px; display: inline-flex; color: var(--mgh-grid-fg-secondary); pointer-events: none; }\n.mgh-grid-input-adornment--end { left: auto; right: 4px; pointer-events: auto; }\n\n/* ---- checkbox ---- */\n.mgh-grid-checkbox { appearance: none; -webkit-appearance: none; width: 18px; height: 18px; margin: 0; border: 2px solid var(--mgh-grid-fg-secondary); border-radius: 3px; background: transparent; cursor: pointer; display: inline-grid; place-content: center; position: relative; flex: 0 0 auto; transition: background-color .12s, border-color .12s; }\n.mgh-grid-checkbox:hover { border-color: var(--mgh-grid-fg); }\n.mgh-grid-checkbox:focus-visible { outline: 2px solid var(--mgh-grid-focus); outline-offset: 2px; }\n.mgh-grid-checkbox:checked, .mgh-grid-checkbox:indeterminate { background: var(--mgh-grid-primary); border-color: var(--mgh-grid-primary); }\n.mgh-grid-checkbox:checked::after { content: ""; width: 5px; height: 10px; border: solid var(--mgh-grid-primary-contrast); border-width: 0 2px 2px 0; transform: translateY(-1px) rotate(45deg); }\n.mgh-grid-checkbox:indeterminate::after { content: ""; width: 10px; height: 2px; background: var(--mgh-grid-primary-contrast); }\n.mgh-grid-checkbox:disabled { opacity: 0.4; cursor: default; }\n.mgh-grid-checkbox-label { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-size: 0.875rem; padding: 6px 4px; border-radius: 4px; }\n.mgh-grid-checkbox-label:hover { background: var(--mgh-grid-hover); }\n\n/* ---- quick filter ---- */\n.mgh-grid-quick-filter { display: grid; align-items: center; }\n.mgh-grid-quick-filter-trigger { grid-area: 1 / 1; z-index: 1; transition: opacity .2s; }\n.mgh-grid-quick-filter--expanded .mgh-grid-quick-filter-trigger { opacity: 0; pointer-events: none; }\n.mgh-grid-quick-filter-control { grid-area: 1 / 1; width: 32px; opacity: 0; overflow: hidden; transition: width .2s, opacity .2s; }\n.mgh-grid-quick-filter--expanded .mgh-grid-quick-filter-control { width: 260px; opacity: 1; }\n@media (max-width: 599.95px) { .mgh-grid-quick-filter--expanded .mgh-grid-quick-filter-control { width: 180px; } }\n\n/* ---- main / scroller ---- */\n.mgh-grid-main { position: relative; display: flex; flex: 1 1 auto; min-height: 0; min-width: 0; overflow: hidden; }\n.mgh-grid--auto-height .mgh-grid-main { flex: 0 0 auto; }\n.mgh-grid-scroller { position: relative; flex: 1 1 auto; min-height: 0; min-width: 0; overflow: auto; outline: none; scrollbar-width: thin; }\n.mgh-grid--auto-height .mgh-grid-scroller { overflow-y: hidden; }\n.mgh-grid-scroller::-webkit-scrollbar { width: 10px; height: 10px; }\n.mgh-grid-scroller::-webkit-scrollbar-thumb { background: var(--mgh-grid-scrollbar); border-radius: 5px; border: 2px solid transparent; background-clip: content-box; }\n\n/* ---- column headers ---- */\n.mgh-grid-columns { position: sticky; top: 0; z-index: 3; background: var(--mgh-grid-header-bg); border-bottom: 1px solid var(--mgh-grid-border); min-width: 100%; width: max-content; }\n.mgh-grid-header-row { display: flex; min-width: 100%; }\n.mgh-grid-header-cell { position: relative; display: flex; align-items: center; flex: 0 0 auto; height: var(--mgh-grid-header-height); padding: 0 10px; font-weight: 600; font-size: 0.875rem; color: var(--mgh-grid-header-fg); background: var(--mgh-grid-header-bg); white-space: nowrap; overflow: hidden; user-select: none; outline: none; }\n.mgh-grid-header-cell--sortable { cursor: pointer; }\n.mgh-grid-header-cell:focus-visible { outline: 2px solid var(--mgh-grid-focus); outline-offset: -2px; }\n.mgh-grid-header-cell--align-center { justify-content: center; }\n.mgh-grid-header-cell--align-right { justify-content: flex-end; }\n.mgh-grid-header-cell--align-right .mgh-grid-header-title-container { flex-direction: row-reverse; }\n.mgh-grid-header-title-container { display: flex; align-items: center; gap: 2px; min-width: 0; flex: 1 1 auto; overflow: hidden; }\n.mgh-grid-header-cell--align-center .mgh-grid-header-title-container { flex: 0 1 auto; }\n.mgh-grid-header-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }\n.mgh-grid-sort-icon { display: inline-flex; align-items: center; color: var(--mgh-grid-fg-secondary); opacity: 0; transition: opacity .15s; flex: 0 0 auto; }\n.mgh-grid-header-cell:hover .mgh-grid-sort-icon, .mgh-grid-sort-icon--active { opacity: 1; }\n.mgh-grid-sort-index { font-size: 10px; margin-left: -2px; color: var(--mgh-grid-fg-secondary); }\n.mgh-grid-header-menu-btn { position: absolute; right: 2px; opacity: 0; transition: opacity .15s; background: var(--mgh-grid-header-bg); }\n.mgh-grid-header-cell--align-right .mgh-grid-header-menu-btn { right: auto; left: 2px; }\n.mgh-grid-header-cell:hover .mgh-grid-header-menu-btn, .mgh-grid-header-menu-btn--open, .mgh-grid-header-cell:focus-within .mgh-grid-header-menu-btn { opacity: 1; }\n.mgh-grid-header-cell--menu-open { background: var(--mgh-grid-hover); }\n.mgh-grid-resize-handle { position: absolute; top: 0; right: -4px; width: 9px; height: 100%; cursor: col-resize; z-index: 2; display: flex; justify-content: center; touch-action: none; }\n.mgh-grid-resize-handle::after { content: ""; width: 1px; height: 60%; margin-top: 20%; background: var(--mgh-grid-border); transition: background .15s, width .15s; }\n.mgh-grid-resize-handle:hover::after, .mgh-grid-resize-handle--active::after { background: var(--mgh-grid-primary); width: 2px; }\n.mgh-grid-header-cell--last .mgh-grid-resize-handle { right: 0; }\n.mgh-grid-header-cell--dragging { opacity: 0.5; }\n.mgh-grid-header-cell--drop-left::before, .mgh-grid-header-cell--drop-right::before { content: ""; position: absolute; top: 4px; bottom: 4px; width: 2px; background: var(--mgh-grid-primary); z-index: 3; }\n.mgh-grid-header-cell--drop-left::before { left: 0; }\n.mgh-grid-header-cell--drop-right::before { right: 0; }\n.mgh-grid-header-filler { flex: 1 1 auto; background: var(--mgh-grid-header-bg); }\n\n/* ---- pinned cells ---- */\n.mgh-grid-cell--pinned-left, .mgh-grid-header-cell--pinned-left { position: sticky; z-index: 2; background-color: var(--mgh-grid-bg); }\n.mgh-grid-cell--pinned-right, .mgh-grid-header-cell--pinned-right { position: sticky; z-index: 2; background-color: var(--mgh-grid-bg); }\n.mgh-grid-header-cell--pinned-left, .mgh-grid-header-cell--pinned-right { z-index: 4; background-color: var(--mgh-grid-header-bg); }\n.mgh-grid-cell--pinned-left-last, .mgh-grid-header-cell--pinned-left-last { box-shadow: 2px 0 4px -2px var(--mgh-grid-pinned-shadow); }\n.mgh-grid-cell--pinned-right-first, .mgh-grid-header-cell--pinned-right-first { box-shadow: -2px 0 4px -2px var(--mgh-grid-pinned-shadow); }\n.mgh-grid--no-pinned-shadow .mgh-grid-cell--pinned-left-last, .mgh-grid--no-pinned-shadow .mgh-grid-header-cell--pinned-left-last { box-shadow: none; }\n\n/* ---- body & rows ---- */\n.mgh-grid-body { position: relative; min-width: 100%; width: max-content; }\n.mgh-grid-body--flow { display: flex; flex-direction: column; }\n.mgh-grid-row-block { min-width: 100%; }\n.mgh-grid-body--virtual .mgh-grid-row-block { position: absolute; left: 0; }\n.mgh-grid-row { display: flex; min-width: 100%; border-bottom: 1px solid var(--mgh-grid-border); background: var(--mgh-grid-bg); position: relative; }\n.mgh-grid-row--auto-height { align-items: stretch; }\n.mgh-grid-row:hover { background: var(--mgh-grid-hover); }\n.mgh-grid-row--selected { background: var(--mgh-grid-selected); }\n.mgh-grid-row--selected:hover { background: var(--mgh-grid-selected-hover); }\n.mgh-grid-row--clickable { cursor: pointer; }\n.mgh-grid-row--group { background: var(--mgh-grid-group-bg); }\n.mgh-grid-row--pinned { background: var(--mgh-grid-bg); }\n.mgh-grid-row--footer { background: var(--mgh-grid-footer-bg); font-weight: 600; }\n.mgh-grid-row:hover .mgh-grid-cell--pinned-left, .mgh-grid-row:hover .mgh-grid-cell--pinned-right { background-image: linear-gradient(var(--mgh-grid-hover), var(--mgh-grid-hover)); }\n.mgh-grid-row--selected .mgh-grid-cell--pinned-left, .mgh-grid-row--selected .mgh-grid-cell--pinned-right { background-image: linear-gradient(var(--mgh-grid-selected), var(--mgh-grid-selected)); }\n.mgh-grid-row--selected:hover .mgh-grid-cell--pinned-left, .mgh-grid-row--selected:hover .mgh-grid-cell--pinned-right { background-image: linear-gradient(var(--mgh-grid-selected-hover), var(--mgh-grid-selected-hover)); }\n.mgh-grid-row--group .mgh-grid-cell--pinned-left, .mgh-grid-row--group .mgh-grid-cell--pinned-right { background-image: linear-gradient(var(--mgh-grid-group-bg), var(--mgh-grid-group-bg)); }\n.mgh-grid-row--footer .mgh-grid-cell--pinned-left, .mgh-grid-row--footer .mgh-grid-cell--pinned-right { background-image: linear-gradient(var(--mgh-grid-footer-bg), var(--mgh-grid-footer-bg)); }\n.mgh-grid-row-filler { flex: 1 1 auto; }\n\n.mgh-grid-cell { display: flex; align-items: center; flex: 0 0 auto; padding: 0 10px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-size: 0.875rem; outline: none; min-height: 100%; }\n.mgh-grid-cell > .mgh-grid-cell-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }\n.mgh-grid-row--auto-height .mgh-grid-cell { white-space: normal; align-items: flex-start; padding-top: 8px; padding-bottom: 8px; }\n.mgh-grid-row--auto-height .mgh-grid-cell > .mgh-grid-cell-text { white-space: normal; word-break: break-word; }\n.mgh-grid-cell--align-center { justify-content: center; }\n.mgh-grid-cell--align-right { justify-content: flex-end; }\n.mgh-grid-cell--focused { outline: 1px solid var(--mgh-grid-focus); outline-offset: -1px; }\n.mgh-grid-cell--editable { cursor: text; }\n.mgh-grid-cell--editing { padding: 0 4px; outline: 2px solid var(--mgh-grid-focus); outline-offset: -2px; background: var(--mgh-grid-bg); }\n.mgh-grid-cell--editing .mgh-grid-input, .mgh-grid-cell--editing .mgh-grid-select { width: 100%; height: calc(100% - 6px); border: 0; box-shadow: none; padding: 0 6px; background: transparent; }\n.mgh-grid-cell--checkbox, .mgh-grid-header-cell--checkbox, .mgh-grid-cell--detail-toggle, .mgh-grid-header-cell--detail-toggle { justify-content: center; padding: 0; }\n.mgh-grid-cell--boolean .mgh-grid-icon { color: var(--mgh-grid-fg-secondary); }\n.mgh-grid-cell--actions { gap: 2px; justify-content: center; }\n.mgh-grid-cell--aggregation { flex-direction: column; align-items: stretch; justify-content: center; line-height: 1.2; }\n.mgh-grid-cell--aggregation.mgh-grid-cell--align-right { align-items: flex-end; }\n.mgh-grid-cell--aggregation.mgh-grid-cell--align-center { align-items: center; }\n.mgh-grid-aggregation-label { font-size: 0.65rem; font-weight: 500; text-transform: uppercase; color: var(--mgh-grid-fg-secondary); letter-spacing: .04em; }\n.mgh-grid-group-cell { display: flex; align-items: center; gap: 4px; min-width: 0; }\n.mgh-grid-group-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }\n.mgh-grid-group-count { color: var(--mgh-grid-fg-secondary); margin-left: 2px; }\n.mgh-grid-group-toggle { flex: 0 0 auto; }\n.mgh-grid-group-toggle .mgh-grid-icon { transition: transform .15s; }\n.mgh-grid-group-toggle--expanded .mgh-grid-icon { transform: rotate(90deg); }\n.mgh-grid-detail-toggle .mgh-grid-icon { transition: transform .15s; }\n.mgh-grid-detail-toggle--expanded .mgh-grid-icon { transform: rotate(180deg); }\n\n/* ---- pinned rows ---- */\n.mgh-grid-pinned-rows { position: sticky; z-index: 2; min-width: 100%; width: max-content; background: var(--mgh-grid-bg); }\n.mgh-grid-pinned-rows--top { box-shadow: 0 2px 4px -2px var(--mgh-grid-pinned-shadow); }\n.mgh-grid-pinned-rows--bottom { bottom: 0; box-shadow: 0 -2px 4px -2px var(--mgh-grid-pinned-shadow); }\n.mgh-grid-pinned-rows--bottom .mgh-grid-row { border-bottom: 0; border-top: 1px solid var(--mgh-grid-border); }\n\n/* ---- detail panel ---- */\n.mgh-grid-detail-panel { position: sticky; left: 0; overflow: auto; border-bottom: 1px solid var(--mgh-grid-border); background: var(--mgh-grid-bg); z-index: 1; }\n\n/* ---- overlays ---- */\n.mgh-grid-overlay { position: absolute; left: 0; right: 0; bottom: 0; display: flex; align-items: center; justify-content: center; flex-direction: column; gap: 8px; z-index: 5; color: var(--mgh-grid-fg-secondary); font-size: 0.875rem; pointer-events: none; }\n.mgh-grid-overlay--loading { background: var(--mgh-grid-overlay); pointer-events: auto; }\n.mgh-grid-no-rows { display: flex; align-items: center; justify-content: center; gap: 8px; height: 100%; text-align: center; padding: 16px; }\n.mgh-grid-no-rows img, .mgh-grid-no-rows .mgh-grid-icon { width: 50px; height: 50px; color: var(--mgh-grid-fg-disabled); }\n.mgh-grid-spinner { width: 36px; height: 36px; border-radius: 50%; border: 3px solid var(--mgh-grid-selected); border-top-color: var(--mgh-grid-primary); animation: mgh-grid-spin .8s linear infinite; }\n@keyframes mgh-grid-spin { to { transform: rotate(360deg); } }\n\n/* ---- footer ---- */\n.mgh-grid-footer { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 52px; padding: 0 8px 0 16px; border-top: 1px solid var(--mgh-grid-border); font-size: 0.875rem; color: var(--mgh-grid-fg-secondary); flex-wrap: wrap; }\n.mgh-grid-footer-left { display: flex; align-items: center; gap: 16px; }\n.mgh-grid-pagination { display: flex; align-items: center; gap: 8px; margin-left: auto; flex-wrap: wrap; }\n.mgh-grid-pagination-select { height: 32px; padding: 2px 24px 2px 8px; font-size: 0.875rem; border-color: transparent; }\n.mgh-grid-pagination-select:hover { border-color: transparent; background-color: var(--mgh-grid-hover); }\n.mgh-grid-pagination-actions { display: inline-flex; align-items: center; }\n\n/* ---- popover / menu / panels ---- */\n.mgh-grid-popover {\n --mgh-grid-font-family: inherit; --mgh-grid-font-size: 14px; --mgh-grid-paper: #ffffff; --mgh-grid-bg: #fff; --mgh-grid-fg: rgba(0,0,0,.87); --mgh-grid-fg-secondary: rgba(0,0,0,.6); --mgh-grid-fg-disabled: rgba(0,0,0,.38); --mgh-grid-border: rgba(224,224,224,1); --mgh-grid-hover: rgba(0,0,0,.04); --mgh-grid-selected: rgba(25,118,210,.08); --mgh-grid-primary: #1976d2; --mgh-grid-primary-contrast: #fff; --mgh-grid-focus: #1976d2; --mgh-grid-input-bg: transparent; --mgh-grid-input-border: rgba(0,0,0,.23); --mgh-grid-popover-shadow: 0 5px 5px -3px rgba(0,0,0,.2), 0 8px 10px 1px rgba(0,0,0,.14), 0 3px 14px 2px rgba(0,0,0,.12);\n position: fixed; z-index: 1300; background: var(--mgh-grid-paper); color: var(--mgh-grid-fg); border-radius: 8px; box-shadow: var(--mgh-grid-popover-shadow); font-family: var(--mgh-grid-font-family); font-size: var(--mgh-grid-font-size); line-height: 1.5; outline: none; max-height: calc(100vh - 16px); overflow: auto; animation: mgh-grid-pop .12s ease-out;\n}\n.mgh-grid-popover[data-mgh-theme="dark"] { --mgh-grid-paper: #212b36; --mgh-grid-bg: #212b36; --mgh-grid-fg: #fff; --mgh-grid-fg-secondary: rgba(255,255,255,.7); --mgh-grid-fg-disabled: rgba(255,255,255,.5); --mgh-grid-border: rgba(81,81,81,1); --mgh-grid-hover: rgba(255,255,255,.08); --mgh-grid-selected: rgba(144,202,249,.16); --mgh-grid-primary: #90caf9; --mgh-grid-primary-contrast: rgba(0,0,0,.87); --mgh-grid-focus: #90caf9; --mgh-grid-input-border: rgba(255,255,255,.23); }\n@keyframes mgh-grid-pop { from { opacity: 0; transform: scale(0.96); } to { opacity: 1; transform: scale(1); } }\n.mgh-grid-menu { list-style: none; margin: 0; padding: 6px 0; min-width: 180px; }\n.mgh-grid-menu-item { display: flex; align-items: center; gap: 12px; padding: 6px 16px; min-height: 36px; font-size: 0.875rem; cursor: pointer; white-space: nowrap; color: var(--mgh-grid-fg); background: transparent; border: 0; width: 100%; text-align: left; font-family: inherit; outline: none; }\n.mgh-grid-menu-item:hover, .mgh-grid-menu-item:focus-visible { background: var(--mgh-grid-hover); }\n.mgh-grid-menu-item--disabled { color: var(--mgh-grid-fg-disabled); cursor: default; pointer-events: none; }\n.mgh-grid-menu-item--selected { background: var(--mgh-grid-selected); }\n.mgh-grid-menu-item .mgh-grid-icon { color: var(--mgh-grid-fg-secondary); flex: 0 0 auto; }\n.mgh-grid-menu-divider { height: 1px; margin: 6px 0; background: var(--mgh-grid-border); border: 0; }\n.mgh-grid-menu-header { padding: 6px 16px 2px; font-size: 0.75rem; color: var(--mgh-grid-fg-secondary); text-transform: uppercase; letter-spacing: .04em; }\n.mgh-grid-menu-section { padding: 4px 16px 8px; display: flex; flex-direction: column; gap: 4px; }\n.mgh-grid-panel { display: flex; flex-direction: column; min-width: 300px; max-width: min(640px, calc(100vw - 16px)); }\n.mgh-grid-panel-header { padding: 12px 12px 4px; }\n.mgh-grid-panel-content { padding: 4px 12px; overflow: auto; max-height: 360px; }\n.mgh-grid-panel-footer { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 12px; }\n.mgh-grid-columns-list { display: flex; flex-direction: column; }\n.mgh-grid-filter-row { display: grid; grid-template-columns: 32px minmax(120px, 1fr) minmax(120px, 1fr) minmax(140px, 1.3fr); gap: 8px; align-items: end; margin-bottom: 8px; }\n.mgh-grid-filter-row--first { grid-template-columns: 32px minmax(120px, 1fr) minmax(120px, 1fr) minmax(140px, 1.3fr); }\n.mgh-grid-filter-row--with-logic { grid-template-columns: 32px 80px minmax(120px, 1fr) minmax(120px, 1fr) minmax(140px, 1.3fr); }\n.mgh-grid-filter-row .mgh-grid-btn--icon { margin-bottom: 4px; }\n.mgh-grid-filter-empty { padding: 8px 4px; color: var(--mgh-grid-fg-secondary); font-size: 0.875rem; }\n@media (max-width: 599.95px) { .mgh-grid-filter-row, .mgh-grid-filter-row--with-logic { grid-template-columns: 1fr; } }\n\n/* ---- misc ---- */\n.mgh-grid-tooltip-anchor { display: inline-flex; }\n.mgh-grid-visually-hidden { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); border: 0; }\n@media print { .mgh-grid-toolbar, .mgh-grid-footer { display: none !important; } }\n';let Ae=!1;const Le=e.useInsertionEffect??("undefined"!=typeof window?e.useLayoutEffect:e.useEffect),He=()=>{Le(()=>{(()=>{if(Ae||"undefined"==typeof document)return;if(document.getElementById(Oe))return void(Ae=!0);const e=document.createElement("style");e.id=Oe,e.setAttribute("data-mgh-grid","true"),e.textContent=Te,document.head.appendChild(e),Ae=!0})()},[])},Ve=e.createContext(null);Ve.displayName="MGHGridContext";const $e=()=>{const t=e.useContext(Ve);if(!t)throw new Error("MGHGrid: this component must be rendered inside an <MGHGrid /> (e.g. through a slot).");return t};function Be(t){const r=e.useRef(t);return r.current=t,r}function Ue(t,r,n){const o=void 0!==t,[i,l]=e.useState(r),a=o?t:i,d=Be(a),s=Be(o),c=Be(n);return[a,e.useCallback(e=>{const t="function"==typeof e?e(d.current):e;Object.is(t,d.current)||(d.current=t,s.current||l(t),c.current?.(t))},[])]}let _e=0;const We=(e,t)=>{const r=((e,t)=>{const r=e.getAllColumns();let n;if(t.fields){const e=new Map;r.forEach(t=>e.set(t.field,t)),n=t.fields.map(t=>e.get(t)).filter(Boolean)}else n=t.allColumns?r:e.getVisibleColumns();return n.filter(e=>!e.disableExport&&!O(e.field)&&"actions"!==e.type)})(e,t),n=t.getRowsToExport?t.getRowsToExport({api:e}):e.getSortedRowIds(),o=[];return n.forEach(t=>{const n=e.getRow(t);n&&o.push(r.map(r=>{const o=Z(n,r,e);return{raw:o,formatted:re(te(o,n,r,e,t)),col:r}}))}),{columns:r,headers:r.map(e=>e.headerName??e.field),rows:o}},qe=(e,t,r)=>{const n=e&&e.trim()||t;return n.toLowerCase().endsWith(`.${r}`)?n:`${n}.${r}`},je=()=>(("undefined"!=typeof document&&document.title?document.title.trim():"")||"export").replace(/[\\/:*?"<>|]+/g,"-"),Ke=(e,t)=>{let r=e;return/^[=+\-@\t\r]/.test(r)&&(r=`'${r}`),-1!==r.indexOf('"')||-1!==r.indexOf(t)||/[\r\n]/.test(r)?`"${r.replace(/"/g,'""')}"`:r},Qe=(e,t={})=>{const r=t.delimiter??",",n=t.includeHeaders??!0,o=We(e,t),i=[];return n&&i.push(o.headers.map(e=>Ke(e,r)).join(r)),o.rows.forEach(e=>{i.push(e.map(e=>{const n=t.useRawValues?T(e.raw)?"":String(e.raw):e.formatted;return Ke(n,r)}).join(r))}),i.join("\r\n")},Xe=String.fromCharCode(65279),Ye=(()=>{const e=new Uint32Array(256);for(let t=0;t<256;t+=1){let r=t;for(let e=0;e<8;e+=1)r=1&r?3988292384^r>>>1:r>>>1;e[t]=r>>>0}return e})(),Je="undefined"!=typeof TextEncoder?new TextEncoder:null,Ze=e=>{if(Je)return Je.encode(e);const t=unescape(encodeURIComponent(e)),r=new Uint8Array(t.length);for(let e=0;e<t.length;e+=1)r[e]=t.charCodeAt(e);return r},et=e=>{const t=e.reduce((e,t)=>e+t.length,0),r=new Uint8Array(t);let n=0;return e.forEach(e=>{r.set(e,n),n+=e.length}),r},tt=e=>{const t=[],r=[];let n=0;e.forEach(e=>{const o=Ze(e.name),i=(e=>{let t=4294967295;for(let r=0;r<e.length;r+=1)t=Ye[255&(t^e[r])]^t>>>8;return(4294967295^t)>>>0})(e.data),l=e.data.length,a=new Uint8Array(30+o.length),d=new DataView(a.buffer);d.setUint32(0,67324752,!0),d.setUint16(4,20,!0),d.setUint16(6,2048,!0),d.setUint16(8,0,!0),d.setUint16(10,0,!0),d.setUint16(12,33,!0),d.setUint32(14,i,!0),d.setUint32(18,l,!0),d.setUint32(22,l,!0),d.setUint16(26,o.length,!0),d.setUint16(28,0,!0),a.set(o,30);const s=new Uint8Array(46+o.length),c=new DataView(s.buffer);c.setUint32(0,33639248,!0),c.setUint16(4,20,!0),c.setUint16(6,20,!0),c.setUint16(8,2048,!0),c.setUint16(10,0,!0),c.setUint16(12,0,!0),c.setUint16(14,33,!0),c.setUint32(16,i,!0),c.setUint32(20,l,!0),c.setUint32(24,l,!0),c.setUint16(28,o.length,!0),c.setUint16(30,0,!0),c.setUint16(32,0,!0),c.setUint16(34,0,!0),c.setUint16(36,0,!0),c.setUint32(38,0,!0),c.setUint32(42,n,!0),s.set(o,46),t.push(a,e.data),r.push(s),n+=a.length+l});const o=et(r),i=new Uint8Array(22),l=new DataView(i.buffer);return l.setUint32(0,101010256,!0),l.setUint16(4,0,!0),l.setUint16(6,0,!0),l.setUint16(8,e.length,!0),l.setUint16(10,e.length,!0),l.setUint32(12,o.length,!0),l.setUint32(16,n,!0),l.setUint16(20,0,!0),et(t.concat([o,i]))},rt=new RegExp("["+String.fromCharCode(0)+"-"+String.fromCharCode(8)+String.fromCharCode(11)+String.fromCharCode(12)+String.fromCharCode(14)+"-"+String.fromCharCode(31)+String.fromCharCode(65534)+String.fromCharCode(65535)+"]","g"),nt=e=>(e=>e.replace(rt,""))(e).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&apos;"),ot=e=>{let t=e+1,r="";for(;t>0;){const e=(t-1)%26;r=String.fromCharCode(65+e)+r,t=Math.floor((t-1)/26)}return r},it='<?xml version="1.0" encoding="UTF-8" standalone="yes"?>\n',lt=(e,t,r)=>{const n=[];let o=1;const i=(e,t,r)=>`<c r="${e}" t="inlineStr"${r?` s="${r}"`:""}><is><t xml:space="preserve">${nt(t)}</t></is></c>`;if(t){const t=e.headers.map((e,t)=>i(`${ot(t)}${o}`,e,1)).join("");n.push(`<row r="${o}">${t}</row>`),o+=1}e.rows.forEach(e=>{const t=e.map((e,t)=>{const r=`${ot(t)}${o}`,n=e.col.type;if(T(e.raw)||""===e.raw)return"";if("number"===n&&"number"==typeof e.raw&&Number.isFinite(e.raw))return`<c r="${r}"><v>${e.raw}</v></c>`;if("boolean"===n)return`<c r="${r}" t="b"><v>${e.raw?1:0}</v></c>`;if(("date"===n||"dateTime"===n)&&q(e.raw)){const t=q(e.raw);return`<c r="${r}" s="${"dateTime"===n?3:2}"><v>${Date.UTC(t.getFullYear(),t.getMonth(),t.getDate(),t.getHours(),t.getMinutes(),t.getSeconds())/864e5+25569}</v></c>`}return i(r,e.formatted)}).join("");n.push(`<row r="${o}">${t}</row>`),o+=1});const l=ot(Math.max(e.columns.length-1,0)),a=Math.max(o-1,1),d=r.map((e,t)=>`<col min="${t+1}" max="${t+1}" width="${e}" customWidth="1"/>`).join("");return it+'<worksheet xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships">'+`<dimension ref="A1:${l}${a}"/><sheetViews><sheetView workbookViewId="0">`+(t?'<pane ySplit="1" topLeftCell="A2" activePane="bottomLeft" state="frozen"/>':"")+'</sheetView></sheetViews><sheetFormatPr defaultRowHeight="15"/>'+(d?`<cols>${d}</cols>`:"")+`<sheetData>${n.join("")}</sheetData>`+(t&&e.rows.length>0?`<autoFilter ref="A1:${l}${a}"/>`:"")+"</worksheet>"},at=it+'<styleSheet xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main"><numFmts count="2"><numFmt numFmtId="164" formatCode="m/d/yyyy"/><numFmt numFmtId="165" formatCode="m/d/yyyy h:mm AM/PM"/></numFmts><fonts count="2"><font><sz val="11"/><name val="Calibri"/></font><font><b/><sz val="11"/><name val="Calibri"/></font></fonts><fills count="2"><fill><patternFill patternType="none"/></fill><fill><patternFill patternType="gray125"/></fill></fills><borders count="1"><border><left/><right/><top/><bottom/><diagonal/></border></borders><cellStyleXfs count="1"><xf numFmtId="0" fontId="0" fillId="0" borderId="0"/></cellStyleXfs><cellXfs count="4"><xf numFmtId="0" fontId="0" fillId="0" borderId="0" xfId="0"/><xf numFmtId="0" fontId="1" fillId="0" borderId="0" xfId="0" applyFont="1"/><xf numFmtId="164" fontId="0" fillId="0" borderId="0" xfId="0" applyNumberFormat="1"/><xf numFmtId="165" fontId="0" fillId="0" borderId="0" xfId="0" applyNumberFormat="1"/></cellXfs><cellStyles count="1"><cellStyle name="Normal" xfId="0" builtinId="0"/></cellStyles></styleSheet>',dt=it+'<Types xmlns="http://schemas.openxmlformats.org/package/2006/content-types"><Default Extension="rels" ContentType="application/vnd.openxmlformats-package.relationships+xml"/><Default Extension="xml" ContentType="application/xml"/><Override PartName="/xl/workbook.xml" ContentType="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml"/><Override PartName="/xl/worksheets/sheet1.xml" ContentType="application/vnd.openxmlformats-officedocument.spreadsheetml.worksheet+xml"/><Override PartName="/xl/styles.xml" ContentType="application/vnd.openxmlformats-officedocument.spreadsheetml.styles+xml"/><Override PartName="/docProps/core.xml" ContentType="application/vnd.openxmlformats-package.core-properties+xml"/><Override PartName="/docProps/app.xml" ContentType="application/vnd.openxmlformats-officedocument.extended-properties+xml"/></Types>',st=it+'<Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships"><Relationship Id="rId1" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument" Target="xl/workbook.xml"/><Relationship Id="rId2" Type="http://schemas.openxmlformats.org/package/2006/relationships/metadata/core-properties" Target="docProps/core.xml"/><Relationship Id="rId3" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/extended-properties" Target="docProps/app.xml"/></Relationships>',ct=it+'<Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships"><Relationship Id="rId1" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/worksheet" Target="worksheets/sheet1.xml"/><Relationship Id="rId2" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles" Target="styles.xml"/></Relationships>',gt=e=>it+'<workbook xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships">'+`<sheets><sheet name="${nt(e)}" sheetId="1" r:id="rId1"/></sheets></workbook>`,mt=()=>{const e=(new Date).toISOString();return it+'<cp:coreProperties xmlns:cp="http://schemas.openxmlformats.org/package/2006/metadata/core-properties" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:dcterms="http://purl.org/dc/terms/" xmlns:dcmitype="http://purl.org/dc/dcmitype/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><dc:creator>MGH Grid</dc:creator>'+`<dcterms:created xsi:type="dcterms:W3CDTF">${e}</dcterms:created>`+`<dcterms:modified xsi:type="dcterms:W3CDTF">${e}</dcterms:modified></cp:coreProperties>`},ut=it+'<Properties xmlns="http://schemas.openxmlformats.org/officeDocument/2006/extended-properties" xmlns:vt="http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes"><Application>MGH Grid</Application></Properties>',pt=(e,t={})=>{const r=t.includeHeaders??!0,n=We(e,t),o=n.columns.map((e,r)=>{const o=t.columnsStyles?.[e.field]?.width;if(o)return o;let i=n.headers[r].length;for(let e=0;e<Math.min(n.rows.length,500);e+=1){const t=n.rows[e][r].formatted.length;t>i&&(i=t)}return Math.min(Math.max(i+2,8),60)}),i=(e=>{const t=(e||"Sheet1").replace(/[\[\]:*?/\\]/g," ").trim()||"Sheet1";return t.length>31?t.slice(0,31):t})(t.sheetName),l=[{name:"[Content_Types].xml",data:Ze(dt)},{name:"_rels/.rels",data:Ze(st)},{name:"docProps/core.xml",data:Ze(mt())},{name:"docProps/app.xml",data:Ze(ut)},{name:"xl/workbook.xml",data:Ze(gt(i))},{name:"xl/_rels/workbook.xml.rels",data:Ze(ct)},{name:"xl/styles.xml",data:Ze(at)},{name:"xl/worksheets/sheet1.xml",data:Ze(lt(n,r,o))}];return tt(l)},ht=e=>e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;"),ft=e=>T(e)?"":e instanceof Date?String(e.getTime()):String(e),bt=(e,t,r,n,o="(empty)")=>{const i=(e,l,a,d)=>{const s=t[l],c=r.get(s);if(!c)return[];const g=new Map;e.forEach(e=>{const t=((e,t,r)=>t.groupingValueGetter?t.groupingValueGetter(e[t.field],e,t,r):Z(e,t,r))(e.row,c,n),r=ft(t);let i=g.get(r);if(!i){const m=re(te(t,e.row,c,n,e.id))||o;i={id:`auto-generated-row-${d}${s}/${r}`,depth:l,parent:a,groupingField:s,groupingKey:t,groupingLabel:m,childGroups:[],leaves:[],descendants:[]},g.set(r,i)}i.leaves.push(e)});const m=[];return g.forEach(e=>{l<t.length-1?(e.childGroups=i(e.leaves,l+1,e.id,`${d}${s}/${ft(e.groupingKey)}|`),e.descendants=e.leaves,e.leaves=[]):e.descendants=e.leaves,m.push(e)}),m};return i(e,0,null,"")},xt=e=>{const t=[];return e.forEach(e=>e.descendants.forEach(e=>t.push(e))),t},wt=(e,t,r,n,o)=>{const i={};return Object.keys(t).forEach(l=>{const a=t[l],d=n[a],s=r.get(l);if(!d||!s||!1===s.aggregable)return;const c=e.map(e=>Z(e,s,o));i[l]={value:d.apply({values:c,field:l}),fn:a}}),i},vt=(t,r)=>{const n=e.forwardRef(({size:r=20,className:n,style:o,...i},l)=>e.createElement("svg",{ref:l,viewBox:"0 0 24 24",width:r,height:r,fill:"currentColor",focusable:"false","aria-hidden":"true",className:["mgh-grid-icon",n].filter(Boolean).join(" "),style:o,...i},t));return n.displayName=r,n},yt=vt(e.createElement("path",{d:"M14.67 5v14H9.33V5h5.34zm1 14H21V5h-5.33v14zm-7.34 0V5H3v14h5.33z"}),"ViewColumnIcon"),Et=vt(e.createElement("path",{d:"M10 18h4v-2h-4v2zM3 6v2h18V6H3zm3 7h12v-2H6v2z"}),"FilterListIcon"),Ct=vt(e.createElement("path",{d:"M15.5 14h-.79l-.28-.27A6.471 6.471 0 0 0 16 9.5 6.5 6.5 0 1 0 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z"}),"SearchIcon"),Mt=vt(e.createElement("path",{d:"M19 6.41 17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"}),"CloseIcon"),kt=vt(e.createElement("path",{d:"M19 12v7H5v-7H3v7c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2v-7h-2zm-6 .67 2.59-2.58L17 11.5l-5 5-5-5 1.41-1.41L11 12.67V3h2z"}),"DownloadIcon"),St=vt(e.createElement("path",{d:"m4 12 1.41 1.41L11 7.83V20h2V7.83l5.58 5.59L20 12l-8-8-8 8z"}),"ArrowUpwardIcon"),It=vt(e.createElement("path",{d:"m20 12-1.41-1.41L13 16.17V4h-2v12.17l-5.58-5.59L4 12l8 8 8-8z"}),"ArrowDownwardIcon"),Ft=vt(e.createElement("path",{d:"M12 8c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2zm0 2c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm0 6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2z"}),"MoreVertIcon"),Pt=vt(e.createElement("path",{d:"M9 16.17 4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z"}),"CheckIcon"),Rt=vt(e.createElement("path",{d:"M16.59 8.59 12 13.17 7.41 8.59 6 10l6 6 6-6z"}),"ExpandMoreIcon"),Nt=vt(e.createElement("path",{d:"M10 6 8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6z"}),"ChevronRightIcon"),Dt=vt(e.createElement("path",{d:"M15.41 7.41 14 6l-6 6 6 6 1.41-1.41L10.83 12z"}),"ChevronLeftIcon"),zt=vt(e.createElement("path",{d:"M18.41 16.59 13.82 12l4.59-4.59L17 6l-6 6 6 6zM6 6h2v12H6z"}),"FirstPageIcon"),Gt=vt(e.createElement("path",{d:"M5.59 7.41 10.18 12l-4.59 4.59L7 18l6-6-6-6zM16 6h2v12h-2z"}),"LastPageIcon"),Ot=vt(e.createElement("path",{d:"M16 9V4h1c.55 0 1-.45 1-1s-.45-1-1-1H7c-.55 0-1 .45-1 1s.45 1 1 1h1v5c0 1.66-1.34 3-3 3v2h5.97v7l1 1 1-1v-7H19v-2c-1.66 0-3-1.34-3-3z"}),"PushPinIcon"),Tt=vt(e.createElement("path",{d:"M6 19c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2V7H6v12zM19 4h-3.5l-1-1h-5l-1 1H5v2h14V4z"}),"DeleteIcon"),At=vt(e.createElement("path",{d:"M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z"}),"AddIcon"),Lt=vt(e.createElement("path",{d:"M3 2h18v2H3zm0 18h18v2H3zm0-6h18v2H3zm0-6h18v2H3z"}),"DensitySmallIcon"),Ht=vt(e.createElement("path",{d:"M3 3h18v2H3zm0 16h18v2H3zm0-8h18v2H3z"}),"DensityMediumIcon"),Vt=vt(e.createElement("path",{d:"M3 3h18v2H3zm0 16h18v2H3z"}),"DensityLargeIcon"),$t=vt(e.createElement("path",{d:"M11 18c0 1.1-.9 2-2 2s-2-.9-2-2 .9-2 2-2 2 .9 2 2zm-2-8c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm0-6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm6 4c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2zm0 2c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm0 6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2z"}),"DragIndicatorIcon"),Bt=vt(e.createElement("path",{d:"M19 8H5c-1.66 0-3 1.34-3 3v6h4v4h12v-4h4v-6c0-1.66-1.34-3-3-3zm-3 11H8v-5h8v5zm3-7c-.55 0-1-.45-1-1s.45-1 1-1 1 .45 1 1-.45 1-1 1zm-1-9H6v4h12V3z"}),"PrintIcon"),Ut=vt(e.createElement("path",{d:"M10 10.02h5V21h-5zM17 21h3c1.1 0 2-.9 2-2v-9h-5v11zm3-18H5c-1.1 0-2 .9-2 2v3h19V5c0-1.1-.9-2-2-2zM3 19c0 1.1.9 2 2 2h3V10H3v9z"}),"TableChartIcon"),_t=vt(e.createElement("path",{d:"M14 2H6c-1.1 0-1.99.9-1.99 2L4 20c0 1.1.89 2 1.99 2H18c1.1 0 2-.9 2-2V8l-6-6zm2 16H8v-2h8v2zm0-4H8v-2h8v2zm-3-5V3.5L18.5 9H13z"}),"DescriptionIcon"),Wt=vt(e.createElement("path",{d:"M12 7c2.76 0 5 2.24 5 5 0 .65-.13 1.26-.36 1.83l2.92 2.92c1.51-1.26 2.7-2.89 3.43-4.75-1.73-4.39-6-7.5-11-7.5-1.4 0-2.74.25-3.98.7l2.16 2.16C10.74 7.13 11.35 7 12 7zM2 4.27l2.28 2.28.46.46A11.804 11.804 0 0 0 1 12c1.73 4.39 6 7.5 11 7.5 1.55 0 3.03-.3 4.38-.84l.42.42L19.73 22 21 20.73 3.27 3 2 4.27zM7.53 9.8l1.55 1.55c-.05.21-.08.43-.08.65 0 1.66 1.34 3 3 3 .22 0 .44-.03.65-.08l1.55 1.55c-.67.33-1.41.53-2.2.53-2.76 0-5-2.24-5-5 0-.79.2-1.53.53-2.2zm4.31-.78 3.15 3.15.02-.16c0-1.66-1.34-3-3-3l-.17.01z"}),"VisibilityOffIcon"),qt=vt(e.createElement("path",{d:"M18 4H6v2l6.5 6L6 18v2h12v-3h-7l5-5-5-5h7z"}),"FunctionsIcon"),jt=vt(e.createElement("path",{d:"M6 13c-2.2 0-4 1.8-4 4s1.8 4 4 4 4-1.8 4-4-1.8-4-4-4zm6-10C9.8 3 8 4.8 8 7s1.8 4 4 4 4-1.8 4-4-1.8-4-4-4zm6 10c-2.2 0-4 1.8-4 4s1.8 4 4 4 4-1.8 4-4-1.8-4-4-4z"}),"WorkspacesIcon"),Kt=vt(e.createElement(e.Fragment,null,e.createElement("path",{d:"M20 6h-2.18c.11-.31.18-.65.18-1a2.996 2.996 0 0 0-5.5-1.65l-.5.67-.5-.68C10.96 2.54 10.05 2 9 2 7.34 2 6 3.34 6 5c0 .35.07.69.18 1H4c-1.11 0-1.99.89-1.99 2L2 19c0 1.11.89 2 2 2h16c1.11 0 2-.89 2-2V8c0-1.11-.89-2-2-2z",opacity:".25"}),e.createElement("path",{d:"M4 8h16v11H4z",opacity:".15"})),"EmptyBoxIcon");var Qt=Object.freeze({__proto__:null,AddIcon:At,ArrowDownwardIcon:It,ArrowUpwardIcon:St,CheckIcon:Pt,ChevronLeftIcon:Dt,ChevronRightIcon:Nt,CloseIcon:Mt,DeleteIcon:Tt,DensityLargeIcon:Vt,DensityMediumIcon:Ht,DensitySmallIcon:Lt,DescriptionIcon:_t,DownloadIcon:kt,DragIndicatorIcon:$t,EmptyBoxIcon:Kt,ExpandMoreIcon:Rt,FilterListIcon:Et,FirstPageIcon:zt,FunctionsIcon:qt,LastPageIcon:Gt,MoreVertIcon:Ft,PrintIcon:Bt,PushPinIcon:Ot,SearchIcon:Ct,TableChartIcon:Ut,ViewColumnIcon:yt,VisibilityOffIcon:Wt,WorkspacesIcon:jt});const Xt=e.forwardRef(({variant:t="text",size:r="medium",startIcon:n,endIcon:o,active:i,className:l,children:a,type:d="button",...s},c)=>e.createElement("button",{ref:c,type:d,className:H("mgh-grid-btn","primary"===t&&"mgh-grid-btn--primary","contained"===t&&"mgh-grid-btn--contained","small"===r&&"mgh-grid-btn--small",i&&"mgh-grid-btn--active",l),...s},n,a,o));Xt.displayName="MGHGridButton";const Yt=e.forwardRef(({size:t="medium",active:r,label:n,className:o,children:i,type:l="button",...a},d)=>e.createElement("button",{ref:d,type:l,title:n,"aria-label":n,className:H("mgh-grid-btn mgh-grid-btn--icon","small"===t&&"mgh-grid-btn--small",r&&"mgh-grid-btn--active",o),...a},i));Yt.displayName="MGHGridIconButton";const Jt=({count:t=0,variant:r="dot",children:n})=>e.createElement("span",{className:"mgh-grid-badge"},n,t>0&&("dot"===r?e.createElement("span",{className:"mgh-grid-badge-dot"}):e.createElement("span",{className:"mgh-grid-badge-count"},t>99?"99+":t))),Zt=e.forwardRef(({size:t="medium",className:r,...n},o)=>e.createElement("input",{ref:o,className:H("mgh-grid-input","small"===t&&"mgh-grid-input--small",r),...n}));Zt.displayName="MGHGridTextInput";const er=e.forwardRef(({size:t="medium",className:r,...n},o)=>e.createElement("select",{ref:o,className:H("mgh-grid-select","small"===t&&"mgh-grid-select--small",r),...n}));er.displayName="MGHGridSelect";const tr=({label:t,children:r,className:n,htmlFor:o})=>e.createElement("div",{className:H("mgh-grid-field",n)},t&&e.createElement("label",{className:"mgh-grid-field-label",htmlFor:o},t),r),rr=e.forwardRef(({indeterminate:t=!1,label:r,className:n,...o},i)=>{const l=e.useRef(null),a=e.useCallback(e=>{l.current=e,"function"==typeof i?i(e):i&&(i.current=e)},[i]);return e.useEffect(()=>{l.current&&(l.current.indeterminate=t)},[t]),e.createElement("input",{ref:a,type:"checkbox",title:r,"aria-label":r,className:H("mgh-grid-checkbox",n),...o})});rr.displayName="MGHGridCheckbox";const nr=({className:t})=>e.createElement("div",{className:H("mgh-grid-spinner",t),role:"progressbar","aria-label":"Loading"});function or({open:t,anchorEl:r,onClose:n,children:o,placement:i="bottom-start",themeMode:l="light",className:a,style:d,offset:s=4,role:c="dialog",autoFocus:g=!1,ignoreOutsideClickOn:m}){const u=e.useRef(null),[h,f]=e.useState({top:0,left:0,ready:!1}),b=e.useCallback(()=>{const e=u.current;if(!e)return;const t=window.innerWidth,n=window.innerHeight,o=e.offsetWidth,l=e.offsetHeight;let a,d;if(r&&r.isConnected){const e=r.getBoundingClientRect();"right-start"===i?(a=e.top,d=e.right+s,d+o>t-8&&(d=e.left-s-o)):(a=e.bottom+s,a+l>n-8&&e.top-s-l>=8&&(a=e.top-s-l),d="bottom-end"===i?e.right-o:"bottom"===i?e.left+e.width/2-o/2:e.left)}else a=n/2-l/2,d=t/2-o/2;a=L(a,8,Math.max(8,n-l-8)),d=L(d,8,Math.max(8,t-o-8)),f(e=>e.ready&&e.top===a&&e.left===d?e:{top:a,left:d,ready:!0})},[r,i,s]);if(e.useLayoutEffect(()=>{if(!t)return void f(e=>e.ready?{...e,ready:!1}:e);b(),window.addEventListener("resize",b),window.addEventListener("scroll",b,!0);let e=null;return"undefined"!=typeof ResizeObserver&&u.current&&(e=new ResizeObserver(()=>b()),e.observe(u.current)),()=>{window.removeEventListener("resize",b),window.removeEventListener("scroll",b,!0),e?.disconnect()}},[t,b]),e.useEffect(()=>{if(!t)return;const e=e=>{const t=e.target;t&&(u.current?.contains(t)||r?.contains(t)||m?.some(e=>e.current?.contains(t))||t.closest?.(".mgh-grid-popover")||n("backdrop"))},o=e=>{"Escape"===e.key&&n("escape")};return document.addEventListener("mousedown",e,!0),document.addEventListener("touchstart",e,!0),document.addEventListener("keydown",o),()=>{document.removeEventListener("mousedown",e,!0),document.removeEventListener("touchstart",e,!0),document.removeEventListener("keydown",o)}},[t,n,r,m]),e.useEffect(()=>{if(t&&g&&u.current){(u.current.querySelector('input, select, textarea, button, [tabindex]:not([tabindex="-1"])')??u.current).focus()}},[t,g]),!t||"undefined"==typeof document)return null;const x=e=>e.stopPropagation();return p.createPortal(e.createElement("div",{ref:u,role:c,tabIndex:-1,className:H("mgh-grid-popover",a),"data-mgh-theme":l,style:{top:h.top,left:h.left,visibility:h.ready?"visible":"hidden",...d},onClick:x,onDoubleClick:x,onMouseDown:x,onKeyDown:e=>{if("Escape"===e.key)return e.stopPropagation(),void n("escape");e.stopPropagation()}},o),document.body)}const ir=({children:t,className:r,onKeyDown:n,...o})=>{const i=e.useRef(null);return e.useEffect(()=>{const e=i.current?.querySelector('[role="menuitem"]:not([aria-disabled="true"])');e?.focus()},[]),e.createElement("ul",{ref:i,role:"menu",className:H("mgh-grid-menu",r),onKeyDown:e=>{if(n?.(e),"ArrowDown"!==e.key&&"ArrowUp"!==e.key&&"Home"!==e.key&&"End"!==e.key)return;const t=Array.from(i.current?.querySelectorAll('[role="menuitem"]:not([aria-disabled="true"])')??[]);if(0===t.length)return;e.preventDefault();const r=t.indexOf(document.activeElement);let o=0;o="ArrowDown"===e.key?r<0?0:(r+1)%t.length:"ArrowUp"===e.key?r<0?t.length-1:(r-1+t.length)%t.length:"Home"===e.key?0:t.length-1,t[o].focus()},...o},t)},lr=e.forwardRef(({icon:t,selected:r,disabled:n,className:o,children:i,onClick:l,hideMenu:a,...d},s)=>e.createElement("li",{role:"none"},e.createElement("button",{ref:s,type:"button",role:"menuitem","aria-disabled":n||void 0,disabled:n,tabIndex:-1,className:H("mgh-grid-menu-item",n&&"mgh-grid-menu-item--disabled",r&&"mgh-grid-menu-item--selected",o),onClick:e=>{n||(l?.(e),a?.())},...d},t,e.createElement("span",null,i))));lr.displayName="MGHGridMenuItem";const ar=()=>e.createElement("li",{role:"separator",className:"mgh-grid-menu-divider"}),dr=({children:t})=>e.createElement("li",{role:"presentation",className:"mgh-grid-menu-section"},t);function sr(){const{api:t,state:r,localeText:n}=$e(),o=r.preferencePanel.open&&"columns"===r.preferencePanel.openedPanelValue;return e.createElement(Yt,{label:n.toolbarColumns,active:o,"aria-haspopup":"dialog","aria-expanded":o,onClick:e=>o?t.hidePreferences():t.showPreferences("columns",e.currentTarget)},e.createElement(yt,null))}function cr(){const{api:t,state:r,localeText:n}=$e(),o=r.preferencePanel.open&&"filters"===r.preferencePanel.openedPanelValue;return e.createElement(Yt,{label:n.toolbarFilters,active:o,"aria-haspopup":"dialog","aria-expanded":o,onClick:e=>o?t.hidePreferences():t.showPreferences("filters",e.currentTarget)},e.createElement(Jt,{count:r.filterCount,variant:"dot"},e.createElement(Et,null)))}function gr(){const{api:t,state:r,localeText:n,themeMode:o}=$e(),[i,l]=e.useState(null),a=[{value:"compact",label:n.densityCompact,icon:e.createElement(Lt,null)},{value:"standard",label:n.densityStandard,icon:e.createElement(Ht,null)},{value:"comfortable",label:n.densityComfortable,icon:e.createElement(Vt,null)}],d=a.find(e=>e.value===r.density)??a[1];return e.createElement(e.Fragment,null,e.createElement(Yt,{label:n.toolbarDensity,active:Boolean(i),"aria-haspopup":"menu",onClick:e=>l(t=>t?null:e.currentTarget)},d.icon),e.createElement(or,{open:Boolean(i),anchorEl:i,onClose:()=>l(null),themeMode:o,role:"menu"},e.createElement(ir,null,a.map(n=>e.createElement(lr,{key:n.value,icon:n.icon,selected:n.value===r.density,onClick:()=>t.setDensity(n.value),hideMenu:()=>l(null)},n.label)))))}const mr=lr;function ur({csvOptions:t={allColumns:!0},excelOptions:r={allColumns:!0},printOptions:n,showCsvOption:o=!0,showExcelOption:i=!0,showPrintOption:l=!0,customMenuItem:a}){const{api:d,localeText:s,themeMode:c,rootProps:g}=$e(),[m,u]=e.useState(null),p=()=>u(null),h=e.Children.map(a,t=>e.isValidElement(t)?e.cloneElement(t,{hideMenu:p}):t),f={title:"string"==typeof g.header?g.header:void 0,...n};return e.createElement(e.Fragment,null,e.createElement(Yt,{label:s.toolbarExport,active:Boolean(m),"aria-haspopup":"menu",onClick:e=>u(t=>t?null:e.currentTarget)},e.createElement(kt,null)),e.createElement(or,{open:Boolean(m),anchorEl:m,onClose:p,themeMode:c,role:"menu"},e.createElement(ir,null,h,o&&e.createElement(lr,{icon:e.createElement(_t,null),onClick:()=>d.exportDataAsCsv(t),hideMenu:p},s.toolbarExportCSV),i&&e.createElement(lr,{icon:e.createElement(Ut,null),onClick:()=>{d.exportDataAsExcel(r)},hideMenu:p},s.toolbarExportExcel),l&&e.createElement(lr,{icon:e.createElement(Bt,null),onClick:()=>d.exportDataAsPrint(f),hideMenu:p},s.toolbarExportPrint))))}function pr({placeholder:t,debounceMs:r,alwaysExpanded:n=!1}){const{api:o,state:i,localeText:l,rootProps:a}=$e(),d=(i.quickFilterValues??[]).join(" "),[s,c]=e.useState(d),[g,m]=e.useState(n||""!==d),u=e.useRef(null),p=e.useRef(null),h=r??a.quickFilterDebounceMs,f=e.useRef(d);e.useEffect(()=>{d!==f.current&&(f.current=d,c(d),""!==d&&m(!0))},[d]),e.useEffect(()=>()=>{null!==p.current&&window.clearTimeout(p.current)},[]);const b=e=>{const t=e.split(/\s+/).filter(e=>""!==e);f.current=t.join(" "),o.setQuickFilterValues(t)},x=()=>{null!==p.current&&window.clearTimeout(p.current),c(""),b(""),u.current?.focus()},w=n||g;return e.createElement("div",{className:H("mgh-grid-quick-filter",w&&"mgh-grid-quick-filter--expanded")},e.createElement(Yt,{className:"mgh-grid-quick-filter-trigger",label:l.toolbarQuickFilterLabel,"aria-disabled":w,tabIndex:w?-1:0,onClick:()=>{m(!0),window.setTimeout(()=>u.current?.focus(),0)}},e.createElement(Ct,null)),e.createElement("div",{className:H("mgh-grid-quick-filter-control mgh-grid-input-adorned",s&&"mgh-grid-input-adorned--clearable")},e.createElement("span",{className:"mgh-grid-input-adornment"},e.createElement(Ct,{size:18})),e.createElement(Zt,{ref:u,size:"small",type:"search",value:s,tabIndex:w?0:-1,placeholder:t??l.toolbarQuickFilterPlaceholder,"aria-label":l.toolbarQuickFilterLabel,onChange:e=>{return t=e.target.value,c(t),null!==p.current&&window.clearTimeout(p.current),void(p.current=window.setTimeout(()=>b(t),h));var t},onBlur:()=>{n||""!==s.trim()||m(!1)},onKeyDown:e=>{"Escape"===e.key&&(e.stopPropagation(),s?x():n||(m(!1),u.current?.blur())),"Enter"===e.key&&(null!==p.current&&window.clearTimeout(p.current),b(s))}}),s&&e.createElement("span",{className:"mgh-grid-input-adornment mgh-grid-input-adornment--end"},e.createElement(Yt,{size:"small",label:l.clearSearch,onClick:x,tabIndex:-1},e.createElement(Mt,null)))))}function hr({showColumnsButton:t=!0,showFilterButton:r=!0,showExportButton:n=!0,showQuickFilter:o=!0,showDensitySelector:i=!1,showCsvOption:l=!0,showExcelOption:a=!0,showPrintOption:d=!0,csvOptions:s,excelOptions:c,printOptions:g,renderOtherButtons:m,renderDateRange:u,customMenuItem:p,quickFilterPlaceholder:h,quickFilterDebounceMs:f}){const{rootProps:b}=$e(),x=t&&!b.disableColumnSelector,w=r&&!b.disableColumnFilter,v=i&&!b.disableDensitySelector;return e.createElement("div",{className:"mgh-grid-toolbar",role:"toolbar"},e.createElement("div",{className:"mgh-grid-toolbar-group"},x&&e.createElement(sr,null),w&&e.createElement(cr,null),v&&e.createElement(gr,null),n&&e.createElement(ur,{csvOptions:s,excelOptions:c,printOptions:g,showCsvOption:l,showExcelOption:a,showPrintOption:d,customMenuItem:p})),u&&e.createElement("div",{className:"mgh-grid-toolbar-center"},u),e.createElement("div",{className:"mgh-grid-toolbar-group"},m,o&&e.createElement(pr,{placeholder:h,debounceMs:f})))}function fr(){const{api:t,state:r,localeText:n,rootProps:o}=$e(),{page:i,pageSize:l}=r.paginationModel,a=r.rowCount,d=r.pageCount,s=0===a?0:i*l+1,c=Math.min(a,(i+1)*l),g=-1===o.pageSizeOptions.indexOf(l)?o.pageSizeOptions.concat([l]).sort((e,t)=>e-t):o.pageSizeOptions;return e.createElement("div",{className:"mgh-grid-pagination",role:"navigation","aria-label":"Pagination"},e.createElement("span",null,n.footerPaginationRowsPerPage),e.createElement(er,{className:"mgh-grid-pagination-select",value:l,"aria-label":n.footerPaginationRowsPerPage,onChange:e=>t.setPageSize(Number(e.target.value))},g.map(t=>e.createElement("option",{key:t,value:t},t))),e.createElement("span",null,n.footerPaginationDisplayedRows(s,c,a)),e.createElement("div",{className:"mgh-grid-pagination-actions"},e.createElement(Yt,{label:n.footerPaginationFirstPage,disabled:i<=0,onClick:()=>t.setPage(0)},e.createElement(zt,null)),e.createElement(Yt,{label:n.footerPaginationPreviousPage,disabled:i<=0,onClick:()=>t.setPage(i-1)},e.createElement(Dt,null)),e.createElement(Yt,{label:n.footerPaginationNextPage,disabled:i>=d-1,onClick:()=>t.setPage(i+1)},e.createElement(Nt,null)),e.createElement(Yt,{label:n.footerPaginationLastPage,disabled:i>=d-1,onClick:()=>t.setPage(Math.max(d-1,0))},e.createElement(Gt,null))))}function br(){const{state:t,localeText:r,rootProps:n}=$e(),o=t.rowSelectionModel.ids.size,i=o>0&&!n.hideFooterSelectedRowCount,l=n.pagination&&!n.hideFooterPagination,a=!l&&!n.hideFooterRowCount;return e.createElement("div",{className:"mgh-grid-footer"},e.createElement("div",{className:"mgh-grid-footer-left"},i&&e.createElement("span",null,r.footerRowSelected(o))),a&&e.createElement("span",null,r.footerTotalRows," ",t.rowCount.toLocaleString()),l&&e.createElement(fr,null))}function xr(){const{api:t,state:r,localeText:n,columns:o,visibleColumns:i}=$e(),l=e.useMemo(()=>new Set(i.map(e=>e.field)),[i]),[a,d]=e.useState(""),s=r.columnVisibilityModel,c=o.filter(e=>!1!==e.hideable),g=a.trim().toLowerCase(),m=g?c.filter(e=>-1!==(e.headerName??e.field).toLowerCase().indexOf(g)):c,u=e=>{const r={...s};c.forEach(t=>{r[t.field]=e}),t.setColumnVisibilityModel(r)};return e.createElement("div",{className:"mgh-grid-panel",role:"group","aria-label":n.toolbarColumns},e.createElement("div",{className:"mgh-grid-panel-header"},e.createElement("div",{className:"mgh-grid-input-adorned"},e.createElement("span",{className:"mgh-grid-input-adornment"},e.createElement(Ct,{size:18})),e.createElement(Zt,{autoFocus:!0,size:"small",value:a,placeholder:n.columnsPanelSearchPlaceholder,"aria-label":n.columnsPanelSearchPlaceholder,onChange:e=>d(e.target.value)}))),e.createElement("div",{className:"mgh-grid-panel-content"},e.createElement("div",{className:"mgh-grid-columns-list"},m.map(r=>{const n=l.has(r.field);return e.createElement("label",{key:r.field,className:"mgh-grid-checkbox-label"},e.createElement(rr,{checked:n,onChange:()=>t.setColumnVisibility(r.field,!n)}),e.createElement("span",null,r.headerName??r.field))}),0===m.length&&e.createElement("div",{className:"mgh-grid-filter-empty"},"No columns"))),e.createElement("div",{className:"mgh-grid-panel-footer"},e.createElement(Xt,{variant:"primary",size:"small",onClick:()=>u(!0)},n.columnsPanelShowAll),e.createElement(Xt,{variant:"primary",size:"small",onClick:()=>u(!1)},n.columnsPanelHideAll),e.createElement(Xt,{size:"small",onClick:()=>t.setColumnVisibilityModel({})},n.columnsPanelReset)))}const wr=(t,r,n=250)=>{const[o,i]=e.useState(t??""),l=e.useRef(null);e.useEffect(()=>{i(t??"")},[t]);return e.useEffect(()=>()=>{null!==l.current&&window.clearTimeout(l.current)},[]),[o,e=>{i(e),null!==l.current&&window.clearTimeout(l.current),l.current=window.setTimeout(()=>r(e),n)}]};function vr({item:t,onChange:r,placeholder:n,type:o}){const[i,l]=wr(t.value,r);return e.createElement(Zt,{size:"small",type:o,value:i,placeholder:n,"aria-label":n,onChange:e=>l(e.target.value)})}function yr({item:t,column:r,onChange:n,placeholder:o}){const i=Array.isArray(t.value)?t.value.join(", "):t.value??"",[l,a]=wr(i,e=>n(String(e).split(",").map(e=>e.trim()).filter(e=>""!==e)));if("singleSelect"===r.type){const i=J(r),l=Array.isArray(t.value)?t.value.map(String):[];return e.createElement(er,{multiple:!0,size:"small",value:l,"aria-label":o,onChange:e=>{const t=Array.from(e.target.selectedOptions).map(e=>{const t=i.find(t=>String(X(r,t))===e.value);return void 0!==t?X(r,t):e.value});n(t)}},i.map(t=>{const n=X(r,t);return e.createElement("option",{key:String(n),value:String(n)},Y(r,t))}))}return e.createElement(Zt,{size:"small",value:l,placeholder:"Comma separated values","aria-label":o,onChange:e=>a(e.target.value)})}function Er(t){const{item:r,column:n,operator:o,onChange:i,placeholder:l}=t,{api:a}=$e(),d=o?.inputType??"text";if(o?.InputComponent){const t=o.InputComponent;return e.createElement(t,{item:r,column:n,applyValue:e=>i(e.value),api:a})}switch(d){case"none":return e.createElement("div",null);case"boolean":return e.createElement(er,{size:"small",value:void 0===r.value||null===r.value?"":String(r.value),"aria-label":l,onChange:e=>i(""===e.target.value?void 0:e.target.value)},e.createElement("option",{value:""},"any"),e.createElement("option",{value:"true"},"yes"),e.createElement("option",{value:"false"},"no"));case"select":{const t=J(n);return e.createElement(er,{size:"small",value:void 0===r.value||null===r.value?"":String(r.value),"aria-label":l,onChange:e=>{const r=t.find(t=>String(X(n,t))===e.target.value);i(""===e.target.value?void 0:void 0!==r?X(n,r):e.target.value)}},e.createElement("option",{value:""}),t.map(t=>{const r=X(n,t);return e.createElement("option",{key:String(r),value:String(r)},Y(n,t))}))}case"multiselect":return e.createElement(yr,{...t});case"number":return e.createElement(vr,{...t,type:"number"});case"date":return e.createElement(vr,{...t,type:"date"});case"datetime-local":return e.createElement(vr,{...t,type:"datetime-local"});default:return e.createElement(vr,{...t,type:"text"})}}const Cr=e=>({id:V("filter"),field:e?.field??"",operator:e?ve(e)[0]?.value??"contains":"contains",value:void 0});function Mr(){const{api:t,state:r,localeText:n,columns:o,rootProps:i}=$e(),l=e.useMemo(()=>o.filter(e=>!1!==e.filterable),[o]),a=e.useMemo(()=>{const e=new Map;return l.forEach(t=>e.set(t.field,t)),e},[l]),d=r.filterModel.items,s=r.filterModel.logicOperator??"and",c=r.preferencePanel.targetField,g=e.useRef(!1);e.useEffect(()=>{if(!g.current)if(g.current=!0,c&&a.has(c)){d.find(e=>e.field===c)||t.upsertFilterItem(Cr(a.get(c)))}else 0===d.length&&l.length>0&&t.upsertFilterItem(Cr(l[0]))},[t,a,l,d,c]);const m=(e,r)=>{t.upsertFilterItem({...e,...r})},u=!i.disableMultipleColumnsFiltering||0===d.length;return e.createElement("div",{className:"mgh-grid-panel",role:"group","aria-label":n.toolbarFilters},e.createElement("div",{className:"mgh-grid-panel-content",style:{paddingTop:12}},0===d.length&&e.createElement("div",{className:"mgh-grid-filter-empty"},"No filters"),d.map((r,o)=>{const i=a.get(r.field)??l[0],c=i?ve(i):[],g=c.find(e=>e.value===r.operator)??c[0],u=d.length>1;return e.createElement("div",{key:String(r.id??o),className:u?"mgh-grid-filter-row mgh-grid-filter-row--with-logic":"mgh-grid-filter-row"},e.createElement(Yt,{size:"small",label:n.filterPanelDeleteIcon,onClick:()=>t.deleteFilterItem(r)},e.createElement(Tt,null)),u&&e.createElement(tr,{label:1===o?n.filterPanelLogicOperator:" "},0===o?e.createElement("div",{style:{height:32}}):e.createElement(er,{size:"small",value:s,disabled:o>1,"aria-label":n.filterPanelLogicOperator,onChange:e=>t.setFilterLogicOperator(e.target.value)},e.createElement("option",{value:"and"},n.filterPanelOperatorAnd),e.createElement("option",{value:"or"},n.filterPanelOperatorOr))),e.createElement(tr,{label:n.filterPanelColumns},e.createElement(er,{size:"small",value:i?.field??"","aria-label":n.filterPanelColumns,onChange:e=>{const t=a.get(e.target.value),n=t?ve(t):[],o=n.some(e=>e.value===r.operator);m(r,{field:e.target.value,operator:o?r.operator:n[0]?.value??"contains",value:void 0})}},l.map(t=>e.createElement("option",{key:t.field,value:t.field},t.headerName??t.field)))),e.createElement(tr,{label:n.filterPanelOperator},e.createElement(er,{size:"small",value:g?.value??"","aria-label":n.filterPanelOperator,onChange:e=>{const t=c.find(t=>t.value===e.target.value),n="multiselect"===t?.inputType,o="multiselect"===g?.inputType;m(r,{operator:e.target.value,value:n!==o?void 0:r.value})}},c.map(t=>e.createElement("option",{key:t.value,value:t.value},t.label??t.value)))),e.createElement(tr,{label:n.filterPanelValue},i?e.createElement(Er,{item:r,column:i,operator:g,placeholder:n.filterPanelInputPlaceholder,onChange:e=>m(r,{value:e})}):e.createElement("div",null)))})),e.createElement("div",{className:"mgh-grid-panel-footer"},e.createElement(Xt,{variant:"primary",size:"small",startIcon:e.createElement(At,{size:18}),onClick:()=>{t.upsertFilterItem(Cr(l[0]))},disabled:!u},n.filterPanelAddFilter),e.createElement(Xt,{size:"small",startIcon:e.createElement(Tt,{size:18}),disabled:0===d.length,onClick:()=>t.setFilterModel({...r.filterModel,items:[]})},n.filterPanelRemoveAll)))}function kr({column:t,anchorEl:r,open:n,onClose:o,themeMode:i,panelAnchorEl:l}){const{api:a,state:d,localeText:s,rootProps:c}=$e(),g=t.field,m=g===S,u=d.sortModel.find(e=>e.field===g),p=a.isColumnPinned(g),h=-1!==d.rowGroupingModel.indexOf(g),f=d.aggregationModel[g],b=!1!==t.sortable&&!c.disableColumnSorting,x=!1!==t.filterable&&!c.disableColumnFilter&&!m,w=!1!==t.hideable,v=!1!==t.pinnable&&!c.disableColumnPinning,y=!1!==t.groupable&&!c.disableRowGrouping&&!m,E=Object.keys(c.aggregationFunctions).filter(e=>{const r=c.aggregationFunctions[e];return(!t.availableAggregationFunctions||-1!==t.availableAggregationFunctions.indexOf(e))&&(!r.columnTypes||!t.type||-1!==r.columnTypes.indexOf(t.type))}),C=!1!==t.aggregable&&!c.disableAggregation&&!m&&E.length>0,M=l??r,k=t.headerName??t.field;return e.createElement(or,{open:n,anchorEl:r,onClose:o,themeMode:i,placement:"bottom-end",role:"menu"},e.createElement(ir,{"aria-label":s.columnMenuLabel},b&&e.createElement(e.Fragment,null,e.createElement(lr,{icon:e.createElement(St,null),selected:"asc"===u?.sort,onClick:()=>a.sortColumn(g,"asc"),hideMenu:o},s.columnMenuSortAsc),e.createElement(lr,{icon:e.createElement(It,null),selected:"desc"===u?.sort,onClick:()=>a.sortColumn(g,"desc"),hideMenu:o},s.columnMenuSortDesc),u&&e.createElement(lr,{icon:e.createElement("span",{style:{width:20}}),onClick:()=>a.sortColumn(g,null),hideMenu:o},s.columnMenuUnsort)),x&&e.createElement(e.Fragment,null,b&&e.createElement(ar,null),e.createElement(lr,{icon:e.createElement(Et,null),onClick:()=>a.showFilterPanel(g,M),hideMenu:o},s.columnMenuFilter)),(w||!c.disableColumnSelector)&&e.createElement(e.Fragment,null,(b||x)&&e.createElement(ar,null),w&&e.createElement(lr,{icon:e.createElement(Wt,null),onClick:()=>a.setColumnVisibility(g,!1),hideMenu:o},s.columnMenuHideColumn),!c.disableColumnSelector&&e.createElement(lr,{icon:e.createElement(yt,null),onClick:()=>a.showPreferences("columns",M),hideMenu:o},s.columnMenuManageColumns)),v&&e.createElement(e.Fragment,null,e.createElement(ar,null),"left"!==p&&e.createElement(lr,{icon:e.createElement(Ot,{style:{transform:"rotate(30deg)"}}),onClick:()=>a.pinColumn(g,"left"),hideMenu:o},s.columnMenuPinLeft),"right"!==p&&e.createElement(lr,{icon:e.createElement(Ot,{style:{transform:"rotate(-30deg)"}}),onClick:()=>a.pinColumn(g,"right"),hideMenu:o},s.columnMenuPinRight),p&&e.createElement(lr,{icon:e.createElement("span",{style:{width:20}}),onClick:()=>a.unpinColumn(g),hideMenu:o},s.columnMenuUnpin)),y&&e.createElement(e.Fragment,null,e.createElement(ar,null),e.createElement(lr,{icon:e.createElement(jt,null),onClick:()=>h?a.removeRowGroupingCriteria(g):a.addRowGroupingCriteria(g),hideMenu:o},h?s.columnMenuUngroup(k):s.columnMenuGroup(k))),C&&e.createElement(e.Fragment,null,e.createElement(ar,null),e.createElement(dr,null,e.createElement("label",{className:"mgh-grid-field-label",style:{display:"flex",alignItems:"center",gap:6}},e.createElement(qt,{size:16})," ",s.columnMenuAggregation),e.createElement(er,{size:"small",value:f??"","aria-label":s.columnMenuAggregation,onChange:e=>{const t={...d.aggregationModel};""===e.target.value?delete t[g]:t[g]=e.target.value,a.setAggregationModel(t)}},e.createElement("option",{value:""},s.aggregationFunctionLabelNone),E.map(t=>e.createElement("option",{key:t,value:t},c.aggregationFunctions[t].label??t)))))))}function Sr({text:t="No rows",imageSrc:r}){return e.createElement("div",{className:"mgh-grid-no-rows",role:"status"},r?e.createElement("img",{alt:"",src:r}):e.createElement(Kt,{size:50}),e.createElement("div",null,t))}function Ir({text:t}){return e.createElement(e.Fragment,null,e.createElement(nr,null),t&&e.createElement("div",null,t))}function Fr({icon:t,label:r,onClick:n,showInMenu:o,disabled:i,className:l,...a}){return e.createElement(Yt,{size:"small",label:r,disabled:i,className:l,onClick:e=>{e.stopPropagation(),n?.(e)},...a},t)}function Pr({actions:t,themeMode:r,moreLabel:n}){const[o,i]=e.useState(null),l=[],a=[];return t.forEach(t=>{e.isValidElement(t)&&(t.props?.showInMenu?a.push(t):l.push(t))}),e.createElement(e.Fragment,null,l.map((t,r)=>e.createElement(e.Fragment,{key:t.key??r},t)),a.length>0&&e.createElement(e.Fragment,null,e.createElement(Yt,{size:"small",label:n,active:Boolean(o),onClick:e=>{e.stopPropagation(),i(t=>t?null:e.currentTarget)}},e.createElement(Ft,null)),e.createElement(or,{open:Boolean(o),anchorEl:o,onClose:()=>i(null),themeMode:r,placement:"bottom-end",role:"menu"},e.createElement(ir,null,a.map((t,r)=>{const n=t.props;return e.createElement(lr,{key:t.key??r,icon:n.icon,disabled:n.disabled,onClick:e=>{n.onClick?.(e),i(null)}},n.label)})))))}Fr.displayName="MGHGridActionsCellItem";const Rr=[],Nr={},Dr=new Map,zr=["asc","desc",null],Gr=[10,25,50,100],Or={items:[],quickFilterExcludeHiddenColumns:!1},Tr=e=>{if(!e)return;const t={};return Object.keys(e).forEach(r=>{if(Se(r))return;const n=e[r];"string"!=typeof n&&"number"!=typeof n||(t[r]=n)}),t},Ar=(e,t)=>{const r=q(e);if(!r)return"";const n=e=>String(e).padStart(2,"0"),o=`${r.getFullYear()}-${n(r.getMonth()+1)}-${n(r.getDate())}`;return t?`${o}T${n(r.getHours())}:${n(r.getMinutes())}`:o};function Lr(t){const{rows:r,columns:n,getRowId:o,loading:i=!1,header:l,renderHeaderEndContent:a,renderHeaderCenterContent:d,disableCard:s=!1,className:c,cardClassName:g,boxClassName:m,cardStyle:u,cardSx:p,boxStyle:h,boxSx:f,style:b,sx:x,themeMode:w="light",themeVars:v,showToolbar:y=!0,toolbarProps:E,slots:C=Nr,slotProps:M=Nr,noRowsText:k="No data found within selected parameters.",localeText:R,rowHeight:A=D,columnHeaderHeight:V=z,getRowHeight:$,autoHeight:j=!1,disableVirtualization:K=!1,density:Q,onDensityChange:ne,disableDensitySelector:oe=!1,pagination:ie=!0,pageSize:le=25,pageSizeOptions:ae=Gr,paginationModel:de,onPaginationModelChange:se,hideFooter:ge=!1,hideFooterPagination:me=!1,hideFooterRowCount:ue=!1,hideFooterSelectedRowCount:pe=!1,sortModel:he,onSortModelChange:fe,sortingOrder:be=zr,disableMultipleColumnsSorting:xe=!1,disableColumnSorting:we=!1,filterModel:Ee,onFilterModelChange:ke,disableColumnFilter:Se=!1,disableMultipleColumnsFiltering:Ie=!1,quickFilterDebounceMs:Pe=150,columnVisibilityModel:De,onColumnVisibilityModelChange:Oe,columnVisibilityStorageKey:Te,columnOrderStorageKey:Ae,columnWidthStorageKey:Le,pinnedColumnsStorageKey:$e,onColumnOrderChange:Be,onColumnWidthChange:Ke,disableColumnMenu:Ye=!1,disableColumnSelector:Je=!1,disableColumnResize:Ze=!1,disableColumnReorder:et=!1,disableColumnPinning:tt=!1,pinnedColumns:rt,onPinnedColumnsChange:nt,checkboxSelection:ot=!1,checkboxSelectionVisibleOnly:it=!1,disableRowSelectionOnClick:lt=!0,disableMultipleRowSelection:at=!1,rowSelectionModel:dt,onRowSelectionModelChange:st,isRowSelectable:ct,keepNonExistentRowsSelected:gt=!0,getRowClassName:mt,onRowClick:ut,onRowDoubleClick:ft,onCellClick:vt,onCellDoubleClick:yt,pinnedRows:Et,getDetailPanelContent:Ct,getDetailPanelHeight:kt,detailPanelExpandedRowIds:Dt,onDetailPanelExpandedRowIdsChange:zt,rowGroupingModel:Gt,onRowGroupingModelChange:Ot,defaultGroupingExpansionDepth:Tt=0,groupingColDef:At,disableRowGrouping:Lt=!1,isGroupExpandedByDefault:Ht,aggregationModel:Vt,onAggregationModelChange:$t,aggregationFunctions:Bt,disableAggregation:Ut=!1,aggregationPosition:_t="both",processRowUpdate:Wt,onProcessRowUpdateError:qt,onCellEditStop:jt,isCellEditable:Kt,initialState:Qt,apiRef:Xt,onStateChange:Jt}=t;He();const tr=function(t){const r=e.useId;if(r)return`${t}-${r().replace(/:/g,"")}`;const n=e.useRef(null);return null===n.current&&(_e+=1,n.current=`${t}-${_e}`),n.current}("mgh-grid"),nr=e.useRef(null),ir=e.useRef(null),lr=e.useRef(null),ar=function(){const[,t]=e.useState(0);return e.useCallback(()=>t(e=>e+1),[])}(),dr=e.useMemo(()=>({...Ne,...R}),[R]),sr=e.useRef({}),cr=e.useCallback(()=>({api:sr.current.api}),[]),gr=e.useMemo(()=>{const e=()=>sr.current,t={getRow:t=>e().rowsById.get(t)??null,getRowModels:()=>new Map(e().rowsById),getAllRowIds:()=>e().rowEntries.map(e=>e.id),getRowNode:t=>e().nodesById.get(t)??null,getSortedRows:()=>e().sortedLeaves.map(e=>e.row),getSortedRowIds:()=>e().sortedLeaves.map(e=>e.id),getVisibleRows:()=>e().pagedRows.filter(e=>"leaf"===e.type&&e.row).map(e=>({id:e.id,model:e.row})),getRowIndexRelativeToVisibleRows:t=>e().pagedRows.findIndex(e=>e.id===t),updateRows:t=>{t.forEach(t=>{const r=_(t,e().getRowId),n=e().rowsById.get(r);n&&e().setRowOverride(r,{...n,...t})})},getAllColumns:()=>e().orderedUserColumns,getVisibleColumns:()=>e().visibleUserColumns,getColumn:t=>e().getColumn(t),getColumnIndex:(t,r=!0)=>(r?e().visibleUserColumns:e().orderedUserColumns).findIndex(e=>e.field===t),getColumnVisibilityModel:()=>e().columnVisibilityModel,setColumnVisibility:(t,r)=>e().setColumnVisibilityModel({...e().columnVisibilityModel,[t]:r}),setColumnVisibilityModel:t=>e().setColumnVisibilityModel(t),setColumnWidth:(t,r)=>e().setColumnWidth(t,r),setColumnIndex:(t,r)=>e().setColumnIndex(t,r),autosizeColumns:t=>e().autosizeColumns(t),pinColumn:(t,r)=>e().pinColumn(t,r),unpinColumn:t=>e().unpinColumn(t),isColumnPinned:t=>e().isColumnPinned(t),getPinnedColumns:()=>e().pinnedColumns,setPinnedColumns:t=>e().setPinnedColumns(t),getSortModel:()=>e().sortModel,setSortModel:t=>e().setSortModel(t),sortColumn:(t,r,n)=>e().sortColumn(t,r,n),getFilterModel:()=>e().filterModel,setFilterModel:t=>e().setFilterModel(t),upsertFilterItem:t=>e().upsertFilterItems([t]),upsertFilterItems:t=>e().upsertFilterItems(t),deleteFilterItem:t=>e().deleteFilterItem(t),setFilterLogicOperator:t=>e().setFilterModel({...e().filterModel,logicOperator:t}),setQuickFilterValues:t=>e().setFilterModel({...e().filterModel,quickFilterValues:t}),showFilterPanel:(t,r)=>e().showPreferences("filters",r,t),hideFilterPanel:()=>e().hidePreferences(),showPreferences:(t,r,n)=>e().showPreferences(t,r,n),hidePreferences:()=>e().hidePreferences(),getSelectedRows:()=>{const t=new Map;return e().selectedIds.forEach(r=>{const n=e().rowsById.get(r);n&&t.set(r,n)}),t},getRowSelectionModel:()=>({type:"include",ids:e().selectedIds}),setRowSelectionModel:t=>{const r=W(t,e().rowEntries.map(e=>e.id));e().setSelectedIds(r.ids)},selectRow:(t,r=!0,n=!1)=>e().selectRows([t],r,n),selectRows:(t,r=!0,n=!1)=>e().selectRows(t,r,n),isRowSelected:t=>e().selectedIds.has(t),isRowSelectable:t=>e().isRowSelectableFn(t,e().rowsById.get(t)),setPage:t=>e().setPaginationModel({...e().paginationModel,page:Math.max(0,t)}),setPageSize:t=>e().setPaginationModel({page:0,pageSize:Math.max(1,t)}),setPaginationModel:t=>e().setPaginationModel(t),setDensity:t=>e().setDensity(t),getDataAsCsv:e=>Qe(t,e),exportDataAsCsv:e=>((e,t={})=>{const r=Qe(e,t),n=t.utf8WithBom?Xe:"",o=new Blob([n+r],{type:"text/csv;charset=utf-8;"});Ge(o,qe(t.fileName,je(),"csv"))})(t,e),exportDataAsExcel:e=>(async(e,t={})=>{const r=pt(e,t),n=new Blob([r],{type:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"});Ge(n,qe(t.fileName,je(),"xlsx"))})(t,e),exportDataAsPrint:e=>((e,t={})=>{if("undefined"==typeof document)return;const r=t.includeHeaders??!0,n=We(e,t),o=t.title??t.fileName??document.title??"",i=r?`<thead><tr>${n.headers.map((e,t)=>`<th class="${n.columns[t].align??"left"}">${ht(e)}</th>`).join("")}</tr></thead>`:"",l=`<tbody>${n.rows.map(e=>`<tr>${e.map(e=>`<td class="${e.col.align??"left"}">${ht(e.formatted)}</td>`).join("")}</tr>`).join("")}</tbody>`,a=`<!doctype html><html><head><meta charset="utf-8" /><title>${ht(o)}</title><style>body{font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Helvetica,Arial,sans-serif;font-size:12px;color:#111;margin:16px;}h1{font-size:16px;margin:0 0 12px;}table{border-collapse:collapse;width:100%;}th,td{border:1px solid #ccc;padding:4px 8px;text-align:left;vertical-align:top;}th{background:#f3f3f3;font-weight:600;}td.right,th.right{text-align:right;} td.center,th.center{text-align:center;}tr{page-break-inside:avoid;} thead{display:table-header-group;}`+(t.pageStyle??"")+"</style></head><body>"+(o?`<h1>${ht(o)}</h1>`:"")+`<table>${i}${l}</table></body></html>`,d=document.createElement("iframe");d.setAttribute("aria-hidden","true"),d.style.position="fixed",d.style.right="0",d.style.bottom="0",d.style.width="0",d.style.height="0",d.style.border="0",d.style.opacity="0",document.body.appendChild(d);const s=()=>{window.setTimeout(()=>{d.parentNode&&d.parentNode.removeChild(d)},1e3)};d.onload=()=>{const e=d.contentWindow;if(e)try{e.focus(),e.onafterprint=s,e.print()}catch{s()}else s()};const c=d.contentDocument||d.contentWindow?.document;c?(c.open(),c.write(a),c.close()):d.srcdoc=a})(t,e),toggleDetailPanel:t=>e().toggleDetailPanel(t),setExpandedDetailPanels:t=>e().setExpandedDetailPanels(new Set(t)),getExpandedDetailPanels:()=>Array.from(e().expandedDetailPanels),getRowGroupingModel:()=>e().rowGroupingModel,setRowGroupingModel:t=>e().setRowGroupingModel(t),addRowGroupingCriteria:(t,r)=>{const n=e().rowGroupingModel.filter(e=>e!==t);void 0===r?n.push(t):n.splice(L(r,0,n.length),0,t),e().setRowGroupingModel(n)},removeRowGroupingCriteria:t=>e().setRowGroupingModel(e().rowGroupingModel.filter(e=>e!==t)),setRowChildrenExpansion:(t,r)=>e().setRowChildrenExpansion(t,r),getRowGroupChildren:({groupId:t})=>{const r=e().groupsById.get(t);return r?r.descendants.map(e=>e.id):[]},getAggregationModel:()=>e().aggregationModel,setAggregationModel:t=>e().setAggregationModel(t),startCellEditMode:({id:t,field:r})=>e().startCellEditMode(t,r),stopCellEditMode:({id:t,field:r,ignoreModifications:n})=>e().stopCellEditMode(t,r,n,"api"),getCellMode:(t,r)=>{const n=e().editingCell;return n&&n.id===t&&n.field===r?"edit":"view"},setEditCellValue:({id:t,field:r,value:n})=>{const o=e().editingCell;o&&o.id===t&&o.field===r&&e().setEditValue(n)},getCellValue:(r,n)=>{const o=e().rowsById.get(r),i=e().getColumn(n);return o&&i?Z(o,i,t):void 0},getCellParams:(t,r)=>{const n=e().rowsById.get(t);return e().buildCellParams(t,r,n,e().nodesById.get(t)??{type:"leaf",id:t,depth:0,parent:null})},setCellFocus:(t,r)=>{cn.current=!0,e().setFocusedCell({id:t,field:r})},scrollToIndexes:t=>e().scrollToIndexes(t),scroll:({left:e,top:t})=>{const r=ir.current;r&&(void 0!==e&&(r.scrollLeft=e),void 0!==t&&(r.scrollTop=t))},getScrollPosition:()=>({left:ir.current?.scrollLeft??0,top:ir.current?.scrollTop??0}),get state(){return e().state},forceUpdate:()=>e().forceUpdate(),rootElementRef:nr};return t},[]);sr.current.api||(sr.current.api=gr);const mr=e.useMemo(()=>({visibility:Te?B(Te):null,order:Ae?B(Ae):null,widths:Le?B(Le):null,pinned:$e?B($e):null}),[Te,Ae,Le,$e]),[ur,pr]=Ue(he,Qt?.sorting?.sortModel??Rr,e=>fe?.(e,cr())),[fr,wr]=Ue(Ee,Qt?.filter?.filterModel??Or,e=>ke?.(e,cr())),[vr,yr]=Ue(de,{page:Qt?.pagination?.paginationModel?.page??0,pageSize:Qt?.pagination?.paginationModel?.pageSize??le},e=>se?.(e,cr())),[Er,Cr]=Ue(De,mr.visibility??Qt?.columns?.columnVisibilityModel??Nr,e=>{Te&&U(Te,e),Oe?.(e,cr())}),[Fr,Lr]=Ue(Q,Qt?.density??"compact",e=>ne?.(e,cr())),[Hr,Vr]=Ue(rt,mr.pinned??Qt?.pinnedColumns??Nr,e=>{$e&&U($e,e),nt?.(e,cr())}),[$r,Br]=Ue(Gt,Qt?.rowGrouping?.model??Rr,e=>Ot?.(e,cr())),[Ur,_r]=Ue(Vt,Qt?.aggregation?.model??Nr,e=>$t?.(e,cr())),Wr=e.useMemo(()=>Dt?new Set(Dt):void 0,[Dt]),[qr,jr]=Ue(Wr,e.useMemo(()=>new Set(Qt?.detailPanel?.expandedRowIds??[]),[]),e=>zt?.(Array.from(e),cr())),Kr=e.useMemo(()=>void 0!==dt?W(dt).ids:void 0,[dt]),[Qr,Xr]=Ue(Kr,e.useMemo(()=>new Set,[]),e=>st?.({type:"include",ids:e},cr())),[Yr,Jr]=e.useState(()=>mr.order??Qt?.columns?.orderedFields??null),[Zr,en]=e.useState(()=>{if(mr.widths)return mr.widths;const e=Qt?.columns?.dimensions;if(!e)return{};const t={};return Object.keys(e).forEach(r=>{e[r].width&&(t[r]=e[r].width)}),t}),[tn,rn]=e.useState(()=>new Map),[nn,on]=e.useState(null),[ln,an]=e.useState(void 0),[dn,sn]=e.useState(null),cn=e.useRef(!1),[gn,mn]=e.useState({open:!1,anchorEl:null}),[un,pn]=e.useState(null),[hn,fn]=e.useState(null),[bn,xn]=e.useState(null),[wn,vn]=e.useState(0),yn=e.useRef(0),En=e.useRef(null),[Cn,Mn]=e.useState(()=>({rows:r,map:new Map})),kn=Cn.rows===r?Cn.map:Dr,Sn=e.useCallback((e,t)=>{Mn(n=>{const o=new Map(n.rows===r?n.map:[]);return o.set(e,t),{rows:r,map:o}})},[r]),{width:In,height:Fn}=function(t,r=!0){const[n,o]=e.useState({width:0,height:0});return e.useLayoutEffect(()=>{const e=t.current;if(!e||!r)return;const n=()=>{const t=e.clientWidth,r=e.clientHeight;o(e=>e.width===t&&e.height===r?e:{width:t,height:r})};if(n(),"undefined"==typeof ResizeObserver)return window.addEventListener("resize",n),()=>window.removeEventListener("resize",n);const i=new ResizeObserver(n);return i.observe(e),()=>i.disconnect()},[t,r]),n}(ir),Pn=N[Fr]??1,Rn=Math.round(A*Pn),Nn=Math.round(V*Pn),Dn=e.useMemo(()=>{const e=[];return r.forEach(t=>{const r=_(t,o);null!=r&&e.push({id:r,row:kn.get(r)??t})}),e},[r,o,kn]),zn=e.useMemo(()=>{const e=new Map;return Dn.forEach(t=>e.set(t.id,t.row)),(Et?.top??[]).forEach(t=>e.set(_(t,o),t)),(Et?.bottom??[]).forEach(t=>e.set(_(t,o),t)),e},[Dn,Et,o]),Gn=e.useMemo(()=>n.map(e=>ye(e)),[n]),On=e.useMemo(()=>{const e=new Map;return Gn.forEach(t=>e.set(t.field,t)),e},[Gn]),Tn=e.useMemo(()=>Lt?[]:$r.filter(e=>On.has(e)),[$r,On,Lt]),An=Tn.length>0,Ln=e.useMemo(()=>{if(!An)return null;const e=1===Tn.length?On.get(Tn[0]):void 0;return ye({field:S,headerName:e?e.headerName??e.field:dr.groupingColumnHeaderName,width:220,minWidth:120,sortable:!0,filterable:!1,hideable:!1,groupable:!1,aggregable:!1,editable:!1,disableExport:!0,disableReorder:!0,...At})},[An,Tn,On,dr.groupingColumnHeaderName,At]),Hn=e.useMemo(()=>{if(!Yr||0===Yr.length)return Gn;const e=new Set,t=[];return Yr.forEach(r=>{const n=On.get(r);n&&!e.has(r)&&(e.add(r),t.push(n))}),Gn.forEach(r=>{e.has(r.field)||t.push(r)}),t},[Yr,Gn,On]),Vn=e.useCallback(e=>{const t=Er[e];return!1!==t&&(void 0!==t||-1===Tn.indexOf(e))},[Er,Tn]),$n=e.useMemo(()=>Hn.filter(e=>Vn(e.field)),[Hn,Vn]),Bn=e.useMemo(()=>{const e=[];ot&&e.push(Ce),Ct&&e.push(Me);const t=tt?[]:(Hr.left??[]).filter(e=>e!==S),r=tt?[]:(Hr.right??[]).filter(e=>e!==S),n=new Map;$n.forEach(e=>n.set(e.field,e));const o=e.slice();Ln&&o.push(Ln),t.forEach(e=>{const t=n.get(e);t&&o.push(t)});const i=[];r.forEach(e=>{const r=n.get(e);r&&-1===t.indexOf(e)&&i.push(r)});const l=$n.filter(e=>-1===t.indexOf(e.field)&&-1===r.indexOf(e.field)),a=o.concat(l,i),d=((e,t,r)=>{const n=e.map(e=>{const t=e.minWidth??G,n=e.maxWidth??1/0,o=r[e.field];return o?L(o,t,n):e.flex&&e.flex>0?null:L(e.width??100,t,n)}),o=[];let i=0;if(n.forEach((e,t)=>{null===e?o.push(t):i+=e}),o.length>0){let r=Math.max(0,t-i),l=o.reduce((t,r)=>t+e[r].flex,0),a=o.slice(),d=!0;for(;d&&a.length>0;){d=!1;for(let t=0;t<a.length;t+=1){const o=a[t],i=e[o],s=i.minWidth??G,c=i.maxWidth??1/0,g=l>0?r*i.flex/l:0;if(g<s||g>c){const e=g<s?s:c;n[o]=e,r=Math.max(0,r-e),l-=i.flex,a=a.filter(e=>e!==o),d=!0;break}}}a.forEach(t=>{const o=e[t];n[t]=l>0?Math.floor(r*o.flex/l):o.minWidth??50})}return n})(a,In,Zr),s=o.length>e.length+(Ln?1:0)||i.length>0,c=[];let g=0,m=0;a.forEach((e,t)=>{const r=d[t],n=t<o.length,i=t>=o.length+l.length;c.push({col:e,width:r,pinned:n?"left":i?"right":null,offset:n?m:0,x:g,isLastLeft:n&&t===o.length-1,isFirstRight:i&&t===o.length+l.length}),n&&(m+=r),g+=r});let u=0;for(let e=c.length-1;e>=0&&"right"===c[e].pinned;e-=1)c[e].offset=u,u+=c[e].width;return{columns:c,totalWidth:g,hasPinning:s,leftCount:o.length,rightCount:i.length}},[ot,Ct,Hr,tt,$n,Ln,In,Zr]),Un=e.useMemo(()=>{const e=new Map;return Bn.columns.forEach(t=>e.set(t.col.field,t.col)),Ln&&e.set(S,Ln),e},[Bn.columns,Ln]),_n=e.useCallback(e=>On.get(e)??Un.get(e),[On,Un]),Wn=e.useMemo(()=>{const e=[];return fr.items.forEach(t=>{const r=On.get(t.field);if(!r||!1===r.filterable)return;const n=ve(r).find(e=>e.value===t.operator);if(!n)return;const o=n.getApplyFilterFn(t,r);o&&e.push({col:r,fn:o})}),e},[fr.items,On]),qn=e.useMemo(()=>(fr.quickFilterValues??[]).map(e=>String(e).trim()).filter(e=>""!==e),[fr.quickFilterValues]),jn=e.useMemo(()=>(fr.quickFilterExcludeHiddenColumns?$n:Hn).filter(e=>!1!==e.filterable&&"actions"!==e.type),[fr.quickFilterExcludeHiddenColumns,$n,Hn]),Kn=e.useMemo(()=>{if(0===Wn.length&&0===qn.length)return Dn;const e="and"===(fr.logicOperator??"and"),t="and"===(fr.quickFilterLogicOperator??"and"),r=sr.current.api,n=qn.map(e=>{const t=e.toLowerCase(),n=jn.map(n=>{if(n.getApplyQuickFilterFn){const t=n.getApplyQuickFilterFn(e,n,r);return t?{col:n,fn:t}:null}return{col:n,fn:(e,o)=>{if(T(e))return!1;if(-1!==re(te(e,o,n,r)).toLowerCase().indexOf(t))return!0;return-1!==("object"==typeof e?"":String(e).toLowerCase()).indexOf(t)}}}).filter(Boolean);return e=>n.some(({col:t,fn:n})=>n(Z(e,t,r),e,t,r))});return Dn.filter(({row:o})=>{if(Wn.length>0){const t=Wn.map(({col:e,fn:t})=>t(Z(o,e,r),o,e,r));if(!(e?t.every(Boolean):t.some(Boolean)))return!1}if(n.length>0){const e=n.map(e=>e(o));return t?e.every(Boolean):e.some(Boolean)}return!0})},[Dn,Wn,qn,jn,fr.logicOperator,fr.quickFilterLogicOperator]),Qn=e.useMemo(()=>{const e=sr.current.api,t=ur.filter(e=>e.sort&&e.field!==S).map(e=>{const t=On.get(e.field);return t&&!1!==t.sortable?{col:t,dir:"desc"===e.sort?-1:1,comparator:t.sortComparator??ce(t.type)}:null}).filter(Boolean);return 0===t.length?null:(r,n)=>{for(let o=0;o<t.length;o+=1){const{col:i,dir:l,comparator:a}=t[o],d=Z(r.row,i,e),s=Z(n.row,i,e),c=a(d,s,{id:r.id,field:i.field,value:d,row:r.row,api:e},{id:n.id,field:i.field,value:s,row:n.row,api:e});if(0!==c)return c*l}return 0}},[ur,On]),Xn=e.useCallback(e=>Qn?e.map((e,t)=>({entry:e,index:t})).sort((e,t)=>Qn(e.entry,t.entry)||e.index-t.index).map(e=>e.entry):e,[Qn]),Yn=e.useMemo(()=>({...Re,...Bt}),[Bt]),Jn=!Ut&&Object.keys(Ur).length>0,Zn=e.useCallback(e=>{const t=tn.get(e.id);return void 0!==t?t:Ht?Ht({type:"group",id:e.id,depth:e.depth,parent:e.parent,groupingField:e.groupingField,groupingKey:e.groupingKey,groupingLabel:e.groupingLabel,children:[],leafIds:[],isExpanded:!1}):-1===Tt||e.depth<Tt},[tn,Ht,Tt]),eo=e.useMemo(()=>{const e=new Map,t=new Map;if(!An){const r=Xn(Kn);return{displayRows:r.map(t=>{const r={type:"leaf",id:t.id,depth:0,parent:null};return e.set(t.id,r),{id:t.id,type:"leaf",row:t.row,node:r,depth:0}}),sortedLeaves:r,nodesById:e,groupsById:t,tree:[]}}const r=sr.current.api;let n=bt(Kn,Tn,On,r);const o=ur.find(e=>e.field===S&&e.sort);n=((e,t,r)=>{const n=(e,o)=>{const i=t?t(o):null,l=i?e.map((e,t)=>({node:e,index:t})).sort((e,t)=>i(e.node,t.node)||e.index-t.index).map(e=>e.node):e;return l.forEach(e=>{if(e.childGroups.length>0){e.childGroups=n(e.childGroups,o+1);const t=[];e.childGroups.forEach(e=>e.descendants.forEach(e=>t.push(e))),e.descendants=t}else e.leaves=r(e.leaves),e.descendants=e.leaves}),l};return n(e,0)})(n,e=>{const t=Tn[e],n=On.get(t);if(!n)return null;const i=o??ur.find(e=>e.field===t&&e.sort);if(!i)return null;const l=n.sortComparator??ce(n.type),a="desc"===i.sort?-1:1;return(e,n)=>l(e.groupingKey,n.groupingKey,{id:e.id,field:t,value:e.groupingKey,row:e.descendants[0]?.row,api:r},{id:n.id,field:t,value:n.groupingKey,row:n.descendants[0]?.row,api:r})*a},Xn);const i=((e,t,r,n)=>{const o=[],i=(e,l)=>{e.forEach(e=>{const a=t(e),d=((e,t)=>({type:"group",id:e.id,depth:e.depth,parent:e.parent,groupingField:e.groupingField,groupingKey:e.groupingKey,groupingLabel:e.groupingLabel,children:e.childGroups.length>0?e.childGroups.map(e=>e.id):e.leaves.map(e=>e.id),leafIds:e.descendants.map(e=>e.id),isExpanded:t}))(e,a);r.set(e.id,d),n.set(e.id,e),l&&o.push({id:e.id,type:"group",row:null,node:d,depth:e.depth,group:e});const s=l&&a;e.childGroups.length>0?i(e.childGroups,s):e.leaves.forEach(t=>{const n={type:"leaf",id:t.id,depth:e.depth+1,parent:e.id};r.set(t.id,n),s&&o.push({id:t.id,type:"leaf",row:t.row,node:n,depth:e.depth+1})})})};return i(e,!0),o})(n,Zn,e,t);return{displayRows:i,sortedLeaves:xt(n),nodesById:e,groupsById:t,tree:n}},[An,Kn,Xn,Tn,On,ur,Zn]),{displayRows:to,sortedLeaves:ro,nodesById:no,groupsById:oo}=eo,io=to.length,lo=ie?Math.max(1,Math.ceil(io/Math.max(vr.pageSize,1))):1,ao=ie?L(vr.page,0,lo-1):0;e.useEffect(()=>{ie&&vr.page!==ao&&yr({...vr,page:ao})},[ie,vr,ao,yr]);const so=e.useMemo(()=>ie?to.slice(ao*vr.pageSize,(ao+1)*vr.pageSize):to,[to,ie,ao,vr.pageSize]),co=e.useMemo(()=>{if(!Jn||"inline"===_t)return null;const e=ro.map(e=>e.row);return wt(e,Ur,On,Yn,sr.current.api)},[Jn,_t,ro,Ur,On,Yn]),go=e.useMemo(()=>new Map,[so,Ur,Yn]),mo=e=>{if(!Jn||"footer"===_t)return;let t=go.get(e.id);return t||(t=wt(e.descendants.map(e=>e.row),Ur,On,Yn,sr.current.api),go.set(e.id,t)),t},uo=e.useMemo(()=>{const e=[],t=[],r=[];let n=0,o=j||K;return so.forEach(i=>{let l=Rn;if($&&"leaf"===i.type&&i.row){const e=$({id:i.id,model:i.row,densityFactor:Pn});"auto"===e?o=!0:"number"==typeof e&&e>0&&(l=e)}let a=0;if("leaf"===i.type&&Ct&&qr.has(i.id)&&i.row){const e=kt?kt({id:i.id,row:i.row}):500;"auto"===e?o=!0:a=e}e.push(l),t.push(a),r.push(n),n+=l+a}),{rowHeights:e,detailHeights:t,offsets:r,total:n,hasAuto:o}},[so,Rn,$,Pn,Ct,kt,qr,j,K]),po=!uo.hasAuto,ho=e.useMemo(()=>{const e=so.length;if(!po||0===e)return{start:0,end:e};const t=6*Rn,r=Math.max(0,wn-Nn-t),n=wn+Math.max(Fn,Rn)+t,{offsets:o}=uo;let i=0,l=e-1;for(;i<l;){const e=i+l>>1;o[e]+uo.rowHeights[e]+uo.detailHeights[e]<r?i=e+1:l=e}const a=i;let d=a;for(;d<e&&o[d]<n;)d+=1;return{start:a,end:d}},[po,so.length,wn,Fn,Rn,Nn,uo]),fo=e.useCallback(()=>{sr.current.virtual&&(yn.current||(yn.current=window.requestAnimationFrame(()=>{yn.current=0,ir.current&&vn(ir.current.scrollTop)})))},[]);e.useEffect(()=>()=>{yn.current&&window.cancelAnimationFrame(yn.current)},[]);const bo=e.useCallback((e,t)=>!!t&&(!ct||ct({id:e,row:t,columns:Hn,api:sr.current.api})),[ct,Hn]),xo=e.useMemo(()=>(it?so.filter(e=>"leaf"===e.type&&e.row).map(e=>({id:e.id,row:e.row})):ro).filter(e=>bo(e.id,e.row)).map(e=>e.id),[it,so,ro,bo]),wo=e.useMemo(()=>xo.reduce((e,t)=>e+(Qr.has(t)?1:0),0),[xo,Qr]),vo=xo.length>0&&wo===xo.length,yo=wo>0&&!vo,Eo=e.useCallback(e=>{Xr(t=>{const r=e(t);return((e,t)=>{if(e.ids.size!==t.ids.size)return!1;let r=!0;return e.ids.forEach(e=>{t.ids.has(e)||(r=!1)}),r})({ids:t},{ids:r})?t:r})},[Xr]),Co=e.useCallback((e,t=!0,r=!1)=>{Eo(n=>{const o=r?new Set:new Set(n);if(e.forEach(e=>{t?bo(e,zn.get(e))&&o.add(e):o.delete(e)}),at&&o.size>1){const r=e[e.length-1];return new Set(t&&o.has(r)?[r]:[])}return o})},[Eo,bo,zn,at]);e.useEffect(()=>{if(gt||0===Qr.size)return;let e=!1;const t=new Set;Qr.forEach(r=>{zn.has(r)?t.add(r):e=!0}),e&&Xr(t)},[zn,gt,Qr,Xr]);const Mo=()=>{Co(xo,!vo)},ko=(e,t,r=!1)=>{const n=_n(e);if(!n||!1===n.sortable||we)return;const o=ur.find(t=>t.field===e);let i,l;if(void 0===t){const e=n.sortingOrder??be,t=e.indexOf(o?.sort??null);i=e[(t+1)%e.length]}else i=t;r&&!xe?(l=ur.filter(t=>t.field!==e),i&&(l=o?ur.map(t=>t.field===e?{field:e,sort:i}:t):l.concat([{field:e,sort:i}]))):l=i?[{field:e,sort:i}]:[],pr(l)},So=e=>{Ae&&U(Ae,e)},Io=e=>{Le&&U(Le,e)},Fo=(e={})=>{const t=e.includeHeaders??!0,r=Bn.columns.filter(t=>!(O(t.col.field)||e.columns&&-1===e.columns.indexOf(t.col.field)));if(0===r.length)return;const n=nr.current,o=n&&"undefined"!=typeof window?window.getComputedStyle(n):null,i=o?.fontFamily||"sans-serif",l=`400 14px ${i}`,a=`600 14px ${i}`,d=ro.slice(0,500),s=sr.current.api,c={...Zr};r.forEach(({col:e})=>{let r=t?ze(e.headerName??e.field,a)+64:0;d.forEach(t=>{const n=Z(t.row,e,s),o=re(te(n,t.row,e,s,t.id)),i=ze(o,l)+24;i>r&&(r=i)}),c[e.field]=L(Math.ceil(r),e.minWidth??G,e.maxWidth??1/0)}),en(c),Io(c)},Po=e.useCallback(()=>{mn(e=>e.open?{open:!1,anchorEl:null}:e)},[]),Ro=e=>!!e.colDef.editable&&("leaf"===e.rowNode.type&&(!Kt||Kt(e))),No=(e,t)=>{const r=zn.get(e),n=_n(t);if(!r||!n)return;const o=Ao(e,t,r,no.get(e)??{type:"leaf",id:e,depth:0,parent:null});Ro(o)&&(on({id:e,field:t}),an(o.value),sn({id:e,field:t}))},Do=(e,t,r=!1,n="api")=>{if(!nn||nn.id!==e||nn.field!==t)return;const o=zn.get(e),i=_n(t);if(on(null),o&&i){if(!r){const r=sr.current.api,n=i.valueParser?i.valueParser(ln,o,i,r):((e,t)=>{switch(t.type){case"number":{if(""===e||T(e))return null;const t=Number(e);return Number.isNaN(t)?e:t}case"boolean":return Boolean(e);case"date":case"dateTime":return""===e||T(e)?null:q(e)??e;default:return e}})(ln,i),l=Z(o,i,r);if(!Object.is(n,l)){((e,t,r)=>{Wt?Promise.resolve().then(()=>Wt(t,r,{rowId:e})).then(r=>Sn(e,r??t)).catch(e=>{qt?qt(e):console.error("MGHGrid: processRowUpdate failed",e)}):Sn(e,t)})(e,i.valueSetter?i.valueSetter(n,o,i,r):{...o,[t]:n},o)}}jt?.({id:e,field:t,row:o,reason:n},cr()),cn.current=!0,sn({id:e,field:t})}},zo=e=>{jr(t=>{const r=new Set(t);return r.has(e)?r.delete(e):r.add(e),r})},Go=(e,t)=>{rn(r=>{const n=new Map(r);return n.set(e,t),n})},Oo=Tn.join("|"),To=e.useRef(Oo);e.useEffect(()=>{To.current!==Oo&&(To.current=Oo,rn(new Map))},[Oo]);const Ao=(e,t,r,n)=>{const o=_n(t),i=sr.current.api,l=Z(r,o,i),a=te(l,r,o,i,e),d=Boolean(dn&&dn.id===e&&dn.field===t);return{id:e,field:t,value:l,formattedValue:a,row:r,rowNode:n,colDef:o,api:i,hasFocus:d,tabIndex:d?0:-1,cellMode:nn&&nn.id===e&&nn.field===t?"edit":"view",isEditable:Boolean(o.editable)&&"leaf"===n.type}},Lo=(e,t)=>({id:e,row:t,columns:Hn,api:sr.current.api});e.useEffect(()=>{if(!cn.current||!dn||!nr.current)return;cn.current=!1;const e=`[data-mgh-row-id="${String(dn.id).replace(/"/g,'\\"')}"] [data-mgh-field="${dn.field.replace(/"/g,'\\"')}"]`,t=nr.current.querySelector(e);t&&document.activeElement!==t&&!t.contains(document.activeElement)&&t.focus({preventScroll:!0})},[dn,ho.start,ho.end]);const Ho=e=>{const t=ir.current;if(!t)return!1;if(void 0!==e.rowIndex&&po){const r=L(e.rowIndex,0,Math.max(so.length-1,0)),n=uo.offsets[r]??0,o=n+(uo.rowHeights[r]??Rn),i=t.scrollTop,l=t.scrollTop+t.clientHeight-Nn;n<i?t.scrollTop=n:o>l&&(t.scrollTop=o-(t.clientHeight-Nn))}else if(void 0!==e.rowIndex){const r=t.querySelector(`[data-mgh-row-index="${e.rowIndex}"]`);r?.scrollIntoView?.({block:"nearest"})}if(void 0!==e.colIndex){const r=Bn.columns[L(e.colIndex,0,Bn.columns.length-1)];if(r&&!r.pinned){const e=Bn.columns.filter(e=>"left"===e.pinned).reduce((e,t)=>e+t.width,0),n=Bn.columns.filter(e=>"right"===e.pinned).reduce((e,t)=>e+t.width,0),o=t.scrollLeft+e,i=t.scrollLeft+t.clientWidth-n;r.x<o?t.scrollLeft=r.x-e:r.x+r.width>i&&(t.scrollLeft=r.x+r.width-t.clientWidth+n)}}return!0},Vo=(e,t,r)=>{if(0===so.length||0===Bn.columns.length)return;let n=dn?so.findIndex(e=>e.id===dn.id):-1,o=dn?Bn.columns.findIndex(e=>e.col.field===dn.field):-1;-1===n&&(n=0),-1===o&&(o=0),n="first"===r?.row?0:"last"===r?.row?so.length-1:L(n+e,0,so.length-1),o="first"===r?.col?0:"last"===r?.col?Bn.columns.length-1:L(o+t,0,Bn.columns.length-1);const i={id:so[n].id,field:Bn.columns[o].col.field};cn.current=!0,sn(i),Ho({rowIndex:n,colIndex:o})},$o=e=>!et&&!e.disableReorder&&!O(e.field),Bo=e.useRef(null),Uo=Wn.length,_o=An?io:Kn.length,Wo=e.useMemo(()=>({sortModel:ur,filterModel:fr,paginationModel:{page:ao,pageSize:vr.pageSize},pageCount:lo,rowCount:_o,totalRowCount:Dn.length,columnVisibilityModel:Er,orderedFields:Hn.map(e=>e.field),columnWidths:Zr,pinnedColumns:Hr,density:Fr,densityFactor:Pn,rowSelectionModel:{type:"include",ids:Qr},rowGroupingModel:$r,aggregationModel:Ur,expandedDetailPanels:qr,preferencePanel:{open:gn.open,openedPanelValue:gn.openedPanelValue,targetField:gn.targetField},filterCount:Uo,quickFilterValues:qn}),[ur,fr,ao,vr.pageSize,lo,_o,Dn.length,Er,Hn,Zr,Hr,Fr,Pn,Qr,$r,Ur,qr,gn.open,gn.openedPanelValue,gn.targetField,Uo,qn]);sr.current={api:gr,state:Wo,rowsById:zn,rowEntries:Dn,nodesById:no,groupsById:oo,sortedLeaves:ro,pagedRows:so,getRowId:o,setRowOverride:Sn,orderedUserColumns:Hn,visibleUserColumns:$n,getColumn:_n,columnVisibilityModel:Er,setColumnVisibilityModel:Cr,setColumnWidth:(e,t)=>{const r=_n(e);if(!r)return;const n=L(t,r.minWidth??G,r.maxWidth??1/0);en(t=>{const r={...t,[e]:n};return Io(r),r}),Ke?.({colDef:r,width:n},cr())},setColumnIndex:(e,t,r=null)=>{const n=Hn.map(e=>e.field),o=n.indexOf(e);if(-1===o)return;const i=((e,t,r)=>{const n=e.slice(),[o]=n.splice(t,1);return n.splice(r,0,o),n})(n,o,L(t,0,n.length-1));Jr(i),So(i);const l=On.get(e);l&&Be?.({column:l,targetIndex:t,oldIndex:o},r,cr())},columnWidths:Zr,autosizeColumns:Fo,pinColumn:(e,t)=>{if(tt)return;const r=(Hr.left??[]).filter(t=>t!==e),n=(Hr.right??[]).filter(t=>t!==e);"left"===t?r.push(e):n.unshift(e),Vr({left:r,right:n})},unpinColumn:e=>{Vr({left:(Hr.left??[]).filter(t=>t!==e),right:(Hr.right??[]).filter(t=>t!==e)})},isColumnPinned:e=>!tt&&(-1!==(Hr.left??[]).indexOf(e)?"left":-1!==(Hr.right??[]).indexOf(e)&&"right"),pinnedColumns:Hr,setPinnedColumns:Vr,sortModel:ur,setSortModel:pr,sortColumn:ko,filterModel:fr,setFilterModel:wr,upsertFilterItems:e=>{let t=fr.items.slice();e.forEach(e=>{const r=void 0===e.id?{...e,id:`${Date.now()}-${Math.random().toString(36).slice(2,8)}`}:e,n=t.findIndex(e=>void 0!==e.id&&e.id===r.id);-1===n?t.push(r):t[n]=r}),Ie&&t.length>1&&(t=t.slice(-1)),wr({...fr,items:t})},deleteFilterItem:e=>{wr({...fr,items:fr.items.filter(t=>void 0!==e.id?t.id!==e.id:t!==e)})},showPreferences:(e,t,r)=>{pn(null),mn({open:!0,openedPanelValue:e,targetField:r,anchorEl:t??lr.current??nr.current})},hidePreferences:Po,selectedIds:Qr,setSelectedIds:Xr,selectRows:Co,isRowSelectableFn:bo,paginationModel:{page:ao,pageSize:vr.pageSize},setPaginationModel:yr,setDensity:Lr,toggleDetailPanel:zo,expandedDetailPanels:qr,setExpandedDetailPanels:jr,rowGroupingModel:$r,setRowGroupingModel:Br,setRowChildrenExpansion:Go,aggregationModel:Ur,setAggregationModel:_r,startCellEditMode:No,stopCellEditMode:Do,editingCell:nn,setEditValue:an,buildCellParams:Ao,setFocusedCell:sn,scrollToIndexes:Ho,forceUpdate:ar,virtual:po},Xt&&(Xt.current=gr),e.useEffect(()=>{Jt?.(Wo,{api:gr})},[Wo,Jt,gr]);const qo=e.useMemo(()=>({header:l,pagination:ie,pageSizeOptions:ae,hideFooterPagination:me,hideFooterRowCount:ue,hideFooterSelectedRowCount:pe,disableColumnFilter:Se,disableColumnSelector:Je,disableDensitySelector:oe,disableColumnPinning:tt,disableColumnSorting:we,disableMultipleColumnsSorting:xe,disableMultipleColumnsFiltering:Ie,disableRowGrouping:Lt,disableAggregation:Ut,checkboxSelection:ot,aggregationFunctions:Yn,quickFilterDebounceMs:Pe}),[l,ie,ae,me,ue,pe,Se,Je,oe,tt,we,xe,Ie,Lt,Ut,ot,Yn,Pe]),jo=e.useMemo(()=>({api:gr,state:Wo,localeText:dr,themeMode:w,rootProps:qo,columns:Hn,visibleColumns:$n}),[gr,Wo,dr,w,qo,Hn,$n]),Ko=(t,r)=>{const{col:n}=t,o=n.field;if(o===I){if("group"===r.kind&&r.group){const t=r.group.descendants.map(e=>e.id),n=t.reduce((e,t)=>e+(Qr.has(t)?1:0),0);return e.createElement(rr,{checked:t.length>0&&n===t.length,indeterminate:n>0&&n<t.length,label:dr.checkboxSelectionSelectRow,onClick:e=>e.stopPropagation(),onChange:()=>Co(t,n!==t.length,!1)})}if("leaf"!==r.kind)return null;const t=bo(r.id,r.row),n=Qr.has(r.id);return e.createElement(rr,{checked:n,disabled:!t,label:n?dr.checkboxSelectionUnselectRow:dr.checkboxSelectionSelectRow,tabIndex:-1,onClick:e=>e.stopPropagation(),onChange:()=>{En.current=r.id,Co([r.id],!n,at)}})}if(o===F){if("leaf"!==r.kind||!r.row)return null;const t=qr.has(r.id),n=Ct?.(Lo(r.id,r.row));return null==n||!1===n?null:e.createElement(Yt,{size:"small",className:H("mgh-grid-detail-toggle",t&&"mgh-grid-detail-toggle--expanded"),label:t?dr.collapseDetailPanel:dr.expandDetailPanel,"aria-expanded":t,tabIndex:-1,onClick:e=>{e.stopPropagation(),zo(r.id)}},e.createElement(Rt,null))}if(o===S){if("group"===r.kind&&r.group){const t=r.group,n=Zn(t),o=At?.hideDescendantCount;return e.createElement("div",{className:"mgh-grid-group-cell",style:{paddingLeft:20*r.depth}},e.createElement(Yt,{size:"small",className:H("mgh-grid-group-toggle",n&&"mgh-grid-group-toggle--expanded"),label:n?dr.collapseDetailPanel:dr.expandDetailPanel,"aria-expanded":n,tabIndex:-1,onClick:e=>{e.stopPropagation(),Go(t.id,!n)}},e.createElement(Nt,null)),e.createElement("span",{className:"mgh-grid-group-label",title:t.groupingLabel},t.groupingLabel),!o&&e.createElement("span",{className:"mgh-grid-group-count"},"(",t.descendants.length,")"))}return null}if("group"===r.kind||"footer"===r.kind){const t=r.aggregates?.[o];if(!t||T(t.value))return null;const i=Yn[t.fn],l=sr.current.api,a=r.group?.descendants[0]?.row??sr.current.sortedLeaves[0]?.row??{},d=i?.valueFormatter?i.valueFormatter(t.value):n.valueFormatter?n.valueFormatter(t.value,a,n,l):ee(t.value,n);return e.createElement(e.Fragment,null,e.createElement("span",{className:"mgh-grid-aggregation-label"},i?.label??t.fn),e.createElement("span",{className:"mgh-grid-cell-text"},re(d)))}if(!r.row)return null;const i=Ao(r.id,o,r.row,r.node);if("edit"===i.cellMode)return(t=>{const r=t.colDef,n=e=>Do(t.id,t.field,!1,e),o=()=>Do(t.id,t.field,!0,"escapeKeyDown");if(r.renderEditCell)return r.renderEditCell({...t,editValue:ln,onValueChange:an,commit:()=>n("enterKeyDown"),cancel:o});const i={autoFocus:!0,onKeyDown:e=>{"Enter"===e.key?(e.preventDefault(),e.stopPropagation(),n("enterKeyDown")):"Escape"===e.key?(e.preventDefault(),e.stopPropagation(),o()):"Tab"===e.key?n("tabKeyDown"):e.stopPropagation()},onBlur:()=>n("cellFocusOut"),onClick:e=>e.stopPropagation()};switch(r.type){case"boolean":return e.createElement(rr,{...i,checked:Boolean(ln),onChange:e=>an(e.target.checked)});case"singleSelect":{const n=J(r,t.row,t.id);return e.createElement(er,{...i,size:"small",value:null==ln?"":String(ln),onChange:e=>{const t=n.find(t=>String(X(r,t))===e.target.value);an(void 0!==t?X(r,t):e.target.value)}},e.createElement("option",{value:""}),n.map(t=>{const n=X(r,t);return e.createElement("option",{key:String(n),value:String(n)},Y(r,t))}))}case"number":return e.createElement(Zt,{...i,size:"small",type:"number",value:null==ln?"":ln,onChange:e=>an(e.target.value)});case"date":case"dateTime":return e.createElement(Zt,{...i,size:"small",type:"date"===r.type?"date":"datetime-local",value:"string"==typeof ln&&/^\d{4}-\d{2}-\d{2}/.test(ln)?ln:Ar(ln,"dateTime"===r.type),onChange:e=>an(e.target.value)});default:return e.createElement(Zt,{...i,size:"small",type:"text",value:null==ln?"":String(ln),onChange:e=>an(e.target.value)})}})(i);if(n.renderCell)return n.renderCell(i);if("actions"===n.type){const t=n.getActions?n.getActions(Lo(r.id,r.row)):[];return e.createElement(Pr,{actions:t,themeMode:w,moreLabel:dr.actionsCellMore})}if("boolean"===n.type)return T(i.value)?null:i.value?e.createElement(Pt,{"aria-label":dr.booleanCellTrueLabel}):e.createElement(Mt,{"aria-label":dr.booleanCellFalseLabel});const l=i.formattedValue;if(null==l)return null;if(e.isValidElement(l))return l;const a=re(l);return e.createElement("span",{className:"mgh-grid-cell-text",title:a.length>20?a:void 0},a)},Qo=e=>({width:e.width,minWidth:e.width,maxWidth:e.width,left:"left"===e.pinned?e.offset:void 0,right:"right"===e.pinned?e.offset:void 0}),Xo=(e,t)=>H("left"===e.pinned&&`${t}--pinned-left`,"right"===e.pinned&&`${t}--pinned-right`,e.isLastLeft&&Bn.hasPinning&&`${t}--pinned-left-last`,e.isFirstRight&&`${t}--pinned-right-first`),Yo=Boolean(ut||ft||!lt),Jo=(t,r)=>{const n="leaf"===t.kind&&Qr.has(t.id),o="leaf"===t.kind&&t.row&&mt?mt({...Lo(t.id,t.row),indexRelativeToCurrentPage:r.index,isFirstVisible:r.isFirst,isLastVisible:r.isLast,rowNode:t.node}):void 0;return e.createElement("div",{role:"row","aria-rowindex":r.index+2,"aria-selected":"leaf"===t.kind?n:void 0,"data-mgh-row-id":String(t.id),"data-mgh-row-index":r.index,className:H("mgh-grid-row",n&&"mgh-grid-row--selected",Yo&&"leaf"===t.kind&&"mgh-grid-row--clickable","group"===t.kind&&"mgh-grid-row--group","pinnedRow"===t.kind&&"mgh-grid-row--pinned","footer"===t.kind&&"mgh-grid-row--footer",r.isAuto&&"mgh-grid-row--auto-height",o),style:{width:Bn.totalWidth,height:r.isAuto?void 0:r.height,minHeight:r.isAuto?Rn:void 0},onClick:e=>{"leaf"===t.kind&&t.row?(lt||((e,t)=>{if("group"===e.kind&&e.group){const t=e.group.descendants.map(e=>e.id),r=t.every(e=>Qr.has(e));return void Co(t,!r,!1)}if("leaf"!==e.kind)return;const r=e.id;if(!bo(r,e.row))return;const n=!at;if(t.shiftKey&&n&&null!==En.current){const e=so.filter(e=>"leaf"===e.type).map(e=>e.id),n=e.indexOf(En.current),o=e.indexOf(r);if(-1!==n&&-1!==o){const[r,i]=n<o?[n,o]:[o,n];return void Co(e.slice(r,i+1),!0,!ot&&!t.ctrlKey&&!t.metaKey)}}En.current=r;const o=Qr.has(r);ot||t.ctrlKey||t.metaKey?Co([r],!o,!1):o&&1===Qr.size?Co([r],!1,!0):Co([r],!0,!0)})(t,e),ut?.(Lo(t.id,t.row),e,cr())):"group"===t.kind&&t.group&&Go(t.group.id,!Zn(t.group))},onDoubleClick:e=>{"leaf"===t.kind&&t.row&&ft?.(Lo(t.id,t.row),e,cr())}},Bn.columns.map(n=>((t,r)=>{const{col:n}=t,o=n.field,i=Boolean(dn&&dn.id===r.id&&dn.field===o),l=Boolean(nn&&nn.id===r.id&&nn.field===o),a=("group"===r.kind||"footer"===r.kind)&&Boolean(r.aggregates?.[o]),d="leaf"===r.kind&&r.row?Ao(r.id,o,r.row,r.node):null,s=!!d&&Ro(d),c=d&&n.cellClassName?"function"==typeof n.cellClassName?n.cellClassName(d):n.cellClassName:void 0,g=o===I,m=o===F;return e.createElement("div",{key:o,role:"gridcell","data-mgh-field":o,"data-mgh-colindex":Bn.columns.indexOf(t),tabIndex:i?0:-1,"aria-selected":"leaf"===r.kind?Qr.has(r.id):void 0,className:H("mgh-grid-cell",`mgh-grid-cell--align-${n.align??"left"}`,Xo(t,"mgh-grid-cell"),i&&!l&&"mgh-grid-cell--focused",l&&"mgh-grid-cell--editing",s&&!l&&"mgh-grid-cell--editable","boolean"===n.type&&"mgh-grid-cell--boolean","actions"===n.type&&"mgh-grid-cell--actions",g&&"mgh-grid-cell--checkbox",m&&"mgh-grid-cell--detail-toggle",a&&"mgh-grid-cell--aggregation",c),style:Qo(t),onMouseDown:()=>{"leaf"!==r.kind&&"group"!==r.kind||i||sn({id:r.id,field:o})},onClick:e=>{d&&vt&&vt(d,e,cr())},onDoubleClick:e=>{d&&(yt?.(d,e,cr()),s&&!l&&(e.stopPropagation(),No(r.id,o)))}},Ko(t,r))})(n,t,r.isAuto)),e.createElement("div",{className:"mgh-grid-row-filler"}))},Zo=e=>({id:e.id,kind:e.type,row:e.row,node:e.node,depth:e.depth,group:e.group,aggregates:"group"===e.type&&e.group?mo(e.group):void 0}),ei=(t,r)=>{const n=[];if((t??[]).forEach((t,i)=>{const l=_(t,o),a={id:l,kind:"pinnedRow",row:t,node:{type:"pinnedRow",id:l,depth:0,parent:null,position:r},depth:0};n.push(e.createElement(e.Fragment,{key:String(l)},Jo(a,{height:Rn,index:i,isFirst:!1,isLast:!1,isAuto:!1})))}),"bottom"===r&&co){const t={id:P,kind:"footer",row:null,node:{type:"footer",id:P,depth:0,parent:null},depth:0,aggregates:co};n.push(e.createElement(e.Fragment,{key:P},Jo(t,{height:Rn,index:0,isFirst:!1,isLast:!1,isAuto:!1})))}return n},ti=(t,r)=>{const{col:n}=t,o=n.field,i=ur.findIndex(e=>e.field===o&&e.sort),l=-1!==i?ur[i]:void 0,a=!1!==n.sortable&&!we&&!O(o)||o===S&&!1!==n.sortable,d=!Ye&&!n.disableColumnMenu&&!O(o)||o===S&&!Ye,s=!Ze&&!1!==n.resizable&&!O(o)||o===S&&!Ze,c=$o(n),g=bn?.field===o,m=bn&&bn.overField===o&&bn.field!==o,u=un?.field===o,p={field:o,colDef:n,api:gr},h=n.headerClassName?"function"==typeof n.headerClassName?n.headerClassName(p):n.headerClassName:void 0;let f;return f=o===I?at?null:e.createElement(rr,{checked:vo,indeterminate:yo,disabled:0===xo.length,label:vo?dr.checkboxSelectionUnselectAllRows:dr.checkboxSelectionSelectAllRows,onChange:Mo,onClick:e=>e.stopPropagation()}):o===F?null:n.renderHeader?n.renderHeader(p):e.createElement("span",{className:"mgh-grid-header-title"},n.headerName??o),e.createElement("div",{key:o,role:"columnheader","aria-colindex":r+1,"aria-sort":l?"asc"===l.sort?"ascending":"descending":a?"none":void 0,"data-mgh-field":o,title:n.description,tabIndex:-1,draggable:c,className:H("mgh-grid-header-cell",`mgh-grid-header-cell--align-${n.headerAlign??"left"}`,Xo(t,"mgh-grid-header-cell"),a&&"mgh-grid-header-cell--sortable",o===I&&"mgh-grid-header-cell--checkbox",o===F&&"mgh-grid-header-cell--detail-toggle",r===Bn.columns.length-1&&"mgh-grid-header-cell--last",g&&"mgh-grid-header-cell--dragging",m&&"left"===bn?.side&&"mgh-grid-header-cell--drop-left",m&&"right"===bn?.side&&"mgh-grid-header-cell--drop-right",u&&"mgh-grid-header-cell--menu-open",h),style:Qo(t),onClick:e=>{a&&!hn&&ko(o,void 0,e.shiftKey)},onDragStart:e=>{if(c){e.dataTransfer.effectAllowed="move";try{e.dataTransfer.setData("text/plain",o)}catch{}xn({field:o,overField:null,side:"left"})}},onDragOver:e=>{if(!bn||bn.field===o)return;const r=Bn.columns.find(e=>e.col.field===bn.field);if(!r||r.pinned!==t.pinned||!$o(n))return;e.preventDefault(),e.dataTransfer.dropEffect="move";const i=e.currentTarget.getBoundingClientRect(),l=e.clientX<i.left+i.width/2?"left":"right";bn.overField===o&&bn.side===l||xn({...bn,overField:o,side:l})},onDragLeave:()=>{bn&&bn.overField===o&&xn({...bn,overField:null})},onDrop:e=>((e,t)=>{t.preventDefault();const r=bn;if(xn(null),!r||r.field===e.col.field)return;const n=Bn.columns.find(e=>e.col.field===r.field);if(!n||n.pinned!==e.pinned||!$o(e.col))return;const o=r.side;if(n.pinned){const t=n.pinned,i=(Hr[t]??[]).slice(),l=i.indexOf(r.field);let a=i.indexOf(e.col.field);if(-1===l||-1===a)return;return i.splice(l,1),a=i.indexOf(e.col.field),i.splice("right"===o?a+1:a,0,r.field),void Vr({...Hr,[t]:i})}const i=Hn.map(e=>e.field),l=i.indexOf(r.field),a=i.filter(e=>e!==r.field);let d=a.indexOf(e.col.field);"right"===o&&(d+=1),a.splice(d,0,r.field),Jr(a),So(a);const s=On.get(r.field);s&&Be?.({column:s,targetIndex:d,oldIndex:l},t,cr())})(t,e),onDragEnd:()=>xn(null)},e.createElement("div",{className:"mgh-grid-header-title-container"},f,a&&e.createElement("span",{className:H("mgh-grid-sort-icon",l&&"mgh-grid-sort-icon--active"),"aria-hidden":"true"},"desc"===l?.sort?e.createElement(It,{size:18}):e.createElement(St,{size:18}),l&&ur.filter(e=>e.sort).length>1&&e.createElement("span",{className:"mgh-grid-sort-index"},i+1))),d&&e.createElement(Yt,{size:"small",className:H("mgh-grid-header-menu-btn",u&&"mgh-grid-header-menu-btn--open"),label:dr.columnMenuLabel,"aria-haspopup":"menu","aria-expanded":u,tabIndex:-1,onClick:e=>{e.stopPropagation(),pn(t=>t?.field===o?null:{field:o,anchorEl:e.currentTarget})},onMouseDown:e=>e.stopPropagation()},e.createElement(Ft,null)),s&&e.createElement("div",{className:H("mgh-grid-resize-handle",hn===o&&"mgh-grid-resize-handle--active"),role:"separator","aria-orientation":"vertical",onPointerDown:e=>((e,t)=>{t.preventDefault(),t.stopPropagation(),Bo.current={field:e.col.field,startX:t.clientX,startWidth:e.width,lastWidth:e.width,min:e.col.minWidth??G,max:e.col.maxWidth??1/0},fn(e.col.field);const r=e=>{const t=Bo.current;if(!t)return;const r=L(t.startWidth+(e.clientX-t.startX),t.min,t.max);t.lastWidth=r,en(e=>e[t.field]===r?e:{...e,[t.field]:r})},n=()=>{window.removeEventListener("pointermove",r),window.removeEventListener("pointerup",n);const e=Bo.current;if(Bo.current=null,fn(null),!e)return;const t={...sr.current.columnWidths,[e.field]:e.lastWidth};en(t),Io(t);const o=sr.current.getColumn(e.field);o&&e.lastWidth!==e.startWidth&&Ke?.({colDef:o,width:e.lastWidth},cr())};window.addEventListener("pointermove",r),window.addEventListener("pointerup",n)})(t,e),onClick:e=>e.stopPropagation(),onDoubleClick:e=>{e.stopPropagation(),Fo({columns:[o]})},draggable:!1,onDragStart:e=>{e.preventDefault(),e.stopPropagation()}}))},ri=null===C.toolbar?null:C.toolbar??hr,ni=null===C.footer?null:C.footer??br,oi=C.noRowsOverlay??Sr,ii=C.loadingOverlay??Ir,li={...E,...M.toolbar},ai={text:k,...M.noRowsOverlay},di={...M.loadingOverlay},si=!i&&0===so.length,ci=un?_n(un.field):void 0,gi={height:"auto",flexGrow:1,...Tr(p),...Tr(u),...v},mi={flexGrow:1,...Tr(f),...Tr(h)},ui={...Tr(x),...Tr(b),"--mgh-grid-header-height":`${Nn}px`,"--mgh-grid-row-height":`${Rn}px`},pi=e.useMemo(()=>{const e=[];return Fe(`[data-mgh-grid-id="${tr}"]`,x,e),Fe(`[data-mgh-grid-id="${tr}"]`,b,e),Fe(`[data-mgh-grid-card="${tr}"]`,p,e),Fe(`[data-mgh-grid-card="${tr}"]`,u,e),Fe(`[data-mgh-grid-box="${tr}"]`,f,e),Fe(`[data-mgh-grid-box="${tr}"]`,h,e),e.join("\n")},[tr,x,b,p,u,f,h]),hi=In>0&&In<600,fi=e.createElement("div",{ref:nr,id:tr,"data-mgh-grid-id":tr,role:"grid","aria-rowcount":_o+1,"aria-colcount":Bn.columns.length,"aria-multiselectable":!(!ot||at)||void 0,"aria-busy":i||void 0,className:H("mgh-grid",j&&"mgh-grid--auto-height",!Bn.hasPinning&&"mgh-grid--no-pinned-shadow",c),style:ui,onKeyDown:e=>{if(nn)return;const t=e.target;if(t&&("INPUT"===t.tagName||"SELECT"===t.tagName||"TEXTAREA"===t.tagName||"BUTTON"===t.tagName))return;const r=Math.max(1,Math.floor(Math.max(Fn-Nn,Rn)/Rn));switch(e.key){case"ArrowDown":e.preventDefault(),Vo(1,0);break;case"ArrowUp":e.preventDefault(),Vo(-1,0);break;case"ArrowLeft":e.preventDefault(),Vo(0,-1);break;case"ArrowRight":e.preventDefault(),Vo(0,1);break;case"PageDown":e.preventDefault(),Vo(r,0);break;case"PageUp":e.preventDefault(),Vo(-r,0);break;case"Home":e.preventDefault(),Vo(0,0,e.ctrlKey||e.metaKey?{row:"first",col:"first"}:{col:"first"});break;case"End":e.preventDefault(),Vo(0,0,e.ctrlKey||e.metaKey?{row:"last",col:"last"}:{col:"last"});break;case"Enter":case"F2":if(dn){const t=no.get(dn.id);if("group"===t?.type&&dn.field===S){const e=oo.get(dn.id);e&&Go(e.id,!Zn(e))}else e.preventDefault(),No(dn.id,dn.field)}break;case" ":if(dn&&(ot||!lt)){const t=so.find(e=>e.id===dn.id);t&&"leaf"===t.type&&t.row&&(e.preventDefault(),Co([t.id],!Qr.has(t.id),!1))}break;case"Escape":gn.open&&Po(),un&&pn(null);break;default:(e.ctrlKey||e.metaKey)&&"a"===e.key.toLowerCase()&&ot&&!at&&(e.preventDefault(),Co(xo,!0))}}},y&&ri&&e.createElement("div",{ref:lr},e.createElement(ri,{...li})),e.createElement("div",{className:"mgh-grid-main"},e.createElement("div",{ref:ir,className:"mgh-grid-scroller",onScroll:fo,tabIndex:-1},e.createElement("div",{className:"mgh-grid-columns",role:"rowgroup",style:{width:Bn.totalWidth}},e.createElement("div",{className:"mgh-grid-header-row",role:"row","aria-rowindex":1,style:{height:Nn}},Bn.columns.map((e,t)=>ti(e,t)),e.createElement("div",{className:"mgh-grid-header-filler"}))),Et?.top&&Et.top.length>0&&e.createElement("div",{className:"mgh-grid-pinned-rows mgh-grid-pinned-rows--top",role:"rowgroup",style:{top:Nn,width:Bn.totalWidth}},ei(Et.top,"top")),e.createElement("div",{className:H("mgh-grid-body",po?"mgh-grid-body--virtual":"mgh-grid-body--flow"),role:"rowgroup",style:po?{height:uo.total,width:Bn.totalWidth}:{width:Bn.totalWidth,minHeight:si||i?120:void 0}},(()=>{const{start:t,end:r}=ho,n=[];for(let o=t;o<r;o+=1){const t=so[o],r=Zo(t),i=uo.detailHeights[o],l="leaf"===t.type&&Boolean(t.row)&&Boolean(Ct)&&qr.has(t.id),a=l&&t.row?Ct?.(Lo(t.id,t.row)):null,d=!!(l&&t.row&&kt)&&"auto"===kt({id:t.id,row:t.row}),s=!(po||!$||"leaf"!==t.type||!t.row||"auto"!==$({id:t.id,model:t.row,densityFactor:Pn}));n.push(e.createElement("div",{key:String(t.id),className:"mgh-grid-row-block",style:po?{top:uo.offsets[o],width:Bn.totalWidth}:{width:Bn.totalWidth}},Jo(r,{height:uo.rowHeights[o],index:o,isFirst:0===o,isLast:o===so.length-1,isAuto:s}),l&&null!=a&&!1!==a&&e.createElement("div",{className:"mgh-grid-detail-panel",style:{height:d?void 0:i||void 0,width:In||void 0},onClick:e=>e.stopPropagation()},a)))}return n})()),(Et?.bottom&&Et.bottom.length>0||co)&&e.createElement("div",{className:"mgh-grid-pinned-rows mgh-grid-pinned-rows--bottom",role:"rowgroup",style:{width:Bn.totalWidth}},ei(Et?.bottom,"bottom"))),i&&e.createElement("div",{className:"mgh-grid-overlay mgh-grid-overlay--loading",style:{top:Nn}},e.createElement(ii,{...di})),si&&e.createElement("div",{className:"mgh-grid-overlay",style:{top:Nn}},e.createElement(oi,{...ai}))),!ge&&ni&&e.createElement(ni,{...M.footer}),e.createElement(or,{open:gn.open,anchorEl:gn.anchorEl,onClose:Po,themeMode:w,placement:"bottom-start",autoFocus:!0},"columns"===gn.openedPanelValue?e.createElement(xr,null):e.createElement(Mr,null)),ci&&un&&e.createElement(kr,{column:ci,anchorEl:un.anchorEl,open:!0,onClose:()=>pn(null),themeMode:w,panelAnchorEl:lr.current}));return e.createElement(Ve.Provider,{value:jo},e.createElement("div",{className:H("mgh-grid-card",s&&"mgh-grid-card--plain",g),"data-mgh-theme":w,"data-mgh-grid-card":tr,style:gi},pi&&e.createElement("style",{"data-mgh-grid-sx":tr},pi),!s&&(void 0!==l||d||a)&&e.createElement("div",{className:"mgh-grid-card-header"},void 0!==l&&e.createElement("h3",{className:"mgh-grid-card-title"},l),d&&e.createElement("div",{className:"mgh-grid-card-header-center"},d),e.createElement("div",{className:"mgh-grid-card-header-end",style:{gap:hi?8:16}},a)),e.createElement("div",{className:H("mgh-grid-box",m),"data-mgh-grid-box":tr,style:mi},fi)))}Lr.displayName="MGHGrid",exports.ConfirmDialog=function({title:t,content:r,action:n,open:o,onClose:i,...g}){return e.createElement(a,{fullWidth:!0,maxWidth:"xs",open:o,onClose:i,...g},e.createElement(d,{sx:{pb:2}},t),r&&e.createElement(c,{sx:{typography:"body2"}}," ",r," "),e.createElement(s,null,e.createElement(l,{onClick:i},"Cancel"),n))},exports.CustomGridToolbarExport=function({csvOptions:t={allColumns:!0},excelOptions:n={allColumns:!0},printOptions:o,customMenuItem:i,...l}){return e.createElement(r.GridToolbarExportContainer,{...l},i,e.createElement(r.GridCsvExportMenuItem,{options:t}),e.createElement(r.GridExcelExportMenuItem,{options:n}),e.createElement(r.GridPrintExportMenuItem,{options:o}))},exports.CustomNoRowsOverlay=f,exports.DataGridQuickFilter=E,exports.ExportingDialog=function({open:r,text:n=e.createElement(e.Fragment,null,"Your export is currently being built. Some larger exports can take a couple of minutes to complete. ",e.createElement("br",null),e.createElement("br",null),"Please do not close your browser or refresh the page.")}){return e.createElement(t.Dialog,{open:r,fullWidth:!0,sx:{p:4}},e.createElement(t.DialogContent,{sx:{p:4,textAlign:"center"}},e.createElement(t.Typography,{variant:"subtitle1",sx:{mb:3}},n),e.createElement(t.CircularProgress,null)))},exports.GRID_CHECKBOX_SELECTION_COL_DEF=Ce,exports.GRID_CHECKBOX_SELECTION_FIELD=I,exports.GRID_DETAIL_PANEL_TOGGLE_COL_DEF=Me,exports.GRID_DETAIL_PANEL_TOGGLE_FIELD=F,exports.GRID_ROW_GROUPING_SINGLE_GROUPING_FIELD=S,exports.Iconify=C,exports.Label=k,exports.MGHDataGrid=function({header:n,rows:o,columns:i,onRowClick:l,onRowDoubleClick:a,pagination:d=!0,pageSize:s=25,slots:c={},slotProps:g={},toolbarProps:m={},initialState:u={},pageSizeOptions:p=[10,25,50,100],sx:b={},cardSx:y={flexGrow:1},boxSx:E={flexGrow:1},columnVisibilityModel:C,onColumnVisibilityModelChange:M,columnVisibilityStorageKey:k,columnOrderStorageKey:S,disableDensitySelector:I=!1,disableRowSelectionOnClick:F=!0,disableColumnFilter:P=!1,disableColumnMenu:R=!1,disableColumnSelector:N=!1,checkboxSelectionVisibleOnly:D=!1,renderHeaderEndContent:z,renderHeaderCenterContent:G,noRowsText:O="No data found within selected parameters.",checkboxSelection:T=!1,onRowSelectionModelChange:A,rowSelectionModel:L,getRowClassName:H,getDetailPanelContent:V,getDetailPanelHeight:$,loading:B=!1,isRowSelectable:U,getRowHeight:_,showToolbar:W=!0,hideFooterRowCount:q=!1,onColumnOrderChange:j,defaultGroupingExpansionDepth:K,pinnedRows:Q,keepNonExistentRowsSelected:X=!0}){const Y=h("down","sm"),J=e.useMemo(()=>{if(k)return x(k)??void 0},[k]),Z=e.useMemo(()=>{if(!S)return;return((e,t)=>{if(!e||0===e.length)return;const r=new Set(t.map(e=>e.field));return e.filter(e=>r.has(e))})(x(S),i)},[S,i]),ee=void 0!==C?C:J,te=e.useCallback((e,t)=>{k&&w(k,e),M?.(e,t)},[k,M]),re=e.useCallback((e,t,r)=>{if(S){const e=r.api.getAllColumns().map(e=>e.field);w(S,e)}j?.(e,t,r)},[S,j]),ne={density:"compact",pagination:{paginationModel:{pageSize:s}},filter:{filterModel:{items:[],quickFilterExcludeHiddenColumns:!1}},...u,columns:{...u?.columns,columnVisibilityModel:ee??u?.columns?.columnVisibilityModel,orderedFields:Z??u?.columns?.orderedFields}};return e.createElement(t.Card,{sx:{height:"auto",...y}},e.createElement(t.Box,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",pr:1}},e.createElement(t.CardHeader,{title:n,sx:{mb:2}}),G,e.createElement(t.Box,{sx:{display:"flex",gap:Y?1:2,alignItems:"center",flexWrap:"wrap",justifyContent:"flex-end"}},z)),e.createElement(t.Box,{component:"div",sx:{display:"flex",flexDirection:"column",flexGrow:1,...E}},e.createElement(r.DataGridPremium,{loading:B,onRowClick:l,onRowDoubleClick:a,rows:o,columns:i,pagination:d,disableDensitySelector:I,disableRowSelectionOnClick:F,disableColumnFilter:P,disableColumnMenu:R,disableColumnSelector:N,slots:{noRowsOverlay:f,toolbar:v,...c},slotProps:{noRowsOverlay:{text:O},toolbar:m,...g},initialState:ne,pageSizeOptions:p,sx:{"& .MuiDataGrid-row:hover":{cursor:l||a?"pointer":"default"},...b},onColumnVisibilityModelChange:te,checkboxSelection:T,onRowSelectionModelChange:A,rowSelectionModel:L,isRowSelectable:U,getRowClassName:H,getDetailPanelContent:V,getDetailPanelHeight:$,checkboxSelectionVisibleOnly:D,disableRowSelectionExcludeModel:!0,showToolbar:W,hideFooterRowCount:q,getRowHeight:_,onColumnOrderChange:re,defaultGroupingExpansionDepth:K,pinnedRows:Q,keepNonExistentRowsSelected:X})))},exports.MGHGrid=Lr,exports.MGHGridActionsCellItem=Fr,exports.MGHGridButton=Xt,exports.MGHGridCheckbox=rr,exports.MGHGridColumnMenu=kr,exports.MGHGridColumnsButton=sr,exports.MGHGridColumnsPanel=xr,exports.MGHGridContext=Ve,exports.MGHGridDefaultToolbar=hr,exports.MGHGridDensitySelector=gr,exports.MGHGridExportMenu=ur,exports.MGHGridExportMenuItem=mr,exports.MGHGridFilterPanel=Mr,exports.MGHGridFiltersButton=cr,exports.MGHGridFooter=br,exports.MGHGridIconButton=Yt,exports.MGHGridIcons=Qt,exports.MGHGridLoadingOverlay=Ir,exports.MGHGridMenu=ir,exports.MGHGridMenuDivider=ar,exports.MGHGridMenuItem=lr,exports.MGHGridNoRowsOverlay=Sr,exports.MGHGridPagination=fr,exports.MGHGridPopover=or,exports.MGHGridQuickFilter=pr,exports.MGHGridSelect=er,exports.MGHGridTextInput=Zt,exports.MGHGridToolbar=v,exports.MGH_GRID_AGGREGATION_FUNCTIONS=Re,exports.MGH_GRID_CHECKBOX_FIELD=I,exports.MGH_GRID_CHECKBOX_SELECTION_COL_DEF=Ce,exports.MGH_GRID_CSS=Te,exports.MGH_GRID_DEFAULT_LOCALE_TEXT=Ne,exports.MGH_GRID_DETAIL_PANEL_TOGGLE_COL_DEF=Me,exports.MGH_GRID_DETAIL_PANEL_TOGGLE_FIELD=F,exports.MGH_GRID_GROUPING_COLUMN_FIELD=S,exports.MGH_GRID_STYLE_ID=Oe,exports.mghGridBooleanFilterOperators=xe,exports.mghGridBuildScopedCss=Fe,exports.mghGridBuildXlsx=pt,exports.mghGridGetDataAsCsv=Qe,exports.mghGridGetDateFilterOperators=be,exports.mghGridNumberFilterOperators=he,exports.mghGridSingleSelectFilterOperators=we,exports.mghGridStringFilterOperators=ue,exports.useMGHGridApiContext=()=>$e().api,exports.useMGHGridApiRef=()=>e.useRef(null),exports.useMGHGridContext=$e,exports.useMGHGridLocaleText=()=>$e().localeText,exports.useMGHGridStyles=He,exports.useResponsive=h;
1
+ "use strict";var e=require("react"),t=require("@mui/material"),r=require("@mui/x-data-grid-premium"),n=require("@mui/material/useMediaQuery"),o=require("@mui/material/styles"),a=require("@emotion/styled"),i=require("@mui/material/Button"),l=require("@mui/material/Dialog"),d=require("@mui/material/DialogTitle"),s=require("@mui/material/DialogActions"),c=require("@mui/material/DialogContent"),g=require("@iconify/react"),m=require("@mui/material/Box"),p=require("dayjs"),u=require("react-dom"),h=require("dayjs/plugin/customParseFormat");function f(e,t,r){const a=o.useTheme(),i=n(a.breakpoints.up(t)),l=n(a.breakpoints.down(t)),d=n(a.breakpoints.between(t,r)),s=n(a.breakpoints.only(t));return"up"===e?i:"down"===e?l:"between"===e?d:s}function b({text:r,useSettingsContext:n}){const i=o.useTheme(),l=n?.()?.themeMode??i.palette.mode??"light",d=a("div")(()=>({display:"flex",alignItems:"center",justifyContent:"center",height:"100%","& .ant-empty-img-1":{fill:"light"===l?"#aeb8c2":"#262626"},"& .ant-empty-img-2":{fill:"light"===l?"#f5f5f7":"#595959"},"& .ant-empty-img-3":{fill:"light"===l?"#dce0e6":"#434343"},"& .ant-empty-img-4":{fill:"light"===l?"#fff":"#1c1c1c"},"& .ant-empty-img-5":{fillOpacity:"light"===l?"0.8":"0.08",fill:"light"===l?"#f5f5f5":"#fff"}}));return e.createElement(d,null,e.createElement(t.Box,{component:"img",alt:"empty content",src:"/assets/icons/empty/ic_content.svg",sx:{width:50,maxWidth:160}}),e.createElement(t.Box,{sx:{mb:0}},r))}const x=()=>"undefined"!=typeof window&&void 0!==window.localStorage,y=e=>{if(!x())return null;try{const t=window.localStorage.getItem(e);return t?JSON.parse(t):null}catch{return null}},v=(e,t)=>{if(x())try{window.localStorage.setItem(e,JSON.stringify(t))}catch{return}};function w({showColumnsButton:n=!0,showFilterButton:o=!0,showExportButton:a=!0,showQuickFilter:i=!0,renderOtherButtons:l,renderDateRange:d,customMenuItem:s,showCsvOption:c=!0}){return e.createElement(r.Toolbar,{style:{display:"flex",justifyContent:"space-between"}},e.createElement("div",null,n&&e.createElement(t.Tooltip,{title:"Columns"},e.createElement(r.ColumnsPanelTrigger,{render:e.createElement(r.ToolbarButton,null)},e.createElement(r.GridViewColumnIcon,{fontSize:"small"}))),o&&e.createElement(t.Tooltip,{title:"Filters"},e.createElement(r.FilterPanelTrigger,{render:(n,o)=>e.createElement(r.ToolbarButton,{...n,color:"default"},e.createElement(t.Badge,{badgeContent:o.filterCount,color:"primary",variant:"dot"},e.createElement(r.GridFilterListIcon,{fontSize:"small"})))})),a&&e.createElement(E,{customMenuItem:s,showCsvOption:c})),d,e.createElement("div",null,l,i&&e.createElement(C,null)))}const E=({csvOptions:t={allColumns:!0},excelOptions:n={allColumns:!0},printOptions:o,customMenuItem:a,showCsvOption:i=!0,...l})=>e.createElement(r.GridToolbarExportContainer,{...l},a?.map(e=>e),i&&e.createElement(r.GridCsvExportMenuItem,{options:t}),e.createElement(r.GridExcelExportMenuItem,{options:n}),e.createElement(r.GridPrintExportMenuItem,{options:o}));function C(){const n=t.styled(r.QuickFilter)({display:"grid",alignItems:"center"}),o=t.styled(r.ToolbarButton)(({theme:e,ownerState:t})=>({gridArea:"1 / 1",width:"min-content",height:"min-content",zIndex:1,opacity:t.expanded?0:1,pointerEvents:t.expanded?"none":"auto",transition:e.transitions.create(["opacity"])})),a=t.styled(t.TextField)(({theme:e,ownerState:t})=>({gridArea:"1 / 1",overflowX:"clip",width:t.expanded?260:"var(--trigger-width)",opacity:t.expanded?1:0,transition:e.transitions.create(["width","opacity"])}));return e.createElement(n,null,e.createElement(r.QuickFilterTrigger,{render:(n,a)=>e.createElement(t.Tooltip,{title:"Search",enterDelay:0},e.createElement(o,{...n,ownerState:{expanded:a.expanded},color:"default","aria-disabled":a.expanded},e.createElement(r.GridSearchIcon,{fontSize:"small"})))}),e.createElement(r.QuickFilterControl,{render:({ref:n,...o},i)=>e.createElement(a,{...o,ownerState:{expanded:i.expanded},inputRef:n,"aria-label":"Search",placeholder:"Search...",size:"small",slotProps:{input:{startAdornment:e.createElement(t.InputAdornment,{position:"start"},e.createElement(r.GridSearchIcon,{fontSize:"small"})),endAdornment:i.value?e.createElement(t.InputAdornment,{position:"end"},e.createElement(r.QuickFilterClear,{edge:"end",size:"small","aria-label":"Clear search",material:{sx:{marginRight:-.75}}},e.createElement(r.GridCloseIcon,{fontSize:"small"}))):null,...o.slotProps?.input},...o.slotProps}})}))}const k=e.forwardRef(({icon:t,width:r=20,sx:n,...o},a)=>e.createElement(g.Icon,{icon:t,style:{width:20,height:r??20,...n}})),M=o.styled(m)(({ownerState:e})=>{const t=o.useTheme(),r="light"===t.palette.mode,n="filled"===e.variant,a="outlined"===e.variant,i="soft"===e.variant,l={..."default"===e.color&&{...n&&{color:r?t.palette.common.white:t.palette.grey[800],backgroundColor:t.palette.text.primary},...a&&{backgroundColor:"transparent",color:t.palette.text.primary,border:`2px solid ${t.palette.text.primary}`},...i&&{color:t.palette.text.secondary,backgroundColor:o.alpha(t.palette.grey[500],.16)}}},d={..."default"!==e.color&&{...n&&{color:t.palette[e.color].contrastText,backgroundColor:t.palette[e.color].main},...a&&{backgroundColor:"transparent",color:t.palette[e.color].main,border:`2px solid ${t.palette[e.color].main}`},...i&&{color:t.palette[e.color][r?"dark":"light"],backgroundColor:o.alpha(t.palette[e.color].main,.16)}}};return{height:24,minWidth:24,lineHeight:0,borderRadius:6,cursor:"default",alignItems:"center",whiteSpace:"nowrap",display:"inline-flex",justifyContent:"center",textTransform:"capitalize",padding:t.spacing(0,.75),fontSize:t.typography.pxToRem(12),fontWeight:t.typography.fontWeightBold,transition:t.transitions.create("all",{duration:t.transitions.duration.shorter}),...l,...d}}),S=e.forwardRef(({children:t,color:r="default",variant:n="soft",startIcon:o,endIcon:a,sx:i,...l},d)=>{const s={width:16,height:16,"& svg, img":{width:1,height:1,objectFit:"cover"}};return e.createElement(M,{ref:d,ownerState:{color:r,variant:n},sx:{...o&&{pl:.75},...a&&{pr:.75},...i},...l},o&&e.createElement(m,{sx:{mr:.75,...s}}," ",o," "),t,a&&e.createElement(m,{sx:{ml:.75,...s}}," ",a," "))}),D="__row_group_by_columns_group__",I="__check__",F="__detail_panel_toggle__",P="__aggregation_footer__",N=new Set([I,F]),R={compact:.7,standard:1,comfortable:1.3},z=52,O=56,G=50,T=e=>N.has(e)||e===D,A=e=>null==e,L=e=>A(e)||""===e||Array.isArray(e)&&0===e.length,H=(e,t,r)=>Math.min(Math.max(e,t),r),V=(...e)=>e.filter(Boolean).join(" "),$=(()=>{let e=0;return(t="mgh")=>(e+=1,`${t}-${e}`)})(),B=()=>"undefined"!=typeof window&&void 0!==window.localStorage,_=e=>{if(!B())return null;try{const t=window.localStorage.getItem(e);return t?JSON.parse(t):null}catch{return null}},U=(e,t)=>{if(B())try{window.localStorage.setItem(e,JSON.stringify(t))}catch{}},W=(e,t)=>t?t(e):e.id,q=(e,t)=>{if(!e)return{type:"include",ids:new Set};if(Array.isArray(e))return{type:"include",ids:new Set(e)};if(e instanceof Set)return{type:"include",ids:new Set(e)};if("exclude"===e.type&&t){const r=new Set;return t.forEach(t=>{e.ids.has(t)||r.add(t)}),{type:"include",ids:r}}return{type:"include",ids:new Set(e.ids)}},j=e=>{if(A(e)||""===e)return null;if(e instanceof Date)return Number.isNaN(e.getTime())?null:e;if(p.isDayjs(e))return e.isValid()?e.toDate():null;if("number"==typeof e){const t=new Date(e);return Number.isNaN(t.getTime())?null:t}if("string"==typeof e){const t=p(e);return t.isValid()?t.toDate():null}return null},Y=(e,t)=>{const r=j(e);return r?p(r).format(t?"M/D/YYYY h:mm A":"M/D/YYYY"):""},K=(e,t)=>t?p(e).startOf("minute").valueOf():p(e).startOf("day").valueOf(),X=e=>"object"==typeof e&&null!==e,Q=(e,t)=>e.getOptionValue?e.getOptionValue(t):X(t)?t.value:t,J=(e,t)=>e.getOptionLabel?e.getOptionLabel(t):X(t)?t.label:String(t),Z=(e,t,r)=>e.valueOptions?"function"==typeof e.valueOptions?e.valueOptions({field:e.field,row:t,id:r}):e.valueOptions:[],ee=(e,t,r)=>{const n=e?e[t.field]:void 0;return t.valueGetter?t.valueGetter(n,e,t,r):n},te=(e,t,r,n)=>{if(A(e))return"";switch(t.type){case"date":return Y(e,!1);case"dateTime":return Y(e,!0);case"boolean":return e?"Yes":"No";case"singleSelect":{const o=Z(t,r,n).find(r=>Q(t,r)===e);return void 0!==o?J(t,o):String(e)}case"number":return"number"==typeof e?Number.isFinite(e)?String(e):"":String(e);default:if(e instanceof Date)return Y(e,!0);if("object"==typeof e)try{return JSON.stringify(e)}catch{return String(e)}return String(e)}},re=(e,t,r,n,o)=>r.valueFormatter?r.valueFormatter(e,t,r,n):te(e,r,t,o),ne=e=>A(e)?"":"string"==typeof e?e:"number"==typeof e||"boolean"==typeof e?String(e):e instanceof Date?Y(e,!0):"object"==typeof e&&"props"in e?"":String(e),oe="undefined"!=typeof Intl?new Intl.Collator(void 0,{numeric:!0,sensitivity:"base"}):null,ae=(e,t)=>{const r=A(e)||""===e,n=A(t)||""===t;return r&&n?0:r?-1:n?1:null},ie=(e,t)=>{const r=ae(e,t);return null!==r?r:Number(e)-Number(t)},le=(e,t)=>{const r=ae(e,t);if(null!==r)return r;const n=String(e),o=String(t);return oe?oe.compare(n,o):n<o?-1:n>o?1:0},de=(e,t,r,n)=>"number"==typeof e&&"number"==typeof t?ie(e,t):le(e,t),se=(e,t)=>{const r=j(e),n=j(t),o=ae(r,n);return null!==o?o:r.getTime()-n.getTime()},ce=(e,t)=>{const r=ae(e,t);return null!==r?r:Number(Boolean(e))-Number(Boolean(t))},ge=e=>{switch(e){case"number":return ie;case"date":case"dateTime":return se;case"boolean":return ce;default:return de}},me=e=>A(e)?"":String(e).toLowerCase(),pe=e=>!L(e.value),ue=[{value:"contains",label:"contains",inputType:"text",getApplyFilterFn:e=>{if(!pe(e))return null;const t=me(e.value);return e=>-1!==me(e).indexOf(t)}},{value:"doesNotContain",label:"does not contain",inputType:"text",getApplyFilterFn:e=>{if(!pe(e))return null;const t=me(e.value);return e=>-1===me(e).indexOf(t)}},{value:"equals",label:"equals",inputType:"text",getApplyFilterFn:e=>{if(!pe(e))return null;const t=me(e.value);return e=>me(e)===t}},{value:"doesNotEqual",label:"does not equal",inputType:"text",getApplyFilterFn:e=>{if(!pe(e))return null;const t=me(e.value);return e=>me(e)!==t}},{value:"startsWith",label:"starts with",inputType:"text",getApplyFilterFn:e=>{if(!pe(e))return null;const t=me(e.value);return e=>0===me(e).indexOf(t)}},{value:"endsWith",label:"ends with",inputType:"text",getApplyFilterFn:e=>{if(!pe(e))return null;const t=me(e.value);return e=>{const r=me(e);return r.length>=t.length&&r.lastIndexOf(t)===r.length-t.length}}},{value:"isEmpty",label:"is empty",inputType:"none",requiresFilterValue:!1,getApplyFilterFn:()=>e=>L(e)},{value:"isNotEmpty",label:"is not empty",inputType:"none",requiresFilterValue:!1,getApplyFilterFn:()=>e=>!L(e)},{value:"isAnyOf",label:"is any of",inputType:"multiselect",getApplyFilterFn:e=>{if(!Array.isArray(e.value)||0===e.value.length)return null;const t=new Set(e.value.map(me));return e=>t.has(me(e))}}],he=(e,t,r)=>({value:e,label:t,inputType:"number",getApplyFilterFn:e=>{if(!pe(e))return null;const t=Number(e.value);return Number.isNaN(t)?null:e=>{if(A(e)||""===e)return!1;const n=Number(e);return!Number.isNaN(n)&&r(n,t)}}}),fe=[he("=","=",(e,t)=>e===t),he("!=","!=",(e,t)=>e!==t),he(">",">",(e,t)=>e>t),he(">=",">=",(e,t)=>e>=t),he("<","<",(e,t)=>e<t),he("<=","<=",(e,t)=>e<=t),{value:"isEmpty",label:"is empty",inputType:"none",requiresFilterValue:!1,getApplyFilterFn:()=>e=>L(e)},{value:"isNotEmpty",label:"is not empty",inputType:"none",requiresFilterValue:!1,getApplyFilterFn:()=>e=>!L(e)},{value:"isAnyOf",label:"is any of",inputType:"multiselect",getApplyFilterFn:e=>{if(!Array.isArray(e.value)||0===e.value.length)return null;const t=new Set(e.value.map(e=>Number(e)));return e=>!A(e)&&t.has(Number(e))}}],be=(e,t,r,n)=>({value:e,label:t,inputType:r?"datetime-local":"date",getApplyFilterFn:e=>{if(!pe(e))return null;const t=j(e.value);if(!t)return null;const o=K(t,r);return e=>{const t=j(e);return!!t&&n(K(t,r),o)}}}),xe=e=>[be("is","is",e,(e,t)=>e===t),be("not","is not",e,(e,t)=>e!==t),be("after","is after",e,(e,t)=>e>t),be("onOrAfter","is on or after",e,(e,t)=>e>=t),be("before","is before",e,(e,t)=>e<t),be("onOrBefore","is on or before",e,(e,t)=>e<=t),{value:"isEmpty",label:"is empty",inputType:"none",requiresFilterValue:!1,getApplyFilterFn:()=>e=>null===j(e)},{value:"isNotEmpty",label:"is not empty",inputType:"none",requiresFilterValue:!1,getApplyFilterFn:()=>e=>null!==j(e)}],ye=[{value:"is",label:"is",inputType:"boolean",getApplyFilterFn:e=>{if(A(e.value)||""===e.value||"any"===e.value)return null;const t=!0===e.value||"true"===e.value;return e=>Boolean(e)===t}}],ve=[{value:"is",label:"is",inputType:"select",getApplyFilterFn:e=>A(e.value)||""===e.value?null:t=>String(t)===String(e.value)},{value:"not",label:"is not",inputType:"select",getApplyFilterFn:e=>A(e.value)||""===e.value?null:t=>String(t)!==String(e.value)},{value:"isAnyOf",label:"is any of",inputType:"multiselect",getApplyFilterFn:e=>{if(!Array.isArray(e.value)||0===e.value.length)return null;const t=new Set(e.value.map(String));return e=>t.has(String(e))}}],we=e=>e.filterOperators??(e=>{switch(e){case"number":return fe;case"date":return xe(!1);case"dateTime":return xe(!0);case"boolean":return ye;case"singleSelect":return ve;case"actions":return[];default:return ue}})(e.type),Ee=e=>{const t=e.type??"string",r="number"===t,n="boolean"===t,o="actions"===t;return{...e,type:t,headerName:e.headerName??e.field,width:e.width??100,minWidth:e.minWidth??G,align:e.align??(r?"right":n||o?"center":"left"),headerAlign:e.headerAlign??e.align??(r?"right":n||o?"center":"left"),sortable:!o&&(e.sortable??!0),filterable:!o&&(e.filterable??!0),hideable:e.hideable??!0,resizable:e.resizable??!0,pinnable:e.pinnable??!0,groupable:!o&&(e.groupable??!0),aggregable:!o&&(e.aggregable??!0),editable:e.editable??!1,disableColumnMenu:e.disableColumnMenu??o,disableExport:e.disableExport??o}},Ce=(e,t)=>Ee({field:e,headerName:"",width:t,minWidth:t,maxWidth:t,sortable:!1,filterable:!1,hideable:!1,resizable:!1,pinnable:!1,groupable:!1,aggregable:!1,disableColumnMenu:!0,disableExport:!0,disableReorder:!0,align:"center",headerAlign:"center"}),ke=Ce(I,50),Me=Ce(F,50),Se=new Set(["animationIterationCount","borderImageOutset","borderImageSlice","borderImageWidth","boxFlex","boxFlexGroup","boxOrdinalGroup","columnCount","columns","flex","flexGrow","flexPositive","flexShrink","flexNegative","flexOrder","gridArea","gridRow","gridRowEnd","gridRowSpan","gridRowStart","gridColumn","gridColumnEnd","gridColumnSpan","gridColumnStart","fontWeight","lineClamp","lineHeight","opacity","order","orphans","tabSize","widows","zIndex","zoom","fillOpacity","floodOpacity","stopOpacity","strokeDasharray","strokeDashoffset","strokeMiterlimit","strokeOpacity","strokeWidth"]),De=e=>/[&.:#>\[\s*~+,@]/.test(e),Ie=e=>Object.keys(e).filter(t=>{const r=e[t];return!De(t)&&("string"==typeof r||"number"==typeof r)}).map(t=>{return`${(e=>{if(0===e.indexOf("--"))return e;const t=e.replace(/[A-Z]/g,e=>`-${e.toLowerCase()}`);return 0===t.indexOf("ms-")?`-${t}`:t})(t)}:${r=t,n=e[t],"number"!=typeof n||0===n||Se.has(r)||0===r.indexOf("--")?String(n):`${n}px`}`;var r,n}).join(";"),Fe=(e,t,r=[])=>t?(Object.keys(t).forEach(n=>{const o=t[n];if(!o||"object"!=typeof o)return;const a=o;if("@"===n.charAt(0)){const t=[],o=Ie(a);return o&&t.push(`${e}{${o}}`),Fe(e,a,t),void(t.length&&r.push(`${n}{${t.join("")}}`))}const i=((e,t)=>t.split(",").map(e=>e.trim()).filter(Boolean).map(t=>-1!==t.indexOf("&")?t.replace(/&/g,e):`${e} ${t}`).join(","))(e,n),l=Ie(a);l&&r.push(`${i}{${l}}`),Fe(i,a,r)}),r):r,Pe=e=>e.map(e=>"number"==typeof e?e:Number(e)).filter(e=>!Number.isNaN(e)&&null!==e),Ne={sum:{label:"sum",columnTypes:["number"],apply:({values:e})=>{const t=Pe(e.filter(e=>!A(e)&&""!==e));return 0===t.length?null:t.reduce((e,t)=>e+t,0)}},avg:{label:"avg",columnTypes:["number"],apply:({values:e})=>{const t=Pe(e.filter(e=>!A(e)&&""!==e));return 0===t.length?null:t.reduce((e,t)=>e+t,0)/t.length}},min:{label:"min",columnTypes:["number","date","dateTime"],apply:({values:e})=>{const t=e.filter(e=>!A(e)&&""!==e);if(0===t.length)return null;if(t.every(e=>"number"==typeof e))return Math.min(...t);const r=t.map(j);return r.every(e=>null!==e)?new Date(Math.min(...r.map(e=>e.getTime()))):t.slice().sort((e,t)=>le(e,t))[0]}},max:{label:"max",columnTypes:["number","date","dateTime"],apply:({values:e})=>{const t=e.filter(e=>!A(e)&&""!==e);if(0===t.length)return null;if(t.every(e=>"number"==typeof e))return Math.max(...t);const r=t.map(j);if(r.every(e=>null!==e))return new Date(Math.max(...r.map(e=>e.getTime())));const n=t.slice().sort((e,t)=>le(e,t));return n[n.length-1]}},size:{label:"size",apply:({values:e})=>e.length}},Re={noRowsLabel:"No rows",loadingLabel:"Loading…",toolbarColumns:"Columns",toolbarFilters:"Filters",toolbarExport:"Export",toolbarDensity:"Density",toolbarQuickFilterPlaceholder:"Search...",toolbarQuickFilterLabel:"Search",toolbarExportCSV:"Download as CSV",toolbarExportExcel:"Download as Excel",toolbarExportPrint:"Print",densityCompact:"Compact",densityStandard:"Standard",densityComfortable:"Comfortable",columnsPanelSearchPlaceholder:"Search",columnsPanelShowAll:"Show all",columnsPanelHideAll:"Hide all",columnsPanelReset:"Reset",filterPanelAddFilter:"Add filter",filterPanelRemoveAll:"Remove all",filterPanelDeleteIcon:"Delete",filterPanelColumns:"Columns",filterPanelOperator:"Operator",filterPanelValue:"Value",filterPanelInputPlaceholder:"Filter value",filterPanelLogicOperator:"Logic operator",filterPanelOperatorAnd:"And",filterPanelOperatorOr:"Or",columnMenuSortAsc:"Sort by ASC",columnMenuSortDesc:"Sort by DESC",columnMenuUnsort:"Unsort",columnMenuFilter:"Filter",columnMenuHideColumn:"Hide column",columnMenuManageColumns:"Manage columns",columnMenuPinLeft:"Pin to left",columnMenuPinRight:"Pin to right",columnMenuUnpin:"Unpin",columnMenuGroup:e=>`Group by ${e}`,columnMenuUngroup:e=>`Stop grouping by ${e}`,columnMenuAggregation:"Aggregation",aggregationMenuItemHeader:"Aggregation",aggregationFunctionLabelNone:"none",aggregationFunctionLabelSum:"sum",aggregationFunctionLabelAvg:"avg",aggregationFunctionLabelMin:"min",aggregationFunctionLabelMax:"max",aggregationFunctionLabelSize:"size",footerRowSelected:e=>1===e?"1 row selected":`${e.toLocaleString()} rows selected`,footerTotalRows:"Total Rows:",footerPaginationRowsPerPage:"Rows per page:",footerPaginationDisplayedRows:(e,t,r)=>`${e}–${t} of ${r.toLocaleString()}`,footerPaginationFirstPage:"First page",footerPaginationPreviousPage:"Previous page",footerPaginationNextPage:"Next page",footerPaginationLastPage:"Last page",checkboxSelectionHeaderName:"Checkbox selection",checkboxSelectionSelectAllRows:"Select all rows",checkboxSelectionUnselectAllRows:"Unselect all rows",checkboxSelectionSelectRow:"Select row",checkboxSelectionUnselectRow:"Unselect row",booleanCellTrueLabel:"yes",booleanCellFalseLabel:"no",detailPanelToggle:"Detail panel toggle",expandDetailPanel:"Expand",collapseDetailPanel:"Collapse",groupingColumnHeaderName:"Group",groupColumn:e=>`Group by ${e}`,unGroupColumn:e=>`Stop grouping by ${e}`,actionsCellMore:"more",columnHeaderSortIconLabel:"Sort",columnMenuLabel:"Menu",clearSearch:"Clear search"};let ze;const Oe=(e,t)=>{if("undefined"==typeof document)return 8*e.length;if(void 0===ze){const e=document.createElement("canvas");ze=e.getContext("2d")}return ze?(ze.font=t,ze.measureText(e).width):8*e.length},Ge=(e,t)=>{if("undefined"==typeof document)return;const r=URL.createObjectURL(e),n=document.createElement("a");n.href=r,n.download=t,n.style.display="none",document.body.appendChild(n),n.click(),window.setTimeout(()=>{document.body.removeChild(n),URL.revokeObjectURL(r)},0)},Te="mgh-grid-styles",Ae='\n.mgh-grid-card {\n --mgh-grid-font-family: inherit;\n --mgh-grid-font-size: 14px;\n --mgh-grid-radius: 16px;\n --mgh-grid-inner-radius: 4px;\n --mgh-grid-paper: #ffffff;\n --mgh-grid-bg: #ffffff;\n --mgh-grid-fg: rgba(0, 0, 0, 0.87);\n --mgh-grid-fg-secondary: rgba(0, 0, 0, 0.6);\n --mgh-grid-fg-disabled: rgba(0, 0, 0, 0.38);\n --mgh-grid-border: rgba(224, 224, 224, 1);\n --mgh-grid-header-bg: #ffffff;\n --mgh-grid-header-fg: rgba(0, 0, 0, 0.87);\n --mgh-grid-hover: rgba(0, 0, 0, 0.04);\n --mgh-grid-hover-strong: rgba(0, 0, 0, 0.08);\n --mgh-grid-selected: rgba(25, 118, 210, 0.08);\n --mgh-grid-selected-hover: rgba(25, 118, 210, 0.12);\n --mgh-grid-primary: #1976d2;\n --mgh-grid-primary-contrast: #ffffff;\n --mgh-grid-focus: #1976d2;\n --mgh-grid-shadow: 0 0 2px rgba(145, 158, 171, 0.2), 0 12px 24px -4px rgba(145, 158, 171, 0.12);\n --mgh-grid-popover-shadow: 0 5px 5px -3px rgba(0,0,0,.2), 0 8px 10px 1px rgba(0,0,0,.14), 0 3px 14px 2px rgba(0,0,0,.12);\n --mgh-grid-overlay: rgba(255, 255, 255, 0.6);\n --mgh-grid-input-bg: transparent;\n --mgh-grid-input-border: rgba(0, 0, 0, 0.23);\n --mgh-grid-pinned-shadow: rgba(0, 0, 0, 0.12);\n --mgh-grid-group-bg: rgba(0, 0, 0, 0.02);\n --mgh-grid-footer-bg: rgba(0, 0, 0, 0.02);\n --mgh-grid-badge: #1976d2;\n --mgh-grid-scrollbar: rgba(0, 0, 0, 0.3);\n\n position: relative;\n display: flex;\n flex-direction: column;\n min-width: 0;\n background: var(--mgh-grid-paper);\n color: var(--mgh-grid-fg);\n border-radius: var(--mgh-grid-radius);\n box-shadow: var(--mgh-grid-shadow);\n font-family: var(--mgh-grid-font-family);\n font-size: var(--mgh-grid-font-size);\n line-height: 1.5;\n overflow: hidden;\n box-sizing: border-box;\n}\n.mgh-grid-card[data-mgh-theme="dark"] {\n --mgh-grid-paper: #212b36;\n --mgh-grid-bg: #212b36;\n --mgh-grid-fg: #ffffff;\n --mgh-grid-fg-secondary: rgba(255, 255, 255, 0.7);\n --mgh-grid-fg-disabled: rgba(255, 255, 255, 0.5);\n --mgh-grid-border: rgba(81, 81, 81, 1);\n --mgh-grid-header-bg: #212b36;\n --mgh-grid-header-fg: #ffffff;\n --mgh-grid-hover: rgba(255, 255, 255, 0.08);\n --mgh-grid-hover-strong: rgba(255, 255, 255, 0.16);\n --mgh-grid-selected: rgba(144, 202, 249, 0.16);\n --mgh-grid-selected-hover: rgba(144, 202, 249, 0.24);\n --mgh-grid-primary: #90caf9;\n --mgh-grid-primary-contrast: rgba(0, 0, 0, 0.87);\n --mgh-grid-focus: #90caf9;\n --mgh-grid-shadow: 0 0 2px rgba(0, 0, 0, 0.2), 0 12px 24px -4px rgba(0, 0, 0, 0.12);\n --mgh-grid-overlay: rgba(33, 43, 54, 0.6);\n --mgh-grid-input-border: rgba(255, 255, 255, 0.23);\n --mgh-grid-pinned-shadow: rgba(0, 0, 0, 0.5);\n --mgh-grid-group-bg: rgba(255, 255, 255, 0.03);\n --mgh-grid-footer-bg: rgba(255, 255, 255, 0.03);\n --mgh-grid-badge: #90caf9;\n --mgh-grid-scrollbar: rgba(255, 255, 255, 0.3);\n}\n/* Only our own elements get the border-box reset. A blanket descendant reset would leak into\n consumer content rendered through slots (e.g. MUI TextField inputs rely on content-box). */\n[class*="mgh-grid"], [class*="mgh-grid"]::before, [class*="mgh-grid"]::after { box-sizing: border-box; }\n.mgh-grid-card--plain { box-shadow: none; border-radius: 0; background: transparent; }\n\n/* ---- card header ---- */\n/* Title stays on its row; only the end-content group wraps internally (like the legacy MUI card). */\n.mgh-grid-card-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding: 16px 16px 16px 0; flex-wrap: nowrap; }\n.mgh-grid-card-title { flex: 0 0 auto; padding: 8px 24px; margin: 0; font-size: 1.125rem; font-weight: 700; line-height: 1.5556; }\n/* Children are auto-sized so space-between leaves equal gaps title|center|end (like the legacy MUI card).\n Only the end group shrinks (and wraps internally); the centre content keeps its natural width. */\n.mgh-grid-card-header-center { flex: 0 0 auto; min-width: 0; display: flex; align-items: center; justify-content: center; gap: 16px; flex-wrap: wrap; }\n.mgh-grid-card-header-end { flex: 0 1 auto; min-width: 0; display: flex; align-items: center; gap: 16px; flex-wrap: wrap; justify-content: flex-end; }\n.mgh-grid-card-header-end:first-child { margin-left: auto; }\n@media (max-width: 599.95px) {\n .mgh-grid-card-header { flex-wrap: wrap; }\n .mgh-grid-card-header-end { gap: 8px; }\n}\n\n/* ---- box + root ---- */\n.mgh-grid-box { display: flex; flex-direction: column; flex-grow: 1; min-height: 0; min-width: 0; }\n.mgh-grid {\n position: relative;\n display: flex;\n flex-direction: column;\n flex: 1 1 auto;\n min-height: 0;\n min-width: 0;\n border: 1px solid var(--mgh-grid-border);\n border-radius: var(--mgh-grid-inner-radius);\n background: var(--mgh-grid-bg);\n color: var(--mgh-grid-fg);\n outline: none;\n}\n.mgh-grid--auto-height { flex: 0 0 auto; }\n\n/* ---- toolbar ---- */\n.mgh-grid-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 45px; padding: 4px 8px; border-bottom: 1px solid var(--mgh-grid-border); flex-wrap: wrap; }\n.mgh-grid-toolbar-group { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }\n.mgh-grid-toolbar-center { display: flex; align-items: center; flex: 1 1 auto; justify-content: center; }\n\n/* ---- buttons ---- */\n.mgh-grid-btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 0; margin: 0; background: transparent; color: var(--mgh-grid-fg-secondary); font: inherit; font-size: 0.8125rem; font-weight: 500; line-height: 1.75; letter-spacing: .02em; padding: 4px 8px; border-radius: 4px; cursor: pointer; user-select: none; transition: background-color .15s, color .15s; text-transform: none; white-space: nowrap; }\n.mgh-grid-btn:hover { background: var(--mgh-grid-hover); color: var(--mgh-grid-fg); }\n.mgh-grid-btn:focus-visible { outline: 2px solid var(--mgh-grid-focus); outline-offset: 1px; }\n.mgh-grid-btn:disabled { color: var(--mgh-grid-fg-disabled); cursor: default; background: transparent; }\n.mgh-grid-btn--icon { padding: 6px; border-radius: 50%; width: 32px; height: 32px; }\n.mgh-grid-btn--icon.mgh-grid-btn--small { width: 26px; height: 26px; padding: 3px; }\n.mgh-grid-btn--icon.mgh-grid-btn--small .mgh-grid-icon { width: 18px; height: 18px; }\n.mgh-grid-btn--primary { color: var(--mgh-grid-primary); }\n.mgh-grid-btn--primary:hover { background: var(--mgh-grid-selected); color: var(--mgh-grid-primary); }\n.mgh-grid-btn--contained { background: var(--mgh-grid-primary); color: var(--mgh-grid-primary-contrast); }\n.mgh-grid-btn--contained:hover { background: var(--mgh-grid-primary); color: var(--mgh-grid-primary-contrast); filter: brightness(0.92); }\n.mgh-grid-btn--active { color: var(--mgh-grid-primary); }\n\n/* ---- badge ---- */\n.mgh-grid-badge { position: relative; display: inline-flex; }\n.mgh-grid-badge-dot { position: absolute; top: 0; right: 0; min-width: 8px; height: 8px; border-radius: 4px; background: var(--mgh-grid-badge); transform: translate(50%, -50%); }\n.mgh-grid-badge-count { position: absolute; top: 0; right: 0; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 8px; background: var(--mgh-grid-badge); color: var(--mgh-grid-primary-contrast); font-size: 10px; font-weight: 600; line-height: 16px; text-align: center; transform: translate(50%, -50%); }\n\n/* ---- inputs ---- */\n.mgh-grid-input, .mgh-grid-select { font: inherit; font-size: 0.875rem; color: var(--mgh-grid-fg); background: var(--mgh-grid-input-bg); border: 1px solid var(--mgh-grid-input-border); border-radius: 6px; padding: 6px 10px; height: 36px; min-width: 0; outline: none; transition: border-color .15s, box-shadow .15s; }\n.mgh-grid-input:hover, .mgh-grid-select:hover { border-color: var(--mgh-grid-fg); }\n.mgh-grid-input:focus, .mgh-grid-select:focus { border-color: var(--mgh-grid-focus); box-shadow: 0 0 0 1px var(--mgh-grid-focus); }\n.mgh-grid-input::placeholder { color: var(--mgh-grid-fg-disabled); }\n.mgh-grid-input--small, .mgh-grid-select--small { height: 32px; padding: 4px 8px; font-size: 0.8125rem; }\n.mgh-grid-select { appearance: none; -webkit-appearance: none; padding-right: 28px; background-image: url("data:image/svg+xml;utf8,<svg xmlns=\'http://www.w3.org/2000/svg\' viewBox=\'0 0 24 24\' fill=\'%23888\'><path d=\'M7 10l5 5 5-5z\'/></svg>"); background-repeat: no-repeat; background-position: right 6px center; background-size: 18px; cursor: pointer; }\n.mgh-grid-select option { color: initial; background: initial; }\n.mgh-grid-card[data-mgh-theme="dark"] .mgh-grid-select option, .mgh-grid-popover[data-mgh-theme="dark"] .mgh-grid-select option { color: #fff; background: #212b36; }\n.mgh-grid-select[multiple] { height: auto; min-height: 36px; background-image: none; padding-right: 10px; }\n.mgh-grid-field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }\n.mgh-grid-field-label { font-size: 0.75rem; color: var(--mgh-grid-fg-secondary); }\n.mgh-grid-input-adorned { position: relative; display: flex; align-items: center; }\n.mgh-grid-input-adorned .mgh-grid-input { width: 100%; padding-left: 34px; }\n.mgh-grid-input-adorned--clearable .mgh-grid-input { padding-right: 34px; }\n.mgh-grid-input-adornment { position: absolute; left: 10px; display: inline-flex; color: var(--mgh-grid-fg-secondary); pointer-events: none; }\n.mgh-grid-input-adornment--end { left: auto; right: 4px; pointer-events: auto; }\n\n/* ---- checkbox ---- */\n.mgh-grid-checkbox { appearance: none; -webkit-appearance: none; width: 18px; height: 18px; margin: 0; border: 2px solid var(--mgh-grid-fg-secondary); border-radius: 3px; background: transparent; cursor: pointer; display: inline-grid; place-content: center; position: relative; flex: 0 0 auto; transition: background-color .12s, border-color .12s; }\n.mgh-grid-checkbox:hover { border-color: var(--mgh-grid-fg); }\n.mgh-grid-checkbox:focus-visible { outline: 2px solid var(--mgh-grid-focus); outline-offset: 2px; }\n.mgh-grid-checkbox:checked, .mgh-grid-checkbox:indeterminate { background: var(--mgh-grid-primary); border-color: var(--mgh-grid-primary); }\n.mgh-grid-checkbox:checked::after { content: ""; width: 5px; height: 10px; border: solid var(--mgh-grid-primary-contrast); border-width: 0 2px 2px 0; transform: translateY(-1px) rotate(45deg); }\n.mgh-grid-checkbox:indeterminate::after { content: ""; width: 10px; height: 2px; background: var(--mgh-grid-primary-contrast); }\n.mgh-grid-checkbox:disabled { opacity: 0.4; cursor: default; }\n.mgh-grid-checkbox-label { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-size: 0.875rem; padding: 6px 4px; border-radius: 4px; }\n.mgh-grid-checkbox-label:hover { background: var(--mgh-grid-hover); }\n\n/* ---- quick filter ---- */\n.mgh-grid-quick-filter { display: grid; align-items: center; }\n.mgh-grid-quick-filter-trigger { grid-area: 1 / 1; z-index: 1; transition: opacity .2s; }\n.mgh-grid-quick-filter--expanded .mgh-grid-quick-filter-trigger { opacity: 0; pointer-events: none; }\n.mgh-grid-quick-filter-control { grid-area: 1 / 1; width: 32px; opacity: 0; overflow: hidden; transition: width .2s, opacity .2s; }\n.mgh-grid-quick-filter--expanded .mgh-grid-quick-filter-control { width: 260px; opacity: 1; }\n@media (max-width: 599.95px) { .mgh-grid-quick-filter--expanded .mgh-grid-quick-filter-control { width: 180px; } }\n\n/* ---- main / scroller ---- */\n.mgh-grid-main { position: relative; display: flex; flex: 1 1 auto; min-height: 0; min-width: 0; overflow: hidden; }\n.mgh-grid--auto-height .mgh-grid-main { flex: 0 0 auto; }\n.mgh-grid-scroller { position: relative; flex: 1 1 auto; min-height: 0; min-width: 0; overflow: auto; outline: none; scrollbar-width: thin; }\n.mgh-grid--auto-height .mgh-grid-scroller { overflow-y: hidden; }\n.mgh-grid-scroller::-webkit-scrollbar { width: 10px; height: 10px; }\n.mgh-grid-scroller::-webkit-scrollbar-thumb { background: var(--mgh-grid-scrollbar); border-radius: 5px; border: 2px solid transparent; background-clip: content-box; }\n\n/* ---- column headers ---- */\n.mgh-grid-columns { position: sticky; top: 0; z-index: 3; background: var(--mgh-grid-header-bg); border-bottom: 1px solid var(--mgh-grid-border); min-width: 100%; width: max-content; }\n.mgh-grid-header-row { display: flex; min-width: 100%; }\n.mgh-grid-header-cell { position: relative; display: flex; align-items: center; flex: 0 0 auto; height: var(--mgh-grid-header-height); padding: 0 10px; font-weight: 600; font-size: 0.875rem; color: var(--mgh-grid-header-fg); background: var(--mgh-grid-header-bg); white-space: nowrap; overflow: hidden; user-select: none; outline: none; }\n.mgh-grid-header-cell--sortable { cursor: pointer; }\n.mgh-grid-header-cell:focus-visible { outline: 2px solid var(--mgh-grid-focus); outline-offset: -2px; }\n.mgh-grid-header-cell--align-center { justify-content: center; }\n.mgh-grid-header-cell--align-right { justify-content: flex-end; }\n.mgh-grid-header-cell--align-right .mgh-grid-header-title-container { flex-direction: row-reverse; }\n.mgh-grid-header-title-container { display: flex; align-items: center; gap: 2px; min-width: 0; flex: 1 1 auto; overflow: hidden; }\n.mgh-grid-header-cell--align-center .mgh-grid-header-title-container { flex: 0 1 auto; }\n.mgh-grid-header-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }\n.mgh-grid-sort-icon { display: inline-flex; align-items: center; color: var(--mgh-grid-fg-secondary); opacity: 0; transition: opacity .15s; flex: 0 0 auto; }\n.mgh-grid-header-cell:hover .mgh-grid-sort-icon, .mgh-grid-sort-icon--active { opacity: 1; }\n.mgh-grid-sort-index { font-size: 10px; margin-left: -2px; color: var(--mgh-grid-fg-secondary); }\n.mgh-grid-header-menu-btn { position: absolute; right: 2px; opacity: 0; transition: opacity .15s; background: var(--mgh-grid-header-bg); }\n.mgh-grid-header-cell--align-right .mgh-grid-header-menu-btn { right: auto; left: 2px; }\n.mgh-grid-header-cell:hover .mgh-grid-header-menu-btn, .mgh-grid-header-menu-btn--open, .mgh-grid-header-cell:focus-within .mgh-grid-header-menu-btn { opacity: 1; }\n.mgh-grid-header-cell--menu-open { background: var(--mgh-grid-hover); }\n.mgh-grid-resize-handle { position: absolute; top: 0; right: -4px; width: 9px; height: 100%; cursor: col-resize; z-index: 2; display: flex; justify-content: center; touch-action: none; }\n.mgh-grid-resize-handle::after { content: ""; width: 1px; height: 60%; margin-top: 20%; background: var(--mgh-grid-border); transition: background .15s, width .15s; }\n.mgh-grid-resize-handle:hover::after, .mgh-grid-resize-handle--active::after { background: var(--mgh-grid-primary); width: 2px; }\n.mgh-grid-header-cell--last .mgh-grid-resize-handle { right: 0; }\n.mgh-grid-header-cell--dragging { opacity: 0.5; }\n.mgh-grid-header-cell--drop-left::before, .mgh-grid-header-cell--drop-right::before { content: ""; position: absolute; top: 4px; bottom: 4px; width: 2px; background: var(--mgh-grid-primary); z-index: 3; }\n.mgh-grid-header-cell--drop-left::before { left: 0; }\n.mgh-grid-header-cell--drop-right::before { right: 0; }\n.mgh-grid-header-filler { flex: 1 1 auto; background: var(--mgh-grid-header-bg); }\n\n/* ---- pinned cells ---- */\n.mgh-grid-cell--pinned-left, .mgh-grid-header-cell--pinned-left { position: sticky; z-index: 2; background-color: var(--mgh-grid-bg); }\n.mgh-grid-cell--pinned-right, .mgh-grid-header-cell--pinned-right { position: sticky; z-index: 2; background-color: var(--mgh-grid-bg); }\n.mgh-grid-header-cell--pinned-left, .mgh-grid-header-cell--pinned-right { z-index: 4; background-color: var(--mgh-grid-header-bg); }\n.mgh-grid-cell--pinned-left-last, .mgh-grid-header-cell--pinned-left-last { box-shadow: 2px 0 4px -2px var(--mgh-grid-pinned-shadow); }\n.mgh-grid-cell--pinned-right-first, .mgh-grid-header-cell--pinned-right-first { box-shadow: -2px 0 4px -2px var(--mgh-grid-pinned-shadow); }\n.mgh-grid--no-pinned-shadow .mgh-grid-cell--pinned-left-last, .mgh-grid--no-pinned-shadow .mgh-grid-header-cell--pinned-left-last { box-shadow: none; }\n\n/* ---- body & rows ---- */\n.mgh-grid-body { position: relative; min-width: 100%; width: max-content; }\n.mgh-grid-body--flow { display: flex; flex-direction: column; }\n.mgh-grid-row-block { min-width: 100%; }\n.mgh-grid-body--virtual .mgh-grid-row-block { position: absolute; left: 0; }\n.mgh-grid-row { display: flex; min-width: 100%; border-bottom: 1px solid var(--mgh-grid-border); background: var(--mgh-grid-bg); position: relative; }\n.mgh-grid-row--auto-height { align-items: stretch; }\n.mgh-grid-row:hover { background: var(--mgh-grid-hover); }\n.mgh-grid-row--selected { background: var(--mgh-grid-selected); }\n.mgh-grid-row--selected:hover { background: var(--mgh-grid-selected-hover); }\n.mgh-grid-row--clickable { cursor: pointer; }\n.mgh-grid-row--group { background: var(--mgh-grid-group-bg); }\n.mgh-grid-row--pinned { background: var(--mgh-grid-bg); }\n.mgh-grid-row--footer { background: var(--mgh-grid-footer-bg); font-weight: 600; }\n.mgh-grid-row:hover .mgh-grid-cell--pinned-left, .mgh-grid-row:hover .mgh-grid-cell--pinned-right { background-image: linear-gradient(var(--mgh-grid-hover), var(--mgh-grid-hover)); }\n.mgh-grid-row--selected .mgh-grid-cell--pinned-left, .mgh-grid-row--selected .mgh-grid-cell--pinned-right { background-image: linear-gradient(var(--mgh-grid-selected), var(--mgh-grid-selected)); }\n.mgh-grid-row--selected:hover .mgh-grid-cell--pinned-left, .mgh-grid-row--selected:hover .mgh-grid-cell--pinned-right { background-image: linear-gradient(var(--mgh-grid-selected-hover), var(--mgh-grid-selected-hover)); }\n.mgh-grid-row--group .mgh-grid-cell--pinned-left, .mgh-grid-row--group .mgh-grid-cell--pinned-right { background-image: linear-gradient(var(--mgh-grid-group-bg), var(--mgh-grid-group-bg)); }\n.mgh-grid-row--footer .mgh-grid-cell--pinned-left, .mgh-grid-row--footer .mgh-grid-cell--pinned-right { background-image: linear-gradient(var(--mgh-grid-footer-bg), var(--mgh-grid-footer-bg)); }\n.mgh-grid-row-filler { flex: 1 1 auto; }\n\n.mgh-grid-cell { display: flex; align-items: center; flex: 0 0 auto; padding: 0 10px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-size: 0.875rem; outline: none; min-height: 100%; }\n.mgh-grid-cell > .mgh-grid-cell-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }\n.mgh-grid-row--auto-height .mgh-grid-cell { white-space: normal; align-items: flex-start; padding-top: 8px; padding-bottom: 8px; }\n.mgh-grid-row--auto-height .mgh-grid-cell > .mgh-grid-cell-text { white-space: normal; word-break: break-word; }\n.mgh-grid-cell--align-center { justify-content: center; }\n.mgh-grid-cell--align-right { justify-content: flex-end; }\n.mgh-grid-cell--focused { outline: 1px solid var(--mgh-grid-focus); outline-offset: -1px; }\n.mgh-grid-cell--editable { cursor: text; }\n.mgh-grid-cell--editing { padding: 0 4px; outline: 2px solid var(--mgh-grid-focus); outline-offset: -2px; background: var(--mgh-grid-bg); }\n.mgh-grid-cell--editing .mgh-grid-input, .mgh-grid-cell--editing .mgh-grid-select { width: 100%; height: calc(100% - 6px); border: 0; box-shadow: none; padding: 0 6px; background: transparent; }\n.mgh-grid-cell--checkbox, .mgh-grid-header-cell--checkbox, .mgh-grid-cell--detail-toggle, .mgh-grid-header-cell--detail-toggle { justify-content: center; padding: 0; }\n.mgh-grid-cell--boolean .mgh-grid-icon { color: var(--mgh-grid-fg-secondary); }\n.mgh-grid-cell--actions { gap: 2px; justify-content: center; }\n.mgh-grid-cell--aggregation { flex-direction: column; align-items: stretch; justify-content: center; line-height: 1.2; }\n.mgh-grid-cell--aggregation.mgh-grid-cell--align-right { align-items: flex-end; }\n.mgh-grid-cell--aggregation.mgh-grid-cell--align-center { align-items: center; }\n.mgh-grid-aggregation-label { font-size: 0.65rem; font-weight: 500; text-transform: uppercase; color: var(--mgh-grid-fg-secondary); letter-spacing: .04em; }\n.mgh-grid-group-cell { display: flex; align-items: center; gap: 4px; min-width: 0; }\n.mgh-grid-group-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }\n.mgh-grid-group-count { color: var(--mgh-grid-fg-secondary); margin-left: 2px; }\n.mgh-grid-group-toggle { flex: 0 0 auto; }\n.mgh-grid-group-toggle .mgh-grid-icon { transition: transform .15s; }\n.mgh-grid-group-toggle--expanded .mgh-grid-icon { transform: rotate(90deg); }\n.mgh-grid-detail-toggle .mgh-grid-icon { transition: transform .15s; }\n.mgh-grid-detail-toggle--expanded .mgh-grid-icon { transform: rotate(180deg); }\n\n/* ---- pinned rows ---- */\n.mgh-grid-pinned-rows { position: sticky; z-index: 2; min-width: 100%; width: max-content; background: var(--mgh-grid-bg); }\n.mgh-grid-pinned-rows--top { box-shadow: 0 2px 4px -2px var(--mgh-grid-pinned-shadow); }\n.mgh-grid-pinned-rows--bottom { bottom: 0; box-shadow: 0 -2px 4px -2px var(--mgh-grid-pinned-shadow); }\n.mgh-grid-pinned-rows--bottom .mgh-grid-row { border-bottom: 0; border-top: 1px solid var(--mgh-grid-border); }\n\n/* ---- detail panel ---- */\n.mgh-grid-detail-panel { position: sticky; left: 0; overflow: auto; border-bottom: 1px solid var(--mgh-grid-border); background: var(--mgh-grid-bg); z-index: 1; }\n\n/* ---- overlays ---- */\n.mgh-grid-overlay { position: absolute; left: 0; right: 0; bottom: 0; display: flex; align-items: center; justify-content: center; flex-direction: column; gap: 8px; z-index: 5; color: var(--mgh-grid-fg-secondary); font-size: 0.875rem; pointer-events: none; }\n.mgh-grid-overlay--loading { background: var(--mgh-grid-overlay); pointer-events: auto; }\n.mgh-grid-no-rows { display: flex; align-items: center; justify-content: center; gap: 8px; height: 100%; text-align: center; padding: 16px; }\n.mgh-grid-no-rows img, .mgh-grid-no-rows .mgh-grid-icon { width: 50px; height: 50px; color: var(--mgh-grid-fg-disabled); }\n.mgh-grid-spinner { width: 36px; height: 36px; border-radius: 50%; border: 3px solid var(--mgh-grid-selected); border-top-color: var(--mgh-grid-primary); animation: mgh-grid-spin .8s linear infinite; }\n@keyframes mgh-grid-spin { to { transform: rotate(360deg); } }\n\n/* ---- footer ---- */\n.mgh-grid-footer { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 52px; padding: 0 8px 0 16px; border-top: 1px solid var(--mgh-grid-border); font-size: 0.875rem; color: var(--mgh-grid-fg-secondary); flex-wrap: wrap; }\n.mgh-grid-footer-left { display: flex; align-items: center; gap: 16px; }\n.mgh-grid-pagination { display: flex; align-items: center; gap: 8px; margin-left: auto; flex-wrap: wrap; }\n.mgh-grid-pagination-select { height: 32px; padding: 2px 24px 2px 8px; font-size: 0.875rem; border-color: transparent; }\n.mgh-grid-pagination-select:hover { border-color: transparent; background-color: var(--mgh-grid-hover); }\n.mgh-grid-pagination-actions { display: inline-flex; align-items: center; }\n\n/* ---- popover / menu / panels ---- */\n.mgh-grid-popover {\n --mgh-grid-font-family: inherit; --mgh-grid-font-size: 14px; --mgh-grid-paper: #ffffff; --mgh-grid-bg: #fff; --mgh-grid-fg: rgba(0,0,0,.87); --mgh-grid-fg-secondary: rgba(0,0,0,.6); --mgh-grid-fg-disabled: rgba(0,0,0,.38); --mgh-grid-border: rgba(224,224,224,1); --mgh-grid-hover: rgba(0,0,0,.04); --mgh-grid-selected: rgba(25,118,210,.08); --mgh-grid-primary: #1976d2; --mgh-grid-primary-contrast: #fff; --mgh-grid-focus: #1976d2; --mgh-grid-input-bg: transparent; --mgh-grid-input-border: rgba(0,0,0,.23); --mgh-grid-popover-shadow: 0 5px 5px -3px rgba(0,0,0,.2), 0 8px 10px 1px rgba(0,0,0,.14), 0 3px 14px 2px rgba(0,0,0,.12);\n position: fixed; z-index: 1300; background: var(--mgh-grid-paper); color: var(--mgh-grid-fg); border-radius: 8px; box-shadow: var(--mgh-grid-popover-shadow); font-family: var(--mgh-grid-font-family); font-size: var(--mgh-grid-font-size); line-height: 1.5; outline: none; max-height: calc(100vh - 16px); overflow: auto; animation: mgh-grid-pop .12s ease-out;\n}\n.mgh-grid-popover[data-mgh-theme="dark"] { --mgh-grid-paper: #212b36; --mgh-grid-bg: #212b36; --mgh-grid-fg: #fff; --mgh-grid-fg-secondary: rgba(255,255,255,.7); --mgh-grid-fg-disabled: rgba(255,255,255,.5); --mgh-grid-border: rgba(81,81,81,1); --mgh-grid-hover: rgba(255,255,255,.08); --mgh-grid-selected: rgba(144,202,249,.16); --mgh-grid-primary: #90caf9; --mgh-grid-primary-contrast: rgba(0,0,0,.87); --mgh-grid-focus: #90caf9; --mgh-grid-input-border: rgba(255,255,255,.23); }\n@keyframes mgh-grid-pop { from { opacity: 0; transform: scale(0.96); } to { opacity: 1; transform: scale(1); } }\n.mgh-grid-menu { list-style: none; margin: 0; padding: 6px 0; min-width: 180px; }\n.mgh-grid-menu-item { display: flex; align-items: center; gap: 12px; padding: 6px 16px; min-height: 36px; font-size: 0.875rem; cursor: pointer; white-space: nowrap; color: var(--mgh-grid-fg); background: transparent; border: 0; width: 100%; text-align: left; font-family: inherit; outline: none; }\n.mgh-grid-menu-item:hover, .mgh-grid-menu-item:focus-visible { background: var(--mgh-grid-hover); }\n.mgh-grid-menu-item--disabled { color: var(--mgh-grid-fg-disabled); cursor: default; pointer-events: none; }\n.mgh-grid-menu-item--selected { background: var(--mgh-grid-selected); }\n.mgh-grid-menu-item .mgh-grid-icon { color: var(--mgh-grid-fg-secondary); flex: 0 0 auto; }\n.mgh-grid-menu-divider { height: 1px; margin: 6px 0; background: var(--mgh-grid-border); border: 0; }\n.mgh-grid-menu-header { padding: 6px 16px 2px; font-size: 0.75rem; color: var(--mgh-grid-fg-secondary); text-transform: uppercase; letter-spacing: .04em; }\n.mgh-grid-menu-section { padding: 4px 16px 8px; display: flex; flex-direction: column; gap: 4px; }\n.mgh-grid-panel { display: flex; flex-direction: column; min-width: 300px; max-width: min(640px, calc(100vw - 16px)); }\n.mgh-grid-panel-header { padding: 12px 12px 4px; }\n.mgh-grid-panel-content { padding: 4px 12px; overflow: auto; max-height: 360px; }\n.mgh-grid-panel-footer { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 12px; }\n.mgh-grid-columns-list { display: flex; flex-direction: column; }\n.mgh-grid-filter-row { display: grid; grid-template-columns: 32px minmax(120px, 1fr) minmax(120px, 1fr) minmax(140px, 1.3fr); gap: 8px; align-items: end; margin-bottom: 8px; }\n.mgh-grid-filter-row--first { grid-template-columns: 32px minmax(120px, 1fr) minmax(120px, 1fr) minmax(140px, 1.3fr); }\n.mgh-grid-filter-row--with-logic { grid-template-columns: 32px 80px minmax(120px, 1fr) minmax(120px, 1fr) minmax(140px, 1.3fr); }\n.mgh-grid-filter-row .mgh-grid-btn--icon { margin-bottom: 4px; }\n.mgh-grid-filter-empty { padding: 8px 4px; color: var(--mgh-grid-fg-secondary); font-size: 0.875rem; }\n@media (max-width: 599.95px) { .mgh-grid-filter-row, .mgh-grid-filter-row--with-logic { grid-template-columns: 1fr; } }\n\n/* ---- misc ---- */\n.mgh-grid-tooltip-anchor { display: inline-flex; }\n.mgh-grid-visually-hidden { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); border: 0; }\n@media print { .mgh-grid-toolbar, .mgh-grid-footer { display: none !important; } }\n';let Le=!1;const He=e.useInsertionEffect??("undefined"!=typeof window?e.useLayoutEffect:e.useEffect),Ve=()=>{He(()=>{(()=>{if(Le||"undefined"==typeof document)return;if(document.getElementById(Te))return void(Le=!0);const e=document.createElement("style");e.id=Te,e.setAttribute("data-mgh-grid","true"),e.textContent=Ae,document.head.appendChild(e),Le=!0})()},[])},$e=e.createContext(null);$e.displayName="MGHGridContext";const Be=()=>{const t=e.useContext($e);if(!t)throw new Error("MGHGrid: this component must be rendered inside an <MGHGrid /> (e.g. through a slot).");return t};function _e(t){const r=e.useRef(t);return r.current=t,r}function Ue(t,r,n){const o=void 0!==t,[a,i]=e.useState(r),l=o?t:a,d=_e(l),s=_e(o),c=_e(n);return[l,e.useCallback(e=>{const t="function"==typeof e?e(d.current):e;Object.is(t,d.current)||(d.current=t,s.current||i(t),c.current?.(t))},[])]}let We=0;const qe=(e,t)=>{const r=((e,t)=>{const r=e.getAllColumns();let n;if(t.fields){const e=new Map;r.forEach(t=>e.set(t.field,t)),n=t.fields.map(t=>e.get(t)).filter(Boolean)}else n=t.allColumns?r:e.getVisibleColumns();return n.filter(e=>!e.disableExport&&!T(e.field)&&"actions"!==e.type)})(e,t),n=t.getRowsToExport?t.getRowsToExport({api:e}):e.getSortedRowIds(),o=[];return n.forEach(t=>{const n=e.getRow(t);n&&o.push(r.map(r=>{const o=ee(n,r,e);return{raw:o,formatted:ne(re(o,n,r,e,t)),col:r}}))}),{columns:r,headers:r.map(e=>e.headerName??e.field),rows:o}},je=(e,t,r)=>{const n=e&&e.trim()||t;return n.toLowerCase().endsWith(`.${r}`)?n:`${n}.${r}`},Ye=()=>(("undefined"!=typeof document&&document.title?document.title.trim():"")||"export").replace(/[\\/:*?"<>|]+/g,"-"),Ke=(e,t)=>{let r=e;return/^[=+\-@\t\r]/.test(r)&&(r=`'${r}`),-1!==r.indexOf('"')||-1!==r.indexOf(t)||/[\r\n]/.test(r)?`"${r.replace(/"/g,'""')}"`:r},Xe=(e,t={})=>{const r=t.delimiter??",",n=t.includeHeaders??!0,o=qe(e,t),a=[];return n&&a.push(o.headers.map(e=>Ke(e,r)).join(r)),o.rows.forEach(e=>{a.push(e.map(e=>{const n=t.useRawValues?A(e.raw)?"":String(e.raw):e.formatted;return Ke(n,r)}).join(r))}),a.join("\r\n")},Qe=String.fromCharCode(65279),Je=(()=>{const e=new Uint32Array(256);for(let t=0;t<256;t+=1){let r=t;for(let e=0;e<8;e+=1)r=1&r?3988292384^r>>>1:r>>>1;e[t]=r>>>0}return e})(),Ze="undefined"!=typeof TextEncoder?new TextEncoder:null,et=e=>{if(Ze)return Ze.encode(e);const t=unescape(encodeURIComponent(e)),r=new Uint8Array(t.length);for(let e=0;e<t.length;e+=1)r[e]=t.charCodeAt(e);return r},tt=e=>{const t=e.reduce((e,t)=>e+t.length,0),r=new Uint8Array(t);let n=0;return e.forEach(e=>{r.set(e,n),n+=e.length}),r},rt=e=>{const t=[],r=[];let n=0;e.forEach(e=>{const o=et(e.name),a=(e=>{let t=4294967295;for(let r=0;r<e.length;r+=1)t=Je[255&(t^e[r])]^t>>>8;return(4294967295^t)>>>0})(e.data),i=e.data.length,l=new Uint8Array(30+o.length),d=new DataView(l.buffer);d.setUint32(0,67324752,!0),d.setUint16(4,20,!0),d.setUint16(6,2048,!0),d.setUint16(8,0,!0),d.setUint16(10,0,!0),d.setUint16(12,33,!0),d.setUint32(14,a,!0),d.setUint32(18,i,!0),d.setUint32(22,i,!0),d.setUint16(26,o.length,!0),d.setUint16(28,0,!0),l.set(o,30);const s=new Uint8Array(46+o.length),c=new DataView(s.buffer);c.setUint32(0,33639248,!0),c.setUint16(4,20,!0),c.setUint16(6,20,!0),c.setUint16(8,2048,!0),c.setUint16(10,0,!0),c.setUint16(12,0,!0),c.setUint16(14,33,!0),c.setUint32(16,a,!0),c.setUint32(20,i,!0),c.setUint32(24,i,!0),c.setUint16(28,o.length,!0),c.setUint16(30,0,!0),c.setUint16(32,0,!0),c.setUint16(34,0,!0),c.setUint16(36,0,!0),c.setUint32(38,0,!0),c.setUint32(42,n,!0),s.set(o,46),t.push(l,e.data),r.push(s),n+=l.length+i});const o=tt(r),a=new Uint8Array(22),i=new DataView(a.buffer);return i.setUint32(0,101010256,!0),i.setUint16(4,0,!0),i.setUint16(6,0,!0),i.setUint16(8,e.length,!0),i.setUint16(10,e.length,!0),i.setUint32(12,o.length,!0),i.setUint32(16,n,!0),i.setUint16(20,0,!0),tt(t.concat([o,a]))},nt=new RegExp("["+String.fromCharCode(0)+"-"+String.fromCharCode(8)+String.fromCharCode(11)+String.fromCharCode(12)+String.fromCharCode(14)+"-"+String.fromCharCode(31)+String.fromCharCode(65534)+String.fromCharCode(65535)+"]","g"),ot=e=>(e=>e.replace(nt,""))(e).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&apos;"),at=e=>{let t=e+1,r="";for(;t>0;){const e=(t-1)%26;r=String.fromCharCode(65+e)+r,t=Math.floor((t-1)/26)}return r},it='<?xml version="1.0" encoding="UTF-8" standalone="yes"?>\n',lt=(e,t,r)=>{const n=[];let o=1;const a=(e,t,r)=>`<c r="${e}" t="inlineStr"${r?` s="${r}"`:""}><is><t xml:space="preserve">${ot(t)}</t></is></c>`;if(t){const t=e.headers.map((e,t)=>a(`${at(t)}${o}`,e,1)).join("");n.push(`<row r="${o}">${t}</row>`),o+=1}e.rows.forEach(e=>{const t=e.map((e,t)=>{const r=`${at(t)}${o}`,n=e.col.type;if(A(e.raw)||""===e.raw)return"";if("number"===n&&"number"==typeof e.raw&&Number.isFinite(e.raw))return`<c r="${r}"><v>${e.raw}</v></c>`;if("boolean"===n)return`<c r="${r}" t="b"><v>${e.raw?1:0}</v></c>`;if(("date"===n||"dateTime"===n)&&j(e.raw)){const t=j(e.raw);return`<c r="${r}" s="${"dateTime"===n?3:2}"><v>${Date.UTC(t.getFullYear(),t.getMonth(),t.getDate(),t.getHours(),t.getMinutes(),t.getSeconds())/864e5+25569}</v></c>`}return a(r,e.formatted)}).join("");n.push(`<row r="${o}">${t}</row>`),o+=1});const i=at(Math.max(e.columns.length-1,0)),l=Math.max(o-1,1),d=r.map((e,t)=>`<col min="${t+1}" max="${t+1}" width="${e}" customWidth="1"/>`).join("");return it+'<worksheet xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships">'+`<dimension ref="A1:${i}${l}"/><sheetViews><sheetView workbookViewId="0">`+(t?'<pane ySplit="1" topLeftCell="A2" activePane="bottomLeft" state="frozen"/>':"")+'</sheetView></sheetViews><sheetFormatPr defaultRowHeight="15"/>'+(d?`<cols>${d}</cols>`:"")+`<sheetData>${n.join("")}</sheetData>`+(t&&e.rows.length>0?`<autoFilter ref="A1:${i}${l}"/>`:"")+"</worksheet>"},dt=it+'<styleSheet xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main"><numFmts count="2"><numFmt numFmtId="164" formatCode="m/d/yyyy"/><numFmt numFmtId="165" formatCode="m/d/yyyy h:mm AM/PM"/></numFmts><fonts count="2"><font><sz val="11"/><name val="Calibri"/></font><font><b/><sz val="11"/><name val="Calibri"/></font></fonts><fills count="2"><fill><patternFill patternType="none"/></fill><fill><patternFill patternType="gray125"/></fill></fills><borders count="1"><border><left/><right/><top/><bottom/><diagonal/></border></borders><cellStyleXfs count="1"><xf numFmtId="0" fontId="0" fillId="0" borderId="0"/></cellStyleXfs><cellXfs count="4"><xf numFmtId="0" fontId="0" fillId="0" borderId="0" xfId="0"/><xf numFmtId="0" fontId="1" fillId="0" borderId="0" xfId="0" applyFont="1"/><xf numFmtId="164" fontId="0" fillId="0" borderId="0" xfId="0" applyNumberFormat="1"/><xf numFmtId="165" fontId="0" fillId="0" borderId="0" xfId="0" applyNumberFormat="1"/></cellXfs><cellStyles count="1"><cellStyle name="Normal" xfId="0" builtinId="0"/></cellStyles></styleSheet>',st=it+'<Types xmlns="http://schemas.openxmlformats.org/package/2006/content-types"><Default Extension="rels" ContentType="application/vnd.openxmlformats-package.relationships+xml"/><Default Extension="xml" ContentType="application/xml"/><Override PartName="/xl/workbook.xml" ContentType="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml"/><Override PartName="/xl/worksheets/sheet1.xml" ContentType="application/vnd.openxmlformats-officedocument.spreadsheetml.worksheet+xml"/><Override PartName="/xl/styles.xml" ContentType="application/vnd.openxmlformats-officedocument.spreadsheetml.styles+xml"/><Override PartName="/docProps/core.xml" ContentType="application/vnd.openxmlformats-package.core-properties+xml"/><Override PartName="/docProps/app.xml" ContentType="application/vnd.openxmlformats-officedocument.extended-properties+xml"/></Types>',ct=it+'<Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships"><Relationship Id="rId1" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument" Target="xl/workbook.xml"/><Relationship Id="rId2" Type="http://schemas.openxmlformats.org/package/2006/relationships/metadata/core-properties" Target="docProps/core.xml"/><Relationship Id="rId3" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/extended-properties" Target="docProps/app.xml"/></Relationships>',gt=it+'<Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships"><Relationship Id="rId1" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/worksheet" Target="worksheets/sheet1.xml"/><Relationship Id="rId2" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles" Target="styles.xml"/></Relationships>',mt=e=>it+'<workbook xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships">'+`<sheets><sheet name="${ot(e)}" sheetId="1" r:id="rId1"/></sheets></workbook>`,pt=()=>{const e=(new Date).toISOString();return it+'<cp:coreProperties xmlns:cp="http://schemas.openxmlformats.org/package/2006/metadata/core-properties" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:dcterms="http://purl.org/dc/terms/" xmlns:dcmitype="http://purl.org/dc/dcmitype/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><dc:creator>MGH Grid</dc:creator>'+`<dcterms:created xsi:type="dcterms:W3CDTF">${e}</dcterms:created>`+`<dcterms:modified xsi:type="dcterms:W3CDTF">${e}</dcterms:modified></cp:coreProperties>`},ut=it+'<Properties xmlns="http://schemas.openxmlformats.org/officeDocument/2006/extended-properties" xmlns:vt="http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes"><Application>MGH Grid</Application></Properties>',ht=(e,t={})=>{const r=t.includeHeaders??!0,n=qe(e,t),o=n.columns.map((e,r)=>{const o=t.columnsStyles?.[e.field]?.width;if(o)return o;let a=n.headers[r].length;for(let e=0;e<Math.min(n.rows.length,500);e+=1){const t=n.rows[e][r].formatted.length;t>a&&(a=t)}return Math.min(Math.max(a+2,8),60)}),a=(e=>{const t=(e||"Sheet1").replace(/[\[\]:*?/\\]/g," ").trim()||"Sheet1";return t.length>31?t.slice(0,31):t})(t.sheetName),i=[{name:"[Content_Types].xml",data:et(st)},{name:"_rels/.rels",data:et(ct)},{name:"docProps/core.xml",data:et(pt())},{name:"docProps/app.xml",data:et(ut)},{name:"xl/workbook.xml",data:et(mt(a))},{name:"xl/_rels/workbook.xml.rels",data:et(gt)},{name:"xl/styles.xml",data:et(dt)},{name:"xl/worksheets/sheet1.xml",data:et(lt(n,r,o))}];return rt(i)},ft=e=>e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;"),bt=e=>e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;"),xt=e=>{let t=!1;const r=()=>{t||(t=!0,e.onDone())};try{yt({...e,onDone:r})}catch(e){console.error("MGHGrid: print failed",e),r()}},yt=({cardElement:e,options:t,onDone:r})=>{if("undefined"==typeof document)return void r();const n=t.hideToolbar??!0,o=t.hideFooter??!1,a=t.includeHeaders??!0,i=t.copyStyles??!0,l=e.cloneNode(!0);((e,t)=>{const r=Array.from(e.querySelectorAll("input, select, textarea")),n=Array.from(t.querySelectorAll("input, select, textarea"));r.forEach((e,t)=>{const r=n[t];if(r&&r.tagName===e.tagName)if("INPUT"===e.tagName){const t=e,n=r;"checkbox"===t.type||"radio"===t.type?(n.checked=t.checked,t.checked&&n.setAttribute("checked",""),n.indeterminate=t.indeterminate):(n.value=t.value,n.setAttribute("value",t.value))}else"SELECT"===e.tagName?r.value=e.value:"TEXTAREA"===e.tagName&&(r.value=e.value,r.textContent=e.value)});const o=Array.from(e.querySelectorAll("canvas")),a=Array.from(t.querySelectorAll("canvas"));o.forEach((e,t)=>{const r=a[t];if(r)try{const t=r.ownerDocument.createElement("img");t.src=e.toDataURL(),t.width=e.width,t.height=e.height,t.style.cssText=r.style.cssText,r.replaceWith(t)}catch{}})})(e,l),l.querySelectorAll(".mgh-grid-card-header").forEach(e=>e.remove()),n&&l.querySelectorAll(".mgh-grid-toolbar").forEach(e=>e.remove()),o&&l.querySelectorAll(".mgh-grid-footer").forEach(e=>e.remove()),a||l.querySelectorAll(".mgh-grid-columns").forEach(e=>e.remove()),l.classList.add("mgh-grid-card--plain"),l.querySelectorAll("[id]").forEach(e=>e.removeAttribute("id")),l.style.height="auto",l.style.flexGrow="0";const d=t.title??"",{styles:s,links:c}=i?(e=>{const t=[],r=[];return Array.from(e.styleSheets).forEach(e=>{try{const r=Array.from(e.cssRules).map(e=>e.cssText).join("\n");r&&t.push(r)}catch{e.href&&r.push(e.href)}}),{styles:t,links:r}})(document):{styles:[],links:[]},g=document.createElement("iframe");g.setAttribute("aria-hidden","true"),g.setAttribute("data-mgh-grid-print","true"),g.style.cssText="position:fixed;right:0;bottom:0;width:0;height:0;border:0;opacity:0;pointer-events:none;",document.body.appendChild(g);let m=!1;const p=()=>{m||(m=!0,window.setTimeout(()=>{g.parentNode&&g.parentNode.removeChild(g)},500),r())},u=g.contentWindow,h=g.contentDocument||u?.document;if(!u||!h)return void p();h.open(),h.write(`<!doctype html><html><head><meta charset="utf-8" /><title>${bt(d||document.title||"Print")}</title>`+c.map(e=>`<link rel="stylesheet" href="${bt(e)}" />`).join("")+"</head><body></body></html>"),h.close(),s.forEach(e=>{const t=h.createElement("style");t.textContent=e,h.head.appendChild(t)});const f=h.createElement("style");if(f.textContent='\n@page { margin: 10mm; }\nhtml, body { margin: 0; padding: 0; background: #fff; }\n.mgh-grid-print-title { margin: 0 0 12px; font: 600 16px/1.4 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; }\n.mgh-grid-card { box-shadow: none !important; border-radius: 0 !important; height: auto !important; max-height: none !important; overflow: visible !important; background: transparent !important; }\n.mgh-grid-box { height: auto !important; max-height: none !important; flex: none !important; }\n.mgh-grid { height: auto !important; max-height: none !important; border-radius: 0 !important; }\n.mgh-grid-main, .mgh-grid-scroller { overflow: visible !important; height: auto !important; max-height: none !important; }\n.mgh-grid-columns, .mgh-grid-pinned-rows, .mgh-grid-detail-panel { position: static !important; box-shadow: none !important; }\n.mgh-grid-header-cell, .mgh-grid-cell { position: static !important; box-shadow: none !important; background-image: none !important; }\n.mgh-grid-detail-panel { width: auto !important; }\n.mgh-grid-body { min-height: 0 !important; }\n.mgh-grid-row, .mgh-grid-row-block, .mgh-grid-detail-panel { break-inside: avoid; page-break-inside: avoid; }\n.mgh-grid-columns { break-after: avoid; page-break-after: avoid; }\n.mgh-grid-header-menu-btn, .mgh-grid-resize-handle, .mgh-grid-overlay, .mgh-grid-sort-icon:not(.mgh-grid-sort-icon--active) { display: none !important; }\n.mgh-grid-popover { display: none !important; }\n'+(t.pageStyle??""),h.head.appendChild(f),d){const e=h.createElement("h1");e.className="mgh-grid-print-title",e.textContent=d,h.body.appendChild(e)}h.body.appendChild(h.adoptNode(l));(async()=>{try{await((e,t)=>new Promise(r=>{const n=Array.from(e.images).filter(e=>!e.complete);if(0===n.length)return void r();let o=n.length,a=!1;const i=()=>{a||(a=!0,r())},l=window.setTimeout(i,t);n.forEach(e=>{const t=()=>{o-=1,o<=0&&(window.clearTimeout(l),i())};e.addEventListener("load",t,{once:!0}),e.addEventListener("error",t,{once:!0})})}))(h,4e3),t.onBeforePrint&&await t.onBeforePrint(h),u.onafterprint=p,u.focus(),u.print(),window.setTimeout(p,1e3)}catch{p()}})()},vt=e=>A(e)?"":e instanceof Date?String(e.getTime()):String(e),wt=(e,t,r,n,o="(empty)")=>{const a=(e,i,l,d)=>{const s=t[i],c=r.get(s);if(!c)return[];const g=new Map;e.forEach(e=>{const t=((e,t,r)=>t.groupingValueGetter?t.groupingValueGetter(e[t.field],e,t,r):ee(e,t,r))(e.row,c,n),r=vt(t);let a=g.get(r);if(!a){const m=ne(re(t,e.row,c,n,e.id))||o;a={id:`auto-generated-row-${d}${s}/${r}`,depth:i,parent:l,groupingField:s,groupingKey:t,groupingLabel:m,childGroups:[],leaves:[],descendants:[]},g.set(r,a)}a.leaves.push(e)});const m=[];return g.forEach(e=>{i<t.length-1?(e.childGroups=a(e.leaves,i+1,e.id,`${d}${s}/${vt(e.groupingKey)}|`),e.descendants=e.leaves,e.leaves=[]):e.descendants=e.leaves,m.push(e)}),m};return a(e,0,null,"")},Et=e=>{const t=[];return e.forEach(e=>e.descendants.forEach(e=>t.push(e))),t},Ct=(e,t,r,n,o)=>{const a={};return Object.keys(t).forEach(i=>{const l=t[i],d=n[l],s=r.get(i);if(!d||!s||!1===s.aggregable)return;const c=e.map(e=>ee(e,s,o));a[i]={value:d.apply({values:c,field:i}),fn:l}}),a},kt=(t,r)=>{const n=e.forwardRef(({size:r=20,className:n,style:o,...a},i)=>e.createElement("svg",{ref:i,viewBox:"0 0 24 24",width:r,height:r,fill:"currentColor",focusable:"false","aria-hidden":"true",className:["mgh-grid-icon",n].filter(Boolean).join(" "),style:o,...a},t));return n.displayName=r,n},Mt=kt(e.createElement("path",{d:"M14.67 5v14H9.33V5h5.34zm1 14H21V5h-5.33v14zm-7.34 0V5H3v14h5.33z"}),"ViewColumnIcon"),St=kt(e.createElement("path",{d:"M10 18h4v-2h-4v2zM3 6v2h18V6H3zm3 7h12v-2H6v2z"}),"FilterListIcon"),Dt=kt(e.createElement("path",{d:"M15.5 14h-.79l-.28-.27A6.471 6.471 0 0 0 16 9.5 6.5 6.5 0 1 0 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z"}),"SearchIcon"),It=kt(e.createElement("path",{d:"M19 6.41 17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"}),"CloseIcon"),Ft=kt(e.createElement("path",{d:"M19 12v7H5v-7H3v7c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2v-7h-2zm-6 .67 2.59-2.58L17 11.5l-5 5-5-5 1.41-1.41L11 12.67V3h2z"}),"DownloadIcon"),Pt=kt(e.createElement("path",{d:"m4 12 1.41 1.41L11 7.83V20h2V7.83l5.58 5.59L20 12l-8-8-8 8z"}),"ArrowUpwardIcon"),Nt=kt(e.createElement("path",{d:"m20 12-1.41-1.41L13 16.17V4h-2v12.17l-5.58-5.59L4 12l8 8 8-8z"}),"ArrowDownwardIcon"),Rt=kt(e.createElement("path",{d:"M12 8c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2zm0 2c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm0 6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2z"}),"MoreVertIcon"),zt=kt(e.createElement("path",{d:"M9 16.17 4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z"}),"CheckIcon"),Ot=kt(e.createElement("path",{d:"M16.59 8.59 12 13.17 7.41 8.59 6 10l6 6 6-6z"}),"ExpandMoreIcon"),Gt=kt(e.createElement("path",{d:"M10 6 8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6z"}),"ChevronRightIcon"),Tt=kt(e.createElement("path",{d:"M15.41 7.41 14 6l-6 6 6 6 1.41-1.41L10.83 12z"}),"ChevronLeftIcon"),At=kt(e.createElement("path",{d:"M18.41 16.59 13.82 12l4.59-4.59L17 6l-6 6 6 6zM6 6h2v12H6z"}),"FirstPageIcon"),Lt=kt(e.createElement("path",{d:"M5.59 7.41 10.18 12l-4.59 4.59L7 18l6-6-6-6zM16 6h2v12h-2z"}),"LastPageIcon"),Ht=kt(e.createElement("path",{d:"M16 9V4h1c.55 0 1-.45 1-1s-.45-1-1-1H7c-.55 0-1 .45-1 1s.45 1 1 1h1v5c0 1.66-1.34 3-3 3v2h5.97v7l1 1 1-1v-7H19v-2c-1.66 0-3-1.34-3-3z"}),"PushPinIcon"),Vt=kt(e.createElement("path",{d:"M6 19c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2V7H6v12zM19 4h-3.5l-1-1h-5l-1 1H5v2h14V4z"}),"DeleteIcon"),$t=kt(e.createElement("path",{d:"M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z"}),"AddIcon"),Bt=kt(e.createElement("path",{d:"M3 2h18v2H3zm0 18h18v2H3zm0-6h18v2H3zm0-6h18v2H3z"}),"DensitySmallIcon"),_t=kt(e.createElement("path",{d:"M3 3h18v2H3zm0 16h18v2H3zm0-8h18v2H3z"}),"DensityMediumIcon"),Ut=kt(e.createElement("path",{d:"M3 3h18v2H3zm0 16h18v2H3z"}),"DensityLargeIcon"),Wt=kt(e.createElement("path",{d:"M11 18c0 1.1-.9 2-2 2s-2-.9-2-2 .9-2 2-2 2 .9 2 2zm-2-8c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm0-6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm6 4c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2zm0 2c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm0 6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2z"}),"DragIndicatorIcon"),qt=kt(e.createElement("path",{d:"M19 8H5c-1.66 0-3 1.34-3 3v6h4v4h12v-4h4v-6c0-1.66-1.34-3-3-3zm-3 11H8v-5h8v5zm3-7c-.55 0-1-.45-1-1s.45-1 1-1 1 .45 1 1-.45 1-1 1zm-1-9H6v4h12V3z"}),"PrintIcon"),jt=kt(e.createElement("path",{d:"M10 10.02h5V21h-5zM17 21h3c1.1 0 2-.9 2-2v-9h-5v11zm3-18H5c-1.1 0-2 .9-2 2v3h19V5c0-1.1-.9-2-2-2zM3 19c0 1.1.9 2 2 2h3V10H3v9z"}),"TableChartIcon"),Yt=kt(e.createElement("path",{d:"M14 2H6c-1.1 0-1.99.9-1.99 2L4 20c0 1.1.89 2 1.99 2H18c1.1 0 2-.9 2-2V8l-6-6zm2 16H8v-2h8v2zm0-4H8v-2h8v2zm-3-5V3.5L18.5 9H13z"}),"DescriptionIcon"),Kt=kt(e.createElement("path",{d:"M12 7c2.76 0 5 2.24 5 5 0 .65-.13 1.26-.36 1.83l2.92 2.92c1.51-1.26 2.7-2.89 3.43-4.75-1.73-4.39-6-7.5-11-7.5-1.4 0-2.74.25-3.98.7l2.16 2.16C10.74 7.13 11.35 7 12 7zM2 4.27l2.28 2.28.46.46A11.804 11.804 0 0 0 1 12c1.73 4.39 6 7.5 11 7.5 1.55 0 3.03-.3 4.38-.84l.42.42L19.73 22 21 20.73 3.27 3 2 4.27zM7.53 9.8l1.55 1.55c-.05.21-.08.43-.08.65 0 1.66 1.34 3 3 3 .22 0 .44-.03.65-.08l1.55 1.55c-.67.33-1.41.53-2.2.53-2.76 0-5-2.24-5-5 0-.79.2-1.53.53-2.2zm4.31-.78 3.15 3.15.02-.16c0-1.66-1.34-3-3-3l-.17.01z"}),"VisibilityOffIcon"),Xt=kt(e.createElement("path",{d:"M18 4H6v2l6.5 6L6 18v2h12v-3h-7l5-5-5-5h7z"}),"FunctionsIcon"),Qt=kt(e.createElement("path",{d:"M6 13c-2.2 0-4 1.8-4 4s1.8 4 4 4 4-1.8 4-4-1.8-4-4-4zm6-10C9.8 3 8 4.8 8 7s1.8 4 4 4 4-1.8 4-4-1.8-4-4-4zm6 10c-2.2 0-4 1.8-4 4s1.8 4 4 4 4-1.8 4-4-1.8-4-4-4z"}),"WorkspacesIcon"),Jt=kt(e.createElement(e.Fragment,null,e.createElement("path",{d:"M20 6h-2.18c.11-.31.18-.65.18-1a2.996 2.996 0 0 0-5.5-1.65l-.5.67-.5-.68C10.96 2.54 10.05 2 9 2 7.34 2 6 3.34 6 5c0 .35.07.69.18 1H4c-1.11 0-1.99.89-1.99 2L2 19c0 1.11.89 2 2 2h16c1.11 0 2-.89 2-2V8c0-1.11-.89-2-2-2z",opacity:".25"}),e.createElement("path",{d:"M4 8h16v11H4z",opacity:".15"})),"EmptyBoxIcon");var Zt=Object.freeze({__proto__:null,AddIcon:$t,ArrowDownwardIcon:Nt,ArrowUpwardIcon:Pt,CheckIcon:zt,ChevronLeftIcon:Tt,ChevronRightIcon:Gt,CloseIcon:It,DeleteIcon:Vt,DensityLargeIcon:Ut,DensityMediumIcon:_t,DensitySmallIcon:Bt,DescriptionIcon:Yt,DownloadIcon:Ft,DragIndicatorIcon:Wt,EmptyBoxIcon:Jt,ExpandMoreIcon:Ot,FilterListIcon:St,FirstPageIcon:At,FunctionsIcon:Xt,LastPageIcon:Lt,MoreVertIcon:Rt,PrintIcon:qt,PushPinIcon:Ht,SearchIcon:Dt,TableChartIcon:jt,ViewColumnIcon:Mt,VisibilityOffIcon:Kt,WorkspacesIcon:Qt});const er=e.forwardRef(({variant:t="text",size:r="medium",startIcon:n,endIcon:o,active:a,className:i,children:l,type:d="button",...s},c)=>e.createElement("button",{ref:c,type:d,className:V("mgh-grid-btn","primary"===t&&"mgh-grid-btn--primary","contained"===t&&"mgh-grid-btn--contained","small"===r&&"mgh-grid-btn--small",a&&"mgh-grid-btn--active",i),...s},n,l,o));er.displayName="MGHGridButton";const tr=e.forwardRef(({size:t="medium",active:r,label:n,className:o,children:a,type:i="button",...l},d)=>e.createElement("button",{ref:d,type:i,title:n,"aria-label":n,className:V("mgh-grid-btn mgh-grid-btn--icon","small"===t&&"mgh-grid-btn--small",r&&"mgh-grid-btn--active",o),...l},a));tr.displayName="MGHGridIconButton";const rr=({count:t=0,variant:r="dot",children:n})=>e.createElement("span",{className:"mgh-grid-badge"},n,t>0&&("dot"===r?e.createElement("span",{className:"mgh-grid-badge-dot"}):e.createElement("span",{className:"mgh-grid-badge-count"},t>99?"99+":t))),nr=e.forwardRef(({size:t="medium",className:r,...n},o)=>e.createElement("input",{ref:o,className:V("mgh-grid-input","small"===t&&"mgh-grid-input--small",r),...n}));nr.displayName="MGHGridTextInput";const or=e.forwardRef(({size:t="medium",className:r,...n},o)=>e.createElement("select",{ref:o,className:V("mgh-grid-select","small"===t&&"mgh-grid-select--small",r),...n}));or.displayName="MGHGridSelect";const ar=({label:t,children:r,className:n,htmlFor:o})=>e.createElement("div",{className:V("mgh-grid-field",n)},t&&e.createElement("label",{className:"mgh-grid-field-label",htmlFor:o},t),r),ir=e.forwardRef(({indeterminate:t=!1,label:r,className:n,...o},a)=>{const i=e.useRef(null),l=e.useCallback(e=>{i.current=e,"function"==typeof a?a(e):a&&(a.current=e)},[a]);return e.useEffect(()=>{i.current&&(i.current.indeterminate=t)},[t]),e.createElement("input",{ref:l,type:"checkbox",title:r,"aria-label":r,className:V("mgh-grid-checkbox",n),...o})});ir.displayName="MGHGridCheckbox";const lr=({className:t})=>e.createElement("div",{className:V("mgh-grid-spinner",t),role:"progressbar","aria-label":"Loading"});function dr({open:t,anchorEl:r,onClose:n,children:o,placement:a="bottom-start",themeMode:i="light",className:l,style:d,offset:s=4,role:c="dialog",autoFocus:g=!1,ignoreOutsideClickOn:m}){const p=e.useRef(null),[h,f]=e.useState({top:0,left:0,ready:!1}),b=e.useCallback(()=>{const e=p.current;if(!e)return;const t=window.innerWidth,n=window.innerHeight,o=e.offsetWidth,i=e.offsetHeight;let l,d;if(r&&r.isConnected){const e=r.getBoundingClientRect();"right-start"===a?(l=e.top,d=e.right+s,d+o>t-8&&(d=e.left-s-o)):(l=e.bottom+s,l+i>n-8&&e.top-s-i>=8&&(l=e.top-s-i),d="bottom-end"===a?e.right-o:"bottom"===a?e.left+e.width/2-o/2:e.left)}else l=n/2-i/2,d=t/2-o/2;l=H(l,8,Math.max(8,n-i-8)),d=H(d,8,Math.max(8,t-o-8)),f(e=>e.ready&&e.top===l&&e.left===d?e:{top:l,left:d,ready:!0})},[r,a,s]);if(e.useLayoutEffect(()=>{if(!t)return void f(e=>e.ready?{...e,ready:!1}:e);b(),window.addEventListener("resize",b),window.addEventListener("scroll",b,!0);let e=null;return"undefined"!=typeof ResizeObserver&&p.current&&(e=new ResizeObserver(()=>b()),e.observe(p.current)),()=>{window.removeEventListener("resize",b),window.removeEventListener("scroll",b,!0),e?.disconnect()}},[t,b]),e.useEffect(()=>{if(!t)return;const e=e=>{const t=e.target;t&&(p.current?.contains(t)||r?.contains(t)||m?.some(e=>e.current?.contains(t))||t.closest?.(".mgh-grid-popover")||n("backdrop"))},o=e=>{"Escape"===e.key&&n("escape")};return document.addEventListener("mousedown",e,!0),document.addEventListener("touchstart",e,!0),document.addEventListener("keydown",o),()=>{document.removeEventListener("mousedown",e,!0),document.removeEventListener("touchstart",e,!0),document.removeEventListener("keydown",o)}},[t,n,r,m]),e.useEffect(()=>{if(t&&g&&p.current){(p.current.querySelector('input, select, textarea, button, [tabindex]:not([tabindex="-1"])')??p.current).focus()}},[t,g]),!t||"undefined"==typeof document)return null;const x=e=>e.stopPropagation();return u.createPortal(e.createElement("div",{ref:p,role:c,tabIndex:-1,className:V("mgh-grid-popover",l),"data-mgh-theme":i,style:{top:h.top,left:h.left,visibility:h.ready?"visible":"hidden",...d},onClick:x,onDoubleClick:x,onMouseDown:x,onKeyDown:e=>{if("Escape"===e.key)return e.stopPropagation(),void n("escape");e.stopPropagation()}},o),document.body)}const sr=({children:t,className:r,onKeyDown:n,...o})=>{const a=e.useRef(null);return e.useEffect(()=>{const e=a.current?.querySelector('[role="menuitem"]:not([aria-disabled="true"])');e?.focus()},[]),e.createElement("ul",{ref:a,role:"menu",className:V("mgh-grid-menu",r),onKeyDown:e=>{if(n?.(e),"ArrowDown"!==e.key&&"ArrowUp"!==e.key&&"Home"!==e.key&&"End"!==e.key)return;const t=Array.from(a.current?.querySelectorAll('[role="menuitem"]:not([aria-disabled="true"])')??[]);if(0===t.length)return;e.preventDefault();const r=t.indexOf(document.activeElement);let o=0;o="ArrowDown"===e.key?r<0?0:(r+1)%t.length:"ArrowUp"===e.key?r<0?t.length-1:(r-1+t.length)%t.length:"Home"===e.key?0:t.length-1,t[o].focus()},...o},t)},cr=e.forwardRef(({icon:t,selected:r,disabled:n,className:o,children:a,onClick:i,hideMenu:l,...d},s)=>e.createElement("li",{role:"none"},e.createElement("button",{ref:s,type:"button",role:"menuitem","aria-disabled":n||void 0,disabled:n,tabIndex:-1,className:V("mgh-grid-menu-item",n&&"mgh-grid-menu-item--disabled",r&&"mgh-grid-menu-item--selected",o),onClick:e=>{n||(i?.(e),l?.())},...d},t,e.createElement("span",null,a))));cr.displayName="MGHGridMenuItem";const gr=()=>e.createElement("li",{role:"separator",className:"mgh-grid-menu-divider"}),mr=({children:t})=>e.createElement("li",{role:"presentation",className:"mgh-grid-menu-section"},t);function pr(){const{api:t,state:r,localeText:n}=Be(),o=r.preferencePanel.open&&"columns"===r.preferencePanel.openedPanelValue;return e.createElement(tr,{label:n.toolbarColumns,active:o,"aria-haspopup":"dialog","aria-expanded":o,onClick:e=>o?t.hidePreferences():t.showPreferences("columns",e.currentTarget)},e.createElement(Mt,null))}function ur(){const{api:t,state:r,localeText:n}=Be(),o=r.preferencePanel.open&&"filters"===r.preferencePanel.openedPanelValue;return e.createElement(tr,{label:n.toolbarFilters,active:o,"aria-haspopup":"dialog","aria-expanded":o,onClick:e=>o?t.hidePreferences():t.showPreferences("filters",e.currentTarget)},e.createElement(rr,{count:r.filterCount,variant:"dot"},e.createElement(St,null)))}function hr(){const{api:t,state:r,localeText:n,themeMode:o}=Be(),[a,i]=e.useState(null),l=[{value:"compact",label:n.densityCompact,icon:e.createElement(Bt,null)},{value:"standard",label:n.densityStandard,icon:e.createElement(_t,null)},{value:"comfortable",label:n.densityComfortable,icon:e.createElement(Ut,null)}],d=l.find(e=>e.value===r.density)??l[1];return e.createElement(e.Fragment,null,e.createElement(tr,{label:n.toolbarDensity,active:Boolean(a),"aria-haspopup":"menu",onClick:e=>i(t=>t?null:e.currentTarget)},d.icon),e.createElement(dr,{open:Boolean(a),anchorEl:a,onClose:()=>i(null),themeMode:o,role:"menu"},e.createElement(sr,null,l.map(n=>e.createElement(cr,{key:n.value,icon:n.icon,selected:n.value===r.density,onClick:()=>t.setDensity(n.value),hideMenu:()=>i(null)},n.label)))))}const fr=cr;function br({csvOptions:t={allColumns:!0},excelOptions:r={allColumns:!0},printOptions:n,showCsvOption:o=!0,showExcelOption:a=!0,showPrintOption:i=!0,customMenuItem:l}){const{api:d,localeText:s,themeMode:c,rootProps:g}=Be(),[m,p]=e.useState(null),u=()=>p(null),h=e.Children.map(l,t=>e.isValidElement(t)?e.cloneElement(t,{hideMenu:u}):t),f={title:"string"==typeof g.header?g.header:void 0,...n};return e.createElement(e.Fragment,null,e.createElement(tr,{label:s.toolbarExport,active:Boolean(m),"aria-haspopup":"menu",onClick:e=>p(t=>t?null:e.currentTarget)},e.createElement(Ft,null)),e.createElement(dr,{open:Boolean(m),anchorEl:m,onClose:u,themeMode:c,role:"menu"},e.createElement(sr,null,h,o&&e.createElement(cr,{icon:e.createElement(Yt,null),onClick:()=>d.exportDataAsCsv(t),hideMenu:u},s.toolbarExportCSV),a&&e.createElement(cr,{icon:e.createElement(jt,null),onClick:()=>{d.exportDataAsExcel(r)},hideMenu:u},s.toolbarExportExcel),i&&e.createElement(cr,{icon:e.createElement(qt,null),onClick:()=>d.exportDataAsPrint(f),hideMenu:u},s.toolbarExportPrint))))}function xr({placeholder:t,debounceMs:r,alwaysExpanded:n=!1}){const{api:o,state:a,localeText:i,rootProps:l}=Be(),d=(a.quickFilterValues??[]).join(" "),[s,c]=e.useState(d),[g,m]=e.useState(n||""!==d),p=e.useRef(null),u=e.useRef(null),h=r??l.quickFilterDebounceMs,f=e.useRef(d);e.useEffect(()=>{d!==f.current&&(f.current=d,c(d),""!==d&&m(!0))},[d]),e.useEffect(()=>()=>{null!==u.current&&window.clearTimeout(u.current)},[]);const b=e=>{const t=e.split(/\s+/).filter(e=>""!==e);f.current=t.join(" "),o.setQuickFilterValues(t)},x=()=>{null!==u.current&&window.clearTimeout(u.current),c(""),b(""),p.current?.focus()},y=n||g;return e.createElement("div",{className:V("mgh-grid-quick-filter",y&&"mgh-grid-quick-filter--expanded")},e.createElement(tr,{className:"mgh-grid-quick-filter-trigger",label:i.toolbarQuickFilterLabel,"aria-disabled":y,tabIndex:y?-1:0,onClick:()=>{m(!0),window.setTimeout(()=>p.current?.focus(),0)}},e.createElement(Dt,null)),e.createElement("div",{className:V("mgh-grid-quick-filter-control mgh-grid-input-adorned",s&&"mgh-grid-input-adorned--clearable")},e.createElement("span",{className:"mgh-grid-input-adornment"},e.createElement(Dt,{size:18})),e.createElement(nr,{ref:p,size:"small",type:"search",value:s,tabIndex:y?0:-1,placeholder:t??i.toolbarQuickFilterPlaceholder,"aria-label":i.toolbarQuickFilterLabel,onChange:e=>{return t=e.target.value,c(t),null!==u.current&&window.clearTimeout(u.current),void(u.current=window.setTimeout(()=>b(t),h));var t},onBlur:()=>{n||""!==s.trim()||m(!1)},onKeyDown:e=>{"Escape"===e.key&&(e.stopPropagation(),s?x():n||(m(!1),p.current?.blur())),"Enter"===e.key&&(null!==u.current&&window.clearTimeout(u.current),b(s))}}),s&&e.createElement("span",{className:"mgh-grid-input-adornment mgh-grid-input-adornment--end"},e.createElement(tr,{size:"small",label:i.clearSearch,onClick:x,tabIndex:-1},e.createElement(It,null)))))}function yr({showColumnsButton:t=!0,showFilterButton:r=!0,showExportButton:n=!0,showQuickFilter:o=!0,showDensitySelector:a=!1,showCsvOption:i=!0,showExcelOption:l=!0,showPrintOption:d=!0,csvOptions:s,excelOptions:c,printOptions:g,renderOtherButtons:m,renderDateRange:p,customMenuItem:u,quickFilterPlaceholder:h,quickFilterDebounceMs:f}){const{rootProps:b}=Be(),x=t&&!b.disableColumnSelector,y=r&&!b.disableColumnFilter,v=a&&!b.disableDensitySelector;return e.createElement("div",{className:"mgh-grid-toolbar",role:"toolbar"},e.createElement("div",{className:"mgh-grid-toolbar-group"},x&&e.createElement(pr,null),y&&e.createElement(ur,null),v&&e.createElement(hr,null),n&&e.createElement(br,{csvOptions:s,excelOptions:c,printOptions:g,showCsvOption:i,showExcelOption:l,showPrintOption:d,customMenuItem:u})),p&&e.createElement("div",{className:"mgh-grid-toolbar-center"},p),e.createElement("div",{className:"mgh-grid-toolbar-group"},m,o&&e.createElement(xr,{placeholder:h,debounceMs:f})))}function vr(){const{api:t,state:r,localeText:n,rootProps:o}=Be(),{page:a,pageSize:i}=r.paginationModel,l=r.rowCount,d=r.pageCount,s=0===l?0:a*i+1,c=Math.min(l,(a+1)*i),g=-1===o.pageSizeOptions.indexOf(i)?o.pageSizeOptions.concat([i]).sort((e,t)=>e-t):o.pageSizeOptions;return e.createElement("div",{className:"mgh-grid-pagination",role:"navigation","aria-label":"Pagination"},e.createElement("span",null,n.footerPaginationRowsPerPage),e.createElement(or,{className:"mgh-grid-pagination-select",value:i,"aria-label":n.footerPaginationRowsPerPage,onChange:e=>t.setPageSize(Number(e.target.value))},g.map(t=>e.createElement("option",{key:t,value:t},t))),e.createElement("span",null,n.footerPaginationDisplayedRows(s,c,l)),e.createElement("div",{className:"mgh-grid-pagination-actions"},e.createElement(tr,{label:n.footerPaginationFirstPage,disabled:a<=0,onClick:()=>t.setPage(0)},e.createElement(At,null)),e.createElement(tr,{label:n.footerPaginationPreviousPage,disabled:a<=0,onClick:()=>t.setPage(a-1)},e.createElement(Tt,null)),e.createElement(tr,{label:n.footerPaginationNextPage,disabled:a>=d-1,onClick:()=>t.setPage(a+1)},e.createElement(Gt,null)),e.createElement(tr,{label:n.footerPaginationLastPage,disabled:a>=d-1,onClick:()=>t.setPage(Math.max(d-1,0))},e.createElement(Lt,null))))}function wr(){const{state:t,localeText:r,rootProps:n}=Be(),o=t.rowSelectionModel.ids.size,a=o>0&&!n.hideFooterSelectedRowCount,i=n.pagination&&!n.hideFooterPagination,l=!i&&!n.hideFooterRowCount;return e.createElement("div",{className:"mgh-grid-footer"},e.createElement("div",{className:"mgh-grid-footer-left"},a&&e.createElement("span",null,r.footerRowSelected(o))),l&&e.createElement("span",null,r.footerTotalRows," ",t.rowCount.toLocaleString()),i&&e.createElement(vr,null))}function Er(){const{api:t,state:r,localeText:n,columns:o,visibleColumns:a}=Be(),i=e.useMemo(()=>new Set(a.map(e=>e.field)),[a]),[l,d]=e.useState(""),s=r.columnVisibilityModel,c=o.filter(e=>!1!==e.hideable),g=l.trim().toLowerCase(),m=g?c.filter(e=>-1!==(e.headerName??e.field).toLowerCase().indexOf(g)):c,p=e=>{const r={...s};c.forEach(t=>{r[t.field]=e}),t.setColumnVisibilityModel(r)};return e.createElement("div",{className:"mgh-grid-panel",role:"group","aria-label":n.toolbarColumns},e.createElement("div",{className:"mgh-grid-panel-header"},e.createElement("div",{className:"mgh-grid-input-adorned"},e.createElement("span",{className:"mgh-grid-input-adornment"},e.createElement(Dt,{size:18})),e.createElement(nr,{autoFocus:!0,size:"small",value:l,placeholder:n.columnsPanelSearchPlaceholder,"aria-label":n.columnsPanelSearchPlaceholder,onChange:e=>d(e.target.value)}))),e.createElement("div",{className:"mgh-grid-panel-content"},e.createElement("div",{className:"mgh-grid-columns-list"},m.map(r=>{const n=i.has(r.field);return e.createElement("label",{key:r.field,className:"mgh-grid-checkbox-label"},e.createElement(ir,{checked:n,onChange:()=>t.setColumnVisibility(r.field,!n)}),e.createElement("span",null,r.headerName??r.field))}),0===m.length&&e.createElement("div",{className:"mgh-grid-filter-empty"},"No columns"))),e.createElement("div",{className:"mgh-grid-panel-footer"},e.createElement(er,{variant:"primary",size:"small",onClick:()=>p(!0)},n.columnsPanelShowAll),e.createElement(er,{variant:"primary",size:"small",onClick:()=>p(!1)},n.columnsPanelHideAll),e.createElement(er,{size:"small",onClick:()=>t.setColumnVisibilityModel({})},n.columnsPanelReset)))}const Cr=(t,r,n=250)=>{const[o,a]=e.useState(t??""),i=e.useRef(null);e.useEffect(()=>{a(t??"")},[t]);return e.useEffect(()=>()=>{null!==i.current&&window.clearTimeout(i.current)},[]),[o,e=>{a(e),null!==i.current&&window.clearTimeout(i.current),i.current=window.setTimeout(()=>r(e),n)}]};function kr({item:t,onChange:r,placeholder:n,type:o}){const[a,i]=Cr(t.value,r);return e.createElement(nr,{size:"small",type:o,value:a,placeholder:n,"aria-label":n,onChange:e=>i(e.target.value)})}function Mr({item:t,column:r,onChange:n,placeholder:o}){const a=Array.isArray(t.value)?t.value.join(", "):t.value??"",[i,l]=Cr(a,e=>n(String(e).split(",").map(e=>e.trim()).filter(e=>""!==e)));if("singleSelect"===r.type){const a=Z(r),i=Array.isArray(t.value)?t.value.map(String):[];return e.createElement(or,{multiple:!0,size:"small",value:i,"aria-label":o,onChange:e=>{const t=Array.from(e.target.selectedOptions).map(e=>{const t=a.find(t=>String(Q(r,t))===e.value);return void 0!==t?Q(r,t):e.value});n(t)}},a.map(t=>{const n=Q(r,t);return e.createElement("option",{key:String(n),value:String(n)},J(r,t))}))}return e.createElement(nr,{size:"small",value:i,placeholder:"Comma separated values","aria-label":o,onChange:e=>l(e.target.value)})}function Sr(t){const{item:r,column:n,operator:o,onChange:a,placeholder:i}=t,{api:l}=Be(),d=o?.inputType??"text";if(o?.InputComponent){const t=o.InputComponent;return e.createElement(t,{item:r,column:n,applyValue:e=>a(e.value),api:l})}switch(d){case"none":return e.createElement("div",null);case"boolean":return e.createElement(or,{size:"small",value:void 0===r.value||null===r.value?"":String(r.value),"aria-label":i,onChange:e=>a(""===e.target.value?void 0:e.target.value)},e.createElement("option",{value:""},"any"),e.createElement("option",{value:"true"},"yes"),e.createElement("option",{value:"false"},"no"));case"select":{const t=Z(n);return e.createElement(or,{size:"small",value:void 0===r.value||null===r.value?"":String(r.value),"aria-label":i,onChange:e=>{const r=t.find(t=>String(Q(n,t))===e.target.value);a(""===e.target.value?void 0:void 0!==r?Q(n,r):e.target.value)}},e.createElement("option",{value:""}),t.map(t=>{const r=Q(n,t);return e.createElement("option",{key:String(r),value:String(r)},J(n,t))}))}case"multiselect":return e.createElement(Mr,{...t});case"number":return e.createElement(kr,{...t,type:"number"});case"date":return e.createElement(kr,{...t,type:"date"});case"datetime-local":return e.createElement(kr,{...t,type:"datetime-local"});default:return e.createElement(kr,{...t,type:"text"})}}const Dr=e=>({id:$("filter"),field:e?.field??"",operator:e?we(e)[0]?.value??"contains":"contains",value:void 0});function Ir(){const{api:t,state:r,localeText:n,columns:o,rootProps:a}=Be(),i=e.useMemo(()=>o.filter(e=>!1!==e.filterable),[o]),l=e.useMemo(()=>{const e=new Map;return i.forEach(t=>e.set(t.field,t)),e},[i]),d=r.filterModel.items,s=r.filterModel.logicOperator??"and",c=r.preferencePanel.targetField,g=e.useRef(!1);e.useEffect(()=>{if(!g.current)if(g.current=!0,c&&l.has(c)){d.find(e=>e.field===c)||t.upsertFilterItem(Dr(l.get(c)))}else 0===d.length&&i.length>0&&t.upsertFilterItem(Dr(i[0]))},[t,l,i,d,c]);const m=(e,r)=>{t.upsertFilterItem({...e,...r})},p=!a.disableMultipleColumnsFiltering||0===d.length;return e.createElement("div",{className:"mgh-grid-panel",role:"group","aria-label":n.toolbarFilters},e.createElement("div",{className:"mgh-grid-panel-content",style:{paddingTop:12}},0===d.length&&e.createElement("div",{className:"mgh-grid-filter-empty"},"No filters"),d.map((r,o)=>{const a=l.get(r.field)??i[0],c=a?we(a):[],g=c.find(e=>e.value===r.operator)??c[0],p=d.length>1;return e.createElement("div",{key:String(r.id??o),className:p?"mgh-grid-filter-row mgh-grid-filter-row--with-logic":"mgh-grid-filter-row"},e.createElement(tr,{size:"small",label:n.filterPanelDeleteIcon,onClick:()=>t.deleteFilterItem(r)},e.createElement(Vt,null)),p&&e.createElement(ar,{label:1===o?n.filterPanelLogicOperator:" "},0===o?e.createElement("div",{style:{height:32}}):e.createElement(or,{size:"small",value:s,disabled:o>1,"aria-label":n.filterPanelLogicOperator,onChange:e=>t.setFilterLogicOperator(e.target.value)},e.createElement("option",{value:"and"},n.filterPanelOperatorAnd),e.createElement("option",{value:"or"},n.filterPanelOperatorOr))),e.createElement(ar,{label:n.filterPanelColumns},e.createElement(or,{size:"small",value:a?.field??"","aria-label":n.filterPanelColumns,onChange:e=>{const t=l.get(e.target.value),n=t?we(t):[],o=n.some(e=>e.value===r.operator);m(r,{field:e.target.value,operator:o?r.operator:n[0]?.value??"contains",value:void 0})}},i.map(t=>e.createElement("option",{key:t.field,value:t.field},t.headerName??t.field)))),e.createElement(ar,{label:n.filterPanelOperator},e.createElement(or,{size:"small",value:g?.value??"","aria-label":n.filterPanelOperator,onChange:e=>{const t=c.find(t=>t.value===e.target.value),n="multiselect"===t?.inputType,o="multiselect"===g?.inputType;m(r,{operator:e.target.value,value:n!==o?void 0:r.value})}},c.map(t=>e.createElement("option",{key:t.value,value:t.value},t.label??t.value)))),e.createElement(ar,{label:n.filterPanelValue},a?e.createElement(Sr,{item:r,column:a,operator:g,placeholder:n.filterPanelInputPlaceholder,onChange:e=>m(r,{value:e})}):e.createElement("div",null)))})),e.createElement("div",{className:"mgh-grid-panel-footer"},e.createElement(er,{variant:"primary",size:"small",startIcon:e.createElement($t,{size:18}),onClick:()=>{t.upsertFilterItem(Dr(i[0]))},disabled:!p},n.filterPanelAddFilter),e.createElement(er,{size:"small",startIcon:e.createElement(Vt,{size:18}),disabled:0===d.length,onClick:()=>t.setFilterModel({...r.filterModel,items:[]})},n.filterPanelRemoveAll)))}function Fr({column:t,anchorEl:r,open:n,onClose:o,themeMode:a,panelAnchorEl:i}){const{api:l,state:d,localeText:s,rootProps:c}=Be(),g=t.field,m=g===D,p=d.sortModel.find(e=>e.field===g),u=l.isColumnPinned(g),h=-1!==d.rowGroupingModel.indexOf(g),f=d.aggregationModel[g],b=!1!==t.sortable&&!c.disableColumnSorting,x=!1!==t.filterable&&!c.disableColumnFilter&&!m,y=!1!==t.hideable,v=!1!==t.pinnable&&!c.disableColumnPinning,w=!1!==t.groupable&&!c.disableRowGrouping&&!m,E=Object.keys(c.aggregationFunctions).filter(e=>{const r=c.aggregationFunctions[e];return(!t.availableAggregationFunctions||-1!==t.availableAggregationFunctions.indexOf(e))&&(!r.columnTypes||!t.type||-1!==r.columnTypes.indexOf(t.type))}),C=!1!==t.aggregable&&!c.disableAggregation&&!m&&E.length>0,k=i??r,M=t.headerName??t.field;return e.createElement(dr,{open:n,anchorEl:r,onClose:o,themeMode:a,placement:"bottom-end",role:"menu"},e.createElement(sr,{"aria-label":s.columnMenuLabel},b&&e.createElement(e.Fragment,null,e.createElement(cr,{icon:e.createElement(Pt,null),selected:"asc"===p?.sort,onClick:()=>l.sortColumn(g,"asc"),hideMenu:o},s.columnMenuSortAsc),e.createElement(cr,{icon:e.createElement(Nt,null),selected:"desc"===p?.sort,onClick:()=>l.sortColumn(g,"desc"),hideMenu:o},s.columnMenuSortDesc),p&&e.createElement(cr,{icon:e.createElement("span",{style:{width:20}}),onClick:()=>l.sortColumn(g,null),hideMenu:o},s.columnMenuUnsort)),x&&e.createElement(e.Fragment,null,b&&e.createElement(gr,null),e.createElement(cr,{icon:e.createElement(St,null),onClick:()=>l.showFilterPanel(g,k),hideMenu:o},s.columnMenuFilter)),(y||!c.disableColumnSelector)&&e.createElement(e.Fragment,null,(b||x)&&e.createElement(gr,null),y&&e.createElement(cr,{icon:e.createElement(Kt,null),onClick:()=>l.setColumnVisibility(g,!1),hideMenu:o},s.columnMenuHideColumn),!c.disableColumnSelector&&e.createElement(cr,{icon:e.createElement(Mt,null),onClick:()=>l.showPreferences("columns",k),hideMenu:o},s.columnMenuManageColumns)),v&&e.createElement(e.Fragment,null,e.createElement(gr,null),"left"!==u&&e.createElement(cr,{icon:e.createElement(Ht,{style:{transform:"rotate(30deg)"}}),onClick:()=>l.pinColumn(g,"left"),hideMenu:o},s.columnMenuPinLeft),"right"!==u&&e.createElement(cr,{icon:e.createElement(Ht,{style:{transform:"rotate(-30deg)"}}),onClick:()=>l.pinColumn(g,"right"),hideMenu:o},s.columnMenuPinRight),u&&e.createElement(cr,{icon:e.createElement("span",{style:{width:20}}),onClick:()=>l.unpinColumn(g),hideMenu:o},s.columnMenuUnpin)),w&&e.createElement(e.Fragment,null,e.createElement(gr,null),e.createElement(cr,{icon:e.createElement(Qt,null),onClick:()=>h?l.removeRowGroupingCriteria(g):l.addRowGroupingCriteria(g),hideMenu:o},h?s.columnMenuUngroup(M):s.columnMenuGroup(M))),C&&e.createElement(e.Fragment,null,e.createElement(gr,null),e.createElement(mr,null,e.createElement("label",{className:"mgh-grid-field-label",style:{display:"flex",alignItems:"center",gap:6}},e.createElement(Xt,{size:16})," ",s.columnMenuAggregation),e.createElement(or,{size:"small",value:f??"","aria-label":s.columnMenuAggregation,onChange:e=>{const t={...d.aggregationModel};""===e.target.value?delete t[g]:t[g]=e.target.value,l.setAggregationModel(t)}},e.createElement("option",{value:""},s.aggregationFunctionLabelNone),E.map(t=>e.createElement("option",{key:t,value:t},c.aggregationFunctions[t].label??t)))))))}function Pr({text:t="No rows",imageSrc:r}){return e.createElement("div",{className:"mgh-grid-no-rows",role:"status"},r?e.createElement("img",{alt:"",src:r}):e.createElement(Jt,{size:50}),e.createElement("div",null,t))}function Nr({text:t}){return e.createElement(e.Fragment,null,e.createElement(lr,null),t&&e.createElement("div",null,t))}function Rr({icon:t,label:r,onClick:n,showInMenu:o,disabled:a,className:i,...l}){return e.createElement(tr,{size:"small",label:r,disabled:a,className:i,onClick:e=>{e.stopPropagation(),n?.(e)},...l},t)}function zr({actions:t,themeMode:r,moreLabel:n}){const[o,a]=e.useState(null),i=[],l=[];return t.forEach(t=>{e.isValidElement(t)&&(t.props?.showInMenu?l.push(t):i.push(t))}),e.createElement(e.Fragment,null,i.map((t,r)=>e.createElement(e.Fragment,{key:t.key??r},t)),l.length>0&&e.createElement(e.Fragment,null,e.createElement(tr,{size:"small",label:n,active:Boolean(o),onClick:e=>{e.stopPropagation(),a(t=>t?null:e.currentTarget)}},e.createElement(Rt,null)),e.createElement(dr,{open:Boolean(o),anchorEl:o,onClose:()=>a(null),themeMode:r,placement:"bottom-end",role:"menu"},e.createElement(sr,null,l.map((t,r)=>{const n=t.props;return e.createElement(cr,{key:t.key??r,icon:n.icon,disabled:n.disabled,onClick:e=>{n.onClick?.(e),a(null)}},n.label)})))))}Rr.displayName="MGHGridActionsCellItem";const Or=[],Gr={},Tr=new Map,Ar=["asc","desc",null],Lr=[10,25,50,100],Hr={items:[],quickFilterExcludeHiddenColumns:!1},Vr=e=>{if(!e)return;const t={};return Object.keys(e).forEach(r=>{if(De(r))return;const n=e[r];"string"!=typeof n&&"number"!=typeof n||(t[r]=n)}),t},$r=(e,t)=>{const r=j(e);if(!r)return"";const n=e=>String(e).padStart(2,"0"),o=`${r.getFullYear()}-${n(r.getMonth()+1)}-${n(r.getDate())}`;return t?`${o}T${n(r.getHours())}:${n(r.getMinutes())}`:o};function Br(t){const{rows:r,columns:n,getRowId:o,loading:a=!1,header:i,renderHeaderEndContent:l,renderHeaderCenterContent:d,disableCard:s=!1,className:c,cardClassName:g,boxClassName:m,cardStyle:p,cardSx:u,boxStyle:h,boxSx:f,style:b,sx:x,themeMode:y="light",themeVars:v,showToolbar:w=!0,toolbarProps:E,slots:C=Gr,slotProps:k=Gr,noRowsText:M="No data found within selected parameters.",localeText:S,rowHeight:N=z,columnHeaderHeight:L=O,getRowHeight:$,autoHeight:B=!1,disableVirtualization:Y=!1,density:K,onDensityChange:X,disableDensitySelector:oe=!1,pagination:ae=!0,pageSize:ie=25,pageSizeOptions:le=Lr,paginationModel:de,onPaginationModelChange:se,hideFooter:ce=!1,hideFooterPagination:me=!1,hideFooterRowCount:pe=!1,hideFooterSelectedRowCount:ue=!1,sortModel:he,onSortModelChange:fe,sortingOrder:be=Ar,disableMultipleColumnsSorting:xe=!1,disableColumnSorting:ye=!1,filterModel:ve,onFilterModelChange:Ce,disableColumnFilter:Se=!1,disableMultipleColumnsFiltering:De=!1,quickFilterDebounceMs:Ie=150,columnVisibilityModel:Pe,onColumnVisibilityModelChange:ze,columnVisibilityStorageKey:Te,columnOrderStorageKey:Ae,columnWidthStorageKey:Le,pinnedColumnsStorageKey:He,onColumnOrderChange:Be,onColumnWidthChange:_e,disableColumnMenu:qe=!1,disableColumnSelector:Ke=!1,disableColumnResize:Je=!1,disableColumnReorder:Ze=!1,disableColumnPinning:et=!1,pinnedColumns:tt,onPinnedColumnsChange:rt,checkboxSelection:nt=!1,checkboxSelectionVisibleOnly:ot=!1,disableRowSelectionOnClick:at=!0,disableMultipleRowSelection:it=!1,rowSelectionModel:lt,onRowSelectionModelChange:dt,isRowSelectable:st,keepNonExistentRowsSelected:ct=!0,getRowClassName:gt,onRowClick:mt,onRowDoubleClick:pt,onCellClick:ut,onCellDoubleClick:ft,pinnedRows:bt,getDetailPanelContent:yt,getDetailPanelHeight:vt,detailPanelExpandedRowIds:kt,onDetailPanelExpandedRowIdsChange:Mt,rowGroupingModel:St,onRowGroupingModelChange:Dt,defaultGroupingExpansionDepth:Ft=0,groupingColDef:Tt,disableRowGrouping:At=!1,isGroupExpandedByDefault:Lt,aggregationModel:Ht,onAggregationModelChange:Vt,aggregationFunctions:$t,disableAggregation:Bt=!1,aggregationPosition:_t="both",processRowUpdate:Ut,onProcessRowUpdateError:Wt,onCellEditStop:qt,isCellEditable:jt,initialState:Yt,apiRef:Kt,onStateChange:Xt}=t;Ve();const Qt=function(t){const r=e.useId;if(r)return`${t}-${r().replace(/:/g,"")}`;const n=e.useRef(null);return null===n.current&&(We+=1,n.current=`${t}-${We}`),n.current}("mgh-grid"),Jt=e.useRef(null),Zt=e.useRef(null),er=e.useRef(null),rr=e.useRef(null),ar=function(){const[,t]=e.useState(0);return e.useCallback(()=>t(e=>e+1),[])}(),lr=e.useMemo(()=>({...Re,...S}),[S]),sr=e.useRef({}),cr=e.useCallback(()=>({api:sr.current.api}),[]),gr=e.useMemo(()=>{const e=()=>sr.current,t={getRow:t=>e().rowsById.get(t)??null,getRowModels:()=>new Map(e().rowsById),getAllRowIds:()=>e().rowEntries.map(e=>e.id),getRowNode:t=>e().nodesById.get(t)??null,getSortedRows:()=>e().sortedLeaves.map(e=>e.row),getSortedRowIds:()=>e().sortedLeaves.map(e=>e.id),getVisibleRows:()=>e().pagedRows.filter(e=>"leaf"===e.type&&e.row).map(e=>({id:e.id,model:e.row})),getRowIndexRelativeToVisibleRows:t=>e().pagedRows.findIndex(e=>e.id===t),updateRows:t=>{t.forEach(t=>{const r=W(t,e().getRowId),n=e().rowsById.get(r);n&&e().setRowOverride(r,{...n,...t})})},getAllColumns:()=>e().orderedUserColumns,getVisibleColumns:()=>e().visibleUserColumns,getColumn:t=>e().getColumn(t),getColumnIndex:(t,r=!0)=>(r?e().visibleUserColumns:e().orderedUserColumns).findIndex(e=>e.field===t),getColumnVisibilityModel:()=>e().columnVisibilityModel,setColumnVisibility:(t,r)=>e().setColumnVisibilityModel({...e().columnVisibilityModel,[t]:r}),setColumnVisibilityModel:t=>e().setColumnVisibilityModel(t),setColumnWidth:(t,r)=>e().setColumnWidth(t,r),setColumnIndex:(t,r)=>e().setColumnIndex(t,r),autosizeColumns:t=>e().autosizeColumns(t),pinColumn:(t,r)=>e().pinColumn(t,r),unpinColumn:t=>e().unpinColumn(t),isColumnPinned:t=>e().isColumnPinned(t),getPinnedColumns:()=>e().pinnedColumns,setPinnedColumns:t=>e().setPinnedColumns(t),getSortModel:()=>e().sortModel,setSortModel:t=>e().setSortModel(t),sortColumn:(t,r,n)=>e().sortColumn(t,r,n),getFilterModel:()=>e().filterModel,setFilterModel:t=>e().setFilterModel(t),upsertFilterItem:t=>e().upsertFilterItems([t]),upsertFilterItems:t=>e().upsertFilterItems(t),deleteFilterItem:t=>e().deleteFilterItem(t),setFilterLogicOperator:t=>e().setFilterModel({...e().filterModel,logicOperator:t}),setQuickFilterValues:t=>e().setFilterModel({...e().filterModel,quickFilterValues:t}),showFilterPanel:(t,r)=>e().showPreferences("filters",r,t),hideFilterPanel:()=>e().hidePreferences(),showPreferences:(t,r,n)=>e().showPreferences(t,r,n),hidePreferences:()=>e().hidePreferences(),getSelectedRows:()=>{const t=new Map;return e().selectedIds.forEach(r=>{const n=e().rowsById.get(r);n&&t.set(r,n)}),t},getRowSelectionModel:()=>({type:"include",ids:e().selectedIds}),setRowSelectionModel:t=>{const r=q(t,e().rowEntries.map(e=>e.id));e().setSelectedIds(r.ids)},selectRow:(t,r=!0,n=!1)=>e().selectRows([t],r,n),selectRows:(t,r=!0,n=!1)=>e().selectRows(t,r,n),isRowSelected:t=>e().selectedIds.has(t),isRowSelectable:t=>e().isRowSelectableFn(t,e().rowsById.get(t)),setPage:t=>e().setPaginationModel({...e().paginationModel,page:Math.max(0,t)}),setPageSize:t=>e().setPaginationModel({page:0,pageSize:Math.max(1,t)}),setPaginationModel:t=>e().setPaginationModel(t),setDensity:t=>e().setDensity(t),getDataAsCsv:e=>Xe(t,e),exportDataAsCsv:e=>((e,t={})=>{const r=Xe(e,t),n=t.utf8WithBom?Qe:"",o=new Blob([n+r],{type:"text/csv;charset=utf-8;"});Ge(o,je(t.fileName,Ye(),"csv"))})(t,e),exportDataAsExcel:e=>(async(e,t={})=>{const r=ht(e,t),n=new Blob([r],{type:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"});Ge(n,je(t.fileName,Ye(),"xlsx"))})(t,e),exportDataAsPrint:t=>e().startPrint(t),toggleDetailPanel:t=>e().toggleDetailPanel(t),setExpandedDetailPanels:t=>e().setExpandedDetailPanels(new Set(t)),getExpandedDetailPanels:()=>Array.from(e().expandedDetailPanels),getRowGroupingModel:()=>e().rowGroupingModel,setRowGroupingModel:t=>e().setRowGroupingModel(t),addRowGroupingCriteria:(t,r)=>{const n=e().rowGroupingModel.filter(e=>e!==t);void 0===r?n.push(t):n.splice(H(r,0,n.length),0,t),e().setRowGroupingModel(n)},removeRowGroupingCriteria:t=>e().setRowGroupingModel(e().rowGroupingModel.filter(e=>e!==t)),setRowChildrenExpansion:(t,r)=>e().setRowChildrenExpansion(t,r),getRowGroupChildren:({groupId:t})=>{const r=e().groupsById.get(t);return r?r.descendants.map(e=>e.id):[]},getAggregationModel:()=>e().aggregationModel,setAggregationModel:t=>e().setAggregationModel(t),startCellEditMode:({id:t,field:r})=>e().startCellEditMode(t,r),stopCellEditMode:({id:t,field:r,ignoreModifications:n})=>e().stopCellEditMode(t,r,n,"api"),getCellMode:(t,r)=>{const n=e().editingCell;return n&&n.id===t&&n.field===r?"edit":"view"},setEditCellValue:({id:t,field:r,value:n})=>{const o=e().editingCell;o&&o.id===t&&o.field===r&&e().setEditValue(n)},getCellValue:(r,n)=>{const o=e().rowsById.get(r),a=e().getColumn(n);return o&&a?ee(o,a,t):void 0},getCellParams:(t,r)=>{const n=e().rowsById.get(t);return e().buildCellParams(t,r,n,e().nodesById.get(t)??{type:"leaf",id:t,depth:0,parent:null})},setCellFocus:(t,r)=>{cn.current=!0,e().setFocusedCell({id:t,field:r})},scrollToIndexes:t=>e().scrollToIndexes(t),scroll:({left:e,top:t})=>{const r=er.current;r&&(void 0!==e&&(r.scrollLeft=e),void 0!==t&&(r.scrollTop=t))},getScrollPosition:()=>({left:er.current?.scrollLeft??0,top:er.current?.scrollTop??0}),get state(){return e().state},forceUpdate:()=>e().forceUpdate(),rootElementRef:Jt};return t},[]);sr.current.api||(sr.current.api=gr);const mr=e.useMemo(()=>({visibility:Te?_(Te):null,order:Ae?_(Ae):null,widths:Le?_(Le):null,pinned:He?_(He):null}),[Te,Ae,Le,He]),[pr,ur]=Ue(he,Yt?.sorting?.sortModel??Or,e=>fe?.(e,cr())),[hr,fr]=Ue(ve,Yt?.filter?.filterModel??Hr,e=>Ce?.(e,cr())),[br,xr]=Ue(de,{page:Yt?.pagination?.paginationModel?.page??0,pageSize:Yt?.pagination?.paginationModel?.pageSize??ie},e=>se?.(e,cr())),[vr,Cr]=Ue(Pe,mr.visibility??Yt?.columns?.columnVisibilityModel??Gr,e=>{Te&&U(Te,e),ze?.(e,cr())}),[kr,Mr]=Ue(K,Yt?.density??"compact",e=>X?.(e,cr())),[Sr,Dr]=Ue(tt,mr.pinned??Yt?.pinnedColumns??Gr,e=>{He&&U(He,e),rt?.(e,cr())}),[Rr,Br]=Ue(St,Yt?.rowGrouping?.model??Or,e=>Dt?.(e,cr())),[_r,Ur]=Ue(Ht,Yt?.aggregation?.model??Gr,e=>Vt?.(e,cr())),Wr=e.useMemo(()=>kt?new Set(kt):void 0,[kt]),[qr,jr]=Ue(Wr,e.useMemo(()=>new Set(Yt?.detailPanel?.expandedRowIds??[]),[]),e=>Mt?.(Array.from(e),cr())),Yr=e.useMemo(()=>void 0!==lt?q(lt).ids:void 0,[lt]),[Kr,Xr]=Ue(Yr,e.useMemo(()=>new Set,[]),e=>dt?.({type:"include",ids:e},cr())),[Qr,Jr]=e.useState(()=>mr.order??Yt?.columns?.orderedFields??null),[Zr,en]=e.useState(()=>{if(mr.widths)return mr.widths;const e=Yt?.columns?.dimensions;if(!e)return{};const t={};return Object.keys(e).forEach(r=>{e[r].width&&(t[r]=e[r].width)}),t}),[tn,rn]=e.useState(()=>new Map),[nn,on]=e.useState(null),[an,ln]=e.useState(void 0),[dn,sn]=e.useState(null),cn=e.useRef(!1),[gn,mn]=e.useState({open:!1,anchorEl:null}),[pn,un]=e.useState(null),[hn,fn]=e.useState(null),[bn,xn]=e.useState(null),yn=null!==bn,[vn,wn]=e.useState(null),[En,Cn]=e.useState(0),kn=e.useRef(0),Mn=e.useRef(null),[Sn,Dn]=e.useState(()=>({rows:r,map:new Map})),In=Sn.rows===r?Sn.map:Tr,Fn=e.useCallback((e,t)=>{Dn(n=>{const o=new Map(n.rows===r?n.map:[]);return o.set(e,t),{rows:r,map:o}})},[r]),{width:Pn,height:Nn}=function(t,r=!0){const[n,o]=e.useState({width:0,height:0});return e.useLayoutEffect(()=>{const e=t.current;if(!e||!r)return;const n=()=>{const t=e.clientWidth,r=e.clientHeight;o(e=>e.width===t&&e.height===r?e:{width:t,height:r})};if(n(),"undefined"==typeof ResizeObserver)return window.addEventListener("resize",n),()=>window.removeEventListener("resize",n);const a=new ResizeObserver(n);return a.observe(e),()=>a.disconnect()},[t,r]),n}(er),Rn=R[kr]??1,zn=Math.round(N*Rn),On=Math.round(L*Rn),Gn=e.useMemo(()=>{const e=[];return r.forEach(t=>{const r=W(t,o);null!=r&&e.push({id:r,row:In.get(r)??t})}),e},[r,o,In]),Tn=e.useMemo(()=>{const e=new Map;return Gn.forEach(t=>e.set(t.id,t.row)),(bt?.top??[]).forEach(t=>e.set(W(t,o),t)),(bt?.bottom??[]).forEach(t=>e.set(W(t,o),t)),e},[Gn,bt,o]),An=e.useMemo(()=>n.map(e=>Ee(e)),[n]),Ln=e.useMemo(()=>{const e=new Map;return An.forEach(t=>e.set(t.field,t)),e},[An]),Hn=e.useMemo(()=>At?[]:Rr.filter(e=>Ln.has(e)),[Rr,Ln,At]),Vn=Hn.length>0,$n=e.useMemo(()=>{if(!Vn)return null;const e=1===Hn.length?Ln.get(Hn[0]):void 0;return Ee({field:D,headerName:e?e.headerName??e.field:lr.groupingColumnHeaderName,width:220,minWidth:120,sortable:!0,filterable:!1,hideable:!1,groupable:!1,aggregable:!1,editable:!1,disableExport:!0,disableReorder:!0,...Tt})},[Vn,Hn,Ln,lr.groupingColumnHeaderName,Tt]),Bn=e.useMemo(()=>{if(!Qr||0===Qr.length)return An;const e=new Set,t=[];return Qr.forEach(r=>{const n=Ln.get(r);n&&!e.has(r)&&(e.add(r),t.push(n))}),An.forEach(r=>{e.has(r.field)||t.push(r)}),t},[Qr,An,Ln]),_n=e.useCallback(e=>{const t=vr[e];return!1!==t&&(void 0!==t||-1===Hn.indexOf(e))},[vr,Hn]),Un=e.useMemo(()=>{if(bn){let e=Bn.filter(e=>_n(e.field));if(bn.fields){const t=new Set(bn.fields);e=Bn.filter(e=>t.has(e.field))}else bn.allColumns&&(e=Bn);return e.filter(e=>!e.disableExport)}return Bn.filter(e=>_n(e.field))},[Bn,_n,bn]),Wn=e.useMemo(()=>{const e=[];nt&&e.push(ke),yt&&e.push(Me);const t=et?[]:(Sr.left??[]).filter(e=>e!==D),r=et?[]:(Sr.right??[]).filter(e=>e!==D),n=new Map;Un.forEach(e=>n.set(e.field,e));const o=e.slice();$n&&o.push($n),t.forEach(e=>{const t=n.get(e);t&&o.push(t)});const a=[];r.forEach(e=>{const r=n.get(e);r&&-1===t.indexOf(e)&&a.push(r)});const i=Un.filter(e=>-1===t.indexOf(e.field)&&-1===r.indexOf(e.field)),l=o.concat(i,a),d=((e,t,r)=>{const n=e.map(e=>{const t=e.minWidth??G,n=e.maxWidth??1/0,o=r[e.field];return o?H(o,t,n):e.flex&&e.flex>0?null:H(e.width??100,t,n)}),o=[];let a=0;if(n.forEach((e,t)=>{null===e?o.push(t):a+=e}),o.length>0){let r=Math.max(0,t-a),i=o.reduce((t,r)=>t+e[r].flex,0),l=o.slice(),d=!0;for(;d&&l.length>0;){d=!1;for(let t=0;t<l.length;t+=1){const o=l[t],a=e[o],s=a.minWidth??G,c=a.maxWidth??1/0,g=i>0?r*a.flex/i:0;if(g<s||g>c){const e=g<s?s:c;n[o]=e,r=Math.max(0,r-e),i-=a.flex,l=l.filter(e=>e!==o),d=!0;break}}}l.forEach(t=>{const o=e[t];n[t]=i>0?Math.floor(r*o.flex/i):o.minWidth??50})}return n})(l,Pn,Zr),s=o.length>e.length+($n?1:0)||a.length>0,c=[];let g=0,m=0;l.forEach((e,t)=>{const r=d[t],n=t<o.length,a=t>=o.length+i.length;c.push({col:e,width:r,pinned:n?"left":a?"right":null,offset:n?m:0,x:g,isLastLeft:n&&t===o.length-1,isFirstRight:a&&t===o.length+i.length}),n&&(m+=r),g+=r});let p=0;for(let e=c.length-1;e>=0&&"right"===c[e].pinned;e-=1)c[e].offset=p,p+=c[e].width;return{columns:c,totalWidth:g,hasPinning:s,leftCount:o.length,rightCount:a.length}},[nt,yt,Sr,et,Un,$n,Pn,Zr]),qn=e.useMemo(()=>{const e=new Map;return Wn.columns.forEach(t=>e.set(t.col.field,t.col)),$n&&e.set(D,$n),e},[Wn.columns,$n]),jn=e.useCallback(e=>Ln.get(e)??qn.get(e),[Ln,qn]),Yn=e.useMemo(()=>{const e=[];return hr.items.forEach(t=>{const r=Ln.get(t.field);if(!r||!1===r.filterable)return;const n=we(r).find(e=>e.value===t.operator);if(!n)return;const o=n.getApplyFilterFn(t,r);o&&e.push({col:r,fn:o})}),e},[hr.items,Ln]),Kn=e.useMemo(()=>(hr.quickFilterValues??[]).map(e=>String(e).trim()).filter(e=>""!==e),[hr.quickFilterValues]),Xn=e.useMemo(()=>(hr.quickFilterExcludeHiddenColumns?Un:Bn).filter(e=>!1!==e.filterable&&"actions"!==e.type),[hr.quickFilterExcludeHiddenColumns,Un,Bn]),Qn=e.useMemo(()=>{if(0===Yn.length&&0===Kn.length)return Gn;const e="and"===(hr.logicOperator??"and"),t="and"===(hr.quickFilterLogicOperator??"and"),r=sr.current.api,n=Kn.map(e=>{const t=e.toLowerCase(),n=Xn.map(n=>{if(n.getApplyQuickFilterFn){const t=n.getApplyQuickFilterFn(e,n,r);return t?{col:n,fn:t}:null}return{col:n,fn:(e,o)=>{if(A(e))return!1;if(-1!==ne(re(e,o,n,r)).toLowerCase().indexOf(t))return!0;return-1!==("object"==typeof e?"":String(e).toLowerCase()).indexOf(t)}}}).filter(Boolean);return e=>n.some(({col:t,fn:n})=>n(ee(e,t,r),e,t,r))});return Gn.filter(({row:o})=>{if(Yn.length>0){const t=Yn.map(({col:e,fn:t})=>t(ee(o,e,r),o,e,r));if(!(e?t.every(Boolean):t.some(Boolean)))return!1}if(n.length>0){const e=n.map(e=>e(o));return t?e.every(Boolean):e.some(Boolean)}return!0})},[Gn,Yn,Kn,Xn,hr.logicOperator,hr.quickFilterLogicOperator]),Jn=e.useMemo(()=>{const e=sr.current.api,t=pr.filter(e=>e.sort&&e.field!==D).map(e=>{const t=Ln.get(e.field);return t&&!1!==t.sortable?{col:t,dir:"desc"===e.sort?-1:1,comparator:t.sortComparator??ge(t.type)}:null}).filter(Boolean);return 0===t.length?null:(r,n)=>{for(let o=0;o<t.length;o+=1){const{col:a,dir:i,comparator:l}=t[o],d=ee(r.row,a,e),s=ee(n.row,a,e),c=l(d,s,{id:r.id,field:a.field,value:d,row:r.row,api:e},{id:n.id,field:a.field,value:s,row:n.row,api:e});if(0!==c)return c*i}return 0}},[pr,Ln]),Zn=e.useCallback(e=>Jn?e.map((e,t)=>({entry:e,index:t})).sort((e,t)=>Jn(e.entry,t.entry)||e.index-t.index).map(e=>e.entry):e,[Jn]),eo=e.useMemo(()=>({...Ne,...$t}),[$t]),to=!Bt&&Object.keys(_r).length>0,ro=e.useCallback(e=>{const t=tn.get(e.id);return void 0!==t?t:Lt?Lt({type:"group",id:e.id,depth:e.depth,parent:e.parent,groupingField:e.groupingField,groupingKey:e.groupingKey,groupingLabel:e.groupingLabel,children:[],leafIds:[],isExpanded:!1}):-1===Ft||e.depth<Ft},[tn,Lt,Ft]),no=e.useMemo(()=>{const e=new Map,t=new Map;if(!Vn){const r=Zn(Qn);return{displayRows:r.map(t=>{const r={type:"leaf",id:t.id,depth:0,parent:null};return e.set(t.id,r),{id:t.id,type:"leaf",row:t.row,node:r,depth:0}}),sortedLeaves:r,nodesById:e,groupsById:t,tree:[]}}const r=sr.current.api;let n=wt(Qn,Hn,Ln,r);const o=pr.find(e=>e.field===D&&e.sort);n=((e,t,r)=>{const n=(e,o)=>{const a=t?t(o):null,i=a?e.map((e,t)=>({node:e,index:t})).sort((e,t)=>a(e.node,t.node)||e.index-t.index).map(e=>e.node):e;return i.forEach(e=>{if(e.childGroups.length>0){e.childGroups=n(e.childGroups,o+1);const t=[];e.childGroups.forEach(e=>e.descendants.forEach(e=>t.push(e))),e.descendants=t}else e.leaves=r(e.leaves),e.descendants=e.leaves}),i};return n(e,0)})(n,e=>{const t=Hn[e],n=Ln.get(t);if(!n)return null;const a=o??pr.find(e=>e.field===t&&e.sort);if(!a)return null;const i=n.sortComparator??ge(n.type),l="desc"===a.sort?-1:1;return(e,n)=>i(e.groupingKey,n.groupingKey,{id:e.id,field:t,value:e.groupingKey,row:e.descendants[0]?.row,api:r},{id:n.id,field:t,value:n.groupingKey,row:n.descendants[0]?.row,api:r})*l},Zn);const a=((e,t,r,n)=>{const o=[],a=(e,i)=>{e.forEach(e=>{const l=t(e),d=((e,t)=>({type:"group",id:e.id,depth:e.depth,parent:e.parent,groupingField:e.groupingField,groupingKey:e.groupingKey,groupingLabel:e.groupingLabel,children:e.childGroups.length>0?e.childGroups.map(e=>e.id):e.leaves.map(e=>e.id),leafIds:e.descendants.map(e=>e.id),isExpanded:t}))(e,l);r.set(e.id,d),n.set(e.id,e),i&&o.push({id:e.id,type:"group",row:null,node:d,depth:e.depth,group:e});const s=i&&l;e.childGroups.length>0?a(e.childGroups,s):e.leaves.forEach(t=>{const n={type:"leaf",id:t.id,depth:e.depth+1,parent:e.id};r.set(t.id,n),s&&o.push({id:t.id,type:"leaf",row:t.row,node:n,depth:e.depth+1})})})};return a(e,!0),o})(n,ro,e,t);return{displayRows:a,sortedLeaves:Et(n),nodesById:e,groupsById:t,tree:n}},[Vn,Qn,Zn,Hn,Ln,pr,ro]),{displayRows:oo,sortedLeaves:ao,nodesById:io,groupsById:lo}=no,so=oo.length,co=ae&&!yn,go=ae?Math.max(1,Math.ceil(so/Math.max(br.pageSize,1))):1,mo=ae?H(br.page,0,go-1):0;e.useEffect(()=>{ae&&br.page!==mo&&xr({...br,page:mo})},[ae,br,mo,xr]);const po=e.useMemo(()=>co?oo.slice(mo*br.pageSize,(mo+1)*br.pageSize):oo,[oo,co,mo,br.pageSize]),uo=e.useMemo(()=>{if(!to||"inline"===_t)return null;const e=ao.map(e=>e.row);return Ct(e,_r,Ln,eo,sr.current.api)},[to,_t,ao,_r,Ln,eo]),ho=e.useMemo(()=>new Map,[po,_r,eo]),fo=e=>{if(!to||"footer"===_t)return;let t=ho.get(e.id);return t||(t=Ct(e.descendants.map(e=>e.row),_r,Ln,eo,sr.current.api),ho.set(e.id,t)),t},bo=e.useMemo(()=>{const e=[],t=[],r=[];let n=0,o=B||Y||yn;return po.forEach(a=>{let i=zn;if($&&"leaf"===a.type&&a.row){const e=$({id:a.id,model:a.row,densityFactor:Rn});"auto"===e?o=!0:"number"==typeof e&&e>0&&(i=e)}let l=0;if("leaf"===a.type&&yt&&qr.has(a.id)&&a.row){const e=vt?vt({id:a.id,row:a.row}):500;"auto"===e?o=!0:l=e}e.push(i),t.push(l),r.push(n),n+=i+l}),{rowHeights:e,detailHeights:t,offsets:r,total:n,hasAuto:o}},[po,zn,$,Rn,yt,vt,qr,B,Y,yn]),xo=!bo.hasAuto;e.useEffect(()=>{if(!bn)return;const e=window.setTimeout(()=>{Zt.current&&xt({cardElement:Zt.current,options:bn,onDone:()=>xn(null)})},50);return()=>window.clearTimeout(e)},[bn]);const yo=e.useMemo(()=>{const e=po.length;if(!xo||0===e)return{start:0,end:e};const t=6*zn,r=Math.max(0,En-On-t),n=En+Math.max(Nn,zn)+t,{offsets:o}=bo;let a=0,i=e-1;for(;a<i;){const e=a+i>>1;o[e]+bo.rowHeights[e]+bo.detailHeights[e]<r?a=e+1:i=e}const l=a;let d=l;for(;d<e&&o[d]<n;)d+=1;return{start:l,end:d}},[xo,po.length,En,Nn,zn,On,bo]),vo=e.useCallback(()=>{sr.current.virtual&&(kn.current||(kn.current=window.requestAnimationFrame(()=>{kn.current=0,er.current&&Cn(er.current.scrollTop)})))},[]);e.useEffect(()=>()=>{kn.current&&window.cancelAnimationFrame(kn.current)},[]);const wo=e.useCallback((e,t)=>!!t&&(!st||st({id:e,row:t,columns:Bn,api:sr.current.api})),[st,Bn]),Eo=e.useMemo(()=>(ot?po.filter(e=>"leaf"===e.type&&e.row).map(e=>({id:e.id,row:e.row})):ao).filter(e=>wo(e.id,e.row)).map(e=>e.id),[ot,po,ao,wo]),Co=e.useMemo(()=>Eo.reduce((e,t)=>e+(Kr.has(t)?1:0),0),[Eo,Kr]),ko=Eo.length>0&&Co===Eo.length,Mo=Co>0&&!ko,So=e.useCallback(e=>{Xr(t=>{const r=e(t);return((e,t)=>{if(e.ids.size!==t.ids.size)return!1;let r=!0;return e.ids.forEach(e=>{t.ids.has(e)||(r=!1)}),r})({ids:t},{ids:r})?t:r})},[Xr]),Do=e.useCallback((e,t=!0,r=!1)=>{So(n=>{const o=r?new Set:new Set(n);if(e.forEach(e=>{t?wo(e,Tn.get(e))&&o.add(e):o.delete(e)}),it&&o.size>1){const r=e[e.length-1];return new Set(t&&o.has(r)?[r]:[])}return o})},[So,wo,Tn,it]);e.useEffect(()=>{if(ct||0===Kr.size)return;let e=!1;const t=new Set;Kr.forEach(r=>{Tn.has(r)?t.add(r):e=!0}),e&&Xr(t)},[Tn,ct,Kr,Xr]);const Io=()=>{Do(Eo,!ko)},Fo=(e,t,r=!1)=>{const n=jn(e);if(!n||!1===n.sortable||ye)return;const o=pr.find(t=>t.field===e);let a,i;if(void 0===t){const e=n.sortingOrder??be,t=e.indexOf(o?.sort??null);a=e[(t+1)%e.length]}else a=t;r&&!xe?(i=pr.filter(t=>t.field!==e),a&&(i=o?pr.map(t=>t.field===e?{field:e,sort:a}:t):i.concat([{field:e,sort:a}]))):i=a?[{field:e,sort:a}]:[],ur(i)},Po=e=>{Ae&&U(Ae,e)},No=e=>{Le&&U(Le,e)},Ro=(e={})=>{const t=e.includeHeaders??!0,r=Wn.columns.filter(t=>!(T(t.col.field)||e.columns&&-1===e.columns.indexOf(t.col.field)));if(0===r.length)return;const n=Jt.current,o=n&&"undefined"!=typeof window?window.getComputedStyle(n):null,a=o?.fontFamily||"sans-serif",i=`400 14px ${a}`,l=`600 14px ${a}`,d=ao.slice(0,500),s=sr.current.api,c={...Zr};r.forEach(({col:e})=>{let r=t?Oe(e.headerName??e.field,l)+64:0;d.forEach(t=>{const n=ee(t.row,e,s),o=ne(re(n,t.row,e,s,t.id)),a=Oe(o,i)+24;a>r&&(r=a)}),c[e.field]=H(Math.ceil(r),e.minWidth??G,e.maxWidth??1/0)}),en(c),No(c)},zo=e.useCallback(()=>{mn(e=>e.open?{open:!1,anchorEl:null}:e)},[]),Oo=e=>!!e.colDef.editable&&("leaf"===e.rowNode.type&&(!jt||jt(e))),Go=(e,t)=>{const r=Tn.get(e),n=jn(t);if(!r||!n)return;const o=$o(e,t,r,io.get(e)??{type:"leaf",id:e,depth:0,parent:null});Oo(o)&&(on({id:e,field:t}),ln(o.value),sn({id:e,field:t}))},To=(e,t,r=!1,n="api")=>{if(!nn||nn.id!==e||nn.field!==t)return;const o=Tn.get(e),a=jn(t);if(on(null),o&&a){if(!r){const r=sr.current.api,n=a.valueParser?a.valueParser(an,o,a,r):((e,t)=>{switch(t.type){case"number":{if(""===e||A(e))return null;const t=Number(e);return Number.isNaN(t)?e:t}case"boolean":return Boolean(e);case"date":case"dateTime":return""===e||A(e)?null:j(e)??e;default:return e}})(an,a),i=ee(o,a,r);if(!Object.is(n,i)){((e,t,r)=>{Ut?Promise.resolve().then(()=>Ut(t,r,{rowId:e})).then(r=>Fn(e,r??t)).catch(e=>{Wt?Wt(e):console.error("MGHGrid: processRowUpdate failed",e)}):Fn(e,t)})(e,a.valueSetter?a.valueSetter(n,o,a,r):{...o,[t]:n},o)}}qt?.({id:e,field:t,row:o,reason:n},cr()),cn.current=!0,sn({id:e,field:t})}},Ao=e=>{jr(t=>{const r=new Set(t);return r.has(e)?r.delete(e):r.add(e),r})},Lo=(e,t)=>{rn(r=>{const n=new Map(r);return n.set(e,t),n})},Ho=Hn.join("|"),Vo=e.useRef(Ho);e.useEffect(()=>{Vo.current!==Ho&&(Vo.current=Ho,rn(new Map))},[Ho]);const $o=(e,t,r,n)=>{const o=jn(t),a=sr.current.api,i=ee(r,o,a),l=re(i,r,o,a,e),d=Boolean(dn&&dn.id===e&&dn.field===t);return{id:e,field:t,value:i,formattedValue:l,row:r,rowNode:n,colDef:o,api:a,hasFocus:d,tabIndex:d?0:-1,cellMode:nn&&nn.id===e&&nn.field===t?"edit":"view",isEditable:Boolean(o.editable)&&"leaf"===n.type}},Bo=(e,t)=>({id:e,row:t,columns:Bn,api:sr.current.api});e.useEffect(()=>{if(!cn.current||!dn||!Jt.current)return;cn.current=!1;const e=`[data-mgh-row-id="${String(dn.id).replace(/"/g,'\\"')}"] [data-mgh-field="${dn.field.replace(/"/g,'\\"')}"]`,t=Jt.current.querySelector(e);t&&document.activeElement!==t&&!t.contains(document.activeElement)&&t.focus({preventScroll:!0})},[dn,yo.start,yo.end]);const _o=e=>{const t=er.current;if(!t)return!1;if(void 0!==e.rowIndex&&xo){const r=H(e.rowIndex,0,Math.max(po.length-1,0)),n=bo.offsets[r]??0,o=n+(bo.rowHeights[r]??zn),a=t.scrollTop,i=t.scrollTop+t.clientHeight-On;n<a?t.scrollTop=n:o>i&&(t.scrollTop=o-(t.clientHeight-On))}else if(void 0!==e.rowIndex){const r=t.querySelector(`[data-mgh-row-index="${e.rowIndex}"]`);r?.scrollIntoView?.({block:"nearest"})}if(void 0!==e.colIndex){const r=Wn.columns[H(e.colIndex,0,Wn.columns.length-1)];if(r&&!r.pinned){const e=Wn.columns.filter(e=>"left"===e.pinned).reduce((e,t)=>e+t.width,0),n=Wn.columns.filter(e=>"right"===e.pinned).reduce((e,t)=>e+t.width,0),o=t.scrollLeft+e,a=t.scrollLeft+t.clientWidth-n;r.x<o?t.scrollLeft=r.x-e:r.x+r.width>a&&(t.scrollLeft=r.x+r.width-t.clientWidth+n)}}return!0},Uo=(e,t,r)=>{if(0===po.length||0===Wn.columns.length)return;let n=dn?po.findIndex(e=>e.id===dn.id):-1,o=dn?Wn.columns.findIndex(e=>e.col.field===dn.field):-1;-1===n&&(n=0),-1===o&&(o=0),n="first"===r?.row?0:"last"===r?.row?po.length-1:H(n+e,0,po.length-1),o="first"===r?.col?0:"last"===r?.col?Wn.columns.length-1:H(o+t,0,Wn.columns.length-1);const a={id:po[n].id,field:Wn.columns[o].col.field};cn.current=!0,sn(a),_o({rowIndex:n,colIndex:o})},Wo=e=>!Ze&&!e.disableReorder&&!T(e.field),qo=e.useRef(null),jo=Yn.length,Yo=Vn?so:Qn.length,Ko=e.useMemo(()=>({sortModel:pr,filterModel:hr,paginationModel:{page:mo,pageSize:br.pageSize},pageCount:go,rowCount:Yo,totalRowCount:Gn.length,columnVisibilityModel:vr,orderedFields:Bn.map(e=>e.field),columnWidths:Zr,pinnedColumns:Sr,density:kr,densityFactor:Rn,rowSelectionModel:{type:"include",ids:Kr},rowGroupingModel:Rr,aggregationModel:_r,expandedDetailPanels:qr,preferencePanel:{open:gn.open,openedPanelValue:gn.openedPanelValue,targetField:gn.targetField},filterCount:jo,quickFilterValues:Kn}),[pr,hr,mo,br.pageSize,go,Yo,Gn.length,vr,Bn,Zr,Sr,kr,Rn,Kr,Rr,_r,qr,gn.open,gn.openedPanelValue,gn.targetField,jo,Kn]);sr.current={api:gr,state:Ko,rowsById:Tn,rowEntries:Gn,nodesById:io,groupsById:lo,sortedLeaves:ao,pagedRows:po,getRowId:o,setRowOverride:Fn,orderedUserColumns:Bn,visibleUserColumns:Un,getColumn:jn,columnVisibilityModel:vr,setColumnVisibilityModel:Cr,setColumnWidth:(e,t)=>{const r=jn(e);if(!r)return;const n=H(t,r.minWidth??G,r.maxWidth??1/0);en(t=>{const r={...t,[e]:n};return No(r),r}),_e?.({colDef:r,width:n},cr())},setColumnIndex:(e,t,r=null)=>{const n=Bn.map(e=>e.field),o=n.indexOf(e);if(-1===o)return;const a=((e,t,r)=>{const n=e.slice(),[o]=n.splice(t,1);return n.splice(r,0,o),n})(n,o,H(t,0,n.length-1));Jr(a),Po(a);const i=Ln.get(e);i&&Be?.({column:i,targetIndex:t,oldIndex:o},r,cr())},columnWidths:Zr,autosizeColumns:Ro,pinColumn:(e,t)=>{if(et)return;const r=(Sr.left??[]).filter(t=>t!==e),n=(Sr.right??[]).filter(t=>t!==e);"left"===t?r.push(e):n.unshift(e),Dr({left:r,right:n})},unpinColumn:e=>{Dr({left:(Sr.left??[]).filter(t=>t!==e),right:(Sr.right??[]).filter(t=>t!==e)})},isColumnPinned:e=>!et&&(-1!==(Sr.left??[]).indexOf(e)?"left":-1!==(Sr.right??[]).indexOf(e)&&"right"),pinnedColumns:Sr,setPinnedColumns:Dr,sortModel:pr,setSortModel:ur,sortColumn:Fo,filterModel:hr,setFilterModel:fr,upsertFilterItems:e=>{let t=hr.items.slice();e.forEach(e=>{const r=void 0===e.id?{...e,id:`${Date.now()}-${Math.random().toString(36).slice(2,8)}`}:e,n=t.findIndex(e=>void 0!==e.id&&e.id===r.id);-1===n?t.push(r):t[n]=r}),De&&t.length>1&&(t=t.slice(-1)),fr({...hr,items:t})},deleteFilterItem:e=>{fr({...hr,items:hr.items.filter(t=>void 0!==e.id?t.id!==e.id:t!==e)})},showPreferences:(e,t,r)=>{un(null),mn({open:!0,openedPanelValue:e,targetField:r,anchorEl:t??rr.current??Jt.current})},hidePreferences:zo,selectedIds:Kr,setSelectedIds:Xr,selectRows:Do,isRowSelectableFn:wo,paginationModel:{page:mo,pageSize:br.pageSize},setPaginationModel:xr,setDensity:Mr,toggleDetailPanel:Ao,expandedDetailPanels:qr,setExpandedDetailPanels:jr,rowGroupingModel:Rr,setRowGroupingModel:Br,setRowChildrenExpansion:Lo,aggregationModel:_r,setAggregationModel:Ur,startCellEditMode:Go,stopCellEditMode:To,editingCell:nn,setEditValue:ln,buildCellParams:$o,setFocusedCell:sn,scrollToIndexes:_o,forceUpdate:ar,virtual:xo,startPrint:(e={})=>{if(bn)return;const t={title:"string"==typeof i?i:void 0,...e};Zt.current&&"undefined"!=typeof window&&xn(t)}},Kt&&(Kt.current=gr),e.useEffect(()=>{Xt?.(Ko,{api:gr})},[Ko,Xt,gr]);const Xo=e.useMemo(()=>({header:i,pagination:ae,pageSizeOptions:le,hideFooterPagination:me,hideFooterRowCount:pe,hideFooterSelectedRowCount:ue,disableColumnFilter:Se,disableColumnSelector:Ke,disableDensitySelector:oe,disableColumnPinning:et,disableColumnSorting:ye,disableMultipleColumnsSorting:xe,disableMultipleColumnsFiltering:De,disableRowGrouping:At,disableAggregation:Bt,checkboxSelection:nt,aggregationFunctions:eo,quickFilterDebounceMs:Ie}),[i,ae,le,me,pe,ue,Se,Ke,oe,et,ye,xe,De,At,Bt,nt,eo,Ie]),Qo=e.useMemo(()=>({api:gr,state:Ko,localeText:lr,themeMode:y,rootProps:Xo,columns:Bn,visibleColumns:Un}),[gr,Ko,lr,y,Xo,Bn,Un]),Jo=(t,r)=>{const{col:n}=t,o=n.field;if(o===I){if("group"===r.kind&&r.group){const t=r.group.descendants.map(e=>e.id),n=t.reduce((e,t)=>e+(Kr.has(t)?1:0),0);return e.createElement(ir,{checked:t.length>0&&n===t.length,indeterminate:n>0&&n<t.length,label:lr.checkboxSelectionSelectRow,onClick:e=>e.stopPropagation(),onChange:()=>Do(t,n!==t.length,!1)})}if("leaf"!==r.kind)return null;const t=wo(r.id,r.row),n=Kr.has(r.id);return e.createElement(ir,{checked:n,disabled:!t,label:n?lr.checkboxSelectionUnselectRow:lr.checkboxSelectionSelectRow,tabIndex:-1,onClick:e=>e.stopPropagation(),onChange:()=>{Mn.current=r.id,Do([r.id],!n,it)}})}if(o===F){if("leaf"!==r.kind||!r.row)return null;const t=qr.has(r.id),n=yt?.(Bo(r.id,r.row));return null==n||!1===n?null:e.createElement(tr,{size:"small",className:V("mgh-grid-detail-toggle",t&&"mgh-grid-detail-toggle--expanded"),label:t?lr.collapseDetailPanel:lr.expandDetailPanel,"aria-expanded":t,tabIndex:-1,onClick:e=>{e.stopPropagation(),Ao(r.id)}},e.createElement(Ot,null))}if(o===D){if("group"===r.kind&&r.group){const t=r.group,n=ro(t),o=Tt?.hideDescendantCount;return e.createElement("div",{className:"mgh-grid-group-cell",style:{paddingLeft:20*r.depth}},e.createElement(tr,{size:"small",className:V("mgh-grid-group-toggle",n&&"mgh-grid-group-toggle--expanded"),label:n?lr.collapseDetailPanel:lr.expandDetailPanel,"aria-expanded":n,tabIndex:-1,onClick:e=>{e.stopPropagation(),Lo(t.id,!n)}},e.createElement(Gt,null)),e.createElement("span",{className:"mgh-grid-group-label",title:t.groupingLabel},t.groupingLabel),!o&&e.createElement("span",{className:"mgh-grid-group-count"},"(",t.descendants.length,")"))}return null}if("group"===r.kind||"footer"===r.kind){const t=r.aggregates?.[o];if(!t||A(t.value))return null;const a=eo[t.fn],i=sr.current.api,l=r.group?.descendants[0]?.row??sr.current.sortedLeaves[0]?.row??{},d=a?.valueFormatter?a.valueFormatter(t.value):n.valueFormatter?n.valueFormatter(t.value,l,n,i):te(t.value,n);return e.createElement(e.Fragment,null,e.createElement("span",{className:"mgh-grid-aggregation-label"},a?.label??t.fn),e.createElement("span",{className:"mgh-grid-cell-text"},ne(d)))}if(!r.row)return null;const a=$o(r.id,o,r.row,r.node);if("edit"===a.cellMode)return(t=>{const r=t.colDef,n=e=>To(t.id,t.field,!1,e),o=()=>To(t.id,t.field,!0,"escapeKeyDown");if(r.renderEditCell)return r.renderEditCell({...t,editValue:an,onValueChange:ln,commit:()=>n("enterKeyDown"),cancel:o});const a={autoFocus:!0,onKeyDown:e=>{"Enter"===e.key?(e.preventDefault(),e.stopPropagation(),n("enterKeyDown")):"Escape"===e.key?(e.preventDefault(),e.stopPropagation(),o()):"Tab"===e.key?n("tabKeyDown"):e.stopPropagation()},onBlur:()=>n("cellFocusOut"),onClick:e=>e.stopPropagation()};switch(r.type){case"boolean":return e.createElement(ir,{...a,checked:Boolean(an),onChange:e=>ln(e.target.checked)});case"singleSelect":{const n=Z(r,t.row,t.id);return e.createElement(or,{...a,size:"small",value:null==an?"":String(an),onChange:e=>{const t=n.find(t=>String(Q(r,t))===e.target.value);ln(void 0!==t?Q(r,t):e.target.value)}},e.createElement("option",{value:""}),n.map(t=>{const n=Q(r,t);return e.createElement("option",{key:String(n),value:String(n)},J(r,t))}))}case"number":return e.createElement(nr,{...a,size:"small",type:"number",value:null==an?"":an,onChange:e=>ln(e.target.value)});case"date":case"dateTime":return e.createElement(nr,{...a,size:"small",type:"date"===r.type?"date":"datetime-local",value:"string"==typeof an&&/^\d{4}-\d{2}-\d{2}/.test(an)?an:$r(an,"dateTime"===r.type),onChange:e=>ln(e.target.value)});default:return e.createElement(nr,{...a,size:"small",type:"text",value:null==an?"":String(an),onChange:e=>ln(e.target.value)})}})(a);if(n.renderCell)return n.renderCell(a);if("actions"===n.type){const t=n.getActions?n.getActions(Bo(r.id,r.row)):[];return e.createElement(zr,{actions:t,themeMode:y,moreLabel:lr.actionsCellMore})}if("boolean"===n.type)return A(a.value)?null:a.value?e.createElement(zt,{"aria-label":lr.booleanCellTrueLabel}):e.createElement(It,{"aria-label":lr.booleanCellFalseLabel});const i=a.formattedValue;if(null==i)return null;if(e.isValidElement(i))return i;const l=ne(i);return e.createElement("span",{className:"mgh-grid-cell-text",title:l.length>20?l:void 0},l)},Zo=e=>({width:e.width,minWidth:e.width,maxWidth:e.width,left:"left"===e.pinned?e.offset:void 0,right:"right"===e.pinned?e.offset:void 0}),ea=(e,t)=>V("left"===e.pinned&&`${t}--pinned-left`,"right"===e.pinned&&`${t}--pinned-right`,e.isLastLeft&&Wn.hasPinning&&`${t}--pinned-left-last`,e.isFirstRight&&`${t}--pinned-right-first`),ta=Boolean(mt||pt||!at),ra=(t,r)=>{const n="leaf"===t.kind&&Kr.has(t.id),o="leaf"===t.kind&&t.row&&gt?gt({...Bo(t.id,t.row),indexRelativeToCurrentPage:r.index,isFirstVisible:r.isFirst,isLastVisible:r.isLast,rowNode:t.node}):void 0;return e.createElement("div",{role:"row","aria-rowindex":r.index+2,"aria-selected":"leaf"===t.kind?n:void 0,"data-mgh-row-id":String(t.id),"data-mgh-row-index":r.index,className:V("mgh-grid-row",n&&"mgh-grid-row--selected",ta&&"leaf"===t.kind&&"mgh-grid-row--clickable","group"===t.kind&&"mgh-grid-row--group","pinnedRow"===t.kind&&"mgh-grid-row--pinned","footer"===t.kind&&"mgh-grid-row--footer",r.isAuto&&"mgh-grid-row--auto-height",o),style:{width:Wn.totalWidth,height:r.isAuto?void 0:r.height,minHeight:r.isAuto?zn:void 0},onClick:e=>{"leaf"===t.kind&&t.row?(at||((e,t)=>{if("group"===e.kind&&e.group){const t=e.group.descendants.map(e=>e.id),r=t.every(e=>Kr.has(e));return void Do(t,!r,!1)}if("leaf"!==e.kind)return;const r=e.id;if(!wo(r,e.row))return;const n=!it;if(t.shiftKey&&n&&null!==Mn.current){const e=po.filter(e=>"leaf"===e.type).map(e=>e.id),n=e.indexOf(Mn.current),o=e.indexOf(r);if(-1!==n&&-1!==o){const[r,a]=n<o?[n,o]:[o,n];return void Do(e.slice(r,a+1),!0,!nt&&!t.ctrlKey&&!t.metaKey)}}Mn.current=r;const o=Kr.has(r);nt||t.ctrlKey||t.metaKey?Do([r],!o,!1):o&&1===Kr.size?Do([r],!1,!0):Do([r],!0,!0)})(t,e),mt?.(Bo(t.id,t.row),e,cr())):"group"===t.kind&&t.group&&Lo(t.group.id,!ro(t.group))},onDoubleClick:e=>{"leaf"===t.kind&&t.row&&pt?.(Bo(t.id,t.row),e,cr())}},Wn.columns.map(n=>((t,r)=>{const{col:n}=t,o=n.field,a=Boolean(dn&&dn.id===r.id&&dn.field===o),i=Boolean(nn&&nn.id===r.id&&nn.field===o),l=("group"===r.kind||"footer"===r.kind)&&Boolean(r.aggregates?.[o]),d="leaf"===r.kind&&r.row?$o(r.id,o,r.row,r.node):null,s=!!d&&Oo(d),c=d&&n.cellClassName?"function"==typeof n.cellClassName?n.cellClassName(d):n.cellClassName:void 0,g=o===I,m=o===F;return e.createElement("div",{key:o,role:"gridcell","data-mgh-field":o,"data-mgh-colindex":Wn.columns.indexOf(t),tabIndex:a?0:-1,"aria-selected":"leaf"===r.kind?Kr.has(r.id):void 0,className:V("mgh-grid-cell",`mgh-grid-cell--align-${n.align??"left"}`,ea(t,"mgh-grid-cell"),a&&!i&&"mgh-grid-cell--focused",i&&"mgh-grid-cell--editing",s&&!i&&"mgh-grid-cell--editable","boolean"===n.type&&"mgh-grid-cell--boolean","actions"===n.type&&"mgh-grid-cell--actions",g&&"mgh-grid-cell--checkbox",m&&"mgh-grid-cell--detail-toggle",l&&"mgh-grid-cell--aggregation",c),style:Zo(t),onMouseDown:()=>{"leaf"!==r.kind&&"group"!==r.kind||a||sn({id:r.id,field:o})},onClick:e=>{d&&ut&&ut(d,e,cr())},onDoubleClick:e=>{d&&(ft?.(d,e,cr()),s&&!i&&(e.stopPropagation(),Go(r.id,o)))}},Jo(t,r))})(n,t,r.isAuto)),e.createElement("div",{className:"mgh-grid-row-filler"}))},na=e=>({id:e.id,kind:e.type,row:e.row,node:e.node,depth:e.depth,group:e.group,aggregates:"group"===e.type&&e.group?fo(e.group):void 0}),oa=(t,r)=>{const n=[];if((t??[]).forEach((t,a)=>{const i=W(t,o),l={id:i,kind:"pinnedRow",row:t,node:{type:"pinnedRow",id:i,depth:0,parent:null,position:r},depth:0};n.push(e.createElement(e.Fragment,{key:String(i)},ra(l,{height:zn,index:a,isFirst:!1,isLast:!1,isAuto:!1})))}),"bottom"===r&&uo){const t={id:P,kind:"footer",row:null,node:{type:"footer",id:P,depth:0,parent:null},depth:0,aggregates:uo};n.push(e.createElement(e.Fragment,{key:P},ra(t,{height:zn,index:0,isFirst:!1,isLast:!1,isAuto:!1})))}return n},aa=(t,r)=>{const{col:n}=t,o=n.field,a=pr.findIndex(e=>e.field===o&&e.sort),i=-1!==a?pr[a]:void 0,l=!1!==n.sortable&&!ye&&!T(o)||o===D&&!1!==n.sortable,d=!qe&&!n.disableColumnMenu&&!T(o)||o===D&&!qe,s=!Je&&!1!==n.resizable&&!T(o)||o===D&&!Je,c=Wo(n),g=vn?.field===o,m=vn&&vn.overField===o&&vn.field!==o,p=pn?.field===o,u={field:o,colDef:n,api:gr},h=n.headerClassName?"function"==typeof n.headerClassName?n.headerClassName(u):n.headerClassName:void 0;let f;return f=o===I?it?null:e.createElement(ir,{checked:ko,indeterminate:Mo,disabled:0===Eo.length,label:ko?lr.checkboxSelectionUnselectAllRows:lr.checkboxSelectionSelectAllRows,onChange:Io,onClick:e=>e.stopPropagation()}):o===F?null:n.renderHeader?n.renderHeader(u):e.createElement("span",{className:"mgh-grid-header-title"},n.headerName??o),e.createElement("div",{key:o,role:"columnheader","aria-colindex":r+1,"aria-sort":i?"asc"===i.sort?"ascending":"descending":l?"none":void 0,"data-mgh-field":o,title:n.description,tabIndex:-1,draggable:c,className:V("mgh-grid-header-cell",`mgh-grid-header-cell--align-${n.headerAlign??"left"}`,ea(t,"mgh-grid-header-cell"),l&&"mgh-grid-header-cell--sortable",o===I&&"mgh-grid-header-cell--checkbox",o===F&&"mgh-grid-header-cell--detail-toggle",r===Wn.columns.length-1&&"mgh-grid-header-cell--last",g&&"mgh-grid-header-cell--dragging",m&&"left"===vn?.side&&"mgh-grid-header-cell--drop-left",m&&"right"===vn?.side&&"mgh-grid-header-cell--drop-right",p&&"mgh-grid-header-cell--menu-open",h),style:Zo(t),onClick:e=>{l&&!hn&&Fo(o,void 0,e.shiftKey)},onDragStart:e=>{if(c){e.dataTransfer.effectAllowed="move";try{e.dataTransfer.setData("text/plain",o)}catch{}wn({field:o,overField:null,side:"left"})}},onDragOver:e=>{if(!vn||vn.field===o)return;const r=Wn.columns.find(e=>e.col.field===vn.field);if(!r||r.pinned!==t.pinned||!Wo(n))return;e.preventDefault(),e.dataTransfer.dropEffect="move";const a=e.currentTarget.getBoundingClientRect(),i=e.clientX<a.left+a.width/2?"left":"right";vn.overField===o&&vn.side===i||wn({...vn,overField:o,side:i})},onDragLeave:()=>{vn&&vn.overField===o&&wn({...vn,overField:null})},onDrop:e=>((e,t)=>{t.preventDefault();const r=vn;if(wn(null),!r||r.field===e.col.field)return;const n=Wn.columns.find(e=>e.col.field===r.field);if(!n||n.pinned!==e.pinned||!Wo(e.col))return;const o=r.side;if(n.pinned){const t=n.pinned,a=(Sr[t]??[]).slice(),i=a.indexOf(r.field);let l=a.indexOf(e.col.field);if(-1===i||-1===l)return;return a.splice(i,1),l=a.indexOf(e.col.field),a.splice("right"===o?l+1:l,0,r.field),void Dr({...Sr,[t]:a})}const a=Bn.map(e=>e.field),i=a.indexOf(r.field),l=a.filter(e=>e!==r.field);let d=l.indexOf(e.col.field);"right"===o&&(d+=1),l.splice(d,0,r.field),Jr(l),Po(l);const s=Ln.get(r.field);s&&Be?.({column:s,targetIndex:d,oldIndex:i},t,cr())})(t,e),onDragEnd:()=>wn(null)},e.createElement("div",{className:"mgh-grid-header-title-container"},f,l&&e.createElement("span",{className:V("mgh-grid-sort-icon",i&&"mgh-grid-sort-icon--active"),"aria-hidden":"true"},"desc"===i?.sort?e.createElement(Nt,{size:18}):e.createElement(Pt,{size:18}),i&&pr.filter(e=>e.sort).length>1&&e.createElement("span",{className:"mgh-grid-sort-index"},a+1))),d&&e.createElement(tr,{size:"small",className:V("mgh-grid-header-menu-btn",p&&"mgh-grid-header-menu-btn--open"),label:lr.columnMenuLabel,"aria-haspopup":"menu","aria-expanded":p,tabIndex:-1,onClick:e=>{e.stopPropagation(),un(t=>t?.field===o?null:{field:o,anchorEl:e.currentTarget})},onMouseDown:e=>e.stopPropagation()},e.createElement(Rt,null)),s&&e.createElement("div",{className:V("mgh-grid-resize-handle",hn===o&&"mgh-grid-resize-handle--active"),role:"separator","aria-orientation":"vertical",onPointerDown:e=>((e,t)=>{t.preventDefault(),t.stopPropagation(),qo.current={field:e.col.field,startX:t.clientX,startWidth:e.width,lastWidth:e.width,min:e.col.minWidth??G,max:e.col.maxWidth??1/0},fn(e.col.field);const r=e=>{const t=qo.current;if(!t)return;const r=H(t.startWidth+(e.clientX-t.startX),t.min,t.max);t.lastWidth=r,en(e=>e[t.field]===r?e:{...e,[t.field]:r})},n=()=>{window.removeEventListener("pointermove",r),window.removeEventListener("pointerup",n);const e=qo.current;if(qo.current=null,fn(null),!e)return;const t={...sr.current.columnWidths,[e.field]:e.lastWidth};en(t),No(t);const o=sr.current.getColumn(e.field);o&&e.lastWidth!==e.startWidth&&_e?.({colDef:o,width:e.lastWidth},cr())};window.addEventListener("pointermove",r),window.addEventListener("pointerup",n)})(t,e),onClick:e=>e.stopPropagation(),onDoubleClick:e=>{e.stopPropagation(),Ro({columns:[o]})},draggable:!1,onDragStart:e=>{e.preventDefault(),e.stopPropagation()}}))},ia=null===C.toolbar?null:C.toolbar??yr,la=null===C.footer?null:C.footer??wr,da=C.noRowsOverlay??Pr,sa=C.loadingOverlay??Nr,ca={...E,...k.toolbar},ga={text:M,...k.noRowsOverlay},ma={...k.loadingOverlay},pa=!a&&0===po.length,ua=pn?jn(pn.field):void 0,ha={height:"auto",flexGrow:1,...Vr(u),...Vr(p),...v},fa={flexGrow:1,...Vr(f),...Vr(h)},ba={...Vr(x),...Vr(b),"--mgh-grid-header-height":`${On}px`,"--mgh-grid-row-height":`${zn}px`},xa=e.useMemo(()=>{const e=[];return Fe(`[data-mgh-grid-id="${Qt}"]`,x,e),Fe(`[data-mgh-grid-id="${Qt}"]`,b,e),Fe(`[data-mgh-grid-card="${Qt}"]`,u,e),Fe(`[data-mgh-grid-card="${Qt}"]`,p,e),Fe(`[data-mgh-grid-box="${Qt}"]`,f,e),Fe(`[data-mgh-grid-box="${Qt}"]`,h,e),e.join("\n")},[Qt,x,b,u,p,f,h]),ya=Pn>0&&Pn<600,va=e.createElement("div",{ref:Jt,id:Qt,"data-mgh-grid-id":Qt,role:"grid","aria-rowcount":Yo+1,"aria-colcount":Wn.columns.length,"aria-multiselectable":!(!nt||it)||void 0,"aria-busy":a||void 0,className:V("mgh-grid",(B||yn)&&"mgh-grid--auto-height",yn&&"mgh-grid--printing",!Wn.hasPinning&&"mgh-grid--no-pinned-shadow",c),style:ba,onKeyDown:e=>{if(nn)return;const t=e.target;if(t&&("INPUT"===t.tagName||"SELECT"===t.tagName||"TEXTAREA"===t.tagName||"BUTTON"===t.tagName))return;const r=Math.max(1,Math.floor(Math.max(Nn-On,zn)/zn));switch(e.key){case"ArrowDown":e.preventDefault(),Uo(1,0);break;case"ArrowUp":e.preventDefault(),Uo(-1,0);break;case"ArrowLeft":e.preventDefault(),Uo(0,-1);break;case"ArrowRight":e.preventDefault(),Uo(0,1);break;case"PageDown":e.preventDefault(),Uo(r,0);break;case"PageUp":e.preventDefault(),Uo(-r,0);break;case"Home":e.preventDefault(),Uo(0,0,e.ctrlKey||e.metaKey?{row:"first",col:"first"}:{col:"first"});break;case"End":e.preventDefault(),Uo(0,0,e.ctrlKey||e.metaKey?{row:"last",col:"last"}:{col:"last"});break;case"Enter":case"F2":if(dn){const t=io.get(dn.id);if("group"===t?.type&&dn.field===D){const e=lo.get(dn.id);e&&Lo(e.id,!ro(e))}else e.preventDefault(),Go(dn.id,dn.field)}break;case" ":if(dn&&(nt||!at)){const t=po.find(e=>e.id===dn.id);t&&"leaf"===t.type&&t.row&&(e.preventDefault(),Do([t.id],!Kr.has(t.id),!1))}break;case"Escape":gn.open&&zo(),pn&&un(null);break;default:(e.ctrlKey||e.metaKey)&&"a"===e.key.toLowerCase()&&nt&&!it&&(e.preventDefault(),Do(Eo,!0))}}},w&&ia&&e.createElement("div",{ref:rr},e.createElement(ia,{...ca})),e.createElement("div",{className:"mgh-grid-main"},e.createElement("div",{ref:er,className:"mgh-grid-scroller",onScroll:vo,tabIndex:-1},e.createElement("div",{className:"mgh-grid-columns",role:"rowgroup",style:{width:Wn.totalWidth}},e.createElement("div",{className:"mgh-grid-header-row",role:"row","aria-rowindex":1,style:{height:On}},Wn.columns.map((e,t)=>aa(e,t)),e.createElement("div",{className:"mgh-grid-header-filler"}))),bt?.top&&bt.top.length>0&&e.createElement("div",{className:"mgh-grid-pinned-rows mgh-grid-pinned-rows--top",role:"rowgroup",style:{top:On,width:Wn.totalWidth}},oa(bt.top,"top")),e.createElement("div",{className:V("mgh-grid-body",xo?"mgh-grid-body--virtual":"mgh-grid-body--flow"),role:"rowgroup",style:xo?{height:bo.total,width:Wn.totalWidth}:{width:Wn.totalWidth,minHeight:pa||a?120:void 0}},(()=>{const{start:t,end:r}=yo,n=[];for(let o=t;o<r;o+=1){const t=po[o],r=na(t),a=bo.detailHeights[o],i="leaf"===t.type&&Boolean(t.row)&&Boolean(yt)&&qr.has(t.id),l=i&&t.row?yt?.(Bo(t.id,t.row)):null,d=!!(i&&t.row&&vt)&&"auto"===vt({id:t.id,row:t.row}),s=!(xo||!$||"leaf"!==t.type||!t.row||"auto"!==$({id:t.id,model:t.row,densityFactor:Rn}));n.push(e.createElement("div",{key:String(t.id),className:"mgh-grid-row-block",style:xo?{top:bo.offsets[o],width:Wn.totalWidth}:{width:Wn.totalWidth}},ra(r,{height:bo.rowHeights[o],index:o,isFirst:0===o,isLast:o===po.length-1,isAuto:s}),i&&null!=l&&!1!==l&&e.createElement("div",{className:"mgh-grid-detail-panel",style:{height:d?void 0:a||void 0,width:Pn||void 0},onClick:e=>e.stopPropagation()},l)))}return n})()),(bt?.bottom&&bt.bottom.length>0||uo)&&e.createElement("div",{className:"mgh-grid-pinned-rows mgh-grid-pinned-rows--bottom",role:"rowgroup",style:{width:Wn.totalWidth}},oa(bt?.bottom,"bottom"))),a&&e.createElement("div",{className:"mgh-grid-overlay mgh-grid-overlay--loading",style:{top:On}},e.createElement(sa,{...ma})),pa&&e.createElement("div",{className:"mgh-grid-overlay",style:{top:On}},e.createElement(da,{...ga}))),!ce&&la&&e.createElement(la,{...k.footer}),e.createElement(dr,{open:gn.open,anchorEl:gn.anchorEl,onClose:zo,themeMode:y,placement:"bottom-start",autoFocus:!0},"columns"===gn.openedPanelValue?e.createElement(Er,null):e.createElement(Ir,null)),ua&&pn&&e.createElement(Fr,{column:ua,anchorEl:pn.anchorEl,open:!0,onClose:()=>un(null),themeMode:y,panelAnchorEl:rr.current}));return e.createElement($e.Provider,{value:Qo},e.createElement("div",{ref:Zt,className:V("mgh-grid-card",s&&"mgh-grid-card--plain",g),"data-mgh-theme":y,"data-mgh-grid-card":Qt,style:ha},xa&&e.createElement("style",{"data-mgh-grid-sx":Qt},xa),!s&&(void 0!==i||d||l)&&e.createElement("div",{className:"mgh-grid-card-header"},void 0!==i&&e.createElement("h3",{className:"mgh-grid-card-title"},i),d&&e.createElement("div",{className:"mgh-grid-card-header-center"},d),e.createElement("div",{className:"mgh-grid-card-header-end",style:{gap:ya?8:16}},l)),e.createElement("div",{className:V("mgh-grid-box",m),"data-mgh-grid-box":Qt,style:fa},va)))}Br.displayName="MGHGrid";const _r="mgh-drp-styles",Ur='\n.mgh-drp, .mgh-drp-popover, .mgh-drp-calendars {\n --mgh-drp-font-family: var(--mgh-grid-font-family, inherit);\n --mgh-drp-font-size: var(--mgh-grid-font-size, 14px);\n --mgh-drp-paper: var(--mgh-grid-paper, #ffffff);\n --mgh-drp-fg: var(--mgh-grid-fg, rgba(0, 0, 0, 0.87));\n --mgh-drp-fg-secondary: var(--mgh-grid-fg-secondary, rgba(0, 0, 0, 0.6));\n --mgh-drp-fg-disabled: var(--mgh-grid-fg-disabled, rgba(0, 0, 0, 0.38));\n --mgh-drp-border: var(--mgh-grid-border, rgba(224, 224, 224, 1));\n --mgh-drp-input-border: var(--mgh-grid-input-border, rgba(0, 0, 0, 0.23));\n --mgh-drp-hover: var(--mgh-grid-hover, rgba(0, 0, 0, 0.04));\n --mgh-drp-primary: var(--mgh-grid-primary, #1976d2);\n --mgh-drp-primary-contrast: var(--mgh-grid-primary-contrast, #ffffff);\n --mgh-drp-focus: var(--mgh-grid-focus, #1976d2);\n --mgh-drp-selected: var(--mgh-grid-selected, rgba(25, 118, 210, 0.12));\n --mgh-drp-preview: rgba(0, 0, 0, 0.06);\n --mgh-drp-error: #d32f2f;\n --mgh-drp-radius: 4px;\n --mgh-drp-popover-radius: 8px;\n --mgh-drp-popover-shadow: var(--mgh-grid-popover-shadow, 0 5px 5px -3px rgba(0,0,0,.2), 0 8px 10px 1px rgba(0,0,0,.14), 0 3px 14px 2px rgba(0,0,0,.12));\n --mgh-drp-day-size: 36px;\n --mgh-drp-day-margin: 2px;\n font-family: var(--mgh-drp-font-family);\n font-size: var(--mgh-drp-font-size);\n color: var(--mgh-drp-fg);\n line-height: 1.5;\n}\n/* Dark values also apply to a calendar nested inside a dark picker / popover, so the calendar\'s own\n defaults (declared above for standalone use) never reset the colours back to light. */\n.mgh-drp[data-mgh-theme="dark"], .mgh-drp-popover[data-mgh-theme="dark"], .mgh-drp-calendars[data-mgh-theme="dark"],\n.mgh-drp[data-mgh-theme="dark"] .mgh-drp-calendars, .mgh-drp-popover[data-mgh-theme="dark"] .mgh-drp-calendars {\n --mgh-drp-paper: #212b36;\n --mgh-drp-fg: #ffffff;\n --mgh-drp-fg-secondary: rgba(255, 255, 255, 0.7);\n --mgh-drp-fg-disabled: rgba(255, 255, 255, 0.5);\n --mgh-drp-border: rgba(81, 81, 81, 1);\n --mgh-drp-input-border: rgba(255, 255, 255, 0.23);\n --mgh-drp-hover: rgba(255, 255, 255, 0.08);\n --mgh-drp-primary: #90caf9;\n --mgh-drp-primary-contrast: rgba(0, 0, 0, 0.87);\n --mgh-drp-focus: #90caf9;\n --mgh-drp-selected: rgba(144, 202, 249, 0.16);\n --mgh-drp-preview: rgba(255, 255, 255, 0.08);\n --mgh-drp-error: #f44336;\n}\n[class*="mgh-drp"], [class*="mgh-drp"]::before, [class*="mgh-drp"]::after { box-sizing: border-box; }\n\n/* ---- root / multi-input layout ---- */\n.mgh-drp { display: inline-flex; flex-direction: column; vertical-align: top; min-width: 0; }\n.mgh-drp--full-width { display: flex; width: 100%; }\n.mgh-drp-fields { display: flex; align-items: flex-start; gap: 8px; min-width: 0; }\n.mgh-drp-fields .mgh-drp-field { flex: 1 1 0; min-width: 0; }\n.mgh-drp-fields-separator { align-self: center; color: var(--mgh-drp-fg-secondary); padding: 0 2px; }\n\n/* ---- outlined text field (MUI TextField look-alike) ---- */\n.mgh-drp-field { position: relative; display: inline-flex; align-items: center; min-width: 0; width: 100%; border-radius: var(--mgh-drp-radius); color: var(--mgh-drp-fg); }\n.mgh-drp-field--medium { height: 56px; }\n.mgh-drp-field--small { height: 40px; }\n.mgh-drp-field:not(.mgh-drp-field--full-width) { width: 260px; }\n.mgh-drp-field--multi:not(.mgh-drp-field--full-width) { width: 170px; }\n.mgh-drp-field--full-width { width: 100%; }\n.mgh-drp-input { flex: 1 1 auto; min-width: 0; width: 100%; height: 100%; margin: 0; border: 0; outline: none; background: transparent; color: inherit; font: inherit; font-size: 1rem; letter-spacing: inherit; padding: 16.5px 14px; }\n.mgh-drp-field--small .mgh-drp-input { padding: 8.5px 14px; }\n.mgh-drp-field--adorned .mgh-drp-input { padding-right: 0; }\n.mgh-drp-input::placeholder { color: var(--mgh-drp-fg-disabled); opacity: 1; }\n.mgh-drp-input::-webkit-calendar-picker-indicator { display: none; }\n.mgh-drp-field--disabled .mgh-drp-input { color: var(--mgh-drp-fg-disabled); -webkit-text-fill-color: var(--mgh-drp-fg-disabled); }\n.mgh-drp-field--disabled { cursor: default; }\n.mgh-drp-field--clickable .mgh-drp-input { cursor: pointer; }\n.mgh-drp-adornment { display: flex; align-items: center; gap: 0; margin-right: 6px; flex: 0 0 auto; color: var(--mgh-drp-fg-secondary); }\n.mgh-drp-field--small .mgh-drp-adornment { margin-right: 4px; }\n\n/* notched outline */\n.mgh-drp-outline { position: absolute; inset: -5px 0 0 0; margin: 0; padding: 0 8px; pointer-events: none; border: 1px solid var(--mgh-drp-input-border); border-radius: inherit; min-width: 0; overflow: hidden; text-align: left; transition: border-color .15s; }\n.mgh-drp-outline legend { float: unset; width: auto; padding: 0; height: 11px; font-size: 0.75em; visibility: hidden; max-width: 0.01px; white-space: nowrap; transition: max-width 50ms cubic-bezier(0.0, 0, 0.2, 1) 0ms; overflow: hidden; display: block; line-height: 11px; }\n.mgh-drp-outline legend > span { padding-left: 5px; padding-right: 5px; display: inline-block; opacity: 0; visibility: visible; }\n.mgh-drp-field--shrink .mgh-drp-outline legend { max-width: 100%; transition: max-width 100ms cubic-bezier(0.0, 0, 0.2, 1) 50ms; }\n.mgh-drp-field--no-label .mgh-drp-outline legend { display: none; }\n.mgh-drp-field:hover:not(.mgh-drp-field--disabled) .mgh-drp-outline { border-color: var(--mgh-drp-fg); }\n.mgh-drp-field--focused .mgh-drp-outline, .mgh-drp-field--focused:hover .mgh-drp-outline { border-color: var(--mgh-drp-focus); border-width: 2px; }\n.mgh-drp-field--error .mgh-drp-outline, .mgh-drp-field--error:hover .mgh-drp-outline { border-color: var(--mgh-drp-error); }\n.mgh-drp-field--disabled .mgh-drp-outline { border-color: var(--mgh-drp-fg-disabled); }\n\n/* floating label */\n.mgh-drp-label { position: absolute; left: 0; top: 0; transform-origin: top left; transform: translate(14px, 16px) scale(1); color: var(--mgh-drp-fg-secondary); font-size: 1rem; line-height: 1.4375em; pointer-events: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: calc(100% - 24px); transition: color .15s, transform .15s cubic-bezier(0.0, 0, 0.2, 1), max-width .15s; z-index: 1; }\n.mgh-drp-field--small .mgh-drp-label { transform: translate(14px, 9px) scale(1); }\n.mgh-drp-field--shrink .mgh-drp-label, .mgh-drp-field--small.mgh-drp-field--shrink .mgh-drp-label { transform: translate(14px, -9px) scale(0.75); max-width: calc(133% - 32px); }\n.mgh-drp-field--focused .mgh-drp-label { color: var(--mgh-drp-focus); }\n.mgh-drp-field--error .mgh-drp-label { color: var(--mgh-drp-error); }\n.mgh-drp-field--disabled .mgh-drp-label { color: var(--mgh-drp-fg-disabled); }\n.mgh-drp-label-asterisk { margin-left: 2px; }\n\n.mgh-drp-helper { margin: 3px 14px 0; font-size: 0.75rem; line-height: 1.66; color: var(--mgh-drp-fg-secondary); }\n.mgh-drp-helper--error { color: var(--mgh-drp-error); }\n\n/* ---- buttons ---- */\n.mgh-drp-btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 0; margin: 0; background: transparent; color: var(--mgh-drp-fg-secondary); font: inherit; font-size: 0.8125rem; font-weight: 500; line-height: 1.75; letter-spacing: .02em; padding: 4px 8px; border-radius: 4px; cursor: pointer; user-select: none; transition: background-color .15s, color .15s; white-space: nowrap; text-transform: uppercase; }\n.mgh-drp-btn:hover { background: var(--mgh-drp-hover); color: var(--mgh-drp-fg); }\n.mgh-drp-btn:focus-visible { outline: 2px solid var(--mgh-drp-focus); outline-offset: 1px; }\n.mgh-drp-btn:disabled { color: var(--mgh-drp-fg-disabled); cursor: default; background: transparent; }\n.mgh-drp-btn--primary { color: var(--mgh-drp-primary); }\n.mgh-drp-btn--primary:hover { background: var(--mgh-drp-selected); color: var(--mgh-drp-primary); }\n.mgh-drp-btn--icon { padding: 8px; border-radius: 50%; width: 40px; height: 40px; text-transform: none; }\n.mgh-drp-btn--icon.mgh-drp-btn--small { width: 32px; height: 32px; padding: 4px; }\n.mgh-drp-icon { flex: 0 0 auto; }\n\n/* ---- popover ---- */\n.mgh-drp-popover { position: fixed; z-index: 1300; display: flex; flex-direction: column; background: var(--mgh-drp-paper); color: var(--mgh-drp-fg); border-radius: var(--mgh-drp-popover-radius); box-shadow: var(--mgh-drp-popover-shadow); outline: none; max-height: calc(100vh - 16px); max-width: calc(100vw - 16px); overflow: auto; animation: mgh-drp-pop .12s ease-out; }\n@keyframes mgh-drp-pop { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }\n.mgh-drp-layout { display: flex; flex-direction: row; align-items: stretch; }\n.mgh-drp-layout--with-toolbar { flex-direction: column; }\n.mgh-drp-layout-main { display: flex; flex-direction: row; align-items: stretch; }\n.mgh-drp-toolbar { padding: 16px 24px 0; }\n.mgh-drp-toolbar-title { font-size: 0.75rem; text-transform: uppercase; letter-spacing: .08em; color: var(--mgh-drp-fg-secondary); margin: 0 0 8px; }\n.mgh-drp-toolbar-range { display: flex; align-items: center; gap: 8px; font-size: 1.5rem; font-weight: 400; line-height: 1.334; }\n.mgh-drp-toolbar-range button { border: 0; background: transparent; padding: 0 2px; font: inherit; color: var(--mgh-drp-fg-secondary); cursor: pointer; border-radius: 4px; }\n.mgh-drp-toolbar-range button.mgh-drp-toolbar-range--active { color: var(--mgh-drp-fg); }\n.mgh-drp-toolbar-range button:hover { background: var(--mgh-drp-hover); }\n\n/* shortcuts (left column) */\n.mgh-drp-shortcuts { list-style: none; margin: 0; padding: 8px 0; min-width: 140px; max-height: 340px; overflow: auto; border-right: 1px solid var(--mgh-drp-border); display: flex; flex-direction: column; gap: 4px; padding-left: 8px; padding-right: 8px; }\n.mgh-drp-shortcut { display: inline-flex; align-items: center; height: 32px; padding: 0 12px; border-radius: 16px; border: 1px solid var(--mgh-drp-input-border); background: transparent; color: var(--mgh-drp-fg); font: inherit; font-size: 0.8125rem; cursor: pointer; white-space: nowrap; justify-content: flex-start; transition: background-color .15s; }\n.mgh-drp-shortcut:hover { background: var(--mgh-drp-hover); }\n.mgh-drp-shortcut:focus-visible { outline: 2px solid var(--mgh-drp-focus); outline-offset: 1px; }\n.mgh-drp-shortcut:disabled { color: var(--mgh-drp-fg-disabled); cursor: default; }\n.mgh-drp-shortcut--selected { background: var(--mgh-drp-selected); border-color: var(--mgh-drp-primary); color: var(--mgh-drp-primary); }\n\n/* ---- calendars ---- */\n.mgh-drp-calendars { display: flex; flex-direction: row; align-items: flex-start; }\n.mgh-drp-calendar { display: flex; flex-direction: column; width: calc(7 * (var(--mgh-drp-day-size) + 2 * var(--mgh-drp-day-margin)) + 24px); padding: 0 12px 8px; }\n.mgh-drp-calendar + .mgh-drp-calendar { border-left: 1px solid var(--mgh-drp-border); }\n.mgh-drp-calendar-header { display: flex; align-items: center; justify-content: space-between; min-height: 40px; margin: 12px 0 8px; padding: 0 4px; }\n.mgh-drp-calendar-label { flex: 1 1 auto; text-align: center; font-size: 1rem; font-weight: 500; }\n.mgh-drp-calendar-header .mgh-drp-btn--icon { color: var(--mgh-drp-fg-secondary); }\n.mgh-drp-calendar-nav-spacer { width: 40px; height: 40px; flex: 0 0 auto; }\n.mgh-drp-weekdays, .mgh-drp-week { display: flex; justify-content: center; }\n.mgh-drp-weekday { width: var(--mgh-drp-day-size); height: 40px; margin: 0 var(--mgh-drp-day-margin); display: flex; align-items: center; justify-content: center; font-size: 0.75rem; color: var(--mgh-drp-fg-secondary); font-weight: 400; }\n.mgh-drp-weeks { display: flex; flex-direction: column; min-height: calc(6 * (var(--mgh-drp-day-size) + 2 * var(--mgh-drp-day-margin))); }\n.mgh-drp-week { margin: var(--mgh-drp-day-margin) 0; }\n\n/* day cell: the outer wrapper carries the range highlight, the inner button the day itself */\n.mgh-drp-day-wrap { position: relative; width: calc(var(--mgh-drp-day-size) + 2 * var(--mgh-drp-day-margin)); height: var(--mgh-drp-day-size); display: flex; align-items: center; justify-content: center; }\n.mgh-drp-day-wrap--in-range { background: var(--mgh-drp-selected); }\n.mgh-drp-day-wrap--range-start { border-top-left-radius: 50%; border-bottom-left-radius: 50%; }\n.mgh-drp-day-wrap--range-end { border-top-right-radius: 50%; border-bottom-right-radius: 50%; }\n.mgh-drp-day-wrap--preview { border-top: 1px dashed var(--mgh-drp-fg-secondary); border-bottom: 1px dashed var(--mgh-drp-fg-secondary); }\n.mgh-drp-day-wrap--preview-start { border-left: 1px dashed var(--mgh-drp-fg-secondary); border-top-left-radius: 50%; border-bottom-left-radius: 50%; }\n.mgh-drp-day-wrap--preview-end { border-right: 1px dashed var(--mgh-drp-fg-secondary); border-top-right-radius: 50%; border-bottom-right-radius: 50%; }\n.mgh-drp-day-wrap--first-visible.mgh-drp-day-wrap--in-range:not(.mgh-drp-day-wrap--range-start) { border-top-left-radius: 50%; border-bottom-left-radius: 50%; }\n.mgh-drp-day-wrap--last-visible.mgh-drp-day-wrap--in-range:not(.mgh-drp-day-wrap--range-end) { border-top-right-radius: 50%; border-bottom-right-radius: 50%; }\n.mgh-drp-day-wrap--first-visible.mgh-drp-day-wrap--preview:not(.mgh-drp-day-wrap--preview-start) { border-top-left-radius: 50%; border-bottom-left-radius: 50%; border-left: 1px dashed var(--mgh-drp-fg-secondary); }\n.mgh-drp-day-wrap--last-visible.mgh-drp-day-wrap--preview:not(.mgh-drp-day-wrap--preview-end) { border-top-right-radius: 50%; border-bottom-right-radius: 50%; border-right: 1px dashed var(--mgh-drp-fg-secondary); }\n.mgh-drp-day { width: var(--mgh-drp-day-size); height: var(--mgh-drp-day-size); border-radius: 50%; border: 0; margin: 0; padding: 0; background: transparent; color: var(--mgh-drp-fg); font: inherit; font-size: 0.75rem; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; transition: background-color .15s, color .15s; position: relative; }\n.mgh-drp-day:hover { background: var(--mgh-drp-hover); }\n.mgh-drp-day:focus-visible { outline: 2px solid var(--mgh-drp-focus); outline-offset: -1px; }\n.mgh-drp-day--today:not(.mgh-drp-day--selected) { border: 1px solid var(--mgh-drp-fg-secondary); }\n.mgh-drp-day--outside { color: var(--mgh-drp-fg-secondary); opacity: .6; }\n.mgh-drp-day--hidden { visibility: hidden; pointer-events: none; }\n.mgh-drp-day--disabled, .mgh-drp-day--disabled:hover { color: var(--mgh-drp-fg-disabled); cursor: default; background: transparent; }\n.mgh-drp-day--selected, .mgh-drp-day--selected:hover { background: var(--mgh-drp-primary); color: var(--mgh-drp-primary-contrast); font-weight: 500; }\n.mgh-drp-day--selected:focus-visible { outline-offset: 2px; }\n.mgh-drp-calendar--read-only .mgh-drp-day, .mgh-drp-calendar--disabled .mgh-drp-day { cursor: default; }\n.mgh-drp-calendar--disabled .mgh-drp-day { color: var(--mgh-drp-fg-disabled); }\n.mgh-drp-calendar--disabled .mgh-drp-day--selected { opacity: .6; }\n\n/* ---- action bar ---- */\n.mgh-drp-actions { display: flex; align-items: center; justify-content: flex-end; gap: 8px; padding: 8px; border-top: 1px solid var(--mgh-drp-border); }\n.mgh-drp-actions--spread { justify-content: space-between; }\n.mgh-drp-actions-group { display: flex; gap: 8px; }\n\n@media (max-width: 599.95px) {\n .mgh-drp-layout-main { flex-direction: column; }\n .mgh-drp-shortcuts { flex-direction: row; flex-wrap: wrap; border-right: 0; border-bottom: 1px solid var(--mgh-drp-border); max-height: none; }\n .mgh-drp-calendars { flex-direction: column; align-items: center; }\n .mgh-drp-calendar + .mgh-drp-calendar { border-left: 0; border-top: 1px solid var(--mgh-drp-border); }\n}\n';let Wr=!1;const qr=e.useInsertionEffect??("undefined"!=typeof window?e.useLayoutEffect:e.useEffect),jr=()=>{qr(()=>{(()=>{if(Wr||"undefined"==typeof document)return;if(document.getElementById(_r))return void(Wr=!0);const e=document.createElement("style");e.id=_r,e.setAttribute("data-mgh-drp","true"),e.textContent=Ur,document.head.appendChild(e),Wr=!0})()},[])},Yr=(t,r)=>{const n=e.forwardRef(({size:r=24,className:n,style:o,...a},i)=>e.createElement("svg",{ref:i,viewBox:"0 0 24 24",width:r,height:r,fill:"currentColor",focusable:"false","aria-hidden":"true",className:["mgh-drp-icon",n].filter(Boolean).join(" "),style:o,...a},t));return n.displayName=r,n},Kr=Yr(e.createElement("path",{d:"M9 11H7v2h2v-2zm4 0h-2v2h2v-2zm4 0h-2v2h2v-2zm2-7h-1V2h-2v2H8V2H6v2H5c-1.11 0-1.99.9-1.99 2L3 20a2 2 0 0 0 2 2h14c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zm0 16H5V9h14v11z"}),"DateRangeIcon"),Xr=Yr(e.createElement("path",{d:"M15.41 16.59 10.83 12l4.58-4.59L14 6l-6 6 6 6 1.41-1.41z"}),"ChevronLeftIcon"),Qr=Yr(e.createElement("path",{d:"M8.59 16.59 13.17 12 8.59 7.41 10 6l6 6-6 6-1.41-1.41z"}),"ChevronRightIcon"),Jr=Yr(e.createElement("path",{d:"M19 6.41 17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"}),"CloseIcon");var Zr=Object.freeze({__proto__:null,ChevronLeftIcon:Xr,ChevronRightIcon:Qr,CloseIcon:Jr,DateRangeIcon:Kr});p.extend(h);const en=(...e)=>e.filter(Boolean).join(" "),tn=(e,t,r)=>Math.min(Math.max(e,t),r),rn=[null,null],nn=e=>{if(null==e||""===e)return null;if(p.isDayjs(e))return e.isValid()?e:null;if(e instanceof Date||"number"==typeof e||"string"==typeof e){const t=p(e);return t.isValid()?t:null}return null},on=(e,t)=>!!e&&!!t&&e.isSame(t,"day"),an=(e,t)=>e.isBefore(t,"day"),ln=(e,t)=>e.isAfter(t,"day"),dn=(e,t,r)=>!(!t||!r||an(e,t)||ln(e,r)),sn=(e,t)=>{if(e===t)return!0;if(!e||!t)return!1;const r=(e,t)=>null==e&&null==t||!!e&&!!t&&e.isSame(t,"day");return r(e[0],t[0])&&r(e[1],t[1])},cn=e=>Array.isArray(e)?[nn(e[0]),nn(e[1])]:rn,gn=(e,t)=>{const r=e.trim();if(!r)return null;const n=p(r,t,!0);if(n.isValid())return n;const o=[t.replace(/MM/g,"M").replace(/DD/g,"D"),"M/D/YYYY","M/D/YY","YYYY-MM-DD","MM-DD-YYYY","M-D-YYYY"];for(const e of o){const t=p(r,e,!0);if(t.isValid())return t}return null},mn=(e,t)=>e&&e.isValid()?e.format(t):"",pn=(e,t,r,n=p())=>null==e?null:e.isValid()?r.disablePast&&an(e,n)?"disablePast":r.disableFuture&&ln(e,n)?"disableFuture":r.minDate&&an(e,r.minDate)?"minDate":r.maxDate&&ln(e,r.maxDate)?"maxDate":r.shouldDisableDate?.(e,t)?"shouldDisableDate":null:"invalidDate",un=(e,t)=>{const r=p(),n=pn(e[0],"start",t,r),o=pn(e[1],"end",t,r);return!n&&!o&&e[0]&&e[1]&&ln(e[0],e[1])?["invalidRange","invalidRange"]:[n,o]},hn=(e,t,r)=>null!=pn(e,t,r),fn=[{label:"This Week",getValue:()=>{const e=p();return[e.startOf("week"),e.endOf("week")]}},{label:"Last Week",getValue:()=>{const e=p().subtract(7,"day");return[e.startOf("week"),e.endOf("week")]}},{label:"Last 7 Days",getValue:()=>{const e=p();return[e.subtract(7,"day"),e]}},{label:"Current Month",getValue:()=>{const e=p();return[e.startOf("month"),e.endOf("month")]}},{label:"Next Month",getValue:()=>{const e=p().add(1,"month");return[e.startOf("month"),e.endOf("month")]}},{label:"Reset",getValue:()=>[null,null]}],bn=e=>e.format("dd").charAt(0).toUpperCase();function xn({value:t,defaultValue:r,onChange:n,rangePosition:o,onRangePositionChange:a,calendars:i=2,referenceDate:l,minDate:d,maxDate:s,disablePast:c,disableFuture:g,shouldDisableDate:m,disabled:u=!1,readOnly:h=!1,showDaysOutsideCurrentMonth:f=!1,fixedWeekNumber:b,dayOfWeekFormatter:x=bn,disableHighlightToday:y=!1,showRangePreview:v=!0,autoFocus:w=!1,onMonthChange:E,localeText:C,themeMode:k,className:M,style:S}){jr();const D=void 0!==t,[I,F]=e.useState(()=>cn(r??rn)),P=e.useMemo(()=>D?cn(t):I,[D,t,I]),[N,R]=P,[z,O]=e.useState("start"),G=o??z,T=e.useCallback(e=>{void 0===o&&O(e),a?.(e)},[o,a]),A=e.useMemo(()=>({minDate:d,maxDate:s,disablePast:c,disableFuture:g,shouldDisableDate:m}),[d,s,c,g,m]),[L,H]=e.useState(()=>(N??R??l??p()).startOf("month")),V=e.useMemo(()=>Array.from({length:i},(e,t)=>L.add(t,"month")),[L,i]),$=V[V.length-1],B=e.useCallback(e=>{const t=e.startOf("month");H(e=>e.isSame(t,"month")?e:(E?.(t),t))},[E]),_=e.useCallback(e=>{an(e,L.startOf("month"))?B(e):ln(e,$.endOf("month"))&&B(e.subtract(i-1,"month"))},[L,$,i,B]),U=e.useRef(P);e.useEffect(()=>{const e=U.current;U.current=P;const t="end"===G?R??N:N??R;if(!t)return;(!on(e[0],N)||!on(e[1],R))&&_(t)},[N,R]);const W=!d||L.isAfter(d,"month"),q=!s||$.isBefore(s,"month"),[j,Y]=e.useState(null),K=e.useMemo(()=>!v||!j||u||h?rn:"end"===G&&N&&!R?an(j,N)?rn:[N,j]:"start"===G&&R&&!N?ln(j,R)?rn:[j,R]:rn,[v,j,G,N,R,u,h]),X=e.useCallback(e=>{if(u||h)return;if(hn(e,G,A))return;let t,r;"start"===G?(t=[e,R&&ln(e,R)?null:R],r="end"):N&&an(e,N)?(t=[e,null],r="end"):(t=[N,e],r="start"),D||F(t),n?.(t,e,G),T(r)},[u,h,G,A,R,N,D,n,T]),[Q,J]=e.useState(()=>N??R??l??p()),Z=e.useRef(null),ee=e.useRef(w),te=e.useCallback(e=>{const t=e.format("YYYY-MM-DD"),r=Z.current?.querySelector(`[data-day="${t}"]`);r?.focus()},[]);e.useEffect(()=>{if(!ee.current)return;ee.current=!1;const e=Q;_(e);const t=window.setTimeout(()=>te(e),0);return()=>window.clearTimeout(t)},[]);const re=(e,t)=>{let r=null;switch(e.key){case"ArrowLeft":r=t.subtract(1,"day");break;case"ArrowRight":r=t.add(1,"day");break;case"ArrowUp":r=t.subtract(7,"day");break;case"ArrowDown":r=t.add(7,"day");break;case"Home":r=t.startOf("week");break;case"End":r=t.endOf("week");break;case"PageUp":r=e.shiftKey?t.subtract(1,"year"):t.subtract(1,"month");break;case"PageDown":r=e.shiftKey?t.add(1,"year"):t.add(1,"month");break;case"Enter":case" ":return e.preventDefault(),void X(t);default:return}e.preventDefault(),r&&(e=>{J(e),_(e),window.setTimeout(()=>te(e),0)})(r)},ne=e.useMemo(()=>(e=>{const t=p().startOf("week");return Array.from({length:7},(r,n)=>{const o=t.add(n,"day");return{key:o.format("dd"),label:e(o),full:o.format("dddd")}})})(x),[x]),oe=p(),ae=K[0],ie=K[1],le=!!N&&!!R;return e.createElement("div",{ref:Z,className:en("mgh-drp-calendars",u&&"mgh-drp-calendar--disabled",h&&"mgh-drp-calendar--read-only",M),"data-mgh-theme":k,"data-range-position":G,style:S,onMouseLeave:()=>Y(null)},V.map((t,r)=>{const n=((e,t)=>{const r=e.startOf("month"),n=r.startOf("week"),o=Math.ceil(r.endOf("month").diff(n,"day")/7+1/7),a=t&&t>0?t:Math.max(o,1),i=[];for(let e=0;e<a;e+=1){const t=n.add(7*e,"day");i.push({key:t.format("YYYY-MM-DD"),days:Array.from({length:7},(e,n)=>{const o=t.add(n,"day");return{day:o,outsideMonth:!o.isSame(r,"month")}})})}return i})(t,b),o=0===r,a=r===V.length-1,i=(Q.isSame(t,"month")?Q:null)??(N&&N.isSame(t,"month")?N:null)??(R&&R.isSame(t,"month")?R:null)??(o&&!V.some(e=>Q.isSame(e,"month"))?t.startOf("month"):null);return e.createElement("div",{key:t.format("YYYY-MM"),className:"mgh-drp-calendar",role:"group","aria-label":t.format("MMMM YYYY")},e.createElement("div",{className:"mgh-drp-calendar-header"},o?e.createElement("button",{type:"button",className:"mgh-drp-btn mgh-drp-btn--icon","aria-label":C?.previousMonth??"Previous month",title:C?.previousMonth??"Previous month",disabled:u||!W,onClick:()=>B(L.subtract(1,"month"))},e.createElement(Xr,null)):e.createElement("span",{className:"mgh-drp-calendar-nav-spacer"}),e.createElement("div",{className:"mgh-drp-calendar-label","aria-live":"polite"},t.format("MMMM YYYY")),a?e.createElement("button",{type:"button",className:"mgh-drp-btn mgh-drp-btn--icon","aria-label":C?.nextMonth??"Next month",title:C?.nextMonth??"Next month",disabled:u||!q,onClick:()=>B(L.add(1,"month"))},e.createElement(Qr,null)):e.createElement("span",{className:"mgh-drp-calendar-nav-spacer"})),e.createElement("div",{className:"mgh-drp-weekdays",role:"row"},ne.map(t=>e.createElement("span",{key:t.key,className:"mgh-drp-weekday",role:"columnheader","aria-label":t.full},t.label))),e.createElement("div",{className:"mgh-drp-weeks",role:"grid","aria-label":t.format("MMMM YYYY")},n.map(t=>e.createElement("div",{key:t.key,className:"mgh-drp-week",role:"row"},t.days.map(({day:t,outsideMonth:r},n)=>{const o=r&&!f,a=on(t,N),l=on(t,R),d=a||l,s=!o&&le&&dn(t,N,R),c=!o&&!!ae&&!!ie&&dn(t,ae,ie),g=u||hn(t,G,A),m=!!i&&on(t,i)&&!o,p=0===n||!f&&1===t.date(),h=6===n||!f&&t.date()===t.daysInMonth();return e.createElement("div",{key:t.format("YYYY-MM-DD"),role:"gridcell","aria-selected":d||void 0,className:en("mgh-drp-day-wrap",s&&"mgh-drp-day-wrap--in-range",s&&a&&"mgh-drp-day-wrap--range-start",s&&l&&"mgh-drp-day-wrap--range-end",c&&"mgh-drp-day-wrap--preview",c&&on(t,ae)&&"mgh-drp-day-wrap--preview-start",c&&on(t,ie)&&"mgh-drp-day-wrap--preview-end",p&&"mgh-drp-day-wrap--first-visible",h&&"mgh-drp-day-wrap--last-visible")},e.createElement("button",{type:"button","data-day":t.format("YYYY-MM-DD"),tabIndex:m?0:-1,"aria-label":t.format("dddd, MMMM D, YYYY"),"aria-current":!y&&on(t,oe)?"date":void 0,"aria-disabled":g||void 0,disabled:o,className:en("mgh-drp-day",o&&"mgh-drp-day--hidden",r&&!o&&"mgh-drp-day--outside",d&&"mgh-drp-day--selected",!y&&on(t,oe)&&"mgh-drp-day--today",g&&"mgh-drp-day--disabled"),onClick:()=>X(t),onMouseEnter:()=>Y(t),onMouseLeave:()=>Y(e=>e&&on(e,t)?null:e),onFocus:()=>J(t),onKeyDown:e=>re(e,t)},t.date()))})))))}))}const yn={start:"Start",end:"End",fieldSeparator:"–",openPicker:"Choose date range",clear:"Clear",today:"Today",cancel:"Cancel",accept:"OK",previousMonth:"Previous month",nextMonth:"Next month",toolbarTitle:"Select date range"};function vn({open:t,anchorEl:r,placement:n,onDismiss:o,themeMode:a,className:i,style:l,labelledBy:d,children:s}){const c=e.useRef(null),[g,m]=e.useState({top:0,left:0,ready:!1}),p=e.useCallback(()=>{const e=c.current;if(!e)return;const t=window.innerWidth,o=window.innerHeight,a=e.offsetWidth,i=e.offsetHeight;let l,d;if(r&&r.isConnected){const e=r.getBoundingClientRect();l=e.bottom+4,l+i>o-8&&e.top-4-i>=8&&(l=e.top-4-i),d="bottom-end"===n?e.right-a:"bottom"===n?e.left+e.width/2-a/2:e.left}else l=o/2-i/2,d=t/2-a/2;l=tn(l,8,Math.max(8,o-i-8)),d=tn(d,8,Math.max(8,t-a-8)),m(e=>e.ready&&e.top===l&&e.left===d?e:{top:l,left:d,ready:!0})},[r,n]);return e.useLayoutEffect(()=>{if(!t)return void m(e=>e.ready?{...e,ready:!1}:e);p(),window.addEventListener("resize",p),window.addEventListener("scroll",p,!0);let e=null;return"undefined"!=typeof ResizeObserver&&c.current&&(e=new ResizeObserver(()=>p()),e.observe(c.current)),()=>{window.removeEventListener("resize",p),window.removeEventListener("scroll",p,!0),e?.disconnect()}},[t,p]),e.useEffect(()=>{if(!t)return;const e=e=>{const t=e.target;t&&(c.current?.contains(t)||r?.contains(t)||o("backdrop"))},n=e=>{"Escape"===e.key&&o("escape")};return document.addEventListener("mousedown",e,!0),document.addEventListener("touchstart",e,!0),document.addEventListener("keydown",n),()=>{document.removeEventListener("mousedown",e,!0),document.removeEventListener("touchstart",e,!0),document.removeEventListener("keydown",n)}},[t,o,r]),t&&"undefined"!=typeof document?u.createPortal(e.createElement("div",{ref:c,role:"dialog","aria-modal":"false","aria-labelledby":d,tabIndex:-1,className:en("mgh-drp-popover",i),"data-mgh-theme":a,style:{top:g.top,left:g.left,visibility:g.ready?"visible":"hidden",...l},onMouseDown:e=>e.stopPropagation()},s),document.body):null}const wn=e.forwardRef(function({id:t,label:r,value:n,placeholder:o,size:a,fullWidth:i,multi:l,disabled:d,readOnly:s,required:c,error:g,focused:m,clickable:p,name:u,autoFocus:h,inputRef:f,adornment:b,ariaLabel:x,onChange:y,onFocus:v,onBlur:w,onClick:E,onKeyDown:C},k){const M=null!=r&&""!==r,S=m||""!==n||!M;return e.createElement("div",{ref:k,className:en("mgh-drp-field",`mgh-drp-field--${a}`,i&&"mgh-drp-field--full-width",l&&"mgh-drp-field--multi",S&&"mgh-drp-field--shrink",m&&"mgh-drp-field--focused",d&&"mgh-drp-field--disabled",g&&"mgh-drp-field--error",p&&"mgh-drp-field--clickable",!M&&"mgh-drp-field--no-label",!!b&&"mgh-drp-field--adorned"),onClick:E},M&&e.createElement("label",{className:"mgh-drp-label",htmlFor:t},r,c&&e.createElement("span",{className:"mgh-drp-label-asterisk","aria-hidden":"true"},"*")),e.createElement("input",{id:t,ref:f,name:u,className:"mgh-drp-input",type:"text",inputMode:"numeric",autoComplete:"off",spellCheck:!1,value:n,placeholder:S?o:void 0,disabled:d,readOnly:s,required:c,autoFocus:h,"aria-label":x,"aria-invalid":g||void 0,onChange:e=>y(e.target.value),onFocus:v,onBlur:w,onKeyDown:C}),b&&e.createElement("div",{className:"mgh-drp-adornment"},b),e.createElement("fieldset",{"aria-hidden":"true",className:"mgh-drp-outline"},e.createElement("legend",null,e.createElement("span",null,M?r:"",M&&c?" *":""))))}),En=e.forwardRef(function({value:t,defaultValue:r,onChange:n,onAccept:o,onError:a,open:i,onOpen:l,onClose:d,rangePosition:s,onRangePositionChange:c,label:g,format:m="MM/DD/YYYY",fieldVariant:u="single",size:h="small",fullWidth:f=!1,clearable:b=!1,openOnClick:x,disableOpenPicker:y=!1,closeOnSelect:v,shortcuts:w,actions:E=[],showToolbar:C=!1,localeText:k,calendars:M=2,referenceDate:S,minDate:D,maxDate:I,disablePast:F,disableFuture:P,shouldDisableDate:N,disabled:R=!1,readOnly:z=!1,showDaysOutsideCurrentMonth:O,fixedWeekNumber:G,dayOfWeekFormatter:T,disableHighlightToday:A,showRangePreview:L,onMonthChange:H,name:V,id:$,placeholder:B,required:_,error:U,helperText:W,autoFocus:q,inputRef:j,themeMode:Y,themeVars:K,className:X,style:Q,popoverClassName:J,popoverStyle:Z,placement:ee="bottom-start"},te){jr();const re=e.useMemo(()=>({...yn,...k}),[k]),ne=re.datePlaceholder??m,oe="multi"===u,ae=x??oe,ie=v??!E.includes("accept"),le=e.useId(),de=$??`mgh-drp-${le.replace(/:/g,"")}`,se=oe?`${de}-start`:de,ce=`${de}-end`,ge=`${de}-title`,me=void 0!==t,[pe,ue]=e.useState(()=>cn(r??rn)),he=e.useMemo(()=>me?cn(t):pe,[me,t,pe]),[fe,be]=he,xe=e.useMemo(()=>({minDate:D,maxDate:I,disablePast:F,disableFuture:P,shouldDisableDate:N}),[D,I,F,P,N]),ye=e.useMemo(()=>un(he,xe),[he,xe]),ve=e.useCallback(e=>un(e,xe).every(e=>null==e),[xe]),we=e.useRef(null);e.useEffect(()=>{const e=we.current;e&&e[0]===ye[0]&&e[1]===ye[1]||((null!==e||ye[0]||ye[1])&&a?.(ye,he),we.current=ye)},[ye,he,a]);const Ee=e.useCallback((e,t)=>{me||ue(e);const r={validationError:un(e,xe)};t&&(r.shortcut=t),n?.(e,r)},[me,n,xe]),[Ce,ke]=e.useState("start"),Me=s??Ce,Se=e.useCallback(e=>{void 0===s&&ke(e),c?.(e)},[s,c]),De=void 0!==i,[Ie,Fe]=e.useState(!1),Pe=De?!!i:Ie,Ne=e.useRef(he),Re=e.useRef(he),ze=e.useCallback((e,t=!1)=>{!t&&sn(e,Re.current)||(Re.current=e,o?.(e))},[o]),Oe=e.useRef(null),Ge=e.useRef(null),Te=e.useRef(null),[Ae,Le]=e.useState(void 0);e.useEffect(()=>{if(void 0!==Y)return;const e=Oe.current?.parentElement?.closest("[data-mgh-theme]")?.getAttribute("data-mgh-theme");Le("dark"===e?"dark":"light"===e?"light":void 0)});const He=Y??Ae,Ve=e.useCallback(e=>{Oe.current=e,"function"==typeof te?te(e):te&&(te.current=e)},[te]),$e=e.useCallback(e=>{R||z||Pe||(Ne.current=he,Te.current=document.activeElement??null,Se(e??(fe&&!be?"end":"start")),De||Fe(!0),l?.())},[R,z,Pe,he,fe,be,Se,De,l]),Be=e.useCallback(()=>{if(!Pe)return;De||Fe(!1),d?.();const e=Ge.current??Te.current;window.setTimeout(()=>e?.focus?.(),0)},[Pe,De,d]),_e=e.useCallback(e=>{ze(e,!0),Be()},[ze,Be]),Ue=e.useCallback(()=>{ze(he),Be()},[he,ze,Be]),We=e.useCallback((e,t,r)=>{Ee(e),"end"===r&&e[0]&&e[1]&&ie&&_e(e)},[Ee,ie,_e]),[qe,je]=e.useState(null),Ye=e.useCallback(e=>{const[t,r]=e;return t||r?`${t?mn(t,m):ne} ${re.fieldSeparator} ${r?mn(r,m):ne}`:""},[m,ne,re.fieldSeparator]),[Ke,Xe]=e.useState(()=>Ye(he)),[Qe,Je]=e.useState(()=>mn(fe,m)),[Ze,et]=e.useState(()=>mn(be,m)),[tt,rt]=e.useState({single:!1,start:!1,end:!1});e.useEffect(()=>{"single"!==qe&&(Xe(Ye(he)),rt(e=>e.single?{...e,single:!1}:e)),"start"!==qe&&(Je(mn(fe,m)),rt(e=>e.start?{...e,start:!1}:e)),"end"!==qe&&(et(mn(be,m)),rt(e=>e.end?{...e,end:!1}:e))},[he,fe,be,qe,m,Ye]);const nt=e=>{const t=e.trim();if(!t||t.toUpperCase()===ne.toUpperCase())return{date:null,invalid:!1};const r=gn(t,m);return{date:r,invalid:null==r}},ot=(e,t)=>{"start"===e?Je(t):et(t);const r=nt(t);if(rt(t=>({...t,[e]:r.invalid})),r.invalid)return;const n="start"===e?[r.date,be]:[fe,r.date];sn(n,he)||Ee(n)},at=e=>{je(t=>t===e?null:t),"single"!==e||tt.single||Xe(Ye(he)),"start"!==e||tt.start||Je(mn(fe,m)),"end"!==e||tt.end||et(mn(be,m)),Pe||ze(he)},it=(e,t)=>{"ArrowDown"!==e.key||e.altKey?"Enter"===e.key&&(e.preventDefault(),Pe||ze(he)):(e.preventDefault(),$e(t))},lt=!!fe||!!be,dt=ye.some(e=>null!=e),st=!!U||dt||tt.single||tt.start||tt.end,ct=!y&&e.createElement("button",{ref:Ge,type:"button",className:en("mgh-drp-btn mgh-drp-btn--icon","small"===h&&"mgh-drp-btn--small"),"aria-label":re.openPicker,title:re.openPicker,"aria-haspopup":"dialog","aria-expanded":Pe,disabled:R,onClick:e=>{e.stopPropagation(),Pe?Ue():$e()}},e.createElement(Kr,{size:"small"===h?20:24})),gt=b&&lt&&!R&&!z&&e.createElement("button",{type:"button",className:en("mgh-drp-btn mgh-drp-btn--icon","small"===h&&"mgh-drp-btn--small"),"aria-label":re.clear,title:re.clear,onClick:e=>{e.stopPropagation(),Ee(rn),Se("start"),ze(rn)}},e.createElement(Jr,{size:"small"===h?18:20})),mt=e.useMemo(()=>({...K,...Q}),[K,Q]),pt=e.useMemo(()=>({...K,...Z}),[K,Z]),ut=e.useMemo(()=>(w??[]).map((e,t)=>{let r=rn;try{r=cn(e.getValue({isValid:ve}))}catch{}return{shortcut:e,key:e.id??`${e.label}-${t}`,value:r}}),[w,ve]),ht=e.createElement(xn,{value:he,onChange:We,rangePosition:Me,onRangePositionChange:Se,calendars:M,referenceDate:S,minDate:D,maxDate:I,disablePast:F,disableFuture:P,shouldDisableDate:N,showDaysOutsideCurrentMonth:O,fixedWeekNumber:G,dayOfWeekFormatter:T,disableHighlightToday:A,showRangePreview:L,onMonthChange:H,localeText:re,themeMode:He,autoFocus:!0}),ft={size:h,fullWidth:f,disabled:R,readOnly:z,required:_,error:st};return e.createElement("div",{ref:Ve,className:en("mgh-drp",f&&"mgh-drp--full-width",oe&&"mgh-drp--multi",X),"data-mgh-theme":He,style:mt},oe?e.createElement("div",{className:"mgh-drp-fields"},e.createElement(wn,{...ft,multi:!0,id:se,name:V?`${V}-start`:void 0,label:re.start,value:Qe,placeholder:B??ne,focused:"start"===qe,clickable:ae,autoFocus:q,inputRef:j,onChange:e=>ot("start",e),onFocus:()=>{je("start"),Se("start")},onBlur:()=>at("start"),onClick:()=>ae&&$e("start"),onKeyDown:e=>it(e,"start")}),e.createElement("span",{className:"mgh-drp-fields-separator","aria-hidden":"true"},re.fieldSeparator),e.createElement(wn,{...ft,multi:!0,id:ce,name:V?`${V}-end`:void 0,label:re.end,value:Ze,placeholder:B??ne,focused:"end"===qe,clickable:ae,adornment:e.createElement(e.Fragment,null,gt,ct),onChange:e=>ot("end",e),onFocus:()=>{je("end"),Se("end")},onBlur:()=>at("end"),onClick:()=>ae&&$e("end"),onKeyDown:e=>it(e,"end")})):e.createElement(wn,{...ft,id:se,name:V,label:g,value:Ke,placeholder:B??`${ne} ${re.fieldSeparator} ${ne}`,focused:"single"===qe,clickable:ae,autoFocus:q,inputRef:j,ariaLabel:null==g?re.toolbarTitle:void 0,adornment:e.createElement(e.Fragment,null,gt,ct),onChange:e=>{Xe(e);const[t,r]=(e=>{const t=e.split(/\s+[–—-]\s+|\s*–\s*|\s*—\s*|\s+to\s+/i);return t.length>=2?[t[0],t.slice(1).join(" ")]:[e,""]})(e),n=nt(t),o=nt(r),a=n.invalid||o.invalid;if(rt(e=>({...e,single:a})),a)return;const i=[n.date,o.date];sn(i,he)||Ee(i)},onFocus:()=>je("single"),onBlur:()=>at("single"),onClick:()=>ae&&$e(),onKeyDown:e=>it(e,"start")}),null!=W&&""!==W&&e.createElement("div",{className:en("mgh-drp-helper",st&&"mgh-drp-helper--error")},W),e.createElement(vn,{open:Pe,anchorEl:Oe.current,placement:ee,onDismiss:Ue,themeMode:He,className:J,style:pt,labelledBy:C?ge:void 0},e.createElement("div",{className:en("mgh-drp-layout",C&&"mgh-drp-layout--with-toolbar")},C&&e.createElement("div",{className:"mgh-drp-toolbar"},e.createElement("p",{className:"mgh-drp-toolbar-title",id:ge},re.toolbarTitle),e.createElement("div",{className:"mgh-drp-toolbar-range"},e.createElement("button",{type:"button",className:en("start"===Me&&"mgh-drp-toolbar-range--active"),onClick:()=>Se("start")},fe?mn(fe,m):re.start),e.createElement("span",null,re.fieldSeparator),e.createElement("button",{type:"button",className:en("end"===Me&&"mgh-drp-toolbar-range--active"),onClick:()=>Se("end")},be?mn(be,m):re.end))),e.createElement("div",{className:"mgh-drp-layout-main"},ut.length>0&&e.createElement("ul",{className:"mgh-drp-shortcuts","aria-label":"Shortcuts"},ut.map(({shortcut:t,key:r,value:n})=>e.createElement("li",{key:r},e.createElement("button",{type:"button",className:en("mgh-drp-shortcut",lt&&sn(n,he)&&"mgh-drp-shortcut--selected"),disabled:R||z,onClick:()=>(e=>{const t=cn(e.getValue({isValid:ve}));Ee(t,e),Se("start"),_e(t)})(t)},t.label)))),ht),E.length>0&&e.createElement("div",{className:"mgh-drp-actions"},E.map(t=>e.createElement("button",{key:t,type:"button",className:en("mgh-drp-btn",("accept"===t||"today"===t)&&"mgh-drp-btn--primary"),onClick:()=>(e=>{switch(e){case"clear":Ee(rn),Se("start"),_e(rn);break;case"today":{const e=p().startOf("day"),t=[e,e];Ee(t),Se("start"),ie&&_e(t);break}case"cancel":sn(he,Ne.current)||Ee(Ne.current),Be();break;default:_e(he)}})(t)},re[t]))))))});En.displayName="MGHDateRangePicker",exports.ConfirmDialog=function({title:t,content:r,action:n,open:o,onClose:a,...g}){return e.createElement(l,{fullWidth:!0,maxWidth:"xs",open:o,onClose:a,...g},e.createElement(d,{sx:{pb:2}},t),r&&e.createElement(c,{sx:{typography:"body2"}}," ",r," "),e.createElement(s,null,e.createElement(i,{onClick:a},"Cancel"),n))},exports.CustomGridToolbarExport=function({csvOptions:t={allColumns:!0},excelOptions:n={allColumns:!0},printOptions:o,customMenuItem:a,...i}){return e.createElement(r.GridToolbarExportContainer,{...i},a,e.createElement(r.GridCsvExportMenuItem,{options:t}),e.createElement(r.GridExcelExportMenuItem,{options:n}),e.createElement(r.GridPrintExportMenuItem,{options:o}))},exports.CustomNoRowsOverlay=b,exports.DataGridQuickFilter=C,exports.ExportingDialog=function({open:r,text:n=e.createElement(e.Fragment,null,"Your export is currently being built. Some larger exports can take a couple of minutes to complete. ",e.createElement("br",null),e.createElement("br",null),"Please do not close your browser or refresh the page.")}){return e.createElement(t.Dialog,{open:r,fullWidth:!0,sx:{p:4}},e.createElement(t.DialogContent,{sx:{p:4,textAlign:"center"}},e.createElement(t.Typography,{variant:"subtitle1",sx:{mb:3}},n),e.createElement(t.CircularProgress,null)))},exports.GRID_CHECKBOX_SELECTION_COL_DEF=ke,exports.GRID_CHECKBOX_SELECTION_FIELD=I,exports.GRID_DETAIL_PANEL_TOGGLE_COL_DEF=Me,exports.GRID_DETAIL_PANEL_TOGGLE_FIELD=F,exports.GRID_ROW_GROUPING_SINGLE_GROUPING_FIELD=D,exports.Iconify=k,exports.Label=S,exports.MGHDataGrid=function({header:n,rows:o,columns:a,onRowClick:i,onRowDoubleClick:l,pagination:d=!0,pageSize:s=25,slots:c={},slotProps:g={},toolbarProps:m={},initialState:p={},pageSizeOptions:u=[10,25,50,100],sx:h={},cardSx:x={flexGrow:1},boxSx:E={flexGrow:1},columnVisibilityModel:C,onColumnVisibilityModelChange:k,columnVisibilityStorageKey:M,columnOrderStorageKey:S,disableDensitySelector:D=!1,disableRowSelectionOnClick:I=!0,disableColumnFilter:F=!1,disableColumnMenu:P=!1,disableColumnSelector:N=!1,checkboxSelectionVisibleOnly:R=!1,renderHeaderEndContent:z,renderHeaderCenterContent:O,noRowsText:G="No data found within selected parameters.",checkboxSelection:T=!1,onRowSelectionModelChange:A,rowSelectionModel:L,getRowClassName:H,getDetailPanelContent:V,getDetailPanelHeight:$,loading:B=!1,isRowSelectable:_,getRowHeight:U,showToolbar:W=!0,hideFooterRowCount:q=!1,onColumnOrderChange:j,defaultGroupingExpansionDepth:Y,pinnedRows:K,keepNonExistentRowsSelected:X=!0}){const Q=f("down","sm"),J=e.useMemo(()=>{if(M)return y(M)??void 0},[M]),Z=e.useMemo(()=>{if(!S)return;return((e,t)=>{if(!e||0===e.length)return;const r=new Set(t.map(e=>e.field));return e.filter(e=>r.has(e))})(y(S),a)},[S,a]),ee=void 0!==C?C:J,te=e.useCallback((e,t)=>{M&&v(M,e),k?.(e,t)},[M,k]),re=e.useCallback((e,t,r)=>{if(S){const e=r.api.getAllColumns().map(e=>e.field);v(S,e)}j?.(e,t,r)},[S,j]),ne={density:"compact",pagination:{paginationModel:{pageSize:s}},filter:{filterModel:{items:[],quickFilterExcludeHiddenColumns:!1}},...p,columns:{...p?.columns,columnVisibilityModel:ee??p?.columns?.columnVisibilityModel,orderedFields:Z??p?.columns?.orderedFields}};return e.createElement(t.Card,{sx:{height:"auto",...x}},e.createElement(t.Box,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",pr:1}},e.createElement(t.CardHeader,{title:n,sx:{mb:2}}),O,e.createElement(t.Box,{sx:{display:"flex",gap:Q?1:2,alignItems:"center",flexWrap:"wrap",justifyContent:"flex-end"}},z)),e.createElement(t.Box,{component:"div",sx:{display:"flex",flexDirection:"column",flexGrow:1,...E}},e.createElement(r.DataGridPremium,{loading:B,onRowClick:i,onRowDoubleClick:l,rows:o,columns:a,pagination:d,disableDensitySelector:D,disableRowSelectionOnClick:I,disableColumnFilter:F,disableColumnMenu:P,disableColumnSelector:N,slots:{noRowsOverlay:b,toolbar:w,...c},slotProps:{noRowsOverlay:{text:G},toolbar:m,...g},initialState:ne,pageSizeOptions:u,sx:{"& .MuiDataGrid-row:hover":{cursor:i||l?"pointer":"default"},...h},onColumnVisibilityModelChange:te,checkboxSelection:T,onRowSelectionModelChange:A,rowSelectionModel:L,isRowSelectable:_,getRowClassName:H,getDetailPanelContent:V,getDetailPanelHeight:$,checkboxSelectionVisibleOnly:R,disableRowSelectionExcludeModel:!0,showToolbar:W,hideFooterRowCount:q,getRowHeight:U,onColumnOrderChange:re,defaultGroupingExpansionDepth:Y,pinnedRows:K,keepNonExistentRowsSelected:X})))},exports.MGHDateRangeCalendar=xn,exports.MGHDateRangeIcons=Zr,exports.MGHDateRangePicker=En,exports.MGHGrid=Br,exports.MGHGridActionsCellItem=Rr,exports.MGHGridButton=er,exports.MGHGridCheckbox=ir,exports.MGHGridColumnMenu=Fr,exports.MGHGridColumnsButton=pr,exports.MGHGridColumnsPanel=Er,exports.MGHGridContext=$e,exports.MGHGridDefaultToolbar=yr,exports.MGHGridDensitySelector=hr,exports.MGHGridExportMenu=br,exports.MGHGridExportMenuItem=fr,exports.MGHGridFilterPanel=Ir,exports.MGHGridFiltersButton=ur,exports.MGHGridFooter=wr,exports.MGHGridIconButton=tr,exports.MGHGridIcons=Zt,exports.MGHGridLoadingOverlay=Nr,exports.MGHGridMenu=sr,exports.MGHGridMenuDivider=gr,exports.MGHGridMenuItem=cr,exports.MGHGridNoRowsOverlay=Pr,exports.MGHGridPagination=vr,exports.MGHGridPopover=dr,exports.MGHGridQuickFilter=xr,exports.MGHGridSelect=or,exports.MGHGridTextInput=nr,exports.MGHGridToolbar=w,exports.MGH_DATE_RANGE_DEFAULT_SHORTCUTS=fn,exports.MGH_DATE_RANGE_PICKER_CSS=Ur,exports.MGH_DATE_RANGE_PICKER_DEFAULT_LOCALE_TEXT=yn,exports.MGH_DATE_RANGE_PICKER_STYLE_ID=_r,exports.MGH_GRID_AGGREGATION_FUNCTIONS=Ne,exports.MGH_GRID_CHECKBOX_FIELD=I,exports.MGH_GRID_CHECKBOX_SELECTION_COL_DEF=ke,exports.MGH_GRID_CSS=Ae,exports.MGH_GRID_DEFAULT_LOCALE_TEXT=Re,exports.MGH_GRID_DETAIL_PANEL_TOGGLE_COL_DEF=Me,exports.MGH_GRID_DETAIL_PANEL_TOGGLE_FIELD=F,exports.MGH_GRID_GROUPING_COLUMN_FIELD=D,exports.MGH_GRID_STYLE_ID=Te,exports.mghDateRangeIsEqual=sn,exports.mghDateRangeParseDate=gn,exports.mghDateRangeValidate=un,exports.mghGridBooleanFilterOperators=ye,exports.mghGridBuildScopedCss=Fe,exports.mghGridBuildXlsx=ht,exports.mghGridGetDataAsCsv=Xe,exports.mghGridGetDateFilterOperators=xe,exports.mghGridNumberFilterOperators=fe,exports.mghGridPrintElement=xt,exports.mghGridPrintTable=(e,t={})=>{if("undefined"==typeof document)return;const r=t.includeHeaders??!0,n=qe(e,t),o=t.title??t.fileName??document.title??"",a=r?`<thead><tr>${n.headers.map((e,t)=>`<th class="${n.columns[t].align??"left"}">${ft(e)}</th>`).join("")}</tr></thead>`:"",i=`<tbody>${n.rows.map(e=>`<tr>${e.map(e=>`<td class="${e.col.align??"left"}">${ft(e.formatted)}</td>`).join("")}</tr>`).join("")}</tbody>`,l=`<!doctype html><html><head><meta charset="utf-8" /><title>${ft(o)}</title><style>body{font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Helvetica,Arial,sans-serif;font-size:12px;color:#111;margin:16px;}h1{font-size:16px;margin:0 0 12px;}table{border-collapse:collapse;width:100%;}th,td{border:1px solid #ccc;padding:4px 8px;text-align:left;vertical-align:top;}th{background:#f3f3f3;font-weight:600;}td.right,th.right{text-align:right;} td.center,th.center{text-align:center;}tr{page-break-inside:avoid;} thead{display:table-header-group;}`+(t.pageStyle??"")+"</style></head><body>"+(o?`<h1>${ft(o)}</h1>`:"")+`<table>${a}${i}</table></body></html>`,d=document.createElement("iframe");d.setAttribute("aria-hidden","true"),d.style.position="fixed",d.style.right="0",d.style.bottom="0",d.style.width="0",d.style.height="0",d.style.border="0",d.style.opacity="0",document.body.appendChild(d);const s=()=>{window.setTimeout(()=>{d.parentNode&&d.parentNode.removeChild(d)},1e3)};d.onload=()=>{const e=d.contentWindow;if(e)try{e.focus(),e.onafterprint=s,e.print()}catch{s()}else s()};const c=d.contentDocument||d.contentWindow?.document;c?(c.open(),c.write(l),c.close()):d.srcdoc=l},exports.mghGridSingleSelectFilterOperators=ve,exports.mghGridStringFilterOperators=ue,exports.useMGHDateRangePickerStyles=jr,exports.useMGHGridApiContext=()=>Be().api,exports.useMGHGridApiRef=()=>e.useRef(null),exports.useMGHGridContext=Be,exports.useMGHGridLocaleText=()=>Be().localeText,exports.useMGHGridStyles=Ve,exports.useResponsive=f;
2
2
  //# sourceMappingURL=index.cjs.map