@agile-team/mach-table 0.42.1 → 0.42.3
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/README.md +2 -0
- package/dist/adapter.cjs +1 -1
- package/dist/adapter.d.cts +2 -2
- package/dist/adapter.d.ts +2 -2
- package/dist/adapter.js +1 -1
- package/dist/analysis.cjs +2 -2
- package/dist/analysis.d.cts +2 -2
- package/dist/analysis.d.ts +2 -2
- package/dist/analysis.js +2 -2
- package/dist/{colDef-CrzNjIXe.d.cts → colDef-Bx4-qB_a.d.cts} +2 -0
- package/dist/{colDef-CrzNjIXe.d.ts → colDef-Bx4-qB_a.d.ts} +2 -0
- package/dist/{configuration-BOLDHb5S.d.ts → configuration-CRE4Ov9v.d.ts} +1 -1
- package/dist/{configuration-DUubqwfv.d.cts → configuration-DPWWTHFL.d.cts} +1 -1
- package/dist/import.d.cts +1 -1
- package/dist/import.d.ts +1 -1
- package/dist/index.cjs +4 -4
- package/dist/index.d.cts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +5 -5
- package/dist/mach-table.css +1 -1
- package/dist/multi-range.d.cts +1 -1
- package/dist/multi-range.d.ts +1 -1
- package/dist/ordering.cjs +1 -1
- package/dist/ordering.d.cts +1 -1
- package/dist/ordering.d.ts +1 -1
- package/dist/ordering.js +1 -1
- package/dist/preferences.d.cts +1 -1
- package/dist/preferences.d.ts +1 -1
- package/dist/server-side.cjs +1 -1
- package/dist/server-side.d.cts +1 -1
- package/dist/server-side.d.ts +1 -1
- package/dist/server-side.js +1 -1
- package/dist/{shared-CEihWWC5.d.ts → shared-CZHRvokM.d.ts} +1 -1
- package/dist/{shared-DBW62DHt.d.cts → shared-Dq_FMxwM.d.cts} +1 -1
- package/dist/workbench.cjs +1 -1
- package/dist/workbench.d.cts +3 -3
- package/dist/workbench.d.ts +3 -3
- package/dist/workbench.js +1 -1
- package/dist/worker.d.cts +2 -2
- package/dist/worker.d.ts +2 -2
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
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(`
|
|
2
|
-
`)||t.includes("\r")?'"'+t.replace(/"/g,'""')+'"':t}function
|
|
3
|
-
`);return e.prependBOM?"\uFEFF"+r:r}function
|
|
1
|
+
"use strict";var yi=Object.defineProperty;var Io=Object.getOwnPropertyDescriptor;var Ao=Object.getOwnPropertyNames;var ko=Object.prototype.hasOwnProperty;var Po=(n,e)=>{for(var t in e)yi(n,t,{get:e[t],enumerable:!0})},Go=(n,e,t,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of Ao(e))!ko.call(n,r)&&r!==t&&yi(n,r,{get:()=>e[r],enumerable:!(i=Io(e,r))||i.enumerable});return n};var Lo=n=>Go(yi({},"__esModule",{value:!0}),n);var nl={};Po(nl,{BUILTIN_AGG_FUNCS:()=>Oe,DEFAULT_LOCALE:()=>O,EVENT_TYPES:()=>jt,LOCALE_EN:()=>Or,actionsColumn:()=>Ur,advancedFilterCondition:()=>Sr,advancedFilterGroup:()=>Mr,applyGridViewState:()=>pr,buildColDefsFromSchema:()=>ho,captureGridViewState:()=>hr,clearGridState:()=>to,createActionButtonsRenderer:()=>Te,createAggResolver:()=>yt,createBusinessColumnTypes:()=>Do,createColumnHelper:()=>fo,createEnterprisePreset:()=>vo,createGrid:()=>ao,createGridViewManager:()=>So,createLocalGridStateStore:()=>ar,createLocalGridViewStore:()=>fr,createMachTableCommands:()=>po,createMachTablePreset:()=>cr,createProgressBarRenderer:()=>Pi,createRemoteExportRequest:()=>lo,createRowActionsRenderer:()=>ct,createStatusTagRenderer:()=>ki,defineColumns:()=>mo,defineGridOptions:()=>wo,defineMachTableConfig:()=>Co,defineMachTablePreset:()=>bo,describeFilter:()=>uo,downloadFile:()=>Ut,dragColumn:()=>Kr,escapeHtml:()=>pe,formatText:()=>z,formatTwo:()=>we,getByPath:()=>_,indexColumn:()=>ht,isColDefGroup:()=>be,isSafePath:()=>nt,linkRenderer:()=>Gi,loadGridState:()=>di,matchLocaleKey:()=>lt,normalizeAdvancedFilterModel:()=>F,normalizeColumnFilter:()=>ot,normalizeFilterModel:()=>te,normalizeGridState:()=>j,normalizeGridViewState:()=>gi,normalizeSavedGridView:()=>Me,parseCsv:()=>Mt,parseDelimited:()=>It,parseTsv:()=>St,resolveGridFeatures:()=>hi,resolveSaveConflict:()=>Fn,resolveTagVariant:()=>dt,rowActionsColumn:()=>jr,sanitizeFormulaCell:()=>ue,saveGridState:()=>li,selectionColumn:()=>$r,setByPath:()=>ge,toTsv:()=>Et,validateGridOptions:()=>ui,version:()=>rl});module.exports=Lo(nl);var je="0.42.3";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 S(n,e,t,i=!1){return x(n,t,i)??e}function M(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 E(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,Ye=new WeakMap;function Ie(n){let e=vi.get(n);return e||(e={},vi.set(n,e)),e}function bi(n){return vi.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 R(n,e,t,i=!1){let r=e?"addEventListener":"removeEventListener";for(let[o,s]of Object.entries(t))n[r](o,s,i)}function q(n,e,t){R(document,n,{mousedown:e,keydown:t},!0)}function K(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 Ze(n,e,t){K(n,t);let i='[aria-modal="true"],dialog[open]';(e.closest(i)??t?.closest(i)??document.body).appendChild(n)}function ee(n,e,t=4,i=!1){let r=n.style;r.left=r.top="0px",i&&(r.maxHeight="");let o=e.getBoundingClientRect(),s=n.getBoundingClientRect(),a=window.innerHeight-o.bottom-t-8,l=o.top-t-8,d=s.height>a&&l>a,u=Math.max(0,d?l:a),c=n.offsetHeight/s.height||1,h=i?Math.min(s.height,u):s.height;h<s.height&&(r.maxHeight=`${h*c}px`);let f=d?o.top-h-t:o.bottom+t,m=T(o.left,8,Math.max(8,window.innerWidth-s.width-8));r.left=`${(m-s.left)*(n.offsetWidth/s.width||1)}px`,r.top=`${(T(f,8,Math.max(8,window.innerHeight-h-8))-s.top)*c}px`}var br=0;function wr(n="rg"){return br++,`${n}-${br}`}var Cr='<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>',Tr='<svg viewBox="0 0 16 16" width="10" height="10" fill="currentColor"><path d="M8 3l4 5H4l4-5z"/></svg>',Dr='<svg viewBox="0 0 16 16" width="10" height="10" fill="currentColor"><path d="M8 13l4-5H4l4 5z"/></svg>',xr='<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 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 A(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 Rr(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 Fo(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 me(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 Oo(n,e,t,i){let r=i.colDef.cellStyle,o=Ie(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 Ho(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 Vo(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.yu(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(Fo(n,e,t,i,a,d)){Rr(n,e,t,i,r,o);return}A(n,e);try{l=a(d)}catch(u){n.reportError(u,"cellRenderer",{colId:i.id,rowId:t.id})}}else A(n,e);if(typeof l=="string")Ho(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=Ie(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="";Rr(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 Bo(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 _o(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)];Bo(n,r,t,i),_o(r,e,i);let o=r.join(" ");e.className!==o&&(e.className=o)}function et(n,e,t,i){Vo(n,e,t,i),Ci(n,e,t,i),Oo(n,e,t,i)}function Ae(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=Ae(e,String(n));return typeof t=="string"?{color:t}:t}var it=class{constructor(e){this.e=e;this.Qn="";this.eo=[];this.sa=0;this.Ci=!0}to(e){this.vu()&&(this.Ci=!0,e=void 0);let t=this.Ci?this.aa():void 0,i=t&&Wo(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.bu(s);if(o=s.minWidth!==a||o,s.minWidth=a,zo(s)){let l=this.la(s,t);o=l!==s.contentWidth||o,s.contentWidth=l}}return this.Ci=!1,o&&(this.e.r.Xe=!1),o}vu(){let e=Array.from(document.fonts??[]).filter(s=>s.status==="loaded"),t=e.length!==this.eo.length||e.some((s,a)=>s!==this.eo[a]);t&&(this.eo=e,this.sa++);let i=getComputedStyle(this.e.n.root),r=`${i.getPropertyValue("--mach-header-font-weight")||650} ${i.fontSize} ${i.fontFamily}`,o=r!==this.Qn||t;return this.Qn=r,o}aa(){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))])}ro(e,t){return this.wi===void 0&&(this.wi=p("canvas").getContext("2d")),this.wi?(this.wi.font=t??this.Qn,this.wi.measureText(e).width):t?1/0:e.replace(/[^\x00-\xff]/g,"mm").length*7}bu(e){let t=e.colDef,i=t.headerName??t.field??e.id;return Math.ceil(Math.max(t.minWidth??0,this.ro(i)+i.length*.15+28+(e.sortable?20:0)+(e.filterable?28:0)+(this.e.t.columnMenu&&!e.hasCheckbox&&!t.suppressColumnMenu?22:0)))}la(e,t=this.aa()){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.ro(s.slice(0,128))+(e.colDef.status?44:28))}return Math.ceil(Math.min(M(e.colDef.maxWidth)??360,i))}};function zo(n){let{width:e,autoWidth:t}=n.colDef;return n.manualWidth==null&&e==null&&t!==!1&&!n.hasCheckbox&&!n.isDetailToggle}function Wo(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.wu=e;this.Tr=new Map}on(e,t){let i=this.Tr.get(e);return i||(i=new Set,this.Tr.set(e,i)),i.add(t),()=>{i.delete(t)}}emit(e,t){let i=this.Tr.get(e);if(i)for(let r of[...i])try{r(t)}catch(o){console.error(`[mach-table] error in "${e}" listener`,o),this.wu?.(o,e)}}clear(){this.Tr.clear()}};var $o=new Set(["__proto__","prototype","constructor"]),ke=new Map;function Ti(n){if(typeof n!="string"||n.length===0)return null;let e=ke.get(n);if(e!==void 0)return e;let t=n.split("."),i=t.every(r=>r.length>0&&!$o.has(r))?t:null;return n.length<=1024&&(ke.size>=256&&ke.delete(ke.keys().next().value),ke.set(n,i)),i}function nt(n){return Ti(n)!==null}function _(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 ge(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 ye={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 Ko=16,Uo=512,jo=20,qo=2e3,Yo=2e3,Xo={text:new Set(ye.text),number:new Set(ye.number),date:new Set(ye.date)};function Jo(n){return n==null||typeof n=="string"||typeof n=="number"&&Number.isFinite(n)}function Zo(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,...Qo(i,e)}}function Qo(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 es(n,e){let t=[],i=Xo[e];for(let r of n.slice(0,jo)){let o=Zo(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,qo)}: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:es(e.conditions,e.type)}}function ts(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 is(n,e,t){if(!Array.isArray(n.children))return null;let i=[];for(let r of n.children){let o=Er(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 rs(n,e,t){return e<=Ko&&t.nodes<Uo&&n!=null&&typeof n=="object"}function Er(n,e,t){if(!rs(n,e,t)||t.ancestors.has(n))return null;t.ancestors.add(n),t.nodes++;let i=n,r=i.kind==="condition"?ts(i,t):i.kind==="group"?is(i,e,t):null;return t.ancestors.delete(n),r}function F(n,e){if(n==null||typeof n!="object")return null;let t=n;if(t.version!==1||t.root==null)return null;let i=Er(t.root,0,{ancestors:new WeakSet,nodes:0,validColumnIds:e});return i?{version:1,root:i}:null}function Sr(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,Yo)){let o=i.trim();if(!o||e?.has(o)===!1)continue;let s=ot(r);s&&(t[o]=s)}return t}function Mr(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},Pe={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}},Ge={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},ns=Object.keys(Ge);function os(n){let e={};for(let t of ns)e[t]=n[t]??Ge[t];return e}function ss(n){return n&&v(Pe,n)?n:"normal"}function as(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=>S(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):_(e,n);return t==null?"":String(t)}function ls(n,e){let t=Pe[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:S(n.rowHeight,t.rowHeight,1),detailRowHeight:S(n.detailRowHeight,240,1),headerHeight:S(n.headerHeight,t.headerHeight,1),rowBuffer:S(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 ds(n){let e=typeof n.pagination=="object"?n.pagination:void 0,t=S(e?.pageSize,20,1,!0);return{paginationEnabled:n.pagination!==!1&&n.datasource==null,paginationMode:e?.mode==="server"?"server":"client",paginationPage:S(e?.page,1,1,!0),paginationTotal:S(e?.total,0,0,!0),paginationPageSize:t,paginationPageSizeOptions:as(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 us(n){return{advancedFilterModel:F(n.advancedFilterModel),persistence:qe(n.persistence),locale:n.locale??{},tooltipShowDelay:S(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 Ar={blockSize:100,maxBlocksInCache:12,datasourceMaxConcurrentRequests:4},kr={infiniteBufferRows:40,blockPrefetch:1,datasourceRetryCount:2,datasourceRetryDelay:300},cs=Object.keys(Ar),hs=Object.keys(kr);function Ir(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=Ir(n,e,cs,1);Ir(n,e,hs,0);let i=x(n.datasourceRetryJitter,0);return i!==void 0&&(e.datasourceRetryJitter=Math.min(1,i)),t}function ps(n){let e={...Ar,...kr,datasourceRetryJitter:.15};return Ei(n,e),{...e,datasourceMode:n.datasourceMode==="block"?"block":"sequential",datasourceRowCount:n.datasourceRowCount==null?null:S(n.datasourceRowCount,0,0,!0),dataProcessorMinRows:S(n.dataProcessorMinRows,5e3,1,!0)}}var fs=["detailRowRenderer","isRowExpandable","aggFuncs","components","actionPolicy","summaryMethod","datasource","getRowHeight","tooltipComponent","getContextMenuItems","initialState","rowEditValidator","isTreeRowExpandable","loadTreeChildren","dataProcessor"];function Pr(n){let e=ss(n.size),t={...os(n),...ls(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:S(n.undoStackSize,100,0,!0),asyncTransactionWaitMillis:S(n.asyncTransactionWaitMillis,16,0,!0),...ds(n),...Ri(n),...us(n),...ps(n),features:Array.isArray(n.features)?n.features:[]};for(let i of fs)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 Gr(n){return Array.isArray(n)?n.filter(e=>typeof e=="string"&&e.length>0):typeof n=="string"&&n.length>0?[n]:[]}function ve(n,e){return Gr(n.type).includes(e)}function Lr(n,e,t={}){let i=n.checkboxSelection||n.rowDrag||ve(n,"index")?{resizable:!1,suppressSizeToFit:!0}:{};for(let o of Gr(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=M(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 be(n){return Array.isArray(n.children)}var Le=150,ms=80;function U(n,e){let t=M(e.minWidth)??ms,i=M(e.maxWidth)??Number.MAX_SAFE_INTEGER,r=M(n)??M(e.width)??Le;return Math.max(t,Math.min(i,r))}function gs(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 Nr(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)&&gs(n,i,r,t?[...i]:n.map(o=>o.flex??0)),i}function Fr(n,e){return Nr(n,e,!1)}function at(n,e){return Nr(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"/>',le={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 O={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",columnFilter:"\u7B5B\u9009",columnFilterActive:"\u7B5B\u9009\u5DF2\u751F\u6548",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"},Or={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",columnFilter:"Filter",columnFilterActive:"Filter active",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"},ys={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 ys[n]??"matchEquals"}function z(n,e){return n.replace("{n}",String(e))}function we(n,e,t){return n.replace("{a}",String(e)).replace("{b}",String(t))}var vs=[[/^(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=Ae(e,i);if(r)return r;let o=Ae(e,i.toLowerCase());if(o)return o}for(let[r,o]of vs)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??Ae(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,H=null;function Hr(n){H&&n.contains(H)&&Z()}function Z(n=!1){oe?.remove(),oe=null,H&&(H.setAttribute("aria-expanded","false"),n&&H.isConnected&&H.focus({preventScroll:!0})),H=null,document.removeEventListener("mousedown",Vr,!0),document.removeEventListener("keydown",Li,!0)}function Vr(n){oe&&!oe.contains(n.target)&&!H?.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 Br(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&&le[n.icon]?(t.innerHTML=J(le[n.icon],16),t.appendChild(p("span")).textContent=n.label):t.textContent=n.label,t.addEventListener("click",()=>n.pick(t)),t}function bs(n,e){Z();let t=p("div","mach-context-menu mach-action-menu");t.setAttribute("role","menu");for(let i of e){let r=Br(i,"mach-context-menu-item");r.setAttribute("role","menuitem"),t.appendChild(r)}K(t,n.closest(".mach-root")),document.body.appendChild(t),ee(t,n),oe=t,H=n,n.setAttribute("aria-expanded","true"),document.addEventListener("mousedown",Vr,!0),document.addEventListener("keydown",Li,!0),t.querySelector("button:not(:disabled)")?.focus({preventScroll:!0})}function ws(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(le.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(Br(d,"mach-action-drawer__item"));r.append(o,l),i.appendChild(r),i.addEventListener("mousedown",d=>{d.target===i&&Z(!0)}),K(i,n.closest(".mach-root")),document.body.appendChild(i),oe=i,H=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 _r(n){return n.variant??"default"}function zr(n){return n.permission?typeof n.permission=="string"?[n.permission]:n.permission:[]}function Ni(n,e,t){return{...n.id?{actionId:n.id}:{},permissions:zr(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 Cs(n,e){if(zr(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 Ts(n,e){return n.filter(t=>{if(!Cs(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 Ds(n,e,t,i){Promise.resolve(n).catch(r=>ut(r,e,t)).finally(()=>Fi(e,t,i))}function xs(n,e,t){try{Ds(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 Rs(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 Es(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){xs(e,n,t);return}(async()=>{await Rs(e,n)&&await e.onClick(n)})().catch(r=>ut(r,e,n)).finally(()=>{Fi(e,n,t)})}}function Ss(n,e,t){let i=p("button","mach-action-btn");i.type="button";let r=_r(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&&le[n.icon]?(i.innerHTML=J(le[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 Ms(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??O.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(le.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:_r(u),disabled:ne(u.disabled,i)||ne(u.loading,i),pick:c=>{Z(),r(u,c)}}));e==="drawer"?ws(o,t.drawerTitle??a,d):bs(o,d)}),o}function Te(n){let e=Math.max(0,n.max??3),t=n.overflow??"menu";return i=>{let r=Ts(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=Es(i);for(let d of s)o.appendChild(Ss(d,i,l));return a.length>0&&o.appendChild(Ms(a,t,n,i,l)),{el:o,destroy:()=>{H&&o.contains(H)&&Z()}}}}function Ce(n,e,t){return n??e??t}function Is(n,e){let t=e.api.getOption("locale")??{};return{view:Ce(n.labels?.view,t.actionView,O.actionView),edit:Ce(n.labels?.edit,t.actionEdit,O.actionEdit),delete:Ce(n.labels?.delete,t.actionDelete,O.actionDelete),confirm:Ce(n.labels?.confirm,t.actionConfirm,O.actionConfirm),save:Ce(n.labels?.save,t.actionSave,O.actionSave),cancel:Ce(n.labels?.cancel,t.actionCancel,O.actionCancel)}}function As(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 Te({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 ks(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=Is(n,e);if(e.api.editing.isRowActive(e.rowIndex))return As(n,e,t);let i=ks(n,e,t);return Te({actions:i,max:n.max,overflow:n.overflow??"menu",moreLabel:n.moreLabel,drawerTitle:n.drawerTitle})(e)}}var Ps=ki(),Gs=Pi(),Wr=Object.freeze({statusTag:Ps,progressBar:Gs,link:Gi});var Ne={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,...Ne,...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",...Ne,...n}}function Kr(n={}){let e=n.width??40;return{colId:"drag",headerName:"",rowDrag:!0,width:e,minWidth:n.minWidth??e,maxWidth:n.maxWidth??e,pinned:"left",...Ne,...n}}function Ur(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:Te(i),...Ne,cellRendererParams:void 0}}function jr(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),...Ne,cellRendererParams:void 0}}var Oi="__rg_detail_toggle__";function Fe(n){return M(n)!==void 0}function Yr(n){return n===!0?"left":n||null}function qr(n,e){let t=e;for(let i=2;n.has(t);i++)t=`${e}_${i}`;return n.add(t),t}function Ls(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!==(M(t.flex)??null))&&(n.flex=e.flex),e.hide!==(t.hide??!1)&&(n.hide=e.hide),e.pinned!==Yr(t.pinned)&&(n.pinned=e.pinned)}var pt=class{constructor(e){this.e=e;this.X=[];this.Dr=new Map;this.fe=[];this.no=[];this.xr=[];this.oo=[];this.me=[];this.Rr=[];this.wt=new Map;this.jt=1;this.so=new Map;this.da=0;this.Xe=!1}Ti(e){this.Rr=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(be(f)){let N=f.groupId??f.headerName??`group_${m}_${h}`,W=new re(N,f);return W.parent=c,W.children=a(f.children,W,h+1),W}let g=f,w=qr(o,g.colId??g.field??`col_${m}`),y=new ie(w,Lr(g,i,this.e.t.columnTypes));s&&(s=!ve(y.colDef,"index")),y.parentGroup=c,y.level=h;let V=t.get(w);return V&&!V.isAutoRowNumber&&Ls(y,V),y});if(this.fe=a(this.Rr,null,0),s&&o.size>Number(r)&&this.Cu(qr(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.wt.size&&this.Tu(),this.X=this.Er(this.fe),this.Dr=new Map(this.X.map(u=>[u.id,u])),this.jt=this.X.reduce((u,c)=>Math.max(u,c.level+1),1);let l=this.me.length;this.me=this.me.filter(u=>this.Dr.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.qt(),d}Cu(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)}Er(e,t=[]){for(let i of e)i instanceof re?this.Er(i.children,t):t.push(i);return t}qt(){this.Xe=!1;let e=this.X.filter(t=>!t.hide);this.no=e.filter(t=>t.pinned==="left"),this.oo=e.filter(t=>t.pinned==="right"),this.xr=e.filter(t=>t.pinned===null),this.so.clear(),this.l().forEach((t,i)=>this.so.set(t.id,i))}J(e){return this.so.get(e)??-1}Z(){return this.X}ao(){return this.Rr}Du(){return this.fe}xu(){return this.jt}D(e){return this.Dr.get(e)}x(e){return e==="left"?this.no:e==="right"?this.oo:this.xr}l(){return[...this.no,...this.xr,...this.oo]}Je(){return this.l().filter(e=>e.colDef.rowGroup===!0)}Ru(){return this.l().filter(e=>e.colDef.aggFunc!=null&&e.colDef.rowGroup!==!0)}ua(){let e=this.l();return this.xr.find(X)??e.find(X)??e[0]}ge(e){return e.pinned==="left"?"left":e.pinned==="right"?"right":"center"}ca(e){let t=this.e.n.ye.clientWidth,i=this.Xe&&t===this.da;this.da=t;let r=e,o=[],s=[];for(let l of this.l()){let d=this.Sr(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"?at(s,Math.max(0,r)):Fr(s,Math.max(0,r));o.forEach((l,d)=>{l.currentWidth=a[d]})}Sr(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 Fe(t)?(this.Xe=!0,e.manualWidth=U(t,this.Sr(e)),e.flex=null,!0):!1}ha(e,t){return Fe(t)?(this.Xe=!1,e.resetWidth(),e.contentWidth=U(t,this.Sr(e)),!0):!1}lo(e,t){let i=this.D(e);!i||i.hide===!t||(i.hide=!t,this.qt())}Di(e,t){let i=this.D(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.wt.set(this.pa(i),a.filter(c=>c.movable).map(c=>c.id)),this.X=this.Er(this.fe),this.qt(),!0}uo(e,t){let i=this.D(e);!i||!i.movable||(i.pinned=t,this.qt())}fa(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}))}ma(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.Eu(i,r)}this.Su(e),this.qt()}Eu(e,t){typeof t.hide=="boolean"&&(e.hide=t.hide),t.widthMode==="auto"?(e.resetWidth(),Fe(t.flex)&&(e.flex=t.flex)):Fe(t.flex)?(e.flex=t.flex,e.manualWidth=null):this.Ee(e,t.width),Fe(t.contentWidth)&&(e.contentWidth=U(t.contentWidth,this.Sr(e))),e.movable&&(t.pinned==="left"||t.pinned==="right"||t.pinned===null)&&(e.pinned=t.pinned)}Su(e){let t=new Map(e.map((i,r)=>[i.colId,r]));this.co(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.wt.set(r,i.map(s=>s.id))}),this.X=this.Er(this.fe)}pa(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)}Tu(){let e=new Map;this.co(t=>t.movable,(t,i)=>{let r=this.wt.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.wt=e}co(e,t,i=this.fe){let r=new Map;i.forEach((o,s)=>{if(o instanceof re)this.co(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.pa(s[0])),o.forEach((a,l)=>{i[a]=s[l]})}}ho(){for(let e of this.X)e.resetWidth(),e.hide=e.colDef.hide??!1,e.pinned=Yr(e.colDef.pinned);if(this.wt.size){this.wt.clear(),this.Ti(this.Rr);return}this.qt()}Q(){return this.me.map(e=>({...e}))}xi(e){if(!e||e.length===0){this.me=[];return}this.me=e.filter(t=>this.Dr.has(t.colId)&&(t.direction==="asc"||t.direction==="desc")).map(t=>({colId:t.colId,direction:t.direction}))}Mr(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 I(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 Ns=()=>se(void 0,"[MachTable] Operation cancelled.");function ft(n,e,t=Ns){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 Xr(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 Fs(n,e,t){let i=Xr(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 Jr(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 Os(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:Jr(i,r,e.match,e.value2??r)}function Hs(n,e,t){return Vi(e,t,r=>Os(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 Vs(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 Jr(i,a,o.match,l)})}function Bs(n,e){return e.length===0?!0:e.some(t=>t==null&&n==null||t===n)}function _s(n,e){let t=e.type!=="set"&&e.operator==="or"?"or":"and";switch(e.type){case"text":return Fs(n,e.conditions,t);case"number":return Hs(n,e.conditions,t);case"date":return Vs(n,e.conditions,t);case"set":return Bs(n,e.values);default:return!0}}function Zr(n,e,t){return i=>_s(t(i,n),e)}function Qr(n,e,t){if(n.kind==="condition"){let r=e.get(n.colId);return r?Zr(r,n.filter,t):()=>!0}let i=n.children.map(r=>Qr(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?[Zr(u,d,r)]:[]});t&&s.push(Qr(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=>Xr(r(l,u)).includes(d)))}var en=typeof Intl<"u"?new Intl.Collator(void 0,{numeric:!0,sensitivity:"base"}):null;function zs(n,e){let t=n==null||n==="",i=e==null||e==="";return!t&&!i?null:t&&i?0:t?1:-1}function Ws(n,e){let t=Number.isNaN(n),i=Number.isNaN(e);return t||i?t===i?0:t?1:-1:n-e}function $s(n,e){return n===e?0:n?1:-1}function mt(n,e){let t=zs(n,e);if(t!==null)return t;if(typeof n=="number"&&typeof e=="number")return Ws(n,e);if(n instanceof Date&&e instanceof Date)return n.getTime()-e.getTime();if(typeof n=="boolean"&&typeof e=="boolean")return $s(n,e);let i=String(n),r=String(e);return en?en.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 tn(){return{count:0,numeric:0,sum:0,min:1/0,max:-1/0}}function rn(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 nn(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=tn();for(let i of n)rn(t,i);return nn(t,e)}var Oe={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 on(n,e,t){if(e===Oe.count)return n.length;let i=["sum","avg","min","max"].find(o=>e===Oe[o]);if(!i)return e(n.map(t));let r=tn();for(let o of n)rn(r,t(o));return nn(r,i)}function yt(n){let e={...Oe,...n??{}};return t=>e[t]}var vt="group:";function sn(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 an(n){return vt+JSON.stringify(n)}function Ks(n,e,t){let i=new Map;for(let r of n){let o=t(r,e),s=sn(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 ln(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 Ks(a,e[l],t)){let f=[...d,[e[l].id,h.key]],m=an(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 w of g.display)u.push(w);if(l>0)for(let w of g.leaves)c.push(w)}return{display:u,leaves:c}};return{rows:s(n,0,[]).display,ids:o}}function dn(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,sn(h)]),u+=`/g${c}:${zi(h)}`,!r.has(u))continue;let f=an(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 Us(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 un(n){let e=new Set(Object.keys(n.filterModel));Us(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 cn(n){return n!=null&&(typeof n=="object"||typeof n=="function")}function hn(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=>_(i.data,o));r.some(cn)||t.set(i,r)}return t}function pn(n,e,t,i){return t.length?!i||n===e||n==null||e==null?!0:t.some((r,o)=>{let s=_(e,r);return cn(s)||!Object.is(i[o],s)}):!1}function de(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.go=t;this.maxConcurrentRequests=i;this.ee=new Map;this.j=new Map;this.ga=0;this.po=0;this.fo=0;this.ya=0;this.va=0;this.Ir=0;this.Ar=new Set;this.maxBlocks=bt(e),this.maxConcurrentRequests=bt(i)}configure(e,t=this.maxConcurrentRequests){this.maxBlocks=bt(e),this.maxConcurrentRequests=bt(t),this.mo(),this.kr()}Mu(e){this.Ar=e,this.mo()}peek(e){let t=this.ee.get(e);if(t)return t.touchedAt=++this.ga,t}has(e){return this.ee.has(e)}Yt(e){let t=this.j.get(e);t&&(this.j.delete(e),t.controller.abort(),t.state==="queued"&&t.reject(de(t.controller.signal)));let i=this.ee.get(e);i&&(this.ee.delete(e),this.go?.(e,i))}load(e,t,i,r=0){if(i?.aborted)return Promise.reject(de(i));let o=this.peek(e);if(o)return this.fo++,Promise.resolve(o);let s=this.j.get(e);if(s)return this.fo++,s.priority=Math.max(s.priority,r),this.kr(),this.ba(e,s,i);this.ya++;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.ba(e,c,i);return this.kr(),h}Iu(){this.po++,this.Ar.clear();for(let e of this.j.values())e.controller.abort(),e.state==="queued"&&e.reject(de(e.controller.signal));this.j.clear();for(let[e,t]of this.ee)this.go?.(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.fo,missCount:this.ya,evictionCount:this.va}}kr(){for(;this.Ir<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.Au(e,t)}}Au(e,t){t.state="active",this.Ir++;let i=this.po;this.ku(t).then(r=>{i===this.po&&!t.controller.signal.aborted&&(this.ee.set(e,{rows:r.rows,...r.lastRow==null?{}:{lastRow:r.lastRow},touchedAt:++this.ga}),this.mo()),t.resolve(r)},t.reject).finally(()=>{this.Ir=Math.max(0,this.Ir-1),this.j.get(e)===t&&this.j.delete(e),this.kr()})}ku(e){let{signal:t}=e.controller;return ft(Promise.resolve().then(()=>{if(t.aborted)throw de(t);return e.loader(t)}),t,()=>de(t))}ba(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(de(t.controller.signal))),o(de(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")))))})}mo(){let e=Math.max(this.maxBlocks,this.Ar.size+1);for(;this.ee.size>e;){let t=-1,i=Number.POSITIVE_INFINITY;for(let[o,s]of this.ee)this.Ar.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.va++,r&&this.go?.(t,r)}}};function De(n,e){if(n==null||typeof n!="object")return;let t=n[e];return Array.isArray(t)?t:void 0}function xe(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=De(r,e);o?.length&&(i.add(r),xe(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.I=new Set;this.z=new Set;this.Ri=[];this.Ei=new Map;this.wa=[];this.A=null;this.Si=!1;this.Ca=!1;this.Ze=0;this.Pr=null;this.Gr=new WeakMap;this.Lr=new WeakMap;this.Qe=new Map;this.Mi=new Map;this.Nr=0;this.Fr=0;this.et=null;this.tt=new Map;this.Ct=new Map;this.Or=new Set;this.Tt=new Map;this.it=new wt(12,e=>this.Ta(e));this.Ii=0;this.Hr=null;this.yo=!1;this.Da=0;this.we=[];this.V=1;this.Me=F(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 S(){return this.e.t.treeData}get g(){return this.e.t.datasource!=null}get be(){return this.g&&this.e.t.datasourceMode==="block"}Ai(){if(this.g){if(this.be)return this.Xt();let e=Math.max(0,this.ve.length-this.c.length);return(this.A??this.c.length)+e}return this.ve.length}ki(){return this.Nr}Ve(){return this.Fr}Pu(){return this.Ca}Vr(e){return!this.g||e?.aborted?Promise.resolve():(this.xa(!0),this.be?(this.it.configure(this.e.t.maxBlocksInCache,this.e.t.datasourceMaxConcurrentRequests),this.Br(0,e)):this.Ra(0,void 0,e))}Dt(e){this.Ca=e,this.e.n.Dt(e,this.e.u("loading"))}Ra(e,t,i){if(!this.g||this.Si||this.A!=null&&e>=this.A)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.Pr=a,this.Si=!0,this.Dt(!0),new Promise(d=>{let u=c=>{i?.removeEventListener("abort",l),s===this.Ze&&(this.Si=!1,this.Pr=null,this.Dt(!1),c!=null&&c?.name!=="AbortError"&&this.e.reportError(c,"datasource.getRows",{startRow:e,endRow:o})),d()};this.Ea(e,o,a.signal,(c,h)=>{if(s!==this.Ze||this.e.o()||a.signal.aborted){u();return}typeof h=="number"&&h>=0?this.A=h:c.length<o-e&&(this.A=e+c.length);let f=this.c.length===0;this.Gu(c),u(),this.F(),f&&this.e.Ie(),this.e.W._r()},c=>u(a.signal.aborted||this.e.o()?void 0:c??new Error("Datasource request failed")))})}vo(){this.Ze++,this.Pr?.abort(),this.Pr=null,this.Si=!1,this.Dt(!1),this.it.Iu(),this.tt.clear(),this.Ct.clear(),this.Or.clear();for(let[e,t]of this.Tt)this.p.get(e)===t&&this.p.delete(e);this.Tt.clear()}Gu(e){for(let t of e){if(t==null)continue;let i=this.c.length,r=this.resolveRowId(t,i,`inf-${this.e.Jt()}`);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.zr(r)};this.c.push(o),this.p.set(r,o),this._.push(o)}}Br(e,t,i=0){if(!this.be||e<0)return Promise.resolve();if(t?.aborted)return Promise.reject(this.Sa(t.reason));let r=this.e.t.blockSize,o=this.Ze,s=e*r;if(s>=this.Xt())return Promise.resolve();let a=this.A==null?s+r:Math.min(this.A,s+r),l=this.it.load(e,d=>this.Lu(s,a,d),t,i);return this.Dt(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.Or.has(e)||(this.Nu(e,d),this.F(),this.e.W._r(),o===this.Ze&&!this.e.o()&&this.Ma(this.e.s.bo().lastExcl-1))}).catch(d=>{throw d?.name!=="AbortError"&&this.e.reportError(d,"datasource.getRows",{startRow:s,endRow:a}),d}).finally(()=>{o===this.Ze&&this.Dt(this.c.length===0&&this.it.snapshot().loadingBlockCount>0)})}Lu(e,t,i){return new Promise((r,o)=>{this.Ea(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")))})}Ea(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.Sa(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.Pi(),quickFilterText:this.He,signal:i,onSuccess:(w,y)=>{!f&&u()&&r(w??[],y)},fail:m});g&&typeof g.catch=="function"&&g.catch(m)}catch(g){m(g)}};h()}Nu(e,t){let i=this.e.t.blockSize,r=e*i;this.Ta(e),typeof t.lastRow=="number"&&t.lastRow>=0?this.A=t.lastRow:t.rows.length<i&&(this.A=r+t.rows.length),t.rows.forEach((o,s)=>{if(o==null)return;let a=r+s;if(this.A!=null&&a>=this.A)return;let l=this.resolveRowId(o,a,`block-${a}`),d=this.Tt.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.zr(l)};c.rowIndex=a,c.selected=this.e.f.zr(l),this.Tt.delete(l),this.tt.set(a,c),this.Ct.delete(a),this.p.set(l,c),this.Lr.set(c,a+1)}),this.Ia(),this.Or.add(e)}Ta(e){this.Or.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.k.getDirtyRowIds())),this.tt.delete(o),r.has(s.id)?this.Tt.set(s.id,s):this.p.get(s.id)===s&&this.p.delete(s.id))}this.Ia()}Ia(){this.c=[...this.tt.entries()].sort(([e],[t])=>e-t).map(([,e])=>e),this._=this.c}Xt(){if(this.A!=null)return this.A;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}Fu(e){let t=this.Ct.get(e);if(!t&&(t={id:`__mach_loading_${e}`,data:null,rowIndex:e,selected:!1,loading:!0},this.Ct.set(e,t),this.Ct.size>2e3)){let i=this.Ct.keys().next().value;i!=null&&this.Ct.delete(i)}return t}Sa(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)))}Ou(e){if(this.be){this.Ma(e);return}if(!this.g||this.Si)return;let t=this.c.length;if(this.A!=null&&t>=this.A)return;let i=this.e.t.infiniteBufferRows;if(e+i<t&&e<t)return;let r=this.e.t.blockSize,o=this.A==null?t+r:Math.min(this.A,t+r);this.Ra(t,o)}Ma(e){if(e<0)return;this.Aa();let t=this.e.t.blockSize,i=Math.floor(e/t),r=Math.floor(this.e.s.bo().first/t),o=this.e.t.blockPrefetch,s=i<this.Da?-1:1;this.Da=i;for(let a=r;a<i;a++)this.Br(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.Xt()||this.Br(d,void 0,o-a+1).catch(()=>{})}}ka(){return this.Vr().catch(()=>{})}Hu(){return this.vo(),this.g?this.Vr().catch(()=>{}):(this.A=null,this.rt(this.e.t.rowData),this.e.$({data:!0}),Promise.resolve())}destroy(){this.et=null,this.vo(),this.Pa(),this.wo(),this.c=this._=this.ve=this.we=[],this.p.clear(),this.te.clear(),this.Ei.clear(),this.wa=[],this.I.clear(),this.z.clear(),this.Ri=[]}Co(e,t,i){if(!this.be)return Promise.resolve();this.Aa();let r=this.e.t.blockSize,o=Math.max(0,Math.trunc(e)),s=Math.min(this.Xt(),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.Br(u,i,100));return Promise.all(d).then(()=>{})}Vu(){this.be&&this.xa(!1)}xa(e){this.Ga(),this.e.k.clear(),this.vo(),e&&(this.A=null,this.I.clear()),this.c=[],this._=[],this.p.clear(),this.e.H.clear(),this.F()}Ga(){this.Fr++,this.e._e(),this.e.api.editing.stop({cancel:!0})}Bu(){return this.it.snapshot()}Aa(){let e=new Set(this.e.k.getDirtyRowIds());for(let[l,d]of this.Tt)e.has(l)||(this.Tt.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.bo();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._u();a!=null&&i.add(Math.floor(a/t)),this.it.Mu(i)}rt(e){let t=this.e.t.resolveRowId,i=this.e.t.childrenKey;this.S&&xe(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.S?De(u,i):void 0,w={id:m,data:u,rowIndex:-1,selected:!1,treeChildrenLoaded:Array.isArray(g)};if(this.Gr.set(w,c),r.push(w),s.set(m,w),h!=null){let y=a.get(h)??[];y.push(m),a.set(h,y)}else o.push(w);if(this.S&&Array.isArray(g))for(let y of g)y!=null&&d(y,c+1,m);return w};(e??[]).forEach(u=>{u!=null&&d(u,0,null)}),this.e.t.rowData=e??[],this.Ga(),this.Pa(),this.e.k.clear(),this.c=r,this._=o,this.te=a,this.p=s,this.e.H.clear();for(let u of[...this.I])s.has(u)||this.I.delete(u);if(this.e.t.defaultExpandAll)for(let u of r)this.La(u.id)>0&&this.I.add(u.id);this.e.f.Na(t!=null),this.Wr()}Gi(e){return this.te.get(e)??[]}La(e){return this.te.get(e)?.length??0}To(e){return this.La(e)>0}isTreeRowLoading(e){return this.p.get(e)?.treeLoading===!0}Pa(){for(let e of this.Qe.values())e.abort();this.Qe.clear(),this.Mi.clear()}loadTreeChildren(e,t=!1){let i=this.p.get(e),r=this.e.t.loadTreeChildren;if(!this.S||!i?.data||!r)return Promise.resolve([]);if(!t&&i.treeChildrenLoaded)return Promise.resolve(this.Gi(e).flatMap(l=>{let d=this.p.get(l)?.data;return d==null?[]:[d]}));let o=this.Mi.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.zu(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.Mi.delete(e),i.treeLoading=!1,this.e.$({data:!0}))});return this.Mi.set(e,a),a}zu(e,t){let i=new Set,r=[...this.Gi(e.id)];for(;r.length>0;){let s=r.pop();i.has(s)||(i.add(s),r.push(...this.Gi(s)))}this.Wu(t,i,this.$r(e)+1);for(let s of i)this.Qe.get(s)?.abort(),this.Qe.delete(s),this.Mi.delete(s),this.te.delete(s),this.p.delete(s),this.I.delete(s);this.te.delete(e.id);let o=this.$r(e)+1;for(let s of t)s!=null&&this.Do(e,s,o);this.Fa(),this.e.f.Na(this.e.t.resolveRowId!=null),this.F()}Wu(e,t,i){xe(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=De(l,this.e.t.childrenKey);d&&s.push(...d)}}Li(e,t=!0){this.S&&e.add?.length&&xe(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.Jt()}`)];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.S?De(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.Jt()}`)):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.Oa(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.Jt()}`);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.Gr.set(h,0);let f=this.S?De(d,this.e.t.childrenKey):void 0;if(f)for(let m of f)m!=null&&this.Do(h,m,1);l.push(h)}),this._=this._.slice(0,a).concat(l,this._.slice(a)),this.Fa()}let s={pipelineChanged:this.$u(e,r),updatedRowIds:r.map(({node:a})=>a.id)};return this.e.H.Ku(o),this.Uu(s,t),this.e.k.ju(o),s}Uu(e,t){e.pipelineChanged&&(this.et=null),t&&(e.pipelineChanged?this.Wr():e.updatedRowIds.length&&this.Ha())}qu(e){if(e.length===0)return{pipelineChanged:!1,updatedRowIds:[]};let t=this.Fr,i=!1,r=new Set;for(let o of e){let s=this.Li(o,!1);if(this.Fr!==t)return{pipelineChanged:!1,updatedRowIds:[]};i||(i=s.pipelineChanged);for(let a of s.updatedRowIds)r.add(a)}return i?this.Wr():r.size>0&&this.Ha(),{pipelineChanged:i,updatedRowIds:[...r]}}$u(e,t){if(e.add?.length||e.remove?.length)return!0;if(!t.length)return!1;let i=this.Va();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})=>pn(s,a,i,r.values.get(o)))}Va(){if(this.S||this.e.t.masterDetail||this.Ba())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 un({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})}Yu(){let e=this.Va(),t=e?.length?hn(this.c,e):null;this.et=e&&t?{fields:e,values:t}:null}Ha(){this.e.emit("modelUpdated",{rowCount:this.we.length})}Do(e,t,i){let r=this.resolveRowId(t,-1,`add-${this.e.Jt()}`);if(this.p.has(r)){this.e.reportError(new Error(`Duplicate row id: ${r}`),"transaction.add",{rowId:r});return}let o=De(t,this.e.t.childrenKey),s={id:r,data:t,rowIndex:-1,selected:!1,treeChildrenLoaded:Array.isArray(o)};this.p.set(r,s),this.Gr.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.Do(s,l,i+1)}Fa(){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)}xt(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}}Xu(e=this.Me){let t=Object.keys(this.Se).length>0&&this.xt(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=F(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}Pi(){return F(this.Me)}Rt(e){let t=e!=null&&e.trim()!==""?e:null;return t===this.He?!1:(this.He=t,this.et=null,!0)}xo(){return this.He}Ni(){return Object.keys(this.Se).length>0||this.Me!=null||this.He!=null}F(){this.Wr(),this.e.$({data:!0})}Ro(){this.g?this.ka():this.F()}Wr(){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.Ju(e);return}if(this.Zu(e))return;let r,o=[];if(this.S)r=this.Qu(t,i);else{r=this.c,this.Ni()&&!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.ec(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.I.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._a(r,e,!0),this.tc(o)}_a(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.Lr.set(o,++r)}),this.we=e,this.Fi(),i&&this.Yu(),this.ic((o,s)=>this.e.d(o,s)),this.e.emit("modelUpdated",{rowCount:e.length}),this.e.Ce.za(t)}Ju(e){this.c.forEach((t,i)=>{this.be||(t.rowIndex=i),this.Lr.set(t,this.be?t.rowIndex+1:i+1)}),this.ve=this.c,this.we=this.c,this.Ei.clear(),this.e.t.getRowHeight&&this.e.s.ot(),this.Nr++,this.e.emit("modelUpdated",{rowCount:this.c.length}),this.e.Ce.za(e)}Zu(e){let t=this.yo;return this.yo=!1,!t&&this.Ba()?(this.rc(e),!0):(this.wo(),!1)}Ba(){if(!this.e.t.dataProcessor||this.c.length<this.e.t.dataProcessorMinRows||this.S||this.e.t.masterDetail||this.e.r.Je().length>0)return!1;let e=!this.e.t.manualFiltering&&this.Ni(),t=!this.e.t.manualSorting&&this.e.r.Q().length>0;return e||t}rc(e){this.wo();let t=this.e.t.dataProcessor;if(!t)return;let i=++this.Ii,r=new AbortController;this.Hr=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.Pi():null,quickFilterText:a?this.He:null,signal:r.signal})).then(d=>{if(i!==this.Ii||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._a(c,e),this.e.$({data:!0})}).catch(d=>{i!==this.Ii||r.signal.aborted||this.e.o()||(this.e.reportError(d,"dataProcessor.process"),this.yo=!0,this.F())}).finally(()=>{i===this.Ii&&(this.Hr=null)})}wo(){this.Ii++,this.Hr?.abort(),this.Hr=null}get Te(){return this.e.t.paginationEnabled&&!this.g}Fi(){if(this.e.t.getRowHeight&&this.e.s.ot(),!this.Te){this.ve=this.we,this.Nr++;return}let e=this.Oi(),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.Nr++}Oi(){return Math.max(1,this.e.t.paginationPageSize)}Zt(){return this.Te?this.V:1}getTotalRowCount(){return this.g?this.Ai():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.Oi())):1}Wa(){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.Fi(),this.e.$({data:!0}),this.e.s.Kr(0,"top"),t||this.Hi())}setPageSize(e){if(!this.Te)return;let t=Math.max(1,Math.round(e)||this.Oi()),i=(this.V-1)*this.Oi();this.e.t.paginationPageSize=t,this.V=Math.floor(i/t)+1,this.e.t.paginationPage=this.V,this.Fi(),this.e.$({data:!0}),this.Hi()}$a(e,t){this.e.t.paginationPageSize=t,this.V=e,this.e.t.paginationPage=this.V}Ka(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.Fi(),this.e.$({data:!0}),this.Hi())}nc(){this.Te&&(this.V=this.e.t.paginationMode==="server"?this.e.t.paginationPage:1,this.Fi(),this.e.$({data:!0}),this.Hi())}Hi(e=this.Oi()){this.e.emit("paginationChanged",{page:this.Zt(),pageSize:e,pageCount:this.getPageCount(),total:this.getTotalRowCount()})}Qu(e,t){let i=this.e.t.manualSorting?[]:this.e.r.Q(),r=new Map,o=this.Ni()&&!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.I.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}oc(){let e=this.wa,t=0;for(let i of this.ve)!i.isDetail&&!i.isGroup&&(e[t++]=i);return e.length=t,e}sc(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}}ac(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}lc(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.sc(s,t,a,e.length-o):this.ac(e,o,t,a,i);r[o]=l;for(let d=1;d<l;d++)r[o+d]=-1;o+=l}return r}ic(e){if(this.Ei.clear(),this.S||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.oc();if(i.length!==0)for(let r of t)this.Ei.set(r.id,this.lc(i,r,e))}dc(e){return this.Ei.get(e)}Ua(e){return this.Lr.get(e)??0}$r(e){return this.Gr.get(e)??0}ec(e,t){let i=yt(this.e.t.aggFuncs),r=this.e.r.Ru();this.Ri=[];let o=l=>{let d={};for(let u of r){let c=i(u.colDef.aggFunc);if(c)try{d[u.id]=on(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=dn(this.z,this.c,t,(l,d)=>this.e.d(l,d));this.z=s.expanded;let a=ln(e,t,(l,d)=>this.e.d(l,d),o,this.z);return this.Ri=a.ids,{rows:a.rows,ambiguousExpansions:s.ambiguous}}tc(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.S;if(t){if(this.To(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.I.has(e)}uc(){return[...this.I]}cc(){return[...this.z]}hc(e,t){this.I=new Set(e.filter(i=>this.p.has(i))),this.z=new Set(t)}pc(e){return this.Eo(e,!0)}fc(e){return this.Eo(e,!1)}Ur(e){return this.Eo(e,!this.I.has(e))}Eo(e,t){let i=this.p.get(e);return!i||t&&!this.isRowExpandable(i)?!1:(t===this.I.has(e)||(t?this.I.add(e):this.I.delete(e),this.F(),this.e.emit("detailToggled",{rowId:e,rowNode:i,expanded:t}),t&&this.S&&!this.To(e)&&!i.treeLoading&&this.loadTreeChildren(e).catch(()=>{})),t)}setAllDetailsExpanded(e){let t=!1;if(e)for(let i of this.c)!this.I.has(i.id)&&this.isRowExpandable(i)&&(this.I.add(i.id),t=!0);else this.I.size>0&&(this.I.clear(),t=!0);t&&this.F()}So(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.Ri)this.z.add(i);else this.z.clear();this.z.size!==t&&this.F()}setGroupExpanded(e,t){return!this.Ri.includes(e)||t===this.z.has(e)||(t?this.z.add(e):this.z.delete(e),this.F()),t}ja(){return!this.S&&!this.g&&!this.e.t.dataProcessor&&this.e.t.paginationMode!=="server"&&this.e.r.Q().length===0&&this.e.r.Je().length===0}qa(e,t){if(!this.ja()||!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.F(),!0)}Oe(){return this.c}mc(){return this._}Et(){return this.ve}P(){return this.be?this.Xt():this.ve.length}h(e){return this.be?e<0||e>=this.Xt()?void 0:this.tt.get(e)??this.Fu(e):this.ve[e]}N(e){return this.p.get(e)}gc(e){this.c.forEach(e)}yc(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.G=new Set;this.St=null;this.Vi=new Set}zr(e){return this.G.has(e)}vc(e){return this.Vi.has(e)}ze(e,t){if(e.loading)return!1;if(e.isGroup||e.isDetail)return!0;let i=t===void 0?this.Mo():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}}Mo(){return this.e.r.l().find(e=>e.hasCheckbox&&e.colDef.selectable!=null)}Qt(){return this.e.i.Oe().filter(e=>this.G.has(e.id))}Ya(e=this.Qt()){return e.filter(t=>t.data!=null).map(t=>t.data)}Io(){return[...this.G]}Xa(e){let t=new Set(e),i=this.Mo()??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.Mt(r,!0)}bc(){this.Xa(this.e.t.rowSelection==="none"?[]:this.Io())}Na(e){let t=this.e.i;if(!e)this.G.clear(),this.St=null;else{for(let i of this.G)t.N(i)||this.G.delete(i);this.St!=null&&!t.N(this.St)&&(this.St=null)}this.Ja(null);for(let i of t.Oe())i.selected=this.G.has(i.id)}Za(e){let{selectable:t,selected:i}=this.Qa(e.leafNodes??[],!1);return{all:i>0&&i===t,some:i>0}}wc(e,t){let i=(e.leafNodes??[]).filter(r=>this.ze(r));i.length!==0&&this.Mt(i.map(r=>({node:r,selected:t})))}Ao(e,t,i=!1){this.Mt([{node:e,selected:t,clearOthers:i}])}Cc(e,t=!0,i=!0){let r=this.e.i.N(e);r&&this.Ao(r,t,i)}Tc(e,t,i){if(!i||!t.shiftKey||this.St==null)return!1;let r=this.e.i.N(this.St);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.Mt(a),!0}tl(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.Tc(e,t,o)||(this.Ao(e,!s||!e.selected,!s),this.St=e.id)}selectAll(e=!0){if(this.e.t.rowSelection==="none")return;let i=e?this.e.i.Et():this.e.i.Oe();this.Mt(i.filter(r=>!r.isDetail&&!r.isGroup).map(r=>({node:r,selected:!0})))}deselectAll(){this.Mt([],!0)}Dc(){let e=this.e.i,{selectable:t,selected:i}=this.Qa(e.Et(),!0),r=i>0&&i===t&&(!e.g||t>=e.Ai());return{all:r,some:i>0&&!r}}Qa(e,t){let i=0,r=0;for(let o of e)t&&(o.isDetail||o.isGroup)||!this.ze(o)||(i++,this.G.has(o.id)&&r++);return{selectable:i,selected:r}}xc(e,t){let i=this.e.i,r=this.e.t.rowSelection==="single",o=!r&&i.S&&this.e.t.autoCheckedChildren,s=(a,l,d=!1)=>{if(l?(d||this.ze(a,t))&&this.G.add(a.id):this.G.delete(a.id),!!o)for(let u of i.Gi(a.id)){let c=i.N(u);c&&s(c,l)}};for(let{node:a,selected:l}of e)if(s(a,l,!0),r&&l)break}Rc(e){let t=new Set(e);for(let i of this.G)t.delete(i)||t.add(i);return t}Ec(e){let t=[];for(let i of this.e.i.Oe()){let r=this.G.has(i.id);(i.selected!==r||e.has(i.id)||this.Vi.has(i.id))&&i.rowIndex>=0&&t.push(i.rowIndex),i.selected=r}return t}Mt(e,t=!1){let i=this.e.t.rowSelection,r=this.Mo()??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.G);(t||o.some(u=>u.selected?i==="single"||u.clearOthers:u.clearOthers&&this.ze(u.node,r)))&&this.G.clear(),this.xc(o,r);let a=new Set(this.Vi);this.Ja(r);let l=this.Rc(s),d=this.Ec(a);if(l.size>0){this.e.s.F(d),this.e.W._r();let u=this.Qt();this.e.emit("selectionChanged",{selectedNodes:u,selectedRows:this.Ya(u)})}}Ja(e){this.Vi.clear();let t=this.e.i;if(this.e.t.rowSelection!=="multiple"||!t.S||this.G.size===0)return;let i=r=>{let o=e&&t.N(r),s=!o||this.ze(o,e),a=!0,l=!1;for(let d of t.Gi(r)){let u=i(d);a&&(a=u.all),l||(l=u.some)}if(a&&!l){s||this.G.delete(r);let d=this.G.has(r);return{all:d||!s,some:d}}return s&&a?this.G.add(r):(this.G.delete(r),s&&l&&this.Vi.add(r)),{all:a,some:l}};for(let r of t.mc())i(r.id)}};var Dt=class{constructor(e){this.e=e;this.It=null;this.ie=0;this.st=0;this.We=null;this.ei=null;this.Bi=e=>{let t=this.Go(e);t&&(this.st=this.nl(t,e.clientX),t.didResize||(t.didResize=Math.abs(this.st-t.startWidth)>=.5),!this.ie&&(this.ie=requestAnimationFrame(()=>{this.ie=0,this.Ic()})))};this.ii=e=>{let t=this.Go(e);t&&(this.st=this.nl(t,e.clientX),t.didResize||(t.didResize=Math.abs(this.st-t.startWidth)>=.5),this.Ac(t))};this.jr=e=>{this.Go(e)&&this.at()};this.kc=()=>{this.at()};this.Lo=e=>{e.key==="Escape"&&(e.preventDefault(),this.at())}}Sc(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.It={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.ko(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.Mc(this.It)}at(e=!0){let t=this.It;t&&(this.It=null,this.Po(),this.ko(t.handle,!1),e&&(this.il(t),this.e.ti()),this.e.n.root.classList.remove("mach-root--resizing"),this.rl(t))}il(e){e.column.manualWidth=e.startManualWidth,e.column.flex=e.startFlex,e.column.currentWidth=e.startWidth,this.e.r.Xe=e.startPreserveWidths}Ac(e){this.It=null,this.Po(),e.didResize&&(Math.abs(this.st-e.startWidth)<.5?this.il(e):this.e.r.Ee(e.column,this.st),this.e.ti()),this.ko(e.handle,!1);try{e.handle.releasePointerCapture?.(e.pointerId)}catch{}this.e.n.root.classList.remove("mach-root--resizing"),this.rl(e),e.didResize&&this.e.lt([e.column])}Ic(){let e=this.It;!e?.didResize||!this.e.r.Ee(e.column,this.st)||(this.e.ti(),this._i(e),this.e.ol(e.column,!1))}Mc(e){this.We=p("div","mach-column-resize-guide"),this.We.setAttribute("aria-hidden","true"),this.ei=p("span","mach-column-resize-label"),this.We.appendChild(this.ei),this.e.n.root.appendChild(this.We),this._i(e)}_i(e){if(!this.We||!this.ei)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.ei.style.left=`${s-o}px`,this.ei.textContent=`${Math.round(e.column.currentWidth)} px`}rl(e){e.handle.classList.remove("mach-header-resize--active"),this.We?.remove(),this.We=null,this.ei=null}nl(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})}Go(e){let t=this.It;return t&&e.pointerId===t.pointerId?t:null}Po(){this.ie&&cancelAnimationFrame(this.ie),this.ie=0}ko(e,t){R(window,t,{pointermove:this.Bi}),R(window,t,{pointerup:this.ii,pointercancel:this.jr,keydown:this.Lo},!0),R(e,t,{lostpointercapture:this.kc})}destroy(){this.at(!1),this.Po(),this.e.n.root?.classList.remove("mach-root--resizing")}};var fn=6,xt=class{constructor(e){this.e=e;this.zi=null;this.ri=null;this.No=!1;this.se=0;this.qr=null;this.Bi=e=>{if(this.ri){this.Lc(e);return}let t=this.zi;t&&(Math.abs(e.clientX-t.startX)<fn&&Math.abs(e.clientY-t.startY)<fn||this.Nc(e))};this.ii=e=>{this.zi=null,e.type!=="pointercancel"&&this.ri&&this.Oo(e.clientX,e.clientY),this.Fo();let t=this.sl();t&&e.type!=="pointercancel"&&t.targetIndex>=0&&this.e.Di(t.column.id,t.targetIndex)}}Pc(e,t){e.button===0&&t.movable&&(this.zi={column:t,startX:e.clientX,startY:e.clientY},this.Wi(!0))}Wi(e){R(window,e,{pointermove:this.Bi,pointerup:this.ii,pointercancel:this.ii})}Gc(){let e=this.No;return this.No=!1,e}Nc(e){let t=this.zi;if(!t)return;let i=this.e.W.At(t.column.id,this.e.r.ge(t.column));if(!i||!i.parentElement){this.Fo();return}this.No=!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",K(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.ni[s],l=this.e.r.x(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.ri={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.Oo(e.clientX,e.clientY)}Lc(e){this.qr={clientX:e.clientX,clientY:e.clientY},!this.se&&(this.se=requestAnimationFrame(()=>{this.se=0;let t=this.qr;this.qr=null,t&&this.Oo(t.clientX,t.clientY)}))}Oo(e,t){let i=this.ri;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)`}sl(){let e=this.ri;return e?(this.ri=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}Fo(){this.Wi(!1),this.se&&cancelAnimationFrame(this.se),this.se=0,this.qr=null}destroy(){this.Fo(),this.sl(),this.zi=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
|
+
`)||t.includes("\r")?'"'+t.replace(/"/g,'""')+'"':t}function ue(n){return typeof n!="string"||n===""||Wi.test(n)?n:/^[\s\u0000-\u001f]*[=+\-@]/.test(n)?"'"+n:n}function mn(n,e={}){let t=e.columnSeparator??",",i=e.protectFormulas??!0,r=n.map(o=>o.map(s=>$i(i?ue(s):s,t)).join(t)).join(`\r
|
|
3
|
+
`);return e.prependBOM?"\uFEFF"+r:r}function gn(n){return n==null?"":String(n)}function js(n,e){return $i(e?ue(n):n," ")}function Et(n,e=!0){return n.map(t=>t.map(i=>js(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===`
|
|
5
5
|
`||a==="\r"?(i.push(r),t.push(i),i=[],r="",a==="\r"&&n[s+1]===`
|
|
6
|
-
`&&s++):r+=a,s++}return(r!==""||i.length>0)&&(i.push(r),t.push(i)),t}function $s(n){let e=null;try{return e=document.createElement("textarea"),e.value=n,e.style.position="fixed",e.style.opacity="0",document.body.appendChild(e),e.focus(),e.select(),document.execCommand("copy")}catch{return!1}finally{e?.remove()}}async function _e(n){try{if(typeof navigator<"u"&&navigator.clipboard?.writeText)return await navigator.clipboard.writeText(n),!0}catch{}return $s(n)}var fn=new Set(["ArrowUp","ArrowDown","ArrowLeft","ArrowRight","Home","End","PageUp","PageDown"]),Ks=new Set([...fn,"Enter","F2","Tab"," ","Escape","Delete","Backspace"]),At=class{constructor(e){this.e=e;this.ul=e=>{if(this.Bo(e)||this.e.o()||this.e.t.suppressClipboard)return;let t=this.e.s.ai();if(!t)return;let i=this.e.hl(t),r=e.clipboardData;if(e.preventDefault(),r&&typeof r.setData=="function"){try{r.setData("text/plain",i)}catch{return}e.type==="cut"&&this.e._o(t)}else e.type==="cut"?this.e.Fc(t,i):_e(i)};this.Nc=e=>{if(this.Bo(e)||this.e.t.suppressClipboard)return;let t=this.e.s.zo();if(!t)return;let i=e.clipboardData,r=i&&typeof i.getData=="function"?i.getData("text/plain"):null;typeof r!="string"||r===""||(e.preventDefault(),this.e.pl(r,t.row,t.colIdx))};this.Lc=e=>{this.Bo(e)||this.e.o()||this.Oc(e)||Ks.has(e.key)&&(this.Hc(e)||this.Vc(e)||this.Bc(e))}}init(){this.dl(!0)}destroy(){this.dl(!1)}dl(e){S(this.e.n.root,e,{keydown:this.Lc,copy:this.ul,cut:this.ul,paste:this.Nc})}cl(e,t,i){let r=this.e.r.l(),o=this.e.r.J(t);if(o<0)return null;let s=this.e.i.G(),a=o,l=e;for(let d=0;d<(r.length+1)*(s+1);d++){if(a+=i,a>=r.length){if(l>=s-1)return null;a=0,l=this.Lt(l+1,1)}else if(a<0){if(l<=0)return null;a=r.length-1,l=this.Lt(l-1,-1)}if(l<0||l>=s)return null;let u=this.e.i.h(l);if(u&&!u.isDetail&&this.e.a.ae(u,r[a]))return{rowIndex:l,column:r[a]}}return null}Lt(e,t){let i=this.e.i.G();for(;e>=0&&e<i;){let r=this.e.i.h(e);if(!r||!r.isDetail)return e;e+=t}return-1}Bo(e){let t=e.target;return e.defaultPrevented||t instanceof HTMLElement&&(t.isContentEditable||!!t.closest("button,a[href],input,textarea,select"))||this.e.a.isEditing()}Oc(e){if(!e.ctrlKey&&!e.metaKey)return!1;let t=e.key.toLowerCase();return t==="a"?(this.e.t.rowSelection==="multiple"&&(e.preventDefault(),this.e.f.selectAll(!0)),!0):e.altKey||t!=="z"&&t!=="y"?!1:(e.preventDefault(),t==="z"&&!e.shiftKey?this.e.H.undo():this.e.H.redo(),!0)}Hc(e){let t=this.e.s;if(e.key==="Escape")return this.e._e(),this.e.t.enableRangeSelection&&t.De()&&(e.preventDefault(),t.li()),!0;if(e.key!=="Delete"&&e.key!=="Backspace")return!1;let i=t.ai();return i&&(e.preventDefault(),this.e._o(i)),!0}Vc(e){if(this.e.s.v)return!1;let t=this.e.r.l();return this.e.i.G()>0&&t.length>0&&(e.preventDefault(),this.e.s.Ae(0,t[0].id)),!0}Bc(e){let t=this.e.s,i=t.v;if(!i)return;let r=this.e.r.l(),o=this.e.r.J(i.colId),s=this.e.i.G();if(o<0||s===0)return;let a={row:i.rowIndex,colIdx:o},l=this._c(e,a,r,s);if(!l)return;e.preventDefault();let d=l.row!==a.row||l.colIdx!==a.colIdx;if(e.shiftKey&&this.e.t.enableRangeSelection&&d){t.zc(l.row,l.colIdx);return}d&&t.Ae(l.row,r[l.colIdx].id)}_c(e,t,i,r){return fn.has(e.key)?this.Wc(e,t,i.length,r):e.key==="Enter"||e.key==="F2"?this.$c(e,t,i,r):e.key===" "?(this.Kc(t.row),t):e.key==="Tab"?this.Uc(e,t,i):null}Wc(e,t,i,r){let{row:o,colIdx:s}=t;switch(e.key){case"ArrowUp":o=this.Jr(o,this.Lt(o-1,-1),r);break;case"ArrowDown":o=this.Jr(o,this.Lt(o+1,1),r);break;case"ArrowLeft":s=Math.max(0,s-1);break;case"ArrowRight":s=Math.min(i-1,s+1);break;case"Home":s=0,e.ctrlKey&&(o=0);break;case"End":s=i-1,e.ctrlKey&&(o=Math.max(0,this.Lt(r-1,-1)));break;case"PageUp":case"PageDown":o=this.jc(e.key,o,r);break}return{row:o,colIdx:s}}Jr(e,t,i){return t>=0&&t<i?t:e}jc(e,t,i){let r=this.e.n.b.center,o=Math.max(1,Math.floor(r.clientHeight/this.e.t.rowHeight)),s=e==="PageUp"?-1:1,a=Math.max(0,Math.min(i-1,t+o*s));return this.Jr(t,this.Lt(a,s),i)}$c(e,t,i,r){let o=this.e.i.h(t.row),s=i[t.colIdx];if(o&&!o.isDetail&&s&&this.e.a.ae(o,s))return this.e.a.start(t.row,s,e.key==="F2"?e.key:null),t;let a=this.Lt(t.row+1,1);return{...t,row:this.Jr(t.row,a,r)}}Kc(e){let t=this.e.i.h(e);if(!(!t||t.isDetail)){if(t.isGroup){this.e.i.Io(t.id);return}this.e.t.rowSelection!=="none"&&this.e.f.Po(t,!t.selected,this.e.t.rowSelection==="single")}}Uc(e,t,i){let r=this.cl(t.row,i[t.colIdx].id,e.shiftKey?-1:1);return r?(this.e.s.Ae(r.rowIndex,r.column.id),this.e.a.start(r.rowIndex,r.column),t):null}};var P=null;function gn(n){P?.owner&&(n===P.owner||n.contains(P.owner))&&P.close()}function Us(n){let e=n.target;P?.contains(e)||P?.close()}function mn(){P?.reposition()}function js(n){n.key!=="Escape"||!P||(n.preventDefault(),n.stopImmediatePropagation(),P.close(!0))}function yn(n){_(n,Us,js);let e=n?"addEventListener":"removeEventListener";window[e]("resize",mn),window[e]("scroll",mn,!0)}function qs(n){P?.close!==n.close&&P?.close(),!P&&(P=n,yn(!0))}function Ys(n){P?.close===n&&(P=null,yn(!1))}function he(n,e){return e?`${n} ${e}`:n}function ze(n,e,t){let i=n[e]&&!n[e].disabled,r=i?e+t:t>0?0:n.length-1;for(let o=r;o>=0&&o<n.length;o+=t)if(!n[o].disabled)return o;return i?e:-1}function kt(n,e){return n.findIndex(t=>t.value===e&&!t.disabled)}function ae(n){let e=p("div",he("mach-select-control",n.classNames?.root)),t=p("select",he("mach-select-native",n.classNames?.native));t.hidden=!0,t.tabIndex=-1,t.setAttribute("aria-hidden","true");let i=p("button",he("mach-select-trigger",n.classNames?.trigger));i.type="button",i.setAttribute("role","combobox"),i.setAttribute("aria-haspopup","listbox"),i.setAttribute("aria-expanded","false"),i.setAttribute("aria-label",n.ariaLabel);let r=p("span",he("mach-select-value",n.classNames?.value)),o=p("span",he("mach-select-caret",n.classNames?.caret));o.setAttribute("aria-hidden","true"),i.append(r,o);let s=p("div",he("mach-select-listbox",n.classNames?.listbox));s.id=yr("mach-select-listbox"),s.setAttribute("role","listbox"),s.setAttribute("aria-hidden","true"),i.setAttribute("aria-controls",s.id),e.append(t,i);let a=[...n.options],l=[],d=-1,u=!1,c=()=>n.themeSource??e.closest(".mach-root")??e,h=y=>e.contains(y)||s.contains(y),f=()=>s.classList.contains("mach-select-listbox--open"),m=()=>{let y=a.find(D=>D.value===t.value);r.textContent=y?.label??t.value,l.forEach((D,me)=>{let M=a[me]?.value===t.value;D.setAttribute("aria-selected",M?"true":"false"),D.classList.toggle("mach-select-option--selected",M),D.classList.toggle("mach-select-option--active",me===d)}),i.setAttribute("aria-activedescendant",d>=0?l[d]?.id??"":"")},g=()=>{let y=i.getBoundingClientRect(),D=s.getBoundingClientRect(),me=Math.max(y.width,D.width),M=T(y.left,8,Math.max(8,window.innerWidth-me-8)),ke=window.innerHeight-y.bottom-8,le=ke<Math.min(D.height,240)&&y.top>ke,F=le?Math.max(8,y.top-D.height-5):Math.min(window.innerHeight-D.height-8,y.bottom+5);s.style.minWidth=`${y.width}px`,s.style.left=`${M}px`,s.style.top=`${Math.max(8,F)}px`,s.classList.toggle("mach-select-listbox--above",le)},b=(y=!1)=>f()?(s.classList.remove("mach-select-listbox--open","mach-select-listbox--above"),s.setAttribute("aria-hidden","true"),i.setAttribute("aria-expanded","false"),i.removeAttribute("aria-activedescendant"),s.remove(),Ys(b),y&&!u&&i.focus({preventScroll:!0}),!0):!1,w=(y,D=!0)=>{!a[y]||a[y].disabled||(d=y,m(),D&&l[y]?.scrollIntoView?.({block:"nearest"}))},G=()=>{if(u||i.disabled||f())return;let y=c();qs({owner:y,close:b,contains:h,reposition:g}),d=kt(a,t.value),d<0&&(d=ze(a,-1,1)),A(s,y),document.body.appendChild(s),s.classList.add("mach-select-listbox--open"),s.setAttribute("aria-hidden","false"),i.setAttribute("aria-expanded","true"),g(),m(),l[d]?.scrollIntoView?.({block:"nearest"})},$=y=>{let D=a[y];!D||D.disabled||(t.value=D.value,d=y,m(),b(!0),t.dispatchEvent(new Event("input",{bubbles:!0})),t.dispatchEvent(new Event("change",{bubbles:!0})))},K=(y,D)=>{a=[...y],t.replaceChildren(),s.replaceChildren(),l=a.map((M,ke)=>{let le=p("option");le.value=M.value,le.textContent=M.label,le.disabled=M.disabled===!0,t.appendChild(le);let F=p("button",he("mach-select-option",n.classNames?.option));return F.id=`${s.id}-option-${ke}`,F.type="button",F.tabIndex=-1,F.dataset.value=M.value,F.disabled=M.disabled===!0,F.setAttribute("role","option"),F.textContent=M.label,F.addEventListener("mousedown",xo=>xo.preventDefault()),F.addEventListener("click",()=>$(ke)),s.appendChild(F),F});let me=a.find(M=>!M.disabled)?.value??"";t.value=D!=null&&a.some(M=>M.value===D)?D:me,d=kt(a,t.value),m()},fr=y=>{if(y.key==="Tab"){b();return}if(y.key==="Escape"){if(!b(!0))return;y.preventDefault(),y.stopPropagation();return}if(y.key==="Enter"||y.key===" "){y.preventDefault(),y.stopPropagation(),f()?$(d):G();return}let D=d;if(y.key==="ArrowDown")D=ze(a,d,1);else if(y.key==="ArrowUp")D=ze(a,d,-1);else if(y.key==="Home")D=ze(a,-1,1);else if(y.key==="End")D=ze(a,-1,-1);else return;y.preventDefault(),y.stopPropagation(),f()||G(),w(D)},mr=()=>{d=kt(a,t.value),m(),n.onChange?.(t.value)};return i.addEventListener("click",()=>{b()||G()}),i.addEventListener("keydown",fr),t.addEventListener("change",mr),K(a,n.value),{el:e,native:t,trigger:i,listbox:s,contains:h,isOpen:f,open:G,close:b,focus:()=>i.focus({preventScroll:!0}),getValue:()=>t.value,setValue:y=>{t.value=y,d=kt(a,y),m()},setOptions:K,destroy:()=>{u||(u=!0,b(),i.removeEventListener("keydown",fr),t.removeEventListener("change",mr),e.remove())}}}function vn(n,e){let t=p("input","mach-editor-input");return t.type=n,e!=null&&e!==""&&(t.value=n==="date"?String(e).slice(0,10):String(e)),t}function Xs(n){return n?.options?.length?n.options:(n?.values??[]).map(e=>({label:String(e),value:e}))}function Js(n,e){return e?.options?.length||e?.values?.length?"select":typeof n=="number"?"number":n instanceof Date||typeof n=="string"&&/^\d{4}-\d{2}-\d{2}/.test(n)?"date":"text"}function Ki(n,e,t){let i=n.colDef,r=typeof i.cellEditor=="string"?i.cellEditor:Js(e,i.cellEditorParams);if(r==="date"){let a=e instanceof Date?e.toISOString():e==null?"":String(e),l=vn("date",a),d=a.match(/T(\d{2}:\d{2})/);return{el:l,getValue:()=>l.value===""?null:d?`${l.value}T${d[1]}`:l.value,focus:()=>l.focus({preventScroll:!0})}}if(r==="select"){let a=Xs(i.cellEditorParams),l=ae({ariaLabel:i.headerName??i.field??n.id,options:a.map(d=>({value:String(d.value),label:d.label,disabled:d.disabled})),value:String(e??""),classNames:{root:"mach-editor-select-control",native:"mach-editor-select"}});return{el:l.el,getValue:()=>{let d=l.getValue();return a.find(c=>String(c.value)===d)?.value??d},focus:()=>l.focus(),destroy:()=>l.destroy()}}let o=r==="number",s=vn(o?"number":"text",e);return!o&&t&&t.length===1&&(s.value=t),{el:s,getValue:()=>o?s.value===""?null:Number(s.value):s.value,focus:()=>{s.focus({preventScroll:!0}),s.select()}}}function pe(n,e,t,i,r,o){let s=t.colDef.valueParser;if(!s)return i;let a=s({api:n.api,colDef:t.colDef,column:t,data:e.data,node:e,value:i,oldValue:o,source:r});if(k(a))throw new TypeError("valueParser must return a synchronous value");return a}function We(n,e,t,i){let r=n.d(e,t),o=t.colDef.valueSerializer;if(o)try{let s=o({api:n.api,colDef:t.colDef,column:t,data:e.data,node:e,value:r,target:i});if(k(s))throw new TypeError("valueSerializer must return a synchronous value");return s}catch(s){throw n.reportError(s,"valueSerializer",{colId:t.id,rowId:e.id}),s}return i==="xlsx"||i==="csv"&&typeof r=="number"?r:Y(n,e,t,r)}function Q(n,e){e.length&&n.s.O(e),n.Nt.refresh(),n.ji.refresh()}function bn(n,e){let t=p("button",`mach-edit-control mach-edit-control--${n}`);return t.type="button",t.setAttribute("aria-label",e),t.title=e,t.innerHTML=J(n==="confirm"?Ii:Mi),t}var Pt=class{constructor(e){this.e=e;this.y=null;this.T=null;this.le=null;this.dt=0;this.Zr=0;this.vl=e=>{if(!(!this.y||e.isComposing||e.keyCode===229)&&!(e.key!=="Enter"&&e.key!=="Escape"&&e.key!=="Tab"))if(e.preventDefault(),e.stopPropagation(),e.key==="Tab"){let t=this.y,i=this.e.Zo.cl(t.node.rowIndex,t.column.id,e.shiftKey?-1:1);i?this.start(i.rowIndex,i.column,null,!0):this.ke(!1)}else this.ke(e.key==="Escape")}}isEditing(e,t){return this.y?e==null&&t==null?!0:this.y.node.rowIndex===e&&this.y.column.id===t:this.T?e==null&&t==null?!0:this.qi(this.T)!==e?!1:t==null||this.T.drafts.has(t):!1}Qr(){return this.y!=null}Vu(){return this.y?.node.rowIndex??(this.T?this.qi(this.T):null)}fl(e){return this.T?e==null||this.qi(this.T)===e:!1}ae(e,t){if(e.isDetail||e.isGroup||e.data==null)return!1;let i=t.colDef.editable;if(!i)return!1;if(typeof i=="function")try{return i(ge(this.e,e,t,this.e.d(e,t)))}catch(r){return this.e.reportError(r,"editable",{colId:t.id,rowId:e.id}),!1}return!0}start(e,t,i,r=!1){if(this.Zr++,this.e.o())return!1;let o=this.e.i.h(e);if(!o||o.data==null)return!1;if(this.e.t.editType==="fullRow")return this.startRow(e,t.id);if(this.T)return!1;if(this.y)return!this.le&&this.y.node===o&&this.y.column===t||this.ml(o,t).then(f=>{f&&this.start(o.rowIndex,t,i,r)}),!0;if(!this.ae(o,t))return!1;r&&(this.e.s.jr(e,"nearest"),this.e.s.Ae(e,t.id));let s=this.e.s.Gt(e,t.id);if(!s)return!1;this.e._e();let a=this.e.d(o,t),l=this.gl(o,t,e,a,i);if(!l)return!1;let d=p("div","mach-cell-editor-controls",{role:"group"}),u=bn("confirm","Confirm edit"),c=bn("cancel","Cancel edit");d.append(u,c),this.yl(l,s,!0),this.e.n.root.appendChild(d);let h=this.vl;return l.el.addEventListener("keydown",h),d.addEventListener("mousedown",f=>{f.preventDefault(),f.stopPropagation()}),d.addEventListener("click",f=>{f.stopPropagation();let m=f.target.closest("button");m&&this.ke(m===c)}),d.addEventListener("keydown",f=>{f.key==="Escape"&&this.vl(f)}),this.y={node:o,column:t,editor:l,oldValue:a,cell:s,keydown:h,confirmButton:u,cancelButton:c},this.Wo(),this.$o(l,t,o),this.e.emit("cellEditingStarted",{rowIndex:e,colId:t.id,rowNode:o}),!0}ml(e,t){let i=++this.Zr;return this.ke(!1).then(r=>r&&i===this.Zr&&!this.isEditing()&&this.e.i.h(e.rowIndex)===e&&(t==null||this.e.r.x(t.id)===t))}startRow(e,t){if(this.y||this.T)return!1;let i=this.e.i.h(e);if(!i||i.data==null||i.isDetail||i.isGroup)return!1;this.e._e();let r=new Map;for(let l of this.e.r.l()){if(!this.ae(i,l))continue;let d=this.e.d(i,l);r.set(l.id,{column:l,oldValue:d,value:d,mounted:null})}if(r.size===0)return!1;let o={node:i,rowIndex:e,drafts:r,validating:!1};if(this.T=o,this.e.s.O([e]),r.size===0)return this.T=null,this.e.s.O([e]),!1;let s=r.values().next().value,a=(t?r.get(t):void 0)??s;return this.Wo(),a?.mounted&&this.$o(a.mounted.editor,a.column,i),this.e.emit("rowEditingStarted",{rowIndex:e,rowNode:i,data:i.data}),!0}qc(e,t,i,r){if(this.y)return this.y.node===t&&this.y.column.id===i.id;let o=this.T;if(!o||o.node!==t)return!1;let s=o.drafts.get(i.id);return s?s.mounted?.cell!==r&&(this.Ko(s),!this.Yc(e,o,s,r))?(o.drafts.delete(i.id),!1):!0:!1}en(e,t,i){let r=this.T;if(r&&this.qi(r)===e){let o=r.drafts.get(t);return o?.mounted?.cell===i&&this.Ko(o),!1}if(this.y?.cell===i){let o=this.y;return this.ke(!1),this.y===o&&this.ke(!0),!0}return!1}stop(e=!1){this.ke(e)}ke(e=!1){if(e&&this.Zr++,this.T)return this.bl(e);let t=this.y;if(!t)return Promise.resolve(!1);if(e)return this.dt++,this.le=null,Promise.resolve(this.Yi(t,!0,t.oldValue));if(this.le)return this.le;let i,r="cellEditor.getValue";try{if(i=t.editor.getValue(),Object.is(i,t.oldValue)||(r="valueParser",i=pe(this.e,t.node,t.column,i,"editor",t.oldValue)),r="cellEditor.isCancelAfterEnd",t.editor.isCancelAfterEnd?.(i))return Promise.resolve(this.Yi(t,!0,t.oldValue))}catch(u){return this.e.reportError(u,r,{colId:t.column.id,rowId:t.node.id}),r!=="valueParser"?Promise.resolve(this.Yi(t,!0,t.oldValue)):(this.Xi(t.editor,u instanceof Error?u.message:String(u)),Promise.resolve(!1))}let o=[{node:t.node,column:t.column,oldValue:t.oldValue,newValue:i}],s=this.e.B.tn(o),a=++this.dt,l=()=>a===this.dt&&this.y===t&&s(),d=u=>l()?u.length?(this.Uo(t,!1),this.Xi(t.editor,u[0].message),!1):this.Yi(t,!1,i):(a===this.dt&&this.y===t&&this.Yi(t,!0,t.oldValue),!1);return this.wl(o,l,d,()=>this.Uo(t,!0))}bl(e=!1){let t=this.T;if(!t)return Promise.resolve(!1);if(e)return this.dt++,this.le=null,Promise.resolve(this.rn(t,!0));if(this.le)return this.le;for(let u of t.drafts.values())this.jo(u);let i=[];for(let u of t.drafts.values())if(!Object.is(u.oldValue,u.value))try{let c=pe(this.e,t.node,u.column,u.value,"editor",u.oldValue);c!==void 0&&!Object.is(u.oldValue,c)&&i.push({node:t.node,column:u.column,oldValue:u.oldValue,newValue:c})}catch(c){return this.e.reportError(c,"valueParser",{colId:u.column.id,rowId:t.node.id}),this.qo(t,[{draft:u,message:c instanceof Error?c.message:String(c)}]),Promise.resolve(!1)}if(i.length===0)return Promise.resolve(this.rn(t,!1,i));let r=i.map(u=>t.drafts.get(u.column.id)),o=r.map(u=>u.value),s=this.e.B.tn(i),a=++this.dt,l=()=>a===this.dt&&this.T===t&&s();for(let u of r)u.error=void 0;let d=u=>l()?u.length?(this.qo(t,u.map(({colId:c,message:h})=>({draft:t.drafts.get(c)??r[0],message:h}))),!1):r.some((c,h)=>!Object.is(c.value,o[h]))?(t.validating=!1,this.Yo(t,!1),!1):this.rn(t,!1,i):(a===this.dt&&this.T===t&&this.rn(t,!0),!1);return this.wl(i,l,d,()=>{t.validating=!0,this.Yo(t,!0)})}wl(e,t,i,r){let o=this.e.B.Xo(e,t);if(!k(o))return Promise.resolve(i(o));r();let s=o.then(i).finally(()=>{this.le===s&&(this.le=null)});return this.le=s,s}Yi(e,t,i){if(this.y!==e)return!1;let r={node:e.node,column:e.column,oldValue:e.oldValue,newValue:i},o=!t&&i!==void 0&&!Object.is(e.oldValue,i);if(o){let a=this.e.B.Jo([r],()=>!this.e.o());if(this.y!==e)return!1;if(a)return this.Uo(e,!1),this.Xi(e.editor,a.message),!1}if(this.y=null,this.le=null,e.confirmButton.parentElement?.remove(),o&&this.e.Ji(e.node,e.column,e.oldValue,i),this.Cl(e),this.e.o())return!0;this.e.emit("cellEditingStopped",{rowIndex:e.node.rowIndex,colId:e.column.id,rowNode:e.node,oldValue:e.oldValue,newValue:o?i:e.oldValue});let s=e.node.rowIndex;return Q(this.e,s>=0?[s]:[]),!0}rn(e,t,i=[]){if(this.T!==e)return!1;let r=t?[]:this.Xc(e,i);if(r==null||this.T!==e)return!1;this.T=null,this.le=null;for(let s of e.drafts.values())this.Ko(s,!1);if(this.e.o())return!0;let o=this.qi(e);return this.e.emit("rowEditingStopped",{rowIndex:o,rowNode:e.node,data:e.node.data,cancelled:t,changes:r}),Q(this.e,o>=0?[o]:[]),!0}Xc(e,t){if(t.length===0)return[];let i=this.e.B.Jo(t,()=>!this.e.o());if(i)return this.qo(e,[{draft:e.drafts.get(i.colId)??e.drafts.get(t[0].column.id),message:i.message}]),null;let r=this.e.B.Zi(t);this.e.H.Qi();try{for(let o of t){if(!r())break;this.e.Ji(e.node,o.column,o.oldValue,o.newValue)}}finally{this.e.H.er()}return t.map(({column:o,oldValue:s,newValue:a})=>({colId:o.id,oldValue:s,newValue:a}))}Yc(e,t,i,r){let o=this.gl(t.node,i.column,e,i.value,null);if(!o)return!1;this.yl(o,r);let s=l=>this.Jc(l,t,i),a=()=>{try{i.value=o.getValue(),i.error=void 0}catch{}};return o.el.addEventListener("keydown",s),o.el.addEventListener("input",a),i.mounted={editor:o,cell:r,keydown:s,input:a},i.error&&this.Xi(o,i.error),t.validating&&this.tr(o.el,!0),!0}yl(e,t,i=!1){L(this.e,t);let r=p("div",i?"mach-cell-editor-shell":"mach-row-editor-shell");r.appendChild(e.el),t.replaceChildren(r),t.classList.add("mach-cell--editing"),i||t.classList.add("mach-cell--row-editing"),t.removeAttribute("title")}Tl(e,t,i,r){let o=e.firstElementChild;if(i.width>t.clientWidth||i.left<r.left){let s=getComputedStyle(e);o.style.maxWidth=`${Math.max(0,t.clientWidth-parseFloat(s.paddingLeft)-parseFloat(s.paddingRight))}px`,o.style.marginLeft=`${Math.max(0,r.left-i.left)}px`,o.style.marginRight="auto"}else o.style.maxWidth&&(o.style.maxWidth=o.style.marginRight=o.style.marginLeft="")}Zc(e){for(let t of this.e.n.root.querySelectorAll(".mach-row--editing .mach-row-editor-shell")){let i=t.parentElement,r=e.drafts.get(i.dataset.colId);if(r?.mounted?.cell!==i)continue;let o=this.e.n.b[r.column.pinned??"center"];parseFloat(i.style.width)<=o.clientWidth&&parseFloat(i.style.left)>=o.scrollLeft&&!t.style.maxWidth||this.Tl(i,o,i.getBoundingClientRect(),o.getBoundingClientRect())}}Wo(){if(this.T&&this.Zc(this.T),!this.y)return;let{cell:e,column:t,confirmButton:i}=this.y,r=this.e.n.root;if(!r.contains(e)){this.ke(!0);return}let o=i.parentElement,s=this.e.n.b[t.pinned??"center"],a=e.getBoundingClientRect(),l=s.getBoundingClientRect();this.Tl(e,s,a,l);let d=r.getBoundingClientRect(),u=o.getBoundingClientRect(),c=l.left+s.clientWidth,h=l.top+s.clientHeight,f=a.top-u.height-2>=l.top?a.top-u.height-2:a.bottom+2,m=this.e.t.domLayout==="autoHeight"&&f+u.height>h;o.style.position=m?"static":"";let g=u.width;o.style.visibility=(m||g<=s.clientWidth&&f+u.height<=h)&&a.right>l.left&&a.left<c&&a.bottom>l.top&&a.top<h?"":"hidden",o.style.left=`${T(a.right-g,l.left,Math.max(l.left,c-g))-d.left-r.clientLeft}px`,o.style.top=`${f-d.top-r.clientTop}px`}Ko(e,t=!0){let i=e.mounted;e.mounted=null,i&&(t&&this.jo(e,i),this.Cl(i))}jo(e,t=e.mounted){if(t)try{let i=t.editor.getValue();i!==void 0&&(e.value=i)}catch(i){this.e.reportError(i,"cellEditor.getValue",{colId:e.column.id,rowId:this.T?.node.id})}}gl(e,t,i,r,o){let s=t.colDef,a;try{let l={api:this.e.api,colDef:s,column:t,node:e,data:e.data,value:r,rowIndex:i,keyPress:o};typeof s.cellEditor=="function"?a=s.cellEditor(l):typeof s.cellEditor=="string"&&!["text","number","date","select"].includes(s.cellEditor)?a=this.e.Qc(s.cellEditor)?.(l)??Ki(t,r,o):a=Ki(t,r,o)}catch(l){return this.e.reportError(l,"cellEditor",{colId:t.id,rowId:e.id}),null}if(!a||!(a.el instanceof HTMLElement))return this.e.reportError(new Error("cellEditor must return an editor with an HTMLElement el"),"cellEditor",{colId:t.id,rowId:e.id}),null;try{if(a.isCancelBeforeStart?.())return a.destroy?.(),null}catch(l){this.e.reportError(l,"cellEditor.isCancelBeforeStart",{colId:t.id,rowId:e.id});try{a.destroy?.()}catch{}return null}return a}qo(e,t){e.validating=!1,this.Yo(e,!1);for(let{draft:i,message:r}of t)i.error=r,i.mounted&&this.Xi(i.mounted.editor,r);t[0].draft.mounted?.editor.focus?.()}Xi(e,t){let i=e.el;i.classList.add("mach-editor-invalid"),i.setAttribute("title",t),i.setAttribute("aria-invalid","true"),this.tr(i,!1),(i.querySelector(".mach-select-trigger, input:not([type='hidden']), select:not([hidden]), textarea")??i).focus?.();let o=()=>{i.classList.remove("mach-editor-invalid"),i.removeAttribute("title"),i.removeAttribute("aria-invalid")};i.addEventListener("input",o,{once:!0})}Uo(e,t){this.tr(e.editor.el,t),e.confirmButton.disabled=t,e.cancelButton.disabled=!1}Yo(e,t){for(let i of e.drafts.values()){let r=i.mounted?.editor.el;r&&this.tr(r,t)}}tr(e,t){e.classList.toggle("mach-editor-validating",t),t?e.setAttribute("aria-busy","true"):e.removeAttribute("aria-busy"),e.inert=t}$o(e,t,i){try{e.focus?.()}catch(r){this.e.reportError(r,"cellEditor.focus",{colId:t.id,rowId:i.id})}}Cl(e){e.editor.el.removeEventListener("keydown",e.keydown),e.input&&e.editor.el.removeEventListener("input",e.input),this.tr(e.editor.el,!1),e.cell.contains(e.editor.el)&&e.cell.classList.remove("mach-cell--editing","mach-cell--row-editing","mach-cell--error");try{e.editor.destroy?.()}catch(t){this.e.reportError(t,"cellEditor.destroy",{colId:e.cell.dataset.colId})}}qi(e){return e.node.rowIndex>=0?e.node.rowIndex:e.rowIndex}Jc(e,t,i){if(this.T!==t||e.isComposing||e.keyCode===229)return;if(e.key==="Escape"||e.key==="Enter"&&!e.shiftKey){e.preventDefault(),e.stopPropagation(),this.bl(e.key==="Escape");return}if(e.key!=="Tab")return;e.preventDefault(),e.stopPropagation(),this.jo(i);let r=[...t.drafts.values()],o=r.indexOf(i),s=e.shiftKey?-1:1;for(let a=1;a<=r.length;a++){let l=r[(o+s*a+r.length)%r.length];if(l.mounted){this.$o(l.mounted.editor,l.column,t.node);break}}}destroy(){this.ke(!0)}};var Gt=class{constructor(e){this.e=e;this.Qo=0}eh(){this.Qo++}nn(){let e=++this.Qo;return()=>e===this.Qo&&!this.e.o()}tn(e){let t=e[0].node,i=this.e.r.Z(),r=i.map(a=>this.e.d(t,a)),o=this.Zi(e),s=e.every(a=>Object.is(this.e.d(t,a.column),a.oldValue));return()=>s&&o()&&i.every((a,l)=>Object.is(this.e.d(t,a),r[l]))}Zi(e){let t=e[0].node,i=t.data,r=this.e.r,o=r.Z(),s=e.every(a=>a.node===t&&r.x(a.column.id)===a.column);return()=>s&&!this.e.o()&&this.e.i.F(t.id)===t&&t.data===i&&r.Z()===o}Xo(e,t){let i=e.map(o=>this.th(o,t)),r=o=>{let s=o.filter(a=>a!=null);return s.length||!t()?s:this.ih(e,t)};return i.some(k)?Promise.all(i.map(o=>Promise.resolve(o))).then(r):r(i)}th(e,t){let{node:i,column:r,oldValue:o,newValue:s}=e,a=d=>(t()&&this.e.reportError(d,"validate",{colId:r.id,rowId:i.id}),{colId:r.id,message:"Validation failed"}),l=d=>typeof d=="string"?{colId:r.id,message:d}:null;try{let d=r.colDef.validate?.(s,{oldValue:o,newValue:s,node:i,data:i.data,column:r,colDef:r.colDef,api:this.e.api});return k(d)?d.then(l,a):l(d)}catch(d){return a(d)}}ih(e,t){let i=this.e.t.rowEditValidator;if(!i)return[];let r=e[0].node,o=Object.create(null);for(let l of this.e.r.Z())o[l.id]=this.e.d(r,l);for(let l of e)o[l.column.id]=l.newValue;let s=l=>typeof l=="string"?[{colId:e[0].column.id,message:l}]:l&&typeof l=="object"?Object.entries(l).filter(([,d])=>typeof d=="string"&&d).map(([d,u])=>({colId:d,message:u})):[],a=l=>(t()&&this.e.reportError(l,"validate",{rowId:r.id}),[{colId:e[0].column.id,message:"Row validation failed"}]);try{let l=i({data:r.data,node:r,values:o,api:this.e.api,changes:e.map(({column:d,oldValue:u,newValue:c})=>({colId:d.id,oldValue:u,newValue:c}))});return k(l)?l.then(s,a):s(l)}catch(l){return a(l)}}Jo(e,t){let i=[],r=this.Zi(e);for(let o of e){if(!t()||!r()||!Object.is(this.e.d(o.node,o.column),o.oldValue)||!this.e.a.ae(o.node,o.column)||!this.e.sn(o.node,o.column,o.newValue,o.oldValue)){for(let s of i.reverse()){if(!t()||!r())break;this.e.sn(s.node,s.column,s.oldValue,s.newValue)||this.e.reportError(new Error("A valueSetter rejected input rollback"),"inputRollback",{rowId:s.node.id})}return{colId:o.column.id,message:"Value was rejected by the column setter"}}i.push(o)}return t()&&r()?null:{colId:e[0].column.id,message:"Input target changed during commit"}}rh(e){let t=this.nn();if(this.e.o()||this.e.a.isEditing())return;let i=new Map;for(let a of e){if(a.newValue===void 0||Object.is(a.oldValue,a.newValue)||!this.e.a.ae(a.node,a.column))continue;let l=i.get(a.node)??[];l.push(a),i.set(a.node,l)}let r=[...i.values()].map(a=>{let l=this.tn(a),d=()=>t()&&l();return{changes:a,current:d,validation:this.Xo(a,d)}}),o=a=>{this.Dl(r,a,t)},s=r.map(a=>a.validation);s.some(k)?Promise.all(s.map(a=>Promise.resolve(a))).then(o):o(s)}Dl(e,t,i){let r=e.map(()=>({applied:!1,errors:[]}));if(!i())return r;let o=new Set;this.e.H.Qi();try{e.forEach(({changes:s,current:a},l)=>{let d=r[l];if(!a()||!s.length)return;d.errors=[...t[l]];let u=d.errors.length?null:this.Jo(s,i);if(!i())return;if(u&&d.errors.push(u),d.errors.length){this.e.reportError(new Error(d.errors.map(h=>h.message).join("; ")),"validate",{rowId:s[0].node.id,errors:d.errors});return}let c=this.Zi(s);d.applied=!0;for(let h of s){if(!i()||!c()){d.applied=!1;break}this.e.Ji(h.node,h.column,h.oldValue,h.newValue),h.node.rowIndex>=0&&o.add(h.node.rowIndex)}})}finally{this.e.H.er()}return o.size&&i()&&Q(this.e,[...o]),r}};function Ui(n){return n==="blank"||n==="notBlank"}function Lt(n){return n===null?"null:":`${typeof n}:${String(n)}`}var Nt=class{constructor(e){this.e=e;this.w=null;this.ut=null;this.di=null;this.ct=e=>{if(!this.w)return;let t=e.target;if(!this.di?.contains(t)){if(!this.w.contains(t)){this.close();return}(!(t instanceof Element)||!t.closest(".mach-filter-select-control"))&&this.di?.close()}};this.ht=e=>{if(e.key==="Escape"){if(this.di?.close(!0)){e.preventDefault(),e.stopPropagation();return}this.close()}}}toggle(e,t){if(this.ut===e.id){this.close();return}this.close(),this.open(e,t)}open(e,t){let i=this.e.i.Be()[e.id]??null,r=i?.type??e.filterType,o=p("div","mach-filter-panel");o.setAttribute("role","dialog"),o.setAttribute("aria-label",`${e.id} filter`);let s=u=>{this.e.nh(e,u),this.close()},a=r==="set"?this.oh(o,e,i):this.sh(o,r,i,s),l=p("div","mach-filter-footer");l.append(U("mach-filter-btn-reset",this.e.u("reset"),()=>s(null)),U("mach-filter-btn-apply",this.e.u("apply"),()=>s(a()))),o.appendChild(l),A(o,this.e.n.root),document.body.appendChild(o),this.w=o,this.ut=e.id,ee(o,t),_(!0,this.ct,this.ht),o.querySelector(".mach-filter-select-trigger, input")?.focus()}close(){this.w&&(this.di?.destroy(),this.di=null,this.w.remove(),this.w=null,this.ut=null,_(!1,this.ct,this.ht))}destroy(){this.close()}sh(e,t,i,r){let o=i&&i.type!=="set"&&i.conditions.length>0?i.conditions[0]:null,s=o?.match??(t==="text"?"contains":"equals"),{el:a,native:l}=this.ah(t,s),d=this.xl(t),u=this.xl(t,!0);this.lh(t,s,o,d,u),this.Rl(s,d,u),l.addEventListener("change",()=>{this.Rl(l.value,d,u)});let c=p("div","mach-filter-body");c.append(a,d,u),e.appendChild(c);let h=()=>this.dh(t,l.value,d.value,u.value),f=m=>{m.key==="Enter"&&r(h())};return d.addEventListener("keydown",f),u.addEventListener("keydown",f),h}ah(e,t){let i=ae({ariaLabel:"Filter condition",options:be[e].map(r=>({value:r,label:this.e.u(lt(r))})),value:t,classNames:{root:"mach-filter-select-control",native:"mach-filter-select",trigger:"mach-filter-select-trigger",value:"mach-filter-select-value",caret:"mach-filter-select-caret",listbox:"mach-filter-listbox",option:"mach-filter-listbox-option"},themeSource:this.e.n.root});return this.di=i,i}xl(e,t=!1){let r=p("input",`mach-filter-input${t?" mach-filter-input--second":""}`);return r.type=e,r}lh(e,t,i,r,o){i?.value!=null&&!Ui(t)&&(r.value=e==="date"?String(i.value).slice(0,10):String(i.value)),i&&"value2"in i&&i.value2!=null&&(o.value=e==="date"?String(i.value2).slice(0,10):String(i.value2))}Rl(e,t,i){t.style.display=Ui(e)?"none":"",i.style.display=e==="inRange"?"":"none"}oh(e,t,i){let o=t.colDef.filterParams,s;if(o?.values)s=o.values;else{let f=new Set;s=[];let m=this.e.i.Oe(),g=Math.min(m.length,o?.maxValues??500);for(let b=0;b<g;b++){let w=this.e.d(m[b],t),G=Lt(w??null);f.has(G)||(f.add(G),s.push(w))}}let a=new Set((i?.type==="set"?i.values:s).map(Lt)),l=p("input","mach-filter-input mach-filter-input--search");l.type="text",l.placeholder=this.e.u("search");let d=p("div","mach-filter-set-list"),u=new Map(s.map(f=>[Lt(f),f??null])),c=f=>{d.textContent="";let m=f.trim().toLowerCase();for(let g of s){let b=g==null?this.e.u("emptySetLabel"):String(g);if(m&&!b.toLowerCase().includes(m))continue;let w=Lt(g),G=p("label","mach-filter-set-item"),$=p("input");$.type="checkbox",$.checked=a.has(w),$.addEventListener("change",()=>{$.checked?a.add(w):a.delete(w)});let K=p("span");K.textContent=b,G.append($,K),d.appendChild(G)}};l.addEventListener("input",()=>c(l.value)),c("");let h=p("div","mach-filter-body mach-filter-body--set");return h.append(l,d),e.appendChild(h),()=>{let f=[];for(let[m,g]of u)a.has(m)&&f.push(g);return f.length&&f.length<u.size?{type:"set",values:f}:null}}dh(e,t,i,r){if(Ui(t))return{type:e,conditions:[{match:t}]};if(i===""&&t!=="inRange")return null;let o=e==="number",s=o?Number(i):i;if(Number.isNaN(s))return null;if(e==="text"||t!=="inRange")return{type:e,conditions:[{match:t,value:s}]};let a=r?o?Number(r):r:s;return Number.isNaN(a)?null:{type:e,conditions:[{match:t,value:s,value2:a}]}}};var Ft=class{constructor(e){this.e=e;this.w=null;this.ut=null;this.an=null;this.ln="";this.ir=new Set;this.ct=e=>{let t=e.target;this.w&&!this.w.contains(t)&&!this.ch(t)&&this.close()};this.ht=e=>{if(e.key==="Escape"){for(let t of this.ir)if(t.close(!0)){e.preventDefault(),e.stopImmediatePropagation();return}this.close()}}}toggle(e,t){let i=this.ut===e.id;this.close(),i||this.open(e,t)}uh(e){this.close();let t=e??(()=>{let r=this.e.n.root.getBoundingClientRect(),o=p("div");return o.style.position="fixed",o.style.left=`${r.right-16}px`,o.style.top=`${r.top+this.e.t.headerHeight}px`,o.style.width="1px",o.style.height="1px",document.body.appendChild(o),this.an=o,o})();this.open(null,t)}close(){this.El(),this.an&&(this.an.remove(),this.an=null),this.w?.remove(),this.w=null,this.ut=null,_(!1,this.ct,this.ht)}destroy(){this.close()}open(e,t){let i=this.e.api,r=p("div","mach-filter-panel mach-column-panel");r.setAttribute("role",e?"menu":"dialog"),e||(r.setAttribute("aria-modal","false"),r.setAttribute("aria-label",this.e.u("columnSettings")));let o=p("div","mach-column-panel-title");o.textContent=e?e.colDef.headerName??e.colDef.field??e.id:this.e.u("columnSettings"),r.appendChild(o);let s=(c,h,f="mach-column-panel-btn")=>U(f,this.e.u(c),()=>{h(),this.close()});if(e){let c=e.id,h=(...f)=>{let m=p("div","mach-column-panel-actions");m.append(...f),r.appendChild(m)};e.sortable&&h(s("sortAsc",()=>i.sorting.setModel([{colId:c,direction:"asc"}])),s("sortDesc",()=>i.sorting.setModel([{colId:c,direction:"desc"}])),s("clearSort",()=>i.sorting.setModel([]))),h(s("pinLeft",()=>i.columns.setPinned(c,"left")),s("pinRight",()=>i.columns.setPinned(c,"right")),s("clearPin",()=>i.columns.setPinned(c,null))),h(s("autoSize",()=>i.columns.autoSize(c)),s("hideColumn",()=>i.columns.setVisible(c,!1)))}let a=p("div","mach-column-panel-divider");r.appendChild(a);let l=p("div","mach-column-panel-subtitle");if(l.textContent=this.e.u("columnVisibility"),r.appendChild(l),!e){let c=p("input","mach-column-workbench-search");c.type="search",c.placeholder=this.e.u("search"),c.setAttribute("aria-label",this.e.u("search")),c.value=this.ln,c.addEventListener("input",()=>{this.ln=c.value.trim().toLocaleLowerCase(),this.es(d,!0)}),r.appendChild(c)}let d=p("div","mach-column-panel-list");this.es(d,!e),r.appendChild(d);let u=p("div","mach-filter-footer");u.append(s("resetAll",()=>i.columns.resetState(),"mach-filter-btn-reset"),s("autoSizeAll",()=>i.columns.autoSizeAll(),"mach-filter-btn-apply")),r.appendChild(u),A(r,this.e.n.root),document.body.appendChild(r),this.w=r,this.ut=e?e.id:"__standalone__",ee(r,t),_(!0,this.ct,this.ht)}ts(){if(!this.w)return;let e=this.w.querySelector(".mach-column-panel-list");e&&this.es(e,this.ut==="__standalone__")}es(e,t){let i=this.e.api;this.El(e),e.replaceChildren();let r=this.e.r.Z().filter(o=>o.isDetailToggle?!1:!t||!this.ln?!0:`${o.colDef.headerName??o.colDef.field??o.id} ${o.id}`.toLocaleLowerCase().includes(this.ln));for(let o of r){let s=p("div",t?"mach-column-workbench-item":"mach-filter-set-item"),a=p("label","mach-column-workbench-label"),l=p("input");l.type="checkbox",l.checked=!o.hide,l.disabled=o.hasCheckbox,l.addEventListener("change",()=>{i.columns.setVisible(o.id,l.checked),this.ts()});let d=p("span","mach-column-workbench-name");if(d.textContent=o.colDef.headerName??o.colDef.field??o.id,d.title=`${d.textContent} (${o.id})`,a.append(l,d),s.appendChild(a),t){let u=ae({ariaLabel:`${d.textContent} ${this.e.u("clearPin")}`,options:[{value:"",label:this.e.u("clearPin")},{value:"left",label:this.e.u("pinLeft")},{value:"right",label:this.e.u("pinRight")}],value:o.pinned??"",classNames:{root:"mach-column-workbench-pin-control",native:"mach-column-workbench-pin"},themeSource:this.e.n.root,onChange:m=>{i.columns.setPinned(o.id,m==="left"||m==="right"?m:null),this.ts()}});u.trigger.disabled=!o.movable,u.native.disabled=!o.movable,this.ir.add(u),s.appendChild(u.el);let c=this.e.r.Z().filter(m=>!m.hide&&m.parentGroup===o.parentGroup&&(o.parentGroup!=null||m.pinned===o.pinned)),h=c.indexOf(o),f=(m,g,b)=>{let w=U("mach-column-workbench-move",m,()=>{i.columns.move(o.id,g),this.ts()});return w.disabled=b||o.hide||!o.movable,w};s.append(f("\u2191",h-1,h<=0),f("\u2193",h+1,h<0||h>=c.length-1))}e.appendChild(s)}}ch(e){for(let t of this.ir)if(t.contains(e))return!0;return!1}El(e){for(let t of this.ir)e&&!e.contains(t.el)||(t.destroy(),this.ir.delete(t))}};var Ot=class{constructor(e){this.e=e;this.w=null;this.ct=e=>{this.w&&!this.w.contains(e.target)&&this.close()};this.ht=e=>{e.key==="Escape"&&this.close()}}hh(e){if(e){let o=this.e.i.h(e.rowIndex),s=this.e.r.x(e.colId);return o&&s?{node:o,column:s}:null}let t=this.e.s.ai();if(!t)return null;let i=this.e.i.h(t.r1),r=this.e.r.l()[t.c1];return i&&r?{node:i,column:r}:null}ph(e,t){let i=this.e.t.getContextMenuItems;if(!i)return null;try{return i({data:e.data,node:e,api:this.e.api,colId:t.id,value:this.e.d(e,t),rowIndex:e.rowIndex})??null}catch(r){return this.e.reportError(r,"getContextMenuItems",{colId:t.id,rowId:e.id}),null}}fh(e,t,i,r){let o=!1;for(let s of t){if(s.separator){e.appendChild(p("div","mach-context-menu-separator"));continue}let a=p("button","mach-context-menu-item");a.type="button",a.textContent=s.label??"",s.danger&&a.classList.add("mach-context-menu-item--danger"),a.disabled=s.disabled===!0,a.disabled||(o=!0,a.addEventListener("click",()=>this.mh(s,i,r))),e.appendChild(a)}return o}mh(e,t,i){this.close();try{e.action?.()}catch(r){this.e.reportError(r,"contextMenu.action",{colId:i.id,rowId:t.id})}}gh(e){let t=this.e,i=(r,o)=>{e.append(U("mach-context-menu-item",t.u(r),()=>{o(),this.close()}))};t.t.suppressClipboard||(i("menuCopy",()=>{t.Sl()}),i("menuPaste",()=>{t.yh()})),i("menuClearContents",()=>{let r=t.s.ai();r&&t._o(r)})}open(e,t,i){this.close();let r=this.hh(i);if(!r)return;let o=p("div","mach-context-menu");if(o.setAttribute("role","menu"),this.e.t.getContextMenuItems){let s=this.ph(r.node,r.column);if(!s||!this.fh(o,s,r.node,r.column))return;this.Ml(o,e,t);return}this.gh(o),this.Ml(o,e,t)}Ml(e,t,i){A(e,this.e.n.root),document.body.appendChild(e),this.w=e;let r=e.getBoundingClientRect(),o=T(t,8,Math.max(8,window.innerWidth-r.width-8)),s=T(i,8,Math.max(8,window.innerHeight-r.height-8));e.style.left=`${o}px`,e.style.top=`${s}px`,_(!0,this.ct,this.ht)}close(){this.w&&(this.w.remove(),this.w=null,_(!1,this.ct,this.ht))}destroy(){this.close()}};var Ht=class{constructor(e){this.e=e;this.w=null;this.dn=0;this.un=null;this.cn=e=>{if(this.e.o()||!this.e.t.tooltipComponent)return;let i=e.target.closest(".mach-cell");if(!i||i===this.un)return;this.Al(),this.rs(),this.un=i;let r=this.vh(i);if(!r||i.classList.contains("mach-cell--editing"))return;let o=this.bh(r.node,r.column,r.index);this.wh(o,r.column)&&(this.dn=window.setTimeout(()=>{this.e.o()||this.un!==i||this.Ch(i,o)},Math.max(0,this.e.t.tooltipShowDelay)))};this.Il=()=>{this.hide()}}init(){S(this.e.n.ye,!0,{mouseover:this.cn,mouseleave:this.Il})}destroy(){this.hide(),S(this.e.n.ye,!1,{mouseover:this.cn,mouseleave:this.Il})}hide(){this.Al(),this.rs(),this.un=null}Al(){this.dn&&(clearTimeout(this.dn),this.dn=0)}rs(){this.w?.remove(),this.w=null}vh(e){let t=e.dataset.colId??"",i=Number(e.closest(".mach-row")?.dataset.index);if(Number.isNaN(i))return null;let r=this.e.i.h(i),o=t?this.e.r.x(t):void 0;return!r||!o||r.isDetail||r.isGroup?null:{node:r,column:o,index:i}}bh(e,t,i){return{data:e.data,node:e,api:this.e.api,colId:t.id,value:this.e.d(e,t),formatted:ye(this.e,e,t),rowIndex:i}}wh(e,t){let i=t.colDef.tooltipValueGetter;if(!i)return!!e.formatted;try{i({...e,colDef:t.colDef,column:t})}catch(r){this.e.reportError(r,"tooltipValueGetter",{colId:t.id,rowId:e.node.id})}return!0}Ch(e,t){this.rs();let i=this.e.t.tooltipComponent;if(!i)return;let r=p("div","mach-tooltip");r.setAttribute("role","tooltip");let o;try{o=i(t)}catch(s){this.e.reportError(s,"tooltipComponent",{colId:t.colId,rowIndex:t.rowIndex});return}typeof o=="string"?r.textContent=o:r.appendChild(o),A(r,this.e.n.root),document.body.appendChild(r),this.w=r,ee(r,e,6)}};var Vt=class{constructor(e){this.e=e;this.re=null}init(){this.re=p("div","mach-watermark"),this.re.setAttribute("aria-hidden","true"),this.re.style.pointerEvents="none",this.e.n.root.appendChild(this.re),this.apply()}apply(){if(!this.re||this.e.o())return;let e=this.e.t.watermarkEnabled?this.e.t.watermarkConfig:null;if(!e||!e.text){this.re.style.display="none",this.re.style.backgroundImage="";return}let t=this.Th(e);this.re.style.display="",t?(this.re.style.backgroundImage=`url(${t})`,this.re.style.backgroundColor=""):this.re.style.backgroundImage=""}Th(e){try{let t=p("canvas"),i=t.getContext("2d");if(!i)return null;let r=e.fontSize??14,o=e.gap??160,s=e.angle??-22,a=e.color??(this.Dh()?"rgba(255,255,255,0.9)":"rgba(31,55,88,0.9)"),l=e.opacity??.06;i.font=`500 ${r}px sans-serif`;let d=i.measureText(e.text),u=Math.ceil(d.width),c=Math.max(o,u+40);t.width=c,t.height=c;let h=t.getContext("2d");return h.clearRect(0,0,c,c),h.globalAlpha=l,h.fillStyle=a,h.font=`500 ${r}px sans-serif`,h.translate(c/2,c/2),h.rotate(s*Math.PI/180),h.textAlign="center",h.textBaseline="middle",h.fillText(e.text,0,0),t.toDataURL("image/png")}catch{return null}}Dh(){return this.e.n.root.classList.contains("mach-theme-dark")}refresh(){this.apply()}destroy(){this.re?.remove(),this.re=null}};var Bt=class{constructor(e){this.e=e;this.q=[];this.de=-1;this.Pe=null}Qi(){this.e.P.Qi(),this.Pe===null&&(this.Pe=[])}er(){let e=this.Pe;this.Pe=null,e&&e.length&&this.push(e),this.e.P.er()}ns(e){let t=this.Pe;t?t.push(e):t!==!1&&this.push([e])}push(e){this.e.t.undoStackSize!==0&&(this.q.length=this.de+1,this.q.push(e),this.de++,this.kl())}kl(){let e=this.e.t.undoStackSize;if(e===0){this.clear();return}for(;this.q.length>e;)this.q.shift(),this.de--;this.de<-1&&(this.de=-1)}canUndo(){return this.de>=0}canRedo(){return this.de<this.q.length-1}undo(){if(this.e._e(),!this.canUndo())return!1;let e=this.q[this.de--];return this.apply(e,!1),!0}redo(){return this.e._e(),this.canRedo()?(this.apply(this.q[++this.de],!0),!0):!1}apply(e,t){let i=this.e,r=[],o=this.q;i.P.Qi();try{for(let s of e){if(o!==this.q&&(o=this.q,!o.includes(e)))break;let a=i.i.F(s.rowId),l=i.r.x(s.colId);if(!a||!l||a.data==null)continue;let d=t?s.newValue:s.oldValue,u=t?s.oldValue:s.newValue;!l.colDef.valueGetter&&!l.colDef.valueSetter&&!Object.is(i.d(a,l),u)||i.sn(a,l,d,u)&&(a.rowIndex>=0&&r.push(a.rowIndex),i.Ji(a,l,u,d,"undo"))}Q(i,r)}finally{i.P.er()}}Wu(e){if(e.length===0||!this.q.length&&!this.Pe)return;let t=new Set(e),i=o=>o.some(s=>t.has(s.rowId)),r=this.de;this.q=this.q.filter((o,s)=>i(o)?(s<=r&&this.de--,!1):!0),this.Pe&&i(this.Pe)&&(this.Pe=!1)}clear(){this.q=[],this.de=-1,this.Pe=null}};var _t=class{constructor(e){this.e=e;this.K=new Map;this.os=!1;this.ss=0;this.hn=!1;this.as=null}Qi(){this.ss++}er(){--this.ss===0&&this.hn&&this.rr()}init(){this.as=this.e.ue.on("cellValueChanged",e=>{this.os||this.ns(e)})}ns(e){let{rowNode:t,column:i,oldValue:r,newValue:o}=e,s=`${t.id}\0${i.id}`,a=this.K.get(s),l=a?a.originalValue:r;Object.is(o,l)?this.K.delete(s):this.K.set(s,{rowId:t.id,colId:i.id,originalValue:l,value:o}),this.rr()}getDirtyRowIds(){let e=new Set;for(let{rowId:t}of this.K.values())e.add(t);return[...e]}getChanges(){let e=new Map;for(let t of this.K.values()){let i=e.get(t.rowId);if(!i){let r=this.e.i.F(t.rowId);if(!r?.data)continue;i={rowId:t.rowId,data:r.data,cells:[]},e.set(t.rowId,i)}i.cells.push({colId:t.colId,originalValue:t.originalValue,value:t.value})}return[...e.values()]}markSaved(e){if(!e)this.K.clear();else{let t=new Set(e);for(let[i,r]of this.K)t.has(r.rowId)&&this.K.delete(i)}this.rr()}xh(e){for(let t of e)for(let i of t.cells){let r=`${t.rowId}\0${i.colId}`,o=this.K.get(r);if(o){Object.is(o.value,i.value)?this.K.delete(r):o.originalValue=i.value;continue}let s=this.e.i.F(t.rowId),a=this.e.r.x(i.colId);if(!s||!a||s.data==null)continue;let l=this.e.d(s,a);Object.is(l,i.value)||this.K.set(r,{rowId:t.rowId,colId:i.colId,originalValue:i.value,value:l})}this.rr()}rollback(e){let t=e?new Set(e):null,i=[...this.K].filter(([,s])=>!t||t.has(s.rowId));if(!i.length)return!1;let r=new Set,o=[];this.os=!0;try{for(let[s,a]of i){let l=this.e.i.F(a.rowId),d=this.e.r.x(a.colId);if(!l||!d||l.data==null)continue;let u=this.e.d(l,d);if(!Object.is(u,a.originalValue)){if(!this.e.sn(l,d,a.originalValue,u))continue;l.rowIndex>=0&&r.add(l.rowIndex),this.e.Ji(l,d,u,a.originalValue,"rollback")}o.push(s)}}finally{this.os=!1}for(let s of o)this.K.delete(s);return Q(this.e,[...r]),this.rr(),o.length>0}Ku(e){e.length&&this.markSaved(e)}clear(){this.K.size&&this.markSaved()}destroy(){this.as?.(),this.as=null,this.K.clear(),this.hn=!1}rr(){this.hn=this.ss>0,this.hn||this.e.emit("dirtyStateChanged",{dirtyRowIds:this.getDirtyRowIds()})}};var qi=class{constructor(){this.nr=null;this.pn=0;this.Pl=0;this.Gl=0}acquire(){this.pn++,this.Rh();let e=!1;return()=>{e||(e=!0,this.pn=Math.max(0,this.pn-1),this.pn===0&&this.disconnect())}}snapshot(){return{count:this.Pl,totalMs:this.Gl}}Rh(){if(!(this.nr||typeof PerformanceObserver>"u"))try{this.nr=new PerformanceObserver(e=>{for(let t of e.getEntries())this.Pl++,this.Gl+=t.duration}),this.nr.observe({entryTypes:["longtask"]})}catch{this.disconnect()}}disconnect(){let e=this.nr;this.nr=null;try{e?.disconnect()}catch{}}},zt=new qi;function ji(){return typeof performance<"u"&&typeof performance.now=="function"?performance.now():Date.now()}var Wt=class{constructor(){this.Ft=[];this.fn=[];this.mn=[];this.ls=zt.acquire(),this.gn=zt.snapshot()}start(){return ji()}Eh(e,t,i){this.Ft.push({duration:Math.max(0,ji()-e),rows:t,columns:i}),this.Ft.length>120&&this.Ft.shift()}Sh(e){this.Ll(this.fn,e)}$a(e){this.Ll(this.mn,e)}snapshot(){let e=this.Ft.map(r=>r.duration),t=this.Ft[this.Ft.length-1],i=zt.snapshot();return{sampleCount:e.length,lastRenderMs:t?.duration??0,averageRenderMs:this.Mh(e),maxRenderMs:Math.max(0,...e),p95RenderMs:this.ds(e),longRenderCount:e.filter(r=>r>16.7).length,renderedRows:t?.rows??0,renderedColumns:t?.columns??0,renderedCells:(t?.rows??0)*(t?.columns??0),layoutSampleCount:this.fn.length,p95LayoutMs:this.ds(this.fn),modelSampleCount:this.mn.length,p95ModelMs:this.ds(this.mn),longTaskCount:Math.max(0,i.count-this.gn.count),longTaskTotalMs:Math.max(0,i.totalMs-this.gn.totalMs),usedHeapBytes:this.usedHeapBytes()}}reset(){this.Ft=[],this.fn=[],this.mn=[],this.gn=zt.snapshot()}destroy(){this.ls?.(),this.ls=null}Ll(e,t){e.push(Math.max(0,ji()-t)),e.length>120&&e.shift()}Mh(e){return e.length===0?0:e.reduce((t,i)=>t+i,0)/e.length}usedHeapBytes(){let e=typeof performance>"u"?void 0:performance.memory?.usedJSHeapSize;return typeof e=="number"&&Number.isFinite(e)?e:null}ds(e){if(e.length===0)return 0;let t=[...e].sort((i,r)=>i-r);return t[Math.max(0,Math.ceil(t.length*.95)-1)]??0}};function Yi(n,e){if(!(n==null||e==null))return[...new Set([...n,...e])]}function Zs(n,e){return n===!0||e===!0?!0:n?e?{rowIds:Yi(n.rowIds,e.rowIds),rowIndexes:Yi(n.rowIndexes,e.rowIndexes),columns:Yi(n.columns,e.columns),force:n.force===!0||e.force===!0,includePinned:n.includePinned===!0||e.includePinned===!0}:n:e}var Qs=["columns","header","pool","data","layout","pinned","summary","overlays"];function ea(n,e){let t={cells:Zs(n.cells,e.cells)};for(let i of Qs)t[i]=n[i]===!0||e[i]===!0;return t}var $t=class{constructor(e){this.apply=e;this.Ot=0;this.pt=null;this.Nl=0;this.Fl=0;this.Ol=0;this.yn=!1}batch(e){if(this.yn)return e();this.Ot++;try{return e()}finally{this.Ot--,this.Ot===0&&this.flush()}}Hl(e){this.yn||(this.Fl++,this.pt&&this.Ol++,this.pt=ea(this.pt??{},e),this.Ot===0&&this.flush())}flush(){if(this.yn||this.Ot>0||!this.pt)return;let e=this.pt;this.pt=null,this.Nl++,this.apply(e)}snapshot(){return{batchDepth:this.Ot,flushCount:this.Nl,requestCount:this.Fl,coalescedRequestCount:this.Ol,pending:this.pt!=null}}destroy(){this.yn=!0,this.pt=null,this.Ot=0}};var wn=Symbol.for("mach-table.adapter.lifecycle.v1");function Cn(n,e){Object.defineProperty(n,wn,{value:e})}function Xi(n){let e=n[wn]?.rowDrag;return e?.policy===n.getOption("rowDragPolicy")?e?.factory:void 0}var Tn=Symbol.for("mach-table.import.v1");function Dn(n,e){Object.defineProperty(n,Tn,{value:{begin:()=>e.B.nn(),revision:()=>e.i.Ve(),isEditing:()=>e.a.isEditing(),columns:()=>e.r.Z(),visibleColumns:()=>e.r.l(),read:(i,r)=>e.d(i,r),editable:(i,r)=>e.a.ae(i,r),parse:(i,r,o,s)=>pe(e,i,r,o,"import",s),pasteRows:i=>{let r=[];for(let o of e.i.It())if(!o.isGroup&&!o.isDetail&&r.push(o),r.length>=i)break;return r},resolveId:(i,r)=>e.t.resolveRowId?.({data:i,index:r,api:n}),validate:(i,r)=>e.B.Xo(i,r),guard:i=>e.B.tn(i),commitRows:(i,r,o)=>e.B.Dl(i,r,o)}})}function xn(n){let e=n[Tn];if(!e)throw new TypeError("Import plans require a MachTable GridApi");return e}function ta(n,e,t,i){let r=n.columns().filter(c=>c.colDef.field),o=t.columns??e,s=new Map(r.map(c=>[c.id,c])),a=new Map,l=new Map;for(let c of r){let h=c.colDef.field;a.set(h,a.has(h)?null:c);let f=c.colDef.headerName;f&&l.set(f,l.has(f)?null:c)}let d=[],u=new Set;return o.forEach((c,h)=>{let f=(typeof c=="string"||typeof c=="number"?String(c):"").replace(/^\uFEFF/,"").trim(),m=s.get(f)??(a.has(f)?a.get(f):l.get(f));if(!m){if(i||t.columns||a.has(f)||l.has(f))throw new TypeError(`Unknown or ambiguous import column: ${f}`);return}if(u.has(m.colDef.field))throw new TypeError(`Duplicate import column: ${m.id}`);u.add(m.colDef.field),d.push({column:m,index:h})}),d.length?d:n.visibleColumns().filter(c=>c.colDef.field).map((c,h)=>({column:c,index:h}))}function ia(n,e){if(!Array.isArray(n)||n.some(t=>!Array.isArray(t)))throw new TypeError("Import requires an array of rows");if(!Number.isInteger(e)||e<-1||e>=n.length)throw new RangeError("Invalid import header row");if(n.length-e-1>1e4||n.reduce((t,i)=>t+i.length,0)>1e5)throw new RangeError("Import supports 10000 data rows and 100000 cells")}function ra(n,e,t,i,r,o){let s=t.colDef.field,a=n.read(e.node,t),l=o.parseValue?o.parseValue({value:r,field:s,rowIndex:e.rowIndex,columnIndex:i}):t.colDef.valueParser?n.parse(e.node,t,r,a):Rt(r,o.coerceNumbers!==!1);if(k(l))throw new TypeError("Import parsers must return synchronous values");if(!ve(e.data,s,l))throw new TypeError(`Unsafe import field: ${s}`);e.changes.push({node:e.node,column:t,oldValue:a,newValue:l})}function na(n,e,t,i,r,o,s,a){let l=a?.[t]??{},d=s?.[t]??{id:`import:${t}`,rowIndex:t,data:l,selected:!1},u={data:l,node:d,changes:[],rowIndex:t};for(let{column:c,index:h}of i)if(!(e[h]===void 0||s&&!n.editable(d,c)))try{ra(n,u,c,h,e[h],r)}catch(f){o.issues.push({rowIndex:t,columnIndex:h,colId:c.id,code:"PARSE",message:f instanceof Error?f.message:String(f)})}o.rows.push(u)}function Rn(n,e,t={},i,r=!1,o){let s=t.headerRowIndex??(t.columns?-1:0);ia(e,s);let a=ta(n,s<0?[]:e[s],t,r);if(!a.length)throw new TypeError("Import requires a writable field column");let l={rows:[],issues:[]};for(let d=s+1;d<e.length;d++){let u=e[d];u.some(c=>c!==""&&c!==void 0)&&na(n,u,d-s-1,a,t,l,i,o)}return l}function fe(n){return(n==null?"":String(n)).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function Kt(n,e,t="text/plain;charset=utf-8"){try{if(typeof document>"u"||typeof Blob>"u")return!1;let i=document.createElement("a");if(typeof URL<"u"&&typeof URL.createObjectURL=="function"){let r=new Blob([e],{type:t}),o=URL.createObjectURL(r);i.href=o,i.download=n,i.click();let s=typeof URL.revokeObjectURL=="function"?URL.revokeObjectURL.bind(URL):null;s&&setTimeout(()=>{try{s(o)}catch{}},0)}else i.href=`data:${t},${encodeURIComponent(e)}`,i.download=n,i.click();return!0}catch{return!1}}var Ut=["gridReady","gridDestroyed","modelUpdated","cellClicked","cellDoubleClicked","cellContextMenu","rowClicked","rowDoubleClicked","selectionChanged","sortChanged","filterChanged","columnResized","columnMoved","columnVisibilityChanged","cellValueChanged","cellEditingStarted","cellEditingStopped","rowEditingStarted","rowEditingStopped","detailToggled","treeChildrenLoaded","treeChildrenLoadFailed","rowDragEnd","rangeSelectionChanged","paginationChanged","displayedColumnsChanged","gridError","dirtyStateChanged"];var Se={columnDefs:"array",rowData:"array",defaultColDef:"object",columnTypes:"object",rowKey:"unknown",rowHeight:"number",headerHeight:"number",rowBuffer:"number",columnLayout:"string",enableColumnResize:"boolean",domLayout:"string",maxBodyHeight:"number",rowSelection:"string",multiSort:"boolean",size:"string",stripedRows:"boolean",rowStyleRules:"array",showCellBorders:"boolean",theme:"string",quickFilterText:"string",advancedFilterModel:"object",masterDetail:"boolean",detailRowHeight:"number",detailRowRenderer:"function",isRowExpandable:"function",detailToggleColumn:"boolean",columnMenu:"boolean",aggFuncs:"object",components:"object",actionPolicy:"object",features:"array",initialState:"object",persistence:"boolean-object",locale:"object",editType:"string",editableIndicator:"string",rowEditValidator:"function",singleClickEdit:"boolean",manualSorting:"boolean",manualFiltering:"boolean",showSummary:"boolean",summaryMethod:"function",treeData:"boolean",childrenKey:"string",isTreeRowExpandable:"function",loadTreeChildren:"function",autoCheckedChildren:"boolean",defaultExpandAll:"boolean",rowNumber:"boolean",indexOffset:"number",applyRowDrag:"boolean",rowDragPolicy:"object",undoStackSize:"number",asyncTransactionWaitMillis:"number",getRowHeight:"function",pinnedTopRowData:"array",pinnedBottomRowData:"array",pagination:"boolean-object",watermark:"boolean-object",suppressWarnings:"boolean",enableRangeSelection:"boolean",suppressClipboard:"boolean",contextMenu:"boolean",getContextMenuItems:"function",tooltipComponent:"function",tooltipShowDelay:"number",flashCells:"boolean",fillHandle:"boolean",statusBar:"boolean-object",datasource:"object",datasourceMode:"string",blockSize:"number",infiniteBufferRows:"number",maxBlocksInCache:"number",datasourceMaxConcurrentRequests:"number",blockPrefetch:"number",datasourceRowCount:"number",dataProcessor:"object-function",dataProcessorMinRows:"number",datasourceRetryCount:"number",datasourceRetryDelay:"number",datasourceRetryJitter:"number",suppressCellFocus:"boolean",suppressRowHoverHighlight:"boolean",suppressNoRowsOverlay:"boolean",suppressHeaderFocus:"boolean",ariaLabel:"string",ariaLabelledBy:"string",ariaDescribedBy:"string",loading:"boolean",error:"unknown",overlayNoRowsTemplate:"unknown",overlayLoadingTemplate:"unknown",overlayErrorTemplate:"unknown",allowUnsafeOverlayHtml:"boolean",className:"string"};var Ji=Object.freeze(Object.keys(Se));var $e=new Set(Ut.map(n=>`on${n.charAt(0).toUpperCase()}${n.slice(1)}`));function Zi(n,e){let t=Se[n];return e==null||t==="unknown"?!0:t==="array"?Array.isArray(e):t==="number"?x(e,n==="maxBodyHeight"?1:-1/0)!==void 0:t==="boolean-object"&&typeof e=="boolean"||t==="object-function"&&typeof e=="function"?!0:t==="object"||t==="boolean-object"||t==="object-function"?typeof e=="object"&&!Array.isArray(e):typeof e===t}function En(n){let e={};for(let[t,i]of Object.entries(n)){if($e.has(t)){(i==null||typeof i=="function")&&(e[t]=i);continue}!v(Se,t)||!Zi(t,i)||(e[t]=i)}return e}var Mn=2e3,Qi=1e5,Ke=512,sa=1e4;function Sn(n){return Array.isArray(n)?[...new Set(n.slice(0,Qi).filter(e=>typeof e=="string"&&e.length>0&&e.length<=Ke))]:[]}function aa(n){if(!Array.isArray(n))return[];let e=new Set,t=Qi*Ke;for(let i of n.slice(0,Qi)){if(typeof i!="string"||!i.length||e.has(i))continue;let r=i.startsWith(vt)?65536:Ke;i.length>r||i.length>t||(e.add(i),t-=i.length)}return[...e]}function la(n,e){let t=I(e.flex);for(let i of["width","contentWidth"]){let r=I(e[i]);r!==void 0&&(n[i]=r)}e.flex===null?n.flex=null:t!==void 0&&(n.flex=t),(e.widthMode==="auto"||e.widthMode==="manual")&&(n.widthMode=e.widthMode)}function da(n,e){typeof e.hide=="boolean"&&(n.hide=e.hide),(e.pinned===null||e.pinned==="left"||e.pinned==="right")&&(n.pinned=e.pinned)}function ua(n,e){if(n==null||typeof n!="object")return null;let t=n,i=typeof t.colId=="string"?t.colId.trim():"";if(!i||i.length>Ke||e.has(i))return null;e.add(i);let r={colId:i};return da(r,t),la(r,t),r}function ca(n){if(!Array.isArray(n))return[];let e=[],t=new Set;for(let i of n.slice(0,Mn)){let r=ua(i,t);r&&e.push(r)}return e}function ha(n){if(!Array.isArray(n))return[];let e=[],t=new Set;for(let i of n.slice(0,Mn)){if(i==null||typeof i!="object")continue;let r=i,o=typeof r.colId=="string"?r.colId.trim():"";!o||o.length>Ke||t.has(o)||r.direction!=="asc"&&r.direction!=="desc"||(t.add(o),e.push({colId:o,direction:r.direction}))}return e}function q(n){if(n==null||typeof n!="object")return null;let e=n;if(e.version!==2||!Array.isArray(e.columns)||!Array.isArray(e.sortModel))return null;let t=e.pagination!=null&&typeof e.pagination=="object"?e.pagination:{};return{version:2,columns:ca(e.columns),sortModel:ha(e.sortModel),filterModel:te(e.filterModel),advancedFilterModel:H(e.advancedFilterModel),quickFilterText:typeof e.quickFilterText=="string"&&e.quickFilterText.trim()?e.quickFilterText.slice(0,sa):null,pagination:{enabled:t.enabled===!0,page:E(t.page,1,1,!0),pageSize:E(t.pageSize,20,1,!0)},selectedRowIds:Sn(e.selectedRowIds),expandedRowIds:Sn(e.expandedRowIds),expandedGroupIds:aa(e.expandedGroupIds)}}function In(n,e){let t=q(n);if(!t)throw new TypeError("[MachTable] Cannot persist an invalid GridState snapshot.");let i=new Set(e);return{version:2,columns:i.has("columns")?t.columns:[],sortModel:i.has("sort")?t.sortModel:[],filterModel:i.has("filter")?t.filterModel:{},advancedFilterModel:i.has("filter")?t.advancedFilterModel:null,quickFilterText:i.has("filter")?t.quickFilterText:null,pagination:i.has("pagination")?t.pagination:{enabled:!1,page:1,pageSize:20},selectedRowIds:i.has("selection")?t.selectedRowIds:[],expandedRowIds:i.has("expansion")?t.expandedRowIds:[],expandedGroupIds:i.has("expansion")?t.expandedGroupIds:[]}}function pa(n){try{if(typeof structuredClone=="function")return structuredClone(n)}catch{}return Array.isArray(n)?[...n]:n!=null&&typeof n=="object"?{...n}:n}function kn(n,e){let t=e?new Set(e.map(String)):null;return n.filter(i=>!t||t.has(i.rowId)).map(i=>({...i,data:pa(i.data),cells:i.cells.map(r=>({...r}))}))}function fa(n,e){let t=typeof n?.rowId=="string"?n.rowId:"";return!e.has(t)||typeof n.message!="string"||!n.message.trim()?null:{...n,rowId:t,message:n.message.trim(),...typeof n.code=="string"&&n.code.trim()?{code:n.code.trim()}:{},...Array.isArray(n.colIds)?{colIds:[...new Set(n.colIds.filter(i=>typeof i=="string"&&i.length>0))]}:{}}}function An(n,e){let t=new Map;for(let i of n??[]){let r=fa(i,e);r&&!t.has(r.rowId)&&t.set(r.rowId,r)}return[...t.values()]}function Pn(n,e){let t=new Set(n.map(d=>d.rowId)),i=An(e?.conflicts,t),r=new Set(i.map(d=>d.rowId)),o=An(e?.failures,t).filter(d=>!r.has(d.rowId)),s=new Set([...o,...i].map(d=>d.rowId)),a=e?.savedRowIds==null?null:new Set(e.savedRowIds.map(String).filter(d=>t.has(d))),l=n.filter(d=>!s.has(d.rowId)&&(a==null||a.has(d.rowId)));return{submitted:n,saved:l,failures:o,conflicts:i}}function ma(n,e){if(e.serverData===void 0)return null;let t=n.rows.getById(e.rowId);if(!t||t.data==null)return null;let i=n.getOption("rowKey");if(i){let s=typeof i=="function"?i(e.serverData):z(e.serverData,i);return String(s)===e.rowId?{data:e.serverData,mergeIntoCurrent:!1}:null}let r=t.data;return r!=null&&e.serverData!=null&&typeof r=="object"&&typeof e.serverData=="object"?{data:r,mergeIntoCurrent:!0}:null}function Gn(n,e,t){if(n.isDestroyed())return!1;if(t==="keepLocal")return!0;let i=ma(n,e);return i?(n.editing.rollback([e.rowId]),i.mergeIntoCurrent&&Object.assign(i.data,e.serverData),n.rows.transact({update:[i.data]}),n.editing.markSaved([e.rowId]),!0):!1}var ga=["compact","normal","large"],C=["left","center","right"];function qt(n,e){let t=n.t,i;if(e==="loading")i=t.overlayLoadingTemplate||n.Ih();else if(e==="noRows")i=t.overlayNoRowsTemplate||n.Ah();else if(e==="error")i=t.overlayErrorTemplate||n.kh();else{n.n.Ph();return}n.n.Gh(e,i,t.allowUnsafeOverlayHtml)}var jt=class{constructor(e){this.e=e;this.ar=null;this.hs=null;this.ps=!1;this.Cn=null;this.fs=[];this.Tn=null;this.ui=0;this.Vl=-1;this.Bl=-1;this.Yt=1;this.ms=()=>{document.fonts.ready.then(this.$l)};this.$l=()=>{this.ui||this.e.o()||(this.ui=requestAnimationFrame(()=>{this.ui=0,this.e.Ie()}))};this.ci=null}init(e,t){let i=["mach-root",`mach-size--${t.size}`];t.stripedRows&&i.push("mach-striped"),t.showCellBorders&&i.push("mach-cell-borders"),t.domLayout==="autoHeight"&&i.push("mach-dom-layout--auto-height"),this.root=p("div",i.join(" ")),this._l(t.className),this.root.style.setProperty("--mach-row-h",`${t.rowHeight}px`),this.root.style.setProperty("--mach-header-h",`${t.headerHeight}px`),this.root.setAttribute("role","grid"),this.root.tabIndex=0,this.zl(t),this.or=p("div","mach-header"),this.or.setAttribute("role","rowgroup"),this.sr={left:[],center:[],right:[]},this.us={},this.si={};for(let r of C){let o=p("div",`mach-pane mach-pane--${r} mach-header-pane`),s=p("div","mach-header-rows");if(r==="center"){let a=p("div","mach-header-viewport");a.appendChild(s),o.appendChild(a)}else o.appendChild(s);this.or.appendChild(o),this.us[r]=o,this.si[r]=s}this.Wl(1),this.ye=p("div","mach-body"),this.vn=p("div","mach-pinned-rows mach-pinned-rows--top"),this.vn.style.display="none",this.bn=p("div","mach-pinned-rows mach-pinned-rows--bottom"),this.bn.style.display="none",this.b={},this.ce={},this.cs={};for(let r of C){let o=p("div",`mach-pane mach-pane--${r} mach-body-pane`),s=p("div",`mach-body-viewport${r==="center"?" mach-body-viewport--scroll":""}`),a=p("div","mach-row-container");s.appendChild(a),o.appendChild(s),this.ye.appendChild(o),this.cs[r]=o,this.b[r]=s,this.ce[r]=a}this.$e=p("div","mach-overlay"),this.$e.style.display="none",this.$e.setAttribute("role","status"),this.$e.setAttribute("aria-live","polite"),this.Ke=p("div","mach-overlay-content"),this.$e.appendChild(this.Ke),this.ft=p("div","mach-infinite-loading"),this.ft.style.display="none",this.ft.appendChild(p("div","mach-spinner")),this.wn=p("span"),this.ft.appendChild(this.wn),this.root.append(this.or,this.vn,this.ye,this.bn,this.$e,this.ft),e.appendChild(this.root),document.fonts?.addEventListener("loading",this.ms),document.fonts?.status==="loading"&&this.ms(),typeof ResizeObserver<"u"&&(this.Tn=new ResizeObserver(r=>{let o=r[r.length-1]?.contentRect;if(!o)return;let s=Math.round(o.width),a=Math.round(o.height);s===this.Vl&&a===this.Bl||(this.Vl=s,this.Bl=a,this.$l())}),this.Tn.observe(this.root)),this.Kl(t.theme)}zl(e){e.ariaLabelledBy?(this.root.setAttribute("aria-labelledby",e.ariaLabelledBy),this.root.removeAttribute("aria-label")):(this.root.removeAttribute("aria-labelledby"),this.root.setAttribute("aria-label",e.ariaLabel)),e.ariaDescribedBy?this.root.setAttribute("aria-describedby",e.ariaDescribedBy):this.root.removeAttribute("aria-describedby")}Wl(e){this.Yt=e;for(let t of C){let i=this.si[t],r=this.sr[t];for(;r.length<e;){let o=p("div","mach-header-row");o.setAttribute("role","row"),o.setAttribute("aria-rowindex",String(r.length+1)),i.appendChild(o),r.push(o)}for(;r.length>e;)r.pop().remove()}this.Ul()}jl(){return this.Yt}Ul(){this.or.style.height=`${this.Yt*this.e.t.headerHeight}px`;for(let e of C)this.sr[e].forEach((i,r)=>{i.style.top=`${r*this.e.t.headerHeight}px`,i.style.height=`${this.e.t.headerHeight}px`})}Lh(e,t){this.ql("left",e),this.ql("right",t)}ql(e,t){let i=this.us[e],r=this.cs[e];i.style.width=`${t}px`,r.style.width=`${t}px`;let o=t<=0;i.classList.toggle("mach-pane--hidden",o),r.classList.toggle("mach-pane--hidden",o)}gs(){let e=this.b.center,t=Math.max(0,e.offsetWidth-e.clientWidth);return Math.max(0,this.ye.clientWidth-t)}Nh(e,t){this.root.style.setProperty("--mach-row-h",`${e}px`),this.root.style.setProperty("--mach-header-h",`${t}px`),this.Ul()}Fh(e){for(let t of ga)this.root.classList.toggle(`mach-size--${t}`,t===e)}Kl(e){if(!this.root)return;this.ci?.(),this.ci=null;let t=e==="dark"||e==="auto"&&this.Oh();if(this.root.classList.toggle("mach-theme-dark",t),e==="auto"&&typeof window<"u"&&typeof window.matchMedia=="function"){let i=window.matchMedia("(prefers-color-scheme: dark)"),r=()=>this.root.classList.toggle("mach-theme-dark",i.matches);typeof i.addEventListener=="function"?(i.addEventListener("change",r),this.ci=()=>i.removeEventListener("change",r)):typeof i.addListener=="function"&&(i.addListener(r),this.ci=()=>i.removeListener(r))}}Oh(){return typeof window>"u"||typeof window.matchMedia!="function"?!1:window.matchMedia("(prefers-color-scheme: dark)").matches}Hh(e){this.root.classList.toggle("mach-striped",e)}Vh(e){this.root.classList.toggle("mach-cell-borders",e)}Bh(e){this.root.classList.toggle("mach-dom-layout--auto-height",e==="autoHeight")}_l(e){for(let t of this.fs)this.root.classList.remove(t);this.fs=[];for(let t of String(e??"").split(/\s+/).filter(Boolean))this.root.classList.contains(t)||(this.root.classList.add(t),this.fs.push(t))}_h(e){try{return typeof e=="function"?e():e}catch(t){return this.e.reportError(t,"overlayTemplate"),""}}zh(e,t,i){if(typeof t=="object"&&t!=null&&"el"in t){this.Ke.appendChild(t.el),this.Cn=t.destroy??null;return}if(t instanceof HTMLElement){this.Ke.appendChild(t);return}if(t){i?this.Ke.innerHTML=t:this.Ke.textContent=t;return}if(e!=="loading")return;let r=p("div","mach-spinner");r.setAttribute("aria-label","loading"),this.Ke.appendChild(r)}Gh(e,t,i=!1){this.ar===e&&this.hs===t&&this.ps===i||(this.ar=e,this.hs=t,this.ps=i,this.ys(),this.Ke.replaceChildren(),this.zh(e,this._h(t),i),this.$e.style.display="",this.root.classList.add("mach-has-overlay"),this.$e.setAttribute("role",e==="error"?"alert":"status"),this.root.setAttribute("aria-busy",e==="loading"?"true":"false"))}Ph(){this.ar&&(this.ar=null,this.hs=null,this.ps=!1,this.$e.style.display="none",this.root.classList.remove("mach-has-overlay"),this.ys(),this.Ke.replaceChildren(),this.root.setAttribute("aria-busy","false"))}Et(e,t){this.ft&&(e?(this.wn.textContent!==t&&(this.wn.textContent=t),this.ft.style.display="",this.root.setAttribute("aria-busy","true")):(this.ft.style.display="none",this.ar!=="loading"&&this.root.setAttribute("aria-busy","false")))}destroy(){document.fonts?.removeEventListener("loading",this.ms),this.ci?.(),this.ci=null,this.Tn?.disconnect(),this.Tn=null,this.ui&&cancelAnimationFrame(this.ui),this.ui=0,this.ys(),this.root?.remove()}ys(){if(!this.Cn)return;let e=this.Cn;this.Cn=null;try{e()}catch(t){this.e.reportError(t,"overlayTemplate.destroy")}}};function Ln(n,e){return{setData:t=>n.rt(t),transact:t=>n.Oi(t),transactAsync:(t,i)=>n.Wh(t,i),flushTransactions:()=>n.Yl(),getCount:()=>e.i.G(),getAt:t=>e.i.h(t),getById:t=>e.i.F(t),forEach:t=>e.i.fc(t),forEachDisplayed:t=>e.i.mc(t),reorder:(t,i)=>!e.o()&&!e.a.isEditing()&&e.i.Xa(t,i),isRemote:()=>e.i.g,reload:t=>n.reload(t),ensureLoaded:(t,i,r)=>n.Do(t,i,r),purgeCache:()=>{e.o()||e.i.Ou()},getCacheSnapshot:()=>e.i.Hu()}}function Nn(n,e){return{getDefinitions:()=>e.r.uo(),setDefinitions:t=>n.Ri(t),getState:()=>e.r.ga(),setState:t=>n.$h(t),resetState:()=>n.fo(),setVisible:(t,i)=>n.co(t,i),setPinned:(t,i)=>n.ho(t,i),move:(t,i)=>{e.o()||e.Ei(t,i)},setWidth:(t,i)=>n.Ee(t,i),fit:t=>n.Kh(t),autoSize:t=>n.Uh(t),autoSizeAll:()=>n.jh(),getWorkbenchItems:()=>n.qh(),openWorkbench:t=>{e.o()||e.columnMenu.uh(t)},closeWorkbench:()=>e.columnMenu.close()}}function Fn(n,e){return{getRows:()=>e.f.Ja(),getVisibleRows:()=>n.Yh(),getNodes:()=>e.f.ti(),getIds:()=>e.f.ko(),setRows:(t,i)=>n.Xh(t,i),setById:(t,i,r)=>e.f.bc(t,i,r),selectAll:t=>e.f.selectAll(t),clear:()=>e.f.deselectAll(),getMode:()=>e.t.rowSelection,setMode:t=>n.Jh(t),getRange:()=>e.s.lr(),clearRange:()=>n.li()}}function On(n,e){return{startCell:t=>n.Zh(t),startRow:t=>e.a.startRow(t),isRowActive:t=>e.a.fl(t),stop:t=>e.a.ke(t?.cancel===!0),getChanges:()=>e.P.getChanges(),getDirtyRowIds:()=>e.P.getDirtyRowIds(),markSaved:t=>e.P.markSaved(t),rollback:t=>e.P.rollback(t),save:(t,i)=>n.Qh(t,i),undo:()=>!e.o()&&e.H.undo(),redo:()=>!e.o()&&e.H.redo(),canUndo:()=>e.H.canUndo(),canRedo:()=>e.H.canRedo()}}function Hn(n){return{get:()=>n.getState(),apply:(e,t)=>n.Xl(e,t)}}function Vn(n,e){return{get:()=>e.ep(),getPerformance:()=>e.Ce.snapshot(),resetPerformance:()=>e.Ce.reset()}}function Bn(n,e){return{getModel:()=>e.i.Be(),setModel:t=>n.St(t),getAdvancedModel:()=>e.i.Ni(),setAdvancedModel:t=>n.nt(t),getQuickText:()=>e.i.Eo(),setQuickText:t=>n.Mt(t),isPresent:t=>t==null?e.i.Hi():v(e.i.Be(),t)}}function _n(n,e){return{getModel:()=>e.r.Q(),setModel:t=>n.tp(t)}}function zn(n,e){return{isEnabled:()=>e.i.Te,setEnabled:t=>{e.o()||e.i.ja(t)},getPage:()=>e.i.ei(),setPage:t=>{e.o()||e.i.setPage(t)},getPageSize:()=>e.t.paginationPageSize,setPageSize:t=>{e.o()||e.i.setPageSize(t)},getPageCount:()=>e.i.getPageCount(),getTotalRowCount:()=>e.i.getTotalRowCount()}}function Wn(n,e){return{isRowExpanded:t=>e.i.isRowExpanded(t),setRowExpanded:(t,i)=>e.o()||e.i.isRowExpanded(t)===i?!1:(i?e.i.cc(t):e.i.hc(t),e.i.isRowExpanded(t)===i),isTreeRowLoading:t=>!e.o()&&e.i.isTreeRowLoading(t),loadTreeChildren:(t,i)=>e.o()?Promise.resolve([]):e.i.loadTreeChildren(t,i?.force===!0),isGroupExpanded:t=>e.i.isGroupExpanded(t),setGroupExpanded:(t,i)=>e.o()||e.i.isGroupExpanded(t)===i?!1:(e.i.Io(t),e.i.isGroupExpanded(t)===i),setAllGroupsExpanded:t=>{e.o()||e.i.setAllGroupsExpanded(t)},setAllDetailsExpanded:t=>{e.o()||e.i.setAllDetailsExpanded(t)}}}function $n(n,e){return{getRoot:()=>e.o()?null:e.n.root,scrollToRow:(t,i)=>e.s.jr(t,i),refreshCells:t=>n.refreshCells(t),refreshLayout:()=>n.refreshLayout(),flush:()=>e.hi.flush(),setOverlay:t=>qt(e,t),getPinnedRows:t=>e.Ge.getRows(t),setPinnedRows:(t,i)=>n.setPinnedRows(t,i)}}function Kn(n,e){return{exportCsv:t=>n.ip(t),importCsv:(t,i)=>n.importCsv(t,i),exportMatrix:t=>n.Jl(t),importMatrix:(t,i)=>n.importMatrix(t,i),print:t=>n.print(t),copyRange:()=>e.o()?Promise.resolve(!1):e.Sl()}}function Yt(n){return se(n?.reason,"The operation was aborted")}function Un(n,e){return ft(n,e,()=>Yt(e))}function er(n,e,t,i=!1){let r=x(n,t,i);return r===void 0||r===e?void 0:r}function O(n,e,t){let i=n[t];return i==null||i===e[t]?!1:(e[t]=i,!0)}var tr=class{constructor(e){this.e=e;this.vs=[];this.dr=null}batch(e){return this.e.Zl(()=>e(this.e.api))}rt(e){if(!this.e.o()){if(this.e.i.g){this.e.t.rowData=e??[];return}this.e.i.rt(e),this.e.$({data:!0})}}Oi(e){if(this.e.o()||this.e.i.g)return;let t=this.e.i.Oi(e);this.Ql(t)}Wh(e,t={}){if(this.e.o()||this.e.i.g)return Promise.resolve();if(t.signal?.aborted)return Promise.reject(Yt(t.signal));let i=new Promise((r,o)=>{let s={transaction:e,revision:this.e.i.Ve(),resolve:r,reject:o,signal:t.signal,aborted:!1};t.signal&&(s.onAbort=()=>{s.aborted||(s.aborted=!0,o(Yt(t.signal)))},t.signal.addEventListener("abort",s.onAbort,{once:!0})),this.vs.push(s)});return this.dr==null&&(this.dr=setTimeout(()=>this.Yl(),this.e.t.asyncTransactionWaitMillis)),i}ed(){this.dr!=null&&clearTimeout(this.dr),this.dr=null;let e=this.vs;return this.vs=[],e}Yl(){let e=this.ed(),t=this.e.i,i=t.Ve(),r=e.filter(s=>!s.aborted&&s.revision===i).map(s=>s.transaction);if(r.length>0&&!this.e.o()&&!t.g){let s=t.Uu(r);t.Ve()===i&&this.Ql(s)}let o=t.Ve()===i;for(let s of e)s.signal&&s.onAbort&&s.signal.removeEventListener("abort",s.onAbort),!s.aborted&&(o&&s.revision===i?s.resolve():s.reject(se(void 0,"The table data changed before the transaction could complete")))}Ql(e){if(!(!e.pipelineChanged&&e.updatedRowIds.length===0)){if(e.pipelineChanged||this.e.t.getRowHeight||this.e.r.l().some(t=>t.colDef.autoHeight===!0)){this.e.$({data:!0});return}this.e.$({cells:{rowIds:e.updatedRowIds},summary:!0,overlays:!0})}}Ri(e){this.updateOptions({columnDefs:[...e??[]]})}$h(e){this.e.o()||(this.e.r.ya(e),this.bs())}fo(){this.e.o()||(this.e.r.fo(),this.bs())}co(e,t){this.e.o()||(this.e.r.co(e,t),this.e.ur(),this.e.emit("columnVisibilityChanged",{colId:e,visible:t}))}ho(e,t){this.e.o()||(this.e.r.ho(e,t),this.bs())}bs(){this.e.ur(),this.e.Dn()}Ee(e,t){if(this.e.o())return!1;let i=this.e.r.x(e);return!i||!this.e.r.Ee(i,t)?!1:(this.lt([i]),!0)}Kh(e){if(this.e.o())return;let t=this.e.r.l(),i=t.filter(d=>d.pinned===null&&!d.colDef.suppressSizeToFit);if(i.length===0)return;let r=e??this.e.n.gs();if(!Number.isFinite(r)||r<=0)return;let o=t.reduce((d,u)=>d+(u.pinned!==null||u.colDef.suppressSizeToFit?u.currentWidth:0),0),s=at(i.map(d=>({width:d.currentWidth,minWidth:d.colDef.minWidth,maxWidth:d.colDef.maxWidth})),Math.max(0,r-o)),a=this.e.t.columnLayout!=="normal"&&e===void 0,l=i.filter((d,u)=>a?this.e.r.fa(d,s[u]):this.e.r.Ee(d,s[u]));this.lt(l)}Uh(e){if(this.e.o())return;let t=this.e.r.x(e);t&&this.td(t)&&this.lt([t])}td(e){return this.e.t.columnLayout!=="normal"&&e.colDef.suppressSizeToFit?!1:e.hasCheckbox||e.isDetailToggle?this.e.r.Ee(e,e.isDetailToggle?38:46):this.rp(e,this.e.Ue.ua(e))}rp(e,t){return this.e.t.columnLayout!=="normal"?this.e.r.fa(e,t):this.e.r.Ee(e,t)}jh(){if(this.e.o())return;let e=[];for(let t of this.e.r.l())this.td(t)&&e.push(t);e.length>0&&this.lt(e)}lt(e){this.e.ri(),this.e.lt(e)}tp(e){this.e.o()||(this.e.r.Si(e),this.e.Si())}St(e){this.e.o()||(this.e.i.St(e),this.e.cr())}nt(e){this.e.o()||!this.e.i.nt(e)||this.e.cr()}Mt(e){if(this.e.o())return;let t=this.e.i.Mt(e);this.e.t.quickFilterText=this.e.i.Eo(),t&&this.e.cr()}Jh(e){this.e.t.rowSelection!==e&&this.updateOptions({rowSelection:e})}Xh(e,t=!0){if(this.e.o())return;let i=this.e.t.resolveRowId,r=[];for(let o of e){let s=i?this.e.i.F(this.e.i.resolveRowId(o,-1,`__missing_selection_${this.e.Qt()}`)):this.e.i.Oe().find(a=>a.data===o);s&&r.push({node:s,selected:!0})}r.length>0?this.e.f.kt(r,t):t&&this.e.f.deselectAll()}Yh(){let e=this.e.f;return this.e.i.It().filter(t=>!t.isDetail&&!t.isGroup&&e.$r(t.id)).map(t=>t.data).filter(Boolean)}async Qh(e,t){let i=kn(this.e.P.getChanges(),t);if(i.length===0)return{submitted:[],saved:[],failures:[],conflicts:[]};let r=this.e.i.Ve(),o=Pn(i,await e(i));return!this.e.o()&&r===this.e.i.Ve()&&this.e.P.xh(o.saved),o}setPinnedRows(e,t){if(this.e.o())return;let i=e==="top"?"pinnedTopRowData":"pinnedBottomRowData";this.e.t[i]=t??[],this.e.Ge.setRows(e,this.e.t[i])}li(){this.e.o()||this.e.s.li()}qh(){return this.e.r.Z().filter(e=>!e.isDetailToggle).map(e=>({colId:e.id,label:e.colDef.headerName??e.colDef.field??e.id,visible:!e.hide,pinned:e.pinned,width:e.currentWidth||e.manualWidth||e.colDef.width||0,movable:e.movable,hideable:!e.hasCheckbox}))}refreshLayout(){this.e.o()||(this.e.Ie(),this.e.s.xn(!0))}reload(e={}){return this.e.o()?Promise.resolve():e.signal?.aborted?Promise.reject(Yt(e.signal)):this.e.i.g?Un(this.e.i._r(e.signal),e.signal):(this.rt(this.e.t.rowData),Promise.resolve())}Do(e,t,i={}){return this.e.o()?Promise.resolve():Un(this.e.i.Do(e,t,i.signal),i.signal)}importCsv(e,t={}){if(!e)return!1;let{parseValue:i,...r}=t;return this.importMatrix(Mt(e,t.separator??","),{...r,parseValue:i?o=>i({...o,value:o.value}):void 0})}importMatrix(e,t={}){if(this.e.o()||this.e.i.g||!Array.isArray(e)||!e.length)return!1;try{let i=xn(this.e.api),r=t.mode==="paste"?i.pasteRows(e.length):void 0,o=Rn(i,e,t,r);if(o.issues.length)return this.e.reportError(new Error(o.issues.map(s=>s.message).join("; ")),"import",{issues:o.issues}),!1;if(t.mode==="paste")this.e.pi(o.rows.flatMap(s=>s.changes));else{let s=o.rows.map(a=>a.data);t.mode==="append"?this.Oi({add:s}):this.rt(s)}return!0}catch(i){return this.e.reportError(i,"import"),!1}}print(e={}){if(this.e.o())return!1;try{let t=window.open("","_blank","width=980,height=720");if(!t)return!1;let i=this.e.r.l().filter(d=>X(d)&&!d.colDef.rowDrag),r=this.e.i.Ka().filter(d=>!d.isDetail&&!d.isGroup),s=e.includeHeader!==!1?`<tr>${i.map(d=>`<th>${fe(d.colDef.headerName??d.colDef.field??d.id)}</th>`).join("")}</tr>`:"",a=r.map(d=>`<tr>${i.map(u=>{let c=ye(this.e,d,u);return`<td>${fe(c)}</td>`}).join("")}</tr>`).join(""),l=`<!doctype html><html><head><meta charset="utf-8"><title>${fe(e.title??"MachTable")}</title><style>body{font-family:system-ui,"PingFang SC","Microsoft YaHei",sans-serif;padding:20px}h3{margin:0 0 12px;font-size:16px}table{border-collapse:collapse;width:100%;font-size:12px}th,td{border:1px solid #bbb;padding:5px 8px;text-align:left;word-break:break-all}th{background:#f2f5f9;font-weight:600}@page{margin:12mm}</style></head><body><h3>${fe(e.title??"")}</h3><table>${s}${a}</table></body></html>`;return t.document.write(l),t.document.close(),t.focus(),t.print(),!0}catch{return!1}}Zh(e){let t=this.e.r.x(e.colId);return t?this.e.a.start(e.rowIndex,t,e.keyPress??null):!1}refreshCells(e){let t=e==null||e.rowIds==null&&e.rowIndexes==null&&e.columns==null;this.e.$({cells:e??!0,pinned:e?.includePinned??t,summary:t})}getOption(e){return this.e.t[e]}updateOptions(e){if(this.e.o()||(this.e.ws(e),e=En(e),Object.keys(e).length===0))return;let t=this.e.t;if((e.treeData??t.treeData)&&(e.rowData!==void 0||e.treeData!=null||e.childrenKey!=null)){let i=v(e,"rowData")?e.rowData:t.rowData;Ee(Array.isArray(i)?i:[],e.childrenKey??t.childrenKey)}this.e.Zl(()=>{let i={},r=this.e.t.columnMenu;this.np(e,i),this.op(e,i),this.sp(e,i),this.ap(e,i),this.lp(e),this.dp(e,i),this.up(e,i),this.cp(e,i),this.hp(e,i),this.pp(e,i),this.fp(e,i,r)})}np(e,t){let i=this.e.t;v(e,"columnDefs")&&e.columnDefs!==i.columnDefs&&(i.columnDefs=Array.isArray(e.columnDefs)?e.columnDefs:[],t.needsColumnRebuild=!0,t.columnDefsChanged=!0),R(e,i,["rowNumber"])&&(t.needsColumnRebuild=!0),v(e,"rowData")&&e.rowData!==i.rowData&&(i.rowData=Array.isArray(e.rowData)?e.rowData:[],t.needsRowRebuild=!0),v(e,"initialState")&&e.initialState&&(i.initialState=e.initialState,t.stateToApply=e.initialState),this.mp(e)}mp(e){for(let t of $e){let i=t;v(e,i)&&Reflect.set(this.e.t,i,e[i])}}op(e,t){let i=this.e.t;for(let o of["rowHeight","headerHeight","rowBuffer"]){let s=er(e[o],i[o],o==="rowBuffer"?0:1,o==="rowBuffer");s!==void 0&&(i[o]=s,t.layout=!0,o==="headerHeight"&&(t.header=!0))}e.columnLayout!=null&&e.columnLayout!==i.columnLayout&&(i.columnLayout=e.columnLayout==="fit"||e.columnLayout==="normal"?e.columnLayout:"auto",this.e.r.Xe=!1,t.layout=!0),e.domLayout!=null&&e.domLayout!==i.domLayout&&(i.domLayout=e.domLayout==="autoHeight"?"autoHeight":"normal",this.e.n.Bh(i.domLayout),t.pool=!0),v(e,"maxBodyHeight")&&(i.maxBodyHeight=x(e.maxBodyHeight,1),t.layout=!0),R(e,i,["multiSort"]);let r=er(e.detailRowHeight,i.detailRowHeight,1);r!==void 0&&(i.detailRowHeight=r,this.e.s.Rn(),this.e.s.hr(!0))}sp(e,t){let i=this.e.t;e.editType!=null&&e.editType!==i.editType&&(this.e.a.stop(!0),i.editType=e.editType==="fullRow"?"fullRow":"cell",t.cells=!0),e.editableIndicator!=null&&e.editableIndicator!==i.editableIndicator&&(i.editableIndicator=e.editableIndicator==="always"||e.editableIndicator==="none"?e.editableIndicator:"hover",t.cells=!0),R(e,i,["rowEditValidator"],!0),R(e,i,["singleClickEdit","manualSorting","manualFiltering"])}ap(e,t){let i=this.e.t;typeof e.enableColumnResize=="boolean"&&e.enableColumnResize!==i.enableColumnResize&&(this.e.pr.at(),i.enableColumnResize=e.enableColumnResize,t.header=!0),O(e,i,"locale")&&(t.header=!0,t.cells=!0,this.e.fi.xe(),this.e.ji.xe()),O(e,i,"indexOffset")&&(t.cells=!0),O(e,i,"showSummary")&&(t.summary=!0,t.layout=!0);let r=er(e.undoStackSize,i.undoStackSize,0,!0);r!==void 0&&(i.undoStackSize=r,this.e.H.kl());let o=x(e.asyncTransactionWaitMillis,0,!0);o!==void 0&&(i.asyncTransactionWaitMillis=o),this.gp(e,t),this.yp(e)}gp(e,t){v(e,"getRowHeight")&&(this.e.t.getRowHeight=e.getRowHeight,this.e.s.ot(),t.layout=!0)}yp(e){let t=this.e.t;e.enableRangeSelection!=null&&(t.enableRangeSelection=e.enableRangeSelection,e.enableRangeSelection||this.li()),R(e,t,["tooltipComponent"],!0);let i=x(e.tooltipShowDelay,0);i!==void 0&&(t.tooltipShowDelay=i),R(e,t,["flashCells"]),R(e,t,["getContextMenuItems"],!0),O(e,t,"theme")&&(this.e.n.Kl(t.theme),this.e.En.refresh())}lp(e){if(!v(e,"pagination"))return;let t=this.e.t,i=e.pagination,r=i!==!1&&t.datasource==null;r!==t.paginationEnabled&&this.e.i.ja(r),typeof i=="object"&&i&&this.vp(i),t.paginationEnabled&&this.e.i.ic(),this.e.fi.xe()}vp(e){let t=this.e.t;t.paginationMode=e.mode==="server"?"server":"client";let i=x(e.page,1,!0),r=x(e.total,0,!0);i!==void 0&&(t.paginationPage=i),r!==void 0&&(t.paginationTotal=r),e.pageSize!=null&&(t.paginationPageSize=e.pageSize),e.pageSizeOptions!=null&&(t.paginationPageSizeOptions=e.pageSizeOptions),e.showTotal!=null&&(t.paginationShowTotal=e.showTotal),e.showPageSizeSelector!=null&&(t.paginationShowSizeSelector=e.showPageSizeSelector)}dp(e,t){v(e,"rowStyleRules")&&(this.e.t.rowStyleRules=Array.isArray(e.rowStyleRules)?e.rowStyleRules:[],t.cells=!0,this.e.$({pinned:!0})),this.bp(e,t),this.wp(e,t);let i=this.e.t;O(e,i,"stripedRows")&&this.e.n.Hh(i.stripedRows),O(e,i,"showCellBorders")&&this.e.n.Vh(i.showCellBorders)}bp(e,t){let i=this.e.t;e.watermark!==void 0&&(Object.assign(i,Ri(e)),this.e.En.refresh()),this.Cp(e),v(e,"summaryMethod")&&(i.summaryMethod=e.summaryMethod,t.summary=!0)}Cp(e){let t=this.e.t;R(e,t,["suppressClipboard","contextMenu","columnMenu","fillHandle"]),e.statusBar!==void 0&&(t.statusBarEnabled=e.statusBar===!0||typeof e.statusBar=="object"&&e.statusBar!=null,typeof e.statusBar=="object"&&e.statusBar?.panels&&(t.statusBarPanels=e.statusBar.panels),this.e.ji.xe())}wp(e,t){let{size:i}=e;if(i==null||!v(Ne,i)||i===this.e.t.size)return;let r=Ne[i];this.e.t.size=i,this.e.t.rowHeight=e.rowHeight??r.rowHeight,this.e.t.headerHeight=e.headerHeight??r.headerHeight,this.e.n.Fh(i),t.layout=!0,t.header=!0}up(e,t){let i=this.e.t;R(e,i,["suppressCellFocus","suppressRowHoverHighlight","suppressNoRowsOverlay"]),O(e,i,"suppressHeaderFocus")&&(t.header=!0),this.Tp(e),this.Dp(e)}Tp(e){let t=this.e.t,i=!1;for(let r of["ariaLabel","ariaLabelledBy","ariaDescribedBy"])v(e,r)&&(t[r]=e[r]??Fe[r],i=!0);i&&this.e.n.zl(t)}Dp(e){let t=this.e.t;for(let i of["overlayNoRowsTemplate","overlayLoadingTemplate","overlayErrorTemplate"])v(e,i)&&(t[i]=e[i]??Fe[i]);R(e,t,["allowUnsafeOverlayHtml"]),v(e,"className")&&(t.className=e.className??"",this.e.n._l(t.className)),R(e,t,["loading"]),v(e,"error")&&(t.error=e.error??null)}cp(e,t){this.xp(e,t),this.Rp(e,t);let i=this.e.t;R(e,i,["autoCheckedChildren"]),O(e,i,"defaultExpandAll")&&(t.needsRowRebuild=!0),e.applyRowDrag!=null&&(i.applyRowDrag=e.applyRowDrag,t.cells=!0),v(e,"rowDragPolicy")&&(i.rowDragPolicy=e.rowDragPolicy,t.cells=!0),R(e,i,["suppressWarnings"])}xp(e,t){let i=this.e.t;if(O(e,i,"rowSelection")&&(this.e.f.yc(),t.header=!0,t.pool=!0,this.e.Sn()),e.quickFilterText!==void 0&&this.Mt(e.quickFilterText),e.defaultColDef!==void 0&&e.defaultColDef!==i.defaultColDef&&(i.defaultColDef={...Di,...e.defaultColDef},t.needsColumnRebuild=!0),v(e,"columnTypes")&&e.columnTypes!==i.columnTypes&&(i.columnTypes=e.columnTypes??{},t.needsColumnRebuild=!0),v(e,"rowKey")){i.rowKey=e.rowKey;let r=e.rowKey;i.resolveRowId=r?({data:o})=>xi(r,o):void 0,t.needsRowRebuild=!0}}Rp(e,t){let i=this.e.t;O(e,i,"masterDetail")&&(t.needsColumnRebuild=!0,t.needsRowRebuild=!0),O(e,i,"detailToggleColumn")&&(t.needsColumnRebuild=!0),O(e,i,"treeData")&&(t.needsRowRebuild=!0,t.needsColumnRebuild=!0,this.e.Sn()),O(e,i,"childrenKey")&&(t.needsRowRebuild=!0),R(e,i,["isTreeRowExpandable","loadTreeChildren"],!0)&&(t.cells=!0)}hp(e,t){let i=this.e.t;R(e,i,["aggFuncs"],!0)&&(t.needsRowRebuild=!0),R(e,i,["components","actionPolicy"],!0)&&(t.cells=!0),v(e,"features")&&(i.features=Array.isArray(e.features)?e.features:[],t.needsFeatureReload=!0),this.Ep(e,t),this.Sp(e,t)}Ep(e,t){let i=this.e.t;v(e,"dataProcessor")&&this.e.rd(e.dataProcessor)&&(t.needsRowRebuild=!0);let r=x(e.dataProcessorMinRows,1,!0);r!==void 0&&r!==i.dataProcessorMinRows&&(i.dataProcessorMinRows=r,t.needsRowRebuild=!0)}Sp(e,t){let i=this.e.t;v(e,"persistence")&&(i.persistence=Ye(e.persistence),t.needsStateLoad=!0)}pp(e,t){let i=this.e.t;Ei(e,i)&&i.datasourceMode==="block"&&(t.datasourceChanged=!0),this.Mp(e,t),this.Ip(e,t),this.Ap(e)}Mp(e,t){let i=this.e.t;if(v(e,"datasourceMode")){let r=e.datasourceMode==="block"?"block":"sequential";r!==i.datasourceMode&&(i.datasourceMode=r,t.datasourceChanged=!0)}if(v(e,"datasourceRowCount")){let r=e.datasourceRowCount==null?null:x(e.datasourceRowCount,0,!0)??null;r!==i.datasourceRowCount&&(i.datasourceRowCount=r,t.datasourceChanged=!0)}}Ip(e,t){let i=this.e.t;v(e,"datasource")&&e.datasource!==i.datasource&&(i.datasource=e.datasource,i.paginationEnabled=e.datasource==null&&i.paginationEnabled,t.datasourceChanged=!0,this.e.fi.xe()),R(e,i,["detailRowRenderer","isRowExpandable"],!0)&&(t.cells=!0)}Ap(e){e.pinnedTopRowData!==void 0&&this.setPinnedRows("top",e.pinnedTopRowData),e.pinnedBottomRowData!==void 0&&this.setPinnedRows("bottom",e.pinnedBottomRowData)}fp(e,t,i){let r=this.e.t;t.needsColumnRebuild?this.kp(e,t):v(e,"advancedFilterModel")&&(t.filterChanged=this.e.i.nt(e.advancedFilterModel)),t.needsFeatureReload&&this.e.nd(r.features),this.Pp(t),t.filterChanged&&this.e.Cs(!t.needsColumnRebuild),t.layout&&this.e.n.Nh(r.rowHeight,r.headerHeight),e.columnMenu!=null&&e.columnMenu!==i&&(t.header=!0),t.stateToApply&&this.Xl(t.stateToApply),t.pool&&(t.cells=void 0),t.overlays=!0,this.e.$(t)}kp(e,t){t.columnDefsChanged&&!t.needsRowRebuild&&(this.e._e(),this.e.a.stop(!0));let i=this.e.r.Ri(this.e.t.columnDefs);t.filterChanged=this.e.i.qu(v(e,"advancedFilterModel")?e.advancedFilterModel??null:void 0),i&&this.e.emit("sortChanged",{sortModel:this.e.r.Q()},!1),this.e.ur(),t.header=!1,t.pool=!1}Pp(e){let t=e.needsStateLoad||e.needsColumnRebuild,i=e.datasourceChanged||e.needsRowRebuild||e.columnDefsChanged||e.filterChanged,r=this.e.t.persistence?.sections,o=i&&(this.e.i.g||r?.length===1&&r[0]==="columns");t&&o&&this.e.Ts(!e.needsStateLoad,!0),this.Gp(e,i),t&&!o&&this.e.Ts(!e.needsStateLoad)}Gp(e,t){if(e.datasourceChanged){this.e.i.Fu();return}t&&(!this.e.i.g&&e.needsRowRebuild?this.rt(this.e.t.rowData):this.e.i.So())}ip(e={}){let t=this.Jl({...e,target:"csv",protectFormulas:!1});return hn(t,e)}Jl(e={}){let t=this.e.r.l().filter(X),i=e.includeHeader===!1?[]:[t.map(o=>o.colDef.headerName??o.colDef.field??o.id)];if(e.headersOnly)return i;let r=e.onlySelected?this.e.f.ti().sort((o,s)=>o.rowIndex-s.rowIndex):e.onlyAllDisplayed?this.e.i.It():this.e.i.Ka();return[...i,...r.filter(o=>!o.isDetail&&!o.isGroup).map(o=>t.map(s=>{let a=We(this.e,o,s,e.target??"xlsx");return e.protectFormulas===!1?a:ce(a)}))]}getState(){return{version:2,columns:this.e.r.ga(!1),sortModel:this.e.r.Q(),filterModel:this.e.i.Be(),advancedFilterModel:this.e.i.Ni(),quickFilterText:this.e.i.Eo(),pagination:{enabled:this.e.i.Te,page:this.e.i.ei(),pageSize:this.e.t.paginationPageSize},selectedRowIds:this.e.f.ko(),expandedRowIds:this.e.i.lc(),expandedGroupIds:this.e.i.dc()}}Xl(e,t={}){if(this.e.o())return;let i=q(e);if(!i){this.e.reportError(new TypeError("[MachTable] GridState must use the current version 2 schema."),"gridState.apply");return}let r=["columns","sort","filter","pagination","selection","expansion"],o=new Set(t.sections??r);this.e.a.stop(!0),this.Lp(i,o),this.Np(i,o),t.emitEvents!==!1&&this.Fp(o),o.has("columns")&&this.e.Dn()}Lp(e,t){t.has("columns")&&this.e.r.ya(e.columns??[]),t.has("sort")&&this.e.r.Si(e.sortModel??[]),t.has("filter")&&(this.e.i.St(e.filterModel??{}),this.e.i.nt(e.advancedFilterModel),this.e.i.Mt(e.quickFilterText)),t.has("expansion")&&this.e.i.uc(e.expandedRowIds??[],e.expandedGroupIds??[]),t.has("pagination")&&e.pagination&&(this.e.t.paginationEnabled=e.pagination.enabled&&!this.e.i.g,this.e.i.Ua(e.pagination.page,e.pagination.pageSize),this.e.fi.xe())}Np(e,t){t.has("columns")&&this.e.ur(),this.e.Op()||(this.e.i.g?(t.has("sort")||t.has("filter"))&&this.e.i.Ga():this.e.i.O()),this.e.W.Ds(),this.e.W.xs(),t.has("selection")&&this.e.f.Za(e.selectedRowIds??[])}Fp(e){e.has("sort")&&this.e.emit("sortChanged",{sortModel:this.e.r.Q()}),e.has("filter")&&this.e.Cs(),e.has("pagination")&&this.e.i._i(this.e.t.paginationPageSize)}destroy(){let e=this.ed();for(let t of e)t.signal&&t.onAbort&&t.signal.removeEventListener("abort",t.onAbort),t.aborted||t.resolve();this.e.destroy()}},ya={rows:Ln,columns:Nn,selection:Fn,editing:On,filtering:Bn,sorting:_n,pagination:zn,hierarchy:Wn,view:$n,state:Hn,io:Kn,diagnostics:Vn};function jn(n){let e=new tr(n),t={};for(let[i,r]of Object.entries(ya)){let o;Object.defineProperty(t,i,{enumerable:!0,get:()=>o??(o=Object.freeze(r(e,n)))})}return Object.assign(t,{batch:i=>e.batch(i),whenReady:()=>n.whenReady(),getOption:i=>e.getOption(i),updateOptions:i=>e.updateOptions(i),on:(i,r)=>n.ue.on(i,r),destroy:()=>e.destroy(),isDestroyed:()=>n.o()}),Dn(t,n),Cn(t,{suspend:()=>n.suspend(),resume:()=>t.view.refreshLayout(),canReplaceData:()=>!n.a.isEditing()&&n.P.getDirtyRowIds().length===0,readCell:(i,r)=>{let o=n.i.F(i),s=n.r.x(r);return o&&s?pn(We(n,o,s,"clipboard")):""},writeInput:i=>n.pi(i.flatMap(({rowId:r,colId:o,value:s})=>{let a=n.i.F(r),l=n.r.x(o);return a&&l?[{node:a,column:l,oldValue:n.d(a,l),newValue:s}]:[]}))}),Object.freeze(t)}var va={contains:"\u5305\u542B",notContains:"\u4E0D\u5305\u542B",equals:"=",notEquals:"\u2260",startsWith:"\u5F00\u5934",endsWith:"\u7ED3\u5C3E",blank:"\u4E3A\u7A7A",notBlank:"\u975E\u7A7A",lessThan:"<",lessThanOrEqual:"\u2264",greaterThan:">",greaterThanOrEqual:"\u2265",inRange:"\u8303\u56F4"};function Xt(n){if(!n)return"";if(n.type==="set")return`\u5DF2\u9009 ${n.values.length} \u9879`;let e=[];for(let i of n.conditions){let r=va[i.match]??i.match,o=i.value,s="value2"in i?i.value2:void 0;i.match==="blank"||i.match==="notBlank"?e.push(r):i.match==="inRange"&&o!=null?e.push(`${r} ${o}~${s??o}`):o!=null&&String(o)!==""?e.push(`${r} ${o}`):e.push(r)}let t=n.operator==="or"?" \u6216 ":" \u4E14 ";return e.join(t)}function ir(n,e,t=!1){let i=0,r=n.length;for(;i<r;){let o=i+r>>1;n[o]<e||t&&n[o]===e?i=o+1:r=o}return i}var Me=class{constructor(){this.ne=new Float64Array(1)}update(e){this.ne.length!==e.length+1&&(this.ne=new Float64Array(e.length+1));let t=0;for(let i=0;i<e.length;i++)t+=e[i].currentWidth,this.ne[i+1]!==t&&(this.ne[i+1]=t)}Rs(){return this.ne[this.ne.length-1]??0}je(e){let t=Math.max(0,Math.min(Math.trunc(e),this.ne.length-1));return this.ne[t]??0}Hp(e){let t=Math.max(0,this.ne.length-1);return t===0?-1:Math.min(t-1,Math.max(0,ir(this.ne,Math.max(0,e),!0)-1))}od(e,t,i=2){let r=Math.max(0,this.ne.length-1);if(r===0||t<=0||this.Rs()<=t)return{first:0,lastExcl:r};let o=Math.max(0,e),s=o+t,a=Math.max(0,ir(this.ne,o,!0)-1),l=Math.min(r,ir(this.ne,s));return{first:Math.max(0,a-i),lastExcl:Math.min(r,l+i)}}Mn(e,t,i){let r=t.indexOf(i);if(r<0)return;this.update(t);let o=this.je(r),s=o+i.currentWidth;o<e.scrollLeft?e.scrollLeft=o:s>e.scrollLeft+e.clientWidth&&(e.scrollLeft=s-e.clientWidth)}};var ba=".mach-header-resize, .mach-filter-btn, .mach-menu-btn, .mach-select-all";function rr(n){return n instanceof HTMLElement&&n.closest(ba)!=null}function nr(n){return n==="ArrowLeft"||n==="ArrowRight"}function qn(n,e){typeof e=="string"?n.classList.add(e):Array.isArray(e)&&n.classList.add(...e)}var Jt=class{constructor(e){this.e=e;this.Y=[];this.Es=[];this.N=new Me;this.mt=0;this.Ht=Number.MAX_SAFE_INTEGER}In(){this.sd(),this.e.pr.at(),this.mi(!1);let e=this.e.r,t=e.Tu();this.e.n.Wl(t);let i=new Set(e.R("center").slice(this.mt,this.Ht)),r=e.Cu(),o=this.e.t.headerHeight;for(let s of C){let a=this.e.n.sr[s];for(let d of a)d.textContent="";let l=(d,u)=>{let c=a[Math.min(u,a.length-1)];for(let h of d)if(h instanceof re){let f=this.Y.length;if(l(h.children,u+1),this.Y.length===f)continue;let m=this.Vp(h);c.appendChild(m),this.Es.push({group:h,el:m,pane:s})}else if(!h.hide&&e.ge(h)===s&&(s!=="center"||i.has(h))){let f=this.Bp(h,t-u,o);c.appendChild(f.el),this.Y.push(f)}};l(r,0)}this.e.t.suppressHeaderFocus||this.Y.forEach((s,a)=>{s.el.tabIndex=a===0?0:-1}),this.gt(),this.Ds(),this.xs(),this.Wr()}ad(){let e=this.mt,t=this.Ht;this.sd(),(e!==this.mt||t!==this.Ht)&&this.In()}Gt(e,t){let i=this.e.n.si[t];return this.Y.find(r=>r.column.id===e&&i.contains(r.el))?.el??null}sd(){let e=this.e.r.R("center"),t=this.e.n.b.center;this.N.update(e);let i=e.length>20?this.N.od(t.scrollLeft,t.clientWidth,2):{first:0,lastExcl:e.length};this.mt=i.first,this.Ht=i.lastExcl}Bp(e,t,i){let r=p("div","mach-header-cell mach-header-cell--leaf");e.hasCheckbox&&r.classList.add("mach-header-cell--selection"),r.dataset.colId=e.id,r.setAttribute("role","columnheader"),r.style.height=`${t*i}px`,this._p(r,e),this.zp(r,e);let o=this.Wp(r,e);this.$p(r,e);let s=p("span","mach-sort-indicator");r.appendChild(s);let{filterBtn:a,filterTagEl:l}=this.Kp(r,e);return this.Up(r,e),this.jp(r,e),this.qp(r,e),{column:e,el:r,sortEl:s,filterBtn:a,filterTagEl:l,selectAllEl:o}}_p(e,t){let i=t.colDef;qn(e,i.headerClass),i.headerTooltip&&e.setAttribute("title",i.headerTooltip);let r=i.headerAlign??i.align;r==="center"?e.classList.add("mach-header-cell--center"):r==="right"&&e.classList.add("mach-header-cell--right")}zp(e,t){this.e.t.suppressHeaderFocus||(e.tabIndex=-1,e.addEventListener("mousedown",()=>this.Ss(t)),e.addEventListener("keydown",i=>this.Yp(i,t)))}Wp(e,t){if(!t.hasCheckbox||this.e.t.rowSelection!=="multiple")return;let i=p("input","mach-select-all");return i.type="checkbox",i.setAttribute("aria-label","select all rows"),i.addEventListener("click",r=>r.stopPropagation()),i.addEventListener("change",()=>{i.checked?this.e.f.selectAll(!0):this.e.f.deselectAll()}),e.appendChild(i),i}$p(e,t){let i=t.colDef,r;try{r=i.headerComponent?.({colDef:i,column:t,api:this.e.api})}catch(s){this.e.reportError(s,"headerComponent",{colId:t.id}),r=null}r instanceof HTMLElement&&(r={el:r});let o=p("span","mach-header-label");!t.sortable&&!t.movable&&(o.style.cursor="default"),r&&typeof r=="object"&&r.el instanceof HTMLElement?(o.classList.add("mach-header-label--custom"),o.appendChild(r.el),Je(e,r.destroy)):o.textContent=typeof r=="string"?r:i.headerName??i.field??t.id,e.appendChild(o)}Kp(e,t){if(!t.filterable)return{};let i=p("button","mach-filter-btn");i.type="button",i.setAttribute("aria-label",`filter ${t.id}`),i.innerHTML=vr,i.addEventListener("click",o=>{o.stopPropagation(),this.e.Ms.toggle(t,i)}),e.appendChild(i);let r=p("span","mach-filter-tag");return e.appendChild(r),{filterBtn:i,filterTagEl:r}}Up(e,t){if(!this.e.t.columnMenu||t.hasCheckbox||t.colDef.suppressColumnMenu)return;let i=p("button","mach-menu-btn");i.type="button";let o=`${t.colDef.headerName??t.colDef.field??t.id} \xB7 ${this.e.u("columnSettings")}`;i.setAttribute("aria-label",o),i.title=o,i.innerHTML=Cr,i.addEventListener("click",s=>{s.stopPropagation(),this.e.columnMenu.toggle(t,i)}),e.appendChild(i)}jp(e,t){if(!this.ld(t))return;let i=p("div","mach-header-resize");i.setAttribute("aria-hidden","true"),i.addEventListener("pointerdown",r=>{r.button===0&&(r.preventDefault(),r.stopPropagation(),this.e.pr.Rc(r,t))}),i.addEventListener("dblclick",r=>{r.stopPropagation(),this.e.api.columns.autoSize(t.id)}),i.addEventListener("click",r=>r.stopPropagation()),e.appendChild(i)}qp(e,t){e.addEventListener("click",i=>{this.e.An.kc()||rr(i.target)||t.sortable&&this.e.Ar(t,i.shiftKey)}),e.addEventListener("pointerdown",i=>{i.button!==0||rr(i.target)||this.e.An.Ac(i,t)})}Vp(e){let t=p("div","mach-header-cell mach-header-cell--group");e.groupId&&(t.dataset.groupId=e.groupId),t.setAttribute("role","columnheader"),qn(t,e.def.headerClass);let i=p("span","mach-header-label mach-header-label--group");return i.textContent=e.headerName,t.appendChild(i),t}gt(){let e={left:0,center:0,right:0};for(let t of C){let i=this.e.n.sr[t],r=0,o=new Map;for(let a of this.e.r.R(t))o.set(a.id,r),r+=a.currentWidth;let s=this.e.t.headerHeight;for(let a of this.Y){if(this.e.r.ge(a.column)!==t)continue;let l=o.get(a.column.id)??0;a.el.style.width=`${a.column.currentWidth}px`,a.el.style.left=`${l}px`,a.el.setAttribute("aria-colindex",String(this.e.r.J(a.column.id)+1))}for(let a of this.Es){if(a.pane!==t)continue;let l=a.group.getLeafColumns().filter(c=>!c.hide&&this.e.r.ge(c)===t);if(l.length===0)continue;let d=o.get(l[0].id)??0,u=0;for(let c of l)u+=c.currentWidth;a.el.style.left=`${d}px`,a.el.style.width=`${u}px`,a.el.style.height=`${s}px`,a.el.setAttribute("aria-colspan",String(l.length))}for(let a of i)a.style.width=`${r}px`;e[t]=r}this.e.n.Lh(e.left,e.right)}Yp(e,t){this.e.o()||this.Xp(e,t)||this.Jp(e,t)||this.Zp(e,t)||this.Qp(e,t)||this.ef(e)}Xp(e,t){return e.key!=="Enter"&&e.key!==" "?!1:(rr(e.target)||(e.preventDefault(),t.sortable&&this.e.Ar(t,e.shiftKey)),!0)}Jp(e,t){if(!e.altKey||!nr(e.key))return!1;if(!this.ld(t))return!0;let i=e.key==="ArrowRight"?24:-24;return this.e.r.Ee(t,t.currentWidth+i),this.e.ri(),this.e.lt([t]),e.preventDefault(),!0}Zp(e,t){if(!e.ctrlKey||!nr(e.key))return!1;if(!t.movable)return!0;e.preventDefault();let i=this.e.r.ge(t),r=this.e.r.R(i),o=r.indexOf(t),s=e.key==="ArrowRight"?1:-1,a=Math.max(0,Math.min(r.length-1,o+s));return a!==o&&this.e.Ei(t.id,a),!0}Qp(e,t){if(e.altKey||e.ctrlKey||e.metaKey||!nr(e.key))return!1;e.preventDefault();let i=this.e.r.l(),r=i.indexOf(t);if(r<0)return!0;let o=e.key==="ArrowRight"?1:-1,s=Math.max(0,Math.min(i.length-1,r+o));return this.Ss(i[s]),!0}ef(e){if(e.key!=="Home"&&e.key!=="End")return!1;e.preventDefault();let t=this.e.r.l();if(t.length===0)return!0;let i=e.key==="Home"?0:t.length-1;return this.Ss(t[i]),!0}Ss(e){let t=this.Y.find(i=>i.column.id===e.id);if(!t&&!e.pinned&&(this.Mn(e),this.ad(),t=this.Y.find(i=>i.column.id===e.id)),!!t){for(let i of this.Y)i.el.tabIndex=i===t?0:-1;t.el.focus({preventScroll:!0})}}Mn(e){this.N.Mn(this.e.n.b.center,this.e.r.R("center"),e)}ld(e){return this.e.t.enableColumnResize&&e.resizable}Ds(){let e=this.e.r.Q();for(let t of this.Y){let i=e.findIndex(r=>r.colId===t.column.id);if(i>=0){let r=e[i].direction;t.sortEl.innerHTML=t.column.sortable?(r==="asc"?br:wr)+(e.length>1?`<span class="mach-sort-badge">${i+1}</span>`:""):"",t.el.setAttribute("aria-sort",r==="asc"?"ascending":"descending"),t.el.classList.add("mach-header-cell--sorted")}else t.sortEl.innerHTML="",t.el.removeAttribute("aria-sort"),t.el.classList.remove("mach-header-cell--sorted")}}xs(){let e=this.e.i.Be();for(let t of this.Y){if(!t.filterBtn)continue;let i=e[t.column.id],r=i!=null;if(t.filterBtn.classList.toggle("mach-filter-btn--active",r),t.filterTagEl){let o=r?Xt(i):"";t.filterTagEl.style.display=o?"":"none",o&&(t.filterTagEl.textContent=o)}}}Wr(){for(let e of this.Y){if(!e.selectAllEl)continue;let{all:t,some:i}=this.e.f.Cc();e.selectAllEl.checked=t,e.selectAllEl.indeterminate=i}}destroy(){this.mi(!0)}mi(e){for(let t of this.Y){let i=Ze(t.el);if(i)try{i()}catch(r){e?console.error("[mach-table] headerComponent destroy error",r):this.e.reportError(r,"headerComponent.destroy",{colId:t.column.id})}}this.Y=[],this.Es=[]}};var Zt=class{constructor(){this.he=null;this.qe=null;this.gi=!1;this.Is=-1;this.As=-1}tf(){return this.he}ks(){return this.qe}rf(){return this.he!=null}start(e,t){(!t||!this.he)&&(this.he={...e}),this.qe={...e},this.Jt()}nf(e){return this.he?!0:e.colIdx<0?!1:(this.he={...e},this.Jt(),!0)}setEnd(e){this.qe={...e},this.Jt()}clear(){this.he=null,this.qe=null,this.Jt()}Jt(){this.gi=!1,this.Is=-1,this.As=-1}normalize(e,t){return this.gi!==!1&&this.Is===e&&this.As===t?this.gi:(this.Is=e,this.As=t,!this.he||!this.qe||e<=0||t<=0?(this.gi=null,null):(this.gi={r1:Math.max(0,Math.min(this.he.row,this.qe.row,e-1)),r2:Math.max(0,Math.min(Math.max(this.he.row,this.qe.row),e-1)),c1:Math.max(0,Math.min(this.he.colIdx,this.qe.colIdx,t-1)),c2:Math.max(0,Math.min(Math.max(this.he.colIdx,this.qe.colIdx),t-1))},this.gi))}};var Qt=class{constructor(e){this.host=e;this.Le=null;this.se=0;this.kn=0;this.Wi=e=>{let t=this.Le;if(!(!t||e.pointerId!==t.pointerId)){if(t.clientX=e.clientX,t.clientY=e.clientY,!t.active){if(Math.abs(e.clientY-t.startY)<5)return;t.active=!0,this.host.root.classList.add("mach-root--row-dragging"),this.host.root.querySelectorAll(".mach-row").forEach(i=>i.classList.toggle("mach-row--drag-source",this.sourceContains(i.dataset.id??"")))}this.dd()}};this.af=()=>{if(this.se=0,!!this.Le?.active){if(!this.current()){this.destroy();return}this.$i(),this.lf()&&this.dd()}};this.ni=e=>{let t=this.Le;if(!(!t||e.pointerId!==t.pointerId)){t.clientX=e.clientX,t.clientY=e.clientY,t.active&&this.current()&&this.$i(),this.ud();try{t.active&&t.drop?.valid&&this.Ps(e.clientX,e.clientY)&&this.current()&&this.commitDrop(t.drop)}finally{this.release()}}};this.Fo=e=>{e.key==="Escape"&&(e.preventDefault(),this.destroy())};this.Yr=e=>{e.type==="pointercancel"&&e.pointerId!==this.Le?.pointerId||this.destroy()}}begin(e){let t=this.host.containers.map(r=>{let o=p("div","mach-row-drop-indicator");return o.hidden=!0,r.append(o),o}),i=p("div","mach-row-drag-preview");i.setAttribute("role","status"),i.hidden=!0,this.host.root.append(i),this.Le={startY:e.clientY,clientX:e.clientX,clientY:e.clientY,pointerId:e.pointerId,indicators:t,preview:i,drop:null,active:!1},this.Ui(!0)}Ui(e){S(window,e,{pointermove:this.Wi,pointerup:this.ni,pointercancel:this.Yr,keydown:this.Fo,blur:this.Yr})}of(e){return this.Le?.active===!0&&this.sourceContains(e)}sf(e,t=()=>!0){this.kn=requestAnimationFrame(()=>{this.kn=0,t()&&[...this.host.root.querySelectorAll(".mach-row-drag-handle")].find(i=>i.closest(".mach-row")?.dataset.id===e)?.focus()})}dd(){this.se||(this.se=requestAnimationFrame(this.af))}Ps(e,t,i=0){let r=this.host.body.getBoundingClientRect();return e>=r.left&&e<=r.right&&t>=r.top-i&&t<=r.bottom+i}lf(){let e=this.Le;if(!e||!this.Ps(e.clientX,e.clientY,28))return!1;let t=this.host.viewport,i=t.getBoundingClientRect(),r=Math.min(36,i.height/3);if(r<=0)return!1;let o=e.clientY<i.top+r?-Math.ceil(14*T((i.top+r-e.clientY)/r,0,1)):Math.ceil(14*T((e.clientY-i.bottom+r)/r,0,1));if(this.host.scrollBy)return this.host.scrollBy(o);let s=t.scrollTop;return t.scrollTop=T(s+o,0,Math.max(0,t.scrollHeight-t.clientHeight)),t.scrollTop!==s}$i(){let e=this.Le;if(!e?.active)return;let t=e.clientY-this.host.viewport.getBoundingClientRect().top+this.host.viewport.scrollTop,i=this.describe(t);e.drop=i;let r=this.Ps(e.clientX,e.clientY);for(let s of e.indicators){if(s.hidden=!r||!i?.valid,!i)continue;s.dataset.dropPosition=i.position??"",s.style.cssText=i.style??"";let a=parseFloat(s.parentElement.style.height),l=Math.min(this.host.getRowTop(i.boundary),Number.isFinite(a)?Math.max(0,a-2):1/0);s.style.transform=`translate3d(0, ${l}px, 0)`}let o=this.host.root.getBoundingClientRect();e.preview.hidden=!1,e.preview.textContent=r?i?.text??this.outsideText():this.outsideText(),e.preview.style.transform=`translate3d(${T(e.clientX-o.left+16,8,Math.max(8,o.width-224))}px, ${T(e.clientY-o.top+16,8,Math.max(8,o.height-48))}px, 0)`}ud(){let e=this.Le;this.Le=null,this.Ui(!1),cancelAnimationFrame(this.se),this.se=0,this.host.root?.classList.remove("mach-root--row-dragging"),this.host.root?.querySelectorAll(".mach-row--drag-source").forEach(t=>t.classList.remove("mach-row--drag-source")),e?.indicators.forEach(t=>t.remove()),e?.preview.remove()}destroy(){this.ud(),this.release(),cancelAnimationFrame(this.kn),this.kn=0}};function Yn(n,e,t,i,r){let o=i==="before"?-1:1,s=t.rowIndex+o,a=e(s);for(;a&&(a===n||a.isDetail);)s+=o,a=e(s);let l=a&&!a.loading?a.id:null;return{rowIds:[n.id],targetId:t.id,position:i,beforeId:i==="before"?l:t.id,afterId:i==="before"?t.id:l,expectedRevision:r}}var ei=class extends Qt{constructor(t,i,r,o){super({get root(){return t.n.root},get body(){return t.n.ye},get viewport(){return t.n.b.center},get containers(){return Object.values(t.n.ce)},getRowTop:i,findRowAt:r,scrollBy:o});this.e=t;this.Vt=null}hd(t){return!t.loading&&!t.treeLoading&&!t.isGroup}pd(t){if(this.e.a.isEditing()||t.isDetail||!this.hd(t)||t.data==null||this.e.r.Je().length||this.e.t.applyRowDrag&&!this.e.i.Ya())return!1;let i=this.yi("canDrag",()=>this.e.t.rowDragPolicy?.canDrag?.({node:t,api:this.e.api})??!0,!1);return i!==!0?i:!this.e.i.M||!!Xi(this.e.api)}canDrag(t){return this.pd(t)===!0}isSource(t){return this.Gs()?.isSource(t)??this.of(t.id)}start(t,i){if(this.destroy(),!this.canDrag(i)||t.isPrimary===!1)return;let r=this.Gs();if(r){r.start(t,i);return}let o=this.yi("getRevision",()=>this.Ls(i),null);o&&(this.Vt={node:i,from:i.rowIndex,guard:o},this.begin(t))}moveWithKeyboard(t,i){if(!t.altKey||t.key!=="ArrowUp"&&t.key!=="ArrowDown"||(t.preventDefault(),t.stopPropagation(),!this.canDrag(i)))return;let r=this.Gs();if(r){r.moveWithKeyboard(t,i);return}let o=t.key==="ArrowUp"?-1:1,s=i.rowIndex+o;for(;this.e.i.h(s)?.isDetail;)s+=o;let a=this.e.i.h(s),l=this.yi("getRevision",()=>this.Ls(i),null);if(!(!a||!l)){this.Vt={node:i,from:i.rowIndex,guard:l};try{this.commitDrop(this.destination(a,o>0))&&this.sf(i.id)}finally{this.release()}}}yi(t,i,r){try{return i()}catch(o){return this.e.reportError(o,`rowDragPolicy.${t}`),r}}Ls(t){let i=this.e.i,r=this.e.r.Z(),o=this.e.t.rowDragPolicy,s=i.Ve(),a=i.Li(),l=this.e.t.applyRowDrag,d=o?.getRevision?.();return{revision:d,current:()=>this.yi("getRevision",()=>o?.getRevision?.()===d&&s===i.Ve()&&a===i.Li()&&i.F(t.id)===t&&r===this.e.r.Z()&&o===this.e.t.rowDragPolicy&&l===this.e.t.applyRowDrag,!1)}}Gs(){let t=Xi(this.e.api);return t!==this.cd&&(this.Pn?.destroy(),this.cd=t,this.Pn=t?this.yi("driver",()=>t({...this.host,api:this.e.api,capture:i=>this.Ls(i),emit:(i,r,o,s,a)=>{this.e.emit("rowDragEnd",{rowNode:i,fromIndex:r,toIndex:o,targetIndex:s,applied:!1,intent:a})},report:(i,r)=>this.e.reportError(i,`rowDragPolicy.${r}`)}),void 0):void 0),this.Pn}current(){return this.Vt?.guard.current()??!1}release(){this.Vt=null}sourceContains(t){return this.Vt?.node.id===t}outsideText(){return this.e.u("rowDragOutside")}describe(t){let i=T(this.host.findRowAt(t),0,this.e.i.G()-1),r=this.e.i.h(i);if(r?.isDetail&&(r=this.e.i.F(r.masterId)),!r)return null;let o=this.host.getRowTop(r.rowIndex),s=this.host.getRowTop(r.rowIndex+1);return this.destination(r,t>=(o+s)/2)}destination(t,i){let r=this.Vt,o=t.rowIndex+Number(i);for(;this.e.i.h(o)?.isDetail;)o++;let s=this.e.t.rowDragPolicy,a=!this.e.t.applyRowDrag||s?.canDrop?Yn(r.node,c=>this.e.i.h(c),t,i?"after":"before",r.guard.revision):void 0,l=s?.canDrop&&a?this.yi("canDrop",()=>s.canDrop({node:r.node,api:this.e.api,targetNode:t,intent:a}),!1):!0,d=l===!0&&this.hd(t),u=typeof l=="string"?l:Te(this.e.u("rowDragPosition"),r.from+1,this.fd(r.from,o)+1);return{node:t,intent:a,boundary:o,valid:d,text:u,position:i?"after":"before"}}commitDrop(t){let i=this.Vt;if(!i||!this.current()||!this.canDrag(i.node)||!this.current())return!1;let r=this.destination(t.node,t.boundary>t.node.rowIndex);if(!r.valid||!this.current())return!1;let o=r.boundary>i.from?r.boundary-1:r.boundary;for(;this.e.i.h(o)?.isDetail;)o--;if(i.from===o)return!1;let s=this.e.t.applyRowDrag&&this.e.i.Xa(i.from,o);return this.e.t.applyRowDrag&&!s?!1:(this.e.emit("rowDragEnd",{rowNode:i.node,fromIndex:i.from,toIndex:r.boundary,targetIndex:s?i.node.rowIndex:this.fd(i.from,r.boundary),applied:s,intent:r.intent}),!0)}fd(t,i){let r=t+1;for(;this.e.i.h(r)?.isDetail;)r++;return i>t?i-(r-t):i}destroy(){this.Pn?.destroy(),super.destroy()}};var wa=new Set(["warning","danger","success","info"]);function Ue(n,e,t=null){if(!(e.data==null||e.isGroup||e.isDetail||e.loading))for(let i of n.t.rowStyleRules)try{if(i.when({data:e.data,node:e,api:n.api,rowPinned:t})===!0)return i}catch(r){n.reportError(r,"rowStyleRules",{rowId:e.id})}}function Ie(n,e){n.style.removeProperty("--mach-row-rule-bg"),n.style.removeProperty("--mach-row-rule-fg"),e?.tone&&wa.has(e.tone)?n.dataset.rowTone=e.tone:delete n.dataset.rowTone,e?.backgroundColor&&n.style.setProperty("--mach-row-rule-bg",e.backgroundColor),e?.color&&n.style.setProperty("--mach-row-rule-fg",e.color),n.classList.toggle("mach-row--styled",!!e)}var ti=class{constructor(){this.oe=new Float64Array(0);this.vi=new Float64Array(1);this.Ns=new WeakMap;this.Bt=new Map;this.yt=0}reset(e,t){this.oe=new Float64Array(e.length),this.vi=new Float64Array(e.length+1),this.Ns=new WeakMap,this.Bt=new Map,this.yt=0;for(let i=0;i<e.length;i++){this.Ns.set(e[i],i);let r=Math.max(1,t(e[i],i));this.oe[i]=r,this.Fs(r,1),this.add(i,r)}}get length(){return this.oe.length}indexOf(e){return this.Ns.get(e)??-1}update(e,t){if(e<0||e>=this.oe.length)return!1;let i=Math.max(1,t),r=i-this.oe[e];return Math.abs(r)<.01?!1:(this.Fs(this.oe[e],-1),this.oe[e]=i,this.Fs(i,1),this.add(e,r),!0)}je(e){let t=Math.max(0,Math.min(Math.trunc(e),this.oe.length)),i=0;for(;t>0;)i+=this.vi[t],t-=t&-t;return i}Os(){return this.je(this.oe.length)}df(){return this.yt}findIndex(e){if(this.oe.length===0)return 0;let t=Math.max(0,e),i=0,r=0,o=1;for(;o<<1<=this.oe.length;)o<<=1;for(;o>0;){let s=i+o;s<=this.oe.length&&r+this.vi[s]<=t&&(i=s,r+=this.vi[s]),o>>=1}return Math.min(i,this.oe.length-1)}add(e,t){for(let i=e+1;i<this.vi.length;i+=i&-i)this.vi[i]+=t}Fs(e,t){let i=(this.Bt.get(e)??0)+t;if(i<=0?this.Bt.delete(e):this.Bt.set(e,i),this.Bt.size===0)this.yt=0;else if(t>0&&(this.yt===0||e<this.yt))this.yt=e;else if(t<0&&e===this.yt&&!this.Bt.has(e)){let r=Number.POSITIVE_INFINITY;for(let o of this.Bt.keys())r=Math.min(r,o);this.yt=Number.isFinite(r)?r:0}}};var Ca=16e6,ii=class{constructor(){this.height=0;this._t=0;this.bi=0;this.Gn=NaN;this.Hs=0}configure(e,t,i=!0){this.height=i?Math.min(e,Ca):e,this._t=Math.max(0,e-t),this.bi=Math.max(0,this.height-t),this.Gn=NaN}get vt(){return this._t>this.bi}uf(e){return this._t?T(e,0,this._t)*this.bi/this._t:0}read(e){return e!==this.Gn&&(this.Gn=e,this.Hs=this.bi>0?T(e,0,this.bi)*this._t/this.bi:0),this.Hs}anchor(e,t){this.Hs=T(e,0,this._t),this.Gn=t}};function Xn(n){return!!n&&!n.hasCheckbox&&!n.isDetailToggle&&!n.colDef.rowDrag}function Ta(n){let e=n.length>1&&n.every(r=>typeof r=="number"&&!Number.isNaN(r)),t=e?(n[n.length-1]-n[0])/(n.length-1):0,i=!e||n.every(r=>Number.isInteger(r));return{difference:t,integer:i,numeric:e,values:n}}function Da(n,e){let t=n.values.length;if(t===1)return n.values[0];if(!n.numeric)return n.values[e%t];let i=n.values[t-1]+n.difference*(e-t+1);return n.integer?Math.round(i):Math.round(i*1e6)/1e6}var ri=class{constructor(e){this.e=e;this.m=[];this.bt=0;this.Ye=-1;this.ie=0;this.Vs=0;this.Bs=0;this.md=0;this.S=new ii;this.wt=0;this._s=!1;this.Ln=-1;this.U=new ti;this.N=new Me;this.pe=new Zt;this.Nn=!1;this.fr=[];this.mt=0;this.Ht=0;this.zs=!1;this.v=null;this.Ws=()=>{this.ie||(this.ie=requestAnimationFrame(()=>{this.ie=0,this.xn()}))};this._n=0;this.zn=new WeakMap;this.Wt=new Set;this.Wn="";this.Ct=!1;this.mr=[];this.Re=null;this.wd="";this.Ks="";this.Cd=0;this.Td=0;this.$s=e=>{if(e.defaultPrevented||e.ctrlKey||e.metaKey||e.shiftKey||!e.deltaY||!e.cancelable)return;let t=this.e.n.b.center,i=e.deltaMode===1?this.e.t.rowHeight:e.deltaMode===2?t.clientHeight:1,r=this.S.read(t.scrollTop);this.$n(r+e.deltaY*i),this.S.read(t.scrollTop)!==r&&(e.preventDefault(),t.scrollLeft+=e.deltaX*i,this.Ws())};this.Vn=null;this.vr=null;this.Xs=!1;this.um=e=>{let t=this.vr;if(!t)return;let i=e;if(typeof i.clientX!="number")return;if(!t.active){let o=Math.abs(i.clientX-t.startX),s=Math.abs(i.clientY-t.startY);if(o<4&&s<4)return;t.active=!0,t.axis=o>=s?"h":"v",this.e.n.root.classList.add("mach-root--filling")}let r=t.axis!=="v";this.jd(r,r?Math.max(t.c2+1,this.Ud(i)):this.Kd(i),!0)};this.cm=e=>{let t=this.vr;if(!t)return;let i=e;if(!t.active){this.Hn();return}let r=t.axis==="h",o=r?t.c2:t.r2,s=o;r?s=Math.max(o+1,typeof i.clientX=="number"?this.Ud(i):o+1):typeof i.clientY=="number"&&(s=this.Kd(i)),this.Hn(),s>o?(this.hm(t,s,r),this.wi()):this.jd(r,o,!1)};this.hf=e=>{if(this.e.o())return;let t=e.target,i=this.Ut(e);if(i&&!t.closest(".mach-cell-editor-shell, .mach-row-editor-shell, .mach-row-drag-handle")&&!(e.detail>1&&this.e.a.Qr())){if(this.e.a.Qr()){let r=i.cellEl?.dataset.colId??"";if(this.e.a.isEditing(i.index,r))return;let o=r?this.e.r.x(r):void 0;this.e.a.ml(i.node,o).then(s=>{if(!s||this.e.o())return;this.Xd(e,t,{...i,index:i.node.rowIndex});let a=r?this.e.r.x(r):void 0;a&&!this.e.a.Qr()&&this.e.a.start(i.node.rowIndex,a)});return}this.Xd(e,t,i)}};this.pf=e=>{if(this.e.o()||e.target.closest(".mach-cell-editor-shell, .mach-row-editor-shell"))return;let t=this.Ut(e);if(!t)return;let{node:i,index:r,cellEl:o}=t;if(i.isDetail||i.isGroup||!o)return;let s=o.dataset.colId??"",a=this.e.r.x(s);if(!a)return;let l=this.e.d(i,a),d=this.e.emit("cellDoubleClicked",{event:e,rowNode:i,rowIndex:r,column:a,colDef:a.colDef,value:l});a.colDef.onCellDoubleClick?.(d),this.e.emit("rowDoubleClicked",{event:e,rowNode:i,rowIndex:r}),this.e.a.ae(i,a)&&this.e.a.start(r,a)};this.ff=e=>{if(this.e.o())return;let t=this.Ut(e);if(!t||t.node.isDetail||t.node.isGroup||!t.cellEl)return;let{node:i,index:r,cellEl:o}=t,s=o.dataset.colId??"",a=this.e.r.x(s);if(a&&(this.e.emit("cellContextMenu",{event:e,rowNode:i,rowIndex:r,column:a,colDef:a.colDef,value:this.e.d(i,a)}),this.e.t.contextMenu)){if(e.preventDefault(),this.e.t.enableRangeSelection&&!this.De()){let l=this.e.r.J(s);l>=0&&this.Ys(r,l,!1)}this.e.Js.open(e.clientX,e.clientY,{rowIndex:r,colId:s})}};this.mf=e=>{if(!this.Tm(e)&&this.e.t.enableRangeSelection&&e.button===0){let t=this.Ut(e);if(t&&!t.node.isDetail&&!t.node.isGroup&&t.cellEl&&!t.cellEl.classList.contains("mach-cell--selection")){let i=this.e.r.J(t.cellEl.dataset.colId??"");i>=0&&(this.Ys(t.index,i,e.shiftKey),this.Nn=!0,!e.shiftKey&&!this.e.t.suppressCellFocus&&this.Ae(t.index,t.cellEl.dataset.colId??""))}}};this.yd=()=>{this.Nn=!1};this.cn=e=>{if(this.e.o())return;let t=this.Ut(e);if(this.Nn&&t&&!t.node.isDetail&&!t.node.isGroup&&t.cellEl){let i=this.e.r.J(t.cellEl.dataset.colId??""),r=this.pe.ks();i>=0&&r&&(r.row!==t.index||r.colIdx!==i)&&this.Ys(t.index,i,!0)}this.e.t.suppressRowHoverHighlight||!t||t.node.isDetail||this.qd(t.index)};this.gf=()=>{this.qd(-1)};this.yf=e=>{if(this.e.o()||e.button!==0||!e.target.closest(".mach-row-drag-handle"))return;let i=this.Ut(e);!i||i.node.isDetail||i.node.isGroup||(this.zt.start(e,i.node),e.preventDefault())};this.vf=e=>{if(!e.target.closest(".mach-row-drag-handle"))return;let t=this.Ut(e);t&&this.zt.moveWithKeyboard(e,t.node)};this.zt=new ei(e,t=>this.Ne(t)-this.wt,t=>this.On(t+this.wt,this.e.i.G()),t=>this.cf(t))}init(){let e=this.e.n.b.center;this.Vs=e.scrollLeft,this.Bs=e.scrollTop,e.addEventListener("scroll",this.Ws,{passive:!0}),this.gd(!0),window.addEventListener("mouseup",this.yd)}gd(e){S(this.e.n.ye,e,{click:this.hf,dblclick:this.pf,contextmenu:this.ff,mousedown:this.mf,mouseover:this.cn,mouseleave:this.gf,pointerdown:this.yf,keydown:this.vf})}suspend(){cancelAnimationFrame(this.ie),this.ie=0,this.Hn(),this.zt.destroy(),this.Nn=!1}destroy(){cancelAnimationFrame(this.ie);let e=this.e.n.b.center;e.removeEventListener("scroll",this.Ws),e.removeEventListener("wheel",this.$s),this.gd(!1),window.removeEventListener("mouseup",this.yd),this.Hn(),this.zt.destroy(),this.vd(!1),this.Vn?.remove(),this.mr=[],this.Wt.clear(),this.U.reset([],()=>this.e.t.rowHeight),this.N.update([]),this.Re?.remove(),this.Re=null}bf(e){return this.e.r.ge(e)}xn(e=!1){if(this.e.o())return;let t=this.e.n,i=t.b.center,r=i.scrollLeft,o=i.scrollTop,s=this.S.read(o),a=e||r!==this.Vs,l=e||o!==this.Bs||s!==this.md;!a&&!l||(this.Vs=r,this.Bs=o,this.md=s,a&&(t.si.center.style.transform=`translate3d(${-r}px, 0, 0)`,this.e.W.ad(),this.e.Ge.wf(r)),l&&this.bd(o),this.e.Bn.hide(),this.hr(!1,a),l&&this.e.i.Nu(this.Ye-1))}Rn(){let e=this.e.n;this.N.update(this.e.r.R("center"));let t=this.N.Rs(),i=this.e.i.It(),r=this.Cf(i.length);this.Tf(i,r);let o=this.Df(r);this.xf(o),this.Rf(t,o),e.root.setAttribute("aria-rowcount",String(r.rowCount+e.jl()))}Cf(e){let t=this.e.i.Gi(),i=this.e.t.rowHeight,r=this.e.t.masterDetail?[]:this.Ef();r.length&&this.Sf();let o=this.e.t.datasourceMode!=="block"&&(this.e.t.masterDetail||this.e.t.getRowHeight!=null||r.length>0),s=o?this.Mf(i,r):`fixed|${i}`;return{autoHeightColumns:r,positionedCount:Math.min(t,e),rowCount:t,rowHeight:i,signature:s,variable:o}}Mf(e,t){let i=t.map(r=>`${r.id}:${r.currentWidth}`).join(",");return`${this.e.i.Li()}|${e}|${this.e.t.detailRowHeight}|${i}`}Tf(e,t){if(!t.variable){this.If(t);return}if(t.signature!==this.Wn||this.U.length!==t.positionedCount){t.autoHeightColumns.some(st)&&this.ot();let i=e.slice(0,t.positionedCount);this.U.reset(i,r=>this.Dd(r,t.autoHeightColumns)),this.xd(t);return}if(this.Wt.size!==0){for(let i of this.Wt){let r=this.U.indexOf(i);r>=0&&this.U.update(r,this.Dd(i,t.autoHeightColumns))}this.xd(t)}}If(e){this.U.length>0&&this.U.reset([],()=>e.rowHeight),this.Wn=e.signature,this.Wt.clear(),this._n=e.rowHeight}xd(e){this.Wn=e.signature,this.Wt.clear(),this._n=this.U.df()||e.rowHeight}Df(e){return(e.variable?this.U.Os():e.positionedCount*e.rowHeight)+Math.max(0,e.rowCount-e.positionedCount)*e.rowHeight}Rf(e,t){let i=this.e.n,r=i.b.center,o=this.S.read(r.scrollTop),s=this.S.vt;this.S.configure(t,r.clientHeight,!this.Ct);let a=Math.max(e,r.clientWidth);for(let l of C){let d=i.ce[l];d.style.height=`${this.S.height}px`,d.style.overflow=this.S.vt?"hidden":"",l==="center"&&(d.style.width=`${a}px`)}(s||this.S.vt)&&this.$n(o),this.bd(r.scrollTop),this._s!==this.S.vt&&(this._s=this.S.vt,this._s?r.addEventListener("wheel",this.$s,{passive:!1}):r.removeEventListener("wheel",this.$s))}$n(e){let t=this.e.n.b.center;t.scrollTop=this.S.uf(e),this.S.anchor(e,t.scrollTop)}bd(e){let t=this.S.vt;for(let i of["left","right"]){let r=this.e.n.ce[i].style;r.top=t?`${-e}px`:"",r.transform=t?"":`translate3d(0, ${-e}px, 0)`}}cf(e){let t=this.e.n.b.center,i=this.S.read(t.scrollTop);this.$n(i+e);let r=this.S.read(t.scrollTop)!==i;return r&&this.xn(),r}Va(e){this.zn.delete(e),this.Wt.add(e)}xf(e){let{ye:t,b:i,ce:r}=this.e.n,{domLayout:o,maxBodyHeight:s}=this.e.t,a=o==="autoHeight",l=s??1/0,d=i.center,u=Math.min(e,l),c=0;a&&(r.center.style.width=`${this.N.Rs()}px`,d.style.overflowY=e<=l?"hidden":"auto"),t.style.height=a?`${u}px`:"",a&&e<=l&&(c=Math.max(0,d.offsetHeight-d.clientHeight),u=Math.min(e+c,l),t.style.height=`${u}px`),this.Ct=a&&u===e+c,d.style.overflowY=a&&!this.Ct?"auto":"",this.Ct&&d.scrollTop&&(d.scrollTop=0)}ot(){this.zn=new WeakMap,this.Wt.clear(),this.Wn=""}Dd(e,t){if(e.isDetail)return this.e.t.detailRowHeight;let i=this.zn.get(e);if(i!==void 0)return i;let r=this.e.t.rowHeight,o=this.e.t.getRowHeight;if(o)try{let s=o({data:e.data,node:e,api:this.e.api});r=Number.isFinite(s)?Math.max(1,s||r):r}catch(s){this.e.reportError(s,"getRowHeight",{rowId:e.id})}return t.length>0&&(r=Math.max(r,this.Af(e,t))),this.zn.set(e,r),r}Ne(e){let t=this.U.length;return t===0?Math.max(0,e)*this.e.t.rowHeight:e<=t?this.U.je(e):this.U.Os()+(e-t)*this.e.t.rowHeight}On(e,t){if(t<=0)return 0;let i=this.U.length,r=this.U.Os();if(i>0&&e<r)return this.U.findIndex(e);let o=i+Math.floor(Math.max(0,e-r)/this.e.t.rowHeight);return Math.max(0,Math.min(o,t-1))}Ef(){return this.e.r.l().filter(e=>e.colDef.autoHeight===!0)}get kf(){return this.e.r.l().some(e=>e.colDef.autoHeight===!0)}Sf(){this.Re||(this.Re=p("div","mach-cell mach-cell--wrap",{"aria-hidden":"true"}),this.Re.style.cssText="height:auto;visibility:hidden;pointer-events:none",this.e.n.root.appendChild(this.Re));let e=window.getComputedStyle(this.Re),t=`${e.fontStyle} ${e.fontWeight} ${e.fontSize} ${e.fontFamily}`,i=[t,e.lineHeight,e.letterSpacing,e.wordSpacing,e.padding,e.boxSizing,this.e.Ue.la].join("|");i!==this.wd&&(this.wd=i,this.ot(),this.Ks=parseFloat(e.letterSpacing)||parseFloat(e.wordSpacing)?"":t,this.Cd=parseFloat(e.paddingLeft)+parseFloat(e.paddingRight)+parseFloat(e.borderLeftWidth)+parseFloat(e.borderRightWidth),this.Re.style.width="10000px",this.Re.textContent="M",this.Td=Math.ceil(this.Re.getBoundingClientRect().height))}Af(e,t){let i=this.Re,r=0;for(let o of t){let s=ye(this.e,e,o);if(!s)continue;let a=this.Td;if(!this.Ks||this.e.Ue.oo(s,this.Ks)>o.currentWidth-this.Cd){let l=`${o.currentWidth}px`;i.style.width!==l&&(i.style.width=l),i.textContent!==s&&(i.textContent=s),a=Math.ceil(i.getBoundingClientRect().height),s.length>4096&&(i.textContent="")}r=Math.max(r,a)}return r}Pf(e,t){if(this.e.t.flashCells)for(let i of e)for(let r of t)this.mr.push([i,r])}Rd(){if(this.mr.length===0)return;let e=this.mr;this.mr=[];for(let[t,i]of e){let r=this.Gt(t,i);if(!r)continue;r.classList.remove("mach-cell--flash"),r.offsetWidth,r.classList.add("mach-cell--flash");let o=Pe(r),s=o.flashTimer;s&&clearTimeout(s),o.flashTimer=window.setTimeout(()=>{r.classList.remove("mach-cell--flash"),o.flashTimer=void 0},800)}}Ie(){this.Rn();let e=this.e.n.b.center,i=this.e.t.rowHeight;this.e.t.masterDetail&&(i=Math.min(i,this.e.t.detailRowHeight)),this._n>0&&(i=Math.min(i,this._n));let r=Math.ceil(e.clientHeight/Math.max(1,i)),o=this.Ct?this.e.i.G():r+this.e.t.rowBuffer*2+1,s=o%2===0?o:o+1;this.Ed(),s>this.m.length&&this.Sd(s),this.Kn(),this.hr(!0,!1),!this.e.o()&&this.Us()}Sd(e){for(;this.m.length<e;){let t={index:-1,nodeId:"",kind:"master",rows:{},cells:{}},i=this.e.n;for(let r of C){if(this.e.r.R(r).length===0)continue;let s=p("div","mach-row");s.style.height=`${this.e.t.rowHeight}px`,s.setAttribute("role","row"),s.style.display="none",i.ce[r].appendChild(s),t.rows[r]=s,t.cells[r]=this.$t(r).map(a=>s.appendChild(this.Md(a)))}if(this.e.t.masterDetail){let r=p("div","mach-row mach-detail-row");r.style.height=`${this.e.t.detailRowHeight}px`,r.setAttribute("role","row"),r.style.display="none",i.ce.center.appendChild(r),t.detailRow=r}this.m.push(t)}}$t(e){return e==="center"?this.fr:this.e.r.R(e)}Md(e){let t=p("div","mach-cell");if(t.dataset.colId=e.id,t.setAttribute("role","gridcell"),e.hasCheckbox){let i=p("input","mach-row-checkbox");i.type=this.e.t.rowSelection==="single"?"radio":"checkbox",i.type==="radio"&&(i.name=`mach-radio-${this.e.gridId}`),i.setAttribute("aria-label","select row"),t.appendChild(i),t.classList.add("mach-cell--selection")}return t}Gf(e){let t=new Map(this.fr.map((r,o)=>[r.id,o])),i=e.map(r=>{let o=t.get(r.id);return t.delete(r.id),o});for(let r of this.m){let o=r.rows.center,s=r.cells.center;if(!o||!s)continue;for(let l of t.values()){let d=s[l];r.index>=0&&this.e.a.en(r.index,d.dataset.colId??"",d),L(this.e,d),d.remove()}let a=o.firstElementChild;r.cells.center=e.map((l,d)=>{let u=i[d],c=u===void 0?this.Md(l):s[u];return c!==a&&o.insertBefore(c,a),a=c.nextElementSibling,c})}}Id(){this.gr=void 0,this.Ad(),this.vd(!0),this.bt=0,this.Ye=-1}vd(e){this.kd(0,e),this.Fn=void 0,this.fr=[]}kd(e,t){for(let i=e;i<this.m.length;i++){let r=this.m[i];r.detailRow&&this.js(r.detailRow);for(let o of C){for(let s of r.cells[o]??[])!t&&r.index>=0&&this.e.a.en(r.index,s.dataset.colId??"",s),L(this.e,s);t&&r.rows[o]?.remove()}t&&r.detailRow?.remove()}this.m.length=e}Kn(){let e=this.Lf();for(let t of C){let i=this.$t(t),r=this.Nf(t,i);this.Ff(t,i,r,e)}this.Of()}Lf(){return this.e.t.masterDetail||this.e.t.getRowHeight!=null||this.kf}Nf(e,t){if(e==="center"){let o=this.e.r.R("left").length;return t.map(s=>this.N.je(this.e.r.J(s.id)-o))}let i=0,r=[];for(let o of t)r.push(i),i+=o.currentWidth;return r}Ff(e,t,i,r){for(let o of this.m){let s=o.cells[e],a=o.rows[e];if(!s||!a)continue;r||(a.style.height=`${this.e.t.rowHeight}px`);let l=Math.min(t.length,s.length);for(let d=0;d<l;d++){let u=t[d],c=s[d];c.hasAttribute("aria-colspan")||(c.style.width=`${u.currentWidth}px`),c.style.left=`${i[d]}px`,c.setAttribute("aria-colindex",String(this.e.r.J(u.id)+1))}}}Of(){if(!this.e.t.masterDetail)return;let e=`${this.e.t.detailRowHeight}px`;for(let t of this.m)t.detailRow?.style.setProperty("--mach-detail-h",e)}Ed(){let e=this.e.n.b.center,t=this.e.r.R("center");this.N.update(t);let{first:i,lastExcl:r}=t.length>20?this.N.od(e.scrollLeft,e.clientWidth,2):{first:0,lastExcl:t.length};if(t===this.Fn&&i===this.mt&&r===this.Ht)return!1;let o=t.slice(i,r),s=i>0?t.slice(0,i).filter(a=>a.colDef.colSpan!=null).concat(o):o;return this.m.length>0&&this.Gf(s),this.Fn=t,this.fr=s,this.mt=i,this.Ht=r,this.zs=s.some(a=>a.colDef.colSpan!=null),!0}Co(){return{first:this.bt,lastExcl:this.Ye}}hr(e=!1,t=!0){let i=this.e.Ce.start(),r=this.Hf(e,t);if(this.e.o()||(this.e.a.Wo(),!r))return;let o=Math.max(0,this.Ye-this.bt);if(this.m.length>Math.max(32,o*2)){let a=o+o%2+8,l=new Map(this.m.filter(u=>u.index>=0).map(u=>[u.index%a,u])),d=this.m.filter(u=>u.index<0);this.m=Array.from({length:a},(u,c)=>l.get(c)??d.pop()).concat(d),this.kd(a,!0)}this.wi();let s=this.e.r.R("left").length+this.$t("center").length+this.e.r.R("right").length;this.e.Ce.Eh(i,o,s)}Hf(e,t){let i=this.e.n.b.center,r=this.S.read(i.scrollTop)-i.scrollTop,o=r!==this.wt;this.wt=r;let s=this.e.i.G(),a=this.e.t.rowBuffer,l=t&&this.Ed();if(l&&this.Kn(),s===0){for(let c of this.m)this.Pd(c);return this.bt=0,this.Ye=0,!0}let{first:d,lastExcl:u}=this.Vf(i,s,a);return!e&&!l&&d===this.bt&&u===this.Ye?(o&&this.Gd(),o):(this.Bf(d,u),this.bt=d,this.Ye=u,this._f(d,u,e,l),l&&this.yr(),o&&this.Gd(),!0)}Vf(e,t,i){if(this.Ct)return{first:0,lastExcl:t};let r=this.S.read(e.scrollTop),o=this.On(r,t),s=r+e.clientHeight,a=Math.min(t,this.On(s,t)+1);return{first:T(o-i,0,t-1),lastExcl:T(a+i,1,t)}}Bf(e,t){if(!(this.Ct&&this.bt===0&&t>=this.Ye))for(let i of this.m)i.index!==-1&&(i.index<e||i.index>=t)&&this.Pd(i)}_f(e,t,i,r){let o=t-e;o>this.m.length&&(this.Sd(o+o%2),this.Kn());for(let s=e;s<t;s++){let a=this.e.i.h(s),l=this.m[s%this.m.length];if(!(!l||!a)){if(!i&&l.index===s&&l.nodeId===a.id){r&&l.kind==="master"&&this.Un(l,a,"center");continue}this.zf(l,s,a)}}}Pd(e){if(this.Ld(e),this.Ct&&e.index>=0)for(let t of C)for(let i of e.cells[t]??[])L(this.e,i);this.v?.rowIndex===e.index&&this.e.n.root.removeAttribute("aria-activedescendant"),e.index=-1,e.nodeId="",e.kind="master";for(let t of C){let i=e.rows[t];i&&(i.style.display="none",delete i.dataset.id,delete i.dataset.index,Ie(i,void 0),i.classList.remove("mach-row--drag-source"))}e.detailRow&&(this.js(e.detailRow),e.detailRow.style.display="none")}zf(e,t,i){e.index>=0&&e.index!==t&&this.Ld(e),e.index=t,e.nodeId=i.id;let r=this.Ne(t),o=r-this.wt,s=this.Ne(t+1)-r;if(i.isDetail){this.Wf(e,i,t,o,s);return}this.$f(e,i,t,o,s)}Gd(){for(let e of this.m){if(e.index<this.bt||e.index>=this.Ye)continue;let t=`translateY(${this.Ne(e.index)-this.wt}px)`;for(let i of Object.values(e.rows))i.style.transform=t;e.detailRow&&(e.detailRow.style.transform=t)}}Wf(e,t,i,r,o){e.kind="detail";for(let a of C){let l=e.rows[a];l&&(l.style.display="none")}let s=e.detailRow;s&&(this.Nd(s,i,r,o),this.qs(s,t))}$f(e,t,i,r,o){e.kind="master",e.detailRow&&(e.detailRow.style.display="none");let s=this.Kf(t),a=Ue(this.e,t);for(let l of C){let d=e.rows[l];if(d&&(this.Uf(d,t,i,r,o,s),Ie(d,a),!this.Un(e,t,l)))return}this.v&&this.v.rowIndex===i&&this.yr()}Kf(e){let t=this.e.i.M,i=e.isGroup===!0,r=t&&this.e.i.xo(e.id),o=i||r||this.e.t.masterDetail&&this.e.i.isRowExpandable(e),s=i?this.e.i.isGroupExpanded(e.id):this.e.i.isRowExpanded(e.id),a=null;return i?a=(e.groupLevel??0)+1:t&&(a=this.e.i.Ur(e)+1),{expanded:s,expandable:o,level:a}}Uf(e,t,i,r,o,s){this.Nd(e,i,r,o,t.id),this.Fd(e,t);let a=this.Ln===i&&!this.e.t.suppressRowHoverHighlight;e.classList.toggle("mach-row--hover",a),e.classList.toggle("mach-row--odd",i%2===1),e.classList.toggle("mach-row--drag-source",this.zt.isSource(t)),this.jf(e,s)}Nd(e,t,i,r,o){e.style.display="",e.style.transform=`translateY(${i}px)`,e.style.zIndex=String(-t),e.style.height=`${r}px`,e.dataset.index=String(t),o!==void 0&&(e.dataset.id=o),e.setAttribute("aria-rowindex",String(t+this.e.n.jl()+1))}Fd(e,t){e.classList.toggle("mach-row--selected",t.selected),e.setAttribute("aria-selected",t.selected?"true":"false")}jf(e,t){t.expandable?e.setAttribute("aria-expanded",t.expanded?"true":"false"):e.removeAttribute("aria-expanded"),t.level!=null?e.setAttribute("aria-level",String(t.level)):e.removeAttribute("aria-level")}Un(e,t,i,r,o){let s=this.$t(i),a=e.cells[i];if(!a)return!0;let l=e.index,d=this.e.r,u=i==="center"&&this.zs,c=u?d.R("left").length:0,h=0;e.rows[i]?.classList.toggle("mach-row--editing",this.e.a.fl(l));for(let f=0;f<s.length;f++){let m=s[f],g=a[f];if(g){if(u){let b=d.J(m.id)-c,w=b<h?0:this.qf(t,m,l,this.Fn.length-b);if(w>0&&(h=b+w),w===0||h<=this.mt){if(!this.Yf(e,t,m,g,s))return!1;continue}this.Xf(g,b,w)}if(g.style.display==="none"&&(g.style.display=""),g.removeAttribute("aria-hidden"),!this.Od(g,t,m,l,r,o))return!1}}return!0}Yf(e,t,i,r,o){let s=e.index;return this.e.a.en(s,i.id,r)||this.e.o()||this.fr!==o||e.index!==s||this.e.i.h(s)!==t?!1:(L(this.e,r),r.firstChild&&r.replaceChildren(),r.setAttribute("aria-hidden","true"),r.style.display="none",!0)}qf(e,t,i,r){let o=t.colDef.colSpan;if(!o)return 1;try{let s=o(ge(this.e,e,t,this.e.d(e,t),i));return Math.max(1,Math.min(Math.round(s)||1,r))}catch(s){return this.e.reportError(s,"colSpan",{colId:t.id,rowId:e.id}),1}}Xf(e,t,i){if(i===1&&!e.hasAttribute("aria-colspan"))return;let r=`${this.N.je(t+i)-this.N.je(t)}px`;e.style.width!==r&&(e.style.width=r),i>1?e.setAttribute("aria-colspan",String(i)):e.removeAttribute("aria-colspan")}qs(e,t){this.js(e);let i=t.masterId!=null?this.e.i.F(t.masterId):t,r=p("div","mach-detail");e.appendChild(r);let o=this.e.t.detailRowRenderer;if(o){let s={data:t.data,node:i??t,api:this.e.api},a;try{a=o(s)}catch(l){this.e.reportError(l,"detailRowRenderer",{rowId:t.id}),a=null}typeof a=="string"?r.textContent=a:a instanceof HTMLElement?r.appendChild(a):a&&typeof a=="object"&&a.el instanceof HTMLElement&&(r.appendChild(a.el),Je(e,a.destroy))}}js(e){let t=Ze(e);if(t)try{t()}catch(i){this.e.reportError(i,"detailRowRenderer.destroy")}e.textContent=""}Od(e,t,i,r,o,s){if(this.e.a.qc(r,t,i,e))return!0;if(t.loading){L(this.e,e),e.className="mach-cell mach-cell--loading",e.setAttribute("aria-readonly","true"),e.setAttribute("aria-busy","true");let a=p("span","mach-cell-loading-bar");a.style.width=`${34+(i.id.length*13+t.rowIndex*7)%44}%`,e.replaceChildren(a),this.Kt(e)}else{if(o&&(s==null||s.has(i.id))){let d=t.data;if(L(this.e,e),this.e.o()||t.data!==d||this.e.i.h(t.rowIndex)!==t||this.e.r.x(i.id)!==i||this.Gt(t.rowIndex,i.id)!==e)return!1}e.removeAttribute("aria-busy");let a=this.e.a.ae(t,i);e.setAttribute("aria-readonly",a?"false":"true"),e.removeAttribute("aria-expanded"),e.removeAttribute("aria-level");let l=this.Jf(t,i);l!=="standard"?(L(this.e,e),this.Zf(l,e,t,i)):(et(this.e,e,t,i),this.Hd(e,t,i),this.Qf(e,t,i,a))}return this.Vd(e,r,i),!0}Jf(e,t){return e.isGroup?"group":t.isDetailToggle?"detail":t.hasCheckbox?"checkbox":t.colDef.rowDrag?"drag":we(t.colDef,"index")?"index":this.e.i.M&&this.Bd()?.id===t.id?"tree":"standard"}Zf(e,t,i,r){if(e==="group")this.em(t,i,r);else if(e==="detail"){let o=this.e.i.isRowExpanded(i.id),s=p("span",`mach-detail-toggle${o?" mach-detail-toggle--open":""}`);s.textContent="\u25B6",t.replaceChildren(s),t.classList.add("mach-cell--detail-toggle"),this.Kt(t)}else if(e==="checkbox")this._d(t,i),this.Kt(t);else if(e==="drag")this.tm(t,i),t.className!=="mach-cell mach-cell--drag"&&(t.className="mach-cell mach-cell--drag"),this.Kt(t);else if(e==="index"){t.textContent=String(this.e.i.qa(i)+this.e.t.indexOffset);let o=`mach-cell mach-cell--index ${Qe(r)}`;t.className!==o&&(t.className=o),this.Hd(t,i,r)}else this.im(t,i,r)}Qf(e,t,i,r){if(this.e.t.editType!=="cell"||this.e.t.editableIndicator==="none"||!r)return;let o=p("button",`mach-cell-edit-trigger mach-cell-edit-trigger--${this.e.t.editableIndicator}`);o.type="button",o.tabIndex=-1,o.title="Edit cell",o.setAttribute("aria-label","Edit cell"),o.innerHTML=J(Si),o.addEventListener("mousedown",s=>{s.preventDefault(),s.stopPropagation()}),o.addEventListener("click",s=>{s.preventDefault(),s.stopPropagation(),this.Ae(t.rowIndex,i.id),this.e.a.start(t.rowIndex,i)}),e.appendChild(o)}Ld(e){if(!(e.index<0))for(let t of C)for(let i of e.cells[t]??[])this.e.a.en(e.index,i.dataset.colId??"",i)}Bd(){return this.gr!==void 0?this.gr:(this.gr=this.e.r.l().find(e=>!e.hasCheckbox&&!e.isDetailToggle&&!e.colDef.rowDrag&&!we(e.colDef,"index"))??null,this.gr)}im(e,t,i){let r=this.e.i.isRowExpandable(t),o=this.e.i.Ur(t),s=Y(this.e,t,i,this.e.d(t,i)),a=p("span","mach-tree-indent");a.style.width=`${o*16}px`;let l=p("span","mach-tree-cell");if(o>0&&l.appendChild(a),r){let u=this.e.i.isRowExpanded(t.id);e.setAttribute("aria-expanded",u?"true":"false"),e.setAttribute("aria-level",String(o+1));let c=t.treeLoading?" mach-detail-toggle--loading":t.treeLoadError?" mach-detail-toggle--error":"",h=p("button","mach-tree-toggle");h.type="button",h.tabIndex=-1,h.setAttribute("aria-label",t.treeLoadError?"Retry loading children":u?"Collapse row":"Expand row"),h.setAttribute("aria-expanded",String(u)),t.treeLoadError&&(h.title="Retry loading children");let f=p("span",`mach-detail-toggle${u?" mach-detail-toggle--open":""}${c}`);f.setAttribute("aria-hidden","true"),f.textContent="\u25B6",h.appendChild(f),h.addEventListener("keydown",m=>{(m.key==="Enter"||m.key===" ")&&m.stopPropagation()}),l.appendChild(h)}else{let u=p("span","mach-tree-toggle-spacer");l.appendChild(u)}let d=p("span","mach-tree-text");d.textContent=s,l.appendChild(d),e.replaceChildren(l),s&&!this.e.t.tooltipComponent?e.title=s:e.removeAttribute("title"),Ci(this.e,e,t,i)}Kt(e){e.style.height!==""&&(e.style.height=""),e.style.display==="none"&&(e.style.display=""),e.removeAttribute("aria-rowspan")}Hd(e,t,i){let r=this.e.i.ac(i.id);if(!r||t.isDetail){this.Kt(e);return}let o=this.e.i.qa(t)-1;if(o<0||o>=r.length){this.Kt(e);return}let s=r[o];if(s===-1){e.style.display="none",e.setAttribute("aria-hidden","true");return}if(e.style.display==="none"&&(e.style.display=""),e.removeAttribute("aria-hidden"),s>1){let a=Math.min(o+s,this.e.i.G()),l=this.Ne(a)-this.Ne(o);e.style.height=`${l>0?l:s*this.e.t.rowHeight}px`,e.setAttribute("aria-rowspan",String(s))}else this.Kt(e)}em(e,t,i){if(i.hasCheckbox){this._d(e,t);return}if(i.isDetailToggle){this.zd(e);return}let r=this.e.r.ha();if(r&&i.id===r.id){this.rm(e,t);return}this.nm(e,t,i)||this.zd(e)}_d(e,t){let i=e.querySelector(".mach-row-checkbox");if(i){let r=this.e.f,o=t.isGroup?r.tl(t):null;i.checked=o?.all??t.selected,i.indeterminate=o?o.some&&!o.all:r.gc(t.id),i.disabled=!r.ze(t)}e.className!=="mach-cell mach-cell--selection"&&(e.className="mach-cell mach-cell--selection")}rm(e,t){let i=this.e.i.isGroupExpanded(t.id),r=t.groupLevel??0;e.setAttribute("aria-expanded",i?"true":"false"),e.setAttribute("aria-level",String(r+1));let o=p("span","mach-group-label");o.style.paddingLeft=`${r*16}px`;let s=p("span",`mach-detail-toggle${i?" mach-detail-toggle--open":""}`);s.textContent="\u25B6";let a=p("span","mach-group-text"),l=this.e.r.Je()[r],d=l?.colDef.headerName?`${l.colDef.headerName}: `:"";a.textContent=`${d}${t.groupKey??""}`;let u=p("span","mach-group-count");u.textContent=`(${t.leafNodes?.length??0})`,o.append(s,a,u),e.replaceChildren(o),e.className!=="mach-cell mach-cell--group"&&(e.className="mach-cell mach-cell--group")}nm(e,t,i){if(!i.colDef.aggFunc||!t.aggValues||!v(t.aggValues,i.id))return!1;let r=t.aggValues[i.id];e.textContent=i.colDef.valueFormatter!=null?Y(this.e,t,i,r):wi(r);let o=`mach-cell ${Qe(i)}`;return e.className!==o&&(e.className=o),!0}zd(e){e.textContent="",e.className!=="mach-cell"&&(e.className="mach-cell")}O(e){if(this.e.o())return;let t=new Set;for(let i of e){if(i<0||t.has(i))continue;t.add(i);let r=this.m[i%this.m.length];if(!r||r.index!==i)continue;let o=this.e.i.h(i);if(o){if(r.kind==="detail"){r.detailRow&&this.qs(r.detailRow,o);continue}for(let s of C){let a=r.rows[s];if(a&&this.Fd(a,o),!!r.cells[s]&&!this.Un(r,o,s))break}}}this.yr(),this.Rd()}refreshCells(e={}){if(this.e.o())return;let t=e.rowIds==null?null:new Set(e.rowIds),i=e.rowIndexes==null?null:new Set(e.rowIndexes),r=e.columns==null?null:new Set(e.columns);for(let o of this.m){let s=this.e.i.h(o.index);!s||!this.om(o,s,t,i)||this.sm(o,s,r,e.force===!0)}this.yr(),this.Rd()}om(e,t,i,r){return e.index<0?!1:i==null&&r==null?!0:i?.has(t.id)===!0||r?.has(e.index)===!0}sm(e,t,i,r){if(e.kind==="detail"){i==null&&e.detailRow&&this.qs(e.detailRow,t);return}let o=i==null||this.zs,s=Ue(this.e,t);for(let a of C){let l=e.rows[a];if(l&&Ie(l,s),o){if(!this.Un(e,t,a,r,i))return}else if(!this.am(e,t,a,i,r))return}}am(e,t,i,r,o){let s=this.$t(i),a=e.cells[i];if(!a)return!0;for(let l=0;l<s.length;l++){let d=s[l];if(!r.has(d.id))continue;let u=a[l];if(u&&!this.Od(u,t,d,e.index,o))return!1}return!0}lm(){this.e.o()||(this.v&&this.v.rowIndex>=this.e.i.G()&&this.Ae(null,null),this.Ad(),this.Rn(),this.hr(!0),this.Us(),this.e.Nt.refresh())}Us(){let e=this.e.t,t=e.loading?"loading":e.error!=null?"error":this.e.i.G()===0&&!e.suppressNoRowsOverlay?"noRows":null;qt(this.e,t)}Gt(e,t){let i=this.e.r.x(t);if(!i)return null;let r=this.bf(i),o=this.$t(r).indexOf(i);if(o<0)return null;let s=this.m[e%this.m.length];return!s||s.index!==e||s.kind!=="master"?null:s.cells[r]?.[o]??null}Ad(){this.pe.Jt()}De(){let e=this.e.i.G(),t=this.e.r.l().length;return this.pe.normalize(e,t)}ai(){let e=this.De();if(e)return e;let t=this.v;if(t){let i=this.e.r.J(t.colId);if(i>=0)return{r1:t.rowIndex,c1:i,r2:t.rowIndex,c2:i}}return null}lr(){let e=this.De();if(!e)return null;let t=this.e.r.l();return{row1:e.r1,row2:e.r2,colId1:t[e.c1]?.id??"",colId2:t[e.c2]?.id??""}}zo(){let e=this.pe.tf();if(e)return{row:e.row,colIdx:e.colIdx};let t=this.ai();return t?{row:t.r1,colIdx:t.c1}:null}li(){let e=this.De();this.pe.clear(),e&&(this.jn(),this.wi(),this.e.emit("rangeSelectionChanged",{range:null}))}jn(){for(let e of this.m)if(!(e.index<0||e.kind!=="master"))for(let t of C){let i=this.$t(t);e.cells[t]?.forEach((r,o)=>{let s=i[o];s&&this.Vd(r,e.index,s)})}}Ys(e,t,i){this.pe.start({row:e,colIdx:t},i),this.jn(),this.wi(),this.e.emit("rangeSelectionChanged",{range:this.lr()})}zc(e,t){if(!this.pe.rf()){let a=this.v;if(!a)return;let l=this.e.r.J(a.colId);if(!this.pe.nf({row:a.rowIndex,colIdx:l}))return}let i=this.e.i.G(),r=this.e.r.l().length;this.pe.setEnd({row:Math.max(0,Math.min(e,i-1)),colIdx:Math.max(0,Math.min(t,r-1))}),this.jn(),this.wi();let o=this.e.r.l(),s=this.pe.ks();s&&s.colIdx<o.length&&this.Ae(s.row,o[s.colIdx].id),this.e.emit("rangeSelectionChanged",{range:this.lr()})}Vd(e,t,i){let r=this.De();if(!r){e.classList.contains("mach-cell--range")&&e.classList.remove("mach-cell--range","mach-cell--range-top","mach-cell--range-bottom","mach-cell--range-left","mach-cell--range-right");return}let o=this.e.r.J(i.id);if(o<0)return;let s=t>=r.r1&&t<=r.r2&&o>=r.c1&&o<=r.c2;e.classList.toggle("mach-cell--range",s),s?(e.classList.toggle("mach-cell--range-top",t===r.r1),e.classList.toggle("mach-cell--range-bottom",t===r.r2),e.classList.toggle("mach-cell--range-left",o===r.c1),e.classList.toggle("mach-cell--range-right",o===r.c2)):e.classList.remove("mach-cell--range-top","mach-cell--range-bottom","mach-cell--range-left","mach-cell--range-right")}dm(){if(this.Vn)return this.Vn;let e=p("div","mach-fill-handle");return e.style.display="none",e.addEventListener("pointerdown",t=>{this.Xs=!0,this.Wd(t)}),e.addEventListener("mousedown",t=>{this.Xs||this.Wd(t)}),this.e.n.ce.center.appendChild(e),this.Vn=e,e}wi(){let e=this.dm(),t=this.De();if(!this.e.t.enableRangeSelection||!this.e.t.fillHandle||!t){e.style.display="none";return}let i=this.e.r,r=i.R("left").length,o=i.R("center");if(t.c2<r||t.c2>=r+o.length){e.style.display="none";return}let s=t.c2-r;this.N.update(o);let a=this.N.je(s+1),l=this.Ne(Math.min(t.r2+1,this.e.i.G()))-this.wt,d=this.e.n.b.center;if(this.S.vt&&(l<d.scrollTop||l>d.scrollTop+d.clientHeight)){e.style.display="none";return}e.style.display="",e.style.left=`${this.S.vt?Math.min(a-4,parseFloat(this.e.n.ce.center.style.width)-8):a-4}px`,e.style.top=`${Math.min(l-4,this.S.height-8)}px`}Wd(e){if(this.e.o()||e.button!==0)return;let t=this.De();t&&(e.preventDefault(),e.stopPropagation(),this.vr={r1:t.r1,r2:t.r2,c1:t.c1,c2:t.c2,startX:e.clientX,startY:e.clientY,axis:null,active:!1},this.$d(!0))}Kd(e){let i=this.e.n.ce.center.getBoundingClientRect(),r=e.clientY-i.top+this.wt,o=this.e.i.G(),s=this.On(r,o);return Math.max(this.vr.r2,Math.min(s,o-1))}Ud(e){let i=this.e.n.ce.center.getBoundingClientRect(),r=e.clientX-i.left,o=this.e.r,s=o.R("left").length,a=o.R("center");this.N.update(a);let l=this.N.Hp(r);if(l<0)return s;let d=this.N.je(l)+a[l].currentWidth/2;return r<d?s+l:l+1<a.length?s+l+1:s+a.length-1}$d(e){let t=e?"addEventListener":"removeEventListener";for(let i of["pointermove","mousemove"])window[t](i,this.um);for(let i of["pointerup","mouseup","pointercancel"])window[t](i,this.cm)}Hn(){this.vr=null,this.Xs=!1,this.$d(!1),this.e.n.root.classList.remove("mach-root--filling")}jd(e,t,i){let r=this.pe.ks();!r||t===(e?r.colIdx:r.row)||(this.pe.setEnd(e?{row:r.row,colIdx:t}:{row:t,colIdx:r.colIdx}),this.jn(),i&&(e&&this.wi(),this.e.emit("rangeSelectionChanged",{range:this.lr()})))}hm({r1:e,r2:t,c1:i,c2:r},o,s){let a=this.e.r.l(),l=[],d=s?i:e,u=s?r:t,c=s?t:r;for(let h=s?e:i;h<=c;h++){let f=s?this.e.i.h(h):void 0,m=s?void 0:a[h];(s?!f||f.isDetail||f.isGroup:!Xn(m))||this.pm(a,d,u,o,l,f,m)}this.e.pi(l),this.e.emit("rangeSelectionChanged",{range:this.lr()})}pm(e,t,i,r,o,s,a){let l=[];for(let u=t;u<=i;u++){let c=s??this.e.i.h(u),h=a??e[u];l.push(c&&h?this.e.d(c,h):void 0)}if(a&&l.length===1&&l[0]===void 0)return;let d=Ta(l);for(let u=i+1;u<=r;u++){let c=s??this.e.i.h(u),h=a??e[u];if(!c||!Xn(h)||!this.e.a.ae(c,h))continue;let f=Da(d,u-t),m=this.e.d(c,h);o.push({node:c,column:h,oldValue:m,newValue:f})}}Ae(e,t){if(this.fm(),e==null||t==null){this.v=null;return}this.v={rowIndex:e,colId:t},this.yr(),this.mm()}yr(){if(!this.v)return;let e=this.Gt(this.v.rowIndex,this.v.colId);if(e&&e.style.display!=="none"){let t=Math.max(0,this.e.r.J(this.v.colId));e.id=`mach-grid-${this.e.gridId}-r${this.v.rowIndex}-c${t}`,e.classList.add("mach-cell--focus"),this.e.n.root.setAttribute("aria-activedescendant",e.id)}else this.e.n.root.removeAttribute("aria-activedescendant")}fm(){if(this.v){let e=this.Gt(this.v.rowIndex,this.v.colId);e&&(e.classList.remove("mach-cell--focus"),e.removeAttribute("id"))}this.e.n.root.removeAttribute("aria-activedescendant")}mm(){if(!this.v)return;this.jr(this.v.rowIndex,"nearest");let e=this.e.r.x(this.v.colId);!e||e.pinned||this.N.Mn(this.e.n.b.center,this.e.r.R("center"),e)}jr(e,t="top"){let i=this.e.n.b.center,r=this.e.i.G();if(r===0)return;let o=T(e,0,r-1),s=i.clientHeight,a=this.S.read(i.scrollTop),l=this.Ne(o),d=this.Ne(o+1),u=a;t==="top"?u=l:t==="bottom"?u=d-s:t==="middle"?u=l-(s-(d-l))/2:l<a?u=l:d>a+s&&(u=d-s);let c=Math.max(0,this.Ne(r)-s);this.$n(T(u,0,c)),this.xn()}qd(e){if(this.Ln===e)return;let t=this.Ln;this.Ln=e,this.Yd(t,!1),this.Yd(e,!0)}Yd(e,t){if(e<0)return;let i=this.m[e%this.m.length];if(!(!i||i.index!==e||i.kind!=="master"))for(let r of C)i.rows[r]?.classList.toggle("mach-row--hover",t)}br(){this.e.n.root.focus({preventScroll:!0})}Ut(e){let t=e.target,i=t.closest(".mach-row");if(!i)return null;let r=Number(i.dataset.index);if(Number.isNaN(r))return null;let o=this.e.i.h(r);if(!o)return null;let s=t.closest(".mach-cell");return{node:o,index:r,cellEl:s}}Xd(e,t,i){let{node:r,index:o,cellEl:s}=i;if(this.gm(t,r,s)||this.ym(t,r,s))return;let a=s?.dataset.colId??"",l=a?this.e.r.x(a):void 0;this.vm(r,l)||r.isDetail||this.bm(t,r,o,e)||!s||!l||(this.br(),this.e.t.suppressCellFocus||this.Ae(o,a),this.e.f.rl(r,e,!1),this.wm(e,r,o,l),this.Cm(r,o,l))}gm(e,t,i){if(!t.isGroup)return!1;if(this.br(),e.closest(".mach-row-checkbox")){let o=this.e.f.tl(t).all;return this.e.f.vc(t,!o),!0}let r=this.e.r.ha();return(!r||!i||i.dataset.colId===r.id)&&this.e.i.Io(t.id),!0}vm(e,t){return!t?.isDetailToggle||e.isDetail?!1:(this.br(),this.e.qr(e.id),!0)}bm(e,t,i,r){let o=e.closest(".mach-cell--selection");return o?(this.br(),this.e.t.suppressCellFocus||this.Ae(i,o.dataset.colId??""),this.li(),this.e.f.rl(t,r,!0),!0):!1}wm(e,t,i,r){let o=this.e.d(t,r),s=this.e.emit("cellClicked",{event:e,rowNode:t,rowIndex:i,column:r,colDef:r.colDef,value:o});r.colDef.onCellClick?.(s),this.e.emit("rowClicked",{event:e,rowNode:t,rowIndex:i})}Cm(e,t,i){(this.e.t.singleClickEdit||i.colDef.singleClickEdit===!0)&&this.e.a.ae(e,i)&&this.e.a.start(t,i)}ym(e,t,i){if(!this.e.i.M||!e.closest(".mach-tree-toggle"))return!1;let r=this.Bd();return!r||i?.dataset.colId!==r.id||!this.e.i.isRowExpandable(t)?!1:(this.br(),t.treeLoadError?this.e.i.loadTreeChildren(t.id,!0).catch(()=>{}):this.e.i.qr(t.id),!0)}Tm(e){return!!(e.target.closest(".mach-cell-editor-shell, .mach-row-editor-shell, .mach-tree-toggle, .mach-row-drag-handle")||this.e.a.Qr())}tm(e,t){let i=e.querySelector("button.mach-row-drag-handle"),r=i?.value===t.id?i:p("button","mach-row-drag-handle");r.type="button",r.value=t.id;let o=this.zt.pd(t);r.disabled=o!==!0;let s=this.e.u("rowDragHandle");r.setAttribute("aria-label",s),r.title=typeof o=="string"?o:r.disabled?this.e.u("rowDragUnavailable"):s,r.setAttribute("aria-keyshortcuts","Alt+ArrowUp Alt+ArrowDown"),r!==i&&e.replaceChildren(r)}};var ni=class{constructor(e){this.e=e;this.Fe=null;this.Jd={left:void 0,center:void 0,right:void 0};this.Zs={left:[],center:[],right:[]}}init(){this.Fe=p("div","mach-footer"),this.Fe.style.display="none",this.Fe.setAttribute("role","row"),this.e.n.root.appendChild(this.Fe);for(let e of C){let t=p("div",`mach-footer-row mach-footer-row--${e}`);t.style.height=`${this.e.t.rowHeight}px`,this.Fe.appendChild(t),this.Jd[e]=t}}setVisible(e){this.Fe&&(this.Fe.style.display=e?"":"none")}refresh(){if(!this.Fe||this.e.o())return;let e=this.e.t.showSummary;if(this.setVisible(e),!e)return;let t=this.e.t.summaryMethod,i=this.e.i.It().filter(r=>!r.isDetail&&!r.isGroup);for(let r of C){let o=this.e.r.R(r),s=this.Jd[r];this.Zs[r].length!==o.length&&(s.textContent="",this.Zs[r]=o.map(()=>{let l=p("div","mach-footer-cell");return l.setAttribute("role","cell"),s.appendChild(l),l}));let a=0;o.forEach((l,d)=>{let u=this.Zs[r][d];if(u.style.left=`${a}px`,u.style.width=`${l.currentWidth}px`,a+=l.currentWidth,l.hasCheckbox||l.isDetailToggle||l.colDef.rowDrag){u.textContent="";return}if(t)try{u.textContent=t({colId:l.id,column:l,values:i.map(c=>this.e.d(c,l))})}catch(c){this.e.reportError(c,"summaryMethod",{colId:l.id}),u.textContent=""}else d===0&&r==="left"?u.textContent=W(this.e.u("totalRowsLabel"),i.length):u.textContent=""})}}destroy(){this.Fe?.remove(),this.Fe=null}};var oi=class{constructor(e){this.e=e;this.D=null;this.qn=null;this.Qs=null;this.Ci=null;this.jt=null;this.Yn=null;this.Xn=null;this.Jn=null;this.Zn=null;this.qt=[]}init(){this.D=p("div","mach-pagination"),this.D.style.display="none",this.D.setAttribute("role","navigation");let e=(t,i,r,o)=>{let s=U(`mach-pagination-btn ${t}`,r,o);return s.title=i,s.setAttribute("aria-label",i),s};this.qn=p("span","mach-pagination-total"),this.Yn=e("mach-pagination-first",this.e.u("pageFirst"),"\xAB",()=>this.e.i.setPage(1)),this.Xn=e("mach-pagination-prev",this.e.u("pagePrev"),"\u2039",()=>this.e.i.setPage(this.e.i.ei()-1)),this.Qs=p("span","mach-pagination-page"),this.Jn=e("mach-pagination-next",this.e.u("pageNext"),"\u203A",()=>this.e.i.setPage(this.e.i.ei()+1)),this.Zn=e("mach-pagination-last",this.e.u("pageLast"),"\xBB",()=>this.e.i.setPage(this.e.i.getPageCount())),this.D.append(this.qn,this.Yn,this.Xn,this.Qs,this.Jn,this.Zn),this.e.t.paginationShowSizeSelector&&(this.jt=ae({ariaLabel:"page size",options:[],classNames:{root:"mach-pagination-size-control",native:"mach-pagination-size"},themeSource:this.e.n.root,onChange:t=>{let i=Number(t);Number.isNaN(i)||this.e.i.setPageSize(i)}}),this.Ci=this.jt.native,this.Zd(),this.D.appendChild(this.jt.el)),this.e.n.root.appendChild(this.D),this.qt.push(this.e.ue.on("modelUpdated",()=>this.refresh()),this.e.ue.on("paginationChanged",()=>this.refresh())),this.refresh()}Zd(){if(!this.Ci)return;let e=this.e.t.paginationPageSizeOptions,t=this.e.t.paginationPageSize;e.includes(t)||(e.push(t),e.sort((i,r)=>i-r)),this.jt?.setOptions(e.map(i=>({value:String(i),label:W(this.e.u("perPage"),i)})),String(t))}xe(){this.D&&(this.Ci&&this.e.t.paginationShowSizeSelector&&this.Zd(),this.refresh())}Qd(e,t){e&&e.textContent!==t&&(e.textContent=t)}Dm(e,t){let i=e<=1,r=e>=t;this.Yn&&(this.Yn.disabled=i),this.Xn&&(this.Xn.disabled=i),this.Jn&&(this.Jn.disabled=r),this.Zn&&(this.Zn.disabled=r)}refresh(){if(!this.D||this.e.o())return;let e=this.e.i,t=e.Te,i=e.getTotalRowCount(),r=t&&i>0;if(this.D.style.display=r?"":"none",!r)return;let o=e.ei(),s=e.getPageCount();this.qn&&this.e.t.paginationShowTotal&&this.Qd(this.qn,W(this.e.u("paginationTotal"),i)),this.Qd(this.Qs,Te(this.e.u("paginationPage"),o,s)),this.Dm(o,s),this.Ci&&Number(this.Ci.value)!==this.e.t.paginationPageSize&&this.jt?.setValue(String(this.e.t.paginationPageSize))}destroy(){for(let e of this.qt)e();this.qt=[],this.jt?.destroy(),this.jt=null,this.Ci=null,this.D?.remove(),this.D=null}};var si=class{constructor(e){this.e=e;this.top=null;this.bottom=null}init(){this.top=this.eu(this.e.n.vn),this.bottom=this.eu(this.e.n.bn)}eu(e){let t={root:e,segments:{left:p("div"),center:p("div"),right:p("div")},centerViewport:p("div","mach-pinned-viewport"),rowWrappers:{left:[],center:[],right:[]},cells:[],data:[]};for(let i of C)t.segments[i].className=`mach-pinned-seg mach-pinned-seg--${i}`,i!=="center"&&t.segments[i].classList.add("mach-pane--hidden"),i==="center"&&t.centerViewport.appendChild(t.segments[i]);return e.append(t.segments.left,t.centerViewport,t.segments.right),t}setData(e,t){this.e.o()||!this.top||!this.bottom||(this.top.data=e??[],this.bottom.data=t??[],this.refresh(),this.e.Ie())}setRows(e,t){let i=this[e];this.e.o()||!i||(i.data=t??[],this.ea(i,e),this.gt(),this.e.Ie())}getRows(e){return this[e]?.data.slice()??[]}xe(){!this.top||!this.bottom||(this.ea(this.top,"top"),this.ea(this.bottom,"bottom"))}ea(e,t){this.mi(e);for(let o of C){for(let s of e.rowWrappers[o])s.remove();e.rowWrappers[o]=[]}if(e.root.style.display=e.data.length>0?"":"none",e.data.length===0)return;let i=this.e.t.rowHeight,r=this.e.r;e.data.forEach((o,s)=>{let a={id:`__pinned_${t}_${s}`,data:o,rowIndex:-1,selected:!1},l={},d=Ue(this.e,a,t);for(let u of C){let c=p("div","mach-pinned-row");Ie(c,d),c.style.height=`${i}px`,c.setAttribute("role","row"),l[u]=[];for(let h of r.R(u)){let f=p("div","mach-cell");if(f.dataset.colId=h.id,f.setAttribute("role","gridcell"),h.hasCheckbox&&f.classList.add("mach-cell--selection"),!h.hasCheckbox&&!h.isDetailToggle&&!h.colDef.rowDrag&&h.colDef.type!=="index")try{et(this.e,f,a,h)}catch(m){this.e.reportError(m,"pinnedRow.render",{colId:h.id,side:t,rowIndex:s})}c.appendChild(f),l[u].push(f)}e.segments[u].appendChild(c),e.rowWrappers[u].push(c)}e.cells.push(l)})}gt(){if(!this.top||!this.bottom)return;let e=this.e.r,t={left:0,center:0,right:0},i={left:[],center:[],right:[]};for(let r of C){let o=0;for(let s of e.R(r))i[r].push(o),o+=s.currentWidth;t[r]=o}for(let r of[this.top,this.bottom]){let o=r.data.length===0;r.segments.left.classList.toggle("mach-pane--hidden",o||t.left<=0),r.segments.right.classList.toggle("mach-pane--hidden",o||t.right<=0),r.segments.left.style.width=`${t.left}px`,r.segments.right.style.width=`${t.right}px`,r.segments.center.style.width=`${t.center}px`,r.cells.forEach(s=>{let a=0;for(let l of C){let d=e.R(l);s[l].forEach((u,c)=>{u.style.width=`${d[c].currentWidth}px`,u.style.left=`${i[l][c]}px`,u.setAttribute("aria-colindex",String(a+c+1))}),a+=d.length}})}}wf(e){this.top&&(this.top.segments.center.style.transform=`translateX(${-e}px)`),this.bottom&&(this.bottom.segments.center.style.transform=`translateX(${-e}px)`)}refresh(){this.xe(),this.gt()}destroy(){this.top&&this.mi(this.top),this.bottom&&this.mi(this.bottom),this.top=null,this.bottom=null}mi(e){for(let t of e.cells)for(let i of C)for(let r of t[i])L(this.e,r);e.cells=[]}};var ai=class{constructor(e){this.e=e;this.D=null;this.Ti={};this.qt=[]}init(){this.D=p("div","mach-statusbar"),this.D.style.display="none",this.D.setAttribute("role","status"),this.e.n.root.appendChild(this.D),this.xe(),this.qt.push(this.e.ue.on("modelUpdated",()=>this.refresh()),this.e.ue.on("selectionChanged",()=>this.refresh()),this.e.ue.on("rangeSelectionChanged",()=>this.refresh()),this.e.ue.on("cellValueChanged",()=>this.refresh()))}xe(){if(!this.D)return;this.D.textContent="",this.Ti={};let e=this.e.t;if(!e.statusBarEnabled){this.D.style.display="none";return}for(let t of e.statusBarPanels){let i=p("span",`mach-statusbar-item mach-statusbar-item--${t}`);this.D.appendChild(i),this.Ti[t]=i}this.refresh()}ta(e,t){return W(this.e.u(e),t||0)}ia(e,t){let i=this.Ti[e];i&&i.textContent!==t&&(i.textContent=t)}xm(){let e=this.e.i,t=e.Gi(),i=e.Te?e.getTotalRowCount():e.G(),r=W(this.e.u("totalRowsLabel"),i);return e.g&&t>i?`${r} / ${t}`:r}Rm(){let e=this.e.s.De();if(!e)return"";let t=this.e.r.l(),i=0,r=0;for(let a=e.r1;a<=e.r2;a++){let l=this.e.i.h(a);if(!(!l||l.isDetail||l.isGroup))for(let d=e.c1;d<=e.c2;d++){let u=t[d];if(!u)continue;let c=this.e.d(l,u);typeof c!="number"||Number.isNaN(c)||(i+=c,r++)}}if(r===0)return"";let o=Math.round(i/r*100)/100,s=Number.isInteger(i)?i:Math.round(i*100)/100;return`${this.ta("statusSum",s)} \xB7 ${this.ta("statusAvg",o)} \xB7 ${this.ta("statusCount",r)}`}refresh(){if(!this.D||this.e.o())return;let e=this.e.t;if(this.D.style.display=e.statusBarEnabled?"":"none",!!e.statusBarEnabled){if(this.Ti.rowCount&&this.ia("rowCount",this.xm()),this.Ti.selectedRowCount){let t=this.e.f.ti().length;this.ia("selectedRowCount",W(this.e.u("statusSelected"),t))}this.Ti.rangeAggregate&&this.ia("rangeAggregate",this.Rm())}}destroy(){for(let e of this.qt)e();this.qt=[],this.D?.remove(),this.D=null}};function or(){try{return typeof localStorage>"u"?null:localStorage}catch{return null}}function Jn(n){return typeof TextEncoder>"u"?n.length*2:new TextEncoder().encode(n).byteLength}function sr(n={}){let e=(n.namespace??"mach-table:grid-state").replace(/:+$/,""),t=Math.max(1024,Math.floor(n.maxBytes??512*1024)),i=o=>`${e}:${o}`,r=(o,s,a)=>{try{n.onError?.(o,s,a)}catch{}};return{storageKey:i,load(o){try{let s=(n.storage??or())?.getItem(i(o));if(!s)return null;if(Jn(s)>t)throw new RangeError(`[MachTable] Stored grid state for "${o}" exceeds ${t} bytes.`);let a=JSON.parse(s);if(a?.schemaVersion!==2)throw new TypeError(`[MachTable] Stored grid state for "${o}" uses an unsupported schema.`);let l=q(a.state);if(!l)throw new TypeError(`[MachTable] Stored grid state for "${o}" is invalid.`);return l}catch(s){return r(s,"load",o),null}},save(o,s){try{let a=q(s);if(!a)throw new TypeError(`[MachTable] Invalid grid state for "${o}".`);let l=JSON.stringify({schemaVersion:2,savedAt:Date.now(),state:a});if(Jn(l)>t)throw new RangeError(`[MachTable] Grid state for "${o}" exceeds ${t} bytes.`);(n.storage??or())?.setItem(i(o),l)}catch(a){r(a,"save",o)}},clear(o){try{(n.storage??or())?.removeItem(i(o))}catch(s){r(s,"clear",o)}}}}var ar=sr();function li(n,e){ar.save(n,e)}function di(n){return ar.load(n)}function Zn(n){ar.clear(n)}var je=class{constructor(e){this.onError=e;this.Qn=new Set;this.disposed=!1}add(e){let t=!0,i=()=>{if(t){t=!1,this.Qn.delete(i);try{e()}catch(r){try{this.onError(r)}catch{}}}};return this.disposed?i():this.Qn.add(i),i}I(e){return this.add(()=>e.destroy()),e}dispose(){if(this.disposed)return;this.disposed=!0;let e=[...this.Qn].reverse();this.Qn.clear();for(let t of e)t()}};function xa(n){return!!(n.field||n.valueGetter||n.cellRenderer||n.checkboxSelection||n.rowDrag||n.type||n.autoRowSpan||n.rowSpan)}function Ra(n,e,t){n.width!=null&&n.minWidth!=null&&n.width<n.minWidth&&t.push(`\u5217 "${e}" \u7684 width(${n.width}) \u5C0F\u4E8E minWidth(${n.minWidth})\uFF0C\u5C06\u6309 minWidth \u6E32\u67D3`),n.width!=null&&n.maxWidth!=null&&n.width>n.maxWidth&&t.push(`\u5217 "${e}" \u7684 width(${n.width}) \u5927\u4E8E maxWidth(${n.maxWidth})\uFF0C\u5C06\u6309 maxWidth \u6E32\u67D3`)}function Ea(n,e){let t=n.colId??n.field??`col_${e.leafIndex}`;e.seenIds.set(t,(e.seenIds.get(t)??0)+1),n.field&&!nt(n.field)&&e.issues.push(`\u5217 "${t}" \u7684 field \u8DEF\u5F84\u4E0D\u5B89\u5168\u6216\u65E0\u6548\uFF0C\u5DF2\u7981\u6B62\u8BFB\u53D6\u548C\u5199\u5165`),xa(n)||e.issues.push(`\u5217 "${t}" \u65E2\u65E0 field \u4E5F\u65E0 valueGetter\uFF0C\u5C06\u59CB\u7EC8\u663E\u793A\u7A7A\u503C\uFF08\u7EAF\u5DE5\u5177\u5217\u8BF7\u5FFD\u7565\u6B64\u63D0\u793A\uFF09`),Ra(n,t,e.issues)}function Qn(n,e){for(let t of n){if(Ce(t)){!Array.isArray(t.children)||t.children.length===0?e.issues.push(`\u5217\u5206\u7EC4 "${t.headerName??t.groupId??"?"}" \u7684 children \u4E3A\u7A7A`):Qn(t.children,e);continue}e.leafIndex++,Ea(t,e)}}function eo(n){if(!n||n.length===0)return[];let e={issues:[],seenIds:new Map,leafIndex:0};Qn(n,e);for(let[t,i]of e.seenIds)i>1&&e.issues.push(`\u5B58\u5728 ${i} \u4E2A\u91CD\u590D\u7684 colId/field "${t}"\uFF0C\u5DF2\u81EA\u52A8\u52A0\u540E\u7F00\u533A\u5206\uFF0C\u5EFA\u8BAE\u663E\u5F0F\u547D\u540D colId`);return e.issues}var to=new Set([...Ji,...$e]),Sa=new Set(["enableColumnResize","pagination","rowKey"]);function Ma(n,e){if(n===e)return 0;if(n.length===0)return e.length;if(e.length===0)return n.length;let t=Array.from({length:e.length+1},(i,r)=>r);for(let i=1;i<=n.length;i++){let r=t[0];t[0]=i;for(let o=1;o<=e.length;o++){let s=t[o];t[o]=Math.min(t[o-1]+1,s+1,r+(n[i-1]===e[o-1]?0:1)),r=s}}return t[e.length]}function Ia(n){let e,t=Math.max(2,Math.floor(n.length*.3))+1,i=n.toLowerCase();for(let r of to){if(Math.abs(i.length-r.length)>=t)continue;let o=Ma(i,r.toLowerCase());o<t&&(t=o,e=r)}return e}function Aa(n,e){n.rowKey!=null&&typeof n.rowKey!="string"&&typeof n.rowKey!="function"&&e("INVALID_OPTION_VALUE","rowKey","rowKey \u5FC5\u987B\u662F\u5B57\u6BB5\u8DEF\u5F84\u6216\u8FD4\u56DE\u7A33\u5B9A\u4E1A\u52A1\u4E3B\u952E\u7684\u51FD\u6570"),n.domLayout==="autoHeight"&&n.datasource!=null&&e("OPTION_CONFLICT","domLayout","autoHeight \u4F1A\u6E32\u67D3\u5168\u90E8\u5DF2\u52A0\u8F7D\u884C\uFF0C\u4E0D\u9002\u7528\u4E8E datasource \u65E0\u9650\u6EDA\u52A8\u6A21\u5F0F"),ka(n,e),n.enableColumnResize!=null&&typeof n.enableColumnResize!="boolean"&&e("INVALID_OPTION_VALUE","enableColumnResize","enableColumnResize \u5FC5\u987B\u662F boolean\uFF1B\u672A\u914D\u7F6E\u65F6\u9ED8\u8BA4\u5173\u95ED")}function ka(n,e){n.datasourceMode==="block"&&(n.datasource==null&&e("OPTION_CONFLICT","datasourceMode","datasourceMode='block' requires a datasource"),typeof n.getRowHeight=="function"&&e("OPTION_CONFLICT","getRowHeight","Random-access block rows require fixed rowHeight so unloaded offsets remain deterministic"),n.masterDetail===!0&&e("OPTION_CONFLICT","masterDetail","masterDetail is not supported by the sparse random-access block row model"),n.treeData===!0&&e("OPTION_CONFLICT","treeData","treeData requires the local/tree row model and cannot use random-access blocks"),n.rowKey==null&&e("MISSING_STABLE_ROW_ID","rowKey","Random-access blocks require rowKey to preserve selection and identity after eviction"))}function Pa(n,e){for(let t of Ji)if(!(Sa.has(t)||!v(n,t))&&!Zi(t,n[t])){let i=t==="maxBodyHeight"?"maxBodyHeight \u5FC5\u987B\u662F\u81F3\u5C11 1px \u7684\u6709\u9650\u6570":`${t} \u503C\u7C7B\u578B\u65E0\u6548\uFF0C\u671F\u671B ${Se[t]}`;e("INVALID_OPTION_VALUE",t,i)}}function Ga(n){let e=[];for(let t of Object.keys(n)){if(to.has(t))continue;let i=Ia(t);e.push({code:"UNKNOWN_OPTION",option:t,...i?{suggestion:i}:{},message:i?`\u672A\u77E5 GridOption "${t}"\uFF0C\u662F\u5426\u60F3\u4F7F\u7528 "${i}"\uFF1F`:`\u672A\u77E5 GridOption "${t}"\uFF0C\u8BE5\u503C\u4E0D\u4F1A\u751F\u6548`})}return e}function La(n,e,t){if(e.mode!=="server")return;n.rowKey==null&&t("MISSING_STABLE_ROW_ID","rowKey","\u670D\u52A1\u7AEF\u5206\u9875\u5EFA\u8BAE\u63D0\u4F9B\u7A33\u5B9A rowKey\uFF0C\u5426\u5219\u8DE8\u9875\u9009\u62E9\u4E0E\u589E\u91CF\u66F4\u65B0\u65E0\u6CD5\u53EF\u9760\u4FDD\u6301");let i=e.total;i!==void 0&&(typeof i!="number"||!Number.isFinite(i)||i<0)&&t("INVALID_OPTION_VALUE","pagination.total","\u670D\u52A1\u7AEF\u5206\u9875 total \u5FC5\u987B\u662F\u975E\u8D1F\u6709\u9650\u6570")}function Na(n,e){let t=n.pagination;t!=null&&typeof t!="boolean"&&typeof t!="object"&&e("INVALID_OPTION_VALUE","pagination","pagination \u5FC5\u987B\u662F boolean \u6216\u914D\u7F6E\u5BF9\u8C61"),n.datasource!=null&&t!==void 0&&t!==!1&&e("OPTION_CONFLICT","pagination","datasource \u987A\u5E8F\u65E0\u9650\u6A21\u5F0F\u4E0E pagination \u4E0D\u80FD\u540C\u65F6\u542F\u7528\uFF1B\u666E\u901A\u670D\u52A1\u7AEF\u5206\u9875\u8BF7\u4F7F\u7528 pagination.mode='server'"),t&&typeof t=="object"&&La(n,t,e)}function ui(n){let e=n,t=Ga(e),i=(r,o,s)=>{t.push({code:r,option:o,message:s})};return Na(e,i),e.treeData===!0&&e.masterDetail===!0&&i("OPTION_CONFLICT","masterDetail","treeData \u4E0E masterDetail \u4E0D\u80FD\u540C\u65F6\u542F\u7528\uFF0C\u4E3B\u4ECE\u660E\u7EC6\u5C06\u88AB\u5FFD\u7565"),Pa(e,i),Aa(e,i),t}function io(n){let e=/^v?(\d+)(?:\.(\d+))?(?:\.(\d+))?(?:[-+].*)?$/.exec(n.trim());return e?[Number(e[1]),Number(e[2]??0),Number(e[3]??0)]:null}function lr(n,e){for(let t=0;t<3;t++)if(n[t]!==e[t])return n[t]<e[t]?-1:1;return 0}function Fa(n){return n[0]>0?[n[0]+1,0,0]:n[1]>0?[0,n[1]+1,0]:[0,0,n[2]+1]}function Oa(n,e){if(e==="*"||e.toLowerCase()==="latest")return!0;let t=/^(\^|~|>=|<=|>|<|=)?\s*(.+)$/.exec(e);if(!t)return!1;let i=io(t[2]);if(!i)return!1;let r=lr(n,i);switch(t[1]??"="){case">=":return r>=0;case"<=":return r<=0;case">":return r>0;case"<":return r<0;case"^":return r>=0&&lr(n,Fa(i))<0;case"~":return r>=0&&lr(n,[i[0],i[1]+1,0])<0;default:return r===0}}function ro(n,e){if(!e?.trim())return!0;let t=n?io(n):null;return t?e.split("||").some(i=>{let r=i.trim().split(/\s+/).filter(Boolean);return r.length>0&&r.every(o=>Oa(t,o))}):!1}function Ha(n){return[...new Set((n??[]).map(e=>e.trim()).filter(Boolean))]}function ci(n){let e=new Map;for(let t of n??[]){let i=(typeof t=="string"?t:t?.key??"").trim();if(!i||e.has(i))continue;let r=typeof t=="object"?t.version?.trim():void 0;e.set(i,{key:i,...r?{version:r}:{}})}return[...e.values()]}function hi(n){let e=[],t=new Map;for(let l of n){let d=typeof l?.key=="string"?l.key.trim():"";if(!d){e.push({code:"INVALID_FEATURE_KEY",message:"GridFeature.key must be a non-empty string"});continue}if(t.has(d)){e.push({code:"DUPLICATE_FEATURE",feature:d,message:`Duplicate GridFeature key: ${d}`});continue}t.set(d,l)}let i=new Set;for(let[l,d]of t){for(let u of ci(d.requires)){let c=t.get(u.key);c?ro(c.version,u.version)||(i.add(l),e.push({code:"UNSUPPORTED_FEATURE_VERSION",feature:l,dependency:u.key,message:`GridFeature "${l}" requires "${u.key}" ${u.version}, received ${c.version??"unversioned"}`})):(i.add(l),e.push({code:"MISSING_FEATURE_DEPENDENCY",feature:l,dependency:u.key,message:`GridFeature "${l}" requires missing feature "${u.key}"`}))}for(let u of Ha(d.conflicts))if(t.has(u)){i.add(l),e.push({code:"FEATURE_CONFLICT",feature:l,dependency:u,message:`GridFeature "${l}" conflicts with "${u}"`});break}}let r=[],o=new Set,s=new Set,a=l=>{if(s.has(l))return!i.has(l);if(o.has(l))return i.add(l),e.push({code:"FEATURE_CYCLE",feature:l,message:`GridFeature dependency cycle includes "${l}"`}),!1;let d=t.get(l);if(!d||i.has(l))return!1;o.add(l);let u=!0;for(let c of ci(d.requires))a(c.key)||(u=!1);return o.delete(l),s.add(l),u?(r.push(d),!0):(i.add(l),!1)};for(let l of t.keys())a(l);return{features:r.filter(l=>!i.has(l.key.trim())),issues:e}}var Va=new Set(["valueFormatter","cellStyle","cellClass"]),Ba=new Set(["selectionChanged","sortChanged","filterChanged","columnMoved","columnVisibilityChanged","paginationChanged","detailToggled"]),_a=0,pi=class{constructor(e,t){this.C=!1;this.Em=0;this.wr=0;this.tu=!1;this.ra="";this.E=new je(e=>console.error("[mach-table] resource cleanup error",e));this.activeFeatures=new Map;this.su=0;this.Cr=0;this.recentErrors=[];this.Tt=null;this.au=0;this.Tr=null;this.na=0;this.Dr=null;this.oa=!1;this.sa=null;this.fu=null;this.eo=new Set;let i;this.iu=new Promise(r=>{i=r}),this.ru=i,this.gridId=++_a,this.t=Ir(t),this.ue=new rt((r,o)=>{o==="gridError"?console.error("[mach-table] error in gridError listener",r):this.reportError(r,"eventBus.listener",{eventType:o})});try{if(this.rd(t.dataProcessor),this.r=new pt(this),this.i=this.E.I(new Ct(this)),this.f=new Tt(this),this.n=this.E.I(new jt(this)),this.W=this.E.I(new Jt(this)),this.s=this.E.I(new ri(this)),this.pr=this.E.I(new Dt(this)),this.An=this.E.I(new xt(this)),this.Zo=this.E.I(new At(this)),this.a=this.E.I(new Pt(this)),this.B=new Gt(this),this.H=new Bt(this),this.Ce=this.E.I(new Wt),this.hi=this.E.I(new $t(r=>this.Sm(r))),this.Ms=this.E.I(new Nt(this)),this.columnMenu=this.E.I(new Ft(this)),this.Js=this.E.I(new Ot(this)),this.Bn=this.E.I(new Ht(this)),this.En=this.E.I(new Vt(this)),this.fi=this.E.I(new oi(this)),this.Ge=this.E.I(new si(this)),this.Nt=this.E.I(new ni(this)),this.ji=this.E.I(new ai(this)),this.api=jn(this),this.Ue=new it(this),this.P=this.E.I(new _t(this)),this.E.add(()=>this.lu()),this.P.init(),this.n.init(e,this.t),this.En.init(),this.s.init(),this.Zo.init(),this.Bn.init(),this.fi.init(),this.Nt.init(),this.ji.init(),this.Ge.init(),this.i.Ua(this.t.paginationPage,this.t.paginationPageSize),this.r.Ri(this.t.columnDefs),this.i.nt(this.t.advancedFilterModel),this.i.Mt(this.t.quickFilterText),this.Sn(),this.du(this.t.columnDefs),this.ws(t),this.W.In(),this.t.datasource?this.i._r().catch(()=>{}):this.i.rt(this.t.rowData),this.t.initialState&&this.api.state.apply(this.t.initialState,{emitEvents:!1}),this.Ts(),this.Ie(),this.Ge.setData(this.t.pinnedTopRowData,this.t.pinnedBottomRowData),this.nd(this.t.features),this.C)return;this.wr=requestAnimationFrame(()=>{this.wr=0,this.C||this.emit("gridReady",{}),this.uu()})}catch(r){throw this.api&&this.reportError(r,"grid.constructor"),this.destroy(),r}}rd(e){if(e===this.nu)return!1;let t=++this.su,i=typeof e=="function"?e():e;if(this.C||t!==this.su)return i?.destroy?.(),!1;let r=this.ou;return this.nu=e,i===this.t.dataProcessor&&r?!1:(this.t.dataProcessor=i,this.ou=i?this.E.add(()=>i.destroy?.()):void 0,r?.(),!0)}whenReady(){return this.iu}uu(){this.tu||(this.tu=!0,this.ru(this.api))}mu(e){return this.t.components?.cellRenderers?.[e]??Br[e]}Qc(e){return this.t.components?.cellEditors?.[e]}Mm(e){return ci(e.requires).map(t=>t.key).find(t=>!this.activeFeatures.has(t))}nd(e){let t=this.Cr+1;if(this.lu(),this.C||this.Cr!==t)return;let i=hi(e??[]);for(let r of i.issues)this.reportError(new Error(r.message),"feature.manifest",{code:r.code,...r.feature?{key:r.feature}:{},...r.dependency?{dependency:r.dependency}:{}});for(let r of i.features){if(this.C||this.Cr!==t)return;let o=r.key.trim(),s=this.Mm(r);if(s){this.reportError(new Error(`GridFeature "${o}" dependency "${s}" did not initialise`),"feature.manifest",{code:"FEATURE_DEPENDENCY_SETUP_FAILED",key:o,dependency:s});continue}let a=new je(u=>this.reportError(u,"feature.cleanup",{key:o})),l=u=>a.add(u),d={api:this.api,root:this.n.root,getOptions:()=>this.t,addEventListener:(u,c)=>l(this.ue.on(u,c)),onCleanup:u=>{l(u)},addManagedDomListener:(u,c,h,f)=>(u.addEventListener(c,h,f),l(()=>u.removeEventListener(c,h,f))),setManagedTimeout:(u,c)=>{let h=setTimeout(()=>{f(),u()},Math.max(0,c)),f=l(()=>clearTimeout(h));return h},createAbortController:()=>{let u=new AbortController;return l(()=>u.abort()),u},reportError:(u,c,h)=>this.reportError(u,`feature.${c}`,h)};try{let u=r.setup(d);if(typeof u=="function"&&l(u),this.C||this.Cr!==t){this.cu(o,{feature:r,scope:a});return}this.activeFeatures.set(o,{feature:r,scope:a})}catch(u){a.dispose(),this.reportError(u,"feature.setup",{key:o})}}}lu(){this.Cr++;let e=[...this.activeFeatures.entries()].reverse();this.activeFeatures.clear();for(let[t,i]of e)this.cu(t,i)}cu(e,t){t.scope.dispose();try{t.feature.destroy?.()}catch(i){this.reportError(i,"feature.destroy",{key:e})}}o(){return this.C}suspend(){this._e(),this.api.editing.stop({cancel:!0}),this.Ms.close(),this.columnMenu.close(),this.Js.close(),this.Bn.hide(),this.pr.at(),this.An.destroy(),this.s.suspend(),gn(this.n.root),Nr(this.n.root);let e=document.activeElement;e instanceof HTMLElement&&this.n.root.contains(e)&&e.blur()}Qt(){return++this.Em}d(e,t){let i=t.colDef;if(i.valueGetter)try{return i.valueGetter({api:this.api,colDef:i,column:t,node:e,data:e.data})}catch(r){this.reportError(r,"valueGetter",{colId:t.id,rowId:e.id});return}if(i.field)return z(e.data,i.field)}u(e){return this.t.locale[e]??V[e]}sn(e,t,i,r){let o=t.colDef;if(o.valueSetter)try{return o.valueSetter({oldValue:r,newValue:i,data:e.data,node:e,colDef:o,column:t,api:this.api})}catch(s){return this.reportError(s,"valueSetter",{colId:t.id,rowId:e.id}),!1}return o.field?ve(e.data,o.field,i):!1}Ji(e,t,i,r,o){this.s.Va(e),o!=="rollback"&&this.s.Pf([e.rowIndex],[t.id]),o||this.H.ns({rowId:e.id,colId:t.id,oldValue:i,newValue:r}),this.emit("cellValueChanged",{oldValue:i,newValue:r,rowNode:e,rowIndex:e.rowIndex,column:t,colDef:t.colDef,data:e.data})}hl(e){let i=this.r.l().slice(e.c1,e.c2+1).filter(o=>!o.isAutoRowNumber),r=[];for(let o=e.r1;o<=e.r2;o++){let s=this.i.h(o);r.push(i.map(a=>!s||s.isDetail||s.isGroup?"":We(this,s,a,"clipboard")))}return Et(r)}Sl(){let e=this.s.ai();return e?_e(this.hl(e)):Promise.resolve(!1)}_o(e){this.C||this.pi(this.hu(e,this.r.l()))}async Fc(e,t){let{s:i,r,i:o}=this,s=this.B.nn(),a=o.Li(),l=i.v,d=i.De(),u=r.l(),c=this.hu(e,u),h=c.map(({node:m})=>m.data);if(!await _e(t)||!s()||this.t.suppressClipboard||a!==o.Li()||l!==i.v||d!==i.De())return;let f=r.l();u.slice(e.c1,e.c2+1).some((m,g)=>m!==f[e.c1+g])||c.every(({node:m,column:g,oldValue:b},w)=>m.data===h[w]&&Object.is(this.d(m,g),b))&&this.pi(c)}hu(e,t){let i=[];for(let r=e.r1;r<=e.r2;r++){let o=this.i.h(r);if(!(!o||o.isDetail||o.isGroup))for(let s=e.c1;s<=e.c2;s++){let a=t[s];!a||!X(a)||a.colDef.rowDrag||i.push({node:o,column:a,oldValue:this.d(o,a),newValue:null})}}return i}pi(e){this.B.rh(e)}_e(){this.B?.eh()}pl(e,t,i){if(this.C)return;let r=St(e);if(r.length===0)return;let o=this.r.l(),s=this.i.G(),a=[],l=t;for(let d of r){let u=this.Im(l,s);if(!u)break;this.Am(u.node,d,o,i,a),l=u.index+1}this.pi(a)}Im(e,t){for(let i=e;i<t;i++){let r=this.i.h(i);if(r&&!r.isDetail&&!r.isGroup)return{index:i,node:r}}return null}km(e,t){let i=t;for(;i<e.length;){let r=e[i];if(X(r)&&!r.colDef.rowDrag)break;i++}return i}Am(e,t,i,r,o){let s=r,a=o.length;for(let l of t){if(s=this.km(i,s),s>=i.length)return;let d=i[s];if(!this.a.ae(e,d)){s++;continue}let u=this.d(e,d);try{let c=d.colDef.valueParser?pe(this,e,d,l,"clipboard",u):Rt(l,typeof u=="number"||d.colDef.cellEditor==="number");o.push({node:e,column:d,oldValue:u,newValue:c})}catch(c){o.splice(a),this.reportError(c,"validate",{rowId:e.id,colId:d.id});return}s++}}yh(){let e=this.s.zo();if(!e)return Promise.resolve();let t=this.B.nn(),i=this.i.h(e.row),r=this.r.l()[e.colIdx];if(!i||!r)return Promise.resolve();let o=this.d(i,r),s=this.B.Zi([{node:i,column:r,oldValue:o,newValue:o}]);try{if(typeof navigator<"u"&&navigator.clipboard?.readText)return navigator.clipboard.readText().then(a=>{let l=this.s.zo();a&&t()&&s()&&l?.row===e.row&&l.colIdx===e.colIdx&&this.i.h(e.row)===i&&this.r.l()[e.colIdx]===r&&this.pl(a,e.row,e.colIdx)}).catch(()=>{})}catch{}return Promise.resolve()}emit(e,t,i=!0){let r={type:e,api:this.api,...t};this.ue.emit(e,r);let o="on"+e.charAt(0).toUpperCase()+e.slice(1),s=this.t[o];if(typeof s=="function")try{s(r)}catch(l){e==="gridError"?console.error("[mach-table] error in onGridError",l):this.reportError(l,`eventHandler.${String(o)}`,{eventType:e})}let a=e==="columnResized"&&!!r.finished;return i&&(a||Ba.has(e))&&this.Dn(),r}reportError(e,t,i){let r=e instanceof Error?e.message:String(e),o=this.Pm(t,r);this.recentErrors.push({code:o,source:t,message:r,timestamp:Date.now(),...i?{context:i}:{}}),this.recentErrors.length>50&&this.recentErrors.shift(),console.error(`[mach-table] ${o} (${t})`,e),!this.C&&this.emit("gridError",{code:o,error:e,source:t,context:i})}Pm(e,t){return/^(datasource|treeData)/.test(e)?"DATA_SOURCE_ERROR":e==="rowKey"||t.includes("Duplicate row id")?"DATA_INTEGRITY_ERROR":e==="validate"?"VALIDATION_ERROR":e.toLowerCase().includes("renderer")||Va.has(e)?"RENDERER_ERROR":e.toLowerCase().includes("editor")||e==="editable"?"EDITOR_ERROR":e.startsWith("feature.")?"FEATURE_ERROR":/^(columnState|gridState)\./.test(e)?"STATE_ERROR":/^(eventBus|eventHandler)\./.test(e)?"EVENT_HANDLER_ERROR":"GRID_ERROR"}ep(){return{gridId:this.gridId,version:qe,destroyed:this.C,infinite:this.i.g,loading:this.i.Au()||this.t.loading,rowCount:this.i.Gi(),renderedRowCount:this.n.ye.querySelectorAll(".mach-row[data-index]").length,columnCount:this.r.Z().length,selectedRowCount:this.f.ti().length,dirtyRowCount:this.P.getDirtyRowIds().length,activeFeatures:[...this.activeFeatures].map(([e,t])=>({key:e,...t.feature.version?{version:t.feature.version}:{}})),performance:this.Ce.snapshot(),updates:this.hi.snapshot(),recentErrors:this.recentErrors.map(e=>({...e,...e.context?{context:{...e.context}}:{}}))}}Ar(e,t){this.r.Ar(e,t),this.Si()}Si(){this.W.Ds(),this.emit("sortChanged",{sortModel:this.r.Q()}),this.i.So()}nh(e,t){let i=this.i.Be();t?i[e.id]=t:delete i[e.id],this.i.St(i),this.cr()}cr(){this.W.xs(),this.Cs(),this.i.So()}Cs(e=!0){this.emit("filterChanged",{filterModel:this.i.Be(),advancedFilterModel:this.i.Ni()},e)}Ei(e,t){this.r.Ei(e,t)&&(this.ur(),this.emit("columnMoved",{colId:e,toIndex:t}))}qr(e){return this.i.qr(e)}al(e,t){this.emit("columnResized",{colId:e.id,width:e.currentWidth,finished:t})}lt(e){if(!(this.C||e.length===0))for(let t of e){if(this.C)break;this.al(t,!0)}}Ts(e=!1,t=!1){let i=this.na,r=this.Tr,o=this.r.uo().length>0;if(e){if(r==null||!o)return;if(r!==i){this.Tr=null,this.Dn();return}}this.Tr=null;let s=++this.au,a=this.t.persistence;if(!a)return;let{key:l,store:d,sections:u}=a;if(!o&&(!u||u.some(f=>f==="columns"||f==="sort"||f==="filter"))){this.Tr=i;return}let c;try{c=d?d.load(l):di(l)}catch(f){this.reportError(f,"gridState.load");return}let h=(f,m=!1)=>{if(this.C||s!==this.au||i!==this.na||!f)return;let g=this.Dr;this.Dr=m?"beforeRows":"normal";try{this.api.state.apply(f,{emitEvents:!1,sections:u})}finally{this.Dr=g}};k(c)?Promise.resolve(c).then(h).catch(f=>this.reportError(f,"gridState.load")):h(c,t)}Op(){return this.Dr==="beforeRows"}Dn(){let e=this.t.persistence;if(!(!e||this.C||this.Dr)&&(this.na++,this.Tr==null)){if(this.Tt&&clearTimeout(this.Tt),e.debounceMs===0){this.Tt=null,this.aa();return}this.Tt=setTimeout(()=>{this.Tt=null,this.aa()},e.debounceMs)}}aa(){let e=this.t.persistence;if(!e||this.C)return;let{key:t,store:i,sections:r}=e,o=this.api.state.get(),s=r?In(o,r):o,a={key:t,...i?{store:i}:{},state:s};if(this.oa){this.sa=a;return}this.pu(a)}pu(e){try{let t=e.store?e.store.save(e.key,e.state):li(e.key,e.state);if(!k(t))return;this.oa=!0,Promise.resolve(t).catch(i=>this.reportError(i,"gridState.save")).finally(()=>{this.oa=!1;let i=this.sa;this.sa=null,i&&this.pu(i)})}catch(t){this.reportError(t,"gridState.save")}}kh(){let e=p("div","mach-empty mach-empty--error"),t=p("div","mach-empty__title");t.textContent=this.u("requestFailed");let i=p("div","mach-empty__hint");return i.textContent=this.u("requestFailedHint"),e.append(t,i),e}Ih(){let e=p("div","mach-loading"),t=p("div","mach-loading__visual");t.setAttribute("aria-hidden","true");for(let r=0;r<3;r+=1){let o=p("span","mach-loading__row");t.appendChild(o)}let i=p("span","mach-loading__label");return i.textContent=this.u("loading"),e.append(t,i),e}Ah(){let e=p("div","mach-empty");e.innerHTML='<svg class="mach-empty__icon" viewBox="0 0 96 84" aria-hidden="true"><rect stroke-opacity=".3" x="8" y="6" width="76" height="66" rx="9"/><path fill="#8b98ff" opacity=".12" stroke="none" d="M17 6H75Q84 6 84 15V26H8V15Q8 6 17 6Z"/><path stroke="var(--mach-body-fg)" opacity=".06" d="M8 26h76M38 26v46M61 26v46M8 42h76M8 57h76"/><path stroke-width="5" opacity=".5" d="M19 15h12m17 0h7m15 0h7"/><path stroke="var(--mach-body-fg)" opacity=".06" stroke-width="4" d="M19 34h12m14 0h8m15 0h8M19 49h12m14 0h8m15 0h8M19 64h12m14 0h8"/><circle stroke-opacity=".3" cx="72" cy="55" r="19"/><circle cx="70" cy="53" r="9"/><path d="m77 60 6 6m-16-16 6 6m0-6-6 6"/></svg>';let{locale:t,manualFiltering:i}=this.t,r=!i&&!this.i.g&&this.i.Oe().length>0&&this.i.Hi(),o=p("div","mach-empty__title");o.textContent=r?t.noMatchingRows??t.emptyRows??this.u("noMatchingRows"):this.u("emptyRows");let s=p("div","mach-empty__hint");if(s.textContent=this.u("emptyRowsHint"),e.append(o),(!r||t.emptyRowsHint)&&e.append(s),r){let a=p("button","mach-toolbar__select-host");a.type="button",a.textContent=this.u("clearFilters"),a.onclick=()=>{this.i.St({}),this.i.nt(null),this.i.Mt(null),this.t.quickFilterText=null,this.cr(),this.n.root.focus({preventScroll:!0})},e.append(a)}return e}ws(e){if(!(this.t.suppressWarnings||this.C)){if(e)for(let t of ui({rowKey:this.t.rowKey,...e})){let i=`${t.code}:${t.option??""}:${t.message}`;this.eo.has(i)||(this.eo.add(i),console.warn(`[mach-table:${t.code}] ${t.message}`))}this.t.treeData&&this.r.Je().length>0&&console.warn("[mach-table] treeData \u4E0E rowGroup \u4E0D\u652F\u6301\u540C\u65F6\u542F\u7528\uFF0C\u884C\u5206\u7EC4\u5DF2\u88AB\u5FFD\u7565")}}du(e){if(!(this.t.suppressWarnings||this.C)&&this.fu!==e){this.fu=e;for(let t of eo(e))this.eo.has(t)||(this.eo.add(t),console.warn(`[mach-table] ${t}`))}}ur(){this.Ue.xi=!0,this.hi.Hl({columns:!0})}$(e){(e.data||e.cells)&&(this.Ue.xi=!0),this.hi.Hl(e)}Zl(e){return this.hi.batch(e)}Sm(e){this.C||(e.columns?this.Gm():(e.header&&this.W.In(),e.pool&&this.s.Id(),(e.pool||e.layout)&&this.Ie()),this.Lm(e),e.data&&!e.pool&&!e.columns?this.s.lm():e.cells&&this.s.refreshCells(e.cells===!0?void 0:e.cells),e.pinned&&this.Ge.refresh(),e.summary&&this.Nt.refresh(),e.overlays&&this.s.Us())}Lm(e){if(!(e.data||e.cells)||e.layout||e.columns||e.pool)return;let t=e.data||e.cells===!0?void 0:e.cells;this.Ue.no(t)&&this.ri()}Gm(){this.ws(),this.du(this.r.uo()),this.s.ot(),this.W.In(),this.s.Id(),this.Ie(),this.Ge.xe(),this.emit("displayedColumnsChanged",{})}Ie(){if(this.C)return;let e=this.Ce.start();this.Sn(),this.Ue.no(),this.r.pa(this.n.gs());let t=this.r.l().map(i=>`${i.id}:${i.currentWidth}`).join("|");this.ra&&t!==this.ra&&this.s.ot(),this.ra=t,this.n.root.setAttribute("aria-colcount",String(this.r.l().length)),this.W.gt(),this.s.Ie(),!this.C&&(this.Ge.gt(),this.Nt.refresh(),this.Ce.Sh(e))}Sn(){if(!this.n.root)return;let e=this.t.treeData||this.r.Je().length>0;this.n.root.setAttribute("role",e?"treegrid":"grid"),this.t.rowSelection==="multiple"?this.n.root.setAttribute("aria-multiselectable","true"):this.n.root.removeAttribute("aria-multiselectable"),this.r.l().some(i=>!!i.colDef.editable)?this.n.root.removeAttribute("aria-readonly"):this.n.root.setAttribute("aria-readonly","true")}ri(e=!0){this.C||(this.Ue.no(),this.r.pa(this.n.gs()),e&&this.s.ot(),this.W.gt(),this.s.Rn(),this.s.Kn(),this.s.hr(!0),!this.C&&(this.Ge.gt(),this.Nt.refresh()))}destroy(){if(!this.C){if(this.Tt&&(clearTimeout(this.Tt),this.Tt=null,this.aa()),this.C=!0,this._e(),this.wr&&cancelAnimationFrame(this.wr),this.wr=0,this.api){this.uu();try{this.emit("gridDestroyed",{})}catch(e){console.error("[mach-table] grid destroy event",e)}}this.E.dispose(),this.ue.clear()}}};function no(n,e={}){if(!n)throw new Error("[mach-table] createGrid requires a container element");if(typeof document>"u")throw new Error("[mach-table] createGrid can only be used in a browser environment");return new pi(n,e).api}function za(n){return n.mode==="allMatching"?{mode:"allMatching",excludedKeys:[...n.excludedKeys]}:{mode:"explicit",selectedKeys:[...n.selectedKeys]}}function oo(n,e){if(e.scope!=="filtered"&&e.scope!=="selected")throw new TypeError("[MachTable] Remote export scope must be filtered or selected.");let t=n.state.get();return{version:1,scope:e.scope,columnIds:t.columns.filter(i=>!i.hide).map(i=>i.colId),sortModel:t.sortModel.map(i=>({...i})),filterModel:te(t.filterModel),advancedFilterModel:H(t.advancedFilterModel),quickFilterText:t.quickFilterText,...e.scope==="selected"?{selection:za(e.selection??{mode:"explicit",selectedKeys:t.selectedRowIds})}:{}}}function Wa(n){return n.value===!0?"\u662F":n.value===!1?"\u5426":""}function $a(n){return e=>{if(e.value==null||e.value==="")return"";let t=e.value instanceof Date?e.value.toISOString():String(e.value);return n==="datetime"?t.slice(0,16).replace("T"," "):t.slice(0,10)}}function Ka(n){return e=>{if(e.value==null)return"";let t=n.find(i=>i.value===e.value);return t?t.label:String(e.value)}}function Ua(n,e){return n.filterable===!1?!1:e==="number"?"number":e==="date"?"date":e==="select"||e==="boolean"?"set":"text"}function ja(n,e,t){if(e.editable&&(t==="number"||t==="date")&&(n.cellEditor=t),t==="date"){n.valueFormatter=$a(e.format);return}if(t==="boolean"){n.valueFormatter=Wa;return}if(t!=="select")return;let i=e.options??[];n.valueFormatter=Ka(i),e.editable&&(n.cellEditor="select",n.cellEditorParams={options:i})}function so(n){let e=n.type??"string",t={colId:n.field,field:n.field,headerName:n.title??n.field,width:n.width,minWidth:n.minWidth,maxWidth:n.maxWidth,flex:n.flex,pinned:n.pinned??void 0,hide:n.hidden??!1,editable:n.editable??!1,sortable:n.sortable??!0,resizable:n.resizable??!0,filter:Ua(n,e),cellClass:n.cellClass};return ja(t,n,e),t}function ao(n){let e=new Map(n.fields.map(s=>[s.field,s])),t=n.groups??[],i=new Set(t.flatMap(s=>s.fields)),r=new Set,o=[];for(let s of n.fields)r.has(s.field)||i.has(s.field)||(o.push(so(s)),r.add(s.field));for(let s of t){let a=[];for(let l of s.fields){let d=e.get(l);!d||r.has(l)||(a.push(so(d)),r.add(l))}a.length>0&&o.push({groupId:s.groupId,headerName:s.title,children:a})}return o}function N(n){let e=n();return e&&!e.isDestroyed()?e:null}function lo(n){let e=()=>n.getApi();return{search(t){N(e)?.filtering.setQuickText(t)},async refresh(){if(n.reload){await n.reload();return}let t=N(e);t&&(t.rows.isRemote()?await t.rows.reload():t.view.refreshCells())},openColumns(t){N(e)?.columns.openWorkbench(t)},setDensity(t){N(e)?.updateOptions({size:t})},selectAll(t=!0){N(e)?.selection.selectAll(t)},clearSelection(){let t=N(e);t?.selection.clear(),t?.selection.clearRange()},resetColumns(){N(e)?.columns.resetState()},resetView(){N(e)?.batch(t=>{t.selection.clear(),t.selection.clearRange(),t.filtering.setModel(null),t.filtering.setAdvancedModel(null),t.sorting.setModel(null),t.pagination.setPage(1),t.columns.resetState()})},undo(){return N(e)?.editing.undo()??!1},redo(){return N(e)?.editing.redo()??!1},canUndo(){return N(e)?.editing.canUndo()??!1},canRedo(){return N(e)?.editing.canRedo()??!1},exportCsv(t="mach-table.csv"){let i=N(e);return i?Kt(t,i.io.exportCsv({prependBOM:!0}),"text/csv;charset=utf-8"):!1},async toggleFullscreen(){if(typeof document>"u")return!1;if(document.fullscreenElement)return await document.exitFullscreen?.(),!1;let i=N(e)?.view.getRoot(),r=n.getFullscreenElement?.()??i?.parentElement??i;return r?.requestFullscreen?(await r.requestFullscreen(),!0):!1}}}function uo(){return{accessor:(n,e={})=>({...e,field:n}),display:n=>({...n}),group:n=>({...n,children:[...n.children]})}}function co(n){return[...n]}function ho(n){if(n==="list")return{rowNumber:!0,columnMenu:!0,enableColumnResize:!0,defaultColDef:{filter:!0}};if(n==="detail")return{rowNumber:!0,domLayout:"autoHeight",maxBodyHeight:330,pagination:!1,columnMenu:!1,enableColumnResize:!1,statusBar:!1,contextMenu:!1,defaultColDef:{sortable:!1,filter:!1,resizable:!1,movable:!1,editable:!1}}}function dr(n,e){return e===void 0?n:typeof e!="object"||e===null||typeof n!="object"||n===null?e:{...n,...e}}function qa(n,e){return typeof n!="function"?e:typeof e!="function"?n:(...t)=>{let i;try{n(...t)}catch(r){i=r}try{e(...t)}catch(r){i??(i=r)}if(i!==void 0)throw i}}function Ya(n,e){if(!(!n.components&&!e.components))return{cellRenderers:{...n.components?.cellRenderers,...e.components?.cellRenderers},cellEditors:{...n.components?.cellEditors,...e.components?.cellEditors}}}function Xa(n,e){if(!n.columnTypes&&!e.columnTypes)return;let t={},i=new Set([...Object.keys(n.columnTypes??{}),...Object.keys(e.columnTypes??{})]);for(let r of i)t[r]={...n.columnTypes?.[r],...e.columnTypes?.[r]};return t}function Ja(n,e,t){for(let i of new Set([...Object.keys(e),...Object.keys(t)])){if(!/^on[A-Z]/.test(i))continue;let r=e[i],o=t[i];typeof r!="function"||typeof o!="function"||(n[i]=qa(r,o))}}function po(n,e){let t={...n,...e,features:e.features??n.features};(n.defaultColDef||e.defaultColDef)&&(t.defaultColDef={...n.defaultColDef,...e.defaultColDef}),(n.locale||e.locale)&&(t.locale={...n.locale,...e.locale});let i=Ya(n,e);i&&(t.components=i);let r=Xa(n,e);return r&&(t.columnTypes=r),(n.aggFuncs||e.aggFuncs)&&(t.aggFuncs={...n.aggFuncs,...e.aggFuncs}),t.pagination=dr(n.pagination,e.pagination),t.statusBar=dr(n.statusBar,e.statusBar),t.watermark=dr(n.watermark,e.watermark),Ja(t,n,e),t}function ur(...n){return n.reduce((e,t)=>{if(typeof t!="string")return po(e,t);let i=ho(t);if(!i)throw new TypeError(`[MachTable] Unknown built-in preset "${t}". Use "list" or "detail".`);return po(e,i)},{})}function fo(n={}){return ur({defaultColDef:{sortable:!0,resizable:!0,movable:!0,filter:!0},enableColumnResize:!0,rowSelection:"multiple",columnMenu:!0,contextMenu:!0,enableRangeSelection:!0,fillHandle:!0,statusBar:!0,stripedRows:!0},n)}function mo(n){return n}function go(n){return n}function yo(n){return n}function mi(n){return n!=null&&n!==""}function Za(n){if(!mi(n))return null;let e=typeof n=="number"?n:Number(n);return Number.isFinite(e)?e:null}function fi(n,e){try{return new Intl.NumberFormat(n,e)}catch{return new Intl.NumberFormat(void 0,e)}}function vo(n,e){try{return new Intl.DateTimeFormat(n,e)}catch{let t={...e};return delete t.timeZone,new Intl.DateTimeFormat(void 0,t)}}function Qa(n){if(!mi(n))return null;let e=n instanceof Date?n:new Date(n);return Number.isFinite(e.getTime())?e:null}function bo(n={}){let e=n.emptyText??"",t=n.invalidText??"\u2014",i=fi(n.locale,{maximumFractionDigits:n.maximumFractionDigits??2}),r=fi(n.locale,{maximumFractionDigits:0}),o=fi(n.locale,{style:"currency",currency:n.currency??"CNY",currencyDisplay:n.currencyDisplay??"symbol",maximumFractionDigits:n.maximumFractionDigits??2}),s=fi(n.locale,{style:"percent",maximumFractionDigits:n.maximumFractionDigits??2}),a=vo(n.locale,{year:"numeric",month:"2-digit",day:"2-digit",...n.timeZone?{timeZone:n.timeZone}:{}}),l=vo(n.locale,{year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1,...n.timeZone?{timeZone:n.timeZone}:{}}),d=(c,h=1)=>({value:f})=>{if(!mi(f))return e;let m=Za(f);return m==null?t:c.format(m*h)},u=c=>({value:h})=>{if(!mi(h))return e;let f=Qa(h);return f==null?t:c.format(f)};return Object.freeze({text:{align:"left",filter:"text"},number:{align:"right",filter:"number",cellEditor:"number",valueFormatter:d(i)},integer:{align:"right",filter:"number",cellEditor:"number",valueFormatter:d(r)},money:{align:"right",filter:"number",cellEditor:"number",valueFormatter:d(o)},percent:{align:"right",filter:"number",cellEditor:"number",valueFormatter:d(s)},percentage:{align:"right",filter:"number",cellEditor:"number",valueFormatter:d(s,.01)},date:{align:"center",filter:"date",cellEditor:"date",valueFormatter:u(a)},datetime:{align:"center",filter:"date",valueFormatter:u(l)},boolean:{align:"center",filter:"set",valueFormatter:({value:c})=>c===!0?n.trueText??"\u662F":c===!1?n.falseText??"\u5426":e},status:{filter:"set",cellRenderer:"statusTag"},link:{filter:"text",cellRenderer:"link"}})}function wo(){try{return typeof localStorage>"u"?null:localStorage}catch{return null}}function Co(n){return typeof TextEncoder>"u"?n.length*2:new TextEncoder().encode(n).byteLength}function To(n){if(typeof n!="string")return null;let e=n.trim();return e&&e.length<=256?e:null}function gi(n){if(n==null||typeof n!="object")return null;let e=n;if(e.version!==1)return null;let t=q({version:2,columns:e.columns,sortModel:e.sortModel,filterModel:e.filterModel,advancedFilterModel:e.advancedFilterModel,quickFilterText:e.quickFilterText,pagination:{enabled:!0,page:1,pageSize:e.pageSize},selectedRowIds:[],expandedRowIds:[],expandedGroupIds:[]});return t?{version:1,columns:t.columns,sortModel:t.sortModel,filterModel:t.filterModel,advancedFilterModel:t.advancedFilterModel,quickFilterText:t.quickFilterText,pageSize:t.pagination.pageSize}:null}function Ae(n){if(n==null||typeof n!="object")return null;let e=n,t=To(e.id),i=typeof e.name=="string"?e.name.trim().slice(0,120):"",r=gi(e.state);if(e.schemaVersion!==1||!t||!i||!r)return null;let o=typeof e.createdAt=="number"&&Number.isFinite(e.createdAt)?e.createdAt:Date.now(),s=typeof e.updatedAt=="number"&&Number.isFinite(e.updatedAt)?e.updatedAt:o;return{schemaVersion:1,id:t,name:i,createdAt:o,updatedAt:s,state:r}}function cr(n){let e=n.state.get();return{version:1,columns:e.columns,sortModel:e.sortModel,filterModel:e.filterModel,advancedFilterModel:e.advancedFilterModel,quickFilterText:e.quickFilterText,pageSize:e.pagination.pageSize}}function hr(n,e,t={}){let i=gi(e);if(!i||n.isDestroyed())return!1;let r=n.state.get();return n.state.apply({...r,columns:i.columns,sortModel:i.sortModel,filterModel:i.filterModel,advancedFilterModel:i.advancedFilterModel,quickFilterText:i.quickFilterText,pagination:{...r.pagination,page:1,pageSize:i.pageSize}},{sections:["columns","sort","filter","pagination"],emitEvents:t.emitEvents}),!0}function pr(n={}){let e=(n.namespace??"mach-table:views").replace(/:+$/,""),t=Math.max(1,Math.floor(n.maxViews??50)),i=Math.max(4096,Math.floor(n.maxBytes??512*1024)),r=l=>`${e}:${encodeURIComponent(l)}`,o=(l,d,u)=>{try{n.onError?.(l,d,u)}catch{}},s=l=>{let d=(n.storage??wo())?.getItem(r(l));if(!d||Co(d)>i)return[];let u=JSON.parse(d);return u.schemaVersion!==1||!Array.isArray(u.views)?[]:u.views.flatMap(c=>{let h=Ae(c);return h?[h]:[]}).slice(0,t)},a=(l,d)=>{let u=JSON.stringify({schemaVersion:1,savedAt:Date.now(),views:d});if(Co(u)>i)throw new RangeError(`[MachTable] Saved views for "${l}" exceed ${i} bytes.`);let c=n.storage??wo();if(!c)throw new Error("[MachTable] Saved view storage is unavailable.");c.setItem(r(l),u)};return{list(l){try{return s(l)}catch(d){return o(d,"list",l),[]}},save(l,d){try{let u=Ae(d);if(!u)throw new TypeError(`[MachTable] Invalid saved view for "${l}".`);let c=s(l).filter(h=>h.id!==u.id);c.unshift(u),a(l,c.slice(0,t))}catch(u){throw o(u,"save",l),u}},remove(l,d){try{a(l,s(l).filter(u=>u.id!==d))}catch(u){throw o(u,"remove",l),u}}}}function el(){try{if(typeof crypto<"u"&&crypto.randomUUID)return crypto.randomUUID()}catch{}return`view-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,10)}`}function Do(n,e){let t=e.scope.trim();if(!t||t.length>512)throw new TypeError("[MachTable] Grid view scope must contain between 1 and 512 characters.");let i=e.store??pr(),r=async()=>(await i.list(t)).flatMap(s=>{let a=Ae(s);return a?[a]:[]}).sort((s,a)=>a.updatedAt-s.updatedAt);return{list:r,async save(o,s){let a=o.trim().slice(0,120);if(!a)throw new TypeError("[MachTable] Grid view name must be a non-empty string.");let l=To(s)??el(),d=(await r()).find(h=>h.id===l),u=Date.now(),c={schemaVersion:1,id:l,name:a,createdAt:d?.createdAt??u,updatedAt:u,state:cr(n)};return await i.save(t,c),c},async apply(o,s){let a=typeof o=="string"?(await r()).find(d=>d.id===o):Ae(o),l=typeof o=="string"?o:"provided view";if(!a)throw new Error(`[MachTable] Grid view "${l}" was not found.`);if(!hr(n,a.state,s))throw new Error(`[MachTable] Grid view "${a.id}" could not be applied.`);return a},async remove(o){await i.remove(t,o)}}}var tl=qe;0&&(module.exports={BUILTIN_AGG_FUNCS,DEFAULT_LOCALE,EVENT_TYPES,LOCALE_EN,actionsColumn,advancedFilterCondition,advancedFilterGroup,applyGridViewState,buildColDefsFromSchema,captureGridViewState,clearGridState,createActionButtonsRenderer,createAggResolver,createBusinessColumnTypes,createColumnHelper,createEnterprisePreset,createGrid,createGridViewManager,createLocalGridStateStore,createLocalGridViewStore,createMachTableCommands,createMachTablePreset,createProgressBarRenderer,createRemoteExportRequest,createRowActionsRenderer,createStatusTagRenderer,defineColumns,defineGridOptions,defineMachTableConfig,defineMachTablePreset,describeFilter,downloadFile,dragColumn,escapeHtml,formatText,formatTwo,getByPath,indexColumn,isColDefGroup,isSafePath,linkRenderer,loadGridState,matchLocaleKey,normalizeAdvancedFilterModel,normalizeColumnFilter,normalizeFilterModel,normalizeGridState,normalizeGridViewState,normalizeSavedGridView,parseCsv,parseDelimited,parseTsv,resolveGridFeatures,resolveSaveConflict,resolveTagVariant,rowActionsColumn,sanitizeFormulaCell,saveGridState,selectionColumn,setByPath,toTsv,validateGridOptions,version});
|
|
6
|
+
`&&s++):r+=a,s++}return(r!==""||i.length>0)&&(i.push(r),t.push(i)),t}function qs(n){let e=null;try{return e=document.createElement("textarea"),e.value=n,e.style.position="fixed",e.style.opacity="0",document.body.appendChild(e),e.focus(),e.select(),document.execCommand("copy")}catch{return!1}finally{e?.remove()}}async function He(n){try{if(typeof navigator<"u"&&navigator.clipboard?.writeText)return await navigator.clipboard.writeText(n),!0}catch{}return qs(n)}var yn=new Set(["ArrowUp","ArrowDown","ArrowLeft","ArrowRight","Home","End","PageUp","PageDown"]),Ys=new Set([...yn,"Enter","F2","Tab"," ","Escape","Delete","Backspace"]),At=class{constructor(e){this.e=e;this.ll=e=>{if(this.Ho(e)||this.e.o()||this.e.t.suppressClipboard)return;let t=this.e.s.oi();if(!t)return;let i=this.e.ul(t),r=e.clipboardData;if(e.preventDefault(),r&&typeof r.setData=="function"){try{r.setData("text/plain",i)}catch{return}e.type==="cut"&&this.e.Vo(t)}else e.type==="cut"?this.e.Hc(t,i):He(i)};this.Oc=e=>{if(this.Ho(e)||this.e.t.suppressClipboard)return;let t=this.e.s.Bo();if(!t)return;let i=e.clipboardData,r=i&&typeof i.getData=="function"?i.getData("text/plain"):null;typeof r!="string"||r===""||(e.preventDefault(),this.e.cl(r,t.row,t.colIdx))};this.Fc=e=>{this.Ho(e)||this.e.o()||this.Vc(e)||Ys.has(e.key)&&(this.Bc(e)||this._c(e)||this.zc(e))}}init(){this.al(!0)}destroy(){this.al(!1)}al(e){R(this.e.n.root,e,{keydown:this.Fc,copy:this.ll,cut:this.ll,paste:this.Oc})}dl(e,t,i){let r=this.e.r.l(),o=this.e.r.J(t);if(o<0)return null;let s=this.e.i.P(),a=o,l=e;for(let d=0;d<(r.length+1)*(s+1);d++){if(a+=i,a>=r.length){if(l>=s-1)return null;a=0,l=this.kt(l+1,1)}else if(a<0){if(l<=0)return null;a=r.length-1,l=this.kt(l-1,-1)}if(l<0||l>=s)return null;let u=this.e.i.h(l);if(u&&!u.isDetail&&this.e.a.ae(u,r[a]))return{rowIndex:l,column:r[a]}}return null}kt(e,t){let i=this.e.i.P();for(;e>=0&&e<i;){let r=this.e.i.h(e);if(!r||!r.isDetail)return e;e+=t}return-1}Ho(e){let t=e.target;return e.defaultPrevented||t instanceof HTMLElement&&(t.isContentEditable||!!t.closest("button,a[href],input,textarea,select"))||this.e.a.isEditing()}Vc(e){if(!e.ctrlKey&&!e.metaKey)return!1;let t=e.key.toLowerCase();return t==="a"?(this.e.t.rowSelection==="multiple"&&(e.preventDefault(),this.e.f.selectAll(!0)),!0):e.altKey||t!=="z"&&t!=="y"?!1:(e.preventDefault(),t==="z"&&!e.shiftKey?this.e.H.undo():this.e.H.redo(),!0)}Bc(e){let t=this.e.s;if(e.key==="Escape")return this.e._e(),this.e.t.enableRangeSelection&&t.De()&&(e.preventDefault(),t.si()),!0;if(e.key!=="Delete"&&e.key!=="Backspace")return!1;let i=t.oi();return i&&(e.preventDefault(),this.e.Vo(i)),!0}_c(e){if(this.e.s.v)return!1;let t=this.e.r.l();return this.e.i.P()>0&&t.length>0&&(e.preventDefault(),this.e.s.Ae(0,t[0].id)),!0}zc(e){let t=this.e.s,i=t.v;if(!i)return;let r=this.e.r.l(),o=this.e.r.J(i.colId),s=this.e.i.P();if(o<0||s===0)return;let a={row:i.rowIndex,colIdx:o},l=this.Wc(e,a,r,s);if(!l)return;e.preventDefault();let d=l.row!==a.row||l.colIdx!==a.colIdx;if(e.shiftKey&&this.e.t.enableRangeSelection&&d){t.$c(l.row,l.colIdx);return}d&&t.Ae(l.row,r[l.colIdx].id)}Wc(e,t,i,r){return yn.has(e.key)?this.Kc(e,t,i.length,r):e.key==="Enter"||e.key==="F2"?this.Uc(e,t,i,r):e.key===" "?(this.jc(t.row),t):e.key==="Tab"?this.qc(e,t,i):null}Kc(e,t,i,r){let{row:o,colIdx:s}=t;switch(e.key){case"ArrowUp":o=this.Yr(o,this.kt(o-1,-1),r);break;case"ArrowDown":o=this.Yr(o,this.kt(o+1,1),r);break;case"ArrowLeft":s=Math.max(0,s-1);break;case"ArrowRight":s=Math.min(i-1,s+1);break;case"Home":s=0,e.ctrlKey&&(o=0);break;case"End":s=i-1,e.ctrlKey&&(o=Math.max(0,this.kt(r-1,-1)));break;case"PageUp":case"PageDown":o=this.Yc(e.key,o,r);break}return{row:o,colIdx:s}}Yr(e,t,i){return t>=0&&t<i?t:e}Yc(e,t,i){let r=this.e.n.b.center,o=Math.max(1,Math.floor(r.clientHeight/this.e.t.rowHeight)),s=e==="PageUp"?-1:1,a=Math.max(0,Math.min(i-1,t+o*s));return this.Yr(t,this.kt(a,s),i)}Uc(e,t,i,r){let o=this.e.i.h(t.row),s=i[t.colIdx];if(o&&!o.isDetail&&s&&this.e.a.ae(o,s))return this.e.a.start(t.row,s,e.key==="F2"?e.key:null),t;let a=this.kt(t.row+1,1);return{...t,row:this.Yr(t.row,a,r)}}jc(e){let t=this.e.i.h(e);if(!(!t||t.isDetail)){if(t.isGroup){this.e.i.So(t.id);return}this.e.t.rowSelection!=="none"&&this.e.f.Ao(t,!t.selected,this.e.t.rowSelection==="single")}}qc(e,t,i){let r=this.dl(t.row,i[t.colIdx].id,e.shiftKey?-1:1);return r?(this.e.s.Ae(r.rowIndex,r.column.id),this.e.a.start(r.rowIndex,r.column),t):null}};function Ki(n,e,t,i){t();let r=0,o=a=>{r||a.target instanceof Node&&n.contains(a.target)||(r=requestAnimationFrame(()=>{if(r=0,!e.isConnected)return i();t();let{left:l,top:d,width:u,height:c}=e.getBoundingClientRect(),h=document.elementFromPoint?.(l+u/2,d+c/2);h!==void 0&&!e.contains(h)&&i()}))},s={scroll:o,resize:o,transitionend:o};return R(window,!0,s,!0),()=>{R(window,!1,s,!0),r&&cancelAnimationFrame(r)}}function kt(n,e,t,i,r,o,s=!0){Ze(n,e,t);let a=()=>ee(n,e,4,!0),l=s?Ki(n,e,a,i):a(),d=c=>{let h=c.target;!e.contains(h)&&!n.contains(h)&&!r(h)&&i()},u=c=>{c.key!=="Escape"||c.isComposing||c.keyCode===229||(c.preventDefault(),c.stopImmediatePropagation(),o()||i(!0))};return e.setAttribute("aria-expanded","true"),q(!0,d,u),c=>{l?.(),q(!1,d,u),e.setAttribute("aria-expanded","false"),n.remove(),c&&(e.isConnected?e:t).focus({preventScroll:!0})}}var k=null;function vn(n){k?.owner&&(n===k.owner||n.contains(k.owner))&&k.close()}function bn(n){let e=n.target;k?.contains(e)||k?.close()}function wn(n){n.key!=="Escape"||!k||(n.preventDefault(),n.stopImmediatePropagation(),k.close(!0))}function Xs(n){k?.close!==n.close&&k?.close(),!k&&(k=n,q(!0,bn,wn))}function Js(n){k?.close===n&&(k=null,q(!1,bn,wn))}function ce(n,e){return e?`${n} ${e}`:n}function Ve(n,e,t){let i=n[e]&&!n[e].disabled,r=i?e+t:t>0?0:n.length-1;for(let o=r;o>=0&&o<n.length;o+=t)if(!n[o].disabled)return o;return i?e:-1}function Pt(n,e){return n.findIndex(t=>t.value===e&&!t.disabled)}function ae(n){let e=p("div",ce("mach-select-control",n.classNames?.root)),t=p("select",ce("mach-select-native",n.classNames?.native));t.hidden=!0,t.tabIndex=-1,t.setAttribute("aria-hidden","true");let i=p("button",ce("mach-select-trigger",n.classNames?.trigger));i.type="button",i.setAttribute("role","combobox"),i.setAttribute("aria-haspopup","listbox"),i.setAttribute("aria-expanded","false"),i.setAttribute("aria-label",n.ariaLabel);let r=p("span",ce("mach-select-value",n.classNames?.value)),o=p("span",ce("mach-select-caret",n.classNames?.caret));o.setAttribute("aria-hidden","true"),i.append(r,o);let s=p("div",ce("mach-select-listbox",n.classNames?.listbox));s.id=wr("mach-select-listbox"),s.setAttribute("role","listbox"),s.setAttribute("aria-hidden","true"),i.setAttribute("aria-controls",s.id),e.append(t,i);let a=[...n.options],l=[],d=-1,u=!1,c,h=()=>n.themeSource??e.closest(".mach-root")??e,f=b=>e.contains(b)||s.contains(b),m=()=>s.classList.contains("mach-select-listbox--open"),g=()=>{let b=a.find(D=>D.value===t.value);r.textContent=b?.label??t.value,l.forEach((D,Ke)=>{let G=a[Ke]?.value===t.value;D.setAttribute("aria-selected",G?"true":"false"),D.classList.toggle("mach-select-option--selected",G),D.classList.toggle("mach-select-option--active",Ke===d)}),i.setAttribute("aria-activedescendant",d>=0?l[d]?.id??"":"")},w=()=>{s.style.minWidth=`${i.offsetWidth}px`,ee(s,i,5,!0)},y=(b=!1)=>m()?(c?.(),c=void 0,s.classList.remove("mach-select-listbox--open"),s.setAttribute("aria-hidden","true"),i.setAttribute("aria-expanded","false"),i.removeAttribute("aria-activedescendant"),s.remove(),Js(y),b&&!u&&i.focus({preventScroll:!0}),!0):!1,V=(b,D=!0)=>{!a[b]||a[b].disabled||(d=b,g(),D&&l[b]?.scrollIntoView?.({block:"nearest"}))},N=()=>{if(u||i.disabled||m())return;let b=h();Xs({owner:b,close:y,contains:f}),d=Pt(a,t.value),d<0&&(d=Ve(a,-1,1)),Ze(s,i,b),s.classList.add("mach-select-listbox--open"),s.setAttribute("aria-hidden","false"),i.setAttribute("aria-expanded","true"),c=Ki(s,i,w,y),g(),l[d]?.scrollIntoView?.({block:"nearest"})},W=b=>{let D=a[b];!D||D.disabled||(t.value=D.value,d=b,g(),y(!0),t.dispatchEvent(new Event("input",{bubbles:!0})),t.dispatchEvent(new Event("change",{bubbles:!0})))},mr=(b,D)=>{a=[...b],t.replaceChildren(),s.replaceChildren(),l=a.map((G,vr)=>{let Ue=p("option");Ue.value=G.value,Ue.textContent=G.label,Ue.disabled=G.disabled===!0,t.appendChild(Ue);let B=p("button",ce("mach-select-option",n.classNames?.option));return B.id=`${s.id}-option-${vr}`,B.type="button",B.tabIndex=-1,B.dataset.value=G.value,B.disabled=G.disabled===!0,B.setAttribute("role","option"),B.textContent=G.label,B.addEventListener("mousedown",Mo=>Mo.preventDefault()),B.addEventListener("click",()=>W(vr)),s.appendChild(B),B});let Ke=a.find(G=>!G.disabled)?.value??"";t.value=D!=null&&a.some(G=>G.value===D)?D:Ke,d=Pt(a,t.value),g()},gr=b=>{if(b.key==="Tab"){y();return}if(b.key==="Escape"){if(!y(!0))return;b.preventDefault(),b.stopPropagation();return}if(b.key==="Enter"||b.key===" "){b.preventDefault(),b.stopPropagation(),m()?W(d):N();return}let D=d;if(b.key==="ArrowDown")D=Ve(a,d,1);else if(b.key==="ArrowUp")D=Ve(a,d,-1);else if(b.key==="Home")D=Ve(a,-1,1);else if(b.key==="End")D=Ve(a,-1,-1);else return;b.preventDefault(),b.stopPropagation(),m()||N(),V(D)},yr=()=>{d=Pt(a,t.value),g(),n.onChange?.(t.value)};return i.addEventListener("click",()=>{y()||N()}),i.addEventListener("keydown",gr),t.addEventListener("change",yr),mr(a,n.value),{el:e,native:t,trigger:i,listbox:s,contains:f,isOpen:m,open:N,close:y,focus:()=>i.focus({preventScroll:!0}),getValue:()=>t.value,setValue:b=>{t.value=b,d=Pt(a,b),g()},setOptions:mr,destroy:()=>{u||(u=!0,y(),i.removeEventListener("keydown",gr),t.removeEventListener("change",yr),e.remove())}}}function Cn(n,e){let t=p("input","mach-editor-input");return t.type=n,e!=null&&e!==""&&(t.value=n==="date"?String(e).slice(0,10):String(e)),t}function Zs(n){return n?.options?.length?n.options:(n?.values??[]).map(e=>({label:String(e),value:e}))}function Qs(n,e){return e?.options?.length||e?.values?.length?"select":typeof n=="number"?"number":n instanceof Date||typeof n=="string"&&/^\d{4}-\d{2}-\d{2}/.test(n)?"date":"text"}function Ui(n,e,t){let i=n.colDef,r=typeof i.cellEditor=="string"?i.cellEditor:Qs(e,i.cellEditorParams);if(r==="date"){let a=e instanceof Date?e.toISOString():e==null?"":String(e),l=Cn("date",a),d=a.match(/T(\d{2}:\d{2})/);return{el:l,getValue:()=>l.value===""?null:d?`${l.value}T${d[1]}`:l.value,focus:()=>l.focus({preventScroll:!0})}}if(r==="select"){let a=Zs(i.cellEditorParams),l=ae({ariaLabel:i.headerName??i.field??n.id,options:a.map(d=>({value:String(d.value),label:d.label,disabled:d.disabled})),value:String(e??""),classNames:{root:"mach-editor-select-control",native:"mach-editor-select"}});return{el:l.el,getValue:()=>{let d=l.getValue();return a.find(c=>String(c.value)===d)?.value??d},focus:()=>l.focus(),destroy:()=>l.destroy()}}let o=r==="number",s=Cn(o?"number":"text",e);return!o&&t&&t.length===1&&(s.value=t),{el:s,getValue:()=>o?s.value===""?null:Number(s.value):s.value,focus:()=>{s.focus({preventScroll:!0}),s.select()}}}function he(n,e,t,i,r,o){let s=t.colDef.valueParser;if(!s)return i;let a=s({api:n.api,colDef:t.colDef,column:t,data:e.data,node:e,value:i,oldValue:o,source:r});if(I(a))throw new TypeError("valueParser must return a synchronous value");return a}function Be(n,e,t,i){let r=n.d(e,t),o=t.colDef.valueSerializer;if(o)try{let s=o({api:n.api,colDef:t.colDef,column:t,data:e.data,node:e,value:r,target:i});if(I(s))throw new TypeError("valueSerializer must return a synchronous value");return s}catch(s){throw n.reportError(s,"valueSerializer",{colId:t.id,rowId:e.id}),s}return i==="xlsx"||i==="csv"&&typeof r=="number"?r:Y(n,e,t,r)}function Q(n,e){e.length&&n.s.F(e),n.Pt.refresh(),n.$i.refresh()}function Tn(n,e){let t=p("button",`mach-edit-control mach-edit-control--${n}`);return t.type="button",t.setAttribute("aria-label",e),t.title=e,t.innerHTML=J(n==="confirm"?Ii:Mi),t}var Gt=class{constructor(e){this.e=e;this.y=null;this.C=null;this.le=null;this.dt=0;this.Xr=0;this.gl=e=>{if(!(!this.y||e.isComposing||e.keyCode===229)&&!(e.key!=="Enter"&&e.key!=="Escape"&&e.key!=="Tab"))if(e.preventDefault(),e.stopPropagation(),e.key==="Tab"){let t=this.y,i=this.e.Xo.dl(t.node.rowIndex,t.column.id,e.shiftKey?-1:1);i?this.start(i.rowIndex,i.column,null,!0):this.ke(!1)}else this.ke(e.key==="Escape")}}isEditing(e,t){return this.y?e==null&&t==null?!0:this.y.node.rowIndex===e&&this.y.column.id===t:this.C?e==null&&t==null?!0:this.Ki(this.C)!==e?!1:t==null||this.C.drafts.has(t):!1}Jr(){return this.y!=null}_u(){return this.y?.node.rowIndex??(this.C?this.Ki(this.C):null)}hl(e){return this.C?e==null||this.Ki(this.C)===e:!1}ae(e,t){if(e.isDetail||e.isGroup||e.data==null)return!1;let i=t.colDef.editable;if(!i)return!1;if(typeof i=="function")try{return i(fe(this.e,e,t,this.e.d(e,t)))}catch(r){return this.e.reportError(r,"editable",{colId:t.id,rowId:e.id}),!1}return!0}start(e,t,i,r=!1){if(this.Xr++,this.e.o())return!1;let o=this.e.i.h(e);if(!o||o.data==null)return!1;if(this.e.t.editType==="fullRow")return this.startRow(e,t.id);if(this.C)return!1;if(this.y)return!this.le&&this.y.node===o&&this.y.column===t||this.pl(o,t).then(f=>{f&&this.start(o.rowIndex,t,i,r)}),!0;if(!this.ae(o,t))return!1;r&&(this.e.s.Kr(e,"nearest"),this.e.s.Ae(e,t.id));let s=this.e.s.At(e,t.id);if(!s)return!1;this.e._e();let a=this.e.d(o,t),l=this.fl(o,t,e,a,i);if(!l)return!1;let d=p("div","mach-cell-editor-controls",{role:"group"}),u=Tn("confirm","Confirm edit"),c=Tn("cancel","Cancel edit");d.append(u,c),this.ml(l,s,!0),this.e.n.root.appendChild(d);let h=this.gl;return l.el.addEventListener("keydown",h),d.addEventListener("mousedown",f=>{f.preventDefault(),f.stopPropagation()}),d.addEventListener("click",f=>{f.stopPropagation();let m=f.target.closest("button");m&&this.ke(m===c)}),d.addEventListener("keydown",f=>{f.key==="Escape"&&this.gl(f)}),this.y={node:o,column:t,editor:l,oldValue:a,cell:s,keydown:h,confirmButton:u,cancelButton:c},this._o(),this.zo(l,t,o),this.e.emit("cellEditingStarted",{rowIndex:e,colId:t.id,rowNode:o}),!0}pl(e,t){let i=++this.Xr;return this.ke(!1).then(r=>r&&i===this.Xr&&!this.isEditing()&&this.e.i.h(e.rowIndex)===e&&(t==null||this.e.r.D(t.id)===t))}startRow(e,t){if(this.y||this.C)return!1;let i=this.e.i.h(e);if(!i||i.data==null||i.isDetail||i.isGroup)return!1;this.e._e();let r=new Map;for(let l of this.e.r.l()){if(!this.ae(i,l))continue;let d=this.e.d(i,l);r.set(l.id,{column:l,oldValue:d,value:d,mounted:null})}if(r.size===0)return!1;let o={node:i,rowIndex:e,drafts:r,validating:!1};if(this.C=o,this.e.s.F([e]),r.size===0)return this.C=null,this.e.s.F([e]),!1;let s=r.values().next().value,a=(t?r.get(t):void 0)??s;return this._o(),a?.mounted&&this.zo(a.mounted.editor,a.column,i),this.e.emit("rowEditingStarted",{rowIndex:e,rowNode:i,data:i.data}),!0}Xc(e,t,i,r){if(this.y)return this.y.node===t&&this.y.column.id===i.id;let o=this.C;if(!o||o.node!==t)return!1;let s=o.drafts.get(i.id);return s?s.mounted?.cell!==r&&(this.Wo(s),!this.Jc(e,o,s,r))?(o.drafts.delete(i.id),!1):!0:!1}Zr(e,t,i){let r=this.C;if(r&&this.Ki(r)===e){let o=r.drafts.get(t);return o?.mounted?.cell===i&&this.Wo(o),!1}if(this.y?.cell===i){let o=this.y;return this.ke(!1),this.y===o&&this.ke(!0),!0}return!1}stop(e=!1){this.ke(e)}ke(e=!1){if(e&&this.Xr++,this.C)return this.yl(e);let t=this.y;if(!t)return Promise.resolve(!1);if(e)return this.dt++,this.le=null,Promise.resolve(this.Ui(t,!0,t.oldValue));if(this.le)return this.le;let i,r="cellEditor.getValue";try{if(i=t.editor.getValue(),Object.is(i,t.oldValue)||(r="valueParser",i=he(this.e,t.node,t.column,i,"editor",t.oldValue)),r="cellEditor.isCancelAfterEnd",t.editor.isCancelAfterEnd?.(i))return Promise.resolve(this.Ui(t,!0,t.oldValue))}catch(u){return this.e.reportError(u,r,{colId:t.column.id,rowId:t.node.id}),r!=="valueParser"?Promise.resolve(this.Ui(t,!0,t.oldValue)):(this.ji(t.editor,u instanceof Error?u.message:String(u)),Promise.resolve(!1))}let o=[{node:t.node,column:t.column,oldValue:t.oldValue,newValue:i}],s=this.e.B.Qr(o),a=++this.dt,l=()=>a===this.dt&&this.y===t&&s(),d=u=>l()?u.length?(this.$o(t,!1),this.ji(t.editor,u[0].message),!1):this.Ui(t,!1,i):(a===this.dt&&this.y===t&&this.Ui(t,!0,t.oldValue),!1);return this.vl(o,l,d,()=>this.$o(t,!0))}yl(e=!1){let t=this.C;if(!t)return Promise.resolve(!1);if(e)return this.dt++,this.le=null,Promise.resolve(this.en(t,!0));if(this.le)return this.le;for(let u of t.drafts.values())this.Ko(u);let i=[];for(let u of t.drafts.values())if(!Object.is(u.oldValue,u.value))try{let c=he(this.e,t.node,u.column,u.value,"editor",u.oldValue);c!==void 0&&!Object.is(u.oldValue,c)&&i.push({node:t.node,column:u.column,oldValue:u.oldValue,newValue:c})}catch(c){return this.e.reportError(c,"valueParser",{colId:u.column.id,rowId:t.node.id}),this.Uo(t,[{draft:u,message:c instanceof Error?c.message:String(c)}]),Promise.resolve(!1)}if(i.length===0)return Promise.resolve(this.en(t,!1,i));let r=i.map(u=>t.drafts.get(u.column.id)),o=r.map(u=>u.value),s=this.e.B.Qr(i),a=++this.dt,l=()=>a===this.dt&&this.C===t&&s();for(let u of r)u.error=void 0;let d=u=>l()?u.length?(this.Uo(t,u.map(({colId:c,message:h})=>({draft:t.drafts.get(c)??r[0],message:h}))),!1):r.some((c,h)=>!Object.is(c.value,o[h]))?(t.validating=!1,this.jo(t,!1),!1):this.en(t,!1,i):(a===this.dt&&this.C===t&&this.en(t,!0),!1);return this.vl(i,l,d,()=>{t.validating=!0,this.jo(t,!0)})}vl(e,t,i,r){let o=this.e.B.qo(e,t);if(!I(o))return Promise.resolve(i(o));r();let s=o.then(i).finally(()=>{this.le===s&&(this.le=null)});return this.le=s,s}Ui(e,t,i){if(this.y!==e)return!1;let r={node:e.node,column:e.column,oldValue:e.oldValue,newValue:i},o=!t&&i!==void 0&&!Object.is(e.oldValue,i);if(o){let a=this.e.B.Yo([r],()=>!this.e.o());if(this.y!==e)return!1;if(a)return this.$o(e,!1),this.ji(e.editor,a.message),!1}if(this.y=null,this.le=null,e.confirmButton.parentElement?.remove(),o&&this.e.qi(e.node,e.column,e.oldValue,i),this.bl(e),this.e.o())return!0;this.e.emit("cellEditingStopped",{rowIndex:e.node.rowIndex,colId:e.column.id,rowNode:e.node,oldValue:e.oldValue,newValue:o?i:e.oldValue});let s=e.node.rowIndex;return Q(this.e,s>=0?[s]:[]),!0}en(e,t,i=[]){if(this.C!==e)return!1;let r=t?[]:this.Zc(e,i);if(r==null||this.C!==e)return!1;this.C=null,this.le=null;for(let s of e.drafts.values())this.Wo(s,!1);if(this.e.o())return!0;let o=this.Ki(e);return this.e.emit("rowEditingStopped",{rowIndex:o,rowNode:e.node,data:e.node.data,cancelled:t,changes:r}),Q(this.e,o>=0?[o]:[]),!0}Zc(e,t){if(t.length===0)return[];let i=this.e.B.Yo(t,()=>!this.e.o());if(i)return this.Uo(e,[{draft:e.drafts.get(i.colId)??e.drafts.get(t[0].column.id),message:i.message}]),null;let r=this.e.B.Yi(t);this.e.H.Xi();try{for(let o of t){if(!r())break;this.e.qi(e.node,o.column,o.oldValue,o.newValue)}}finally{this.e.H.Ji()}return t.map(({column:o,oldValue:s,newValue:a})=>({colId:o.id,oldValue:s,newValue:a}))}Jc(e,t,i,r){let o=this.fl(t.node,i.column,e,i.value,null);if(!o)return!1;this.ml(o,r);let s=l=>this.Qc(l,t,i),a=()=>{try{i.value=o.getValue(),i.error=void 0}catch{}};return o.el.addEventListener("keydown",s),o.el.addEventListener("input",a),i.mounted={editor:o,cell:r,keydown:s,input:a},i.error&&this.ji(o,i.error),t.validating&&this.Zi(o.el,!0),!0}ml(e,t,i=!1){A(this.e,t);let r=p("div",i?"mach-cell-editor-shell":"mach-row-editor-shell");r.appendChild(e.el),t.replaceChildren(r),t.classList.add("mach-cell--editing"),i||t.classList.add("mach-cell--row-editing"),t.removeAttribute("title")}wl(e,t,i,r){let o=e.firstElementChild;if(i.width>t.clientWidth||i.left<r.left){let s=getComputedStyle(e);o.style.maxWidth=`${Math.max(0,t.clientWidth-parseFloat(s.paddingLeft)-parseFloat(s.paddingRight))}px`,o.style.marginLeft=`${Math.max(0,r.left-i.left)}px`,o.style.marginRight="auto"}else o.style.maxWidth&&(o.style.maxWidth=o.style.marginRight=o.style.marginLeft="")}eh(e){for(let t of this.e.n.root.querySelectorAll(".mach-row--editing .mach-row-editor-shell")){let i=t.parentElement,r=e.drafts.get(i.dataset.colId);if(r?.mounted?.cell!==i)continue;let o=this.e.n.b[r.column.pinned??"center"];parseFloat(i.style.width)<=o.clientWidth&&parseFloat(i.style.left)>=o.scrollLeft&&!t.style.maxWidth||this.wl(i,o,i.getBoundingClientRect(),o.getBoundingClientRect())}}_o(){if(this.C&&this.eh(this.C),!this.y)return;let{cell:e,column:t,confirmButton:i}=this.y,r=this.e.n.root;if(!r.contains(e)){this.ke(!0);return}let o=i.parentElement,s=this.e.n.b[t.pinned??"center"],a=e.getBoundingClientRect(),l=s.getBoundingClientRect();this.wl(e,s,a,l);let d=r.getBoundingClientRect(),u=o.getBoundingClientRect(),c=l.left+s.clientWidth,h=l.top+s.clientHeight,f=a.top-u.height-2>=l.top?a.top-u.height-2:a.bottom+2,m=this.e.t.domLayout==="autoHeight"&&f+u.height>h;o.style.position=m?"static":"";let g=u.width;o.style.visibility=(m||g<=s.clientWidth&&f+u.height<=h)&&a.right>l.left&&a.left<c&&a.bottom>l.top&&a.top<h?"":"hidden",o.style.left=`${T(a.right-g,l.left,Math.max(l.left,c-g))-d.left-r.clientLeft}px`,o.style.top=`${f-d.top-r.clientTop}px`}Wo(e,t=!0){let i=e.mounted;e.mounted=null,i&&(t&&this.Ko(e,i),this.bl(i))}Ko(e,t=e.mounted){if(t)try{let i=t.editor.getValue();i!==void 0&&(e.value=i)}catch(i){this.e.reportError(i,"cellEditor.getValue",{colId:e.column.id,rowId:this.C?.node.id})}}fl(e,t,i,r,o){let s=t.colDef,a;try{let l={api:this.e.api,colDef:s,column:t,node:e,data:e.data,value:r,rowIndex:i,keyPress:o};typeof s.cellEditor=="function"?a=s.cellEditor(l):typeof s.cellEditor=="string"&&!["text","number","date","select"].includes(s.cellEditor)?a=this.e.th(s.cellEditor)?.(l)??Ui(t,r,o):a=Ui(t,r,o)}catch(l){return this.e.reportError(l,"cellEditor",{colId:t.id,rowId:e.id}),null}if(!a||!(a.el instanceof HTMLElement))return this.e.reportError(new Error("cellEditor must return an editor with an HTMLElement el"),"cellEditor",{colId:t.id,rowId:e.id}),null;try{if(a.isCancelBeforeStart?.())return a.destroy?.(),null}catch(l){this.e.reportError(l,"cellEditor.isCancelBeforeStart",{colId:t.id,rowId:e.id});try{a.destroy?.()}catch{}return null}return a}Uo(e,t){e.validating=!1,this.jo(e,!1);for(let{draft:i,message:r}of t)i.error=r,i.mounted&&this.ji(i.mounted.editor,r);t[0].draft.mounted?.editor.focus?.()}ji(e,t){let i=e.el;i.classList.add("mach-editor-invalid"),i.setAttribute("title",t),i.setAttribute("aria-invalid","true"),this.Zi(i,!1),(i.querySelector(".mach-select-trigger, input:not([type='hidden']), select:not([hidden]), textarea")??i).focus?.();let o=()=>{i.classList.remove("mach-editor-invalid"),i.removeAttribute("title"),i.removeAttribute("aria-invalid")};i.addEventListener("input",o,{once:!0})}$o(e,t){this.Zi(e.editor.el,t),e.confirmButton.disabled=t,e.cancelButton.disabled=!1}jo(e,t){for(let i of e.drafts.values()){let r=i.mounted?.editor.el;r&&this.Zi(r,t)}}Zi(e,t){e.classList.toggle("mach-editor-validating",t),t?e.setAttribute("aria-busy","true"):e.removeAttribute("aria-busy"),e.inert=t}zo(e,t,i){try{e.focus?.()}catch(r){this.e.reportError(r,"cellEditor.focus",{colId:t.id,rowId:i.id})}}bl(e){e.editor.el.removeEventListener("keydown",e.keydown),e.input&&e.editor.el.removeEventListener("input",e.input),this.Zi(e.editor.el,!1),e.cell.contains(e.editor.el)&&e.cell.classList.remove("mach-cell--editing","mach-cell--row-editing","mach-cell--error");try{e.editor.destroy?.()}catch(t){this.e.reportError(t,"cellEditor.destroy",{colId:e.cell.dataset.colId})}}Ki(e){return e.node.rowIndex>=0?e.node.rowIndex:e.rowIndex}Qc(e,t,i){if(this.C!==t||e.isComposing||e.keyCode===229)return;if(e.key==="Escape"||e.key==="Enter"&&!e.shiftKey){e.preventDefault(),e.stopPropagation(),this.yl(e.key==="Escape");return}if(e.key!=="Tab")return;e.preventDefault(),e.stopPropagation(),this.Ko(i);let r=[...t.drafts.values()],o=r.indexOf(i),s=e.shiftKey?-1:1;for(let a=1;a<=r.length;a++){let l=r[(o+s*a+r.length)%r.length];if(l.mounted){this.zo(l.mounted.editor,l.column,t.node);break}}}destroy(){this.ke(!0)}};var Lt=class{constructor(e){this.e=e;this.Jo=0}ih(){this.Jo++}tn(){let e=++this.Jo;return()=>e===this.Jo&&!this.e.o()}Qr(e){let t=e[0].node,i=this.e.r.Z(),r=i.map(a=>this.e.d(t,a)),o=this.Yi(e),s=e.every(a=>Object.is(this.e.d(t,a.column),a.oldValue));return()=>s&&o()&&i.every((a,l)=>Object.is(this.e.d(t,a),r[l]))}Yi(e){let t=e[0].node,i=t.data,r=this.e.r,o=r.Z(),s=e.every(a=>a.node===t&&r.D(a.column.id)===a.column);return()=>s&&!this.e.o()&&this.e.i.N(t.id)===t&&t.data===i&&r.Z()===o}qo(e,t){let i=e.map(o=>this.rh(o,t)),r=o=>{let s=o.filter(a=>a!=null);return s.length||!t()?s:this.nh(e,t)};return i.some(I)?Promise.all(i.map(o=>Promise.resolve(o))).then(r):r(i)}rh(e,t){let{node:i,column:r,oldValue:o,newValue:s}=e,a=d=>(t()&&this.e.reportError(d,"validate",{colId:r.id,rowId:i.id}),{colId:r.id,message:"Validation failed"}),l=d=>typeof d=="string"?{colId:r.id,message:d}:null;try{let d=r.colDef.validate?.(s,{oldValue:o,newValue:s,node:i,data:i.data,column:r,colDef:r.colDef,api:this.e.api});return I(d)?d.then(l,a):l(d)}catch(d){return a(d)}}nh(e,t){let i=this.e.t.rowEditValidator;if(!i)return[];let r=e[0].node,o=Object.create(null);for(let l of this.e.r.Z())o[l.id]=this.e.d(r,l);for(let l of e)o[l.column.id]=l.newValue;let s=l=>typeof l=="string"?[{colId:e[0].column.id,message:l}]:l&&typeof l=="object"?Object.entries(l).filter(([,d])=>typeof d=="string"&&d).map(([d,u])=>({colId:d,message:u})):[],a=l=>(t()&&this.e.reportError(l,"validate",{rowId:r.id}),[{colId:e[0].column.id,message:"Row validation failed"}]);try{let l=i({data:r.data,node:r,values:o,api:this.e.api,changes:e.map(({column:d,oldValue:u,newValue:c})=>({colId:d.id,oldValue:u,newValue:c}))});return I(l)?l.then(s,a):s(l)}catch(l){return a(l)}}Yo(e,t){let i=[],r=this.Yi(e);for(let o of e){if(!t()||!r()||!Object.is(this.e.d(o.node,o.column),o.oldValue)||!this.e.a.ae(o.node,o.column)||!this.e.rn(o.node,o.column,o.newValue,o.oldValue)){for(let s of i.reverse()){if(!t()||!r())break;this.e.rn(s.node,s.column,s.oldValue,s.newValue)||this.e.reportError(new Error("A valueSetter rejected input rollback"),"inputRollback",{rowId:s.node.id})}return{colId:o.column.id,message:"Value was rejected by the column setter"}}i.push(o)}return t()&&r()?null:{colId:e[0].column.id,message:"Input target changed during commit"}}oh(e){let t=this.tn();if(this.e.o()||this.e.a.isEditing())return;let i=new Map;for(let a of e){if(a.newValue===void 0||Object.is(a.oldValue,a.newValue)||!this.e.a.ae(a.node,a.column))continue;let l=i.get(a.node)??[];l.push(a),i.set(a.node,l)}let r=[...i.values()].map(a=>{let l=this.Qr(a),d=()=>t()&&l();return{changes:a,current:d,validation:this.qo(a,d)}}),o=a=>{this.Cl(r,a,t)},s=r.map(a=>a.validation);s.some(I)?Promise.all(s.map(a=>Promise.resolve(a))).then(o):o(s)}Cl(e,t,i){let r=e.map(()=>({applied:!1,errors:[]}));if(!i())return r;let o=new Set;this.e.H.Xi();try{e.forEach(({changes:s,current:a},l)=>{let d=r[l];if(!a()||!s.length)return;d.errors=[...t[l]];let u=d.errors.length?null:this.Yo(s,i);if(!i())return;if(u&&d.errors.push(u),d.errors.length){this.e.reportError(new Error(d.errors.map(h=>h.message).join("; ")),"validate",{rowId:s[0].node.id,errors:d.errors});return}let c=this.Yi(s);d.applied=!0;for(let h of s){if(!i()||!c()){d.applied=!1;break}this.e.qi(h.node,h.column,h.oldValue,h.newValue),h.node.rowIndex>=0&&o.add(h.node.rowIndex)}})}finally{this.e.H.Ji()}return o.size&&i()&&Q(this.e,[...o]),r}};function ji(n){return n==="blank"||n==="notBlank"}function Nt(n){return n===null?"null:":`${typeof n}:${String(n)}`}var Ft=class{constructor(e){this.e=e;this.anchor=null;this.Qi=null}toggle(e,t){let i=this.anchor===t;this.close(),i||this.open(e,t)}open(e,t){let i=this.e.i.Be()[e.id]??null,r=i?.type??e.filterType,o=p("div","mach-filter-panel");o.setAttribute("role","dialog"),o.setAttribute("aria-label",t.title);let s=u=>{this.e.sh(e,u),o.isConnected&&this.close(!0)},a=r==="set"?this.ah(o,e,i):this.lh(o,r,i,s),l=p("div","mach-filter-footer");l.append($("mach-filter-btn-reset",this.e.u("reset"),()=>s(null)),$("mach-filter-btn-apply",this.e.u("apply"),()=>s(a()))),o.appendChild(l),this.anchor=t,this.Gt=kt(o,t,this.e.n.root,u=>this.close(u),u=>this.Qi?.contains(u)??!1,()=>this.Qi?.close(!0)??!1),o.querySelector(".mach-filter-select-trigger, input")?.focus({preventScroll:!0})}close(e=!1){this.Qi?.destroy(),this.Qi=null,this.anchor=null;let t=this.Gt;this.Gt=void 0,t?.(e)}destroy(){this.close()}lh(e,t,i,r){let o=i&&i.type!=="set"&&i.conditions.length>0?i.conditions[0]:null,s=o?.match??(t==="text"?"contains":"equals"),{el:a,native:l}=this.dh(t,s),d=this.Tl(t),u=this.Tl(t,!0);this.uh(t,s,o,d,u),this.Dl(s,d,u),l.addEventListener("change",()=>{this.Dl(l.value,d,u)});let c=p("div","mach-filter-body");c.append(a,d,u),e.appendChild(c);let h=()=>this.ch(t,l.value,d.value,u.value),f=m=>{m.key==="Enter"&&!m.isComposing&&m.keyCode!==229&&r(h())};return d.addEventListener("keydown",f),u.addEventListener("keydown",f),h}dh(e,t){let i=ae({ariaLabel:"Filter condition",options:ye[e].map(r=>({value:r,label:this.e.u(lt(r))})),value:t,classNames:{root:"mach-filter-select-control",native:"mach-filter-select",trigger:"mach-filter-select-trigger",value:"mach-filter-select-value",caret:"mach-filter-select-caret",listbox:"mach-filter-listbox",option:"mach-filter-listbox-option"},themeSource:this.e.n.root});return this.Qi=i,i}Tl(e,t=!1){let r=p("input",`mach-filter-input${t?" mach-filter-input--second":""}`);return r.type=e,r}uh(e,t,i,r,o){i?.value!=null&&!ji(t)&&(r.value=e==="date"?String(i.value).slice(0,10):String(i.value)),i&&"value2"in i&&i.value2!=null&&(o.value=e==="date"?String(i.value2).slice(0,10):String(i.value2))}Dl(e,t,i){t.style.display=ji(e)?"none":"",i.style.display=e==="inRange"?"":"none"}ah(e,t,i){let o=t.colDef.filterParams,s;if(o?.values)s=o.values;else{let f=new Set;s=[];let m=this.e.i.Oe(),g=Math.min(m.length,o?.maxValues??500);for(let w=0;w<g;w++){let y=this.e.d(m[w],t),V=Nt(y??null);f.has(V)||(f.add(V),s.push(y))}}let a=new Set((i?.type==="set"?i.values:s).map(Nt)),l=p("input","mach-filter-input mach-filter-input--search");l.type="text",l.placeholder=this.e.u("search");let d=p("div","mach-filter-set-list"),u=new Map(s.map(f=>[Nt(f),f??null])),c=f=>{d.textContent="";let m=f.trim().toLowerCase();for(let g of s){let w=g==null?this.e.u("emptySetLabel"):String(g);if(m&&!w.toLowerCase().includes(m))continue;let y=Nt(g),V=p("label","mach-filter-set-item"),N=p("input");N.type="checkbox",N.checked=a.has(y),N.addEventListener("change",()=>{N.checked?a.add(y):a.delete(y)});let W=p("span");W.textContent=w,V.append(N,W),d.appendChild(V)}};l.addEventListener("input",()=>c(l.value)),c("");let h=p("div","mach-filter-body mach-filter-body--set");return h.append(l,d),e.appendChild(h),()=>{let f=[];for(let[m,g]of u)a.has(m)&&f.push(g);return f.length&&f.length<u.size?{type:"set",values:f}:null}}ch(e,t,i,r){if(ji(t))return{type:e,conditions:[{match:t}]};if(i===""&&t!=="inRange")return null;let o=e==="number",s=o?Number(i):i;if(Number.isNaN(s))return null;if(e==="text"||t!=="inRange")return{type:e,conditions:[{match:t,value:s}]};let a=r?o?Number(r):r:s;return Number.isNaN(a)?null:{type:e,conditions:[{match:t,value:s,value2:a}]}}};var Ot=class{constructor(e){this.e=e;this.O=null;this.anchor=null;this.nn=null;this.sn="";this.er=new Set}toggle(e,t){let i=this.anchor===t;this.close(),i||this.open(e,t)}hh(e){this.close();let t=e??(()=>{let r=this.e.n.root.getBoundingClientRect(),o=p("div");return o.style.position="fixed",o.style.left=`${r.right-16}px`,o.style.top=`${r.top+this.e.t.headerHeight}px`,o.style.width="1px",o.style.height="1px",document.body.appendChild(o),this.nn=o,o})();this.open(null,t)}close(e=!1){this.xl(),this.nn?.remove(),this.nn=this.O=this.anchor=null;let t=this.Gt;this.Gt=void 0,t?.(e)}destroy(){this.close()}open(e,t){let i=this.e.api,r=p("div","mach-filter-panel mach-column-panel");e||r.classList.add("mach-column-workbench"),r.setAttribute("role","dialog"),r.setAttribute("aria-label",e?t.title:this.e.u("columnSettings"));let o=p("div","mach-column-panel-title");o.textContent=e?e.colDef.headerName??e.colDef.field??e.id:this.e.u("columnSettings"),r.appendChild(o);let s=(c,h,f="mach-column-panel-btn")=>$(f,this.e.u(c),()=>{h(),this.O===r&&this.close(!0)});if(e){let c=e.id,h=(...f)=>{let m=p("div","mach-column-panel-actions");m.append(...f),r.appendChild(m)};e.sortable&&h(s("sortAsc",()=>i.sorting.setModel([{colId:c,direction:"asc"}])),s("sortDesc",()=>i.sorting.setModel([{colId:c,direction:"desc"}])),s("clearSort",()=>i.sorting.setModel([]))),h(s("pinLeft",()=>i.columns.setPinned(c,"left")),s("pinRight",()=>i.columns.setPinned(c,"right")),s("clearPin",()=>i.columns.setPinned(c,null))),h(s("autoSize",()=>i.columns.autoSize(c)),s("hideColumn",()=>i.columns.setVisible(c,!1)))}let a=p("div","mach-column-panel-divider");r.appendChild(a);let l=p("div","mach-column-panel-subtitle");if(l.textContent=this.e.u("columnVisibility"),r.appendChild(l),!e){let c=p("input","mach-column-workbench-search");c.type="search",c.placeholder=this.e.u("search"),c.setAttribute("aria-label",this.e.u("search")),c.value=this.sn,c.addEventListener("input",()=>{this.sn=c.value.trim().toLocaleLowerCase(),this.Zo(d,!0)}),r.appendChild(c)}let d=p("div","mach-column-panel-list");this.Zo(d,!e),r.appendChild(d);let u=p("div","mach-filter-footer");u.append(s("resetAll",()=>i.columns.resetState(),"mach-filter-btn-reset"),s("autoSizeAll",()=>i.columns.autoSizeAll(),"mach-filter-btn-apply")),r.appendChild(u),this.O=r,this.anchor=t,this.Gt=kt(r,t,this.e.n.root,c=>this.close(c),c=>this.ph(c),()=>this.fh(),t!==this.nn),r.querySelector("button, input")?.focus({preventScroll:!0})}Qo(){if(!this.O)return;let e=this.O.querySelector(".mach-column-panel-list");e&&this.Zo(e,this.O.classList.contains("mach-column-workbench"))}Zo(e,t){let i=this.e.api;this.xl(e),e.replaceChildren();let r=this.e.r.Z().filter(o=>o.isDetailToggle?!1:!t||!this.sn?!0:`${o.colDef.headerName??o.colDef.field??o.id} ${o.id}`.toLocaleLowerCase().includes(this.sn));for(let o of r){let s=p("div",t?"mach-column-workbench-item":"mach-filter-set-item"),a=p("label","mach-column-workbench-label"),l=p("input");l.type="checkbox",l.checked=!o.hide,l.disabled=o.hasCheckbox,l.addEventListener("change",()=>{i.columns.setVisible(o.id,l.checked),this.Qo()});let d=p("span","mach-column-workbench-name");if(d.textContent=o.colDef.headerName??o.colDef.field??o.id,d.title=`${d.textContent} (${o.id})`,a.append(l,d),s.appendChild(a),t){let u=ae({ariaLabel:`${d.textContent} ${this.e.u("clearPin")}`,options:[{value:"",label:this.e.u("clearPin")},{value:"left",label:this.e.u("pinLeft")},{value:"right",label:this.e.u("pinRight")}],value:o.pinned??"",classNames:{root:"mach-column-workbench-pin-control",native:"mach-column-workbench-pin"},themeSource:this.e.n.root,onChange:m=>{i.columns.setPinned(o.id,m==="left"||m==="right"?m:null),this.Qo()}});u.trigger.disabled=!o.movable,u.native.disabled=!o.movable,this.er.add(u),s.appendChild(u.el);let c=this.e.r.Z().filter(m=>!m.hide&&m.parentGroup===o.parentGroup&&(o.parentGroup!=null||m.pinned===o.pinned)),h=c.indexOf(o),f=(m,g,w)=>{let y=$("mach-column-workbench-move",m,()=>{i.columns.move(o.id,g),this.Qo()});return y.disabled=w||o.hide||!o.movable,y};s.append(f("\u2191",h-1,h<=0),f("\u2193",h+1,h<0||h>=c.length-1))}e.appendChild(s)}}ph(e){for(let t of this.er)if(t.contains(e))return!0;return!1}fh(){for(let e of this.er)if(e.close(!0))return!0;return!1}xl(e){for(let t of this.er)e&&!e.contains(t.el)||(t.destroy(),this.er.delete(t))}};var Ht=class{constructor(e){this.e=e;this.O=null;this.Sl=e=>{this.O&&!this.O.contains(e.target)&&this.close()};this.Ml=e=>{e.key==="Escape"&&this.close()}}mh(e){if(e){let o=this.e.i.h(e.rowIndex),s=this.e.r.D(e.colId);return o&&s?{node:o,column:s}:null}let t=this.e.s.oi();if(!t)return null;let i=this.e.i.h(t.r1),r=this.e.r.l()[t.c1];return i&&r?{node:i,column:r}:null}gh(e,t){let i=this.e.t.getContextMenuItems;if(!i)return null;try{return i({data:e.data,node:e,api:this.e.api,colId:t.id,value:this.e.d(e,t),rowIndex:e.rowIndex})??null}catch(r){return this.e.reportError(r,"getContextMenuItems",{colId:t.id,rowId:e.id}),null}}yh(e,t,i,r){let o=!1;for(let s of t){if(s.separator){e.appendChild(p("div","mach-context-menu-separator"));continue}let a=p("button","mach-context-menu-item");a.type="button",a.textContent=s.label??"",s.danger&&a.classList.add("mach-context-menu-item--danger"),a.disabled=s.disabled===!0,a.disabled||(o=!0,a.addEventListener("click",()=>this.vh(s,i,r))),e.appendChild(a)}return o}vh(e,t,i){this.close();try{e.action?.()}catch(r){this.e.reportError(r,"contextMenu.action",{colId:i.id,rowId:t.id})}}bh(e){let t=this.e,i=(r,o)=>{e.append($("mach-context-menu-item",t.u(r),()=>{o(),this.close()}))};t.t.suppressClipboard||(i("menuCopy",()=>{t.Rl()}),i("menuPaste",()=>{t.wh()})),i("menuClearContents",()=>{let r=t.s.oi();r&&t.Vo(r)})}open(e,t,i){this.close();let r=this.mh(i);if(!r)return;let o=p("div","mach-context-menu");if(o.setAttribute("role","menu"),this.e.t.getContextMenuItems){let s=this.gh(r.node,r.column);if(!s||!this.yh(o,s,r.node,r.column))return;this.El(o,e,t);return}this.bh(o),this.El(o,e,t)}El(e,t,i){K(e,this.e.n.root),document.body.appendChild(e),this.O=e;let r=e.getBoundingClientRect(),o=T(t,8,Math.max(8,window.innerWidth-r.width-8)),s=T(i,8,Math.max(8,window.innerHeight-r.height-8));e.style.left=`${o}px`,e.style.top=`${s}px`,q(!0,this.Sl,this.Ml)}close(){this.O&&(this.O.remove(),this.O=null,q(!1,this.Sl,this.Ml))}destroy(){this.close()}};var Vt=class{constructor(e){this.e=e;this.O=null;this.an=0;this.ln=null;this.dn=e=>{if(this.e.o()||!this.e.t.tooltipComponent)return;let i=e.target.closest(".mach-cell");if(!i||i===this.ln)return;this.Al(),this.es(),this.ln=i;let r=this.Ch(i);if(!r||i.classList.contains("mach-cell--editing"))return;let o=this.Th(r.node,r.column,r.index);this.Dh(o,r.column)&&(this.an=window.setTimeout(()=>{this.e.o()||this.ln!==i||this.xh(i,o)},Math.max(0,this.e.t.tooltipShowDelay)))};this.Il=()=>{this.hide()}}init(){R(this.e.n.ye,!0,{mouseover:this.dn,mouseleave:this.Il})}destroy(){this.hide(),R(this.e.n.ye,!1,{mouseover:this.dn,mouseleave:this.Il})}hide(){this.Al(),this.es(),this.ln=null}Al(){this.an&&(clearTimeout(this.an),this.an=0)}es(){this.O?.remove(),this.O=null}Ch(e){let t=e.dataset.colId??"",i=Number(e.closest(".mach-row")?.dataset.index);if(Number.isNaN(i))return null;let r=this.e.i.h(i),o=t?this.e.r.D(t):void 0;return!r||!o||r.isDetail||r.isGroup?null:{node:r,column:o,index:i}}Th(e,t,i){return{data:e.data,node:e,api:this.e.api,colId:t.id,value:this.e.d(e,t),formatted:me(this.e,e,t),rowIndex:i}}Dh(e,t){let i=t.colDef.tooltipValueGetter;if(!i)return!!e.formatted;try{i({...e,colDef:t.colDef,column:t})}catch(r){this.e.reportError(r,"tooltipValueGetter",{colId:t.id,rowId:e.node.id})}return!0}xh(e,t){this.es();let i=this.e.t.tooltipComponent;if(!i)return;let r=p("div","mach-tooltip");r.setAttribute("role","tooltip");let o;try{o=i(t)}catch(s){this.e.reportError(s,"tooltipComponent",{colId:t.colId,rowIndex:t.rowIndex});return}typeof o=="string"?r.textContent=o:r.appendChild(o),K(r,this.e.n.root),document.body.appendChild(r),this.O=r,ee(r,e,6)}};var Bt=class{constructor(e){this.e=e;this.re=null}init(){this.re=p("div","mach-watermark"),this.re.setAttribute("aria-hidden","true"),this.re.style.pointerEvents="none",this.e.n.root.appendChild(this.re),this.apply()}apply(){if(!this.re||this.e.o())return;let e=this.e.t.watermarkEnabled?this.e.t.watermarkConfig:null;if(!e||!e.text){this.re.style.display="none",this.re.style.backgroundImage="";return}let t=this.Rh(e);this.re.style.display="",t?(this.re.style.backgroundImage=`url(${t})`,this.re.style.backgroundColor=""):this.re.style.backgroundImage=""}Rh(e){try{let t=p("canvas"),i=t.getContext("2d");if(!i)return null;let r=e.fontSize??14,o=e.gap??160,s=e.angle??-22,a=e.color??(this.Eh()?"rgba(255,255,255,0.9)":"rgba(31,55,88,0.9)"),l=e.opacity??.06;i.font=`500 ${r}px sans-serif`;let d=i.measureText(e.text),u=Math.ceil(d.width),c=Math.max(o,u+40);t.width=c,t.height=c;let h=t.getContext("2d");return h.clearRect(0,0,c,c),h.globalAlpha=l,h.fillStyle=a,h.font=`500 ${r}px sans-serif`,h.translate(c/2,c/2),h.rotate(s*Math.PI/180),h.textAlign="center",h.textBaseline="middle",h.fillText(e.text,0,0),t.toDataURL("image/png")}catch{return null}}Eh(){return this.e.n.root.classList.contains("mach-theme-dark")}refresh(){this.apply()}destroy(){this.re?.remove(),this.re=null}};var _t=class{constructor(e){this.e=e;this.q=[];this.de=-1;this.Pe=null}Xi(){this.e.k.Xi(),this.Pe===null&&(this.Pe=[])}Ji(){let e=this.Pe;this.Pe=null,e&&e.length&&this.push(e),this.e.k.Ji()}ts(e){let t=this.Pe;t?t.push(e):t!==!1&&this.push([e])}push(e){this.e.t.undoStackSize!==0&&(this.q.length=this.de+1,this.q.push(e),this.de++,this.kl())}kl(){let e=this.e.t.undoStackSize;if(e===0){this.clear();return}for(;this.q.length>e;)this.q.shift(),this.de--;this.de<-1&&(this.de=-1)}canUndo(){return this.de>=0}canRedo(){return this.de<this.q.length-1}undo(){if(this.e._e(),!this.canUndo())return!1;let e=this.q[this.de--];return this.apply(e,!1),!0}redo(){return this.e._e(),this.canRedo()?(this.apply(this.q[++this.de],!0),!0):!1}apply(e,t){let i=this.e,r=[],o=this.q;i.k.Xi();try{for(let s of e){if(o!==this.q&&(o=this.q,!o.includes(e)))break;let a=i.i.N(s.rowId),l=i.r.D(s.colId);if(!a||!l||a.data==null)continue;let d=t?s.newValue:s.oldValue,u=t?s.oldValue:s.newValue;!l.colDef.valueGetter&&!l.colDef.valueSetter&&!Object.is(i.d(a,l),u)||i.rn(a,l,d,u)&&(a.rowIndex>=0&&r.push(a.rowIndex),i.qi(a,l,u,d,"undo"))}Q(i,r)}finally{i.k.Ji()}}Ku(e){if(e.length===0||!this.q.length&&!this.Pe)return;let t=new Set(e),i=o=>o.some(s=>t.has(s.rowId)),r=this.de;this.q=this.q.filter((o,s)=>i(o)?(s<=r&&this.de--,!1):!0),this.Pe&&i(this.Pe)&&(this.Pe=!1)}clear(){this.q=[],this.de=-1,this.Pe=null}};var zt=class{constructor(e){this.e=e;this.K=new Map;this.rs=!1;this.ns=0;this.un=!1;this.os=null}Xi(){this.ns++}Ji(){--this.ns===0&&this.un&&this.tr()}init(){this.os=this.e.ue.on("cellValueChanged",e=>{this.rs||this.ts(e)})}ts(e){let{rowNode:t,column:i,oldValue:r,newValue:o}=e,s=`${t.id}\0${i.id}`,a=this.K.get(s),l=a?a.originalValue:r;Object.is(o,l)?this.K.delete(s):this.K.set(s,{rowId:t.id,colId:i.id,originalValue:l,value:o}),this.tr()}getDirtyRowIds(){let e=new Set;for(let{rowId:t}of this.K.values())e.add(t);return[...e]}getChanges(){let e=new Map;for(let t of this.K.values()){let i=e.get(t.rowId);if(!i){let r=this.e.i.N(t.rowId);if(!r?.data)continue;i={rowId:t.rowId,data:r.data,cells:[]},e.set(t.rowId,i)}i.cells.push({colId:t.colId,originalValue:t.originalValue,value:t.value})}return[...e.values()]}markSaved(e){if(!e)this.K.clear();else{let t=new Set(e);for(let[i,r]of this.K)t.has(r.rowId)&&this.K.delete(i)}this.tr()}Sh(e){for(let t of e)for(let i of t.cells){let r=`${t.rowId}\0${i.colId}`,o=this.K.get(r);if(o){Object.is(o.value,i.value)?this.K.delete(r):o.originalValue=i.value;continue}let s=this.e.i.N(t.rowId),a=this.e.r.D(i.colId);if(!s||!a||s.data==null)continue;let l=this.e.d(s,a);Object.is(l,i.value)||this.K.set(r,{rowId:t.rowId,colId:i.colId,originalValue:i.value,value:l})}this.tr()}rollback(e){let t=e?new Set(e):null,i=[...this.K].filter(([,s])=>!t||t.has(s.rowId));if(!i.length)return!1;let r=new Set,o=[];this.rs=!0;try{for(let[s,a]of i){let l=this.e.i.N(a.rowId),d=this.e.r.D(a.colId);if(!l||!d||l.data==null)continue;let u=this.e.d(l,d);if(!Object.is(u,a.originalValue)){if(!this.e.rn(l,d,a.originalValue,u))continue;l.rowIndex>=0&&r.add(l.rowIndex),this.e.qi(l,d,u,a.originalValue,"rollback")}o.push(s)}}finally{this.rs=!1}for(let s of o)this.K.delete(s);return Q(this.e,[...r]),this.tr(),o.length>0}ju(e){e.length&&this.markSaved(e)}clear(){this.K.size&&this.markSaved()}destroy(){this.os?.(),this.os=null,this.K.clear(),this.un=!1}tr(){this.un=this.ns>0,this.un||this.e.emit("dirtyStateChanged",{dirtyRowIds:this.getDirtyRowIds()})}};var Yi=class{constructor(){this.ir=null;this.cn=0;this.Pl=0;this.Gl=0}acquire(){this.cn++,this.Mh();let e=!1;return()=>{e||(e=!0,this.cn=Math.max(0,this.cn-1),this.cn===0&&this.disconnect())}}snapshot(){return{count:this.Pl,totalMs:this.Gl}}Mh(){if(!(this.ir||typeof PerformanceObserver>"u"))try{this.ir=new PerformanceObserver(e=>{for(let t of e.getEntries())this.Pl++,this.Gl+=t.duration}),this.ir.observe({entryTypes:["longtask"]})}catch{this.disconnect()}}disconnect(){let e=this.ir;this.ir=null;try{e?.disconnect()}catch{}}},Wt=new Yi;function qi(){return typeof performance<"u"&&typeof performance.now=="function"?performance.now():Date.now()}var $t=class{constructor(){this.Lt=[];this.hn=[];this.pn=[];this.ss=Wt.acquire(),this.fn=Wt.snapshot()}start(){return qi()}Ih(e,t,i){this.Lt.push({duration:Math.max(0,qi()-e),rows:t,columns:i}),this.Lt.length>120&&this.Lt.shift()}Ah(e){this.Ll(this.hn,e)}za(e){this.Ll(this.pn,e)}snapshot(){let e=this.Lt.map(r=>r.duration),t=this.Lt[this.Lt.length-1],i=Wt.snapshot();return{sampleCount:e.length,lastRenderMs:t?.duration??0,averageRenderMs:this.kh(e),maxRenderMs:Math.max(0,...e),p95RenderMs:this.as(e),longRenderCount:e.filter(r=>r>16.7).length,renderedRows:t?.rows??0,renderedColumns:t?.columns??0,renderedCells:(t?.rows??0)*(t?.columns??0),layoutSampleCount:this.hn.length,p95LayoutMs:this.as(this.hn),modelSampleCount:this.pn.length,p95ModelMs:this.as(this.pn),longTaskCount:Math.max(0,i.count-this.fn.count),longTaskTotalMs:Math.max(0,i.totalMs-this.fn.totalMs),usedHeapBytes:this.usedHeapBytes()}}reset(){this.Lt=[],this.hn=[],this.pn=[],this.fn=Wt.snapshot()}destroy(){this.ss?.(),this.ss=null}Ll(e,t){e.push(Math.max(0,qi()-t)),e.length>120&&e.shift()}kh(e){return e.length===0?0:e.reduce((t,i)=>t+i,0)/e.length}usedHeapBytes(){let e=typeof performance>"u"?void 0:performance.memory?.usedJSHeapSize;return typeof e=="number"&&Number.isFinite(e)?e:null}as(e){if(e.length===0)return 0;let t=[...e].sort((i,r)=>i-r);return t[Math.max(0,Math.ceil(t.length*.95)-1)]??0}};function Xi(n,e){if(!(n==null||e==null))return[...new Set([...n,...e])]}function ea(n,e){return n===!0||e===!0?!0:n?e?{rowIds:Xi(n.rowIds,e.rowIds),rowIndexes:Xi(n.rowIndexes,e.rowIndexes),columns:Xi(n.columns,e.columns),force:n.force===!0||e.force===!0,includePinned:n.includePinned===!0||e.includePinned===!0}:n:e}var ta=["columns","header","pool","data","layout","pinned","summary","overlays"];function ia(n,e){let t={cells:ea(n.cells,e.cells)};for(let i of ta)t[i]=n[i]===!0||e[i]===!0;return t}var Kt=class{constructor(e){this.apply=e;this.Nt=0;this.ut=null;this.Nl=0;this.Fl=0;this.Ol=0;this.mn=!1}batch(e){if(this.mn)return e();this.Nt++;try{return e()}finally{this.Nt--,this.Nt===0&&this.flush()}}Hl(e){this.mn||(this.Fl++,this.ut&&this.Ol++,this.ut=ia(this.ut??{},e),this.Nt===0&&this.flush())}flush(){if(this.mn||this.Nt>0||!this.ut)return;let e=this.ut;this.ut=null,this.Nl++,this.apply(e)}snapshot(){return{batchDepth:this.Nt,flushCount:this.Nl,requestCount:this.Fl,coalescedRequestCount:this.Ol,pending:this.ut!=null}}destroy(){this.mn=!0,this.ut=null,this.Nt=0}};var Dn=Symbol.for("mach-table.adapter.lifecycle.v1");function xn(n,e){Object.defineProperty(n,Dn,{value:e})}function Ji(n){let e=n[Dn]?.rowDrag;return e?.policy===n.getOption("rowDragPolicy")?e?.factory:void 0}var Rn=Symbol.for("mach-table.import.v1");function En(n,e){Object.defineProperty(n,Rn,{value:{begin:()=>e.B.tn(),revision:()=>e.i.Ve(),isEditing:()=>e.a.isEditing(),columns:()=>e.r.Z(),visibleColumns:()=>e.r.l(),read:(i,r)=>e.d(i,r),editable:(i,r)=>e.a.ae(i,r),parse:(i,r,o,s)=>he(e,i,r,o,"import",s),pasteRows:i=>{let r=[];for(let o of e.i.Et())if(!o.isGroup&&!o.isDetail&&r.push(o),r.length>=i)break;return r},resolveId:(i,r)=>e.t.resolveRowId?.({data:i,index:r,api:n}),validate:(i,r)=>e.B.qo(i,r),guard:i=>e.B.Qr(i),commitRows:(i,r,o)=>e.B.Cl(i,r,o)}})}function Sn(n){let e=n[Rn];if(!e)throw new TypeError("Import plans require a MachTable GridApi");return e}function ra(n,e,t,i){let r=n.columns().filter(c=>c.colDef.field),o=t.columns??e,s=new Map(r.map(c=>[c.id,c])),a=new Map,l=new Map;for(let c of r){let h=c.colDef.field;a.set(h,a.has(h)?null:c);let f=c.colDef.headerName;f&&l.set(f,l.has(f)?null:c)}let d=[],u=new Set;return o.forEach((c,h)=>{let f=(typeof c=="string"||typeof c=="number"?String(c):"").replace(/^\uFEFF/,"").trim(),m=s.get(f)??(a.has(f)?a.get(f):l.get(f));if(!m){if(i||t.columns||a.has(f)||l.has(f))throw new TypeError(`Unknown or ambiguous import column: ${f}`);return}if(u.has(m.colDef.field))throw new TypeError(`Duplicate import column: ${m.id}`);u.add(m.colDef.field),d.push({column:m,index:h})}),d.length?d:n.visibleColumns().filter(c=>c.colDef.field).map((c,h)=>({column:c,index:h}))}function na(n,e){if(!Array.isArray(n)||n.some(t=>!Array.isArray(t)))throw new TypeError("Import requires an array of rows");if(!Number.isInteger(e)||e<-1||e>=n.length)throw new RangeError("Invalid import header row");if(n.length-e-1>1e4||n.reduce((t,i)=>t+i.length,0)>1e5)throw new RangeError("Import supports 10000 data rows and 100000 cells")}function oa(n,e,t,i,r,o){let s=t.colDef.field,a=n.read(e.node,t),l=o.parseValue?o.parseValue({value:r,field:s,rowIndex:e.rowIndex,columnIndex:i}):t.colDef.valueParser?n.parse(e.node,t,r,a):Rt(r,o.coerceNumbers!==!1);if(I(l))throw new TypeError("Import parsers must return synchronous values");if(!ge(e.data,s,l))throw new TypeError(`Unsafe import field: ${s}`);e.changes.push({node:e.node,column:t,oldValue:a,newValue:l})}function sa(n,e,t,i,r,o,s,a){let l=a?.[t]??{},d=s?.[t]??{id:`import:${t}`,rowIndex:t,data:l,selected:!1},u={data:l,node:d,changes:[],rowIndex:t};for(let{column:c,index:h}of i)if(!(e[h]===void 0||s&&!n.editable(d,c)))try{oa(n,u,c,h,e[h],r)}catch(f){o.issues.push({rowIndex:t,columnIndex:h,colId:c.id,code:"PARSE",message:f instanceof Error?f.message:String(f)})}o.rows.push(u)}function Mn(n,e,t={},i,r=!1,o){let s=t.headerRowIndex??(t.columns?-1:0);na(e,s);let a=ra(n,s<0?[]:e[s],t,r);if(!a.length)throw new TypeError("Import requires a writable field column");let l={rows:[],issues:[]};for(let d=s+1;d<e.length;d++){let u=e[d];u.some(c=>c!==""&&c!==void 0)&&sa(n,u,d-s-1,a,t,l,i,o)}return l}function pe(n){return(n==null?"":String(n)).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function Ut(n,e,t="text/plain;charset=utf-8"){try{if(typeof document>"u"||typeof Blob>"u")return!1;let i=document.createElement("a");if(typeof URL<"u"&&typeof URL.createObjectURL=="function"){let r=new Blob([e],{type:t}),o=URL.createObjectURL(r);i.href=o,i.download=n,i.click();let s=typeof URL.revokeObjectURL=="function"?URL.revokeObjectURL.bind(URL):null;s&&setTimeout(()=>{try{s(o)}catch{}},0)}else i.href=`data:${t},${encodeURIComponent(e)}`,i.download=n,i.click();return!0}catch{return!1}}var jt=["gridReady","gridDestroyed","modelUpdated","cellClicked","cellDoubleClicked","cellContextMenu","rowClicked","rowDoubleClicked","selectionChanged","sortChanged","filterChanged","columnResized","columnMoved","columnVisibilityChanged","cellValueChanged","cellEditingStarted","cellEditingStopped","rowEditingStarted","rowEditingStopped","detailToggled","treeChildrenLoaded","treeChildrenLoadFailed","rowDragEnd","rangeSelectionChanged","paginationChanged","displayedColumnsChanged","gridError","dirtyStateChanged"];var Re={columnDefs:"array",rowData:"array",defaultColDef:"object",columnTypes:"object",rowKey:"unknown",rowHeight:"number",headerHeight:"number",rowBuffer:"number",columnLayout:"string",enableColumnResize:"boolean",domLayout:"string",maxBodyHeight:"number",rowSelection:"string",multiSort:"boolean",size:"string",stripedRows:"boolean",rowStyleRules:"array",showCellBorders:"boolean",theme:"string",quickFilterText:"string",advancedFilterModel:"object",masterDetail:"boolean",detailRowHeight:"number",detailRowRenderer:"function",isRowExpandable:"function",detailToggleColumn:"boolean",columnMenu:"boolean",aggFuncs:"object",components:"object",actionPolicy:"object",features:"array",initialState:"object",persistence:"boolean-object",locale:"object",editType:"string",editableIndicator:"string",rowEditValidator:"function",singleClickEdit:"boolean",manualSorting:"boolean",manualFiltering:"boolean",showSummary:"boolean",summaryMethod:"function",treeData:"boolean",childrenKey:"string",isTreeRowExpandable:"function",loadTreeChildren:"function",autoCheckedChildren:"boolean",defaultExpandAll:"boolean",rowNumber:"boolean",indexOffset:"number",applyRowDrag:"boolean",rowDragPolicy:"object",undoStackSize:"number",asyncTransactionWaitMillis:"number",getRowHeight:"function",pinnedTopRowData:"array",pinnedBottomRowData:"array",pagination:"boolean-object",watermark:"boolean-object",suppressWarnings:"boolean",enableRangeSelection:"boolean",suppressClipboard:"boolean",contextMenu:"boolean",getContextMenuItems:"function",tooltipComponent:"function",tooltipShowDelay:"number",flashCells:"boolean",fillHandle:"boolean",statusBar:"boolean-object",datasource:"object",datasourceMode:"string",blockSize:"number",infiniteBufferRows:"number",maxBlocksInCache:"number",datasourceMaxConcurrentRequests:"number",blockPrefetch:"number",datasourceRowCount:"number",dataProcessor:"object-function",dataProcessorMinRows:"number",datasourceRetryCount:"number",datasourceRetryDelay:"number",datasourceRetryJitter:"number",suppressCellFocus:"boolean",suppressRowHoverHighlight:"boolean",suppressNoRowsOverlay:"boolean",suppressHeaderFocus:"boolean",ariaLabel:"string",ariaLabelledBy:"string",ariaDescribedBy:"string",loading:"boolean",error:"unknown",overlayNoRowsTemplate:"unknown",overlayLoadingTemplate:"unknown",overlayErrorTemplate:"unknown",allowUnsafeOverlayHtml:"boolean",className:"string"};var Zi=Object.freeze(Object.keys(Re));var _e=new Set(jt.map(n=>`on${n.charAt(0).toUpperCase()}${n.slice(1)}`));function Qi(n,e){let t=Re[n];return e==null||t==="unknown"?!0:t==="array"?Array.isArray(e):t==="number"?x(e,n==="maxBodyHeight"?1:-1/0)!==void 0:t==="boolean-object"&&typeof e=="boolean"||t==="object-function"&&typeof e=="function"?!0:t==="object"||t==="boolean-object"||t==="object-function"?typeof e=="object"&&!Array.isArray(e):typeof e===t}function In(n){let e={};for(let[t,i]of Object.entries(n)){if(_e.has(t)){(i==null||typeof i=="function")&&(e[t]=i);continue}!v(Re,t)||!Qi(t,i)||(e[t]=i)}return e}var kn=2e3,er=1e5,ze=512,la=1e4;function An(n){return Array.isArray(n)?[...new Set(n.slice(0,er).filter(e=>typeof e=="string"&&e.length>0&&e.length<=ze))]:[]}function da(n){if(!Array.isArray(n))return[];let e=new Set,t=er*ze;for(let i of n.slice(0,er)){if(typeof i!="string"||!i.length||e.has(i))continue;let r=i.startsWith(vt)?65536:ze;i.length>r||i.length>t||(e.add(i),t-=i.length)}return[...e]}function ua(n,e){let t=M(e.flex);for(let i of["width","contentWidth"]){let r=M(e[i]);r!==void 0&&(n[i]=r)}e.flex===null?n.flex=null:t!==void 0&&(n.flex=t),(e.widthMode==="auto"||e.widthMode==="manual")&&(n.widthMode=e.widthMode)}function ca(n,e){typeof e.hide=="boolean"&&(n.hide=e.hide),(e.pinned===null||e.pinned==="left"||e.pinned==="right")&&(n.pinned=e.pinned)}function ha(n,e){if(n==null||typeof n!="object")return null;let t=n,i=typeof t.colId=="string"?t.colId.trim():"";if(!i||i.length>ze||e.has(i))return null;e.add(i);let r={colId:i};return ca(r,t),ua(r,t),r}function pa(n){if(!Array.isArray(n))return[];let e=[],t=new Set;for(let i of n.slice(0,kn)){let r=ha(i,t);r&&e.push(r)}return e}function fa(n){if(!Array.isArray(n))return[];let e=[],t=new Set;for(let i of n.slice(0,kn)){if(i==null||typeof i!="object")continue;let r=i,o=typeof r.colId=="string"?r.colId.trim():"";!o||o.length>ze||t.has(o)||r.direction!=="asc"&&r.direction!=="desc"||(t.add(o),e.push({colId:o,direction:r.direction}))}return e}function j(n){if(n==null||typeof n!="object")return null;let e=n;if(e.version!==2||!Array.isArray(e.columns)||!Array.isArray(e.sortModel))return null;let t=e.pagination!=null&&typeof e.pagination=="object"?e.pagination:{};return{version:2,columns:pa(e.columns),sortModel:fa(e.sortModel),filterModel:te(e.filterModel),advancedFilterModel:F(e.advancedFilterModel),quickFilterText:typeof e.quickFilterText=="string"&&e.quickFilterText.trim()?e.quickFilterText.slice(0,la):null,pagination:{enabled:t.enabled===!0,page:S(t.page,1,1,!0),pageSize:S(t.pageSize,20,1,!0)},selectedRowIds:An(e.selectedRowIds),expandedRowIds:An(e.expandedRowIds),expandedGroupIds:da(e.expandedGroupIds)}}function Pn(n,e){let t=j(n);if(!t)throw new TypeError("[MachTable] Cannot persist an invalid GridState snapshot.");let i=new Set(e);return{version:2,columns:i.has("columns")?t.columns:[],sortModel:i.has("sort")?t.sortModel:[],filterModel:i.has("filter")?t.filterModel:{},advancedFilterModel:i.has("filter")?t.advancedFilterModel:null,quickFilterText:i.has("filter")?t.quickFilterText:null,pagination:i.has("pagination")?t.pagination:{enabled:!1,page:1,pageSize:20},selectedRowIds:i.has("selection")?t.selectedRowIds:[],expandedRowIds:i.has("expansion")?t.expandedRowIds:[],expandedGroupIds:i.has("expansion")?t.expandedGroupIds:[]}}function ma(n){try{if(typeof structuredClone=="function")return structuredClone(n)}catch{}return Array.isArray(n)?[...n]:n!=null&&typeof n=="object"?{...n}:n}function Ln(n,e){let t=e?new Set(e.map(String)):null;return n.filter(i=>!t||t.has(i.rowId)).map(i=>({...i,data:ma(i.data),cells:i.cells.map(r=>({...r}))}))}function ga(n,e){let t=typeof n?.rowId=="string"?n.rowId:"";return!e.has(t)||typeof n.message!="string"||!n.message.trim()?null:{...n,rowId:t,message:n.message.trim(),...typeof n.code=="string"&&n.code.trim()?{code:n.code.trim()}:{},...Array.isArray(n.colIds)?{colIds:[...new Set(n.colIds.filter(i=>typeof i=="string"&&i.length>0))]}:{}}}function Gn(n,e){let t=new Map;for(let i of n??[]){let r=ga(i,e);r&&!t.has(r.rowId)&&t.set(r.rowId,r)}return[...t.values()]}function Nn(n,e){let t=new Set(n.map(d=>d.rowId)),i=Gn(e?.conflicts,t),r=new Set(i.map(d=>d.rowId)),o=Gn(e?.failures,t).filter(d=>!r.has(d.rowId)),s=new Set([...o,...i].map(d=>d.rowId)),a=e?.savedRowIds==null?null:new Set(e.savedRowIds.map(String).filter(d=>t.has(d))),l=n.filter(d=>!s.has(d.rowId)&&(a==null||a.has(d.rowId)));return{submitted:n,saved:l,failures:o,conflicts:i}}function ya(n,e){if(e.serverData===void 0)return null;let t=n.rows.getById(e.rowId);if(!t||t.data==null)return null;let i=n.getOption("rowKey");if(i){let s=typeof i=="function"?i(e.serverData):_(e.serverData,i);return String(s)===e.rowId?{data:e.serverData,mergeIntoCurrent:!1}:null}let r=t.data;return r!=null&&e.serverData!=null&&typeof r=="object"&&typeof e.serverData=="object"?{data:r,mergeIntoCurrent:!0}:null}function Fn(n,e,t){if(n.isDestroyed())return!1;if(t==="keepLocal")return!0;let i=ya(n,e);return i?(n.editing.rollback([e.rowId]),i.mergeIntoCurrent&&Object.assign(i.data,e.serverData),n.rows.transact({update:[i.data]}),n.editing.markSaved([e.rowId]),!0):!1}var va=["compact","normal","large"],C=["left","center","right"];function Yt(n,e){let t=n.t,i;if(e==="loading")i=t.overlayLoadingTemplate||n.Ph();else if(e==="noRows")i=t.overlayNoRowsTemplate||n.Gh();else if(e==="error")i=t.overlayErrorTemplate||n.Lh();else{n.n.Nh();return}n.n.Fh(e,i,t.allowUnsafeOverlayHtml)}var qt=class{constructor(e){this.e=e;this.or=null;this.us=null;this.cs=!1;this.bn=null;this.hs=[];this.wn=null;this.ai=0;this.Vl=-1;this.Bl=-1;this.jt=1;this.ps=()=>{document.fonts.ready.then(this.$l)};this.$l=()=>{this.ai||this.e.o()||(this.ai=requestAnimationFrame(()=>{this.ai=0,this.e.Ie()}))};this.li=null}init(e,t){let i=["mach-root",`mach-size--${t.size}`];t.stripedRows&&i.push("mach-striped"),t.showCellBorders&&i.push("mach-cell-borders"),t.domLayout==="autoHeight"&&i.push("mach-dom-layout--auto-height"),this.root=p("div",i.join(" ")),this._l(t.className),this.root.style.setProperty("--mach-row-h",`${t.rowHeight}px`),this.root.style.setProperty("--mach-header-h",`${t.headerHeight}px`),this.root.setAttribute("role","grid"),this.root.tabIndex=0,this.zl(t),this.rr=p("div","mach-header"),this.rr.setAttribute("role","rowgroup"),this.nr={left:[],center:[],right:[]},this.ls={},this.ni={};for(let r of C){let o=p("div",`mach-pane mach-pane--${r} mach-header-pane`),s=p("div","mach-header-rows");if(r==="center"){let a=p("div","mach-header-viewport");a.appendChild(s),o.appendChild(a)}else o.appendChild(s);this.rr.appendChild(o),this.ls[r]=o,this.ni[r]=s}this.Wl(1),this.ye=p("div","mach-body"),this.gn=p("div","mach-pinned-rows mach-pinned-rows--top"),this.gn.style.display="none",this.yn=p("div","mach-pinned-rows mach-pinned-rows--bottom"),this.yn.style.display="none",this.b={},this.ce={},this.ds={};for(let r of C){let o=p("div",`mach-pane mach-pane--${r} mach-body-pane`),s=p("div",`mach-body-viewport${r==="center"?" mach-body-viewport--scroll":""}`),a=p("div","mach-row-container");s.appendChild(a),o.appendChild(s),this.ye.appendChild(o),this.ds[r]=o,this.b[r]=s,this.ce[r]=a}this.$e=p("div","mach-overlay"),this.$e.style.display="none",this.$e.setAttribute("role","status"),this.$e.setAttribute("aria-live","polite"),this.Ke=p("div","mach-overlay-content"),this.$e.appendChild(this.Ke),this.ct=p("div","mach-infinite-loading"),this.ct.style.display="none",this.ct.appendChild(p("div","mach-spinner")),this.vn=p("span"),this.ct.appendChild(this.vn),this.root.append(this.rr,this.gn,this.ye,this.yn,this.$e,this.ct),e.appendChild(this.root),document.fonts?.addEventListener("loading",this.ps),document.fonts?.status==="loading"&&this.ps(),typeof ResizeObserver<"u"&&(this.wn=new ResizeObserver(r=>{let o=r[r.length-1]?.contentRect;if(!o)return;let s=Math.round(o.width),a=Math.round(o.height);s===this.Vl&&a===this.Bl||(this.Vl=s,this.Bl=a,this.$l())}),this.wn.observe(this.root)),this.Kl(t.theme)}zl(e){e.ariaLabelledBy?(this.root.setAttribute("aria-labelledby",e.ariaLabelledBy),this.root.removeAttribute("aria-label")):(this.root.removeAttribute("aria-labelledby"),this.root.setAttribute("aria-label",e.ariaLabel)),e.ariaDescribedBy?this.root.setAttribute("aria-describedby",e.ariaDescribedBy):this.root.removeAttribute("aria-describedby")}Wl(e){this.jt=e;for(let t of C){let i=this.ni[t],r=this.nr[t];for(;r.length<e;){let o=p("div","mach-header-row");o.setAttribute("role","row"),o.setAttribute("aria-rowindex",String(r.length+1)),i.appendChild(o),r.push(o)}for(;r.length>e;)r.pop().remove()}this.Ul()}jl(){return this.jt}Ul(){this.rr.style.height=`${this.jt*this.e.t.headerHeight}px`;for(let e of C)this.nr[e].forEach((i,r)=>{i.style.top=`${r*this.e.t.headerHeight}px`,i.style.height=`${this.e.t.headerHeight}px`})}Oh(e,t){this.ql("left",e),this.ql("right",t)}ql(e,t){let i=this.ls[e],r=this.ds[e];i.style.width=`${t}px`,r.style.width=`${t}px`;let o=t<=0;i.classList.toggle("mach-pane--hidden",o),r.classList.toggle("mach-pane--hidden",o)}fs(){let e=this.b.center,t=Math.max(0,e.offsetWidth-e.clientWidth);return Math.max(0,this.ye.clientWidth-t)}Hh(e,t){this.root.style.setProperty("--mach-row-h",`${e}px`),this.root.style.setProperty("--mach-header-h",`${t}px`),this.Ul()}Vh(e){for(let t of va)this.root.classList.toggle(`mach-size--${t}`,t===e)}Kl(e){if(!this.root)return;this.li?.(),this.li=null;let t=e==="dark"||e==="auto"&&this.Bh();if(this.root.classList.toggle("mach-theme-dark",t),e==="auto"&&typeof window<"u"&&typeof window.matchMedia=="function"){let i=window.matchMedia("(prefers-color-scheme: dark)"),r=()=>this.root.classList.toggle("mach-theme-dark",i.matches);typeof i.addEventListener=="function"?(i.addEventListener("change",r),this.li=()=>i.removeEventListener("change",r)):typeof i.addListener=="function"&&(i.addListener(r),this.li=()=>i.removeListener(r))}}Bh(){return typeof window>"u"||typeof window.matchMedia!="function"?!1:window.matchMedia("(prefers-color-scheme: dark)").matches}_h(e){this.root.classList.toggle("mach-striped",e)}zh(e){this.root.classList.toggle("mach-cell-borders",e)}Wh(e){this.root.classList.toggle("mach-dom-layout--auto-height",e==="autoHeight")}_l(e){for(let t of this.hs)this.root.classList.remove(t);this.hs=[];for(let t of String(e??"").split(/\s+/).filter(Boolean))this.root.classList.contains(t)||(this.root.classList.add(t),this.hs.push(t))}$h(e){try{return typeof e=="function"?e():e}catch(t){return this.e.reportError(t,"overlayTemplate"),""}}Kh(e,t,i){if(typeof t=="object"&&t!=null&&"el"in t){this.Ke.appendChild(t.el),this.bn=t.destroy??null;return}if(t instanceof HTMLElement){this.Ke.appendChild(t);return}if(t){i?this.Ke.innerHTML=t:this.Ke.textContent=t;return}if(e!=="loading")return;let r=p("div","mach-spinner");r.setAttribute("aria-label","loading"),this.Ke.appendChild(r)}Fh(e,t,i=!1){this.or===e&&this.us===t&&this.cs===i||(this.or=e,this.us=t,this.cs=i,this.ms(),this.Ke.replaceChildren(),this.Kh(e,this.$h(t),i),this.$e.style.display="",this.root.classList.add("mach-has-overlay"),this.$e.setAttribute("role",e==="error"?"alert":"status"),this.root.setAttribute("aria-busy",e==="loading"?"true":"false"))}Nh(){this.or&&(this.or=null,this.us=null,this.cs=!1,this.$e.style.display="none",this.root.classList.remove("mach-has-overlay"),this.ms(),this.Ke.replaceChildren(),this.root.setAttribute("aria-busy","false"))}Dt(e,t){this.ct&&(e?(this.vn.textContent!==t&&(this.vn.textContent=t),this.ct.style.display="",this.root.setAttribute("aria-busy","true")):(this.ct.style.display="none",this.or!=="loading"&&this.root.setAttribute("aria-busy","false")))}destroy(){document.fonts?.removeEventListener("loading",this.ps),this.li?.(),this.li=null,this.wn?.disconnect(),this.wn=null,this.ai&&cancelAnimationFrame(this.ai),this.ai=0,this.ms(),this.root?.remove()}ms(){if(!this.bn)return;let e=this.bn;this.bn=null;try{e()}catch(t){this.e.reportError(t,"overlayTemplate.destroy")}}};function On(n,e){return{setData:t=>n.rt(t),transact:t=>n.Li(t),transactAsync:(t,i)=>n.Uh(t,i),flushTransactions:()=>n.Yl(),getCount:()=>e.i.P(),getAt:t=>e.i.h(t),getById:t=>e.i.N(t),forEach:t=>e.i.gc(t),forEachDisplayed:t=>e.i.yc(t),reorder:(t,i)=>!e.o()&&!e.a.isEditing()&&e.i.qa(t,i),isRemote:()=>e.i.g,reload:t=>n.reload(t),ensureLoaded:(t,i,r)=>n.Co(t,i,r),purgeCache:()=>{e.o()||e.i.Vu()},getCacheSnapshot:()=>e.i.Bu()}}function Hn(n,e){return{getDefinitions:()=>e.r.ao(),setDefinitions:t=>n.Ti(t),getState:()=>e.r.fa(),setState:t=>n.jh(t),resetState:()=>n.ho(),setVisible:(t,i)=>n.lo(t,i),setPinned:(t,i)=>n.uo(t,i),move:(t,i)=>{e.o()||e.Di(t,i)},setWidth:(t,i)=>n.Ee(t,i),fit:t=>n.qh(t),autoSize:t=>n.Yh(t),autoSizeAll:()=>n.Xh(),getWorkbenchItems:()=>n.Jh(),openWorkbench:t=>{e.o()||e.columnMenu.hh(t)},closeWorkbench:()=>e.columnMenu.close()}}function Vn(n,e){return{getRows:()=>e.f.Ya(),getVisibleRows:()=>n.Zh(),getNodes:()=>e.f.Qt(),getIds:()=>e.f.Io(),setRows:(t,i)=>n.Qh(t,i),setById:(t,i,r)=>e.f.Cc(t,i,r),selectAll:t=>e.f.selectAll(t),clear:()=>e.f.deselectAll(),getMode:()=>e.t.rowSelection,setMode:t=>n.ep(t),getRange:()=>e.s.sr(),clearRange:()=>n.si()}}function Bn(n,e){return{startCell:t=>n.tp(t),startRow:t=>e.a.startRow(t),isRowActive:t=>e.a.hl(t),stop:t=>e.a.ke(t?.cancel===!0),getChanges:()=>e.k.getChanges(),getDirtyRowIds:()=>e.k.getDirtyRowIds(),markSaved:t=>e.k.markSaved(t),rollback:t=>e.k.rollback(t),save:(t,i)=>n.ip(t,i),undo:()=>!e.o()&&e.H.undo(),redo:()=>!e.o()&&e.H.redo(),canUndo:()=>e.H.canUndo(),canRedo:()=>e.H.canRedo()}}function _n(n){return{get:()=>n.getState(),apply:(e,t)=>n.Xl(e,t)}}function zn(n,e){return{get:()=>e.rp(),getPerformance:()=>e.Ce.snapshot(),resetPerformance:()=>e.Ce.reset()}}function Wn(n,e){return{getModel:()=>e.i.Be(),setModel:t=>n.xt(t),getAdvancedModel:()=>e.i.Pi(),setAdvancedModel:t=>n.nt(t),getQuickText:()=>e.i.xo(),setQuickText:t=>n.Rt(t),isPresent:t=>t==null?e.i.Ni():v(e.i.Be(),t)}}function $n(n,e){return{getModel:()=>e.r.Q(),setModel:t=>n.np(t)}}function Kn(n,e){return{isEnabled:()=>e.i.Te,setEnabled:t=>{e.o()||e.i.Ka(t)},getPage:()=>e.i.Zt(),setPage:t=>{e.o()||e.i.setPage(t)},getPageSize:()=>e.t.paginationPageSize,setPageSize:t=>{e.o()||e.i.setPageSize(t)},getPageCount:()=>e.i.getPageCount(),getTotalRowCount:()=>e.i.getTotalRowCount()}}function Un(n,e){return{isRowExpanded:t=>e.i.isRowExpanded(t),setRowExpanded:(t,i)=>e.o()||e.i.isRowExpanded(t)===i?!1:(i?e.i.pc(t):e.i.fc(t),e.i.isRowExpanded(t)===i),isTreeRowLoading:t=>!e.o()&&e.i.isTreeRowLoading(t),loadTreeChildren:(t,i)=>e.o()?Promise.resolve([]):e.i.loadTreeChildren(t,i?.force===!0),isGroupExpanded:t=>e.i.isGroupExpanded(t),setGroupExpanded:(t,i)=>e.o()||e.i.isGroupExpanded(t)===i?!1:(e.i.So(t),e.i.isGroupExpanded(t)===i),setAllGroupsExpanded:t=>{e.o()||e.i.setAllGroupsExpanded(t)},setAllDetailsExpanded:t=>{e.o()||e.i.setAllDetailsExpanded(t)}}}function jn(n,e){return{getRoot:()=>e.o()?null:e.n.root,scrollToRow:(t,i)=>e.s.Kr(t,i),refreshCells:t=>n.refreshCells(t),refreshLayout:()=>n.refreshLayout(),flush:()=>e.di.flush(),setOverlay:t=>Yt(e,t),getPinnedRows:t=>e.Ge.getRows(t),setPinnedRows:(t,i)=>n.setPinnedRows(t,i)}}function qn(n,e){return{exportCsv:t=>n.op(t),importCsv:(t,i)=>n.importCsv(t,i),exportMatrix:t=>n.Jl(t),importMatrix:(t,i)=>n.importMatrix(t,i),print:t=>n.print(t),copyRange:()=>e.o()?Promise.resolve(!1):e.Rl()}}function Xt(n){return se(n?.reason,"The operation was aborted")}function Yn(n,e){return ft(n,e,()=>Xt(e))}function tr(n,e,t,i=!1){let r=x(n,t,i);return r===void 0||r===e?void 0:r}function L(n,e,t){let i=n[t];return i==null||i===e[t]?!1:(e[t]=i,!0)}var ir=class{constructor(e){this.e=e;this.gs=[];this.ar=null}batch(e){return this.e.Zl(()=>e(this.e.api))}rt(e){if(!this.e.o()){if(this.e.i.g){this.e.t.rowData=e??[];return}this.e.i.rt(e),this.e.$({data:!0})}}Li(e){if(this.e.o()||this.e.i.g)return;let t=this.e.i.Li(e);this.Ql(t)}Uh(e,t={}){if(this.e.o()||this.e.i.g)return Promise.resolve();if(t.signal?.aborted)return Promise.reject(Xt(t.signal));let i=new Promise((r,o)=>{let s={transaction:e,revision:this.e.i.Ve(),resolve:r,reject:o,signal:t.signal,aborted:!1};t.signal&&(s.onAbort=()=>{s.aborted||(s.aborted=!0,o(Xt(t.signal)))},t.signal.addEventListener("abort",s.onAbort,{once:!0})),this.gs.push(s)});return this.ar==null&&(this.ar=setTimeout(()=>this.Yl(),this.e.t.asyncTransactionWaitMillis)),i}ed(){this.ar!=null&&clearTimeout(this.ar),this.ar=null;let e=this.gs;return this.gs=[],e}Yl(){let e=this.ed(),t=this.e.i,i=t.Ve(),r=e.filter(s=>!s.aborted&&s.revision===i).map(s=>s.transaction);if(r.length>0&&!this.e.o()&&!t.g){let s=t.qu(r);t.Ve()===i&&this.Ql(s)}let o=t.Ve()===i;for(let s of e)s.signal&&s.onAbort&&s.signal.removeEventListener("abort",s.onAbort),!s.aborted&&(o&&s.revision===i?s.resolve():s.reject(se(void 0,"The table data changed before the transaction could complete")))}Ql(e){if(!(!e.pipelineChanged&&e.updatedRowIds.length===0)){if(e.pipelineChanged||this.e.t.getRowHeight||this.e.r.l().some(t=>t.colDef.autoHeight===!0)){this.e.$({data:!0});return}this.e.$({cells:{rowIds:e.updatedRowIds},summary:!0,overlays:!0})}}Ti(e){this.updateOptions({columnDefs:[...e??[]]})}jh(e){this.e.o()||(this.e.r.ma(e),this.ys())}ho(){this.e.o()||(this.e.r.ho(),this.ys())}lo(e,t){this.e.o()||(this.e.r.lo(e,t),this.e.lr(),this.e.emit("columnVisibilityChanged",{colId:e,visible:t}))}uo(e,t){this.e.o()||(this.e.r.uo(e,t),this.ys())}ys(){this.e.lr(),this.e.Cn()}Ee(e,t){if(this.e.o())return!1;let i=this.e.r.D(e);return!i||!this.e.r.Ee(i,t)?!1:(this.lt([i]),!0)}qh(e){if(this.e.o())return;let t=this.e.r.l(),i=t.filter(d=>d.pinned===null&&!d.colDef.suppressSizeToFit);if(i.length===0)return;let r=e??this.e.n.fs();if(!Number.isFinite(r)||r<=0)return;let o=t.reduce((d,u)=>d+(u.pinned!==null||u.colDef.suppressSizeToFit?u.currentWidth:0),0),s=at(i.map(d=>({width:d.currentWidth,minWidth:d.colDef.minWidth,maxWidth:d.colDef.maxWidth})),Math.max(0,r-o)),a=this.e.t.columnLayout!=="normal"&&e===void 0,l=i.filter((d,u)=>a?this.e.r.ha(d,s[u]):this.e.r.Ee(d,s[u]));this.lt(l)}Yh(e){if(this.e.o())return;let t=this.e.r.D(e);t&&this.td(t)&&this.lt([t])}td(e){return this.e.t.columnLayout!=="normal"&&e.colDef.suppressSizeToFit?!1:e.hasCheckbox||e.isDetailToggle?this.e.r.Ee(e,e.isDetailToggle?38:46):this.sp(e,this.e.Ue.la(e))}sp(e,t){return this.e.t.columnLayout!=="normal"?this.e.r.ha(e,t):this.e.r.Ee(e,t)}Xh(){if(this.e.o())return;let e=[];for(let t of this.e.r.l())this.td(t)&&e.push(t);e.length>0&&this.lt(e)}lt(e){this.e.ti(),this.e.lt(e)}np(e){this.e.o()||(this.e.r.xi(e),this.e.xi())}xt(e){this.e.o()||(this.e.i.xt(e),this.e.dr())}nt(e){this.e.o()||!this.e.i.nt(e)||this.e.dr()}Rt(e){if(this.e.o())return;let t=this.e.i.Rt(e);this.e.t.quickFilterText=this.e.i.xo(),t&&this.e.dr()}ep(e){this.e.t.rowSelection!==e&&this.updateOptions({rowSelection:e})}Qh(e,t=!0){if(this.e.o())return;let i=this.e.t.resolveRowId,r=[];for(let o of e){let s=i?this.e.i.N(this.e.i.resolveRowId(o,-1,`__missing_selection_${this.e.Jt()}`)):this.e.i.Oe().find(a=>a.data===o);s&&r.push({node:s,selected:!0})}r.length>0?this.e.f.Mt(r,t):t&&this.e.f.deselectAll()}Zh(){let e=this.e.f;return this.e.i.Et().filter(t=>!t.isDetail&&!t.isGroup&&e.zr(t.id)).map(t=>t.data).filter(Boolean)}async ip(e,t){let i=Ln(this.e.k.getChanges(),t);if(i.length===0)return{submitted:[],saved:[],failures:[],conflicts:[]};let r=this.e.i.Ve(),o=Nn(i,await e(i));return!this.e.o()&&r===this.e.i.Ve()&&this.e.k.Sh(o.saved),o}setPinnedRows(e,t){if(this.e.o())return;let i=e==="top"?"pinnedTopRowData":"pinnedBottomRowData";this.e.t[i]=t??[],this.e.Ge.setRows(e,this.e.t[i])}si(){this.e.o()||this.e.s.si()}Jh(){return this.e.r.Z().filter(e=>!e.isDetailToggle).map(e=>({colId:e.id,label:e.colDef.headerName??e.colDef.field??e.id,visible:!e.hide,pinned:e.pinned,width:e.currentWidth||e.manualWidth||e.colDef.width||0,movable:e.movable,hideable:!e.hasCheckbox}))}refreshLayout(){this.e.o()||(this.e.Ie(),this.e.s.Tn(!0))}reload(e={}){return this.e.o()?Promise.resolve():e.signal?.aborted?Promise.reject(Xt(e.signal)):this.e.i.g?Yn(this.e.i.Vr(e.signal),e.signal):(this.rt(this.e.t.rowData),Promise.resolve())}Co(e,t,i={}){return this.e.o()?Promise.resolve():Yn(this.e.i.Co(e,t,i.signal),i.signal)}importCsv(e,t={}){if(!e)return!1;let{parseValue:i,...r}=t;return this.importMatrix(Mt(e,t.separator??","),{...r,parseValue:i?o=>i({...o,value:o.value}):void 0})}importMatrix(e,t={}){if(this.e.o()||this.e.i.g||!Array.isArray(e)||!e.length)return!1;try{let i=Sn(this.e.api),r=t.mode==="paste"?i.pasteRows(e.length):void 0,o=Mn(i,e,t,r);if(o.issues.length)return this.e.reportError(new Error(o.issues.map(s=>s.message).join("; ")),"import",{issues:o.issues}),!1;if(t.mode==="paste")this.e.ui(o.rows.flatMap(s=>s.changes));else{let s=o.rows.map(a=>a.data);t.mode==="append"?this.Li({add:s}):this.rt(s)}return!0}catch(i){return this.e.reportError(i,"import"),!1}}print(e={}){if(this.e.o())return!1;try{let t=window.open("","_blank","width=980,height=720");if(!t)return!1;let i=this.e.r.l().filter(d=>X(d)&&!d.colDef.rowDrag),r=this.e.i.Wa().filter(d=>!d.isDetail&&!d.isGroup),s=e.includeHeader!==!1?`<tr>${i.map(d=>`<th>${pe(d.colDef.headerName??d.colDef.field??d.id)}</th>`).join("")}</tr>`:"",a=r.map(d=>`<tr>${i.map(u=>{let c=me(this.e,d,u);return`<td>${pe(c)}</td>`}).join("")}</tr>`).join(""),l=`<!doctype html><html><head><meta charset="utf-8"><title>${pe(e.title??"MachTable")}</title><style>body{font-family:system-ui,"PingFang SC","Microsoft YaHei",sans-serif;padding:20px}h3{margin:0 0 12px;font-size:16px}table{border-collapse:collapse;width:100%;font-size:12px}th,td{border:1px solid #bbb;padding:5px 8px;text-align:left;word-break:break-all}th{background:#f2f5f9;font-weight:600}@page{margin:12mm}</style></head><body><h3>${pe(e.title??"")}</h3><table>${s}${a}</table></body></html>`;return t.document.write(l),t.document.close(),t.focus(),t.print(),!0}catch{return!1}}tp(e){let t=this.e.r.D(e.colId);return t?this.e.a.start(e.rowIndex,t,e.keyPress??null):!1}refreshCells(e){let t=e==null||e.rowIds==null&&e.rowIndexes==null&&e.columns==null;this.e.$({cells:e??!0,pinned:e?.includePinned??t,summary:t})}getOption(e){return this.e.t[e]}updateOptions(e){if(this.e.o()||(this.e.vs(e),e=In(e),Object.keys(e).length===0))return;let t=this.e.t;if((e.treeData??t.treeData)&&(e.rowData!==void 0||e.treeData!=null||e.childrenKey!=null)){let i=v(e,"rowData")?e.rowData:t.rowData;xe(Array.isArray(i)?i:[],e.childrenKey??t.childrenKey)}this.e.Zl(()=>{let i={},r=this.e.t.columnMenu;this.ap(e,i),this.lp(e,i),this.dp(e,i),this.up(e,i),this.cp(e),this.hp(e,i),this.pp(e,i),this.fp(e,i),this.mp(e,i),this.gp(e,i),this.yp(e,i,r)})}ap(e,t){let i=this.e.t;v(e,"columnDefs")&&e.columnDefs!==i.columnDefs&&(i.columnDefs=Array.isArray(e.columnDefs)?e.columnDefs:[],t.needsColumnRebuild=!0,t.columnDefsChanged=!0),E(e,i,["rowNumber"])&&(t.needsColumnRebuild=!0),v(e,"rowData")&&e.rowData!==i.rowData&&(i.rowData=Array.isArray(e.rowData)?e.rowData:[],t.needsRowRebuild=!0),v(e,"initialState")&&e.initialState&&(i.initialState=e.initialState,t.stateToApply=e.initialState),this.vp(e)}vp(e){for(let t of _e){let i=t;v(e,i)&&Reflect.set(this.e.t,i,e[i])}}lp(e,t){let i=this.e.t;for(let o of["rowHeight","headerHeight","rowBuffer"]){let s=tr(e[o],i[o],o==="rowBuffer"?0:1,o==="rowBuffer");s!==void 0&&(i[o]=s,t.layout=!0,o==="headerHeight"&&(t.header=!0))}e.columnLayout!=null&&e.columnLayout!==i.columnLayout&&(i.columnLayout=e.columnLayout==="fit"||e.columnLayout==="normal"?e.columnLayout:"auto",this.e.r.Xe=!1,t.layout=!0),e.domLayout!=null&&e.domLayout!==i.domLayout&&(i.domLayout=e.domLayout==="autoHeight"?"autoHeight":"normal",this.e.n.Wh(i.domLayout),t.pool=!0),v(e,"maxBodyHeight")&&(i.maxBodyHeight=x(e.maxBodyHeight,1),t.layout=!0),E(e,i,["multiSort"]);let r=tr(e.detailRowHeight,i.detailRowHeight,1);r!==void 0&&(i.detailRowHeight=r,this.e.s.Dn(),this.e.s.ur(!0))}dp(e,t){let i=this.e.t;e.editType!=null&&e.editType!==i.editType&&(this.e.a.stop(!0),i.editType=e.editType==="fullRow"?"fullRow":"cell",t.cells=!0),e.editableIndicator!=null&&e.editableIndicator!==i.editableIndicator&&(i.editableIndicator=e.editableIndicator==="always"||e.editableIndicator==="none"?e.editableIndicator:"hover",t.cells=!0),E(e,i,["rowEditValidator"],!0),E(e,i,["singleClickEdit","manualSorting","manualFiltering"])}up(e,t){let i=this.e.t;typeof e.enableColumnResize=="boolean"&&e.enableColumnResize!==i.enableColumnResize&&(this.e.cr.at(),i.enableColumnResize=e.enableColumnResize,t.header=!0),L(e,i,"locale")&&(t.header=!0,t.cells=!0,this.e.ci.xe(),this.e.$i.xe()),L(e,i,"indexOffset")&&(t.cells=!0),L(e,i,"showSummary")&&(t.summary=!0,t.layout=!0);let r=tr(e.undoStackSize,i.undoStackSize,0,!0);r!==void 0&&(i.undoStackSize=r,this.e.H.kl());let o=x(e.asyncTransactionWaitMillis,0,!0);o!==void 0&&(i.asyncTransactionWaitMillis=o),this.bp(e,t),this.wp(e)}bp(e,t){v(e,"getRowHeight")&&(this.e.t.getRowHeight=e.getRowHeight,this.e.s.ot(),t.layout=!0)}wp(e){let t=this.e.t;e.enableRangeSelection!=null&&(t.enableRangeSelection=e.enableRangeSelection,e.enableRangeSelection||this.si()),E(e,t,["tooltipComponent"],!0);let i=x(e.tooltipShowDelay,0);i!==void 0&&(t.tooltipShowDelay=i),E(e,t,["flashCells"]),E(e,t,["getContextMenuItems"],!0),L(e,t,"theme")&&(this.e.n.Kl(t.theme),this.e.xn.refresh())}cp(e){if(!v(e,"pagination"))return;let t=this.e.t,i=e.pagination,r=i!==!1&&t.datasource==null;r!==t.paginationEnabled&&this.e.i.Ka(r),typeof i=="object"&&i&&this.Cp(i),t.paginationEnabled&&this.e.i.nc(),this.e.ci.xe()}Cp(e){let t=this.e.t;t.paginationMode=e.mode==="server"?"server":"client";let i=x(e.page,1,!0),r=x(e.total,0,!0);i!==void 0&&(t.paginationPage=i),r!==void 0&&(t.paginationTotal=r),e.pageSize!=null&&(t.paginationPageSize=e.pageSize),e.pageSizeOptions!=null&&(t.paginationPageSizeOptions=e.pageSizeOptions),e.showTotal!=null&&(t.paginationShowTotal=e.showTotal),e.showPageSizeSelector!=null&&(t.paginationShowSizeSelector=e.showPageSizeSelector)}hp(e,t){v(e,"rowStyleRules")&&(this.e.t.rowStyleRules=Array.isArray(e.rowStyleRules)?e.rowStyleRules:[],t.cells=!0,this.e.$({pinned:!0})),this.Tp(e,t),this.Dp(e,t);let i=this.e.t;L(e,i,"stripedRows")&&this.e.n._h(i.stripedRows),L(e,i,"showCellBorders")&&this.e.n.zh(i.showCellBorders)}Tp(e,t){let i=this.e.t;e.watermark!==void 0&&(Object.assign(i,Ri(e)),this.e.xn.refresh()),this.xp(e),v(e,"summaryMethod")&&(i.summaryMethod=e.summaryMethod,t.summary=!0)}xp(e){let t=this.e.t;E(e,t,["suppressClipboard","contextMenu","columnMenu","fillHandle"]),e.statusBar!==void 0&&(t.statusBarEnabled=e.statusBar===!0||typeof e.statusBar=="object"&&e.statusBar!=null,typeof e.statusBar=="object"&&e.statusBar?.panels&&(t.statusBarPanels=e.statusBar.panels),this.e.$i.xe())}Dp(e,t){let{size:i}=e;if(i==null||!v(Pe,i)||i===this.e.t.size)return;let r=Pe[i];this.e.t.size=i,this.e.t.rowHeight=e.rowHeight??r.rowHeight,this.e.t.headerHeight=e.headerHeight??r.headerHeight,this.e.n.Vh(i),t.layout=!0,t.header=!0}pp(e,t){let i=this.e.t;E(e,i,["suppressCellFocus","suppressRowHoverHighlight","suppressNoRowsOverlay"]),L(e,i,"suppressHeaderFocus")&&(t.header=!0),this.Rp(e),this.Ep(e)}Rp(e){let t=this.e.t,i=!1;for(let r of["ariaLabel","ariaLabelledBy","ariaDescribedBy"])v(e,r)&&(t[r]=e[r]??Ge[r],i=!0);i&&this.e.n.zl(t)}Ep(e){let t=this.e.t;for(let i of["overlayNoRowsTemplate","overlayLoadingTemplate","overlayErrorTemplate"])v(e,i)&&(t[i]=e[i]??Ge[i]);E(e,t,["allowUnsafeOverlayHtml"]),v(e,"className")&&(t.className=e.className??"",this.e.n._l(t.className)),E(e,t,["loading"]),v(e,"error")&&(t.error=e.error??null)}fp(e,t){this.Sp(e,t),this.Mp(e,t);let i=this.e.t;E(e,i,["autoCheckedChildren"]),L(e,i,"defaultExpandAll")&&(t.needsRowRebuild=!0),e.applyRowDrag!=null&&(i.applyRowDrag=e.applyRowDrag,t.cells=!0),v(e,"rowDragPolicy")&&(i.rowDragPolicy=e.rowDragPolicy,t.cells=!0),E(e,i,["suppressWarnings"])}Sp(e,t){let i=this.e.t;if(L(e,i,"rowSelection")&&(this.e.f.bc(),t.header=!0,t.pool=!0,this.e.Rn()),e.quickFilterText!==void 0&&this.Rt(e.quickFilterText),e.defaultColDef!==void 0&&e.defaultColDef!==i.defaultColDef&&(i.defaultColDef={...Di,...e.defaultColDef},t.needsColumnRebuild=!0),v(e,"columnTypes")&&e.columnTypes!==i.columnTypes&&(i.columnTypes=e.columnTypes??{},t.needsColumnRebuild=!0),v(e,"rowKey")){i.rowKey=e.rowKey;let r=e.rowKey;i.resolveRowId=r?({data:o})=>xi(r,o):void 0,t.needsRowRebuild=!0}}Mp(e,t){let i=this.e.t;L(e,i,"masterDetail")&&(t.needsColumnRebuild=!0,t.needsRowRebuild=!0),L(e,i,"detailToggleColumn")&&(t.needsColumnRebuild=!0),L(e,i,"treeData")&&(t.needsRowRebuild=!0,t.needsColumnRebuild=!0,this.e.Rn()),L(e,i,"childrenKey")&&(t.needsRowRebuild=!0),E(e,i,["isTreeRowExpandable","loadTreeChildren"],!0)&&(t.cells=!0)}mp(e,t){let i=this.e.t;E(e,i,["aggFuncs"],!0)&&(t.needsRowRebuild=!0),E(e,i,["components","actionPolicy"],!0)&&(t.cells=!0),v(e,"features")&&(i.features=Array.isArray(e.features)?e.features:[],t.needsFeatureReload=!0),this.Ip(e,t),this.Ap(e,t)}Ip(e,t){let i=this.e.t;v(e,"dataProcessor")&&this.e.rd(e.dataProcessor)&&(t.needsRowRebuild=!0);let r=x(e.dataProcessorMinRows,1,!0);r!==void 0&&r!==i.dataProcessorMinRows&&(i.dataProcessorMinRows=r,t.needsRowRebuild=!0)}Ap(e,t){let i=this.e.t;v(e,"persistence")&&(i.persistence=qe(e.persistence),t.needsStateLoad=!0)}gp(e,t){let i=this.e.t;Ei(e,i)&&i.datasourceMode==="block"&&(t.datasourceChanged=!0),this.kp(e,t),this.Pp(e,t),this.Gp(e)}kp(e,t){let i=this.e.t;if(v(e,"datasourceMode")){let r=e.datasourceMode==="block"?"block":"sequential";r!==i.datasourceMode&&(i.datasourceMode=r,t.datasourceChanged=!0)}if(v(e,"datasourceRowCount")){let r=e.datasourceRowCount==null?null:x(e.datasourceRowCount,0,!0)??null;r!==i.datasourceRowCount&&(i.datasourceRowCount=r,t.datasourceChanged=!0)}}Pp(e,t){let i=this.e.t;v(e,"datasource")&&e.datasource!==i.datasource&&(i.datasource=e.datasource,i.paginationEnabled=e.datasource==null&&i.paginationEnabled,t.datasourceChanged=!0,this.e.ci.xe()),E(e,i,["detailRowRenderer","isRowExpandable"],!0)&&(t.cells=!0)}Gp(e){e.pinnedTopRowData!==void 0&&this.setPinnedRows("top",e.pinnedTopRowData),e.pinnedBottomRowData!==void 0&&this.setPinnedRows("bottom",e.pinnedBottomRowData)}yp(e,t,i){let r=this.e.t;t.needsColumnRebuild?this.Lp(e,t):v(e,"advancedFilterModel")&&(t.filterChanged=this.e.i.nt(e.advancedFilterModel)),t.needsFeatureReload&&this.e.nd(r.features),this.Np(t),t.filterChanged&&this.e.bs(!t.needsColumnRebuild),t.layout&&this.e.n.Hh(r.rowHeight,r.headerHeight),e.columnMenu!=null&&e.columnMenu!==i&&(t.header=!0),t.stateToApply&&this.Xl(t.stateToApply),t.pool&&(t.cells=void 0),t.overlays=!0,this.e.$(t)}Lp(e,t){t.columnDefsChanged&&!t.needsRowRebuild&&(this.e._e(),this.e.a.stop(!0));let i=this.e.r.Ti(this.e.t.columnDefs);t.filterChanged=this.e.i.Xu(v(e,"advancedFilterModel")?e.advancedFilterModel??null:void 0),i&&this.e.emit("sortChanged",{sortModel:this.e.r.Q()},!1),this.e.lr(),t.header=!1,t.pool=!1}Np(e){let t=e.needsStateLoad||e.needsColumnRebuild,i=e.datasourceChanged||e.needsRowRebuild||e.columnDefsChanged||e.filterChanged,r=this.e.t.persistence?.sections,o=i&&(this.e.i.g||r?.length===1&&r[0]==="columns");t&&o&&this.e.ws(!e.needsStateLoad,!0),this.Fp(e,i),t&&!o&&this.e.ws(!e.needsStateLoad)}Fp(e,t){if(e.datasourceChanged){this.e.i.Hu();return}t&&(!this.e.i.g&&e.needsRowRebuild?this.rt(this.e.t.rowData):this.e.i.Ro())}op(e={}){let t=this.Jl({...e,target:"csv",protectFormulas:!1});return mn(t,e)}Jl(e={}){let t=this.e.r.l().filter(X),i=e.includeHeader===!1?[]:[t.map(o=>o.colDef.headerName??o.colDef.field??o.id)];if(e.headersOnly)return i;let r=e.onlySelected?this.e.f.Qt().sort((o,s)=>o.rowIndex-s.rowIndex):e.onlyAllDisplayed?this.e.i.Et():this.e.i.Wa();return[...i,...r.filter(o=>!o.isDetail&&!o.isGroup).map(o=>t.map(s=>{let a=Be(this.e,o,s,e.target??"xlsx");return e.protectFormulas===!1?a:ue(a)}))]}getState(){return{version:2,columns:this.e.r.fa(!1),sortModel:this.e.r.Q(),filterModel:this.e.i.Be(),advancedFilterModel:this.e.i.Pi(),quickFilterText:this.e.i.xo(),pagination:{enabled:this.e.i.Te,page:this.e.i.Zt(),pageSize:this.e.t.paginationPageSize},selectedRowIds:this.e.f.Io(),expandedRowIds:this.e.i.uc(),expandedGroupIds:this.e.i.cc()}}Xl(e,t={}){if(this.e.o())return;let i=j(e);if(!i){this.e.reportError(new TypeError("[MachTable] GridState must use the current version 2 schema."),"gridState.apply");return}let r=["columns","sort","filter","pagination","selection","expansion"],o=new Set(t.sections??r);this.e.a.stop(!0),this.Op(i,o),this.Hp(i,o),t.emitEvents!==!1&&this.Vp(o),o.has("columns")&&this.e.Cn()}Op(e,t){t.has("columns")&&this.e.r.ma(e.columns??[]),t.has("sort")&&this.e.r.xi(e.sortModel??[]),t.has("filter")&&(this.e.i.xt(e.filterModel??{}),this.e.i.nt(e.advancedFilterModel),this.e.i.Rt(e.quickFilterText)),t.has("expansion")&&this.e.i.hc(e.expandedRowIds??[],e.expandedGroupIds??[]),t.has("pagination")&&e.pagination&&(this.e.t.paginationEnabled=e.pagination.enabled&&!this.e.i.g,this.e.i.$a(e.pagination.page,e.pagination.pageSize),this.e.ci.xe())}Hp(e,t){t.has("columns")&&this.e.lr(),this.e.Bp()||(this.e.i.g?(t.has("sort")||t.has("filter"))&&this.e.i.ka():this.e.i.F()),this.e.W.Cs(),this.e.W.Ts(),t.has("selection")&&this.e.f.Xa(e.selectedRowIds??[])}Vp(e){e.has("sort")&&this.e.emit("sortChanged",{sortModel:this.e.r.Q()}),e.has("filter")&&this.e.bs(),e.has("pagination")&&this.e.i.Hi(this.e.t.paginationPageSize)}destroy(){let e=this.ed();for(let t of e)t.signal&&t.onAbort&&t.signal.removeEventListener("abort",t.onAbort),t.aborted||t.resolve();this.e.destroy()}},ba={rows:On,columns:Hn,selection:Vn,editing:Bn,filtering:Wn,sorting:$n,pagination:Kn,hierarchy:Un,view:jn,state:_n,io:qn,diagnostics:zn};function Xn(n){let e=new ir(n),t={};for(let[i,r]of Object.entries(ba)){let o;Object.defineProperty(t,i,{enumerable:!0,get:()=>o??(o=Object.freeze(r(e,n)))})}return Object.assign(t,{batch:i=>e.batch(i),whenReady:()=>n.whenReady(),getOption:i=>e.getOption(i),updateOptions:i=>e.updateOptions(i),on:(i,r)=>n.ue.on(i,r),destroy:()=>e.destroy(),isDestroyed:()=>n.o()}),En(t,n),xn(t,{suspend:()=>n.suspend(),resume:()=>t.view.refreshLayout(),canReplaceData:()=>!n.a.isEditing()&&n.k.getDirtyRowIds().length===0,readCell:(i,r)=>{let o=n.i.N(i),s=n.r.D(r);return o&&s?gn(Be(n,o,s,"clipboard")):""},writeInput:i=>n.ui(i.flatMap(({rowId:r,colId:o,value:s})=>{let a=n.i.N(r),l=n.r.D(o);return a&&l?[{node:a,column:l,oldValue:n.d(a,l),newValue:s}]:[]}))}),Object.freeze(t)}function rr(n,e,t=!1){let i=0,r=n.length;for(;i<r;){let o=i+r>>1;n[o]<e||t&&n[o]===e?i=o+1:r=o}return i}var Ee=class{constructor(){this.ne=new Float64Array(1)}update(e){this.ne.length!==e.length+1&&(this.ne=new Float64Array(e.length+1));let t=0;for(let i=0;i<e.length;i++)t+=e[i].currentWidth,this.ne[i+1]!==t&&(this.ne[i+1]=t)}Ds(){return this.ne[this.ne.length-1]??0}je(e){let t=Math.max(0,Math.min(Math.trunc(e),this.ne.length-1));return this.ne[t]??0}_p(e){let t=Math.max(0,this.ne.length-1);return t===0?-1:Math.min(t-1,Math.max(0,rr(this.ne,Math.max(0,e),!0)-1))}od(e,t,i=2){let r=Math.max(0,this.ne.length-1);if(r===0||t<=0||this.Ds()<=t)return{first:0,lastExcl:r};let o=Math.max(0,e),s=o+t,a=Math.max(0,rr(this.ne,o,!0)-1),l=Math.min(r,rr(this.ne,s));return{first:Math.max(0,a-i),lastExcl:Math.min(r,l+i)}}En(e,t,i){let r=t.indexOf(i);if(r<0)return;this.update(t);let o=this.je(r),s=o+i.currentWidth;o<e.scrollLeft?e.scrollLeft=o:s>e.scrollLeft+e.clientWidth&&(e.scrollLeft=s-e.clientWidth)}};var wa=".mach-header-resize, .mach-filter-btn, .mach-menu-btn, .mach-select-all";function nr(n){return n instanceof HTMLElement&&n.closest(wa)!=null}function or(n){return n==="ArrowLeft"||n==="ArrowRight"}function Jn(n,e){typeof e=="string"?n.classList.add(e):Array.isArray(e)&&n.classList.add(...e)}var Jt=class{constructor(e){this.e=e;this.Y=[];this.xs=[];this.L=new Ee;this.ht=0;this.Ft=Number.MAX_SAFE_INTEGER}Sn(){this.sd(),this.e.cr.at(),this.hi(!1);let e=this.e.r,t=e.xu();this.e.n.Wl(t);let i=new Set(e.x("center").slice(this.ht,this.Ft)),r=e.Du(),o=this.e.t.headerHeight;for(let s of C){let a=this.e.n.nr[s];for(let d of a)d.textContent="";let l=(d,u)=>{let c=a[Math.min(u,a.length-1)];for(let h of d)if(h instanceof re){let f=this.Y.length;if(l(h.children,u+1),this.Y.length===f)continue;let m=this.zp(h);c.appendChild(m),this.xs.push({group:h,el:m,pane:s})}else if(!h.hide&&e.ge(h)===s&&(s!=="center"||i.has(h))){let f=this.Wp(h,t-u,o);c.appendChild(f.el),this.Y.push(f)}};l(r,0)}this.e.t.suppressHeaderFocus||this.Y.forEach((s,a)=>{s.el.tabIndex=a===0?0:-1}),this.pt(),this.Cs(),this.Ts(),this._r()}ad(){let e=this.ht,t=this.Ft;this.sd(),(e!==this.ht||t!==this.Ft)&&this.Sn()}At(e,t){let i=this.e.n.ni[t];return this.Y.find(r=>r.column.id===e&&i.contains(r.el))?.el??null}sd(){let e=this.e.r.x("center"),t=this.e.n.b.center;this.L.update(e);let i=e.length>20?this.L.od(t.scrollLeft,t.clientWidth,2):{first:0,lastExcl:e.length};this.ht=i.first,this.Ft=i.lastExcl}Wp(e,t,i){let r=p("div","mach-header-cell mach-header-cell--leaf");e.hasCheckbox&&r.classList.add("mach-header-cell--selection"),r.dataset.colId=e.id,r.setAttribute("role","columnheader"),r.style.height=`${t*i}px`,this.$p(r,e),this.Kp(r,e);let o=this.Up(r,e);this.jp(r,e);let s=p("span","mach-sort-indicator");r.appendChild(s);let a=e.filterable?this.ld(r,e,!0):void 0;return this.e.t.columnMenu&&!e.hasCheckbox&&!e.colDef.suppressColumnMenu&&this.ld(r,e,!1),this.qp(r,e),this.Yp(r,e),{column:e,el:r,sortEl:s,filterBtn:a,selectAllEl:o}}$p(e,t){let i=t.colDef;Jn(e,i.headerClass),i.headerTooltip&&e.setAttribute("title",i.headerTooltip);let r=i.headerAlign??i.align;r==="center"?e.classList.add("mach-header-cell--center"):r==="right"&&e.classList.add("mach-header-cell--right")}Kp(e,t){this.e.t.suppressHeaderFocus||(e.tabIndex=-1,e.addEventListener("mousedown",()=>this.Rs(t)),e.addEventListener("keydown",i=>this.Xp(i,t)))}Up(e,t){if(!t.hasCheckbox||this.e.t.rowSelection!=="multiple")return;let i=p("input","mach-select-all");return i.type="checkbox",i.setAttribute("aria-label","select all rows"),i.addEventListener("click",r=>r.stopPropagation()),i.addEventListener("change",()=>{i.checked?this.e.f.selectAll(!0):this.e.f.deselectAll()}),e.appendChild(i),i}jp(e,t){let i=t.colDef,r;try{r=i.headerComponent?.({colDef:i,column:t,api:this.e.api})}catch(s){this.e.reportError(s,"headerComponent",{colId:t.id}),r=null}r instanceof HTMLElement&&(r={el:r});let o=p("span","mach-header-label");!t.sortable&&!t.movable&&(o.style.cursor="default"),r&&typeof r=="object"&&r.el instanceof HTMLElement?(o.classList.add("mach-header-label--custom"),o.appendChild(r.el),Xe(e,r.destroy)):o.textContent=typeof r=="string"?r:i.headerName??i.field??t.id,e.appendChild(o)}dd(e,t){return`${e.colDef.headerName??e.colDef.field??e.id} \xB7 ${this.e.u(t)}`}ld(e,t,i){let r=p("button",i?"mach-filter-btn":"mach-menu-btn");return r.type="button",r.setAttribute("aria-haspopup","dialog"),r.setAttribute("aria-expanded","false"),i||(r.title=this.dd(t,"columnSettings"),r.setAttribute("aria-label",r.title)),r.innerHTML=i?Cr:xr,r.addEventListener("click",o=>{o.stopPropagation(),(i?this.e.Es:this.e.columnMenu).toggle(t,r)}),e.appendChild(r),r}qp(e,t){if(!this.ud(t))return;let i=p("div","mach-header-resize");i.setAttribute("aria-hidden","true"),i.addEventListener("pointerdown",r=>{r.button===0&&(r.preventDefault(),r.stopPropagation(),this.e.cr.Sc(r,t))}),i.addEventListener("dblclick",r=>{r.stopPropagation(),this.e.api.columns.autoSize(t.id)}),i.addEventListener("click",r=>r.stopPropagation()),e.appendChild(i)}Yp(e,t){e.addEventListener("click",i=>{this.e.Mn.Gc()||nr(i.target)||t.sortable&&this.e.Mr(t,i.shiftKey)}),e.addEventListener("pointerdown",i=>{i.button!==0||nr(i.target)||this.e.Mn.Pc(i,t)})}zp(e){let t=p("div","mach-header-cell mach-header-cell--group");e.groupId&&(t.dataset.groupId=e.groupId),t.setAttribute("role","columnheader"),Jn(t,e.def.headerClass);let i=p("span","mach-header-label mach-header-label--group");return i.textContent=e.headerName,t.appendChild(i),t}pt(){let e={left:0,center:0,right:0};for(let t of C){let i=this.e.n.nr[t],r=0,o=new Map;for(let a of this.e.r.x(t))o.set(a.id,r),r+=a.currentWidth;let s=this.e.t.headerHeight;for(let a of this.Y){if(this.e.r.ge(a.column)!==t)continue;let l=o.get(a.column.id)??0;a.el.style.width=`${a.column.currentWidth}px`,a.el.style.left=`${l}px`,a.el.setAttribute("aria-colindex",String(this.e.r.J(a.column.id)+1))}for(let a of this.xs){if(a.pane!==t)continue;let l=a.group.getLeafColumns().filter(c=>!c.hide&&this.e.r.ge(c)===t);if(l.length===0)continue;let d=o.get(l[0].id)??0,u=0;for(let c of l)u+=c.currentWidth;a.el.style.left=`${d}px`,a.el.style.width=`${u}px`,a.el.style.height=`${s}px`,a.el.setAttribute("aria-colspan",String(l.length))}for(let a of i)a.style.width=`${r}px`;e[t]=r}this.e.n.Oh(e.left,e.right)}Xp(e,t){this.e.o()||this.Jp(e,t)||this.Zp(e,t)||this.Qp(e,t)||this.ef(e,t)||this.tf(e)}Jp(e,t){return e.key!=="Enter"&&e.key!==" "?!1:(nr(e.target)||(e.preventDefault(),t.sortable&&this.e.Mr(t,e.shiftKey)),!0)}Zp(e,t){if(!e.altKey||!or(e.key))return!1;if(!this.ud(t))return!0;let i=e.key==="ArrowRight"?24:-24;return this.e.r.Ee(t,t.currentWidth+i),this.e.ti(),this.e.lt([t]),e.preventDefault(),!0}Qp(e,t){if(!e.ctrlKey||!or(e.key))return!1;if(!t.movable)return!0;e.preventDefault();let i=this.e.r.ge(t),r=this.e.r.x(i),o=r.indexOf(t),s=e.key==="ArrowRight"?1:-1,a=Math.max(0,Math.min(r.length-1,o+s));return a!==o&&this.e.Di(t.id,a),!0}ef(e,t){if(e.altKey||e.ctrlKey||e.metaKey||!or(e.key))return!1;e.preventDefault();let i=this.e.r.l(),r=i.indexOf(t);if(r<0)return!0;let o=e.key==="ArrowRight"?1:-1,s=Math.max(0,Math.min(i.length-1,r+o));return this.Rs(i[s]),!0}tf(e){if(e.key!=="Home"&&e.key!=="End")return!1;e.preventDefault();let t=this.e.r.l();if(t.length===0)return!0;let i=e.key==="Home"?0:t.length-1;return this.Rs(t[i]),!0}Rs(e){let t=this.Y.find(i=>i.column.id===e.id);if(!t&&!e.pinned&&(this.En(e),this.ad(),t=this.Y.find(i=>i.column.id===e.id)),!!t){for(let i of this.Y)i.el.tabIndex=i===t?0:-1;t.el.focus({preventScroll:!0})}}En(e){this.L.En(this.e.n.b.center,this.e.r.x("center"),e)}ud(e){return this.e.t.enableColumnResize&&e.resizable}Cs(){let e=this.e.r.Q();for(let t of this.Y){let i=e.findIndex(r=>r.colId===t.column.id);if(i>=0){let r=e[i].direction;t.sortEl.innerHTML=t.column.sortable?(r==="asc"?Tr:Dr)+(e.length>1?`<span class="mach-sort-badge">${i+1}</span>`:""):"",t.el.setAttribute("aria-sort",r==="asc"?"ascending":"descending"),t.el.classList.add("mach-header-cell--sorted")}else t.sortEl.innerHTML="",t.el.removeAttribute("aria-sort"),t.el.classList.remove("mach-header-cell--sorted")}}Ts(){let e=this.e.i.Be();for(let t of this.Y){if(!t.filterBtn)continue;let i=e[t.column.id]!=null;t.filterBtn.classList.toggle("mach-filter-btn--active",i),t.filterBtn.title=this.dd(t.column,i?"columnFilterActive":"columnFilter"),t.filterBtn.setAttribute("aria-label",t.filterBtn.title)}}_r(){for(let e of this.Y){if(!e.selectAllEl)continue;let{all:t,some:i}=this.e.f.Dc();e.selectAllEl.checked=t,e.selectAllEl.indeterminate=i}}destroy(){this.hi(!0)}hi(e){for(let t of this.Y){let i=Je(t.el);if(i)try{i()}catch(r){e?console.error("[mach-table] headerComponent destroy error",r):this.e.reportError(r,"headerComponent.destroy",{colId:t.column.id})}}this.Y=[],this.xs=[]}};var Zt=class{constructor(){this.he=null;this.qe=null;this.pi=!1;this.Ss=-1;this.Ms=-1}rf(){return this.he}Is(){return this.qe}nf(){return this.he!=null}start(e,t){(!t||!this.he)&&(this.he={...e}),this.qe={...e},this.Yt()}of(e){return this.he?!0:e.colIdx<0?!1:(this.he={...e},this.Yt(),!0)}setEnd(e){this.qe={...e},this.Yt()}clear(){this.he=null,this.qe=null,this.Yt()}Yt(){this.pi=!1,this.Ss=-1,this.Ms=-1}normalize(e,t){return this.pi!==!1&&this.Ss===e&&this.Ms===t?this.pi:(this.Ss=e,this.Ms=t,!this.he||!this.qe||e<=0||t<=0?(this.pi=null,null):(this.pi={r1:Math.max(0,Math.min(this.he.row,this.qe.row,e-1)),r2:Math.max(0,Math.min(Math.max(this.he.row,this.qe.row),e-1)),c1:Math.max(0,Math.min(this.he.colIdx,this.qe.colIdx,t-1)),c2:Math.max(0,Math.min(Math.max(this.he.colIdx,this.qe.colIdx),t-1))},this.pi))}};var Qt=class{constructor(e){this.host=e;this.Le=null;this.se=0;this.In=0;this.Bi=e=>{let t=this.Le;if(!(!t||e.pointerId!==t.pointerId)){if(t.clientX=e.clientX,t.clientY=e.clientY,!t.active){if(Math.abs(e.clientY-t.startY)<5)return;t.active=!0,this.host.root.classList.add("mach-root--row-dragging"),this.host.root.querySelectorAll(".mach-row").forEach(i=>i.classList.toggle("mach-row--drag-source",this.sourceContains(i.dataset.id??"")))}this.cd()}};this.lf=()=>{if(this.se=0,!!this.Le?.active){if(!this.current()){this.destroy();return}this._i(),this.df()&&this.cd()}};this.ii=e=>{let t=this.Le;if(!(!t||e.pointerId!==t.pointerId)){t.clientX=e.clientX,t.clientY=e.clientY,t.active&&this.current()&&this._i(),this.hd();try{t.active&&t.drop?.valid&&this.As(e.clientX,e.clientY)&&this.current()&&this.commitDrop(t.drop)}finally{this.release()}}};this.Lo=e=>{e.key==="Escape"&&(e.preventDefault(),this.destroy())};this.jr=e=>{e.type==="pointercancel"&&e.pointerId!==this.Le?.pointerId||this.destroy()}}begin(e){let t=this.host.containers.map(r=>{let o=p("div","mach-row-drop-indicator");return o.hidden=!0,r.append(o),o}),i=p("div","mach-row-drag-preview");i.setAttribute("role","status"),i.hidden=!0,this.host.root.append(i),this.Le={startY:e.clientY,clientX:e.clientX,clientY:e.clientY,pointerId:e.pointerId,indicators:t,preview:i,drop:null,active:!1},this.Wi(!0)}Wi(e){R(window,e,{pointermove:this.Bi,pointerup:this.ii,pointercancel:this.jr,keydown:this.Lo,blur:this.jr})}sf(e){return this.Le?.active===!0&&this.sourceContains(e)}af(e,t=()=>!0){this.In=requestAnimationFrame(()=>{this.In=0,t()&&[...this.host.root.querySelectorAll(".mach-row-drag-handle")].find(i=>i.closest(".mach-row")?.dataset.id===e)?.focus()})}cd(){this.se||(this.se=requestAnimationFrame(this.lf))}As(e,t,i=0){let r=this.host.body.getBoundingClientRect();return e>=r.left&&e<=r.right&&t>=r.top-i&&t<=r.bottom+i}df(){let e=this.Le;if(!e||!this.As(e.clientX,e.clientY,28))return!1;let t=this.host.viewport,i=t.getBoundingClientRect(),r=Math.min(36,i.height/3);if(r<=0)return!1;let o=e.clientY<i.top+r?-Math.ceil(14*T((i.top+r-e.clientY)/r,0,1)):Math.ceil(14*T((e.clientY-i.bottom+r)/r,0,1));if(this.host.scrollBy)return this.host.scrollBy(o);let s=t.scrollTop;return t.scrollTop=T(s+o,0,Math.max(0,t.scrollHeight-t.clientHeight)),t.scrollTop!==s}_i(){let e=this.Le;if(!e?.active)return;let t=e.clientY-this.host.viewport.getBoundingClientRect().top+this.host.viewport.scrollTop,i=this.describe(t);e.drop=i;let r=this.As(e.clientX,e.clientY);for(let s of e.indicators){if(s.hidden=!r||!i?.valid,!i)continue;s.dataset.dropPosition=i.position??"",s.style.cssText=i.style??"";let a=parseFloat(s.parentElement.style.height),l=Math.min(this.host.getRowTop(i.boundary),Number.isFinite(a)?Math.max(0,a-2):1/0);s.style.transform=`translate3d(0, ${l}px, 0)`}let o=this.host.root.getBoundingClientRect();e.preview.hidden=!1,e.preview.textContent=r?i?.text??this.outsideText():this.outsideText(),e.preview.style.transform=`translate3d(${T(e.clientX-o.left+16,8,Math.max(8,o.width-224))}px, ${T(e.clientY-o.top+16,8,Math.max(8,o.height-48))}px, 0)`}hd(){let e=this.Le;this.Le=null,this.Wi(!1),cancelAnimationFrame(this.se),this.se=0,this.host.root?.classList.remove("mach-root--row-dragging"),this.host.root?.querySelectorAll(".mach-row--drag-source").forEach(t=>t.classList.remove("mach-row--drag-source")),e?.indicators.forEach(t=>t.remove()),e?.preview.remove()}destroy(){this.hd(),this.release(),cancelAnimationFrame(this.In),this.In=0}};function Zn(n,e,t,i,r){let o=i==="before"?-1:1,s=t.rowIndex+o,a=e(s);for(;a&&(a===n||a.isDetail);)s+=o,a=e(s);let l=a&&!a.loading?a.id:null;return{rowIds:[n.id],targetId:t.id,position:i,beforeId:i==="before"?l:t.id,afterId:i==="before"?t.id:l,expectedRevision:r}}var ei=class extends Qt{constructor(t,i,r,o){super({get root(){return t.n.root},get body(){return t.n.ye},get viewport(){return t.n.b.center},get containers(){return Object.values(t.n.ce)},getRowTop:i,findRowAt:r,scrollBy:o});this.e=t;this.Ot=null}fd(t){return!t.loading&&!t.treeLoading&&!t.isGroup}md(t){if(this.e.a.isEditing()||t.isDetail||!this.fd(t)||t.data==null||this.e.r.Je().length||this.e.t.applyRowDrag&&!this.e.i.ja())return!1;let i=this.fi("canDrag",()=>this.e.t.rowDragPolicy?.canDrag?.({node:t,api:this.e.api})??!0,!1);return i!==!0?i:!this.e.i.S||!!Ji(this.e.api)}canDrag(t){return this.md(t)===!0}isSource(t){return this.ks()?.isSource(t)??this.sf(t.id)}start(t,i){if(this.destroy(),!this.canDrag(i)||t.isPrimary===!1)return;let r=this.ks();if(r){r.start(t,i);return}let o=this.fi("getRevision",()=>this.Ps(i),null);o&&(this.Ot={node:i,from:i.rowIndex,guard:o},this.begin(t))}moveWithKeyboard(t,i){if(!t.altKey||t.key!=="ArrowUp"&&t.key!=="ArrowDown"||(t.preventDefault(),t.stopPropagation(),!this.canDrag(i)))return;let r=this.ks();if(r){r.moveWithKeyboard(t,i);return}let o=t.key==="ArrowUp"?-1:1,s=i.rowIndex+o;for(;this.e.i.h(s)?.isDetail;)s+=o;let a=this.e.i.h(s),l=this.fi("getRevision",()=>this.Ps(i),null);if(!(!a||!l)){this.Ot={node:i,from:i.rowIndex,guard:l};try{this.commitDrop(this.destination(a,o>0))&&this.af(i.id)}finally{this.release()}}}fi(t,i,r){try{return i()}catch(o){return this.e.reportError(o,`rowDragPolicy.${t}`),r}}Ps(t){let i=this.e.i,r=this.e.r.Z(),o=this.e.t.rowDragPolicy,s=i.Ve(),a=i.ki(),l=this.e.t.applyRowDrag,d=o?.getRevision?.();return{revision:d,current:()=>this.fi("getRevision",()=>o?.getRevision?.()===d&&s===i.Ve()&&a===i.ki()&&i.N(t.id)===t&&r===this.e.r.Z()&&o===this.e.t.rowDragPolicy&&l===this.e.t.applyRowDrag,!1)}}ks(){let t=Ji(this.e.api);return t!==this.pd&&(this.An?.destroy(),this.pd=t,this.An=t?this.fi("driver",()=>t({...this.host,api:this.e.api,capture:i=>this.Ps(i),emit:(i,r,o,s,a)=>{this.e.emit("rowDragEnd",{rowNode:i,fromIndex:r,toIndex:o,targetIndex:s,applied:!1,intent:a})},report:(i,r)=>this.e.reportError(i,`rowDragPolicy.${r}`)}),void 0):void 0),this.An}current(){return this.Ot?.guard.current()??!1}release(){this.Ot=null}sourceContains(t){return this.Ot?.node.id===t}outsideText(){return this.e.u("rowDragOutside")}describe(t){let i=T(this.host.findRowAt(t),0,this.e.i.P()-1),r=this.e.i.h(i);if(r?.isDetail&&(r=this.e.i.N(r.masterId)),!r)return null;let o=this.host.getRowTop(r.rowIndex),s=this.host.getRowTop(r.rowIndex+1);return this.destination(r,t>=(o+s)/2)}destination(t,i){let r=this.Ot,o=t.rowIndex+Number(i);for(;this.e.i.h(o)?.isDetail;)o++;let s=this.e.t.rowDragPolicy,a=!this.e.t.applyRowDrag||s?.canDrop?Zn(r.node,c=>this.e.i.h(c),t,i?"after":"before",r.guard.revision):void 0,l=s?.canDrop&&a?this.fi("canDrop",()=>s.canDrop({node:r.node,api:this.e.api,targetNode:t,intent:a}),!1):!0,d=l===!0&&this.fd(t),u=typeof l=="string"?l:we(this.e.u("rowDragPosition"),r.from+1,this.gd(r.from,o)+1);return{node:t,intent:a,boundary:o,valid:d,text:u,position:i?"after":"before"}}commitDrop(t){let i=this.Ot;if(!i||!this.current()||!this.canDrag(i.node)||!this.current())return!1;let r=this.destination(t.node,t.boundary>t.node.rowIndex);if(!r.valid||!this.current())return!1;let o=r.boundary>i.from?r.boundary-1:r.boundary;for(;this.e.i.h(o)?.isDetail;)o--;if(i.from===o)return!1;let s=this.e.t.applyRowDrag&&this.e.i.qa(i.from,o);return this.e.t.applyRowDrag&&!s?!1:(this.e.emit("rowDragEnd",{rowNode:i.node,fromIndex:i.from,toIndex:r.boundary,targetIndex:s?i.node.rowIndex:this.gd(i.from,r.boundary),applied:s,intent:r.intent}),!0)}gd(t,i){let r=t+1;for(;this.e.i.h(r)?.isDetail;)r++;return i>t?i-(r-t):i}destroy(){this.An?.destroy(),super.destroy()}};var Ca=new Set(["warning","danger","success","info"]);function We(n,e,t=null){if(!(e.data==null||e.isGroup||e.isDetail||e.loading))for(let i of n.t.rowStyleRules)try{if(i.when({data:e.data,node:e,api:n.api,rowPinned:t})===!0)return i}catch(r){n.reportError(r,"rowStyleRules",{rowId:e.id})}}function Se(n,e){n.style.removeProperty("--mach-row-rule-bg"),n.style.removeProperty("--mach-row-rule-fg"),e?.tone&&Ca.has(e.tone)?n.dataset.rowTone=e.tone:delete n.dataset.rowTone,e?.backgroundColor&&n.style.setProperty("--mach-row-rule-bg",e.backgroundColor),e?.color&&n.style.setProperty("--mach-row-rule-fg",e.color),n.classList.toggle("mach-row--styled",!!e)}var ti=class{constructor(){this.oe=new Float64Array(0);this.mi=new Float64Array(1);this.Gs=new WeakMap;this.Ht=new Map;this.ft=0}reset(e,t){this.oe=new Float64Array(e.length),this.mi=new Float64Array(e.length+1),this.Gs=new WeakMap,this.Ht=new Map,this.ft=0;for(let i=0;i<e.length;i++){this.Gs.set(e[i],i);let r=Math.max(1,t(e[i],i));this.oe[i]=r,this.Ls(r,1),this.add(i,r)}}get length(){return this.oe.length}indexOf(e){return this.Gs.get(e)??-1}update(e,t){if(e<0||e>=this.oe.length)return!1;let i=Math.max(1,t),r=i-this.oe[e];return Math.abs(r)<.01?!1:(this.Ls(this.oe[e],-1),this.oe[e]=i,this.Ls(i,1),this.add(e,r),!0)}je(e){let t=Math.max(0,Math.min(Math.trunc(e),this.oe.length)),i=0;for(;t>0;)i+=this.mi[t],t-=t&-t;return i}Ns(){return this.je(this.oe.length)}uf(){return this.ft}findIndex(e){if(this.oe.length===0)return 0;let t=Math.max(0,e),i=0,r=0,o=1;for(;o<<1<=this.oe.length;)o<<=1;for(;o>0;){let s=i+o;s<=this.oe.length&&r+this.mi[s]<=t&&(i=s,r+=this.mi[s]),o>>=1}return Math.min(i,this.oe.length-1)}add(e,t){for(let i=e+1;i<this.mi.length;i+=i&-i)this.mi[i]+=t}Ls(e,t){let i=(this.Ht.get(e)??0)+t;if(i<=0?this.Ht.delete(e):this.Ht.set(e,i),this.Ht.size===0)this.ft=0;else if(t>0&&(this.ft===0||e<this.ft))this.ft=e;else if(t<0&&e===this.ft&&!this.Ht.has(e)){let r=Number.POSITIVE_INFINITY;for(let o of this.Ht.keys())r=Math.min(r,o);this.ft=Number.isFinite(r)?r:0}}};var Ta=16e6,ii=class{constructor(){this.height=0;this.Vt=0;this.gi=0;this.kn=NaN;this.Fs=0}configure(e,t,i=!0){this.height=i?Math.min(e,Ta):e,this.Vt=Math.max(0,e-t),this.gi=Math.max(0,this.height-t),this.kn=NaN}get mt(){return this.Vt>this.gi}cf(e){return this.Vt?T(e,0,this.Vt)*this.gi/this.Vt:0}read(e){return e!==this.kn&&(this.kn=e,this.Fs=this.gi>0?T(e,0,this.gi)*this.Vt/this.gi:0),this.Fs}anchor(e,t){this.Fs=T(e,0,this.Vt),this.kn=t}};function Qn(n){return!!n&&!n.hasCheckbox&&!n.isDetailToggle&&!n.colDef.rowDrag}function Da(n){let e=n.length>1&&n.every(r=>typeof r=="number"&&!Number.isNaN(r)),t=e?(n[n.length-1]-n[0])/(n.length-1):0,i=!e||n.every(r=>Number.isInteger(r));return{difference:t,integer:i,numeric:e,values:n}}function xa(n,e){let t=n.values.length;if(t===1)return n.values[0];if(!n.numeric)return n.values[e%t];let i=n.values[t-1]+n.difference*(e-t+1);return n.integer?Math.round(i):Math.round(i*1e6)/1e6}var ri=class{constructor(e){this.e=e;this.m=[];this.gt=0;this.Ye=-1;this.ie=0;this.Os=0;this.Hs=0;this.yd=0;this.E=new ii;this.yt=0;this.Vs=!1;this.Pn=-1;this.U=new ti;this.L=new Ee;this.pe=new Zt;this.Gn=!1;this.hr=[];this.ht=0;this.Ft=0;this.Bs=!1;this.v=null;this._s=()=>{this.ie||(this.ie=requestAnimationFrame(()=>{this.ie=0,this.Tn()}))};this.Vn=0;this.Bn=new WeakMap;this._t=new Set;this._n="";this.vt=!1;this.pr=[];this.Re=null;this.Td="";this.Ws="";this.Dd=0;this.xd=0;this.zs=e=>{if(e.defaultPrevented||e.ctrlKey||e.metaKey||e.shiftKey||!e.deltaY||!e.cancelable)return;let t=this.e.n.b.center,i=e.deltaMode===1?this.e.t.rowHeight:e.deltaMode===2?t.clientHeight:1,r=this.E.read(t.scrollTop);this.zn(r+e.deltaY*i),this.E.read(t.scrollTop)!==r&&(e.preventDefault(),t.scrollLeft+=e.deltaX*i,this._s())};this.On=null;this.gr=null;this.qs=!1;this.cm=e=>{let t=this.gr;if(!t)return;let i=e;if(typeof i.clientX!="number")return;if(!t.active){let o=Math.abs(i.clientX-t.startX),s=Math.abs(i.clientY-t.startY);if(o<4&&s<4)return;t.active=!0,t.axis=o>=s?"h":"v",this.e.n.root.classList.add("mach-root--filling")}let r=t.axis!=="v";this.Yd(r,r?Math.max(t.c2+1,this.qd(i)):this.jd(i),!0)};this.hm=e=>{let t=this.gr;if(!t)return;let i=e;if(!t.active){this.Fn();return}let r=t.axis==="h",o=r?t.c2:t.r2,s=o;r?s=Math.max(o+1,typeof i.clientX=="number"?this.qd(i):o+1):typeof i.clientY=="number"&&(s=this.jd(i)),this.Fn(),s>o?(this.pm(t,s,r),this.yi()):this.Yd(r,o,!1)};this.pf=e=>{if(this.e.o())return;let t=e.target,i=this.$t(e);if(i&&!t.closest(".mach-cell-editor-shell, .mach-row-editor-shell, .mach-row-drag-handle")&&!(e.detail>1&&this.e.a.Jr())){if(this.e.a.Jr()){let r=i.cellEl?.dataset.colId??"";if(this.e.a.isEditing(i.index,r))return;let o=r?this.e.r.D(r):void 0;this.e.a.pl(i.node,o).then(s=>{if(!s||this.e.o())return;this.Zd(e,t,{...i,index:i.node.rowIndex});let a=r?this.e.r.D(r):void 0;a&&!this.e.a.Jr()&&this.e.a.start(i.node.rowIndex,a)});return}this.Zd(e,t,i)}};this.ff=e=>{if(this.e.o()||e.target.closest(".mach-cell-editor-shell, .mach-row-editor-shell"))return;let t=this.$t(e);if(!t)return;let{node:i,index:r,cellEl:o}=t;if(i.isDetail||i.isGroup||!o)return;let s=o.dataset.colId??"",a=this.e.r.D(s);if(!a)return;let l=this.e.d(i,a),d=this.e.emit("cellDoubleClicked",{event:e,rowNode:i,rowIndex:r,column:a,colDef:a.colDef,value:l});a.colDef.onCellDoubleClick?.(d),this.e.emit("rowDoubleClicked",{event:e,rowNode:i,rowIndex:r}),this.e.a.ae(i,a)&&this.e.a.start(r,a)};this.mf=e=>{if(this.e.o())return;let t=this.$t(e);if(!t||t.node.isDetail||t.node.isGroup||!t.cellEl)return;let{node:i,index:r,cellEl:o}=t,s=o.dataset.colId??"",a=this.e.r.D(s);if(a&&(this.e.emit("cellContextMenu",{event:e,rowNode:i,rowIndex:r,column:a,colDef:a.colDef,value:this.e.d(i,a)}),this.e.t.contextMenu)){if(e.preventDefault(),this.e.t.enableRangeSelection&&!this.De()){let l=this.e.r.J(s);l>=0&&this.js(r,l,!1)}this.e.Ys.open(e.clientX,e.clientY,{rowIndex:r,colId:s})}};this.gf=e=>{if(!this.Dm(e)&&this.e.t.enableRangeSelection&&e.button===0){let t=this.$t(e);if(t&&!t.node.isDetail&&!t.node.isGroup&&t.cellEl&&!t.cellEl.classList.contains("mach-cell--selection")){let i=this.e.r.J(t.cellEl.dataset.colId??"");i>=0&&(this.js(t.index,i,e.shiftKey),this.Gn=!0,!e.shiftKey&&!this.e.t.suppressCellFocus&&this.Ae(t.index,t.cellEl.dataset.colId??""))}}};this.bd=()=>{this.Gn=!1};this.dn=e=>{if(this.e.o())return;let t=this.$t(e);if(this.Gn&&t&&!t.node.isDetail&&!t.node.isGroup&&t.cellEl){let i=this.e.r.J(t.cellEl.dataset.colId??""),r=this.pe.Is();i>=0&&r&&(r.row!==t.index||r.colIdx!==i)&&this.js(t.index,i,!0)}this.e.t.suppressRowHoverHighlight||!t||t.node.isDetail||this.Xd(t.index)};this.yf=()=>{this.Xd(-1)};this.vf=e=>{if(this.e.o()||e.button!==0||!e.target.closest(".mach-row-drag-handle"))return;let i=this.$t(e);!i||i.node.isDetail||i.node.isGroup||(this.Bt.start(e,i.node),e.preventDefault())};this.bf=e=>{if(!e.target.closest(".mach-row-drag-handle"))return;let t=this.$t(e);t&&this.Bt.moveWithKeyboard(e,t.node)};this.Bt=new ei(e,t=>this.Ne(t)-this.yt,t=>this.Nn(t+this.yt,this.e.i.P()),t=>this.hf(t))}init(){let e=this.e.n.b.center;this.Os=e.scrollLeft,this.Hs=e.scrollTop,e.addEventListener("scroll",this._s,{passive:!0}),this.vd(!0),window.addEventListener("mouseup",this.bd)}vd(e){R(this.e.n.ye,e,{click:this.pf,dblclick:this.ff,contextmenu:this.mf,mousedown:this.gf,mouseover:this.dn,mouseleave:this.yf,pointerdown:this.vf,keydown:this.bf})}suspend(){cancelAnimationFrame(this.ie),this.ie=0,this.Fn(),this.Bt.destroy(),this.Gn=!1}destroy(){cancelAnimationFrame(this.ie);let e=this.e.n.b.center;e.removeEventListener("scroll",this._s),e.removeEventListener("wheel",this.zs),this.vd(!1),window.removeEventListener("mouseup",this.bd),this.Fn(),this.Bt.destroy(),this.wd(!1),this.On?.remove(),this.pr=[],this._t.clear(),this.U.reset([],()=>this.e.t.rowHeight),this.L.update([]),this.Re?.remove(),this.Re=null}wf(e){return this.e.r.ge(e)}Tn(e=!1){if(this.e.o())return;let t=this.e.n,i=t.b.center,r=i.scrollLeft,o=i.scrollTop,s=this.E.read(o),a=e||r!==this.Os,l=e||o!==this.Hs||s!==this.yd;!a&&!l||(this.Os=r,this.Hs=o,this.yd=s,a&&(t.ni.center.style.transform=`translate3d(${-r}px, 0, 0)`,this.e.W.ad(),this.e.Ge.Cf(r)),l&&this.Cd(o),this.e.Hn.hide(),this.ur(!1,a),l&&this.e.i.Ou(this.Ye-1))}Dn(){let e=this.e.n;this.L.update(this.e.r.x("center"));let t=this.L.Ds(),i=this.e.i.Et(),r=this.Tf(i.length);this.Df(i,r);let o=this.xf(r);this.Rf(o),this.Ef(t,o),e.root.setAttribute("aria-rowcount",String(r.rowCount+e.jl()))}Tf(e){let t=this.e.i.Ai(),i=this.e.t.rowHeight,r=this.e.t.masterDetail?[]:this.Sf();r.length&&this.Mf();let o=this.e.t.datasourceMode!=="block"&&(this.e.t.masterDetail||this.e.t.getRowHeight!=null||r.length>0),s=o?this.If(i,r):`fixed|${i}`;return{autoHeightColumns:r,positionedCount:Math.min(t,e),rowCount:t,rowHeight:i,signature:s,variable:o}}If(e,t){let i=t.map(r=>`${r.id}:${r.currentWidth}`).join(",");return`${this.e.i.ki()}|${e}|${this.e.t.detailRowHeight}|${i}`}Df(e,t){if(!t.variable){this.Af(t);return}if(t.signature!==this._n||this.U.length!==t.positionedCount){t.autoHeightColumns.some(st)&&this.ot();let i=e.slice(0,t.positionedCount);this.U.reset(i,r=>this.Rd(r,t.autoHeightColumns)),this.Ed(t);return}if(this._t.size!==0){for(let i of this._t){let r=this.U.indexOf(i);r>=0&&this.U.update(r,this.Rd(i,t.autoHeightColumns))}this.Ed(t)}}Af(e){this.U.length>0&&this.U.reset([],()=>e.rowHeight),this._n=e.signature,this._t.clear(),this.Vn=e.rowHeight}Ed(e){this._n=e.signature,this._t.clear(),this.Vn=this.U.uf()||e.rowHeight}xf(e){return(e.variable?this.U.Ns():e.positionedCount*e.rowHeight)+Math.max(0,e.rowCount-e.positionedCount)*e.rowHeight}Ef(e,t){let i=this.e.n,r=i.b.center,o=this.E.read(r.scrollTop),s=this.E.mt;this.E.configure(t,r.clientHeight,!this.vt);let a=Math.max(e,r.clientWidth);for(let l of C){let d=i.ce[l];d.style.height=`${this.E.height}px`,d.style.overflow=this.E.mt?"hidden":"",l==="center"&&(d.style.width=`${a}px`)}(s||this.E.mt)&&this.zn(o),this.Cd(r.scrollTop),this.Vs!==this.E.mt&&(this.Vs=this.E.mt,this.Vs?r.addEventListener("wheel",this.zs,{passive:!1}):r.removeEventListener("wheel",this.zs))}zn(e){let t=this.e.n.b.center;t.scrollTop=this.E.cf(e),this.E.anchor(e,t.scrollTop)}Cd(e){let t=this.E.mt;for(let i of["left","right"]){let r=this.e.n.ce[i].style;r.top=t?`${-e}px`:"",r.transform=t?"":`translate3d(0, ${-e}px, 0)`}}hf(e){let t=this.e.n.b.center,i=this.E.read(t.scrollTop);this.zn(i+e);let r=this.E.read(t.scrollTop)!==i;return r&&this.Tn(),r}Oa(e){this.Bn.delete(e),this._t.add(e)}Rf(e){let{ye:t,b:i,ce:r}=this.e.n,{domLayout:o,maxBodyHeight:s}=this.e.t,a=o==="autoHeight",l=s??1/0,d=i.center,u=Math.min(e,l),c=0;a&&(r.center.style.width=`${this.L.Ds()}px`,d.style.overflowY=e<=l?"hidden":"auto"),t.style.height=a?`${u}px`:"",a&&e<=l&&(c=Math.max(0,d.offsetHeight-d.clientHeight),u=Math.min(e+c,l),t.style.height=`${u}px`),this.vt=a&&u===e+c,d.style.overflowY=a&&!this.vt?"auto":"",this.vt&&d.scrollTop&&(d.scrollTop=0)}ot(){this.Bn=new WeakMap,this._t.clear(),this._n=""}Rd(e,t){if(e.isDetail)return this.e.t.detailRowHeight;let i=this.Bn.get(e);if(i!==void 0)return i;let r=this.e.t.rowHeight,o=this.e.t.getRowHeight;if(o)try{let s=o({data:e.data,node:e,api:this.e.api});r=Number.isFinite(s)?Math.max(1,s||r):r}catch(s){this.e.reportError(s,"getRowHeight",{rowId:e.id})}return t.length>0&&(r=Math.max(r,this.kf(e,t))),this.Bn.set(e,r),r}Ne(e){let t=this.U.length;return t===0?Math.max(0,e)*this.e.t.rowHeight:e<=t?this.U.je(e):this.U.Ns()+(e-t)*this.e.t.rowHeight}Nn(e,t){if(t<=0)return 0;let i=this.U.length,r=this.U.Ns();if(i>0&&e<r)return this.U.findIndex(e);let o=i+Math.floor(Math.max(0,e-r)/this.e.t.rowHeight);return Math.max(0,Math.min(o,t-1))}Sf(){return this.e.r.l().filter(e=>e.colDef.autoHeight===!0)}get Pf(){return this.e.r.l().some(e=>e.colDef.autoHeight===!0)}Mf(){this.Re||(this.Re=p("div","mach-cell mach-cell--wrap",{"aria-hidden":"true"}),this.Re.style.cssText="height:auto;visibility:hidden;pointer-events:none",this.e.n.root.appendChild(this.Re));let e=window.getComputedStyle(this.Re),t=`${e.fontStyle} ${e.fontWeight} ${e.fontSize} ${e.fontFamily}`,i=[t,e.lineHeight,e.letterSpacing,e.wordSpacing,e.padding,e.boxSizing,this.e.Ue.sa].join("|");i!==this.Td&&(this.Td=i,this.ot(),this.Ws=parseFloat(e.letterSpacing)||parseFloat(e.wordSpacing)?"":t,this.Dd=parseFloat(e.paddingLeft)+parseFloat(e.paddingRight)+parseFloat(e.borderLeftWidth)+parseFloat(e.borderRightWidth),this.Re.style.width="10000px",this.Re.textContent="M",this.xd=Math.ceil(this.Re.getBoundingClientRect().height))}kf(e,t){let i=this.Re,r=0;for(let o of t){let s=me(this.e,e,o);if(!s)continue;let a=this.xd;if(!this.Ws||this.e.Ue.ro(s,this.Ws)>o.currentWidth-this.Dd){let l=`${o.currentWidth}px`;i.style.width!==l&&(i.style.width=l),i.textContent!==s&&(i.textContent=s),a=Math.ceil(i.getBoundingClientRect().height),s.length>4096&&(i.textContent="")}r=Math.max(r,a)}return r}Gf(e,t){if(this.e.t.flashCells)for(let i of e)for(let r of t)this.pr.push([i,r])}Sd(){if(this.pr.length===0)return;let e=this.pr;this.pr=[];for(let[t,i]of e){let r=this.At(t,i);if(!r)continue;r.classList.remove("mach-cell--flash"),r.offsetWidth,r.classList.add("mach-cell--flash");let o=Ie(r),s=o.flashTimer;s&&clearTimeout(s),o.flashTimer=window.setTimeout(()=>{r.classList.remove("mach-cell--flash"),o.flashTimer=void 0},800)}}Ie(){this.Dn();let e=this.e.n.b.center,i=this.e.t.rowHeight;this.e.t.masterDetail&&(i=Math.min(i,this.e.t.detailRowHeight)),this.Vn>0&&(i=Math.min(i,this.Vn));let r=Math.ceil(e.clientHeight/Math.max(1,i)),o=this.vt?this.e.i.P():r+this.e.t.rowBuffer*2+1,s=o%2===0?o:o+1;this.Md(),s>this.m.length&&this.Id(s),this.Wn(),this.ur(!0,!1),!this.e.o()&&this.$s()}Id(e){for(;this.m.length<e;){let t={index:-1,nodeId:"",kind:"master",rows:{},cells:{}},i=this.e.n;for(let r of C){if(this.e.r.x(r).length===0)continue;let s=p("div","mach-row");s.style.height=`${this.e.t.rowHeight}px`,s.setAttribute("role","row"),s.style.display="none",i.ce[r].appendChild(s),t.rows[r]=s,t.cells[r]=this.zt(r).map(a=>s.appendChild(this.Ad(a)))}if(this.e.t.masterDetail){let r=p("div","mach-row mach-detail-row");r.style.height=`${this.e.t.detailRowHeight}px`,r.setAttribute("role","row"),r.style.display="none",i.ce.center.appendChild(r),t.detailRow=r}this.m.push(t)}}zt(e){return e==="center"?this.hr:this.e.r.x(e)}Ad(e){let t=p("div","mach-cell");if(t.dataset.colId=e.id,t.setAttribute("role","gridcell"),e.hasCheckbox){let i=p("input","mach-row-checkbox");i.type=this.e.t.rowSelection==="single"?"radio":"checkbox",i.type==="radio"&&(i.name=`mach-radio-${this.e.gridId}`),i.setAttribute("aria-label","select row"),t.appendChild(i),t.classList.add("mach-cell--selection")}return t}Lf(e){let t=new Map(this.hr.map((r,o)=>[r.id,o])),i=e.map(r=>{let o=t.get(r.id);return t.delete(r.id),o});for(let r of this.m){let o=r.rows.center,s=r.cells.center;if(!o||!s)continue;for(let l of t.values()){let d=s[l];r.index>=0&&this.e.a.Zr(r.index,d.dataset.colId??"",d),A(this.e,d),d.remove()}let a=o.firstElementChild;r.cells.center=e.map((l,d)=>{let u=i[d],c=u===void 0?this.Ad(l):s[u];return c!==a&&o.insertBefore(c,a),a=c.nextElementSibling,c})}}kd(){this.fr=void 0,this.Pd(),this.wd(!0),this.gt=0,this.Ye=-1}wd(e){this.Gd(0,e),this.Ln=void 0,this.hr=[]}Gd(e,t){for(let i=e;i<this.m.length;i++){let r=this.m[i];r.detailRow&&this.Ks(r.detailRow);for(let o of C){for(let s of r.cells[o]??[])!t&&r.index>=0&&this.e.a.Zr(r.index,s.dataset.colId??"",s),A(this.e,s);t&&r.rows[o]?.remove()}t&&r.detailRow?.remove()}this.m.length=e}Wn(){let e=this.Nf();for(let t of C){let i=this.zt(t),r=this.Ff(t,i);this.Of(t,i,r,e)}this.Hf()}Nf(){return this.e.t.masterDetail||this.e.t.getRowHeight!=null||this.Pf}Ff(e,t){if(e==="center"){let o=this.e.r.x("left").length;return t.map(s=>this.L.je(this.e.r.J(s.id)-o))}let i=0,r=[];for(let o of t)r.push(i),i+=o.currentWidth;return r}Of(e,t,i,r){for(let o of this.m){let s=o.cells[e],a=o.rows[e];if(!s||!a)continue;r||(a.style.height=`${this.e.t.rowHeight}px`);let l=Math.min(t.length,s.length);for(let d=0;d<l;d++){let u=t[d],c=s[d];c.hasAttribute("aria-colspan")||(c.style.width=`${u.currentWidth}px`),c.style.left=`${i[d]}px`,c.setAttribute("aria-colindex",String(this.e.r.J(u.id)+1))}}}Hf(){if(!this.e.t.masterDetail)return;let e=`${this.e.t.detailRowHeight}px`;for(let t of this.m)t.detailRow?.style.setProperty("--mach-detail-h",e)}Md(){let e=this.e.n.b.center,t=this.e.r.x("center");this.L.update(t);let{first:i,lastExcl:r}=t.length>20?this.L.od(e.scrollLeft,e.clientWidth,2):{first:0,lastExcl:t.length};if(t===this.Ln&&i===this.ht&&r===this.Ft)return!1;let o=t.slice(i,r),s=i>0?t.slice(0,i).filter(a=>a.colDef.colSpan!=null).concat(o):o;return this.m.length>0&&this.Lf(s),this.Ln=t,this.hr=s,this.ht=i,this.Ft=r,this.Bs=s.some(a=>a.colDef.colSpan!=null),!0}bo(){return{first:this.gt,lastExcl:this.Ye}}ur(e=!1,t=!0){let i=this.e.Ce.start(),r=this.Vf(e,t);if(this.e.o()||(this.e.a._o(),!r))return;let o=Math.max(0,this.Ye-this.gt);if(this.m.length>Math.max(32,o*2)){let a=o+o%2+8,l=new Map(this.m.filter(u=>u.index>=0).map(u=>[u.index%a,u])),d=this.m.filter(u=>u.index<0);this.m=Array.from({length:a},(u,c)=>l.get(c)??d.pop()).concat(d),this.Gd(a,!0)}this.yi();let s=this.e.r.x("left").length+this.zt("center").length+this.e.r.x("right").length;this.e.Ce.Ih(i,o,s)}Vf(e,t){let i=this.e.n.b.center,r=this.E.read(i.scrollTop)-i.scrollTop,o=r!==this.yt;this.yt=r;let s=this.e.i.P(),a=this.e.t.rowBuffer,l=t&&this.Md();if(l&&this.Wn(),s===0){for(let c of this.m)this.Ld(c);return this.gt=0,this.Ye=0,!0}let{first:d,lastExcl:u}=this.Bf(i,s,a);return!e&&!l&&d===this.gt&&u===this.Ye?(o&&this.Nd(),o):(this._f(d,u),this.gt=d,this.Ye=u,this.zf(d,u,e,l),l&&this.mr(),o&&this.Nd(),!0)}Bf(e,t,i){if(this.vt)return{first:0,lastExcl:t};let r=this.E.read(e.scrollTop),o=this.Nn(r,t),s=r+e.clientHeight,a=Math.min(t,this.Nn(s,t)+1);return{first:T(o-i,0,t-1),lastExcl:T(a+i,1,t)}}_f(e,t){if(!(this.vt&&this.gt===0&&t>=this.Ye))for(let i of this.m)i.index!==-1&&(i.index<e||i.index>=t)&&this.Ld(i)}zf(e,t,i,r){let o=t-e;o>this.m.length&&(this.Id(o+o%2),this.Wn());for(let s=e;s<t;s++){let a=this.e.i.h(s),l=this.m[s%this.m.length];if(!(!l||!a)){if(!i&&l.index===s&&l.nodeId===a.id){r&&l.kind==="master"&&this.$n(l,a,"center");continue}this.Wf(l,s,a)}}}Ld(e){if(this.Fd(e),this.vt&&e.index>=0)for(let t of C)for(let i of e.cells[t]??[])A(this.e,i);this.v?.rowIndex===e.index&&this.e.n.root.removeAttribute("aria-activedescendant"),e.index=-1,e.nodeId="",e.kind="master";for(let t of C){let i=e.rows[t];i&&(i.style.display="none",delete i.dataset.id,delete i.dataset.index,Se(i,void 0),i.classList.remove("mach-row--drag-source"))}e.detailRow&&(this.Ks(e.detailRow),e.detailRow.style.display="none")}Wf(e,t,i){e.index>=0&&e.index!==t&&this.Fd(e),e.index=t,e.nodeId=i.id;let r=this.Ne(t),o=r-this.yt,s=this.Ne(t+1)-r;if(i.isDetail){this.$f(e,i,t,o,s);return}this.Kf(e,i,t,o,s)}Nd(){for(let e of this.m){if(e.index<this.gt||e.index>=this.Ye)continue;let t=`translateY(${this.Ne(e.index)-this.yt}px)`;for(let i of Object.values(e.rows))i.style.transform=t;e.detailRow&&(e.detailRow.style.transform=t)}}$f(e,t,i,r,o){e.kind="detail";for(let a of C){let l=e.rows[a];l&&(l.style.display="none")}let s=e.detailRow;s&&(this.Od(s,i,r,o),this.Us(s,t))}Kf(e,t,i,r,o){e.kind="master",e.detailRow&&(e.detailRow.style.display="none");let s=this.Uf(t),a=We(this.e,t);for(let l of C){let d=e.rows[l];if(d&&(this.jf(d,t,i,r,o,s),Se(d,a),!this.$n(e,t,l)))return}this.v&&this.v.rowIndex===i&&this.mr()}Uf(e){let t=this.e.i.S,i=e.isGroup===!0,r=t&&this.e.i.To(e.id),o=i||r||this.e.t.masterDetail&&this.e.i.isRowExpandable(e),s=i?this.e.i.isGroupExpanded(e.id):this.e.i.isRowExpanded(e.id),a=null;return i?a=(e.groupLevel??0)+1:t&&(a=this.e.i.$r(e)+1),{expanded:s,expandable:o,level:a}}jf(e,t,i,r,o,s){this.Od(e,i,r,o,t.id),this.Hd(e,t);let a=this.Pn===i&&!this.e.t.suppressRowHoverHighlight;e.classList.toggle("mach-row--hover",a),e.classList.toggle("mach-row--odd",i%2===1),e.classList.toggle("mach-row--drag-source",this.Bt.isSource(t)),this.qf(e,s)}Od(e,t,i,r,o){e.style.display="",e.style.transform=`translateY(${i}px)`,e.style.zIndex=String(-t),e.style.height=`${r}px`,e.dataset.index=String(t),o!==void 0&&(e.dataset.id=o),e.setAttribute("aria-rowindex",String(t+this.e.n.jl()+1))}Hd(e,t){e.classList.toggle("mach-row--selected",t.selected),e.setAttribute("aria-selected",t.selected?"true":"false")}qf(e,t){t.expandable?e.setAttribute("aria-expanded",t.expanded?"true":"false"):e.removeAttribute("aria-expanded"),t.level!=null?e.setAttribute("aria-level",String(t.level)):e.removeAttribute("aria-level")}$n(e,t,i,r,o){let s=this.zt(i),a=e.cells[i];if(!a)return!0;let l=e.index,d=this.e.r,u=i==="center"&&this.Bs,c=u?d.x("left").length:0,h=0;e.rows[i]?.classList.toggle("mach-row--editing",this.e.a.hl(l));for(let f=0;f<s.length;f++){let m=s[f],g=a[f];if(g){if(u){let w=d.J(m.id)-c,y=w<h?0:this.Yf(t,m,l,this.Ln.length-w);if(y>0&&(h=w+y),y===0||h<=this.ht){if(!this.Xf(e,t,m,g,s))return!1;continue}this.Jf(g,w,y)}if(g.style.display==="none"&&(g.style.display=""),g.removeAttribute("aria-hidden"),!this.Vd(g,t,m,l,r,o))return!1}}return!0}Xf(e,t,i,r,o){let s=e.index;return this.e.a.Zr(s,i.id,r)||this.e.o()||this.hr!==o||e.index!==s||this.e.i.h(s)!==t?!1:(A(this.e,r),r.firstChild&&r.replaceChildren(),r.setAttribute("aria-hidden","true"),r.style.display="none",!0)}Yf(e,t,i,r){let o=t.colDef.colSpan;if(!o)return 1;try{let s=o(fe(this.e,e,t,this.e.d(e,t),i));return Math.max(1,Math.min(Math.round(s)||1,r))}catch(s){return this.e.reportError(s,"colSpan",{colId:t.id,rowId:e.id}),1}}Jf(e,t,i){if(i===1&&!e.hasAttribute("aria-colspan"))return;let r=`${this.L.je(t+i)-this.L.je(t)}px`;e.style.width!==r&&(e.style.width=r),i>1?e.setAttribute("aria-colspan",String(i)):e.removeAttribute("aria-colspan")}Us(e,t){this.Ks(e);let i=t.masterId!=null?this.e.i.N(t.masterId):t,r=p("div","mach-detail");e.appendChild(r);let o=this.e.t.detailRowRenderer;if(o){let s={data:t.data,node:i??t,api:this.e.api},a;try{a=o(s)}catch(l){this.e.reportError(l,"detailRowRenderer",{rowId:t.id}),a=null}typeof a=="string"?r.textContent=a:a instanceof HTMLElement?r.appendChild(a):a&&typeof a=="object"&&a.el instanceof HTMLElement&&(r.appendChild(a.el),Xe(e,a.destroy))}}Ks(e){let t=Je(e);if(t)try{t()}catch(i){this.e.reportError(i,"detailRowRenderer.destroy")}e.textContent=""}Vd(e,t,i,r,o,s){if(this.e.a.Xc(r,t,i,e))return!0;if(t.loading){A(this.e,e),e.className="mach-cell mach-cell--loading",e.setAttribute("aria-readonly","true"),e.setAttribute("aria-busy","true");let a=p("span","mach-cell-loading-bar");a.style.width=`${34+(i.id.length*13+t.rowIndex*7)%44}%`,e.replaceChildren(a),this.Wt(e)}else{if(o&&(s==null||s.has(i.id))){let d=t.data;if(A(this.e,e),this.e.o()||t.data!==d||this.e.i.h(t.rowIndex)!==t||this.e.r.D(i.id)!==i||this.At(t.rowIndex,i.id)!==e)return!1}e.removeAttribute("aria-busy");let a=this.e.a.ae(t,i);e.setAttribute("aria-readonly",a?"false":"true"),e.removeAttribute("aria-expanded"),e.removeAttribute("aria-level");let l=this.Zf(t,i);l!=="standard"?(A(this.e,e),this.Qf(l,e,t,i)):(et(this.e,e,t,i),this.Bd(e,t,i),this.em(e,t,i,a))}return this._d(e,r,i),!0}Zf(e,t){return e.isGroup?"group":t.isDetailToggle?"detail":t.hasCheckbox?"checkbox":t.colDef.rowDrag?"drag":ve(t.colDef,"index")?"index":this.e.i.S&&this.zd()?.id===t.id?"tree":"standard"}Qf(e,t,i,r){if(e==="group")this.tm(t,i,r);else if(e==="detail"){let o=this.e.i.isRowExpanded(i.id),s=p("span",`mach-detail-toggle${o?" mach-detail-toggle--open":""}`);s.textContent="\u25B6",t.replaceChildren(s),t.classList.add("mach-cell--detail-toggle"),this.Wt(t)}else if(e==="checkbox")this.Wd(t,i),this.Wt(t);else if(e==="drag")this.im(t,i),t.className!=="mach-cell mach-cell--drag"&&(t.className="mach-cell mach-cell--drag"),this.Wt(t);else if(e==="index"){t.textContent=String(this.e.i.Ua(i)+this.e.t.indexOffset);let o=`mach-cell mach-cell--index ${Qe(r)}`;t.className!==o&&(t.className=o),this.Bd(t,i,r)}else this.rm(t,i,r)}em(e,t,i,r){if(this.e.t.editType!=="cell"||this.e.t.editableIndicator==="none"||!r)return;let o=p("button",`mach-cell-edit-trigger mach-cell-edit-trigger--${this.e.t.editableIndicator}`);o.type="button",o.tabIndex=-1,o.title="Edit cell",o.setAttribute("aria-label","Edit cell"),o.innerHTML=J(Si),o.addEventListener("mousedown",s=>{s.preventDefault(),s.stopPropagation()}),o.addEventListener("click",s=>{s.preventDefault(),s.stopPropagation(),this.Ae(t.rowIndex,i.id),this.e.a.start(t.rowIndex,i)}),e.appendChild(o)}Fd(e){if(!(e.index<0))for(let t of C)for(let i of e.cells[t]??[])this.e.a.Zr(e.index,i.dataset.colId??"",i)}zd(){return this.fr!==void 0?this.fr:(this.fr=this.e.r.l().find(e=>!e.hasCheckbox&&!e.isDetailToggle&&!e.colDef.rowDrag&&!ve(e.colDef,"index"))??null,this.fr)}rm(e,t,i){let r=this.e.i.isRowExpandable(t),o=this.e.i.$r(t),s=Y(this.e,t,i,this.e.d(t,i)),a=p("span","mach-tree-indent");a.style.width=`${o*16}px`;let l=p("span","mach-tree-cell");if(o>0&&l.appendChild(a),r){let u=this.e.i.isRowExpanded(t.id);e.setAttribute("aria-expanded",u?"true":"false"),e.setAttribute("aria-level",String(o+1));let c=t.treeLoading?" mach-detail-toggle--loading":t.treeLoadError?" mach-detail-toggle--error":"",h=p("button","mach-tree-toggle");h.type="button",h.tabIndex=-1,h.setAttribute("aria-label",t.treeLoadError?"Retry loading children":u?"Collapse row":"Expand row"),h.setAttribute("aria-expanded",String(u)),t.treeLoadError&&(h.title="Retry loading children");let f=p("span",`mach-detail-toggle${u?" mach-detail-toggle--open":""}${c}`);f.setAttribute("aria-hidden","true"),f.textContent="\u25B6",h.appendChild(f),h.addEventListener("keydown",m=>{(m.key==="Enter"||m.key===" ")&&m.stopPropagation()}),l.appendChild(h)}else{let u=p("span","mach-tree-toggle-spacer");l.appendChild(u)}let d=p("span","mach-tree-text");d.textContent=s,l.appendChild(d),e.replaceChildren(l),s&&!this.e.t.tooltipComponent?e.title=s:e.removeAttribute("title"),Ci(this.e,e,t,i)}Wt(e){e.style.height!==""&&(e.style.height=""),e.style.display==="none"&&(e.style.display=""),e.removeAttribute("aria-rowspan")}Bd(e,t,i){let r=this.e.i.dc(i.id);if(!r||t.isDetail){this.Wt(e);return}let o=this.e.i.Ua(t)-1;if(o<0||o>=r.length){this.Wt(e);return}let s=r[o];if(s===-1){e.style.display="none",e.setAttribute("aria-hidden","true");return}if(e.style.display==="none"&&(e.style.display=""),e.removeAttribute("aria-hidden"),s>1){let a=Math.min(o+s,this.e.i.P()),l=this.Ne(a)-this.Ne(o);e.style.height=`${l>0?l:s*this.e.t.rowHeight}px`,e.setAttribute("aria-rowspan",String(s))}else this.Wt(e)}tm(e,t,i){if(i.hasCheckbox){this.Wd(e,t);return}if(i.isDetailToggle){this.$d(e);return}let r=this.e.r.ua();if(r&&i.id===r.id){this.nm(e,t);return}this.om(e,t,i)||this.$d(e)}Wd(e,t){let i=e.querySelector(".mach-row-checkbox");if(i){let r=this.e.f,o=t.isGroup?r.Za(t):null;i.checked=o?.all??t.selected,i.indeterminate=o?o.some&&!o.all:r.vc(t.id),i.disabled=!r.ze(t)}e.className!=="mach-cell mach-cell--selection"&&(e.className="mach-cell mach-cell--selection")}nm(e,t){let i=this.e.i.isGroupExpanded(t.id),r=t.groupLevel??0;e.setAttribute("aria-expanded",i?"true":"false"),e.setAttribute("aria-level",String(r+1));let o=p("span","mach-group-label");o.style.paddingLeft=`${r*16}px`;let s=p("span",`mach-detail-toggle${i?" mach-detail-toggle--open":""}`);s.textContent="\u25B6";let a=p("span","mach-group-text"),l=this.e.r.Je()[r],d=l?.colDef.headerName?`${l.colDef.headerName}: `:"";a.textContent=`${d}${t.groupKey??""}`;let u=p("span","mach-group-count");u.textContent=`(${t.leafNodes?.length??0})`,o.append(s,a,u),e.replaceChildren(o),e.className!=="mach-cell mach-cell--group"&&(e.className="mach-cell mach-cell--group")}om(e,t,i){if(!i.colDef.aggFunc||!t.aggValues||!v(t.aggValues,i.id))return!1;let r=t.aggValues[i.id];e.textContent=i.colDef.valueFormatter!=null?Y(this.e,t,i,r):wi(r);let o=`mach-cell ${Qe(i)}`;return e.className!==o&&(e.className=o),!0}$d(e){e.textContent="",e.className!=="mach-cell"&&(e.className="mach-cell")}F(e){if(this.e.o())return;let t=new Set;for(let i of e){if(i<0||t.has(i))continue;t.add(i);let r=this.m[i%this.m.length];if(!r||r.index!==i)continue;let o=this.e.i.h(i);if(o){if(r.kind==="detail"){r.detailRow&&this.Us(r.detailRow,o);continue}for(let s of C){let a=r.rows[s];if(a&&this.Hd(a,o),!!r.cells[s]&&!this.$n(r,o,s))break}}}this.mr(),this.Sd()}refreshCells(e={}){if(this.e.o())return;let t=e.rowIds==null?null:new Set(e.rowIds),i=e.rowIndexes==null?null:new Set(e.rowIndexes),r=e.columns==null?null:new Set(e.columns);for(let o of this.m){let s=this.e.i.h(o.index);!s||!this.sm(o,s,t,i)||this.am(o,s,r,e.force===!0)}this.mr(),this.Sd()}sm(e,t,i,r){return e.index<0?!1:i==null&&r==null?!0:i?.has(t.id)===!0||r?.has(e.index)===!0}am(e,t,i,r){if(e.kind==="detail"){i==null&&e.detailRow&&this.Us(e.detailRow,t);return}let o=i==null||this.Bs,s=We(this.e,t);for(let a of C){let l=e.rows[a];if(l&&Se(l,s),o){if(!this.$n(e,t,a,r,i))return}else if(!this.lm(e,t,a,i,r))return}}lm(e,t,i,r,o){let s=this.zt(i),a=e.cells[i];if(!a)return!0;for(let l=0;l<s.length;l++){let d=s[l];if(!r.has(d.id))continue;let u=a[l];if(u&&!this.Vd(u,t,d,e.index,o))return!1}return!0}dm(){this.e.o()||(this.v&&this.v.rowIndex>=this.e.i.P()&&this.Ae(null,null),this.Pd(),this.Dn(),this.ur(!0),this.$s(),this.e.Pt.refresh())}$s(){let e=this.e.t,t=e.loading?"loading":e.error!=null?"error":this.e.i.P()===0&&!e.suppressNoRowsOverlay?"noRows":null;Yt(this.e,t)}At(e,t){let i=this.e.r.D(t);if(!i)return null;let r=this.wf(i),o=this.zt(r).indexOf(i);if(o<0)return null;let s=this.m[e%this.m.length];return!s||s.index!==e||s.kind!=="master"?null:s.cells[r]?.[o]??null}Pd(){this.pe.Yt()}De(){let e=this.e.i.P(),t=this.e.r.l().length;return this.pe.normalize(e,t)}oi(){let e=this.De();if(e)return e;let t=this.v;if(t){let i=this.e.r.J(t.colId);if(i>=0)return{r1:t.rowIndex,c1:i,r2:t.rowIndex,c2:i}}return null}sr(){let e=this.De();if(!e)return null;let t=this.e.r.l();return{row1:e.r1,row2:e.r2,colId1:t[e.c1]?.id??"",colId2:t[e.c2]?.id??""}}Bo(){let e=this.pe.rf();if(e)return{row:e.row,colIdx:e.colIdx};let t=this.oi();return t?{row:t.r1,colIdx:t.c1}:null}si(){let e=this.De();this.pe.clear(),e&&(this.Kn(),this.yi(),this.e.emit("rangeSelectionChanged",{range:null}))}Kn(){for(let e of this.m)if(!(e.index<0||e.kind!=="master"))for(let t of C){let i=this.zt(t);e.cells[t]?.forEach((r,o)=>{let s=i[o];s&&this._d(r,e.index,s)})}}js(e,t,i){this.pe.start({row:e,colIdx:t},i),this.Kn(),this.yi(),this.e.emit("rangeSelectionChanged",{range:this.sr()})}$c(e,t){if(!this.pe.nf()){let a=this.v;if(!a)return;let l=this.e.r.J(a.colId);if(!this.pe.of({row:a.rowIndex,colIdx:l}))return}let i=this.e.i.P(),r=this.e.r.l().length;this.pe.setEnd({row:Math.max(0,Math.min(e,i-1)),colIdx:Math.max(0,Math.min(t,r-1))}),this.Kn(),this.yi();let o=this.e.r.l(),s=this.pe.Is();s&&s.colIdx<o.length&&this.Ae(s.row,o[s.colIdx].id),this.e.emit("rangeSelectionChanged",{range:this.sr()})}_d(e,t,i){let r=this.De();if(!r){e.classList.contains("mach-cell--range")&&e.classList.remove("mach-cell--range","mach-cell--range-top","mach-cell--range-bottom","mach-cell--range-left","mach-cell--range-right");return}let o=this.e.r.J(i.id);if(o<0)return;let s=t>=r.r1&&t<=r.r2&&o>=r.c1&&o<=r.c2;e.classList.toggle("mach-cell--range",s),s?(e.classList.toggle("mach-cell--range-top",t===r.r1),e.classList.toggle("mach-cell--range-bottom",t===r.r2),e.classList.toggle("mach-cell--range-left",o===r.c1),e.classList.toggle("mach-cell--range-right",o===r.c2)):e.classList.remove("mach-cell--range-top","mach-cell--range-bottom","mach-cell--range-left","mach-cell--range-right")}um(){if(this.On)return this.On;let e=p("div","mach-fill-handle");return e.style.display="none",e.addEventListener("pointerdown",t=>{this.qs=!0,this.Kd(t)}),e.addEventListener("mousedown",t=>{this.qs||this.Kd(t)}),this.e.n.ce.center.appendChild(e),this.On=e,e}yi(){let e=this.um(),t=this.De();if(!this.e.t.enableRangeSelection||!this.e.t.fillHandle||!t){e.style.display="none";return}let i=this.e.r,r=i.x("left").length,o=i.x("center");if(t.c2<r||t.c2>=r+o.length){e.style.display="none";return}let s=t.c2-r;this.L.update(o);let a=this.L.je(s+1),l=this.Ne(Math.min(t.r2+1,this.e.i.P()))-this.yt,d=this.e.n.b.center;if(this.E.mt&&(l<d.scrollTop||l>d.scrollTop+d.clientHeight)){e.style.display="none";return}e.style.display="",e.style.left=`${this.E.mt?Math.min(a-4,parseFloat(this.e.n.ce.center.style.width)-8):a-4}px`,e.style.top=`${Math.min(l-4,this.E.height-8)}px`}Kd(e){if(this.e.o()||e.button!==0)return;let t=this.De();t&&(e.preventDefault(),e.stopPropagation(),this.gr={r1:t.r1,r2:t.r2,c1:t.c1,c2:t.c2,startX:e.clientX,startY:e.clientY,axis:null,active:!1},this.Ud(!0))}jd(e){let i=this.e.n.ce.center.getBoundingClientRect(),r=e.clientY-i.top+this.yt,o=this.e.i.P(),s=this.Nn(r,o);return Math.max(this.gr.r2,Math.min(s,o-1))}qd(e){let i=this.e.n.ce.center.getBoundingClientRect(),r=e.clientX-i.left,o=this.e.r,s=o.x("left").length,a=o.x("center");this.L.update(a);let l=this.L._p(r);if(l<0)return s;let d=this.L.je(l)+a[l].currentWidth/2;return r<d?s+l:l+1<a.length?s+l+1:s+a.length-1}Ud(e){let t=e?"addEventListener":"removeEventListener";for(let i of["pointermove","mousemove"])window[t](i,this.cm);for(let i of["pointerup","mouseup","pointercancel"])window[t](i,this.hm)}Fn(){this.gr=null,this.qs=!1,this.Ud(!1),this.e.n.root.classList.remove("mach-root--filling")}Yd(e,t,i){let r=this.pe.Is();!r||t===(e?r.colIdx:r.row)||(this.pe.setEnd(e?{row:r.row,colIdx:t}:{row:t,colIdx:r.colIdx}),this.Kn(),i&&(e&&this.yi(),this.e.emit("rangeSelectionChanged",{range:this.sr()})))}pm({r1:e,r2:t,c1:i,c2:r},o,s){let a=this.e.r.l(),l=[],d=s?i:e,u=s?r:t,c=s?t:r;for(let h=s?e:i;h<=c;h++){let f=s?this.e.i.h(h):void 0,m=s?void 0:a[h];(s?!f||f.isDetail||f.isGroup:!Qn(m))||this.fm(a,d,u,o,l,f,m)}this.e.ui(l),this.e.emit("rangeSelectionChanged",{range:this.sr()})}fm(e,t,i,r,o,s,a){let l=[];for(let u=t;u<=i;u++){let c=s??this.e.i.h(u),h=a??e[u];l.push(c&&h?this.e.d(c,h):void 0)}if(a&&l.length===1&&l[0]===void 0)return;let d=Da(l);for(let u=i+1;u<=r;u++){let c=s??this.e.i.h(u),h=a??e[u];if(!c||!Qn(h)||!this.e.a.ae(c,h))continue;let f=xa(d,u-t),m=this.e.d(c,h);o.push({node:c,column:h,oldValue:m,newValue:f})}}Ae(e,t){if(this.mm(),e==null||t==null){this.v=null;return}this.v={rowIndex:e,colId:t},this.mr(),this.gm()}mr(){if(!this.v)return;let e=this.At(this.v.rowIndex,this.v.colId);if(e&&e.style.display!=="none"){let t=Math.max(0,this.e.r.J(this.v.colId));e.id=`mach-grid-${this.e.gridId}-r${this.v.rowIndex}-c${t}`,e.classList.add("mach-cell--focus"),this.e.n.root.setAttribute("aria-activedescendant",e.id)}else this.e.n.root.removeAttribute("aria-activedescendant")}mm(){if(this.v){let e=this.At(this.v.rowIndex,this.v.colId);e&&(e.classList.remove("mach-cell--focus"),e.removeAttribute("id"))}this.e.n.root.removeAttribute("aria-activedescendant")}gm(){if(!this.v)return;this.Kr(this.v.rowIndex,"nearest");let e=this.e.r.D(this.v.colId);!e||e.pinned||this.L.En(this.e.n.b.center,this.e.r.x("center"),e)}Kr(e,t="top"){let i=this.e.n.b.center,r=this.e.i.P();if(r===0)return;let o=T(e,0,r-1),s=i.clientHeight,a=this.E.read(i.scrollTop),l=this.Ne(o),d=this.Ne(o+1),u=a;t==="top"?u=l:t==="bottom"?u=d-s:t==="middle"?u=l-(s-(d-l))/2:l<a?u=l:d>a+s&&(u=d-s);let c=Math.max(0,this.Ne(r)-s);this.zn(T(u,0,c)),this.Tn()}Xd(e){if(this.Pn===e)return;let t=this.Pn;this.Pn=e,this.Jd(t,!1),this.Jd(e,!0)}Jd(e,t){if(e<0)return;let i=this.m[e%this.m.length];if(!(!i||i.index!==e||i.kind!=="master"))for(let r of C)i.rows[r]?.classList.toggle("mach-row--hover",t)}yr(){this.e.n.root.focus({preventScroll:!0})}$t(e){let t=e.target,i=t.closest(".mach-row");if(!i)return null;let r=Number(i.dataset.index);if(Number.isNaN(r))return null;let o=this.e.i.h(r);if(!o)return null;let s=t.closest(".mach-cell");return{node:o,index:r,cellEl:s}}Zd(e,t,i){let{node:r,index:o,cellEl:s}=i;if(this.ym(t,r,s)||this.vm(t,r,s))return;let a=s?.dataset.colId??"",l=a?this.e.r.D(a):void 0;this.bm(r,l)||r.isDetail||this.wm(t,r,o,e)||!s||!l||(this.yr(),this.e.t.suppressCellFocus||this.Ae(o,a),this.e.f.tl(r,e,!1),this.Cm(e,r,o,l),this.Tm(r,o,l))}ym(e,t,i){if(!t.isGroup)return!1;if(this.yr(),e.closest(".mach-row-checkbox")){let o=this.e.f.Za(t).all;return this.e.f.wc(t,!o),!0}let r=this.e.r.ua();return(!r||!i||i.dataset.colId===r.id)&&this.e.i.So(t.id),!0}bm(e,t){return!t?.isDetailToggle||e.isDetail?!1:(this.yr(),this.e.Ur(e.id),!0)}wm(e,t,i,r){let o=e.closest(".mach-cell--selection");return o?(this.yr(),this.e.t.suppressCellFocus||this.Ae(i,o.dataset.colId??""),this.si(),this.e.f.tl(t,r,!0),!0):!1}Cm(e,t,i,r){let o=this.e.d(t,r),s=this.e.emit("cellClicked",{event:e,rowNode:t,rowIndex:i,column:r,colDef:r.colDef,value:o});r.colDef.onCellClick?.(s),this.e.emit("rowClicked",{event:e,rowNode:t,rowIndex:i})}Tm(e,t,i){(this.e.t.singleClickEdit||i.colDef.singleClickEdit===!0)&&this.e.a.ae(e,i)&&this.e.a.start(t,i)}vm(e,t,i){if(!this.e.i.S||!e.closest(".mach-tree-toggle"))return!1;let r=this.zd();return!r||i?.dataset.colId!==r.id||!this.e.i.isRowExpandable(t)?!1:(this.yr(),t.treeLoadError?this.e.i.loadTreeChildren(t.id,!0).catch(()=>{}):this.e.i.Ur(t.id),!0)}Dm(e){return!!(e.target.closest(".mach-cell-editor-shell, .mach-row-editor-shell, .mach-tree-toggle, .mach-row-drag-handle")||this.e.a.Jr())}im(e,t){let i=e.querySelector("button.mach-row-drag-handle"),r=i?.value===t.id?i:p("button","mach-row-drag-handle");r.type="button",r.value=t.id;let o=this.Bt.md(t);r.disabled=o!==!0;let s=this.e.u("rowDragHandle");r.setAttribute("aria-label",s),r.title=typeof o=="string"?o:r.disabled?this.e.u("rowDragUnavailable"):s,r.setAttribute("aria-keyshortcuts","Alt+ArrowUp Alt+ArrowDown"),r!==i&&e.replaceChildren(r)}};var ni=class{constructor(e){this.e=e;this.Fe=null;this.Qd={left:void 0,center:void 0,right:void 0};this.Xs={left:[],center:[],right:[]}}init(){this.Fe=p("div","mach-footer"),this.Fe.style.display="none",this.Fe.setAttribute("role","row"),this.e.n.root.appendChild(this.Fe);for(let e of C){let t=p("div",`mach-footer-row mach-footer-row--${e}`);t.style.height=`${this.e.t.rowHeight}px`,this.Fe.appendChild(t),this.Qd[e]=t}}setVisible(e){this.Fe&&(this.Fe.style.display=e?"":"none")}refresh(){if(!this.Fe||this.e.o())return;let e=this.e.t.showSummary;if(this.setVisible(e),!e)return;let t=this.e.t.summaryMethod,i=this.e.i.Et().filter(r=>!r.isDetail&&!r.isGroup);for(let r of C){let o=this.e.r.x(r),s=this.Qd[r];this.Xs[r].length!==o.length&&(s.textContent="",this.Xs[r]=o.map(()=>{let l=p("div","mach-footer-cell");return l.setAttribute("role","cell"),s.appendChild(l),l}));let a=0;o.forEach((l,d)=>{let u=this.Xs[r][d];if(u.style.left=`${a}px`,u.style.width=`${l.currentWidth}px`,a+=l.currentWidth,l.hasCheckbox||l.isDetailToggle||l.colDef.rowDrag){u.textContent="";return}if(t)try{u.textContent=t({colId:l.id,column:l,values:i.map(c=>this.e.d(c,l))})}catch(c){this.e.reportError(c,"summaryMethod",{colId:l.id}),u.textContent=""}else d===0&&r==="left"?u.textContent=z(this.e.u("totalRowsLabel"),i.length):u.textContent=""})}}destroy(){this.Fe?.remove(),this.Fe=null}};var oi=class{constructor(e){this.e=e;this.T=null;this.Un=null;this.Js=null;this.vi=null;this.Kt=null;this.jn=null;this.qn=null;this.Yn=null;this.Xn=null;this.Ut=[]}init(){this.T=p("div","mach-pagination"),this.T.style.display="none",this.T.setAttribute("role","navigation");let e=(t,i,r,o)=>{let s=$(`mach-pagination-btn ${t}`,r,o);return s.title=i,s.setAttribute("aria-label",i),s};this.Un=p("span","mach-pagination-total"),this.jn=e("mach-pagination-first",this.e.u("pageFirst"),"\xAB",()=>this.e.i.setPage(1)),this.qn=e("mach-pagination-prev",this.e.u("pagePrev"),"\u2039",()=>this.e.i.setPage(this.e.i.Zt()-1)),this.Js=p("span","mach-pagination-page"),this.Yn=e("mach-pagination-next",this.e.u("pageNext"),"\u203A",()=>this.e.i.setPage(this.e.i.Zt()+1)),this.Xn=e("mach-pagination-last",this.e.u("pageLast"),"\xBB",()=>this.e.i.setPage(this.e.i.getPageCount())),this.T.append(this.Un,this.jn,this.qn,this.Js,this.Yn,this.Xn),this.e.t.paginationShowSizeSelector&&(this.Kt=ae({ariaLabel:"page size",options:[],classNames:{root:"mach-pagination-size-control",native:"mach-pagination-size"},themeSource:this.e.n.root,onChange:t=>{let i=Number(t);Number.isNaN(i)||this.e.i.setPageSize(i)}}),this.vi=this.Kt.native,this.eu(),this.T.appendChild(this.Kt.el)),this.e.n.root.appendChild(this.T),this.Ut.push(this.e.ue.on("modelUpdated",()=>this.refresh()),this.e.ue.on("paginationChanged",()=>this.refresh())),this.refresh()}eu(){if(!this.vi)return;let e=this.e.t.paginationPageSizeOptions,t=this.e.t.paginationPageSize;e.includes(t)||(e.push(t),e.sort((i,r)=>i-r)),this.Kt?.setOptions(e.map(i=>({value:String(i),label:z(this.e.u("perPage"),i)})),String(t))}xe(){this.T&&(this.vi&&this.e.t.paginationShowSizeSelector&&this.eu(),this.refresh())}tu(e,t){e&&e.textContent!==t&&(e.textContent=t)}xm(e,t){let i=e<=1,r=e>=t;this.jn&&(this.jn.disabled=i),this.qn&&(this.qn.disabled=i),this.Yn&&(this.Yn.disabled=r),this.Xn&&(this.Xn.disabled=r)}refresh(){if(!this.T||this.e.o())return;let e=this.e.i,t=e.Te,i=e.getTotalRowCount(),r=t&&i>0;if(this.T.style.display=r?"":"none",!r)return;let o=e.Zt(),s=e.getPageCount();this.Un&&this.e.t.paginationShowTotal&&this.tu(this.Un,z(this.e.u("paginationTotal"),i)),this.tu(this.Js,we(this.e.u("paginationPage"),o,s)),this.xm(o,s),this.vi&&Number(this.vi.value)!==this.e.t.paginationPageSize&&this.Kt?.setValue(String(this.e.t.paginationPageSize))}destroy(){for(let e of this.Ut)e();this.Ut=[],this.Kt?.destroy(),this.Kt=null,this.vi=null,this.T?.remove(),this.T=null}};var si=class{constructor(e){this.e=e;this.top=null;this.bottom=null}init(){this.top=this.iu(this.e.n.gn),this.bottom=this.iu(this.e.n.yn)}iu(e){let t={root:e,segments:{left:p("div"),center:p("div"),right:p("div")},centerViewport:p("div","mach-pinned-viewport"),rowWrappers:{left:[],center:[],right:[]},cells:[],data:[]};for(let i of C)t.segments[i].className=`mach-pinned-seg mach-pinned-seg--${i}`,i!=="center"&&t.segments[i].classList.add("mach-pane--hidden"),i==="center"&&t.centerViewport.appendChild(t.segments[i]);return e.append(t.segments.left,t.centerViewport,t.segments.right),t}setData(e,t){this.e.o()||!this.top||!this.bottom||(this.top.data=e??[],this.bottom.data=t??[],this.refresh(),this.e.Ie())}setRows(e,t){let i=this[e];this.e.o()||!i||(i.data=t??[],this.Zs(i,e),this.pt(),this.e.Ie())}getRows(e){return this[e]?.data.slice()??[]}xe(){!this.top||!this.bottom||(this.Zs(this.top,"top"),this.Zs(this.bottom,"bottom"))}Zs(e,t){this.hi(e);for(let o of C){for(let s of e.rowWrappers[o])s.remove();e.rowWrappers[o]=[]}if(e.root.style.display=e.data.length>0?"":"none",e.data.length===0)return;let i=this.e.t.rowHeight,r=this.e.r;e.data.forEach((o,s)=>{let a={id:`__pinned_${t}_${s}`,data:o,rowIndex:-1,selected:!1},l={},d=We(this.e,a,t);for(let u of C){let c=p("div","mach-pinned-row");Se(c,d),c.style.height=`${i}px`,c.setAttribute("role","row"),l[u]=[];for(let h of r.x(u)){let f=p("div","mach-cell");if(f.dataset.colId=h.id,f.setAttribute("role","gridcell"),h.hasCheckbox&&f.classList.add("mach-cell--selection"),!h.hasCheckbox&&!h.isDetailToggle&&!h.colDef.rowDrag&&h.colDef.type!=="index")try{et(this.e,f,a,h)}catch(m){this.e.reportError(m,"pinnedRow.render",{colId:h.id,side:t,rowIndex:s})}c.appendChild(f),l[u].push(f)}e.segments[u].appendChild(c),e.rowWrappers[u].push(c)}e.cells.push(l)})}pt(){if(!this.top||!this.bottom)return;let e=this.e.r,t={left:0,center:0,right:0},i={left:[],center:[],right:[]};for(let r of C){let o=0;for(let s of e.x(r))i[r].push(o),o+=s.currentWidth;t[r]=o}for(let r of[this.top,this.bottom]){let o=r.data.length===0;r.segments.left.classList.toggle("mach-pane--hidden",o||t.left<=0),r.segments.right.classList.toggle("mach-pane--hidden",o||t.right<=0),r.segments.left.style.width=`${t.left}px`,r.segments.right.style.width=`${t.right}px`,r.segments.center.style.width=`${t.center}px`,r.cells.forEach(s=>{let a=0;for(let l of C){let d=e.x(l);s[l].forEach((u,c)=>{u.style.width=`${d[c].currentWidth}px`,u.style.left=`${i[l][c]}px`,u.setAttribute("aria-colindex",String(a+c+1))}),a+=d.length}})}}Cf(e){this.top&&(this.top.segments.center.style.transform=`translateX(${-e}px)`),this.bottom&&(this.bottom.segments.center.style.transform=`translateX(${-e}px)`)}refresh(){this.xe(),this.pt()}destroy(){this.top&&this.hi(this.top),this.bottom&&this.hi(this.bottom),this.top=null,this.bottom=null}hi(e){for(let t of e.cells)for(let i of C)for(let r of t[i])A(this.e,r);e.cells=[]}};var ai=class{constructor(e){this.e=e;this.T=null;this.bi={};this.Ut=[]}init(){this.T=p("div","mach-statusbar"),this.T.style.display="none",this.T.setAttribute("role","status"),this.e.n.root.appendChild(this.T),this.xe(),this.Ut.push(this.e.ue.on("modelUpdated",()=>this.refresh()),this.e.ue.on("selectionChanged",()=>this.refresh()),this.e.ue.on("rangeSelectionChanged",()=>this.refresh()),this.e.ue.on("cellValueChanged",()=>this.refresh()))}xe(){if(!this.T)return;this.T.textContent="",this.bi={};let e=this.e.t;if(!e.statusBarEnabled){this.T.style.display="none";return}for(let t of e.statusBarPanels){let i=p("span",`mach-statusbar-item mach-statusbar-item--${t}`);this.T.appendChild(i),this.bi[t]=i}this.refresh()}Qs(e,t){return z(this.e.u(e),t||0)}ea(e,t){let i=this.bi[e];i&&i.textContent!==t&&(i.textContent=t)}Rm(){let e=this.e.i,t=e.Ai(),i=e.Te?e.getTotalRowCount():e.P(),r=z(this.e.u("totalRowsLabel"),i);return e.g&&t>i?`${r} / ${t}`:r}Em(){let e=this.e.s.De();if(!e)return"";let t=this.e.r.l(),i=0,r=0;for(let a=e.r1;a<=e.r2;a++){let l=this.e.i.h(a);if(!(!l||l.isDetail||l.isGroup))for(let d=e.c1;d<=e.c2;d++){let u=t[d];if(!u)continue;let c=this.e.d(l,u);typeof c!="number"||Number.isNaN(c)||(i+=c,r++)}}if(r===0)return"";let o=Math.round(i/r*100)/100,s=Number.isInteger(i)?i:Math.round(i*100)/100;return`${this.Qs("statusSum",s)} \xB7 ${this.Qs("statusAvg",o)} \xB7 ${this.Qs("statusCount",r)}`}refresh(){if(!this.T||this.e.o())return;let e=this.e.t;if(this.T.style.display=e.statusBarEnabled?"":"none",!!e.statusBarEnabled){if(this.bi.rowCount&&this.ea("rowCount",this.Rm()),this.bi.selectedRowCount){let t=this.e.f.Qt().length;this.ea("selectedRowCount",z(this.e.u("statusSelected"),t))}this.bi.rangeAggregate&&this.ea("rangeAggregate",this.Em())}}destroy(){for(let e of this.Ut)e();this.Ut=[],this.T?.remove(),this.T=null}};function sr(){try{return typeof localStorage>"u"?null:localStorage}catch{return null}}function eo(n){return typeof TextEncoder>"u"?n.length*2:new TextEncoder().encode(n).byteLength}function ar(n={}){let e=(n.namespace??"mach-table:grid-state").replace(/:+$/,""),t=Math.max(1024,Math.floor(n.maxBytes??512*1024)),i=o=>`${e}:${o}`,r=(o,s,a)=>{try{n.onError?.(o,s,a)}catch{}};return{storageKey:i,load(o){try{let s=(n.storage??sr())?.getItem(i(o));if(!s)return null;if(eo(s)>t)throw new RangeError(`[MachTable] Stored grid state for "${o}" exceeds ${t} bytes.`);let a=JSON.parse(s);if(a?.schemaVersion!==2)throw new TypeError(`[MachTable] Stored grid state for "${o}" uses an unsupported schema.`);let l=j(a.state);if(!l)throw new TypeError(`[MachTable] Stored grid state for "${o}" is invalid.`);return l}catch(s){return r(s,"load",o),null}},save(o,s){try{let a=j(s);if(!a)throw new TypeError(`[MachTable] Invalid grid state for "${o}".`);let l=JSON.stringify({schemaVersion:2,savedAt:Date.now(),state:a});if(eo(l)>t)throw new RangeError(`[MachTable] Grid state for "${o}" exceeds ${t} bytes.`);(n.storage??sr())?.setItem(i(o),l)}catch(a){r(a,"save",o)}},clear(o){try{(n.storage??sr())?.removeItem(i(o))}catch(s){r(s,"clear",o)}}}}var lr=ar();function li(n,e){lr.save(n,e)}function di(n){return lr.load(n)}function to(n){lr.clear(n)}var $e=class{constructor(e){this.onError=e;this.Jn=new Set;this.disposed=!1}add(e){let t=!0,i=()=>{if(t){t=!1,this.Jn.delete(i);try{e()}catch(r){try{this.onError(r)}catch{}}}};return this.disposed?i():this.Jn.add(i),i}M(e){return this.add(()=>e.destroy()),e}dispose(){if(this.disposed)return;this.disposed=!0;let e=[...this.Jn].reverse();this.Jn.clear();for(let t of e)t()}};function Ra(n){return!!(n.field||n.valueGetter||n.cellRenderer||n.checkboxSelection||n.rowDrag||n.type||n.autoRowSpan||n.rowSpan)}function Ea(n,e,t){n.width!=null&&n.minWidth!=null&&n.width<n.minWidth&&t.push(`\u5217 "${e}" \u7684 width(${n.width}) \u5C0F\u4E8E minWidth(${n.minWidth})\uFF0C\u5C06\u6309 minWidth \u6E32\u67D3`),n.width!=null&&n.maxWidth!=null&&n.width>n.maxWidth&&t.push(`\u5217 "${e}" \u7684 width(${n.width}) \u5927\u4E8E maxWidth(${n.maxWidth})\uFF0C\u5C06\u6309 maxWidth \u6E32\u67D3`)}function Sa(n,e){let t=n.colId??n.field??`col_${e.leafIndex}`;e.seenIds.set(t,(e.seenIds.get(t)??0)+1),n.field&&!nt(n.field)&&e.issues.push(`\u5217 "${t}" \u7684 field \u8DEF\u5F84\u4E0D\u5B89\u5168\u6216\u65E0\u6548\uFF0C\u5DF2\u7981\u6B62\u8BFB\u53D6\u548C\u5199\u5165`),Ra(n)||e.issues.push(`\u5217 "${t}" \u65E2\u65E0 field \u4E5F\u65E0 valueGetter\uFF0C\u5C06\u59CB\u7EC8\u663E\u793A\u7A7A\u503C\uFF08\u7EAF\u5DE5\u5177\u5217\u8BF7\u5FFD\u7565\u6B64\u63D0\u793A\uFF09`),Ea(n,t,e.issues)}function io(n,e){for(let t of n){if(be(t)){!Array.isArray(t.children)||t.children.length===0?e.issues.push(`\u5217\u5206\u7EC4 "${t.headerName??t.groupId??"?"}" \u7684 children \u4E3A\u7A7A`):io(t.children,e);continue}e.leafIndex++,Sa(t,e)}}function ro(n){if(!n||n.length===0)return[];let e={issues:[],seenIds:new Map,leafIndex:0};io(n,e);for(let[t,i]of e.seenIds)i>1&&e.issues.push(`\u5B58\u5728 ${i} \u4E2A\u91CD\u590D\u7684 colId/field "${t}"\uFF0C\u5DF2\u81EA\u52A8\u52A0\u540E\u7F00\u533A\u5206\uFF0C\u5EFA\u8BAE\u663E\u5F0F\u547D\u540D colId`);return e.issues}var no=new Set([...Zi,..._e]),Ma=new Set(["enableColumnResize","pagination","rowKey"]);function Ia(n,e){if(n===e)return 0;if(n.length===0)return e.length;if(e.length===0)return n.length;let t=Array.from({length:e.length+1},(i,r)=>r);for(let i=1;i<=n.length;i++){let r=t[0];t[0]=i;for(let o=1;o<=e.length;o++){let s=t[o];t[o]=Math.min(t[o-1]+1,s+1,r+(n[i-1]===e[o-1]?0:1)),r=s}}return t[e.length]}function Aa(n){let e,t=Math.max(2,Math.floor(n.length*.3))+1,i=n.toLowerCase();for(let r of no){if(Math.abs(i.length-r.length)>=t)continue;let o=Ia(i,r.toLowerCase());o<t&&(t=o,e=r)}return e}function ka(n,e){n.rowKey!=null&&typeof n.rowKey!="string"&&typeof n.rowKey!="function"&&e("INVALID_OPTION_VALUE","rowKey","rowKey \u5FC5\u987B\u662F\u5B57\u6BB5\u8DEF\u5F84\u6216\u8FD4\u56DE\u7A33\u5B9A\u4E1A\u52A1\u4E3B\u952E\u7684\u51FD\u6570"),n.domLayout==="autoHeight"&&n.datasource!=null&&e("OPTION_CONFLICT","domLayout","autoHeight \u4F1A\u6E32\u67D3\u5168\u90E8\u5DF2\u52A0\u8F7D\u884C\uFF0C\u4E0D\u9002\u7528\u4E8E datasource \u65E0\u9650\u6EDA\u52A8\u6A21\u5F0F"),Pa(n,e),n.enableColumnResize!=null&&typeof n.enableColumnResize!="boolean"&&e("INVALID_OPTION_VALUE","enableColumnResize","enableColumnResize \u5FC5\u987B\u662F boolean\uFF1B\u672A\u914D\u7F6E\u65F6\u9ED8\u8BA4\u5173\u95ED")}function Pa(n,e){n.datasourceMode==="block"&&(n.datasource==null&&e("OPTION_CONFLICT","datasourceMode","datasourceMode='block' requires a datasource"),typeof n.getRowHeight=="function"&&e("OPTION_CONFLICT","getRowHeight","Random-access block rows require fixed rowHeight so unloaded offsets remain deterministic"),n.masterDetail===!0&&e("OPTION_CONFLICT","masterDetail","masterDetail is not supported by the sparse random-access block row model"),n.treeData===!0&&e("OPTION_CONFLICT","treeData","treeData requires the local/tree row model and cannot use random-access blocks"),n.rowKey==null&&e("MISSING_STABLE_ROW_ID","rowKey","Random-access blocks require rowKey to preserve selection and identity after eviction"))}function Ga(n,e){for(let t of Zi)if(!(Ma.has(t)||!v(n,t))&&!Qi(t,n[t])){let i=t==="maxBodyHeight"?"maxBodyHeight \u5FC5\u987B\u662F\u81F3\u5C11 1px \u7684\u6709\u9650\u6570":`${t} \u503C\u7C7B\u578B\u65E0\u6548\uFF0C\u671F\u671B ${Re[t]}`;e("INVALID_OPTION_VALUE",t,i)}}function La(n){let e=[];for(let t of Object.keys(n)){if(no.has(t))continue;let i=Aa(t);e.push({code:"UNKNOWN_OPTION",option:t,...i?{suggestion:i}:{},message:i?`\u672A\u77E5 GridOption "${t}"\uFF0C\u662F\u5426\u60F3\u4F7F\u7528 "${i}"\uFF1F`:`\u672A\u77E5 GridOption "${t}"\uFF0C\u8BE5\u503C\u4E0D\u4F1A\u751F\u6548`})}return e}function Na(n,e,t){if(e.mode!=="server")return;n.rowKey==null&&t("MISSING_STABLE_ROW_ID","rowKey","\u670D\u52A1\u7AEF\u5206\u9875\u5EFA\u8BAE\u63D0\u4F9B\u7A33\u5B9A rowKey\uFF0C\u5426\u5219\u8DE8\u9875\u9009\u62E9\u4E0E\u589E\u91CF\u66F4\u65B0\u65E0\u6CD5\u53EF\u9760\u4FDD\u6301");let i=e.total;i!==void 0&&(typeof i!="number"||!Number.isFinite(i)||i<0)&&t("INVALID_OPTION_VALUE","pagination.total","\u670D\u52A1\u7AEF\u5206\u9875 total \u5FC5\u987B\u662F\u975E\u8D1F\u6709\u9650\u6570")}function Fa(n,e){let t=n.pagination;t!=null&&typeof t!="boolean"&&typeof t!="object"&&e("INVALID_OPTION_VALUE","pagination","pagination \u5FC5\u987B\u662F boolean \u6216\u914D\u7F6E\u5BF9\u8C61"),n.datasource!=null&&t!==void 0&&t!==!1&&e("OPTION_CONFLICT","pagination","datasource \u987A\u5E8F\u65E0\u9650\u6A21\u5F0F\u4E0E pagination \u4E0D\u80FD\u540C\u65F6\u542F\u7528\uFF1B\u666E\u901A\u670D\u52A1\u7AEF\u5206\u9875\u8BF7\u4F7F\u7528 pagination.mode='server'"),t&&typeof t=="object"&&Na(n,t,e)}function ui(n){let e=n,t=La(e),i=(r,o,s)=>{t.push({code:r,option:o,message:s})};return Fa(e,i),e.treeData===!0&&e.masterDetail===!0&&i("OPTION_CONFLICT","masterDetail","treeData \u4E0E masterDetail \u4E0D\u80FD\u540C\u65F6\u542F\u7528\uFF0C\u4E3B\u4ECE\u660E\u7EC6\u5C06\u88AB\u5FFD\u7565"),Ga(e,i),ka(e,i),t}function oo(n){let e=/^v?(\d+)(?:\.(\d+))?(?:\.(\d+))?(?:[-+].*)?$/.exec(n.trim());return e?[Number(e[1]),Number(e[2]??0),Number(e[3]??0)]:null}function dr(n,e){for(let t=0;t<3;t++)if(n[t]!==e[t])return n[t]<e[t]?-1:1;return 0}function Oa(n){return n[0]>0?[n[0]+1,0,0]:n[1]>0?[0,n[1]+1,0]:[0,0,n[2]+1]}function Ha(n,e){if(e==="*"||e.toLowerCase()==="latest")return!0;let t=/^(\^|~|>=|<=|>|<|=)?\s*(.+)$/.exec(e);if(!t)return!1;let i=oo(t[2]);if(!i)return!1;let r=dr(n,i);switch(t[1]??"="){case">=":return r>=0;case"<=":return r<=0;case">":return r>0;case"<":return r<0;case"^":return r>=0&&dr(n,Oa(i))<0;case"~":return r>=0&&dr(n,[i[0],i[1]+1,0])<0;default:return r===0}}function so(n,e){if(!e?.trim())return!0;let t=n?oo(n):null;return t?e.split("||").some(i=>{let r=i.trim().split(/\s+/).filter(Boolean);return r.length>0&&r.every(o=>Ha(t,o))}):!1}function Va(n){return[...new Set((n??[]).map(e=>e.trim()).filter(Boolean))]}function ci(n){let e=new Map;for(let t of n??[]){let i=(typeof t=="string"?t:t?.key??"").trim();if(!i||e.has(i))continue;let r=typeof t=="object"?t.version?.trim():void 0;e.set(i,{key:i,...r?{version:r}:{}})}return[...e.values()]}function hi(n){let e=[],t=new Map;for(let l of n){let d=typeof l?.key=="string"?l.key.trim():"";if(!d){e.push({code:"INVALID_FEATURE_KEY",message:"GridFeature.key must be a non-empty string"});continue}if(t.has(d)){e.push({code:"DUPLICATE_FEATURE",feature:d,message:`Duplicate GridFeature key: ${d}`});continue}t.set(d,l)}let i=new Set;for(let[l,d]of t){for(let u of ci(d.requires)){let c=t.get(u.key);c?so(c.version,u.version)||(i.add(l),e.push({code:"UNSUPPORTED_FEATURE_VERSION",feature:l,dependency:u.key,message:`GridFeature "${l}" requires "${u.key}" ${u.version}, received ${c.version??"unversioned"}`})):(i.add(l),e.push({code:"MISSING_FEATURE_DEPENDENCY",feature:l,dependency:u.key,message:`GridFeature "${l}" requires missing feature "${u.key}"`}))}for(let u of Va(d.conflicts))if(t.has(u)){i.add(l),e.push({code:"FEATURE_CONFLICT",feature:l,dependency:u,message:`GridFeature "${l}" conflicts with "${u}"`});break}}let r=[],o=new Set,s=new Set,a=l=>{if(s.has(l))return!i.has(l);if(o.has(l))return i.add(l),e.push({code:"FEATURE_CYCLE",feature:l,message:`GridFeature dependency cycle includes "${l}"`}),!1;let d=t.get(l);if(!d||i.has(l))return!1;o.add(l);let u=!0;for(let c of ci(d.requires))a(c.key)||(u=!1);return o.delete(l),s.add(l),u?(r.push(d),!0):(i.add(l),!1)};for(let l of t.keys())a(l);return{features:r.filter(l=>!i.has(l.key.trim())),issues:e}}var Ba=new Set(["valueFormatter","cellStyle","cellClass"]),_a=new Set(["selectionChanged","sortChanged","filterChanged","columnMoved","columnVisibilityChanged","paginationChanged","detailToggled"]),za=0,pi=class{constructor(e,t){this.w=!1;this.Sm=0;this.vr=0;this.ru=!1;this.ta="";this.R=new $e(e=>console.error("[mach-table] resource cleanup error",e));this.activeFeatures=new Map;this.lu=0;this.br=0;this.recentErrors=[];this.bt=null;this.du=0;this.wr=null;this.ia=0;this.Cr=null;this.ra=!1;this.na=null;this.gu=null;this.Zn=new Set;let i;this.nu=new Promise(r=>{i=r}),this.ou=i,this.gridId=++za,this.t=Pr(t),this.ue=new rt((r,o)=>{o==="gridError"?console.error("[mach-table] error in gridError listener",r):this.reportError(r,"eventBus.listener",{eventType:o})});try{if(this.rd(t.dataProcessor),this.r=new pt(this),this.i=this.R.M(new Ct(this)),this.f=new Tt(this),this.n=this.R.M(new qt(this)),this.W=this.R.M(new Jt(this)),this.s=this.R.M(new ri(this)),this.cr=this.R.M(new Dt(this)),this.Mn=this.R.M(new xt(this)),this.Xo=this.R.M(new At(this)),this.a=this.R.M(new Gt(this)),this.B=new Lt(this),this.H=new _t(this),this.Ce=this.R.M(new $t),this.di=this.R.M(new Kt(r=>this.Mm(r))),this.Es=this.R.M(new Ft(this)),this.columnMenu=this.R.M(new Ot(this)),this.Ys=this.R.M(new Ht(this)),this.Hn=this.R.M(new Vt(this)),this.xn=this.R.M(new Bt(this)),this.ci=this.R.M(new oi(this)),this.Ge=this.R.M(new si(this)),this.Pt=this.R.M(new ni(this)),this.$i=this.R.M(new ai(this)),this.api=Xn(this),this.Ue=new it(this),this.k=this.R.M(new zt(this)),this.R.add(()=>this.uu()),this.k.init(),this.n.init(e,this.t),this.xn.init(),this.s.init(),this.Xo.init(),this.Hn.init(),this.ci.init(),this.Pt.init(),this.$i.init(),this.Ge.init(),this.i.$a(this.t.paginationPage,this.t.paginationPageSize),this.r.Ti(this.t.columnDefs),this.i.nt(this.t.advancedFilterModel),this.i.Rt(this.t.quickFilterText),this.Rn(),this.cu(this.t.columnDefs),this.vs(t),this.W.Sn(),this.t.datasource?this.i.Vr().catch(()=>{}):this.i.rt(this.t.rowData),this.t.initialState&&this.api.state.apply(this.t.initialState,{emitEvents:!1}),this.ws(),this.Ie(),this.Ge.setData(this.t.pinnedTopRowData,this.t.pinnedBottomRowData),this.nd(this.t.features),this.w)return;this.vr=requestAnimationFrame(()=>{this.vr=0,this.w||this.emit("gridReady",{}),this.hu()})}catch(r){throw this.api&&this.reportError(r,"grid.constructor"),this.destroy(),r}}rd(e){if(e===this.su)return!1;let t=++this.lu,i=typeof e=="function"?e():e;if(this.w||t!==this.lu)return i?.destroy?.(),!1;let r=this.au;return this.su=e,i===this.t.dataProcessor&&r?!1:(this.t.dataProcessor=i,this.au=i?this.R.add(()=>i.destroy?.()):void 0,r?.(),!0)}whenReady(){return this.nu}hu(){this.ru||(this.ru=!0,this.ou(this.api))}yu(e){return this.t.components?.cellRenderers?.[e]??Wr[e]}th(e){return this.t.components?.cellEditors?.[e]}Im(e){return ci(e.requires).map(t=>t.key).find(t=>!this.activeFeatures.has(t))}nd(e){let t=this.br+1;if(this.uu(),this.w||this.br!==t)return;let i=hi(e??[]);for(let r of i.issues)this.reportError(new Error(r.message),"feature.manifest",{code:r.code,...r.feature?{key:r.feature}:{},...r.dependency?{dependency:r.dependency}:{}});for(let r of i.features){if(this.w||this.br!==t)return;let o=r.key.trim(),s=this.Im(r);if(s){this.reportError(new Error(`GridFeature "${o}" dependency "${s}" did not initialise`),"feature.manifest",{code:"FEATURE_DEPENDENCY_SETUP_FAILED",key:o,dependency:s});continue}let a=new $e(u=>this.reportError(u,"feature.cleanup",{key:o})),l=u=>a.add(u),d={api:this.api,root:this.n.root,getOptions:()=>this.t,addEventListener:(u,c)=>l(this.ue.on(u,c)),onCleanup:u=>{l(u)},addManagedDomListener:(u,c,h,f)=>(u.addEventListener(c,h,f),l(()=>u.removeEventListener(c,h,f))),setManagedTimeout:(u,c)=>{let h=setTimeout(()=>{f(),u()},Math.max(0,c)),f=l(()=>clearTimeout(h));return h},createAbortController:()=>{let u=new AbortController;return l(()=>u.abort()),u},reportError:(u,c,h)=>this.reportError(u,`feature.${c}`,h)};try{let u=r.setup(d);if(typeof u=="function"&&l(u),this.w||this.br!==t){this.pu(o,{feature:r,scope:a});return}this.activeFeatures.set(o,{feature:r,scope:a})}catch(u){a.dispose(),this.reportError(u,"feature.setup",{key:o})}}}uu(){this.br++;let e=[...this.activeFeatures.entries()].reverse();this.activeFeatures.clear();for(let[t,i]of e)this.pu(t,i)}pu(e,t){t.scope.dispose();try{t.feature.destroy?.()}catch(i){this.reportError(i,"feature.destroy",{key:e})}}o(){return this.w}suspend(){this._e(),this.api.editing.stop({cancel:!0}),this.Es.close(),this.columnMenu.close(),this.Ys.close(),this.Hn.hide(),this.cr.at(),this.Mn.destroy(),this.s.suspend(),vn(this.n.root),Hr(this.n.root);let e=document.activeElement;e instanceof HTMLElement&&this.n.root.contains(e)&&e.blur()}Jt(){return++this.Sm}d(e,t){let i=t.colDef;if(i.valueGetter)try{return i.valueGetter({api:this.api,colDef:i,column:t,node:e,data:e.data})}catch(r){this.reportError(r,"valueGetter",{colId:t.id,rowId:e.id});return}if(i.field)return _(e.data,i.field)}u(e){return this.t.locale[e]??O[e]}rn(e,t,i,r){let o=t.colDef;if(o.valueSetter)try{return o.valueSetter({oldValue:r,newValue:i,data:e.data,node:e,colDef:o,column:t,api:this.api})}catch(s){return this.reportError(s,"valueSetter",{colId:t.id,rowId:e.id}),!1}return o.field?ge(e.data,o.field,i):!1}qi(e,t,i,r,o){this.s.Oa(e),o!=="rollback"&&this.s.Gf([e.rowIndex],[t.id]),o||this.H.ts({rowId:e.id,colId:t.id,oldValue:i,newValue:r}),this.emit("cellValueChanged",{oldValue:i,newValue:r,rowNode:e,rowIndex:e.rowIndex,column:t,colDef:t.colDef,data:e.data})}ul(e){let i=this.r.l().slice(e.c1,e.c2+1).filter(o=>!o.isAutoRowNumber),r=[];for(let o=e.r1;o<=e.r2;o++){let s=this.i.h(o);r.push(i.map(a=>!s||s.isDetail||s.isGroup?"":Be(this,s,a,"clipboard")))}return Et(r)}Rl(){let e=this.s.oi();return e?He(this.ul(e)):Promise.resolve(!1)}Vo(e){this.w||this.ui(this.fu(e,this.r.l()))}async Hc(e,t){let{s:i,r,i:o}=this,s=this.B.tn(),a=o.ki(),l=i.v,d=i.De(),u=r.l(),c=this.fu(e,u),h=c.map(({node:m})=>m.data);if(!await He(t)||!s()||this.t.suppressClipboard||a!==o.ki()||l!==i.v||d!==i.De())return;let f=r.l();u.slice(e.c1,e.c2+1).some((m,g)=>m!==f[e.c1+g])||c.every(({node:m,column:g,oldValue:w},y)=>m.data===h[y]&&Object.is(this.d(m,g),w))&&this.ui(c)}fu(e,t){let i=[];for(let r=e.r1;r<=e.r2;r++){let o=this.i.h(r);if(!(!o||o.isDetail||o.isGroup))for(let s=e.c1;s<=e.c2;s++){let a=t[s];!a||!X(a)||a.colDef.rowDrag||i.push({node:o,column:a,oldValue:this.d(o,a),newValue:null})}}return i}ui(e){this.B.oh(e)}_e(){this.B?.ih()}cl(e,t,i){if(this.w)return;let r=St(e);if(r.length===0)return;let o=this.r.l(),s=this.i.P(),a=[],l=t;for(let d of r){let u=this.Am(l,s);if(!u)break;this.km(u.node,d,o,i,a),l=u.index+1}this.ui(a)}Am(e,t){for(let i=e;i<t;i++){let r=this.i.h(i);if(r&&!r.isDetail&&!r.isGroup)return{index:i,node:r}}return null}Pm(e,t){let i=t;for(;i<e.length;){let r=e[i];if(X(r)&&!r.colDef.rowDrag)break;i++}return i}km(e,t,i,r,o){let s=r,a=o.length;for(let l of t){if(s=this.Pm(i,s),s>=i.length)return;let d=i[s];if(!this.a.ae(e,d)){s++;continue}let u=this.d(e,d);try{let c=d.colDef.valueParser?he(this,e,d,l,"clipboard",u):Rt(l,typeof u=="number"||d.colDef.cellEditor==="number");o.push({node:e,column:d,oldValue:u,newValue:c})}catch(c){o.splice(a),this.reportError(c,"validate",{rowId:e.id,colId:d.id});return}s++}}wh(){let e=this.s.Bo();if(!e)return Promise.resolve();let t=this.B.tn(),i=this.i.h(e.row),r=this.r.l()[e.colIdx];if(!i||!r)return Promise.resolve();let o=this.d(i,r),s=this.B.Yi([{node:i,column:r,oldValue:o,newValue:o}]);try{if(typeof navigator<"u"&&navigator.clipboard?.readText)return navigator.clipboard.readText().then(a=>{let l=this.s.Bo();a&&t()&&s()&&l?.row===e.row&&l.colIdx===e.colIdx&&this.i.h(e.row)===i&&this.r.l()[e.colIdx]===r&&this.cl(a,e.row,e.colIdx)}).catch(()=>{})}catch{}return Promise.resolve()}emit(e,t,i=!0){let r={type:e,api:this.api,...t};this.ue.emit(e,r);let o="on"+e.charAt(0).toUpperCase()+e.slice(1),s=this.t[o];if(typeof s=="function")try{s(r)}catch(l){e==="gridError"?console.error("[mach-table] error in onGridError",l):this.reportError(l,`eventHandler.${String(o)}`,{eventType:e})}let a=e==="columnResized"&&!!r.finished;return i&&(a||_a.has(e))&&this.Cn(),r}reportError(e,t,i){let r=e instanceof Error?e.message:String(e),o=this.Gm(t,r);this.recentErrors.push({code:o,source:t,message:r,timestamp:Date.now(),...i?{context:i}:{}}),this.recentErrors.length>50&&this.recentErrors.shift(),console.error(`[mach-table] ${o} (${t})`,e),!this.w&&this.emit("gridError",{code:o,error:e,source:t,context:i})}Gm(e,t){return/^(datasource|treeData)/.test(e)?"DATA_SOURCE_ERROR":e==="rowKey"||t.includes("Duplicate row id")?"DATA_INTEGRITY_ERROR":e==="validate"?"VALIDATION_ERROR":e.toLowerCase().includes("renderer")||Ba.has(e)?"RENDERER_ERROR":e.toLowerCase().includes("editor")||e==="editable"?"EDITOR_ERROR":e.startsWith("feature.")?"FEATURE_ERROR":/^(columnState|gridState)\./.test(e)?"STATE_ERROR":/^(eventBus|eventHandler)\./.test(e)?"EVENT_HANDLER_ERROR":"GRID_ERROR"}rp(){return{gridId:this.gridId,version:je,destroyed:this.w,infinite:this.i.g,loading:this.i.Pu()||this.t.loading,rowCount:this.i.Ai(),renderedRowCount:this.n.ye.querySelectorAll(".mach-row[data-index]").length,columnCount:this.r.Z().length,selectedRowCount:this.f.Qt().length,dirtyRowCount:this.k.getDirtyRowIds().length,activeFeatures:[...this.activeFeatures].map(([e,t])=>({key:e,...t.feature.version?{version:t.feature.version}:{}})),performance:this.Ce.snapshot(),updates:this.di.snapshot(),recentErrors:this.recentErrors.map(e=>({...e,...e.context?{context:{...e.context}}:{}}))}}Mr(e,t){this.r.Mr(e,t),this.xi()}xi(){this.W.Cs(),this.emit("sortChanged",{sortModel:this.r.Q()}),this.i.Ro()}sh(e,t){let i=this.i.Be();t?i[e.id]=t:delete i[e.id],this.i.xt(i),this.dr()}dr(){this.W.Ts(),this.bs(),this.i.Ro()}bs(e=!0){this.emit("filterChanged",{filterModel:this.i.Be(),advancedFilterModel:this.i.Pi()},e)}Di(e,t){this.r.Di(e,t)&&(this.lr(),this.emit("columnMoved",{colId:e,toIndex:t}))}Ur(e){return this.i.Ur(e)}ol(e,t){this.emit("columnResized",{colId:e.id,width:e.currentWidth,finished:t})}lt(e){if(!(this.w||e.length===0))for(let t of e){if(this.w)break;this.ol(t,!0)}}ws(e=!1,t=!1){let i=this.ia,r=this.wr,o=this.r.ao().length>0;if(e){if(r==null||!o)return;if(r!==i){this.wr=null,this.Cn();return}}this.wr=null;let s=++this.du,a=this.t.persistence;if(!a)return;let{key:l,store:d,sections:u}=a;if(!o&&(!u||u.some(f=>f==="columns"||f==="sort"||f==="filter"))){this.wr=i;return}let c;try{c=d?d.load(l):di(l)}catch(f){this.reportError(f,"gridState.load");return}let h=(f,m=!1)=>{if(this.w||s!==this.du||i!==this.ia||!f)return;let g=this.Cr;this.Cr=m?"beforeRows":"normal";try{this.api.state.apply(f,{emitEvents:!1,sections:u})}finally{this.Cr=g}};I(c)?Promise.resolve(c).then(h).catch(f=>this.reportError(f,"gridState.load")):h(c,t)}Bp(){return this.Cr==="beforeRows"}Cn(){let e=this.t.persistence;if(!(!e||this.w||this.Cr)&&(this.ia++,this.wr==null)){if(this.bt&&clearTimeout(this.bt),e.debounceMs===0){this.bt=null,this.oa();return}this.bt=setTimeout(()=>{this.bt=null,this.oa()},e.debounceMs)}}oa(){let e=this.t.persistence;if(!e||this.w)return;let{key:t,store:i,sections:r}=e,o=this.api.state.get(),s=r?Pn(o,r):o,a={key:t,...i?{store:i}:{},state:s};if(this.ra){this.na=a;return}this.mu(a)}mu(e){try{let t=e.store?e.store.save(e.key,e.state):li(e.key,e.state);if(!I(t))return;this.ra=!0,Promise.resolve(t).catch(i=>this.reportError(i,"gridState.save")).finally(()=>{this.ra=!1;let i=this.na;this.na=null,i&&this.mu(i)})}catch(t){this.reportError(t,"gridState.save")}}Lh(){let e=p("div","mach-empty mach-empty--error"),t=p("div","mach-empty__title");t.textContent=this.u("requestFailed");let i=p("div","mach-empty__hint");return i.textContent=this.u("requestFailedHint"),e.append(t,i),e}Ph(){let e=p("div","mach-loading"),t=p("div","mach-loading__visual");t.setAttribute("aria-hidden","true");for(let r=0;r<3;r+=1){let o=p("span","mach-loading__row");t.appendChild(o)}let i=p("span","mach-loading__label");return i.textContent=this.u("loading"),e.append(t,i),e}Gh(){let e=p("div","mach-empty");e.innerHTML='<svg class="mach-empty__icon" viewBox="0 0 96 84" aria-hidden="true"><rect stroke-opacity=".3" x="8" y="6" width="76" height="66" rx="9"/><path fill="#8b98ff" opacity=".12" stroke="none" d="M17 6H75Q84 6 84 15V26H8V15Q8 6 17 6Z"/><path stroke="var(--mach-body-fg)" opacity=".06" d="M8 26h76M38 26v46M61 26v46M8 42h76M8 57h76"/><path stroke-width="5" opacity=".5" d="M19 15h12m17 0h7m15 0h7"/><path stroke="var(--mach-body-fg)" opacity=".06" stroke-width="4" d="M19 34h12m14 0h8m15 0h8M19 49h12m14 0h8m15 0h8M19 64h12m14 0h8"/><circle stroke-opacity=".3" cx="72" cy="55" r="19"/><circle cx="70" cy="53" r="9"/><path d="m77 60 6 6m-16-16 6 6m0-6-6 6"/></svg>';let{locale:t,manualFiltering:i}=this.t,r=!i&&!this.i.g&&this.i.Oe().length>0&&this.i.Ni(),o=p("div","mach-empty__title");o.textContent=r?t.noMatchingRows??t.emptyRows??this.u("noMatchingRows"):this.u("emptyRows");let s=p("div","mach-empty__hint");if(s.textContent=this.u("emptyRowsHint"),e.append(o),(!r||t.emptyRowsHint)&&e.append(s),r){let a=p("button","mach-toolbar__select-host");a.type="button",a.textContent=this.u("clearFilters"),a.onclick=()=>{this.i.xt({}),this.i.nt(null),this.i.Rt(null),this.t.quickFilterText=null,this.dr(),this.n.root.focus({preventScroll:!0})},e.append(a)}return e}vs(e){if(!(this.t.suppressWarnings||this.w)){if(e)for(let t of ui({rowKey:this.t.rowKey,...e})){let i=`${t.code}:${t.option??""}:${t.message}`;this.Zn.has(i)||(this.Zn.add(i),console.warn(`[mach-table:${t.code}] ${t.message}`))}this.t.treeData&&this.r.Je().length>0&&console.warn("[mach-table] treeData \u4E0E rowGroup \u4E0D\u652F\u6301\u540C\u65F6\u542F\u7528\uFF0C\u884C\u5206\u7EC4\u5DF2\u88AB\u5FFD\u7565")}}cu(e){if(!(this.t.suppressWarnings||this.w)&&this.gu!==e){this.gu=e;for(let t of ro(e))this.Zn.has(t)||(this.Zn.add(t),console.warn(`[mach-table] ${t}`))}}lr(){this.Ue.Ci=!0,this.di.Hl({columns:!0})}$(e){(e.data||e.cells)&&(this.Ue.Ci=!0),this.di.Hl(e)}Zl(e){return this.di.batch(e)}Mm(e){this.w||(e.columns?this.Lm():(e.header&&this.W.Sn(),e.pool&&this.s.kd(),(e.pool||e.layout)&&this.Ie()),this.Nm(e),e.data&&!e.pool&&!e.columns?this.s.dm():e.cells&&this.s.refreshCells(e.cells===!0?void 0:e.cells),e.pinned&&this.Ge.refresh(),e.summary&&this.Pt.refresh(),e.overlays&&this.s.$s())}Nm(e){if(!(e.data||e.cells)||e.layout||e.columns||e.pool)return;let t=e.data||e.cells===!0?void 0:e.cells;this.Ue.to(t)&&this.ti()}Lm(){this.vs(),this.cu(this.r.ao()),this.s.ot(),this.W.Sn(),this.s.kd(),this.Ie(),this.Ge.xe(),this.emit("displayedColumnsChanged",{})}Ie(){if(this.w)return;let e=this.Ce.start();this.Rn(),this.Ue.to(),this.r.ca(this.n.fs());let t=this.r.l().map(i=>`${i.id}:${i.currentWidth}`).join("|");this.ta&&t!==this.ta&&this.s.ot(),this.ta=t,this.n.root.setAttribute("aria-colcount",String(this.r.l().length)),this.W.pt(),this.s.Ie(),!this.w&&(this.Ge.pt(),this.Pt.refresh(),this.Ce.Ah(e))}Rn(){if(!this.n.root)return;let e=this.t.treeData||this.r.Je().length>0;this.n.root.setAttribute("role",e?"treegrid":"grid"),this.t.rowSelection==="multiple"?this.n.root.setAttribute("aria-multiselectable","true"):this.n.root.removeAttribute("aria-multiselectable"),this.r.l().some(i=>!!i.colDef.editable)?this.n.root.removeAttribute("aria-readonly"):this.n.root.setAttribute("aria-readonly","true")}ti(e=!0){this.w||(this.Ue.to(),this.r.ca(this.n.fs()),e&&this.s.ot(),this.W.pt(),this.s.Dn(),this.s.Wn(),this.s.ur(!0),!this.w&&(this.Ge.pt(),this.Pt.refresh()))}destroy(){if(!this.w){if(this.bt&&(clearTimeout(this.bt),this.bt=null,this.oa()),this.w=!0,this._e(),this.vr&&cancelAnimationFrame(this.vr),this.vr=0,this.api){this.hu();try{this.emit("gridDestroyed",{})}catch(e){console.error("[mach-table] grid destroy event",e)}}this.R.dispose(),this.ue.clear()}}};function ao(n,e={}){if(!n)throw new Error("[mach-table] createGrid requires a container element");if(typeof document>"u")throw new Error("[mach-table] createGrid can only be used in a browser environment");return new pi(n,e).api}function Wa(n){return n.mode==="allMatching"?{mode:"allMatching",excludedKeys:[...n.excludedKeys]}:{mode:"explicit",selectedKeys:[...n.selectedKeys]}}function lo(n,e){if(e.scope!=="filtered"&&e.scope!=="selected")throw new TypeError("[MachTable] Remote export scope must be filtered or selected.");let t=n.state.get();return{version:1,scope:e.scope,columnIds:t.columns.filter(i=>!i.hide).map(i=>i.colId),sortModel:t.sortModel.map(i=>({...i})),filterModel:te(t.filterModel),advancedFilterModel:F(t.advancedFilterModel),quickFilterText:t.quickFilterText,...e.scope==="selected"?{selection:Wa(e.selection??{mode:"explicit",selectedKeys:t.selectedRowIds})}:{}}}var $a={contains:"\u5305\u542B",notContains:"\u4E0D\u5305\u542B",equals:"=",notEquals:"\u2260",startsWith:"\u5F00\u5934",endsWith:"\u7ED3\u5C3E",blank:"\u4E3A\u7A7A",notBlank:"\u975E\u7A7A",lessThan:"<",lessThanOrEqual:"\u2264",greaterThan:">",greaterThanOrEqual:"\u2265",inRange:"\u8303\u56F4"};function uo(n){if(!n)return"";if(n.type==="set")return`\u5DF2\u9009 ${n.values.length} \u9879`;let e=[];for(let i of n.conditions){let r=$a[i.match]??i.match,o=i.value,s="value2"in i?i.value2:void 0;i.match==="blank"||i.match==="notBlank"?e.push(r):i.match==="inRange"&&o!=null?e.push(`${r} ${o}~${s??o}`):o!=null&&String(o)!==""?e.push(`${r} ${o}`):e.push(r)}let t=n.operator==="or"?" \u6216 ":" \u4E14 ";return e.join(t)}function Ka(n){return n.value===!0?"\u662F":n.value===!1?"\u5426":""}function Ua(n){return e=>{if(e.value==null||e.value==="")return"";let t=e.value instanceof Date?e.value.toISOString():String(e.value);return n==="datetime"?t.slice(0,16).replace("T"," "):t.slice(0,10)}}function ja(n){return e=>{if(e.value==null)return"";let t=n.find(i=>i.value===e.value);return t?t.label:String(e.value)}}function qa(n,e){return n.filterable===!1?!1:e==="number"?"number":e==="date"?"date":e==="select"||e==="boolean"?"set":"text"}function Ya(n,e,t){if(e.editable&&(t==="number"||t==="date")&&(n.cellEditor=t),t==="date"){n.valueFormatter=Ua(e.format);return}if(t==="boolean"){n.valueFormatter=Ka;return}if(t!=="select")return;let i=e.options??[];n.valueFormatter=ja(i),e.editable&&(n.cellEditor="select",n.cellEditorParams={options:i})}function co(n){let e=n.type??"string",t={colId:n.field,field:n.field,headerName:n.title??n.field,width:n.width,minWidth:n.minWidth,maxWidth:n.maxWidth,flex:n.flex,pinned:n.pinned??void 0,hide:n.hidden??!1,editable:n.editable??!1,sortable:n.sortable??!0,resizable:n.resizable??!0,filter:qa(n,e),cellClass:n.cellClass};return Ya(t,n,e),t}function ho(n){let e=new Map(n.fields.map(s=>[s.field,s])),t=n.groups??[],i=new Set(t.flatMap(s=>s.fields)),r=new Set,o=[];for(let s of n.fields)r.has(s.field)||i.has(s.field)||(o.push(co(s)),r.add(s.field));for(let s of t){let a=[];for(let l of s.fields){let d=e.get(l);!d||r.has(l)||(a.push(co(d)),r.add(l))}a.length>0&&o.push({groupId:s.groupId,headerName:s.title,children:a})}return o}function P(n){let e=n();return e&&!e.isDestroyed()?e:null}function po(n){let e=()=>n.getApi();return{search(t){P(e)?.filtering.setQuickText(t)},async refresh(){if(n.reload){await n.reload();return}let t=P(e);t&&(t.rows.isRemote()?await t.rows.reload():t.view.refreshCells())},openColumns(t){P(e)?.columns.openWorkbench(t)},setDensity(t){P(e)?.updateOptions({size:t})},selectAll(t=!0){P(e)?.selection.selectAll(t)},clearSelection(){let t=P(e);t?.selection.clear(),t?.selection.clearRange()},resetColumns(){P(e)?.columns.resetState()},resetView(){P(e)?.batch(t=>{t.selection.clear(),t.selection.clearRange(),t.filtering.setModel(null),t.filtering.setAdvancedModel(null),t.sorting.setModel(null),t.pagination.setPage(1),t.columns.resetState()})},undo(){return P(e)?.editing.undo()??!1},redo(){return P(e)?.editing.redo()??!1},canUndo(){return P(e)?.editing.canUndo()??!1},canRedo(){return P(e)?.editing.canRedo()??!1},exportCsv(t="mach-table.csv"){let i=P(e);return i?Ut(t,i.io.exportCsv({prependBOM:!0}),"text/csv;charset=utf-8"):!1},async toggleFullscreen(){if(typeof document>"u")return!1;if(document.fullscreenElement)return await document.exitFullscreen?.(),!1;let i=P(e)?.view.getRoot(),r=n.getFullscreenElement?.()??i?.parentElement??i;return r?.requestFullscreen?(await r.requestFullscreen(),!0):!1}}}function fo(){return{accessor:(n,e={})=>({...e,field:n}),display:n=>({...n}),group:n=>({...n,children:[...n.children]})}}function mo(n){return[...n]}function go(n){if(n==="list")return{rowNumber:!0,columnMenu:!0,enableColumnResize:!0,defaultColDef:{filter:!0}};if(n==="detail")return{rowNumber:!0,domLayout:"autoHeight",maxBodyHeight:330,pagination:!1,columnMenu:!1,enableColumnResize:!1,statusBar:!1,contextMenu:!1,defaultColDef:{sortable:!1,filter:!1,resizable:!1,movable:!1,editable:!1}}}function ur(n,e){return e===void 0?n:typeof e!="object"||e===null||typeof n!="object"||n===null?e:{...n,...e}}function Xa(n,e){return typeof n!="function"?e:typeof e!="function"?n:(...t)=>{let i;try{n(...t)}catch(r){i=r}try{e(...t)}catch(r){i??(i=r)}if(i!==void 0)throw i}}function Ja(n,e){if(!(!n.components&&!e.components))return{cellRenderers:{...n.components?.cellRenderers,...e.components?.cellRenderers},cellEditors:{...n.components?.cellEditors,...e.components?.cellEditors}}}function Za(n,e){if(!n.columnTypes&&!e.columnTypes)return;let t={},i=new Set([...Object.keys(n.columnTypes??{}),...Object.keys(e.columnTypes??{})]);for(let r of i)t[r]={...n.columnTypes?.[r],...e.columnTypes?.[r]};return t}function Qa(n,e,t){for(let i of new Set([...Object.keys(e),...Object.keys(t)])){if(!/^on[A-Z]/.test(i))continue;let r=e[i],o=t[i];typeof r!="function"||typeof o!="function"||(n[i]=Xa(r,o))}}function yo(n,e){let t={...n,...e,features:e.features??n.features};(n.defaultColDef||e.defaultColDef)&&(t.defaultColDef={...n.defaultColDef,...e.defaultColDef}),(n.locale||e.locale)&&(t.locale={...n.locale,...e.locale});let i=Ja(n,e);i&&(t.components=i);let r=Za(n,e);return r&&(t.columnTypes=r),(n.aggFuncs||e.aggFuncs)&&(t.aggFuncs={...n.aggFuncs,...e.aggFuncs}),t.pagination=ur(n.pagination,e.pagination),t.statusBar=ur(n.statusBar,e.statusBar),t.watermark=ur(n.watermark,e.watermark),Qa(t,n,e),t}function cr(...n){return n.reduce((e,t)=>{if(typeof t!="string")return yo(e,t);let i=go(t);if(!i)throw new TypeError(`[MachTable] Unknown built-in preset "${t}". Use "list" or "detail".`);return yo(e,i)},{})}function vo(n={}){return cr({defaultColDef:{sortable:!0,resizable:!0,movable:!0,filter:!0},enableColumnResize:!0,rowSelection:"multiple",columnMenu:!0,contextMenu:!0,enableRangeSelection:!0,fillHandle:!0,statusBar:!0,stripedRows:!0},n)}function bo(n){return n}function wo(n){return n}function Co(n){return n}function mi(n){return n!=null&&n!==""}function el(n){if(!mi(n))return null;let e=typeof n=="number"?n:Number(n);return Number.isFinite(e)?e:null}function fi(n,e){try{return new Intl.NumberFormat(n,e)}catch{return new Intl.NumberFormat(void 0,e)}}function To(n,e){try{return new Intl.DateTimeFormat(n,e)}catch{let t={...e};return delete t.timeZone,new Intl.DateTimeFormat(void 0,t)}}function tl(n){if(!mi(n))return null;let e=n instanceof Date?n:new Date(n);return Number.isFinite(e.getTime())?e:null}function Do(n={}){let e=n.emptyText??"",t=n.invalidText??"\u2014",i=fi(n.locale,{maximumFractionDigits:n.maximumFractionDigits??2}),r=fi(n.locale,{maximumFractionDigits:0}),o=fi(n.locale,{style:"currency",currency:n.currency??"CNY",currencyDisplay:n.currencyDisplay??"symbol",maximumFractionDigits:n.maximumFractionDigits??2}),s=fi(n.locale,{style:"percent",maximumFractionDigits:n.maximumFractionDigits??2}),a=To(n.locale,{year:"numeric",month:"2-digit",day:"2-digit",...n.timeZone?{timeZone:n.timeZone}:{}}),l=To(n.locale,{year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1,...n.timeZone?{timeZone:n.timeZone}:{}}),d=(c,h=1)=>({value:f})=>{if(!mi(f))return e;let m=el(f);return m==null?t:c.format(m*h)},u=c=>({value:h})=>{if(!mi(h))return e;let f=tl(h);return f==null?t:c.format(f)};return Object.freeze({text:{align:"left",filter:"text"},number:{align:"right",filter:"number",cellEditor:"number",valueFormatter:d(i)},integer:{align:"right",filter:"number",cellEditor:"number",valueFormatter:d(r)},money:{align:"right",filter:"number",cellEditor:"number",valueFormatter:d(o)},percent:{align:"right",filter:"number",cellEditor:"number",valueFormatter:d(s)},percentage:{align:"right",filter:"number",cellEditor:"number",valueFormatter:d(s,.01)},date:{align:"center",filter:"date",cellEditor:"date",valueFormatter:u(a)},datetime:{align:"center",filter:"date",valueFormatter:u(l)},boolean:{align:"center",filter:"set",valueFormatter:({value:c})=>c===!0?n.trueText??"\u662F":c===!1?n.falseText??"\u5426":e},status:{filter:"set",cellRenderer:"statusTag"},link:{filter:"text",cellRenderer:"link"}})}function xo(){try{return typeof localStorage>"u"?null:localStorage}catch{return null}}function Ro(n){return typeof TextEncoder>"u"?n.length*2:new TextEncoder().encode(n).byteLength}function Eo(n){if(typeof n!="string")return null;let e=n.trim();return e&&e.length<=256?e:null}function gi(n){if(n==null||typeof n!="object")return null;let e=n;if(e.version!==1)return null;let t=j({version:2,columns:e.columns,sortModel:e.sortModel,filterModel:e.filterModel,advancedFilterModel:e.advancedFilterModel,quickFilterText:e.quickFilterText,pagination:{enabled:!0,page:1,pageSize:e.pageSize},selectedRowIds:[],expandedRowIds:[],expandedGroupIds:[]});return t?{version:1,columns:t.columns,sortModel:t.sortModel,filterModel:t.filterModel,advancedFilterModel:t.advancedFilterModel,quickFilterText:t.quickFilterText,pageSize:t.pagination.pageSize}:null}function Me(n){if(n==null||typeof n!="object")return null;let e=n,t=Eo(e.id),i=typeof e.name=="string"?e.name.trim().slice(0,120):"",r=gi(e.state);if(e.schemaVersion!==1||!t||!i||!r)return null;let o=typeof e.createdAt=="number"&&Number.isFinite(e.createdAt)?e.createdAt:Date.now(),s=typeof e.updatedAt=="number"&&Number.isFinite(e.updatedAt)?e.updatedAt:o;return{schemaVersion:1,id:t,name:i,createdAt:o,updatedAt:s,state:r}}function hr(n){let e=n.state.get();return{version:1,columns:e.columns,sortModel:e.sortModel,filterModel:e.filterModel,advancedFilterModel:e.advancedFilterModel,quickFilterText:e.quickFilterText,pageSize:e.pagination.pageSize}}function pr(n,e,t={}){let i=gi(e);if(!i||n.isDestroyed())return!1;let r=n.state.get();return n.state.apply({...r,columns:i.columns,sortModel:i.sortModel,filterModel:i.filterModel,advancedFilterModel:i.advancedFilterModel,quickFilterText:i.quickFilterText,pagination:{...r.pagination,page:1,pageSize:i.pageSize}},{sections:["columns","sort","filter","pagination"],emitEvents:t.emitEvents}),!0}function fr(n={}){let e=(n.namespace??"mach-table:views").replace(/:+$/,""),t=Math.max(1,Math.floor(n.maxViews??50)),i=Math.max(4096,Math.floor(n.maxBytes??512*1024)),r=l=>`${e}:${encodeURIComponent(l)}`,o=(l,d,u)=>{try{n.onError?.(l,d,u)}catch{}},s=l=>{let d=(n.storage??xo())?.getItem(r(l));if(!d||Ro(d)>i)return[];let u=JSON.parse(d);return u.schemaVersion!==1||!Array.isArray(u.views)?[]:u.views.flatMap(c=>{let h=Me(c);return h?[h]:[]}).slice(0,t)},a=(l,d)=>{let u=JSON.stringify({schemaVersion:1,savedAt:Date.now(),views:d});if(Ro(u)>i)throw new RangeError(`[MachTable] Saved views for "${l}" exceed ${i} bytes.`);let c=n.storage??xo();if(!c)throw new Error("[MachTable] Saved view storage is unavailable.");c.setItem(r(l),u)};return{list(l){try{return s(l)}catch(d){return o(d,"list",l),[]}},save(l,d){try{let u=Me(d);if(!u)throw new TypeError(`[MachTable] Invalid saved view for "${l}".`);let c=s(l).filter(h=>h.id!==u.id);c.unshift(u),a(l,c.slice(0,t))}catch(u){throw o(u,"save",l),u}},remove(l,d){try{a(l,s(l).filter(u=>u.id!==d))}catch(u){throw o(u,"remove",l),u}}}}function il(){try{if(typeof crypto<"u"&&crypto.randomUUID)return crypto.randomUUID()}catch{}return`view-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,10)}`}function So(n,e){let t=e.scope.trim();if(!t||t.length>512)throw new TypeError("[MachTable] Grid view scope must contain between 1 and 512 characters.");let i=e.store??fr(),r=async()=>(await i.list(t)).flatMap(s=>{let a=Me(s);return a?[a]:[]}).sort((s,a)=>a.updatedAt-s.updatedAt);return{list:r,async save(o,s){let a=o.trim().slice(0,120);if(!a)throw new TypeError("[MachTable] Grid view name must be a non-empty string.");let l=Eo(s)??il(),d=(await r()).find(h=>h.id===l),u=Date.now(),c={schemaVersion:1,id:l,name:a,createdAt:d?.createdAt??u,updatedAt:u,state:hr(n)};return await i.save(t,c),c},async apply(o,s){let a=typeof o=="string"?(await r()).find(d=>d.id===o):Me(o),l=typeof o=="string"?o:"provided view";if(!a)throw new Error(`[MachTable] Grid view "${l}" was not found.`);if(!pr(n,a.state,s))throw new Error(`[MachTable] Grid view "${a.id}" could not be applied.`);return a},async remove(o){await i.remove(t,o)}}}var rl=je;0&&(module.exports={BUILTIN_AGG_FUNCS,DEFAULT_LOCALE,EVENT_TYPES,LOCALE_EN,actionsColumn,advancedFilterCondition,advancedFilterGroup,applyGridViewState,buildColDefsFromSchema,captureGridViewState,clearGridState,createActionButtonsRenderer,createAggResolver,createBusinessColumnTypes,createColumnHelper,createEnterprisePreset,createGrid,createGridViewManager,createLocalGridStateStore,createLocalGridViewStore,createMachTableCommands,createMachTablePreset,createProgressBarRenderer,createRemoteExportRequest,createRowActionsRenderer,createStatusTagRenderer,defineColumns,defineGridOptions,defineMachTableConfig,defineMachTablePreset,describeFilter,downloadFile,dragColumn,escapeHtml,formatText,formatTwo,getByPath,indexColumn,isColDefGroup,isSafePath,linkRenderer,loadGridState,matchLocaleKey,normalizeAdvancedFilterModel,normalizeColumnFilter,normalizeFilterModel,normalizeGridState,normalizeGridViewState,normalizeSavedGridView,parseCsv,parseDelimited,parseTsv,resolveGridFeatures,resolveSaveConflict,resolveTagVariant,rowActionsColumn,sanitizeFormulaCell,saveGridState,selectionColumn,setByPath,toTsv,validateGridOptions,version});
|