@agile-team/mach-table 0.35.3 → 0.36.0

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 CHANGED
@@ -4,7 +4,7 @@
4
4
 
5
5
  # @agile-team/mach-table
6
6
 
7
- MachTable 0.35.3 的框架无关 TypeScript Core:零运行时依赖,提供行列双虚拟化、领域化 API、单元格/整行编辑、树与分组、随机访问远程数据、区段隔离状态持久化和可诊断扩展系统。本版统一完整表头宽度下限,覆盖初始布局、fit、状态恢复及交互缩列,内置插画空态与亮暗主题继续保留;可选 `/business` 的字典列策略、本地语义合计及字典缓存隔离继续兼容;普通根入口 API 和既有默认行为保持兼容。
7
+ MachTable 0.36.0 的框架无关 TypeScript Core:零运行时依赖,提供行列双虚拟化、领域化 API、单元格/整行编辑、树与分组、随机访问远程数据、区段隔离状态持久化和可诊断扩展系统。本版统一完整表头宽度下限,覆盖初始布局、fit、状态恢复及交互缩列,内置插画空态与亮暗主题继续保留;可选 `/business` 的字典列策略、本地语义合计及字典缓存隔离继续兼容;普通根入口 API 和既有默认行为保持兼容。
8
8
 
9
9
  小型本地明细可使用 `domLayout: "autoHeight"` 随当前页内容收起;本版为该模式的空态、加载态和错误态预留必要展示空间,恢复数据后释放最小高度。可通过 `--mach-overlay-min-height` 局部调整。大数据表继续使用有明确高度的默认虚拟布局。
10
10
 
package/dist/business.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";var T=Object.defineProperty;var C=Object.getOwnPropertyDescriptor;var P=Object.getOwnPropertyNames;var E=Object.prototype.hasOwnProperty;var N=(t,e)=>{for(var o in e)T(t,o,{get:e[o],enumerable:!0})},R=(t,e,o,a)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of P(e))!E.call(t,r)&&r!==o&&T(t,r,{get:()=>e[r],enumerable:!(a=C(e,r))||a.enumerable});return t};var O=t=>R(T({},"__esModule",{value:!0}),t);var A={};N(A,{createDictionaryColumn:()=>V,summarizeRows:()=>k});module.exports=O(A);var f=Symbol("ambiguous dictionary input");function p(t,e,o){let a=t.get(e);t.set(e,a!==void 0&&a!==o?f:o)}function z(t,e){return t===void 0?e:e===void 0||e===t?t:f}function V(t,e={}){let o=[],a=o,r=new Map,i=new Map,u=new Map,s=new Map,g=()=>{let n=typeof e.options=="function"?e.options():e.options??o;if(n===a)return;let y=new Map(n.map(m=>[m.value,m])),c=new Map,l=new Map,K=new Map;for(let[m,w]of y)p(c,String(m),m),p(l,w.label,m),p(K,`${String(m)} \xB7 ${w.label}`,m);a=n,r=y,i=c,u=l,s=K},b=n=>typeof n=="string"||typeof n=="number",h=n=>(g(),t.get(n)??r.get(n)?.label),D=(n,y)=>{if(n==null||n==="")return"";if(!b(n))return typeof n=="boolean"?String(n):"";let c=String(n);if(y==="code")return c;let l=h(n);return l===void 0?c:y==="label"?l:`${c} \xB7 ${l}`},x=n=>{if(!b(n)||n===""||(g(),r.has(n)||t.get(n)!==void 0||typeof n!="string"))return n;let y=i.get(n)??z(u.get(n),s.get(n));if(y===f)throw new TypeError(`[MachTable] Ambiguous dictionary value: ${n}`);return y??n};return{valueFormatter:({value:n})=>D(n,e.display??"label"),valueParser:({value:n})=>x(n),valueSerializer:({value:n,target:y})=>{let c=e.output?.[y]??"code";return c==="code"?n:D(n,c)}}}function S(t){if(typeof t!="number"||!Number.isFinite(t)||Math.abs(t)>Number.MAX_SAFE_INTEGER)throw new TypeError("[MachTable] Summary arithmetic requires finite numbers within the safe range; provide numeric for decimal strings or exact arithmetic.");return t}function d(t){if(t!=null&&typeof t.then=="function")throw Promise.resolve(t).catch(()=>{}),new TypeError("[MachTable] Summary numeric callbacks must return synchronous values.");return t}var G={zero:()=>0,add:(t,e)=>S(t+S(e)),divide:(t,e)=>e===0?null:S(t/e)};function M(t,e){let o=new Map;for(let a of t)(a.kind==="sum"||a.kind==="ratio")&&o.set(a.id,{value:d(e.zero()),denominator:d(e.zero())});return{rowCount:0,totals:o}}function $(t,e,o,a){e.rowCount++;for(let r of o){if(r.kind==="count"||r.kind==="none")continue;let i=e.totals.get(r.id),u=r.kind==="sum"?r.value(t):r.numerator(t);if(u!=null&&u!==""&&(i.value=d(a.add(i.value,u))),r.kind==="ratio"){let s=r.denominator(t);s!=null&&s!==""&&(i.denominator=d(a.add(i.denominator,s)))}}}function v(t,e,o){let a=Object.create(null);for(let r of e)if(r.kind!=="none")if(r.kind==="count")a[r.id]=t.rowCount;else{let i=t.totals.get(r.id);a[r.id]=r.kind==="sum"?i.value:d(o.divide(i.value,i.denominator))}return a}function k(t,e){let o=new Set;for(let i of e.metrics){if(!i.id||o.has(i.id))throw new TypeError("[MachTable] Summary metric IDs must be non-empty and unique.");o.add(i.id)}let a=e.numeric??G,r=new Map;e.groupBy||r.set(void 0,M(e.metrics,a));for(let i of t){let u=e.groupBy?.(i);if(e.groupBy&&typeof u!="string"&&(typeof u!="number"||!Number.isFinite(u)))throw new TypeError("[MachTable] Summary group keys must be strings or finite numbers.");let s=r.get(u);s||(s=M(e.metrics,a),r.set(u,s)),$(i,s,e.metrics,a)}return{scope:e.scope,groups:[...r].map(([i,u])=>({key:i,rowCount:u.rowCount,values:v(u,e.metrics,a)}))}}0&&(module.exports={createDictionaryColumn,summarizeRows});
1
+ "use strict";var f=Object.defineProperty;var x=Object.getOwnPropertyDescriptor;var P=Object.getOwnPropertyNames;var E=Object.prototype.hasOwnProperty;var N=(n,e)=>{for(var o in e)f(n,o,{get:e[o],enumerable:!0})},R=(n,e,o,a)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of P(e))!E.call(n,r)&&r!==o&&f(n,r,{get:()=>e[r],enumerable:!(a=x(e,r))||a.enumerable});return n};var O=n=>R(f({},"__esModule",{value:!0}),n);var B={};N(B,{createDictionaryColumn:()=>C,summarizeRows:()=>k});module.exports=O(B);var g=Symbol("ambiguous dictionary input");function S(n,e,o){let a=n.get(e);n.set(e,a!==void 0&&a!==o?g:o)}function A(n,e){return n===void 0?e:e===void 0||e===n?n:g}function C(n,e={}){let o=[],a=o,r=new Map,i=new Map,u=new Map,m=new Map,K=()=>{let t=typeof e.options=="function"?e.options():e.options??o;if(t===a)return;let s=new Map(t.map(c=>[c.value,c])),y=new Map,l=new Map,T=new Map;for(let[c,V]of s)S(y,String(c),c),S(l,V.label,c),S(T,`${String(c)} \xB7 ${V.label}`,c);a=t,r=s,i=y,u=l,m=T},w=t=>typeof t=="string"||typeof t=="number"||typeof t=="boolean",h=t=>(K(),n.get(t)??r.get(t)?.label),p=(t,s)=>{if(Array.isArray(t))return t.map(T=>p(T,s)).join(e.separator??"\u3001");if(t==null||!w(t))return"";let y=String(t);if(s==="code")return y;let l=h(t);return l===void 0?y:s==="label"?l:`${y} \xB7 ${l}`},D=t=>{if(Array.isArray(t))return t.map(D);if(!w(t)||t===""||(K(),r.has(t)||n.get(t)!==void 0||typeof t!="string"))return t;let s=i.get(t)??A(u.get(t),m.get(t));if(s===g)throw new TypeError(`[MachTable] Ambiguous dictionary value: ${t}`);return s??t};return{valueFormatter:({value:t})=>p(t,e.display??"label"),valueParser:({value:t})=>D(t),valueSerializer:({value:t,target:s})=>{let y=e.output?.[s]??"code";return y==="code"?t:p(t,y)}}}function b(n){if(typeof n!="number"||!Number.isFinite(n)||Math.abs(n)>Number.MAX_SAFE_INTEGER)throw new TypeError("[MachTable] Summary arithmetic requires finite numbers within the safe range; provide numeric for decimal strings or exact arithmetic.");return n}function d(n){if(n!=null&&typeof n.then=="function")throw Promise.resolve(n).catch(()=>{}),new TypeError("[MachTable] Summary numeric callbacks must return synchronous values.");return n}var z={zero:()=>0,add:(n,e)=>b(n+b(e)),divide:(n,e)=>e===0?null:b(n/e)};function M(n,e){let o=new Map;for(let a of n)(a.kind==="sum"||a.kind==="ratio")&&o.set(a.id,{value:d(e.zero()),denominator:d(e.zero())});return{rowCount:0,totals:o}}function G(n,e,o,a){e.rowCount++;for(let r of o){if(r.kind==="count"||r.kind==="none")continue;let i=e.totals.get(r.id),u=r.kind==="sum"?r.value(n):r.numerator(n);if(u!=null&&u!==""&&(i.value=d(a.add(i.value,u))),r.kind==="ratio"){let m=r.denominator(n);m!=null&&m!==""&&(i.denominator=d(a.add(i.denominator,m)))}}}function $(n,e,o){let a=Object.create(null);for(let r of e)if(r.kind!=="none")if(r.kind==="count")a[r.id]=n.rowCount;else{let i=n.totals.get(r.id);a[r.id]=r.kind==="sum"?i.value:d(o.divide(i.value,i.denominator))}return a}function k(n,e){let o=new Set;for(let i of e.metrics){if(!i.id||o.has(i.id))throw new TypeError("[MachTable] Summary metric IDs must be non-empty and unique.");o.add(i.id)}let a=e.numeric??z,r=new Map;e.groupBy||r.set(void 0,M(e.metrics,a));for(let i of n){let u=e.groupBy?.(i);if(e.groupBy&&typeof u!="string"&&(typeof u!="number"||!Number.isFinite(u)))throw new TypeError("[MachTable] Summary group keys must be strings or finite numbers.");let m=r.get(u);m||(m=M(e.metrics,a),r.set(u,m)),G(i,m,e.metrics,a)}return{scope:e.scope,groups:[...r].map(([i,u])=>({key:i,rowCount:u.rowCount,values:$(u,e.metrics,a)}))}}0&&(module.exports={createDictionaryColumn,summarizeRows});
@@ -1,20 +1,27 @@
1
1
  import { V as ValueOutputTarget, C as ColDef } from './api-Di5SQHAP.cjs';
2
- import { D as DictionaryKey, a as DictionaryEntry } from './cachedDictionary-HXvqrDI0.cjs';
2
+ import { D as DictionaryKey } from './cachedDictionary-C26hMT22.cjs';
3
3
 
4
4
  type DictionaryDisplay = "code" | "label" | "code-label";
5
+ type ColumnKey = DictionaryKey | boolean;
6
+ interface ColumnEntry<TKey extends ColumnKey> {
7
+ value: TKey;
8
+ label: string;
9
+ }
5
10
  /** Structural adapter for an existing provider; this helper never loads or caches remote data. */
6
- interface DictionaryColumnSource<TKey extends DictionaryKey = DictionaryKey> {
11
+ interface DictionaryColumnSource<TKey extends ColumnKey = ColumnKey> {
7
12
  get(key: TKey): string | undefined;
8
13
  }
9
- interface DictionaryColumnOptions<TKey extends DictionaryKey = DictionaryKey> {
14
+ interface DictionaryColumnOptions<TKey extends ColumnKey = ColumnKey> {
10
15
  /** Immutable snapshot for reverse parsing. Replace its identity when options change. */
11
- options?: readonly DictionaryEntry<TKey>[] | (() => readonly DictionaryEntry<TKey>[]);
16
+ options?: readonly ColumnEntry<TKey>[] | (() => readonly ColumnEntry<TKey>[]);
12
17
  display?: DictionaryDisplay;
18
+ /** Array display/output only; input strings are never split implicitly. */
19
+ separator?: string;
13
20
  /** Omitted targets preserve the original code and its type. */
14
21
  output?: Partial<Record<ValueOutputTarget, DictionaryDisplay>>;
15
22
  }
16
23
  /** Explicit, synchronous dictionary presentation and typed IO; no existing defaults are changed. */
17
- declare function createDictionaryColumn<TData = any, TKey extends DictionaryKey = DictionaryKey>(source: DictionaryColumnSource<TKey>, config?: DictionaryColumnOptions<TKey>): Partial<ColDef<TData>>;
24
+ declare function createDictionaryColumn<TData = any, TKey extends ColumnKey = ColumnKey>(source: DictionaryColumnSource<TKey>, config?: DictionaryColumnOptions<TKey>): Partial<ColDef<TData>>;
18
25
 
19
26
  type SummaryScope = "page" | "selected" | "query";
20
27
  type SemanticSummaryMetric<TData> = {
@@ -1,20 +1,27 @@
1
1
  import { V as ValueOutputTarget, C as ColDef } from './api-Di5SQHAP.js';
2
- import { D as DictionaryKey, a as DictionaryEntry } from './cachedDictionary-HXvqrDI0.js';
2
+ import { D as DictionaryKey } from './cachedDictionary-C26hMT22.js';
3
3
 
4
4
  type DictionaryDisplay = "code" | "label" | "code-label";
5
+ type ColumnKey = DictionaryKey | boolean;
6
+ interface ColumnEntry<TKey extends ColumnKey> {
7
+ value: TKey;
8
+ label: string;
9
+ }
5
10
  /** Structural adapter for an existing provider; this helper never loads or caches remote data. */
6
- interface DictionaryColumnSource<TKey extends DictionaryKey = DictionaryKey> {
11
+ interface DictionaryColumnSource<TKey extends ColumnKey = ColumnKey> {
7
12
  get(key: TKey): string | undefined;
8
13
  }
9
- interface DictionaryColumnOptions<TKey extends DictionaryKey = DictionaryKey> {
14
+ interface DictionaryColumnOptions<TKey extends ColumnKey = ColumnKey> {
10
15
  /** Immutable snapshot for reverse parsing. Replace its identity when options change. */
11
- options?: readonly DictionaryEntry<TKey>[] | (() => readonly DictionaryEntry<TKey>[]);
16
+ options?: readonly ColumnEntry<TKey>[] | (() => readonly ColumnEntry<TKey>[]);
12
17
  display?: DictionaryDisplay;
18
+ /** Array display/output only; input strings are never split implicitly. */
19
+ separator?: string;
13
20
  /** Omitted targets preserve the original code and its type. */
14
21
  output?: Partial<Record<ValueOutputTarget, DictionaryDisplay>>;
15
22
  }
16
23
  /** Explicit, synchronous dictionary presentation and typed IO; no existing defaults are changed. */
17
- declare function createDictionaryColumn<TData = any, TKey extends DictionaryKey = DictionaryKey>(source: DictionaryColumnSource<TKey>, config?: DictionaryColumnOptions<TKey>): Partial<ColDef<TData>>;
24
+ declare function createDictionaryColumn<TData = any, TKey extends ColumnKey = ColumnKey>(source: DictionaryColumnSource<TKey>, config?: DictionaryColumnOptions<TKey>): Partial<ColDef<TData>>;
18
25
 
19
26
  type SummaryScope = "page" | "selected" | "query";
20
27
  type SemanticSummaryMetric<TData> = {
package/dist/business.js CHANGED
@@ -1 +1 @@
1
- var p=Symbol("ambiguous dictionary input");function T(n,t,i){let a=n.get(t);n.set(t,a!==void 0&&a!==i?p:i)}function k(n,t){return n===void 0?t:t===void 0||t===n?n:p}function h(n,t={}){let i=[],a=i,r=new Map,o=new Map,u=new Map,s=new Map,S=()=>{let e=typeof t.options=="function"?t.options():t.options??i;if(e===a)return;let y=new Map(e.map(m=>[m.value,m])),c=new Map,l=new Map,D=new Map;for(let[m,K]of y)T(c,String(m),m),T(l,K.label,m),T(D,`${String(m)} \xB7 ${K.label}`,m);a=e,r=y,o=c,u=l,s=D},g=e=>typeof e=="string"||typeof e=="number",V=e=>(S(),n.get(e)??r.get(e)?.label),b=(e,y)=>{if(e==null||e==="")return"";if(!g(e))return typeof e=="boolean"?String(e):"";let c=String(e);if(y==="code")return c;let l=V(e);return l===void 0?c:y==="label"?l:`${c} \xB7 ${l}`},M=e=>{if(!g(e)||e===""||(S(),r.has(e)||n.get(e)!==void 0||typeof e!="string"))return e;let y=o.get(e)??k(u.get(e),s.get(e));if(y===p)throw new TypeError(`[MachTable] Ambiguous dictionary value: ${e}`);return y??e};return{valueFormatter:({value:e})=>b(e,t.display??"label"),valueParser:({value:e})=>M(e),valueSerializer:({value:e,target:y})=>{let c=t.output?.[y]??"code";return c==="code"?e:b(e,c)}}}function f(n){if(typeof n!="number"||!Number.isFinite(n)||Math.abs(n)>Number.MAX_SAFE_INTEGER)throw new TypeError("[MachTable] Summary arithmetic requires finite numbers within the safe range; provide numeric for decimal strings or exact arithmetic.");return n}function d(n){if(n!=null&&typeof n.then=="function")throw Promise.resolve(n).catch(()=>{}),new TypeError("[MachTable] Summary numeric callbacks must return synchronous values.");return n}var x={zero:()=>0,add:(n,t)=>f(n+f(t)),divide:(n,t)=>t===0?null:f(n/t)};function w(n,t){let i=new Map;for(let a of n)(a.kind==="sum"||a.kind==="ratio")&&i.set(a.id,{value:d(t.zero()),denominator:d(t.zero())});return{rowCount:0,totals:i}}function C(n,t,i,a){t.rowCount++;for(let r of i){if(r.kind==="count"||r.kind==="none")continue;let o=t.totals.get(r.id),u=r.kind==="sum"?r.value(n):r.numerator(n);if(u!=null&&u!==""&&(o.value=d(a.add(o.value,u))),r.kind==="ratio"){let s=r.denominator(n);s!=null&&s!==""&&(o.denominator=d(a.add(o.denominator,s)))}}}function P(n,t,i){let a=Object.create(null);for(let r of t)if(r.kind!=="none")if(r.kind==="count")a[r.id]=n.rowCount;else{let o=n.totals.get(r.id);a[r.id]=r.kind==="sum"?o.value:d(i.divide(o.value,o.denominator))}return a}function E(n,t){let i=new Set;for(let o of t.metrics){if(!o.id||i.has(o.id))throw new TypeError("[MachTable] Summary metric IDs must be non-empty and unique.");i.add(o.id)}let a=t.numeric??x,r=new Map;t.groupBy||r.set(void 0,w(t.metrics,a));for(let o of n){let u=t.groupBy?.(o);if(t.groupBy&&typeof u!="string"&&(typeof u!="number"||!Number.isFinite(u)))throw new TypeError("[MachTable] Summary group keys must be strings or finite numbers.");let s=r.get(u);s||(s=w(t.metrics,a),r.set(u,s)),C(o,s,t.metrics,a)}return{scope:t.scope,groups:[...r].map(([o,u])=>({key:o,rowCount:u.rowCount,values:P(u,t.metrics,a)}))}}export{h as createDictionaryColumn,E as summarizeRows};
1
+ var S=Symbol("ambiguous dictionary input");function f(t,n,i){let a=t.get(n);t.set(n,a!==void 0&&a!==i?S:i)}function M(t,n){return t===void 0?n:n===void 0||n===t?t:S}function k(t,n={}){let i=[],a=i,r=new Map,o=new Map,u=new Map,m=new Map,b=()=>{let e=typeof n.options=="function"?n.options():n.options??i;if(e===a)return;let s=new Map(e.map(c=>[c.value,c])),y=new Map,l=new Map,T=new Map;for(let[c,D]of s)f(y,String(c),c),f(l,D.label,c),f(T,`${String(c)} \xB7 ${D.label}`,c);a=e,r=s,o=y,u=l,m=T},K=e=>typeof e=="string"||typeof e=="number"||typeof e=="boolean",C=e=>(b(),t.get(e)??r.get(e)?.label),p=(e,s)=>{if(Array.isArray(e))return e.map(T=>p(T,s)).join(n.separator??"\u3001");if(e==null||!K(e))return"";let y=String(e);if(s==="code")return y;let l=C(e);return l===void 0?y:s==="label"?l:`${y} \xB7 ${l}`},w=e=>{if(Array.isArray(e))return e.map(w);if(!K(e)||e===""||(b(),r.has(e)||t.get(e)!==void 0||typeof e!="string"))return e;let s=o.get(e)??M(u.get(e),m.get(e));if(s===S)throw new TypeError(`[MachTable] Ambiguous dictionary value: ${e}`);return s??e};return{valueFormatter:({value:e})=>p(e,n.display??"label"),valueParser:({value:e})=>w(e),valueSerializer:({value:e,target:s})=>{let y=n.output?.[s]??"code";return y==="code"?e:p(e,y)}}}function g(t){if(typeof t!="number"||!Number.isFinite(t)||Math.abs(t)>Number.MAX_SAFE_INTEGER)throw new TypeError("[MachTable] Summary arithmetic requires finite numbers within the safe range; provide numeric for decimal strings or exact arithmetic.");return t}function d(t){if(t!=null&&typeof t.then=="function")throw Promise.resolve(t).catch(()=>{}),new TypeError("[MachTable] Summary numeric callbacks must return synchronous values.");return t}var h={zero:()=>0,add:(t,n)=>g(t+g(n)),divide:(t,n)=>n===0?null:g(t/n)};function V(t,n){let i=new Map;for(let a of t)(a.kind==="sum"||a.kind==="ratio")&&i.set(a.id,{value:d(n.zero()),denominator:d(n.zero())});return{rowCount:0,totals:i}}function x(t,n,i,a){n.rowCount++;for(let r of i){if(r.kind==="count"||r.kind==="none")continue;let o=n.totals.get(r.id),u=r.kind==="sum"?r.value(t):r.numerator(t);if(u!=null&&u!==""&&(o.value=d(a.add(o.value,u))),r.kind==="ratio"){let m=r.denominator(t);m!=null&&m!==""&&(o.denominator=d(a.add(o.denominator,m)))}}}function P(t,n,i){let a=Object.create(null);for(let r of n)if(r.kind!=="none")if(r.kind==="count")a[r.id]=t.rowCount;else{let o=t.totals.get(r.id);a[r.id]=r.kind==="sum"?o.value:d(i.divide(o.value,o.denominator))}return a}function E(t,n){let i=new Set;for(let o of n.metrics){if(!o.id||i.has(o.id))throw new TypeError("[MachTable] Summary metric IDs must be non-empty and unique.");i.add(o.id)}let a=n.numeric??h,r=new Map;n.groupBy||r.set(void 0,V(n.metrics,a));for(let o of t){let u=n.groupBy?.(o);if(n.groupBy&&typeof u!="string"&&(typeof u!="number"||!Number.isFinite(u)))throw new TypeError("[MachTable] Summary group keys must be strings or finite numbers.");let m=r.get(u);m||(m=V(n.metrics,a),r.set(u,m)),x(o,m,n.metrics,a)}return{scope:n.scope,groups:[...r].map(([o,u])=>({key:o,rowCount:u.rowCount,values:P(u,n.metrics,a)}))}}export{k as createDictionaryColumn,E as summarizeRows};
@@ -27,4 +27,4 @@ interface CachedDictionary<TKey extends DictionaryKey = DictionaryKey> {
27
27
  /** Bounded TTL/LRU resolver; pending entry identity isolates invalidated generations. */
28
28
  declare function createCachedDictionary<TKey extends DictionaryKey = DictionaryKey>(options: CachedDictionaryOptions<TKey>): CachedDictionary<TKey>;
29
29
 
30
- export { type CachedDictionary as C, type DictionaryKey as D, type DictionaryEntry as a, type CachedDictionaryOptions as b, createCachedDictionary as c };
30
+ export { type CachedDictionary as C, type DictionaryKey as D, type CachedDictionaryOptions as a, type DictionaryEntry as b, createCachedDictionary as c };
@@ -27,4 +27,4 @@ interface CachedDictionary<TKey extends DictionaryKey = DictionaryKey> {
27
27
  /** Bounded TTL/LRU resolver; pending entry identity isolates invalidated generations. */
28
28
  declare function createCachedDictionary<TKey extends DictionaryKey = DictionaryKey>(options: CachedDictionaryOptions<TKey>): CachedDictionary<TKey>;
29
29
 
30
- export { type CachedDictionary as C, type DictionaryKey as D, type DictionaryEntry as a, type CachedDictionaryOptions as b, createCachedDictionary as c };
30
+ export { type CachedDictionary as C, type DictionaryKey as D, type CachedDictionaryOptions as a, type DictionaryEntry as b, createCachedDictionary as c };
package/dist/index.cjs CHANGED
@@ -1,4 +1,4 @@
1
- "use strict";var lr=Object.defineProperty;var mo=Object.getOwnPropertyDescriptor;var go=Object.getOwnPropertyNames;var yo=Object.prototype.hasOwnProperty;var vo=(n,e)=>{for(var t in e)lr(n,t,{get:e[t],enumerable:!0})},bo=(n,e,t,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of go(e))!yo.call(n,i)&&i!==t&&lr(n,i,{get:()=>e[i],enumerable:!(r=mo(e,i))||r.enumerable});return n};var wo=n=>bo(lr({},"__esModule",{value:!0}),n);var Ya={};vo(Ya,{BUILTIN_AGG_FUNCS:()=>Ae,DEFAULT_LOCALE:()=>x,EVENT_TYPES:()=>ge,LOCALE_EN:()=>Ui,actionsColumn:()=>Zn,advancedFilterCondition:()=>ni,advancedFilterGroup:()=>oi,applyGridViewState:()=>ei,buildColDefsFromSchema:()=>jn,captureGridViewState:()=>Qr,clearGridState:()=>Ln,createActionButtonsRenderer:()=>we,createAggResolver:()=>rt,createBusinessColumnTypes:()=>ao,createCachedDictionary:()=>Zr,createColumnHelper:()=>eo,createDictionaryRenderer:()=>lo,createEnterprisePreset:()=>ro,createGrid:()=>Wn,createGridViewManager:()=>po,createLocalGridStateStore:()=>Hr,createLocalGridViewStore:()=>ti,createMachTableCommands:()=>qn,createMachTablePreset:()=>Xr,createProgressBarRenderer:()=>_r,createRemoteExportRequest:()=>$n,createRowActionsRenderer:()=>er,createStatusTagRenderer:()=>zr,defineColumns:()=>to,defineGridOptions:()=>no,defineMachTableConfig:()=>oo,defineMachTablePreset:()=>io,describeFilter:()=>Ft,downloadFile:()=>Gt,dragColumn:()=>Jn,escapeHtml:()=>de,formatText:()=>K,formatTwo:()=>me,getByPath:()=>_,indexColumn:()=>Xn,isColDefGroup:()=>fe,isSafePath:()=>_e,linkRenderer:()=>Kr,loadGridState:()=>Xt,matchLocaleKey:()=>Tt,normalizeAdvancedFilterModel:()=>V,normalizeColumnFilter:()=>Ke,normalizeFilterModel:()=>j,normalizeGridState:()=>$,normalizeGridViewState:()=>sr,normalizeSavedGridView:()=>Ce,parseCsv:()=>pt,parseDelimited:()=>ft,parseTsv:()=>ht,resolveGridFeatures:()=>ir,resolveSaveConflict:()=>cn,resolveTagVariant:()=>Jt,rowActionsColumn:()=>Qn,sanitizeFormulaCell:()=>oe,saveGridState:()=>Yt,selectionColumn:()=>Yn,setByPath:()=>ue,toTsv:()=>ut,validateGridOptions:()=>tr,version:()=>qa});module.exports=wo(Ya);var Be="0.35.3";function P(n,e,t=!1){if(!(typeof n!="number"||!Number.isFinite(n)||n<e))return t?Math.floor(n):n}function z(n){return P(n,0)||void 0}function ze(n){return!n||typeof n.key!="string"||!n.key.trim()?null:{key:n.key.trim(),debounceMs:P(n.debounceMs,0,!0)??160,...n.sections?{sections:[...new Set(n.sections)]}:{},...n.store?{store:n.store}:{}}}function A(n,e,t,r=!1){let i=!1;for(let o of t)(r?Object.prototype.hasOwnProperty.call(n,o):n[o]!=null)&&(e[o]=n[o],i=!0);return i}var To=new Set(["__proto__","prototype","constructor"]),Te=new Map;function dr(n){if(typeof n!="string"||n.length===0)return null;let e=Te.get(n);if(e!==void 0)return e;let t=n.split("."),r=t.every(i=>i.length>0&&!To.has(i))?t:null;return n.length<=1024&&(Te.size>=256&&Te.delete(Te.keys().next().value),Te.set(n,r)),r}function _e(n){return dr(n)!==null}function _(n,e){if(n==null)return;let t=dr(e);if(!t)return;let r=n;for(let i of t){if(r==null)return;r=r[i]}return r}function ue(n,e,t){if(n==null)return!1;let r=dr(e);if(!r)return!1;let i=n;for(let o=0;o<r.length-1;o++){if(typeof i!="object"&&typeof i!="function"||i===null)return!1;i[r[o]]==null&&(i[r[o]]={}),i=i[r[o]]}return typeof i!="object"&&typeof i!="function"||i===null?!1:(i[r[r.length-1]]=t,!0)}var he={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 Do=16,Eo=512,xo=20,Ro=2e3,So=2e3,Mo={text:new Set(he.text),number:new Set(he.number),date:new Set(he.date)};function Io(n){return n==null||typeof n=="string"||typeof n=="number"&&Number.isFinite(n)}function Ao(n,e,t){if(n==null||typeof n!="object")return null;let r=n;return typeof r.match!="string"||!t.has(r.match)?null:{match:r.match,...Lo(r,e)}}function Lo(n,e){let t=e==="number"?ri(n.value):typeof n.value=="string"?n.value:void 0,r=e==="number"?ri(n.value2):typeof n.value2=="string"?n.value2:void 0;return{...t!==void 0?{value:t}:{},...r!==void 0?{value2:r}:{}}}function ri(n){return typeof n=="number"&&Number.isFinite(n)?n:void 0}function ko(n,e){let t=[],r=Mo[e];for(let i of n.slice(0,xo)){let o=Ao(i,e,r);o&&t.push(o)}return t}function Ke(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(Io).slice(0,Ro)}: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 Po(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 r=Ke(n.filter);return r?{kind:"condition",colId:t,filter:r}:null}function Go(n,e,t){if(!Array.isArray(n.children))return null;let r=[];for(let i of n.children){let o=ii(i,e+1,t);o&&r.push(o)}return r.length===0?null:{kind:"group",operator:n.operator==="or"?"or":"and",children:r,...n.not===!0?{not:!0}:{}}}function No(n,e,t){return e<=Do&&t.nodes<Eo&&n!=null&&typeof n=="object"}function ii(n,e,t){if(!No(n,e,t)||t.ancestors.has(n))return null;t.ancestors.add(n),t.nodes++;let r=n,i=r.kind==="condition"?Po(r,t):r.kind==="group"?Go(r,e,t):null;return t.ancestors.delete(n),i}function V(n,e){if(n==null||typeof n!="object")return null;let t=n;if(t.version!==1||t.root==null)return null;let r=ii(t.root,0,{ancestors:new WeakSet,nodes:0,validColumnIds:e});return r?{version:1,root:r}:null}function ni(n,e){return{kind:"condition",colId:n,filter:e}}function j(n,e){if(n==null||typeof n!="object"||Array.isArray(n))return{};let t={};for(let[r,i]of Object.entries(n).slice(0,So)){let o=r.trim();if(!o||e?.has(o)===!1)continue;let s=Ke(i);s&&(t[o]=s)}return t}function oi(n,e,t={}){return{kind:"group",operator:n,children:e,...t.not?{not:!0}:{}}}var cr={align:"center",sortable:!0,resizable:!0,movable:!0,filter:!1,minWidth:80},De={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}},Ee={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,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},Oo=Object.keys(Ee);function Fo(n){let e={};for(let t of Oo)e[t]=n[t]??Ee[t];return e}function I(n,e,t,r=!1){return P(n,t,r)??e}function Ho(n){return n&&Object.prototype.hasOwnProperty.call(De,n)?n:"normal"}function Vo(n){return n.theme==="light"||n.theme==="dark"||n.theme==="auto"?n.theme:"light"}function Bo(n,e){let t=typeof n.pagination=="object"&&Array.isArray(n.pagination.pageSizeOptions)?n.pagination.pageSizeOptions:void 0,r=t?[...new Set(t.map(i=>I(i,0,1,!0)).filter(Boolean))]:[10,20,50,100];return r.includes(e)||r.push(e),r.sort((i,o)=>i-o)}function ur(n,e){let t=typeof n=="function"?n(e):_(e,n);return t==null?"":String(t)}function zo(n){let e=n.rowKey,t=e?({data:r})=>ur(e,r):void 0;return{...t?{resolveRowId:t}:{},...e?{rowKey:e}:{}}}function _o(n,e){let t=De[e];return{columnDefs:Array.isArray(n.columnDefs)?n.columnDefs:[],rowData:Array.isArray(n.rowData)?n.rowData:[],defaultColDef:{...cr,...n.defaultColDef??{}},columnTypes:n.columnTypes??{},...zo(n),rowHeight:I(n.rowHeight,t.rowHeight,1),headerHeight:I(n.headerHeight,t.headerHeight,1),rowBuffer:I(n.rowBuffer,8,0,!0),columnLayout:n.columnLayout==="fit"?"fit":"normal",enableColumnResize:n.enableColumnResize===!0,domLayout:n.domLayout==="autoHeight"?"autoHeight":"normal",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 Ko(n){return{rowStyleRules:Array.isArray(n.rowStyleRules)?n.rowStyleRules:[],theme:Vo(n)}}function Wo(n){return{editType:n.editType==="fullRow"?"fullRow":"cell",editableIndicator:n.editableIndicator==="always"||n.editableIndicator==="none"?n.editableIndicator:"hover",rowDragPolicy:n.rowDragPolicy,undoStackSize:I(n.undoStackSize,100,0,!0),asyncTransactionWaitMillis:I(n.asyncTransactionWaitMillis,16,0,!0)}}function $o(n){return{detailRowHeight:I(n.detailRowHeight,240,1)}}function Uo(n){let e=typeof n.pagination=="object"?n.pagination:void 0,t=I(e?.pageSize,20,1,!0);return{paginationEnabled:n.pagination!==!1&&n.datasource==null,paginationMode:e?.mode==="server"?"server":"client",paginationPage:I(e?.page,1,1,!0),paginationTotal:I(e?.total,0,0,!0),paginationPageSize:t,paginationPageSizeOptions:Bo(n,t),paginationShowTotal:e?e.showTotal!==!1:!0,paginationShowSizeSelector:e?e.showPageSizeSelector!==!1:!0}}function hr(n){return{watermarkEnabled:n.watermark!=null&&n.watermark!==!1,watermarkConfig:n.watermark==null||n.watermark===!1?null:n.watermark===!0?{text:"MachTable"}:n.watermark}}function jo(n){return{advancedFilterModel:V(n.advancedFilterModel),persistence:ze(n.persistence),locale:n.locale??{},tooltipShowDelay:I(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"]}}function qo(n){return{datasourceMode:n.datasourceMode==="block"?"block":"sequential",blockSize:I(n.blockSize,100,1,!0),infiniteBufferRows:I(n.infiniteBufferRows,40,0,!0),maxBlocksInCache:I(n.maxBlocksInCache,12,1,!0),datasourceMaxConcurrentRequests:I(n.datasourceMaxConcurrentRequests,4,1,!0),blockPrefetch:I(n.blockPrefetch,1,0,!0),datasourceRowCount:n.datasourceRowCount==null?null:I(n.datasourceRowCount,0,0,!0),dataProcessorMinRows:I(n.dataProcessorMinRows,5e3,1,!0),datasourceRetryCount:I(n.datasourceRetryCount,2,0,!0),datasourceRetryDelay:I(n.datasourceRetryDelay,300,0,!0),datasourceRetryJitter:Math.min(1,I(n.datasourceRetryJitter,.15,0))}}var Yo=["detailRowRenderer","isRowExpandable","aggFuncs","components","actionPolicy","summaryMethod","datasource","getRowHeight","tooltipComponent","getContextMenuItems","initialState","rowEditValidator","isTreeRowExpandable","loadTreeChildren","dataProcessor"];function Xo(n,e){for(let t of Yo)n[t]&&Reflect.set(e,t,n[t])}function Jo(n,e){for(let t of Object.keys(n))t.startsWith("on")&&typeof n[t]=="function"&&Reflect.set(e,t,n[t])}function si(n){let e=Ho(n.size),t={...Fo(n),..._o(n,e),...Ko(n),...Wo(n),...$o(n),...Uo(n),...hr(n),...jo(n),...qo(n),features:Array.isArray(n.features)?n.features:[]};return Xo(n,t),Jo(n,t),t}function ai(n){return Array.isArray(n)?n.filter(e=>typeof e=="string"&&e.length>0):typeof n=="string"&&n.length>0?[n]:[]}function pe(n,e){return ai(n.type).includes(e)}function li(n,e,t={}){let r={};for(let o of ai(n.type)){let s=t[o];s&&Object.assign(r,s)}let i={...e,...r,...n};return i.status&&!i.cellRenderer&&(i.cellRenderer="statusTag"),i}var pr=new WeakMap,We=new WeakMap,$e=new WeakMap;function xe(n){let e=pr.get(n);return e||(e={},pr.set(n,e)),e}function fr(n){return pr.get(n)}function di(n,e){e?We.set(n,e):We.delete(n)}function ci(n){let e=We.get(n);return We.delete(n),e}function ui(n,e){e?$e.set(n,e):$e.delete(n)}function mr(n){let e=$e.get(n);return $e.delete(n),e}function gr(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 k(n,e){let t=fr(e);if(!t)return;t.flashTimer&&clearTimeout(t.flashTimer),t.flashTimer=void 0;let r=t.destroy;if(t.destroy=void 0,t.refresh=void 0,t.rendererDefinition=void 0,t.rendererRowId=void 0,t.rendererColumnId=void 0,!!r)try{r()}catch(i){n.reportError(i,"cellRenderer.destroy",{colId:e.dataset.colId})}}function hi(n,e,t,r,i,o){let s=n.r.tooltipComponent?"":o,a=r.colDef.tooltipValueGetter;if(a)try{s=a({api:n.api,colDef:r.colDef,column:r,node:t,data:t.data,value:i})??o}catch(l){n.reportError(l,"tooltipValueGetter",{colId:r.id,rowId:t.id})}s?e.setAttribute("title",s):e.removeAttribute("title")}function Zo(n,e,t,r,i,o){let s=fr(e);if(!s?.refresh||s.rendererDefinition!==i||s.rendererRowId!==t.id||s.rendererColumnId!==r.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:r.id,rowId:t.id}),!1}}function te(n,e,t){return q(n,e,t,n.d(e,t))}function q(n,e,t,r){let i=t.colDef.valueFormatter;if(i)try{let o=i({api:n.api,colDef:t.colDef,column:t,node:e,data:e.data,value:r});return o==null?"":String(o)}catch(o){n.reportError(o,"valueFormatter",{colId:t.id,rowId:e.id})}return gr(r)}function Ue(n,e,t,r){let i=r.colDef.cellStyle,o=xe(e),s=o.styleKeys;if(s)for(let d of s)Reflect.set(e.style,d,"");if(!i){o.styleKeys=void 0;return}let a;if(typeof i=="function"){let d=n.d(t,r);try{a=i({api:n.api,colDef:r.colDef,column:r,node:t,data:t.data,value:d,rowIndex:t.rowIndex})}catch(c){n.reportError(c,"cellStyle",{colId:r.id,rowId:t.id}),a=null}}else a=i;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 je(n,e,t,r){let i=n.d(t,r),o=te(n,t,r),s=r.colDef.cellRenderer,a=typeof s=="string"?n.lc(s):s;if(a){let l={api:n.api,colDef:r.colDef,column:r,node:t,data:t.data,value:i,formatted:o,rowIndex:t.rowIndex,rendererParams:r.colDef.cellRendererParams};if(Zo(n,e,t,r,a,l)){hi(n,e,t,r,i,o);return}k(n,e);let d;try{d=a(l)}catch(c){n.reportError(c,"cellRenderer",{colId:r.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 c=d;e.replaceChildren(c.el);let u=xe(e);u.destroy=c.destroy,c.refresh&&(u.refresh=h=>c.refresh(h),u.rendererDefinition=a,u.rendererRowId=t.id,u.rendererColumnId=r.id)}else e.textContent=""}else k(n,e),e.textContent=o;hi(n,e,t,r,i,o)}function Qo(n,e,t){let r=e.colDef.align;if(r==="center"){n.push("mach-cell--center");return}if(r==="right"){n.push("mach-cell--right");return}(pe(e.colDef,"rightAligned")||pe(e.colDef,"numericColumn")||typeof t=="number")&&n.push("mach-cell--num")}function es(n,e,t,r,i){let o=r.colDef.cellClass;if(!o)return;if(typeof o=="string"){e.push(o);return}if(Array.isArray(o)){e.push(...o);return}let s={api:n.api,colDef:r.colDef,column:r,node:t,data:t.data,value:i,rowIndex:t.rowIndex};try{let a=o(s);typeof a=="string"?e.push(a):Array.isArray(a)&&e.push(...a)}catch(a){n.reportError(a,"cellClass",{colId:r.id,rowId:t.id})}}function ts(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 Re(n,e,t,r){let i=n.d(t,r),o=["mach-cell"];Qo(o,r,i),es(n,o,t,r,i),ts(o,e,r);let s=o.join(" ");e.className!==s&&(e.className=s)}function Se(n,e){return n&&Object.prototype.hasOwnProperty.call(n,e)?n[e]:void 0}function qe(n,e){if(n==null||n===""||!e||typeof e!="object")return;let t=Se(e,String(n));return typeof t=="string"?{color:t}:t}var Ye=class{constructor(e){this.e=e;this.Xn="";this.kr=!0}Jn(){var i;let e=getComputedStyle(this.e.o.root),t=`${e.getPropertyValue("--mach-header-font-weight")||650} ${e.fontSize} ${e.fontFamily}`;this[i="kr"]||(this[i]=t!==this.Xn),this.Xn=t;let r=!1;for(let o of this.e.n.c()){if(!this.kr&&o.minWidth!=null)continue;let s=o.colDef;if(o.minWidth=this.dc(o),o.manualWidth==null&&s.width==null&&s.autoWidth!==!1&&!o.hasCheckbox&&!o.isDetailToggle){let a=this.ma(o);r=a!==o.contentWidth||r,o.contentWidth=a}}return this.kr=!1,r}ga(e){return this.Lr===void 0&&(this.Lr=document.createElement("canvas").getContext("2d")),this.Lr?(this.Lr.font=this.Xn,this.Lr.measureText(e).width):e.replace(/[^\x00-\xff]/g,"mm").length*7}dc(e){let t=e.colDef,r=t.headerName??t.field??e.id;return Math.ceil(Math.max(t.minWidth??0,this.ga(r)+r.length*.15+28+(e.sortable?20:0)+(e.filterable?28:0)+(this.e.r.columnMenu&&!e.hasCheckbox&&!t.suppressColumnMenu?22:0)))}ma(e){let t=28,r=this.e.i.be(),i=Math.min(r.length,100);for(let o=0;o<i;o++){let s=r[i===1?0:Math.floor(o*(r.length-1)/(i-1))],a=this.e.d(s,e),l=qe(a,e.colDef.status)?.label??q(this.e,s,e,a);t=Math.max(t,this.ga(l.slice(0,128))+(e.colDef.status?44:28))}return Math.ceil(Math.min(z(e.colDef.maxWidth)??360,t))}};function f(n,e,t){let r=document.createElement(n);if(e&&(r.className=e),t)for(let i of Object.keys(t))r.setAttribute(i,t[i]);return r}function G(n,e){if(n.classList.add("mach-portal"),!e)return;let t=window.getComputedStyle(e);for(let r=0;r<t.length;r++){let i=t.item(r);if(!i.startsWith("--mach-"))continue;let o=t.getPropertyValue(i).trim();o&&n.style.setProperty(i,o)}n.style.colorScheme=t.colorScheme}function E(n,e,t){return n<e?e:n>t?t:n}function Y(n,e,t=4){let r=e.getBoundingClientRect(),i=n.getBoundingClientRect(),o=r.bottom+t,s=o+i.height>window.innerHeight-8?r.top-i.height-t:o;n.style.left=`${E(r.left,8,Math.max(8,window.innerWidth-i.width-8))}px`,n.style.top=`${E(s,8,Math.max(8,window.innerHeight-i.height-8))}px`}var pi=0;function fi(n="rg"){return pi++,`${n}-${pi}`}var mi='<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>',gi='<svg viewBox="0 0 16 16" width="10" height="10" fill="currentColor"><path d="M8 3l4 5H4l4-5z"/></svg>',yi='<svg viewBox="0 0 16 16" width="10" height="10" fill="currentColor"><path d="M8 13l4-5H4l4 5z"/></svg>',vi='<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 Xe=class{constructor(e){this.cc=e;this.Di=new Map}on(e,t){let r=this.Di.get(e);return r||(r=new Set,this.Di.set(e,r)),r.add(t),()=>{r.delete(t)}}once(e,t){let r=this.on(e,i=>{r(),t(i)});return r}emit(e,t){let r=this.Di.get(e);if(r)for(let i of[...r])try{i(t)}catch(o){console.error(`[mach-table] error in "${e}" listener`,o),this.cc?.(o,e)}}clear(){this.Di.clear()}};var X=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 r=t.pinned;this.pinned=r===!0?"left":r===!1||r==null?null:r,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=z(this.colDef.flex)??null}};var re=class n{constructor(e,t){this.parent=null;this.children=[];this.groupId=e,this.def=t}get headerName(){return this.def.headerName??this.def.groupId??""}getLeafColumns(e=[]){for(let t of this.children)t instanceof n?t.getLeafColumns(e):e.push(t);return e}};function fe(n){return Array.isArray(n.children)}var Me=150,rs=80;function J(n,e){let t=z(e.minWidth)??rs,r=z(e.maxWidth)??Number.MAX_SAFE_INTEGER,i=z(n)??z(e.width)??Me;return Math.max(t,Math.min(r,i))}function bi(n,e,t,r){let i=r.map((s,a)=>a).filter(s=>r[s]>0),o=t-e.reduce((s,a)=>s+a,0);for(;Math.abs(o)>.001&&i.length;){let s=i.reduce((l,d)=>l+r[d],0),a=0;if(i=i.filter(l=>{let d=e[l];return e[l]=J(d+o*r[l]/s,n[l]),a+=e[l]-d,e[l]!==d}),Math.abs(a)<1e-4)break;o-=a}}function wi(n,e){let t=n.map(r=>J(r.width??Me,r));return e>t.reduce((r,i)=>r+i,0)&&bi(n,t,e,n.map(r=>r.flex??0)),t}function Je(n,e){let t=n.map(r=>J(r.width??Me,r));return Number.isFinite(e)&&e>0&&bi(n,t,e,[...t]),t}var yr="__rg_detail_toggle__";function Ie(n){return z(n)!==void 0}var Ze=class{constructor(e){this.e=e;this.X=[];this.ya=new Map;this.Be=[];this.Zn=[];this.Pr=[];this.Qn=[];this.ze=[];this.eo=[];this.Zt=1;this.to=new Map;this.uc=0}Gr(e){this.eo=e?[...e]:[];let t=new Map(this.X.map(s=>[s.id,s])),r=this.e.r.defaultColDef,i=new Set(this.e.r.masterDetail&&this.e.r.detailToggleColumn?[yr]:[]),o=(s,a,l)=>s.map((d,c)=>{if(fe(d)){let C=d.groupId??d.headerName??`group_${c}_${l}`,R=new re(C,d);return R.parent=a,R.children=o(d.children,R,l+1),R}let u=d,h=u.colId??u.field??`col_${c}`,p=h,m=2;for(;i.has(p);)p=`${h}_${m++}`;i.add(p);let b=new X(p,li(u,r,this.e.r.columnTypes));b.parentGroup=a,b.level=l;let w=t.get(p);return w&&(b.manualWidth=w.manualWidth,b.contentWidth=w.contentWidth,b.flex=w.flex,b.hide=w.hide,b.pinned=w.pinned),b});if(this.Be=o(this.eo,null,0),this.e.r.masterDetail&&this.e.r.detailToggleColumn){let s=new X(yr,{colId:yr,headerName:"",width:38,pinned:"left",sortable:!1,resizable:!1,movable:!1,filter:!1});s.isDetailToggle=!0,this.Be.unshift(s)}if(this.X=this.Ei(this.Be),this.ya=new Map(this.X.map(s=>[s.id,s])),this.Zt=this.X.reduce((s,a)=>Math.max(s,a.level+1),1),this.ze=this.ze.filter(s=>this.X.some(a=>a.id===s.colId)),this.ze.length===0){let s=[];for(let a of this.X)a.colDef.initialSort&&s.push({colId:a.id,direction:a.colDef.initialSort});this.ze=s}this.Qt()}Ei(e,t=[]){for(let r of e)r instanceof re?this.Ei(r.children,t):t.push(r);return t}Qt(){let e=this.X.filter(t=>!t.hide);this.Zn=e.filter(t=>t.pinned==="left"),this.Qn=e.filter(t=>t.pinned==="right"),this.Pr=e.filter(t=>t.pinned===null),this.to.clear(),this.c().forEach((t,r)=>this.to.set(t.id,r))}_e(e){return this.to.get(e)??-1}te(){return this.X}xi(){return this.eo}hc(){return this.Be}pc(){return this.Zt}k(e){return this.ya.get(e)}T(e){return e==="left"?this.Zn:e==="right"?this.Qn:this.Pr}c(){return[...this.Zn,...this.Pr,...this.Qn]}nt(){return this.c().filter(e=>e.colDef.rowGroup===!0)}fc(){return this.c().filter(e=>e.colDef.aggFunc!=null&&e.colDef.rowGroup!==!0)}ro(){return this.Pr.some(e=>e.colDef.colSpan!=null)}va(){let e=this.c();return this.Pr.find(t=>!t.hasCheckbox&&!t.isDetailToggle)??e.find(t=>!t.hasCheckbox&&!t.isDetailToggle)??e[0]}er(e){return e.pinned==="left"?"left":e.pinned==="right"?"right":"center"}ba(e){this.uc=e;let t=e,r=[],i=[];for(let s of this.c()){let a=this.Ri(s);s.pinned!=null||s.colDef.suppressSizeToFit||s.manualWidth!=null?(s.currentWidth=J(a.width??Me,a),t-=s.currentWidth):(r.push(s),i.push(a))}let o=this.e.r.columnLayout==="fit"?Je(i,Math.max(0,t)):wi(i,Math.max(0,t));r.forEach((s,a)=>{s.currentWidth=o[a]})}Ri(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}}Se(e,t){return Ie(t)?(e.manualWidth=J(t,this.Ri(e)),e.flex=null,!0):!1}wa(e,t){return Ie(t)?(e.resetWidth(),e.contentWidth=J(t,this.Ri(e)),!0):!1}no(e,t){let r=this.k(e);!r||r.hide===!t||(r.hide=!t,this.Qt())}At(e,t){let r=this.k(e);if(!r)return!1;let i=this.er(r),o=u=>r.parentGroup?!0:this.er(u)===i,s=r.parentGroup?r.parentGroup.children:this.Be,a=s.filter(u=>u instanceof X&&!u.hide&&o(u)),l=a.indexOf(r);if(l<0)return!1;a.splice(l,1);let d=Math.max(0,Math.min(t,a.length));a.splice(d,0,r);let c=[];return s.forEach((u,h)=>{u instanceof X&&!u.hide&&o(u)&&c.push(h)}),c.length!==a.length?!1:(c.forEach((u,h)=>{s[u]=a[h]}),this.X=this.Ei(this.Be),this.Qt(),!0)}oo(e,t){let r=this.k(e);!r||!r.movable||(r.pinned=t,this.Qt())}Si(){return this.X.map(e=>({colId:e.id,hide:e.hide,width:e.manualWidth??e.currentWidth,flex:e.flex,widthMode:e.manualWidth==null?"auto":"manual",contentWidth:e.contentWidth??void 0,pinned:e.pinned}))}Ca(e){let t=new Map(e.map(r=>[r.colId,r]));for(let r of this.X){let i=t.get(r.id);i&&this.mc(r,i)}this.gc(e),this.Qt()}mc(e,t){typeof t.hide=="boolean"&&(e.hide=t.hide),t.widthMode==="auto"?(e.resetWidth(),Ie(t.flex)&&(e.flex=t.flex)):Ie(t.flex)?(e.flex=t.flex,e.manualWidth=null):this.Se(e,t.width),Ie(t.contentWidth)&&(e.contentWidth=J(t.contentWidth,this.Ri(e))),e.movable&&(t.pinned==="left"||t.pinned==="right"||t.pinned===null)&&(e.pinned=t.pinned)}gc(e){let t=new Map;e.forEach((r,i)=>t.set(r.colId,i));for(let r of["left","center","right"]){let i=[],o=[];this.Be.forEach((s,a)=>{s instanceof X&&!s.hide&&s.parentGroup===null&&s.movable&&this.er(s)===r&&(i.push(a),o.push(s))}),o.sort((s,a)=>(t.get(s.id)??Number.MAX_SAFE_INTEGER)-(t.get(a.id)??Number.MAX_SAFE_INTEGER)),i.forEach((s,a)=>{this.Be[s]=o[a]})}this.X=this.Ei(this.Be)}so(){for(let e of this.X){e.resetWidth(),e.hide=e.colDef.hide??!1;let t=e.colDef.pinned;e.pinned=t===!0?"left":t===!1||t==null?null:t}this.Qt()}J(){return this.ze.map(e=>({...e}))}Nr(e){if(!e||e.length===0){this.ze=[];return}this.ze=e.filter(t=>this.X.some(r=>r.id===t.colId)&&(t.direction==="asc"||t.direction==="desc")).map(t=>({colId:t.colId,direction:t.direction}))}Mi(e,t){let r=[...this.ze],i=r.findIndex(l=>l.colId===e.id),o=i>=0?r[i].direction:null,s=o===null?"asc":o==="asc"?"desc":null;t&&this.e.r.multiSort?s===null?i>=0&&r.splice(i,1):i>=0?r[i]={colId:e.id,direction:s}:r.push({colId:e.id,direction:s}):(r.length=0,s&&r.push({colId:e.id,direction:s})),this.ze=r}};function ie(n,e){if(n instanceof Error)return n;let t=new Error(typeof n=="string"?n:e);return t.name="AbortError",t}var is=()=>ie(void 0,"[MachTable] Operation cancelled.");function Qe(n,e,t=is){return e?new Promise((r,i)=>{let o=()=>{e.removeEventListener("abort",o),i(t())};if(n.then(r,i).finally(()=>e.removeEventListener("abort",o)),e.aborted){o();return}e.addEventListener("abort",o,{once:!0})}):n}function Ci(n){return n==null?"":String(n).toLowerCase()}function ns(n,e,t){let r=Ci(n),i=o=>{let s=(o.value??"").toLowerCase();switch(o.match){case"contains":return r.includes(s);case"notContains":return!r.includes(s);case"equals":return r===s;case"notEquals":return r!==s;case"startsWith":return r.startsWith(s);case"endsWith":return r.endsWith(s);case"blank":return r==="";case"notBlank":return r!=="";default:return!0}};return e.length===0||(t==="or"?e.some(i):e.every(i))}function os(n,e,t){switch(t.match){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<=(t.value2??e);default:return!0}}function ss(n,e){let t=n==null||n==="";if(e.match==="blank")return t;if(e.match==="notBlank")return!t;if(t)return!1;let r=typeof n=="number"?n:Number(n);if(Number.isNaN(r))return!1;let i=e.value;return i==null||Number.isNaN(i)?!1:os(r,i,e)}function as(n,e,t){let r=i=>ss(n,i);return e.length===0||(t==="or"?e.some(r):e.every(r))}function vr(n){if(n==null||n==="")return null;if(n instanceof Date)return isNaN(n.getTime())?null:n.getTime();if(typeof n=="number")return n;let e=Date.parse(String(n));return isNaN(e)?null:e}function ls(n,e,t){let r=vr(n),i=o=>{let s=r==null;if(o.match==="blank")return s;if(o.match==="notBlank")return!s;if(s)return!1;let a=r,l=o.value!=null?vr(o.value):null;if(l==null)return!1;switch(o.match){case"equals":return a===l;case"notEquals":return a!==l;case"lessThan":return a<l;case"greaterThan":return a>l;case"inRange":{let d=o.value2!=null?vr(o.value2):null;return d!=null?a>=l&&a<=d:a>=l}default:return!0}};return e.length===0||(t==="or"?e.some(i):e.every(i))}function ds(n,e){return e.length===0?!0:e.some(t=>t==null&&n==null||t===n)}function Ti(n,e){let t=e.type!=="set"&&e.operator==="or"?"or":"and";switch(e.type){case"text":return ns(n,e.conditions,t);case"number":return as(n,e.conditions,t);case"date":return ls(n,e.conditions,t);case"set":return ds(n,e.values);default:return!0}}function Di(n,e,t){if(n.kind==="condition"){let i=e.get(n.colId);return i?o=>Ti(t(o,i),n.filter):()=>!0}let r=n.children.map(i=>Di(i,e,t));return i=>{let o=n.operator==="or"?r.some(s=>s(i)):r.every(s=>s(i));return n.not?!o:o}}function br(n,e,t,r,i){let o=new Map(n.map(d=>[d.id,d])),s=Object.entries(e).flatMap(([d,c])=>{let u=o.get(d);return u?[{column:u,filter:c}]:[]}),a=t?Di(t.root,o,i):()=>!0,l=r?.trim().toLowerCase().split(/\s+/).filter(Boolean)??[];return d=>!s.every(({column:c,filter:u})=>Ti(i(d,c),u))||!a(d)?!1:l.every(c=>n.some(u=>Ci(i(d,u)).includes(c)))}var Ei=typeof Intl<"u"?new Intl.Collator(void 0,{numeric:!0,sensitivity:"base"}):null;function cs(n,e){let t=n==null||n==="",r=e==null||e==="";return!t&&!r?null:t&&r?0:t?1:-1}function us(n,e){let t=Number.isNaN(n),r=Number.isNaN(e);return t||r?t===r?0:t?1:-1:n-e}function hs(n,e){return n===e?0:n?1:-1}function et(n,e){let t=cs(n,e);if(t!==null)return t;if(typeof n=="number"&&typeof e=="number")return us(n,e);if(n instanceof Date&&e instanceof Date)return n.getTime()-e.getTime();if(typeof n=="boolean"&&typeof e=="boolean")return hs(n,e);let r=String(n),i=String(e);return Ei?Ei.compare(r,i):r.localeCompare(i)}function wr(n,e,t,r){let i=new Map(t.map(a=>[a.id,a])),o=e.flatMap(a=>{let l=i.get(a.colId);return l?[{column:l,compare:l.colDef.comparator??et,direction:a.direction}]:[]}),s=n.map(a=>({node:a,values:o.map(({column:l})=>r(a,l))}));return s.sort((a,l)=>{for(let d=0;d<o.length;d++){let c=o[d],u=c.compare(a.values[d],l.values[d],a.node,l.node);if(u!==0)return c.direction==="asc"?u:-u}return 0}),s.map(({node:a})=>a)}function xi(){return{count:0,numeric:0,sum:0,min:1/0,max:-1/0}}function Ri(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 Si(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 tt(n,e){let t=xi();for(let r of n)Ri(t,r);return Si(t,e)}var Ae={sum:n=>tt(n,"sum"),avg:n=>tt(n,"avg"),count:n=>n.length,min:n=>tt(n,"min"),max:n=>tt(n,"max"),first:n=>n.length>0?n[0]:null,last:n=>n.length>0?n[n.length-1]:null};function Mi(n,e,t){if(e===Ae.count)return n.length;let r=["sum","avg","min","max"].find(o=>e===Ae[o]);if(!r)return e(n.map(t));let i=xi();for(let o of n)Ri(i,t(o));return Si(i,r)}function rt(n){let e={...Ae,...n??{}};return t=>e[t]}var it="group:";function Ii(n){return n==null?"null":n instanceof Date?JSON.stringify(["date",String(n.getTime())]):JSON.stringify([typeof n,Cr(n)])}function Cr(n){return n==null?"(\u7A7A)":String(n)}function Ai(n){return it+JSON.stringify(n)}function ps(n,e,t){let r=new Map;for(let i of n){let o=t(i,e),s=Ii(o),a=r.get(s);a||(a={key:s,label:Cr(o),rows:[]},r.set(s,a)),a.rows.push(i)}return[...r.values()].sort((i,o)=>i.label.localeCompare(o.label,void 0,{numeric:!0,sensitivity:"base"})||i.key.localeCompare(o.key))}function Li(n,e,t,r,i){let o=[],s=(a,l,d)=>{if(l===e.length)return{display:a,leaves:a};let c=[],u=[];for(let h of ps(a,e[l],t)){let p=[...d,[e[l].id,h.key]],m=Ai(p);o.push(m);let b=s(h.rows,l+1,p);if(c.push({id:m,data:null,rowIndex:-1,selected:!1,isGroup:!0,groupLevel:l,groupKey:h.label,leafNodes:b.leaves,aggValues:r(b.leaves)}),i.has(m))for(let w of b.display)c.push(w);if(l>0)for(let w of b.leaves)u.push(w)}return{display:c,leaves:u}};return{rows:s(n,0,[]).display,ids:o}}function ki(n,e,t,r){let i=new Set([...n].filter(l=>l.startsWith("/g0:")));if(!i.size)return{expanded:n,ambiguous:[]};let o=new Map;for(let l of e){let d=[],c="";for(let u=0;u<t.length;u++){let h=r(l,t[u]);if(d.push([t[u].id,Ii(h)]),c+=`/g${u}:${Cr(h)}`,!i.has(c))continue;let p=Ai(d);o.set(c,o.has(c)&&o.get(c)!==p?null:p)}}let s=new Set([...n].filter(l=>!i.has(l))),a=[];for(let l of i){let d=o.get(l);d?s.add(d):d===null?a.push(l):s.add(l)}return{expanded:s,ambiguous:a}}function fs(n,e){let t=n?[n.root]:[];for(;t.length;){let r=t.pop();if(r.kind==="condition")e.add(r.colId);else for(let i of r.children)t.push(i)}}function Pi(n){let e=new Set(Object.keys(n.filterModel));fs(n.advancedFilter,e);let t=new Set(n.sortModel.map(a=>a.colId));for(let a of t)e.add(a);let r=n.columns.some(a=>a.colDef.rowGroup===!0),i=!!n.quickFilter?.trim(),o=n.columns.filter(a=>e.has(a.id)||i||a.colDef.rowGroup===!0||r&&a.colDef.aggFunc!=null),s=new Set;for(let a of o){let l=a.colDef;if(r&&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 Gi(n){return n!=null&&(typeof n=="object"||typeof n=="function")}function Ni(n,e){let t=new WeakMap;for(let r of n){if(r.data==null)continue;let i=e.map(o=>_(r.data,o));i.some(Gi)||t.set(r,i)}return t}function Oi(n,e,t,r){return t.length?!r||n===e||n==null||e==null?!0:t.some((i,o)=>{let s=_(e,i);return Gi(s)||!Object.is(r[o],s)}):!1}function ne(n){return ie(n.reason,"Block request aborted")}function nt(n){return Number.isFinite(n)?Math.max(1,Math.trunc(n)):1}var ot=class{constructor(e,t,r=4){this.maxBlocks=e;this.uo=t;this.maxConcurrentRequests=r;this.re=new Map;this.Z=new Map;this.Ta=0;this.ao=0;this.lo=0;this.Da=0;this.Ea=0;this.Ii=0;this.Ai=new Set;this.maxBlocks=nt(e),this.maxConcurrentRequests=nt(r)}configure(e,t=this.maxConcurrentRequests){this.maxBlocks=nt(e),this.maxConcurrentRequests=nt(t),this.co(),this.Li()}yc(e){this.Ai=e,this.co()}peek(e){let t=this.re.get(e);if(t)return t.touchedAt=++this.Ta,t}has(e){return this.re.has(e)}invalidate(e){let t=this.Z.get(e);t&&(this.Z.delete(e),t.controller.abort(),t.state==="queued"&&t.reject(ne(t.controller.signal)));let r=this.re.get(e);r&&(this.re.delete(e),this.uo?.(e,r))}load(e,t,r,i=0){if(r?.aborted)return Promise.reject(ne(r));let o=this.peek(e);if(o)return this.lo++,Promise.resolve(o);let s=this.Z.get(e);if(s)return this.lo++,s.priority=Math.max(s.priority,i),this.Li(),this.xa(e,s,r);this.Da++;let a=new AbortController,l,d,c=new Promise((p,m)=>{l=p,d=m}),u={controller:a,promise:c,consumers:0,loader:t,priority:i,state:"queued",resolve:l,reject:d};this.Z.set(e,u);let h=this.xa(e,u,r);return this.Li(),h}vc(){this.ao++,this.Ai.clear();for(let e of this.Z.values())e.controller.abort(),e.state==="queued"&&e.reject(ne(e.controller.signal));this.Z.clear();for(let[e,t]of this.re)this.uo?.(e,t);this.re.clear()}snapshot(){let e=0,t=0;for(let r of this.re.values())e+=r.rows.length;for(let r of this.Z.values())r.state==="active"&&t++;return{cachedBlockCount:this.re.size,loadingBlockCount:this.Z.size,activeRequestCount:t,queuedRequestCount:Math.max(0,this.Z.size-t),cachedRowCount:e,hitCount:this.lo,missCount:this.Da,evictionCount:this.Ea}}Li(){for(;this.Ii<this.maxConcurrentRequests;){let e,t;for(let[r,i]of this.Z)i.state!=="queued"||i.controller.signal.aborted||(!t||i.priority>t.priority)&&(e=r,t=i);if(e==null||!t)return;this.bc(e,t)}}bc(e,t){t.state="active",this.Ii++;let r=this.ao;this.wc(t).then(i=>{r===this.ao&&!t.controller.signal.aborted&&(this.re.set(e,{rows:i.rows,...i.lastRow==null?{}:{lastRow:i.lastRow},touchedAt:++this.Ta}),this.co()),t.resolve(i)},t.reject).finally(()=>{this.Ii=Math.max(0,this.Ii-1),this.Z.get(e)===t&&this.Z.delete(e),this.Li()})}wc(e){let{signal:t}=e.controller;return Qe(Promise.resolve().then(()=>{if(t.aborted)throw ne(t);return e.loader(t)}),t,()=>ne(t))}xa(e,t,r){return t.consumers++,new Promise((i,o)=>{let s=!1,a=d=>{s||(s=!0,r?.removeEventListener("abort",l),t.consumers=Math.max(0,t.consumers-1),d())},l=()=>a(()=>{t.consumers===0&&this.Z.get(e)===t&&(this.Z.delete(e),t.controller.abort(r?.reason),t.state==="queued"&&t.reject(ne(t.controller.signal))),o(ne(r))});r?.addEventListener("abort",l,{once:!0}),t.promise.then(d=>a(()=>i(d)),d=>a(()=>o(d instanceof Error?d:new Error(String(d??"Block request failed")))))})}co(){let e=Math.max(this.maxBlocks,this.Ai.size+1);for(;this.re.size>e;){let t=-1,r=Number.POSITIVE_INFINITY;for(let[o,s]of this.re)this.Ai.has(o)||s.touchedAt<r&&(t=o,r=s.touchedAt);if(t<0)return;let i=this.re.get(t);this.re.delete(t),this.Ea++,i&&this.uo?.(t,i)}}};function Le(n,e){if(n==null||typeof n!="object")return;let t=n[e];return Array.isArray(t)?t:void 0}var st=class{constructor(e){this.e=e;this.u=[];this.B=[];this.ie=new Map;this.we=[];this.p=new Map;this.ot={};this.st=null;this.Ke=null;this.P=new Set;this.j=new Set;this.tr=[];this.Or=new Map;this.Ra=[];this.G=null;this.rr=!1;this.Sa=!1;this.at=0;this.ki=null;this.Pi=null;this.Gi=new WeakMap;this.Fr=new WeakMap;this.lt=new Map;this.Hr=new Map;this.Vr=0;this.Ni=0;this.dt=null;this.ct=new Map;this.Lt=new Map;this.Oi=new Set;this.kt=new Map;this.ut=new ot(12,e=>this.Ma(e));this.Br=0;this.Fi=null;this.ho=!1;this.Ia=0;this.ae=[];this.W=1;this.Ur=20;this.st=V(e.r.advancedFilterModel)}resolveRowId(e,t,r){let i=this.e.r.resolveRowId;if(!i)return r;try{let o=i({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 r}get F(){return this.e.r.treeData}get f(){return this.e.r.datasource!=null}get Ce(){return this.f&&this.e.r.datasourceMode==="block"}ir(){if(this.f){if(this.Ce)return this.nr();let e=Math.max(0,this.we.length-this.u.length);return(this.G??this.u.length)+e}return this.we.length}po(){return this.Vr}zr(){return this.Ni}Cc(){return this.Sa}Hi(e){return!this.f||e?.aborted?Promise.resolve():(this.Ni++,this.e.Me(),this.e.api.editing.stop({cancel:!0}),this.e.z.clear(),this.Vi(),this.G=null,this.rr=!1,this.u=[],this.B=[],this.p.clear(),this.P.clear(),this.e._.clear(),this.w(),this.e.h({data:!0}),this.Ce?(this.ut.configure(this.e.r.maxBlocksInCache,this.e.r.datasourceMaxConcurrentRequests),this.Bi(0,e)):this.Aa(0,void 0,e))}Pt(e){this.Sa=e,this.e.o.Pt(e,this.e.y("loading"))}Aa(e,t,r){if(!this.f||this.rr||this.G!=null&&e>=this.G)return Promise.resolve();let i=this.e.r.blockSize,o=t??e+i;if(o<=e)return Promise.resolve();let s=++this.at,a=new AbortController,l=()=>a.abort(r?.reason);return r?.addEventListener("abort",l,{once:!0}),this.ki=a,this.rr=!0,this.Pt(!0),new Promise(d=>{let c=!1;this.Pi=d;let u=h=>{c||(c=!0,r?.removeEventListener("abort",l),s===this.at&&(this.rr=!1,this.ki=null,this.Pi=null,this.Pt(!1),h!=null&&h?.name!=="AbortError"&&this.e.reportError(h,"datasource.getRows",{startRow:e,endRow:o})),d())};this.La(e,o,a.signal,(h,p)=>{if(s!==this.at||this.e.s()||a.signal.aborted){u();return}typeof p=="number"&&p>=0?this.G=p:h.length<o-e&&(this.G=e+h.length);let m=this.u.length===0;this.Tc(h),u(),this.w(),this.e.h({data:!0}),m&&this.e.Te(),this.e.K.zi()},h=>u(a.signal.aborted||this.e.s()?void 0:h??new Error("Datasource request failed")))})}Vi(){this.at++,this.ki?.abort(),this.ki=null,this.rr=!1,this.Pt(!1),this.Pi?.(),this.Pi=null,this.ut.vc(),this.ct.clear(),this.Lt.clear(),this.Oi.clear();for(let[e,t]of this.kt)this.p.get(e)===t&&this.p.delete(e);this.kt.clear()}Tc(e){for(let t of e){if(t==null)continue;let r=this.u.length,i=this.resolveRowId(t,r,`inf-${this.e.or()}`);if(this.p.has(i)){this.e.reportError(new Error(`Duplicate row id: ${i}`),"datasource.getRows",{rowId:i});continue}let o={id:i,data:t,rowIndex:-1,selected:this.e.g.fo(i)};this.u.push(o),this.p.set(i,o),this.B.push(o)}}Bi(e,t,r=0){if(!this.Ce||e<0)return Promise.resolve();if(t?.aborted)return Promise.reject(this.ka(t.reason));let i=this.e.r.blockSize,o=this.at,s=e*i;if(s>=this.nr())return Promise.resolve();let a=this.G==null?s+i:Math.min(this.G,s+i),l=this.ut.load(e,d=>this.Dc(s,a,d),t,r);return this.Pt(this.u.length===0&&this.ut.snapshot().loadingBlockCount>0),l.then(d=>{o!==this.at||t?.aborted||this.e.s()||!this.Ce||!this.ut.has(e)||this.Oi.has(e)||(this.Ec(e,d),this.w(),this.e.h({data:!0}),this.e.K.zi(),o===this.at&&!this.e.s()&&this.Pa(this.e.a.mo().lastExcl-1))}).catch(d=>{throw d?.name!=="AbortError"&&this.e.reportError(d,"datasource.getRows",{startRow:s,endRow:a}),d}).finally(()=>{o===this.at&&this.Pt(this.u.length===0&&this.ut.snapshot().loadingBlockCount>0)})}Dc(e,t,r){return new Promise((i,o)=>{this.La(e,t,r,(s,a)=>i({rows:s,...typeof a=="number"&&a>=0?{lastRow:a}:{}}),s=>o(s instanceof Error?s:new Error(typeof s=="string"?s:"Datasource request failed")))})}La(e,t,r,i,o){let s=this.e.r.datasource,a=0,l=null,d=!1,c=p=>{d||(d=!0,l!=null&&clearTimeout(l),r.removeEventListener("abort",u),p())},u=()=>c(()=>o(this.ka(r.reason)));r.addEventListener("abort",u,{once:!0});let h=()=>{if(d)return;if(r.aborted||this.e.s()){u();return}a++;let p=!1,m=b=>{if(!(p||d)){if(p=!0,r.aborted||this.e.s()){u();return}a<=this.e.r.datasourceRetryCount?l=setTimeout(h,this.retryDelay(a)):c(()=>o(b))}};try{let b=s.getRows({startRow:e,endRow:t,sortModel:this.e.n.J(),filterModel:this.Q(),advancedFilterModel:this.Ie(),quickFilterText:this.Ke,signal:r,onSuccess:(w,C)=>{p||d||(p=!0,c(()=>i(w??[],C)))},fail:m});b&&typeof b.catch=="function"&&b.catch(m)}catch(b){m(b)}};h()}Ec(e,t){let r=this.e.r.blockSize,i=e*r;this.Ma(e),typeof t.lastRow=="number"&&t.lastRow>=0?this.G=t.lastRow:t.rows.length<r&&(this.G=i+t.rows.length),t.rows.forEach((o,s)=>{if(o==null)return;let a=i+s;if(this.G!=null&&a>=this.G)return;let l=this.resolveRowId(o,a,`block-${a}`),d=this.kt.get(l),c=this.p.get(l);if(c&&c!==d&&c.rowIndex!==a){this.e.reportError(new Error(`Duplicate row id: ${l}`),"datasource.getRows",{rowId:l});return}let u=d??{id:l,data:o,rowIndex:a,selected:this.e.g.fo(l)};u.rowIndex=a,u.selected=this.e.g.fo(l),this.kt.delete(l),this.ct.set(a,u),this.Lt.delete(a),this.p.set(l,u),this.Fr.set(u,a+1)}),this.Ga(),this.Oi.add(e)}Ma(e){this.Oi.delete(e);let t=this.e.r.blockSize,r=e*t,i;for(let o=r;o<r+t;o++){let s=this.ct.get(o);s&&(i??(i=new Set(this.e.z.getDirtyRowIds())),this.ct.delete(o),i.has(s.id)?this.kt.set(s.id,s):this.p.get(s.id)===s&&this.p.delete(s.id))}this.Ga()}Ga(){this.u=[...this.ct.entries()].sort(([e],[t])=>e-t).map(([,e])=>e),this.B=this.u}nr(){if(this.G!=null)return this.G;if(this.e.r.datasourceRowCount!=null)return this.e.r.datasourceRowCount;if(this.ct.size===0)return this.e.r.blockSize;let e=0;for(let t of this.ct.keys())e=Math.max(e,t+1);return e+this.e.r.blockSize}xc(e){let t=this.Lt.get(e);if(!t&&(t={id:`__mach_loading_${e}`,data:null,rowIndex:e,selected:!1,loading:!0},this.Lt.set(e,t),this.Lt.size>2e3)){let r=this.Lt.keys().next().value;r!=null&&this.Lt.delete(r)}return t}ka(e){return ie(e,"Operation aborted")}retryDelay(e){let t=Math.min(this.e.r.datasourceRetryDelay*2**Math.max(0,e-1),3e4),r=this.e.r.datasourceRetryJitter;return Math.max(0,Math.round(t*(1+(Math.random()*2-1)*r)))}Rc(e){if(this.Ce){this.Pa(e);return}if(!this.f||this.rr)return;let t=this.u.length;if(this.G!=null&&t>=this.G)return;let r=this.e.r.infiniteBufferRows;if(e+r<t&&e<t)return;let i=this.e.r.blockSize,o=this.G==null?t+i:Math.min(this.G,t+i);this.Aa(t,o)}Pa(e){if(e<0)return;this.Na();let t=this.e.r.blockSize,r=Math.floor(e/t),i=Math.floor(this.e.a.mo().first/t),o=this.e.r.blockPrefetch,s=r<this.Ia?-1:1;this.Ia=r;for(let a=i;a<r;a++)this.Bi(a,void 0,o+2).catch(()=>{});for(let a=0;a<=o;a++){let l=a===0?[r]:[r+s*a,r-s*a];for(let d of l)d<0||d*t>=this.nr()||this.Bi(d,void 0,o-a+1).catch(()=>{})}}We(){return this.Hi().catch(()=>{})}Sc(){return this.Vi(),this.f?this.Hi().catch(()=>{}):(this.G=null,this.ht(this.e.r.rowData),this.e.h({data:!0}),Promise.resolve())}destroy(){this.dt=null,this.Vi(),this.Oa(),this.go(),this.u=this.B=this.we=this.ae=[],this.p.clear(),this.ie.clear(),this.Or.clear(),this.Ra=[],this.P.clear(),this.j.clear(),this.tr=[]}yo(e,t,r){if(!this.Ce)return Promise.resolve();this.Na();let i=this.e.r.blockSize,o=Math.max(0,Math.trunc(e)),s=Math.min(this.nr(),Math.max(o,Math.trunc(t))),a=Math.floor(o/i),l=Math.max(a,Math.floor(Math.max(o,s-1)/i)),d=[];for(let c=a;c<=l;c++)d.push(this.Bi(c,r,100));return Promise.all(d).then(()=>{})}vo(){this.Ce&&(this.Ni++,this.e.Me(),this.e.api.editing.stop({cancel:!0}),this.e.z.clear(),this.Vi(),this.e._.clear(),this.u=[],this.B=[],this.p.clear(),this.w(),this.e.h({data:!0}))}bo(){return this.ut.snapshot()}Na(){let e=new Set(this.e.z.getDirtyRowIds());for(let[l,d]of this.kt)e.has(l)||(this.kt.delete(l),this.p.get(l)===d&&this.p.delete(l));let t=this.e.r.blockSize,r=new Set,{first:i,lastExcl:o}=this.e.a.mo();for(let l=i;l<o;l+=t)r.add(Math.floor(l/t));o>i&&r.add(Math.floor((o-1)/t));let s=this.e.a.D;s&&r.add(Math.floor(s.rowIndex/t));let a=this.e.l.Mc();a!=null&&r.add(Math.floor(a/t)),this.ut.yc(r)}ht(e){this.Ni++,this.e.Me(),this.e.api.editing.stop({cancel:!0}),this.Oa(),this.e.z.clear();let t=this.e.r.resolveRowId,r=this.e.r.childrenKey,i=[],o=[],s=new Map,a=new Map,l=0,d=(c,u,h)=>{let p=l++,m=this.resolveRowId(c,p,`auto-${p}`);if(s.has(m))return this.e.reportError(new Error(`Duplicate row id: ${m}`),"rowData",{rowId:m,index:p}),null;let b=this.F?Le(c,r):void 0,w={id:m,data:c,rowIndex:-1,selected:!1,treeChildrenLoaded:Array.isArray(b)};if(this.Gi.set(w,u),i.push(w),s.set(m,w),h!=null){let C=a.get(h)??[];C.push(m),a.set(h,C)}else o.push(w);if(this.F&&Array.isArray(b))for(let C of b)C!=null&&d(C,u+1,m);return w};(e??[]).forEach(c=>{c!=null&&d(c,0,null)}),this.u=i,this.B=o,this.ie=a,this.p=s,this.e._.clear();for(let c of[...this.P])s.has(c)||this.P.delete(c);if(this.e.r.defaultExpandAll)for(let c of i)this.Fa(c.id)>0&&this.P.add(c.id);this.e.g.Ha(t!=null),this.w()}_r(e){return this.ie.get(e)??[]}Fa(e){return this.ie.get(e)?.length??0}wo(e){return this.Fa(e)>0}isTreeRowLoading(e){return this.p.get(e)?.treeLoading===!0}Oa(){for(let e of this.lt.values())e.abort();this.lt.clear(),this.Hr.clear()}loadTreeChildren(e,t=!1){let r=this.p.get(e),i=this.e.r.loadTreeChildren;if(!this.F||!r?.data||!i)return Promise.resolve([]);if(!t&&r.treeChildrenLoaded)return Promise.resolve(this._r(e).flatMap(l=>{let d=this.p.get(l)?.data;return d==null?[]:[d]}));let o=this.Hr.get(e);if(o&&!t)return o;this.lt.get(e)?.abort();let s=new AbortController;this.lt.set(e,s),r.treeLoading=!0,r.treeLoadError=void 0,this.e.h({data:!0});let a=Promise.resolve().then(()=>i({data:r.data,node:r,api:this.e.api,signal:s.signal})).then(l=>{if(s.signal.aborted||this.e.s())return[];if(!Array.isArray(l))throw new TypeError("[MachTable] loadTreeChildren must resolve to an array.");return this.Ic(r,l),r.treeChildrenLoaded=!0,r.treeLoadError=void 0,this.e.emit("treeChildrenLoaded",{rowId:e,rowNode:r,children:l}),l}).catch(l=>{if(s.signal.aborted||l?.name==="AbortError")return[];throw r.treeLoadError=l,r.treeChildrenLoaded=!1,this.e.reportError(l,"treeData.loadChildren",{rowId:e}),this.e.emit("treeChildrenLoadFailed",{rowId:e,rowNode:r,error:l}),l}).finally(()=>{this.lt.get(e)===s&&(this.lt.delete(e),this.Hr.delete(e),r.treeLoading=!1,this.e.h({data:!0}))});return this.Hr.set(e,a),a}Ic(e,t){let r=new Set,i=[...this._r(e.id)];for(;i.length>0;){let s=i.pop();r.has(s)||(r.add(s),i.push(...this._r(s)))}this.Ac(t,r);for(let s of r)this.lt.get(s)?.abort(),this.lt.delete(s),this.Hr.delete(s),this.ie.delete(s),this.p.delete(s),this.P.delete(s);this.ie.delete(e.id);let o=this.Co(e)+1;for(let s of t)s!=null&&this.To(e,s,o);this.Va(),this.e.g.Ha(this.e.r.resolveRowId!=null),this.w(),this.e.h({data:!0})}Ac(e,t){let r=this.e.r.resolveRowId,i=r?new Set([...this.p.keys()].filter(l=>!t.has(l))):null,o=new WeakSet,s=[...e],a=0;for(;s.length>0;){let l=s.pop();if(l==null)continue;if(typeof l=="object"){if(o.has(l))throw new TypeError("[MachTable] Lazy tree children contain a cyclic object graph.");o.add(l)}if(r&&i){let c=r({data:l,index:a++,api:this.e.api});if(typeof c!="string"||c.length===0)throw new TypeError("[MachTable] rowKey must resolve to a non-empty identifier for lazy tree children.");if(i.has(c))throw new Error(`Duplicate row id: ${c}`);i.add(c)}let d=Le(l,this.e.r.childrenKey);d&&s.push(...d)}}Kr(e,t=!0){let r=this.e.r.resolveRowId,i=[],o=[],s=[];if(e.remove?.length){let l=new Set,d=new Set,c=h=>{if(r){let m=[this.resolveRowId(h,-1,`__missing_remove_${this.e.or()}`)];for(;m.length>0;){let b=m.pop();if(!l.has(b)){l.add(b);for(let w of this.ie.get(b)??[])m.push(w)}}}else{let p=[h];for(;p.length>0;){let m=p.pop();d.add(m);let b=this.F?Le(m,this.e.r.childrenKey):void 0;if(b)for(let w of b)p.push(w)}}};e.remove.forEach(c),this.u=this.u.filter(h=>{let p=l.has(h.id)||h.data!=null&&d.has(h.data);return p&&(s.push(h.id),this.p.delete(h.id),this.ie.delete(h.id)),!p});let u=new Set(this.u);this.B=this.B.filter(h=>u.has(h))}if(e.update?.length)for(let l of e.update){let d;r?d=this.p.get(this.resolveRowId(l,-1,`__missing_update_${this.e.or()}`)):d=this.u.find(c=>c.data===l),d&&(o.push({node:d,before:d.data,after:l}),d.data=l,s.push(d.id),this.e.a._i(d),i.push(d))}if(e.add?.length){let l=e.addIndex!=null?Math.max(0,Math.min(e.addIndex,this.B.length)):this.B.length,d=[];e.add.forEach((c,u)=>{let h=this.resolveRowId(c,l+u,`add-${this.e.or()}`);if(this.p.has(h)){this.e.reportError(new Error(`Duplicate row id: ${h}`),"transaction.add",{rowId:h});return}let p={id:h,data:c,rowIndex:-1,selected:!1};this.p.set(h,p),this.Gi.set(p,0);let m=this.F?Le(c,this.e.r.childrenKey):void 0;if(m)for(let b of m)b!=null&&this.To(p,b,1);d.push(p)}),this.B=this.B.slice(0,l).concat(d,this.B.slice(l)),this.Va()}let a={pipelineChanged:this.Lc(e,o),updatedRowIds:i.map(l=>l.id)};return this.kc(a,t),this.e.z.Pc(s),a}kc(e,t){e.pipelineChanged&&(this.dt=null),t&&(e.pipelineChanged?this.w():e.updatedRowIds.length&&this.Ba())}Gc(e){if(e.length===0)return{pipelineChanged:!1,updatedRowIds:[]};let t=!1,r=new Set;for(let i of e){let o=this.Kr(i,!1);t||(t=o.pipelineChanged);for(let s of o.updatedRowIds)r.add(s)}return t?this.w():r.size>0&&this.Ba(),{pipelineChanged:t,updatedRowIds:[...r]}}Lc(e,t){if(e.add?.length||e.remove?.length)return!0;if(!t.length)return!1;let r=this.za();if(r===null)return!0;if(!r.length)return!1;let i=this.dt;return!i||r.length!==i.fields.length||r.some((o,s)=>o!==i.fields[s])?!0:t.some(({node:o,before:s,after:a})=>Oi(s,a,r,i.values.get(o)))}za(){if(this.F||this.e.r.masterDetail||this.e.r.getRowHeight||this._a())return null;let e=this.e.n.c();if(e.some(r=>r.colDef.autoHeight===!0||r.colDef.autoRowSpan===!0||r.colDef.rowSpan!=null))return null;let t=!this.e.r.manualFiltering;return Pi({columns:e,customAggregates:this.e.r.aggFuncs,sortModel:this.e.r.manualSorting?[]:this.e.n.J(),filterModel:t?this.ot:{},advancedFilter:t?this.st:null,quickFilter:t?this.Ke:null})}Nc(){let e=this.za();this.dt=e?.length?{fields:e,values:Ni(this.u,e)}:null}Ba(){this.e.emit("modelUpdated",{rowCount:this.ae.length})}To(e,t,r){let i=this.resolveRowId(t,-1,`add-${this.e.or()}`);if(this.p.has(i)){this.e.reportError(new Error(`Duplicate row id: ${i}`),"transaction.add",{rowId:i});return}let o=Le(t,this.e.r.childrenKey),s={id:i,data:t,rowIndex:-1,selected:!1,treeChildrenLoaded:Array.isArray(o)};this.p.set(i,s),this.Gi.set(s,r);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.To(s,l,r+1)}Va(){this.u=[];let e=t=>{this.u.push(t),this.p.has(t.id)||this.p.set(t.id,t);for(let r of this.ie.get(t.id)??[]){let i=this.p.get(r);i&&e(i)}};for(let t of this.B)e(t)}Wr(e){let t=JSON.stringify(this.ot),r=new Set(this.e.n.te().map(o=>o.id));this.ot=j(e,r);let i=JSON.stringify(this.ot)!==t;return i&&(this.dt=null),i}Q(){return{...this.ot}}sr(e){let t=new Set(this.e.n.te().map(s=>s.id)),r=V(e,t),i=JSON.stringify(this.st);this.st=r,this.e.r.advancedFilterModel=r;let o=JSON.stringify(r)!==i;return o&&(this.dt=null),o}Ie(){return V(this.st)}ar(e){let t=e!=null&&e.trim()!==""?e:null;return t===this.Ke?!1:(this.Ke=t,this.dt=null,!0)}$r(){return this.Ke}Do(){return Object.keys(this.ot).length>0||this.st!=null||this.Ke!=null}w(){this.dt=null;let e=this.e.le.start(),t=this.e.n.c(),r=(a,l)=>this.e.d(a,l);if(this.f){this.Oc(e);return}if(this.Fc(e))return;let i,o=[];if(this.F)i=this.Hc(t,r);else{i=this.u,this.Do()&&!this.e.r.manualFiltering&&(i=i.filter(br(t,this.ot,this.st,this.Ke,r)));let l=this.e.n.J();if(l.length>0&&!this.e.r.manualSorting)try{i=wr(i,l,t,r)}catch(c){this.e.reportError(c,"comparator",{sortModel:l})}let d=this.e.n.nt();if(d.length>0){let c=this.Vc(i,d);i=c.rows,o=c.ambiguousExpansions}else if(this.e.r.masterDetail){let c=[];for(let u of i)c.push(u),this.P.has(u.id)&&this.isRowExpandable(u)&&c.push({id:`__detail__${u.id}`,data:u.data,rowIndex:-1,selected:!1,isDetail:!0,masterId:u.id});i=c}}for(let a of this.u)a.rowIndex=-1;let s=0;i.forEach((a,l)=>{a.rowIndex=l,!a.isDetail&&!a.isGroup&&(s++,this.Fr.set(a,s))}),this.ae=i,this.lr(),this.Nc(),this.Ka(r),this.e.emit("modelUpdated",{rowCount:i.length}),this.e.le.Eo(e),this.Bc(o)}Oc(e){this.u.forEach((t,r)=>{this.Ce||(t.rowIndex=r),this.Fr.set(t,this.Ce?t.rowIndex+1:r+1)}),this.we=this.u,this.ae=this.u,this.Or.clear(),this.Vr++,this.e.emit("modelUpdated",{rowCount:this.u.length}),this.e.le.Eo(e)}Fc(e){let t=this.ho;return this.ho=!1,!t&&this._a()?(this.zc(e),!0):(this.go(),!1)}_a(){if(!this.e.r.dataProcessor||this.u.length<this.e.r.dataProcessorMinRows||this.F||this.e.r.masterDetail||this.e.n.nt().length>0)return!1;let e=!this.e.r.manualFiltering&&this.Do(),t=!this.e.r.manualSorting&&this.e.n.J().length>0;return e||t}zc(e){this.go();let t=this.e.r.dataProcessor;if(!t)return;let r=++this.Br,i=new AbortController;this.Fi=i;let o=this.e.n.c(),s=this.u.flatMap(d=>d.data==null?[]:[{id:d.id,data:d.data}]),a=!this.e.r.manualFiltering,l=!this.e.r.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.n.J():[],filterModel:a?this.Q():{},advancedFilterModel:a?this.Ie():null,quickFilterText:a?this.Ke:null,signal:i.signal})).then(d=>{if(r!==this.Br||i.signal.aborted||this.e.s())return;let c=new Set,u=[];for(let p of d.rowIds){if(c.has(p))continue;c.add(p);let m=this.p.get(p);m&&!m.isDetail&&!m.isGroup&&u.push(m)}for(let p of this.u)p.rowIndex=-1;u.forEach((p,m)=>{p.rowIndex=m,this.Fr.set(p,m+1)}),this.ae=u,this.lr();let h=(p,m)=>this.e.d(p,m);this.Ka(h),this.e.emit("modelUpdated",{rowCount:u.length}),this.e.le.Eo(e),this.e.h({data:!0})}).catch(d=>{r!==this.Br||i.signal.aborted||this.e.s()||(this.e.reportError(d,"dataProcessor.process"),this.ho=!0,this.w(),this.e.h({data:!0}))}).finally(()=>{r===this.Br&&(this.Fi=null)})}go(){this.Br++,this.Fi?.abort(),this.Fi=null}get Ae(){return this.e.r.paginationEnabled&&!this.f}lr(){if(!this.Ae){this.we=this.ae,this.Vr++;return}let e=this.jr(),t=this.getPageCount();if(this.W>t&&(this.W=t),this.W<1&&(this.W=1),this.e.r.paginationPage=this.W,this.e.r.paginationMode==="server"){this.ae.forEach((o,s)=>{o.rowIndex=s}),this.we=this.ae,this.Vr++;return}let r=(this.W-1)*e,i=this.ae.slice(r,r+e);i.forEach((o,s)=>{o.rowIndex=s}),this.we=i,this.Vr++}jr(){return this.Ur=this.e.r.paginationPageSize,Math.max(1,this.Ur)}qr(){return this.Ae?this.W:1}getTotalRowCount(){return this.f?this.ir():this.Ae&&this.e.r.paginationMode==="server"?this.e.r.paginationTotal:this.ae.length}getPageCount(){return this.Ae?Math.max(1,Math.ceil(this.getTotalRowCount()/this.jr())):1}Wa(){return this.ae}setPage(e,t=!1){if(!this.Ae)return;let r=this.getPageCount(),i=Math.max(1,Math.min(Math.round(e)||1,r));i!==this.W&&(this.W=i,this.e.r.paginationPage=i,this.lr(),this.e.h({data:!0}),this.e.a.dr(0,"top"),t||this.Ki())}setPageSize(e){if(!this.Ae)return;let t=Math.max(1,Math.round(e)||this.jr()),r=(this.W-1)*this.jr();this.e.r.paginationPageSize=t,this.Ur=t,this.W=Math.floor(r/t)+1,this.e.r.paginationPage=this.W,this.lr(),this.e.h({data:!0}),this.Ki()}$a(e,t){this.Ur=Math.max(1,Math.round(t)||1),this.e.r.paginationPageSize=this.Ur,this.W=Math.max(1,Math.round(e)||1),this.e.r.paginationPage=this.W}Wi(e){this.e.r.paginationEnabled!==e&&(this.e.r.paginationEnabled=e&&!this.f,this.e.r.paginationEnabled&&(this.W=1),this.lr(),this.e.h({data:!0}),this.Ki())}_c(){this.Ae&&(this.W=this.e.r.paginationMode==="server"?this.e.r.paginationPage:1,this.lr(),this.e.h({data:!0}),this.Ki())}Ki(){this.e.emit("paginationChanged",{page:this.qr(),pageSize:this.jr(),pageCount:this.getPageCount(),total:this.getTotalRowCount()})}Hc(e,t){let r=this.e.r.manualSorting?[]:this.e.n.J(),i=new Map,o=this.Do()&&!this.e.r.manualFiltering,s=br(e,this.ot,this.st,this.Ke,t),a=c=>{let u=i.get(c.id);if(u!==void 0)return u;let h=!0;if(o){h=s(c);for(let p of this.ie.get(c.id)??[]){let m=this.p.get(p);m&&a(m)&&(h=!0)}}return i.set(c.id,h),h},l=[],d=c=>{let u=c;r.length>0&&(u=wr(c,r,e,t));for(let h of u)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.B),l}Kc(){let e=this.Ra,t=0;for(let r of this.we)!r.isDetail&&!r.isGroup&&(e[t++]=r);return e.length=t,e}Wc(e,t,r,i){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:r,rowIndex:e.rowIndex});return Math.max(1,Math.min(Math.round(s)||1,i))}catch(s){return this.e.reportError(s,"rowSpan",{colId:t.id,rowId:e.id}),1}}$c(e,t,r,i,o){if(!r.colDef.autoRowSpan||i==null||i==="")return 1;let s=1;for(;t+s<e.length&&et(i,o(e[t+s],r))===0;)s++;return s}Uc(e,t,r){let i=new Int32Array(e.length),o=0;for(;o<e.length;){let s=e[o],a=r(s,t),l=t.colDef.rowSpan?this.Wc(s,t,a,e.length-o):this.$c(e,o,t,a,r);i[o]=l;for(let d=1;d<l;d++)i[o+d]=-1;o+=l}return i}Ka(e){if(this.Or.clear(),this.F||this.e.r.masterDetail||this.e.n.nt().length>0)return;let t=this.e.n.c().filter(i=>i.colDef.rowSpan!=null||i.colDef.autoRowSpan===!0);if(t.length===0)return;let r=this.Kc();if(r.length!==0)for(let i of t)this.Or.set(i.id,this.Uc(r,i,e))}jc(e){return this.Or.get(e)}Ua(e){return this.Fr.get(e)??0}Co(e){return this.Gi.get(e)??0}Vc(e,t){let r=rt(this.e.r.aggFuncs),i=this.e.n.fc();this.tr=[];let o=l=>{let d={};for(let c of i){let u=r(c.colDef.aggFunc);if(u)try{d[c.id]=Mi(l,u,h=>this.e.d(h,c))}catch(h){this.e.reportError(h,"aggFunc",{colId:c.id,aggFunc:c.colDef.aggFunc}),d[c.id]=null}}return d},s=ki(this.j,this.u,t,(l,d)=>this.e.d(l,d));this.j=s.expanded;let a=Li(e,t,(l,d)=>this.e.d(l,d),o,this.j);return this.tr=a.ids,{rows:a.rows,ambiguousExpansions:s.ambiguous}}Bc(e){for(let t of e){if(this.e.s())return;this.e.reportError(new Error(`Ambiguous legacy group expansion: ${t}`),"gridState.groupExpansion",{groupId:t})}}isRowExpandable(e){if(this.F){if(this.wo(e.id)||e.treeLoading)return!0;if(e.treeChildrenLoaded||!e.data||!this.e.r.loadTreeChildren)return!1;let r=this.e.r.isTreeRowExpandable;if(!r)return!1;try{return r({data:e.data,node:e,api:this.e.api})}catch(i){return this.e.reportError(i,"isTreeRowExpandable",{rowId:e.id}),!1}}if(!this.e.r.masterDetail)return!1;let t=this.e.r.isRowExpandable;if(t)try{return t({data:e.data,node:e,api:this.e.api})}catch(r){return this.e.reportError(r,"isRowExpandable",{rowId:e.id}),!1}return!0}isRowExpanded(e){return this.P.has(e)}qc(){return[...this.P]}Yc(){return[...this.j]}Xc(e,t){this.P=new Set(e.filter(r=>this.p.has(r))),this.j=new Set(t)}xo(e){return this.Ro(e,!0)}So(e){return this.Ro(e,!1)}$i(e){return this.Ro(e,!this.P.has(e))}Ro(e,t){let r=this.p.get(e);return!r||t&&!this.isRowExpandable(r)?!1:(t===this.P.has(e)||(t?this.P.add(e):this.P.delete(e),this.w(),this.e.h({data:!0}),this.e.emit("detailToggled",{rowId:e,rowNode:r,expanded:t}),t&&this.F&&!this.wo(e)&&!r.treeLoading&&this.loadTreeChildren(e).catch(()=>{})),t)}Mo(){let e=!1;for(let t of this.u)!this.P.has(t.id)&&this.isRowExpandable(t)&&(this.P.add(t.id),e=!0);e&&(this.w(),this.e.h({data:!0}))}Io(){this.P.size!==0&&(this.P.clear(),this.w(),this.e.h({data:!0}))}Ao(e){return this.setGroupExpanded(e,!this.j.has(e))}isGroupExpanded(e){return this.j.has(e)}Lo(){if(this.tr.length===0)return;let e=!1;for(let t of this.tr)this.j.has(t)||(this.j.add(t),e=!0);e&&(this.w(),this.e.h({data:!0}))}ko(){this.j.size!==0&&(this.j.clear(),this.w(),this.e.h({data:!0}))}setGroupExpanded(e,t){return!this.tr.includes(e)||t===this.j.has(e)||(t?this.j.add(e):this.j.delete(e),this.w(),this.e.h({data:!0})),t}ja(){return!this.F&&!this.f&&!this.e.r.dataProcessor&&this.e.r.paginationMode!=="server"&&this.e.n.J().length===0&&this.e.n.nt().length===0}qa(e,t){if(!this.ja()||!Number.isInteger(e)||!Number.isInteger(t))return!1;let r=this.m(e),i=this.m(t);if(!r||!i||r.isDetail||i.isDetail||r.isGroup||i.isGroup)return!1;let o=this.u.indexOf(r),s=this.u.indexOf(i);return o<0||s<0||o===s?!1:(this.u.splice(o,1),this.u.splice(s,0,r),this.w(),this.e.h({data:!0}),!0)}be(){return this.u}Jc(){return this.B}pt(){return this.we}A(){return this.Ce?this.nr():this.we.length}m(e){return this.Ce?e<0||e>=this.nr()?void 0:this.ct.get(e)??this.xc(e):this.we[e]}$(e){return this.p.get(e)}Po(e){this.u.forEach(e)}Go(e){let t=0;for(let r of this.ae)r.isDetail||r.isGroup||e(r,t++)}};var at=class{constructor(e){this.e=e;this.S=new Set;this.$e=null;this.Yr=new Set}fo(e){return this.S.has(e)}Zc(e){return this.Yr.has(e)}Ue(e){if(e.loading)return!1;let t=this.Qc(e),r=t?.colDef.selectable;if(!t||!r)return!0;try{return r({api:this.e.api,colDef:t.colDef,column:t,node:e,data:e.data,value:this.e.d(e,t),rowIndex:e.rowIndex})}catch(i){return this.e.reportError(i,"selectable",{rowId:e.id,colId:t?.id}),!1}}Qc(e){if(!(e.isGroup||e.isDetail))return this.e.n.c().find(t=>t.hasCheckbox&&t.colDef.selectable!=null)}je(){return this.e.i.be().filter(e=>this.S.has(e.id))}Ui(){return this.je().filter(e=>e.data!=null).map(e=>e.data)}ji(){return[...this.S]}eu(e){let t=new Set(e),r=this.e.i.be().filter(i=>t.has(i.id)&&!i.isDetail&&!i.isGroup).map(i=>({node:i,selected:!0}));this.De(r,!0)}Ha(e){if(!e)this.S.clear(),this.$e=null;else{let t=new Set(this.e.i.be().map(r=>r.id));for(let r of[...this.S])t.has(r)||this.S.delete(r);this.$e!=null&&!t.has(this.$e)&&(this.$e=null)}for(let t of this.e.i.be())t.selected=this.S.has(t.id);this.Ya()}Xa(e){let t=e.leafNodes??[];if(t.length===0)return{all:!1,some:!1};let r=0,i=0;for(let o of t)this.Ue(o)&&(r++,this.S.has(o.id)&&i++);return r===0?{all:!1,some:!1}:{all:i===r,some:i>0}}tu(e,t){let r=(e.leafNodes??[]).filter(i=>this.Ue(i));r.length!==0&&this.De(r.map(i=>({node:i,selected:t})))}Ja(e,t,r=!1){this.De([{node:e,selected:t,clearOthers:r}])}No(e,t=!0,r=!0){let i=this.e.i.$(e);i&&this.Ja(i,t,r)}ru(e,t){let r=t==="single";this.De([{node:e,selected:r?!0:!e.selected,clearOthers:r}]),this.$e=e.id}iu(e,t,r){return!r||!t.ctrlKey&&!t.metaKey?!1:(this.De([{node:e,selected:!e.selected}]),this.$e=e.id,!0)}nu(e,t,r){if(!r||!t.shiftKey||this.$e==null)return!1;let i=this.e.i.$(this.$e);if(!i||i.rowIndex<0||e.rowIndex<0)return!1;let o=Math.min(i.rowIndex,e.rowIndex),s=Math.max(i.rowIndex,e.rowIndex),a=[];for(let l=o;l<=s;l++){let d=this.e.i.m(l);d&&!d.isDetail&&!d.isGroup&&this.Ue(d)&&a.push({node:d,selected:!0})}return this.De(a),!0}Za(e,t,r){let i=this.e.r.rowSelection;if(i==="none"||!this.Ue(e))return;if(r){this.ru(e,i);return}let o=i==="multiple";this.iu(e,t,o)||this.nu(e,t,o)||(this.De([{node:e,selected:!0,clearOthers:!0}]),this.$e=e.id)}selectAll(e=!0){let t=this.e.r.rowSelection;if(t==="none")return;let i=(e?this.e.i.pt():this.e.i.be()).filter(o=>!o.isDetail&&!o.isGroup&&this.Ue(o));if(i.length!==0){if(t==="single"){this.De([{node:i[0],selected:!0,clearOthers:!0}]);return}this.De(i.map(o=>({node:o,selected:!0})))}}deselectAll(){this.De([],!0)}ou(){let t=this.e.i.pt().filter(r=>!r.isDetail&&!r.isGroup).filter(r=>this.Ue(r));if(t.length===0)return!1;if(this.e.i.f){let r=this.e.i.ir();if(t.length<r)return!1}return t.every(r=>this.S.has(r.id))}su(){let t=this.e.i.pt().filter(i=>!i.isDetail&&!i.isGroup).filter(i=>this.Ue(i)),r=t.reduce((i,o)=>i+(this.S.has(o.id)?1:0),0);if(r===0)return!1;if(this.e.i.f){let i=this.e.i.ir();if(t.length<i)return!0}return r>0&&r<t.length}au(e,t=!1){this.De(e,t)}lu(e,t,r){!t&&!e.some(i=>i.clearOthers)||(this.S=t?new Set:new Set(e.filter(i=>i.selected).flatMap(i=>r?this.Qa(i.node):[i.node.id])))}du(e,t){for(let r of e){if(!this.Ue(r.node))continue;let i=t?this.Qa(r.node):[r.node.id];for(let o of i)r.selected?this.S.add(o):this.S.delete(o)}}cu(e){let t=new Set;for(let r of new Set([...e,...this.S]))e.has(r)!==this.S.has(r)&&t.add(r);return t}uu(e,t,r){let i=[],o=new Set([...e,...r,...this.Yr]);for(let s of this.e.i.be()){let a=this.S.has(s.id);s.selected=a,(o.has(s.id)||t.get(s.id)!==a)&&s.rowIndex>=0&&i.push(s.rowIndex)}return i}De(e,t=!1){let r=new Set(this.S),i=this.e.i.F&&this.e.r.autoCheckedChildren;this.lu(e,t,i),this.du(e,i);let o=this.cu(r),s=new Map;for(let d of this.e.i.be())s.set(d.id,d.selected);let a=new Set(this.Yr);this.Ya();let l=this.uu(o,s,a);o.size>0&&(this.e.a.ft(l),this.e.K.zi(),this.e.emit("selectionChanged",{selectedNodes:this.je(),selectedRows:this.Ui()}))}Qa(e){let t=[e.id],r=i=>{for(let o of this.e.i._r(i))t.push(o),r(o)};return r(e.id),t}Ya(){if(this.Yr.clear(),!this.e.i.F)return;let e=t=>{let r=this.e.i._r(t);if(r.length===0)return{all:this.S.has(t),some:this.S.has(t)};let i=!0,o=!1;for(let s of r){let a=e(s);a.all?o=!0:(a.some&&(o=!0),i=!1)}return o&&!i&&this.Yr.add(t),i?this.S.add(t):this.S.delete(t),{all:i,some:o}};for(let t of this.e.i.Jc())e(t.id);for(let t of this.e.i.be())t.selected=this.S.has(t.id)}};var lt=class{constructor(e){this.e=e;this.Gt=null;this.ne=0;this.mt=0;this.Le=null;this.Nt=null;this.gt=e=>{let t=this.Fo(e);t&&(this.mt=this.nl(t,e.clientX),t.didResize||(t.didResize=Math.abs(this.mt-t.startWidth)>=.5),!this.ne&&(this.ne=requestAnimationFrame(()=>{this.ne=0,this.fu()})))};this.ke=e=>{let t=this.Fo(e);t&&(this.mt=this.nl(t,e.clientX),t.didResize||(t.didResize=Math.abs(this.mt-t.startWidth)>=.5),this.mu(t))};this.Ft=e=>{this.Fo(e)&&this.Ot()};this.tl=()=>{this.Ot()}}hu(e,t){if(!this.e.r.enableColumnResize||!t.resizable||e.isPrimary===!1)return;this.Ot();let r=e.currentTarget,i=t.currentWidth;this.mt=i,this.Gt={column:t,didResize:!1,handle:r,pointerId:e.pointerId,startFlex:t.flex,startManualWidth:t.manualWidth,startWidth:i,startX:e.clientX},window.addEventListener("pointermove",this.gt),window.addEventListener("pointerup",this.ke,!0),window.addEventListener("pointercancel",this.Ft,!0),r.addEventListener("lostpointercapture",this.tl);try{r.setPointerCapture?.(e.pointerId)}catch{}this.e.o.root.classList.add("mach-root--resizing"),r.classList.add("mach-header-resize--active"),this.pu(this.Gt)}Ot(e=!0){let t=this.Gt;t&&(this.Gt=null,this.Oo(),this.rl(t),e&&(t.column.manualWidth=t.startManualWidth,t.column.flex=t.startFlex,this.e.qe()),this.e.o.root.classList.remove("mach-root--resizing"),this.il(t))}mu(e){this.Gt=null,this.Oo(),e.didResize&&(Math.abs(this.mt-e.startWidth)<.5?(e.column.manualWidth=e.startManualWidth,e.column.flex=e.startFlex):this.e.n.Se(e.column,this.mt),this.e.qe()),this.rl(e);try{e.handle.releasePointerCapture?.(e.pointerId)}catch{}this.e.o.root.classList.remove("mach-root--resizing"),this.il(e),e.didResize&&this.e.cr([e.column])}fu(){let e=this.Gt;!e||!this.e.n.Se(e.column,this.mt)||(this.e.qe(),this.Xr(e),this.e.ol(e.column,!1))}pu(e){this.Le=document.createElement("div"),this.Le.className="mach-column-resize-guide",this.Le.setAttribute("aria-hidden","true"),this.Nt=document.createElement("span"),this.Nt.className="mach-column-resize-label",this.Le.appendChild(this.Nt),this.e.o.root.appendChild(this.Le),this.Xr(e)}Xr(e){if(!this.Le||!this.Nt)return;let t=this.e.o.root,r=t.getBoundingClientRect(),i=e.handle.parentElement.getBoundingClientRect(),o=Math.max(0,Math.min(t.clientWidth,i.right-r.left-t.clientLeft)),s=Math.max(32,Math.min(t.clientWidth-32,o));this.Le.style.left=`${o}px`,this.Le.style.top=`${Math.max(0,i.top-r.top-t.clientTop)}px`,this.Nt.style.left=`${s-o}px`,this.Nt.textContent=`${Math.round(e.column.currentWidth)} px`}il(e){e.handle.classList.remove("mach-header-resize--active"),this.Le?.remove(),this.Le=null,this.Nt=null}nl(e,t){let r=Number.isFinite(t)?t:e.startX;return Math.max(1,e.startWidth+r-e.startX)}Fo(e){let t=this.Gt;return t&&e.pointerId===t.pointerId?t:null}Oo(){this.ne&&cancelAnimationFrame(this.ne),this.ne=0}rl(e){window.removeEventListener("pointermove",this.gt),window.removeEventListener("pointerup",this.ke,!0),window.removeEventListener("pointercancel",this.Ft,!0),e.handle.removeEventListener("lostpointercapture",this.tl)}destroy(){this.Ot(!1),this.Oo(),this.e.o.root?.classList.remove("mach-root--resizing")}};var Fi=6,dt=class{constructor(e){this.e=e;this.Jr=null;this.ur=null;this.Ho=!1;this.de=0;this.qi=null;this.gt=e=>{if(this.ur){this.vu(e);return}let t=this.Jr;t&&(Math.abs(e.clientX-t.startX)<Fi&&Math.abs(e.clientY-t.startY)<Fi||this.bu(e))};this.ke=e=>{this.Jr=null,e.type!=="pointercancel"&&this.ur&&this.zo(e.clientX,e.clientY),this.Vo();let t=this.sl();t&&e.type!=="pointercancel"&&t.targetIndex>=0&&this.e.At(t.column.id,t.targetIndex)}}gu(e,t){e.button===0&&t.movable&&(this.Jr={column:t,startX:e.clientX,startY:e.clientY},window.addEventListener("pointermove",this.gt),window.addEventListener("pointerup",this.ke),window.addEventListener("pointercancel",this.ke))}yu(){let e=this.Ho;return this.Ho=!1,e}bu(e){let t=this.Jr;if(!t)return;let r=this.wu(t.column);if(!r||!r.parentElement){this.Vo();return}this.Ho=!0;let i=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",G(o,this.e.o.root),document.body.appendChild(o),r.parentElement.appendChild(i),r.classList.add("mach-header-cell--dragging"),this.e.o.root.classList.add("mach-root--dragging");let s=this.e.a.Bo(t.column),a=this.e.o.hr[s],l=this.e.n.T(s),d=new Float64Array(l.length+1),c=new Float64Array(l.length);for(let h=0;h<l.length;h++){let p=l[h].currentWidth;c[h]=d[h]+p/2,d[h+1]=d[h]+p}let u=o.getBoundingClientRect();this.ur={column:t.column,cellEl:r,ghost:o,indicator:i,targetIndex:-1,pane:s,containerLeft:a.getBoundingClientRect().left,startScrollLeft:this.e.o.M.center.scrollLeft,fromIndex:l.indexOf(t.column),midpoints:c,offsets:d,ghostWidth:u.width,ghostHeight:u.height},this.zo(e.clientX,e.clientY)}wu(e){let t=this.e.a.Bo(e);return this.e.o.hr[t].querySelector(`.mach-header-cell[data-col-id="${ms(e.id)}"]`)}vu(e){this.qi={clientX:e.clientX,clientY:e.clientY},!this.de&&(this.de=requestAnimationFrame(()=>{this.de=0;let t=this.qi;this.qi=null,t&&this.zo(t.clientX,t.clientY)}))}zo(e,t){let r=this.ur;if(!r)return;let i=E(e+12,8,window.innerWidth-r.ghostWidth-8),o=E(t+12,8,window.innerHeight-r.ghostHeight-8);r.ghost.style.transform=`translate3d(${i}px, ${o}px, 0)`;let s=r.pane==="center"?this.e.o.M.center.scrollLeft-r.startScrollLeft:0,a=e-(r.containerLeft-s),l=r.midpoints.length;for(let d=0;d<r.midpoints.length;d++)if(a<r.midpoints[d]){l=d;break}r.targetIndex=l>r.fromIndex?l-1:l,r.indicator.style.transform=`translate3d(${r.offsets[l]}px, 0, 0)`}sl(){let e=this.ur;return e?(this.ur=null,e.cellEl.classList.remove("mach-header-cell--dragging"),e.ghost.remove(),e.indicator.remove(),this.e.o.root.classList.remove("mach-root--dragging"),e):null}Vo(){window.removeEventListener("pointermove",this.gt),window.removeEventListener("pointerup",this.ke),window.removeEventListener("pointercancel",this.ke),this.de&&cancelAnimationFrame(this.de),this.de=0,this.qi=null}destroy(){this.Vo(),this.sl(),this.Jr=null}};function ms(n){return typeof CSS<"u"&&typeof CSS.escape=="function"?CSS.escape(n):n.replace(/[^a-zA-Z0-9_-]/g,"\\$&")}var Tr=/^[+-]?(?:\d+(?:\.\d+)?|\.\d+)(?:[eE][+-]?\d+)?$/;function ct(n,e=!0){if(n==="")return null;if(!e||typeof n!="string"||!Tr.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 gs(n,e){let t=n==null?"":String(n);return t.includes(e)||t.includes('"')||t.includes(`
1
+ "use strict";var lr=Object.defineProperty;var mo=Object.getOwnPropertyDescriptor;var go=Object.getOwnPropertyNames;var yo=Object.prototype.hasOwnProperty;var vo=(n,e)=>{for(var t in e)lr(n,t,{get:e[t],enumerable:!0})},bo=(n,e,t,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of go(e))!yo.call(n,i)&&i!==t&&lr(n,i,{get:()=>e[i],enumerable:!(r=mo(e,i))||r.enumerable});return n};var wo=n=>bo(lr({},"__esModule",{value:!0}),n);var Ya={};vo(Ya,{BUILTIN_AGG_FUNCS:()=>Ae,DEFAULT_LOCALE:()=>x,EVENT_TYPES:()=>ge,LOCALE_EN:()=>Ui,actionsColumn:()=>Zn,advancedFilterCondition:()=>ni,advancedFilterGroup:()=>oi,applyGridViewState:()=>ei,buildColDefsFromSchema:()=>jn,captureGridViewState:()=>Qr,clearGridState:()=>Ln,createActionButtonsRenderer:()=>we,createAggResolver:()=>rt,createBusinessColumnTypes:()=>ao,createCachedDictionary:()=>Zr,createColumnHelper:()=>eo,createDictionaryRenderer:()=>lo,createEnterprisePreset:()=>ro,createGrid:()=>Wn,createGridViewManager:()=>po,createLocalGridStateStore:()=>Hr,createLocalGridViewStore:()=>ti,createMachTableCommands:()=>qn,createMachTablePreset:()=>Xr,createProgressBarRenderer:()=>_r,createRemoteExportRequest:()=>$n,createRowActionsRenderer:()=>er,createStatusTagRenderer:()=>zr,defineColumns:()=>to,defineGridOptions:()=>no,defineMachTableConfig:()=>oo,defineMachTablePreset:()=>io,describeFilter:()=>Ft,downloadFile:()=>Gt,dragColumn:()=>Jn,escapeHtml:()=>de,formatText:()=>K,formatTwo:()=>me,getByPath:()=>_,indexColumn:()=>Xn,isColDefGroup:()=>fe,isSafePath:()=>_e,linkRenderer:()=>Kr,loadGridState:()=>Xt,matchLocaleKey:()=>Tt,normalizeAdvancedFilterModel:()=>V,normalizeColumnFilter:()=>Ke,normalizeFilterModel:()=>j,normalizeGridState:()=>$,normalizeGridViewState:()=>sr,normalizeSavedGridView:()=>Ce,parseCsv:()=>pt,parseDelimited:()=>ft,parseTsv:()=>ht,resolveGridFeatures:()=>ir,resolveSaveConflict:()=>cn,resolveTagVariant:()=>Jt,rowActionsColumn:()=>Qn,sanitizeFormulaCell:()=>oe,saveGridState:()=>Yt,selectionColumn:()=>Yn,setByPath:()=>ue,toTsv:()=>ut,validateGridOptions:()=>tr,version:()=>qa});module.exports=wo(Ya);var Be="0.36.0";function P(n,e,t=!1){if(!(typeof n!="number"||!Number.isFinite(n)||n<e))return t?Math.floor(n):n}function z(n){return P(n,0)||void 0}function ze(n){return!n||typeof n.key!="string"||!n.key.trim()?null:{key:n.key.trim(),debounceMs:P(n.debounceMs,0,!0)??160,...n.sections?{sections:[...new Set(n.sections)]}:{},...n.store?{store:n.store}:{}}}function A(n,e,t,r=!1){let i=!1;for(let o of t)(r?Object.prototype.hasOwnProperty.call(n,o):n[o]!=null)&&(e[o]=n[o],i=!0);return i}var To=new Set(["__proto__","prototype","constructor"]),Te=new Map;function dr(n){if(typeof n!="string"||n.length===0)return null;let e=Te.get(n);if(e!==void 0)return e;let t=n.split("."),r=t.every(i=>i.length>0&&!To.has(i))?t:null;return n.length<=1024&&(Te.size>=256&&Te.delete(Te.keys().next().value),Te.set(n,r)),r}function _e(n){return dr(n)!==null}function _(n,e){if(n==null)return;let t=dr(e);if(!t)return;let r=n;for(let i of t){if(r==null)return;r=r[i]}return r}function ue(n,e,t){if(n==null)return!1;let r=dr(e);if(!r)return!1;let i=n;for(let o=0;o<r.length-1;o++){if(typeof i!="object"&&typeof i!="function"||i===null)return!1;i[r[o]]==null&&(i[r[o]]={}),i=i[r[o]]}return typeof i!="object"&&typeof i!="function"||i===null?!1:(i[r[r.length-1]]=t,!0)}var he={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 Do=16,Eo=512,xo=20,Ro=2e3,So=2e3,Mo={text:new Set(he.text),number:new Set(he.number),date:new Set(he.date)};function Io(n){return n==null||typeof n=="string"||typeof n=="number"&&Number.isFinite(n)}function Ao(n,e,t){if(n==null||typeof n!="object")return null;let r=n;return typeof r.match!="string"||!t.has(r.match)?null:{match:r.match,...Lo(r,e)}}function Lo(n,e){let t=e==="number"?ri(n.value):typeof n.value=="string"?n.value:void 0,r=e==="number"?ri(n.value2):typeof n.value2=="string"?n.value2:void 0;return{...t!==void 0?{value:t}:{},...r!==void 0?{value2:r}:{}}}function ri(n){return typeof n=="number"&&Number.isFinite(n)?n:void 0}function ko(n,e){let t=[],r=Mo[e];for(let i of n.slice(0,xo)){let o=Ao(i,e,r);o&&t.push(o)}return t}function Ke(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(Io).slice(0,Ro)}: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 Po(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 r=Ke(n.filter);return r?{kind:"condition",colId:t,filter:r}:null}function Go(n,e,t){if(!Array.isArray(n.children))return null;let r=[];for(let i of n.children){let o=ii(i,e+1,t);o&&r.push(o)}return r.length===0?null:{kind:"group",operator:n.operator==="or"?"or":"and",children:r,...n.not===!0?{not:!0}:{}}}function No(n,e,t){return e<=Do&&t.nodes<Eo&&n!=null&&typeof n=="object"}function ii(n,e,t){if(!No(n,e,t)||t.ancestors.has(n))return null;t.ancestors.add(n),t.nodes++;let r=n,i=r.kind==="condition"?Po(r,t):r.kind==="group"?Go(r,e,t):null;return t.ancestors.delete(n),i}function V(n,e){if(n==null||typeof n!="object")return null;let t=n;if(t.version!==1||t.root==null)return null;let r=ii(t.root,0,{ancestors:new WeakSet,nodes:0,validColumnIds:e});return r?{version:1,root:r}:null}function ni(n,e){return{kind:"condition",colId:n,filter:e}}function j(n,e){if(n==null||typeof n!="object"||Array.isArray(n))return{};let t={};for(let[r,i]of Object.entries(n).slice(0,So)){let o=r.trim();if(!o||e?.has(o)===!1)continue;let s=Ke(i);s&&(t[o]=s)}return t}function oi(n,e,t={}){return{kind:"group",operator:n,children:e,...t.not?{not:!0}:{}}}var cr={align:"center",sortable:!0,resizable:!0,movable:!0,filter:!1,minWidth:80},De={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}},Ee={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,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},Oo=Object.keys(Ee);function Fo(n){let e={};for(let t of Oo)e[t]=n[t]??Ee[t];return e}function I(n,e,t,r=!1){return P(n,t,r)??e}function Ho(n){return n&&Object.prototype.hasOwnProperty.call(De,n)?n:"normal"}function Vo(n){return n.theme==="light"||n.theme==="dark"||n.theme==="auto"?n.theme:"light"}function Bo(n,e){let t=typeof n.pagination=="object"&&Array.isArray(n.pagination.pageSizeOptions)?n.pagination.pageSizeOptions:void 0,r=t?[...new Set(t.map(i=>I(i,0,1,!0)).filter(Boolean))]:[10,20,50,100];return r.includes(e)||r.push(e),r.sort((i,o)=>i-o)}function ur(n,e){let t=typeof n=="function"?n(e):_(e,n);return t==null?"":String(t)}function zo(n){let e=n.rowKey,t=e?({data:r})=>ur(e,r):void 0;return{...t?{resolveRowId:t}:{},...e?{rowKey:e}:{}}}function _o(n,e){let t=De[e];return{columnDefs:Array.isArray(n.columnDefs)?n.columnDefs:[],rowData:Array.isArray(n.rowData)?n.rowData:[],defaultColDef:{...cr,...n.defaultColDef??{}},columnTypes:n.columnTypes??{},...zo(n),rowHeight:I(n.rowHeight,t.rowHeight,1),headerHeight:I(n.headerHeight,t.headerHeight,1),rowBuffer:I(n.rowBuffer,8,0,!0),columnLayout:n.columnLayout==="fit"?"fit":"normal",enableColumnResize:n.enableColumnResize===!0,domLayout:n.domLayout==="autoHeight"?"autoHeight":"normal",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 Ko(n){return{rowStyleRules:Array.isArray(n.rowStyleRules)?n.rowStyleRules:[],theme:Vo(n)}}function Wo(n){return{editType:n.editType==="fullRow"?"fullRow":"cell",editableIndicator:n.editableIndicator==="always"||n.editableIndicator==="none"?n.editableIndicator:"hover",rowDragPolicy:n.rowDragPolicy,undoStackSize:I(n.undoStackSize,100,0,!0),asyncTransactionWaitMillis:I(n.asyncTransactionWaitMillis,16,0,!0)}}function $o(n){return{detailRowHeight:I(n.detailRowHeight,240,1)}}function Uo(n){let e=typeof n.pagination=="object"?n.pagination:void 0,t=I(e?.pageSize,20,1,!0);return{paginationEnabled:n.pagination!==!1&&n.datasource==null,paginationMode:e?.mode==="server"?"server":"client",paginationPage:I(e?.page,1,1,!0),paginationTotal:I(e?.total,0,0,!0),paginationPageSize:t,paginationPageSizeOptions:Bo(n,t),paginationShowTotal:e?e.showTotal!==!1:!0,paginationShowSizeSelector:e?e.showPageSizeSelector!==!1:!0}}function hr(n){return{watermarkEnabled:n.watermark!=null&&n.watermark!==!1,watermarkConfig:n.watermark==null||n.watermark===!1?null:n.watermark===!0?{text:"MachTable"}:n.watermark}}function jo(n){return{advancedFilterModel:V(n.advancedFilterModel),persistence:ze(n.persistence),locale:n.locale??{},tooltipShowDelay:I(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"]}}function qo(n){return{datasourceMode:n.datasourceMode==="block"?"block":"sequential",blockSize:I(n.blockSize,100,1,!0),infiniteBufferRows:I(n.infiniteBufferRows,40,0,!0),maxBlocksInCache:I(n.maxBlocksInCache,12,1,!0),datasourceMaxConcurrentRequests:I(n.datasourceMaxConcurrentRequests,4,1,!0),blockPrefetch:I(n.blockPrefetch,1,0,!0),datasourceRowCount:n.datasourceRowCount==null?null:I(n.datasourceRowCount,0,0,!0),dataProcessorMinRows:I(n.dataProcessorMinRows,5e3,1,!0),datasourceRetryCount:I(n.datasourceRetryCount,2,0,!0),datasourceRetryDelay:I(n.datasourceRetryDelay,300,0,!0),datasourceRetryJitter:Math.min(1,I(n.datasourceRetryJitter,.15,0))}}var Yo=["detailRowRenderer","isRowExpandable","aggFuncs","components","actionPolicy","summaryMethod","datasource","getRowHeight","tooltipComponent","getContextMenuItems","initialState","rowEditValidator","isTreeRowExpandable","loadTreeChildren","dataProcessor"];function Xo(n,e){for(let t of Yo)n[t]&&Reflect.set(e,t,n[t])}function Jo(n,e){for(let t of Object.keys(n))t.startsWith("on")&&typeof n[t]=="function"&&Reflect.set(e,t,n[t])}function si(n){let e=Ho(n.size),t={...Fo(n),..._o(n,e),...Ko(n),...Wo(n),...$o(n),...Uo(n),...hr(n),...jo(n),...qo(n),features:Array.isArray(n.features)?n.features:[]};return Xo(n,t),Jo(n,t),t}function ai(n){return Array.isArray(n)?n.filter(e=>typeof e=="string"&&e.length>0):typeof n=="string"&&n.length>0?[n]:[]}function pe(n,e){return ai(n.type).includes(e)}function li(n,e,t={}){let r={};for(let o of ai(n.type)){let s=t[o];s&&Object.assign(r,s)}let i={...e,...r,...n};return i.status&&!i.cellRenderer&&(i.cellRenderer="statusTag"),i}var pr=new WeakMap,We=new WeakMap,$e=new WeakMap;function xe(n){let e=pr.get(n);return e||(e={},pr.set(n,e)),e}function fr(n){return pr.get(n)}function di(n,e){e?We.set(n,e):We.delete(n)}function ci(n){let e=We.get(n);return We.delete(n),e}function ui(n,e){e?$e.set(n,e):$e.delete(n)}function mr(n){let e=$e.get(n);return $e.delete(n),e}function gr(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 k(n,e){let t=fr(e);if(!t)return;t.flashTimer&&clearTimeout(t.flashTimer),t.flashTimer=void 0;let r=t.destroy;if(t.destroy=void 0,t.refresh=void 0,t.rendererDefinition=void 0,t.rendererRowId=void 0,t.rendererColumnId=void 0,!!r)try{r()}catch(i){n.reportError(i,"cellRenderer.destroy",{colId:e.dataset.colId})}}function hi(n,e,t,r,i,o){let s=n.r.tooltipComponent?"":o,a=r.colDef.tooltipValueGetter;if(a)try{s=a({api:n.api,colDef:r.colDef,column:r,node:t,data:t.data,value:i})??o}catch(l){n.reportError(l,"tooltipValueGetter",{colId:r.id,rowId:t.id})}s?e.setAttribute("title",s):e.removeAttribute("title")}function Zo(n,e,t,r,i,o){let s=fr(e);if(!s?.refresh||s.rendererDefinition!==i||s.rendererRowId!==t.id||s.rendererColumnId!==r.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:r.id,rowId:t.id}),!1}}function te(n,e,t){return q(n,e,t,n.d(e,t))}function q(n,e,t,r){let i=t.colDef.valueFormatter;if(i)try{let o=i({api:n.api,colDef:t.colDef,column:t,node:e,data:e.data,value:r});return o==null?"":String(o)}catch(o){n.reportError(o,"valueFormatter",{colId:t.id,rowId:e.id})}return gr(r)}function Ue(n,e,t,r){let i=r.colDef.cellStyle,o=xe(e),s=o.styleKeys;if(s)for(let d of s)Reflect.set(e.style,d,"");if(!i){o.styleKeys=void 0;return}let a;if(typeof i=="function"){let d=n.d(t,r);try{a=i({api:n.api,colDef:r.colDef,column:r,node:t,data:t.data,value:d,rowIndex:t.rowIndex})}catch(c){n.reportError(c,"cellStyle",{colId:r.id,rowId:t.id}),a=null}}else a=i;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 je(n,e,t,r){let i=n.d(t,r),o=te(n,t,r),s=r.colDef.cellRenderer,a=typeof s=="string"?n.lc(s):s;if(a){let l={api:n.api,colDef:r.colDef,column:r,node:t,data:t.data,value:i,formatted:o,rowIndex:t.rowIndex,rendererParams:r.colDef.cellRendererParams};if(Zo(n,e,t,r,a,l)){hi(n,e,t,r,i,o);return}k(n,e);let d;try{d=a(l)}catch(c){n.reportError(c,"cellRenderer",{colId:r.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 c=d;e.replaceChildren(c.el);let u=xe(e);u.destroy=c.destroy,c.refresh&&(u.refresh=h=>c.refresh(h),u.rendererDefinition=a,u.rendererRowId=t.id,u.rendererColumnId=r.id)}else e.textContent=""}else k(n,e),e.textContent=o;hi(n,e,t,r,i,o)}function Qo(n,e,t){let r=e.colDef.align;if(r==="center"){n.push("mach-cell--center");return}if(r==="right"){n.push("mach-cell--right");return}(pe(e.colDef,"rightAligned")||pe(e.colDef,"numericColumn")||typeof t=="number")&&n.push("mach-cell--num")}function es(n,e,t,r,i){let o=r.colDef.cellClass;if(!o)return;if(typeof o=="string"){e.push(o);return}if(Array.isArray(o)){e.push(...o);return}let s={api:n.api,colDef:r.colDef,column:r,node:t,data:t.data,value:i,rowIndex:t.rowIndex};try{let a=o(s);typeof a=="string"?e.push(a):Array.isArray(a)&&e.push(...a)}catch(a){n.reportError(a,"cellClass",{colId:r.id,rowId:t.id})}}function ts(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 Re(n,e,t,r){let i=n.d(t,r),o=["mach-cell"];Qo(o,r,i),es(n,o,t,r,i),ts(o,e,r);let s=o.join(" ");e.className!==s&&(e.className=s)}function Se(n,e){return n&&Object.prototype.hasOwnProperty.call(n,e)?n[e]:void 0}function qe(n,e){if(n==null||n===""||!e||typeof e!="object")return;let t=Se(e,String(n));return typeof t=="string"?{color:t}:t}var Ye=class{constructor(e){this.e=e;this.Xn="";this.kr=!0}Jn(){var i;let e=getComputedStyle(this.e.o.root),t=`${e.getPropertyValue("--mach-header-font-weight")||650} ${e.fontSize} ${e.fontFamily}`;this[i="kr"]||(this[i]=t!==this.Xn),this.Xn=t;let r=!1;for(let o of this.e.n.c()){if(!this.kr&&o.minWidth!=null)continue;let s=o.colDef;if(o.minWidth=this.dc(o),o.manualWidth==null&&s.width==null&&s.autoWidth!==!1&&!o.hasCheckbox&&!o.isDetailToggle){let a=this.ma(o);r=a!==o.contentWidth||r,o.contentWidth=a}}return this.kr=!1,r}ga(e){return this.Lr===void 0&&(this.Lr=document.createElement("canvas").getContext("2d")),this.Lr?(this.Lr.font=this.Xn,this.Lr.measureText(e).width):e.replace(/[^\x00-\xff]/g,"mm").length*7}dc(e){let t=e.colDef,r=t.headerName??t.field??e.id;return Math.ceil(Math.max(t.minWidth??0,this.ga(r)+r.length*.15+28+(e.sortable?20:0)+(e.filterable?28:0)+(this.e.r.columnMenu&&!e.hasCheckbox&&!t.suppressColumnMenu?22:0)))}ma(e){let t=28,r=this.e.i.be(),i=Math.min(r.length,100);for(let o=0;o<i;o++){let s=r[i===1?0:Math.floor(o*(r.length-1)/(i-1))],a=this.e.d(s,e),l=qe(a,e.colDef.status)?.label??q(this.e,s,e,a);t=Math.max(t,this.ga(l.slice(0,128))+(e.colDef.status?44:28))}return Math.ceil(Math.min(z(e.colDef.maxWidth)??360,t))}};function f(n,e,t){let r=document.createElement(n);if(e&&(r.className=e),t)for(let i of Object.keys(t))r.setAttribute(i,t[i]);return r}function G(n,e){if(n.classList.add("mach-portal"),!e)return;let t=window.getComputedStyle(e);for(let r=0;r<t.length;r++){let i=t.item(r);if(!i.startsWith("--mach-"))continue;let o=t.getPropertyValue(i).trim();o&&n.style.setProperty(i,o)}n.style.colorScheme=t.colorScheme}function E(n,e,t){return n<e?e:n>t?t:n}function Y(n,e,t=4){let r=e.getBoundingClientRect(),i=n.getBoundingClientRect(),o=r.bottom+t,s=o+i.height>window.innerHeight-8?r.top-i.height-t:o;n.style.left=`${E(r.left,8,Math.max(8,window.innerWidth-i.width-8))}px`,n.style.top=`${E(s,8,Math.max(8,window.innerHeight-i.height-8))}px`}var pi=0;function fi(n="rg"){return pi++,`${n}-${pi}`}var mi='<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>',gi='<svg viewBox="0 0 16 16" width="10" height="10" fill="currentColor"><path d="M8 3l4 5H4l4-5z"/></svg>',yi='<svg viewBox="0 0 16 16" width="10" height="10" fill="currentColor"><path d="M8 13l4-5H4l4 5z"/></svg>',vi='<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 Xe=class{constructor(e){this.cc=e;this.Di=new Map}on(e,t){let r=this.Di.get(e);return r||(r=new Set,this.Di.set(e,r)),r.add(t),()=>{r.delete(t)}}once(e,t){let r=this.on(e,i=>{r(),t(i)});return r}emit(e,t){let r=this.Di.get(e);if(r)for(let i of[...r])try{i(t)}catch(o){console.error(`[mach-table] error in "${e}" listener`,o),this.cc?.(o,e)}}clear(){this.Di.clear()}};var X=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 r=t.pinned;this.pinned=r===!0?"left":r===!1||r==null?null:r,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=z(this.colDef.flex)??null}};var re=class n{constructor(e,t){this.parent=null;this.children=[];this.groupId=e,this.def=t}get headerName(){return this.def.headerName??this.def.groupId??""}getLeafColumns(e=[]){for(let t of this.children)t instanceof n?t.getLeafColumns(e):e.push(t);return e}};function fe(n){return Array.isArray(n.children)}var Me=150,rs=80;function J(n,e){let t=z(e.minWidth)??rs,r=z(e.maxWidth)??Number.MAX_SAFE_INTEGER,i=z(n)??z(e.width)??Me;return Math.max(t,Math.min(r,i))}function bi(n,e,t,r){let i=r.map((s,a)=>a).filter(s=>r[s]>0),o=t-e.reduce((s,a)=>s+a,0);for(;Math.abs(o)>.001&&i.length;){let s=i.reduce((l,d)=>l+r[d],0),a=0;if(i=i.filter(l=>{let d=e[l];return e[l]=J(d+o*r[l]/s,n[l]),a+=e[l]-d,e[l]!==d}),Math.abs(a)<1e-4)break;o-=a}}function wi(n,e){let t=n.map(r=>J(r.width??Me,r));return e>t.reduce((r,i)=>r+i,0)&&bi(n,t,e,n.map(r=>r.flex??0)),t}function Je(n,e){let t=n.map(r=>J(r.width??Me,r));return Number.isFinite(e)&&e>0&&bi(n,t,e,[...t]),t}var yr="__rg_detail_toggle__";function Ie(n){return z(n)!==void 0}var Ze=class{constructor(e){this.e=e;this.X=[];this.ya=new Map;this.Be=[];this.Zn=[];this.Pr=[];this.Qn=[];this.ze=[];this.eo=[];this.Zt=1;this.to=new Map;this.uc=0}Gr(e){this.eo=e?[...e]:[];let t=new Map(this.X.map(s=>[s.id,s])),r=this.e.r.defaultColDef,i=new Set(this.e.r.masterDetail&&this.e.r.detailToggleColumn?[yr]:[]),o=(s,a,l)=>s.map((d,c)=>{if(fe(d)){let C=d.groupId??d.headerName??`group_${c}_${l}`,R=new re(C,d);return R.parent=a,R.children=o(d.children,R,l+1),R}let u=d,h=u.colId??u.field??`col_${c}`,p=h,m=2;for(;i.has(p);)p=`${h}_${m++}`;i.add(p);let b=new X(p,li(u,r,this.e.r.columnTypes));b.parentGroup=a,b.level=l;let w=t.get(p);return w&&(b.manualWidth=w.manualWidth,b.contentWidth=w.contentWidth,b.flex=w.flex,b.hide=w.hide,b.pinned=w.pinned),b});if(this.Be=o(this.eo,null,0),this.e.r.masterDetail&&this.e.r.detailToggleColumn){let s=new X(yr,{colId:yr,headerName:"",width:38,pinned:"left",sortable:!1,resizable:!1,movable:!1,filter:!1});s.isDetailToggle=!0,this.Be.unshift(s)}if(this.X=this.Ei(this.Be),this.ya=new Map(this.X.map(s=>[s.id,s])),this.Zt=this.X.reduce((s,a)=>Math.max(s,a.level+1),1),this.ze=this.ze.filter(s=>this.X.some(a=>a.id===s.colId)),this.ze.length===0){let s=[];for(let a of this.X)a.colDef.initialSort&&s.push({colId:a.id,direction:a.colDef.initialSort});this.ze=s}this.Qt()}Ei(e,t=[]){for(let r of e)r instanceof re?this.Ei(r.children,t):t.push(r);return t}Qt(){let e=this.X.filter(t=>!t.hide);this.Zn=e.filter(t=>t.pinned==="left"),this.Qn=e.filter(t=>t.pinned==="right"),this.Pr=e.filter(t=>t.pinned===null),this.to.clear(),this.c().forEach((t,r)=>this.to.set(t.id,r))}_e(e){return this.to.get(e)??-1}te(){return this.X}xi(){return this.eo}hc(){return this.Be}pc(){return this.Zt}k(e){return this.ya.get(e)}T(e){return e==="left"?this.Zn:e==="right"?this.Qn:this.Pr}c(){return[...this.Zn,...this.Pr,...this.Qn]}nt(){return this.c().filter(e=>e.colDef.rowGroup===!0)}fc(){return this.c().filter(e=>e.colDef.aggFunc!=null&&e.colDef.rowGroup!==!0)}ro(){return this.Pr.some(e=>e.colDef.colSpan!=null)}va(){let e=this.c();return this.Pr.find(t=>!t.hasCheckbox&&!t.isDetailToggle)??e.find(t=>!t.hasCheckbox&&!t.isDetailToggle)??e[0]}er(e){return e.pinned==="left"?"left":e.pinned==="right"?"right":"center"}ba(e){this.uc=e;let t=e,r=[],i=[];for(let s of this.c()){let a=this.Ri(s);s.pinned!=null||s.colDef.suppressSizeToFit||s.manualWidth!=null?(s.currentWidth=J(a.width??Me,a),t-=s.currentWidth):(r.push(s),i.push(a))}let o=this.e.r.columnLayout==="fit"?Je(i,Math.max(0,t)):wi(i,Math.max(0,t));r.forEach((s,a)=>{s.currentWidth=o[a]})}Ri(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}}Se(e,t){return Ie(t)?(e.manualWidth=J(t,this.Ri(e)),e.flex=null,!0):!1}wa(e,t){return Ie(t)?(e.resetWidth(),e.contentWidth=J(t,this.Ri(e)),!0):!1}no(e,t){let r=this.k(e);!r||r.hide===!t||(r.hide=!t,this.Qt())}At(e,t){let r=this.k(e);if(!r)return!1;let i=this.er(r),o=u=>r.parentGroup?!0:this.er(u)===i,s=r.parentGroup?r.parentGroup.children:this.Be,a=s.filter(u=>u instanceof X&&!u.hide&&o(u)),l=a.indexOf(r);if(l<0)return!1;a.splice(l,1);let d=Math.max(0,Math.min(t,a.length));a.splice(d,0,r);let c=[];return s.forEach((u,h)=>{u instanceof X&&!u.hide&&o(u)&&c.push(h)}),c.length!==a.length?!1:(c.forEach((u,h)=>{s[u]=a[h]}),this.X=this.Ei(this.Be),this.Qt(),!0)}oo(e,t){let r=this.k(e);!r||!r.movable||(r.pinned=t,this.Qt())}Si(){return this.X.map(e=>({colId:e.id,hide:e.hide,width:e.manualWidth??e.currentWidth,flex:e.flex,widthMode:e.manualWidth==null?"auto":"manual",contentWidth:e.contentWidth??void 0,pinned:e.pinned}))}Ca(e){let t=new Map(e.map(r=>[r.colId,r]));for(let r of this.X){let i=t.get(r.id);i&&this.mc(r,i)}this.gc(e),this.Qt()}mc(e,t){typeof t.hide=="boolean"&&(e.hide=t.hide),t.widthMode==="auto"?(e.resetWidth(),Ie(t.flex)&&(e.flex=t.flex)):Ie(t.flex)?(e.flex=t.flex,e.manualWidth=null):this.Se(e,t.width),Ie(t.contentWidth)&&(e.contentWidth=J(t.contentWidth,this.Ri(e))),e.movable&&(t.pinned==="left"||t.pinned==="right"||t.pinned===null)&&(e.pinned=t.pinned)}gc(e){let t=new Map;e.forEach((r,i)=>t.set(r.colId,i));for(let r of["left","center","right"]){let i=[],o=[];this.Be.forEach((s,a)=>{s instanceof X&&!s.hide&&s.parentGroup===null&&s.movable&&this.er(s)===r&&(i.push(a),o.push(s))}),o.sort((s,a)=>(t.get(s.id)??Number.MAX_SAFE_INTEGER)-(t.get(a.id)??Number.MAX_SAFE_INTEGER)),i.forEach((s,a)=>{this.Be[s]=o[a]})}this.X=this.Ei(this.Be)}so(){for(let e of this.X){e.resetWidth(),e.hide=e.colDef.hide??!1;let t=e.colDef.pinned;e.pinned=t===!0?"left":t===!1||t==null?null:t}this.Qt()}J(){return this.ze.map(e=>({...e}))}Nr(e){if(!e||e.length===0){this.ze=[];return}this.ze=e.filter(t=>this.X.some(r=>r.id===t.colId)&&(t.direction==="asc"||t.direction==="desc")).map(t=>({colId:t.colId,direction:t.direction}))}Mi(e,t){let r=[...this.ze],i=r.findIndex(l=>l.colId===e.id),o=i>=0?r[i].direction:null,s=o===null?"asc":o==="asc"?"desc":null;t&&this.e.r.multiSort?s===null?i>=0&&r.splice(i,1):i>=0?r[i]={colId:e.id,direction:s}:r.push({colId:e.id,direction:s}):(r.length=0,s&&r.push({colId:e.id,direction:s})),this.ze=r}};function ie(n,e){if(n instanceof Error)return n;let t=new Error(typeof n=="string"?n:e);return t.name="AbortError",t}var is=()=>ie(void 0,"[MachTable] Operation cancelled.");function Qe(n,e,t=is){return e?new Promise((r,i)=>{let o=()=>{e.removeEventListener("abort",o),i(t())};if(n.then(r,i).finally(()=>e.removeEventListener("abort",o)),e.aborted){o();return}e.addEventListener("abort",o,{once:!0})}):n}function Ci(n){return n==null?"":String(n).toLowerCase()}function ns(n,e,t){let r=Ci(n),i=o=>{let s=(o.value??"").toLowerCase();switch(o.match){case"contains":return r.includes(s);case"notContains":return!r.includes(s);case"equals":return r===s;case"notEquals":return r!==s;case"startsWith":return r.startsWith(s);case"endsWith":return r.endsWith(s);case"blank":return r==="";case"notBlank":return r!=="";default:return!0}};return e.length===0||(t==="or"?e.some(i):e.every(i))}function os(n,e,t){switch(t.match){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<=(t.value2??e);default:return!0}}function ss(n,e){let t=n==null||n==="";if(e.match==="blank")return t;if(e.match==="notBlank")return!t;if(t)return!1;let r=typeof n=="number"?n:Number(n);if(Number.isNaN(r))return!1;let i=e.value;return i==null||Number.isNaN(i)?!1:os(r,i,e)}function as(n,e,t){let r=i=>ss(n,i);return e.length===0||(t==="or"?e.some(r):e.every(r))}function vr(n){if(n==null||n==="")return null;if(n instanceof Date)return isNaN(n.getTime())?null:n.getTime();if(typeof n=="number")return n;let e=Date.parse(String(n));return isNaN(e)?null:e}function ls(n,e,t){let r=vr(n),i=o=>{let s=r==null;if(o.match==="blank")return s;if(o.match==="notBlank")return!s;if(s)return!1;let a=r,l=o.value!=null?vr(o.value):null;if(l==null)return!1;switch(o.match){case"equals":return a===l;case"notEquals":return a!==l;case"lessThan":return a<l;case"greaterThan":return a>l;case"inRange":{let d=o.value2!=null?vr(o.value2):null;return d!=null?a>=l&&a<=d:a>=l}default:return!0}};return e.length===0||(t==="or"?e.some(i):e.every(i))}function ds(n,e){return e.length===0?!0:e.some(t=>t==null&&n==null||t===n)}function Ti(n,e){let t=e.type!=="set"&&e.operator==="or"?"or":"and";switch(e.type){case"text":return ns(n,e.conditions,t);case"number":return as(n,e.conditions,t);case"date":return ls(n,e.conditions,t);case"set":return ds(n,e.values);default:return!0}}function Di(n,e,t){if(n.kind==="condition"){let i=e.get(n.colId);return i?o=>Ti(t(o,i),n.filter):()=>!0}let r=n.children.map(i=>Di(i,e,t));return i=>{let o=n.operator==="or"?r.some(s=>s(i)):r.every(s=>s(i));return n.not?!o:o}}function br(n,e,t,r,i){let o=new Map(n.map(d=>[d.id,d])),s=Object.entries(e).flatMap(([d,c])=>{let u=o.get(d);return u?[{column:u,filter:c}]:[]}),a=t?Di(t.root,o,i):()=>!0,l=r?.trim().toLowerCase().split(/\s+/).filter(Boolean)??[];return d=>!s.every(({column:c,filter:u})=>Ti(i(d,c),u))||!a(d)?!1:l.every(c=>n.some(u=>Ci(i(d,u)).includes(c)))}var Ei=typeof Intl<"u"?new Intl.Collator(void 0,{numeric:!0,sensitivity:"base"}):null;function cs(n,e){let t=n==null||n==="",r=e==null||e==="";return!t&&!r?null:t&&r?0:t?1:-1}function us(n,e){let t=Number.isNaN(n),r=Number.isNaN(e);return t||r?t===r?0:t?1:-1:n-e}function hs(n,e){return n===e?0:n?1:-1}function et(n,e){let t=cs(n,e);if(t!==null)return t;if(typeof n=="number"&&typeof e=="number")return us(n,e);if(n instanceof Date&&e instanceof Date)return n.getTime()-e.getTime();if(typeof n=="boolean"&&typeof e=="boolean")return hs(n,e);let r=String(n),i=String(e);return Ei?Ei.compare(r,i):r.localeCompare(i)}function wr(n,e,t,r){let i=new Map(t.map(a=>[a.id,a])),o=e.flatMap(a=>{let l=i.get(a.colId);return l?[{column:l,compare:l.colDef.comparator??et,direction:a.direction}]:[]}),s=n.map(a=>({node:a,values:o.map(({column:l})=>r(a,l))}));return s.sort((a,l)=>{for(let d=0;d<o.length;d++){let c=o[d],u=c.compare(a.values[d],l.values[d],a.node,l.node);if(u!==0)return c.direction==="asc"?u:-u}return 0}),s.map(({node:a})=>a)}function xi(){return{count:0,numeric:0,sum:0,min:1/0,max:-1/0}}function Ri(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 Si(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 tt(n,e){let t=xi();for(let r of n)Ri(t,r);return Si(t,e)}var Ae={sum:n=>tt(n,"sum"),avg:n=>tt(n,"avg"),count:n=>n.length,min:n=>tt(n,"min"),max:n=>tt(n,"max"),first:n=>n.length>0?n[0]:null,last:n=>n.length>0?n[n.length-1]:null};function Mi(n,e,t){if(e===Ae.count)return n.length;let r=["sum","avg","min","max"].find(o=>e===Ae[o]);if(!r)return e(n.map(t));let i=xi();for(let o of n)Ri(i,t(o));return Si(i,r)}function rt(n){let e={...Ae,...n??{}};return t=>e[t]}var it="group:";function Ii(n){return n==null?"null":n instanceof Date?JSON.stringify(["date",String(n.getTime())]):JSON.stringify([typeof n,Cr(n)])}function Cr(n){return n==null?"(\u7A7A)":String(n)}function Ai(n){return it+JSON.stringify(n)}function ps(n,e,t){let r=new Map;for(let i of n){let o=t(i,e),s=Ii(o),a=r.get(s);a||(a={key:s,label:Cr(o),rows:[]},r.set(s,a)),a.rows.push(i)}return[...r.values()].sort((i,o)=>i.label.localeCompare(o.label,void 0,{numeric:!0,sensitivity:"base"})||i.key.localeCompare(o.key))}function Li(n,e,t,r,i){let o=[],s=(a,l,d)=>{if(l===e.length)return{display:a,leaves:a};let c=[],u=[];for(let h of ps(a,e[l],t)){let p=[...d,[e[l].id,h.key]],m=Ai(p);o.push(m);let b=s(h.rows,l+1,p);if(c.push({id:m,data:null,rowIndex:-1,selected:!1,isGroup:!0,groupLevel:l,groupKey:h.label,leafNodes:b.leaves,aggValues:r(b.leaves)}),i.has(m))for(let w of b.display)c.push(w);if(l>0)for(let w of b.leaves)u.push(w)}return{display:c,leaves:u}};return{rows:s(n,0,[]).display,ids:o}}function ki(n,e,t,r){let i=new Set([...n].filter(l=>l.startsWith("/g0:")));if(!i.size)return{expanded:n,ambiguous:[]};let o=new Map;for(let l of e){let d=[],c="";for(let u=0;u<t.length;u++){let h=r(l,t[u]);if(d.push([t[u].id,Ii(h)]),c+=`/g${u}:${Cr(h)}`,!i.has(c))continue;let p=Ai(d);o.set(c,o.has(c)&&o.get(c)!==p?null:p)}}let s=new Set([...n].filter(l=>!i.has(l))),a=[];for(let l of i){let d=o.get(l);d?s.add(d):d===null?a.push(l):s.add(l)}return{expanded:s,ambiguous:a}}function fs(n,e){let t=n?[n.root]:[];for(;t.length;){let r=t.pop();if(r.kind==="condition")e.add(r.colId);else for(let i of r.children)t.push(i)}}function Pi(n){let e=new Set(Object.keys(n.filterModel));fs(n.advancedFilter,e);let t=new Set(n.sortModel.map(a=>a.colId));for(let a of t)e.add(a);let r=n.columns.some(a=>a.colDef.rowGroup===!0),i=!!n.quickFilter?.trim(),o=n.columns.filter(a=>e.has(a.id)||i||a.colDef.rowGroup===!0||r&&a.colDef.aggFunc!=null),s=new Set;for(let a of o){let l=a.colDef;if(r&&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 Gi(n){return n!=null&&(typeof n=="object"||typeof n=="function")}function Ni(n,e){let t=new WeakMap;for(let r of n){if(r.data==null)continue;let i=e.map(o=>_(r.data,o));i.some(Gi)||t.set(r,i)}return t}function Oi(n,e,t,r){return t.length?!r||n===e||n==null||e==null?!0:t.some((i,o)=>{let s=_(e,i);return Gi(s)||!Object.is(r[o],s)}):!1}function ne(n){return ie(n.reason,"Block request aborted")}function nt(n){return Number.isFinite(n)?Math.max(1,Math.trunc(n)):1}var ot=class{constructor(e,t,r=4){this.maxBlocks=e;this.uo=t;this.maxConcurrentRequests=r;this.re=new Map;this.Z=new Map;this.Ta=0;this.ao=0;this.lo=0;this.Da=0;this.Ea=0;this.Ii=0;this.Ai=new Set;this.maxBlocks=nt(e),this.maxConcurrentRequests=nt(r)}configure(e,t=this.maxConcurrentRequests){this.maxBlocks=nt(e),this.maxConcurrentRequests=nt(t),this.co(),this.Li()}yc(e){this.Ai=e,this.co()}peek(e){let t=this.re.get(e);if(t)return t.touchedAt=++this.Ta,t}has(e){return this.re.has(e)}invalidate(e){let t=this.Z.get(e);t&&(this.Z.delete(e),t.controller.abort(),t.state==="queued"&&t.reject(ne(t.controller.signal)));let r=this.re.get(e);r&&(this.re.delete(e),this.uo?.(e,r))}load(e,t,r,i=0){if(r?.aborted)return Promise.reject(ne(r));let o=this.peek(e);if(o)return this.lo++,Promise.resolve(o);let s=this.Z.get(e);if(s)return this.lo++,s.priority=Math.max(s.priority,i),this.Li(),this.xa(e,s,r);this.Da++;let a=new AbortController,l,d,c=new Promise((p,m)=>{l=p,d=m}),u={controller:a,promise:c,consumers:0,loader:t,priority:i,state:"queued",resolve:l,reject:d};this.Z.set(e,u);let h=this.xa(e,u,r);return this.Li(),h}vc(){this.ao++,this.Ai.clear();for(let e of this.Z.values())e.controller.abort(),e.state==="queued"&&e.reject(ne(e.controller.signal));this.Z.clear();for(let[e,t]of this.re)this.uo?.(e,t);this.re.clear()}snapshot(){let e=0,t=0;for(let r of this.re.values())e+=r.rows.length;for(let r of this.Z.values())r.state==="active"&&t++;return{cachedBlockCount:this.re.size,loadingBlockCount:this.Z.size,activeRequestCount:t,queuedRequestCount:Math.max(0,this.Z.size-t),cachedRowCount:e,hitCount:this.lo,missCount:this.Da,evictionCount:this.Ea}}Li(){for(;this.Ii<this.maxConcurrentRequests;){let e,t;for(let[r,i]of this.Z)i.state!=="queued"||i.controller.signal.aborted||(!t||i.priority>t.priority)&&(e=r,t=i);if(e==null||!t)return;this.bc(e,t)}}bc(e,t){t.state="active",this.Ii++;let r=this.ao;this.wc(t).then(i=>{r===this.ao&&!t.controller.signal.aborted&&(this.re.set(e,{rows:i.rows,...i.lastRow==null?{}:{lastRow:i.lastRow},touchedAt:++this.Ta}),this.co()),t.resolve(i)},t.reject).finally(()=>{this.Ii=Math.max(0,this.Ii-1),this.Z.get(e)===t&&this.Z.delete(e),this.Li()})}wc(e){let{signal:t}=e.controller;return Qe(Promise.resolve().then(()=>{if(t.aborted)throw ne(t);return e.loader(t)}),t,()=>ne(t))}xa(e,t,r){return t.consumers++,new Promise((i,o)=>{let s=!1,a=d=>{s||(s=!0,r?.removeEventListener("abort",l),t.consumers=Math.max(0,t.consumers-1),d())},l=()=>a(()=>{t.consumers===0&&this.Z.get(e)===t&&(this.Z.delete(e),t.controller.abort(r?.reason),t.state==="queued"&&t.reject(ne(t.controller.signal))),o(ne(r))});r?.addEventListener("abort",l,{once:!0}),t.promise.then(d=>a(()=>i(d)),d=>a(()=>o(d instanceof Error?d:new Error(String(d??"Block request failed")))))})}co(){let e=Math.max(this.maxBlocks,this.Ai.size+1);for(;this.re.size>e;){let t=-1,r=Number.POSITIVE_INFINITY;for(let[o,s]of this.re)this.Ai.has(o)||s.touchedAt<r&&(t=o,r=s.touchedAt);if(t<0)return;let i=this.re.get(t);this.re.delete(t),this.Ea++,i&&this.uo?.(t,i)}}};function Le(n,e){if(n==null||typeof n!="object")return;let t=n[e];return Array.isArray(t)?t:void 0}var st=class{constructor(e){this.e=e;this.u=[];this.B=[];this.ie=new Map;this.we=[];this.p=new Map;this.ot={};this.st=null;this.Ke=null;this.P=new Set;this.j=new Set;this.tr=[];this.Or=new Map;this.Ra=[];this.G=null;this.rr=!1;this.Sa=!1;this.at=0;this.ki=null;this.Pi=null;this.Gi=new WeakMap;this.Fr=new WeakMap;this.lt=new Map;this.Hr=new Map;this.Vr=0;this.Ni=0;this.dt=null;this.ct=new Map;this.Lt=new Map;this.Oi=new Set;this.kt=new Map;this.ut=new ot(12,e=>this.Ma(e));this.Br=0;this.Fi=null;this.ho=!1;this.Ia=0;this.ae=[];this.W=1;this.Ur=20;this.st=V(e.r.advancedFilterModel)}resolveRowId(e,t,r){let i=this.e.r.resolveRowId;if(!i)return r;try{let o=i({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 r}get F(){return this.e.r.treeData}get f(){return this.e.r.datasource!=null}get Ce(){return this.f&&this.e.r.datasourceMode==="block"}ir(){if(this.f){if(this.Ce)return this.nr();let e=Math.max(0,this.we.length-this.u.length);return(this.G??this.u.length)+e}return this.we.length}po(){return this.Vr}zr(){return this.Ni}Cc(){return this.Sa}Hi(e){return!this.f||e?.aborted?Promise.resolve():(this.Ni++,this.e.Me(),this.e.api.editing.stop({cancel:!0}),this.e.z.clear(),this.Vi(),this.G=null,this.rr=!1,this.u=[],this.B=[],this.p.clear(),this.P.clear(),this.e._.clear(),this.w(),this.e.h({data:!0}),this.Ce?(this.ut.configure(this.e.r.maxBlocksInCache,this.e.r.datasourceMaxConcurrentRequests),this.Bi(0,e)):this.Aa(0,void 0,e))}Pt(e){this.Sa=e,this.e.o.Pt(e,this.e.y("loading"))}Aa(e,t,r){if(!this.f||this.rr||this.G!=null&&e>=this.G)return Promise.resolve();let i=this.e.r.blockSize,o=t??e+i;if(o<=e)return Promise.resolve();let s=++this.at,a=new AbortController,l=()=>a.abort(r?.reason);return r?.addEventListener("abort",l,{once:!0}),this.ki=a,this.rr=!0,this.Pt(!0),new Promise(d=>{let c=!1;this.Pi=d;let u=h=>{c||(c=!0,r?.removeEventListener("abort",l),s===this.at&&(this.rr=!1,this.ki=null,this.Pi=null,this.Pt(!1),h!=null&&h?.name!=="AbortError"&&this.e.reportError(h,"datasource.getRows",{startRow:e,endRow:o})),d())};this.La(e,o,a.signal,(h,p)=>{if(s!==this.at||this.e.s()||a.signal.aborted){u();return}typeof p=="number"&&p>=0?this.G=p:h.length<o-e&&(this.G=e+h.length);let m=this.u.length===0;this.Tc(h),u(),this.w(),this.e.h({data:!0}),m&&this.e.Te(),this.e.K.zi()},h=>u(a.signal.aborted||this.e.s()?void 0:h??new Error("Datasource request failed")))})}Vi(){this.at++,this.ki?.abort(),this.ki=null,this.rr=!1,this.Pt(!1),this.Pi?.(),this.Pi=null,this.ut.vc(),this.ct.clear(),this.Lt.clear(),this.Oi.clear();for(let[e,t]of this.kt)this.p.get(e)===t&&this.p.delete(e);this.kt.clear()}Tc(e){for(let t of e){if(t==null)continue;let r=this.u.length,i=this.resolveRowId(t,r,`inf-${this.e.or()}`);if(this.p.has(i)){this.e.reportError(new Error(`Duplicate row id: ${i}`),"datasource.getRows",{rowId:i});continue}let o={id:i,data:t,rowIndex:-1,selected:this.e.g.fo(i)};this.u.push(o),this.p.set(i,o),this.B.push(o)}}Bi(e,t,r=0){if(!this.Ce||e<0)return Promise.resolve();if(t?.aborted)return Promise.reject(this.ka(t.reason));let i=this.e.r.blockSize,o=this.at,s=e*i;if(s>=this.nr())return Promise.resolve();let a=this.G==null?s+i:Math.min(this.G,s+i),l=this.ut.load(e,d=>this.Dc(s,a,d),t,r);return this.Pt(this.u.length===0&&this.ut.snapshot().loadingBlockCount>0),l.then(d=>{o!==this.at||t?.aborted||this.e.s()||!this.Ce||!this.ut.has(e)||this.Oi.has(e)||(this.Ec(e,d),this.w(),this.e.h({data:!0}),this.e.K.zi(),o===this.at&&!this.e.s()&&this.Pa(this.e.a.mo().lastExcl-1))}).catch(d=>{throw d?.name!=="AbortError"&&this.e.reportError(d,"datasource.getRows",{startRow:s,endRow:a}),d}).finally(()=>{o===this.at&&this.Pt(this.u.length===0&&this.ut.snapshot().loadingBlockCount>0)})}Dc(e,t,r){return new Promise((i,o)=>{this.La(e,t,r,(s,a)=>i({rows:s,...typeof a=="number"&&a>=0?{lastRow:a}:{}}),s=>o(s instanceof Error?s:new Error(typeof s=="string"?s:"Datasource request failed")))})}La(e,t,r,i,o){let s=this.e.r.datasource,a=0,l=null,d=!1,c=p=>{d||(d=!0,l!=null&&clearTimeout(l),r.removeEventListener("abort",u),p())},u=()=>c(()=>o(this.ka(r.reason)));r.addEventListener("abort",u,{once:!0});let h=()=>{if(d)return;if(r.aborted||this.e.s()){u();return}a++;let p=!1,m=b=>{if(!(p||d)){if(p=!0,r.aborted||this.e.s()){u();return}a<=this.e.r.datasourceRetryCount?l=setTimeout(h,this.retryDelay(a)):c(()=>o(b))}};try{let b=s.getRows({startRow:e,endRow:t,sortModel:this.e.n.J(),filterModel:this.Q(),advancedFilterModel:this.Ie(),quickFilterText:this.Ke,signal:r,onSuccess:(w,C)=>{p||d||(p=!0,c(()=>i(w??[],C)))},fail:m});b&&typeof b.catch=="function"&&b.catch(m)}catch(b){m(b)}};h()}Ec(e,t){let r=this.e.r.blockSize,i=e*r;this.Ma(e),typeof t.lastRow=="number"&&t.lastRow>=0?this.G=t.lastRow:t.rows.length<r&&(this.G=i+t.rows.length),t.rows.forEach((o,s)=>{if(o==null)return;let a=i+s;if(this.G!=null&&a>=this.G)return;let l=this.resolveRowId(o,a,`block-${a}`),d=this.kt.get(l),c=this.p.get(l);if(c&&c!==d&&c.rowIndex!==a){this.e.reportError(new Error(`Duplicate row id: ${l}`),"datasource.getRows",{rowId:l});return}let u=d??{id:l,data:o,rowIndex:a,selected:this.e.g.fo(l)};u.rowIndex=a,u.selected=this.e.g.fo(l),this.kt.delete(l),this.ct.set(a,u),this.Lt.delete(a),this.p.set(l,u),this.Fr.set(u,a+1)}),this.Ga(),this.Oi.add(e)}Ma(e){this.Oi.delete(e);let t=this.e.r.blockSize,r=e*t,i;for(let o=r;o<r+t;o++){let s=this.ct.get(o);s&&(i??(i=new Set(this.e.z.getDirtyRowIds())),this.ct.delete(o),i.has(s.id)?this.kt.set(s.id,s):this.p.get(s.id)===s&&this.p.delete(s.id))}this.Ga()}Ga(){this.u=[...this.ct.entries()].sort(([e],[t])=>e-t).map(([,e])=>e),this.B=this.u}nr(){if(this.G!=null)return this.G;if(this.e.r.datasourceRowCount!=null)return this.e.r.datasourceRowCount;if(this.ct.size===0)return this.e.r.blockSize;let e=0;for(let t of this.ct.keys())e=Math.max(e,t+1);return e+this.e.r.blockSize}xc(e){let t=this.Lt.get(e);if(!t&&(t={id:`__mach_loading_${e}`,data:null,rowIndex:e,selected:!1,loading:!0},this.Lt.set(e,t),this.Lt.size>2e3)){let r=this.Lt.keys().next().value;r!=null&&this.Lt.delete(r)}return t}ka(e){return ie(e,"Operation aborted")}retryDelay(e){let t=Math.min(this.e.r.datasourceRetryDelay*2**Math.max(0,e-1),3e4),r=this.e.r.datasourceRetryJitter;return Math.max(0,Math.round(t*(1+(Math.random()*2-1)*r)))}Rc(e){if(this.Ce){this.Pa(e);return}if(!this.f||this.rr)return;let t=this.u.length;if(this.G!=null&&t>=this.G)return;let r=this.e.r.infiniteBufferRows;if(e+r<t&&e<t)return;let i=this.e.r.blockSize,o=this.G==null?t+i:Math.min(this.G,t+i);this.Aa(t,o)}Pa(e){if(e<0)return;this.Na();let t=this.e.r.blockSize,r=Math.floor(e/t),i=Math.floor(this.e.a.mo().first/t),o=this.e.r.blockPrefetch,s=r<this.Ia?-1:1;this.Ia=r;for(let a=i;a<r;a++)this.Bi(a,void 0,o+2).catch(()=>{});for(let a=0;a<=o;a++){let l=a===0?[r]:[r+s*a,r-s*a];for(let d of l)d<0||d*t>=this.nr()||this.Bi(d,void 0,o-a+1).catch(()=>{})}}We(){return this.Hi().catch(()=>{})}Sc(){return this.Vi(),this.f?this.Hi().catch(()=>{}):(this.G=null,this.ht(this.e.r.rowData),this.e.h({data:!0}),Promise.resolve())}destroy(){this.dt=null,this.Vi(),this.Oa(),this.go(),this.u=this.B=this.we=this.ae=[],this.p.clear(),this.ie.clear(),this.Or.clear(),this.Ra=[],this.P.clear(),this.j.clear(),this.tr=[]}yo(e,t,r){if(!this.Ce)return Promise.resolve();this.Na();let i=this.e.r.blockSize,o=Math.max(0,Math.trunc(e)),s=Math.min(this.nr(),Math.max(o,Math.trunc(t))),a=Math.floor(o/i),l=Math.max(a,Math.floor(Math.max(o,s-1)/i)),d=[];for(let c=a;c<=l;c++)d.push(this.Bi(c,r,100));return Promise.all(d).then(()=>{})}vo(){this.Ce&&(this.Ni++,this.e.Me(),this.e.api.editing.stop({cancel:!0}),this.e.z.clear(),this.Vi(),this.e._.clear(),this.u=[],this.B=[],this.p.clear(),this.w(),this.e.h({data:!0}))}bo(){return this.ut.snapshot()}Na(){let e=new Set(this.e.z.getDirtyRowIds());for(let[l,d]of this.kt)e.has(l)||(this.kt.delete(l),this.p.get(l)===d&&this.p.delete(l));let t=this.e.r.blockSize,r=new Set,{first:i,lastExcl:o}=this.e.a.mo();for(let l=i;l<o;l+=t)r.add(Math.floor(l/t));o>i&&r.add(Math.floor((o-1)/t));let s=this.e.a.D;s&&r.add(Math.floor(s.rowIndex/t));let a=this.e.l.Mc();a!=null&&r.add(Math.floor(a/t)),this.ut.yc(r)}ht(e){this.Ni++,this.e.Me(),this.e.api.editing.stop({cancel:!0}),this.Oa(),this.e.z.clear();let t=this.e.r.resolveRowId,r=this.e.r.childrenKey,i=[],o=[],s=new Map,a=new Map,l=0,d=(c,u,h)=>{let p=l++,m=this.resolveRowId(c,p,`auto-${p}`);if(s.has(m))return this.e.reportError(new Error(`Duplicate row id: ${m}`),"rowData",{rowId:m,index:p}),null;let b=this.F?Le(c,r):void 0,w={id:m,data:c,rowIndex:-1,selected:!1,treeChildrenLoaded:Array.isArray(b)};if(this.Gi.set(w,u),i.push(w),s.set(m,w),h!=null){let C=a.get(h)??[];C.push(m),a.set(h,C)}else o.push(w);if(this.F&&Array.isArray(b))for(let C of b)C!=null&&d(C,u+1,m);return w};(e??[]).forEach(c=>{c!=null&&d(c,0,null)}),this.u=i,this.B=o,this.ie=a,this.p=s,this.e._.clear();for(let c of[...this.P])s.has(c)||this.P.delete(c);if(this.e.r.defaultExpandAll)for(let c of i)this.Fa(c.id)>0&&this.P.add(c.id);this.e.g.Ha(t!=null),this.w()}_r(e){return this.ie.get(e)??[]}Fa(e){return this.ie.get(e)?.length??0}wo(e){return this.Fa(e)>0}isTreeRowLoading(e){return this.p.get(e)?.treeLoading===!0}Oa(){for(let e of this.lt.values())e.abort();this.lt.clear(),this.Hr.clear()}loadTreeChildren(e,t=!1){let r=this.p.get(e),i=this.e.r.loadTreeChildren;if(!this.F||!r?.data||!i)return Promise.resolve([]);if(!t&&r.treeChildrenLoaded)return Promise.resolve(this._r(e).flatMap(l=>{let d=this.p.get(l)?.data;return d==null?[]:[d]}));let o=this.Hr.get(e);if(o&&!t)return o;this.lt.get(e)?.abort();let s=new AbortController;this.lt.set(e,s),r.treeLoading=!0,r.treeLoadError=void 0,this.e.h({data:!0});let a=Promise.resolve().then(()=>i({data:r.data,node:r,api:this.e.api,signal:s.signal})).then(l=>{if(s.signal.aborted||this.e.s())return[];if(!Array.isArray(l))throw new TypeError("[MachTable] loadTreeChildren must resolve to an array.");return this.Ic(r,l),r.treeChildrenLoaded=!0,r.treeLoadError=void 0,this.e.emit("treeChildrenLoaded",{rowId:e,rowNode:r,children:l}),l}).catch(l=>{if(s.signal.aborted||l?.name==="AbortError")return[];throw r.treeLoadError=l,r.treeChildrenLoaded=!1,this.e.reportError(l,"treeData.loadChildren",{rowId:e}),this.e.emit("treeChildrenLoadFailed",{rowId:e,rowNode:r,error:l}),l}).finally(()=>{this.lt.get(e)===s&&(this.lt.delete(e),this.Hr.delete(e),r.treeLoading=!1,this.e.h({data:!0}))});return this.Hr.set(e,a),a}Ic(e,t){let r=new Set,i=[...this._r(e.id)];for(;i.length>0;){let s=i.pop();r.has(s)||(r.add(s),i.push(...this._r(s)))}this.Ac(t,r);for(let s of r)this.lt.get(s)?.abort(),this.lt.delete(s),this.Hr.delete(s),this.ie.delete(s),this.p.delete(s),this.P.delete(s);this.ie.delete(e.id);let o=this.Co(e)+1;for(let s of t)s!=null&&this.To(e,s,o);this.Va(),this.e.g.Ha(this.e.r.resolveRowId!=null),this.w(),this.e.h({data:!0})}Ac(e,t){let r=this.e.r.resolveRowId,i=r?new Set([...this.p.keys()].filter(l=>!t.has(l))):null,o=new WeakSet,s=[...e],a=0;for(;s.length>0;){let l=s.pop();if(l==null)continue;if(typeof l=="object"){if(o.has(l))throw new TypeError("[MachTable] Lazy tree children contain a cyclic object graph.");o.add(l)}if(r&&i){let c=r({data:l,index:a++,api:this.e.api});if(typeof c!="string"||c.length===0)throw new TypeError("[MachTable] rowKey must resolve to a non-empty identifier for lazy tree children.");if(i.has(c))throw new Error(`Duplicate row id: ${c}`);i.add(c)}let d=Le(l,this.e.r.childrenKey);d&&s.push(...d)}}Kr(e,t=!0){let r=this.e.r.resolveRowId,i=[],o=[],s=[];if(e.remove?.length){let l=new Set,d=new Set,c=h=>{if(r){let m=[this.resolveRowId(h,-1,`__missing_remove_${this.e.or()}`)];for(;m.length>0;){let b=m.pop();if(!l.has(b)){l.add(b);for(let w of this.ie.get(b)??[])m.push(w)}}}else{let p=[h];for(;p.length>0;){let m=p.pop();d.add(m);let b=this.F?Le(m,this.e.r.childrenKey):void 0;if(b)for(let w of b)p.push(w)}}};e.remove.forEach(c),this.u=this.u.filter(h=>{let p=l.has(h.id)||h.data!=null&&d.has(h.data);return p&&(s.push(h.id),this.p.delete(h.id),this.ie.delete(h.id)),!p});let u=new Set(this.u);this.B=this.B.filter(h=>u.has(h))}if(e.update?.length)for(let l of e.update){let d;r?d=this.p.get(this.resolveRowId(l,-1,`__missing_update_${this.e.or()}`)):d=this.u.find(c=>c.data===l),d&&(o.push({node:d,before:d.data,after:l}),d.data=l,s.push(d.id),this.e.a._i(d),i.push(d))}if(e.add?.length){let l=e.addIndex!=null?Math.max(0,Math.min(e.addIndex,this.B.length)):this.B.length,d=[];e.add.forEach((c,u)=>{let h=this.resolveRowId(c,l+u,`add-${this.e.or()}`);if(this.p.has(h)){this.e.reportError(new Error(`Duplicate row id: ${h}`),"transaction.add",{rowId:h});return}let p={id:h,data:c,rowIndex:-1,selected:!1};this.p.set(h,p),this.Gi.set(p,0);let m=this.F?Le(c,this.e.r.childrenKey):void 0;if(m)for(let b of m)b!=null&&this.To(p,b,1);d.push(p)}),this.B=this.B.slice(0,l).concat(d,this.B.slice(l)),this.Va()}let a={pipelineChanged:this.Lc(e,o),updatedRowIds:i.map(l=>l.id)};return this.kc(a,t),this.e.z.Pc(s),a}kc(e,t){e.pipelineChanged&&(this.dt=null),t&&(e.pipelineChanged?this.w():e.updatedRowIds.length&&this.Ba())}Gc(e){if(e.length===0)return{pipelineChanged:!1,updatedRowIds:[]};let t=!1,r=new Set;for(let i of e){let o=this.Kr(i,!1);t||(t=o.pipelineChanged);for(let s of o.updatedRowIds)r.add(s)}return t?this.w():r.size>0&&this.Ba(),{pipelineChanged:t,updatedRowIds:[...r]}}Lc(e,t){if(e.add?.length||e.remove?.length)return!0;if(!t.length)return!1;let r=this.za();if(r===null)return!0;if(!r.length)return!1;let i=this.dt;return!i||r.length!==i.fields.length||r.some((o,s)=>o!==i.fields[s])?!0:t.some(({node:o,before:s,after:a})=>Oi(s,a,r,i.values.get(o)))}za(){if(this.F||this.e.r.masterDetail||this.e.r.getRowHeight||this._a())return null;let e=this.e.n.c();if(e.some(r=>r.colDef.autoHeight===!0||r.colDef.autoRowSpan===!0||r.colDef.rowSpan!=null))return null;let t=!this.e.r.manualFiltering;return Pi({columns:e,customAggregates:this.e.r.aggFuncs,sortModel:this.e.r.manualSorting?[]:this.e.n.J(),filterModel:t?this.ot:{},advancedFilter:t?this.st:null,quickFilter:t?this.Ke:null})}Nc(){let e=this.za();this.dt=e?.length?{fields:e,values:Ni(this.u,e)}:null}Ba(){this.e.emit("modelUpdated",{rowCount:this.ae.length})}To(e,t,r){let i=this.resolveRowId(t,-1,`add-${this.e.or()}`);if(this.p.has(i)){this.e.reportError(new Error(`Duplicate row id: ${i}`),"transaction.add",{rowId:i});return}let o=Le(t,this.e.r.childrenKey),s={id:i,data:t,rowIndex:-1,selected:!1,treeChildrenLoaded:Array.isArray(o)};this.p.set(i,s),this.Gi.set(s,r);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.To(s,l,r+1)}Va(){this.u=[];let e=t=>{this.u.push(t),this.p.has(t.id)||this.p.set(t.id,t);for(let r of this.ie.get(t.id)??[]){let i=this.p.get(r);i&&e(i)}};for(let t of this.B)e(t)}Wr(e){let t=JSON.stringify(this.ot),r=new Set(this.e.n.te().map(o=>o.id));this.ot=j(e,r);let i=JSON.stringify(this.ot)!==t;return i&&(this.dt=null),i}Q(){return{...this.ot}}sr(e){let t=new Set(this.e.n.te().map(s=>s.id)),r=V(e,t),i=JSON.stringify(this.st);this.st=r,this.e.r.advancedFilterModel=r;let o=JSON.stringify(r)!==i;return o&&(this.dt=null),o}Ie(){return V(this.st)}ar(e){let t=e!=null&&e.trim()!==""?e:null;return t===this.Ke?!1:(this.Ke=t,this.dt=null,!0)}$r(){return this.Ke}Do(){return Object.keys(this.ot).length>0||this.st!=null||this.Ke!=null}w(){this.dt=null;let e=this.e.le.start(),t=this.e.n.c(),r=(a,l)=>this.e.d(a,l);if(this.f){this.Oc(e);return}if(this.Fc(e))return;let i,o=[];if(this.F)i=this.Hc(t,r);else{i=this.u,this.Do()&&!this.e.r.manualFiltering&&(i=i.filter(br(t,this.ot,this.st,this.Ke,r)));let l=this.e.n.J();if(l.length>0&&!this.e.r.manualSorting)try{i=wr(i,l,t,r)}catch(c){this.e.reportError(c,"comparator",{sortModel:l})}let d=this.e.n.nt();if(d.length>0){let c=this.Vc(i,d);i=c.rows,o=c.ambiguousExpansions}else if(this.e.r.masterDetail){let c=[];for(let u of i)c.push(u),this.P.has(u.id)&&this.isRowExpandable(u)&&c.push({id:`__detail__${u.id}`,data:u.data,rowIndex:-1,selected:!1,isDetail:!0,masterId:u.id});i=c}}for(let a of this.u)a.rowIndex=-1;let s=0;i.forEach((a,l)=>{a.rowIndex=l,!a.isDetail&&!a.isGroup&&(s++,this.Fr.set(a,s))}),this.ae=i,this.lr(),this.Nc(),this.Ka(r),this.e.emit("modelUpdated",{rowCount:i.length}),this.e.le.Eo(e),this.Bc(o)}Oc(e){this.u.forEach((t,r)=>{this.Ce||(t.rowIndex=r),this.Fr.set(t,this.Ce?t.rowIndex+1:r+1)}),this.we=this.u,this.ae=this.u,this.Or.clear(),this.Vr++,this.e.emit("modelUpdated",{rowCount:this.u.length}),this.e.le.Eo(e)}Fc(e){let t=this.ho;return this.ho=!1,!t&&this._a()?(this.zc(e),!0):(this.go(),!1)}_a(){if(!this.e.r.dataProcessor||this.u.length<this.e.r.dataProcessorMinRows||this.F||this.e.r.masterDetail||this.e.n.nt().length>0)return!1;let e=!this.e.r.manualFiltering&&this.Do(),t=!this.e.r.manualSorting&&this.e.n.J().length>0;return e||t}zc(e){this.go();let t=this.e.r.dataProcessor;if(!t)return;let r=++this.Br,i=new AbortController;this.Fi=i;let o=this.e.n.c(),s=this.u.flatMap(d=>d.data==null?[]:[{id:d.id,data:d.data}]),a=!this.e.r.manualFiltering,l=!this.e.r.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.n.J():[],filterModel:a?this.Q():{},advancedFilterModel:a?this.Ie():null,quickFilterText:a?this.Ke:null,signal:i.signal})).then(d=>{if(r!==this.Br||i.signal.aborted||this.e.s())return;let c=new Set,u=[];for(let p of d.rowIds){if(c.has(p))continue;c.add(p);let m=this.p.get(p);m&&!m.isDetail&&!m.isGroup&&u.push(m)}for(let p of this.u)p.rowIndex=-1;u.forEach((p,m)=>{p.rowIndex=m,this.Fr.set(p,m+1)}),this.ae=u,this.lr();let h=(p,m)=>this.e.d(p,m);this.Ka(h),this.e.emit("modelUpdated",{rowCount:u.length}),this.e.le.Eo(e),this.e.h({data:!0})}).catch(d=>{r!==this.Br||i.signal.aborted||this.e.s()||(this.e.reportError(d,"dataProcessor.process"),this.ho=!0,this.w(),this.e.h({data:!0}))}).finally(()=>{r===this.Br&&(this.Fi=null)})}go(){this.Br++,this.Fi?.abort(),this.Fi=null}get Ae(){return this.e.r.paginationEnabled&&!this.f}lr(){if(!this.Ae){this.we=this.ae,this.Vr++;return}let e=this.jr(),t=this.getPageCount();if(this.W>t&&(this.W=t),this.W<1&&(this.W=1),this.e.r.paginationPage=this.W,this.e.r.paginationMode==="server"){this.ae.forEach((o,s)=>{o.rowIndex=s}),this.we=this.ae,this.Vr++;return}let r=(this.W-1)*e,i=this.ae.slice(r,r+e);i.forEach((o,s)=>{o.rowIndex=s}),this.we=i,this.Vr++}jr(){return this.Ur=this.e.r.paginationPageSize,Math.max(1,this.Ur)}qr(){return this.Ae?this.W:1}getTotalRowCount(){return this.f?this.ir():this.Ae&&this.e.r.paginationMode==="server"?this.e.r.paginationTotal:this.ae.length}getPageCount(){return this.Ae?Math.max(1,Math.ceil(this.getTotalRowCount()/this.jr())):1}Wa(){return this.ae}setPage(e,t=!1){if(!this.Ae)return;let r=this.getPageCount(),i=Math.max(1,Math.min(Math.round(e)||1,r));i!==this.W&&(this.W=i,this.e.r.paginationPage=i,this.lr(),this.e.h({data:!0}),this.e.a.dr(0,"top"),t||this.Ki())}setPageSize(e){if(!this.Ae)return;let t=Math.max(1,Math.round(e)||this.jr()),r=(this.W-1)*this.jr();this.e.r.paginationPageSize=t,this.Ur=t,this.W=Math.floor(r/t)+1,this.e.r.paginationPage=this.W,this.lr(),this.e.h({data:!0}),this.Ki()}$a(e,t){this.Ur=Math.max(1,Math.round(t)||1),this.e.r.paginationPageSize=this.Ur,this.W=Math.max(1,Math.round(e)||1),this.e.r.paginationPage=this.W}Wi(e){this.e.r.paginationEnabled!==e&&(this.e.r.paginationEnabled=e&&!this.f,this.e.r.paginationEnabled&&(this.W=1),this.lr(),this.e.h({data:!0}),this.Ki())}_c(){this.Ae&&(this.W=this.e.r.paginationMode==="server"?this.e.r.paginationPage:1,this.lr(),this.e.h({data:!0}),this.Ki())}Ki(){this.e.emit("paginationChanged",{page:this.qr(),pageSize:this.jr(),pageCount:this.getPageCount(),total:this.getTotalRowCount()})}Hc(e,t){let r=this.e.r.manualSorting?[]:this.e.n.J(),i=new Map,o=this.Do()&&!this.e.r.manualFiltering,s=br(e,this.ot,this.st,this.Ke,t),a=c=>{let u=i.get(c.id);if(u!==void 0)return u;let h=!0;if(o){h=s(c);for(let p of this.ie.get(c.id)??[]){let m=this.p.get(p);m&&a(m)&&(h=!0)}}return i.set(c.id,h),h},l=[],d=c=>{let u=c;r.length>0&&(u=wr(c,r,e,t));for(let h of u)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.B),l}Kc(){let e=this.Ra,t=0;for(let r of this.we)!r.isDetail&&!r.isGroup&&(e[t++]=r);return e.length=t,e}Wc(e,t,r,i){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:r,rowIndex:e.rowIndex});return Math.max(1,Math.min(Math.round(s)||1,i))}catch(s){return this.e.reportError(s,"rowSpan",{colId:t.id,rowId:e.id}),1}}$c(e,t,r,i,o){if(!r.colDef.autoRowSpan||i==null||i==="")return 1;let s=1;for(;t+s<e.length&&et(i,o(e[t+s],r))===0;)s++;return s}Uc(e,t,r){let i=new Int32Array(e.length),o=0;for(;o<e.length;){let s=e[o],a=r(s,t),l=t.colDef.rowSpan?this.Wc(s,t,a,e.length-o):this.$c(e,o,t,a,r);i[o]=l;for(let d=1;d<l;d++)i[o+d]=-1;o+=l}return i}Ka(e){if(this.Or.clear(),this.F||this.e.r.masterDetail||this.e.n.nt().length>0)return;let t=this.e.n.c().filter(i=>i.colDef.rowSpan!=null||i.colDef.autoRowSpan===!0);if(t.length===0)return;let r=this.Kc();if(r.length!==0)for(let i of t)this.Or.set(i.id,this.Uc(r,i,e))}jc(e){return this.Or.get(e)}Ua(e){return this.Fr.get(e)??0}Co(e){return this.Gi.get(e)??0}Vc(e,t){let r=rt(this.e.r.aggFuncs),i=this.e.n.fc();this.tr=[];let o=l=>{let d={};for(let c of i){let u=r(c.colDef.aggFunc);if(u)try{d[c.id]=Mi(l,u,h=>this.e.d(h,c))}catch(h){this.e.reportError(h,"aggFunc",{colId:c.id,aggFunc:c.colDef.aggFunc}),d[c.id]=null}}return d},s=ki(this.j,this.u,t,(l,d)=>this.e.d(l,d));this.j=s.expanded;let a=Li(e,t,(l,d)=>this.e.d(l,d),o,this.j);return this.tr=a.ids,{rows:a.rows,ambiguousExpansions:s.ambiguous}}Bc(e){for(let t of e){if(this.e.s())return;this.e.reportError(new Error(`Ambiguous legacy group expansion: ${t}`),"gridState.groupExpansion",{groupId:t})}}isRowExpandable(e){if(this.F){if(this.wo(e.id)||e.treeLoading)return!0;if(e.treeChildrenLoaded||!e.data||!this.e.r.loadTreeChildren)return!1;let r=this.e.r.isTreeRowExpandable;if(!r)return!1;try{return r({data:e.data,node:e,api:this.e.api})}catch(i){return this.e.reportError(i,"isTreeRowExpandable",{rowId:e.id}),!1}}if(!this.e.r.masterDetail)return!1;let t=this.e.r.isRowExpandable;if(t)try{return t({data:e.data,node:e,api:this.e.api})}catch(r){return this.e.reportError(r,"isRowExpandable",{rowId:e.id}),!1}return!0}isRowExpanded(e){return this.P.has(e)}qc(){return[...this.P]}Yc(){return[...this.j]}Xc(e,t){this.P=new Set(e.filter(r=>this.p.has(r))),this.j=new Set(t)}xo(e){return this.Ro(e,!0)}So(e){return this.Ro(e,!1)}$i(e){return this.Ro(e,!this.P.has(e))}Ro(e,t){let r=this.p.get(e);return!r||t&&!this.isRowExpandable(r)?!1:(t===this.P.has(e)||(t?this.P.add(e):this.P.delete(e),this.w(),this.e.h({data:!0}),this.e.emit("detailToggled",{rowId:e,rowNode:r,expanded:t}),t&&this.F&&!this.wo(e)&&!r.treeLoading&&this.loadTreeChildren(e).catch(()=>{})),t)}Mo(){let e=!1;for(let t of this.u)!this.P.has(t.id)&&this.isRowExpandable(t)&&(this.P.add(t.id),e=!0);e&&(this.w(),this.e.h({data:!0}))}Io(){this.P.size!==0&&(this.P.clear(),this.w(),this.e.h({data:!0}))}Ao(e){return this.setGroupExpanded(e,!this.j.has(e))}isGroupExpanded(e){return this.j.has(e)}Lo(){if(this.tr.length===0)return;let e=!1;for(let t of this.tr)this.j.has(t)||(this.j.add(t),e=!0);e&&(this.w(),this.e.h({data:!0}))}ko(){this.j.size!==0&&(this.j.clear(),this.w(),this.e.h({data:!0}))}setGroupExpanded(e,t){return!this.tr.includes(e)||t===this.j.has(e)||(t?this.j.add(e):this.j.delete(e),this.w(),this.e.h({data:!0})),t}ja(){return!this.F&&!this.f&&!this.e.r.dataProcessor&&this.e.r.paginationMode!=="server"&&this.e.n.J().length===0&&this.e.n.nt().length===0}qa(e,t){if(!this.ja()||!Number.isInteger(e)||!Number.isInteger(t))return!1;let r=this.m(e),i=this.m(t);if(!r||!i||r.isDetail||i.isDetail||r.isGroup||i.isGroup)return!1;let o=this.u.indexOf(r),s=this.u.indexOf(i);return o<0||s<0||o===s?!1:(this.u.splice(o,1),this.u.splice(s,0,r),this.w(),this.e.h({data:!0}),!0)}be(){return this.u}Jc(){return this.B}pt(){return this.we}A(){return this.Ce?this.nr():this.we.length}m(e){return this.Ce?e<0||e>=this.nr()?void 0:this.ct.get(e)??this.xc(e):this.we[e]}$(e){return this.p.get(e)}Po(e){this.u.forEach(e)}Go(e){let t=0;for(let r of this.ae)r.isDetail||r.isGroup||e(r,t++)}};var at=class{constructor(e){this.e=e;this.S=new Set;this.$e=null;this.Yr=new Set}fo(e){return this.S.has(e)}Zc(e){return this.Yr.has(e)}Ue(e){if(e.loading)return!1;let t=this.Qc(e),r=t?.colDef.selectable;if(!t||!r)return!0;try{return r({api:this.e.api,colDef:t.colDef,column:t,node:e,data:e.data,value:this.e.d(e,t),rowIndex:e.rowIndex})}catch(i){return this.e.reportError(i,"selectable",{rowId:e.id,colId:t?.id}),!1}}Qc(e){if(!(e.isGroup||e.isDetail))return this.e.n.c().find(t=>t.hasCheckbox&&t.colDef.selectable!=null)}je(){return this.e.i.be().filter(e=>this.S.has(e.id))}Ui(){return this.je().filter(e=>e.data!=null).map(e=>e.data)}ji(){return[...this.S]}eu(e){let t=new Set(e),r=this.e.i.be().filter(i=>t.has(i.id)&&!i.isDetail&&!i.isGroup).map(i=>({node:i,selected:!0}));this.De(r,!0)}Ha(e){if(!e)this.S.clear(),this.$e=null;else{let t=new Set(this.e.i.be().map(r=>r.id));for(let r of[...this.S])t.has(r)||this.S.delete(r);this.$e!=null&&!t.has(this.$e)&&(this.$e=null)}for(let t of this.e.i.be())t.selected=this.S.has(t.id);this.Ya()}Xa(e){let t=e.leafNodes??[];if(t.length===0)return{all:!1,some:!1};let r=0,i=0;for(let o of t)this.Ue(o)&&(r++,this.S.has(o.id)&&i++);return r===0?{all:!1,some:!1}:{all:i===r,some:i>0}}tu(e,t){let r=(e.leafNodes??[]).filter(i=>this.Ue(i));r.length!==0&&this.De(r.map(i=>({node:i,selected:t})))}Ja(e,t,r=!1){this.De([{node:e,selected:t,clearOthers:r}])}No(e,t=!0,r=!0){let i=this.e.i.$(e);i&&this.Ja(i,t,r)}ru(e,t){let r=t==="single";this.De([{node:e,selected:r?!0:!e.selected,clearOthers:r}]),this.$e=e.id}iu(e,t,r){return!r||!t.ctrlKey&&!t.metaKey?!1:(this.De([{node:e,selected:!e.selected}]),this.$e=e.id,!0)}nu(e,t,r){if(!r||!t.shiftKey||this.$e==null)return!1;let i=this.e.i.$(this.$e);if(!i||i.rowIndex<0||e.rowIndex<0)return!1;let o=Math.min(i.rowIndex,e.rowIndex),s=Math.max(i.rowIndex,e.rowIndex),a=[];for(let l=o;l<=s;l++){let d=this.e.i.m(l);d&&!d.isDetail&&!d.isGroup&&this.Ue(d)&&a.push({node:d,selected:!0})}return this.De(a),!0}Za(e,t,r){let i=this.e.r.rowSelection;if(i==="none"||!this.Ue(e))return;if(r){this.ru(e,i);return}let o=i==="multiple";this.iu(e,t,o)||this.nu(e,t,o)||(this.De([{node:e,selected:!0,clearOthers:!0}]),this.$e=e.id)}selectAll(e=!0){let t=this.e.r.rowSelection;if(t==="none")return;let i=(e?this.e.i.pt():this.e.i.be()).filter(o=>!o.isDetail&&!o.isGroup&&this.Ue(o));if(i.length!==0){if(t==="single"){this.De([{node:i[0],selected:!0,clearOthers:!0}]);return}this.De(i.map(o=>({node:o,selected:!0})))}}deselectAll(){this.De([],!0)}ou(){let t=this.e.i.pt().filter(r=>!r.isDetail&&!r.isGroup).filter(r=>this.Ue(r));if(t.length===0)return!1;if(this.e.i.f){let r=this.e.i.ir();if(t.length<r)return!1}return t.every(r=>this.S.has(r.id))}su(){let t=this.e.i.pt().filter(i=>!i.isDetail&&!i.isGroup).filter(i=>this.Ue(i)),r=t.reduce((i,o)=>i+(this.S.has(o.id)?1:0),0);if(r===0)return!1;if(this.e.i.f){let i=this.e.i.ir();if(t.length<i)return!0}return r>0&&r<t.length}au(e,t=!1){this.De(e,t)}lu(e,t,r){!t&&!e.some(i=>i.clearOthers)||(this.S=t?new Set:new Set(e.filter(i=>i.selected).flatMap(i=>r?this.Qa(i.node):[i.node.id])))}du(e,t){for(let r of e){if(!this.Ue(r.node))continue;let i=t?this.Qa(r.node):[r.node.id];for(let o of i)r.selected?this.S.add(o):this.S.delete(o)}}cu(e){let t=new Set;for(let r of new Set([...e,...this.S]))e.has(r)!==this.S.has(r)&&t.add(r);return t}uu(e,t,r){let i=[],o=new Set([...e,...r,...this.Yr]);for(let s of this.e.i.be()){let a=this.S.has(s.id);s.selected=a,(o.has(s.id)||t.get(s.id)!==a)&&s.rowIndex>=0&&i.push(s.rowIndex)}return i}De(e,t=!1){let r=new Set(this.S),i=this.e.i.F&&this.e.r.autoCheckedChildren;this.lu(e,t,i),this.du(e,i);let o=this.cu(r),s=new Map;for(let d of this.e.i.be())s.set(d.id,d.selected);let a=new Set(this.Yr);this.Ya();let l=this.uu(o,s,a);o.size>0&&(this.e.a.ft(l),this.e.K.zi(),this.e.emit("selectionChanged",{selectedNodes:this.je(),selectedRows:this.Ui()}))}Qa(e){let t=[e.id],r=i=>{for(let o of this.e.i._r(i))t.push(o),r(o)};return r(e.id),t}Ya(){if(this.Yr.clear(),!this.e.i.F)return;let e=t=>{let r=this.e.i._r(t);if(r.length===0)return{all:this.S.has(t),some:this.S.has(t)};let i=!0,o=!1;for(let s of r){let a=e(s);a.all?o=!0:(a.some&&(o=!0),i=!1)}return o&&!i&&this.Yr.add(t),i?this.S.add(t):this.S.delete(t),{all:i,some:o}};for(let t of this.e.i.Jc())e(t.id);for(let t of this.e.i.be())t.selected=this.S.has(t.id)}};var lt=class{constructor(e){this.e=e;this.Gt=null;this.ne=0;this.mt=0;this.Le=null;this.Nt=null;this.gt=e=>{let t=this.Fo(e);t&&(this.mt=this.nl(t,e.clientX),t.didResize||(t.didResize=Math.abs(this.mt-t.startWidth)>=.5),!this.ne&&(this.ne=requestAnimationFrame(()=>{this.ne=0,this.fu()})))};this.ke=e=>{let t=this.Fo(e);t&&(this.mt=this.nl(t,e.clientX),t.didResize||(t.didResize=Math.abs(this.mt-t.startWidth)>=.5),this.mu(t))};this.Ft=e=>{this.Fo(e)&&this.Ot()};this.tl=()=>{this.Ot()}}hu(e,t){if(!this.e.r.enableColumnResize||!t.resizable||e.isPrimary===!1)return;this.Ot();let r=e.currentTarget,i=t.currentWidth;this.mt=i,this.Gt={column:t,didResize:!1,handle:r,pointerId:e.pointerId,startFlex:t.flex,startManualWidth:t.manualWidth,startWidth:i,startX:e.clientX},window.addEventListener("pointermove",this.gt),window.addEventListener("pointerup",this.ke,!0),window.addEventListener("pointercancel",this.Ft,!0),r.addEventListener("lostpointercapture",this.tl);try{r.setPointerCapture?.(e.pointerId)}catch{}this.e.o.root.classList.add("mach-root--resizing"),r.classList.add("mach-header-resize--active"),this.pu(this.Gt)}Ot(e=!0){let t=this.Gt;t&&(this.Gt=null,this.Oo(),this.rl(t),e&&(t.column.manualWidth=t.startManualWidth,t.column.flex=t.startFlex,this.e.qe()),this.e.o.root.classList.remove("mach-root--resizing"),this.il(t))}mu(e){this.Gt=null,this.Oo(),e.didResize&&(Math.abs(this.mt-e.startWidth)<.5?(e.column.manualWidth=e.startManualWidth,e.column.flex=e.startFlex):this.e.n.Se(e.column,this.mt),this.e.qe()),this.rl(e);try{e.handle.releasePointerCapture?.(e.pointerId)}catch{}this.e.o.root.classList.remove("mach-root--resizing"),this.il(e),e.didResize&&this.e.cr([e.column])}fu(){let e=this.Gt;!e||!this.e.n.Se(e.column,this.mt)||(this.e.qe(),this.Xr(e),this.e.ol(e.column,!1))}pu(e){this.Le=document.createElement("div"),this.Le.className="mach-column-resize-guide",this.Le.setAttribute("aria-hidden","true"),this.Nt=document.createElement("span"),this.Nt.className="mach-column-resize-label",this.Le.appendChild(this.Nt),this.e.o.root.appendChild(this.Le),this.Xr(e)}Xr(e){if(!this.Le||!this.Nt)return;let t=this.e.o.root,r=t.getBoundingClientRect(),i=e.handle.parentElement.getBoundingClientRect(),o=Math.max(0,Math.min(t.clientWidth,i.right-r.left-t.clientLeft)),s=Math.max(32,Math.min(t.clientWidth-32,o));this.Le.style.left=`${o}px`,this.Le.style.top=`${Math.max(0,i.top-r.top-t.clientTop)}px`,this.Nt.style.left=`${s-o}px`,this.Nt.textContent=`${Math.round(e.column.currentWidth)} px`}il(e){e.handle.classList.remove("mach-header-resize--active"),this.Le?.remove(),this.Le=null,this.Nt=null}nl(e,t){let r=Number.isFinite(t)?t:e.startX;return Math.max(1,e.startWidth+r-e.startX)}Fo(e){let t=this.Gt;return t&&e.pointerId===t.pointerId?t:null}Oo(){this.ne&&cancelAnimationFrame(this.ne),this.ne=0}rl(e){window.removeEventListener("pointermove",this.gt),window.removeEventListener("pointerup",this.ke,!0),window.removeEventListener("pointercancel",this.Ft,!0),e.handle.removeEventListener("lostpointercapture",this.tl)}destroy(){this.Ot(!1),this.Oo(),this.e.o.root?.classList.remove("mach-root--resizing")}};var Fi=6,dt=class{constructor(e){this.e=e;this.Jr=null;this.ur=null;this.Ho=!1;this.de=0;this.qi=null;this.gt=e=>{if(this.ur){this.vu(e);return}let t=this.Jr;t&&(Math.abs(e.clientX-t.startX)<Fi&&Math.abs(e.clientY-t.startY)<Fi||this.bu(e))};this.ke=e=>{this.Jr=null,e.type!=="pointercancel"&&this.ur&&this.zo(e.clientX,e.clientY),this.Vo();let t=this.sl();t&&e.type!=="pointercancel"&&t.targetIndex>=0&&this.e.At(t.column.id,t.targetIndex)}}gu(e,t){e.button===0&&t.movable&&(this.Jr={column:t,startX:e.clientX,startY:e.clientY},window.addEventListener("pointermove",this.gt),window.addEventListener("pointerup",this.ke),window.addEventListener("pointercancel",this.ke))}yu(){let e=this.Ho;return this.Ho=!1,e}bu(e){let t=this.Jr;if(!t)return;let r=this.wu(t.column);if(!r||!r.parentElement){this.Vo();return}this.Ho=!0;let i=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",G(o,this.e.o.root),document.body.appendChild(o),r.parentElement.appendChild(i),r.classList.add("mach-header-cell--dragging"),this.e.o.root.classList.add("mach-root--dragging");let s=this.e.a.Bo(t.column),a=this.e.o.hr[s],l=this.e.n.T(s),d=new Float64Array(l.length+1),c=new Float64Array(l.length);for(let h=0;h<l.length;h++){let p=l[h].currentWidth;c[h]=d[h]+p/2,d[h+1]=d[h]+p}let u=o.getBoundingClientRect();this.ur={column:t.column,cellEl:r,ghost:o,indicator:i,targetIndex:-1,pane:s,containerLeft:a.getBoundingClientRect().left,startScrollLeft:this.e.o.M.center.scrollLeft,fromIndex:l.indexOf(t.column),midpoints:c,offsets:d,ghostWidth:u.width,ghostHeight:u.height},this.zo(e.clientX,e.clientY)}wu(e){let t=this.e.a.Bo(e);return this.e.o.hr[t].querySelector(`.mach-header-cell[data-col-id="${ms(e.id)}"]`)}vu(e){this.qi={clientX:e.clientX,clientY:e.clientY},!this.de&&(this.de=requestAnimationFrame(()=>{this.de=0;let t=this.qi;this.qi=null,t&&this.zo(t.clientX,t.clientY)}))}zo(e,t){let r=this.ur;if(!r)return;let i=E(e+12,8,window.innerWidth-r.ghostWidth-8),o=E(t+12,8,window.innerHeight-r.ghostHeight-8);r.ghost.style.transform=`translate3d(${i}px, ${o}px, 0)`;let s=r.pane==="center"?this.e.o.M.center.scrollLeft-r.startScrollLeft:0,a=e-(r.containerLeft-s),l=r.midpoints.length;for(let d=0;d<r.midpoints.length;d++)if(a<r.midpoints[d]){l=d;break}r.targetIndex=l>r.fromIndex?l-1:l,r.indicator.style.transform=`translate3d(${r.offsets[l]}px, 0, 0)`}sl(){let e=this.ur;return e?(this.ur=null,e.cellEl.classList.remove("mach-header-cell--dragging"),e.ghost.remove(),e.indicator.remove(),this.e.o.root.classList.remove("mach-root--dragging"),e):null}Vo(){window.removeEventListener("pointermove",this.gt),window.removeEventListener("pointerup",this.ke),window.removeEventListener("pointercancel",this.ke),this.de&&cancelAnimationFrame(this.de),this.de=0,this.qi=null}destroy(){this.Vo(),this.sl(),this.Jr=null}};function ms(n){return typeof CSS<"u"&&typeof CSS.escape=="function"?CSS.escape(n):n.replace(/[^a-zA-Z0-9_-]/g,"\\$&")}var Tr=/^[+-]?(?:\d+(?:\.\d+)?|\.\d+)(?:[eE][+-]?\d+)?$/;function ct(n,e=!0){if(n==="")return null;if(!e||typeof n!="string"||!Tr.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 gs(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 oe(n){return typeof n!="string"||n===""||Tr.test(n)?n:/^[\s\u0000-\u001f]*[=+\-@]/.test(n)?"'"+n:n}function Hi(n,e={}){let t=e.columnSeparator??",",r=e.protectFormulas??!0,i=n.map(o=>o.map(s=>gs(r?oe(s):s,t)).join(t)).join(`\r
3
3
  `);return e.prependBOM?"\uFEFF"+i:i}function Dr(n){return n==null?"":String(n)}function ys(n,e){let t=e?oe(n):n,r=Dr(t);return/["\t\n\r]/.test(r)?'"'+r.replace(/"/g,'""')+'"':r}function ut(n,e=!0){return n.map(t=>t.map(r=>ys(r,e)).join(" ")).join(`
4
4
  `)}function ht(n){return ft(n," ")}function pt(n,e=","){return ft(n,e)}function ft(n,e){let t=[],r=[],i="",o=!1,s=0;for(;s<n.length;){let a=n[s];if(o){if(a==='"'){if(n[s+1]==='"'){i+='"',s+=2;continue}o=!1,s++;continue}i+=a,s++;continue}if(a==='"'&&i===""){o=!0,s++;continue}if(a===e){r.push(i),i="",s++;continue}if(a===`
package/dist/index.d.cts CHANGED
@@ -2,8 +2,8 @@ import { c as GridOptions, b as GridApi, S as SortModel, h as FilterModel, A as
2
2
  export { y as ActionPolicy, z as ActionPolicyContext, B as ApplyGridStateOptions, D as CellAlign, E as CellClassParams, H as CellClassRule, J as CellClickEvent, K as CellContextMenuEvent, L as CellDoubleClickEvent, M as CellEditingStartedEvent, N as CellEditingStoppedEvent, O as CellEditorFactory, P as CellEditorParams, Q as CellRendererOutput, R as CellStyleRule, T as CellValueChangedEvent, U as ColDefOrGroup, W as ColumnLayoutMode, X as ColumnMovedEvent, Y as ColumnResizedEvent, Z as ColumnStatus, _ as ColumnVisibilityChangedEvent, $ as ColumnWorkbenchItem, a0 as ContextMenuItem, a1 as ContextMenuParams, a2 as CsvExportParams, a3 as DEFAULT_LOCALE, a4 as DatasourceMode, a5 as DateFilterCondition, a6 as DateFilterMatch, a7 as DetailRowRendererParams, a8 as DetailToggledEvent, a9 as DirtyStateChangedEvent, aa as DomLayoutMode, ab as EVENT_TYPES, ac as EditableIndicator, ad as EditableParams, ae as EventHandlers, af as FilterChangedEvent, F as FilterType, ag as GetRowHeightParams, ah as GridAsyncOptions, ai as GridBatchSaveResult, aj as GridCellChange, a as GridCellRange, ak as GridColumnsApi, e as GridComponents, al as GridDataProcessorColumn, am as GridDataProcessorRequest, an as GridDataProcessorResult, ao as GridDataProcessorRow, ap as GridDatasource, aq as GridDiagnosticError, ar as GridDiagnostics, as as GridDiagnosticsApi, at as GridEditType, au as GridEditingApi, av as GridErrorCode, aw as GridErrorEvent, ax as GridEventBase, ay as GridEventMap, j as GridEventType, az as GridFeatureContext, aA as GridFilteringApi, aB as GridHierarchyApi, aC as GridIoApi, aD as GridPaginationApi, aE as GridPerformanceSnapshot, aF as GridPersistenceOptions, aG as GridReadyEvent, aH as GridRowsApi, aI as GridSelectionApi, aJ as GridSortingApi, aK as GridStateApi, aL as GridStateSection, aM as GridUpdateSchedulerSnapshot, aN as GridViewApi, aO as HeaderComponentParams, aP as ICellEditor, aQ as ICellRendererResult, aR as ImportCsvOptions, I as ImportMatrixOptions, aS as InfiniteGetRowsParams, aT as LOCALE_EN, aU as MachTableLocale, aV as MachTableLocaleKey, aW as MatrixExportParams, aX as ModelUpdatedEvent, aY as NumberFilterCondition, aZ as NumberFilterMatch, a_ as OverlayContent, a$ as OverlayTemplate, b0 as PaginationChangedEvent, b1 as PaginationConfig, b2 as PinnedDirection, b3 as PrintOptions, b4 as RangeSelectionChangedEvent, b5 as RefreshCellsParams, b6 as RemoteBlockCacheSnapshot, b7 as ResolvedGridOptions, b8 as RowClickEvent, b9 as RowDragEndEvent, ba as RowDragIntent, bb as RowDragPolicy, bc as RowEditChange, bd as RowEditValidationParams, be as RowEditValidationResult, bf as RowEditingStartedEvent, bg as RowEditingStoppedEvent, bh as RowNode, bi as RowSelectionMode, bj as RowStyleParams, bk as RowStyleRule, bl as RowTone, bm as RowTransaction, bn as SaveChangeIssue, k as SaveChangesHandler, bo as SaveChangesResult, bp as SelectEditorOption, bq as SelectEditorParams, br as SelectionChangedEvent, bs as SetFilterCondition, bt as SetFilterParams, bu as SortChangedEvent, bv as SortDirection, bw as SortModelItem, bx as StatusBarConfig, by as StatusBarPanel, bz as TextFilterCondition, bA as TextFilterMatch, bB as ThemeMode, bC as TooltipParams, bD as TreeChildrenLoadFailedEvent, bE as TreeChildrenLoadedEvent, bF as TreeDataLoadParams, bG as ValueFormatterParams, bH as ValueGetterParams, bI as ValueInputSource, V as ValueOutputTarget, bJ as ValueParserParams, bK as ValueSerializerParams, bL as ValueSetterParams, bM as WatermarkConfig, bN as formatText, bO as formatTwo, bP as isColDefGroup, bQ as matchLocaleKey } from './api-Di5SQHAP.cjs';
3
3
  export { FieldDataProcessorOptions, GridDataProcessorPayload, GridDataWorkerScope, GridWorkerCancelMessage, GridWorkerProcessMessage, GridWorkerRequestMessage, GridWorkerResponseMessage, WorkerDataProcessorOptions } from './worker.cjs';
4
4
  export { b as MachTableConfigWarning, c as MachTableDefaults, d as MachTableInstanceOptionKey, M as MachTableOptionExplanation, e as MachTablePreset, f as MachTablePresetSelection, g as MachTableRuntimeConfig, R as ResolvedMachTableConfig, h as defineMachTableConfig } from './configuration-DlRW86iR.cjs';
5
- import { D as DictionaryKey, C as CachedDictionary } from './cachedDictionary-HXvqrDI0.cjs';
6
- export { b as CachedDictionaryOptions, a as DictionaryEntry, c as createCachedDictionary } from './cachedDictionary-HXvqrDI0.cjs';
5
+ import { D as DictionaryKey, C as CachedDictionary } from './cachedDictionary-C26hMT22.cjs';
6
+ export { a as CachedDictionaryOptions, b as DictionaryEntry, c as createCachedDictionary } from './cachedDictionary-C26hMT22.cjs';
7
7
 
8
8
  declare function createGrid<TData = any>(container: HTMLElement, options?: GridOptions<TData>): GridApi<TData>;
9
9
 
package/dist/index.d.ts CHANGED
@@ -2,8 +2,8 @@ import { c as GridOptions, b as GridApi, S as SortModel, h as FilterModel, A as
2
2
  export { y as ActionPolicy, z as ActionPolicyContext, B as ApplyGridStateOptions, D as CellAlign, E as CellClassParams, H as CellClassRule, J as CellClickEvent, K as CellContextMenuEvent, L as CellDoubleClickEvent, M as CellEditingStartedEvent, N as CellEditingStoppedEvent, O as CellEditorFactory, P as CellEditorParams, Q as CellRendererOutput, R as CellStyleRule, T as CellValueChangedEvent, U as ColDefOrGroup, W as ColumnLayoutMode, X as ColumnMovedEvent, Y as ColumnResizedEvent, Z as ColumnStatus, _ as ColumnVisibilityChangedEvent, $ as ColumnWorkbenchItem, a0 as ContextMenuItem, a1 as ContextMenuParams, a2 as CsvExportParams, a3 as DEFAULT_LOCALE, a4 as DatasourceMode, a5 as DateFilterCondition, a6 as DateFilterMatch, a7 as DetailRowRendererParams, a8 as DetailToggledEvent, a9 as DirtyStateChangedEvent, aa as DomLayoutMode, ab as EVENT_TYPES, ac as EditableIndicator, ad as EditableParams, ae as EventHandlers, af as FilterChangedEvent, F as FilterType, ag as GetRowHeightParams, ah as GridAsyncOptions, ai as GridBatchSaveResult, aj as GridCellChange, a as GridCellRange, ak as GridColumnsApi, e as GridComponents, al as GridDataProcessorColumn, am as GridDataProcessorRequest, an as GridDataProcessorResult, ao as GridDataProcessorRow, ap as GridDatasource, aq as GridDiagnosticError, ar as GridDiagnostics, as as GridDiagnosticsApi, at as GridEditType, au as GridEditingApi, av as GridErrorCode, aw as GridErrorEvent, ax as GridEventBase, ay as GridEventMap, j as GridEventType, az as GridFeatureContext, aA as GridFilteringApi, aB as GridHierarchyApi, aC as GridIoApi, aD as GridPaginationApi, aE as GridPerformanceSnapshot, aF as GridPersistenceOptions, aG as GridReadyEvent, aH as GridRowsApi, aI as GridSelectionApi, aJ as GridSortingApi, aK as GridStateApi, aL as GridStateSection, aM as GridUpdateSchedulerSnapshot, aN as GridViewApi, aO as HeaderComponentParams, aP as ICellEditor, aQ as ICellRendererResult, aR as ImportCsvOptions, I as ImportMatrixOptions, aS as InfiniteGetRowsParams, aT as LOCALE_EN, aU as MachTableLocale, aV as MachTableLocaleKey, aW as MatrixExportParams, aX as ModelUpdatedEvent, aY as NumberFilterCondition, aZ as NumberFilterMatch, a_ as OverlayContent, a$ as OverlayTemplate, b0 as PaginationChangedEvent, b1 as PaginationConfig, b2 as PinnedDirection, b3 as PrintOptions, b4 as RangeSelectionChangedEvent, b5 as RefreshCellsParams, b6 as RemoteBlockCacheSnapshot, b7 as ResolvedGridOptions, b8 as RowClickEvent, b9 as RowDragEndEvent, ba as RowDragIntent, bb as RowDragPolicy, bc as RowEditChange, bd as RowEditValidationParams, be as RowEditValidationResult, bf as RowEditingStartedEvent, bg as RowEditingStoppedEvent, bh as RowNode, bi as RowSelectionMode, bj as RowStyleParams, bk as RowStyleRule, bl as RowTone, bm as RowTransaction, bn as SaveChangeIssue, k as SaveChangesHandler, bo as SaveChangesResult, bp as SelectEditorOption, bq as SelectEditorParams, br as SelectionChangedEvent, bs as SetFilterCondition, bt as SetFilterParams, bu as SortChangedEvent, bv as SortDirection, bw as SortModelItem, bx as StatusBarConfig, by as StatusBarPanel, bz as TextFilterCondition, bA as TextFilterMatch, bB as ThemeMode, bC as TooltipParams, bD as TreeChildrenLoadFailedEvent, bE as TreeChildrenLoadedEvent, bF as TreeDataLoadParams, bG as ValueFormatterParams, bH as ValueGetterParams, bI as ValueInputSource, V as ValueOutputTarget, bJ as ValueParserParams, bK as ValueSerializerParams, bL as ValueSetterParams, bM as WatermarkConfig, bN as formatText, bO as formatTwo, bP as isColDefGroup, bQ as matchLocaleKey } from './api-Di5SQHAP.js';
3
3
  export { FieldDataProcessorOptions, GridDataProcessorPayload, GridDataWorkerScope, GridWorkerCancelMessage, GridWorkerProcessMessage, GridWorkerRequestMessage, GridWorkerResponseMessage, WorkerDataProcessorOptions } from './worker.js';
4
4
  export { b as MachTableConfigWarning, c as MachTableDefaults, d as MachTableInstanceOptionKey, M as MachTableOptionExplanation, e as MachTablePreset, f as MachTablePresetSelection, g as MachTableRuntimeConfig, R as ResolvedMachTableConfig, h as defineMachTableConfig } from './configuration-nh5lvWDe.js';
5
- import { D as DictionaryKey, C as CachedDictionary } from './cachedDictionary-HXvqrDI0.js';
6
- export { b as CachedDictionaryOptions, a as DictionaryEntry, c as createCachedDictionary } from './cachedDictionary-HXvqrDI0.js';
5
+ import { D as DictionaryKey, C as CachedDictionary } from './cachedDictionary-C26hMT22.js';
6
+ export { a as CachedDictionaryOptions, b as DictionaryEntry, c as createCachedDictionary } from './cachedDictionary-C26hMT22.js';
7
7
 
8
8
  declare function createGrid<TData = any>(container: HTMLElement, options?: GridOptions<TData>): GridApi<TData>;
9
9
 
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- var Ve="0.35.3";function P(n,e,t=!1){if(!(typeof n!="number"||!Number.isFinite(n)||n<e))return t?Math.floor(n):n}function B(n){return P(n,0)||void 0}function Be(n){return!n||typeof n.key!="string"||!n.key.trim()?null:{key:n.key.trim(),debounceMs:P(n.debounceMs,0,!0)??160,...n.sections?{sections:[...new Set(n.sections)]}:{},...n.store?{store:n.store}:{}}}function A(n,e,t,r=!1){let i=!1;for(let o of t)(r?Object.prototype.hasOwnProperty.call(n,o):n[o]!=null)&&(e[o]=n[o],i=!0);return i}var $n=new Set(["__proto__","prototype","constructor"]),ge=new Map;function $t(n){if(typeof n!="string"||n.length===0)return null;let e=ge.get(n);if(e!==void 0)return e;let t=n.split("."),r=t.every(i=>i.length>0&&!$n.has(i))?t:null;return n.length<=1024&&(ge.size>=256&&ge.delete(ge.keys().next().value),ge.set(n,r)),r}function Ut(n){return $t(n)!==null}function K(n,e){if(n==null)return;let t=$t(e);if(!t)return;let r=n;for(let i of t){if(r==null)return;r=r[i]}return r}function ye(n,e,t){if(n==null)return!1;let r=$t(e);if(!r)return!1;let i=n;for(let o=0;o<r.length-1;o++){if(typeof i!="object"&&typeof i!="function"||i===null)return!1;i[r[o]]==null&&(i[r[o]]={}),i=i[r[o]]}return typeof i!="object"&&typeof i!="function"||i===null?!1:(i[r[r.length-1]]=t,!0)}var de={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 Un=16,jn=512,qn=20,Yn=2e3,Xn=2e3,Jn={text:new Set(de.text),number:new Set(de.number),date:new Set(de.date)};function Zn(n){return n==null||typeof n=="string"||typeof n=="number"&&Number.isFinite(n)}function Qn(n,e,t){if(n==null||typeof n!="object")return null;let r=n;return typeof r.match!="string"||!t.has(r.match)?null:{match:r.match,...eo(r,e)}}function eo(n,e){let t=e==="number"?Ur(n.value):typeof n.value=="string"?n.value:void 0,r=e==="number"?Ur(n.value2):typeof n.value2=="string"?n.value2:void 0;return{...t!==void 0?{value:t}:{},...r!==void 0?{value2:r}:{}}}function Ur(n){return typeof n=="number"&&Number.isFinite(n)?n:void 0}function to(n,e){let t=[],r=Jn[e];for(let i of n.slice(0,qn)){let o=Qn(i,e,r);o&&t.push(o)}return t}function jt(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(Zn).slice(0,Yn)}:null:e.type!=="text"&&e.type!=="number"&&e.type!=="date"||!Array.isArray(e.conditions)?null:{type:e.type,...e.operator==="or"||e.operator==="and"?{operator:e.operator}:{},conditions:to(e.conditions,e.type)}}function ro(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 r=jt(n.filter);return r?{kind:"condition",colId:t,filter:r}:null}function io(n,e,t){if(!Array.isArray(n.children))return null;let r=[];for(let i of n.children){let o=jr(i,e+1,t);o&&r.push(o)}return r.length===0?null:{kind:"group",operator:n.operator==="or"?"or":"and",children:r,...n.not===!0?{not:!0}:{}}}function no(n,e,t){return e<=Un&&t.nodes<jn&&n!=null&&typeof n=="object"}function jr(n,e,t){if(!no(n,e,t)||t.ancestors.has(n))return null;t.ancestors.add(n),t.nodes++;let r=n,i=r.kind==="condition"?ro(r,t):r.kind==="group"?io(r,e,t):null;return t.ancestors.delete(n),i}function z(n,e){if(n==null||typeof n!="object")return null;let t=n;if(t.version!==1||t.root==null)return null;let r=jr(t.root,0,{ancestors:new WeakSet,nodes:0,validColumnIds:e});return r?{version:1,root:r}:null}function oo(n,e){return{kind:"condition",colId:n,filter:e}}function ee(n,e){if(n==null||typeof n!="object"||Array.isArray(n))return{};let t={};for(let[r,i]of Object.entries(n).slice(0,Xn)){let o=r.trim();if(!o||e?.has(o)===!1)continue;let s=jt(i);s&&(t[o]=s)}return t}function so(n,e,t={}){return{kind:"group",operator:n,children:e,...t.not?{not:!0}:{}}}var qt={align:"center",sortable:!0,resizable:!0,movable:!0,filter:!1,minWidth:80},ve={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}},be={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,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},ao=Object.keys(be);function lo(n){let e={};for(let t of ao)e[t]=n[t]??be[t];return e}function I(n,e,t,r=!1){return P(n,t,r)??e}function co(n){return n&&Object.prototype.hasOwnProperty.call(ve,n)?n:"normal"}function uo(n){return n.theme==="light"||n.theme==="dark"||n.theme==="auto"?n.theme:"light"}function ho(n,e){let t=typeof n.pagination=="object"&&Array.isArray(n.pagination.pageSizeOptions)?n.pagination.pageSizeOptions:void 0,r=t?[...new Set(t.map(i=>I(i,0,1,!0)).filter(Boolean))]:[10,20,50,100];return r.includes(e)||r.push(e),r.sort((i,o)=>i-o)}function Yt(n,e){let t=typeof n=="function"?n(e):K(e,n);return t==null?"":String(t)}function po(n){let e=n.rowKey,t=e?({data:r})=>Yt(e,r):void 0;return{...t?{resolveRowId:t}:{},...e?{rowKey:e}:{}}}function fo(n,e){let t=ve[e];return{columnDefs:Array.isArray(n.columnDefs)?n.columnDefs:[],rowData:Array.isArray(n.rowData)?n.rowData:[],defaultColDef:{...qt,...n.defaultColDef??{}},columnTypes:n.columnTypes??{},...po(n),rowHeight:I(n.rowHeight,t.rowHeight,1),headerHeight:I(n.headerHeight,t.headerHeight,1),rowBuffer:I(n.rowBuffer,8,0,!0),columnLayout:n.columnLayout==="fit"?"fit":"normal",enableColumnResize:n.enableColumnResize===!0,domLayout:n.domLayout==="autoHeight"?"autoHeight":"normal",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 mo(n){return{rowStyleRules:Array.isArray(n.rowStyleRules)?n.rowStyleRules:[],theme:uo(n)}}function go(n){return{editType:n.editType==="fullRow"?"fullRow":"cell",editableIndicator:n.editableIndicator==="always"||n.editableIndicator==="none"?n.editableIndicator:"hover",rowDragPolicy:n.rowDragPolicy,undoStackSize:I(n.undoStackSize,100,0,!0),asyncTransactionWaitMillis:I(n.asyncTransactionWaitMillis,16,0,!0)}}function yo(n){return{detailRowHeight:I(n.detailRowHeight,240,1)}}function vo(n){let e=typeof n.pagination=="object"?n.pagination:void 0,t=I(e?.pageSize,20,1,!0);return{paginationEnabled:n.pagination!==!1&&n.datasource==null,paginationMode:e?.mode==="server"?"server":"client",paginationPage:I(e?.page,1,1,!0),paginationTotal:I(e?.total,0,0,!0),paginationPageSize:t,paginationPageSizeOptions:ho(n,t),paginationShowTotal:e?e.showTotal!==!1:!0,paginationShowSizeSelector:e?e.showPageSizeSelector!==!1:!0}}function Xt(n){return{watermarkEnabled:n.watermark!=null&&n.watermark!==!1,watermarkConfig:n.watermark==null||n.watermark===!1?null:n.watermark===!0?{text:"MachTable"}:n.watermark}}function bo(n){return{advancedFilterModel:z(n.advancedFilterModel),persistence:Be(n.persistence),locale:n.locale??{},tooltipShowDelay:I(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"]}}function wo(n){return{datasourceMode:n.datasourceMode==="block"?"block":"sequential",blockSize:I(n.blockSize,100,1,!0),infiniteBufferRows:I(n.infiniteBufferRows,40,0,!0),maxBlocksInCache:I(n.maxBlocksInCache,12,1,!0),datasourceMaxConcurrentRequests:I(n.datasourceMaxConcurrentRequests,4,1,!0),blockPrefetch:I(n.blockPrefetch,1,0,!0),datasourceRowCount:n.datasourceRowCount==null?null:I(n.datasourceRowCount,0,0,!0),dataProcessorMinRows:I(n.dataProcessorMinRows,5e3,1,!0),datasourceRetryCount:I(n.datasourceRetryCount,2,0,!0),datasourceRetryDelay:I(n.datasourceRetryDelay,300,0,!0),datasourceRetryJitter:Math.min(1,I(n.datasourceRetryJitter,.15,0))}}var Co=["detailRowRenderer","isRowExpandable","aggFuncs","components","actionPolicy","summaryMethod","datasource","getRowHeight","tooltipComponent","getContextMenuItems","initialState","rowEditValidator","isTreeRowExpandable","loadTreeChildren","dataProcessor"];function To(n,e){for(let t of Co)n[t]&&Reflect.set(e,t,n[t])}function Do(n,e){for(let t of Object.keys(n))t.startsWith("on")&&typeof n[t]=="function"&&Reflect.set(e,t,n[t])}function qr(n){let e=co(n.size),t={...lo(n),...fo(n,e),...mo(n),...go(n),...yo(n),...vo(n),...Xt(n),...bo(n),...wo(n),features:Array.isArray(n.features)?n.features:[]};return To(n,t),Do(n,t),t}function Yr(n){return Array.isArray(n)?n.filter(e=>typeof e=="string"&&e.length>0):typeof n=="string"&&n.length>0?[n]:[]}function ce(n,e){return Yr(n.type).includes(e)}function Xr(n,e,t={}){let r={};for(let o of Yr(n.type)){let s=t[o];s&&Object.assign(r,s)}let i={...e,...r,...n};return i.status&&!i.cellRenderer&&(i.cellRenderer="statusTag"),i}var Jt=new WeakMap,ze=new WeakMap,_e=new WeakMap;function we(n){let e=Jt.get(n);return e||(e={},Jt.set(n,e)),e}function Zt(n){return Jt.get(n)}function Jr(n,e){e?ze.set(n,e):ze.delete(n)}function Zr(n){let e=ze.get(n);return ze.delete(n),e}function Qr(n,e){e?_e.set(n,e):_e.delete(n)}function Qt(n){let e=_e.get(n);return _e.delete(n),e}function er(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 k(n,e){let t=Zt(e);if(!t)return;t.flashTimer&&clearTimeout(t.flashTimer),t.flashTimer=void 0;let r=t.destroy;if(t.destroy=void 0,t.refresh=void 0,t.rendererDefinition=void 0,t.rendererRowId=void 0,t.rendererColumnId=void 0,!!r)try{r()}catch(i){n.reportError(i,"cellRenderer.destroy",{colId:e.dataset.colId})}}function ei(n,e,t,r,i,o){let s=n.r.tooltipComponent?"":o,a=r.colDef.tooltipValueGetter;if(a)try{s=a({api:n.api,colDef:r.colDef,column:r,node:t,data:t.data,value:i})??o}catch(l){n.reportError(l,"tooltipValueGetter",{colId:r.id,rowId:t.id})}s?e.setAttribute("title",s):e.removeAttribute("title")}function Eo(n,e,t,r,i,o){let s=Zt(e);if(!s?.refresh||s.rendererDefinition!==i||s.rendererRowId!==t.id||s.rendererColumnId!==r.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:r.id,rowId:t.id}),!1}}function te(n,e,t){return j(n,e,t,n.d(e,t))}function j(n,e,t,r){let i=t.colDef.valueFormatter;if(i)try{let o=i({api:n.api,colDef:t.colDef,column:t,node:e,data:e.data,value:r});return o==null?"":String(o)}catch(o){n.reportError(o,"valueFormatter",{colId:t.id,rowId:e.id})}return er(r)}function Ke(n,e,t,r){let i=r.colDef.cellStyle,o=we(e),s=o.styleKeys;if(s)for(let d of s)Reflect.set(e.style,d,"");if(!i){o.styleKeys=void 0;return}let a;if(typeof i=="function"){let d=n.d(t,r);try{a=i({api:n.api,colDef:r.colDef,column:r,node:t,data:t.data,value:d,rowIndex:t.rowIndex})}catch(c){n.reportError(c,"cellStyle",{colId:r.id,rowId:t.id}),a=null}}else a=i;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 We(n,e,t,r){let i=n.d(t,r),o=te(n,t,r),s=r.colDef.cellRenderer,a=typeof s=="string"?n.lc(s):s;if(a){let l={api:n.api,colDef:r.colDef,column:r,node:t,data:t.data,value:i,formatted:o,rowIndex:t.rowIndex,rendererParams:r.colDef.cellRendererParams};if(Eo(n,e,t,r,a,l)){ei(n,e,t,r,i,o);return}k(n,e);let d;try{d=a(l)}catch(c){n.reportError(c,"cellRenderer",{colId:r.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 c=d;e.replaceChildren(c.el);let u=we(e);u.destroy=c.destroy,c.refresh&&(u.refresh=h=>c.refresh(h),u.rendererDefinition=a,u.rendererRowId=t.id,u.rendererColumnId=r.id)}else e.textContent=""}else k(n,e),e.textContent=o;ei(n,e,t,r,i,o)}function xo(n,e,t){let r=e.colDef.align;if(r==="center"){n.push("mach-cell--center");return}if(r==="right"){n.push("mach-cell--right");return}(ce(e.colDef,"rightAligned")||ce(e.colDef,"numericColumn")||typeof t=="number")&&n.push("mach-cell--num")}function Ro(n,e,t,r,i){let o=r.colDef.cellClass;if(!o)return;if(typeof o=="string"){e.push(o);return}if(Array.isArray(o)){e.push(...o);return}let s={api:n.api,colDef:r.colDef,column:r,node:t,data:t.data,value:i,rowIndex:t.rowIndex};try{let a=o(s);typeof a=="string"?e.push(a):Array.isArray(a)&&e.push(...a)}catch(a){n.reportError(a,"cellClass",{colId:r.id,rowId:t.id})}}function So(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 Ce(n,e,t,r){let i=n.d(t,r),o=["mach-cell"];xo(o,r,i),Ro(n,o,t,r,i),So(o,e,r);let s=o.join(" ");e.className!==s&&(e.className=s)}function Te(n,e){return n&&Object.prototype.hasOwnProperty.call(n,e)?n[e]:void 0}function $e(n,e){if(n==null||n===""||!e||typeof e!="object")return;let t=Te(e,String(n));return typeof t=="string"?{color:t}:t}var Ue=class{constructor(e){this.e=e;this.Xn="";this.kr=!0}Jn(){var i;let e=getComputedStyle(this.e.o.root),t=`${e.getPropertyValue("--mach-header-font-weight")||650} ${e.fontSize} ${e.fontFamily}`;this[i="kr"]||(this[i]=t!==this.Xn),this.Xn=t;let r=!1;for(let o of this.e.n.c()){if(!this.kr&&o.minWidth!=null)continue;let s=o.colDef;if(o.minWidth=this.dc(o),o.manualWidth==null&&s.width==null&&s.autoWidth!==!1&&!o.hasCheckbox&&!o.isDetailToggle){let a=this.ma(o);r=a!==o.contentWidth||r,o.contentWidth=a}}return this.kr=!1,r}ga(e){return this.Lr===void 0&&(this.Lr=document.createElement("canvas").getContext("2d")),this.Lr?(this.Lr.font=this.Xn,this.Lr.measureText(e).width):e.replace(/[^\x00-\xff]/g,"mm").length*7}dc(e){let t=e.colDef,r=t.headerName??t.field??e.id;return Math.ceil(Math.max(t.minWidth??0,this.ga(r)+r.length*.15+28+(e.sortable?20:0)+(e.filterable?28:0)+(this.e.r.columnMenu&&!e.hasCheckbox&&!t.suppressColumnMenu?22:0)))}ma(e){let t=28,r=this.e.i.be(),i=Math.min(r.length,100);for(let o=0;o<i;o++){let s=r[i===1?0:Math.floor(o*(r.length-1)/(i-1))],a=this.e.d(s,e),l=$e(a,e.colDef.status)?.label??j(this.e,s,e,a);t=Math.max(t,this.ga(l.slice(0,128))+(e.colDef.status?44:28))}return Math.ceil(Math.min(B(e.colDef.maxWidth)??360,t))}};function f(n,e,t){let r=document.createElement(n);if(e&&(r.className=e),t)for(let i of Object.keys(t))r.setAttribute(i,t[i]);return r}function G(n,e){if(n.classList.add("mach-portal"),!e)return;let t=window.getComputedStyle(e);for(let r=0;r<t.length;r++){let i=t.item(r);if(!i.startsWith("--mach-"))continue;let o=t.getPropertyValue(i).trim();o&&n.style.setProperty(i,o)}n.style.colorScheme=t.colorScheme}function E(n,e,t){return n<e?e:n>t?t:n}function q(n,e,t=4){let r=e.getBoundingClientRect(),i=n.getBoundingClientRect(),o=r.bottom+t,s=o+i.height>window.innerHeight-8?r.top-i.height-t:o;n.style.left=`${E(r.left,8,Math.max(8,window.innerWidth-i.width-8))}px`,n.style.top=`${E(s,8,Math.max(8,window.innerHeight-i.height-8))}px`}var ti=0;function ri(n="rg"){return ti++,`${n}-${ti}`}var ii='<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>',ni='<svg viewBox="0 0 16 16" width="10" height="10" fill="currentColor"><path d="M8 3l4 5H4l4-5z"/></svg>',oi='<svg viewBox="0 0 16 16" width="10" height="10" fill="currentColor"><path d="M8 13l4-5H4l4 5z"/></svg>',si='<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 je=class{constructor(e){this.cc=e;this.Di=new Map}on(e,t){let r=this.Di.get(e);return r||(r=new Set,this.Di.set(e,r)),r.add(t),()=>{r.delete(t)}}once(e,t){let r=this.on(e,i=>{r(),t(i)});return r}emit(e,t){let r=this.Di.get(e);if(r)for(let i of[...r])try{i(t)}catch(o){console.error(`[mach-table] error in "${e}" listener`,o),this.cc?.(o,e)}}clear(){this.Di.clear()}};var Y=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 r=t.pinned;this.pinned=r===!0?"left":r===!1||r==null?null:r,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=B(this.colDef.flex)??null}};var re=class n{constructor(e,t){this.parent=null;this.children=[];this.groupId=e,this.def=t}get headerName(){return this.def.headerName??this.def.groupId??""}getLeafColumns(e=[]){for(let t of this.children)t instanceof n?t.getLeafColumns(e):e.push(t);return e}};function De(n){return Array.isArray(n.children)}var Ee=150,Mo=80;function X(n,e){let t=B(e.minWidth)??Mo,r=B(e.maxWidth)??Number.MAX_SAFE_INTEGER,i=B(n)??B(e.width)??Ee;return Math.max(t,Math.min(r,i))}function ai(n,e,t,r){let i=r.map((s,a)=>a).filter(s=>r[s]>0),o=t-e.reduce((s,a)=>s+a,0);for(;Math.abs(o)>.001&&i.length;){let s=i.reduce((l,d)=>l+r[d],0),a=0;if(i=i.filter(l=>{let d=e[l];return e[l]=X(d+o*r[l]/s,n[l]),a+=e[l]-d,e[l]!==d}),Math.abs(a)<1e-4)break;o-=a}}function li(n,e){let t=n.map(r=>X(r.width??Ee,r));return e>t.reduce((r,i)=>r+i,0)&&ai(n,t,e,n.map(r=>r.flex??0)),t}function qe(n,e){let t=n.map(r=>X(r.width??Ee,r));return Number.isFinite(e)&&e>0&&ai(n,t,e,[...t]),t}var tr="__rg_detail_toggle__";function xe(n){return B(n)!==void 0}var Ye=class{constructor(e){this.e=e;this.X=[];this.ya=new Map;this.Be=[];this.Zn=[];this.Pr=[];this.Qn=[];this.ze=[];this.eo=[];this.Zt=1;this.to=new Map;this.uc=0}Gr(e){this.eo=e?[...e]:[];let t=new Map(this.X.map(s=>[s.id,s])),r=this.e.r.defaultColDef,i=new Set(this.e.r.masterDetail&&this.e.r.detailToggleColumn?[tr]:[]),o=(s,a,l)=>s.map((d,c)=>{if(De(d)){let C=d.groupId??d.headerName??`group_${c}_${l}`,R=new re(C,d);return R.parent=a,R.children=o(d.children,R,l+1),R}let u=d,h=u.colId??u.field??`col_${c}`,p=h,m=2;for(;i.has(p);)p=`${h}_${m++}`;i.add(p);let b=new Y(p,Xr(u,r,this.e.r.columnTypes));b.parentGroup=a,b.level=l;let w=t.get(p);return w&&(b.manualWidth=w.manualWidth,b.contentWidth=w.contentWidth,b.flex=w.flex,b.hide=w.hide,b.pinned=w.pinned),b});if(this.Be=o(this.eo,null,0),this.e.r.masterDetail&&this.e.r.detailToggleColumn){let s=new Y(tr,{colId:tr,headerName:"",width:38,pinned:"left",sortable:!1,resizable:!1,movable:!1,filter:!1});s.isDetailToggle=!0,this.Be.unshift(s)}if(this.X=this.Ei(this.Be),this.ya=new Map(this.X.map(s=>[s.id,s])),this.Zt=this.X.reduce((s,a)=>Math.max(s,a.level+1),1),this.ze=this.ze.filter(s=>this.X.some(a=>a.id===s.colId)),this.ze.length===0){let s=[];for(let a of this.X)a.colDef.initialSort&&s.push({colId:a.id,direction:a.colDef.initialSort});this.ze=s}this.Qt()}Ei(e,t=[]){for(let r of e)r instanceof re?this.Ei(r.children,t):t.push(r);return t}Qt(){let e=this.X.filter(t=>!t.hide);this.Zn=e.filter(t=>t.pinned==="left"),this.Qn=e.filter(t=>t.pinned==="right"),this.Pr=e.filter(t=>t.pinned===null),this.to.clear(),this.c().forEach((t,r)=>this.to.set(t.id,r))}_e(e){return this.to.get(e)??-1}te(){return this.X}xi(){return this.eo}hc(){return this.Be}pc(){return this.Zt}k(e){return this.ya.get(e)}T(e){return e==="left"?this.Zn:e==="right"?this.Qn:this.Pr}c(){return[...this.Zn,...this.Pr,...this.Qn]}nt(){return this.c().filter(e=>e.colDef.rowGroup===!0)}fc(){return this.c().filter(e=>e.colDef.aggFunc!=null&&e.colDef.rowGroup!==!0)}ro(){return this.Pr.some(e=>e.colDef.colSpan!=null)}va(){let e=this.c();return this.Pr.find(t=>!t.hasCheckbox&&!t.isDetailToggle)??e.find(t=>!t.hasCheckbox&&!t.isDetailToggle)??e[0]}er(e){return e.pinned==="left"?"left":e.pinned==="right"?"right":"center"}ba(e){this.uc=e;let t=e,r=[],i=[];for(let s of this.c()){let a=this.Ri(s);s.pinned!=null||s.colDef.suppressSizeToFit||s.manualWidth!=null?(s.currentWidth=X(a.width??Ee,a),t-=s.currentWidth):(r.push(s),i.push(a))}let o=this.e.r.columnLayout==="fit"?qe(i,Math.max(0,t)):li(i,Math.max(0,t));r.forEach((s,a)=>{s.currentWidth=o[a]})}Ri(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}}Se(e,t){return xe(t)?(e.manualWidth=X(t,this.Ri(e)),e.flex=null,!0):!1}wa(e,t){return xe(t)?(e.resetWidth(),e.contentWidth=X(t,this.Ri(e)),!0):!1}no(e,t){let r=this.k(e);!r||r.hide===!t||(r.hide=!t,this.Qt())}At(e,t){let r=this.k(e);if(!r)return!1;let i=this.er(r),o=u=>r.parentGroup?!0:this.er(u)===i,s=r.parentGroup?r.parentGroup.children:this.Be,a=s.filter(u=>u instanceof Y&&!u.hide&&o(u)),l=a.indexOf(r);if(l<0)return!1;a.splice(l,1);let d=Math.max(0,Math.min(t,a.length));a.splice(d,0,r);let c=[];return s.forEach((u,h)=>{u instanceof Y&&!u.hide&&o(u)&&c.push(h)}),c.length!==a.length?!1:(c.forEach((u,h)=>{s[u]=a[h]}),this.X=this.Ei(this.Be),this.Qt(),!0)}oo(e,t){let r=this.k(e);!r||!r.movable||(r.pinned=t,this.Qt())}Si(){return this.X.map(e=>({colId:e.id,hide:e.hide,width:e.manualWidth??e.currentWidth,flex:e.flex,widthMode:e.manualWidth==null?"auto":"manual",contentWidth:e.contentWidth??void 0,pinned:e.pinned}))}Ca(e){let t=new Map(e.map(r=>[r.colId,r]));for(let r of this.X){let i=t.get(r.id);i&&this.mc(r,i)}this.gc(e),this.Qt()}mc(e,t){typeof t.hide=="boolean"&&(e.hide=t.hide),t.widthMode==="auto"?(e.resetWidth(),xe(t.flex)&&(e.flex=t.flex)):xe(t.flex)?(e.flex=t.flex,e.manualWidth=null):this.Se(e,t.width),xe(t.contentWidth)&&(e.contentWidth=X(t.contentWidth,this.Ri(e))),e.movable&&(t.pinned==="left"||t.pinned==="right"||t.pinned===null)&&(e.pinned=t.pinned)}gc(e){let t=new Map;e.forEach((r,i)=>t.set(r.colId,i));for(let r of["left","center","right"]){let i=[],o=[];this.Be.forEach((s,a)=>{s instanceof Y&&!s.hide&&s.parentGroup===null&&s.movable&&this.er(s)===r&&(i.push(a),o.push(s))}),o.sort((s,a)=>(t.get(s.id)??Number.MAX_SAFE_INTEGER)-(t.get(a.id)??Number.MAX_SAFE_INTEGER)),i.forEach((s,a)=>{this.Be[s]=o[a]})}this.X=this.Ei(this.Be)}so(){for(let e of this.X){e.resetWidth(),e.hide=e.colDef.hide??!1;let t=e.colDef.pinned;e.pinned=t===!0?"left":t===!1||t==null?null:t}this.Qt()}J(){return this.ze.map(e=>({...e}))}Nr(e){if(!e||e.length===0){this.ze=[];return}this.ze=e.filter(t=>this.X.some(r=>r.id===t.colId)&&(t.direction==="asc"||t.direction==="desc")).map(t=>({colId:t.colId,direction:t.direction}))}Mi(e,t){let r=[...this.ze],i=r.findIndex(l=>l.colId===e.id),o=i>=0?r[i].direction:null,s=o===null?"asc":o==="asc"?"desc":null;t&&this.e.r.multiSort?s===null?i>=0&&r.splice(i,1):i>=0?r[i]={colId:e.id,direction:s}:r.push({colId:e.id,direction:s}):(r.length=0,s&&r.push({colId:e.id,direction:s})),this.ze=r}};function ie(n,e){if(n instanceof Error)return n;let t=new Error(typeof n=="string"?n:e);return t.name="AbortError",t}var Io=()=>ie(void 0,"[MachTable] Operation cancelled.");function Xe(n,e,t=Io){return e?new Promise((r,i)=>{let o=()=>{e.removeEventListener("abort",o),i(t())};if(n.then(r,i).finally(()=>e.removeEventListener("abort",o)),e.aborted){o();return}e.addEventListener("abort",o,{once:!0})}):n}function di(n){return n==null?"":String(n).toLowerCase()}function Ao(n,e,t){let r=di(n),i=o=>{let s=(o.value??"").toLowerCase();switch(o.match){case"contains":return r.includes(s);case"notContains":return!r.includes(s);case"equals":return r===s;case"notEquals":return r!==s;case"startsWith":return r.startsWith(s);case"endsWith":return r.endsWith(s);case"blank":return r==="";case"notBlank":return r!=="";default:return!0}};return e.length===0||(t==="or"?e.some(i):e.every(i))}function Lo(n,e,t){switch(t.match){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<=(t.value2??e);default:return!0}}function ko(n,e){let t=n==null||n==="";if(e.match==="blank")return t;if(e.match==="notBlank")return!t;if(t)return!1;let r=typeof n=="number"?n:Number(n);if(Number.isNaN(r))return!1;let i=e.value;return i==null||Number.isNaN(i)?!1:Lo(r,i,e)}function Po(n,e,t){let r=i=>ko(n,i);return e.length===0||(t==="or"?e.some(r):e.every(r))}function rr(n){if(n==null||n==="")return null;if(n instanceof Date)return isNaN(n.getTime())?null:n.getTime();if(typeof n=="number")return n;let e=Date.parse(String(n));return isNaN(e)?null:e}function Go(n,e,t){let r=rr(n),i=o=>{let s=r==null;if(o.match==="blank")return s;if(o.match==="notBlank")return!s;if(s)return!1;let a=r,l=o.value!=null?rr(o.value):null;if(l==null)return!1;switch(o.match){case"equals":return a===l;case"notEquals":return a!==l;case"lessThan":return a<l;case"greaterThan":return a>l;case"inRange":{let d=o.value2!=null?rr(o.value2):null;return d!=null?a>=l&&a<=d:a>=l}default:return!0}};return e.length===0||(t==="or"?e.some(i):e.every(i))}function No(n,e){return e.length===0?!0:e.some(t=>t==null&&n==null||t===n)}function ci(n,e){let t=e.type!=="set"&&e.operator==="or"?"or":"and";switch(e.type){case"text":return Ao(n,e.conditions,t);case"number":return Po(n,e.conditions,t);case"date":return Go(n,e.conditions,t);case"set":return No(n,e.values);default:return!0}}function ui(n,e,t){if(n.kind==="condition"){let i=e.get(n.colId);return i?o=>ci(t(o,i),n.filter):()=>!0}let r=n.children.map(i=>ui(i,e,t));return i=>{let o=n.operator==="or"?r.some(s=>s(i)):r.every(s=>s(i));return n.not?!o:o}}function ir(n,e,t,r,i){let o=new Map(n.map(d=>[d.id,d])),s=Object.entries(e).flatMap(([d,c])=>{let u=o.get(d);return u?[{column:u,filter:c}]:[]}),a=t?ui(t.root,o,i):()=>!0,l=r?.trim().toLowerCase().split(/\s+/).filter(Boolean)??[];return d=>!s.every(({column:c,filter:u})=>ci(i(d,c),u))||!a(d)?!1:l.every(c=>n.some(u=>di(i(d,u)).includes(c)))}var hi=typeof Intl<"u"?new Intl.Collator(void 0,{numeric:!0,sensitivity:"base"}):null;function Oo(n,e){let t=n==null||n==="",r=e==null||e==="";return!t&&!r?null:t&&r?0:t?1:-1}function Fo(n,e){let t=Number.isNaN(n),r=Number.isNaN(e);return t||r?t===r?0:t?1:-1:n-e}function Ho(n,e){return n===e?0:n?1:-1}function Je(n,e){let t=Oo(n,e);if(t!==null)return t;if(typeof n=="number"&&typeof e=="number")return Fo(n,e);if(n instanceof Date&&e instanceof Date)return n.getTime()-e.getTime();if(typeof n=="boolean"&&typeof e=="boolean")return Ho(n,e);let r=String(n),i=String(e);return hi?hi.compare(r,i):r.localeCompare(i)}function nr(n,e,t,r){let i=new Map(t.map(a=>[a.id,a])),o=e.flatMap(a=>{let l=i.get(a.colId);return l?[{column:l,compare:l.colDef.comparator??Je,direction:a.direction}]:[]}),s=n.map(a=>({node:a,values:o.map(({column:l})=>r(a,l))}));return s.sort((a,l)=>{for(let d=0;d<o.length;d++){let c=o[d],u=c.compare(a.values[d],l.values[d],a.node,l.node);if(u!==0)return c.direction==="asc"?u:-u}return 0}),s.map(({node:a})=>a)}function pi(){return{count:0,numeric:0,sum:0,min:1/0,max:-1/0}}function fi(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 mi(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 Ze(n,e){let t=pi();for(let r of n)fi(t,r);return mi(t,e)}var Qe={sum:n=>Ze(n,"sum"),avg:n=>Ze(n,"avg"),count:n=>n.length,min:n=>Ze(n,"min"),max:n=>Ze(n,"max"),first:n=>n.length>0?n[0]:null,last:n=>n.length>0?n[n.length-1]:null};function gi(n,e,t){if(e===Qe.count)return n.length;let r=["sum","avg","min","max"].find(o=>e===Qe[o]);if(!r)return e(n.map(t));let i=pi();for(let o of n)fi(i,t(o));return mi(i,r)}function or(n){let e={...Qe,...n??{}};return t=>e[t]}var et="group:";function yi(n){return n==null?"null":n instanceof Date?JSON.stringify(["date",String(n.getTime())]):JSON.stringify([typeof n,sr(n)])}function sr(n){return n==null?"(\u7A7A)":String(n)}function vi(n){return et+JSON.stringify(n)}function Vo(n,e,t){let r=new Map;for(let i of n){let o=t(i,e),s=yi(o),a=r.get(s);a||(a={key:s,label:sr(o),rows:[]},r.set(s,a)),a.rows.push(i)}return[...r.values()].sort((i,o)=>i.label.localeCompare(o.label,void 0,{numeric:!0,sensitivity:"base"})||i.key.localeCompare(o.key))}function bi(n,e,t,r,i){let o=[],s=(a,l,d)=>{if(l===e.length)return{display:a,leaves:a};let c=[],u=[];for(let h of Vo(a,e[l],t)){let p=[...d,[e[l].id,h.key]],m=vi(p);o.push(m);let b=s(h.rows,l+1,p);if(c.push({id:m,data:null,rowIndex:-1,selected:!1,isGroup:!0,groupLevel:l,groupKey:h.label,leafNodes:b.leaves,aggValues:r(b.leaves)}),i.has(m))for(let w of b.display)c.push(w);if(l>0)for(let w of b.leaves)u.push(w)}return{display:c,leaves:u}};return{rows:s(n,0,[]).display,ids:o}}function wi(n,e,t,r){let i=new Set([...n].filter(l=>l.startsWith("/g0:")));if(!i.size)return{expanded:n,ambiguous:[]};let o=new Map;for(let l of e){let d=[],c="";for(let u=0;u<t.length;u++){let h=r(l,t[u]);if(d.push([t[u].id,yi(h)]),c+=`/g${u}:${sr(h)}`,!i.has(c))continue;let p=vi(d);o.set(c,o.has(c)&&o.get(c)!==p?null:p)}}let s=new Set([...n].filter(l=>!i.has(l))),a=[];for(let l of i){let d=o.get(l);d?s.add(d):d===null?a.push(l):s.add(l)}return{expanded:s,ambiguous:a}}function Bo(n,e){let t=n?[n.root]:[];for(;t.length;){let r=t.pop();if(r.kind==="condition")e.add(r.colId);else for(let i of r.children)t.push(i)}}function Ci(n){let e=new Set(Object.keys(n.filterModel));Bo(n.advancedFilter,e);let t=new Set(n.sortModel.map(a=>a.colId));for(let a of t)e.add(a);let r=n.columns.some(a=>a.colDef.rowGroup===!0),i=!!n.quickFilter?.trim(),o=n.columns.filter(a=>e.has(a.id)||i||a.colDef.rowGroup===!0||r&&a.colDef.aggFunc!=null),s=new Set;for(let a of o){let l=a.colDef;if(r&&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 Ti(n){return n!=null&&(typeof n=="object"||typeof n=="function")}function Di(n,e){let t=new WeakMap;for(let r of n){if(r.data==null)continue;let i=e.map(o=>K(r.data,o));i.some(Ti)||t.set(r,i)}return t}function Ei(n,e,t,r){return t.length?!r||n===e||n==null||e==null?!0:t.some((i,o)=>{let s=K(e,i);return Ti(s)||!Object.is(r[o],s)}):!1}function ne(n){return ie(n.reason,"Block request aborted")}function tt(n){return Number.isFinite(n)?Math.max(1,Math.trunc(n)):1}var rt=class{constructor(e,t,r=4){this.maxBlocks=e;this.uo=t;this.maxConcurrentRequests=r;this.re=new Map;this.Z=new Map;this.Ta=0;this.ao=0;this.lo=0;this.Da=0;this.Ea=0;this.Ii=0;this.Ai=new Set;this.maxBlocks=tt(e),this.maxConcurrentRequests=tt(r)}configure(e,t=this.maxConcurrentRequests){this.maxBlocks=tt(e),this.maxConcurrentRequests=tt(t),this.co(),this.Li()}yc(e){this.Ai=e,this.co()}peek(e){let t=this.re.get(e);if(t)return t.touchedAt=++this.Ta,t}has(e){return this.re.has(e)}invalidate(e){let t=this.Z.get(e);t&&(this.Z.delete(e),t.controller.abort(),t.state==="queued"&&t.reject(ne(t.controller.signal)));let r=this.re.get(e);r&&(this.re.delete(e),this.uo?.(e,r))}load(e,t,r,i=0){if(r?.aborted)return Promise.reject(ne(r));let o=this.peek(e);if(o)return this.lo++,Promise.resolve(o);let s=this.Z.get(e);if(s)return this.lo++,s.priority=Math.max(s.priority,i),this.Li(),this.xa(e,s,r);this.Da++;let a=new AbortController,l,d,c=new Promise((p,m)=>{l=p,d=m}),u={controller:a,promise:c,consumers:0,loader:t,priority:i,state:"queued",resolve:l,reject:d};this.Z.set(e,u);let h=this.xa(e,u,r);return this.Li(),h}vc(){this.ao++,this.Ai.clear();for(let e of this.Z.values())e.controller.abort(),e.state==="queued"&&e.reject(ne(e.controller.signal));this.Z.clear();for(let[e,t]of this.re)this.uo?.(e,t);this.re.clear()}snapshot(){let e=0,t=0;for(let r of this.re.values())e+=r.rows.length;for(let r of this.Z.values())r.state==="active"&&t++;return{cachedBlockCount:this.re.size,loadingBlockCount:this.Z.size,activeRequestCount:t,queuedRequestCount:Math.max(0,this.Z.size-t),cachedRowCount:e,hitCount:this.lo,missCount:this.Da,evictionCount:this.Ea}}Li(){for(;this.Ii<this.maxConcurrentRequests;){let e,t;for(let[r,i]of this.Z)i.state!=="queued"||i.controller.signal.aborted||(!t||i.priority>t.priority)&&(e=r,t=i);if(e==null||!t)return;this.bc(e,t)}}bc(e,t){t.state="active",this.Ii++;let r=this.ao;this.wc(t).then(i=>{r===this.ao&&!t.controller.signal.aborted&&(this.re.set(e,{rows:i.rows,...i.lastRow==null?{}:{lastRow:i.lastRow},touchedAt:++this.Ta}),this.co()),t.resolve(i)},t.reject).finally(()=>{this.Ii=Math.max(0,this.Ii-1),this.Z.get(e)===t&&this.Z.delete(e),this.Li()})}wc(e){let{signal:t}=e.controller;return Xe(Promise.resolve().then(()=>{if(t.aborted)throw ne(t);return e.loader(t)}),t,()=>ne(t))}xa(e,t,r){return t.consumers++,new Promise((i,o)=>{let s=!1,a=d=>{s||(s=!0,r?.removeEventListener("abort",l),t.consumers=Math.max(0,t.consumers-1),d())},l=()=>a(()=>{t.consumers===0&&this.Z.get(e)===t&&(this.Z.delete(e),t.controller.abort(r?.reason),t.state==="queued"&&t.reject(ne(t.controller.signal))),o(ne(r))});r?.addEventListener("abort",l,{once:!0}),t.promise.then(d=>a(()=>i(d)),d=>a(()=>o(d instanceof Error?d:new Error(String(d??"Block request failed")))))})}co(){let e=Math.max(this.maxBlocks,this.Ai.size+1);for(;this.re.size>e;){let t=-1,r=Number.POSITIVE_INFINITY;for(let[o,s]of this.re)this.Ai.has(o)||s.touchedAt<r&&(t=o,r=s.touchedAt);if(t<0)return;let i=this.re.get(t);this.re.delete(t),this.Ea++,i&&this.uo?.(t,i)}}};function Re(n,e){if(n==null||typeof n!="object")return;let t=n[e];return Array.isArray(t)?t:void 0}var it=class{constructor(e){this.e=e;this.u=[];this.B=[];this.ie=new Map;this.we=[];this.p=new Map;this.ot={};this.st=null;this.Ke=null;this.P=new Set;this.j=new Set;this.tr=[];this.Or=new Map;this.Ra=[];this.G=null;this.rr=!1;this.Sa=!1;this.at=0;this.ki=null;this.Pi=null;this.Gi=new WeakMap;this.Fr=new WeakMap;this.lt=new Map;this.Hr=new Map;this.Vr=0;this.Ni=0;this.dt=null;this.ct=new Map;this.Lt=new Map;this.Oi=new Set;this.kt=new Map;this.ut=new rt(12,e=>this.Ma(e));this.Br=0;this.Fi=null;this.ho=!1;this.Ia=0;this.ae=[];this.W=1;this.Ur=20;this.st=z(e.r.advancedFilterModel)}resolveRowId(e,t,r){let i=this.e.r.resolveRowId;if(!i)return r;try{let o=i({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 r}get F(){return this.e.r.treeData}get f(){return this.e.r.datasource!=null}get Ce(){return this.f&&this.e.r.datasourceMode==="block"}ir(){if(this.f){if(this.Ce)return this.nr();let e=Math.max(0,this.we.length-this.u.length);return(this.G??this.u.length)+e}return this.we.length}po(){return this.Vr}zr(){return this.Ni}Cc(){return this.Sa}Hi(e){return!this.f||e?.aborted?Promise.resolve():(this.Ni++,this.e.Me(),this.e.api.editing.stop({cancel:!0}),this.e.z.clear(),this.Vi(),this.G=null,this.rr=!1,this.u=[],this.B=[],this.p.clear(),this.P.clear(),this.e._.clear(),this.w(),this.e.h({data:!0}),this.Ce?(this.ut.configure(this.e.r.maxBlocksInCache,this.e.r.datasourceMaxConcurrentRequests),this.Bi(0,e)):this.Aa(0,void 0,e))}Pt(e){this.Sa=e,this.e.o.Pt(e,this.e.y("loading"))}Aa(e,t,r){if(!this.f||this.rr||this.G!=null&&e>=this.G)return Promise.resolve();let i=this.e.r.blockSize,o=t??e+i;if(o<=e)return Promise.resolve();let s=++this.at,a=new AbortController,l=()=>a.abort(r?.reason);return r?.addEventListener("abort",l,{once:!0}),this.ki=a,this.rr=!0,this.Pt(!0),new Promise(d=>{let c=!1;this.Pi=d;let u=h=>{c||(c=!0,r?.removeEventListener("abort",l),s===this.at&&(this.rr=!1,this.ki=null,this.Pi=null,this.Pt(!1),h!=null&&h?.name!=="AbortError"&&this.e.reportError(h,"datasource.getRows",{startRow:e,endRow:o})),d())};this.La(e,o,a.signal,(h,p)=>{if(s!==this.at||this.e.s()||a.signal.aborted){u();return}typeof p=="number"&&p>=0?this.G=p:h.length<o-e&&(this.G=e+h.length);let m=this.u.length===0;this.Tc(h),u(),this.w(),this.e.h({data:!0}),m&&this.e.Te(),this.e.K.zi()},h=>u(a.signal.aborted||this.e.s()?void 0:h??new Error("Datasource request failed")))})}Vi(){this.at++,this.ki?.abort(),this.ki=null,this.rr=!1,this.Pt(!1),this.Pi?.(),this.Pi=null,this.ut.vc(),this.ct.clear(),this.Lt.clear(),this.Oi.clear();for(let[e,t]of this.kt)this.p.get(e)===t&&this.p.delete(e);this.kt.clear()}Tc(e){for(let t of e){if(t==null)continue;let r=this.u.length,i=this.resolveRowId(t,r,`inf-${this.e.or()}`);if(this.p.has(i)){this.e.reportError(new Error(`Duplicate row id: ${i}`),"datasource.getRows",{rowId:i});continue}let o={id:i,data:t,rowIndex:-1,selected:this.e.g.fo(i)};this.u.push(o),this.p.set(i,o),this.B.push(o)}}Bi(e,t,r=0){if(!this.Ce||e<0)return Promise.resolve();if(t?.aborted)return Promise.reject(this.ka(t.reason));let i=this.e.r.blockSize,o=this.at,s=e*i;if(s>=this.nr())return Promise.resolve();let a=this.G==null?s+i:Math.min(this.G,s+i),l=this.ut.load(e,d=>this.Dc(s,a,d),t,r);return this.Pt(this.u.length===0&&this.ut.snapshot().loadingBlockCount>0),l.then(d=>{o!==this.at||t?.aborted||this.e.s()||!this.Ce||!this.ut.has(e)||this.Oi.has(e)||(this.Ec(e,d),this.w(),this.e.h({data:!0}),this.e.K.zi(),o===this.at&&!this.e.s()&&this.Pa(this.e.a.mo().lastExcl-1))}).catch(d=>{throw d?.name!=="AbortError"&&this.e.reportError(d,"datasource.getRows",{startRow:s,endRow:a}),d}).finally(()=>{o===this.at&&this.Pt(this.u.length===0&&this.ut.snapshot().loadingBlockCount>0)})}Dc(e,t,r){return new Promise((i,o)=>{this.La(e,t,r,(s,a)=>i({rows:s,...typeof a=="number"&&a>=0?{lastRow:a}:{}}),s=>o(s instanceof Error?s:new Error(typeof s=="string"?s:"Datasource request failed")))})}La(e,t,r,i,o){let s=this.e.r.datasource,a=0,l=null,d=!1,c=p=>{d||(d=!0,l!=null&&clearTimeout(l),r.removeEventListener("abort",u),p())},u=()=>c(()=>o(this.ka(r.reason)));r.addEventListener("abort",u,{once:!0});let h=()=>{if(d)return;if(r.aborted||this.e.s()){u();return}a++;let p=!1,m=b=>{if(!(p||d)){if(p=!0,r.aborted||this.e.s()){u();return}a<=this.e.r.datasourceRetryCount?l=setTimeout(h,this.retryDelay(a)):c(()=>o(b))}};try{let b=s.getRows({startRow:e,endRow:t,sortModel:this.e.n.J(),filterModel:this.Q(),advancedFilterModel:this.Ie(),quickFilterText:this.Ke,signal:r,onSuccess:(w,C)=>{p||d||(p=!0,c(()=>i(w??[],C)))},fail:m});b&&typeof b.catch=="function"&&b.catch(m)}catch(b){m(b)}};h()}Ec(e,t){let r=this.e.r.blockSize,i=e*r;this.Ma(e),typeof t.lastRow=="number"&&t.lastRow>=0?this.G=t.lastRow:t.rows.length<r&&(this.G=i+t.rows.length),t.rows.forEach((o,s)=>{if(o==null)return;let a=i+s;if(this.G!=null&&a>=this.G)return;let l=this.resolveRowId(o,a,`block-${a}`),d=this.kt.get(l),c=this.p.get(l);if(c&&c!==d&&c.rowIndex!==a){this.e.reportError(new Error(`Duplicate row id: ${l}`),"datasource.getRows",{rowId:l});return}let u=d??{id:l,data:o,rowIndex:a,selected:this.e.g.fo(l)};u.rowIndex=a,u.selected=this.e.g.fo(l),this.kt.delete(l),this.ct.set(a,u),this.Lt.delete(a),this.p.set(l,u),this.Fr.set(u,a+1)}),this.Ga(),this.Oi.add(e)}Ma(e){this.Oi.delete(e);let t=this.e.r.blockSize,r=e*t,i;for(let o=r;o<r+t;o++){let s=this.ct.get(o);s&&(i??(i=new Set(this.e.z.getDirtyRowIds())),this.ct.delete(o),i.has(s.id)?this.kt.set(s.id,s):this.p.get(s.id)===s&&this.p.delete(s.id))}this.Ga()}Ga(){this.u=[...this.ct.entries()].sort(([e],[t])=>e-t).map(([,e])=>e),this.B=this.u}nr(){if(this.G!=null)return this.G;if(this.e.r.datasourceRowCount!=null)return this.e.r.datasourceRowCount;if(this.ct.size===0)return this.e.r.blockSize;let e=0;for(let t of this.ct.keys())e=Math.max(e,t+1);return e+this.e.r.blockSize}xc(e){let t=this.Lt.get(e);if(!t&&(t={id:`__mach_loading_${e}`,data:null,rowIndex:e,selected:!1,loading:!0},this.Lt.set(e,t),this.Lt.size>2e3)){let r=this.Lt.keys().next().value;r!=null&&this.Lt.delete(r)}return t}ka(e){return ie(e,"Operation aborted")}retryDelay(e){let t=Math.min(this.e.r.datasourceRetryDelay*2**Math.max(0,e-1),3e4),r=this.e.r.datasourceRetryJitter;return Math.max(0,Math.round(t*(1+(Math.random()*2-1)*r)))}Rc(e){if(this.Ce){this.Pa(e);return}if(!this.f||this.rr)return;let t=this.u.length;if(this.G!=null&&t>=this.G)return;let r=this.e.r.infiniteBufferRows;if(e+r<t&&e<t)return;let i=this.e.r.blockSize,o=this.G==null?t+i:Math.min(this.G,t+i);this.Aa(t,o)}Pa(e){if(e<0)return;this.Na();let t=this.e.r.blockSize,r=Math.floor(e/t),i=Math.floor(this.e.a.mo().first/t),o=this.e.r.blockPrefetch,s=r<this.Ia?-1:1;this.Ia=r;for(let a=i;a<r;a++)this.Bi(a,void 0,o+2).catch(()=>{});for(let a=0;a<=o;a++){let l=a===0?[r]:[r+s*a,r-s*a];for(let d of l)d<0||d*t>=this.nr()||this.Bi(d,void 0,o-a+1).catch(()=>{})}}We(){return this.Hi().catch(()=>{})}Sc(){return this.Vi(),this.f?this.Hi().catch(()=>{}):(this.G=null,this.ht(this.e.r.rowData),this.e.h({data:!0}),Promise.resolve())}destroy(){this.dt=null,this.Vi(),this.Oa(),this.go(),this.u=this.B=this.we=this.ae=[],this.p.clear(),this.ie.clear(),this.Or.clear(),this.Ra=[],this.P.clear(),this.j.clear(),this.tr=[]}yo(e,t,r){if(!this.Ce)return Promise.resolve();this.Na();let i=this.e.r.blockSize,o=Math.max(0,Math.trunc(e)),s=Math.min(this.nr(),Math.max(o,Math.trunc(t))),a=Math.floor(o/i),l=Math.max(a,Math.floor(Math.max(o,s-1)/i)),d=[];for(let c=a;c<=l;c++)d.push(this.Bi(c,r,100));return Promise.all(d).then(()=>{})}vo(){this.Ce&&(this.Ni++,this.e.Me(),this.e.api.editing.stop({cancel:!0}),this.e.z.clear(),this.Vi(),this.e._.clear(),this.u=[],this.B=[],this.p.clear(),this.w(),this.e.h({data:!0}))}bo(){return this.ut.snapshot()}Na(){let e=new Set(this.e.z.getDirtyRowIds());for(let[l,d]of this.kt)e.has(l)||(this.kt.delete(l),this.p.get(l)===d&&this.p.delete(l));let t=this.e.r.blockSize,r=new Set,{first:i,lastExcl:o}=this.e.a.mo();for(let l=i;l<o;l+=t)r.add(Math.floor(l/t));o>i&&r.add(Math.floor((o-1)/t));let s=this.e.a.D;s&&r.add(Math.floor(s.rowIndex/t));let a=this.e.l.Mc();a!=null&&r.add(Math.floor(a/t)),this.ut.yc(r)}ht(e){this.Ni++,this.e.Me(),this.e.api.editing.stop({cancel:!0}),this.Oa(),this.e.z.clear();let t=this.e.r.resolveRowId,r=this.e.r.childrenKey,i=[],o=[],s=new Map,a=new Map,l=0,d=(c,u,h)=>{let p=l++,m=this.resolveRowId(c,p,`auto-${p}`);if(s.has(m))return this.e.reportError(new Error(`Duplicate row id: ${m}`),"rowData",{rowId:m,index:p}),null;let b=this.F?Re(c,r):void 0,w={id:m,data:c,rowIndex:-1,selected:!1,treeChildrenLoaded:Array.isArray(b)};if(this.Gi.set(w,u),i.push(w),s.set(m,w),h!=null){let C=a.get(h)??[];C.push(m),a.set(h,C)}else o.push(w);if(this.F&&Array.isArray(b))for(let C of b)C!=null&&d(C,u+1,m);return w};(e??[]).forEach(c=>{c!=null&&d(c,0,null)}),this.u=i,this.B=o,this.ie=a,this.p=s,this.e._.clear();for(let c of[...this.P])s.has(c)||this.P.delete(c);if(this.e.r.defaultExpandAll)for(let c of i)this.Fa(c.id)>0&&this.P.add(c.id);this.e.g.Ha(t!=null),this.w()}_r(e){return this.ie.get(e)??[]}Fa(e){return this.ie.get(e)?.length??0}wo(e){return this.Fa(e)>0}isTreeRowLoading(e){return this.p.get(e)?.treeLoading===!0}Oa(){for(let e of this.lt.values())e.abort();this.lt.clear(),this.Hr.clear()}loadTreeChildren(e,t=!1){let r=this.p.get(e),i=this.e.r.loadTreeChildren;if(!this.F||!r?.data||!i)return Promise.resolve([]);if(!t&&r.treeChildrenLoaded)return Promise.resolve(this._r(e).flatMap(l=>{let d=this.p.get(l)?.data;return d==null?[]:[d]}));let o=this.Hr.get(e);if(o&&!t)return o;this.lt.get(e)?.abort();let s=new AbortController;this.lt.set(e,s),r.treeLoading=!0,r.treeLoadError=void 0,this.e.h({data:!0});let a=Promise.resolve().then(()=>i({data:r.data,node:r,api:this.e.api,signal:s.signal})).then(l=>{if(s.signal.aborted||this.e.s())return[];if(!Array.isArray(l))throw new TypeError("[MachTable] loadTreeChildren must resolve to an array.");return this.Ic(r,l),r.treeChildrenLoaded=!0,r.treeLoadError=void 0,this.e.emit("treeChildrenLoaded",{rowId:e,rowNode:r,children:l}),l}).catch(l=>{if(s.signal.aborted||l?.name==="AbortError")return[];throw r.treeLoadError=l,r.treeChildrenLoaded=!1,this.e.reportError(l,"treeData.loadChildren",{rowId:e}),this.e.emit("treeChildrenLoadFailed",{rowId:e,rowNode:r,error:l}),l}).finally(()=>{this.lt.get(e)===s&&(this.lt.delete(e),this.Hr.delete(e),r.treeLoading=!1,this.e.h({data:!0}))});return this.Hr.set(e,a),a}Ic(e,t){let r=new Set,i=[...this._r(e.id)];for(;i.length>0;){let s=i.pop();r.has(s)||(r.add(s),i.push(...this._r(s)))}this.Ac(t,r);for(let s of r)this.lt.get(s)?.abort(),this.lt.delete(s),this.Hr.delete(s),this.ie.delete(s),this.p.delete(s),this.P.delete(s);this.ie.delete(e.id);let o=this.Co(e)+1;for(let s of t)s!=null&&this.To(e,s,o);this.Va(),this.e.g.Ha(this.e.r.resolveRowId!=null),this.w(),this.e.h({data:!0})}Ac(e,t){let r=this.e.r.resolveRowId,i=r?new Set([...this.p.keys()].filter(l=>!t.has(l))):null,o=new WeakSet,s=[...e],a=0;for(;s.length>0;){let l=s.pop();if(l==null)continue;if(typeof l=="object"){if(o.has(l))throw new TypeError("[MachTable] Lazy tree children contain a cyclic object graph.");o.add(l)}if(r&&i){let c=r({data:l,index:a++,api:this.e.api});if(typeof c!="string"||c.length===0)throw new TypeError("[MachTable] rowKey must resolve to a non-empty identifier for lazy tree children.");if(i.has(c))throw new Error(`Duplicate row id: ${c}`);i.add(c)}let d=Re(l,this.e.r.childrenKey);d&&s.push(...d)}}Kr(e,t=!0){let r=this.e.r.resolveRowId,i=[],o=[],s=[];if(e.remove?.length){let l=new Set,d=new Set,c=h=>{if(r){let m=[this.resolveRowId(h,-1,`__missing_remove_${this.e.or()}`)];for(;m.length>0;){let b=m.pop();if(!l.has(b)){l.add(b);for(let w of this.ie.get(b)??[])m.push(w)}}}else{let p=[h];for(;p.length>0;){let m=p.pop();d.add(m);let b=this.F?Re(m,this.e.r.childrenKey):void 0;if(b)for(let w of b)p.push(w)}}};e.remove.forEach(c),this.u=this.u.filter(h=>{let p=l.has(h.id)||h.data!=null&&d.has(h.data);return p&&(s.push(h.id),this.p.delete(h.id),this.ie.delete(h.id)),!p});let u=new Set(this.u);this.B=this.B.filter(h=>u.has(h))}if(e.update?.length)for(let l of e.update){let d;r?d=this.p.get(this.resolveRowId(l,-1,`__missing_update_${this.e.or()}`)):d=this.u.find(c=>c.data===l),d&&(o.push({node:d,before:d.data,after:l}),d.data=l,s.push(d.id),this.e.a._i(d),i.push(d))}if(e.add?.length){let l=e.addIndex!=null?Math.max(0,Math.min(e.addIndex,this.B.length)):this.B.length,d=[];e.add.forEach((c,u)=>{let h=this.resolveRowId(c,l+u,`add-${this.e.or()}`);if(this.p.has(h)){this.e.reportError(new Error(`Duplicate row id: ${h}`),"transaction.add",{rowId:h});return}let p={id:h,data:c,rowIndex:-1,selected:!1};this.p.set(h,p),this.Gi.set(p,0);let m=this.F?Re(c,this.e.r.childrenKey):void 0;if(m)for(let b of m)b!=null&&this.To(p,b,1);d.push(p)}),this.B=this.B.slice(0,l).concat(d,this.B.slice(l)),this.Va()}let a={pipelineChanged:this.Lc(e,o),updatedRowIds:i.map(l=>l.id)};return this.kc(a,t),this.e.z.Pc(s),a}kc(e,t){e.pipelineChanged&&(this.dt=null),t&&(e.pipelineChanged?this.w():e.updatedRowIds.length&&this.Ba())}Gc(e){if(e.length===0)return{pipelineChanged:!1,updatedRowIds:[]};let t=!1,r=new Set;for(let i of e){let o=this.Kr(i,!1);t||(t=o.pipelineChanged);for(let s of o.updatedRowIds)r.add(s)}return t?this.w():r.size>0&&this.Ba(),{pipelineChanged:t,updatedRowIds:[...r]}}Lc(e,t){if(e.add?.length||e.remove?.length)return!0;if(!t.length)return!1;let r=this.za();if(r===null)return!0;if(!r.length)return!1;let i=this.dt;return!i||r.length!==i.fields.length||r.some((o,s)=>o!==i.fields[s])?!0:t.some(({node:o,before:s,after:a})=>Ei(s,a,r,i.values.get(o)))}za(){if(this.F||this.e.r.masterDetail||this.e.r.getRowHeight||this._a())return null;let e=this.e.n.c();if(e.some(r=>r.colDef.autoHeight===!0||r.colDef.autoRowSpan===!0||r.colDef.rowSpan!=null))return null;let t=!this.e.r.manualFiltering;return Ci({columns:e,customAggregates:this.e.r.aggFuncs,sortModel:this.e.r.manualSorting?[]:this.e.n.J(),filterModel:t?this.ot:{},advancedFilter:t?this.st:null,quickFilter:t?this.Ke:null})}Nc(){let e=this.za();this.dt=e?.length?{fields:e,values:Di(this.u,e)}:null}Ba(){this.e.emit("modelUpdated",{rowCount:this.ae.length})}To(e,t,r){let i=this.resolveRowId(t,-1,`add-${this.e.or()}`);if(this.p.has(i)){this.e.reportError(new Error(`Duplicate row id: ${i}`),"transaction.add",{rowId:i});return}let o=Re(t,this.e.r.childrenKey),s={id:i,data:t,rowIndex:-1,selected:!1,treeChildrenLoaded:Array.isArray(o)};this.p.set(i,s),this.Gi.set(s,r);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.To(s,l,r+1)}Va(){this.u=[];let e=t=>{this.u.push(t),this.p.has(t.id)||this.p.set(t.id,t);for(let r of this.ie.get(t.id)??[]){let i=this.p.get(r);i&&e(i)}};for(let t of this.B)e(t)}Wr(e){let t=JSON.stringify(this.ot),r=new Set(this.e.n.te().map(o=>o.id));this.ot=ee(e,r);let i=JSON.stringify(this.ot)!==t;return i&&(this.dt=null),i}Q(){return{...this.ot}}sr(e){let t=new Set(this.e.n.te().map(s=>s.id)),r=z(e,t),i=JSON.stringify(this.st);this.st=r,this.e.r.advancedFilterModel=r;let o=JSON.stringify(r)!==i;return o&&(this.dt=null),o}Ie(){return z(this.st)}ar(e){let t=e!=null&&e.trim()!==""?e:null;return t===this.Ke?!1:(this.Ke=t,this.dt=null,!0)}$r(){return this.Ke}Do(){return Object.keys(this.ot).length>0||this.st!=null||this.Ke!=null}w(){this.dt=null;let e=this.e.le.start(),t=this.e.n.c(),r=(a,l)=>this.e.d(a,l);if(this.f){this.Oc(e);return}if(this.Fc(e))return;let i,o=[];if(this.F)i=this.Hc(t,r);else{i=this.u,this.Do()&&!this.e.r.manualFiltering&&(i=i.filter(ir(t,this.ot,this.st,this.Ke,r)));let l=this.e.n.J();if(l.length>0&&!this.e.r.manualSorting)try{i=nr(i,l,t,r)}catch(c){this.e.reportError(c,"comparator",{sortModel:l})}let d=this.e.n.nt();if(d.length>0){let c=this.Vc(i,d);i=c.rows,o=c.ambiguousExpansions}else if(this.e.r.masterDetail){let c=[];for(let u of i)c.push(u),this.P.has(u.id)&&this.isRowExpandable(u)&&c.push({id:`__detail__${u.id}`,data:u.data,rowIndex:-1,selected:!1,isDetail:!0,masterId:u.id});i=c}}for(let a of this.u)a.rowIndex=-1;let s=0;i.forEach((a,l)=>{a.rowIndex=l,!a.isDetail&&!a.isGroup&&(s++,this.Fr.set(a,s))}),this.ae=i,this.lr(),this.Nc(),this.Ka(r),this.e.emit("modelUpdated",{rowCount:i.length}),this.e.le.Eo(e),this.Bc(o)}Oc(e){this.u.forEach((t,r)=>{this.Ce||(t.rowIndex=r),this.Fr.set(t,this.Ce?t.rowIndex+1:r+1)}),this.we=this.u,this.ae=this.u,this.Or.clear(),this.Vr++,this.e.emit("modelUpdated",{rowCount:this.u.length}),this.e.le.Eo(e)}Fc(e){let t=this.ho;return this.ho=!1,!t&&this._a()?(this.zc(e),!0):(this.go(),!1)}_a(){if(!this.e.r.dataProcessor||this.u.length<this.e.r.dataProcessorMinRows||this.F||this.e.r.masterDetail||this.e.n.nt().length>0)return!1;let e=!this.e.r.manualFiltering&&this.Do(),t=!this.e.r.manualSorting&&this.e.n.J().length>0;return e||t}zc(e){this.go();let t=this.e.r.dataProcessor;if(!t)return;let r=++this.Br,i=new AbortController;this.Fi=i;let o=this.e.n.c(),s=this.u.flatMap(d=>d.data==null?[]:[{id:d.id,data:d.data}]),a=!this.e.r.manualFiltering,l=!this.e.r.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.n.J():[],filterModel:a?this.Q():{},advancedFilterModel:a?this.Ie():null,quickFilterText:a?this.Ke:null,signal:i.signal})).then(d=>{if(r!==this.Br||i.signal.aborted||this.e.s())return;let c=new Set,u=[];for(let p of d.rowIds){if(c.has(p))continue;c.add(p);let m=this.p.get(p);m&&!m.isDetail&&!m.isGroup&&u.push(m)}for(let p of this.u)p.rowIndex=-1;u.forEach((p,m)=>{p.rowIndex=m,this.Fr.set(p,m+1)}),this.ae=u,this.lr();let h=(p,m)=>this.e.d(p,m);this.Ka(h),this.e.emit("modelUpdated",{rowCount:u.length}),this.e.le.Eo(e),this.e.h({data:!0})}).catch(d=>{r!==this.Br||i.signal.aborted||this.e.s()||(this.e.reportError(d,"dataProcessor.process"),this.ho=!0,this.w(),this.e.h({data:!0}))}).finally(()=>{r===this.Br&&(this.Fi=null)})}go(){this.Br++,this.Fi?.abort(),this.Fi=null}get Ae(){return this.e.r.paginationEnabled&&!this.f}lr(){if(!this.Ae){this.we=this.ae,this.Vr++;return}let e=this.jr(),t=this.getPageCount();if(this.W>t&&(this.W=t),this.W<1&&(this.W=1),this.e.r.paginationPage=this.W,this.e.r.paginationMode==="server"){this.ae.forEach((o,s)=>{o.rowIndex=s}),this.we=this.ae,this.Vr++;return}let r=(this.W-1)*e,i=this.ae.slice(r,r+e);i.forEach((o,s)=>{o.rowIndex=s}),this.we=i,this.Vr++}jr(){return this.Ur=this.e.r.paginationPageSize,Math.max(1,this.Ur)}qr(){return this.Ae?this.W:1}getTotalRowCount(){return this.f?this.ir():this.Ae&&this.e.r.paginationMode==="server"?this.e.r.paginationTotal:this.ae.length}getPageCount(){return this.Ae?Math.max(1,Math.ceil(this.getTotalRowCount()/this.jr())):1}Wa(){return this.ae}setPage(e,t=!1){if(!this.Ae)return;let r=this.getPageCount(),i=Math.max(1,Math.min(Math.round(e)||1,r));i!==this.W&&(this.W=i,this.e.r.paginationPage=i,this.lr(),this.e.h({data:!0}),this.e.a.dr(0,"top"),t||this.Ki())}setPageSize(e){if(!this.Ae)return;let t=Math.max(1,Math.round(e)||this.jr()),r=(this.W-1)*this.jr();this.e.r.paginationPageSize=t,this.Ur=t,this.W=Math.floor(r/t)+1,this.e.r.paginationPage=this.W,this.lr(),this.e.h({data:!0}),this.Ki()}$a(e,t){this.Ur=Math.max(1,Math.round(t)||1),this.e.r.paginationPageSize=this.Ur,this.W=Math.max(1,Math.round(e)||1),this.e.r.paginationPage=this.W}Wi(e){this.e.r.paginationEnabled!==e&&(this.e.r.paginationEnabled=e&&!this.f,this.e.r.paginationEnabled&&(this.W=1),this.lr(),this.e.h({data:!0}),this.Ki())}_c(){this.Ae&&(this.W=this.e.r.paginationMode==="server"?this.e.r.paginationPage:1,this.lr(),this.e.h({data:!0}),this.Ki())}Ki(){this.e.emit("paginationChanged",{page:this.qr(),pageSize:this.jr(),pageCount:this.getPageCount(),total:this.getTotalRowCount()})}Hc(e,t){let r=this.e.r.manualSorting?[]:this.e.n.J(),i=new Map,o=this.Do()&&!this.e.r.manualFiltering,s=ir(e,this.ot,this.st,this.Ke,t),a=c=>{let u=i.get(c.id);if(u!==void 0)return u;let h=!0;if(o){h=s(c);for(let p of this.ie.get(c.id)??[]){let m=this.p.get(p);m&&a(m)&&(h=!0)}}return i.set(c.id,h),h},l=[],d=c=>{let u=c;r.length>0&&(u=nr(c,r,e,t));for(let h of u)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.B),l}Kc(){let e=this.Ra,t=0;for(let r of this.we)!r.isDetail&&!r.isGroup&&(e[t++]=r);return e.length=t,e}Wc(e,t,r,i){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:r,rowIndex:e.rowIndex});return Math.max(1,Math.min(Math.round(s)||1,i))}catch(s){return this.e.reportError(s,"rowSpan",{colId:t.id,rowId:e.id}),1}}$c(e,t,r,i,o){if(!r.colDef.autoRowSpan||i==null||i==="")return 1;let s=1;for(;t+s<e.length&&Je(i,o(e[t+s],r))===0;)s++;return s}Uc(e,t,r){let i=new Int32Array(e.length),o=0;for(;o<e.length;){let s=e[o],a=r(s,t),l=t.colDef.rowSpan?this.Wc(s,t,a,e.length-o):this.$c(e,o,t,a,r);i[o]=l;for(let d=1;d<l;d++)i[o+d]=-1;o+=l}return i}Ka(e){if(this.Or.clear(),this.F||this.e.r.masterDetail||this.e.n.nt().length>0)return;let t=this.e.n.c().filter(i=>i.colDef.rowSpan!=null||i.colDef.autoRowSpan===!0);if(t.length===0)return;let r=this.Kc();if(r.length!==0)for(let i of t)this.Or.set(i.id,this.Uc(r,i,e))}jc(e){return this.Or.get(e)}Ua(e){return this.Fr.get(e)??0}Co(e){return this.Gi.get(e)??0}Vc(e,t){let r=or(this.e.r.aggFuncs),i=this.e.n.fc();this.tr=[];let o=l=>{let d={};for(let c of i){let u=r(c.colDef.aggFunc);if(u)try{d[c.id]=gi(l,u,h=>this.e.d(h,c))}catch(h){this.e.reportError(h,"aggFunc",{colId:c.id,aggFunc:c.colDef.aggFunc}),d[c.id]=null}}return d},s=wi(this.j,this.u,t,(l,d)=>this.e.d(l,d));this.j=s.expanded;let a=bi(e,t,(l,d)=>this.e.d(l,d),o,this.j);return this.tr=a.ids,{rows:a.rows,ambiguousExpansions:s.ambiguous}}Bc(e){for(let t of e){if(this.e.s())return;this.e.reportError(new Error(`Ambiguous legacy group expansion: ${t}`),"gridState.groupExpansion",{groupId:t})}}isRowExpandable(e){if(this.F){if(this.wo(e.id)||e.treeLoading)return!0;if(e.treeChildrenLoaded||!e.data||!this.e.r.loadTreeChildren)return!1;let r=this.e.r.isTreeRowExpandable;if(!r)return!1;try{return r({data:e.data,node:e,api:this.e.api})}catch(i){return this.e.reportError(i,"isTreeRowExpandable",{rowId:e.id}),!1}}if(!this.e.r.masterDetail)return!1;let t=this.e.r.isRowExpandable;if(t)try{return t({data:e.data,node:e,api:this.e.api})}catch(r){return this.e.reportError(r,"isRowExpandable",{rowId:e.id}),!1}return!0}isRowExpanded(e){return this.P.has(e)}qc(){return[...this.P]}Yc(){return[...this.j]}Xc(e,t){this.P=new Set(e.filter(r=>this.p.has(r))),this.j=new Set(t)}xo(e){return this.Ro(e,!0)}So(e){return this.Ro(e,!1)}$i(e){return this.Ro(e,!this.P.has(e))}Ro(e,t){let r=this.p.get(e);return!r||t&&!this.isRowExpandable(r)?!1:(t===this.P.has(e)||(t?this.P.add(e):this.P.delete(e),this.w(),this.e.h({data:!0}),this.e.emit("detailToggled",{rowId:e,rowNode:r,expanded:t}),t&&this.F&&!this.wo(e)&&!r.treeLoading&&this.loadTreeChildren(e).catch(()=>{})),t)}Mo(){let e=!1;for(let t of this.u)!this.P.has(t.id)&&this.isRowExpandable(t)&&(this.P.add(t.id),e=!0);e&&(this.w(),this.e.h({data:!0}))}Io(){this.P.size!==0&&(this.P.clear(),this.w(),this.e.h({data:!0}))}Ao(e){return this.setGroupExpanded(e,!this.j.has(e))}isGroupExpanded(e){return this.j.has(e)}Lo(){if(this.tr.length===0)return;let e=!1;for(let t of this.tr)this.j.has(t)||(this.j.add(t),e=!0);e&&(this.w(),this.e.h({data:!0}))}ko(){this.j.size!==0&&(this.j.clear(),this.w(),this.e.h({data:!0}))}setGroupExpanded(e,t){return!this.tr.includes(e)||t===this.j.has(e)||(t?this.j.add(e):this.j.delete(e),this.w(),this.e.h({data:!0})),t}ja(){return!this.F&&!this.f&&!this.e.r.dataProcessor&&this.e.r.paginationMode!=="server"&&this.e.n.J().length===0&&this.e.n.nt().length===0}qa(e,t){if(!this.ja()||!Number.isInteger(e)||!Number.isInteger(t))return!1;let r=this.m(e),i=this.m(t);if(!r||!i||r.isDetail||i.isDetail||r.isGroup||i.isGroup)return!1;let o=this.u.indexOf(r),s=this.u.indexOf(i);return o<0||s<0||o===s?!1:(this.u.splice(o,1),this.u.splice(s,0,r),this.w(),this.e.h({data:!0}),!0)}be(){return this.u}Jc(){return this.B}pt(){return this.we}A(){return this.Ce?this.nr():this.we.length}m(e){return this.Ce?e<0||e>=this.nr()?void 0:this.ct.get(e)??this.xc(e):this.we[e]}$(e){return this.p.get(e)}Po(e){this.u.forEach(e)}Go(e){let t=0;for(let r of this.ae)r.isDetail||r.isGroup||e(r,t++)}};var nt=class{constructor(e){this.e=e;this.S=new Set;this.$e=null;this.Yr=new Set}fo(e){return this.S.has(e)}Zc(e){return this.Yr.has(e)}Ue(e){if(e.loading)return!1;let t=this.Qc(e),r=t?.colDef.selectable;if(!t||!r)return!0;try{return r({api:this.e.api,colDef:t.colDef,column:t,node:e,data:e.data,value:this.e.d(e,t),rowIndex:e.rowIndex})}catch(i){return this.e.reportError(i,"selectable",{rowId:e.id,colId:t?.id}),!1}}Qc(e){if(!(e.isGroup||e.isDetail))return this.e.n.c().find(t=>t.hasCheckbox&&t.colDef.selectable!=null)}je(){return this.e.i.be().filter(e=>this.S.has(e.id))}Ui(){return this.je().filter(e=>e.data!=null).map(e=>e.data)}ji(){return[...this.S]}eu(e){let t=new Set(e),r=this.e.i.be().filter(i=>t.has(i.id)&&!i.isDetail&&!i.isGroup).map(i=>({node:i,selected:!0}));this.De(r,!0)}Ha(e){if(!e)this.S.clear(),this.$e=null;else{let t=new Set(this.e.i.be().map(r=>r.id));for(let r of[...this.S])t.has(r)||this.S.delete(r);this.$e!=null&&!t.has(this.$e)&&(this.$e=null)}for(let t of this.e.i.be())t.selected=this.S.has(t.id);this.Ya()}Xa(e){let t=e.leafNodes??[];if(t.length===0)return{all:!1,some:!1};let r=0,i=0;for(let o of t)this.Ue(o)&&(r++,this.S.has(o.id)&&i++);return r===0?{all:!1,some:!1}:{all:i===r,some:i>0}}tu(e,t){let r=(e.leafNodes??[]).filter(i=>this.Ue(i));r.length!==0&&this.De(r.map(i=>({node:i,selected:t})))}Ja(e,t,r=!1){this.De([{node:e,selected:t,clearOthers:r}])}No(e,t=!0,r=!0){let i=this.e.i.$(e);i&&this.Ja(i,t,r)}ru(e,t){let r=t==="single";this.De([{node:e,selected:r?!0:!e.selected,clearOthers:r}]),this.$e=e.id}iu(e,t,r){return!r||!t.ctrlKey&&!t.metaKey?!1:(this.De([{node:e,selected:!e.selected}]),this.$e=e.id,!0)}nu(e,t,r){if(!r||!t.shiftKey||this.$e==null)return!1;let i=this.e.i.$(this.$e);if(!i||i.rowIndex<0||e.rowIndex<0)return!1;let o=Math.min(i.rowIndex,e.rowIndex),s=Math.max(i.rowIndex,e.rowIndex),a=[];for(let l=o;l<=s;l++){let d=this.e.i.m(l);d&&!d.isDetail&&!d.isGroup&&this.Ue(d)&&a.push({node:d,selected:!0})}return this.De(a),!0}Za(e,t,r){let i=this.e.r.rowSelection;if(i==="none"||!this.Ue(e))return;if(r){this.ru(e,i);return}let o=i==="multiple";this.iu(e,t,o)||this.nu(e,t,o)||(this.De([{node:e,selected:!0,clearOthers:!0}]),this.$e=e.id)}selectAll(e=!0){let t=this.e.r.rowSelection;if(t==="none")return;let i=(e?this.e.i.pt():this.e.i.be()).filter(o=>!o.isDetail&&!o.isGroup&&this.Ue(o));if(i.length!==0){if(t==="single"){this.De([{node:i[0],selected:!0,clearOthers:!0}]);return}this.De(i.map(o=>({node:o,selected:!0})))}}deselectAll(){this.De([],!0)}ou(){let t=this.e.i.pt().filter(r=>!r.isDetail&&!r.isGroup).filter(r=>this.Ue(r));if(t.length===0)return!1;if(this.e.i.f){let r=this.e.i.ir();if(t.length<r)return!1}return t.every(r=>this.S.has(r.id))}su(){let t=this.e.i.pt().filter(i=>!i.isDetail&&!i.isGroup).filter(i=>this.Ue(i)),r=t.reduce((i,o)=>i+(this.S.has(o.id)?1:0),0);if(r===0)return!1;if(this.e.i.f){let i=this.e.i.ir();if(t.length<i)return!0}return r>0&&r<t.length}au(e,t=!1){this.De(e,t)}lu(e,t,r){!t&&!e.some(i=>i.clearOthers)||(this.S=t?new Set:new Set(e.filter(i=>i.selected).flatMap(i=>r?this.Qa(i.node):[i.node.id])))}du(e,t){for(let r of e){if(!this.Ue(r.node))continue;let i=t?this.Qa(r.node):[r.node.id];for(let o of i)r.selected?this.S.add(o):this.S.delete(o)}}cu(e){let t=new Set;for(let r of new Set([...e,...this.S]))e.has(r)!==this.S.has(r)&&t.add(r);return t}uu(e,t,r){let i=[],o=new Set([...e,...r,...this.Yr]);for(let s of this.e.i.be()){let a=this.S.has(s.id);s.selected=a,(o.has(s.id)||t.get(s.id)!==a)&&s.rowIndex>=0&&i.push(s.rowIndex)}return i}De(e,t=!1){let r=new Set(this.S),i=this.e.i.F&&this.e.r.autoCheckedChildren;this.lu(e,t,i),this.du(e,i);let o=this.cu(r),s=new Map;for(let d of this.e.i.be())s.set(d.id,d.selected);let a=new Set(this.Yr);this.Ya();let l=this.uu(o,s,a);o.size>0&&(this.e.a.ft(l),this.e.K.zi(),this.e.emit("selectionChanged",{selectedNodes:this.je(),selectedRows:this.Ui()}))}Qa(e){let t=[e.id],r=i=>{for(let o of this.e.i._r(i))t.push(o),r(o)};return r(e.id),t}Ya(){if(this.Yr.clear(),!this.e.i.F)return;let e=t=>{let r=this.e.i._r(t);if(r.length===0)return{all:this.S.has(t),some:this.S.has(t)};let i=!0,o=!1;for(let s of r){let a=e(s);a.all?o=!0:(a.some&&(o=!0),i=!1)}return o&&!i&&this.Yr.add(t),i?this.S.add(t):this.S.delete(t),{all:i,some:o}};for(let t of this.e.i.Jc())e(t.id);for(let t of this.e.i.be())t.selected=this.S.has(t.id)}};var ot=class{constructor(e){this.e=e;this.Gt=null;this.ne=0;this.mt=0;this.Le=null;this.Nt=null;this.gt=e=>{let t=this.Fo(e);t&&(this.mt=this.nl(t,e.clientX),t.didResize||(t.didResize=Math.abs(this.mt-t.startWidth)>=.5),!this.ne&&(this.ne=requestAnimationFrame(()=>{this.ne=0,this.fu()})))};this.ke=e=>{let t=this.Fo(e);t&&(this.mt=this.nl(t,e.clientX),t.didResize||(t.didResize=Math.abs(this.mt-t.startWidth)>=.5),this.mu(t))};this.Ft=e=>{this.Fo(e)&&this.Ot()};this.tl=()=>{this.Ot()}}hu(e,t){if(!this.e.r.enableColumnResize||!t.resizable||e.isPrimary===!1)return;this.Ot();let r=e.currentTarget,i=t.currentWidth;this.mt=i,this.Gt={column:t,didResize:!1,handle:r,pointerId:e.pointerId,startFlex:t.flex,startManualWidth:t.manualWidth,startWidth:i,startX:e.clientX},window.addEventListener("pointermove",this.gt),window.addEventListener("pointerup",this.ke,!0),window.addEventListener("pointercancel",this.Ft,!0),r.addEventListener("lostpointercapture",this.tl);try{r.setPointerCapture?.(e.pointerId)}catch{}this.e.o.root.classList.add("mach-root--resizing"),r.classList.add("mach-header-resize--active"),this.pu(this.Gt)}Ot(e=!0){let t=this.Gt;t&&(this.Gt=null,this.Oo(),this.rl(t),e&&(t.column.manualWidth=t.startManualWidth,t.column.flex=t.startFlex,this.e.qe()),this.e.o.root.classList.remove("mach-root--resizing"),this.il(t))}mu(e){this.Gt=null,this.Oo(),e.didResize&&(Math.abs(this.mt-e.startWidth)<.5?(e.column.manualWidth=e.startManualWidth,e.column.flex=e.startFlex):this.e.n.Se(e.column,this.mt),this.e.qe()),this.rl(e);try{e.handle.releasePointerCapture?.(e.pointerId)}catch{}this.e.o.root.classList.remove("mach-root--resizing"),this.il(e),e.didResize&&this.e.cr([e.column])}fu(){let e=this.Gt;!e||!this.e.n.Se(e.column,this.mt)||(this.e.qe(),this.Xr(e),this.e.ol(e.column,!1))}pu(e){this.Le=document.createElement("div"),this.Le.className="mach-column-resize-guide",this.Le.setAttribute("aria-hidden","true"),this.Nt=document.createElement("span"),this.Nt.className="mach-column-resize-label",this.Le.appendChild(this.Nt),this.e.o.root.appendChild(this.Le),this.Xr(e)}Xr(e){if(!this.Le||!this.Nt)return;let t=this.e.o.root,r=t.getBoundingClientRect(),i=e.handle.parentElement.getBoundingClientRect(),o=Math.max(0,Math.min(t.clientWidth,i.right-r.left-t.clientLeft)),s=Math.max(32,Math.min(t.clientWidth-32,o));this.Le.style.left=`${o}px`,this.Le.style.top=`${Math.max(0,i.top-r.top-t.clientTop)}px`,this.Nt.style.left=`${s-o}px`,this.Nt.textContent=`${Math.round(e.column.currentWidth)} px`}il(e){e.handle.classList.remove("mach-header-resize--active"),this.Le?.remove(),this.Le=null,this.Nt=null}nl(e,t){let r=Number.isFinite(t)?t:e.startX;return Math.max(1,e.startWidth+r-e.startX)}Fo(e){let t=this.Gt;return t&&e.pointerId===t.pointerId?t:null}Oo(){this.ne&&cancelAnimationFrame(this.ne),this.ne=0}rl(e){window.removeEventListener("pointermove",this.gt),window.removeEventListener("pointerup",this.ke,!0),window.removeEventListener("pointercancel",this.Ft,!0),e.handle.removeEventListener("lostpointercapture",this.tl)}destroy(){this.Ot(!1),this.Oo(),this.e.o.root?.classList.remove("mach-root--resizing")}};var xi=6,st=class{constructor(e){this.e=e;this.Jr=null;this.ur=null;this.Ho=!1;this.de=0;this.qi=null;this.gt=e=>{if(this.ur){this.vu(e);return}let t=this.Jr;t&&(Math.abs(e.clientX-t.startX)<xi&&Math.abs(e.clientY-t.startY)<xi||this.bu(e))};this.ke=e=>{this.Jr=null,e.type!=="pointercancel"&&this.ur&&this.zo(e.clientX,e.clientY),this.Vo();let t=this.sl();t&&e.type!=="pointercancel"&&t.targetIndex>=0&&this.e.At(t.column.id,t.targetIndex)}}gu(e,t){e.button===0&&t.movable&&(this.Jr={column:t,startX:e.clientX,startY:e.clientY},window.addEventListener("pointermove",this.gt),window.addEventListener("pointerup",this.ke),window.addEventListener("pointercancel",this.ke))}yu(){let e=this.Ho;return this.Ho=!1,e}bu(e){let t=this.Jr;if(!t)return;let r=this.wu(t.column);if(!r||!r.parentElement){this.Vo();return}this.Ho=!0;let i=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",G(o,this.e.o.root),document.body.appendChild(o),r.parentElement.appendChild(i),r.classList.add("mach-header-cell--dragging"),this.e.o.root.classList.add("mach-root--dragging");let s=this.e.a.Bo(t.column),a=this.e.o.hr[s],l=this.e.n.T(s),d=new Float64Array(l.length+1),c=new Float64Array(l.length);for(let h=0;h<l.length;h++){let p=l[h].currentWidth;c[h]=d[h]+p/2,d[h+1]=d[h]+p}let u=o.getBoundingClientRect();this.ur={column:t.column,cellEl:r,ghost:o,indicator:i,targetIndex:-1,pane:s,containerLeft:a.getBoundingClientRect().left,startScrollLeft:this.e.o.M.center.scrollLeft,fromIndex:l.indexOf(t.column),midpoints:c,offsets:d,ghostWidth:u.width,ghostHeight:u.height},this.zo(e.clientX,e.clientY)}wu(e){let t=this.e.a.Bo(e);return this.e.o.hr[t].querySelector(`.mach-header-cell[data-col-id="${zo(e.id)}"]`)}vu(e){this.qi={clientX:e.clientX,clientY:e.clientY},!this.de&&(this.de=requestAnimationFrame(()=>{this.de=0;let t=this.qi;this.qi=null,t&&this.zo(t.clientX,t.clientY)}))}zo(e,t){let r=this.ur;if(!r)return;let i=E(e+12,8,window.innerWidth-r.ghostWidth-8),o=E(t+12,8,window.innerHeight-r.ghostHeight-8);r.ghost.style.transform=`translate3d(${i}px, ${o}px, 0)`;let s=r.pane==="center"?this.e.o.M.center.scrollLeft-r.startScrollLeft:0,a=e-(r.containerLeft-s),l=r.midpoints.length;for(let d=0;d<r.midpoints.length;d++)if(a<r.midpoints[d]){l=d;break}r.targetIndex=l>r.fromIndex?l-1:l,r.indicator.style.transform=`translate3d(${r.offsets[l]}px, 0, 0)`}sl(){let e=this.ur;return e?(this.ur=null,e.cellEl.classList.remove("mach-header-cell--dragging"),e.ghost.remove(),e.indicator.remove(),this.e.o.root.classList.remove("mach-root--dragging"),e):null}Vo(){window.removeEventListener("pointermove",this.gt),window.removeEventListener("pointerup",this.ke),window.removeEventListener("pointercancel",this.ke),this.de&&cancelAnimationFrame(this.de),this.de=0,this.qi=null}destroy(){this.Vo(),this.sl(),this.Jr=null}};function zo(n){return typeof CSS<"u"&&typeof CSS.escape=="function"?CSS.escape(n):n.replace(/[^a-zA-Z0-9_-]/g,"\\$&")}var ar=/^[+-]?(?:\d+(?:\.\d+)?|\.\d+)(?:[eE][+-]?\d+)?$/;function at(n,e=!0){if(n==="")return null;if(!e||typeof n!="string"||!ar.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 _o(n,e){let t=n==null?"":String(n);return t.includes(e)||t.includes('"')||t.includes(`
1
+ var Ve="0.36.0";function P(n,e,t=!1){if(!(typeof n!="number"||!Number.isFinite(n)||n<e))return t?Math.floor(n):n}function B(n){return P(n,0)||void 0}function Be(n){return!n||typeof n.key!="string"||!n.key.trim()?null:{key:n.key.trim(),debounceMs:P(n.debounceMs,0,!0)??160,...n.sections?{sections:[...new Set(n.sections)]}:{},...n.store?{store:n.store}:{}}}function A(n,e,t,r=!1){let i=!1;for(let o of t)(r?Object.prototype.hasOwnProperty.call(n,o):n[o]!=null)&&(e[o]=n[o],i=!0);return i}var $n=new Set(["__proto__","prototype","constructor"]),ge=new Map;function $t(n){if(typeof n!="string"||n.length===0)return null;let e=ge.get(n);if(e!==void 0)return e;let t=n.split("."),r=t.every(i=>i.length>0&&!$n.has(i))?t:null;return n.length<=1024&&(ge.size>=256&&ge.delete(ge.keys().next().value),ge.set(n,r)),r}function Ut(n){return $t(n)!==null}function K(n,e){if(n==null)return;let t=$t(e);if(!t)return;let r=n;for(let i of t){if(r==null)return;r=r[i]}return r}function ye(n,e,t){if(n==null)return!1;let r=$t(e);if(!r)return!1;let i=n;for(let o=0;o<r.length-1;o++){if(typeof i!="object"&&typeof i!="function"||i===null)return!1;i[r[o]]==null&&(i[r[o]]={}),i=i[r[o]]}return typeof i!="object"&&typeof i!="function"||i===null?!1:(i[r[r.length-1]]=t,!0)}var de={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 Un=16,jn=512,qn=20,Yn=2e3,Xn=2e3,Jn={text:new Set(de.text),number:new Set(de.number),date:new Set(de.date)};function Zn(n){return n==null||typeof n=="string"||typeof n=="number"&&Number.isFinite(n)}function Qn(n,e,t){if(n==null||typeof n!="object")return null;let r=n;return typeof r.match!="string"||!t.has(r.match)?null:{match:r.match,...eo(r,e)}}function eo(n,e){let t=e==="number"?Ur(n.value):typeof n.value=="string"?n.value:void 0,r=e==="number"?Ur(n.value2):typeof n.value2=="string"?n.value2:void 0;return{...t!==void 0?{value:t}:{},...r!==void 0?{value2:r}:{}}}function Ur(n){return typeof n=="number"&&Number.isFinite(n)?n:void 0}function to(n,e){let t=[],r=Jn[e];for(let i of n.slice(0,qn)){let o=Qn(i,e,r);o&&t.push(o)}return t}function jt(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(Zn).slice(0,Yn)}:null:e.type!=="text"&&e.type!=="number"&&e.type!=="date"||!Array.isArray(e.conditions)?null:{type:e.type,...e.operator==="or"||e.operator==="and"?{operator:e.operator}:{},conditions:to(e.conditions,e.type)}}function ro(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 r=jt(n.filter);return r?{kind:"condition",colId:t,filter:r}:null}function io(n,e,t){if(!Array.isArray(n.children))return null;let r=[];for(let i of n.children){let o=jr(i,e+1,t);o&&r.push(o)}return r.length===0?null:{kind:"group",operator:n.operator==="or"?"or":"and",children:r,...n.not===!0?{not:!0}:{}}}function no(n,e,t){return e<=Un&&t.nodes<jn&&n!=null&&typeof n=="object"}function jr(n,e,t){if(!no(n,e,t)||t.ancestors.has(n))return null;t.ancestors.add(n),t.nodes++;let r=n,i=r.kind==="condition"?ro(r,t):r.kind==="group"?io(r,e,t):null;return t.ancestors.delete(n),i}function z(n,e){if(n==null||typeof n!="object")return null;let t=n;if(t.version!==1||t.root==null)return null;let r=jr(t.root,0,{ancestors:new WeakSet,nodes:0,validColumnIds:e});return r?{version:1,root:r}:null}function oo(n,e){return{kind:"condition",colId:n,filter:e}}function ee(n,e){if(n==null||typeof n!="object"||Array.isArray(n))return{};let t={};for(let[r,i]of Object.entries(n).slice(0,Xn)){let o=r.trim();if(!o||e?.has(o)===!1)continue;let s=jt(i);s&&(t[o]=s)}return t}function so(n,e,t={}){return{kind:"group",operator:n,children:e,...t.not?{not:!0}:{}}}var qt={align:"center",sortable:!0,resizable:!0,movable:!0,filter:!1,minWidth:80},ve={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}},be={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,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},ao=Object.keys(be);function lo(n){let e={};for(let t of ao)e[t]=n[t]??be[t];return e}function I(n,e,t,r=!1){return P(n,t,r)??e}function co(n){return n&&Object.prototype.hasOwnProperty.call(ve,n)?n:"normal"}function uo(n){return n.theme==="light"||n.theme==="dark"||n.theme==="auto"?n.theme:"light"}function ho(n,e){let t=typeof n.pagination=="object"&&Array.isArray(n.pagination.pageSizeOptions)?n.pagination.pageSizeOptions:void 0,r=t?[...new Set(t.map(i=>I(i,0,1,!0)).filter(Boolean))]:[10,20,50,100];return r.includes(e)||r.push(e),r.sort((i,o)=>i-o)}function Yt(n,e){let t=typeof n=="function"?n(e):K(e,n);return t==null?"":String(t)}function po(n){let e=n.rowKey,t=e?({data:r})=>Yt(e,r):void 0;return{...t?{resolveRowId:t}:{},...e?{rowKey:e}:{}}}function fo(n,e){let t=ve[e];return{columnDefs:Array.isArray(n.columnDefs)?n.columnDefs:[],rowData:Array.isArray(n.rowData)?n.rowData:[],defaultColDef:{...qt,...n.defaultColDef??{}},columnTypes:n.columnTypes??{},...po(n),rowHeight:I(n.rowHeight,t.rowHeight,1),headerHeight:I(n.headerHeight,t.headerHeight,1),rowBuffer:I(n.rowBuffer,8,0,!0),columnLayout:n.columnLayout==="fit"?"fit":"normal",enableColumnResize:n.enableColumnResize===!0,domLayout:n.domLayout==="autoHeight"?"autoHeight":"normal",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 mo(n){return{rowStyleRules:Array.isArray(n.rowStyleRules)?n.rowStyleRules:[],theme:uo(n)}}function go(n){return{editType:n.editType==="fullRow"?"fullRow":"cell",editableIndicator:n.editableIndicator==="always"||n.editableIndicator==="none"?n.editableIndicator:"hover",rowDragPolicy:n.rowDragPolicy,undoStackSize:I(n.undoStackSize,100,0,!0),asyncTransactionWaitMillis:I(n.asyncTransactionWaitMillis,16,0,!0)}}function yo(n){return{detailRowHeight:I(n.detailRowHeight,240,1)}}function vo(n){let e=typeof n.pagination=="object"?n.pagination:void 0,t=I(e?.pageSize,20,1,!0);return{paginationEnabled:n.pagination!==!1&&n.datasource==null,paginationMode:e?.mode==="server"?"server":"client",paginationPage:I(e?.page,1,1,!0),paginationTotal:I(e?.total,0,0,!0),paginationPageSize:t,paginationPageSizeOptions:ho(n,t),paginationShowTotal:e?e.showTotal!==!1:!0,paginationShowSizeSelector:e?e.showPageSizeSelector!==!1:!0}}function Xt(n){return{watermarkEnabled:n.watermark!=null&&n.watermark!==!1,watermarkConfig:n.watermark==null||n.watermark===!1?null:n.watermark===!0?{text:"MachTable"}:n.watermark}}function bo(n){return{advancedFilterModel:z(n.advancedFilterModel),persistence:Be(n.persistence),locale:n.locale??{},tooltipShowDelay:I(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"]}}function wo(n){return{datasourceMode:n.datasourceMode==="block"?"block":"sequential",blockSize:I(n.blockSize,100,1,!0),infiniteBufferRows:I(n.infiniteBufferRows,40,0,!0),maxBlocksInCache:I(n.maxBlocksInCache,12,1,!0),datasourceMaxConcurrentRequests:I(n.datasourceMaxConcurrentRequests,4,1,!0),blockPrefetch:I(n.blockPrefetch,1,0,!0),datasourceRowCount:n.datasourceRowCount==null?null:I(n.datasourceRowCount,0,0,!0),dataProcessorMinRows:I(n.dataProcessorMinRows,5e3,1,!0),datasourceRetryCount:I(n.datasourceRetryCount,2,0,!0),datasourceRetryDelay:I(n.datasourceRetryDelay,300,0,!0),datasourceRetryJitter:Math.min(1,I(n.datasourceRetryJitter,.15,0))}}var Co=["detailRowRenderer","isRowExpandable","aggFuncs","components","actionPolicy","summaryMethod","datasource","getRowHeight","tooltipComponent","getContextMenuItems","initialState","rowEditValidator","isTreeRowExpandable","loadTreeChildren","dataProcessor"];function To(n,e){for(let t of Co)n[t]&&Reflect.set(e,t,n[t])}function Do(n,e){for(let t of Object.keys(n))t.startsWith("on")&&typeof n[t]=="function"&&Reflect.set(e,t,n[t])}function qr(n){let e=co(n.size),t={...lo(n),...fo(n,e),...mo(n),...go(n),...yo(n),...vo(n),...Xt(n),...bo(n),...wo(n),features:Array.isArray(n.features)?n.features:[]};return To(n,t),Do(n,t),t}function Yr(n){return Array.isArray(n)?n.filter(e=>typeof e=="string"&&e.length>0):typeof n=="string"&&n.length>0?[n]:[]}function ce(n,e){return Yr(n.type).includes(e)}function Xr(n,e,t={}){let r={};for(let o of Yr(n.type)){let s=t[o];s&&Object.assign(r,s)}let i={...e,...r,...n};return i.status&&!i.cellRenderer&&(i.cellRenderer="statusTag"),i}var Jt=new WeakMap,ze=new WeakMap,_e=new WeakMap;function we(n){let e=Jt.get(n);return e||(e={},Jt.set(n,e)),e}function Zt(n){return Jt.get(n)}function Jr(n,e){e?ze.set(n,e):ze.delete(n)}function Zr(n){let e=ze.get(n);return ze.delete(n),e}function Qr(n,e){e?_e.set(n,e):_e.delete(n)}function Qt(n){let e=_e.get(n);return _e.delete(n),e}function er(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 k(n,e){let t=Zt(e);if(!t)return;t.flashTimer&&clearTimeout(t.flashTimer),t.flashTimer=void 0;let r=t.destroy;if(t.destroy=void 0,t.refresh=void 0,t.rendererDefinition=void 0,t.rendererRowId=void 0,t.rendererColumnId=void 0,!!r)try{r()}catch(i){n.reportError(i,"cellRenderer.destroy",{colId:e.dataset.colId})}}function ei(n,e,t,r,i,o){let s=n.r.tooltipComponent?"":o,a=r.colDef.tooltipValueGetter;if(a)try{s=a({api:n.api,colDef:r.colDef,column:r,node:t,data:t.data,value:i})??o}catch(l){n.reportError(l,"tooltipValueGetter",{colId:r.id,rowId:t.id})}s?e.setAttribute("title",s):e.removeAttribute("title")}function Eo(n,e,t,r,i,o){let s=Zt(e);if(!s?.refresh||s.rendererDefinition!==i||s.rendererRowId!==t.id||s.rendererColumnId!==r.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:r.id,rowId:t.id}),!1}}function te(n,e,t){return j(n,e,t,n.d(e,t))}function j(n,e,t,r){let i=t.colDef.valueFormatter;if(i)try{let o=i({api:n.api,colDef:t.colDef,column:t,node:e,data:e.data,value:r});return o==null?"":String(o)}catch(o){n.reportError(o,"valueFormatter",{colId:t.id,rowId:e.id})}return er(r)}function Ke(n,e,t,r){let i=r.colDef.cellStyle,o=we(e),s=o.styleKeys;if(s)for(let d of s)Reflect.set(e.style,d,"");if(!i){o.styleKeys=void 0;return}let a;if(typeof i=="function"){let d=n.d(t,r);try{a=i({api:n.api,colDef:r.colDef,column:r,node:t,data:t.data,value:d,rowIndex:t.rowIndex})}catch(c){n.reportError(c,"cellStyle",{colId:r.id,rowId:t.id}),a=null}}else a=i;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 We(n,e,t,r){let i=n.d(t,r),o=te(n,t,r),s=r.colDef.cellRenderer,a=typeof s=="string"?n.lc(s):s;if(a){let l={api:n.api,colDef:r.colDef,column:r,node:t,data:t.data,value:i,formatted:o,rowIndex:t.rowIndex,rendererParams:r.colDef.cellRendererParams};if(Eo(n,e,t,r,a,l)){ei(n,e,t,r,i,o);return}k(n,e);let d;try{d=a(l)}catch(c){n.reportError(c,"cellRenderer",{colId:r.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 c=d;e.replaceChildren(c.el);let u=we(e);u.destroy=c.destroy,c.refresh&&(u.refresh=h=>c.refresh(h),u.rendererDefinition=a,u.rendererRowId=t.id,u.rendererColumnId=r.id)}else e.textContent=""}else k(n,e),e.textContent=o;ei(n,e,t,r,i,o)}function xo(n,e,t){let r=e.colDef.align;if(r==="center"){n.push("mach-cell--center");return}if(r==="right"){n.push("mach-cell--right");return}(ce(e.colDef,"rightAligned")||ce(e.colDef,"numericColumn")||typeof t=="number")&&n.push("mach-cell--num")}function Ro(n,e,t,r,i){let o=r.colDef.cellClass;if(!o)return;if(typeof o=="string"){e.push(o);return}if(Array.isArray(o)){e.push(...o);return}let s={api:n.api,colDef:r.colDef,column:r,node:t,data:t.data,value:i,rowIndex:t.rowIndex};try{let a=o(s);typeof a=="string"?e.push(a):Array.isArray(a)&&e.push(...a)}catch(a){n.reportError(a,"cellClass",{colId:r.id,rowId:t.id})}}function So(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 Ce(n,e,t,r){let i=n.d(t,r),o=["mach-cell"];xo(o,r,i),Ro(n,o,t,r,i),So(o,e,r);let s=o.join(" ");e.className!==s&&(e.className=s)}function Te(n,e){return n&&Object.prototype.hasOwnProperty.call(n,e)?n[e]:void 0}function $e(n,e){if(n==null||n===""||!e||typeof e!="object")return;let t=Te(e,String(n));return typeof t=="string"?{color:t}:t}var Ue=class{constructor(e){this.e=e;this.Xn="";this.kr=!0}Jn(){var i;let e=getComputedStyle(this.e.o.root),t=`${e.getPropertyValue("--mach-header-font-weight")||650} ${e.fontSize} ${e.fontFamily}`;this[i="kr"]||(this[i]=t!==this.Xn),this.Xn=t;let r=!1;for(let o of this.e.n.c()){if(!this.kr&&o.minWidth!=null)continue;let s=o.colDef;if(o.minWidth=this.dc(o),o.manualWidth==null&&s.width==null&&s.autoWidth!==!1&&!o.hasCheckbox&&!o.isDetailToggle){let a=this.ma(o);r=a!==o.contentWidth||r,o.contentWidth=a}}return this.kr=!1,r}ga(e){return this.Lr===void 0&&(this.Lr=document.createElement("canvas").getContext("2d")),this.Lr?(this.Lr.font=this.Xn,this.Lr.measureText(e).width):e.replace(/[^\x00-\xff]/g,"mm").length*7}dc(e){let t=e.colDef,r=t.headerName??t.field??e.id;return Math.ceil(Math.max(t.minWidth??0,this.ga(r)+r.length*.15+28+(e.sortable?20:0)+(e.filterable?28:0)+(this.e.r.columnMenu&&!e.hasCheckbox&&!t.suppressColumnMenu?22:0)))}ma(e){let t=28,r=this.e.i.be(),i=Math.min(r.length,100);for(let o=0;o<i;o++){let s=r[i===1?0:Math.floor(o*(r.length-1)/(i-1))],a=this.e.d(s,e),l=$e(a,e.colDef.status)?.label??j(this.e,s,e,a);t=Math.max(t,this.ga(l.slice(0,128))+(e.colDef.status?44:28))}return Math.ceil(Math.min(B(e.colDef.maxWidth)??360,t))}};function f(n,e,t){let r=document.createElement(n);if(e&&(r.className=e),t)for(let i of Object.keys(t))r.setAttribute(i,t[i]);return r}function G(n,e){if(n.classList.add("mach-portal"),!e)return;let t=window.getComputedStyle(e);for(let r=0;r<t.length;r++){let i=t.item(r);if(!i.startsWith("--mach-"))continue;let o=t.getPropertyValue(i).trim();o&&n.style.setProperty(i,o)}n.style.colorScheme=t.colorScheme}function E(n,e,t){return n<e?e:n>t?t:n}function q(n,e,t=4){let r=e.getBoundingClientRect(),i=n.getBoundingClientRect(),o=r.bottom+t,s=o+i.height>window.innerHeight-8?r.top-i.height-t:o;n.style.left=`${E(r.left,8,Math.max(8,window.innerWidth-i.width-8))}px`,n.style.top=`${E(s,8,Math.max(8,window.innerHeight-i.height-8))}px`}var ti=0;function ri(n="rg"){return ti++,`${n}-${ti}`}var ii='<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>',ni='<svg viewBox="0 0 16 16" width="10" height="10" fill="currentColor"><path d="M8 3l4 5H4l4-5z"/></svg>',oi='<svg viewBox="0 0 16 16" width="10" height="10" fill="currentColor"><path d="M8 13l4-5H4l4 5z"/></svg>',si='<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 je=class{constructor(e){this.cc=e;this.Di=new Map}on(e,t){let r=this.Di.get(e);return r||(r=new Set,this.Di.set(e,r)),r.add(t),()=>{r.delete(t)}}once(e,t){let r=this.on(e,i=>{r(),t(i)});return r}emit(e,t){let r=this.Di.get(e);if(r)for(let i of[...r])try{i(t)}catch(o){console.error(`[mach-table] error in "${e}" listener`,o),this.cc?.(o,e)}}clear(){this.Di.clear()}};var Y=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 r=t.pinned;this.pinned=r===!0?"left":r===!1||r==null?null:r,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=B(this.colDef.flex)??null}};var re=class n{constructor(e,t){this.parent=null;this.children=[];this.groupId=e,this.def=t}get headerName(){return this.def.headerName??this.def.groupId??""}getLeafColumns(e=[]){for(let t of this.children)t instanceof n?t.getLeafColumns(e):e.push(t);return e}};function De(n){return Array.isArray(n.children)}var Ee=150,Mo=80;function X(n,e){let t=B(e.minWidth)??Mo,r=B(e.maxWidth)??Number.MAX_SAFE_INTEGER,i=B(n)??B(e.width)??Ee;return Math.max(t,Math.min(r,i))}function ai(n,e,t,r){let i=r.map((s,a)=>a).filter(s=>r[s]>0),o=t-e.reduce((s,a)=>s+a,0);for(;Math.abs(o)>.001&&i.length;){let s=i.reduce((l,d)=>l+r[d],0),a=0;if(i=i.filter(l=>{let d=e[l];return e[l]=X(d+o*r[l]/s,n[l]),a+=e[l]-d,e[l]!==d}),Math.abs(a)<1e-4)break;o-=a}}function li(n,e){let t=n.map(r=>X(r.width??Ee,r));return e>t.reduce((r,i)=>r+i,0)&&ai(n,t,e,n.map(r=>r.flex??0)),t}function qe(n,e){let t=n.map(r=>X(r.width??Ee,r));return Number.isFinite(e)&&e>0&&ai(n,t,e,[...t]),t}var tr="__rg_detail_toggle__";function xe(n){return B(n)!==void 0}var Ye=class{constructor(e){this.e=e;this.X=[];this.ya=new Map;this.Be=[];this.Zn=[];this.Pr=[];this.Qn=[];this.ze=[];this.eo=[];this.Zt=1;this.to=new Map;this.uc=0}Gr(e){this.eo=e?[...e]:[];let t=new Map(this.X.map(s=>[s.id,s])),r=this.e.r.defaultColDef,i=new Set(this.e.r.masterDetail&&this.e.r.detailToggleColumn?[tr]:[]),o=(s,a,l)=>s.map((d,c)=>{if(De(d)){let C=d.groupId??d.headerName??`group_${c}_${l}`,R=new re(C,d);return R.parent=a,R.children=o(d.children,R,l+1),R}let u=d,h=u.colId??u.field??`col_${c}`,p=h,m=2;for(;i.has(p);)p=`${h}_${m++}`;i.add(p);let b=new Y(p,Xr(u,r,this.e.r.columnTypes));b.parentGroup=a,b.level=l;let w=t.get(p);return w&&(b.manualWidth=w.manualWidth,b.contentWidth=w.contentWidth,b.flex=w.flex,b.hide=w.hide,b.pinned=w.pinned),b});if(this.Be=o(this.eo,null,0),this.e.r.masterDetail&&this.e.r.detailToggleColumn){let s=new Y(tr,{colId:tr,headerName:"",width:38,pinned:"left",sortable:!1,resizable:!1,movable:!1,filter:!1});s.isDetailToggle=!0,this.Be.unshift(s)}if(this.X=this.Ei(this.Be),this.ya=new Map(this.X.map(s=>[s.id,s])),this.Zt=this.X.reduce((s,a)=>Math.max(s,a.level+1),1),this.ze=this.ze.filter(s=>this.X.some(a=>a.id===s.colId)),this.ze.length===0){let s=[];for(let a of this.X)a.colDef.initialSort&&s.push({colId:a.id,direction:a.colDef.initialSort});this.ze=s}this.Qt()}Ei(e,t=[]){for(let r of e)r instanceof re?this.Ei(r.children,t):t.push(r);return t}Qt(){let e=this.X.filter(t=>!t.hide);this.Zn=e.filter(t=>t.pinned==="left"),this.Qn=e.filter(t=>t.pinned==="right"),this.Pr=e.filter(t=>t.pinned===null),this.to.clear(),this.c().forEach((t,r)=>this.to.set(t.id,r))}_e(e){return this.to.get(e)??-1}te(){return this.X}xi(){return this.eo}hc(){return this.Be}pc(){return this.Zt}k(e){return this.ya.get(e)}T(e){return e==="left"?this.Zn:e==="right"?this.Qn:this.Pr}c(){return[...this.Zn,...this.Pr,...this.Qn]}nt(){return this.c().filter(e=>e.colDef.rowGroup===!0)}fc(){return this.c().filter(e=>e.colDef.aggFunc!=null&&e.colDef.rowGroup!==!0)}ro(){return this.Pr.some(e=>e.colDef.colSpan!=null)}va(){let e=this.c();return this.Pr.find(t=>!t.hasCheckbox&&!t.isDetailToggle)??e.find(t=>!t.hasCheckbox&&!t.isDetailToggle)??e[0]}er(e){return e.pinned==="left"?"left":e.pinned==="right"?"right":"center"}ba(e){this.uc=e;let t=e,r=[],i=[];for(let s of this.c()){let a=this.Ri(s);s.pinned!=null||s.colDef.suppressSizeToFit||s.manualWidth!=null?(s.currentWidth=X(a.width??Ee,a),t-=s.currentWidth):(r.push(s),i.push(a))}let o=this.e.r.columnLayout==="fit"?qe(i,Math.max(0,t)):li(i,Math.max(0,t));r.forEach((s,a)=>{s.currentWidth=o[a]})}Ri(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}}Se(e,t){return xe(t)?(e.manualWidth=X(t,this.Ri(e)),e.flex=null,!0):!1}wa(e,t){return xe(t)?(e.resetWidth(),e.contentWidth=X(t,this.Ri(e)),!0):!1}no(e,t){let r=this.k(e);!r||r.hide===!t||(r.hide=!t,this.Qt())}At(e,t){let r=this.k(e);if(!r)return!1;let i=this.er(r),o=u=>r.parentGroup?!0:this.er(u)===i,s=r.parentGroup?r.parentGroup.children:this.Be,a=s.filter(u=>u instanceof Y&&!u.hide&&o(u)),l=a.indexOf(r);if(l<0)return!1;a.splice(l,1);let d=Math.max(0,Math.min(t,a.length));a.splice(d,0,r);let c=[];return s.forEach((u,h)=>{u instanceof Y&&!u.hide&&o(u)&&c.push(h)}),c.length!==a.length?!1:(c.forEach((u,h)=>{s[u]=a[h]}),this.X=this.Ei(this.Be),this.Qt(),!0)}oo(e,t){let r=this.k(e);!r||!r.movable||(r.pinned=t,this.Qt())}Si(){return this.X.map(e=>({colId:e.id,hide:e.hide,width:e.manualWidth??e.currentWidth,flex:e.flex,widthMode:e.manualWidth==null?"auto":"manual",contentWidth:e.contentWidth??void 0,pinned:e.pinned}))}Ca(e){let t=new Map(e.map(r=>[r.colId,r]));for(let r of this.X){let i=t.get(r.id);i&&this.mc(r,i)}this.gc(e),this.Qt()}mc(e,t){typeof t.hide=="boolean"&&(e.hide=t.hide),t.widthMode==="auto"?(e.resetWidth(),xe(t.flex)&&(e.flex=t.flex)):xe(t.flex)?(e.flex=t.flex,e.manualWidth=null):this.Se(e,t.width),xe(t.contentWidth)&&(e.contentWidth=X(t.contentWidth,this.Ri(e))),e.movable&&(t.pinned==="left"||t.pinned==="right"||t.pinned===null)&&(e.pinned=t.pinned)}gc(e){let t=new Map;e.forEach((r,i)=>t.set(r.colId,i));for(let r of["left","center","right"]){let i=[],o=[];this.Be.forEach((s,a)=>{s instanceof Y&&!s.hide&&s.parentGroup===null&&s.movable&&this.er(s)===r&&(i.push(a),o.push(s))}),o.sort((s,a)=>(t.get(s.id)??Number.MAX_SAFE_INTEGER)-(t.get(a.id)??Number.MAX_SAFE_INTEGER)),i.forEach((s,a)=>{this.Be[s]=o[a]})}this.X=this.Ei(this.Be)}so(){for(let e of this.X){e.resetWidth(),e.hide=e.colDef.hide??!1;let t=e.colDef.pinned;e.pinned=t===!0?"left":t===!1||t==null?null:t}this.Qt()}J(){return this.ze.map(e=>({...e}))}Nr(e){if(!e||e.length===0){this.ze=[];return}this.ze=e.filter(t=>this.X.some(r=>r.id===t.colId)&&(t.direction==="asc"||t.direction==="desc")).map(t=>({colId:t.colId,direction:t.direction}))}Mi(e,t){let r=[...this.ze],i=r.findIndex(l=>l.colId===e.id),o=i>=0?r[i].direction:null,s=o===null?"asc":o==="asc"?"desc":null;t&&this.e.r.multiSort?s===null?i>=0&&r.splice(i,1):i>=0?r[i]={colId:e.id,direction:s}:r.push({colId:e.id,direction:s}):(r.length=0,s&&r.push({colId:e.id,direction:s})),this.ze=r}};function ie(n,e){if(n instanceof Error)return n;let t=new Error(typeof n=="string"?n:e);return t.name="AbortError",t}var Io=()=>ie(void 0,"[MachTable] Operation cancelled.");function Xe(n,e,t=Io){return e?new Promise((r,i)=>{let o=()=>{e.removeEventListener("abort",o),i(t())};if(n.then(r,i).finally(()=>e.removeEventListener("abort",o)),e.aborted){o();return}e.addEventListener("abort",o,{once:!0})}):n}function di(n){return n==null?"":String(n).toLowerCase()}function Ao(n,e,t){let r=di(n),i=o=>{let s=(o.value??"").toLowerCase();switch(o.match){case"contains":return r.includes(s);case"notContains":return!r.includes(s);case"equals":return r===s;case"notEquals":return r!==s;case"startsWith":return r.startsWith(s);case"endsWith":return r.endsWith(s);case"blank":return r==="";case"notBlank":return r!=="";default:return!0}};return e.length===0||(t==="or"?e.some(i):e.every(i))}function Lo(n,e,t){switch(t.match){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<=(t.value2??e);default:return!0}}function ko(n,e){let t=n==null||n==="";if(e.match==="blank")return t;if(e.match==="notBlank")return!t;if(t)return!1;let r=typeof n=="number"?n:Number(n);if(Number.isNaN(r))return!1;let i=e.value;return i==null||Number.isNaN(i)?!1:Lo(r,i,e)}function Po(n,e,t){let r=i=>ko(n,i);return e.length===0||(t==="or"?e.some(r):e.every(r))}function rr(n){if(n==null||n==="")return null;if(n instanceof Date)return isNaN(n.getTime())?null:n.getTime();if(typeof n=="number")return n;let e=Date.parse(String(n));return isNaN(e)?null:e}function Go(n,e,t){let r=rr(n),i=o=>{let s=r==null;if(o.match==="blank")return s;if(o.match==="notBlank")return!s;if(s)return!1;let a=r,l=o.value!=null?rr(o.value):null;if(l==null)return!1;switch(o.match){case"equals":return a===l;case"notEquals":return a!==l;case"lessThan":return a<l;case"greaterThan":return a>l;case"inRange":{let d=o.value2!=null?rr(o.value2):null;return d!=null?a>=l&&a<=d:a>=l}default:return!0}};return e.length===0||(t==="or"?e.some(i):e.every(i))}function No(n,e){return e.length===0?!0:e.some(t=>t==null&&n==null||t===n)}function ci(n,e){let t=e.type!=="set"&&e.operator==="or"?"or":"and";switch(e.type){case"text":return Ao(n,e.conditions,t);case"number":return Po(n,e.conditions,t);case"date":return Go(n,e.conditions,t);case"set":return No(n,e.values);default:return!0}}function ui(n,e,t){if(n.kind==="condition"){let i=e.get(n.colId);return i?o=>ci(t(o,i),n.filter):()=>!0}let r=n.children.map(i=>ui(i,e,t));return i=>{let o=n.operator==="or"?r.some(s=>s(i)):r.every(s=>s(i));return n.not?!o:o}}function ir(n,e,t,r,i){let o=new Map(n.map(d=>[d.id,d])),s=Object.entries(e).flatMap(([d,c])=>{let u=o.get(d);return u?[{column:u,filter:c}]:[]}),a=t?ui(t.root,o,i):()=>!0,l=r?.trim().toLowerCase().split(/\s+/).filter(Boolean)??[];return d=>!s.every(({column:c,filter:u})=>ci(i(d,c),u))||!a(d)?!1:l.every(c=>n.some(u=>di(i(d,u)).includes(c)))}var hi=typeof Intl<"u"?new Intl.Collator(void 0,{numeric:!0,sensitivity:"base"}):null;function Oo(n,e){let t=n==null||n==="",r=e==null||e==="";return!t&&!r?null:t&&r?0:t?1:-1}function Fo(n,e){let t=Number.isNaN(n),r=Number.isNaN(e);return t||r?t===r?0:t?1:-1:n-e}function Ho(n,e){return n===e?0:n?1:-1}function Je(n,e){let t=Oo(n,e);if(t!==null)return t;if(typeof n=="number"&&typeof e=="number")return Fo(n,e);if(n instanceof Date&&e instanceof Date)return n.getTime()-e.getTime();if(typeof n=="boolean"&&typeof e=="boolean")return Ho(n,e);let r=String(n),i=String(e);return hi?hi.compare(r,i):r.localeCompare(i)}function nr(n,e,t,r){let i=new Map(t.map(a=>[a.id,a])),o=e.flatMap(a=>{let l=i.get(a.colId);return l?[{column:l,compare:l.colDef.comparator??Je,direction:a.direction}]:[]}),s=n.map(a=>({node:a,values:o.map(({column:l})=>r(a,l))}));return s.sort((a,l)=>{for(let d=0;d<o.length;d++){let c=o[d],u=c.compare(a.values[d],l.values[d],a.node,l.node);if(u!==0)return c.direction==="asc"?u:-u}return 0}),s.map(({node:a})=>a)}function pi(){return{count:0,numeric:0,sum:0,min:1/0,max:-1/0}}function fi(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 mi(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 Ze(n,e){let t=pi();for(let r of n)fi(t,r);return mi(t,e)}var Qe={sum:n=>Ze(n,"sum"),avg:n=>Ze(n,"avg"),count:n=>n.length,min:n=>Ze(n,"min"),max:n=>Ze(n,"max"),first:n=>n.length>0?n[0]:null,last:n=>n.length>0?n[n.length-1]:null};function gi(n,e,t){if(e===Qe.count)return n.length;let r=["sum","avg","min","max"].find(o=>e===Qe[o]);if(!r)return e(n.map(t));let i=pi();for(let o of n)fi(i,t(o));return mi(i,r)}function or(n){let e={...Qe,...n??{}};return t=>e[t]}var et="group:";function yi(n){return n==null?"null":n instanceof Date?JSON.stringify(["date",String(n.getTime())]):JSON.stringify([typeof n,sr(n)])}function sr(n){return n==null?"(\u7A7A)":String(n)}function vi(n){return et+JSON.stringify(n)}function Vo(n,e,t){let r=new Map;for(let i of n){let o=t(i,e),s=yi(o),a=r.get(s);a||(a={key:s,label:sr(o),rows:[]},r.set(s,a)),a.rows.push(i)}return[...r.values()].sort((i,o)=>i.label.localeCompare(o.label,void 0,{numeric:!0,sensitivity:"base"})||i.key.localeCompare(o.key))}function bi(n,e,t,r,i){let o=[],s=(a,l,d)=>{if(l===e.length)return{display:a,leaves:a};let c=[],u=[];for(let h of Vo(a,e[l],t)){let p=[...d,[e[l].id,h.key]],m=vi(p);o.push(m);let b=s(h.rows,l+1,p);if(c.push({id:m,data:null,rowIndex:-1,selected:!1,isGroup:!0,groupLevel:l,groupKey:h.label,leafNodes:b.leaves,aggValues:r(b.leaves)}),i.has(m))for(let w of b.display)c.push(w);if(l>0)for(let w of b.leaves)u.push(w)}return{display:c,leaves:u}};return{rows:s(n,0,[]).display,ids:o}}function wi(n,e,t,r){let i=new Set([...n].filter(l=>l.startsWith("/g0:")));if(!i.size)return{expanded:n,ambiguous:[]};let o=new Map;for(let l of e){let d=[],c="";for(let u=0;u<t.length;u++){let h=r(l,t[u]);if(d.push([t[u].id,yi(h)]),c+=`/g${u}:${sr(h)}`,!i.has(c))continue;let p=vi(d);o.set(c,o.has(c)&&o.get(c)!==p?null:p)}}let s=new Set([...n].filter(l=>!i.has(l))),a=[];for(let l of i){let d=o.get(l);d?s.add(d):d===null?a.push(l):s.add(l)}return{expanded:s,ambiguous:a}}function Bo(n,e){let t=n?[n.root]:[];for(;t.length;){let r=t.pop();if(r.kind==="condition")e.add(r.colId);else for(let i of r.children)t.push(i)}}function Ci(n){let e=new Set(Object.keys(n.filterModel));Bo(n.advancedFilter,e);let t=new Set(n.sortModel.map(a=>a.colId));for(let a of t)e.add(a);let r=n.columns.some(a=>a.colDef.rowGroup===!0),i=!!n.quickFilter?.trim(),o=n.columns.filter(a=>e.has(a.id)||i||a.colDef.rowGroup===!0||r&&a.colDef.aggFunc!=null),s=new Set;for(let a of o){let l=a.colDef;if(r&&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 Ti(n){return n!=null&&(typeof n=="object"||typeof n=="function")}function Di(n,e){let t=new WeakMap;for(let r of n){if(r.data==null)continue;let i=e.map(o=>K(r.data,o));i.some(Ti)||t.set(r,i)}return t}function Ei(n,e,t,r){return t.length?!r||n===e||n==null||e==null?!0:t.some((i,o)=>{let s=K(e,i);return Ti(s)||!Object.is(r[o],s)}):!1}function ne(n){return ie(n.reason,"Block request aborted")}function tt(n){return Number.isFinite(n)?Math.max(1,Math.trunc(n)):1}var rt=class{constructor(e,t,r=4){this.maxBlocks=e;this.uo=t;this.maxConcurrentRequests=r;this.re=new Map;this.Z=new Map;this.Ta=0;this.ao=0;this.lo=0;this.Da=0;this.Ea=0;this.Ii=0;this.Ai=new Set;this.maxBlocks=tt(e),this.maxConcurrentRequests=tt(r)}configure(e,t=this.maxConcurrentRequests){this.maxBlocks=tt(e),this.maxConcurrentRequests=tt(t),this.co(),this.Li()}yc(e){this.Ai=e,this.co()}peek(e){let t=this.re.get(e);if(t)return t.touchedAt=++this.Ta,t}has(e){return this.re.has(e)}invalidate(e){let t=this.Z.get(e);t&&(this.Z.delete(e),t.controller.abort(),t.state==="queued"&&t.reject(ne(t.controller.signal)));let r=this.re.get(e);r&&(this.re.delete(e),this.uo?.(e,r))}load(e,t,r,i=0){if(r?.aborted)return Promise.reject(ne(r));let o=this.peek(e);if(o)return this.lo++,Promise.resolve(o);let s=this.Z.get(e);if(s)return this.lo++,s.priority=Math.max(s.priority,i),this.Li(),this.xa(e,s,r);this.Da++;let a=new AbortController,l,d,c=new Promise((p,m)=>{l=p,d=m}),u={controller:a,promise:c,consumers:0,loader:t,priority:i,state:"queued",resolve:l,reject:d};this.Z.set(e,u);let h=this.xa(e,u,r);return this.Li(),h}vc(){this.ao++,this.Ai.clear();for(let e of this.Z.values())e.controller.abort(),e.state==="queued"&&e.reject(ne(e.controller.signal));this.Z.clear();for(let[e,t]of this.re)this.uo?.(e,t);this.re.clear()}snapshot(){let e=0,t=0;for(let r of this.re.values())e+=r.rows.length;for(let r of this.Z.values())r.state==="active"&&t++;return{cachedBlockCount:this.re.size,loadingBlockCount:this.Z.size,activeRequestCount:t,queuedRequestCount:Math.max(0,this.Z.size-t),cachedRowCount:e,hitCount:this.lo,missCount:this.Da,evictionCount:this.Ea}}Li(){for(;this.Ii<this.maxConcurrentRequests;){let e,t;for(let[r,i]of this.Z)i.state!=="queued"||i.controller.signal.aborted||(!t||i.priority>t.priority)&&(e=r,t=i);if(e==null||!t)return;this.bc(e,t)}}bc(e,t){t.state="active",this.Ii++;let r=this.ao;this.wc(t).then(i=>{r===this.ao&&!t.controller.signal.aborted&&(this.re.set(e,{rows:i.rows,...i.lastRow==null?{}:{lastRow:i.lastRow},touchedAt:++this.Ta}),this.co()),t.resolve(i)},t.reject).finally(()=>{this.Ii=Math.max(0,this.Ii-1),this.Z.get(e)===t&&this.Z.delete(e),this.Li()})}wc(e){let{signal:t}=e.controller;return Xe(Promise.resolve().then(()=>{if(t.aborted)throw ne(t);return e.loader(t)}),t,()=>ne(t))}xa(e,t,r){return t.consumers++,new Promise((i,o)=>{let s=!1,a=d=>{s||(s=!0,r?.removeEventListener("abort",l),t.consumers=Math.max(0,t.consumers-1),d())},l=()=>a(()=>{t.consumers===0&&this.Z.get(e)===t&&(this.Z.delete(e),t.controller.abort(r?.reason),t.state==="queued"&&t.reject(ne(t.controller.signal))),o(ne(r))});r?.addEventListener("abort",l,{once:!0}),t.promise.then(d=>a(()=>i(d)),d=>a(()=>o(d instanceof Error?d:new Error(String(d??"Block request failed")))))})}co(){let e=Math.max(this.maxBlocks,this.Ai.size+1);for(;this.re.size>e;){let t=-1,r=Number.POSITIVE_INFINITY;for(let[o,s]of this.re)this.Ai.has(o)||s.touchedAt<r&&(t=o,r=s.touchedAt);if(t<0)return;let i=this.re.get(t);this.re.delete(t),this.Ea++,i&&this.uo?.(t,i)}}};function Re(n,e){if(n==null||typeof n!="object")return;let t=n[e];return Array.isArray(t)?t:void 0}var it=class{constructor(e){this.e=e;this.u=[];this.B=[];this.ie=new Map;this.we=[];this.p=new Map;this.ot={};this.st=null;this.Ke=null;this.P=new Set;this.j=new Set;this.tr=[];this.Or=new Map;this.Ra=[];this.G=null;this.rr=!1;this.Sa=!1;this.at=0;this.ki=null;this.Pi=null;this.Gi=new WeakMap;this.Fr=new WeakMap;this.lt=new Map;this.Hr=new Map;this.Vr=0;this.Ni=0;this.dt=null;this.ct=new Map;this.Lt=new Map;this.Oi=new Set;this.kt=new Map;this.ut=new rt(12,e=>this.Ma(e));this.Br=0;this.Fi=null;this.ho=!1;this.Ia=0;this.ae=[];this.W=1;this.Ur=20;this.st=z(e.r.advancedFilterModel)}resolveRowId(e,t,r){let i=this.e.r.resolveRowId;if(!i)return r;try{let o=i({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 r}get F(){return this.e.r.treeData}get f(){return this.e.r.datasource!=null}get Ce(){return this.f&&this.e.r.datasourceMode==="block"}ir(){if(this.f){if(this.Ce)return this.nr();let e=Math.max(0,this.we.length-this.u.length);return(this.G??this.u.length)+e}return this.we.length}po(){return this.Vr}zr(){return this.Ni}Cc(){return this.Sa}Hi(e){return!this.f||e?.aborted?Promise.resolve():(this.Ni++,this.e.Me(),this.e.api.editing.stop({cancel:!0}),this.e.z.clear(),this.Vi(),this.G=null,this.rr=!1,this.u=[],this.B=[],this.p.clear(),this.P.clear(),this.e._.clear(),this.w(),this.e.h({data:!0}),this.Ce?(this.ut.configure(this.e.r.maxBlocksInCache,this.e.r.datasourceMaxConcurrentRequests),this.Bi(0,e)):this.Aa(0,void 0,e))}Pt(e){this.Sa=e,this.e.o.Pt(e,this.e.y("loading"))}Aa(e,t,r){if(!this.f||this.rr||this.G!=null&&e>=this.G)return Promise.resolve();let i=this.e.r.blockSize,o=t??e+i;if(o<=e)return Promise.resolve();let s=++this.at,a=new AbortController,l=()=>a.abort(r?.reason);return r?.addEventListener("abort",l,{once:!0}),this.ki=a,this.rr=!0,this.Pt(!0),new Promise(d=>{let c=!1;this.Pi=d;let u=h=>{c||(c=!0,r?.removeEventListener("abort",l),s===this.at&&(this.rr=!1,this.ki=null,this.Pi=null,this.Pt(!1),h!=null&&h?.name!=="AbortError"&&this.e.reportError(h,"datasource.getRows",{startRow:e,endRow:o})),d())};this.La(e,o,a.signal,(h,p)=>{if(s!==this.at||this.e.s()||a.signal.aborted){u();return}typeof p=="number"&&p>=0?this.G=p:h.length<o-e&&(this.G=e+h.length);let m=this.u.length===0;this.Tc(h),u(),this.w(),this.e.h({data:!0}),m&&this.e.Te(),this.e.K.zi()},h=>u(a.signal.aborted||this.e.s()?void 0:h??new Error("Datasource request failed")))})}Vi(){this.at++,this.ki?.abort(),this.ki=null,this.rr=!1,this.Pt(!1),this.Pi?.(),this.Pi=null,this.ut.vc(),this.ct.clear(),this.Lt.clear(),this.Oi.clear();for(let[e,t]of this.kt)this.p.get(e)===t&&this.p.delete(e);this.kt.clear()}Tc(e){for(let t of e){if(t==null)continue;let r=this.u.length,i=this.resolveRowId(t,r,`inf-${this.e.or()}`);if(this.p.has(i)){this.e.reportError(new Error(`Duplicate row id: ${i}`),"datasource.getRows",{rowId:i});continue}let o={id:i,data:t,rowIndex:-1,selected:this.e.g.fo(i)};this.u.push(o),this.p.set(i,o),this.B.push(o)}}Bi(e,t,r=0){if(!this.Ce||e<0)return Promise.resolve();if(t?.aborted)return Promise.reject(this.ka(t.reason));let i=this.e.r.blockSize,o=this.at,s=e*i;if(s>=this.nr())return Promise.resolve();let a=this.G==null?s+i:Math.min(this.G,s+i),l=this.ut.load(e,d=>this.Dc(s,a,d),t,r);return this.Pt(this.u.length===0&&this.ut.snapshot().loadingBlockCount>0),l.then(d=>{o!==this.at||t?.aborted||this.e.s()||!this.Ce||!this.ut.has(e)||this.Oi.has(e)||(this.Ec(e,d),this.w(),this.e.h({data:!0}),this.e.K.zi(),o===this.at&&!this.e.s()&&this.Pa(this.e.a.mo().lastExcl-1))}).catch(d=>{throw d?.name!=="AbortError"&&this.e.reportError(d,"datasource.getRows",{startRow:s,endRow:a}),d}).finally(()=>{o===this.at&&this.Pt(this.u.length===0&&this.ut.snapshot().loadingBlockCount>0)})}Dc(e,t,r){return new Promise((i,o)=>{this.La(e,t,r,(s,a)=>i({rows:s,...typeof a=="number"&&a>=0?{lastRow:a}:{}}),s=>o(s instanceof Error?s:new Error(typeof s=="string"?s:"Datasource request failed")))})}La(e,t,r,i,o){let s=this.e.r.datasource,a=0,l=null,d=!1,c=p=>{d||(d=!0,l!=null&&clearTimeout(l),r.removeEventListener("abort",u),p())},u=()=>c(()=>o(this.ka(r.reason)));r.addEventListener("abort",u,{once:!0});let h=()=>{if(d)return;if(r.aborted||this.e.s()){u();return}a++;let p=!1,m=b=>{if(!(p||d)){if(p=!0,r.aborted||this.e.s()){u();return}a<=this.e.r.datasourceRetryCount?l=setTimeout(h,this.retryDelay(a)):c(()=>o(b))}};try{let b=s.getRows({startRow:e,endRow:t,sortModel:this.e.n.J(),filterModel:this.Q(),advancedFilterModel:this.Ie(),quickFilterText:this.Ke,signal:r,onSuccess:(w,C)=>{p||d||(p=!0,c(()=>i(w??[],C)))},fail:m});b&&typeof b.catch=="function"&&b.catch(m)}catch(b){m(b)}};h()}Ec(e,t){let r=this.e.r.blockSize,i=e*r;this.Ma(e),typeof t.lastRow=="number"&&t.lastRow>=0?this.G=t.lastRow:t.rows.length<r&&(this.G=i+t.rows.length),t.rows.forEach((o,s)=>{if(o==null)return;let a=i+s;if(this.G!=null&&a>=this.G)return;let l=this.resolveRowId(o,a,`block-${a}`),d=this.kt.get(l),c=this.p.get(l);if(c&&c!==d&&c.rowIndex!==a){this.e.reportError(new Error(`Duplicate row id: ${l}`),"datasource.getRows",{rowId:l});return}let u=d??{id:l,data:o,rowIndex:a,selected:this.e.g.fo(l)};u.rowIndex=a,u.selected=this.e.g.fo(l),this.kt.delete(l),this.ct.set(a,u),this.Lt.delete(a),this.p.set(l,u),this.Fr.set(u,a+1)}),this.Ga(),this.Oi.add(e)}Ma(e){this.Oi.delete(e);let t=this.e.r.blockSize,r=e*t,i;for(let o=r;o<r+t;o++){let s=this.ct.get(o);s&&(i??(i=new Set(this.e.z.getDirtyRowIds())),this.ct.delete(o),i.has(s.id)?this.kt.set(s.id,s):this.p.get(s.id)===s&&this.p.delete(s.id))}this.Ga()}Ga(){this.u=[...this.ct.entries()].sort(([e],[t])=>e-t).map(([,e])=>e),this.B=this.u}nr(){if(this.G!=null)return this.G;if(this.e.r.datasourceRowCount!=null)return this.e.r.datasourceRowCount;if(this.ct.size===0)return this.e.r.blockSize;let e=0;for(let t of this.ct.keys())e=Math.max(e,t+1);return e+this.e.r.blockSize}xc(e){let t=this.Lt.get(e);if(!t&&(t={id:`__mach_loading_${e}`,data:null,rowIndex:e,selected:!1,loading:!0},this.Lt.set(e,t),this.Lt.size>2e3)){let r=this.Lt.keys().next().value;r!=null&&this.Lt.delete(r)}return t}ka(e){return ie(e,"Operation aborted")}retryDelay(e){let t=Math.min(this.e.r.datasourceRetryDelay*2**Math.max(0,e-1),3e4),r=this.e.r.datasourceRetryJitter;return Math.max(0,Math.round(t*(1+(Math.random()*2-1)*r)))}Rc(e){if(this.Ce){this.Pa(e);return}if(!this.f||this.rr)return;let t=this.u.length;if(this.G!=null&&t>=this.G)return;let r=this.e.r.infiniteBufferRows;if(e+r<t&&e<t)return;let i=this.e.r.blockSize,o=this.G==null?t+i:Math.min(this.G,t+i);this.Aa(t,o)}Pa(e){if(e<0)return;this.Na();let t=this.e.r.blockSize,r=Math.floor(e/t),i=Math.floor(this.e.a.mo().first/t),o=this.e.r.blockPrefetch,s=r<this.Ia?-1:1;this.Ia=r;for(let a=i;a<r;a++)this.Bi(a,void 0,o+2).catch(()=>{});for(let a=0;a<=o;a++){let l=a===0?[r]:[r+s*a,r-s*a];for(let d of l)d<0||d*t>=this.nr()||this.Bi(d,void 0,o-a+1).catch(()=>{})}}We(){return this.Hi().catch(()=>{})}Sc(){return this.Vi(),this.f?this.Hi().catch(()=>{}):(this.G=null,this.ht(this.e.r.rowData),this.e.h({data:!0}),Promise.resolve())}destroy(){this.dt=null,this.Vi(),this.Oa(),this.go(),this.u=this.B=this.we=this.ae=[],this.p.clear(),this.ie.clear(),this.Or.clear(),this.Ra=[],this.P.clear(),this.j.clear(),this.tr=[]}yo(e,t,r){if(!this.Ce)return Promise.resolve();this.Na();let i=this.e.r.blockSize,o=Math.max(0,Math.trunc(e)),s=Math.min(this.nr(),Math.max(o,Math.trunc(t))),a=Math.floor(o/i),l=Math.max(a,Math.floor(Math.max(o,s-1)/i)),d=[];for(let c=a;c<=l;c++)d.push(this.Bi(c,r,100));return Promise.all(d).then(()=>{})}vo(){this.Ce&&(this.Ni++,this.e.Me(),this.e.api.editing.stop({cancel:!0}),this.e.z.clear(),this.Vi(),this.e._.clear(),this.u=[],this.B=[],this.p.clear(),this.w(),this.e.h({data:!0}))}bo(){return this.ut.snapshot()}Na(){let e=new Set(this.e.z.getDirtyRowIds());for(let[l,d]of this.kt)e.has(l)||(this.kt.delete(l),this.p.get(l)===d&&this.p.delete(l));let t=this.e.r.blockSize,r=new Set,{first:i,lastExcl:o}=this.e.a.mo();for(let l=i;l<o;l+=t)r.add(Math.floor(l/t));o>i&&r.add(Math.floor((o-1)/t));let s=this.e.a.D;s&&r.add(Math.floor(s.rowIndex/t));let a=this.e.l.Mc();a!=null&&r.add(Math.floor(a/t)),this.ut.yc(r)}ht(e){this.Ni++,this.e.Me(),this.e.api.editing.stop({cancel:!0}),this.Oa(),this.e.z.clear();let t=this.e.r.resolveRowId,r=this.e.r.childrenKey,i=[],o=[],s=new Map,a=new Map,l=0,d=(c,u,h)=>{let p=l++,m=this.resolveRowId(c,p,`auto-${p}`);if(s.has(m))return this.e.reportError(new Error(`Duplicate row id: ${m}`),"rowData",{rowId:m,index:p}),null;let b=this.F?Re(c,r):void 0,w={id:m,data:c,rowIndex:-1,selected:!1,treeChildrenLoaded:Array.isArray(b)};if(this.Gi.set(w,u),i.push(w),s.set(m,w),h!=null){let C=a.get(h)??[];C.push(m),a.set(h,C)}else o.push(w);if(this.F&&Array.isArray(b))for(let C of b)C!=null&&d(C,u+1,m);return w};(e??[]).forEach(c=>{c!=null&&d(c,0,null)}),this.u=i,this.B=o,this.ie=a,this.p=s,this.e._.clear();for(let c of[...this.P])s.has(c)||this.P.delete(c);if(this.e.r.defaultExpandAll)for(let c of i)this.Fa(c.id)>0&&this.P.add(c.id);this.e.g.Ha(t!=null),this.w()}_r(e){return this.ie.get(e)??[]}Fa(e){return this.ie.get(e)?.length??0}wo(e){return this.Fa(e)>0}isTreeRowLoading(e){return this.p.get(e)?.treeLoading===!0}Oa(){for(let e of this.lt.values())e.abort();this.lt.clear(),this.Hr.clear()}loadTreeChildren(e,t=!1){let r=this.p.get(e),i=this.e.r.loadTreeChildren;if(!this.F||!r?.data||!i)return Promise.resolve([]);if(!t&&r.treeChildrenLoaded)return Promise.resolve(this._r(e).flatMap(l=>{let d=this.p.get(l)?.data;return d==null?[]:[d]}));let o=this.Hr.get(e);if(o&&!t)return o;this.lt.get(e)?.abort();let s=new AbortController;this.lt.set(e,s),r.treeLoading=!0,r.treeLoadError=void 0,this.e.h({data:!0});let a=Promise.resolve().then(()=>i({data:r.data,node:r,api:this.e.api,signal:s.signal})).then(l=>{if(s.signal.aborted||this.e.s())return[];if(!Array.isArray(l))throw new TypeError("[MachTable] loadTreeChildren must resolve to an array.");return this.Ic(r,l),r.treeChildrenLoaded=!0,r.treeLoadError=void 0,this.e.emit("treeChildrenLoaded",{rowId:e,rowNode:r,children:l}),l}).catch(l=>{if(s.signal.aborted||l?.name==="AbortError")return[];throw r.treeLoadError=l,r.treeChildrenLoaded=!1,this.e.reportError(l,"treeData.loadChildren",{rowId:e}),this.e.emit("treeChildrenLoadFailed",{rowId:e,rowNode:r,error:l}),l}).finally(()=>{this.lt.get(e)===s&&(this.lt.delete(e),this.Hr.delete(e),r.treeLoading=!1,this.e.h({data:!0}))});return this.Hr.set(e,a),a}Ic(e,t){let r=new Set,i=[...this._r(e.id)];for(;i.length>0;){let s=i.pop();r.has(s)||(r.add(s),i.push(...this._r(s)))}this.Ac(t,r);for(let s of r)this.lt.get(s)?.abort(),this.lt.delete(s),this.Hr.delete(s),this.ie.delete(s),this.p.delete(s),this.P.delete(s);this.ie.delete(e.id);let o=this.Co(e)+1;for(let s of t)s!=null&&this.To(e,s,o);this.Va(),this.e.g.Ha(this.e.r.resolveRowId!=null),this.w(),this.e.h({data:!0})}Ac(e,t){let r=this.e.r.resolveRowId,i=r?new Set([...this.p.keys()].filter(l=>!t.has(l))):null,o=new WeakSet,s=[...e],a=0;for(;s.length>0;){let l=s.pop();if(l==null)continue;if(typeof l=="object"){if(o.has(l))throw new TypeError("[MachTable] Lazy tree children contain a cyclic object graph.");o.add(l)}if(r&&i){let c=r({data:l,index:a++,api:this.e.api});if(typeof c!="string"||c.length===0)throw new TypeError("[MachTable] rowKey must resolve to a non-empty identifier for lazy tree children.");if(i.has(c))throw new Error(`Duplicate row id: ${c}`);i.add(c)}let d=Re(l,this.e.r.childrenKey);d&&s.push(...d)}}Kr(e,t=!0){let r=this.e.r.resolveRowId,i=[],o=[],s=[];if(e.remove?.length){let l=new Set,d=new Set,c=h=>{if(r){let m=[this.resolveRowId(h,-1,`__missing_remove_${this.e.or()}`)];for(;m.length>0;){let b=m.pop();if(!l.has(b)){l.add(b);for(let w of this.ie.get(b)??[])m.push(w)}}}else{let p=[h];for(;p.length>0;){let m=p.pop();d.add(m);let b=this.F?Re(m,this.e.r.childrenKey):void 0;if(b)for(let w of b)p.push(w)}}};e.remove.forEach(c),this.u=this.u.filter(h=>{let p=l.has(h.id)||h.data!=null&&d.has(h.data);return p&&(s.push(h.id),this.p.delete(h.id),this.ie.delete(h.id)),!p});let u=new Set(this.u);this.B=this.B.filter(h=>u.has(h))}if(e.update?.length)for(let l of e.update){let d;r?d=this.p.get(this.resolveRowId(l,-1,`__missing_update_${this.e.or()}`)):d=this.u.find(c=>c.data===l),d&&(o.push({node:d,before:d.data,after:l}),d.data=l,s.push(d.id),this.e.a._i(d),i.push(d))}if(e.add?.length){let l=e.addIndex!=null?Math.max(0,Math.min(e.addIndex,this.B.length)):this.B.length,d=[];e.add.forEach((c,u)=>{let h=this.resolveRowId(c,l+u,`add-${this.e.or()}`);if(this.p.has(h)){this.e.reportError(new Error(`Duplicate row id: ${h}`),"transaction.add",{rowId:h});return}let p={id:h,data:c,rowIndex:-1,selected:!1};this.p.set(h,p),this.Gi.set(p,0);let m=this.F?Re(c,this.e.r.childrenKey):void 0;if(m)for(let b of m)b!=null&&this.To(p,b,1);d.push(p)}),this.B=this.B.slice(0,l).concat(d,this.B.slice(l)),this.Va()}let a={pipelineChanged:this.Lc(e,o),updatedRowIds:i.map(l=>l.id)};return this.kc(a,t),this.e.z.Pc(s),a}kc(e,t){e.pipelineChanged&&(this.dt=null),t&&(e.pipelineChanged?this.w():e.updatedRowIds.length&&this.Ba())}Gc(e){if(e.length===0)return{pipelineChanged:!1,updatedRowIds:[]};let t=!1,r=new Set;for(let i of e){let o=this.Kr(i,!1);t||(t=o.pipelineChanged);for(let s of o.updatedRowIds)r.add(s)}return t?this.w():r.size>0&&this.Ba(),{pipelineChanged:t,updatedRowIds:[...r]}}Lc(e,t){if(e.add?.length||e.remove?.length)return!0;if(!t.length)return!1;let r=this.za();if(r===null)return!0;if(!r.length)return!1;let i=this.dt;return!i||r.length!==i.fields.length||r.some((o,s)=>o!==i.fields[s])?!0:t.some(({node:o,before:s,after:a})=>Ei(s,a,r,i.values.get(o)))}za(){if(this.F||this.e.r.masterDetail||this.e.r.getRowHeight||this._a())return null;let e=this.e.n.c();if(e.some(r=>r.colDef.autoHeight===!0||r.colDef.autoRowSpan===!0||r.colDef.rowSpan!=null))return null;let t=!this.e.r.manualFiltering;return Ci({columns:e,customAggregates:this.e.r.aggFuncs,sortModel:this.e.r.manualSorting?[]:this.e.n.J(),filterModel:t?this.ot:{},advancedFilter:t?this.st:null,quickFilter:t?this.Ke:null})}Nc(){let e=this.za();this.dt=e?.length?{fields:e,values:Di(this.u,e)}:null}Ba(){this.e.emit("modelUpdated",{rowCount:this.ae.length})}To(e,t,r){let i=this.resolveRowId(t,-1,`add-${this.e.or()}`);if(this.p.has(i)){this.e.reportError(new Error(`Duplicate row id: ${i}`),"transaction.add",{rowId:i});return}let o=Re(t,this.e.r.childrenKey),s={id:i,data:t,rowIndex:-1,selected:!1,treeChildrenLoaded:Array.isArray(o)};this.p.set(i,s),this.Gi.set(s,r);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.To(s,l,r+1)}Va(){this.u=[];let e=t=>{this.u.push(t),this.p.has(t.id)||this.p.set(t.id,t);for(let r of this.ie.get(t.id)??[]){let i=this.p.get(r);i&&e(i)}};for(let t of this.B)e(t)}Wr(e){let t=JSON.stringify(this.ot),r=new Set(this.e.n.te().map(o=>o.id));this.ot=ee(e,r);let i=JSON.stringify(this.ot)!==t;return i&&(this.dt=null),i}Q(){return{...this.ot}}sr(e){let t=new Set(this.e.n.te().map(s=>s.id)),r=z(e,t),i=JSON.stringify(this.st);this.st=r,this.e.r.advancedFilterModel=r;let o=JSON.stringify(r)!==i;return o&&(this.dt=null),o}Ie(){return z(this.st)}ar(e){let t=e!=null&&e.trim()!==""?e:null;return t===this.Ke?!1:(this.Ke=t,this.dt=null,!0)}$r(){return this.Ke}Do(){return Object.keys(this.ot).length>0||this.st!=null||this.Ke!=null}w(){this.dt=null;let e=this.e.le.start(),t=this.e.n.c(),r=(a,l)=>this.e.d(a,l);if(this.f){this.Oc(e);return}if(this.Fc(e))return;let i,o=[];if(this.F)i=this.Hc(t,r);else{i=this.u,this.Do()&&!this.e.r.manualFiltering&&(i=i.filter(ir(t,this.ot,this.st,this.Ke,r)));let l=this.e.n.J();if(l.length>0&&!this.e.r.manualSorting)try{i=nr(i,l,t,r)}catch(c){this.e.reportError(c,"comparator",{sortModel:l})}let d=this.e.n.nt();if(d.length>0){let c=this.Vc(i,d);i=c.rows,o=c.ambiguousExpansions}else if(this.e.r.masterDetail){let c=[];for(let u of i)c.push(u),this.P.has(u.id)&&this.isRowExpandable(u)&&c.push({id:`__detail__${u.id}`,data:u.data,rowIndex:-1,selected:!1,isDetail:!0,masterId:u.id});i=c}}for(let a of this.u)a.rowIndex=-1;let s=0;i.forEach((a,l)=>{a.rowIndex=l,!a.isDetail&&!a.isGroup&&(s++,this.Fr.set(a,s))}),this.ae=i,this.lr(),this.Nc(),this.Ka(r),this.e.emit("modelUpdated",{rowCount:i.length}),this.e.le.Eo(e),this.Bc(o)}Oc(e){this.u.forEach((t,r)=>{this.Ce||(t.rowIndex=r),this.Fr.set(t,this.Ce?t.rowIndex+1:r+1)}),this.we=this.u,this.ae=this.u,this.Or.clear(),this.Vr++,this.e.emit("modelUpdated",{rowCount:this.u.length}),this.e.le.Eo(e)}Fc(e){let t=this.ho;return this.ho=!1,!t&&this._a()?(this.zc(e),!0):(this.go(),!1)}_a(){if(!this.e.r.dataProcessor||this.u.length<this.e.r.dataProcessorMinRows||this.F||this.e.r.masterDetail||this.e.n.nt().length>0)return!1;let e=!this.e.r.manualFiltering&&this.Do(),t=!this.e.r.manualSorting&&this.e.n.J().length>0;return e||t}zc(e){this.go();let t=this.e.r.dataProcessor;if(!t)return;let r=++this.Br,i=new AbortController;this.Fi=i;let o=this.e.n.c(),s=this.u.flatMap(d=>d.data==null?[]:[{id:d.id,data:d.data}]),a=!this.e.r.manualFiltering,l=!this.e.r.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.n.J():[],filterModel:a?this.Q():{},advancedFilterModel:a?this.Ie():null,quickFilterText:a?this.Ke:null,signal:i.signal})).then(d=>{if(r!==this.Br||i.signal.aborted||this.e.s())return;let c=new Set,u=[];for(let p of d.rowIds){if(c.has(p))continue;c.add(p);let m=this.p.get(p);m&&!m.isDetail&&!m.isGroup&&u.push(m)}for(let p of this.u)p.rowIndex=-1;u.forEach((p,m)=>{p.rowIndex=m,this.Fr.set(p,m+1)}),this.ae=u,this.lr();let h=(p,m)=>this.e.d(p,m);this.Ka(h),this.e.emit("modelUpdated",{rowCount:u.length}),this.e.le.Eo(e),this.e.h({data:!0})}).catch(d=>{r!==this.Br||i.signal.aborted||this.e.s()||(this.e.reportError(d,"dataProcessor.process"),this.ho=!0,this.w(),this.e.h({data:!0}))}).finally(()=>{r===this.Br&&(this.Fi=null)})}go(){this.Br++,this.Fi?.abort(),this.Fi=null}get Ae(){return this.e.r.paginationEnabled&&!this.f}lr(){if(!this.Ae){this.we=this.ae,this.Vr++;return}let e=this.jr(),t=this.getPageCount();if(this.W>t&&(this.W=t),this.W<1&&(this.W=1),this.e.r.paginationPage=this.W,this.e.r.paginationMode==="server"){this.ae.forEach((o,s)=>{o.rowIndex=s}),this.we=this.ae,this.Vr++;return}let r=(this.W-1)*e,i=this.ae.slice(r,r+e);i.forEach((o,s)=>{o.rowIndex=s}),this.we=i,this.Vr++}jr(){return this.Ur=this.e.r.paginationPageSize,Math.max(1,this.Ur)}qr(){return this.Ae?this.W:1}getTotalRowCount(){return this.f?this.ir():this.Ae&&this.e.r.paginationMode==="server"?this.e.r.paginationTotal:this.ae.length}getPageCount(){return this.Ae?Math.max(1,Math.ceil(this.getTotalRowCount()/this.jr())):1}Wa(){return this.ae}setPage(e,t=!1){if(!this.Ae)return;let r=this.getPageCount(),i=Math.max(1,Math.min(Math.round(e)||1,r));i!==this.W&&(this.W=i,this.e.r.paginationPage=i,this.lr(),this.e.h({data:!0}),this.e.a.dr(0,"top"),t||this.Ki())}setPageSize(e){if(!this.Ae)return;let t=Math.max(1,Math.round(e)||this.jr()),r=(this.W-1)*this.jr();this.e.r.paginationPageSize=t,this.Ur=t,this.W=Math.floor(r/t)+1,this.e.r.paginationPage=this.W,this.lr(),this.e.h({data:!0}),this.Ki()}$a(e,t){this.Ur=Math.max(1,Math.round(t)||1),this.e.r.paginationPageSize=this.Ur,this.W=Math.max(1,Math.round(e)||1),this.e.r.paginationPage=this.W}Wi(e){this.e.r.paginationEnabled!==e&&(this.e.r.paginationEnabled=e&&!this.f,this.e.r.paginationEnabled&&(this.W=1),this.lr(),this.e.h({data:!0}),this.Ki())}_c(){this.Ae&&(this.W=this.e.r.paginationMode==="server"?this.e.r.paginationPage:1,this.lr(),this.e.h({data:!0}),this.Ki())}Ki(){this.e.emit("paginationChanged",{page:this.qr(),pageSize:this.jr(),pageCount:this.getPageCount(),total:this.getTotalRowCount()})}Hc(e,t){let r=this.e.r.manualSorting?[]:this.e.n.J(),i=new Map,o=this.Do()&&!this.e.r.manualFiltering,s=ir(e,this.ot,this.st,this.Ke,t),a=c=>{let u=i.get(c.id);if(u!==void 0)return u;let h=!0;if(o){h=s(c);for(let p of this.ie.get(c.id)??[]){let m=this.p.get(p);m&&a(m)&&(h=!0)}}return i.set(c.id,h),h},l=[],d=c=>{let u=c;r.length>0&&(u=nr(c,r,e,t));for(let h of u)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.B),l}Kc(){let e=this.Ra,t=0;for(let r of this.we)!r.isDetail&&!r.isGroup&&(e[t++]=r);return e.length=t,e}Wc(e,t,r,i){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:r,rowIndex:e.rowIndex});return Math.max(1,Math.min(Math.round(s)||1,i))}catch(s){return this.e.reportError(s,"rowSpan",{colId:t.id,rowId:e.id}),1}}$c(e,t,r,i,o){if(!r.colDef.autoRowSpan||i==null||i==="")return 1;let s=1;for(;t+s<e.length&&Je(i,o(e[t+s],r))===0;)s++;return s}Uc(e,t,r){let i=new Int32Array(e.length),o=0;for(;o<e.length;){let s=e[o],a=r(s,t),l=t.colDef.rowSpan?this.Wc(s,t,a,e.length-o):this.$c(e,o,t,a,r);i[o]=l;for(let d=1;d<l;d++)i[o+d]=-1;o+=l}return i}Ka(e){if(this.Or.clear(),this.F||this.e.r.masterDetail||this.e.n.nt().length>0)return;let t=this.e.n.c().filter(i=>i.colDef.rowSpan!=null||i.colDef.autoRowSpan===!0);if(t.length===0)return;let r=this.Kc();if(r.length!==0)for(let i of t)this.Or.set(i.id,this.Uc(r,i,e))}jc(e){return this.Or.get(e)}Ua(e){return this.Fr.get(e)??0}Co(e){return this.Gi.get(e)??0}Vc(e,t){let r=or(this.e.r.aggFuncs),i=this.e.n.fc();this.tr=[];let o=l=>{let d={};for(let c of i){let u=r(c.colDef.aggFunc);if(u)try{d[c.id]=gi(l,u,h=>this.e.d(h,c))}catch(h){this.e.reportError(h,"aggFunc",{colId:c.id,aggFunc:c.colDef.aggFunc}),d[c.id]=null}}return d},s=wi(this.j,this.u,t,(l,d)=>this.e.d(l,d));this.j=s.expanded;let a=bi(e,t,(l,d)=>this.e.d(l,d),o,this.j);return this.tr=a.ids,{rows:a.rows,ambiguousExpansions:s.ambiguous}}Bc(e){for(let t of e){if(this.e.s())return;this.e.reportError(new Error(`Ambiguous legacy group expansion: ${t}`),"gridState.groupExpansion",{groupId:t})}}isRowExpandable(e){if(this.F){if(this.wo(e.id)||e.treeLoading)return!0;if(e.treeChildrenLoaded||!e.data||!this.e.r.loadTreeChildren)return!1;let r=this.e.r.isTreeRowExpandable;if(!r)return!1;try{return r({data:e.data,node:e,api:this.e.api})}catch(i){return this.e.reportError(i,"isTreeRowExpandable",{rowId:e.id}),!1}}if(!this.e.r.masterDetail)return!1;let t=this.e.r.isRowExpandable;if(t)try{return t({data:e.data,node:e,api:this.e.api})}catch(r){return this.e.reportError(r,"isRowExpandable",{rowId:e.id}),!1}return!0}isRowExpanded(e){return this.P.has(e)}qc(){return[...this.P]}Yc(){return[...this.j]}Xc(e,t){this.P=new Set(e.filter(r=>this.p.has(r))),this.j=new Set(t)}xo(e){return this.Ro(e,!0)}So(e){return this.Ro(e,!1)}$i(e){return this.Ro(e,!this.P.has(e))}Ro(e,t){let r=this.p.get(e);return!r||t&&!this.isRowExpandable(r)?!1:(t===this.P.has(e)||(t?this.P.add(e):this.P.delete(e),this.w(),this.e.h({data:!0}),this.e.emit("detailToggled",{rowId:e,rowNode:r,expanded:t}),t&&this.F&&!this.wo(e)&&!r.treeLoading&&this.loadTreeChildren(e).catch(()=>{})),t)}Mo(){let e=!1;for(let t of this.u)!this.P.has(t.id)&&this.isRowExpandable(t)&&(this.P.add(t.id),e=!0);e&&(this.w(),this.e.h({data:!0}))}Io(){this.P.size!==0&&(this.P.clear(),this.w(),this.e.h({data:!0}))}Ao(e){return this.setGroupExpanded(e,!this.j.has(e))}isGroupExpanded(e){return this.j.has(e)}Lo(){if(this.tr.length===0)return;let e=!1;for(let t of this.tr)this.j.has(t)||(this.j.add(t),e=!0);e&&(this.w(),this.e.h({data:!0}))}ko(){this.j.size!==0&&(this.j.clear(),this.w(),this.e.h({data:!0}))}setGroupExpanded(e,t){return!this.tr.includes(e)||t===this.j.has(e)||(t?this.j.add(e):this.j.delete(e),this.w(),this.e.h({data:!0})),t}ja(){return!this.F&&!this.f&&!this.e.r.dataProcessor&&this.e.r.paginationMode!=="server"&&this.e.n.J().length===0&&this.e.n.nt().length===0}qa(e,t){if(!this.ja()||!Number.isInteger(e)||!Number.isInteger(t))return!1;let r=this.m(e),i=this.m(t);if(!r||!i||r.isDetail||i.isDetail||r.isGroup||i.isGroup)return!1;let o=this.u.indexOf(r),s=this.u.indexOf(i);return o<0||s<0||o===s?!1:(this.u.splice(o,1),this.u.splice(s,0,r),this.w(),this.e.h({data:!0}),!0)}be(){return this.u}Jc(){return this.B}pt(){return this.we}A(){return this.Ce?this.nr():this.we.length}m(e){return this.Ce?e<0||e>=this.nr()?void 0:this.ct.get(e)??this.xc(e):this.we[e]}$(e){return this.p.get(e)}Po(e){this.u.forEach(e)}Go(e){let t=0;for(let r of this.ae)r.isDetail||r.isGroup||e(r,t++)}};var nt=class{constructor(e){this.e=e;this.S=new Set;this.$e=null;this.Yr=new Set}fo(e){return this.S.has(e)}Zc(e){return this.Yr.has(e)}Ue(e){if(e.loading)return!1;let t=this.Qc(e),r=t?.colDef.selectable;if(!t||!r)return!0;try{return r({api:this.e.api,colDef:t.colDef,column:t,node:e,data:e.data,value:this.e.d(e,t),rowIndex:e.rowIndex})}catch(i){return this.e.reportError(i,"selectable",{rowId:e.id,colId:t?.id}),!1}}Qc(e){if(!(e.isGroup||e.isDetail))return this.e.n.c().find(t=>t.hasCheckbox&&t.colDef.selectable!=null)}je(){return this.e.i.be().filter(e=>this.S.has(e.id))}Ui(){return this.je().filter(e=>e.data!=null).map(e=>e.data)}ji(){return[...this.S]}eu(e){let t=new Set(e),r=this.e.i.be().filter(i=>t.has(i.id)&&!i.isDetail&&!i.isGroup).map(i=>({node:i,selected:!0}));this.De(r,!0)}Ha(e){if(!e)this.S.clear(),this.$e=null;else{let t=new Set(this.e.i.be().map(r=>r.id));for(let r of[...this.S])t.has(r)||this.S.delete(r);this.$e!=null&&!t.has(this.$e)&&(this.$e=null)}for(let t of this.e.i.be())t.selected=this.S.has(t.id);this.Ya()}Xa(e){let t=e.leafNodes??[];if(t.length===0)return{all:!1,some:!1};let r=0,i=0;for(let o of t)this.Ue(o)&&(r++,this.S.has(o.id)&&i++);return r===0?{all:!1,some:!1}:{all:i===r,some:i>0}}tu(e,t){let r=(e.leafNodes??[]).filter(i=>this.Ue(i));r.length!==0&&this.De(r.map(i=>({node:i,selected:t})))}Ja(e,t,r=!1){this.De([{node:e,selected:t,clearOthers:r}])}No(e,t=!0,r=!0){let i=this.e.i.$(e);i&&this.Ja(i,t,r)}ru(e,t){let r=t==="single";this.De([{node:e,selected:r?!0:!e.selected,clearOthers:r}]),this.$e=e.id}iu(e,t,r){return!r||!t.ctrlKey&&!t.metaKey?!1:(this.De([{node:e,selected:!e.selected}]),this.$e=e.id,!0)}nu(e,t,r){if(!r||!t.shiftKey||this.$e==null)return!1;let i=this.e.i.$(this.$e);if(!i||i.rowIndex<0||e.rowIndex<0)return!1;let o=Math.min(i.rowIndex,e.rowIndex),s=Math.max(i.rowIndex,e.rowIndex),a=[];for(let l=o;l<=s;l++){let d=this.e.i.m(l);d&&!d.isDetail&&!d.isGroup&&this.Ue(d)&&a.push({node:d,selected:!0})}return this.De(a),!0}Za(e,t,r){let i=this.e.r.rowSelection;if(i==="none"||!this.Ue(e))return;if(r){this.ru(e,i);return}let o=i==="multiple";this.iu(e,t,o)||this.nu(e,t,o)||(this.De([{node:e,selected:!0,clearOthers:!0}]),this.$e=e.id)}selectAll(e=!0){let t=this.e.r.rowSelection;if(t==="none")return;let i=(e?this.e.i.pt():this.e.i.be()).filter(o=>!o.isDetail&&!o.isGroup&&this.Ue(o));if(i.length!==0){if(t==="single"){this.De([{node:i[0],selected:!0,clearOthers:!0}]);return}this.De(i.map(o=>({node:o,selected:!0})))}}deselectAll(){this.De([],!0)}ou(){let t=this.e.i.pt().filter(r=>!r.isDetail&&!r.isGroup).filter(r=>this.Ue(r));if(t.length===0)return!1;if(this.e.i.f){let r=this.e.i.ir();if(t.length<r)return!1}return t.every(r=>this.S.has(r.id))}su(){let t=this.e.i.pt().filter(i=>!i.isDetail&&!i.isGroup).filter(i=>this.Ue(i)),r=t.reduce((i,o)=>i+(this.S.has(o.id)?1:0),0);if(r===0)return!1;if(this.e.i.f){let i=this.e.i.ir();if(t.length<i)return!0}return r>0&&r<t.length}au(e,t=!1){this.De(e,t)}lu(e,t,r){!t&&!e.some(i=>i.clearOthers)||(this.S=t?new Set:new Set(e.filter(i=>i.selected).flatMap(i=>r?this.Qa(i.node):[i.node.id])))}du(e,t){for(let r of e){if(!this.Ue(r.node))continue;let i=t?this.Qa(r.node):[r.node.id];for(let o of i)r.selected?this.S.add(o):this.S.delete(o)}}cu(e){let t=new Set;for(let r of new Set([...e,...this.S]))e.has(r)!==this.S.has(r)&&t.add(r);return t}uu(e,t,r){let i=[],o=new Set([...e,...r,...this.Yr]);for(let s of this.e.i.be()){let a=this.S.has(s.id);s.selected=a,(o.has(s.id)||t.get(s.id)!==a)&&s.rowIndex>=0&&i.push(s.rowIndex)}return i}De(e,t=!1){let r=new Set(this.S),i=this.e.i.F&&this.e.r.autoCheckedChildren;this.lu(e,t,i),this.du(e,i);let o=this.cu(r),s=new Map;for(let d of this.e.i.be())s.set(d.id,d.selected);let a=new Set(this.Yr);this.Ya();let l=this.uu(o,s,a);o.size>0&&(this.e.a.ft(l),this.e.K.zi(),this.e.emit("selectionChanged",{selectedNodes:this.je(),selectedRows:this.Ui()}))}Qa(e){let t=[e.id],r=i=>{for(let o of this.e.i._r(i))t.push(o),r(o)};return r(e.id),t}Ya(){if(this.Yr.clear(),!this.e.i.F)return;let e=t=>{let r=this.e.i._r(t);if(r.length===0)return{all:this.S.has(t),some:this.S.has(t)};let i=!0,o=!1;for(let s of r){let a=e(s);a.all?o=!0:(a.some&&(o=!0),i=!1)}return o&&!i&&this.Yr.add(t),i?this.S.add(t):this.S.delete(t),{all:i,some:o}};for(let t of this.e.i.Jc())e(t.id);for(let t of this.e.i.be())t.selected=this.S.has(t.id)}};var ot=class{constructor(e){this.e=e;this.Gt=null;this.ne=0;this.mt=0;this.Le=null;this.Nt=null;this.gt=e=>{let t=this.Fo(e);t&&(this.mt=this.nl(t,e.clientX),t.didResize||(t.didResize=Math.abs(this.mt-t.startWidth)>=.5),!this.ne&&(this.ne=requestAnimationFrame(()=>{this.ne=0,this.fu()})))};this.ke=e=>{let t=this.Fo(e);t&&(this.mt=this.nl(t,e.clientX),t.didResize||(t.didResize=Math.abs(this.mt-t.startWidth)>=.5),this.mu(t))};this.Ft=e=>{this.Fo(e)&&this.Ot()};this.tl=()=>{this.Ot()}}hu(e,t){if(!this.e.r.enableColumnResize||!t.resizable||e.isPrimary===!1)return;this.Ot();let r=e.currentTarget,i=t.currentWidth;this.mt=i,this.Gt={column:t,didResize:!1,handle:r,pointerId:e.pointerId,startFlex:t.flex,startManualWidth:t.manualWidth,startWidth:i,startX:e.clientX},window.addEventListener("pointermove",this.gt),window.addEventListener("pointerup",this.ke,!0),window.addEventListener("pointercancel",this.Ft,!0),r.addEventListener("lostpointercapture",this.tl);try{r.setPointerCapture?.(e.pointerId)}catch{}this.e.o.root.classList.add("mach-root--resizing"),r.classList.add("mach-header-resize--active"),this.pu(this.Gt)}Ot(e=!0){let t=this.Gt;t&&(this.Gt=null,this.Oo(),this.rl(t),e&&(t.column.manualWidth=t.startManualWidth,t.column.flex=t.startFlex,this.e.qe()),this.e.o.root.classList.remove("mach-root--resizing"),this.il(t))}mu(e){this.Gt=null,this.Oo(),e.didResize&&(Math.abs(this.mt-e.startWidth)<.5?(e.column.manualWidth=e.startManualWidth,e.column.flex=e.startFlex):this.e.n.Se(e.column,this.mt),this.e.qe()),this.rl(e);try{e.handle.releasePointerCapture?.(e.pointerId)}catch{}this.e.o.root.classList.remove("mach-root--resizing"),this.il(e),e.didResize&&this.e.cr([e.column])}fu(){let e=this.Gt;!e||!this.e.n.Se(e.column,this.mt)||(this.e.qe(),this.Xr(e),this.e.ol(e.column,!1))}pu(e){this.Le=document.createElement("div"),this.Le.className="mach-column-resize-guide",this.Le.setAttribute("aria-hidden","true"),this.Nt=document.createElement("span"),this.Nt.className="mach-column-resize-label",this.Le.appendChild(this.Nt),this.e.o.root.appendChild(this.Le),this.Xr(e)}Xr(e){if(!this.Le||!this.Nt)return;let t=this.e.o.root,r=t.getBoundingClientRect(),i=e.handle.parentElement.getBoundingClientRect(),o=Math.max(0,Math.min(t.clientWidth,i.right-r.left-t.clientLeft)),s=Math.max(32,Math.min(t.clientWidth-32,o));this.Le.style.left=`${o}px`,this.Le.style.top=`${Math.max(0,i.top-r.top-t.clientTop)}px`,this.Nt.style.left=`${s-o}px`,this.Nt.textContent=`${Math.round(e.column.currentWidth)} px`}il(e){e.handle.classList.remove("mach-header-resize--active"),this.Le?.remove(),this.Le=null,this.Nt=null}nl(e,t){let r=Number.isFinite(t)?t:e.startX;return Math.max(1,e.startWidth+r-e.startX)}Fo(e){let t=this.Gt;return t&&e.pointerId===t.pointerId?t:null}Oo(){this.ne&&cancelAnimationFrame(this.ne),this.ne=0}rl(e){window.removeEventListener("pointermove",this.gt),window.removeEventListener("pointerup",this.ke,!0),window.removeEventListener("pointercancel",this.Ft,!0),e.handle.removeEventListener("lostpointercapture",this.tl)}destroy(){this.Ot(!1),this.Oo(),this.e.o.root?.classList.remove("mach-root--resizing")}};var xi=6,st=class{constructor(e){this.e=e;this.Jr=null;this.ur=null;this.Ho=!1;this.de=0;this.qi=null;this.gt=e=>{if(this.ur){this.vu(e);return}let t=this.Jr;t&&(Math.abs(e.clientX-t.startX)<xi&&Math.abs(e.clientY-t.startY)<xi||this.bu(e))};this.ke=e=>{this.Jr=null,e.type!=="pointercancel"&&this.ur&&this.zo(e.clientX,e.clientY),this.Vo();let t=this.sl();t&&e.type!=="pointercancel"&&t.targetIndex>=0&&this.e.At(t.column.id,t.targetIndex)}}gu(e,t){e.button===0&&t.movable&&(this.Jr={column:t,startX:e.clientX,startY:e.clientY},window.addEventListener("pointermove",this.gt),window.addEventListener("pointerup",this.ke),window.addEventListener("pointercancel",this.ke))}yu(){let e=this.Ho;return this.Ho=!1,e}bu(e){let t=this.Jr;if(!t)return;let r=this.wu(t.column);if(!r||!r.parentElement){this.Vo();return}this.Ho=!0;let i=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",G(o,this.e.o.root),document.body.appendChild(o),r.parentElement.appendChild(i),r.classList.add("mach-header-cell--dragging"),this.e.o.root.classList.add("mach-root--dragging");let s=this.e.a.Bo(t.column),a=this.e.o.hr[s],l=this.e.n.T(s),d=new Float64Array(l.length+1),c=new Float64Array(l.length);for(let h=0;h<l.length;h++){let p=l[h].currentWidth;c[h]=d[h]+p/2,d[h+1]=d[h]+p}let u=o.getBoundingClientRect();this.ur={column:t.column,cellEl:r,ghost:o,indicator:i,targetIndex:-1,pane:s,containerLeft:a.getBoundingClientRect().left,startScrollLeft:this.e.o.M.center.scrollLeft,fromIndex:l.indexOf(t.column),midpoints:c,offsets:d,ghostWidth:u.width,ghostHeight:u.height},this.zo(e.clientX,e.clientY)}wu(e){let t=this.e.a.Bo(e);return this.e.o.hr[t].querySelector(`.mach-header-cell[data-col-id="${zo(e.id)}"]`)}vu(e){this.qi={clientX:e.clientX,clientY:e.clientY},!this.de&&(this.de=requestAnimationFrame(()=>{this.de=0;let t=this.qi;this.qi=null,t&&this.zo(t.clientX,t.clientY)}))}zo(e,t){let r=this.ur;if(!r)return;let i=E(e+12,8,window.innerWidth-r.ghostWidth-8),o=E(t+12,8,window.innerHeight-r.ghostHeight-8);r.ghost.style.transform=`translate3d(${i}px, ${o}px, 0)`;let s=r.pane==="center"?this.e.o.M.center.scrollLeft-r.startScrollLeft:0,a=e-(r.containerLeft-s),l=r.midpoints.length;for(let d=0;d<r.midpoints.length;d++)if(a<r.midpoints[d]){l=d;break}r.targetIndex=l>r.fromIndex?l-1:l,r.indicator.style.transform=`translate3d(${r.offsets[l]}px, 0, 0)`}sl(){let e=this.ur;return e?(this.ur=null,e.cellEl.classList.remove("mach-header-cell--dragging"),e.ghost.remove(),e.indicator.remove(),this.e.o.root.classList.remove("mach-root--dragging"),e):null}Vo(){window.removeEventListener("pointermove",this.gt),window.removeEventListener("pointerup",this.ke),window.removeEventListener("pointercancel",this.ke),this.de&&cancelAnimationFrame(this.de),this.de=0,this.qi=null}destroy(){this.Vo(),this.sl(),this.Jr=null}};function zo(n){return typeof CSS<"u"&&typeof CSS.escape=="function"?CSS.escape(n):n.replace(/[^a-zA-Z0-9_-]/g,"\\$&")}var ar=/^[+-]?(?:\d+(?:\.\d+)?|\.\d+)(?:[eE][+-]?\d+)?$/;function at(n,e=!0){if(n==="")return null;if(!e||typeof n!="string"||!ar.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 _o(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 ue(n){return typeof n!="string"||n===""||ar.test(n)?n:/^[\s\u0000-\u001f]*[=+\-@]/.test(n)?"'"+n:n}function Ri(n,e={}){let t=e.columnSeparator??",",r=e.protectFormulas??!0,i=n.map(o=>o.map(s=>_o(r?ue(s):s,t)).join(t)).join(`\r
3
3
  `);return e.prependBOM?"\uFEFF"+i:i}function lr(n){return n==null?"":String(n)}function Ko(n,e){let t=e?ue(n):n,r=lr(t);return/["\t\n\r]/.test(r)?'"'+r.replace(/"/g,'""')+'"':r}function dr(n,e=!0){return n.map(t=>t.map(r=>Ko(r,e)).join(" ")).join(`
4
4
  `)}function cr(n){return hr(n," ")}function ur(n,e=","){return hr(n,e)}function hr(n,e){let t=[],r=[],i="",o=!1,s=0;for(;s<n.length;){let a=n[s];if(o){if(a==='"'){if(n[s+1]==='"'){i+='"',s+=2;continue}o=!1,s++;continue}i+=a,s++;continue}if(a==='"'&&i===""){o=!0,s++;continue}if(a===e){r.push(i),i="",s++;continue}if(a===`
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agile-team/mach-table",
3
- "version": "0.35.3",
3
+ "version": "0.36.0",
4
4
  "description": "Enterprise-grade, framework-agnostic TypeScript data grid with virtualization, editing, grouping and extensibility",
5
5
  "keywords": [
6
6
  "data-grid",
@@ -168,5 +168,5 @@
168
168
  "test": "vitest run",
169
169
  "test:coverage": "vitest run --coverage"
170
170
  },
171
- "readme": "<p align=\"center\">\n <img src=\"https://raw.githubusercontent.com/ChenyCHENYU/MachTable/main/assets/mach-table-logo.svg\" alt=\"MachTable\" width=\"760\" />\n</p>\n\n# @agile-team/mach-table\n\nMachTable 0.35.3 的框架无关 TypeScript Core:零运行时依赖,提供行列双虚拟化、领域化 API、单元格/整行编辑、树与分组、随机访问远程数据、区段隔离状态持久化和可诊断扩展系统。本版统一完整表头宽度下限,覆盖初始布局、fit、状态恢复及交互缩列,内置插画空态与亮暗主题继续保留;可选 `/business` 的字典列策略、本地语义合计及字典缓存隔离继续兼容;普通根入口 API 和既有默认行为保持兼容。\n\n小型本地明细可使用 `domLayout: \"autoHeight\"` 随当前页内容收起;本版为该模式的空态、加载态和错误态预留必要展示空间,恢复数据后释放最小高度。可通过 `--mach-overlay-min-height` 局部调整。大数据表继续使用有明确高度的默认虚拟布局。\n\n```bash\npnpm add @agile-team/mach-table\n```\n\n```ts\nimport { createGrid, indexColumn } from \"@agile-team/mach-table\";\nimport \"@agile-team/mach-table/styles/mach-table.css\";\n\nconst api = createGrid(document.querySelector(\"#grid\")!, {\n columnDefs: [\n indexColumn({ headerName: \"序号\" }),\n { field: \"id\", headerName: \"ID\", width: 120 },\n { field: \"name\", headerName: \"名称\", flex: 1, editable: true }\n ],\n rowData: [{ id: \"1\", name: \"MachTable\" }],\n rowKey: \"id\",\n enableColumnResize: true,\n persistence: { key: \"tenant:user:customers\", sections: [\"columns\"] }\n});\n\napi.batch((grid) => {\n grid.rows.transact({ update: [{ id: \"1\", name: \"Updated\" }] });\n grid.columns.setVisible(\"internalNote\", false);\n grid.view.refreshCells({ rowIds: [\"1\"] });\n});\n\nconst saved = await api.editing.save(orderApi.saveChanges);\nconsole.table(saved.conflicts);\nconsole.info(api.diagnostics.get());\n\n// 原生宿主卸载时必须销毁;Vue/React 适配器会自动处理。\napi.destroy();\n```\n\n`persistence.sections` 同时约束进入 store 的数据与恢复范围;异步 store 写入有序,晚到加载不会覆盖加载期间的用户操作。\n\n单元格编辑通过内置对勾/取消控件显式结束,普通鼠标和焦点变化不会误提交;Enter、Escape、Tab 仍提供完整键盘路径。筛选、列设置、上下文菜单和操作菜单会继承所属表格实例的主题变量,不受宿主页面全局样式影响。\n\n编辑、粘贴、清空和填充共用已有列校验与整行校验,批量输入按行提交并合并撤销记录,异步校验不会写回已替换的数据。随机块缓存淘汰后,未保存行仍可通过编辑 API 保存或回滚;完整替换数据与重新查询会清理旧作用域的状态。\n\n`loading: true` 默认展示轻量表格骨架与本地化状态文案,空数据默认展示内置插画;需要品牌化时再通过 `overlayLoadingTemplate`、`overlayNoRowsTemplate` 覆盖,基础页面无需重复实现 loading/empty DOM。\n\n内置空态使用适配亮暗主题的淡蓝表格卡片与放大镜插画;`locale.emptyRows` 和 `locale.emptyRowsHint` 分别配置标题、说明,均按纯文本呈现。静态 SVG 不依赖远端资源或共享 id,多表并排不会互相影响。\n\n公共命令按 `rows`、`columns`、`selection`、`editing`、`filtering`、`sorting`、`pagination`、`hierarchy`、`view`、`state`、`io`、`diagnostics` 划分。完整签名见 [GridApi](https://github.com/ChenyCHENYU/MachTable/blob/main/docs/api/grid-api.md)。\n\n大型本地数据 Worker 使用独立入口:\n\n```ts\nimport { createWorkerDataProcessor } from \"@agile-team/mach-table/worker\";\n```\n\nVue/React 项目请只安装对应适配包,它会自动安装并重导出 Core:\n\n- [@agile-team/mach-table-vue](https://www.npmjs.com/package/@agile-team/mach-table-vue)\n- [@agile-team/mach-table-react](https://www.npmjs.com/package/@agile-team/mach-table-react)\n\n## 行拖拽与条件整行颜色\n\n```ts\nimport { dragColumn, type GridOptions } from \"@agile-team/mach-table\";\n\ninterface Plan { id: string; name: string; status: string }\nconst options: GridOptions<Plan> = {\n rowKey: \"id\",\n columnDefs: [dragColumn(), { field: \"name\" }, { field: \"status\" }],\n rowStyleRules: [\n { when: ({ data }) => data.status === \"pending\", tone: \"warning\" },\n { when: ({ data }) => data.status === \"failed\", tone: \"danger\" },\n { when: ({ data }) => data.status === \"done\", tone: \"success\" }\n ]\n};\n```\n\n状态码由应用定义,包内不识别业务状态。颜色规则取第一条命中结果,未命中时沿用默认样式;支持自定义背景/文字颜色、固定列、明暗主题、选择和虚拟行复用。拖拽提供主题手柄、落点线、位置浮层、边缘滚动、Esc 取消和 Alt + ↑/↓ 移动。扁平外部数据设置 `applyRowDrag: false`,由 `onRowDragEnd` 处理持久化;自动模式先完成移动再发出事件,使用 `targetIndex` 读取最终下标。树、分组及排序等自动模式限制见[完整配方](https://github.com/ChenyCHENYU/MachTable/blob/main/docs/recipes/row-presentation.md)。\n\n文档:[快速开始](https://github.com/ChenyCHENYU/MachTable/blob/main/docs/guide/getting-started.md) · [企业接入](https://github.com/ChenyCHENYU/MachTable/blob/main/docs/guide/enterprise-integration.md) · [API](https://github.com/ChenyCHENYU/MachTable/tree/main/docs/api)\n\n## 按需高级入口(0.34)\n\n仍从本包导入,无需另装高级功能包。普通根入口不加载这些实现或附加 CSS。\n\n| 子路径 | 功能 |\n| --- | --- |\n| `/workbench` | 高级过滤草稿与应用、修改差异/部分保存/冲突审阅、手动诊断 |\n| `/preferences` | 复合身份隔离、CAS、有序写入、历史版本及列 ID/类型迁移报告 |\n| `/ordering` | 多行/树移动、防环与业务约束、失败回滚、持久化撤销/重做 |\n| `/server-side` | 服务端分组/聚合、route 分页、缓存/刷新/事务及层级选择 |\n| `/multi-range` | Ctrl/Cmd 追加范围、格式化复制、校验清空及撤销 |\n| `/import` | 有界数据预览、共享同步/异步校验、结构化错误与过期保护 |\n| `/business` | 显式字典显示/解析/输出策略、范围与币种/单位分组的本地语义合计 |\n| `/analysis` | Pivot、安全公式、柱/折线图和数据表回退 |\n\n```ts\nimport { mountAdvancedFilterBuilder } from \"@agile-team/mach-table/workbench\";\nimport \"@agile-team/mach-table/styles/workbench.css\";\n\nconst filters = mountAdvancedFilterBuilder(host, { api });\n// 宿主卸载时调用;表格销毁也会释放工作台。\nfilters.destroy();\n```\n\n服务端分组控件使用 `/styles/server-side.css`,分析与多范围使用 `/styles/workbench.css`。排序、偏好和纯分析计算无需附加 CSS。服务端 Store 按 route 分页,不提供全树任意显示 offset;分析只处理当前已加载数据并显示范围。排序 undo/redo 的 transport 必须一次 CAS 保存 `context.operations` 的完整批次或 `context.plan.after`,只保存首参数无法完整恢复非连续/跨父级位置。\n\n完整示例与限制:[工作台](https://github.com/ChenyCHENYU/MachTable/blob/main/docs/recipes/workbench.md) · [排序](https://github.com/ChenyCHENYU/MachTable/blob/main/docs/recipes/row-presentation.md) · [企业偏好](https://github.com/ChenyCHENYU/MachTable/blob/main/docs/recipes/enterprise-preferences.md) · [服务端 Store](https://github.com/ChenyCHENYU/MachTable/blob/main/docs/recipes/server-side-store.md) · [多范围](https://github.com/ChenyCHENYU/MachTable/blob/main/docs/recipes/multi-range.md) · [分析](https://github.com/ChenyCHENYU/MachTable/blob/main/docs/recipes/analysis.md)。\n\nSource-available © ChenyCHENYU (Agile Team). 任何使用均须事先取得书面授权。详见 [LICENSE](https://github.com/ChenyCHENYU/MachTable/blob/main/LICENSE) 与[授权流程](https://github.com/ChenyCHENYU/MachTable/blob/main/LICENSING.md)。\n\n## 0.34 字典列策略与语义合计\n\n```ts\nimport { createDictionaryColumn, summarizeRows } from \"@agile-team/mach-table/business\";\n\nconst options = [{ value: \"ready\", label: \"已就绪\" }];\nconst labels = new Map(options.map(entry => [entry.value, entry.label]));\nconst statusColumn = {\n field: \"status\",\n ...createDictionaryColumn({ get: key => labels.get(key) }, {\n options,\n display: \"label\",\n output: { clipboard: \"label\", csv: \"code-label\" }\n })\n};\n```\n\n`/business` 无 UI、请求或缓存,连接已有 Provider;异步标签先预热,动态选项用新数组替换快照。原始数字/文本编码保留类型,重复标签拒绝歧义;未配置的输出通道保留原码,旧 renderer 的导出行为不变。\n\n`summarizeRows(rows, { scope, metrics, groupBy?, numeric? })` 只计算传入记录,支持 sum/count/ratio/none;ratio 先分别汇总分子分母。业务按币种、单位分组,scope 仅声明 page/selected/query,不自动获取全量。默认有限 number 仍遵循浮点语义,精确金额使用已有同步 numeric 策略;结果接入原 summaryMethod 或固定行。详见[业务列与字典](https://github.com/ChenyCHENYU/MachTable/blob/main/docs/recipes/business-columns.md)。\n\n根入口的 `createCachedDictionary()` 现在复用同 key 在途请求,失效隔离旧响应并结束旧等待,缺失项受同一 TTL/LRU 约束。失败可重试,销毁拒绝未完成请求,错误观察回调不会阻塞清理。具体升级边界见[升级指南](https://github.com/ChenyCHENYU/MachTable/blob/main/docs/guide/upgrading.md)。\n\n## 列值与运行边界(自 0.33)\n\n`ColDef.valueParser` 统一编辑、粘贴和导入的规范值;`valueSerializer` 按 clipboard/csv/xlsx 定义输出,沿用已有 `columnTypes` 优先级。排序/过滤读取规范值,可信事务与撤销不重复解析。`api.io.importMatrix()` / `exportMatrix()` 直传类型,完整导入预览从当前包的 `/import` 导入 `createImportPlan()`,不加载到默认入口。\n\n`sum` / `avg` / `min` / `max` 只聚合有限数,空数值集合返回 null,sum/avg 溢出返回 null;`count` 计全部记录,空集合为 0。自定义聚合保留原始输入。分组 ID 区分数字/文本/空值,旧展开路径仅在唯一时迁移,歧义报告错误。超大远程滚动使用有界物理坐标,API、滚轮和交互共用逻辑偏移;应用默认配置的 `dataProcessor` 使用每表工厂。完整边界与升级说明见[升级指南](https://github.com/ChenyCHENYU/MachTable/blob/main/docs/guide/upgrading.md)。\n\n冻结区由正文视口统一管理滚动,原生焦点恢复和 `scrollIntoView` 不会单独改变其滚动位置。业务定位继续使用 `api.view.scrollToRow()`,无需页面补丁。\n\n\n## 内容列宽与状态颜色(0.35)\n\n未声明 `width` 的列默认按表头和已加载数据的显示文本测宽:每列均匀抽样最多 100 行,默认 80–360px,`minWidth/maxWidth` 可覆盖。长内容在单元格内省略,表格保留内部横向滚动;不为测宽请求远程数据或执行自定义渲染器。格式化、字典及状态标签文字都参与测量。图形/操作等特殊列请指定宽度。\n\n```ts\nconst columns = [\n { field: \"customer\", headerName: \"客户\", maxWidth: 280 },\n { field: \"status\", headerName: \"状态\", status: true },\n { field: \"planStatus\", headerName: \"计划状态\", status: {\n S1B: { label: \"待复核\", color: \"danger\" },\n S1C: { label: \"已完成\", color: \"success\" },\n special: { label: \"特殊处理\", color: \"#8b5cf6\" }\n } }\n];\n```\n\n`status` 复用主题标签,支持 `success/warning/danger/info/neutral` 及 CSS 颜色;未知代码保持中性,`0/false` 保留。字典/formatter 的文字可参与默认语义匹配;显式 renderer 优先。状态配置只控制展示,导出继续遵循原有列值政策。\n\n普通布局尊重显式 `width` 和拖动后的宽度;`autoWidth: false` 保留原默认 150px。显式选择 `columnLayout: \"fit\"` 时仍按首选宽度比例铺满,360px 限制的是内容首选宽度,实际铺满仍遵循显式 minWidth/maxWidth;配置 `flex` 则主动允许本列吸收余量。手动调宽、列状态恢复及主动 `columns.fit()` 不受自动默认上限限制。更新数据或刷新单元格会重新测量,普通布局刷新复用结果。\n\n表头默认完整展示,不省略。初始布局、fit、列宽恢复、API、鼠标和 Alt+方向键统一以完整标题及排序/筛选/列工具控件为最小宽度;显式 width/minWidth/maxWidth 不能把标题压窄,空间不足时表格内部横向滚动。360px 上限仅作用于数据内容的首选宽度,不截断表头。复杂自定义表头请显式提供 minWidth。\n\n原生单元格按钮、链接、输入控件及 contenteditable 保留自身键盘和剪贴板行为;Enter/空格可直接激活详情等操作,Ctrl/Cmd 快捷键不会误触发表格编辑或修改表格数据。\n"
171
+ "readme": "<p align=\"center\">\n <img src=\"https://raw.githubusercontent.com/ChenyCHENYU/MachTable/main/assets/mach-table-logo.svg\" alt=\"MachTable\" width=\"760\" />\n</p>\n\n# @agile-team/mach-table\n\nMachTable 0.36.0 的框架无关 TypeScript Core:零运行时依赖,提供行列双虚拟化、领域化 API、单元格/整行编辑、树与分组、随机访问远程数据、区段隔离状态持久化和可诊断扩展系统。本版统一完整表头宽度下限,覆盖初始布局、fit、状态恢复及交互缩列,内置插画空态与亮暗主题继续保留;可选 `/business` 的字典列策略、本地语义合计及字典缓存隔离继续兼容;普通根入口 API 和既有默认行为保持兼容。\n\n小型本地明细可使用 `domLayout: \"autoHeight\"` 随当前页内容收起;本版为该模式的空态、加载态和错误态预留必要展示空间,恢复数据后释放最小高度。可通过 `--mach-overlay-min-height` 局部调整。大数据表继续使用有明确高度的默认虚拟布局。\n\n```bash\npnpm add @agile-team/mach-table\n```\n\n```ts\nimport { createGrid, indexColumn } from \"@agile-team/mach-table\";\nimport \"@agile-team/mach-table/styles/mach-table.css\";\n\nconst api = createGrid(document.querySelector(\"#grid\")!, {\n columnDefs: [\n indexColumn({ headerName: \"序号\" }),\n { field: \"id\", headerName: \"ID\", width: 120 },\n { field: \"name\", headerName: \"名称\", flex: 1, editable: true }\n ],\n rowData: [{ id: \"1\", name: \"MachTable\" }],\n rowKey: \"id\",\n enableColumnResize: true,\n persistence: { key: \"tenant:user:customers\", sections: [\"columns\"] }\n});\n\napi.batch((grid) => {\n grid.rows.transact({ update: [{ id: \"1\", name: \"Updated\" }] });\n grid.columns.setVisible(\"internalNote\", false);\n grid.view.refreshCells({ rowIds: [\"1\"] });\n});\n\nconst saved = await api.editing.save(orderApi.saveChanges);\nconsole.table(saved.conflicts);\nconsole.info(api.diagnostics.get());\n\n// 原生宿主卸载时必须销毁;Vue/React 适配器会自动处理。\napi.destroy();\n```\n\n`persistence.sections` 同时约束进入 store 的数据与恢复范围;异步 store 写入有序,晚到加载不会覆盖加载期间的用户操作。\n\n单元格编辑通过内置对勾/取消控件显式结束,普通鼠标和焦点变化不会误提交;Enter、Escape、Tab 仍提供完整键盘路径。筛选、列设置、上下文菜单和操作菜单会继承所属表格实例的主题变量,不受宿主页面全局样式影响。\n\n编辑、粘贴、清空和填充共用已有列校验与整行校验,批量输入按行提交并合并撤销记录,异步校验不会写回已替换的数据。随机块缓存淘汰后,未保存行仍可通过编辑 API 保存或回滚;完整替换数据与重新查询会清理旧作用域的状态。\n\n`loading: true` 默认展示轻量表格骨架与本地化状态文案,空数据默认展示内置插画;需要品牌化时再通过 `overlayLoadingTemplate`、`overlayNoRowsTemplate` 覆盖,基础页面无需重复实现 loading/empty DOM。\n\n内置空态使用适配亮暗主题的淡蓝表格卡片与放大镜插画;`locale.emptyRows` 和 `locale.emptyRowsHint` 分别配置标题、说明,均按纯文本呈现。静态 SVG 不依赖远端资源或共享 id,多表并排不会互相影响。\n\n公共命令按 `rows`、`columns`、`selection`、`editing`、`filtering`、`sorting`、`pagination`、`hierarchy`、`view`、`state`、`io`、`diagnostics` 划分。完整签名见 [GridApi](https://github.com/ChenyCHENYU/MachTable/blob/main/docs/api/grid-api.md)。\n\n大型本地数据 Worker 使用独立入口:\n\n```ts\nimport { createWorkerDataProcessor } from \"@agile-team/mach-table/worker\";\n```\n\nVue/React 项目请只安装对应适配包,它会自动安装并重导出 Core:\n\n- [@agile-team/mach-table-vue](https://www.npmjs.com/package/@agile-team/mach-table-vue)\n- [@agile-team/mach-table-react](https://www.npmjs.com/package/@agile-team/mach-table-react)\n\n## 行拖拽与条件整行颜色\n\n```ts\nimport { dragColumn, type GridOptions } from \"@agile-team/mach-table\";\n\ninterface Plan { id: string; name: string; status: string }\nconst options: GridOptions<Plan> = {\n rowKey: \"id\",\n columnDefs: [dragColumn(), { field: \"name\" }, { field: \"status\" }],\n rowStyleRules: [\n { when: ({ data }) => data.status === \"pending\", tone: \"warning\" },\n { when: ({ data }) => data.status === \"failed\", tone: \"danger\" },\n { when: ({ data }) => data.status === \"done\", tone: \"success\" }\n ]\n};\n```\n\n状态码由应用定义,包内不识别业务状态。颜色规则取第一条命中结果,未命中时沿用默认样式;支持自定义背景/文字颜色、固定列、明暗主题、选择和虚拟行复用。拖拽提供主题手柄、落点线、位置浮层、边缘滚动、Esc 取消和 Alt + ↑/↓ 移动。扁平外部数据设置 `applyRowDrag: false`,由 `onRowDragEnd` 处理持久化;自动模式先完成移动再发出事件,使用 `targetIndex` 读取最终下标。树、分组及排序等自动模式限制见[完整配方](https://github.com/ChenyCHENYU/MachTable/blob/main/docs/recipes/row-presentation.md)。\n\n文档:[快速开始](https://github.com/ChenyCHENYU/MachTable/blob/main/docs/guide/getting-started.md) · [企业接入](https://github.com/ChenyCHENYU/MachTable/blob/main/docs/guide/enterprise-integration.md) · [API](https://github.com/ChenyCHENYU/MachTable/tree/main/docs/api)\n\n## 按需高级入口(0.34)\n\n仍从本包导入,无需另装高级功能包。普通根入口不加载这些实现或附加 CSS。\n\n| 子路径 | 功能 |\n| --- | --- |\n| `/workbench` | 高级过滤草稿与应用、修改差异/部分保存/冲突审阅、手动诊断 |\n| `/preferences` | 复合身份隔离、CAS、有序写入、历史版本及列 ID/类型迁移报告 |\n| `/ordering` | 多行/树移动、防环与业务约束、失败回滚、持久化撤销/重做 |\n| `/server-side` | 服务端分组/聚合、route 分页、缓存/刷新/事务及层级选择 |\n| `/multi-range` | Ctrl/Cmd 追加范围、格式化复制、校验清空及撤销 |\n| `/import` | 有界数据预览、共享同步/异步校验、结构化错误与过期保护 |\n| `/business` | 显式字典显示/解析/输出策略、范围与币种/单位分组的本地语义合计 |\n| `/analysis` | Pivot、安全公式、柱/折线图和数据表回退 |\n\n```ts\nimport { mountAdvancedFilterBuilder } from \"@agile-team/mach-table/workbench\";\nimport \"@agile-team/mach-table/styles/workbench.css\";\n\nconst filters = mountAdvancedFilterBuilder(host, { api });\n// 宿主卸载时调用;表格销毁也会释放工作台。\nfilters.destroy();\n```\n\n服务端分组控件使用 `/styles/server-side.css`,分析与多范围使用 `/styles/workbench.css`。排序、偏好和纯分析计算无需附加 CSS。服务端 Store 按 route 分页,不提供全树任意显示 offset;分析只处理当前已加载数据并显示范围。排序 undo/redo 的 transport 必须一次 CAS 保存 `context.operations` 的完整批次或 `context.plan.after`,只保存首参数无法完整恢复非连续/跨父级位置。\n\n完整示例与限制:[工作台](https://github.com/ChenyCHENYU/MachTable/blob/main/docs/recipes/workbench.md) · [排序](https://github.com/ChenyCHENYU/MachTable/blob/main/docs/recipes/row-presentation.md) · [企业偏好](https://github.com/ChenyCHENYU/MachTable/blob/main/docs/recipes/enterprise-preferences.md) · [服务端 Store](https://github.com/ChenyCHENYU/MachTable/blob/main/docs/recipes/server-side-store.md) · [多范围](https://github.com/ChenyCHENYU/MachTable/blob/main/docs/recipes/multi-range.md) · [分析](https://github.com/ChenyCHENYU/MachTable/blob/main/docs/recipes/analysis.md)。\n\nSource-available © ChenyCHENYU (Agile Team). 任何使用均须事先取得书面授权。详见 [LICENSE](https://github.com/ChenyCHENYU/MachTable/blob/main/LICENSE) 与[授权流程](https://github.com/ChenyCHENYU/MachTable/blob/main/LICENSING.md)。\n\n## 0.34 字典列策略与语义合计\n\n```ts\nimport { createDictionaryColumn, summarizeRows } from \"@agile-team/mach-table/business\";\n\nconst options = [{ value: \"ready\", label: \"已就绪\" }];\nconst labels = new Map(options.map(entry => [entry.value, entry.label]));\nconst statusColumn = {\n field: \"status\",\n ...createDictionaryColumn({ get: key => labels.get(key) }, {\n options,\n display: \"label\",\n output: { clipboard: \"label\", csv: \"code-label\" }\n })\n};\n```\n\n`/business` 无 UI、请求或缓存,连接已有 Provider;异步标签先预热,动态选项用新数组替换快照。原始数字/文本编码保留类型,重复标签拒绝歧义;未配置的输出通道保留原码,旧 renderer 的导出行为不变。\n\n`summarizeRows(rows, { scope, metrics, groupBy?, numeric? })` 只计算传入记录,支持 sum/count/ratio/none;ratio 先分别汇总分子分母。业务按币种、单位分组,scope 仅声明 page/selected/query,不自动获取全量。默认有限 number 仍遵循浮点语义,精确金额使用已有同步 numeric 策略;结果接入原 summaryMethod 或固定行。详见[业务列与字典](https://github.com/ChenyCHENYU/MachTable/blob/main/docs/recipes/business-columns.md)。\n\n根入口的 `createCachedDictionary()` 现在复用同 key 在途请求,失效隔离旧响应并结束旧等待,缺失项受同一 TTL/LRU 约束。失败可重试,销毁拒绝未完成请求,错误观察回调不会阻塞清理。具体升级边界见[升级指南](https://github.com/ChenyCHENYU/MachTable/blob/main/docs/guide/upgrading.md)。\n\n## 列值与运行边界(自 0.33)\n\n`ColDef.valueParser` 统一编辑、粘贴和导入的规范值;`valueSerializer` 按 clipboard/csv/xlsx 定义输出,沿用已有 `columnTypes` 优先级。排序/过滤读取规范值,可信事务与撤销不重复解析。`api.io.importMatrix()` / `exportMatrix()` 直传类型,完整导入预览从当前包的 `/import` 导入 `createImportPlan()`,不加载到默认入口。\n\n`sum` / `avg` / `min` / `max` 只聚合有限数,空数值集合返回 null,sum/avg 溢出返回 null;`count` 计全部记录,空集合为 0。自定义聚合保留原始输入。分组 ID 区分数字/文本/空值,旧展开路径仅在唯一时迁移,歧义报告错误。超大远程滚动使用有界物理坐标,API、滚轮和交互共用逻辑偏移;应用默认配置的 `dataProcessor` 使用每表工厂。完整边界与升级说明见[升级指南](https://github.com/ChenyCHENYU/MachTable/blob/main/docs/guide/upgrading.md)。\n\n冻结区由正文视口统一管理滚动,原生焦点恢复和 `scrollIntoView` 不会单独改变其滚动位置。业务定位继续使用 `api.view.scrollToRow()`,无需页面补丁。\n\n\n## 内容列宽与状态颜色(0.35)\n\n未声明 `width` 的列默认按表头和已加载数据的显示文本测宽:每列均匀抽样最多 100 行,默认 80–360px,`minWidth/maxWidth` 可覆盖。长内容在单元格内省略,表格保留内部横向滚动;不为测宽请求远程数据或执行自定义渲染器。格式化、字典及状态标签文字都参与测量。图形/操作等特殊列请指定宽度。\n\n```ts\nconst columns = [\n { field: \"customer\", headerName: \"客户\", maxWidth: 280 },\n { field: \"status\", headerName: \"状态\", status: true },\n { field: \"planStatus\", headerName: \"计划状态\", status: {\n S1B: { label: \"待复核\", color: \"danger\" },\n S1C: { label: \"已完成\", color: \"success\" },\n special: { label: \"特殊处理\", color: \"#8b5cf6\" }\n } }\n];\n```\n\n`status` 复用主题标签,支持 `success/warning/danger/info/neutral` 及 CSS 颜色;未知代码保持中性,`0/false` 保留。字典/formatter 的文字可参与默认语义匹配;显式 renderer 优先。状态配置只控制展示,导出继续遵循原有列值政策。\n\n普通布局尊重显式 `width` 和拖动后的宽度;`autoWidth: false` 保留原默认 150px。显式选择 `columnLayout: \"fit\"` 时仍按首选宽度比例铺满,360px 限制的是内容首选宽度,实际铺满仍遵循显式 minWidth/maxWidth;配置 `flex` 则主动允许本列吸收余量。手动调宽、列状态恢复及主动 `columns.fit()` 不受自动默认上限限制。更新数据或刷新单元格会重新测量,普通布局刷新复用结果。\n\n表头默认完整展示,不省略。初始布局、fit、列宽恢复、API、鼠标和 Alt+方向键统一以完整标题及排序/筛选/列工具控件为最小宽度;显式 width/minWidth/maxWidth 不能把标题压窄,空间不足时表格内部横向滚动。360px 上限仅作用于数据内容的首选宽度,不截断表头。复杂自定义表头请显式提供 minWidth。\n\n原生单元格按钮、链接、输入控件及 contenteditable 保留自身键盘和剪贴板行为;Enter/空格可直接激活详情等操作,Ctrl/Cmd 快捷键不会误触发表格编辑或修改表格数据。\n"
172
172
  }