@agile-team/mach-table 0.42.1 → 0.42.2
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 +1 -1
- package/dist/index.js +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";var yi=Object.defineProperty;var Ro=Object.getOwnPropertyDescriptor;var Eo=Object.getOwnPropertyNames;var So=Object.prototype.hasOwnProperty;var Mo=(n,e)=>{for(var t in e)yi(n,t,{get:e[t],enumerable:!0})},Io=(n,e,t,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of Eo(e))!So.call(n,r)&&r!==t&&yi(n,r,{get:()=>e[r],enumerable:!(i=Ro(e,r))||i.enumerable});return n};var Ao=n=>Io(yi({},"__esModule",{value:!0}),n);var il={};Mo(il,{BUILTIN_AGG_FUNCS:()=>Be,DEFAULT_LOCALE:()=>V,EVENT_TYPES:()=>Ut,LOCALE_EN:()=>Lr,actionsColumn:()=>Wr,advancedFilterCondition:()=>xr,advancedFilterGroup:()=>Rr,applyGridViewState:()=>hr,buildColDefsFromSchema:()=>ao,captureGridViewState:()=>cr,clearGridState:()=>Zn,createActionButtonsRenderer:()=>xe,createAggResolver:()=>yt,createBusinessColumnTypes:()=>bo,createColumnHelper:()=>uo,createEnterprisePreset:()=>fo,createGrid:()=>no,createGridViewManager:()=>Do,createLocalGridStateStore:()=>sr,createLocalGridViewStore:()=>pr,createMachTableCommands:()=>lo,createMachTablePreset:()=>ur,createProgressBarRenderer:()=>Pi,createRemoteExportRequest:()=>oo,createRowActionsRenderer:()=>ct,createStatusTagRenderer:()=>ki,defineColumns:()=>co,defineGridOptions:()=>go,defineMachTableConfig:()=>yo,defineMachTablePreset:()=>mo,describeFilter:()=>Xt,downloadFile:()=>Kt,dragColumn:()=>zr,escapeHtml:()=>fe,formatText:()=>W,formatTwo:()=>Te,getByPath:()=>z,indexColumn:()=>ht,isColDefGroup:()=>Ce,isSafePath:()=>nt,linkRenderer:()=>Gi,loadGridState:()=>di,matchLocaleKey:()=>lt,normalizeAdvancedFilterModel:()=>H,normalizeColumnFilter:()=>ot,normalizeFilterModel:()=>te,normalizeGridState:()=>q,normalizeGridViewState:()=>gi,normalizeSavedGridView:()=>Ae,parseCsv:()=>Mt,parseDelimited:()=>It,parseTsv:()=>St,resolveGridFeatures:()=>hi,resolveSaveConflict:()=>Gn,resolveTagVariant:()=>dt,rowActionsColumn:()=>$r,sanitizeFormulaCell:()=>ce,saveGridState:()=>li,selectionColumn:()=>_r,setByPath:()=>ve,toTsv:()=>Et,validateGridOptions:()=>ui,version:()=>tl});module.exports=Ao(il);var qe="0.42.1";function v(n,e){return Object.prototype.hasOwnProperty.call(n,e)}function x(n,e,t=!1){if(!(typeof n!="number"||!Number.isFinite(n)||n<e))return t?Math.floor(n):n}function E(n,e,t,i=!1){return x(n,t,i)??e}function I(n){return x(n,0)||void 0}function Ye(n){return!n||typeof n.key!="string"||!n.key.trim()?null:{key:n.key.trim(),debounceMs:x(n.debounceMs,0,!0)??160,...n.sections?{sections:[...new Set(n.sections)]}:{},...n.store?{store:n.store}:{}}}function R(n,e,t,i=!1){let r=!1;for(let o of t)(i?v(n,o):n[o]!=null)&&(e[o]=n[o],r=!0);return r}var vi=new WeakMap,Xe=new WeakMap;function Pe(n){let e=vi.get(n);return e||(e={},vi.set(n,e)),e}function bi(n){return vi.get(n)}function Je(n,e){e?Xe.set(n,e):Xe.delete(n)}function Ze(n){let e=Xe.get(n);return Xe.delete(n),e}function p(n,e,t){let i=document.createElement(n);if(e&&(i.className=e),t)for(let r of Object.keys(t))i.setAttribute(r,t[r]);return i}function U(n,e,t){let i=p("button",n);return i.type="button",i.textContent=e,i.addEventListener("click",t),i}function S(n,e,t,i=!1){let r=e?"addEventListener":"removeEventListener";for(let[o,s]of Object.entries(t))n[r](o,s,i)}function _(n,e,t){S(document,n,{mousedown:e,keydown:t},!0)}function A(n,e){if(n.classList.add("mach-portal"),!e)return;let t=window.getComputedStyle(e);for(let i=0;i<t.length;i++){let r=t.item(i);if(!r.startsWith("--mach-"))continue;let o=t.getPropertyValue(r).trim();o&&n.style.setProperty(r,o)}n.style.colorScheme=t.colorScheme}function T(n,e,t){return n<e?e:n>t?t:n}function ee(n,e,t=4){let i=e.getBoundingClientRect(),r=n.getBoundingClientRect(),o=i.bottom+t,s=o+r.height>window.innerHeight-8?i.top-r.height-t:o;n.style.left=`${T(i.left,8,Math.max(8,window.innerWidth-r.width-8))}px`,n.style.top=`${T(s,8,Math.max(8,window.innerHeight-r.height-8))}px`}var gr=0;function yr(n="rg"){return gr++,`${n}-${gr}`}var vr='<svg viewBox="0 0 16 16" width="12" height="12" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><path d="M2 3.5h12L9.5 8v4.5L6.5 14V8L2 3.5z"/></svg>',br='<svg viewBox="0 0 16 16" width="10" height="10" fill="currentColor"><path d="M8 3l4 5H4l4-5z"/></svg>',wr='<svg viewBox="0 0 16 16" width="10" height="10" fill="currentColor"><path d="M8 13l4-5H4l4 5z"/></svg>',Cr='<svg viewBox="0 0 16 16" width="12" height="12" fill="none" stroke="currentColor" stroke-width="1.35" stroke-linecap="round"><path d="M2 4h3m3 0h6M2 8h7m3 0h2M2 12h1m3 0h8"/><circle cx="6.5" cy="4" r="1.35"/><circle cx="10.5" cy="8" r="1.35"/><circle cx="4.5" cy="12" r="1.35"/></svg>';function ge(n,e,t,i,r=e.rowIndex){return{api:n.api,colDef:t.colDef,column:t,node:e,data:e.data,value:i,rowIndex:r}}function wi(n){if(n==null)return"";if(n instanceof Date)return n.toLocaleDateString();if(typeof n=="object")try{return JSON.stringify(n)}catch{return String(n)}return String(n)}function L(n,e){let t=bi(e);if(!t)return;t.flashTimer&&clearTimeout(t.flashTimer),t.flashTimer=void 0;let i=t.destroy;if(t.destroy=void 0,t.refresh=void 0,t.rendererDefinition=void 0,t.rendererRowId=void 0,t.rendererColumnId=void 0,!!i)try{i()}catch(r){n.reportError(r,"cellRenderer.destroy",{colId:e.dataset.colId})}}function Tr(n,e,t,i,r,o){let s=n.t.tooltipComponent?"":o,a=i.colDef.tooltipValueGetter;if(a)try{s=a({api:n.api,colDef:i.colDef,column:i,node:t,data:t.data,value:r})??o}catch(l){n.reportError(l,"tooltipValueGetter",{colId:i.id,rowId:t.id})}s?e.setAttribute("title",s):e.removeAttribute("title")}function Po(n,e,t,i,r,o){let s=bi(e);if(!s?.refresh||s.rendererDefinition!==r||s.rendererRowId!==t.id||s.rendererColumnId!==i.id)return!1;try{return e.querySelector(":scope > .mach-cell-edit-trigger")?.remove(),s.refresh(o)!==!1}catch(a){return n.reportError(a,"cellRenderer.refresh",{colId:i.id,rowId:t.id}),!1}}function ye(n,e,t){return Y(n,e,t,n.d(e,t))}function Y(n,e,t,i){let r=t.colDef.valueFormatter;if(r)try{let o=r({api:n.api,colDef:t.colDef,column:t,node:e,data:e.data,value:i});return o==null?"":String(o)}catch(o){n.reportError(o,"valueFormatter",{colId:t.id,rowId:e.id})}return wi(i)}function Go(n,e,t,i){let r=i.colDef.cellStyle,o=Pe(e),s=o.styleKeys;if(s)for(let d of s)Reflect.set(e.style,d,"");if(!r){o.styleKeys=void 0;return}let a;if(typeof r=="function"){let d=n.d(t,i);try{a=r(ge(n,t,i,d))}catch(u){n.reportError(u,"cellStyle",{colId:i.id,rowId:t.id}),a=null}}else a=r;if(!a){o.styleKeys=void 0;return}let l=Object.keys(a);for(let d of l)Reflect.set(e.style,d,Reflect.get(a,d));o.styleKeys=l}function Lo(n,e){let t=n.firstElementChild,i=t?.className==="mach-cell-text"?t:p("span","mach-cell-text");i.textContent!==e&&(i.textContent=e),n.replaceChildren(i)}function No(n,e,t,i){let r=n.d(t,i),o=Y(n,t,i,r),s=i.colDef.cellRenderer,a=typeof s=="string"?n.mu(s):s,l=o;if(a){let d={api:n.api,colDef:i.colDef,column:i,node:t,data:t.data,value:r,formatted:o,rowIndex:t.rowIndex,rendererParams:i.colDef.cellRendererParams};if(Po(n,e,t,i,a,d)){Tr(n,e,t,i,r,o);return}L(n,e);try{l=a(d)}catch(u){n.reportError(u,"cellRenderer",{colId:i.id,rowId:t.id})}}else L(n,e);if(typeof l=="string")Lo(e,l);else if(l instanceof HTMLElement)e.replaceChildren(l);else if(l&&typeof l=="object"&&l.el instanceof HTMLElement){let d=l;e.replaceChildren(d.el);let u=Pe(e);u.destroy=d.destroy,d.refresh&&(u.refresh=c=>d.refresh(c),u.rendererDefinition=a,u.rendererRowId=t.id,u.rendererColumnId=i.id)}else e.textContent="";Tr(n,e,t,i,r,o)}function Qe(n){let{align:e}=n.colDef;return e==="left"?"mach-cell--left":e==="right"?"mach-cell--right":"mach-cell--center"}function Fo(n,e,t,i){let r=i.colDef.cellClass;if(!r)return;if(typeof r=="string"){e.push(r);return}if(Array.isArray(r)){e.push(...r);return}let o=ge(n,t,i,n.d(t,i));try{let s=r(o);typeof s=="string"?e.push(s):Array.isArray(s)&&e.push(...s)}catch(s){n.reportError(s,"cellClass",{colId:i.id,rowId:t.id})}}function Oo(n,e,t){e.classList.contains("mach-cell--focus")&&n.push("mach-cell--focus"),e.classList.contains("mach-cell--editing")&&n.push("mach-cell--editing"),t.colDef.wrapText&&n.push("mach-cell--wrap")}function Ci(n,e,t,i){let r=["mach-cell",Qe(i)];Fo(n,r,t,i),Oo(r,e,i);let o=r.join(" ");e.className!==o&&(e.className=o)}function et(n,e,t,i){No(n,e,t,i),Ci(n,e,t,i),Go(n,e,t,i)}function Ge(n,e){return n&&v(n,e)?n[e]:void 0}function tt(n,e){if(n==null||n===""||!e||typeof e!="object")return;let t=Ge(e,String(n));return typeof t=="string"?{color:t}:t}var it=class{constructor(e){this.e=e;this.to="";this.ro=[];this.la=0;this.xi=!0}no(e){this.gu()&&(this.xi=!0,e=void 0);let t=this.xi?this.da():void 0,i=t&&Vo(t,e),r=e?.columns&&new Set(e.columns),o=!1;for(let s of this.e.r.l()){if(s.minWidth!=null&&(!i||r&&!r.has(s.id)))continue;let a=this.yu(s);if(o=s.minWidth!==a||o,s.minWidth=a,Ho(s)){let l=this.ua(s,t);o=l!==s.contentWidth||o,s.contentWidth=l}}return this.xi=!1,o&&(this.e.r.Xe=!1),o}gu(){let e=Array.from(document.fonts??[]).filter(s=>s.status==="loaded"),t=e.length!==this.ro.length||e.some((s,a)=>s!==this.ro[a]);t&&(this.ro=e,this.la++);let i=getComputedStyle(this.e.n.root),r=`${i.getPropertyValue("--mach-header-font-weight")||650} ${i.fontSize} ${i.fontFamily}`,o=r!==this.to||t;return this.to=r,o}da(){let e=this.e.i.Oe(),t=Math.min(e.length,100);return Array.from({length:t},(i,r)=>e[Math.floor(r*(e.length-1)/Math.max(t-1,1))])}oo(e,t){return this.Di===void 0&&(this.Di=p("canvas").getContext("2d")),this.Di?(this.Di.font=t??this.to,this.Di.measureText(e).width):t?1/0:e.replace(/[^\x00-\xff]/g,"mm").length*7}yu(e){let t=e.colDef,i=t.headerName??t.field??e.id;return Math.ceil(Math.max(t.minWidth??0,this.oo(i)+i.length*.15+28+(e.sortable?20:0)+(e.filterable?28:0)+(this.e.t.columnMenu&&!e.hasCheckbox&&!t.suppressColumnMenu?22:0)))}ua(e,t=this.da()){let i=28;for(let r of t){let o=this.e.d(r,e),s=tt(o,e.colDef.status)?.label??Y(this.e,r,e,o);i=Math.max(i,this.oo(s.slice(0,128))+(e.colDef.status?44:28))}return Math.ceil(Math.min(I(e.colDef.maxWidth)??360,i))}};function Ho(n){let{width:e,autoWidth:t}=n.colDef;return n.manualWidth==null&&e==null&&t!==!1&&!n.hasCheckbox&&!n.isDetailToggle}function Vo(n,e){if(!e?.rowIds&&!e?.rowIndexes)return!0;let t=new Set(e.rowIds),i=new Set(e.rowIndexes);return n.some(r=>t.has(r.id)||i.has(r.rowIndex))}var rt=class{constructor(e){this.vu=e;this.xr=new Map}on(e,t){let i=this.xr.get(e);return i||(i=new Set,this.xr.set(e,i)),i.add(t),()=>{i.delete(t)}}emit(e,t){let i=this.xr.get(e);if(i)for(let r of[...i])try{r(t)}catch(o){console.error(`[mach-table] error in "${e}" listener`,o),this.vu?.(o,e)}}clear(){this.xr.clear()}};var Bo=new Set(["__proto__","prototype","constructor"]),Le=new Map;function Ti(n){if(typeof n!="string"||n.length===0)return null;let e=Le.get(n);if(e!==void 0)return e;let t=n.split("."),i=t.every(r=>r.length>0&&!Bo.has(r))?t:null;return n.length<=1024&&(Le.size>=256&&Le.delete(Le.keys().next().value),Le.set(n,i)),i}function nt(n){return Ti(n)!==null}function z(n,e){if(n==null)return;let t=Ti(e);if(!t)return;let i=n;for(let r of t){if(i==null)return;i=i[r]}return i}function ve(n,e,t){if(n==null)return!1;let i=Ti(e);if(!i)return!1;let r=n;for(let o=0;o<i.length-1;o++){if(typeof r!="object"&&typeof r!="function"||r===null)return!1;r[i[o]]==null&&(r[i[o]]={}),r=r[i[o]]}return typeof r!="object"&&typeof r!="function"||r===null?!1:(r[i[i.length-1]]=t,!0)}var be={text:["contains","notContains","equals","notEquals","startsWith","endsWith","blank","notBlank"],number:["equals","notEquals","lessThan","lessThanOrEqual","greaterThan","greaterThanOrEqual","inRange","blank","notBlank"],date:["equals","notEquals","lessThan","greaterThan","inRange","blank","notBlank"]};var _o=16,zo=512,Wo=20,$o=2e3,Ko=2e3,Uo={text:new Set(be.text),number:new Set(be.number),date:new Set(be.date)};function jo(n){return n==null||typeof n=="string"||typeof n=="number"&&Number.isFinite(n)}function qo(n,e,t){if(n==null||typeof n!="object")return null;let i=n;return typeof i.match!="string"||!t.has(i.match)?null:{match:i.match,...Yo(i,e)}}function Yo(n,e){let t=e==="number"?x(n.value,-1/0):typeof n.value=="string"?n.value:void 0,i=e==="number"?x(n.value2,-1/0):typeof n.value2=="string"?n.value2:void 0;return{...t!==void 0?{value:t}:{},...i!==void 0?{value2:i}:{}}}function Xo(n,e){let t=[],i=Uo[e];for(let r of n.slice(0,Wo)){let o=qo(r,e,i);o&&t.push(o)}return t}function ot(n){if(n==null||typeof n!="object")return null;let e=n;return e.type==="set"?Array.isArray(e.values)?{type:"set",values:e.values.filter(jo).slice(0,$o)}:null:e.type!=="text"&&e.type!=="number"&&e.type!=="date"||!Array.isArray(e.conditions)?null:{type:e.type,...e.operator==="or"||e.operator==="and"?{operator:e.operator}:{},conditions:Xo(e.conditions,e.type)}}function Jo(n,e){if(typeof n.colId!="string"||!n.colId.trim())return null;let t=n.colId.trim();if(e.validColumnIds?.has(t)===!1)return null;let i=ot(n.filter);return i?{kind:"condition",colId:t,filter:i}:null}function Zo(n,e,t){if(!Array.isArray(n.children))return null;let i=[];for(let r of n.children){let o=Dr(r,e+1,t);o&&i.push(o)}return i.length===0?null:{kind:"group",operator:n.operator==="or"?"or":"and",children:i,...n.not===!0?{not:!0}:{}}}function Qo(n,e,t){return e<=_o&&t.nodes<zo&&n!=null&&typeof n=="object"}function Dr(n,e,t){if(!Qo(n,e,t)||t.ancestors.has(n))return null;t.ancestors.add(n),t.nodes++;let i=n,r=i.kind==="condition"?Jo(i,t):i.kind==="group"?Zo(i,e,t):null;return t.ancestors.delete(n),r}function H(n,e){if(n==null||typeof n!="object")return null;let t=n;if(t.version!==1||t.root==null)return null;let i=Dr(t.root,0,{ancestors:new WeakSet,nodes:0,validColumnIds:e});return i?{version:1,root:i}:null}function xr(n,e){return{kind:"condition",colId:n,filter:e}}function te(n,e){if(n==null||typeof n!="object"||Array.isArray(n))return{};let t={};for(let[i,r]of Object.entries(n).slice(0,Ko)){let o=i.trim();if(!o||e?.has(o)===!1)continue;let s=ot(r);s&&(t[o]=s)}return t}function Rr(n,e,t={}){return{kind:"group",operator:n,children:e,...t.not?{not:!0}:{}}}var Di={align:"center",sortable:!0,resizable:!0,movable:!0,filter:!1,minWidth:80},Ne={compact:{rowHeight:30,headerHeight:34,fontSize:12,cellPadding:6},normal:{rowHeight:36,headerHeight:40,fontSize:13,cellPadding:9},large:{rowHeight:44,headerHeight:48,fontSize:14,cellPadding:12}},Fe={multiSort:!0,stripedRows:!1,showCellBorders:!1,quickFilterText:null,suppressCellFocus:!1,suppressRowHoverHighlight:!1,suppressNoRowsOverlay:!1,suppressHeaderFocus:!1,loading:!1,error:null,className:"",singleClickEdit:!1,manualSorting:!1,manualFiltering:!1,showSummary:!1,rowNumber:!1,indexOffset:0,applyRowDrag:!0,masterDetail:!1,detailToggleColumn:!0,treeData:!1,childrenKey:"children",autoCheckedChildren:!0,defaultExpandAll:!1,columnMenu:!1,suppressWarnings:!1,enableRangeSelection:!1,suppressClipboard:!1,contextMenu:!1,flashCells:!0,fillHandle:!0,ariaLabel:"MachTable data grid",ariaLabelledBy:"",ariaDescribedBy:"",overlayNoRowsTemplate:"",overlayLoadingTemplate:"",overlayErrorTemplate:"",allowUnsafeOverlayHtml:!1},es=Object.keys(Fe);function ts(n){let e={};for(let t of es)e[t]=n[t]??Fe[t];return e}function is(n){return n&&v(Ne,n)?n:"normal"}function rs(n,e){let t=typeof n.pagination=="object"&&Array.isArray(n.pagination?.pageSizeOptions)?n.pagination.pageSizeOptions:void 0,i=t?[...new Set(t.map(r=>E(r,0,1,!0)).filter(Boolean))]:[10,20,50,100];return i.includes(e)||i.push(e),i.sort((r,o)=>r-o)}function xi(n,e){let t=typeof n=="function"?n(e):z(e,n);return t==null?"":String(t)}function ns(n,e){let t=Ne[e],i=n.rowKey;return{columnDefs:Array.isArray(n.columnDefs)?n.columnDefs:[],rowData:Array.isArray(n.rowData)?n.rowData:[],defaultColDef:{...Di,...n.defaultColDef??{}},columnTypes:n.columnTypes??{},...i?{resolveRowId:({data:r})=>xi(i,r),rowKey:i}:{},rowHeight:E(n.rowHeight,t.rowHeight,1),detailRowHeight:E(n.detailRowHeight,240,1),headerHeight:E(n.headerHeight,t.headerHeight,1),rowBuffer:E(n.rowBuffer,8,0,!0),columnLayout:n.columnLayout==="fit"||n.columnLayout==="normal"?n.columnLayout:"auto",enableColumnResize:n.enableColumnResize===!0,domLayout:n.domLayout==="autoHeight"?"autoHeight":"normal",maxBodyHeight:x(n.maxBodyHeight,1),rowSelection:n.rowSelection==="single"||n.rowSelection==="multiple"?n.rowSelection:"none",size:e,pinnedTopRowData:Array.isArray(n.pinnedTopRowData)?n.pinnedTopRowData:[],pinnedBottomRowData:Array.isArray(n.pinnedBottomRowData)?n.pinnedBottomRowData:[]}}function os(n){let e=typeof n.pagination=="object"?n.pagination:void 0,t=E(e?.pageSize,20,1,!0);return{paginationEnabled:n.pagination!==!1&&n.datasource==null,paginationMode:e?.mode==="server"?"server":"client",paginationPage:E(e?.page,1,1,!0),paginationTotal:E(e?.total,0,0,!0),paginationPageSize:t,paginationPageSizeOptions:rs(n,t),paginationShowTotal:e?e.showTotal!==!1:!0,paginationShowSizeSelector:e?e.showPageSizeSelector!==!1:!0}}function Ri(n){let e=n.watermark==null||n.watermark===!1?null:n.watermark===!0?{text:"MachTable"}:n.watermark;return{watermarkEnabled:e!==null,watermarkConfig:e}}function ss(n){return{advancedFilterModel:H(n.advancedFilterModel),persistence:Ye(n.persistence),locale:n.locale??{},tooltipShowDelay:E(n.tooltipShowDelay,600,0),statusBarEnabled:n.statusBar===!0||typeof n.statusBar=="object"&&n.statusBar!=null,statusBarPanels:typeof n.statusBar=="object"&&n.statusBar?.panels?n.statusBar.panels:["rowCount","selectedRowCount","rangeAggregate"]}}var Sr={blockSize:100,maxBlocksInCache:12,datasourceMaxConcurrentRequests:4},Mr={infiniteBufferRows:40,blockPrefetch:1,datasourceRetryCount:2,datasourceRetryDelay:300},as=Object.keys(Sr),ls=Object.keys(Mr);function Er(n,e,t,i){let r=!1;for(let o of t){let s=x(n[o],i,!0);s===void 0||s===e[o]||(e[o]=s,r=!0)}return r}function Ei(n,e){let t=Er(n,e,as,1);Er(n,e,ls,0);let i=x(n.datasourceRetryJitter,0);return i!==void 0&&(e.datasourceRetryJitter=Math.min(1,i)),t}function ds(n){let e={...Sr,...Mr,datasourceRetryJitter:.15};return Ei(n,e),{...e,datasourceMode:n.datasourceMode==="block"?"block":"sequential",datasourceRowCount:n.datasourceRowCount==null?null:E(n.datasourceRowCount,0,0,!0),dataProcessorMinRows:E(n.dataProcessorMinRows,5e3,1,!0)}}var us=["detailRowRenderer","isRowExpandable","aggFuncs","components","actionPolicy","summaryMethod","datasource","getRowHeight","tooltipComponent","getContextMenuItems","initialState","rowEditValidator","isTreeRowExpandable","loadTreeChildren","dataProcessor"];function Ir(n){let e=is(n.size),t={...ts(n),...ns(n,e),rowStyleRules:Array.isArray(n.rowStyleRules)?n.rowStyleRules:[],theme:n.theme==="dark"||n.theme==="auto"?n.theme:"light",editType:n.editType==="fullRow"?"fullRow":"cell",editableIndicator:n.editableIndicator==="always"||n.editableIndicator==="none"?n.editableIndicator:"hover",rowDragPolicy:n.rowDragPolicy,undoStackSize:E(n.undoStackSize,100,0,!0),asyncTransactionWaitMillis:E(n.asyncTransactionWaitMillis,16,0,!0),...os(n),...Ri(n),...ss(n),...ds(n),features:Array.isArray(n.features)?n.features:[]};for(let i of us)n[i]&&Reflect.set(t,i,n[i]);for(let i of Object.keys(n))i.startsWith("on")&&typeof n[i]=="function"&&Reflect.set(t,i,n[i]);return t}function Ar(n){return Array.isArray(n)?n.filter(e=>typeof e=="string"&&e.length>0):typeof n=="string"&&n.length>0?[n]:[]}function we(n,e){return Ar(n.type).includes(e)}function kr(n,e,t={}){let i=n.checkboxSelection||n.rowDrag||we(n,"index")?{resizable:!1,suppressSizeToFit:!0}:{};for(let o of Ar(n.type)){o==="rightAligned"&&(i.align="right");let s=t[o];s&&Object.assign(i,s)}let r={...e,...i,...n};return r.align??(r.align=e.align??"center"),r.status&&!r.cellRenderer&&(r.cellRenderer="statusTag"),r}var ie=class{constructor(e,t){this.manualWidth=null;this.contentWidth=null;this.flex=null;this.currentWidth=0;this.parentGroup=null;this.level=0;this.isDetailToggle=!1;this.id=e,this.colDef=t,this.hide=t.hide??!1;let i=t.pinned;this.pinned=i===!0?"left":i===!1||i==null?null:i,this.resetWidth()}get sortable(){return this.colDef.sortable!==!1}get resizable(){return this.colDef.resizable!==!1}get movable(){return this.colDef.movable!==!1}get filterable(){return this.colDef.filter!=null&&this.colDef.filter!==!1}get filterType(){let e=this.colDef.filter;return e===!0?"text":e??"text"}get hasCheckbox(){return this.colDef.checkboxSelection===!0}resetWidth(){this.manualWidth=null,this.contentWidth=null,this.flex=I(this.colDef.flex)??null}};function X(n){return!n.hasCheckbox&&!n.isDetailToggle&&!n.isAutoRowNumber}function st(n){return n.colDef.autoHeight===!0&&!!(n.colDef.valueGetter||n.colDef.valueFormatter)}var re=class n{constructor(e,t){this.parent=null;this.children=[];this.groupId=e,this.def=t}get headerName(){return this.def.headerName??this.def.groupId??""}getLeafColumns(e=[]){for(let t of this.children)t instanceof n?t.getLeafColumns(e):e.push(t);return e}};function Ce(n){return Array.isArray(n.children)}var Oe=150,cs=80;function j(n,e){let t=I(e.minWidth)??cs,i=I(e.maxWidth)??Number.MAX_SAFE_INTEGER,r=I(n)??I(e.width)??Oe;return Math.max(t,Math.min(i,r))}function hs(n,e,t,i){let r=e.map((o,s)=>s).filter(o=>i[o]>0);for(;Math.abs(t)>.001&&r.length;){let o=r.reduce((a,l)=>a+i[l],0),s=0;if(r=r.filter(a=>{let l=e[a];return e[a]=j(l+t*i[a]/o,n[a]),s+=e[a]-l,e[a]!==l}),Math.abs(s)<1e-4)break;t-=s}}function Pr(n,e,t){let i=n.map(o=>j(o.width??Oe,o)),r=e-i.reduce((o,s)=>o+s,0);return(t?Number.isFinite(e)&&e>0:r>0)&&hs(n,i,r,t?[...i]:n.map(o=>o.flex??0)),i}function Gr(n,e){return Pr(n,e,!1)}function at(n,e){return Pr(n,e,!0)}var Si='<path d="M11.5 2.5l2 2L5 13H3v-2l8.5-8.5z"/>',Mi='<path d="M3.5 3.5l9 9m0-9l-9 9"/>',Ii='<path d="M2.5 8.5l3.5 3.5 7.5-8"/>',de={edit:Si,delete:'<path d="M3 5h10M6 5V3h4v2M5 5l.7 8h4.6L11 5"/>',view:'<path d="M1.5 8s2.4-4.2 6.5-4.2S14.5 8 14.5 8s-2.4 4.2-6.5 4.2S1.5 8 1.5 8z"/><circle cx="8" cy="8" r="1.8"/>',copy:'<rect x="5" y="5" width="8" height="8" rx="1"/><path d="M3 11V3h8"/>',download:'<path d="M8 2v8m0 0l-3-3m3 3l3-3M2.5 13.5h11"/>',refresh:'<path d="M13 3v4h-4M3 13V9h4"/><path d="M13 7a5.5 5.5 0 00-9.7-2.6M3 9a5.5 5.5 0 009.7 2.6"/>',close:Mi,check:Ii,plus:'<path d="M8 2.5v11M2.5 8h11"/>',search:'<circle cx="7" cy="7" r="4.5"/><path d="M10.5 10.5L14 14"/>',more:'<circle cx="3" cy="8" r=".9" fill="currentColor" stroke="none"/><circle cx="8" cy="8" r=".9" fill="currentColor" stroke="none"/><circle cx="13" cy="8" r=".9" fill="currentColor" stroke="none"/>'};function J(n,e=14){return`<svg viewBox="0 0 16 16" width="${e}" height="${e}" aria-hidden="true" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round">${n}</svg>`}var V={matchContains:"\u5305\u542B",matchNotContains:"\u4E0D\u5305\u542B",matchEquals:"\u7B49\u4E8E",matchNotEquals:"\u4E0D\u7B49\u4E8E",matchStartsWith:"\u5F00\u5934\u662F",matchEndsWith:"\u7ED3\u5C3E\u662F",matchBlank:"\u4E3A\u7A7A",matchNotBlank:"\u4E0D\u4E3A\u7A7A",matchLessThan:"\u5C0F\u4E8E",matchLessThanOrEqual:"\u5C0F\u4E8E\u7B49\u4E8E",matchGreaterThan:"\u5927\u4E8E",matchGreaterThanOrEqual:"\u5927\u4E8E\u7B49\u4E8E",matchInRange:"\u5728\u8303\u56F4\u5185",apply:"\u5E94\u7528",reset:"\u91CD\u7F6E",search:"\u641C\u7D22...",emptySetLabel:"(\u7A7A)",selectedCount:"\u5DF2\u9009 {n} \u9879",sortAsc:"\u5347\u5E8F",sortDesc:"\u964D\u5E8F",clearSort:"\u53D6\u6D88\u6392\u5E8F",pinLeft:"\u56FA\u5B9A\u5DE6\u4FA7",pinRight:"\u56FA\u5B9A\u53F3\u4FA7",clearPin:"\u53D6\u6D88\u56FA\u5B9A",autoSize:"\u81EA\u9002\u5E94\u5217\u5BBD",hideColumn:"\u9690\u85CF\u6B64\u5217",columnVisibility:"\u5217\u663E\u793A",resetAll:"\u91CD\u7F6E\u5168\u90E8",autoSizeAll:"\u5168\u90E8\u81EA\u9002\u5E94",columnSettings:"\u5217\u8BBE\u7F6E",totalLabel:"\u5408\u8BA1",totalRowsLabel:"\u5171 {n} \u884C",menuCopy:"\u590D\u5236",menuPaste:"\u7C98\u8D34",menuClearContents:"\u6E05\u9664\u5185\u5BB9",loading:"\u52A0\u8F7D\u4E2D...",statusSelected:"\u5DF2\u9009 {n} \u884C",statusSum:"\u548C {n}",statusAvg:"\u5747 {n}",statusCount:"\u8BA1 {n}",emptyRows:"\u6CA1\u6709\u53EF\u663E\u793A\u7684\u884C",emptyRowsHint:"\u6682\u65E0\u6570\u636E",noMatchingRows:"\u6CA1\u6709\u7B26\u5408\u7B5B\u9009\u6761\u4EF6\u7684\u884C",clearFilters:"\u6E05\u9664\u7B5B\u9009",paginationTotal:"\u5171 {n} \u6761",paginationPage:"\u7B2C {a} / {b} \u9875",perPage:"{n} \u6761/\u9875",pageFirst:"\u9996\u9875",pagePrev:"\u4E0A\u4E00\u9875",pageNext:"\u4E0B\u4E00\u9875",pageLast:"\u672B\u9875",requestFailed:"\u6570\u636E\u52A0\u8F7D\u5931\u8D25",requestFailedHint:"\u8BF7\u68C0\u67E5\u7F51\u7EDC\u540E\u91CD\u8BD5",actionView:"\u67E5\u770B",actionEdit:"\u7F16\u8F91",actionDelete:"\u5220\u9664",actionConfirm:"\u786E\u8BA4",actionSave:"\u4FDD\u5B58",actionCancel:"\u53D6\u6D88",actionMore:"\u66F4\u591A\u64CD\u4F5C",rowDragHandle:"\u62D6\u52A8\u8C03\u6574\u987A\u5E8F\uFF1BAlt + \u4E0A\u4E0B\u65B9\u5411\u952E\u79FB\u52A8",rowDragUnavailable:"\u5F53\u524D\u6392\u5E8F\u6216\u6570\u636E\u6A21\u5F0F\u4E0D\u652F\u6301\u81EA\u52A8\u8C03\u6574\u987A\u5E8F",rowDragPosition:"\u7B2C {a} \u884C \u2192 \u7B2C {b} \u884C",rowDragOutside:"\u79FB\u56DE\u8868\u683C\u5185\u653E\u7F6E \xB7 Esc \u53D6\u6D88"},Lr={matchContains:"Contains",matchNotContains:"Not Contains",matchEquals:"Equals",matchNotEquals:"Not Equals",matchStartsWith:"Starts With",matchEndsWith:"Ends With",matchBlank:"Blank",matchNotBlank:"Not Blank",matchLessThan:"Less Than",matchLessThanOrEqual:"\u2264",matchGreaterThan:"Greater Than",matchGreaterThanOrEqual:"\u2265",matchInRange:"In Range",apply:"Apply",reset:"Reset",search:"Search...",emptySetLabel:"(blank)",selectedCount:"{n} selected",sortAsc:"Ascending",sortDesc:"Descending",clearSort:"Clear Sort",pinLeft:"Pin Left",pinRight:"Pin Right",clearPin:"Unpin",autoSize:"Auto Fit",hideColumn:"Hide Column",columnVisibility:"Columns",resetAll:"Reset All",autoSizeAll:"Fit All",columnSettings:"Column Settings",totalLabel:"Total",totalRowsLabel:"{n} rows",menuCopy:"Copy",menuPaste:"Paste",menuClearContents:"Clear Contents",loading:"Loading...",statusSelected:"{n} selected",statusSum:"Sum {n}",statusAvg:"Avg {n}",statusCount:"Cnt {n}",emptyRows:"No rows to display",emptyRowsHint:"No data is available.",noMatchingRows:"No rows match the filters",clearFilters:"Clear filters",paginationTotal:"{n} items",paginationPage:"Page {a} / {b}",perPage:"{n} / page",pageFirst:"First",pagePrev:"Previous",pageNext:"Next",pageLast:"Last",requestFailed:"Unable to load data",requestFailedHint:"Check your connection and try again",actionView:"View",actionEdit:"Edit",actionDelete:"Delete",actionConfirm:"Confirm",actionSave:"Save",actionCancel:"Cancel",actionMore:"More actions",rowDragHandle:"Drag to reorder; Alt + Up/Down to move",rowDragUnavailable:"Reordering is unavailable in the current sort or data mode",rowDragPosition:"Row {a} \u2192 Row {b}",rowDragOutside:"Move inside to drop \xB7 Esc to cancel",rowDragSelection:"{a} selected rows \u2192 Row {b}",rowDragBefore:"Before",rowDragAfter:"After",rowDragInside:"Inside",rowDragRejected:"This destination is unavailable"},ps={contains:"matchContains",notContains:"matchNotContains",equals:"matchEquals",notEquals:"matchNotEquals",startsWith:"matchStartsWith",endsWith:"matchEndsWith",blank:"matchBlank",notBlank:"matchNotBlank",lessThan:"matchLessThan",lessThanOrEqual:"matchLessThanOrEqual",greaterThan:"matchGreaterThan",greaterThanOrEqual:"matchGreaterThanOrEqual",inRange:"matchInRange"};function lt(n){return ps[n]??"matchEquals"}function W(n,e){return n.replace("{n}",String(e))}function Te(n,e,t){return n.replace("{a}",String(e)).replace("{b}",String(t))}var fs=[[/^(success|ok|done|complete|completed|normal|active|enabled|启用|正常|完成|已完成|运行|运行中|在线|生效|已发运)$/i,"success"],[/^(warning|warn|hold|pending|standby|待机|待审核|暂停|预警|部分完成|待下达|待复核|待发运)$/i,"warning"],[/^(error|fail|failed|danger|fault|offline|disabled|故障|失败|错误|异常|停用|离线|断开)$/i,"danger"],[/^(info|processing|new|draft|进行中|新建|草稿|审批中|同步中|执行中|已下达|装车中)$/i,"info"],[/^(neutral|default)$/i,"neutral"]];function dt(n,e,t){let i=String(n??"");if(e){let r=Ge(e,i);if(r)return r;let o=Ge(e,i.toLowerCase());if(o)return o}for(let[r,o]of fs)if(r.test(i))return o;return t==null?"neutral":dt(t)}function ki(n={}){return e=>{if(e.value==null||e.value==="")return"";let t=String(e.value),i=tt(t,e.colDef.status),r=i?.label??Ge(n.labelMap,t)??(e.formatted||t),o=i?.color,s=dt(o??t,o?void 0:n.variantMap,r),a=p("span",`mach-tag mach-tag--${s}`);return a.textContent=r,o&&s!==o&&(a.style.color=o,a.style.backgroundColor=`color-mix(in srgb, ${o} 12%, transparent)`),a}}function Pi(n={}){return e=>{let t=Number(e.value);if(isNaN(t))return e.formatted;let i=Math.max(0,Math.min(100,t)),r=p("div","mach-progress"),o=p("div","mach-progress__track"),s=p("div","mach-progress__bar");if(s.style.width=`${i}%`,n.color&&(s.style.background=n.color),o.appendChild(s),r.appendChild(o),n.showValue!==!1){let a=p("span","mach-progress__label");a.textContent=`${Math.round(i)}${n.unit??"%"}`,r.appendChild(a)}return r}}function Gi(n){if(n.value==null||n.value==="")return"";let e=p("span","mach-link");return e.textContent=n.formatted||String(n.value),e}var oe=null,B=null;function Nr(n){B&&n.contains(B)&&Z()}function Z(n=!1){oe?.remove(),oe=null,B&&(B.setAttribute("aria-expanded","false"),n&&B.isConnected&&B.focus({preventScroll:!0})),B=null,document.removeEventListener("mousedown",Fr,!0),document.removeEventListener("keydown",Li,!0)}function Fr(n){oe&&!oe.contains(n.target)&&!B?.contains(n.target)&&Z()}function Li(n){if(!oe)return;if(n.key==="Escape"){n.preventDefault(),Z(!0);return}let e=[...oe.querySelectorAll("button:not(:disabled)")];if(e.length===0)return;if(n.key==="Tab"){let r=e.indexOf(document.activeElement);(!n.shiftKey&&r===e.length-1||n.shiftKey&&r<=0)&&(n.preventDefault(),e[n.shiftKey?e.length-1:0].focus());return}if(n.key!=="ArrowDown"&&n.key!=="ArrowUp")return;n.preventDefault();let t=e.indexOf(document.activeElement),i=n.key==="ArrowDown"?1:-1;e[(t+i+e.length)%e.length].focus()}function Or(n,e){let t=p("button",e);return t.type="button",n.variant&&n.variant!=="default"&&t.classList.add(`${e}--${n.variant}`),t.disabled=n.disabled===!0,n.icon&&de[n.icon]?(t.innerHTML=J(de[n.icon],16),t.appendChild(p("span")).textContent=n.label):t.textContent=n.label,t.addEventListener("click",()=>n.pick(t)),t}function ms(n,e){Z();let t=p("div","mach-context-menu mach-action-menu");t.setAttribute("role","menu");for(let i of e){let r=Or(i,"mach-context-menu-item");r.setAttribute("role","menuitem"),t.appendChild(r)}A(t,n.closest(".mach-root")),document.body.appendChild(t),ee(t,n),oe=t,B=n,n.setAttribute("aria-expanded","true"),document.addEventListener("mousedown",Fr,!0),document.addEventListener("keydown",Li,!0),t.querySelector("button:not(:disabled)")?.focus({preventScroll:!0})}function gs(n,e,t){Z();let i=p("div","mach-action-drawer-backdrop"),r=p("section","mach-action-drawer");r.setAttribute("role","dialog"),r.setAttribute("aria-modal","true"),r.setAttribute("aria-label",e);let o=p("header","mach-action-drawer__header"),s=p("strong");s.textContent=e;let a=p("button","mach-action-drawer__close");a.type="button",a.setAttribute("aria-label","Close"),a.title="Close",a.innerHTML=J(de.close,16),a.addEventListener("click",()=>Z(!0)),o.append(s,a);let l=p("div","mach-action-drawer__body");for(let d of t)l.appendChild(Or(d,"mach-action-drawer__item"));r.append(o,l),i.appendChild(r),i.addEventListener("mousedown",d=>{d.target===i&&Z(!0)}),A(i,n.closest(".mach-root")),document.body.appendChild(i),oe=i,B=n,n.setAttribute("aria-expanded","true"),document.addEventListener("keydown",Li,!0),r.querySelector("button:not(:disabled)")?.focus({preventScroll:!0})}function ne(n,e){if(typeof n=="function")try{return n(e)}catch{return!1}return n===!0}function Hr(n){return n.variant??"default"}function Vr(n){return n.permission?typeof n.permission=="string"?[n.permission]:n.permission:[]}function Ni(n,e,t){return{...n.id?{actionId:n.id}:{},permissions:Vr(n),...t?{message:t}:{},params:e}}function ut(n,e,t){let i=t.api.getOption("actionPolicy");try{i?.onError?i.onError(n,Ni(e,t)):console.error("[mach-table] action handler failed",n)}catch(r){console.error("[mach-table] action error policy failed",r,n)}}function ys(n,e){if(Vr(n).length===0)return!0;let i=e.api.getOption("actionPolicy");if(!i?.canAccess)return!0;try{return i.canAccess(Ni(n,e))}catch(r){return ut(r,n,e),!1}}function vs(n,e){return n.filter(t=>{if(!ys(t,e))return!1;if(!t.show)return!0;try{return t.show(e)}catch{return!1}})}function Fi(n,e,t){t.isConnected&&(t.disabled=ne(n.disabled,e)||ne(n.loading,e),t.classList.toggle("mach-action-btn--loading",ne(n.loading,e)))}function bs(n,e,t,i){Promise.resolve(n).catch(r=>ut(r,e,t)).finally(()=>Fi(e,t,i))}function ws(n,e,t){try{bs(n.onClick(e),n,e,t)}catch(i){ut(i,n,e),Fi(n,e,t)}}function Ai(n,e,t){if(n===!1)return!1;let i=typeof n=="string"?n:e.label??e.title??"Confirm action",r=t.api.getOption("actionPolicy");return r?.confirm?r.confirm(Ni(e,t,i)):typeof window>"u"||typeof window.confirm!="function"?!1:window.confirm(i)}function Cs(n,e){if(n.confirm==null||n.confirm===!1)return!0;if(typeof n.confirm!="function")return Ai(n.confirm,n,e);let t=n.confirm(e);return t instanceof Promise?t.then(i=>Ai(i,n,e)):Ai(t,n,e)}function Ts(n){return(e,t)=>{if(ne(e.disabled,n))return;if(t.disabled=!0,t.classList.add("mach-action-btn--loading"),e.confirm==null||e.confirm===!1){ws(e,n,t);return}(async()=>{await Cs(e,n)&&await e.onClick(n)})().catch(r=>ut(r,e,n)).finally(()=>{Fi(e,n,t)})}}function Ds(n,e,t){let i=p("button","mach-action-btn");i.type="button";let r=Hr(n);r!=="default"&&i.classList.add(`mach-action-btn--${r}`);let o=n.title??n.label??"Action";return i.title=o,i.setAttribute("aria-label",o),i.disabled=ne(n.disabled,e),ne(n.loading,e)&&(i.disabled=!0,i.classList.add("mach-action-btn--loading")),n.icon&&de[n.icon]?(i.innerHTML=J(de[n.icon]),i.classList.add("mach-action-btn--icon")):i.textContent=n.label??o,i.addEventListener("mousedown",s=>s.stopPropagation()),i.addEventListener("click",s=>{s.stopPropagation(),t(n,i)}),i}function xs(n,e,t,i,r){let o=p("button","mach-action-btn mach-action-btn--icon");o.type="button";let s=i.api.getOption("locale")??{},a=t.moreLabel??s.actionMore??V.actionMore;return o.title=a,o.setAttribute("aria-label",a),o.setAttribute("aria-haspopup",e==="drawer"?"dialog":"menu"),o.setAttribute("aria-expanded","false"),o.innerHTML=`${J(de.more,16)}<span class="mach-sr-only">\u22EF</span>`,o.addEventListener("mousedown",l=>l.stopPropagation()),o.addEventListener("click",l=>{l.stopPropagation();let d=n.map(u=>({label:u.label??u.title??"Action",icon:u.icon,variant:Hr(u),disabled:ne(u.disabled,i)||ne(u.loading,i),pick:c=>{Z(),r(u,c)}}));e==="drawer"?gs(o,t.drawerTitle??a,d):ms(o,d)}),o}function xe(n){let e=Math.max(0,n.max??3),t=n.overflow??"menu";return i=>{let r=vs(n.actions,i);if(r.length===0)return"";let o=p("div","mach-actions"),s=t==="inline"?r:r.slice(0,e),a=t==="inline"?[]:r.slice(e),l=Ts(i);for(let d of s)o.appendChild(Ds(d,i,l));return a.length>0&&o.appendChild(xs(a,t,n,i,l)),{el:o,destroy:()=>{B&&o.contains(B)&&Z()}}}}function De(n,e,t){return n??e??t}function Rs(n,e){let t=e.api.getOption("locale")??{};return{view:De(n.labels?.view,t.actionView,V.actionView),edit:De(n.labels?.edit,t.actionEdit,V.actionEdit),delete:De(n.labels?.delete,t.actionDelete,V.actionDelete),confirm:De(n.labels?.confirm,t.actionConfirm,V.actionConfirm),save:De(n.labels?.save,t.actionSave,V.actionSave),cancel:De(n.labels?.cancel,t.actionCancel,V.actionCancel)}}function Es(n,e,t){let i=async()=>{if(!await e.api.editing.stop()||!n.onSave)return;let s=e.api.editing.getChanges().filter(a=>a.rowId===e.node.id);try{await n.onSave(e,s),e.api.editing.markSaved([e.node.id])}catch(a){throw e.api.editing.startRow(e.rowIndex),a}},r=n.onSave?t.save:n.labels?.confirm??n.labels?.save??t.confirm;return xe({actions:[{icon:"check",title:r,variant:"success",onClick:i},{icon:"close",title:t.cancel,variant:"danger",onClick:()=>e.api.editing.stop({cancel:!0}).then(()=>{})}],overflow:"inline"})(e)}function Ss(n,e,t){let i=[];return n.onView&&i.push({id:"view",icon:"view",title:t.view,variant:"primary",...n.permissions?.view?{permission:n.permissions.view}:{},onClick:n.onView}),n.edit!==!1&&i.push({id:"edit",icon:"edit",title:t.edit,variant:"warning",...n.permissions?.edit?{permission:n.permissions.edit}:{},onClick:n.onEdit??(()=>{e.api.editing.startRow(e.rowIndex)})}),n.onDelete&&i.push({id:"delete",icon:"delete",title:t.delete,variant:"danger",...n.permissions?.delete?{permission:n.permissions.delete}:{},...n.confirmDelete?{confirm:n.confirmDelete===!0?t.delete:n.confirmDelete}:{},onClick:n.onDelete}),i.push(...n.extraActions??[]),i}function ct(n={}){return e=>{let t=Rs(n,e);if(e.api.editing.isRowActive(e.rowIndex))return Es(n,e,t);let i=Ss(n,e,t);return xe({actions:i,max:n.max,overflow:n.overflow??"menu",moreLabel:n.moreLabel,drawerTitle:n.drawerTitle})(e)}}var Ms=ki(),Is=Pi(),Br=Object.freeze({statusTag:Ms,progressBar:Is,link:Gi});var He={sortable:!1,resizable:!1,movable:!1,filter:!1,suppressSizeToFit:!0,suppressColumnMenu:!0};function _r(n={}){let e=n.width??40;return{colId:"sel",headerName:"",width:e,minWidth:n.minWidth??e,maxWidth:n.maxWidth??e,pinned:"left",checkboxSelection:!0,...He,...n}}function ht(n={}){let e=n.width??52;return{colId:"idx",headerName:"#",type:"index",width:e,minWidth:n.minWidth??e,maxWidth:n.maxWidth??e,pinned:"left",align:"center",headerAlign:"center",...He,...n}}function zr(n={}){let e=n.width??40;return{colId:"drag",headerName:"",rowDrag:!0,width:e,minWidth:n.minWidth??e,maxWidth:n.maxWidth??e,pinned:"left",...He,...n}}function Wr(n={actions:[]}){let{width:e,pinned:t,...i}=n,r=i.actions?.length??0,o=i.overflow==="inline"?r:Math.min(r,i.max??3),s=i.overflow!=="inline"&&r>o,a=Math.max(1,o)*26+(s?26:0)+10;return{colId:"op",headerName:"\u64CD\u4F5C",width:e??Math.max(64,a),pinned:t??"right",cellRenderer:xe(i),...He,cellRendererParams:void 0}}function $r(n={}){let{width:e,pinned:t,...i}=n,r=(i.onView?1:0)+(i.edit===!1?0:1)+(i.onDelete?1:0)+(i.extraActions?.length??0),o=i.overflow==="inline"?r:Math.min(r,i.max??3),s=i.overflow!=="inline"&&r>o,a=Math.max(2,o)*26+(s?26:0)+10;return{colId:"op",headerName:"\u64CD\u4F5C",width:e??Math.max(72,a),pinned:t??"right",cellRenderer:ct(i),...He,cellRendererParams:void 0}}var Oi="__rg_detail_toggle__";function Ve(n){return I(n)!==void 0}function Ur(n){return n===!0?"left":n||null}function Kr(n,e){let t=e;for(let i=2;n.has(t);i++)t=`${e}_${i}`;return n.add(t),t}function As(n,e){let t=e.colDef,i=n.colDef;n.manualWidth=e.manualWidth,(t.width===i.width&&t.autoWidth===i.autoWidth||t.width!=null||t.autoWidth===!1)&&(n.contentWidth=e.contentWidth),(e.manualWidth!=null||e.flex!==(I(t.flex)??null))&&(n.flex=e.flex),e.hide!==(t.hide??!1)&&(n.hide=e.hide),e.pinned!==Ur(t.pinned)&&(n.pinned=e.pinned)}var pt=class{constructor(e){this.e=e;this.X=[];this.Rr=new Map;this.fe=[];this.so=[];this.Er=[];this.ao=[];this.me=[];this.Sr=[];this.Dt=new Map;this.Yt=1;this.lo=new Map;this.ca=0;this.Xe=!1}Ri(e){this.Sr=e?[...e]:[];let t=new Map(this.X.map(u=>[u.id,u])),i=this.e.t.defaultColDef,r=this.e.t.masterDetail&&this.e.t.detailToggleColumn,o=new Set(r?[Oi]:[]),s=this.e.t.rowNumber,a=(u,c,h)=>u.map((f,m)=>{if(Ce(f)){let $=f.groupId??f.headerName??`group_${m}_${h}`,K=new re($,f);return K.parent=c,K.children=a(f.children,K,h+1),K}let g=f,b=Kr(o,g.colId??g.field??`col_${m}`),w=new ie(b,kr(g,i,this.e.t.columnTypes));s&&(s=!we(w.colDef,"index")),w.parentGroup=c,w.level=h;let G=t.get(b);return G&&!G.isAutoRowNumber&&As(w,G),w});if(this.fe=a(this.Sr,null,0),s&&o.size>Number(r)&&this.bu(Kr(o,"idx"),t),r){let u=new ie(Oi,{colId:Oi,headerName:"",width:38,pinned:"left",sortable:!1,resizable:!1,movable:!1,filter:!1});u.isDetailToggle=!0,this.fe.unshift(u)}this.Dt.size&&this.wu(),this.X=this.Mr(this.fe),this.Rr=new Map(this.X.map(u=>[u.id,u])),this.Yt=this.X.reduce((u,c)=>Math.max(u,c.level+1),1);let l=this.me.length;this.me=this.me.filter(u=>this.Rr.has(u.colId));let d=this.me.length!==l;if(this.me.length===0){let u=[];for(let c of this.X)c.colDef.initialSort&&!t.has(c.id)&&u.push({colId:c.id,direction:c.colDef.initialSort});this.me=u}return this.Xt(),d}bu(e,t){let i=new ie(e,ht({colId:e,headerName:"\u5E8F\u53F7"}));i.isAutoRowNumber=!0;let r=t.get(e);r?.isAutoRowNumber&&(i.hide=r.hide);let o=this.fe.findIndex(s=>!(s instanceof ie&&(s.hasCheckbox||s.colDef.rowDrag)));this.fe.splice(o===-1?this.fe.length:o,0,i)}Mr(e,t=[]){for(let i of e)i instanceof re?this.Mr(i.children,t):t.push(i);return t}Xt(){this.Xe=!1;let e=this.X.filter(t=>!t.hide);this.so=e.filter(t=>t.pinned==="left"),this.ao=e.filter(t=>t.pinned==="right"),this.Er=e.filter(t=>t.pinned===null),this.lo.clear(),this.l().forEach((t,i)=>this.lo.set(t.id,i))}J(e){return this.lo.get(e)??-1}Z(){return this.X}uo(){return this.Sr}Cu(){return this.fe}Tu(){return this.Yt}x(e){return this.Rr.get(e)}R(e){return e==="left"?this.so:e==="right"?this.ao:this.Er}l(){return[...this.so,...this.Er,...this.ao]}Je(){return this.l().filter(e=>e.colDef.rowGroup===!0)}Du(){return this.l().filter(e=>e.colDef.aggFunc!=null&&e.colDef.rowGroup!==!0)}ha(){let e=this.l();return this.Er.find(X)??e.find(X)??e[0]}ge(e){return e.pinned==="left"?"left":e.pinned==="right"?"right":"center"}pa(e){let t=this.e.n.ye.clientWidth,i=this.Xe&&t===this.ca;this.ca=t;let r=e,o=[],s=[];for(let l of this.l()){let d=this.Ir(l);i||l.pinned!=null||l.colDef.suppressSizeToFit||l.manualWidth!=null?(l.currentWidth=j(i?l.manualWidth??l.currentWidth:d.width??Oe,d),r-=l.currentWidth):(o.push(l),s.push(d))}this.e.t.columnLayout==="auto"&&!s.some(l=>l.flex)&&o.forEach((l,d)=>{if(l.colDef.autoWidth!==!1&&(l.colDef.width==null||l.contentWidth!=null)){let u=s[d];u.flex=j(u.width??Oe,u)}});let a=this.e.t.columnLayout==="fit"?at(s,Math.max(0,r)):Gr(s,Math.max(0,r));o.forEach((l,d)=>{l.currentWidth=a[d]})}Ir(e){let t=e.colDef;return{width:e.manualWidth??e.contentWidth??t.width??void 0,minWidth:e.minWidth??t.minWidth,maxWidth:t.maxWidth,flex:e.manualWidth==null?e.flex??void 0:void 0}}Ee(e,t){return Ve(t)?(this.Xe=!0,e.manualWidth=j(t,this.Ir(e)),e.flex=null,!0):!1}fa(e,t){return Ve(t)?(this.Xe=!1,e.resetWidth(),e.contentWidth=j(t,this.Ir(e)),!0):!1}co(e,t){let i=this.x(e);!i||i.hide===!t||(i.hide=!t,this.Xt())}Ei(e,t){let i=this.x(e);if(!i)return!1;let r=this.ge(i),o=c=>i.parentGroup?!0:this.ge(c)===r,s=i.parentGroup?i.parentGroup.children:this.fe,a=[],l=[];s.forEach((c,h)=>{c instanceof ie&&!c.hide&&o(c)&&(a.push(c),l.push(h))});let d=a.indexOf(i);if(d<0)return!1;a.splice(d,1);let u=Math.max(0,Math.min(t,a.length));return a.splice(u,0,i),l.forEach((c,h)=>{s[c]=a[h]}),d!==u&&this.Dt.set(this.ma(i),a.filter(c=>c.movable).map(c=>c.id)),this.X=this.Mr(this.fe),this.Xt(),!0}ho(e,t){let i=this.x(e);!i||!i.movable||(i.pinned=t,this.Xt())}ga(e=!0){return(e?this.X:this.X.filter(i=>!i.isAutoRowNumber)).map(i=>({colId:i.id,hide:i.hide,width:i.manualWidth??i.currentWidth,flex:i.flex,widthMode:i.manualWidth==null?"auto":"manual",contentWidth:i.contentWidth??void 0,pinned:i.pinned}))}ya(e){let t=new Map(e.map(i=>[i.colId,i]));for(let i of this.X){let r=t.get(i.id);r&&this.xu(i,r)}this.Ru(e),this.Xt()}xu(e,t){typeof t.hide=="boolean"&&(e.hide=t.hide),t.widthMode==="auto"?(e.resetWidth(),Ve(t.flex)&&(e.flex=t.flex)):Ve(t.flex)?(e.flex=t.flex,e.manualWidth=null):this.Ee(e,t.width),Ve(t.contentWidth)&&(e.contentWidth=j(t.contentWidth,this.Ir(e))),e.movable&&(t.pinned==="left"||t.pinned==="right"||t.pinned===null)&&(e.pinned=t.pinned)}Ru(e){let t=new Map(e.map((i,r)=>[i.colId,r]));this.po(i=>!i.hide&&i.movable&&t.has(i.id),(i,r)=>{let o=[...i];i.sort((s,a)=>t.get(s.id)-t.get(a.id)),i.some((s,a)=>s!==o[a])&&this.Dt.set(r,i.map(s=>s.id))}),this.X=this.Mr(this.fe)}ma(e){if(!e.parentGroup)return this.ge(e);let t=[];for(let i=e.parentGroup;i;i=i.parent)t.push(i.groupId);return JSON.stringify(t)}wu(){let e=new Map;this.po(t=>t.movable,(t,i)=>{let r=this.Dt.get(i);if(!r)return;let o=new Map(t.map(d=>[d.id,d])),s=r.filter(d=>o.has(d));if(s.length<2)return;let a=new Set(s),l=0;t.forEach((d,u)=>{a.has(d.id)&&(t[u]=o.get(s[l++]))}),e.set(i,s)}),this.Dt=e}po(e,t,i=this.fe){let r=new Map;i.forEach((o,s)=>{if(o instanceof re)this.po(e,t,o.children);else if(e(o)){let a=o.parentGroup?"center":this.ge(o),l=r.get(a)??[];l.push(s),r.set(a,l)}});for(let o of r.values()){if(o.length<2)continue;let s=o.map(a=>i[a]);t(s,this.ma(s[0])),o.forEach((a,l)=>{i[a]=s[l]})}}fo(){for(let e of this.X)e.resetWidth(),e.hide=e.colDef.hide??!1,e.pinned=Ur(e.colDef.pinned);if(this.Dt.size){this.Dt.clear(),this.Ri(this.Sr);return}this.Xt()}Q(){return this.me.map(e=>({...e}))}Si(e){if(!e||e.length===0){this.me=[];return}this.me=e.filter(t=>this.Rr.has(t.colId)&&(t.direction==="asc"||t.direction==="desc")).map(t=>({colId:t.colId,direction:t.direction}))}Ar(e,t){let i=[...this.me],r=i.findIndex(l=>l.colId===e.id),o=r>=0?i[r].direction:null,s=o===null?"asc":o==="asc"?"desc":null;t&&this.e.t.multiSort?s===null?r>=0&&i.splice(r,1):r>=0?i[r]={colId:e.id,direction:s}:i.push({colId:e.id,direction:s}):(i.length=0,s&&i.push({colId:e.id,direction:s})),this.me=i}};function k(n){return n!=null&&typeof n.then=="function"}function se(n,e){if(n instanceof Error)return n;let t=new Error(typeof n=="string"?n:e);return t.name="AbortError",t}var ks=()=>se(void 0,"[MachTable] Operation cancelled.");function ft(n,e,t=ks){return e?new Promise((i,r)=>{let o=()=>{e.removeEventListener("abort",o),r(t())};if(n.then(i,r).finally(()=>e.removeEventListener("abort",o)),e.aborted){o();return}e.addEventListener("abort",o,{once:!0})}):n}function jr(n){return n==null?"":String(n).toLowerCase()}function Vi(n,e,t){return n.length===0||(e==="or"?n.some(t):n.every(t))}function Ps(n,e,t){let i=jr(n);return Vi(e,t,o=>{let s=(o.value??"").toLowerCase();switch(o.match){case"contains":return i.includes(s);case"notContains":return!i.includes(s);case"equals":return i===s;case"notEquals":return i!==s;case"startsWith":return i.startsWith(s);case"endsWith":return i.endsWith(s);case"blank":return i==="";case"notBlank":return i!=="";default:return!0}})}function qr(n,e,t,i){switch(t){case"equals":return n===e;case"notEquals":return n!==e;case"lessThan":return n<e;case"lessThanOrEqual":return n<=e;case"greaterThan":return n>e;case"greaterThanOrEqual":return n>=e;case"inRange":return n>=e&&n<=i;default:return!0}}function Gs(n,e){let t=n==null||n==="";if(e.match==="blank")return t;if(e.match==="notBlank")return!t;if(t)return!1;let i=typeof n=="number"?n:Number(n);if(Number.isNaN(i))return!1;let r=e.value;return r==null||Number.isNaN(r)?!1:qr(i,r,e.match,e.value2??r)}function Ls(n,e,t){return Vi(e,t,r=>Gs(n,r))}function Hi(n){if(n==null||n==="")return null;if(typeof n=="number")return n;let e=n instanceof Date?n.getTime():Date.parse(String(n));return isNaN(e)?null:e}function Ns(n,e,t){let i=Hi(n);return Vi(e,t,o=>{let s=i==null;if(o.match==="blank")return s;if(o.match==="notBlank")return!s;if(s)return!1;let a=Hi(o.value);if(a==null)return!1;let l=o.match==="inRange"?Hi(o.value2)??1/0:a;return qr(i,a,o.match,l)})}function Fs(n,e){return e.length===0?!0:e.some(t=>t==null&&n==null||t===n)}function Os(n,e){let t=e.type!=="set"&&e.operator==="or"?"or":"and";switch(e.type){case"text":return Ps(n,e.conditions,t);case"number":return Ls(n,e.conditions,t);case"date":return Ns(n,e.conditions,t);case"set":return Fs(n,e.values);default:return!0}}function Yr(n,e,t){return i=>Os(t(i,n),e)}function Xr(n,e,t){if(n.kind==="condition"){let r=e.get(n.colId);return r?Yr(r,n.filter,t):()=>!0}let i=n.children.map(r=>Xr(r,e,t));return r=>{let o=n.operator==="or"?i.some(s=>s(r)):i.every(s=>s(r));return n.not?!o:o}}function Bi(n,e,t,i,r){let o=new Map(n.map(l=>[l.id,l])),s=Object.entries(e).flatMap(([l,d])=>{let u=o.get(l);return u?[Yr(u,d,r)]:[]});t&&s.push(Xr(t.root,o,r));let a=i?.trim().toLowerCase().split(/\s+/).filter(Boolean)??[];return l=>s.every(d=>d(l))&&a.every(d=>n.some(u=>jr(r(l,u)).includes(d)))}var Jr=typeof Intl<"u"?new Intl.Collator(void 0,{numeric:!0,sensitivity:"base"}):null;function Hs(n,e){let t=n==null||n==="",i=e==null||e==="";return!t&&!i?null:t&&i?0:t?1:-1}function Vs(n,e){let t=Number.isNaN(n),i=Number.isNaN(e);return t||i?t===i?0:t?1:-1:n-e}function Bs(n,e){return n===e?0:n?1:-1}function mt(n,e){let t=Hs(n,e);if(t!==null)return t;if(typeof n=="number"&&typeof e=="number")return Vs(n,e);if(n instanceof Date&&e instanceof Date)return n.getTime()-e.getTime();if(typeof n=="boolean"&&typeof e=="boolean")return Bs(n,e);let i=String(n),r=String(e);return Jr?Jr.compare(i,r):i.localeCompare(r)}function _i(n,e,t,i){let r=new Map(t.map(a=>[a.id,a])),o=e.flatMap(a=>{let l=r.get(a.colId);return l?[{column:l,compare:l.colDef.comparator??mt,direction:a.direction}]:[]}),s=n.map(a=>({node:a,values:o.map(({column:l})=>i(a,l))}));return s.sort((a,l)=>{for(let d=0;d<o.length;d++){let u=o[d],c=u.compare(a.values[d],l.values[d],a.node,l.node);if(c!==0)return u.direction==="asc"?c:-c}return 0}),s.map(({node:a})=>a)}function Zr(){return{count:0,numeric:0,sum:0,min:1/0,max:-1/0}}function Qr(n,e){n.count++,!(typeof e!="number"||!Number.isFinite(e))&&(n.numeric++,n.sum+=e,n.min=Math.min(n.min,e),n.max=Math.max(n.max,e))}function en(n,e){return e==="count"?n?.count??0:n?.numeric?e==="min"?n.min:e==="max"?n.max:Number.isFinite(n.sum)?e==="avg"?n.sum/n.numeric:n.sum:null:null}function gt(n,e){let t=Zr();for(let i of n)Qr(t,i);return en(t,e)}var Be={sum:n=>gt(n,"sum"),avg:n=>gt(n,"avg"),count:n=>n.length,min:n=>gt(n,"min"),max:n=>gt(n,"max"),first:n=>n.length>0?n[0]:null,last:n=>n.length>0?n[n.length-1]:null};function tn(n,e,t){if(e===Be.count)return n.length;let i=["sum","avg","min","max"].find(o=>e===Be[o]);if(!i)return e(n.map(t));let r=Zr();for(let o of n)Qr(r,t(o));return en(r,i)}function yt(n){let e={...Be,...n??{}};return t=>e[t]}var vt="group:";function rn(n){return n==null?"null":n instanceof Date?JSON.stringify(["date",String(n.getTime())]):JSON.stringify([typeof n,zi(n)])}function zi(n){return n==null?"(\u7A7A)":String(n)}function nn(n){return vt+JSON.stringify(n)}function _s(n,e,t){let i=new Map;for(let r of n){let o=t(r,e),s=rn(o),a=i.get(s);a||(a={key:s,label:zi(o),rows:[]},i.set(s,a)),a.rows.push(r)}return[...i.values()].sort((r,o)=>r.label.localeCompare(o.label,void 0,{numeric:!0,sensitivity:"base"})||r.key.localeCompare(o.key))}function on(n,e,t,i,r){let o=[],s=(a,l,d)=>{if(l===e.length)return{display:a,leaves:a};let u=[],c=[];for(let h of _s(a,e[l],t)){let f=[...d,[e[l].id,h.key]],m=nn(f);o.push(m);let g=s(h.rows,l+1,f);if(u.push({id:m,data:null,rowIndex:-1,selected:!1,isGroup:!0,groupLevel:l,groupKey:h.label,leafNodes:g.leaves,aggValues:i(g.leaves)}),r.has(m))for(let b of g.display)u.push(b);if(l>0)for(let b of g.leaves)c.push(b)}return{display:u,leaves:c}};return{rows:s(n,0,[]).display,ids:o}}function sn(n,e,t,i){let r=new Set([...n].filter(l=>l.startsWith("/g0:")));if(!r.size)return{expanded:n,ambiguous:[]};let o=new Map;for(let l of e){let d=[],u="";for(let c=0;c<t.length;c++){let h=i(l,t[c]);if(d.push([t[c].id,rn(h)]),u+=`/g${c}:${zi(h)}`,!r.has(u))continue;let f=nn(d);o.set(u,o.has(u)&&o.get(u)!==f?null:f)}}let s=new Set([...n].filter(l=>!r.has(l))),a=[];for(let l of r){let d=o.get(l);d?s.add(d):d===null?a.push(l):s.add(l)}return{expanded:s,ambiguous:a}}function zs(n,e){let t=n?[n.root]:[];for(;t.length;){let i=t.pop();if(i.kind==="condition")e.add(i.colId);else for(let r of i.children)t.push(r)}}function an(n){let e=new Set(Object.keys(n.filterModel));zs(n.advancedFilter,e);let t=new Set(n.sortModel.map(a=>a.colId));for(let a of t)e.add(a);let i=n.columns.some(a=>a.colDef.rowGroup===!0),r=!!n.quickFilter?.trim(),o=n.columns.filter(a=>e.has(a.id)||r||a.colDef.rowGroup===!0||i&&a.colDef.aggFunc!=null),s=new Set;for(let a of o){let l=a.colDef;if(i&&l.rowGroup!==!0&&l.aggFunc!=null&&n.customAggregates?.[l.aggFunc]||l.valueGetter||t.has(a.id)&&l.comparator||!l.field)return null;s.add(l.field)}return[...s]}function ln(n){return n!=null&&(typeof n=="object"||typeof n=="function")}function dn(n,e){if(n.length*(e.length+4)>1e6)return null;let t=new WeakMap;for(let i of n){if(i.data==null)continue;let r=e.map(o=>z(i.data,o));r.some(ln)||t.set(i,r)}return t}function un(n,e,t,i){return t.length?!i||n===e||n==null||e==null?!0:t.some((r,o)=>{let s=z(e,r);return ln(s)||!Object.is(i[o],s)}):!1}function ue(n){return se(n.reason,"Block request aborted")}function bt(n){return Number.isFinite(n)?Math.max(1,Math.trunc(n)):1}var wt=class{constructor(e,t,i=4){this.maxBlocks=e;this.vo=t;this.maxConcurrentRequests=i;this.ee=new Map;this.j=new Map;this.va=0;this.mo=0;this.go=0;this.ba=0;this.wa=0;this.kr=0;this.Pr=new Set;this.maxBlocks=bt(e),this.maxConcurrentRequests=bt(i)}configure(e,t=this.maxConcurrentRequests){this.maxBlocks=bt(e),this.maxConcurrentRequests=bt(t),this.yo(),this.Gr()}Eu(e){this.Pr=e,this.yo()}peek(e){let t=this.ee.get(e);if(t)return t.touchedAt=++this.va,t}has(e){return this.ee.has(e)}Jt(e){let t=this.j.get(e);t&&(this.j.delete(e),t.controller.abort(),t.state==="queued"&&t.reject(ue(t.controller.signal)));let i=this.ee.get(e);i&&(this.ee.delete(e),this.vo?.(e,i))}load(e,t,i,r=0){if(i?.aborted)return Promise.reject(ue(i));let o=this.peek(e);if(o)return this.go++,Promise.resolve(o);let s=this.j.get(e);if(s)return this.go++,s.priority=Math.max(s.priority,r),this.Gr(),this.Ca(e,s,i);this.ba++;let a=new AbortController,l,d,u=new Promise((f,m)=>{l=f,d=m}),c={controller:a,promise:u,consumers:0,loader:t,priority:r,state:"queued",resolve:l,reject:d};this.j.set(e,c);let h=this.Ca(e,c,i);return this.Gr(),h}Su(){this.mo++,this.Pr.clear();for(let e of this.j.values())e.controller.abort(),e.state==="queued"&&e.reject(ue(e.controller.signal));this.j.clear();for(let[e,t]of this.ee)this.vo?.(e,t);this.ee.clear()}snapshot(){let e=0,t=0;for(let i of this.ee.values())e+=i.rows.length;for(let i of this.j.values())i.state==="active"&&t++;return{cachedBlockCount:this.ee.size,loadingBlockCount:this.j.size,activeRequestCount:t,queuedRequestCount:Math.max(0,this.j.size-t),cachedRowCount:e,hitCount:this.go,missCount:this.ba,evictionCount:this.wa}}Gr(){for(;this.kr<this.maxConcurrentRequests;){let e,t;for(let[i,r]of this.j)r.state!=="queued"||r.controller.signal.aborted||(!t||r.priority>t.priority)&&(e=i,t=r);if(e==null||!t)return;this.Mu(e,t)}}Mu(e,t){t.state="active",this.kr++;let i=this.mo;this.Iu(t).then(r=>{i===this.mo&&!t.controller.signal.aborted&&(this.ee.set(e,{rows:r.rows,...r.lastRow==null?{}:{lastRow:r.lastRow},touchedAt:++this.va}),this.yo()),t.resolve(r)},t.reject).finally(()=>{this.kr=Math.max(0,this.kr-1),this.j.get(e)===t&&this.j.delete(e),this.Gr()})}Iu(e){let{signal:t}=e.controller;return ft(Promise.resolve().then(()=>{if(t.aborted)throw ue(t);return e.loader(t)}),t,()=>ue(t))}Ca(e,t,i){return t.consumers++,new Promise((r,o)=>{let s=!1,a=d=>{s||(s=!0,i?.removeEventListener("abort",l),t.consumers=Math.max(0,t.consumers-1),d())},l=()=>a(()=>{t.consumers===0&&this.j.get(e)===t&&(this.j.delete(e),t.controller.abort(i?.reason),t.state==="queued"&&t.reject(ue(t.controller.signal))),o(ue(i))});i?.addEventListener("abort",l,{once:!0}),t.promise.then(d=>a(()=>r(d)),d=>a(()=>o(d instanceof Error?d:new Error(String(d??"Block request failed")))))})}yo(){let e=Math.max(this.maxBlocks,this.Pr.size+1);for(;this.ee.size>e;){let t=-1,i=Number.POSITIVE_INFINITY;for(let[o,s]of this.ee)this.Pr.has(o)||s.touchedAt<i&&(t=o,i=s.touchedAt);if(t<0)return;let r=this.ee.get(t);this.ee.delete(t),this.wa++,r&&this.vo?.(t,r)}}};function Re(n,e){if(n==null||typeof n!="object")return;let t=n[e];return Array.isArray(t)?t:void 0}function Ee(n,e,t=0,i=new Set){for(let r of n){if(r==null)continue;if(t>=256)throw new RangeError("[MachTable] Tree data exceeds 256 levels.");if(i.has(r))throw new TypeError("[MachTable] Tree data contains a cyclic object graph.");let o=Re(r,e);o?.length&&(i.add(r),Ee(o,e,t+1,i),i.delete(r))}}var Ct=class{constructor(e){this.e=e;this.c=[];this._=[];this.te=new Map;this.ve=[];this.p=new Map;this.Se={};this.Me=null;this.He=null;this.A=new Set;this.z=new Set;this.Mi=[];this.Ii=new Map;this.Ta=[];this.k=null;this.Ai=!1;this.Da=!1;this.Ze=0;this.Lr=null;this.Nr=new WeakMap;this.Fr=new WeakMap;this.Qe=new Map;this.ki=new Map;this.Or=0;this.Hr=0;this.et=null;this.tt=new Map;this.xt=new Map;this.Vr=new Set;this.Rt=new Map;this.it=new wt(12,e=>this.xa(e));this.Pi=0;this.Br=null;this.bo=!1;this.Ra=0;this.we=[];this.V=1;this.Me=H(e.t.advancedFilterModel)}resolveRowId(e,t,i){let r=this.e.t.resolveRowId;if(!r)return i;try{let o=r({data:e,index:t,api:this.e.api});if(typeof o=="string"&&o.length>0)return o;this.e.reportError(new Error("rowKey must resolve to a non-empty identifier"),"rowKey",{index:t})}catch(o){this.e.reportError(o,"rowKey",{index:t})}return i}get M(){return this.e.t.treeData}get g(){return this.e.t.datasource!=null}get be(){return this.g&&this.e.t.datasourceMode==="block"}Gi(){if(this.g){if(this.be)return this.Zt();let e=Math.max(0,this.ve.length-this.c.length);return(this.k??this.c.length)+e}return this.ve.length}Li(){return this.Or}Ve(){return this.Hr}Au(){return this.Da}_r(e){return!this.g||e?.aborted?Promise.resolve():(this.Ea(!0),this.be?(this.it.configure(this.e.t.maxBlocksInCache,this.e.t.datasourceMaxConcurrentRequests),this.zr(0,e)):this.Sa(0,void 0,e))}Et(e){this.Da=e,this.e.n.Et(e,this.e.u("loading"))}Sa(e,t,i){if(!this.g||this.Ai||this.k!=null&&e>=this.k)return Promise.resolve();let r=this.e.t.blockSize,o=t??e+r;if(o<=e)return Promise.resolve();let s=++this.Ze,a=new AbortController,l=()=>a.abort(i?.reason);return i?.addEventListener("abort",l,{once:!0}),this.Lr=a,this.Ai=!0,this.Et(!0),new Promise(d=>{let u=c=>{i?.removeEventListener("abort",l),s===this.Ze&&(this.Ai=!1,this.Lr=null,this.Et(!1),c!=null&&c?.name!=="AbortError"&&this.e.reportError(c,"datasource.getRows",{startRow:e,endRow:o})),d()};this.Ma(e,o,a.signal,(c,h)=>{if(s!==this.Ze||this.e.o()||a.signal.aborted){u();return}typeof h=="number"&&h>=0?this.k=h:c.length<o-e&&(this.k=e+c.length);let f=this.c.length===0;this.ku(c),u(),this.O(),f&&this.e.Ie(),this.e.W.Wr()},c=>u(a.signal.aborted||this.e.o()?void 0:c??new Error("Datasource request failed")))})}wo(){this.Ze++,this.Lr?.abort(),this.Lr=null,this.Ai=!1,this.Et(!1),this.it.Su(),this.tt.clear(),this.xt.clear(),this.Vr.clear();for(let[e,t]of this.Rt)this.p.get(e)===t&&this.p.delete(e);this.Rt.clear()}ku(e){for(let t of e){if(t==null)continue;let i=this.c.length,r=this.resolveRowId(t,i,`inf-${this.e.Qt()}`);if(this.p.has(r)){this.e.reportError(new Error(`Duplicate row id: ${r}`),"datasource.getRows",{rowId:r});continue}let o={id:r,data:t,rowIndex:-1,selected:this.e.f.$r(r)};this.c.push(o),this.p.set(r,o),this._.push(o)}}zr(e,t,i=0){if(!this.be||e<0)return Promise.resolve();if(t?.aborted)return Promise.reject(this.Ia(t.reason));let r=this.e.t.blockSize,o=this.Ze,s=e*r;if(s>=this.Zt())return Promise.resolve();let a=this.k==null?s+r:Math.min(this.k,s+r),l=this.it.load(e,d=>this.Pu(s,a,d),t,i);return this.Et(this.c.length===0&&this.it.snapshot().loadingBlockCount>0),l.then(d=>{o!==this.Ze||t?.aborted||this.e.o()||!this.be||!this.it.has(e)||this.Vr.has(e)||(this.Gu(e,d),this.O(),this.e.W.Wr(),o===this.Ze&&!this.e.o()&&this.Aa(this.e.s.Co().lastExcl-1))}).catch(d=>{throw d?.name!=="AbortError"&&this.e.reportError(d,"datasource.getRows",{startRow:s,endRow:a}),d}).finally(()=>{o===this.Ze&&this.Et(this.c.length===0&&this.it.snapshot().loadingBlockCount>0)})}Pu(e,t,i){return new Promise((r,o)=>{this.Ma(e,t,i,(s,a)=>r({rows:s,...typeof a=="number"&&a>=0?{lastRow:a}:{}}),s=>o(s instanceof Error?s:new Error(typeof s=="string"?s:"Datasource request failed")))})}Ma(e,t,i,r,o){let s=this.e.t.datasource,a=0,l=null,d=!1,u=()=>d?!1:(d=!0,l!=null&&clearTimeout(l),i.removeEventListener("abort",c),!0),c=()=>{u()&&o(this.Ia(i.reason))};i.addEventListener("abort",c,{once:!0});let h=()=>{if(d)return;if(i.aborted||this.e.o()){c();return}a++;let f=!1,m=g=>{if(!(f||d)){if(f=!0,i.aborted||this.e.o()){c();return}a<=this.e.t.datasourceRetryCount?l=setTimeout(h,this.retryDelay(a)):u()&&o(g)}};try{let g=s.getRows({startRow:e,endRow:t,sortModel:this.e.r.Q(),filterModel:this.Be(),advancedFilterModel:this.Ni(),quickFilterText:this.He,signal:i,onSuccess:(b,w)=>{!f&&u()&&r(b??[],w)},fail:m});g&&typeof g.catch=="function"&&g.catch(m)}catch(g){m(g)}};h()}Gu(e,t){let i=this.e.t.blockSize,r=e*i;this.xa(e),typeof t.lastRow=="number"&&t.lastRow>=0?this.k=t.lastRow:t.rows.length<i&&(this.k=r+t.rows.length),t.rows.forEach((o,s)=>{if(o==null)return;let a=r+s;if(this.k!=null&&a>=this.k)return;let l=this.resolveRowId(o,a,`block-${a}`),d=this.Rt.get(l),u=this.p.get(l);if(u&&u!==d&&u.rowIndex!==a){this.e.reportError(new Error(`Duplicate row id: ${l}`),"datasource.getRows",{rowId:l});return}let c=d??{id:l,data:o,rowIndex:a,selected:this.e.f.$r(l)};c.rowIndex=a,c.selected=this.e.f.$r(l),this.Rt.delete(l),this.tt.set(a,c),this.xt.delete(a),this.p.set(l,c),this.Fr.set(c,a+1)}),this.ka(),this.Vr.add(e)}xa(e){this.Vr.delete(e);let t=this.e.t.blockSize,i=e*t,r;for(let o=i;o<i+t;o++){let s=this.tt.get(o);s&&(r??(r=new Set(this.e.P.getDirtyRowIds())),this.tt.delete(o),r.has(s.id)?this.Rt.set(s.id,s):this.p.get(s.id)===s&&this.p.delete(s.id))}this.ka()}ka(){this.c=[...this.tt.entries()].sort(([e],[t])=>e-t).map(([,e])=>e),this._=this.c}Zt(){if(this.k!=null)return this.k;if(this.e.t.datasourceRowCount!=null)return this.e.t.datasourceRowCount;if(this.tt.size===0)return this.e.t.blockSize;let e=0;for(let t of this.tt.keys())e=Math.max(e,t+1);return e+this.e.t.blockSize}Lu(e){let t=this.xt.get(e);if(!t&&(t={id:`__mach_loading_${e}`,data:null,rowIndex:e,selected:!1,loading:!0},this.xt.set(e,t),this.xt.size>2e3)){let i=this.xt.keys().next().value;i!=null&&this.xt.delete(i)}return t}Ia(e){return se(e,"Operation aborted")}retryDelay(e){let t=Math.min(this.e.t.datasourceRetryDelay*2**Math.max(0,e-1),3e4),i=this.e.t.datasourceRetryJitter;return Math.max(0,Math.round(t*(1+(Math.random()*2-1)*i)))}Nu(e){if(this.be){this.Aa(e);return}if(!this.g||this.Ai)return;let t=this.c.length;if(this.k!=null&&t>=this.k)return;let i=this.e.t.infiniteBufferRows;if(e+i<t&&e<t)return;let r=this.e.t.blockSize,o=this.k==null?t+r:Math.min(this.k,t+r);this.Sa(t,o)}Aa(e){if(e<0)return;this.Pa();let t=this.e.t.blockSize,i=Math.floor(e/t),r=Math.floor(this.e.s.Co().first/t),o=this.e.t.blockPrefetch,s=i<this.Ra?-1:1;this.Ra=i;for(let a=r;a<i;a++)this.zr(a,void 0,o+2).catch(()=>{});for(let a=0;a<=o;a++){let l=a===0?[i]:[i+s*a,i-s*a];for(let d of l)d<0||d*t>=this.Zt()||this.zr(d,void 0,o-a+1).catch(()=>{})}}Ga(){return this._r().catch(()=>{})}Fu(){return this.wo(),this.g?this._r().catch(()=>{}):(this.k=null,this.rt(this.e.t.rowData),this.e.$({data:!0}),Promise.resolve())}destroy(){this.et=null,this.wo(),this.La(),this.To(),this.c=this._=this.ve=this.we=[],this.p.clear(),this.te.clear(),this.Ii.clear(),this.Ta=[],this.A.clear(),this.z.clear(),this.Mi=[]}Do(e,t,i){if(!this.be)return Promise.resolve();this.Pa();let r=this.e.t.blockSize,o=Math.max(0,Math.trunc(e)),s=Math.min(this.Zt(),Math.max(o,Math.trunc(t))),a=Math.floor(o/r),l=Math.max(a,Math.floor(Math.max(o,s-1)/r)),d=[];for(let u=a;u<=l;u++)d.push(this.zr(u,i,100));return Promise.all(d).then(()=>{})}Ou(){this.be&&this.Ea(!1)}Ea(e){this.Na(),this.e.P.clear(),this.wo(),e&&(this.k=null,this.A.clear()),this.c=[],this._=[],this.p.clear(),this.e.H.clear(),this.O()}Na(){this.Hr++,this.e._e(),this.e.api.editing.stop({cancel:!0})}Hu(){return this.it.snapshot()}Pa(){let e=new Set(this.e.P.getDirtyRowIds());for(let[l,d]of this.Rt)e.has(l)||(this.Rt.delete(l),this.p.get(l)===d&&this.p.delete(l));let t=this.e.t.blockSize,i=new Set,{first:r,lastExcl:o}=this.e.s.Co();for(let l=r;l<o;l+=t)i.add(Math.floor(l/t));o>r&&i.add(Math.floor((o-1)/t));let s=this.e.s.v;s&&i.add(Math.floor(s.rowIndex/t));let a=this.e.a.Vu();a!=null&&i.add(Math.floor(a/t)),this.it.Eu(i)}rt(e){let t=this.e.t.resolveRowId,i=this.e.t.childrenKey;this.M&&Ee(e??[],i);let r=[],o=[],s=new Map,a=new Map,l=0,d=(u,c,h)=>{let f=l++,m=this.resolveRowId(u,f,`auto-${f}`);if(s.has(m))return this.e.reportError(new Error(`Duplicate row id: ${m}`),"rowData",{rowId:m,index:f}),null;let g=this.M?Re(u,i):void 0,b={id:m,data:u,rowIndex:-1,selected:!1,treeChildrenLoaded:Array.isArray(g)};if(this.Nr.set(b,c),r.push(b),s.set(m,b),h!=null){let w=a.get(h)??[];w.push(m),a.set(h,w)}else o.push(b);if(this.M&&Array.isArray(g))for(let w of g)w!=null&&d(w,c+1,m);return b};(e??[]).forEach(u=>{u!=null&&d(u,0,null)}),this.e.t.rowData=e??[],this.Na(),this.La(),this.e.P.clear(),this.c=r,this._=o,this.te=a,this.p=s,this.e.H.clear();for(let u of[...this.A])s.has(u)||this.A.delete(u);if(this.e.t.defaultExpandAll)for(let u of r)this.Fa(u.id)>0&&this.A.add(u.id);this.e.f.Oa(t!=null),this.Kr()}Fi(e){return this.te.get(e)??[]}Fa(e){return this.te.get(e)?.length??0}xo(e){return this.Fa(e)>0}isTreeRowLoading(e){return this.p.get(e)?.treeLoading===!0}La(){for(let e of this.Qe.values())e.abort();this.Qe.clear(),this.ki.clear()}loadTreeChildren(e,t=!1){let i=this.p.get(e),r=this.e.t.loadTreeChildren;if(!this.M||!i?.data||!r)return Promise.resolve([]);if(!t&&i.treeChildrenLoaded)return Promise.resolve(this.Fi(e).flatMap(l=>{let d=this.p.get(l)?.data;return d==null?[]:[d]}));let o=this.ki.get(e);if(o&&!t)return o;this.Qe.get(e)?.abort();let s=new AbortController;this.Qe.set(e,s),i.treeLoading=!0,i.treeLoadError=void 0,this.e.$({data:!0});let a=Promise.resolve().then(()=>r({data:i.data,node:i,api:this.e.api,signal:s.signal})).then(l=>{if(s.signal.aborted||this.e.o())return[];if(!Array.isArray(l))throw new TypeError("[MachTable] loadTreeChildren must resolve to an array.");return this.Bu(i,l),i.treeChildrenLoaded=!0,i.treeLoadError=void 0,this.e.emit("treeChildrenLoaded",{rowId:e,rowNode:i,children:l}),l}).catch(l=>{if(s.signal.aborted||l?.name==="AbortError")return[];throw i.treeLoadError=l,i.treeChildrenLoaded=!1,this.e.reportError(l,"treeData.loadChildren",{rowId:e}),this.e.emit("treeChildrenLoadFailed",{rowId:e,rowNode:i,error:l}),l}).finally(()=>{this.Qe.get(e)===s&&(this.Qe.delete(e),this.ki.delete(e),i.treeLoading=!1,this.e.$({data:!0}))});return this.ki.set(e,a),a}Bu(e,t){let i=new Set,r=[...this.Fi(e.id)];for(;r.length>0;){let s=r.pop();i.has(s)||(i.add(s),r.push(...this.Fi(s)))}this._u(t,i,this.Ur(e)+1);for(let s of i)this.Qe.get(s)?.abort(),this.Qe.delete(s),this.ki.delete(s),this.te.delete(s),this.p.delete(s),this.A.delete(s);this.te.delete(e.id);let o=this.Ur(e)+1;for(let s of t)s!=null&&this.Ro(e,s,o);this.Ha(),this.e.f.Oa(this.e.t.resolveRowId!=null),this.O()}_u(e,t,i){Ee(e,this.e.t.childrenKey,i);let r=this.e.t.resolveRowId,o=r?new Set([...this.p.keys()].filter(l=>!t.has(l))):null,s=[...e],a=0;for(;s.length>0;){let l=s.pop();if(l==null)continue;if(r&&o){let u=r({data:l,index:a++,api:this.e.api});if(typeof u!="string"||u.length===0)throw new TypeError("[MachTable] rowKey must resolve to a non-empty identifier for lazy tree children.");if(o.has(u))throw new Error(`Duplicate row id: ${u}`);o.add(u)}let d=Re(l,this.e.t.childrenKey);d&&s.push(...d)}}Oi(e,t=!0){this.M&&e.add?.length&&Ee(e.add,this.e.t.childrenKey);let i=this.e.t.resolveRowId,r=[],o=[];if(e.remove?.length){let a=new Set,l=new Set,d=c=>{if(i){let f=[this.resolveRowId(c,-1,`__missing_remove_${this.e.Qt()}`)];for(;f.length>0;){let m=f.pop();if(!a.has(m)){a.add(m);for(let g of this.te.get(m)??[])f.push(g)}}}else{let h=[c];for(;h.length>0;){let f=h.pop();l.add(f);let m=this.M?Re(f,this.e.t.childrenKey):void 0;if(m)for(let g of m)h.push(g)}}};e.remove.forEach(d),this.c=this.c.filter(c=>{let h=a.has(c.id)||c.data!=null&&l.has(c.data);return h&&(o.push(c.id),this.p.delete(c.id),this.te.delete(c.id)),!h});let u=new Set(this.c);this._=this._.filter(c=>u.has(c))}if(e.update?.length)for(let a of e.update){let l;i?l=this.p.get(this.resolveRowId(a,-1,`__missing_update_${this.e.Qt()}`)):l=this.c.find(d=>d.data===a),l&&(r.push({node:l,before:l.data,after:a}),l.data=a,o.push(l.id),this.e.s.Va(l))}if(e.add?.length){let a=e.addIndex!=null?Math.max(0,Math.min(e.addIndex,this._.length)):this._.length,l=[];e.add.forEach((d,u)=>{let c=this.resolveRowId(d,a+u,`add-${this.e.Qt()}`);if(this.p.has(c)){this.e.reportError(new Error(`Duplicate row id: ${c}`),"transaction.add",{rowId:c});return}let h={id:c,data:d,rowIndex:-1,selected:!1};this.p.set(c,h),this.Nr.set(h,0);let f=this.M?Re(d,this.e.t.childrenKey):void 0;if(f)for(let m of f)m!=null&&this.Ro(h,m,1);l.push(h)}),this._=this._.slice(0,a).concat(l,this._.slice(a)),this.Ha()}let s={pipelineChanged:this.zu(e,r),updatedRowIds:r.map(({node:a})=>a.id)};return this.e.H.Wu(o),this.$u(s,t),this.e.P.Ku(o),s}$u(e,t){e.pipelineChanged&&(this.et=null),t&&(e.pipelineChanged?this.Kr():e.updatedRowIds.length&&this.Ba())}Uu(e){if(e.length===0)return{pipelineChanged:!1,updatedRowIds:[]};let t=this.Hr,i=!1,r=new Set;for(let o of e){let s=this.Oi(o,!1);if(this.Hr!==t)return{pipelineChanged:!1,updatedRowIds:[]};i||(i=s.pipelineChanged);for(let a of s.updatedRowIds)r.add(a)}return i?this.Kr():r.size>0&&this.Ba(),{pipelineChanged:i,updatedRowIds:[...r]}}zu(e,t){if(e.add?.length||e.remove?.length)return!0;if(!t.length)return!1;let i=this._a();if(i===null)return!0;if(!i.length)return!1;let r=this.et;return!r||i.length!==r.fields.length||i.some((o,s)=>o!==r.fields[s])?!0:t.some(({node:o,before:s,after:a})=>un(s,a,i,r.values.get(o)))}_a(){if(this.M||this.e.t.masterDetail||this.za())return null;let e=this.e.r.l();if(e.some(i=>st(i)||i.colDef.autoRowSpan===!0||i.colDef.rowSpan!=null))return null;let t=!this.e.t.manualFiltering;return an({columns:e,customAggregates:this.e.t.aggFuncs,sortModel:this.e.t.manualSorting?[]:this.e.r.Q(),filterModel:t?this.Se:{},advancedFilter:t?this.Me:null,quickFilter:t?this.He:null})}ju(){let e=this._a(),t=e?.length?dn(this.c,e):null;this.et=e&&t?{fields:e,values:t}:null}Ba(){this.e.emit("modelUpdated",{rowCount:this.we.length})}Ro(e,t,i){let r=this.resolveRowId(t,-1,`add-${this.e.Qt()}`);if(this.p.has(r)){this.e.reportError(new Error(`Duplicate row id: ${r}`),"transaction.add",{rowId:r});return}let o=Re(t,this.e.t.childrenKey),s={id:r,data:t,rowIndex:-1,selected:!1,treeChildrenLoaded:Array.isArray(o)};this.p.set(r,s),this.Nr.set(s,i);let a=this.te.get(e.id)??[];if(a.push(s.id),this.te.set(e.id,a),!!o)for(let l of o)l!=null&&this.Ro(s,l,i+1)}Ha(){this.c=[];let e=t=>{this.c.push(t),this.p.has(t.id)||this.p.set(t.id,t);for(let i of this.te.get(t.id)??[]){let r=this.p.get(i);r&&e(r)}};for(let t of this._)e(t)}St(e){let t=JSON.stringify(this.Se),i=new Set(this.e.r.Z().map(o=>o.id));this.Se=te(e,i);let r=JSON.stringify(this.Se)!==t;return r&&(this.et=null),r}Be(){return{...this.Se}}qu(e=this.Me){let t=Object.keys(this.Se).length>0&&this.St(this.Se),i=(e!=null||this.Me!=null)&&this.nt(e);return t||i}nt(e){let t=new Set(this.e.r.Z().map(s=>s.id)),i=H(e,t),r=JSON.stringify(this.Me);this.Me=i,this.e.t.advancedFilterModel=i;let o=JSON.stringify(i)!==r;return o&&(this.et=null),o}Ni(){return H(this.Me)}Mt(e){let t=e!=null&&e.trim()!==""?e:null;return t===this.He?!1:(this.He=t,this.et=null,!0)}Eo(){return this.He}Hi(){return Object.keys(this.Se).length>0||this.Me!=null||this.He!=null}O(){this.Kr(),this.e.$({data:!0})}So(){this.g?this.Ga():this.O()}Kr(){this.et=null;let e=this.e.Ce.start(),t=this.e.r.l(),i=(s,a)=>this.e.d(s,a);if(this.g){this.Yu(e);return}if(this.Xu(e))return;let r,o=[];if(this.M)r=this.Ju(t,i);else{r=this.c,this.Hi()&&!this.e.t.manualFiltering&&(r=r.filter(Bi(t,this.Se,this.Me,this.He,i)));let a=this.e.r.Q();if(a.length>0&&!this.e.t.manualSorting)try{r=_i(r,a,t,i)}catch(d){this.e.reportError(d,"comparator",{sortModel:a})}let l=this.e.r.Je();if(l.length>0){let d=this.Zu(r,l);r=d.rows,o=d.ambiguousExpansions}else if(this.e.t.masterDetail){let d=[];for(let u of r)d.push(u),this.A.has(u.id)&&this.isRowExpandable(u)&&d.push({id:`__detail__${u.id}`,data:u.data,rowIndex:-1,selected:!1,isDetail:!0,masterId:u.id});r=d}}this.Wa(r,e,!0),this.Qu(o)}Wa(e,t,i=!1){for(let o of this.c)o.rowIndex=-1;let r=0;e.forEach((o,s)=>{o.rowIndex=s,!o.isDetail&&!o.isGroup&&this.Fr.set(o,++r)}),this.we=e,this.Vi(),i&&this.ju(),this.ec((o,s)=>this.e.d(o,s)),this.e.emit("modelUpdated",{rowCount:e.length}),this.e.Ce.$a(t)}Yu(e){this.c.forEach((t,i)=>{this.be||(t.rowIndex=i),this.Fr.set(t,this.be?t.rowIndex+1:i+1)}),this.ve=this.c,this.we=this.c,this.Ii.clear(),this.e.t.getRowHeight&&this.e.s.ot(),this.Or++,this.e.emit("modelUpdated",{rowCount:this.c.length}),this.e.Ce.$a(e)}Xu(e){let t=this.bo;return this.bo=!1,!t&&this.za()?(this.tc(e),!0):(this.To(),!1)}za(){if(!this.e.t.dataProcessor||this.c.length<this.e.t.dataProcessorMinRows||this.M||this.e.t.masterDetail||this.e.r.Je().length>0)return!1;let e=!this.e.t.manualFiltering&&this.Hi(),t=!this.e.t.manualSorting&&this.e.r.Q().length>0;return e||t}tc(e){this.To();let t=this.e.t.dataProcessor;if(!t)return;let i=++this.Pi,r=new AbortController;this.Br=r;let o=this.e.r.l(),s=this.c.flatMap(d=>d.data==null?[]:[{id:d.id,data:d.data}]),a=!this.e.t.manualFiltering,l=!this.e.t.manualSorting;Promise.resolve().then(()=>t.process({rows:s,columns:o.map(d=>({colId:d.id,...d.colDef.field?{field:d.colDef.field}:{}})),sortModel:l?this.e.r.Q():[],filterModel:a?this.Be():{},advancedFilterModel:a?this.Ni():null,quickFilterText:a?this.He:null,signal:r.signal})).then(d=>{if(i!==this.Pi||r.signal.aborted||this.e.o())return;let u=new Set,c=[];for(let h of d.rowIds){if(u.has(h))continue;u.add(h);let f=this.p.get(h);f&&!f.isDetail&&!f.isGroup&&c.push(f)}this.Wa(c,e),this.e.$({data:!0})}).catch(d=>{i!==this.Pi||r.signal.aborted||this.e.o()||(this.e.reportError(d,"dataProcessor.process"),this.bo=!0,this.O())}).finally(()=>{i===this.Pi&&(this.Br=null)})}To(){this.Pi++,this.Br?.abort(),this.Br=null}get Te(){return this.e.t.paginationEnabled&&!this.g}Vi(){if(this.e.t.getRowHeight&&this.e.s.ot(),!this.Te){this.ve=this.we,this.Or++;return}let e=this.Bi(),t=this.getPageCount();this.V>t&&(this.V=t),this.V<1&&(this.V=1),this.e.t.paginationPage=this.V;let i=(this.V-1)*e;this.ve=this.e.t.paginationMode==="server"?this.we:this.we.slice(i,i+e),this.ve.forEach((r,o)=>{r.rowIndex=o}),this.Or++}Bi(){return Math.max(1,this.e.t.paginationPageSize)}ei(){return this.Te?this.V:1}getTotalRowCount(){return this.g?this.Gi():this.Te&&this.e.t.paginationMode==="server"?this.e.t.paginationTotal:this.we.length}getPageCount(){return this.Te?Math.max(1,Math.ceil(this.getTotalRowCount()/this.Bi())):1}Ka(){return this.we}setPage(e,t=!1){if(!this.Te)return;let i=this.getPageCount(),r=Math.max(1,Math.min(Math.round(e)||1,i));r!==this.V&&(this.V=r,this.e.t.paginationPage=r,this.Vi(),this.e.$({data:!0}),this.e.s.jr(0,"top"),t||this._i())}setPageSize(e){if(!this.Te)return;let t=Math.max(1,Math.round(e)||this.Bi()),i=(this.V-1)*this.Bi();this.e.t.paginationPageSize=t,this.V=Math.floor(i/t)+1,this.e.t.paginationPage=this.V,this.Vi(),this.e.$({data:!0}),this._i()}Ua(e,t){this.e.t.paginationPageSize=t,this.V=e,this.e.t.paginationPage=this.V}ja(e){this.e.t.paginationEnabled!==e&&(this.e.t.paginationEnabled=e&&!this.g,this.e.t.paginationEnabled&&(this.V=1),e||this.we.forEach((t,i)=>{t.rowIndex=i}),this.Vi(),this.e.$({data:!0}),this._i())}ic(){this.Te&&(this.V=this.e.t.paginationMode==="server"?this.e.t.paginationPage:1,this.Vi(),this.e.$({data:!0}),this._i())}_i(e=this.Bi()){this.e.emit("paginationChanged",{page:this.ei(),pageSize:e,pageCount:this.getPageCount(),total:this.getTotalRowCount()})}Ju(e,t){let i=this.e.t.manualSorting?[]:this.e.r.Q(),r=new Map,o=this.Hi()&&!this.e.t.manualFiltering,s=Bi(e,this.Se,this.Me,this.He,t),a=u=>{let c=r.get(u.id);if(c!==void 0)return c;let h=!0;if(o){h=s(u);for(let f of this.te.get(u.id)??[]){let m=this.p.get(f);m&&a(m)&&(h=!0)}}return r.set(u.id,h),h},l=[],d=u=>{let c=u;i.length>0&&(c=_i(u,i,e,t));for(let h of c)if(a(h)&&(l.push(h),this.A.has(h.id))){let f=(this.te.get(h.id)??[]).map(m=>this.p.get(m)).filter(m=>m!=null);d(f)}};return d(this._),l}rc(){let e=this.Ta,t=0;for(let i of this.ve)!i.isDetail&&!i.isGroup&&(e[t++]=i);return e.length=t,e}nc(e,t,i,r){let o=t.colDef.rowSpan;if(!o)return 1;try{let s=o({api:this.e.api,colDef:t.colDef,column:t,node:e,data:e.data,value:i,rowIndex:e.rowIndex});return Math.max(1,Math.min(Math.round(s)||1,r))}catch(s){return this.e.reportError(s,"rowSpan",{colId:t.id,rowId:e.id}),1}}oc(e,t,i,r,o){if(!i.colDef.autoRowSpan||r==null||r==="")return 1;let s=1;for(;t+s<e.length&&mt(r,o(e[t+s],i))===0;)s++;return s}sc(e,t,i){let r=new Int32Array(e.length),o=0;for(;o<e.length;){let s=e[o],a=i(s,t),l=t.colDef.rowSpan?this.nc(s,t,a,e.length-o):this.oc(e,o,t,a,i);r[o]=l;for(let d=1;d<l;d++)r[o+d]=-1;o+=l}return r}ec(e){if(this.Ii.clear(),this.M||this.e.t.masterDetail||this.e.r.Je().length>0)return;let t=this.e.r.l().filter(r=>r.colDef.rowSpan!=null||r.colDef.autoRowSpan===!0);if(t.length===0)return;let i=this.rc();if(i.length!==0)for(let r of t)this.Ii.set(r.id,this.sc(i,r,e))}ac(e){return this.Ii.get(e)}qa(e){return this.Fr.get(e)??0}Ur(e){return this.Nr.get(e)??0}Zu(e,t){let i=yt(this.e.t.aggFuncs),r=this.e.r.Du();this.Mi=[];let o=l=>{let d={};for(let u of r){let c=i(u.colDef.aggFunc);if(c)try{d[u.id]=tn(l,c,h=>this.e.d(h,u))}catch(h){this.e.reportError(h,"aggFunc",{colId:u.id,aggFunc:u.colDef.aggFunc}),d[u.id]=null}}return d},s=sn(this.z,this.c,t,(l,d)=>this.e.d(l,d));this.z=s.expanded;let a=on(e,t,(l,d)=>this.e.d(l,d),o,this.z);return this.Mi=a.ids,{rows:a.rows,ambiguousExpansions:s.ambiguous}}Qu(e){for(let t of e){if(this.e.o())return;this.e.reportError(new Error(`Ambiguous legacy group expansion: ${t}`),"gridState.groupExpansion",{groupId:t})}}isRowExpandable(e){let t=this.M;if(t){if(this.xo(e.id)||e.treeLoading)return!0;if(e.treeChildrenLoaded||!e.data||!this.e.t.loadTreeChildren)return!1}else if(!this.e.t.masterDetail)return!1;let i=t?"isTreeRowExpandable":"isRowExpandable",r=this.e.t[i];if(!r)return!t;try{return r({data:e.data,node:e,api:this.e.api})}catch(o){return this.e.reportError(o,i,{rowId:e.id}),!1}}isRowExpanded(e){return this.A.has(e)}lc(){return[...this.A]}dc(){return[...this.z]}uc(e,t){this.A=new Set(e.filter(i=>this.p.has(i))),this.z=new Set(t)}cc(e){return this.Mo(e,!0)}hc(e){return this.Mo(e,!1)}qr(e){return this.Mo(e,!this.A.has(e))}Mo(e,t){let i=this.p.get(e);return!i||t&&!this.isRowExpandable(i)?!1:(t===this.A.has(e)||(t?this.A.add(e):this.A.delete(e),this.O(),this.e.emit("detailToggled",{rowId:e,rowNode:i,expanded:t}),t&&this.M&&!this.xo(e)&&!i.treeLoading&&this.loadTreeChildren(e).catch(()=>{})),t)}setAllDetailsExpanded(e){let t=!1;if(e)for(let i of this.c)!this.A.has(i.id)&&this.isRowExpandable(i)&&(this.A.add(i.id),t=!0);else this.A.size>0&&(this.A.clear(),t=!0);t&&this.O()}Io(e){return this.setGroupExpanded(e,!this.z.has(e))}isGroupExpanded(e){return this.z.has(e)}setAllGroupsExpanded(e){let t=this.z.size;if(e)for(let i of this.Mi)this.z.add(i);else this.z.clear();this.z.size!==t&&this.O()}setGroupExpanded(e,t){return!this.Mi.includes(e)||t===this.z.has(e)||(t?this.z.add(e):this.z.delete(e),this.O()),t}Ya(){return!this.M&&!this.g&&!this.e.t.dataProcessor&&this.e.t.paginationMode!=="server"&&this.e.r.Q().length===0&&this.e.r.Je().length===0}Xa(e,t){if(!this.Ya()||!Number.isInteger(e)||!Number.isInteger(t))return!1;let i=this.h(e),r=this.h(t);if(!i||!r||i.isDetail||r.isDetail||i.isGroup||r.isGroup)return!1;let o=this.c.indexOf(i),s=this.c.indexOf(r);return o<0||s<0||o===s?!1:(this.c.splice(o,1),this.c.splice(s,0,i),this.O(),!0)}Oe(){return this.c}pc(){return this._}It(){return this.ve}G(){return this.be?this.Zt():this.ve.length}h(e){return this.be?e<0||e>=this.Zt()?void 0:this.tt.get(e)??this.Lu(e):this.ve[e]}F(e){return this.p.get(e)}fc(e){this.c.forEach(e)}mc(e){let t=0;for(let i of this.we)i.isDetail||i.isGroup||e(i,t++)}};var Tt=class{constructor(e){this.e=e;this.L=new Set;this.At=null;this.zi=new Set}$r(e){return this.L.has(e)}gc(e){return this.zi.has(e)}ze(e,t){if(e.loading)return!1;if(e.isGroup||e.isDetail)return!0;let i=t===void 0?this.Ao():t,r=i?.colDef.selectable;if(!i||!r)return!0;try{return r({api:this.e.api,colDef:i.colDef,column:i,node:e,data:e.data,value:this.e.d(e,i),rowIndex:e.rowIndex})}catch(o){return this.e.reportError(o,"selectable",{rowId:e.id,colId:i.id}),!1}}Ao(){return this.e.r.l().find(e=>e.hasCheckbox&&e.colDef.selectable!=null)}ti(){return this.e.i.Oe().filter(e=>this.L.has(e.id))}Ja(e=this.ti()){return e.filter(t=>t.data!=null).map(t=>t.data)}ko(){return[...this.L]}Za(e){let t=new Set(e),i=this.Ao()??null,r=this.e.i.Oe().filter(o=>t.has(o.id)&&!o.isDetail&&!o.isGroup&&this.ze(o,i)).map(o=>({node:o,selected:!0}));this.kt(r,!0)}yc(){this.Za(this.e.t.rowSelection==="none"?[]:this.ko())}Oa(e){let t=this.e.i;if(!e)this.L.clear(),this.At=null;else{for(let i of this.L)t.F(i)||this.L.delete(i);this.At!=null&&!t.F(this.At)&&(this.At=null)}this.Qa(null);for(let i of t.Oe())i.selected=this.L.has(i.id)}tl(e){let{selectable:t,selected:i}=this.il(e.leafNodes??[],!1);return{all:i>0&&i===t,some:i>0}}vc(e,t){let i=(e.leafNodes??[]).filter(r=>this.ze(r));i.length!==0&&this.kt(i.map(r=>({node:r,selected:t})))}Po(e,t,i=!1){this.kt([{node:e,selected:t,clearOthers:i}])}bc(e,t=!0,i=!0){let r=this.e.i.F(e);r&&this.Po(r,t,i)}wc(e,t,i){if(!i||!t.shiftKey||this.At==null)return!1;let r=this.e.i.F(this.At);if(!r||r.rowIndex<0||e.rowIndex<0)return!1;let o=Math.min(r.rowIndex,e.rowIndex),s=Math.max(r.rowIndex,e.rowIndex),a=[];for(let l=o;l<=s;l++){let d=this.e.i.h(l);d&&!d.isDetail&&!d.isGroup&&a.push({node:d,selected:!0})}return this.kt(a),!0}rl(e,t,i){let r=this.e.t.rowSelection;if(r==="none"||!this.ze(e))return;let o=r==="multiple",s=o&&(i||t.ctrlKey||t.metaKey);!s&&this.wc(e,t,o)||(this.Po(e,!s||!e.selected,!s),this.At=e.id)}selectAll(e=!0){if(this.e.t.rowSelection==="none")return;let i=e?this.e.i.It():this.e.i.Oe();this.kt(i.filter(r=>!r.isDetail&&!r.isGroup).map(r=>({node:r,selected:!0})))}deselectAll(){this.kt([],!0)}Cc(){let e=this.e.i,{selectable:t,selected:i}=this.il(e.It(),!0),r=i>0&&i===t&&(!e.g||t>=e.Gi());return{all:r,some:i>0&&!r}}il(e,t){let i=0,r=0;for(let o of e)t&&(o.isDetail||o.isGroup)||!this.ze(o)||(i++,this.L.has(o.id)&&r++);return{selectable:i,selected:r}}Tc(e,t){let i=this.e.i,r=this.e.t.rowSelection==="single",o=!r&&i.M&&this.e.t.autoCheckedChildren,s=(a,l,d=!1)=>{if(l?(d||this.ze(a,t))&&this.L.add(a.id):this.L.delete(a.id),!!o)for(let u of i.Fi(a.id)){let c=i.F(u);c&&s(c,l)}};for(let{node:a,selected:l}of e)if(s(a,l,!0),r&&l)break}Dc(e){let t=new Set(e);for(let i of this.L)t.delete(i)||t.add(i);return t}xc(e){let t=[];for(let i of this.e.i.Oe()){let r=this.L.has(i.id);(i.selected!==r||e.has(i.id)||this.zi.has(i.id))&&i.rowIndex>=0&&t.push(i.rowIndex),i.selected=r}return t}kt(e,t=!1){let i=this.e.t.rowSelection,r=this.Ao()??null,o=e.filter(u=>!u.selected||i!=="none"&&this.ze(u.node,r));if(e.length>0&&o.length===0)return;let s=new Set(this.L);(t||o.some(u=>u.selected?i==="single"||u.clearOthers:u.clearOthers&&this.ze(u.node,r)))&&this.L.clear(),this.Tc(o,r);let a=new Set(this.zi);this.Qa(r);let l=this.Dc(s),d=this.xc(a);if(l.size>0){this.e.s.O(d),this.e.W.Wr();let u=this.ti();this.e.emit("selectionChanged",{selectedNodes:u,selectedRows:this.Ja(u)})}}Qa(e){this.zi.clear();let t=this.e.i;if(this.e.t.rowSelection!=="multiple"||!t.M||this.L.size===0)return;let i=r=>{let o=e&&t.F(r),s=!o||this.ze(o,e),a=!0,l=!1;for(let d of t.Fi(r)){let u=i(d);a&&(a=u.all),l||(l=u.some)}if(a&&!l){s||this.L.delete(r);let d=this.L.has(r);return{all:d||!s,some:d}}return s&&a?this.L.add(r):(this.L.delete(r),s&&l&&this.zi.add(r)),{all:a,some:l}};for(let r of t.pc())i(r.id)}};var Dt=class{constructor(e){this.e=e;this.Pt=null;this.ie=0;this.st=0;this.We=null;this.ii=null;this.Wi=e=>{let t=this.No(e);t&&(this.st=this.sl(t,e.clientX),t.didResize||(t.didResize=Math.abs(this.st-t.startWidth)>=.5),!this.ie&&(this.ie=requestAnimationFrame(()=>{this.ie=0,this.Sc()})))};this.ni=e=>{let t=this.No(e);t&&(this.st=this.sl(t,e.clientX),t.didResize||(t.didResize=Math.abs(this.st-t.startWidth)>=.5),this.Mc(t))};this.Yr=e=>{this.No(e)&&this.at()};this.Ic=()=>{this.at()};this.Fo=e=>{e.key==="Escape"&&(e.preventDefault(),this.at())}}Rc(e,t){if(!this.e.t.enableColumnResize||!t.resizable||e.isPrimary===!1)return;this.at();let i=e.currentTarget,r=t.currentWidth;this.st=r,this.Pt={column:t,didResize:!1,handle:i,pointerId:e.pointerId,startFlex:t.flex,startManualWidth:t.manualWidth,startWidth:r,startX:e.clientX,startPreserveWidths:this.e.r.Xe},this.Go(i,!0);try{i.setPointerCapture?.(e.pointerId)}catch{}this.e.n.root.classList.add("mach-root--resizing"),i.classList.add("mach-header-resize--active"),this.Ec(this.Pt)}at(e=!0){let t=this.Pt;t&&(this.Pt=null,this.Lo(),this.Go(t.handle,!1),e&&(this.nl(t),this.e.ri()),this.e.n.root.classList.remove("mach-root--resizing"),this.ol(t))}nl(e){e.column.manualWidth=e.startManualWidth,e.column.flex=e.startFlex,e.column.currentWidth=e.startWidth,this.e.r.Xe=e.startPreserveWidths}Mc(e){this.Pt=null,this.Lo(),e.didResize&&(Math.abs(this.st-e.startWidth)<.5?this.nl(e):this.e.r.Ee(e.column,this.st),this.e.ri()),this.Go(e.handle,!1);try{e.handle.releasePointerCapture?.(e.pointerId)}catch{}this.e.n.root.classList.remove("mach-root--resizing"),this.ol(e),e.didResize&&this.e.lt([e.column])}Sc(){let e=this.Pt;!e?.didResize||!this.e.r.Ee(e.column,this.st)||(this.e.ri(),this.$i(e),this.e.al(e.column,!1))}Ec(e){this.We=p("div","mach-column-resize-guide"),this.We.setAttribute("aria-hidden","true"),this.ii=p("span","mach-column-resize-label"),this.We.appendChild(this.ii),this.e.n.root.appendChild(this.We),this.$i(e)}$i(e){if(!this.We||!this.ii)return;let t=this.e.n.root,i=t.getBoundingClientRect(),r=e.handle.parentElement.getBoundingClientRect(),o=Math.max(0,Math.min(t.clientWidth,r.right-i.left-t.clientLeft)),s=Math.max(32,Math.min(t.clientWidth-32,o));this.We.style.left=`${o}px`,this.We.style.top=`${Math.max(0,r.top-i.top-t.clientTop)}px`,this.ii.style.left=`${s-o}px`,this.ii.textContent=`${Math.round(e.column.currentWidth)} px`}ol(e){e.handle.classList.remove("mach-header-resize--active"),this.We?.remove(),this.We=null,this.ii=null}sl(e,t){let i=Number.isFinite(t)?t:e.startX;return j(Math.max(1,e.startWidth+i-e.startX),{minWidth:e.column.minWidth??e.column.colDef.minWidth,maxWidth:e.column.colDef.maxWidth})}No(e){let t=this.Pt;return t&&e.pointerId===t.pointerId?t:null}Lo(){this.ie&&cancelAnimationFrame(this.ie),this.ie=0}Go(e,t){S(window,t,{pointermove:this.Wi}),S(window,t,{pointerup:this.ni,pointercancel:this.Yr,keydown:this.Fo},!0),S(e,t,{lostpointercapture:this.Ic})}destroy(){this.at(!1),this.Lo(),this.e.n.root?.classList.remove("mach-root--resizing")}};var cn=6,xt=class{constructor(e){this.e=e;this.Ki=null;this.oi=null;this.Oo=!1;this.se=0;this.Xr=null;this.Wi=e=>{if(this.oi){this.Pc(e);return}let t=this.Ki;t&&(Math.abs(e.clientX-t.startX)<cn&&Math.abs(e.clientY-t.startY)<cn||this.Gc(e))};this.ni=e=>{this.Ki=null,e.type!=="pointercancel"&&this.oi&&this.Vo(e.clientX,e.clientY),this.Ho();let t=this.ll();t&&e.type!=="pointercancel"&&t.targetIndex>=0&&this.e.Ei(t.column.id,t.targetIndex)}}Ac(e,t){e.button===0&&t.movable&&(this.Ki={column:t,startX:e.clientX,startY:e.clientY},this.Ui(!0))}Ui(e){S(window,e,{pointermove:this.Wi,pointerup:this.ni,pointercancel:this.ni})}kc(){let e=this.Oo;return this.Oo=!1,e}Gc(e){let t=this.Ki;if(!t)return;let i=this.e.W.Gt(t.column.id,this.e.r.ge(t.column));if(!i||!i.parentElement){this.Ho();return}this.Oo=!0;let r=p("div","mach-drop-indicator"),o=p("div","mach-column-drag-ghost");o.textContent=t.column.colDef.headerName??t.column.colDef.field??t.column.id,o.ariaHidden="true",A(o,this.e.n.root),document.body.appendChild(o),i.parentElement.appendChild(r),i.classList.add("mach-header-cell--dragging"),this.e.n.root.classList.add("mach-root--dragging");let s=this.e.r.ge(t.column),a=this.e.n.si[s],l=this.e.r.R(s),d=new Float64Array(l.length+1),u=new Float64Array(l.length);for(let h=0;h<l.length;h++){let f=l[h].currentWidth;u[h]=d[h]+f/2,d[h+1]=d[h]+f}let c=o.getBoundingClientRect();this.oi={column:t.column,cellEl:i,ghost:o,indicator:r,targetIndex:-1,pane:s,containerLeft:a.getBoundingClientRect().left,startScrollLeft:this.e.n.b.center.scrollLeft,fromIndex:l.indexOf(t.column),midpoints:u,offsets:d,ghostWidth:c.width,ghostHeight:c.height},this.Vo(e.clientX,e.clientY)}Pc(e){this.Xr={clientX:e.clientX,clientY:e.clientY},!this.se&&(this.se=requestAnimationFrame(()=>{this.se=0;let t=this.Xr;this.Xr=null,t&&this.Vo(t.clientX,t.clientY)}))}Vo(e,t){let i=this.oi;if(!i)return;let r=T(e+12,8,window.innerWidth-i.ghostWidth-8),o=T(t+12,8,window.innerHeight-i.ghostHeight-8);i.ghost.style.transform=`translate3d(${r}px, ${o}px, 0)`;let s=i.pane==="center"?this.e.n.b.center.scrollLeft-i.startScrollLeft:0,a=e-(i.containerLeft-s),l=i.midpoints.length;for(let d=0;d<i.midpoints.length;d++)if(a<i.midpoints[d]){l=d;break}i.targetIndex=l>i.fromIndex?l-1:l,i.indicator.style.transform=`translate3d(${i.offsets[l]}px, 0, 0)`}ll(){let e=this.oi;return e?(this.oi=null,e.cellEl.classList.remove("mach-header-cell--dragging"),e.ghost.remove(),e.indicator.remove(),this.e.n.root.classList.remove("mach-root--dragging"),e):null}Ho(){this.Ui(!1),this.se&&cancelAnimationFrame(this.se),this.se=0,this.Xr=null}destroy(){this.Ho(),this.ll(),this.Ki=null}};var Wi=/^[+-]?(?:\d+(?:\.\d+)?|\.\d+)(?:[eE][+-]?\d+)?$/;function Rt(n,e=!0){if(n==="")return null;if(!e||typeof n!="string"||!Wi.test(n)||/^[+-]?0\d/.test(n))return n;let t=Number(n);return Number.isFinite(t)&&(!Number.isInteger(t)||Number.isSafeInteger(t))?t:n}function $i(n,e){let t=n==null?"":String(n);return t.includes(e)||t.includes('"')||t.includes(`
|
|
1
|
+
"use strict";var yi=Object.defineProperty;var Ro=Object.getOwnPropertyDescriptor;var Eo=Object.getOwnPropertyNames;var So=Object.prototype.hasOwnProperty;var Mo=(n,e)=>{for(var t in e)yi(n,t,{get:e[t],enumerable:!0})},Io=(n,e,t,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of Eo(e))!So.call(n,r)&&r!==t&&yi(n,r,{get:()=>e[r],enumerable:!(i=Ro(e,r))||i.enumerable});return n};var Ao=n=>Io(yi({},"__esModule",{value:!0}),n);var il={};Mo(il,{BUILTIN_AGG_FUNCS:()=>Be,DEFAULT_LOCALE:()=>V,EVENT_TYPES:()=>Ut,LOCALE_EN:()=>Lr,actionsColumn:()=>Wr,advancedFilterCondition:()=>xr,advancedFilterGroup:()=>Rr,applyGridViewState:()=>hr,buildColDefsFromSchema:()=>ao,captureGridViewState:()=>cr,clearGridState:()=>Zn,createActionButtonsRenderer:()=>xe,createAggResolver:()=>yt,createBusinessColumnTypes:()=>bo,createColumnHelper:()=>uo,createEnterprisePreset:()=>fo,createGrid:()=>no,createGridViewManager:()=>Do,createLocalGridStateStore:()=>sr,createLocalGridViewStore:()=>pr,createMachTableCommands:()=>lo,createMachTablePreset:()=>ur,createProgressBarRenderer:()=>Pi,createRemoteExportRequest:()=>oo,createRowActionsRenderer:()=>ct,createStatusTagRenderer:()=>ki,defineColumns:()=>co,defineGridOptions:()=>go,defineMachTableConfig:()=>yo,defineMachTablePreset:()=>mo,describeFilter:()=>Xt,downloadFile:()=>Kt,dragColumn:()=>zr,escapeHtml:()=>fe,formatText:()=>W,formatTwo:()=>Te,getByPath:()=>z,indexColumn:()=>ht,isColDefGroup:()=>Ce,isSafePath:()=>nt,linkRenderer:()=>Gi,loadGridState:()=>di,matchLocaleKey:()=>lt,normalizeAdvancedFilterModel:()=>H,normalizeColumnFilter:()=>ot,normalizeFilterModel:()=>te,normalizeGridState:()=>q,normalizeGridViewState:()=>gi,normalizeSavedGridView:()=>Ae,parseCsv:()=>Mt,parseDelimited:()=>It,parseTsv:()=>St,resolveGridFeatures:()=>hi,resolveSaveConflict:()=>Gn,resolveTagVariant:()=>dt,rowActionsColumn:()=>$r,sanitizeFormulaCell:()=>ce,saveGridState:()=>li,selectionColumn:()=>_r,setByPath:()=>ve,toTsv:()=>Et,validateGridOptions:()=>ui,version:()=>tl});module.exports=Ao(il);var qe="0.42.2";function v(n,e){return Object.prototype.hasOwnProperty.call(n,e)}function x(n,e,t=!1){if(!(typeof n!="number"||!Number.isFinite(n)||n<e))return t?Math.floor(n):n}function E(n,e,t,i=!1){return x(n,t,i)??e}function I(n){return x(n,0)||void 0}function Ye(n){return!n||typeof n.key!="string"||!n.key.trim()?null:{key:n.key.trim(),debounceMs:x(n.debounceMs,0,!0)??160,...n.sections?{sections:[...new Set(n.sections)]}:{},...n.store?{store:n.store}:{}}}function R(n,e,t,i=!1){let r=!1;for(let o of t)(i?v(n,o):n[o]!=null)&&(e[o]=n[o],r=!0);return r}var vi=new WeakMap,Xe=new WeakMap;function Pe(n){let e=vi.get(n);return e||(e={},vi.set(n,e)),e}function bi(n){return vi.get(n)}function Je(n,e){e?Xe.set(n,e):Xe.delete(n)}function Ze(n){let e=Xe.get(n);return Xe.delete(n),e}function p(n,e,t){let i=document.createElement(n);if(e&&(i.className=e),t)for(let r of Object.keys(t))i.setAttribute(r,t[r]);return i}function U(n,e,t){let i=p("button",n);return i.type="button",i.textContent=e,i.addEventListener("click",t),i}function S(n,e,t,i=!1){let r=e?"addEventListener":"removeEventListener";for(let[o,s]of Object.entries(t))n[r](o,s,i)}function _(n,e,t){S(document,n,{mousedown:e,keydown:t},!0)}function A(n,e){if(n.classList.add("mach-portal"),!e)return;let t=window.getComputedStyle(e);for(let i=0;i<t.length;i++){let r=t.item(i);if(!r.startsWith("--mach-"))continue;let o=t.getPropertyValue(r).trim();o&&n.style.setProperty(r,o)}n.style.colorScheme=t.colorScheme}function T(n,e,t){return n<e?e:n>t?t:n}function ee(n,e,t=4){let i=e.getBoundingClientRect(),r=n.getBoundingClientRect(),o=i.bottom+t,s=o+r.height>window.innerHeight-8?i.top-r.height-t:o;n.style.left=`${T(i.left,8,Math.max(8,window.innerWidth-r.width-8))}px`,n.style.top=`${T(s,8,Math.max(8,window.innerHeight-r.height-8))}px`}var gr=0;function yr(n="rg"){return gr++,`${n}-${gr}`}var vr='<svg viewBox="0 0 16 16" width="12" height="12" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><path d="M2 3.5h12L9.5 8v4.5L6.5 14V8L2 3.5z"/></svg>',br='<svg viewBox="0 0 16 16" width="10" height="10" fill="currentColor"><path d="M8 3l4 5H4l4-5z"/></svg>',wr='<svg viewBox="0 0 16 16" width="10" height="10" fill="currentColor"><path d="M8 13l4-5H4l4 5z"/></svg>',Cr='<svg viewBox="0 0 16 16" width="12" height="12" fill="none" stroke="currentColor" stroke-width="1.35" stroke-linecap="round"><path d="M2 4h3m3 0h6M2 8h7m3 0h2M2 12h1m3 0h8"/><circle cx="6.5" cy="4" r="1.35"/><circle cx="10.5" cy="8" r="1.35"/><circle cx="4.5" cy="12" r="1.35"/></svg>';function ge(n,e,t,i,r=e.rowIndex){return{api:n.api,colDef:t.colDef,column:t,node:e,data:e.data,value:i,rowIndex:r}}function wi(n){if(n==null)return"";if(n instanceof Date)return n.toLocaleDateString();if(typeof n=="object")try{return JSON.stringify(n)}catch{return String(n)}return String(n)}function L(n,e){let t=bi(e);if(!t)return;t.flashTimer&&clearTimeout(t.flashTimer),t.flashTimer=void 0;let i=t.destroy;if(t.destroy=void 0,t.refresh=void 0,t.rendererDefinition=void 0,t.rendererRowId=void 0,t.rendererColumnId=void 0,!!i)try{i()}catch(r){n.reportError(r,"cellRenderer.destroy",{colId:e.dataset.colId})}}function Tr(n,e,t,i,r,o){let s=n.t.tooltipComponent?"":o,a=i.colDef.tooltipValueGetter;if(a)try{s=a({api:n.api,colDef:i.colDef,column:i,node:t,data:t.data,value:r})??o}catch(l){n.reportError(l,"tooltipValueGetter",{colId:i.id,rowId:t.id})}s?e.setAttribute("title",s):e.removeAttribute("title")}function Po(n,e,t,i,r,o){let s=bi(e);if(!s?.refresh||s.rendererDefinition!==r||s.rendererRowId!==t.id||s.rendererColumnId!==i.id)return!1;try{return e.querySelector(":scope > .mach-cell-edit-trigger")?.remove(),s.refresh(o)!==!1}catch(a){return n.reportError(a,"cellRenderer.refresh",{colId:i.id,rowId:t.id}),!1}}function ye(n,e,t){return Y(n,e,t,n.d(e,t))}function Y(n,e,t,i){let r=t.colDef.valueFormatter;if(r)try{let o=r({api:n.api,colDef:t.colDef,column:t,node:e,data:e.data,value:i});return o==null?"":String(o)}catch(o){n.reportError(o,"valueFormatter",{colId:t.id,rowId:e.id})}return wi(i)}function Go(n,e,t,i){let r=i.colDef.cellStyle,o=Pe(e),s=o.styleKeys;if(s)for(let d of s)Reflect.set(e.style,d,"");if(!r){o.styleKeys=void 0;return}let a;if(typeof r=="function"){let d=n.d(t,i);try{a=r(ge(n,t,i,d))}catch(u){n.reportError(u,"cellStyle",{colId:i.id,rowId:t.id}),a=null}}else a=r;if(!a){o.styleKeys=void 0;return}let l=Object.keys(a);for(let d of l)Reflect.set(e.style,d,Reflect.get(a,d));o.styleKeys=l}function Lo(n,e){let t=n.firstElementChild,i=t?.className==="mach-cell-text"?t:p("span","mach-cell-text");i.textContent!==e&&(i.textContent=e),n.replaceChildren(i)}function No(n,e,t,i){let r=n.d(t,i),o=Y(n,t,i,r),s=i.colDef.cellRenderer,a=typeof s=="string"?n.mu(s):s,l=o;if(a){let d={api:n.api,colDef:i.colDef,column:i,node:t,data:t.data,value:r,formatted:o,rowIndex:t.rowIndex,rendererParams:i.colDef.cellRendererParams};if(Po(n,e,t,i,a,d)){Tr(n,e,t,i,r,o);return}L(n,e);try{l=a(d)}catch(u){n.reportError(u,"cellRenderer",{colId:i.id,rowId:t.id})}}else L(n,e);if(typeof l=="string")Lo(e,l);else if(l instanceof HTMLElement)e.replaceChildren(l);else if(l&&typeof l=="object"&&l.el instanceof HTMLElement){let d=l;e.replaceChildren(d.el);let u=Pe(e);u.destroy=d.destroy,d.refresh&&(u.refresh=c=>d.refresh(c),u.rendererDefinition=a,u.rendererRowId=t.id,u.rendererColumnId=i.id)}else e.textContent="";Tr(n,e,t,i,r,o)}function Qe(n){let{align:e}=n.colDef;return e==="left"?"mach-cell--left":e==="right"?"mach-cell--right":"mach-cell--center"}function Fo(n,e,t,i){let r=i.colDef.cellClass;if(!r)return;if(typeof r=="string"){e.push(r);return}if(Array.isArray(r)){e.push(...r);return}let o=ge(n,t,i,n.d(t,i));try{let s=r(o);typeof s=="string"?e.push(s):Array.isArray(s)&&e.push(...s)}catch(s){n.reportError(s,"cellClass",{colId:i.id,rowId:t.id})}}function Oo(n,e,t){e.classList.contains("mach-cell--focus")&&n.push("mach-cell--focus"),e.classList.contains("mach-cell--editing")&&n.push("mach-cell--editing"),t.colDef.wrapText&&n.push("mach-cell--wrap")}function Ci(n,e,t,i){let r=["mach-cell",Qe(i)];Fo(n,r,t,i),Oo(r,e,i);let o=r.join(" ");e.className!==o&&(e.className=o)}function et(n,e,t,i){No(n,e,t,i),Ci(n,e,t,i),Go(n,e,t,i)}function Ge(n,e){return n&&v(n,e)?n[e]:void 0}function tt(n,e){if(n==null||n===""||!e||typeof e!="object")return;let t=Ge(e,String(n));return typeof t=="string"?{color:t}:t}var it=class{constructor(e){this.e=e;this.to="";this.ro=[];this.la=0;this.xi=!0}no(e){this.gu()&&(this.xi=!0,e=void 0);let t=this.xi?this.da():void 0,i=t&&Vo(t,e),r=e?.columns&&new Set(e.columns),o=!1;for(let s of this.e.r.l()){if(s.minWidth!=null&&(!i||r&&!r.has(s.id)))continue;let a=this.yu(s);if(o=s.minWidth!==a||o,s.minWidth=a,Ho(s)){let l=this.ua(s,t);o=l!==s.contentWidth||o,s.contentWidth=l}}return this.xi=!1,o&&(this.e.r.Xe=!1),o}gu(){let e=Array.from(document.fonts??[]).filter(s=>s.status==="loaded"),t=e.length!==this.ro.length||e.some((s,a)=>s!==this.ro[a]);t&&(this.ro=e,this.la++);let i=getComputedStyle(this.e.n.root),r=`${i.getPropertyValue("--mach-header-font-weight")||650} ${i.fontSize} ${i.fontFamily}`,o=r!==this.to||t;return this.to=r,o}da(){let e=this.e.i.Oe(),t=Math.min(e.length,100);return Array.from({length:t},(i,r)=>e[Math.floor(r*(e.length-1)/Math.max(t-1,1))])}oo(e,t){return this.Di===void 0&&(this.Di=p("canvas").getContext("2d")),this.Di?(this.Di.font=t??this.to,this.Di.measureText(e).width):t?1/0:e.replace(/[^\x00-\xff]/g,"mm").length*7}yu(e){let t=e.colDef,i=t.headerName??t.field??e.id;return Math.ceil(Math.max(t.minWidth??0,this.oo(i)+i.length*.15+28+(e.sortable?20:0)+(e.filterable?28:0)+(this.e.t.columnMenu&&!e.hasCheckbox&&!t.suppressColumnMenu?22:0)))}ua(e,t=this.da()){let i=28;for(let r of t){let o=this.e.d(r,e),s=tt(o,e.colDef.status)?.label??Y(this.e,r,e,o);i=Math.max(i,this.oo(s.slice(0,128))+(e.colDef.status?44:28))}return Math.ceil(Math.min(I(e.colDef.maxWidth)??360,i))}};function Ho(n){let{width:e,autoWidth:t}=n.colDef;return n.manualWidth==null&&e==null&&t!==!1&&!n.hasCheckbox&&!n.isDetailToggle}function Vo(n,e){if(!e?.rowIds&&!e?.rowIndexes)return!0;let t=new Set(e.rowIds),i=new Set(e.rowIndexes);return n.some(r=>t.has(r.id)||i.has(r.rowIndex))}var rt=class{constructor(e){this.vu=e;this.xr=new Map}on(e,t){let i=this.xr.get(e);return i||(i=new Set,this.xr.set(e,i)),i.add(t),()=>{i.delete(t)}}emit(e,t){let i=this.xr.get(e);if(i)for(let r of[...i])try{r(t)}catch(o){console.error(`[mach-table] error in "${e}" listener`,o),this.vu?.(o,e)}}clear(){this.xr.clear()}};var Bo=new Set(["__proto__","prototype","constructor"]),Le=new Map;function Ti(n){if(typeof n!="string"||n.length===0)return null;let e=Le.get(n);if(e!==void 0)return e;let t=n.split("."),i=t.every(r=>r.length>0&&!Bo.has(r))?t:null;return n.length<=1024&&(Le.size>=256&&Le.delete(Le.keys().next().value),Le.set(n,i)),i}function nt(n){return Ti(n)!==null}function z(n,e){if(n==null)return;let t=Ti(e);if(!t)return;let i=n;for(let r of t){if(i==null)return;i=i[r]}return i}function ve(n,e,t){if(n==null)return!1;let i=Ti(e);if(!i)return!1;let r=n;for(let o=0;o<i.length-1;o++){if(typeof r!="object"&&typeof r!="function"||r===null)return!1;r[i[o]]==null&&(r[i[o]]={}),r=r[i[o]]}return typeof r!="object"&&typeof r!="function"||r===null?!1:(r[i[i.length-1]]=t,!0)}var be={text:["contains","notContains","equals","notEquals","startsWith","endsWith","blank","notBlank"],number:["equals","notEquals","lessThan","lessThanOrEqual","greaterThan","greaterThanOrEqual","inRange","blank","notBlank"],date:["equals","notEquals","lessThan","greaterThan","inRange","blank","notBlank"]};var _o=16,zo=512,Wo=20,$o=2e3,Ko=2e3,Uo={text:new Set(be.text),number:new Set(be.number),date:new Set(be.date)};function jo(n){return n==null||typeof n=="string"||typeof n=="number"&&Number.isFinite(n)}function qo(n,e,t){if(n==null||typeof n!="object")return null;let i=n;return typeof i.match!="string"||!t.has(i.match)?null:{match:i.match,...Yo(i,e)}}function Yo(n,e){let t=e==="number"?x(n.value,-1/0):typeof n.value=="string"?n.value:void 0,i=e==="number"?x(n.value2,-1/0):typeof n.value2=="string"?n.value2:void 0;return{...t!==void 0?{value:t}:{},...i!==void 0?{value2:i}:{}}}function Xo(n,e){let t=[],i=Uo[e];for(let r of n.slice(0,Wo)){let o=qo(r,e,i);o&&t.push(o)}return t}function ot(n){if(n==null||typeof n!="object")return null;let e=n;return e.type==="set"?Array.isArray(e.values)?{type:"set",values:e.values.filter(jo).slice(0,$o)}:null:e.type!=="text"&&e.type!=="number"&&e.type!=="date"||!Array.isArray(e.conditions)?null:{type:e.type,...e.operator==="or"||e.operator==="and"?{operator:e.operator}:{},conditions:Xo(e.conditions,e.type)}}function Jo(n,e){if(typeof n.colId!="string"||!n.colId.trim())return null;let t=n.colId.trim();if(e.validColumnIds?.has(t)===!1)return null;let i=ot(n.filter);return i?{kind:"condition",colId:t,filter:i}:null}function Zo(n,e,t){if(!Array.isArray(n.children))return null;let i=[];for(let r of n.children){let o=Dr(r,e+1,t);o&&i.push(o)}return i.length===0?null:{kind:"group",operator:n.operator==="or"?"or":"and",children:i,...n.not===!0?{not:!0}:{}}}function Qo(n,e,t){return e<=_o&&t.nodes<zo&&n!=null&&typeof n=="object"}function Dr(n,e,t){if(!Qo(n,e,t)||t.ancestors.has(n))return null;t.ancestors.add(n),t.nodes++;let i=n,r=i.kind==="condition"?Jo(i,t):i.kind==="group"?Zo(i,e,t):null;return t.ancestors.delete(n),r}function H(n,e){if(n==null||typeof n!="object")return null;let t=n;if(t.version!==1||t.root==null)return null;let i=Dr(t.root,0,{ancestors:new WeakSet,nodes:0,validColumnIds:e});return i?{version:1,root:i}:null}function xr(n,e){return{kind:"condition",colId:n,filter:e}}function te(n,e){if(n==null||typeof n!="object"||Array.isArray(n))return{};let t={};for(let[i,r]of Object.entries(n).slice(0,Ko)){let o=i.trim();if(!o||e?.has(o)===!1)continue;let s=ot(r);s&&(t[o]=s)}return t}function Rr(n,e,t={}){return{kind:"group",operator:n,children:e,...t.not?{not:!0}:{}}}var Di={align:"center",sortable:!0,resizable:!0,movable:!0,filter:!1,minWidth:80},Ne={compact:{rowHeight:30,headerHeight:34,fontSize:12,cellPadding:6},normal:{rowHeight:36,headerHeight:40,fontSize:13,cellPadding:9},large:{rowHeight:44,headerHeight:48,fontSize:14,cellPadding:12}},Fe={multiSort:!0,stripedRows:!1,showCellBorders:!1,quickFilterText:null,suppressCellFocus:!1,suppressRowHoverHighlight:!1,suppressNoRowsOverlay:!1,suppressHeaderFocus:!1,loading:!1,error:null,className:"",singleClickEdit:!1,manualSorting:!1,manualFiltering:!1,showSummary:!1,rowNumber:!1,indexOffset:0,applyRowDrag:!0,masterDetail:!1,detailToggleColumn:!0,treeData:!1,childrenKey:"children",autoCheckedChildren:!0,defaultExpandAll:!1,columnMenu:!1,suppressWarnings:!1,enableRangeSelection:!1,suppressClipboard:!1,contextMenu:!1,flashCells:!0,fillHandle:!0,ariaLabel:"MachTable data grid",ariaLabelledBy:"",ariaDescribedBy:"",overlayNoRowsTemplate:"",overlayLoadingTemplate:"",overlayErrorTemplate:"",allowUnsafeOverlayHtml:!1},es=Object.keys(Fe);function ts(n){let e={};for(let t of es)e[t]=n[t]??Fe[t];return e}function is(n){return n&&v(Ne,n)?n:"normal"}function rs(n,e){let t=typeof n.pagination=="object"&&Array.isArray(n.pagination?.pageSizeOptions)?n.pagination.pageSizeOptions:void 0,i=t?[...new Set(t.map(r=>E(r,0,1,!0)).filter(Boolean))]:[10,20,50,100];return i.includes(e)||i.push(e),i.sort((r,o)=>r-o)}function xi(n,e){let t=typeof n=="function"?n(e):z(e,n);return t==null?"":String(t)}function ns(n,e){let t=Ne[e],i=n.rowKey;return{columnDefs:Array.isArray(n.columnDefs)?n.columnDefs:[],rowData:Array.isArray(n.rowData)?n.rowData:[],defaultColDef:{...Di,...n.defaultColDef??{}},columnTypes:n.columnTypes??{},...i?{resolveRowId:({data:r})=>xi(i,r),rowKey:i}:{},rowHeight:E(n.rowHeight,t.rowHeight,1),detailRowHeight:E(n.detailRowHeight,240,1),headerHeight:E(n.headerHeight,t.headerHeight,1),rowBuffer:E(n.rowBuffer,8,0,!0),columnLayout:n.columnLayout==="fit"||n.columnLayout==="normal"?n.columnLayout:"auto",enableColumnResize:n.enableColumnResize===!0,domLayout:n.domLayout==="autoHeight"?"autoHeight":"normal",maxBodyHeight:x(n.maxBodyHeight,1),rowSelection:n.rowSelection==="single"||n.rowSelection==="multiple"?n.rowSelection:"none",size:e,pinnedTopRowData:Array.isArray(n.pinnedTopRowData)?n.pinnedTopRowData:[],pinnedBottomRowData:Array.isArray(n.pinnedBottomRowData)?n.pinnedBottomRowData:[]}}function os(n){let e=typeof n.pagination=="object"?n.pagination:void 0,t=E(e?.pageSize,20,1,!0);return{paginationEnabled:n.pagination!==!1&&n.datasource==null,paginationMode:e?.mode==="server"?"server":"client",paginationPage:E(e?.page,1,1,!0),paginationTotal:E(e?.total,0,0,!0),paginationPageSize:t,paginationPageSizeOptions:rs(n,t),paginationShowTotal:e?e.showTotal!==!1:!0,paginationShowSizeSelector:e?e.showPageSizeSelector!==!1:!0}}function Ri(n){let e=n.watermark==null||n.watermark===!1?null:n.watermark===!0?{text:"MachTable"}:n.watermark;return{watermarkEnabled:e!==null,watermarkConfig:e}}function ss(n){return{advancedFilterModel:H(n.advancedFilterModel),persistence:Ye(n.persistence),locale:n.locale??{},tooltipShowDelay:E(n.tooltipShowDelay,600,0),statusBarEnabled:n.statusBar===!0||typeof n.statusBar=="object"&&n.statusBar!=null,statusBarPanels:typeof n.statusBar=="object"&&n.statusBar?.panels?n.statusBar.panels:["rowCount","selectedRowCount","rangeAggregate"]}}var Sr={blockSize:100,maxBlocksInCache:12,datasourceMaxConcurrentRequests:4},Mr={infiniteBufferRows:40,blockPrefetch:1,datasourceRetryCount:2,datasourceRetryDelay:300},as=Object.keys(Sr),ls=Object.keys(Mr);function Er(n,e,t,i){let r=!1;for(let o of t){let s=x(n[o],i,!0);s===void 0||s===e[o]||(e[o]=s,r=!0)}return r}function Ei(n,e){let t=Er(n,e,as,1);Er(n,e,ls,0);let i=x(n.datasourceRetryJitter,0);return i!==void 0&&(e.datasourceRetryJitter=Math.min(1,i)),t}function ds(n){let e={...Sr,...Mr,datasourceRetryJitter:.15};return Ei(n,e),{...e,datasourceMode:n.datasourceMode==="block"?"block":"sequential",datasourceRowCount:n.datasourceRowCount==null?null:E(n.datasourceRowCount,0,0,!0),dataProcessorMinRows:E(n.dataProcessorMinRows,5e3,1,!0)}}var us=["detailRowRenderer","isRowExpandable","aggFuncs","components","actionPolicy","summaryMethod","datasource","getRowHeight","tooltipComponent","getContextMenuItems","initialState","rowEditValidator","isTreeRowExpandable","loadTreeChildren","dataProcessor"];function Ir(n){let e=is(n.size),t={...ts(n),...ns(n,e),rowStyleRules:Array.isArray(n.rowStyleRules)?n.rowStyleRules:[],theme:n.theme==="dark"||n.theme==="auto"?n.theme:"light",editType:n.editType==="fullRow"?"fullRow":"cell",editableIndicator:n.editableIndicator==="always"||n.editableIndicator==="none"?n.editableIndicator:"hover",rowDragPolicy:n.rowDragPolicy,undoStackSize:E(n.undoStackSize,100,0,!0),asyncTransactionWaitMillis:E(n.asyncTransactionWaitMillis,16,0,!0),...os(n),...Ri(n),...ss(n),...ds(n),features:Array.isArray(n.features)?n.features:[]};for(let i of us)n[i]&&Reflect.set(t,i,n[i]);for(let i of Object.keys(n))i.startsWith("on")&&typeof n[i]=="function"&&Reflect.set(t,i,n[i]);return t}function Ar(n){return Array.isArray(n)?n.filter(e=>typeof e=="string"&&e.length>0):typeof n=="string"&&n.length>0?[n]:[]}function we(n,e){return Ar(n.type).includes(e)}function kr(n,e,t={}){let i=n.checkboxSelection||n.rowDrag||we(n,"index")?{resizable:!1,suppressSizeToFit:!0}:{};for(let o of Ar(n.type)){o==="rightAligned"&&(i.align="right");let s=t[o];s&&Object.assign(i,s)}let r={...e,...i,...n};return r.align??(r.align=e.align??"center"),r.status&&!r.cellRenderer&&(r.cellRenderer="statusTag"),r}var ie=class{constructor(e,t){this.manualWidth=null;this.contentWidth=null;this.flex=null;this.currentWidth=0;this.parentGroup=null;this.level=0;this.isDetailToggle=!1;this.id=e,this.colDef=t,this.hide=t.hide??!1;let i=t.pinned;this.pinned=i===!0?"left":i===!1||i==null?null:i,this.resetWidth()}get sortable(){return this.colDef.sortable!==!1}get resizable(){return this.colDef.resizable!==!1}get movable(){return this.colDef.movable!==!1}get filterable(){return this.colDef.filter!=null&&this.colDef.filter!==!1}get filterType(){let e=this.colDef.filter;return e===!0?"text":e??"text"}get hasCheckbox(){return this.colDef.checkboxSelection===!0}resetWidth(){this.manualWidth=null,this.contentWidth=null,this.flex=I(this.colDef.flex)??null}};function X(n){return!n.hasCheckbox&&!n.isDetailToggle&&!n.isAutoRowNumber}function st(n){return n.colDef.autoHeight===!0&&!!(n.colDef.valueGetter||n.colDef.valueFormatter)}var re=class n{constructor(e,t){this.parent=null;this.children=[];this.groupId=e,this.def=t}get headerName(){return this.def.headerName??this.def.groupId??""}getLeafColumns(e=[]){for(let t of this.children)t instanceof n?t.getLeafColumns(e):e.push(t);return e}};function Ce(n){return Array.isArray(n.children)}var Oe=150,cs=80;function j(n,e){let t=I(e.minWidth)??cs,i=I(e.maxWidth)??Number.MAX_SAFE_INTEGER,r=I(n)??I(e.width)??Oe;return Math.max(t,Math.min(i,r))}function hs(n,e,t,i){let r=e.map((o,s)=>s).filter(o=>i[o]>0);for(;Math.abs(t)>.001&&r.length;){let o=r.reduce((a,l)=>a+i[l],0),s=0;if(r=r.filter(a=>{let l=e[a];return e[a]=j(l+t*i[a]/o,n[a]),s+=e[a]-l,e[a]!==l}),Math.abs(s)<1e-4)break;t-=s}}function Pr(n,e,t){let i=n.map(o=>j(o.width??Oe,o)),r=e-i.reduce((o,s)=>o+s,0);return(t?Number.isFinite(e)&&e>0:r>0)&&hs(n,i,r,t?[...i]:n.map(o=>o.flex??0)),i}function Gr(n,e){return Pr(n,e,!1)}function at(n,e){return Pr(n,e,!0)}var Si='<path d="M11.5 2.5l2 2L5 13H3v-2l8.5-8.5z"/>',Mi='<path d="M3.5 3.5l9 9m0-9l-9 9"/>',Ii='<path d="M2.5 8.5l3.5 3.5 7.5-8"/>',de={edit:Si,delete:'<path d="M3 5h10M6 5V3h4v2M5 5l.7 8h4.6L11 5"/>',view:'<path d="M1.5 8s2.4-4.2 6.5-4.2S14.5 8 14.5 8s-2.4 4.2-6.5 4.2S1.5 8 1.5 8z"/><circle cx="8" cy="8" r="1.8"/>',copy:'<rect x="5" y="5" width="8" height="8" rx="1"/><path d="M3 11V3h8"/>',download:'<path d="M8 2v8m0 0l-3-3m3 3l3-3M2.5 13.5h11"/>',refresh:'<path d="M13 3v4h-4M3 13V9h4"/><path d="M13 7a5.5 5.5 0 00-9.7-2.6M3 9a5.5 5.5 0 009.7 2.6"/>',close:Mi,check:Ii,plus:'<path d="M8 2.5v11M2.5 8h11"/>',search:'<circle cx="7" cy="7" r="4.5"/><path d="M10.5 10.5L14 14"/>',more:'<circle cx="3" cy="8" r=".9" fill="currentColor" stroke="none"/><circle cx="8" cy="8" r=".9" fill="currentColor" stroke="none"/><circle cx="13" cy="8" r=".9" fill="currentColor" stroke="none"/>'};function J(n,e=14){return`<svg viewBox="0 0 16 16" width="${e}" height="${e}" aria-hidden="true" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round">${n}</svg>`}var V={matchContains:"\u5305\u542B",matchNotContains:"\u4E0D\u5305\u542B",matchEquals:"\u7B49\u4E8E",matchNotEquals:"\u4E0D\u7B49\u4E8E",matchStartsWith:"\u5F00\u5934\u662F",matchEndsWith:"\u7ED3\u5C3E\u662F",matchBlank:"\u4E3A\u7A7A",matchNotBlank:"\u4E0D\u4E3A\u7A7A",matchLessThan:"\u5C0F\u4E8E",matchLessThanOrEqual:"\u5C0F\u4E8E\u7B49\u4E8E",matchGreaterThan:"\u5927\u4E8E",matchGreaterThanOrEqual:"\u5927\u4E8E\u7B49\u4E8E",matchInRange:"\u5728\u8303\u56F4\u5185",apply:"\u5E94\u7528",reset:"\u91CD\u7F6E",search:"\u641C\u7D22...",emptySetLabel:"(\u7A7A)",selectedCount:"\u5DF2\u9009 {n} \u9879",sortAsc:"\u5347\u5E8F",sortDesc:"\u964D\u5E8F",clearSort:"\u53D6\u6D88\u6392\u5E8F",pinLeft:"\u56FA\u5B9A\u5DE6\u4FA7",pinRight:"\u56FA\u5B9A\u53F3\u4FA7",clearPin:"\u53D6\u6D88\u56FA\u5B9A",autoSize:"\u81EA\u9002\u5E94\u5217\u5BBD",hideColumn:"\u9690\u85CF\u6B64\u5217",columnVisibility:"\u5217\u663E\u793A",resetAll:"\u91CD\u7F6E\u5168\u90E8",autoSizeAll:"\u5168\u90E8\u81EA\u9002\u5E94",columnSettings:"\u5217\u8BBE\u7F6E",totalLabel:"\u5408\u8BA1",totalRowsLabel:"\u5171 {n} \u884C",menuCopy:"\u590D\u5236",menuPaste:"\u7C98\u8D34",menuClearContents:"\u6E05\u9664\u5185\u5BB9",loading:"\u52A0\u8F7D\u4E2D...",statusSelected:"\u5DF2\u9009 {n} \u884C",statusSum:"\u548C {n}",statusAvg:"\u5747 {n}",statusCount:"\u8BA1 {n}",emptyRows:"\u6CA1\u6709\u53EF\u663E\u793A\u7684\u884C",emptyRowsHint:"\u6682\u65E0\u6570\u636E",noMatchingRows:"\u6CA1\u6709\u7B26\u5408\u7B5B\u9009\u6761\u4EF6\u7684\u884C",clearFilters:"\u6E05\u9664\u7B5B\u9009",paginationTotal:"\u5171 {n} \u6761",paginationPage:"\u7B2C {a} / {b} \u9875",perPage:"{n} \u6761/\u9875",pageFirst:"\u9996\u9875",pagePrev:"\u4E0A\u4E00\u9875",pageNext:"\u4E0B\u4E00\u9875",pageLast:"\u672B\u9875",requestFailed:"\u6570\u636E\u52A0\u8F7D\u5931\u8D25",requestFailedHint:"\u8BF7\u68C0\u67E5\u7F51\u7EDC\u540E\u91CD\u8BD5",actionView:"\u67E5\u770B",actionEdit:"\u7F16\u8F91",actionDelete:"\u5220\u9664",actionConfirm:"\u786E\u8BA4",actionSave:"\u4FDD\u5B58",actionCancel:"\u53D6\u6D88",actionMore:"\u66F4\u591A\u64CD\u4F5C",rowDragHandle:"\u62D6\u52A8\u8C03\u6574\u987A\u5E8F\uFF1BAlt + \u4E0A\u4E0B\u65B9\u5411\u952E\u79FB\u52A8",rowDragUnavailable:"\u5F53\u524D\u6392\u5E8F\u6216\u6570\u636E\u6A21\u5F0F\u4E0D\u652F\u6301\u81EA\u52A8\u8C03\u6574\u987A\u5E8F",rowDragPosition:"\u7B2C {a} \u884C \u2192 \u7B2C {b} \u884C",rowDragOutside:"\u79FB\u56DE\u8868\u683C\u5185\u653E\u7F6E \xB7 Esc \u53D6\u6D88"},Lr={matchContains:"Contains",matchNotContains:"Not Contains",matchEquals:"Equals",matchNotEquals:"Not Equals",matchStartsWith:"Starts With",matchEndsWith:"Ends With",matchBlank:"Blank",matchNotBlank:"Not Blank",matchLessThan:"Less Than",matchLessThanOrEqual:"\u2264",matchGreaterThan:"Greater Than",matchGreaterThanOrEqual:"\u2265",matchInRange:"In Range",apply:"Apply",reset:"Reset",search:"Search...",emptySetLabel:"(blank)",selectedCount:"{n} selected",sortAsc:"Ascending",sortDesc:"Descending",clearSort:"Clear Sort",pinLeft:"Pin Left",pinRight:"Pin Right",clearPin:"Unpin",autoSize:"Auto Fit",hideColumn:"Hide Column",columnVisibility:"Columns",resetAll:"Reset All",autoSizeAll:"Fit All",columnSettings:"Column Settings",totalLabel:"Total",totalRowsLabel:"{n} rows",menuCopy:"Copy",menuPaste:"Paste",menuClearContents:"Clear Contents",loading:"Loading...",statusSelected:"{n} selected",statusSum:"Sum {n}",statusAvg:"Avg {n}",statusCount:"Cnt {n}",emptyRows:"No rows to display",emptyRowsHint:"No data is available.",noMatchingRows:"No rows match the filters",clearFilters:"Clear filters",paginationTotal:"{n} items",paginationPage:"Page {a} / {b}",perPage:"{n} / page",pageFirst:"First",pagePrev:"Previous",pageNext:"Next",pageLast:"Last",requestFailed:"Unable to load data",requestFailedHint:"Check your connection and try again",actionView:"View",actionEdit:"Edit",actionDelete:"Delete",actionConfirm:"Confirm",actionSave:"Save",actionCancel:"Cancel",actionMore:"More actions",rowDragHandle:"Drag to reorder; Alt + Up/Down to move",rowDragUnavailable:"Reordering is unavailable in the current sort or data mode",rowDragPosition:"Row {a} \u2192 Row {b}",rowDragOutside:"Move inside to drop \xB7 Esc to cancel",rowDragSelection:"{a} selected rows \u2192 Row {b}",rowDragBefore:"Before",rowDragAfter:"After",rowDragInside:"Inside",rowDragRejected:"This destination is unavailable"},ps={contains:"matchContains",notContains:"matchNotContains",equals:"matchEquals",notEquals:"matchNotEquals",startsWith:"matchStartsWith",endsWith:"matchEndsWith",blank:"matchBlank",notBlank:"matchNotBlank",lessThan:"matchLessThan",lessThanOrEqual:"matchLessThanOrEqual",greaterThan:"matchGreaterThan",greaterThanOrEqual:"matchGreaterThanOrEqual",inRange:"matchInRange"};function lt(n){return ps[n]??"matchEquals"}function W(n,e){return n.replace("{n}",String(e))}function Te(n,e,t){return n.replace("{a}",String(e)).replace("{b}",String(t))}var fs=[[/^(success|ok|done|complete|completed|normal|active|enabled|启用|正常|完成|已完成|运行|运行中|在线|生效|已发运)$/i,"success"],[/^(warning|warn|hold|pending|standby|待机|待审核|暂停|预警|部分完成|待下达|待复核|待发运)$/i,"warning"],[/^(error|fail|failed|danger|fault|offline|disabled|故障|失败|错误|异常|停用|离线|断开)$/i,"danger"],[/^(info|processing|new|draft|进行中|新建|草稿|审批中|同步中|执行中|已下达|装车中)$/i,"info"],[/^(neutral|default)$/i,"neutral"]];function dt(n,e,t){let i=String(n??"");if(e){let r=Ge(e,i);if(r)return r;let o=Ge(e,i.toLowerCase());if(o)return o}for(let[r,o]of fs)if(r.test(i))return o;return t==null?"neutral":dt(t)}function ki(n={}){return e=>{if(e.value==null||e.value==="")return"";let t=String(e.value),i=tt(t,e.colDef.status),r=i?.label??Ge(n.labelMap,t)??(e.formatted||t),o=i?.color,s=dt(o??t,o?void 0:n.variantMap,r),a=p("span",`mach-tag mach-tag--${s}`);return a.textContent=r,o&&s!==o&&(a.style.color=o,a.style.backgroundColor=`color-mix(in srgb, ${o} 12%, transparent)`),a}}function Pi(n={}){return e=>{let t=Number(e.value);if(isNaN(t))return e.formatted;let i=Math.max(0,Math.min(100,t)),r=p("div","mach-progress"),o=p("div","mach-progress__track"),s=p("div","mach-progress__bar");if(s.style.width=`${i}%`,n.color&&(s.style.background=n.color),o.appendChild(s),r.appendChild(o),n.showValue!==!1){let a=p("span","mach-progress__label");a.textContent=`${Math.round(i)}${n.unit??"%"}`,r.appendChild(a)}return r}}function Gi(n){if(n.value==null||n.value==="")return"";let e=p("span","mach-link");return e.textContent=n.formatted||String(n.value),e}var oe=null,B=null;function Nr(n){B&&n.contains(B)&&Z()}function Z(n=!1){oe?.remove(),oe=null,B&&(B.setAttribute("aria-expanded","false"),n&&B.isConnected&&B.focus({preventScroll:!0})),B=null,document.removeEventListener("mousedown",Fr,!0),document.removeEventListener("keydown",Li,!0)}function Fr(n){oe&&!oe.contains(n.target)&&!B?.contains(n.target)&&Z()}function Li(n){if(!oe)return;if(n.key==="Escape"){n.preventDefault(),Z(!0);return}let e=[...oe.querySelectorAll("button:not(:disabled)")];if(e.length===0)return;if(n.key==="Tab"){let r=e.indexOf(document.activeElement);(!n.shiftKey&&r===e.length-1||n.shiftKey&&r<=0)&&(n.preventDefault(),e[n.shiftKey?e.length-1:0].focus());return}if(n.key!=="ArrowDown"&&n.key!=="ArrowUp")return;n.preventDefault();let t=e.indexOf(document.activeElement),i=n.key==="ArrowDown"?1:-1;e[(t+i+e.length)%e.length].focus()}function Or(n,e){let t=p("button",e);return t.type="button",n.variant&&n.variant!=="default"&&t.classList.add(`${e}--${n.variant}`),t.disabled=n.disabled===!0,n.icon&&de[n.icon]?(t.innerHTML=J(de[n.icon],16),t.appendChild(p("span")).textContent=n.label):t.textContent=n.label,t.addEventListener("click",()=>n.pick(t)),t}function ms(n,e){Z();let t=p("div","mach-context-menu mach-action-menu");t.setAttribute("role","menu");for(let i of e){let r=Or(i,"mach-context-menu-item");r.setAttribute("role","menuitem"),t.appendChild(r)}A(t,n.closest(".mach-root")),document.body.appendChild(t),ee(t,n),oe=t,B=n,n.setAttribute("aria-expanded","true"),document.addEventListener("mousedown",Fr,!0),document.addEventListener("keydown",Li,!0),t.querySelector("button:not(:disabled)")?.focus({preventScroll:!0})}function gs(n,e,t){Z();let i=p("div","mach-action-drawer-backdrop"),r=p("section","mach-action-drawer");r.setAttribute("role","dialog"),r.setAttribute("aria-modal","true"),r.setAttribute("aria-label",e);let o=p("header","mach-action-drawer__header"),s=p("strong");s.textContent=e;let a=p("button","mach-action-drawer__close");a.type="button",a.setAttribute("aria-label","Close"),a.title="Close",a.innerHTML=J(de.close,16),a.addEventListener("click",()=>Z(!0)),o.append(s,a);let l=p("div","mach-action-drawer__body");for(let d of t)l.appendChild(Or(d,"mach-action-drawer__item"));r.append(o,l),i.appendChild(r),i.addEventListener("mousedown",d=>{d.target===i&&Z(!0)}),A(i,n.closest(".mach-root")),document.body.appendChild(i),oe=i,B=n,n.setAttribute("aria-expanded","true"),document.addEventListener("keydown",Li,!0),r.querySelector("button:not(:disabled)")?.focus({preventScroll:!0})}function ne(n,e){if(typeof n=="function")try{return n(e)}catch{return!1}return n===!0}function Hr(n){return n.variant??"default"}function Vr(n){return n.permission?typeof n.permission=="string"?[n.permission]:n.permission:[]}function Ni(n,e,t){return{...n.id?{actionId:n.id}:{},permissions:Vr(n),...t?{message:t}:{},params:e}}function ut(n,e,t){let i=t.api.getOption("actionPolicy");try{i?.onError?i.onError(n,Ni(e,t)):console.error("[mach-table] action handler failed",n)}catch(r){console.error("[mach-table] action error policy failed",r,n)}}function ys(n,e){if(Vr(n).length===0)return!0;let i=e.api.getOption("actionPolicy");if(!i?.canAccess)return!0;try{return i.canAccess(Ni(n,e))}catch(r){return ut(r,n,e),!1}}function vs(n,e){return n.filter(t=>{if(!ys(t,e))return!1;if(!t.show)return!0;try{return t.show(e)}catch{return!1}})}function Fi(n,e,t){t.isConnected&&(t.disabled=ne(n.disabled,e)||ne(n.loading,e),t.classList.toggle("mach-action-btn--loading",ne(n.loading,e)))}function bs(n,e,t,i){Promise.resolve(n).catch(r=>ut(r,e,t)).finally(()=>Fi(e,t,i))}function ws(n,e,t){try{bs(n.onClick(e),n,e,t)}catch(i){ut(i,n,e),Fi(n,e,t)}}function Ai(n,e,t){if(n===!1)return!1;let i=typeof n=="string"?n:e.label??e.title??"Confirm action",r=t.api.getOption("actionPolicy");return r?.confirm?r.confirm(Ni(e,t,i)):typeof window>"u"||typeof window.confirm!="function"?!1:window.confirm(i)}function Cs(n,e){if(n.confirm==null||n.confirm===!1)return!0;if(typeof n.confirm!="function")return Ai(n.confirm,n,e);let t=n.confirm(e);return t instanceof Promise?t.then(i=>Ai(i,n,e)):Ai(t,n,e)}function Ts(n){return(e,t)=>{if(ne(e.disabled,n))return;if(t.disabled=!0,t.classList.add("mach-action-btn--loading"),e.confirm==null||e.confirm===!1){ws(e,n,t);return}(async()=>{await Cs(e,n)&&await e.onClick(n)})().catch(r=>ut(r,e,n)).finally(()=>{Fi(e,n,t)})}}function Ds(n,e,t){let i=p("button","mach-action-btn");i.type="button";let r=Hr(n);r!=="default"&&i.classList.add(`mach-action-btn--${r}`);let o=n.title??n.label??"Action";return i.title=o,i.setAttribute("aria-label",o),i.disabled=ne(n.disabled,e),ne(n.loading,e)&&(i.disabled=!0,i.classList.add("mach-action-btn--loading")),n.icon&&de[n.icon]?(i.innerHTML=J(de[n.icon]),i.classList.add("mach-action-btn--icon")):i.textContent=n.label??o,i.addEventListener("mousedown",s=>s.stopPropagation()),i.addEventListener("click",s=>{s.stopPropagation(),t(n,i)}),i}function xs(n,e,t,i,r){let o=p("button","mach-action-btn mach-action-btn--icon");o.type="button";let s=i.api.getOption("locale")??{},a=t.moreLabel??s.actionMore??V.actionMore;return o.title=a,o.setAttribute("aria-label",a),o.setAttribute("aria-haspopup",e==="drawer"?"dialog":"menu"),o.setAttribute("aria-expanded","false"),o.innerHTML=`${J(de.more,16)}<span class="mach-sr-only">\u22EF</span>`,o.addEventListener("mousedown",l=>l.stopPropagation()),o.addEventListener("click",l=>{l.stopPropagation();let d=n.map(u=>({label:u.label??u.title??"Action",icon:u.icon,variant:Hr(u),disabled:ne(u.disabled,i)||ne(u.loading,i),pick:c=>{Z(),r(u,c)}}));e==="drawer"?gs(o,t.drawerTitle??a,d):ms(o,d)}),o}function xe(n){let e=Math.max(0,n.max??3),t=n.overflow??"menu";return i=>{let r=vs(n.actions,i);if(r.length===0)return"";let o=p("div","mach-actions"),s=t==="inline"?r:r.slice(0,e),a=t==="inline"?[]:r.slice(e),l=Ts(i);for(let d of s)o.appendChild(Ds(d,i,l));return a.length>0&&o.appendChild(xs(a,t,n,i,l)),{el:o,destroy:()=>{B&&o.contains(B)&&Z()}}}}function De(n,e,t){return n??e??t}function Rs(n,e){let t=e.api.getOption("locale")??{};return{view:De(n.labels?.view,t.actionView,V.actionView),edit:De(n.labels?.edit,t.actionEdit,V.actionEdit),delete:De(n.labels?.delete,t.actionDelete,V.actionDelete),confirm:De(n.labels?.confirm,t.actionConfirm,V.actionConfirm),save:De(n.labels?.save,t.actionSave,V.actionSave),cancel:De(n.labels?.cancel,t.actionCancel,V.actionCancel)}}function Es(n,e,t){let i=async()=>{if(!await e.api.editing.stop()||!n.onSave)return;let s=e.api.editing.getChanges().filter(a=>a.rowId===e.node.id);try{await n.onSave(e,s),e.api.editing.markSaved([e.node.id])}catch(a){throw e.api.editing.startRow(e.rowIndex),a}},r=n.onSave?t.save:n.labels?.confirm??n.labels?.save??t.confirm;return xe({actions:[{icon:"check",title:r,variant:"success",onClick:i},{icon:"close",title:t.cancel,variant:"danger",onClick:()=>e.api.editing.stop({cancel:!0}).then(()=>{})}],overflow:"inline"})(e)}function Ss(n,e,t){let i=[];return n.onView&&i.push({id:"view",icon:"view",title:t.view,variant:"primary",...n.permissions?.view?{permission:n.permissions.view}:{},onClick:n.onView}),n.edit!==!1&&i.push({id:"edit",icon:"edit",title:t.edit,variant:"warning",...n.permissions?.edit?{permission:n.permissions.edit}:{},onClick:n.onEdit??(()=>{e.api.editing.startRow(e.rowIndex)})}),n.onDelete&&i.push({id:"delete",icon:"delete",title:t.delete,variant:"danger",...n.permissions?.delete?{permission:n.permissions.delete}:{},...n.confirmDelete?{confirm:n.confirmDelete===!0?t.delete:n.confirmDelete}:{},onClick:n.onDelete}),i.push(...n.extraActions??[]),i}function ct(n={}){return e=>{let t=Rs(n,e);if(e.api.editing.isRowActive(e.rowIndex))return Es(n,e,t);let i=Ss(n,e,t);return xe({actions:i,max:n.max,overflow:n.overflow??"menu",moreLabel:n.moreLabel,drawerTitle:n.drawerTitle})(e)}}var Ms=ki(),Is=Pi(),Br=Object.freeze({statusTag:Ms,progressBar:Is,link:Gi});var He={sortable:!1,resizable:!1,movable:!1,filter:!1,suppressSizeToFit:!0,suppressColumnMenu:!0};function _r(n={}){let e=n.width??40;return{colId:"sel",headerName:"",width:e,minWidth:n.minWidth??e,maxWidth:n.maxWidth??e,pinned:"left",checkboxSelection:!0,...He,...n}}function ht(n={}){let e=n.width??52;return{colId:"idx",headerName:"#",type:"index",width:e,minWidth:n.minWidth??e,maxWidth:n.maxWidth??e,pinned:"left",align:"center",headerAlign:"center",...He,...n}}function zr(n={}){let e=n.width??40;return{colId:"drag",headerName:"",rowDrag:!0,width:e,minWidth:n.minWidth??e,maxWidth:n.maxWidth??e,pinned:"left",...He,...n}}function Wr(n={actions:[]}){let{width:e,pinned:t,...i}=n,r=i.actions?.length??0,o=i.overflow==="inline"?r:Math.min(r,i.max??3),s=i.overflow!=="inline"&&r>o,a=Math.max(1,o)*26+(s?26:0)+10;return{colId:"op",headerName:"\u64CD\u4F5C",width:e??Math.max(64,a),pinned:t??"right",cellRenderer:xe(i),...He,cellRendererParams:void 0}}function $r(n={}){let{width:e,pinned:t,...i}=n,r=(i.onView?1:0)+(i.edit===!1?0:1)+(i.onDelete?1:0)+(i.extraActions?.length??0),o=i.overflow==="inline"?r:Math.min(r,i.max??3),s=i.overflow!=="inline"&&r>o,a=Math.max(2,o)*26+(s?26:0)+10;return{colId:"op",headerName:"\u64CD\u4F5C",width:e??Math.max(72,a),pinned:t??"right",cellRenderer:ct(i),...He,cellRendererParams:void 0}}var Oi="__rg_detail_toggle__";function Ve(n){return I(n)!==void 0}function Ur(n){return n===!0?"left":n||null}function Kr(n,e){let t=e;for(let i=2;n.has(t);i++)t=`${e}_${i}`;return n.add(t),t}function As(n,e){let t=e.colDef,i=n.colDef;n.manualWidth=e.manualWidth,(t.width===i.width&&t.autoWidth===i.autoWidth||t.width!=null||t.autoWidth===!1)&&(n.contentWidth=e.contentWidth),(e.manualWidth!=null||e.flex!==(I(t.flex)??null))&&(n.flex=e.flex),e.hide!==(t.hide??!1)&&(n.hide=e.hide),e.pinned!==Ur(t.pinned)&&(n.pinned=e.pinned)}var pt=class{constructor(e){this.e=e;this.X=[];this.Rr=new Map;this.fe=[];this.so=[];this.Er=[];this.ao=[];this.me=[];this.Sr=[];this.Dt=new Map;this.Yt=1;this.lo=new Map;this.ca=0;this.Xe=!1}Ri(e){this.Sr=e?[...e]:[];let t=new Map(this.X.map(u=>[u.id,u])),i=this.e.t.defaultColDef,r=this.e.t.masterDetail&&this.e.t.detailToggleColumn,o=new Set(r?[Oi]:[]),s=this.e.t.rowNumber,a=(u,c,h)=>u.map((f,m)=>{if(Ce(f)){let $=f.groupId??f.headerName??`group_${m}_${h}`,K=new re($,f);return K.parent=c,K.children=a(f.children,K,h+1),K}let g=f,b=Kr(o,g.colId??g.field??`col_${m}`),w=new ie(b,kr(g,i,this.e.t.columnTypes));s&&(s=!we(w.colDef,"index")),w.parentGroup=c,w.level=h;let G=t.get(b);return G&&!G.isAutoRowNumber&&As(w,G),w});if(this.fe=a(this.Sr,null,0),s&&o.size>Number(r)&&this.bu(Kr(o,"idx"),t),r){let u=new ie(Oi,{colId:Oi,headerName:"",width:38,pinned:"left",sortable:!1,resizable:!1,movable:!1,filter:!1});u.isDetailToggle=!0,this.fe.unshift(u)}this.Dt.size&&this.wu(),this.X=this.Mr(this.fe),this.Rr=new Map(this.X.map(u=>[u.id,u])),this.Yt=this.X.reduce((u,c)=>Math.max(u,c.level+1),1);let l=this.me.length;this.me=this.me.filter(u=>this.Rr.has(u.colId));let d=this.me.length!==l;if(this.me.length===0){let u=[];for(let c of this.X)c.colDef.initialSort&&!t.has(c.id)&&u.push({colId:c.id,direction:c.colDef.initialSort});this.me=u}return this.Xt(),d}bu(e,t){let i=new ie(e,ht({colId:e,headerName:"\u5E8F\u53F7"}));i.isAutoRowNumber=!0;let r=t.get(e);r?.isAutoRowNumber&&(i.hide=r.hide);let o=this.fe.findIndex(s=>!(s instanceof ie&&(s.hasCheckbox||s.colDef.rowDrag)));this.fe.splice(o===-1?this.fe.length:o,0,i)}Mr(e,t=[]){for(let i of e)i instanceof re?this.Mr(i.children,t):t.push(i);return t}Xt(){this.Xe=!1;let e=this.X.filter(t=>!t.hide);this.so=e.filter(t=>t.pinned==="left"),this.ao=e.filter(t=>t.pinned==="right"),this.Er=e.filter(t=>t.pinned===null),this.lo.clear(),this.l().forEach((t,i)=>this.lo.set(t.id,i))}J(e){return this.lo.get(e)??-1}Z(){return this.X}uo(){return this.Sr}Cu(){return this.fe}Tu(){return this.Yt}x(e){return this.Rr.get(e)}R(e){return e==="left"?this.so:e==="right"?this.ao:this.Er}l(){return[...this.so,...this.Er,...this.ao]}Je(){return this.l().filter(e=>e.colDef.rowGroup===!0)}Du(){return this.l().filter(e=>e.colDef.aggFunc!=null&&e.colDef.rowGroup!==!0)}ha(){let e=this.l();return this.Er.find(X)??e.find(X)??e[0]}ge(e){return e.pinned==="left"?"left":e.pinned==="right"?"right":"center"}pa(e){let t=this.e.n.ye.clientWidth,i=this.Xe&&t===this.ca;this.ca=t;let r=e,o=[],s=[];for(let l of this.l()){let d=this.Ir(l);i||l.pinned!=null||l.colDef.suppressSizeToFit||l.manualWidth!=null?(l.currentWidth=j(i?l.manualWidth??l.currentWidth:d.width??Oe,d),r-=l.currentWidth):(o.push(l),s.push(d))}this.e.t.columnLayout==="auto"&&!s.some(l=>l.flex)&&o.forEach((l,d)=>{if(l.colDef.autoWidth!==!1&&(l.colDef.width==null||l.contentWidth!=null)){let u=s[d];u.flex=j(u.width??Oe,u)}});let a=this.e.t.columnLayout==="fit"?at(s,Math.max(0,r)):Gr(s,Math.max(0,r));o.forEach((l,d)=>{l.currentWidth=a[d]})}Ir(e){let t=e.colDef;return{width:e.manualWidth??e.contentWidth??t.width??void 0,minWidth:e.minWidth??t.minWidth,maxWidth:t.maxWidth,flex:e.manualWidth==null?e.flex??void 0:void 0}}Ee(e,t){return Ve(t)?(this.Xe=!0,e.manualWidth=j(t,this.Ir(e)),e.flex=null,!0):!1}fa(e,t){return Ve(t)?(this.Xe=!1,e.resetWidth(),e.contentWidth=j(t,this.Ir(e)),!0):!1}co(e,t){let i=this.x(e);!i||i.hide===!t||(i.hide=!t,this.Xt())}Ei(e,t){let i=this.x(e);if(!i)return!1;let r=this.ge(i),o=c=>i.parentGroup?!0:this.ge(c)===r,s=i.parentGroup?i.parentGroup.children:this.fe,a=[],l=[];s.forEach((c,h)=>{c instanceof ie&&!c.hide&&o(c)&&(a.push(c),l.push(h))});let d=a.indexOf(i);if(d<0)return!1;a.splice(d,1);let u=Math.max(0,Math.min(t,a.length));return a.splice(u,0,i),l.forEach((c,h)=>{s[c]=a[h]}),d!==u&&this.Dt.set(this.ma(i),a.filter(c=>c.movable).map(c=>c.id)),this.X=this.Mr(this.fe),this.Xt(),!0}ho(e,t){let i=this.x(e);!i||!i.movable||(i.pinned=t,this.Xt())}ga(e=!0){return(e?this.X:this.X.filter(i=>!i.isAutoRowNumber)).map(i=>({colId:i.id,hide:i.hide,width:i.manualWidth??i.currentWidth,flex:i.flex,widthMode:i.manualWidth==null?"auto":"manual",contentWidth:i.contentWidth??void 0,pinned:i.pinned}))}ya(e){let t=new Map(e.map(i=>[i.colId,i]));for(let i of this.X){let r=t.get(i.id);r&&this.xu(i,r)}this.Ru(e),this.Xt()}xu(e,t){typeof t.hide=="boolean"&&(e.hide=t.hide),t.widthMode==="auto"?(e.resetWidth(),Ve(t.flex)&&(e.flex=t.flex)):Ve(t.flex)?(e.flex=t.flex,e.manualWidth=null):this.Ee(e,t.width),Ve(t.contentWidth)&&(e.contentWidth=j(t.contentWidth,this.Ir(e))),e.movable&&(t.pinned==="left"||t.pinned==="right"||t.pinned===null)&&(e.pinned=t.pinned)}Ru(e){let t=new Map(e.map((i,r)=>[i.colId,r]));this.po(i=>!i.hide&&i.movable&&t.has(i.id),(i,r)=>{let o=[...i];i.sort((s,a)=>t.get(s.id)-t.get(a.id)),i.some((s,a)=>s!==o[a])&&this.Dt.set(r,i.map(s=>s.id))}),this.X=this.Mr(this.fe)}ma(e){if(!e.parentGroup)return this.ge(e);let t=[];for(let i=e.parentGroup;i;i=i.parent)t.push(i.groupId);return JSON.stringify(t)}wu(){let e=new Map;this.po(t=>t.movable,(t,i)=>{let r=this.Dt.get(i);if(!r)return;let o=new Map(t.map(d=>[d.id,d])),s=r.filter(d=>o.has(d));if(s.length<2)return;let a=new Set(s),l=0;t.forEach((d,u)=>{a.has(d.id)&&(t[u]=o.get(s[l++]))}),e.set(i,s)}),this.Dt=e}po(e,t,i=this.fe){let r=new Map;i.forEach((o,s)=>{if(o instanceof re)this.po(e,t,o.children);else if(e(o)){let a=o.parentGroup?"center":this.ge(o),l=r.get(a)??[];l.push(s),r.set(a,l)}});for(let o of r.values()){if(o.length<2)continue;let s=o.map(a=>i[a]);t(s,this.ma(s[0])),o.forEach((a,l)=>{i[a]=s[l]})}}fo(){for(let e of this.X)e.resetWidth(),e.hide=e.colDef.hide??!1,e.pinned=Ur(e.colDef.pinned);if(this.Dt.size){this.Dt.clear(),this.Ri(this.Sr);return}this.Xt()}Q(){return this.me.map(e=>({...e}))}Si(e){if(!e||e.length===0){this.me=[];return}this.me=e.filter(t=>this.Rr.has(t.colId)&&(t.direction==="asc"||t.direction==="desc")).map(t=>({colId:t.colId,direction:t.direction}))}Ar(e,t){let i=[...this.me],r=i.findIndex(l=>l.colId===e.id),o=r>=0?i[r].direction:null,s=o===null?"asc":o==="asc"?"desc":null;t&&this.e.t.multiSort?s===null?r>=0&&i.splice(r,1):r>=0?i[r]={colId:e.id,direction:s}:i.push({colId:e.id,direction:s}):(i.length=0,s&&i.push({colId:e.id,direction:s})),this.me=i}};function k(n){return n!=null&&typeof n.then=="function"}function se(n,e){if(n instanceof Error)return n;let t=new Error(typeof n=="string"?n:e);return t.name="AbortError",t}var ks=()=>se(void 0,"[MachTable] Operation cancelled.");function ft(n,e,t=ks){return e?new Promise((i,r)=>{let o=()=>{e.removeEventListener("abort",o),r(t())};if(n.then(i,r).finally(()=>e.removeEventListener("abort",o)),e.aborted){o();return}e.addEventListener("abort",o,{once:!0})}):n}function jr(n){return n==null?"":String(n).toLowerCase()}function Vi(n,e,t){return n.length===0||(e==="or"?n.some(t):n.every(t))}function Ps(n,e,t){let i=jr(n);return Vi(e,t,o=>{let s=(o.value??"").toLowerCase();switch(o.match){case"contains":return i.includes(s);case"notContains":return!i.includes(s);case"equals":return i===s;case"notEquals":return i!==s;case"startsWith":return i.startsWith(s);case"endsWith":return i.endsWith(s);case"blank":return i==="";case"notBlank":return i!=="";default:return!0}})}function qr(n,e,t,i){switch(t){case"equals":return n===e;case"notEquals":return n!==e;case"lessThan":return n<e;case"lessThanOrEqual":return n<=e;case"greaterThan":return n>e;case"greaterThanOrEqual":return n>=e;case"inRange":return n>=e&&n<=i;default:return!0}}function Gs(n,e){let t=n==null||n==="";if(e.match==="blank")return t;if(e.match==="notBlank")return!t;if(t)return!1;let i=typeof n=="number"?n:Number(n);if(Number.isNaN(i))return!1;let r=e.value;return r==null||Number.isNaN(r)?!1:qr(i,r,e.match,e.value2??r)}function Ls(n,e,t){return Vi(e,t,r=>Gs(n,r))}function Hi(n){if(n==null||n==="")return null;if(typeof n=="number")return n;let e=n instanceof Date?n.getTime():Date.parse(String(n));return isNaN(e)?null:e}function Ns(n,e,t){let i=Hi(n);return Vi(e,t,o=>{let s=i==null;if(o.match==="blank")return s;if(o.match==="notBlank")return!s;if(s)return!1;let a=Hi(o.value);if(a==null)return!1;let l=o.match==="inRange"?Hi(o.value2)??1/0:a;return qr(i,a,o.match,l)})}function Fs(n,e){return e.length===0?!0:e.some(t=>t==null&&n==null||t===n)}function Os(n,e){let t=e.type!=="set"&&e.operator==="or"?"or":"and";switch(e.type){case"text":return Ps(n,e.conditions,t);case"number":return Ls(n,e.conditions,t);case"date":return Ns(n,e.conditions,t);case"set":return Fs(n,e.values);default:return!0}}function Yr(n,e,t){return i=>Os(t(i,n),e)}function Xr(n,e,t){if(n.kind==="condition"){let r=e.get(n.colId);return r?Yr(r,n.filter,t):()=>!0}let i=n.children.map(r=>Xr(r,e,t));return r=>{let o=n.operator==="or"?i.some(s=>s(r)):i.every(s=>s(r));return n.not?!o:o}}function Bi(n,e,t,i,r){let o=new Map(n.map(l=>[l.id,l])),s=Object.entries(e).flatMap(([l,d])=>{let u=o.get(l);return u?[Yr(u,d,r)]:[]});t&&s.push(Xr(t.root,o,r));let a=i?.trim().toLowerCase().split(/\s+/).filter(Boolean)??[];return l=>s.every(d=>d(l))&&a.every(d=>n.some(u=>jr(r(l,u)).includes(d)))}var Jr=typeof Intl<"u"?new Intl.Collator(void 0,{numeric:!0,sensitivity:"base"}):null;function Hs(n,e){let t=n==null||n==="",i=e==null||e==="";return!t&&!i?null:t&&i?0:t?1:-1}function Vs(n,e){let t=Number.isNaN(n),i=Number.isNaN(e);return t||i?t===i?0:t?1:-1:n-e}function Bs(n,e){return n===e?0:n?1:-1}function mt(n,e){let t=Hs(n,e);if(t!==null)return t;if(typeof n=="number"&&typeof e=="number")return Vs(n,e);if(n instanceof Date&&e instanceof Date)return n.getTime()-e.getTime();if(typeof n=="boolean"&&typeof e=="boolean")return Bs(n,e);let i=String(n),r=String(e);return Jr?Jr.compare(i,r):i.localeCompare(r)}function _i(n,e,t,i){let r=new Map(t.map(a=>[a.id,a])),o=e.flatMap(a=>{let l=r.get(a.colId);return l?[{column:l,compare:l.colDef.comparator??mt,direction:a.direction}]:[]}),s=n.map(a=>({node:a,values:o.map(({column:l})=>i(a,l))}));return s.sort((a,l)=>{for(let d=0;d<o.length;d++){let u=o[d],c=u.compare(a.values[d],l.values[d],a.node,l.node);if(c!==0)return u.direction==="asc"?c:-c}return 0}),s.map(({node:a})=>a)}function Zr(){return{count:0,numeric:0,sum:0,min:1/0,max:-1/0}}function Qr(n,e){n.count++,!(typeof e!="number"||!Number.isFinite(e))&&(n.numeric++,n.sum+=e,n.min=Math.min(n.min,e),n.max=Math.max(n.max,e))}function en(n,e){return e==="count"?n?.count??0:n?.numeric?e==="min"?n.min:e==="max"?n.max:Number.isFinite(n.sum)?e==="avg"?n.sum/n.numeric:n.sum:null:null}function gt(n,e){let t=Zr();for(let i of n)Qr(t,i);return en(t,e)}var Be={sum:n=>gt(n,"sum"),avg:n=>gt(n,"avg"),count:n=>n.length,min:n=>gt(n,"min"),max:n=>gt(n,"max"),first:n=>n.length>0?n[0]:null,last:n=>n.length>0?n[n.length-1]:null};function tn(n,e,t){if(e===Be.count)return n.length;let i=["sum","avg","min","max"].find(o=>e===Be[o]);if(!i)return e(n.map(t));let r=Zr();for(let o of n)Qr(r,t(o));return en(r,i)}function yt(n){let e={...Be,...n??{}};return t=>e[t]}var vt="group:";function rn(n){return n==null?"null":n instanceof Date?JSON.stringify(["date",String(n.getTime())]):JSON.stringify([typeof n,zi(n)])}function zi(n){return n==null?"(\u7A7A)":String(n)}function nn(n){return vt+JSON.stringify(n)}function _s(n,e,t){let i=new Map;for(let r of n){let o=t(r,e),s=rn(o),a=i.get(s);a||(a={key:s,label:zi(o),rows:[]},i.set(s,a)),a.rows.push(r)}return[...i.values()].sort((r,o)=>r.label.localeCompare(o.label,void 0,{numeric:!0,sensitivity:"base"})||r.key.localeCompare(o.key))}function on(n,e,t,i,r){let o=[],s=(a,l,d)=>{if(l===e.length)return{display:a,leaves:a};let u=[],c=[];for(let h of _s(a,e[l],t)){let f=[...d,[e[l].id,h.key]],m=nn(f);o.push(m);let g=s(h.rows,l+1,f);if(u.push({id:m,data:null,rowIndex:-1,selected:!1,isGroup:!0,groupLevel:l,groupKey:h.label,leafNodes:g.leaves,aggValues:i(g.leaves)}),r.has(m))for(let b of g.display)u.push(b);if(l>0)for(let b of g.leaves)c.push(b)}return{display:u,leaves:c}};return{rows:s(n,0,[]).display,ids:o}}function sn(n,e,t,i){let r=new Set([...n].filter(l=>l.startsWith("/g0:")));if(!r.size)return{expanded:n,ambiguous:[]};let o=new Map;for(let l of e){let d=[],u="";for(let c=0;c<t.length;c++){let h=i(l,t[c]);if(d.push([t[c].id,rn(h)]),u+=`/g${c}:${zi(h)}`,!r.has(u))continue;let f=nn(d);o.set(u,o.has(u)&&o.get(u)!==f?null:f)}}let s=new Set([...n].filter(l=>!r.has(l))),a=[];for(let l of r){let d=o.get(l);d?s.add(d):d===null?a.push(l):s.add(l)}return{expanded:s,ambiguous:a}}function zs(n,e){let t=n?[n.root]:[];for(;t.length;){let i=t.pop();if(i.kind==="condition")e.add(i.colId);else for(let r of i.children)t.push(r)}}function an(n){let e=new Set(Object.keys(n.filterModel));zs(n.advancedFilter,e);let t=new Set(n.sortModel.map(a=>a.colId));for(let a of t)e.add(a);let i=n.columns.some(a=>a.colDef.rowGroup===!0),r=!!n.quickFilter?.trim(),o=n.columns.filter(a=>e.has(a.id)||r||a.colDef.rowGroup===!0||i&&a.colDef.aggFunc!=null),s=new Set;for(let a of o){let l=a.colDef;if(i&&l.rowGroup!==!0&&l.aggFunc!=null&&n.customAggregates?.[l.aggFunc]||l.valueGetter||t.has(a.id)&&l.comparator||!l.field)return null;s.add(l.field)}return[...s]}function ln(n){return n!=null&&(typeof n=="object"||typeof n=="function")}function dn(n,e){if(n.length*(e.length+4)>1e6)return null;let t=new WeakMap;for(let i of n){if(i.data==null)continue;let r=e.map(o=>z(i.data,o));r.some(ln)||t.set(i,r)}return t}function un(n,e,t,i){return t.length?!i||n===e||n==null||e==null?!0:t.some((r,o)=>{let s=z(e,r);return ln(s)||!Object.is(i[o],s)}):!1}function ue(n){return se(n.reason,"Block request aborted")}function bt(n){return Number.isFinite(n)?Math.max(1,Math.trunc(n)):1}var wt=class{constructor(e,t,i=4){this.maxBlocks=e;this.vo=t;this.maxConcurrentRequests=i;this.ee=new Map;this.j=new Map;this.va=0;this.mo=0;this.go=0;this.ba=0;this.wa=0;this.kr=0;this.Pr=new Set;this.maxBlocks=bt(e),this.maxConcurrentRequests=bt(i)}configure(e,t=this.maxConcurrentRequests){this.maxBlocks=bt(e),this.maxConcurrentRequests=bt(t),this.yo(),this.Gr()}Eu(e){this.Pr=e,this.yo()}peek(e){let t=this.ee.get(e);if(t)return t.touchedAt=++this.va,t}has(e){return this.ee.has(e)}Jt(e){let t=this.j.get(e);t&&(this.j.delete(e),t.controller.abort(),t.state==="queued"&&t.reject(ue(t.controller.signal)));let i=this.ee.get(e);i&&(this.ee.delete(e),this.vo?.(e,i))}load(e,t,i,r=0){if(i?.aborted)return Promise.reject(ue(i));let o=this.peek(e);if(o)return this.go++,Promise.resolve(o);let s=this.j.get(e);if(s)return this.go++,s.priority=Math.max(s.priority,r),this.Gr(),this.Ca(e,s,i);this.ba++;let a=new AbortController,l,d,u=new Promise((f,m)=>{l=f,d=m}),c={controller:a,promise:u,consumers:0,loader:t,priority:r,state:"queued",resolve:l,reject:d};this.j.set(e,c);let h=this.Ca(e,c,i);return this.Gr(),h}Su(){this.mo++,this.Pr.clear();for(let e of this.j.values())e.controller.abort(),e.state==="queued"&&e.reject(ue(e.controller.signal));this.j.clear();for(let[e,t]of this.ee)this.vo?.(e,t);this.ee.clear()}snapshot(){let e=0,t=0;for(let i of this.ee.values())e+=i.rows.length;for(let i of this.j.values())i.state==="active"&&t++;return{cachedBlockCount:this.ee.size,loadingBlockCount:this.j.size,activeRequestCount:t,queuedRequestCount:Math.max(0,this.j.size-t),cachedRowCount:e,hitCount:this.go,missCount:this.ba,evictionCount:this.wa}}Gr(){for(;this.kr<this.maxConcurrentRequests;){let e,t;for(let[i,r]of this.j)r.state!=="queued"||r.controller.signal.aborted||(!t||r.priority>t.priority)&&(e=i,t=r);if(e==null||!t)return;this.Mu(e,t)}}Mu(e,t){t.state="active",this.kr++;let i=this.mo;this.Iu(t).then(r=>{i===this.mo&&!t.controller.signal.aborted&&(this.ee.set(e,{rows:r.rows,...r.lastRow==null?{}:{lastRow:r.lastRow},touchedAt:++this.va}),this.yo()),t.resolve(r)},t.reject).finally(()=>{this.kr=Math.max(0,this.kr-1),this.j.get(e)===t&&this.j.delete(e),this.Gr()})}Iu(e){let{signal:t}=e.controller;return ft(Promise.resolve().then(()=>{if(t.aborted)throw ue(t);return e.loader(t)}),t,()=>ue(t))}Ca(e,t,i){return t.consumers++,new Promise((r,o)=>{let s=!1,a=d=>{s||(s=!0,i?.removeEventListener("abort",l),t.consumers=Math.max(0,t.consumers-1),d())},l=()=>a(()=>{t.consumers===0&&this.j.get(e)===t&&(this.j.delete(e),t.controller.abort(i?.reason),t.state==="queued"&&t.reject(ue(t.controller.signal))),o(ue(i))});i?.addEventListener("abort",l,{once:!0}),t.promise.then(d=>a(()=>r(d)),d=>a(()=>o(d instanceof Error?d:new Error(String(d??"Block request failed")))))})}yo(){let e=Math.max(this.maxBlocks,this.Pr.size+1);for(;this.ee.size>e;){let t=-1,i=Number.POSITIVE_INFINITY;for(let[o,s]of this.ee)this.Pr.has(o)||s.touchedAt<i&&(t=o,i=s.touchedAt);if(t<0)return;let r=this.ee.get(t);this.ee.delete(t),this.wa++,r&&this.vo?.(t,r)}}};function Re(n,e){if(n==null||typeof n!="object")return;let t=n[e];return Array.isArray(t)?t:void 0}function Ee(n,e,t=0,i=new Set){for(let r of n){if(r==null)continue;if(t>=256)throw new RangeError("[MachTable] Tree data exceeds 256 levels.");if(i.has(r))throw new TypeError("[MachTable] Tree data contains a cyclic object graph.");let o=Re(r,e);o?.length&&(i.add(r),Ee(o,e,t+1,i),i.delete(r))}}var Ct=class{constructor(e){this.e=e;this.c=[];this._=[];this.te=new Map;this.ve=[];this.p=new Map;this.Se={};this.Me=null;this.He=null;this.A=new Set;this.z=new Set;this.Mi=[];this.Ii=new Map;this.Ta=[];this.k=null;this.Ai=!1;this.Da=!1;this.Ze=0;this.Lr=null;this.Nr=new WeakMap;this.Fr=new WeakMap;this.Qe=new Map;this.ki=new Map;this.Or=0;this.Hr=0;this.et=null;this.tt=new Map;this.xt=new Map;this.Vr=new Set;this.Rt=new Map;this.it=new wt(12,e=>this.xa(e));this.Pi=0;this.Br=null;this.bo=!1;this.Ra=0;this.we=[];this.V=1;this.Me=H(e.t.advancedFilterModel)}resolveRowId(e,t,i){let r=this.e.t.resolveRowId;if(!r)return i;try{let o=r({data:e,index:t,api:this.e.api});if(typeof o=="string"&&o.length>0)return o;this.e.reportError(new Error("rowKey must resolve to a non-empty identifier"),"rowKey",{index:t})}catch(o){this.e.reportError(o,"rowKey",{index:t})}return i}get M(){return this.e.t.treeData}get g(){return this.e.t.datasource!=null}get be(){return this.g&&this.e.t.datasourceMode==="block"}Gi(){if(this.g){if(this.be)return this.Zt();let e=Math.max(0,this.ve.length-this.c.length);return(this.k??this.c.length)+e}return this.ve.length}Li(){return this.Or}Ve(){return this.Hr}Au(){return this.Da}_r(e){return!this.g||e?.aborted?Promise.resolve():(this.Ea(!0),this.be?(this.it.configure(this.e.t.maxBlocksInCache,this.e.t.datasourceMaxConcurrentRequests),this.zr(0,e)):this.Sa(0,void 0,e))}Et(e){this.Da=e,this.e.n.Et(e,this.e.u("loading"))}Sa(e,t,i){if(!this.g||this.Ai||this.k!=null&&e>=this.k)return Promise.resolve();let r=this.e.t.blockSize,o=t??e+r;if(o<=e)return Promise.resolve();let s=++this.Ze,a=new AbortController,l=()=>a.abort(i?.reason);return i?.addEventListener("abort",l,{once:!0}),this.Lr=a,this.Ai=!0,this.Et(!0),new Promise(d=>{let u=c=>{i?.removeEventListener("abort",l),s===this.Ze&&(this.Ai=!1,this.Lr=null,this.Et(!1),c!=null&&c?.name!=="AbortError"&&this.e.reportError(c,"datasource.getRows",{startRow:e,endRow:o})),d()};this.Ma(e,o,a.signal,(c,h)=>{if(s!==this.Ze||this.e.o()||a.signal.aborted){u();return}typeof h=="number"&&h>=0?this.k=h:c.length<o-e&&(this.k=e+c.length);let f=this.c.length===0;this.ku(c),u(),this.O(),f&&this.e.Ie(),this.e.W.Wr()},c=>u(a.signal.aborted||this.e.o()?void 0:c??new Error("Datasource request failed")))})}wo(){this.Ze++,this.Lr?.abort(),this.Lr=null,this.Ai=!1,this.Et(!1),this.it.Su(),this.tt.clear(),this.xt.clear(),this.Vr.clear();for(let[e,t]of this.Rt)this.p.get(e)===t&&this.p.delete(e);this.Rt.clear()}ku(e){for(let t of e){if(t==null)continue;let i=this.c.length,r=this.resolveRowId(t,i,`inf-${this.e.Qt()}`);if(this.p.has(r)){this.e.reportError(new Error(`Duplicate row id: ${r}`),"datasource.getRows",{rowId:r});continue}let o={id:r,data:t,rowIndex:-1,selected:this.e.f.$r(r)};this.c.push(o),this.p.set(r,o),this._.push(o)}}zr(e,t,i=0){if(!this.be||e<0)return Promise.resolve();if(t?.aborted)return Promise.reject(this.Ia(t.reason));let r=this.e.t.blockSize,o=this.Ze,s=e*r;if(s>=this.Zt())return Promise.resolve();let a=this.k==null?s+r:Math.min(this.k,s+r),l=this.it.load(e,d=>this.Pu(s,a,d),t,i);return this.Et(this.c.length===0&&this.it.snapshot().loadingBlockCount>0),l.then(d=>{o!==this.Ze||t?.aborted||this.e.o()||!this.be||!this.it.has(e)||this.Vr.has(e)||(this.Gu(e,d),this.O(),this.e.W.Wr(),o===this.Ze&&!this.e.o()&&this.Aa(this.e.s.Co().lastExcl-1))}).catch(d=>{throw d?.name!=="AbortError"&&this.e.reportError(d,"datasource.getRows",{startRow:s,endRow:a}),d}).finally(()=>{o===this.Ze&&this.Et(this.c.length===0&&this.it.snapshot().loadingBlockCount>0)})}Pu(e,t,i){return new Promise((r,o)=>{this.Ma(e,t,i,(s,a)=>r({rows:s,...typeof a=="number"&&a>=0?{lastRow:a}:{}}),s=>o(s instanceof Error?s:new Error(typeof s=="string"?s:"Datasource request failed")))})}Ma(e,t,i,r,o){let s=this.e.t.datasource,a=0,l=null,d=!1,u=()=>d?!1:(d=!0,l!=null&&clearTimeout(l),i.removeEventListener("abort",c),!0),c=()=>{u()&&o(this.Ia(i.reason))};i.addEventListener("abort",c,{once:!0});let h=()=>{if(d)return;if(i.aborted||this.e.o()){c();return}a++;let f=!1,m=g=>{if(!(f||d)){if(f=!0,i.aborted||this.e.o()){c();return}a<=this.e.t.datasourceRetryCount?l=setTimeout(h,this.retryDelay(a)):u()&&o(g)}};try{let g=s.getRows({startRow:e,endRow:t,sortModel:this.e.r.Q(),filterModel:this.Be(),advancedFilterModel:this.Ni(),quickFilterText:this.He,signal:i,onSuccess:(b,w)=>{!f&&u()&&r(b??[],w)},fail:m});g&&typeof g.catch=="function"&&g.catch(m)}catch(g){m(g)}};h()}Gu(e,t){let i=this.e.t.blockSize,r=e*i;this.xa(e),typeof t.lastRow=="number"&&t.lastRow>=0?this.k=t.lastRow:t.rows.length<i&&(this.k=r+t.rows.length),t.rows.forEach((o,s)=>{if(o==null)return;let a=r+s;if(this.k!=null&&a>=this.k)return;let l=this.resolveRowId(o,a,`block-${a}`),d=this.Rt.get(l),u=this.p.get(l);if(u&&u!==d&&u.rowIndex!==a){this.e.reportError(new Error(`Duplicate row id: ${l}`),"datasource.getRows",{rowId:l});return}let c=d??{id:l,data:o,rowIndex:a,selected:this.e.f.$r(l)};c.rowIndex=a,c.selected=this.e.f.$r(l),this.Rt.delete(l),this.tt.set(a,c),this.xt.delete(a),this.p.set(l,c),this.Fr.set(c,a+1)}),this.ka(),this.Vr.add(e)}xa(e){this.Vr.delete(e);let t=this.e.t.blockSize,i=e*t,r;for(let o=i;o<i+t;o++){let s=this.tt.get(o);s&&(r??(r=new Set(this.e.P.getDirtyRowIds())),this.tt.delete(o),r.has(s.id)?this.Rt.set(s.id,s):this.p.get(s.id)===s&&this.p.delete(s.id))}this.ka()}ka(){this.c=[...this.tt.entries()].sort(([e],[t])=>e-t).map(([,e])=>e),this._=this.c}Zt(){if(this.k!=null)return this.k;if(this.e.t.datasourceRowCount!=null)return this.e.t.datasourceRowCount;if(this.tt.size===0)return this.e.t.blockSize;let e=0;for(let t of this.tt.keys())e=Math.max(e,t+1);return e+this.e.t.blockSize}Lu(e){let t=this.xt.get(e);if(!t&&(t={id:`__mach_loading_${e}`,data:null,rowIndex:e,selected:!1,loading:!0},this.xt.set(e,t),this.xt.size>2e3)){let i=this.xt.keys().next().value;i!=null&&this.xt.delete(i)}return t}Ia(e){return se(e,"Operation aborted")}retryDelay(e){let t=Math.min(this.e.t.datasourceRetryDelay*2**Math.max(0,e-1),3e4),i=this.e.t.datasourceRetryJitter;return Math.max(0,Math.round(t*(1+(Math.random()*2-1)*i)))}Nu(e){if(this.be){this.Aa(e);return}if(!this.g||this.Ai)return;let t=this.c.length;if(this.k!=null&&t>=this.k)return;let i=this.e.t.infiniteBufferRows;if(e+i<t&&e<t)return;let r=this.e.t.blockSize,o=this.k==null?t+r:Math.min(this.k,t+r);this.Sa(t,o)}Aa(e){if(e<0)return;this.Pa();let t=this.e.t.blockSize,i=Math.floor(e/t),r=Math.floor(this.e.s.Co().first/t),o=this.e.t.blockPrefetch,s=i<this.Ra?-1:1;this.Ra=i;for(let a=r;a<i;a++)this.zr(a,void 0,o+2).catch(()=>{});for(let a=0;a<=o;a++){let l=a===0?[i]:[i+s*a,i-s*a];for(let d of l)d<0||d*t>=this.Zt()||this.zr(d,void 0,o-a+1).catch(()=>{})}}Ga(){return this._r().catch(()=>{})}Fu(){return this.wo(),this.g?this._r().catch(()=>{}):(this.k=null,this.rt(this.e.t.rowData),this.e.$({data:!0}),Promise.resolve())}destroy(){this.et=null,this.wo(),this.La(),this.To(),this.c=this._=this.ve=this.we=[],this.p.clear(),this.te.clear(),this.Ii.clear(),this.Ta=[],this.A.clear(),this.z.clear(),this.Mi=[]}Do(e,t,i){if(!this.be)return Promise.resolve();this.Pa();let r=this.e.t.blockSize,o=Math.max(0,Math.trunc(e)),s=Math.min(this.Zt(),Math.max(o,Math.trunc(t))),a=Math.floor(o/r),l=Math.max(a,Math.floor(Math.max(o,s-1)/r)),d=[];for(let u=a;u<=l;u++)d.push(this.zr(u,i,100));return Promise.all(d).then(()=>{})}Ou(){this.be&&this.Ea(!1)}Ea(e){this.Na(),this.e.P.clear(),this.wo(),e&&(this.k=null,this.A.clear()),this.c=[],this._=[],this.p.clear(),this.e.H.clear(),this.O()}Na(){this.Hr++,this.e._e(),this.e.api.editing.stop({cancel:!0})}Hu(){return this.it.snapshot()}Pa(){let e=new Set(this.e.P.getDirtyRowIds());for(let[l,d]of this.Rt)e.has(l)||(this.Rt.delete(l),this.p.get(l)===d&&this.p.delete(l));let t=this.e.t.blockSize,i=new Set,{first:r,lastExcl:o}=this.e.s.Co();for(let l=r;l<o;l+=t)i.add(Math.floor(l/t));o>r&&i.add(Math.floor((o-1)/t));let s=this.e.s.v;s&&i.add(Math.floor(s.rowIndex/t));let a=this.e.a.Vu();a!=null&&i.add(Math.floor(a/t)),this.it.Eu(i)}rt(e){let t=this.e.t.resolveRowId,i=this.e.t.childrenKey;this.M&&Ee(e??[],i);let r=[],o=[],s=new Map,a=new Map,l=0,d=(u,c,h)=>{let f=l++,m=this.resolveRowId(u,f,`auto-${f}`);if(s.has(m))return this.e.reportError(new Error(`Duplicate row id: ${m}`),"rowData",{rowId:m,index:f}),null;let g=this.M?Re(u,i):void 0,b={id:m,data:u,rowIndex:-1,selected:!1,treeChildrenLoaded:Array.isArray(g)};if(this.Nr.set(b,c),r.push(b),s.set(m,b),h!=null){let w=a.get(h)??[];w.push(m),a.set(h,w)}else o.push(b);if(this.M&&Array.isArray(g))for(let w of g)w!=null&&d(w,c+1,m);return b};(e??[]).forEach(u=>{u!=null&&d(u,0,null)}),this.e.t.rowData=e??[],this.Na(),this.La(),this.e.P.clear(),this.c=r,this._=o,this.te=a,this.p=s,this.e.H.clear();for(let u of[...this.A])s.has(u)||this.A.delete(u);if(this.e.t.defaultExpandAll)for(let u of r)this.Fa(u.id)>0&&this.A.add(u.id);this.e.f.Oa(t!=null),this.Kr()}Fi(e){return this.te.get(e)??[]}Fa(e){return this.te.get(e)?.length??0}xo(e){return this.Fa(e)>0}isTreeRowLoading(e){return this.p.get(e)?.treeLoading===!0}La(){for(let e of this.Qe.values())e.abort();this.Qe.clear(),this.ki.clear()}loadTreeChildren(e,t=!1){let i=this.p.get(e),r=this.e.t.loadTreeChildren;if(!this.M||!i?.data||!r)return Promise.resolve([]);if(!t&&i.treeChildrenLoaded)return Promise.resolve(this.Fi(e).flatMap(l=>{let d=this.p.get(l)?.data;return d==null?[]:[d]}));let o=this.ki.get(e);if(o&&!t)return o;this.Qe.get(e)?.abort();let s=new AbortController;this.Qe.set(e,s),i.treeLoading=!0,i.treeLoadError=void 0,this.e.$({data:!0});let a=Promise.resolve().then(()=>r({data:i.data,node:i,api:this.e.api,signal:s.signal})).then(l=>{if(s.signal.aborted||this.e.o())return[];if(!Array.isArray(l))throw new TypeError("[MachTable] loadTreeChildren must resolve to an array.");return this.Bu(i,l),i.treeChildrenLoaded=!0,i.treeLoadError=void 0,this.e.emit("treeChildrenLoaded",{rowId:e,rowNode:i,children:l}),l}).catch(l=>{if(s.signal.aborted||l?.name==="AbortError")return[];throw i.treeLoadError=l,i.treeChildrenLoaded=!1,this.e.reportError(l,"treeData.loadChildren",{rowId:e}),this.e.emit("treeChildrenLoadFailed",{rowId:e,rowNode:i,error:l}),l}).finally(()=>{this.Qe.get(e)===s&&(this.Qe.delete(e),this.ki.delete(e),i.treeLoading=!1,this.e.$({data:!0}))});return this.ki.set(e,a),a}Bu(e,t){let i=new Set,r=[...this.Fi(e.id)];for(;r.length>0;){let s=r.pop();i.has(s)||(i.add(s),r.push(...this.Fi(s)))}this._u(t,i,this.Ur(e)+1);for(let s of i)this.Qe.get(s)?.abort(),this.Qe.delete(s),this.ki.delete(s),this.te.delete(s),this.p.delete(s),this.A.delete(s);this.te.delete(e.id);let o=this.Ur(e)+1;for(let s of t)s!=null&&this.Ro(e,s,o);this.Ha(),this.e.f.Oa(this.e.t.resolveRowId!=null),this.O()}_u(e,t,i){Ee(e,this.e.t.childrenKey,i);let r=this.e.t.resolveRowId,o=r?new Set([...this.p.keys()].filter(l=>!t.has(l))):null,s=[...e],a=0;for(;s.length>0;){let l=s.pop();if(l==null)continue;if(r&&o){let u=r({data:l,index:a++,api:this.e.api});if(typeof u!="string"||u.length===0)throw new TypeError("[MachTable] rowKey must resolve to a non-empty identifier for lazy tree children.");if(o.has(u))throw new Error(`Duplicate row id: ${u}`);o.add(u)}let d=Re(l,this.e.t.childrenKey);d&&s.push(...d)}}Oi(e,t=!0){this.M&&e.add?.length&&Ee(e.add,this.e.t.childrenKey);let i=this.e.t.resolveRowId,r=[],o=[];if(e.remove?.length){let a=new Set,l=new Set,d=c=>{if(i){let f=[this.resolveRowId(c,-1,`__missing_remove_${this.e.Qt()}`)];for(;f.length>0;){let m=f.pop();if(!a.has(m)){a.add(m);for(let g of this.te.get(m)??[])f.push(g)}}}else{let h=[c];for(;h.length>0;){let f=h.pop();l.add(f);let m=this.M?Re(f,this.e.t.childrenKey):void 0;if(m)for(let g of m)h.push(g)}}};e.remove.forEach(d),this.c=this.c.filter(c=>{let h=a.has(c.id)||c.data!=null&&l.has(c.data);return h&&(o.push(c.id),this.p.delete(c.id),this.te.delete(c.id)),!h});let u=new Set(this.c);this._=this._.filter(c=>u.has(c))}if(e.update?.length)for(let a of e.update){let l;i?l=this.p.get(this.resolveRowId(a,-1,`__missing_update_${this.e.Qt()}`)):l=this.c.find(d=>d.data===a),l&&(r.push({node:l,before:l.data,after:a}),l.data=a,o.push(l.id),this.e.s.Va(l))}if(e.add?.length){let a=e.addIndex!=null?Math.max(0,Math.min(e.addIndex,this._.length)):this._.length,l=[];e.add.forEach((d,u)=>{let c=this.resolveRowId(d,a+u,`add-${this.e.Qt()}`);if(this.p.has(c)){this.e.reportError(new Error(`Duplicate row id: ${c}`),"transaction.add",{rowId:c});return}let h={id:c,data:d,rowIndex:-1,selected:!1};this.p.set(c,h),this.Nr.set(h,0);let f=this.M?Re(d,this.e.t.childrenKey):void 0;if(f)for(let m of f)m!=null&&this.Ro(h,m,1);l.push(h)}),this._=this._.slice(0,a).concat(l,this._.slice(a)),this.Ha()}let s={pipelineChanged:this.zu(e,r),updatedRowIds:r.map(({node:a})=>a.id)};return this.e.H.Wu(o),this.$u(s,t),this.e.P.Ku(o),s}$u(e,t){e.pipelineChanged&&(this.et=null),t&&(e.pipelineChanged?this.Kr():e.updatedRowIds.length&&this.Ba())}Uu(e){if(e.length===0)return{pipelineChanged:!1,updatedRowIds:[]};let t=this.Hr,i=!1,r=new Set;for(let o of e){let s=this.Oi(o,!1);if(this.Hr!==t)return{pipelineChanged:!1,updatedRowIds:[]};i||(i=s.pipelineChanged);for(let a of s.updatedRowIds)r.add(a)}return i?this.Kr():r.size>0&&this.Ba(),{pipelineChanged:i,updatedRowIds:[...r]}}zu(e,t){if(e.add?.length||e.remove?.length)return!0;if(!t.length)return!1;let i=this._a();if(i===null)return!0;if(!i.length)return!1;let r=this.et;return!r||i.length!==r.fields.length||i.some((o,s)=>o!==r.fields[s])?!0:t.some(({node:o,before:s,after:a})=>un(s,a,i,r.values.get(o)))}_a(){if(this.M||this.e.t.masterDetail||this.za())return null;let e=this.e.r.l();if(e.some(i=>st(i)||i.colDef.autoRowSpan===!0||i.colDef.rowSpan!=null))return null;let t=!this.e.t.manualFiltering;return an({columns:e,customAggregates:this.e.t.aggFuncs,sortModel:this.e.t.manualSorting?[]:this.e.r.Q(),filterModel:t?this.Se:{},advancedFilter:t?this.Me:null,quickFilter:t?this.He:null})}ju(){let e=this._a(),t=e?.length?dn(this.c,e):null;this.et=e&&t?{fields:e,values:t}:null}Ba(){this.e.emit("modelUpdated",{rowCount:this.we.length})}Ro(e,t,i){let r=this.resolveRowId(t,-1,`add-${this.e.Qt()}`);if(this.p.has(r)){this.e.reportError(new Error(`Duplicate row id: ${r}`),"transaction.add",{rowId:r});return}let o=Re(t,this.e.t.childrenKey),s={id:r,data:t,rowIndex:-1,selected:!1,treeChildrenLoaded:Array.isArray(o)};this.p.set(r,s),this.Nr.set(s,i);let a=this.te.get(e.id)??[];if(a.push(s.id),this.te.set(e.id,a),!!o)for(let l of o)l!=null&&this.Ro(s,l,i+1)}Ha(){this.c=[];let e=t=>{this.c.push(t),this.p.has(t.id)||this.p.set(t.id,t);for(let i of this.te.get(t.id)??[]){let r=this.p.get(i);r&&e(r)}};for(let t of this._)e(t)}St(e){let t=JSON.stringify(this.Se),i=new Set(this.e.r.Z().map(o=>o.id));this.Se=te(e,i);let r=JSON.stringify(this.Se)!==t;return r&&(this.et=null),r}Be(){return{...this.Se}}qu(e=this.Me){let t=Object.keys(this.Se).length>0&&this.St(this.Se),i=(e!=null||this.Me!=null)&&this.nt(e);return t||i}nt(e){let t=new Set(this.e.r.Z().map(s=>s.id)),i=H(e,t),r=JSON.stringify(this.Me);this.Me=i,this.e.t.advancedFilterModel=i;let o=JSON.stringify(i)!==r;return o&&(this.et=null),o}Ni(){return H(this.Me)}Mt(e){let t=e!=null&&e.trim()!==""?e:null;return t===this.He?!1:(this.He=t,this.et=null,!0)}Eo(){return this.He}Hi(){return Object.keys(this.Se).length>0||this.Me!=null||this.He!=null}O(){this.Kr(),this.e.$({data:!0})}So(){this.g?this.Ga():this.O()}Kr(){this.et=null;let e=this.e.Ce.start(),t=this.e.r.l(),i=(s,a)=>this.e.d(s,a);if(this.g){this.Yu(e);return}if(this.Xu(e))return;let r,o=[];if(this.M)r=this.Ju(t,i);else{r=this.c,this.Hi()&&!this.e.t.manualFiltering&&(r=r.filter(Bi(t,this.Se,this.Me,this.He,i)));let a=this.e.r.Q();if(a.length>0&&!this.e.t.manualSorting)try{r=_i(r,a,t,i)}catch(d){this.e.reportError(d,"comparator",{sortModel:a})}let l=this.e.r.Je();if(l.length>0){let d=this.Zu(r,l);r=d.rows,o=d.ambiguousExpansions}else if(this.e.t.masterDetail){let d=[];for(let u of r)d.push(u),this.A.has(u.id)&&this.isRowExpandable(u)&&d.push({id:`__detail__${u.id}`,data:u.data,rowIndex:-1,selected:!1,isDetail:!0,masterId:u.id});r=d}}this.Wa(r,e,!0),this.Qu(o)}Wa(e,t,i=!1){for(let o of this.c)o.rowIndex=-1;let r=0;e.forEach((o,s)=>{o.rowIndex=s,!o.isDetail&&!o.isGroup&&this.Fr.set(o,++r)}),this.we=e,this.Vi(),i&&this.ju(),this.ec((o,s)=>this.e.d(o,s)),this.e.emit("modelUpdated",{rowCount:e.length}),this.e.Ce.$a(t)}Yu(e){this.c.forEach((t,i)=>{this.be||(t.rowIndex=i),this.Fr.set(t,this.be?t.rowIndex+1:i+1)}),this.ve=this.c,this.we=this.c,this.Ii.clear(),this.e.t.getRowHeight&&this.e.s.ot(),this.Or++,this.e.emit("modelUpdated",{rowCount:this.c.length}),this.e.Ce.$a(e)}Xu(e){let t=this.bo;return this.bo=!1,!t&&this.za()?(this.tc(e),!0):(this.To(),!1)}za(){if(!this.e.t.dataProcessor||this.c.length<this.e.t.dataProcessorMinRows||this.M||this.e.t.masterDetail||this.e.r.Je().length>0)return!1;let e=!this.e.t.manualFiltering&&this.Hi(),t=!this.e.t.manualSorting&&this.e.r.Q().length>0;return e||t}tc(e){this.To();let t=this.e.t.dataProcessor;if(!t)return;let i=++this.Pi,r=new AbortController;this.Br=r;let o=this.e.r.l(),s=this.c.flatMap(d=>d.data==null?[]:[{id:d.id,data:d.data}]),a=!this.e.t.manualFiltering,l=!this.e.t.manualSorting;Promise.resolve().then(()=>t.process({rows:s,columns:o.map(d=>({colId:d.id,...d.colDef.field?{field:d.colDef.field}:{}})),sortModel:l?this.e.r.Q():[],filterModel:a?this.Be():{},advancedFilterModel:a?this.Ni():null,quickFilterText:a?this.He:null,signal:r.signal})).then(d=>{if(i!==this.Pi||r.signal.aborted||this.e.o())return;let u=new Set,c=[];for(let h of d.rowIds){if(u.has(h))continue;u.add(h);let f=this.p.get(h);f&&!f.isDetail&&!f.isGroup&&c.push(f)}this.Wa(c,e),this.e.$({data:!0})}).catch(d=>{i!==this.Pi||r.signal.aborted||this.e.o()||(this.e.reportError(d,"dataProcessor.process"),this.bo=!0,this.O())}).finally(()=>{i===this.Pi&&(this.Br=null)})}To(){this.Pi++,this.Br?.abort(),this.Br=null}get Te(){return this.e.t.paginationEnabled&&!this.g}Vi(){if(this.e.t.getRowHeight&&this.e.s.ot(),!this.Te){this.ve=this.we,this.Or++;return}let e=this.Bi(),t=this.getPageCount();this.V>t&&(this.V=t),this.V<1&&(this.V=1),this.e.t.paginationPage=this.V;let i=(this.V-1)*e;this.ve=this.e.t.paginationMode==="server"?this.we:this.we.slice(i,i+e),this.ve.forEach((r,o)=>{r.rowIndex=o}),this.Or++}Bi(){return Math.max(1,this.e.t.paginationPageSize)}ei(){return this.Te?this.V:1}getTotalRowCount(){return this.g?this.Gi():this.Te&&this.e.t.paginationMode==="server"?this.e.t.paginationTotal:this.we.length}getPageCount(){return this.Te?Math.max(1,Math.ceil(this.getTotalRowCount()/this.Bi())):1}Ka(){return this.we}setPage(e,t=!1){if(!this.Te)return;let i=this.getPageCount(),r=Math.max(1,Math.min(Math.round(e)||1,i));r!==this.V&&(this.V=r,this.e.t.paginationPage=r,this.Vi(),this.e.$({data:!0}),this.e.s.jr(0,"top"),t||this._i())}setPageSize(e){if(!this.Te)return;let t=Math.max(1,Math.round(e)||this.Bi()),i=(this.V-1)*this.Bi();this.e.t.paginationPageSize=t,this.V=Math.floor(i/t)+1,this.e.t.paginationPage=this.V,this.Vi(),this.e.$({data:!0}),this._i()}Ua(e,t){this.e.t.paginationPageSize=t,this.V=e,this.e.t.paginationPage=this.V}ja(e){this.e.t.paginationEnabled!==e&&(this.e.t.paginationEnabled=e&&!this.g,this.e.t.paginationEnabled&&(this.V=1),e||this.we.forEach((t,i)=>{t.rowIndex=i}),this.Vi(),this.e.$({data:!0}),this._i())}ic(){this.Te&&(this.V=this.e.t.paginationMode==="server"?this.e.t.paginationPage:1,this.Vi(),this.e.$({data:!0}),this._i())}_i(e=this.Bi()){this.e.emit("paginationChanged",{page:this.ei(),pageSize:e,pageCount:this.getPageCount(),total:this.getTotalRowCount()})}Ju(e,t){let i=this.e.t.manualSorting?[]:this.e.r.Q(),r=new Map,o=this.Hi()&&!this.e.t.manualFiltering,s=Bi(e,this.Se,this.Me,this.He,t),a=u=>{let c=r.get(u.id);if(c!==void 0)return c;let h=!0;if(o){h=s(u);for(let f of this.te.get(u.id)??[]){let m=this.p.get(f);m&&a(m)&&(h=!0)}}return r.set(u.id,h),h},l=[],d=u=>{let c=u;i.length>0&&(c=_i(u,i,e,t));for(let h of c)if(a(h)&&(l.push(h),this.A.has(h.id))){let f=(this.te.get(h.id)??[]).map(m=>this.p.get(m)).filter(m=>m!=null);d(f)}};return d(this._),l}rc(){let e=this.Ta,t=0;for(let i of this.ve)!i.isDetail&&!i.isGroup&&(e[t++]=i);return e.length=t,e}nc(e,t,i,r){let o=t.colDef.rowSpan;if(!o)return 1;try{let s=o({api:this.e.api,colDef:t.colDef,column:t,node:e,data:e.data,value:i,rowIndex:e.rowIndex});return Math.max(1,Math.min(Math.round(s)||1,r))}catch(s){return this.e.reportError(s,"rowSpan",{colId:t.id,rowId:e.id}),1}}oc(e,t,i,r,o){if(!i.colDef.autoRowSpan||r==null||r==="")return 1;let s=1;for(;t+s<e.length&&mt(r,o(e[t+s],i))===0;)s++;return s}sc(e,t,i){let r=new Int32Array(e.length),o=0;for(;o<e.length;){let s=e[o],a=i(s,t),l=t.colDef.rowSpan?this.nc(s,t,a,e.length-o):this.oc(e,o,t,a,i);r[o]=l;for(let d=1;d<l;d++)r[o+d]=-1;o+=l}return r}ec(e){if(this.Ii.clear(),this.M||this.e.t.masterDetail||this.e.r.Je().length>0)return;let t=this.e.r.l().filter(r=>r.colDef.rowSpan!=null||r.colDef.autoRowSpan===!0);if(t.length===0)return;let i=this.rc();if(i.length!==0)for(let r of t)this.Ii.set(r.id,this.sc(i,r,e))}ac(e){return this.Ii.get(e)}qa(e){return this.Fr.get(e)??0}Ur(e){return this.Nr.get(e)??0}Zu(e,t){let i=yt(this.e.t.aggFuncs),r=this.e.r.Du();this.Mi=[];let o=l=>{let d={};for(let u of r){let c=i(u.colDef.aggFunc);if(c)try{d[u.id]=tn(l,c,h=>this.e.d(h,u))}catch(h){this.e.reportError(h,"aggFunc",{colId:u.id,aggFunc:u.colDef.aggFunc}),d[u.id]=null}}return d},s=sn(this.z,this.c,t,(l,d)=>this.e.d(l,d));this.z=s.expanded;let a=on(e,t,(l,d)=>this.e.d(l,d),o,this.z);return this.Mi=a.ids,{rows:a.rows,ambiguousExpansions:s.ambiguous}}Qu(e){for(let t of e){if(this.e.o())return;this.e.reportError(new Error(`Ambiguous legacy group expansion: ${t}`),"gridState.groupExpansion",{groupId:t})}}isRowExpandable(e){let t=this.M;if(t){if(this.xo(e.id)||e.treeLoading)return!0;if(e.treeChildrenLoaded||!e.data||!this.e.t.loadTreeChildren)return!1}else if(!this.e.t.masterDetail)return!1;let i=t?"isTreeRowExpandable":"isRowExpandable",r=this.e.t[i];if(!r)return!t;try{return r({data:e.data,node:e,api:this.e.api})}catch(o){return this.e.reportError(o,i,{rowId:e.id}),!1}}isRowExpanded(e){return this.A.has(e)}lc(){return[...this.A]}dc(){return[...this.z]}uc(e,t){this.A=new Set(e.filter(i=>this.p.has(i))),this.z=new Set(t)}cc(e){return this.Mo(e,!0)}hc(e){return this.Mo(e,!1)}qr(e){return this.Mo(e,!this.A.has(e))}Mo(e,t){let i=this.p.get(e);return!i||t&&!this.isRowExpandable(i)?!1:(t===this.A.has(e)||(t?this.A.add(e):this.A.delete(e),this.O(),this.e.emit("detailToggled",{rowId:e,rowNode:i,expanded:t}),t&&this.M&&!this.xo(e)&&!i.treeLoading&&this.loadTreeChildren(e).catch(()=>{})),t)}setAllDetailsExpanded(e){let t=!1;if(e)for(let i of this.c)!this.A.has(i.id)&&this.isRowExpandable(i)&&(this.A.add(i.id),t=!0);else this.A.size>0&&(this.A.clear(),t=!0);t&&this.O()}Io(e){return this.setGroupExpanded(e,!this.z.has(e))}isGroupExpanded(e){return this.z.has(e)}setAllGroupsExpanded(e){let t=this.z.size;if(e)for(let i of this.Mi)this.z.add(i);else this.z.clear();this.z.size!==t&&this.O()}setGroupExpanded(e,t){return!this.Mi.includes(e)||t===this.z.has(e)||(t?this.z.add(e):this.z.delete(e),this.O()),t}Ya(){return!this.M&&!this.g&&!this.e.t.dataProcessor&&this.e.t.paginationMode!=="server"&&this.e.r.Q().length===0&&this.e.r.Je().length===0}Xa(e,t){if(!this.Ya()||!Number.isInteger(e)||!Number.isInteger(t))return!1;let i=this.h(e),r=this.h(t);if(!i||!r||i.isDetail||r.isDetail||i.isGroup||r.isGroup)return!1;let o=this.c.indexOf(i),s=this.c.indexOf(r);return o<0||s<0||o===s?!1:(this.c.splice(o,1),this.c.splice(s,0,i),this.O(),!0)}Oe(){return this.c}pc(){return this._}It(){return this.ve}G(){return this.be?this.Zt():this.ve.length}h(e){return this.be?e<0||e>=this.Zt()?void 0:this.tt.get(e)??this.Lu(e):this.ve[e]}F(e){return this.p.get(e)}fc(e){this.c.forEach(e)}mc(e){let t=0;for(let i of this.we)i.isDetail||i.isGroup||e(i,t++)}};var Tt=class{constructor(e){this.e=e;this.L=new Set;this.At=null;this.zi=new Set}$r(e){return this.L.has(e)}gc(e){return this.zi.has(e)}ze(e,t){if(e.loading)return!1;if(e.isGroup||e.isDetail)return!0;let i=t===void 0?this.Ao():t,r=i?.colDef.selectable;if(!i||!r)return!0;try{return r({api:this.e.api,colDef:i.colDef,column:i,node:e,data:e.data,value:this.e.d(e,i),rowIndex:e.rowIndex})}catch(o){return this.e.reportError(o,"selectable",{rowId:e.id,colId:i.id}),!1}}Ao(){return this.e.r.l().find(e=>e.hasCheckbox&&e.colDef.selectable!=null)}ti(){return this.e.i.Oe().filter(e=>this.L.has(e.id))}Ja(e=this.ti()){return e.filter(t=>t.data!=null).map(t=>t.data)}ko(){return[...this.L]}Za(e){let t=new Set(e),i=this.Ao()??null,r=this.e.i.Oe().filter(o=>t.has(o.id)&&!o.isDetail&&!o.isGroup&&this.ze(o,i)).map(o=>({node:o,selected:!0}));this.kt(r,!0)}yc(){this.Za(this.e.t.rowSelection==="none"?[]:this.ko())}Oa(e){let t=this.e.i;if(!e)this.L.clear(),this.At=null;else{for(let i of this.L)t.F(i)||this.L.delete(i);this.At!=null&&!t.F(this.At)&&(this.At=null)}this.Qa(null);for(let i of t.Oe())i.selected=this.L.has(i.id)}tl(e){let{selectable:t,selected:i}=this.il(e.leafNodes??[],!1);return{all:i>0&&i===t,some:i>0}}vc(e,t){let i=(e.leafNodes??[]).filter(r=>this.ze(r));i.length!==0&&this.kt(i.map(r=>({node:r,selected:t})))}Po(e,t,i=!1){this.kt([{node:e,selected:t,clearOthers:i}])}bc(e,t=!0,i=!0){let r=this.e.i.F(e);r&&this.Po(r,t,i)}wc(e,t,i){if(!i||!t.shiftKey||this.At==null)return!1;let r=this.e.i.F(this.At);if(!r||r.rowIndex<0||e.rowIndex<0)return!1;let o=Math.min(r.rowIndex,e.rowIndex),s=Math.max(r.rowIndex,e.rowIndex),a=[];for(let l=o;l<=s;l++){let d=this.e.i.h(l);d&&!d.isDetail&&!d.isGroup&&a.push({node:d,selected:!0})}return this.kt(a),!0}rl(e,t,i){let r=this.e.t.rowSelection;if(r==="none"||!this.ze(e))return;let o=r==="multiple",s=o&&(i||t.ctrlKey||t.metaKey);!s&&this.wc(e,t,o)||(this.Po(e,!s||!e.selected,!s),this.At=e.id)}selectAll(e=!0){if(this.e.t.rowSelection==="none")return;let i=e?this.e.i.It():this.e.i.Oe();this.kt(i.filter(r=>!r.isDetail&&!r.isGroup).map(r=>({node:r,selected:!0})))}deselectAll(){this.kt([],!0)}Cc(){let e=this.e.i,{selectable:t,selected:i}=this.il(e.It(),!0),r=i>0&&i===t&&(!e.g||t>=e.Gi());return{all:r,some:i>0&&!r}}il(e,t){let i=0,r=0;for(let o of e)t&&(o.isDetail||o.isGroup)||!this.ze(o)||(i++,this.L.has(o.id)&&r++);return{selectable:i,selected:r}}Tc(e,t){let i=this.e.i,r=this.e.t.rowSelection==="single",o=!r&&i.M&&this.e.t.autoCheckedChildren,s=(a,l,d=!1)=>{if(l?(d||this.ze(a,t))&&this.L.add(a.id):this.L.delete(a.id),!!o)for(let u of i.Fi(a.id)){let c=i.F(u);c&&s(c,l)}};for(let{node:a,selected:l}of e)if(s(a,l,!0),r&&l)break}Dc(e){let t=new Set(e);for(let i of this.L)t.delete(i)||t.add(i);return t}xc(e){let t=[];for(let i of this.e.i.Oe()){let r=this.L.has(i.id);(i.selected!==r||e.has(i.id)||this.zi.has(i.id))&&i.rowIndex>=0&&t.push(i.rowIndex),i.selected=r}return t}kt(e,t=!1){let i=this.e.t.rowSelection,r=this.Ao()??null,o=e.filter(u=>!u.selected||i!=="none"&&this.ze(u.node,r));if(e.length>0&&o.length===0)return;let s=new Set(this.L);(t||o.some(u=>u.selected?i==="single"||u.clearOthers:u.clearOthers&&this.ze(u.node,r)))&&this.L.clear(),this.Tc(o,r);let a=new Set(this.zi);this.Qa(r);let l=this.Dc(s),d=this.xc(a);if(l.size>0){this.e.s.O(d),this.e.W.Wr();let u=this.ti();this.e.emit("selectionChanged",{selectedNodes:u,selectedRows:this.Ja(u)})}}Qa(e){this.zi.clear();let t=this.e.i;if(this.e.t.rowSelection!=="multiple"||!t.M||this.L.size===0)return;let i=r=>{let o=e&&t.F(r),s=!o||this.ze(o,e),a=!0,l=!1;for(let d of t.Fi(r)){let u=i(d);a&&(a=u.all),l||(l=u.some)}if(a&&!l){s||this.L.delete(r);let d=this.L.has(r);return{all:d||!s,some:d}}return s&&a?this.L.add(r):(this.L.delete(r),s&&l&&this.zi.add(r)),{all:a,some:l}};for(let r of t.pc())i(r.id)}};var Dt=class{constructor(e){this.e=e;this.Pt=null;this.ie=0;this.st=0;this.We=null;this.ii=null;this.Wi=e=>{let t=this.No(e);t&&(this.st=this.sl(t,e.clientX),t.didResize||(t.didResize=Math.abs(this.st-t.startWidth)>=.5),!this.ie&&(this.ie=requestAnimationFrame(()=>{this.ie=0,this.Sc()})))};this.ni=e=>{let t=this.No(e);t&&(this.st=this.sl(t,e.clientX),t.didResize||(t.didResize=Math.abs(this.st-t.startWidth)>=.5),this.Mc(t))};this.Yr=e=>{this.No(e)&&this.at()};this.Ic=()=>{this.at()};this.Fo=e=>{e.key==="Escape"&&(e.preventDefault(),this.at())}}Rc(e,t){if(!this.e.t.enableColumnResize||!t.resizable||e.isPrimary===!1)return;this.at();let i=e.currentTarget,r=t.currentWidth;this.st=r,this.Pt={column:t,didResize:!1,handle:i,pointerId:e.pointerId,startFlex:t.flex,startManualWidth:t.manualWidth,startWidth:r,startX:e.clientX,startPreserveWidths:this.e.r.Xe},this.Go(i,!0);try{i.setPointerCapture?.(e.pointerId)}catch{}this.e.n.root.classList.add("mach-root--resizing"),i.classList.add("mach-header-resize--active"),this.Ec(this.Pt)}at(e=!0){let t=this.Pt;t&&(this.Pt=null,this.Lo(),this.Go(t.handle,!1),e&&(this.nl(t),this.e.ri()),this.e.n.root.classList.remove("mach-root--resizing"),this.ol(t))}nl(e){e.column.manualWidth=e.startManualWidth,e.column.flex=e.startFlex,e.column.currentWidth=e.startWidth,this.e.r.Xe=e.startPreserveWidths}Mc(e){this.Pt=null,this.Lo(),e.didResize&&(Math.abs(this.st-e.startWidth)<.5?this.nl(e):this.e.r.Ee(e.column,this.st),this.e.ri()),this.Go(e.handle,!1);try{e.handle.releasePointerCapture?.(e.pointerId)}catch{}this.e.n.root.classList.remove("mach-root--resizing"),this.ol(e),e.didResize&&this.e.lt([e.column])}Sc(){let e=this.Pt;!e?.didResize||!this.e.r.Ee(e.column,this.st)||(this.e.ri(),this.$i(e),this.e.al(e.column,!1))}Ec(e){this.We=p("div","mach-column-resize-guide"),this.We.setAttribute("aria-hidden","true"),this.ii=p("span","mach-column-resize-label"),this.We.appendChild(this.ii),this.e.n.root.appendChild(this.We),this.$i(e)}$i(e){if(!this.We||!this.ii)return;let t=this.e.n.root,i=t.getBoundingClientRect(),r=e.handle.parentElement.getBoundingClientRect(),o=Math.max(0,Math.min(t.clientWidth,r.right-i.left-t.clientLeft)),s=Math.max(32,Math.min(t.clientWidth-32,o));this.We.style.left=`${o}px`,this.We.style.top=`${Math.max(0,r.top-i.top-t.clientTop)}px`,this.ii.style.left=`${s-o}px`,this.ii.textContent=`${Math.round(e.column.currentWidth)} px`}ol(e){e.handle.classList.remove("mach-header-resize--active"),this.We?.remove(),this.We=null,this.ii=null}sl(e,t){let i=Number.isFinite(t)?t:e.startX;return j(Math.max(1,e.startWidth+i-e.startX),{minWidth:e.column.minWidth??e.column.colDef.minWidth,maxWidth:e.column.colDef.maxWidth})}No(e){let t=this.Pt;return t&&e.pointerId===t.pointerId?t:null}Lo(){this.ie&&cancelAnimationFrame(this.ie),this.ie=0}Go(e,t){S(window,t,{pointermove:this.Wi}),S(window,t,{pointerup:this.ni,pointercancel:this.Yr,keydown:this.Fo},!0),S(e,t,{lostpointercapture:this.Ic})}destroy(){this.at(!1),this.Lo(),this.e.n.root?.classList.remove("mach-root--resizing")}};var cn=6,xt=class{constructor(e){this.e=e;this.Ki=null;this.oi=null;this.Oo=!1;this.se=0;this.Xr=null;this.Wi=e=>{if(this.oi){this.Pc(e);return}let t=this.Ki;t&&(Math.abs(e.clientX-t.startX)<cn&&Math.abs(e.clientY-t.startY)<cn||this.Gc(e))};this.ni=e=>{this.Ki=null,e.type!=="pointercancel"&&this.oi&&this.Vo(e.clientX,e.clientY),this.Ho();let t=this.ll();t&&e.type!=="pointercancel"&&t.targetIndex>=0&&this.e.Ei(t.column.id,t.targetIndex)}}Ac(e,t){e.button===0&&t.movable&&(this.Ki={column:t,startX:e.clientX,startY:e.clientY},this.Ui(!0))}Ui(e){S(window,e,{pointermove:this.Wi,pointerup:this.ni,pointercancel:this.ni})}kc(){let e=this.Oo;return this.Oo=!1,e}Gc(e){let t=this.Ki;if(!t)return;let i=this.e.W.Gt(t.column.id,this.e.r.ge(t.column));if(!i||!i.parentElement){this.Ho();return}this.Oo=!0;let r=p("div","mach-drop-indicator"),o=p("div","mach-column-drag-ghost");o.textContent=t.column.colDef.headerName??t.column.colDef.field??t.column.id,o.ariaHidden="true",A(o,this.e.n.root),document.body.appendChild(o),i.parentElement.appendChild(r),i.classList.add("mach-header-cell--dragging"),this.e.n.root.classList.add("mach-root--dragging");let s=this.e.r.ge(t.column),a=this.e.n.si[s],l=this.e.r.R(s),d=new Float64Array(l.length+1),u=new Float64Array(l.length);for(let h=0;h<l.length;h++){let f=l[h].currentWidth;u[h]=d[h]+f/2,d[h+1]=d[h]+f}let c=o.getBoundingClientRect();this.oi={column:t.column,cellEl:i,ghost:o,indicator:r,targetIndex:-1,pane:s,containerLeft:a.getBoundingClientRect().left,startScrollLeft:this.e.n.b.center.scrollLeft,fromIndex:l.indexOf(t.column),midpoints:u,offsets:d,ghostWidth:c.width,ghostHeight:c.height},this.Vo(e.clientX,e.clientY)}Pc(e){this.Xr={clientX:e.clientX,clientY:e.clientY},!this.se&&(this.se=requestAnimationFrame(()=>{this.se=0;let t=this.Xr;this.Xr=null,t&&this.Vo(t.clientX,t.clientY)}))}Vo(e,t){let i=this.oi;if(!i)return;let r=T(e+12,8,window.innerWidth-i.ghostWidth-8),o=T(t+12,8,window.innerHeight-i.ghostHeight-8);i.ghost.style.transform=`translate3d(${r}px, ${o}px, 0)`;let s=i.pane==="center"?this.e.n.b.center.scrollLeft-i.startScrollLeft:0,a=e-(i.containerLeft-s),l=i.midpoints.length;for(let d=0;d<i.midpoints.length;d++)if(a<i.midpoints[d]){l=d;break}i.targetIndex=l>i.fromIndex?l-1:l,i.indicator.style.transform=`translate3d(${i.offsets[l]}px, 0, 0)`}ll(){let e=this.oi;return e?(this.oi=null,e.cellEl.classList.remove("mach-header-cell--dragging"),e.ghost.remove(),e.indicator.remove(),this.e.n.root.classList.remove("mach-root--dragging"),e):null}Ho(){this.Ui(!1),this.se&&cancelAnimationFrame(this.se),this.se=0,this.Xr=null}destroy(){this.Ho(),this.ll(),this.Ki=null}};var Wi=/^[+-]?(?:\d+(?:\.\d+)?|\.\d+)(?:[eE][+-]?\d+)?$/;function Rt(n,e=!0){if(n==="")return null;if(!e||typeof n!="string"||!Wi.test(n)||/^[+-]?0\d/.test(n))return n;let t=Number(n);return Number.isFinite(t)&&(!Number.isInteger(t)||Number.isSafeInteger(t))?t:n}function $i(n,e){let t=n==null?"":String(n);return t.includes(e)||t.includes('"')||t.includes(`
|
|
2
2
|
`)||t.includes("\r")?'"'+t.replace(/"/g,'""')+'"':t}function ce(n){return typeof n!="string"||n===""||Wi.test(n)?n:/^[\s\u0000-\u001f]*[=+\-@]/.test(n)?"'"+n:n}function hn(n,e={}){let t=e.columnSeparator??",",i=e.protectFormulas??!0,r=n.map(o=>o.map(s=>$i(i?ce(s):s,t)).join(t)).join(`\r
|
|
3
3
|
`);return e.prependBOM?"\uFEFF"+r:r}function pn(n){return n==null?"":String(n)}function Ws(n,e){return $i(e?ce(n):n," ")}function Et(n,e=!0){return n.map(t=>t.map(i=>Ws(i,e)).join(" ")).join(`
|
|
4
4
|
`)}function St(n){return It(n," ")}function Mt(n,e=","){return It(n,e)}function It(n,e){let t=[],i=[],r="",o=!1,s=0;for(;s<n.length;){let a=n[s];a==='"'&&(o||r==="")?o&&n[s+1]==='"'?(r+=a,s++):o=!o:o?r+=a:a===e?(i.push(r),r=""):a===`
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var je="0.42.1";function v(n,e){return Object.prototype.hasOwnProperty.call(n,e)}function x(n,e,t=!1){if(!(typeof n!="number"||!Number.isFinite(n)||n<e))return t?Math.floor(n):n}function E(n,e,t,i=!1){return x(n,t,i)??e}function I(n){return x(n,0)||void 0}function qe(n){return!n||typeof n.key!="string"||!n.key.trim()?null:{key:n.key.trim(),debounceMs:x(n.debounceMs,0,!0)??160,...n.sections?{sections:[...new Set(n.sections)]}:{},...n.store?{store:n.store}:{}}}function R(n,e,t,i=!1){let r=!1;for(let o of t)(i?v(n,o):n[o]!=null)&&(e[o]=n[o],r=!0);return r}var Zt=new WeakMap,Ye=new WeakMap;function Se(n){let e=Zt.get(n);return e||(e={},Zt.set(n,e)),e}function Qt(n){return Zt.get(n)}function Xe(n,e){e?Ye.set(n,e):Ye.delete(n)}function Je(n){let e=Ye.get(n);return Ye.delete(n),e}function p(n,e,t){let i=document.createElement(n);if(e&&(i.className=e),t)for(let r of Object.keys(t))i.setAttribute(r,t[r]);return i}function $(n,e,t){let i=p("button",n);return i.type="button",i.textContent=e,i.addEventListener("click",t),i}function S(n,e,t,i=!1){let r=e?"addEventListener":"removeEventListener";for(let[o,s]of Object.entries(t))n[r](o,s,i)}function V(n,e,t){S(document,n,{mousedown:e,keydown:t},!0)}function A(n,e){if(n.classList.add("mach-portal"),!e)return;let t=window.getComputedStyle(e);for(let i=0;i<t.length;i++){let r=t.item(i);if(!r.startsWith("--mach-"))continue;let o=t.getPropertyValue(r).trim();o&&n.style.setProperty(r,o)}n.style.colorScheme=t.colorScheme}function T(n,e,t){return n<e?e:n>t?t:n}function ee(n,e,t=4){let i=e.getBoundingClientRect(),r=n.getBoundingClientRect(),o=i.bottom+t,s=o+r.height>window.innerHeight-8?i.top-r.height-t:o;n.style.left=`${T(i.left,8,Math.max(8,window.innerWidth-r.width-8))}px`,n.style.top=`${T(s,8,Math.max(8,window.innerHeight-r.height-8))}px`}var ar=0;function lr(n="rg"){return ar++,`${n}-${ar}`}var dr='<svg viewBox="0 0 16 16" width="12" height="12" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><path d="M2 3.5h12L9.5 8v4.5L6.5 14V8L2 3.5z"/></svg>',ur='<svg viewBox="0 0 16 16" width="10" height="10" fill="currentColor"><path d="M8 3l4 5H4l4-5z"/></svg>',cr='<svg viewBox="0 0 16 16" width="10" height="10" fill="currentColor"><path d="M8 13l4-5H4l4 5z"/></svg>',hr='<svg viewBox="0 0 16 16" width="12" height="12" fill="none" stroke="currentColor" stroke-width="1.35" stroke-linecap="round"><path d="M2 4h3m3 0h6M2 8h7m3 0h2M2 12h1m3 0h8"/><circle cx="6.5" cy="4" r="1.35"/><circle cx="10.5" cy="8" r="1.35"/><circle cx="4.5" cy="12" r="1.35"/></svg>';function fe(n,e,t,i,r=e.rowIndex){return{api:n.api,colDef:t.colDef,column:t,node:e,data:e.data,value:i,rowIndex:r}}function ei(n){if(n==null)return"";if(n instanceof Date)return n.toLocaleDateString();if(typeof n=="object")try{return JSON.stringify(n)}catch{return String(n)}return String(n)}function L(n,e){let t=Qt(e);if(!t)return;t.flashTimer&&clearTimeout(t.flashTimer),t.flashTimer=void 0;let i=t.destroy;if(t.destroy=void 0,t.refresh=void 0,t.rendererDefinition=void 0,t.rendererRowId=void 0,t.rendererColumnId=void 0,!!i)try{i()}catch(r){n.reportError(r,"cellRenderer.destroy",{colId:e.dataset.colId})}}function pr(n,e,t,i,r,o){let s=n.t.tooltipComponent?"":o,a=i.colDef.tooltipValueGetter;if(a)try{s=a({api:n.api,colDef:i.colDef,column:i,node:t,data:t.data,value:r})??o}catch(l){n.reportError(l,"tooltipValueGetter",{colId:i.id,rowId:t.id})}s?e.setAttribute("title",s):e.removeAttribute("title")}function ro(n,e,t,i,r,o){let s=Qt(e);if(!s?.refresh||s.rendererDefinition!==r||s.rendererRowId!==t.id||s.rendererColumnId!==i.id)return!1;try{return e.querySelector(":scope > .mach-cell-edit-trigger")?.remove(),s.refresh(o)!==!1}catch(a){return n.reportError(a,"cellRenderer.refresh",{colId:i.id,rowId:t.id}),!1}}function me(n,e,t){return q(n,e,t,n.d(e,t))}function q(n,e,t,i){let r=t.colDef.valueFormatter;if(r)try{let o=r({api:n.api,colDef:t.colDef,column:t,node:e,data:e.data,value:i});return o==null?"":String(o)}catch(o){n.reportError(o,"valueFormatter",{colId:t.id,rowId:e.id})}return ei(i)}function no(n,e,t,i){let r=i.colDef.cellStyle,o=Se(e),s=o.styleKeys;if(s)for(let d of s)Reflect.set(e.style,d,"");if(!r){o.styleKeys=void 0;return}let a;if(typeof r=="function"){let d=n.d(t,i);try{a=r(fe(n,t,i,d))}catch(u){n.reportError(u,"cellStyle",{colId:i.id,rowId:t.id}),a=null}}else a=r;if(!a){o.styleKeys=void 0;return}let l=Object.keys(a);for(let d of l)Reflect.set(e.style,d,Reflect.get(a,d));o.styleKeys=l}function oo(n,e){let t=n.firstElementChild,i=t?.className==="mach-cell-text"?t:p("span","mach-cell-text");i.textContent!==e&&(i.textContent=e),n.replaceChildren(i)}function so(n,e,t,i){let r=n.d(t,i),o=q(n,t,i,r),s=i.colDef.cellRenderer,a=typeof s=="string"?n.mu(s):s,l=o;if(a){let d={api:n.api,colDef:i.colDef,column:i,node:t,data:t.data,value:r,formatted:o,rowIndex:t.rowIndex,rendererParams:i.colDef.cellRendererParams};if(ro(n,e,t,i,a,d)){pr(n,e,t,i,r,o);return}L(n,e);try{l=a(d)}catch(u){n.reportError(u,"cellRenderer",{colId:i.id,rowId:t.id})}}else L(n,e);if(typeof l=="string")oo(e,l);else if(l instanceof HTMLElement)e.replaceChildren(l);else if(l&&typeof l=="object"&&l.el instanceof HTMLElement){let d=l;e.replaceChildren(d.el);let u=Se(e);u.destroy=d.destroy,d.refresh&&(u.refresh=c=>d.refresh(c),u.rendererDefinition=a,u.rendererRowId=t.id,u.rendererColumnId=i.id)}else e.textContent="";pr(n,e,t,i,r,o)}function Ze(n){let{align:e}=n.colDef;return e==="left"?"mach-cell--left":e==="right"?"mach-cell--right":"mach-cell--center"}function ao(n,e,t,i){let r=i.colDef.cellClass;if(!r)return;if(typeof r=="string"){e.push(r);return}if(Array.isArray(r)){e.push(...r);return}let o=fe(n,t,i,n.d(t,i));try{let s=r(o);typeof s=="string"?e.push(s):Array.isArray(s)&&e.push(...s)}catch(s){n.reportError(s,"cellClass",{colId:i.id,rowId:t.id})}}function lo(n,e,t){e.classList.contains("mach-cell--focus")&&n.push("mach-cell--focus"),e.classList.contains("mach-cell--editing")&&n.push("mach-cell--editing"),t.colDef.wrapText&&n.push("mach-cell--wrap")}function ti(n,e,t,i){let r=["mach-cell",Ze(i)];ao(n,r,t,i),lo(r,e,i);let o=r.join(" ");e.className!==o&&(e.className=o)}function Qe(n,e,t,i){so(n,e,t,i),ti(n,e,t,i),no(n,e,t,i)}function Me(n,e){return n&&v(n,e)?n[e]:void 0}function et(n,e){if(n==null||n===""||!e||typeof e!="object")return;let t=Me(e,String(n));return typeof t=="string"?{color:t}:t}var tt=class{constructor(e){this.e=e;this.to="";this.ro=[];this.la=0;this.xi=!0}no(e){this.gu()&&(this.xi=!0,e=void 0);let t=this.xi?this.da():void 0,i=t&&co(t,e),r=e?.columns&&new Set(e.columns),o=!1;for(let s of this.e.r.l()){if(s.minWidth!=null&&(!i||r&&!r.has(s.id)))continue;let a=this.yu(s);if(o=s.minWidth!==a||o,s.minWidth=a,uo(s)){let l=this.ua(s,t);o=l!==s.contentWidth||o,s.contentWidth=l}}return this.xi=!1,o&&(this.e.r.Xe=!1),o}gu(){let e=Array.from(document.fonts??[]).filter(s=>s.status==="loaded"),t=e.length!==this.ro.length||e.some((s,a)=>s!==this.ro[a]);t&&(this.ro=e,this.la++);let i=getComputedStyle(this.e.n.root),r=`${i.getPropertyValue("--mach-header-font-weight")||650} ${i.fontSize} ${i.fontFamily}`,o=r!==this.to||t;return this.to=r,o}da(){let e=this.e.i.Oe(),t=Math.min(e.length,100);return Array.from({length:t},(i,r)=>e[Math.floor(r*(e.length-1)/Math.max(t-1,1))])}oo(e,t){return this.Di===void 0&&(this.Di=p("canvas").getContext("2d")),this.Di?(this.Di.font=t??this.to,this.Di.measureText(e).width):t?1/0:e.replace(/[^\x00-\xff]/g,"mm").length*7}yu(e){let t=e.colDef,i=t.headerName??t.field??e.id;return Math.ceil(Math.max(t.minWidth??0,this.oo(i)+i.length*.15+28+(e.sortable?20:0)+(e.filterable?28:0)+(this.e.t.columnMenu&&!e.hasCheckbox&&!t.suppressColumnMenu?22:0)))}ua(e,t=this.da()){let i=28;for(let r of t){let o=this.e.d(r,e),s=et(o,e.colDef.status)?.label??q(this.e,r,e,o);i=Math.max(i,this.oo(s.slice(0,128))+(e.colDef.status?44:28))}return Math.ceil(Math.min(I(e.colDef.maxWidth)??360,i))}};function uo(n){let{width:e,autoWidth:t}=n.colDef;return n.manualWidth==null&&e==null&&t!==!1&&!n.hasCheckbox&&!n.isDetailToggle}function co(n,e){if(!e?.rowIds&&!e?.rowIndexes)return!0;let t=new Set(e.rowIds),i=new Set(e.rowIndexes);return n.some(r=>t.has(r.id)||i.has(r.rowIndex))}var it=class{constructor(e){this.vu=e;this.xr=new Map}on(e,t){let i=this.xr.get(e);return i||(i=new Set,this.xr.set(e,i)),i.add(t),()=>{i.delete(t)}}emit(e,t){let i=this.xr.get(e);if(i)for(let r of[...i])try{r(t)}catch(o){console.error(`[mach-table] error in "${e}" listener`,o),this.vu?.(o,e)}}clear(){this.xr.clear()}};var ho=new Set(["__proto__","prototype","constructor"]),Ie=new Map;function ii(n){if(typeof n!="string"||n.length===0)return null;let e=Ie.get(n);if(e!==void 0)return e;let t=n.split("."),i=t.every(r=>r.length>0&&!ho.has(r))?t:null;return n.length<=1024&&(Ie.size>=256&&Ie.delete(Ie.keys().next().value),Ie.set(n,i)),i}function ri(n){return ii(n)!==null}function K(n,e){if(n==null)return;let t=ii(e);if(!t)return;let i=n;for(let r of t){if(i==null)return;i=i[r]}return i}function Ae(n,e,t){if(n==null)return!1;let i=ii(e);if(!i)return!1;let r=n;for(let o=0;o<i.length-1;o++){if(typeof r!="object"&&typeof r!="function"||r===null)return!1;r[i[o]]==null&&(r[i[o]]={}),r=r[i[o]]}return typeof r!="object"&&typeof r!="function"||r===null?!1:(r[i[i.length-1]]=t,!0)}var ge={text:["contains","notContains","equals","notEquals","startsWith","endsWith","blank","notBlank"],number:["equals","notEquals","lessThan","lessThanOrEqual","greaterThan","greaterThanOrEqual","inRange","blank","notBlank"],date:["equals","notEquals","lessThan","greaterThan","inRange","blank","notBlank"]};var po=16,fo=512,mo=20,go=2e3,yo=2e3,vo={text:new Set(ge.text),number:new Set(ge.number),date:new Set(ge.date)};function bo(n){return n==null||typeof n=="string"||typeof n=="number"&&Number.isFinite(n)}function wo(n,e,t){if(n==null||typeof n!="object")return null;let i=n;return typeof i.match!="string"||!t.has(i.match)?null:{match:i.match,...Co(i,e)}}function Co(n,e){let t=e==="number"?x(n.value,-1/0):typeof n.value=="string"?n.value:void 0,i=e==="number"?x(n.value2,-1/0):typeof n.value2=="string"?n.value2:void 0;return{...t!==void 0?{value:t}:{},...i!==void 0?{value2:i}:{}}}function To(n,e){let t=[],i=vo[e];for(let r of n.slice(0,mo)){let o=wo(r,e,i);o&&t.push(o)}return t}function ni(n){if(n==null||typeof n!="object")return null;let e=n;return e.type==="set"?Array.isArray(e.values)?{type:"set",values:e.values.filter(bo).slice(0,go)}:null:e.type!=="text"&&e.type!=="number"&&e.type!=="date"||!Array.isArray(e.conditions)?null:{type:e.type,...e.operator==="or"||e.operator==="and"?{operator:e.operator}:{},conditions:To(e.conditions,e.type)}}function Do(n,e){if(typeof n.colId!="string"||!n.colId.trim())return null;let t=n.colId.trim();if(e.validColumnIds?.has(t)===!1)return null;let i=ni(n.filter);return i?{kind:"condition",colId:t,filter:i}:null}function xo(n,e,t){if(!Array.isArray(n.children))return null;let i=[];for(let r of n.children){let o=fr(r,e+1,t);o&&i.push(o)}return i.length===0?null:{kind:"group",operator:n.operator==="or"?"or":"and",children:i,...n.not===!0?{not:!0}:{}}}function Ro(n,e,t){return e<=po&&t.nodes<fo&&n!=null&&typeof n=="object"}function fr(n,e,t){if(!Ro(n,e,t)||t.ancestors.has(n))return null;t.ancestors.add(n),t.nodes++;let i=n,r=i.kind==="condition"?Do(i,t):i.kind==="group"?xo(i,e,t):null;return t.ancestors.delete(n),r}function B(n,e){if(n==null||typeof n!="object")return null;let t=n;if(t.version!==1||t.root==null)return null;let i=fr(t.root,0,{ancestors:new WeakSet,nodes:0,validColumnIds:e});return i?{version:1,root:i}:null}function Eo(n,e){return{kind:"condition",colId:n,filter:e}}function le(n,e){if(n==null||typeof n!="object"||Array.isArray(n))return{};let t={};for(let[i,r]of Object.entries(n).slice(0,yo)){let o=i.trim();if(!o||e?.has(o)===!1)continue;let s=ni(r);s&&(t[o]=s)}return t}function So(n,e,t={}){return{kind:"group",operator:n,children:e,...t.not?{not:!0}:{}}}var oi={align:"center",sortable:!0,resizable:!0,movable:!0,filter:!1,minWidth:80},ke={compact:{rowHeight:30,headerHeight:34,fontSize:12,cellPadding:6},normal:{rowHeight:36,headerHeight:40,fontSize:13,cellPadding:9},large:{rowHeight:44,headerHeight:48,fontSize:14,cellPadding:12}},Pe={multiSort:!0,stripedRows:!1,showCellBorders:!1,quickFilterText:null,suppressCellFocus:!1,suppressRowHoverHighlight:!1,suppressNoRowsOverlay:!1,suppressHeaderFocus:!1,loading:!1,error:null,className:"",singleClickEdit:!1,manualSorting:!1,manualFiltering:!1,showSummary:!1,rowNumber:!1,indexOffset:0,applyRowDrag:!0,masterDetail:!1,detailToggleColumn:!0,treeData:!1,childrenKey:"children",autoCheckedChildren:!0,defaultExpandAll:!1,columnMenu:!1,suppressWarnings:!1,enableRangeSelection:!1,suppressClipboard:!1,contextMenu:!1,flashCells:!0,fillHandle:!0,ariaLabel:"MachTable data grid",ariaLabelledBy:"",ariaDescribedBy:"",overlayNoRowsTemplate:"",overlayLoadingTemplate:"",overlayErrorTemplate:"",allowUnsafeOverlayHtml:!1},Mo=Object.keys(Pe);function Io(n){let e={};for(let t of Mo)e[t]=n[t]??Pe[t];return e}function Ao(n){return n&&v(ke,n)?n:"normal"}function ko(n,e){let t=typeof n.pagination=="object"&&Array.isArray(n.pagination?.pageSizeOptions)?n.pagination.pageSizeOptions:void 0,i=t?[...new Set(t.map(r=>E(r,0,1,!0)).filter(Boolean))]:[10,20,50,100];return i.includes(e)||i.push(e),i.sort((r,o)=>r-o)}function si(n,e){let t=typeof n=="function"?n(e):K(e,n);return t==null?"":String(t)}function Po(n,e){let t=ke[e],i=n.rowKey;return{columnDefs:Array.isArray(n.columnDefs)?n.columnDefs:[],rowData:Array.isArray(n.rowData)?n.rowData:[],defaultColDef:{...oi,...n.defaultColDef??{}},columnTypes:n.columnTypes??{},...i?{resolveRowId:({data:r})=>si(i,r),rowKey:i}:{},rowHeight:E(n.rowHeight,t.rowHeight,1),detailRowHeight:E(n.detailRowHeight,240,1),headerHeight:E(n.headerHeight,t.headerHeight,1),rowBuffer:E(n.rowBuffer,8,0,!0),columnLayout:n.columnLayout==="fit"||n.columnLayout==="normal"?n.columnLayout:"auto",enableColumnResize:n.enableColumnResize===!0,domLayout:n.domLayout==="autoHeight"?"autoHeight":"normal",maxBodyHeight:x(n.maxBodyHeight,1),rowSelection:n.rowSelection==="single"||n.rowSelection==="multiple"?n.rowSelection:"none",size:e,pinnedTopRowData:Array.isArray(n.pinnedTopRowData)?n.pinnedTopRowData:[],pinnedBottomRowData:Array.isArray(n.pinnedBottomRowData)?n.pinnedBottomRowData:[]}}function Go(n){let e=typeof n.pagination=="object"?n.pagination:void 0,t=E(e?.pageSize,20,1,!0);return{paginationEnabled:n.pagination!==!1&&n.datasource==null,paginationMode:e?.mode==="server"?"server":"client",paginationPage:E(e?.page,1,1,!0),paginationTotal:E(e?.total,0,0,!0),paginationPageSize:t,paginationPageSizeOptions:ko(n,t),paginationShowTotal:e?e.showTotal!==!1:!0,paginationShowSizeSelector:e?e.showPageSizeSelector!==!1:!0}}function ai(n){let e=n.watermark==null||n.watermark===!1?null:n.watermark===!0?{text:"MachTable"}:n.watermark;return{watermarkEnabled:e!==null,watermarkConfig:e}}function Lo(n){return{advancedFilterModel:B(n.advancedFilterModel),persistence:qe(n.persistence),locale:n.locale??{},tooltipShowDelay:E(n.tooltipShowDelay,600,0),statusBarEnabled:n.statusBar===!0||typeof n.statusBar=="object"&&n.statusBar!=null,statusBarPanels:typeof n.statusBar=="object"&&n.statusBar?.panels?n.statusBar.panels:["rowCount","selectedRowCount","rangeAggregate"]}}var gr={blockSize:100,maxBlocksInCache:12,datasourceMaxConcurrentRequests:4},yr={infiniteBufferRows:40,blockPrefetch:1,datasourceRetryCount:2,datasourceRetryDelay:300},No=Object.keys(gr),Fo=Object.keys(yr);function mr(n,e,t,i){let r=!1;for(let o of t){let s=x(n[o],i,!0);s===void 0||s===e[o]||(e[o]=s,r=!0)}return r}function li(n,e){let t=mr(n,e,No,1);mr(n,e,Fo,0);let i=x(n.datasourceRetryJitter,0);return i!==void 0&&(e.datasourceRetryJitter=Math.min(1,i)),t}function Oo(n){let e={...gr,...yr,datasourceRetryJitter:.15};return li(n,e),{...e,datasourceMode:n.datasourceMode==="block"?"block":"sequential",datasourceRowCount:n.datasourceRowCount==null?null:E(n.datasourceRowCount,0,0,!0),dataProcessorMinRows:E(n.dataProcessorMinRows,5e3,1,!0)}}var Ho=["detailRowRenderer","isRowExpandable","aggFuncs","components","actionPolicy","summaryMethod","datasource","getRowHeight","tooltipComponent","getContextMenuItems","initialState","rowEditValidator","isTreeRowExpandable","loadTreeChildren","dataProcessor"];function vr(n){let e=Ao(n.size),t={...Io(n),...Po(n,e),rowStyleRules:Array.isArray(n.rowStyleRules)?n.rowStyleRules:[],theme:n.theme==="dark"||n.theme==="auto"?n.theme:"light",editType:n.editType==="fullRow"?"fullRow":"cell",editableIndicator:n.editableIndicator==="always"||n.editableIndicator==="none"?n.editableIndicator:"hover",rowDragPolicy:n.rowDragPolicy,undoStackSize:E(n.undoStackSize,100,0,!0),asyncTransactionWaitMillis:E(n.asyncTransactionWaitMillis,16,0,!0),...Go(n),...ai(n),...Lo(n),...Oo(n),features:Array.isArray(n.features)?n.features:[]};for(let i of Ho)n[i]&&Reflect.set(t,i,n[i]);for(let i of Object.keys(n))i.startsWith("on")&&typeof n[i]=="function"&&Reflect.set(t,i,n[i]);return t}function br(n){return Array.isArray(n)?n.filter(e=>typeof e=="string"&&e.length>0):typeof n=="string"&&n.length>0?[n]:[]}function ye(n,e){return br(n.type).includes(e)}function wr(n,e,t={}){let i=n.checkboxSelection||n.rowDrag||ye(n,"index")?{resizable:!1,suppressSizeToFit:!0}:{};for(let o of br(n.type)){o==="rightAligned"&&(i.align="right");let s=t[o];s&&Object.assign(i,s)}let r={...e,...i,...n};return r.align??(r.align=e.align??"center"),r.status&&!r.cellRenderer&&(r.cellRenderer="statusTag"),r}var te=class{constructor(e,t){this.manualWidth=null;this.contentWidth=null;this.flex=null;this.currentWidth=0;this.parentGroup=null;this.level=0;this.isDetailToggle=!1;this.id=e,this.colDef=t,this.hide=t.hide??!1;let i=t.pinned;this.pinned=i===!0?"left":i===!1||i==null?null:i,this.resetWidth()}get sortable(){return this.colDef.sortable!==!1}get resizable(){return this.colDef.resizable!==!1}get movable(){return this.colDef.movable!==!1}get filterable(){return this.colDef.filter!=null&&this.colDef.filter!==!1}get filterType(){let e=this.colDef.filter;return e===!0?"text":e??"text"}get hasCheckbox(){return this.colDef.checkboxSelection===!0}resetWidth(){this.manualWidth=null,this.contentWidth=null,this.flex=I(this.colDef.flex)??null}};function Y(n){return!n.hasCheckbox&&!n.isDetailToggle&&!n.isAutoRowNumber}function rt(n){return n.colDef.autoHeight===!0&&!!(n.colDef.valueGetter||n.colDef.valueFormatter)}var ie=class n{constructor(e,t){this.parent=null;this.children=[];this.groupId=e,this.def=t}get headerName(){return this.def.headerName??this.def.groupId??""}getLeafColumns(e=[]){for(let t of this.children)t instanceof n?t.getLeafColumns(e):e.push(t);return e}};function Ge(n){return Array.isArray(n.children)}var Le=150,Vo=80;function U(n,e){let t=I(e.minWidth)??Vo,i=I(e.maxWidth)??Number.MAX_SAFE_INTEGER,r=I(n)??I(e.width)??Le;return Math.max(t,Math.min(i,r))}function Bo(n,e,t,i){let r=e.map((o,s)=>s).filter(o=>i[o]>0);for(;Math.abs(t)>.001&&r.length;){let o=r.reduce((a,l)=>a+i[l],0),s=0;if(r=r.filter(a=>{let l=e[a];return e[a]=U(l+t*i[a]/o,n[a]),s+=e[a]-l,e[a]!==l}),Math.abs(s)<1e-4)break;t-=s}}function Cr(n,e,t){let i=n.map(o=>U(o.width??Le,o)),r=e-i.reduce((o,s)=>o+s,0);return(t?Number.isFinite(e)&&e>0:r>0)&&Bo(n,i,r,t?[...i]:n.map(o=>o.flex??0)),i}function Tr(n,e){return Cr(n,e,!1)}function nt(n,e){return Cr(n,e,!0)}var di='<path d="M11.5 2.5l2 2L5 13H3v-2l8.5-8.5z"/>',ui='<path d="M3.5 3.5l9 9m0-9l-9 9"/>',ci='<path d="M2.5 8.5l3.5 3.5 7.5-8"/>',de={edit:di,delete:'<path d="M3 5h10M6 5V3h4v2M5 5l.7 8h4.6L11 5"/>',view:'<path d="M1.5 8s2.4-4.2 6.5-4.2S14.5 8 14.5 8s-2.4 4.2-6.5 4.2S1.5 8 1.5 8z"/><circle cx="8" cy="8" r="1.8"/>',copy:'<rect x="5" y="5" width="8" height="8" rx="1"/><path d="M3 11V3h8"/>',download:'<path d="M8 2v8m0 0l-3-3m3 3l3-3M2.5 13.5h11"/>',refresh:'<path d="M13 3v4h-4M3 13V9h4"/><path d="M13 7a5.5 5.5 0 00-9.7-2.6M3 9a5.5 5.5 0 009.7 2.6"/>',close:ui,check:ci,plus:'<path d="M8 2.5v11M2.5 8h11"/>',search:'<circle cx="7" cy="7" r="4.5"/><path d="M10.5 10.5L14 14"/>',more:'<circle cx="3" cy="8" r=".9" fill="currentColor" stroke="none"/><circle cx="8" cy="8" r=".9" fill="currentColor" stroke="none"/><circle cx="13" cy="8" r=".9" fill="currentColor" stroke="none"/>'};function X(n,e=14){return`<svg viewBox="0 0 16 16" width="${e}" height="${e}" aria-hidden="true" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round">${n}</svg>`}var _={matchContains:"\u5305\u542B",matchNotContains:"\u4E0D\u5305\u542B",matchEquals:"\u7B49\u4E8E",matchNotEquals:"\u4E0D\u7B49\u4E8E",matchStartsWith:"\u5F00\u5934\u662F",matchEndsWith:"\u7ED3\u5C3E\u662F",matchBlank:"\u4E3A\u7A7A",matchNotBlank:"\u4E0D\u4E3A\u7A7A",matchLessThan:"\u5C0F\u4E8E",matchLessThanOrEqual:"\u5C0F\u4E8E\u7B49\u4E8E",matchGreaterThan:"\u5927\u4E8E",matchGreaterThanOrEqual:"\u5927\u4E8E\u7B49\u4E8E",matchInRange:"\u5728\u8303\u56F4\u5185",apply:"\u5E94\u7528",reset:"\u91CD\u7F6E",search:"\u641C\u7D22...",emptySetLabel:"(\u7A7A)",selectedCount:"\u5DF2\u9009 {n} \u9879",sortAsc:"\u5347\u5E8F",sortDesc:"\u964D\u5E8F",clearSort:"\u53D6\u6D88\u6392\u5E8F",pinLeft:"\u56FA\u5B9A\u5DE6\u4FA7",pinRight:"\u56FA\u5B9A\u53F3\u4FA7",clearPin:"\u53D6\u6D88\u56FA\u5B9A",autoSize:"\u81EA\u9002\u5E94\u5217\u5BBD",hideColumn:"\u9690\u85CF\u6B64\u5217",columnVisibility:"\u5217\u663E\u793A",resetAll:"\u91CD\u7F6E\u5168\u90E8",autoSizeAll:"\u5168\u90E8\u81EA\u9002\u5E94",columnSettings:"\u5217\u8BBE\u7F6E",totalLabel:"\u5408\u8BA1",totalRowsLabel:"\u5171 {n} \u884C",menuCopy:"\u590D\u5236",menuPaste:"\u7C98\u8D34",menuClearContents:"\u6E05\u9664\u5185\u5BB9",loading:"\u52A0\u8F7D\u4E2D...",statusSelected:"\u5DF2\u9009 {n} \u884C",statusSum:"\u548C {n}",statusAvg:"\u5747 {n}",statusCount:"\u8BA1 {n}",emptyRows:"\u6CA1\u6709\u53EF\u663E\u793A\u7684\u884C",emptyRowsHint:"\u6682\u65E0\u6570\u636E",noMatchingRows:"\u6CA1\u6709\u7B26\u5408\u7B5B\u9009\u6761\u4EF6\u7684\u884C",clearFilters:"\u6E05\u9664\u7B5B\u9009",paginationTotal:"\u5171 {n} \u6761",paginationPage:"\u7B2C {a} / {b} \u9875",perPage:"{n} \u6761/\u9875",pageFirst:"\u9996\u9875",pagePrev:"\u4E0A\u4E00\u9875",pageNext:"\u4E0B\u4E00\u9875",pageLast:"\u672B\u9875",requestFailed:"\u6570\u636E\u52A0\u8F7D\u5931\u8D25",requestFailedHint:"\u8BF7\u68C0\u67E5\u7F51\u7EDC\u540E\u91CD\u8BD5",actionView:"\u67E5\u770B",actionEdit:"\u7F16\u8F91",actionDelete:"\u5220\u9664",actionConfirm:"\u786E\u8BA4",actionSave:"\u4FDD\u5B58",actionCancel:"\u53D6\u6D88",actionMore:"\u66F4\u591A\u64CD\u4F5C",rowDragHandle:"\u62D6\u52A8\u8C03\u6574\u987A\u5E8F\uFF1BAlt + \u4E0A\u4E0B\u65B9\u5411\u952E\u79FB\u52A8",rowDragUnavailable:"\u5F53\u524D\u6392\u5E8F\u6216\u6570\u636E\u6A21\u5F0F\u4E0D\u652F\u6301\u81EA\u52A8\u8C03\u6574\u987A\u5E8F",rowDragPosition:"\u7B2C {a} \u884C \u2192 \u7B2C {b} \u884C",rowDragOutside:"\u79FB\u56DE\u8868\u683C\u5185\u653E\u7F6E \xB7 Esc \u53D6\u6D88"},_o={matchContains:"Contains",matchNotContains:"Not Contains",matchEquals:"Equals",matchNotEquals:"Not Equals",matchStartsWith:"Starts With",matchEndsWith:"Ends With",matchBlank:"Blank",matchNotBlank:"Not Blank",matchLessThan:"Less Than",matchLessThanOrEqual:"\u2264",matchGreaterThan:"Greater Than",matchGreaterThanOrEqual:"\u2265",matchInRange:"In Range",apply:"Apply",reset:"Reset",search:"Search...",emptySetLabel:"(blank)",selectedCount:"{n} selected",sortAsc:"Ascending",sortDesc:"Descending",clearSort:"Clear Sort",pinLeft:"Pin Left",pinRight:"Pin Right",clearPin:"Unpin",autoSize:"Auto Fit",hideColumn:"Hide Column",columnVisibility:"Columns",resetAll:"Reset All",autoSizeAll:"Fit All",columnSettings:"Column Settings",totalLabel:"Total",totalRowsLabel:"{n} rows",menuCopy:"Copy",menuPaste:"Paste",menuClearContents:"Clear Contents",loading:"Loading...",statusSelected:"{n} selected",statusSum:"Sum {n}",statusAvg:"Avg {n}",statusCount:"Cnt {n}",emptyRows:"No rows to display",emptyRowsHint:"No data is available.",noMatchingRows:"No rows match the filters",clearFilters:"Clear filters",paginationTotal:"{n} items",paginationPage:"Page {a} / {b}",perPage:"{n} / page",pageFirst:"First",pagePrev:"Previous",pageNext:"Next",pageLast:"Last",requestFailed:"Unable to load data",requestFailedHint:"Check your connection and try again",actionView:"View",actionEdit:"Edit",actionDelete:"Delete",actionConfirm:"Confirm",actionSave:"Save",actionCancel:"Cancel",actionMore:"More actions",rowDragHandle:"Drag to reorder; Alt + Up/Down to move",rowDragUnavailable:"Reordering is unavailable in the current sort or data mode",rowDragPosition:"Row {a} \u2192 Row {b}",rowDragOutside:"Move inside to drop \xB7 Esc to cancel",rowDragSelection:"{a} selected rows \u2192 Row {b}",rowDragBefore:"Before",rowDragAfter:"After",rowDragInside:"Inside",rowDragRejected:"This destination is unavailable"},zo={contains:"matchContains",notContains:"matchNotContains",equals:"matchEquals",notEquals:"matchNotEquals",startsWith:"matchStartsWith",endsWith:"matchEndsWith",blank:"matchBlank",notBlank:"matchNotBlank",lessThan:"matchLessThan",lessThanOrEqual:"matchLessThanOrEqual",greaterThan:"matchGreaterThan",greaterThanOrEqual:"matchGreaterThanOrEqual",inRange:"matchInRange"};function hi(n){return zo[n]??"matchEquals"}function j(n,e){return n.replace("{n}",String(e))}function Ne(n,e,t){return n.replace("{a}",String(e)).replace("{b}",String(t))}var Wo=[[/^(success|ok|done|complete|completed|normal|active|enabled|启用|正常|完成|已完成|运行|运行中|在线|生效|已发运)$/i,"success"],[/^(warning|warn|hold|pending|standby|待机|待审核|暂停|预警|部分完成|待下达|待复核|待发运)$/i,"warning"],[/^(error|fail|failed|danger|fault|offline|disabled|故障|失败|错误|异常|停用|离线|断开)$/i,"danger"],[/^(info|processing|new|draft|进行中|新建|草稿|审批中|同步中|执行中|已下达|装车中)$/i,"info"],[/^(neutral|default)$/i,"neutral"]];function fi(n,e,t){let i=String(n??"");if(e){let r=Me(e,i);if(r)return r;let o=Me(e,i.toLowerCase());if(o)return o}for(let[r,o]of Wo)if(r.test(i))return o;return t==null?"neutral":fi(t)}function Dr(n={}){return e=>{if(e.value==null||e.value==="")return"";let t=String(e.value),i=et(t,e.colDef.status),r=i?.label??Me(n.labelMap,t)??(e.formatted||t),o=i?.color,s=fi(o??t,o?void 0:n.variantMap,r),a=p("span",`mach-tag mach-tag--${s}`);return a.textContent=r,o&&s!==o&&(a.style.color=o,a.style.backgroundColor=`color-mix(in srgb, ${o} 12%, transparent)`),a}}function xr(n={}){return e=>{let t=Number(e.value);if(isNaN(t))return e.formatted;let i=Math.max(0,Math.min(100,t)),r=p("div","mach-progress"),o=p("div","mach-progress__track"),s=p("div","mach-progress__bar");if(s.style.width=`${i}%`,n.color&&(s.style.background=n.color),o.appendChild(s),r.appendChild(o),n.showValue!==!1){let a=p("span","mach-progress__label");a.textContent=`${Math.round(i)}${n.unit??"%"}`,r.appendChild(a)}return r}}function Rr(n){if(n.value==null||n.value==="")return"";let e=p("span","mach-link");return e.textContent=n.formatted||String(n.value),e}var ne=null,H=null;function Er(n){H&&n.contains(H)&&J()}function J(n=!1){ne?.remove(),ne=null,H&&(H.setAttribute("aria-expanded","false"),n&&H.isConnected&&H.focus({preventScroll:!0})),H=null,document.removeEventListener("mousedown",Sr,!0),document.removeEventListener("keydown",mi,!0)}function Sr(n){ne&&!ne.contains(n.target)&&!H?.contains(n.target)&&J()}function mi(n){if(!ne)return;if(n.key==="Escape"){n.preventDefault(),J(!0);return}let e=[...ne.querySelectorAll("button:not(:disabled)")];if(e.length===0)return;if(n.key==="Tab"){let r=e.indexOf(document.activeElement);(!n.shiftKey&&r===e.length-1||n.shiftKey&&r<=0)&&(n.preventDefault(),e[n.shiftKey?e.length-1:0].focus());return}if(n.key!=="ArrowDown"&&n.key!=="ArrowUp")return;n.preventDefault();let t=e.indexOf(document.activeElement),i=n.key==="ArrowDown"?1:-1;e[(t+i+e.length)%e.length].focus()}function Mr(n,e){let t=p("button",e);return t.type="button",n.variant&&n.variant!=="default"&&t.classList.add(`${e}--${n.variant}`),t.disabled=n.disabled===!0,n.icon&&de[n.icon]?(t.innerHTML=X(de[n.icon],16),t.appendChild(p("span")).textContent=n.label):t.textContent=n.label,t.addEventListener("click",()=>n.pick(t)),t}function $o(n,e){J();let t=p("div","mach-context-menu mach-action-menu");t.setAttribute("role","menu");for(let i of e){let r=Mr(i,"mach-context-menu-item");r.setAttribute("role","menuitem"),t.appendChild(r)}A(t,n.closest(".mach-root")),document.body.appendChild(t),ee(t,n),ne=t,H=n,n.setAttribute("aria-expanded","true"),document.addEventListener("mousedown",Sr,!0),document.addEventListener("keydown",mi,!0),t.querySelector("button:not(:disabled)")?.focus({preventScroll:!0})}function Ko(n,e,t){J();let i=p("div","mach-action-drawer-backdrop"),r=p("section","mach-action-drawer");r.setAttribute("role","dialog"),r.setAttribute("aria-modal","true"),r.setAttribute("aria-label",e);let o=p("header","mach-action-drawer__header"),s=p("strong");s.textContent=e;let a=p("button","mach-action-drawer__close");a.type="button",a.setAttribute("aria-label","Close"),a.title="Close",a.innerHTML=X(de.close,16),a.addEventListener("click",()=>J(!0)),o.append(s,a);let l=p("div","mach-action-drawer__body");for(let d of t)l.appendChild(Mr(d,"mach-action-drawer__item"));r.append(o,l),i.appendChild(r),i.addEventListener("mousedown",d=>{d.target===i&&J(!0)}),A(i,n.closest(".mach-root")),document.body.appendChild(i),ne=i,H=n,n.setAttribute("aria-expanded","true"),document.addEventListener("keydown",mi,!0),r.querySelector("button:not(:disabled)")?.focus({preventScroll:!0})}function re(n,e){if(typeof n=="function")try{return n(e)}catch{return!1}return n===!0}function Ir(n){return n.variant??"default"}function Ar(n){return n.permission?typeof n.permission=="string"?[n.permission]:n.permission:[]}function gi(n,e,t){return{...n.id?{actionId:n.id}:{},permissions:Ar(n),...t?{message:t}:{},params:e}}function ot(n,e,t){let i=t.api.getOption("actionPolicy");try{i?.onError?i.onError(n,gi(e,t)):console.error("[mach-table] action handler failed",n)}catch(r){console.error("[mach-table] action error policy failed",r,n)}}function Uo(n,e){if(Ar(n).length===0)return!0;let i=e.api.getOption("actionPolicy");if(!i?.canAccess)return!0;try{return i.canAccess(gi(n,e))}catch(r){return ot(r,n,e),!1}}function jo(n,e){return n.filter(t=>{if(!Uo(t,e))return!1;if(!t.show)return!0;try{return t.show(e)}catch{return!1}})}function yi(n,e,t){t.isConnected&&(t.disabled=re(n.disabled,e)||re(n.loading,e),t.classList.toggle("mach-action-btn--loading",re(n.loading,e)))}function qo(n,e,t,i){Promise.resolve(n).catch(r=>ot(r,e,t)).finally(()=>yi(e,t,i))}function Yo(n,e,t){try{qo(n.onClick(e),n,e,t)}catch(i){ot(i,n,e),yi(n,e,t)}}function pi(n,e,t){if(n===!1)return!1;let i=typeof n=="string"?n:e.label??e.title??"Confirm action",r=t.api.getOption("actionPolicy");return r?.confirm?r.confirm(gi(e,t,i)):typeof window>"u"||typeof window.confirm!="function"?!1:window.confirm(i)}function Xo(n,e){if(n.confirm==null||n.confirm===!1)return!0;if(typeof n.confirm!="function")return pi(n.confirm,n,e);let t=n.confirm(e);return t instanceof Promise?t.then(i=>pi(i,n,e)):pi(t,n,e)}function Jo(n){return(e,t)=>{if(re(e.disabled,n))return;if(t.disabled=!0,t.classList.add("mach-action-btn--loading"),e.confirm==null||e.confirm===!1){Yo(e,n,t);return}(async()=>{await Xo(e,n)&&await e.onClick(n)})().catch(r=>ot(r,e,n)).finally(()=>{yi(e,n,t)})}}function Zo(n,e,t){let i=p("button","mach-action-btn");i.type="button";let r=Ir(n);r!=="default"&&i.classList.add(`mach-action-btn--${r}`);let o=n.title??n.label??"Action";return i.title=o,i.setAttribute("aria-label",o),i.disabled=re(n.disabled,e),re(n.loading,e)&&(i.disabled=!0,i.classList.add("mach-action-btn--loading")),n.icon&&de[n.icon]?(i.innerHTML=X(de[n.icon]),i.classList.add("mach-action-btn--icon")):i.textContent=n.label??o,i.addEventListener("mousedown",s=>s.stopPropagation()),i.addEventListener("click",s=>{s.stopPropagation(),t(n,i)}),i}function Qo(n,e,t,i,r){let o=p("button","mach-action-btn mach-action-btn--icon");o.type="button";let s=i.api.getOption("locale")??{},a=t.moreLabel??s.actionMore??_.actionMore;return o.title=a,o.setAttribute("aria-label",a),o.setAttribute("aria-haspopup",e==="drawer"?"dialog":"menu"),o.setAttribute("aria-expanded","false"),o.innerHTML=`${X(de.more,16)}<span class="mach-sr-only">\u22EF</span>`,o.addEventListener("mousedown",l=>l.stopPropagation()),o.addEventListener("click",l=>{l.stopPropagation();let d=n.map(u=>({label:u.label??u.title??"Action",icon:u.icon,variant:Ir(u),disabled:re(u.disabled,i)||re(u.loading,i),pick:c=>{J(),r(u,c)}}));e==="drawer"?Ko(o,t.drawerTitle??a,d):$o(o,d)}),o}function Fe(n){let e=Math.max(0,n.max??3),t=n.overflow??"menu";return i=>{let r=jo(n.actions,i);if(r.length===0)return"";let o=p("div","mach-actions"),s=t==="inline"?r:r.slice(0,e),a=t==="inline"?[]:r.slice(e),l=Jo(i);for(let d of s)o.appendChild(Zo(d,i,l));return a.length>0&&o.appendChild(Qo(a,t,n,i,l)),{el:o,destroy:()=>{H&&o.contains(H)&&J()}}}}function ve(n,e,t){return n??e??t}function es(n,e){let t=e.api.getOption("locale")??{};return{view:ve(n.labels?.view,t.actionView,_.actionView),edit:ve(n.labels?.edit,t.actionEdit,_.actionEdit),delete:ve(n.labels?.delete,t.actionDelete,_.actionDelete),confirm:ve(n.labels?.confirm,t.actionConfirm,_.actionConfirm),save:ve(n.labels?.save,t.actionSave,_.actionSave),cancel:ve(n.labels?.cancel,t.actionCancel,_.actionCancel)}}function ts(n,e,t){let i=async()=>{if(!await e.api.editing.stop()||!n.onSave)return;let s=e.api.editing.getChanges().filter(a=>a.rowId===e.node.id);try{await n.onSave(e,s),e.api.editing.markSaved([e.node.id])}catch(a){throw e.api.editing.startRow(e.rowIndex),a}},r=n.onSave?t.save:n.labels?.confirm??n.labels?.save??t.confirm;return Fe({actions:[{icon:"check",title:r,variant:"success",onClick:i},{icon:"close",title:t.cancel,variant:"danger",onClick:()=>e.api.editing.stop({cancel:!0}).then(()=>{})}],overflow:"inline"})(e)}function is(n,e,t){let i=[];return n.onView&&i.push({id:"view",icon:"view",title:t.view,variant:"primary",...n.permissions?.view?{permission:n.permissions.view}:{},onClick:n.onView}),n.edit!==!1&&i.push({id:"edit",icon:"edit",title:t.edit,variant:"warning",...n.permissions?.edit?{permission:n.permissions.edit}:{},onClick:n.onEdit??(()=>{e.api.editing.startRow(e.rowIndex)})}),n.onDelete&&i.push({id:"delete",icon:"delete",title:t.delete,variant:"danger",...n.permissions?.delete?{permission:n.permissions.delete}:{},...n.confirmDelete?{confirm:n.confirmDelete===!0?t.delete:n.confirmDelete}:{},onClick:n.onDelete}),i.push(...n.extraActions??[]),i}function vi(n={}){return e=>{let t=es(n,e);if(e.api.editing.isRowActive(e.rowIndex))return ts(n,e,t);let i=is(n,e,t);return Fe({actions:i,max:n.max,overflow:n.overflow??"menu",moreLabel:n.moreLabel,drawerTitle:n.drawerTitle})(e)}}var rs=Dr(),ns=xr(),kr=Object.freeze({statusTag:rs,progressBar:ns,link:Rr});var Oe={sortable:!1,resizable:!1,movable:!1,filter:!1,suppressSizeToFit:!0,suppressColumnMenu:!0};function os(n={}){let e=n.width??40;return{colId:"sel",headerName:"",width:e,minWidth:n.minWidth??e,maxWidth:n.maxWidth??e,pinned:"left",checkboxSelection:!0,...Oe,...n}}function bi(n={}){let e=n.width??52;return{colId:"idx",headerName:"#",type:"index",width:e,minWidth:n.minWidth??e,maxWidth:n.maxWidth??e,pinned:"left",align:"center",headerAlign:"center",...Oe,...n}}function ss(n={}){let e=n.width??40;return{colId:"drag",headerName:"",rowDrag:!0,width:e,minWidth:n.minWidth??e,maxWidth:n.maxWidth??e,pinned:"left",...Oe,...n}}function as(n={actions:[]}){let{width:e,pinned:t,...i}=n,r=i.actions?.length??0,o=i.overflow==="inline"?r:Math.min(r,i.max??3),s=i.overflow!=="inline"&&r>o,a=Math.max(1,o)*26+(s?26:0)+10;return{colId:"op",headerName:"\u64CD\u4F5C",width:e??Math.max(64,a),pinned:t??"right",cellRenderer:Fe(i),...Oe,cellRendererParams:void 0}}function ls(n={}){let{width:e,pinned:t,...i}=n,r=(i.onView?1:0)+(i.edit===!1?0:1)+(i.onDelete?1:0)+(i.extraActions?.length??0),o=i.overflow==="inline"?r:Math.min(r,i.max??3),s=i.overflow!=="inline"&&r>o,a=Math.max(2,o)*26+(s?26:0)+10;return{colId:"op",headerName:"\u64CD\u4F5C",width:e??Math.max(72,a),pinned:t??"right",cellRenderer:vi(i),...Oe,cellRendererParams:void 0}}var wi="__rg_detail_toggle__";function He(n){return I(n)!==void 0}function Gr(n){return n===!0?"left":n||null}function Pr(n,e){let t=e;for(let i=2;n.has(t);i++)t=`${e}_${i}`;return n.add(t),t}function ds(n,e){let t=e.colDef,i=n.colDef;n.manualWidth=e.manualWidth,(t.width===i.width&&t.autoWidth===i.autoWidth||t.width!=null||t.autoWidth===!1)&&(n.contentWidth=e.contentWidth),(e.manualWidth!=null||e.flex!==(I(t.flex)??null))&&(n.flex=e.flex),e.hide!==(t.hide??!1)&&(n.hide=e.hide),e.pinned!==Gr(t.pinned)&&(n.pinned=e.pinned)}var st=class{constructor(e){this.e=e;this.X=[];this.Rr=new Map;this.fe=[];this.so=[];this.Er=[];this.ao=[];this.me=[];this.Sr=[];this.Dt=new Map;this.Yt=1;this.lo=new Map;this.ca=0;this.Xe=!1}Ri(e){this.Sr=e?[...e]:[];let t=new Map(this.X.map(u=>[u.id,u])),i=this.e.t.defaultColDef,r=this.e.t.masterDetail&&this.e.t.detailToggleColumn,o=new Set(r?[wi]:[]),s=this.e.t.rowNumber,a=(u,c,h)=>u.map((f,m)=>{if(Ge(f)){let z=f.groupId??f.headerName??`group_${m}_${h}`,W=new ie(z,f);return W.parent=c,W.children=a(f.children,W,h+1),W}let g=f,b=Pr(o,g.colId??g.field??`col_${m}`),w=new te(b,wr(g,i,this.e.t.columnTypes));s&&(s=!ye(w.colDef,"index")),w.parentGroup=c,w.level=h;let G=t.get(b);return G&&!G.isAutoRowNumber&&ds(w,G),w});if(this.fe=a(this.Sr,null,0),s&&o.size>Number(r)&&this.bu(Pr(o,"idx"),t),r){let u=new te(wi,{colId:wi,headerName:"",width:38,pinned:"left",sortable:!1,resizable:!1,movable:!1,filter:!1});u.isDetailToggle=!0,this.fe.unshift(u)}this.Dt.size&&this.wu(),this.X=this.Mr(this.fe),this.Rr=new Map(this.X.map(u=>[u.id,u])),this.Yt=this.X.reduce((u,c)=>Math.max(u,c.level+1),1);let l=this.me.length;this.me=this.me.filter(u=>this.Rr.has(u.colId));let d=this.me.length!==l;if(this.me.length===0){let u=[];for(let c of this.X)c.colDef.initialSort&&!t.has(c.id)&&u.push({colId:c.id,direction:c.colDef.initialSort});this.me=u}return this.Xt(),d}bu(e,t){let i=new te(e,bi({colId:e,headerName:"\u5E8F\u53F7"}));i.isAutoRowNumber=!0;let r=t.get(e);r?.isAutoRowNumber&&(i.hide=r.hide);let o=this.fe.findIndex(s=>!(s instanceof te&&(s.hasCheckbox||s.colDef.rowDrag)));this.fe.splice(o===-1?this.fe.length:o,0,i)}Mr(e,t=[]){for(let i of e)i instanceof ie?this.Mr(i.children,t):t.push(i);return t}Xt(){this.Xe=!1;let e=this.X.filter(t=>!t.hide);this.so=e.filter(t=>t.pinned==="left"),this.ao=e.filter(t=>t.pinned==="right"),this.Er=e.filter(t=>t.pinned===null),this.lo.clear(),this.l().forEach((t,i)=>this.lo.set(t.id,i))}J(e){return this.lo.get(e)??-1}Z(){return this.X}uo(){return this.Sr}Cu(){return this.fe}Tu(){return this.Yt}x(e){return this.Rr.get(e)}R(e){return e==="left"?this.so:e==="right"?this.ao:this.Er}l(){return[...this.so,...this.Er,...this.ao]}Je(){return this.l().filter(e=>e.colDef.rowGroup===!0)}Du(){return this.l().filter(e=>e.colDef.aggFunc!=null&&e.colDef.rowGroup!==!0)}ha(){let e=this.l();return this.Er.find(Y)??e.find(Y)??e[0]}ge(e){return e.pinned==="left"?"left":e.pinned==="right"?"right":"center"}pa(e){let t=this.e.n.ye.clientWidth,i=this.Xe&&t===this.ca;this.ca=t;let r=e,o=[],s=[];for(let l of this.l()){let d=this.Ir(l);i||l.pinned!=null||l.colDef.suppressSizeToFit||l.manualWidth!=null?(l.currentWidth=U(i?l.manualWidth??l.currentWidth:d.width??Le,d),r-=l.currentWidth):(o.push(l),s.push(d))}this.e.t.columnLayout==="auto"&&!s.some(l=>l.flex)&&o.forEach((l,d)=>{if(l.colDef.autoWidth!==!1&&(l.colDef.width==null||l.contentWidth!=null)){let u=s[d];u.flex=U(u.width??Le,u)}});let a=this.e.t.columnLayout==="fit"?nt(s,Math.max(0,r)):Tr(s,Math.max(0,r));o.forEach((l,d)=>{l.currentWidth=a[d]})}Ir(e){let t=e.colDef;return{width:e.manualWidth??e.contentWidth??t.width??void 0,minWidth:e.minWidth??t.minWidth,maxWidth:t.maxWidth,flex:e.manualWidth==null?e.flex??void 0:void 0}}Ee(e,t){return He(t)?(this.Xe=!0,e.manualWidth=U(t,this.Ir(e)),e.flex=null,!0):!1}fa(e,t){return He(t)?(this.Xe=!1,e.resetWidth(),e.contentWidth=U(t,this.Ir(e)),!0):!1}co(e,t){let i=this.x(e);!i||i.hide===!t||(i.hide=!t,this.Xt())}Ei(e,t){let i=this.x(e);if(!i)return!1;let r=this.ge(i),o=c=>i.parentGroup?!0:this.ge(c)===r,s=i.parentGroup?i.parentGroup.children:this.fe,a=[],l=[];s.forEach((c,h)=>{c instanceof te&&!c.hide&&o(c)&&(a.push(c),l.push(h))});let d=a.indexOf(i);if(d<0)return!1;a.splice(d,1);let u=Math.max(0,Math.min(t,a.length));return a.splice(u,0,i),l.forEach((c,h)=>{s[c]=a[h]}),d!==u&&this.Dt.set(this.ma(i),a.filter(c=>c.movable).map(c=>c.id)),this.X=this.Mr(this.fe),this.Xt(),!0}ho(e,t){let i=this.x(e);!i||!i.movable||(i.pinned=t,this.Xt())}ga(e=!0){return(e?this.X:this.X.filter(i=>!i.isAutoRowNumber)).map(i=>({colId:i.id,hide:i.hide,width:i.manualWidth??i.currentWidth,flex:i.flex,widthMode:i.manualWidth==null?"auto":"manual",contentWidth:i.contentWidth??void 0,pinned:i.pinned}))}ya(e){let t=new Map(e.map(i=>[i.colId,i]));for(let i of this.X){let r=t.get(i.id);r&&this.xu(i,r)}this.Ru(e),this.Xt()}xu(e,t){typeof t.hide=="boolean"&&(e.hide=t.hide),t.widthMode==="auto"?(e.resetWidth(),He(t.flex)&&(e.flex=t.flex)):He(t.flex)?(e.flex=t.flex,e.manualWidth=null):this.Ee(e,t.width),He(t.contentWidth)&&(e.contentWidth=U(t.contentWidth,this.Ir(e))),e.movable&&(t.pinned==="left"||t.pinned==="right"||t.pinned===null)&&(e.pinned=t.pinned)}Ru(e){let t=new Map(e.map((i,r)=>[i.colId,r]));this.po(i=>!i.hide&&i.movable&&t.has(i.id),(i,r)=>{let o=[...i];i.sort((s,a)=>t.get(s.id)-t.get(a.id)),i.some((s,a)=>s!==o[a])&&this.Dt.set(r,i.map(s=>s.id))}),this.X=this.Mr(this.fe)}ma(e){if(!e.parentGroup)return this.ge(e);let t=[];for(let i=e.parentGroup;i;i=i.parent)t.push(i.groupId);return JSON.stringify(t)}wu(){let e=new Map;this.po(t=>t.movable,(t,i)=>{let r=this.Dt.get(i);if(!r)return;let o=new Map(t.map(d=>[d.id,d])),s=r.filter(d=>o.has(d));if(s.length<2)return;let a=new Set(s),l=0;t.forEach((d,u)=>{a.has(d.id)&&(t[u]=o.get(s[l++]))}),e.set(i,s)}),this.Dt=e}po(e,t,i=this.fe){let r=new Map;i.forEach((o,s)=>{if(o instanceof ie)this.po(e,t,o.children);else if(e(o)){let a=o.parentGroup?"center":this.ge(o),l=r.get(a)??[];l.push(s),r.set(a,l)}});for(let o of r.values()){if(o.length<2)continue;let s=o.map(a=>i[a]);t(s,this.ma(s[0])),o.forEach((a,l)=>{i[a]=s[l]})}}fo(){for(let e of this.X)e.resetWidth(),e.hide=e.colDef.hide??!1,e.pinned=Gr(e.colDef.pinned);if(this.Dt.size){this.Dt.clear(),this.Ri(this.Sr);return}this.Xt()}Q(){return this.me.map(e=>({...e}))}Si(e){if(!e||e.length===0){this.me=[];return}this.me=e.filter(t=>this.Rr.has(t.colId)&&(t.direction==="asc"||t.direction==="desc")).map(t=>({colId:t.colId,direction:t.direction}))}Ar(e,t){let i=[...this.me],r=i.findIndex(l=>l.colId===e.id),o=r>=0?i[r].direction:null,s=o===null?"asc":o==="asc"?"desc":null;t&&this.e.t.multiSort?s===null?r>=0&&i.splice(r,1):r>=0?i[r]={colId:e.id,direction:s}:i.push({colId:e.id,direction:s}):(i.length=0,s&&i.push({colId:e.id,direction:s})),this.me=i}};function k(n){return n!=null&&typeof n.then=="function"}function oe(n,e){if(n instanceof Error)return n;let t=new Error(typeof n=="string"?n:e);return t.name="AbortError",t}var us=()=>oe(void 0,"[MachTable] Operation cancelled.");function at(n,e,t=us){return e?new Promise((i,r)=>{let o=()=>{e.removeEventListener("abort",o),r(t())};if(n.then(i,r).finally(()=>e.removeEventListener("abort",o)),e.aborted){o();return}e.addEventListener("abort",o,{once:!0})}):n}function Lr(n){return n==null?"":String(n).toLowerCase()}function Ti(n,e,t){return n.length===0||(e==="or"?n.some(t):n.every(t))}function cs(n,e,t){let i=Lr(n);return Ti(e,t,o=>{let s=(o.value??"").toLowerCase();switch(o.match){case"contains":return i.includes(s);case"notContains":return!i.includes(s);case"equals":return i===s;case"notEquals":return i!==s;case"startsWith":return i.startsWith(s);case"endsWith":return i.endsWith(s);case"blank":return i==="";case"notBlank":return i!=="";default:return!0}})}function Nr(n,e,t,i){switch(t){case"equals":return n===e;case"notEquals":return n!==e;case"lessThan":return n<e;case"lessThanOrEqual":return n<=e;case"greaterThan":return n>e;case"greaterThanOrEqual":return n>=e;case"inRange":return n>=e&&n<=i;default:return!0}}function hs(n,e){let t=n==null||n==="";if(e.match==="blank")return t;if(e.match==="notBlank")return!t;if(t)return!1;let i=typeof n=="number"?n:Number(n);if(Number.isNaN(i))return!1;let r=e.value;return r==null||Number.isNaN(r)?!1:Nr(i,r,e.match,e.value2??r)}function ps(n,e,t){return Ti(e,t,r=>hs(n,r))}function Ci(n){if(n==null||n==="")return null;if(typeof n=="number")return n;let e=n instanceof Date?n.getTime():Date.parse(String(n));return isNaN(e)?null:e}function fs(n,e,t){let i=Ci(n);return Ti(e,t,o=>{let s=i==null;if(o.match==="blank")return s;if(o.match==="notBlank")return!s;if(s)return!1;let a=Ci(o.value);if(a==null)return!1;let l=o.match==="inRange"?Ci(o.value2)??1/0:a;return Nr(i,a,o.match,l)})}function ms(n,e){return e.length===0?!0:e.some(t=>t==null&&n==null||t===n)}function gs(n,e){let t=e.type!=="set"&&e.operator==="or"?"or":"and";switch(e.type){case"text":return cs(n,e.conditions,t);case"number":return ps(n,e.conditions,t);case"date":return fs(n,e.conditions,t);case"set":return ms(n,e.values);default:return!0}}function Fr(n,e,t){return i=>gs(t(i,n),e)}function Or(n,e,t){if(n.kind==="condition"){let r=e.get(n.colId);return r?Fr(r,n.filter,t):()=>!0}let i=n.children.map(r=>Or(r,e,t));return r=>{let o=n.operator==="or"?i.some(s=>s(r)):i.every(s=>s(r));return n.not?!o:o}}function Di(n,e,t,i,r){let o=new Map(n.map(l=>[l.id,l])),s=Object.entries(e).flatMap(([l,d])=>{let u=o.get(l);return u?[Fr(u,d,r)]:[]});t&&s.push(Or(t.root,o,r));let a=i?.trim().toLowerCase().split(/\s+/).filter(Boolean)??[];return l=>s.every(d=>d(l))&&a.every(d=>n.some(u=>Lr(r(l,u)).includes(d)))}var Hr=typeof Intl<"u"?new Intl.Collator(void 0,{numeric:!0,sensitivity:"base"}):null;function ys(n,e){let t=n==null||n==="",i=e==null||e==="";return!t&&!i?null:t&&i?0:t?1:-1}function vs(n,e){let t=Number.isNaN(n),i=Number.isNaN(e);return t||i?t===i?0:t?1:-1:n-e}function bs(n,e){return n===e?0:n?1:-1}function lt(n,e){let t=ys(n,e);if(t!==null)return t;if(typeof n=="number"&&typeof e=="number")return vs(n,e);if(n instanceof Date&&e instanceof Date)return n.getTime()-e.getTime();if(typeof n=="boolean"&&typeof e=="boolean")return bs(n,e);let i=String(n),r=String(e);return Hr?Hr.compare(i,r):i.localeCompare(r)}function xi(n,e,t,i){let r=new Map(t.map(a=>[a.id,a])),o=e.flatMap(a=>{let l=r.get(a.colId);return l?[{column:l,compare:l.colDef.comparator??lt,direction:a.direction}]:[]}),s=n.map(a=>({node:a,values:o.map(({column:l})=>i(a,l))}));return s.sort((a,l)=>{for(let d=0;d<o.length;d++){let u=o[d],c=u.compare(a.values[d],l.values[d],a.node,l.node);if(c!==0)return u.direction==="asc"?c:-c}return 0}),s.map(({node:a})=>a)}function Vr(){return{count:0,numeric:0,sum:0,min:1/0,max:-1/0}}function Br(n,e){n.count++,!(typeof e!="number"||!Number.isFinite(e))&&(n.numeric++,n.sum+=e,n.min=Math.min(n.min,e),n.max=Math.max(n.max,e))}function _r(n,e){return e==="count"?n?.count??0:n?.numeric?e==="min"?n.min:e==="max"?n.max:Number.isFinite(n.sum)?e==="avg"?n.sum/n.numeric:n.sum:null:null}function dt(n,e){let t=Vr();for(let i of n)Br(t,i);return _r(t,e)}var ut={sum:n=>dt(n,"sum"),avg:n=>dt(n,"avg"),count:n=>n.length,min:n=>dt(n,"min"),max:n=>dt(n,"max"),first:n=>n.length>0?n[0]:null,last:n=>n.length>0?n[n.length-1]:null};function zr(n,e,t){if(e===ut.count)return n.length;let i=["sum","avg","min","max"].find(o=>e===ut[o]);if(!i)return e(n.map(t));let r=Vr();for(let o of n)Br(r,t(o));return _r(r,i)}function Ri(n){let e={...ut,...n??{}};return t=>e[t]}var ct="group:";function Wr(n){return n==null?"null":n instanceof Date?JSON.stringify(["date",String(n.getTime())]):JSON.stringify([typeof n,Ei(n)])}function Ei(n){return n==null?"(\u7A7A)":String(n)}function $r(n){return ct+JSON.stringify(n)}function ws(n,e,t){let i=new Map;for(let r of n){let o=t(r,e),s=Wr(o),a=i.get(s);a||(a={key:s,label:Ei(o),rows:[]},i.set(s,a)),a.rows.push(r)}return[...i.values()].sort((r,o)=>r.label.localeCompare(o.label,void 0,{numeric:!0,sensitivity:"base"})||r.key.localeCompare(o.key))}function Kr(n,e,t,i,r){let o=[],s=(a,l,d)=>{if(l===e.length)return{display:a,leaves:a};let u=[],c=[];for(let h of ws(a,e[l],t)){let f=[...d,[e[l].id,h.key]],m=$r(f);o.push(m);let g=s(h.rows,l+1,f);if(u.push({id:m,data:null,rowIndex:-1,selected:!1,isGroup:!0,groupLevel:l,groupKey:h.label,leafNodes:g.leaves,aggValues:i(g.leaves)}),r.has(m))for(let b of g.display)u.push(b);if(l>0)for(let b of g.leaves)c.push(b)}return{display:u,leaves:c}};return{rows:s(n,0,[]).display,ids:o}}function Ur(n,e,t,i){let r=new Set([...n].filter(l=>l.startsWith("/g0:")));if(!r.size)return{expanded:n,ambiguous:[]};let o=new Map;for(let l of e){let d=[],u="";for(let c=0;c<t.length;c++){let h=i(l,t[c]);if(d.push([t[c].id,Wr(h)]),u+=`/g${c}:${Ei(h)}`,!r.has(u))continue;let f=$r(d);o.set(u,o.has(u)&&o.get(u)!==f?null:f)}}let s=new Set([...n].filter(l=>!r.has(l))),a=[];for(let l of r){let d=o.get(l);d?s.add(d):d===null?a.push(l):s.add(l)}return{expanded:s,ambiguous:a}}function Cs(n,e){let t=n?[n.root]:[];for(;t.length;){let i=t.pop();if(i.kind==="condition")e.add(i.colId);else for(let r of i.children)t.push(r)}}function jr(n){let e=new Set(Object.keys(n.filterModel));Cs(n.advancedFilter,e);let t=new Set(n.sortModel.map(a=>a.colId));for(let a of t)e.add(a);let i=n.columns.some(a=>a.colDef.rowGroup===!0),r=!!n.quickFilter?.trim(),o=n.columns.filter(a=>e.has(a.id)||r||a.colDef.rowGroup===!0||i&&a.colDef.aggFunc!=null),s=new Set;for(let a of o){let l=a.colDef;if(i&&l.rowGroup!==!0&&l.aggFunc!=null&&n.customAggregates?.[l.aggFunc]||l.valueGetter||t.has(a.id)&&l.comparator||!l.field)return null;s.add(l.field)}return[...s]}function qr(n){return n!=null&&(typeof n=="object"||typeof n=="function")}function Yr(n,e){if(n.length*(e.length+4)>1e6)return null;let t=new WeakMap;for(let i of n){if(i.data==null)continue;let r=e.map(o=>K(i.data,o));r.some(qr)||t.set(i,r)}return t}function Xr(n,e,t,i){return t.length?!i||n===e||n==null||e==null?!0:t.some((r,o)=>{let s=K(e,r);return qr(s)||!Object.is(i[o],s)}):!1}function ue(n){return oe(n.reason,"Block request aborted")}function ht(n){return Number.isFinite(n)?Math.max(1,Math.trunc(n)):1}var pt=class{constructor(e,t,i=4){this.maxBlocks=e;this.vo=t;this.maxConcurrentRequests=i;this.ee=new Map;this.j=new Map;this.va=0;this.mo=0;this.go=0;this.ba=0;this.wa=0;this.kr=0;this.Pr=new Set;this.maxBlocks=ht(e),this.maxConcurrentRequests=ht(i)}configure(e,t=this.maxConcurrentRequests){this.maxBlocks=ht(e),this.maxConcurrentRequests=ht(t),this.yo(),this.Gr()}Eu(e){this.Pr=e,this.yo()}peek(e){let t=this.ee.get(e);if(t)return t.touchedAt=++this.va,t}has(e){return this.ee.has(e)}Jt(e){let t=this.j.get(e);t&&(this.j.delete(e),t.controller.abort(),t.state==="queued"&&t.reject(ue(t.controller.signal)));let i=this.ee.get(e);i&&(this.ee.delete(e),this.vo?.(e,i))}load(e,t,i,r=0){if(i?.aborted)return Promise.reject(ue(i));let o=this.peek(e);if(o)return this.go++,Promise.resolve(o);let s=this.j.get(e);if(s)return this.go++,s.priority=Math.max(s.priority,r),this.Gr(),this.Ca(e,s,i);this.ba++;let a=new AbortController,l,d,u=new Promise((f,m)=>{l=f,d=m}),c={controller:a,promise:u,consumers:0,loader:t,priority:r,state:"queued",resolve:l,reject:d};this.j.set(e,c);let h=this.Ca(e,c,i);return this.Gr(),h}Su(){this.mo++,this.Pr.clear();for(let e of this.j.values())e.controller.abort(),e.state==="queued"&&e.reject(ue(e.controller.signal));this.j.clear();for(let[e,t]of this.ee)this.vo?.(e,t);this.ee.clear()}snapshot(){let e=0,t=0;for(let i of this.ee.values())e+=i.rows.length;for(let i of this.j.values())i.state==="active"&&t++;return{cachedBlockCount:this.ee.size,loadingBlockCount:this.j.size,activeRequestCount:t,queuedRequestCount:Math.max(0,this.j.size-t),cachedRowCount:e,hitCount:this.go,missCount:this.ba,evictionCount:this.wa}}Gr(){for(;this.kr<this.maxConcurrentRequests;){let e,t;for(let[i,r]of this.j)r.state!=="queued"||r.controller.signal.aborted||(!t||r.priority>t.priority)&&(e=i,t=r);if(e==null||!t)return;this.Mu(e,t)}}Mu(e,t){t.state="active",this.kr++;let i=this.mo;this.Iu(t).then(r=>{i===this.mo&&!t.controller.signal.aborted&&(this.ee.set(e,{rows:r.rows,...r.lastRow==null?{}:{lastRow:r.lastRow},touchedAt:++this.va}),this.yo()),t.resolve(r)},t.reject).finally(()=>{this.kr=Math.max(0,this.kr-1),this.j.get(e)===t&&this.j.delete(e),this.Gr()})}Iu(e){let{signal:t}=e.controller;return at(Promise.resolve().then(()=>{if(t.aborted)throw ue(t);return e.loader(t)}),t,()=>ue(t))}Ca(e,t,i){return t.consumers++,new Promise((r,o)=>{let s=!1,a=d=>{s||(s=!0,i?.removeEventListener("abort",l),t.consumers=Math.max(0,t.consumers-1),d())},l=()=>a(()=>{t.consumers===0&&this.j.get(e)===t&&(this.j.delete(e),t.controller.abort(i?.reason),t.state==="queued"&&t.reject(ue(t.controller.signal))),o(ue(i))});i?.addEventListener("abort",l,{once:!0}),t.promise.then(d=>a(()=>r(d)),d=>a(()=>o(d instanceof Error?d:new Error(String(d??"Block request failed")))))})}yo(){let e=Math.max(this.maxBlocks,this.Pr.size+1);for(;this.ee.size>e;){let t=-1,i=Number.POSITIVE_INFINITY;for(let[o,s]of this.ee)this.Pr.has(o)||s.touchedAt<i&&(t=o,i=s.touchedAt);if(t<0)return;let r=this.ee.get(t);this.ee.delete(t),this.wa++,r&&this.vo?.(t,r)}}};function be(n,e){if(n==null||typeof n!="object")return;let t=n[e];return Array.isArray(t)?t:void 0}function we(n,e,t=0,i=new Set){for(let r of n){if(r==null)continue;if(t>=256)throw new RangeError("[MachTable] Tree data exceeds 256 levels.");if(i.has(r))throw new TypeError("[MachTable] Tree data contains a cyclic object graph.");let o=be(r,e);o?.length&&(i.add(r),we(o,e,t+1,i),i.delete(r))}}var ft=class{constructor(e){this.e=e;this.c=[];this._=[];this.te=new Map;this.ve=[];this.p=new Map;this.Se={};this.Me=null;this.He=null;this.A=new Set;this.z=new Set;this.Mi=[];this.Ii=new Map;this.Ta=[];this.k=null;this.Ai=!1;this.Da=!1;this.Ze=0;this.Lr=null;this.Nr=new WeakMap;this.Fr=new WeakMap;this.Qe=new Map;this.ki=new Map;this.Or=0;this.Hr=0;this.et=null;this.tt=new Map;this.xt=new Map;this.Vr=new Set;this.Rt=new Map;this.it=new pt(12,e=>this.xa(e));this.Pi=0;this.Br=null;this.bo=!1;this.Ra=0;this.we=[];this.V=1;this.Me=B(e.t.advancedFilterModel)}resolveRowId(e,t,i){let r=this.e.t.resolveRowId;if(!r)return i;try{let o=r({data:e,index:t,api:this.e.api});if(typeof o=="string"&&o.length>0)return o;this.e.reportError(new Error("rowKey must resolve to a non-empty identifier"),"rowKey",{index:t})}catch(o){this.e.reportError(o,"rowKey",{index:t})}return i}get M(){return this.e.t.treeData}get g(){return this.e.t.datasource!=null}get be(){return this.g&&this.e.t.datasourceMode==="block"}Gi(){if(this.g){if(this.be)return this.Zt();let e=Math.max(0,this.ve.length-this.c.length);return(this.k??this.c.length)+e}return this.ve.length}Li(){return this.Or}Ve(){return this.Hr}Au(){return this.Da}_r(e){return!this.g||e?.aborted?Promise.resolve():(this.Ea(!0),this.be?(this.it.configure(this.e.t.maxBlocksInCache,this.e.t.datasourceMaxConcurrentRequests),this.zr(0,e)):this.Sa(0,void 0,e))}Et(e){this.Da=e,this.e.n.Et(e,this.e.u("loading"))}Sa(e,t,i){if(!this.g||this.Ai||this.k!=null&&e>=this.k)return Promise.resolve();let r=this.e.t.blockSize,o=t??e+r;if(o<=e)return Promise.resolve();let s=++this.Ze,a=new AbortController,l=()=>a.abort(i?.reason);return i?.addEventListener("abort",l,{once:!0}),this.Lr=a,this.Ai=!0,this.Et(!0),new Promise(d=>{let u=c=>{i?.removeEventListener("abort",l),s===this.Ze&&(this.Ai=!1,this.Lr=null,this.Et(!1),c!=null&&c?.name!=="AbortError"&&this.e.reportError(c,"datasource.getRows",{startRow:e,endRow:o})),d()};this.Ma(e,o,a.signal,(c,h)=>{if(s!==this.Ze||this.e.o()||a.signal.aborted){u();return}typeof h=="number"&&h>=0?this.k=h:c.length<o-e&&(this.k=e+c.length);let f=this.c.length===0;this.ku(c),u(),this.O(),f&&this.e.Ie(),this.e.W.Wr()},c=>u(a.signal.aborted||this.e.o()?void 0:c??new Error("Datasource request failed")))})}wo(){this.Ze++,this.Lr?.abort(),this.Lr=null,this.Ai=!1,this.Et(!1),this.it.Su(),this.tt.clear(),this.xt.clear(),this.Vr.clear();for(let[e,t]of this.Rt)this.p.get(e)===t&&this.p.delete(e);this.Rt.clear()}ku(e){for(let t of e){if(t==null)continue;let i=this.c.length,r=this.resolveRowId(t,i,`inf-${this.e.Qt()}`);if(this.p.has(r)){this.e.reportError(new Error(`Duplicate row id: ${r}`),"datasource.getRows",{rowId:r});continue}let o={id:r,data:t,rowIndex:-1,selected:this.e.f.$r(r)};this.c.push(o),this.p.set(r,o),this._.push(o)}}zr(e,t,i=0){if(!this.be||e<0)return Promise.resolve();if(t?.aborted)return Promise.reject(this.Ia(t.reason));let r=this.e.t.blockSize,o=this.Ze,s=e*r;if(s>=this.Zt())return Promise.resolve();let a=this.k==null?s+r:Math.min(this.k,s+r),l=this.it.load(e,d=>this.Pu(s,a,d),t,i);return this.Et(this.c.length===0&&this.it.snapshot().loadingBlockCount>0),l.then(d=>{o!==this.Ze||t?.aborted||this.e.o()||!this.be||!this.it.has(e)||this.Vr.has(e)||(this.Gu(e,d),this.O(),this.e.W.Wr(),o===this.Ze&&!this.e.o()&&this.Aa(this.e.s.Co().lastExcl-1))}).catch(d=>{throw d?.name!=="AbortError"&&this.e.reportError(d,"datasource.getRows",{startRow:s,endRow:a}),d}).finally(()=>{o===this.Ze&&this.Et(this.c.length===0&&this.it.snapshot().loadingBlockCount>0)})}Pu(e,t,i){return new Promise((r,o)=>{this.Ma(e,t,i,(s,a)=>r({rows:s,...typeof a=="number"&&a>=0?{lastRow:a}:{}}),s=>o(s instanceof Error?s:new Error(typeof s=="string"?s:"Datasource request failed")))})}Ma(e,t,i,r,o){let s=this.e.t.datasource,a=0,l=null,d=!1,u=()=>d?!1:(d=!0,l!=null&&clearTimeout(l),i.removeEventListener("abort",c),!0),c=()=>{u()&&o(this.Ia(i.reason))};i.addEventListener("abort",c,{once:!0});let h=()=>{if(d)return;if(i.aborted||this.e.o()){c();return}a++;let f=!1,m=g=>{if(!(f||d)){if(f=!0,i.aborted||this.e.o()){c();return}a<=this.e.t.datasourceRetryCount?l=setTimeout(h,this.retryDelay(a)):u()&&o(g)}};try{let g=s.getRows({startRow:e,endRow:t,sortModel:this.e.r.Q(),filterModel:this.Be(),advancedFilterModel:this.Ni(),quickFilterText:this.He,signal:i,onSuccess:(b,w)=>{!f&&u()&&r(b??[],w)},fail:m});g&&typeof g.catch=="function"&&g.catch(m)}catch(g){m(g)}};h()}Gu(e,t){let i=this.e.t.blockSize,r=e*i;this.xa(e),typeof t.lastRow=="number"&&t.lastRow>=0?this.k=t.lastRow:t.rows.length<i&&(this.k=r+t.rows.length),t.rows.forEach((o,s)=>{if(o==null)return;let a=r+s;if(this.k!=null&&a>=this.k)return;let l=this.resolveRowId(o,a,`block-${a}`),d=this.Rt.get(l),u=this.p.get(l);if(u&&u!==d&&u.rowIndex!==a){this.e.reportError(new Error(`Duplicate row id: ${l}`),"datasource.getRows",{rowId:l});return}let c=d??{id:l,data:o,rowIndex:a,selected:this.e.f.$r(l)};c.rowIndex=a,c.selected=this.e.f.$r(l),this.Rt.delete(l),this.tt.set(a,c),this.xt.delete(a),this.p.set(l,c),this.Fr.set(c,a+1)}),this.ka(),this.Vr.add(e)}xa(e){this.Vr.delete(e);let t=this.e.t.blockSize,i=e*t,r;for(let o=i;o<i+t;o++){let s=this.tt.get(o);s&&(r??(r=new Set(this.e.P.getDirtyRowIds())),this.tt.delete(o),r.has(s.id)?this.Rt.set(s.id,s):this.p.get(s.id)===s&&this.p.delete(s.id))}this.ka()}ka(){this.c=[...this.tt.entries()].sort(([e],[t])=>e-t).map(([,e])=>e),this._=this.c}Zt(){if(this.k!=null)return this.k;if(this.e.t.datasourceRowCount!=null)return this.e.t.datasourceRowCount;if(this.tt.size===0)return this.e.t.blockSize;let e=0;for(let t of this.tt.keys())e=Math.max(e,t+1);return e+this.e.t.blockSize}Lu(e){let t=this.xt.get(e);if(!t&&(t={id:`__mach_loading_${e}`,data:null,rowIndex:e,selected:!1,loading:!0},this.xt.set(e,t),this.xt.size>2e3)){let i=this.xt.keys().next().value;i!=null&&this.xt.delete(i)}return t}Ia(e){return oe(e,"Operation aborted")}retryDelay(e){let t=Math.min(this.e.t.datasourceRetryDelay*2**Math.max(0,e-1),3e4),i=this.e.t.datasourceRetryJitter;return Math.max(0,Math.round(t*(1+(Math.random()*2-1)*i)))}Nu(e){if(this.be){this.Aa(e);return}if(!this.g||this.Ai)return;let t=this.c.length;if(this.k!=null&&t>=this.k)return;let i=this.e.t.infiniteBufferRows;if(e+i<t&&e<t)return;let r=this.e.t.blockSize,o=this.k==null?t+r:Math.min(this.k,t+r);this.Sa(t,o)}Aa(e){if(e<0)return;this.Pa();let t=this.e.t.blockSize,i=Math.floor(e/t),r=Math.floor(this.e.s.Co().first/t),o=this.e.t.blockPrefetch,s=i<this.Ra?-1:1;this.Ra=i;for(let a=r;a<i;a++)this.zr(a,void 0,o+2).catch(()=>{});for(let a=0;a<=o;a++){let l=a===0?[i]:[i+s*a,i-s*a];for(let d of l)d<0||d*t>=this.Zt()||this.zr(d,void 0,o-a+1).catch(()=>{})}}Ga(){return this._r().catch(()=>{})}Fu(){return this.wo(),this.g?this._r().catch(()=>{}):(this.k=null,this.rt(this.e.t.rowData),this.e.$({data:!0}),Promise.resolve())}destroy(){this.et=null,this.wo(),this.La(),this.To(),this.c=this._=this.ve=this.we=[],this.p.clear(),this.te.clear(),this.Ii.clear(),this.Ta=[],this.A.clear(),this.z.clear(),this.Mi=[]}Do(e,t,i){if(!this.be)return Promise.resolve();this.Pa();let r=this.e.t.blockSize,o=Math.max(0,Math.trunc(e)),s=Math.min(this.Zt(),Math.max(o,Math.trunc(t))),a=Math.floor(o/r),l=Math.max(a,Math.floor(Math.max(o,s-1)/r)),d=[];for(let u=a;u<=l;u++)d.push(this.zr(u,i,100));return Promise.all(d).then(()=>{})}Ou(){this.be&&this.Ea(!1)}Ea(e){this.Na(),this.e.P.clear(),this.wo(),e&&(this.k=null,this.A.clear()),this.c=[],this._=[],this.p.clear(),this.e.H.clear(),this.O()}Na(){this.Hr++,this.e._e(),this.e.api.editing.stop({cancel:!0})}Hu(){return this.it.snapshot()}Pa(){let e=new Set(this.e.P.getDirtyRowIds());for(let[l,d]of this.Rt)e.has(l)||(this.Rt.delete(l),this.p.get(l)===d&&this.p.delete(l));let t=this.e.t.blockSize,i=new Set,{first:r,lastExcl:o}=this.e.s.Co();for(let l=r;l<o;l+=t)i.add(Math.floor(l/t));o>r&&i.add(Math.floor((o-1)/t));let s=this.e.s.v;s&&i.add(Math.floor(s.rowIndex/t));let a=this.e.a.Vu();a!=null&&i.add(Math.floor(a/t)),this.it.Eu(i)}rt(e){let t=this.e.t.resolveRowId,i=this.e.t.childrenKey;this.M&&we(e??[],i);let r=[],o=[],s=new Map,a=new Map,l=0,d=(u,c,h)=>{let f=l++,m=this.resolveRowId(u,f,`auto-${f}`);if(s.has(m))return this.e.reportError(new Error(`Duplicate row id: ${m}`),"rowData",{rowId:m,index:f}),null;let g=this.M?be(u,i):void 0,b={id:m,data:u,rowIndex:-1,selected:!1,treeChildrenLoaded:Array.isArray(g)};if(this.Nr.set(b,c),r.push(b),s.set(m,b),h!=null){let w=a.get(h)??[];w.push(m),a.set(h,w)}else o.push(b);if(this.M&&Array.isArray(g))for(let w of g)w!=null&&d(w,c+1,m);return b};(e??[]).forEach(u=>{u!=null&&d(u,0,null)}),this.e.t.rowData=e??[],this.Na(),this.La(),this.e.P.clear(),this.c=r,this._=o,this.te=a,this.p=s,this.e.H.clear();for(let u of[...this.A])s.has(u)||this.A.delete(u);if(this.e.t.defaultExpandAll)for(let u of r)this.Fa(u.id)>0&&this.A.add(u.id);this.e.f.Oa(t!=null),this.Kr()}Fi(e){return this.te.get(e)??[]}Fa(e){return this.te.get(e)?.length??0}xo(e){return this.Fa(e)>0}isTreeRowLoading(e){return this.p.get(e)?.treeLoading===!0}La(){for(let e of this.Qe.values())e.abort();this.Qe.clear(),this.ki.clear()}loadTreeChildren(e,t=!1){let i=this.p.get(e),r=this.e.t.loadTreeChildren;if(!this.M||!i?.data||!r)return Promise.resolve([]);if(!t&&i.treeChildrenLoaded)return Promise.resolve(this.Fi(e).flatMap(l=>{let d=this.p.get(l)?.data;return d==null?[]:[d]}));let o=this.ki.get(e);if(o&&!t)return o;this.Qe.get(e)?.abort();let s=new AbortController;this.Qe.set(e,s),i.treeLoading=!0,i.treeLoadError=void 0,this.e.$({data:!0});let a=Promise.resolve().then(()=>r({data:i.data,node:i,api:this.e.api,signal:s.signal})).then(l=>{if(s.signal.aborted||this.e.o())return[];if(!Array.isArray(l))throw new TypeError("[MachTable] loadTreeChildren must resolve to an array.");return this.Bu(i,l),i.treeChildrenLoaded=!0,i.treeLoadError=void 0,this.e.emit("treeChildrenLoaded",{rowId:e,rowNode:i,children:l}),l}).catch(l=>{if(s.signal.aborted||l?.name==="AbortError")return[];throw i.treeLoadError=l,i.treeChildrenLoaded=!1,this.e.reportError(l,"treeData.loadChildren",{rowId:e}),this.e.emit("treeChildrenLoadFailed",{rowId:e,rowNode:i,error:l}),l}).finally(()=>{this.Qe.get(e)===s&&(this.Qe.delete(e),this.ki.delete(e),i.treeLoading=!1,this.e.$({data:!0}))});return this.ki.set(e,a),a}Bu(e,t){let i=new Set,r=[...this.Fi(e.id)];for(;r.length>0;){let s=r.pop();i.has(s)||(i.add(s),r.push(...this.Fi(s)))}this._u(t,i,this.Ur(e)+1);for(let s of i)this.Qe.get(s)?.abort(),this.Qe.delete(s),this.ki.delete(s),this.te.delete(s),this.p.delete(s),this.A.delete(s);this.te.delete(e.id);let o=this.Ur(e)+1;for(let s of t)s!=null&&this.Ro(e,s,o);this.Ha(),this.e.f.Oa(this.e.t.resolveRowId!=null),this.O()}_u(e,t,i){we(e,this.e.t.childrenKey,i);let r=this.e.t.resolveRowId,o=r?new Set([...this.p.keys()].filter(l=>!t.has(l))):null,s=[...e],a=0;for(;s.length>0;){let l=s.pop();if(l==null)continue;if(r&&o){let u=r({data:l,index:a++,api:this.e.api});if(typeof u!="string"||u.length===0)throw new TypeError("[MachTable] rowKey must resolve to a non-empty identifier for lazy tree children.");if(o.has(u))throw new Error(`Duplicate row id: ${u}`);o.add(u)}let d=be(l,this.e.t.childrenKey);d&&s.push(...d)}}Oi(e,t=!0){this.M&&e.add?.length&&we(e.add,this.e.t.childrenKey);let i=this.e.t.resolveRowId,r=[],o=[];if(e.remove?.length){let a=new Set,l=new Set,d=c=>{if(i){let f=[this.resolveRowId(c,-1,`__missing_remove_${this.e.Qt()}`)];for(;f.length>0;){let m=f.pop();if(!a.has(m)){a.add(m);for(let g of this.te.get(m)??[])f.push(g)}}}else{let h=[c];for(;h.length>0;){let f=h.pop();l.add(f);let m=this.M?be(f,this.e.t.childrenKey):void 0;if(m)for(let g of m)h.push(g)}}};e.remove.forEach(d),this.c=this.c.filter(c=>{let h=a.has(c.id)||c.data!=null&&l.has(c.data);return h&&(o.push(c.id),this.p.delete(c.id),this.te.delete(c.id)),!h});let u=new Set(this.c);this._=this._.filter(c=>u.has(c))}if(e.update?.length)for(let a of e.update){let l;i?l=this.p.get(this.resolveRowId(a,-1,`__missing_update_${this.e.Qt()}`)):l=this.c.find(d=>d.data===a),l&&(r.push({node:l,before:l.data,after:a}),l.data=a,o.push(l.id),this.e.s.Va(l))}if(e.add?.length){let a=e.addIndex!=null?Math.max(0,Math.min(e.addIndex,this._.length)):this._.length,l=[];e.add.forEach((d,u)=>{let c=this.resolveRowId(d,a+u,`add-${this.e.Qt()}`);if(this.p.has(c)){this.e.reportError(new Error(`Duplicate row id: ${c}`),"transaction.add",{rowId:c});return}let h={id:c,data:d,rowIndex:-1,selected:!1};this.p.set(c,h),this.Nr.set(h,0);let f=this.M?be(d,this.e.t.childrenKey):void 0;if(f)for(let m of f)m!=null&&this.Ro(h,m,1);l.push(h)}),this._=this._.slice(0,a).concat(l,this._.slice(a)),this.Ha()}let s={pipelineChanged:this.zu(e,r),updatedRowIds:r.map(({node:a})=>a.id)};return this.e.H.Wu(o),this.$u(s,t),this.e.P.Ku(o),s}$u(e,t){e.pipelineChanged&&(this.et=null),t&&(e.pipelineChanged?this.Kr():e.updatedRowIds.length&&this.Ba())}Uu(e){if(e.length===0)return{pipelineChanged:!1,updatedRowIds:[]};let t=this.Hr,i=!1,r=new Set;for(let o of e){let s=this.Oi(o,!1);if(this.Hr!==t)return{pipelineChanged:!1,updatedRowIds:[]};i||(i=s.pipelineChanged);for(let a of s.updatedRowIds)r.add(a)}return i?this.Kr():r.size>0&&this.Ba(),{pipelineChanged:i,updatedRowIds:[...r]}}zu(e,t){if(e.add?.length||e.remove?.length)return!0;if(!t.length)return!1;let i=this._a();if(i===null)return!0;if(!i.length)return!1;let r=this.et;return!r||i.length!==r.fields.length||i.some((o,s)=>o!==r.fields[s])?!0:t.some(({node:o,before:s,after:a})=>Xr(s,a,i,r.values.get(o)))}_a(){if(this.M||this.e.t.masterDetail||this.za())return null;let e=this.e.r.l();if(e.some(i=>rt(i)||i.colDef.autoRowSpan===!0||i.colDef.rowSpan!=null))return null;let t=!this.e.t.manualFiltering;return jr({columns:e,customAggregates:this.e.t.aggFuncs,sortModel:this.e.t.manualSorting?[]:this.e.r.Q(),filterModel:t?this.Se:{},advancedFilter:t?this.Me:null,quickFilter:t?this.He:null})}ju(){let e=this._a(),t=e?.length?Yr(this.c,e):null;this.et=e&&t?{fields:e,values:t}:null}Ba(){this.e.emit("modelUpdated",{rowCount:this.we.length})}Ro(e,t,i){let r=this.resolveRowId(t,-1,`add-${this.e.Qt()}`);if(this.p.has(r)){this.e.reportError(new Error(`Duplicate row id: ${r}`),"transaction.add",{rowId:r});return}let o=be(t,this.e.t.childrenKey),s={id:r,data:t,rowIndex:-1,selected:!1,treeChildrenLoaded:Array.isArray(o)};this.p.set(r,s),this.Nr.set(s,i);let a=this.te.get(e.id)??[];if(a.push(s.id),this.te.set(e.id,a),!!o)for(let l of o)l!=null&&this.Ro(s,l,i+1)}Ha(){this.c=[];let e=t=>{this.c.push(t),this.p.has(t.id)||this.p.set(t.id,t);for(let i of this.te.get(t.id)??[]){let r=this.p.get(i);r&&e(r)}};for(let t of this._)e(t)}St(e){let t=JSON.stringify(this.Se),i=new Set(this.e.r.Z().map(o=>o.id));this.Se=le(e,i);let r=JSON.stringify(this.Se)!==t;return r&&(this.et=null),r}Be(){return{...this.Se}}qu(e=this.Me){let t=Object.keys(this.Se).length>0&&this.St(this.Se),i=(e!=null||this.Me!=null)&&this.nt(e);return t||i}nt(e){let t=new Set(this.e.r.Z().map(s=>s.id)),i=B(e,t),r=JSON.stringify(this.Me);this.Me=i,this.e.t.advancedFilterModel=i;let o=JSON.stringify(i)!==r;return o&&(this.et=null),o}Ni(){return B(this.Me)}Mt(e){let t=e!=null&&e.trim()!==""?e:null;return t===this.He?!1:(this.He=t,this.et=null,!0)}Eo(){return this.He}Hi(){return Object.keys(this.Se).length>0||this.Me!=null||this.He!=null}O(){this.Kr(),this.e.$({data:!0})}So(){this.g?this.Ga():this.O()}Kr(){this.et=null;let e=this.e.Ce.start(),t=this.e.r.l(),i=(s,a)=>this.e.d(s,a);if(this.g){this.Yu(e);return}if(this.Xu(e))return;let r,o=[];if(this.M)r=this.Ju(t,i);else{r=this.c,this.Hi()&&!this.e.t.manualFiltering&&(r=r.filter(Di(t,this.Se,this.Me,this.He,i)));let a=this.e.r.Q();if(a.length>0&&!this.e.t.manualSorting)try{r=xi(r,a,t,i)}catch(d){this.e.reportError(d,"comparator",{sortModel:a})}let l=this.e.r.Je();if(l.length>0){let d=this.Zu(r,l);r=d.rows,o=d.ambiguousExpansions}else if(this.e.t.masterDetail){let d=[];for(let u of r)d.push(u),this.A.has(u.id)&&this.isRowExpandable(u)&&d.push({id:`__detail__${u.id}`,data:u.data,rowIndex:-1,selected:!1,isDetail:!0,masterId:u.id});r=d}}this.Wa(r,e,!0),this.Qu(o)}Wa(e,t,i=!1){for(let o of this.c)o.rowIndex=-1;let r=0;e.forEach((o,s)=>{o.rowIndex=s,!o.isDetail&&!o.isGroup&&this.Fr.set(o,++r)}),this.we=e,this.Vi(),i&&this.ju(),this.ec((o,s)=>this.e.d(o,s)),this.e.emit("modelUpdated",{rowCount:e.length}),this.e.Ce.$a(t)}Yu(e){this.c.forEach((t,i)=>{this.be||(t.rowIndex=i),this.Fr.set(t,this.be?t.rowIndex+1:i+1)}),this.ve=this.c,this.we=this.c,this.Ii.clear(),this.e.t.getRowHeight&&this.e.s.ot(),this.Or++,this.e.emit("modelUpdated",{rowCount:this.c.length}),this.e.Ce.$a(e)}Xu(e){let t=this.bo;return this.bo=!1,!t&&this.za()?(this.tc(e),!0):(this.To(),!1)}za(){if(!this.e.t.dataProcessor||this.c.length<this.e.t.dataProcessorMinRows||this.M||this.e.t.masterDetail||this.e.r.Je().length>0)return!1;let e=!this.e.t.manualFiltering&&this.Hi(),t=!this.e.t.manualSorting&&this.e.r.Q().length>0;return e||t}tc(e){this.To();let t=this.e.t.dataProcessor;if(!t)return;let i=++this.Pi,r=new AbortController;this.Br=r;let o=this.e.r.l(),s=this.c.flatMap(d=>d.data==null?[]:[{id:d.id,data:d.data}]),a=!this.e.t.manualFiltering,l=!this.e.t.manualSorting;Promise.resolve().then(()=>t.process({rows:s,columns:o.map(d=>({colId:d.id,...d.colDef.field?{field:d.colDef.field}:{}})),sortModel:l?this.e.r.Q():[],filterModel:a?this.Be():{},advancedFilterModel:a?this.Ni():null,quickFilterText:a?this.He:null,signal:r.signal})).then(d=>{if(i!==this.Pi||r.signal.aborted||this.e.o())return;let u=new Set,c=[];for(let h of d.rowIds){if(u.has(h))continue;u.add(h);let f=this.p.get(h);f&&!f.isDetail&&!f.isGroup&&c.push(f)}this.Wa(c,e),this.e.$({data:!0})}).catch(d=>{i!==this.Pi||r.signal.aborted||this.e.o()||(this.e.reportError(d,"dataProcessor.process"),this.bo=!0,this.O())}).finally(()=>{i===this.Pi&&(this.Br=null)})}To(){this.Pi++,this.Br?.abort(),this.Br=null}get Te(){return this.e.t.paginationEnabled&&!this.g}Vi(){if(this.e.t.getRowHeight&&this.e.s.ot(),!this.Te){this.ve=this.we,this.Or++;return}let e=this.Bi(),t=this.getPageCount();this.V>t&&(this.V=t),this.V<1&&(this.V=1),this.e.t.paginationPage=this.V;let i=(this.V-1)*e;this.ve=this.e.t.paginationMode==="server"?this.we:this.we.slice(i,i+e),this.ve.forEach((r,o)=>{r.rowIndex=o}),this.Or++}Bi(){return Math.max(1,this.e.t.paginationPageSize)}ei(){return this.Te?this.V:1}getTotalRowCount(){return this.g?this.Gi():this.Te&&this.e.t.paginationMode==="server"?this.e.t.paginationTotal:this.we.length}getPageCount(){return this.Te?Math.max(1,Math.ceil(this.getTotalRowCount()/this.Bi())):1}Ka(){return this.we}setPage(e,t=!1){if(!this.Te)return;let i=this.getPageCount(),r=Math.max(1,Math.min(Math.round(e)||1,i));r!==this.V&&(this.V=r,this.e.t.paginationPage=r,this.Vi(),this.e.$({data:!0}),this.e.s.jr(0,"top"),t||this._i())}setPageSize(e){if(!this.Te)return;let t=Math.max(1,Math.round(e)||this.Bi()),i=(this.V-1)*this.Bi();this.e.t.paginationPageSize=t,this.V=Math.floor(i/t)+1,this.e.t.paginationPage=this.V,this.Vi(),this.e.$({data:!0}),this._i()}Ua(e,t){this.e.t.paginationPageSize=t,this.V=e,this.e.t.paginationPage=this.V}ja(e){this.e.t.paginationEnabled!==e&&(this.e.t.paginationEnabled=e&&!this.g,this.e.t.paginationEnabled&&(this.V=1),e||this.we.forEach((t,i)=>{t.rowIndex=i}),this.Vi(),this.e.$({data:!0}),this._i())}ic(){this.Te&&(this.V=this.e.t.paginationMode==="server"?this.e.t.paginationPage:1,this.Vi(),this.e.$({data:!0}),this._i())}_i(e=this.Bi()){this.e.emit("paginationChanged",{page:this.ei(),pageSize:e,pageCount:this.getPageCount(),total:this.getTotalRowCount()})}Ju(e,t){let i=this.e.t.manualSorting?[]:this.e.r.Q(),r=new Map,o=this.Hi()&&!this.e.t.manualFiltering,s=Di(e,this.Se,this.Me,this.He,t),a=u=>{let c=r.get(u.id);if(c!==void 0)return c;let h=!0;if(o){h=s(u);for(let f of this.te.get(u.id)??[]){let m=this.p.get(f);m&&a(m)&&(h=!0)}}return r.set(u.id,h),h},l=[],d=u=>{let c=u;i.length>0&&(c=xi(u,i,e,t));for(let h of c)if(a(h)&&(l.push(h),this.A.has(h.id))){let f=(this.te.get(h.id)??[]).map(m=>this.p.get(m)).filter(m=>m!=null);d(f)}};return d(this._),l}rc(){let e=this.Ta,t=0;for(let i of this.ve)!i.isDetail&&!i.isGroup&&(e[t++]=i);return e.length=t,e}nc(e,t,i,r){let o=t.colDef.rowSpan;if(!o)return 1;try{let s=o({api:this.e.api,colDef:t.colDef,column:t,node:e,data:e.data,value:i,rowIndex:e.rowIndex});return Math.max(1,Math.min(Math.round(s)||1,r))}catch(s){return this.e.reportError(s,"rowSpan",{colId:t.id,rowId:e.id}),1}}oc(e,t,i,r,o){if(!i.colDef.autoRowSpan||r==null||r==="")return 1;let s=1;for(;t+s<e.length&<(r,o(e[t+s],i))===0;)s++;return s}sc(e,t,i){let r=new Int32Array(e.length),o=0;for(;o<e.length;){let s=e[o],a=i(s,t),l=t.colDef.rowSpan?this.nc(s,t,a,e.length-o):this.oc(e,o,t,a,i);r[o]=l;for(let d=1;d<l;d++)r[o+d]=-1;o+=l}return r}ec(e){if(this.Ii.clear(),this.M||this.e.t.masterDetail||this.e.r.Je().length>0)return;let t=this.e.r.l().filter(r=>r.colDef.rowSpan!=null||r.colDef.autoRowSpan===!0);if(t.length===0)return;let i=this.rc();if(i.length!==0)for(let r of t)this.Ii.set(r.id,this.sc(i,r,e))}ac(e){return this.Ii.get(e)}qa(e){return this.Fr.get(e)??0}Ur(e){return this.Nr.get(e)??0}Zu(e,t){let i=Ri(this.e.t.aggFuncs),r=this.e.r.Du();this.Mi=[];let o=l=>{let d={};for(let u of r){let c=i(u.colDef.aggFunc);if(c)try{d[u.id]=zr(l,c,h=>this.e.d(h,u))}catch(h){this.e.reportError(h,"aggFunc",{colId:u.id,aggFunc:u.colDef.aggFunc}),d[u.id]=null}}return d},s=Ur(this.z,this.c,t,(l,d)=>this.e.d(l,d));this.z=s.expanded;let a=Kr(e,t,(l,d)=>this.e.d(l,d),o,this.z);return this.Mi=a.ids,{rows:a.rows,ambiguousExpansions:s.ambiguous}}Qu(e){for(let t of e){if(this.e.o())return;this.e.reportError(new Error(`Ambiguous legacy group expansion: ${t}`),"gridState.groupExpansion",{groupId:t})}}isRowExpandable(e){let t=this.M;if(t){if(this.xo(e.id)||e.treeLoading)return!0;if(e.treeChildrenLoaded||!e.data||!this.e.t.loadTreeChildren)return!1}else if(!this.e.t.masterDetail)return!1;let i=t?"isTreeRowExpandable":"isRowExpandable",r=this.e.t[i];if(!r)return!t;try{return r({data:e.data,node:e,api:this.e.api})}catch(o){return this.e.reportError(o,i,{rowId:e.id}),!1}}isRowExpanded(e){return this.A.has(e)}lc(){return[...this.A]}dc(){return[...this.z]}uc(e,t){this.A=new Set(e.filter(i=>this.p.has(i))),this.z=new Set(t)}cc(e){return this.Mo(e,!0)}hc(e){return this.Mo(e,!1)}qr(e){return this.Mo(e,!this.A.has(e))}Mo(e,t){let i=this.p.get(e);return!i||t&&!this.isRowExpandable(i)?!1:(t===this.A.has(e)||(t?this.A.add(e):this.A.delete(e),this.O(),this.e.emit("detailToggled",{rowId:e,rowNode:i,expanded:t}),t&&this.M&&!this.xo(e)&&!i.treeLoading&&this.loadTreeChildren(e).catch(()=>{})),t)}setAllDetailsExpanded(e){let t=!1;if(e)for(let i of this.c)!this.A.has(i.id)&&this.isRowExpandable(i)&&(this.A.add(i.id),t=!0);else this.A.size>0&&(this.A.clear(),t=!0);t&&this.O()}Io(e){return this.setGroupExpanded(e,!this.z.has(e))}isGroupExpanded(e){return this.z.has(e)}setAllGroupsExpanded(e){let t=this.z.size;if(e)for(let i of this.Mi)this.z.add(i);else this.z.clear();this.z.size!==t&&this.O()}setGroupExpanded(e,t){return!this.Mi.includes(e)||t===this.z.has(e)||(t?this.z.add(e):this.z.delete(e),this.O()),t}Ya(){return!this.M&&!this.g&&!this.e.t.dataProcessor&&this.e.t.paginationMode!=="server"&&this.e.r.Q().length===0&&this.e.r.Je().length===0}Xa(e,t){if(!this.Ya()||!Number.isInteger(e)||!Number.isInteger(t))return!1;let i=this.h(e),r=this.h(t);if(!i||!r||i.isDetail||r.isDetail||i.isGroup||r.isGroup)return!1;let o=this.c.indexOf(i),s=this.c.indexOf(r);return o<0||s<0||o===s?!1:(this.c.splice(o,1),this.c.splice(s,0,i),this.O(),!0)}Oe(){return this.c}pc(){return this._}It(){return this.ve}G(){return this.be?this.Zt():this.ve.length}h(e){return this.be?e<0||e>=this.Zt()?void 0:this.tt.get(e)??this.Lu(e):this.ve[e]}F(e){return this.p.get(e)}fc(e){this.c.forEach(e)}mc(e){let t=0;for(let i of this.we)i.isDetail||i.isGroup||e(i,t++)}};var mt=class{constructor(e){this.e=e;this.L=new Set;this.At=null;this.zi=new Set}$r(e){return this.L.has(e)}gc(e){return this.zi.has(e)}ze(e,t){if(e.loading)return!1;if(e.isGroup||e.isDetail)return!0;let i=t===void 0?this.Ao():t,r=i?.colDef.selectable;if(!i||!r)return!0;try{return r({api:this.e.api,colDef:i.colDef,column:i,node:e,data:e.data,value:this.e.d(e,i),rowIndex:e.rowIndex})}catch(o){return this.e.reportError(o,"selectable",{rowId:e.id,colId:i.id}),!1}}Ao(){return this.e.r.l().find(e=>e.hasCheckbox&&e.colDef.selectable!=null)}ti(){return this.e.i.Oe().filter(e=>this.L.has(e.id))}Ja(e=this.ti()){return e.filter(t=>t.data!=null).map(t=>t.data)}ko(){return[...this.L]}Za(e){let t=new Set(e),i=this.Ao()??null,r=this.e.i.Oe().filter(o=>t.has(o.id)&&!o.isDetail&&!o.isGroup&&this.ze(o,i)).map(o=>({node:o,selected:!0}));this.kt(r,!0)}yc(){this.Za(this.e.t.rowSelection==="none"?[]:this.ko())}Oa(e){let t=this.e.i;if(!e)this.L.clear(),this.At=null;else{for(let i of this.L)t.F(i)||this.L.delete(i);this.At!=null&&!t.F(this.At)&&(this.At=null)}this.Qa(null);for(let i of t.Oe())i.selected=this.L.has(i.id)}tl(e){let{selectable:t,selected:i}=this.il(e.leafNodes??[],!1);return{all:i>0&&i===t,some:i>0}}vc(e,t){let i=(e.leafNodes??[]).filter(r=>this.ze(r));i.length!==0&&this.kt(i.map(r=>({node:r,selected:t})))}Po(e,t,i=!1){this.kt([{node:e,selected:t,clearOthers:i}])}bc(e,t=!0,i=!0){let r=this.e.i.F(e);r&&this.Po(r,t,i)}wc(e,t,i){if(!i||!t.shiftKey||this.At==null)return!1;let r=this.e.i.F(this.At);if(!r||r.rowIndex<0||e.rowIndex<0)return!1;let o=Math.min(r.rowIndex,e.rowIndex),s=Math.max(r.rowIndex,e.rowIndex),a=[];for(let l=o;l<=s;l++){let d=this.e.i.h(l);d&&!d.isDetail&&!d.isGroup&&a.push({node:d,selected:!0})}return this.kt(a),!0}rl(e,t,i){let r=this.e.t.rowSelection;if(r==="none"||!this.ze(e))return;let o=r==="multiple",s=o&&(i||t.ctrlKey||t.metaKey);!s&&this.wc(e,t,o)||(this.Po(e,!s||!e.selected,!s),this.At=e.id)}selectAll(e=!0){if(this.e.t.rowSelection==="none")return;let i=e?this.e.i.It():this.e.i.Oe();this.kt(i.filter(r=>!r.isDetail&&!r.isGroup).map(r=>({node:r,selected:!0})))}deselectAll(){this.kt([],!0)}Cc(){let e=this.e.i,{selectable:t,selected:i}=this.il(e.It(),!0),r=i>0&&i===t&&(!e.g||t>=e.Gi());return{all:r,some:i>0&&!r}}il(e,t){let i=0,r=0;for(let o of e)t&&(o.isDetail||o.isGroup)||!this.ze(o)||(i++,this.L.has(o.id)&&r++);return{selectable:i,selected:r}}Tc(e,t){let i=this.e.i,r=this.e.t.rowSelection==="single",o=!r&&i.M&&this.e.t.autoCheckedChildren,s=(a,l,d=!1)=>{if(l?(d||this.ze(a,t))&&this.L.add(a.id):this.L.delete(a.id),!!o)for(let u of i.Fi(a.id)){let c=i.F(u);c&&s(c,l)}};for(let{node:a,selected:l}of e)if(s(a,l,!0),r&&l)break}Dc(e){let t=new Set(e);for(let i of this.L)t.delete(i)||t.add(i);return t}xc(e){let t=[];for(let i of this.e.i.Oe()){let r=this.L.has(i.id);(i.selected!==r||e.has(i.id)||this.zi.has(i.id))&&i.rowIndex>=0&&t.push(i.rowIndex),i.selected=r}return t}kt(e,t=!1){let i=this.e.t.rowSelection,r=this.Ao()??null,o=e.filter(u=>!u.selected||i!=="none"&&this.ze(u.node,r));if(e.length>0&&o.length===0)return;let s=new Set(this.L);(t||o.some(u=>u.selected?i==="single"||u.clearOthers:u.clearOthers&&this.ze(u.node,r)))&&this.L.clear(),this.Tc(o,r);let a=new Set(this.zi);this.Qa(r);let l=this.Dc(s),d=this.xc(a);if(l.size>0){this.e.s.O(d),this.e.W.Wr();let u=this.ti();this.e.emit("selectionChanged",{selectedNodes:u,selectedRows:this.Ja(u)})}}Qa(e){this.zi.clear();let t=this.e.i;if(this.e.t.rowSelection!=="multiple"||!t.M||this.L.size===0)return;let i=r=>{let o=e&&t.F(r),s=!o||this.ze(o,e),a=!0,l=!1;for(let d of t.Fi(r)){let u=i(d);a&&(a=u.all),l||(l=u.some)}if(a&&!l){s||this.L.delete(r);let d=this.L.has(r);return{all:d||!s,some:d}}return s&&a?this.L.add(r):(this.L.delete(r),s&&l&&this.zi.add(r)),{all:a,some:l}};for(let r of t.pc())i(r.id)}};var gt=class{constructor(e){this.e=e;this.Pt=null;this.ie=0;this.st=0;this.We=null;this.ii=null;this.Wi=e=>{let t=this.No(e);t&&(this.st=this.sl(t,e.clientX),t.didResize||(t.didResize=Math.abs(this.st-t.startWidth)>=.5),!this.ie&&(this.ie=requestAnimationFrame(()=>{this.ie=0,this.Sc()})))};this.ni=e=>{let t=this.No(e);t&&(this.st=this.sl(t,e.clientX),t.didResize||(t.didResize=Math.abs(this.st-t.startWidth)>=.5),this.Mc(t))};this.Yr=e=>{this.No(e)&&this.at()};this.Ic=()=>{this.at()};this.Fo=e=>{e.key==="Escape"&&(e.preventDefault(),this.at())}}Rc(e,t){if(!this.e.t.enableColumnResize||!t.resizable||e.isPrimary===!1)return;this.at();let i=e.currentTarget,r=t.currentWidth;this.st=r,this.Pt={column:t,didResize:!1,handle:i,pointerId:e.pointerId,startFlex:t.flex,startManualWidth:t.manualWidth,startWidth:r,startX:e.clientX,startPreserveWidths:this.e.r.Xe},this.Go(i,!0);try{i.setPointerCapture?.(e.pointerId)}catch{}this.e.n.root.classList.add("mach-root--resizing"),i.classList.add("mach-header-resize--active"),this.Ec(this.Pt)}at(e=!0){let t=this.Pt;t&&(this.Pt=null,this.Lo(),this.Go(t.handle,!1),e&&(this.nl(t),this.e.ri()),this.e.n.root.classList.remove("mach-root--resizing"),this.ol(t))}nl(e){e.column.manualWidth=e.startManualWidth,e.column.flex=e.startFlex,e.column.currentWidth=e.startWidth,this.e.r.Xe=e.startPreserveWidths}Mc(e){this.Pt=null,this.Lo(),e.didResize&&(Math.abs(this.st-e.startWidth)<.5?this.nl(e):this.e.r.Ee(e.column,this.st),this.e.ri()),this.Go(e.handle,!1);try{e.handle.releasePointerCapture?.(e.pointerId)}catch{}this.e.n.root.classList.remove("mach-root--resizing"),this.ol(e),e.didResize&&this.e.lt([e.column])}Sc(){let e=this.Pt;!e?.didResize||!this.e.r.Ee(e.column,this.st)||(this.e.ri(),this.$i(e),this.e.al(e.column,!1))}Ec(e){this.We=p("div","mach-column-resize-guide"),this.We.setAttribute("aria-hidden","true"),this.ii=p("span","mach-column-resize-label"),this.We.appendChild(this.ii),this.e.n.root.appendChild(this.We),this.$i(e)}$i(e){if(!this.We||!this.ii)return;let t=this.e.n.root,i=t.getBoundingClientRect(),r=e.handle.parentElement.getBoundingClientRect(),o=Math.max(0,Math.min(t.clientWidth,r.right-i.left-t.clientLeft)),s=Math.max(32,Math.min(t.clientWidth-32,o));this.We.style.left=`${o}px`,this.We.style.top=`${Math.max(0,r.top-i.top-t.clientTop)}px`,this.ii.style.left=`${s-o}px`,this.ii.textContent=`${Math.round(e.column.currentWidth)} px`}ol(e){e.handle.classList.remove("mach-header-resize--active"),this.We?.remove(),this.We=null,this.ii=null}sl(e,t){let i=Number.isFinite(t)?t:e.startX;return U(Math.max(1,e.startWidth+i-e.startX),{minWidth:e.column.minWidth??e.column.colDef.minWidth,maxWidth:e.column.colDef.maxWidth})}No(e){let t=this.Pt;return t&&e.pointerId===t.pointerId?t:null}Lo(){this.ie&&cancelAnimationFrame(this.ie),this.ie=0}Go(e,t){S(window,t,{pointermove:this.Wi}),S(window,t,{pointerup:this.ni,pointercancel:this.Yr,keydown:this.Fo},!0),S(e,t,{lostpointercapture:this.Ic})}destroy(){this.at(!1),this.Lo(),this.e.n.root?.classList.remove("mach-root--resizing")}};var Jr=6,yt=class{constructor(e){this.e=e;this.Ki=null;this.oi=null;this.Oo=!1;this.se=0;this.Xr=null;this.Wi=e=>{if(this.oi){this.Pc(e);return}let t=this.Ki;t&&(Math.abs(e.clientX-t.startX)<Jr&&Math.abs(e.clientY-t.startY)<Jr||this.Gc(e))};this.ni=e=>{this.Ki=null,e.type!=="pointercancel"&&this.oi&&this.Vo(e.clientX,e.clientY),this.Ho();let t=this.ll();t&&e.type!=="pointercancel"&&t.targetIndex>=0&&this.e.Ei(t.column.id,t.targetIndex)}}Ac(e,t){e.button===0&&t.movable&&(this.Ki={column:t,startX:e.clientX,startY:e.clientY},this.Ui(!0))}Ui(e){S(window,e,{pointermove:this.Wi,pointerup:this.ni,pointercancel:this.ni})}kc(){let e=this.Oo;return this.Oo=!1,e}Gc(e){let t=this.Ki;if(!t)return;let i=this.e.W.Gt(t.column.id,this.e.r.ge(t.column));if(!i||!i.parentElement){this.Ho();return}this.Oo=!0;let r=p("div","mach-drop-indicator"),o=p("div","mach-column-drag-ghost");o.textContent=t.column.colDef.headerName??t.column.colDef.field??t.column.id,o.ariaHidden="true",A(o,this.e.n.root),document.body.appendChild(o),i.parentElement.appendChild(r),i.classList.add("mach-header-cell--dragging"),this.e.n.root.classList.add("mach-root--dragging");let s=this.e.r.ge(t.column),a=this.e.n.si[s],l=this.e.r.R(s),d=new Float64Array(l.length+1),u=new Float64Array(l.length);for(let h=0;h<l.length;h++){let f=l[h].currentWidth;u[h]=d[h]+f/2,d[h+1]=d[h]+f}let c=o.getBoundingClientRect();this.oi={column:t.column,cellEl:i,ghost:o,indicator:r,targetIndex:-1,pane:s,containerLeft:a.getBoundingClientRect().left,startScrollLeft:this.e.n.b.center.scrollLeft,fromIndex:l.indexOf(t.column),midpoints:u,offsets:d,ghostWidth:c.width,ghostHeight:c.height},this.Vo(e.clientX,e.clientY)}Pc(e){this.Xr={clientX:e.clientX,clientY:e.clientY},!this.se&&(this.se=requestAnimationFrame(()=>{this.se=0;let t=this.Xr;this.Xr=null,t&&this.Vo(t.clientX,t.clientY)}))}Vo(e,t){let i=this.oi;if(!i)return;let r=T(e+12,8,window.innerWidth-i.ghostWidth-8),o=T(t+12,8,window.innerHeight-i.ghostHeight-8);i.ghost.style.transform=`translate3d(${r}px, ${o}px, 0)`;let s=i.pane==="center"?this.e.n.b.center.scrollLeft-i.startScrollLeft:0,a=e-(i.containerLeft-s),l=i.midpoints.length;for(let d=0;d<i.midpoints.length;d++)if(a<i.midpoints[d]){l=d;break}i.targetIndex=l>i.fromIndex?l-1:l,i.indicator.style.transform=`translate3d(${i.offsets[l]}px, 0, 0)`}ll(){let e=this.oi;return e?(this.oi=null,e.cellEl.classList.remove("mach-header-cell--dragging"),e.ghost.remove(),e.indicator.remove(),this.e.n.root.classList.remove("mach-root--dragging"),e):null}Ho(){this.Ui(!1),this.se&&cancelAnimationFrame(this.se),this.se=0,this.Xr=null}destroy(){this.Ho(),this.ll(),this.Ki=null}};var Si=/^[+-]?(?:\d+(?:\.\d+)?|\.\d+)(?:[eE][+-]?\d+)?$/;function vt(n,e=!0){if(n==="")return null;if(!e||typeof n!="string"||!Si.test(n)||/^[+-]?0\d/.test(n))return n;let t=Number(n);return Number.isFinite(t)&&(!Number.isInteger(t)||Number.isSafeInteger(t))?t:n}function Mi(n,e){let t=n==null?"":String(n);return t.includes(e)||t.includes('"')||t.includes(`
|
|
1
|
+
var je="0.42.2";function v(n,e){return Object.prototype.hasOwnProperty.call(n,e)}function x(n,e,t=!1){if(!(typeof n!="number"||!Number.isFinite(n)||n<e))return t?Math.floor(n):n}function E(n,e,t,i=!1){return x(n,t,i)??e}function I(n){return x(n,0)||void 0}function qe(n){return!n||typeof n.key!="string"||!n.key.trim()?null:{key:n.key.trim(),debounceMs:x(n.debounceMs,0,!0)??160,...n.sections?{sections:[...new Set(n.sections)]}:{},...n.store?{store:n.store}:{}}}function R(n,e,t,i=!1){let r=!1;for(let o of t)(i?v(n,o):n[o]!=null)&&(e[o]=n[o],r=!0);return r}var Zt=new WeakMap,Ye=new WeakMap;function Se(n){let e=Zt.get(n);return e||(e={},Zt.set(n,e)),e}function Qt(n){return Zt.get(n)}function Xe(n,e){e?Ye.set(n,e):Ye.delete(n)}function Je(n){let e=Ye.get(n);return Ye.delete(n),e}function p(n,e,t){let i=document.createElement(n);if(e&&(i.className=e),t)for(let r of Object.keys(t))i.setAttribute(r,t[r]);return i}function $(n,e,t){let i=p("button",n);return i.type="button",i.textContent=e,i.addEventListener("click",t),i}function S(n,e,t,i=!1){let r=e?"addEventListener":"removeEventListener";for(let[o,s]of Object.entries(t))n[r](o,s,i)}function V(n,e,t){S(document,n,{mousedown:e,keydown:t},!0)}function A(n,e){if(n.classList.add("mach-portal"),!e)return;let t=window.getComputedStyle(e);for(let i=0;i<t.length;i++){let r=t.item(i);if(!r.startsWith("--mach-"))continue;let o=t.getPropertyValue(r).trim();o&&n.style.setProperty(r,o)}n.style.colorScheme=t.colorScheme}function T(n,e,t){return n<e?e:n>t?t:n}function ee(n,e,t=4){let i=e.getBoundingClientRect(),r=n.getBoundingClientRect(),o=i.bottom+t,s=o+r.height>window.innerHeight-8?i.top-r.height-t:o;n.style.left=`${T(i.left,8,Math.max(8,window.innerWidth-r.width-8))}px`,n.style.top=`${T(s,8,Math.max(8,window.innerHeight-r.height-8))}px`}var ar=0;function lr(n="rg"){return ar++,`${n}-${ar}`}var dr='<svg viewBox="0 0 16 16" width="12" height="12" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><path d="M2 3.5h12L9.5 8v4.5L6.5 14V8L2 3.5z"/></svg>',ur='<svg viewBox="0 0 16 16" width="10" height="10" fill="currentColor"><path d="M8 3l4 5H4l4-5z"/></svg>',cr='<svg viewBox="0 0 16 16" width="10" height="10" fill="currentColor"><path d="M8 13l4-5H4l4 5z"/></svg>',hr='<svg viewBox="0 0 16 16" width="12" height="12" fill="none" stroke="currentColor" stroke-width="1.35" stroke-linecap="round"><path d="M2 4h3m3 0h6M2 8h7m3 0h2M2 12h1m3 0h8"/><circle cx="6.5" cy="4" r="1.35"/><circle cx="10.5" cy="8" r="1.35"/><circle cx="4.5" cy="12" r="1.35"/></svg>';function fe(n,e,t,i,r=e.rowIndex){return{api:n.api,colDef:t.colDef,column:t,node:e,data:e.data,value:i,rowIndex:r}}function ei(n){if(n==null)return"";if(n instanceof Date)return n.toLocaleDateString();if(typeof n=="object")try{return JSON.stringify(n)}catch{return String(n)}return String(n)}function L(n,e){let t=Qt(e);if(!t)return;t.flashTimer&&clearTimeout(t.flashTimer),t.flashTimer=void 0;let i=t.destroy;if(t.destroy=void 0,t.refresh=void 0,t.rendererDefinition=void 0,t.rendererRowId=void 0,t.rendererColumnId=void 0,!!i)try{i()}catch(r){n.reportError(r,"cellRenderer.destroy",{colId:e.dataset.colId})}}function pr(n,e,t,i,r,o){let s=n.t.tooltipComponent?"":o,a=i.colDef.tooltipValueGetter;if(a)try{s=a({api:n.api,colDef:i.colDef,column:i,node:t,data:t.data,value:r})??o}catch(l){n.reportError(l,"tooltipValueGetter",{colId:i.id,rowId:t.id})}s?e.setAttribute("title",s):e.removeAttribute("title")}function ro(n,e,t,i,r,o){let s=Qt(e);if(!s?.refresh||s.rendererDefinition!==r||s.rendererRowId!==t.id||s.rendererColumnId!==i.id)return!1;try{return e.querySelector(":scope > .mach-cell-edit-trigger")?.remove(),s.refresh(o)!==!1}catch(a){return n.reportError(a,"cellRenderer.refresh",{colId:i.id,rowId:t.id}),!1}}function me(n,e,t){return q(n,e,t,n.d(e,t))}function q(n,e,t,i){let r=t.colDef.valueFormatter;if(r)try{let o=r({api:n.api,colDef:t.colDef,column:t,node:e,data:e.data,value:i});return o==null?"":String(o)}catch(o){n.reportError(o,"valueFormatter",{colId:t.id,rowId:e.id})}return ei(i)}function no(n,e,t,i){let r=i.colDef.cellStyle,o=Se(e),s=o.styleKeys;if(s)for(let d of s)Reflect.set(e.style,d,"");if(!r){o.styleKeys=void 0;return}let a;if(typeof r=="function"){let d=n.d(t,i);try{a=r(fe(n,t,i,d))}catch(u){n.reportError(u,"cellStyle",{colId:i.id,rowId:t.id}),a=null}}else a=r;if(!a){o.styleKeys=void 0;return}let l=Object.keys(a);for(let d of l)Reflect.set(e.style,d,Reflect.get(a,d));o.styleKeys=l}function oo(n,e){let t=n.firstElementChild,i=t?.className==="mach-cell-text"?t:p("span","mach-cell-text");i.textContent!==e&&(i.textContent=e),n.replaceChildren(i)}function so(n,e,t,i){let r=n.d(t,i),o=q(n,t,i,r),s=i.colDef.cellRenderer,a=typeof s=="string"?n.mu(s):s,l=o;if(a){let d={api:n.api,colDef:i.colDef,column:i,node:t,data:t.data,value:r,formatted:o,rowIndex:t.rowIndex,rendererParams:i.colDef.cellRendererParams};if(ro(n,e,t,i,a,d)){pr(n,e,t,i,r,o);return}L(n,e);try{l=a(d)}catch(u){n.reportError(u,"cellRenderer",{colId:i.id,rowId:t.id})}}else L(n,e);if(typeof l=="string")oo(e,l);else if(l instanceof HTMLElement)e.replaceChildren(l);else if(l&&typeof l=="object"&&l.el instanceof HTMLElement){let d=l;e.replaceChildren(d.el);let u=Se(e);u.destroy=d.destroy,d.refresh&&(u.refresh=c=>d.refresh(c),u.rendererDefinition=a,u.rendererRowId=t.id,u.rendererColumnId=i.id)}else e.textContent="";pr(n,e,t,i,r,o)}function Ze(n){let{align:e}=n.colDef;return e==="left"?"mach-cell--left":e==="right"?"mach-cell--right":"mach-cell--center"}function ao(n,e,t,i){let r=i.colDef.cellClass;if(!r)return;if(typeof r=="string"){e.push(r);return}if(Array.isArray(r)){e.push(...r);return}let o=fe(n,t,i,n.d(t,i));try{let s=r(o);typeof s=="string"?e.push(s):Array.isArray(s)&&e.push(...s)}catch(s){n.reportError(s,"cellClass",{colId:i.id,rowId:t.id})}}function lo(n,e,t){e.classList.contains("mach-cell--focus")&&n.push("mach-cell--focus"),e.classList.contains("mach-cell--editing")&&n.push("mach-cell--editing"),t.colDef.wrapText&&n.push("mach-cell--wrap")}function ti(n,e,t,i){let r=["mach-cell",Ze(i)];ao(n,r,t,i),lo(r,e,i);let o=r.join(" ");e.className!==o&&(e.className=o)}function Qe(n,e,t,i){so(n,e,t,i),ti(n,e,t,i),no(n,e,t,i)}function Me(n,e){return n&&v(n,e)?n[e]:void 0}function et(n,e){if(n==null||n===""||!e||typeof e!="object")return;let t=Me(e,String(n));return typeof t=="string"?{color:t}:t}var tt=class{constructor(e){this.e=e;this.to="";this.ro=[];this.la=0;this.xi=!0}no(e){this.gu()&&(this.xi=!0,e=void 0);let t=this.xi?this.da():void 0,i=t&&co(t,e),r=e?.columns&&new Set(e.columns),o=!1;for(let s of this.e.r.l()){if(s.minWidth!=null&&(!i||r&&!r.has(s.id)))continue;let a=this.yu(s);if(o=s.minWidth!==a||o,s.minWidth=a,uo(s)){let l=this.ua(s,t);o=l!==s.contentWidth||o,s.contentWidth=l}}return this.xi=!1,o&&(this.e.r.Xe=!1),o}gu(){let e=Array.from(document.fonts??[]).filter(s=>s.status==="loaded"),t=e.length!==this.ro.length||e.some((s,a)=>s!==this.ro[a]);t&&(this.ro=e,this.la++);let i=getComputedStyle(this.e.n.root),r=`${i.getPropertyValue("--mach-header-font-weight")||650} ${i.fontSize} ${i.fontFamily}`,o=r!==this.to||t;return this.to=r,o}da(){let e=this.e.i.Oe(),t=Math.min(e.length,100);return Array.from({length:t},(i,r)=>e[Math.floor(r*(e.length-1)/Math.max(t-1,1))])}oo(e,t){return this.Di===void 0&&(this.Di=p("canvas").getContext("2d")),this.Di?(this.Di.font=t??this.to,this.Di.measureText(e).width):t?1/0:e.replace(/[^\x00-\xff]/g,"mm").length*7}yu(e){let t=e.colDef,i=t.headerName??t.field??e.id;return Math.ceil(Math.max(t.minWidth??0,this.oo(i)+i.length*.15+28+(e.sortable?20:0)+(e.filterable?28:0)+(this.e.t.columnMenu&&!e.hasCheckbox&&!t.suppressColumnMenu?22:0)))}ua(e,t=this.da()){let i=28;for(let r of t){let o=this.e.d(r,e),s=et(o,e.colDef.status)?.label??q(this.e,r,e,o);i=Math.max(i,this.oo(s.slice(0,128))+(e.colDef.status?44:28))}return Math.ceil(Math.min(I(e.colDef.maxWidth)??360,i))}};function uo(n){let{width:e,autoWidth:t}=n.colDef;return n.manualWidth==null&&e==null&&t!==!1&&!n.hasCheckbox&&!n.isDetailToggle}function co(n,e){if(!e?.rowIds&&!e?.rowIndexes)return!0;let t=new Set(e.rowIds),i=new Set(e.rowIndexes);return n.some(r=>t.has(r.id)||i.has(r.rowIndex))}var it=class{constructor(e){this.vu=e;this.xr=new Map}on(e,t){let i=this.xr.get(e);return i||(i=new Set,this.xr.set(e,i)),i.add(t),()=>{i.delete(t)}}emit(e,t){let i=this.xr.get(e);if(i)for(let r of[...i])try{r(t)}catch(o){console.error(`[mach-table] error in "${e}" listener`,o),this.vu?.(o,e)}}clear(){this.xr.clear()}};var ho=new Set(["__proto__","prototype","constructor"]),Ie=new Map;function ii(n){if(typeof n!="string"||n.length===0)return null;let e=Ie.get(n);if(e!==void 0)return e;let t=n.split("."),i=t.every(r=>r.length>0&&!ho.has(r))?t:null;return n.length<=1024&&(Ie.size>=256&&Ie.delete(Ie.keys().next().value),Ie.set(n,i)),i}function ri(n){return ii(n)!==null}function K(n,e){if(n==null)return;let t=ii(e);if(!t)return;let i=n;for(let r of t){if(i==null)return;i=i[r]}return i}function Ae(n,e,t){if(n==null)return!1;let i=ii(e);if(!i)return!1;let r=n;for(let o=0;o<i.length-1;o++){if(typeof r!="object"&&typeof r!="function"||r===null)return!1;r[i[o]]==null&&(r[i[o]]={}),r=r[i[o]]}return typeof r!="object"&&typeof r!="function"||r===null?!1:(r[i[i.length-1]]=t,!0)}var ge={text:["contains","notContains","equals","notEquals","startsWith","endsWith","blank","notBlank"],number:["equals","notEquals","lessThan","lessThanOrEqual","greaterThan","greaterThanOrEqual","inRange","blank","notBlank"],date:["equals","notEquals","lessThan","greaterThan","inRange","blank","notBlank"]};var po=16,fo=512,mo=20,go=2e3,yo=2e3,vo={text:new Set(ge.text),number:new Set(ge.number),date:new Set(ge.date)};function bo(n){return n==null||typeof n=="string"||typeof n=="number"&&Number.isFinite(n)}function wo(n,e,t){if(n==null||typeof n!="object")return null;let i=n;return typeof i.match!="string"||!t.has(i.match)?null:{match:i.match,...Co(i,e)}}function Co(n,e){let t=e==="number"?x(n.value,-1/0):typeof n.value=="string"?n.value:void 0,i=e==="number"?x(n.value2,-1/0):typeof n.value2=="string"?n.value2:void 0;return{...t!==void 0?{value:t}:{},...i!==void 0?{value2:i}:{}}}function To(n,e){let t=[],i=vo[e];for(let r of n.slice(0,mo)){let o=wo(r,e,i);o&&t.push(o)}return t}function ni(n){if(n==null||typeof n!="object")return null;let e=n;return e.type==="set"?Array.isArray(e.values)?{type:"set",values:e.values.filter(bo).slice(0,go)}:null:e.type!=="text"&&e.type!=="number"&&e.type!=="date"||!Array.isArray(e.conditions)?null:{type:e.type,...e.operator==="or"||e.operator==="and"?{operator:e.operator}:{},conditions:To(e.conditions,e.type)}}function Do(n,e){if(typeof n.colId!="string"||!n.colId.trim())return null;let t=n.colId.trim();if(e.validColumnIds?.has(t)===!1)return null;let i=ni(n.filter);return i?{kind:"condition",colId:t,filter:i}:null}function xo(n,e,t){if(!Array.isArray(n.children))return null;let i=[];for(let r of n.children){let o=fr(r,e+1,t);o&&i.push(o)}return i.length===0?null:{kind:"group",operator:n.operator==="or"?"or":"and",children:i,...n.not===!0?{not:!0}:{}}}function Ro(n,e,t){return e<=po&&t.nodes<fo&&n!=null&&typeof n=="object"}function fr(n,e,t){if(!Ro(n,e,t)||t.ancestors.has(n))return null;t.ancestors.add(n),t.nodes++;let i=n,r=i.kind==="condition"?Do(i,t):i.kind==="group"?xo(i,e,t):null;return t.ancestors.delete(n),r}function B(n,e){if(n==null||typeof n!="object")return null;let t=n;if(t.version!==1||t.root==null)return null;let i=fr(t.root,0,{ancestors:new WeakSet,nodes:0,validColumnIds:e});return i?{version:1,root:i}:null}function Eo(n,e){return{kind:"condition",colId:n,filter:e}}function le(n,e){if(n==null||typeof n!="object"||Array.isArray(n))return{};let t={};for(let[i,r]of Object.entries(n).slice(0,yo)){let o=i.trim();if(!o||e?.has(o)===!1)continue;let s=ni(r);s&&(t[o]=s)}return t}function So(n,e,t={}){return{kind:"group",operator:n,children:e,...t.not?{not:!0}:{}}}var oi={align:"center",sortable:!0,resizable:!0,movable:!0,filter:!1,minWidth:80},ke={compact:{rowHeight:30,headerHeight:34,fontSize:12,cellPadding:6},normal:{rowHeight:36,headerHeight:40,fontSize:13,cellPadding:9},large:{rowHeight:44,headerHeight:48,fontSize:14,cellPadding:12}},Pe={multiSort:!0,stripedRows:!1,showCellBorders:!1,quickFilterText:null,suppressCellFocus:!1,suppressRowHoverHighlight:!1,suppressNoRowsOverlay:!1,suppressHeaderFocus:!1,loading:!1,error:null,className:"",singleClickEdit:!1,manualSorting:!1,manualFiltering:!1,showSummary:!1,rowNumber:!1,indexOffset:0,applyRowDrag:!0,masterDetail:!1,detailToggleColumn:!0,treeData:!1,childrenKey:"children",autoCheckedChildren:!0,defaultExpandAll:!1,columnMenu:!1,suppressWarnings:!1,enableRangeSelection:!1,suppressClipboard:!1,contextMenu:!1,flashCells:!0,fillHandle:!0,ariaLabel:"MachTable data grid",ariaLabelledBy:"",ariaDescribedBy:"",overlayNoRowsTemplate:"",overlayLoadingTemplate:"",overlayErrorTemplate:"",allowUnsafeOverlayHtml:!1},Mo=Object.keys(Pe);function Io(n){let e={};for(let t of Mo)e[t]=n[t]??Pe[t];return e}function Ao(n){return n&&v(ke,n)?n:"normal"}function ko(n,e){let t=typeof n.pagination=="object"&&Array.isArray(n.pagination?.pageSizeOptions)?n.pagination.pageSizeOptions:void 0,i=t?[...new Set(t.map(r=>E(r,0,1,!0)).filter(Boolean))]:[10,20,50,100];return i.includes(e)||i.push(e),i.sort((r,o)=>r-o)}function si(n,e){let t=typeof n=="function"?n(e):K(e,n);return t==null?"":String(t)}function Po(n,e){let t=ke[e],i=n.rowKey;return{columnDefs:Array.isArray(n.columnDefs)?n.columnDefs:[],rowData:Array.isArray(n.rowData)?n.rowData:[],defaultColDef:{...oi,...n.defaultColDef??{}},columnTypes:n.columnTypes??{},...i?{resolveRowId:({data:r})=>si(i,r),rowKey:i}:{},rowHeight:E(n.rowHeight,t.rowHeight,1),detailRowHeight:E(n.detailRowHeight,240,1),headerHeight:E(n.headerHeight,t.headerHeight,1),rowBuffer:E(n.rowBuffer,8,0,!0),columnLayout:n.columnLayout==="fit"||n.columnLayout==="normal"?n.columnLayout:"auto",enableColumnResize:n.enableColumnResize===!0,domLayout:n.domLayout==="autoHeight"?"autoHeight":"normal",maxBodyHeight:x(n.maxBodyHeight,1),rowSelection:n.rowSelection==="single"||n.rowSelection==="multiple"?n.rowSelection:"none",size:e,pinnedTopRowData:Array.isArray(n.pinnedTopRowData)?n.pinnedTopRowData:[],pinnedBottomRowData:Array.isArray(n.pinnedBottomRowData)?n.pinnedBottomRowData:[]}}function Go(n){let e=typeof n.pagination=="object"?n.pagination:void 0,t=E(e?.pageSize,20,1,!0);return{paginationEnabled:n.pagination!==!1&&n.datasource==null,paginationMode:e?.mode==="server"?"server":"client",paginationPage:E(e?.page,1,1,!0),paginationTotal:E(e?.total,0,0,!0),paginationPageSize:t,paginationPageSizeOptions:ko(n,t),paginationShowTotal:e?e.showTotal!==!1:!0,paginationShowSizeSelector:e?e.showPageSizeSelector!==!1:!0}}function ai(n){let e=n.watermark==null||n.watermark===!1?null:n.watermark===!0?{text:"MachTable"}:n.watermark;return{watermarkEnabled:e!==null,watermarkConfig:e}}function Lo(n){return{advancedFilterModel:B(n.advancedFilterModel),persistence:qe(n.persistence),locale:n.locale??{},tooltipShowDelay:E(n.tooltipShowDelay,600,0),statusBarEnabled:n.statusBar===!0||typeof n.statusBar=="object"&&n.statusBar!=null,statusBarPanels:typeof n.statusBar=="object"&&n.statusBar?.panels?n.statusBar.panels:["rowCount","selectedRowCount","rangeAggregate"]}}var gr={blockSize:100,maxBlocksInCache:12,datasourceMaxConcurrentRequests:4},yr={infiniteBufferRows:40,blockPrefetch:1,datasourceRetryCount:2,datasourceRetryDelay:300},No=Object.keys(gr),Fo=Object.keys(yr);function mr(n,e,t,i){let r=!1;for(let o of t){let s=x(n[o],i,!0);s===void 0||s===e[o]||(e[o]=s,r=!0)}return r}function li(n,e){let t=mr(n,e,No,1);mr(n,e,Fo,0);let i=x(n.datasourceRetryJitter,0);return i!==void 0&&(e.datasourceRetryJitter=Math.min(1,i)),t}function Oo(n){let e={...gr,...yr,datasourceRetryJitter:.15};return li(n,e),{...e,datasourceMode:n.datasourceMode==="block"?"block":"sequential",datasourceRowCount:n.datasourceRowCount==null?null:E(n.datasourceRowCount,0,0,!0),dataProcessorMinRows:E(n.dataProcessorMinRows,5e3,1,!0)}}var Ho=["detailRowRenderer","isRowExpandable","aggFuncs","components","actionPolicy","summaryMethod","datasource","getRowHeight","tooltipComponent","getContextMenuItems","initialState","rowEditValidator","isTreeRowExpandable","loadTreeChildren","dataProcessor"];function vr(n){let e=Ao(n.size),t={...Io(n),...Po(n,e),rowStyleRules:Array.isArray(n.rowStyleRules)?n.rowStyleRules:[],theme:n.theme==="dark"||n.theme==="auto"?n.theme:"light",editType:n.editType==="fullRow"?"fullRow":"cell",editableIndicator:n.editableIndicator==="always"||n.editableIndicator==="none"?n.editableIndicator:"hover",rowDragPolicy:n.rowDragPolicy,undoStackSize:E(n.undoStackSize,100,0,!0),asyncTransactionWaitMillis:E(n.asyncTransactionWaitMillis,16,0,!0),...Go(n),...ai(n),...Lo(n),...Oo(n),features:Array.isArray(n.features)?n.features:[]};for(let i of Ho)n[i]&&Reflect.set(t,i,n[i]);for(let i of Object.keys(n))i.startsWith("on")&&typeof n[i]=="function"&&Reflect.set(t,i,n[i]);return t}function br(n){return Array.isArray(n)?n.filter(e=>typeof e=="string"&&e.length>0):typeof n=="string"&&n.length>0?[n]:[]}function ye(n,e){return br(n.type).includes(e)}function wr(n,e,t={}){let i=n.checkboxSelection||n.rowDrag||ye(n,"index")?{resizable:!1,suppressSizeToFit:!0}:{};for(let o of br(n.type)){o==="rightAligned"&&(i.align="right");let s=t[o];s&&Object.assign(i,s)}let r={...e,...i,...n};return r.align??(r.align=e.align??"center"),r.status&&!r.cellRenderer&&(r.cellRenderer="statusTag"),r}var te=class{constructor(e,t){this.manualWidth=null;this.contentWidth=null;this.flex=null;this.currentWidth=0;this.parentGroup=null;this.level=0;this.isDetailToggle=!1;this.id=e,this.colDef=t,this.hide=t.hide??!1;let i=t.pinned;this.pinned=i===!0?"left":i===!1||i==null?null:i,this.resetWidth()}get sortable(){return this.colDef.sortable!==!1}get resizable(){return this.colDef.resizable!==!1}get movable(){return this.colDef.movable!==!1}get filterable(){return this.colDef.filter!=null&&this.colDef.filter!==!1}get filterType(){let e=this.colDef.filter;return e===!0?"text":e??"text"}get hasCheckbox(){return this.colDef.checkboxSelection===!0}resetWidth(){this.manualWidth=null,this.contentWidth=null,this.flex=I(this.colDef.flex)??null}};function Y(n){return!n.hasCheckbox&&!n.isDetailToggle&&!n.isAutoRowNumber}function rt(n){return n.colDef.autoHeight===!0&&!!(n.colDef.valueGetter||n.colDef.valueFormatter)}var ie=class n{constructor(e,t){this.parent=null;this.children=[];this.groupId=e,this.def=t}get headerName(){return this.def.headerName??this.def.groupId??""}getLeafColumns(e=[]){for(let t of this.children)t instanceof n?t.getLeafColumns(e):e.push(t);return e}};function Ge(n){return Array.isArray(n.children)}var Le=150,Vo=80;function U(n,e){let t=I(e.minWidth)??Vo,i=I(e.maxWidth)??Number.MAX_SAFE_INTEGER,r=I(n)??I(e.width)??Le;return Math.max(t,Math.min(i,r))}function Bo(n,e,t,i){let r=e.map((o,s)=>s).filter(o=>i[o]>0);for(;Math.abs(t)>.001&&r.length;){let o=r.reduce((a,l)=>a+i[l],0),s=0;if(r=r.filter(a=>{let l=e[a];return e[a]=U(l+t*i[a]/o,n[a]),s+=e[a]-l,e[a]!==l}),Math.abs(s)<1e-4)break;t-=s}}function Cr(n,e,t){let i=n.map(o=>U(o.width??Le,o)),r=e-i.reduce((o,s)=>o+s,0);return(t?Number.isFinite(e)&&e>0:r>0)&&Bo(n,i,r,t?[...i]:n.map(o=>o.flex??0)),i}function Tr(n,e){return Cr(n,e,!1)}function nt(n,e){return Cr(n,e,!0)}var di='<path d="M11.5 2.5l2 2L5 13H3v-2l8.5-8.5z"/>',ui='<path d="M3.5 3.5l9 9m0-9l-9 9"/>',ci='<path d="M2.5 8.5l3.5 3.5 7.5-8"/>',de={edit:di,delete:'<path d="M3 5h10M6 5V3h4v2M5 5l.7 8h4.6L11 5"/>',view:'<path d="M1.5 8s2.4-4.2 6.5-4.2S14.5 8 14.5 8s-2.4 4.2-6.5 4.2S1.5 8 1.5 8z"/><circle cx="8" cy="8" r="1.8"/>',copy:'<rect x="5" y="5" width="8" height="8" rx="1"/><path d="M3 11V3h8"/>',download:'<path d="M8 2v8m0 0l-3-3m3 3l3-3M2.5 13.5h11"/>',refresh:'<path d="M13 3v4h-4M3 13V9h4"/><path d="M13 7a5.5 5.5 0 00-9.7-2.6M3 9a5.5 5.5 0 009.7 2.6"/>',close:ui,check:ci,plus:'<path d="M8 2.5v11M2.5 8h11"/>',search:'<circle cx="7" cy="7" r="4.5"/><path d="M10.5 10.5L14 14"/>',more:'<circle cx="3" cy="8" r=".9" fill="currentColor" stroke="none"/><circle cx="8" cy="8" r=".9" fill="currentColor" stroke="none"/><circle cx="13" cy="8" r=".9" fill="currentColor" stroke="none"/>'};function X(n,e=14){return`<svg viewBox="0 0 16 16" width="${e}" height="${e}" aria-hidden="true" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round">${n}</svg>`}var _={matchContains:"\u5305\u542B",matchNotContains:"\u4E0D\u5305\u542B",matchEquals:"\u7B49\u4E8E",matchNotEquals:"\u4E0D\u7B49\u4E8E",matchStartsWith:"\u5F00\u5934\u662F",matchEndsWith:"\u7ED3\u5C3E\u662F",matchBlank:"\u4E3A\u7A7A",matchNotBlank:"\u4E0D\u4E3A\u7A7A",matchLessThan:"\u5C0F\u4E8E",matchLessThanOrEqual:"\u5C0F\u4E8E\u7B49\u4E8E",matchGreaterThan:"\u5927\u4E8E",matchGreaterThanOrEqual:"\u5927\u4E8E\u7B49\u4E8E",matchInRange:"\u5728\u8303\u56F4\u5185",apply:"\u5E94\u7528",reset:"\u91CD\u7F6E",search:"\u641C\u7D22...",emptySetLabel:"(\u7A7A)",selectedCount:"\u5DF2\u9009 {n} \u9879",sortAsc:"\u5347\u5E8F",sortDesc:"\u964D\u5E8F",clearSort:"\u53D6\u6D88\u6392\u5E8F",pinLeft:"\u56FA\u5B9A\u5DE6\u4FA7",pinRight:"\u56FA\u5B9A\u53F3\u4FA7",clearPin:"\u53D6\u6D88\u56FA\u5B9A",autoSize:"\u81EA\u9002\u5E94\u5217\u5BBD",hideColumn:"\u9690\u85CF\u6B64\u5217",columnVisibility:"\u5217\u663E\u793A",resetAll:"\u91CD\u7F6E\u5168\u90E8",autoSizeAll:"\u5168\u90E8\u81EA\u9002\u5E94",columnSettings:"\u5217\u8BBE\u7F6E",totalLabel:"\u5408\u8BA1",totalRowsLabel:"\u5171 {n} \u884C",menuCopy:"\u590D\u5236",menuPaste:"\u7C98\u8D34",menuClearContents:"\u6E05\u9664\u5185\u5BB9",loading:"\u52A0\u8F7D\u4E2D...",statusSelected:"\u5DF2\u9009 {n} \u884C",statusSum:"\u548C {n}",statusAvg:"\u5747 {n}",statusCount:"\u8BA1 {n}",emptyRows:"\u6CA1\u6709\u53EF\u663E\u793A\u7684\u884C",emptyRowsHint:"\u6682\u65E0\u6570\u636E",noMatchingRows:"\u6CA1\u6709\u7B26\u5408\u7B5B\u9009\u6761\u4EF6\u7684\u884C",clearFilters:"\u6E05\u9664\u7B5B\u9009",paginationTotal:"\u5171 {n} \u6761",paginationPage:"\u7B2C {a} / {b} \u9875",perPage:"{n} \u6761/\u9875",pageFirst:"\u9996\u9875",pagePrev:"\u4E0A\u4E00\u9875",pageNext:"\u4E0B\u4E00\u9875",pageLast:"\u672B\u9875",requestFailed:"\u6570\u636E\u52A0\u8F7D\u5931\u8D25",requestFailedHint:"\u8BF7\u68C0\u67E5\u7F51\u7EDC\u540E\u91CD\u8BD5",actionView:"\u67E5\u770B",actionEdit:"\u7F16\u8F91",actionDelete:"\u5220\u9664",actionConfirm:"\u786E\u8BA4",actionSave:"\u4FDD\u5B58",actionCancel:"\u53D6\u6D88",actionMore:"\u66F4\u591A\u64CD\u4F5C",rowDragHandle:"\u62D6\u52A8\u8C03\u6574\u987A\u5E8F\uFF1BAlt + \u4E0A\u4E0B\u65B9\u5411\u952E\u79FB\u52A8",rowDragUnavailable:"\u5F53\u524D\u6392\u5E8F\u6216\u6570\u636E\u6A21\u5F0F\u4E0D\u652F\u6301\u81EA\u52A8\u8C03\u6574\u987A\u5E8F",rowDragPosition:"\u7B2C {a} \u884C \u2192 \u7B2C {b} \u884C",rowDragOutside:"\u79FB\u56DE\u8868\u683C\u5185\u653E\u7F6E \xB7 Esc \u53D6\u6D88"},_o={matchContains:"Contains",matchNotContains:"Not Contains",matchEquals:"Equals",matchNotEquals:"Not Equals",matchStartsWith:"Starts With",matchEndsWith:"Ends With",matchBlank:"Blank",matchNotBlank:"Not Blank",matchLessThan:"Less Than",matchLessThanOrEqual:"\u2264",matchGreaterThan:"Greater Than",matchGreaterThanOrEqual:"\u2265",matchInRange:"In Range",apply:"Apply",reset:"Reset",search:"Search...",emptySetLabel:"(blank)",selectedCount:"{n} selected",sortAsc:"Ascending",sortDesc:"Descending",clearSort:"Clear Sort",pinLeft:"Pin Left",pinRight:"Pin Right",clearPin:"Unpin",autoSize:"Auto Fit",hideColumn:"Hide Column",columnVisibility:"Columns",resetAll:"Reset All",autoSizeAll:"Fit All",columnSettings:"Column Settings",totalLabel:"Total",totalRowsLabel:"{n} rows",menuCopy:"Copy",menuPaste:"Paste",menuClearContents:"Clear Contents",loading:"Loading...",statusSelected:"{n} selected",statusSum:"Sum {n}",statusAvg:"Avg {n}",statusCount:"Cnt {n}",emptyRows:"No rows to display",emptyRowsHint:"No data is available.",noMatchingRows:"No rows match the filters",clearFilters:"Clear filters",paginationTotal:"{n} items",paginationPage:"Page {a} / {b}",perPage:"{n} / page",pageFirst:"First",pagePrev:"Previous",pageNext:"Next",pageLast:"Last",requestFailed:"Unable to load data",requestFailedHint:"Check your connection and try again",actionView:"View",actionEdit:"Edit",actionDelete:"Delete",actionConfirm:"Confirm",actionSave:"Save",actionCancel:"Cancel",actionMore:"More actions",rowDragHandle:"Drag to reorder; Alt + Up/Down to move",rowDragUnavailable:"Reordering is unavailable in the current sort or data mode",rowDragPosition:"Row {a} \u2192 Row {b}",rowDragOutside:"Move inside to drop \xB7 Esc to cancel",rowDragSelection:"{a} selected rows \u2192 Row {b}",rowDragBefore:"Before",rowDragAfter:"After",rowDragInside:"Inside",rowDragRejected:"This destination is unavailable"},zo={contains:"matchContains",notContains:"matchNotContains",equals:"matchEquals",notEquals:"matchNotEquals",startsWith:"matchStartsWith",endsWith:"matchEndsWith",blank:"matchBlank",notBlank:"matchNotBlank",lessThan:"matchLessThan",lessThanOrEqual:"matchLessThanOrEqual",greaterThan:"matchGreaterThan",greaterThanOrEqual:"matchGreaterThanOrEqual",inRange:"matchInRange"};function hi(n){return zo[n]??"matchEquals"}function j(n,e){return n.replace("{n}",String(e))}function Ne(n,e,t){return n.replace("{a}",String(e)).replace("{b}",String(t))}var Wo=[[/^(success|ok|done|complete|completed|normal|active|enabled|启用|正常|完成|已完成|运行|运行中|在线|生效|已发运)$/i,"success"],[/^(warning|warn|hold|pending|standby|待机|待审核|暂停|预警|部分完成|待下达|待复核|待发运)$/i,"warning"],[/^(error|fail|failed|danger|fault|offline|disabled|故障|失败|错误|异常|停用|离线|断开)$/i,"danger"],[/^(info|processing|new|draft|进行中|新建|草稿|审批中|同步中|执行中|已下达|装车中)$/i,"info"],[/^(neutral|default)$/i,"neutral"]];function fi(n,e,t){let i=String(n??"");if(e){let r=Me(e,i);if(r)return r;let o=Me(e,i.toLowerCase());if(o)return o}for(let[r,o]of Wo)if(r.test(i))return o;return t==null?"neutral":fi(t)}function Dr(n={}){return e=>{if(e.value==null||e.value==="")return"";let t=String(e.value),i=et(t,e.colDef.status),r=i?.label??Me(n.labelMap,t)??(e.formatted||t),o=i?.color,s=fi(o??t,o?void 0:n.variantMap,r),a=p("span",`mach-tag mach-tag--${s}`);return a.textContent=r,o&&s!==o&&(a.style.color=o,a.style.backgroundColor=`color-mix(in srgb, ${o} 12%, transparent)`),a}}function xr(n={}){return e=>{let t=Number(e.value);if(isNaN(t))return e.formatted;let i=Math.max(0,Math.min(100,t)),r=p("div","mach-progress"),o=p("div","mach-progress__track"),s=p("div","mach-progress__bar");if(s.style.width=`${i}%`,n.color&&(s.style.background=n.color),o.appendChild(s),r.appendChild(o),n.showValue!==!1){let a=p("span","mach-progress__label");a.textContent=`${Math.round(i)}${n.unit??"%"}`,r.appendChild(a)}return r}}function Rr(n){if(n.value==null||n.value==="")return"";let e=p("span","mach-link");return e.textContent=n.formatted||String(n.value),e}var ne=null,H=null;function Er(n){H&&n.contains(H)&&J()}function J(n=!1){ne?.remove(),ne=null,H&&(H.setAttribute("aria-expanded","false"),n&&H.isConnected&&H.focus({preventScroll:!0})),H=null,document.removeEventListener("mousedown",Sr,!0),document.removeEventListener("keydown",mi,!0)}function Sr(n){ne&&!ne.contains(n.target)&&!H?.contains(n.target)&&J()}function mi(n){if(!ne)return;if(n.key==="Escape"){n.preventDefault(),J(!0);return}let e=[...ne.querySelectorAll("button:not(:disabled)")];if(e.length===0)return;if(n.key==="Tab"){let r=e.indexOf(document.activeElement);(!n.shiftKey&&r===e.length-1||n.shiftKey&&r<=0)&&(n.preventDefault(),e[n.shiftKey?e.length-1:0].focus());return}if(n.key!=="ArrowDown"&&n.key!=="ArrowUp")return;n.preventDefault();let t=e.indexOf(document.activeElement),i=n.key==="ArrowDown"?1:-1;e[(t+i+e.length)%e.length].focus()}function Mr(n,e){let t=p("button",e);return t.type="button",n.variant&&n.variant!=="default"&&t.classList.add(`${e}--${n.variant}`),t.disabled=n.disabled===!0,n.icon&&de[n.icon]?(t.innerHTML=X(de[n.icon],16),t.appendChild(p("span")).textContent=n.label):t.textContent=n.label,t.addEventListener("click",()=>n.pick(t)),t}function $o(n,e){J();let t=p("div","mach-context-menu mach-action-menu");t.setAttribute("role","menu");for(let i of e){let r=Mr(i,"mach-context-menu-item");r.setAttribute("role","menuitem"),t.appendChild(r)}A(t,n.closest(".mach-root")),document.body.appendChild(t),ee(t,n),ne=t,H=n,n.setAttribute("aria-expanded","true"),document.addEventListener("mousedown",Sr,!0),document.addEventListener("keydown",mi,!0),t.querySelector("button:not(:disabled)")?.focus({preventScroll:!0})}function Ko(n,e,t){J();let i=p("div","mach-action-drawer-backdrop"),r=p("section","mach-action-drawer");r.setAttribute("role","dialog"),r.setAttribute("aria-modal","true"),r.setAttribute("aria-label",e);let o=p("header","mach-action-drawer__header"),s=p("strong");s.textContent=e;let a=p("button","mach-action-drawer__close");a.type="button",a.setAttribute("aria-label","Close"),a.title="Close",a.innerHTML=X(de.close,16),a.addEventListener("click",()=>J(!0)),o.append(s,a);let l=p("div","mach-action-drawer__body");for(let d of t)l.appendChild(Mr(d,"mach-action-drawer__item"));r.append(o,l),i.appendChild(r),i.addEventListener("mousedown",d=>{d.target===i&&J(!0)}),A(i,n.closest(".mach-root")),document.body.appendChild(i),ne=i,H=n,n.setAttribute("aria-expanded","true"),document.addEventListener("keydown",mi,!0),r.querySelector("button:not(:disabled)")?.focus({preventScroll:!0})}function re(n,e){if(typeof n=="function")try{return n(e)}catch{return!1}return n===!0}function Ir(n){return n.variant??"default"}function Ar(n){return n.permission?typeof n.permission=="string"?[n.permission]:n.permission:[]}function gi(n,e,t){return{...n.id?{actionId:n.id}:{},permissions:Ar(n),...t?{message:t}:{},params:e}}function ot(n,e,t){let i=t.api.getOption("actionPolicy");try{i?.onError?i.onError(n,gi(e,t)):console.error("[mach-table] action handler failed",n)}catch(r){console.error("[mach-table] action error policy failed",r,n)}}function Uo(n,e){if(Ar(n).length===0)return!0;let i=e.api.getOption("actionPolicy");if(!i?.canAccess)return!0;try{return i.canAccess(gi(n,e))}catch(r){return ot(r,n,e),!1}}function jo(n,e){return n.filter(t=>{if(!Uo(t,e))return!1;if(!t.show)return!0;try{return t.show(e)}catch{return!1}})}function yi(n,e,t){t.isConnected&&(t.disabled=re(n.disabled,e)||re(n.loading,e),t.classList.toggle("mach-action-btn--loading",re(n.loading,e)))}function qo(n,e,t,i){Promise.resolve(n).catch(r=>ot(r,e,t)).finally(()=>yi(e,t,i))}function Yo(n,e,t){try{qo(n.onClick(e),n,e,t)}catch(i){ot(i,n,e),yi(n,e,t)}}function pi(n,e,t){if(n===!1)return!1;let i=typeof n=="string"?n:e.label??e.title??"Confirm action",r=t.api.getOption("actionPolicy");return r?.confirm?r.confirm(gi(e,t,i)):typeof window>"u"||typeof window.confirm!="function"?!1:window.confirm(i)}function Xo(n,e){if(n.confirm==null||n.confirm===!1)return!0;if(typeof n.confirm!="function")return pi(n.confirm,n,e);let t=n.confirm(e);return t instanceof Promise?t.then(i=>pi(i,n,e)):pi(t,n,e)}function Jo(n){return(e,t)=>{if(re(e.disabled,n))return;if(t.disabled=!0,t.classList.add("mach-action-btn--loading"),e.confirm==null||e.confirm===!1){Yo(e,n,t);return}(async()=>{await Xo(e,n)&&await e.onClick(n)})().catch(r=>ot(r,e,n)).finally(()=>{yi(e,n,t)})}}function Zo(n,e,t){let i=p("button","mach-action-btn");i.type="button";let r=Ir(n);r!=="default"&&i.classList.add(`mach-action-btn--${r}`);let o=n.title??n.label??"Action";return i.title=o,i.setAttribute("aria-label",o),i.disabled=re(n.disabled,e),re(n.loading,e)&&(i.disabled=!0,i.classList.add("mach-action-btn--loading")),n.icon&&de[n.icon]?(i.innerHTML=X(de[n.icon]),i.classList.add("mach-action-btn--icon")):i.textContent=n.label??o,i.addEventListener("mousedown",s=>s.stopPropagation()),i.addEventListener("click",s=>{s.stopPropagation(),t(n,i)}),i}function Qo(n,e,t,i,r){let o=p("button","mach-action-btn mach-action-btn--icon");o.type="button";let s=i.api.getOption("locale")??{},a=t.moreLabel??s.actionMore??_.actionMore;return o.title=a,o.setAttribute("aria-label",a),o.setAttribute("aria-haspopup",e==="drawer"?"dialog":"menu"),o.setAttribute("aria-expanded","false"),o.innerHTML=`${X(de.more,16)}<span class="mach-sr-only">\u22EF</span>`,o.addEventListener("mousedown",l=>l.stopPropagation()),o.addEventListener("click",l=>{l.stopPropagation();let d=n.map(u=>({label:u.label??u.title??"Action",icon:u.icon,variant:Ir(u),disabled:re(u.disabled,i)||re(u.loading,i),pick:c=>{J(),r(u,c)}}));e==="drawer"?Ko(o,t.drawerTitle??a,d):$o(o,d)}),o}function Fe(n){let e=Math.max(0,n.max??3),t=n.overflow??"menu";return i=>{let r=jo(n.actions,i);if(r.length===0)return"";let o=p("div","mach-actions"),s=t==="inline"?r:r.slice(0,e),a=t==="inline"?[]:r.slice(e),l=Jo(i);for(let d of s)o.appendChild(Zo(d,i,l));return a.length>0&&o.appendChild(Qo(a,t,n,i,l)),{el:o,destroy:()=>{H&&o.contains(H)&&J()}}}}function ve(n,e,t){return n??e??t}function es(n,e){let t=e.api.getOption("locale")??{};return{view:ve(n.labels?.view,t.actionView,_.actionView),edit:ve(n.labels?.edit,t.actionEdit,_.actionEdit),delete:ve(n.labels?.delete,t.actionDelete,_.actionDelete),confirm:ve(n.labels?.confirm,t.actionConfirm,_.actionConfirm),save:ve(n.labels?.save,t.actionSave,_.actionSave),cancel:ve(n.labels?.cancel,t.actionCancel,_.actionCancel)}}function ts(n,e,t){let i=async()=>{if(!await e.api.editing.stop()||!n.onSave)return;let s=e.api.editing.getChanges().filter(a=>a.rowId===e.node.id);try{await n.onSave(e,s),e.api.editing.markSaved([e.node.id])}catch(a){throw e.api.editing.startRow(e.rowIndex),a}},r=n.onSave?t.save:n.labels?.confirm??n.labels?.save??t.confirm;return Fe({actions:[{icon:"check",title:r,variant:"success",onClick:i},{icon:"close",title:t.cancel,variant:"danger",onClick:()=>e.api.editing.stop({cancel:!0}).then(()=>{})}],overflow:"inline"})(e)}function is(n,e,t){let i=[];return n.onView&&i.push({id:"view",icon:"view",title:t.view,variant:"primary",...n.permissions?.view?{permission:n.permissions.view}:{},onClick:n.onView}),n.edit!==!1&&i.push({id:"edit",icon:"edit",title:t.edit,variant:"warning",...n.permissions?.edit?{permission:n.permissions.edit}:{},onClick:n.onEdit??(()=>{e.api.editing.startRow(e.rowIndex)})}),n.onDelete&&i.push({id:"delete",icon:"delete",title:t.delete,variant:"danger",...n.permissions?.delete?{permission:n.permissions.delete}:{},...n.confirmDelete?{confirm:n.confirmDelete===!0?t.delete:n.confirmDelete}:{},onClick:n.onDelete}),i.push(...n.extraActions??[]),i}function vi(n={}){return e=>{let t=es(n,e);if(e.api.editing.isRowActive(e.rowIndex))return ts(n,e,t);let i=is(n,e,t);return Fe({actions:i,max:n.max,overflow:n.overflow??"menu",moreLabel:n.moreLabel,drawerTitle:n.drawerTitle})(e)}}var rs=Dr(),ns=xr(),kr=Object.freeze({statusTag:rs,progressBar:ns,link:Rr});var Oe={sortable:!1,resizable:!1,movable:!1,filter:!1,suppressSizeToFit:!0,suppressColumnMenu:!0};function os(n={}){let e=n.width??40;return{colId:"sel",headerName:"",width:e,minWidth:n.minWidth??e,maxWidth:n.maxWidth??e,pinned:"left",checkboxSelection:!0,...Oe,...n}}function bi(n={}){let e=n.width??52;return{colId:"idx",headerName:"#",type:"index",width:e,minWidth:n.minWidth??e,maxWidth:n.maxWidth??e,pinned:"left",align:"center",headerAlign:"center",...Oe,...n}}function ss(n={}){let e=n.width??40;return{colId:"drag",headerName:"",rowDrag:!0,width:e,minWidth:n.minWidth??e,maxWidth:n.maxWidth??e,pinned:"left",...Oe,...n}}function as(n={actions:[]}){let{width:e,pinned:t,...i}=n,r=i.actions?.length??0,o=i.overflow==="inline"?r:Math.min(r,i.max??3),s=i.overflow!=="inline"&&r>o,a=Math.max(1,o)*26+(s?26:0)+10;return{colId:"op",headerName:"\u64CD\u4F5C",width:e??Math.max(64,a),pinned:t??"right",cellRenderer:Fe(i),...Oe,cellRendererParams:void 0}}function ls(n={}){let{width:e,pinned:t,...i}=n,r=(i.onView?1:0)+(i.edit===!1?0:1)+(i.onDelete?1:0)+(i.extraActions?.length??0),o=i.overflow==="inline"?r:Math.min(r,i.max??3),s=i.overflow!=="inline"&&r>o,a=Math.max(2,o)*26+(s?26:0)+10;return{colId:"op",headerName:"\u64CD\u4F5C",width:e??Math.max(72,a),pinned:t??"right",cellRenderer:vi(i),...Oe,cellRendererParams:void 0}}var wi="__rg_detail_toggle__";function He(n){return I(n)!==void 0}function Gr(n){return n===!0?"left":n||null}function Pr(n,e){let t=e;for(let i=2;n.has(t);i++)t=`${e}_${i}`;return n.add(t),t}function ds(n,e){let t=e.colDef,i=n.colDef;n.manualWidth=e.manualWidth,(t.width===i.width&&t.autoWidth===i.autoWidth||t.width!=null||t.autoWidth===!1)&&(n.contentWidth=e.contentWidth),(e.manualWidth!=null||e.flex!==(I(t.flex)??null))&&(n.flex=e.flex),e.hide!==(t.hide??!1)&&(n.hide=e.hide),e.pinned!==Gr(t.pinned)&&(n.pinned=e.pinned)}var st=class{constructor(e){this.e=e;this.X=[];this.Rr=new Map;this.fe=[];this.so=[];this.Er=[];this.ao=[];this.me=[];this.Sr=[];this.Dt=new Map;this.Yt=1;this.lo=new Map;this.ca=0;this.Xe=!1}Ri(e){this.Sr=e?[...e]:[];let t=new Map(this.X.map(u=>[u.id,u])),i=this.e.t.defaultColDef,r=this.e.t.masterDetail&&this.e.t.detailToggleColumn,o=new Set(r?[wi]:[]),s=this.e.t.rowNumber,a=(u,c,h)=>u.map((f,m)=>{if(Ge(f)){let z=f.groupId??f.headerName??`group_${m}_${h}`,W=new ie(z,f);return W.parent=c,W.children=a(f.children,W,h+1),W}let g=f,b=Pr(o,g.colId??g.field??`col_${m}`),w=new te(b,wr(g,i,this.e.t.columnTypes));s&&(s=!ye(w.colDef,"index")),w.parentGroup=c,w.level=h;let G=t.get(b);return G&&!G.isAutoRowNumber&&ds(w,G),w});if(this.fe=a(this.Sr,null,0),s&&o.size>Number(r)&&this.bu(Pr(o,"idx"),t),r){let u=new te(wi,{colId:wi,headerName:"",width:38,pinned:"left",sortable:!1,resizable:!1,movable:!1,filter:!1});u.isDetailToggle=!0,this.fe.unshift(u)}this.Dt.size&&this.wu(),this.X=this.Mr(this.fe),this.Rr=new Map(this.X.map(u=>[u.id,u])),this.Yt=this.X.reduce((u,c)=>Math.max(u,c.level+1),1);let l=this.me.length;this.me=this.me.filter(u=>this.Rr.has(u.colId));let d=this.me.length!==l;if(this.me.length===0){let u=[];for(let c of this.X)c.colDef.initialSort&&!t.has(c.id)&&u.push({colId:c.id,direction:c.colDef.initialSort});this.me=u}return this.Xt(),d}bu(e,t){let i=new te(e,bi({colId:e,headerName:"\u5E8F\u53F7"}));i.isAutoRowNumber=!0;let r=t.get(e);r?.isAutoRowNumber&&(i.hide=r.hide);let o=this.fe.findIndex(s=>!(s instanceof te&&(s.hasCheckbox||s.colDef.rowDrag)));this.fe.splice(o===-1?this.fe.length:o,0,i)}Mr(e,t=[]){for(let i of e)i instanceof ie?this.Mr(i.children,t):t.push(i);return t}Xt(){this.Xe=!1;let e=this.X.filter(t=>!t.hide);this.so=e.filter(t=>t.pinned==="left"),this.ao=e.filter(t=>t.pinned==="right"),this.Er=e.filter(t=>t.pinned===null),this.lo.clear(),this.l().forEach((t,i)=>this.lo.set(t.id,i))}J(e){return this.lo.get(e)??-1}Z(){return this.X}uo(){return this.Sr}Cu(){return this.fe}Tu(){return this.Yt}x(e){return this.Rr.get(e)}R(e){return e==="left"?this.so:e==="right"?this.ao:this.Er}l(){return[...this.so,...this.Er,...this.ao]}Je(){return this.l().filter(e=>e.colDef.rowGroup===!0)}Du(){return this.l().filter(e=>e.colDef.aggFunc!=null&&e.colDef.rowGroup!==!0)}ha(){let e=this.l();return this.Er.find(Y)??e.find(Y)??e[0]}ge(e){return e.pinned==="left"?"left":e.pinned==="right"?"right":"center"}pa(e){let t=this.e.n.ye.clientWidth,i=this.Xe&&t===this.ca;this.ca=t;let r=e,o=[],s=[];for(let l of this.l()){let d=this.Ir(l);i||l.pinned!=null||l.colDef.suppressSizeToFit||l.manualWidth!=null?(l.currentWidth=U(i?l.manualWidth??l.currentWidth:d.width??Le,d),r-=l.currentWidth):(o.push(l),s.push(d))}this.e.t.columnLayout==="auto"&&!s.some(l=>l.flex)&&o.forEach((l,d)=>{if(l.colDef.autoWidth!==!1&&(l.colDef.width==null||l.contentWidth!=null)){let u=s[d];u.flex=U(u.width??Le,u)}});let a=this.e.t.columnLayout==="fit"?nt(s,Math.max(0,r)):Tr(s,Math.max(0,r));o.forEach((l,d)=>{l.currentWidth=a[d]})}Ir(e){let t=e.colDef;return{width:e.manualWidth??e.contentWidth??t.width??void 0,minWidth:e.minWidth??t.minWidth,maxWidth:t.maxWidth,flex:e.manualWidth==null?e.flex??void 0:void 0}}Ee(e,t){return He(t)?(this.Xe=!0,e.manualWidth=U(t,this.Ir(e)),e.flex=null,!0):!1}fa(e,t){return He(t)?(this.Xe=!1,e.resetWidth(),e.contentWidth=U(t,this.Ir(e)),!0):!1}co(e,t){let i=this.x(e);!i||i.hide===!t||(i.hide=!t,this.Xt())}Ei(e,t){let i=this.x(e);if(!i)return!1;let r=this.ge(i),o=c=>i.parentGroup?!0:this.ge(c)===r,s=i.parentGroup?i.parentGroup.children:this.fe,a=[],l=[];s.forEach((c,h)=>{c instanceof te&&!c.hide&&o(c)&&(a.push(c),l.push(h))});let d=a.indexOf(i);if(d<0)return!1;a.splice(d,1);let u=Math.max(0,Math.min(t,a.length));return a.splice(u,0,i),l.forEach((c,h)=>{s[c]=a[h]}),d!==u&&this.Dt.set(this.ma(i),a.filter(c=>c.movable).map(c=>c.id)),this.X=this.Mr(this.fe),this.Xt(),!0}ho(e,t){let i=this.x(e);!i||!i.movable||(i.pinned=t,this.Xt())}ga(e=!0){return(e?this.X:this.X.filter(i=>!i.isAutoRowNumber)).map(i=>({colId:i.id,hide:i.hide,width:i.manualWidth??i.currentWidth,flex:i.flex,widthMode:i.manualWidth==null?"auto":"manual",contentWidth:i.contentWidth??void 0,pinned:i.pinned}))}ya(e){let t=new Map(e.map(i=>[i.colId,i]));for(let i of this.X){let r=t.get(i.id);r&&this.xu(i,r)}this.Ru(e),this.Xt()}xu(e,t){typeof t.hide=="boolean"&&(e.hide=t.hide),t.widthMode==="auto"?(e.resetWidth(),He(t.flex)&&(e.flex=t.flex)):He(t.flex)?(e.flex=t.flex,e.manualWidth=null):this.Ee(e,t.width),He(t.contentWidth)&&(e.contentWidth=U(t.contentWidth,this.Ir(e))),e.movable&&(t.pinned==="left"||t.pinned==="right"||t.pinned===null)&&(e.pinned=t.pinned)}Ru(e){let t=new Map(e.map((i,r)=>[i.colId,r]));this.po(i=>!i.hide&&i.movable&&t.has(i.id),(i,r)=>{let o=[...i];i.sort((s,a)=>t.get(s.id)-t.get(a.id)),i.some((s,a)=>s!==o[a])&&this.Dt.set(r,i.map(s=>s.id))}),this.X=this.Mr(this.fe)}ma(e){if(!e.parentGroup)return this.ge(e);let t=[];for(let i=e.parentGroup;i;i=i.parent)t.push(i.groupId);return JSON.stringify(t)}wu(){let e=new Map;this.po(t=>t.movable,(t,i)=>{let r=this.Dt.get(i);if(!r)return;let o=new Map(t.map(d=>[d.id,d])),s=r.filter(d=>o.has(d));if(s.length<2)return;let a=new Set(s),l=0;t.forEach((d,u)=>{a.has(d.id)&&(t[u]=o.get(s[l++]))}),e.set(i,s)}),this.Dt=e}po(e,t,i=this.fe){let r=new Map;i.forEach((o,s)=>{if(o instanceof ie)this.po(e,t,o.children);else if(e(o)){let a=o.parentGroup?"center":this.ge(o),l=r.get(a)??[];l.push(s),r.set(a,l)}});for(let o of r.values()){if(o.length<2)continue;let s=o.map(a=>i[a]);t(s,this.ma(s[0])),o.forEach((a,l)=>{i[a]=s[l]})}}fo(){for(let e of this.X)e.resetWidth(),e.hide=e.colDef.hide??!1,e.pinned=Gr(e.colDef.pinned);if(this.Dt.size){this.Dt.clear(),this.Ri(this.Sr);return}this.Xt()}Q(){return this.me.map(e=>({...e}))}Si(e){if(!e||e.length===0){this.me=[];return}this.me=e.filter(t=>this.Rr.has(t.colId)&&(t.direction==="asc"||t.direction==="desc")).map(t=>({colId:t.colId,direction:t.direction}))}Ar(e,t){let i=[...this.me],r=i.findIndex(l=>l.colId===e.id),o=r>=0?i[r].direction:null,s=o===null?"asc":o==="asc"?"desc":null;t&&this.e.t.multiSort?s===null?r>=0&&i.splice(r,1):r>=0?i[r]={colId:e.id,direction:s}:i.push({colId:e.id,direction:s}):(i.length=0,s&&i.push({colId:e.id,direction:s})),this.me=i}};function k(n){return n!=null&&typeof n.then=="function"}function oe(n,e){if(n instanceof Error)return n;let t=new Error(typeof n=="string"?n:e);return t.name="AbortError",t}var us=()=>oe(void 0,"[MachTable] Operation cancelled.");function at(n,e,t=us){return e?new Promise((i,r)=>{let o=()=>{e.removeEventListener("abort",o),r(t())};if(n.then(i,r).finally(()=>e.removeEventListener("abort",o)),e.aborted){o();return}e.addEventListener("abort",o,{once:!0})}):n}function Lr(n){return n==null?"":String(n).toLowerCase()}function Ti(n,e,t){return n.length===0||(e==="or"?n.some(t):n.every(t))}function cs(n,e,t){let i=Lr(n);return Ti(e,t,o=>{let s=(o.value??"").toLowerCase();switch(o.match){case"contains":return i.includes(s);case"notContains":return!i.includes(s);case"equals":return i===s;case"notEquals":return i!==s;case"startsWith":return i.startsWith(s);case"endsWith":return i.endsWith(s);case"blank":return i==="";case"notBlank":return i!=="";default:return!0}})}function Nr(n,e,t,i){switch(t){case"equals":return n===e;case"notEquals":return n!==e;case"lessThan":return n<e;case"lessThanOrEqual":return n<=e;case"greaterThan":return n>e;case"greaterThanOrEqual":return n>=e;case"inRange":return n>=e&&n<=i;default:return!0}}function hs(n,e){let t=n==null||n==="";if(e.match==="blank")return t;if(e.match==="notBlank")return!t;if(t)return!1;let i=typeof n=="number"?n:Number(n);if(Number.isNaN(i))return!1;let r=e.value;return r==null||Number.isNaN(r)?!1:Nr(i,r,e.match,e.value2??r)}function ps(n,e,t){return Ti(e,t,r=>hs(n,r))}function Ci(n){if(n==null||n==="")return null;if(typeof n=="number")return n;let e=n instanceof Date?n.getTime():Date.parse(String(n));return isNaN(e)?null:e}function fs(n,e,t){let i=Ci(n);return Ti(e,t,o=>{let s=i==null;if(o.match==="blank")return s;if(o.match==="notBlank")return!s;if(s)return!1;let a=Ci(o.value);if(a==null)return!1;let l=o.match==="inRange"?Ci(o.value2)??1/0:a;return Nr(i,a,o.match,l)})}function ms(n,e){return e.length===0?!0:e.some(t=>t==null&&n==null||t===n)}function gs(n,e){let t=e.type!=="set"&&e.operator==="or"?"or":"and";switch(e.type){case"text":return cs(n,e.conditions,t);case"number":return ps(n,e.conditions,t);case"date":return fs(n,e.conditions,t);case"set":return ms(n,e.values);default:return!0}}function Fr(n,e,t){return i=>gs(t(i,n),e)}function Or(n,e,t){if(n.kind==="condition"){let r=e.get(n.colId);return r?Fr(r,n.filter,t):()=>!0}let i=n.children.map(r=>Or(r,e,t));return r=>{let o=n.operator==="or"?i.some(s=>s(r)):i.every(s=>s(r));return n.not?!o:o}}function Di(n,e,t,i,r){let o=new Map(n.map(l=>[l.id,l])),s=Object.entries(e).flatMap(([l,d])=>{let u=o.get(l);return u?[Fr(u,d,r)]:[]});t&&s.push(Or(t.root,o,r));let a=i?.trim().toLowerCase().split(/\s+/).filter(Boolean)??[];return l=>s.every(d=>d(l))&&a.every(d=>n.some(u=>Lr(r(l,u)).includes(d)))}var Hr=typeof Intl<"u"?new Intl.Collator(void 0,{numeric:!0,sensitivity:"base"}):null;function ys(n,e){let t=n==null||n==="",i=e==null||e==="";return!t&&!i?null:t&&i?0:t?1:-1}function vs(n,e){let t=Number.isNaN(n),i=Number.isNaN(e);return t||i?t===i?0:t?1:-1:n-e}function bs(n,e){return n===e?0:n?1:-1}function lt(n,e){let t=ys(n,e);if(t!==null)return t;if(typeof n=="number"&&typeof e=="number")return vs(n,e);if(n instanceof Date&&e instanceof Date)return n.getTime()-e.getTime();if(typeof n=="boolean"&&typeof e=="boolean")return bs(n,e);let i=String(n),r=String(e);return Hr?Hr.compare(i,r):i.localeCompare(r)}function xi(n,e,t,i){let r=new Map(t.map(a=>[a.id,a])),o=e.flatMap(a=>{let l=r.get(a.colId);return l?[{column:l,compare:l.colDef.comparator??lt,direction:a.direction}]:[]}),s=n.map(a=>({node:a,values:o.map(({column:l})=>i(a,l))}));return s.sort((a,l)=>{for(let d=0;d<o.length;d++){let u=o[d],c=u.compare(a.values[d],l.values[d],a.node,l.node);if(c!==0)return u.direction==="asc"?c:-c}return 0}),s.map(({node:a})=>a)}function Vr(){return{count:0,numeric:0,sum:0,min:1/0,max:-1/0}}function Br(n,e){n.count++,!(typeof e!="number"||!Number.isFinite(e))&&(n.numeric++,n.sum+=e,n.min=Math.min(n.min,e),n.max=Math.max(n.max,e))}function _r(n,e){return e==="count"?n?.count??0:n?.numeric?e==="min"?n.min:e==="max"?n.max:Number.isFinite(n.sum)?e==="avg"?n.sum/n.numeric:n.sum:null:null}function dt(n,e){let t=Vr();for(let i of n)Br(t,i);return _r(t,e)}var ut={sum:n=>dt(n,"sum"),avg:n=>dt(n,"avg"),count:n=>n.length,min:n=>dt(n,"min"),max:n=>dt(n,"max"),first:n=>n.length>0?n[0]:null,last:n=>n.length>0?n[n.length-1]:null};function zr(n,e,t){if(e===ut.count)return n.length;let i=["sum","avg","min","max"].find(o=>e===ut[o]);if(!i)return e(n.map(t));let r=Vr();for(let o of n)Br(r,t(o));return _r(r,i)}function Ri(n){let e={...ut,...n??{}};return t=>e[t]}var ct="group:";function Wr(n){return n==null?"null":n instanceof Date?JSON.stringify(["date",String(n.getTime())]):JSON.stringify([typeof n,Ei(n)])}function Ei(n){return n==null?"(\u7A7A)":String(n)}function $r(n){return ct+JSON.stringify(n)}function ws(n,e,t){let i=new Map;for(let r of n){let o=t(r,e),s=Wr(o),a=i.get(s);a||(a={key:s,label:Ei(o),rows:[]},i.set(s,a)),a.rows.push(r)}return[...i.values()].sort((r,o)=>r.label.localeCompare(o.label,void 0,{numeric:!0,sensitivity:"base"})||r.key.localeCompare(o.key))}function Kr(n,e,t,i,r){let o=[],s=(a,l,d)=>{if(l===e.length)return{display:a,leaves:a};let u=[],c=[];for(let h of ws(a,e[l],t)){let f=[...d,[e[l].id,h.key]],m=$r(f);o.push(m);let g=s(h.rows,l+1,f);if(u.push({id:m,data:null,rowIndex:-1,selected:!1,isGroup:!0,groupLevel:l,groupKey:h.label,leafNodes:g.leaves,aggValues:i(g.leaves)}),r.has(m))for(let b of g.display)u.push(b);if(l>0)for(let b of g.leaves)c.push(b)}return{display:u,leaves:c}};return{rows:s(n,0,[]).display,ids:o}}function Ur(n,e,t,i){let r=new Set([...n].filter(l=>l.startsWith("/g0:")));if(!r.size)return{expanded:n,ambiguous:[]};let o=new Map;for(let l of e){let d=[],u="";for(let c=0;c<t.length;c++){let h=i(l,t[c]);if(d.push([t[c].id,Wr(h)]),u+=`/g${c}:${Ei(h)}`,!r.has(u))continue;let f=$r(d);o.set(u,o.has(u)&&o.get(u)!==f?null:f)}}let s=new Set([...n].filter(l=>!r.has(l))),a=[];for(let l of r){let d=o.get(l);d?s.add(d):d===null?a.push(l):s.add(l)}return{expanded:s,ambiguous:a}}function Cs(n,e){let t=n?[n.root]:[];for(;t.length;){let i=t.pop();if(i.kind==="condition")e.add(i.colId);else for(let r of i.children)t.push(r)}}function jr(n){let e=new Set(Object.keys(n.filterModel));Cs(n.advancedFilter,e);let t=new Set(n.sortModel.map(a=>a.colId));for(let a of t)e.add(a);let i=n.columns.some(a=>a.colDef.rowGroup===!0),r=!!n.quickFilter?.trim(),o=n.columns.filter(a=>e.has(a.id)||r||a.colDef.rowGroup===!0||i&&a.colDef.aggFunc!=null),s=new Set;for(let a of o){let l=a.colDef;if(i&&l.rowGroup!==!0&&l.aggFunc!=null&&n.customAggregates?.[l.aggFunc]||l.valueGetter||t.has(a.id)&&l.comparator||!l.field)return null;s.add(l.field)}return[...s]}function qr(n){return n!=null&&(typeof n=="object"||typeof n=="function")}function Yr(n,e){if(n.length*(e.length+4)>1e6)return null;let t=new WeakMap;for(let i of n){if(i.data==null)continue;let r=e.map(o=>K(i.data,o));r.some(qr)||t.set(i,r)}return t}function Xr(n,e,t,i){return t.length?!i||n===e||n==null||e==null?!0:t.some((r,o)=>{let s=K(e,r);return qr(s)||!Object.is(i[o],s)}):!1}function ue(n){return oe(n.reason,"Block request aborted")}function ht(n){return Number.isFinite(n)?Math.max(1,Math.trunc(n)):1}var pt=class{constructor(e,t,i=4){this.maxBlocks=e;this.vo=t;this.maxConcurrentRequests=i;this.ee=new Map;this.j=new Map;this.va=0;this.mo=0;this.go=0;this.ba=0;this.wa=0;this.kr=0;this.Pr=new Set;this.maxBlocks=ht(e),this.maxConcurrentRequests=ht(i)}configure(e,t=this.maxConcurrentRequests){this.maxBlocks=ht(e),this.maxConcurrentRequests=ht(t),this.yo(),this.Gr()}Eu(e){this.Pr=e,this.yo()}peek(e){let t=this.ee.get(e);if(t)return t.touchedAt=++this.va,t}has(e){return this.ee.has(e)}Jt(e){let t=this.j.get(e);t&&(this.j.delete(e),t.controller.abort(),t.state==="queued"&&t.reject(ue(t.controller.signal)));let i=this.ee.get(e);i&&(this.ee.delete(e),this.vo?.(e,i))}load(e,t,i,r=0){if(i?.aborted)return Promise.reject(ue(i));let o=this.peek(e);if(o)return this.go++,Promise.resolve(o);let s=this.j.get(e);if(s)return this.go++,s.priority=Math.max(s.priority,r),this.Gr(),this.Ca(e,s,i);this.ba++;let a=new AbortController,l,d,u=new Promise((f,m)=>{l=f,d=m}),c={controller:a,promise:u,consumers:0,loader:t,priority:r,state:"queued",resolve:l,reject:d};this.j.set(e,c);let h=this.Ca(e,c,i);return this.Gr(),h}Su(){this.mo++,this.Pr.clear();for(let e of this.j.values())e.controller.abort(),e.state==="queued"&&e.reject(ue(e.controller.signal));this.j.clear();for(let[e,t]of this.ee)this.vo?.(e,t);this.ee.clear()}snapshot(){let e=0,t=0;for(let i of this.ee.values())e+=i.rows.length;for(let i of this.j.values())i.state==="active"&&t++;return{cachedBlockCount:this.ee.size,loadingBlockCount:this.j.size,activeRequestCount:t,queuedRequestCount:Math.max(0,this.j.size-t),cachedRowCount:e,hitCount:this.go,missCount:this.ba,evictionCount:this.wa}}Gr(){for(;this.kr<this.maxConcurrentRequests;){let e,t;for(let[i,r]of this.j)r.state!=="queued"||r.controller.signal.aborted||(!t||r.priority>t.priority)&&(e=i,t=r);if(e==null||!t)return;this.Mu(e,t)}}Mu(e,t){t.state="active",this.kr++;let i=this.mo;this.Iu(t).then(r=>{i===this.mo&&!t.controller.signal.aborted&&(this.ee.set(e,{rows:r.rows,...r.lastRow==null?{}:{lastRow:r.lastRow},touchedAt:++this.va}),this.yo()),t.resolve(r)},t.reject).finally(()=>{this.kr=Math.max(0,this.kr-1),this.j.get(e)===t&&this.j.delete(e),this.Gr()})}Iu(e){let{signal:t}=e.controller;return at(Promise.resolve().then(()=>{if(t.aborted)throw ue(t);return e.loader(t)}),t,()=>ue(t))}Ca(e,t,i){return t.consumers++,new Promise((r,o)=>{let s=!1,a=d=>{s||(s=!0,i?.removeEventListener("abort",l),t.consumers=Math.max(0,t.consumers-1),d())},l=()=>a(()=>{t.consumers===0&&this.j.get(e)===t&&(this.j.delete(e),t.controller.abort(i?.reason),t.state==="queued"&&t.reject(ue(t.controller.signal))),o(ue(i))});i?.addEventListener("abort",l,{once:!0}),t.promise.then(d=>a(()=>r(d)),d=>a(()=>o(d instanceof Error?d:new Error(String(d??"Block request failed")))))})}yo(){let e=Math.max(this.maxBlocks,this.Pr.size+1);for(;this.ee.size>e;){let t=-1,i=Number.POSITIVE_INFINITY;for(let[o,s]of this.ee)this.Pr.has(o)||s.touchedAt<i&&(t=o,i=s.touchedAt);if(t<0)return;let r=this.ee.get(t);this.ee.delete(t),this.wa++,r&&this.vo?.(t,r)}}};function be(n,e){if(n==null||typeof n!="object")return;let t=n[e];return Array.isArray(t)?t:void 0}function we(n,e,t=0,i=new Set){for(let r of n){if(r==null)continue;if(t>=256)throw new RangeError("[MachTable] Tree data exceeds 256 levels.");if(i.has(r))throw new TypeError("[MachTable] Tree data contains a cyclic object graph.");let o=be(r,e);o?.length&&(i.add(r),we(o,e,t+1,i),i.delete(r))}}var ft=class{constructor(e){this.e=e;this.c=[];this._=[];this.te=new Map;this.ve=[];this.p=new Map;this.Se={};this.Me=null;this.He=null;this.A=new Set;this.z=new Set;this.Mi=[];this.Ii=new Map;this.Ta=[];this.k=null;this.Ai=!1;this.Da=!1;this.Ze=0;this.Lr=null;this.Nr=new WeakMap;this.Fr=new WeakMap;this.Qe=new Map;this.ki=new Map;this.Or=0;this.Hr=0;this.et=null;this.tt=new Map;this.xt=new Map;this.Vr=new Set;this.Rt=new Map;this.it=new pt(12,e=>this.xa(e));this.Pi=0;this.Br=null;this.bo=!1;this.Ra=0;this.we=[];this.V=1;this.Me=B(e.t.advancedFilterModel)}resolveRowId(e,t,i){let r=this.e.t.resolveRowId;if(!r)return i;try{let o=r({data:e,index:t,api:this.e.api});if(typeof o=="string"&&o.length>0)return o;this.e.reportError(new Error("rowKey must resolve to a non-empty identifier"),"rowKey",{index:t})}catch(o){this.e.reportError(o,"rowKey",{index:t})}return i}get M(){return this.e.t.treeData}get g(){return this.e.t.datasource!=null}get be(){return this.g&&this.e.t.datasourceMode==="block"}Gi(){if(this.g){if(this.be)return this.Zt();let e=Math.max(0,this.ve.length-this.c.length);return(this.k??this.c.length)+e}return this.ve.length}Li(){return this.Or}Ve(){return this.Hr}Au(){return this.Da}_r(e){return!this.g||e?.aborted?Promise.resolve():(this.Ea(!0),this.be?(this.it.configure(this.e.t.maxBlocksInCache,this.e.t.datasourceMaxConcurrentRequests),this.zr(0,e)):this.Sa(0,void 0,e))}Et(e){this.Da=e,this.e.n.Et(e,this.e.u("loading"))}Sa(e,t,i){if(!this.g||this.Ai||this.k!=null&&e>=this.k)return Promise.resolve();let r=this.e.t.blockSize,o=t??e+r;if(o<=e)return Promise.resolve();let s=++this.Ze,a=new AbortController,l=()=>a.abort(i?.reason);return i?.addEventListener("abort",l,{once:!0}),this.Lr=a,this.Ai=!0,this.Et(!0),new Promise(d=>{let u=c=>{i?.removeEventListener("abort",l),s===this.Ze&&(this.Ai=!1,this.Lr=null,this.Et(!1),c!=null&&c?.name!=="AbortError"&&this.e.reportError(c,"datasource.getRows",{startRow:e,endRow:o})),d()};this.Ma(e,o,a.signal,(c,h)=>{if(s!==this.Ze||this.e.o()||a.signal.aborted){u();return}typeof h=="number"&&h>=0?this.k=h:c.length<o-e&&(this.k=e+c.length);let f=this.c.length===0;this.ku(c),u(),this.O(),f&&this.e.Ie(),this.e.W.Wr()},c=>u(a.signal.aborted||this.e.o()?void 0:c??new Error("Datasource request failed")))})}wo(){this.Ze++,this.Lr?.abort(),this.Lr=null,this.Ai=!1,this.Et(!1),this.it.Su(),this.tt.clear(),this.xt.clear(),this.Vr.clear();for(let[e,t]of this.Rt)this.p.get(e)===t&&this.p.delete(e);this.Rt.clear()}ku(e){for(let t of e){if(t==null)continue;let i=this.c.length,r=this.resolveRowId(t,i,`inf-${this.e.Qt()}`);if(this.p.has(r)){this.e.reportError(new Error(`Duplicate row id: ${r}`),"datasource.getRows",{rowId:r});continue}let o={id:r,data:t,rowIndex:-1,selected:this.e.f.$r(r)};this.c.push(o),this.p.set(r,o),this._.push(o)}}zr(e,t,i=0){if(!this.be||e<0)return Promise.resolve();if(t?.aborted)return Promise.reject(this.Ia(t.reason));let r=this.e.t.blockSize,o=this.Ze,s=e*r;if(s>=this.Zt())return Promise.resolve();let a=this.k==null?s+r:Math.min(this.k,s+r),l=this.it.load(e,d=>this.Pu(s,a,d),t,i);return this.Et(this.c.length===0&&this.it.snapshot().loadingBlockCount>0),l.then(d=>{o!==this.Ze||t?.aborted||this.e.o()||!this.be||!this.it.has(e)||this.Vr.has(e)||(this.Gu(e,d),this.O(),this.e.W.Wr(),o===this.Ze&&!this.e.o()&&this.Aa(this.e.s.Co().lastExcl-1))}).catch(d=>{throw d?.name!=="AbortError"&&this.e.reportError(d,"datasource.getRows",{startRow:s,endRow:a}),d}).finally(()=>{o===this.Ze&&this.Et(this.c.length===0&&this.it.snapshot().loadingBlockCount>0)})}Pu(e,t,i){return new Promise((r,o)=>{this.Ma(e,t,i,(s,a)=>r({rows:s,...typeof a=="number"&&a>=0?{lastRow:a}:{}}),s=>o(s instanceof Error?s:new Error(typeof s=="string"?s:"Datasource request failed")))})}Ma(e,t,i,r,o){let s=this.e.t.datasource,a=0,l=null,d=!1,u=()=>d?!1:(d=!0,l!=null&&clearTimeout(l),i.removeEventListener("abort",c),!0),c=()=>{u()&&o(this.Ia(i.reason))};i.addEventListener("abort",c,{once:!0});let h=()=>{if(d)return;if(i.aborted||this.e.o()){c();return}a++;let f=!1,m=g=>{if(!(f||d)){if(f=!0,i.aborted||this.e.o()){c();return}a<=this.e.t.datasourceRetryCount?l=setTimeout(h,this.retryDelay(a)):u()&&o(g)}};try{let g=s.getRows({startRow:e,endRow:t,sortModel:this.e.r.Q(),filterModel:this.Be(),advancedFilterModel:this.Ni(),quickFilterText:this.He,signal:i,onSuccess:(b,w)=>{!f&&u()&&r(b??[],w)},fail:m});g&&typeof g.catch=="function"&&g.catch(m)}catch(g){m(g)}};h()}Gu(e,t){let i=this.e.t.blockSize,r=e*i;this.xa(e),typeof t.lastRow=="number"&&t.lastRow>=0?this.k=t.lastRow:t.rows.length<i&&(this.k=r+t.rows.length),t.rows.forEach((o,s)=>{if(o==null)return;let a=r+s;if(this.k!=null&&a>=this.k)return;let l=this.resolveRowId(o,a,`block-${a}`),d=this.Rt.get(l),u=this.p.get(l);if(u&&u!==d&&u.rowIndex!==a){this.e.reportError(new Error(`Duplicate row id: ${l}`),"datasource.getRows",{rowId:l});return}let c=d??{id:l,data:o,rowIndex:a,selected:this.e.f.$r(l)};c.rowIndex=a,c.selected=this.e.f.$r(l),this.Rt.delete(l),this.tt.set(a,c),this.xt.delete(a),this.p.set(l,c),this.Fr.set(c,a+1)}),this.ka(),this.Vr.add(e)}xa(e){this.Vr.delete(e);let t=this.e.t.blockSize,i=e*t,r;for(let o=i;o<i+t;o++){let s=this.tt.get(o);s&&(r??(r=new Set(this.e.P.getDirtyRowIds())),this.tt.delete(o),r.has(s.id)?this.Rt.set(s.id,s):this.p.get(s.id)===s&&this.p.delete(s.id))}this.ka()}ka(){this.c=[...this.tt.entries()].sort(([e],[t])=>e-t).map(([,e])=>e),this._=this.c}Zt(){if(this.k!=null)return this.k;if(this.e.t.datasourceRowCount!=null)return this.e.t.datasourceRowCount;if(this.tt.size===0)return this.e.t.blockSize;let e=0;for(let t of this.tt.keys())e=Math.max(e,t+1);return e+this.e.t.blockSize}Lu(e){let t=this.xt.get(e);if(!t&&(t={id:`__mach_loading_${e}`,data:null,rowIndex:e,selected:!1,loading:!0},this.xt.set(e,t),this.xt.size>2e3)){let i=this.xt.keys().next().value;i!=null&&this.xt.delete(i)}return t}Ia(e){return oe(e,"Operation aborted")}retryDelay(e){let t=Math.min(this.e.t.datasourceRetryDelay*2**Math.max(0,e-1),3e4),i=this.e.t.datasourceRetryJitter;return Math.max(0,Math.round(t*(1+(Math.random()*2-1)*i)))}Nu(e){if(this.be){this.Aa(e);return}if(!this.g||this.Ai)return;let t=this.c.length;if(this.k!=null&&t>=this.k)return;let i=this.e.t.infiniteBufferRows;if(e+i<t&&e<t)return;let r=this.e.t.blockSize,o=this.k==null?t+r:Math.min(this.k,t+r);this.Sa(t,o)}Aa(e){if(e<0)return;this.Pa();let t=this.e.t.blockSize,i=Math.floor(e/t),r=Math.floor(this.e.s.Co().first/t),o=this.e.t.blockPrefetch,s=i<this.Ra?-1:1;this.Ra=i;for(let a=r;a<i;a++)this.zr(a,void 0,o+2).catch(()=>{});for(let a=0;a<=o;a++){let l=a===0?[i]:[i+s*a,i-s*a];for(let d of l)d<0||d*t>=this.Zt()||this.zr(d,void 0,o-a+1).catch(()=>{})}}Ga(){return this._r().catch(()=>{})}Fu(){return this.wo(),this.g?this._r().catch(()=>{}):(this.k=null,this.rt(this.e.t.rowData),this.e.$({data:!0}),Promise.resolve())}destroy(){this.et=null,this.wo(),this.La(),this.To(),this.c=this._=this.ve=this.we=[],this.p.clear(),this.te.clear(),this.Ii.clear(),this.Ta=[],this.A.clear(),this.z.clear(),this.Mi=[]}Do(e,t,i){if(!this.be)return Promise.resolve();this.Pa();let r=this.e.t.blockSize,o=Math.max(0,Math.trunc(e)),s=Math.min(this.Zt(),Math.max(o,Math.trunc(t))),a=Math.floor(o/r),l=Math.max(a,Math.floor(Math.max(o,s-1)/r)),d=[];for(let u=a;u<=l;u++)d.push(this.zr(u,i,100));return Promise.all(d).then(()=>{})}Ou(){this.be&&this.Ea(!1)}Ea(e){this.Na(),this.e.P.clear(),this.wo(),e&&(this.k=null,this.A.clear()),this.c=[],this._=[],this.p.clear(),this.e.H.clear(),this.O()}Na(){this.Hr++,this.e._e(),this.e.api.editing.stop({cancel:!0})}Hu(){return this.it.snapshot()}Pa(){let e=new Set(this.e.P.getDirtyRowIds());for(let[l,d]of this.Rt)e.has(l)||(this.Rt.delete(l),this.p.get(l)===d&&this.p.delete(l));let t=this.e.t.blockSize,i=new Set,{first:r,lastExcl:o}=this.e.s.Co();for(let l=r;l<o;l+=t)i.add(Math.floor(l/t));o>r&&i.add(Math.floor((o-1)/t));let s=this.e.s.v;s&&i.add(Math.floor(s.rowIndex/t));let a=this.e.a.Vu();a!=null&&i.add(Math.floor(a/t)),this.it.Eu(i)}rt(e){let t=this.e.t.resolveRowId,i=this.e.t.childrenKey;this.M&&we(e??[],i);let r=[],o=[],s=new Map,a=new Map,l=0,d=(u,c,h)=>{let f=l++,m=this.resolveRowId(u,f,`auto-${f}`);if(s.has(m))return this.e.reportError(new Error(`Duplicate row id: ${m}`),"rowData",{rowId:m,index:f}),null;let g=this.M?be(u,i):void 0,b={id:m,data:u,rowIndex:-1,selected:!1,treeChildrenLoaded:Array.isArray(g)};if(this.Nr.set(b,c),r.push(b),s.set(m,b),h!=null){let w=a.get(h)??[];w.push(m),a.set(h,w)}else o.push(b);if(this.M&&Array.isArray(g))for(let w of g)w!=null&&d(w,c+1,m);return b};(e??[]).forEach(u=>{u!=null&&d(u,0,null)}),this.e.t.rowData=e??[],this.Na(),this.La(),this.e.P.clear(),this.c=r,this._=o,this.te=a,this.p=s,this.e.H.clear();for(let u of[...this.A])s.has(u)||this.A.delete(u);if(this.e.t.defaultExpandAll)for(let u of r)this.Fa(u.id)>0&&this.A.add(u.id);this.e.f.Oa(t!=null),this.Kr()}Fi(e){return this.te.get(e)??[]}Fa(e){return this.te.get(e)?.length??0}xo(e){return this.Fa(e)>0}isTreeRowLoading(e){return this.p.get(e)?.treeLoading===!0}La(){for(let e of this.Qe.values())e.abort();this.Qe.clear(),this.ki.clear()}loadTreeChildren(e,t=!1){let i=this.p.get(e),r=this.e.t.loadTreeChildren;if(!this.M||!i?.data||!r)return Promise.resolve([]);if(!t&&i.treeChildrenLoaded)return Promise.resolve(this.Fi(e).flatMap(l=>{let d=this.p.get(l)?.data;return d==null?[]:[d]}));let o=this.ki.get(e);if(o&&!t)return o;this.Qe.get(e)?.abort();let s=new AbortController;this.Qe.set(e,s),i.treeLoading=!0,i.treeLoadError=void 0,this.e.$({data:!0});let a=Promise.resolve().then(()=>r({data:i.data,node:i,api:this.e.api,signal:s.signal})).then(l=>{if(s.signal.aborted||this.e.o())return[];if(!Array.isArray(l))throw new TypeError("[MachTable] loadTreeChildren must resolve to an array.");return this.Bu(i,l),i.treeChildrenLoaded=!0,i.treeLoadError=void 0,this.e.emit("treeChildrenLoaded",{rowId:e,rowNode:i,children:l}),l}).catch(l=>{if(s.signal.aborted||l?.name==="AbortError")return[];throw i.treeLoadError=l,i.treeChildrenLoaded=!1,this.e.reportError(l,"treeData.loadChildren",{rowId:e}),this.e.emit("treeChildrenLoadFailed",{rowId:e,rowNode:i,error:l}),l}).finally(()=>{this.Qe.get(e)===s&&(this.Qe.delete(e),this.ki.delete(e),i.treeLoading=!1,this.e.$({data:!0}))});return this.ki.set(e,a),a}Bu(e,t){let i=new Set,r=[...this.Fi(e.id)];for(;r.length>0;){let s=r.pop();i.has(s)||(i.add(s),r.push(...this.Fi(s)))}this._u(t,i,this.Ur(e)+1);for(let s of i)this.Qe.get(s)?.abort(),this.Qe.delete(s),this.ki.delete(s),this.te.delete(s),this.p.delete(s),this.A.delete(s);this.te.delete(e.id);let o=this.Ur(e)+1;for(let s of t)s!=null&&this.Ro(e,s,o);this.Ha(),this.e.f.Oa(this.e.t.resolveRowId!=null),this.O()}_u(e,t,i){we(e,this.e.t.childrenKey,i);let r=this.e.t.resolveRowId,o=r?new Set([...this.p.keys()].filter(l=>!t.has(l))):null,s=[...e],a=0;for(;s.length>0;){let l=s.pop();if(l==null)continue;if(r&&o){let u=r({data:l,index:a++,api:this.e.api});if(typeof u!="string"||u.length===0)throw new TypeError("[MachTable] rowKey must resolve to a non-empty identifier for lazy tree children.");if(o.has(u))throw new Error(`Duplicate row id: ${u}`);o.add(u)}let d=be(l,this.e.t.childrenKey);d&&s.push(...d)}}Oi(e,t=!0){this.M&&e.add?.length&&we(e.add,this.e.t.childrenKey);let i=this.e.t.resolveRowId,r=[],o=[];if(e.remove?.length){let a=new Set,l=new Set,d=c=>{if(i){let f=[this.resolveRowId(c,-1,`__missing_remove_${this.e.Qt()}`)];for(;f.length>0;){let m=f.pop();if(!a.has(m)){a.add(m);for(let g of this.te.get(m)??[])f.push(g)}}}else{let h=[c];for(;h.length>0;){let f=h.pop();l.add(f);let m=this.M?be(f,this.e.t.childrenKey):void 0;if(m)for(let g of m)h.push(g)}}};e.remove.forEach(d),this.c=this.c.filter(c=>{let h=a.has(c.id)||c.data!=null&&l.has(c.data);return h&&(o.push(c.id),this.p.delete(c.id),this.te.delete(c.id)),!h});let u=new Set(this.c);this._=this._.filter(c=>u.has(c))}if(e.update?.length)for(let a of e.update){let l;i?l=this.p.get(this.resolveRowId(a,-1,`__missing_update_${this.e.Qt()}`)):l=this.c.find(d=>d.data===a),l&&(r.push({node:l,before:l.data,after:a}),l.data=a,o.push(l.id),this.e.s.Va(l))}if(e.add?.length){let a=e.addIndex!=null?Math.max(0,Math.min(e.addIndex,this._.length)):this._.length,l=[];e.add.forEach((d,u)=>{let c=this.resolveRowId(d,a+u,`add-${this.e.Qt()}`);if(this.p.has(c)){this.e.reportError(new Error(`Duplicate row id: ${c}`),"transaction.add",{rowId:c});return}let h={id:c,data:d,rowIndex:-1,selected:!1};this.p.set(c,h),this.Nr.set(h,0);let f=this.M?be(d,this.e.t.childrenKey):void 0;if(f)for(let m of f)m!=null&&this.Ro(h,m,1);l.push(h)}),this._=this._.slice(0,a).concat(l,this._.slice(a)),this.Ha()}let s={pipelineChanged:this.zu(e,r),updatedRowIds:r.map(({node:a})=>a.id)};return this.e.H.Wu(o),this.$u(s,t),this.e.P.Ku(o),s}$u(e,t){e.pipelineChanged&&(this.et=null),t&&(e.pipelineChanged?this.Kr():e.updatedRowIds.length&&this.Ba())}Uu(e){if(e.length===0)return{pipelineChanged:!1,updatedRowIds:[]};let t=this.Hr,i=!1,r=new Set;for(let o of e){let s=this.Oi(o,!1);if(this.Hr!==t)return{pipelineChanged:!1,updatedRowIds:[]};i||(i=s.pipelineChanged);for(let a of s.updatedRowIds)r.add(a)}return i?this.Kr():r.size>0&&this.Ba(),{pipelineChanged:i,updatedRowIds:[...r]}}zu(e,t){if(e.add?.length||e.remove?.length)return!0;if(!t.length)return!1;let i=this._a();if(i===null)return!0;if(!i.length)return!1;let r=this.et;return!r||i.length!==r.fields.length||i.some((o,s)=>o!==r.fields[s])?!0:t.some(({node:o,before:s,after:a})=>Xr(s,a,i,r.values.get(o)))}_a(){if(this.M||this.e.t.masterDetail||this.za())return null;let e=this.e.r.l();if(e.some(i=>rt(i)||i.colDef.autoRowSpan===!0||i.colDef.rowSpan!=null))return null;let t=!this.e.t.manualFiltering;return jr({columns:e,customAggregates:this.e.t.aggFuncs,sortModel:this.e.t.manualSorting?[]:this.e.r.Q(),filterModel:t?this.Se:{},advancedFilter:t?this.Me:null,quickFilter:t?this.He:null})}ju(){let e=this._a(),t=e?.length?Yr(this.c,e):null;this.et=e&&t?{fields:e,values:t}:null}Ba(){this.e.emit("modelUpdated",{rowCount:this.we.length})}Ro(e,t,i){let r=this.resolveRowId(t,-1,`add-${this.e.Qt()}`);if(this.p.has(r)){this.e.reportError(new Error(`Duplicate row id: ${r}`),"transaction.add",{rowId:r});return}let o=be(t,this.e.t.childrenKey),s={id:r,data:t,rowIndex:-1,selected:!1,treeChildrenLoaded:Array.isArray(o)};this.p.set(r,s),this.Nr.set(s,i);let a=this.te.get(e.id)??[];if(a.push(s.id),this.te.set(e.id,a),!!o)for(let l of o)l!=null&&this.Ro(s,l,i+1)}Ha(){this.c=[];let e=t=>{this.c.push(t),this.p.has(t.id)||this.p.set(t.id,t);for(let i of this.te.get(t.id)??[]){let r=this.p.get(i);r&&e(r)}};for(let t of this._)e(t)}St(e){let t=JSON.stringify(this.Se),i=new Set(this.e.r.Z().map(o=>o.id));this.Se=le(e,i);let r=JSON.stringify(this.Se)!==t;return r&&(this.et=null),r}Be(){return{...this.Se}}qu(e=this.Me){let t=Object.keys(this.Se).length>0&&this.St(this.Se),i=(e!=null||this.Me!=null)&&this.nt(e);return t||i}nt(e){let t=new Set(this.e.r.Z().map(s=>s.id)),i=B(e,t),r=JSON.stringify(this.Me);this.Me=i,this.e.t.advancedFilterModel=i;let o=JSON.stringify(i)!==r;return o&&(this.et=null),o}Ni(){return B(this.Me)}Mt(e){let t=e!=null&&e.trim()!==""?e:null;return t===this.He?!1:(this.He=t,this.et=null,!0)}Eo(){return this.He}Hi(){return Object.keys(this.Se).length>0||this.Me!=null||this.He!=null}O(){this.Kr(),this.e.$({data:!0})}So(){this.g?this.Ga():this.O()}Kr(){this.et=null;let e=this.e.Ce.start(),t=this.e.r.l(),i=(s,a)=>this.e.d(s,a);if(this.g){this.Yu(e);return}if(this.Xu(e))return;let r,o=[];if(this.M)r=this.Ju(t,i);else{r=this.c,this.Hi()&&!this.e.t.manualFiltering&&(r=r.filter(Di(t,this.Se,this.Me,this.He,i)));let a=this.e.r.Q();if(a.length>0&&!this.e.t.manualSorting)try{r=xi(r,a,t,i)}catch(d){this.e.reportError(d,"comparator",{sortModel:a})}let l=this.e.r.Je();if(l.length>0){let d=this.Zu(r,l);r=d.rows,o=d.ambiguousExpansions}else if(this.e.t.masterDetail){let d=[];for(let u of r)d.push(u),this.A.has(u.id)&&this.isRowExpandable(u)&&d.push({id:`__detail__${u.id}`,data:u.data,rowIndex:-1,selected:!1,isDetail:!0,masterId:u.id});r=d}}this.Wa(r,e,!0),this.Qu(o)}Wa(e,t,i=!1){for(let o of this.c)o.rowIndex=-1;let r=0;e.forEach((o,s)=>{o.rowIndex=s,!o.isDetail&&!o.isGroup&&this.Fr.set(o,++r)}),this.we=e,this.Vi(),i&&this.ju(),this.ec((o,s)=>this.e.d(o,s)),this.e.emit("modelUpdated",{rowCount:e.length}),this.e.Ce.$a(t)}Yu(e){this.c.forEach((t,i)=>{this.be||(t.rowIndex=i),this.Fr.set(t,this.be?t.rowIndex+1:i+1)}),this.ve=this.c,this.we=this.c,this.Ii.clear(),this.e.t.getRowHeight&&this.e.s.ot(),this.Or++,this.e.emit("modelUpdated",{rowCount:this.c.length}),this.e.Ce.$a(e)}Xu(e){let t=this.bo;return this.bo=!1,!t&&this.za()?(this.tc(e),!0):(this.To(),!1)}za(){if(!this.e.t.dataProcessor||this.c.length<this.e.t.dataProcessorMinRows||this.M||this.e.t.masterDetail||this.e.r.Je().length>0)return!1;let e=!this.e.t.manualFiltering&&this.Hi(),t=!this.e.t.manualSorting&&this.e.r.Q().length>0;return e||t}tc(e){this.To();let t=this.e.t.dataProcessor;if(!t)return;let i=++this.Pi,r=new AbortController;this.Br=r;let o=this.e.r.l(),s=this.c.flatMap(d=>d.data==null?[]:[{id:d.id,data:d.data}]),a=!this.e.t.manualFiltering,l=!this.e.t.manualSorting;Promise.resolve().then(()=>t.process({rows:s,columns:o.map(d=>({colId:d.id,...d.colDef.field?{field:d.colDef.field}:{}})),sortModel:l?this.e.r.Q():[],filterModel:a?this.Be():{},advancedFilterModel:a?this.Ni():null,quickFilterText:a?this.He:null,signal:r.signal})).then(d=>{if(i!==this.Pi||r.signal.aborted||this.e.o())return;let u=new Set,c=[];for(let h of d.rowIds){if(u.has(h))continue;u.add(h);let f=this.p.get(h);f&&!f.isDetail&&!f.isGroup&&c.push(f)}this.Wa(c,e),this.e.$({data:!0})}).catch(d=>{i!==this.Pi||r.signal.aborted||this.e.o()||(this.e.reportError(d,"dataProcessor.process"),this.bo=!0,this.O())}).finally(()=>{i===this.Pi&&(this.Br=null)})}To(){this.Pi++,this.Br?.abort(),this.Br=null}get Te(){return this.e.t.paginationEnabled&&!this.g}Vi(){if(this.e.t.getRowHeight&&this.e.s.ot(),!this.Te){this.ve=this.we,this.Or++;return}let e=this.Bi(),t=this.getPageCount();this.V>t&&(this.V=t),this.V<1&&(this.V=1),this.e.t.paginationPage=this.V;let i=(this.V-1)*e;this.ve=this.e.t.paginationMode==="server"?this.we:this.we.slice(i,i+e),this.ve.forEach((r,o)=>{r.rowIndex=o}),this.Or++}Bi(){return Math.max(1,this.e.t.paginationPageSize)}ei(){return this.Te?this.V:1}getTotalRowCount(){return this.g?this.Gi():this.Te&&this.e.t.paginationMode==="server"?this.e.t.paginationTotal:this.we.length}getPageCount(){return this.Te?Math.max(1,Math.ceil(this.getTotalRowCount()/this.Bi())):1}Ka(){return this.we}setPage(e,t=!1){if(!this.Te)return;let i=this.getPageCount(),r=Math.max(1,Math.min(Math.round(e)||1,i));r!==this.V&&(this.V=r,this.e.t.paginationPage=r,this.Vi(),this.e.$({data:!0}),this.e.s.jr(0,"top"),t||this._i())}setPageSize(e){if(!this.Te)return;let t=Math.max(1,Math.round(e)||this.Bi()),i=(this.V-1)*this.Bi();this.e.t.paginationPageSize=t,this.V=Math.floor(i/t)+1,this.e.t.paginationPage=this.V,this.Vi(),this.e.$({data:!0}),this._i()}Ua(e,t){this.e.t.paginationPageSize=t,this.V=e,this.e.t.paginationPage=this.V}ja(e){this.e.t.paginationEnabled!==e&&(this.e.t.paginationEnabled=e&&!this.g,this.e.t.paginationEnabled&&(this.V=1),e||this.we.forEach((t,i)=>{t.rowIndex=i}),this.Vi(),this.e.$({data:!0}),this._i())}ic(){this.Te&&(this.V=this.e.t.paginationMode==="server"?this.e.t.paginationPage:1,this.Vi(),this.e.$({data:!0}),this._i())}_i(e=this.Bi()){this.e.emit("paginationChanged",{page:this.ei(),pageSize:e,pageCount:this.getPageCount(),total:this.getTotalRowCount()})}Ju(e,t){let i=this.e.t.manualSorting?[]:this.e.r.Q(),r=new Map,o=this.Hi()&&!this.e.t.manualFiltering,s=Di(e,this.Se,this.Me,this.He,t),a=u=>{let c=r.get(u.id);if(c!==void 0)return c;let h=!0;if(o){h=s(u);for(let f of this.te.get(u.id)??[]){let m=this.p.get(f);m&&a(m)&&(h=!0)}}return r.set(u.id,h),h},l=[],d=u=>{let c=u;i.length>0&&(c=xi(u,i,e,t));for(let h of c)if(a(h)&&(l.push(h),this.A.has(h.id))){let f=(this.te.get(h.id)??[]).map(m=>this.p.get(m)).filter(m=>m!=null);d(f)}};return d(this._),l}rc(){let e=this.Ta,t=0;for(let i of this.ve)!i.isDetail&&!i.isGroup&&(e[t++]=i);return e.length=t,e}nc(e,t,i,r){let o=t.colDef.rowSpan;if(!o)return 1;try{let s=o({api:this.e.api,colDef:t.colDef,column:t,node:e,data:e.data,value:i,rowIndex:e.rowIndex});return Math.max(1,Math.min(Math.round(s)||1,r))}catch(s){return this.e.reportError(s,"rowSpan",{colId:t.id,rowId:e.id}),1}}oc(e,t,i,r,o){if(!i.colDef.autoRowSpan||r==null||r==="")return 1;let s=1;for(;t+s<e.length&<(r,o(e[t+s],i))===0;)s++;return s}sc(e,t,i){let r=new Int32Array(e.length),o=0;for(;o<e.length;){let s=e[o],a=i(s,t),l=t.colDef.rowSpan?this.nc(s,t,a,e.length-o):this.oc(e,o,t,a,i);r[o]=l;for(let d=1;d<l;d++)r[o+d]=-1;o+=l}return r}ec(e){if(this.Ii.clear(),this.M||this.e.t.masterDetail||this.e.r.Je().length>0)return;let t=this.e.r.l().filter(r=>r.colDef.rowSpan!=null||r.colDef.autoRowSpan===!0);if(t.length===0)return;let i=this.rc();if(i.length!==0)for(let r of t)this.Ii.set(r.id,this.sc(i,r,e))}ac(e){return this.Ii.get(e)}qa(e){return this.Fr.get(e)??0}Ur(e){return this.Nr.get(e)??0}Zu(e,t){let i=Ri(this.e.t.aggFuncs),r=this.e.r.Du();this.Mi=[];let o=l=>{let d={};for(let u of r){let c=i(u.colDef.aggFunc);if(c)try{d[u.id]=zr(l,c,h=>this.e.d(h,u))}catch(h){this.e.reportError(h,"aggFunc",{colId:u.id,aggFunc:u.colDef.aggFunc}),d[u.id]=null}}return d},s=Ur(this.z,this.c,t,(l,d)=>this.e.d(l,d));this.z=s.expanded;let a=Kr(e,t,(l,d)=>this.e.d(l,d),o,this.z);return this.Mi=a.ids,{rows:a.rows,ambiguousExpansions:s.ambiguous}}Qu(e){for(let t of e){if(this.e.o())return;this.e.reportError(new Error(`Ambiguous legacy group expansion: ${t}`),"gridState.groupExpansion",{groupId:t})}}isRowExpandable(e){let t=this.M;if(t){if(this.xo(e.id)||e.treeLoading)return!0;if(e.treeChildrenLoaded||!e.data||!this.e.t.loadTreeChildren)return!1}else if(!this.e.t.masterDetail)return!1;let i=t?"isTreeRowExpandable":"isRowExpandable",r=this.e.t[i];if(!r)return!t;try{return r({data:e.data,node:e,api:this.e.api})}catch(o){return this.e.reportError(o,i,{rowId:e.id}),!1}}isRowExpanded(e){return this.A.has(e)}lc(){return[...this.A]}dc(){return[...this.z]}uc(e,t){this.A=new Set(e.filter(i=>this.p.has(i))),this.z=new Set(t)}cc(e){return this.Mo(e,!0)}hc(e){return this.Mo(e,!1)}qr(e){return this.Mo(e,!this.A.has(e))}Mo(e,t){let i=this.p.get(e);return!i||t&&!this.isRowExpandable(i)?!1:(t===this.A.has(e)||(t?this.A.add(e):this.A.delete(e),this.O(),this.e.emit("detailToggled",{rowId:e,rowNode:i,expanded:t}),t&&this.M&&!this.xo(e)&&!i.treeLoading&&this.loadTreeChildren(e).catch(()=>{})),t)}setAllDetailsExpanded(e){let t=!1;if(e)for(let i of this.c)!this.A.has(i.id)&&this.isRowExpandable(i)&&(this.A.add(i.id),t=!0);else this.A.size>0&&(this.A.clear(),t=!0);t&&this.O()}Io(e){return this.setGroupExpanded(e,!this.z.has(e))}isGroupExpanded(e){return this.z.has(e)}setAllGroupsExpanded(e){let t=this.z.size;if(e)for(let i of this.Mi)this.z.add(i);else this.z.clear();this.z.size!==t&&this.O()}setGroupExpanded(e,t){return!this.Mi.includes(e)||t===this.z.has(e)||(t?this.z.add(e):this.z.delete(e),this.O()),t}Ya(){return!this.M&&!this.g&&!this.e.t.dataProcessor&&this.e.t.paginationMode!=="server"&&this.e.r.Q().length===0&&this.e.r.Je().length===0}Xa(e,t){if(!this.Ya()||!Number.isInteger(e)||!Number.isInteger(t))return!1;let i=this.h(e),r=this.h(t);if(!i||!r||i.isDetail||r.isDetail||i.isGroup||r.isGroup)return!1;let o=this.c.indexOf(i),s=this.c.indexOf(r);return o<0||s<0||o===s?!1:(this.c.splice(o,1),this.c.splice(s,0,i),this.O(),!0)}Oe(){return this.c}pc(){return this._}It(){return this.ve}G(){return this.be?this.Zt():this.ve.length}h(e){return this.be?e<0||e>=this.Zt()?void 0:this.tt.get(e)??this.Lu(e):this.ve[e]}F(e){return this.p.get(e)}fc(e){this.c.forEach(e)}mc(e){let t=0;for(let i of this.we)i.isDetail||i.isGroup||e(i,t++)}};var mt=class{constructor(e){this.e=e;this.L=new Set;this.At=null;this.zi=new Set}$r(e){return this.L.has(e)}gc(e){return this.zi.has(e)}ze(e,t){if(e.loading)return!1;if(e.isGroup||e.isDetail)return!0;let i=t===void 0?this.Ao():t,r=i?.colDef.selectable;if(!i||!r)return!0;try{return r({api:this.e.api,colDef:i.colDef,column:i,node:e,data:e.data,value:this.e.d(e,i),rowIndex:e.rowIndex})}catch(o){return this.e.reportError(o,"selectable",{rowId:e.id,colId:i.id}),!1}}Ao(){return this.e.r.l().find(e=>e.hasCheckbox&&e.colDef.selectable!=null)}ti(){return this.e.i.Oe().filter(e=>this.L.has(e.id))}Ja(e=this.ti()){return e.filter(t=>t.data!=null).map(t=>t.data)}ko(){return[...this.L]}Za(e){let t=new Set(e),i=this.Ao()??null,r=this.e.i.Oe().filter(o=>t.has(o.id)&&!o.isDetail&&!o.isGroup&&this.ze(o,i)).map(o=>({node:o,selected:!0}));this.kt(r,!0)}yc(){this.Za(this.e.t.rowSelection==="none"?[]:this.ko())}Oa(e){let t=this.e.i;if(!e)this.L.clear(),this.At=null;else{for(let i of this.L)t.F(i)||this.L.delete(i);this.At!=null&&!t.F(this.At)&&(this.At=null)}this.Qa(null);for(let i of t.Oe())i.selected=this.L.has(i.id)}tl(e){let{selectable:t,selected:i}=this.il(e.leafNodes??[],!1);return{all:i>0&&i===t,some:i>0}}vc(e,t){let i=(e.leafNodes??[]).filter(r=>this.ze(r));i.length!==0&&this.kt(i.map(r=>({node:r,selected:t})))}Po(e,t,i=!1){this.kt([{node:e,selected:t,clearOthers:i}])}bc(e,t=!0,i=!0){let r=this.e.i.F(e);r&&this.Po(r,t,i)}wc(e,t,i){if(!i||!t.shiftKey||this.At==null)return!1;let r=this.e.i.F(this.At);if(!r||r.rowIndex<0||e.rowIndex<0)return!1;let o=Math.min(r.rowIndex,e.rowIndex),s=Math.max(r.rowIndex,e.rowIndex),a=[];for(let l=o;l<=s;l++){let d=this.e.i.h(l);d&&!d.isDetail&&!d.isGroup&&a.push({node:d,selected:!0})}return this.kt(a),!0}rl(e,t,i){let r=this.e.t.rowSelection;if(r==="none"||!this.ze(e))return;let o=r==="multiple",s=o&&(i||t.ctrlKey||t.metaKey);!s&&this.wc(e,t,o)||(this.Po(e,!s||!e.selected,!s),this.At=e.id)}selectAll(e=!0){if(this.e.t.rowSelection==="none")return;let i=e?this.e.i.It():this.e.i.Oe();this.kt(i.filter(r=>!r.isDetail&&!r.isGroup).map(r=>({node:r,selected:!0})))}deselectAll(){this.kt([],!0)}Cc(){let e=this.e.i,{selectable:t,selected:i}=this.il(e.It(),!0),r=i>0&&i===t&&(!e.g||t>=e.Gi());return{all:r,some:i>0&&!r}}il(e,t){let i=0,r=0;for(let o of e)t&&(o.isDetail||o.isGroup)||!this.ze(o)||(i++,this.L.has(o.id)&&r++);return{selectable:i,selected:r}}Tc(e,t){let i=this.e.i,r=this.e.t.rowSelection==="single",o=!r&&i.M&&this.e.t.autoCheckedChildren,s=(a,l,d=!1)=>{if(l?(d||this.ze(a,t))&&this.L.add(a.id):this.L.delete(a.id),!!o)for(let u of i.Fi(a.id)){let c=i.F(u);c&&s(c,l)}};for(let{node:a,selected:l}of e)if(s(a,l,!0),r&&l)break}Dc(e){let t=new Set(e);for(let i of this.L)t.delete(i)||t.add(i);return t}xc(e){let t=[];for(let i of this.e.i.Oe()){let r=this.L.has(i.id);(i.selected!==r||e.has(i.id)||this.zi.has(i.id))&&i.rowIndex>=0&&t.push(i.rowIndex),i.selected=r}return t}kt(e,t=!1){let i=this.e.t.rowSelection,r=this.Ao()??null,o=e.filter(u=>!u.selected||i!=="none"&&this.ze(u.node,r));if(e.length>0&&o.length===0)return;let s=new Set(this.L);(t||o.some(u=>u.selected?i==="single"||u.clearOthers:u.clearOthers&&this.ze(u.node,r)))&&this.L.clear(),this.Tc(o,r);let a=new Set(this.zi);this.Qa(r);let l=this.Dc(s),d=this.xc(a);if(l.size>0){this.e.s.O(d),this.e.W.Wr();let u=this.ti();this.e.emit("selectionChanged",{selectedNodes:u,selectedRows:this.Ja(u)})}}Qa(e){this.zi.clear();let t=this.e.i;if(this.e.t.rowSelection!=="multiple"||!t.M||this.L.size===0)return;let i=r=>{let o=e&&t.F(r),s=!o||this.ze(o,e),a=!0,l=!1;for(let d of t.Fi(r)){let u=i(d);a&&(a=u.all),l||(l=u.some)}if(a&&!l){s||this.L.delete(r);let d=this.L.has(r);return{all:d||!s,some:d}}return s&&a?this.L.add(r):(this.L.delete(r),s&&l&&this.zi.add(r)),{all:a,some:l}};for(let r of t.pc())i(r.id)}};var gt=class{constructor(e){this.e=e;this.Pt=null;this.ie=0;this.st=0;this.We=null;this.ii=null;this.Wi=e=>{let t=this.No(e);t&&(this.st=this.sl(t,e.clientX),t.didResize||(t.didResize=Math.abs(this.st-t.startWidth)>=.5),!this.ie&&(this.ie=requestAnimationFrame(()=>{this.ie=0,this.Sc()})))};this.ni=e=>{let t=this.No(e);t&&(this.st=this.sl(t,e.clientX),t.didResize||(t.didResize=Math.abs(this.st-t.startWidth)>=.5),this.Mc(t))};this.Yr=e=>{this.No(e)&&this.at()};this.Ic=()=>{this.at()};this.Fo=e=>{e.key==="Escape"&&(e.preventDefault(),this.at())}}Rc(e,t){if(!this.e.t.enableColumnResize||!t.resizable||e.isPrimary===!1)return;this.at();let i=e.currentTarget,r=t.currentWidth;this.st=r,this.Pt={column:t,didResize:!1,handle:i,pointerId:e.pointerId,startFlex:t.flex,startManualWidth:t.manualWidth,startWidth:r,startX:e.clientX,startPreserveWidths:this.e.r.Xe},this.Go(i,!0);try{i.setPointerCapture?.(e.pointerId)}catch{}this.e.n.root.classList.add("mach-root--resizing"),i.classList.add("mach-header-resize--active"),this.Ec(this.Pt)}at(e=!0){let t=this.Pt;t&&(this.Pt=null,this.Lo(),this.Go(t.handle,!1),e&&(this.nl(t),this.e.ri()),this.e.n.root.classList.remove("mach-root--resizing"),this.ol(t))}nl(e){e.column.manualWidth=e.startManualWidth,e.column.flex=e.startFlex,e.column.currentWidth=e.startWidth,this.e.r.Xe=e.startPreserveWidths}Mc(e){this.Pt=null,this.Lo(),e.didResize&&(Math.abs(this.st-e.startWidth)<.5?this.nl(e):this.e.r.Ee(e.column,this.st),this.e.ri()),this.Go(e.handle,!1);try{e.handle.releasePointerCapture?.(e.pointerId)}catch{}this.e.n.root.classList.remove("mach-root--resizing"),this.ol(e),e.didResize&&this.e.lt([e.column])}Sc(){let e=this.Pt;!e?.didResize||!this.e.r.Ee(e.column,this.st)||(this.e.ri(),this.$i(e),this.e.al(e.column,!1))}Ec(e){this.We=p("div","mach-column-resize-guide"),this.We.setAttribute("aria-hidden","true"),this.ii=p("span","mach-column-resize-label"),this.We.appendChild(this.ii),this.e.n.root.appendChild(this.We),this.$i(e)}$i(e){if(!this.We||!this.ii)return;let t=this.e.n.root,i=t.getBoundingClientRect(),r=e.handle.parentElement.getBoundingClientRect(),o=Math.max(0,Math.min(t.clientWidth,r.right-i.left-t.clientLeft)),s=Math.max(32,Math.min(t.clientWidth-32,o));this.We.style.left=`${o}px`,this.We.style.top=`${Math.max(0,r.top-i.top-t.clientTop)}px`,this.ii.style.left=`${s-o}px`,this.ii.textContent=`${Math.round(e.column.currentWidth)} px`}ol(e){e.handle.classList.remove("mach-header-resize--active"),this.We?.remove(),this.We=null,this.ii=null}sl(e,t){let i=Number.isFinite(t)?t:e.startX;return U(Math.max(1,e.startWidth+i-e.startX),{minWidth:e.column.minWidth??e.column.colDef.minWidth,maxWidth:e.column.colDef.maxWidth})}No(e){let t=this.Pt;return t&&e.pointerId===t.pointerId?t:null}Lo(){this.ie&&cancelAnimationFrame(this.ie),this.ie=0}Go(e,t){S(window,t,{pointermove:this.Wi}),S(window,t,{pointerup:this.ni,pointercancel:this.Yr,keydown:this.Fo},!0),S(e,t,{lostpointercapture:this.Ic})}destroy(){this.at(!1),this.Lo(),this.e.n.root?.classList.remove("mach-root--resizing")}};var Jr=6,yt=class{constructor(e){this.e=e;this.Ki=null;this.oi=null;this.Oo=!1;this.se=0;this.Xr=null;this.Wi=e=>{if(this.oi){this.Pc(e);return}let t=this.Ki;t&&(Math.abs(e.clientX-t.startX)<Jr&&Math.abs(e.clientY-t.startY)<Jr||this.Gc(e))};this.ni=e=>{this.Ki=null,e.type!=="pointercancel"&&this.oi&&this.Vo(e.clientX,e.clientY),this.Ho();let t=this.ll();t&&e.type!=="pointercancel"&&t.targetIndex>=0&&this.e.Ei(t.column.id,t.targetIndex)}}Ac(e,t){e.button===0&&t.movable&&(this.Ki={column:t,startX:e.clientX,startY:e.clientY},this.Ui(!0))}Ui(e){S(window,e,{pointermove:this.Wi,pointerup:this.ni,pointercancel:this.ni})}kc(){let e=this.Oo;return this.Oo=!1,e}Gc(e){let t=this.Ki;if(!t)return;let i=this.e.W.Gt(t.column.id,this.e.r.ge(t.column));if(!i||!i.parentElement){this.Ho();return}this.Oo=!0;let r=p("div","mach-drop-indicator"),o=p("div","mach-column-drag-ghost");o.textContent=t.column.colDef.headerName??t.column.colDef.field??t.column.id,o.ariaHidden="true",A(o,this.e.n.root),document.body.appendChild(o),i.parentElement.appendChild(r),i.classList.add("mach-header-cell--dragging"),this.e.n.root.classList.add("mach-root--dragging");let s=this.e.r.ge(t.column),a=this.e.n.si[s],l=this.e.r.R(s),d=new Float64Array(l.length+1),u=new Float64Array(l.length);for(let h=0;h<l.length;h++){let f=l[h].currentWidth;u[h]=d[h]+f/2,d[h+1]=d[h]+f}let c=o.getBoundingClientRect();this.oi={column:t.column,cellEl:i,ghost:o,indicator:r,targetIndex:-1,pane:s,containerLeft:a.getBoundingClientRect().left,startScrollLeft:this.e.n.b.center.scrollLeft,fromIndex:l.indexOf(t.column),midpoints:u,offsets:d,ghostWidth:c.width,ghostHeight:c.height},this.Vo(e.clientX,e.clientY)}Pc(e){this.Xr={clientX:e.clientX,clientY:e.clientY},!this.se&&(this.se=requestAnimationFrame(()=>{this.se=0;let t=this.Xr;this.Xr=null,t&&this.Vo(t.clientX,t.clientY)}))}Vo(e,t){let i=this.oi;if(!i)return;let r=T(e+12,8,window.innerWidth-i.ghostWidth-8),o=T(t+12,8,window.innerHeight-i.ghostHeight-8);i.ghost.style.transform=`translate3d(${r}px, ${o}px, 0)`;let s=i.pane==="center"?this.e.n.b.center.scrollLeft-i.startScrollLeft:0,a=e-(i.containerLeft-s),l=i.midpoints.length;for(let d=0;d<i.midpoints.length;d++)if(a<i.midpoints[d]){l=d;break}i.targetIndex=l>i.fromIndex?l-1:l,i.indicator.style.transform=`translate3d(${i.offsets[l]}px, 0, 0)`}ll(){let e=this.oi;return e?(this.oi=null,e.cellEl.classList.remove("mach-header-cell--dragging"),e.ghost.remove(),e.indicator.remove(),this.e.n.root.classList.remove("mach-root--dragging"),e):null}Ho(){this.Ui(!1),this.se&&cancelAnimationFrame(this.se),this.se=0,this.Xr=null}destroy(){this.Ho(),this.ll(),this.Ki=null}};var Si=/^[+-]?(?:\d+(?:\.\d+)?|\.\d+)(?:[eE][+-]?\d+)?$/;function vt(n,e=!0){if(n==="")return null;if(!e||typeof n!="string"||!Si.test(n)||/^[+-]?0\d/.test(n))return n;let t=Number(n);return Number.isFinite(t)&&(!Number.isInteger(t)||Number.isSafeInteger(t))?t:n}function Mi(n,e){let t=n==null?"":String(n);return t.includes(e)||t.includes('"')||t.includes(`
|
|
2
2
|
`)||t.includes("\r")?'"'+t.replace(/"/g,'""')+'"':t}function Ce(n){return typeof n!="string"||n===""||Si.test(n)?n:/^[\s\u0000-\u001f]*[=+\-@]/.test(n)?"'"+n:n}function Zr(n,e={}){let t=e.columnSeparator??",",i=e.protectFormulas??!0,r=n.map(o=>o.map(s=>Mi(i?Ce(s):s,t)).join(t)).join(`\r
|
|
3
3
|
`);return e.prependBOM?"\uFEFF"+r:r}function Qr(n){return n==null?"":String(n)}function Ts(n,e){return Mi(e?Ce(n):n," ")}function Ii(n,e=!0){return n.map(t=>t.map(i=>Ts(i,e)).join(" ")).join(`
|
|
4
4
|
`)}function Ai(n){return Pi(n," ")}function ki(n,e=","){return Pi(n,e)}function Pi(n,e){let t=[],i=[],r="",o=!1,s=0;for(;s<n.length;){let a=n[s];a==='"'&&(o||r==="")?o&&n[s+1]==='"'?(r+=a,s++):o=!o:o?r+=a:a===e?(i.push(r),r=""):a===`
|
package/package.json
CHANGED