@agile-team/mach-table 0.40.2 → 0.41.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/dist/adapter.d.cts +2 -2
- package/dist/adapter.d.ts +2 -2
- package/dist/analysis.d.cts +2 -2
- package/dist/analysis.d.ts +2 -2
- package/dist/{colDef-BiwNRXwf.d.cts → colDef-CrzNjIXe.d.cts} +2 -2
- package/dist/{colDef-BiwNRXwf.d.ts → colDef-CrzNjIXe.d.ts} +2 -2
- package/dist/{configuration-ZGE-MtGs.d.ts → configuration-BOLDHb5S.d.ts} +1 -1
- package/dist/{configuration-D57x5Ovu.d.cts → configuration-DUubqwfv.d.cts} +1 -1
- package/dist/import.d.cts +1 -1
- package/dist/import.d.ts +1 -1
- package/dist/index.cjs +3 -3
- package/dist/index.d.cts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +4 -4
- 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.d.cts +1 -1
- package/dist/ordering.d.ts +1 -1
- package/dist/preferences.d.cts +1 -1
- package/dist/preferences.d.ts +1 -1
- package/dist/server-side.d.cts +1 -1
- package/dist/server-side.d.ts +1 -1
- package/dist/{shared-C9SPn-Hh.d.ts → shared-CEihWWC5.d.ts} +1 -1
- package/dist/{shared-TcluaEBe.d.cts → shared-DBW62DHt.d.cts} +1 -1
- package/dist/workbench.d.cts +3 -3
- package/dist/workbench.d.ts +3 -3
- 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 mi=Object.defineProperty;var Co=Object.getOwnPropertyDescriptor;var To=Object.getOwnPropertyNames;var Do=Object.prototype.hasOwnProperty;var xo=(n,e)=>{for(var t in e)mi(n,t,{get:e[t],enumerable:!0})},Ro=(n,e,t,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of To(e))!Do.call(n,r)&&r!==t&&mi(n,r,{get:()=>e[r],enumerable:!(i=Co(e,r))||i.enumerable});return n};var Eo=n=>Ro(mi({},"__esModule",{value:!0}),n);var Qa={};xo(Qa,{BUILTIN_AGG_FUNCS:()=>Fe,DEFAULT_LOCALE:()=>V,EVENT_TYPES:()=>$t,LOCALE_EN:()=>Ar,actionsColumn:()=>Vr,advancedFilterCondition:()=>wr,advancedFilterGroup:()=>Cr,applyGridViewState:()=>lr,buildColDefsFromSchema:()=>ro,captureGridViewState:()=>ar,clearGridState:()=>qn,createActionButtonsRenderer:()=>we,createAggResolver:()=>mt,createBusinessColumnTypes:()=>mo,createColumnHelper:()=>oo,createEnterprisePreset:()=>uo,createGrid:()=>eo,createGridViewManager:()=>bo,createLocalGridStateStore:()=>ir,createLocalGridViewStore:()=>dr,createMachTableCommands:()=>no,createMachTablePreset:()=>sr,createProgressBarRenderer:()=>Si,createRemoteExportRequest:()=>to,createRowActionsRenderer:()=>dt,createStatusTagRenderer:()=>Ei,defineColumns:()=>so,defineGridOptions:()=>ho,defineMachTableConfig:()=>po,defineMachTablePreset:()=>co,describeFilter:()=>qt,downloadFile:()=>Wt,dragColumn:()=>Hr,escapeHtml:()=>ce,formatText:()=>W,formatTwo:()=>ve,getByPath:()=>z,indexColumn:()=>ut,isColDefGroup:()=>ye,isSafePath:()=>et,linkRenderer:()=>Mi,loadGridState:()=>ai,matchLocaleKey:()=>ot,normalizeAdvancedFilterModel:()=>H,normalizeColumnFilter:()=>tt,normalizeFilterModel:()=>Z,normalizeGridState:()=>j,normalizeGridViewState:()=>fi,normalizeSavedGridView:()=>Ee,parseCsv:()=>Et,parseDelimited:()=>St,parseTsv:()=>Rt,resolveGridFeatures:()=>ui,resolveSaveConflict:()=>In,resolveTagVariant:()=>st,rowActionsColumn:()=>Br,sanitizeFormulaCell:()=>le,saveGridState:()=>si,selectionColumn:()=>Or,setByPath:()=>me,toTsv:()=>xt,validateGridOptions:()=>li,version:()=>Za});module.exports=Eo(Qa);var $e="0.40.2";function v(n,e){return Object.prototype.hasOwnProperty.call(n,e)}function x(n,e,t=!1){if(!(typeof n!="number"||!Number.isFinite(n)||n<e))return t?Math.floor(n):n}function E(n,e,t,i=!1){return x(n,t,i)??e}function I(n){return x(n,0)||void 0}function Ke(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 gi=new WeakMap,Ue=new WeakMap;function Me(n){let e=gi.get(n);return e||(e={},gi.set(n,e)),e}function yi(n){return gi.get(n)}function je(n,e){e?Ue.set(n,e):Ue.delete(n)}function qe(n){let e=Ue.get(n);return Ue.delete(n),e}function pe(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 vi(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=yi(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 hr(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 Mo(n,e,t,i,r,o){let s=yi(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 fe(n,e,t){return q(n,e,t,n.d(e,t))}function q(n,e,t,i){let r=t.colDef.valueFormatter;if(r)try{let o=r({api:n.api,colDef:t.colDef,column:t,node:e,data:e.data,value:i});return o==null?"":String(o)}catch(o){n.reportError(o,"valueFormatter",{colId:t.id,rowId:e.id})}return vi(i)}function Io(n,e,t,i){let r=i.colDef.cellStyle,o=Me(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(pe(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 Ao(n,e,t,i){let r=n.d(t,i),o=q(n,t,i,r),s=i.colDef.cellRenderer,a=typeof s=="string"?n.mu(s):s;if(a){let l={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(Mo(n,e,t,i,a,l)){hr(n,e,t,i,r,o);return}L(n,e);let d;try{d=a(l)}catch(u){n.reportError(u,"cellRenderer",{colId:i.id,rowId:t.id}),e.textContent=o;return}if(typeof d=="string")e.textContent=d;else if(d instanceof HTMLElement)e.replaceChildren(d);else if(d&&typeof d=="object"&&d.el instanceof HTMLElement){let u=d;e.replaceChildren(u.el);let c=Me(e);c.destroy=u.destroy,u.refresh&&(c.refresh=h=>u.refresh(h),c.rendererDefinition=a,c.rendererRowId=t.id,c.rendererColumnId=i.id)}else e.textContent=""}else L(n,e),e.textContent=o;hr(n,e,t,i,r,o)}function Ye(n){let{align:e}=n.colDef;return e==="left"?"mach-cell--left":e==="right"?"mach-cell--right":"mach-cell--center"}function ko(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=pe(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 Po(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 bi(n,e,t,i){let r=["mach-cell",Ye(i)];ko(n,r,t,i),Po(r,e,i);let o=r.join(" ");e.className!==o&&(e.className=o)}function Xe(n,e,t,i){Ao(n,e,t,i),bi(n,e,t,i),Io(n,e,t,i)}function Ie(n,e){return n&&v(n,e)?n[e]:void 0}function Je(n,e){if(n==null||n===""||!e||typeof e!="object")return;let t=Ie(e,String(n));return typeof t=="string"?{color:t}:t}function f(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=f("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 C(n,e,t){return n<e?e:n>t?t:n}function J(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=`${C(i.left,8,Math.max(8,window.innerWidth-r.width-8))}px`,n.style.top=`${C(s,8,Math.max(8,window.innerHeight-r.height-8))}px`}var pr=0;function fr(n="rg"){return pr++,`${n}-${pr}`}var mr='<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>',gr='<svg viewBox="0 0 16 16" width="10" height="10" fill="currentColor"><path d="M8 3l4 5H4l4-5z"/></svg>',yr='<svg viewBox="0 0 16 16" width="10" height="10" fill="currentColor"><path d="M8 13l4-5H4l4 5z"/></svg>',vr='<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>';var Ze=class{constructor(e){this.e=e;this.Jn="";this.Zn=[];this.oa=0;this.Ri=!0}Qn(e){this.gu()&&(this.Ri=!0,e=void 0);let t=this.Ri?this.sa():void 0,i=t&&Lo(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,Go(s)){let l=this.aa(s,t);o=l!==s.contentWidth||o,s.contentWidth=l}}return this.Ri=!1,o&&(this.e.r.Je=!1),o}gu(){let e=Array.from(document.fonts??[]).filter(s=>s.status==="loaded"),t=e.length!==this.Zn.length||e.some((s,a)=>s!==this.Zn[a]);t&&(this.Zn=e,this.oa++);let i=getComputedStyle(this.e.n.root),r=`${i.getPropertyValue("--mach-header-font-weight")||650} ${i.fontSize} ${i.fontFamily}`,o=r!==this.Jn||t;return this.Jn=r,o}sa(){let e=this.e.i.He(),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))])}eo(e,t){return this.xi===void 0&&(this.xi=f("canvas").getContext("2d")),this.xi?(this.xi.font=t??this.Jn,this.xi.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.eo(i)+i.length*.15+28+(e.sortable?20:0)+(e.filterable?28:0)+(this.e.t.columnMenu&&!e.hasCheckbox&&!t.suppressColumnMenu?22:0)))}aa(e,t=this.sa()){let i=28;for(let r of t){let o=this.e.d(r,e),s=Je(o,e.colDef.status)?.label??q(this.e,r,e,o);i=Math.max(i,this.eo(s.slice(0,128))+(e.colDef.status?44:28))}return Math.ceil(Math.min(I(e.colDef.maxWidth)??360,i))}};function Go(n){let{width:e,autoWidth:t}=n.colDef;return n.manualWidth==null&&e==null&&t!==!1&&!n.hasCheckbox&&!n.isDetailToggle}function Lo(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 Qe=class{constructor(e){this.vu=e;this.wr=new Map}on(e,t){let i=this.wr.get(e);return i||(i=new Set,this.wr.set(e,i)),i.add(t),()=>{i.delete(t)}}emit(e,t){let i=this.wr.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.wr.clear()}};var No=new Set(["__proto__","prototype","constructor"]),Ae=new Map;function wi(n){if(typeof n!="string"||n.length===0)return null;let e=Ae.get(n);if(e!==void 0)return e;let t=n.split("."),i=t.every(r=>r.length>0&&!No.has(r))?t:null;return n.length<=1024&&(Ae.size>=256&&Ae.delete(Ae.keys().next().value),Ae.set(n,i)),i}function et(n){return wi(n)!==null}function z(n,e){if(n==null)return;let t=wi(e);if(!t)return;let i=n;for(let r of t){if(i==null)return;i=i[r]}return i}function me(n,e,t){if(n==null)return!1;let i=wi(e);if(!i)return!1;let r=n;for(let o=0;o<i.length-1;o++){if(typeof r!="object"&&typeof r!="function"||r===null)return!1;r[i[o]]==null&&(r[i[o]]={}),r=r[i[o]]}return typeof r!="object"&&typeof r!="function"||r===null?!1:(r[i[i.length-1]]=t,!0)}var ge={text:["contains","notContains","equals","notEquals","startsWith","endsWith","blank","notBlank"],number:["equals","notEquals","lessThan","lessThanOrEqual","greaterThan","greaterThanOrEqual","inRange","blank","notBlank"],date:["equals","notEquals","lessThan","greaterThan","inRange","blank","notBlank"]};var Fo=16,Oo=512,Ho=20,Vo=2e3,Bo=2e3,_o={text:new Set(ge.text),number:new Set(ge.number),date:new Set(ge.date)};function zo(n){return n==null||typeof n=="string"||typeof n=="number"&&Number.isFinite(n)}function Wo(n,e,t){if(n==null||typeof n!="object")return null;let i=n;return typeof i.match!="string"||!t.has(i.match)?null:{match:i.match,...$o(i,e)}}function $o(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 Ko(n,e){let t=[],i=_o[e];for(let r of n.slice(0,Ho)){let o=Wo(r,e,i);o&&t.push(o)}return t}function tt(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(zo).slice(0,Vo)}: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:Ko(e.conditions,e.type)}}function Uo(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=tt(n.filter);return i?{kind:"condition",colId:t,filter:i}:null}function jo(n,e,t){if(!Array.isArray(n.children))return null;let i=[];for(let r of n.children){let o=br(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<=Fo&&t.nodes<Oo&&n!=null&&typeof n=="object"}function br(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"?Uo(i,t):i.kind==="group"?jo(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=br(t.root,0,{ancestors:new WeakSet,nodes:0,validColumnIds:e});return i?{version:1,root:i}:null}function wr(n,e){return{kind:"condition",colId:n,filter:e}}function Z(n,e){if(n==null||typeof n!="object"||Array.isArray(n))return{};let t={};for(let[i,r]of Object.entries(n).slice(0,Bo)){let o=i.trim();if(!o||e?.has(o)===!1)continue;let s=tt(r);s&&(t[o]=s)}return t}function Cr(n,e,t={}){return{kind:"group",operator:n,children:e,...t.not?{not:!0}:{}}}var Ci={align:"center",sortable:!0,resizable:!0,movable:!0,filter:!1,minWidth:80},ke={compact:{rowHeight:30,headerHeight:34,fontSize:12,cellPadding:6},normal:{rowHeight:36,headerHeight:40,fontSize:13,cellPadding:9},large:{rowHeight:44,headerHeight:48,fontSize:14,cellPadding:12}},Pe={multiSort:!0,stripedRows:!1,showCellBorders:!1,quickFilterText:null,suppressCellFocus:!1,suppressRowHoverHighlight:!1,suppressNoRowsOverlay:!1,suppressHeaderFocus:!1,loading:!1,error:null,className:"",singleClickEdit:!1,manualSorting:!1,manualFiltering:!1,showSummary:!1,rowNumber:!1,indexOffset:0,applyRowDrag:!0,masterDetail:!1,detailToggleColumn:!0,treeData:!1,childrenKey:"children",autoCheckedChildren:!0,defaultExpandAll:!1,columnMenu:!1,suppressWarnings:!1,enableRangeSelection:!1,suppressClipboard:!1,contextMenu:!1,flashCells:!0,fillHandle:!0,ariaLabel:"MachTable data grid",ariaLabelledBy:"",ariaDescribedBy:"",overlayNoRowsTemplate:"",overlayLoadingTemplate:"",overlayErrorTemplate:"",allowUnsafeOverlayHtml:!1},Yo=Object.keys(Pe);function Xo(n){let e={};for(let t of Yo)e[t]=n[t]??Pe[t];return e}function Jo(n){return n&&v(ke,n)?n:"normal"}function Zo(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 Ti(n,e){let t=typeof n=="function"?n(e):z(e,n);return t==null?"":String(t)}function Qo(n,e){let t=ke[e],i=n.rowKey;return{columnDefs:Array.isArray(n.columnDefs)?n.columnDefs:[],rowData:Array.isArray(n.rowData)?n.rowData:[],defaultColDef:{...Ci,...n.defaultColDef??{}},columnTypes:n.columnTypes??{},...i?{resolveRowId:({data:r})=>Ti(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"?"fit":"normal",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 es(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:Zo(n,t),paginationShowTotal:e?e.showTotal!==!1:!0,paginationShowSizeSelector:e?e.showPageSizeSelector!==!1:!0}}function Di(n){let e=n.watermark==null||n.watermark===!1?null:n.watermark===!0?{text:"MachTable"}:n.watermark;return{watermarkEnabled:e!==null,watermarkConfig:e}}function ts(n){return{advancedFilterModel:H(n.advancedFilterModel),persistence:Ke(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 Dr={blockSize:100,maxBlocksInCache:12,datasourceMaxConcurrentRequests:4},xr={infiniteBufferRows:40,blockPrefetch:1,datasourceRetryCount:2,datasourceRetryDelay:300},is=Object.keys(Dr),rs=Object.keys(xr);function Tr(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 xi(n,e){let t=Tr(n,e,is,1);Tr(n,e,rs,0);let i=x(n.datasourceRetryJitter,0);return i!==void 0&&(e.datasourceRetryJitter=Math.min(1,i)),t}function ns(n){let e={...Dr,...xr,datasourceRetryJitter:.15};return xi(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 os=["detailRowRenderer","isRowExpandable","aggFuncs","components","actionPolicy","summaryMethod","datasource","getRowHeight","tooltipComponent","getContextMenuItems","initialState","rowEditValidator","isTreeRowExpandable","loadTreeChildren","dataProcessor"];function Rr(n){let e=Jo(n.size),t={...Xo(n),...Qo(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),...es(n),...Di(n),...ts(n),...ns(n),features:Array.isArray(n.features)?n.features:[]};for(let i of os)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 Er(n){return Array.isArray(n)?n.filter(e=>typeof e=="string"&&e.length>0):typeof n=="string"&&n.length>0?[n]:[]}function Ge(n,e){return Er(n.type).includes(e)}function Sr(n,e,t={}){let i={};for(let o of Er(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 Q=class{constructor(e,t){this.manualWidth=null;this.contentWidth=null;this.flex=null;this.currentWidth=0;this.parentGroup=null;this.level=0;this.isDetailToggle=!1;this.id=e,this.colDef=t,this.hide=t.hide??!1;let i=t.pinned;this.pinned=i===!0?"left":i===!1||i==null?null:i,this.resetWidth()}get sortable(){return this.colDef.sortable!==!1}get resizable(){return this.colDef.resizable!==!1}get movable(){return this.colDef.movable!==!1}get filterable(){return this.colDef.filter!=null&&this.colDef.filter!==!1}get filterType(){let e=this.colDef.filter;return e===!0?"text":e??"text"}get hasCheckbox(){return this.colDef.checkboxSelection===!0}resetWidth(){this.manualWidth=null,this.contentWidth=null,this.flex=I(this.colDef.flex)??null}};function Y(n){return!n.hasCheckbox&&!n.isDetailToggle&&!n.isAutoRowNumber}function it(n){return n.colDef.autoHeight===!0&&!!(n.colDef.valueGetter||n.colDef.valueFormatter)}var ee=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 ye(n){return Array.isArray(n.children)}var rt=150,ss=80;function se(n,e){let t=I(e.minWidth)??ss,i=I(e.maxWidth)??Number.MAX_SAFE_INTEGER,r=I(n)??I(e.width)??rt;return Math.max(t,Math.min(i,r))}function as(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]=se(l+t*i[a]/o,n[a]),s+=e[a]-l,e[a]!==l}),Math.abs(s)<1e-4)break;t-=s}}function Mr(n,e,t){let i=n.map(o=>se(o.width??rt,o)),r=e-i.reduce((o,s)=>o+s,0);return(t?Number.isFinite(e)&&e>0:r>0)&&as(n,i,r,t?[...i]:n.map(o=>o.flex??0)),i}function Ir(n,e){return Mr(n,e,!1)}function nt(n,e){return Mr(n,e,!0)}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"},Ar={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"},ls={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 ot(n){return ls[n]??"matchEquals"}function W(n,e){return n.replace("{n}",String(e))}function ve(n,e,t){return n.replace("{a}",String(e)).replace("{b}",String(t))}var ds=[[/^(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 st(n,e,t){let i=String(n??"");if(e){let r=Ie(e,i);if(r)return r;let o=Ie(e,i.toLowerCase());if(o)return o}for(let[r,o]of ds)if(r.test(i))return o;return t==null?"neutral":st(t)}function Ei(n={}){return e=>{if(e.value==null||e.value==="")return"";let t=String(e.value),i=Je(t,e.colDef.status),r=i?.label??Ie(n.labelMap,t)??(e.formatted||t),o=i?.color,s=st(o??t,o?void 0:n.variantMap,r),a=f("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 Si(n={}){return e=>{let t=Number(e.value);if(isNaN(t))return e.formatted;let i=Math.max(0,Math.min(100,t)),r=f("div","mach-progress"),o=f("div","mach-progress__track"),s=f("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=f("span","mach-progress__label");a.textContent=`${Math.round(i)}${n.unit??"%"}`,r.appendChild(a)}return r}}function Mi(n){if(n.value==null||n.value==="")return"";let e=f("span","mach-link");return e.textContent=n.formatted||String(n.value),e}var Ii={edit:'<path d="M11.5 2.5l2 2L5 13H3v-2l8.5-8.5z"/>',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:'<path d="M3.5 3.5l9 9m0-9l-9 9"/>',check:'<path d="M2.5 8.5l3.5 3.5 7.5-8"/>',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 at(n,e=14){let t=Ii[n]??"";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">${t}</svg>`}var ie=null,B=null;function kr(n){B&&n.contains(B)&&X()}function X(n=!1){ie?.remove(),ie=null,B&&(B.setAttribute("aria-expanded","false"),n&&B.isConnected&&B.focus({preventScroll:!0})),B=null,document.removeEventListener("mousedown",Pr,!0),document.removeEventListener("keydown",Ai,!0)}function Pr(n){ie&&!ie.contains(n.target)&&!B?.contains(n.target)&&X()}function Ai(n){if(!ie)return;if(n.key==="Escape"){n.preventDefault(),X(!0);return}let e=[...ie.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 Gr(n,e){let t=f("button",e);return t.type="button",n.variant&&n.variant!=="default"&&t.classList.add(`${e}--${n.variant}`),t.disabled=n.disabled===!0,n.icon&&Ii[n.icon]?(t.innerHTML=at(n.icon,16),t.appendChild(f("span")).textContent=n.label):t.textContent=n.label,t.addEventListener("click",()=>n.pick(t)),t}function us(n,e){X();let t=f("div","mach-context-menu mach-action-menu");t.setAttribute("role","menu");for(let i of e){let r=Gr(i,"mach-context-menu-item");r.setAttribute("role","menuitem"),t.appendChild(r)}A(t,n.closest(".mach-root")),document.body.appendChild(t),J(t,n),ie=t,B=n,n.setAttribute("aria-expanded","true"),document.addEventListener("mousedown",Pr,!0),document.addEventListener("keydown",Ai,!0),t.querySelector("button:not(:disabled)")?.focus({preventScroll:!0})}function cs(n,e,t){X();let i=f("div","mach-action-drawer-backdrop"),r=f("section","mach-action-drawer");r.setAttribute("role","dialog"),r.setAttribute("aria-modal","true"),r.setAttribute("aria-label",e);let o=f("header","mach-action-drawer__header"),s=f("strong");s.textContent=e;let a=f("button","mach-action-drawer__close");a.type="button",a.setAttribute("aria-label","Close"),a.title="Close",a.innerHTML=at("close",16),a.addEventListener("click",()=>X(!0)),o.append(s,a);let l=f("div","mach-action-drawer__body");for(let d of t)l.appendChild(Gr(d,"mach-action-drawer__item"));r.append(o,l),i.appendChild(r),i.addEventListener("mousedown",d=>{d.target===i&&X(!0)}),A(i,n.closest(".mach-root")),document.body.appendChild(i),ie=i,B=n,n.setAttribute("aria-expanded","true"),document.addEventListener("keydown",Ai,!0),r.querySelector("button:not(:disabled)")?.focus({preventScroll:!0})}function te(n,e){if(typeof n=="function")try{return n(e)}catch{return!1}return n===!0}function Lr(n){return n.variant??"default"}function Nr(n){return n.permission?typeof n.permission=="string"?[n.permission]:n.permission:[]}function ki(n,e,t){return{...n.id?{actionId:n.id}:{},permissions:Nr(n),...t?{message:t}:{},params:e}}function lt(n,e,t){let i=t.api.getOption("actionPolicy");try{i?.onError?i.onError(n,ki(e,t)):console.error("[mach-table] action handler failed",n)}catch(r){console.error("[mach-table] action error policy failed",r,n)}}function hs(n,e){if(Nr(n).length===0)return!0;let i=e.api.getOption("actionPolicy");if(!i?.canAccess)return!0;try{return i.canAccess(ki(n,e))}catch(r){return lt(r,n,e),!1}}function ps(n,e){return n.filter(t=>{if(!hs(t,e))return!1;if(!t.show)return!0;try{return t.show(e)}catch{return!1}})}function Pi(n,e,t){t.isConnected&&(t.disabled=te(n.disabled,e)||te(n.loading,e),t.classList.toggle("mach-action-btn--loading",te(n.loading,e)))}function fs(n,e,t,i){Promise.resolve(n).catch(r=>lt(r,e,t)).finally(()=>Pi(e,t,i))}function ms(n,e,t){try{fs(n.onClick(e),n,e,t)}catch(i){lt(i,n,e),Pi(n,e,t)}}function Ri(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(ki(e,t,i)):typeof window>"u"||typeof window.confirm!="function"?!1:window.confirm(i)}function gs(n,e){if(n.confirm==null||n.confirm===!1)return!0;if(typeof n.confirm!="function")return Ri(n.confirm,n,e);let t=n.confirm(e);return t instanceof Promise?t.then(i=>Ri(i,n,e)):Ri(t,n,e)}function ys(n){return(e,t)=>{if(te(e.disabled,n))return;if(t.disabled=!0,t.classList.add("mach-action-btn--loading"),e.confirm==null||e.confirm===!1){ms(e,n,t);return}(async()=>{await gs(e,n)&&await e.onClick(n)})().catch(r=>lt(r,e,n)).finally(()=>{Pi(e,n,t)})}}function vs(n,e,t){let i=f("button","mach-action-btn");i.type="button";let r=Lr(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=te(n.disabled,e),te(n.loading,e)&&(i.disabled=!0,i.classList.add("mach-action-btn--loading")),n.icon&&Ii[n.icon]?(i.innerHTML=at(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 bs(n,e,t,i,r){let o=f("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=`${at("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:Lr(u),disabled:te(u.disabled,i)||te(u.loading,i),pick:c=>{X(),r(u,c)}}));e==="drawer"?cs(o,t.drawerTitle??a,d):us(o,d)}),o}function we(n){let e=Math.max(0,n.max??3),t=n.overflow??"menu";return i=>{let r=ps(n.actions,i);if(r.length===0)return"";let o=f("div","mach-actions"),s=t==="inline"?r:r.slice(0,e),a=t==="inline"?[]:r.slice(e),l=ys(i);for(let d of s)o.appendChild(vs(d,i,l));return a.length>0&&o.appendChild(bs(a,t,n,i,l)),{el:o,destroy:()=>{B&&o.contains(B)&&X()}}}}function be(n,e,t){return n??e??t}function ws(n,e){let t=e.api.getOption("locale")??{};return{view:be(n.labels?.view,t.actionView,V.actionView),edit:be(n.labels?.edit,t.actionEdit,V.actionEdit),delete:be(n.labels?.delete,t.actionDelete,V.actionDelete),confirm:be(n.labels?.confirm,t.actionConfirm,V.actionConfirm),save:be(n.labels?.save,t.actionSave,V.actionSave),cancel:be(n.labels?.cancel,t.actionCancel,V.actionCancel)}}function Cs(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 we({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 Ts(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 dt(n={}){return e=>{let t=ws(n,e);if(e.api.editing.isRowActive(e.rowIndex))return Cs(n,e,t);let i=Ts(n,e,t);return we({actions:i,max:n.max,overflow:n.overflow??"menu",moreLabel:n.moreLabel,drawerTitle:n.drawerTitle})(e)}}var Ds=Ei(),xs=Si(),Fr=Object.freeze({statusTag:Ds,progressBar:xs,link:Mi});var Le={sortable:!1,resizable:!1,movable:!1,filter:!1,suppressSizeToFit:!0,suppressColumnMenu:!0};function Or(n={}){let e=n.width??40;return{colId:"sel",headerName:"",width:e,minWidth:n.minWidth??e,maxWidth:n.maxWidth??e,pinned:"left",checkboxSelection:!0,...Le,...n}}function ut(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",...Le,...n}}function Hr(n={}){let e=n.width??40;return{colId:"drag",headerName:"",rowDrag:!0,width:e,minWidth:n.minWidth??e,maxWidth:n.maxWidth??e,pinned:"left",...Le,...n}}function Vr(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:we(i),...Le,cellRendererParams:void 0}}function Br(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:dt(i),...Le,cellRendererParams:void 0}}var Gi="__rg_detail_toggle__";function Ne(n){return I(n)!==void 0}function zr(n){return n===!0?"left":n||null}function _r(n,e){let t=e;for(let i=2;n.has(t);i++)t=`${e}_${i}`;return n.add(t),t}function Rs(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!==zr(t.pinned)&&(n.pinned=e.pinned)}var ct=class{constructor(e){this.e=e;this.J=[];this.Cr=new Map;this.fe=[];this.to=[];this.Tr=[];this.ro=[];this.me=[];this.Dr=[];this.Rt=new Map;this.Yt=1;this.no=new Map;this.la=0;this.Je=!1}Ei(e){this.Dr=e?[...e]:[];let t=new Map(this.J.map(u=>[u.id,u])),i=this.e.t.defaultColDef,r=this.e.t.masterDetail&&this.e.t.detailToggleColumn,o=new Set(r?[Gi]:[]),s=this.e.t.rowNumber,a=(u,c,h)=>u.map((p,m)=>{if(ye(p)){let $=p.groupId??p.headerName??`group_${m}_${h}`,K=new ee($,p);return K.parent=c,K.children=a(p.children,K,h+1),K}let g=p,b=_r(o,g.colId??g.field??`col_${m}`),T=new Q(b,Sr(g,i,this.e.t.columnTypes));s&&(s=!Ge(T.colDef,"index")),T.parentGroup=c,T.level=h;let G=t.get(b);return G&&!G.isAutoRowNumber&&Rs(T,G),T});if(this.fe=a(this.Dr,null,0),s&&o.size>Number(r)&&this.bu(_r(o,"idx"),t),r){let u=new Q(Gi,{colId:Gi,headerName:"",width:38,pinned:"left",sortable:!1,resizable:!1,movable:!1,filter:!1});u.isDetailToggle=!0,this.fe.unshift(u)}this.Rt.size&&this.wu(),this.J=this.xr(this.fe),this.Cr=new Map(this.J.map(u=>[u.id,u])),this.Yt=this.J.reduce((u,c)=>Math.max(u,c.level+1),1);let l=this.me.length;this.me=this.me.filter(u=>this.Cr.has(u.colId));let d=this.me.length!==l;if(this.me.length===0){let u=[];for(let c of this.J)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 Q(e,ut({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 Q&&(s.hasCheckbox||s.colDef.rowDrag)));this.fe.splice(o===-1?this.fe.length:o,0,i)}xr(e,t=[]){for(let i of e)i instanceof ee?this.xr(i.children,t):t.push(i);return t}Xt(){this.Je=!1;let e=this.J.filter(t=>!t.hide);this.to=e.filter(t=>t.pinned==="left"),this.ro=e.filter(t=>t.pinned==="right"),this.Tr=e.filter(t=>t.pinned===null),this.no.clear(),this.l().forEach((t,i)=>this.no.set(t.id,i))}Z(e){return this.no.get(e)??-1}Q(){return this.J}oo(){return this.Dr}Cu(){return this.fe}Tu(){return this.Yt}R(e){return this.Cr.get(e)}y(e){return e==="left"?this.to:e==="right"?this.ro:this.Tr}l(){return[...this.to,...this.Tr,...this.ro]}Ze(){return this.l().filter(e=>e.colDef.rowGroup===!0)}Du(){return this.l().filter(e=>e.colDef.aggFunc!=null&&e.colDef.rowGroup!==!0)}da(){let e=this.l();return this.Tr.find(Y)??e.find(Y)??e[0]}ge(e){return e.pinned==="left"?"left":e.pinned==="right"?"right":"center"}ua(e){let t=this.e.n.ye.clientWidth,i=this.Je&&t===this.la;this.la=t;let r=e,o=[],s=[];for(let l of this.l()){let d=this.Rr(l);i||l.pinned!=null||l.colDef.suppressSizeToFit||l.manualWidth!=null?(l.currentWidth=se(i?l.manualWidth??l.currentWidth:d.width??rt,d),r-=l.currentWidth):(o.push(l),s.push(d))}let a=this.e.t.columnLayout==="fit"?nt(s,Math.max(0,r)):Ir(s,Math.max(0,r));o.forEach((l,d)=>{l.currentWidth=a[d]})}Rr(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 Ne(t)?(this.Je=!0,e.manualWidth=se(t,this.Rr(e)),e.flex=null,!0):!1}ca(e,t){return Ne(t)?(this.Je=!1,e.resetWidth(),e.contentWidth=se(t,this.Rr(e)),!0):!1}so(e,t){let i=this.R(e);!i||i.hide===!t||(i.hide=!t,this.Xt())}Si(e,t){let i=this.R(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 Q&&!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.Rt.set(this.ha(i),a.filter(c=>c.movable).map(c=>c.id)),this.J=this.xr(this.fe),this.Xt(),!0}ao(e,t){let i=this.R(e);!i||!i.movable||(i.pinned=t,this.Xt())}pa(e=!0){return(e?this.J:this.J.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}))}fa(e){let t=new Map(e.map(i=>[i.colId,i]));for(let i of this.J){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(),Ne(t.flex)&&(e.flex=t.flex)):Ne(t.flex)?(e.flex=t.flex,e.manualWidth=null):this.Ee(e,t.width),Ne(t.contentWidth)&&(e.contentWidth=se(t.contentWidth,this.Rr(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.lo(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.Rt.set(r,i.map(s=>s.id))}),this.J=this.xr(this.fe)}ha(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.lo(t=>t.movable,(t,i)=>{let r=this.Rt.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.Rt=e}lo(e,t,i=this.fe){let r=new Map;i.forEach((o,s)=>{if(o instanceof ee)this.lo(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.ha(s[0])),o.forEach((a,l)=>{i[a]=s[l]})}}uo(){for(let e of this.J)e.resetWidth(),e.hide=e.colDef.hide??!1,e.pinned=zr(e.colDef.pinned);if(this.Rt.size){this.Rt.clear(),this.Ei(this.Dr);return}this.Xt()}ee(){return this.me.map(e=>({...e}))}Mi(e){if(!e||e.length===0){this.me=[];return}this.me=e.filter(t=>this.Cr.has(t.colId)&&(t.direction==="asc"||t.direction==="desc")).map(t=>({colId:t.colId,direction:t.direction}))}Er(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 re(n,e){if(n instanceof Error)return n;let t=new Error(typeof n=="string"?n:e);return t.name="AbortError",t}var Es=()=>re(void 0,"[MachTable] Operation cancelled.");function ht(n,e,t=Es){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 Wr(n){return n==null?"":String(n).toLowerCase()}function Ni(n,e,t){return n.length===0||(e==="or"?n.some(t):n.every(t))}function Ss(n,e,t){let i=Wr(n);return Ni(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 $r(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 Ms(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:$r(i,r,e.match,e.value2??r)}function Is(n,e,t){return Ni(e,t,r=>Ms(n,r))}function Li(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 As(n,e,t){let i=Li(n);return Ni(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=Li(o.value);if(a==null)return!1;let l=o.match==="inRange"?Li(o.value2)??1/0:a;return $r(i,a,o.match,l)})}function ks(n,e){return e.length===0?!0:e.some(t=>t==null&&n==null||t===n)}function Ps(n,e){let t=e.type!=="set"&&e.operator==="or"?"or":"and";switch(e.type){case"text":return Ss(n,e.conditions,t);case"number":return Is(n,e.conditions,t);case"date":return As(n,e.conditions,t);case"set":return ks(n,e.values);default:return!0}}function Kr(n,e,t){return i=>Ps(t(i,n),e)}function Ur(n,e,t){if(n.kind==="condition"){let r=e.get(n.colId);return r?Kr(r,n.filter,t):()=>!0}let i=n.children.map(r=>Ur(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 Fi(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?[Kr(u,d,r)]:[]});t&&s.push(Ur(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=>Wr(r(l,u)).includes(d)))}var jr=typeof Intl<"u"?new Intl.Collator(void 0,{numeric:!0,sensitivity:"base"}):null;function Gs(n,e){let t=n==null||n==="",i=e==null||e==="";return!t&&!i?null:t&&i?0:t?1:-1}function Ls(n,e){let t=Number.isNaN(n),i=Number.isNaN(e);return t||i?t===i?0:t?1:-1:n-e}function Ns(n,e){return n===e?0:n?1:-1}function pt(n,e){let t=Gs(n,e);if(t!==null)return t;if(typeof n=="number"&&typeof e=="number")return Ls(n,e);if(n instanceof Date&&e instanceof Date)return n.getTime()-e.getTime();if(typeof n=="boolean"&&typeof e=="boolean")return Ns(n,e);let i=String(n),r=String(e);return jr?jr.compare(i,r):i.localeCompare(r)}function Oi(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??pt,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 qr(){return{count:0,numeric:0,sum:0,min:1/0,max:-1/0}}function Yr(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 Xr(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 ft(n,e){let t=qr();for(let i of n)Yr(t,i);return Xr(t,e)}var Fe={sum:n=>ft(n,"sum"),avg:n=>ft(n,"avg"),count:n=>n.length,min:n=>ft(n,"min"),max:n=>ft(n,"max"),first:n=>n.length>0?n[0]:null,last:n=>n.length>0?n[n.length-1]:null};function Jr(n,e,t){if(e===Fe.count)return n.length;let i=["sum","avg","min","max"].find(o=>e===Fe[o]);if(!i)return e(n.map(t));let r=qr();for(let o of n)Yr(r,t(o));return Xr(r,i)}function mt(n){let e={...Fe,...n??{}};return t=>e[t]}var gt="group:";function Zr(n){return n==null?"null":n instanceof Date?JSON.stringify(["date",String(n.getTime())]):JSON.stringify([typeof n,Hi(n)])}function Hi(n){return n==null?"(\u7A7A)":String(n)}function Qr(n){return gt+JSON.stringify(n)}function Fs(n,e,t){let i=new Map;for(let r of n){let o=t(r,e),s=Zr(o),a=i.get(s);a||(a={key:s,label:Hi(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 en(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 Fs(a,e[l],t)){let p=[...d,[e[l].id,h.key]],m=Qr(p);o.push(m);let g=s(h.rows,l+1,p);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 tn(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,Zr(h)]),u+=`/g${c}:${Hi(h)}`,!r.has(u))continue;let p=Qr(d);o.set(u,o.has(u)&&o.get(u)!==p?null:p)}}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 Os(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 rn(n){let e=new Set(Object.keys(n.filterModel));Os(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 nn(n){return n!=null&&(typeof n=="object"||typeof n=="function")}function on(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(nn)||t.set(i,r)}return t}function sn(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 nn(s)||!Object.is(i[o],s)}):!1}function ae(n){return re(n.reason,"Block request aborted")}function yt(n){return Number.isFinite(n)?Math.max(1,Math.trunc(n)):1}var vt=class{constructor(e,t,i=4){this.maxBlocks=e;this.fo=t;this.maxConcurrentRequests=i;this.te=new Map;this.q=new Map;this.ma=0;this.co=0;this.ho=0;this.ga=0;this.ya=0;this.Sr=0;this.Mr=new Set;this.maxBlocks=yt(e),this.maxConcurrentRequests=yt(i)}configure(e,t=this.maxConcurrentRequests){this.maxBlocks=yt(e),this.maxConcurrentRequests=yt(t),this.po(),this.Ir()}Eu(e){this.Mr=e,this.po()}peek(e){let t=this.te.get(e);if(t)return t.touchedAt=++this.ma,t}has(e){return this.te.has(e)}Jt(e){let t=this.q.get(e);t&&(this.q.delete(e),t.controller.abort(),t.state==="queued"&&t.reject(ae(t.controller.signal)));let i=this.te.get(e);i&&(this.te.delete(e),this.fo?.(e,i))}load(e,t,i,r=0){if(i?.aborted)return Promise.reject(ae(i));let o=this.peek(e);if(o)return this.ho++,Promise.resolve(o);let s=this.q.get(e);if(s)return this.ho++,s.priority=Math.max(s.priority,r),this.Ir(),this.va(e,s,i);this.ga++;let a=new AbortController,l,d,u=new Promise((p,m)=>{l=p,d=m}),c={controller:a,promise:u,consumers:0,loader:t,priority:r,state:"queued",resolve:l,reject:d};this.q.set(e,c);let h=this.va(e,c,i);return this.Ir(),h}Su(){this.co++,this.Mr.clear();for(let e of this.q.values())e.controller.abort(),e.state==="queued"&&e.reject(ae(e.controller.signal));this.q.clear();for(let[e,t]of this.te)this.fo?.(e,t);this.te.clear()}snapshot(){let e=0,t=0;for(let i of this.te.values())e+=i.rows.length;for(let i of this.q.values())i.state==="active"&&t++;return{cachedBlockCount:this.te.size,loadingBlockCount:this.q.size,activeRequestCount:t,queuedRequestCount:Math.max(0,this.q.size-t),cachedRowCount:e,hitCount:this.ho,missCount:this.ga,evictionCount:this.ya}}Ir(){for(;this.Sr<this.maxConcurrentRequests;){let e,t;for(let[i,r]of this.q)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.Sr++;let i=this.co;this.Iu(t).then(r=>{i===this.co&&!t.controller.signal.aborted&&(this.te.set(e,{rows:r.rows,...r.lastRow==null?{}:{lastRow:r.lastRow},touchedAt:++this.ma}),this.po()),t.resolve(r)},t.reject).finally(()=>{this.Sr=Math.max(0,this.Sr-1),this.q.get(e)===t&&this.q.delete(e),this.Ir()})}Iu(e){let{signal:t}=e.controller;return ht(Promise.resolve().then(()=>{if(t.aborted)throw ae(t);return e.loader(t)}),t,()=>ae(t))}va(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.q.get(e)===t&&(this.q.delete(e),t.controller.abort(i?.reason),t.state==="queued"&&t.reject(ae(t.controller.signal))),o(ae(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")))))})}po(){let e=Math.max(this.maxBlocks,this.Mr.size+1);for(;this.te.size>e;){let t=-1,i=Number.POSITIVE_INFINITY;for(let[o,s]of this.te)this.Mr.has(o)||s.touchedAt<i&&(t=o,i=s.touchedAt);if(t<0)return;let r=this.te.get(t);this.te.delete(t),this.ya++,r&&this.fo?.(t,r)}}};function Ce(n,e){if(n==null||typeof n!="object")return;let t=n[e];return Array.isArray(t)?t:void 0}function Te(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=Ce(r,e);o?.length&&(i.add(r),Te(o,e,t+1,i),i.delete(r))}}var bt=class{constructor(e){this.e=e;this.c=[];this._=[];this.ie=new Map;this.ve=[];this.p=new Map;this.Se={};this.Me=null;this.Ve=null;this.P=new Set;this.z=new Set;this.Ii=[];this.Ai=new Map;this.ba=[];this.G=null;this.ki=!1;this.wa=!1;this.Qe=0;this.Ar=null;this.kr=new WeakMap;this.Pr=new WeakMap;this.et=new Map;this.Pi=new Map;this.Gr=0;this.Lr=0;this.tt=null;this.it=new Map;this.Et=new Map;this.Nr=new Set;this.St=new Map;this.rt=new vt(12,e=>this.Ca(e));this.Gi=0;this.Fr=null;this.mo=!1;this.Ta=0;this.we=[];this.H=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"}Li(){if(this.g){if(this.be)return this.Zt();let e=Math.max(0,this.ve.length-this.c.length);return(this.G??this.c.length)+e}return this.ve.length}Ni(){return this.Gr}Be(){return this.Lr}Au(){return this.wa}Or(e){return!this.g||e?.aborted?Promise.resolve():(this.Da(!0),this.be?(this.rt.configure(this.e.t.maxBlocksInCache,this.e.t.datasourceMaxConcurrentRequests),this.Hr(0,e)):this.xa(0,void 0,e))}Mt(e){this.wa=e,this.e.n.Mt(e,this.e.u("loading"))}xa(e,t,i){if(!this.g||this.ki||this.G!=null&&e>=this.G)return Promise.resolve();let r=this.e.t.blockSize,o=t??e+r;if(o<=e)return Promise.resolve();let s=++this.Qe,a=new AbortController,l=()=>a.abort(i?.reason);return i?.addEventListener("abort",l,{once:!0}),this.Ar=a,this.ki=!0,this.Mt(!0),new Promise(d=>{let u=c=>{i?.removeEventListener("abort",l),s===this.Qe&&(this.ki=!1,this.Ar=null,this.Mt(!1),c!=null&&c?.name!=="AbortError"&&this.e.reportError(c,"datasource.getRows",{startRow:e,endRow:o})),d()};this.Ra(e,o,a.signal,(c,h)=>{if(s!==this.Qe||this.e.o()||a.signal.aborted){u();return}typeof h=="number"&&h>=0?this.G=h:c.length<o-e&&(this.G=e+c.length);let p=this.c.length===0;this.ku(c),u(),this.I(),p&&this.e.Ie(),this.e.W.Vr()},c=>u(a.signal.aborted||this.e.o()?void 0:c??new Error("Datasource request failed")))})}go(){this.Qe++,this.Ar?.abort(),this.Ar=null,this.ki=!1,this.Mt(!1),this.rt.Su(),this.it.clear(),this.Et.clear(),this.Nr.clear();for(let[e,t]of this.St)this.p.get(e)===t&&this.p.delete(e);this.St.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.Br(r)};this.c.push(o),this.p.set(r,o),this._.push(o)}}Hr(e,t,i=0){if(!this.be||e<0)return Promise.resolve();if(t?.aborted)return Promise.reject(this.Ea(t.reason));let r=this.e.t.blockSize,o=this.Qe,s=e*r;if(s>=this.Zt())return Promise.resolve();let a=this.G==null?s+r:Math.min(this.G,s+r),l=this.rt.load(e,d=>this.Pu(s,a,d),t,i);return this.Mt(this.c.length===0&&this.rt.snapshot().loadingBlockCount>0),l.then(d=>{o!==this.Qe||t?.aborted||this.e.o()||!this.be||!this.rt.has(e)||this.Nr.has(e)||(this.Gu(e,d),this.I(),this.e.W.Vr(),o===this.Qe&&!this.e.o()&&this.Sa(this.e.s.yo().lastExcl-1))}).catch(d=>{throw d?.name!=="AbortError"&&this.e.reportError(d,"datasource.getRows",{startRow:s,endRow:a}),d}).finally(()=>{o===this.Qe&&this.Mt(this.c.length===0&&this.rt.snapshot().loadingBlockCount>0)})}Pu(e,t,i){return new Promise((r,o)=>{this.Ra(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")))})}Ra(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.Ea(i.reason))};i.addEventListener("abort",c,{once:!0});let h=()=>{if(d)return;if(i.aborted||this.e.o()){c();return}a++;let p=!1,m=g=>{if(!(p||d)){if(p=!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.ee(),filterModel:this._e(),advancedFilterModel:this.Fi(),quickFilterText:this.Ve,signal:i,onSuccess:(b,T)=>{!p&&u()&&r(b??[],T)},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.Ca(e),typeof t.lastRow=="number"&&t.lastRow>=0?this.G=t.lastRow:t.rows.length<i&&(this.G=r+t.rows.length),t.rows.forEach((o,s)=>{if(o==null)return;let a=r+s;if(this.G!=null&&a>=this.G)return;let l=this.resolveRowId(o,a,`block-${a}`),d=this.St.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.Br(l)};c.rowIndex=a,c.selected=this.e.f.Br(l),this.St.delete(l),this.it.set(a,c),this.Et.delete(a),this.p.set(l,c),this.Pr.set(c,a+1)}),this.Ma(),this.Nr.add(e)}Ca(e){this.Nr.delete(e);let t=this.e.t.blockSize,i=e*t,r;for(let o=i;o<i+t;o++){let s=this.it.get(o);s&&(r??(r=new Set(this.e.$.getDirtyRowIds())),this.it.delete(o),r.has(s.id)?this.St.set(s.id,s):this.p.get(s.id)===s&&this.p.delete(s.id))}this.Ma()}Ma(){this.c=[...this.it.entries()].sort(([e],[t])=>e-t).map(([,e])=>e),this._=this.c}Zt(){if(this.G!=null)return this.G;if(this.e.t.datasourceRowCount!=null)return this.e.t.datasourceRowCount;if(this.it.size===0)return this.e.t.blockSize;let e=0;for(let t of this.it.keys())e=Math.max(e,t+1);return e+this.e.t.blockSize}Lu(e){let t=this.Et.get(e);if(!t&&(t={id:`__mach_loading_${e}`,data:null,rowIndex:e,selected:!1,loading:!0},this.Et.set(e,t),this.Et.size>2e3)){let i=this.Et.keys().next().value;i!=null&&this.Et.delete(i)}return t}Ea(e){return re(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.Sa(e);return}if(!this.g||this.ki)return;let t=this.c.length;if(this.G!=null&&t>=this.G)return;let i=this.e.t.infiniteBufferRows;if(e+i<t&&e<t)return;let r=this.e.t.blockSize,o=this.G==null?t+r:Math.min(this.G,t+r);this.xa(t,o)}Sa(e){if(e<0)return;this.Ia();let t=this.e.t.blockSize,i=Math.floor(e/t),r=Math.floor(this.e.s.yo().first/t),o=this.e.t.blockPrefetch,s=i<this.Ta?-1:1;this.Ta=i;for(let a=r;a<i;a++)this.Hr(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.Hr(d,void 0,o-a+1).catch(()=>{})}}Aa(){return this.Or().catch(()=>{})}Fu(){return this.go(),this.g?this.Or().catch(()=>{}):(this.G=null,this.nt(this.e.t.rowData),this.e.K({data:!0}),Promise.resolve())}destroy(){this.tt=null,this.go(),this.ka(),this.vo(),this.c=this._=this.ve=this.we=[],this.p.clear(),this.ie.clear(),this.Ai.clear(),this.ba=[],this.P.clear(),this.z.clear(),this.Ii=[]}bo(e,t,i){if(!this.be)return Promise.resolve();this.Ia();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.Hr(u,i,100));return Promise.all(d).then(()=>{})}Ou(){this.be&&this.Da(!1)}Da(e){this.Pa(),this.e.$.clear(),this.go(),e&&(this.G=null,this.P.clear()),this.c=[],this._=[],this.p.clear(),this.e.O.clear(),this.I()}Pa(){this.Lr++,this.e.ze(),this.e.api.editing.stop({cancel:!0})}Hu(){return this.rt.snapshot()}Ia(){let e=new Set(this.e.$.getDirtyRowIds());for(let[l,d]of this.St)e.has(l)||(this.St.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.yo();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.rt.Eu(i)}nt(e){let t=this.e.t.resolveRowId,i=this.e.t.childrenKey;this.M&&Te(e??[],i);let r=[],o=[],s=new Map,a=new Map,l=0,d=(u,c,h)=>{let p=l++,m=this.resolveRowId(u,p,`auto-${p}`);if(s.has(m))return this.e.reportError(new Error(`Duplicate row id: ${m}`),"rowData",{rowId:m,index:p}),null;let g=this.M?Ce(u,i):void 0,b={id:m,data:u,rowIndex:-1,selected:!1,treeChildrenLoaded:Array.isArray(g)};if(this.kr.set(b,c),r.push(b),s.set(m,b),h!=null){let T=a.get(h)??[];T.push(m),a.set(h,T)}else o.push(b);if(this.M&&Array.isArray(g))for(let T of g)T!=null&&d(T,c+1,m);return b};(e??[]).forEach(u=>{u!=null&&d(u,0,null)}),this.e.t.rowData=e??[],this.Pa(),this.ka(),this.e.$.clear(),this.c=r,this._=o,this.ie=a,this.p=s,this.e.O.clear();for(let u of[...this.P])s.has(u)||this.P.delete(u);if(this.e.t.defaultExpandAll)for(let u of r)this.Ga(u.id)>0&&this.P.add(u.id);this.e.f.La(t!=null),this._r()}Oi(e){return this.ie.get(e)??[]}Ga(e){return this.ie.get(e)?.length??0}wo(e){return this.Ga(e)>0}isTreeRowLoading(e){return this.p.get(e)?.treeLoading===!0}ka(){for(let e of this.et.values())e.abort();this.et.clear(),this.Pi.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.Oi(e).flatMap(l=>{let d=this.p.get(l)?.data;return d==null?[]:[d]}));let o=this.Pi.get(e);if(o&&!t)return o;this.et.get(e)?.abort();let s=new AbortController;this.et.set(e,s),i.treeLoading=!0,i.treeLoadError=void 0,this.e.K({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.et.get(e)===s&&(this.et.delete(e),this.Pi.delete(e),i.treeLoading=!1,this.e.K({data:!0}))});return this.Pi.set(e,a),a}Bu(e,t){let i=new Set,r=[...this.Oi(e.id)];for(;r.length>0;){let s=r.pop();i.has(s)||(i.add(s),r.push(...this.Oi(s)))}this._u(t,i,this.zr(e)+1);for(let s of i)this.et.get(s)?.abort(),this.et.delete(s),this.Pi.delete(s),this.ie.delete(s),this.p.delete(s),this.P.delete(s);this.ie.delete(e.id);let o=this.zr(e)+1;for(let s of t)s!=null&&this.Co(e,s,o);this.Na(),this.e.f.La(this.e.t.resolveRowId!=null),this.I()}_u(e,t,i){Te(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=Ce(l,this.e.t.childrenKey);d&&s.push(...d)}}Hi(e,t=!0){this.M&&e.add?.length&&Te(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 p=[this.resolveRowId(c,-1,`__missing_remove_${this.e.Qt()}`)];for(;p.length>0;){let m=p.pop();if(!a.has(m)){a.add(m);for(let g of this.ie.get(m)??[])p.push(g)}}}else{let h=[c];for(;h.length>0;){let p=h.pop();l.add(p);let m=this.M?Ce(p,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.ie.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.Wr(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.kr.set(h,0);let p=this.M?Ce(d,this.e.t.childrenKey):void 0;if(p)for(let m of p)m!=null&&this.Co(h,m,1);l.push(h)}),this._=this._.slice(0,a).concat(l,this._.slice(a)),this.Na()}let s={pipelineChanged:this.zu(e,r),updatedRowIds:r.map(({node:a})=>a.id)};return this.e.O.Wu(o),this.$u(s,t),this.e.$.Ku(o),s}$u(e,t){e.pipelineChanged&&(this.tt=null),t&&(e.pipelineChanged?this._r():e.updatedRowIds.length&&this.Fa())}Uu(e){if(e.length===0)return{pipelineChanged:!1,updatedRowIds:[]};let t=this.Lr,i=!1,r=new Set;for(let o of e){let s=this.Hi(o,!1);if(this.Lr!==t)return{pipelineChanged:!1,updatedRowIds:[]};i||(i=s.pipelineChanged);for(let a of s.updatedRowIds)r.add(a)}return i?this._r():r.size>0&&this.Fa(),{pipelineChanged:i,updatedRowIds:[...r]}}zu(e,t){if(e.add?.length||e.remove?.length)return!0;if(!t.length)return!1;let i=this.Oa();if(i===null)return!0;if(!i.length)return!1;let r=this.tt;return!r||i.length!==r.fields.length||i.some((o,s)=>o!==r.fields[s])?!0:t.some(({node:o,before:s,after:a})=>sn(s,a,i,r.values.get(o)))}Oa(){if(this.M||this.e.t.masterDetail||this.Ha())return null;let e=this.e.r.l();if(e.some(i=>it(i)||i.colDef.autoRowSpan===!0||i.colDef.rowSpan!=null))return null;let t=!this.e.t.manualFiltering;return rn({columns:e,customAggregates:this.e.t.aggFuncs,sortModel:this.e.t.manualSorting?[]:this.e.r.ee(),filterModel:t?this.Se:{},advancedFilter:t?this.Me:null,quickFilter:t?this.Ve:null})}ju(){let e=this.Oa(),t=e?.length?on(this.c,e):null;this.tt=e&&t?{fields:e,values:t}:null}Fa(){this.e.emit("modelUpdated",{rowCount:this.we.length})}Co(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=Ce(t,this.e.t.childrenKey),s={id:r,data:t,rowIndex:-1,selected:!1,treeChildrenLoaded:Array.isArray(o)};this.p.set(r,s),this.kr.set(s,i);let a=this.ie.get(e.id)??[];if(a.push(s.id),this.ie.set(e.id,a),!!o)for(let l of o)l!=null&&this.Co(s,l,i+1)}Na(){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.ie.get(t.id)??[]){let r=this.p.get(i);r&&e(r)}};for(let t of this._)e(t)}It(e){let t=JSON.stringify(this.Se),i=new Set(this.e.r.Q().map(o=>o.id));this.Se=Z(e,i);let r=JSON.stringify(this.Se)!==t;return r&&(this.tt=null),r}_e(){return{...this.Se}}qu(e=this.Me){let t=Object.keys(this.Se).length>0&&this.It(this.Se),i=(e!=null||this.Me!=null)&&this.ot(e);return t||i}ot(e){let t=new Set(this.e.r.Q().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.tt=null),o}Fi(){return H(this.Me)}At(e){let t=e!=null&&e.trim()!==""?e:null;return t===this.Ve?!1:(this.Ve=t,this.tt=null,!0)}To(){return this.Ve}Vi(){return Object.keys(this.Se).length>0||this.Me!=null||this.Ve!=null}I(){this._r(),this.e.K({data:!0})}Do(){this.g?this.Aa():this.I()}_r(){this.tt=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.Vi()&&!this.e.t.manualFiltering&&(r=r.filter(Fi(t,this.Se,this.Me,this.Ve,i)));let a=this.e.r.ee();if(a.length>0&&!this.e.t.manualSorting)try{r=Oi(r,a,t,i)}catch(d){this.e.reportError(d,"comparator",{sortModel:a})}let l=this.e.r.Ze();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.P.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.Va(r,e,!0),this.Qu(o)}Va(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.Pr.set(o,++r)}),this.we=e,this.Bi(),i&&this.ju(),this.ec((o,s)=>this.e.d(o,s)),this.e.emit("modelUpdated",{rowCount:e.length}),this.e.Ce.Ba(t)}Yu(e){this.c.forEach((t,i)=>{this.be||(t.rowIndex=i),this.Pr.set(t,this.be?t.rowIndex+1:i+1)}),this.ve=this.c,this.we=this.c,this.Ai.clear(),this.e.t.getRowHeight&&this.e.s.st(),this.Gr++,this.e.emit("modelUpdated",{rowCount:this.c.length}),this.e.Ce.Ba(e)}Xu(e){let t=this.mo;return this.mo=!1,!t&&this.Ha()?(this.tc(e),!0):(this.vo(),!1)}Ha(){if(!this.e.t.dataProcessor||this.c.length<this.e.t.dataProcessorMinRows||this.M||this.e.t.masterDetail||this.e.r.Ze().length>0)return!1;let e=!this.e.t.manualFiltering&&this.Vi(),t=!this.e.t.manualSorting&&this.e.r.ee().length>0;return e||t}tc(e){this.vo();let t=this.e.t.dataProcessor;if(!t)return;let i=++this.Gi,r=new AbortController;this.Fr=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.ee():[],filterModel:a?this._e():{},advancedFilterModel:a?this.Fi():null,quickFilterText:a?this.Ve:null,signal:r.signal})).then(d=>{if(i!==this.Gi||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 p=this.p.get(h);p&&!p.isDetail&&!p.isGroup&&c.push(p)}this.Va(c,e),this.e.K({data:!0})}).catch(d=>{i!==this.Gi||r.signal.aborted||this.e.o()||(this.e.reportError(d,"dataProcessor.process"),this.mo=!0,this.I())}).finally(()=>{i===this.Gi&&(this.Fr=null)})}vo(){this.Gi++,this.Fr?.abort(),this.Fr=null}get Te(){return this.e.t.paginationEnabled&&!this.g}Bi(){if(this.e.t.getRowHeight&&this.e.s.st(),!this.Te){this.ve=this.we,this.Gr++;return}let e=this._i(),t=this.getPageCount();this.H>t&&(this.H=t),this.H<1&&(this.H=1),this.e.t.paginationPage=this.H;let i=(this.H-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.Gr++}_i(){return Math.max(1,this.e.t.paginationPageSize)}ei(){return this.Te?this.H:1}getTotalRowCount(){return this.g?this.Li():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._i())):1}_a(){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.H&&(this.H=r,this.e.t.paginationPage=r,this.Bi(),this.e.K({data:!0}),this.e.s.$r(0,"top"),t||this.zi())}setPageSize(e){if(!this.Te)return;let t=Math.max(1,Math.round(e)||this._i()),i=(this.H-1)*this._i();this.e.t.paginationPageSize=t,this.H=Math.floor(i/t)+1,this.e.t.paginationPage=this.H,this.Bi(),this.e.K({data:!0}),this.zi()}za(e,t){this.e.t.paginationPageSize=t,this.H=e,this.e.t.paginationPage=this.H}Wa(e){this.e.t.paginationEnabled!==e&&(this.e.t.paginationEnabled=e&&!this.g,this.e.t.paginationEnabled&&(this.H=1),e||this.we.forEach((t,i)=>{t.rowIndex=i}),this.Bi(),this.e.K({data:!0}),this.zi())}ic(){this.Te&&(this.H=this.e.t.paginationMode==="server"?this.e.t.paginationPage:1,this.Bi(),this.e.K({data:!0}),this.zi())}zi(e=this._i()){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.ee(),r=new Map,o=this.Vi()&&!this.e.t.manualFiltering,s=Fi(e,this.Se,this.Me,this.Ve,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 p of this.ie.get(u.id)??[]){let m=this.p.get(p);m&&a(m)&&(h=!0)}}return r.set(u.id,h),h},l=[],d=u=>{let c=u;i.length>0&&(c=Oi(u,i,e,t));for(let h of c)if(a(h)&&(l.push(h),this.P.has(h.id))){let p=(this.ie.get(h.id)??[]).map(m=>this.p.get(m)).filter(m=>m!=null);d(p)}};return d(this._),l}rc(){let e=this.ba,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&&pt(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.Ai.clear(),this.M||this.e.t.masterDetail||this.e.r.Ze().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.Ai.set(r.id,this.sc(i,r,e))}ac(e){return this.Ai.get(e)}$a(e){return this.Pr.get(e)??0}zr(e){return this.kr.get(e)??0}Zu(e,t){let i=mt(this.e.t.aggFuncs),r=this.e.r.Du();this.Ii=[];let o=l=>{let d={};for(let u of r){let c=i(u.colDef.aggFunc);if(c)try{d[u.id]=Jr(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=tn(this.z,this.c,t,(l,d)=>this.e.d(l,d));this.z=s.expanded;let a=en(e,t,(l,d)=>this.e.d(l,d),o,this.z);return this.Ii=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.wo(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.P.has(e)}lc(){return[...this.P]}dc(){return[...this.z]}uc(e,t){this.P=new Set(e.filter(i=>this.p.has(i))),this.z=new Set(t)}cc(e){return this.xo(e,!0)}hc(e){return this.xo(e,!1)}Kr(e){return this.xo(e,!this.P.has(e))}xo(e,t){let i=this.p.get(e);return!i||t&&!this.isRowExpandable(i)?!1:(t===this.P.has(e)||(t?this.P.add(e):this.P.delete(e),this.I(),this.e.emit("detailToggled",{rowId:e,rowNode:i,expanded:t}),t&&this.M&&!this.wo(e)&&!i.treeLoading&&this.loadTreeChildren(e).catch(()=>{})),t)}setAllDetailsExpanded(e){let t=!1;if(e)for(let i of this.c)!this.P.has(i.id)&&this.isRowExpandable(i)&&(this.P.add(i.id),t=!0);else this.P.size>0&&(this.P.clear(),t=!0);t&&this.I()}Ro(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.Ii)this.z.add(i);else this.z.clear();this.z.size!==t&&this.I()}setGroupExpanded(e,t){return!this.Ii.includes(e)||t===this.z.has(e)||(t?this.z.add(e):this.z.delete(e),this.I()),t}Ka(){return!this.M&&!this.g&&!this.e.t.dataProcessor&&this.e.t.paginationMode!=="server"&&this.e.r.ee().length===0&&this.e.r.Ze().length===0}Ua(e,t){if(!this.Ka()||!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.I(),!0)}He(){return this.c}pc(){return this._}kt(){return this.ve}L(){return this.be?this.Zt():this.ve.length}h(e){return this.be?e<0||e>=this.Zt()?void 0:this.it.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 wt=class{constructor(e){this.e=e;this.N=new Set;this.Pt=null;this.Wi=new Set}Br(e){return this.N.has(e)}gc(e){return this.Wi.has(e)}We(e,t){if(e.loading)return!1;if(e.isGroup||e.isDetail)return!0;let i=t===void 0?this.Eo():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}}Eo(){return this.e.r.l().find(e=>e.hasCheckbox&&e.colDef.selectable!=null)}ti(){return this.e.i.He().filter(e=>this.N.has(e.id))}ja(e=this.ti()){return e.filter(t=>t.data!=null).map(t=>t.data)}So(){return[...this.N]}qa(e){let t=new Set(e),i=this.Eo()??null,r=this.e.i.He().filter(o=>t.has(o.id)&&!o.isDetail&&!o.isGroup&&this.We(o,i)).map(o=>({node:o,selected:!0}));this.Gt(r,!0)}yc(){this.qa(this.e.t.rowSelection==="none"?[]:this.So())}La(e){let t=this.e.i;if(!e)this.N.clear(),this.Pt=null;else{for(let i of this.N)t.F(i)||this.N.delete(i);this.Pt!=null&&!t.F(this.Pt)&&(this.Pt=null)}this.Ya(null);for(let i of t.He())i.selected=this.N.has(i.id)}Xa(e){let{selectable:t,selected:i}=this.Ja(e.leafNodes??[],!1);return{all:i>0&&i===t,some:i>0}}vc(e,t){let i=(e.leafNodes??[]).filter(r=>this.We(r));i.length!==0&&this.Gt(i.map(r=>({node:r,selected:t})))}Mo(e,t,i=!1){this.Gt([{node:e,selected:t,clearOthers:i}])}bc(e,t=!0,i=!0){let r=this.e.i.F(e);r&&this.Mo(r,t,i)}wc(e,t,i){if(!i||!t.shiftKey||this.Pt==null)return!1;let r=this.e.i.F(this.Pt);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.Gt(a),!0}Za(e,t,i){let r=this.e.t.rowSelection;if(r==="none"||!this.We(e))return;let o=r==="multiple",s=o&&(i||t.ctrlKey||t.metaKey);!s&&this.wc(e,t,o)||(this.Mo(e,!s||!e.selected,!s),this.Pt=e.id)}selectAll(e=!0){if(this.e.t.rowSelection==="none")return;let i=e?this.e.i.kt():this.e.i.He();this.Gt(i.filter(r=>!r.isDetail&&!r.isGroup).map(r=>({node:r,selected:!0})))}deselectAll(){this.Gt([],!0)}Cc(){let e=this.e.i,{selectable:t,selected:i}=this.Ja(e.kt(),!0),r=i>0&&i===t&&(!e.g||t>=e.Li());return{all:r,some:i>0&&!r}}Ja(e,t){let i=0,r=0;for(let o of e)t&&(o.isDetail||o.isGroup)||!this.We(o)||(i++,this.N.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.We(a,t))&&this.N.add(a.id):this.N.delete(a.id),!!o)for(let u of i.Oi(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.N)t.delete(i)||t.add(i);return t}xc(e){let t=[];for(let i of this.e.i.He()){let r=this.N.has(i.id);(i.selected!==r||e.has(i.id)||this.Wi.has(i.id))&&i.rowIndex>=0&&t.push(i.rowIndex),i.selected=r}return t}Gt(e,t=!1){let i=this.e.t.rowSelection,r=this.Eo()??null,o=e.filter(u=>!u.selected||i!=="none"&&this.We(u.node,r));if(e.length>0&&o.length===0)return;let s=new Set(this.N);(t||o.some(u=>u.selected?i==="single"||u.clearOthers:u.clearOthers&&this.We(u.node,r)))&&this.N.clear(),this.Tc(o,r);let a=new Set(this.Wi);this.Ya(r);let l=this.Dc(s),d=this.xc(a);if(l.size>0){this.e.s.I(d),this.e.W.Vr();let u=this.ti();this.e.emit("selectionChanged",{selectedNodes:u,selectedRows:this.ja(u)})}}Ya(e){this.Wi.clear();let t=this.e.i;if(this.e.t.rowSelection!=="multiple"||!t.M||this.N.size===0)return;let i=r=>{let o=e&&t.F(r),s=!o||this.We(o,e),a=!0,l=!1;for(let d of t.Oi(r)){let u=i(d);a&&(a=u.all),l||(l=u.some)}if(a&&!l){s||this.N.delete(r);let d=this.N.has(r);return{all:d||!s,some:d}}return s&&a?this.N.add(r):(this.N.delete(r),s&&l&&this.Wi.add(r)),{all:a,some:l}};for(let r of t.pc())i(r.id)}};var Ct=class{constructor(e){this.e=e;this.Lt=null;this.re=0;this.at=0;this.$e=null;this.ii=null;this.$i=e=>{let t=this.ko(e);t&&(this.at=this.il(t,e.clientX),t.didResize||(t.didResize=Math.abs(this.at-t.startWidth)>=.5),!this.re&&(this.re=requestAnimationFrame(()=>{this.re=0,this.Sc()})))};this.ni=e=>{let t=this.ko(e);t&&(this.at=this.il(t,e.clientX),t.didResize||(t.didResize=Math.abs(this.at-t.startWidth)>=.5),this.Mc(t))};this.Ur=e=>{this.ko(e)&&this.lt()};this.Ic=()=>{this.lt()};this.Po=e=>{e.key==="Escape"&&(e.preventDefault(),this.lt())}}Rc(e,t){if(!this.e.t.enableColumnResize||!t.resizable||e.isPrimary===!1)return;this.lt();let i=e.currentTarget,r=t.currentWidth;this.at=r,this.Lt={column:t,didResize:!1,handle:i,pointerId:e.pointerId,startFlex:t.flex,startManualWidth:t.manualWidth,startWidth:r,startX:e.clientX,startPreserveWidths:this.e.r.Je},this.Io(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.Lt)}lt(e=!0){let t=this.Lt;t&&(this.Lt=null,this.Ao(),this.Io(t.handle,!1),e&&(this.Qa(t),this.e.ri()),this.e.n.root.classList.remove("mach-root--resizing"),this.tl(t))}Qa(e){e.column.manualWidth=e.startManualWidth,e.column.flex=e.startFlex,e.column.currentWidth=e.startWidth,this.e.r.Je=e.startPreserveWidths}Mc(e){this.Lt=null,this.Ao(),e.didResize&&(Math.abs(this.at-e.startWidth)<.5?this.Qa(e):this.e.r.Ee(e.column,this.at),this.e.ri()),this.Io(e.handle,!1);try{e.handle.releasePointerCapture?.(e.pointerId)}catch{}this.e.n.root.classList.remove("mach-root--resizing"),this.tl(e),e.didResize&&this.e.dt([e.column])}Sc(){let e=this.Lt;!e||!this.e.r.Ee(e.column,this.at)||(this.e.ri(),this.Ki(e),this.e.rl(e.column,!1))}Ec(e){this.$e=f("div","mach-column-resize-guide"),this.$e.setAttribute("aria-hidden","true"),this.ii=f("span","mach-column-resize-label"),this.$e.appendChild(this.ii),this.e.n.root.appendChild(this.$e),this.Ki(e)}Ki(e){if(!this.$e||!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.$e.style.left=`${o}px`,this.$e.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`}tl(e){e.handle.classList.remove("mach-header-resize--active"),this.$e?.remove(),this.$e=null,this.ii=null}il(e,t){let i=Number.isFinite(t)?t:e.startX;return Math.max(1,e.startWidth+i-e.startX)}ko(e){let t=this.Lt;return t&&e.pointerId===t.pointerId?t:null}Ao(){this.re&&cancelAnimationFrame(this.re),this.re=0}Io(e,t){S(window,t,{pointermove:this.$i}),S(window,t,{pointerup:this.ni,pointercancel:this.Ur,keydown:this.Po},!0),S(e,t,{lostpointercapture:this.Ic})}destroy(){this.lt(!1),this.Ao(),this.e.n.root?.classList.remove("mach-root--resizing")}};var an=6,Tt=class{constructor(e){this.e=e;this.Ui=null;this.oi=null;this.Go=!1;this.le=0;this.jr=null;this.$i=e=>{if(this.oi){this.Pc(e);return}let t=this.Ui;t&&(Math.abs(e.clientX-t.startX)<an&&Math.abs(e.clientY-t.startY)<an||this.Gc(e))};this.ni=e=>{this.Ui=null,e.type!=="pointercancel"&&this.oi&&this.No(e.clientX,e.clientY),this.Lo();let t=this.nl();t&&e.type!=="pointercancel"&&t.targetIndex>=0&&this.e.Si(t.column.id,t.targetIndex)}}Ac(e,t){e.button===0&&t.movable&&(this.Ui={column:t,startX:e.clientX,startY:e.clientY},this.ji(!0))}ji(e){S(window,e,{pointermove:this.$i,pointerup:this.ni,pointercancel:this.ni})}kc(){let e=this.Go;return this.Go=!1,e}Gc(e){let t=this.Ui;if(!t)return;let i=this.e.W.si(t.column.id,this.e.r.ge(t.column));if(!i||!i.parentElement){this.Lo();return}this.Go=!0;let r=f("div","mach-drop-indicator"),o=f("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.ai[s],l=this.e.r.y(s),d=new Float64Array(l.length+1),u=new Float64Array(l.length);for(let h=0;h<l.length;h++){let p=l[h].currentWidth;u[h]=d[h]+p/2,d[h+1]=d[h]+p}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.C.center.scrollLeft,fromIndex:l.indexOf(t.column),midpoints:u,offsets:d,ghostWidth:c.width,ghostHeight:c.height},this.No(e.clientX,e.clientY)}Pc(e){this.jr={clientX:e.clientX,clientY:e.clientY},!this.le&&(this.le=requestAnimationFrame(()=>{this.le=0;let t=this.jr;this.jr=null,t&&this.No(t.clientX,t.clientY)}))}No(e,t){let i=this.oi;if(!i)return;let r=C(e+12,8,window.innerWidth-i.ghostWidth-8),o=C(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.C.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)`}nl(){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}Lo(){this.ji(!1),this.le&&cancelAnimationFrame(this.le),this.le=0,this.jr=null}destroy(){this.Lo(),this.nl(),this.Ui=null}};var Vi=/^[+-]?(?:\d+(?:\.\d+)?|\.\d+)(?:[eE][+-]?\d+)?$/;function Dt(n,e=!0){if(n==="")return null;if(!e||typeof n!="string"||!Vi.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 Bi(n,e){let t=n==null?"":String(n);return t.includes(e)||t.includes('"')||t.includes(`
|
|
1
|
+
"use strict";var mi=Object.defineProperty;var Co=Object.getOwnPropertyDescriptor;var To=Object.getOwnPropertyNames;var Do=Object.prototype.hasOwnProperty;var xo=(n,e)=>{for(var t in e)mi(n,t,{get:e[t],enumerable:!0})},Ro=(n,e,t,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of To(e))!Do.call(n,r)&&r!==t&&mi(n,r,{get:()=>e[r],enumerable:!(i=Co(e,r))||i.enumerable});return n};var Eo=n=>Ro(mi({},"__esModule",{value:!0}),n);var el={};xo(el,{BUILTIN_AGG_FUNCS:()=>Oe,DEFAULT_LOCALE:()=>V,EVENT_TYPES:()=>$t,LOCALE_EN:()=>Ar,actionsColumn:()=>Vr,advancedFilterCondition:()=>wr,advancedFilterGroup:()=>Cr,applyGridViewState:()=>lr,buildColDefsFromSchema:()=>ro,captureGridViewState:()=>ar,clearGridState:()=>qn,createActionButtonsRenderer:()=>Ce,createAggResolver:()=>mt,createBusinessColumnTypes:()=>mo,createColumnHelper:()=>oo,createEnterprisePreset:()=>uo,createGrid:()=>eo,createGridViewManager:()=>bo,createLocalGridStateStore:()=>ir,createLocalGridViewStore:()=>dr,createMachTableCommands:()=>no,createMachTablePreset:()=>sr,createProgressBarRenderer:()=>Si,createRemoteExportRequest:()=>to,createRowActionsRenderer:()=>dt,createStatusTagRenderer:()=>Ei,defineColumns:()=>so,defineGridOptions:()=>ho,defineMachTableConfig:()=>po,defineMachTablePreset:()=>co,describeFilter:()=>qt,downloadFile:()=>Wt,dragColumn:()=>Hr,escapeHtml:()=>ce,formatText:()=>W,formatTwo:()=>be,getByPath:()=>z,indexColumn:()=>ut,isColDefGroup:()=>ve,isSafePath:()=>tt,linkRenderer:()=>Mi,loadGridState:()=>ai,matchLocaleKey:()=>ot,normalizeAdvancedFilterModel:()=>H,normalizeColumnFilter:()=>it,normalizeFilterModel:()=>Q,normalizeGridState:()=>q,normalizeGridViewState:()=>fi,normalizeSavedGridView:()=>Se,parseCsv:()=>Et,parseDelimited:()=>St,parseTsv:()=>Rt,resolveGridFeatures:()=>ui,resolveSaveConflict:()=>In,resolveTagVariant:()=>st,rowActionsColumn:()=>Br,sanitizeFormulaCell:()=>le,saveGridState:()=>si,selectionColumn:()=>Or,setByPath:()=>me,toTsv:()=>xt,validateGridOptions:()=>li,version:()=>Qa});module.exports=Eo(el);var Ke="0.41.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 Ue(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 gi=new WeakMap,je=new WeakMap;function Ie(n){let e=gi.get(n);return e||(e={},gi.set(n,e)),e}function yi(n){return gi.get(n)}function qe(n,e){e?je.set(n,e):je.delete(n)}function Ye(n){let e=je.get(n);return je.delete(n),e}function f(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=f("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 C(n,e,t){return n<e?e:n>t?t:n}function Z(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=`${C(i.left,8,Math.max(8,window.innerWidth-r.width-8))}px`,n.style.top=`${C(s,8,Math.max(8,window.innerHeight-r.height-8))}px`}var hr=0;function pr(n="rg"){return hr++,`${n}-${hr}`}var fr='<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>',mr='<svg viewBox="0 0 16 16" width="10" height="10" fill="currentColor"><path d="M8 3l4 5H4l4-5z"/></svg>',gr='<svg viewBox="0 0 16 16" width="10" height="10" fill="currentColor"><path d="M8 13l4-5H4l4 5z"/></svg>',yr='<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 pe(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 vi(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=yi(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 vr(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 Mo(n,e,t,i,r,o){let s=yi(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 fe(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 vi(i)}function Io(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(pe(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 Ao(n,e){let t=n.firstElementChild,i=t?.className==="mach-cell-text"?t:f("span","mach-cell-text");i.textContent!==e&&(i.textContent=e),n.replaceChildren(i)}function ko(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(Mo(n,e,t,i,a,d)){vr(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")Ao(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="";vr(n,e,t,i,r,o)}function Xe(n){let{align:e}=n.colDef;return e==="left"?"mach-cell--left":e==="right"?"mach-cell--right":"mach-cell--center"}function Po(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=pe(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 Go(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 bi(n,e,t,i){let r=["mach-cell",Xe(i)];Po(n,r,t,i),Go(r,e,i);let o=r.join(" ");e.className!==o&&(e.className=o)}function Je(n,e,t,i){ko(n,e,t,i),bi(n,e,t,i),Io(n,e,t,i)}function Ae(n,e){return n&&v(n,e)?n[e]:void 0}function Ze(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 Qe=class{constructor(e){this.e=e;this.Jn="";this.Zn=[];this.oa=0;this.Ri=!0}Qn(e){this.gu()&&(this.Ri=!0,e=void 0);let t=this.Ri?this.sa():void 0,i=t&&No(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,Lo(s)){let l=this.aa(s,t);o=l!==s.contentWidth||o,s.contentWidth=l}}return this.Ri=!1,o&&(this.e.r.Je=!1),o}gu(){let e=Array.from(document.fonts??[]).filter(s=>s.status==="loaded"),t=e.length!==this.Zn.length||e.some((s,a)=>s!==this.Zn[a]);t&&(this.Zn=e,this.oa++);let i=getComputedStyle(this.e.n.root),r=`${i.getPropertyValue("--mach-header-font-weight")||650} ${i.fontSize} ${i.fontFamily}`,o=r!==this.Jn||t;return this.Jn=r,o}sa(){let e=this.e.i.He(),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))])}eo(e,t){return this.xi===void 0&&(this.xi=f("canvas").getContext("2d")),this.xi?(this.xi.font=t??this.Jn,this.xi.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.eo(i)+i.length*.15+28+(e.sortable?20:0)+(e.filterable?28:0)+(this.e.t.columnMenu&&!e.hasCheckbox&&!t.suppressColumnMenu?22:0)))}aa(e,t=this.sa()){let i=28;for(let r of t){let o=this.e.d(r,e),s=Ze(o,e.colDef.status)?.label??Y(this.e,r,e,o);i=Math.max(i,this.eo(s.slice(0,128))+(e.colDef.status?44:28))}return Math.ceil(Math.min(I(e.colDef.maxWidth)??360,i))}};function Lo(n){let{width:e,autoWidth:t}=n.colDef;return n.manualWidth==null&&e==null&&t!==!1&&!n.hasCheckbox&&!n.isDetailToggle}function No(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 et=class{constructor(e){this.vu=e;this.wr=new Map}on(e,t){let i=this.wr.get(e);return i||(i=new Set,this.wr.set(e,i)),i.add(t),()=>{i.delete(t)}}emit(e,t){let i=this.wr.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.wr.clear()}};var Fo=new Set(["__proto__","prototype","constructor"]),ke=new Map;function wi(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&&!Fo.has(r))?t:null;return n.length<=1024&&(ke.size>=256&&ke.delete(ke.keys().next().value),ke.set(n,i)),i}function tt(n){return wi(n)!==null}function z(n,e){if(n==null)return;let t=wi(e);if(!t)return;let i=n;for(let r of t){if(i==null)return;i=i[r]}return i}function me(n,e,t){if(n==null)return!1;let i=wi(e);if(!i)return!1;let r=n;for(let o=0;o<i.length-1;o++){if(typeof r!="object"&&typeof r!="function"||r===null)return!1;r[i[o]]==null&&(r[i[o]]={}),r=r[i[o]]}return typeof r!="object"&&typeof r!="function"||r===null?!1:(r[i[i.length-1]]=t,!0)}var ge={text:["contains","notContains","equals","notEquals","startsWith","endsWith","blank","notBlank"],number:["equals","notEquals","lessThan","lessThanOrEqual","greaterThan","greaterThanOrEqual","inRange","blank","notBlank"],date:["equals","notEquals","lessThan","greaterThan","inRange","blank","notBlank"]};var Oo=16,Ho=512,Vo=20,Bo=2e3,_o=2e3,zo={text:new Set(ge.text),number:new Set(ge.number),date:new Set(ge.date)};function Wo(n){return n==null||typeof n=="string"||typeof n=="number"&&Number.isFinite(n)}function $o(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,...Ko(i,e)}}function Ko(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 Uo(n,e){let t=[],i=zo[e];for(let r of n.slice(0,Vo)){let o=$o(r,e,i);o&&t.push(o)}return t}function it(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(Wo).slice(0,Bo)}: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:Uo(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=it(n.filter);return i?{kind:"condition",colId:t,filter:i}:null}function qo(n,e,t){if(!Array.isArray(n.children))return null;let i=[];for(let r of n.children){let o=br(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 Yo(n,e,t){return e<=Oo&&t.nodes<Ho&&n!=null&&typeof n=="object"}function br(n,e,t){if(!Yo(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"?qo(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=br(t.root,0,{ancestors:new WeakSet,nodes:0,validColumnIds:e});return i?{version:1,root:i}:null}function wr(n,e){return{kind:"condition",colId:n,filter:e}}function Q(n,e){if(n==null||typeof n!="object"||Array.isArray(n))return{};let t={};for(let[i,r]of Object.entries(n).slice(0,_o)){let o=i.trim();if(!o||e?.has(o)===!1)continue;let s=it(r);s&&(t[o]=s)}return t}function Cr(n,e,t={}){return{kind:"group",operator:n,children:e,...t.not?{not:!0}:{}}}var Ci={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},Xo=Object.keys(Ge);function Jo(n){let e={};for(let t of Xo)e[t]=n[t]??Ge[t];return e}function Zo(n){return n&&v(Pe,n)?n:"normal"}function Qo(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 Ti(n,e){let t=typeof n=="function"?n(e):z(e,n);return t==null?"":String(t)}function es(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:{...Ci,...n.defaultColDef??{}},columnTypes:n.columnTypes??{},...i?{resolveRowId:({data:r})=>Ti(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 ts(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:Qo(n,t),paginationShowTotal:e?e.showTotal!==!1:!0,paginationShowSizeSelector:e?e.showPageSizeSelector!==!1:!0}}function Di(n){let e=n.watermark==null||n.watermark===!1?null:n.watermark===!0?{text:"MachTable"}:n.watermark;return{watermarkEnabled:e!==null,watermarkConfig:e}}function is(n){return{advancedFilterModel:H(n.advancedFilterModel),persistence:Ue(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 Dr={blockSize:100,maxBlocksInCache:12,datasourceMaxConcurrentRequests:4},xr={infiniteBufferRows:40,blockPrefetch:1,datasourceRetryCount:2,datasourceRetryDelay:300},rs=Object.keys(Dr),ns=Object.keys(xr);function Tr(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 xi(n,e){let t=Tr(n,e,rs,1);Tr(n,e,ns,0);let i=x(n.datasourceRetryJitter,0);return i!==void 0&&(e.datasourceRetryJitter=Math.min(1,i)),t}function os(n){let e={...Dr,...xr,datasourceRetryJitter:.15};return xi(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 ss=["detailRowRenderer","isRowExpandable","aggFuncs","components","actionPolicy","summaryMethod","datasource","getRowHeight","tooltipComponent","getContextMenuItems","initialState","rowEditValidator","isTreeRowExpandable","loadTreeChildren","dataProcessor"];function Rr(n){let e=Zo(n.size),t={...Jo(n),...es(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),...ts(n),...Di(n),...is(n),...os(n),features:Array.isArray(n.features)?n.features:[]};for(let i of ss)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 Er(n){return Array.isArray(n)?n.filter(e=>typeof e=="string"&&e.length>0):typeof n=="string"&&n.length>0?[n]:[]}function ye(n,e){return Er(n.type).includes(e)}function Sr(n,e,t={}){let i=n.checkboxSelection||n.rowDrag||ye(n,"index")?{resizable:!1,suppressSizeToFit:!0}:{};for(let o of Er(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 ee=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 rt(n){return n.colDef.autoHeight===!0&&!!(n.colDef.valueGetter||n.colDef.valueFormatter)}var te=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 ve(n){return Array.isArray(n.children)}var Le=150,as=80;function j(n,e){let t=I(e.minWidth)??as,i=I(e.maxWidth)??Number.MAX_SAFE_INTEGER,r=I(n)??I(e.width)??Le;return Math.max(t,Math.min(i,r))}function ls(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 Mr(n,e,t){let i=n.map(o=>j(o.width??Le,o)),r=e-i.reduce((o,s)=>o+s,0);return(t?Number.isFinite(e)&&e>0:r>0)&&ls(n,i,r,t?[...i]:n.map(o=>o.flex??0)),i}function Ir(n,e){return Mr(n,e,!1)}function nt(n,e){return Mr(n,e,!0)}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"},Ar={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"},ds={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 ot(n){return ds[n]??"matchEquals"}function W(n,e){return n.replace("{n}",String(e))}function be(n,e,t){return n.replace("{a}",String(e)).replace("{b}",String(t))}var us=[[/^(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 st(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 us)if(r.test(i))return o;return t==null?"neutral":st(t)}function Ei(n={}){return e=>{if(e.value==null||e.value==="")return"";let t=String(e.value),i=Ze(t,e.colDef.status),r=i?.label??Ae(n.labelMap,t)??(e.formatted||t),o=i?.color,s=st(o??t,o?void 0:n.variantMap,r),a=f("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 Si(n={}){return e=>{let t=Number(e.value);if(isNaN(t))return e.formatted;let i=Math.max(0,Math.min(100,t)),r=f("div","mach-progress"),o=f("div","mach-progress__track"),s=f("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=f("span","mach-progress__label");a.textContent=`${Math.round(i)}${n.unit??"%"}`,r.appendChild(a)}return r}}function Mi(n){if(n.value==null||n.value==="")return"";let e=f("span","mach-link");return e.textContent=n.formatted||String(n.value),e}var Ii={edit:'<path d="M11.5 2.5l2 2L5 13H3v-2l8.5-8.5z"/>',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:'<path d="M3.5 3.5l9 9m0-9l-9 9"/>',check:'<path d="M2.5 8.5l3.5 3.5 7.5-8"/>',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 at(n,e=14){let t=Ii[n]??"";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">${t}</svg>`}var re=null,B=null;function kr(n){B&&n.contains(B)&&J()}function J(n=!1){re?.remove(),re=null,B&&(B.setAttribute("aria-expanded","false"),n&&B.isConnected&&B.focus({preventScroll:!0})),B=null,document.removeEventListener("mousedown",Pr,!0),document.removeEventListener("keydown",Ai,!0)}function Pr(n){re&&!re.contains(n.target)&&!B?.contains(n.target)&&J()}function Ai(n){if(!re)return;if(n.key==="Escape"){n.preventDefault(),J(!0);return}let e=[...re.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 Gr(n,e){let t=f("button",e);return t.type="button",n.variant&&n.variant!=="default"&&t.classList.add(`${e}--${n.variant}`),t.disabled=n.disabled===!0,n.icon&&Ii[n.icon]?(t.innerHTML=at(n.icon,16),t.appendChild(f("span")).textContent=n.label):t.textContent=n.label,t.addEventListener("click",()=>n.pick(t)),t}function cs(n,e){J();let t=f("div","mach-context-menu mach-action-menu");t.setAttribute("role","menu");for(let i of e){let r=Gr(i,"mach-context-menu-item");r.setAttribute("role","menuitem"),t.appendChild(r)}A(t,n.closest(".mach-root")),document.body.appendChild(t),Z(t,n),re=t,B=n,n.setAttribute("aria-expanded","true"),document.addEventListener("mousedown",Pr,!0),document.addEventListener("keydown",Ai,!0),t.querySelector("button:not(:disabled)")?.focus({preventScroll:!0})}function hs(n,e,t){J();let i=f("div","mach-action-drawer-backdrop"),r=f("section","mach-action-drawer");r.setAttribute("role","dialog"),r.setAttribute("aria-modal","true"),r.setAttribute("aria-label",e);let o=f("header","mach-action-drawer__header"),s=f("strong");s.textContent=e;let a=f("button","mach-action-drawer__close");a.type="button",a.setAttribute("aria-label","Close"),a.title="Close",a.innerHTML=at("close",16),a.addEventListener("click",()=>J(!0)),o.append(s,a);let l=f("div","mach-action-drawer__body");for(let d of t)l.appendChild(Gr(d,"mach-action-drawer__item"));r.append(o,l),i.appendChild(r),i.addEventListener("mousedown",d=>{d.target===i&&J(!0)}),A(i,n.closest(".mach-root")),document.body.appendChild(i),re=i,B=n,n.setAttribute("aria-expanded","true"),document.addEventListener("keydown",Ai,!0),r.querySelector("button:not(:disabled)")?.focus({preventScroll:!0})}function ie(n,e){if(typeof n=="function")try{return n(e)}catch{return!1}return n===!0}function Lr(n){return n.variant??"default"}function Nr(n){return n.permission?typeof n.permission=="string"?[n.permission]:n.permission:[]}function ki(n,e,t){return{...n.id?{actionId:n.id}:{},permissions:Nr(n),...t?{message:t}:{},params:e}}function lt(n,e,t){let i=t.api.getOption("actionPolicy");try{i?.onError?i.onError(n,ki(e,t)):console.error("[mach-table] action handler failed",n)}catch(r){console.error("[mach-table] action error policy failed",r,n)}}function ps(n,e){if(Nr(n).length===0)return!0;let i=e.api.getOption("actionPolicy");if(!i?.canAccess)return!0;try{return i.canAccess(ki(n,e))}catch(r){return lt(r,n,e),!1}}function fs(n,e){return n.filter(t=>{if(!ps(t,e))return!1;if(!t.show)return!0;try{return t.show(e)}catch{return!1}})}function Pi(n,e,t){t.isConnected&&(t.disabled=ie(n.disabled,e)||ie(n.loading,e),t.classList.toggle("mach-action-btn--loading",ie(n.loading,e)))}function ms(n,e,t,i){Promise.resolve(n).catch(r=>lt(r,e,t)).finally(()=>Pi(e,t,i))}function gs(n,e,t){try{ms(n.onClick(e),n,e,t)}catch(i){lt(i,n,e),Pi(n,e,t)}}function Ri(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(ki(e,t,i)):typeof window>"u"||typeof window.confirm!="function"?!1:window.confirm(i)}function ys(n,e){if(n.confirm==null||n.confirm===!1)return!0;if(typeof n.confirm!="function")return Ri(n.confirm,n,e);let t=n.confirm(e);return t instanceof Promise?t.then(i=>Ri(i,n,e)):Ri(t,n,e)}function vs(n){return(e,t)=>{if(ie(e.disabled,n))return;if(t.disabled=!0,t.classList.add("mach-action-btn--loading"),e.confirm==null||e.confirm===!1){gs(e,n,t);return}(async()=>{await ys(e,n)&&await e.onClick(n)})().catch(r=>lt(r,e,n)).finally(()=>{Pi(e,n,t)})}}function bs(n,e,t){let i=f("button","mach-action-btn");i.type="button";let r=Lr(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=ie(n.disabled,e),ie(n.loading,e)&&(i.disabled=!0,i.classList.add("mach-action-btn--loading")),n.icon&&Ii[n.icon]?(i.innerHTML=at(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 ws(n,e,t,i,r){let o=f("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=`${at("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:Lr(u),disabled:ie(u.disabled,i)||ie(u.loading,i),pick:c=>{J(),r(u,c)}}));e==="drawer"?hs(o,t.drawerTitle??a,d):cs(o,d)}),o}function Ce(n){let e=Math.max(0,n.max??3),t=n.overflow??"menu";return i=>{let r=fs(n.actions,i);if(r.length===0)return"";let o=f("div","mach-actions"),s=t==="inline"?r:r.slice(0,e),a=t==="inline"?[]:r.slice(e),l=vs(i);for(let d of s)o.appendChild(bs(d,i,l));return a.length>0&&o.appendChild(ws(a,t,n,i,l)),{el:o,destroy:()=>{B&&o.contains(B)&&J()}}}}function we(n,e,t){return n??e??t}function Cs(n,e){let t=e.api.getOption("locale")??{};return{view:we(n.labels?.view,t.actionView,V.actionView),edit:we(n.labels?.edit,t.actionEdit,V.actionEdit),delete:we(n.labels?.delete,t.actionDelete,V.actionDelete),confirm:we(n.labels?.confirm,t.actionConfirm,V.actionConfirm),save:we(n.labels?.save,t.actionSave,V.actionSave),cancel:we(n.labels?.cancel,t.actionCancel,V.actionCancel)}}function Ts(n,e,t){let i=async()=>{if(!await e.api.editing.stop()||!n.onSave)return;let s=e.api.editing.getChanges().filter(a=>a.rowId===e.node.id);try{await n.onSave(e,s),e.api.editing.markSaved([e.node.id])}catch(a){throw e.api.editing.startRow(e.rowIndex),a}},r=n.onSave?t.save:n.labels?.confirm??n.labels?.save??t.confirm;return Ce({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 Ds(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 dt(n={}){return e=>{let t=Cs(n,e);if(e.api.editing.isRowActive(e.rowIndex))return Ts(n,e,t);let i=Ds(n,e,t);return Ce({actions:i,max:n.max,overflow:n.overflow??"menu",moreLabel:n.moreLabel,drawerTitle:n.drawerTitle})(e)}}var xs=Ei(),Rs=Si(),Fr=Object.freeze({statusTag:xs,progressBar:Rs,link:Mi});var Ne={sortable:!1,resizable:!1,movable:!1,filter:!1,suppressSizeToFit:!0,suppressColumnMenu:!0};function Or(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 ut(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 Hr(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 Vr(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:Ce(i),...Ne,cellRendererParams:void 0}}function Br(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:dt(i),...Ne,cellRendererParams:void 0}}var Gi="__rg_detail_toggle__";function Fe(n){return I(n)!==void 0}function zr(n){return n===!0?"left":n||null}function _r(n,e){let t=e;for(let i=2;n.has(t);i++)t=`${e}_${i}`;return n.add(t),t}function Es(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!==zr(t.pinned)&&(n.pinned=e.pinned)}var ct=class{constructor(e){this.e=e;this.J=[];this.Cr=new Map;this.fe=[];this.to=[];this.Tr=[];this.ro=[];this.me=[];this.Dr=[];this.Rt=new Map;this.Yt=1;this.no=new Map;this.la=0;this.Je=!1}Ei(e){this.Dr=e?[...e]:[];let t=new Map(this.J.map(u=>[u.id,u])),i=this.e.t.defaultColDef,r=this.e.t.masterDetail&&this.e.t.detailToggleColumn,o=new Set(r?[Gi]:[]),s=this.e.t.rowNumber,a=(u,c,h)=>u.map((p,m)=>{if(ve(p)){let $=p.groupId??p.headerName??`group_${m}_${h}`,K=new te($,p);return K.parent=c,K.children=a(p.children,K,h+1),K}let g=p,b=_r(o,g.colId??g.field??`col_${m}`),T=new ee(b,Sr(g,i,this.e.t.columnTypes));s&&(s=!ye(T.colDef,"index")),T.parentGroup=c,T.level=h;let G=t.get(b);return G&&!G.isAutoRowNumber&&Es(T,G),T});if(this.fe=a(this.Dr,null,0),s&&o.size>Number(r)&&this.bu(_r(o,"idx"),t),r){let u=new ee(Gi,{colId:Gi,headerName:"",width:38,pinned:"left",sortable:!1,resizable:!1,movable:!1,filter:!1});u.isDetailToggle=!0,this.fe.unshift(u)}this.Rt.size&&this.wu(),this.J=this.xr(this.fe),this.Cr=new Map(this.J.map(u=>[u.id,u])),this.Yt=this.J.reduce((u,c)=>Math.max(u,c.level+1),1);let l=this.me.length;this.me=this.me.filter(u=>this.Cr.has(u.colId));let d=this.me.length!==l;if(this.me.length===0){let u=[];for(let c of this.J)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 ee(e,ut({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 ee&&(s.hasCheckbox||s.colDef.rowDrag)));this.fe.splice(o===-1?this.fe.length:o,0,i)}xr(e,t=[]){for(let i of e)i instanceof te?this.xr(i.children,t):t.push(i);return t}Xt(){this.Je=!1;let e=this.J.filter(t=>!t.hide);this.to=e.filter(t=>t.pinned==="left"),this.ro=e.filter(t=>t.pinned==="right"),this.Tr=e.filter(t=>t.pinned===null),this.no.clear(),this.l().forEach((t,i)=>this.no.set(t.id,i))}Z(e){return this.no.get(e)??-1}Q(){return this.J}oo(){return this.Dr}Cu(){return this.fe}Tu(){return this.Yt}R(e){return this.Cr.get(e)}y(e){return e==="left"?this.to:e==="right"?this.ro:this.Tr}l(){return[...this.to,...this.Tr,...this.ro]}Ze(){return this.l().filter(e=>e.colDef.rowGroup===!0)}Du(){return this.l().filter(e=>e.colDef.aggFunc!=null&&e.colDef.rowGroup!==!0)}da(){let e=this.l();return this.Tr.find(X)??e.find(X)??e[0]}ge(e){return e.pinned==="left"?"left":e.pinned==="right"?"right":"center"}ua(e){let t=this.e.n.ye.clientWidth,i=this.Je&&t===this.la;this.la=t;let r=e,o=[],s=[];for(let l of this.l()){let d=this.Rr(l);i||l.pinned!=null||l.colDef.suppressSizeToFit||l.manualWidth!=null?(l.currentWidth=j(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=j(u.width??Le,u)}});let a=this.e.t.columnLayout==="fit"?nt(s,Math.max(0,r)):Ir(s,Math.max(0,r));o.forEach((l,d)=>{l.currentWidth=a[d]})}Rr(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.Je=!0,e.manualWidth=j(t,this.Rr(e)),e.flex=null,!0):!1}ca(e,t){return Fe(t)?(this.Je=!1,e.resetWidth(),e.contentWidth=j(t,this.Rr(e)),!0):!1}so(e,t){let i=this.R(e);!i||i.hide===!t||(i.hide=!t,this.Xt())}Si(e,t){let i=this.R(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 ee&&!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.Rt.set(this.ha(i),a.filter(c=>c.movable).map(c=>c.id)),this.J=this.xr(this.fe),this.Xt(),!0}ao(e,t){let i=this.R(e);!i||!i.movable||(i.pinned=t,this.Xt())}pa(e=!0){return(e?this.J:this.J.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}))}fa(e){let t=new Map(e.map(i=>[i.colId,i]));for(let i of this.J){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(),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=j(t.contentWidth,this.Rr(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.lo(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.Rt.set(r,i.map(s=>s.id))}),this.J=this.xr(this.fe)}ha(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.lo(t=>t.movable,(t,i)=>{let r=this.Rt.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.Rt=e}lo(e,t,i=this.fe){let r=new Map;i.forEach((o,s)=>{if(o instanceof te)this.lo(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.ha(s[0])),o.forEach((a,l)=>{i[a]=s[l]})}}uo(){for(let e of this.J)e.resetWidth(),e.hide=e.colDef.hide??!1,e.pinned=zr(e.colDef.pinned);if(this.Rt.size){this.Rt.clear(),this.Ei(this.Dr);return}this.Xt()}ee(){return this.me.map(e=>({...e}))}Mi(e){if(!e||e.length===0){this.me=[];return}this.me=e.filter(t=>this.Cr.has(t.colId)&&(t.direction==="asc"||t.direction==="desc")).map(t=>({colId:t.colId,direction:t.direction}))}Er(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 ne(n,e){if(n instanceof Error)return n;let t=new Error(typeof n=="string"?n:e);return t.name="AbortError",t}var Ss=()=>ne(void 0,"[MachTable] Operation cancelled.");function ht(n,e,t=Ss){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 Wr(n){return n==null?"":String(n).toLowerCase()}function Ni(n,e,t){return n.length===0||(e==="or"?n.some(t):n.every(t))}function Ms(n,e,t){let i=Wr(n);return Ni(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 $r(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 Is(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:$r(i,r,e.match,e.value2??r)}function As(n,e,t){return Ni(e,t,r=>Is(n,r))}function Li(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 ks(n,e,t){let i=Li(n);return Ni(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=Li(o.value);if(a==null)return!1;let l=o.match==="inRange"?Li(o.value2)??1/0:a;return $r(i,a,o.match,l)})}function Ps(n,e){return e.length===0?!0:e.some(t=>t==null&&n==null||t===n)}function Gs(n,e){let t=e.type!=="set"&&e.operator==="or"?"or":"and";switch(e.type){case"text":return Ms(n,e.conditions,t);case"number":return As(n,e.conditions,t);case"date":return ks(n,e.conditions,t);case"set":return Ps(n,e.values);default:return!0}}function Kr(n,e,t){return i=>Gs(t(i,n),e)}function Ur(n,e,t){if(n.kind==="condition"){let r=e.get(n.colId);return r?Kr(r,n.filter,t):()=>!0}let i=n.children.map(r=>Ur(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 Fi(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?[Kr(u,d,r)]:[]});t&&s.push(Ur(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=>Wr(r(l,u)).includes(d)))}var jr=typeof Intl<"u"?new Intl.Collator(void 0,{numeric:!0,sensitivity:"base"}):null;function Ls(n,e){let t=n==null||n==="",i=e==null||e==="";return!t&&!i?null:t&&i?0:t?1:-1}function Ns(n,e){let t=Number.isNaN(n),i=Number.isNaN(e);return t||i?t===i?0:t?1:-1:n-e}function Fs(n,e){return n===e?0:n?1:-1}function pt(n,e){let t=Ls(n,e);if(t!==null)return t;if(typeof n=="number"&&typeof e=="number")return Ns(n,e);if(n instanceof Date&&e instanceof Date)return n.getTime()-e.getTime();if(typeof n=="boolean"&&typeof e=="boolean")return Fs(n,e);let i=String(n),r=String(e);return jr?jr.compare(i,r):i.localeCompare(r)}function Oi(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??pt,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 qr(){return{count:0,numeric:0,sum:0,min:1/0,max:-1/0}}function Yr(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 Xr(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 ft(n,e){let t=qr();for(let i of n)Yr(t,i);return Xr(t,e)}var Oe={sum:n=>ft(n,"sum"),avg:n=>ft(n,"avg"),count:n=>n.length,min:n=>ft(n,"min"),max:n=>ft(n,"max"),first:n=>n.length>0?n[0]:null,last:n=>n.length>0?n[n.length-1]:null};function Jr(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=qr();for(let o of n)Yr(r,t(o));return Xr(r,i)}function mt(n){let e={...Oe,...n??{}};return t=>e[t]}var gt="group:";function Zr(n){return n==null?"null":n instanceof Date?JSON.stringify(["date",String(n.getTime())]):JSON.stringify([typeof n,Hi(n)])}function Hi(n){return n==null?"(\u7A7A)":String(n)}function Qr(n){return gt+JSON.stringify(n)}function Os(n,e,t){let i=new Map;for(let r of n){let o=t(r,e),s=Zr(o),a=i.get(s);a||(a={key:s,label:Hi(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 en(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 Os(a,e[l],t)){let p=[...d,[e[l].id,h.key]],m=Qr(p);o.push(m);let g=s(h.rows,l+1,p);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 tn(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,Zr(h)]),u+=`/g${c}:${Hi(h)}`,!r.has(u))continue;let p=Qr(d);o.set(u,o.has(u)&&o.get(u)!==p?null:p)}}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 Hs(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 rn(n){let e=new Set(Object.keys(n.filterModel));Hs(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 nn(n){return n!=null&&(typeof n=="object"||typeof n=="function")}function on(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(nn)||t.set(i,r)}return t}function sn(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 nn(s)||!Object.is(i[o],s)}):!1}function ae(n){return ne(n.reason,"Block request aborted")}function yt(n){return Number.isFinite(n)?Math.max(1,Math.trunc(n)):1}var vt=class{constructor(e,t,i=4){this.maxBlocks=e;this.fo=t;this.maxConcurrentRequests=i;this.te=new Map;this.q=new Map;this.ma=0;this.co=0;this.ho=0;this.ga=0;this.ya=0;this.Sr=0;this.Mr=new Set;this.maxBlocks=yt(e),this.maxConcurrentRequests=yt(i)}configure(e,t=this.maxConcurrentRequests){this.maxBlocks=yt(e),this.maxConcurrentRequests=yt(t),this.po(),this.Ir()}Eu(e){this.Mr=e,this.po()}peek(e){let t=this.te.get(e);if(t)return t.touchedAt=++this.ma,t}has(e){return this.te.has(e)}Jt(e){let t=this.q.get(e);t&&(this.q.delete(e),t.controller.abort(),t.state==="queued"&&t.reject(ae(t.controller.signal)));let i=this.te.get(e);i&&(this.te.delete(e),this.fo?.(e,i))}load(e,t,i,r=0){if(i?.aborted)return Promise.reject(ae(i));let o=this.peek(e);if(o)return this.ho++,Promise.resolve(o);let s=this.q.get(e);if(s)return this.ho++,s.priority=Math.max(s.priority,r),this.Ir(),this.va(e,s,i);this.ga++;let a=new AbortController,l,d,u=new Promise((p,m)=>{l=p,d=m}),c={controller:a,promise:u,consumers:0,loader:t,priority:r,state:"queued",resolve:l,reject:d};this.q.set(e,c);let h=this.va(e,c,i);return this.Ir(),h}Su(){this.co++,this.Mr.clear();for(let e of this.q.values())e.controller.abort(),e.state==="queued"&&e.reject(ae(e.controller.signal));this.q.clear();for(let[e,t]of this.te)this.fo?.(e,t);this.te.clear()}snapshot(){let e=0,t=0;for(let i of this.te.values())e+=i.rows.length;for(let i of this.q.values())i.state==="active"&&t++;return{cachedBlockCount:this.te.size,loadingBlockCount:this.q.size,activeRequestCount:t,queuedRequestCount:Math.max(0,this.q.size-t),cachedRowCount:e,hitCount:this.ho,missCount:this.ga,evictionCount:this.ya}}Ir(){for(;this.Sr<this.maxConcurrentRequests;){let e,t;for(let[i,r]of this.q)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.Sr++;let i=this.co;this.Iu(t).then(r=>{i===this.co&&!t.controller.signal.aborted&&(this.te.set(e,{rows:r.rows,...r.lastRow==null?{}:{lastRow:r.lastRow},touchedAt:++this.ma}),this.po()),t.resolve(r)},t.reject).finally(()=>{this.Sr=Math.max(0,this.Sr-1),this.q.get(e)===t&&this.q.delete(e),this.Ir()})}Iu(e){let{signal:t}=e.controller;return ht(Promise.resolve().then(()=>{if(t.aborted)throw ae(t);return e.loader(t)}),t,()=>ae(t))}va(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.q.get(e)===t&&(this.q.delete(e),t.controller.abort(i?.reason),t.state==="queued"&&t.reject(ae(t.controller.signal))),o(ae(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")))))})}po(){let e=Math.max(this.maxBlocks,this.Mr.size+1);for(;this.te.size>e;){let t=-1,i=Number.POSITIVE_INFINITY;for(let[o,s]of this.te)this.Mr.has(o)||s.touchedAt<i&&(t=o,i=s.touchedAt);if(t<0)return;let r=this.te.get(t);this.te.delete(t),this.ya++,r&&this.fo?.(t,r)}}};function Te(n,e){if(n==null||typeof n!="object")return;let t=n[e];return Array.isArray(t)?t:void 0}function De(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=Te(r,e);o?.length&&(i.add(r),De(o,e,t+1,i),i.delete(r))}}var bt=class{constructor(e){this.e=e;this.c=[];this._=[];this.ie=new Map;this.ve=[];this.p=new Map;this.Se={};this.Me=null;this.Ve=null;this.P=new Set;this.z=new Set;this.Ii=[];this.Ai=new Map;this.ba=[];this.G=null;this.ki=!1;this.wa=!1;this.Qe=0;this.Ar=null;this.kr=new WeakMap;this.Pr=new WeakMap;this.et=new Map;this.Pi=new Map;this.Gr=0;this.Lr=0;this.tt=null;this.it=new Map;this.Et=new Map;this.Nr=new Set;this.St=new Map;this.rt=new vt(12,e=>this.Ca(e));this.Gi=0;this.Fr=null;this.mo=!1;this.Ta=0;this.we=[];this.H=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"}Li(){if(this.g){if(this.be)return this.Zt();let e=Math.max(0,this.ve.length-this.c.length);return(this.G??this.c.length)+e}return this.ve.length}Ni(){return this.Gr}Be(){return this.Lr}Au(){return this.wa}Or(e){return!this.g||e?.aborted?Promise.resolve():(this.Da(!0),this.be?(this.rt.configure(this.e.t.maxBlocksInCache,this.e.t.datasourceMaxConcurrentRequests),this.Hr(0,e)):this.xa(0,void 0,e))}Mt(e){this.wa=e,this.e.n.Mt(e,this.e.u("loading"))}xa(e,t,i){if(!this.g||this.ki||this.G!=null&&e>=this.G)return Promise.resolve();let r=this.e.t.blockSize,o=t??e+r;if(o<=e)return Promise.resolve();let s=++this.Qe,a=new AbortController,l=()=>a.abort(i?.reason);return i?.addEventListener("abort",l,{once:!0}),this.Ar=a,this.ki=!0,this.Mt(!0),new Promise(d=>{let u=c=>{i?.removeEventListener("abort",l),s===this.Qe&&(this.ki=!1,this.Ar=null,this.Mt(!1),c!=null&&c?.name!=="AbortError"&&this.e.reportError(c,"datasource.getRows",{startRow:e,endRow:o})),d()};this.Ra(e,o,a.signal,(c,h)=>{if(s!==this.Qe||this.e.o()||a.signal.aborted){u();return}typeof h=="number"&&h>=0?this.G=h:c.length<o-e&&(this.G=e+c.length);let p=this.c.length===0;this.ku(c),u(),this.I(),p&&this.e.Ie(),this.e.W.Vr()},c=>u(a.signal.aborted||this.e.o()?void 0:c??new Error("Datasource request failed")))})}go(){this.Qe++,this.Ar?.abort(),this.Ar=null,this.ki=!1,this.Mt(!1),this.rt.Su(),this.it.clear(),this.Et.clear(),this.Nr.clear();for(let[e,t]of this.St)this.p.get(e)===t&&this.p.delete(e);this.St.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.Br(r)};this.c.push(o),this.p.set(r,o),this._.push(o)}}Hr(e,t,i=0){if(!this.be||e<0)return Promise.resolve();if(t?.aborted)return Promise.reject(this.Ea(t.reason));let r=this.e.t.blockSize,o=this.Qe,s=e*r;if(s>=this.Zt())return Promise.resolve();let a=this.G==null?s+r:Math.min(this.G,s+r),l=this.rt.load(e,d=>this.Pu(s,a,d),t,i);return this.Mt(this.c.length===0&&this.rt.snapshot().loadingBlockCount>0),l.then(d=>{o!==this.Qe||t?.aborted||this.e.o()||!this.be||!this.rt.has(e)||this.Nr.has(e)||(this.Gu(e,d),this.I(),this.e.W.Vr(),o===this.Qe&&!this.e.o()&&this.Sa(this.e.s.yo().lastExcl-1))}).catch(d=>{throw d?.name!=="AbortError"&&this.e.reportError(d,"datasource.getRows",{startRow:s,endRow:a}),d}).finally(()=>{o===this.Qe&&this.Mt(this.c.length===0&&this.rt.snapshot().loadingBlockCount>0)})}Pu(e,t,i){return new Promise((r,o)=>{this.Ra(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")))})}Ra(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.Ea(i.reason))};i.addEventListener("abort",c,{once:!0});let h=()=>{if(d)return;if(i.aborted||this.e.o()){c();return}a++;let p=!1,m=g=>{if(!(p||d)){if(p=!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.ee(),filterModel:this._e(),advancedFilterModel:this.Fi(),quickFilterText:this.Ve,signal:i,onSuccess:(b,T)=>{!p&&u()&&r(b??[],T)},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.Ca(e),typeof t.lastRow=="number"&&t.lastRow>=0?this.G=t.lastRow:t.rows.length<i&&(this.G=r+t.rows.length),t.rows.forEach((o,s)=>{if(o==null)return;let a=r+s;if(this.G!=null&&a>=this.G)return;let l=this.resolveRowId(o,a,`block-${a}`),d=this.St.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.Br(l)};c.rowIndex=a,c.selected=this.e.f.Br(l),this.St.delete(l),this.it.set(a,c),this.Et.delete(a),this.p.set(l,c),this.Pr.set(c,a+1)}),this.Ma(),this.Nr.add(e)}Ca(e){this.Nr.delete(e);let t=this.e.t.blockSize,i=e*t,r;for(let o=i;o<i+t;o++){let s=this.it.get(o);s&&(r??(r=new Set(this.e.$.getDirtyRowIds())),this.it.delete(o),r.has(s.id)?this.St.set(s.id,s):this.p.get(s.id)===s&&this.p.delete(s.id))}this.Ma()}Ma(){this.c=[...this.it.entries()].sort(([e],[t])=>e-t).map(([,e])=>e),this._=this.c}Zt(){if(this.G!=null)return this.G;if(this.e.t.datasourceRowCount!=null)return this.e.t.datasourceRowCount;if(this.it.size===0)return this.e.t.blockSize;let e=0;for(let t of this.it.keys())e=Math.max(e,t+1);return e+this.e.t.blockSize}Lu(e){let t=this.Et.get(e);if(!t&&(t={id:`__mach_loading_${e}`,data:null,rowIndex:e,selected:!1,loading:!0},this.Et.set(e,t),this.Et.size>2e3)){let i=this.Et.keys().next().value;i!=null&&this.Et.delete(i)}return t}Ea(e){return ne(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.Sa(e);return}if(!this.g||this.ki)return;let t=this.c.length;if(this.G!=null&&t>=this.G)return;let i=this.e.t.infiniteBufferRows;if(e+i<t&&e<t)return;let r=this.e.t.blockSize,o=this.G==null?t+r:Math.min(this.G,t+r);this.xa(t,o)}Sa(e){if(e<0)return;this.Ia();let t=this.e.t.blockSize,i=Math.floor(e/t),r=Math.floor(this.e.s.yo().first/t),o=this.e.t.blockPrefetch,s=i<this.Ta?-1:1;this.Ta=i;for(let a=r;a<i;a++)this.Hr(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.Hr(d,void 0,o-a+1).catch(()=>{})}}Aa(){return this.Or().catch(()=>{})}Fu(){return this.go(),this.g?this.Or().catch(()=>{}):(this.G=null,this.nt(this.e.t.rowData),this.e.K({data:!0}),Promise.resolve())}destroy(){this.tt=null,this.go(),this.ka(),this.vo(),this.c=this._=this.ve=this.we=[],this.p.clear(),this.ie.clear(),this.Ai.clear(),this.ba=[],this.P.clear(),this.z.clear(),this.Ii=[]}bo(e,t,i){if(!this.be)return Promise.resolve();this.Ia();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.Hr(u,i,100));return Promise.all(d).then(()=>{})}Ou(){this.be&&this.Da(!1)}Da(e){this.Pa(),this.e.$.clear(),this.go(),e&&(this.G=null,this.P.clear()),this.c=[],this._=[],this.p.clear(),this.e.O.clear(),this.I()}Pa(){this.Lr++,this.e.ze(),this.e.api.editing.stop({cancel:!0})}Hu(){return this.rt.snapshot()}Ia(){let e=new Set(this.e.$.getDirtyRowIds());for(let[l,d]of this.St)e.has(l)||(this.St.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.yo();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.rt.Eu(i)}nt(e){let t=this.e.t.resolveRowId,i=this.e.t.childrenKey;this.M&&De(e??[],i);let r=[],o=[],s=new Map,a=new Map,l=0,d=(u,c,h)=>{let p=l++,m=this.resolveRowId(u,p,`auto-${p}`);if(s.has(m))return this.e.reportError(new Error(`Duplicate row id: ${m}`),"rowData",{rowId:m,index:p}),null;let g=this.M?Te(u,i):void 0,b={id:m,data:u,rowIndex:-1,selected:!1,treeChildrenLoaded:Array.isArray(g)};if(this.kr.set(b,c),r.push(b),s.set(m,b),h!=null){let T=a.get(h)??[];T.push(m),a.set(h,T)}else o.push(b);if(this.M&&Array.isArray(g))for(let T of g)T!=null&&d(T,c+1,m);return b};(e??[]).forEach(u=>{u!=null&&d(u,0,null)}),this.e.t.rowData=e??[],this.Pa(),this.ka(),this.e.$.clear(),this.c=r,this._=o,this.ie=a,this.p=s,this.e.O.clear();for(let u of[...this.P])s.has(u)||this.P.delete(u);if(this.e.t.defaultExpandAll)for(let u of r)this.Ga(u.id)>0&&this.P.add(u.id);this.e.f.La(t!=null),this._r()}Oi(e){return this.ie.get(e)??[]}Ga(e){return this.ie.get(e)?.length??0}wo(e){return this.Ga(e)>0}isTreeRowLoading(e){return this.p.get(e)?.treeLoading===!0}ka(){for(let e of this.et.values())e.abort();this.et.clear(),this.Pi.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.Oi(e).flatMap(l=>{let d=this.p.get(l)?.data;return d==null?[]:[d]}));let o=this.Pi.get(e);if(o&&!t)return o;this.et.get(e)?.abort();let s=new AbortController;this.et.set(e,s),i.treeLoading=!0,i.treeLoadError=void 0,this.e.K({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.et.get(e)===s&&(this.et.delete(e),this.Pi.delete(e),i.treeLoading=!1,this.e.K({data:!0}))});return this.Pi.set(e,a),a}Bu(e,t){let i=new Set,r=[...this.Oi(e.id)];for(;r.length>0;){let s=r.pop();i.has(s)||(i.add(s),r.push(...this.Oi(s)))}this._u(t,i,this.zr(e)+1);for(let s of i)this.et.get(s)?.abort(),this.et.delete(s),this.Pi.delete(s),this.ie.delete(s),this.p.delete(s),this.P.delete(s);this.ie.delete(e.id);let o=this.zr(e)+1;for(let s of t)s!=null&&this.Co(e,s,o);this.Na(),this.e.f.La(this.e.t.resolveRowId!=null),this.I()}_u(e,t,i){De(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=Te(l,this.e.t.childrenKey);d&&s.push(...d)}}Hi(e,t=!0){this.M&&e.add?.length&&De(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 p=[this.resolveRowId(c,-1,`__missing_remove_${this.e.Qt()}`)];for(;p.length>0;){let m=p.pop();if(!a.has(m)){a.add(m);for(let g of this.ie.get(m)??[])p.push(g)}}}else{let h=[c];for(;h.length>0;){let p=h.pop();l.add(p);let m=this.M?Te(p,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.ie.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.Wr(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.kr.set(h,0);let p=this.M?Te(d,this.e.t.childrenKey):void 0;if(p)for(let m of p)m!=null&&this.Co(h,m,1);l.push(h)}),this._=this._.slice(0,a).concat(l,this._.slice(a)),this.Na()}let s={pipelineChanged:this.zu(e,r),updatedRowIds:r.map(({node:a})=>a.id)};return this.e.O.Wu(o),this.$u(s,t),this.e.$.Ku(o),s}$u(e,t){e.pipelineChanged&&(this.tt=null),t&&(e.pipelineChanged?this._r():e.updatedRowIds.length&&this.Fa())}Uu(e){if(e.length===0)return{pipelineChanged:!1,updatedRowIds:[]};let t=this.Lr,i=!1,r=new Set;for(let o of e){let s=this.Hi(o,!1);if(this.Lr!==t)return{pipelineChanged:!1,updatedRowIds:[]};i||(i=s.pipelineChanged);for(let a of s.updatedRowIds)r.add(a)}return i?this._r():r.size>0&&this.Fa(),{pipelineChanged:i,updatedRowIds:[...r]}}zu(e,t){if(e.add?.length||e.remove?.length)return!0;if(!t.length)return!1;let i=this.Oa();if(i===null)return!0;if(!i.length)return!1;let r=this.tt;return!r||i.length!==r.fields.length||i.some((o,s)=>o!==r.fields[s])?!0:t.some(({node:o,before:s,after:a})=>sn(s,a,i,r.values.get(o)))}Oa(){if(this.M||this.e.t.masterDetail||this.Ha())return null;let e=this.e.r.l();if(e.some(i=>rt(i)||i.colDef.autoRowSpan===!0||i.colDef.rowSpan!=null))return null;let t=!this.e.t.manualFiltering;return rn({columns:e,customAggregates:this.e.t.aggFuncs,sortModel:this.e.t.manualSorting?[]:this.e.r.ee(),filterModel:t?this.Se:{},advancedFilter:t?this.Me:null,quickFilter:t?this.Ve:null})}ju(){let e=this.Oa(),t=e?.length?on(this.c,e):null;this.tt=e&&t?{fields:e,values:t}:null}Fa(){this.e.emit("modelUpdated",{rowCount:this.we.length})}Co(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=Te(t,this.e.t.childrenKey),s={id:r,data:t,rowIndex:-1,selected:!1,treeChildrenLoaded:Array.isArray(o)};this.p.set(r,s),this.kr.set(s,i);let a=this.ie.get(e.id)??[];if(a.push(s.id),this.ie.set(e.id,a),!!o)for(let l of o)l!=null&&this.Co(s,l,i+1)}Na(){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.ie.get(t.id)??[]){let r=this.p.get(i);r&&e(r)}};for(let t of this._)e(t)}It(e){let t=JSON.stringify(this.Se),i=new Set(this.e.r.Q().map(o=>o.id));this.Se=Q(e,i);let r=JSON.stringify(this.Se)!==t;return r&&(this.tt=null),r}_e(){return{...this.Se}}qu(e=this.Me){let t=Object.keys(this.Se).length>0&&this.It(this.Se),i=(e!=null||this.Me!=null)&&this.ot(e);return t||i}ot(e){let t=new Set(this.e.r.Q().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.tt=null),o}Fi(){return H(this.Me)}At(e){let t=e!=null&&e.trim()!==""?e:null;return t===this.Ve?!1:(this.Ve=t,this.tt=null,!0)}To(){return this.Ve}Vi(){return Object.keys(this.Se).length>0||this.Me!=null||this.Ve!=null}I(){this._r(),this.e.K({data:!0})}Do(){this.g?this.Aa():this.I()}_r(){this.tt=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.Vi()&&!this.e.t.manualFiltering&&(r=r.filter(Fi(t,this.Se,this.Me,this.Ve,i)));let a=this.e.r.ee();if(a.length>0&&!this.e.t.manualSorting)try{r=Oi(r,a,t,i)}catch(d){this.e.reportError(d,"comparator",{sortModel:a})}let l=this.e.r.Ze();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.P.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.Va(r,e,!0),this.Qu(o)}Va(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.Pr.set(o,++r)}),this.we=e,this.Bi(),i&&this.ju(),this.ec((o,s)=>this.e.d(o,s)),this.e.emit("modelUpdated",{rowCount:e.length}),this.e.Ce.Ba(t)}Yu(e){this.c.forEach((t,i)=>{this.be||(t.rowIndex=i),this.Pr.set(t,this.be?t.rowIndex+1:i+1)}),this.ve=this.c,this.we=this.c,this.Ai.clear(),this.e.t.getRowHeight&&this.e.s.st(),this.Gr++,this.e.emit("modelUpdated",{rowCount:this.c.length}),this.e.Ce.Ba(e)}Xu(e){let t=this.mo;return this.mo=!1,!t&&this.Ha()?(this.tc(e),!0):(this.vo(),!1)}Ha(){if(!this.e.t.dataProcessor||this.c.length<this.e.t.dataProcessorMinRows||this.M||this.e.t.masterDetail||this.e.r.Ze().length>0)return!1;let e=!this.e.t.manualFiltering&&this.Vi(),t=!this.e.t.manualSorting&&this.e.r.ee().length>0;return e||t}tc(e){this.vo();let t=this.e.t.dataProcessor;if(!t)return;let i=++this.Gi,r=new AbortController;this.Fr=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.ee():[],filterModel:a?this._e():{},advancedFilterModel:a?this.Fi():null,quickFilterText:a?this.Ve:null,signal:r.signal})).then(d=>{if(i!==this.Gi||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 p=this.p.get(h);p&&!p.isDetail&&!p.isGroup&&c.push(p)}this.Va(c,e),this.e.K({data:!0})}).catch(d=>{i!==this.Gi||r.signal.aborted||this.e.o()||(this.e.reportError(d,"dataProcessor.process"),this.mo=!0,this.I())}).finally(()=>{i===this.Gi&&(this.Fr=null)})}vo(){this.Gi++,this.Fr?.abort(),this.Fr=null}get Te(){return this.e.t.paginationEnabled&&!this.g}Bi(){if(this.e.t.getRowHeight&&this.e.s.st(),!this.Te){this.ve=this.we,this.Gr++;return}let e=this._i(),t=this.getPageCount();this.H>t&&(this.H=t),this.H<1&&(this.H=1),this.e.t.paginationPage=this.H;let i=(this.H-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.Gr++}_i(){return Math.max(1,this.e.t.paginationPageSize)}ei(){return this.Te?this.H:1}getTotalRowCount(){return this.g?this.Li():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._i())):1}_a(){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.H&&(this.H=r,this.e.t.paginationPage=r,this.Bi(),this.e.K({data:!0}),this.e.s.$r(0,"top"),t||this.zi())}setPageSize(e){if(!this.Te)return;let t=Math.max(1,Math.round(e)||this._i()),i=(this.H-1)*this._i();this.e.t.paginationPageSize=t,this.H=Math.floor(i/t)+1,this.e.t.paginationPage=this.H,this.Bi(),this.e.K({data:!0}),this.zi()}za(e,t){this.e.t.paginationPageSize=t,this.H=e,this.e.t.paginationPage=this.H}Wa(e){this.e.t.paginationEnabled!==e&&(this.e.t.paginationEnabled=e&&!this.g,this.e.t.paginationEnabled&&(this.H=1),e||this.we.forEach((t,i)=>{t.rowIndex=i}),this.Bi(),this.e.K({data:!0}),this.zi())}ic(){this.Te&&(this.H=this.e.t.paginationMode==="server"?this.e.t.paginationPage:1,this.Bi(),this.e.K({data:!0}),this.zi())}zi(e=this._i()){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.ee(),r=new Map,o=this.Vi()&&!this.e.t.manualFiltering,s=Fi(e,this.Se,this.Me,this.Ve,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 p of this.ie.get(u.id)??[]){let m=this.p.get(p);m&&a(m)&&(h=!0)}}return r.set(u.id,h),h},l=[],d=u=>{let c=u;i.length>0&&(c=Oi(u,i,e,t));for(let h of c)if(a(h)&&(l.push(h),this.P.has(h.id))){let p=(this.ie.get(h.id)??[]).map(m=>this.p.get(m)).filter(m=>m!=null);d(p)}};return d(this._),l}rc(){let e=this.ba,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&&pt(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.Ai.clear(),this.M||this.e.t.masterDetail||this.e.r.Ze().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.Ai.set(r.id,this.sc(i,r,e))}ac(e){return this.Ai.get(e)}$a(e){return this.Pr.get(e)??0}zr(e){return this.kr.get(e)??0}Zu(e,t){let i=mt(this.e.t.aggFuncs),r=this.e.r.Du();this.Ii=[];let o=l=>{let d={};for(let u of r){let c=i(u.colDef.aggFunc);if(c)try{d[u.id]=Jr(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=tn(this.z,this.c,t,(l,d)=>this.e.d(l,d));this.z=s.expanded;let a=en(e,t,(l,d)=>this.e.d(l,d),o,this.z);return this.Ii=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.wo(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.P.has(e)}lc(){return[...this.P]}dc(){return[...this.z]}uc(e,t){this.P=new Set(e.filter(i=>this.p.has(i))),this.z=new Set(t)}cc(e){return this.xo(e,!0)}hc(e){return this.xo(e,!1)}Kr(e){return this.xo(e,!this.P.has(e))}xo(e,t){let i=this.p.get(e);return!i||t&&!this.isRowExpandable(i)?!1:(t===this.P.has(e)||(t?this.P.add(e):this.P.delete(e),this.I(),this.e.emit("detailToggled",{rowId:e,rowNode:i,expanded:t}),t&&this.M&&!this.wo(e)&&!i.treeLoading&&this.loadTreeChildren(e).catch(()=>{})),t)}setAllDetailsExpanded(e){let t=!1;if(e)for(let i of this.c)!this.P.has(i.id)&&this.isRowExpandable(i)&&(this.P.add(i.id),t=!0);else this.P.size>0&&(this.P.clear(),t=!0);t&&this.I()}Ro(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.Ii)this.z.add(i);else this.z.clear();this.z.size!==t&&this.I()}setGroupExpanded(e,t){return!this.Ii.includes(e)||t===this.z.has(e)||(t?this.z.add(e):this.z.delete(e),this.I()),t}Ka(){return!this.M&&!this.g&&!this.e.t.dataProcessor&&this.e.t.paginationMode!=="server"&&this.e.r.ee().length===0&&this.e.r.Ze().length===0}Ua(e,t){if(!this.Ka()||!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.I(),!0)}He(){return this.c}pc(){return this._}kt(){return this.ve}L(){return this.be?this.Zt():this.ve.length}h(e){return this.be?e<0||e>=this.Zt()?void 0:this.it.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 wt=class{constructor(e){this.e=e;this.N=new Set;this.Pt=null;this.Wi=new Set}Br(e){return this.N.has(e)}gc(e){return this.Wi.has(e)}We(e,t){if(e.loading)return!1;if(e.isGroup||e.isDetail)return!0;let i=t===void 0?this.Eo():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}}Eo(){return this.e.r.l().find(e=>e.hasCheckbox&&e.colDef.selectable!=null)}ti(){return this.e.i.He().filter(e=>this.N.has(e.id))}ja(e=this.ti()){return e.filter(t=>t.data!=null).map(t=>t.data)}So(){return[...this.N]}qa(e){let t=new Set(e),i=this.Eo()??null,r=this.e.i.He().filter(o=>t.has(o.id)&&!o.isDetail&&!o.isGroup&&this.We(o,i)).map(o=>({node:o,selected:!0}));this.Gt(r,!0)}yc(){this.qa(this.e.t.rowSelection==="none"?[]:this.So())}La(e){let t=this.e.i;if(!e)this.N.clear(),this.Pt=null;else{for(let i of this.N)t.F(i)||this.N.delete(i);this.Pt!=null&&!t.F(this.Pt)&&(this.Pt=null)}this.Ya(null);for(let i of t.He())i.selected=this.N.has(i.id)}Xa(e){let{selectable:t,selected:i}=this.Ja(e.leafNodes??[],!1);return{all:i>0&&i===t,some:i>0}}vc(e,t){let i=(e.leafNodes??[]).filter(r=>this.We(r));i.length!==0&&this.Gt(i.map(r=>({node:r,selected:t})))}Mo(e,t,i=!1){this.Gt([{node:e,selected:t,clearOthers:i}])}bc(e,t=!0,i=!0){let r=this.e.i.F(e);r&&this.Mo(r,t,i)}wc(e,t,i){if(!i||!t.shiftKey||this.Pt==null)return!1;let r=this.e.i.F(this.Pt);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.Gt(a),!0}Za(e,t,i){let r=this.e.t.rowSelection;if(r==="none"||!this.We(e))return;let o=r==="multiple",s=o&&(i||t.ctrlKey||t.metaKey);!s&&this.wc(e,t,o)||(this.Mo(e,!s||!e.selected,!s),this.Pt=e.id)}selectAll(e=!0){if(this.e.t.rowSelection==="none")return;let i=e?this.e.i.kt():this.e.i.He();this.Gt(i.filter(r=>!r.isDetail&&!r.isGroup).map(r=>({node:r,selected:!0})))}deselectAll(){this.Gt([],!0)}Cc(){let e=this.e.i,{selectable:t,selected:i}=this.Ja(e.kt(),!0),r=i>0&&i===t&&(!e.g||t>=e.Li());return{all:r,some:i>0&&!r}}Ja(e,t){let i=0,r=0;for(let o of e)t&&(o.isDetail||o.isGroup)||!this.We(o)||(i++,this.N.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.We(a,t))&&this.N.add(a.id):this.N.delete(a.id),!!o)for(let u of i.Oi(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.N)t.delete(i)||t.add(i);return t}xc(e){let t=[];for(let i of this.e.i.He()){let r=this.N.has(i.id);(i.selected!==r||e.has(i.id)||this.Wi.has(i.id))&&i.rowIndex>=0&&t.push(i.rowIndex),i.selected=r}return t}Gt(e,t=!1){let i=this.e.t.rowSelection,r=this.Eo()??null,o=e.filter(u=>!u.selected||i!=="none"&&this.We(u.node,r));if(e.length>0&&o.length===0)return;let s=new Set(this.N);(t||o.some(u=>u.selected?i==="single"||u.clearOthers:u.clearOthers&&this.We(u.node,r)))&&this.N.clear(),this.Tc(o,r);let a=new Set(this.Wi);this.Ya(r);let l=this.Dc(s),d=this.xc(a);if(l.size>0){this.e.s.I(d),this.e.W.Vr();let u=this.ti();this.e.emit("selectionChanged",{selectedNodes:u,selectedRows:this.ja(u)})}}Ya(e){this.Wi.clear();let t=this.e.i;if(this.e.t.rowSelection!=="multiple"||!t.M||this.N.size===0)return;let i=r=>{let o=e&&t.F(r),s=!o||this.We(o,e),a=!0,l=!1;for(let d of t.Oi(r)){let u=i(d);a&&(a=u.all),l||(l=u.some)}if(a&&!l){s||this.N.delete(r);let d=this.N.has(r);return{all:d||!s,some:d}}return s&&a?this.N.add(r):(this.N.delete(r),s&&l&&this.Wi.add(r)),{all:a,some:l}};for(let r of t.pc())i(r.id)}};var Ct=class{constructor(e){this.e=e;this.Lt=null;this.re=0;this.at=0;this.$e=null;this.ii=null;this.$i=e=>{let t=this.ko(e);t&&(this.at=this.il(t,e.clientX),t.didResize||(t.didResize=Math.abs(this.at-t.startWidth)>=.5),!this.re&&(this.re=requestAnimationFrame(()=>{this.re=0,this.Sc()})))};this.ni=e=>{let t=this.ko(e);t&&(this.at=this.il(t,e.clientX),t.didResize||(t.didResize=Math.abs(this.at-t.startWidth)>=.5),this.Mc(t))};this.Ur=e=>{this.ko(e)&&this.lt()};this.Ic=()=>{this.lt()};this.Po=e=>{e.key==="Escape"&&(e.preventDefault(),this.lt())}}Rc(e,t){if(!this.e.t.enableColumnResize||!t.resizable||e.isPrimary===!1)return;this.lt();let i=e.currentTarget,r=t.currentWidth;this.at=r,this.Lt={column:t,didResize:!1,handle:i,pointerId:e.pointerId,startFlex:t.flex,startManualWidth:t.manualWidth,startWidth:r,startX:e.clientX,startPreserveWidths:this.e.r.Je},this.Io(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.Lt)}lt(e=!0){let t=this.Lt;t&&(this.Lt=null,this.Ao(),this.Io(t.handle,!1),e&&(this.Qa(t),this.e.ri()),this.e.n.root.classList.remove("mach-root--resizing"),this.tl(t))}Qa(e){e.column.manualWidth=e.startManualWidth,e.column.flex=e.startFlex,e.column.currentWidth=e.startWidth,this.e.r.Je=e.startPreserveWidths}Mc(e){this.Lt=null,this.Ao(),e.didResize&&(Math.abs(this.at-e.startWidth)<.5?this.Qa(e):this.e.r.Ee(e.column,this.at),this.e.ri()),this.Io(e.handle,!1);try{e.handle.releasePointerCapture?.(e.pointerId)}catch{}this.e.n.root.classList.remove("mach-root--resizing"),this.tl(e),e.didResize&&this.e.dt([e.column])}Sc(){let e=this.Lt;!e?.didResize||!this.e.r.Ee(e.column,this.at)||(this.e.ri(),this.Ki(e),this.e.rl(e.column,!1))}Ec(e){this.$e=f("div","mach-column-resize-guide"),this.$e.setAttribute("aria-hidden","true"),this.ii=f("span","mach-column-resize-label"),this.$e.appendChild(this.ii),this.e.n.root.appendChild(this.$e),this.Ki(e)}Ki(e){if(!this.$e||!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.$e.style.left=`${o}px`,this.$e.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`}tl(e){e.handle.classList.remove("mach-header-resize--active"),this.$e?.remove(),this.$e=null,this.ii=null}il(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})}ko(e){let t=this.Lt;return t&&e.pointerId===t.pointerId?t:null}Ao(){this.re&&cancelAnimationFrame(this.re),this.re=0}Io(e,t){S(window,t,{pointermove:this.$i}),S(window,t,{pointerup:this.ni,pointercancel:this.Ur,keydown:this.Po},!0),S(e,t,{lostpointercapture:this.Ic})}destroy(){this.lt(!1),this.Ao(),this.e.n.root?.classList.remove("mach-root--resizing")}};var an=6,Tt=class{constructor(e){this.e=e;this.Ui=null;this.oi=null;this.Go=!1;this.le=0;this.jr=null;this.$i=e=>{if(this.oi){this.Pc(e);return}let t=this.Ui;t&&(Math.abs(e.clientX-t.startX)<an&&Math.abs(e.clientY-t.startY)<an||this.Gc(e))};this.ni=e=>{this.Ui=null,e.type!=="pointercancel"&&this.oi&&this.No(e.clientX,e.clientY),this.Lo();let t=this.nl();t&&e.type!=="pointercancel"&&t.targetIndex>=0&&this.e.Si(t.column.id,t.targetIndex)}}Ac(e,t){e.button===0&&t.movable&&(this.Ui={column:t,startX:e.clientX,startY:e.clientY},this.ji(!0))}ji(e){S(window,e,{pointermove:this.$i,pointerup:this.ni,pointercancel:this.ni})}kc(){let e=this.Go;return this.Go=!1,e}Gc(e){let t=this.Ui;if(!t)return;let i=this.e.W.si(t.column.id,this.e.r.ge(t.column));if(!i||!i.parentElement){this.Lo();return}this.Go=!0;let r=f("div","mach-drop-indicator"),o=f("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.ai[s],l=this.e.r.y(s),d=new Float64Array(l.length+1),u=new Float64Array(l.length);for(let h=0;h<l.length;h++){let p=l[h].currentWidth;u[h]=d[h]+p/2,d[h+1]=d[h]+p}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.C.center.scrollLeft,fromIndex:l.indexOf(t.column),midpoints:u,offsets:d,ghostWidth:c.width,ghostHeight:c.height},this.No(e.clientX,e.clientY)}Pc(e){this.jr={clientX:e.clientX,clientY:e.clientY},!this.le&&(this.le=requestAnimationFrame(()=>{this.le=0;let t=this.jr;this.jr=null,t&&this.No(t.clientX,t.clientY)}))}No(e,t){let i=this.oi;if(!i)return;let r=C(e+12,8,window.innerWidth-i.ghostWidth-8),o=C(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.C.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)`}nl(){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}Lo(){this.ji(!1),this.le&&cancelAnimationFrame(this.le),this.le=0,this.jr=null}destroy(){this.Lo(),this.nl(),this.Ui=null}};var Vi=/^[+-]?(?:\d+(?:\.\d+)?|\.\d+)(?:[eE][+-]?\d+)?$/;function Dt(n,e=!0){if(n==="")return null;if(!e||typeof n!="string"||!Vi.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 Bi(n,e){let t=n==null?"":String(n);return t.includes(e)||t.includes('"')||t.includes(`
|
|
2
2
|
`)||t.includes("\r")?'"'+t.replace(/"/g,'""')+'"':t}function le(n){return typeof n!="string"||n===""||Vi.test(n)?n:/^[\s\u0000-\u001f]*[=+\-@]/.test(n)?"'"+n:n}function ln(n,e={}){let t=e.columnSeparator??",",i=e.protectFormulas??!0,r=n.map(o=>o.map(s=>Bi(i?le(s):s,t)).join(t)).join(`\r
|
|
3
|
-
`);return e.prependBOM?"\uFEFF"+r:r}function dn(n){return n==null?"":String(n)}function
|
|
3
|
+
`);return e.prependBOM?"\uFEFF"+r:r}function dn(n){return n==null?"":String(n)}function Vs(n,e){return Bi(e?le(n):n," ")}function xt(n,e=!0){return n.map(t=>t.map(i=>Vs(i,e)).join(" ")).join(`
|
|
4
4
|
`)}function Rt(n){return St(n," ")}function Et(n,e=","){return St(n,e)}function St(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 Vs(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 Oe(n){try{if(typeof navigator<"u"&&navigator.clipboard?.writeText)return await navigator.clipboard.writeText(n),!0}catch{}return Vs(n)}var un=new Set(["ArrowUp","ArrowDown","ArrowLeft","ArrowRight","Home","End","PageUp","PageDown"]),Bs=new Set([...un,"Enter","F2","Tab"," ","Escape","Delete","Backspace"]),Mt=class{constructor(e){this.e=e;this.sl=e=>{if(this.Fo(e)||this.e.o()||this.e.t.suppressClipboard)return;let t=this.e.s.li();if(!t)return;let i=this.e.ll(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.Oo(t)}else e.type==="cut"?this.e.Fc(t,i):Oe(i)};this.Nc=e=>{if(this.Fo(e)||this.e.t.suppressClipboard)return;let t=this.e.s.Ho();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.dl(r,t.row,t.colIdx))};this.Lc=e=>{this.Fo(e)||this.e.o()||this.Oc(e)||Bs.has(e.key)&&(this.Hc(e)||this.Vc(e)||this.Bc(e))}}init(){this.ol(!0)}destroy(){this.ol(!1)}ol(e){S(this.e.n.root,e,{keydown:this.Lc,copy:this.sl,cut:this.sl,paste:this.Nc})}al(e,t,i){let r=this.e.r.l(),o=this.e.r.Z(t);if(o<0)return null;let s=this.e.i.L(),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.Nt(l+1,1)}else if(a<0){if(l<=0)return null;a=r.length-1,l=this.Nt(l-1,-1)}if(l<0||l>=s)return null;let u=this.e.i.h(l);if(u&&!u.isDetail&&this.e.a.ne(u,r[a]))return{rowIndex:l,column:r[a]}}return null}Nt(e,t){let i=this.e.i.L();for(;e>=0&&e<i;){let r=this.e.i.h(e);if(!r||!r.isDetail)return e;e+=t}return-1}Fo(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.O.undo():this.e.O.redo(),!0)}Hc(e){let t=this.e.s;if(e.key==="Escape")return this.e.ze(),this.e.t.enableRangeSelection&&t.De()&&(e.preventDefault(),t.di()),!0;if(e.key!=="Delete"&&e.key!=="Backspace")return!1;let i=t.li();return i&&(e.preventDefault(),this.e.Oo(i)),!0}Vc(e){if(this.e.s.v)return!1;let t=this.e.r.l();return this.e.i.L()>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.Z(i.colId),s=this.e.i.L();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 un.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.qr(o,this.Nt(o-1,-1),r);break;case"ArrowDown":o=this.qr(o,this.Nt(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.Nt(r-1,-1)));break;case"PageUp":case"PageDown":o=this.jc(e.key,o,r);break}return{row:o,colIdx:s}}qr(e,t,i){return t>=0&&t<i?t:e}jc(e,t,i){let r=this.e.n.C.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.qr(t,this.Nt(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.ne(o,s))return this.e.a.start(t.row,s,e.key==="F2"?e.key:null),t;let a=this.Nt(t.row+1,1);return{...t,row:this.qr(t.row,a,r)}}Kc(e){let t=this.e.i.h(e);if(!(!t||t.isDetail)){if(t.isGroup){this.e.i.Ro(t.id);return}this.e.t.rowSelection!=="none"&&this.e.f.Mo(t,!t.selected,this.e.t.rowSelection==="single")}}Uc(e,t,i){let r=this.al(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 hn(n){P?.owner&&(n===P.owner||n.contains(P.owner))&&P.close()}function _s(n){let e=n.target;P?.contains(e)||P?.close()}function cn(){P?.reposition()}function zs(n){n.key!=="Escape"||!P||(n.preventDefault(),n.stopImmediatePropagation(),P.close(!0))}function pn(n){_(n,_s,zs);let e=n?"addEventListener":"removeEventListener";window[e]("resize",cn),window[e]("scroll",cn,!0)}function Ws(n){P?.close!==n.close&&P?.close(),!P&&(P=n,pn(!0))}function $s(n){P?.close===n&&(P=null,pn(!1))}function de(n,e){return e?`${n} ${e}`:n}function He(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 It(n,e){return n.findIndex(t=>t.value===e&&!t.disabled)}function ne(n){let e=f("div",de("mach-select-control",n.classNames?.root)),t=f("select",de("mach-select-native",n.classNames?.native));t.hidden=!0,t.tabIndex=-1,t.setAttribute("aria-hidden","true");let i=f("button",de("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=f("span",de("mach-select-value",n.classNames?.value)),o=f("span",de("mach-select-caret",n.classNames?.caret));o.setAttribute("aria-hidden","true"),i.append(r,o);let s=f("div",de("mach-select-listbox",n.classNames?.listbox));s.id=fr("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),p=()=>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,he)=>{let M=a[he]?.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",he===d)}),i.setAttribute("aria-activedescendant",d>=0?l[d]?.id??"":"")},g=()=>{let y=i.getBoundingClientRect(),D=s.getBoundingClientRect(),he=Math.max(y.width,D.width),M=C(y.left,8,Math.max(8,window.innerWidth-he-8)),Se=window.innerHeight-y.bottom-8,oe=Se<Math.min(D.height,240)&&y.top>Se,F=oe?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",oe)},b=(y=!1)=>p()?(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(),$s(b),y&&!u&&i.focus({preventScroll:!0}),!0):!1,T=(y,D=!0)=>{!a[y]||a[y].disabled||(d=y,m(),D&&l[y]?.scrollIntoView?.({block:"nearest"}))},G=()=>{if(u||i.disabled||p())return;let y=c();Ws({owner:y,close:b,contains:h,reposition:g}),d=It(a,t.value),d<0&&(d=He(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,Se)=>{let oe=f("option");oe.value=M.value,oe.textContent=M.label,oe.disabled=M.disabled===!0,t.appendChild(oe);let F=f("button",de("mach-select-option",n.classNames?.option));return F.id=`${s.id}-option-${Se}`,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",wo=>wo.preventDefault()),F.addEventListener("click",()=>$(Se)),s.appendChild(F),F});let he=a.find(M=>!M.disabled)?.value??"";t.value=D!=null&&a.some(M=>M.value===D)?D:he,d=It(a,t.value),m()},ur=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(),p()?$(d):G();return}let D=d;if(y.key==="ArrowDown")D=He(a,d,1);else if(y.key==="ArrowUp")D=He(a,d,-1);else if(y.key==="Home")D=He(a,-1,1);else if(y.key==="End")D=He(a,-1,-1);else return;y.preventDefault(),y.stopPropagation(),p()||G(),T(D)},cr=()=>{d=It(a,t.value),m(),n.onChange?.(t.value)};return i.addEventListener("click",()=>{b()||G()}),i.addEventListener("keydown",ur),t.addEventListener("change",cr),K(a,n.value),{el:e,native:t,trigger:i,listbox:s,contains:h,isOpen:p,open:G,close:b,focus:()=>i.focus({preventScroll:!0}),getValue:()=>t.value,setValue:y=>{t.value=y,d=It(a,y),m()},setOptions:K,destroy:()=>{u||(u=!0,b(),i.removeEventListener("keydown",ur),t.removeEventListener("change",cr),e.remove())}}}function fn(n,e){let t=f("input","mach-editor-input");return t.type=n,e!=null&&e!==""&&(t.value=n==="date"?String(e).slice(0,10):String(e)),t}function Ks(n){return n?.options?.length?n.options:(n?.values??[]).map(e=>({label:String(e),value:e}))}function Us(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 _i(n,e,t){let i=n.colDef,r=typeof i.cellEditor=="string"?i.cellEditor:Us(e,i.cellEditorParams);if(r==="date"){let a=fn("date",e),d=(e==null?"":String(e)).match(/T(\d{2}:\d{2})/);return{el:a,getValue:()=>a.value===""?null:d?`${a.value}T${d[1]}`:a.value,focus:()=>a.focus({preventScroll:!0})}}if(r==="select"){let a=Ks(i.cellEditorParams),l=ne({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=fn(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 ue(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 Ve(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:q(n,e,t,r)}var js='<path d="M3 8.5 6.4 12 13.5 4"/>',qs='<path d="m4 4 8 8m0-8-8 8"/>';function mn(n,e){let t=f("button",`mach-edit-control mach-edit-control--${n}`);return t.type="button",t.setAttribute("aria-label",e),t.title=e,t.innerHTML=`<svg viewBox="0 0 16 16" aria-hidden="true" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round">${n==="confirm"?js:qs}</svg>`,t}var At=class{constructor(e){this.e=e;this.b=null;this.S=null;this.ke=null;this.ut=0;this.Yr=0;this.fl=e=>{if(!(!this.b||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.b,i=this.e.Yo.al(t.node.rowIndex,t.column.id,e.shiftKey?-1:1);i?this.start(i.rowIndex,i.column,null,!0):this.Pe(!1)}else this.Pe(e.key==="Escape")}}isEditing(e,t){return this.b?e==null&&t==null?!0:this.b.node.rowIndex===e&&this.b.column.id===t:this.S?e==null&&t==null?!0:this.qi(this.S)!==e?!1:t==null||this.S.drafts.has(t):!1}Xr(){return this.b!=null}Vu(){return this.b?.node.rowIndex??(this.S?this.qi(this.S):null)}ul(e){return this.S?e==null||this.qi(this.S)===e:!1}ne(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(pe(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.Yr++,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.S)return!1;if(this.b)return!this.ke&&this.b.node===o&&this.b.column===t||this.cl(o,t).then(p=>{p&&this.start(o.rowIndex,t,i,r)}),!0;if(!this.ne(o,t))return!1;r&&(this.e.s.$r(e,"nearest"),this.e.s.Ae(e,t.id));let s=this.e.s.si(e,t.id);if(!s)return!1;this.e.ze();let a=this.e.d(o,t),l=this.hl(o,t,e,a,i);if(!l)return!1;let d=f("div","mach-cell-editor-controls",{role:"group"}),u=mn("confirm","Confirm edit"),c=mn("cancel","Cancel edit");d.append(u,c),this.pl(l,s,!0),this.e.n.root.appendChild(d);let h=this.fl;return l.el.addEventListener("keydown",h),d.addEventListener("mousedown",p=>{p.preventDefault(),p.stopPropagation()}),d.addEventListener("click",p=>{p.stopPropagation();let m=p.target.closest("button");m&&this.Pe(m===c)}),d.addEventListener("keydown",p=>{p.key==="Escape"&&this.fl(p)}),this.b={node:o,column:t,editor:l,oldValue:a,cell:s,keydown:h,confirmButton:u,cancelButton:c},this.ml(),this.Vo(l,t,o),this.e.emit("cellEditingStarted",{rowIndex:e,colId:t.id,rowNode:o}),!0}cl(e,t){let i=++this.Yr;return this.Pe(!1).then(r=>r&&i===this.Yr&&!this.isEditing()&&this.e.i.h(e.rowIndex)===e&&(t==null||this.e.r.R(t.id)===t))}startRow(e,t){if(this.b||this.S)return!1;let i=this.e.i.h(e);if(!i||i.data==null||i.isDetail||i.isGroup)return!1;this.e.ze();let r=new Map;for(let l of this.e.r.l()){if(!this.ne(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.S=o,this.e.s.I([e]),r.size===0)return this.S=null,this.e.s.I([e]),!1;let s=r.values().next().value,a=(t?r.get(t):void 0)??s;return a?.mounted&&this.Vo(a.mounted.editor,a.column,i),this.e.emit("rowEditingStarted",{rowIndex:e,rowNode:i,data:i.data}),!0}gl(e,t,i,r){if(this.b)return this.b.node===t&&this.b.column.id===i.id;let o=this.S;if(!o||o.node!==t)return!1;let s=o.drafts.get(i.id);return s?s.mounted?.cell!==r&&(this.yl(s),!this.qc(e,o,s,r))?(o.drafts.delete(i.id),!1):!0:!1}Bo(e,t,i){let r=this.S;if(r&&this.qi(r)===e){let o=r.drafts.get(t);o?.mounted?.cell===i&&this.yl(o);return}if(this.b?.cell===i){let o=this.b;this.Pe(!1),this.b===o&&this.Pe(!0)}}stop(e=!1){this.Pe(e)}Pe(e=!1){if(e&&this.Yr++,this.S)return this.vl(e);let t=this.b;if(!t)return Promise.resolve(!1);if(e)return this.ut++,this.ke=null,Promise.resolve(this.Yi(t,!0,t.oldValue));if(this.ke)return this.ke;let i,r="cellEditor.getValue";try{if(i=t.editor.getValue(),Object.is(i,t.oldValue)||(r="valueParser",i=ue(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.V.Jr(o),a=++this.ut,l=()=>a===this.ut&&this.b===t&&s(),d=u=>l()?u.length?(this._o(t,!1),this.Xi(t.editor,u[0].message),!1):this.Yi(t,!1,i):(a===this.ut&&this.b===t&&this.Yi(t,!0,t.oldValue),!1);return this.bl(o,l,d,()=>this._o(t,!0))}vl(e=!1){let t=this.S;if(!t)return Promise.resolve(!1);if(e)return this.ut++,this.ke=null,Promise.resolve(this.Zr(t,!0));if(this.ke)return this.ke;for(let u of t.drafts.values())this.zo(u);let i=[];for(let u of t.drafts.values())if(!Object.is(u.oldValue,u.value))try{let c=ue(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.Wo(t,[{draft:u,message:c instanceof Error?c.message:String(c)}]),Promise.resolve(!1)}if(i.length===0)return Promise.resolve(this.Zr(t,!1,i));let r=i.map(u=>t.drafts.get(u.column.id)),o=r.map(u=>u.value),s=this.e.V.Jr(i),a=++this.ut,l=()=>a===this.ut&&this.S===t&&s();for(let u of r)u.error=void 0;let d=u=>l()?u.length?(this.Wo(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.$o(t,!1),!1):this.Zr(t,!1,i):(a===this.ut&&this.S===t&&this.Zr(t,!0),!1);return this.bl(i,l,d,()=>{t.validating=!0,this.$o(t,!0)})}bl(e,t,i,r){let o=this.e.V.Ko(e,t);if(!k(o))return Promise.resolve(i(o));r();let s=o.then(i).finally(()=>{this.ke===s&&(this.ke=null)});return this.ke=s,s}Yi(e,t,i){if(this.b!==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 s=this.e.V.Uo([r],()=>!this.e.o());if(s)return this._o(e,!1),this.Xi(e.editor,s.message),!1}return this.b=null,e.confirmButton.parentElement?.remove(),o&&this.e.jo(e.node,e.column,e.oldValue,i),this.qo(e),this.e.o()||(this.e.emit("cellEditingStopped",{rowIndex:e.node.rowIndex,colId:e.column.id,rowNode:e.node,oldValue:e.oldValue,newValue:o?i:e.oldValue}),this.wl(e.node.rowIndex)),!0}Zr(e,t,i=[]){if(this.S!==e)return!1;let r=t?[]:this.Yc(e,i);if(r==null)return!1;for(let s of e.drafts.values())s.mounted&&this.qo(s.mounted),s.mounted=null;if(this.S=null,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}),this.wl(o),!0}wl(e){e>=0&&this.e.s.I([e]),this.e.Ge.refresh(),this.e.ct.refresh()}Yc(e,t){if(t.length===0)return[];let i=this.e.V.Uo(t,()=>!this.e.o());if(i)return this.Wo(e,[{draft:e.drafts.get(i.colId)??e.drafts.get(t[0].column.id),message:i.message}]),null;let r=this.e.V.Ji(t);this.e.O.Cl();try{for(let o of t){if(!r())break;this.e.jo(e.node,o.column,o.oldValue,o.newValue)}}finally{this.e.O.Tl()}return t.map(({column:o,oldValue:s,newValue:a})=>({colId:o.id,oldValue:s,newValue:a}))}qc(e,t,i,r){let o=this.hl(t.node,i.column,e,i.value,null);if(!o)return!1;this.pl(o,r);let s=l=>this.Xc(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.Zi(o.el,!0),!0}pl(e,t,i=!1){L(this.e,t);let r=f("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")}ml(){if(!this.b)return;let{cell:e,column:t,confirmButton:i}=this.b,r=this.e.n.root;if(!r.contains(e)){this.Pe(!0);return}let o=i.parentElement,s=this.e.n.C[t.pinned??"center"],a=e.getBoundingClientRect(),l=s.getBoundingClientRect(),d=r.getBoundingClientRect(),u=o.getBoundingClientRect(),c=l.left+s.clientWidth,h=l.top+s.clientHeight,p=a.top-u.height-2>=l.top?a.top-u.height-2:a.bottom+2,m=this.e.t.domLayout==="autoHeight"&&p+u.height>h;o.style.position=m?"static":"",o.style.justifyContent=m?"flex-end":"";let g=o.getBoundingClientRect().width;o.style.visibility=(m||g<=s.clientWidth&&p+u.height<=h)&&a.right>l.left&&a.left<c&&a.bottom>l.top&&a.top<h?"":"hidden",o.style.left=`${C(a.right-g,l.left,Math.max(l.left,c-g))-d.left-r.clientLeft}px`,o.style.top=`${p-d.top-r.clientTop}px`}yl(e){e.mounted&&(this.zo(e),this.qo(e.mounted),e.mounted=null)}zo(e){if(e.mounted)try{let t=e.mounted.editor.getValue();t!==void 0&&(e.value=t)}catch(t){this.e.reportError(t,"cellEditor.getValue",{colId:e.column.id,rowId:this.S?.node.id})}}hl(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.Jc(s.cellEditor)?.(l)??_i(t,r,o):a=_i(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}Wo(e,t){e.validating=!1,this.$o(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.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}$o(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}Vo(e,t,i){try{e.focus?.()}catch(r){this.e.reportError(r,"cellEditor.focus",{colId:t.id,rowId:i.id})}}qo(e){e.editor.el.removeEventListener("keydown",e.keydown),e.input&&e.editor.el.removeEventListener("input",e.input),this.Zi(e.editor.el,!1);try{e.editor.destroy?.()}catch(t){this.e.reportError(t,"cellEditor.destroy",{colId:e.cell.dataset.colId})}e.cell.classList.remove("mach-cell--editing","mach-cell--row-editing","mach-cell--error")}qi(e){return e.node.rowIndex>=0?e.node.rowIndex:e.rowIndex}Xc(e,t,i){if(this.S!==t||e.isComposing||e.keyCode===229)return;if(e.key==="Escape"||e.key==="Enter"&&!e.shiftKey){e.preventDefault(),e.stopPropagation(),this.vl(e.key==="Escape");return}if(e.key!=="Tab")return;e.preventDefault(),e.stopPropagation(),this.zo(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.Vo(l.mounted.editor,l.column,t.node);break}}}destroy(){this.Pe(!0)}};var kt=class{constructor(e){this.e=e;this.Xo=0}Zc(){this.Xo++}Qr(){let e=++this.Xo;return()=>e===this.Xo&&!this.e.o()}Jr(e){let t=e[0].node,i=this.e.r.Q(),r=i.map(a=>this.e.d(t,a)),o=this.Ji(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]))}Ji(e){let t=e[0].node,i=t.data,r=this.e.r,o=r.Q(),s=e.every(a=>a.node===t&&r.R(a.column.id)===a.column);return()=>s&&!this.e.o()&&this.e.i.F(t.id)===t&&t.data===i&&r.Q()===o}Ko(e,t){let i=e.map(o=>this.Qc(o,t)),r=o=>{let s=o.filter(a=>a!=null);return s.length||!t()?s:this.eh(e,t)};return i.some(k)?Promise.all(i.map(o=>Promise.resolve(o))).then(r):r(i)}Qc(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)}}eh(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.Q())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)}}Uo(e,t){let i=[],r=this.Ji(e);for(let o of e){if(!t()||!r()||!Object.is(this.e.d(o.node,o.column),o.oldValue)||!this.e.a.ne(o.node,o.column)||!this.e.en(o.node,o.column,o.newValue,o.oldValue)){for(let s of i.reverse()){if(!t()||!r())break;this.e.en(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"}}th(e){let t=this.Qr();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.ne(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.Jr(a),d=()=>t()&&l();return{changes:a,current:d,validation:this.Ko(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.O.Cl();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.Uo(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.Ji(s);d.applied=!0;for(let h of s){if(!i()||!c()){d.applied=!1;break}this.e.jo(h.node,h.column,h.oldValue,h.newValue),h.node.rowIndex>=0&&o.add(h.node.rowIndex)}})}finally{this.e.O.Tl()}return o.size&&i()&&(this.e.s.I([...o]),this.e.Ge.refresh(),this.e.ct.refresh()),r}};function zi(n){return n==="blank"||n==="notBlank"}function Pt(n){return n===null?"null:":`${typeof n}:${String(n)}`}var Gt=class{constructor(e){this.e=e;this.w=null;this.ht=null;this.ui=null;this.pt=e=>{if(!this.w)return;let t=e.target;if(!this.ui?.contains(t)){if(!this.w.contains(t)){this.close();return}(!(t instanceof Element)||!t.closest(".mach-filter-select-control"))&&this.ui?.close()}};this.ft=e=>{if(e.key==="Escape"){if(this.ui?.close(!0)){e.preventDefault(),e.stopPropagation();return}this.close()}}}toggle(e,t){if(this.ht===e.id){this.close();return}this.close(),this.open(e,t)}open(e,t){let i=this.e.i._e()[e.id]??null,r=i?.type??e.filterType,o=f("div","mach-filter-panel");o.setAttribute("role","dialog"),o.setAttribute("aria-label",`${e.id} filter`);let s=u=>{this.e.ih(e,u),this.close()},a=r==="set"?this.rh(o,e,i):this.nh(o,r,i,s),l=f("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.ht=e.id,J(o,t),_(!0,this.pt,this.ft),o.querySelector(".mach-filter-select-trigger, input")?.focus()}close(){this.w&&(this.ui?.destroy(),this.ui=null,this.w.remove(),this.w=null,this.ht=null,_(!1,this.pt,this.ft))}destroy(){this.close()}nh(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.oh(t,s),d=this.xl(t),u=this.xl(t,!0);this.sh(t,s,o,d,u),this.Rl(s,d,u),l.addEventListener("change",()=>{this.Rl(l.value,d,u)});let c=f("div","mach-filter-body");c.append(a,d,u),e.appendChild(c);let h=()=>this.ah(t,l.value,d.value,u.value),p=m=>{m.key==="Enter"&&r(h())};return d.addEventListener("keydown",p),u.addEventListener("keydown",p),h}oh(e,t){let i=ne({ariaLabel:"Filter condition",options:ge[e].map(r=>({value:r,label:this.e.u(ot(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.ui=i,i}xl(e,t=!1){let r=f("input",`mach-filter-input${t?" mach-filter-input--second":""}`);return r.type=e,r}sh(e,t,i,r,o){i?.value!=null&&!zi(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=zi(e)?"none":"",i.style.display=e==="inRange"?"":"none"}rh(e,t,i){let o=t.colDef.filterParams,s;if(o?.values)s=o.values;else{let p=new Set;s=[];let m=this.e.i.He(),g=Math.min(m.length,o?.maxValues??500);for(let b=0;b<g;b++){let T=this.e.d(m[b],t),G=Pt(T??null);p.has(G)||(p.add(G),s.push(T))}}let a=new Set((i?.type==="set"?i.values:s).map(Pt)),l=f("input","mach-filter-input mach-filter-input--search");l.type="text",l.placeholder=this.e.u("search");let d=f("div","mach-filter-set-list"),u=new Map(s.map(p=>[Pt(p),p??null])),c=p=>{d.textContent="";let m=p.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 T=Pt(g),G=f("label","mach-filter-set-item"),$=f("input");$.type="checkbox",$.checked=a.has(T),$.addEventListener("change",()=>{$.checked?a.add(T):a.delete(T)});let K=f("span");K.textContent=b,G.append($,K),d.appendChild(G)}};l.addEventListener("input",()=>c(l.value)),c("");let h=f("div","mach-filter-body mach-filter-body--set");return h.append(l,d),e.appendChild(h),()=>{let p=[];for(let[m,g]of u)a.has(m)&&p.push(g);return p.length&&p.length<u.size?{type:"set",values:p}:null}}ah(e,t,i,r){if(zi(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 Lt=class{constructor(e){this.e=e;this.w=null;this.ht=null;this.tn=null;this.rn="";this.Qi=new Set;this.pt=e=>{let t=e.target;this.w&&!this.w.contains(t)&&!this.dh(t)&&this.close()};this.ft=e=>{if(e.key==="Escape"){for(let t of this.Qi)if(t.close(!0)){e.preventDefault(),e.stopImmediatePropagation();return}this.close()}}}toggle(e,t){let i=this.ht===e.id;this.close(),i||this.open(e,t)}lh(e){this.close();let t=e??(()=>{let r=this.e.n.root.getBoundingClientRect(),o=f("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.tn=o,o})();this.open(null,t)}close(){this.El(),this.tn&&(this.tn.remove(),this.tn=null),this.w?.remove(),this.w=null,this.ht=null,_(!1,this.pt,this.ft)}destroy(){this.close()}open(e,t){let i=this.e.api,r=f("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=f("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,p="mach-column-panel-btn")=>U(p,this.e.u(c),()=>{h(),this.close()});if(e){let c=e.id,h=(...p)=>{let m=f("div","mach-column-panel-actions");m.append(...p),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=f("div","mach-column-panel-divider");r.appendChild(a);let l=f("div","mach-column-panel-subtitle");if(l.textContent=this.e.u("columnVisibility"),r.appendChild(l),!e){let c=f("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.rn,c.addEventListener("input",()=>{this.rn=c.value.trim().toLocaleLowerCase(),this.Jo(d,!0)}),r.appendChild(c)}let d=f("div","mach-column-panel-list");this.Jo(d,!e),r.appendChild(d);let u=f("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.ht=e?e.id:"__standalone__",J(r,t),_(!0,this.pt,this.ft)}Zo(){if(!this.w)return;let e=this.w.querySelector(".mach-column-panel-list");e&&this.Jo(e,this.ht==="__standalone__")}Jo(e,t){let i=this.e.api;this.El(e),e.replaceChildren();let r=this.e.r.Q().filter(o=>o.isDetailToggle?!1:!t||!this.rn?!0:`${o.colDef.headerName??o.colDef.field??o.id} ${o.id}`.toLocaleLowerCase().includes(this.rn));for(let o of r){let s=f("div",t?"mach-column-workbench-item":"mach-filter-set-item"),a=f("label","mach-column-workbench-label"),l=f("input");l.type="checkbox",l.checked=!o.hide,l.disabled=o.hasCheckbox,l.addEventListener("change",()=>{i.columns.setVisible(o.id,l.checked),this.Zo()});let d=f("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=ne({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.Zo()}});u.trigger.disabled=!o.movable,u.native.disabled=!o.movable,this.Qi.add(u),s.appendChild(u.el);let c=this.e.r.Q().filter(m=>!m.hide&&m.parentGroup===o.parentGroup&&(o.parentGroup!=null||m.pinned===o.pinned)),h=c.indexOf(o),p=(m,g,b)=>{let T=U("mach-column-workbench-move",m,()=>{i.columns.move(o.id,g),this.Zo()});return T.disabled=b||o.hide||!o.movable,T};s.append(p("\u2191",h-1,h<=0),p("\u2193",h+1,h<0||h>=c.length-1))}e.appendChild(s)}}dh(e){for(let t of this.Qi)if(t.contains(e))return!0;return!1}El(e){for(let t of this.Qi)e&&!e.contains(t.el)||(t.destroy(),this.Qi.delete(t))}};var Nt=class{constructor(e){this.e=e;this.w=null;this.pt=e=>{this.w&&!this.w.contains(e.target)&&this.close()};this.ft=e=>{e.key==="Escape"&&this.close()}}uh(e){if(e){let o=this.e.i.h(e.rowIndex),s=this.e.r.R(e.colId);return o&&s?{node:o,column:s}:null}let t=this.e.s.li();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}ch(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}}hh(e,t,i,r){let o=!1;for(let s of t){if(s.separator){e.appendChild(f("div","mach-context-menu-separator"));continue}let a=f("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.ph(s,i,r))),e.appendChild(a)}return o}ph(e,t,i){this.close();try{e.action?.()}catch(r){this.e.reportError(r,"contextMenu.action",{colId:i.id,rowId:t.id})}}fh(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.mh()})),i("menuClearContents",()=>{let r=t.s.li();r&&t.Oo(r)})}open(e,t,i){this.close();let r=this.uh(i);if(!r)return;let o=f("div","mach-context-menu");if(o.setAttribute("role","menu"),this.e.t.getContextMenuItems){let s=this.ch(r.node,r.column);if(!s||!this.hh(o,s,r.node,r.column))return;this.Ml(o,e,t);return}this.fh(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=C(t,8,Math.max(8,window.innerWidth-r.width-8)),s=C(i,8,Math.max(8,window.innerHeight-r.height-8));e.style.left=`${o}px`,e.style.top=`${s}px`,_(!0,this.pt,this.ft)}close(){this.w&&(this.w.remove(),this.w=null,_(!1,this.pt,this.ft))}destroy(){this.close()}};var Ft=class{constructor(e){this.e=e;this.w=null;this.nn=0;this.sn=null;this.an=e=>{if(this.e.o()||!this.e.t.tooltipComponent)return;let i=e.target.closest(".mach-cell");if(!i||i===this.sn)return;this.Al(),this.Qo(),this.sn=i;let r=this.gh(i);if(!r||i.classList.contains("mach-cell--editing"))return;let o=this.yh(r.node,r.column,r.index);this.vh(o,r.column)&&(this.nn=window.setTimeout(()=>{this.e.o()||this.sn!==i||this.bh(i,o)},Math.max(0,this.e.t.tooltipShowDelay)))};this.Il=()=>{this.hide()}}init(){S(this.e.n.ye,!0,{mouseover:this.an,mouseleave:this.Il})}destroy(){this.hide(),S(this.e.n.ye,!1,{mouseover:this.an,mouseleave:this.Il})}hide(){this.Al(),this.Qo(),this.sn=null}Al(){this.nn&&(clearTimeout(this.nn),this.nn=0)}Qo(){this.w?.remove(),this.w=null}gh(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.R(t):void 0;return!r||!o||r.isDetail||r.isGroup?null:{node:r,column:o,index:i}}yh(e,t,i){return{data:e.data,node:e,api:this.e.api,colId:t.id,value:this.e.d(e,t),formatted:fe(this.e,e,t),rowIndex:i}}vh(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}bh(e,t){this.Qo();let i=this.e.t.tooltipComponent;if(!i)return;let r=f("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,J(r,e,6)}};var Ot=class{constructor(e){this.e=e;this.oe=null}init(){this.oe=f("div","mach-watermark"),this.oe.setAttribute("aria-hidden","true"),this.oe.style.pointerEvents="none",this.e.n.root.appendChild(this.oe),this.apply()}apply(){if(!this.oe||this.e.o())return;let e=this.e.t.watermarkEnabled?this.e.t.watermarkConfig:null;if(!e||!e.text){this.oe.style.display="none",this.oe.style.backgroundImage="";return}let t=this.wh(e);this.oe.style.display="",t?(this.oe.style.backgroundImage=`url(${t})`,this.oe.style.backgroundColor=""):this.oe.style.backgroundImage=""}wh(e){try{let t=f("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.Ch()?"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}}Ch(){return this.e.n.root.classList.contains("mach-theme-dark")}refresh(){this.apply()}destroy(){this.oe?.remove(),this.oe=null}};var Ht=class{constructor(e){this.e=e;this.U=[];this.Y=-1;this.de=null}Cl(){this.de===null&&(this.de=[])}Tl(){let e=this.de;this.de=null,e&&e.length>0&&this.push(e)}es(e){if(this.de!==!1){if(this.de){this.de.push(e);return}this.push([e])}}push(e){this.e.t.undoStackSize!==0&&(this.U.length=this.Y+1,this.U.push(e),this.Y=this.U.length-1,this.kl())}kl(){let e=this.e.t.undoStackSize;if(e===0){this.clear();return}for(;this.U.length>e;)this.U.shift(),this.Y--;this.Y<-1&&(this.Y=-1)}canUndo(){return this.Y>=0}canRedo(){return this.Y<this.U.length-1}undo(){if(this.e.ze(),!this.canUndo())return!1;let e=this.U[this.Y];return this.Y--,this.apply(e,!1),!0}redo(){return this.e.ze(),this.canRedo()?(this.Y++,this.apply(this.U[this.Y],!0),!0):!1}apply(e,t){let i=this.e,r=[],o=this.U;for(let s of e){if(o!==this.U&&(o=this.U,!o.includes(e)))break;let a=i.i.F(s.nodeId),l=i.r.R(s.columnId);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.en(a,l,d,u)&&(i.s.Wr(a),i.s.Pl([a.rowIndex],[l.id]),a.rowIndex>=0&&r.push(a.rowIndex),i.emit("cellValueChanged",{oldValue:u,newValue:d,rowNode:a,rowIndex:a.rowIndex,column:l,colDef:l.colDef,data:a.data}))}r.length>0&&i.s.I(r),i.Ge.refresh(),i.ct.refresh()}Wu(e){if(e.length===0||!this.U.length&&!this.de)return;let t=new Set(e),i=o=>o.some(s=>t.has(s.nodeId)),r=this.Y;this.U=this.U.filter((o,s)=>i(o)?(s<=r&&this.Y--,!1):!0),this.de&&i(this.de)&&(this.de=!1)}clear(){this.U=[],this.Y=-1,this.de=null}};var Vt=class{constructor(e){this.e=e;this.B=new Map;this.ts=!1;this.rs=null}init(){this.rs=this.e.ue.on("cellValueChanged",e=>{this.ts||this.es(e)})}es(e){let t=`${e.rowNode.id}\0${e.column.id}`,i=this.B.get(t),r=i?i.originalValue:e.oldValue;Object.is(e.newValue,r)?this.B.delete(t):this.B.set(t,{rowId:e.rowNode.id,colId:e.column.id,originalValue:r,value:e.newValue}),this.er()}getDirtyRowIds(){let e=new Set;for(let{rowId:t}of this.B.values())e.add(t);return[...e]}getChanges(){let e=new Map;for(let t of this.B.values()){let i=this.e.i.F(t.rowId);if(!i?.data)continue;let r=e.get(t.rowId);r||(r={rowId:t.rowId,data:i.data,cells:[]},e.set(t.rowId,r)),r.cells.push({colId:t.colId,originalValue:t.originalValue,value:t.value})}return[...e.values()]}markSaved(e){if(!e)this.B.clear();else{let t=new Set(e);for(let[i,r]of this.B)t.has(r.rowId)&&this.B.delete(i)}this.er()}Th(e){for(let t of e)for(let i of t.cells){let r=`${t.rowId}\0${i.colId}`,o=this.B.get(r);if(o){Object.is(o.value,i.value)?this.B.delete(r):o.originalValue=i.value;continue}let s=this.e.i.F(t.rowId),a=this.e.r.R(i.colId);if(!s||!a||s.data==null)continue;let l=this.e.d(s,a);Object.is(l,i.value)||this.B.set(r,{rowId:t.rowId,colId:i.colId,originalValue:i.value,value:l})}this.er()}rollback(e){let t=e?new Set(e):null,i=[...this.B.entries()].filter(([,s])=>!t||t.has(s.rowId));if(i.length===0)return!1;let r=new Set,o=new Set;this.ts=!0;try{for(let[s,a]of i){let l=this.e.i.F(a.rowId),d=this.e.r.R(a.colId);if(!l||!d||l.data==null)continue;let u=this.e.d(l,d);if(Object.is(u,a.originalValue)){o.add(s);continue}this.e.en(l,d,a.originalValue,u)&&(o.add(s),this.e.s.Wr(l),l.rowIndex>=0&&r.add(l.rowIndex),this.e.emit("cellValueChanged",{oldValue:u,newValue:a.originalValue,rowNode:l,rowIndex:l.rowIndex,column:d,colDef:d.colDef,data:l.data}))}}finally{this.ts=!1}for(let s of o)this.B.delete(s);return r.size>0&&this.e.s.I([...r]),this.e.Ge.refresh(),this.e.ct.refresh(),this.er(),o.size>0}Ku(e){e.length>0&&this.markSaved(e)}clear(){this.B.size!==0&&(this.B.clear(),this.er())}destroy(){this.rs?.(),this.rs=null,this.B.clear()}er(){this.e.emit("dirtyStateChanged",{dirtyRowIds:this.getDirtyRowIds()})}};var $i=class{constructor(){this.tr=null;this.ln=0;this.Gl=0;this.Ll=0}acquire(){this.ln++,this.Dh();let e=!1;return()=>{e||(e=!0,this.ln=Math.max(0,this.ln-1),this.ln===0&&this.disconnect())}}snapshot(){return{count:this.Gl,totalMs:this.Ll}}Dh(){if(!(this.tr||typeof PerformanceObserver>"u"))try{this.tr=new PerformanceObserver(e=>{for(let t of e.getEntries())this.Gl++,this.Ll+=t.duration}),this.tr.observe({entryTypes:["longtask"]})}catch{this.disconnect()}}disconnect(){let e=this.tr;this.tr=null;try{e?.disconnect()}catch{}}},Bt=new $i;function Wi(){return typeof performance<"u"&&typeof performance.now=="function"?performance.now():Date.now()}var _t=class{constructor(){this.Ft=[];this.dn=[];this.un=[];this.ns=Bt.acquire(),this.cn=Bt.snapshot()}start(){return Wi()}xh(e,t,i){this.Ft.push({duration:Math.max(0,Wi()-e),rows:t,columns:i}),this.Ft.length>120&&this.Ft.shift()}Rh(e){this.Nl(this.dn,e)}Ba(e){this.Nl(this.un,e)}snapshot(){let e=this.Ft.map(r=>r.duration),t=this.Ft[this.Ft.length-1],i=Bt.snapshot();return{sampleCount:e.length,lastRenderMs:t?.duration??0,averageRenderMs:this.Eh(e),maxRenderMs:Math.max(0,...e),p95RenderMs:this.os(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.dn.length,p95LayoutMs:this.os(this.dn),modelSampleCount:this.un.length,p95ModelMs:this.os(this.un),longTaskCount:Math.max(0,i.count-this.cn.count),longTaskTotalMs:Math.max(0,i.totalMs-this.cn.totalMs),usedHeapBytes:this.usedHeapBytes()}}reset(){this.Ft=[],this.dn=[],this.un=[],this.cn=Bt.snapshot()}destroy(){this.ns?.(),this.ns=null}Nl(e,t){e.push(Math.max(0,Wi()-t)),e.length>120&&e.shift()}Eh(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}os(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 Ki(n,e){if(!(n==null||e==null))return[...new Set([...n,...e])]}function Ys(n,e){return n===!0||e===!0?!0:n?e?{rowIds:Ki(n.rowIds,e.rowIds),rowIndexes:Ki(n.rowIndexes,e.rowIndexes),columns:Ki(n.columns,e.columns),force:n.force===!0||e.force===!0,includePinned:n.includePinned===!0||e.includePinned===!0}:n:e}var Xs=["columns","header","pool","data","layout","pinned","summary","overlays"];function Js(n,e){let t={cells:Ys(n.cells,e.cells)};for(let i of Xs)t[i]=n[i]===!0||e[i]===!0;return t}var zt=class{constructor(e){this.apply=e;this.Ot=0;this.mt=null;this.Fl=0;this.Ol=0;this.Hl=0;this.hn=!1}batch(e){if(this.hn)return e();this.Ot++;try{return e()}finally{this.Ot--,this.Ot===0&&this.flush()}}Vl(e){this.hn||(this.Ol++,this.mt&&this.Hl++,this.mt=Js(this.mt??{},e),this.Ot===0&&this.flush())}flush(){if(this.hn||this.Ot>0||!this.mt)return;let e=this.mt;this.mt=null,this.Fl++,this.apply(e)}snapshot(){return{batchDepth:this.Ot,flushCount:this.Fl,requestCount:this.Ol,coalescedRequestCount:this.Hl,pending:this.mt!=null}}destroy(){this.hn=!0,this.mt=null,this.Ot=0}};var gn=Symbol.for("mach-table.adapter.lifecycle.v1");function yn(n,e){Object.defineProperty(n,gn,{value:e})}function Ui(n){let e=n[gn]?.rowDrag;return e?.policy===n.getOption("rowDragPolicy")?e?.factory:void 0}var vn=Symbol.for("mach-table.import.v1");function bn(n,e){Object.defineProperty(n,vn,{value:{begin:()=>e.V.Qr(),revision:()=>e.i.Be(),isEditing:()=>e.a.isEditing(),columns:()=>e.r.Q(),visibleColumns:()=>e.r.l(),read:(i,r)=>e.d(i,r),editable:(i,r)=>e.a.ne(i,r),parse:(i,r,o,s)=>ue(e,i,r,o,"import",s),pasteRows:i=>{let r=[];for(let o of e.i.kt())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.V.Ko(i,r),guard:i=>e.V.Jr(i),commitRows:(i,r,o)=>e.V.Dl(i,r,o)}})}function wn(n){let e=n[vn];if(!e)throw new TypeError("Import plans require a MachTable GridApi");return e}function Zs(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 p=c.colDef.headerName;p&&l.set(p,l.has(p)?null:c)}let d=[],u=new Set;return o.forEach((c,h)=>{let p=(typeof c=="string"||typeof c=="number"?String(c):"").replace(/^\uFEFF/,"").trim(),m=s.get(p)??(a.has(p)?a.get(p):l.get(p));if(!m){if(i||t.columns||a.has(p)||l.has(p))throw new TypeError(`Unknown or ambiguous import column: ${p}`);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 Qs(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 ea(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):Dt(r,o.coerceNumbers!==!1);if(k(l))throw new TypeError("Import parsers must return synchronous values");if(!me(e.data,s,l))throw new TypeError(`Unsafe import field: ${s}`);e.changes.push({node:e.node,column:t,oldValue:a,newValue:l})}function ta(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{ea(n,u,c,h,e[h],r)}catch(p){o.issues.push({rowIndex:t,columnIndex:h,colId:c.id,code:"PARSE",message:p instanceof Error?p.message:String(p)})}o.rows.push(u)}function Cn(n,e,t={},i,r=!1,o){let s=t.headerRowIndex??(t.columns?-1:0);Qs(e,s);let a=Zs(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)&&ta(n,u,d-s-1,a,t,l,i,o)}return l}function ce(n){return(n==null?"":String(n)).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function Wt(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 $t=["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 De={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(De));var Be=new Set($t.map(n=>`on${n.charAt(0).toUpperCase()}${n.slice(1)}`));function qi(n,e){let t=De[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 Tn(n){let e={};for(let[t,i]of Object.entries(n)){if(Be.has(t)){(i==null||typeof i=="function")&&(e[t]=i);continue}!v(De,t)||!qi(t,i)||(e[t]=i)}return e}var xn=2e3,Yi=1e5,_e=512,ra=1e4;function Dn(n){return Array.isArray(n)?[...new Set(n.slice(0,Yi).filter(e=>typeof e=="string"&&e.length>0&&e.length<=_e))]:[]}function na(n){if(!Array.isArray(n))return[];let e=new Set,t=Yi*_e;for(let i of n.slice(0,Yi)){if(typeof i!="string"||!i.length||e.has(i))continue;let r=i.startsWith(gt)?65536:_e;i.length>r||i.length>t||(e.add(i),t-=i.length)}return[...e]}function oa(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 sa(n,e){typeof e.hide=="boolean"&&(n.hide=e.hide),(e.pinned===null||e.pinned==="left"||e.pinned==="right")&&(n.pinned=e.pinned)}function aa(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>_e||e.has(i))return null;e.add(i);let r={colId:i};return sa(r,t),oa(r,t),r}function la(n){if(!Array.isArray(n))return[];let e=[],t=new Set;for(let i of n.slice(0,xn)){let r=aa(i,t);r&&e.push(r)}return e}function da(n){if(!Array.isArray(n))return[];let e=[],t=new Set;for(let i of n.slice(0,xn)){if(i==null||typeof i!="object")continue;let r=i,o=typeof r.colId=="string"?r.colId.trim():"";!o||o.length>_e||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:la(e.columns),sortModel:da(e.sortModel),filterModel:Z(e.filterModel),advancedFilterModel:H(e.advancedFilterModel),quickFilterText:typeof e.quickFilterText=="string"&&e.quickFilterText.trim()?e.quickFilterText.slice(0,ra):null,pagination:{enabled:t.enabled===!0,page:E(t.page,1,1,!0),pageSize:E(t.pageSize,20,1,!0)},selectedRowIds:Dn(e.selectedRowIds),expandedRowIds:Dn(e.expandedRowIds),expandedGroupIds:na(e.expandedGroupIds)}}function Rn(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 ua(n){try{if(typeof structuredClone=="function")return structuredClone(n)}catch{}return Array.isArray(n)?[...n]:n!=null&&typeof n=="object"?{...n}:n}function Sn(n,e){let t=e?new Set(e.map(String)):null;return n.filter(i=>!t||t.has(i.rowId)).map(i=>({...i,data:ua(i.data),cells:i.cells.map(r=>({...r}))}))}function ca(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 En(n,e){let t=new Map;for(let i of n??[]){let r=ca(i,e);r&&!t.has(r.rowId)&&t.set(r.rowId,r)}return[...t.values()]}function Mn(n,e){let t=new Set(n.map(d=>d.rowId)),i=En(e?.conflicts,t),r=new Set(i.map(d=>d.rowId)),o=En(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 ha(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 In(n,e,t){if(n.isDestroyed())return!1;if(t==="keepLocal")return!0;let i=ha(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 pa=["compact","normal","large"],w=["left","center","right"];function Ut(n,e){let t=n.t,i;if(e==="loading")i=t.overlayLoadingTemplate||n.Sh();else if(e==="noRows")i=t.overlayNoRowsTemplate||n.Mh();else if(e==="error")i=t.overlayErrorTemplate||n.Ih();else{n.n.Ah();return}n.n.kh(e,i,t.allowUnsafeOverlayHtml)}var Kt=class{constructor(e){this.e=e;this.nr=null;this.ls=null;this.ds=!1;this.gn=null;this.us=[];this.yn=null;this.ci=0;this.Bl=-1;this._l=-1;this.Yt=1;this.cs=()=>{document.fonts.ready.then(this.Kl)};this.Kl=()=>{this.ci||this.e.o()||(this.ci=requestAnimationFrame(()=>{this.ci=0,this.e.Ie()}))};this.hi=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=f("div",i.join(" ")),this.zl(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.Wl(t),this.ir=f("div","mach-header"),this.ir.setAttribute("role","rowgroup"),this.rr={left:[],center:[],right:[]},this.ss={},this.ai={};for(let r of w){let o=f("div",`mach-pane mach-pane--${r} mach-header-pane`),s=f("div","mach-header-rows");if(r==="center"){let a=f("div","mach-header-viewport");a.appendChild(s),o.appendChild(a)}else o.appendChild(s);this.ir.appendChild(o),this.ss[r]=o,this.ai[r]=s}this.$l(1),this.ye=f("div","mach-body"),this.pn=f("div","mach-pinned-rows mach-pinned-rows--top"),this.pn.style.display="none",this.fn=f("div","mach-pinned-rows mach-pinned-rows--bottom"),this.fn.style.display="none",this.C={},this.ce={},this.as={};for(let r of w){let o=f("div",`mach-pane mach-pane--${r} mach-body-pane`),s=f("div",`mach-body-viewport${r==="center"?" mach-body-viewport--scroll":""}`),a=f("div","mach-row-container");s.appendChild(a),o.appendChild(s),this.ye.appendChild(o),this.as[r]=o,this.C[r]=s,this.ce[r]=a}this.Ke=f("div","mach-overlay"),this.Ke.style.display="none",this.Ke.setAttribute("role","status"),this.Ke.setAttribute("aria-live","polite"),this.Ue=f("div","mach-overlay-content"),this.Ke.appendChild(this.Ue),this.gt=f("div","mach-infinite-loading"),this.gt.style.display="none",this.gt.appendChild(f("div","mach-spinner")),this.mn=f("span"),this.gt.appendChild(this.mn),this.root.append(this.ir,this.pn,this.ye,this.fn,this.Ke,this.gt),e.appendChild(this.root),document.fonts?.addEventListener("loading",this.cs),document.fonts?.status==="loading"&&this.cs(),typeof ResizeObserver<"u"&&(this.yn=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.Bl&&a===this._l||(this.Bl=s,this._l=a,this.Kl())}),this.yn.observe(this.root)),this.Ul(t.theme)}Wl(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")}$l(e){this.Yt=e;for(let t of w){let i=this.ai[t],r=this.rr[t];for(;r.length<e;){let o=f("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.jl()}ql(){return this.Yt}jl(){this.ir.style.height=`${this.Yt*this.e.t.headerHeight}px`;for(let e of w)this.rr[e].forEach((i,r)=>{i.style.top=`${r*this.e.t.headerHeight}px`,i.style.height=`${this.e.t.headerHeight}px`})}Ph(e,t){this.Yl("left",e),this.Yl("right",t)}Yl(e,t){let i=this.ss[e],r=this.as[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)}hs(){let e=this.C.center,t=Math.max(0,e.offsetWidth-e.clientWidth);return Math.max(0,this.ye.clientWidth-t)}Gh(e,t){this.root.style.setProperty("--mach-row-h",`${e}px`),this.root.style.setProperty("--mach-header-h",`${t}px`),this.jl()}Lh(e){for(let t of pa)this.root.classList.toggle(`mach-size--${t}`,t===e)}Ul(e){if(!this.root)return;this.hi?.(),this.hi=null;let t=e==="dark"||e==="auto"&&this.Nh();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.hi=()=>i.removeEventListener("change",r)):typeof i.addListener=="function"&&(i.addListener(r),this.hi=()=>i.removeListener(r))}}Nh(){return typeof window>"u"||typeof window.matchMedia!="function"?!1:window.matchMedia("(prefers-color-scheme: dark)").matches}Fh(e){this.root.classList.toggle("mach-striped",e)}Oh(e){this.root.classList.toggle("mach-cell-borders",e)}Hh(e){this.root.classList.toggle("mach-dom-layout--auto-height",e==="autoHeight")}zl(e){for(let t of this.us)this.root.classList.remove(t);this.us=[];for(let t of String(e??"").split(/\s+/).filter(Boolean))this.root.classList.contains(t)||(this.root.classList.add(t),this.us.push(t))}Vh(e){try{return typeof e=="function"?e():e}catch(t){return this.e.reportError(t,"overlayTemplate"),""}}Bh(e,t,i){if(typeof t=="object"&&t!=null&&"el"in t){this.Ue.appendChild(t.el),this.gn=t.destroy??null;return}if(t instanceof HTMLElement){this.Ue.appendChild(t);return}if(t){i?this.Ue.innerHTML=t:this.Ue.textContent=t;return}if(e!=="loading")return;let r=f("div","mach-spinner");r.setAttribute("aria-label","loading"),this.Ue.appendChild(r)}kh(e,t,i=!1){this.nr===e&&this.ls===t&&this.ds===i||(this.nr=e,this.ls=t,this.ds=i,this.ps(),this.Ue.replaceChildren(),this.Bh(e,this.Vh(t),i),this.Ke.style.display="",this.root.classList.add("mach-has-overlay"),this.Ke.setAttribute("role",e==="error"?"alert":"status"),this.root.setAttribute("aria-busy",e==="loading"?"true":"false"))}Ah(){this.nr&&(this.nr=null,this.ls=null,this.ds=!1,this.Ke.style.display="none",this.root.classList.remove("mach-has-overlay"),this.ps(),this.Ue.replaceChildren(),this.root.setAttribute("aria-busy","false"))}Mt(e,t){this.gt&&(e?(this.mn.textContent!==t&&(this.mn.textContent=t),this.gt.style.display="",this.root.setAttribute("aria-busy","true")):(this.gt.style.display="none",this.nr!=="loading"&&this.root.setAttribute("aria-busy","false")))}destroy(){document.fonts?.removeEventListener("loading",this.cs),this.hi?.(),this.hi=null,this.yn?.disconnect(),this.yn=null,this.ci&&cancelAnimationFrame(this.ci),this.ci=0,this.ps(),this.root?.remove()}ps(){if(!this.gn)return;let e=this.gn;this.gn=null;try{e()}catch(t){this.e.reportError(t,"overlayTemplate.destroy")}}};function An(n,e){return{setData:t=>n.nt(t),transact:t=>n.Hi(t),transactAsync:(t,i)=>n._h(t,i),flushTransactions:()=>n.Xl(),getCount:()=>e.i.L(),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.Ua(t,i),isRemote:()=>e.i.g,reload:t=>n.reload(t),ensureLoaded:(t,i,r)=>n.bo(t,i,r),purgeCache:()=>{e.o()||e.i.Ou()},getCacheSnapshot:()=>e.i.Hu()}}function kn(n,e){return{getDefinitions:()=>e.r.oo(),setDefinitions:t=>n.Ei(t),getState:()=>e.r.pa(),setState:t=>n.zh(t),resetState:()=>n.uo(),setVisible:(t,i)=>n.so(t,i),setPinned:(t,i)=>n.ao(t,i),move:(t,i)=>{e.o()||e.Si(t,i)},setWidth:(t,i)=>n.Ee(t,i),fit:t=>n.Wh(t),autoSize:t=>n.$h(t),autoSizeAll:()=>n.Kh(),getWorkbenchItems:()=>n.Uh(),openWorkbench:t=>{e.o()||e.columnMenu.lh(t)},closeWorkbench:()=>e.columnMenu.close()}}function Pn(n,e){return{getRows:()=>e.f.ja(),getVisibleRows:()=>n.jh(),getNodes:()=>e.f.ti(),getIds:()=>e.f.So(),setRows:(t,i)=>n.qh(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.Yh(t),getRange:()=>e.s.or(),clearRange:()=>n.di()}}function Gn(n,e){return{startCell:t=>n.Xh(t),startRow:t=>e.a.startRow(t),isRowActive:t=>e.a.ul(t),stop:t=>e.a.Pe(t?.cancel===!0),getChanges:()=>e.$.getChanges(),getDirtyRowIds:()=>e.$.getDirtyRowIds(),markSaved:t=>e.$.markSaved(t),rollback:t=>e.$.rollback(t),save:(t,i)=>n.Jh(t,i),undo:()=>!e.o()&&e.O.undo(),redo:()=>!e.o()&&e.O.redo(),canUndo:()=>e.O.canUndo(),canRedo:()=>e.O.canRedo()}}function Ln(n){return{get:()=>n.getState(),apply:(e,t)=>n.Jl(e,t)}}function Nn(n,e){return{get:()=>e.Zh(),getPerformance:()=>e.Ce.snapshot(),resetPerformance:()=>e.Ce.reset()}}function Fn(n,e){return{getModel:()=>e.i._e(),setModel:t=>n.It(t),getAdvancedModel:()=>e.i.Fi(),setAdvancedModel:t=>n.ot(t),getQuickText:()=>e.i.To(),setQuickText:t=>n.At(t),isPresent:t=>t==null?e.i.Vi():v(e.i._e(),t)}}function On(n,e){return{getModel:()=>e.r.ee(),setModel:t=>n.Qh(t)}}function Hn(n,e){return{isEnabled:()=>e.i.Te,setEnabled:t=>{e.o()||e.i.Wa(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 Vn(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.Ro(t),e.i.isGroupExpanded(t)===i),setAllGroupsExpanded:t=>{e.o()||e.i.setAllGroupsExpanded(t)},setAllDetailsExpanded:t=>{e.o()||e.i.setAllDetailsExpanded(t)}}}function Bn(n,e){return{getRoot:()=>e.o()?null:e.n.root,scrollToRow:(t,i)=>e.s.$r(t,i),refreshCells:t=>n.refreshCells(t),refreshLayout:()=>n.refreshLayout(),flush:()=>e.pi.flush(),setOverlay:t=>Ut(e,t),getPinnedRows:t=>e.Le.getRows(t),setPinnedRows:(t,i)=>n.setPinnedRows(t,i)}}function _n(n,e){return{exportCsv:t=>n.ep(t),importCsv:(t,i)=>n.importCsv(t,i),exportMatrix:t=>n.Zl(t),importMatrix:(t,i)=>n.importMatrix(t,i),print:t=>n.print(t),copyRange:()=>e.o()?Promise.resolve(!1):e.Sl()}}function jt(n){return re(n?.reason,"The operation was aborted")}function zn(n,e){return ht(n,e,()=>jt(e))}function Xi(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 Ji=class{constructor(e){this.e=e;this.fs=[];this.sr=null}batch(e){return this.e.Ql(()=>e(this.e.api))}nt(e){if(!this.e.o()){if(this.e.i.g){this.e.t.rowData=e??[];return}this.e.i.nt(e),this.e.K({data:!0})}}Hi(e){if(this.e.o()||this.e.i.g)return;let t=this.e.i.Hi(e);this.ed(t)}_h(e,t={}){if(this.e.o()||this.e.i.g)return Promise.resolve();if(t.signal?.aborted)return Promise.reject(jt(t.signal));let i=new Promise((r,o)=>{let s={transaction:e,revision:this.e.i.Be(),resolve:r,reject:o,signal:t.signal,aborted:!1};t.signal&&(s.onAbort=()=>{s.aborted||(s.aborted=!0,o(jt(t.signal)))},t.signal.addEventListener("abort",s.onAbort,{once:!0})),this.fs.push(s)});return this.sr==null&&(this.sr=setTimeout(()=>this.Xl(),this.e.t.asyncTransactionWaitMillis)),i}td(){this.sr!=null&&clearTimeout(this.sr),this.sr=null;let e=this.fs;return this.fs=[],e}Xl(){let e=this.td(),t=this.e.i,i=t.Be(),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.Be()===i&&this.ed(s)}let o=t.Be()===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(re(void 0,"The table data changed before the transaction could complete")))}ed(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.K({data:!0});return}this.e.K({cells:{rowIds:e.updatedRowIds},summary:!0,overlays:!0})}}Ei(e){this.updateOptions({columnDefs:[...e??[]]})}zh(e){this.e.o()||(this.e.r.fa(e),this.ms())}uo(){this.e.o()||(this.e.r.uo(),this.ms())}so(e,t){this.e.o()||(this.e.r.so(e,t),this.e.ar(),this.e.emit("columnVisibilityChanged",{colId:e,visible:t}))}ao(e,t){this.e.o()||(this.e.r.ao(e,t),this.ms())}ms(){this.e.ar(),this.e.vn()}Ee(e,t){if(this.e.o())return!1;let i=this.e.r.R(e);return!i||!this.e.r.Ee(i,t)?!1:(this.dt([i]),!0)}Wh(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.hs();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=nt(i.map(d=>({width:d.currentWidth,minWidth:d.colDef.minWidth,maxWidth:d.colDef.maxWidth})),Math.max(0,r-o)),a=this.e.t.columnLayout==="fit"&&e===void 0,l=i.filter((d,u)=>a?this.e.r.ca(d,s[u]):this.e.r.Ee(d,s[u]));this.dt(l)}$h(e){if(this.e.o())return;let t=this.e.r.R(e);t&&this.rd(t)&&this.dt([t])}rd(e){return this.e.t.columnLayout==="fit"&&e.colDef.suppressSizeToFit?!1:e.hasCheckbox||e.isDetailToggle?this.e.r.Ee(e,e.isDetailToggle?38:46):this.tp(e,this.e.je.aa(e))}tp(e,t){return this.e.t.columnLayout==="fit"?this.e.r.ca(e,t):this.e.r.Ee(e,t)}Kh(){if(this.e.o())return;let e=[];for(let t of this.e.r.l())this.rd(t)&&e.push(t);e.length>0&&this.dt(e)}dt(e){this.e.ri(),this.e.dt(e)}Qh(e){this.e.o()||(this.e.r.Mi(e),this.e.Mi())}It(e){this.e.o()||(this.e.i.It(e),this.e.lr())}ot(e){this.e.o()||!this.e.i.ot(e)||this.e.lr()}At(e){if(this.e.o())return;let t=this.e.i.At(e);this.e.t.quickFilterText=this.e.i.To(),t&&this.e.lr()}Yh(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.F(this.e.i.resolveRowId(o,-1,`__missing_selection_${this.e.Qt()}`)):this.e.i.He().find(a=>a.data===o);s&&r.push({node:s,selected:!0})}r.length>0?this.e.f.Gt(r,t):t&&this.e.f.deselectAll()}jh(){let e=this.e.f;return this.e.i.kt().filter(t=>!t.isDetail&&!t.isGroup&&e.Br(t.id)).map(t=>t.data).filter(Boolean)}async Jh(e,t){let i=Sn(this.e.$.getChanges(),t);if(i.length===0)return{submitted:[],saved:[],failures:[],conflicts:[]};let r=this.e.i.Be(),o=Mn(i,await e(i));return!this.e.o()&&r===this.e.i.Be()&&this.e.$.Th(o.saved),o}setPinnedRows(e,t){if(this.e.o())return;let i=e==="top"?"pinnedTopRowData":"pinnedBottomRowData";this.e.t[i]=t??[],this.e.Le.setRows(e,this.e.t[i])}di(){this.e.o()||this.e.s.di()}Uh(){return this.e.r.Q().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.bn(!0))}reload(e={}){return this.e.o()?Promise.resolve():e.signal?.aborted?Promise.reject(jt(e.signal)):this.e.i.g?zn(this.e.i.Or(e.signal),e.signal):(this.nt(this.e.t.rowData),Promise.resolve())}bo(e,t,i={}){return this.e.o()?Promise.resolve():zn(this.e.i.bo(e,t,i.signal),i.signal)}importCsv(e,t={}){if(!e)return!1;let{parseValue:i,...r}=t;return this.importMatrix(Et(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=wn(this.e.api),r=t.mode==="paste"?i.pasteRows(e.length):void 0,o=Cn(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.fi(o.rows.flatMap(s=>s.changes));else{let s=o.rows.map(a=>a.data);t.mode==="append"?this.Hi({add:s}):this.nt(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=>Y(d)&&!d.colDef.rowDrag),r=this.e.i._a().filter(d=>!d.isDetail&&!d.isGroup),s=e.includeHeader!==!1?`<tr>${i.map(d=>`<th>${ce(d.colDef.headerName??d.colDef.field??d.id)}</th>`).join("")}</tr>`:"",a=r.map(d=>`<tr>${i.map(u=>{let c=fe(this.e,d,u);return`<td>${ce(c)}</td>`}).join("")}</tr>`).join(""),l=`<!doctype html><html><head><meta charset="utf-8"><title>${ce(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>${ce(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}}Xh(e){let t=this.e.r.R(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.K({cells:e??!0,pinned:e?.includePinned??t,summary:t})}getOption(e){return this.e.t[e]}updateOptions(e){if(this.e.o()||(this.e.gs(e),e=Tn(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;Te(Array.isArray(i)?i:[],e.childrenKey??t.childrenKey)}this.e.Ql(()=>{let i={},r=this.e.t.columnMenu;this.ip(e,i),this.rp(e,i),this.np(e,i),this.op(e,i),this.sp(e),this.ap(e,i),this.lp(e,i),this.dp(e,i),this.up(e,i),this.cp(e,i),this.hp(e,i,r)})}ip(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.pp(e)}pp(e){for(let t of Be){let i=t;v(e,i)&&Reflect.set(this.e.t,i,e[i])}}rp(e,t){let i=this.e.t;for(let o of["rowHeight","headerHeight","rowBuffer"]){let s=Xi(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"?"fit":"normal",this.e.r.Je=!1,t.layout=!0),e.domLayout!=null&&e.domLayout!==i.domLayout&&(i.domLayout=e.domLayout==="autoHeight"?"autoHeight":"normal",this.e.n.Hh(i.domLayout),t.pool=!0),v(e,"maxBodyHeight")&&(i.maxBodyHeight=x(e.maxBodyHeight,1),t.layout=!0),R(e,i,["multiSort"]);let r=Xi(e.detailRowHeight,i.detailRowHeight,1);r!==void 0&&(i.detailRowHeight=r,this.e.s.wn(),this.e.s.dr(!0))}np(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"])}op(e,t){let i=this.e.t;typeof e.enableColumnResize=="boolean"&&e.enableColumnResize!==i.enableColumnResize&&(this.e.ur.lt(),i.enableColumnResize=e.enableColumnResize,t.header=!0),O(e,i,"locale")&&(t.header=!0,t.cells=!0,this.e.mi.xe(),this.e.ct.xe()),O(e,i,"indexOffset")&&(t.cells=!0),O(e,i,"showSummary")&&(t.summary=!0,t.layout=!0);let r=Xi(e.undoStackSize,i.undoStackSize,0,!0);r!==void 0&&(i.undoStackSize=r,this.e.O.kl());let o=x(e.asyncTransactionWaitMillis,0,!0);o!==void 0&&(i.asyncTransactionWaitMillis=o),this.fp(e,t),this.mp(e)}fp(e,t){v(e,"getRowHeight")&&(this.e.t.getRowHeight=e.getRowHeight,this.e.s.st(),t.layout=!0)}mp(e){let t=this.e.t;e.enableRangeSelection!=null&&(t.enableRangeSelection=e.enableRangeSelection,e.enableRangeSelection||this.di()),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.Ul(t.theme),this.e.Cn.refresh())}sp(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.Wa(r),typeof i=="object"&&i&&this.gp(i),t.paginationEnabled&&this.e.i.ic(),this.e.mi.xe()}gp(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)}ap(e,t){v(e,"rowStyleRules")&&(this.e.t.rowStyleRules=Array.isArray(e.rowStyleRules)?e.rowStyleRules:[],t.cells=!0,this.e.K({pinned:!0})),this.yp(e,t),this.vp(e,t);let i=this.e.t;O(e,i,"stripedRows")&&this.e.n.Fh(i.stripedRows),O(e,i,"showCellBorders")&&this.e.n.Oh(i.showCellBorders)}yp(e,t){let i=this.e.t;e.watermark!==void 0&&(Object.assign(i,Di(e)),this.e.Cn.refresh()),this.bp(e),v(e,"summaryMethod")&&(i.summaryMethod=e.summaryMethod,t.summary=!0)}bp(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.ct.xe())}vp(e,t){let{size:i}=e;if(i==null||!v(ke,i)||i===this.e.t.size)return;let r=ke[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.Lh(i),t.layout=!0,t.header=!0}lp(e,t){let i=this.e.t;R(e,i,["suppressCellFocus","suppressRowHoverHighlight","suppressNoRowsOverlay"]),O(e,i,"suppressHeaderFocus")&&(t.header=!0),this.wp(e),this.Cp(e)}wp(e){let t=this.e.t,i=!1;for(let r of["ariaLabel","ariaLabelledBy","ariaDescribedBy"])v(e,r)&&(t[r]=e[r]??Pe[r],i=!0);i&&this.e.n.Wl(t)}Cp(e){let t=this.e.t;for(let i of["overlayNoRowsTemplate","overlayLoadingTemplate","overlayErrorTemplate"])v(e,i)&&(t[i]=e[i]??Pe[i]);R(e,t,["allowUnsafeOverlayHtml"]),v(e,"className")&&(t.className=e.className??"",this.e.n.zl(t.className)),R(e,t,["loading"]),v(e,"error")&&(t.error=e.error??null)}dp(e,t){this.Tp(e,t),this.Dp(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"])}Tp(e,t){let i=this.e.t;if(O(e,i,"rowSelection")&&(this.e.f.yc(),t.header=!0,t.pool=!0,this.e.Tn()),e.quickFilterText!==void 0&&this.At(e.quickFilterText),e.defaultColDef!==void 0&&e.defaultColDef!==i.defaultColDef&&(i.defaultColDef={...Ci,...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})=>Ti(r,o):void 0,t.needsRowRebuild=!0}}Dp(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.Tn()),O(e,i,"childrenKey")&&(t.needsRowRebuild=!0),R(e,i,["isTreeRowExpandable","loadTreeChildren"],!0)&&(t.cells=!0)}up(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.xp(e,t),this.Rp(e,t)}xp(e,t){let i=this.e.t;v(e,"dataProcessor")&&this.e.nd(e.dataProcessor)&&(t.needsRowRebuild=!0);let r=x(e.dataProcessorMinRows,1,!0);r!==void 0&&r!==i.dataProcessorMinRows&&(i.dataProcessorMinRows=r,t.needsRowRebuild=!0)}Rp(e,t){let i=this.e.t;v(e,"persistence")&&(i.persistence=Ke(e.persistence),t.needsStateLoad=!0)}cp(e,t){let i=this.e.t;xi(e,i)&&i.datasourceMode==="block"&&(t.datasourceChanged=!0),this.Ep(e,t),this.Sp(e,t),this.Mp(e)}Ep(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)}}Sp(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.mi.xe()),R(e,i,["detailRowRenderer","isRowExpandable"],!0)&&(t.cells=!0)}Mp(e){e.pinnedTopRowData!==void 0&&this.setPinnedRows("top",e.pinnedTopRowData),e.pinnedBottomRowData!==void 0&&this.setPinnedRows("bottom",e.pinnedBottomRowData)}hp(e,t,i){let r=this.e.t;t.needsColumnRebuild?this.Ip(e,t):v(e,"advancedFilterModel")&&(t.filterChanged=this.e.i.ot(e.advancedFilterModel)),t.needsFeatureReload&&this.e.od(r.features),this.Ap(t),t.filterChanged&&this.e.ys(!t.needsColumnRebuild),t.layout&&this.e.n.Gh(r.rowHeight,r.headerHeight),e.columnMenu!=null&&e.columnMenu!==i&&(t.header=!0),t.stateToApply&&this.Jl(t.stateToApply),t.pool&&(t.cells=void 0),t.overlays=!0,this.e.K(t)}Ip(e,t){t.columnDefsChanged&&!t.needsRowRebuild&&(this.e.ze(),this.e.a.stop(!0));let i=this.e.r.Ei(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.ee()},!1),this.e.ar(),t.header=!1,t.pool=!1}Ap(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.vs(!e.needsStateLoad,!0),this.kp(e,i),t&&!o&&this.e.vs(!e.needsStateLoad)}kp(e,t){if(e.datasourceChanged){this.e.i.Fu();return}t&&(!this.e.i.g&&e.needsRowRebuild?this.nt(this.e.t.rowData):this.e.i.Do())}ep(e={}){let t=this.Zl({...e,target:"csv",protectFormulas:!1});return ln(t,e)}Zl(e={}){let t=this.e.r.l().filter(Y),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.kt():this.e.i._a();return[...i,...r.filter(o=>!o.isDetail&&!o.isGroup).map(o=>t.map(s=>{let a=Ve(this.e,o,s,e.target??"xlsx");return e.protectFormulas===!1?a:le(a)}))]}getState(){return{version:2,columns:this.e.r.pa(!1),sortModel:this.e.r.ee(),filterModel:this.e.i._e(),advancedFilterModel:this.e.i.Fi(),quickFilterText:this.e.i.To(),pagination:{enabled:this.e.i.Te,page:this.e.i.ei(),pageSize:this.e.t.paginationPageSize},selectedRowIds:this.e.f.So(),expandedRowIds:this.e.i.lc(),expandedGroupIds:this.e.i.dc()}}Jl(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.Pp(i,o),this.Gp(i,o),t.emitEvents!==!1&&this.Lp(o),o.has("columns")&&this.e.vn()}Pp(e,t){t.has("columns")&&this.e.r.fa(e.columns??[]),t.has("sort")&&this.e.r.Mi(e.sortModel??[]),t.has("filter")&&(this.e.i.It(e.filterModel??{}),this.e.i.ot(e.advancedFilterModel),this.e.i.At(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.za(e.pagination.page,e.pagination.pageSize),this.e.mi.xe())}Gp(e,t){t.has("columns")&&this.e.ar(),this.e.Np()||(this.e.i.g?(t.has("sort")||t.has("filter"))&&this.e.i.Aa():this.e.i.I()),this.e.W.bs(),this.e.W.ws(),t.has("selection")&&this.e.f.qa(e.selectedRowIds??[])}Lp(e){e.has("sort")&&this.e.emit("sortChanged",{sortModel:this.e.r.ee()}),e.has("filter")&&this.e.ys(),e.has("pagination")&&this.e.i.zi(this.e.t.paginationPageSize)}destroy(){let e=this.td();for(let t of e)t.signal&&t.onAbort&&t.signal.removeEventListener("abort",t.onAbort),t.aborted||t.resolve();this.e.destroy()}},fa={rows:An,columns:kn,selection:Pn,editing:Gn,filtering:Fn,sorting:On,pagination:Hn,hierarchy:Vn,view:Bn,state:Ln,io:_n,diagnostics:Nn};function Wn(n){let e=new Ji(n),t={};for(let[i,r]of Object.entries(fa)){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()}),bn(t,n),yn(t,{suspend:()=>n.suspend(),resume:()=>t.view.refreshLayout(),canReplaceData:()=>!n.a.isEditing()&&n.$.getDirtyRowIds().length===0,readCell:(i,r)=>{let o=n.i.F(i),s=n.r.R(r);return o&&s?dn(Ve(n,o,s,"clipboard")):""},writeInput:i=>n.fi(i.flatMap(({rowId:r,colId:o,value:s})=>{let a=n.i.F(r),l=n.r.R(o);return a&&l?[{node:a,column:l,oldValue:n.d(a,l),newValue:s}]:[]}))}),Object.freeze(t)}var ma={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 qt(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=ma[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 Zi(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 xe=class{constructor(){this.se=new Float64Array(1)}update(e){let t=this.se.length!==e.length+1;t&&(this.se=new Float64Array(e.length+1));let i=0;for(let r=0;r<e.length;r++)i+=e[r].currentWidth,this.se[r+1]!==i&&(this.se[r+1]=i,t=!0);return t}Cs(){return this.se[this.se.length-1]??0}qe(e){let t=Math.max(0,Math.min(Math.trunc(e),this.se.length-1));return this.se[t]??0}Fp(e){let t=Math.max(0,this.se.length-1);return t===0?-1:Math.min(t-1,Math.max(0,Zi(this.se,Math.max(0,e),!0)-1))}sd(e,t,i=2){let r=Math.max(0,this.se.length-1);if(r===0||t<=0||this.Cs()<=t)return{first:0,lastExcl:r};let o=Math.max(0,e),s=o+t,a=Math.max(0,Zi(this.se,o,!0)-1),l=Math.min(r,Zi(this.se,s));return{first:Math.max(0,a-i),lastExcl:Math.min(r,l+i)}}Dn(e,t,i){let r=t.indexOf(i);if(r<0)return;this.update(t);let o=this.qe(r),s=o+i.currentWidth;o<e.scrollLeft?e.scrollLeft=o:s>e.scrollLeft+e.clientWidth&&(e.scrollLeft=s-e.clientWidth)}};var ga=".mach-header-resize, .mach-filter-btn, .mach-menu-btn, .mach-select-all";function Qi(n){return n instanceof HTMLElement&&n.closest(ga)!=null}function er(n){return n==="ArrowLeft"||n==="ArrowRight"}function $n(n,e){typeof e=="string"?n.classList.add(e):Array.isArray(e)&&n.classList.add(...e)}var Yt=class{constructor(e){this.e=e;this.X=[];this.Ts=[];this.A=new xe;this.yt=0;this.Ht=Number.MAX_SAFE_INTEGER}xn(){this.ad(),this.e.ur.lt(),this.gi(!1);let e=this.e.r,t=e.Tu();this.e.n.$l(t);let i=new Set(e.y("center").slice(this.yt,this.Ht)),r=e.Cu(),o=this.e.t.headerHeight;for(let s of w){let a=this.e.n.rr[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 ee){let p=this.X.length;if(l(h.children,u+1),this.X.length===p)continue;let m=this.Op(h);c.appendChild(m),this.Ts.push({group:h,el:m,pane:s})}else if(!h.hide&&e.ge(h)===s&&(s!=="center"||i.has(h))){let p=this.Hp(h,t-u,o);c.appendChild(p.el),this.X.push(p)}};l(r,0)}this.e.t.suppressHeaderFocus||this.X.forEach((s,a)=>{s.el.tabIndex=a===0?0:-1}),this.vt(),this.bs(),this.ws(),this.Vr()}ld(){let e=this.yt,t=this.Ht;this.ad(),(e!==this.yt||t!==this.Ht)&&this.xn()}si(e,t){let i=this.e.n.ai[t];return this.X.find(r=>r.column.id===e&&i.contains(r.el))?.el??null}ad(){let e=this.e.r.y("center"),t=this.e.n.C.center;this.A.update(e);let i=e.length>20?this.A.sd(t.scrollLeft,t.clientWidth,2):{first:0,lastExcl:e.length};this.yt=i.first,this.Ht=i.lastExcl}Hp(e,t,i){let r=f("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.Vp(r,e),this.Bp(r,e);let o=this._p(r,e);this.zp(r,e);let s=f("span","mach-sort-indicator");r.appendChild(s);let{filterBtn:a,filterTagEl:l}=this.Wp(r,e);return this.$p(r,e),this.Kp(r,e),this.Up(r,e),{column:e,el:r,sortEl:s,filterBtn:a,filterTagEl:l,selectAllEl:o}}Vp(e,t){let i=t.colDef;$n(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")}Bp(e,t){this.e.t.suppressHeaderFocus||(e.tabIndex=-1,e.addEventListener("mousedown",()=>this.Ds(t)),e.addEventListener("keydown",i=>this.jp(i,t)))}_p(e,t){if(!t.hasCheckbox||this.e.t.rowSelection!=="multiple")return;let i=f("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}zp(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=f("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)}Wp(e,t){if(!t.filterable)return{};let i=f("button","mach-filter-btn");i.type="button",i.setAttribute("aria-label",`filter ${t.id}`),i.innerHTML=mr,i.addEventListener("click",o=>{o.stopPropagation(),this.e.xs.toggle(t,i)}),e.appendChild(i);let r=f("span","mach-filter-tag");return e.appendChild(r),{filterBtn:i,filterTagEl:r}}$p(e,t){if(!this.e.t.columnMenu||t.hasCheckbox||t.colDef.suppressColumnMenu)return;let i=f("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=vr,i.addEventListener("click",s=>{s.stopPropagation(),this.e.columnMenu.toggle(t,i)}),e.appendChild(i)}Kp(e,t){if(!this.dd(t))return;let i=f("div","mach-header-resize");i.setAttribute("aria-hidden","true"),i.addEventListener("pointerdown",r=>{r.button===0&&(r.preventDefault(),r.stopPropagation(),this.e.ur.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)}Up(e,t){e.addEventListener("click",i=>{this.e.Rn.kc()||Qi(i.target)||t.sortable&&this.e.Er(t,i.shiftKey)}),e.addEventListener("pointerdown",i=>{i.button!==0||Qi(i.target)||this.e.Rn.Ac(i,t)})}Op(e){let t=f("div","mach-header-cell mach-header-cell--group");e.groupId&&(t.dataset.groupId=e.groupId),t.setAttribute("role","columnheader"),$n(t,e.def.headerClass);let i=f("span","mach-header-label mach-header-label--group");return i.textContent=e.headerName,t.appendChild(i),t}vt(){let e={left:0,center:0,right:0};for(let t of w){let i=this.e.n.rr[t],r=0,o=new Map;for(let a of this.e.r.y(t))o.set(a.id,r),r+=a.currentWidth;let s=this.e.t.headerHeight;for(let a of this.X){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.Z(a.column.id)+1))}for(let a of this.Ts){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.Ph(e.left,e.right)}jp(e,t){this.e.o()||this.qp(e,t)||this.Yp(e,t)||this.Xp(e,t)||this.Jp(e,t)||this.Zp(e)}qp(e,t){return e.key!=="Enter"&&e.key!==" "?!1:(Qi(e.target)||(e.preventDefault(),t.sortable&&this.e.Er(t,e.shiftKey)),!0)}Yp(e,t){if(!e.altKey||!er(e.key))return!1;if(!this.dd(t))return!0;let i=e.key==="ArrowRight"?24:-24;return this.e.r.Ee(t,t.currentWidth+i),this.e.ri(),this.e.dt([t]),e.preventDefault(),!0}Xp(e,t){if(!e.ctrlKey||!er(e.key))return!1;if(!t.movable)return!0;e.preventDefault();let i=this.e.r.ge(t),r=this.e.r.y(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.Si(t.id,a),!0}Jp(e,t){if(e.altKey||e.ctrlKey||e.metaKey||!er(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.Ds(i[s]),!0}Zp(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.Ds(t[i]),!0}Ds(e){let t=this.X.find(i=>i.column.id===e.id);if(!t&&!e.pinned&&(this.Dn(e),this.ld(),t=this.X.find(i=>i.column.id===e.id)),!!t){for(let i of this.X)i.el.tabIndex=i===t?0:-1;t.el.focus({preventScroll:!0})}}Dn(e){this.A.Dn(this.e.n.C.center,this.e.r.y("center"),e)}dd(e){return this.e.t.enableColumnResize&&e.resizable}bs(){let e=this.e.r.ee();for(let t of this.X){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"?gr:yr)+(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")}}ws(){let e=this.e.i._e();for(let t of this.X){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?qt(i):"";t.filterTagEl.style.display=o?"":"none",o&&(t.filterTagEl.textContent=o)}}}Vr(){for(let e of this.X){if(!e.selectAllEl)continue;let{all:t,some:i}=this.e.f.Cc();e.selectAllEl.checked=t,e.selectAllEl.indeterminate=i}}destroy(){this.gi(!0)}gi(e){for(let t of this.X){let i=qe(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.X=[],this.Ts=[]}};var Xt=class{constructor(){this.he=null;this.Ye=null;this.yi=!1;this.Rs=-1;this.Es=-1}Qp(){return this.he}Ss(){return this.Ye}ef(){return this.he!=null}start(e,t){(!t||!this.he)&&(this.he={...e}),this.Ye={...e},this.Jt()}tf(e){return this.he?!0:e.colIdx<0?!1:(this.he={...e},this.Jt(),!0)}setEnd(e){this.Ye={...e},this.Jt()}clear(){this.he=null,this.Ye=null,this.Jt()}Jt(){this.yi=!1,this.Rs=-1,this.Es=-1}normalize(e,t){return this.yi!==!1&&this.Rs===e&&this.Es===t?this.yi:(this.Rs=e,this.Es=t,!this.he||!this.Ye||e<=0||t<=0?(this.yi=null,null):(this.yi={r1:Math.max(0,Math.min(this.he.row,this.Ye.row,e-1)),r2:Math.max(0,Math.min(Math.max(this.he.row,this.Ye.row),e-1)),c1:Math.max(0,Math.min(this.he.colIdx,this.Ye.colIdx,t-1)),c2:Math.max(0,Math.min(Math.max(this.he.colIdx,this.Ye.colIdx),t-1))},this.yi))}};var Jt=class{constructor(e){this.host=e;this.Ne=null;this.le=0;this.En=0;this.$i=e=>{let t=this.Ne;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.ud()}};this.of=()=>{if(this.le=0,!!this.Ne?.active){if(!this.current()){this.destroy();return}this.Ki(),this.sf()&&this.ud()}};this.ni=e=>{let t=this.Ne;if(!(!t||e.pointerId!==t.pointerId)){t.clientX=e.clientX,t.clientY=e.clientY,t.active&&this.current()&&this.Ki(),this.cd();try{t.active&&t.drop?.valid&&this.Ms(e.clientX,e.clientY)&&this.current()&&this.commitDrop(t.drop)}finally{this.release()}}};this.Po=e=>{e.key==="Escape"&&(e.preventDefault(),this.destroy())};this.Ur=e=>{e.type==="pointercancel"&&e.pointerId!==this.Ne?.pointerId||this.destroy()}}begin(e){let t=this.host.containers.map(r=>{let o=f("div","mach-row-drop-indicator");return o.hidden=!0,r.append(o),o}),i=f("div","mach-row-drag-preview");i.setAttribute("role","status"),i.hidden=!0,this.host.root.append(i),this.Ne={startY:e.clientY,clientX:e.clientX,clientY:e.clientY,pointerId:e.pointerId,indicators:t,preview:i,drop:null,active:!1},this.ji(!0)}ji(e){S(window,e,{pointermove:this.$i,pointerup:this.ni,pointercancel:this.Ur,keydown:this.Po,blur:this.Ur})}rf(e){return this.Ne?.active===!0&&this.sourceContains(e)}nf(e,t=()=>!0){this.En=requestAnimationFrame(()=>{this.En=0,t()&&[...this.host.root.querySelectorAll(".mach-row-drag-handle")].find(i=>i.closest(".mach-row")?.dataset.id===e)?.focus()})}ud(){this.le||(this.le=requestAnimationFrame(this.of))}Ms(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}sf(){let e=this.Ne;if(!e||!this.Ms(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*C((i.top+r-e.clientY)/r,0,1)):Math.ceil(14*C((e.clientY-i.bottom+r)/r,0,1));if(this.host.scrollBy)return this.host.scrollBy(o);let s=t.scrollTop;return t.scrollTop=C(s+o,0,Math.max(0,t.scrollHeight-t.clientHeight)),t.scrollTop!==s}Ki(){let e=this.Ne;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.Ms(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(${C(e.clientX-o.left+16,8,Math.max(8,o.width-224))}px, ${C(e.clientY-o.top+16,8,Math.max(8,o.height-48))}px, 0)`}cd(){let e=this.Ne;this.Ne=null,this.ji(!1),cancelAnimationFrame(this.le),this.le=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.cd(),this.release(),cancelAnimationFrame(this.En),this.En=0}};function Kn(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 Zt=class extends Jt{constructor(t,i,r,o){super({get root(){return t.n.root},get body(){return t.n.ye},get viewport(){return t.n.C.center},get containers(){return Object.values(t.n.ce)},getRowTop:i,findRowAt:r,scrollBy:o});this.e=t;this.Vt=null}pd(t){return!t.loading&&!t.treeLoading&&!t.isGroup}fd(t){if(this.e.a.isEditing()||t.isDetail||!this.pd(t)||t.data==null||this.e.r.Ze().length||this.e.t.applyRowDrag&&!this.e.i.Ka())return!1;let i=this.vi("canDrag",()=>this.e.t.rowDragPolicy?.canDrag?.({node:t,api:this.e.api})??!0,!1);return i!==!0?i:!this.e.i.M||!!Ui(this.e.api)}canDrag(t){return this.fd(t)===!0}isSource(t){return this.Is()?.isSource(t)??this.rf(t.id)}start(t,i){if(this.destroy(),!this.canDrag(i)||t.isPrimary===!1)return;let r=this.Is();if(r){r.start(t,i);return}let o=this.vi("getRevision",()=>this.As(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.Is();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.vi("getRevision",()=>this.As(i),null);if(!(!a||!l)){this.Vt={node:i,from:i.rowIndex,guard:l};try{this.commitDrop(this.destination(a,o>0))&&this.nf(i.id)}finally{this.release()}}}vi(t,i,r){try{return i()}catch(o){return this.e.reportError(o,`rowDragPolicy.${t}`),r}}As(t){let i=this.e.i,r=this.e.r.Q(),o=this.e.t.rowDragPolicy,s=i.Be(),a=i.Ni(),l=this.e.t.applyRowDrag,d=o?.getRevision?.();return{revision:d,current:()=>this.vi("getRevision",()=>o?.getRevision?.()===d&&s===i.Be()&&a===i.Ni()&&i.F(t.id)===t&&r===this.e.r.Q()&&o===this.e.t.rowDragPolicy&&l===this.e.t.applyRowDrag,!1)}}Is(){let t=Ui(this.e.api);return t!==this.hd&&(this.Sn?.destroy(),this.hd=t,this.Sn=t?this.vi("driver",()=>t({...this.host,api:this.e.api,capture:i=>this.As(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.Sn}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=C(this.host.findRowAt(t),0,this.e.i.L()-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?Kn(r.node,c=>this.e.i.h(c),t,i?"after":"before",r.guard.revision):void 0,l=s?.canDrop&&a?this.vi("canDrop",()=>s.canDrop({node:r.node,api:this.e.api,targetNode:t,intent:a}),!1):!0,d=l===!0&&this.pd(t),u=typeof l=="string"?l:ve(this.e.u("rowDragPosition"),r.from+1,this.md(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.Ua(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.md(i.from,r.boundary),applied:s,intent:r.intent}),!0)}md(t,i){let r=t+1;for(;this.e.i.h(r)?.isDetail;)r++;return i>t?i-(r-t):i}destroy(){this.Sn?.destroy(),super.destroy()}};var ya=new Set(["warning","danger","success","info"]);function ze(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 Re(n,e){n.style.removeProperty("--mach-row-rule-bg"),n.style.removeProperty("--mach-row-rule-fg"),e?.tone&&ya.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 Qt=class{constructor(){this.ae=new Float64Array(0);this.bi=new Float64Array(1);this.ks=new WeakMap;this.Bt=new Map;this.bt=0}reset(e,t){this.ae=new Float64Array(e.length),this.bi=new Float64Array(e.length+1),this.ks=new WeakMap,this.Bt=new Map,this.bt=0;for(let i=0;i<e.length;i++){this.ks.set(e[i],i);let r=Math.max(1,t(e[i],i));this.ae[i]=r,this.Ps(r,1),this.add(i,r)}}get length(){return this.ae.length}indexOf(e){return this.ks.get(e)??-1}update(e,t){if(e<0||e>=this.ae.length)return!1;let i=Math.max(1,t),r=i-this.ae[e];return Math.abs(r)<.01?!1:(this.Ps(this.ae[e],-1),this.ae[e]=i,this.Ps(i,1),this.add(e,r),!0)}qe(e){let t=Math.max(0,Math.min(Math.trunc(e),this.ae.length)),i=0;for(;t>0;)i+=this.bi[t],t-=t&-t;return i}Gs(){return this.qe(this.ae.length)}af(){return this.bt}findIndex(e){if(this.ae.length===0)return 0;let t=Math.max(0,e),i=0,r=0,o=1;for(;o<<1<=this.ae.length;)o<<=1;for(;o>0;){let s=i+o;s<=this.ae.length&&r+this.bi[s]<=t&&(i=s,r+=this.bi[s]),o>>=1}return Math.min(i,this.ae.length-1)}add(e,t){for(let i=e+1;i<this.bi.length;i+=i&-i)this.bi[i]+=t}Ps(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.bt=0;else if(t>0&&(this.bt===0||e<this.bt))this.bt=e;else if(t<0&&e===this.bt&&!this.Bt.has(e)){let r=Number.POSITIVE_INFINITY;for(let o of this.Bt.keys())r=Math.min(r,o);this.bt=Number.isFinite(r)?r:0}}};var va=16e6,ei=class{constructor(){this.height=0;this._t=0;this.wi=0;this.Mn=NaN;this.Ls=0}configure(e,t,i=!0){this.height=i?Math.min(e,va):e,this._t=Math.max(0,e-t),this.wi=Math.max(0,this.height-t),this.Mn=NaN}get wt(){return this._t>this.wi}lf(e){return this._t?C(e,0,this._t)*this.wi/this._t:0}read(e){return e!==this.Mn&&(this.Mn=e,this.Ls=this.wi>0?C(e,0,this.wi)*this._t/this.wi:0),this.Ls}anchor(e,t){this.Ls=C(e,0,this._t),this.Mn=t}};function Un(n){return!!n&&!n.hasCheckbox&&!n.isDetailToggle&&!n.colDef.rowDrag}function ba(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 wa(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 ti=class{constructor(e){this.e=e;this.m=[];this.Ct=0;this.Xe=-1;this.re=0;this.Ns=0;this.Fs=0;this.gd=0;this.E=new ei;this.Tt=0;this.Os=!1;this.In=-1;this.j=new Qt;this.A=new xe;this.pe=new Xt;this.An=!1;this.Pn=[];this.yt=0;this.Ht=0;this.Hs=!1;this.v=null;this.Vs=()=>{this.re||(this.re=requestAnimationFrame(()=>{this.re=0,this.bn()}))};this.On=0;this.Hn=new WeakMap;this.Wt=new Set;this.Vn="";this.Dt=!1;this.cr=[];this.Re=null;this.Cd="";this._s="";this.Td=0;this.Dd=0;this.Bs=e=>{if(e.defaultPrevented||e.ctrlKey||e.metaKey||e.shiftKey||!e.deltaY||!e.cancelable)return;let t=this.e.n.C.center,i=e.deltaMode===1?this.e.t.rowHeight:e.deltaMode===2?t.clientHeight:1,r=this.E.read(t.scrollTop);this.Bn(r+e.deltaY*i),this.E.read(t.scrollTop)!==r&&(e.preventDefault(),t.scrollLeft+=e.deltaX*i,this.Vs())};this.Nn=null;this.fr=null;this.js=!1;this.am=e=>{let t=this.fr;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.lm=e=>{let t=this.fr;if(!t)return;let i=e;if(!t.active){this.Ln();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.Ln(),s>o?(this.dm(t,s,r),this.Ci()):this.jd(r,o,!1)};this.uf=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.Xr())){if(this.e.a.Xr()){let r=i.cellEl?.dataset.colId??"";if(this.e.a.isEditing(i.index,r))return;let o=r?this.e.r.R(r):void 0;this.e.a.cl(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.R(r):void 0;a&&!this.e.a.Xr()&&this.e.a.start(i.node.rowIndex,a)});return}this.Xd(e,t,i)}};this.cf=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.R(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.ne(i,a)&&this.e.a.start(r,a)};this.hf=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.R(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.Z(s);l>=0&&this.Us(r,l,!1)}this.e.qs.open(e.clientX,e.clientY,{rowIndex:r,colId:s})}};this.pf=e=>{if(!this.bm(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.Z(t.cellEl.dataset.colId??"");i>=0&&(this.Us(t.index,i,e.shiftKey),this.An=!0,!e.shiftKey&&!this.e.t.suppressCellFocus&&this.Ae(t.index,t.cellEl.dataset.colId??""))}}};this.vd=()=>{this.An=!1};this.an=e=>{if(this.e.o())return;let t=this.Ut(e);if(this.An&&t&&!t.node.isDetail&&!t.node.isGroup&&t.cellEl){let i=this.e.r.Z(t.cellEl.dataset.colId??""),r=this.pe.Ss();i>=0&&r&&(r.row!==t.index||r.colIdx!==i)&&this.Us(t.index,i,!0)}this.e.t.suppressRowHoverHighlight||!t||t.node.isDetail||this.qd(t.index)};this.ff=()=>{this.qd(-1)};this.mf=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.gf=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 Zt(e,t=>this.Fe(t)-this.Tt,t=>this.Gn(t+this.Tt,this.e.i.L()),t=>this.df(t))}init(){let e=this.e.n.C.center;this.Ns=e.scrollLeft,this.Fs=e.scrollTop,e.addEventListener("scroll",this.Vs,{passive:!0}),this.yd(!0),window.addEventListener("mouseup",this.vd)}yd(e){S(this.e.n.ye,e,{click:this.uf,dblclick:this.cf,contextmenu:this.hf,mousedown:this.pf,mouseover:this.an,mouseleave:this.ff,pointerdown:this.mf,keydown:this.gf})}suspend(){cancelAnimationFrame(this.re),this.re=0,this.Ln(),this.zt.destroy(),this.An=!1}destroy(){cancelAnimationFrame(this.re);let e=this.e.n.C.center;e.removeEventListener("scroll",this.Vs),e.removeEventListener("wheel",this.Bs),this.yd(!1),window.removeEventListener("mouseup",this.vd),this.Ln(),this.zt.destroy(),this.bd(!1),this.Nn?.remove(),this.cr=[],this.Wt.clear(),this.j.reset([],()=>this.e.t.rowHeight),this.A.update([]),this.Re?.remove(),this.Re=null}yf(e){return this.e.r.ge(e)}bn(e=!1){if(this.e.o())return;let t=this.e.n,i=t.C.center,r=i.scrollLeft,o=i.scrollTop,s=this.E.read(o),a=e||r!==this.Ns,l=e||o!==this.Fs||s!==this.gd;!a&&!l||(this.Ns=r,this.Fs=o,this.gd=s,a&&(t.ai.center.style.transform=`translate3d(${-r}px, 0, 0)`,this.e.W.ld(),this.e.Le.vf(r)),l&&this.wd(o),this.e.Fn.hide(),this.dr(!1,a),l&&this.e.i.Nu(this.Xe-1))}bf(){let e={left:0,center:0,right:0};for(let t of w)e[t]=this.e.r.y(t).reduce((i,r)=>i+r.currentWidth,0);return e}wn(){let e=this.e.n,t=this.bf();this.A.update(this.e.r.y("center")),t.center=this.A.Cs();let i=this.e.i.kt(),r=this.wf(i.length);this.Cf(i,r);let o=this.Tf(r);this.Df(o),this.xf(t,o),e.root.setAttribute("aria-rowcount",String(r.rowCount+e.ql()))}wf(e){let t=this.e.i.Li(),i=this.e.t.rowHeight,r=this.e.t.masterDetail?[]:this.Rf();r.length&&this.Ef();let o=this.e.t.datasourceMode!=="block"&&(this.e.t.masterDetail||this.e.t.getRowHeight!=null||r.length>0),s=o?this.Sf(i,r):`fixed|${i}`;return{autoHeightColumns:r,positionedCount:Math.min(t,e),rowCount:t,rowHeight:i,signature:s,variable:o}}Sf(e,t){let i=t.map(r=>`${r.id}:${r.currentWidth}`).join(",");return`${this.e.i.Ni()}|${e}|${this.e.t.detailRowHeight}|${i}`}Cf(e,t){if(!t.variable){this.Mf(t);return}if(t.signature!==this.Vn||this.j.length!==t.positionedCount){t.autoHeightColumns.some(it)&&this.st();let i=e.slice(0,t.positionedCount);this.j.reset(i,r=>this.xd(r,t.autoHeightColumns)),this.Rd(t);return}if(this.Wt.size!==0){for(let i of this.Wt){let r=this.j.indexOf(i);r>=0&&this.j.update(r,this.xd(i,t.autoHeightColumns))}this.Rd(t)}}Mf(e){this.j.length>0&&this.j.reset([],()=>e.rowHeight),this.Vn=e.signature,this.Wt.clear(),this.On=e.rowHeight}Rd(e){this.Vn=e.signature,this.Wt.clear(),this.On=this.j.af()||e.rowHeight}Tf(e){return(e.variable?this.j.Gs():e.positionedCount*e.rowHeight)+Math.max(0,e.rowCount-e.positionedCount)*e.rowHeight}xf(e,t){let i=this.e.n,r=i.C.center,o=this.E.read(r.scrollTop),s=this.E.wt;this.E.configure(t,r.clientHeight,!this.Dt);let a=Math.max(0,r.clientWidth-e.left-e.right),l=Math.max(e.center,a);for(let d of w){let u=i.ce[d];u.style.height=`${this.E.height}px`,u.style.overflow=this.E.wt?"hidden":"",d==="center"&&(u.style.width=`${l}px`)}(s||this.E.wt)&&this.Bn(o),this.wd(r.scrollTop),this.Os!==this.E.wt&&(this.Os=this.E.wt,this.Os?r.addEventListener("wheel",this.Bs,{passive:!1}):r.removeEventListener("wheel",this.Bs))}Bn(e){let t=this.e.n.C.center;t.scrollTop=this.E.lf(e),this.E.anchor(e,t.scrollTop)}wd(e){let t=this.E.wt;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)`}}df(e){let t=this.e.n.C.center,i=this.E.read(t.scrollTop);this.Bn(i+e);let r=this.E.read(t.scrollTop)!==i;return r&&this.bn(),r}Wr(e){this.Hn.delete(e),this.Wt.add(e)}Df(e){let{ye:t,C: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.A.Cs()}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.Dt=a&&u===e+c,d.style.overflowY=a&&!this.Dt?"auto":"",this.Dt&&d.scrollTop&&(d.scrollTop=0)}st(){this.Hn=new WeakMap,this.Wt.clear(),this.Vn=""}xd(e,t){if(e.isDetail)return this.e.t.detailRowHeight;let i=this.Hn.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.If(e,t))),this.Hn.set(e,r),r}Fe(e){let t=this.j.length;return t===0?Math.max(0,e)*this.e.t.rowHeight:e<=t?this.j.qe(e):this.j.Gs()+(e-t)*this.e.t.rowHeight}Gn(e,t){if(t<=0)return 0;let i=this.j.length,r=this.j.Gs();if(i>0&&e<r)return this.j.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))}Rf(){return this.e.r.l().filter(e=>e.colDef.autoHeight===!0)}get Af(){return this.e.r.l().some(e=>e.colDef.autoHeight===!0)}Ef(){this.Re||(this.Re=f("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.je.oa].join("|");i!==this.Cd&&(this.Cd=i,this.st(),this._s=parseFloat(e.letterSpacing)||parseFloat(e.wordSpacing)?"":t,this.Td=parseFloat(e.paddingLeft)+parseFloat(e.paddingRight)+parseFloat(e.borderLeftWidth)+parseFloat(e.borderRightWidth),this.Re.style.width="10000px",this.Re.textContent="M",this.Dd=Math.ceil(this.Re.getBoundingClientRect().height))}If(e,t){let i=this.Re,r=0;for(let o of t){let s=fe(this.e,e,o);if(!s)continue;let a=this.Dd;if(!this._s||this.e.je.eo(s,this._s)>o.currentWidth-this.Td){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}Pl(e,t){if(this.e.t.flashCells)for(let i of e)for(let r of t)this.cr.push([i,r])}Ed(){if(this.cr.length===0)return;let e=this.cr;this.cr=[];for(let[t,i]of e){let r=this.si(t,i);if(!r)continue;r.classList.remove("mach-cell--flash"),r.offsetWidth,r.classList.add("mach-cell--flash");let o=Me(r),s=o.flashTimer;s&&clearTimeout(s),o.flashTimer=window.setTimeout(()=>{r.classList.remove("mach-cell--flash"),o.flashTimer=void 0},800)}}Ie(){this.wn();let e=this.e.n.C.center,i=this.e.t.rowHeight;this.e.t.masterDetail&&(i=Math.min(i,this.e.t.detailRowHeight)),this.On>0&&(i=Math.min(i,this.On));let r=Math.ceil(e.clientHeight/Math.max(1,i)),o=this.Dt?this.e.i.L():r+this.e.t.rowBuffer*2+1,s=o%2===0?o:o+1;this.Sd(),s>this.m.length&&this.Md(s),this._n(),this.dr(!0,!1),this.zs()}Md(e){for(;this.m.length<e;){let t={index:-1,nodeId:"",kind:"master",rows:{},cells:{}},i=this.e.n;for(let r of w){if(this.e.r.y(r).length===0)continue;let s=f("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.Id(a)))}if(this.e.t.masterDetail){let r=f("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.Pn:this.e.r.y(e)}Id(e){let t=f("div","mach-cell");if(t.dataset.colId=e.id,t.setAttribute("role","gridcell"),e.hasCheckbox){let i=f("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}kf(e){let t=new Map(this.Pn.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.Bo(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.Id(l):s[u];return c!==a&&o.insertBefore(c,a),a=c.nextElementSibling,c})}}Ad(){this.hr=void 0,this.kd(),this.bd(!0),this.Ct=0,this.Xe=-1}bd(e){this.Pd(0,e),this.kn=void 0,this.Pn=[]}Pd(e,t){for(let i=e;i<this.m.length;i++){let r=this.m[i];r.detailRow&&this.Ws(r.detailRow);for(let o of w){for(let s of r.cells[o]??[])!t&&r.index>=0&&this.e.a.Bo(r.index,s.dataset.colId??"",s),L(this.e,s);t&&r.rows[o]?.remove()}t&&r.detailRow?.remove()}this.m.length=e}_n(){let e=this.Pf();for(let t of w){let i=this.e.r.y(t),r=this.$t(t),o=this.Gf(t,r,i);this.Lf(t,r,o,e)}this.Nf()}Pf(){return this.e.t.masterDetail||this.e.t.getRowHeight!=null||this.Af}Gf(e,t,i){if(e==="center"){this.A.update(i);let s=this.e.r.y("left").length;return t.map(a=>this.A.qe(this.e.r.Z(a.id)-s))}let r=0,o=[];for(let s of t)o.push(r),r+=s.currentWidth;return o}Lf(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];s[d].style.width=`${u.currentWidth}px`,s[d].style.left=`${i[d]}px`,s[d].setAttribute("aria-colindex",String(this.e.r.Z(u.id)+1))}}}Nf(){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)}Sd(){let e=this.e.n.C.center,t=this.e.r.y("center");this.A.update(t);let{first:i,lastExcl:r}=t.length>20?this.A.sd(e.scrollLeft,e.clientWidth,2):{first:0,lastExcl:t.length};if(t===this.kn&&i===this.yt&&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.kf(s),this.kn=t,this.Pn=s,this.yt=i,this.Ht=r,this.Hs=s.some(a=>a.colDef.colSpan!=null),!0}yo(){return{first:this.Ct,lastExcl:this.Xe}}dr(e=!1,t=!0){let i=this.e.Ce.start(),r=this.Ff(e,t);if(this.e.a.ml(),!r)return;let o=Math.max(0,this.Xe-this.Ct);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.Pd(a,!0)}this.Ci();let s=this.e.r.y("left").length+this.$t("center").length+this.e.r.y("right").length;this.e.Ce.xh(i,o,s)}Ff(e,t){let i=this.e.n.C.center,r=this.E.read(i.scrollTop)-i.scrollTop,o=r!==this.Tt;this.Tt=r;let s=this.e.i.L(),a=this.e.t.rowBuffer,l=t&&this.Sd();if(l&&this._n(),s===0){for(let c of this.m)this.Gd(c);return this.Ct=0,this.Xe=0,!0}let{first:d,lastExcl:u}=this.Of(i,s,a);return!e&&!l&&d===this.Ct&&u===this.Xe?(o&&this.Ld(),l||o):(this.Hf(d,u),this.Ct=d,this.Xe=u,this.Vf(d,u,e,l),l&&this.pr(),o&&this.Ld(),!0)}Of(e,t,i){if(this.Dt)return{first:0,lastExcl:t};let r=this.E.read(e.scrollTop),o=this.Gn(r,t),s=r+e.clientHeight,a=Math.min(t,this.Gn(s,t)+1);return{first:C(o-i,0,t-1),lastExcl:C(a+i,1,t)}}Hf(e,t){if(!(this.Dt&&this.Ct===0&&t>=this.Xe))for(let i of this.m)i.index!==-1&&(i.index<e||i.index>=t)&&this.Gd(i)}Vf(e,t,i,r){let o=t-e;o>this.m.length&&(this.Md(o+o%2),this._n());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.zn(l,a,"center");continue}this.Bf(l,s,a)}}}Gd(e){if(this.Nd(e),this.Dt&&e.index>=0)for(let t of w)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 w){let i=e.rows[t];i&&(i.style.display="none",delete i.dataset.id,delete i.dataset.index,Re(i,void 0),i.classList.remove("mach-row--drag-source"))}e.detailRow&&(this.Ws(e.detailRow),e.detailRow.style.display="none")}Bf(e,t,i){e.index>=0&&e.index!==t&&this.Nd(e),e.index=t,e.nodeId=i.id;let r=this.Fe(t),o=r-this.Tt,s=this.Fe(t+1)-r;if(i.isDetail){this._f(e,i,t,o,s);return}this.zf(e,i,t,o,s)}Ld(){for(let e of this.m){if(e.index<this.Ct||e.index>=this.Xe)continue;let t=`translateY(${this.Fe(e.index)-this.Tt}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 w){let l=e.rows[a];l&&(l.style.display="none")}let s=e.detailRow;s&&(this.Fd(s,i,r,o),this.$s(s,t))}zf(e,t,i,r,o){e.kind="master",e.detailRow&&(e.detailRow.style.display="none");let s=this.Wf(t),a=ze(this.e,t);for(let l of w){let d=e.rows[l];d&&(this.$f(d,t,i,r,o,s),Re(d,a),this.zn(e,t,l))}this.v&&this.v.rowIndex===i&&this.pr()}Wf(e){let t=this.e.i.M,i=e.isGroup===!0,r=t&&this.e.i.wo(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.zr(e)+1),{expanded:s,expandable:o,level:a}}$f(e,t,i,r,o,s){this.Fd(e,i,r,o,t.id),this.Od(e,t);let a=this.In===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.Kf(e,s)}Fd(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.ql()+1))}Od(e,t){e.classList.toggle("mach-row--selected",t.selected),e.setAttribute("aria-selected",t.selected?"true":"false")}Kf(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")}zn(e,t,i){let r=this.$t(i),o=e.cells[i];if(!o)return;let s=e.index,a=this.e.r,l=i==="center"&&this.Hs,d=l?a.y("left").length:0,u=0;e.rows[i]?.classList.toggle("mach-row--editing",this.e.a.ul(s));for(let c=0;c<r.length;c++){let h=r[c],p=o[c];if(l){let m=a.Z(h.id)-d,g=m<u?0:this.Uf(t,h,s,this.kn.length-m);if(g>0&&(u=m+g),g===0||u<=this.yt){L(this.e,p),p.setAttribute("aria-hidden","true"),p.style.display="none";continue}(g>1||p.hasAttribute("aria-colspan"))&&this.jf(p,m,g)}p.style.display==="none"&&(p.style.display=""),p.removeAttribute("aria-hidden"),!this.e.a.gl(s,t,h,p)&&(this.Hd(p,t,h),this.Ks(p,s,h))}}Uf(e,t,i,r){let o=t.colDef.colSpan;if(!o)return 1;try{let s=o(pe(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){let r=`${this.A.qe(t+i)-this.A.qe(t)}px`;e.style.width!==r&&(e.style.width=r),i>1?e.setAttribute("aria-colspan",String(i)):e.removeAttribute("aria-colspan")}$s(e,t){this.Ws(e);let i=t.masterId!=null?this.e.i.F(t.masterId):t,r=f("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))}}Ws(e){let t=qe(e);if(t)try{t()}catch(i){this.e.reportError(i,"detailRowRenderer.destroy")}e.textContent=""}Hd(e,t,i){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 o=f("span","mach-cell-loading-bar");o.style.width=`${34+(i.id.length*13+t.rowIndex*7)%44}%`,e.replaceChildren(o),this.Kt(e);return}e.removeAttribute("aria-busy"),e.setAttribute("aria-readonly",this.e.a.ne(t,i)?"false":"true"),e.removeAttribute("aria-expanded"),e.removeAttribute("aria-level");let r=this.qf(t,i);if(r!=="standard"){L(this.e,e),this.Yf(r,e,t,i);return}Xe(this.e,e,t,i),this.Vd(e,t,i),this.Xf(e,t,i)}qf(e,t){return e.isGroup?"group":t.isDetailToggle?"detail":t.hasCheckbox?"checkbox":t.colDef.rowDrag?"drag":Ge(t.colDef,"index")?"index":this.e.i.M&&this.Bd()?.id===t.id?"tree":"standard"}Yf(e,t,i,r){if(e==="group")this.Jf(t,i,r);else if(e==="detail"){let o=this.e.i.isRowExpanded(i.id),s=f("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.Zf(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.$a(i)+this.e.t.indexOffset);let o=`mach-cell mach-cell--index ${Ye(r)}`;t.className!==o&&(t.className=o),this.Vd(t,i,r)}else this.Qf(t,i,r)}Xf(e,t,i){if(this.e.t.editType!=="cell"||this.e.t.editableIndicator==="none"||!this.e.a.ne(t,i))return;let r=f("button",`mach-cell-edit-trigger mach-cell-edit-trigger--${this.e.t.editableIndicator}`);r.type="button",r.tabIndex=-1,r.title="Edit cell",r.setAttribute("aria-label","Edit cell"),r.innerHTML='<svg viewBox="0 0 16 16" aria-hidden="true" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><path d="m10.8 2.7 2.5 2.5L5.5 13H3v-2.5z"/><path d="m9.5 4 2.5 2.5"/></svg>',r.addEventListener("mousedown",o=>{o.preventDefault(),o.stopPropagation()}),r.addEventListener("click",o=>{o.preventDefault(),o.stopPropagation(),this.Ae(t.rowIndex,i.id),this.e.a.start(t.rowIndex,i)}),e.appendChild(r)}Nd(e){if(!(e.index<0))for(let t of w)for(let i of e.cells[t]??[])this.e.a.Bo(e.index,i.dataset.colId??"",i)}Bd(){return this.hr!==void 0?this.hr:(this.hr=this.e.r.l().find(e=>!e.hasCheckbox&&!e.isDetailToggle&&!e.colDef.rowDrag&&!Ge(e.colDef,"index"))??null,this.hr)}Qf(e,t,i){let r=this.e.i.isRowExpandable(t),o=this.e.i.zr(t),s=q(this.e,t,i,this.e.d(t,i)),a=f("span","mach-tree-indent");a.style.width=`${o*16}px`;let l=f("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=f("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 p=f("span",`mach-detail-toggle${u?" mach-detail-toggle--open":""}${c}`);p.setAttribute("aria-hidden","true"),p.textContent="\u25B6",h.appendChild(p),h.addEventListener("keydown",m=>{(m.key==="Enter"||m.key===" ")&&m.stopPropagation()}),l.appendChild(h)}else{let u=f("span","mach-tree-toggle-spacer");l.appendChild(u)}let d=f("span","mach-tree-text");d.textContent=s,l.appendChild(d),e.replaceChildren(l),s&&!this.e.t.tooltipComponent?e.title=s:e.removeAttribute("title"),bi(this.e,e,t,i)}Kt(e){e.style.height!==""&&(e.style.height=""),e.style.display==="none"&&(e.style.display=""),e.removeAttribute("aria-rowspan")}Vd(e,t,i){let r=this.e.i.ac(i.id);if(!r||t.isDetail){this.Kt(e);return}let o=this.e.i.$a(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.L()),l=this.Fe(a)-this.Fe(o);e.style.height=`${l>0?l:s*this.e.t.rowHeight}px`,e.setAttribute("aria-rowspan",String(s))}else this.Kt(e)}Jf(e,t,i){if(i.hasCheckbox){this._d(e,t);return}if(i.isDetailToggle){this.zd(e);return}let r=this.e.r.da();if(r&&i.id===r.id){this.em(e,t);return}this.tm(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.Xa(t):null;i.checked=o?.all??t.selected,i.indeterminate=o?o.some&&!o.all:r.gc(t.id),i.disabled=!r.We(t)}e.className!=="mach-cell mach-cell--selection"&&(e.className="mach-cell mach-cell--selection")}em(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=f("span","mach-group-label");o.style.paddingLeft=`${r*16}px`;let s=f("span",`mach-detail-toggle${i?" mach-detail-toggle--open":""}`);s.textContent="\u25B6";let a=f("span","mach-group-text"),l=this.e.r.Ze()[r],d=l?.colDef.headerName?`${l.colDef.headerName}: `:"";a.textContent=`${d}${t.groupKey??""}`;let u=f("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")}tm(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?q(this.e,t,i,r):vi(r);let o=`mach-cell ${Ye(i)}`;return e.className!==o&&(e.className=o),!0}zd(e){e.textContent="",e.className!=="mach-cell"&&(e.className="mach-cell")}I(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.$s(r.detailRow,o);continue}for(let s of w){let a=r.rows[s];a&&this.Od(a,o),r.cells[s]&&this.zn(r,o,s)}}}this.pr(),this.Ed()}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.im(o,s,t,i)||this.rm(o,s,r,e.force===!0)}this.pr(),this.Ed()}im(e,t,i,r){return e.index<0?!1:i==null&&r==null?!0:i?.has(t.id)===!0||r?.has(e.index)===!0}rm(e,t,i,r){if(e.kind==="detail"){i==null&&e.detailRow&&this.$s(e.detailRow,t);return}let o=i==null||this.Hs,s=ze(this.e,t);for(let a of w){let l=e.rows[a];l&&Re(l,s),o?this.zn(e,t,a):this.nm(e,t,a,i,r)}}nm(e,t,i,r,o){let s=this.$t(i),a=e.cells[i];if(a)for(let l=0;l<s.length;l++){let d=s[l];if(!r.has(d.id))continue;let u=a[l];u&&(this.e.a.gl(e.index,t,d,u)||(o&&L(this.e,u),this.Hd(u,t,d),this.Ks(u,e.index,d)))}}om(){this.e.o()||(this.v&&this.v.rowIndex>=this.e.i.L()&&this.Ae(null,null),this.kd(),this.wn(),this.dr(!0),this.zs(),this.e.Ge.refresh())}zs(){let e=this.e.t,t=e.loading?"loading":e.error!=null?"error":this.e.i.L()===0&&!e.suppressNoRowsOverlay?"noRows":null;Ut(this.e,t)}si(e,t){let i=this.e.r.R(t);if(!i)return null;let r=this.yf(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}kd(){this.pe.Jt()}De(){let e=this.e.i.L(),t=this.e.r.l().length;return this.pe.normalize(e,t)}li(){let e=this.De();if(e)return e;let t=this.v;if(t){let i=this.e.r.Z(t.colId);if(i>=0)return{r1:t.rowIndex,c1:i,r2:t.rowIndex,c2:i}}return null}or(){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??""}}Ho(){let e=this.pe.Qp();if(e)return{row:e.row,colIdx:e.colIdx};let t=this.li();return t?{row:t.r1,colIdx:t.c1}:null}di(){let e=this.De();this.pe.clear(),e&&(this.Wn(),this.Ci(),this.e.emit("rangeSelectionChanged",{range:null}))}Wn(){for(let e of this.m)if(!(e.index<0||e.kind!=="master"))for(let t of w){let i=this.$t(t);e.cells[t]?.forEach((r,o)=>{let s=i[o];s&&this.Ks(r,e.index,s)})}}Us(e,t,i){this.pe.start({row:e,colIdx:t},i),this.Wn(),this.Ci(),this.e.emit("rangeSelectionChanged",{range:this.or()})}zc(e,t){if(!this.pe.ef()){let a=this.v;if(!a)return;let l=this.e.r.Z(a.colId);if(!this.pe.tf({row:a.rowIndex,colIdx:l}))return}let i=this.e.i.L(),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.Wn(),this.Ci();let o=this.e.r.l(),s=this.pe.Ss();s&&s.colIdx<o.length&&this.Ae(s.row,o[s.colIdx].id),this.e.emit("rangeSelectionChanged",{range:this.or()})}Ks(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.Z(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")}sm(){if(this.Nn)return this.Nn;let e=f("div","mach-fill-handle");return e.style.display="none",e.addEventListener("pointerdown",t=>{this.js=!0,this.Wd(t)}),e.addEventListener("mousedown",t=>{this.js||this.Wd(t)}),this.e.n.ce.center.appendChild(e),this.Nn=e,e}Ci(){let e=this.sm(),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.y("left").length,o=i.y("center");if(t.c2<r||t.c2>=r+o.length){e.style.display="none";return}let s=t.c2-r;this.A.update(o);let a=this.A.qe(s+1),l=this.Fe(Math.min(t.r2+1,this.e.i.L()))-this.Tt,d=this.e.n.C.center;if(this.E.wt&&(l<d.scrollTop||l>d.scrollTop+d.clientHeight)){e.style.display="none";return}e.style.display="",e.style.left=`${this.E.wt?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`}Wd(e){if(this.e.o()||e.button!==0)return;let t=this.De();t&&(e.preventDefault(),e.stopPropagation(),this.fr={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.Tt,o=this.e.i.L(),s=this.Gn(r,o);return Math.max(this.fr.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.y("left").length,a=o.y("center");this.A.update(a);let l=this.A.Fp(r);if(l<0)return s;let d=this.A.qe(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.am);for(let i of["pointerup","mouseup","pointercancel"])window[t](i,this.lm)}Ln(){this.fr=null,this.js=!1,this.$d(!1),this.e.n.root.classList.remove("mach-root--filling")}jd(e,t,i){let r=this.pe.Ss();!r||t===(e?r.colIdx:r.row)||(this.pe.setEnd(e?{row:r.row,colIdx:t}:{row:t,colIdx:r.colIdx}),this.Wn(),i&&(e&&this.Ci(),this.e.emit("rangeSelectionChanged",{range:this.or()})))}dm({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 p=s?this.e.i.h(h):void 0,m=s?void 0:a[h];(s?!p||p.isDetail||p.isGroup:!Un(m))||this.um(a,d,u,o,l,p,m)}this.e.fi(l),this.e.emit("rangeSelectionChanged",{range:this.or()})}um(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=ba(l);for(let u=i+1;u<=r;u++){let c=s??this.e.i.h(u),h=a??e[u];if(!c||!Un(h)||!this.e.a.ne(c,h))continue;let p=wa(d,u-t),m=this.e.d(c,h);o.push({node:c,column:h,oldValue:m,newValue:p})}}Ae(e,t){if(this.cm(),e==null||t==null){this.v=null;return}this.v={rowIndex:e,colId:t},this.pr(),this.hm()}pr(){if(!this.v)return;let e=this.si(this.v.rowIndex,this.v.colId);if(e&&e.style.display!=="none"){let t=Math.max(0,this.e.r.Z(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")}cm(){if(this.v){let e=this.si(this.v.rowIndex,this.v.colId);e&&(e.classList.remove("mach-cell--focus"),e.removeAttribute("id"))}this.e.n.root.removeAttribute("aria-activedescendant")}hm(){if(!this.v)return;this.$r(this.v.rowIndex,"nearest");let e=this.e.r.R(this.v.colId);!e||e.pinned||this.A.Dn(this.e.n.C.center,this.e.r.y("center"),e)}$r(e,t="top"){let i=this.e.n.C.center,r=this.e.i.L();if(r===0)return;let o=C(e,0,r-1),s=i.clientHeight,a=this.E.read(i.scrollTop),l=this.Fe(o),d=this.Fe(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.Fe(r)-s);this.Bn(C(u,0,c)),this.bn()}qd(e){if(this.In===e)return;let t=this.In;this.In=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 w)i.rows[r]?.classList.toggle("mach-row--hover",t)}mr(){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.pm(t,r,s)||this.fm(t,r,s))return;let a=s?.dataset.colId??"",l=a?this.e.r.R(a):void 0;this.mm(r,l)||r.isDetail||this.gm(t,r,o,e)||!s||!l||(this.mr(),this.e.t.suppressCellFocus||this.Ae(o,a),this.e.f.Za(r,e,!1),this.ym(e,r,o,l),this.vm(r,o,l))}pm(e,t,i){if(!t.isGroup)return!1;if(this.mr(),e.closest(".mach-row-checkbox")){let o=this.e.f.Xa(t).all;return this.e.f.vc(t,!o),!0}let r=this.e.r.da();return(!r||!i||i.dataset.colId===r.id)&&this.e.i.Ro(t.id),!0}mm(e,t){return!t?.isDetailToggle||e.isDetail?!1:(this.mr(),this.e.Kr(e.id),!0)}gm(e,t,i,r){let o=e.closest(".mach-cell--selection");return o?(this.mr(),this.e.t.suppressCellFocus||this.Ae(i,o.dataset.colId??""),this.di(),this.e.f.Za(t,r,!0),!0):!1}ym(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})}vm(e,t,i){(this.e.t.singleClickEdit||i.colDef.singleClickEdit===!0)&&this.e.a.ne(e,i)&&this.e.a.start(t,i)}fm(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.mr(),t.treeLoadError?this.e.i.loadTreeChildren(t.id,!0).catch(()=>{}):this.e.i.Kr(t.id),!0)}bm(e){return!!(e.target.closest(".mach-cell-editor-shell, .mach-row-editor-shell, .mach-tree-toggle, .mach-row-drag-handle")||this.e.a.Xr())}Zf(e,t){let i=e.querySelector("button.mach-row-drag-handle"),r=i?.value===t.id?i:f("button","mach-row-drag-handle");r.type="button",r.value=t.id;let o=this.zt.fd(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 ii=class{constructor(e){this.e=e;this.Oe=null;this.Jd={left:void 0,center:void 0,right:void 0};this.Ys={left:[],center:[],right:[]}}init(){this.Oe=f("div","mach-footer"),this.Oe.style.display="none",this.Oe.setAttribute("role","row"),this.e.n.root.appendChild(this.Oe);for(let e of w){let t=f("div",`mach-footer-row mach-footer-row--${e}`);t.style.height=`${this.e.t.rowHeight}px`,this.Oe.appendChild(t),this.Jd[e]=t}}setVisible(e){this.Oe&&(this.Oe.style.display=e?"":"none")}refresh(){if(!this.Oe||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.kt().filter(r=>!r.isDetail&&!r.isGroup);for(let r of w){let o=this.e.r.y(r),s=this.Jd[r];this.Ys[r].length!==o.length&&(s.textContent="",this.Ys[r]=o.map(()=>{let l=f("div","mach-footer-cell");return l.setAttribute("role","cell"),s.appendChild(l),l}));let a=0;o.forEach((l,d)=>{let u=this.Ys[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.Oe?.remove(),this.Oe=null}};var ri=class{constructor(e){this.e=e;this.T=null;this.$n=null;this.Xs=null;this.Ti=null;this.jt=null;this.Kn=null;this.Un=null;this.jn=null;this.qn=null;this.qt=[]}init(){this.T=f("div","mach-pagination"),this.T.style.display="none",this.T.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.$n=f("span","mach-pagination-total"),this.Kn=e("mach-pagination-first",this.e.u("pageFirst"),"\xAB",()=>this.e.i.setPage(1)),this.Un=e("mach-pagination-prev",this.e.u("pagePrev"),"\u2039",()=>this.e.i.setPage(this.e.i.ei()-1)),this.Xs=f("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.qn=e("mach-pagination-last",this.e.u("pageLast"),"\xBB",()=>this.e.i.setPage(this.e.i.getPageCount())),this.T.append(this.$n,this.Kn,this.Un,this.Xs,this.jn,this.qn),this.e.t.paginationShowSizeSelector&&(this.jt=ne({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.Ti=this.jt.native,this.Zd(),this.T.appendChild(this.jt.el)),this.e.n.root.appendChild(this.T),this.qt.push(this.e.ue.on("modelUpdated",()=>this.refresh()),this.e.ue.on("paginationChanged",()=>this.refresh())),this.refresh()}Zd(){if(!this.Ti)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.T&&(this.Ti&&this.e.t.paginationShowSizeSelector&&this.Zd(),this.refresh())}Qd(e,t){e&&e.textContent!==t&&(e.textContent=t)}wm(e,t){let i=e<=1,r=e>=t;this.Kn&&(this.Kn.disabled=i),this.Un&&(this.Un.disabled=i),this.jn&&(this.jn.disabled=r),this.qn&&(this.qn.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.ei(),s=e.getPageCount();this.$n&&this.e.t.paginationShowTotal&&this.Qd(this.$n,W(this.e.u("paginationTotal"),i)),this.Qd(this.Xs,ve(this.e.u("paginationPage"),o,s)),this.wm(o,s),this.Ti&&Number(this.Ti.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.Ti=null,this.T?.remove(),this.T=null}};var ni=class{constructor(e){this.e=e;this.top=null;this.bottom=null}init(){this.top=this.eu(this.e.n.pn),this.bottom=this.eu(this.e.n.fn)}eu(e){let t={root:e,segments:{left:f("div"),center:f("div"),right:f("div")},centerViewport:f("div","mach-pinned-viewport"),rowWrappers:{left:[],center:[],right:[]},cells:[],data:[]};for(let i of w)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.Js(i,e),this.vt(),this.e.Ie())}getRows(e){return this[e]?.data.slice()??[]}xe(){!this.top||!this.bottom||(this.Js(this.top,"top"),this.Js(this.bottom,"bottom"))}Js(e,t){this.gi(e);for(let o of w){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=ze(this.e,a,t);for(let u of w){let c=f("div","mach-pinned-row");Re(c,d),c.style.height=`${i}px`,c.setAttribute("role","row"),l[u]=[];for(let h of r.y(u)){let p=f("div","mach-cell");if(p.dataset.colId=h.id,p.setAttribute("role","gridcell"),h.hasCheckbox&&p.classList.add("mach-cell--selection"),!h.hasCheckbox&&!h.isDetailToggle&&!h.colDef.rowDrag&&h.colDef.type!=="index")try{Xe(this.e,p,a,h)}catch(m){this.e.reportError(m,"pinnedRow.render",{colId:h.id,side:t,rowIndex:s})}c.appendChild(p),l[u].push(p)}e.segments[u].appendChild(c),e.rowWrappers[u].push(c)}e.cells.push(l)})}vt(){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 w){let o=0;for(let s of e.y(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 w){let d=e.y(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}})}}vf(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.vt()}destroy(){this.top&&this.gi(this.top),this.bottom&&this.gi(this.bottom),this.top=null,this.bottom=null}gi(e){for(let t of e.cells)for(let i of w)for(let r of t[i])L(this.e,r);e.cells=[]}};var oi=class{constructor(e){this.e=e;this.T=null;this.Di={};this.qt=[]}init(){this.T=f("div","mach-statusbar"),this.T.style.display="none",this.T.setAttribute("role","status"),this.e.n.root.appendChild(this.T),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.T)return;this.T.textContent="",this.Di={};let e=this.e.t;if(!e.statusBarEnabled){this.T.style.display="none";return}for(let t of e.statusBarPanels){let i=f("span",`mach-statusbar-item mach-statusbar-item--${t}`);this.T.appendChild(i),this.Di[t]=i}this.refresh()}Zs(e,t){return W(this.e.u(e),t||0)}Qs(e,t){let i=this.Di[e];i&&i.textContent!==t&&(i.textContent=t)}Cm(){let e=this.e.i,t=e.Li(),i=e.Te?e.getTotalRowCount():e.L(),r=W(this.e.u("totalRowsLabel"),i);return e.g&&t>i?`${r} / ${t}`:r}Tm(){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.Zs("statusSum",s)} \xB7 ${this.Zs("statusAvg",o)} \xB7 ${this.Zs("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.Di.rowCount&&this.Qs("rowCount",this.Cm()),this.Di.selectedRowCount){let t=this.e.f.ti().length;this.Qs("selectedRowCount",W(this.e.u("statusSelected"),t))}this.Di.rangeAggregate&&this.Qs("rangeAggregate",this.Tm())}}destroy(){for(let e of this.qt)e();this.qt=[],this.T?.remove(),this.T=null}};function tr(){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 ir(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??tr())?.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=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(jn(l)>t)throw new RangeError(`[MachTable] Grid state for "${o}" exceeds ${t} bytes.`);(n.storage??tr())?.setItem(i(o),l)}catch(a){r(a,"save",o)}},clear(o){try{(n.storage??tr())?.removeItem(i(o))}catch(s){r(s,"clear",o)}}}}var rr=ir();function si(n,e){rr.save(n,e)}function ai(n){return rr.load(n)}function qn(n){rr.clear(n)}var We=class{constructor(e){this.onError=e;this.Yn=new Set;this.disposed=!1}add(e){let t=!0,i=()=>{if(t){t=!1,this.Yn.delete(i);try{e()}catch(r){try{this.onError(r)}catch{}}}};return this.disposed?i():this.Yn.add(i),i}k(e){return this.add(()=>e.destroy()),e}dispose(){if(this.disposed)return;this.disposed=!0;let e=[...this.Yn].reverse();this.Yn.clear();for(let t of e)t()}};function Ca(n){return!!(n.field||n.valueGetter||n.cellRenderer||n.checkboxSelection||n.rowDrag||n.type||n.autoRowSpan||n.rowSpan)}function Ta(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 Da(n,e){let t=n.colId??n.field??`col_${e.leafIndex}`;e.seenIds.set(t,(e.seenIds.get(t)??0)+1),n.field&&!et(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`),Ca(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`),Ta(n,t,e.issues)}function Yn(n,e){for(let t of n){if(ye(t)){!Array.isArray(t.children)||t.children.length===0?e.issues.push(`\u5217\u5206\u7EC4 "${t.headerName??t.groupId??"?"}" \u7684 children \u4E3A\u7A7A`):Yn(t.children,e);continue}e.leafIndex++,Da(t,e)}}function Xn(n){if(!n||n.length===0)return[];let e={issues:[],seenIds:new Map,leafIndex:0};Yn(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 Jn=new Set([...ji,...Be]),xa=new Set(["enableColumnResize","pagination","rowKey"]);function Ra(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 Ea(n){let e,t=Math.max(2,Math.floor(n.length*.3))+1,i=n.toLowerCase();for(let r of Jn){if(Math.abs(i.length-r.length)>=t)continue;let o=Ra(i,r.toLowerCase());o<t&&(t=o,e=r)}return e}function Sa(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"),Ma(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 Ma(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 Ia(n,e){for(let t of ji)if(!(xa.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 ${De[t]}`;e("INVALID_OPTION_VALUE",t,i)}}function Aa(n){let e=[];for(let t of Object.keys(n)){if(Jn.has(t))continue;let i=Ea(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 ka(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 Pa(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"&&ka(n,t,e)}function li(n){let e=n,t=Aa(e),i=(r,o,s)=>{t.push({code:r,option:o,message:s})};return Pa(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"),Ia(e,i),Sa(e,i),t}function Zn(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 nr(n,e){for(let t=0;t<3;t++)if(n[t]!==e[t])return n[t]<e[t]?-1:1;return 0}function Ga(n){return n[0]>0?[n[0]+1,0,0]:n[1]>0?[0,n[1]+1,0]:[0,0,n[2]+1]}function La(n,e){if(e==="*"||e.toLowerCase()==="latest")return!0;let t=/^(\^|~|>=|<=|>|<|=)?\s*(.+)$/.exec(e);if(!t)return!1;let i=Zn(t[2]);if(!i)return!1;let r=nr(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&&nr(n,Ga(i))<0;case"~":return r>=0&&nr(n,[i[0],i[1]+1,0])<0;default:return r===0}}function Qn(n,e){if(!e?.trim())return!0;let t=n?Zn(n):null;return t?e.split("||").some(i=>{let r=i.trim().split(/\s+/).filter(Boolean);return r.length>0&&r.every(o=>La(t,o))}):!1}function Na(n){return[...new Set((n??[]).map(e=>e.trim()).filter(Boolean))]}function di(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 ui(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 di(d.requires)){let c=t.get(u.key);c?Qn(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 Na(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 di(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 Fa=new Set(["valueFormatter","cellStyle","cellClass"]),Oa=new Set(["selectionChanged","sortChanged","filterChanged","columnMoved","columnVisibilityChanged","paginationChanged","detailToggled"]),Ha=0,ci=class{constructor(e,t){this.D=!1;this.Dm=0;this.gr=0;this.tu=!1;this.ea="";this.x=new We(e=>console.error("[mach-table] resource cleanup error",e));this.activeFeatures=new Map;this.su=0;this.yr=0;this.recentErrors=[];this.xt=null;this.au=0;this.vr=null;this.ta=0;this.br=null;this.ia=!1;this.ra=null;this.fu=null;this.Xn=new Set;let i;this.iu=new Promise(r=>{i=r}),this.ru=i,this.gridId=++Ha,this.t=Rr(t),this.ue=new Qe((r,o)=>{o==="gridError"?console.error("[mach-table] error in gridError listener",r):this.reportError(r,"eventBus.listener",{eventType:o})});try{if(this.nd(t.dataProcessor),this.r=new ct(this),this.i=this.x.k(new bt(this)),this.f=new wt(this),this.n=this.x.k(new Kt(this)),this.W=this.x.k(new Yt(this)),this.s=this.x.k(new ti(this)),this.ur=this.x.k(new Ct(this)),this.Rn=this.x.k(new Tt(this)),this.Yo=this.x.k(new Mt(this)),this.a=this.x.k(new At(this)),this.V=new kt(this),this.O=new Ht(this),this.Ce=this.x.k(new _t),this.pi=this.x.k(new zt(r=>this.xm(r))),this.xs=this.x.k(new Gt(this)),this.columnMenu=this.x.k(new Lt(this)),this.qs=this.x.k(new Nt(this)),this.Fn=this.x.k(new Ft(this)),this.Cn=this.x.k(new Ot(this)),this.mi=this.x.k(new ri(this)),this.Le=this.x.k(new ni(this)),this.Ge=this.x.k(new ii(this)),this.ct=this.x.k(new oi(this)),this.api=Wn(this),this.je=new Ze(this),this.$=this.x.k(new Vt(this)),this.x.add(()=>this.lu()),this.$.init(),this.n.init(e,this.t),this.Cn.init(),this.s.init(),this.Yo.init(),this.Fn.init(),this.mi.init(),this.Ge.init(),this.ct.init(),this.Le.init(),this.i.za(this.t.paginationPage,this.t.paginationPageSize),this.r.Ei(this.t.columnDefs),this.i.ot(this.t.advancedFilterModel),this.i.At(this.t.quickFilterText),this.Tn(),this.du(this.t.columnDefs),this.gs(t),this.W.xn(),this.t.datasource?this.i.Or().catch(()=>{}):this.i.nt(this.t.rowData),this.t.initialState&&this.api.state.apply(this.t.initialState,{emitEvents:!1}),this.vs(),this.Ie(),this.Le.setData(this.t.pinnedTopRowData,this.t.pinnedBottomRowData),this.od(this.t.features),this.D)return;this.gr=requestAnimationFrame(()=>{this.gr=0,this.D||this.emit("gridReady",{}),this.uu()})}catch(r){throw this.api&&this.reportError(r,"grid.constructor"),this.destroy(),r}}nd(e){if(e===this.nu)return!1;let t=++this.su,i=typeof e=="function"?e():e;if(this.D||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.x.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]??Fr[e]}Jc(e){return this.t.components?.cellEditors?.[e]}Rm(e){return di(e.requires).map(t=>t.key).find(t=>!this.activeFeatures.has(t))}od(e){let t=this.yr+1;if(this.lu(),this.D||this.yr!==t)return;let i=ui(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.D||this.yr!==t)return;let o=r.key.trim(),s=this.Rm(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 We(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,p)=>(u.addEventListener(c,h,p),l(()=>u.removeEventListener(c,h,p))),setManagedTimeout:(u,c)=>{let h=setTimeout(()=>{p(),u()},Math.max(0,c)),p=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.D||this.yr!==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.yr++;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.D}suspend(){this.ze(),this.api.editing.stop({cancel:!0}),this.xs.close(),this.columnMenu.close(),this.qs.close(),this.Fn.hide(),this.ur.lt(),this.Rn.destroy(),this.s.suspend(),hn(this.n.root),kr(this.n.root);let e=document.activeElement;e instanceof HTMLElement&&this.n.root.contains(e)&&e.blur()}Qt(){return++this.Dm}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]}en(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?me(e.data,o.field,i):!1}jo(e,t,i,r){this.s.Wr(e),this.s.Pl([e.rowIndex],[t.id]),this.O.es({nodeId:e.id,columnId: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})}ll(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?"":Ve(this,s,a,"clipboard")))}return xt(r)}Sl(){let e=this.s.li();return e?Oe(this.ll(e)):Promise.resolve(!1)}Oo(e){this.D||this.fi(this.hu(e,this.r.l()))}async Fc(e,t){let{s:i,r,i:o}=this,s=this.V.Qr(),a=o.Ni(),l=i.v,d=i.De(),u=r.l(),c=this.hu(e,u),h=c.map(({node:m})=>m.data);if(!await Oe(t)||!s()||this.t.suppressClipboard||a!==o.Ni()||l!==i.v||d!==i.De())return;let p=r.l();u.slice(e.c1,e.c2+1).some((m,g)=>m!==p[e.c1+g])||c.every(({node:m,column:g,oldValue:b},T)=>m.data===h[T]&&Object.is(this.d(m,g),b))&&this.fi(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||!Y(a)||a.colDef.rowDrag||i.push({node:o,column:a,oldValue:this.d(o,a),newValue:null})}}return i}fi(e){this.V.th(e)}ze(){this.V?.Zc()}dl(e,t,i){if(this.D)return;let r=Rt(e);if(r.length===0)return;let o=this.r.l(),s=this.i.L(),a=[],l=t;for(let d of r){let u=this.Em(l,s);if(!u)break;this.Sm(u.node,d,o,i,a),l=u.index+1}this.fi(a)}Em(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}Mm(e,t){let i=t;for(;i<e.length;){let r=e[i];if(Y(r)&&!r.colDef.rowDrag)break;i++}return i}Sm(e,t,i,r,o){let s=r,a=o.length;for(let l of t){if(s=this.Mm(i,s),s>=i.length)return;let d=i[s];if(!this.a.ne(e,d)){s++;continue}let u=this.d(e,d);try{let c=d.colDef.valueParser?ue(this,e,d,l,"clipboard",u):Dt(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++}}mh(){let e=this.s.Ho();if(!e)return Promise.resolve();let t=this.V.Qr(),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.V.Ji([{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.Ho();a&&t()&&s()&&l?.row===e.row&&l.colIdx===e.colIdx&&this.i.h(e.row)===i&&this.r.l()[e.colIdx]===r&&this.dl(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||Oa.has(e))&&this.vn(),r}reportError(e,t,i){let r=e instanceof Error?e.message:String(e),o=this.Im(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.D&&this.emit("gridError",{code:o,error:e,source:t,context:i})}Im(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")||Fa.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"}Zh(){return{gridId:this.gridId,version:$e,destroyed:this.D,infinite:this.i.g,loading:this.i.Au()||this.t.loading,rowCount:this.i.Li(),renderedRowCount:this.n.ye.querySelectorAll(".mach-row[data-index]").length,columnCount:this.r.Q().length,selectedRowCount:this.f.ti().length,dirtyRowCount:this.$.getDirtyRowIds().length,activeFeatures:[...this.activeFeatures].map(([e,t])=>({key:e,...t.feature.version?{version:t.feature.version}:{}})),performance:this.Ce.snapshot(),updates:this.pi.snapshot(),recentErrors:this.recentErrors.map(e=>({...e,...e.context?{context:{...e.context}}:{}}))}}Er(e,t){this.r.Er(e,t),this.Mi()}Mi(){this.W.bs(),this.emit("sortChanged",{sortModel:this.r.ee()}),this.i.Do()}ih(e,t){let i=this.i._e();t?i[e.id]=t:delete i[e.id],this.i.It(i),this.lr()}lr(){this.W.ws(),this.ys(),this.i.Do()}ys(e=!0){this.emit("filterChanged",{filterModel:this.i._e(),advancedFilterModel:this.i.Fi()},e)}Si(e,t){this.r.Si(e,t)&&(this.ar(),this.emit("columnMoved",{colId:e,toIndex:t}))}Kr(e){return this.i.Kr(e)}rl(e,t){this.emit("columnResized",{colId:e.id,width:e.currentWidth,finished:t})}dt(e){if(!(this.D||e.length===0))for(let t of e){if(this.D)break;this.rl(t,!0)}}vs(e=!1,t=!1){let i=this.ta,r=this.vr,o=this.r.oo().length>0;if(e){if(r==null||!o)return;if(r!==i){this.vr=null,this.vn();return}}this.vr=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(p=>p==="columns"||p==="sort"||p==="filter"))){this.vr=i;return}let c;try{c=d?d.load(l):ai(l)}catch(p){this.reportError(p,"gridState.load");return}let h=(p,m=!1)=>{if(this.D||s!==this.au||i!==this.ta||!p)return;let g=this.br;this.br=m?"beforeRows":"normal";try{this.api.state.apply(p,{emitEvents:!1,sections:u})}finally{this.br=g}};k(c)?Promise.resolve(c).then(h).catch(p=>this.reportError(p,"gridState.load")):h(c,t)}Np(){return this.br==="beforeRows"}vn(){let e=this.t.persistence;if(!(!e||this.D||this.br)&&(this.ta++,this.vr==null)){if(this.xt&&clearTimeout(this.xt),e.debounceMs===0){this.xt=null,this.na();return}this.xt=setTimeout(()=>{this.xt=null,this.na()},e.debounceMs)}}na(){let e=this.t.persistence;if(!e||this.D)return;let{key:t,store:i,sections:r}=e,o=this.api.state.get(),s=r?Rn(o,r):o,a={key:t,...i?{store:i}:{},state:s};if(this.ia){this.ra=a;return}this.pu(a)}pu(e){try{let t=e.store?e.store.save(e.key,e.state):si(e.key,e.state);if(!k(t))return;this.ia=!0,Promise.resolve(t).catch(i=>this.reportError(i,"gridState.save")).finally(()=>{this.ia=!1;let i=this.ra;this.ra=null,i&&this.pu(i)})}catch(t){this.reportError(t,"gridState.save")}}Ih(){let e=f("div","mach-empty mach-empty--error"),t=f("div","mach-empty__title");t.textContent=this.u("requestFailed");let i=f("div","mach-empty__hint");return i.textContent=this.u("requestFailedHint"),e.append(t,i),e}Sh(){let e=f("div","mach-loading"),t=f("div","mach-loading__visual");t.setAttribute("aria-hidden","true");for(let r=0;r<3;r+=1){let o=f("span","mach-loading__row");t.appendChild(o)}let i=f("span","mach-loading__label");return i.textContent=this.u("loading"),e.append(t,i),e}Mh(){let e=f("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.He().length>0&&this.i.Vi(),o=f("div","mach-empty__title");o.textContent=r?t.noMatchingRows??t.emptyRows??this.u("noMatchingRows"):this.u("emptyRows");let s=f("div","mach-empty__hint");if(s.textContent=this.u("emptyRowsHint"),e.append(o),(!r||t.emptyRowsHint)&&e.append(s),r){let a=f("button","mach-toolbar__select-host");a.type="button",a.textContent=this.u("clearFilters"),a.onclick=()=>{this.i.It({}),this.i.ot(null),this.i.At(null),this.t.quickFilterText=null,this.lr(),this.n.root.focus({preventScroll:!0})},e.append(a)}return e}gs(e){if(!(this.t.suppressWarnings||this.D)){if(e)for(let t of li({rowKey:this.t.rowKey,...e})){let i=`${t.code}:${t.option??""}:${t.message}`;this.Xn.has(i)||(this.Xn.add(i),console.warn(`[mach-table:${t.code}] ${t.message}`))}this.t.treeData&&this.r.Ze().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.D)&&this.fu!==e){this.fu=e;for(let t of Xn(e))this.Xn.has(t)||(this.Xn.add(t),console.warn(`[mach-table] ${t}`))}}ar(){this.je.Ri=!0,this.pi.Vl({columns:!0})}K(e){(e.data||e.cells)&&(this.je.Ri=!0),this.pi.Vl(e)}Ql(e){return this.pi.batch(e)}xm(e){this.D||(e.columns?this.Am():(e.header&&this.W.xn(),e.pool&&this.s.Ad(),(e.pool||e.layout)&&this.Ie()),this.km(e),e.data&&!e.pool&&!e.columns?this.s.om():e.cells&&this.s.refreshCells(e.cells===!0?void 0:e.cells),e.pinned&&this.Le.refresh(),e.summary&&this.Ge.refresh(),e.overlays&&this.s.zs())}km(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.je.Qn(t)&&this.ri()}Am(){this.gs(),this.du(this.r.oo()),this.s.st(),this.W.xn(),this.s.Ad(),this.Ie(),this.Le.xe(),this.emit("displayedColumnsChanged",{})}Ie(){if(this.D)return;let e=this.Ce.start();this.Tn(),this.je.Qn(),this.r.ua(this.n.hs());let t=this.r.l().map(i=>`${i.id}:${i.currentWidth}`).join("|");this.ea&&t!==this.ea&&this.s.st(),this.ea=t,this.n.root.setAttribute("aria-colcount",String(this.r.l().length)),this.W.vt(),this.s.Ie(),this.Le.vt(),this.Ge.refresh(),this.Ce.Rh(e)}Tn(){if(!this.n.root)return;let e=this.t.treeData||this.r.Ze().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.D||(this.je.Qn(),this.r.ua(this.n.hs()),e&&this.s.st(),this.W.vt(),this.s.wn(),this.s._n(),this.s.dr(!0),this.Le.vt(),this.Ge.refresh())}destroy(){if(!this.D){if(this.xt&&(clearTimeout(this.xt),this.xt=null,this.na()),this.D=!0,this.ze(),this.gr&&cancelAnimationFrame(this.gr),this.gr=0,this.api){this.uu();try{this.emit("gridDestroyed",{})}catch(e){console.error("[mach-table] grid destroy event",e)}}this.x.dispose(),this.ue.clear()}}};function eo(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 ci(n,e).api}function Va(n){return n.mode==="allMatching"?{mode:"allMatching",excludedKeys:[...n.excludedKeys]}:{mode:"explicit",selectedKeys:[...n.selectedKeys]}}function to(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:Z(t.filterModel),advancedFilterModel:H(t.advancedFilterModel),quickFilterText:t.quickFilterText,...e.scope==="selected"?{selection:Va(e.selection??{mode:"explicit",selectedKeys:t.selectedRowIds})}:{}}}function Ba(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 za(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 Wa(n,e){return n.filterable===!1?!1:e==="number"?"number":e==="date"?"date":e==="select"||e==="boolean"?"set":"text"}function $a(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=Ba;return}if(t!=="select")return;let i=e.options??[];n.valueFormatter=za(i),e.editable&&(n.cellEditor="select",n.cellEditorParams={options:i})}function io(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:Wa(n,e),cellClass:n.cellClass};return $a(t,n,e),t}function ro(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(io(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(io(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 no(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?Wt(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 oo(){return{accessor:(n,e={})=>({...e,field:n}),display:n=>({...n}),group:n=>({...n,children:[...n.children]})}}function so(n){return[...n]}function ao(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 or(n,e){return e===void 0?n:typeof e!="object"||e===null||typeof n!="object"||n===null?e:{...n,...e}}function Ka(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 Ua(n,e){if(!(!n.components&&!e.components))return{cellRenderers:{...n.components?.cellRenderers,...e.components?.cellRenderers},cellEditors:{...n.components?.cellEditors,...e.components?.cellEditors}}}function ja(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]=Ka(r,o))}}function lo(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=Ua(n,e);i&&(t.components=i);let r=ja(n,e);return r&&(t.columnTypes=r),(n.aggFuncs||e.aggFuncs)&&(t.aggFuncs={...n.aggFuncs,...e.aggFuncs}),t.pagination=or(n.pagination,e.pagination),t.statusBar=or(n.statusBar,e.statusBar),t.watermark=or(n.watermark,e.watermark),qa(t,n,e),t}function sr(...n){return n.reduce((e,t)=>{if(typeof t!="string")return lo(e,t);let i=ao(t);if(!i)throw new TypeError(`[MachTable] Unknown built-in preset "${t}". Use "list" or "detail".`);return lo(e,i)},{})}function uo(n={}){return sr({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 co(n){return n}function ho(n){return n}function po(n){return n}function pi(n){return n!=null&&n!==""}function Ya(n){if(!pi(n))return null;let e=typeof n=="number"?n:Number(n);return Number.isFinite(e)?e:null}function hi(n,e){try{return new Intl.NumberFormat(n,e)}catch{return new Intl.NumberFormat(void 0,e)}}function fo(n,e){try{return new Intl.DateTimeFormat(n,e)}catch{let t={...e};return delete t.timeZone,new Intl.DateTimeFormat(void 0,t)}}function Xa(n){if(!pi(n))return null;let e=n instanceof Date?n:new Date(n);return Number.isFinite(e.getTime())?e:null}function mo(n={}){let e=n.emptyText??"",t=n.invalidText??"\u2014",i=hi(n.locale,{maximumFractionDigits:n.maximumFractionDigits??2}),r=hi(n.locale,{maximumFractionDigits:0}),o=hi(n.locale,{style:"currency",currency:n.currency??"CNY",currencyDisplay:n.currencyDisplay??"symbol",maximumFractionDigits:n.maximumFractionDigits??2}),s=hi(n.locale,{style:"percent",maximumFractionDigits:n.maximumFractionDigits??2}),a=fo(n.locale,{year:"numeric",month:"2-digit",day:"2-digit",...n.timeZone?{timeZone:n.timeZone}:{}}),l=fo(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:p})=>{if(!pi(p))return e;let m=Ya(p);return m==null?t:c.format(m*h)},u=c=>({value:h})=>{if(!pi(h))return e;let p=Xa(h);return p==null?t:c.format(p)};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 go(){try{return typeof localStorage>"u"?null:localStorage}catch{return null}}function yo(n){return typeof TextEncoder>"u"?n.length*2:new TextEncoder().encode(n).byteLength}function vo(n){if(typeof n!="string")return null;let e=n.trim();return e&&e.length<=256?e:null}function fi(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 Ee(n){if(n==null||typeof n!="object")return null;let e=n,t=vo(e.id),i=typeof e.name=="string"?e.name.trim().slice(0,120):"",r=fi(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 ar(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 lr(n,e,t={}){let i=fi(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 dr(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??go())?.getItem(r(l));if(!d||yo(d)>i)return[];let u=JSON.parse(d);return u.schemaVersion!==1||!Array.isArray(u.views)?[]:u.views.flatMap(c=>{let h=Ee(c);return h?[h]:[]}).slice(0,t)},a=(l,d)=>{let u=JSON.stringify({schemaVersion:1,savedAt:Date.now(),views:d});if(yo(u)>i)throw new RangeError(`[MachTable] Saved views for "${l}" exceed ${i} bytes.`);let c=n.storage??go();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=Ee(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 Ja(){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 bo(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??dr(),r=async()=>(await i.list(t)).flatMap(s=>{let a=Ee(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=vo(s)??Ja(),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:ar(n)};return await i.save(t,c),c},async apply(o,s){let a=typeof o=="string"?(await r()).find(d=>d.id===o):Ee(o),l=typeof o=="string"?o:"provided view";if(!a)throw new Error(`[MachTable] Grid view "${l}" was not found.`);if(!lr(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 Za=$e;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 Bs(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 Bs(n)}var un=new Set(["ArrowUp","ArrowDown","ArrowLeft","ArrowRight","Home","End","PageUp","PageDown"]),_s=new Set([...un,"Enter","F2","Tab"," ","Escape","Delete","Backspace"]),Mt=class{constructor(e){this.e=e;this.sl=e=>{if(this.Fo(e)||this.e.o()||this.e.t.suppressClipboard)return;let t=this.e.s.li();if(!t)return;let i=this.e.ll(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.Oo(t)}else e.type==="cut"?this.e.Fc(t,i):He(i)};this.Nc=e=>{if(this.Fo(e)||this.e.t.suppressClipboard)return;let t=this.e.s.Ho();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.dl(r,t.row,t.colIdx))};this.Lc=e=>{this.Fo(e)||this.e.o()||this.Oc(e)||_s.has(e.key)&&(this.Hc(e)||this.Vc(e)||this.Bc(e))}}init(){this.ol(!0)}destroy(){this.ol(!1)}ol(e){S(this.e.n.root,e,{keydown:this.Lc,copy:this.sl,cut:this.sl,paste:this.Nc})}al(e,t,i){let r=this.e.r.l(),o=this.e.r.Z(t);if(o<0)return null;let s=this.e.i.L(),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.Nt(l+1,1)}else if(a<0){if(l<=0)return null;a=r.length-1,l=this.Nt(l-1,-1)}if(l<0||l>=s)return null;let u=this.e.i.h(l);if(u&&!u.isDetail&&this.e.a.ne(u,r[a]))return{rowIndex:l,column:r[a]}}return null}Nt(e,t){let i=this.e.i.L();for(;e>=0&&e<i;){let r=this.e.i.h(e);if(!r||!r.isDetail)return e;e+=t}return-1}Fo(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.O.undo():this.e.O.redo(),!0)}Hc(e){let t=this.e.s;if(e.key==="Escape")return this.e.ze(),this.e.t.enableRangeSelection&&t.De()&&(e.preventDefault(),t.di()),!0;if(e.key!=="Delete"&&e.key!=="Backspace")return!1;let i=t.li();return i&&(e.preventDefault(),this.e.Oo(i)),!0}Vc(e){if(this.e.s.v)return!1;let t=this.e.r.l();return this.e.i.L()>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.Z(i.colId),s=this.e.i.L();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 un.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.qr(o,this.Nt(o-1,-1),r);break;case"ArrowDown":o=this.qr(o,this.Nt(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.Nt(r-1,-1)));break;case"PageUp":case"PageDown":o=this.jc(e.key,o,r);break}return{row:o,colIdx:s}}qr(e,t,i){return t>=0&&t<i?t:e}jc(e,t,i){let r=this.e.n.C.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.qr(t,this.Nt(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.ne(o,s))return this.e.a.start(t.row,s,e.key==="F2"?e.key:null),t;let a=this.Nt(t.row+1,1);return{...t,row:this.qr(t.row,a,r)}}Kc(e){let t=this.e.i.h(e);if(!(!t||t.isDetail)){if(t.isGroup){this.e.i.Ro(t.id);return}this.e.t.rowSelection!=="none"&&this.e.f.Mo(t,!t.selected,this.e.t.rowSelection==="single")}}Uc(e,t,i){let r=this.al(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 hn(n){P?.owner&&(n===P.owner||n.contains(P.owner))&&P.close()}function zs(n){let e=n.target;P?.contains(e)||P?.close()}function cn(){P?.reposition()}function Ws(n){n.key!=="Escape"||!P||(n.preventDefault(),n.stopImmediatePropagation(),P.close(!0))}function pn(n){_(n,zs,Ws);let e=n?"addEventListener":"removeEventListener";window[e]("resize",cn),window[e]("scroll",cn,!0)}function $s(n){P?.close!==n.close&&P?.close(),!P&&(P=n,pn(!0))}function Ks(n){P?.close===n&&(P=null,pn(!1))}function de(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 It(n,e){return n.findIndex(t=>t.value===e&&!t.disabled)}function oe(n){let e=f("div",de("mach-select-control",n.classNames?.root)),t=f("select",de("mach-select-native",n.classNames?.native));t.hidden=!0,t.tabIndex=-1,t.setAttribute("aria-hidden","true");let i=f("button",de("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=f("span",de("mach-select-value",n.classNames?.value)),o=f("span",de("mach-select-caret",n.classNames?.caret));o.setAttribute("aria-hidden","true"),i.append(r,o);let s=f("div",de("mach-select-listbox",n.classNames?.listbox));s.id=pr("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),p=()=>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,he)=>{let M=a[he]?.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",he===d)}),i.setAttribute("aria-activedescendant",d>=0?l[d]?.id??"":"")},g=()=>{let y=i.getBoundingClientRect(),D=s.getBoundingClientRect(),he=Math.max(y.width,D.width),M=C(y.left,8,Math.max(8,window.innerWidth-he-8)),Me=window.innerHeight-y.bottom-8,se=Me<Math.min(D.height,240)&&y.top>Me,F=se?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",se)},b=(y=!1)=>p()?(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(),Ks(b),y&&!u&&i.focus({preventScroll:!0}),!0):!1,T=(y,D=!0)=>{!a[y]||a[y].disabled||(d=y,m(),D&&l[y]?.scrollIntoView?.({block:"nearest"}))},G=()=>{if(u||i.disabled||p())return;let y=c();$s({owner:y,close:b,contains:h,reposition:g}),d=It(a,t.value),d<0&&(d=Ve(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,Me)=>{let se=f("option");se.value=M.value,se.textContent=M.label,se.disabled=M.disabled===!0,t.appendChild(se);let F=f("button",de("mach-select-option",n.classNames?.option));return F.id=`${s.id}-option-${Me}`,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",wo=>wo.preventDefault()),F.addEventListener("click",()=>$(Me)),s.appendChild(F),F});let he=a.find(M=>!M.disabled)?.value??"";t.value=D!=null&&a.some(M=>M.value===D)?D:he,d=It(a,t.value),m()},ur=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(),p()?$(d):G();return}let D=d;if(y.key==="ArrowDown")D=Ve(a,d,1);else if(y.key==="ArrowUp")D=Ve(a,d,-1);else if(y.key==="Home")D=Ve(a,-1,1);else if(y.key==="End")D=Ve(a,-1,-1);else return;y.preventDefault(),y.stopPropagation(),p()||G(),T(D)},cr=()=>{d=It(a,t.value),m(),n.onChange?.(t.value)};return i.addEventListener("click",()=>{b()||G()}),i.addEventListener("keydown",ur),t.addEventListener("change",cr),K(a,n.value),{el:e,native:t,trigger:i,listbox:s,contains:h,isOpen:p,open:G,close:b,focus:()=>i.focus({preventScroll:!0}),getValue:()=>t.value,setValue:y=>{t.value=y,d=It(a,y),m()},setOptions:K,destroy:()=>{u||(u=!0,b(),i.removeEventListener("keydown",ur),t.removeEventListener("change",cr),e.remove())}}}function fn(n,e){let t=f("input","mach-editor-input");return t.type=n,e!=null&&e!==""&&(t.value=n==="date"?String(e).slice(0,10):String(e)),t}function Us(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 _i(n,e,t){let i=n.colDef,r=typeof i.cellEditor=="string"?i.cellEditor:js(e,i.cellEditorParams);if(r==="date"){let a=fn("date",e),d=(e==null?"":String(e)).match(/T(\d{2}:\d{2})/);return{el:a,getValue:()=>a.value===""?null:d?`${a.value}T${d[1]}`:a.value,focus:()=>a.focus({preventScroll:!0})}}if(r==="select"){let a=Us(i.cellEditorParams),l=oe({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=fn(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 ue(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 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(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)}var qs='<path d="M3 8.5 6.4 12 13.5 4"/>',Ys='<path d="m4 4 8 8m0-8-8 8"/>';function mn(n,e){let t=f("button",`mach-edit-control mach-edit-control--${n}`);return t.type="button",t.setAttribute("aria-label",e),t.title=e,t.innerHTML=`<svg viewBox="0 0 16 16" aria-hidden="true" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round">${n==="confirm"?qs:Ys}</svg>`,t}var At=class{constructor(e){this.e=e;this.b=null;this.S=null;this.ke=null;this.ut=0;this.Yr=0;this.fl=e=>{if(!(!this.b||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.b,i=this.e.Yo.al(t.node.rowIndex,t.column.id,e.shiftKey?-1:1);i?this.start(i.rowIndex,i.column,null,!0):this.Pe(!1)}else this.Pe(e.key==="Escape")}}isEditing(e,t){return this.b?e==null&&t==null?!0:this.b.node.rowIndex===e&&this.b.column.id===t:this.S?e==null&&t==null?!0:this.qi(this.S)!==e?!1:t==null||this.S.drafts.has(t):!1}Xr(){return this.b!=null}Vu(){return this.b?.node.rowIndex??(this.S?this.qi(this.S):null)}ul(e){return this.S?e==null||this.qi(this.S)===e:!1}ne(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(pe(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.Yr++,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.S)return!1;if(this.b)return!this.ke&&this.b.node===o&&this.b.column===t||this.cl(o,t).then(p=>{p&&this.start(o.rowIndex,t,i,r)}),!0;if(!this.ne(o,t))return!1;r&&(this.e.s.$r(e,"nearest"),this.e.s.Ae(e,t.id));let s=this.e.s.si(e,t.id);if(!s)return!1;this.e.ze();let a=this.e.d(o,t),l=this.hl(o,t,e,a,i);if(!l)return!1;let d=f("div","mach-cell-editor-controls",{role:"group"}),u=mn("confirm","Confirm edit"),c=mn("cancel","Cancel edit");d.append(u,c),this.pl(l,s,!0),this.e.n.root.appendChild(d);let h=this.fl;return l.el.addEventListener("keydown",h),d.addEventListener("mousedown",p=>{p.preventDefault(),p.stopPropagation()}),d.addEventListener("click",p=>{p.stopPropagation();let m=p.target.closest("button");m&&this.Pe(m===c)}),d.addEventListener("keydown",p=>{p.key==="Escape"&&this.fl(p)}),this.b={node:o,column:t,editor:l,oldValue:a,cell:s,keydown:h,confirmButton:u,cancelButton:c},this.ml(),this.Vo(l,t,o),this.e.emit("cellEditingStarted",{rowIndex:e,colId:t.id,rowNode:o}),!0}cl(e,t){let i=++this.Yr;return this.Pe(!1).then(r=>r&&i===this.Yr&&!this.isEditing()&&this.e.i.h(e.rowIndex)===e&&(t==null||this.e.r.R(t.id)===t))}startRow(e,t){if(this.b||this.S)return!1;let i=this.e.i.h(e);if(!i||i.data==null||i.isDetail||i.isGroup)return!1;this.e.ze();let r=new Map;for(let l of this.e.r.l()){if(!this.ne(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.S=o,this.e.s.I([e]),r.size===0)return this.S=null,this.e.s.I([e]),!1;let s=r.values().next().value,a=(t?r.get(t):void 0)??s;return a?.mounted&&this.Vo(a.mounted.editor,a.column,i),this.e.emit("rowEditingStarted",{rowIndex:e,rowNode:i,data:i.data}),!0}gl(e,t,i,r){if(this.b)return this.b.node===t&&this.b.column.id===i.id;let o=this.S;if(!o||o.node!==t)return!1;let s=o.drafts.get(i.id);return s?s.mounted?.cell!==r&&(this.yl(s),!this.qc(e,o,s,r))?(o.drafts.delete(i.id),!1):!0:!1}Bo(e,t,i){let r=this.S;if(r&&this.qi(r)===e){let o=r.drafts.get(t);o?.mounted?.cell===i&&this.yl(o);return}if(this.b?.cell===i){let o=this.b;this.Pe(!1),this.b===o&&this.Pe(!0)}}stop(e=!1){this.Pe(e)}Pe(e=!1){if(e&&this.Yr++,this.S)return this.vl(e);let t=this.b;if(!t)return Promise.resolve(!1);if(e)return this.ut++,this.ke=null,Promise.resolve(this.Yi(t,!0,t.oldValue));if(this.ke)return this.ke;let i,r="cellEditor.getValue";try{if(i=t.editor.getValue(),Object.is(i,t.oldValue)||(r="valueParser",i=ue(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.V.Jr(o),a=++this.ut,l=()=>a===this.ut&&this.b===t&&s(),d=u=>l()?u.length?(this._o(t,!1),this.Xi(t.editor,u[0].message),!1):this.Yi(t,!1,i):(a===this.ut&&this.b===t&&this.Yi(t,!0,t.oldValue),!1);return this.bl(o,l,d,()=>this._o(t,!0))}vl(e=!1){let t=this.S;if(!t)return Promise.resolve(!1);if(e)return this.ut++,this.ke=null,Promise.resolve(this.Zr(t,!0));if(this.ke)return this.ke;for(let u of t.drafts.values())this.zo(u);let i=[];for(let u of t.drafts.values())if(!Object.is(u.oldValue,u.value))try{let c=ue(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.Wo(t,[{draft:u,message:c instanceof Error?c.message:String(c)}]),Promise.resolve(!1)}if(i.length===0)return Promise.resolve(this.Zr(t,!1,i));let r=i.map(u=>t.drafts.get(u.column.id)),o=r.map(u=>u.value),s=this.e.V.Jr(i),a=++this.ut,l=()=>a===this.ut&&this.S===t&&s();for(let u of r)u.error=void 0;let d=u=>l()?u.length?(this.Wo(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.$o(t,!1),!1):this.Zr(t,!1,i):(a===this.ut&&this.S===t&&this.Zr(t,!0),!1);return this.bl(i,l,d,()=>{t.validating=!0,this.$o(t,!0)})}bl(e,t,i,r){let o=this.e.V.Ko(e,t);if(!k(o))return Promise.resolve(i(o));r();let s=o.then(i).finally(()=>{this.ke===s&&(this.ke=null)});return this.ke=s,s}Yi(e,t,i){if(this.b!==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 s=this.e.V.Uo([r],()=>!this.e.o());if(s)return this._o(e,!1),this.Xi(e.editor,s.message),!1}return this.b=null,e.confirmButton.parentElement?.remove(),o&&this.e.jo(e.node,e.column,e.oldValue,i),this.qo(e),this.e.o()||(this.e.emit("cellEditingStopped",{rowIndex:e.node.rowIndex,colId:e.column.id,rowNode:e.node,oldValue:e.oldValue,newValue:o?i:e.oldValue}),this.wl(e.node.rowIndex)),!0}Zr(e,t,i=[]){if(this.S!==e)return!1;let r=t?[]:this.Yc(e,i);if(r==null)return!1;for(let s of e.drafts.values())s.mounted&&this.qo(s.mounted),s.mounted=null;if(this.S=null,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}),this.wl(o),!0}wl(e){e>=0&&this.e.s.I([e]),this.e.Ge.refresh(),this.e.ct.refresh()}Yc(e,t){if(t.length===0)return[];let i=this.e.V.Uo(t,()=>!this.e.o());if(i)return this.Wo(e,[{draft:e.drafts.get(i.colId)??e.drafts.get(t[0].column.id),message:i.message}]),null;let r=this.e.V.Ji(t);this.e.O.Cl();try{for(let o of t){if(!r())break;this.e.jo(e.node,o.column,o.oldValue,o.newValue)}}finally{this.e.O.Tl()}return t.map(({column:o,oldValue:s,newValue:a})=>({colId:o.id,oldValue:s,newValue:a}))}qc(e,t,i,r){let o=this.hl(t.node,i.column,e,i.value,null);if(!o)return!1;this.pl(o,r);let s=l=>this.Xc(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.Zi(o.el,!0),!0}pl(e,t,i=!1){L(this.e,t);let r=f("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")}ml(){if(!this.b)return;let{cell:e,column:t,confirmButton:i}=this.b,r=this.e.n.root;if(!r.contains(e)){this.Pe(!0);return}let o=i.parentElement,s=this.e.n.C[t.pinned??"center"],a=e.getBoundingClientRect(),l=s.getBoundingClientRect(),d=r.getBoundingClientRect(),u=o.getBoundingClientRect(),c=l.left+s.clientWidth,h=l.top+s.clientHeight,p=a.top-u.height-2>=l.top?a.top-u.height-2:a.bottom+2,m=this.e.t.domLayout==="autoHeight"&&p+u.height>h;o.style.position=m?"static":"",o.style.justifyContent=m?"flex-end":"";let g=o.getBoundingClientRect().width;o.style.visibility=(m||g<=s.clientWidth&&p+u.height<=h)&&a.right>l.left&&a.left<c&&a.bottom>l.top&&a.top<h?"":"hidden",o.style.left=`${C(a.right-g,l.left,Math.max(l.left,c-g))-d.left-r.clientLeft}px`,o.style.top=`${p-d.top-r.clientTop}px`}yl(e){e.mounted&&(this.zo(e),this.qo(e.mounted),e.mounted=null)}zo(e){if(e.mounted)try{let t=e.mounted.editor.getValue();t!==void 0&&(e.value=t)}catch(t){this.e.reportError(t,"cellEditor.getValue",{colId:e.column.id,rowId:this.S?.node.id})}}hl(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.Jc(s.cellEditor)?.(l)??_i(t,r,o):a=_i(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}Wo(e,t){e.validating=!1,this.$o(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.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}$o(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}Vo(e,t,i){try{e.focus?.()}catch(r){this.e.reportError(r,"cellEditor.focus",{colId:t.id,rowId:i.id})}}qo(e){e.editor.el.removeEventListener("keydown",e.keydown),e.input&&e.editor.el.removeEventListener("input",e.input),this.Zi(e.editor.el,!1);try{e.editor.destroy?.()}catch(t){this.e.reportError(t,"cellEditor.destroy",{colId:e.cell.dataset.colId})}e.cell.classList.remove("mach-cell--editing","mach-cell--row-editing","mach-cell--error")}qi(e){return e.node.rowIndex>=0?e.node.rowIndex:e.rowIndex}Xc(e,t,i){if(this.S!==t||e.isComposing||e.keyCode===229)return;if(e.key==="Escape"||e.key==="Enter"&&!e.shiftKey){e.preventDefault(),e.stopPropagation(),this.vl(e.key==="Escape");return}if(e.key!=="Tab")return;e.preventDefault(),e.stopPropagation(),this.zo(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.Vo(l.mounted.editor,l.column,t.node);break}}}destroy(){this.Pe(!0)}};var kt=class{constructor(e){this.e=e;this.Xo=0}Zc(){this.Xo++}Qr(){let e=++this.Xo;return()=>e===this.Xo&&!this.e.o()}Jr(e){let t=e[0].node,i=this.e.r.Q(),r=i.map(a=>this.e.d(t,a)),o=this.Ji(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]))}Ji(e){let t=e[0].node,i=t.data,r=this.e.r,o=r.Q(),s=e.every(a=>a.node===t&&r.R(a.column.id)===a.column);return()=>s&&!this.e.o()&&this.e.i.F(t.id)===t&&t.data===i&&r.Q()===o}Ko(e,t){let i=e.map(o=>this.Qc(o,t)),r=o=>{let s=o.filter(a=>a!=null);return s.length||!t()?s:this.eh(e,t)};return i.some(k)?Promise.all(i.map(o=>Promise.resolve(o))).then(r):r(i)}Qc(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)}}eh(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.Q())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)}}Uo(e,t){let i=[],r=this.Ji(e);for(let o of e){if(!t()||!r()||!Object.is(this.e.d(o.node,o.column),o.oldValue)||!this.e.a.ne(o.node,o.column)||!this.e.en(o.node,o.column,o.newValue,o.oldValue)){for(let s of i.reverse()){if(!t()||!r())break;this.e.en(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"}}th(e){let t=this.Qr();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.ne(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.Jr(a),d=()=>t()&&l();return{changes:a,current:d,validation:this.Ko(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.O.Cl();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.Uo(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.Ji(s);d.applied=!0;for(let h of s){if(!i()||!c()){d.applied=!1;break}this.e.jo(h.node,h.column,h.oldValue,h.newValue),h.node.rowIndex>=0&&o.add(h.node.rowIndex)}})}finally{this.e.O.Tl()}return o.size&&i()&&(this.e.s.I([...o]),this.e.Ge.refresh(),this.e.ct.refresh()),r}};function zi(n){return n==="blank"||n==="notBlank"}function Pt(n){return n===null?"null:":`${typeof n}:${String(n)}`}var Gt=class{constructor(e){this.e=e;this.w=null;this.ht=null;this.ui=null;this.pt=e=>{if(!this.w)return;let t=e.target;if(!this.ui?.contains(t)){if(!this.w.contains(t)){this.close();return}(!(t instanceof Element)||!t.closest(".mach-filter-select-control"))&&this.ui?.close()}};this.ft=e=>{if(e.key==="Escape"){if(this.ui?.close(!0)){e.preventDefault(),e.stopPropagation();return}this.close()}}}toggle(e,t){if(this.ht===e.id){this.close();return}this.close(),this.open(e,t)}open(e,t){let i=this.e.i._e()[e.id]??null,r=i?.type??e.filterType,o=f("div","mach-filter-panel");o.setAttribute("role","dialog"),o.setAttribute("aria-label",`${e.id} filter`);let s=u=>{this.e.ih(e,u),this.close()},a=r==="set"?this.rh(o,e,i):this.nh(o,r,i,s),l=f("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.ht=e.id,Z(o,t),_(!0,this.pt,this.ft),o.querySelector(".mach-filter-select-trigger, input")?.focus()}close(){this.w&&(this.ui?.destroy(),this.ui=null,this.w.remove(),this.w=null,this.ht=null,_(!1,this.pt,this.ft))}destroy(){this.close()}nh(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.oh(t,s),d=this.xl(t),u=this.xl(t,!0);this.sh(t,s,o,d,u),this.Rl(s,d,u),l.addEventListener("change",()=>{this.Rl(l.value,d,u)});let c=f("div","mach-filter-body");c.append(a,d,u),e.appendChild(c);let h=()=>this.ah(t,l.value,d.value,u.value),p=m=>{m.key==="Enter"&&r(h())};return d.addEventListener("keydown",p),u.addEventListener("keydown",p),h}oh(e,t){let i=oe({ariaLabel:"Filter condition",options:ge[e].map(r=>({value:r,label:this.e.u(ot(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.ui=i,i}xl(e,t=!1){let r=f("input",`mach-filter-input${t?" mach-filter-input--second":""}`);return r.type=e,r}sh(e,t,i,r,o){i?.value!=null&&!zi(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=zi(e)?"none":"",i.style.display=e==="inRange"?"":"none"}rh(e,t,i){let o=t.colDef.filterParams,s;if(o?.values)s=o.values;else{let p=new Set;s=[];let m=this.e.i.He(),g=Math.min(m.length,o?.maxValues??500);for(let b=0;b<g;b++){let T=this.e.d(m[b],t),G=Pt(T??null);p.has(G)||(p.add(G),s.push(T))}}let a=new Set((i?.type==="set"?i.values:s).map(Pt)),l=f("input","mach-filter-input mach-filter-input--search");l.type="text",l.placeholder=this.e.u("search");let d=f("div","mach-filter-set-list"),u=new Map(s.map(p=>[Pt(p),p??null])),c=p=>{d.textContent="";let m=p.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 T=Pt(g),G=f("label","mach-filter-set-item"),$=f("input");$.type="checkbox",$.checked=a.has(T),$.addEventListener("change",()=>{$.checked?a.add(T):a.delete(T)});let K=f("span");K.textContent=b,G.append($,K),d.appendChild(G)}};l.addEventListener("input",()=>c(l.value)),c("");let h=f("div","mach-filter-body mach-filter-body--set");return h.append(l,d),e.appendChild(h),()=>{let p=[];for(let[m,g]of u)a.has(m)&&p.push(g);return p.length&&p.length<u.size?{type:"set",values:p}:null}}ah(e,t,i,r){if(zi(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 Lt=class{constructor(e){this.e=e;this.w=null;this.ht=null;this.tn=null;this.rn="";this.Qi=new Set;this.pt=e=>{let t=e.target;this.w&&!this.w.contains(t)&&!this.dh(t)&&this.close()};this.ft=e=>{if(e.key==="Escape"){for(let t of this.Qi)if(t.close(!0)){e.preventDefault(),e.stopImmediatePropagation();return}this.close()}}}toggle(e,t){let i=this.ht===e.id;this.close(),i||this.open(e,t)}lh(e){this.close();let t=e??(()=>{let r=this.e.n.root.getBoundingClientRect(),o=f("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.tn=o,o})();this.open(null,t)}close(){this.El(),this.tn&&(this.tn.remove(),this.tn=null),this.w?.remove(),this.w=null,this.ht=null,_(!1,this.pt,this.ft)}destroy(){this.close()}open(e,t){let i=this.e.api,r=f("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=f("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,p="mach-column-panel-btn")=>U(p,this.e.u(c),()=>{h(),this.close()});if(e){let c=e.id,h=(...p)=>{let m=f("div","mach-column-panel-actions");m.append(...p),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=f("div","mach-column-panel-divider");r.appendChild(a);let l=f("div","mach-column-panel-subtitle");if(l.textContent=this.e.u("columnVisibility"),r.appendChild(l),!e){let c=f("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.rn,c.addEventListener("input",()=>{this.rn=c.value.trim().toLocaleLowerCase(),this.Jo(d,!0)}),r.appendChild(c)}let d=f("div","mach-column-panel-list");this.Jo(d,!e),r.appendChild(d);let u=f("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.ht=e?e.id:"__standalone__",Z(r,t),_(!0,this.pt,this.ft)}Zo(){if(!this.w)return;let e=this.w.querySelector(".mach-column-panel-list");e&&this.Jo(e,this.ht==="__standalone__")}Jo(e,t){let i=this.e.api;this.El(e),e.replaceChildren();let r=this.e.r.Q().filter(o=>o.isDetailToggle?!1:!t||!this.rn?!0:`${o.colDef.headerName??o.colDef.field??o.id} ${o.id}`.toLocaleLowerCase().includes(this.rn));for(let o of r){let s=f("div",t?"mach-column-workbench-item":"mach-filter-set-item"),a=f("label","mach-column-workbench-label"),l=f("input");l.type="checkbox",l.checked=!o.hide,l.disabled=o.hasCheckbox,l.addEventListener("change",()=>{i.columns.setVisible(o.id,l.checked),this.Zo()});let d=f("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=oe({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.Zo()}});u.trigger.disabled=!o.movable,u.native.disabled=!o.movable,this.Qi.add(u),s.appendChild(u.el);let c=this.e.r.Q().filter(m=>!m.hide&&m.parentGroup===o.parentGroup&&(o.parentGroup!=null||m.pinned===o.pinned)),h=c.indexOf(o),p=(m,g,b)=>{let T=U("mach-column-workbench-move",m,()=>{i.columns.move(o.id,g),this.Zo()});return T.disabled=b||o.hide||!o.movable,T};s.append(p("\u2191",h-1,h<=0),p("\u2193",h+1,h<0||h>=c.length-1))}e.appendChild(s)}}dh(e){for(let t of this.Qi)if(t.contains(e))return!0;return!1}El(e){for(let t of this.Qi)e&&!e.contains(t.el)||(t.destroy(),this.Qi.delete(t))}};var Nt=class{constructor(e){this.e=e;this.w=null;this.pt=e=>{this.w&&!this.w.contains(e.target)&&this.close()};this.ft=e=>{e.key==="Escape"&&this.close()}}uh(e){if(e){let o=this.e.i.h(e.rowIndex),s=this.e.r.R(e.colId);return o&&s?{node:o,column:s}:null}let t=this.e.s.li();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}ch(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}}hh(e,t,i,r){let o=!1;for(let s of t){if(s.separator){e.appendChild(f("div","mach-context-menu-separator"));continue}let a=f("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.ph(s,i,r))),e.appendChild(a)}return o}ph(e,t,i){this.close();try{e.action?.()}catch(r){this.e.reportError(r,"contextMenu.action",{colId:i.id,rowId:t.id})}}fh(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.mh()})),i("menuClearContents",()=>{let r=t.s.li();r&&t.Oo(r)})}open(e,t,i){this.close();let r=this.uh(i);if(!r)return;let o=f("div","mach-context-menu");if(o.setAttribute("role","menu"),this.e.t.getContextMenuItems){let s=this.ch(r.node,r.column);if(!s||!this.hh(o,s,r.node,r.column))return;this.Ml(o,e,t);return}this.fh(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=C(t,8,Math.max(8,window.innerWidth-r.width-8)),s=C(i,8,Math.max(8,window.innerHeight-r.height-8));e.style.left=`${o}px`,e.style.top=`${s}px`,_(!0,this.pt,this.ft)}close(){this.w&&(this.w.remove(),this.w=null,_(!1,this.pt,this.ft))}destroy(){this.close()}};var Ft=class{constructor(e){this.e=e;this.w=null;this.nn=0;this.sn=null;this.an=e=>{if(this.e.o()||!this.e.t.tooltipComponent)return;let i=e.target.closest(".mach-cell");if(!i||i===this.sn)return;this.Al(),this.Qo(),this.sn=i;let r=this.gh(i);if(!r||i.classList.contains("mach-cell--editing"))return;let o=this.yh(r.node,r.column,r.index);this.vh(o,r.column)&&(this.nn=window.setTimeout(()=>{this.e.o()||this.sn!==i||this.bh(i,o)},Math.max(0,this.e.t.tooltipShowDelay)))};this.Il=()=>{this.hide()}}init(){S(this.e.n.ye,!0,{mouseover:this.an,mouseleave:this.Il})}destroy(){this.hide(),S(this.e.n.ye,!1,{mouseover:this.an,mouseleave:this.Il})}hide(){this.Al(),this.Qo(),this.sn=null}Al(){this.nn&&(clearTimeout(this.nn),this.nn=0)}Qo(){this.w?.remove(),this.w=null}gh(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.R(t):void 0;return!r||!o||r.isDetail||r.isGroup?null:{node:r,column:o,index:i}}yh(e,t,i){return{data:e.data,node:e,api:this.e.api,colId:t.id,value:this.e.d(e,t),formatted:fe(this.e,e,t),rowIndex:i}}vh(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}bh(e,t){this.Qo();let i=this.e.t.tooltipComponent;if(!i)return;let r=f("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,Z(r,e,6)}};var Ot=class{constructor(e){this.e=e;this.oe=null}init(){this.oe=f("div","mach-watermark"),this.oe.setAttribute("aria-hidden","true"),this.oe.style.pointerEvents="none",this.e.n.root.appendChild(this.oe),this.apply()}apply(){if(!this.oe||this.e.o())return;let e=this.e.t.watermarkEnabled?this.e.t.watermarkConfig:null;if(!e||!e.text){this.oe.style.display="none",this.oe.style.backgroundImage="";return}let t=this.wh(e);this.oe.style.display="",t?(this.oe.style.backgroundImage=`url(${t})`,this.oe.style.backgroundColor=""):this.oe.style.backgroundImage=""}wh(e){try{let t=f("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.Ch()?"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}}Ch(){return this.e.n.root.classList.contains("mach-theme-dark")}refresh(){this.apply()}destroy(){this.oe?.remove(),this.oe=null}};var Ht=class{constructor(e){this.e=e;this.U=[];this.Y=-1;this.de=null}Cl(){this.de===null&&(this.de=[])}Tl(){let e=this.de;this.de=null,e&&e.length>0&&this.push(e)}es(e){if(this.de!==!1){if(this.de){this.de.push(e);return}this.push([e])}}push(e){this.e.t.undoStackSize!==0&&(this.U.length=this.Y+1,this.U.push(e),this.Y=this.U.length-1,this.kl())}kl(){let e=this.e.t.undoStackSize;if(e===0){this.clear();return}for(;this.U.length>e;)this.U.shift(),this.Y--;this.Y<-1&&(this.Y=-1)}canUndo(){return this.Y>=0}canRedo(){return this.Y<this.U.length-1}undo(){if(this.e.ze(),!this.canUndo())return!1;let e=this.U[this.Y];return this.Y--,this.apply(e,!1),!0}redo(){return this.e.ze(),this.canRedo()?(this.Y++,this.apply(this.U[this.Y],!0),!0):!1}apply(e,t){let i=this.e,r=[],o=this.U;for(let s of e){if(o!==this.U&&(o=this.U,!o.includes(e)))break;let a=i.i.F(s.nodeId),l=i.r.R(s.columnId);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.en(a,l,d,u)&&(i.s.Wr(a),i.s.Pl([a.rowIndex],[l.id]),a.rowIndex>=0&&r.push(a.rowIndex),i.emit("cellValueChanged",{oldValue:u,newValue:d,rowNode:a,rowIndex:a.rowIndex,column:l,colDef:l.colDef,data:a.data}))}r.length>0&&i.s.I(r),i.Ge.refresh(),i.ct.refresh()}Wu(e){if(e.length===0||!this.U.length&&!this.de)return;let t=new Set(e),i=o=>o.some(s=>t.has(s.nodeId)),r=this.Y;this.U=this.U.filter((o,s)=>i(o)?(s<=r&&this.Y--,!1):!0),this.de&&i(this.de)&&(this.de=!1)}clear(){this.U=[],this.Y=-1,this.de=null}};var Vt=class{constructor(e){this.e=e;this.B=new Map;this.ts=!1;this.rs=null}init(){this.rs=this.e.ue.on("cellValueChanged",e=>{this.ts||this.es(e)})}es(e){let t=`${e.rowNode.id}\0${e.column.id}`,i=this.B.get(t),r=i?i.originalValue:e.oldValue;Object.is(e.newValue,r)?this.B.delete(t):this.B.set(t,{rowId:e.rowNode.id,colId:e.column.id,originalValue:r,value:e.newValue}),this.er()}getDirtyRowIds(){let e=new Set;for(let{rowId:t}of this.B.values())e.add(t);return[...e]}getChanges(){let e=new Map;for(let t of this.B.values()){let i=this.e.i.F(t.rowId);if(!i?.data)continue;let r=e.get(t.rowId);r||(r={rowId:t.rowId,data:i.data,cells:[]},e.set(t.rowId,r)),r.cells.push({colId:t.colId,originalValue:t.originalValue,value:t.value})}return[...e.values()]}markSaved(e){if(!e)this.B.clear();else{let t=new Set(e);for(let[i,r]of this.B)t.has(r.rowId)&&this.B.delete(i)}this.er()}Th(e){for(let t of e)for(let i of t.cells){let r=`${t.rowId}\0${i.colId}`,o=this.B.get(r);if(o){Object.is(o.value,i.value)?this.B.delete(r):o.originalValue=i.value;continue}let s=this.e.i.F(t.rowId),a=this.e.r.R(i.colId);if(!s||!a||s.data==null)continue;let l=this.e.d(s,a);Object.is(l,i.value)||this.B.set(r,{rowId:t.rowId,colId:i.colId,originalValue:i.value,value:l})}this.er()}rollback(e){let t=e?new Set(e):null,i=[...this.B.entries()].filter(([,s])=>!t||t.has(s.rowId));if(i.length===0)return!1;let r=new Set,o=new Set;this.ts=!0;try{for(let[s,a]of i){let l=this.e.i.F(a.rowId),d=this.e.r.R(a.colId);if(!l||!d||l.data==null)continue;let u=this.e.d(l,d);if(Object.is(u,a.originalValue)){o.add(s);continue}this.e.en(l,d,a.originalValue,u)&&(o.add(s),this.e.s.Wr(l),l.rowIndex>=0&&r.add(l.rowIndex),this.e.emit("cellValueChanged",{oldValue:u,newValue:a.originalValue,rowNode:l,rowIndex:l.rowIndex,column:d,colDef:d.colDef,data:l.data}))}}finally{this.ts=!1}for(let s of o)this.B.delete(s);return r.size>0&&this.e.s.I([...r]),this.e.Ge.refresh(),this.e.ct.refresh(),this.er(),o.size>0}Ku(e){e.length>0&&this.markSaved(e)}clear(){this.B.size!==0&&(this.B.clear(),this.er())}destroy(){this.rs?.(),this.rs=null,this.B.clear()}er(){this.e.emit("dirtyStateChanged",{dirtyRowIds:this.getDirtyRowIds()})}};var $i=class{constructor(){this.tr=null;this.ln=0;this.Gl=0;this.Ll=0}acquire(){this.ln++,this.Dh();let e=!1;return()=>{e||(e=!0,this.ln=Math.max(0,this.ln-1),this.ln===0&&this.disconnect())}}snapshot(){return{count:this.Gl,totalMs:this.Ll}}Dh(){if(!(this.tr||typeof PerformanceObserver>"u"))try{this.tr=new PerformanceObserver(e=>{for(let t of e.getEntries())this.Gl++,this.Ll+=t.duration}),this.tr.observe({entryTypes:["longtask"]})}catch{this.disconnect()}}disconnect(){let e=this.tr;this.tr=null;try{e?.disconnect()}catch{}}},Bt=new $i;function Wi(){return typeof performance<"u"&&typeof performance.now=="function"?performance.now():Date.now()}var _t=class{constructor(){this.Ft=[];this.dn=[];this.un=[];this.ns=Bt.acquire(),this.cn=Bt.snapshot()}start(){return Wi()}xh(e,t,i){this.Ft.push({duration:Math.max(0,Wi()-e),rows:t,columns:i}),this.Ft.length>120&&this.Ft.shift()}Rh(e){this.Nl(this.dn,e)}Ba(e){this.Nl(this.un,e)}snapshot(){let e=this.Ft.map(r=>r.duration),t=this.Ft[this.Ft.length-1],i=Bt.snapshot();return{sampleCount:e.length,lastRenderMs:t?.duration??0,averageRenderMs:this.Eh(e),maxRenderMs:Math.max(0,...e),p95RenderMs:this.os(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.dn.length,p95LayoutMs:this.os(this.dn),modelSampleCount:this.un.length,p95ModelMs:this.os(this.un),longTaskCount:Math.max(0,i.count-this.cn.count),longTaskTotalMs:Math.max(0,i.totalMs-this.cn.totalMs),usedHeapBytes:this.usedHeapBytes()}}reset(){this.Ft=[],this.dn=[],this.un=[],this.cn=Bt.snapshot()}destroy(){this.ns?.(),this.ns=null}Nl(e,t){e.push(Math.max(0,Wi()-t)),e.length>120&&e.shift()}Eh(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}os(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 Ki(n,e){if(!(n==null||e==null))return[...new Set([...n,...e])]}function Xs(n,e){return n===!0||e===!0?!0:n?e?{rowIds:Ki(n.rowIds,e.rowIds),rowIndexes:Ki(n.rowIndexes,e.rowIndexes),columns:Ki(n.columns,e.columns),force:n.force===!0||e.force===!0,includePinned:n.includePinned===!0||e.includePinned===!0}:n:e}var Js=["columns","header","pool","data","layout","pinned","summary","overlays"];function Zs(n,e){let t={cells:Xs(n.cells,e.cells)};for(let i of Js)t[i]=n[i]===!0||e[i]===!0;return t}var zt=class{constructor(e){this.apply=e;this.Ot=0;this.mt=null;this.Fl=0;this.Ol=0;this.Hl=0;this.hn=!1}batch(e){if(this.hn)return e();this.Ot++;try{return e()}finally{this.Ot--,this.Ot===0&&this.flush()}}Vl(e){this.hn||(this.Ol++,this.mt&&this.Hl++,this.mt=Zs(this.mt??{},e),this.Ot===0&&this.flush())}flush(){if(this.hn||this.Ot>0||!this.mt)return;let e=this.mt;this.mt=null,this.Fl++,this.apply(e)}snapshot(){return{batchDepth:this.Ot,flushCount:this.Fl,requestCount:this.Ol,coalescedRequestCount:this.Hl,pending:this.mt!=null}}destroy(){this.hn=!0,this.mt=null,this.Ot=0}};var gn=Symbol.for("mach-table.adapter.lifecycle.v1");function yn(n,e){Object.defineProperty(n,gn,{value:e})}function Ui(n){let e=n[gn]?.rowDrag;return e?.policy===n.getOption("rowDragPolicy")?e?.factory:void 0}var vn=Symbol.for("mach-table.import.v1");function bn(n,e){Object.defineProperty(n,vn,{value:{begin:()=>e.V.Qr(),revision:()=>e.i.Be(),isEditing:()=>e.a.isEditing(),columns:()=>e.r.Q(),visibleColumns:()=>e.r.l(),read:(i,r)=>e.d(i,r),editable:(i,r)=>e.a.ne(i,r),parse:(i,r,o,s)=>ue(e,i,r,o,"import",s),pasteRows:i=>{let r=[];for(let o of e.i.kt())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.V.Ko(i,r),guard:i=>e.V.Jr(i),commitRows:(i,r,o)=>e.V.Dl(i,r,o)}})}function wn(n){let e=n[vn];if(!e)throw new TypeError("Import plans require a MachTable GridApi");return e}function Qs(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 p=c.colDef.headerName;p&&l.set(p,l.has(p)?null:c)}let d=[],u=new Set;return o.forEach((c,h)=>{let p=(typeof c=="string"||typeof c=="number"?String(c):"").replace(/^\uFEFF/,"").trim(),m=s.get(p)??(a.has(p)?a.get(p):l.get(p));if(!m){if(i||t.columns||a.has(p)||l.has(p))throw new TypeError(`Unknown or ambiguous import column: ${p}`);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 ea(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 ta(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):Dt(r,o.coerceNumbers!==!1);if(k(l))throw new TypeError("Import parsers must return synchronous values");if(!me(e.data,s,l))throw new TypeError(`Unsafe import field: ${s}`);e.changes.push({node:e.node,column:t,oldValue:a,newValue:l})}function ia(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{ta(n,u,c,h,e[h],r)}catch(p){o.issues.push({rowIndex:t,columnIndex:h,colId:c.id,code:"PARSE",message:p instanceof Error?p.message:String(p)})}o.rows.push(u)}function Cn(n,e,t={},i,r=!1,o){let s=t.headerRowIndex??(t.columns?-1:0);ea(e,s);let a=Qs(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)&&ia(n,u,d-s-1,a,t,l,i,o)}return l}function ce(n){return(n==null?"":String(n)).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function Wt(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 $t=["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 xe={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(xe));var _e=new Set($t.map(n=>`on${n.charAt(0).toUpperCase()}${n.slice(1)}`));function qi(n,e){let t=xe[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 Tn(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(xe,t)||!qi(t,i)||(e[t]=i)}return e}var xn=2e3,Yi=1e5,ze=512,na=1e4;function Dn(n){return Array.isArray(n)?[...new Set(n.slice(0,Yi).filter(e=>typeof e=="string"&&e.length>0&&e.length<=ze))]:[]}function oa(n){if(!Array.isArray(n))return[];let e=new Set,t=Yi*ze;for(let i of n.slice(0,Yi)){if(typeof i!="string"||!i.length||e.has(i))continue;let r=i.startsWith(gt)?65536:ze;i.length>r||i.length>t||(e.add(i),t-=i.length)}return[...e]}function sa(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 aa(n,e){typeof e.hide=="boolean"&&(n.hide=e.hide),(e.pinned===null||e.pinned==="left"||e.pinned==="right")&&(n.pinned=e.pinned)}function la(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 aa(r,t),sa(r,t),r}function da(n){if(!Array.isArray(n))return[];let e=[],t=new Set;for(let i of n.slice(0,xn)){let r=la(i,t);r&&e.push(r)}return e}function ua(n){if(!Array.isArray(n))return[];let e=[],t=new Set;for(let i of n.slice(0,xn)){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 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:da(e.columns),sortModel:ua(e.sortModel),filterModel:Q(e.filterModel),advancedFilterModel:H(e.advancedFilterModel),quickFilterText:typeof e.quickFilterText=="string"&&e.quickFilterText.trim()?e.quickFilterText.slice(0,na):null,pagination:{enabled:t.enabled===!0,page:E(t.page,1,1,!0),pageSize:E(t.pageSize,20,1,!0)},selectedRowIds:Dn(e.selectedRowIds),expandedRowIds:Dn(e.expandedRowIds),expandedGroupIds:oa(e.expandedGroupIds)}}function Rn(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 ca(n){try{if(typeof structuredClone=="function")return structuredClone(n)}catch{}return Array.isArray(n)?[...n]:n!=null&&typeof n=="object"?{...n}:n}function Sn(n,e){let t=e?new Set(e.map(String)):null;return n.filter(i=>!t||t.has(i.rowId)).map(i=>({...i,data:ca(i.data),cells:i.cells.map(r=>({...r}))}))}function ha(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 En(n,e){let t=new Map;for(let i of n??[]){let r=ha(i,e);r&&!t.has(r.rowId)&&t.set(r.rowId,r)}return[...t.values()]}function Mn(n,e){let t=new Set(n.map(d=>d.rowId)),i=En(e?.conflicts,t),r=new Set(i.map(d=>d.rowId)),o=En(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 pa(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 In(n,e,t){if(n.isDestroyed())return!1;if(t==="keepLocal")return!0;let i=pa(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 fa=["compact","normal","large"],w=["left","center","right"];function Ut(n,e){let t=n.t,i;if(e==="loading")i=t.overlayLoadingTemplate||n.Sh();else if(e==="noRows")i=t.overlayNoRowsTemplate||n.Mh();else if(e==="error")i=t.overlayErrorTemplate||n.Ih();else{n.n.Ah();return}n.n.kh(e,i,t.allowUnsafeOverlayHtml)}var Kt=class{constructor(e){this.e=e;this.nr=null;this.ls=null;this.ds=!1;this.gn=null;this.us=[];this.yn=null;this.ci=0;this.Bl=-1;this._l=-1;this.Yt=1;this.cs=()=>{document.fonts.ready.then(this.Kl)};this.Kl=()=>{this.ci||this.e.o()||(this.ci=requestAnimationFrame(()=>{this.ci=0,this.e.Ie()}))};this.hi=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=f("div",i.join(" ")),this.zl(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.Wl(t),this.ir=f("div","mach-header"),this.ir.setAttribute("role","rowgroup"),this.rr={left:[],center:[],right:[]},this.ss={},this.ai={};for(let r of w){let o=f("div",`mach-pane mach-pane--${r} mach-header-pane`),s=f("div","mach-header-rows");if(r==="center"){let a=f("div","mach-header-viewport");a.appendChild(s),o.appendChild(a)}else o.appendChild(s);this.ir.appendChild(o),this.ss[r]=o,this.ai[r]=s}this.$l(1),this.ye=f("div","mach-body"),this.pn=f("div","mach-pinned-rows mach-pinned-rows--top"),this.pn.style.display="none",this.fn=f("div","mach-pinned-rows mach-pinned-rows--bottom"),this.fn.style.display="none",this.C={},this.ce={},this.as={};for(let r of w){let o=f("div",`mach-pane mach-pane--${r} mach-body-pane`),s=f("div",`mach-body-viewport${r==="center"?" mach-body-viewport--scroll":""}`),a=f("div","mach-row-container");s.appendChild(a),o.appendChild(s),this.ye.appendChild(o),this.as[r]=o,this.C[r]=s,this.ce[r]=a}this.Ke=f("div","mach-overlay"),this.Ke.style.display="none",this.Ke.setAttribute("role","status"),this.Ke.setAttribute("aria-live","polite"),this.Ue=f("div","mach-overlay-content"),this.Ke.appendChild(this.Ue),this.gt=f("div","mach-infinite-loading"),this.gt.style.display="none",this.gt.appendChild(f("div","mach-spinner")),this.mn=f("span"),this.gt.appendChild(this.mn),this.root.append(this.ir,this.pn,this.ye,this.fn,this.Ke,this.gt),e.appendChild(this.root),document.fonts?.addEventListener("loading",this.cs),document.fonts?.status==="loading"&&this.cs(),typeof ResizeObserver<"u"&&(this.yn=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.Bl&&a===this._l||(this.Bl=s,this._l=a,this.Kl())}),this.yn.observe(this.root)),this.Ul(t.theme)}Wl(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")}$l(e){this.Yt=e;for(let t of w){let i=this.ai[t],r=this.rr[t];for(;r.length<e;){let o=f("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.jl()}ql(){return this.Yt}jl(){this.ir.style.height=`${this.Yt*this.e.t.headerHeight}px`;for(let e of w)this.rr[e].forEach((i,r)=>{i.style.top=`${r*this.e.t.headerHeight}px`,i.style.height=`${this.e.t.headerHeight}px`})}Ph(e,t){this.Yl("left",e),this.Yl("right",t)}Yl(e,t){let i=this.ss[e],r=this.as[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)}hs(){let e=this.C.center,t=Math.max(0,e.offsetWidth-e.clientWidth);return Math.max(0,this.ye.clientWidth-t)}Gh(e,t){this.root.style.setProperty("--mach-row-h",`${e}px`),this.root.style.setProperty("--mach-header-h",`${t}px`),this.jl()}Lh(e){for(let t of fa)this.root.classList.toggle(`mach-size--${t}`,t===e)}Ul(e){if(!this.root)return;this.hi?.(),this.hi=null;let t=e==="dark"||e==="auto"&&this.Nh();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.hi=()=>i.removeEventListener("change",r)):typeof i.addListener=="function"&&(i.addListener(r),this.hi=()=>i.removeListener(r))}}Nh(){return typeof window>"u"||typeof window.matchMedia!="function"?!1:window.matchMedia("(prefers-color-scheme: dark)").matches}Fh(e){this.root.classList.toggle("mach-striped",e)}Oh(e){this.root.classList.toggle("mach-cell-borders",e)}Hh(e){this.root.classList.toggle("mach-dom-layout--auto-height",e==="autoHeight")}zl(e){for(let t of this.us)this.root.classList.remove(t);this.us=[];for(let t of String(e??"").split(/\s+/).filter(Boolean))this.root.classList.contains(t)||(this.root.classList.add(t),this.us.push(t))}Vh(e){try{return typeof e=="function"?e():e}catch(t){return this.e.reportError(t,"overlayTemplate"),""}}Bh(e,t,i){if(typeof t=="object"&&t!=null&&"el"in t){this.Ue.appendChild(t.el),this.gn=t.destroy??null;return}if(t instanceof HTMLElement){this.Ue.appendChild(t);return}if(t){i?this.Ue.innerHTML=t:this.Ue.textContent=t;return}if(e!=="loading")return;let r=f("div","mach-spinner");r.setAttribute("aria-label","loading"),this.Ue.appendChild(r)}kh(e,t,i=!1){this.nr===e&&this.ls===t&&this.ds===i||(this.nr=e,this.ls=t,this.ds=i,this.ps(),this.Ue.replaceChildren(),this.Bh(e,this.Vh(t),i),this.Ke.style.display="",this.root.classList.add("mach-has-overlay"),this.Ke.setAttribute("role",e==="error"?"alert":"status"),this.root.setAttribute("aria-busy",e==="loading"?"true":"false"))}Ah(){this.nr&&(this.nr=null,this.ls=null,this.ds=!1,this.Ke.style.display="none",this.root.classList.remove("mach-has-overlay"),this.ps(),this.Ue.replaceChildren(),this.root.setAttribute("aria-busy","false"))}Mt(e,t){this.gt&&(e?(this.mn.textContent!==t&&(this.mn.textContent=t),this.gt.style.display="",this.root.setAttribute("aria-busy","true")):(this.gt.style.display="none",this.nr!=="loading"&&this.root.setAttribute("aria-busy","false")))}destroy(){document.fonts?.removeEventListener("loading",this.cs),this.hi?.(),this.hi=null,this.yn?.disconnect(),this.yn=null,this.ci&&cancelAnimationFrame(this.ci),this.ci=0,this.ps(),this.root?.remove()}ps(){if(!this.gn)return;let e=this.gn;this.gn=null;try{e()}catch(t){this.e.reportError(t,"overlayTemplate.destroy")}}};function An(n,e){return{setData:t=>n.nt(t),transact:t=>n.Hi(t),transactAsync:(t,i)=>n._h(t,i),flushTransactions:()=>n.Xl(),getCount:()=>e.i.L(),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.Ua(t,i),isRemote:()=>e.i.g,reload:t=>n.reload(t),ensureLoaded:(t,i,r)=>n.bo(t,i,r),purgeCache:()=>{e.o()||e.i.Ou()},getCacheSnapshot:()=>e.i.Hu()}}function kn(n,e){return{getDefinitions:()=>e.r.oo(),setDefinitions:t=>n.Ei(t),getState:()=>e.r.pa(),setState:t=>n.zh(t),resetState:()=>n.uo(),setVisible:(t,i)=>n.so(t,i),setPinned:(t,i)=>n.ao(t,i),move:(t,i)=>{e.o()||e.Si(t,i)},setWidth:(t,i)=>n.Ee(t,i),fit:t=>n.Wh(t),autoSize:t=>n.$h(t),autoSizeAll:()=>n.Kh(),getWorkbenchItems:()=>n.Uh(),openWorkbench:t=>{e.o()||e.columnMenu.lh(t)},closeWorkbench:()=>e.columnMenu.close()}}function Pn(n,e){return{getRows:()=>e.f.ja(),getVisibleRows:()=>n.jh(),getNodes:()=>e.f.ti(),getIds:()=>e.f.So(),setRows:(t,i)=>n.qh(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.Yh(t),getRange:()=>e.s.or(),clearRange:()=>n.di()}}function Gn(n,e){return{startCell:t=>n.Xh(t),startRow:t=>e.a.startRow(t),isRowActive:t=>e.a.ul(t),stop:t=>e.a.Pe(t?.cancel===!0),getChanges:()=>e.$.getChanges(),getDirtyRowIds:()=>e.$.getDirtyRowIds(),markSaved:t=>e.$.markSaved(t),rollback:t=>e.$.rollback(t),save:(t,i)=>n.Jh(t,i),undo:()=>!e.o()&&e.O.undo(),redo:()=>!e.o()&&e.O.redo(),canUndo:()=>e.O.canUndo(),canRedo:()=>e.O.canRedo()}}function Ln(n){return{get:()=>n.getState(),apply:(e,t)=>n.Jl(e,t)}}function Nn(n,e){return{get:()=>e.Zh(),getPerformance:()=>e.Ce.snapshot(),resetPerformance:()=>e.Ce.reset()}}function Fn(n,e){return{getModel:()=>e.i._e(),setModel:t=>n.It(t),getAdvancedModel:()=>e.i.Fi(),setAdvancedModel:t=>n.ot(t),getQuickText:()=>e.i.To(),setQuickText:t=>n.At(t),isPresent:t=>t==null?e.i.Vi():v(e.i._e(),t)}}function On(n,e){return{getModel:()=>e.r.ee(),setModel:t=>n.Qh(t)}}function Hn(n,e){return{isEnabled:()=>e.i.Te,setEnabled:t=>{e.o()||e.i.Wa(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 Vn(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.Ro(t),e.i.isGroupExpanded(t)===i),setAllGroupsExpanded:t=>{e.o()||e.i.setAllGroupsExpanded(t)},setAllDetailsExpanded:t=>{e.o()||e.i.setAllDetailsExpanded(t)}}}function Bn(n,e){return{getRoot:()=>e.o()?null:e.n.root,scrollToRow:(t,i)=>e.s.$r(t,i),refreshCells:t=>n.refreshCells(t),refreshLayout:()=>n.refreshLayout(),flush:()=>e.pi.flush(),setOverlay:t=>Ut(e,t),getPinnedRows:t=>e.Le.getRows(t),setPinnedRows:(t,i)=>n.setPinnedRows(t,i)}}function _n(n,e){return{exportCsv:t=>n.ep(t),importCsv:(t,i)=>n.importCsv(t,i),exportMatrix:t=>n.Zl(t),importMatrix:(t,i)=>n.importMatrix(t,i),print:t=>n.print(t),copyRange:()=>e.o()?Promise.resolve(!1):e.Sl()}}function jt(n){return ne(n?.reason,"The operation was aborted")}function zn(n,e){return ht(n,e,()=>jt(e))}function Xi(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 Ji=class{constructor(e){this.e=e;this.fs=[];this.sr=null}batch(e){return this.e.Ql(()=>e(this.e.api))}nt(e){if(!this.e.o()){if(this.e.i.g){this.e.t.rowData=e??[];return}this.e.i.nt(e),this.e.K({data:!0})}}Hi(e){if(this.e.o()||this.e.i.g)return;let t=this.e.i.Hi(e);this.ed(t)}_h(e,t={}){if(this.e.o()||this.e.i.g)return Promise.resolve();if(t.signal?.aborted)return Promise.reject(jt(t.signal));let i=new Promise((r,o)=>{let s={transaction:e,revision:this.e.i.Be(),resolve:r,reject:o,signal:t.signal,aborted:!1};t.signal&&(s.onAbort=()=>{s.aborted||(s.aborted=!0,o(jt(t.signal)))},t.signal.addEventListener("abort",s.onAbort,{once:!0})),this.fs.push(s)});return this.sr==null&&(this.sr=setTimeout(()=>this.Xl(),this.e.t.asyncTransactionWaitMillis)),i}td(){this.sr!=null&&clearTimeout(this.sr),this.sr=null;let e=this.fs;return this.fs=[],e}Xl(){let e=this.td(),t=this.e.i,i=t.Be(),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.Be()===i&&this.ed(s)}let o=t.Be()===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(ne(void 0,"The table data changed before the transaction could complete")))}ed(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.K({data:!0});return}this.e.K({cells:{rowIds:e.updatedRowIds},summary:!0,overlays:!0})}}Ei(e){this.updateOptions({columnDefs:[...e??[]]})}zh(e){this.e.o()||(this.e.r.fa(e),this.ms())}uo(){this.e.o()||(this.e.r.uo(),this.ms())}so(e,t){this.e.o()||(this.e.r.so(e,t),this.e.ar(),this.e.emit("columnVisibilityChanged",{colId:e,visible:t}))}ao(e,t){this.e.o()||(this.e.r.ao(e,t),this.ms())}ms(){this.e.ar(),this.e.vn()}Ee(e,t){if(this.e.o())return!1;let i=this.e.r.R(e);return!i||!this.e.r.Ee(i,t)?!1:(this.dt([i]),!0)}Wh(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.hs();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=nt(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.ca(d,s[u]):this.e.r.Ee(d,s[u]));this.dt(l)}$h(e){if(this.e.o())return;let t=this.e.r.R(e);t&&this.rd(t)&&this.dt([t])}rd(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.tp(e,this.e.je.aa(e))}tp(e,t){return this.e.t.columnLayout!=="normal"?this.e.r.ca(e,t):this.e.r.Ee(e,t)}Kh(){if(this.e.o())return;let e=[];for(let t of this.e.r.l())this.rd(t)&&e.push(t);e.length>0&&this.dt(e)}dt(e){this.e.ri(),this.e.dt(e)}Qh(e){this.e.o()||(this.e.r.Mi(e),this.e.Mi())}It(e){this.e.o()||(this.e.i.It(e),this.e.lr())}ot(e){this.e.o()||!this.e.i.ot(e)||this.e.lr()}At(e){if(this.e.o())return;let t=this.e.i.At(e);this.e.t.quickFilterText=this.e.i.To(),t&&this.e.lr()}Yh(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.F(this.e.i.resolveRowId(o,-1,`__missing_selection_${this.e.Qt()}`)):this.e.i.He().find(a=>a.data===o);s&&r.push({node:s,selected:!0})}r.length>0?this.e.f.Gt(r,t):t&&this.e.f.deselectAll()}jh(){let e=this.e.f;return this.e.i.kt().filter(t=>!t.isDetail&&!t.isGroup&&e.Br(t.id)).map(t=>t.data).filter(Boolean)}async Jh(e,t){let i=Sn(this.e.$.getChanges(),t);if(i.length===0)return{submitted:[],saved:[],failures:[],conflicts:[]};let r=this.e.i.Be(),o=Mn(i,await e(i));return!this.e.o()&&r===this.e.i.Be()&&this.e.$.Th(o.saved),o}setPinnedRows(e,t){if(this.e.o())return;let i=e==="top"?"pinnedTopRowData":"pinnedBottomRowData";this.e.t[i]=t??[],this.e.Le.setRows(e,this.e.t[i])}di(){this.e.o()||this.e.s.di()}Uh(){return this.e.r.Q().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.bn(!0))}reload(e={}){return this.e.o()?Promise.resolve():e.signal?.aborted?Promise.reject(jt(e.signal)):this.e.i.g?zn(this.e.i.Or(e.signal),e.signal):(this.nt(this.e.t.rowData),Promise.resolve())}bo(e,t,i={}){return this.e.o()?Promise.resolve():zn(this.e.i.bo(e,t,i.signal),i.signal)}importCsv(e,t={}){if(!e)return!1;let{parseValue:i,...r}=t;return this.importMatrix(Et(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=wn(this.e.api),r=t.mode==="paste"?i.pasteRows(e.length):void 0,o=Cn(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.fi(o.rows.flatMap(s=>s.changes));else{let s=o.rows.map(a=>a.data);t.mode==="append"?this.Hi({add:s}):this.nt(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._a().filter(d=>!d.isDetail&&!d.isGroup),s=e.includeHeader!==!1?`<tr>${i.map(d=>`<th>${ce(d.colDef.headerName??d.colDef.field??d.id)}</th>`).join("")}</tr>`:"",a=r.map(d=>`<tr>${i.map(u=>{let c=fe(this.e,d,u);return`<td>${ce(c)}</td>`}).join("")}</tr>`).join(""),l=`<!doctype html><html><head><meta charset="utf-8"><title>${ce(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>${ce(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}}Xh(e){let t=this.e.r.R(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.K({cells:e??!0,pinned:e?.includePinned??t,summary:t})}getOption(e){return this.e.t[e]}updateOptions(e){if(this.e.o()||(this.e.gs(e),e=Tn(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;De(Array.isArray(i)?i:[],e.childrenKey??t.childrenKey)}this.e.Ql(()=>{let i={},r=this.e.t.columnMenu;this.ip(e,i),this.rp(e,i),this.np(e,i),this.op(e,i),this.sp(e),this.ap(e,i),this.lp(e,i),this.dp(e,i),this.up(e,i),this.cp(e,i),this.hp(e,i,r)})}ip(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.pp(e)}pp(e){for(let t of _e){let i=t;v(e,i)&&Reflect.set(this.e.t,i,e[i])}}rp(e,t){let i=this.e.t;for(let o of["rowHeight","headerHeight","rowBuffer"]){let s=Xi(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.Je=!1,t.layout=!0),e.domLayout!=null&&e.domLayout!==i.domLayout&&(i.domLayout=e.domLayout==="autoHeight"?"autoHeight":"normal",this.e.n.Hh(i.domLayout),t.pool=!0),v(e,"maxBodyHeight")&&(i.maxBodyHeight=x(e.maxBodyHeight,1),t.layout=!0),R(e,i,["multiSort"]);let r=Xi(e.detailRowHeight,i.detailRowHeight,1);r!==void 0&&(i.detailRowHeight=r,this.e.s.wn(),this.e.s.dr(!0))}np(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"])}op(e,t){let i=this.e.t;typeof e.enableColumnResize=="boolean"&&e.enableColumnResize!==i.enableColumnResize&&(this.e.ur.lt(),i.enableColumnResize=e.enableColumnResize,t.header=!0),O(e,i,"locale")&&(t.header=!0,t.cells=!0,this.e.mi.xe(),this.e.ct.xe()),O(e,i,"indexOffset")&&(t.cells=!0),O(e,i,"showSummary")&&(t.summary=!0,t.layout=!0);let r=Xi(e.undoStackSize,i.undoStackSize,0,!0);r!==void 0&&(i.undoStackSize=r,this.e.O.kl());let o=x(e.asyncTransactionWaitMillis,0,!0);o!==void 0&&(i.asyncTransactionWaitMillis=o),this.fp(e,t),this.mp(e)}fp(e,t){v(e,"getRowHeight")&&(this.e.t.getRowHeight=e.getRowHeight,this.e.s.st(),t.layout=!0)}mp(e){let t=this.e.t;e.enableRangeSelection!=null&&(t.enableRangeSelection=e.enableRangeSelection,e.enableRangeSelection||this.di()),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.Ul(t.theme),this.e.Cn.refresh())}sp(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.Wa(r),typeof i=="object"&&i&&this.gp(i),t.paginationEnabled&&this.e.i.ic(),this.e.mi.xe()}gp(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)}ap(e,t){v(e,"rowStyleRules")&&(this.e.t.rowStyleRules=Array.isArray(e.rowStyleRules)?e.rowStyleRules:[],t.cells=!0,this.e.K({pinned:!0})),this.yp(e,t),this.vp(e,t);let i=this.e.t;O(e,i,"stripedRows")&&this.e.n.Fh(i.stripedRows),O(e,i,"showCellBorders")&&this.e.n.Oh(i.showCellBorders)}yp(e,t){let i=this.e.t;e.watermark!==void 0&&(Object.assign(i,Di(e)),this.e.Cn.refresh()),this.bp(e),v(e,"summaryMethod")&&(i.summaryMethod=e.summaryMethod,t.summary=!0)}bp(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.ct.xe())}vp(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.Lh(i),t.layout=!0,t.header=!0}lp(e,t){let i=this.e.t;R(e,i,["suppressCellFocus","suppressRowHoverHighlight","suppressNoRowsOverlay"]),O(e,i,"suppressHeaderFocus")&&(t.header=!0),this.wp(e),this.Cp(e)}wp(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.Wl(t)}Cp(e){let t=this.e.t;for(let i of["overlayNoRowsTemplate","overlayLoadingTemplate","overlayErrorTemplate"])v(e,i)&&(t[i]=e[i]??Ge[i]);R(e,t,["allowUnsafeOverlayHtml"]),v(e,"className")&&(t.className=e.className??"",this.e.n.zl(t.className)),R(e,t,["loading"]),v(e,"error")&&(t.error=e.error??null)}dp(e,t){this.Tp(e,t),this.Dp(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"])}Tp(e,t){let i=this.e.t;if(O(e,i,"rowSelection")&&(this.e.f.yc(),t.header=!0,t.pool=!0,this.e.Tn()),e.quickFilterText!==void 0&&this.At(e.quickFilterText),e.defaultColDef!==void 0&&e.defaultColDef!==i.defaultColDef&&(i.defaultColDef={...Ci,...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})=>Ti(r,o):void 0,t.needsRowRebuild=!0}}Dp(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.Tn()),O(e,i,"childrenKey")&&(t.needsRowRebuild=!0),R(e,i,["isTreeRowExpandable","loadTreeChildren"],!0)&&(t.cells=!0)}up(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.xp(e,t),this.Rp(e,t)}xp(e,t){let i=this.e.t;v(e,"dataProcessor")&&this.e.nd(e.dataProcessor)&&(t.needsRowRebuild=!0);let r=x(e.dataProcessorMinRows,1,!0);r!==void 0&&r!==i.dataProcessorMinRows&&(i.dataProcessorMinRows=r,t.needsRowRebuild=!0)}Rp(e,t){let i=this.e.t;v(e,"persistence")&&(i.persistence=Ue(e.persistence),t.needsStateLoad=!0)}cp(e,t){let i=this.e.t;xi(e,i)&&i.datasourceMode==="block"&&(t.datasourceChanged=!0),this.Ep(e,t),this.Sp(e,t),this.Mp(e)}Ep(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)}}Sp(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.mi.xe()),R(e,i,["detailRowRenderer","isRowExpandable"],!0)&&(t.cells=!0)}Mp(e){e.pinnedTopRowData!==void 0&&this.setPinnedRows("top",e.pinnedTopRowData),e.pinnedBottomRowData!==void 0&&this.setPinnedRows("bottom",e.pinnedBottomRowData)}hp(e,t,i){let r=this.e.t;t.needsColumnRebuild?this.Ip(e,t):v(e,"advancedFilterModel")&&(t.filterChanged=this.e.i.ot(e.advancedFilterModel)),t.needsFeatureReload&&this.e.od(r.features),this.Ap(t),t.filterChanged&&this.e.ys(!t.needsColumnRebuild),t.layout&&this.e.n.Gh(r.rowHeight,r.headerHeight),e.columnMenu!=null&&e.columnMenu!==i&&(t.header=!0),t.stateToApply&&this.Jl(t.stateToApply),t.pool&&(t.cells=void 0),t.overlays=!0,this.e.K(t)}Ip(e,t){t.columnDefsChanged&&!t.needsRowRebuild&&(this.e.ze(),this.e.a.stop(!0));let i=this.e.r.Ei(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.ee()},!1),this.e.ar(),t.header=!1,t.pool=!1}Ap(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.vs(!e.needsStateLoad,!0),this.kp(e,i),t&&!o&&this.e.vs(!e.needsStateLoad)}kp(e,t){if(e.datasourceChanged){this.e.i.Fu();return}t&&(!this.e.i.g&&e.needsRowRebuild?this.nt(this.e.t.rowData):this.e.i.Do())}ep(e={}){let t=this.Zl({...e,target:"csv",protectFormulas:!1});return ln(t,e)}Zl(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.kt():this.e.i._a();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:le(a)}))]}getState(){return{version:2,columns:this.e.r.pa(!1),sortModel:this.e.r.ee(),filterModel:this.e.i._e(),advancedFilterModel:this.e.i.Fi(),quickFilterText:this.e.i.To(),pagination:{enabled:this.e.i.Te,page:this.e.i.ei(),pageSize:this.e.t.paginationPageSize},selectedRowIds:this.e.f.So(),expandedRowIds:this.e.i.lc(),expandedGroupIds:this.e.i.dc()}}Jl(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.Pp(i,o),this.Gp(i,o),t.emitEvents!==!1&&this.Lp(o),o.has("columns")&&this.e.vn()}Pp(e,t){t.has("columns")&&this.e.r.fa(e.columns??[]),t.has("sort")&&this.e.r.Mi(e.sortModel??[]),t.has("filter")&&(this.e.i.It(e.filterModel??{}),this.e.i.ot(e.advancedFilterModel),this.e.i.At(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.za(e.pagination.page,e.pagination.pageSize),this.e.mi.xe())}Gp(e,t){t.has("columns")&&this.e.ar(),this.e.Np()||(this.e.i.g?(t.has("sort")||t.has("filter"))&&this.e.i.Aa():this.e.i.I()),this.e.W.bs(),this.e.W.ws(),t.has("selection")&&this.e.f.qa(e.selectedRowIds??[])}Lp(e){e.has("sort")&&this.e.emit("sortChanged",{sortModel:this.e.r.ee()}),e.has("filter")&&this.e.ys(),e.has("pagination")&&this.e.i.zi(this.e.t.paginationPageSize)}destroy(){let e=this.td();for(let t of e)t.signal&&t.onAbort&&t.signal.removeEventListener("abort",t.onAbort),t.aborted||t.resolve();this.e.destroy()}},ma={rows:An,columns:kn,selection:Pn,editing:Gn,filtering:Fn,sorting:On,pagination:Hn,hierarchy:Vn,view:Bn,state:Ln,io:_n,diagnostics:Nn};function Wn(n){let e=new Ji(n),t={};for(let[i,r]of Object.entries(ma)){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()}),bn(t,n),yn(t,{suspend:()=>n.suspend(),resume:()=>t.view.refreshLayout(),canReplaceData:()=>!n.a.isEditing()&&n.$.getDirtyRowIds().length===0,readCell:(i,r)=>{let o=n.i.F(i),s=n.r.R(r);return o&&s?dn(Be(n,o,s,"clipboard")):""},writeInput:i=>n.fi(i.flatMap(({rowId:r,colId:o,value:s})=>{let a=n.i.F(r),l=n.r.R(o);return a&&l?[{node:a,column:l,oldValue:n.d(a,l),newValue:s}]:[]}))}),Object.freeze(t)}var ga={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 qt(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=ga[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 Zi(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 Re=class{constructor(){this.se=new Float64Array(1)}update(e){let t=this.se.length!==e.length+1;t&&(this.se=new Float64Array(e.length+1));let i=0;for(let r=0;r<e.length;r++)i+=e[r].currentWidth,this.se[r+1]!==i&&(this.se[r+1]=i,t=!0);return t}Cs(){return this.se[this.se.length-1]??0}qe(e){let t=Math.max(0,Math.min(Math.trunc(e),this.se.length-1));return this.se[t]??0}Fp(e){let t=Math.max(0,this.se.length-1);return t===0?-1:Math.min(t-1,Math.max(0,Zi(this.se,Math.max(0,e),!0)-1))}sd(e,t,i=2){let r=Math.max(0,this.se.length-1);if(r===0||t<=0||this.Cs()<=t)return{first:0,lastExcl:r};let o=Math.max(0,e),s=o+t,a=Math.max(0,Zi(this.se,o,!0)-1),l=Math.min(r,Zi(this.se,s));return{first:Math.max(0,a-i),lastExcl:Math.min(r,l+i)}}Dn(e,t,i){let r=t.indexOf(i);if(r<0)return;this.update(t);let o=this.qe(r),s=o+i.currentWidth;o<e.scrollLeft?e.scrollLeft=o:s>e.scrollLeft+e.clientWidth&&(e.scrollLeft=s-e.clientWidth)}};var ya=".mach-header-resize, .mach-filter-btn, .mach-menu-btn, .mach-select-all";function Qi(n){return n instanceof HTMLElement&&n.closest(ya)!=null}function er(n){return n==="ArrowLeft"||n==="ArrowRight"}function $n(n,e){typeof e=="string"?n.classList.add(e):Array.isArray(e)&&n.classList.add(...e)}var Yt=class{constructor(e){this.e=e;this.X=[];this.Ts=[];this.A=new Re;this.yt=0;this.Ht=Number.MAX_SAFE_INTEGER}xn(){this.ad(),this.e.ur.lt(),this.gi(!1);let e=this.e.r,t=e.Tu();this.e.n.$l(t);let i=new Set(e.y("center").slice(this.yt,this.Ht)),r=e.Cu(),o=this.e.t.headerHeight;for(let s of w){let a=this.e.n.rr[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 te){let p=this.X.length;if(l(h.children,u+1),this.X.length===p)continue;let m=this.Op(h);c.appendChild(m),this.Ts.push({group:h,el:m,pane:s})}else if(!h.hide&&e.ge(h)===s&&(s!=="center"||i.has(h))){let p=this.Hp(h,t-u,o);c.appendChild(p.el),this.X.push(p)}};l(r,0)}this.e.t.suppressHeaderFocus||this.X.forEach((s,a)=>{s.el.tabIndex=a===0?0:-1}),this.vt(),this.bs(),this.ws(),this.Vr()}ld(){let e=this.yt,t=this.Ht;this.ad(),(e!==this.yt||t!==this.Ht)&&this.xn()}si(e,t){let i=this.e.n.ai[t];return this.X.find(r=>r.column.id===e&&i.contains(r.el))?.el??null}ad(){let e=this.e.r.y("center"),t=this.e.n.C.center;this.A.update(e);let i=e.length>20?this.A.sd(t.scrollLeft,t.clientWidth,2):{first:0,lastExcl:e.length};this.yt=i.first,this.Ht=i.lastExcl}Hp(e,t,i){let r=f("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.Vp(r,e),this.Bp(r,e);let o=this._p(r,e);this.zp(r,e);let s=f("span","mach-sort-indicator");r.appendChild(s);let{filterBtn:a,filterTagEl:l}=this.Wp(r,e);return this.$p(r,e),this.Kp(r,e),this.Up(r,e),{column:e,el:r,sortEl:s,filterBtn:a,filterTagEl:l,selectAllEl:o}}Vp(e,t){let i=t.colDef;$n(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")}Bp(e,t){this.e.t.suppressHeaderFocus||(e.tabIndex=-1,e.addEventListener("mousedown",()=>this.Ds(t)),e.addEventListener("keydown",i=>this.jp(i,t)))}_p(e,t){if(!t.hasCheckbox||this.e.t.rowSelection!=="multiple")return;let i=f("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}zp(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=f("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),qe(e,r.destroy)):o.textContent=typeof r=="string"?r:i.headerName??i.field??t.id,e.appendChild(o)}Wp(e,t){if(!t.filterable)return{};let i=f("button","mach-filter-btn");i.type="button",i.setAttribute("aria-label",`filter ${t.id}`),i.innerHTML=fr,i.addEventListener("click",o=>{o.stopPropagation(),this.e.xs.toggle(t,i)}),e.appendChild(i);let r=f("span","mach-filter-tag");return e.appendChild(r),{filterBtn:i,filterTagEl:r}}$p(e,t){if(!this.e.t.columnMenu||t.hasCheckbox||t.colDef.suppressColumnMenu)return;let i=f("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=yr,i.addEventListener("click",s=>{s.stopPropagation(),this.e.columnMenu.toggle(t,i)}),e.appendChild(i)}Kp(e,t){if(!this.dd(t))return;let i=f("div","mach-header-resize");i.setAttribute("aria-hidden","true"),i.addEventListener("pointerdown",r=>{r.button===0&&(r.preventDefault(),r.stopPropagation(),this.e.ur.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)}Up(e,t){e.addEventListener("click",i=>{this.e.Rn.kc()||Qi(i.target)||t.sortable&&this.e.Er(t,i.shiftKey)}),e.addEventListener("pointerdown",i=>{i.button!==0||Qi(i.target)||this.e.Rn.Ac(i,t)})}Op(e){let t=f("div","mach-header-cell mach-header-cell--group");e.groupId&&(t.dataset.groupId=e.groupId),t.setAttribute("role","columnheader"),$n(t,e.def.headerClass);let i=f("span","mach-header-label mach-header-label--group");return i.textContent=e.headerName,t.appendChild(i),t}vt(){let e={left:0,center:0,right:0};for(let t of w){let i=this.e.n.rr[t],r=0,o=new Map;for(let a of this.e.r.y(t))o.set(a.id,r),r+=a.currentWidth;let s=this.e.t.headerHeight;for(let a of this.X){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.Z(a.column.id)+1))}for(let a of this.Ts){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.Ph(e.left,e.right)}jp(e,t){this.e.o()||this.qp(e,t)||this.Yp(e,t)||this.Xp(e,t)||this.Jp(e,t)||this.Zp(e)}qp(e,t){return e.key!=="Enter"&&e.key!==" "?!1:(Qi(e.target)||(e.preventDefault(),t.sortable&&this.e.Er(t,e.shiftKey)),!0)}Yp(e,t){if(!e.altKey||!er(e.key))return!1;if(!this.dd(t))return!0;let i=e.key==="ArrowRight"?24:-24;return this.e.r.Ee(t,t.currentWidth+i),this.e.ri(),this.e.dt([t]),e.preventDefault(),!0}Xp(e,t){if(!e.ctrlKey||!er(e.key))return!1;if(!t.movable)return!0;e.preventDefault();let i=this.e.r.ge(t),r=this.e.r.y(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.Si(t.id,a),!0}Jp(e,t){if(e.altKey||e.ctrlKey||e.metaKey||!er(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.Ds(i[s]),!0}Zp(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.Ds(t[i]),!0}Ds(e){let t=this.X.find(i=>i.column.id===e.id);if(!t&&!e.pinned&&(this.Dn(e),this.ld(),t=this.X.find(i=>i.column.id===e.id)),!!t){for(let i of this.X)i.el.tabIndex=i===t?0:-1;t.el.focus({preventScroll:!0})}}Dn(e){this.A.Dn(this.e.n.C.center,this.e.r.y("center"),e)}dd(e){return this.e.t.enableColumnResize&&e.resizable}bs(){let e=this.e.r.ee();for(let t of this.X){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"?mr:gr)+(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")}}ws(){let e=this.e.i._e();for(let t of this.X){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?qt(i):"";t.filterTagEl.style.display=o?"":"none",o&&(t.filterTagEl.textContent=o)}}}Vr(){for(let e of this.X){if(!e.selectAllEl)continue;let{all:t,some:i}=this.e.f.Cc();e.selectAllEl.checked=t,e.selectAllEl.indeterminate=i}}destroy(){this.gi(!0)}gi(e){for(let t of this.X){let i=Ye(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.X=[],this.Ts=[]}};var Xt=class{constructor(){this.he=null;this.Ye=null;this.yi=!1;this.Rs=-1;this.Es=-1}Qp(){return this.he}Ss(){return this.Ye}ef(){return this.he!=null}start(e,t){(!t||!this.he)&&(this.he={...e}),this.Ye={...e},this.Jt()}tf(e){return this.he?!0:e.colIdx<0?!1:(this.he={...e},this.Jt(),!0)}setEnd(e){this.Ye={...e},this.Jt()}clear(){this.he=null,this.Ye=null,this.Jt()}Jt(){this.yi=!1,this.Rs=-1,this.Es=-1}normalize(e,t){return this.yi!==!1&&this.Rs===e&&this.Es===t?this.yi:(this.Rs=e,this.Es=t,!this.he||!this.Ye||e<=0||t<=0?(this.yi=null,null):(this.yi={r1:Math.max(0,Math.min(this.he.row,this.Ye.row,e-1)),r2:Math.max(0,Math.min(Math.max(this.he.row,this.Ye.row),e-1)),c1:Math.max(0,Math.min(this.he.colIdx,this.Ye.colIdx,t-1)),c2:Math.max(0,Math.min(Math.max(this.he.colIdx,this.Ye.colIdx),t-1))},this.yi))}};var Jt=class{constructor(e){this.host=e;this.Ne=null;this.le=0;this.En=0;this.$i=e=>{let t=this.Ne;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.ud()}};this.of=()=>{if(this.le=0,!!this.Ne?.active){if(!this.current()){this.destroy();return}this.Ki(),this.sf()&&this.ud()}};this.ni=e=>{let t=this.Ne;if(!(!t||e.pointerId!==t.pointerId)){t.clientX=e.clientX,t.clientY=e.clientY,t.active&&this.current()&&this.Ki(),this.cd();try{t.active&&t.drop?.valid&&this.Ms(e.clientX,e.clientY)&&this.current()&&this.commitDrop(t.drop)}finally{this.release()}}};this.Po=e=>{e.key==="Escape"&&(e.preventDefault(),this.destroy())};this.Ur=e=>{e.type==="pointercancel"&&e.pointerId!==this.Ne?.pointerId||this.destroy()}}begin(e){let t=this.host.containers.map(r=>{let o=f("div","mach-row-drop-indicator");return o.hidden=!0,r.append(o),o}),i=f("div","mach-row-drag-preview");i.setAttribute("role","status"),i.hidden=!0,this.host.root.append(i),this.Ne={startY:e.clientY,clientX:e.clientX,clientY:e.clientY,pointerId:e.pointerId,indicators:t,preview:i,drop:null,active:!1},this.ji(!0)}ji(e){S(window,e,{pointermove:this.$i,pointerup:this.ni,pointercancel:this.Ur,keydown:this.Po,blur:this.Ur})}rf(e){return this.Ne?.active===!0&&this.sourceContains(e)}nf(e,t=()=>!0){this.En=requestAnimationFrame(()=>{this.En=0,t()&&[...this.host.root.querySelectorAll(".mach-row-drag-handle")].find(i=>i.closest(".mach-row")?.dataset.id===e)?.focus()})}ud(){this.le||(this.le=requestAnimationFrame(this.of))}Ms(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}sf(){let e=this.Ne;if(!e||!this.Ms(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*C((i.top+r-e.clientY)/r,0,1)):Math.ceil(14*C((e.clientY-i.bottom+r)/r,0,1));if(this.host.scrollBy)return this.host.scrollBy(o);let s=t.scrollTop;return t.scrollTop=C(s+o,0,Math.max(0,t.scrollHeight-t.clientHeight)),t.scrollTop!==s}Ki(){let e=this.Ne;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.Ms(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(${C(e.clientX-o.left+16,8,Math.max(8,o.width-224))}px, ${C(e.clientY-o.top+16,8,Math.max(8,o.height-48))}px, 0)`}cd(){let e=this.Ne;this.Ne=null,this.ji(!1),cancelAnimationFrame(this.le),this.le=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.cd(),this.release(),cancelAnimationFrame(this.En),this.En=0}};function Kn(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 Zt=class extends Jt{constructor(t,i,r,o){super({get root(){return t.n.root},get body(){return t.n.ye},get viewport(){return t.n.C.center},get containers(){return Object.values(t.n.ce)},getRowTop:i,findRowAt:r,scrollBy:o});this.e=t;this.Vt=null}pd(t){return!t.loading&&!t.treeLoading&&!t.isGroup}fd(t){if(this.e.a.isEditing()||t.isDetail||!this.pd(t)||t.data==null||this.e.r.Ze().length||this.e.t.applyRowDrag&&!this.e.i.Ka())return!1;let i=this.vi("canDrag",()=>this.e.t.rowDragPolicy?.canDrag?.({node:t,api:this.e.api})??!0,!1);return i!==!0?i:!this.e.i.M||!!Ui(this.e.api)}canDrag(t){return this.fd(t)===!0}isSource(t){return this.Is()?.isSource(t)??this.rf(t.id)}start(t,i){if(this.destroy(),!this.canDrag(i)||t.isPrimary===!1)return;let r=this.Is();if(r){r.start(t,i);return}let o=this.vi("getRevision",()=>this.As(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.Is();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.vi("getRevision",()=>this.As(i),null);if(!(!a||!l)){this.Vt={node:i,from:i.rowIndex,guard:l};try{this.commitDrop(this.destination(a,o>0))&&this.nf(i.id)}finally{this.release()}}}vi(t,i,r){try{return i()}catch(o){return this.e.reportError(o,`rowDragPolicy.${t}`),r}}As(t){let i=this.e.i,r=this.e.r.Q(),o=this.e.t.rowDragPolicy,s=i.Be(),a=i.Ni(),l=this.e.t.applyRowDrag,d=o?.getRevision?.();return{revision:d,current:()=>this.vi("getRevision",()=>o?.getRevision?.()===d&&s===i.Be()&&a===i.Ni()&&i.F(t.id)===t&&r===this.e.r.Q()&&o===this.e.t.rowDragPolicy&&l===this.e.t.applyRowDrag,!1)}}Is(){let t=Ui(this.e.api);return t!==this.hd&&(this.Sn?.destroy(),this.hd=t,this.Sn=t?this.vi("driver",()=>t({...this.host,api:this.e.api,capture:i=>this.As(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.Sn}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=C(this.host.findRowAt(t),0,this.e.i.L()-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?Kn(r.node,c=>this.e.i.h(c),t,i?"after":"before",r.guard.revision):void 0,l=s?.canDrop&&a?this.vi("canDrop",()=>s.canDrop({node:r.node,api:this.e.api,targetNode:t,intent:a}),!1):!0,d=l===!0&&this.pd(t),u=typeof l=="string"?l:be(this.e.u("rowDragPosition"),r.from+1,this.md(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.Ua(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.md(i.from,r.boundary),applied:s,intent:r.intent}),!0)}md(t,i){let r=t+1;for(;this.e.i.h(r)?.isDetail;)r++;return i>t?i-(r-t):i}destroy(){this.Sn?.destroy(),super.destroy()}};var va=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 Ee(n,e){n.style.removeProperty("--mach-row-rule-bg"),n.style.removeProperty("--mach-row-rule-fg"),e?.tone&&va.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 Qt=class{constructor(){this.ae=new Float64Array(0);this.bi=new Float64Array(1);this.ks=new WeakMap;this.Bt=new Map;this.bt=0}reset(e,t){this.ae=new Float64Array(e.length),this.bi=new Float64Array(e.length+1),this.ks=new WeakMap,this.Bt=new Map,this.bt=0;for(let i=0;i<e.length;i++){this.ks.set(e[i],i);let r=Math.max(1,t(e[i],i));this.ae[i]=r,this.Ps(r,1),this.add(i,r)}}get length(){return this.ae.length}indexOf(e){return this.ks.get(e)??-1}update(e,t){if(e<0||e>=this.ae.length)return!1;let i=Math.max(1,t),r=i-this.ae[e];return Math.abs(r)<.01?!1:(this.Ps(this.ae[e],-1),this.ae[e]=i,this.Ps(i,1),this.add(e,r),!0)}qe(e){let t=Math.max(0,Math.min(Math.trunc(e),this.ae.length)),i=0;for(;t>0;)i+=this.bi[t],t-=t&-t;return i}Gs(){return this.qe(this.ae.length)}af(){return this.bt}findIndex(e){if(this.ae.length===0)return 0;let t=Math.max(0,e),i=0,r=0,o=1;for(;o<<1<=this.ae.length;)o<<=1;for(;o>0;){let s=i+o;s<=this.ae.length&&r+this.bi[s]<=t&&(i=s,r+=this.bi[s]),o>>=1}return Math.min(i,this.ae.length-1)}add(e,t){for(let i=e+1;i<this.bi.length;i+=i&-i)this.bi[i]+=t}Ps(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.bt=0;else if(t>0&&(this.bt===0||e<this.bt))this.bt=e;else if(t<0&&e===this.bt&&!this.Bt.has(e)){let r=Number.POSITIVE_INFINITY;for(let o of this.Bt.keys())r=Math.min(r,o);this.bt=Number.isFinite(r)?r:0}}};var ba=16e6,ei=class{constructor(){this.height=0;this._t=0;this.wi=0;this.Mn=NaN;this.Ls=0}configure(e,t,i=!0){this.height=i?Math.min(e,ba):e,this._t=Math.max(0,e-t),this.wi=Math.max(0,this.height-t),this.Mn=NaN}get wt(){return this._t>this.wi}lf(e){return this._t?C(e,0,this._t)*this.wi/this._t:0}read(e){return e!==this.Mn&&(this.Mn=e,this.Ls=this.wi>0?C(e,0,this.wi)*this._t/this.wi:0),this.Ls}anchor(e,t){this.Ls=C(e,0,this._t),this.Mn=t}};function Un(n){return!!n&&!n.hasCheckbox&&!n.isDetailToggle&&!n.colDef.rowDrag}function wa(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 Ca(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 ti=class{constructor(e){this.e=e;this.m=[];this.Ct=0;this.Xe=-1;this.re=0;this.Ns=0;this.Fs=0;this.gd=0;this.E=new ei;this.Tt=0;this.Os=!1;this.In=-1;this.j=new Qt;this.A=new Re;this.pe=new Xt;this.An=!1;this.Pn=[];this.yt=0;this.Ht=0;this.Hs=!1;this.v=null;this.Vs=()=>{this.re||(this.re=requestAnimationFrame(()=>{this.re=0,this.bn()}))};this.On=0;this.Hn=new WeakMap;this.Wt=new Set;this.Vn="";this.Dt=!1;this.cr=[];this.Re=null;this.Cd="";this._s="";this.Td=0;this.Dd=0;this.Bs=e=>{if(e.defaultPrevented||e.ctrlKey||e.metaKey||e.shiftKey||!e.deltaY||!e.cancelable)return;let t=this.e.n.C.center,i=e.deltaMode===1?this.e.t.rowHeight:e.deltaMode===2?t.clientHeight:1,r=this.E.read(t.scrollTop);this.Bn(r+e.deltaY*i),this.E.read(t.scrollTop)!==r&&(e.preventDefault(),t.scrollLeft+=e.deltaX*i,this.Vs())};this.Nn=null;this.fr=null;this.js=!1;this.am=e=>{let t=this.fr;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.lm=e=>{let t=this.fr;if(!t)return;let i=e;if(!t.active){this.Ln();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.Ln(),s>o?(this.dm(t,s,r),this.Ci()):this.jd(r,o,!1)};this.uf=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.Xr())){if(this.e.a.Xr()){let r=i.cellEl?.dataset.colId??"";if(this.e.a.isEditing(i.index,r))return;let o=r?this.e.r.R(r):void 0;this.e.a.cl(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.R(r):void 0;a&&!this.e.a.Xr()&&this.e.a.start(i.node.rowIndex,a)});return}this.Xd(e,t,i)}};this.cf=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.R(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.ne(i,a)&&this.e.a.start(r,a)};this.hf=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.R(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.Z(s);l>=0&&this.Us(r,l,!1)}this.e.qs.open(e.clientX,e.clientY,{rowIndex:r,colId:s})}};this.pf=e=>{if(!this.bm(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.Z(t.cellEl.dataset.colId??"");i>=0&&(this.Us(t.index,i,e.shiftKey),this.An=!0,!e.shiftKey&&!this.e.t.suppressCellFocus&&this.Ae(t.index,t.cellEl.dataset.colId??""))}}};this.vd=()=>{this.An=!1};this.an=e=>{if(this.e.o())return;let t=this.Ut(e);if(this.An&&t&&!t.node.isDetail&&!t.node.isGroup&&t.cellEl){let i=this.e.r.Z(t.cellEl.dataset.colId??""),r=this.pe.Ss();i>=0&&r&&(r.row!==t.index||r.colIdx!==i)&&this.Us(t.index,i,!0)}this.e.t.suppressRowHoverHighlight||!t||t.node.isDetail||this.qd(t.index)};this.ff=()=>{this.qd(-1)};this.mf=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.gf=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 Zt(e,t=>this.Fe(t)-this.Tt,t=>this.Gn(t+this.Tt,this.e.i.L()),t=>this.df(t))}init(){let e=this.e.n.C.center;this.Ns=e.scrollLeft,this.Fs=e.scrollTop,e.addEventListener("scroll",this.Vs,{passive:!0}),this.yd(!0),window.addEventListener("mouseup",this.vd)}yd(e){S(this.e.n.ye,e,{click:this.uf,dblclick:this.cf,contextmenu:this.hf,mousedown:this.pf,mouseover:this.an,mouseleave:this.ff,pointerdown:this.mf,keydown:this.gf})}suspend(){cancelAnimationFrame(this.re),this.re=0,this.Ln(),this.zt.destroy(),this.An=!1}destroy(){cancelAnimationFrame(this.re);let e=this.e.n.C.center;e.removeEventListener("scroll",this.Vs),e.removeEventListener("wheel",this.Bs),this.yd(!1),window.removeEventListener("mouseup",this.vd),this.Ln(),this.zt.destroy(),this.bd(!1),this.Nn?.remove(),this.cr=[],this.Wt.clear(),this.j.reset([],()=>this.e.t.rowHeight),this.A.update([]),this.Re?.remove(),this.Re=null}yf(e){return this.e.r.ge(e)}bn(e=!1){if(this.e.o())return;let t=this.e.n,i=t.C.center,r=i.scrollLeft,o=i.scrollTop,s=this.E.read(o),a=e||r!==this.Ns,l=e||o!==this.Fs||s!==this.gd;!a&&!l||(this.Ns=r,this.Fs=o,this.gd=s,a&&(t.ai.center.style.transform=`translate3d(${-r}px, 0, 0)`,this.e.W.ld(),this.e.Le.vf(r)),l&&this.wd(o),this.e.Fn.hide(),this.dr(!1,a),l&&this.e.i.Nu(this.Xe-1))}bf(){let e={left:0,center:0,right:0};for(let t of w)e[t]=this.e.r.y(t).reduce((i,r)=>i+r.currentWidth,0);return e}wn(){let e=this.e.n,t=this.bf();this.A.update(this.e.r.y("center")),t.center=this.A.Cs();let i=this.e.i.kt(),r=this.wf(i.length);this.Cf(i,r);let o=this.Tf(r);this.Df(o),this.xf(t,o),e.root.setAttribute("aria-rowcount",String(r.rowCount+e.ql()))}wf(e){let t=this.e.i.Li(),i=this.e.t.rowHeight,r=this.e.t.masterDetail?[]:this.Rf();r.length&&this.Ef();let o=this.e.t.datasourceMode!=="block"&&(this.e.t.masterDetail||this.e.t.getRowHeight!=null||r.length>0),s=o?this.Sf(i,r):`fixed|${i}`;return{autoHeightColumns:r,positionedCount:Math.min(t,e),rowCount:t,rowHeight:i,signature:s,variable:o}}Sf(e,t){let i=t.map(r=>`${r.id}:${r.currentWidth}`).join(",");return`${this.e.i.Ni()}|${e}|${this.e.t.detailRowHeight}|${i}`}Cf(e,t){if(!t.variable){this.Mf(t);return}if(t.signature!==this.Vn||this.j.length!==t.positionedCount){t.autoHeightColumns.some(rt)&&this.st();let i=e.slice(0,t.positionedCount);this.j.reset(i,r=>this.xd(r,t.autoHeightColumns)),this.Rd(t);return}if(this.Wt.size!==0){for(let i of this.Wt){let r=this.j.indexOf(i);r>=0&&this.j.update(r,this.xd(i,t.autoHeightColumns))}this.Rd(t)}}Mf(e){this.j.length>0&&this.j.reset([],()=>e.rowHeight),this.Vn=e.signature,this.Wt.clear(),this.On=e.rowHeight}Rd(e){this.Vn=e.signature,this.Wt.clear(),this.On=this.j.af()||e.rowHeight}Tf(e){return(e.variable?this.j.Gs():e.positionedCount*e.rowHeight)+Math.max(0,e.rowCount-e.positionedCount)*e.rowHeight}xf(e,t){let i=this.e.n,r=i.C.center,o=this.E.read(r.scrollTop),s=this.E.wt;this.E.configure(t,r.clientHeight,!this.Dt);let a=Math.max(e.center,r.clientWidth);for(let l of w){let d=i.ce[l];d.style.height=`${this.E.height}px`,d.style.overflow=this.E.wt?"hidden":"",l==="center"&&(d.style.width=`${a}px`)}(s||this.E.wt)&&this.Bn(o),this.wd(r.scrollTop),this.Os!==this.E.wt&&(this.Os=this.E.wt,this.Os?r.addEventListener("wheel",this.Bs,{passive:!1}):r.removeEventListener("wheel",this.Bs))}Bn(e){let t=this.e.n.C.center;t.scrollTop=this.E.lf(e),this.E.anchor(e,t.scrollTop)}wd(e){let t=this.E.wt;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)`}}df(e){let t=this.e.n.C.center,i=this.E.read(t.scrollTop);this.Bn(i+e);let r=this.E.read(t.scrollTop)!==i;return r&&this.bn(),r}Wr(e){this.Hn.delete(e),this.Wt.add(e)}Df(e){let{ye:t,C: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.A.Cs()}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.Dt=a&&u===e+c,d.style.overflowY=a&&!this.Dt?"auto":"",this.Dt&&d.scrollTop&&(d.scrollTop=0)}st(){this.Hn=new WeakMap,this.Wt.clear(),this.Vn=""}xd(e,t){if(e.isDetail)return this.e.t.detailRowHeight;let i=this.Hn.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.If(e,t))),this.Hn.set(e,r),r}Fe(e){let t=this.j.length;return t===0?Math.max(0,e)*this.e.t.rowHeight:e<=t?this.j.qe(e):this.j.Gs()+(e-t)*this.e.t.rowHeight}Gn(e,t){if(t<=0)return 0;let i=this.j.length,r=this.j.Gs();if(i>0&&e<r)return this.j.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))}Rf(){return this.e.r.l().filter(e=>e.colDef.autoHeight===!0)}get Af(){return this.e.r.l().some(e=>e.colDef.autoHeight===!0)}Ef(){this.Re||(this.Re=f("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.je.oa].join("|");i!==this.Cd&&(this.Cd=i,this.st(),this._s=parseFloat(e.letterSpacing)||parseFloat(e.wordSpacing)?"":t,this.Td=parseFloat(e.paddingLeft)+parseFloat(e.paddingRight)+parseFloat(e.borderLeftWidth)+parseFloat(e.borderRightWidth),this.Re.style.width="10000px",this.Re.textContent="M",this.Dd=Math.ceil(this.Re.getBoundingClientRect().height))}If(e,t){let i=this.Re,r=0;for(let o of t){let s=fe(this.e,e,o);if(!s)continue;let a=this.Dd;if(!this._s||this.e.je.eo(s,this._s)>o.currentWidth-this.Td){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}Pl(e,t){if(this.e.t.flashCells)for(let i of e)for(let r of t)this.cr.push([i,r])}Ed(){if(this.cr.length===0)return;let e=this.cr;this.cr=[];for(let[t,i]of e){let r=this.si(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.wn();let e=this.e.n.C.center,i=this.e.t.rowHeight;this.e.t.masterDetail&&(i=Math.min(i,this.e.t.detailRowHeight)),this.On>0&&(i=Math.min(i,this.On));let r=Math.ceil(e.clientHeight/Math.max(1,i)),o=this.Dt?this.e.i.L():r+this.e.t.rowBuffer*2+1,s=o%2===0?o:o+1;this.Sd(),s>this.m.length&&this.Md(s),this._n(),this.dr(!0,!1),this.zs()}Md(e){for(;this.m.length<e;){let t={index:-1,nodeId:"",kind:"master",rows:{},cells:{}},i=this.e.n;for(let r of w){if(this.e.r.y(r).length===0)continue;let s=f("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.Id(a)))}if(this.e.t.masterDetail){let r=f("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.Pn:this.e.r.y(e)}Id(e){let t=f("div","mach-cell");if(t.dataset.colId=e.id,t.setAttribute("role","gridcell"),e.hasCheckbox){let i=f("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}kf(e){let t=new Map(this.Pn.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.Bo(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.Id(l):s[u];return c!==a&&o.insertBefore(c,a),a=c.nextElementSibling,c})}}Ad(){this.hr=void 0,this.kd(),this.bd(!0),this.Ct=0,this.Xe=-1}bd(e){this.Pd(0,e),this.kn=void 0,this.Pn=[]}Pd(e,t){for(let i=e;i<this.m.length;i++){let r=this.m[i];r.detailRow&&this.Ws(r.detailRow);for(let o of w){for(let s of r.cells[o]??[])!t&&r.index>=0&&this.e.a.Bo(r.index,s.dataset.colId??"",s),L(this.e,s);t&&r.rows[o]?.remove()}t&&r.detailRow?.remove()}this.m.length=e}_n(){let e=this.Pf();for(let t of w){let i=this.e.r.y(t),r=this.$t(t),o=this.Gf(t,r,i);this.Lf(t,r,o,e)}this.Nf()}Pf(){return this.e.t.masterDetail||this.e.t.getRowHeight!=null||this.Af}Gf(e,t,i){if(e==="center"){this.A.update(i);let s=this.e.r.y("left").length;return t.map(a=>this.A.qe(this.e.r.Z(a.id)-s))}let r=0,o=[];for(let s of t)o.push(r),r+=s.currentWidth;return o}Lf(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];s[d].style.width=`${u.currentWidth}px`,s[d].style.left=`${i[d]}px`,s[d].setAttribute("aria-colindex",String(this.e.r.Z(u.id)+1))}}}Nf(){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)}Sd(){let e=this.e.n.C.center,t=this.e.r.y("center");this.A.update(t);let{first:i,lastExcl:r}=t.length>20?this.A.sd(e.scrollLeft,e.clientWidth,2):{first:0,lastExcl:t.length};if(t===this.kn&&i===this.yt&&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.kf(s),this.kn=t,this.Pn=s,this.yt=i,this.Ht=r,this.Hs=s.some(a=>a.colDef.colSpan!=null),!0}yo(){return{first:this.Ct,lastExcl:this.Xe}}dr(e=!1,t=!0){let i=this.e.Ce.start(),r=this.Ff(e,t);if(this.e.a.ml(),!r)return;let o=Math.max(0,this.Xe-this.Ct);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.Pd(a,!0)}this.Ci();let s=this.e.r.y("left").length+this.$t("center").length+this.e.r.y("right").length;this.e.Ce.xh(i,o,s)}Ff(e,t){let i=this.e.n.C.center,r=this.E.read(i.scrollTop)-i.scrollTop,o=r!==this.Tt;this.Tt=r;let s=this.e.i.L(),a=this.e.t.rowBuffer,l=t&&this.Sd();if(l&&this._n(),s===0){for(let c of this.m)this.Gd(c);return this.Ct=0,this.Xe=0,!0}let{first:d,lastExcl:u}=this.Of(i,s,a);return!e&&!l&&d===this.Ct&&u===this.Xe?(o&&this.Ld(),l||o):(this.Hf(d,u),this.Ct=d,this.Xe=u,this.Vf(d,u,e,l),l&&this.pr(),o&&this.Ld(),!0)}Of(e,t,i){if(this.Dt)return{first:0,lastExcl:t};let r=this.E.read(e.scrollTop),o=this.Gn(r,t),s=r+e.clientHeight,a=Math.min(t,this.Gn(s,t)+1);return{first:C(o-i,0,t-1),lastExcl:C(a+i,1,t)}}Hf(e,t){if(!(this.Dt&&this.Ct===0&&t>=this.Xe))for(let i of this.m)i.index!==-1&&(i.index<e||i.index>=t)&&this.Gd(i)}Vf(e,t,i,r){let o=t-e;o>this.m.length&&(this.Md(o+o%2),this._n());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.zn(l,a,"center");continue}this.Bf(l,s,a)}}}Gd(e){if(this.Nd(e),this.Dt&&e.index>=0)for(let t of w)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 w){let i=e.rows[t];i&&(i.style.display="none",delete i.dataset.id,delete i.dataset.index,Ee(i,void 0),i.classList.remove("mach-row--drag-source"))}e.detailRow&&(this.Ws(e.detailRow),e.detailRow.style.display="none")}Bf(e,t,i){e.index>=0&&e.index!==t&&this.Nd(e),e.index=t,e.nodeId=i.id;let r=this.Fe(t),o=r-this.Tt,s=this.Fe(t+1)-r;if(i.isDetail){this._f(e,i,t,o,s);return}this.zf(e,i,t,o,s)}Ld(){for(let e of this.m){if(e.index<this.Ct||e.index>=this.Xe)continue;let t=`translateY(${this.Fe(e.index)-this.Tt}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 w){let l=e.rows[a];l&&(l.style.display="none")}let s=e.detailRow;s&&(this.Fd(s,i,r,o),this.$s(s,t))}zf(e,t,i,r,o){e.kind="master",e.detailRow&&(e.detailRow.style.display="none");let s=this.Wf(t),a=We(this.e,t);for(let l of w){let d=e.rows[l];d&&(this.$f(d,t,i,r,o,s),Ee(d,a),this.zn(e,t,l))}this.v&&this.v.rowIndex===i&&this.pr()}Wf(e){let t=this.e.i.M,i=e.isGroup===!0,r=t&&this.e.i.wo(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.zr(e)+1),{expanded:s,expandable:o,level:a}}$f(e,t,i,r,o,s){this.Fd(e,i,r,o,t.id),this.Od(e,t);let a=this.In===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.Kf(e,s)}Fd(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.ql()+1))}Od(e,t){e.classList.toggle("mach-row--selected",t.selected),e.setAttribute("aria-selected",t.selected?"true":"false")}Kf(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")}zn(e,t,i){let r=this.$t(i),o=e.cells[i];if(!o)return;let s=e.index,a=this.e.r,l=i==="center"&&this.Hs,d=l?a.y("left").length:0,u=0;e.rows[i]?.classList.toggle("mach-row--editing",this.e.a.ul(s));for(let c=0;c<r.length;c++){let h=r[c],p=o[c];if(l){let m=a.Z(h.id)-d,g=m<u?0:this.Uf(t,h,s,this.kn.length-m);if(g>0&&(u=m+g),g===0||u<=this.yt){L(this.e,p),p.setAttribute("aria-hidden","true"),p.style.display="none";continue}(g>1||p.hasAttribute("aria-colspan"))&&this.jf(p,m,g)}p.style.display==="none"&&(p.style.display=""),p.removeAttribute("aria-hidden"),!this.e.a.gl(s,t,h,p)&&(this.Hd(p,t,h),this.Ks(p,s,h))}}Uf(e,t,i,r){let o=t.colDef.colSpan;if(!o)return 1;try{let s=o(pe(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){let r=`${this.A.qe(t+i)-this.A.qe(t)}px`;e.style.width!==r&&(e.style.width=r),i>1?e.setAttribute("aria-colspan",String(i)):e.removeAttribute("aria-colspan")}$s(e,t){this.Ws(e);let i=t.masterId!=null?this.e.i.F(t.masterId):t,r=f("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),qe(e,a.destroy))}}Ws(e){let t=Ye(e);if(t)try{t()}catch(i){this.e.reportError(i,"detailRowRenderer.destroy")}e.textContent=""}Hd(e,t,i){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 o=f("span","mach-cell-loading-bar");o.style.width=`${34+(i.id.length*13+t.rowIndex*7)%44}%`,e.replaceChildren(o),this.Kt(e);return}e.removeAttribute("aria-busy"),e.setAttribute("aria-readonly",this.e.a.ne(t,i)?"false":"true"),e.removeAttribute("aria-expanded"),e.removeAttribute("aria-level");let r=this.qf(t,i);if(r!=="standard"){L(this.e,e),this.Yf(r,e,t,i);return}Je(this.e,e,t,i),this.Vd(e,t,i),this.Xf(e,t,i)}qf(e,t){return e.isGroup?"group":t.isDetailToggle?"detail":t.hasCheckbox?"checkbox":t.colDef.rowDrag?"drag":ye(t.colDef,"index")?"index":this.e.i.M&&this.Bd()?.id===t.id?"tree":"standard"}Yf(e,t,i,r){if(e==="group")this.Jf(t,i,r);else if(e==="detail"){let o=this.e.i.isRowExpanded(i.id),s=f("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.Zf(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.$a(i)+this.e.t.indexOffset);let o=`mach-cell mach-cell--index ${Xe(r)}`;t.className!==o&&(t.className=o),this.Vd(t,i,r)}else this.Qf(t,i,r)}Xf(e,t,i){if(this.e.t.editType!=="cell"||this.e.t.editableIndicator==="none"||!this.e.a.ne(t,i))return;let r=f("button",`mach-cell-edit-trigger mach-cell-edit-trigger--${this.e.t.editableIndicator}`);r.type="button",r.tabIndex=-1,r.title="Edit cell",r.setAttribute("aria-label","Edit cell"),r.innerHTML='<svg viewBox="0 0 16 16" aria-hidden="true" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><path d="m10.8 2.7 2.5 2.5L5.5 13H3v-2.5z"/><path d="m9.5 4 2.5 2.5"/></svg>',r.addEventListener("mousedown",o=>{o.preventDefault(),o.stopPropagation()}),r.addEventListener("click",o=>{o.preventDefault(),o.stopPropagation(),this.Ae(t.rowIndex,i.id),this.e.a.start(t.rowIndex,i)}),e.appendChild(r)}Nd(e){if(!(e.index<0))for(let t of w)for(let i of e.cells[t]??[])this.e.a.Bo(e.index,i.dataset.colId??"",i)}Bd(){return this.hr!==void 0?this.hr:(this.hr=this.e.r.l().find(e=>!e.hasCheckbox&&!e.isDetailToggle&&!e.colDef.rowDrag&&!ye(e.colDef,"index"))??null,this.hr)}Qf(e,t,i){let r=this.e.i.isRowExpandable(t),o=this.e.i.zr(t),s=Y(this.e,t,i,this.e.d(t,i)),a=f("span","mach-tree-indent");a.style.width=`${o*16}px`;let l=f("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=f("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 p=f("span",`mach-detail-toggle${u?" mach-detail-toggle--open":""}${c}`);p.setAttribute("aria-hidden","true"),p.textContent="\u25B6",h.appendChild(p),h.addEventListener("keydown",m=>{(m.key==="Enter"||m.key===" ")&&m.stopPropagation()}),l.appendChild(h)}else{let u=f("span","mach-tree-toggle-spacer");l.appendChild(u)}let d=f("span","mach-tree-text");d.textContent=s,l.appendChild(d),e.replaceChildren(l),s&&!this.e.t.tooltipComponent?e.title=s:e.removeAttribute("title"),bi(this.e,e,t,i)}Kt(e){e.style.height!==""&&(e.style.height=""),e.style.display==="none"&&(e.style.display=""),e.removeAttribute("aria-rowspan")}Vd(e,t,i){let r=this.e.i.ac(i.id);if(!r||t.isDetail){this.Kt(e);return}let o=this.e.i.$a(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.L()),l=this.Fe(a)-this.Fe(o);e.style.height=`${l>0?l:s*this.e.t.rowHeight}px`,e.setAttribute("aria-rowspan",String(s))}else this.Kt(e)}Jf(e,t,i){if(i.hasCheckbox){this._d(e,t);return}if(i.isDetailToggle){this.zd(e);return}let r=this.e.r.da();if(r&&i.id===r.id){this.em(e,t);return}this.tm(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.Xa(t):null;i.checked=o?.all??t.selected,i.indeterminate=o?o.some&&!o.all:r.gc(t.id),i.disabled=!r.We(t)}e.className!=="mach-cell mach-cell--selection"&&(e.className="mach-cell mach-cell--selection")}em(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=f("span","mach-group-label");o.style.paddingLeft=`${r*16}px`;let s=f("span",`mach-detail-toggle${i?" mach-detail-toggle--open":""}`);s.textContent="\u25B6";let a=f("span","mach-group-text"),l=this.e.r.Ze()[r],d=l?.colDef.headerName?`${l.colDef.headerName}: `:"";a.textContent=`${d}${t.groupKey??""}`;let u=f("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")}tm(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):vi(r);let o=`mach-cell ${Xe(i)}`;return e.className!==o&&(e.className=o),!0}zd(e){e.textContent="",e.className!=="mach-cell"&&(e.className="mach-cell")}I(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.$s(r.detailRow,o);continue}for(let s of w){let a=r.rows[s];a&&this.Od(a,o),r.cells[s]&&this.zn(r,o,s)}}}this.pr(),this.Ed()}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.im(o,s,t,i)||this.rm(o,s,r,e.force===!0)}this.pr(),this.Ed()}im(e,t,i,r){return e.index<0?!1:i==null&&r==null?!0:i?.has(t.id)===!0||r?.has(e.index)===!0}rm(e,t,i,r){if(e.kind==="detail"){i==null&&e.detailRow&&this.$s(e.detailRow,t);return}let o=i==null||this.Hs,s=We(this.e,t);for(let a of w){let l=e.rows[a];l&&Ee(l,s),o?this.zn(e,t,a):this.nm(e,t,a,i,r)}}nm(e,t,i,r,o){let s=this.$t(i),a=e.cells[i];if(a)for(let l=0;l<s.length;l++){let d=s[l];if(!r.has(d.id))continue;let u=a[l];u&&(this.e.a.gl(e.index,t,d,u)||(o&&L(this.e,u),this.Hd(u,t,d),this.Ks(u,e.index,d)))}}om(){this.e.o()||(this.v&&this.v.rowIndex>=this.e.i.L()&&this.Ae(null,null),this.kd(),this.wn(),this.dr(!0),this.zs(),this.e.Ge.refresh())}zs(){let e=this.e.t,t=e.loading?"loading":e.error!=null?"error":this.e.i.L()===0&&!e.suppressNoRowsOverlay?"noRows":null;Ut(this.e,t)}si(e,t){let i=this.e.r.R(t);if(!i)return null;let r=this.yf(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}kd(){this.pe.Jt()}De(){let e=this.e.i.L(),t=this.e.r.l().length;return this.pe.normalize(e,t)}li(){let e=this.De();if(e)return e;let t=this.v;if(t){let i=this.e.r.Z(t.colId);if(i>=0)return{r1:t.rowIndex,c1:i,r2:t.rowIndex,c2:i}}return null}or(){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??""}}Ho(){let e=this.pe.Qp();if(e)return{row:e.row,colIdx:e.colIdx};let t=this.li();return t?{row:t.r1,colIdx:t.c1}:null}di(){let e=this.De();this.pe.clear(),e&&(this.Wn(),this.Ci(),this.e.emit("rangeSelectionChanged",{range:null}))}Wn(){for(let e of this.m)if(!(e.index<0||e.kind!=="master"))for(let t of w){let i=this.$t(t);e.cells[t]?.forEach((r,o)=>{let s=i[o];s&&this.Ks(r,e.index,s)})}}Us(e,t,i){this.pe.start({row:e,colIdx:t},i),this.Wn(),this.Ci(),this.e.emit("rangeSelectionChanged",{range:this.or()})}zc(e,t){if(!this.pe.ef()){let a=this.v;if(!a)return;let l=this.e.r.Z(a.colId);if(!this.pe.tf({row:a.rowIndex,colIdx:l}))return}let i=this.e.i.L(),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.Wn(),this.Ci();let o=this.e.r.l(),s=this.pe.Ss();s&&s.colIdx<o.length&&this.Ae(s.row,o[s.colIdx].id),this.e.emit("rangeSelectionChanged",{range:this.or()})}Ks(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.Z(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")}sm(){if(this.Nn)return this.Nn;let e=f("div","mach-fill-handle");return e.style.display="none",e.addEventListener("pointerdown",t=>{this.js=!0,this.Wd(t)}),e.addEventListener("mousedown",t=>{this.js||this.Wd(t)}),this.e.n.ce.center.appendChild(e),this.Nn=e,e}Ci(){let e=this.sm(),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.y("left").length,o=i.y("center");if(t.c2<r||t.c2>=r+o.length){e.style.display="none";return}let s=t.c2-r;this.A.update(o);let a=this.A.qe(s+1),l=this.Fe(Math.min(t.r2+1,this.e.i.L()))-this.Tt,d=this.e.n.C.center;if(this.E.wt&&(l<d.scrollTop||l>d.scrollTop+d.clientHeight)){e.style.display="none";return}e.style.display="",e.style.left=`${this.E.wt?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`}Wd(e){if(this.e.o()||e.button!==0)return;let t=this.De();t&&(e.preventDefault(),e.stopPropagation(),this.fr={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.Tt,o=this.e.i.L(),s=this.Gn(r,o);return Math.max(this.fr.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.y("left").length,a=o.y("center");this.A.update(a);let l=this.A.Fp(r);if(l<0)return s;let d=this.A.qe(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.am);for(let i of["pointerup","mouseup","pointercancel"])window[t](i,this.lm)}Ln(){this.fr=null,this.js=!1,this.$d(!1),this.e.n.root.classList.remove("mach-root--filling")}jd(e,t,i){let r=this.pe.Ss();!r||t===(e?r.colIdx:r.row)||(this.pe.setEnd(e?{row:r.row,colIdx:t}:{row:t,colIdx:r.colIdx}),this.Wn(),i&&(e&&this.Ci(),this.e.emit("rangeSelectionChanged",{range:this.or()})))}dm({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 p=s?this.e.i.h(h):void 0,m=s?void 0:a[h];(s?!p||p.isDetail||p.isGroup:!Un(m))||this.um(a,d,u,o,l,p,m)}this.e.fi(l),this.e.emit("rangeSelectionChanged",{range:this.or()})}um(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=wa(l);for(let u=i+1;u<=r;u++){let c=s??this.e.i.h(u),h=a??e[u];if(!c||!Un(h)||!this.e.a.ne(c,h))continue;let p=Ca(d,u-t),m=this.e.d(c,h);o.push({node:c,column:h,oldValue:m,newValue:p})}}Ae(e,t){if(this.cm(),e==null||t==null){this.v=null;return}this.v={rowIndex:e,colId:t},this.pr(),this.hm()}pr(){if(!this.v)return;let e=this.si(this.v.rowIndex,this.v.colId);if(e&&e.style.display!=="none"){let t=Math.max(0,this.e.r.Z(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")}cm(){if(this.v){let e=this.si(this.v.rowIndex,this.v.colId);e&&(e.classList.remove("mach-cell--focus"),e.removeAttribute("id"))}this.e.n.root.removeAttribute("aria-activedescendant")}hm(){if(!this.v)return;this.$r(this.v.rowIndex,"nearest");let e=this.e.r.R(this.v.colId);!e||e.pinned||this.A.Dn(this.e.n.C.center,this.e.r.y("center"),e)}$r(e,t="top"){let i=this.e.n.C.center,r=this.e.i.L();if(r===0)return;let o=C(e,0,r-1),s=i.clientHeight,a=this.E.read(i.scrollTop),l=this.Fe(o),d=this.Fe(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.Fe(r)-s);this.Bn(C(u,0,c)),this.bn()}qd(e){if(this.In===e)return;let t=this.In;this.In=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 w)i.rows[r]?.classList.toggle("mach-row--hover",t)}mr(){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.pm(t,r,s)||this.fm(t,r,s))return;let a=s?.dataset.colId??"",l=a?this.e.r.R(a):void 0;this.mm(r,l)||r.isDetail||this.gm(t,r,o,e)||!s||!l||(this.mr(),this.e.t.suppressCellFocus||this.Ae(o,a),this.e.f.Za(r,e,!1),this.ym(e,r,o,l),this.vm(r,o,l))}pm(e,t,i){if(!t.isGroup)return!1;if(this.mr(),e.closest(".mach-row-checkbox")){let o=this.e.f.Xa(t).all;return this.e.f.vc(t,!o),!0}let r=this.e.r.da();return(!r||!i||i.dataset.colId===r.id)&&this.e.i.Ro(t.id),!0}mm(e,t){return!t?.isDetailToggle||e.isDetail?!1:(this.mr(),this.e.Kr(e.id),!0)}gm(e,t,i,r){let o=e.closest(".mach-cell--selection");return o?(this.mr(),this.e.t.suppressCellFocus||this.Ae(i,o.dataset.colId??""),this.di(),this.e.f.Za(t,r,!0),!0):!1}ym(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})}vm(e,t,i){(this.e.t.singleClickEdit||i.colDef.singleClickEdit===!0)&&this.e.a.ne(e,i)&&this.e.a.start(t,i)}fm(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.mr(),t.treeLoadError?this.e.i.loadTreeChildren(t.id,!0).catch(()=>{}):this.e.i.Kr(t.id),!0)}bm(e){return!!(e.target.closest(".mach-cell-editor-shell, .mach-row-editor-shell, .mach-tree-toggle, .mach-row-drag-handle")||this.e.a.Xr())}Zf(e,t){let i=e.querySelector("button.mach-row-drag-handle"),r=i?.value===t.id?i:f("button","mach-row-drag-handle");r.type="button",r.value=t.id;let o=this.zt.fd(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 ii=class{constructor(e){this.e=e;this.Oe=null;this.Jd={left:void 0,center:void 0,right:void 0};this.Ys={left:[],center:[],right:[]}}init(){this.Oe=f("div","mach-footer"),this.Oe.style.display="none",this.Oe.setAttribute("role","row"),this.e.n.root.appendChild(this.Oe);for(let e of w){let t=f("div",`mach-footer-row mach-footer-row--${e}`);t.style.height=`${this.e.t.rowHeight}px`,this.Oe.appendChild(t),this.Jd[e]=t}}setVisible(e){this.Oe&&(this.Oe.style.display=e?"":"none")}refresh(){if(!this.Oe||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.kt().filter(r=>!r.isDetail&&!r.isGroup);for(let r of w){let o=this.e.r.y(r),s=this.Jd[r];this.Ys[r].length!==o.length&&(s.textContent="",this.Ys[r]=o.map(()=>{let l=f("div","mach-footer-cell");return l.setAttribute("role","cell"),s.appendChild(l),l}));let a=0;o.forEach((l,d)=>{let u=this.Ys[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.Oe?.remove(),this.Oe=null}};var ri=class{constructor(e){this.e=e;this.T=null;this.$n=null;this.Xs=null;this.Ti=null;this.jt=null;this.Kn=null;this.Un=null;this.jn=null;this.qn=null;this.qt=[]}init(){this.T=f("div","mach-pagination"),this.T.style.display="none",this.T.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.$n=f("span","mach-pagination-total"),this.Kn=e("mach-pagination-first",this.e.u("pageFirst"),"\xAB",()=>this.e.i.setPage(1)),this.Un=e("mach-pagination-prev",this.e.u("pagePrev"),"\u2039",()=>this.e.i.setPage(this.e.i.ei()-1)),this.Xs=f("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.qn=e("mach-pagination-last",this.e.u("pageLast"),"\xBB",()=>this.e.i.setPage(this.e.i.getPageCount())),this.T.append(this.$n,this.Kn,this.Un,this.Xs,this.jn,this.qn),this.e.t.paginationShowSizeSelector&&(this.jt=oe({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.Ti=this.jt.native,this.Zd(),this.T.appendChild(this.jt.el)),this.e.n.root.appendChild(this.T),this.qt.push(this.e.ue.on("modelUpdated",()=>this.refresh()),this.e.ue.on("paginationChanged",()=>this.refresh())),this.refresh()}Zd(){if(!this.Ti)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.T&&(this.Ti&&this.e.t.paginationShowSizeSelector&&this.Zd(),this.refresh())}Qd(e,t){e&&e.textContent!==t&&(e.textContent=t)}wm(e,t){let i=e<=1,r=e>=t;this.Kn&&(this.Kn.disabled=i),this.Un&&(this.Un.disabled=i),this.jn&&(this.jn.disabled=r),this.qn&&(this.qn.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.ei(),s=e.getPageCount();this.$n&&this.e.t.paginationShowTotal&&this.Qd(this.$n,W(this.e.u("paginationTotal"),i)),this.Qd(this.Xs,be(this.e.u("paginationPage"),o,s)),this.wm(o,s),this.Ti&&Number(this.Ti.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.Ti=null,this.T?.remove(),this.T=null}};var ni=class{constructor(e){this.e=e;this.top=null;this.bottom=null}init(){this.top=this.eu(this.e.n.pn),this.bottom=this.eu(this.e.n.fn)}eu(e){let t={root:e,segments:{left:f("div"),center:f("div"),right:f("div")},centerViewport:f("div","mach-pinned-viewport"),rowWrappers:{left:[],center:[],right:[]},cells:[],data:[]};for(let i of w)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.Js(i,e),this.vt(),this.e.Ie())}getRows(e){return this[e]?.data.slice()??[]}xe(){!this.top||!this.bottom||(this.Js(this.top,"top"),this.Js(this.bottom,"bottom"))}Js(e,t){this.gi(e);for(let o of w){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 w){let c=f("div","mach-pinned-row");Ee(c,d),c.style.height=`${i}px`,c.setAttribute("role","row"),l[u]=[];for(let h of r.y(u)){let p=f("div","mach-cell");if(p.dataset.colId=h.id,p.setAttribute("role","gridcell"),h.hasCheckbox&&p.classList.add("mach-cell--selection"),!h.hasCheckbox&&!h.isDetailToggle&&!h.colDef.rowDrag&&h.colDef.type!=="index")try{Je(this.e,p,a,h)}catch(m){this.e.reportError(m,"pinnedRow.render",{colId:h.id,side:t,rowIndex:s})}c.appendChild(p),l[u].push(p)}e.segments[u].appendChild(c),e.rowWrappers[u].push(c)}e.cells.push(l)})}vt(){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 w){let o=0;for(let s of e.y(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 w){let d=e.y(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}})}}vf(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.vt()}destroy(){this.top&&this.gi(this.top),this.bottom&&this.gi(this.bottom),this.top=null,this.bottom=null}gi(e){for(let t of e.cells)for(let i of w)for(let r of t[i])L(this.e,r);e.cells=[]}};var oi=class{constructor(e){this.e=e;this.T=null;this.Di={};this.qt=[]}init(){this.T=f("div","mach-statusbar"),this.T.style.display="none",this.T.setAttribute("role","status"),this.e.n.root.appendChild(this.T),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.T)return;this.T.textContent="",this.Di={};let e=this.e.t;if(!e.statusBarEnabled){this.T.style.display="none";return}for(let t of e.statusBarPanels){let i=f("span",`mach-statusbar-item mach-statusbar-item--${t}`);this.T.appendChild(i),this.Di[t]=i}this.refresh()}Zs(e,t){return W(this.e.u(e),t||0)}Qs(e,t){let i=this.Di[e];i&&i.textContent!==t&&(i.textContent=t)}Cm(){let e=this.e.i,t=e.Li(),i=e.Te?e.getTotalRowCount():e.L(),r=W(this.e.u("totalRowsLabel"),i);return e.g&&t>i?`${r} / ${t}`:r}Tm(){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.Zs("statusSum",s)} \xB7 ${this.Zs("statusAvg",o)} \xB7 ${this.Zs("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.Di.rowCount&&this.Qs("rowCount",this.Cm()),this.Di.selectedRowCount){let t=this.e.f.ti().length;this.Qs("selectedRowCount",W(this.e.u("statusSelected"),t))}this.Di.rangeAggregate&&this.Qs("rangeAggregate",this.Tm())}}destroy(){for(let e of this.qt)e();this.qt=[],this.T?.remove(),this.T=null}};function tr(){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 ir(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??tr())?.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??tr())?.setItem(i(o),l)}catch(a){r(a,"save",o)}},clear(o){try{(n.storage??tr())?.removeItem(i(o))}catch(s){r(s,"clear",o)}}}}var rr=ir();function si(n,e){rr.save(n,e)}function ai(n){return rr.load(n)}function qn(n){rr.clear(n)}var $e=class{constructor(e){this.onError=e;this.Yn=new Set;this.disposed=!1}add(e){let t=!0,i=()=>{if(t){t=!1,this.Yn.delete(i);try{e()}catch(r){try{this.onError(r)}catch{}}}};return this.disposed?i():this.Yn.add(i),i}k(e){return this.add(()=>e.destroy()),e}dispose(){if(this.disposed)return;this.disposed=!0;let e=[...this.Yn].reverse();this.Yn.clear();for(let t of e)t()}};function Ta(n){return!!(n.field||n.valueGetter||n.cellRenderer||n.checkboxSelection||n.rowDrag||n.type||n.autoRowSpan||n.rowSpan)}function Da(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 xa(n,e){let t=n.colId??n.field??`col_${e.leafIndex}`;e.seenIds.set(t,(e.seenIds.get(t)??0)+1),n.field&&!tt(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`),Ta(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`),Da(n,t,e.issues)}function Yn(n,e){for(let t of n){if(ve(t)){!Array.isArray(t.children)||t.children.length===0?e.issues.push(`\u5217\u5206\u7EC4 "${t.headerName??t.groupId??"?"}" \u7684 children \u4E3A\u7A7A`):Yn(t.children,e);continue}e.leafIndex++,xa(t,e)}}function Xn(n){if(!n||n.length===0)return[];let e={issues:[],seenIds:new Map,leafIndex:0};Yn(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 Jn=new Set([...ji,..._e]),Ra=new Set(["enableColumnResize","pagination","rowKey"]);function Ea(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 Sa(n){let e,t=Math.max(2,Math.floor(n.length*.3))+1,i=n.toLowerCase();for(let r of Jn){if(Math.abs(i.length-r.length)>=t)continue;let o=Ea(i,r.toLowerCase());o<t&&(t=o,e=r)}return e}function Ma(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"),Ia(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 Ia(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 Aa(n,e){for(let t of ji)if(!(Ra.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 ${xe[t]}`;e("INVALID_OPTION_VALUE",t,i)}}function ka(n){let e=[];for(let t of Object.keys(n)){if(Jn.has(t))continue;let i=Sa(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 Pa(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 Ga(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"&&Pa(n,t,e)}function li(n){let e=n,t=ka(e),i=(r,o,s)=>{t.push({code:r,option:o,message:s})};return Ga(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"),Aa(e,i),Ma(e,i),t}function Zn(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 nr(n,e){for(let t=0;t<3;t++)if(n[t]!==e[t])return n[t]<e[t]?-1:1;return 0}function La(n){return n[0]>0?[n[0]+1,0,0]:n[1]>0?[0,n[1]+1,0]:[0,0,n[2]+1]}function Na(n,e){if(e==="*"||e.toLowerCase()==="latest")return!0;let t=/^(\^|~|>=|<=|>|<|=)?\s*(.+)$/.exec(e);if(!t)return!1;let i=Zn(t[2]);if(!i)return!1;let r=nr(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&&nr(n,La(i))<0;case"~":return r>=0&&nr(n,[i[0],i[1]+1,0])<0;default:return r===0}}function Qn(n,e){if(!e?.trim())return!0;let t=n?Zn(n):null;return t?e.split("||").some(i=>{let r=i.trim().split(/\s+/).filter(Boolean);return r.length>0&&r.every(o=>Na(t,o))}):!1}function Fa(n){return[...new Set((n??[]).map(e=>e.trim()).filter(Boolean))]}function di(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 ui(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 di(d.requires)){let c=t.get(u.key);c?Qn(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 Fa(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 di(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 Oa=new Set(["valueFormatter","cellStyle","cellClass"]),Ha=new Set(["selectionChanged","sortChanged","filterChanged","columnMoved","columnVisibilityChanged","paginationChanged","detailToggled"]),Va=0,ci=class{constructor(e,t){this.D=!1;this.Dm=0;this.gr=0;this.tu=!1;this.ea="";this.x=new $e(e=>console.error("[mach-table] resource cleanup error",e));this.activeFeatures=new Map;this.su=0;this.yr=0;this.recentErrors=[];this.xt=null;this.au=0;this.vr=null;this.ta=0;this.br=null;this.ia=!1;this.ra=null;this.fu=null;this.Xn=new Set;let i;this.iu=new Promise(r=>{i=r}),this.ru=i,this.gridId=++Va,this.t=Rr(t),this.ue=new et((r,o)=>{o==="gridError"?console.error("[mach-table] error in gridError listener",r):this.reportError(r,"eventBus.listener",{eventType:o})});try{if(this.nd(t.dataProcessor),this.r=new ct(this),this.i=this.x.k(new bt(this)),this.f=new wt(this),this.n=this.x.k(new Kt(this)),this.W=this.x.k(new Yt(this)),this.s=this.x.k(new ti(this)),this.ur=this.x.k(new Ct(this)),this.Rn=this.x.k(new Tt(this)),this.Yo=this.x.k(new Mt(this)),this.a=this.x.k(new At(this)),this.V=new kt(this),this.O=new Ht(this),this.Ce=this.x.k(new _t),this.pi=this.x.k(new zt(r=>this.xm(r))),this.xs=this.x.k(new Gt(this)),this.columnMenu=this.x.k(new Lt(this)),this.qs=this.x.k(new Nt(this)),this.Fn=this.x.k(new Ft(this)),this.Cn=this.x.k(new Ot(this)),this.mi=this.x.k(new ri(this)),this.Le=this.x.k(new ni(this)),this.Ge=this.x.k(new ii(this)),this.ct=this.x.k(new oi(this)),this.api=Wn(this),this.je=new Qe(this),this.$=this.x.k(new Vt(this)),this.x.add(()=>this.lu()),this.$.init(),this.n.init(e,this.t),this.Cn.init(),this.s.init(),this.Yo.init(),this.Fn.init(),this.mi.init(),this.Ge.init(),this.ct.init(),this.Le.init(),this.i.za(this.t.paginationPage,this.t.paginationPageSize),this.r.Ei(this.t.columnDefs),this.i.ot(this.t.advancedFilterModel),this.i.At(this.t.quickFilterText),this.Tn(),this.du(this.t.columnDefs),this.gs(t),this.W.xn(),this.t.datasource?this.i.Or().catch(()=>{}):this.i.nt(this.t.rowData),this.t.initialState&&this.api.state.apply(this.t.initialState,{emitEvents:!1}),this.vs(),this.Ie(),this.Le.setData(this.t.pinnedTopRowData,this.t.pinnedBottomRowData),this.od(this.t.features),this.D)return;this.gr=requestAnimationFrame(()=>{this.gr=0,this.D||this.emit("gridReady",{}),this.uu()})}catch(r){throw this.api&&this.reportError(r,"grid.constructor"),this.destroy(),r}}nd(e){if(e===this.nu)return!1;let t=++this.su,i=typeof e=="function"?e():e;if(this.D||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.x.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]??Fr[e]}Jc(e){return this.t.components?.cellEditors?.[e]}Rm(e){return di(e.requires).map(t=>t.key).find(t=>!this.activeFeatures.has(t))}od(e){let t=this.yr+1;if(this.lu(),this.D||this.yr!==t)return;let i=ui(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.D||this.yr!==t)return;let o=r.key.trim(),s=this.Rm(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,p)=>(u.addEventListener(c,h,p),l(()=>u.removeEventListener(c,h,p))),setManagedTimeout:(u,c)=>{let h=setTimeout(()=>{p(),u()},Math.max(0,c)),p=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.D||this.yr!==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.yr++;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.D}suspend(){this.ze(),this.api.editing.stop({cancel:!0}),this.xs.close(),this.columnMenu.close(),this.qs.close(),this.Fn.hide(),this.ur.lt(),this.Rn.destroy(),this.s.suspend(),hn(this.n.root),kr(this.n.root);let e=document.activeElement;e instanceof HTMLElement&&this.n.root.contains(e)&&e.blur()}Qt(){return++this.Dm}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]}en(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?me(e.data,o.field,i):!1}jo(e,t,i,r){this.s.Wr(e),this.s.Pl([e.rowIndex],[t.id]),this.O.es({nodeId:e.id,columnId: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})}ll(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 xt(r)}Sl(){let e=this.s.li();return e?He(this.ll(e)):Promise.resolve(!1)}Oo(e){this.D||this.fi(this.hu(e,this.r.l()))}async Fc(e,t){let{s:i,r,i:o}=this,s=this.V.Qr(),a=o.Ni(),l=i.v,d=i.De(),u=r.l(),c=this.hu(e,u),h=c.map(({node:m})=>m.data);if(!await He(t)||!s()||this.t.suppressClipboard||a!==o.Ni()||l!==i.v||d!==i.De())return;let p=r.l();u.slice(e.c1,e.c2+1).some((m,g)=>m!==p[e.c1+g])||c.every(({node:m,column:g,oldValue:b},T)=>m.data===h[T]&&Object.is(this.d(m,g),b))&&this.fi(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}fi(e){this.V.th(e)}ze(){this.V?.Zc()}dl(e,t,i){if(this.D)return;let r=Rt(e);if(r.length===0)return;let o=this.r.l(),s=this.i.L(),a=[],l=t;for(let d of r){let u=this.Em(l,s);if(!u)break;this.Sm(u.node,d,o,i,a),l=u.index+1}this.fi(a)}Em(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}Mm(e,t){let i=t;for(;i<e.length;){let r=e[i];if(X(r)&&!r.colDef.rowDrag)break;i++}return i}Sm(e,t,i,r,o){let s=r,a=o.length;for(let l of t){if(s=this.Mm(i,s),s>=i.length)return;let d=i[s];if(!this.a.ne(e,d)){s++;continue}let u=this.d(e,d);try{let c=d.colDef.valueParser?ue(this,e,d,l,"clipboard",u):Dt(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++}}mh(){let e=this.s.Ho();if(!e)return Promise.resolve();let t=this.V.Qr(),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.V.Ji([{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.Ho();a&&t()&&s()&&l?.row===e.row&&l.colIdx===e.colIdx&&this.i.h(e.row)===i&&this.r.l()[e.colIdx]===r&&this.dl(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||Ha.has(e))&&this.vn(),r}reportError(e,t,i){let r=e instanceof Error?e.message:String(e),o=this.Im(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.D&&this.emit("gridError",{code:o,error:e,source:t,context:i})}Im(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")||Oa.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"}Zh(){return{gridId:this.gridId,version:Ke,destroyed:this.D,infinite:this.i.g,loading:this.i.Au()||this.t.loading,rowCount:this.i.Li(),renderedRowCount:this.n.ye.querySelectorAll(".mach-row[data-index]").length,columnCount:this.r.Q().length,selectedRowCount:this.f.ti().length,dirtyRowCount:this.$.getDirtyRowIds().length,activeFeatures:[...this.activeFeatures].map(([e,t])=>({key:e,...t.feature.version?{version:t.feature.version}:{}})),performance:this.Ce.snapshot(),updates:this.pi.snapshot(),recentErrors:this.recentErrors.map(e=>({...e,...e.context?{context:{...e.context}}:{}}))}}Er(e,t){this.r.Er(e,t),this.Mi()}Mi(){this.W.bs(),this.emit("sortChanged",{sortModel:this.r.ee()}),this.i.Do()}ih(e,t){let i=this.i._e();t?i[e.id]=t:delete i[e.id],this.i.It(i),this.lr()}lr(){this.W.ws(),this.ys(),this.i.Do()}ys(e=!0){this.emit("filterChanged",{filterModel:this.i._e(),advancedFilterModel:this.i.Fi()},e)}Si(e,t){this.r.Si(e,t)&&(this.ar(),this.emit("columnMoved",{colId:e,toIndex:t}))}Kr(e){return this.i.Kr(e)}rl(e,t){this.emit("columnResized",{colId:e.id,width:e.currentWidth,finished:t})}dt(e){if(!(this.D||e.length===0))for(let t of e){if(this.D)break;this.rl(t,!0)}}vs(e=!1,t=!1){let i=this.ta,r=this.vr,o=this.r.oo().length>0;if(e){if(r==null||!o)return;if(r!==i){this.vr=null,this.vn();return}}this.vr=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(p=>p==="columns"||p==="sort"||p==="filter"))){this.vr=i;return}let c;try{c=d?d.load(l):ai(l)}catch(p){this.reportError(p,"gridState.load");return}let h=(p,m=!1)=>{if(this.D||s!==this.au||i!==this.ta||!p)return;let g=this.br;this.br=m?"beforeRows":"normal";try{this.api.state.apply(p,{emitEvents:!1,sections:u})}finally{this.br=g}};k(c)?Promise.resolve(c).then(h).catch(p=>this.reportError(p,"gridState.load")):h(c,t)}Np(){return this.br==="beforeRows"}vn(){let e=this.t.persistence;if(!(!e||this.D||this.br)&&(this.ta++,this.vr==null)){if(this.xt&&clearTimeout(this.xt),e.debounceMs===0){this.xt=null,this.na();return}this.xt=setTimeout(()=>{this.xt=null,this.na()},e.debounceMs)}}na(){let e=this.t.persistence;if(!e||this.D)return;let{key:t,store:i,sections:r}=e,o=this.api.state.get(),s=r?Rn(o,r):o,a={key:t,...i?{store:i}:{},state:s};if(this.ia){this.ra=a;return}this.pu(a)}pu(e){try{let t=e.store?e.store.save(e.key,e.state):si(e.key,e.state);if(!k(t))return;this.ia=!0,Promise.resolve(t).catch(i=>this.reportError(i,"gridState.save")).finally(()=>{this.ia=!1;let i=this.ra;this.ra=null,i&&this.pu(i)})}catch(t){this.reportError(t,"gridState.save")}}Ih(){let e=f("div","mach-empty mach-empty--error"),t=f("div","mach-empty__title");t.textContent=this.u("requestFailed");let i=f("div","mach-empty__hint");return i.textContent=this.u("requestFailedHint"),e.append(t,i),e}Sh(){let e=f("div","mach-loading"),t=f("div","mach-loading__visual");t.setAttribute("aria-hidden","true");for(let r=0;r<3;r+=1){let o=f("span","mach-loading__row");t.appendChild(o)}let i=f("span","mach-loading__label");return i.textContent=this.u("loading"),e.append(t,i),e}Mh(){let e=f("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.He().length>0&&this.i.Vi(),o=f("div","mach-empty__title");o.textContent=r?t.noMatchingRows??t.emptyRows??this.u("noMatchingRows"):this.u("emptyRows");let s=f("div","mach-empty__hint");if(s.textContent=this.u("emptyRowsHint"),e.append(o),(!r||t.emptyRowsHint)&&e.append(s),r){let a=f("button","mach-toolbar__select-host");a.type="button",a.textContent=this.u("clearFilters"),a.onclick=()=>{this.i.It({}),this.i.ot(null),this.i.At(null),this.t.quickFilterText=null,this.lr(),this.n.root.focus({preventScroll:!0})},e.append(a)}return e}gs(e){if(!(this.t.suppressWarnings||this.D)){if(e)for(let t of li({rowKey:this.t.rowKey,...e})){let i=`${t.code}:${t.option??""}:${t.message}`;this.Xn.has(i)||(this.Xn.add(i),console.warn(`[mach-table:${t.code}] ${t.message}`))}this.t.treeData&&this.r.Ze().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.D)&&this.fu!==e){this.fu=e;for(let t of Xn(e))this.Xn.has(t)||(this.Xn.add(t),console.warn(`[mach-table] ${t}`))}}ar(){this.je.Ri=!0,this.pi.Vl({columns:!0})}K(e){(e.data||e.cells)&&(this.je.Ri=!0),this.pi.Vl(e)}Ql(e){return this.pi.batch(e)}xm(e){this.D||(e.columns?this.Am():(e.header&&this.W.xn(),e.pool&&this.s.Ad(),(e.pool||e.layout)&&this.Ie()),this.km(e),e.data&&!e.pool&&!e.columns?this.s.om():e.cells&&this.s.refreshCells(e.cells===!0?void 0:e.cells),e.pinned&&this.Le.refresh(),e.summary&&this.Ge.refresh(),e.overlays&&this.s.zs())}km(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.je.Qn(t)&&this.ri()}Am(){this.gs(),this.du(this.r.oo()),this.s.st(),this.W.xn(),this.s.Ad(),this.Ie(),this.Le.xe(),this.emit("displayedColumnsChanged",{})}Ie(){if(this.D)return;let e=this.Ce.start();this.Tn(),this.je.Qn(),this.r.ua(this.n.hs());let t=this.r.l().map(i=>`${i.id}:${i.currentWidth}`).join("|");this.ea&&t!==this.ea&&this.s.st(),this.ea=t,this.n.root.setAttribute("aria-colcount",String(this.r.l().length)),this.W.vt(),this.s.Ie(),this.Le.vt(),this.Ge.refresh(),this.Ce.Rh(e)}Tn(){if(!this.n.root)return;let e=this.t.treeData||this.r.Ze().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.D||(this.je.Qn(),this.r.ua(this.n.hs()),e&&this.s.st(),this.W.vt(),this.s.wn(),this.s._n(),this.s.dr(!0),this.Le.vt(),this.Ge.refresh())}destroy(){if(!this.D){if(this.xt&&(clearTimeout(this.xt),this.xt=null,this.na()),this.D=!0,this.ze(),this.gr&&cancelAnimationFrame(this.gr),this.gr=0,this.api){this.uu();try{this.emit("gridDestroyed",{})}catch(e){console.error("[mach-table] grid destroy event",e)}}this.x.dispose(),this.ue.clear()}}};function eo(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 ci(n,e).api}function Ba(n){return n.mode==="allMatching"?{mode:"allMatching",excludedKeys:[...n.excludedKeys]}:{mode:"explicit",selectedKeys:[...n.selectedKeys]}}function to(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:Q(t.filterModel),advancedFilterModel:H(t.advancedFilterModel),quickFilterText:t.quickFilterText,...e.scope==="selected"?{selection:Ba(e.selection??{mode:"explicit",selectedKeys:t.selectedRowIds})}:{}}}function _a(n){return n.value===!0?"\u662F":n.value===!1?"\u5426":""}function za(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 Wa(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 $a(n,e){return n.filterable===!1?!1:e==="number"?"number":e==="date"?"date":e==="select"||e==="boolean"?"set":"text"}function Ka(n,e,t){if(e.editable&&(t==="number"||t==="date")&&(n.cellEditor=t),t==="date"){n.valueFormatter=za(e.format);return}if(t==="boolean"){n.valueFormatter=_a;return}if(t!=="select")return;let i=e.options??[];n.valueFormatter=Wa(i),e.editable&&(n.cellEditor="select",n.cellEditorParams={options:i})}function io(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:$a(n,e),cellClass:n.cellClass};return Ka(t,n,e),t}function ro(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(io(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(io(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 no(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?Wt(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 oo(){return{accessor:(n,e={})=>({...e,field:n}),display:n=>({...n}),group:n=>({...n,children:[...n.children]})}}function so(n){return[...n]}function ao(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 or(n,e){return e===void 0?n:typeof e!="object"||e===null||typeof n!="object"||n===null?e:{...n,...e}}function Ua(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 qa(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 Ya(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]=Ua(r,o))}}function lo(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=qa(n,e);return r&&(t.columnTypes=r),(n.aggFuncs||e.aggFuncs)&&(t.aggFuncs={...n.aggFuncs,...e.aggFuncs}),t.pagination=or(n.pagination,e.pagination),t.statusBar=or(n.statusBar,e.statusBar),t.watermark=or(n.watermark,e.watermark),Ya(t,n,e),t}function sr(...n){return n.reduce((e,t)=>{if(typeof t!="string")return lo(e,t);let i=ao(t);if(!i)throw new TypeError(`[MachTable] Unknown built-in preset "${t}". Use "list" or "detail".`);return lo(e,i)},{})}function uo(n={}){return sr({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 co(n){return n}function ho(n){return n}function po(n){return n}function pi(n){return n!=null&&n!==""}function Xa(n){if(!pi(n))return null;let e=typeof n=="number"?n:Number(n);return Number.isFinite(e)?e:null}function hi(n,e){try{return new Intl.NumberFormat(n,e)}catch{return new Intl.NumberFormat(void 0,e)}}function fo(n,e){try{return new Intl.DateTimeFormat(n,e)}catch{let t={...e};return delete t.timeZone,new Intl.DateTimeFormat(void 0,t)}}function Ja(n){if(!pi(n))return null;let e=n instanceof Date?n:new Date(n);return Number.isFinite(e.getTime())?e:null}function mo(n={}){let e=n.emptyText??"",t=n.invalidText??"\u2014",i=hi(n.locale,{maximumFractionDigits:n.maximumFractionDigits??2}),r=hi(n.locale,{maximumFractionDigits:0}),o=hi(n.locale,{style:"currency",currency:n.currency??"CNY",currencyDisplay:n.currencyDisplay??"symbol",maximumFractionDigits:n.maximumFractionDigits??2}),s=hi(n.locale,{style:"percent",maximumFractionDigits:n.maximumFractionDigits??2}),a=fo(n.locale,{year:"numeric",month:"2-digit",day:"2-digit",...n.timeZone?{timeZone:n.timeZone}:{}}),l=fo(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:p})=>{if(!pi(p))return e;let m=Xa(p);return m==null?t:c.format(m*h)},u=c=>({value:h})=>{if(!pi(h))return e;let p=Ja(h);return p==null?t:c.format(p)};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 go(){try{return typeof localStorage>"u"?null:localStorage}catch{return null}}function yo(n){return typeof TextEncoder>"u"?n.length*2:new TextEncoder().encode(n).byteLength}function vo(n){if(typeof n!="string")return null;let e=n.trim();return e&&e.length<=256?e:null}function fi(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 Se(n){if(n==null||typeof n!="object")return null;let e=n,t=vo(e.id),i=typeof e.name=="string"?e.name.trim().slice(0,120):"",r=fi(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 ar(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 lr(n,e,t={}){let i=fi(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 dr(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??go())?.getItem(r(l));if(!d||yo(d)>i)return[];let u=JSON.parse(d);return u.schemaVersion!==1||!Array.isArray(u.views)?[]:u.views.flatMap(c=>{let h=Se(c);return h?[h]:[]}).slice(0,t)},a=(l,d)=>{let u=JSON.stringify({schemaVersion:1,savedAt:Date.now(),views:d});if(yo(u)>i)throw new RangeError(`[MachTable] Saved views for "${l}" exceed ${i} bytes.`);let c=n.storage??go();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=Se(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 Za(){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 bo(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??dr(),r=async()=>(await i.list(t)).flatMap(s=>{let a=Se(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=vo(s)??Za(),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:ar(n)};return await i.save(t,c),c},async apply(o,s){let a=typeof o=="string"?(await r()).find(d=>d.id===o):Se(o),l=typeof o=="string"?o:"provided view";if(!a)throw new Error(`[MachTable] Grid view "${l}" was not found.`);if(!lr(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 Qa=Ke;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});
|