@guiexpert/table 1.1.96 → 1.1.98
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 +7 -0
- package/css/main.css +192 -27
- package/css/table-classes.css +33 -9
- package/css/table-color-vars.css +12 -0
- package/css/table-fill-batch.css +9 -2
- package/css/table-master-detail.css +115 -0
- package/css/table-tree.css +23 -16
- package/index.cjs +50 -50
- package/index.d.ts +12 -0
- package/index.js +3996 -2631
- package/lib/table/aria/aria-ids.d.ts +7 -0
- package/lib/table/aria/aria-texts.d.ts +2 -0
- package/lib/table/aria/aria-texts.if.d.ts +14 -0
- package/lib/table/crud/crud-object-edit.d.ts +2 -0
- package/lib/table/crud/crud-object-view.d.ts +2 -0
- package/lib/table/crud/crud-table-model-factory.d.ts +2 -0
- package/lib/table/data/common/event/ge-detail-event.d.ts +40 -0
- package/lib/table/data/options/auto-restore-options.d.ts +2 -0
- package/lib/table/data/options/auto-restore-options.if.d.ts +6 -0
- package/lib/table/data/options/table-options.d.ts +8 -0
- package/lib/table/data/options/table-options.if.d.ts +35 -0
- package/lib/table/ele-scope.d.ts +51 -0
- package/lib/table/event-adapter.d.ts +3 -0
- package/lib/table/event-listener.if.d.ts +7 -0
- package/lib/table/master-detail/detail-renderer.if.d.ts +99 -0
- package/lib/table/master-detail/master-detail-options.d.ts +30 -0
- package/lib/table/master-detail/master-detail-options.if.d.ts +60 -0
- package/lib/table/master-detail/master-detail-service.d.ts +223 -0
- package/lib/table/render-scope.d.ts +73 -0
- package/lib/table/row-layout/row-layout.d.ts +120 -0
- package/lib/table/rtl/rtl-util.d.ts +126 -0
- package/lib/table/rtl/table-direction.type.d.ts +23 -0
- package/lib/table/service/convenience-dom.service.d.ts +49 -1
- package/lib/table/service/excel-export-options.if.d.ts +17 -0
- package/lib/table/service/excel-service.d.ts +8 -2
- package/lib/table/service/excel-service.if.d.ts +3 -1
- package/lib/table/state/table-state.if.d.ts +4 -1
- package/lib/table/state/table-state.service.d.ts +4 -0
- package/lib/table/table-api.d.ts +123 -2
- package/lib/table/table-scope.d.ts +69 -0
- package/package.json +1 -1
package/index.cjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});function
|
|
2
|
-
property: "${
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});function vr(a,e=500){let t=null,s=0;return function(...o){const i=Date.now(),r=e-(i-s);r<=0?(a.apply(this,o),s=i):t||(t=window.setTimeout(()=>{a.apply(this,o),s=Date.now(),t=null},r))}}function Eo(a,e=500){let t=null;return function(...s){t&&window.clearTimeout(t),t=window.setTimeout(()=>{a.apply(this,s),t=null},e)}}const Sr={"&":"&","<":"<",">":">",'"':""","'":"'"};function I(a){return a==null?"":String(a).replace(/[&<>"']/g,e=>Sr[e])}function Rr(a=500){return function(e,t,s){let o=0;const i=s.value;return s.value=function(...r){if(!(Date.now()-o<a))return o=Date.now(),i.apply(this,r)},s}}const Ds="any",Ve="undefined",ks="null",Fs="string",Ht="number",_t="boolean",Ls="Array",Oe="object",tt=[ks,Ve,Ds];class Ps{constructor(e){this.propertyName=e,this.type=Ds}}class mt{constructor(e){this.propertyName=e,this.type=Ve}}class To{constructor(e){this.propertyName=e,this.type=ks}}class Io{constructor(e){this.propertyName=e,this.type=Fs}}class Do{constructor(e){this.propertyName=e,this.type=Ht}}class ko{constructor(e){this.propertyName=e,this.type=_t}}class ge{constructor(e,t=[]){this.propertyName=e,this.items=t,this.type=Ls}}class Vs{constructor(e,t=[]){this.propertyName=e,this.types=t}toString(){return`PropertyItem(propertyName: ${this.propertyName}, types: [${this.types.map(e=>e.type).join(", ")}])`}}class Q{constructor(e,t,s=[]){this.propertyName=e,this.className=t,this.properties=s,this.type=Oe}}class Ar{constructor(){this.rootPropertyType=null,this.allowCustomRenderer=!0,this.bufCustomRenderer=[],this.LABEL_MAPPINGS={Id:"ID",In:"in",At:"at",Of:"of",From:"from",And:"and",The:"the",On:"on",By:"by",To:"to",With:"with",For:"for",As:"as",Or:"or",But:"but",Nor:"nor"}}renderColumnDefs(e,t=!0){this.allowCustomRenderer=t,this.rootPropertyType=e,this.bufCustomRenderer=[];const s=[];if(!this.rootPropertyType)return s;if(e instanceof ge){const o=e.items.find(i=>i.type===Oe);if(o&&o instanceof Q){const i=o.properties;s.push(" const columnDefs: ColumnDefIf[] = ["),this.iteratePropertyItems(s,i,""),s.push(" ];")}}return[...s,...this.bufCustomRenderer]}iteratePropertyItems(e,t,s=""){for(let o=0;o<t.length;o++){let r=t[o].types.filter(n=>!tt.includes(n.type));if(r.length===1){let n=r[0];const l=s?[s,n.propertyName].join("."):n.propertyName;if(n instanceof Q)this.iteratePropertyItems(e,n.properties,l);else{let c="";if(n instanceof ge){const g=n.items.find(p=>p.type===Oe);g&&g instanceof Q&&(c=g.className)}const h=this.getReadableColumnLabel(l);let d=100,u="",f="ge-table-text-align-left";if(n.type===Ls){if(this.allowCustomRenderer&&c){const g=`${c}ArrayCellRenderer`;u=` bodyRenderer: new ${g}(),`,f="",this.renderCumstomCellRenderer(c,g)}else u=" bodyRenderer: new SimpleArrayCellRenderer(),";d=250}else n.type===Ht?(u=" bodyRenderer: new NumberCellRenderer(),",f="ge-table-text-align-right"):n.type===_t&&(u=" bodyRenderer: new TrueFalseCellRenderer(),",f="ge-table-text-align-center",d=80);e.push(` ColumnDef.create({
|
|
2
|
+
property: "${l}",
|
|
3
3
|
headerLabel: "${h}",
|
|
4
4
|
width: new Size(${d}, "px"),
|
|
5
5
|
bodyClasses: ["${f}"],
|
|
@@ -38,15 +38,15 @@ export class ${t} implements CellRendererIf {
|
|
|
38
38
|
|
|
39
39
|
}
|
|
40
40
|
|
|
41
|
-
`)}}class os{fixJSON(e){const t=[];let s="",o=!1,i=!1;for(let r=0;r<e.length;r++){const n=e[r];if(s+=n,n==='"'&&!i&&(o=!o),n==="\\"&&!i){i=!0;continue}else i=!1;if(!o){if(n==="{"||n==="[")t.push(n);else if(n==="}"||n==="]"){const a=t.pop();if(n==="}"&&a!=="{"||n==="]"&&a!=="[")throw new Error("Invalid JSON structure detected.")}}}for(;t.length>0;){const r=t.pop();r==="{"?s+="}":r==="["&&(s+="]")}return s}}class Io{constructor(){this.property="",this.value="",this.path="",this.propertyItem=new Is("",[new Ts("")])}toString(){var e;return`${this.path} -> : ${((e=this.propertyItem)==null?void 0:e.toString())??""}`}}const is="Entity";function Do(l){let e=ko(Fo(l));return e.includes(is)||(e=e+is),e}function ko(l){if(!l||l.length===0)return l;const e=["Array","Arr","List","s"];for(const t of e)if(l.endsWith(t))return l.slice(0,-t.length);return l}function Fo(l){return!l||l.length===0?"":l[0].toUpperCase()+l.slice(1)}class gr{constructor(){this.debugging=!1}json2PropertyType(e,t=""){let s;if(typeof e=="string"){const o=new os().fixJSON(e);s=this.json2Object(o)}else s=e;return this.object2PropertyType(s,t)}json2Object(e){return JSON.parse(e)}object2PropertyType(e,t=""){const s=this.object2ValueInfos(e,t);this.debugging&&this.logValueInfos(s);const o=this.valueInfos2PropertyType(s);return"name"in o&&(o.name=t),o}json2ValueInfos(e,t=""){let s;if(typeof e=="string"){const o=new os().fixJSON(e);s=this.json2Object(o)}else s=e;return this.object2ValueInfos(s,t)}object2ValueInfos(e,t=""){const s=this.extractValueInfos(e,t),o=this.mergeValueInfos(s);return o.length>0&&(o[0].propertyItem.propertyName=t),this.debugging&&this.logValueInfos(o),o}getParentPath(e){const t=e.lastIndexOf("/");return t===-1?"":e.substring(0,t)}valueInfos2PropertyType(e){const t=e[0].propertyItem.types[0],s=new Map;for(const o of e)s.set(o.path,o);for(const o of e){const i=this.getParentPath(o.path);if(i){const r=s.get(i);if(r){let n=!1;const a=r.propertyItem.types.filter(c=>!Je.includes(c.type));if(a.length===1){const c=a[0];if(c instanceof ce){n=!0;for(const h of o.propertyItem.types)c.items.push(h)}else c instanceof X&&(n=!0,c.properties.push(o.propertyItem))}if(!n)for(const c of o.propertyItem.types)r.propertyItem.types.push(c)}}}return t||new Ts("")}logValueInfos(e){for(let t=0;t<e.length;t++){const s=e[t];s.value=null;const o=t.toString().padStart(2,"0");console.info(o+") "+s.toString()+" parent: "+this.getParentPath(s.path))}}mergeValueInfos(e){const t=[];let s=e.length-1;t.push(e[s]);let o=e[s].path;for(let i=s-1;i>=0;i--){if(e[i].path===o){const r=e[i].propertyItem.types[0];e[s].propertyItem.types.some(n=>n.type===r.type)||e[s].propertyItem.types.push(r)}(i===0||e[i].path!==o)&&(s=i,t.push(e[i]),o=e[s].path)}for(const i of e){const r=this.getParentPath(i.path);if(r){const n=this.getParentPath(r);if(n){const a=this.getFirstValueInfoByPath(e,n);if(Array.isArray(a==null?void 0:a.value)){const c=(a==null?void 0:a.value.length)??0,h=this.countPath(e,i.path);c>h&&(i.propertyItem.types.some(d=>d.type===De)||i.propertyItem.types.push(new dt(i.property)))}}}}return t.reverse(),t}countPath(e,t){let s=0;for(const o of e)o.path===t&&s++;return s}getFirstValueInfoByPath(e,t){for(let s=e.length-1;s>=0;s--)if(e[s].path===t)return e[s];return null}extractValueInfos(e,t){const s=[],o=(i,r,n)=>{const a=new Io;let c=r.split("/").pop()||"";if(c==="[]"?c=n:c==="root"&&(c=t),a.property=c,a.value=i,a.path=r,a.propertyItem=this.createPropertyItem(i,a.property),s.push(a),i&&typeof i===ke&&!Array.isArray(i)){for(const h in i)if(i.hasOwnProperty(h)){const d=r?`${r}/${h}`:h;o(i[h],d,c)}}else Array.isArray(i)&&i.forEach((h,d)=>{const u=`${r}/[]`;o(h,u,c)})};return o(e,"root",t),s.sort((i,r)=>i.path.localeCompare(r.path))}createPropertyItem(e,t){return new Is(t,[this.createPropertyType(e,t)])}createPropertyType(e,t){return e===null?new Ao(t):e===void 0?new dt(t):typeof e===Ms?new Mo(t):typeof e===Vt&&!isNaN(e)?new Eo(t):typeof e===Lt?new To(t):Array.isArray(e)?new ce(t):typeof e===ke?new X(t,Do(t)):new dt(t)}}class pr{constructor(){this.orOperator="|",this.rootPropertyType=null,this.rootName="Root",this.renderTypeScriptInterfacesFifo=[],this.renderTypeScriptInterfacesDone=[]}renderTypeScriptInterfaces(e){"name"in e&&(this.rootName=e.name+""),this.rootPropertyType=e;const t=[];return this.rootPropertyType&&(this.renderTypeScriptInterfacesFifo=[],this.renderTypeScriptInterfacesRecursive(this.rootPropertyType,t),this.renderTypeScriptInterfacesFifoNext(t)),t}renderTypeScriptInterfacesFifoNext(e){var t;for(;(t=this.renderTypeScriptInterfacesFifo)!=null&&t.length;){const s=this.renderTypeScriptInterfacesFifo.shift();s&&this.renderTypeScriptInterfacesRecursive(s,e,s.propertyName)}}renderTypeScriptInterfacesRecursive(e=this.rootPropertyType,t=[],s=this.rootName){if(!e)return t;if(e instanceof ce){for(const o of e.items)if(this.renderTypeScriptInterfacesRecursive(o,t,s),o instanceof X){const i=o;i!==this.rootPropertyType&&this.renderTypeScriptInterfacesFifo.push(i)}}else if(e instanceof X){const o=e,i=o.className;if(!this.renderTypeScriptInterfacesDone.includes(i)){this.renderTypeScriptInterfacesDone.push(i),t.push(`export interface ${i} {`);for(const r of o.properties){let n=this.propertyItem2InterfaceDateType(r);n==="[]"?n="any[]":n.startsWith("(")&&n.endsWith(")")&&(n=n.substring(1,n.length-1));const a=this.containsUndefinedPropertyType(r)?"?":"";t.push(" "+r.propertyName+a+": "+n+";");for(const c of r.types)if(c instanceof X)c!==this.rootPropertyType&&this.renderTypeScriptInterfacesFifo.push(c);else if(c instanceof ce)for(const h of c.items)h instanceof X&&this.renderTypeScriptInterfacesFifo.push(h)}t.push("}"),t.push("")}}return t}propertyItem2InterfaceDateType(e){var s,o;if(((s=e.types)==null?void 0:s.length)===0)return"any";if(((o=e.types)==null?void 0:o.length)===1)return this.renderType(e.types[0],e);const t=e.types.map(i=>this.renderType(i,e)).filter(i=>i!==De).sort((i,r)=>Je.includes(i)?100:Je.includes(r)?-100:i.localeCompare(r)).join(this.orOperator);return t.includes(this.orOperator)?"("+t+")":t}renderType(e,t){if(e instanceof ce){const s=e.items.map(o=>this.renderType(o,t)).join(this.orOperator);return s.includes(this.orOperator)?`(${s})[]`:`${s}[]`}return e instanceof X?e.className:e.type}containsUndefinedPropertyType(e){for(const t of e.types)if(t.type===De)return!0;return!1}}class be{constructor(){this.alreadySet=!1}static getInstance(){return be.instance||(be.instance=new be),be.instance}setLicenseKey(e){if(e&&!this.alreadySet){const t=document.createElement("meta");t.content="license="+e,t.name="guiexperttable",document.getElementsByTagName("head")[0].appendChild(t),this.alreadySet=!0}}}function F(l){return l&&l.type==="TreeRow"}function _(l){return l&&l.type==="AreaModelTree"}function Ds(l){return!!l&&l.type==="CheckboxCellRenderer"}function Ce(l){return l&&l.type==="CheckboxColumnDef"}function L(l){return!!l&&l.type==="RowNumberColumnDef"}function Po(l){return!!l&&l.type==="AreaModelAggregateFooter"}function $(l){return!!l&&l.type==="RowGroup"}function rs(l){return F(l)&&$(l.data)}function z(l){return!!l&&l.kind==="AreaModelRowGroups"}function Ee(l){return!!l&&l.type==="RowGroupColumnDef"}function ks(l){return!!l&&l.kind==="PivotTableModel"}function ns(l){return!!l&&l.kind==="AreaModelPivot"}function Ot(l){return!!l&&l.type==="PivotColumnDef"}class Nt{constructor(e=-1,t=-1,s=-1,o=-1,i,r,n,a=0,c=0,h=0,d=""){this.rowIndex=e,this.rowTop=t,this.columnIndex=s,this.columnLeft=o,this.areaIdent=i,this.sideIdent=r,this.originalEvent=n,this.clickCount=a,this.draggingX=c,this.draggingY=h,this.action=d}clone(){return new Nt(this.rowIndex,this.rowTop,this.columnIndex,this.columnLeft,this.areaIdent,this.sideIdent,this.originalEvent,this.clickCount,this.draggingX,this.draggingY,this.action)}}class Z{constructor(e=">",t="",s=[]){this.content=e,this.style=t,this.classes=s}}class Fs{constructor(e=new Z(">","transform: rotate(90deg) translate(66%, -66%); transform-origin: 0 0;",["gt-table-tree-arrow-expanded"]),t=new Z(">","",["ge-table-tree-arrow-collapsed"]),s=new Z(">","color:transparent;",["gt-table-tree-arrow-hidden"]),o=new Z("↕","",["gt-table-tree-arrow-expanded-all"])){this.arrowExpanded=e,this.arrowCollapsed=t,this.arrowPlaceholder=s,this.arrowExpandCollapseAll=o}}class Ps{constructor(e=new Z("↑","",["ge-header-sorted-asc"]),t=new Z("↓","",["ge-header-sorted-desc"]),s=new Z("↑","color:transparent;",[])){this.iconAsc=e,this.iconDesc=t,this.iconPlaceholder=s}}const Et=class Et{constructor(e){this.domService=e}setStyle(e,t,s){return this.domService.setStyle(e,t,s),e}applyStyle(e,t){for(const s in t)this.domService.setStyle(e,s,t[s]);return e}applyDisplayNoneStyle(e){return this.domService.setStyle(e,"display","none"),e}applyDisplayBlockStyle(e){return this.domService.setStyle(e,"display","block"),e}applyStyleInPx(e,t){return Object.entries(t).forEach(([s,o])=>this.domService.setStyle(e,s,o+"px")),e}applyStylePosistionRelative(e){return this.domService.setStyle(e,"position","relative"),this.domService.setStyle(e,"overflow","clip"),e}applyStylePosistionAbsolute(e){return this.domService.setStyle(e,"position","absolute"),e}applyStyleFullSize(e){return this.domService.setStyle(e,"width","100%"),this.domService.setStyle(e,"height","100%"),e}applyStyleOverflowAuto(e="auto",t="auto",s){return this.domService.setStyle(s,"overflow-x",e),this.domService.setStyle(s,"overflow-y",t),s}applyStyleNoPadding(e){return this.domService.setStyle(e,"padding","0"),this.domService.setStyle(e,"margin","0"),this.domService.setStyle(e,"border","0"),e}appendRelativeChildDiv(e){const t=this.applyStylePosistionRelative(this.applyStyleFullSize(this.applyStyleNoPadding(this.domService.createElement("div"))));return this.domService.appendChild(e,t),this.applyStylePosistionAbsolute(e),{parent:e,child:t,cache:{}}}appendText(e,t){const s=this.domService.createText(t);return this.domService.appendChild(e,s),s}addClass(e,t){return e.includes(" ")?e.split(" ").forEach(s=>this.domService.addClass(t,s)):this.domService.addClass(t,e),t}removeClass(e,t){return e.includes(" ")?e.split(" ").forEach(s=>this.domService.removeClass(t,s)):this.domService.removeClass(t,e),t}addClasses(e,t){if(e)for(const s of e)this.domService.addClass(t,s);return t}setAttribute(e,t,s){return t&&s&&this.domService.setAttribute(e,t,s),e}removeAttribute(e,t){return this.domService.removeAttribute?this.domService.removeAttribute(e,t):e.removeAttribute(t),e}setAriaHidden(e){return this.domService.setAttribute(e,"aria-hidden","true"),e}createAreaDivWithClass(e,t,s,o){const i=this.domService.createElement("div");return this.addClass(e,i),this.domService.setAttribute(i,"data-area",s),this.domService.setAttribute(i,"data-side",o),this.domService.appendChild(t,i),i}createDivWithClass(e,t){const s=this.domService.createElement("div");return this.addClass(e,s),this.domService.appendChild(t,s),s}addRowDiv(e,t,s=-1,o,i,r=""){const n=t.index??-1,a=this.getDivOrCreateDiv(n,e);if(this.domService.addClass(a,"ge-table-row-div"),this.domService.addClass(a,`ge-table-row-div-${t.index}`),o==="body"&&i==="center"){const c=((t==null?void 0:t.index)??0)%2===0?"even":"odd";this.domService.addClass(a,`ge-table-row-${c}`)}if(this.domService.setStyle(a,"display","clip"),this.domService.setStyle(a,"position","absolute"),this.domService.setStyle(a,"left",`${t.left}px`),this.domService.setStyle(a,"top",`${t.top}px`),this.domService.setStyle(a,"width",`${t.width}px`),this.domService.setStyle(a,"height",`${t.height}px`),this.domService.setAttribute(a,"data-row-index",`${s}`),this.domService.setAttribute(a,"data-area",`${o}`),r){const c=this.domService.createText(r);this.domService.appendChild(a,c)}return this.domService.appendChild(e.child,a),a}addColumnDiv(e){const{parent:t,geo:s,rowIndex:o=-1,columnIndex:i=-1,areaIdent:r,sideIdent:n,text:a="",treeArrow:c,tableOptions:h,checkedType:d=void 0,sortState:u,checkboxAriaLabel:f,firstDataColumnIndex:g=0}=e,p=h==null?void 0:h.treeOptions,m=h==null?void 0:h.showCheckboxWihoutExtraColumn,b=this.domService.createElement("div");this.domService.addClass(b,"ge-table-col-div"),m&&this.domService.addClass(b,"ge-with-checkbox"),this.domService.addClass(b,`ge-table-col-div-${s.index}`),this.domService.setAttribute(b,"data-col-index",`${s.index}`),this.domService.setAttribute(b,"data-row-index",`${o}`),this.domService.setAttribute(b,"data-area",`${r}`);const y=((s==null?void 0:s.index)??0)%2===0?"even":"odd";if(r==="body"&&n==="center"&&this.domService.addClass(b,`ge-table-column-${y}`),this.domService.setStyle(b,"display","clip"),this.domService.setStyle(b,"position","absolute"),this.domService.setStyle(b,"left",`${s.left}px`),this.domService.setStyle(b,"top",`${s.top}px`),this.domService.setStyle(b,"width",`${s.width}px`),this.domService.setStyle(b,"height",`${s.height}px`),c&&c!=="none"&&(this.domService.addClass(b,"ge-table-col-tree"),this.addArrowDiv(b,c,p,o,i,r)),m&&i===g&&d&&this.addCheckboxToDiv(b,d,r,o,f),a){const w=c!=="none"&&i===g;this.addLabelDiv(b,a,w,o,i,r)}return u&&this.addSortedIcon(b,u,h==null?void 0:h.sortedOptions,i),this.domService.appendChild(t,b),b}addCheckboxToDiv(e,t,s,o,i){const r=this.domService.createElement("div"),n=this.domService.createElement("input");return this.domService.setAttribute(n,"type","checkbox"),this.domService.setAttribute(n,"data-area",`${s}`),this.domService.setAttribute(n,"data-row-index",`${o}`),this.domService.setAttribute(n,"data-input-type","checkbox"),this.domService.setAttribute(n,"tabindex","-1"),t==="full"&&(this.domService.setAttribute(n,"checked",""),n.checked=!0),t==="semi"&&(n.indeterminate=!0),this.domService.addClass(n,"ge-table-row-checkbox"),i&&this.domService.setAttribute(n,"aria-label",i),this.domService.appendChild(r,n),this.domService.setStyle(r,"display","inline"),this.domService.setStyle(r,"width","inherit"),this.domService.setAttribute(r,"data-row-index",`${o}`),this.domService.appendChild(e,r),r}addLabelDiv(e,t="",s=!1,o=-1,i=-1,r="body"){const n=this.domService.createElement("div");if(this.domService.addClass(n,"ge-table-label-div"),this.domService.setStyle(n,"position","relative"),this.domService.setStyle(n,"background","transparent"),this.domService.setStyle(n,"width","100%"),this.domService.setStyle(n,"height","100%"),this.domService.setAttribute(n,"data-row-index",`${o}`),this.domService.setAttribute(n,"data-col-index",`${i}`),this.domService.setAttribute(n,"data-area",`${r}`),t)if(s){const a=this.domService.createText(t);this.domService.appendChild(n,a)}else{const a=this.domService.createElement("div");this.domService.appendChild(n,a);const c=this.domService.createText(t);this.domService.addClass(a,"ge-table-label"),this.domService.appendChild(a,c),this.domService.setAttribute(a,"data-row-index",`${o}`),this.domService.setAttribute(a,"data-col-index",`${i}`),this.domService.setAttribute(a,"data-area",`${r}`)}return this.domService.appendChild(e,n),n}addSortedIcon(e,t="",s=new Ps,o=-1){const i=this.domService.createElement("div");this.domService.addClass(i,"ge-table-sorted-icon-div"),this.setAriaHidden(i),this.domService.setStyle(i,"position","absolute"),this.domService.setStyle(i,"top","0"),this.domService.setStyle(i,"right","0"),this.domService.setStyle(i,"width","20px"),this.domService.setStyle(i,"background","transparent"),this.domService.setStyle(i,"cursor","pointer"),this.domService.setAttribute(i,"data-col-index",`${o}`),this.domService.setAttribute(i,"data-area","header");let r;t==="asc"?r=s.iconAsc:t==="desc"?r=s.iconDesc:r=s.iconPlaceholder;const n=r.content,a=this.domService.createText(n);this.domService.appendChild(i,a),r.style&&this.applyStyleString(i,r.style);for(const c of r.classes)this.domService.addClass(i,c);return this.domService.appendChild(e,i),i}addArrowDiv(e,t="none",s=new Fs,o=-1,i=-1,r="body"){const n=this.domService.createElement("div");this.domService.addClass(n,"ge-table-tree-arrow-div"),this.setAriaHidden(n),this.domService.setStyle(n,"display","inline-block"),this.domService.setStyle(n,"position",""),this.domService.setStyle(n,"width","20px"),this.domService.setStyle(n,"background","transparent"),this.domService.setStyle(n,"cursor","pointer"),this.domService.setAttribute(n,"data-row-index",`${o}`),this.domService.setAttribute(n,"data-col-index",`${i}`),this.domService.setAttribute(n,"data-area",`${r}`);let a;t==="expanded"?a=s.arrowExpanded:t==="collapsed"?a=s.arrowCollapsed:a=s.arrowPlaceholder;const c=a.content,h=this.domService.createText(c);this.domService.appendChild(n,h),a.style&&this.applyStyleString(n,a.style);for(const d of a.classes)this.domService.addClass(n,d);return this.domService.appendChild(e,n),n}addColumnBorderDivs(e,t,s,o,i){if(e.verticalBorderVisible){const r=`ge-table-${o}-${i}-vertical-border`;this.addVerticalBorder(s,t,r)}if(e.horizontalBorderVisible){const r=`ge-table-${o}-${i}-horizontal-border`;this.addHorizontalBorder(s,t,r)}return t}addHorizontalBorder(e,t,s="ge-table-body-center-horizontal-border"){const o=this.domService.createElement("div");return this.domService.addClass(o,s),this.setAriaHidden(o),this.domService.setStyle(o,"display","clip"),this.domService.setStyle(o,"position","absolute"),this.domService.setStyle(o,"left",`${e.left}px`),this.domService.setStyle(o,"top",`${e.top}px`),this.domService.setStyle(o,"width",`${e.width}px`),this.domService.setStyle(o,"height","1px"),this.domService.appendChild(t,o),o}addFocusBorderDivs(e,t,s){t={...t,width:t.width+1,height:t.height+1};const o=Et.focusBorderWidthInPx,i=[[t.left,t.top,o,t.height],[t.left+t.width-o,t.top,o,t.height],[t.left,t.top,t.width,o],[t.left,t.top+t.height-o,t.width,o]];for(const[r,n,a,c]of i){const h=this.domService.createElement("div");this.domService.addClass(h,"ge-table-focus-border"),this.setAriaHidden(h),this.domService.setStyle(h,"display","clip"),this.domService.setStyle(h,"position","absolute"),this.domService.setStyle(h,"left",`${r}px`),this.domService.setStyle(h,"top",`${n}px`),this.domService.setStyle(h,"width",`${a}px`),this.domService.setStyle(h,"height",`${c}px`),this.domService.setStyle(h,"z-index","9999"),this.applyStyle(h,s),this.domService.appendChild(e,h)}return e}addVerticalBorder(e,t,s="ge-table-body-center-vertical-border"){const o=this.domService.createElement("div");return this.domService.addClass(o,s),this.setAriaHidden(o),this.domService.setStyle(o,"display","clip"),this.domService.setStyle(o,"position","absolute"),this.domService.setStyle(o,"left",`${e.left}px`),this.domService.setStyle(o,"top",`${e.top}px`),this.domService.setStyle(o,"width","1px"),this.domService.setStyle(o,"height",`${e.height}px`),this.domService.appendChild(t,o),o}addDiv(e,t,s=""){const o=this.domService.createElement("div");return s&&this.domService.addClass(o,s),this.setAriaHidden(o),this.domService.setStyle(o,"display","clip"),this.domService.setStyle(o,"position","absolute"),this.domService.setStyle(o,"left",`${t.left}px`),this.domService.setStyle(o,"top",`${t.top}px`),this.domService.setStyle(o,"width",`${t.width}px`),this.domService.setStyle(o,"height",`${t.height}px`),this.domService.appendChild(e,o),o}applyStyleString(e,t){const s=t.split(";").map(o=>o.trim()).filter(o=>o);for(const o of s){const[i,r]=o.split(":");this.domService.setStyle(e,i.trim(),r.trim())}}getDivOrCreateDiv(e,t){let s=t.cache[e];return s?(s.innerText="",s):(s=this.domService.createElement("div"),t.cache[e]=s,s)}};Et.focusBorderWidthInPx=2;let ft=Et;const it=l=>l==="header"?"header":l==="footer"?"footer":"body";class gt{constructor(e,t){if(this.rowIdx=-1,this.colIdx=-1,this.action=null,this.inputType=null,this.className="",e!==null&&(e instanceof HTMLDivElement||e instanceof HTMLSpanElement||e instanceof HTMLInputElement)){this.className=e.className,this.action=e.getAttribute("data-ge-action"),this.inputType=e.getAttribute("data-input-type"),this.rowIdx=Number(e.getAttribute("data-row-index")),this.colIdx=Number(e.getAttribute("data-col-index"));const s=e.getAttribute("data-area");if(s&&(this.areaIdent=it(s),this.areaModel=t.tableModel.getAreaModel(this.areaIdent),this.row=this.areaModel.getRowByIndex(this.rowIdx)),e instanceof HTMLInputElement){const o=e;this.value=o.value}}}}class Vo{constructor(e){this.tableScope=e,this.doubleClickDelay=500,this.lastClickedCellKey="",this.mouseDown=!1,this.repaintAfterMouseUp=!1,this.dragging=!1,this.lastClicked=0;const t=this.tableScope.listenerAbortController.signal;this.tableScope.hostElement.addEventListener("click",this.onHostElementClicked.bind(this),{signal:t}),this.tableScope.hostElement.addEventListener("dblclick",this.onHostElementDblClicked.bind(this),{signal:t}),this.tableScope.hostElement.addEventListener("mousedown",this.onMouseDown.bind(this),{signal:t}),this.tableScope.hostElement.addEventListener("mousemove",this.onMouseMove.bind(this),{signal:t}),this.tableScope.hostElement.addEventListener("mouseup",this.onMouseUp.bind(this),{signal:t}),this.tableScope.hostElement.addEventListener("contextmenu",this.onContextmenu.bind(this),{signal:t}),this.tableScope.hostElement._MouseHandler="true",this.tableScope.scrollViewport.addEventListener("scroll",this.tableScope.adjustAfterScrolling.bind(this.tableScope),{signal:t}),this.tableScope.scrollViewport.addEventListener("wheel",this.tableScope.onWheel.bind(this.tableScope),{passive:!1,signal:t}),[window,this.tableScope.hostElement].forEach(s=>s.addEventListener("resize",this.tableScope.adjustContainersAndRows.bind(this.tableScope),{signal:t}))}onContextmenu(e){if(this.isBlocked(e)||!(e instanceof MouseEvent))return;this.mouseEvent=e;const t=this.tableScope.createGeMouseEvent(this.mouseEvent);this.tableScope.contextmenu(t)}onHostElementClicked(e){var n;if(this.isBlocked(e))return;const t=Date.now(),s=this.tableScope.getMouseEventTarget(e),o=this.getCellKey(s),i=e.detail>=2||e.detail===0&&t-this.lastClicked<this.doubleClickDelay&&o===this.lastClickedCellKey;this.lastClicked=t,this.lastClickedCellKey=o;const r=new gt(s,this.tableScope);if(i&&(this.reportedDoubleClick={time:t,cellKey:o}),i&&!this.isClickAction(r)){this.publishGeMouseEvent(e,2);return}if(r.action==="toggleExpandCollapseAll")this.tableScope.toggleExpandCollapseAll(!this.tableScope.allExpanded),e.preventDefault(),e.stopPropagation();else if(r.action==="toggleHeaderGroup")this.tableScope.toggleHeaderGroup(r),e.preventDefault(),e.stopPropagation();else if(r.inputType==="checkbox"&&r.areaIdent)this.tableScope.toggleRowCheckbox(r.rowIdx,r.colIdx,r.areaIdent),e.preventDefault(),e.stopPropagation();else if(F(r.row)&&r.areaModel){const a=r.colIdx===this.getArrowColumnIndex()&&e.altKey,c=r.className.includes("ge-table-tree-arrow-div");if(a||c){e.preventDefault(),e.stopPropagation();const h=r.row;this.tableScope.setTreeRowExpanded(h,!h.expanded)}}r.areaIdent==="body"&&((n=this.tableScope.focusModel())==null||n.setFocus(r.rowIdx,r.colIdx)),this.publishGeMouseEvent(e,i?2:1)}getCellKey(e){var s;const t=e instanceof Element?e:null;return(s=t==null?void 0:t.closest)!=null&&s.call(t,"[data-col-index]")?["data-area","data-row-index","data-col-index"].map(o=>{var i;return((i=t.closest("["+o+"]"))==null?void 0:i.getAttribute(o))??""}).join(":"):""}isClickAction(e){return e.action==="toggleExpandCollapseAll"||e.action==="toggleHeaderGroup"||e.inputType==="checkbox"&&!!e.areaIdent||e.className.includes("ge-table-tree-arrow-div")}onHostElementDblClicked(e){var i,r;if(this.isBlocked(e))return;this.lastClicked=Date.now();const t=this.tableScope.getMouseEventTarget(e),s=this.tableScope.createGeMouseEvent(e);if(t instanceof HTMLElement&&!this.isClickAction(new gt(t,this.tableScope))){const n=t.closest("[data-col-index]")??t,a=((i=n.closest("[data-area]"))==null?void 0:i.getAttribute("data-area"))??null,c=it(a),h=Number((r=n.closest("[data-row-index]"))==null?void 0:r.getAttribute("data-row-index")),d=Number(n.getAttribute("data-col-index")),u=this.tableScope.tableModel.getAreaModel(c);if(a&&c==="header")this.tableScope.tableModel.isSortable(d)&&(this.tableScope.clearSelection(),this.tableScope.onHeaderDblClicked(e,h,d));else if(n.getAttribute("data-row-index")){const f=u.getRowByIndex(h);if(a&&c==="body"&&u.isEditable(h,d)&&(this.tableScope.clearSelection(),this.tableScope.initRenderEditor(h,d)),F(f)&&d===this.getArrowColumnIndex()){e.preventDefault(),e.stopPropagation();const g=f;this.tableScope.setTreeRowExpanded(g,!g.expanded)}}}const o=this.reportedDoubleClick;(!o||Date.now()-o.time>this.doubleClickDelay||o.cellKey!==this.getCellKey(t))&&this.publishGeMouseEvent(e,2,s),this.reportedDoubleClick=void 0}publishGeMouseEvent(e,t,s){var i;this.mouseEvent=e,this.geMouseEventOld=(i=this.geMouseEvent)==null?void 0:i.clone(),this.geMouseEvent=s??this.tableScope.createGeMouseEvent(e),this.geMouseEvent&&(this.geMouseEvent.clickCount=t);const o=this.tableScope.onMouseClicked(this.geMouseEvent,this.geMouseEventOld);this.tableScope.publishGeMouseEvent(this.geMouseEvent),o&&!this.isInteractiveCellElement(e.target)&&this.tableScope.debounceRepaint()}isInteractiveCellElement(e){const t=e instanceof Element?e:null,s=t==null?void 0:t.closest('input, select, textarea, button, a[href], [contenteditable]:not([contenteditable="false"])');return!!s&&this.tableScope.hostElement.contains(s)}getArrowColumnIndex(){const e=this.tableScope.tableModel.isRowCheckboxVisible();return this.tableScope.getFirstDataColumnIndex()+(e?1:0)}onMouseDown(e){this.isBlocked(e)||(this.tableScope.cancelPendingRepaint()&&(this.repaintAfterMouseUp=!0),this.dragging||(this.mouseEvent=e,this.startMouseEvent=this.tableScope.createGeMouseEvent(this.mouseEvent),this.tableScope.onMouseDown(this.startMouseEvent),this.mouseDown=!0))}onMouseMove(e){!this.mouseDown&&this.isBlocked(e)||(this.mouseEvent=e,this.mouseDown?(this.dragging||(this.dragging=!0,this.tableScope.setDragging(!0)),requestAnimationFrame(this.mouseDraggingOnFrame.bind(this))):requestAnimationFrame(this.mouseMoveOnFrame.bind(this)))}onMouseUp(e){this.mouseEvent=e,this.repaintAfterMouseUp&&(this.repaintAfterMouseUp=!1,this.tableScope.debounceRepaint()),this.dragging&&requestAnimationFrame(this.mouseDraggingEndOnFrame.bind(this)),this.mouseDown=!1,this.dragging=!1,this.tableScope.setDragging(!1)}mouseDraggingOnFrame(){var e;if(this.mouseEvent){const t=this.tableScope.createGeMouseEvent(this.mouseEvent);(e=this.startMouseEvent)!=null&&e.originalEvent&&(t.draggingX=this.mouseEvent.clientX-this.startMouseEvent.originalEvent.clientX,t.draggingY=this.mouseEvent.clientY-this.startMouseEvent.originalEvent.clientY),this.tableScope.mouseDraggingOnFrame(t,this.startMouseEvent)}}mouseDraggingEndOnFrame(){var e;if(this.mouseEvent){const t=this.tableScope.createGeMouseEvent(this.mouseEvent);(e=this.startMouseEvent)!=null&&e.originalEvent&&(t.draggingX=this.mouseEvent.clientX-this.startMouseEvent.originalEvent.clientX,t.draggingY=this.mouseEvent.clientY-this.startMouseEvent.originalEvent.clientY),this.tableScope.mouseDraggingEndOnFrame(t)}}mouseMoveOnFrame(){if(this.mouseEvent){const e=this.tableScope.createGeMouseEvent(this.mouseEvent);this.tableScope.mouseMove(e)}}isBlocked(e){var t;return((t=this.tableScope.tableOverlay)==null?void 0:t.isEventBlocked(e))??!1}}function Vs(l){return typeof l=="number"&&!Number.isNaN(l)}function mr(l){if(Vs(l))return l;if(l instanceof Date){const e=l.getTime();return Number.isNaN(e)?void 0:e}}function Ls(l,e){const t=l.sum,s=t+e;Number.isFinite(s)&&(l.compensation+=Math.abs(t)>=Math.abs(e)?t-s+e:e-s+t),l.sum=s}function Lo(l){return Number.isFinite(l.sum)?l.sum+l.compensation:l.sum}function Oo(l,e){Ls(l,e.sum),l.compensation+=e.compensation}const br={name:"sum",init:()=>({sum:0,compensation:0}),add:(l,e)=>(Vs(e)&&Ls(l,e),l),merge:(l,e)=>(Oo(l,e),l),result:l=>Lo(l)},wr={name:"count",init:()=>0,add:l=>l+1,merge:(l,e)=>l+e,result:l=>l},yr={name:"avg",init:()=>({sum:0,compensation:0,count:0}),add:(l,e)=>(Vs(e)&&(Ls(l,e),l.count++),l),merge:(l,e)=>(Oo(l,e),l.count+=e.count,l),result:l=>l.count?Lo(l)/l.count:void 0};function ro(l,e){return{name:l,init:()=>({has:!1,value:void 0,key:0}),add:(t,s)=>{const o=mr(s);return o!==void 0&&(!t.has||e(o,t.key))&&(t.has=!0,t.value=s,t.key=o),t},merge:(t,s)=>(s.has&&(!t.has||e(s.key,t.key))&&(t.has=!0,t.value=s.value,t.key=s.key),t),result:t=>t.has?t.value:void 0}}const Cr={name:"countDistinct",init:()=>({values:new Set,dates:new Set}),add:(l,e)=>(e instanceof Date?l.dates.add(e.getTime()):e!=null&&l.values.add(e),l),merge:(l,e)=>(e.values.forEach(t=>l.values.add(t)),e.dates.forEach(t=>l.dates.add(t)),l),result:l=>l.values.size+l.dates.size},xr={name:"first",init:()=>({has:!1,value:void 0}),add:(l,e)=>(l.has||(l.has=!0,l.value=e),l),merge:(l,e)=>(!l.has&&e.has&&(l.has=!0,l.value=e.value),l),result:l=>l.value},Sr={name:"last",init:()=>({has:!1,value:void 0}),add:(l,e)=>(l.has=!0,l.value=e,l),merge:(l,e)=>(e.has&&(l.has=!0,l.value=e.value),l),result:l=>l.value},oe=Object.freeze({sum:br,count:wr,avg:yr,min:ro("min",(l,e)=>l<e),max:ro("max",(l,e)=>l>e),countDistinct:Cr,first:xr,last:Sr});function Bt(l){if(typeof l!="string")return l;const e=oe[l];if(!e)throw new Error(`Unknown aggregator "${l}" – use one of: ${Object.keys(oe).join(", ")}, or an own AggregatorIf.`);return e}function rt(l){if(typeof l=="function")return l;const e=l.split(".");return e.length===1?t=>t==null?void 0:t[l]:t=>{let s=t;for(const o of e){if(s==null)return;s=s[o]}return s}}function nt(l,e){const t=typeof e=="string"||!("aggregator"in e)?{aggregator:e}:e,s=Bt(t.aggregator),o=t.value??l;return{key:l,aggregator:s,value:o,getValue:s===oe.count?void 0:rt(o),format:t.format}}function _t(l,e){const t=e.map(o=>o.aggregator.init()),s=e.length;for(let o=0;o<l.length;o++){const i=l[o];for(let r=0;r<s;r++){const n=e[r];t[r]=n.aggregator.add(t[r],n.getValue?n.getValue(i):i)}}return t}function vr(l,e){const t=e.map(o=>o.aggregator.init()),s=e.length;for(let o=0;o<l;o++)for(let i=0;i<s;i++){const r=e[i];t[i]=r.aggregator.add(t[i],r.getValue?r.getValue(o):o)}return t}function Rr(l,e,t){const s=nt("",{aggregator:t,value:e}),[o]=_t(l,[s]);return s.aggregator.result(o)}function Ar(l,e){const t=Object.keys(e).map(i=>nt(i,e[i])),s=_t(l,t),o={};return t.forEach((i,r)=>o[i.key]=i.aggregator.result(s[r])),o}const Mr=new Intl.NumberFormat("en-US",{maximumFractionDigits:2});function Ne(l){return l==null?"":typeof l=="number"?Number.isFinite(l)?Mr.format(l):String(l):l instanceof Date?Number.isNaN(l.getTime())?"":l.toLocaleDateString("en-US"):String(l)}const Er=new Set(["percentOfColumnTotal","percentOfGrandTotal","percentOfParentTotal","percentOfRowTotal"]),no=new Map,Tr=new Intl.NumberFormat("en-US",{maximumFractionDigits:0});function Be(l){if(!l)return;const e=typeof l=="string"?{mode:l}:l;return No.includes(e.mode)?e:void 0}const No=Object.freeze(["percentOfColumnTotal","percentOfGrandTotal","percentOfParentTotal","percentOfRowTotal","differenceFromPrevious","runningTotal","rank"]);function Os(l){return!!l&&Er.has(l)}function Ht(l,e){const t=Be(e);if(typeof l!="number"||Number.isNaN(l)||!t)return l==null?"":`${l}`;if(t.format)return`${t.format(l)??""}`;if(Os(t.mode)){const s=lo(t.fractionDigits??1);let o=no.get(s);return o||(o=new Intl.NumberFormat("en-US",{style:"percent",minimumFractionDigits:s,maximumFractionDigits:s}),no.set(s,o)),o.format(l)}if(t.mode==="rank")return Tr.format(l);if(t.fractionDigits!==void 0){const s=lo(t.fractionDigits);return new Intl.NumberFormat("en-US",{minimumFractionDigits:s,maximumFractionDigits:s}).format(l)}return Ne(l)}function lo(l){return Math.min(10,Math.max(0,Math.trunc(Number(l)||0)))}function Re(l){return typeof l=="number"&&!Number.isNaN(l)}function $t(l){const e=oe.sum;let t=e.init();for(let s=0;s<l.length;s++)t=e.add(t,l[s]);return e.result(t)??0}function Ns(l,e){const t=l.length,s=new Array(t);switch(e){case"percentOfColumnTotal":case"percentOfGrandTotal":case"percentOfParentTotal":{const o=$t(l);for(let i=0;i<t;i++)s[i]=Ir(l[i],o);return s}case"runningTotal":{const o=oe.sum;let i=o.init();for(let r=0;r<t;r++){const n=l[r];i=o.add(i,n),s[r]=Re(n)?o.result(i):void 0}return s}case"differenceFromPrevious":for(let o=0;o<t;o++){const i=l[o],r=o>0?l[o-1]:void 0;s[o]=Re(i)&&Re(r)?i-r:void 0}return s;case"rank":{const o=[];for(let r=0;r<t;r++)Re(l[r])&&o.push(r);o.sort((r,n)=>l[n]-l[r]);let i=0;for(let r=0;r<o.length;r++)(r===0||l[o[r]]!==l[o[r-1]])&&(i=r+1),s[o[r]]=i;return s}default:for(let o=0;o<t;o++)s[o]=Re(l[o])?l[o]:void 0;return s}}function Ir(l,e){return Re(l)&&e!==0?l/e:void 0}class T{constructor(e,t,s){this.code=e,this.message=t,this.position=s,this.type="FormulaError"}toString(){return this.code}}function v(l){return!!l&&typeof l=="object"&&l.type==="FormulaError"}class Dr{constructor(e){this.owner=e,this.defsLength=-1,this.computing=new Map,this.contexts=new Map,this.aggregates=new Map,this.aggSignal=void 0,this.aggLength=-1}invalidate(){this.getters=void 0,this.showValuesAs=void 0,this.properties=void 0,this.aggregates.clear()}getter(e){if(e!==void 0)return this.lookup().get(e)}hasGetters(){return this.lookup().size>0}isCalculated(e){return this.lookup().has(e)}hasColumn(e){return this.lookup(),this.properties.has(e)}getShowValuesAs(e){if(e!==void 0)return this.lookup(),this.showValuesAs.get(e)}hasShowValuesAs(){return this.lookup(),this.showValuesAs.size>0}get(e,t){const s=this.lookup().get(t);if(!s)return this.owner.readPath(e,t);if(e!=null)return this.call(s,e,t)}aggregate(e,t){var c;if((c=this.computing.get(e))!=null&&c.size)return new T("#CIRC!",`Circular reference: the column "${e}" uses its own aggregate`);const s=this.owner.getAggregationSource();(s.signal!==this.aggSignal||s.length!==this.aggLength)&&(this.aggregates.clear(),this.aggSignal=s.signal,this.aggLength=s.length);const o=Bt(t),i=`${o.name}\0${e}`;if(this.aggregates.has(i))return this.aggregates.get(i);const r=s.rows();let n=o.init(),a;for(let h=0;h<r.length;h++){const d=this.get(r[h],e);if(v(d)&&d.code==="#CIRC!"){a=d;break}n=o.add(n,d)}return a===void 0&&(a=o.result(n)),this.aggregates.set(i,a),a}context(e){let t=this.contexts.get(e);return t||(t={property:e,getValue:(s,o)=>this.get(s,o),hasColumn:s=>this.hasColumn(s),isCalculated:s=>this.isCalculated(s),aggregate:(s,o)=>this.aggregate(s,o)},this.contexts.set(e,t)),t}call(e,t,s){let o=this.computing.get(s);if(o!=null&&o.has(t))return new T("#CIRC!",`Circular reference: the column "${s}" depends on itself`);o||(o=new Set,this.computing.set(s,o)),o.add(t);try{return e(t,this.context(s))}catch(i){return new T("#VALUE!",`valueGetter of "${s}": ${i instanceof Error?i.message.slice(0,200):"failed"}`)}finally{o.delete(t)}}lookup(){const e=this.owner.getColumnDefsForValues()??[];if(this.getters&&this.defsLength===e.length)return this.getters;const t=new Map,s=new Map,o=new Set;for(const i of e){if(!i)continue;o.add(i.property),typeof i.valueGetter=="function"&&t.set(i.property,i.valueGetter);const r=Be(i.showValuesAs);r&&s.set(i.property,r)}return this.getters=t,this.showValuesAs=s,this.properties=o,this.defsLength=e.length,t}}class _e{constructor(){this.type="AggregateCellRenderer"}render(e,t,s,o,i,r,n){const a=i.getTextValueAt(t,s);if(!a)return;const c=n.createElement("div");n.addClass(c,"ge-table-label-div");const h=n.createElement("div");n.addClass(h,"ge-table-label"),n.setAttribute(h,"data-row-index",`${t}`),n.setAttribute(h,"data-col-index",`${s}`),n.setAttribute(h,"data-area",o),n.appendChild(h,n.createText(a)),n.appendChild(c,h),n.appendChild(e,c)}}class Gt{constructor(e,t=[],s=-1){this.areaIdent=e,this.columnDefs=t,this.defaultRowHeight=s,this.rowSelectionModel=void 0,this.yPositions=[],this.cellRenderers=t.map(o=>o.rendererMap[e])}getTextValueAt(e,t){return""+this.getValueAt(e,t)}getTooltipAt(e,t){return""}getCellRenderer(e,t){if(t<this.cellRenderers.length)return this.cellRenderers[t]}getColspanAt(e,t){return 0}getCustomClassesAt(e,t){return[]}getCustomStyleAt(e,t){}getRowspanAt(e,t){return 0}getRowByIndex(e){}isRowCheckable(e){return!0}isRowChecked(e){var s;const t=this.getRowByIndex(e);return(s=this.rowSelectionModel)==null?void 0:s.isRowChecked(t)}setRowChecked(e,t){if(this.rowSelectionModel){const s=this.getRowByIndex(e);this.rowSelectionModel.checkRow(s,t)}}getMaxColspan(){return 31}getMaxRowspan(){return 31}getYPosByRowIndex(e){return this.defaultRowHeight>0?this.defaultRowHeight*e:this.yPositions[e]}init(){!this.yPositions.length&&this.getRowCount()!==void 0&&this.defaultRowHeight===-1&&this.calcYPositions()}isFilterable(){return this.areaIdent==="body"}doSort(e){return!1}sort(e){}isEditable(e,t){var o,i;const s=(o=this.columnDefs)==null?void 0:o[t];return this.areaIdent==="body"&&(s!=null&&s.valueGetter)&&!s.valueSetter?!1:((i=s==null?void 0:s.editable)==null?void 0:i.call(s))??!1}setValue(e,t,s){var a;const o=(a=this.columnDefs[t])==null?void 0:a.editInputPipe;o&&(s=o(s,e,t));const i=this.getRowByIndex(e),r=this.columnDefs[t];if(this.areaIdent==="body"&&(r!=null&&r.valueGetter))return this.setCalculatedValue(i,r,s);const n=this.columnDefs[t].property;return n.includes(".")?this.setPropertyValue(i,n.split("."),s):(i[n]=s,!0)}isSelectable(e,t){return!0}changeColumnOrder(e,t){this.arrayMove(this.cellRenderers,e,t)}setPropertyValue(e,t,s){const o=t.shift();if(o){const i=e[o];return i&&t.length?this.setPropertyValue(i,t,s):(e[o]=s,!0)}return!1}arrayMove(e,t,s){const o=e.splice(t,1)[0];return e.splice(s,0,o),e}calcYPositions(){const e=this.getRowCount();this.yPositions=new Array(e+1),this.yPositions[0]=0;for(let t=0;t<e;t++)this.yPositions[t+1]=this.getRowHeight(t)+this.yPositions[t]}isCalculatedProperty(e){return this.getColumnValues().isCalculated(e)}getRowValue(e,t){return F(e)&&(e=e.data),this.getColumnValues().get(e,t)}hasDerivedColumns(){const e=this.getColumnValues();return e.hasGetters()||e.hasShowValuesAs()}isDerivedProperty(e){const t=this.getColumnValues();return t.isCalculated(e)||!!t.getShowValuesAs(e)}getColumnValues(){return this.columnValuesInstance??(this.columnValuesInstance=new Dr({getColumnDefsForValues:()=>this.areaIdent==="body"?this.columnDefs:[],readPath:(e,t)=>this.readPropertyPath(e,t),getAggregationSource:()=>this.getAggregationSourceForValues()}))}invalidateColumnValues(){var e;(e=this.columnValuesInstance)==null||e.invalidate()}readPropertyPath(e,t){if(e==null||!t)return;let s=e;for(const o of t.split(".")){if(s==null)return;s=s[o]}return s}getAggregationSourceForValues(){const e=this.getRowCount();return{signal:void 0,length:e,rows:()=>Array.from({length:e},(t,s)=>this.getRowByIndex(s))}}setCalculatedValue(e,t,s){return!t.valueSetter||e===void 0||e===null?!1:(F(e)&&(e=e.data),t.valueSetter(e,s)!==!1)}getCalculatedText(e,t){if(e===void 0)return;const s=this.getColumnValues(),o=s.getShowValuesAs(e),i=s.isCalculated(e);if(i&&v(t))return t.code;if(o)return Ht(t,o);if(i)return t==null?"":`${t}`}getCalculatedRenderer(e){if(e!==void 0&&this.getColumnValues().getShowValuesAs(e))return this.calcTextRenderer??(this.calcTextRenderer=new _e)}addCalculatedClasses(e,t,s){return t!==void 0&&this.getColumnValues().isCalculated(t)&&v(s())?[...e,"ge-table-cell-error"]:e}}class Bs{genericSortComparator(e,t,s){if(typeof e=="number"&&typeof t=="number")return s*(e-t);if(typeof e=="string"&&typeof t=="string")return s*e.localeCompare(t);if(typeof e=="boolean"&&typeof t=="boolean")return s*((e?-1:1)-(t?-1:1));if(e instanceof Date&&t instanceof Date)return s*(e.getTime()-t.getTime());if(e instanceof Array&&t instanceof Array){const o=e,i=t;if(o.length&&i.length)return this.genericSortComparator(o[0],i[0],s)}return s*(""+e).localeCompare(""+t)}}function xe(l,e){return kr(l,e)?l:Array.from(new Set(l)).filter(t=>Number.isInteger(t)&&t>=0&&t<e).sort((t,s)=>t-s)}function kr(l,e){let t=-1;for(const s of l){if(!Number.isInteger(s)||s<=t||s>=e)return!1;t=s}return!0}function _s(l){return l.position==="before"?l.rowIndex:l.rowIndex+1}function ls(l,e){if(!l.length)return-1;const t=_s(e);return t-l.filter(s=>s<t).length}function Bo(l,e,t){const s=xe(e,l.length);if(!s.length)return-1;const o=Math.min(Math.max(0,t),l.length),i=new Uint8Array(l.length);s.forEach(h=>i[h]=1);const r=new Array(s.length);s.forEach((h,d)=>r[d]=l[h]);const n=[];let a=-1;for(let h=0;h<=l.length;h++)h===o&&(a=n.length),h<l.length&&!i[h]&&n.push(l[h]);let c=0;for(let h=0;h<a;h++)l[c++]=n[h];for(const h of r)l[c++]=h;for(let h=a;h<n.length;h++)l[c++]=n[h];return a}function Hs(l){const e=new Set(l);return l.filter(t=>{for(let s=t.parent;s;s=s.parent)if(e.has(s))return!1;return!0})}function $s(l,e){if(!e||!l.length)return!1;const t=new Set(l);for(let s=e;s;s=s.parent)if(t.has(s))return!1;return!0}function _o(l,e,t,s){const o=Hs(e);if(!$s(o,t))return!1;for(const a of o){const c=a.parent?a.parent.children:l,h=(c==null?void 0:c.indexOf(a))??-1;c&&h>-1&&c.splice(h,1)}let i,r,n;s==="inside"?(i=t,t.children=t.children??[],r=t.children,n=r.length,t.expanded=!0):(i=t.parent,r=i?i.children??(i.children=[]):l,n=r.indexOf(t)+(s==="after"?1:0)),r.splice(n,0,...o);for(const a of o)a.parent=i,Ho(a,i?i.deep+1:0);return!0}function Ho(l,e){l.deep=e;for(const t of l.children??[])Ho(t,e+1)}function Wt(l,e,t,s){return l===e&&s.position!=="inside"&&Number.isInteger(s.rowIndex)&&s.rowIndex>=0&&s.rowIndex<l&&xe(t,l).length>0}function Gs(l,e,t,s){if(!Wt(l.length,e.length,t,s))return!1;if(Bo(l,xe(t,l.length),_s(s)),e!==l)for(let o=0;o<l.length;o++)e[o]=l[o];return!0}function Ws(l,e,t,s){if(e<1)return-1;if(s&&s>0)return Math.min(e-1,Math.max(0,Math.floor(l/s)));let o=0,i=e-1;for(;o<i;){const r=o+i+1>>1;t(r)<=l?o=r:i=r-1}return o}class K extends Gt{constructor(e,t,s,o=[],i="ge-selected-row",r="ge-focused-row"){super(e,o,s),this.areaIdent=e,this.rows=t,this.defaultRowHeight=s,this.columnDefs=o,this.selectedRowClass=i,this.focusedRowClass=r,this.sorterService=new Bs,this.showValuesCache=new Map,this._focusedRowIndex=0,this.filteredRows=[...t],this.properties=o.map(n=>n.property)}getFocusedRowIndex(){return this._focusedRowIndex}setFocusedRowIndex(e){this._focusedRowIndex=e}setRows(e){this.rows=e,this.filteredRows=[...e],this.showValuesCache.clear()}filterRowsByPredict(e){this.rows=this.rows.filter(e),this.filteredRows=this.filteredRows.filter(e)}getRowCount(){var e;return((e=this.filteredRows)==null?void 0:e.length)??0}getUnfilteredRowCount(){var e;return((e=this.rows)==null?void 0:e.length)??0}canMoveRows(e,t){return Wt(this.filteredRows.length,this.rows.length,e,t)}moveRows(e,t){const s=Gs(this.filteredRows,this.rows,e,t);return s&&this.invalidateDerivedValues(),s}getValueAt(e,t){const s=this.properties[t];let o=this.filteredRows[e];if(F(o)&&(o=o.data),o){const i=this.getValueByT(o,s),r=this.getColumnValues().getShowValuesAs(s);return r?this.applyShowValuesAs(e,s,i,r):i}return""}getTextValueAt(e,t){const s=this.getValueAt(e,t);return this.getCalculatedText(this.properties[t],s)??""+s}getCellRenderer(e,t){return super.getCellRenderer(e,t)??this.getCalculatedRenderer(this.properties[t])}getTooltipAt(e,t){const s=this.properties[t];if(s!==void 0&&this.getColumnValues().isCalculated(s)){const o=this.getValueAt(e,t);if(v(o))return o.message}return super.getTooltipAt(e,t)}invalidateDerivedValues(e){this.invalidateColumnValues(),this.showValuesCache.clear()}applyShowValuesAs(e,t,s,o){if(v(s))return s;let i=this.showValuesCache.get(t);switch(i||(i={},this.showValuesCache.set(t,i)),o.mode){case"percentOfColumnTotal":case"percentOfGrandTotal":case"percentOfParentTotal":return i.total===void 0&&(i.total=$t(this.filteredRows.map(r=>this.getValueByT(F(r)?r.data:r,t)))),typeof s=="number"&&!Number.isNaN(s)&&i.total!==0?s/i.total:void 0;case"percentOfRowTotal":return s;default:return(!i.values||i.values.length!==this.filteredRows.length)&&(i.values=Ns(this.filteredRows.map(r=>this.getValueByT(F(r)?r.data:r,t)),o.mode)),i.values[e]}}readPropertyPath(e,t){return t.includes(".")?this.getPropertyValue(e,t.split(".")):e[t]}getAggregationSourceForValues(){const e=this.filteredRows;return{signal:e,length:e.length,rows:()=>e.some(t=>F(t))?e.map(t=>F(t)?t.data:t):e}}getFilteredRows(){return this.filteredRows}getAllRows(){return this.rows}findRowFromFilteredRowsByAllCriteria(e,t){return this.getFilteredRows().find(s=>t(e,s))}findRowFromAllRowsByAllCriteria(e,t){return this.getAllRows().find(s=>t(e,s))}getRowHeight(e){return this.defaultRowHeight}getConstantRowHeight(){return this.getRowHeight===K.prototype.getRowHeight&&this.defaultRowHeight>0?this.defaultRowHeight:void 0}getRowByIndex(e){return this.filteredRows[e]}externalFilterChanged(e){this.filteredRows=this.rows?this.rows.filter(e):[],this.showValuesCache.clear()}doSort(e){const t=e.map(({columnIndex:s,sortState:o})=>{const i=o==="asc"?1:o==="desc"?-1:0;return this.genericFlatTableSortComparator(this.properties[s],i)});return this.showValuesCache.clear(),t.length&&(this.filteredRows=this.filteredRows.sort((s,o)=>{for(const i of t){const r=i(s,o);if(r)return r}return 0})),!0}sort(e){this.filteredRows=this.filteredRows.sort(e),this.showValuesCache.clear()}getValueByT(e,t){if(!e||!t)return;const s=this.getColumnValues();return s.getter(t)?s.get(e,t):t.includes(".")?this.getPropertyValue(e,t.split(".")):e[t]}changeColumnOrder(e,t){this.arrayMove(this.properties,e,t),super.changeColumnOrder(e,t)}getCustomClassesAt(e,t){let s=super.getCustomClassesAt(e,t);return s=this.addCalculatedClasses(s,this.properties[t],()=>this.getValueAt(e,t)),this.getRowByIndex(e).selected&&s.push(this.selectedRowClass),this._focusedRowIndex===e&&s.push(this.focusedRowClass),s}genericFlatTableSortComparator(e,t){const s=this.columnDefs.find(r=>r.property===e),o=this.createSortValueReader(e),i=this.getColumnValues().isCalculated(e);return(r,n)=>{const a=o(r),c=o(n);return i&&(a===void 0||c===void 0)?a===c?0:a===void 0?1:-1:s!=null&&s.sortComparator?t*s.sortComparator(a,c,r,n,t):this.sorterService.genericSortComparator(a,c,t)}}createSortValueReader(e){if(!this.getColumnValues().getter(e))return s=>this.getValueByT(s,e);const t=new Map;return s=>{if(t.has(s))return t.get(s);const o=this.getValueByT(s,e),i=v(o)?void 0:o;return t.set(s,i),i}}getPropertyValue(e,t){const s=t.shift(),o=e[s];return o&&t.length?this.getPropertyValue(o,t):o}}class R{constructor(e,t,s,o,i=!1){this.r1=e,this.c1=t,this.r2=s,this.c2=o,this.gammaRange=i}static create(e){return e.gammaRange===void 0&&(e.gammaRange=!1),new R(e.rowIndex1,e.columnIndex1,e.rowIndex2,e.columnIndex2,e.gammaRange)}static singleCell(e,t){return new R(e,t,e,t)}static singleRow(e){return new R(e,0,e,Number.MAX_SAFE_INTEGER)}static singleColumn(e){return new R(0,e,Number.MAX_SAFE_INTEGER,e)}isInRange(e,t){return e>=this.r1&&e<=this.r2&&t>=this.c1&&t<=this.c2}}const Tt=class Tt{aggregate(e,t){const s={count:0,numericCount:0,sum:0,avg:void 0,min:void 0,max:void 0,capped:!1};if(!(t!=null&&t.hasSelection()))return s;const o=e.getBodyModel(),i=o.getRowCount(),r=e.getColumnCount(),n=(t.isAllSelected()?[new R(0,0,i-1,r-1)]:t.getRanges()).map(p=>({r1:Math.max(0,Math.min(p.r1,p.r2)),r2:Math.min(i-1,Math.max(p.r1,p.r2)),columns:this.dataColumns(e,Math.max(0,Math.min(p.c1,p.c2)),Math.min(r-1,Math.max(p.c1,p.c2)))})).filter(p=>p.r2>=p.r1&&p.columns.length);if(n.reduce((p,m)=>p+(m.r2-m.r1+1)*m.columns.length,0)>Tt.maxCells)return s.capped=!0,s;const{sum:c,min:h,max:d}=oe;let u=c.init(),f=h.init(),g=d.init();return n.forEach((p,m)=>{const b=n.slice(0,m);for(let y=p.r1;y<=p.r2;y++)for(const w of p.columns){if(b.length&&b.some(C=>y>=C.r1&&y<=C.r2&&C.columns.includes(w))||!t.isSelected(y,w))continue;s.count++;const S=o.getValueAt(y,w);typeof S=="number"&&!Number.isNaN(S)&&(s.numericCount++,u=c.add(u,S),f=h.add(f,S),g=d.add(g,S))}}),s.numericCount&&(s.sum=c.result(u),s.avg=s.sum/s.numericCount,s.min=h.result(f),s.max=d.result(g)),s}dataColumns(e,t,s){var i;const o=[];for(let r=t;r<=s;r++){const n=e.getColumnDef(r);((i=n==null?void 0:n.isVisible)==null?void 0:i.call(n))===!1||L(n)||Ce(n)||o.push(r)}return o}};Tt.maxCells=1e6;let pt=Tt;function Fr(l){const e=Be(l);if(!e||!Os(e.mode))return;const t=Math.min(10,Math.max(0,Math.trunc(Number(e.fractionDigits??1)||0)));return t?`0.${"0".repeat(t)}%`:"0%"}class N extends Error{constructor(e,t){super(e),this.pos=t}toFormulaError(){return new T("#ERROR!",`${this.message} (at ${this.pos+1})`,this.pos)}}const Pr=["<=",">=","<>","!=","==","+","-","*","/","^","&","=","<",">"],Vr={n:`
|
|
42
|
-
`,t:" ",r:"\r","\\":"\\",'"':'"',"'":"'"};function
|
|
43
|
-
`||o==="\r"){s++;continue}const i=s;if(pe(o)||o==="."&&s+1<t&&pe(l[s+1])){for(;s<t&&pe(l[s]);)s++;if(l[s]===".")for(s++;s<t&&pe(l[s]);)s++;if(l[s]==="e"||l[s]==="E"){let a=s+1;if((l[a]==="+"||l[a]==="-")&&a++,a<t&&pe(l[a]))for(s=a;s<t&&pe(l[s]);)s++}if(s<t&&(as(l[s])||l[s]==="."))throw new N(`Invalid number "${l.slice(i,s+1)}"`,i);const n=l.slice(i,s);e.push({kind:"number",text:n,value:Number(n),pos:i});continue}if(o==='"'||o==="'"){s++;let n="",a=!1;for(;s<t;){const c=l[s];if(c==="\\"){const h=l[s+1];if(h===void 0)break;n+=Vr[h]??h,s+=2;continue}if(c===o){a=!0,s++;break}n+=c,s++}if(!a)throw new N("Unterminated text",i);e.push({kind:"string",text:n,pos:i});continue}if(o==="["){s++;let n="",a=!1;for(;s<t;){const h=l[s];if(h==="\\"&&s+1<t){n+=l[s+1],s+=2;continue}if(h==="]"){a=!0,s++;break}if(h==="[")break;n+=h,s++}if(!a)throw new N("Unterminated field reference, missing ]",i);const c=n.trim();if(!c)throw new N("Empty field reference []",i);e.push({kind:"field",text:c,pos:i});continue}if(as(o)){for(;s<t&&Lr(l[s]);)s++;e.push({kind:"ident",text:l.slice(i,s),pos:i});continue}if(o==="("||o===")"||o===","){e.push({kind:o,text:o,pos:i}),s++;continue}const r=Pr.find(n=>l.startsWith(n,s));if(r){e.push({kind:"op",text:r,pos:i}),s+=r.length;continue}throw new N(`Unexpected character "${o}"`,i)}return e.push({kind:"eof",text:"",pos:t}),e}const qt=1e4,ao=64,co=1e3,Nr={"=":{bp:10,op:"="},"==":{bp:10,op:"="},"<>":{bp:10,op:"<>"},"!=":{bp:10,op:"<>"},"<":{bp:10,op:"<"},"<=":{bp:10,op:"<="},">":{bp:10,op:">"},">=":{bp:10,op:">="},"&":{bp:20,op:"&"},"+":{bp:30,op:"+"},"-":{bp:30,op:"-"},"*":{bp:40,op:"*"},"/":{bp:40,op:"/"},"^":{bp:60,right:!0,op:"^"}},Br=50;class _r{constructor(e){this.tokens=e,this.index=0,this.depth=0,this.operators=0}parse(){if(this.peek().kind==="eof")throw new N("Empty formula",0);const e=this.expression(0),t=this.peek();if(t.kind!=="eof")throw new N(`Unexpected "${t.text}"`,t.pos);return e}peek(){return this.tokens[this.index]}next(){return this.tokens[this.index++]}enter(e){if(++this.depth>ao)throw new N(`Nested too deeply (more than ${ao} levels)`,e)}expression(e){let t=this.prefix();for(;;){const s=this.peek();if(s.kind!=="op")break;const o=Nr[s.text];if(!o||o.bp<=e)break;if(this.next(),++this.operators>co)throw new N(`Too many operators (more than ${co})`,s.pos);this.enter(s.pos);const i=this.expression(o.right?o.bp-1:o.bp);this.depth--,t={kind:"binary",op:o.op,left:t,right:i}}return t}prefix(){const e=this.next();switch(e.kind){case"number":return{kind:"literal",value:e.value};case"string":return{kind:"literal",value:e.text};case"field":return{kind:"field",name:e.text};case"op":if(e.text==="-"||e.text==="+"){this.enter(e.pos);const t=this.expression(Br);return this.depth--,{kind:"unary",op:e.text,operand:t}}throw new N(`Unexpected "${e.text}"`,e.pos);case"(":{this.enter(e.pos);const t=this.expression(0);return this.depth--,this.expect(")","Missing )"),t}case"ident":return this.identifier(e);case"eof":throw new N("Unexpected end of formula",e.pos);default:throw new N(`Unexpected "${e.text}"`,e.pos)}}identifier(e){const t=e.text.toUpperCase();if(this.peek().kind!=="("){if(t==="TRUE")return{kind:"literal",value:!0};if(t==="FALSE")return{kind:"literal",value:!1};throw new N(`Unknown name "${e.text}" – fields are written in brackets: [${e.text}]`,e.pos)}this.next(),this.enter(e.pos);const s=[];if(this.peek().kind!==")")for(;;){if(s.push(this.expression(0)),this.peek().kind===","){this.next();continue}break}return this.expect(")",`Missing ) after the arguments of ${t}`),this.depth--,{kind:"call",name:t,args:s}}expect(e,t){const s=this.peek();if(s.kind!==e)throw new N(t,s.pos);this.next()}}function Hr(l){if(l.length>qt)throw new N(`Formula too long (more than ${qt} characters)`,qt);return new _r(Or(l)).parse()}const $r=/^[+-]?(\d+\.?\d*|\.\d+)(e[+-]?\d+)?$/i;function Ae(l){return l===null||l===""}function mt(l,e,t=!1){if(l==null)return null;switch(typeof l){case"number":return Number.isNaN(l)?null:l;case"string":case"boolean":return l;case"bigint":return Number(l)}if(t&&v(l))return l;if(l instanceof Date){const s=l.getTime();return Number.isNaN(s)?null:s}return new T("#VALUE!",`[${e}] is not a number, text or boolean`)}function B(l){if(typeof l=="number")return l;if(l===null||l==="")return 0;if(typeof l=="boolean")return l?1:0;if(typeof l=="string"){const e=l.trim();if($r.test(e)){const t=Number(e);if(Number.isFinite(t))return t}return new T("#VALUE!",`"${l.length>40?l.slice(0,40)+"…":l}" is not a number`)}return l}function se(l){return typeof l=="string"?l:l===null?"":typeof l=="number"?String(l):typeof l=="boolean"?l?"TRUE":"FALSE":l}function cs(l){if(typeof l=="boolean")return l;if(l===null||l==="")return!1;if(typeof l=="number")return l!==0;if(typeof l=="string"){const e=l.trim().toUpperCase();return e==="TRUE"?!0:e==="FALSE"?!1:new T("#VALUE!",`"${l.length>40?l.slice(0,40)+"…":l}" is not TRUE or FALSE`)}return l}function U(l){return Number.isFinite(l)?l===0?0:l:new T("#NUM!","The result is not a finite number")}function Gr(l,e){if(v(l))return l;if(v(e))return e;if(Ae(l)&&Ae(e))return 0;const t=typeof l=="string"&&!Ae(l),s=typeof e=="string"&&!Ae(e);if(t||s){if(t&&s){const u=l.toLowerCase(),f=e.toLowerCase();return u<f?-1:u>f?1:0}const r=B(l),n=B(e);if(!v(r)&&!v(n))return r-n;const a=se(l),c=se(e),h=a.toLowerCase(),d=c.toLowerCase();return h<d?-1:h>d?1:0}const o=B(l),i=B(e);return o-i}const $o={IF:{min:2,max:3},IFERROR:{min:2,max:2},AND:{min:1,max:255},OR:{min:1,max:255}},Wr={SUM:"sum",AVG:"avg",AVERAGE:"avg",MIN:"min",MAX:"max",COUNT:"count"};function at(l){const e=[];for(const t of l){if(Ae(t))continue;const s=B(t);if(v(s))return s;e.push(s)}return e}function Zt(l){return{min:1,max:1,fn:e=>{const t=B(e[0]);return v(t)?t:U(l(t))}}}function Ur(l,e){const t=Math.trunc(e),s=Math.pow(10,t);if(s===0)return 0;const o=Math.abs(l)*s;if(!Number.isFinite(o))return l;const i=Math.round(o>=1e15?o:Number(o.toPrecision(15)))/s;return l<0?-i:i}const qe={ABS:Zt(Math.abs),FLOOR:Zt(Math.floor),CEILING:Zt(Math.ceil),SQRT:{min:1,max:1,fn:l=>{const e=B(l[0]);return v(e)?e:e<0?new T("#NUM!","SQRT of a negative number"):Math.sqrt(e)}},ROUND:{min:1,max:2,fn:l=>{const e=B(l[0]);if(v(e))return e;const t=l.length>1?B(l[1]):0;return v(t)?t:U(Ur(e,t))}},MOD:{min:2,max:2,fn:l=>{const e=B(l[0]);if(v(e))return e;const t=B(l[1]);return v(t)?t:t===0?new T("#DIV/0!","MOD by zero"):U(e-t*Math.floor(e/t))}},POWER:{min:2,max:2,fn:l=>{const e=B(l[0]);if(v(e))return e;const t=B(l[1]);return v(t)?t:U(Math.pow(e,t))}},SUM:{min:1,max:255,fn:l=>{const e=at(l);return v(e)?e:U(e.reduce((t,s)=>t+s,0))}},AVG:{min:1,max:255,fn:l=>{const e=at(l);return v(e)?e:e.length?U(e.reduce((t,s)=>t+s,0)/e.length):new T("#DIV/0!","AVG of no numbers")}},MIN:{min:1,max:255,fn:l=>{const e=at(l);return v(e)?e:e.length?Math.min(...e):0}},MAX:{min:1,max:255,fn:l=>{const e=at(l);return v(e)?e:e.length?Math.max(...e):0}},COUNT:{min:1,max:255,fn:l=>l.filter(e=>typeof e=="number").length},NOT:{min:1,max:1,fn:l=>{const e=cs(l[0]);return v(e)?e:!e}},CONCAT:{min:1,max:255,fn:l=>{let e="";for(const t of l){const s=se(t);if(v(s))return s;e+=s}return e}},LEN:{min:1,max:1,fn:l=>{const e=se(l[0]);return v(e)?e:e.length}},UPPER:{min:1,max:1,fn:l=>{const e=se(l[0]);return v(e)?e:e.toUpperCase()}},LOWER:{min:1,max:1,fn:l=>{const e=se(l[0]);return v(e)?e:e.toLowerCase()}},TRIM:{min:1,max:1,fn:l=>{const e=se(l[0]);return v(e)?e:e.trim().replace(/\s+/g," ")}},ISBLANK:{min:1,max:1,fn:l=>Ae(l[0])}};qe.AVERAGE=qe.AVG;const zr=new Set(["__proto__","constructor","prototype"]),jr=(l,e)=>Object.prototype.hasOwnProperty.call(l,e);function Kr(l,e,t,s=e.split(".")){if(t!=null&&t.isCalculated(e))return mt(t.getValue(l,e),e,!0);if(s.some(i=>zr.has(i)))return new T("#NAME?",`Unknown field [${e}]`);let o=l;for(let i=0;i<s.length;i++){if(o==null||typeof o!="object")return null;if(!jr(o,s[i]))return i===0&&!(t!=null&&t.hasColumn(e))?new T("#NAME?",`Unknown field [${e}]`):null;o=o[s[i]]}return mt(o,e)}function ho(l,e,t){if(v(e))return e;if(v(t))return t;if(l==="&"){const i=se(e);if(v(i))return i;const r=se(t);return v(r)?r:i+r}if(l==="="||l==="<>"||l==="<"||l==="<="||l===">"||l===">="){const i=Gr(e,t);if(v(i))return i;switch(l){case"=":return i===0;case"<>":return i!==0;case"<":return i<0;case"<=":return i<=0;case">":return i>0;default:return i>=0}}const s=typeof e=="number"?e:B(e);if(v(s))return s;const o=typeof t=="number"?t:B(t);if(v(o))return o;switch(l){case"+":return U(s+o);case"-":return U(s-o);case"*":return U(s*o);case"/":return o===0?new T("#DIV/0!","Division by zero"):U(s/o);default:return U(Math.pow(s,o))}}function Yr(l,e){return l==null?null:typeof l=="number"?Number.isNaN(l)?new T("#NUM!",`${e} returned NaN`):l:typeof l=="string"||typeof l=="boolean"||v(l)?l:l instanceof Date?mt(l,e):new T("#VALUE!",`${e} returned no number, text or boolean`)}function uo(l,e,t){const s=new Array(l.length);for(let o=0;o<l.length;o++){const i=l[o](e,t);if(v(i))return i;s[o]=i}return s}class Xr{constructor(e){this.functions=e}compile(e){const t=this.node(e);return(s,o)=>{try{const i=t(s,o);return typeof i=="number"?U(i):i}catch(i){return new T("#VALUE!",i instanceof Error?i.message.slice(0,200):"Evaluation failed")}}}evaluate(e,t,s){return this.compile(e)(t,s)}node(e){switch(e.kind){case"literal":{const t=e.value;return()=>t}case"field":{const t=e.name,s=t.split(".");return(o,i)=>Kr(o,t,i,s)}case"unary":{const t=this.node(e.operand),s=e.op==="-";return(o,i)=>{const r=t(o,i),n=typeof r=="number"?r:B(r);return v(n)?n:s?-n:n}}case"binary":{const t=this.node(e.left),s=this.node(e.right),o=e.op;return o==="*"||o==="+"||o==="-"?(i,r)=>{const n=t(i,r),a=s(i,r);return typeof n=="number"&&typeof a=="number"?U(o==="*"?n*a:o==="+"?n+a:n-a):ho(o,n,a)}:(i,r)=>ho(o,t(i,r),s(i,r))}case"call":return this.call(e.name,e.args)}}call(e,t){const s=this.functions.get(e);if(s){const a=t.map(c=>this.node(c));return(c,h)=>{const d=uo(a,c,h);if(v(d))return d;try{return Yr(s(...d),e)}catch(u){return new T("#VALUE!",`${e}: ${u instanceof Error?u.message.slice(0,200):"failed"}`)}}}switch(e){case"IF":{const[a,c,h]=t.map(d=>this.node(d));return(d,u)=>{const f=cs(a(d,u));return v(f)?f:f?c(d,u):h?h(d,u):!1}}case"IFERROR":{const[a,c]=t.map(h=>this.node(h));return(h,d)=>{const u=a(h,d);return v(u)?c(h,d):u}}case"AND":case"OR":{const a=e==="AND",c=t.map(h=>this.node(h));return(h,d)=>{for(const u of c){const f=cs(u(h,d));if(v(f))return f;if(a&&!f)return!1;if(!a&&f)return!0}return a}}}const o=Wr[e],i=t[0];if(o&&t.length===1&&i.kind==="field"){const a=i.name;return(c,h)=>{if(!h)return new T("#VALUE!",`${e}([${a}]) needs the rows of a table`);if(!h.hasColumn(a))return new T("#NAME?",`Unknown column [${a}] in ${e}`);const d=h.aggregate(a,o);return d===void 0?o==="avg"?new T("#DIV/0!","AVG of no numbers"):0:mt(d,a,!0)}}const r=qe[e];if(!r){const a=new T("#NAME?",`Unknown function ${e}`);return()=>a}const n=t.map(a=>this.node(a));return(a,c)=>{const h=uo(n,a,c);return v(h)?h:r.fn(h)}}}const Jr=Object.freeze([...Object.keys(qe),...Object.keys($o)].sort());function ze(l,e,t,s){switch(l.kind){case"literal":return;case"field":t.includes(l.name)||t.push(l.name);return;case"unary":return ze(l.operand,e,t,s);case"binary":return ze(l.left,e,t,s)??ze(l.right,e,t,s);case"call":{if(!e.has(l.name)){const o=qe[l.name]??$o[l.name];if(!o)return new T("#NAME?",`Unknown function ${l.name}`);if(l.args.length<o.min||l.args.length>o.max){const i=o.min===o.max?`${o.min}`:o.max>=255?`at least ${o.min}`:`${o.min} to ${o.max}`;return new T("#ERROR!",`${l.name} needs ${i} argument${o.max===1?"":"s"}, got ${l.args.length}`)}["SUM","AVG","AVERAGE","MIN","MAX","COUNT"].includes(l.name)&&l.args.length===1&&l.args[0].kind==="field"&&(s.aggregates=!0)}for(const o of l.args){const i=ze(o,e,t,s);if(i)return i}return}}}function Us(l,e){let t="";const s=new Map;for(const c of Object.keys((e==null?void 0:e.functions)??{})){const h=e.functions[c];typeof h=="function"&&s.set(c.toUpperCase(),h)}let o,i;const r=[],n={aggregates:!1};let a;try{t=typeof l=="string"?l:String(l??"");const c=t.replace(/^\s+/,"");o=Hr(c.startsWith("=")&&!c.startsWith("==")?c.slice(1):t),i=ze(o,s,r,n),i||(a=new Xr(s).compile(o))}catch(c){i=c instanceof N?c.toFormulaError():new T("#ERROR!","Invalid formula")}return i&&(o=void 0,r.length=0),i&&(a=void 0),Object.freeze({source:t,ast:o,error:i,fields:Object.freeze([...r]),usesAggregates:n.aggregates,evaluate:(c,h)=>a?a(c,h):i})}function zs(l,e){const t=typeof l=="string"?Us(l,e):l;return(s,o)=>t.evaluate(s,o)}class Go{constructor(e){this.tableScope=e}updateCells(e,t=!1){this.tableScope.updateCells(e,t)}externalFilterChanged(){this.tableScope.externalFilterChanged()}scrollToPixel(e=0,t=0){this.tableScope.scrollToPixel(e,t)}scrollToIndex(e=0,t=0){this.tableScope.scrollToIndex(e,t)}setHeaderVisible(e=!0){this.tableScope.setHeaderVisible(e)}setColumnVisible(e,t=!0){return this.tableScope.setColumnVisible(e,t)}isColumnVisible(e){var i;const t=this.tableScope.tableModel;if(t.isColumnVisible)return t.isColumnVisible(e);const s=t.getColumnDefs()??[],o=typeof e=="number"?s[e]:typeof e=="string"?s.filter(r=>r.property===e)[0]:e;return o?((i=o.isVisible)==null?void 0:i.call(o))!==!1:typeof e=="number"&&e>=0&&e<t.getColumnCount()}isHeaderVisible(){return this.tableScope.tableModel.isHeaderVisibe()}setFooterVisible(e=!0){this.tableScope.setFooterVisible(e)}isFooterVisible(){return this.tableScope.tableModel.isFooterVisibe()}repaint(){this.tableScope.invalidateAggregates(),this.tableScope.repaint()}destroy(){this.tableScope.destroy()}repaintHard(){this.tableScope.invalidateAggregates(),this.tableScope.repaintHard()}recalcColumnWidths(e){this.tableScope.recalcColumnWidths(e)}clearSelection(){this.tableScope.clearSelection(!0)}setSelectionModel(e,t=!0){this.tableScope.setSelectionModel(e,t)}triggerAction(e){return this.tableScope.onActionTriggered(e)}getShortcutActionMapping(){return this.tableScope.shortcutService.getShortcutActionMapping()}copyToClipboard(){return this.tableScope.copyService.copyToClipboard(this.tableScope.tableModel,this.tableScope.selectionModel(),this.tableScope.focusModel()).then(e=>(this.tableScope.announceCopied(e),e))}announce(e){this.tableScope.announce(e)}showLoadingOverlay(e){this.tableScope.showLoadingOverlay(e)}showNoRowsOverlay(e){this.tableScope.showNoRowsOverlay(e)}hideOverlay(){this.tableScope.hideOverlay()}getOverlayState(){return this.tableScope.getOverlayState()}getState(e){return this.tableScope.stateService.getState(e)}applyState(e,t){this.tableScope.stateService.applyState(e,t)}resetState(){this.tableScope.stateService.resetState()}setCustomState(e){this.tableScope.stateService.setCustomState(e)}setHeaderGroupCollapsed(e,t=!0){return this.tableScope.setHeaderGroupCollapsed(e,t)}getHeaderFocus(){return this.tableScope.getHeaderFocus()}downloadExcel(e="table.xlsx",t=""){var n;const s=[],o=this.tableScope.tableModel,i=[];for(let a=0;a<o.getColumnCount();a++){const c=o.getColumnDef(a);((n=c==null?void 0:c.isVisible)==null?void 0:n.call(c))!==!1&&(L(c)&&!c.options.exported||i.push(a))}const r=["header","body","footer"];for(const a of r){const c=o.getAreaModel(a),h=(c==null?void 0:c.getRowCount())??0;for(let d=0;d<h;d++)s.push(i.map(u=>this.getExportValue(o,a,c,d,u)))}return Promise.resolve(this.tableScope.excelService.downloadExcel(s,e,t))}getExportValue(e,t,s,o,i){const r=e.getColumnDef(i);if(L(r)&&t!=="header")return t!=="body"?"":r.hasDefaultFormat()?r.getRowNumber(o,s):r.getRowNumberText(o,s);const n=s.getValueAt(o,i);if(t!=="header"&&typeof n=="number"&&this.tableScope.excelService.supportsNumberFormats){const a=Ot(r)?r.pivot.value.showValuesAs:t==="body"?r==null?void 0:r.showValuesAs:void 0,c=Fr(a);if(c)return{value:n,numberFormat:c}}return n}getColumnIndex(e){var s,o,i;const t=((o=(s=this.tableScope.tableModel).getColumnDefs)==null?void 0:o.call(s))??[];for(let r=0;r<t.length;r++)if(((i=t[r])==null?void 0:i.property)===e)return r;return-1}getTableScope(){return this.tableScope}getSelectionModel(){return this.tableScope.selectionModel()}getSelectionAggregates(){return new pt().aggregate(this.tableScope.tableModel,this.getSelectionModel())}autoResizeColumns(e=!0){this.tableScope.autoResizeColumns(e)}recalcWrappers(){this.tableScope.recalcWrappers()}setColumnWidth(e,t){this.tableScope.setColumnWidth(e,t)}getTableModel(){return this.tableScope.tableModel}getBodyModel(){return this.tableScope.tableModel.getBodyModel()}setRows(e){var s;const t=this.getBodyModel();t instanceof K?(t.setRows(e),(s=this.tableScope.batchEditService)==null||s.pruneOrphans()):console.warn("setRows<T>(rows: T[]) only works with AreaModelObjectArray<T>, but this body area model is ",typeof t,t)}addRows(e){const t=this.getBodyModel();if(t instanceof K){const s=t;let o=s.getAllRows();s.setRows([...o,...e])}else console.warn("addRows<T>(rows: T[]) only works with AreaModelObjectArray<T>, but this body area model is ",typeof t,t)}addRowsAt(e,t){const s=this.getBodyModel();if(s instanceof K){const o=s;let i=o.getAllRows();o.setRows([...i.slice(0,t),...e,...i.slice(t)])}else console.warn("addRowsAt<T>(rows: T[]) only works with AreaModelObjectArray<T>, but this body area model is ",typeof s,s)}removeRows(e,t=(s,o)=>s===o){const s=this.getBodyModel();if(s instanceof K){const o=s,i=o.getAllRows().filter(r=>!e.some(n=>t(r,n)));o.setRows(i)}else console.warn("removeRows<T>(rows: T[]) only works with AreaModelObjectArray<T>, but this body area model is ",typeof s,s)}findRows(e,t=(s,o)=>s===o){const s=this.getBodyModel();return s instanceof K?s.getAllRows().filter(i=>e.some(r=>t(i,r))):(console.warn("findRows<T>(rows: T[], predicate: (a: T, b: T) => boolean) only works with AreaModelObjectArray<T>, but this body area model is ",typeof s,s),[])}findRowFromFilteredRowsByAllCriteria(e,t){const s=this.getBodyModel();if(s instanceof K)return s.getFilteredRows().find(i=>t(e,i));console.warn("findRowFromFilteredRowsByAllCriteria(...) only works with AreaModelObjectArray<T>, but this body area model is ",typeof s,s)}findRowFromAllRowsByAllCriteria(e,t){const s=this.getBodyModel();if(s instanceof K)return s.getAllRows().find(i=>t(e,i));console.warn("findRowFromAllRowsByAllCriteria(...) only works with AreaModelObjectArray<T>, but this body area model is ",typeof s,s)}updateRows(e,t=(s,o)=>s===o){const s=this.getBodyModel();if(s instanceof K){let i=s.getAllRows();for(const r of i)for(const n of e)if(t(r,n))for(const a of Object.keys(n))r[a]=n[a]}else console.warn("updateRows<T>(rows: T[], predicate: (a: T, b: T) => boolean) only works with AreaModelObjectArray<T>, but this body area model is ",typeof s,s)}sortByColumn(e,t){return this.tableScope.sortByColumn(e,t)}reSort(){this.tableScope.reSort()}expandAll(){this.tableScope.toggleExpandCollapseAll(!0)}collapseAll(){this.tableScope.toggleExpandCollapseAll(!1)}setRowExpanded(e,t){const s=this.tableScope.tableModel.getBodyModel().getRowByIndex(e);return F(s)?this.tableScope.setTreeRowExpanded(s,t):!1}setRowGroupBy(e){return this.tableScope.setRowGroupBy(e)}getRowGroupBy(){const e=this.tableScope.tableModel.getBodyModel();return z(e)?e.getGroupBy():void 0}setPivotConfig(e,t){return this.tableScope.setPivotConfig(e,t)}getPivotConfig(){const e=this.tableScope.tableModel;return ks(e)?e.getPivotConfig():void 0}getRowValue(e,t){const s=this.tableScope.tableModel.getBodyModel();if(typeof s.getRowValue=="function")return s.getRowValue(e,t);const o=F(e)?e.data:e;if(o==null)return;let i=o;for(const r of t.split(".")){if(i==null)return;i=i[r]}return i}setShowValuesAs(e,t){const s=(this.tableScope.tableModel.getColumnDefs()??[]).filter(o=>o.property===e);return!s.length||t!==void 0&&!Be(t)?!1:(s.forEach(o=>o.showValuesAs=t),this.repaint(),!0)}getShowValuesAs(e){var t,s;return(s=(t=this.tableScope.tableModel.getColumnDefs())==null?void 0:t.find(o=>o.property===e))==null?void 0:s.showValuesAs}setColumnFormula(e,t,s){const o=(this.tableScope.tableModel.getColumnDefs()??[]).filter(n=>n.property===e);if(!o.length)return new T("#NAME?",`No column "${e}"`);const i=Us(t,s),r=zs(i);return o.forEach(n=>{n.formula=i.source,n.valueGetter=r}),this.repaint(),i.error}sort(e){this.tableScope.sort(e)}moveRows(e,t){const s=this.tableScope.rowDragService;if(!s)return!1;const o=Array.isArray(e)?e:[e];let i;if(typeof t=="number"){const r=this.tableScope.tableModel.getBodyModel().getRowCount();i=t>=r?{rowIndex:r-1,position:"after"}:{rowIndex:Math.max(0,t),position:"before"}}else i=t;return s.moveRows(o,i,!0)>-1}isRowDragging(){var e;return!!((e=this.tableScope.rowDragService)!=null&&e.isDragging())}cancelRowDrag(){var e;(e=this.tableScope.rowDragService)==null||e.cancel()}applyCellChanges(e,t="api"){return this.tableScope.applyCellChanges(e,t)}fillRange(e,t,s,o="auto"){return this.tableScope.fillRange(e,t,s,o)}isFilling(){var e;return!!((e=this.tableScope.fillHandleService)!=null&&e.isFilling())}cancelFill(){var e;(e=this.tableScope.fillHandleService)==null||e.cancel()}startBatchEdit(){var t;const e=!!((t=this.tableScope.batchEditService)!=null&&t.start());return e&&this.tableScope.repaint(),e}isBatchEditing(){var e;return!!((e=this.tableScope.batchEditService)!=null&&e.isActive())}hasPendingChanges(){var e,t;return(e=this.tableScope.batchEditService)==null||e.pruneOrphans(),!!((t=this.tableScope.batchEditService)!=null&&t.hasPending())}getPendingChanges(){var e;return((e=this.tableScope.batchEditService)==null?void 0:e.getPendingChanges())??[]}commitBatchEdit(){var e;return!!((e=this.tableScope.batchEditService)!=null&&e.commit())}cancelBatchEdit(){var e;(e=this.tableScope.batchEditService)==null||e.cancel()}ensureRowIsVisible(e){return this.tableScope.ensureRowIsVisible(e)}ensureColumnIsVisible(e){return this.tableScope.ensureColumnIsVisible(e)}getDisplayedRowCount(){return this.tableScope.getDisplayedRowCount()}getFirstVisibleRowIndex(){return this.tableScope.getFirstVisibleRowIndex()}getFirstFullVisibleRowIndex(){return this.tableScope.getFirstFullVisibleRowIndex()}getLastVisibleRowIndex(){return this.tableScope.getLastVisibleRowIndex()}getLastFullVisibleRowIndex(){return this.tableScope.getLastFullVisibleRowIndex()}setLoggingActive(e){this.tableScope.loggingActive=e}isLoggingActive(){return this.tableScope.loggingActive}}class q{constructor(e=0,t=0,s=0,o=0,i){this.left=e,this.width=t,this.height=s,this.top=o,this.index=i}}const Xe=class Xe{constructor(e){this.prefix=e}static createPrefix(e){const t=(e??"").trim();return t?`ge-${t.replace(/\s+/g,"_")}`:(Xe.counter++,`ge-t${Xe.counter}`)}cell(e,t,s){return`${this.prefix}-${e}-r${t}-c${s}`}rowGroup(e,t){return`${this.prefix}-rg-${e}-${t}`}liveRegion(){return`${this.prefix}-live`}};Xe.counter=0;let Ze=Xe;class Ut{constructor(){this.loadingText="Loading…",this.noRowsText="No rows to show",this.noMatchesText="No matching rows",this.autoNoRows=!0,this.blockInteractionWhileLoading=!0,this.loadingDelayInMs=0,this.getOverlayElement=void 0}static create(e){const t=new Ut;if(e)for(const s of Object.keys(e))e[s]!==void 0&&(t[s]=e[s]);return t}}function hs(l){return l.manual?l.manual:!l.autoNoRows||l.rowCount!==0?"none":(l.unfilteredRowCount??0)>0?"noMatches":"noRows"}const fo={none:"",loading:"ge-table-overlay-loading",noRows:"ge-table-overlay-no-rows",noMatches:"ge-table-overlay-no-matches"};class Wo{constructor(e,t,s,o=()=>{}){this.dom=t,this.requestUpdate=o,this.shownKind="none",this.shownText="",this.shownBlocking=!1,this.bounds="",this.destroyed=!1,this.options=Ut.create(s),this.element=t.applyStylePosistionAbsolute(t.createDivWithClass("ge-table-overlay",e)),t.setAriaHidden(this.element),t.applyDisplayNoneStyle(this.element),this.contentElement=t.createDivWithClass("ge-table-overlay-content",this.element)}showLoading(e){var o;if(this.destroyed)return;const t=((o=this.manual)==null?void 0:o.kind)==="loading";this.manual={kind:"loading",text:e};const s=this.options.loadingDelayInMs;!t&&s>0&&!this.delayTimeout&&(this.delayTimeout=setTimeout(()=>{this.delayTimeout=void 0,this.requestUpdate()},s)),this.requestUpdate()}showNoRows(e){this.destroyed||(this.clearDelay(),this.manual={kind:"noRows",text:e},this.requestUpdate())}hide(){this.destroyed||!this.manual||(this.clearDelay(),this.manual=void 0,this.requestUpdate())}getState(){return this.shownKind}isBlocking(){return this.shownBlocking}isEventBlocked(e){const t=e.target;return this.shownBlocking&&t instanceof Node&&this.element.contains(t)}update(e,t){var a;if(this.destroyed)return;const s=this.options.autoNoRows,o=this.delayTimeout?hs({rowCount:e,unfilteredRowCount:t,autoNoRows:s}):hs({manual:(a=this.manual)==null?void 0:a.kind,rowCount:e,unfilteredRowCount:t,autoNoRows:s}),i=this.getText(o),r=o==="loading"&&this.options.blockInteractionWhileLoading;if(o===this.shownKind&&i===this.shownText&&r===this.shownBlocking)return;const n=this.shownKind;return this.render(o,i,r),{previous:n,kind:o,text:i}}setBounds(e,t,s,o){const i=`${e},${t},${s},${o}`;this.destroyed||i===this.bounds||(this.bounds=i,this.dom.applyStyle(this.element,{left:`${e}px`,top:`${t}px`,width:`${Math.max(0,s)}px`,height:`${Math.max(0,o)}px`}))}destroy(){this.destroyed||(this.destroyed=!0,this.clearDelay(),this.contentElement.replaceChildren(),this.element.remove(),this.manual=void 0,this.shownKind="none",this.shownBlocking=!1)}getText(e){var s,o;const t=this.options;switch(e){case"loading":return((s=this.manual)==null?void 0:s.text)??t.loadingText;case"noRows":return(((o=this.manual)==null?void 0:o.kind)==="noRows"?this.manual.text:void 0)??t.noRowsText;case"noMatches":return t.noMatchesText;default:return""}}render(e,t,s){const o=this.dom,i=this.element;if(this.shownKind!=="none"&&o.removeClass(fo[this.shownKind],i),this.contentElement.replaceChildren(),e==="none")o.removeClass("ge-table-overlay-visible",i),o.applyDisplayNoneStyle(i);else{o.addClass(`ge-table-overlay-visible ${fo[e]}`,i),o.setStyle(i,"display","flex");const r=this.getOwnElement(e,t);if(r)o.domService.appendChild(this.contentElement,r);else{e==="loading"&&o.createDivWithClass("ge-table-spinner",this.contentElement);const n=o.createDivWithClass("ge-table-overlay-text",this.contentElement);n.textContent=t}}s?o.addClass("ge-table-overlay-blocking",i):o.removeClass("ge-table-overlay-blocking",i),this.shownKind=e,this.shownText=t,this.shownBlocking=s}getOwnElement(e,t){var s,o;try{return(o=(s=this.options).getOverlayElement)==null?void 0:o.call(s,e,t)}catch(i){console.error("TableOverlay: getOverlayElement failed, the built-in content is shown",i);return}}clearDelay(){this.delayTimeout&&(clearTimeout(this.delayTimeout),this.delayTimeout=void 0)}}const It=class It{constructor(e,t,s,o){this.hostElement=e,this.tableModel=t,this.dom=s,this.tableOptions=o,this.scrollTop=0,this.areaBodyWestGeo=new q,this.areaBodyCenterGeo=new q,this.areaBodyEastGeo=new q,this.hostAttributesBefore=new Map;const i=this.hostElement;i.innerText="",this.dom.setAttribute(i,"tabindex","0"),this.ariaIds=new Ze(Ze.createPrefix(i.id)),this.initHostAria(),this.dom.setStyle(this.dom.addClass("ge-table",i),"position","relative"),this.hoverRow=s.applyStylePosistionAbsolute(s.createDivWithClass("ge-table-hover-row",i)),this.hoverColumn=s.applyStylePosistionAbsolute(s.createDivWithClass("ge-table-hover-column",i)),this.draggingColumn=s.applyStylePosistionAbsolute(s.createDivWithClass("ge-table-dragging-column",i)),this.areaHeaderWest=s.appendRelativeChildDiv(s.applyStylePosistionAbsolute(s.createAreaDivWithClass("ge-table-header ge-table-header-west",i,"header","west"))),this.areaHeaderCenter=s.appendRelativeChildDiv(s.applyStylePosistionAbsolute(s.createAreaDivWithClass("ge-table-header ge-table-header-center",i,"header","center"))),this.areaHeaderEast=s.appendRelativeChildDiv(s.applyStylePosistionAbsolute(s.createAreaDivWithClass("ge-table-header ge-table-header-east",i,"header","east"))),this.areaBodyWest=s.appendRelativeChildDiv(s.applyStylePosistionAbsolute(s.createAreaDivWithClass("ge-table-body ge-table-body-west",i,"body","west"))),this.areaBodyEast=s.appendRelativeChildDiv(s.applyStylePosistionAbsolute(s.createAreaDivWithClass("ge-table-body ge-table-body-east",i,"body","east"))),this.areaFooterWest=s.appendRelativeChildDiv(s.applyStylePosistionAbsolute(s.createAreaDivWithClass("ge-table-footer ge-table-footer-west",i,"footer","west"))),this.areaFooterCenter=s.appendRelativeChildDiv(s.applyStylePosistionAbsolute(s.createAreaDivWithClass("ge-table-footer ge-table-footer-center",i,"footer","center"))),this.areaFooterEast=s.appendRelativeChildDiv(s.applyStylePosistionAbsolute(s.createAreaDivWithClass("ge-table-footer ge-table-footer-east",i,"footer","east"))),this.scrollViewport=s.applyStyleOverflowAuto(this.tableOptions.overflowX??"auto",this.tableOptions.overflowY??"auto",s.applyStyleNoPadding(s.applyStylePosistionAbsolute(s.createAreaDivWithClass("ge-table-scroll-viewport",i,"body","center")))),this.contentWrapperDiv=s.applyStyleNoPadding(s.applyStylePosistionRelative(s.createDivWithClass("ge-table-scroll-content-wrapper",this.scrollViewport))),this.contentDiv=s.applyStyleNoPadding(s.applyStylePosistionRelative(s.createDivWithClass("ge-table-scroll-content",this.contentWrapperDiv))),this.areaBodyCenter=s.appendRelativeChildDiv(s.createDivWithClass("ge-table-body-center",this.contentDiv)),this.borderHeaderBottom=s.applyStylePosistionAbsolute(s.createDivWithClass("ge-table-header-border",i)),this.borderFixedWest=s.applyStylePosistionAbsolute(s.createDivWithClass("ge-table-west-fixed-column-border",i)),this.borderFixedEast=s.applyStylePosistionAbsolute(s.createDivWithClass("ge-table-east-fixed-column-border",i)),this.borderFooterTop=s.applyStylePosistionAbsolute(s.createDivWithClass("ge-table-footer-border",i)),[this.hoverRow,this.hoverColumn,this.draggingColumn,this.borderHeaderBottom,this.borderFixedWest,this.borderFixedEast,this.borderFooterTop].forEach(n=>s.setAriaHidden(n)),o!=null&&o.shortcutActionsDisabled||s.setAttribute(this.scrollViewport,"tabindex","-1"),[this.areaHeaderWest,this.areaHeaderCenter,this.areaHeaderEast,this.areaBodyWest,this.areaBodyEast,this.areaFooterWest,this.areaFooterCenter,this.areaFooterEast,this.areaBodyCenter].forEach(n=>s.setAttribute(n.parent,"role","presentation")),s.setAttribute(this.contentWrapperDiv,"role","presentation"),s.setAttribute(this.contentDiv,"role","presentation");const r=[];for(const n of["header","body","footer"])for(const a of["west","center","east"]){const c=this.ariaIds.rowGroup(n,a),h=this.getAreaChild(n,a);s.setAttribute(h,"id",c),s.setAttribute(h,"role","presentation"),r.push(c)}this.setHostAriaAttribute("aria-owns",r.join(" ")),this.tableOverlay=new Wo(i,s,o==null?void 0:o.overlayOptions,()=>this.updateOverlay())}updateOverlay(){}setHostAriaAttribute(e,t){const s=this.hostElement;this.hostAttributesBefore.has(e)||this.hostAttributesBefore.set(e,s.getAttribute(e)),t===void 0?s.hasAttribute(e)&&this.dom.removeAttribute(s,e):s.getAttribute(e)!==t&&this.dom.setAttribute(s,e,t)}restoreHostAriaAttribute(e){const t=this.hostAttributesBefore.get(e)??null;t===null?this.hostElement.hasAttribute(e)&&this.dom.removeAttribute(this.hostElement,e):this.hostElement.getAttribute(e)!==t&&this.dom.setAttribute(this.hostElement,e,t)}removeHostAria(){this.hostAttributesBefore.forEach((e,t)=>{e===null?this.dom.removeAttribute(this.hostElement,t):this.dom.setAttribute(this.hostElement,t,e)}),this.hostAttributesBefore.clear()}initHostAria(){const e=this.tableOptions,t=_(this.tableModel.getAreaModel("body"));this.setHostAriaAttribute("role",t?"treegrid":"grid"),e!=null&&e.ariaLabelledBy?this.setHostAriaAttribute("aria-labelledby",e.ariaLabelledBy):e!=null&&e.ariaLabel&&this.setHostAriaAttribute("aria-label",e.ariaLabel),e!=null&&e.ariaDescribedBy&&this.setHostAriaAttribute("aria-describedby",e.ariaDescribedBy)}getAreaChild(e,t){return{"header-west":this.areaHeaderWest,"header-center":this.areaHeaderCenter,"header-east":this.areaHeaderEast,"body-west":this.areaBodyWest,"body-center":this.areaBodyCenter,"body-east":this.areaBodyEast,"footer-west":this.areaFooterWest,"footer-center":this.areaFooterCenter,"footer-east":this.areaFooterEast}[`${e}-${t}`].child}adjustContainersAndRows(){const e=this.tableModel.getPadding(),t=this.hostElement.clientWidth,s=this.hostElement.clientHeight;this.dom.applyStyle(this.scrollViewport,{width:`${t-e.left}px`,height:`${s-e.top}px`,top:`${e.top}px`,left:`${e.left}px`}),this.scrollTop=this.scrollViewport.scrollTop,this.dom.applyStyle(this.contentDiv,{width:`${this.scrollViewport.clientWidth}px`,height:`${this.scrollViewport.clientHeight}px`,top:`${this.scrollTop}px`,left:`${this.scrollViewport.scrollLeft}px`}),this.areaBodyWestGeo.width=e.left,this.areaBodyWestGeo.height=s-e.top-e.bottom,this.areaBodyWestGeo.top=e.top,this.areaBodyWestGeo.left=0,this.dom.applyStyleInPx(this.areaBodyWest.parent,this.areaBodyWestGeo),this.tableOptions.fixedWestSeparatorBorderVisible&&this.tableModel.getFixedLeftColumnCount()?this.dom.applyDisplayBlockStyle(this.dom.applyStyle(this.borderFixedWest,{width:"1px",height:`${this.areaBodyWestGeo.height}px`,top:`${this.areaBodyWestGeo.top}px`,left:`${this.areaBodyWestGeo.width}px`})):this.dom.applyDisplayNoneStyle(this.borderFixedWest),this.areaBodyEastGeo.width=e.right,this.areaBodyEastGeo.height=s-e.top-e.bottom,this.areaBodyEastGeo.top=e.top,this.areaBodyEastGeo.left=t-e.right,this.dom.applyStyleInPx(this.areaBodyEast.parent,this.areaBodyEastGeo),this.tableOptions.fixedEastSeparatorBorderVisible&&this.tableModel.getFixedRightColumnCount()?this.dom.applyDisplayBlockStyle(this.dom.applyStyle(this.borderFixedEast,{width:"1px",height:`${this.areaBodyEastGeo.height}px`,top:`${this.areaBodyEastGeo.top}px`,left:`${this.areaBodyEastGeo.left}px`})):this.dom.applyDisplayNoneStyle(this.borderFixedEast),this.areaBodyCenterGeo.width=t-e.left-e.right,this.areaBodyCenterGeo.height=s-e.top-e.bottom,this.areaBodyCenterGeo.top=0,this.areaBodyCenterGeo.left=0,this.dom.applyStyleInPx(this.areaBodyCenter.parent,this.areaBodyCenterGeo),this.dom.applyStyle(this.areaHeaderCenter.parent,{width:`${t-e.left-e.right}px`,height:`${e.top}px`,top:"0",left:`${e.left}px`}),this.dom.applyStyle(this.areaHeaderWest.parent,{width:`${e.left}px`,height:`${e.top}px`,top:"0",left:"0"}),this.dom.applyStyle(this.areaHeaderEast.parent,{width:`${e.right}px`,height:`${e.top}px`,top:"0",left:`${t-e.right}px`}),this.tableOptions.headerSeparatorBorderVisible&&this.tableModel.isHeaderVisibe()?this.dom.applyDisplayBlockStyle(this.dom.applyStyle(this.borderHeaderBottom,{width:`${t}px`,height:"1px",top:`${e.top}px`,left:"0px"})):this.dom.applyDisplayNoneStyle(this.borderHeaderBottom),this.dom.applyStyle(this.areaFooterWest.parent,{width:`${e.left}px`,height:`${e.bottom}px`,top:`${s-e.bottom}px`,left:"0"}),this.dom.applyStyle(this.areaFooterCenter.parent,{width:`${t-e.left-e.right}px`,height:`${e.bottom}px`,top:`${s-e.bottom}px`,left:`${e.left}px`}),this.dom.applyStyle(this.areaFooterEast.parent,{width:`${e.right}px`,height:`${e.bottom}px`,top:`${s-e.bottom}px`,left:`${t-e.right}px`}),this.tableOptions.footerSeparatorBorderVisible&&this.tableModel.isFooterVisibe()?this.dom.applyDisplayBlockStyle(this.dom.applyStyle(this.borderFooterTop,{width:`${t}px`,height:"1px",top:`${s-e.bottom}px`,left:"0px"})):this.dom.applyDisplayNoneStyle(this.borderFooterTop),this.tableOverlay.setBounds(0,e.top,Math.min(t,e.left+this.scrollViewport.clientWidth),s-e.top-e.bottom),this.adjustAfterScrolling()}adjustAfterScrolling(){}resetSizeOfWrapperDiv(){const e=`${this.tableModel.getContentWidthInPixel()}px`,t=this.tableModel.getContentHeightInPixel()+1,s=`${Math.min(t,It.maxScrollHeightInPx)}px`;this.dom.setStyle(this.contentWrapperDiv,"width",e),this.dom.setStyle(this.contentWrapperDiv,"height",s)}};It.maxScrollHeightInPx=8e6;let Qe=It;class he{constructor(e="none",t="single"){this.selectionType=e,this.selectionMode=t,this.ranges=[],this.negativeRanges=[],this.allSelected=!1,this.silent=!1,this.listenerArr=[]}getEventSelectionChangedListeners(){return this.listenerArr}addEventSelectionChangedListener(e){this.listenerArr.includes(e)||this.listenerArr.push(e)}removeEventSelectionChangedListener(e){const t=this.listenerArr.indexOf(e,0);t>-1&&this.listenerArr.splice(t,1)}fireChangeEvent(){this.silent||this.listenerArr.forEach(e=>e.onSelectionChanged(this))}firstClick(e,t){this.selectionType==="row"?this.addRange(R.singleRow(e)):this.selectionType==="column"?this.addRange(R.singleColumn(t)):(this.selectionType==="cell"||this.selectionType==="range")&&this.addRange(R.singleCell(e,t))}createSnapshot(){return{ranges:[...this.ranges],negativeRanges:[...this.negativeRanges],allSelected:this.allSelected}}restoreSnapshot(e){this.ranges=[...e.ranges],this.negativeRanges=[...e.negativeRanges],this.allSelected=e.allSelected,this.fireChangeEvent()}getSelectionCount(e,t){let s=0;for(const o of this.ranges)o.isInRange(e,t)&&s++;return this.allSelected&&s++,this.isInNegativeRange(e,t)&&(s=0),s}isInNegativeRange(e,t){for(const s of this.negativeRanges)if(s.isInRange(e,t))return!0;return!1}getRanges(){return this.ranges}clear(){this.ranges=[],this.negativeRanges=[],this.allSelected=!1,this.fireChangeEvent()}hasSelection(){return this.allSelected||!!this.ranges.length}hasNoSelection(){return!this.hasSelection()}getMergedRowIndices(e){const t=e===void 0?void 0:e-1,s=[...this.ranges];this.allSelected&&t!==void 0&&s.push(new R(0,0,t,Number.MAX_SAFE_INTEGER));const o=new Set;for(const i of s){const r=Math.max(i.r1,0),n=t===void 0?i.r2:Math.min(i.r2,t);if(t===void 0&&!(n<Number.MAX_SAFE_INTEGER))continue;const a=this.negativeRanges.filter(c=>he.intersects(c,i));for(let c=r;c<=n;c++)!o.has(c)&&(!a.length||!he.coversColumns(a,c,i.c1,i.c2))&&o.add(c)}return Array.from(o).sort((i,r)=>i-r)}selectAll(){this.selectionType!=="none"&&(this.allSelected=!0,this.negativeRanges=[],this.fireChangeEvent())}isAllSelected(){return this.allSelected}addSelection(e){this.addRange(e)}removeSelection(e){if(this.selectionType==="none")return;let t=e;this.selectionType==="row"?t=new R(e.r1,0,e.r2,Number.MAX_SAFE_INTEGER):this.selectionType==="column"&&(t=new R(0,e.c1,Number.MAX_SAFE_INTEGER,e.c2)),this.negativeRanges.push(t),this.ranges=this.ranges.filter(s=>!this.isCoveredByNegativeRanges(s)),this.fireChangeEvent()}togglePoint(e,t){this.getSelectionCount(e,t)>0?this.removeSelection(R.singleCell(e,t)):this.reselectPoint(e,t)?this.fireChangeEvent():this.addSelection(R.singleCell(e,t))}isSelected(e,t){return this.getSelectionCount(e,t)>0}addRange(e){this.selectionType!=="none"&&(this.allSelected=!1,this.selectionMode==="single"&&(this.ranges=[],this.negativeRanges=[]),this.adjustRangeToSelectionType(e),this.liftNegativeRanges(e),this.ranges.push(e),this.fireChangeEvent())}adjustRangeToSelectionType(e){return this.selectionType==="row"?(e.c1=0,e.c2=Number.MAX_SAFE_INTEGER):this.selectionType==="column"?(e.r1=0,e.r2=Number.MAX_SAFE_INTEGER):this.selectionType==="cell"?(e.r2=e.r1,e.c2=e.c1):this.selectionType,e}reselectPoint(e,t){return this.selectionType==="none"||!this.isInNegativeRange(e,t)||!this.allSelected&&!this.ranges.some(s=>s.isInRange(e,t))?!1:(this.liftNegativeRanges(this.adjustRangeToSelectionType(R.singleCell(e,t))),!0)}liftNegativeRanges(e){if(!this.negativeRanges.length)return;const t=[];for(const s of this.negativeRanges){const o=Math.max(s.r1,e.r1),i=Math.min(s.r2,e.r2),r=Math.max(s.c1,e.c1),n=Math.min(s.c2,e.c2);if(o>i||r>n){t.push(s);continue}s.r1<o&&t.push(new R(s.r1,s.c1,o-1,s.c2,s.gammaRange)),i<s.r2&&t.push(new R(i+1,s.c1,s.r2,s.c2,s.gammaRange)),s.c1<r&&t.push(new R(o,s.c1,i,r-1,s.gammaRange)),n<s.c2&&t.push(new R(o,n+1,i,s.c2,s.gammaRange))}this.negativeRanges=t}isCoveredByNegativeRanges(e){let t=[e];for(const s of this.negativeRanges)if(t=t.flatMap(o=>he.difference(o,s)),!t.length)return!0;return!1}static difference(e,t){const s=Math.max(e.r1,t.r1),o=Math.min(e.r2,t.r2),i=Math.max(e.c1,t.c1),r=Math.min(e.c2,t.c2);if(s>o||i>r)return[e];const n=[];return e.r1<s&&n.push(new R(e.r1,e.c1,s-1,e.c2)),o<e.r2&&n.push(new R(o+1,e.c1,e.r2,e.c2)),e.c1<i&&n.push(new R(s,e.c1,o,i-1)),r<e.c2&&n.push(new R(s,r+1,o,e.c2)),n}static intersects(e,t){return Math.max(e.r1,t.r1)<=Math.min(e.r2,t.r2)&&Math.max(e.c1,t.c1)<=Math.min(e.c2,t.c2)}static coversColumns(e,t,s,o){const i=e.filter(n=>n.r1<=t&&t<=n.r2&&n.c1<=n.c2).sort((n,a)=>n.c1-a.c1);let r=s;for(const n of i){if(n.c1>r)return!1;if(n.c2>=r&&(r=n.c2+1),r>o)return!0}return r>o}}class Uo{constructor(e="none"){this.selectionType=e,this.rowIndex=-1,this.columnIndex=-1,this.changed=!1,this.listenerArr=[]}getEventFocusChangedListeners(){return this.listenerArr}addEventFocusChangedListener(e){this.listenerArr.includes(e)||this.listenerArr.push(e)}removeEventFocusChangedListener(e){const t=this.listenerArr.indexOf(e,0);t>-1&&this.listenerArr.splice(t,1)}fireChangeEvent(){this.listenerArr.forEach(e=>e.onFocusChanged(this))}clearChanged(){this.changed=!1}hasChanged(){return this.changed}clear(){this.rowIndex=-1,this.columnIndex=-1,this.fireChangeEvent()}setFocus(e,t){(this.rowIndex!==e||this.columnIndex!==t)&&(this.rowIndex=e,this.columnIndex=t,this.changed=!0,this.fireChangeEvent())}hasFocus(e,t){return this.rowIndex===e&&this.columnIndex===t}getFocus(){return[this.rowIndex,this.columnIndex]}}class zo{constructor(e,t){this.tableModel=e,this.areaModel=t,this.colAndRowspanRanges=void 0,this.rowCountAtInit=-1}init(){if(this.rowCountAtInit=this.areaModel.getRowCount(),this.areaModel.getMaxColspan()<2&&this.areaModel.getMaxRowspan()<2){this.colAndRowspanRanges=void 0;return}this.colAndRowspanRanges=[];const e=this.areaModel.getRowCount(),t=this.tableModel.getColumnCount();for(let s=0;s<e;s++)for(let o=0;o<t;o++){let i=this.areaModel.getColspanAt(s,o),r=this.areaModel.getRowspanAt(s,o);if(i>1||r>1){i===0&&(i=1),r===0&&(r=1);const n="gammaCells"in this.areaModel;this.colAndRowspanRanges.push(new R(s,o,s+r-1,o+i-1,n))}}}initIfRowCountChanged(){return this.areaModel.getRowCount()===this.rowCountAtInit?!1:(this.init(),!0)}getRanges(){return this.colAndRowspanRanges?this.colAndRowspanRanges:[]}isInRange(e,t){if(this.colAndRowspanRanges){for(const s of this.colAndRowspanRanges)if(s.isInRange(e,t))return!0}return!1}}class V{constructor(e,t,s){this.header=e,this.body=t,this.footer=s}}function et(l){return l!=null&&l.length&&L(l[0])?1:0}class tt{constructor(e,t,s,o){this.headerRowCount=e,this.bodyRowCount=t,this.footerRowCount=s,this.colIndexMap=o}static create(e){var a,c,h;const t=e.isHeaderVisibe()?Math.max(0,((a=e.getAreaModel("header"))==null?void 0:a.getRowCount())??0):0,s=e.isFooterVisibe()?Math.max(0,((c=e.getAreaModel("footer"))==null?void 0:c.getRowCount())??0):0,o=((h=e.getAreaModel("body"))==null?void 0:h.getRowCount())??0,i=e.getColumnCount(),r=new Array(Math.max(0,i));let n=0;for(let d=0;d<i;d++)r[d]=e.getColumnWidth(d)>0?++n:0;return new tt(t,o,s,r)}get rowCount(){return this.bodyRowCount<0?-1:this.headerRowCount+this.bodyRowCount+this.footerRowCount}get colCount(){let e=0;for(const t of this.colIndexMap)t>0&&e++;return e}rowIndex(e,t){return e==="header"?t+1:e==="body"?this.headerRowCount+t+1:this.headerRowCount+Math.max(0,this.bodyRowCount)+t+1}colIndex(e){return this.colIndexMap[e]??0}colSpan(e,t){let s=0;for(let o=e;o<e+t;o++)(this.colIndexMap[o]??0)>0&&s++;return Math.max(1,s)}}class jo{constructor(){this.positions=new WeakMap,this.sizes=new WeakMap}get(e,t){const s=e.getRowByIndex(t);if(!s)return;const o=e.getFilteredFlattenRows();o!==this.displayedRows&&(this.displayedRows=o,this.positions=new WeakMap,this.sizes=new WeakMap);const i=s.parent??e;let r=this.positions.get(i);if(!r){const a=s.parent?e.getDisplayedChildren(s.parent):e.getDisplayedRootRows();r=new Map,a.forEach((c,h)=>r.set(c,h+1)),this.positions.set(i,r),this.sizes.set(i,a.length)}const n=e.hasDisplayedChildren(s);return{level:(s.deep??0)+1,setSize:Math.max(1,this.sizes.get(i)??1),posInSet:r.get(s)??1,expanded:n?!!s.expanded:void 0}}}class ve{static create(e){const t=new ve;if(e)for(const s of Object.keys(e)){const o=e[s];typeof o=="function"&&(t[s]=o)}return t}sorted(e,t){return t==="asc"?`Sorted by ${e}, ascending`:t==="desc"?`Sorted by ${e}, descending`:`Sorting of ${e} removed`}filtered(e){return e===0?"No rows":e===1?"1 row":`${e} rows`}copied(e){return e===1?"1 cell copied":`${e} cells copied`}allSelected(){return"All cells selected"}selectionCleared(){return"Selection cleared"}selectRow(e){return`Select row ${e}`}selectAllRows(){return"Select all rows"}expandGroup(e){return e?`Expand group ${e}`:"Expand group"}collapseGroup(e){return e?`Collapse group ${e}`:"Collapse group"}rowDragStarted(e){return e===1?"Dragging 1 row. Press Escape to cancel.":`Dragging ${e} rows. Press Escape to cancel.`}rowMoved(e,t){return`Row moved to position ${e} of ${t}`}rowMoveNotPossible(){return"Rows cannot be moved while the table is sorted or filtered"}rowDragCancelled(){return"Drag cancelled"}cellsFilled(e){return e===1?"1 cell filled":`${e} cells filled`}fillTooLarge(e){return`Too many cells to fill (at most ${e})`}pendingChanges(e){return e===0?"No unsaved changes":e===1?"1 change not saved":`${e} changes not saved`}changesCommitted(e){return e===1?"1 change saved":`${e} changes saved`}changesDiscarded(){return"Changes discarded"}commitBlocked(e){return e===1?"1 invalid value – nothing saved":`${e} invalid values – nothing saved`}invalidValue(e){return e?`Invalid value: ${e}`:"Invalid value"}}class Ko extends Qe{constructor(e,t,s,o){var r,n,a,c;if(super(e,t,s,o),this.firstVisibleRowIndex=-1,this.lastVisibleRowIndex=-1,this.firstFullVisibleRowIndex=-1,this.lastFullVisibleRowIndex=-1,this.displayedRowCount=0,this.pixelLimitForFullVisible=5,this.loggingActive=!1,this.dragging=!1,this.editing=!1,this.storedColumnWidths=[],this.scrollLeft=0,this.scrollViewportLeft=0,this.scrollFactorY=0,this.scrollFactorX=0,this.cleanupFunctions={header:[],body:[],footer:[]},this.tree=!1,this.colAndRowspanModels=new V,this.draggingTargetColumnIndex=-1,this.contentScrollTop=0,this.removables=[],this.treeAriaInfo=new jo,this.ariaSelectionKind="none",this.renderedSpanCells=new Set,this.adjustingRowNumberWidth=!1,this.rowNumberRemeasureScheduled=!1,this.ariaTexts=ve.create(o==null?void 0:o.ariaTexts),(n=(r=this.tableModel).getSelectionModel)!=null&&n.call(r))this.getSelectionModel=()=>this.tableModel.getSelectionModel();else if((a=this.tableOptions)!=null&&a.getSelectionModel)this.getSelectionModel=this.tableOptions.getSelectionModel;else{const h=new he;this.getSelectionModel=()=>h}if((c=this.tableOptions)!=null&&c.getFocusModel)this.getFocusModel=this.tableOptions.getFocusModel;else{const h=new Uo("cell");this.getFocusModel=()=>h}_(t.getAreaModel("body"))&&(this.tree=!0),["header","body","footer"].forEach(h=>{var d;this.colAndRowspanModels[h]=new zo(t,t.getAreaModel(h)),(d=this.colAndRowspanModels[h])==null||d.init()})}getDomService(){return this.dom}getBodyViewport(){const e=this.hostElement,t=e.getBoundingClientRect();return{top:t.top+e.clientTop+this.tableModel.getPadding().top,height:this.areaBodyCenterGeo.height,left:t.left+e.clientLeft,width:this.scrollViewport.clientWidth,contentScrollTop:this.contentScrollTop}}getBodyCellRectInHost(e,t){const s=this.tableModel,o=s.getBodyModel(),i=s.getPadding(),r=this.hostElement.clientWidth,n=this.hostElement.clientHeight,a=i.top+o.getYPosByRowIndex(e)-this.contentScrollTop,c=this.getColumnLeftInHost(t,s.getXPosByColumnIndex(t)),h=s.getColumnCount(),d=s.getFixedLeftColumnCount(),u=s.getFixedRightColumnCount();let f=i.left,g=r-i.right;return t<d?(f=0,g=i.left):u>0&&t>=h-u&&(f=r-i.right,g=r),{left:c,top:a,width:s.getColumnWidth(t),height:o.getRowHeight(e),clipLeft:f,clipRight:g,clipTop:i.top,clipBottom:n-i.bottom}}getBodyCellAtHostPoint(e,t){var y;const s=this.tableModel,o=s.getBodyModel(),i=o.getRowCount(),r=s.getColumnCount();if(i<1||r<1)return[-1,-1];const n=s.getPadding(),a=this.hostElement.clientWidth,c=this.hostElement.clientHeight-n.top-n.bottom,h=Math.min(Math.max(t-n.top,0),Math.max(0,c-1))+this.contentScrollTop,d=Ws(h,i,w=>o.getYPosByRowIndex(w),(y=o.getConstantRowHeight)==null?void 0:y.call(o)),u=s.getFixedLeftColumnCount(),f=s.getFixedRightColumnCount();let g,p,m;if(u>0&&e<n.left)[g,p,m]=[0,u-1,e];else if(f>0&&e>=a-n.right){const w=r-f;[g,p,m]=[w,r-1,e-(a-n.right)+s.getXPosByColumnIndex(w)]}else{const w=a-n.right,S=Math.min(Math.max(e,n.left),Math.max(n.left,w-1));[g,p,m]=[u,r-f-1,S+this.getContentScrollLeft()]}let b=p;for(let w=g;w<=p;w++)if(m<s.getXPosByColumnIndex(w)+s.getColumnWidth(w)){b=w;break}return[d,Math.min(r-1,Math.max(g,b))]}getScrollerToContentRatioY(){if(!this.isScrollHeightCapped())return 1;const e=this.getContentScrollRangeY(),t=this.getScrollerRangeY();return e>0&&t>0?t/e:1}isEditing(){return this.editing}resetEditorRenderer(){this.editorRenderer=void 0,this.editorRendererRow=-1,this.editorRendererColumn=-1,this.editing=!1}clearSelection(e=!1){if(this.getSelectionModel){const t=this.getSelectionModel();t==null||t.clear(),e&&this.repaint()}}initRenderEditor(e,t){var o;let s=(o=this.tableModel.getColumnDef(t))==null?void 0:o.getEditRenderer;if(s||(s=this.tableOptions.getEditRenderer),s)if(this.editorRenderer=s(e,t),this.editorRenderer){this.editorRendererRow=e,this.editorRendererColumn=t,this.editing=!0,this.repaint();const i=this.hostElement.querySelector("input.ge-table-cell-editor-input");i&&i.focus()}else this.resetEditorRenderer()}repaint(){this.adjustAfterScrolling()}invalidateAggregates(e){var t,s;for(const o of["header","body","footer"])(s=(t=this.tableModel.getAreaModel(o))==null?void 0:t.invalidateDerivedValues)==null||s.call(t,e)}repaintHard(){var e;for(const t of["header","body","footer"])(e=this.colAndRowspanModels[t])==null||e.initIfRowCountChanged();this.tableModel.recalcHeightAndPadding(),this.resetSizeOfWrapperDiv(),this.adjustContainersAndRows(),this.adjustAfterScrolling()}recalcColumnWidths(e){const t=this.getAvailableColumnWidth(e);t>0&&this.tableModel.setParentWidth(t),this.tableModel.init(),this.repaintHard()}getAvailableColumnWidth(e=this.hostElement.clientWidth){const t=Math.max(0,this.scrollViewport.offsetWidth-this.scrollViewport.clientWidth);return Math.max(0,e-this.tableModel.getPadding().left-t)}adjustAfterScrolling(){var i,r,n,a;if(!this.adjustingRowNumberWidth&&this.adjustRowNumberColumnWidth()){this.adjustingRowNumberWidth=!0;try{if((n=(r=(i=this.tableModel).getColumnDefs)==null?void 0:r.call(i))!=null&&n.some(c=>{var h,d;return((h=c.width)==null?void 0:h.unit)==="weight"||((d=c.width)==null?void 0:d.unit)==="%"})){this.tableModel.recalcPadding();const c=this.getAvailableColumnWidth();c>0&&(this.tableModel.setParentWidth(c),this.tableModel.init())}this.tableModel.recalcPadding(),this.resetSizeOfWrapperDiv(),this.adjustContainersAndRows()}finally{this.adjustingRowNumberWidth=!1}return}for(const c of this.removables)c.remove();if(this.hideHoverRow(),this.hideHoverColumn(),this.scrollTop=this.scrollViewport.scrollTop,this.scrollLeft=this.scrollViewport.scrollLeft,this.scrollViewportLeft=this.scrollLeft,this.scrollFactorY=this.scrollTop/(this.scrollViewport.scrollHeight-this.scrollViewport.clientHeight),this.scrollFactorX=this.scrollLeft/(this.scrollViewport.scrollWidth-this.scrollViewport.clientWidth),isNaN(this.scrollFactorY)&&(this.scrollFactorY=0),this.pendingContentScroll){const c=this.getContentScrollRangeY();Math.abs(this.scrollTop-this.pendingContentScroll.scrollTop)<=1&&c>0?this.scrollFactorY=Math.min(1,Math.max(0,this.pendingContentScroll.contentTop/c)):this.pendingContentScroll=void 0}isNaN(this.scrollFactorX)&&(this.scrollFactorX=0);const e=this.hostElement.clientWidth,t=this.hostElement.clientHeight,s=this.areaBodyWest.child.clientWidth,o=this.areaHeaderCenter.child.clientHeight;this.areaHeightsOfRenderPass={body:this.areaBodyCenter.child.clientHeight,footer:this.areaFooterCenter.child.clientHeight,header:o},this.ariaGridInfo=tt.create(this.tableModel),this.ariaSelectionKind=this.getAriaSelectionKind(),this.ariaFocusedCell=void 0,this.renderedSpanCells.clear();try{this.adjustBody(),this.adjustArea("footer"),this.adjustArea("header")}finally{this.areaHeightsOfRenderPass=void 0}this.updateHostAria(),this.tableOptions.tableTopBorderVisible&&this.removables.push(this.dom.addHorizontalBorder(new q(0,e,1,0),this.hostElement,"ge-table-border")),this.tableOptions.tableBottomBorderVisible&&this.removables.push(this.dom.addHorizontalBorder(new q(0,e,1,t-1),this.hostElement,"ge-table-border")),this.tableModel.getFixedLeftColumnCount()>0&&this.removables.push(this.dom.addVerticalBorder(new q(s,1,t,0),this.hostElement,"ge-table-body-west-vertical-border")),this.tableModel.isHeaderVisibe()&&this.removables.push(this.dom.addHorizontalBorder(new q(0,e,1,o),this.hostElement,"ge-table-body-west-vertical-border")),this.updateOverlay(),(a=this.rowNumberWidth)!=null&&a.approximate&&!this.rowNumberRemeasureScheduled&&this.findRowNumberLabel()&&(this.rowNumberRemeasureScheduled=!0,requestAnimationFrame(()=>{this.hostElement.isConnected&&this.repaint()})),this.afterRenderPass()}afterRenderPass(){}updateOverlay(){var r;const e=this.tableOverlay;if(!e)return;const t=this.tableModel.getBodyModel(),s=t.getRowCount(),o=s===0?(r=t.getUnfilteredRowCount)==null?void 0:r.call(t):void 0,i=e.update(s,o);i&&this.onOverlayChanged(i)}onOverlayChanged(e){}checkForScrollPosSaving(){this.afterRenderPass()}updateCells(e,t=!1){const s=this.tableModel.getBodyModel(),o=s.getRowCount(),i=()=>e.forEach(n=>{this.tableModel.getAreaModel(n.area).setValue(n.rowIndex,n.columnIndex,n.value),t||this.rerenderCellContent(n)});if(z(s)?s.batch(i):(i(),!1)){this.invalidateAggregates(),this.repaintHard();return}if(e.length){const n=e[0].area;this.invalidateAggregates(e.every(a=>a.area===n)?{area:n,rowIndices:e.map(a=>a.rowIndex)}:void 0)}e.length&&s.getRowCount()!==o?this.repaintHard():t?this.repaint():e.length&&(this.rerenderDerivedFooterCells(e),this.rerenderGroupRowCells(),this.rerenderCalculatedCells())}rerenderCalculatedCells(){var o;const e=this.tableModel.getBodyModel();if(!((o=e.hasDerivedColumns)!=null&&o.call(e)))return;const t=new Map;this.hostElement.querySelectorAll('div.ge-table-col-div[data-area="body"][data-row-index][data-col-index]').forEach(i=>{var a,c;const r=Number(i.getAttribute("data-row-index")),n=Number(i.getAttribute("data-col-index"));if(!t.has(n)){const h=(a=this.tableModel.getColumnDef(n))==null?void 0:a.property;t.set(n,h!==void 0&&!!((c=e.isDerivedProperty)!=null&&c.call(e,h)))}t.get(n)&&this.rerenderCellContent({area:"body",rowIndex:r,columnIndex:n,value:e.getValueAt(r,n)??""})})}rerenderGroupRowCells(){const e=this.tableModel.getBodyModel();if(!z(e))return;this.hostElement.querySelectorAll('div.ge-table-col-div[data-area="body"][data-row-index][data-col-index]').forEach(s=>{const o=Number(s.getAttribute("data-row-index")),i=Number(s.getAttribute("data-col-index"));!e.isGroupRowIndex(o)||!e.getCellRenderer(o,i)||this.rerenderCellContent({area:"body",rowIndex:o,columnIndex:i,value:e.getValueAt(o,i)})})}rerenderDerivedFooterCells(e){const t=this.tableModel.getAreaModel("footer");if(!(t!=null&&t.invalidateDerivedValues)||e.every(o=>o.area==="footer"))return;this.hostElement.querySelectorAll('div.ge-table-col-div[data-area="footer"][data-row-index][data-col-index]').forEach(o=>{const i=Number(o.getAttribute("data-row-index")),r=Number(o.getAttribute("data-col-index"));this.rerenderCellContent({area:"footer",rowIndex:i,columnIndex:r,value:t.getValueAt(i,r)})})}rerenderCellContent({area:e,rowIndex:t,columnIndex:s,value:o,cssClasses:i}){const r=this.tableModel.getAreaModel(e),n='div[data-col-index="'+s+'"][data-row-index="'+t+'"][data-area="'+e+'"]',a=this.hostElement.querySelector(n);if(a){let c;const h=e==="body"&&this.editorRenderer&&this.editorRendererRow===t&&this.editorRendererColumn===s;let d;if(h?d=this.editorRenderer:d=r.getCellRenderer(t,s),a.innerText="",this.applyCssClasses(a,i),d)c=d.render(a,t,s,e,r,o,this.dom.domService),c&&this.cleanupFunctions[e].push(c);else{const g=`${o}`;this.dom.addLabelDiv(a,g,!1,t,s,e)}const u=r.getCustomClassesAt(t,s);u.length&&this.dom.addClasses(u,a);const f=r.getCustomStyleAt(t,s);if(f)for(const g in f)this.dom.setStyle(a,g,f[g])}}getFirstVisibleRowIndex(){return this.firstVisibleRowIndex}getLastVisibleRowIndex(){return this.lastVisibleRowIndex}getFirstFullVisibleRowIndex(){return this.firstFullVisibleRowIndex}getLastFullVisibleRowIndex(){return this.lastFullVisibleRowIndex}getDisplayedRowCount(){return this.displayedRowCount}storeColumnWidths(){const e=this.tableModel.getColumnDefs();e!=null&&e.length&&(this.storedColumnWidths=e.map((t,s)=>this.tableModel.getColumnWidth(s)))}getAreaAndSideIdentByAttr(e){if(e){const t=this.getStringByAttr(e,"data-area"),s=this.getStringByAttr(e,"data-side");if(s&&t)return[t,s]}return[void 0,void 0]}getArea(e,t){if(e==="header"){if(t==="west")return this.areaHeaderWest;if(t==="center")return this.areaHeaderCenter;if(t==="east")return this.areaHeaderEast}else if(e==="body"){if(t==="west")return this.areaBodyWest;if(t==="center")return this.areaBodyCenter;if(t==="east")return this.areaBodyEast}else if(e==="footer"){if(t==="west")return this.areaFooterWest;if(t==="center")return this.areaFooterCenter;if(t==="east")return this.areaFooterEast}throw Error(`Wrong area identifier: row:${e}, col:${t}`)}snapToDevicePixel(e){const t=typeof window<"u"&&window.devicePixelRatio||1;return Math.round(e*t)/t}isScrollHeightCapped(){return this.tableModel.getContentHeightInPixel()+1>Qe.maxScrollHeightInPx}getContentScrollRangeY(){return this.tableModel.getContentHeightInPixel()-this.areaBodyCenterGeo.height}getScrollerRangeY(){return this.scrollViewport.scrollHeight-this.scrollViewport.clientHeight}onWheel(e){if(e.ctrlKey||!this.isScrollHeightCapped())return;const t=this.getContentScrollRangeY(),s=this.getScrollerRangeY();if(t<=0||s<=0)return;const o=s/t,i=e.deltaMode===1?16:e.deltaMode===2?this.scrollViewport.clientHeight:1;e.preventDefault(),e.deltaY&&(this.scrollViewport.scrollTop+=e.deltaY*i*o),e.deltaX&&(this.scrollViewport.scrollLeft+=e.deltaX*i)}adjustBody(){const e=this.areaBodyCenterGeo.height-this.tableModel.getContentHeightInPixel(),t=this.snapToDevicePixel(this.scrollFactorY*e);this.contentScrollTop=-t,this.dom.setStyle(this.contentDiv,"top",`${this.scrollTop}px`);const s=this.areaHeightsOfRenderPass?this.scrollLeft:this.scrollViewport.scrollLeft;this.dom.setStyle(this.contentDiv,"left",`${s}px`),this.adjustArea("body",t)}getNumberByAttr(e,t){var s;if(e){const o=(s=e.closest("["+t+"]"))==null?void 0:s.getAttribute(t);if(o)return Number(o)}return-1}getStringByAttr(e,t){var s;if(e){const o=(s=e.closest("["+t+"]"))==null?void 0:s.getAttribute(t);if(o)return o}return""}adjustArea(e,t=0){var y,w,S;const s=this.getArea(e,"west"),o=this.getArea(e,"center"),i=this.getArea(e,"east"),r=((y=this.areaHeightsOfRenderPass)==null?void 0:y[e])??o.child.clientHeight;s.child.innerText="",o.child.innerText="",i.child.innerText="";const n=0,a=this.areaBodyCenterGeo.width,c=this.tableModel.getPadding(),h=this.tableModel.getAreaModel(e),d=h.getRowCount();for(;this.cleanupFunctions[e].length;){const C=this.cleanupFunctions[e].shift();C&&C()}if(e==="header"&&!this.tableModel.isHeaderVisibe()||e==="footer"&&!this.tableModel.isFooterVisibe()){this.updateRowGroupRoles(s,o,i);return}let u=t;const f=this.tableModel.getColumnCount(),g=this.tableModel.getFixedRightColumnCount(),p=this.tableModel.getFixedLeftColumnCount();e==="body"&&(this.firstVisibleRowIndex=-1,this.firstFullVisibleRowIndex=-1,this.lastVisibleRowIndex=-1,this.lastFullVisibleRowIndex=-1);let m=0;const b=(w=h.getConstantRowHeight)==null?void 0:w.call(h);if(b!==void 0&&b>0&&u<0){for(m=Math.min(d,Math.floor(-u/b));m>0&&u+m*b>0;)m--;u=u+m*b}for(let C=m;C<d;C++){const A=u,I=C===d-1,M=this.tableModel.getRowHeight(e,C);if(A+M>0){e==="body"&&this.firstVisibleRowIndex===-1&&(this.firstVisibleRowIndex=C,this.firstFullVisibleRowIndex=A<-this.pixelLimitForFullVisible?this.firstVisibleRowIndex+1:this.firstVisibleRowIndex);let E={left:n,width:a,height:M,top:A,index:C},H=this.dom.addRowDiv(o,E,C,e,"center");this.applyRowAria(H,e,h,C);const k=[H],$e=p;this.adjustColumnsToRowParent({areaIdent:e,sideIdent:"center",areaModel:h,geo:E,parent:H,rowIndex:C,columnIndexStart:$e,columnIndexEnd:f-g-1,verticalFixed:!1,lastRowOfModel:I}),c.left>0&&(E={left:n,width:this.areaBodyWestGeo.width,height:M,top:A,index:C},H=this.dom.addRowDiv(s,E,C,e,"west"),this.applyRowAria(H,e,h,C),k.push(H),this.adjustColumnsToRowParent({areaIdent:e,sideIdent:"west",areaModel:h,geo:E,parent:H,rowIndex:C,columnIndexStart:0,columnIndexEnd:$e-1,verticalFixed:!0,lastRowOfModel:I})),c.right>0&&(E={left:n,width:this.areaBodyEastGeo.width,height:M,top:A,index:C},H=this.dom.addRowDiv(i,E,C,e,"east"),this.applyRowAria(H,e,h,C),this.adjustColumnsToRowParent({areaIdent:e,sideIdent:"east",areaModel:h,geo:E,parent:H,rowIndex:C,columnIndexStart:f-g,columnIndexEnd:f-1,verticalFixed:!0,lastRowOfModel:I}));const re=e==="header"&&this.tree&&C===d-1?this.findCellDiv(k,this.getTreeArrowColumnIndex()):void 0;if(re!=null&&re.parentElement){const lt=(parseFloat(re.style.left)||0)+16,Ge=this.dom.applyStyle(this.dom.setAttribute(this.dom.addDiv(re.parentElement,new q(lt,20,20,8)),"data-ge-action","toggleExpandCollapseAll"),{cursor:"pointer"}),ue=this.tableOptions.treeOptions.arrowExpandCollapseAll;if(ue){const We=this.dom.domService.createText(ue.content);this.dom.domService.appendChild(Ge,We),ue.style&&this.dom.applyStyleString(Ge,ue.style)}}}if(u=u+M,u>r){e==="body"&&(this.lastVisibleRowIndex=C,this.lastFullVisibleRowIndex=r-u<-this.pixelLimitForFullVisible?C-1:C,this.displayedRowCount=this.lastFullVisibleRowIndex-this.firstFullVisibleRowIndex+1);break}}if(e==="body"&&this.firstVisibleRowIndex>-1&&this.lastVisibleRowIndex===-1&&(this.lastVisibleRowIndex=d-1,this.lastFullVisibleRowIndex=d-1,this.displayedRowCount=this.lastFullVisibleRowIndex-this.firstFullVisibleRowIndex+1),this.loggingActive&&e==="body"&&console.log("render scope: this.firstVisibleRowIndex <- "+this.firstVisibleRowIndex+`
|
|
41
|
+
`)}}class ls{fixJSON(e){const t=[];let s="",o=!1,i=!1;for(let r=0;r<e.length;r++){const n=e[r];if(s+=n,n==='"'&&!i&&(o=!o),n==="\\"&&!i){i=!0;continue}else i=!1;if(!o){if(n==="{"||n==="[")t.push(n);else if(n==="}"||n==="]"){const l=t.pop();if(n==="}"&&l!=="{"||n==="]"&&l!=="[")throw new Error("Invalid JSON structure detected.")}}}for(;t.length>0;){const r=t.pop();r==="{"?s+="}":r==="["&&(s+="]")}return s}}class Fo{constructor(){this.property="",this.value="",this.path="",this.propertyItem=new Vs("",[new Ps("")])}toString(){var e;return`${this.path} -> : ${((e=this.propertyItem)==null?void 0:e.toString())??""}`}}const cs="Entity";function Lo(a){let e=Po(Vo(a));return e.includes(cs)||(e=e+cs),e}function Po(a){if(!a||a.length===0)return a;const e=["Array","Arr","List","s"];for(const t of e)if(a.endsWith(t))return a.slice(0,-t.length);return a}function Vo(a){return!a||a.length===0?"":a[0].toUpperCase()+a.slice(1)}class Mr{constructor(){this.debugging=!1}json2PropertyType(e,t=""){let s;if(typeof e=="string"){const o=new ls().fixJSON(e);s=this.json2Object(o)}else s=e;return this.object2PropertyType(s,t)}json2Object(e){return JSON.parse(e)}object2PropertyType(e,t=""){const s=this.object2ValueInfos(e,t);this.debugging&&this.logValueInfos(s);const o=this.valueInfos2PropertyType(s);return"name"in o&&(o.name=t),o}json2ValueInfos(e,t=""){let s;if(typeof e=="string"){const o=new ls().fixJSON(e);s=this.json2Object(o)}else s=e;return this.object2ValueInfos(s,t)}object2ValueInfos(e,t=""){const s=this.extractValueInfos(e,t),o=this.mergeValueInfos(s);return o.length>0&&(o[0].propertyItem.propertyName=t),this.debugging&&this.logValueInfos(o),o}getParentPath(e){const t=e.lastIndexOf("/");return t===-1?"":e.substring(0,t)}valueInfos2PropertyType(e){const t=e[0].propertyItem.types[0],s=new Map;for(const o of e)s.set(o.path,o);for(const o of e){const i=this.getParentPath(o.path);if(i){const r=s.get(i);if(r){let n=!1;const l=r.propertyItem.types.filter(c=>!tt.includes(c.type));if(l.length===1){const c=l[0];if(c instanceof ge){n=!0;for(const h of o.propertyItem.types)c.items.push(h)}else c instanceof Q&&(n=!0,c.properties.push(o.propertyItem))}if(!n)for(const c of o.propertyItem.types)r.propertyItem.types.push(c)}}}return t||new Ps("")}logValueInfos(e){for(let t=0;t<e.length;t++){const s=e[t];s.value=null;const o=t.toString().padStart(2,"0");console.info(o+") "+s.toString()+" parent: "+this.getParentPath(s.path))}}mergeValueInfos(e){const t=[];let s=e.length-1;t.push(e[s]);let o=e[s].path;for(let i=s-1;i>=0;i--){if(e[i].path===o){const r=e[i].propertyItem.types[0];e[s].propertyItem.types.some(n=>n.type===r.type)||e[s].propertyItem.types.push(r)}(i===0||e[i].path!==o)&&(s=i,t.push(e[i]),o=e[s].path)}for(const i of e){const r=this.getParentPath(i.path);if(r){const n=this.getParentPath(r);if(n){const l=this.getFirstValueInfoByPath(e,n);if(Array.isArray(l==null?void 0:l.value)){const c=(l==null?void 0:l.value.length)??0,h=this.countPath(e,i.path);c>h&&(i.propertyItem.types.some(d=>d.type===Ve)||i.propertyItem.types.push(new mt(i.property)))}}}}return t.reverse(),t}countPath(e,t){let s=0;for(const o of e)o.path===t&&s++;return s}getFirstValueInfoByPath(e,t){for(let s=e.length-1;s>=0;s--)if(e[s].path===t)return e[s];return null}extractValueInfos(e,t){const s=[],o=(i,r,n)=>{const l=new Fo;let c=r.split("/").pop()||"";if(c==="[]"?c=n:c==="root"&&(c=t),l.property=c,l.value=i,l.path=r,l.propertyItem=this.createPropertyItem(i,l.property),s.push(l),i&&typeof i===Oe&&!Array.isArray(i)){for(const h in i)if(i.hasOwnProperty(h)){const d=r?`${r}/${h}`:h;o(i[h],d,c)}}else Array.isArray(i)&&i.forEach((h,d)=>{const u=`${r}/[]`;o(h,u,c)})};return o(e,"root",t),s.sort((i,r)=>i.path.localeCompare(r.path))}createPropertyItem(e,t){return new Vs(t,[this.createPropertyType(e,t)])}createPropertyType(e,t){return e===null?new To(t):e===void 0?new mt(t):typeof e===Fs?new Io(t):typeof e===Ht&&!isNaN(e)?new Do(t):typeof e===_t?new ko(t):Array.isArray(e)?new ge(t):typeof e===Oe?new Q(t,Lo(t)):new mt(t)}}class Er{constructor(){this.orOperator="|",this.rootPropertyType=null,this.rootName="Root",this.renderTypeScriptInterfacesFifo=[],this.renderTypeScriptInterfacesDone=[]}renderTypeScriptInterfaces(e){"name"in e&&(this.rootName=e.name+""),this.rootPropertyType=e;const t=[];return this.rootPropertyType&&(this.renderTypeScriptInterfacesFifo=[],this.renderTypeScriptInterfacesRecursive(this.rootPropertyType,t),this.renderTypeScriptInterfacesFifoNext(t)),t}renderTypeScriptInterfacesFifoNext(e){var t;for(;(t=this.renderTypeScriptInterfacesFifo)!=null&&t.length;){const s=this.renderTypeScriptInterfacesFifo.shift();s&&this.renderTypeScriptInterfacesRecursive(s,e,s.propertyName)}}renderTypeScriptInterfacesRecursive(e=this.rootPropertyType,t=[],s=this.rootName){if(!e)return t;if(e instanceof ge){for(const o of e.items)if(this.renderTypeScriptInterfacesRecursive(o,t,s),o instanceof Q){const i=o;i!==this.rootPropertyType&&this.renderTypeScriptInterfacesFifo.push(i)}}else if(e instanceof Q){const o=e,i=o.className;if(!this.renderTypeScriptInterfacesDone.includes(i)){this.renderTypeScriptInterfacesDone.push(i),t.push(`export interface ${i} {`);for(const r of o.properties){let n=this.propertyItem2InterfaceDateType(r);n==="[]"?n="any[]":n.startsWith("(")&&n.endsWith(")")&&(n=n.substring(1,n.length-1));const l=this.containsUndefinedPropertyType(r)?"?":"";t.push(" "+r.propertyName+l+": "+n+";");for(const c of r.types)if(c instanceof Q)c!==this.rootPropertyType&&this.renderTypeScriptInterfacesFifo.push(c);else if(c instanceof ge)for(const h of c.items)h instanceof Q&&this.renderTypeScriptInterfacesFifo.push(h)}t.push("}"),t.push("")}}return t}propertyItem2InterfaceDateType(e){var s,o;if(((s=e.types)==null?void 0:s.length)===0)return"any";if(((o=e.types)==null?void 0:o.length)===1)return this.renderType(e.types[0],e);const t=e.types.map(i=>this.renderType(i,e)).filter(i=>i!==Ve).sort((i,r)=>tt.includes(i)?100:tt.includes(r)?-100:i.localeCompare(r)).join(this.orOperator);return t.includes(this.orOperator)?"("+t+")":t}renderType(e,t){if(e instanceof ge){const s=e.items.map(o=>this.renderType(o,t)).join(this.orOperator);return s.includes(this.orOperator)?`(${s})[]`:`${s}[]`}return e instanceof Q?e.className:e.type}containsUndefinedPropertyType(e){for(const t of e.types)if(t.type===Ve)return!0;return!1}}class Ce{constructor(){this.alreadySet=!1}static getInstance(){return Ce.instance||(Ce.instance=new Ce),Ce.instance}setLicenseKey(e){if(e&&!this.alreadySet){const t=document.createElement("meta");t.content="license="+e,t.name="guiexperttable",document.getElementsByTagName("head")[0].appendChild(t),this.alreadySet=!0}}}function L(a){return a&&a.type==="TreeRow"}function B(a){return a&&a.type==="AreaModelTree"}function Os(a){return!!a&&a.type==="CheckboxCellRenderer"}function Se(a){return a&&a.type==="CheckboxColumnDef"}function O(a){return!!a&&a.type==="RowNumberColumnDef"}function Oo(a){return!!a&&a.type==="AreaModelAggregateFooter"}function W(a){return!!a&&a.type==="RowGroup"}function hs(a){return L(a)&&W(a.data)}function X(a){return!!a&&a.kind==="AreaModelRowGroups"}function Fe(a){return!!a&&a.type==="RowGroupColumnDef"}function Bs(a){return!!a&&a.kind==="PivotTableModel"}function ds(a){return!!a&&a.kind==="AreaModelPivot"}function $t(a){return!!a&&a.type==="PivotColumnDef"}function Bo(a,e){var s,o,i;if(a==="rtl")return"rtl";if(a!=="auto"||!e)return"ltr";if(e.isConnected&&typeof getComputedStyle=="function"){const r=getComputedStyle(e).direction;if(r==="rtl"||r==="ltr")return r}return((i=(o=(s=e.closest)==null?void 0:s.call(e,"[dir]"))==null?void 0:o.getAttribute("dir"))==null?void 0:i.toLowerCase())==="rtl"?"rtl":"ltr"}function No(a,e){const t=a.scrollLeft;return e?Math.max(0,-t):t}function Ho(a,e,t){a.scrollLeft=t?-e:e}function wt(a,e){return e&&a!==0?-a:a}function _o(a,e,t){if(!e)return!1;const s=a.scrollWidth-a.clientWidth;return s<=0?!1:t?e>0?a.scrollLeft<0:a.scrollLeft>-s+1:e>0?a.scrollLeft+a.clientWidth<a.scrollWidth-1:a.scrollLeft>0}function $o(a,e,t,s){return s?e+t-a:a-e}function Go(a){return a.split(" ").map(e=>e==="left"?"right":e==="right"?"left":e).join(" ")}class Gt{constructor(e=-1,t=-1,s=-1,o=-1,i,r,n,l=0,c=0,h=0,d=""){this.rowIndex=e,this.rowTop=t,this.columnIndex=s,this.columnLeft=o,this.areaIdent=i,this.sideIdent=r,this.originalEvent=n,this.clickCount=l,this.draggingX=c,this.draggingY=h,this.action=d}clone(){return new Gt(this.rowIndex,this.rowTop,this.columnIndex,this.columnLeft,this.areaIdent,this.sideIdent,this.originalEvent,this.clickCount,this.draggingX,this.draggingY,this.action)}}class se{constructor(e=">",t="",s=[]){this.content=e,this.style=t,this.classes=s}}class Ns{constructor(e=new se(">","transform: rotate(90deg) translate(66%, -66%); transform-origin: 0 0;",["gt-table-tree-arrow-expanded"]),t=new se(">","",["ge-table-tree-arrow-collapsed"]),s=new se(">","color:transparent;",["gt-table-tree-arrow-hidden"]),o=new se("↕","",["gt-table-tree-arrow-expanded-all"])){this.arrowExpanded=e,this.arrowCollapsed=t,this.arrowPlaceholder=s,this.arrowExpandCollapseAll=o}}class Hs{constructor(e=new se("↑","",["ge-header-sorted-asc"]),t=new se("↓","",["ge-header-sorted-desc"]),s=new se("↑","color:transparent;",[])){this.iconAsc=e,this.iconDesc=t,this.iconPlaceholder=s}}const Ft=class Ft{constructor(e){this.domService=e,this.rtl=!1,this.startKey="left",this.endKey="right"}setDirection(e){this.rtl=e==="rtl",this.startKey=this.rtl?"right":"left",this.endKey=this.rtl?"left":"right"}getDirection(){return this.rtl?"rtl":"ltr"}toPhysicalStyleKey(e){if(this.rtl){if(e==="left")return"right";if(e==="right")return"left"}return e}getInlineStart(e){return parseFloat(e.style.getPropertyValue(this.startKey))||0}setStyle(e,t,s){return this.domService.setStyle(e,this.toPhysicalStyleKey(t),s),e}applyStyle(e,t){for(const s in t)this.domService.setStyle(e,this.toPhysicalStyleKey(s),t[s]);return e}applyDisplayNoneStyle(e){return this.domService.setStyle(e,"display","none"),e}applyDisplayBlockStyle(e){return this.domService.setStyle(e,"display","block"),e}applyStyleInPx(e,t){return Object.entries(t).forEach(([s,o])=>this.domService.setStyle(e,this.toPhysicalStyleKey(s),o+"px")),e}applyStylePosistionRelative(e){return this.domService.setStyle(e,"position","relative"),this.domService.setStyle(e,"overflow","clip"),e}applyStylePosistionAbsolute(e){return this.domService.setStyle(e,"position","absolute"),e}applyStyleFullSize(e){return this.domService.setStyle(e,"width","100%"),this.domService.setStyle(e,"height","100%"),e}applyStyleOverflowAuto(e="auto",t="auto",s){return this.domService.setStyle(s,"overflow-x",e),this.domService.setStyle(s,"overflow-y",t),s}applyStyleNoPadding(e){return this.domService.setStyle(e,"padding","0"),this.domService.setStyle(e,"margin","0"),this.domService.setStyle(e,"border","0"),e}appendRelativeChildDiv(e){const t=this.applyStylePosistionRelative(this.applyStyleFullSize(this.applyStyleNoPadding(this.domService.createElement("div"))));return this.domService.appendChild(e,t),this.applyStylePosistionAbsolute(e),{parent:e,child:t,cache:{}}}appendText(e,t){const s=this.domService.createText(t);return this.domService.appendChild(e,s),s}addClass(e,t){return e.includes(" ")?e.split(" ").forEach(s=>this.domService.addClass(t,s)):this.domService.addClass(t,e),t}removeClass(e,t){return e.includes(" ")?e.split(" ").forEach(s=>this.domService.removeClass(t,s)):this.domService.removeClass(t,e),t}addClasses(e,t){if(e)for(const s of e)this.domService.addClass(t,s);return t}setAttribute(e,t,s){return t&&s&&this.domService.setAttribute(e,t,s),e}removeAttribute(e,t){return this.domService.removeAttribute?this.domService.removeAttribute(e,t):e.removeAttribute(t),e}setAriaHidden(e){return this.domService.setAttribute(e,"aria-hidden","true"),e}createAreaDivWithClass(e,t,s,o){const i=this.domService.createElement("div");return this.addClass(e,i),this.domService.setAttribute(i,"data-area",s),this.domService.setAttribute(i,"data-side",o),this.domService.appendChild(t,i),i}createDivWithClass(e,t){const s=this.domService.createElement("div");return this.addClass(e,s),this.domService.appendChild(t,s),s}addRowDiv(e,t,s=-1,o,i,r=""){const n=t.index??-1,l=this.getDivOrCreateDiv(n,e);if(this.domService.addClass(l,"ge-table-row-div"),this.domService.addClass(l,`ge-table-row-div-${t.index}`),o==="body"&&i==="center"){const c=((t==null?void 0:t.index)??0)%2===0?"even":"odd";this.domService.addClass(l,`ge-table-row-${c}`)}if(this.domService.setStyle(l,"display","clip"),this.domService.setStyle(l,"position","absolute"),this.domService.setStyle(l,this.startKey,`${t.left}px`),this.domService.setStyle(l,"top",`${t.top}px`),this.domService.setStyle(l,"width",`${t.width}px`),this.domService.setStyle(l,"height",`${t.height}px`),this.domService.setAttribute(l,"data-row-index",`${s}`),this.domService.setAttribute(l,"data-area",`${o}`),r){const c=this.domService.createText(r);this.domService.appendChild(l,c)}return this.domService.appendChild(e.child,l),l}addColumnDiv(e){const{parent:t,geo:s,rowIndex:o=-1,columnIndex:i=-1,areaIdent:r,sideIdent:n,text:l="",treeArrow:c,tableOptions:h,checkedType:d=void 0,sortState:u,checkboxAriaLabel:f,firstDataColumnIndex:g=0}=e,p=h==null?void 0:h.treeOptions,m=h==null?void 0:h.showCheckboxWihoutExtraColumn,b=this.domService.createElement("div");this.domService.addClass(b,"ge-table-col-div"),m&&this.domService.addClass(b,"ge-with-checkbox"),this.domService.addClass(b,`ge-table-col-div-${s.index}`),this.domService.setAttribute(b,"data-col-index",`${s.index}`),this.domService.setAttribute(b,"data-row-index",`${o}`),this.domService.setAttribute(b,"data-area",`${r}`);const w=((s==null?void 0:s.index)??0)%2===0?"even":"odd";if(r==="body"&&n==="center"&&this.domService.addClass(b,`ge-table-column-${w}`),this.domService.setStyle(b,"display","clip"),this.domService.setStyle(b,"position","absolute"),this.domService.setStyle(b,this.startKey,`${s.left}px`),this.domService.setStyle(b,"top",`${s.top}px`),this.domService.setStyle(b,"width",`${s.width}px`),this.domService.setStyle(b,"height",`${s.height}px`),c&&c!=="none"&&(this.domService.addClass(b,"ge-table-col-tree"),this.addArrowDiv(b,c,p,o,i,r)),m&&i===g&&d&&this.addCheckboxToDiv(b,d,r,o,f),l){const y=c!=="none"&&i===g;this.addLabelDiv(b,l,y,o,i,r)}return u&&this.addSortedIcon(b,u,h==null?void 0:h.sortedOptions,i),this.domService.appendChild(t,b),b}addCheckboxToDiv(e,t,s,o,i){const r=this.domService.createElement("div"),n=this.domService.createElement("input");return this.domService.setAttribute(n,"type","checkbox"),this.domService.setAttribute(n,"data-area",`${s}`),this.domService.setAttribute(n,"data-row-index",`${o}`),this.domService.setAttribute(n,"data-input-type","checkbox"),this.domService.setAttribute(n,"tabindex","-1"),t==="full"&&(this.domService.setAttribute(n,"checked",""),n.checked=!0),t==="semi"&&(n.indeterminate=!0),this.domService.addClass(n,"ge-table-row-checkbox"),i&&this.domService.setAttribute(n,"aria-label",i),this.domService.appendChild(r,n),this.domService.setStyle(r,"display","inline"),this.domService.setStyle(r,"width","inherit"),this.domService.setAttribute(r,"data-row-index",`${o}`),this.domService.appendChild(e,r),r}addLabelDiv(e,t="",s=!1,o=-1,i=-1,r="body"){const n=this.domService.createElement("div");if(this.domService.addClass(n,"ge-table-label-div"),this.domService.setStyle(n,"position","relative"),this.domService.setStyle(n,"background","transparent"),this.domService.setStyle(n,"width","100%"),this.domService.setStyle(n,"height","100%"),this.domService.setAttribute(n,"data-row-index",`${o}`),this.domService.setAttribute(n,"data-col-index",`${i}`),this.domService.setAttribute(n,"data-area",`${r}`),t)if(s){const l=this.domService.createText(t);this.domService.appendChild(n,l)}else{const l=this.domService.createElement("div");this.domService.appendChild(n,l);const c=this.domService.createText(t);this.domService.addClass(l,"ge-table-label"),this.domService.appendChild(l,c),this.domService.setAttribute(l,"data-row-index",`${o}`),this.domService.setAttribute(l,"data-col-index",`${i}`),this.domService.setAttribute(l,"data-area",`${r}`)}return this.domService.appendChild(e,n),n}addSortedIcon(e,t="",s=new Hs,o=-1){const i=this.domService.createElement("div");this.domService.addClass(i,"ge-table-sorted-icon-div"),this.setAriaHidden(i),this.domService.setStyle(i,"position","absolute"),this.domService.setStyle(i,"top","0"),this.domService.setStyle(i,this.endKey,"0"),this.domService.setStyle(i,"width","20px"),this.domService.setStyle(i,"background","transparent"),this.domService.setStyle(i,"cursor","pointer"),this.domService.setAttribute(i,"data-col-index",`${o}`),this.domService.setAttribute(i,"data-area","header");let r;t==="asc"?r=s.iconAsc:t==="desc"?r=s.iconDesc:r=s.iconPlaceholder;const n=r.content,l=this.domService.createText(n);this.domService.appendChild(i,l),r.style&&this.applyStyleString(i,r.style);for(const c of r.classes)this.domService.addClass(i,c);return this.domService.appendChild(e,i),i}addArrowDiv(e,t="none",s=new Ns,o=-1,i=-1,r="body"){const n=this.domService.createElement("div");this.domService.addClass(n,"ge-table-tree-arrow-div"),this.setAriaHidden(n),this.domService.setStyle(n,"display","inline-block"),this.domService.setStyle(n,"position",""),this.domService.setStyle(n,"width","20px"),this.domService.setStyle(n,"background","transparent"),this.domService.setStyle(n,"cursor","pointer"),this.domService.setAttribute(n,"data-row-index",`${o}`),this.domService.setAttribute(n,"data-col-index",`${i}`),this.domService.setAttribute(n,"data-area",`${r}`);let l;t==="expanded"?l=s.arrowExpanded:t==="collapsed"?l=s.arrowCollapsed:l=s.arrowPlaceholder;const c=l.content,h=this.domService.createText(c);this.domService.appendChild(n,h),l.style&&this.applyStyleString(n,l.style);for(const d of l.classes)this.domService.addClass(n,d);return this.domService.appendChild(e,n),n}addColumnBorderDivs(e,t,s,o,i){if(e.verticalBorderVisible){const r=`ge-table-${o}-${i}-vertical-border`;this.addVerticalBorder(s,t,r)}if(e.horizontalBorderVisible){const r=`ge-table-${o}-${i}-horizontal-border`;this.addHorizontalBorder(s,t,r)}return t}addHorizontalBorder(e,t,s="ge-table-body-center-horizontal-border"){const o=this.domService.createElement("div");return this.domService.addClass(o,s),this.setAriaHidden(o),this.domService.setStyle(o,"display","clip"),this.domService.setStyle(o,"position","absolute"),this.domService.setStyle(o,this.startKey,`${e.left}px`),this.domService.setStyle(o,"top",`${e.top}px`),this.domService.setStyle(o,"width",`${e.width}px`),this.domService.setStyle(o,"height","1px"),this.domService.appendChild(t,o),o}addFocusBorderDivs(e,t,s){t={...t,width:t.width+1,height:t.height+1};const o=Ft.focusBorderWidthInPx,i=[[t.left,t.top,o,t.height],[t.left+t.width-o,t.top,o,t.height],[t.left,t.top,t.width,o],[t.left,t.top+t.height-o,t.width,o]];for(const[r,n,l,c]of i){const h=this.domService.createElement("div");this.domService.addClass(h,"ge-table-focus-border"),this.setAriaHidden(h),this.domService.setStyle(h,"display","clip"),this.domService.setStyle(h,"position","absolute"),this.domService.setStyle(h,this.startKey,`${r}px`),this.domService.setStyle(h,"top",`${n}px`),this.domService.setStyle(h,"width",`${l}px`),this.domService.setStyle(h,"height",`${c}px`),this.domService.setStyle(h,"z-index","9999"),this.applyStyle(h,s),this.domService.appendChild(e,h)}return e}addVerticalBorder(e,t,s="ge-table-body-center-vertical-border"){const o=this.domService.createElement("div");return this.domService.addClass(o,s),this.setAriaHidden(o),this.domService.setStyle(o,"display","clip"),this.domService.setStyle(o,"position","absolute"),this.domService.setStyle(o,this.startKey,`${e.left}px`),this.domService.setStyle(o,"top",`${e.top}px`),this.domService.setStyle(o,"width","1px"),this.domService.setStyle(o,"height",`${e.height}px`),this.domService.appendChild(t,o),o}addDiv(e,t,s=""){const o=this.domService.createElement("div");return s&&this.domService.addClass(o,s),this.setAriaHidden(o),this.domService.setStyle(o,"display","clip"),this.domService.setStyle(o,"position","absolute"),this.domService.setStyle(o,this.startKey,`${t.left}px`),this.domService.setStyle(o,"top",`${t.top}px`),this.domService.setStyle(o,"width",`${t.width}px`),this.domService.setStyle(o,"height",`${t.height}px`),this.domService.appendChild(e,o),o}applyStyleString(e,t){const s=t.split(";").map(o=>o.trim()).filter(o=>o);for(const o of s){const[i,r]=o.split(":");this.domService.setStyle(e,i.trim(),r.trim())}}getDivOrCreateDiv(e,t){let s=t.cache[e];return s?(s.innerText="",s):(s=this.domService.createElement("div"),t.cache[e]=s,s)}};Ft.focusBorderWidthInPx=2;let yt=Ft;const ct=a=>a==="header"?"header":a==="footer"?"footer":"body";class Ct{constructor(e,t){if(this.rowIdx=-1,this.colIdx=-1,this.action=null,this.inputType=null,this.className="",e!==null&&(e instanceof HTMLDivElement||e instanceof HTMLSpanElement||e instanceof HTMLInputElement)){this.className=e.className,this.action=e.getAttribute("data-ge-action"),this.inputType=e.getAttribute("data-input-type"),this.rowIdx=Number(e.getAttribute("data-row-index")),this.colIdx=Number(e.getAttribute("data-col-index"));const s=e.getAttribute("data-area");if(s&&(this.areaIdent=ct(s),this.areaModel=t.tableModel.getAreaModel(this.areaIdent),this.row=this.areaModel.getRowByIndex(this.rowIdx)),e instanceof HTMLInputElement){const o=e;this.value=o.value}}}}class Wo{constructor(e){this.tableScope=e,this.doubleClickDelay=500,this.lastClickedCellKey="",this.mouseDown=!1,this.repaintAfterMouseUp=!1,this.dragging=!1,this.lastClicked=0;const t=this.tableScope.listenerAbortController.signal;this.tableScope.hostElement.addEventListener("click",this.onHostElementClicked.bind(this),{signal:t}),this.tableScope.hostElement.addEventListener("dblclick",this.onHostElementDblClicked.bind(this),{signal:t}),this.tableScope.hostElement.addEventListener("mousedown",this.onMouseDown.bind(this),{signal:t}),this.tableScope.hostElement.addEventListener("mousemove",this.onMouseMove.bind(this),{signal:t}),this.tableScope.hostElement.addEventListener("mouseup",this.onMouseUp.bind(this),{signal:t}),this.tableScope.hostElement.addEventListener("contextmenu",this.onContextmenu.bind(this),{signal:t}),this.tableScope.hostElement._MouseHandler="true",this.tableScope.scrollViewport.addEventListener("scroll",this.tableScope.adjustAfterScrolling.bind(this.tableScope),{signal:t}),this.tableScope.scrollViewport.addEventListener("wheel",this.tableScope.onWheel.bind(this.tableScope),{passive:!1,signal:t}),[window,this.tableScope.hostElement].forEach(s=>s.addEventListener("resize",this.tableScope.adjustContainersAndRows.bind(this.tableScope),{signal:t}))}onContextmenu(e){if(this.isBlocked(e)||!(e instanceof MouseEvent))return;this.mouseEvent=e;const t=this.tableScope.createGeMouseEvent(this.mouseEvent);this.tableScope.contextmenu(t)}onHostElementClicked(e){var n;if(this.isBlocked(e))return;const t=Date.now(),s=this.tableScope.getMouseEventTarget(e),o=this.getCellKey(s),i=e.detail>=2||e.detail===0&&t-this.lastClicked<this.doubleClickDelay&&o===this.lastClickedCellKey;this.lastClicked=t,this.lastClickedCellKey=o;const r=new Ct(s,this.tableScope);if(i&&(this.reportedDoubleClick={time:t,cellKey:o}),i&&!this.isClickAction(r)){this.publishGeMouseEvent(e,2);return}if(r.action==="toggleExpandCollapseAll")this.tableScope.toggleExpandCollapseAll(!this.tableScope.allExpanded),e.preventDefault(),e.stopPropagation();else if(r.action==="toggle-detail")this.tableScope.toggleDetail(r.rowIdx,"mouse"),e.preventDefault(),e.stopPropagation();else if(r.action==="toggleHeaderGroup")this.tableScope.toggleHeaderGroup(r),e.preventDefault(),e.stopPropagation();else if(r.inputType==="checkbox"&&r.areaIdent)this.tableScope.toggleRowCheckbox(r.rowIdx,r.colIdx,r.areaIdent),e.preventDefault(),e.stopPropagation();else if(L(r.row)&&r.areaModel){const l=r.colIdx===this.getArrowColumnIndex()&&e.altKey,c=r.className.includes("ge-table-tree-arrow-div");if(l||c){e.preventDefault(),e.stopPropagation();const h=r.row;this.tableScope.setTreeRowExpanded(h,!h.expanded)}}r.areaIdent==="body"&&((n=this.tableScope.focusModel())==null||n.setFocus(r.rowIdx,r.colIdx)),this.publishGeMouseEvent(e,i?2:1)}getCellKey(e){var s;const t=e instanceof Element?e:null;return(s=t==null?void 0:t.closest)!=null&&s.call(t,"[data-col-index]")?["data-area","data-row-index","data-col-index"].map(o=>{var i;return((i=t.closest("["+o+"]"))==null?void 0:i.getAttribute(o))??""}).join(":"):""}isClickAction(e){return e.action==="toggleExpandCollapseAll"||e.action==="toggleHeaderGroup"||e.action==="toggle-detail"||e.inputType==="checkbox"&&!!e.areaIdent||e.className.includes("ge-table-tree-arrow-div")}onHostElementDblClicked(e){var i,r;if(this.isBlocked(e))return;this.lastClicked=Date.now();const t=this.tableScope.getMouseEventTarget(e),s=this.tableScope.createGeMouseEvent(e);if(t instanceof HTMLElement&&!this.isClickAction(new Ct(t,this.tableScope))){const n=t.closest("[data-col-index]")??t,l=((i=n.closest("[data-area]"))==null?void 0:i.getAttribute("data-area"))??null,c=ct(l),h=Number((r=n.closest("[data-row-index]"))==null?void 0:r.getAttribute("data-row-index")),d=Number(n.getAttribute("data-col-index")),u=this.tableScope.tableModel.getAreaModel(c);if(l&&c==="header")this.tableScope.tableModel.isSortable(d)&&(this.tableScope.clearSelection(),this.tableScope.onHeaderDblClicked(e,h,d));else if(n.getAttribute("data-row-index")){const f=u.getRowByIndex(h);if(l&&c==="body"&&u.isEditable(h,d)&&(this.tableScope.clearSelection(),this.tableScope.initRenderEditor(h,d)),L(f)&&d===this.getArrowColumnIndex()){e.preventDefault(),e.stopPropagation();const g=f;this.tableScope.setTreeRowExpanded(g,!g.expanded)}}}const o=this.reportedDoubleClick;(!o||Date.now()-o.time>this.doubleClickDelay||o.cellKey!==this.getCellKey(t))&&this.publishGeMouseEvent(e,2,s),this.reportedDoubleClick=void 0}publishGeMouseEvent(e,t,s){var i;this.mouseEvent=e,this.geMouseEventOld=(i=this.geMouseEvent)==null?void 0:i.clone(),this.geMouseEvent=s??this.tableScope.createGeMouseEvent(e),this.geMouseEvent&&(this.geMouseEvent.clickCount=t);const o=this.tableScope.onMouseClicked(this.geMouseEvent,this.geMouseEventOld);this.tableScope.publishGeMouseEvent(this.geMouseEvent),o&&!this.isInteractiveCellElement(e.target)&&this.tableScope.debounceRepaint()}isInteractiveCellElement(e){const t=e instanceof Element?e:null,s=t==null?void 0:t.closest('input, select, textarea, button, a[href], [contenteditable]:not([contenteditable="false"])');return!!s&&this.tableScope.hostElement.contains(s)}getArrowColumnIndex(){const e=this.tableScope.tableModel.isRowCheckboxVisible();return this.tableScope.getFirstDataColumnIndex()+(e?1:0)}onMouseDown(e){this.isBlocked(e)||(this.tableScope.cancelPendingRepaint()&&(this.repaintAfterMouseUp=!0),this.dragging||(this.mouseEvent=e,this.startMouseEvent=this.tableScope.createGeMouseEvent(this.mouseEvent),this.tableScope.onMouseDown(this.startMouseEvent),this.mouseDown=!0))}onMouseMove(e){var t,s,o,i;if(!this.mouseDown&&((s=(t=this.tableScope).isEventInDetail)!=null&&s.call(t,e))){(i=(o=this.tableScope).hideHover)==null||i.call(o);return}!this.mouseDown&&this.isBlocked(e)||(this.mouseEvent=e,this.mouseDown?(this.dragging||(this.dragging=!0,this.tableScope.setDragging(!0)),requestAnimationFrame(this.mouseDraggingOnFrame.bind(this))):requestAnimationFrame(this.mouseMoveOnFrame.bind(this)))}onMouseUp(e){var t,s;!this.mouseDown&&((s=(t=this.tableScope).isEventInDetail)!=null&&s.call(t,e))||(this.mouseEvent=e,this.repaintAfterMouseUp&&(this.repaintAfterMouseUp=!1,this.tableScope.debounceRepaint()),this.dragging&&requestAnimationFrame(this.mouseDraggingEndOnFrame.bind(this)),this.mouseDown=!1,this.dragging=!1,this.tableScope.setDragging(!1))}mouseDraggingOnFrame(){var e;if(this.mouseEvent){const t=this.tableScope.createGeMouseEvent(this.mouseEvent);(e=this.startMouseEvent)!=null&&e.originalEvent&&(t.draggingX=this.mouseEvent.clientX-this.startMouseEvent.originalEvent.clientX,t.draggingY=this.mouseEvent.clientY-this.startMouseEvent.originalEvent.clientY),this.tableScope.mouseDraggingOnFrame(t,this.startMouseEvent)}}mouseDraggingEndOnFrame(){var e;if(this.mouseEvent){const t=this.tableScope.createGeMouseEvent(this.mouseEvent);(e=this.startMouseEvent)!=null&&e.originalEvent&&(t.draggingX=this.mouseEvent.clientX-this.startMouseEvent.originalEvent.clientX,t.draggingY=this.mouseEvent.clientY-this.startMouseEvent.originalEvent.clientY),this.tableScope.mouseDraggingEndOnFrame(t)}}mouseMoveOnFrame(){if(this.mouseEvent){const e=this.tableScope.createGeMouseEvent(this.mouseEvent);this.tableScope.mouseMove(e)}}isBlocked(e){var t,s,o;return(((t=this.tableScope.tableOverlay)==null?void 0:t.isEventBlocked(e))??!1)||!!((o=(s=this.tableScope).isEventInDetail)!=null&&o.call(s,e))}}function _s(a){return typeof a=="number"&&!Number.isNaN(a)}function Tr(a){if(_s(a))return a;if(a instanceof Date){const e=a.getTime();return Number.isNaN(e)?void 0:e}}function $s(a,e){const t=a.sum,s=t+e;Number.isFinite(s)&&(a.compensation+=Math.abs(t)>=Math.abs(e)?t-s+e:e-s+t),a.sum=s}function Uo(a){return Number.isFinite(a.sum)?a.sum+a.compensation:a.sum}function zo(a,e){$s(a,e.sum),a.compensation+=e.compensation}const Ir={name:"sum",init:()=>({sum:0,compensation:0}),add:(a,e)=>(_s(e)&&$s(a,e),a),merge:(a,e)=>(zo(a,e),a),result:a=>Uo(a)},Dr={name:"count",init:()=>0,add:a=>a+1,merge:(a,e)=>a+e,result:a=>a},kr={name:"avg",init:()=>({sum:0,compensation:0,count:0}),add:(a,e)=>(_s(e)&&($s(a,e),a.count++),a),merge:(a,e)=>(zo(a,e),a.count+=e.count,a),result:a=>a.count?Uo(a)/a.count:void 0};function lo(a,e){return{name:a,init:()=>({has:!1,value:void 0,key:0}),add:(t,s)=>{const o=Tr(s);return o!==void 0&&(!t.has||e(o,t.key))&&(t.has=!0,t.value=s,t.key=o),t},merge:(t,s)=>(s.has&&(!t.has||e(s.key,t.key))&&(t.has=!0,t.value=s.value,t.key=s.key),t),result:t=>t.has?t.value:void 0}}const Fr={name:"countDistinct",init:()=>({values:new Set,dates:new Set}),add:(a,e)=>(e instanceof Date?a.dates.add(e.getTime()):e!=null&&a.values.add(e),a),merge:(a,e)=>(e.values.forEach(t=>a.values.add(t)),e.dates.forEach(t=>a.dates.add(t)),a),result:a=>a.values.size+a.dates.size},Lr={name:"first",init:()=>({has:!1,value:void 0}),add:(a,e)=>(a.has||(a.has=!0,a.value=e),a),merge:(a,e)=>(!a.has&&e.has&&(a.has=!0,a.value=e.value),a),result:a=>a.value},Pr={name:"last",init:()=>({has:!1,value:void 0}),add:(a,e)=>(a.has=!0,a.value=e,a),merge:(a,e)=>(e.has&&(a.has=!0,a.value=e.value),a),result:a=>a.value},ae=Object.freeze({sum:Ir,count:Dr,avg:kr,min:lo("min",(a,e)=>a<e),max:lo("max",(a,e)=>a>e),countDistinct:Fr,first:Lr,last:Pr});function Wt(a){if(typeof a!="string")return a;const e=ae[a];if(!e)throw new Error(`Unknown aggregator "${a}" – use one of: ${Object.keys(ae).join(", ")}, or an own AggregatorIf.`);return e}function ht(a){if(typeof a=="function")return a;const e=a.split(".");return e.length===1?t=>t==null?void 0:t[a]:t=>{let s=t;for(const o of e){if(s==null)return;s=s[o]}return s}}function dt(a,e){const t=typeof e=="string"||!("aggregator"in e)?{aggregator:e}:e,s=Wt(t.aggregator),o=t.value??a;return{key:a,aggregator:s,value:o,getValue:s===ae.count?void 0:ht(o),format:t.format}}function Ut(a,e){const t=e.map(o=>o.aggregator.init()),s=e.length;for(let o=0;o<a.length;o++){const i=a[o];for(let r=0;r<s;r++){const n=e[r];t[r]=n.aggregator.add(t[r],n.getValue?n.getValue(i):i)}}return t}function Vr(a,e){const t=e.map(o=>o.aggregator.init()),s=e.length;for(let o=0;o<a;o++)for(let i=0;i<s;i++){const r=e[i];t[i]=r.aggregator.add(t[i],r.getValue?r.getValue(o):o)}return t}function Or(a,e,t){const s=dt("",{aggregator:t,value:e}),[o]=Ut(a,[s]);return s.aggregator.result(o)}function Br(a,e){const t=Object.keys(e).map(i=>dt(i,e[i])),s=Ut(a,t),o={};return t.forEach((i,r)=>o[i.key]=i.aggregator.result(s[r])),o}const Nr=new Intl.NumberFormat("en-US",{maximumFractionDigits:2});function $e(a){return a==null?"":typeof a=="number"?Number.isFinite(a)?Nr.format(a):String(a):a instanceof Date?Number.isNaN(a.getTime())?"":a.toLocaleDateString("en-US"):String(a)}const Hr=new Set(["percentOfColumnTotal","percentOfGrandTotal","percentOfParentTotal","percentOfRowTotal"]),co=new Map,_r=new Intl.NumberFormat("en-US",{maximumFractionDigits:0});function Ge(a){if(!a)return;const e=typeof a=="string"?{mode:a}:a;return Ko.includes(e.mode)?e:void 0}const Ko=Object.freeze(["percentOfColumnTotal","percentOfGrandTotal","percentOfParentTotal","percentOfRowTotal","differenceFromPrevious","runningTotal","rank"]);function Gs(a){return!!a&&Hr.has(a)}function zt(a,e){const t=Ge(e);if(typeof a!="number"||Number.isNaN(a)||!t)return a==null?"":`${a}`;if(t.format)return`${t.format(a)??""}`;if(Gs(t.mode)){const s=ho(t.fractionDigits??1);let o=co.get(s);return o||(o=new Intl.NumberFormat("en-US",{style:"percent",minimumFractionDigits:s,maximumFractionDigits:s}),co.set(s,o)),o.format(a)}if(t.mode==="rank")return _r.format(a);if(t.fractionDigits!==void 0){const s=ho(t.fractionDigits);return new Intl.NumberFormat("en-US",{minimumFractionDigits:s,maximumFractionDigits:s}).format(a)}return $e(a)}function ho(a){return Math.min(10,Math.max(0,Math.trunc(Number(a)||0)))}function Ie(a){return typeof a=="number"&&!Number.isNaN(a)}function Kt(a){const e=ae.sum;let t=e.init();for(let s=0;s<a.length;s++)t=e.add(t,a[s]);return e.result(t)??0}function Ws(a,e){const t=a.length,s=new Array(t);switch(e){case"percentOfColumnTotal":case"percentOfGrandTotal":case"percentOfParentTotal":{const o=Kt(a);for(let i=0;i<t;i++)s[i]=$r(a[i],o);return s}case"runningTotal":{const o=ae.sum;let i=o.init();for(let r=0;r<t;r++){const n=a[r];i=o.add(i,n),s[r]=Ie(n)?o.result(i):void 0}return s}case"differenceFromPrevious":for(let o=0;o<t;o++){const i=a[o],r=o>0?a[o-1]:void 0;s[o]=Ie(i)&&Ie(r)?i-r:void 0}return s;case"rank":{const o=[];for(let r=0;r<t;r++)Ie(a[r])&&o.push(r);o.sort((r,n)=>a[n]-a[r]);let i=0;for(let r=0;r<o.length;r++)(r===0||a[o[r]]!==a[o[r-1]])&&(i=r+1),s[o[r]]=i;return s}default:for(let o=0;o<t;o++)s[o]=Ie(a[o])?a[o]:void 0;return s}}function $r(a,e){return Ie(a)&&e!==0?a/e:void 0}class E{constructor(e,t,s){this.code=e,this.message=t,this.position=s,this.type="FormulaError"}toString(){return this.code}}function S(a){return!!a&&typeof a=="object"&&a.type==="FormulaError"}class Gr{constructor(e){this.owner=e,this.defsLength=-1,this.computing=new Map,this.contexts=new Map,this.aggregates=new Map,this.aggSignal=void 0,this.aggLength=-1}invalidate(){this.getters=void 0,this.showValuesAs=void 0,this.properties=void 0,this.aggregates.clear()}getter(e){if(e!==void 0)return this.lookup().get(e)}hasGetters(){return this.lookup().size>0}isCalculated(e){return this.lookup().has(e)}hasColumn(e){return this.lookup(),this.properties.has(e)}getShowValuesAs(e){if(e!==void 0)return this.lookup(),this.showValuesAs.get(e)}hasShowValuesAs(){return this.lookup(),this.showValuesAs.size>0}get(e,t){const s=this.lookup().get(t);if(!s)return this.owner.readPath(e,t);if(e!=null)return this.call(s,e,t)}aggregate(e,t){var c;if((c=this.computing.get(e))!=null&&c.size)return new E("#CIRC!",`Circular reference: the column "${e}" uses its own aggregate`);const s=this.owner.getAggregationSource();(s.signal!==this.aggSignal||s.length!==this.aggLength)&&(this.aggregates.clear(),this.aggSignal=s.signal,this.aggLength=s.length);const o=Wt(t),i=`${o.name}\0${e}`;if(this.aggregates.has(i))return this.aggregates.get(i);const r=s.rows();let n=o.init(),l;for(let h=0;h<r.length;h++){const d=this.get(r[h],e);if(S(d)&&d.code==="#CIRC!"){l=d;break}n=o.add(n,d)}return l===void 0&&(l=o.result(n)),this.aggregates.set(i,l),l}context(e){let t=this.contexts.get(e);return t||(t={property:e,getValue:(s,o)=>this.get(s,o),hasColumn:s=>this.hasColumn(s),isCalculated:s=>this.isCalculated(s),aggregate:(s,o)=>this.aggregate(s,o)},this.contexts.set(e,t)),t}call(e,t,s){let o=this.computing.get(s);if(o!=null&&o.has(t))return new E("#CIRC!",`Circular reference: the column "${s}" depends on itself`);o||(o=new Set,this.computing.set(s,o)),o.add(t);try{return e(t,this.context(s))}catch(i){return new E("#VALUE!",`valueGetter of "${s}": ${i instanceof Error?i.message.slice(0,200):"failed"}`)}finally{o.delete(t)}}lookup(){const e=this.owner.getColumnDefsForValues()??[];if(this.getters&&this.defsLength===e.length)return this.getters;const t=new Map,s=new Map,o=new Set;for(const i of e){if(!i)continue;o.add(i.property),typeof i.valueGetter=="function"&&t.set(i.property,i.valueGetter);const r=Ge(i.showValuesAs);r&&s.set(i.property,r)}return this.getters=t,this.showValuesAs=s,this.properties=o,this.defsLength=e.length,t}}class We{constructor(){this.type="AggregateCellRenderer"}render(e,t,s,o,i,r,n){const l=i.getTextValueAt(t,s);if(!l)return;const c=n.createElement("div");n.addClass(c,"ge-table-label-div");const h=n.createElement("div");n.addClass(h,"ge-table-label"),n.setAttribute(h,"data-row-index",`${t}`),n.setAttribute(h,"data-col-index",`${s}`),n.setAttribute(h,"data-area",o),n.appendChild(h,n.createText(l)),n.appendChild(c,h),n.appendChild(e,c)}}class jt{constructor(e,t=[],s=-1){this.areaIdent=e,this.columnDefs=t,this.defaultRowHeight=s,this.rowSelectionModel=void 0,this.yPositions=[],this.cellRenderers=t.map(o=>o.rendererMap[e])}getTextValueAt(e,t){return""+this.getValueAt(e,t)}getTooltipAt(e,t){return""}getCellRenderer(e,t){if(t<this.cellRenderers.length)return this.cellRenderers[t]}getColspanAt(e,t){return 0}getCustomClassesAt(e,t){return[]}getCustomStyleAt(e,t){}getRowspanAt(e,t){return 0}getRowByIndex(e){}isRowCheckable(e){return!0}isRowChecked(e){var s;const t=this.getRowByIndex(e);return(s=this.rowSelectionModel)==null?void 0:s.isRowChecked(t)}setRowChecked(e,t){if(this.rowSelectionModel){const s=this.getRowByIndex(e);this.rowSelectionModel.checkRow(s,t)}}getMaxColspan(){return 31}getMaxRowspan(){return 31}getYPosByRowIndex(e){return this.defaultRowHeight>0?this.defaultRowHeight*e:this.yPositions[e]}init(){!this.yPositions.length&&this.getRowCount()!==void 0&&this.defaultRowHeight===-1&&this.calcYPositions()}isFilterable(){return this.areaIdent==="body"}doSort(e){return!1}sort(e){}isEditable(e,t){var o,i;const s=(o=this.columnDefs)==null?void 0:o[t];return this.areaIdent==="body"&&(s!=null&&s.valueGetter)&&!s.valueSetter?!1:((i=s==null?void 0:s.editable)==null?void 0:i.call(s))??!1}setValue(e,t,s){var l;const o=(l=this.columnDefs[t])==null?void 0:l.editInputPipe;o&&(s=o(s,e,t));const i=this.getRowByIndex(e),r=this.columnDefs[t];if(this.areaIdent==="body"&&(r!=null&&r.valueGetter))return this.setCalculatedValue(i,r,s);const n=this.columnDefs[t].property;return n.includes(".")?this.setPropertyValue(i,n.split("."),s):(i[n]=s,!0)}isSelectable(e,t){return!0}changeColumnOrder(e,t){this.arrayMove(this.cellRenderers,e,t)}setPropertyValue(e,t,s){const o=t.shift();if(o){const i=e[o];return i&&t.length?this.setPropertyValue(i,t,s):(e[o]=s,!0)}return!1}arrayMove(e,t,s){const o=e.splice(t,1)[0];return e.splice(s,0,o),e}calcYPositions(){const e=this.getRowCount();this.yPositions=new Array(e+1),this.yPositions[0]=0;for(let t=0;t<e;t++)this.yPositions[t+1]=this.getRowHeight(t)+this.yPositions[t]}isCalculatedProperty(e){return this.getColumnValues().isCalculated(e)}getRowValue(e,t){return L(e)&&(e=e.data),this.getColumnValues().get(e,t)}hasDerivedColumns(){const e=this.getColumnValues();return e.hasGetters()||e.hasShowValuesAs()}isDerivedProperty(e){const t=this.getColumnValues();return t.isCalculated(e)||!!t.getShowValuesAs(e)}getColumnValues(){return this.columnValuesInstance??(this.columnValuesInstance=new Gr({getColumnDefsForValues:()=>this.areaIdent==="body"?this.columnDefs:[],readPath:(e,t)=>this.readPropertyPath(e,t),getAggregationSource:()=>this.getAggregationSourceForValues()}))}invalidateColumnValues(){var e;(e=this.columnValuesInstance)==null||e.invalidate()}readPropertyPath(e,t){if(e==null||!t)return;let s=e;for(const o of t.split(".")){if(s==null)return;s=s[o]}return s}getAggregationSourceForValues(){const e=this.getRowCount();return{signal:void 0,length:e,rows:()=>Array.from({length:e},(t,s)=>this.getRowByIndex(s))}}setCalculatedValue(e,t,s){return!t.valueSetter||e===void 0||e===null?!1:(L(e)&&(e=e.data),t.valueSetter(e,s)!==!1)}getCalculatedText(e,t){if(e===void 0)return;const s=this.getColumnValues(),o=s.getShowValuesAs(e),i=s.isCalculated(e);if(i&&S(t))return t.code;if(o)return zt(t,o);if(i)return t==null?"":`${t}`}getCalculatedRenderer(e){if(e!==void 0&&this.getColumnValues().getShowValuesAs(e))return this.calcTextRenderer??(this.calcTextRenderer=new We)}addCalculatedClasses(e,t,s){return t!==void 0&&this.getColumnValues().isCalculated(t)&&S(s())?[...e,"ge-table-cell-error"]:e}}class Us{genericSortComparator(e,t,s){if(typeof e=="number"&&typeof t=="number")return s*(e-t);if(typeof e=="string"&&typeof t=="string")return s*e.localeCompare(t);if(typeof e=="boolean"&&typeof t=="boolean")return s*((e?-1:1)-(t?-1:1));if(e instanceof Date&&t instanceof Date)return s*(e.getTime()-t.getTime());if(e instanceof Array&&t instanceof Array){const o=e,i=t;if(o.length&&i.length)return this.genericSortComparator(o[0],i[0],s)}return s*(""+e).localeCompare(""+t)}}function Re(a,e){return Wr(a,e)?a:Array.from(new Set(a)).filter(t=>Number.isInteger(t)&&t>=0&&t<e).sort((t,s)=>t-s)}function Wr(a,e){let t=-1;for(const s of a){if(!Number.isInteger(s)||s<=t||s>=e)return!1;t=s}return!0}function zs(a){return a.position==="before"?a.rowIndex:a.rowIndex+1}function us(a,e){if(!a.length)return-1;const t=zs(e);return t-a.filter(s=>s<t).length}function jo(a,e,t){const s=Re(e,a.length);if(!s.length)return-1;const o=Math.min(Math.max(0,t),a.length),i=new Uint8Array(a.length);s.forEach(h=>i[h]=1);const r=new Array(s.length);s.forEach((h,d)=>r[d]=a[h]);const n=[];let l=-1;for(let h=0;h<=a.length;h++)h===o&&(l=n.length),h<a.length&&!i[h]&&n.push(a[h]);let c=0;for(let h=0;h<l;h++)a[c++]=n[h];for(const h of r)a[c++]=h;for(let h=l;h<n.length;h++)a[c++]=n[h];return l}function Ks(a){const e=new Set(a);return a.filter(t=>{for(let s=t.parent;s;s=s.parent)if(e.has(s))return!1;return!0})}function js(a,e){if(!e||!a.length)return!1;const t=new Set(a);for(let s=e;s;s=s.parent)if(t.has(s))return!1;return!0}function Yo(a,e,t,s){const o=Ks(e);if(!js(o,t))return!1;for(const l of o){const c=l.parent?l.parent.children:a,h=(c==null?void 0:c.indexOf(l))??-1;c&&h>-1&&c.splice(h,1)}let i,r,n;s==="inside"?(i=t,t.children=t.children??[],r=t.children,n=r.length,t.expanded=!0):(i=t.parent,r=i?i.children??(i.children=[]):a,n=r.indexOf(t)+(s==="after"?1:0)),r.splice(n,0,...o);for(const l of o)l.parent=i,Xo(l,i?i.deep+1:0);return!0}function Xo(a,e){a.deep=e;for(const t of a.children??[])Xo(t,e+1)}function Yt(a,e,t,s){return a===e&&s.position!=="inside"&&Number.isInteger(s.rowIndex)&&s.rowIndex>=0&&s.rowIndex<a&&Re(t,a).length>0}function Ys(a,e,t,s){if(!Yt(a.length,e.length,t,s))return!1;if(jo(a,Re(t,a.length),zs(s)),e!==a)for(let o=0;o<a.length;o++)e[o]=a[o];return!0}function Ur(a,e,t,s){if(e<1)return-1;if(s&&s>0)return Math.min(e-1,Math.max(0,Math.floor(a/s)));let o=0,i=e-1;for(;o<i;){const r=o+i+1>>1;t(r)<=a?o=r:i=r-1}return o}class q extends jt{constructor(e,t,s,o=[],i="ge-selected-row",r="ge-focused-row"){super(e,o,s),this.areaIdent=e,this.rows=t,this.defaultRowHeight=s,this.columnDefs=o,this.selectedRowClass=i,this.focusedRowClass=r,this.sorterService=new Us,this.showValuesCache=new Map,this._focusedRowIndex=0,this.filteredRows=[...t],this.properties=o.map(n=>n.property)}getFocusedRowIndex(){return this._focusedRowIndex}setFocusedRowIndex(e){this._focusedRowIndex=e}setRows(e){this.rows=e,this.filteredRows=[...e],this.showValuesCache.clear()}filterRowsByPredict(e){this.rows=this.rows.filter(e),this.filteredRows=this.filteredRows.filter(e)}getRowCount(){var e;return((e=this.filteredRows)==null?void 0:e.length)??0}getUnfilteredRowCount(){var e;return((e=this.rows)==null?void 0:e.length)??0}canMoveRows(e,t){return Yt(this.filteredRows.length,this.rows.length,e,t)}moveRows(e,t){const s=Ys(this.filteredRows,this.rows,e,t);return s&&this.invalidateDerivedValues(),s}getValueAt(e,t){const s=this.properties[t];let o=this.filteredRows[e];if(L(o)&&(o=o.data),o){const i=this.getValueByT(o,s),r=this.getColumnValues().getShowValuesAs(s);return r?this.applyShowValuesAs(e,s,i,r):i}return""}getTextValueAt(e,t){const s=this.getValueAt(e,t);return this.getCalculatedText(this.properties[t],s)??""+s}getCellRenderer(e,t){return super.getCellRenderer(e,t)??this.getCalculatedRenderer(this.properties[t])}getTooltipAt(e,t){const s=this.properties[t];if(s!==void 0&&this.getColumnValues().isCalculated(s)){const o=this.getValueAt(e,t);if(S(o))return o.message}return super.getTooltipAt(e,t)}invalidateDerivedValues(e){this.invalidateColumnValues(),this.showValuesCache.clear()}applyShowValuesAs(e,t,s,o){if(S(s))return s;let i=this.showValuesCache.get(t);switch(i||(i={},this.showValuesCache.set(t,i)),o.mode){case"percentOfColumnTotal":case"percentOfGrandTotal":case"percentOfParentTotal":return i.total===void 0&&(i.total=Kt(this.filteredRows.map(r=>this.getValueByT(L(r)?r.data:r,t)))),typeof s=="number"&&!Number.isNaN(s)&&i.total!==0?s/i.total:void 0;case"percentOfRowTotal":return s;default:return(!i.values||i.values.length!==this.filteredRows.length)&&(i.values=Ws(this.filteredRows.map(r=>this.getValueByT(L(r)?r.data:r,t)),o.mode)),i.values[e]}}readPropertyPath(e,t){return t.includes(".")?this.getPropertyValue(e,t.split(".")):e[t]}getAggregationSourceForValues(){const e=this.filteredRows;return{signal:e,length:e.length,rows:()=>e.some(t=>L(t))?e.map(t=>L(t)?t.data:t):e}}getFilteredRows(){return this.filteredRows}getAllRows(){return this.rows}findRowFromFilteredRowsByAllCriteria(e,t){return this.getFilteredRows().find(s=>t(e,s))}findRowFromAllRowsByAllCriteria(e,t){return this.getAllRows().find(s=>t(e,s))}getRowHeight(e){return this.defaultRowHeight}getConstantRowHeight(){return this.getRowHeight===q.prototype.getRowHeight&&this.defaultRowHeight>0?this.defaultRowHeight:void 0}getRowByIndex(e){return this.filteredRows[e]}externalFilterChanged(e){this.filteredRows=this.rows?this.rows.filter(e):[],this.showValuesCache.clear()}doSort(e){const t=e.map(({columnIndex:s,sortState:o})=>{const i=o==="asc"?1:o==="desc"?-1:0;return this.genericFlatTableSortComparator(this.properties[s],i)});return this.showValuesCache.clear(),t.length&&(this.filteredRows=this.filteredRows.sort((s,o)=>{for(const i of t){const r=i(s,o);if(r)return r}return 0})),!0}sort(e){this.filteredRows=this.filteredRows.sort(e),this.showValuesCache.clear()}getValueByT(e,t){if(!e||!t)return;const s=this.getColumnValues();return s.getter(t)?s.get(e,t):t.includes(".")?this.getPropertyValue(e,t.split(".")):e[t]}changeColumnOrder(e,t){this.arrayMove(this.properties,e,t),super.changeColumnOrder(e,t)}getCustomClassesAt(e,t){let s=super.getCustomClassesAt(e,t);return s=this.addCalculatedClasses(s,this.properties[t],()=>this.getValueAt(e,t)),this.getRowByIndex(e).selected&&s.push(this.selectedRowClass),this._focusedRowIndex===e&&s.push(this.focusedRowClass),s}genericFlatTableSortComparator(e,t){const s=this.columnDefs.find(r=>r.property===e),o=this.createSortValueReader(e),i=this.getColumnValues().isCalculated(e);return(r,n)=>{const l=o(r),c=o(n);return i&&(l===void 0||c===void 0)?l===c?0:l===void 0?1:-1:s!=null&&s.sortComparator?t*s.sortComparator(l,c,r,n,t):this.sorterService.genericSortComparator(l,c,t)}}createSortValueReader(e){if(!this.getColumnValues().getter(e))return s=>this.getValueByT(s,e);const t=new Map;return s=>{if(t.has(s))return t.get(s);const o=this.getValueByT(s,e),i=S(o)?void 0:o;return t.set(s,i),i}}getPropertyValue(e,t){const s=t.shift(),o=e[s];return o&&t.length?this.getPropertyValue(o,t):o}}class A{constructor(e,t,s,o,i=!1){this.r1=e,this.c1=t,this.r2=s,this.c2=o,this.gammaRange=i}static create(e){return e.gammaRange===void 0&&(e.gammaRange=!1),new A(e.rowIndex1,e.columnIndex1,e.rowIndex2,e.columnIndex2,e.gammaRange)}static singleCell(e,t){return new A(e,t,e,t)}static singleRow(e){return new A(e,0,e,Number.MAX_SAFE_INTEGER)}static singleColumn(e){return new A(0,e,Number.MAX_SAFE_INTEGER,e)}isInRange(e,t){return e>=this.r1&&e<=this.r2&&t>=this.c1&&t<=this.c2}}const Lt=class Lt{aggregate(e,t){const s={count:0,numericCount:0,sum:0,avg:void 0,min:void 0,max:void 0,capped:!1};if(!(t!=null&&t.hasSelection()))return s;const o=e.getBodyModel(),i=o.getRowCount(),r=e.getColumnCount(),n=(t.isAllSelected()?[new A(0,0,i-1,r-1)]:t.getRanges()).map(p=>({r1:Math.max(0,Math.min(p.r1,p.r2)),r2:Math.min(i-1,Math.max(p.r1,p.r2)),columns:this.dataColumns(e,Math.max(0,Math.min(p.c1,p.c2)),Math.min(r-1,Math.max(p.c1,p.c2)))})).filter(p=>p.r2>=p.r1&&p.columns.length);if(n.reduce((p,m)=>p+(m.r2-m.r1+1)*m.columns.length,0)>Lt.maxCells)return s.capped=!0,s;const{sum:c,min:h,max:d}=ae;let u=c.init(),f=h.init(),g=d.init();return n.forEach((p,m)=>{const b=n.slice(0,m);for(let w=p.r1;w<=p.r2;w++)for(const y of p.columns){if(b.length&&b.some(R=>w>=R.r1&&w<=R.r2&&R.columns.includes(y))||!t.isSelected(w,y))continue;s.count++;const x=o.getValueAt(w,y);typeof x=="number"&&!Number.isNaN(x)&&(s.numericCount++,u=c.add(u,x),f=h.add(f,x),g=d.add(g,x))}}),s.numericCount&&(s.sum=c.result(u),s.avg=s.sum/s.numericCount,s.min=h.result(f),s.max=d.result(g)),s}dataColumns(e,t,s){var i;const o=[];for(let r=t;r<=s;r++){const n=e.getColumnDef(r);((i=n==null?void 0:n.isVisible)==null?void 0:i.call(n))===!1||O(n)||Se(n)||o.push(r)}return o}};Lt.maxCells=1e6;let xt=Lt;function zr(a){const e=Ge(a);if(!e||!Gs(e.mode))return;const t=Math.min(10,Math.max(0,Math.trunc(Number(e.fractionDigits??1)||0)));return t?`0.${"0".repeat(t)}%`:"0%"}class H extends Error{constructor(e,t){super(e),this.pos=t}toFormulaError(){return new E("#ERROR!",`${this.message} (at ${this.pos+1})`,this.pos)}}const Kr=["<=",">=","<>","!=","==","+","-","*","/","^","&","=","<",">"],jr={n:`
|
|
42
|
+
`,t:" ",r:"\r","\\":"\\",'"':'"',"'":"'"};function ye(a){return a>="0"&&a<="9"}function fs(a){return a>="a"&&a<="z"||a>="A"&&a<="Z"||a==="_"}function Yr(a){return fs(a)||ye(a)||a==="."}function Xr(a){const e=[],t=a.length;let s=0;for(;s<t;){const o=a[s];if(o===" "||o===" "||o===`
|
|
43
|
+
`||o==="\r"){s++;continue}const i=s;if(ye(o)||o==="."&&s+1<t&&ye(a[s+1])){for(;s<t&&ye(a[s]);)s++;if(a[s]===".")for(s++;s<t&&ye(a[s]);)s++;if(a[s]==="e"||a[s]==="E"){let l=s+1;if((a[l]==="+"||a[l]==="-")&&l++,l<t&&ye(a[l]))for(s=l;s<t&&ye(a[s]);)s++}if(s<t&&(fs(a[s])||a[s]==="."))throw new H(`Invalid number "${a.slice(i,s+1)}"`,i);const n=a.slice(i,s);e.push({kind:"number",text:n,value:Number(n),pos:i});continue}if(o==='"'||o==="'"){s++;let n="",l=!1;for(;s<t;){const c=a[s];if(c==="\\"){const h=a[s+1];if(h===void 0)break;n+=jr[h]??h,s+=2;continue}if(c===o){l=!0,s++;break}n+=c,s++}if(!l)throw new H("Unterminated text",i);e.push({kind:"string",text:n,pos:i});continue}if(o==="["){s++;let n="",l=!1;for(;s<t;){const h=a[s];if(h==="\\"&&s+1<t){n+=a[s+1],s+=2;continue}if(h==="]"){l=!0,s++;break}if(h==="[")break;n+=h,s++}if(!l)throw new H("Unterminated field reference, missing ]",i);const c=n.trim();if(!c)throw new H("Empty field reference []",i);e.push({kind:"field",text:c,pos:i});continue}if(fs(o)){for(;s<t&&Yr(a[s]);)s++;e.push({kind:"ident",text:a.slice(i,s),pos:i});continue}if(o==="("||o===")"||o===","){e.push({kind:o,text:o,pos:i}),s++;continue}const r=Kr.find(n=>a.startsWith(n,s));if(r){e.push({kind:"op",text:r,pos:i}),s+=r.length;continue}throw new H(`Unexpected character "${o}"`,i)}return e.push({kind:"eof",text:"",pos:t}),e}const ss=1e4,uo=64,fo=1e3,Jr={"=":{bp:10,op:"="},"==":{bp:10,op:"="},"<>":{bp:10,op:"<>"},"!=":{bp:10,op:"<>"},"<":{bp:10,op:"<"},"<=":{bp:10,op:"<="},">":{bp:10,op:">"},">=":{bp:10,op:">="},"&":{bp:20,op:"&"},"+":{bp:30,op:"+"},"-":{bp:30,op:"-"},"*":{bp:40,op:"*"},"/":{bp:40,op:"/"},"^":{bp:60,right:!0,op:"^"}},qr=50;class Zr{constructor(e){this.tokens=e,this.index=0,this.depth=0,this.operators=0}parse(){if(this.peek().kind==="eof")throw new H("Empty formula",0);const e=this.expression(0),t=this.peek();if(t.kind!=="eof")throw new H(`Unexpected "${t.text}"`,t.pos);return e}peek(){return this.tokens[this.index]}next(){return this.tokens[this.index++]}enter(e){if(++this.depth>uo)throw new H(`Nested too deeply (more than ${uo} levels)`,e)}expression(e){let t=this.prefix();for(;;){const s=this.peek();if(s.kind!=="op")break;const o=Jr[s.text];if(!o||o.bp<=e)break;if(this.next(),++this.operators>fo)throw new H(`Too many operators (more than ${fo})`,s.pos);this.enter(s.pos);const i=this.expression(o.right?o.bp-1:o.bp);this.depth--,t={kind:"binary",op:o.op,left:t,right:i}}return t}prefix(){const e=this.next();switch(e.kind){case"number":return{kind:"literal",value:e.value};case"string":return{kind:"literal",value:e.text};case"field":return{kind:"field",name:e.text};case"op":if(e.text==="-"||e.text==="+"){this.enter(e.pos);const t=this.expression(qr);return this.depth--,{kind:"unary",op:e.text,operand:t}}throw new H(`Unexpected "${e.text}"`,e.pos);case"(":{this.enter(e.pos);const t=this.expression(0);return this.depth--,this.expect(")","Missing )"),t}case"ident":return this.identifier(e);case"eof":throw new H("Unexpected end of formula",e.pos);default:throw new H(`Unexpected "${e.text}"`,e.pos)}}identifier(e){const t=e.text.toUpperCase();if(this.peek().kind!=="("){if(t==="TRUE")return{kind:"literal",value:!0};if(t==="FALSE")return{kind:"literal",value:!1};throw new H(`Unknown name "${e.text}" – fields are written in brackets: [${e.text}]`,e.pos)}this.next(),this.enter(e.pos);const s=[];if(this.peek().kind!==")")for(;;){if(s.push(this.expression(0)),this.peek().kind===","){this.next();continue}break}return this.expect(")",`Missing ) after the arguments of ${t}`),this.depth--,{kind:"call",name:t,args:s}}expect(e,t){const s=this.peek();if(s.kind!==e)throw new H(t,s.pos);this.next()}}function Qr(a){if(a.length>ss)throw new H(`Formula too long (more than ${ss} characters)`,ss);return new Zr(Xr(a)).parse()}const en=/^[+-]?(\d+\.?\d*|\.\d+)(e[+-]?\d+)?$/i;function De(a){return a===null||a===""}function vt(a,e,t=!1){if(a==null)return null;switch(typeof a){case"number":return Number.isNaN(a)?null:a;case"string":case"boolean":return a;case"bigint":return Number(a)}if(t&&S(a))return a;if(a instanceof Date){const s=a.getTime();return Number.isNaN(s)?null:s}return new E("#VALUE!",`[${e}] is not a number, text or boolean`)}function _(a){if(typeof a=="number")return a;if(a===null||a==="")return 0;if(typeof a=="boolean")return a?1:0;if(typeof a=="string"){const e=a.trim();if(en.test(e)){const t=Number(e);if(Number.isFinite(t))return t}return new E("#VALUE!",`"${a.length>40?a.slice(0,40)+"…":a}" is not a number`)}return a}function ne(a){return typeof a=="string"?a:a===null?"":typeof a=="number"?String(a):typeof a=="boolean"?a?"TRUE":"FALSE":a}function gs(a){if(typeof a=="boolean")return a;if(a===null||a==="")return!1;if(typeof a=="number")return a!==0;if(typeof a=="string"){const e=a.trim().toUpperCase();return e==="TRUE"?!0:e==="FALSE"?!1:new E("#VALUE!",`"${a.length>40?a.slice(0,40)+"…":a}" is not TRUE or FALSE`)}return a}function Y(a){return Number.isFinite(a)?a===0?0:a:new E("#NUM!","The result is not a finite number")}function tn(a,e){if(S(a))return a;if(S(e))return e;if(De(a)&&De(e))return 0;const t=typeof a=="string"&&!De(a),s=typeof e=="string"&&!De(e);if(t||s){if(t&&s){const u=a.toLowerCase(),f=e.toLowerCase();return u<f?-1:u>f?1:0}const r=_(a),n=_(e);if(!S(r)&&!S(n))return r-n;const l=ne(a),c=ne(e),h=l.toLowerCase(),d=c.toLowerCase();return h<d?-1:h>d?1:0}const o=_(a),i=_(e);return o-i}const Jo={IF:{min:2,max:3},IFERROR:{min:2,max:2},AND:{min:1,max:255},OR:{min:1,max:255}},sn={SUM:"sum",AVG:"avg",AVERAGE:"avg",MIN:"min",MAX:"max",COUNT:"count"};function ft(a){const e=[];for(const t of a){if(De(t))continue;const s=_(t);if(S(s))return s;e.push(s)}return e}function os(a){return{min:1,max:1,fn:e=>{const t=_(e[0]);return S(t)?t:Y(a(t))}}}function on(a,e){const t=Math.trunc(e),s=Math.pow(10,t);if(s===0)return 0;const o=Math.abs(a)*s;if(!Number.isFinite(o))return a;const i=Math.round(o>=1e15?o:Number(o.toPrecision(15)))/s;return a<0?-i:i}const st={ABS:os(Math.abs),FLOOR:os(Math.floor),CEILING:os(Math.ceil),SQRT:{min:1,max:1,fn:a=>{const e=_(a[0]);return S(e)?e:e<0?new E("#NUM!","SQRT of a negative number"):Math.sqrt(e)}},ROUND:{min:1,max:2,fn:a=>{const e=_(a[0]);if(S(e))return e;const t=a.length>1?_(a[1]):0;return S(t)?t:Y(on(e,t))}},MOD:{min:2,max:2,fn:a=>{const e=_(a[0]);if(S(e))return e;const t=_(a[1]);return S(t)?t:t===0?new E("#DIV/0!","MOD by zero"):Y(e-t*Math.floor(e/t))}},POWER:{min:2,max:2,fn:a=>{const e=_(a[0]);if(S(e))return e;const t=_(a[1]);return S(t)?t:Y(Math.pow(e,t))}},SUM:{min:1,max:255,fn:a=>{const e=ft(a);return S(e)?e:Y(e.reduce((t,s)=>t+s,0))}},AVG:{min:1,max:255,fn:a=>{const e=ft(a);return S(e)?e:e.length?Y(e.reduce((t,s)=>t+s,0)/e.length):new E("#DIV/0!","AVG of no numbers")}},MIN:{min:1,max:255,fn:a=>{const e=ft(a);return S(e)?e:e.length?Math.min(...e):0}},MAX:{min:1,max:255,fn:a=>{const e=ft(a);return S(e)?e:e.length?Math.max(...e):0}},COUNT:{min:1,max:255,fn:a=>a.filter(e=>typeof e=="number").length},NOT:{min:1,max:1,fn:a=>{const e=gs(a[0]);return S(e)?e:!e}},CONCAT:{min:1,max:255,fn:a=>{let e="";for(const t of a){const s=ne(t);if(S(s))return s;e+=s}return e}},LEN:{min:1,max:1,fn:a=>{const e=ne(a[0]);return S(e)?e:e.length}},UPPER:{min:1,max:1,fn:a=>{const e=ne(a[0]);return S(e)?e:e.toUpperCase()}},LOWER:{min:1,max:1,fn:a=>{const e=ne(a[0]);return S(e)?e:e.toLowerCase()}},TRIM:{min:1,max:1,fn:a=>{const e=ne(a[0]);return S(e)?e:e.trim().replace(/\s+/g," ")}},ISBLANK:{min:1,max:1,fn:a=>De(a[0])}};st.AVERAGE=st.AVG;const rn=new Set(["__proto__","constructor","prototype"]),nn=(a,e)=>Object.prototype.hasOwnProperty.call(a,e);function an(a,e,t,s=e.split(".")){if(t!=null&&t.isCalculated(e))return vt(t.getValue(a,e),e,!0);if(s.some(i=>rn.has(i)))return new E("#NAME?",`Unknown field [${e}]`);let o=a;for(let i=0;i<s.length;i++){if(o==null||typeof o!="object")return null;if(!nn(o,s[i]))return i===0&&!(t!=null&&t.hasColumn(e))?new E("#NAME?",`Unknown field [${e}]`):null;o=o[s[i]]}return vt(o,e)}function go(a,e,t){if(S(e))return e;if(S(t))return t;if(a==="&"){const i=ne(e);if(S(i))return i;const r=ne(t);return S(r)?r:i+r}if(a==="="||a==="<>"||a==="<"||a==="<="||a===">"||a===">="){const i=tn(e,t);if(S(i))return i;switch(a){case"=":return i===0;case"<>":return i!==0;case"<":return i<0;case"<=":return i<=0;case">":return i>0;default:return i>=0}}const s=typeof e=="number"?e:_(e);if(S(s))return s;const o=typeof t=="number"?t:_(t);if(S(o))return o;switch(a){case"+":return Y(s+o);case"-":return Y(s-o);case"*":return Y(s*o);case"/":return o===0?new E("#DIV/0!","Division by zero"):Y(s/o);default:return Y(Math.pow(s,o))}}function ln(a,e){return a==null?null:typeof a=="number"?Number.isNaN(a)?new E("#NUM!",`${e} returned NaN`):a:typeof a=="string"||typeof a=="boolean"||S(a)?a:a instanceof Date?vt(a,e):new E("#VALUE!",`${e} returned no number, text or boolean`)}function po(a,e,t){const s=new Array(a.length);for(let o=0;o<a.length;o++){const i=a[o](e,t);if(S(i))return i;s[o]=i}return s}class cn{constructor(e){this.functions=e}compile(e){const t=this.node(e);return(s,o)=>{try{const i=t(s,o);return typeof i=="number"?Y(i):i}catch(i){return new E("#VALUE!",i instanceof Error?i.message.slice(0,200):"Evaluation failed")}}}evaluate(e,t,s){return this.compile(e)(t,s)}node(e){switch(e.kind){case"literal":{const t=e.value;return()=>t}case"field":{const t=e.name,s=t.split(".");return(o,i)=>an(o,t,i,s)}case"unary":{const t=this.node(e.operand),s=e.op==="-";return(o,i)=>{const r=t(o,i),n=typeof r=="number"?r:_(r);return S(n)?n:s?-n:n}}case"binary":{const t=this.node(e.left),s=this.node(e.right),o=e.op;return o==="*"||o==="+"||o==="-"?(i,r)=>{const n=t(i,r),l=s(i,r);return typeof n=="number"&&typeof l=="number"?Y(o==="*"?n*l:o==="+"?n+l:n-l):go(o,n,l)}:(i,r)=>go(o,t(i,r),s(i,r))}case"call":return this.call(e.name,e.args)}}call(e,t){const s=this.functions.get(e);if(s){const l=t.map(c=>this.node(c));return(c,h)=>{const d=po(l,c,h);if(S(d))return d;try{return ln(s(...d),e)}catch(u){return new E("#VALUE!",`${e}: ${u instanceof Error?u.message.slice(0,200):"failed"}`)}}}switch(e){case"IF":{const[l,c,h]=t.map(d=>this.node(d));return(d,u)=>{const f=gs(l(d,u));return S(f)?f:f?c(d,u):h?h(d,u):!1}}case"IFERROR":{const[l,c]=t.map(h=>this.node(h));return(h,d)=>{const u=l(h,d);return S(u)?c(h,d):u}}case"AND":case"OR":{const l=e==="AND",c=t.map(h=>this.node(h));return(h,d)=>{for(const u of c){const f=gs(u(h,d));if(S(f))return f;if(l&&!f)return!1;if(!l&&f)return!0}return l}}}const o=sn[e],i=t[0];if(o&&t.length===1&&i.kind==="field"){const l=i.name;return(c,h)=>{if(!h)return new E("#VALUE!",`${e}([${l}]) needs the rows of a table`);if(!h.hasColumn(l))return new E("#NAME?",`Unknown column [${l}] in ${e}`);const d=h.aggregate(l,o);return d===void 0?o==="avg"?new E("#DIV/0!","AVG of no numbers"):0:vt(d,l,!0)}}const r=st[e];if(!r){const l=new E("#NAME?",`Unknown function ${e}`);return()=>l}const n=t.map(l=>this.node(l));return(l,c)=>{const h=po(n,l,c);return S(h)?h:r.fn(h)}}}const hn=Object.freeze([...Object.keys(st),...Object.keys(Jo)].sort());function Xe(a,e,t,s){switch(a.kind){case"literal":return;case"field":t.includes(a.name)||t.push(a.name);return;case"unary":return Xe(a.operand,e,t,s);case"binary":return Xe(a.left,e,t,s)??Xe(a.right,e,t,s);case"call":{if(!e.has(a.name)){const o=st[a.name]??Jo[a.name];if(!o)return new E("#NAME?",`Unknown function ${a.name}`);if(a.args.length<o.min||a.args.length>o.max){const i=o.min===o.max?`${o.min}`:o.max>=255?`at least ${o.min}`:`${o.min} to ${o.max}`;return new E("#ERROR!",`${a.name} needs ${i} argument${o.max===1?"":"s"}, got ${a.args.length}`)}["SUM","AVG","AVERAGE","MIN","MAX","COUNT"].includes(a.name)&&a.args.length===1&&a.args[0].kind==="field"&&(s.aggregates=!0)}for(const o of a.args){const i=Xe(o,e,t,s);if(i)return i}return}}}function Xs(a,e){let t="";const s=new Map;for(const c of Object.keys((e==null?void 0:e.functions)??{})){const h=e.functions[c];typeof h=="function"&&s.set(c.toUpperCase(),h)}let o,i;const r=[],n={aggregates:!1};let l;try{t=typeof a=="string"?a:String(a??"");const c=t.replace(/^\s+/,"");o=Qr(c.startsWith("=")&&!c.startsWith("==")?c.slice(1):t),i=Xe(o,s,r,n),i||(l=new cn(s).compile(o))}catch(c){i=c instanceof H?c.toFormulaError():new E("#ERROR!","Invalid formula")}return i&&(o=void 0,r.length=0),i&&(l=void 0),Object.freeze({source:t,ast:o,error:i,fields:Object.freeze([...r]),usesAggregates:n.aggregates,evaluate:(c,h)=>l?l(c,h):i})}function Js(a,e){const t=typeof a=="string"?Xs(a,e):a;return(s,o)=>t.evaluate(s,o)}class qo{constructor(e){this.tableScope=e}updateCells(e,t=!1){this.tableScope.updateCells(e,t)}externalFilterChanged(){this.tableScope.externalFilterChanged()}scrollToPixel(e=0,t=0){this.tableScope.scrollToPixel(e,t)}getDirection(){return this.tableScope.direction}scrollToIndex(e=0,t=0){this.tableScope.scrollToIndex(e,t)}setHeaderVisible(e=!0){this.tableScope.setHeaderVisible(e)}setColumnVisible(e,t=!0){return this.tableScope.setColumnVisible(e,t)}isColumnVisible(e){var i;const t=this.tableScope.tableModel;if(t.isColumnVisible)return t.isColumnVisible(e);const s=t.getColumnDefs()??[],o=typeof e=="number"?s[e]:typeof e=="string"?s.filter(r=>r.property===e)[0]:e;return o?((i=o.isVisible)==null?void 0:i.call(o))!==!1:typeof e=="number"&&e>=0&&e<t.getColumnCount()}isHeaderVisible(){return this.tableScope.tableModel.isHeaderVisibe()}setFooterVisible(e=!0){this.tableScope.setFooterVisible(e)}isFooterVisible(){return this.tableScope.tableModel.isFooterVisibe()}repaint(){this.tableScope.invalidateAggregates(),this.tableScope.repaint()}destroy(){this.tableScope.destroy()}repaintHard(){this.tableScope.invalidateAggregates(),this.tableScope.repaintHard()}recalcColumnWidths(e){this.tableScope.recalcColumnWidths(e)}clearSelection(){this.tableScope.clearSelection(!0)}setSelectionModel(e,t=!0){this.tableScope.setSelectionModel(e,t)}triggerAction(e){return this.tableScope.onActionTriggered(e)}getShortcutActionMapping(){return this.tableScope.shortcutService.getShortcutActionMapping()}copyToClipboard(){return this.tableScope.copyService.copyToClipboard(this.tableScope.tableModel,this.tableScope.selectionModel(),this.tableScope.focusModel()).then(e=>(this.tableScope.announceCopied(e),e))}announce(e){this.tableScope.announce(e)}showLoadingOverlay(e){this.tableScope.showLoadingOverlay(e)}showNoRowsOverlay(e){this.tableScope.showNoRowsOverlay(e)}hideOverlay(){this.tableScope.hideOverlay()}getOverlayState(){return this.tableScope.getOverlayState()}getState(e){return this.tableScope.stateService.getState(e)}applyState(e,t){this.tableScope.stateService.applyState(e,t)}resetState(){this.tableScope.stateService.resetState()}setCustomState(e){this.tableScope.stateService.setCustomState(e)}setHeaderGroupCollapsed(e,t=!0){return this.tableScope.setHeaderGroupCollapsed(e,t)}getHeaderFocus(){return this.tableScope.getHeaderFocus()}downloadExcel(e="table.xlsx",t=""){var l;const s=[],o=this.tableScope.tableModel,i=[];for(let c=0;c<o.getColumnCount();c++){const h=o.getColumnDef(c);((l=h==null?void 0:h.isVisible)==null?void 0:l.call(h))!==!1&&(O(h)&&!h.options.exported||i.push(c))}const r=["header","body","footer"];for(const c of r){const h=o.getAreaModel(c),d=(h==null?void 0:h.getRowCount())??0;for(let u=0;u<d;u++)s.push(i.map(f=>this.getExportValue(o,c,h,u,f)))}const n=this.tableScope.isRtl()?{rightToLeft:!0}:void 0;return Promise.resolve(n?this.tableScope.excelService.downloadExcel(s,e,t,n):this.tableScope.excelService.downloadExcel(s,e,t))}getExportValue(e,t,s,o,i){const r=e.getColumnDef(i);if(O(r)&&t!=="header")return t!=="body"?"":r.hasDefaultFormat()?r.getRowNumber(o,s):r.getRowNumberText(o,s);const n=s.getValueAt(o,i);if(t!=="header"&&typeof n=="number"&&this.tableScope.excelService.supportsNumberFormats){const l=$t(r)?r.pivot.value.showValuesAs:t==="body"?r==null?void 0:r.showValuesAs:void 0,c=zr(l);if(c)return{value:n,numberFormat:c}}return n}getColumnIndex(e){var s,o,i;const t=((o=(s=this.tableScope.tableModel).getColumnDefs)==null?void 0:o.call(s))??[];for(let r=0;r<t.length;r++)if(((i=t[r])==null?void 0:i.property)===e)return r;return-1}getTableScope(){return this.tableScope}getSelectionModel(){return this.tableScope.selectionModel()}getSelectionAggregates(){return new xt().aggregate(this.tableScope.tableModel,this.getSelectionModel())}autoResizeColumns(e=!0){this.tableScope.autoResizeColumns(e)}recalcWrappers(){this.tableScope.recalcWrappers()}setColumnWidth(e,t){this.tableScope.setColumnWidth(e,t)}getTableModel(){return this.tableScope.tableModel}getBodyModel(){return this.tableScope.tableModel.getBodyModel()}setRows(e){var s;const t=this.getBodyModel();t instanceof q?(t.setRows(e),(s=this.tableScope.batchEditService)==null||s.pruneOrphans(),this.tableScope.invalidateRowLayout()):console.warn("setRows<T>(rows: T[]) only works with AreaModelObjectArray<T>, but this body area model is ",typeof t,t)}addRows(e){const t=this.getBodyModel();if(t instanceof q){const s=t;let o=s.getAllRows();s.setRows([...o,...e])}else console.warn("addRows<T>(rows: T[]) only works with AreaModelObjectArray<T>, but this body area model is ",typeof t,t)}addRowsAt(e,t){const s=this.getBodyModel();if(s instanceof q){const o=s;let i=o.getAllRows();o.setRows([...i.slice(0,t),...e,...i.slice(t)])}else console.warn("addRowsAt<T>(rows: T[]) only works with AreaModelObjectArray<T>, but this body area model is ",typeof s,s)}removeRows(e,t=(s,o)=>s===o){const s=this.getBodyModel();if(s instanceof q){const o=s,i=o.getAllRows().filter(r=>!e.some(n=>t(r,n)));o.setRows(i)}else console.warn("removeRows<T>(rows: T[]) only works with AreaModelObjectArray<T>, but this body area model is ",typeof s,s)}findRows(e,t=(s,o)=>s===o){const s=this.getBodyModel();return s instanceof q?s.getAllRows().filter(i=>e.some(r=>t(i,r))):(console.warn("findRows<T>(rows: T[], predicate: (a: T, b: T) => boolean) only works with AreaModelObjectArray<T>, but this body area model is ",typeof s,s),[])}findRowFromFilteredRowsByAllCriteria(e,t){const s=this.getBodyModel();if(s instanceof q)return s.getFilteredRows().find(i=>t(e,i));console.warn("findRowFromFilteredRowsByAllCriteria(...) only works with AreaModelObjectArray<T>, but this body area model is ",typeof s,s)}findRowFromAllRowsByAllCriteria(e,t){const s=this.getBodyModel();if(s instanceof q)return s.getAllRows().find(i=>t(e,i));console.warn("findRowFromAllRowsByAllCriteria(...) only works with AreaModelObjectArray<T>, but this body area model is ",typeof s,s)}updateRows(e,t=(s,o)=>s===o){const s=this.getBodyModel();if(s instanceof q){let i=s.getAllRows();for(const r of i)for(const n of e)if(t(r,n))for(const l of Object.keys(n))r[l]=n[l]}else console.warn("updateRows<T>(rows: T[], predicate: (a: T, b: T) => boolean) only works with AreaModelObjectArray<T>, but this body area model is ",typeof s,s)}sortByColumn(e,t){return this.tableScope.sortByColumn(e,t)}reSort(){this.tableScope.reSort()}expandAll(){this.tableScope.toggleExpandCollapseAll(!0)}collapseAll(){this.tableScope.toggleExpandCollapseAll(!1)}setRowExpanded(e,t){const s=this.tableScope.tableModel.getBodyModel().getRowByIndex(e);return L(s)?this.tableScope.setTreeRowExpanded(s,t):!1}setRowGroupBy(e){return this.tableScope.setRowGroupBy(e)}getRowGroupBy(){const e=this.tableScope.tableModel.getBodyModel();return X(e)?e.getGroupBy():void 0}setPivotConfig(e,t){return this.tableScope.setPivotConfig(e,t)}getPivotConfig(){const e=this.tableScope.tableModel;return Bs(e)?e.getPivotConfig():void 0}getRowValue(e,t){const s=this.tableScope.tableModel.getBodyModel();if(typeof s.getRowValue=="function")return s.getRowValue(e,t);const o=L(e)?e.data:e;if(o==null)return;let i=o;for(const r of t.split(".")){if(i==null)return;i=i[r]}return i}setShowValuesAs(e,t){const s=(this.tableScope.tableModel.getColumnDefs()??[]).filter(o=>o.property===e);return!s.length||t!==void 0&&!Ge(t)?!1:(s.forEach(o=>o.showValuesAs=t),this.repaint(),!0)}getShowValuesAs(e){var t,s;return(s=(t=this.tableScope.tableModel.getColumnDefs())==null?void 0:t.find(o=>o.property===e))==null?void 0:s.showValuesAs}setColumnFormula(e,t,s){const o=(this.tableScope.tableModel.getColumnDefs()??[]).filter(n=>n.property===e);if(!o.length)return new E("#NAME?",`No column "${e}"`);const i=Xs(t,s),r=Js(i);return o.forEach(n=>{n.formula=i.source,n.valueGetter=r}),this.repaint(),i.error}sort(e){this.tableScope.sort(e)}moveRows(e,t){const s=this.tableScope.rowDragService;if(!s)return!1;const o=Array.isArray(e)?e:[e];let i;if(typeof t=="number"){const r=this.tableScope.tableModel.getBodyModel().getRowCount();i=t>=r?{rowIndex:r-1,position:"after"}:{rowIndex:Math.max(0,t),position:"before"}}else i=t;return s.moveRows(o,i,!0)>-1}isRowDragging(){var e;return!!((e=this.tableScope.rowDragService)!=null&&e.isDragging())}cancelRowDrag(){var e;(e=this.tableScope.rowDragService)==null||e.cancel()}applyCellChanges(e,t="api"){return this.tableScope.applyCellChanges(e,t)}fillRange(e,t,s,o="auto"){return this.tableScope.fillRange(e,t,s,o)}isFilling(){var e;return!!((e=this.tableScope.fillHandleService)!=null&&e.isFilling())}cancelFill(){var e;(e=this.tableScope.fillHandleService)==null||e.cancel()}setDetailExpanded(e,t){return this.tableScope.setDetailExpanded(e,t,"api")}toggleDetail(e){return this.tableScope.toggleDetail(e,"api")}isDetailExpanded(e){var t;return!!((t=this.tableScope.masterDetailService)!=null&&t.isExpanded(e))}getExpandedDetailRows(){var e;return((e=this.tableScope.masterDetailService)==null?void 0:e.getExpandedRows())??[]}expandAllDetails(){var e;return((e=this.tableScope.masterDetailService)==null?void 0:e.expandAll())??0}collapseAllDetails(){var e;return((e=this.tableScope.masterDetailService)==null?void 0:e.collapseAll())??0}refreshDetail(e){var t;return!!((t=this.tableScope.masterDetailService)!=null&&t.refresh(e))}getDetailElement(e){var t;return(t=this.tableScope.masterDetailService)==null?void 0:t.getDetailElement(e)}startBatchEdit(){var t;const e=!!((t=this.tableScope.batchEditService)!=null&&t.start());return e&&this.tableScope.repaint(),e}isBatchEditing(){var e;return!!((e=this.tableScope.batchEditService)!=null&&e.isActive())}hasPendingChanges(){var e,t;return(e=this.tableScope.batchEditService)==null||e.pruneOrphans(),!!((t=this.tableScope.batchEditService)!=null&&t.hasPending())}getPendingChanges(){var e;return((e=this.tableScope.batchEditService)==null?void 0:e.getPendingChanges())??[]}commitBatchEdit(){var e;return!!((e=this.tableScope.batchEditService)!=null&&e.commit())}cancelBatchEdit(){var e;(e=this.tableScope.batchEditService)==null||e.cancel()}ensureRowIsVisible(e){return this.tableScope.ensureRowIsVisible(e)}ensureColumnIsVisible(e){return this.tableScope.ensureColumnIsVisible(e)}getDisplayedRowCount(){return this.tableScope.getDisplayedRowCount()}getFirstVisibleRowIndex(){return this.tableScope.getFirstVisibleRowIndex()}getFirstFullVisibleRowIndex(){return this.tableScope.getFirstFullVisibleRowIndex()}getLastVisibleRowIndex(){return this.tableScope.getLastVisibleRowIndex()}getLastFullVisibleRowIndex(){return this.tableScope.getLastFullVisibleRowIndex()}setLoggingActive(e){this.tableScope.loggingActive=e}isLoggingActive(){return this.tableScope.loggingActive}}class te{constructor(e=0,t=0,s=0,o=0,i){this.left=e,this.width=t,this.height=s,this.top=o,this.index=i}}const et=class et{constructor(e){this.prefix=e}static createPrefix(e){const t=(e??"").trim();return t?`ge-${t.replace(/\s+/g,"_")}`:(et.counter++,`ge-t${et.counter}`)}cell(e,t,s){return`${this.prefix}-${e}-r${t}-c${s}`}rowGroup(e,t){return`${this.prefix}-rg-${e}-${t}`}detailRowGroup(){return`${this.prefix}-rg-detail`}liveRegion(){return`${this.prefix}-live`}};et.counter=0;let ot=et;class Xt{constructor(){this.loadingText="Loading…",this.noRowsText="No rows to show",this.noMatchesText="No matching rows",this.autoNoRows=!0,this.blockInteractionWhileLoading=!0,this.loadingDelayInMs=0,this.getOverlayElement=void 0}static create(e){const t=new Xt;if(e)for(const s of Object.keys(e))e[s]!==void 0&&(t[s]=e[s]);return t}}function ps(a){return a.manual?a.manual:!a.autoNoRows||a.rowCount!==0?"none":(a.unfilteredRowCount??0)>0?"noMatches":"noRows"}const mo={none:"",loading:"ge-table-overlay-loading",noRows:"ge-table-overlay-no-rows",noMatches:"ge-table-overlay-no-matches"};class Zo{constructor(e,t,s,o=()=>{}){this.dom=t,this.requestUpdate=o,this.shownKind="none",this.shownText="",this.shownBlocking=!1,this.bounds="",this.destroyed=!1,this.options=Xt.create(s),this.element=t.applyStylePosistionAbsolute(t.createDivWithClass("ge-table-overlay",e)),t.setAriaHidden(this.element),t.applyDisplayNoneStyle(this.element),this.contentElement=t.createDivWithClass("ge-table-overlay-content",this.element)}showLoading(e){var o;if(this.destroyed)return;const t=((o=this.manual)==null?void 0:o.kind)==="loading";this.manual={kind:"loading",text:e};const s=this.options.loadingDelayInMs;!t&&s>0&&!this.delayTimeout&&(this.delayTimeout=setTimeout(()=>{this.delayTimeout=void 0,this.requestUpdate()},s)),this.requestUpdate()}showNoRows(e){this.destroyed||(this.clearDelay(),this.manual={kind:"noRows",text:e},this.requestUpdate())}hide(){this.destroyed||!this.manual||(this.clearDelay(),this.manual=void 0,this.requestUpdate())}getState(){return this.shownKind}isBlocking(){return this.shownBlocking}isEventBlocked(e){const t=e.target;return this.shownBlocking&&t instanceof Node&&this.element.contains(t)}update(e,t){var l;if(this.destroyed)return;const s=this.options.autoNoRows,o=this.delayTimeout?ps({rowCount:e,unfilteredRowCount:t,autoNoRows:s}):ps({manual:(l=this.manual)==null?void 0:l.kind,rowCount:e,unfilteredRowCount:t,autoNoRows:s}),i=this.getText(o),r=o==="loading"&&this.options.blockInteractionWhileLoading;if(o===this.shownKind&&i===this.shownText&&r===this.shownBlocking)return;const n=this.shownKind;return this.render(o,i,r),{previous:n,kind:o,text:i}}setBounds(e,t,s,o){const i=`${e},${t},${s},${o}`;this.destroyed||i===this.bounds||(this.bounds=i,this.dom.applyStyle(this.element,{left:`${e}px`,top:`${t}px`,width:`${Math.max(0,s)}px`,height:`${Math.max(0,o)}px`}))}destroy(){this.destroyed||(this.destroyed=!0,this.clearDelay(),this.contentElement.replaceChildren(),this.element.remove(),this.manual=void 0,this.shownKind="none",this.shownBlocking=!1)}getText(e){var s,o;const t=this.options;switch(e){case"loading":return((s=this.manual)==null?void 0:s.text)??t.loadingText;case"noRows":return(((o=this.manual)==null?void 0:o.kind)==="noRows"?this.manual.text:void 0)??t.noRowsText;case"noMatches":return t.noMatchesText;default:return""}}render(e,t,s){const o=this.dom,i=this.element;if(this.shownKind!=="none"&&o.removeClass(mo[this.shownKind],i),this.contentElement.replaceChildren(),e==="none")o.removeClass("ge-table-overlay-visible",i),o.applyDisplayNoneStyle(i);else{o.addClass(`ge-table-overlay-visible ${mo[e]}`,i),o.setStyle(i,"display","flex");const r=this.getOwnElement(e,t);if(r)o.domService.appendChild(this.contentElement,r);else{e==="loading"&&o.createDivWithClass("ge-table-spinner",this.contentElement);const n=o.createDivWithClass("ge-table-overlay-text",this.contentElement);n.textContent=t}}s?o.addClass("ge-table-overlay-blocking",i):o.removeClass("ge-table-overlay-blocking",i),this.shownKind=e,this.shownText=t,this.shownBlocking=s}getOwnElement(e,t){var s,o;try{return(o=(s=this.options).getOverlayElement)==null?void 0:o.call(s,e,t)}catch(i){console.error("TableOverlay: getOverlayElement failed, the built-in content is shown",i);return}}clearDelay(){this.delayTimeout&&(clearTimeout(this.delayTimeout),this.delayTimeout=void 0)}}const Pt=class Pt{constructor(e,t,s,o){this.hostElement=e,this.tableModel=t,this.dom=s,this.tableOptions=o,this.scrollTop=0,this.areaBodyWestGeo=new te,this.areaBodyCenterGeo=new te,this.areaBodyEastGeo=new te,this.hostAttributesBefore=new Map;const i=this.hostElement;i.innerText="",this.direction=Bo(o==null?void 0:o.direction,i),this.dom.setDirection(this.direction),this.dom.setAttribute(i,"tabindex","0"),this.ariaIds=new ot(ot.createPrefix(i.id)),this.initHostAria(),this.setHostAriaAttribute("dir",this.direction),this.dom.setStyle(this.dom.addClass("ge-table",i),"position","relative"),this.hoverRow=s.applyStylePosistionAbsolute(s.createDivWithClass("ge-table-hover-row",i)),this.hoverColumn=s.applyStylePosistionAbsolute(s.createDivWithClass("ge-table-hover-column",i)),this.draggingColumn=s.applyStylePosistionAbsolute(s.createDivWithClass("ge-table-dragging-column",i)),this.areaHeaderWest=s.appendRelativeChildDiv(s.applyStylePosistionAbsolute(s.createAreaDivWithClass("ge-table-header ge-table-header-west",i,"header","west"))),this.areaHeaderCenter=s.appendRelativeChildDiv(s.applyStylePosistionAbsolute(s.createAreaDivWithClass("ge-table-header ge-table-header-center",i,"header","center"))),this.areaHeaderEast=s.appendRelativeChildDiv(s.applyStylePosistionAbsolute(s.createAreaDivWithClass("ge-table-header ge-table-header-east",i,"header","east"))),this.areaBodyWest=s.appendRelativeChildDiv(s.applyStylePosistionAbsolute(s.createAreaDivWithClass("ge-table-body ge-table-body-west",i,"body","west"))),this.areaBodyEast=s.appendRelativeChildDiv(s.applyStylePosistionAbsolute(s.createAreaDivWithClass("ge-table-body ge-table-body-east",i,"body","east"))),this.areaFooterWest=s.appendRelativeChildDiv(s.applyStylePosistionAbsolute(s.createAreaDivWithClass("ge-table-footer ge-table-footer-west",i,"footer","west"))),this.areaFooterCenter=s.appendRelativeChildDiv(s.applyStylePosistionAbsolute(s.createAreaDivWithClass("ge-table-footer ge-table-footer-center",i,"footer","center"))),this.areaFooterEast=s.appendRelativeChildDiv(s.applyStylePosistionAbsolute(s.createAreaDivWithClass("ge-table-footer ge-table-footer-east",i,"footer","east"))),this.scrollViewport=s.applyStyleOverflowAuto(this.tableOptions.overflowX??"auto",this.tableOptions.overflowY??"auto",s.applyStyleNoPadding(s.applyStylePosistionAbsolute(s.createAreaDivWithClass("ge-table-scroll-viewport",i,"body","center")))),this.contentWrapperDiv=s.applyStyleNoPadding(s.applyStylePosistionRelative(s.createDivWithClass("ge-table-scroll-content-wrapper",this.scrollViewport))),this.contentDiv=s.applyStyleNoPadding(s.applyStylePosistionRelative(s.createDivWithClass("ge-table-scroll-content",this.contentWrapperDiv))),this.areaBodyCenter=s.appendRelativeChildDiv(s.createDivWithClass("ge-table-body-center",this.contentDiv)),this.borderHeaderBottom=s.applyStylePosistionAbsolute(s.createDivWithClass("ge-table-header-border",i)),this.borderFixedWest=s.applyStylePosistionAbsolute(s.createDivWithClass("ge-table-west-fixed-column-border",i)),this.borderFixedEast=s.applyStylePosistionAbsolute(s.createDivWithClass("ge-table-east-fixed-column-border",i)),this.borderFooterTop=s.applyStylePosistionAbsolute(s.createDivWithClass("ge-table-footer-border",i)),[this.hoverRow,this.hoverColumn,this.draggingColumn,this.borderHeaderBottom,this.borderFixedWest,this.borderFixedEast,this.borderFooterTop].forEach(n=>s.setAriaHidden(n)),o!=null&&o.shortcutActionsDisabled||s.setAttribute(this.scrollViewport,"tabindex","-1"),[this.areaHeaderWest,this.areaHeaderCenter,this.areaHeaderEast,this.areaBodyWest,this.areaBodyEast,this.areaFooterWest,this.areaFooterCenter,this.areaFooterEast,this.areaBodyCenter].forEach(n=>s.setAttribute(n.parent,"role","presentation")),s.setAttribute(this.contentWrapperDiv,"role","presentation"),s.setAttribute(this.contentDiv,"role","presentation");const r=[];for(const n of["header","body","footer"])for(const l of["west","center","east"]){const c=this.ariaIds.rowGroup(n,l),h=this.getAreaChild(n,l);s.setAttribute(h,"id",c),s.setAttribute(h,"role","presentation"),r.push(c)}this.setHostAriaAttribute("aria-owns",r.join(" ")),this.tableOverlay=new Zo(i,s,o==null?void 0:o.overlayOptions,()=>this.updateOverlay())}isRtl(){return this.direction==="rtl"}getViewportScrollLeft(){return No(this.scrollViewport,this.isRtl())}setViewportScrollLeft(e){Ho(this.scrollViewport,e,this.isRtl())}clientXToHostX(e){const t=this.hostElement,s=t.getBoundingClientRect();return $o(e,s.left+t.clientLeft,t.clientWidth,this.isRtl())}updateOverlay(){}setHostAriaAttribute(e,t){const s=this.hostElement;this.hostAttributesBefore.has(e)||this.hostAttributesBefore.set(e,s.getAttribute(e)),t===void 0?s.hasAttribute(e)&&this.dom.removeAttribute(s,e):s.getAttribute(e)!==t&&this.dom.setAttribute(s,e,t)}restoreHostAriaAttribute(e){const t=this.hostAttributesBefore.get(e)??null;t===null?this.hostElement.hasAttribute(e)&&this.dom.removeAttribute(this.hostElement,e):this.hostElement.getAttribute(e)!==t&&this.dom.setAttribute(this.hostElement,e,t)}removeHostAria(){this.hostAttributesBefore.forEach((e,t)=>{e===null?this.dom.removeAttribute(this.hostElement,t):this.dom.setAttribute(this.hostElement,t,e)}),this.hostAttributesBefore.clear()}initHostAria(){const e=this.tableOptions,t=B(this.tableModel.getAreaModel("body"));this.setHostAriaAttribute("role",t?"treegrid":"grid"),e!=null&&e.ariaLabelledBy?this.setHostAriaAttribute("aria-labelledby",e.ariaLabelledBy):e!=null&&e.ariaLabel&&this.setHostAriaAttribute("aria-label",e.ariaLabel),e!=null&&e.ariaDescribedBy&&this.setHostAriaAttribute("aria-describedby",e.ariaDescribedBy)}getAreaChild(e,t){return{"header-west":this.areaHeaderWest,"header-center":this.areaHeaderCenter,"header-east":this.areaHeaderEast,"body-west":this.areaBodyWest,"body-center":this.areaBodyCenter,"body-east":this.areaBodyEast,"footer-west":this.areaFooterWest,"footer-center":this.areaFooterCenter,"footer-east":this.areaFooterEast}[`${e}-${t}`].child}adjustContainersAndRows(){const e=this.tableModel.getPadding(),t=this.hostElement.clientWidth,s=this.hostElement.clientHeight;this.dom.applyStyle(this.scrollViewport,{width:`${t-e.left}px`,height:`${s-e.top}px`,top:`${e.top}px`,left:`${e.left}px`}),this.scrollTop=this.scrollViewport.scrollTop,this.dom.applyStyle(this.contentDiv,{width:`${this.scrollViewport.clientWidth}px`,height:`${this.scrollViewport.clientHeight}px`,top:`${this.scrollTop}px`,left:`${this.getViewportScrollLeft()}px`}),this.areaBodyWestGeo.width=e.left,this.areaBodyWestGeo.height=s-e.top-e.bottom,this.areaBodyWestGeo.top=e.top,this.areaBodyWestGeo.left=0,this.dom.applyStyleInPx(this.areaBodyWest.parent,this.areaBodyWestGeo),this.tableOptions.fixedWestSeparatorBorderVisible&&this.tableModel.getFixedLeftColumnCount()?this.dom.applyDisplayBlockStyle(this.dom.applyStyle(this.borderFixedWest,{width:"1px",height:`${this.areaBodyWestGeo.height}px`,top:`${this.areaBodyWestGeo.top}px`,left:`${this.areaBodyWestGeo.width}px`})):this.dom.applyDisplayNoneStyle(this.borderFixedWest),this.areaBodyEastGeo.width=e.right,this.areaBodyEastGeo.height=s-e.top-e.bottom,this.areaBodyEastGeo.top=e.top,this.areaBodyEastGeo.left=t-e.right,this.dom.applyStyleInPx(this.areaBodyEast.parent,this.areaBodyEastGeo),this.tableOptions.fixedEastSeparatorBorderVisible&&this.tableModel.getFixedRightColumnCount()?this.dom.applyDisplayBlockStyle(this.dom.applyStyle(this.borderFixedEast,{width:"1px",height:`${this.areaBodyEastGeo.height}px`,top:`${this.areaBodyEastGeo.top}px`,left:`${this.areaBodyEastGeo.left}px`})):this.dom.applyDisplayNoneStyle(this.borderFixedEast),this.areaBodyCenterGeo.width=t-e.left-e.right,this.areaBodyCenterGeo.height=s-e.top-e.bottom,this.areaBodyCenterGeo.top=0,this.areaBodyCenterGeo.left=0,this.dom.applyStyleInPx(this.areaBodyCenter.parent,this.areaBodyCenterGeo),this.dom.applyStyle(this.areaHeaderCenter.parent,{width:`${t-e.left-e.right}px`,height:`${e.top}px`,top:"0",left:`${e.left}px`}),this.dom.applyStyle(this.areaHeaderWest.parent,{width:`${e.left}px`,height:`${e.top}px`,top:"0",left:"0"}),this.dom.applyStyle(this.areaHeaderEast.parent,{width:`${e.right}px`,height:`${e.top}px`,top:"0",left:`${t-e.right}px`}),this.tableOptions.headerSeparatorBorderVisible&&this.tableModel.isHeaderVisibe()?this.dom.applyDisplayBlockStyle(this.dom.applyStyle(this.borderHeaderBottom,{width:`${t}px`,height:"1px",top:`${e.top}px`,left:"0px"})):this.dom.applyDisplayNoneStyle(this.borderHeaderBottom),this.dom.applyStyle(this.areaFooterWest.parent,{width:`${e.left}px`,height:`${e.bottom}px`,top:`${s-e.bottom}px`,left:"0"}),this.dom.applyStyle(this.areaFooterCenter.parent,{width:`${t-e.left-e.right}px`,height:`${e.bottom}px`,top:`${s-e.bottom}px`,left:`${e.left}px`}),this.dom.applyStyle(this.areaFooterEast.parent,{width:`${e.right}px`,height:`${e.bottom}px`,top:`${s-e.bottom}px`,left:`${t-e.right}px`}),this.tableOptions.footerSeparatorBorderVisible&&this.tableModel.isFooterVisibe()?this.dom.applyDisplayBlockStyle(this.dom.applyStyle(this.borderFooterTop,{width:`${t}px`,height:"1px",top:`${s-e.bottom}px`,left:"0px"})):this.dom.applyDisplayNoneStyle(this.borderFooterTop),this.tableOverlay.setBounds(0,e.top,Math.min(t,e.left+this.scrollViewport.clientWidth),s-e.top-e.bottom),this.adjustDetailLayerBounds(0,e.top,Math.min(t,e.left+this.scrollViewport.clientWidth),Math.max(0,Math.min(s-e.top-e.bottom,this.scrollViewport.clientHeight))),this.adjustAfterScrolling()}adjustDetailLayerBounds(e,t,s,o){}adjustAfterScrolling(){}getBodyContentHeight(){return this.tableModel.getContentHeightInPixel()}resetSizeOfWrapperDiv(){const e=`${this.tableModel.getContentWidthInPixel()}px`,t=this.getBodyContentHeight()+1,s=`${Math.min(t,Pt.maxScrollHeightInPx)}px`;this.dom.setStyle(this.contentWrapperDiv,"width",e),this.dom.setStyle(this.contentWrapperDiv,"height",s)}};Pt.maxScrollHeightInPx=8e6;let it=Pt;class pe{constructor(e="none",t="single"){this.selectionType=e,this.selectionMode=t,this.ranges=[],this.negativeRanges=[],this.allSelected=!1,this.silent=!1,this.listenerArr=[]}getEventSelectionChangedListeners(){return this.listenerArr}addEventSelectionChangedListener(e){this.listenerArr.includes(e)||this.listenerArr.push(e)}removeEventSelectionChangedListener(e){const t=this.listenerArr.indexOf(e,0);t>-1&&this.listenerArr.splice(t,1)}fireChangeEvent(){this.silent||this.listenerArr.forEach(e=>e.onSelectionChanged(this))}firstClick(e,t){this.selectionType==="row"?this.addRange(A.singleRow(e)):this.selectionType==="column"?this.addRange(A.singleColumn(t)):(this.selectionType==="cell"||this.selectionType==="range")&&this.addRange(A.singleCell(e,t))}createSnapshot(){return{ranges:[...this.ranges],negativeRanges:[...this.negativeRanges],allSelected:this.allSelected}}restoreSnapshot(e){this.ranges=[...e.ranges],this.negativeRanges=[...e.negativeRanges],this.allSelected=e.allSelected,this.fireChangeEvent()}getSelectionCount(e,t){let s=0;for(const o of this.ranges)o.isInRange(e,t)&&s++;return this.allSelected&&s++,this.isInNegativeRange(e,t)&&(s=0),s}isInNegativeRange(e,t){for(const s of this.negativeRanges)if(s.isInRange(e,t))return!0;return!1}getRanges(){return this.ranges}clear(){this.ranges=[],this.negativeRanges=[],this.allSelected=!1,this.fireChangeEvent()}hasSelection(){return this.allSelected||!!this.ranges.length}hasNoSelection(){return!this.hasSelection()}getMergedRowIndices(e){const t=e===void 0?void 0:e-1,s=[...this.ranges];this.allSelected&&t!==void 0&&s.push(new A(0,0,t,Number.MAX_SAFE_INTEGER));const o=new Set;for(const i of s){const r=Math.max(i.r1,0),n=t===void 0?i.r2:Math.min(i.r2,t);if(t===void 0&&!(n<Number.MAX_SAFE_INTEGER))continue;const l=this.negativeRanges.filter(c=>pe.intersects(c,i));for(let c=r;c<=n;c++)!o.has(c)&&(!l.length||!pe.coversColumns(l,c,i.c1,i.c2))&&o.add(c)}return Array.from(o).sort((i,r)=>i-r)}selectAll(){this.selectionType!=="none"&&(this.allSelected=!0,this.negativeRanges=[],this.fireChangeEvent())}isAllSelected(){return this.allSelected}addSelection(e){this.addRange(e)}removeSelection(e){if(this.selectionType==="none")return;let t=e;this.selectionType==="row"?t=new A(e.r1,0,e.r2,Number.MAX_SAFE_INTEGER):this.selectionType==="column"&&(t=new A(0,e.c1,Number.MAX_SAFE_INTEGER,e.c2)),this.negativeRanges.push(t),this.ranges=this.ranges.filter(s=>!this.isCoveredByNegativeRanges(s)),this.fireChangeEvent()}togglePoint(e,t){this.getSelectionCount(e,t)>0?this.removeSelection(A.singleCell(e,t)):this.reselectPoint(e,t)?this.fireChangeEvent():this.addSelection(A.singleCell(e,t))}isSelected(e,t){return this.getSelectionCount(e,t)>0}addRange(e){this.selectionType!=="none"&&(this.allSelected=!1,this.selectionMode==="single"&&(this.ranges=[],this.negativeRanges=[]),this.adjustRangeToSelectionType(e),this.liftNegativeRanges(e),this.ranges.push(e),this.fireChangeEvent())}adjustRangeToSelectionType(e){return this.selectionType==="row"?(e.c1=0,e.c2=Number.MAX_SAFE_INTEGER):this.selectionType==="column"?(e.r1=0,e.r2=Number.MAX_SAFE_INTEGER):this.selectionType==="cell"?(e.r2=e.r1,e.c2=e.c1):this.selectionType,e}reselectPoint(e,t){return this.selectionType==="none"||!this.isInNegativeRange(e,t)||!this.allSelected&&!this.ranges.some(s=>s.isInRange(e,t))?!1:(this.liftNegativeRanges(this.adjustRangeToSelectionType(A.singleCell(e,t))),!0)}liftNegativeRanges(e){if(!this.negativeRanges.length)return;const t=[];for(const s of this.negativeRanges){const o=Math.max(s.r1,e.r1),i=Math.min(s.r2,e.r2),r=Math.max(s.c1,e.c1),n=Math.min(s.c2,e.c2);if(o>i||r>n){t.push(s);continue}s.r1<o&&t.push(new A(s.r1,s.c1,o-1,s.c2,s.gammaRange)),i<s.r2&&t.push(new A(i+1,s.c1,s.r2,s.c2,s.gammaRange)),s.c1<r&&t.push(new A(o,s.c1,i,r-1,s.gammaRange)),n<s.c2&&t.push(new A(o,n+1,i,s.c2,s.gammaRange))}this.negativeRanges=t}isCoveredByNegativeRanges(e){let t=[e];for(const s of this.negativeRanges)if(t=t.flatMap(o=>pe.difference(o,s)),!t.length)return!0;return!1}static difference(e,t){const s=Math.max(e.r1,t.r1),o=Math.min(e.r2,t.r2),i=Math.max(e.c1,t.c1),r=Math.min(e.c2,t.c2);if(s>o||i>r)return[e];const n=[];return e.r1<s&&n.push(new A(e.r1,e.c1,s-1,e.c2)),o<e.r2&&n.push(new A(o+1,e.c1,e.r2,e.c2)),e.c1<i&&n.push(new A(s,e.c1,o,i-1)),r<e.c2&&n.push(new A(s,r+1,o,e.c2)),n}static intersects(e,t){return Math.max(e.r1,t.r1)<=Math.min(e.r2,t.r2)&&Math.max(e.c1,t.c1)<=Math.min(e.c2,t.c2)}static coversColumns(e,t,s,o){const i=e.filter(n=>n.r1<=t&&t<=n.r2&&n.c1<=n.c2).sort((n,l)=>n.c1-l.c1);let r=s;for(const n of i){if(n.c1>r)return!1;if(n.c2>=r&&(r=n.c2+1),r>o)return!0}return r>o}}class Qo{constructor(e="none"){this.selectionType=e,this.rowIndex=-1,this.columnIndex=-1,this.changed=!1,this.listenerArr=[]}getEventFocusChangedListeners(){return this.listenerArr}addEventFocusChangedListener(e){this.listenerArr.includes(e)||this.listenerArr.push(e)}removeEventFocusChangedListener(e){const t=this.listenerArr.indexOf(e,0);t>-1&&this.listenerArr.splice(t,1)}fireChangeEvent(){this.listenerArr.forEach(e=>e.onFocusChanged(this))}clearChanged(){this.changed=!1}hasChanged(){return this.changed}clear(){this.rowIndex=-1,this.columnIndex=-1,this.fireChangeEvent()}setFocus(e,t){(this.rowIndex!==e||this.columnIndex!==t)&&(this.rowIndex=e,this.columnIndex=t,this.changed=!0,this.fireChangeEvent())}hasFocus(e,t){return this.rowIndex===e&&this.columnIndex===t}getFocus(){return[this.rowIndex,this.columnIndex]}}class ei{constructor(e,t){this.tableModel=e,this.areaModel=t,this.colAndRowspanRanges=void 0,this.rowCountAtInit=-1}init(){if(this.rowCountAtInit=this.areaModel.getRowCount(),this.areaModel.getMaxColspan()<2&&this.areaModel.getMaxRowspan()<2){this.colAndRowspanRanges=void 0;return}this.colAndRowspanRanges=[];const e=this.areaModel.getRowCount(),t=this.tableModel.getColumnCount();for(let s=0;s<e;s++)for(let o=0;o<t;o++){let i=this.areaModel.getColspanAt(s,o),r=this.areaModel.getRowspanAt(s,o);if(i>1||r>1){i===0&&(i=1),r===0&&(r=1);const n="gammaCells"in this.areaModel;this.colAndRowspanRanges.push(new A(s,o,s+r-1,o+i-1,n))}}}initIfRowCountChanged(){return this.areaModel.getRowCount()===this.rowCountAtInit?!1:(this.init(),!0)}getRanges(){return this.colAndRowspanRanges?this.colAndRowspanRanges:[]}isInRange(e,t){if(this.colAndRowspanRanges){for(const s of this.colAndRowspanRanges)if(s.isInRange(e,t))return!0}return!1}}class V{constructor(e,t,s){this.header=e,this.body=t,this.footer=s}}function rt(a){return a!=null&&a.length&&O(a[0])?1:0}class nt{constructor(e,t,s,o){this.headerRowCount=e,this.bodyRowCount=t,this.footerRowCount=s,this.colIndexMap=o}static create(e){var l,c,h;const t=e.isHeaderVisibe()?Math.max(0,((l=e.getAreaModel("header"))==null?void 0:l.getRowCount())??0):0,s=e.isFooterVisibe()?Math.max(0,((c=e.getAreaModel("footer"))==null?void 0:c.getRowCount())??0):0,o=((h=e.getAreaModel("body"))==null?void 0:h.getRowCount())??0,i=e.getColumnCount(),r=new Array(Math.max(0,i));let n=0;for(let d=0;d<i;d++)r[d]=e.getColumnWidth(d)>0?++n:0;return new nt(t,o,s,r)}get rowCount(){return this.bodyRowCount<0?-1:this.headerRowCount+this.bodyRowCount+this.footerRowCount}get colCount(){let e=0;for(const t of this.colIndexMap)t>0&&e++;return e}rowIndex(e,t){return e==="header"?t+1:e==="body"?this.headerRowCount+t+1:this.headerRowCount+Math.max(0,this.bodyRowCount)+t+1}colIndex(e){return this.colIndexMap[e]??0}colSpan(e,t){let s=0;for(let o=e;o<e+t;o++)(this.colIndexMap[o]??0)>0&&s++;return Math.max(1,s)}}class ti{constructor(){this.positions=new WeakMap,this.sizes=new WeakMap}get(e,t){const s=e.getRowByIndex(t);if(!s)return;const o=e.getFilteredFlattenRows();o!==this.displayedRows&&(this.displayedRows=o,this.positions=new WeakMap,this.sizes=new WeakMap);const i=s.parent??e;let r=this.positions.get(i);if(!r){const l=s.parent?e.getDisplayedChildren(s.parent):e.getDisplayedRootRows();r=new Map,l.forEach((c,h)=>r.set(c,h+1)),this.positions.set(i,r),this.sizes.set(i,l.length)}const n=e.hasDisplayedChildren(s);return{level:(s.deep??0)+1,setSize:Math.max(1,this.sizes.get(i)??1),posInSet:r.get(s)??1,expanded:n?!!s.expanded:void 0}}}class Ee{static create(e){const t=new Ee;if(e)for(const s of Object.keys(e)){const o=e[s];typeof o=="function"&&(t[s]=o)}return t}sorted(e,t){return t==="asc"?`Sorted by ${e}, ascending`:t==="desc"?`Sorted by ${e}, descending`:`Sorting of ${e} removed`}filtered(e){return e===0?"No rows":e===1?"1 row":`${e} rows`}copied(e){return e===1?"1 cell copied":`${e} cells copied`}allSelected(){return"All cells selected"}selectionCleared(){return"Selection cleared"}selectRow(e){return`Select row ${e}`}selectAllRows(){return"Select all rows"}expandGroup(e){return e?`Expand group ${e}`:"Expand group"}collapseGroup(e){return e?`Collapse group ${e}`:"Collapse group"}rowDragStarted(e){return e===1?"Dragging 1 row. Press Escape to cancel.":`Dragging ${e} rows. Press Escape to cancel.`}rowMoved(e,t){return`Row moved to position ${e} of ${t}`}rowMoveNotPossible(){return"Rows cannot be moved while the table is sorted or filtered"}rowDragCancelled(){return"Drag cancelled"}cellsFilled(e){return e===1?"1 cell filled":`${e} cells filled`}detailExpanded(){return"Details expanded"}detailCollapsed(){return"Details collapsed"}fillTooLarge(e){return`Too many cells to fill (at most ${e})`}pendingChanges(e){return e===0?"No unsaved changes":e===1?"1 change not saved":`${e} changes not saved`}changesCommitted(e){return e===1?"1 change saved":`${e} changes saved`}changesDiscarded(){return"Changes discarded"}commitBlocked(e){return e===1?"1 invalid value – nothing saved":`${e} invalid values – nothing saved`}invalidValue(e){return e?`Invalid value: ${e}`:"Invalid value"}}class si{constructor(){this.rowCount=0,this.heightOf=()=>0,this.extraIndices=new Int32Array(0),this.extraHeights=new Float64Array(0),this.extraPrefix=new Float64Array(1)}setRows(e,t,s){if(this.rowCount=Math.max(0,Math.floor(e)||0),this.heightOf=t,this.constantHeight=s!==void 0&&s>0?s:void 0,this.prefix=void 0,this.extraIndices.length&&this.extraIndices[this.extraIndices.length-1]>=this.rowCount){const o=[],i=[];this.extraIndices.forEach((r,n)=>{r<this.rowCount&&(o.push(r),i.push(this.extraHeights[n]))}),this.setExtras(o,i)}}setExtras(e,t){const s=new Map;for(let i=0;i<e.length;i++){const r=e[i],n=t[i];r>=0&&r<this.rowCount&&n>0&&s.set(r,(s.get(r)??0)+n)}const o=Int32Array.from(s.keys()).sort();this.extraIndices=o,this.extraHeights=Float64Array.from(o,i=>s.get(i)),this.rebuildExtraPrefix()}setExtraHeight(e,t){const s=this.findExtra(e);return s<0||!(t>0)||this.extraHeights[s]===t?!1:(this.extraHeights[s]=t,this.rebuildExtraPrefix(),!0)}setExtra(e,t){if(!(e>=0&&e<this.rowCount))return!1;const s=this.findExtra(e);if(s>=0){if(t>0)return this.setExtraHeight(e,t);const n=Array.from(this.extraIndices),l=Array.from(this.extraHeights);return n.splice(s,1),l.splice(s,1),this.extraIndices=Int32Array.from(n),this.extraHeights=Float64Array.from(l),this.rebuildExtraPrefix(),!0}if(!(t>0))return!1;const o=this.countExtrasBelow(e),i=Array.from(this.extraIndices),r=Array.from(this.extraHeights);return i.splice(o,0,e),r.splice(o,0,t),this.extraIndices=Int32Array.from(i),this.extraHeights=Float64Array.from(r),this.rebuildExtraPrefix(),!0}getRowCount(){return this.rowCount}getExtraCount(){return this.extraIndices.length}hasPrefixSums(){return!!this.prefix}getRowHeight(e){if(this.constantHeight!==void 0)return this.constantHeight;const t=this.ensurePrefix();return e>=0&&e<this.rowCount?t[e+1]-t[e]:0}getExtraHeight(e){const t=this.findExtra(e);return t<0?0:this.extraHeights[t]}getExtraBefore(e){return this.extraPrefix[this.countExtrasBelow(e)]}getExtraTotal(){return this.extraPrefix[this.extraIndices.length]}getTop(e){const t=Math.min(Math.max(0,Math.floor(e)||0),this.rowCount);return this.getBaseTop(t)+this.extraPrefix[this.countExtrasBelow(t)]}getTotalHeight(){return this.getTop(this.rowCount)}findIndexAt(e){const t=this.rowCount;if(t<1)return-1;if(!(e>0))return 0;const s=this.constantHeight;if(s!==void 0&&!this.extraIndices.length){let r=Math.min(t-1,Math.floor(e/s));for(;r>0&&r*s>e;)r--;for(;r<t-1&&(r+1)*s<=e;)r++;return r}let o=0,i=t-1;for(;o<i;){const r=o+i>>>1;this.getTop(r+1)>e?i=r:o=r+1}return o}getBaseTop(e){return this.constantHeight!==void 0?e*this.constantHeight:this.ensurePrefix()[e]}ensurePrefix(){if(!this.prefix){const e=this.rowCount,t=new Float64Array(e+1);let s=0;for(let o=0;o<e;o++)s+=this.heightOf(o)||0,t[o+1]=s;this.prefix=t}return this.prefix}rebuildExtraPrefix(){const e=this.extraIndices.length,t=new Float64Array(e+1);for(let s=0;s<e;s++)t[s+1]=t[s]+this.extraHeights[s];this.extraPrefix=t}countExtrasBelow(e){const t=this.extraIndices;let s=0,o=t.length;for(;s<o;){const i=s+o>>>1;t[i]<e?s=i+1:o=i}return s}findExtra(e){const t=this.countExtrasBelow(e);return t<this.extraIndices.length&&this.extraIndices[t]===e?t:-1}}class oi extends it{constructor(e,t,s,o){var r,n,l,c;if(super(e,t,s,o),this.firstVisibleRowIndex=-1,this.lastVisibleRowIndex=-1,this.firstFullVisibleRowIndex=-1,this.lastFullVisibleRowIndex=-1,this.displayedRowCount=0,this.pixelLimitForFullVisible=5,this.loggingActive=!1,this.dragging=!1,this.editing=!1,this.storedColumnWidths=[],this.scrollLeft=0,this.scrollViewportLeft=0,this.scrollFactorY=0,this.scrollFactorX=0,this.cleanupFunctions={header:[],body:[],footer:[]},this.tree=!1,this.colAndRowspanModels=new V,this.draggingTargetColumnIndex=-1,this.contentScrollTop=0,this.removables=[],this.treeAriaInfo=new ti,this.ariaSelectionKind="none",this.renderedSpanCells=new Set,this.bodyRowLayout=new si,this.bodyRowLayoutDirty=!0,this.adjustingRowNumberWidth=!1,this.rowNumberRemeasureScheduled=!1,this.ariaTexts=Ee.create(o==null?void 0:o.ariaTexts),(n=(r=this.tableModel).getSelectionModel)!=null&&n.call(r))this.getSelectionModel=()=>this.tableModel.getSelectionModel();else if((l=this.tableOptions)!=null&&l.getSelectionModel)this.getSelectionModel=this.tableOptions.getSelectionModel;else{const h=new pe;this.getSelectionModel=()=>h}if((c=this.tableOptions)!=null&&c.getFocusModel)this.getFocusModel=this.tableOptions.getFocusModel;else{const h=new Qo("cell");this.getFocusModel=()=>h}B(t.getAreaModel("body"))&&(this.tree=!0),["header","body","footer"].forEach(h=>{var d;this.colAndRowspanModels[h]=new ei(t,t.getAreaModel(h)),(d=this.colAndRowspanModels[h])==null||d.init()})}getDomService(){return this.dom}getBodyViewport(){const e=this.hostElement,t=e.getBoundingClientRect();return{top:t.top+e.clientTop+this.tableModel.getPadding().top,height:this.areaBodyCenterGeo.height,left:t.left+e.clientLeft,width:this.scrollViewport.clientWidth,contentScrollTop:this.contentScrollTop}}getBodyCellRectInHost(e,t){const s=this.tableModel,o=s.getBodyModel(),i=s.getPadding(),r=this.hostElement.clientWidth,n=this.hostElement.clientHeight,l=i.top+this.getBodyRowTop(e)-this.contentScrollTop,c=this.getColumnLeftInHost(t,s.getXPosByColumnIndex(t)),h=s.getColumnCount(),d=s.getFixedLeftColumnCount(),u=s.getFixedRightColumnCount();let f=i.left,g=r-i.right;return t<d?(f=0,g=i.left):u>0&&t>=h-u&&(f=r-i.right,g=r),{left:c,top:l,width:s.getColumnWidth(t),height:o.getRowHeight(e),clipLeft:f,clipRight:g,clipTop:i.top,clipBottom:n-i.bottom}}getBodyCellAtHostPoint(e,t){const s=this.tableModel,i=s.getBodyModel().getRowCount(),r=s.getColumnCount();if(i<1||r<1)return[-1,-1];const n=s.getPadding(),l=this.hostElement.clientWidth,c=this.hostElement.clientHeight-n.top-n.bottom,h=Math.min(Math.max(t-n.top,0),Math.max(0,c-1))+this.contentScrollTop,d=this.getBodyRowIndexAtY(h),u=s.getFixedLeftColumnCount(),f=s.getFixedRightColumnCount();let g,p,m;if(u>0&&e<n.left)[g,p,m]=[0,u-1,e];else if(f>0&&e>=l-n.right){const w=r-f;[g,p,m]=[w,r-1,e-(l-n.right)+s.getXPosByColumnIndex(w)]}else{const w=l-n.right,y=Math.min(Math.max(e,n.left),Math.max(n.left,w-1));[g,p,m]=[u,r-f-1,y+this.getContentScrollLeft()]}let b=p;for(let w=g;w<=p;w++)if(m<s.getXPosByColumnIndex(w)+s.getColumnWidth(w)){b=w;break}return[d,Math.min(r-1,Math.max(g,b))]}getBodyRowLayout(){var o,i;const e=this.tableModel.getBodyModel(),t=e.getRowCount(),s=this.bodyRowLayout;if(this.bodyRowLayoutDirty||this.bodyRowLayoutModel!==e||s.getRowCount()!==t){this.bodyRowLayoutDirty=!1,this.bodyRowLayoutModel=e;const r=this.tableModel;s.setRows(t,l=>r.getRowHeight("body",l),(o=e.getConstantRowHeight)==null?void 0:o.call(e));const n=(i=this.masterDetailService)==null?void 0:i.computeExtras();s.setExtras((n==null?void 0:n.rowIndices)??[],(n==null?void 0:n.heights)??[])}return s}invalidateRowLayout(){this.bodyRowLayoutDirty=!0}setBodyRowExtra(e,t){const s=this.tableModel.getBodyModel();return this.bodyRowLayoutDirty||this.bodyRowLayoutModel!==s||this.bodyRowLayout.getRowCount()!==s.getRowCount()?!1:(this.bodyRowLayout.setExtra(e,t),!0)}hasBodyRowExtras(){var e;return!!((e=this.masterDetailService)!=null&&e.hasExpanded())&&this.getBodyRowLayout().getExtraCount()>0}getBodyRowTop(e){return this.hasBodyRowExtras()?this.getBodyRowLayout().getTop(e):this.tableModel.getBodyModel().getYPosByRowIndex(e)}getBodyRowIndexAtY(e){return this.getBodyRowLayout().findIndexAt(e)}getScrollerToContentRatioY(){if(!this.isScrollHeightCapped())return 1;const e=this.getContentScrollRangeY(),t=this.getScrollerRangeY();return e>0&&t>0?t/e:1}isEditing(){return this.editing}resetEditorRenderer(){this.editorRenderer=void 0,this.editorRendererRow=-1,this.editorRendererColumn=-1,this.editing=!1}clearSelection(e=!1){if(this.getSelectionModel){const t=this.getSelectionModel();t==null||t.clear(),e&&this.repaint()}}initRenderEditor(e,t){var o;let s=(o=this.tableModel.getColumnDef(t))==null?void 0:o.getEditRenderer;if(s||(s=this.tableOptions.getEditRenderer),s)if(this.editorRenderer=s(e,t),this.editorRenderer){this.editorRendererRow=e,this.editorRendererColumn=t,this.editing=!0,this.repaint();const i=this.hostElement.querySelector("input.ge-table-cell-editor-input");i&&i.focus()}else this.resetEditorRenderer()}repaint(){this.adjustAfterScrolling()}invalidateAggregates(e){var t,s;e||this.invalidateRowLayout();for(const o of["header","body","footer"])(s=(t=this.tableModel.getAreaModel(o))==null?void 0:t.invalidateDerivedValues)==null||s.call(t,e)}repaintHard(){var e;for(const t of["header","body","footer"])(e=this.colAndRowspanModels[t])==null||e.initIfRowCountChanged();this.tableModel.recalcHeightAndPadding(),this.invalidateRowLayout(),this.resetSizeOfWrapperDiv(),this.adjustContainersAndRows(),this.adjustAfterScrolling()}recalcColumnWidths(e){const t=this.getAvailableColumnWidth(e);t>0&&this.tableModel.setParentWidth(t),this.tableModel.init(),this.repaintHard()}getAvailableColumnWidth(e=this.hostElement.clientWidth){const t=Math.max(0,this.scrollViewport.offsetWidth-this.scrollViewport.clientWidth);return Math.max(0,e-this.tableModel.getPadding().left-t)}adjustAfterScrolling(){var i,r,n,l;if(!this.adjustingRowNumberWidth&&this.adjustRowNumberColumnWidth()){this.adjustingRowNumberWidth=!0;try{if((n=(r=(i=this.tableModel).getColumnDefs)==null?void 0:r.call(i))!=null&&n.some(c=>{var h,d;return((h=c.width)==null?void 0:h.unit)==="weight"||((d=c.width)==null?void 0:d.unit)==="%"})){this.tableModel.recalcPadding();const c=this.getAvailableColumnWidth();c>0&&(this.tableModel.setParentWidth(c),this.tableModel.init())}this.tableModel.recalcPadding(),this.resetSizeOfWrapperDiv(),this.adjustContainersAndRows()}finally{this.adjustingRowNumberWidth=!1}return}for(const c of this.removables)c.remove();if(this.hideHoverRow(),this.hideHoverColumn(),this.scrollTop=this.scrollViewport.scrollTop,this.scrollLeft=this.getViewportScrollLeft(),this.scrollViewportLeft=this.scrollLeft,this.scrollFactorY=this.scrollTop/(this.scrollViewport.scrollHeight-this.scrollViewport.clientHeight),this.scrollFactorX=this.scrollLeft/(this.scrollViewport.scrollWidth-this.scrollViewport.clientWidth),isNaN(this.scrollFactorY)&&(this.scrollFactorY=0),this.pendingContentScroll){const c=this.getContentScrollRangeY();Math.abs(this.scrollTop-this.pendingContentScroll.scrollTop)<=1&&c>0?this.scrollFactorY=Math.min(1,Math.max(0,this.pendingContentScroll.contentTop/c)):this.pendingContentScroll=void 0}isNaN(this.scrollFactorX)&&(this.scrollFactorX=0);const e=this.hostElement.clientWidth,t=this.hostElement.clientHeight,s=this.areaBodyWest.child.clientWidth,o=this.areaHeaderCenter.child.clientHeight;this.areaHeightsOfRenderPass={body:this.areaBodyCenter.child.clientHeight,footer:this.areaFooterCenter.child.clientHeight,header:o},this.ariaGridInfo=nt.create(this.tableModel),this.ariaSelectionKind=this.getAriaSelectionKind(),this.ariaFocusedCell=void 0,this.renderedSpanCells.clear();try{this.adjustBody(),this.adjustArea("footer"),this.adjustArea("header")}finally{this.areaHeightsOfRenderPass=void 0}this.updateHostAria(),this.tableOptions.tableTopBorderVisible&&this.removables.push(this.dom.addHorizontalBorder(new te(0,e,1,0),this.hostElement,"ge-table-border")),this.tableOptions.tableBottomBorderVisible&&this.removables.push(this.dom.addHorizontalBorder(new te(0,e,1,t-1),this.hostElement,"ge-table-border")),this.tableModel.getFixedLeftColumnCount()>0&&this.removables.push(this.dom.addVerticalBorder(new te(s,1,t,0),this.hostElement,"ge-table-body-west-vertical-border")),this.tableModel.isHeaderVisibe()&&this.removables.push(this.dom.addHorizontalBorder(new te(0,e,1,o),this.hostElement,"ge-table-body-west-vertical-border")),this.updateOverlay(),(l=this.rowNumberWidth)!=null&&l.approximate&&!this.rowNumberRemeasureScheduled&&this.findRowNumberLabel()&&(this.rowNumberRemeasureScheduled=!0,requestAnimationFrame(()=>{this.hostElement.isConnected&&this.repaint()})),this.afterRenderPass()}afterRenderPass(){}updateOverlay(){var r;const e=this.tableOverlay;if(!e)return;const t=this.tableModel.getBodyModel(),s=t.getRowCount(),o=s===0?(r=t.getUnfilteredRowCount)==null?void 0:r.call(t):void 0,i=e.update(s,o);i&&this.onOverlayChanged(i)}onOverlayChanged(e){}checkForScrollPosSaving(){this.afterRenderPass()}updateCells(e,t=!1){const s=this.tableModel.getBodyModel(),o=s.getRowCount(),i=()=>e.forEach(n=>{this.tableModel.getAreaModel(n.area).setValue(n.rowIndex,n.columnIndex,n.value),t||this.rerenderCellContent(n)});if(X(s)?s.batch(i):(i(),!1)){this.invalidateAggregates(),this.repaintHard();return}if(e.length){const n=e[0].area;this.invalidateAggregates(e.every(l=>l.area===n)?{area:n,rowIndices:e.map(l=>l.rowIndex)}:void 0)}e.length&&s.getRowCount()!==o?this.repaintHard():t?this.repaint():e.length&&(this.rerenderDerivedFooterCells(e),this.rerenderGroupRowCells(),this.rerenderCalculatedCells())}rerenderCalculatedCells(){var o;const e=this.tableModel.getBodyModel();if(!((o=e.hasDerivedColumns)!=null&&o.call(e)))return;const t=new Map;this.hostElement.querySelectorAll('div.ge-table-col-div[data-area="body"][data-row-index][data-col-index]').forEach(i=>{var l,c;const r=Number(i.getAttribute("data-row-index")),n=Number(i.getAttribute("data-col-index"));if(!t.has(n)){const h=(l=this.tableModel.getColumnDef(n))==null?void 0:l.property;t.set(n,h!==void 0&&!!((c=e.isDerivedProperty)!=null&&c.call(e,h)))}t.get(n)&&this.rerenderCellContent({area:"body",rowIndex:r,columnIndex:n,value:e.getValueAt(r,n)??""})})}rerenderGroupRowCells(){const e=this.tableModel.getBodyModel();if(!X(e))return;this.hostElement.querySelectorAll('div.ge-table-col-div[data-area="body"][data-row-index][data-col-index]').forEach(s=>{const o=Number(s.getAttribute("data-row-index")),i=Number(s.getAttribute("data-col-index"));!e.isGroupRowIndex(o)||!e.getCellRenderer(o,i)||this.rerenderCellContent({area:"body",rowIndex:o,columnIndex:i,value:e.getValueAt(o,i)})})}rerenderDerivedFooterCells(e){const t=this.tableModel.getAreaModel("footer");if(!(t!=null&&t.invalidateDerivedValues)||e.every(o=>o.area==="footer"))return;this.hostElement.querySelectorAll('div.ge-table-col-div[data-area="footer"][data-row-index][data-col-index]').forEach(o=>{const i=Number(o.getAttribute("data-row-index")),r=Number(o.getAttribute("data-col-index"));this.rerenderCellContent({area:"footer",rowIndex:i,columnIndex:r,value:t.getValueAt(i,r)})})}rerenderCellContent({area:e,rowIndex:t,columnIndex:s,value:o,cssClasses:i}){const r=this.tableModel.getAreaModel(e),n='div[data-col-index="'+s+'"][data-row-index="'+t+'"][data-area="'+e+'"]',l=this.hostElement.querySelector(n);if(l){let c;const h=e==="body"&&this.editorRenderer&&this.editorRendererRow===t&&this.editorRendererColumn===s;let d;if(h?d=this.editorRenderer:d=r.getCellRenderer(t,s),l.innerText="",this.applyCssClasses(l,i),d)c=d.render(l,t,s,e,r,o,this.dom.domService),c&&this.cleanupFunctions[e].push(c);else{const g=`${o}`;this.dom.addLabelDiv(l,g,!1,t,s,e)}const u=r.getCustomClassesAt(t,s);u.length&&this.dom.addClasses(u,l);const f=r.getCustomStyleAt(t,s);if(f)for(const g in f)this.dom.domService.setStyle(l,g,f[g])}}getFirstVisibleRowIndex(){return this.firstVisibleRowIndex}getLastVisibleRowIndex(){return this.lastVisibleRowIndex}getFirstFullVisibleRowIndex(){return this.firstFullVisibleRowIndex}getLastFullVisibleRowIndex(){return this.lastFullVisibleRowIndex}getDisplayedRowCount(){return this.displayedRowCount}storeColumnWidths(){const e=this.tableModel.getColumnDefs();e!=null&&e.length&&(this.storedColumnWidths=e.map((t,s)=>this.tableModel.getColumnWidth(s)))}getAreaAndSideIdentByAttr(e){if(e){const t=this.getStringByAttr(e,"data-area"),s=this.getStringByAttr(e,"data-side");if(s&&t)return[t,s]}return[void 0,void 0]}getArea(e,t){if(e==="header"){if(t==="west")return this.areaHeaderWest;if(t==="center")return this.areaHeaderCenter;if(t==="east")return this.areaHeaderEast}else if(e==="body"){if(t==="west")return this.areaBodyWest;if(t==="center")return this.areaBodyCenter;if(t==="east")return this.areaBodyEast}else if(e==="footer"){if(t==="west")return this.areaFooterWest;if(t==="center")return this.areaFooterCenter;if(t==="east")return this.areaFooterEast}throw Error(`Wrong area identifier: row:${e}, col:${t}`)}snapToDevicePixel(e){const t=typeof window<"u"&&window.devicePixelRatio||1;return Math.round(e*t)/t}isScrollHeightCapped(){return this.getBodyContentHeight()+1>it.maxScrollHeightInPx}adjustDetailLayerBounds(e,t,s,o){var i;(i=this.masterDetailService)==null||i.setBounds(e,t,s,o)}getBodyContentHeight(){var t;const e=this.tableModel.getContentHeightInPixel();return(t=this.masterDetailService)!=null&&t.hasExpanded()?e+this.getBodyRowLayout().getExtraTotal():e}getContentScrollRangeY(){return this.getBodyContentHeight()-this.areaBodyCenterGeo.height}getScrollerRangeY(){return this.scrollViewport.scrollHeight-this.scrollViewport.clientHeight}onWheel(e){if(e.ctrlKey||!this.isScrollHeightCapped())return;const t=this.getContentScrollRangeY(),s=this.getScrollerRangeY();if(t<=0||s<=0)return;const o=s/t,i=e.deltaMode===1?16:e.deltaMode===2?this.scrollViewport.clientHeight:1;e.preventDefault(),e.deltaY&&(this.scrollViewport.scrollTop+=e.deltaY*i*o),e.deltaX&&(this.scrollViewport.scrollLeft+=e.deltaX*i)}adjustBody(){const e=this.areaBodyCenterGeo.height-this.getBodyContentHeight(),t=this.snapToDevicePixel(this.scrollFactorY*e);this.contentScrollTop=-t,this.dom.setStyle(this.contentDiv,"top",`${this.scrollTop}px`);const s=this.areaHeightsOfRenderPass?this.scrollLeft:this.getViewportScrollLeft();this.dom.setStyle(this.contentDiv,"left",`${s}px`),this.adjustArea("body",t)}getNumberByAttr(e,t){var s;if(e){const o=(s=e.closest("["+t+"]"))==null?void 0:s.getAttribute(t);if(o)return Number(o)}return-1}getStringByAttr(e,t){var s;if(e){const o=(s=e.closest("["+t+"]"))==null?void 0:s.getAttribute(t);if(o)return o}return""}adjustArea(e,t=0){var x,R,M,D,F;const s=this.getArea(e,"west"),o=this.getArea(e,"center"),i=this.getArea(e,"east"),r=((x=this.areaHeightsOfRenderPass)==null?void 0:x[e])??o.child.clientHeight;s.child.innerText="",o.child.innerText="",i.child.innerText="";const n=0,l=this.areaBodyCenterGeo.width,c=this.tableModel.getPadding(),h=this.tableModel.getAreaModel(e),d=h.getRowCount();for(;this.cleanupFunctions[e].length;){const v=this.cleanupFunctions[e].shift();v&&v()}if(e==="header"&&!this.tableModel.isHeaderVisibe()||e==="footer"&&!this.tableModel.isFooterVisibe()){this.updateRowGroupRoles(s,o,i);return}let u=t;const f=this.tableModel.getColumnCount(),g=this.tableModel.getFixedRightColumnCount(),p=this.tableModel.getFixedLeftColumnCount();e==="body"&&(this.firstVisibleRowIndex=-1,this.firstFullVisibleRowIndex=-1,this.lastVisibleRowIndex=-1,this.lastFullVisibleRowIndex=-1);let m=0;const b=e==="body"?this.getBodyRowLayout():void 0,w=!!b&&b.getExtraCount()>0,y=[];if(b)(R=this.masterDetailService)==null||R.startRenderPass(),u<0&&d>0&&(m=b.findIndexAt(-u),u=u+b.getTop(m));else{const v=(M=h.getConstantRowHeight)==null?void 0:M.call(h);if(v!==void 0&&v>0&&u<0){for(m=Math.min(d,Math.floor(-u/v));m>0&&u+m*v>0;)m--;u=u+m*v}}for(let v=m;v<d;v++){const $=u,T=v===d-1,G=this.tableModel.getRowHeight(e,v),z=w?b.getExtraHeight(v):0;if(z>0&&$+G+z>0&&y.push(v,$+G,z),$+G>0){e==="body"&&this.firstVisibleRowIndex===-1&&(this.firstVisibleRowIndex=v,this.firstFullVisibleRowIndex=$<-this.pixelLimitForFullVisible?this.firstVisibleRowIndex+1:this.firstVisibleRowIndex);let N={left:n,width:l,height:G,top:$,index:v},K=this.dom.addRowDiv(o,N,v,e,"center");this.applyRowAria(K,e,h,v);const ze=[K],Te=p;this.adjustColumnsToRowParent({areaIdent:e,sideIdent:"center",areaModel:h,geo:N,parent:K,rowIndex:v,columnIndexStart:Te,columnIndexEnd:f-g-1,verticalFixed:!1,lastRowOfModel:T}),c.left>0&&(N={left:n,width:this.areaBodyWestGeo.width,height:G,top:$,index:v},K=this.dom.addRowDiv(s,N,v,e,"west"),this.applyRowAria(K,e,h,v),ze.push(K),this.adjustColumnsToRowParent({areaIdent:e,sideIdent:"west",areaModel:h,geo:N,parent:K,rowIndex:v,columnIndexStart:0,columnIndexEnd:Te-1,verticalFixed:!0,lastRowOfModel:T})),c.right>0&&(N={left:n,width:this.areaBodyEastGeo.width,height:G,top:$,index:v},K=this.dom.addRowDiv(i,N,v,e,"east"),this.applyRowAria(K,e,h,v),this.adjustColumnsToRowParent({areaIdent:e,sideIdent:"east",areaModel:h,geo:N,parent:K,rowIndex:v,columnIndexStart:f-g,columnIndexEnd:f-1,verticalFixed:!0,lastRowOfModel:T}));const ce=e==="header"&&this.tree&&v===d-1?this.findCellDiv(ze,this.getTreeArrowColumnIndex()):void 0;if(ce!=null&&ce.parentElement){const ut=this.dom.getInlineStart(ce)+16,Ke=this.dom.applyStyle(this.dom.setAttribute(this.dom.addDiv(ce.parentElement,new te(ut,20,20,8)),"data-ge-action","toggleExpandCollapseAll"),{cursor:"pointer"}),k=this.tableOptions.treeOptions.arrowExpandCollapseAll;if(k){const je=this.dom.domService.createText(k.content);this.dom.domService.appendChild(Ke,je),k.style&&this.dom.applyStyleString(Ke,k.style)}}}if(u=u+G+z,u>r){if(e==="body"){const N=u-z;N<=0&&this.firstVisibleRowIndex===-1?this.displayedRowCount=0:(this.lastVisibleRowIndex=v,this.lastFullVisibleRowIndex=r-N<-this.pixelLimitForFullVisible?v-1:v,this.displayedRowCount=this.lastFullVisibleRowIndex-this.firstFullVisibleRowIndex+1)}break}}if(b&&((D=this.masterDetailService)==null||D.layoutVisible(y)),e==="body"&&this.firstVisibleRowIndex>-1&&this.lastVisibleRowIndex===-1&&(this.lastVisibleRowIndex=d-1,this.lastFullVisibleRowIndex=d-1,this.displayedRowCount=this.lastFullVisibleRowIndex-this.firstFullVisibleRowIndex+1),this.loggingActive&&e==="body"&&console.log("render scope: this.firstVisibleRowIndex <- "+this.firstVisibleRowIndex+`
|
|
44
44
|
render scope: this.firstFullVisibleRowIndex <- `+this.firstFullVisibleRowIndex+`
|
|
45
45
|
render scope: this.lastVisibleRowIndex <- `+this.lastVisibleRowIndex+`
|
|
46
|
-
render scope: this.lastFullVisibleRowIndex <- `+this.lastFullVisibleRowIndex),this.pruneRowDivCache(s),this.pruneRowDivCache(o),this.pruneRowDivCache(i),this.colAndRowspanModels&&this.colAndRowspanModels[e]){const C=((S=this.colAndRowspanModels[e])==null?void 0:S.getRanges())??[];if(C.length)for(const A of C){if(A.r1>=d||A.c1>=f)continue;let I=0,M=o.child,E="center";if(A.c1<p)M=s.child,E="west";else if(g>0&&A.c1>=f-g)M=i.child,E="east";else{const H=this.areaBodyCenterGeo.width-this.tableModel.getContentWidthInPixel();I=this.snapToDevicePixel(this.scrollFactorX*H)-this.areaBodyWestGeo.width,E="center"}this.drawBigCell(A,I,t,h,M,E)}}this.updateRowGroupRoles(s,o,i)}getAriaGridInfo(){return this.ariaGridInfo||(this.ariaGridInfo=tt.create(this.tableModel)),this.ariaGridInfo}applyRowAria(e,t,s,o,i=!0){var n;const r=this.dom.domService;if(r.setAttribute(e,"role","row"),r.setAttribute(e,"aria-rowindex",`${this.getAriaGridInfo().rowIndex(t,o)}`),!(t!=="body"||!i)){if(this.tree&&_(s)){const a=this.treeAriaInfo.get(s,o);a&&(r.setAttribute(e,"aria-level",`${a.level}`),r.setAttribute(e,"aria-setsize",`${a.setSize}`),r.setAttribute(e,"aria-posinset",`${a.posInSet}`),a.expanded===void 0?this.dom.removeAttribute(e,"aria-expanded"):r.setAttribute(e,"aria-expanded",`${a.expanded}`))}if(this.ariaSelectionKind==="row"){const a=(n=this.getSelectionModel)==null?void 0:n.call(this);r.setAttribute(e,"aria-selected",a&&a.getSelectionCount(o,0)>0?"true":"false")}else e.hasAttribute("aria-selected")&&this.dom.removeAttribute(e,"aria-selected")}}applyCellAria(e,t,s,o,i){var f,g;const r=this.dom.domService,n=this.getAriaGridInfo(),a=t==="header",c=t==="body"&&L(this.tableModel.getColumnDef(i))||t==="footer"&&Po(s)&&s.isLabelCell(o,i)||t==="body"&&z(s)&&s.isGroupLabelCell(o,i)||!a&&!!((f=s.isRowHeaderCell)!=null&&f.call(s,o,i));r.setAttribute(e,"role",a?"columnheader":c?"rowheader":"gridcell");const h=n.colIndex(i);h>0&&r.setAttribute(e,"aria-colindex",`${h}`);const d=Math.max(1,s.getRowspanAt(o,i)||1),u=Math.max(1,s.getColspanAt(o,i)||1);if(u>1&&r.setAttribute(e,"aria-colspan",`${n.colSpan(i,u)}`),d>1&&r.setAttribute(e,"aria-rowspan",`${d}`),(d>1||u>1)&&this.renderedSpanCells.add(`${t}:${o}:${i}`),a&&o+d>=n.headerRowCount&&u===1){const p=this.tableModel.getColumnDef(i);if((g=p==null?void 0:p.sortable)!=null&&g.call(p)){const m=p.sortState;r.setAttribute(e,"aria-sort",m==="asc"?"ascending":m==="desc"?"descending":"none")}}return[d,u]}updateRowGroupRoles(...e){for(const t of e){let s=0;for(const i of Array.from(t.child.children)){if(!i.classList.contains("ge-table-row-div")||i.classList.contains("ge-table-span-row")){i.getAttribute("role")==="row"&&s++;continue}i.querySelector(':scope > [role="gridcell"], :scope > [role="columnheader"], :scope > [role="rowheader"]')?s++:i.getAttribute("role")==="row"&&(this.dom.domService.setAttribute(i,"role","presentation"),this.dom.removeAttribute(i,"aria-rowindex"))}const o=t.child.firstElementChild&&s?"rowgroup":"presentation";t.child.getAttribute("role")!==o&&this.dom.domService.setAttribute(t.child,"role",o)}}setHostAttribute(e,t){this.setHostAriaAttribute(e,t)}updateHostAria(){var i;const e=this.getAriaGridInfo();this.setHostAttribute("aria-rowcount",`${e.rowCount}`),this.setHostAttribute("aria-colcount",`${e.colCount}`);const t=(i=this.getSelectionModel)==null?void 0:i.call(this),s=this.ariaSelectionKind!=="none"&&(t==null?void 0:t.selectionMode)==="multi";this.setHostAttribute("aria-multiselectable",s?"true":void 0);const o=this.ariaFocusedCell;if(o){const r=this.ariaIds.cell(o.area,o.rowIndex,o.columnIndex);this.dom.domService.setAttribute(o.element,"id",r),this.setHostAttribute("aria-activedescendant",r)}else this.setHostAttribute("aria-activedescendant",void 0)}setAriaFocusedCell(e,t,s,o){const i=this.ariaFocusedCell;i&&i.area===t&&i.rowIndex===s&&i.columnIndex===o||(this.ariaFocusedCell={element:e,area:t,rowIndex:s,columnIndex:o})}getAriaSelectionKind(){var s;const e=(s=this.getSelectionModel)==null?void 0:s.call(this);if(!e)return"none";const t=e.selectionType;return t==="none"?"none":t==="row"?"row":"cell"}getColumnAriaLabel(e){const t=this.tableModel.getColumnDef(e);if(t!=null&&t.headerLabel)return`${t.headerLabel}`;const s=this.tableModel.getAreaModel("header"),o=(s==null?void 0:s.getRowCount())??0;if(o>0){const i=s.getValueAt(o-1,e),r=i&&typeof i=="object"&&"data"in i?i.data:i;if(typeof r=="string"&&r.trim()||typeof r=="number")return`${r}`}return(t==null?void 0:t.property)||`Column ${e+1}`}getCheckboxAriaLabel(e,t){return e==="header"?this.ariaTexts.selectAllRows():this.ariaTexts.selectRow(t+1)}labelControl(e,t){t&&!e.hasAttribute("aria-label")&&!e.hasAttribute("aria-labelledby")&&this.dom.domService.setAttribute(e,"aria-label",t)}labelRendererControls(e,t,s,o,i){if(Ds(t)||e.classList.contains("ge-table-row-checkbox-div")){const n=e.querySelector("input.ge-table-row-checkbox");if(n){this.labelControl(n,this.getCheckboxAriaLabel(s,o));return}const a=e.querySelector("input.ge-input-checkbox");a&&this.labelControl(a,this.getColumnAriaLabel(i));return}const r=this.tableOptions.ariaTexts;if(s==="header"&&(r!=null&&r.expandGroup||r!=null&&r.collapseGroup)){const n=e.querySelector('.ge-table-toggle-icon-div[role="button"]');if(n){const a=n.getAttribute("data-ge-group-label")??"",c=n.getAttribute("aria-expanded")==="true";this.dom.domService.setAttribute(n,"aria-label",c?this.ariaTexts.collapseGroup(a):this.ariaTexts.expandGroup(a))}}}findCellDiv(e,t){for(const s of e){const o=s.querySelector(`:scope > .ge-table-col-div[data-col-index="${t}"]`);if(o)return o}}pruneRowDivCache(e){const t=e.cache;for(const s in t)t[s].parentNode!==e.child&&delete t[s]}drawBigCell(e,t,s,o,i,r){const n=s+this.getRowHeights(0,e.r1-1,o).reduce((y,w)=>y+w,0),a=this.tableModel.getColumnCount(),c=this.tableModel.getFixedRightColumnCount();let h=0;c>0&&e.c1>=a-c&&(h=a-c);const d=t+this.getColumnWidths(h,e.c1-1).reduce((y,w)=>y+w,0),u=this.getRowHeights(e.r1,e.r2,o).reduce((y,w)=>y+w,0),f=this.getColumnWidths(e.c1,e.c2).reduce((y,w)=>y+w,0);let g=!1;const p=this.getSelectionModel?this.getSelectionModel():void 0;p&&(g=p.getSelectionCount(e.r1,e.c1)>0);const m=o.areaIdent,b=this.dom.applyStyle(this.dom.createDivWithClass("ge-table-span-row",i),{position:"absolute",left:"0",top:"0",width:"0",height:"0",overflow:"visible"});this.renderedSpanCells.has(`${m}:${e.r1}:${e.c1}`)?this.dom.setAriaHidden(b):this.applyRowAria(b,m,o,e.r1,!1),i=b,e.gammaRange?this.renderCell({areaModel:o,areaIdent:o.areaIdent,sideIdent:r,rowIndex:e.r1,columnIndex:e.c1,left:d,top:n,width:f,height:u,parent:i,cellSelected:g,lastRowOfModel:!0,gammaRange:e.gammaRange}):this.renderCell({areaModel:o,areaIdent:o.areaIdent,sideIdent:r,rowIndex:e.r1,columnIndex:e.c1,left:d,top:n,width:f,height:u,parent:i,cellSelected:g,lastRowOfModel:!0,gammaRange:e.gammaRange}),o.areaIdent==="header"&&this.tableOptions.columnsResizable&&this.isColumnResizable(e.c1)&&this.renderHeaderCellResizeHandle({rowIndex:e.r1,columnIndex:e.c1,cellLeft:d,cellTop:n,cellWidth:f,cellHeight:u,parent:i})}findRowOfImportantRowspanCell(e,t,s){const o=e.getMaxRowspan();for(let i=t-1;i>-1;i--){const r=e.getRowspanAt(i,s);if(r>1&&i+r+1>=t)return i;if(t-i>o)return-1}return-1}adjustColumnsToRowParent({areaIdent:e,sideIdent:t,areaModel:s,geo:o,parent:i,rowIndex:r,columnIndexStart:n,columnIndexEnd:a,verticalFixed:c=!1,lastRowOfModel:h=!1}){var p;let d=0;if(!c){const m=this.areaBodyCenterGeo.width-this.tableModel.getContentWidthInPixel();d=this.snapToDevicePixel(this.scrollFactorX*m)}const u=0,f=!!(e==="body"&&t);let g=d;for(let m=n;m<=a;m++){const b=g,y=this.tableModel.getColumnWidth(m);if(y>0&&b+y>0){let w=o.height;const S=s.getRowspanAt(r,m),C=s.getColspanAt(r,m);S>1&&(w=this.getRowHeights(r,r+S-1,s).reduce((M,E)=>M+E,0));let A=y;C>1&&(A=this.getColumnWidths(m,m+C-1).reduce((M,E)=>M+E,0));let I=!1;if(this.colAndRowspanModels&&this.colAndRowspanModels[e]&&(p=this.colAndRowspanModels[e])!=null&&p.isInRange(r,m)&&(I=!0),this.draggingTargetColumnIndex===m&&e!=="header"){this.renderDragTargetDiv(i,b,u,A,w);const M={left:b,top:u,width:A,height:w};this.dom.addColumnBorderDivs(this.tableOptions,i,M,e,t)}else{const M=this.renderSelectedBackgroundDiv(I,f,t,s,r,m,i,b,u,A,w);"gammaCells"in s&&s.getValueAt(r,m)&&(I=!1),I||this.renderCell({areaModel:s,areaIdent:e,sideIdent:t,rowIndex:r,columnIndex:m,left:b,top:u,width:A,height:w,parent:i,cellSelected:M,lastRowOfModel:h,gammaRange:!0}),e==="header"&&this.tableOptions.columnsResizable&&this.isColumnResizable(m)&&this.renderHeaderCellResizeHandle({rowIndex:r,columnIndex:m,cellLeft:b,cellTop:u,cellWidth:A,cellHeight:w,parent:i})}}if(g=g+y,g>this.areaBodyCenterGeo.width)break}this.tableOptions.verticalBorderVisible&&this.dom.addVerticalBorder(new q(g-1,1,o.height,0),i)}getTreeArrowColumnIndex(){const e=this.getFirstDataColumnIndex();return this.tableOptions.showCheckboxWihoutExtraColumn?e:this.tableModel.isRowCheckboxVisible()?e+1:e}getFirstDataColumnIndex(){var e,t;return et((t=(e=this.tableModel).getColumnDefs)==null?void 0:t.call(e))}isColumnResizable(e){return!L(this.tableModel.getColumnDef(e))}adjustRowNumberColumnWidth(){var i,r;if(!this.getFirstDataColumnIndex()||this.tableModel.overridingColumnWidth>-1)return!1;const e=this.tableModel.getColumnDef(0),t=e.getWidestText(this.tableModel.getBodyModel()),s=this.rowNumberWidth;let o=(s==null?void 0:s.text)===t?s.width:-1;if(o<0||s!=null&&s.approximate&&this.findRowNumberLabel()){const[n,a]=this.measureRowNumberText(t);o=Math.max(e.options.minWidthInPx,n),this.rowNumberWidth={text:t,width:o,approximate:a}}return this.tableModel.getColumnWidth(0)===o||((r=(i=this.tableModel).isColumnVisible)==null?void 0:r.call(i,0))===!1?!1:(this.tableModel.setColumnWidth(0,o),this.tableModel.getColumnWidth(0)===o)}findRowNumberLabel(){return this.hostElement.querySelector(".ge-table-row-number .ge-table-label")}measureRowNumberText(e){const t=this.findRowNumberLabel(),s=getComputedStyle(t??this.hostElement),i=(t?(parseFloat(s.paddingLeft)||0)+(parseFloat(s.paddingRight)||0):12)+4,r=e.replace(/[0-9]/g,"0");let n=null;try{n=document.createElement("canvas").getContext("2d")}catch{n=null}return n?(n.font=s.font||`${s.fontWeight} ${s.fontSize} ${s.fontFamily}`,[Math.ceil(n.measureText(r).width+i),!t]):[Math.ceil(e.length*8+i),!t]}addAndRenderCellDiv({areaModel:e,areaIdent:t,sideIdent:s,rowIndex:o,index:i,left:r,width:n,height:a,top:c,parent:h,lastRowOfModel:d}){var so,oo;const u=t==="body"&&this.editorRenderer&&this.editorRendererRow===o&&this.editorRendererColumn===i,f=this.tableModel.getColumnDef(i),g=L(f),p=u?this.editorRenderer:(g&&t==="body"?f.rendererMap.body:void 0)??e.getCellRenderer(o,i),m={left:r,width:n,height:a,top:c,index:i},b=e.getRowByIndex(o);let y="none";if(i===this.getTreeArrowColumnIndex()&&F(b)){const O=b;("hasDisplayedChildren"in e&&typeof e.hasDisplayedChildren=="function"?e.hasDisplayedChildren(O):!!((so=O.children)!=null&&so.length))?O.expanded?y="expanded":y="collapsed":y="hidden"}let S;t==="header"&&(!(f!=null&&f.sortIconVisible)||f!=null&&f.sortIconVisible())&&(S=f==null?void 0:f.sortState);const C=t==="body"&&((oo=this.batchEditService)!=null&&oo.hasPending())?this.batchEditService.getPendingAt(o,i):void 0,A=C?C.newValue:e.getValueAt(o,i),I=p||g&&t==="footer"?"":`${A??""}`,M=e.isRowChecked(o),E=this.getFirstDataColumnIndex(),H=this.tableOptions.showCheckboxWihoutExtraColumn&&i===E&&M?this.getCheckboxAriaLabel(t,o):void 0,k=this.dom.addColumnDiv({parent:h,geo:m,rowIndex:o,columnIndex:i,areaIdent:t,sideIdent:s,text:I,treeArrow:y,tableOptions:this.tableOptions,checkedType:M,sortState:S,checkboxAriaLabel:H,firstDataColumnIndex:E}),[$e,re]=this.applyCellAria(k,t,e,o,i),lt=(C==null?void 0:C.error)||e.getTooltipAt(o,i);lt&&this.dom.setAttribute(k,"title",lt),C&&(this.dom.addClass("ge-table-cell-pending",k),C.error&&(this.dom.addClass("ge-table-cell-invalid",k),this.dom.setAttribute(k,"aria-invalid","true"))),f&&f.classes[t]&&this.dom.addClasses(f.classes[t],k);let Ge;if(p)if(Ge=p.render(k,o,i,t,e,A,this.dom.domService),u){const O=k.querySelector("input, select");O&&(this.labelControl(O,this.getColumnAriaLabel(i)),O.contains(document.activeElement)||O.focus())}else this.labelRendererControls(k,p,t,o,i);const ue=e.getCustomClassesAt(o,i);if(ue.length&&this.dom.addClasses(ue,k),this.dom.addColumnBorderDivs(this.tableOptions,h,m,t,s),d&&this.dom.addHorizontalBorder({left:r,width:n,height:a,top:c+a},h),this.getFocusModel&&t==="body"&&!this.headerFocus){const O=this.getFocusModel();if(O!=null&&O.hasFocus(o,i))this.dom.addFocusBorderDivs(h,m,{}),this.setAriaFocusedCell(k,t,o,i);else if(O&&($e>1||re>1)){const[Jt,io]=O.getFocus();Jt>=o&&Jt<o+$e&&io>=i&&io<i+re&&this.setAriaFocusedCell(k,t,o,i)}}else t==="header"&&this.headerFocus&&this.headerFocus[0]===o&&this.headerFocus[1]===i&&(this.dom.addFocusBorderDivs(h,m,{}),this.setAriaFocusedCell(k,t,o,i));t==="header"&&!g&&this.dom.setAttribute(k,"data-ge-action","drag-column"),t==="body"&&this.rowDragService&&!u&&(f!=null&&f.rowDrag&&this.rowDragService.decorateCell(k,this.rowDragService.getHandleState(o,f,e)),this.rowDragService.isDragSourceRow(o)&&this.dom.addClass("ge-table-row-dragging",k));const We=e.getCustomStyleAt(o,i);if(We)for(const O in We)this.dom.setStyle(k,O,We[O]);return[k,Ge]}applyCssClasses(e,t={}){e&&Object.entries(t).forEach(([s,o])=>{o?this.dom.addClass(s,e):this.dom.removeClass(s,e)})}getColumnWidths(e,t){const s=[];for(let o=e;o<=t;o++)s.push(this.tableModel.getColumnWidth(o));return s}getRowHeights(e,t,s){const o=[];for(let i=e;i<=t;i++)o.push(s.getRowHeight(i));return o}adjustHoverRows(e){if(this.tableOptions.hoverRowVisible&&e.rowIndex>-1&&e.areaIdent==="body"){const t=this.hostElement.clientWidth,s=this.tableModel.getAreaModel("body").getRowHeight(e.rowIndex),o=this.contentScrollTop,i=e.rowTop+this.areaHeaderCenter.parent.clientHeight-o;this.dom.applyStyle(this.hoverRow,{left:"0",top:i+"px",width:t+"px",height:s+"px",display:"block"})}else this.hideHoverRow()}hideHoverRow(){this.dom.applyStyle(this.hoverRow,{display:"none"})}adjustHoverColumns(e){if(this.tableOptions.hoverColumnVisible&&e.rowIndex>-1){const t=this.hostElement.clientHeight,s=this.tableModel.getColumnWidth(e.columnIndex),o=this.getColumnLeftInHost(e.columnIndex,e.columnLeft);this.dom.applyStyle(this.hoverColumn,{left:o+"px",top:"0px",width:s+"px",height:t+"px",display:"block"})}else this.hideHoverColumn()}getColumnLeftInHost(e,t){const s=this.tableModel.getColumnCount(),o=this.tableModel.getFixedLeftColumnCount(),i=this.tableModel.getFixedRightColumnCount();if(e<o)return t;if(i>0&&e>=s-i){const r=this.tableModel.getXPosByColumnIndex(s-i);return this.areaBodyEastGeo.left+t-r}return t-this.getContentScrollLeft()}getContentScrollLeft(){const e=this.areaBodyCenterGeo.width-this.tableModel.getContentWidthInPixel();return-this.snapToDevicePixel(this.scrollFactorX*e)}hideHoverColumn(){this.dom.applyStyle(this.hoverColumn,{display:"none"})}disposeRendering(){this.debounceTimeout&&(clearTimeout(this.debounceTimeout),this.debounceTimeout=null);for(const e of["header","body","footer"])for(;this.cleanupFunctions[e].length;){const t=this.cleanupFunctions[e].shift();t&&t()}}debounce(e,t=1e3){this.debounceTimeout&&clearTimeout(this.debounceTimeout),this.debounceTimeout=setTimeout(()=>{this.debounceTimeout=null,e.call(this)},t)}adjustDraggingColumn(e,t,s){var o,i;if(this.dragging){const r=this.hostElement.clientHeight,n=this.tableModel.getColumnWidth(t);if((o=e.originalEvent)!=null&&o.clientX){const h={left:((i=e.originalEvent)==null?void 0:i.clientX)-n/2,width:n,height:r,top:0,index:t};this.dom.applyStyle(this.draggingColumn,{background:"rgba(128,128,128,0.2)",display:"block",overflow:"hidden"}),this.dom.applyStyleInPx(this.draggingColumn,h),s&&this.renderContentOfDraggingColumn(h)}}else this.hideDraggingColumn()}renderContentOfDraggingColumn(e){const t=this.renderContentOfDraggingColumnForArea(e,"header",0),s=Math.max(0,this.firstVisibleRowIndex),o=this.tableModel.getAreaModel("body"),i=t+o.getYPosByRowIndex(s)-this.contentScrollTop;this.renderContentOfDraggingColumnForArea(e,"body",i,s,this.hostElement.clientHeight)}renderContentOfDraggingColumnForArea(e,t,s=0,o=0,i=Number.POSITIVE_INFINITY){const r="center",n=this.tableModel.getAreaModel(t),a=n==null?void 0:n.getRowCount();if(a){const c=e.index??0,h=this.draggingColumn;for(let d=o;d<a&&s<i;d++){const u=s,f=n.getRowHeight(d),g={left:0,width:e.width,height:f,top:u,index:d},p=n.getValueAt(d,c),m=n.getCellRenderer(d,c),b=m?"":`${p??""}`,y={parent:h,geo:g,rowIndex:d,columnIndex:c,areaIdent:t,sideIdent:r,text:b},w=this.dom.addColumnDiv(y);let S;m&&(S=m.render(w,d,c,t,n,p,this.dom.domService),S&&this.cleanupFunctions[t].push(S));const C=n.getCustomClassesAt(d,c);C.length&&this.dom.addClasses(C,w);const A=this.tableModel.getColumnDef(c);A&&A.classes[t]&&this.dom.addClasses(A.classes[t],w),this.dom.addColumnBorderDivs(this.tableOptions,h,g,t,r);const I=n.getCustomStyleAt(d,c);if(I)for(const M in I)this.dom.setStyle(w,M,I[M]);s=s+f}}return s}hideDraggingColumn(){this.dom.applyStyle(this.draggingColumn,{display:"none"})}renderDragTargetDiv(e,t,s,o,i){const r=this.dom.applyStylePosistionAbsolute(this.dom.setAriaHidden(this.dom.createDivWithClass("ge-table-drop-zone",e)));return this.dom.setStyle(r,"left",`${t}px`),this.dom.setStyle(r,"top",`${s}px`),this.dom.setStyle(r,"width",`${o}px`),this.dom.setStyle(r,"height",`${i}px`),r}renderSelectedBackgroundDiv(e,t,s,o,i,r,n,a,c,h,d){let u=!1;if(!e&&t&&o.isSelectable(i,r)&&this.getSelectionModel){const f=this.getSelectionModel();if(f){const g=f.getSelectionCount(i,r);u=g>0;for(let p=0;p<g;p++){const m=this.dom.applyStylePosistionAbsolute(this.dom.setAriaHidden(this.dom.createDivWithClass(`ge-table-${o.areaIdent}-${s}-selected-range`,n)));this.dom.setStyle(m,"left",`${a}px`),this.dom.setStyle(m,"top",`${c}px`),this.dom.setStyle(m,"width",`${h}px`),this.dom.setStyle(m,"height",`${d}px`)}}}return u}renderCell({areaModel:e,areaIdent:t,sideIdent:s,rowIndex:o,columnIndex:i,left:r,top:n,width:a,height:c,parent:h,cellSelected:d,lastRowOfModel:u}){const[f,g]=this.addAndRenderCellDiv({areaModel:e,areaIdent:t,sideIdent:s,rowIndex:o,index:i,left:r,width:a,height:c,top:n,parent:h,lastRowOfModel:u});d&&this.dom.addClass(`ge-table-${t}-${s}-selected-range`,f),t==="body"&&this.ariaSelectionKind==="cell"&&this.dom.domService.setAttribute(f,"aria-selected",d?"true":"false"),g&&this.cleanupFunctions[t].push(g)}renderHeaderCellResizeHandle({rowIndex:e,columnIndex:t,cellLeft:s,cellTop:o,cellWidth:i,cellHeight:r,parent:n}){const a=this.dom.domService,c=this.tableOptions.columnResizeHandleWidthInPx??2,h=a.createElement("div");a.setAttribute(h,"data-col-index",`${t}`),a.setAttribute(h,"data-row-index",`${e}`),a.setAttribute(h,"data-area","header"),a.setAttribute(h,"data-ge-action","resize-column"),a.addClass(h,"ge-table-column-resize-handle"),a.setAttribute(h,"aria-hidden","true"),a.setStyle(h,"display","clip"),a.setStyle(h,"position","absolute"),a.setStyle(h,"cursor","col-resize"),a.setStyle(h,"left",`${s+i-c}px`),a.setStyle(h,"top",`${o}px`),a.setStyle(h,"width",`${c}px`),a.setStyle(h,"height",`${r}px`),a.appendChild(n,h)}}class bt{constructor(e,t){this.columnIndex=e,this.sortState=t}}const He=()=>!0,js=()=>!1,Fe=new WeakSet,wt=new WeakMap;function Yo(l,e){e?Fe.delete(l):Fe.add(l),Xo(l)}function Qt(l,e){e?wt.set(l,e):wt.delete(l),Xo(l)}function ds(l){var e;return wt.has(l)?!Fe.has(l):!Fe.has(l)&&((e=l.isVisible)==null?void 0:e.call(l))!==!1}function Xo(l){const e=wt.get(l),t=!Fe.has(l);e?l.isVisible=()=>!Fe.has(l)&&e():l.isVisible=t?He:js}const Jo=new WeakSet;function qr(l){return Jo.add(l),l}function Zr(l){return typeof l=="function"&&Jo.has(l)}class qo{constructor(e,t){this.state=e,this.changedParts=t}}const ne=Object.freeze(["headerGroups","columns","tree","sort","checked","selection","scroll","custom"]),Qr=["sortingState","scrollState","collapsedExpandedState"];function es(l,e){try{const t=l.getItem(e);return t?JSON.parse(t):void 0}catch{return}}function Zo(l,e,t){const s={version:1};let o=!1;const i=es(l,e+"sortingState");Array.isArray(i)&&(o=!0,s.sort=i.filter(a=>a&&typeof a.columnIndex=="number"&&(a.sortState==="asc"||a.sortState==="desc")).map(a=>{const c=t[a.columnIndex],h=a.sortState;return c?{property:c,sortState:h}:{columnIndex:a.columnIndex,sortState:h}}));const r=es(l,e+"scrollState");Array.isArray(r)&&typeof r[0]=="number"&&typeof r[1]=="number"&&(o=!0,s.scroll={left:r[0],top:r[1]});const n=es(l,e+"collapsedExpandedState");if(n&&typeof n=="object"){o=!0;let a;n.allExpanded?a={collapsedRowIds:[]}:n.allCollapsed?a={expandedRowIds:[]}:n.mode==="expanded"?a={expandedRowIds:n.rowIds??[]}:a={collapsedRowIds:n.rowIds??[]},s.tree=a}return o?s:void 0}function us(l,e){for(const t of Qr)try{l.removeItem(e+t)}catch{}}const en={headerGroups:"autoRestoreHeaderGroupState",columns:"autoRestoreColumnLayout",tree:"autoRestoreCollapsedExpandedState",sort:"autoRestoreSortingState",checked:"autoRestoreCheckedState",selection:"autoRestoreSelectedState",scroll:"autoRestoreScrollPosition",custom:"autoRestoreCustomState"},fe=l=>l==="checked"?"checkedRowIds":l,Q=Number.MAX_SAFE_INTEGER,ee=class ee{constructor(e){this.scope=e,this.restoring=!1,this.started=!1,this.destroyed=!1,this.dirty=new Set,this.lastReported=new Map,this.reported={version:1},this.legacyRemoved=!1,this.sortPriority=[],this.initialWidths=new Map,this.startState={},this.custom=void 0,this.warnedNoRowObject=!1,this.warnedNoId=!1,this.warnWithoutStorageKey()}initBeforeModel(){this.started||(this.started=!0,this.restoring=!0,this.startState=this.readStartState(),this.defaultState={version:1},this.computePart("headerGroups",this.defaultState),this.startState.headerGroups&&this.applyHeaderGroups(this.startState.headerGroups))}initAfterModel(){if(!this.restoring)return;for(const s of this.columnDefs())this.initialWidths.set(s,s.width);this.sortPriority=this.columnDefs().filter(s=>s.sortState&&s.property).map(s=>s.property);const e=s=>this.persistedParts().includes(s)||this.startState[fe(s)]!==void 0,t=this.getState(ne.filter(s=>s!=="headerGroups"&&s!=="scroll"&&s!=="custom"&&(!ee.EXPENSIVE.includes(s)||e(s))));this.defaultState={...this.defaultState,...t,scroll:{left:0,top:0}},this.startState.columns&&this.applyColumns(this.startState.columns,!1)}initAfterFilter(){if(!this.restoring)return;const e=this.startState;e.tree&&this.applyTree(e.tree),e.sort&&this.applySort(e.sort),e.checkedRowIds&&this.applyChecked(e.checkedRowIds),e.selection&&this.applySelection(e.selection),"custom"in e&&(this.custom=e.custom)}initAfterLayout(){this.restoring&&(this.startState.scroll&&this.applyScroll(this.startState.scroll),this.restoring=!1,this.rememberAsReported(this.getState(ne.filter(e=>!ee.EXPENSIVE.includes(e)))))}getState(e=ne){const t={version:1};for(const s of e)this.computePart(s,t);return t}applyState(e,t=ne){if(!e||typeof e!="object")return;const s=r=>t.includes(r)&&e[fe(r)]!==void 0,o=[];let i=!1;s("headerGroups")&&this.applyHeaderGroups(e.headerGroups)&&o.push("headerGroups"),s("columns")&&(i=this.applyColumns(e.columns,!0),o.push("columns")),s("tree")&&(this.applyTree(e.tree),o.push("tree")),s("sort")&&(this.applySort(e.sort),o.push("sort")),s("checked")&&(this.applyChecked(e.checkedRowIds),o.push("checked")),s("selection")&&(this.applySelection(e.selection),o.push("selection")),t.includes("custom")&&"custom"in e&&(this.custom=e.custom,o.push("custom")),o.includes("headerGroups")?this.scope.headerGroupsChanged():i?this.scope.recalcColumnWidths():o.length&&(this.scope.tableModel.recalcHeightAndPadding(),this.scope.recalcWrappers(),this.scope.repaintHard()),s("scroll")&&(this.applyScroll(e.scroll),o.push("scroll")),o.forEach(r=>this.markDirty(r))}resetState(){if(!this.defaultState)return;this.applyState(this.defaultState),this.custom=void 0,this.markDirty("custom"),this.flush();const e=this.storageKey(),t=this.storage();if(e&&t)try{t.removeItem(e+ee.STORAGE_SUFFIX),us(t,e)}catch{}this.lastPersisted=void 0}setCustomState(e){this.custom=e,this.markDirty("custom")}sortedByColumn(e){this.sortPriority=e?[e]:[],this.markDirty("sort")}markDirty(e){!this.started||this.restoring||this.destroyed||(this.dirty.add(e),this.timer&&clearTimeout(this.timer),this.timer=setTimeout(()=>this.flush(),this.scope.tableOptions.stateChangedDebounceDelay??300))}rendered(){if(this.restoring||!this.started)return;const e=this.scope.scrollViewport,t=this.reportedScroll;(!t||t.left!==e.scrollLeft||t.top!==e.scrollTop)&&this.markDirty("scroll")}flush(){if(this.timer&&(clearTimeout(this.timer),this.timer=void 0),!this.dirty.size||!this.started||this.restoring)return;this.persistedParts().includes("checked")&&this.dirty.add("checked");const e=ne.filter(t=>this.dirty.has(t));this.dirty.clear();try{const t=this.getState(e),s=e.filter(i=>this.partJson(t,i)!==this.lastReported.get(i));if(!s.length)return;const o={...this.reported};for(const i of e){const r=fe(i);t[r]===void 0?delete o[r]:o[r]=t[r],this.lastReported.set(i,this.partJson(t,i))}this.reported=o,t.scroll&&(this.reportedScroll={left:t.scroll.left,top:t.scroll.top}),this.persist(o),this.scope.stateChanged(new qo(JSON.parse(JSON.stringify(o)),s))}catch(t){console.error("GuiExpert Table: the table state could not be stored or reported",t)}}destroy(){if(!this.destroyed){this.started&&!this.restoring&&this.persistedParts().includes("checked")&&this.dirty.add("checked");try{this.flush()}finally{this.destroyed=!0}}}storageKey(){var s;const e=(s=this.scope.tableOptions.autoRestoreOptions)==null?void 0:s.getStorageKeyFn;return(e?e():void 0)||void 0}storage(){var t;const e=(t=this.scope.tableOptions.autoRestoreOptions)==null?void 0:t.storage;if(e)return e;try{return typeof localStorage>"u"?void 0:localStorage}catch{return}}persistedParts(){const e=this.scope.tableOptions.autoRestoreOptions;return e?ne.filter(t=>!!e[en[t]]):[]}warnWithoutStorageKey(){this.scope.tableOptions.autoRestoreOptions&&this.persistedParts().length&&!this.storageKey()&&console.warn("GuiExpert Table: autoRestoreOptions are ignored without getStorageKeyFn (nothing is stored).")}readStartState(){const e=this.scope.tableOptions.initialState??{},t=this.persistedParts(),s=this.storageKey(),o=this.storage();if(!t.length||!s||!o)return{...e};let i;try{const n=o.getItem(s+ee.STORAGE_SUFFIX);if(n){const a=JSON.parse(n);a&&typeof a=="object"&&a.version===1&&(i=a,this.lastPersisted=n)}}catch{}i||(i=Zo(o,s,this.columnDefs().map(n=>n.property)));const r={...e};if(i)for(const n of t){const a=fe(n);a in i&&(r[a]=i[a])}return r}persist(e){const t=this.persistedParts(),s=this.storageKey(),o=this.storage();if(!t.length||!s||!o)return;const i={version:1};for(const n of t){const a=fe(n);e[a]!==void 0&&(i[a]=e[a])}const r=JSON.stringify(i);if(r!==this.lastPersisted)try{o.setItem(s+ee.STORAGE_SUFFIX,r),this.lastPersisted=r,this.legacyRemoved||(us(o,s),this.legacyRemoved=!0)}catch{}}rememberAsReported(e){this.reported=e,e.scroll&&(this.reportedScroll={left:e.scroll.left,top:e.scroll.top});for(const t of ne)fe(t)in e&&this.lastReported.set(t,this.partJson(e,t))}partJson(e,t){const s=e[fe(t)];return s===void 0?"":JSON.stringify(s)}computePart(e,t){var s;switch(e){case"headerGroups":{const o=(s=this.headerGroupModel())==null?void 0:s.getToggleGroupStates();o!=null&&o.length&&(t.headerGroups=o);break}case"columns":{const o=this.computeColumns();o&&(t.columns=o);break}case"sort":{const o=this.computeSort();o&&(t.sort=o);break}case"scroll":t.scroll=this.computeScroll();break;case"tree":{const o=this.computeTree();o&&(t.tree=o);break}case"checked":{const o=this.computeChecked();o&&(t.checkedRowIds=o);break}case"selection":{const o=this.computeSelection();o&&(t.selection=o);break}case"custom":this.custom!==void 0&&(t.custom=this.custom);break}}computeColumns(){const e=this.columnDefs();if(!e.length)return;const t=new Set,s=[];for(const o of e){if(!o.property||t.has(o.property))continue;t.add(o.property);const i={property:o.property},r=this.initialWidths.get(o);r&&o.width&&(r.value!==o.width.value||r.unit!==o.width.unit)&&o.width.unit==="px"&&(i.width=o.width.value),i.visible=ds(o),s.push(i)}return s}computeSort(){const e=this.columnDefs();if(!e.length)return;const t=s=>{const o=this.sortPriority.indexOf(s.property);return o<0?Q:o};return e.filter(s=>s.sortState&&s.property).map((s,o)=>({cd:s,index:o})).sort((s,o)=>t(s.cd)-t(o.cd)||s.index-o.index).map(({cd:s})=>({property:s.property,sortState:s.sortState}))}computeScroll(){const e=this.scope.scrollViewport,t={left:e.scrollLeft,top:e.scrollTop},s=this.scope.getFirstVisibleRowIndex();if(s>-1&&this.body().getRowCount()>0){const o=this.idAt(s,this.warns("scroll"));o!==void 0&&(t.firstRowId=o)}return t}computeTree(){const e=this.body();if(!_(e))return;const t=[],s=[],o=this.warns("tree");return this.walkTree(e,i=>{var r;if((r=i.children)!=null&&r.length){const n=this.idOfRow(i,-1,o);n!==void 0&&(i.expanded?t:s).push(n)}}),t.length<=s.length?{expandedRowIds:t}:{collapsedRowIds:s}}computeChecked(){const e=this.body().rowSelectionModel;if(!e)return;const t=this.warns("checked"),s=[];for(const o of e.getCheckedRows()??[]){const i=this.idOfRow(o,-1,t);i!==void 0&&s.push(i)}return s}computeSelection(){const e=this.scope.selectionModel();if(!e||!e.selectionType||e.selectionType==="none")return;const t=e.createSnapshot?e.createSnapshot():{ranges:e.getRanges(),negativeRanges:[],allSelected:e.isAllSelected()},s=this.warns("selection"),o=r=>r.map(n=>this.toStateRange(n,s)).filter(n=>!!n),i={ranges:o(t.ranges)};return t.negativeRanges.length&&(i.negativeRanges=o(t.negativeRanges)),t.allSelected&&(i.allSelected=!0),i}toStateRange(e,t){var a,c;const s={},o=Math.min(e.r1,e.r2),i=Math.max(e.r1,e.r2);if(!(o<=0&&i>=Q)){const h=this.idAt(o,t);if(h===void 0)return;if(s.fromRowId=h,i<Q){const d=this.idAt(i,t);if(d===void 0)return;s.toRowId=d}}const r=Math.min(e.c1,e.c2),n=Math.max(e.c1,e.c2);if(!(r<=0&&n>=Q)){const h=this.columnDefs(),d=(a=h[r])==null?void 0:a.property;if(!d)return;if(s.fromProperty=d,n<Q){const u=(c=h[n])==null?void 0:c.property;if(!u)return;s.toProperty=u}}return s}applyHeaderGroups(e){const t=this.scope.tableModel.getAreaModel("header");if(!t.setGroupClosed||!t.getToggleGroupStates||!Array.isArray(e))return!1;const s=new Map(t.getToggleGroupStates().map(i=>[i.id,i.closed]));let o=!1;for(const i of e)if(i&&s.has(i.id)&&s.get(i.id)!==!!i.closed){const r=t.setGroupClosed(i.id,!!i.closed);r&&"columnDefs"in this.scope.tableModel&&(this.scope.tableModel.columnDefs=r),o=!0}return o}applyColumns(e,t){const s=this.scope.tableModel,o=this.columnDefs();if(!o.length||!Array.isArray(e))return!1;const i=new Map;for(const d of e)d&&typeof d.property=="string"&&!i.has(d.property)&&o.some(u=>u.property===d.property)&&i.set(d.property,d);const r=o.map(d=>d.property),n=Array.from(i.keys()),a=new Set;r.forEach((d,u)=>{if(i.has(d)&&!a.has(d)){a.add(d);return}const f=u>0?n.lastIndexOf(r[u-1]):-1;n.splice(f+1,0,d)});for(let d=0;d<n.length;d++){const f=s.getColumnDefs().map(g=>g.property).indexOf(n[d],d);f>d&&s.changeColumnOrder(f,d)}let c=!1;return this.columnDefs().forEach((d,u)=>{var g;const f=i.get(d.property);if(f){if(typeof f.visible=="boolean"&&ds(d)!==f.visible&&((g=s.setColumnVisible)==null||g.call(s,u,f.visible)),typeof f.width=="number"&&f.width>=0)s.setColumnWidth(u,f.width);else if(t){const p=this.initialWidths.get(d);p&&(p.value!==d.width.value||p.unit!==d.width.unit)&&(p.unit==="px"?s.setColumnWidth(u,p.value):c=!0,d.width=p)}}}),c}applyTree(e){const t=this.body();if(!_(t)||!e)return;const s=Array.isArray(e.expandedRowIds);if(!s&&!Array.isArray(e.collapsedRowIds))return;const o=new Set((s?e.expandedRowIds:e.collapsedRowIds)??[]),i=t;this.walkTree(i,r=>{var n;if((n=r.children)!=null&&n.length){const a=this.idOfRow(r,-1,!1);a!==void 0&&(r.expanded=s?o.has(a):!o.has(a))}}),i.recalcVisibleTreeRows(!1)}applySort(e){var i;if(!Array.isArray(e))return;const t=this.columnDefs(),s=[],o=[];for(const r of e){if(!r||r.sortState!=="asc"&&r.sortState!=="desc")continue;const n=typeof r.property=="string"?t.findIndex(a=>a.property===r.property):typeof r.columnIndex=="number"?r.columnIndex:-1;n<0||n>=this.scope.tableModel.getColumnCount()||s.some(a=>a.columnIndex===n)||(s.push(new bt(n,r.sortState)),(i=t[n])!=null&&i.property&&o.push(t[n].property))}this.scope.applySortItems(s),this.sortPriority=o}applyChecked(e){const t=this.body(),s=t.rowSelectionModel;if(!s||!Array.isArray(e))return;const o=new Set(e);if(_(t)){const n=t;this.walkTree(n,a=>{a.checked=!1}),this.walkTree(n,a=>{const c=this.idOfRow(a,-1,!1);c!==void 0&&o.has(c)&&!a.checked&&s.checkRow(a,!0)});return}const i=t,r=i.getAllRows?i.getAllRows():Array.from({length:t.getRowCount()},(n,a)=>t.getRowByIndex(a));s.setCheckedRows(r.filter((n,a)=>{const c=this.idOfRow(n,i.getAllRows?-1:a,!1);return c!==void 0&&o.has(c)}))}applySelection(e){const t=this.scope.selectionModel();if(!t||!e||!Array.isArray(e.ranges))return;const o=[...e.ranges,...e.negativeRanges??[]].some(c=>c&&(c.fromRowId!==void 0||c.toRowId!==void 0))?this.rowIndexMap():new Map,i=this.columnDefs(),r=c=>{if(!c)return;let h=0,d=Q,u=0,f=Q;if(c.fromRowId!==void 0||c.toRowId!==void 0){const g=o.get(c.fromRowId??c.toRowId),p=c.toRowId===void 0?Q:o.get(c.toRowId);if(g===void 0||p===void 0)return;h=Math.min(g,p),d=Math.max(g,p)}if(c.fromProperty!==void 0||c.toProperty!==void 0){const g=i.findIndex(m=>m.property===(c.fromProperty??c.toProperty)),p=c.toProperty===void 0?Q:i.findIndex(m=>m.property===c.toProperty);if(g<0||p<0)return;u=Math.min(g,p),f=Math.max(g,p)}return new R(h,u,d,f)},n=c=>(c??[]).map(r).filter(h=>!!h),a={ranges:n(e.ranges),negativeRanges:n(e.negativeRanges),allSelected:!!e.allSelected};t.restoreSnapshot?t.restoreSnapshot(a):(t.clear(),a.ranges.forEach(c=>t.addSelection(c)))}applyScroll(e){if(!e||typeof e.top!="number"||typeof e.left!="number"||(this.scope.scrollViewport.scrollTo(e.left,e.top),this.scope.adjustAfterScrolling(),e.firstRowId===void 0))return;const t=this.scope.getFirstVisibleRowIndex();if(t>-1&&this.idAt(t,!1)===e.firstRowId)return;const s=this.rowIndexMap().get(e.firstRowId);s!==void 0&&(this.scope.scrollToIndex(-1,s),this.scope.adjustAfterScrolling())}columnDefs(){return this.scope.tableModel.getColumnDefs()??[]}body(){return this.scope.tableModel.getBodyModel()}headerGroupModel(){const e=this.scope.tableModel.getAreaModel("header");return e&&typeof e.getToggleGroupStates=="function"?e:void 0}warns(e){return this.persistedParts().includes(e)}ownGetRowId(){var t;const e=(t=this.scope.tableOptions.autoRestoreOptions)==null?void 0:t.getRowId;return e&&!Zr(e)?e:void 0}idAt(e,t){return this.idOfRow(this.body().getRowByIndex(e),e,t)}idOfRow(e,t,s){const o=this.ownGetRowId();if(e==null){if(o&&o.length>=2&&t>-1)return o(void 0,t);s&&!this.warnedNoRowObject&&(this.warnedNoRowObject=!0,console.warn("GuiExpert Table: the body model has no row objects – these rows are not stored. Set autoRestoreOptions.getRowId = (_row, rowIndex) => rowIndex to store them by index."));return}const i=F(e)?e.data:e;if($(i))return i.id;if(o)return o(i,t);if(i&&typeof i=="object")for(const r of["id","uuid"]){const n=i[r];if(typeof n=="string"||typeof n=="number")return n}s&&!this.warnedNoId&&(this.warnedNoId=!0,console.warn("GuiExpert Table: rows without 'id' or 'uuid' are not stored – set autoRestoreOptions.getRowId."))}rowIndexMap(){const e=this.body(),t=new Map,s=e.getRowCount();for(let o=0;o<s;o++){const i=this.idAt(o,!1);i!==void 0&&!t.has(i)&&t.set(i,o)}return t}walkTree(e,t){const s=o=>o==null?void 0:o.forEach(i=>{t(i),s(i.children)});s(e.rows)}};ee.STORAGE_SUFFIX="tableState",ee.EXPENSIVE=["tree","checked","selection"];let yt=ee;class Qo{constructor(e){this.tableScope=e,this.tableScope.hostElement.addEventListener("change",this.onHostElementChanged.bind(this),{signal:this.tableScope.listenerAbortController.signal}),this.tableScope.hostElement.addEventListener("keydown",this.onHostElementKeyDown.bind(this),{signal:this.tableScope.listenerAbortController.signal})}onHostElementKeyDown(e){if(e.key!=="Escape"||!this.tableScope.isEditing())return;const t=e.target;(t instanceof HTMLInputElement||t instanceof HTMLSelectElement||t instanceof HTMLTextAreaElement)&&t.getAttribute("data-area")==="body"&&(e.preventDefault(),e.stopPropagation(),this.tableScope.cancelEditing(t))}onHostElementChanged(e){if(e.target instanceof HTMLInputElement||e.target instanceof HTMLSelectElement||e.target instanceof HTMLTextAreaElement){const t=e.target,s=t.getAttribute("data-area"),o=t.getAttribute("data-row-index"),i=t.getAttribute("data-col-index");if(s&&o&&i){const r=it(s),n=Number(o),a=Number(i);this.tableScope.updateModelValueAfterEdit(r,n,a,t.value)}}}}class fs{constructor(e=-1,t=-1){this.rowIndex=e,this.columnIndex=t}}class Pe{constructor(e,t,s){this.cells=e,this.changes=t,this.source=s}static createForChanges(e,t){const s=e.filter(o=>o.rowIndex>-1).map(o=>new fs(o.rowIndex,o.columnIndex));return new Pe(s,e,t)}static createSingle(e,t){return new Pe([new fs(e,t)])}}class ei{constructor(e,t,s,o,i,r,n,a){this.scrollTop=e,this.scrollLeft=t,this.scrollHeight=s,this.scrollWidth=o,this.clientHeight=i,this.clientWidth=r,this.scrollFactorY=n,this.scrollFactorX=a}}class we{constructor(e){this.tableScope=e,this.ignoreNextClick=!1,this.anchorRanges=[],this.getSelectionModel=()=>this.tableScope.selectionModel(),this.getFocusModel=()=>this.tableScope.focusModel()}onMouseDown(){this.ignoreNextClick=!1,this.dragSnapshot=void 0}onMouseDragging(e,t){var o;if(!t||t.action||t.areaIdent!=="body"||e.areaIdent!=="body"||t.rowIndex<0||t.columnIndex<0||e.rowIndex<0||e.columnIndex<0)return!1;const s=(o=this.getSelectionModel)==null?void 0:o.call(this);return!s||!("selectionType"in s)||s.selectionType!=="range"?!1:(this.batch(()=>{var n,a,c;!!((n=t.originalEvent)!=null&&n.ctrlKey||(a=t.originalEvent)!=null&&a.metaKey)&&we.hasSnapshots(s)?(this.dragSnapshot=this.dragSnapshot??s.createSnapshot(),s.restoreSnapshot(this.dragSnapshot)):s.clear(),s.addSelection(this.createRangeByEvents(e,t));const r=(c=this.getFocusModel)==null?void 0:c.call(this);r&&!r.hasFocus(t.rowIndex,t.columnIndex)&&r.setFocus(t.rowIndex,t.columnIndex),this.previousEvt=t.clone(),this.anchorRanges=[],this.ignoreNextClick=e.rowIndex!==t.rowIndex||e.columnIndex!==t.columnIndex,this.tableScope.onSelectionChanged(s)}),!0)}onMouseClicked(e,t){if(this.ignoreNextClick)return this.ignoreNextClick=!1,!1;if(e.areaIdent==="header"&&e.clickCount===1&&this.isRowNumberColumn(e.columnIndex)&&e.rowIndex===this.tableScope.tableModel.getAreaModel("header").getRowCount()-1)return this.selectAllByRowNumberHeader();if(e.areaIdent!=="body"||e.rowIndex<0||e.columnIndex<0||e.clickCount>1)return!1;let s=!1;if(this.getSelectionModel&&this.getFocusModel){const o=this.getSelectionModel(),i=this.getFocusModel();o&&i&&(this.batch(()=>{var d,u,f,g;i.hasFocus(e.rowIndex,e.columnIndex)||i.setFocus(e.rowIndex,e.columnIndex);const r=!!((d=e.originalEvent)!=null&&d.shiftKey),n=!!((u=e.originalEvent)!=null&&u.ctrlKey||(f=e.originalEvent)!=null&&f.metaKey),a=!!((g=e.originalEvent)!=null&&g.altKey),c=this.isRowNumberColumn(e.columnIndex)&&we.isRangeSelection(o);if(r&&this.previousEvt){if(this.anchorRanges.length&&we.hasSnapshots(o)){const m=o.createSnapshot();o.restoreSnapshot({...m,ranges:m.ranges.filter(b=>!this.anchorRanges.includes(b))})}const p=this.createRangeByEvents(e,this.previousEvt);c&&(p.c1=0,p.c2=Number.MAX_SAFE_INTEGER),o.addSelection(p),this.anchorRanges=[p],this.tableScope.onSelectionChanged(o);return}const h=o.getRanges().slice();c?this.clickRowNumber(o,e.rowIndex,e.columnIndex,r,n,a):n&&a?o.removeSelection(R.singleCell(e.rowIndex,e.columnIndex)):n?o.togglePoint(e.rowIndex,e.columnIndex):(!r&&o.hasSelection()&&o.clear(),o.firstClick(e.rowIndex,e.columnIndex)),this.anchorRanges=o.getRanges().filter(p=>!h.includes(p)),this.previousEvt=e.clone(),this.tableScope.onSelectionChanged(o)}),s=!0)}return s}onActionTriggered(e){var t,s;if(this.getSelectionModel&&this.getFocusModel){const o=this.getSelectionModel(),i=this.getFocusModel();if(o&&i){if(e==="SELECT_ALL")return o.selectAll(),this.tableScope.repaint(),this.announce(r=>r.allSelected()),!0;if(e==="DESELECT_ALL")return o.clear(),this.tableScope.repaint(),this.announce(r=>r.selectionCleared()),!0;if(e==="TOGGLE_SELECTION"&&((s=(t=this.tableScope).getHeaderFocus)!=null&&s.call(t)))return!1;if(e==="TOGGLE_SELECTION"){const[r,n]=i.getFocus();return this.isRowNumberColumn(n)&&we.isRangeSelection(o)?(this.clickRowNumber(o,r,n,!1,!0,!1),this.tableScope.onSelectionChanged(o),this.tableScope.repaint(),!0):(o.togglePoint(r,n),this.tableScope.repaint(),!0)}}}return!1}isRowNumberColumn(e){var t;return e>-1&&L((t=this.tableScope.tableModel)==null?void 0:t.getColumnDef(e))}selectAllByRowNumberHeader(){var s;const e=(s=this.getSelectionModel)==null?void 0:s.call(this),t=e==null?void 0:e.selectionType;return!e||t!=="row"&&t!=="range"?!1:(this.batch(()=>{e.selectAll(),this.tableScope.onSelectionChanged(e)}),this.announce(o=>o.allSelected()),!0)}clickRowNumber(e,t,s,o,i,r){const n=new R(t,0,t,Number.MAX_SAFE_INTEGER);i&&r?e.removeSelection(n):i?e.isSelected(t,s)?e.removeSelection(n):e.addSelection(n):(!o&&e.hasSelection()&&e.clear(),e.addSelection(n))}static isRangeSelection(e){return e.selectionType==="range"}announce(e){var s;const t=(s=this.getSelectionModel)==null?void 0:s.call(this);(t==null?void 0:t.selectionType)!=="none"&&this.tableScope.ariaTexts&&typeof this.tableScope.announce=="function"&&this.tableScope.announce(e(this.tableScope.ariaTexts))}batch(e){typeof this.tableScope.holdSelectionEvents=="function"?this.tableScope.holdSelectionEvents(e):e()}static hasSnapshots(e){return typeof e.createSnapshot=="function"&&typeof e.restoreSnapshot=="function"}createRangeByEvents(e,t){t||(t=e);const s=Math.min(e.rowIndex,t==null?void 0:t.rowIndex),o=Math.max(e.rowIndex,t==null?void 0:t.rowIndex),i=Math.min(e.columnIndex,t==null?void 0:t.columnIndex),r=Math.max(e.columnIndex,t==null?void 0:t.columnIndex);return R.create({rowIndex1:s,columnIndex1:i,rowIndex2:o,columnIndex2:r})}}class ti{get(){return{f2:"START_EDITING",space:"TOGGLE_SELECTION","ctrl+num_add":"SELECT_ALL","ctrl+a":"SELECT_ALL","ctrl+shift+a":"DESELECT_ALL","ctrl+x":"DESELECT_ALL","ctrl+num_subtract":"DESELECT_ALL","meta -":"DESELECT_ALL",arrowup:"NAVIGATE_UP",arrowdown:"NAVIGATE_DOWN",arrowleft:"NAVIGATE_LEFT",arrowright:"NAVIGATE_RIGHT",home:"NAVIGATE_ROW_START",end:"NAVIGATE_ROW_END","ctrl+home":"NAVIGATE_FIRST_CELL","ctrl+end":"NAVIGATE_LAST_CELL",pageup:"NAVIGATE_PAGE_UP",pagedown:"NAVIGATE_PAGE_DOWN",enter:"ACTIVATE_CELL","ctrl+alt+up":"MOVE_ROW_UP","ctrl+alt+down":"MOVE_ROW_DOWN","ctrl+d":"FILL_DOWN","ctrl+r":"FILL_RIGHT","meta+c":"COPY_2_CLIPBOARD","ctrl+c":"COPY_2_CLIPBOARD"}}}class si{get(){return{f2:"START_EDITING",space:"TOGGLE_SELECTION","ctrl+num_add":"SELECT_ALL","meta+a":"SELECT_ALL","ctrl+a":"SELECT_ALL","meta+x":"DESELECT_ALL","meta+shift+a":"DESELECT_ALL","ctrl+shift+a":"DESELECT_ALL","ctrl+num_subtract":"DESELECT_ALL","ctrl -":"DESELECT_ALL",arrowup:"NAVIGATE_UP",arrowdown:"NAVIGATE_DOWN",arrowleft:"NAVIGATE_LEFT",arrowright:"NAVIGATE_RIGHT",home:"NAVIGATE_ROW_START",end:"NAVIGATE_ROW_END","meta+left":"NAVIGATE_ROW_START","meta+right":"NAVIGATE_ROW_END","ctrl+home":"NAVIGATE_FIRST_CELL","ctrl+end":"NAVIGATE_LAST_CELL","meta+up":"NAVIGATE_FIRST_CELL","meta+down":"NAVIGATE_LAST_CELL",pageup:"NAVIGATE_PAGE_UP",pagedown:"NAVIGATE_PAGE_DOWN",enter:"ACTIVATE_CELL","ctrl+alt+up":"MOVE_ROW_UP","ctrl+alt+down":"MOVE_ROW_DOWN","meta+d":"FILL_DOWN","meta+r":"FILL_RIGHT","meta+c":"COPY_2_CLIPBOARD","ctrl+c":"COPY_2_CLIPBOARD"}}}const tn={arrowup:"up",arrowdown:"down",arrowleft:"left",arrowright:"right"};function Ks(l){return l.trim().replace(/\+/g," ").replace(/ +/g," ").replace(/⌫/g,"backspace").replace(/↩/g,"enter").replace(/⇧/g,"shift").replace(/⌥/g,"alt").replace(/option/g,"alt").replace(/opt/g,"alt").replace(/⌃/g,"ctrl").replace(/control/g,"ctrl").replace(/command/g,"cmd").replace(/meta/g,"cmd").replace(/escape/g,"esc").replace(/⌘/g,"cmd").replace(/\*/g,"multiply").split(" ").filter(e=>e).map(e=>tn[e]??e).filter((e,t,s)=>s.indexOf(e)===t).sort((e,t)=>{const s={cmd:1,ctrl:2,alt:3,shift:4},o=s[e]||5,i=s[t]||5;return o!==i?o-i:e.localeCompare(t)}).join(" ")}function oi(l){let e=l.key.toLowerCase();if(e===" "&&(e="space"),e==="arrowleft"&&(e="left"),e==="arrowright"&&(e="right"),e==="arrowup"&&(e="up"),e==="arrowdown"&&(e="down"),e==="delete"&&l.code==="Delete"&&(e="delete"),e==="backspace"&&(e="backspace"),e==="escape"&&(e="esc"),e==="return"&&(e="enter"),l.code.startsWith("Numpad")){const s=l.code.replace("Numpad","").toLowerCase();s==="add"?e="num_add":s==="subtract"?e="num_subtract":s==="multiply"?e="num_multiply":s==="divide"?e="num_divide":s==="decimal"?e="num_decimal":s==="enter"?e="num_enter":e="num_"+s}l.code.match(/^F\d+$/)&&(e=l.code.toLowerCase()),l.code.match(/^Digit\d+$/)&&(e=l.code.replace(/Digit/g,""));let t="";return l.ctrlKey&&(t+=" ctrl"),l.altKey&&(t+=t+" alt"),l.shiftKey&&(t+=t+" shift"),l.metaKey&&(t+=t+" cmd"),Ks(t+" "+e)}class ii{constructor(e){this.tableScope=e,this.shortcutActionIdMapping={},this.listener=[],this.listener.push(e),this.init()}addListener(e){this.listener.includes(e)||this.listener.push(e)}init(){var e,t;(t=(e=this.tableScope)==null?void 0:e.tableOptions)!=null&&t.shortcutActionsDisabled?this.isDebug()&&console.debug("ShortcutService skipped."):(this.assignPredefinedSystemShortcutMappings(),Object.assign(this.shortcutActionIdMapping,this.tableScope.tableOptions.shortcutActionIdMapping),this.isDebug()&&console.debug("ShortcutService",this.shortcutActionIdMapping),this.tableScope.hostElement.addEventListener("keydown",this.onKeyDown.bind(this),{signal:this.tableScope.listenerAbortController.signal}))}assignPredefinedSystemShortcutMappings(){this.isMacintosh()?Object.assign(this.shortcutActionIdMapping,new si().get()):Object.assign(this.shortcutActionIdMapping,new ti().get())}isMacintosh(){return navigator.platform.indexOf("Mac")>-1}isDebug(){return this.isLocalhost()}isLocalhost(){return location.hostname==="localhost"||location.hostname==="127.0.0.1"}onKeyDown(e){const t=e.target;if(t&&(t.isContentEditable||["INPUT","SELECT","TEXTAREA","BUTTON","A"].includes(t.tagName)))return;const s=this.findEntity(e);s&&this.emit(s)&&(e.preventDefault(),e.stopPropagation())}emit(e){this.isDebug()&&console.debug("ShortcutService emit :",e);let t=!1;for(const s of this.listener)s.onActionTriggered(e)&&(t=!0);return t}findEntity(e){const t=oi(e);this.isDebug()&&console.debug("ShortcutService shortcut :",t);for(const s in this.shortcutActionIdMapping)if(Ks(s)===t)return this.isDebug()&&console.debug("ShortcutService action :",this.shortcutActionIdMapping[s]),this.shortcutActionIdMapping[s]}getShortcutActionMapping(){return this.shortcutActionIdMapping}}class Ct{onCheckboxChanged(e){}onContextmenu(e){}onModelChanged(e){}onMouseClicked(e){}onMouseDragging(e){}onMouseDraggingEnd(e){}onMouseMoved(e){}onScroll(e){}onSelectionChanged(e){}onFocusChanged(e){}onStateChanged(e){}onRowDragStart(e){}onRowDragMove(e){}onRowDragEnd(e){}onBatchEditChanged(e){}}class ri{setStyle(e,t,s){return e.style[t]=s,e}appendText(e,t){const s=this.createText(t);return this.appendChild(e,s),s}addClass(e,t){return t.includes(" ")?t.split(" ").forEach(s=>e.classList.add(s)):e.classList.add(t),e}removeClass(e,t){return t.includes(" ")?t.split(" ").forEach(s=>e.classList.remove(s)):e.classList.remove(t),e}appendChild(e,t){e.appendChild(t)}createElement(e){return document.createElement(e)}createText(e){return document.createTextNode(e)}setAttribute(e,t,s){e.setAttribute(t,s)}removeAttribute(e,t){e.removeAttribute(t)}}class ni{render(e,t,s,o,i,r,n){if(i.isEditable(t,s)){n.addClass(e,"ge-table-row-input-div");const a=r!==void 0?r:i.getValueAt(t,s);e.innerHTML=`
|
|
46
|
+
render scope: this.lastFullVisibleRowIndex <- `+this.lastFullVisibleRowIndex),this.pruneRowDivCache(s),this.pruneRowDivCache(o),this.pruneRowDivCache(i),this.colAndRowspanModels&&this.colAndRowspanModels[e]){const v=((F=this.colAndRowspanModels[e])==null?void 0:F.getRanges())??[];if(v.length)for(const $ of v){if($.r1>=d||$.c1>=f)continue;let T=0,G=o.child,z="center";if($.c1<p)G=s.child,z="west";else if(g>0&&$.c1>=f-g)G=i.child,z="east";else{const N=this.areaBodyCenterGeo.width-this.tableModel.getContentWidthInPixel();T=this.snapToDevicePixel(this.scrollFactorX*N)-this.areaBodyWestGeo.width,z="center"}this.drawBigCell($,T,t,h,G,z)}}this.updateRowGroupRoles(s,o,i)}getAriaGridInfo(){return this.ariaGridInfo||(this.ariaGridInfo=nt.create(this.tableModel)),this.ariaGridInfo}applyRowAria(e,t,s,o,i=!0){var n,l;const r=this.dom.domService;if(r.setAttribute(e,"role","row"),r.setAttribute(e,"aria-rowindex",`${this.getAriaGridInfo().rowIndex(t,o)}`),!(t!=="body"||!i)){if(this.tree&&B(s)){const c=this.treeAriaInfo.get(s,o);c&&(r.setAttribute(e,"aria-level",`${c.level}`),r.setAttribute(e,"aria-setsize",`${c.setSize}`),r.setAttribute(e,"aria-posinset",`${c.posInSet}`),c.expanded===void 0?this.dom.removeAttribute(e,"aria-expanded"):r.setAttribute(e,"aria-expanded",`${c.expanded}`))}if((n=this.masterDetailService)!=null&&n.isActive()&&(this.masterDetailService.isMasterAt(o)?r.setAttribute(e,"aria-expanded",`${this.masterDetailService.isExpandedAt(o)}`):e.hasAttribute("aria-expanded")&&this.dom.removeAttribute(e,"aria-expanded")),this.ariaSelectionKind==="row"){const c=(l=this.getSelectionModel)==null?void 0:l.call(this);r.setAttribute(e,"aria-selected",c&&c.getSelectionCount(o,0)>0?"true":"false")}else e.hasAttribute("aria-selected")&&this.dom.removeAttribute(e,"aria-selected")}}applyCellAria(e,t,s,o,i){var f,g;const r=this.dom.domService,n=this.getAriaGridInfo(),l=t==="header",c=t==="body"&&O(this.tableModel.getColumnDef(i))||t==="footer"&&Oo(s)&&s.isLabelCell(o,i)||t==="body"&&X(s)&&s.isGroupLabelCell(o,i)||!l&&!!((f=s.isRowHeaderCell)!=null&&f.call(s,o,i));r.setAttribute(e,"role",l?"columnheader":c?"rowheader":"gridcell");const h=n.colIndex(i);h>0&&r.setAttribute(e,"aria-colindex",`${h}`);const d=Math.max(1,s.getRowspanAt(o,i)||1),u=Math.max(1,s.getColspanAt(o,i)||1);if(u>1&&r.setAttribute(e,"aria-colspan",`${n.colSpan(i,u)}`),d>1&&r.setAttribute(e,"aria-rowspan",`${d}`),(d>1||u>1)&&this.renderedSpanCells.add(`${t}:${o}:${i}`),l&&o+d>=n.headerRowCount&&u===1){const p=this.tableModel.getColumnDef(i);if((g=p==null?void 0:p.sortable)!=null&&g.call(p)){const m=p.sortState;r.setAttribute(e,"aria-sort",m==="asc"?"ascending":m==="desc"?"descending":"none")}}return[d,u]}updateRowGroupRoles(...e){for(const t of e){let s=0;for(const i of Array.from(t.child.children)){if(!i.classList.contains("ge-table-row-div")||i.classList.contains("ge-table-span-row")){i.getAttribute("role")==="row"&&s++;continue}i.querySelector(':scope > [role="gridcell"], :scope > [role="columnheader"], :scope > [role="rowheader"]')?s++:i.getAttribute("role")==="row"&&(this.dom.domService.setAttribute(i,"role","presentation"),this.dom.removeAttribute(i,"aria-rowindex"))}const o=t.child.firstElementChild&&s?"rowgroup":"presentation";t.child.getAttribute("role")!==o&&this.dom.domService.setAttribute(t.child,"role",o)}}setHostAttribute(e,t){this.setHostAriaAttribute(e,t)}updateHostAria(){var i;const e=this.getAriaGridInfo();this.setHostAttribute("aria-rowcount",`${e.rowCount}`),this.setHostAttribute("aria-colcount",`${e.colCount}`);const t=(i=this.getSelectionModel)==null?void 0:i.call(this),s=this.ariaSelectionKind!=="none"&&(t==null?void 0:t.selectionMode)==="multi";this.setHostAttribute("aria-multiselectable",s?"true":void 0);const o=this.ariaFocusedCell;if(o){const r=this.ariaIds.cell(o.area,o.rowIndex,o.columnIndex);this.dom.domService.setAttribute(o.element,"id",r),this.setHostAttribute("aria-activedescendant",r)}else this.setHostAttribute("aria-activedescendant",void 0)}setAriaFocusedCell(e,t,s,o){const i=this.ariaFocusedCell;i&&i.area===t&&i.rowIndex===s&&i.columnIndex===o||(this.ariaFocusedCell={element:e,area:t,rowIndex:s,columnIndex:o})}getAriaSelectionKind(){var s;const e=(s=this.getSelectionModel)==null?void 0:s.call(this);if(!e)return"none";const t=e.selectionType;return t==="none"?"none":t==="row"?"row":"cell"}getColumnAriaLabel(e){const t=this.tableModel.getColumnDef(e);if(t!=null&&t.headerLabel)return`${t.headerLabel}`;const s=this.tableModel.getAreaModel("header"),o=(s==null?void 0:s.getRowCount())??0;if(o>0){const i=s.getValueAt(o-1,e),r=i&&typeof i=="object"&&"data"in i?i.data:i;if(typeof r=="string"&&r.trim()||typeof r=="number")return`${r}`}return(t==null?void 0:t.property)||`Column ${e+1}`}getCheckboxAriaLabel(e,t){return e==="header"?this.ariaTexts.selectAllRows():this.ariaTexts.selectRow(t+1)}labelControl(e,t){t&&!e.hasAttribute("aria-label")&&!e.hasAttribute("aria-labelledby")&&this.dom.domService.setAttribute(e,"aria-label",t)}labelRendererControls(e,t,s,o,i){if(Os(t)||e.classList.contains("ge-table-row-checkbox-div")){const n=e.querySelector("input.ge-table-row-checkbox");if(n){this.labelControl(n,this.getCheckboxAriaLabel(s,o));return}const l=e.querySelector("input.ge-input-checkbox");l&&this.labelControl(l,this.getColumnAriaLabel(i));return}const r=this.tableOptions.ariaTexts;if(s==="header"&&(r!=null&&r.expandGroup||r!=null&&r.collapseGroup)){const n=e.querySelector('.ge-table-toggle-icon-div[role="button"]');if(n){const l=n.getAttribute("data-ge-group-label")??"",c=n.getAttribute("aria-expanded")==="true";this.dom.domService.setAttribute(n,"aria-label",c?this.ariaTexts.collapseGroup(l):this.ariaTexts.expandGroup(l))}}}findCellDiv(e,t){for(const s of e){const o=s.querySelector(`:scope > .ge-table-col-div[data-col-index="${t}"]`);if(o)return o}}pruneRowDivCache(e){const t=e.cache;for(const s in t)t[s].parentNode!==e.child&&delete t[s]}drawBigCell(e,t,s,o,i,r){const n=s+(o.areaIdent==="body"?this.getBodyRowLayout().getTop(e.r1):this.getRowHeights(0,e.r1-1,o).reduce((w,y)=>w+y,0)),l=this.tableModel.getColumnCount(),c=this.tableModel.getFixedRightColumnCount();let h=0;c>0&&e.c1>=l-c&&(h=l-c);const d=t+this.getColumnWidths(h,e.c1-1).reduce((w,y)=>w+y,0),u=this.getRowHeights(e.r1,e.r2,o).reduce((w,y)=>w+y,0),f=this.getColumnWidths(e.c1,e.c2).reduce((w,y)=>w+y,0);let g=!1;const p=this.getSelectionModel?this.getSelectionModel():void 0;p&&(g=p.getSelectionCount(e.r1,e.c1)>0);const m=o.areaIdent,b=this.dom.applyStyle(this.dom.createDivWithClass("ge-table-span-row",i),{position:"absolute",left:"0",top:"0",width:"0",height:"0",overflow:"visible"});this.renderedSpanCells.has(`${m}:${e.r1}:${e.c1}`)?this.dom.setAriaHidden(b):this.applyRowAria(b,m,o,e.r1,!1),i=b,e.gammaRange?this.renderCell({areaModel:o,areaIdent:o.areaIdent,sideIdent:r,rowIndex:e.r1,columnIndex:e.c1,left:d,top:n,width:f,height:u,parent:i,cellSelected:g,lastRowOfModel:!0,gammaRange:e.gammaRange}):this.renderCell({areaModel:o,areaIdent:o.areaIdent,sideIdent:r,rowIndex:e.r1,columnIndex:e.c1,left:d,top:n,width:f,height:u,parent:i,cellSelected:g,lastRowOfModel:!0,gammaRange:e.gammaRange}),o.areaIdent==="header"&&this.tableOptions.columnsResizable&&this.isColumnResizable(e.c1)&&this.renderHeaderCellResizeHandle({rowIndex:e.r1,columnIndex:e.c1,cellLeft:d,cellTop:n,cellWidth:f,cellHeight:u,parent:i})}findRowOfImportantRowspanCell(e,t,s){const o=e.getMaxRowspan();for(let i=t-1;i>-1;i--){const r=e.getRowspanAt(i,s);if(r>1&&i+r+1>=t)return i;if(t-i>o)return-1}return-1}adjustColumnsToRowParent({areaIdent:e,sideIdent:t,areaModel:s,geo:o,parent:i,rowIndex:r,columnIndexStart:n,columnIndexEnd:l,verticalFixed:c=!1,lastRowOfModel:h=!1}){var p;let d=0;if(!c){const m=this.areaBodyCenterGeo.width-this.tableModel.getContentWidthInPixel();d=this.snapToDevicePixel(this.scrollFactorX*m)}const u=0,f=!!(e==="body"&&t);let g=d;for(let m=n;m<=l;m++){const b=g,w=this.tableModel.getColumnWidth(m);if(w>0&&b+w>0){let y=o.height;const x=s.getRowspanAt(r,m),R=s.getColspanAt(r,m);x>1&&(y=this.getRowHeights(r,r+x-1,s).reduce((F,v)=>F+v,0));let M=w;R>1&&(M=this.getColumnWidths(m,m+R-1).reduce((F,v)=>F+v,0));let D=!1;if(this.colAndRowspanModels&&this.colAndRowspanModels[e]&&(p=this.colAndRowspanModels[e])!=null&&p.isInRange(r,m)&&(D=!0),this.draggingTargetColumnIndex===m&&e!=="header"){this.renderDragTargetDiv(i,b,u,M,y);const F={left:b,top:u,width:M,height:y};this.dom.addColumnBorderDivs(this.tableOptions,i,F,e,t)}else{const F=this.renderSelectedBackgroundDiv(D,f,t,s,r,m,i,b,u,M,y);"gammaCells"in s&&s.getValueAt(r,m)&&(D=!1),D||this.renderCell({areaModel:s,areaIdent:e,sideIdent:t,rowIndex:r,columnIndex:m,left:b,top:u,width:M,height:y,parent:i,cellSelected:F,lastRowOfModel:h,gammaRange:!0}),e==="header"&&this.tableOptions.columnsResizable&&this.isColumnResizable(m)&&this.renderHeaderCellResizeHandle({rowIndex:r,columnIndex:m,cellLeft:b,cellTop:u,cellWidth:M,cellHeight:y,parent:i})}}if(g=g+w,g>this.areaBodyCenterGeo.width)break}this.tableOptions.verticalBorderVisible&&this.dom.addVerticalBorder(new te(g-1,1,o.height,0),i)}getTreeArrowColumnIndex(){const e=this.getFirstDataColumnIndex();return this.tableOptions.showCheckboxWihoutExtraColumn?e:this.tableModel.isRowCheckboxVisible()?e+1:e}getFirstDataColumnIndex(){var e,t;return rt((t=(e=this.tableModel).getColumnDefs)==null?void 0:t.call(e))}isColumnResizable(e){return!O(this.tableModel.getColumnDef(e))}adjustRowNumberColumnWidth(){var i,r;if(!this.getFirstDataColumnIndex()||this.tableModel.overridingColumnWidth>-1)return!1;const e=this.tableModel.getColumnDef(0),t=e.getWidestText(this.tableModel.getBodyModel()),s=this.rowNumberWidth;let o=(s==null?void 0:s.text)===t?s.width:-1;if(o<0||s!=null&&s.approximate&&this.findRowNumberLabel()){const[n,l]=this.measureRowNumberText(t);o=Math.max(e.options.minWidthInPx,n),this.rowNumberWidth={text:t,width:o,approximate:l}}return this.tableModel.getColumnWidth(0)===o||((r=(i=this.tableModel).isColumnVisible)==null?void 0:r.call(i,0))===!1?!1:(this.tableModel.setColumnWidth(0,o),this.tableModel.getColumnWidth(0)===o)}findRowNumberLabel(){return this.hostElement.querySelector(".ge-table-row-number .ge-table-label")}measureRowNumberText(e){const t=this.findRowNumberLabel(),s=getComputedStyle(t??this.hostElement),i=(t?(parseFloat(s.paddingLeft)||0)+(parseFloat(s.paddingRight)||0):12)+4,r=e.replace(/[0-9]/g,"0");let n=null;try{n=document.createElement("canvas").getContext("2d")}catch{n=null}return n?(n.font=s.font||`${s.fontWeight} ${s.fontSize} ${s.fontFamily}`,[Math.ceil(n.measureText(r).width+i),!t]):[Math.ceil(e.length*8+i),!t]}addAndRenderCellDiv({areaModel:e,areaIdent:t,sideIdent:s,rowIndex:o,index:i,left:r,width:n,height:l,top:c,parent:h,lastRowOfModel:d}){var ce,ut,Ke;const u=t==="body"&&this.editorRenderer&&this.editorRendererRow===o&&this.editorRendererColumn===i,f=this.tableModel.getColumnDef(i),g=O(f),p=u?this.editorRenderer:(g&&t==="body"?f.rendererMap.body:void 0)??e.getCellRenderer(o,i),m={left:r,width:n,height:l,top:c,index:i},b=e.getRowByIndex(o);let w="none";if(i===this.getTreeArrowColumnIndex()&&L(b)){const k=b;("hasDisplayedChildren"in e&&typeof e.hasDisplayedChildren=="function"?e.hasDisplayedChildren(k):!!((ce=k.children)!=null&&ce.length))?k.expanded?w="expanded":w="collapsed":w="hidden"}let x;t==="header"&&(!(f!=null&&f.sortIconVisible)||f!=null&&f.sortIconVisible())&&(x=f==null?void 0:f.sortState);const R=t==="body"&&((ut=this.batchEditService)!=null&&ut.hasPending())?this.batchEditService.getPendingAt(o,i):void 0,M=R?R.newValue:e.getValueAt(o,i),D=p||g&&t==="footer"?"":`${M??""}`,F=e.isRowChecked(o),v=this.getFirstDataColumnIndex(),$=this.tableOptions.showCheckboxWihoutExtraColumn&&i===v&&F?this.getCheckboxAriaLabel(t,o):void 0,T=this.dom.addColumnDiv({parent:h,geo:m,rowIndex:o,columnIndex:i,areaIdent:t,sideIdent:s,text:D,treeArrow:w,tableOptions:this.tableOptions,checkedType:F,sortState:x,checkboxAriaLabel:$,firstDataColumnIndex:v}),[G,z]=this.applyCellAria(T,t,e,o,i),N=(R==null?void 0:R.error)||e.getTooltipAt(o,i);N&&this.dom.setAttribute(T,"title",N),R&&(this.dom.addClass("ge-table-cell-pending",T),R.error&&(this.dom.addClass("ge-table-cell-invalid",T),this.dom.setAttribute(T,"aria-invalid","true"))),f&&f.classes[t]&&this.dom.addClasses(f.classes[t],T);let K;if(p)if(K=p.render(T,o,i,t,e,M,this.dom.domService),u){const k=T.querySelector("input, select");k&&(this.labelControl(k,this.getColumnAriaLabel(i)),k.contains(document.activeElement)||k.focus())}else this.labelRendererControls(T,p,t,o,i);const ze=e.getCustomClassesAt(o,i);if(ze.length&&this.dom.addClasses(ze,T),this.dom.addColumnBorderDivs(this.tableOptions,h,m,t,s),d&&this.dom.addHorizontalBorder({left:r,width:n,height:l,top:c+l},h),this.getFocusModel&&t==="body"&&!this.headerFocus){const k=this.getFocusModel();if(k!=null&&k.hasFocus(o,i))this.dom.addFocusBorderDivs(h,m,{}),this.setAriaFocusedCell(T,t,o,i);else if(k&&(G>1||z>1)){const[je,ao]=k.getFocus();je>=o&&je<o+G&&ao>=i&&ao<i+z&&this.setAriaFocusedCell(T,t,o,i)}}else t==="header"&&this.headerFocus&&this.headerFocus[0]===o&&this.headerFocus[1]===i&&(this.dom.addFocusBorderDivs(h,m,{}),this.setAriaFocusedCell(T,t,o,i));t==="header"&&!g&&this.dom.setAttribute(T,"data-ge-action","drag-column"),t==="body"&&((Ke=this.masterDetailService)!=null&&Ke.isActive())&&this.masterDetailService.decorateCell(T,o,i),t==="body"&&this.rowDragService&&!u&&(f!=null&&f.rowDrag&&this.rowDragService.decorateCell(T,this.rowDragService.getHandleState(o,f,e)),this.rowDragService.isDragSourceRow(o)&&this.dom.addClass("ge-table-row-dragging",T));const Te=e.getCustomStyleAt(o,i);if(Te)for(const k in Te)this.dom.domService.setStyle(T,k,Te[k]);return[T,K]}applyCssClasses(e,t={}){e&&Object.entries(t).forEach(([s,o])=>{o?this.dom.addClass(s,e):this.dom.removeClass(s,e)})}getColumnWidths(e,t){const s=[];for(let o=e;o<=t;o++)s.push(this.tableModel.getColumnWidth(o));return s}getRowHeights(e,t,s){const o=[];for(let i=e;i<=t;i++)o.push(s.getRowHeight(i));return o}adjustHoverRows(e){if(this.tableOptions.hoverRowVisible&&e.rowIndex>-1&&e.areaIdent==="body"){const t=this.hostElement.clientWidth,s=this.tableModel.getAreaModel("body").getRowHeight(e.rowIndex),o=this.contentScrollTop,i=e.rowTop+this.areaHeaderCenter.parent.clientHeight-o;this.dom.applyStyle(this.hoverRow,{left:"0",top:i+"px",width:t+"px",height:s+"px",display:"block"})}else this.hideHoverRow()}hideHover(){this.hideHoverRow(),this.hideHoverColumn()}hideHoverRow(){this.dom.applyStyle(this.hoverRow,{display:"none"})}adjustHoverColumns(e){if(this.tableOptions.hoverColumnVisible&&e.rowIndex>-1){const t=this.hostElement.clientHeight,s=this.tableModel.getColumnWidth(e.columnIndex),o=this.getColumnLeftInHost(e.columnIndex,e.columnLeft);this.dom.applyStyle(this.hoverColumn,{left:o+"px",top:"0px",width:s+"px",height:t+"px",display:"block"})}else this.hideHoverColumn()}getColumnLeftInHost(e,t){const s=this.tableModel.getColumnCount(),o=this.tableModel.getFixedLeftColumnCount(),i=this.tableModel.getFixedRightColumnCount();if(e<o)return t;if(i>0&&e>=s-i){const r=this.tableModel.getXPosByColumnIndex(s-i);return this.areaBodyEastGeo.left+t-r}return t-this.getContentScrollLeft()}getContentScrollLeft(){const e=this.areaBodyCenterGeo.width-this.tableModel.getContentWidthInPixel();return-this.snapToDevicePixel(this.scrollFactorX*e)}hideHoverColumn(){this.dom.applyStyle(this.hoverColumn,{display:"none"})}disposeRendering(){this.debounceTimeout&&(clearTimeout(this.debounceTimeout),this.debounceTimeout=null);for(const e of["header","body","footer"])for(;this.cleanupFunctions[e].length;){const t=this.cleanupFunctions[e].shift();t&&t()}}debounce(e,t=1e3){this.debounceTimeout&&clearTimeout(this.debounceTimeout),this.debounceTimeout=setTimeout(()=>{this.debounceTimeout=null,e.call(this)},t)}adjustDraggingColumn(e,t,s){var o;if(this.dragging){const i=this.hostElement.clientHeight,r=this.tableModel.getColumnWidth(t);if((o=e.originalEvent)!=null&&o.clientX){const c={left:(this.isRtl()?this.clientXToHostX(e.originalEvent.clientX):e.originalEvent.clientX)-r/2,width:r,height:i,top:0,index:t};this.dom.applyStyle(this.draggingColumn,{background:"rgba(128,128,128,0.2)",display:"block",overflow:"hidden"}),this.dom.applyStyleInPx(this.draggingColumn,c),s&&this.renderContentOfDraggingColumn(c)}}else this.hideDraggingColumn()}renderContentOfDraggingColumn(e){const t=this.renderContentOfDraggingColumnForArea(e,"header",0),s=Math.max(0,this.firstVisibleRowIndex),o=t+this.getBodyRowTop(s)-this.contentScrollTop;this.renderContentOfDraggingColumnForArea(e,"body",o,s,this.hostElement.clientHeight)}renderContentOfDraggingColumnForArea(e,t,s=0,o=0,i=Number.POSITIVE_INFINITY){const r="center",n=this.tableModel.getAreaModel(t),l=n==null?void 0:n.getRowCount();if(l){const c=e.index??0,h=this.draggingColumn;for(let d=o;d<l&&s<i;d++){const u=s,f=n.getRowHeight(d),g={left:0,width:e.width,height:f,top:u,index:d},p=n.getValueAt(d,c),m=n.getCellRenderer(d,c),b=m?"":`${p??""}`,w={parent:h,geo:g,rowIndex:d,columnIndex:c,areaIdent:t,sideIdent:r,text:b},y=this.dom.addColumnDiv(w);let x;m&&(x=m.render(y,d,c,t,n,p,this.dom.domService),x&&this.cleanupFunctions[t].push(x));const R=n.getCustomClassesAt(d,c);R.length&&this.dom.addClasses(R,y);const M=this.tableModel.getColumnDef(c);M&&M.classes[t]&&this.dom.addClasses(M.classes[t],y),this.dom.addColumnBorderDivs(this.tableOptions,h,g,t,r);const D=n.getCustomStyleAt(d,c);if(D)for(const F in D)this.dom.domService.setStyle(y,F,D[F]);s=s+f}}return s}hideDraggingColumn(){this.dom.applyStyle(this.draggingColumn,{display:"none"})}renderDragTargetDiv(e,t,s,o,i){const r=this.dom.applyStylePosistionAbsolute(this.dom.setAriaHidden(this.dom.createDivWithClass("ge-table-drop-zone",e)));return this.dom.setStyle(r,"left",`${t}px`),this.dom.setStyle(r,"top",`${s}px`),this.dom.setStyle(r,"width",`${o}px`),this.dom.setStyle(r,"height",`${i}px`),r}renderSelectedBackgroundDiv(e,t,s,o,i,r,n,l,c,h,d){let u=!1;if(!e&&t&&o.isSelectable(i,r)&&this.getSelectionModel){const f=this.getSelectionModel();if(f){const g=f.getSelectionCount(i,r);u=g>0;for(let p=0;p<g;p++){const m=this.dom.applyStylePosistionAbsolute(this.dom.setAriaHidden(this.dom.createDivWithClass(`ge-table-${o.areaIdent}-${s}-selected-range`,n)));this.dom.setStyle(m,"left",`${l}px`),this.dom.setStyle(m,"top",`${c}px`),this.dom.setStyle(m,"width",`${h}px`),this.dom.setStyle(m,"height",`${d}px`)}}}return u}renderCell({areaModel:e,areaIdent:t,sideIdent:s,rowIndex:o,columnIndex:i,left:r,top:n,width:l,height:c,parent:h,cellSelected:d,lastRowOfModel:u}){const[f,g]=this.addAndRenderCellDiv({areaModel:e,areaIdent:t,sideIdent:s,rowIndex:o,index:i,left:r,width:l,height:c,top:n,parent:h,lastRowOfModel:u});d&&this.dom.addClass(`ge-table-${t}-${s}-selected-range`,f),t==="body"&&this.ariaSelectionKind==="cell"&&this.dom.domService.setAttribute(f,"aria-selected",d?"true":"false"),g&&this.cleanupFunctions[t].push(g)}renderHeaderCellResizeHandle({rowIndex:e,columnIndex:t,cellLeft:s,cellTop:o,cellWidth:i,cellHeight:r,parent:n}){const l=this.dom.domService,c=this.tableOptions.columnResizeHandleWidthInPx??2,h=l.createElement("div");l.setAttribute(h,"data-col-index",`${t}`),l.setAttribute(h,"data-row-index",`${e}`),l.setAttribute(h,"data-area","header"),l.setAttribute(h,"data-ge-action","resize-column"),l.addClass(h,"ge-table-column-resize-handle"),l.setAttribute(h,"aria-hidden","true"),l.setStyle(h,"display","clip"),l.setStyle(h,"position","absolute"),l.setStyle(h,"cursor","col-resize"),this.dom.setStyle(h,"left",`${s+i-c}px`),l.setStyle(h,"top",`${o}px`),l.setStyle(h,"width",`${c}px`),l.setStyle(h,"height",`${r}px`),l.appendChild(n,h)}}class St{constructor(e,t){this.columnIndex=e,this.sortState=t}}const Ue=()=>!0,qs=()=>!1,Be=new WeakSet,Rt=new WeakMap;function ii(a,e){e?Be.delete(a):Be.add(a),ri(a)}function is(a,e){e?Rt.set(a,e):Rt.delete(a),ri(a)}function ms(a){var e;return Rt.has(a)?!Be.has(a):!Be.has(a)&&((e=a.isVisible)==null?void 0:e.call(a))!==!1}function ri(a){const e=Rt.get(a),t=!Be.has(a);e?a.isVisible=()=>!Be.has(a)&&e():a.isVisible=t?Ue:qs}const ni=new WeakSet;function dn(a){return ni.add(a),a}function ai(a){return typeof a=="function"&&ni.has(a)}class li{constructor(e,t){this.state=e,this.changedParts=t}}const he=Object.freeze(["headerGroups","columns","tree","sort","checked","selection","details","scroll","custom"]),un=["sortingState","scrollState","collapsedExpandedState"];function rs(a,e){try{const t=a.getItem(e);return t?JSON.parse(t):void 0}catch{return}}function ci(a,e,t){const s={version:1};let o=!1;const i=rs(a,e+"sortingState");Array.isArray(i)&&(o=!0,s.sort=i.filter(l=>l&&typeof l.columnIndex=="number"&&(l.sortState==="asc"||l.sortState==="desc")).map(l=>{const c=t[l.columnIndex],h=l.sortState;return c?{property:c,sortState:h}:{columnIndex:l.columnIndex,sortState:h}}));const r=rs(a,e+"scrollState");Array.isArray(r)&&typeof r[0]=="number"&&typeof r[1]=="number"&&(o=!0,s.scroll={left:r[0],top:r[1]});const n=rs(a,e+"collapsedExpandedState");if(n&&typeof n=="object"){o=!0;let l;n.allExpanded?l={collapsedRowIds:[]}:n.allCollapsed?l={expandedRowIds:[]}:n.mode==="expanded"?l={expandedRowIds:n.rowIds??[]}:l={collapsedRowIds:n.rowIds??[]},s.tree=l}return o?s:void 0}function bs(a,e){for(const t of un)try{a.removeItem(e+t)}catch{}}const fn={headerGroups:"autoRestoreHeaderGroupState",columns:"autoRestoreColumnLayout",tree:"autoRestoreCollapsedExpandedState",sort:"autoRestoreSortingState",checked:"autoRestoreCheckedState",selection:"autoRestoreSelectedState",scroll:"autoRestoreScrollPosition",custom:"autoRestoreCustomState",details:"autoRestoreDetailState"},be=a=>a==="checked"?"checkedRowIds":a==="details"?"detailRowIds":a,oe=Number.MAX_SAFE_INTEGER,ie=class ie{constructor(e){this.scope=e,this.restoring=!1,this.started=!1,this.destroyed=!1,this.dirty=new Set,this.lastReported=new Map,this.reported={version:1},this.legacyRemoved=!1,this.sortPriority=[],this.initialWidths=new Map,this.startState={},this.custom=void 0,this.warnedNoRowObject=!1,this.warnedNoId=!1,this.warnWithoutStorageKey()}initBeforeModel(){this.started||(this.started=!0,this.restoring=!0,this.startState=this.readStartState(),this.defaultState={version:1},this.computePart("headerGroups",this.defaultState),this.startState.headerGroups&&this.applyHeaderGroups(this.startState.headerGroups))}initAfterModel(){if(!this.restoring)return;for(const s of this.columnDefs())this.initialWidths.set(s,s.width);this.sortPriority=this.columnDefs().filter(s=>s.sortState&&s.property).map(s=>s.property);const e=s=>this.persistedParts().includes(s)||this.startState[be(s)]!==void 0,t=this.getState(he.filter(s=>s!=="headerGroups"&&s!=="scroll"&&s!=="custom"&&(!ie.EXPENSIVE.includes(s)||e(s))));this.defaultState={...this.defaultState,...t,scroll:{left:0,top:0}},this.startState.columns&&this.applyColumns(this.startState.columns,!1)}initAfterFilter(){if(!this.restoring)return;const e=this.startState;e.tree&&this.applyTree(e.tree),e.sort&&this.applySort(e.sort),e.checkedRowIds&&this.applyChecked(e.checkedRowIds),e.selection&&this.applySelection(e.selection),e.detailRowIds&&this.applyDetails(e.detailRowIds),"custom"in e&&(this.custom=e.custom)}initAfterLayout(){this.restoring&&(this.startState.scroll&&this.applyScroll(this.startState.scroll),this.restoring=!1,this.rememberAsReported(this.getState(he.filter(e=>!ie.EXPENSIVE.includes(e)))))}getState(e=he){const t={version:1};for(const s of e)this.computePart(s,t);return t}applyState(e,t=he){if(!e||typeof e!="object")return;const s=r=>t.includes(r)&&e[be(r)]!==void 0,o=[];let i=!1;s("headerGroups")&&this.applyHeaderGroups(e.headerGroups)&&o.push("headerGroups"),s("columns")&&(i=this.applyColumns(e.columns,!0),o.push("columns")),s("tree")&&(this.applyTree(e.tree),o.push("tree")),s("sort")&&(this.applySort(e.sort),o.push("sort")),s("checked")&&(this.applyChecked(e.checkedRowIds),o.push("checked")),s("selection")&&(this.applySelection(e.selection),o.push("selection")),s("details")&&(this.applyDetails(e.detailRowIds),o.push("details")),t.includes("custom")&&"custom"in e&&(this.custom=e.custom,o.push("custom")),o.includes("headerGroups")?this.scope.headerGroupsChanged():i?this.scope.recalcColumnWidths():o.length&&(this.scope.tableModel.recalcHeightAndPadding(),this.scope.recalcWrappers(),this.scope.repaintHard()),s("scroll")&&(this.applyScroll(e.scroll),o.push("scroll")),o.forEach(r=>this.markDirty(r))}resetState(){if(!this.defaultState)return;this.applyState(this.defaultState),this.custom=void 0,this.markDirty("custom"),this.flush();const e=this.storageKey(),t=this.storage();if(e&&t)try{t.removeItem(e+ie.STORAGE_SUFFIX),bs(t,e)}catch{}this.lastPersisted=void 0}setCustomState(e){this.custom=e,this.markDirty("custom")}sortedByColumn(e){this.sortPriority=e?[e]:[],this.markDirty("sort")}markDirty(e){!this.started||this.restoring||this.destroyed||(this.dirty.add(e),this.timer&&clearTimeout(this.timer),this.timer=setTimeout(()=>this.flush(),this.scope.tableOptions.stateChangedDebounceDelay??300))}rendered(){if(this.restoring||!this.started)return;const e=this.scope.scrollViewport,t=this.reportedScroll;(!t||t.left!==this.scope.getViewportScrollLeft()||t.top!==e.scrollTop)&&this.markDirty("scroll")}flush(){if(this.timer&&(clearTimeout(this.timer),this.timer=void 0),!this.dirty.size||!this.started||this.restoring)return;this.persistedParts().includes("checked")&&this.dirty.add("checked");const e=he.filter(t=>this.dirty.has(t));this.dirty.clear();try{const t=this.getState(e),s=e.filter(i=>this.partJson(t,i)!==this.lastReported.get(i));if(!s.length)return;const o={...this.reported};for(const i of e){const r=be(i);t[r]===void 0?delete o[r]:o[r]=t[r],this.lastReported.set(i,this.partJson(t,i))}this.reported=o,t.scroll&&(this.reportedScroll={left:t.scroll.left,top:t.scroll.top}),this.persist(o),this.scope.stateChanged(new li(JSON.parse(JSON.stringify(o)),s))}catch(t){console.error("GuiExpert Table: the table state could not be stored or reported",t)}}destroy(){if(!this.destroyed){this.started&&!this.restoring&&this.persistedParts().includes("checked")&&this.dirty.add("checked");try{this.flush()}finally{this.destroyed=!0}}}storageKey(){var s;const e=(s=this.scope.tableOptions.autoRestoreOptions)==null?void 0:s.getStorageKeyFn;return(e?e():void 0)||void 0}storage(){var t;const e=(t=this.scope.tableOptions.autoRestoreOptions)==null?void 0:t.storage;if(e)return e;try{return typeof localStorage>"u"?void 0:localStorage}catch{return}}persistedParts(){const e=this.scope.tableOptions.autoRestoreOptions;return e?he.filter(t=>!!e[fn[t]]):[]}warnWithoutStorageKey(){this.scope.tableOptions.autoRestoreOptions&&this.persistedParts().length&&!this.storageKey()&&console.warn("GuiExpert Table: autoRestoreOptions are ignored without getStorageKeyFn (nothing is stored).")}readStartState(){const e=this.scope.tableOptions.initialState??{},t=this.persistedParts(),s=this.storageKey(),o=this.storage();if(!t.length||!s||!o)return{...e};let i;try{const n=o.getItem(s+ie.STORAGE_SUFFIX);if(n){const l=JSON.parse(n);l&&typeof l=="object"&&l.version===1&&(i=l,this.lastPersisted=n)}}catch{}i||(i=ci(o,s,this.columnDefs().map(n=>n.property)));const r={...e};if(i)for(const n of t){const l=be(n);l in i&&(r[l]=i[l])}return r}persist(e){const t=this.persistedParts(),s=this.storageKey(),o=this.storage();if(!t.length||!s||!o)return;const i={version:1};for(const n of t){const l=be(n);e[l]!==void 0&&(i[l]=e[l])}const r=JSON.stringify(i);if(r!==this.lastPersisted)try{o.setItem(s+ie.STORAGE_SUFFIX,r),this.lastPersisted=r,this.legacyRemoved||(bs(o,s),this.legacyRemoved=!0)}catch{}}rememberAsReported(e){this.reported=e,e.scroll&&(this.reportedScroll={left:e.scroll.left,top:e.scroll.top});for(const t of he)be(t)in e&&this.lastReported.set(t,this.partJson(e,t))}partJson(e,t){const s=e[be(t)];return s===void 0?"":JSON.stringify(s)}computePart(e,t){var s;switch(e){case"headerGroups":{const o=(s=this.headerGroupModel())==null?void 0:s.getToggleGroupStates();o!=null&&o.length&&(t.headerGroups=o);break}case"columns":{const o=this.computeColumns();o&&(t.columns=o);break}case"sort":{const o=this.computeSort();o&&(t.sort=o);break}case"scroll":t.scroll=this.computeScroll();break;case"tree":{const o=this.computeTree();o&&(t.tree=o);break}case"checked":{const o=this.computeChecked();o&&(t.checkedRowIds=o);break}case"selection":{const o=this.computeSelection();o&&(t.selection=o);break}case"custom":this.custom!==void 0&&(t.custom=this.custom);break;case"details":{const o=this.computeDetails();o&&(t.detailRowIds=o);break}}}computeColumns(){const e=this.columnDefs();if(!e.length)return;const t=new Set,s=[];for(const o of e){if(!o.property||t.has(o.property))continue;t.add(o.property);const i={property:o.property},r=this.initialWidths.get(o);r&&o.width&&(r.value!==o.width.value||r.unit!==o.width.unit)&&o.width.unit==="px"&&(i.width=o.width.value),i.visible=ms(o),s.push(i)}return s}computeSort(){const e=this.columnDefs();if(!e.length)return;const t=s=>{const o=this.sortPriority.indexOf(s.property);return o<0?oe:o};return e.filter(s=>s.sortState&&s.property).map((s,o)=>({cd:s,index:o})).sort((s,o)=>t(s.cd)-t(o.cd)||s.index-o.index).map(({cd:s})=>({property:s.property,sortState:s.sortState}))}computeScroll(){const e=this.scope.scrollViewport,t={left:this.scope.getViewportScrollLeft(),top:e.scrollTop},s=this.scope.getFirstVisibleRowIndex();if(s>-1&&this.body().getRowCount()>0){const o=this.idAt(s,this.warns("scroll"));o!==void 0&&(t.firstRowId=o)}return t}computeTree(){const e=this.body();if(!B(e))return;const t=[],s=[],o=this.warns("tree");return this.walkTree(e,i=>{var r;if((r=i.children)!=null&&r.length){const n=this.idOfRow(i,-1,o);n!==void 0&&(i.expanded?t:s).push(n)}}),t.length<=s.length?{expandedRowIds:t}:{collapsedRowIds:s}}computeChecked(){const e=this.body().rowSelectionModel;if(!e)return;const t=this.warns("checked"),s=[];for(const o of e.getCheckedRows()??[]){const i=this.idOfRow(o,-1,t);i!==void 0&&s.push(i)}return s}computeDetails(){const e=this.scope.masterDetailService;if(!(e!=null&&e.isActive()))return;const t=this.warns("details"),s=[];for(const o of e.getExpandedRows()){const i=this.idOfRow(o,-1,t);i!==void 0&&s.push(i)}return s}applyDetails(e){const t=this.scope.masterDetailService;if(!(t!=null&&t.isActive())||!Array.isArray(e))return;const s=new Set(e),o=this.body(),i=o,r=i.getAllRows?i.getAllRows():Array.from({length:o.getRowCount()},(n,l)=>o.getRowByIndex(l));t.setExpandedRows(r.filter((n,l)=>{const c=this.idOfRow(n,i.getAllRows?-1:l,!1);return c!==void 0&&s.has(c)}),"state")}computeSelection(){const e=this.scope.selectionModel();if(!e||!e.selectionType||e.selectionType==="none")return;const t=e.createSnapshot?e.createSnapshot():{ranges:e.getRanges(),negativeRanges:[],allSelected:e.isAllSelected()},s=this.warns("selection"),o=r=>r.map(n=>this.toStateRange(n,s)).filter(n=>!!n),i={ranges:o(t.ranges)};return t.negativeRanges.length&&(i.negativeRanges=o(t.negativeRanges)),t.allSelected&&(i.allSelected=!0),i}toStateRange(e,t){var l,c;const s={},o=Math.min(e.r1,e.r2),i=Math.max(e.r1,e.r2);if(!(o<=0&&i>=oe)){const h=this.idAt(o,t);if(h===void 0)return;if(s.fromRowId=h,i<oe){const d=this.idAt(i,t);if(d===void 0)return;s.toRowId=d}}const r=Math.min(e.c1,e.c2),n=Math.max(e.c1,e.c2);if(!(r<=0&&n>=oe)){const h=this.columnDefs(),d=(l=h[r])==null?void 0:l.property;if(!d)return;if(s.fromProperty=d,n<oe){const u=(c=h[n])==null?void 0:c.property;if(!u)return;s.toProperty=u}}return s}applyHeaderGroups(e){const t=this.scope.tableModel.getAreaModel("header");if(!t.setGroupClosed||!t.getToggleGroupStates||!Array.isArray(e))return!1;const s=new Map(t.getToggleGroupStates().map(i=>[i.id,i.closed]));let o=!1;for(const i of e)if(i&&s.has(i.id)&&s.get(i.id)!==!!i.closed){const r=t.setGroupClosed(i.id,!!i.closed);r&&"columnDefs"in this.scope.tableModel&&(this.scope.tableModel.columnDefs=r),o=!0}return o}applyColumns(e,t){const s=this.scope.tableModel,o=this.columnDefs();if(!o.length||!Array.isArray(e))return!1;const i=new Map;for(const d of e)d&&typeof d.property=="string"&&!i.has(d.property)&&o.some(u=>u.property===d.property)&&i.set(d.property,d);const r=o.map(d=>d.property),n=Array.from(i.keys()),l=new Set;r.forEach((d,u)=>{if(i.has(d)&&!l.has(d)){l.add(d);return}const f=u>0?n.lastIndexOf(r[u-1]):-1;n.splice(f+1,0,d)});for(let d=0;d<n.length;d++){const f=s.getColumnDefs().map(g=>g.property).indexOf(n[d],d);f>d&&s.changeColumnOrder(f,d)}let c=!1;return this.columnDefs().forEach((d,u)=>{var g;const f=i.get(d.property);if(f){if(typeof f.visible=="boolean"&&ms(d)!==f.visible&&((g=s.setColumnVisible)==null||g.call(s,u,f.visible)),typeof f.width=="number"&&f.width>=0)s.setColumnWidth(u,f.width);else if(t){const p=this.initialWidths.get(d);p&&(p.value!==d.width.value||p.unit!==d.width.unit)&&(p.unit==="px"?s.setColumnWidth(u,p.value):c=!0,d.width=p)}}}),c}applyTree(e){const t=this.body();if(!B(t)||!e)return;const s=Array.isArray(e.expandedRowIds);if(!s&&!Array.isArray(e.collapsedRowIds))return;const o=new Set((s?e.expandedRowIds:e.collapsedRowIds)??[]),i=t;this.walkTree(i,r=>{var n;if((n=r.children)!=null&&n.length){const l=this.idOfRow(r,-1,!1);l!==void 0&&(r.expanded=s?o.has(l):!o.has(l))}}),i.recalcVisibleTreeRows(!1)}applySort(e){var i;if(!Array.isArray(e))return;const t=this.columnDefs(),s=[],o=[];for(const r of e){if(!r||r.sortState!=="asc"&&r.sortState!=="desc")continue;const n=typeof r.property=="string"?t.findIndex(l=>l.property===r.property):typeof r.columnIndex=="number"?r.columnIndex:-1;n<0||n>=this.scope.tableModel.getColumnCount()||s.some(l=>l.columnIndex===n)||(s.push(new St(n,r.sortState)),(i=t[n])!=null&&i.property&&o.push(t[n].property))}this.scope.applySortItems(s),this.sortPriority=o}applyChecked(e){const t=this.body(),s=t.rowSelectionModel;if(!s||!Array.isArray(e))return;const o=new Set(e);if(B(t)){const n=t;this.walkTree(n,l=>{l.checked=!1}),this.walkTree(n,l=>{const c=this.idOfRow(l,-1,!1);c!==void 0&&o.has(c)&&!l.checked&&s.checkRow(l,!0)});return}const i=t,r=i.getAllRows?i.getAllRows():Array.from({length:t.getRowCount()},(n,l)=>t.getRowByIndex(l));s.setCheckedRows(r.filter((n,l)=>{const c=this.idOfRow(n,i.getAllRows?-1:l,!1);return c!==void 0&&o.has(c)}))}applySelection(e){const t=this.scope.selectionModel();if(!t||!e||!Array.isArray(e.ranges))return;const o=[...e.ranges,...e.negativeRanges??[]].some(c=>c&&(c.fromRowId!==void 0||c.toRowId!==void 0))?this.rowIndexMap():new Map,i=this.columnDefs(),r=c=>{if(!c)return;let h=0,d=oe,u=0,f=oe;if(c.fromRowId!==void 0||c.toRowId!==void 0){const g=o.get(c.fromRowId??c.toRowId),p=c.toRowId===void 0?oe:o.get(c.toRowId);if(g===void 0||p===void 0)return;h=Math.min(g,p),d=Math.max(g,p)}if(c.fromProperty!==void 0||c.toProperty!==void 0){const g=i.findIndex(m=>m.property===(c.fromProperty??c.toProperty)),p=c.toProperty===void 0?oe:i.findIndex(m=>m.property===c.toProperty);if(g<0||p<0)return;u=Math.min(g,p),f=Math.max(g,p)}return new A(h,u,d,f)},n=c=>(c??[]).map(r).filter(h=>!!h),l={ranges:n(e.ranges),negativeRanges:n(e.negativeRanges),allSelected:!!e.allSelected};t.restoreSnapshot?t.restoreSnapshot(l):(t.clear(),l.ranges.forEach(c=>t.addSelection(c)))}applyScroll(e){if(!e||typeof e.top!="number"||typeof e.left!="number"||(this.scope.scrollViewport.scrollTo(wt(e.left,this.scope.isRtl()),e.top),this.scope.adjustAfterScrolling(),e.firstRowId===void 0))return;const t=this.scope.getFirstVisibleRowIndex();if(t>-1&&this.idAt(t,!1)===e.firstRowId)return;const s=this.rowIndexMap().get(e.firstRowId);s!==void 0&&(this.scope.scrollToIndex(-1,s),this.scope.adjustAfterScrolling())}columnDefs(){return this.scope.tableModel.getColumnDefs()??[]}body(){return this.scope.tableModel.getBodyModel()}headerGroupModel(){const e=this.scope.tableModel.getAreaModel("header");return e&&typeof e.getToggleGroupStates=="function"?e:void 0}warns(e){return this.persistedParts().includes(e)}ownGetRowId(){var t;const e=(t=this.scope.tableOptions.autoRestoreOptions)==null?void 0:t.getRowId;return e&&!ai(e)?e:void 0}idAt(e,t){return this.idOfRow(this.body().getRowByIndex(e),e,t)}idOfRow(e,t,s){const o=this.ownGetRowId();if(e==null){if(o&&o.length>=2&&t>-1)return o(void 0,t);s&&!this.warnedNoRowObject&&(this.warnedNoRowObject=!0,console.warn("GuiExpert Table: the body model has no row objects – these rows are not stored. Set autoRestoreOptions.getRowId = (_row, rowIndex) => rowIndex to store them by index."));return}const i=L(e)?e.data:e;if(W(i))return i.id;if(o)return o(i,t);if(i&&typeof i=="object")for(const r of["id","uuid"]){const n=i[r];if(typeof n=="string"||typeof n=="number")return n}s&&!this.warnedNoId&&(this.warnedNoId=!0,console.warn("GuiExpert Table: rows without 'id' or 'uuid' are not stored – set autoRestoreOptions.getRowId."))}rowIndexMap(){const e=this.body(),t=new Map,s=e.getRowCount();for(let o=0;o<s;o++){const i=this.idAt(o,!1);i!==void 0&&!t.has(i)&&t.set(i,o)}return t}walkTree(e,t){const s=o=>o==null?void 0:o.forEach(i=>{t(i),s(i.children)});s(e.rows)}};ie.STORAGE_SUFFIX="tableState",ie.EXPENSIVE=["tree","checked","selection"];let At=ie;class hi{constructor(e){this.tableScope=e,this.tableScope.hostElement.addEventListener("change",this.onHostElementChanged.bind(this),{signal:this.tableScope.listenerAbortController.signal}),this.tableScope.hostElement.addEventListener("keydown",this.onHostElementKeyDown.bind(this),{signal:this.tableScope.listenerAbortController.signal})}onHostElementKeyDown(e){var s,o;if((o=(s=this.tableScope).isEventInDetail)!=null&&o.call(s,e)||e.key!=="Escape"||!this.tableScope.isEditing())return;const t=e.target;(t instanceof HTMLInputElement||t instanceof HTMLSelectElement||t instanceof HTMLTextAreaElement)&&t.getAttribute("data-area")==="body"&&(e.preventDefault(),e.stopPropagation(),this.tableScope.cancelEditing(t))}onHostElementChanged(e){var t,s;if(!((s=(t=this.tableScope).isEventInDetail)!=null&&s.call(t,e))&&(e.target instanceof HTMLInputElement||e.target instanceof HTMLSelectElement||e.target instanceof HTMLTextAreaElement)){const o=e.target,i=o.getAttribute("data-area"),r=o.getAttribute("data-row-index"),n=o.getAttribute("data-col-index");if(i&&r&&n){const l=ct(i),c=Number(r),h=Number(n);this.tableScope.updateModelValueAfterEdit(l,c,h,o.value)}}}}class ws{constructor(e=-1,t=-1){this.rowIndex=e,this.columnIndex=t}}class Ne{constructor(e,t,s){this.cells=e,this.changes=t,this.source=s}static createForChanges(e,t){const s=e.filter(o=>o.rowIndex>-1).map(o=>new ws(o.rowIndex,o.columnIndex));return new Ne(s,e,t)}static createSingle(e,t){return new Ne([new ws(e,t)])}}class di{constructor(e,t,s,o,i,r,n,l){this.scrollTop=e,this.scrollLeft=t,this.scrollHeight=s,this.scrollWidth=o,this.clientHeight=i,this.clientWidth=r,this.scrollFactorY=n,this.scrollFactorX=l}}class xe{constructor(e){this.tableScope=e,this.ignoreNextClick=!1,this.anchorRanges=[],this.getSelectionModel=()=>this.tableScope.selectionModel(),this.getFocusModel=()=>this.tableScope.focusModel()}onMouseDown(){this.ignoreNextClick=!1,this.dragSnapshot=void 0}onMouseDragging(e,t){var o;if(!t||t.action||t.areaIdent!=="body"||e.areaIdent!=="body"||t.rowIndex<0||t.columnIndex<0||e.rowIndex<0||e.columnIndex<0)return!1;const s=(o=this.getSelectionModel)==null?void 0:o.call(this);return!s||!("selectionType"in s)||s.selectionType!=="range"?!1:(this.batch(()=>{var n,l,c;!!((n=t.originalEvent)!=null&&n.ctrlKey||(l=t.originalEvent)!=null&&l.metaKey)&&xe.hasSnapshots(s)?(this.dragSnapshot=this.dragSnapshot??s.createSnapshot(),s.restoreSnapshot(this.dragSnapshot)):s.clear(),s.addSelection(this.createRangeByEvents(e,t));const r=(c=this.getFocusModel)==null?void 0:c.call(this);r&&!r.hasFocus(t.rowIndex,t.columnIndex)&&r.setFocus(t.rowIndex,t.columnIndex),this.previousEvt=t.clone(),this.anchorRanges=[],this.ignoreNextClick=e.rowIndex!==t.rowIndex||e.columnIndex!==t.columnIndex,this.tableScope.onSelectionChanged(s)}),!0)}onMouseClicked(e,t){if(this.ignoreNextClick)return this.ignoreNextClick=!1,!1;if(e.areaIdent==="header"&&e.clickCount===1&&this.isRowNumberColumn(e.columnIndex)&&e.rowIndex===this.tableScope.tableModel.getAreaModel("header").getRowCount()-1)return this.selectAllByRowNumberHeader();if(e.areaIdent!=="body"||e.rowIndex<0||e.columnIndex<0||e.clickCount>1)return!1;let s=!1;if(this.getSelectionModel&&this.getFocusModel){const o=this.getSelectionModel(),i=this.getFocusModel();o&&i&&(this.batch(()=>{var d,u,f,g;i.hasFocus(e.rowIndex,e.columnIndex)||i.setFocus(e.rowIndex,e.columnIndex);const r=!!((d=e.originalEvent)!=null&&d.shiftKey),n=!!((u=e.originalEvent)!=null&&u.ctrlKey||(f=e.originalEvent)!=null&&f.metaKey),l=!!((g=e.originalEvent)!=null&&g.altKey),c=this.isRowNumberColumn(e.columnIndex)&&xe.isRangeSelection(o);if(r&&this.previousEvt){if(this.anchorRanges.length&&xe.hasSnapshots(o)){const m=o.createSnapshot();o.restoreSnapshot({...m,ranges:m.ranges.filter(b=>!this.anchorRanges.includes(b))})}const p=this.createRangeByEvents(e,this.previousEvt);c&&(p.c1=0,p.c2=Number.MAX_SAFE_INTEGER),o.addSelection(p),this.anchorRanges=[p],this.tableScope.onSelectionChanged(o);return}const h=o.getRanges().slice();c?this.clickRowNumber(o,e.rowIndex,e.columnIndex,r,n,l):n&&l?o.removeSelection(A.singleCell(e.rowIndex,e.columnIndex)):n?o.togglePoint(e.rowIndex,e.columnIndex):(!r&&o.hasSelection()&&o.clear(),o.firstClick(e.rowIndex,e.columnIndex)),this.anchorRanges=o.getRanges().filter(p=>!h.includes(p)),this.previousEvt=e.clone(),this.tableScope.onSelectionChanged(o)}),s=!0)}return s}onActionTriggered(e){var t,s;if(this.getSelectionModel&&this.getFocusModel){const o=this.getSelectionModel(),i=this.getFocusModel();if(o&&i){if(e==="SELECT_ALL")return o.selectAll(),this.tableScope.repaint(),this.announce(r=>r.allSelected()),!0;if(e==="DESELECT_ALL")return o.clear(),this.tableScope.repaint(),this.announce(r=>r.selectionCleared()),!0;if(e==="TOGGLE_SELECTION"&&((s=(t=this.tableScope).getHeaderFocus)!=null&&s.call(t)))return!1;if(e==="TOGGLE_SELECTION"){const[r,n]=i.getFocus();return this.isRowNumberColumn(n)&&xe.isRangeSelection(o)?(this.clickRowNumber(o,r,n,!1,!0,!1),this.tableScope.onSelectionChanged(o),this.tableScope.repaint(),!0):(o.togglePoint(r,n),this.tableScope.repaint(),!0)}}}return!1}isRowNumberColumn(e){var t;return e>-1&&O((t=this.tableScope.tableModel)==null?void 0:t.getColumnDef(e))}selectAllByRowNumberHeader(){var s;const e=(s=this.getSelectionModel)==null?void 0:s.call(this),t=e==null?void 0:e.selectionType;return!e||t!=="row"&&t!=="range"?!1:(this.batch(()=>{e.selectAll(),this.tableScope.onSelectionChanged(e)}),this.announce(o=>o.allSelected()),!0)}clickRowNumber(e,t,s,o,i,r){const n=new A(t,0,t,Number.MAX_SAFE_INTEGER);i&&r?e.removeSelection(n):i?e.isSelected(t,s)?e.removeSelection(n):e.addSelection(n):(!o&&e.hasSelection()&&e.clear(),e.addSelection(n))}static isRangeSelection(e){return e.selectionType==="range"}announce(e){var s;const t=(s=this.getSelectionModel)==null?void 0:s.call(this);(t==null?void 0:t.selectionType)!=="none"&&this.tableScope.ariaTexts&&typeof this.tableScope.announce=="function"&&this.tableScope.announce(e(this.tableScope.ariaTexts))}batch(e){typeof this.tableScope.holdSelectionEvents=="function"?this.tableScope.holdSelectionEvents(e):e()}static hasSnapshots(e){return typeof e.createSnapshot=="function"&&typeof e.restoreSnapshot=="function"}createRangeByEvents(e,t){t||(t=e);const s=Math.min(e.rowIndex,t==null?void 0:t.rowIndex),o=Math.max(e.rowIndex,t==null?void 0:t.rowIndex),i=Math.min(e.columnIndex,t==null?void 0:t.columnIndex),r=Math.max(e.columnIndex,t==null?void 0:t.columnIndex);return A.create({rowIndex1:s,columnIndex1:i,rowIndex2:o,columnIndex2:r})}}class ui{get(){return{f2:"START_EDITING",space:"TOGGLE_SELECTION","ctrl+num_add":"SELECT_ALL","ctrl+a":"SELECT_ALL","ctrl+shift+a":"DESELECT_ALL","ctrl+x":"DESELECT_ALL","ctrl+num_subtract":"DESELECT_ALL","meta -":"DESELECT_ALL",arrowup:"NAVIGATE_UP",arrowdown:"NAVIGATE_DOWN",arrowleft:"NAVIGATE_LEFT",arrowright:"NAVIGATE_RIGHT",home:"NAVIGATE_ROW_START",end:"NAVIGATE_ROW_END","ctrl+home":"NAVIGATE_FIRST_CELL","ctrl+end":"NAVIGATE_LAST_CELL",pageup:"NAVIGATE_PAGE_UP",pagedown:"NAVIGATE_PAGE_DOWN",enter:"ACTIVATE_CELL","ctrl+alt+up":"MOVE_ROW_UP","ctrl+alt+down":"MOVE_ROW_DOWN","ctrl+d":"FILL_DOWN","ctrl+r":"FILL_RIGHT","meta+c":"COPY_2_CLIPBOARD","ctrl+c":"COPY_2_CLIPBOARD"}}}class fi{get(){return{f2:"START_EDITING",space:"TOGGLE_SELECTION","ctrl+num_add":"SELECT_ALL","meta+a":"SELECT_ALL","ctrl+a":"SELECT_ALL","meta+x":"DESELECT_ALL","meta+shift+a":"DESELECT_ALL","ctrl+shift+a":"DESELECT_ALL","ctrl+num_subtract":"DESELECT_ALL","ctrl -":"DESELECT_ALL",arrowup:"NAVIGATE_UP",arrowdown:"NAVIGATE_DOWN",arrowleft:"NAVIGATE_LEFT",arrowright:"NAVIGATE_RIGHT",home:"NAVIGATE_ROW_START",end:"NAVIGATE_ROW_END","meta+left":"NAVIGATE_ROW_START","meta+right":"NAVIGATE_ROW_END","ctrl+home":"NAVIGATE_FIRST_CELL","ctrl+end":"NAVIGATE_LAST_CELL","meta+up":"NAVIGATE_FIRST_CELL","meta+down":"NAVIGATE_LAST_CELL",pageup:"NAVIGATE_PAGE_UP",pagedown:"NAVIGATE_PAGE_DOWN",enter:"ACTIVATE_CELL","ctrl+alt+up":"MOVE_ROW_UP","ctrl+alt+down":"MOVE_ROW_DOWN","meta+d":"FILL_DOWN","meta+r":"FILL_RIGHT","meta+c":"COPY_2_CLIPBOARD","ctrl+c":"COPY_2_CLIPBOARD"}}}const gn={arrowup:"up",arrowdown:"down",arrowleft:"left",arrowright:"right"};function Zs(a){return a.trim().replace(/\+/g," ").replace(/ +/g," ").replace(/⌫/g,"backspace").replace(/↩/g,"enter").replace(/⇧/g,"shift").replace(/⌥/g,"alt").replace(/option/g,"alt").replace(/opt/g,"alt").replace(/⌃/g,"ctrl").replace(/control/g,"ctrl").replace(/command/g,"cmd").replace(/meta/g,"cmd").replace(/escape/g,"esc").replace(/⌘/g,"cmd").replace(/\*/g,"multiply").split(" ").filter(e=>e).map(e=>gn[e]??e).filter((e,t,s)=>s.indexOf(e)===t).sort((e,t)=>{const s={cmd:1,ctrl:2,alt:3,shift:4},o=s[e]||5,i=s[t]||5;return o!==i?o-i:e.localeCompare(t)}).join(" ")}function gi(a){let e=a.key.toLowerCase();if(e===" "&&(e="space"),e==="arrowleft"&&(e="left"),e==="arrowright"&&(e="right"),e==="arrowup"&&(e="up"),e==="arrowdown"&&(e="down"),e==="delete"&&a.code==="Delete"&&(e="delete"),e==="backspace"&&(e="backspace"),e==="escape"&&(e="esc"),e==="return"&&(e="enter"),a.code.startsWith("Numpad")){const s=a.code.replace("Numpad","").toLowerCase();s==="add"?e="num_add":s==="subtract"?e="num_subtract":s==="multiply"?e="num_multiply":s==="divide"?e="num_divide":s==="decimal"?e="num_decimal":s==="enter"?e="num_enter":e="num_"+s}a.code.match(/^F\d+$/)&&(e=a.code.toLowerCase()),a.code.match(/^Digit\d+$/)&&(e=a.code.replace(/Digit/g,""));let t="";return a.ctrlKey&&(t+=" ctrl"),a.altKey&&(t+=t+" alt"),a.shiftKey&&(t+=t+" shift"),a.metaKey&&(t+=t+" cmd"),Zs(t+" "+e)}class pi{constructor(e){this.tableScope=e,this.shortcutActionIdMapping={},this.listener=[],this.listener.push(e),this.init()}addListener(e){this.listener.includes(e)||this.listener.push(e)}init(){var e,t;(t=(e=this.tableScope)==null?void 0:e.tableOptions)!=null&&t.shortcutActionsDisabled?this.isDebug()&&console.debug("ShortcutService skipped."):(this.assignPredefinedSystemShortcutMappings(),Object.assign(this.shortcutActionIdMapping,this.tableScope.tableOptions.shortcutActionIdMapping),this.isDebug()&&console.debug("ShortcutService",this.shortcutActionIdMapping),this.tableScope.hostElement.addEventListener("keydown",this.onKeyDown.bind(this),{signal:this.tableScope.listenerAbortController.signal}))}assignPredefinedSystemShortcutMappings(){this.isMacintosh()?Object.assign(this.shortcutActionIdMapping,new fi().get()):Object.assign(this.shortcutActionIdMapping,new ui().get())}isMacintosh(){return navigator.platform.indexOf("Mac")>-1}isDebug(){return this.isLocalhost()}isLocalhost(){return location.hostname==="localhost"||location.hostname==="127.0.0.1"}onKeyDown(e){var o,i;if((i=(o=this.tableScope).isEventInDetail)!=null&&i.call(o,e))return;const t=e.target;if(t&&(t.isContentEditable||["INPUT","SELECT","TEXTAREA","BUTTON","A"].includes(t.tagName)))return;const s=this.findEntity(e);s&&this.emit(s)&&(e.preventDefault(),e.stopPropagation())}emit(e){this.isDebug()&&console.debug("ShortcutService emit :",e);let t=!1;for(const s of this.listener)s.onActionTriggered(e)&&(t=!0);return t}findEntity(e){var s,o;let t=gi(e);(o=(s=this.tableScope).isRtl)!=null&&o.call(s)&&(t=Go(t)),this.isDebug()&&console.debug("ShortcutService shortcut :",t);for(const i in this.shortcutActionIdMapping)if(Zs(i)===t)return this.isDebug()&&console.debug("ShortcutService action :",this.shortcutActionIdMapping[i]),this.shortcutActionIdMapping[i]}getShortcutActionMapping(){return this.shortcutActionIdMapping}}class qe{onCheckboxChanged(e){}onContextmenu(e){}onModelChanged(e){}onMouseClicked(e){}onMouseDragging(e){}onMouseDraggingEnd(e){}onMouseMoved(e){}onScroll(e){}onSelectionChanged(e){}onFocusChanged(e){}onStateChanged(e){}onRowDragStart(e){}onRowDragMove(e){}onRowDragEnd(e){}onBatchEditChanged(e){}onDetailExpandedChanged(e){}}class ys{setStyle(e,t,s){return e.style[t]=s,e}appendText(e,t){const s=this.createText(t);return this.appendChild(e,s),s}addClass(e,t){return t.includes(" ")?t.split(" ").forEach(s=>e.classList.add(s)):e.classList.add(t),e}removeClass(e,t){return t.includes(" ")?t.split(" ").forEach(s=>e.classList.remove(s)):e.classList.remove(t),e}appendChild(e,t){e.appendChild(t)}createElement(e){return document.createElement(e)}createText(e){return document.createTextNode(e)}setAttribute(e,t,s){e.setAttribute(t,s)}removeAttribute(e,t){e.removeAttribute(t)}}class mi{render(e,t,s,o,i,r,n){if(i.isEditable(t,s)){n.addClass(e,"ge-table-row-input-div");const l=r!==void 0?r:i.getValueAt(t,s);e.innerHTML=`
|
|
47
47
|
<input
|
|
48
48
|
type="text"
|
|
49
|
-
value="${
|
|
49
|
+
value="${I(l)}"
|
|
50
50
|
autofocus
|
|
51
51
|
onfocus="this.setSelectionRange(0, this.value.length)"
|
|
52
52
|
data-listen="change"
|
|
@@ -54,25 +54,25 @@ render scope: this.lastFullVisibleRowIndex <- `+this.lastFullVisibleRowIndex),th
|
|
|
54
54
|
data-row-index="${t}"
|
|
55
55
|
data-col-index="${s}"
|
|
56
56
|
data-input-type="text"
|
|
57
|
-
style="width:calc(100% - 8px);height:100%;border:0;padding:0
|
|
58
|
-
class="ge-table-cell-editor-input">`}}}class
|
|
59
|
-
`;let
|
|
60
|
-
<Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships"><Relationship Id="rId3" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/extended-properties" Target="docProps/app.xml"/><Relationship Id="rId2" Type="http://schemas.openxmlformats.org/package/2006/relationships/metadata/core-properties" Target="docProps/core.xml"/><Relationship Id="rId1" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument" Target="xl/workbook.xml"/></Relationships>`,
|
|
61
|
-
<Properties xmlns="http://schemas.openxmlformats.org/officeDocument/2006/extended-properties" xmlns:vt="http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes"><Application>Microsoft Macintosh Excel</Application><DocSecurity>0</DocSecurity><ScaleCrop>false</ScaleCrop><HeadingPairs><vt:vector size="2" baseType="variant"><vt:variant><vt:lpstr>Worksheets</vt:lpstr></vt:variant><vt:variant><vt:i4>1</vt:i4></vt:variant></vt:vector></HeadingPairs><TitlesOfParts><vt:vector size="1" baseType="lpstr"><vt:lpstr>Sheet1</vt:lpstr></vt:vector></TitlesOfParts><Company></Company><LinksUpToDate>false</LinksUpToDate><SharedDoc>false</SharedDoc><HyperlinksChanged>false</HyperlinksChanged><AppVersion>16.0300</AppVersion></Properties>`,
|
|
62
|
-
<cp:coreProperties xmlns:cp="http://schemas.openxmlformats.org/package/2006/metadata/core-properties" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:dcterms="http://purl.org/dc/terms/" xmlns:dcmitype="http://purl.org/dc/dcmitype/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><dc:creator>${t}</dc:creator><cp:lastModifiedBy>${t}</cp:lastModifiedBy><dcterms:created xsi:type="dcterms:W3CDTF">2024-12-13T19:45:08Z</dcterms:created><dcterms:modified xsi:type="dcterms:W3CDTF">2024-12-13T19:45:35Z</dcterms:modified></cp:coreProperties>`,
|
|
63
|
-
<Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships"><Relationship Id="rId3" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles" Target="styles.xml"/><Relationship Id="rId2" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/theme" Target="theme/theme1.xml"/><Relationship Id="rId1" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/worksheet" Target="worksheets/sheet1.xml"/><Relationship Id="rId4" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/sharedStrings" Target="sharedStrings.xml"/></Relationships>`,
|
|
64
|
-
<a:theme xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main" name="Office Theme"><a:themeElements><a:clrScheme name="Office"><a:dk1><a:sysClr val="windowText" lastClr="000000"/></a:dk1><a:lt1><a:sysClr val="window" lastClr="FFFFFF"/></a:lt1><a:dk2><a:srgbClr val="0E2841"/></a:dk2><a:lt2><a:srgbClr val="E8E8E8"/></a:lt2><a:accent1><a:srgbClr val="156082"/></a:accent1><a:accent2><a:srgbClr val="E97132"/></a:accent2><a:accent3><a:srgbClr val="196B24"/></a:accent3><a:accent4><a:srgbClr val="0F9ED5"/></a:accent4><a:accent5><a:srgbClr val="A02B93"/></a:accent5><a:accent6><a:srgbClr val="4EA72E"/></a:accent6><a:hlink><a:srgbClr val="467886"/></a:hlink><a:folHlink><a:srgbClr val="96607D"/></a:folHlink></a:clrScheme><a:fontScheme name="Office"><a:majorFont><a:latin typeface="Aptos Display" panose="02110004020202020204"/><a:ea typeface=""/><a:cs typeface=""/><a:font script="Jpan" typeface="游ゴシック Light"/><a:font script="Hang" typeface="맑은 고딕"/><a:font script="Hans" typeface="等线 Light"/><a:font script="Hant" typeface="新細明體"/><a:font script="Arab" typeface="Times New Roman"/><a:font script="Hebr" typeface="Times New Roman"/><a:font script="Thai" typeface="Tahoma"/><a:font script="Ethi" typeface="Nyala"/><a:font script="Beng" typeface="Vrinda"/><a:font script="Gujr" typeface="Shruti"/><a:font script="Khmr" typeface="MoolBoran"/><a:font script="Knda" typeface="Tunga"/><a:font script="Guru" typeface="Raavi"/><a:font script="Cans" typeface="Euphemia"/><a:font script="Cher" typeface="Plantagenet Cherokee"/><a:font script="Yiii" typeface="Microsoft Yi Baiti"/><a:font script="Tibt" typeface="Microsoft Himalaya"/><a:font script="Thaa" typeface="MV Boli"/><a:font script="Deva" typeface="Mangal"/><a:font script="Telu" typeface="Gautami"/><a:font script="Taml" typeface="Latha"/><a:font script="Syrc" typeface="Estrangelo Edessa"/><a:font script="Orya" typeface="Kalinga"/><a:font script="Mlym" typeface="Kartika"/><a:font script="Laoo" typeface="DokChampa"/><a:font script="Sinh" typeface="Iskoola Pota"/><a:font script="Mong" typeface="Mongolian Baiti"/><a:font script="Viet" typeface="Times New Roman"/><a:font script="Uigh" typeface="Microsoft Uighur"/><a:font script="Geor" typeface="Sylfaen"/><a:font script="Armn" typeface="Arial"/><a:font script="Bugi" typeface="Leelawadee UI"/><a:font script="Bopo" typeface="Microsoft JhengHei"/><a:font script="Java" typeface="Javanese Text"/><a:font script="Lisu" typeface="Segoe UI"/><a:font script="Mymr" typeface="Myanmar Text"/><a:font script="Nkoo" typeface="Ebrima"/><a:font script="Olck" typeface="Nirmala UI"/><a:font script="Osma" typeface="Ebrima"/><a:font script="Phag" typeface="Phagspa"/><a:font script="Syrn" typeface="Estrangelo Edessa"/><a:font script="Syrj" typeface="Estrangelo Edessa"/><a:font script="Syre" typeface="Estrangelo Edessa"/><a:font script="Sora" typeface="Nirmala UI"/><a:font script="Tale" typeface="Microsoft Tai Le"/><a:font script="Talu" typeface="Microsoft New Tai Lue"/><a:font script="Tfng" typeface="Ebrima"/></a:majorFont><a:minorFont><a:latin typeface="Aptos Narrow" panose="02110004020202020204"/><a:ea typeface=""/><a:cs typeface=""/><a:font script="Jpan" typeface="游ゴシック"/><a:font script="Hang" typeface="맑은 고딕"/><a:font script="Hans" typeface="等线"/><a:font script="Hant" typeface="新細明體"/><a:font script="Arab" typeface="Arial"/><a:font script="Hebr" typeface="Arial"/><a:font script="Thai" typeface="Tahoma"/><a:font script="Ethi" typeface="Nyala"/><a:font script="Beng" typeface="Vrinda"/><a:font script="Gujr" typeface="Shruti"/><a:font script="Khmr" typeface="DaunPenh"/><a:font script="Knda" typeface="Tunga"/><a:font script="Guru" typeface="Raavi"/><a:font script="Cans" typeface="Euphemia"/><a:font script="Cher" typeface="Plantagenet Cherokee"/><a:font script="Yiii" typeface="Microsoft Yi Baiti"/><a:font script="Tibt" typeface="Microsoft Himalaya"/><a:font script="Thaa" typeface="MV Boli"/><a:font script="Deva" typeface="Mangal"/><a:font script="Telu" typeface="Gautami"/><a:font script="Taml" typeface="Latha"/><a:font script="Syrc" typeface="Estrangelo Edessa"/><a:font script="Orya" typeface="Kalinga"/><a:font script="Mlym" typeface="Kartika"/><a:font script="Laoo" typeface="DokChampa"/><a:font script="Sinh" typeface="Iskoola Pota"/><a:font script="Mong" typeface="Mongolian Baiti"/><a:font script="Viet" typeface="Arial"/><a:font script="Uigh" typeface="Microsoft Uighur"/><a:font script="Geor" typeface="Sylfaen"/><a:font script="Armn" typeface="Arial"/><a:font script="Bugi" typeface="Leelawadee UI"/><a:font script="Bopo" typeface="Microsoft JhengHei"/><a:font script="Java" typeface="Javanese Text"/><a:font script="Lisu" typeface="Segoe UI"/><a:font script="Mymr" typeface="Myanmar Text"/><a:font script="Nkoo" typeface="Ebrima"/><a:font script="Olck" typeface="Nirmala UI"/><a:font script="Osma" typeface="Ebrima"/><a:font script="Phag" typeface="Phagspa"/><a:font script="Syrn" typeface="Estrangelo Edessa"/><a:font script="Syrj" typeface="Estrangelo Edessa"/><a:font script="Syre" typeface="Estrangelo Edessa"/><a:font script="Sora" typeface="Nirmala UI"/><a:font script="Tale" typeface="Microsoft Tai Le"/><a:font script="Talu" typeface="Microsoft New Tai Lue"/><a:font script="Tfng" typeface="Ebrima"/></a:minorFont></a:fontScheme><a:fmtScheme name="Office"><a:fillStyleLst><a:solidFill><a:schemeClr val="phClr"/></a:solidFill><a:gradFill rotWithShape="1"><a:gsLst><a:gs pos="0"><a:schemeClr val="phClr"><a:lumMod val="110000"/><a:satMod val="105000"/><a:tint val="67000"/></a:schemeClr></a:gs><a:gs pos="50000"><a:schemeClr val="phClr"><a:lumMod val="105000"/><a:satMod val="103000"/><a:tint val="73000"/></a:schemeClr></a:gs><a:gs pos="100000"><a:schemeClr val="phClr"><a:lumMod val="105000"/><a:satMod val="109000"/><a:tint val="81000"/></a:schemeClr></a:gs></a:gsLst><a:lin ang="5400000" scaled="0"/></a:gradFill><a:gradFill rotWithShape="1"><a:gsLst><a:gs pos="0"><a:schemeClr val="phClr"><a:satMod val="103000"/><a:lumMod val="102000"/><a:tint val="94000"/></a:schemeClr></a:gs><a:gs pos="50000"><a:schemeClr val="phClr"><a:satMod val="110000"/><a:lumMod val="100000"/><a:shade val="100000"/></a:schemeClr></a:gs><a:gs pos="100000"><a:schemeClr val="phClr"><a:lumMod val="99000"/><a:satMod val="120000"/><a:shade val="78000"/></a:schemeClr></a:gs></a:gsLst><a:lin ang="5400000" scaled="0"/></a:gradFill></a:fillStyleLst><a:lnStyleLst><a:ln w="12700" cap="flat" cmpd="sng" algn="ctr"><a:solidFill><a:schemeClr val="phClr"/></a:solidFill><a:prstDash val="solid"/><a:miter lim="800000"/></a:ln><a:ln w="19050" cap="flat" cmpd="sng" algn="ctr"><a:solidFill><a:schemeClr val="phClr"/></a:solidFill><a:prstDash val="solid"/><a:miter lim="800000"/></a:ln><a:ln w="25400" cap="flat" cmpd="sng" algn="ctr"><a:solidFill><a:schemeClr val="phClr"/></a:solidFill><a:prstDash val="solid"/><a:miter lim="800000"/></a:ln></a:lnStyleLst><a:effectStyleLst><a:effectStyle><a:effectLst/></a:effectStyle><a:effectStyle><a:effectLst/></a:effectStyle><a:effectStyle><a:effectLst><a:outerShdw blurRad="57150" dist="19050" dir="5400000" algn="ctr" rotWithShape="0"><a:srgbClr val="000000"><a:alpha val="63000"/></a:srgbClr></a:outerShdw></a:effectLst></a:effectStyle></a:effectStyleLst><a:bgFillStyleLst><a:solidFill><a:schemeClr val="phClr"/></a:solidFill><a:solidFill><a:schemeClr val="phClr"><a:tint val="95000"/><a:satMod val="170000"/></a:schemeClr></a:solidFill><a:gradFill rotWithShape="1"><a:gsLst><a:gs pos="0"><a:schemeClr val="phClr"><a:tint val="93000"/><a:satMod val="150000"/><a:shade val="98000"/><a:lumMod val="102000"/></a:schemeClr></a:gs><a:gs pos="50000"><a:schemeClr val="phClr"><a:tint val="98000"/><a:satMod val="130000"/><a:shade val="90000"/><a:lumMod val="103000"/></a:schemeClr></a:gs><a:gs pos="100000"><a:schemeClr val="phClr"><a:shade val="63000"/><a:satMod val="120000"/></a:schemeClr></a:gs></a:gsLst><a:lin ang="5400000" scaled="0"/></a:gradFill></a:bgFillStyleLst></a:fmtScheme></a:themeElements><a:objectDefaults><a:lnDef><a:spPr/><a:bodyPr/><a:lstStyle/><a:style><a:lnRef idx="2"><a:schemeClr val="accent1"/></a:lnRef><a:fillRef idx="0"><a:schemeClr val="accent1"/></a:fillRef><a:effectRef idx="1"><a:schemeClr val="accent1"/></a:effectRef><a:fontRef idx="minor"><a:schemeClr val="tx1"/></a:fontRef></a:style></a:lnDef></a:objectDefaults><a:extraClrSchemeLst/><a:extLst><a:ext uri="{05A4C25C-085E-4340-85A3-A5531E510DB2}"><thm15:themeFamily xmlns:thm15="http://schemas.microsoft.com/office/thememl/2012/main" name="Office Theme" id="{2E142A2C-CD16-42D6-873A-C26D2A0506FA}" vid="{1BDDFF52-6CD6-40A5-AB3C-68EB2F1E4D0A}"/></a:ext></a:extLst></a:theme>`,
|
|
65
|
-
<sst xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main" count="3" uniqueCount="3"><si><t>a</t></si><si><t>b</t></si><si><t>c</t></si></sst>`,
|
|
66
|
-
<styleSheet xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="x14ac x16r2 xr" xmlns:x14ac="http://schemas.microsoft.com/office/spreadsheetml/2009/9/ac" xmlns:x16r2="http://schemas.microsoft.com/office/spreadsheetml/2015/02/main" xmlns:xr="http://schemas.microsoft.com/office/spreadsheetml/2014/revision"><fonts count="1" x14ac:knownFonts="1"><font><sz val="12"/><color theme="1"/><name val="Aptos Narrow"/><family val="2"/><scheme val="minor"/></font></fonts><fills count="2"><fill><patternFill patternType="none"/></fill><fill><patternFill patternType="gray125"/></fill></fills><borders count="1"><border><left/><right/><top/><bottom/><diagonal/></border></borders><cellStyleXfs count="1"><xf numFmtId="0" fontId="0" fillId="0" borderId="0"/></cellStyleXfs><cellXfs count="1"><xf numFmtId="0" fontId="0" fillId="0" borderId="0" xfId="0"/></cellXfs><cellStyles count="1"><cellStyle name="Normal" xfId="0" builtinId="0"/></cellStyles><dxfs count="0"/><tableStyles count="0" defaultTableStyle="TableStyleMedium2" defaultPivotStyle="PivotStyleLight16"/><extLst><ext uri="{EB79DEF2-80B8-43e5-95BD-54CBDDF9020C}" xmlns:x14="http://schemas.microsoft.com/office/spreadsheetml/2009/9/main"><x14:slicerStyles defaultSlicerStyle="SlicerStyleLight1"/></ext><ext uri="{9260A510-F301-46a8-8635-F512D64BE5F5}" xmlns:x15="http://schemas.microsoft.com/office/spreadsheetml/2010/11/main"><x15:timelineStyles defaultTimelineStyle="TimeSlicerStyleLight1"/></ext></extLst></styleSheet>`,
|
|
67
|
-
<workbook xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="x15 xr xr6 xr10 xr2" xmlns:x15="http://schemas.microsoft.com/office/spreadsheetml/2010/11/main" xmlns:xr="http://schemas.microsoft.com/office/spreadsheetml/2014/revision" xmlns:xr6="http://schemas.microsoft.com/office/spreadsheetml/2016/revision6" xmlns:xr10="http://schemas.microsoft.com/office/spreadsheetml/2016/revision10" xmlns:xr2="http://schemas.microsoft.com/office/spreadsheetml/2015/revision2"><fileVersion appName="xl" lastEdited="7" lowestEdited="7" rupBuild="11207"/><workbookPr defaultThemeVersion="202300"/><mc:AlternateContent xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"><mc:Choice Requires="x15"><x15ac:absPath url="/" xmlns:x15ac="http://schemas.microsoft.com/office/spreadsheetml/2010/11/ac"/></mc:Choice></mc:AlternateContent><xr:revisionPtr revIDLastSave="0" documentId="8_{292BF245-1F37-B045-B1A5-26C42FB62779}" xr6:coauthVersionLast="47" xr6:coauthVersionMax="47" xr10:uidLastSave="{00000000-0000-0000-0000-000000000000}"/><bookViews><workbookView xWindow="11340" yWindow="5060" windowWidth="28040" windowHeight="17440" xr2:uid="{858B8D3F-6246-774D-8903-6D38687B7BC6}"/></bookViews><sheets><sheet name="Sheet1" sheetId="1" r:id="rId1"/></sheets><calcPr calcId="181029"/><extLst><ext uri="{140A7094-0E35-4892-8432-C4D2E57EDEB5}" xmlns:x15="http://schemas.microsoft.com/office/spreadsheetml/2010/11/main"><x15:workbookPr chartTrackingRefBase="1"/></ext><ext uri="{B58B0392-4F1F-4190-BB64-5DF3571DCE5F}" xmlns:xcalcf="http://schemas.microsoft.com/office/spreadsheetml/2018/calcfeatures"><xcalcf:calcFeatures><xcalcf:feature name="microsoft.com:RD"/><xcalcf:feature name="microsoft.com:Single"/><xcalcf:feature name="microsoft.com:FV"/><xcalcf:feature name="microsoft.com:CNMTM"/><xcalcf:feature name="microsoft.com:LET_WF"/><xcalcf:feature name="microsoft.com:LAMBDA_WF"/><xcalcf:feature name="microsoft.com:ARRAYTEXT_WF"/></xcalcf:calcFeatures></ext></extLst></workbook>`,
|
|
68
|
-
<Types xmlns="http://schemas.openxmlformats.org/package/2006/content-types"><Default Extension="rels" ContentType="application/vnd.openxmlformats-package.relationships+xml"/><Default Extension="xml" ContentType="application/xml"/><Override PartName="/xl/workbook.xml" ContentType="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml"/><Override PartName="/xl/worksheets/sheet1.xml" ContentType="application/vnd.openxmlformats-officedocument.spreadsheetml.worksheet+xml"/><Override PartName="/xl/theme/theme1.xml" ContentType="application/vnd.openxmlformats-officedocument.theme+xml"/><Override PartName="/xl/styles.xml" ContentType="application/vnd.openxmlformats-officedocument.spreadsheetml.styles+xml"/><Override PartName="/xl/sharedStrings.xml" ContentType="application/vnd.openxmlformats-officedocument.spreadsheetml.sharedStrings+xml"/><Override PartName="/docProps/core.xml" ContentType="application/vnd.openxmlformats-package.core-properties+xml"/><Override PartName="/docProps/app.xml" ContentType="application/vnd.openxmlformats-officedocument.extended-properties+xml"/></Types>`,
|
|
57
|
+
style="width:calc(100% - 8px);height:100%;border:0;padding:0;padding-inline-start:8px;"
|
|
58
|
+
class="ge-table-cell-editor-input">`}}}class Jt{constructor(e=new se("❯","",["gt-table-icon-expanded"]),t=new se("❯","transform: rotate(180deg) translate(-100%, -100%); transform-origin: 0 0;",["ge-table-icon-collapsed"])){this.iconExpanded=e,this.iconCollapsed=t}}class Ae{constructor(){this.overflowX="auto",this.overflowY="auto",this.horizontalBorderVisible=!0,this.verticalBorderVisible=!0,this.footerSeparatorBorderVisible=!0,this.headerSeparatorBorderVisible=!0,this.fixedEastSeparatorBorderVisible=!0,this.fixedWestSeparatorBorderVisible=!0,this.tableTopBorderVisible=!0,this.tableBottomBorderVisible=!0,this.hoverRowVisible=!0,this.hoverColumnVisible=!0,this.columnsResizable=!0,this.columnsDraggable=!0,this.columnResizeHandleWidthInPx=4,this.defaultRowHeights={header:34,body:34,footer:34},this.footerVerticalSeparator=!1,this.headerToggleExpandCollapseIcons=!1,this.headerVerticalSeparator=!1,this.treeOptions=new Ns,this.headerGroupOptions=new Jt,this.showCheckboxWihoutExtraColumn=!1,this.externalFilterFunction=void 0,this.sortedOptions=new Hs,this.sortOrder=["asc","desc"],this.shortcutActionsDisabled=!1,this.resizeEventDebounceDelay=500,this.getEditRenderer=(e,t)=>new mi,this.getSelectionModel=void 0,this.getFocusModel=void 0,this.ariaLabel=void 0,this.ariaLabelledBy=void 0,this.ariaDescribedBy=void 0,this.ariaTexts=void 0,this.overlayOptions=void 0,this.rowDragOptions=void 0,this.fillHandle=void 0,this.masterDetail=void 0,this.batchEdit=void 0,this.direction=void 0}}const pn=null;function He(a){return a==null||a===""}const bo=new Intl.Collator("en",{numeric:!0});function wo(a){return typeof a=="number"||typeof a=="bigint"?0:a instanceof Date?1:typeof a=="boolean"?2:typeof a=="string"?3:4}function yo(a,e){const t=wo(a),s=wo(e);if(t!==s)return t-s;switch(t){case 0:{const o=a,i=e,r=typeof o=="number"&&Number.isNaN(o),n=typeof i=="number"&&Number.isNaN(i);return r||n?r===n?0:r?1:-1:o<i?-1:o>i?1:0}case 1:{const o=a.getTime(),i=e.getTime();return(Number.isNaN(o)?1/0:o)-(Number.isNaN(i)?1/0:i)||0}case 2:return(a?1:0)-(e?1:0);case 3:return bo.compare(a,e);default:return bo.compare(String(a),String(e))}}function gt(a){return(e,t)=>{const s=He(e),o=He(t);return s||o?s===o?0:s?1:-1:a(e,t)}}function mn(a,e){const t=typeof a=="string"||typeof a=="function"?{value:a}:a;if(!t||typeof t.value!="string"&&typeof t.value!="function")throw new Error(`Row grouping: level ${e} has no value (a property path or a function).`);const s=typeof t.value=="string"?t.value:void 0,o=t.order??"asc";let i;return o==="asc"?i=gt(yo):o==="desc"?i=gt((r,n)=>yo(n,r)):typeof o=="function"?i=gt(o):i=gt(()=>0),{name:t.name??s??`level${e}`,label:t.label,path:s,getKey:ht(t.value),format:t.format,compare:i}}function le(a){return(a??[]).map((e,t)=>mn(e,t))}const Co=new WeakMap;let bn=1;function ve(a){if(He(a))return"empty";switch(typeof a){case"string":return"s:"+a;case"number":return"n:"+String(a);case"boolean":return"b:"+a;case"bigint":return"i:"+String(a);case"symbol":return"y:"+(a.description??"");case"function":case"object":{if(a instanceof Date)return"d:"+a.getTime();let e=Co.get(a);return e===void 0&&(e=bn++,Co.set(a,e)),"o:"+e}default:return"u:"+String(a)}}function wn(a,e){return He(a)?e:a instanceof Date?Number.isNaN(a.getTime())?"Invalid Date":a.toLocaleDateString("en-US"):String(a)}function bi(a,e){return a.map(t=>t.label??(t.path!==void 0?e(t.path):void 0)??t.name)}function wi(a,e){const t=bi(le(a),s=>{var o;return(o=e.find(i=>i.property===s&&!Fe(i)))==null?void 0:o.headerLabel});return t.length?t.join(" › "):"Group"}function Cs(a){var l,c;const e=a.getBodyModel();if(!X(e))return!1;const t=a.getColumnDefs()??[],s=e.getGroupBy(),o=e.options.hideGroupedColumns===!1?[]:le(s).map(h=>h.path).filter(h=>h!==void 0&&t.some(d=>d.property===h&&!Fe(d))),i=e.hiddenColumnProperties.filter(h=>o.includes(h));for(const h of e.hiddenColumnProperties)o.includes(h)||(l=a.setColumnVisible)==null||l.call(a,h,!0);for(const h of o)i.includes(h)||!yn(t,h)||((c=a.setColumnVisible)==null||c.call(a,h,!1),i.push(h));e.hiddenColumnProperties=i;const r=t.findIndex(Fe),n=t[r];if(n&&Fe(n)&&n.autoHeaderLabel){const h=wi(s,t);n.headerLabel=h;const d=a.getAreaModel("header"),u=d.getRowCount()-1;u>=0&&d.getValueAt(u,r)!==h&&d.setValue(u,r,h)}return!0}function yn(a,e){var t,s;return((s=(t=a.find(o=>o.property===e))==null?void 0:t.isVisible)==null?void 0:s.call(t))!==!1}const re=class re{createContent(e,t,s){return new Promise((o,i)=>{var r;if(t!=null&&t.hasSelection()){const n=t.isAllSelected()?new A(0,0,Number.MAX_SAFE_INTEGER,Number.MAX_SAFE_INTEGER):this.mergeRanges(t.getRanges());if(n){n.c2=Math.min(n.c2,e.getColumnCount()-1),n.r2=Math.min(n.r2,e.getBodyModel().getRowCount()-1);const l=Math.max(0,n.r2-n.r1+1)*Math.max(0,n.c2-n.c1+1);if(l>re.maxCopyCells)return i(`Cannot copy ${l} cells – more than CopyService.maxCopyCells (${re.maxCopyCells}).`);const c=[];for(let h=n.r1;h<=n.r2;h++){const d=[];for(let u=n.c1;u<=n.c2;u++){const f=e.getColumnDef(u);if(((r=f==null?void 0:f.isVisible)==null?void 0:r.call(f))===!1)continue;const g=O(f)?f:void 0;if(g&&!g.options.exported)continue;const p=t.isSelected(h,u),m=e.getBodyModel(),b=p?g?g.getRowNumberText(h,m):m.getTextValueAt(h,u):"";d.push(b)}c.push(d.join(re.columnSeparatorChar))}return o(c.join(re.rowSeparatorChar))}}if(s){const[n,l]=s.getFocus(),c=e.getColumnDef(l),h=O(c)?c.getRowNumberText(n,e.getBodyModel()):e.getBodyModel().getTextValueAt(n,l);return o(h)}i("Cannot copy, neither selection nor focus defined.")})}copyContent(e){return navigator.clipboard.writeText(e)}copyToClipboard(e,t,s){return new Promise((o,i)=>{this.createContent(e,t,s).then(r=>{r?this.copyContent(r).then(n=>{o(r)}).catch(n=>{i()}):o("")}).catch(r=>{i()})})}mergeRanges(e){let t;for(const s of e)t?(t.r1=Math.min(t.r1,s.r1),t.c1=Math.min(t.c1,s.c1),t.r2=Math.max(t.r2,s.r2),t.c2=Math.max(t.c2,s.c2)):t=new A(s.r1,s.c1,s.r2,s.c2);return t}};re.maxCopyCells=1e6,re.columnSeparatorChar=" ",re.rowSeparatorChar=`
|
|
59
|
+
`;let Le=re;class yi{constructor(e,t=500){this.tableScope=e,this.debounceDelay=t,this.disconnected=!1,this.resizeObserver=new ResizeObserver(Eo(this.handleResize.bind(this),t)),this.resizeObserver.observe(this.tableScope.hostElement)}disconnect(){this.disconnected=!0,this.resizeObserver.disconnect()}handleResize(e){if(this.disconnected)return;const t=e[0],{width:s}=t.contentRect;this.tableScope.recalcColumnWidths(s)}}function xs(a){return!!a&&typeof a=="object"&&typeof a.value=="number"&&typeof a.numberFormat=="string"}let pt;function xo(a){if(!pt){pt=new Uint32Array(256);for(let t=0;t<256;t++){let s=t;for(let o=0;o<8;o++)s=s&1?3988292384^s>>>1:s>>>1;pt[t]=s>>>0}}let e=4294967295;for(let t=0;t<a.length;t++)e=pt[(e^a[t])&255]^e>>>8;return(e^4294967295)>>>0}async function Cn(a){const e=globalThis.CompressionStream;if(!(!e||typeof Response>"u"||typeof Blob>"u"))try{const t=new Blob([a]).stream().pipeThrough(new e("deflate-raw"));return new Uint8Array(await new Response(t).arrayBuffer())}catch{return}}class Ci{constructor(){this.supportsNumberFormats=!0,this.numberFormatStyles=new Map}downloadExcel(e,t="file.xlsx",s="",o={}){if(!Array.isArray(e)||e.some(i=>!Array.isArray(i)))throw new Error("Invalid matrix format. Expected a 2D array.");if((t==null?void 0:t.trim())==="")throw new Error("Invalid filename. Filename must be a non-empty string.");return this.createExcelBlob(e,s,o).then(i=>{const r=URL.createObjectURL(i),n=document.createElement("a");n.href=r,n.download=t,document.body.appendChild(n),n.click(),document.body.removeChild(n),setTimeout(()=>URL.revokeObjectURL(r),1e3)}).catch(i=>{throw console.error("Error generating Excel file:",i),new Error("Failed to download Excel file.")})}async createExcelBlob(e,t="",s={}){const o=await this.createZipCompressed(this.generateMap(e,t,s));return new Blob([o],{type:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"})}generateMap(e,t="",s={}){const o=`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
|
60
|
+
<Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships"><Relationship Id="rId3" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/extended-properties" Target="docProps/app.xml"/><Relationship Id="rId2" Type="http://schemas.openxmlformats.org/package/2006/relationships/metadata/core-properties" Target="docProps/core.xml"/><Relationship Id="rId1" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument" Target="xl/workbook.xml"/></Relationships>`,i=`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
|
61
|
+
<Properties xmlns="http://schemas.openxmlformats.org/officeDocument/2006/extended-properties" xmlns:vt="http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes"><Application>Microsoft Macintosh Excel</Application><DocSecurity>0</DocSecurity><ScaleCrop>false</ScaleCrop><HeadingPairs><vt:vector size="2" baseType="variant"><vt:variant><vt:lpstr>Worksheets</vt:lpstr></vt:variant><vt:variant><vt:i4>1</vt:i4></vt:variant></vt:vector></HeadingPairs><TitlesOfParts><vt:vector size="1" baseType="lpstr"><vt:lpstr>Sheet1</vt:lpstr></vt:vector></TitlesOfParts><Company></Company><LinksUpToDate>false</LinksUpToDate><SharedDoc>false</SharedDoc><HyperlinksChanged>false</HyperlinksChanged><AppVersion>16.0300</AppVersion></Properties>`,r=`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
|
62
|
+
<cp:coreProperties xmlns:cp="http://schemas.openxmlformats.org/package/2006/metadata/core-properties" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:dcterms="http://purl.org/dc/terms/" xmlns:dcmitype="http://purl.org/dc/dcmitype/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><dc:creator>${t}</dc:creator><cp:lastModifiedBy>${t}</cp:lastModifiedBy><dcterms:created xsi:type="dcterms:W3CDTF">2024-12-13T19:45:08Z</dcterms:created><dcterms:modified xsi:type="dcterms:W3CDTF">2024-12-13T19:45:35Z</dcterms:modified></cp:coreProperties>`,n=`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
|
63
|
+
<Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships"><Relationship Id="rId3" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles" Target="styles.xml"/><Relationship Id="rId2" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/theme" Target="theme/theme1.xml"/><Relationship Id="rId1" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/worksheet" Target="worksheets/sheet1.xml"/><Relationship Id="rId4" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/sharedStrings" Target="sharedStrings.xml"/></Relationships>`,l=`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
|
64
|
+
<a:theme xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main" name="Office Theme"><a:themeElements><a:clrScheme name="Office"><a:dk1><a:sysClr val="windowText" lastClr="000000"/></a:dk1><a:lt1><a:sysClr val="window" lastClr="FFFFFF"/></a:lt1><a:dk2><a:srgbClr val="0E2841"/></a:dk2><a:lt2><a:srgbClr val="E8E8E8"/></a:lt2><a:accent1><a:srgbClr val="156082"/></a:accent1><a:accent2><a:srgbClr val="E97132"/></a:accent2><a:accent3><a:srgbClr val="196B24"/></a:accent3><a:accent4><a:srgbClr val="0F9ED5"/></a:accent4><a:accent5><a:srgbClr val="A02B93"/></a:accent5><a:accent6><a:srgbClr val="4EA72E"/></a:accent6><a:hlink><a:srgbClr val="467886"/></a:hlink><a:folHlink><a:srgbClr val="96607D"/></a:folHlink></a:clrScheme><a:fontScheme name="Office"><a:majorFont><a:latin typeface="Aptos Display" panose="02110004020202020204"/><a:ea typeface=""/><a:cs typeface=""/><a:font script="Jpan" typeface="游ゴシック Light"/><a:font script="Hang" typeface="맑은 고딕"/><a:font script="Hans" typeface="等线 Light"/><a:font script="Hant" typeface="新細明體"/><a:font script="Arab" typeface="Times New Roman"/><a:font script="Hebr" typeface="Times New Roman"/><a:font script="Thai" typeface="Tahoma"/><a:font script="Ethi" typeface="Nyala"/><a:font script="Beng" typeface="Vrinda"/><a:font script="Gujr" typeface="Shruti"/><a:font script="Khmr" typeface="MoolBoran"/><a:font script="Knda" typeface="Tunga"/><a:font script="Guru" typeface="Raavi"/><a:font script="Cans" typeface="Euphemia"/><a:font script="Cher" typeface="Plantagenet Cherokee"/><a:font script="Yiii" typeface="Microsoft Yi Baiti"/><a:font script="Tibt" typeface="Microsoft Himalaya"/><a:font script="Thaa" typeface="MV Boli"/><a:font script="Deva" typeface="Mangal"/><a:font script="Telu" typeface="Gautami"/><a:font script="Taml" typeface="Latha"/><a:font script="Syrc" typeface="Estrangelo Edessa"/><a:font script="Orya" typeface="Kalinga"/><a:font script="Mlym" typeface="Kartika"/><a:font script="Laoo" typeface="DokChampa"/><a:font script="Sinh" typeface="Iskoola Pota"/><a:font script="Mong" typeface="Mongolian Baiti"/><a:font script="Viet" typeface="Times New Roman"/><a:font script="Uigh" typeface="Microsoft Uighur"/><a:font script="Geor" typeface="Sylfaen"/><a:font script="Armn" typeface="Arial"/><a:font script="Bugi" typeface="Leelawadee UI"/><a:font script="Bopo" typeface="Microsoft JhengHei"/><a:font script="Java" typeface="Javanese Text"/><a:font script="Lisu" typeface="Segoe UI"/><a:font script="Mymr" typeface="Myanmar Text"/><a:font script="Nkoo" typeface="Ebrima"/><a:font script="Olck" typeface="Nirmala UI"/><a:font script="Osma" typeface="Ebrima"/><a:font script="Phag" typeface="Phagspa"/><a:font script="Syrn" typeface="Estrangelo Edessa"/><a:font script="Syrj" typeface="Estrangelo Edessa"/><a:font script="Syre" typeface="Estrangelo Edessa"/><a:font script="Sora" typeface="Nirmala UI"/><a:font script="Tale" typeface="Microsoft Tai Le"/><a:font script="Talu" typeface="Microsoft New Tai Lue"/><a:font script="Tfng" typeface="Ebrima"/></a:majorFont><a:minorFont><a:latin typeface="Aptos Narrow" panose="02110004020202020204"/><a:ea typeface=""/><a:cs typeface=""/><a:font script="Jpan" typeface="游ゴシック"/><a:font script="Hang" typeface="맑은 고딕"/><a:font script="Hans" typeface="等线"/><a:font script="Hant" typeface="新細明體"/><a:font script="Arab" typeface="Arial"/><a:font script="Hebr" typeface="Arial"/><a:font script="Thai" typeface="Tahoma"/><a:font script="Ethi" typeface="Nyala"/><a:font script="Beng" typeface="Vrinda"/><a:font script="Gujr" typeface="Shruti"/><a:font script="Khmr" typeface="DaunPenh"/><a:font script="Knda" typeface="Tunga"/><a:font script="Guru" typeface="Raavi"/><a:font script="Cans" typeface="Euphemia"/><a:font script="Cher" typeface="Plantagenet Cherokee"/><a:font script="Yiii" typeface="Microsoft Yi Baiti"/><a:font script="Tibt" typeface="Microsoft Himalaya"/><a:font script="Thaa" typeface="MV Boli"/><a:font script="Deva" typeface="Mangal"/><a:font script="Telu" typeface="Gautami"/><a:font script="Taml" typeface="Latha"/><a:font script="Syrc" typeface="Estrangelo Edessa"/><a:font script="Orya" typeface="Kalinga"/><a:font script="Mlym" typeface="Kartika"/><a:font script="Laoo" typeface="DokChampa"/><a:font script="Sinh" typeface="Iskoola Pota"/><a:font script="Mong" typeface="Mongolian Baiti"/><a:font script="Viet" typeface="Arial"/><a:font script="Uigh" typeface="Microsoft Uighur"/><a:font script="Geor" typeface="Sylfaen"/><a:font script="Armn" typeface="Arial"/><a:font script="Bugi" typeface="Leelawadee UI"/><a:font script="Bopo" typeface="Microsoft JhengHei"/><a:font script="Java" typeface="Javanese Text"/><a:font script="Lisu" typeface="Segoe UI"/><a:font script="Mymr" typeface="Myanmar Text"/><a:font script="Nkoo" typeface="Ebrima"/><a:font script="Olck" typeface="Nirmala UI"/><a:font script="Osma" typeface="Ebrima"/><a:font script="Phag" typeface="Phagspa"/><a:font script="Syrn" typeface="Estrangelo Edessa"/><a:font script="Syrj" typeface="Estrangelo Edessa"/><a:font script="Syre" typeface="Estrangelo Edessa"/><a:font script="Sora" typeface="Nirmala UI"/><a:font script="Tale" typeface="Microsoft Tai Le"/><a:font script="Talu" typeface="Microsoft New Tai Lue"/><a:font script="Tfng" typeface="Ebrima"/></a:minorFont></a:fontScheme><a:fmtScheme name="Office"><a:fillStyleLst><a:solidFill><a:schemeClr val="phClr"/></a:solidFill><a:gradFill rotWithShape="1"><a:gsLst><a:gs pos="0"><a:schemeClr val="phClr"><a:lumMod val="110000"/><a:satMod val="105000"/><a:tint val="67000"/></a:schemeClr></a:gs><a:gs pos="50000"><a:schemeClr val="phClr"><a:lumMod val="105000"/><a:satMod val="103000"/><a:tint val="73000"/></a:schemeClr></a:gs><a:gs pos="100000"><a:schemeClr val="phClr"><a:lumMod val="105000"/><a:satMod val="109000"/><a:tint val="81000"/></a:schemeClr></a:gs></a:gsLst><a:lin ang="5400000" scaled="0"/></a:gradFill><a:gradFill rotWithShape="1"><a:gsLst><a:gs pos="0"><a:schemeClr val="phClr"><a:satMod val="103000"/><a:lumMod val="102000"/><a:tint val="94000"/></a:schemeClr></a:gs><a:gs pos="50000"><a:schemeClr val="phClr"><a:satMod val="110000"/><a:lumMod val="100000"/><a:shade val="100000"/></a:schemeClr></a:gs><a:gs pos="100000"><a:schemeClr val="phClr"><a:lumMod val="99000"/><a:satMod val="120000"/><a:shade val="78000"/></a:schemeClr></a:gs></a:gsLst><a:lin ang="5400000" scaled="0"/></a:gradFill></a:fillStyleLst><a:lnStyleLst><a:ln w="12700" cap="flat" cmpd="sng" algn="ctr"><a:solidFill><a:schemeClr val="phClr"/></a:solidFill><a:prstDash val="solid"/><a:miter lim="800000"/></a:ln><a:ln w="19050" cap="flat" cmpd="sng" algn="ctr"><a:solidFill><a:schemeClr val="phClr"/></a:solidFill><a:prstDash val="solid"/><a:miter lim="800000"/></a:ln><a:ln w="25400" cap="flat" cmpd="sng" algn="ctr"><a:solidFill><a:schemeClr val="phClr"/></a:solidFill><a:prstDash val="solid"/><a:miter lim="800000"/></a:ln></a:lnStyleLst><a:effectStyleLst><a:effectStyle><a:effectLst/></a:effectStyle><a:effectStyle><a:effectLst/></a:effectStyle><a:effectStyle><a:effectLst><a:outerShdw blurRad="57150" dist="19050" dir="5400000" algn="ctr" rotWithShape="0"><a:srgbClr val="000000"><a:alpha val="63000"/></a:srgbClr></a:outerShdw></a:effectLst></a:effectStyle></a:effectStyleLst><a:bgFillStyleLst><a:solidFill><a:schemeClr val="phClr"/></a:solidFill><a:solidFill><a:schemeClr val="phClr"><a:tint val="95000"/><a:satMod val="170000"/></a:schemeClr></a:solidFill><a:gradFill rotWithShape="1"><a:gsLst><a:gs pos="0"><a:schemeClr val="phClr"><a:tint val="93000"/><a:satMod val="150000"/><a:shade val="98000"/><a:lumMod val="102000"/></a:schemeClr></a:gs><a:gs pos="50000"><a:schemeClr val="phClr"><a:tint val="98000"/><a:satMod val="130000"/><a:shade val="90000"/><a:lumMod val="103000"/></a:schemeClr></a:gs><a:gs pos="100000"><a:schemeClr val="phClr"><a:shade val="63000"/><a:satMod val="120000"/></a:schemeClr></a:gs></a:gsLst><a:lin ang="5400000" scaled="0"/></a:gradFill></a:bgFillStyleLst></a:fmtScheme></a:themeElements><a:objectDefaults><a:lnDef><a:spPr/><a:bodyPr/><a:lstStyle/><a:style><a:lnRef idx="2"><a:schemeClr val="accent1"/></a:lnRef><a:fillRef idx="0"><a:schemeClr val="accent1"/></a:fillRef><a:effectRef idx="1"><a:schemeClr val="accent1"/></a:effectRef><a:fontRef idx="minor"><a:schemeClr val="tx1"/></a:fontRef></a:style></a:lnDef></a:objectDefaults><a:extraClrSchemeLst/><a:extLst><a:ext uri="{05A4C25C-085E-4340-85A3-A5531E510DB2}"><thm15:themeFamily xmlns:thm15="http://schemas.microsoft.com/office/thememl/2012/main" name="Office Theme" id="{2E142A2C-CD16-42D6-873A-C26D2A0506FA}" vid="{1BDDFF52-6CD6-40A5-AB3C-68EB2F1E4D0A}"/></a:ext></a:extLst></a:theme>`,c=`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
|
65
|
+
<sst xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main" count="3" uniqueCount="3"><si><t>a</t></si><si><t>b</t></si><si><t>c</t></si></sst>`,h=`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
|
66
|
+
<styleSheet xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="x14ac x16r2 xr" xmlns:x14ac="http://schemas.microsoft.com/office/spreadsheetml/2009/9/ac" xmlns:x16r2="http://schemas.microsoft.com/office/spreadsheetml/2015/02/main" xmlns:xr="http://schemas.microsoft.com/office/spreadsheetml/2014/revision"><fonts count="1" x14ac:knownFonts="1"><font><sz val="12"/><color theme="1"/><name val="Aptos Narrow"/><family val="2"/><scheme val="minor"/></font></fonts><fills count="2"><fill><patternFill patternType="none"/></fill><fill><patternFill patternType="gray125"/></fill></fills><borders count="1"><border><left/><right/><top/><bottom/><diagonal/></border></borders><cellStyleXfs count="1"><xf numFmtId="0" fontId="0" fillId="0" borderId="0"/></cellStyleXfs><cellXfs count="1"><xf numFmtId="0" fontId="0" fillId="0" borderId="0" xfId="0"/></cellXfs><cellStyles count="1"><cellStyle name="Normal" xfId="0" builtinId="0"/></cellStyles><dxfs count="0"/><tableStyles count="0" defaultTableStyle="TableStyleMedium2" defaultPivotStyle="PivotStyleLight16"/><extLst><ext uri="{EB79DEF2-80B8-43e5-95BD-54CBDDF9020C}" xmlns:x14="http://schemas.microsoft.com/office/spreadsheetml/2009/9/main"><x14:slicerStyles defaultSlicerStyle="SlicerStyleLight1"/></ext><ext uri="{9260A510-F301-46a8-8635-F512D64BE5F5}" xmlns:x15="http://schemas.microsoft.com/office/spreadsheetml/2010/11/main"><x15:timelineStyles defaultTimelineStyle="TimeSlicerStyleLight1"/></ext></extLst></styleSheet>`,d=`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
|
67
|
+
<workbook xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="x15 xr xr6 xr10 xr2" xmlns:x15="http://schemas.microsoft.com/office/spreadsheetml/2010/11/main" xmlns:xr="http://schemas.microsoft.com/office/spreadsheetml/2014/revision" xmlns:xr6="http://schemas.microsoft.com/office/spreadsheetml/2016/revision6" xmlns:xr10="http://schemas.microsoft.com/office/spreadsheetml/2016/revision10" xmlns:xr2="http://schemas.microsoft.com/office/spreadsheetml/2015/revision2"><fileVersion appName="xl" lastEdited="7" lowestEdited="7" rupBuild="11207"/><workbookPr defaultThemeVersion="202300"/><mc:AlternateContent xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"><mc:Choice Requires="x15"><x15ac:absPath url="/" xmlns:x15ac="http://schemas.microsoft.com/office/spreadsheetml/2010/11/ac"/></mc:Choice></mc:AlternateContent><xr:revisionPtr revIDLastSave="0" documentId="8_{292BF245-1F37-B045-B1A5-26C42FB62779}" xr6:coauthVersionLast="47" xr6:coauthVersionMax="47" xr10:uidLastSave="{00000000-0000-0000-0000-000000000000}"/><bookViews><workbookView xWindow="11340" yWindow="5060" windowWidth="28040" windowHeight="17440" xr2:uid="{858B8D3F-6246-774D-8903-6D38687B7BC6}"/></bookViews><sheets><sheet name="Sheet1" sheetId="1" r:id="rId1"/></sheets><calcPr calcId="181029"/><extLst><ext uri="{140A7094-0E35-4892-8432-C4D2E57EDEB5}" xmlns:x15="http://schemas.microsoft.com/office/spreadsheetml/2010/11/main"><x15:workbookPr chartTrackingRefBase="1"/></ext><ext uri="{B58B0392-4F1F-4190-BB64-5DF3571DCE5F}" xmlns:xcalcf="http://schemas.microsoft.com/office/spreadsheetml/2018/calcfeatures"><xcalcf:calcFeatures><xcalcf:feature name="microsoft.com:RD"/><xcalcf:feature name="microsoft.com:Single"/><xcalcf:feature name="microsoft.com:FV"/><xcalcf:feature name="microsoft.com:CNMTM"/><xcalcf:feature name="microsoft.com:LET_WF"/><xcalcf:feature name="microsoft.com:LAMBDA_WF"/><xcalcf:feature name="microsoft.com:ARRAYTEXT_WF"/></xcalcf:calcFeatures></ext></extLst></workbook>`,u=`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
|
68
|
+
<Types xmlns="http://schemas.openxmlformats.org/package/2006/content-types"><Default Extension="rels" ContentType="application/vnd.openxmlformats-package.relationships+xml"/><Default Extension="xml" ContentType="application/xml"/><Override PartName="/xl/workbook.xml" ContentType="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml"/><Override PartName="/xl/worksheets/sheet1.xml" ContentType="application/vnd.openxmlformats-officedocument.spreadsheetml.worksheet+xml"/><Override PartName="/xl/theme/theme1.xml" ContentType="application/vnd.openxmlformats-officedocument.theme+xml"/><Override PartName="/xl/styles.xml" ContentType="application/vnd.openxmlformats-officedocument.spreadsheetml.styles+xml"/><Override PartName="/xl/sharedStrings.xml" ContentType="application/vnd.openxmlformats-officedocument.spreadsheetml.sharedStrings+xml"/><Override PartName="/docProps/core.xml" ContentType="application/vnd.openxmlformats-package.core-properties+xml"/><Override PartName="/docProps/app.xml" ContentType="application/vnd.openxmlformats-officedocument.extended-properties+xml"/></Types>`,f=new Map;f.set("_rels/.rels",o),f.set("docProps/app.xml",i),f.set("docProps/core.xml",r),f.set("xl/_rels/workbook.xml.rels",n),f.set("xl/theme/theme1.xml",l);const g=this.withNumberFormats(h,e);return f.set("xl/worksheets/sheet1.xml",this.getX1WorksheetsSheet1Xml(e,s)),f.set("xl/sharedStrings.xml",c),f.set("xl/styles.xml",g),f.set("xl/workbook.xml",d),f.set("[Content_Types].xml",u),f}getX1WorksheetsSheet1Xml(e,t={}){const s=e.reduce((r,n)=>Math.max(r,n.length),1),o=e.length?`A1:${this.getCellAddress(e.length-1,s-1)}`:"A1",i=[];i.push(`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
|
69
69
|
<worksheet xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="x14ac xr xr2 xr3" xmlns:x14ac="http://schemas.microsoft.com/office/spreadsheetml/2009/9/ac" xmlns:xr="http://schemas.microsoft.com/office/spreadsheetml/2014/revision" xmlns:xr2="http://schemas.microsoft.com/office/spreadsheetml/2015/revision2" xmlns:xr3="http://schemas.microsoft.com/office/spreadsheetml/2016/revision3" xr:uid="{E15F8FC4-4D40-434C-921A-3D9CFAAA2865}">
|
|
70
|
-
<dimension ref="${
|
|
70
|
+
<dimension ref="${o}"/>
|
|
71
71
|
<sheetViews>
|
|
72
|
-
<sheetView tabSelected="1" workbookViewId="0"/></sheetViews>
|
|
72
|
+
<sheetView${t.rightToLeft?' rightToLeft="1"':""} tabSelected="1" workbookViewId="0"/></sheetViews>
|
|
73
73
|
<sheetFormatPr baseColWidth="10" defaultRowHeight="16" x14ac:dyDescent="0.2"/>
|
|
74
|
-
<sheetData>`);for(let
|
|
75
|
-
`)}withNumberFormats(e,t){const s=[];for(const r of t)for(const n of r)ps(n)&&!s.includes(n.numberFormat)&&s.push(n.numberFormat);if(this.numberFormatStyles=new Map(s.map((r,n)=>[r,n+1])),!s.length)return e;const o=`<numFmts count="${s.length}">`+s.map((r,n)=>`<numFmt numFmtId="${164+n}" formatCode="${this.escapeXml(r)}"/>`).join("")+"</numFmts>",i=`<cellXfs count="${s.length+1}"><xf numFmtId="0" fontId="0" fillId="0" borderId="0" xfId="0"/>`+s.map((r,n)=>`<xf numFmtId="${164+n}" fontId="0" fillId="0" borderId="0" xfId="0" applyNumberFormat="1"/>`).join("")+"</cellXfs>";return e.replace("<fonts ",`${o}<fonts `).replace('<cellXfs count="1"><xf numFmtId="0" fontId="0" fillId="0" borderId="0" xfId="0"/></cellXfs>',i)}escapeXml(e){return e==null?"":String(e).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}getCellAddress(e,t){const s="ABCDEFGHIJKLMNOPQRSTUVWXYZ";let o="";for(;t>=0;)o=s[t%26]+o,t=Math.floor(t/26)-1;return`${o}${e+1}`}createZip(e){const t=[];return e.forEach((s,o)=>{const i=new TextEncoder().encode(s);t.push({path:new TextEncoder().encode(o),data:i,size:i.length,crc:wo(i),method:0})}),this.assembleZip(t)}async createZipCompressed(e){const t=[];for(const[s,o]of Array.from(e.entries())){const i=new TextEncoder().encode(o),r=await an(i),n=!!r&&r.length<i.length;t.push({path:new TextEncoder().encode(s),data:n?r:i,size:i.length,crc:wo(i),method:n?8:0})}return this.assembleZip(t)}assembleZip(e){const t=[],s=[];let o=0;for(const h of e){const d=new Uint8Array(30+h.path.length),u=new DataView(d.buffer);d.set([80,75,3,4],0),u.setUint16(4,20,!0),u.setUint16(6,0,!0),u.setUint16(8,h.method,!0),u.setUint16(10,0,!0),u.setUint16(12,33,!0),u.setUint32(14,h.crc,!0),u.setUint32(18,h.data.length,!0),u.setUint32(22,h.size,!0),u.setUint16(26,h.path.length,!0),u.setUint16(28,0,!0),d.set(h.path,30),t.push(d,h.data),s.push(o),o+=d.length+h.data.length}const i=o;e.forEach((h,d)=>{const u=new Uint8Array(46+h.path.length),f=new DataView(u.buffer);u.set([80,75,1,2],0),f.setUint16(4,20,!0),f.setUint16(6,20,!0),f.setUint16(8,0,!0),f.setUint16(10,h.method,!0),f.setUint16(12,0,!0),f.setUint16(14,33,!0),f.setUint32(16,h.crc,!0),f.setUint32(20,h.data.length,!0),f.setUint32(24,h.size,!0),f.setUint16(28,h.path.length,!0),f.setUint16(30,0,!0),f.setUint16(32,0,!0),f.setUint16(34,0,!0),f.setUint16(36,0,!0),f.setUint32(38,0,!0),f.setUint32(42,s[d],!0),u.set(h.path,46),t.push(u),o+=u.length});const r=new Uint8Array(22),n=new DataView(r.buffer);r.set([80,75,5,6],0),n.setUint16(8,e.length,!0),n.setUint16(10,e.length,!0),n.setUint32(12,o-i,!0),n.setUint32(16,i,!0),t.push(r);const a=new Uint8Array(t.reduce((h,d)=>h+d.length,0));let c=0;for(const h of t)a.set(h,c),c+=h.length;return a}}const Dt=class Dt{constructor(e,t,s){this.document=e,this.id=t,this.domService=s}announce(e,t=Dt.defaultDelayInMs){const s=this.getOrCreateElement();s&&(this.timeout&&clearTimeout(this.timeout),s.textContent="",this.pendingText=e,this.timeout=setTimeout(()=>{this.timeout=void 0,this.pendingText=void 0,s.textContent=e},Math.max(0,t)))}cancel(e){this.timeout&&(e===void 0||e===this.pendingText)&&(clearTimeout(this.timeout),this.timeout=void 0,this.pendingText=void 0)}getElement(){return this.getOrCreateElement()}destroy(){var e;this.timeout&&(clearTimeout(this.timeout),this.timeout=void 0),(e=this.element)==null||e.remove(),this.element=void 0}getOrCreateElement(){var i;if(this.element)return this.element;const e=(i=this.document)==null?void 0:i.body;if(!e)return;const t=this.domService,s=t.createElement("div");t.setAttribute(s,"id",this.id),t.setAttribute(s,"role","status"),t.setAttribute(s,"aria-live","polite"),t.setAttribute(s,"aria-atomic","true"),t.addClass(s,"ge-table-sr-only");const o={position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)","white-space":"nowrap",border:"0"};for(const r in o)t.setStyle(s,r,o[r]);return t.appendChild(e,s),this.element=s,s}};Dt.defaultDelayInMs=150;let xt=Dt;class jt{constructor(){this.managed=!0,this.multiRow=!0,this.treeDropInside=!0,this.dragThresholdInPx=4,this.autoScrollZoneInPx=40,this.autoScrollMaxSpeedInPx=24,this.ghostText=void 0}static create(e){const t=new jt;for(const[s,o]of Object.entries(e??{}))o!==void 0&&(t[s]=o);return t}}class di{constructor(e,t,s,o,i,r,n,a,c){this.type=e,this.source=t,this.rows=s,this.rowIndices=o,this.target=i,this.toIndex=r,this.outside=n,this.managed=a,this.originalEvent=c,this.moved=!1,this.prevented=!1}get defaultPrevented(){return this.prevented}preventDefault(){this.prevented=!0}}const ts="drag-row";class ui{constructor(e){this.tableScope=e,this.autoScrollFrame=0,this.suppressClick=!1,this.warnedUnsupported=!1;const t=e.listenerAbortController.signal;e.hostElement.addEventListener("pointerdown",s=>this.onPointerDown(s),{signal:t}),e.hostElement.addEventListener("click",s=>this.onClickCapture(s),{capture:!0,signal:t}),e.hostElement.addEventListener("dblclick",s=>{s.target instanceof Element&&s.target.closest(`[data-ge-action="${ts}"]`)&&s.stopPropagation()},{capture:!0,signal:t})}get options(){return jt.create(this.tableScope.tableOptions.rowDragOptions)}isDragging(){return!!this.session}isDragSourceRow(e){return!!this.session&&this.session.rowSet.has(e)}getBlockReason(){var s;if(!this.isManaged())return;if(this.isSorted())return"sorted";const e=this.tableScope.tableModel.getBodyModel(),t=(s=e.getUnfilteredRowCount)==null?void 0:s.call(e);if(t!==void 0&&t>e.getRowCount())return"filtered"}getHandleState(e,t,s){const o=t==null?void 0:t.rowDrag;if(!o||ns(s))return"none";const i=s.getRowByIndex(e);return rs(i)||typeof o=="function"&&!o(i,e)?"none":this.isManaged()&&!this.canModelMove(s)?(this.warnedUnsupported||(this.warnedUnsupported=!0,console.warn("GuiExpert Table: rowDrag is set, but the body model cannot move rows (no moveRows(), or row grouping / pivot). Use rowDragOptions: { managed: false } and move the rows yourself.")),"none"):this.getBlockReason()?"disabled":"enabled"}decorateCell(e,t){if(t==="none")return;const s=this.tableScope.getDomService().domService,o=s.createElement("span");s.addClass(o,"ge-table-row-drag-handle"),t==="disabled"&&s.addClass(o,"ge-table-row-drag-handle-disabled"),s.setAttribute(o,"data-ge-action",ts),s.setAttribute(o,"aria-hidden","true"),s.appendChild(e,o),s.addClass(e,"ge-table-row-drag-cell"),s.setAttribute(e,"aria-keyshortcuts","Control+Alt+ArrowUp Control+Alt+ArrowDown")}onPointerDown(e){var i;if(this.session||this.pending||e.pointerType==="mouse"&&e.button!==0)return;const t=e.target instanceof Element?e.target:null,s=t==null?void 0:t.closest(`[data-ge-action="${ts}"]`);if(!s||!this.tableScope.hostElement.contains(s)||this.tableScope.tableOverlay.isEventBlocked(e)||this.tableScope.isEditing())return;e.preventDefault();const o=Number((i=s.closest("[data-row-index]"))==null?void 0:i.getAttribute("data-row-index"));if(!(!Number.isInteger(o)||o<0)){if(s.classList.contains("ge-table-row-drag-handle-disabled")){this.announceNotPossible();return}this.pending={pointerId:e.pointerId,startX:e.clientX,startY:e.clientY,rowIndex:o},this.listenToDocument()}}listenToDocument(){this.sessionAbortController=new AbortController;const e=this.sessionAbortController.signal,t=this.tableScope.hostElement.ownerDocument;t.addEventListener("pointermove",s=>this.onPointerMove(s),{signal:e}),t.addEventListener("pointerup",s=>this.onPointerUp(s),{signal:e}),t.addEventListener("pointercancel",s=>this.onPointerCancel(s),{signal:e}),t.addEventListener("keydown",s=>this.onKeyDown(s),{capture:!0,signal:e}),this.tableScope.scrollViewport.addEventListener("scroll",()=>{var s;(s=this.session)!=null&&s.lastEvent&&!this.autoScrollFrame&&this.updateTarget(this.session.lastEvent)},{signal:e})}onPointerMove(e){if(!(!this.pending||e.pointerId!==this.pending.pointerId)){if(!this.session){const t=e.clientX-this.pending.startX,s=e.clientY-this.pending.startY;if(Math.hypot(t,s)<this.options.dragThresholdInPx||!this.startPointerDrag(e))return}e.preventDefault(),this.session&&this.updateTarget(e)}}onPointerUp(e){if(!(!this.pending||e.pointerId!==this.pending.pointerId)){if(!this.session){this.stopListening();return}this.updateTarget(e),this.suppressClick=!0,setTimeout(()=>this.suppressClick=!1,0),this.session&&this.drop(e)}}onPointerCancel(e){this.pending&&e.pointerId===this.pending.pointerId&&this.cancel(e)}onKeyDown(e){e.key==="Escape"&&(this.session||this.pending)&&(e.preventDefault(),e.stopPropagation(),this.cancel(e))}onClickCapture(e){this.suppressClick&&(this.suppressClick=!1,e.stopPropagation(),e.preventDefault())}startPointerDrag(e){var r,n;const t=this.pending,s=this.getDragRowIndices(t.rowIndex),o=this.getRows(s),i=this.createEvent("start","pointer",o,s,void 0,!1,e);return(n=(r=this.tableScope.getEventListener()).onRowDragStart)==null||n.call(r,i),i.defaultPrevented||this.pending!==t?(this.stopListening(),!1):(this.session={source:"pointer",rowIndices:s,rows:o,outside:!1,autoScrollSpeed:0,rowSet:new Set(s),options:this.options,scrollRemainder:0},this.createDragElements(o),this.tableScope.repaint(),this.tableScope.announce(this.texts().rowDragStarted(o.length)),!0)}updateTarget(e){var n,a;const t=this.session;t.lastEvent=e;const{target:s,outside:o}=this.computeTarget(e.clientX,e.clientY);let i=s&&this.isValidTarget(t.rowIndices,s)?s:void 0;if(!cn(i,t.target)||o!==t.outside){const c=this.createEvent("move","pointer",t.rows,t.rowIndices,i,o,e);if((a=(n=this.tableScope.getEventListener()).onRowDragMove)==null||a.call(n,c),this.session!==t)return;c.defaultPrevented&&(i=void 0)}t.target=i,t.outside=o,this.renderDragElements(e),t.autoScrollSpeed=o?0:this.calcAutoScrollSpeed(e.clientY),t.autoScrollSpeed&&!this.autoScrollFrame?this.autoScrollFrame=requestAnimationFrame(()=>this.autoScrollStep()):t.autoScrollSpeed||(t.lastFrameTime=void 0,t.scrollRemainder=0)}autoScrollStep(){this.autoScrollFrame=0;const e=this.session;if(!e||!e.autoScrollSpeed)return;const t=this.tableScope.scrollViewport,s=t.scrollTop,o=performance.now(),i=e.lastFrameTime?Math.min(4,(o-e.lastFrameTime)/(1e3/60)):1;e.lastFrameTime=o;const r=e.autoScrollSpeed*i*this.tableScope.getScrollerToContentRatioY()+e.scrollRemainder,n=Math.trunc(r);e.scrollRemainder=r-n,t.scrollTop=s+n,t.scrollTop!==s&&this.tableScope.adjustAfterScrolling(),this.updateTarget(e.lastEvent)}calcAutoScrollSpeed(e){const{autoScrollZoneInPx:t,autoScrollMaxSpeedInPx:s}=this.session.options;if(t<=0||s<=0)return 0;const o=this.tableScope.getBodyViewport(),i=e-o.top,r=o.top+o.height-e,n=a=>Math.max(1,Math.round(s*Math.min(1,a/t)**2));return i<t?-n(t-i):r<t?n(t-r):0}computeTarget(e,t){var p,m;const s=this.tableScope.hostElement.getBoundingClientRect();if(e<s.left||e>s.right||t<s.top||t>s.bottom)return{outside:!0};const o=this.tableScope.tableModel.getBodyModel(),i=o.getRowCount();if(i<1)return{outside:!1};const r=this.tableScope.getBodyViewport(),a=Math.min(Math.max(t,r.top),r.top+Math.max(0,r.height-1))-r.top+r.contentScrollTop,c=Ws(a,i,b=>o.getYPosByRowIndex(b),(p=o.getConstantRowHeight)==null?void 0:p.call(o)),h=o.getYPosByRowIndex(c),d=Math.max(1,o.getRowHeight(c)),u=Math.min(1,Math.max(0,(a-h)/d));let f;const g=_(o);if(g&&(((m=this.session)==null?void 0:m.options)??this.options).treeDropInside?f=u<.25?"before":u>.75?"after":"inside":f=u<.5?"before":"after",g&&f==="after"&&c+1<i){const b=o.getRowByIndex(c),y=o.getRowByIndex(c+1);if(y!=null&&y.parent&&y.parent===b)return{target:{rowIndex:c+1,position:"before"},outside:!1}}return{target:{rowIndex:c,position:f},outside:!1}}isValidTarget(e,t){if(!this.isManaged())return!0;const s=this.tableScope.tableModel.getBodyModel();return!!s.moveRows&&(s.canMoveRows?s.canMoveRows(e,t):!0)}drop(e){var r,n;const t=this.session,s=t.outside?void 0:t.target,o=this.createEvent("end",t.source,t.rows,t.rowIndices,s,t.outside,e);this.stopListening();const i=s&&this.isManaged()?this.moveRows(t.rowIndices,s,!0):-1;i>-1?(o.moved=!0,o.toIndex=i):this.tableScope.repaint(),(n=(r=this.tableScope.getEventListener()).onRowDragEnd)==null||n.call(r,o)}cancel(e){var s,o;const t=this.session;if(this.stopListening(),t){this.tableScope.repaint(),this.tableScope.announce(this.texts().rowDragCancelled());const i=this.createEvent("cancel",t.source,t.rows,t.rowIndices,void 0,t.outside,e);(o=(s=this.tableScope.getEventListener()).onRowDragEnd)==null||o.call(s,i)}}stopListening(){var t,s,o;(t=this.sessionAbortController)==null||t.abort(),this.sessionAbortController=void 0,this.pending=void 0,this.session=void 0,this.autoScrollFrame&&(cancelAnimationFrame(this.autoScrollFrame),this.autoScrollFrame=0),(s=this.ghost)==null||s.remove(),(o=this.indicator)==null||o.remove(),this.ghost=void 0,this.indicator=void 0,this.tableScope.hostElement.classList.remove("ge-table-row-drag-active","ge-table-row-drag-invalid")}destroy(){this.cancel()}createDragElements(e){const t=this.tableScope.getDomService(),s=this.tableScope.hostElement;this.ghost=t.setAriaHidden(t.createDivWithClass("ge-table-row-drag-ghost",s)),this.ghost.textContent=this.getGhostText(e),this.indicator=t.setAriaHidden(t.createDivWithClass("ge-table-row-drop-indicator",s)),s.classList.add("ge-table-row-drag-active")}getGhostText(e){const t=this.session.options.ghostText;if(t)return String(t(e)??"");const s=this.session.rowIndices[0],o=this.tableScope.tableModel.getBodyModel(),i=this.getHandleColumnIndex(s),n=(i>-1?o.getTextValueAt(s,i):"")||`Row ${s+1}`;return e.length>1?`${n} (+${e.length-1})`:n}renderDragElements(e){const t=this.session,s=this.ghost,o=this.indicator,i=this.tableScope.hostElement,r=i.getBoundingClientRect();s.style.left=`${e.clientX-r.left-i.clientLeft+12}px`,s.style.top=`${e.clientY-r.top-i.clientTop+8}px`,i.classList.toggle("ge-table-row-drag-invalid",!t.target&&!t.outside);const n=t.target,a=this.tableScope.getBodyViewport();if(!n){o.style.display="none";return}const c=this.tableScope.tableModel.getBodyModel(),h=c.getYPosByRowIndex(n.rowIndex),d=c.getRowHeight(n.rowIndex),u=a.top-r.top-i.clientTop,f=n.position==="inside",g=u+h-a.contentScrollTop+(n.position==="after"?d:0),p=f?g:g-1,m=f?d:2,b=p+m>=u&&p<=u+a.height;o.classList.toggle("ge-table-row-drop-indicator-inside",f),Object.assign(o.style,{display:b?"block":"none",left:`${a.left-r.left-i.clientLeft}px`,width:`${this.getMarkerWidth(a.width)}px`,top:`${p}px`,height:`${m}px`})}getMarkerWidth(e){const t=this.tableScope.tableModel,s=t.getPadding(),o=s.left+t.getContentWidthInPixel()+s.right;return o>0?Math.min(e,o):e}moveRows(e,t,s=!0){const o=this.tableScope,i=o.tableModel.getBodyModel(),r=xe(e,i.getRowCount());if(!r.length||!i.moveRows||this.isSorted()||i.canMoveRows&&!i.canMoveRows(r,t))return-1;const n=_(i),a=ls(r,t),c=r[r.length-1]-r[0]===r.length-1;if(!n&&c&&a===r[0])return-1;const h=n?r.map(p=>i.getRowByIndex(p)):[];if(!i.moveRows(r,t))return-1;o.afterRowsMoved();const d=n?this.findDisplayIndices(i,h):[];let u=n?-1:a;for(const p of d)(u<0||p<u)&&(u=p);const f=o.selectionModel();if(f&&f.hasSelection()&&(f.clear(),s&&r.length>1)){const p=o.tableModel.getColumnCount()-1;n?d.forEach(m=>f.addSelection(new R(m,0,m,p))):f.addSelection(new R(a,0,a+r.length-1,p))}const g=o.focusModel();if(g&&u>-1){const[,p]=g.getFocus();g.setFocus(u,p>-1?p:Math.max(0,this.getHandleColumnIndex(u)))}return o.repaintHard(),u>-1&&o.ensureRowIsVisible(u),o.stateService.markDirty("selection"),o.announce(this.texts().rowMoved(u+1,i.getRowCount())),u}findDisplayIndices(e,t){const s=new Set(t),o=[],i=e.getRowCount();for(let r=0;r<i&&o.length<s.size;r++)s.has(e.getRowByIndex(r))&&o.push(r);return o}moveByKeyboard(e){var p,m,b,y,w,S;const t=this.tableScope;if(this.session||t.isEditing())return!1;const s=t.focusModel(),o=t.tableModel.getBodyModel(),[i]=(s==null?void 0:s.getFocus())??[-1,-1],r=i<0||i>=o.getRowCount()?-1:this.getHandleColumnIndex(i);if(r<0)return!1;if(this.getHandleStateOfRow(i,r)==="disabled")return this.announceNotPossible(),!0;const n=_(o),a=n?[i]:this.getDragRowIndices(i),c=n?this.getTreeKeyboardTarget(o,i,e):this.getFlatKeyboardTarget(a,e,o.getRowCount());if(!c)return!0;const h=this.getRows(a),d=this.createEvent("start","keyboard",h,a,void 0,!1);if((m=(p=t.getEventListener()).onRowDragStart)==null||m.call(p,d),d.defaultPrevented)return!0;const u=this.createEvent("move","keyboard",h,a,c,!1);(y=(b=t.getEventListener()).onRowDragMove)==null||y.call(b,u);const f=!u.defaultPrevented&&this.isValidTarget(a,c),g=this.createEvent("end","keyboard",h,a,f?c:void 0,!1);if(f&&this.isManaged()){const C=this.moveRows(a,c,!0);g.moved=C>-1,g.moved&&(g.toIndex=C)}return(S=(w=t.getEventListener()).onRowDragEnd)==null||S.call(w,g),!0}getFlatKeyboardTarget(e,t,s){if(t<0){const i=e[0];return i>0?{rowIndex:i-1,position:"before"}:void 0}const o=e[e.length-1];return o<s-1?{rowIndex:o+1,position:"after"}:void 0}getTreeKeyboardTarget(e,t,s){const o=e.getRowByIndex(t),i=e.rows??[],r=o!=null&&o.parent?o.parent.children??[]:i,n=r[r.indexOf(o)+s];if(!n)return;const[a]=this.findDisplayIndices(e,[n]);return a===void 0?void 0:{rowIndex:a,position:s<0?"before":"after"}}getDragRowIndices(e){const t=this.tableScope.tableModel.getBodyModel().getRowCount(),s=this.tableScope.selectionModel();if(this.options.multiRow&&(s!=null&&s.hasSelection())){const o=xe(s.getMergedRowIndices(t),t);if(o.includes(e))return o}return[e]}getRows(e){const t=this.tableScope.tableModel.getBodyModel(),s=z(t);return e.map(o=>{const i=t.getRowByIndex(o);return s&&F(i)&&!rs(i)?i.data:i})}getHandleColumnIndex(e){const t=this.tableScope.tableModel,s=t.getBodyModel(),o=t.getColumnCount();for(let i=0;i<o;i++){const r=t.getColumnDef(i);if(r!=null&&r.rowDrag&&this.getHandleState(e,r,s)!=="none")return i}return-1}getHandleStateOfRow(e,t){const s=this.tableScope.tableModel;return this.getHandleState(e,s.getColumnDef(t),s.getBodyModel())}isSorted(){var e,t,s;return!!((s=(t=(e=this.tableScope.tableModel).getColumnDefs)==null?void 0:t.call(e))!=null&&s.some(o=>o.sortState==="asc"||o.sortState==="desc"))}isManaged(){var e;return((e=this.tableScope.tableOptions.rowDragOptions)==null?void 0:e.managed)!==!1}canModelMove(e){return!!e.moveRows&&!z(e)&&!ns(e)}createEvent(e,t,s,o,i,r,n){const a=_(this.tableScope.tableModel.getBodyModel()),c=i&&!a?ls(o,i):-1;return new di(e,t,s,[...o],i?{...i}:void 0,c,r,this.isManaged(),n)}announceNotPossible(){this.tableScope.announce(this.texts().rowMoveNotPossible())}texts(){const e=this.tableScope.ariaTexts,t=new ve;return{rowDragStarted:s=>(e.rowDragStarted??t.rowDragStarted).call(e,s),rowMoved:(s,o)=>(e.rowMoved??t.rowMoved).call(e,s,o),rowMoveNotPossible:()=>(e.rowMoveNotPossible??t.rowMoveNotPossible).call(e),rowDragCancelled:()=>(e.rowDragCancelled??t.rowDragCancelled).call(e)}}}function cn(l,e){return l===e||!!l&&!!e&&l.rowIndex===e.rowIndex&&l.position===e.position}class Kt{constructor(){this.blockCommitOnInvalid=!0}static create(e){const t=new Kt;return e&&typeof e=="object"&&e.blockCommitOnInvalid!==void 0&&(t.blockCommitOnInvalid=e.blockCommitOnInvalid),t}}function fi(l,e){if(Object.is(l,e))return!0;const t=s=>s==null||s==="";return t(l)||t(e)?t(l)&&t(e):l instanceof Date&&e instanceof Date?l.getTime()===e.getTime()||isNaN(l.getTime())&&isNaN(e.getTime()):typeof l=="number"&&typeof e=="string"||typeof l=="string"&&typeof e=="number"?String(l)===String(e):!1}class gi{constructor(){this.rows=new Map,this.count=0}set(e,t,s,o,i,r){let n=this.rows.get(e);const a=n==null?void 0:n.get(t),c=a?a.oldValue:s;return fi(c,o)?a?(n.delete(t),n.size||this.rows.delete(e),this.count--,"removed"):"unchanged":(n||(n=new Map,this.rows.set(e,n)),n.set(t,{rowKey:e,property:t,oldValue:c,newValue:o,rawValue:i,error:r||void 0}),a?"changed":(this.count++,"added"))}get(e,t){var s;return this.count?(s=this.rows.get(e))==null?void 0:s.get(t):void 0}remove(e,t){const s=this.rows.get(e);return s!=null&&s.delete(t)?(s.size||this.rows.delete(e),this.count--,!0):!1}hasRow(e){return this.rows.has(e)}size(){return this.count}isEmpty(){return this.count===0}invalidCount(){let e=0;return this.rows.forEach(t=>t.forEach(s=>{s.error&&e++})),e}entries(){const e=[];return this.rows.forEach(t=>t.forEach(s=>e.push(s))),e}clear(){this.rows.clear(),this.count=0}}class pi{constructor(e,t,s,o,i=()=>[]){this.type=e,this.changes=t,this.pendingCount=s,this.invalidCount=o,this.pendingProvider=i}get pendingChanges(){return this.pendingProvider()}}class mi{constructor(e){this.tableScope=e,this.pending=new gi,this.started=!1}get options(){return Kt.create(this.tableScope.tableOptions.batchEdit)}isPermanent(){return!!this.tableScope.tableOptions.batchEdit}isActive(){return this.started||this.isPermanent()}hasPending(){return!this.pending.isEmpty()}start(){return this.isActive()?!1:(this.started=!0,this.fire("start",[]),!0)}rowKeyOf(e){const t=this.tableScope.tableModel.getBodyModel().getRowByIndex(e);return t==null?e:F(t)?t.data??t:t}propertyOf(e){var t;return((t=this.tableScope.tableModel.getColumnDef(e))==null?void 0:t.property)||`#${e}`}getPendingAt(e,t){if(!this.pending.isEmpty())return this.pending.get(this.rowKeyOf(e),this.propertyOf(t))}getShownValue(e,t){const s=this.getPendingAt(e,t);return s?s.newValue:this.tableScope.tableModel.getBodyModel().getValueAt(e,t)}addPending(e){const t=this.tableScope.tableModel.getBodyModel(),s=[];for(const o of e){const i=this.rowKeyOf(o.rowIndex),r=this.propertyOf(o.columnIndex),n=t.getValueAt(o.rowIndex,o.columnIndex);if(this.pending.set(i,r,n,o.value,o.rawValue,o.error)!=="unchanged"){const c=this.pending.get(i,r);s.push({row:typeof i=="number"?void 0:i,rowIndex:o.rowIndex,columnIndex:o.columnIndex,property:r,oldValue:c?c.oldValue:n,newValue:o.value,...o.error?{error:o.error}:{}})}}return s.length&&(this.fire("change",s),this.tableScope.announce(this.texts().pendingChanges(this.pending.size()))),s}getPendingChanges(){if(this.pruneOrphans(),this.pending.isEmpty())return[];const e=this.createRowIndexMap();return this.pending.entries().map(t=>this.toChange(t,e))}commit(){const e=this.tableScope;this.pruneOrphans();const t=this.pending.invalidCount();if(t&&this.options.blockCommitOnInvalid)return e.announce(this.texts().commitBlocked(t)),!1;const s=this.pending.entries(),o=s.length?this.createRowIndexMap():new Map,i=e.tableModel,r=[],n=[];for(const h of s){const d=this.findColumnIndex(h.property);if(d<0)continue;const u=typeof h.rowKey=="number"?h.rowKey:o.get(h.rowKey)??-1;if(u>-1)r.push({rowIndex:u,columnIndex:d,value:h.rawValue});else if(hn(h.rowKey,i.getColumnDef(d),d,h.newValue)){const f=this.toChange(h,o);delete f.error,n.push(f)}}this.pending.clear(),this.isPermanent()||(this.started=!1);const a=e.writeCells(r,"commit",{extraChanges:n,skipValidation:!0}),c=i.getBodyModel();return n.length&&z(c)&&(c.regroup(),e.invalidateAggregates(),e.repaintHard()),this.fire("commit",a),e.announce(this.texts().changesCommitted(a.length)),!0}cancel(){const e=this.getPendingChanges(),t=this.started;this.pending.clear(),this.isPermanent()||(this.started=!1),this.tableScope.repaint(),(e.length||t)&&(this.fire("cancel",e),this.tableScope.announce(this.texts().changesDiscarded()))}pruneOrphans(){if(this.pending.isEmpty())return 0;const e=this.collectRowKeys();if(!e)return 0;let t=0;for(const s of this.pending.entries())typeof s.rowKey!="number"&&!e.has(s.rowKey)&&(this.pending.remove(s.rowKey,s.property),t++);return t}collectRowKeys(){const e=this.tableScope.tableModel.getBodyModel();if(_(e)){const t=new Set,s=o=>o==null?void 0:o.forEach(i=>{const r=i;t.add(r.data??r),s(r.children)});return s(e.rows),t}return typeof e.getAllRows=="function"?new Set(e.getAllRows()):void 0}toChange(e,t){const s=typeof e.rowKey=="number"?e.rowKey:t.get(e.rowKey)??-1;return{row:typeof e.rowKey=="number"?void 0:e.rowKey,rowIndex:s,columnIndex:this.findColumnIndex(e.property),property:e.property,oldValue:e.oldValue,newValue:e.newValue,...e.error?{error:e.error}:{}}}findColumnIndex(e){const s=this.tableScope.tableModel.getColumnCount();for(let o=0;o<s;o++)if(this.propertyOf(o)===e)return o;return-1}createRowIndexMap(){const e=new Map,t=this.tableScope.tableModel.getBodyModel().getRowCount();for(let s=0;s<t;s++){const o=this.rowKeyOf(s);this.pending.hasRow(o)&&!e.has(o)&&e.set(o,s)}return e}fire(e,t){var o,i;const s=new pi(e,t,this.pending.size(),this.pending.invalidCount(),()=>this.getPendingChanges());(i=(o=this.tableScope.getEventListener()).onBatchEditChanged)==null||i.call(o,s)}texts(){return this.tableScope.getEditTexts()}}function hn(l,e,t,s){if(l===null||typeof l!="object")return!1;if(Array.isArray(l))return l[t]=s,!0;if(!(e!=null&&e.property))return!1;if(e.valueGetter)return!!e.valueSetter&&e.valueSetter(l,s)!==!1;const o=e.property.split(".");let i=l;for(let r=0;r<o.length-1;r++)if(i=i==null?void 0:i[o[r]],i===null||typeof i!="object")return!1;return i[o[o.length-1]]=s,!0}const bi=/^(\d{4})-(\d{2})-(\d{2})$/,dn=/^-?\d+(\.\d+)?$/,wi=/^(.*\D)(\d+)$/,un=864e5;function yi(l,e,t=!1,s="auto"){const o=l.length;if(e<1||o<1)return[];const i=Array.from({length:e},(a,c)=>t?-(c+1):c+1),r=()=>i.map(a=>fn(l,a));if(s==="copy")return r();const n=xi(l,s==="alternate");return n?i.map(n):r()}function Ci(l,e="auto"){return e!=="copy"&&l.length>0&&!!xi(l,e==="alternate")}function fn(l,e){const t=l.length;return e>0?l[(e-1)%t]:l[t-1-(-e-1)%t]}function xi(l,e){const s=l.length===1?e:!e,o=!e;if(l.every(gn))return s?Co(l,i=>i):void 0;if(l.every(i=>typeof i=="string"&&dn.test(i))){const i=l;if(i.some(c=>!Number.isSafeInteger(Math.trunc(Number(c)))))return;const r=Math.max(...i.map(c=>{var h;return((h=c.split(".")[1])==null?void 0:h.length)??0})),n=Math.max(...i.map(c=>{const h=c.replace("-","").split(".")[0];return h.length>1&&h.startsWith("0")?h.length:0})),a=c=>{const h=c.toFixed(r);if(!n)return h;const d=h.startsWith("-"),[u,f]=h.replace("-","").split(".");return(d?"-":"")+u.padStart(n,"0")+(f!==void 0?"."+f:"")};return s?Co(i.map(Number),a):void 0}if(l.every(yo))return o?mn(l):void 0;if(l.every(i=>typeof i=="string"&&bi.test(i)&&yo(Ai(i))))return o?bn(l):void 0;if(l.every(i=>typeof i=="string"&&wi.test(i)))return o?wn(l):void 0}function gn(l){return typeof l=="number"&&Number.isFinite(l)}function yo(l){return l instanceof Date&&!isNaN(l.getTime())}function ss(l){const e=Number(l.toPrecision(15));return e===0?0:e}function Co(l,e){const t=l.length,s=l[t-1];if(t===1)return u=>e(ss(s+u));const o=l[1]-l[0];if(l.every((u,f)=>f===0||Math.abs(u-l[f-1]-o)<=1e-9*Math.max(1,Math.abs(o))))return u=>e(ss(u>0?s+o*u:l[0]+o*u));const r=(t-1)/2,n=l.reduce((u,f)=>u+f,0)/t;let a=0,c=0;l.forEach((u,f)=>{a+=(f-r)*(u-n),c+=(f-r)**2});const h=a/c,d=n-h*r;return u=>{const f=u>0?t-1+u:u;return e(ss(d+h*f))}}function pn(l){return l.d===Si(l.y,l.m)}function Si(l,e){return Yt(l,e+1,0).getUTCDate()}function Yt(l,e,t){const s=new Date(0);return s.setUTCFullYear(l,e,t),s}function je(l){return l.y*12+l.m}function xo(l){return Math.round(Yt(l.y,l.m,l.d).getTime()/un)}function vi(l){const e=l.length;if(e===1)return{months:0,days:1,monthEnd:!1};const t=l.every(pn),s=l.every(r=>r.d===l[0].d),o=je(l[1])-je(l[0]);if((s||t)&&o!==0&&l.every((r,n)=>n===0||je(r)-je(l[n-1])===o))return{months:o,days:0,monthEnd:t&&!s};const i=xo(l[e-1])-xo(l[0]);return{months:0,days:Math.round(i/(e-1)),monthEnd:!1}}function Ri(l,e,t){const s=e>0?l[l.length-1]:l[0];if(t.months){const i=je(s)+t.months*e,r=Math.floor(i/12),n=i-r*12,a=Si(r,n);return{y:r,m:n,d:t.monthEnd?a:Math.min(s.d,a)}}const o=Yt(s.y,s.m,s.d+t.days*e);return{y:o.getUTCFullYear(),m:o.getUTCMonth(),d:o.getUTCDate()}}function mn(l){const e=l.map(s=>({y:s.getFullYear(),m:s.getMonth(),d:s.getDate()})),t=vi(e);return s=>{const o=Ri(e,s,t),i=l[s>0?l.length-1:0];return new Date(o.y,o.m,o.d,i.getHours(),i.getMinutes(),i.getSeconds(),i.getMilliseconds())}}function Ai(l){const[,e,t,s]=bi.exec(l),o=Yt(Number(e),Number(t)-1,Number(s));return o.getUTCDate()===Number(s)&&o.getUTCMonth()===Number(t)-1?o:new Date(NaN)}function bn(l){const e=l.map(s=>{const o=Ai(s);return{y:o.getUTCFullYear(),m:o.getUTCMonth(),d:o.getUTCDate()}}),t=vi(e);return s=>{const o=Ri(e,s,t);return`${String(o.y).padStart(4,"0")}-${String(o.m+1).padStart(2,"0")}-${String(o.d).padStart(2,"0")}`}}function wn(l){const e=l.map(r=>{const[,n,a]=wi.exec(r);return{prefix:n,digits:a,num:Number(a)}}),t=e[0].prefix;if(e.some(r=>r.prefix!==t)||e.some(r=>!Number.isSafeInteger(r.num)))return;const s=e.length,o=s===1?1:(e[s-1].num-e[0].num)/(s-1);if(!Number.isInteger(o))return;const i=Math.max(...e.map(r=>r.digits.length>1&&r.digits.startsWith("0")?r.digits.length:0));return r=>{const n=r>0?e[s-1].num:e[0].num,a=Math.abs(n+o*r);return t+String(a).padStart(i,"0")}}function Ys(l,e,t){const{r1:s,c1:o,r2:i,c2:r}=l;switch(e){case"down":return new R(s,o,i+t,r);case"up":return new R(s-t,o,i,r);case"right":return new R(s,o,i,r+t);default:return new R(s,o-t,i,r)}}function Mi(l){var f;const{source:e,direction:t,count:s,getValue:o}=l,i=l.mode??"auto",r=t==="down"||t==="up",n=t==="up"||t==="left",a=[];if(s<1)return a;const[c,h]=r?[e.c1,e.c2]:[e.r1,e.r2],[d,u]=r?[e.r1,e.r2]:[e.c1,e.c2];for(let g=c;g<=h;g++){const p=w=>r?[w,g]:[g,w],m=[];for(let w=d;w<=u;w++)m.push(o(...p(w)));const b=yi(m,s,n,i),y=Ci(m,i);for(let w=0;w<s;w++){const S=n?d-1-w:u+1+w,[C,A]=p(S);if(l.isFillable&&!l.isFillable(C,A))continue;let I=b[w];if(l.fillValue){const M=((f=l.getCellInfo)==null?void 0:f.call(l,C,A))??{row:void 0,property:""},E=l.fillValue({sourceValues:m,step:n?-(w+1):w+1,direction:t,rowIndex:C,columnIndex:A,property:M.property,row:M.row,defaultValue:I,copy:!y});E!==void 0&&(I=E)}a.push({rowIndex:C,column:A,value:I})}}return a}const So="fill-handle";class Ei{constructor(e){this.tableScope=e,this.autoScrollFrame=0,this.suppressClick=!1,this.shortcutsSet=!1;const t=e.listenerAbortController.signal;e.hostElement.addEventListener("pointerdown",s=>this.onPointerDown(s),{signal:t}),e.hostElement.addEventListener("click",s=>this.onClickCapture(s),{capture:!0,signal:t}),e.hostElement.addEventListener("dblclick",s=>{this.isHandle(s.target)&&s.stopPropagation()},{capture:!0,signal:t})}isFilling(){return!!this.session}update(){var r,n;const e=this.tableScope,t=e.getFillHandleOptions();if(!t){this.removeHandle(),this.shortcutsSet&&(this.shortcutsSet=!1,this.tableScope.setHostKeyShortcuts(void 0));return}this.updateHostShortcuts(t);const s=((r=this.session)==null?void 0:r.source)??e.getFillSourceRange(),o=s&&!e.isEditing()&&!e.tableOverlay.isBlocking()&&!((n=e.rowDragService)!=null&&n.isDragging())?this.getCornerOf(s):void 0;if(!o){this.handle&&(this.handle.style.display="none");return}const i=this.ensureHandle();i.style.display="block",i.style.left=`${o.x}px`,i.style.top=`${o.y}px`,this.session&&this.renderPreview()}getCornerOf(e){const t=this.tableScope;let s=e.c2;for(;s>e.c1&&t.tableModel.getColumnWidth(s)<=0;)s--;if(t.tableModel.getColumnWidth(s)<=0)return;const o=t.getBodyCellRectInHost(e.r2,s),i=o.left+o.width,r=o.top+o.height;return i>=o.clipLeft&&i<=o.clipRight+.5&&r>=o.clipTop&&r<=o.clipBottom+.5?{x:i,y:r}:void 0}ensureHandle(){if(!this.handle||!this.handle.isConnected){const e=this.tableScope.getDomService();this.handle=e.setAriaHidden(e.createDivWithClass("ge-table-fill-handle",this.tableScope.hostElement)),e.domService.setAttribute(this.handle,"data-ge-action",So)}return this.handle}removeHandle(){var e;(e=this.handle)==null||e.remove(),this.handle=void 0}updateHostShortcuts(e){const s=typeof navigator<"u"&&navigator.platform.indexOf("Mac")>-1?"Meta":"Control",o=[];e.direction!=="horizontal"&&o.push(`${s}+D`),e.direction!=="vertical"&&o.push(`${s}+R`),this.tableScope.setHostKeyShortcuts(o.join(" ")),this.shortcutsSet=!0}isHandle(e){return e instanceof Element&&!!e.closest(`[data-ge-action="${So}"]`)&&this.tableScope.hostElement.contains(e)}onPointerDown(e){if(this.session||this.pending||e.pointerType==="mouse"&&e.button!==0||!this.isHandle(e.target))return;e.preventDefault();const t=this.tableScope.getFillSourceRange();!t||this.tableScope.isEditing()||(this.pending={pointerId:e.pointerId,startX:e.clientX,startY:e.clientY,source:t},this.listenToDocument())}listenToDocument(){this.sessionAbortController=new AbortController;const e=this.sessionAbortController.signal,t=this.tableScope.hostElement.ownerDocument;t.addEventListener("pointermove",s=>this.onPointerMove(s),{signal:e}),t.addEventListener("pointerup",s=>this.onPointerUp(s),{signal:e}),t.addEventListener("pointercancel",s=>{this.pending&&s.pointerId===this.pending.pointerId&&this.cancel()},{signal:e}),t.addEventListener("keydown",s=>{s.key==="Escape"&&(this.session||this.pending)&&(s.preventDefault(),s.stopPropagation(),this.cancel())},{capture:!0,signal:e}),this.tableScope.scrollViewport.addEventListener("scroll",()=>{var s;(s=this.session)!=null&&s.lastEvent&&!this.autoScrollFrame&&this.updateTarget(this.session.lastEvent)},{signal:e})}onPointerMove(e){if(!(!this.pending||e.pointerId!==this.pending.pointerId)){if(!this.session){const t=this.tableScope.getFillHandleOptions();if(!t){this.stopListening();return}if(Math.hypot(e.clientX-this.pending.startX,e.clientY-this.pending.startY)<t.dragThresholdInPx)return;this.session={source:this.pending.source,options:t,count:0,speedX:0,speedY:0,remainderX:0,remainderY:0};const s=this.tableScope.getDomService();this.preview=s.setAriaHidden(s.createDivWithClass("ge-table-fill-preview",this.tableScope.hostElement)),this.tableScope.hostElement.classList.add("ge-table-fill-active")}e.preventDefault(),this.updateTarget(e)}}onPointerUp(e){if(!this.pending||e.pointerId!==this.pending.pointerId)return;const t=this.session;if(!t){this.stopListening(),this.suppressNextClick();return}this.updateTarget(e),this.suppressNextClick();const{source:s,direction:o,count:i}=t;this.stopListening(),o&&i>0&&!this.tableScope.tableOverlay.isBlocking()&&!this.tableScope.isEditing()?this.tableScope.fillRange(s,o,i,e.altKey||e.ctrlKey?"alternate":"auto"):this.tableScope.repaint()}suppressNextClick(){this.suppressClick=!0,setTimeout(()=>this.suppressClick=!1,0)}onClickCapture(e){(this.suppressClick||this.isHandle(e.target))&&(this.suppressClick=!1,e.stopPropagation(),e.preventDefault())}updateTarget(e){const t=this.session;t.lastEvent=e;const s=this.tableScope,o=s.hostElement,i=o.getBoundingClientRect(),r=e.clientX-i.left-o.clientLeft,n=e.clientY-i.top-o.clientTop,[a,c]=s.getBodyCellAtHostPoint(r,n),h=t.source,d=a>h.r2?a-h.r2:a<h.r1?a-h.r1:0,u=c>h.c2?c-h.c2:c<h.c1?c-h.c1:0,f=t.options.direction,g=f==="vertical"||f==="both"&&Math.abs(d)>=Math.abs(u),p=g?d:u;t.direction=p===0?void 0:g?p>0?"down":"up":p>0?"right":"left",t.count=Math.abs(p),this.renderPreview(),this.updateAutoScroll(r,n)}renderPreview(){const e=this.session,t=this.preview;if(!e||!t)return;const s=e.direction?Ys(e.source,e.direction,e.count):e.source,o=this.tableScope,i=o.getBodyCellRectInHost(s.r1,s.c1),r=o.getBodyCellRectInHost(s.r2,s.c2),n=Math.max(i.top,i.clipTop),a=Math.min(r.top+r.height,r.clipBottom),c=Math.max(i.left,i.clipLeft),h=Math.min(r.left+r.width,r.clipRight);Object.assign(t.style,{display:a>n&&h>c?"block":"none",left:`${c}px`,top:`${n}px`,width:`${Math.max(0,h-c)}px`,height:`${Math.max(0,a-n)}px`})}updateAutoScroll(e,t){const s=this.session,{autoScrollZoneInPx:o,autoScrollMaxSpeedInPx:i}=s.options,r=this.tableScope,n=r.tableModel.getPadding(),a=r.hostElement,c=g=>Math.max(1,Math.round(i*Math.min(1,g/o)**2)),h=n.top,d=a.clientHeight-n.bottom,u=n.left,f=a.clientWidth-n.right;s.speedY=o<=0||i<=0?0:t<h+o?-c(h+o-t):t>d-o?c(t-(d-o)):0,s.speedX=o<=0||i<=0?0:e<u+o&&e>=u-o?-c(u+o-e):e>f-o?c(e-(f-o)):0,(s.speedX||s.speedY)&&!this.autoScrollFrame?this.autoScrollFrame=requestAnimationFrame(()=>this.autoScrollStep()):!s.speedX&&!s.speedY&&(s.lastFrameTime=void 0,s.remainderX=0,s.remainderY=0)}autoScrollStep(){this.autoScrollFrame=0;const e=this.session;if(!e||!e.speedX&&!e.speedY)return;const t=this.tableScope.scrollViewport,s=performance.now(),o=e.lastFrameTime?Math.min(4,(s-e.lastFrameTime)/(1e3/60)):1;e.lastFrameTime=s;const i=e.speedY*o*this.tableScope.getScrollerToContentRatioY()+e.remainderY,r=e.speedX*o+e.remainderX,n=Math.trunc(i),a=Math.trunc(r);e.remainderY=i-n,e.remainderX=r-a;const c=t.scrollTop,h=t.scrollLeft;t.scrollTop=c+n,t.scrollLeft=h+a,(t.scrollTop!==c||t.scrollLeft!==h)&&this.tableScope.adjustAfterScrolling(),this.updateTarget(e.lastEvent)}cancel(){const e=!!this.session;this.stopListening(),e&&this.tableScope.repaint()}stopListening(){var e,t;(e=this.sessionAbortController)==null||e.abort(),this.sessionAbortController=void 0,this.pending=void 0,this.session=void 0,this.autoScrollFrame&&(cancelAnimationFrame(this.autoScrollFrame),this.autoScrollFrame=0),(t=this.preview)==null||t.remove(),this.preview=void 0,this.tableScope.hostElement.classList.remove("ge-table-fill-active")}destroy(){this.stopListening(),this.removeHandle()}}class st{constructor(){this.direction="both",this.fillValue=void 0,this.maxCells=1e5,this.dragThresholdInPx=3,this.autoScrollZoneInPx=40,this.autoScrollMaxSpeedInPx=24}static create(e){if(!e)return;const t=new st;if(typeof e=="object")for(const[s,o]of Object.entries(e))o!==void 0&&(t[s]=o);return t}}const me=class me extends Ko{constructor(e,t,s,o,i,r=new Te,n=new hi){var d;super(e,t,new ft(s),o),this.eventListener=i,this.copyService=r,this.excelService=n,this.licenseManager=be.getInstance(),this.listenerAbortController=new AbortController,this.destroyed=!1,this.selectionService=new we(this),this.api=new Go(this),this.initialized=!1,this.mouseStartAction="",this.mouseStartWidth=-1,this.mouseStartColumnIndex=-1,this.dragFrom=-1,this.dragTo=-1,this.lastDragFrom=-1,this.lastDragTo=-1,this.firstDraggingRendering=!0,this.lastTabKeyTime=0,this.lastContextmenu=Date.now(),this.allExpanded=!0,this.selectionEventsHeld=0,t.setTableScope(this),this.liveAnnouncer=new xt(e.ownerDocument,this.ariaIds.liveRegion(),s),i||(this.eventListener=new Ct),this.stateService=new yt(this),this.mouseHandler=new Vo(this),this.inputHandler=new Qo(this),this.resizeHandler=new ci(this,o.resizeEventDebounceDelay),this.shortcutService=new ii(this),this.rowDragService=new ui(this),this.batchEditService=new mi(this),this.fillHandleService=new Ei(this),this.shortcutService.addListener(this.selectionService);const a=this.getSelectionModel?this.getSelectionModel():void 0;a&&a.addEventSelectionChangedListener(this);const c=this.getFocusModel?this.getFocusModel():void 0;c&&c.addEventFocusChangedListener(this);const h=this.listenerAbortController.signal;(d=e.ownerDocument)==null||d.addEventListener("keydown",u=>{u.key==="Tab"&&(this.lastTabKeyTime=Date.now())},{capture:!0,signal:h}),e.addEventListener("focus",()=>this.onHostKeyboardFocus(),{signal:h}),this.scrollViewport.addEventListener("focus",()=>this.hostElement.focus({preventScroll:!0}),{signal:h})}onHostKeyboardFocus(){const e=Date.now()-this.lastTabKeyTime<1e3,t=this.focusModel();if(!e||!t||this.headerFocus||this.isEditing())return;const[s,o]=t.getFocus(),i=this.tableModel.getBodyModel().getRowCount();(s<0||o<0)&&i>0&&this.tableModel.getColumnCount()>0?this.setFocusCell(Math.max(0,this.firstFullVisibleRowIndex),this.getFirstShownColumnIndex()):i<1&&this.getAriaGridInfo().headerRowCount>0&&this.tableModel.getColumnCount()>0&&this.setHeaderFocus(this.getAriaGridInfo().headerRowCount-1,this.getFirstShownColumnIndex())}static create(e,t,s=new Ve,o=new Ct,i=new ri,r=new Te){return new me(e,t,i,s,o,r)}onActionTriggered(e){var s;if(!this.headerFocus&&this.tableOverlay.isBlocking()&&me.actionsBlockedWhileLoading.includes(e))return!0;if(this.headerFocus){const o=this.onHeaderAction(e);if(o!==void 0)return o}if(e==="FILL_DOWN"||e==="FILL_RIGHT")return!this.headerFocus&&this.fillByKeyboard(e==="FILL_DOWN"?"down":"right");if(e==="MOVE_ROW_UP"||e==="MOVE_ROW_DOWN")return!this.headerFocus&&!!((s=this.rowDragService)!=null&&s.moveByKeyboard(e==="MOVE_ROW_UP"?-1:1));if(e==="NAVIGATE_UP"&&this.moveFocusIntoHeader())return!0;const t=this.onBodyNavigation(e);if(t!==void 0)return t;if(e==="NAVIGATE_DOWN"&&this.changeFocusCell(0,1)||e==="NAVIGATE_UP"&&this.changeFocusCell(0,-1)||e==="NAVIGATE_LEFT"&&this.changeFocusCell(-1,0)||e==="NAVIGATE_RIGHT"&&this.changeFocusCell(1,0))return!0;if(e==="START_EDITING"&&this.getFocusModel){const o=this.getFocusModel();if(o){const[i,r]=o.getFocus();this.tableModel.getBodyModel().isEditable(i,r)&&(this.clearSelection(),this.initRenderEditor(i,r))}return!0}if(e==="COPY_2_CLIPBOARD"){const o=this.getSelectionModel?this.getSelectionModel():void 0,i=this.getFocusModel?this.getFocusModel():void 0;this.copyService.createContent(this.tableModel,o,i).then(r=>this.copyService.copyContent(r).then(()=>this.announceCopied(r))).catch(r=>console.warn("GuiExpert Table – copy to clipboard failed:",r))}return!1}getEventListener(){return this.eventListener}afterRowsMoved(){this.lastSortCompareFn=void 0,this.invalidateAggregates()}announce(e,t){e&&!this.isDestroyed()&&this.liveAnnouncer.announce(e,t)}showLoadingOverlay(e){this.tableOverlay.showLoading(e)}showNoRowsOverlay(e){this.tableOverlay.showNoRows(e)}hideOverlay(){this.tableOverlay.hide()}getOverlayState(){return this.tableOverlay.getState()}onOverlayChanged(e){this.isDestroyed()||(e.kind==="loading"?(this.setHostAriaAttribute("aria-busy","true"),this.tableOverlay.isBlocking()&&(this.hideHoverRow(),this.hideHoverColumn())):e.previous==="loading"&&(this.restoreHostAriaAttribute("aria-busy"),this.liveAnnouncer.cancel(this.lastLoadingAnnouncement)),e.kind==="loading"&&(this.lastLoadingAnnouncement=e.text),(e.kind==="loading"||e.kind==="noRows"&&this.initialized)&&this.announce(e.text))}announceCopied(e){this.announce(this.ariaTexts.copied(this.countCopiedCells()))}countCopiedCells(){const e=this.selectionModel();if(!(e!=null&&e.hasSelection()))return 1;const t=this.tableModel.getBodyModel().getRowCount(),s=this.tableModel.getColumnCount(),o=u=>{var f,g;return((g=(f=this.tableModel.getColumnDef(u))==null?void 0:f.isVisible)==null?void 0:g.call(f))!==!1};let i=0;for(let u=0;u<s;u++)o(u)&&i++;if(e.isAllSelected())return t*i;const r=e.getRanges();if(!r.length)return 1;const n=Math.max(0,Math.min(...r.map(u=>u.r1))),a=Math.min(t-1,Math.max(...r.map(u=>u.r2))),c=Math.max(0,Math.min(...r.map(u=>u.c1))),h=Math.min(s-1,Math.max(...r.map(u=>u.c2)));if((a-n+1)*(h-c+1)>Te.maxCopyCells)return 0;let d=0;for(let u=n;u<=a;u++)for(let f=c;f<=h;f++)o(f)&&e.isSelected(u,f)&&d++;return d}getHeaderFocus(){return this.headerFocus?[this.headerFocus[0],this.headerFocus[1]]:void 0}setFocusCell(e,t){const s=this.focusModel();return s?(this.headerFocus=void 0,s.setFocus(e,t),this.ensureColumnIsVisible(t),this.ensureRowIsVisible(e),this.repaint(),!0):!1}getFirstShownColumnIndex(){return this.getNextShownColumnIndex(-1,1,this.tableModel.getColumnCount())}getLastShownColumnIndex(){const e=this.tableModel.getColumnCount();return this.getNextShownColumnIndex(e,-1,e)}onBodyNavigation(e){const t=this.focusModel();if(!["NAVIGATE_ROW_START","NAVIGATE_ROW_END","NAVIGATE_FIRST_CELL","NAVIGATE_LAST_CELL","NAVIGATE_PAGE_UP","NAVIGATE_PAGE_DOWN","ACTIVATE_CELL"].includes(e))return;if(!t||this.isEditing())return!1;const o=this.tableModel.getBodyModel().getRowCount();if(o<1||this.tableModel.getColumnCount()<1)return!1;const[i,r]=t.getFocus(),n=Math.min(Math.max(i,0),o-1),a=r<0?this.getFirstShownColumnIndex():r,c=Math.max(1,this.displayedRowCount-1);switch(e){case"NAVIGATE_ROW_START":return this.setFocusCell(n,this.getFirstShownColumnIndex());case"NAVIGATE_ROW_END":return this.setFocusCell(n,this.getLastShownColumnIndex());case"NAVIGATE_FIRST_CELL":return this.setFocusCell(0,this.getFirstShownColumnIndex());case"NAVIGATE_LAST_CELL":return this.setFocusCell(o-1,this.getLastShownColumnIndex());case"NAVIGATE_PAGE_UP":return this.setFocusCell(Math.max(0,n-c),a);case"NAVIGATE_PAGE_DOWN":return this.setFocusCell(Math.min(o-1,n+c),a);default:return i<0||r<0?!1:this.activateBodyCell(i,r)}}activateBodyCell(e,t){const s=this.tableModel.getBodyModel();if(s.isRowCheckable(e)&&(this.tableOptions.showCheckboxWihoutExtraColumn&&t===this.getFirstDataColumnIndex()||Ds(s.getCellRenderer(e,t))))return this.toggleRowCheckbox(e,t,"body"),!0;const i=s.getRowByIndex(e);if(F(i)&&_(s)&&s.hasDisplayedChildren(i)){const r=i;return this.setTreeRowExpanded(r,!r.expanded)}return!1}moveFocusIntoHeader(){const e=this.focusModel();if(!e||this.isEditing()||this.headerFocus)return!1;const[t,s]=e.getFocus(),o=this.getAriaGridInfo().headerRowCount,i=this.tableModel.getBodyModel().getRowCount()<1;return t!==0&&!i||o<1||this.tableModel.getColumnCount()<1?!1:(this.setHeaderFocus(o-1,s<0?this.getFirstShownColumnIndex():s),!0)}setHeaderFocus(e,t){var o;const s=(o=this.colAndRowspanModels.header)==null?void 0:o.getRanges().find(i=>i.isInRange(e,t));this.headerFocus=s?[s.r1,s.c1]:[e,t],this.ensureColumnIsVisible(this.headerFocus[1]),this.repaint()}onHeaderAction(e){const[t,s]=this.headerFocus,o=this.tableModel.getAreaModel("header"),i=this.getAriaGridInfo().headerRowCount,r=this.tableModel.getColumnCount(),n=Math.max(1,o.getColspanAt(t,s)||1),a=Math.max(1,o.getRowspanAt(t,s)||1);switch(e){case"NAVIGATE_LEFT":{const c=this.getNextShownColumnIndex(s,-1,r);return c!==s&&this.setHeaderFocus(t,c),!0}case"NAVIGATE_RIGHT":{const c=this.getNextShownColumnIndex(s+n-1,1,r);return c>s+n-1&&this.setHeaderFocus(t,c),!0}case"NAVIGATE_ROW_START":return this.setHeaderFocus(t,this.getFirstShownColumnIndex()),!0;case"NAVIGATE_ROW_END":return this.setHeaderFocus(t,this.getLastShownColumnIndex()),!0;case"NAVIGATE_UP":return t>0&&this.setHeaderFocus(t-1,s),!0;case"NAVIGATE_DOWN":return t+a<i?(this.setHeaderFocus(t+a,s),!0):this.tableModel.getBodyModel().getRowCount()<1?!0:this.setFocusCell(Math.max(0,this.firstFullVisibleRowIndex),s);case"NAVIGATE_FIRST_CELL":case"NAVIGATE_LAST_CELL":case"NAVIGATE_PAGE_UP":case"NAVIGATE_PAGE_DOWN":this.headerFocus=void 0;return;case"ACTIVATE_CELL":return this.activateHeaderCell(t,s,a,i);case"START_EDITING":case"TOGGLE_SELECTION":return!0;default:return}}activateHeaderCell(e,t,s,o){var a;const i=this.tableModel.getAreaModel("header"),r=i.getValueAt(e,t);if(r&&typeof r=="object"&&r.toggle&&r.visibility!=="always"&&"toggleHeaderGroup"in i){const c=new gt(null,this);return c.rowIdx=e,c.colIdx=t,c.areaIdent="header",c.areaModel=i,this.toggleHeaderGroup(c),this.setHeaderFocus(e,t),!0}const n=this.tableModel.getColumnDef(t);return e+s>=o&&((a=n==null?void 0:n.sortable)!=null&&a.call(n))?(this.sortByColumn(t),!0):!1}cancelEditing(e){if(e instanceof HTMLSelectElement){const t=Array.from(e.options).find(s=>s.defaultSelected);e.selectedIndex=t?t.index:-1}else e&&(e.value=e.defaultValue);this.resetEditorRenderer(),this.hostElement.focus(),this.repaint()}updateModelValueAfterEdit(e,t,s,o){var n;if(e!=="body")return;const i=()=>{this.resetEditorRenderer()};if((n=this.batchEditService)!=null&&n.isActive()){i(),this.markPending([{rowIndex:t,column:s,value:o}],!1),this.repaint(),this.hostElement.focus();return}const r=this.writeCellsInternal([{rowIndex:t,columnIndex:s,value:o}],"edit",{beforeRepaint:i});(r.changes.length||r.invalid)&&(r.changes.length||(i(),this.repaint()),this.hostElement.focus())}applyCellChanges(e,t="api"){var o;const s=this.resolveCellChanges(e);if(!s.length)return[];if((o=this.batchEditService)!=null&&o.isActive()){const i=this.markPending(s.map(r=>({rowIndex:r.rowIndex,column:r.columnIndex,value:r.value})),!0);return this.repaint(),i}return this.writeCellsInternal(s,t,{}).changes}writeCells(e,t,s={}){return this.writeCellsInternal(e,t,s).changes}writeCellsInternal(e,t,s){var g,p,m,b,y,w,S;const o=this.tableModel.getBodyModel(),i=o.getRowCount(),r=z(o)?o.getBuildCount():0,n=[];let a=0,c="";const h=()=>{for(const{rowIndex:C,columnIndex:A,value:I}of e){if(!s.skipValidation){const E=this.validateCellValue(C,A,this.pipeCellValue(C,A,I));if(E){a++,c=c||E;continue}}const M=o.getValueAt(C,A);o.setValue(C,A,I)&&n.push({row:this.rowObjectOf(C),rowIndex:C,columnIndex:A,property:this.batchEditService.propertyOf(A),oldValue:M,newValue:o.getValueAt(C,A)})}};z(o)?o.batch(h):h(),a&&this.announce(this.getEditTexts().invalidValue(c));const d=(g=s.extraChanges)!=null&&g.length?[...n,...s.extraChanges]:n;if(!d.length)return{changes:d,invalid:a};(p=s.beforeRepaint)==null||p.call(s);const u=(m=s.extraChanges)!=null&&m.length?void 0:{area:"body",rowIndices:n.map(C=>C.rowIndex)};if(this.invalidateAggregates(u),z(o)&&o.getBuildCount()!==r||o.getRowCount()!==i||t==="commit"?this.repaintHard():this.repaint(),this.invalidateAggregates(u),t==="edit"&&d.length===1){const C=Pe.createSingle(d[0].rowIndex,d[0].columnIndex);C.changes=d,C.source=t,(y=(b=this.eventListener).onModelChanged)==null||y.call(b,C)}else(S=(w=this.eventListener).onModelChanged)==null||S.call(w,Pe.createForChanges(d,t));return{changes:d,invalid:a}}markPending(e,t){const o=(t?e.map(i=>({rowIndex:i.rowIndex,columnIndex:i.column,value:i.value})):this.resolveCellChanges(e,!1)).map(({rowIndex:i,columnIndex:r,value:n})=>{const a=this.pipeCellValue(i,r,n),c=this.validateCellValue(i,r,a);return{rowIndex:i,columnIndex:r,value:a,rawValue:n,...c?{error:c}:{}}});return this.batchEditService.addPending(o)}resolveCellChanges(e,t=!0){var a,c;const s=this.tableModel.getBodyModel(),o=s.getRowCount(),i=this.tableModel.getColumnCount(),r=((c=(a=this.tableModel).getColumnDefs)==null?void 0:c.call(a))??[],n=[];for(const h of e){const d=typeof h.column=="number"?h.column:r.findIndex(f=>f.property===h.column),u=h.rowIndex;u>=0&&u<o&&d>=0&&d<i&&(t&&!s.isEditable(u,d)||n.push({rowIndex:u,columnIndex:d,value:h.value}))}return n}pipeCellValue(e,t,s){var i;const o=(i=this.tableModel.getColumnDef(t))==null?void 0:i.editInputPipe;return o?o(s,e,t):s}validateCellValue(e,t,s){var r;const o=(r=this.tableModel.getColumnDef(t))==null?void 0:r.validate;if(!o)return;const i=o(s,this.rowObjectOf(e));return i?String(i):void 0}rowObjectOf(e){const t=this.tableModel.getBodyModel().getRowByIndex(e);return F(t)?t.data:t}getFillHandleOptions(){return st.create(this.tableOptions.fillHandle)}fillRange(e,t,s,o="auto",i){const r=this.getFillHandleOptions()??st.create(!0),n=this.tableModel.getBodyModel(),a=n.getRowCount(),c=this.tableModel.getColumnCount(),h=this.normalizeRange(e,a,c);if(!h||s<1)return 0;const d=t==="down"?a-1-h.r2:t==="up"?h.r1:t==="right"?c-1-h.c2:h.c1,u=Math.min(s,d);if(u<1)return 0;const f=t==="down"||t==="up"?h.c2-h.c1+1:h.r2-h.r1+1;if(u*f>r.maxCells)return this.announce(this.getEditTexts().fillTooLarge(r.maxCells)),-1;const g=this.batchEditService,p=Mi({source:h,direction:t,count:u,mode:o,getValue:(y,w)=>g.getShownValue(y,w),isFillable:(y,w)=>this.tableModel.getColumnWidth(w)>0&&n.isEditable(y,w),fillValue:r.fillValue,getCellInfo:(y,w)=>{var S;return{row:this.rowObjectOf(y),property:((S=this.tableModel.getColumnDef(w))==null?void 0:S.property)??""}}}),m=this.applyCellChanges(p,"fill"),b=this.selectionModel();return b&&this.holdSelectionEvents(()=>{b.clear(),b.addSelection(i??Ys(h,t,u)),this.onSelectionChanged(b)}),this.repaint(),this.announce(this.getEditTexts().cellsFilled(m.length)),m.length}getFillSourceRange(){const e=this.selectionModel();if(!e||e.selectionType!=="range"||e.isAllSelected())return;const t=e.getRanges();if(t.length)return this.normalizeRange(t[t.length-1],this.tableModel.getBodyModel().getRowCount(),this.tableModel.getColumnCount())}normalizeRange(e,t,s){const o=Math.max(0,Math.min(e.r1,e.r2)),i=Math.min(t-1,Math.max(e.r1,e.r2)),r=Math.max(0,Math.min(e.c1,e.c2)),n=Math.min(s-1,Math.max(e.c1,e.c2));return o<=i&&r<=n?new R(o,r,i,n):void 0}fillByKeyboard(e){var r;const t=this.getFillHandleOptions(),s=e==="down";if(!t||this.isEditing()||(r=this.fillHandleService)!=null&&r.isFilling()||t.direction===(s?"horizontal":"vertical"))return!1;const o=this.getFillSourceRange();if(!o)return!1;const i=s?o.r2-o.r1:o.c2-o.c1;if(i>0){const n=s?new R(o.r1,o.c1,o.r1,o.c2):new R(o.r1,o.c1,o.r2,o.c1);this.fillRange(n,e,i,"copy")}else if(s?o.r1>0:o.c1>0){const n=s?new R(o.r1-1,o.c1,o.r1-1,o.c2):new R(o.r1,o.c1-1,o.r2,o.c1-1);this.fillRange(n,e,1,"copy",o)}return!0}setHostKeyShortcuts(e){e===void 0?this.restoreHostAriaAttribute("aria-keyshortcuts"):this.setHostAriaAttribute("aria-keyshortcuts",e)}getEditTexts(){const e=this.ariaTexts,t=new ve;return{cellsFilled:s=>(e.cellsFilled??t.cellsFilled).call(e,s),fillTooLarge:s=>(e.fillTooLarge??t.fillTooLarge).call(e,s),pendingChanges:s=>(e.pendingChanges??t.pendingChanges).call(e,s),changesCommitted:s=>(e.changesCommitted??t.changesCommitted).call(e,s),changesDiscarded:()=>(e.changesDiscarded??t.changesDiscarded).call(e),commitBlocked:s=>(e.commitBlocked??t.commitBlocked).call(e,s),invalidValue:s=>(e.invalidValue??t.invalidValue).call(e,s)}}getApi(){return this.api}firstInit(){var t;const e=this.getAvailableColumnWidth();return e>0&&this.tableModel.setParentWidth(e),this.stateService.initBeforeModel(),this.tableModel.init(),this.stateService.initAfterModel(),(t=this.tableOptions)!=null&&t.externalFilterFunction&&this.externalFilterChanged(!1),this.stateService.initAfterFilter(),this.resetSizeOfWrapperDiv(),this.adjustContainersAndRows(),this.stateService.initAfterLayout(),this.liveAnnouncer.getElement(),this.initialized=!0,this}destroy(){var s,o;if(this.destroyed)return;try{this.stateService.destroy()}catch(i){console.error(i)}try{(s=this.rowDragService)==null||s.destroy()}catch(i){console.error(i)}(o=this.fillHandleService)==null||o.destroy(),this.destroyed=!0,this.listenerAbortController.abort(),this.resizeHandler.disconnect();const e=this.getSelectionModel?this.getSelectionModel():void 0;e==null||e.removeEventSelectionChangedListener(this);const t=this.getFocusModel?this.getFocusModel():void 0;t==null||t.removeEventFocusChangedListener(this),this.disposeRendering(),this.tableOverlay.destroy(),this.liveAnnouncer.destroy(),this.removeHostAria(),this.hostElement.innerText=""}isDestroyed(){return this.destroyed}createGeMouseEvent(e){const t=new Nt;if(t.originalEvent=e,e){const s=this.getMouseEventTarget(e);if([t.areaIdent,t.sideIdent]=this.getAreaAndSideIdentByAttr(s),t.rowIndex=this.getNumberByAttr(s,"data-row-index"),t.columnIndex=this.getNumberByAttr(s,"data-col-index"),t.action=this.getStringByAttr(s,"data-ge-action"),t.areaIdent){const o=this.tableModel.getAreaModel(t.areaIdent);t.rowTop=o.getYPosByRowIndex(t.rowIndex)}t.columnLeft=this.tableModel.getXPosByColumnIndex(t.columnIndex)}return t}getMouseEventTarget(e){const t=e.target;if((t===this.scrollViewport||t===this.contentWrapperDiv||t===this.contentDiv)&&this.tableModel.getPadding().bottom>0){const s=this.scrollViewport.getBoundingClientRect(),o=e.clientY-s.top>=this.scrollViewport.clientHeight||e.clientX-s.left>=this.scrollViewport.clientWidth,i=this.hostElement.getRootNode();if(!o&&i.elementsFromPoint){const r=i.elementsFromPoint(e.clientX,e.clientY).find(n=>this.hostElement.contains(n)&&n.closest(".ge-table-footer"));if(r)return r}}return t}onMouseDown(e){this.selectionService.onMouseDown(),e.columnIndex>-1&&e.action&&["resize-column","drag-column"].includes(e.action)&&!L(this.tableModel.getColumnDef(e.columnIndex))&&(this.mouseStartWidth=this.tableModel.getColumnWidth(e.columnIndex),this.mouseStartAction=e.action,this.mouseStartColumnIndex=e.columnIndex,this.mouseStartAction==="drag-column"&&(this.firstDraggingRendering=!0,this.dragFrom=this.mouseStartColumnIndex))}mouseDraggingOnFrame(e,t){var s,o;(o=(s=this.eventListener).onMouseDragging)==null||o.call(s,e),this.mouseEvent=e,this.mouseStartColumnIndex>-1&&this.mouseStartAction==="resize-column"&&this.tableOptions.columnsResizable?this.resizeColumn(e):!this.mouseStartAction&&this.selectionService.onMouseDragging(e,t)?this.repaint():this.mouseStartAction==="drag-column"&&e.columnIndex>-1&&this.tableOptions.columnsDraggable&&(this.draggingTargetColumnIndex=Math.max(e.columnIndex,this.getFirstDataColumnIndex()),this.dragTo=this.draggingTargetColumnIndex,this.dragFrom>-1&&this.dragTo>-1&&this.dragFrom!==this.dragTo&&(this.lastDragFrom===this.dragTo&&this.lastDragTo===this.dragFrom||(this.tableModel.changeColumnOrder(this.dragFrom,this.dragTo),this.lastDragFrom=this.dragFrom,this.lastDragTo=this.dragTo,this.dragFrom=this.dragTo,this.resetSizeOfWrapperDiv(),this.adjustContainersAndRows())),t&&(this.adjustDraggingColumn(e,this.dragFrom,this.firstDraggingRendering),this.firstDraggingRendering=!1),this.repaint())}mouseDraggingEndOnFrame(e){var t,s;(s=(t=this.eventListener).onMouseDraggingEnd)==null||s.call(t,e),this.draggingTargetColumnIndex=-1,this.mouseStartAction==="resize-column"?(this.resizeColumn(e),this.stateService.markDirty("columns")):this.mouseStartAction==="drag-column"&&(this.hideDraggingColumn(),this.repaint(),this.stateService.markDirty("columns"),this.stateService.markDirty("selection")),this.mouseStartWidth=-1,this.mouseStartColumnIndex=-1,this.dragFrom=-1,this.dragTo=-1,this.firstDraggingRendering=!0,this.mouseStartAction=""}mouseMove(e){var t,s;(s=(t=this.eventListener).onMouseMoved)==null||s.call(t,e),this.adjustHoverRows(e),this.adjustHoverColumns(e)}contextmenu(e){var s,o,i,r;const t=Date.now();if(t-this.lastContextmenu<50){this.lastContextmenu=t,(s=e.originalEvent)==null||s.preventDefault(),(o=e.originalEvent)==null||o.stopImmediatePropagation();return}this.lastContextmenu=t,(r=(i=this.eventListener).onContextmenu)==null||r.call(i,e)}toggleExpandCollapseAll(e=!0){const t=this.tableModel.getBodyModel();_(t)&&(t.toggleExpandCollapseAll(e),this.allExpanded=e,this.repaintHard(),this.stateService.markDirty("tree"))}setTreeRowExpanded(e,t){const s=this.tableModel.getBodyModel();return!_(s)||e.expanded===t?!1:(e.expanded=t,s.recalcVisibleTreeRows(!1),this.repaintHard(),this.stateService.markDirty("tree"),!0)}setRowGroupBy(e){const t=this.tableModel.getBodyModel();return z(t)?(t.setGroupBy(e),gs(this.tableModel),this.invalidateAggregates(),this.tableModel.recalcPadding(),this.repaintHard(),this.stateService.markDirty("tree"),this.stateService.markDirty("columns"),!0):!1}setPivotConfig(e,t){var o,i;const s=this.tableModel;if(!ks(s))return!1;s.setPivotConfig(e,t),(s.getColumnDefs()??[]).forEach(r=>r.sortState=void 0),this.lastSortCompareFn=void 0,this.clearSelection(),(o=this.getFocusModel?this.getFocusModel():void 0)==null||o.clear();for(const r of["header","body","footer"])(i=this.colAndRowspanModels[r])==null||i.init();return this.invalidateAggregates(),this.firstInit(),this.repaintHard(),this.stateService.markDirty("columns"),this.stateService.markDirty("sort"),this.stateService.markDirty("tree"),this.stateService.markDirty("headerGroups"),!0}toggleRowCheckbox(e,t,s){var a,c,h;const o=this.tableModel.getAreaModel(s),i=o.isRowChecked(e),r=i===void 0||i==="semi"||i==="none";o.setRowChecked(e,r),this.repaint();const n=(a=o.rowSelectionModel)==null?void 0:a.getCheckedRows();(h=(c=this.eventListener).onCheckboxChanged)==null||h.call(c,n?n.slice():[]),this.stateService.markDirty("checked")}onMouseClicked(e,t){if(this.headerFocus=void 0,e.clickCount>1)return!1;let s=this.selectionService.onMouseClicked(e,t);if(!s&&this.getFocusModel){this.resetEditorRenderer();const o=this.getFocusModel();o&&(s=o.hasChanged(),o.clearChanged())}return s}debounceRepaint(){this.debounce(this.repaint.bind(this),1)}cancelPendingRepaint(){return this.debounceTimeout?(clearTimeout(this.debounceTimeout),this.debounceTimeout=null,!0):!1}publishGeMouseEvent(e){var t,s;(s=(t=this.eventListener).onMouseClicked)==null||s.call(t,e)}onFocusChanged(e){var t,s;(s=(t=this.eventListener).onFocusChanged)==null||s.call(t,e)}stateChanged(e){var t,s;(s=(t=this.eventListener).onStateChanged)==null||s.call(t,e)}afterRenderPass(){var e,t;(e=this.stateService)==null||e.rendered(),(t=this.fillHandleService)==null||t.update()}onSelectionChanged(e){var t,s,o;if((t=this.stateService)==null||t.markDirty("selection"),this.selectionEventsHeld>0){this.heldSelectionModel=e;return}(o=(s=this.eventListener).onSelectionChanged)==null||o.call(s,e)}holdSelectionEvents(e){var t,s;this.selectionEventsHeld++;try{e()}finally{if(this.selectionEventsHeld--,this.selectionEventsHeld===0&&this.heldSelectionModel){const o=this.heldSelectionModel;this.heldSelectionModel=void 0,(s=(t=this.eventListener).onSelectionChanged)==null||s.call(t,o)}}}externalFilterChanged(e=!0){const t=this.tableOptions.externalFilterFunction;if(t&&(e&&this.clearSelectionModel(),this.tableModel.externalFilterChanged(t),this.reapplySorting(),this.invalidateAggregates(),this.scrollViewport.scrollTo(0,0),this.tableModel.recalcHeightAndPadding(),this.resetSizeOfWrapperDiv(),this.repaint(),this.initialized)){const s=this.tableModel.getBodyModel().getRowCount();this.announce(this.ariaTexts.filtered(s),me.filterAnnouncementDelayInMs)}}onHeaderDblClicked(e,t,s){const o=this.tableModel.getColumnDef(s);o!=null&&o.sortable&&o.sortable()&&(e.preventDefault(),e.stopPropagation(),this.sortByColumn(s))}sortByColumn(e,t){var h;const s=typeof e=="number"?e:(this.tableModel.getColumnDefs()??[]).findIndex(d=>d.property===e),o=this.tableModel.getColumnDef(s);if(!o)return!1;const i=o.sortStatesOrder?o.sortStatesOrder:this.tableOptions.sortOrder,r=o.sortState??"",n=t??i[(i.indexOf(r)+1)%i.length],a=new bt(s,n),c=this.tableModel.doSort([a]);return c&&(this.invalidateAggregates(),this.lastSortCompareFn=void 0,(h=this.tableModel.getColumnDefs())==null||h.forEach(d=>d.sortState=""),o.sortState=n),this.repaint(),c&&this.stateService.sortedByColumn(n?o.property:void 0),c&&this.announce(this.ariaTexts.sorted(this.getColumnAriaLabel(s),n)),!0}scrollToPixel(e,t){const s=this.getContentScrollRangeY(),o=this.getScrollerRangeY();if(s>0&&o>0){const i=Math.min(s,Math.max(0,t)),r=i/s*o;this.scrollViewport.scrollTo(e,r),this.pendingContentScroll={scrollTop:this.scrollViewport.scrollTop,contentTop:i},this.adjustAfterScrolling();return}this.scrollViewport.scrollTo(e,t)}scrollToIndex(e,t){const o=this.tableModel.getAreaModel("body").getYPosByRowIndex(t);this.scrollToPixel(this.getScrollLeftForColumnIndex(e),o)}getScrollLeftForColumnIndex(e){const t=this.scrollViewport,s=this.tableModel.getFixedLeftColumnCount(),o=this.tableModel.getColumnCount()-this.tableModel.getFixedRightColumnCount()-1;if(e>=0&&e<s)return 0;if(!(e>=s&&e<=o))return t.scrollLeft;let i=0;for(let a=s;a<e;a++)i+=this.tableModel.getColumnWidth(a);const r=this.tableModel.getContentWidthInPixel()-this.areaBodyCenterGeo.width,n=t.scrollWidth-t.clientWidth;return r<=0||n<=0?0:Math.min(1,i/r)*n}adjustAfterScrolling(){var t,s;super.adjustAfterScrolling();const e=this.scrollViewport;(s=(t=this.eventListener).onScroll)==null||s.call(t,new ei(this.scrollTop,this.scrollLeft,e.scrollHeight,e.scrollWidth,e.clientHeight,e.clientWidth,this.scrollFactorY,this.scrollFactorX))}setSelectionModel(e,t=!1){var o;(o=this.selectionModel())==null||o.removeEventSelectionChangedListener(this),e.addEventSelectionChangedListener(this);const s=()=>e;this.tableOptions.getSelectionModel=s,this.getSelectionModel=s,this.selectionService.getSelectionModel=s,t&&this.repaint()}toggleHeaderGroup(e){const t=this.tableModel.getAreaModel("header");"columnDefs"in this.tableModel&&(this.tableModel.columnDefs=t.toggleHeaderGroup(e)),this.headerGroupsChanged()}setHeaderGroupCollapsed(e,t){var i;const s=this.tableModel.getAreaModel("header"),o=(i=s.setGroupClosed)==null?void 0:i.call(s,e,t);return o?("columnDefs"in this.tableModel&&(this.tableModel.columnDefs=o),this.headerGroupsChanged(),!0):!1}headerGroupsChanged(){this.firstInit(),this.stateService.markDirty("headerGroups"),this.stateService.markDirty("columns")}selectionModel(){if(this!=null&&this.getSelectionModel)return this.getSelectionModel()}focusModel(){if(this!=null&&this.getFocusModel)return this.getFocusModel()}setDragging(e){this.dragging=e,this.dragging?(this.storeColumnWidths(),this.lastDragFrom=-1,this.lastDragTo=-1):this.storedColumnWidths=[]}changeFocusCell(e,t){if(!this.isEditing()&&this.getFocusModel){const s=this.getFocusModel();if(s){const o=this.tableModel.getBodyModel().getRowCount(),i=this.tableModel.getColumnCount();if(o<1||i<1)return!1;const[r,n]=s.getFocus(),a=Math.min(Math.max(r+t,0),o-1),c=this.getNextShownColumnIndex(n,e,i);return(a!==r||c!==n)&&(s.setFocus(a,c),this.ensureColumnIsVisible(c),this.ensureRowIsVisible(a),this.repaint()),!0}}return!1}getNextShownColumnIndex(e,t,s){if(!t){const n=Math.min(Math.max(e,0),s-1);return e<0&&this.tableModel.getColumnWidth(n)<=0?this.getNextShownColumnIndex(-1,1,s):n}const o=t>0?1:-1;let i=e,r=e;for(let n=Math.abs(t);n>0;n--){for(r+=o;r>=0&&r<s&&this.tableModel.getColumnWidth(r)<=0;)r+=o;if(r<0||r>=s)break;i=r}return Math.min(Math.max(i,0),s-1)}resizeColumn(e){this.tableModel.setColumnWidth(this.mouseStartColumnIndex,this.mouseStartWidth+e.draggingX),this.tableModel.recalcPadding(),this.resetSizeOfWrapperDiv(),this.adjustContainersAndRows()}clearSelectionModel(){var e;this.getSelectionModel&&((e=this.getSelectionModel())==null||e.clear())}calcAutoColumnWidths(){const e=this.tableModel.getBodyModel(),t=this.tableModel.getColumnCount();if(!e)return console.warn("Body model is not available."),[];const s=30,o=Array.from({length:t},()=>new Set),i=new Array(t).fill(0),r=u=>{var p,m;const f=this.tableModel.getAreaModel(u),g=(f==null?void 0:f.getRowCount())??0;for(let b=0;b<g;b++)for(let y=0;y<t;y++){const w=((p=f.getTextValueAt)==null?void 0:p.call(f,b,y))||(((m=f.getValueAt(b,y))==null?void 0:m.toString())??""),S=w.length;S>i[y]&&(i[y]=S,o[y].forEach(C=>{C.length<S-2&&o[y].delete(C)})),S>=i[y]-2&&o[y].size<s&&o[y].add(w)}};r("header"),r("body"),r("footer");const n=this.hostElement.querySelector(".ge-table-label"),a=getComputedStyle(n??this.hostElement),c=n?(parseFloat(a.paddingLeft)||0)+(parseFloat(a.paddingRight)||0):20;let h=null;try{h=document.createElement("canvas").getContext("2d")}catch{h=null}h&&(h.font=a.font||`${a.fontSize} ${a.fontFamily}`);const d=u=>h?h.measureText(u).width:u.length*8;return o.map(u=>{let f=0;return u.forEach(g=>{f=Math.max(f,d(g))}),Math.max(Math.ceil(f+c+2),50)})}setColumnWidth(e,t){this.tableModel.setColumnWidth(e,t),this.stateService.markDirty("columns")}setColumnVisible(e,t){var s,o;return(o=(s=this.tableModel).setColumnVisible)!=null&&o.call(s,e,t)?(this.recalcWrappers(),this.stateService.markDirty("columns"),!0):!1}setHeaderVisible(e){this.setAreaVisible("header",e)}setFooterVisible(e){this.setAreaVisible("footer",e)}setAreaVisible(e,t){const s=this.tableModel,o=e==="header"?s.setHeaderVisible:s.setFooterVisible;if(!o){console.warn(`set${e==="header"?"Header":"Footer"}Visible() needs a table model with this method (e.g. TableModel), this one has none:`,s);return}o.call(s,t),e==="header"&&!t&&(this.headerFocus=void 0),this.recalcWrappers()}autoResizeColumns(e=!0){const t=this.calcAutoColumnWidths();for(let s=0;s<t.length;s++){if(L(this.tableModel.getColumnDef(s)))continue;const o=t[s];this.tableModel.setColumnWidth(s,o)}e&&this.recalcWrappers(),this.stateService.markDirty("columns")}recalcWrappers(){this.tableModel.recalcPadding(),this.resetSizeOfWrapperDiv(),this.adjustContainersAndRows()}reSort(){this.reapplySorting(),this.invalidateAggregates(),this.repaint()}sort(e){var t;this.tableModel.sort(e),this.invalidateAggregates(),this.lastSortCompareFn=e,(t=this.tableModel.getColumnDefs())==null||t.forEach(s=>s.sortState=""),this.repaint(),this.stateService.sortedByColumn(void 0)}applySortItems(e){const t=this.tableModel.getColumnDefs();t==null||t.forEach(s=>s.sortState=""),e.forEach(s=>{const o=t==null?void 0:t[s.columnIndex];o&&(o.sortState=s.sortState)}),e.length&&(this.lastSortCompareFn=void 0,this.tableModel.doSort(e),this.invalidateAggregates())}reapplySorting(){var t;if(this.lastSortCompareFn){this.tableModel.sort(this.lastSortCompareFn);return}const e=[];(t=this.tableModel.getColumnDefs())==null||t.forEach((s,o)=>{s.sortState&&e.push(new bt(o,s.sortState))}),e.length&&this.tableModel.doSort(e)}ensureRowIsVisible(e){const t=this.getFirstFullVisibleRowIndex(),s=this.getLastFullVisibleRowIndex(),o=this.getDisplayedRowCount();return e<t?(this.scrollToIndex(-1,e),!0):e>s?(this.scrollToIndex(-1,e-o+1),!0):!1}ensureColumnIsVisible(e){const t=this.tableModel.getFixedLeftColumnCount(),s=this.tableModel.getColumnCount()-this.tableModel.getFixedRightColumnCount()-1;if(!(e>=t&&e<=s))return!1;const o=this.tableModel.getColumnWidth(e),i=this.scrollViewport,r=this.areaBodyCenterGeo.width,n=this.tableModel.getContentWidthInPixel()-r,a=i.scrollWidth-i.clientWidth;if(o<=0||n<=0||a<=0)return!1;let c=0;for(let f=t;f<e;f++)c+=this.tableModel.getColumnWidth(f);const h=Math.min(1,Math.max(0,i.scrollLeft/a))*n;let d;if(c<h-.5)d=c;else if(c+o>h+r+.5)d=o>r?c:c+o-r;else return!1;const u=Math.min(1,Math.max(0,d/n))*a;return i.scrollLeft=d===c?Math.floor(u):Math.ceil(u),this.adjustAfterScrolling(),!0}};me.actionsBlockedWhileLoading=["START_EDITING","TOGGLE_SELECTION","ACTIVATE_CELL","MOVE_ROW_UP","MOVE_ROW_DOWN","FILL_DOWN","FILL_RIGHT"],me.filterAnnouncementDelayInMs=400;let ms=me;class yn extends Ct{constructor(e){super(),this.onCheckboxChangedCallback=e,super.onCheckboxChanged=t=>{this.onCheckboxChangedCallback(t)}}}const kt=class kt{};kt.themes=["light","combat","paper","blackboard"],kt.vars={light:`html[data-theme="light"] {
|
|
74
|
+
<sheetData>`);for(let r=0;r<e.length;r++){const n=e[r];i.push(`<row r="${r+1}" spans="1:${s}" x14ac:dyDescent="0.2">`);for(let l=0;l<n.length;l++){const c=n[l],h=this.getCellAddress(r,l);if(typeof c=="number")i.push(`<c r="${h}"><v>${c}</v></c>`);else if(xs(c)&&Number.isFinite(c.value))i.push(`<c r="${h}" s="${this.numberFormatStyles.get(c.numberFormat)??0}"><v>${c.value}</v></c>`);else if(c instanceof Date){const d=c;i.push(`<c r="${h}" t="inlineStr"><is><t>${d.toISOString()}</t></is></c>`)}else{const d=c!=null?this.escapeXml(String(c)):"";i.push(`<c r="${h}" t="inlineStr"><is><t>${d}</t></is></c>`)}}i.push("</row>")}return i.push(""),i.push(""),i.push('</sheetData><pageMargins left="0.7" right="0.7" top="0.75" bottom="0.75" header="0.3" footer="0.3"/>'),i.push("</worksheet>"),i.join(`
|
|
75
|
+
`)}withNumberFormats(e,t){const s=[];for(const r of t)for(const n of r)xs(n)&&!s.includes(n.numberFormat)&&s.push(n.numberFormat);if(this.numberFormatStyles=new Map(s.map((r,n)=>[r,n+1])),!s.length)return e;const o=`<numFmts count="${s.length}">`+s.map((r,n)=>`<numFmt numFmtId="${164+n}" formatCode="${this.escapeXml(r)}"/>`).join("")+"</numFmts>",i=`<cellXfs count="${s.length+1}"><xf numFmtId="0" fontId="0" fillId="0" borderId="0" xfId="0"/>`+s.map((r,n)=>`<xf numFmtId="${164+n}" fontId="0" fillId="0" borderId="0" xfId="0" applyNumberFormat="1"/>`).join("")+"</cellXfs>";return e.replace("<fonts ",`${o}<fonts `).replace('<cellXfs count="1"><xf numFmtId="0" fontId="0" fillId="0" borderId="0" xfId="0"/></cellXfs>',i)}escapeXml(e){return e==null?"":String(e).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}getCellAddress(e,t){const s="ABCDEFGHIJKLMNOPQRSTUVWXYZ";let o="";for(;t>=0;)o=s[t%26]+o,t=Math.floor(t/26)-1;return`${o}${e+1}`}createZip(e){const t=[];return e.forEach((s,o)=>{const i=new TextEncoder().encode(s);t.push({path:new TextEncoder().encode(o),data:i,size:i.length,crc:xo(i),method:0})}),this.assembleZip(t)}async createZipCompressed(e){const t=[];for(const[s,o]of Array.from(e.entries())){const i=new TextEncoder().encode(o),r=await Cn(i),n=!!r&&r.length<i.length;t.push({path:new TextEncoder().encode(s),data:n?r:i,size:i.length,crc:xo(i),method:n?8:0})}return this.assembleZip(t)}assembleZip(e){const t=[],s=[];let o=0;for(const h of e){const d=new Uint8Array(30+h.path.length),u=new DataView(d.buffer);d.set([80,75,3,4],0),u.setUint16(4,20,!0),u.setUint16(6,0,!0),u.setUint16(8,h.method,!0),u.setUint16(10,0,!0),u.setUint16(12,33,!0),u.setUint32(14,h.crc,!0),u.setUint32(18,h.data.length,!0),u.setUint32(22,h.size,!0),u.setUint16(26,h.path.length,!0),u.setUint16(28,0,!0),d.set(h.path,30),t.push(d,h.data),s.push(o),o+=d.length+h.data.length}const i=o;e.forEach((h,d)=>{const u=new Uint8Array(46+h.path.length),f=new DataView(u.buffer);u.set([80,75,1,2],0),f.setUint16(4,20,!0),f.setUint16(6,20,!0),f.setUint16(8,0,!0),f.setUint16(10,h.method,!0),f.setUint16(12,0,!0),f.setUint16(14,33,!0),f.setUint32(16,h.crc,!0),f.setUint32(20,h.data.length,!0),f.setUint32(24,h.size,!0),f.setUint16(28,h.path.length,!0),f.setUint16(30,0,!0),f.setUint16(32,0,!0),f.setUint16(34,0,!0),f.setUint16(36,0,!0),f.setUint32(38,0,!0),f.setUint32(42,s[d],!0),u.set(h.path,46),t.push(u),o+=u.length});const r=new Uint8Array(22),n=new DataView(r.buffer);r.set([80,75,5,6],0),n.setUint16(8,e.length,!0),n.setUint16(10,e.length,!0),n.setUint32(12,o-i,!0),n.setUint32(16,i,!0),t.push(r);const l=new Uint8Array(t.reduce((h,d)=>h+d.length,0));let c=0;for(const h of t)l.set(h,c),c+=h.length;return l}}const Vt=class Vt{constructor(e,t,s){this.document=e,this.id=t,this.domService=s}announce(e,t=Vt.defaultDelayInMs){const s=this.getOrCreateElement();s&&(this.timeout&&clearTimeout(this.timeout),s.textContent="",this.pendingText=e,this.timeout=setTimeout(()=>{this.timeout=void 0,this.pendingText=void 0,s.textContent=e},Math.max(0,t)))}cancel(e){this.timeout&&(e===void 0||e===this.pendingText)&&(clearTimeout(this.timeout),this.timeout=void 0,this.pendingText=void 0)}getElement(){return this.getOrCreateElement()}destroy(){var e;this.timeout&&(clearTimeout(this.timeout),this.timeout=void 0),(e=this.element)==null||e.remove(),this.element=void 0}getOrCreateElement(){var i;if(this.element)return this.element;const e=(i=this.document)==null?void 0:i.body;if(!e)return;const t=this.domService,s=t.createElement("div");t.setAttribute(s,"id",this.id),t.setAttribute(s,"role","status"),t.setAttribute(s,"aria-live","polite"),t.setAttribute(s,"aria-atomic","true"),t.addClass(s,"ge-table-sr-only");const o={position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)","white-space":"nowrap",border:"0"};for(const r in o)t.setStyle(s,r,o[r]);return t.appendChild(e,s),this.element=s,s}};Vt.defaultDelayInMs=150;let Mt=Vt;class qt{constructor(){this.managed=!0,this.multiRow=!0,this.treeDropInside=!0,this.dragThresholdInPx=4,this.autoScrollZoneInPx=40,this.autoScrollMaxSpeedInPx=24,this.ghostText=void 0}static create(e){const t=new qt;for(const[s,o]of Object.entries(e??{}))o!==void 0&&(t[s]=o);return t}}class xi{constructor(e,t,s,o,i,r,n,l,c){this.type=e,this.source=t,this.rows=s,this.rowIndices=o,this.target=i,this.toIndex=r,this.outside=n,this.managed=l,this.originalEvent=c,this.moved=!1,this.prevented=!1}get defaultPrevented(){return this.prevented}preventDefault(){this.prevented=!0}}const ns="drag-row";class vi{constructor(e){this.tableScope=e,this.autoScrollFrame=0,this.suppressClick=!1,this.warnedUnsupported=!1;const t=e.listenerAbortController.signal;e.hostElement.addEventListener("pointerdown",s=>{var o;(o=e.isEventInDetail)!=null&&o.call(e,s)||this.onPointerDown(s)},{signal:t}),e.hostElement.addEventListener("click",s=>{var o;(o=e.isEventInDetail)!=null&&o.call(e,s)||this.onClickCapture(s)},{capture:!0,signal:t}),e.hostElement.addEventListener("dblclick",s=>{var o;!((o=e.isEventInDetail)!=null&&o.call(e,s))&&s.target instanceof Element&&s.target.closest(`[data-ge-action="${ns}"]`)&&s.stopPropagation()},{capture:!0,signal:t})}get options(){return qt.create(this.tableScope.tableOptions.rowDragOptions)}isDragging(){return!!this.session}isDragSourceRow(e){return!!this.session&&this.session.rowSet.has(e)}getBlockReason(){var s;if(!this.isManaged())return;if(this.isSorted())return"sorted";const e=this.tableScope.tableModel.getBodyModel(),t=(s=e.getUnfilteredRowCount)==null?void 0:s.call(e);if(t!==void 0&&t>e.getRowCount())return"filtered"}getHandleState(e,t,s){const o=t==null?void 0:t.rowDrag;if(!o||ds(s))return"none";const i=s.getRowByIndex(e);return hs(i)||typeof o=="function"&&!o(i,e)?"none":this.isManaged()&&!this.canModelMove(s)?(this.warnedUnsupported||(this.warnedUnsupported=!0,console.warn("GuiExpert Table: rowDrag is set, but the body model cannot move rows (no moveRows(), or row grouping / pivot). Use rowDragOptions: { managed: false } and move the rows yourself.")),"none"):this.getBlockReason()?"disabled":"enabled"}decorateCell(e,t){if(t==="none")return;const s=this.tableScope.getDomService().domService,o=s.createElement("span");s.addClass(o,"ge-table-row-drag-handle"),t==="disabled"&&s.addClass(o,"ge-table-row-drag-handle-disabled"),s.setAttribute(o,"data-ge-action",ns),s.setAttribute(o,"aria-hidden","true"),s.appendChild(e,o),s.addClass(e,"ge-table-row-drag-cell"),s.setAttribute(e,"aria-keyshortcuts","Control+Alt+ArrowUp Control+Alt+ArrowDown")}onPointerDown(e){var i;if(this.session||this.pending||e.pointerType==="mouse"&&e.button!==0)return;const t=e.target instanceof Element?e.target:null,s=t==null?void 0:t.closest(`[data-ge-action="${ns}"]`);if(!s||!this.tableScope.hostElement.contains(s)||this.tableScope.tableOverlay.isEventBlocked(e)||this.tableScope.isEditing())return;e.preventDefault();const o=Number((i=s.closest("[data-row-index]"))==null?void 0:i.getAttribute("data-row-index"));if(!(!Number.isInteger(o)||o<0)){if(s.classList.contains("ge-table-row-drag-handle-disabled")){this.announceNotPossible();return}this.pending={pointerId:e.pointerId,startX:e.clientX,startY:e.clientY,rowIndex:o},this.listenToDocument()}}listenToDocument(){this.sessionAbortController=new AbortController;const e=this.sessionAbortController.signal,t=this.tableScope.hostElement.ownerDocument;t.addEventListener("pointermove",s=>this.onPointerMove(s),{signal:e}),t.addEventListener("pointerup",s=>this.onPointerUp(s),{signal:e}),t.addEventListener("pointercancel",s=>this.onPointerCancel(s),{signal:e}),t.addEventListener("keydown",s=>this.onKeyDown(s),{capture:!0,signal:e}),this.tableScope.scrollViewport.addEventListener("scroll",()=>{var s;(s=this.session)!=null&&s.lastEvent&&!this.autoScrollFrame&&this.updateTarget(this.session.lastEvent)},{signal:e})}onPointerMove(e){if(!(!this.pending||e.pointerId!==this.pending.pointerId)){if(!this.session){const t=e.clientX-this.pending.startX,s=e.clientY-this.pending.startY;if(Math.hypot(t,s)<this.options.dragThresholdInPx||!this.startPointerDrag(e))return}e.preventDefault(),this.session&&this.updateTarget(e)}}onPointerUp(e){if(!(!this.pending||e.pointerId!==this.pending.pointerId)){if(!this.session){this.stopListening();return}this.updateTarget(e),this.suppressClick=!0,setTimeout(()=>this.suppressClick=!1,0),this.session&&this.drop(e)}}onPointerCancel(e){this.pending&&e.pointerId===this.pending.pointerId&&this.cancel(e)}onKeyDown(e){e.key==="Escape"&&(this.session||this.pending)&&(e.preventDefault(),e.stopPropagation(),this.cancel(e))}onClickCapture(e){this.suppressClick&&(this.suppressClick=!1,e.stopPropagation(),e.preventDefault())}startPointerDrag(e){var r,n;const t=this.pending,s=this.getDragRowIndices(t.rowIndex),o=this.getRows(s),i=this.createEvent("start","pointer",o,s,void 0,!1,e);return(n=(r=this.tableScope.getEventListener()).onRowDragStart)==null||n.call(r,i),i.defaultPrevented||this.pending!==t?(this.stopListening(),!1):(this.session={source:"pointer",rowIndices:s,rows:o,outside:!1,autoScrollSpeed:0,rowSet:new Set(s),options:this.options,scrollRemainder:0},this.createDragElements(o),this.tableScope.repaint(),this.tableScope.announce(this.texts().rowDragStarted(o.length)),!0)}updateTarget(e){var n,l;const t=this.session;t.lastEvent=e;const{target:s,outside:o}=this.computeTarget(e.clientX,e.clientY);let i=s&&this.isValidTarget(t.rowIndices,s)?s:void 0;if(!xn(i,t.target)||o!==t.outside){const c=this.createEvent("move","pointer",t.rows,t.rowIndices,i,o,e);if((l=(n=this.tableScope.getEventListener()).onRowDragMove)==null||l.call(n,c),this.session!==t)return;c.defaultPrevented&&(i=void 0)}t.target=i,t.outside=o,this.renderDragElements(e),t.autoScrollSpeed=o?0:this.calcAutoScrollSpeed(e.clientY),t.autoScrollSpeed&&!this.autoScrollFrame?this.autoScrollFrame=requestAnimationFrame(()=>this.autoScrollStep()):t.autoScrollSpeed||(t.lastFrameTime=void 0,t.scrollRemainder=0)}autoScrollStep(){this.autoScrollFrame=0;const e=this.session;if(!e||!e.autoScrollSpeed)return;const t=this.tableScope.scrollViewport,s=t.scrollTop,o=performance.now(),i=e.lastFrameTime?Math.min(4,(o-e.lastFrameTime)/(1e3/60)):1;e.lastFrameTime=o;const r=e.autoScrollSpeed*i*this.tableScope.getScrollerToContentRatioY()+e.scrollRemainder,n=Math.trunc(r);e.scrollRemainder=r-n,t.scrollTop=s+n,t.scrollTop!==s&&this.tableScope.adjustAfterScrolling(),this.updateTarget(e.lastEvent)}calcAutoScrollSpeed(e){const{autoScrollZoneInPx:t,autoScrollMaxSpeedInPx:s}=this.session.options;if(t<=0||s<=0)return 0;const o=this.tableScope.getBodyViewport(),i=e-o.top,r=o.top+o.height-e,n=l=>Math.max(1,Math.round(s*Math.min(1,l/t)**2));return i<t?-n(t-i):r<t?n(t-r):0}computeTarget(e,t){var p;const s=this.tableScope.hostElement.getBoundingClientRect();if(e<s.left||e>s.right||t<s.top||t>s.bottom)return{outside:!0};const o=this.tableScope.tableModel.getBodyModel(),i=o.getRowCount();if(i<1)return{outside:!1};const r=this.tableScope.getBodyViewport(),l=Math.min(Math.max(t,r.top),r.top+Math.max(0,r.height-1))-r.top+r.contentScrollTop,c=this.tableScope.getBodyRowIndexAtY(l),h=this.tableScope.getBodyRowTop(c),d=Math.max(1,o.getRowHeight(c)),u=Math.min(1,Math.max(0,(l-h)/d));let f;const g=B(o);if(g&&(((p=this.session)==null?void 0:p.options)??this.options).treeDropInside?f=u<.25?"before":u>.75?"after":"inside":f=u<.5?"before":"after",g&&f==="after"&&c+1<i){const m=o.getRowByIndex(c),b=o.getRowByIndex(c+1);if(b!=null&&b.parent&&b.parent===m)return{target:{rowIndex:c+1,position:"before"},outside:!1}}return{target:{rowIndex:c,position:f},outside:!1}}isValidTarget(e,t){if(!this.isManaged())return!0;const s=this.tableScope.tableModel.getBodyModel();return!!s.moveRows&&(s.canMoveRows?s.canMoveRows(e,t):!0)}drop(e){var r,n;const t=this.session,s=t.outside?void 0:t.target,o=this.createEvent("end",t.source,t.rows,t.rowIndices,s,t.outside,e);this.stopListening();const i=s&&this.isManaged()?this.moveRows(t.rowIndices,s,!0):-1;i>-1?(o.moved=!0,o.toIndex=i):this.tableScope.repaint(),(n=(r=this.tableScope.getEventListener()).onRowDragEnd)==null||n.call(r,o)}cancel(e){var s,o;const t=this.session;if(this.stopListening(),t){this.tableScope.repaint(),this.tableScope.announce(this.texts().rowDragCancelled());const i=this.createEvent("cancel",t.source,t.rows,t.rowIndices,void 0,t.outside,e);(o=(s=this.tableScope.getEventListener()).onRowDragEnd)==null||o.call(s,i)}}stopListening(){var t,s,o;(t=this.sessionAbortController)==null||t.abort(),this.sessionAbortController=void 0,this.pending=void 0,this.session=void 0,this.autoScrollFrame&&(cancelAnimationFrame(this.autoScrollFrame),this.autoScrollFrame=0),(s=this.ghost)==null||s.remove(),(o=this.indicator)==null||o.remove(),this.ghost=void 0,this.indicator=void 0,this.tableScope.hostElement.classList.remove("ge-table-row-drag-active","ge-table-row-drag-invalid")}destroy(){this.cancel()}createDragElements(e){const t=this.tableScope.getDomService(),s=this.tableScope.hostElement;this.ghost=t.setAriaHidden(t.createDivWithClass("ge-table-row-drag-ghost",s)),this.ghost.textContent=this.getGhostText(e),this.indicator=t.setAriaHidden(t.createDivWithClass("ge-table-row-drop-indicator",s)),s.classList.add("ge-table-row-drag-active")}getGhostText(e){const t=this.session.options.ghostText;if(t)return String(t(e)??"");const s=this.session.rowIndices[0],o=this.tableScope.tableModel.getBodyModel(),i=this.getHandleColumnIndex(s),n=(i>-1?o.getTextValueAt(s,i):"")||`Row ${s+1}`;return e.length>1?`${n} (+${e.length-1})`:n}renderDragElements(e){const t=this.session,s=this.ghost,o=this.indicator,i=this.tableScope.hostElement,r=i.getBoundingClientRect(),n=this.tableScope.getDomService();n.setStyle(s,"left",`${this.tableScope.clientXToHostX(e.clientX)+12}px`),s.style.top=`${e.clientY-r.top-i.clientTop+8}px`,i.classList.toggle("ge-table-row-drag-invalid",!t.target&&!t.outside);const l=t.target,c=this.tableScope.getBodyViewport();if(!l){o.style.display="none";return}const h=this.tableScope.tableModel.getBodyModel(),d=this.tableScope.getBodyRowTop(l.rowIndex),u=h.getRowHeight(l.rowIndex)+(l.position==="after"?this.tableScope.getBodyRowLayout().getExtraHeight(l.rowIndex):0),f=c.top-r.top-i.clientTop,g=l.position==="inside",p=f+d-c.contentScrollTop+(l.position==="after"?u:0),m=g?p:p-1,b=g?u:2,w=m+b>=f&&m<=f+c.height;o.classList.toggle("ge-table-row-drop-indicator-inside",g),n.applyStyle(o,{display:w?"block":"none",left:"0px",width:`${this.getMarkerWidth(c.width)}px`,top:`${m}px`,height:`${b}px`})}getMarkerWidth(e){const t=this.tableScope.tableModel,s=t.getPadding(),o=s.left+t.getContentWidthInPixel()+s.right;return o>0?Math.min(e,o):e}moveRows(e,t,s=!0){const o=this.tableScope,i=o.tableModel.getBodyModel(),r=Re(e,i.getRowCount());if(!r.length||!i.moveRows||this.isSorted()||i.canMoveRows&&!i.canMoveRows(r,t))return-1;const n=B(i),l=us(r,t),c=r[r.length-1]-r[0]===r.length-1;if(!n&&c&&l===r[0])return-1;const h=n?r.map(p=>i.getRowByIndex(p)):[];if(!i.moveRows(r,t))return-1;o.afterRowsMoved();const d=n?this.findDisplayIndices(i,h):[];let u=n?-1:l;for(const p of d)(u<0||p<u)&&(u=p);const f=o.selectionModel();if(f&&f.hasSelection()&&(f.clear(),s&&r.length>1)){const p=o.tableModel.getColumnCount()-1;n?d.forEach(m=>f.addSelection(new A(m,0,m,p))):f.addSelection(new A(l,0,l+r.length-1,p))}const g=o.focusModel();if(g&&u>-1){const[,p]=g.getFocus();g.setFocus(u,p>-1?p:Math.max(0,this.getHandleColumnIndex(u)))}return o.repaintHard(),u>-1&&o.ensureRowIsVisible(u),o.stateService.markDirty("selection"),o.announce(this.texts().rowMoved(u+1,i.getRowCount())),u}findDisplayIndices(e,t){const s=new Set(t),o=[],i=e.getRowCount();for(let r=0;r<i&&o.length<s.size;r++)s.has(e.getRowByIndex(r))&&o.push(r);return o}moveByKeyboard(e){var p,m,b,w,y,x;const t=this.tableScope;if(this.session||t.isEditing())return!1;const s=t.focusModel(),o=t.tableModel.getBodyModel(),[i]=(s==null?void 0:s.getFocus())??[-1,-1],r=i<0||i>=o.getRowCount()?-1:this.getHandleColumnIndex(i);if(r<0)return!1;if(this.getHandleStateOfRow(i,r)==="disabled")return this.announceNotPossible(),!0;const n=B(o),l=n?[i]:this.getDragRowIndices(i),c=n?this.getTreeKeyboardTarget(o,i,e):this.getFlatKeyboardTarget(l,e,o.getRowCount());if(!c)return!0;const h=this.getRows(l),d=this.createEvent("start","keyboard",h,l,void 0,!1);if((m=(p=t.getEventListener()).onRowDragStart)==null||m.call(p,d),d.defaultPrevented)return!0;const u=this.createEvent("move","keyboard",h,l,c,!1);(w=(b=t.getEventListener()).onRowDragMove)==null||w.call(b,u);const f=!u.defaultPrevented&&this.isValidTarget(l,c),g=this.createEvent("end","keyboard",h,l,f?c:void 0,!1);if(f&&this.isManaged()){const R=this.moveRows(l,c,!0);g.moved=R>-1,g.moved&&(g.toIndex=R)}return(x=(y=t.getEventListener()).onRowDragEnd)==null||x.call(y,g),!0}getFlatKeyboardTarget(e,t,s){if(t<0){const i=e[0];return i>0?{rowIndex:i-1,position:"before"}:void 0}const o=e[e.length-1];return o<s-1?{rowIndex:o+1,position:"after"}:void 0}getTreeKeyboardTarget(e,t,s){const o=e.getRowByIndex(t),i=e.rows??[],r=o!=null&&o.parent?o.parent.children??[]:i,n=r[r.indexOf(o)+s];if(!n)return;const[l]=this.findDisplayIndices(e,[n]);return l===void 0?void 0:{rowIndex:l,position:s<0?"before":"after"}}getDragRowIndices(e){const t=this.tableScope.tableModel.getBodyModel().getRowCount(),s=this.tableScope.selectionModel();if(this.options.multiRow&&(s!=null&&s.hasSelection())){const o=Re(s.getMergedRowIndices(t),t);if(o.includes(e))return o}return[e]}getRows(e){const t=this.tableScope.tableModel.getBodyModel(),s=X(t);return e.map(o=>{const i=t.getRowByIndex(o);return s&&L(i)&&!hs(i)?i.data:i})}getHandleColumnIndex(e){const t=this.tableScope.tableModel,s=t.getBodyModel(),o=t.getColumnCount();for(let i=0;i<o;i++){const r=t.getColumnDef(i);if(r!=null&&r.rowDrag&&this.getHandleState(e,r,s)!=="none")return i}return-1}getHandleStateOfRow(e,t){const s=this.tableScope.tableModel;return this.getHandleState(e,s.getColumnDef(t),s.getBodyModel())}isSorted(){var e,t,s;return!!((s=(t=(e=this.tableScope.tableModel).getColumnDefs)==null?void 0:t.call(e))!=null&&s.some(o=>o.sortState==="asc"||o.sortState==="desc"))}isManaged(){var e;return((e=this.tableScope.tableOptions.rowDragOptions)==null?void 0:e.managed)!==!1}canModelMove(e){return!!e.moveRows&&!X(e)&&!ds(e)}createEvent(e,t,s,o,i,r,n){const l=B(this.tableScope.tableModel.getBodyModel()),c=i&&!l?us(o,i):-1;return new xi(e,t,s,[...o],i?{...i}:void 0,c,r,this.isManaged(),n)}announceNotPossible(){this.tableScope.announce(this.texts().rowMoveNotPossible())}texts(){const e=this.tableScope.ariaTexts,t=new Ee;return{rowDragStarted:s=>(e.rowDragStarted??t.rowDragStarted).call(e,s),rowMoved:(s,o)=>(e.rowMoved??t.rowMoved).call(e,s,o),rowMoveNotPossible:()=>(e.rowMoveNotPossible??t.rowMoveNotPossible).call(e),rowDragCancelled:()=>(e.rowDragCancelled??t.rowDragCancelled).call(e)}}}function xn(a,e){return a===e||!!a&&!!e&&a.rowIndex===e.rowIndex&&a.position===e.position}class Zt{constructor(){this.blockCommitOnInvalid=!0}static create(e){const t=new Zt;return e&&typeof e=="object"&&e.blockCommitOnInvalid!==void 0&&(t.blockCommitOnInvalid=e.blockCommitOnInvalid),t}}function Si(a,e){if(Object.is(a,e))return!0;const t=s=>s==null||s==="";return t(a)||t(e)?t(a)&&t(e):a instanceof Date&&e instanceof Date?a.getTime()===e.getTime()||isNaN(a.getTime())&&isNaN(e.getTime()):typeof a=="number"&&typeof e=="string"||typeof a=="string"&&typeof e=="number"?String(a)===String(e):!1}class Ri{constructor(){this.rows=new Map,this.count=0}set(e,t,s,o,i,r){let n=this.rows.get(e);const l=n==null?void 0:n.get(t),c=l?l.oldValue:s;return Si(c,o)?l?(n.delete(t),n.size||this.rows.delete(e),this.count--,"removed"):"unchanged":(n||(n=new Map,this.rows.set(e,n)),n.set(t,{rowKey:e,property:t,oldValue:c,newValue:o,rawValue:i,error:r||void 0}),l?"changed":(this.count++,"added"))}get(e,t){var s;return this.count?(s=this.rows.get(e))==null?void 0:s.get(t):void 0}remove(e,t){const s=this.rows.get(e);return s!=null&&s.delete(t)?(s.size||this.rows.delete(e),this.count--,!0):!1}hasRow(e){return this.rows.has(e)}size(){return this.count}isEmpty(){return this.count===0}invalidCount(){let e=0;return this.rows.forEach(t=>t.forEach(s=>{s.error&&e++})),e}entries(){const e=[];return this.rows.forEach(t=>t.forEach(s=>e.push(s))),e}clear(){this.rows.clear(),this.count=0}}class Ai{constructor(e,t,s,o,i=()=>[]){this.type=e,this.changes=t,this.pendingCount=s,this.invalidCount=o,this.pendingProvider=i}get pendingChanges(){return this.pendingProvider()}}class Mi{constructor(e){this.tableScope=e,this.pending=new Ri,this.started=!1}get options(){return Zt.create(this.tableScope.tableOptions.batchEdit)}isPermanent(){return!!this.tableScope.tableOptions.batchEdit}isActive(){return this.started||this.isPermanent()}hasPending(){return!this.pending.isEmpty()}start(){return this.isActive()?!1:(this.started=!0,this.fire("start",[]),!0)}rowKeyOf(e){const t=this.tableScope.tableModel.getBodyModel().getRowByIndex(e);return t==null?e:L(t)?t.data??t:t}propertyOf(e){var t;return((t=this.tableScope.tableModel.getColumnDef(e))==null?void 0:t.property)||`#${e}`}getPendingAt(e,t){if(!this.pending.isEmpty())return this.pending.get(this.rowKeyOf(e),this.propertyOf(t))}getShownValue(e,t){const s=this.getPendingAt(e,t);return s?s.newValue:this.tableScope.tableModel.getBodyModel().getValueAt(e,t)}addPending(e){const t=this.tableScope.tableModel.getBodyModel(),s=[];for(const o of e){const i=this.rowKeyOf(o.rowIndex),r=this.propertyOf(o.columnIndex),n=t.getValueAt(o.rowIndex,o.columnIndex);if(this.pending.set(i,r,n,o.value,o.rawValue,o.error)!=="unchanged"){const c=this.pending.get(i,r);s.push({row:typeof i=="number"?void 0:i,rowIndex:o.rowIndex,columnIndex:o.columnIndex,property:r,oldValue:c?c.oldValue:n,newValue:o.value,...o.error?{error:o.error}:{}})}}return s.length&&(this.fire("change",s),this.tableScope.announce(this.texts().pendingChanges(this.pending.size()))),s}getPendingChanges(){if(this.pruneOrphans(),this.pending.isEmpty())return[];const e=this.createRowIndexMap();return this.pending.entries().map(t=>this.toChange(t,e))}commit(){const e=this.tableScope;this.pruneOrphans();const t=this.pending.invalidCount();if(t&&this.options.blockCommitOnInvalid)return e.announce(this.texts().commitBlocked(t)),!1;const s=this.pending.entries(),o=s.length?this.createRowIndexMap():new Map,i=e.tableModel,r=[],n=[];for(const h of s){const d=this.findColumnIndex(h.property);if(d<0)continue;const u=typeof h.rowKey=="number"?h.rowKey:o.get(h.rowKey)??-1;if(u>-1)r.push({rowIndex:u,columnIndex:d,value:h.rawValue});else if(vn(h.rowKey,i.getColumnDef(d),d,h.newValue)){const f=this.toChange(h,o);delete f.error,n.push(f)}}this.pending.clear(),this.isPermanent()||(this.started=!1);const l=e.writeCells(r,"commit",{extraChanges:n,skipValidation:!0}),c=i.getBodyModel();return n.length&&X(c)&&(c.regroup(),e.invalidateAggregates(),e.repaintHard()),this.fire("commit",l),e.announce(this.texts().changesCommitted(l.length)),!0}cancel(){const e=this.getPendingChanges(),t=this.started;this.pending.clear(),this.isPermanent()||(this.started=!1),this.tableScope.repaint(),(e.length||t)&&(this.fire("cancel",e),this.tableScope.announce(this.texts().changesDiscarded()))}pruneOrphans(){if(this.pending.isEmpty())return 0;const e=this.collectRowKeys();if(!e)return 0;let t=0;for(const s of this.pending.entries())typeof s.rowKey!="number"&&!e.has(s.rowKey)&&(this.pending.remove(s.rowKey,s.property),t++);return t}collectRowKeys(){const e=this.tableScope.tableModel.getBodyModel();if(B(e)){const t=new Set,s=o=>o==null?void 0:o.forEach(i=>{const r=i;t.add(r.data??r),s(r.children)});return s(e.rows),t}return typeof e.getAllRows=="function"?new Set(e.getAllRows()):void 0}toChange(e,t){const s=typeof e.rowKey=="number"?e.rowKey:t.get(e.rowKey)??-1;return{row:typeof e.rowKey=="number"?void 0:e.rowKey,rowIndex:s,columnIndex:this.findColumnIndex(e.property),property:e.property,oldValue:e.oldValue,newValue:e.newValue,...e.error?{error:e.error}:{}}}findColumnIndex(e){const s=this.tableScope.tableModel.getColumnCount();for(let o=0;o<s;o++)if(this.propertyOf(o)===e)return o;return-1}createRowIndexMap(){const e=new Map,t=this.tableScope.tableModel.getBodyModel().getRowCount();for(let s=0;s<t;s++){const o=this.rowKeyOf(s);this.pending.hasRow(o)&&!e.has(o)&&e.set(o,s)}return e}fire(e,t){var o,i;const s=new Ai(e,t,this.pending.size(),this.pending.invalidCount(),()=>this.getPendingChanges());(i=(o=this.tableScope.getEventListener()).onBatchEditChanged)==null||i.call(o,s)}texts(){return this.tableScope.getEditTexts()}}function vn(a,e,t,s){if(a===null||typeof a!="object")return!1;if(Array.isArray(a))return a[t]=s,!0;if(!(e!=null&&e.property))return!1;if(e.valueGetter)return!!e.valueSetter&&e.valueSetter(a,s)!==!1;const o=e.property.split(".");let i=a;for(let r=0;r<o.length-1;r++)if(i=i==null?void 0:i[o[r]],i===null||typeof i!="object")return!1;return i[o[o.length-1]]=s,!0}const Ei=/^(\d{4})-(\d{2})-(\d{2})$/,Sn=/^-?\d+(\.\d+)?$/,Ti=/^(.*\D)(\d+)$/,Rn=864e5;function Ii(a,e,t=!1,s="auto"){const o=a.length;if(e<1||o<1)return[];const i=Array.from({length:e},(l,c)=>t?-(c+1):c+1),r=()=>i.map(l=>An(a,l));if(s==="copy")return r();const n=ki(a,s==="alternate");return n?i.map(n):r()}function Di(a,e="auto"){return e!=="copy"&&a.length>0&&!!ki(a,e==="alternate")}function An(a,e){const t=a.length;return e>0?a[(e-1)%t]:a[t-1-(-e-1)%t]}function ki(a,e){const s=a.length===1?e:!e,o=!e;if(a.every(Mn))return s?So(a,i=>i):void 0;if(a.every(i=>typeof i=="string"&&Sn.test(i))){const i=a;if(i.some(c=>!Number.isSafeInteger(Math.trunc(Number(c)))))return;const r=Math.max(...i.map(c=>{var h;return((h=c.split(".")[1])==null?void 0:h.length)??0})),n=Math.max(...i.map(c=>{const h=c.replace("-","").split(".")[0];return h.length>1&&h.startsWith("0")?h.length:0})),l=c=>{const h=c.toFixed(r);if(!n)return h;const d=h.startsWith("-"),[u,f]=h.replace("-","").split(".");return(d?"-":"")+u.padStart(n,"0")+(f!==void 0?"."+f:"")};return s?So(i.map(Number),l):void 0}if(a.every(vo))return o?Tn(a):void 0;if(a.every(i=>typeof i=="string"&&Ei.test(i)&&vo(Vi(i))))return o?In(a):void 0;if(a.every(i=>typeof i=="string"&&Ti.test(i)))return o?Dn(a):void 0}function Mn(a){return typeof a=="number"&&Number.isFinite(a)}function vo(a){return a instanceof Date&&!isNaN(a.getTime())}function as(a){const e=Number(a.toPrecision(15));return e===0?0:e}function So(a,e){const t=a.length,s=a[t-1];if(t===1)return u=>e(as(s+u));const o=a[1]-a[0];if(a.every((u,f)=>f===0||Math.abs(u-a[f-1]-o)<=1e-9*Math.max(1,Math.abs(o))))return u=>e(as(u>0?s+o*u:a[0]+o*u));const r=(t-1)/2,n=a.reduce((u,f)=>u+f,0)/t;let l=0,c=0;a.forEach((u,f)=>{l+=(f-r)*(u-n),c+=(f-r)**2});const h=l/c,d=n-h*r;return u=>{const f=u>0?t-1+u:u;return e(as(d+h*f))}}function En(a){return a.d===Fi(a.y,a.m)}function Fi(a,e){return Qt(a,e+1,0).getUTCDate()}function Qt(a,e,t){const s=new Date(0);return s.setUTCFullYear(a,e,t),s}function Je(a){return a.y*12+a.m}function Ro(a){return Math.round(Qt(a.y,a.m,a.d).getTime()/Rn)}function Li(a){const e=a.length;if(e===1)return{months:0,days:1,monthEnd:!1};const t=a.every(En),s=a.every(r=>r.d===a[0].d),o=Je(a[1])-Je(a[0]);if((s||t)&&o!==0&&a.every((r,n)=>n===0||Je(r)-Je(a[n-1])===o))return{months:o,days:0,monthEnd:t&&!s};const i=Ro(a[e-1])-Ro(a[0]);return{months:0,days:Math.round(i/(e-1)),monthEnd:!1}}function Pi(a,e,t){const s=e>0?a[a.length-1]:a[0];if(t.months){const i=Je(s)+t.months*e,r=Math.floor(i/12),n=i-r*12,l=Fi(r,n);return{y:r,m:n,d:t.monthEnd?l:Math.min(s.d,l)}}const o=Qt(s.y,s.m,s.d+t.days*e);return{y:o.getUTCFullYear(),m:o.getUTCMonth(),d:o.getUTCDate()}}function Tn(a){const e=a.map(s=>({y:s.getFullYear(),m:s.getMonth(),d:s.getDate()})),t=Li(e);return s=>{const o=Pi(e,s,t),i=a[s>0?a.length-1:0];return new Date(o.y,o.m,o.d,i.getHours(),i.getMinutes(),i.getSeconds(),i.getMilliseconds())}}function Vi(a){const[,e,t,s]=Ei.exec(a),o=Qt(Number(e),Number(t)-1,Number(s));return o.getUTCDate()===Number(s)&&o.getUTCMonth()===Number(t)-1?o:new Date(NaN)}function In(a){const e=a.map(s=>{const o=Vi(s);return{y:o.getUTCFullYear(),m:o.getUTCMonth(),d:o.getUTCDate()}}),t=Li(e);return s=>{const o=Pi(e,s,t);return`${String(o.y).padStart(4,"0")}-${String(o.m+1).padStart(2,"0")}-${String(o.d).padStart(2,"0")}`}}function Dn(a){const e=a.map(r=>{const[,n,l]=Ti.exec(r);return{prefix:n,digits:l,num:Number(l)}}),t=e[0].prefix;if(e.some(r=>r.prefix!==t)||e.some(r=>!Number.isSafeInteger(r.num)))return;const s=e.length,o=s===1?1:(e[s-1].num-e[0].num)/(s-1);if(!Number.isInteger(o))return;const i=Math.max(...e.map(r=>r.digits.length>1&&r.digits.startsWith("0")?r.digits.length:0));return r=>{const n=r>0?e[s-1].num:e[0].num,l=Math.abs(n+o*r);return t+String(l).padStart(i,"0")}}function Qs(a,e,t){const{r1:s,c1:o,r2:i,c2:r}=a;switch(e){case"down":return new A(s,o,i+t,r);case"up":return new A(s-t,o,i,r);case"right":return new A(s,o,i,r+t);default:return new A(s,o-t,i,r)}}function Oi(a){var f;const{source:e,direction:t,count:s,getValue:o}=a,i=a.mode??"auto",r=t==="down"||t==="up",n=t==="up"||t==="left",l=[];if(s<1)return l;const[c,h]=r?[e.c1,e.c2]:[e.r1,e.r2],[d,u]=r?[e.r1,e.r2]:[e.c1,e.c2];for(let g=c;g<=h;g++){const p=y=>r?[y,g]:[g,y],m=[];for(let y=d;y<=u;y++)m.push(o(...p(y)));const b=Ii(m,s,n,i),w=Di(m,i);for(let y=0;y<s;y++){const x=n?d-1-y:u+1+y,[R,M]=p(x);if(a.isFillable&&!a.isFillable(R,M))continue;let D=b[y];if(a.fillValue){const F=((f=a.getCellInfo)==null?void 0:f.call(a,R,M))??{row:void 0,property:""},v=a.fillValue({sourceValues:m,step:n?-(y+1):y+1,direction:t,rowIndex:R,columnIndex:M,property:F.property,row:F.row,defaultValue:D,copy:!w});v!==void 0&&(D=v)}l.push({rowIndex:R,column:M,value:D})}}return l}const Ao="fill-handle";class Bi{constructor(e){this.tableScope=e,this.autoScrollFrame=0,this.suppressClick=!1,this.shortcutsSet=!1;const t=e.listenerAbortController.signal;e.hostElement.addEventListener("pointerdown",s=>{var o;(o=e.isEventInDetail)!=null&&o.call(e,s)||this.onPointerDown(s)},{signal:t}),e.hostElement.addEventListener("click",s=>{var o;(o=e.isEventInDetail)!=null&&o.call(e,s)||this.onClickCapture(s)},{capture:!0,signal:t}),e.hostElement.addEventListener("dblclick",s=>{var o;!((o=e.isEventInDetail)!=null&&o.call(e,s))&&this.isHandle(s.target)&&s.stopPropagation()},{capture:!0,signal:t})}isFilling(){return!!this.session}update(){var r,n;const e=this.tableScope,t=e.getFillHandleOptions();if(!t){this.removeHandle(),this.shortcutsSet&&(this.shortcutsSet=!1,this.tableScope.setHostKeyShortcuts(void 0));return}this.updateHostShortcuts(t);const s=((r=this.session)==null?void 0:r.source)??e.getFillSourceRange(),o=s&&!e.isEditing()&&!e.tableOverlay.isBlocking()&&!((n=e.rowDragService)!=null&&n.isDragging())?this.getCornerOf(s):void 0;if(!o){this.handle&&(this.handle.style.display="none");return}const i=this.ensureHandle();i.style.display="block",e.getDomService().setStyle(i,"left",`${o.x}px`),i.style.top=`${o.y}px`,this.session&&this.renderPreview()}getCornerOf(e){const t=this.tableScope;let s=e.c2;for(;s>e.c1&&t.tableModel.getColumnWidth(s)<=0;)s--;if(t.tableModel.getColumnWidth(s)<=0)return;const o=t.getBodyCellRectInHost(e.r2,s),i=o.left+o.width,r=o.top+o.height;return i>=o.clipLeft&&i<=o.clipRight+.5&&r>=o.clipTop&&r<=o.clipBottom+.5?{x:i,y:r}:void 0}ensureHandle(){if(!this.handle||!this.handle.isConnected){const e=this.tableScope.getDomService();this.handle=e.setAriaHidden(e.createDivWithClass("ge-table-fill-handle",this.tableScope.hostElement)),e.domService.setAttribute(this.handle,"data-ge-action",Ao)}return this.handle}removeHandle(){var e;(e=this.handle)==null||e.remove(),this.handle=void 0}updateHostShortcuts(e){const s=typeof navigator<"u"&&navigator.platform.indexOf("Mac")>-1?"Meta":"Control",o=[];e.direction!=="horizontal"&&o.push(`${s}+D`),e.direction!=="vertical"&&o.push(`${s}+R`),this.tableScope.setHostKeyShortcuts(o.join(" ")),this.shortcutsSet=!0}isHandle(e){return e instanceof Element&&!!e.closest(`[data-ge-action="${Ao}"]`)&&this.tableScope.hostElement.contains(e)}onPointerDown(e){if(this.session||this.pending||e.pointerType==="mouse"&&e.button!==0||!this.isHandle(e.target))return;e.preventDefault();const t=this.tableScope.getFillSourceRange();!t||this.tableScope.isEditing()||(this.pending={pointerId:e.pointerId,startX:e.clientX,startY:e.clientY,source:t},this.listenToDocument())}listenToDocument(){this.sessionAbortController=new AbortController;const e=this.sessionAbortController.signal,t=this.tableScope.hostElement.ownerDocument;t.addEventListener("pointermove",s=>this.onPointerMove(s),{signal:e}),t.addEventListener("pointerup",s=>this.onPointerUp(s),{signal:e}),t.addEventListener("pointercancel",s=>{this.pending&&s.pointerId===this.pending.pointerId&&this.cancel()},{signal:e}),t.addEventListener("keydown",s=>{s.key==="Escape"&&(this.session||this.pending)&&(s.preventDefault(),s.stopPropagation(),this.cancel())},{capture:!0,signal:e}),this.tableScope.scrollViewport.addEventListener("scroll",()=>{var s;(s=this.session)!=null&&s.lastEvent&&!this.autoScrollFrame&&this.updateTarget(this.session.lastEvent)},{signal:e})}onPointerMove(e){if(!(!this.pending||e.pointerId!==this.pending.pointerId)){if(!this.session){const t=this.tableScope.getFillHandleOptions();if(!t){this.stopListening();return}if(Math.hypot(e.clientX-this.pending.startX,e.clientY-this.pending.startY)<t.dragThresholdInPx)return;this.session={source:this.pending.source,options:t,count:0,speedX:0,speedY:0,remainderX:0,remainderY:0};const s=this.tableScope.getDomService();this.preview=s.setAriaHidden(s.createDivWithClass("ge-table-fill-preview",this.tableScope.hostElement)),this.tableScope.hostElement.classList.add("ge-table-fill-active")}e.preventDefault(),this.updateTarget(e)}}onPointerUp(e){if(!this.pending||e.pointerId!==this.pending.pointerId)return;const t=this.session;if(!t){this.stopListening(),this.suppressNextClick();return}this.updateTarget(e),this.suppressNextClick();const{source:s,direction:o,count:i}=t;this.stopListening(),o&&i>0&&!this.tableScope.tableOverlay.isBlocking()&&!this.tableScope.isEditing()?this.tableScope.fillRange(s,o,i,e.altKey||e.ctrlKey?"alternate":"auto"):this.tableScope.repaint()}suppressNextClick(){this.suppressClick=!0,setTimeout(()=>this.suppressClick=!1,0)}onClickCapture(e){(this.suppressClick||this.isHandle(e.target))&&(this.suppressClick=!1,e.stopPropagation(),e.preventDefault())}updateTarget(e){const t=this.session;t.lastEvent=e;const s=this.tableScope,o=s.hostElement,i=o.getBoundingClientRect(),r=s.clientXToHostX(e.clientX),n=e.clientY-i.top-o.clientTop,[l,c]=s.getBodyCellAtHostPoint(r,n),h=t.source,d=l>h.r2?l-h.r2:l<h.r1?l-h.r1:0,u=c>h.c2?c-h.c2:c<h.c1?c-h.c1:0,f=t.options.direction,g=f==="vertical"||f==="both"&&Math.abs(d)>=Math.abs(u),p=g?d:u;t.direction=p===0?void 0:g?p>0?"down":"up":p>0?"right":"left",t.count=Math.abs(p),this.renderPreview(),this.updateAutoScroll(r,n)}renderPreview(){const e=this.session,t=this.preview;if(!e||!t)return;const s=e.direction?Qs(e.source,e.direction,e.count):e.source,o=this.tableScope,i=o.getBodyCellRectInHost(s.r1,s.c1),r=o.getBodyCellRectInHost(s.r2,s.c2),n=Math.max(i.top,i.clipTop),l=Math.min(r.top+r.height,r.clipBottom),c=Math.max(i.left,i.clipLeft),h=Math.min(r.left+r.width,r.clipRight);o.getDomService().applyStyle(t,{display:l>n&&h>c?"block":"none",left:`${c}px`,top:`${n}px`,width:`${Math.max(0,h-c)}px`,height:`${Math.max(0,l-n)}px`})}updateAutoScroll(e,t){const s=this.session,{autoScrollZoneInPx:o,autoScrollMaxSpeedInPx:i}=s.options,r=this.tableScope,n=r.tableModel.getPadding(),l=r.hostElement,c=g=>Math.max(1,Math.round(i*Math.min(1,g/o)**2)),h=n.top,d=l.clientHeight-n.bottom,u=n.left,f=l.clientWidth-n.right;s.speedY=o<=0||i<=0?0:t<h+o?-c(h+o-t):t>d-o?c(t-(d-o)):0,s.speedX=o<=0||i<=0?0:e<u+o&&e>=u-o?-c(u+o-e):e>f-o?c(e-(f-o)):0,(s.speedX||s.speedY)&&!this.autoScrollFrame?this.autoScrollFrame=requestAnimationFrame(()=>this.autoScrollStep()):!s.speedX&&!s.speedY&&(s.lastFrameTime=void 0,s.remainderX=0,s.remainderY=0)}autoScrollStep(){this.autoScrollFrame=0;const e=this.session;if(!e||!e.speedX&&!e.speedY)return;const t=this.tableScope.scrollViewport,s=performance.now(),o=e.lastFrameTime?Math.min(4,(s-e.lastFrameTime)/(1e3/60)):1;e.lastFrameTime=s;const i=e.speedY*o*this.tableScope.getScrollerToContentRatioY()+e.remainderY,r=e.speedX*o+e.remainderX,n=Math.trunc(i),l=Math.trunc(r);e.remainderY=i-n,e.remainderX=r-l;const c=this.tableScope,h=t.scrollTop,d=c.getViewportScrollLeft();t.scrollTop=h+n,c.setViewportScrollLeft(d+l),(t.scrollTop!==h||c.getViewportScrollLeft()!==d)&&this.tableScope.adjustAfterScrolling(),this.updateTarget(e.lastEvent)}cancel(){const e=!!this.session;this.stopListening(),e&&this.tableScope.repaint()}stopListening(){var e,t;(e=this.sessionAbortController)==null||e.abort(),this.sessionAbortController=void 0,this.pending=void 0,this.session=void 0,this.autoScrollFrame&&(cancelAnimationFrame(this.autoScrollFrame),this.autoScrollFrame=0),(t=this.preview)==null||t.remove(),this.preview=void 0,this.tableScope.hostElement.classList.remove("ge-table-fill-active")}destroy(){this.stopListening(),this.removeHandle()}}class es{constructor(){this.detailRenderer=()=>{},this.isMaster=void 0,this.detailHeight="auto",this.estimatedDetailHeight=200,this.toggleColumn=void 0,this.maxRenderedDetails=50,this.getRowId=void 0}static create(e){const t=new es;for(const[s,o]of Object.entries(e??{}))o!==void 0&&(t[s]=o);return t}}const kn="a[href], button, input, select, textarea, iframe, [contenteditable]:not([contenteditable='false']), [tabindex]";class Ni{constructor(e,t){var i;this.scope=e,this.createNestedScope=t,this.entries=new Map,this.byIndex=new Map,this.visibleNow=new Set,this.renderPass=0,this.renderedCount=0,this.toggleColumnIndex=-1,this.resizeFrame=0,this.destroyed=!1;const s=(i=e.tableOptions)==null?void 0:i.masterDetail;this.options=es.create(s);const o=B(e.tableModel.getBodyModel());s&&o&&console.warn("GuiExpert Table – masterDetail is ignored: it works only with flat body models (no tree, row grouping or pivot table)."),s&&!s.detailRenderer&&console.warn("GuiExpert Table – masterDetail without a detailRenderer: the detail rows stay empty."),this.active=!!s&&!o,this.active&&this.createLayer()}isActive(){return this.active}hasExpanded(){return this.active&&this.entries.size>0}getLayer(){return this.layer}isInLayer(e){var o;const t=this.layer;if(!t)return!1;const s=(o=e.composedPath)==null?void 0:o.call(e);return s!=null&&s.length?s.includes(t):e.target instanceof Node&&t.contains(e.target)}keyOf(e,t){var s,o;if(e!=null){const i=(o=(s=this.scope.tableOptions)==null?void 0:s.autoRestoreOptions)==null?void 0:o.getRowId,r=this.options.getRowId??(i&&!ai(i)?i:void 0);if(r)try{const n=r(e,t);if(n!=null)return n}catch{}if(typeof e=="object"||typeof e=="function")return e}return t}isMasterAt(e){if(!this.active||e<0)return!1;const t=this.getBody();if(e>=t.getRowCount())return!1;const s=this.options.isMaster;if(!s)return!0;try{return!!s(t.getRowByIndex(e),e)}catch(o){return console.error(o),!1}}isExpandedAt(e){return!this.hasExpanded()||e<0?!1:this.entries.has(this.keyOf(this.getBody().getRowByIndex(e),e))}isExpanded(e){const[t,s]=this.resolve(e);return this.hasExpanded()&&this.entries.has(this.keyOf(t,s))}setExpanded(e,t,s="api"){if(!this.active)return!1;const[o,i]=this.resolve(e),r=this.keyOf(o,i);if(t){if(this.entries.has(r)||o===void 0&&i<0||(i>=0?!this.isMasterAt(i):!this.isMasterRow(o)))return!1;const n={key:r,row:o,rowIndex:i,lastSeen:0,renderCount:0};this.entries.set(r,n);const l=i>=0&&this.scope.setBodyRowExtra(i,this.heightOf(n));l&&this.byIndex.set(i,n),this.scope.onDetailToggled(o,i,t,s,!0,l)}else{const n=this.entries.get(r);if(!n)return!1;this.destroyContent(n),this.entries.delete(r);const l=n.rowIndex>=0&&this.byIndex.get(n.rowIndex)===n&&this.scope.setBodyRowExtra(n.rowIndex,0);l&&this.byIndex.delete(n.rowIndex),this.scope.onDetailToggled(o,i,t,s,!0,l)}return!0}expandAll(){if(!this.active)return 0;const e=this.getBody(),t=e.getRowCount();let s=0;for(let o=0;o<t;o++){if(!this.isMasterAt(o))continue;const i=e.getRowByIndex(o),r=this.keyOf(i,o);this.entries.has(r)||(this.entries.set(r,{key:r,row:i,rowIndex:o,lastSeen:0,renderCount:0}),s++)}return s&&this.scope.onDetailToggled(void 0,-1,!0,"api",!1),s}collapseAll(){const e=this.entries.size;return e?(this.clearAll(),this.scope.onDetailToggled(void 0,-1,!1,"api",!1),e):0}getExpandedRows(){return Array.from(this.entries.values(),e=>e.row)}setExpandedRows(e,t="api"){if(!this.active)return!1;const s=new Map;for(const i of e)s.set(this.keyOf(i,-1),i);let o=!1;for(const[i,r]of Array.from(this.entries))s.has(i)||(this.destroyContent(r),this.entries.delete(i),o=!0);for(const[i,r]of Array.from(s))!this.entries.has(i)&&this.isMasterRow(r)&&(this.entries.set(i,{key:i,row:r,rowIndex:-1,lastSeen:0,renderCount:0}),o=!0);return o&&this.scope.onDetailToggled(void 0,-1,!0,t,!1),o}refresh(e){const[t,s]=this.resolve(e),o=this.entries.get(this.keyOf(t,s));return o?(this.destroyContent(o),this.scope.repaint(),!0):!1}getDetailElement(e){var o,i;const[t,s]=this.resolve(e);return(i=(o=this.entries.get(this.keyOf(t,s)))==null?void 0:o.content)==null?void 0:i.cell}getMasterRowIndexOf(e){var t,s;if(!e||!((t=this.layer)!=null&&t.contains(e)))return-1;for(const o of Array.from(this.entries.values()))if((s=o.content)!=null&&s.rowDiv.contains(e))return o.rowIndex;return-1}computeExtras(){var l;if(this.byIndex=new Map,!this.hasExpanded())return;const e=this.getBody(),t=e.getRowCount();for(const c of Array.from(this.entries.values()))c.rowIndex=-1;const s=[],o=[];let i=0;const r=(l=e.getFilteredRows)==null?void 0:l.call(e),n=Array.isArray(r)&&r.length===t?c=>r[c]:c=>e.getRowByIndex(c);for(let c=0;c<t&&i<this.entries.size;c++){const h=n(c),d=this.entries.get(this.keyOf(h,c));!d||d.rowIndex>=0||this.options.isMaster&&!this.isMasterAt(c)||(i++,d.rowIndex=c,d.row=h,this.byIndex.set(c,d),s.push(c),o.push(this.heightOf(d)))}return i<this.entries.size&&this.pruneRemovedRows(e),{rowIndices:s,heights:o}}startRenderPass(){this.toggleColumnIndex=this.active?this.computeToggleColumnIndex():-1}layoutVisible(e){if(!this.active||this.destroyed)return;this.renderPass++;const t=new Set;for(let o=0;o+2<e.length;o+=3){const i=this.byIndex.get(e[o]);if(!i)continue;i.content&&i.content.row!==i.row&&this.destroyContent(i);const r=i.content??this.createContent(i,e[o+1],e[o+2]);this.place(r,e[o+1],e[o+2]),i.lastSeen=this.renderPass,t.add(i)}for(const o of Array.from(this.visibleNow))!t.has(o)&&o.content&&this.park(o.content,o.rowIndex);this.visibleNow=t,this.enforceLimit();const s=t.size?"rowgroup":"presentation";this.layer&&this.layer.getAttribute("role")!==s&&this.scope.getDomService().domService.setAttribute(this.layer,"role",s)}setBounds(e,t,s,o){const i=this.layer;if(!i)return;const r=i.style;this.scope.getDomService().setStyle(i,"left",`${e}px`),r.top=`${t}px`,r.width=`${Math.max(0,s)}px`,r.height=`${Math.max(0,o)}px`}decorateCell(e,t,s){if(s!==this.toggleColumnIndex||!this.isMasterAt(t))return;const o=this.isExpandedAt(t),i=this.scope.getDomService(),r=i.domService;r.addClass(e,"ge-table-detail-toggle-cell");const n=r.createElement("div");r.addClass(n,"ge-table-detail-toggle"),o&&r.addClass(n,"ge-table-detail-toggle-expanded"),r.setAttribute(n,"data-ge-action","toggle-detail"),r.setAttribute(n,"data-area","body"),r.setAttribute(n,"data-row-index",`${t}`),r.setAttribute(n,"data-col-index",`${s}`),i.setAriaHidden(n),e.insertBefore(n,e.firstChild)}destroy(){var e;this.destroyed||(this.destroyed=!0,this.resizeFrame&&(cancelAnimationFrame(this.resizeFrame),this.resizeFrame=0),this.clearAll(),(e=this.layer)==null||e.remove(),this.layer=void 0)}getBody(){return this.scope.tableModel.getBodyModel()}getAllRows(e){var s;const t=(s=e.getAllRows)==null?void 0:s.call(e);return Array.isArray(t)?t:void 0}isMasterRow(e){const t=this.options.isMaster;try{return e!==void 0&&(!t||!!t(e,-1))}catch(s){return console.error(s),!1}}resolve(e){var r;const t=this.getBody();if(typeof e=="number")return e<0||e>=t.getRowCount()?[void 0,-1]:[t.getRowByIndex(e),e];const s=this.entries.get(this.keyOf(e,-1));if(s&&s.rowIndex>=0&&t.getRowByIndex(s.rowIndex)===e)return[e,s.rowIndex];const o=(r=t.getFilteredRows)==null?void 0:r.call(t);if(Array.isArray(o)&&o.length===t.getRowCount())return[e,o.indexOf(e)];const i=t.getRowCount();for(let n=0;n<i;n++)if(t.getRowByIndex(n)===e)return[e,n];return[e,-1]}heightOf(e){const t=this.detailHeightOf(e);return t==="auto"?e.measuredHeight??this.options.estimatedDetailHeight:Math.max(0,t)}detailHeightOf(e){const t=this.options.detailHeight;if(typeof t=="function")try{const s=t(e.row,e.rowIndex);return s==="auto"||typeof s=="number"&&isFinite(s)?s:"auto"}catch(s){return console.error(s),"auto"}return t==="auto"||typeof t=="number"&&isFinite(t)?t:"auto"}computeToggleColumnIndex(){var o,i;const e=this.options.toggleColumn,t=this.scope.tableModel;if(typeof e=="number")return e;if(typeof e=="string")return(((o=t.getColumnDefs)==null?void 0:o.call(t))??[]).findIndex(r=>r.property===e);const s=this.scope.getFirstDataColumnIndex();return(i=this.scope.tableOptions)!=null&&i.showCheckboxWihoutExtraColumn?s:t.isRowCheckboxVisible()?s+1:s}pruneRemovedRows(e){const t=this.getAllRows(e);if(!t)return;const s=new Set;t.forEach((o,i)=>s.add(this.keyOf(o,i)));for(const[o,i]of Array.from(this.entries))i.rowIndex<0&&!s.has(o)&&(this.destroyContent(i),this.entries.delete(o))}createLayer(){const e=this.scope,s=e.getDomService().domService,o=s.createElement("div");s.addClass(o,"ge-table-detail-layer"),s.setAttribute(o,"id",e.ariaIds.detailRowGroup()),s.setAttribute(o,"role","presentation"),s.appendChild(e.hostElement,o),this.layer=o;const i=e.listenerAbortController.signal;o.addEventListener("wheel",r=>this.onWheel(r),{passive:!1,signal:i}),e.hostElement.addEventListener("keydown",r=>this.onHostKeyDown(r),{signal:i}),e.hostElement.addEventListener("focus",r=>this.onHostFocus(r),{signal:i})}createContent(e,t,s){const o=this.scope,i=o.getDomService().domService,r=i.createElement("div");i.addClass(r,"ge-table-detail-row"),i.setAttribute(r,"role","row");const n=i.createElement("div");i.addClass(n,"ge-table-detail-cell"),i.setAttribute(n,"role","gridcell"),i.setAttribute(n,"aria-colspan",`${Math.max(1,o.getAriaGridInfo().colCount)}`),i.appendChild(r,n);const l=this.detailHeightOf(e)==="auto";l&&i.addClass(r,"ge-table-detail-row-auto"),i.appendChild(this.layer,r);const c={rowDiv:r,cell:n,row:e.row,auto:l,abort:new AbortController,tables:[],parked:!1};e.content=c,this.place(c,t,s),this.renderedCount++;const h=e.renderCount>0;e.renderCount++;const d=this,u={row:e.row,rowIndex:e.rowIndex,tableApi:o.getApi(),recreated:h,signal:c.abort.signal,createTable(f){return d.createNestedTable(c,l,f)}};try{const f=this.options.detailRenderer,g=typeof f=="function"?f(n,e.row,u):f==null?void 0:f.render(n,e.row,u);typeof g=="function"&&(c.cleanup=g)}catch(f){console.error(f)}return l&&typeof ResizeObserver<"u"&&(c.resizeObserver=new ResizeObserver(f=>this.onResize(e,c,f)),c.resizeObserver.observe(r)),c}createNestedTable(e,t,s){const o=this.scope.getDomService().domService,i=o.createElement("div");o.addClass(i,"ge-table-detail-table");const r=s.height??(t?this.options.estimatedDetailHeight:"100%");i.style.height=typeof r=="number"?`${r}px`:r,o.appendChild(e.cell,i);const n=this.createNestedScope(i,s.tableModel,s.tableOptions,s.eventListener);return e.tables.push(n),n.firstInit(),n.getApi()}place(e,t,s){const o=e.rowDiv.style;e.parked&&(e.parked=!1,e.rowDiv.classList.remove("ge-table-detail-row-parked")),e.top!==t&&(e.top=t,o.top=`${t}px`),!e.auto&&e.height!==s&&(e.height=s,o.height=`${s}px`)}park(e,t=-1){e.parked||(this.releaseFocus(e,t),e.parked=!0,e.rowDiv.classList.add("ge-table-detail-row-parked"))}releaseFocus(e,t){var o;const s=(o=e.rowDiv.ownerDocument)==null?void 0:o.activeElement;s&&e.rowDiv.contains(s)&&this.scope.takeFocusFromDetail(t)}onResize(e,t,s){var l,c;if(t.parked||e.content!==t||this.destroyed)return;const o=s[s.length-1],i=(l=o==null?void 0:o.borderBoxSize)==null?void 0:l[0],r=i?i.blockSize:((c=o==null?void 0:o.target)==null?void 0:c.offsetHeight)??0,n=Math.max(1,Math.ceil(r));e.measuredHeight!==n&&(e.measuredHeight=n,e.rowIndex>=0&&this.scope.getBodyRowLayout().setExtraHeight(e.rowIndex,n),this.resizeFrame||(this.resizeFrame=requestAnimationFrame(()=>{this.resizeFrame=0,this.destroyed||this.scope.onDetailHeightChanged()})))}enforceLimit(){const e=Math.max(0,this.options.maxRenderedDetails);if(this.renderedCount<=e||this.renderedCount<=this.visibleNow.size)return;const t=Array.from(this.entries.values()).filter(s=>s.content&&!this.visibleNow.has(s)).sort((s,o)=>s.lastSeen-o.lastSeen);for(const s of t){if(this.renderedCount<=e)break;this.destroyContent(s)}}destroyContent(e){var s,o;const t=e.content;if(t){e.content=void 0,this.renderedCount--,this.visibleNow.delete(e),this.destroyed||this.releaseFocus(t,e.rowIndex),(s=t.resizeObserver)==null||s.disconnect();try{(o=t.cleanup)==null||o.call(t)}catch(i){console.error(i)}t.abort.abort();for(const i of t.tables)try{i.destroy()}catch(r){console.error(r)}t.rowDiv.remove()}}clearAll(){for(const e of Array.from(this.entries.values()))this.destroyContent(e);this.entries.clear(),this.byIndex.clear(),this.visibleNow.clear()}onWheel(e){if(e.defaultPrevented||e.ctrlKey)return;const t=this.scope.scrollViewport,s=e.deltaMode===1?16:e.deltaMode===2?t.clientHeight:1,o=e.deltaY*s,i=e.deltaX*s;if(this.canScrollInside(e.target,i,o))return;const r=t.scrollTop,n=t.scrollLeft;o&&(t.scrollTop=r+o*this.scope.getScrollerToContentRatioY()),i&&(t.scrollLeft=n+i),(t.scrollTop!==r||t.scrollLeft!==n)&&e.preventDefault()}canScrollInside(e,t,s){let o=e instanceof Element?e:null;for(;o&&o!==this.layer;){if(o instanceof HTMLElement){const i=getComputedStyle(o);if(s&&/(auto|scroll)/.test(i.overflowY)&&o.scrollHeight>o.clientHeight&&(s>0?o.scrollTop+o.clientHeight<o.scrollHeight-1:o.scrollTop>0)||t&&/(auto|scroll)/.test(i.overflowX)&&o.scrollWidth>o.clientWidth&&_o(o,t,i.direction==="rtl"))return!0}o=o.parentElement}return!1}onHostKeyDown(e){var r;if(e.key!=="Tab"||e.shiftKey||e.altKey||e.ctrlKey||e.metaKey||e.defaultPrevented||e.target!==this.scope.hostElement||this.isInLayer(e))return;const t=(r=this.scope.focusModel())==null?void 0:r.getFocus(),s=t?this.byIndex.get(t[0]):void 0,o=s==null?void 0:s.content;if(!o||o.parked||!this.visibleNow.has(s))return;const i=this.findFocusable(o.cell);i&&(e.preventDefault(),i.focus())}onHostFocus(e){const t=e.relatedTarget instanceof Node?e.relatedTarget:null,s=this.getMasterRowIndexOf(t);s>=0&&this.scope.focusDetailMaster(s)}findFocusable(e){for(const t of Array.from(e.querySelectorAll(kn))){const s=t.getAttribute("tabindex");if(!(s!==null&&Number(s)<0||t.disabled)&&t.getClientRects().length)return t}}}class Hi{constructor(e,t,s,o){this.row=e,this.rowIndex=t,this.expanded=s,this.source=o}}class at{constructor(){this.direction="both",this.fillValue=void 0,this.maxCells=1e5,this.dragThresholdInPx=3,this.autoScrollZoneInPx=40,this.autoScrollMaxSpeedInPx=24}static create(e){if(!e)return;const t=new at;if(typeof e=="object")for(const[s,o]of Object.entries(e))o!==void 0&&(t[s]=o);return t}}const ue=class ue extends oi{constructor(e,t,s,o,i,r=new Le,n=new Ci){var d;if(super(e,t,new yt(s),o),this.eventListener=i,this.copyService=r,this.excelService=n,this.licenseManager=Ce.getInstance(),this.listenerAbortController=new AbortController,this.destroyed=!1,this.selectionService=new xe(this),this.api=new qo(this),this.initialized=!1,this.mouseStartAction="",this.mouseStartWidth=-1,this.mouseStartColumnIndex=-1,this.dragFrom=-1,this.dragTo=-1,this.lastDragFrom=-1,this.lastDragTo=-1,this.firstDraggingRendering=!0,this.lastTabKeyTime=0,this.lastContextmenu=Date.now(),this.allExpanded=!0,this.selectionEventsHeld=0,t.setTableScope(this),this.liveAnnouncer=new Mt(e.ownerDocument,this.ariaIds.liveRegion(),s),i||(this.eventListener=new qe),this.stateService=new At(this),this.mouseHandler=new Wo(this),this.inputHandler=new hi(this),this.resizeHandler=new yi(this,o.resizeEventDebounceDelay),this.shortcutService=new pi(this),this.rowDragService=new vi(this),this.batchEditService=new Mi(this),this.fillHandleService=new Bi(this),o!=null&&o.masterDetail&&(this.masterDetailService=new Ni(this,(u,f,g,p)=>new ue(u,f,new ys,this.nestedTableOptions(g),p??new qe)),this.masterDetailService.isActive())){const u=(e.getAttribute("aria-owns")??"").split(" ").filter(Boolean),f=u.findIndex(g=>g.startsWith(this.ariaIds.rowGroup("footer","west")));u.splice(f<0?u.length:f,0,this.ariaIds.detailRowGroup()),this.setHostAriaAttribute("aria-owns",u.join(" ")),this.setHostAriaAttribute("role","treegrid")}this.shortcutService.addListener(this.selectionService);const l=this.getSelectionModel?this.getSelectionModel():void 0;l&&l.addEventSelectionChangedListener(this);const c=this.getFocusModel?this.getFocusModel():void 0;c&&c.addEventFocusChangedListener(this);const h=this.listenerAbortController.signal;(d=e.ownerDocument)==null||d.addEventListener("keydown",u=>{u.key==="Tab"&&(this.lastTabKeyTime=Date.now())},{capture:!0,signal:h}),e.addEventListener("focus",()=>this.onHostKeyboardFocus(),{signal:h}),this.scrollViewport.addEventListener("focus",()=>this.hostElement.focus({preventScroll:!0}),{signal:h})}nestedTableOptions(e){return e?e.direction!==void 0||!this.isRtl()?e:Object.assign(Object.create(e),{direction:this.direction}):{...new Ae,direction:this.direction}}onHostKeyboardFocus(){const e=Date.now()-this.lastTabKeyTime<1e3,t=this.focusModel();if(!e||!t||this.headerFocus||this.isEditing())return;const[s,o]=t.getFocus(),i=this.tableModel.getBodyModel().getRowCount();if((s<0||o<0)&&i>0&&this.tableModel.getColumnCount()>0){const r=this.firstFullVisibleRowIndex>=0?this.firstFullVisibleRowIndex:Math.max(0,this.getBodyRowIndexAtY(this.contentScrollTop));this.setFocusCell(r,this.getFirstShownColumnIndex())}else i<1&&this.getAriaGridInfo().headerRowCount>0&&this.tableModel.getColumnCount()>0&&this.setHeaderFocus(this.getAriaGridInfo().headerRowCount-1,this.getFirstShownColumnIndex())}static create(e,t,s=new Ae,o=new qe,i=new ys,r=new Le){return new ue(e,t,i,s,o,r)}onActionTriggered(e){var s;if(!this.headerFocus&&this.tableOverlay.isBlocking()&&ue.actionsBlockedWhileLoading.includes(e))return!0;if(this.headerFocus){const o=this.onHeaderAction(e);if(o!==void 0)return o}if(e==="FILL_DOWN"||e==="FILL_RIGHT")return!this.headerFocus&&this.fillByKeyboard(e==="FILL_DOWN"?"down":"right");if(e==="MOVE_ROW_UP"||e==="MOVE_ROW_DOWN")return!this.headerFocus&&!!((s=this.rowDragService)!=null&&s.moveByKeyboard(e==="MOVE_ROW_UP"?-1:1));if(e==="NAVIGATE_UP"&&this.moveFocusIntoHeader())return!0;const t=this.onBodyNavigation(e);if(t!==void 0)return t;if(e==="NAVIGATE_DOWN"&&this.changeFocusCell(0,1)||e==="NAVIGATE_UP"&&this.changeFocusCell(0,-1)||e==="NAVIGATE_LEFT"&&this.changeFocusCell(-1,0)||e==="NAVIGATE_RIGHT"&&this.changeFocusCell(1,0))return!0;if(e==="START_EDITING"&&this.getFocusModel){const o=this.getFocusModel();if(o){const[i,r]=o.getFocus();this.tableModel.getBodyModel().isEditable(i,r)&&(this.clearSelection(),this.initRenderEditor(i,r))}return!0}if(e==="COPY_2_CLIPBOARD"){const o=this.getSelectionModel?this.getSelectionModel():void 0,i=this.getFocusModel?this.getFocusModel():void 0;this.copyService.createContent(this.tableModel,o,i).then(r=>this.copyService.copyContent(r).then(()=>this.announceCopied(r))).catch(r=>console.warn("GuiExpert Table – copy to clipboard failed:",r))}return!1}getEventListener(){return this.eventListener}afterRowsMoved(){this.lastSortCompareFn=void 0,this.invalidateAggregates()}announce(e,t){e&&!this.isDestroyed()&&this.liveAnnouncer.announce(e,t)}showLoadingOverlay(e){this.tableOverlay.showLoading(e)}showNoRowsOverlay(e){this.tableOverlay.showNoRows(e)}hideOverlay(){this.tableOverlay.hide()}getOverlayState(){return this.tableOverlay.getState()}onOverlayChanged(e){this.isDestroyed()||(e.kind==="loading"?(this.setHostAriaAttribute("aria-busy","true"),this.tableOverlay.isBlocking()&&(this.hideHoverRow(),this.hideHoverColumn())):e.previous==="loading"&&(this.restoreHostAriaAttribute("aria-busy"),this.liveAnnouncer.cancel(this.lastLoadingAnnouncement)),e.kind==="loading"&&(this.lastLoadingAnnouncement=e.text),(e.kind==="loading"||e.kind==="noRows"&&this.initialized)&&this.announce(e.text))}announceCopied(e){this.announce(this.ariaTexts.copied(this.countCopiedCells()))}countCopiedCells(){const e=this.selectionModel();if(!(e!=null&&e.hasSelection()))return 1;const t=this.tableModel.getBodyModel().getRowCount(),s=this.tableModel.getColumnCount(),o=u=>{var f,g;return((g=(f=this.tableModel.getColumnDef(u))==null?void 0:f.isVisible)==null?void 0:g.call(f))!==!1};let i=0;for(let u=0;u<s;u++)o(u)&&i++;if(e.isAllSelected())return t*i;const r=e.getRanges();if(!r.length)return 1;const n=Math.max(0,Math.min(...r.map(u=>u.r1))),l=Math.min(t-1,Math.max(...r.map(u=>u.r2))),c=Math.max(0,Math.min(...r.map(u=>u.c1))),h=Math.min(s-1,Math.max(...r.map(u=>u.c2)));if((l-n+1)*(h-c+1)>Le.maxCopyCells)return 0;let d=0;for(let u=n;u<=l;u++)for(let f=c;f<=h;f++)o(f)&&e.isSelected(u,f)&&d++;return d}getHeaderFocus(){return this.headerFocus?[this.headerFocus[0],this.headerFocus[1]]:void 0}setFocusCell(e,t){const s=this.focusModel();return s?(this.headerFocus=void 0,s.setFocus(e,t),this.ensureColumnIsVisible(t),this.ensureRowIsVisible(e),this.repaint(),!0):!1}getFirstShownColumnIndex(){return this.getNextShownColumnIndex(-1,1,this.tableModel.getColumnCount())}getLastShownColumnIndex(){const e=this.tableModel.getColumnCount();return this.getNextShownColumnIndex(e,-1,e)}onBodyNavigation(e){const t=this.focusModel();if(!["NAVIGATE_ROW_START","NAVIGATE_ROW_END","NAVIGATE_FIRST_CELL","NAVIGATE_LAST_CELL","NAVIGATE_PAGE_UP","NAVIGATE_PAGE_DOWN","ACTIVATE_CELL"].includes(e))return;if(!t||this.isEditing())return!1;const o=this.tableModel.getBodyModel().getRowCount();if(o<1||this.tableModel.getColumnCount()<1)return!1;const[i,r]=t.getFocus(),n=Math.min(Math.max(i,0),o-1),l=r<0?this.getFirstShownColumnIndex():r,c=Math.max(1,this.displayedRowCount-1);switch(e){case"NAVIGATE_ROW_START":return this.setFocusCell(n,this.getFirstShownColumnIndex());case"NAVIGATE_ROW_END":return this.setFocusCell(n,this.getLastShownColumnIndex());case"NAVIGATE_FIRST_CELL":return this.setFocusCell(0,this.getFirstShownColumnIndex());case"NAVIGATE_LAST_CELL":return this.setFocusCell(o-1,this.getLastShownColumnIndex());case"NAVIGATE_PAGE_UP":return this.setFocusCell(Math.max(0,n-c),l);case"NAVIGATE_PAGE_DOWN":return this.setFocusCell(Math.min(o-1,n+c),l);default:return i<0||r<0?!1:this.activateBodyCell(i,r)}}activateBodyCell(e,t){var r;const s=this.tableModel.getBodyModel();if(s.isRowCheckable(e)&&(this.tableOptions.showCheckboxWihoutExtraColumn&&t===this.getFirstDataColumnIndex()||Os(s.getCellRenderer(e,t))))return this.toggleRowCheckbox(e,t,"body"),!0;if((r=this.masterDetailService)!=null&&r.isMasterAt(e))return this.toggleDetail(e,"keyboard");const i=s.getRowByIndex(e);if(L(i)&&B(s)&&s.hasDisplayedChildren(i)){const n=i;return this.setTreeRowExpanded(n,!n.expanded)}return!1}moveFocusIntoHeader(){const e=this.focusModel();if(!e||this.isEditing()||this.headerFocus)return!1;const[t,s]=e.getFocus(),o=this.getAriaGridInfo().headerRowCount,i=this.tableModel.getBodyModel().getRowCount()<1;return t!==0&&!i||o<1||this.tableModel.getColumnCount()<1?!1:(this.setHeaderFocus(o-1,s<0?this.getFirstShownColumnIndex():s),!0)}setHeaderFocus(e,t){var o;const s=(o=this.colAndRowspanModels.header)==null?void 0:o.getRanges().find(i=>i.isInRange(e,t));this.headerFocus=s?[s.r1,s.c1]:[e,t],this.ensureColumnIsVisible(this.headerFocus[1]),this.repaint()}onHeaderAction(e){const[t,s]=this.headerFocus,o=this.tableModel.getAreaModel("header"),i=this.getAriaGridInfo().headerRowCount,r=this.tableModel.getColumnCount(),n=Math.max(1,o.getColspanAt(t,s)||1),l=Math.max(1,o.getRowspanAt(t,s)||1);switch(e){case"NAVIGATE_LEFT":{const c=this.getNextShownColumnIndex(s,-1,r);return c!==s&&this.setHeaderFocus(t,c),!0}case"NAVIGATE_RIGHT":{const c=this.getNextShownColumnIndex(s+n-1,1,r);return c>s+n-1&&this.setHeaderFocus(t,c),!0}case"NAVIGATE_ROW_START":return this.setHeaderFocus(t,this.getFirstShownColumnIndex()),!0;case"NAVIGATE_ROW_END":return this.setHeaderFocus(t,this.getLastShownColumnIndex()),!0;case"NAVIGATE_UP":return t>0&&this.setHeaderFocus(t-1,s),!0;case"NAVIGATE_DOWN":return t+l<i?(this.setHeaderFocus(t+l,s),!0):this.tableModel.getBodyModel().getRowCount()<1?!0:this.setFocusCell(Math.max(0,this.firstFullVisibleRowIndex),s);case"NAVIGATE_FIRST_CELL":case"NAVIGATE_LAST_CELL":case"NAVIGATE_PAGE_UP":case"NAVIGATE_PAGE_DOWN":this.headerFocus=void 0;return;case"ACTIVATE_CELL":return this.activateHeaderCell(t,s,l,i);case"START_EDITING":case"TOGGLE_SELECTION":return!0;default:return}}activateHeaderCell(e,t,s,o){var l;const i=this.tableModel.getAreaModel("header"),r=i.getValueAt(e,t);if(r&&typeof r=="object"&&r.toggle&&r.visibility!=="always"&&"toggleHeaderGroup"in i){const c=new Ct(null,this);return c.rowIdx=e,c.colIdx=t,c.areaIdent="header",c.areaModel=i,this.toggleHeaderGroup(c),this.setHeaderFocus(e,t),!0}const n=this.tableModel.getColumnDef(t);return e+s>=o&&((l=n==null?void 0:n.sortable)!=null&&l.call(n))?(this.sortByColumn(t),!0):!1}cancelEditing(e){if(e instanceof HTMLSelectElement){const t=Array.from(e.options).find(s=>s.defaultSelected);e.selectedIndex=t?t.index:-1}else e&&(e.value=e.defaultValue);this.resetEditorRenderer(),this.hostElement.focus(),this.repaint()}updateModelValueAfterEdit(e,t,s,o){var n;if(e!=="body")return;const i=()=>{this.resetEditorRenderer()};if((n=this.batchEditService)!=null&&n.isActive()){i(),this.markPending([{rowIndex:t,column:s,value:o}],!1),this.repaint(),this.hostElement.focus();return}const r=this.writeCellsInternal([{rowIndex:t,columnIndex:s,value:o}],"edit",{beforeRepaint:i});(r.changes.length||r.invalid)&&(r.changes.length||(i(),this.repaint()),this.hostElement.focus())}applyCellChanges(e,t="api"){var o;const s=this.resolveCellChanges(e);if(!s.length)return[];if((o=this.batchEditService)!=null&&o.isActive()){const i=this.markPending(s.map(r=>({rowIndex:r.rowIndex,column:r.columnIndex,value:r.value})),!0);return this.repaint(),i}return this.writeCellsInternal(s,t,{}).changes}writeCells(e,t,s={}){return this.writeCellsInternal(e,t,s).changes}writeCellsInternal(e,t,s){var g,p,m,b,w,y,x;const o=this.tableModel.getBodyModel(),i=o.getRowCount(),r=X(o)?o.getBuildCount():0,n=[];let l=0,c="";const h=()=>{for(const{rowIndex:R,columnIndex:M,value:D}of e){if(!s.skipValidation){const v=this.validateCellValue(R,M,this.pipeCellValue(R,M,D));if(v){l++,c=c||v;continue}}const F=o.getValueAt(R,M);o.setValue(R,M,D)&&n.push({row:this.rowObjectOf(R),rowIndex:R,columnIndex:M,property:this.batchEditService.propertyOf(M),oldValue:F,newValue:o.getValueAt(R,M)})}};X(o)?o.batch(h):h(),l&&this.announce(this.getEditTexts().invalidValue(c));const d=(g=s.extraChanges)!=null&&g.length?[...n,...s.extraChanges]:n;if(!d.length)return{changes:d,invalid:l};(p=s.beforeRepaint)==null||p.call(s);const u=(m=s.extraChanges)!=null&&m.length?void 0:{area:"body",rowIndices:n.map(R=>R.rowIndex)};if(this.invalidateAggregates(u),X(o)&&o.getBuildCount()!==r||o.getRowCount()!==i||t==="commit"?this.repaintHard():this.repaint(),this.invalidateAggregates(u),t==="edit"&&d.length===1){const R=Ne.createSingle(d[0].rowIndex,d[0].columnIndex);R.changes=d,R.source=t,(w=(b=this.eventListener).onModelChanged)==null||w.call(b,R)}else(x=(y=this.eventListener).onModelChanged)==null||x.call(y,Ne.createForChanges(d,t));return{changes:d,invalid:l}}markPending(e,t){const o=(t?e.map(i=>({rowIndex:i.rowIndex,columnIndex:i.column,value:i.value})):this.resolveCellChanges(e,!1)).map(({rowIndex:i,columnIndex:r,value:n})=>{const l=this.pipeCellValue(i,r,n),c=this.validateCellValue(i,r,l);return{rowIndex:i,columnIndex:r,value:l,rawValue:n,...c?{error:c}:{}}});return this.batchEditService.addPending(o)}resolveCellChanges(e,t=!0){var l,c;const s=this.tableModel.getBodyModel(),o=s.getRowCount(),i=this.tableModel.getColumnCount(),r=((c=(l=this.tableModel).getColumnDefs)==null?void 0:c.call(l))??[],n=[];for(const h of e){const d=typeof h.column=="number"?h.column:r.findIndex(f=>f.property===h.column),u=h.rowIndex;u>=0&&u<o&&d>=0&&d<i&&(t&&!s.isEditable(u,d)||n.push({rowIndex:u,columnIndex:d,value:h.value}))}return n}pipeCellValue(e,t,s){var i;const o=(i=this.tableModel.getColumnDef(t))==null?void 0:i.editInputPipe;return o?o(s,e,t):s}validateCellValue(e,t,s){var r;const o=(r=this.tableModel.getColumnDef(t))==null?void 0:r.validate;if(!o)return;const i=o(s,this.rowObjectOf(e));return i?String(i):void 0}rowObjectOf(e){const t=this.tableModel.getBodyModel().getRowByIndex(e);return L(t)?t.data:t}getFillHandleOptions(){return at.create(this.tableOptions.fillHandle)}fillRange(e,t,s,o="auto",i){const r=this.getFillHandleOptions()??at.create(!0),n=this.tableModel.getBodyModel(),l=n.getRowCount(),c=this.tableModel.getColumnCount(),h=this.normalizeRange(e,l,c);if(!h||s<1)return 0;const d=t==="down"?l-1-h.r2:t==="up"?h.r1:t==="right"?c-1-h.c2:h.c1,u=Math.min(s,d);if(u<1)return 0;const f=t==="down"||t==="up"?h.c2-h.c1+1:h.r2-h.r1+1;if(u*f>r.maxCells)return this.announce(this.getEditTexts().fillTooLarge(r.maxCells)),-1;const g=this.batchEditService,p=Oi({source:h,direction:t,count:u,mode:o,getValue:(w,y)=>g.getShownValue(w,y),isFillable:(w,y)=>this.tableModel.getColumnWidth(y)>0&&n.isEditable(w,y),fillValue:r.fillValue,getCellInfo:(w,y)=>{var x;return{row:this.rowObjectOf(w),property:((x=this.tableModel.getColumnDef(y))==null?void 0:x.property)??""}}}),m=this.applyCellChanges(p,"fill"),b=this.selectionModel();return b&&this.holdSelectionEvents(()=>{b.clear(),b.addSelection(i??Qs(h,t,u)),this.onSelectionChanged(b)}),this.repaint(),this.announce(this.getEditTexts().cellsFilled(m.length)),m.length}getFillSourceRange(){const e=this.selectionModel();if(!e||e.selectionType!=="range"||e.isAllSelected())return;const t=e.getRanges();if(t.length)return this.normalizeRange(t[t.length-1],this.tableModel.getBodyModel().getRowCount(),this.tableModel.getColumnCount())}normalizeRange(e,t,s){const o=Math.max(0,Math.min(e.r1,e.r2)),i=Math.min(t-1,Math.max(e.r1,e.r2)),r=Math.max(0,Math.min(e.c1,e.c2)),n=Math.min(s-1,Math.max(e.c1,e.c2));return o<=i&&r<=n?new A(o,r,i,n):void 0}fillByKeyboard(e){var r;const t=this.getFillHandleOptions(),s=e==="down";if(!t||this.isEditing()||(r=this.fillHandleService)!=null&&r.isFilling()||t.direction===(s?"horizontal":"vertical"))return!1;const o=this.getFillSourceRange();if(!o)return!1;const i=s?o.r2-o.r1:o.c2-o.c1;if(i>0){const n=s?new A(o.r1,o.c1,o.r1,o.c2):new A(o.r1,o.c1,o.r2,o.c1);this.fillRange(n,e,i,"copy")}else if(s?o.r1>0:o.c1>0){const n=s?new A(o.r1-1,o.c1,o.r1-1,o.c2):new A(o.r1,o.c1-1,o.r2,o.c1-1);this.fillRange(n,e,1,"copy",o)}return!0}setHostKeyShortcuts(e){e===void 0?this.restoreHostAriaAttribute("aria-keyshortcuts"):this.setHostAriaAttribute("aria-keyshortcuts",e)}getEditTexts(){const e=this.ariaTexts,t=new Ee;return{cellsFilled:s=>(e.cellsFilled??t.cellsFilled).call(e,s),fillTooLarge:s=>(e.fillTooLarge??t.fillTooLarge).call(e,s),pendingChanges:s=>(e.pendingChanges??t.pendingChanges).call(e,s),changesCommitted:s=>(e.changesCommitted??t.changesCommitted).call(e,s),changesDiscarded:()=>(e.changesDiscarded??t.changesDiscarded).call(e),commitBlocked:s=>(e.commitBlocked??t.commitBlocked).call(e,s),invalidValue:s=>(e.invalidValue??t.invalidValue).call(e,s)}}getApi(){return this.api}firstInit(){var t;const e=this.getAvailableColumnWidth();return e>0&&this.tableModel.setParentWidth(e),this.stateService.initBeforeModel(),this.tableModel.init(),this.stateService.initAfterModel(),(t=this.tableOptions)!=null&&t.externalFilterFunction&&this.externalFilterChanged(!1),this.stateService.initAfterFilter(),this.resetSizeOfWrapperDiv(),this.adjustContainersAndRows(),this.stateService.initAfterLayout(),this.liveAnnouncer.getElement(),this.initialized=!0,this}destroy(){var s,o,i;if(this.destroyed)return;try{this.stateService.destroy()}catch(r){console.error(r)}try{(s=this.rowDragService)==null||s.destroy()}catch(r){console.error(r)}(o=this.fillHandleService)==null||o.destroy();try{(i=this.masterDetailService)==null||i.destroy()}catch(r){console.error(r)}this.destroyed=!0,this.listenerAbortController.abort(),this.resizeHandler.disconnect();const e=this.getSelectionModel?this.getSelectionModel():void 0;e==null||e.removeEventSelectionChangedListener(this);const t=this.getFocusModel?this.getFocusModel():void 0;t==null||t.removeEventFocusChangedListener(this),this.disposeRendering(),this.tableOverlay.destroy(),this.liveAnnouncer.destroy(),this.removeHostAria(),this.hostElement.innerText=""}isEventInDetail(e){var t;return!!((t=this.masterDetailService)!=null&&t.isInLayer(e))}setDetailExpanded(e,t,s="api"){var o;return!!((o=this.masterDetailService)!=null&&o.setExpanded(e,t,s))}toggleDetail(e,t="api"){const s=this.masterDetailService;return!!s&&s.setExpanded(e,!s.isExpanded(e),t)}onDetailToggled(e,t,s,o,i=!0,r=!1){var n,l,c,h,d,u;if(r||this.invalidateRowLayout(),this.resetSizeOfWrapperDiv(),this.repaint(),i&&((l=(n=this.eventListener).onDetailExpandedChanged)==null||l.call(n,new Hi(e,t,s,o))),o==="mouse"||o==="keyboard"){const f=s?(h=(c=this.ariaTexts).detailExpanded)==null?void 0:h.call(c):(u=(d=this.ariaTexts).detailCollapsed)==null?void 0:u.call(d);f&&this.announce(f)}this.stateService.markDirty("details")}onDetailHeightChanged(){this.destroyed||(this.resetSizeOfWrapperDiv(),this.adjustAfterScrolling())}takeFocusFromDetail(e){const t=this.focusModel();if(t&&e>=0){const s=t.getFocus()[1];this.headerFocus=void 0,t.setFocus(e,s>=0?s:this.getFirstShownColumnIndex())}this.hostElement.focus({preventScroll:!0})}focusDetailMaster(e){const t=this.focusModel();if(!t||e<0)return;const s=t.getFocus()[1];this.setFocusCell(e,s>=0?s:this.getFirstShownColumnIndex())}isDestroyed(){return this.destroyed}createGeMouseEvent(e){const t=new Gt;if(t.originalEvent=e,e){const s=this.getMouseEventTarget(e);if([t.areaIdent,t.sideIdent]=this.getAreaAndSideIdentByAttr(s),t.rowIndex=this.getNumberByAttr(s,"data-row-index"),t.columnIndex=this.getNumberByAttr(s,"data-col-index"),t.action=this.getStringByAttr(s,"data-ge-action"),t.areaIdent){const o=this.tableModel.getAreaModel(t.areaIdent);t.rowTop=t.areaIdent==="body"?this.getBodyRowTop(t.rowIndex):o.getYPosByRowIndex(t.rowIndex)}t.columnLeft=this.tableModel.getXPosByColumnIndex(t.columnIndex)}return t}getMouseEventTarget(e){const t=e.target;if((t===this.scrollViewport||t===this.contentWrapperDiv||t===this.contentDiv)&&this.tableModel.getPadding().bottom>0){const s=this.scrollViewport.getBoundingClientRect(),o=e.clientX-s.left,i=e.clientY-s.top>=this.scrollViewport.clientHeight||o<this.scrollViewport.clientLeft||o>=this.scrollViewport.clientLeft+this.scrollViewport.clientWidth,r=this.hostElement.getRootNode();if(!i&&r.elementsFromPoint){const n=r.elementsFromPoint(e.clientX,e.clientY).find(l=>this.hostElement.contains(l)&&l.closest(".ge-table-footer"));if(n)return n}}return t}onMouseDown(e){this.selectionService.onMouseDown(),e.columnIndex>-1&&e.action&&["resize-column","drag-column"].includes(e.action)&&!O(this.tableModel.getColumnDef(e.columnIndex))&&(this.mouseStartWidth=this.tableModel.getColumnWidth(e.columnIndex),this.mouseStartAction=e.action,this.mouseStartColumnIndex=e.columnIndex,this.mouseStartAction==="drag-column"&&(this.firstDraggingRendering=!0,this.dragFrom=this.mouseStartColumnIndex))}mouseDraggingOnFrame(e,t){var s,o;(o=(s=this.eventListener).onMouseDragging)==null||o.call(s,e),this.mouseEvent=e,this.mouseStartColumnIndex>-1&&this.mouseStartAction==="resize-column"&&this.tableOptions.columnsResizable?this.resizeColumn(e):!this.mouseStartAction&&this.selectionService.onMouseDragging(e,t)?this.repaint():this.mouseStartAction==="drag-column"&&e.columnIndex>-1&&this.tableOptions.columnsDraggable&&(this.draggingTargetColumnIndex=Math.max(e.columnIndex,this.getFirstDataColumnIndex()),this.dragTo=this.draggingTargetColumnIndex,this.dragFrom>-1&&this.dragTo>-1&&this.dragFrom!==this.dragTo&&(this.lastDragFrom===this.dragTo&&this.lastDragTo===this.dragFrom||(this.tableModel.changeColumnOrder(this.dragFrom,this.dragTo),this.lastDragFrom=this.dragFrom,this.lastDragTo=this.dragTo,this.dragFrom=this.dragTo,this.resetSizeOfWrapperDiv(),this.adjustContainersAndRows())),t&&(this.adjustDraggingColumn(e,this.dragFrom,this.firstDraggingRendering),this.firstDraggingRendering=!1),this.repaint())}mouseDraggingEndOnFrame(e){var t,s;(s=(t=this.eventListener).onMouseDraggingEnd)==null||s.call(t,e),this.draggingTargetColumnIndex=-1,this.mouseStartAction==="resize-column"?(this.resizeColumn(e),this.stateService.markDirty("columns")):this.mouseStartAction==="drag-column"&&(this.hideDraggingColumn(),this.repaint(),this.stateService.markDirty("columns"),this.stateService.markDirty("selection")),this.mouseStartWidth=-1,this.mouseStartColumnIndex=-1,this.dragFrom=-1,this.dragTo=-1,this.firstDraggingRendering=!0,this.mouseStartAction=""}mouseMove(e){var t,s;(s=(t=this.eventListener).onMouseMoved)==null||s.call(t,e),this.adjustHoverRows(e),this.adjustHoverColumns(e)}contextmenu(e){var s,o,i,r;const t=Date.now();if(t-this.lastContextmenu<50){this.lastContextmenu=t,(s=e.originalEvent)==null||s.preventDefault(),(o=e.originalEvent)==null||o.stopImmediatePropagation();return}this.lastContextmenu=t,(r=(i=this.eventListener).onContextmenu)==null||r.call(i,e)}toggleExpandCollapseAll(e=!0){const t=this.tableModel.getBodyModel();B(t)&&(t.toggleExpandCollapseAll(e),this.allExpanded=e,this.repaintHard(),this.stateService.markDirty("tree"))}setTreeRowExpanded(e,t){const s=this.tableModel.getBodyModel();return!B(s)||e.expanded===t?!1:(e.expanded=t,s.recalcVisibleTreeRows(!1),this.repaintHard(),this.stateService.markDirty("tree"),!0)}setRowGroupBy(e){const t=this.tableModel.getBodyModel();return X(t)?(t.setGroupBy(e),Cs(this.tableModel),this.invalidateAggregates(),this.tableModel.recalcPadding(),this.repaintHard(),this.stateService.markDirty("tree"),this.stateService.markDirty("columns"),!0):!1}setPivotConfig(e,t){var o,i;const s=this.tableModel;if(!Bs(s))return!1;s.setPivotConfig(e,t),(s.getColumnDefs()??[]).forEach(r=>r.sortState=void 0),this.lastSortCompareFn=void 0,this.clearSelection(),(o=this.getFocusModel?this.getFocusModel():void 0)==null||o.clear();for(const r of["header","body","footer"])(i=this.colAndRowspanModels[r])==null||i.init();return this.invalidateAggregates(),this.firstInit(),this.repaintHard(),this.stateService.markDirty("columns"),this.stateService.markDirty("sort"),this.stateService.markDirty("tree"),this.stateService.markDirty("headerGroups"),!0}toggleRowCheckbox(e,t,s){var l,c,h;const o=this.tableModel.getAreaModel(s),i=o.isRowChecked(e),r=i===void 0||i==="semi"||i==="none";o.setRowChecked(e,r),this.repaint();const n=(l=o.rowSelectionModel)==null?void 0:l.getCheckedRows();(h=(c=this.eventListener).onCheckboxChanged)==null||h.call(c,n?n.slice():[]),this.stateService.markDirty("checked")}onMouseClicked(e,t){if(this.headerFocus=void 0,e.clickCount>1)return!1;let s=this.selectionService.onMouseClicked(e,t);if(!s&&this.getFocusModel){this.resetEditorRenderer();const o=this.getFocusModel();o&&(s=o.hasChanged(),o.clearChanged())}return s}debounceRepaint(){this.debounce(this.repaint.bind(this),1)}cancelPendingRepaint(){return this.debounceTimeout?(clearTimeout(this.debounceTimeout),this.debounceTimeout=null,!0):!1}publishGeMouseEvent(e){var t,s;(s=(t=this.eventListener).onMouseClicked)==null||s.call(t,e)}onFocusChanged(e){var t,s;(s=(t=this.eventListener).onFocusChanged)==null||s.call(t,e)}stateChanged(e){var t,s;(s=(t=this.eventListener).onStateChanged)==null||s.call(t,e)}afterRenderPass(){var e,t;(e=this.stateService)==null||e.rendered(),(t=this.fillHandleService)==null||t.update()}onSelectionChanged(e){var t,s,o;if((t=this.stateService)==null||t.markDirty("selection"),this.selectionEventsHeld>0){this.heldSelectionModel=e;return}(o=(s=this.eventListener).onSelectionChanged)==null||o.call(s,e)}holdSelectionEvents(e){var t,s;this.selectionEventsHeld++;try{e()}finally{if(this.selectionEventsHeld--,this.selectionEventsHeld===0&&this.heldSelectionModel){const o=this.heldSelectionModel;this.heldSelectionModel=void 0,(s=(t=this.eventListener).onSelectionChanged)==null||s.call(t,o)}}}externalFilterChanged(e=!0){const t=this.tableOptions.externalFilterFunction;if(t&&(e&&this.clearSelectionModel(),this.tableModel.externalFilterChanged(t),this.reapplySorting(),this.invalidateAggregates(),this.scrollViewport.scrollTo(0,0),this.tableModel.recalcHeightAndPadding(),this.resetSizeOfWrapperDiv(),this.repaint(),this.initialized)){const s=this.tableModel.getBodyModel().getRowCount();this.announce(this.ariaTexts.filtered(s),ue.filterAnnouncementDelayInMs)}}onHeaderDblClicked(e,t,s){const o=this.tableModel.getColumnDef(s);o!=null&&o.sortable&&o.sortable()&&(e.preventDefault(),e.stopPropagation(),this.sortByColumn(s))}sortByColumn(e,t){var h;const s=typeof e=="number"?e:(this.tableModel.getColumnDefs()??[]).findIndex(d=>d.property===e),o=this.tableModel.getColumnDef(s);if(!o)return!1;const i=o.sortStatesOrder?o.sortStatesOrder:this.tableOptions.sortOrder,r=o.sortState??"",n=t??i[(i.indexOf(r)+1)%i.length],l=new St(s,n),c=this.tableModel.doSort([l]);return c&&(this.invalidateAggregates(),this.lastSortCompareFn=void 0,(h=this.tableModel.getColumnDefs())==null||h.forEach(d=>d.sortState=""),o.sortState=n),this.repaint(),c&&this.stateService.sortedByColumn(n?o.property:void 0),c&&this.announce(this.ariaTexts.sorted(this.getColumnAriaLabel(s),n)),!0}scrollToPixel(e,t){const s=this.getContentScrollRangeY(),o=this.getScrollerRangeY();if(s>0&&o>0){const i=Math.min(s,Math.max(0,t)),r=i/s*o;this.scrollViewport.scrollTo(wt(e,this.isRtl()),r),this.pendingContentScroll={scrollTop:this.scrollViewport.scrollTop,contentTop:i},this.adjustAfterScrolling();return}this.scrollViewport.scrollTo(wt(e,this.isRtl()),t)}scrollToIndex(e,t){const s=this.getBodyRowTop(t);this.scrollToPixel(this.getScrollLeftForColumnIndex(e),s)}getScrollLeftForColumnIndex(e){const t=this.scrollViewport,s=this.tableModel.getFixedLeftColumnCount(),o=this.tableModel.getColumnCount()-this.tableModel.getFixedRightColumnCount()-1;if(e>=0&&e<s)return 0;if(!(e>=s&&e<=o))return this.getViewportScrollLeft();let i=0;for(let l=s;l<e;l++)i+=this.tableModel.getColumnWidth(l);const r=this.tableModel.getContentWidthInPixel()-this.areaBodyCenterGeo.width,n=t.scrollWidth-t.clientWidth;return r<=0||n<=0?0:Math.min(1,i/r)*n}adjustAfterScrolling(){var t,s;super.adjustAfterScrolling();const e=this.scrollViewport;(s=(t=this.eventListener).onScroll)==null||s.call(t,new di(this.scrollTop,this.scrollLeft,e.scrollHeight,e.scrollWidth,e.clientHeight,e.clientWidth,this.scrollFactorY,this.scrollFactorX))}setSelectionModel(e,t=!1){var o;(o=this.selectionModel())==null||o.removeEventSelectionChangedListener(this),e.addEventSelectionChangedListener(this);const s=()=>e;this.tableOptions.getSelectionModel=s,this.getSelectionModel=s,this.selectionService.getSelectionModel=s,t&&this.repaint()}toggleHeaderGroup(e){const t=this.tableModel.getAreaModel("header");"columnDefs"in this.tableModel&&(this.tableModel.columnDefs=t.toggleHeaderGroup(e)),this.headerGroupsChanged()}setHeaderGroupCollapsed(e,t){var i;const s=this.tableModel.getAreaModel("header"),o=(i=s.setGroupClosed)==null?void 0:i.call(s,e,t);return o?("columnDefs"in this.tableModel&&(this.tableModel.columnDefs=o),this.headerGroupsChanged(),!0):!1}headerGroupsChanged(){this.firstInit(),this.stateService.markDirty("headerGroups"),this.stateService.markDirty("columns")}selectionModel(){if(this!=null&&this.getSelectionModel)return this.getSelectionModel()}focusModel(){if(this!=null&&this.getFocusModel)return this.getFocusModel()}setDragging(e){this.dragging=e,this.dragging?(this.storeColumnWidths(),this.lastDragFrom=-1,this.lastDragTo=-1):this.storedColumnWidths=[]}changeFocusCell(e,t){if(!this.isEditing()&&this.getFocusModel){const s=this.getFocusModel();if(s){const o=this.tableModel.getBodyModel().getRowCount(),i=this.tableModel.getColumnCount();if(o<1||i<1)return!1;const[r,n]=s.getFocus(),l=Math.min(Math.max(r+t,0),o-1),c=this.getNextShownColumnIndex(n,e,i);return(l!==r||c!==n)&&(s.setFocus(l,c),this.ensureColumnIsVisible(c),this.ensureRowIsVisible(l),this.repaint()),!0}}return!1}getNextShownColumnIndex(e,t,s){if(!t){const n=Math.min(Math.max(e,0),s-1);return e<0&&this.tableModel.getColumnWidth(n)<=0?this.getNextShownColumnIndex(-1,1,s):n}const o=t>0?1:-1;let i=e,r=e;for(let n=Math.abs(t);n>0;n--){for(r+=o;r>=0&&r<s&&this.tableModel.getColumnWidth(r)<=0;)r+=o;if(r<0||r>=s)break;i=r}return Math.min(Math.max(i,0),s-1)}resizeColumn(e){const t=this.isRtl()?-e.draggingX:e.draggingX;this.tableModel.setColumnWidth(this.mouseStartColumnIndex,this.mouseStartWidth+t),this.tableModel.recalcPadding(),this.resetSizeOfWrapperDiv(),this.adjustContainersAndRows()}clearSelectionModel(){var e;this.getSelectionModel&&((e=this.getSelectionModel())==null||e.clear())}calcAutoColumnWidths(){const e=this.tableModel.getBodyModel(),t=this.tableModel.getColumnCount();if(!e)return console.warn("Body model is not available."),[];const s=30,o=Array.from({length:t},()=>new Set),i=new Array(t).fill(0),r=u=>{var p,m;const f=this.tableModel.getAreaModel(u),g=(f==null?void 0:f.getRowCount())??0;for(let b=0;b<g;b++)for(let w=0;w<t;w++){const y=((p=f.getTextValueAt)==null?void 0:p.call(f,b,w))||(((m=f.getValueAt(b,w))==null?void 0:m.toString())??""),x=y.length;x>i[w]&&(i[w]=x,o[w].forEach(R=>{R.length<x-2&&o[w].delete(R)})),x>=i[w]-2&&o[w].size<s&&o[w].add(y)}};r("header"),r("body"),r("footer");const n=this.hostElement.querySelector(".ge-table-label"),l=getComputedStyle(n??this.hostElement),c=n?(parseFloat(l.paddingLeft)||0)+(parseFloat(l.paddingRight)||0):20;let h=null;try{h=document.createElement("canvas").getContext("2d")}catch{h=null}h&&(h.font=l.font||`${l.fontSize} ${l.fontFamily}`);const d=u=>h?h.measureText(u).width:u.length*8;return o.map(u=>{let f=0;return u.forEach(g=>{f=Math.max(f,d(g))}),Math.max(Math.ceil(f+c+2),50)})}setColumnWidth(e,t){this.tableModel.setColumnWidth(e,t),this.stateService.markDirty("columns")}setColumnVisible(e,t){var s,o;return(o=(s=this.tableModel).setColumnVisible)!=null&&o.call(s,e,t)?(this.recalcWrappers(),this.stateService.markDirty("columns"),!0):!1}setHeaderVisible(e){this.setAreaVisible("header",e)}setFooterVisible(e){this.setAreaVisible("footer",e)}setAreaVisible(e,t){const s=this.tableModel,o=e==="header"?s.setHeaderVisible:s.setFooterVisible;if(!o){console.warn(`set${e==="header"?"Header":"Footer"}Visible() needs a table model with this method (e.g. TableModel), this one has none:`,s);return}o.call(s,t),e==="header"&&!t&&(this.headerFocus=void 0),this.recalcWrappers()}autoResizeColumns(e=!0){const t=this.calcAutoColumnWidths();for(let s=0;s<t.length;s++){if(O(this.tableModel.getColumnDef(s)))continue;const o=t[s];this.tableModel.setColumnWidth(s,o)}e&&this.recalcWrappers(),this.stateService.markDirty("columns")}recalcWrappers(){this.tableModel.recalcPadding(),this.resetSizeOfWrapperDiv(),this.adjustContainersAndRows()}reSort(){this.reapplySorting(),this.invalidateAggregates(),this.repaint()}sort(e){var t;this.tableModel.sort(e),this.invalidateAggregates(),this.lastSortCompareFn=e,(t=this.tableModel.getColumnDefs())==null||t.forEach(s=>s.sortState=""),this.repaint(),this.stateService.sortedByColumn(void 0)}applySortItems(e){const t=this.tableModel.getColumnDefs();t==null||t.forEach(s=>s.sortState=""),e.forEach(s=>{const o=t==null?void 0:t[s.columnIndex];o&&(o.sortState=s.sortState)}),e.length&&(this.lastSortCompareFn=void 0,this.tableModel.doSort(e),this.invalidateAggregates())}reapplySorting(){var t;if(this.lastSortCompareFn){this.tableModel.sort(this.lastSortCompareFn);return}const e=[];(t=this.tableModel.getColumnDefs())==null||t.forEach((s,o)=>{s.sortState&&e.push(new St(o,s.sortState))}),e.length&&this.tableModel.doSort(e)}ensureRowIsVisible(e){if(this.hasBodyRowExtras()){const i=this.getBodyRowTop(e),r=i+this.tableModel.getRowHeight("body",e),n=this.contentScrollTop,l=this.areaBodyCenterGeo.height;return i<n?(this.scrollToPixel(this.getViewportScrollLeft(),i),!0):r>n+l?(this.scrollToPixel(this.getViewportScrollLeft(),r-l),!0):!1}const t=this.getFirstFullVisibleRowIndex(),s=this.getLastFullVisibleRowIndex(),o=this.getDisplayedRowCount();return e<t?(this.scrollToIndex(-1,e),!0):e>s?(this.scrollToIndex(-1,e-o+1),!0):!1}ensureColumnIsVisible(e){const t=this.tableModel.getFixedLeftColumnCount(),s=this.tableModel.getColumnCount()-this.tableModel.getFixedRightColumnCount()-1;if(!(e>=t&&e<=s))return!1;const o=this.tableModel.getColumnWidth(e),i=this.scrollViewport,r=this.areaBodyCenterGeo.width,n=this.tableModel.getContentWidthInPixel()-r,l=i.scrollWidth-i.clientWidth;if(o<=0||n<=0||l<=0)return!1;let c=0;for(let f=t;f<e;f++)c+=this.tableModel.getColumnWidth(f);const h=Math.min(1,Math.max(0,this.getViewportScrollLeft()/l))*n;let d;if(c<h-.5)d=c;else if(c+o>h+r+.5)d=o>r?c:c+o-r;else return!1;const u=Math.min(1,Math.max(0,d/n))*l;return this.setViewportScrollLeft(d===c?Math.floor(u):Math.ceil(u)),this.adjustAfterScrolling(),!0}};ue.actionsBlockedWhileLoading=["START_EDITING","TOGGLE_SELECTION","ACTIVATE_CELL","MOVE_ROW_UP","MOVE_ROW_DOWN","FILL_DOWN","FILL_RIGHT"],ue.filterAnnouncementDelayInMs=400;let vs=ue;class Fn extends qe{constructor(e){super(),this.onCheckboxChangedCallback=e,super.onCheckboxChanged=t=>{this.onCheckboxChangedCallback(t)}}}const Ot=class Ot{};Ot.themes=["light","combat","paper","blackboard"],Ot.vars={light:`html[data-theme="light"] {
|
|
76
76
|
--ge-table-bg: rgba(255,255,255, 0.5);
|
|
77
77
|
--ge-table-header-west-bg: rgba(233, 233, 233, 0.5);
|
|
78
78
|
--ge-table-header-center-bg: rgba(233, 233, 233, 0.5);
|
|
@@ -332,7 +332,7 @@ render scope: this.lastFullVisibleRowIndex <- `+this.lastFullVisibleRowIndex),th
|
|
|
332
332
|
--ge-table-spinner-size: 28px;
|
|
333
333
|
--ge-table-row-number-bg: var(--ge-table-header-west-bg);
|
|
334
334
|
--ge-table-row-number-color: #c9c86f;
|
|
335
|
-
}`};let bs=kt;class de{constructor(e,t=!0,s,o,i=0,r=!1,n=!1){this.data=e,this.expanded=t,this.children=s,this.parent=o,this.deep=i,this.checked=r,this.keep=n,this.type="TreeRow"}}class Me{static buildTreeRows(e,t="children",s=12,o=!0){const i=typeof t=="string"?{childrenProperty:t,deepMaxLimit:s,expanded:o}:t,r=i.childrenProperty??"children",n=i.deepMaxLimit??12,a=Me.toExpandedFn(i.expanded??!0),c=[];for(const h of e){const d=new de(h,a(h,0),[],void 0,0);c.push(Me.buildTreeRow(h,r,d,0,n,a))}return c}static buildTreeRow(e,t="children",s=new de(e,!0,[],void 0,0),o=0,i=12,r=!0){var c;const n=Me.toExpandedFn(r),a=e[t];if(a!=null&&a.length&&o>=i)return console.warn("Max deep limit reached: ",o),s;if(a)for(const h of a){const d=new de(h,n(h,o+1),[],s,o+1);(c=s.children)==null||c.push(d),Me.buildTreeRow(h,t,d,o+1,i,n)}return s}static toExpandedFn(e){return typeof e=="function"?e:()=>e}}class ae{constructor(e=34,t=34,s=34){this.header=e,this.body=t,this.footer=s}}class x{constructor(e=100,t="px"){this.value=e,this.unit=t}}class J{constructor(e,t,s=new x(100,"px"),o=new V,i=new V,r=new x(100,"px"),n=new x(100,"px"),a,c,h,d,u,f,g,p,m=()=>this.visible){this.property=e,this.headerLabel=t,this.width=s,this.classes=o,this.rendererMap=i,this.minWidth=r,this.maxWidth=n,this.sortable=a,this.sortComparator=c,this.sortState=h,this.sortStatesOrder=d,this.sortIconVisible=u,this.editable=f,this.getEditRenderer=g,this.editInputPipe=p,this.isVisible=m,this.visible=!0,s.unit!=="px"&&(this.minWidth=new x(0,"px"),this.maxWidth=new x(1e5,"px"))}static bodyRenderer(e){return new V(void 0,e,void 0)}static create(e){const t=new V(e.headerRenderer,e.bodyRenderer,e.footerRenderer),s=new V(e.headerClasses,e.bodyClasses,e.footerClasses),o=e.sortIconVisible??e.sortable,i=e.editable??e.editable??js,r=e.isVisible??e.isVisible??He,n=new J(e.property??"",e.headerLabel??"",e.width??new x(100,"px"),s,t,e.minWidth??new x(100,"px"),e.maxWidth??new x(100,"px"),e.sortable,e.sortComparator,e.sortState,e.sortStatesOrder,o,i,e.getEditRenderer,e.editInputPipe,r);return e.formula!==void 0&&e.formula!==null?(n.formula=e.formula,n.valueGetter=zs(e.formula,e.formulaOptions)):e.valueGetter&&(n.valueGetter=e.valueGetter),e.valueSetter&&(n.valueSetter=e.valueSetter),e.showValuesAs&&(n.showValuesAs=e.showValuesAs),e.rowDrag!==void 0&&(n.rowDrag=e.rowDrag),e.validate&&(n.validate=e.validate),n}}const Cn=new x(500,"px"),xn=new x(400,"px"),Ti=new x(300,"px"),Sn=new x(290,"px"),vn=new x(280,"px"),Rn=new x(270,"px"),An=new x(260,"px"),Mn=new x(250,"px"),En=new x(240,"px"),Tn=new x(230,"px"),In=new x(220,"px"),Dn=new x(210,"px"),St=new x(200,"px"),kn=new x(190,"px"),Fn=new x(180,"px"),Pn=new x(170,"px"),Vn=new x(160,"px"),Ln=new x(150,"px"),On=new x(140,"px"),Nn=new x(130,"px"),Bn=new x(120,"px"),_n=new x(110,"px"),Hn=new x(100,"px"),$n=new x(90,"px"),Gn=new x(80,"px"),Wn=new x(70,"px"),Un=new x(60,"px"),zn=new x(50,"px"),jn=new x(40,"px"),Kn=new x(30,"px"),Yn=new x(20,"px"),Xn=new x(10,"px"),Jn=new x(0,"px");class j extends Gt{constructor(e,t,s,o=[]){super(e,o,s),this.areaIdent=e,this.arr=t,this.defaultRowHeight=s,this.columnDefs=o,this.filteredArr=[...t]}externalFilterChanged(e){this.filteredArr=this.arr?this.arr.filter(e):[]}getRowCount(){return this.filteredArr?this.filteredArr.length:0}getUnfilteredRowCount(){var e;return((e=this.arr)==null?void 0:e.length)??0}canMoveRows(e,t){return Wt(this.filteredArr.length,this.arr.length,e,t)}moveRows(e,t){return Gs(this.filteredArr,this.arr,e,t)}getValueAt(e,t){return this.filteredArr[e][t]}setValue(e,t,s){var r;const o=(r=this.columnDefs[t])==null?void 0:r.editInputPipe;o&&(s=o(s,e,t));const i=this.filteredArr[e];return i?(i[t]=s,!0):!1}getRowByIndex(e){return this.filteredArr[e]}getRowHeight(e){return this.defaultRowHeight}getConstantRowHeight(){return this.getRowHeight===j.prototype.getRowHeight&&this.defaultRowHeight>0?this.defaultRowHeight:void 0}changeColumnOrder(e,t){this.filteredArr.forEach(s=>this.arrayMove(s,e,t)),super.changeColumnOrder(e,t)}}class W{constructor(e="body"){this.areaIdent=e,this.rowSelectionModel=void 0}sort(e){}getRowCount(){return 0}getValueAt(e,t){return""}getTextValueAt(e,t){return""}getCellRenderer(e,t){}getRowHeight(e){return 0}getColspanAt(e,t){return 0}getCustomClassesAt(e,t){return[]}getCustomStyleAt(e,t){}getRowspanAt(e,t){return 0}getRowByIndex(e){}isRowCheckable(e){return!1}isRowChecked(e){}setRowChecked(e,t){}getTooltipAt(e,t){return""}getMaxColspan(){return 0}getMaxRowspan(){return 0}getYPosByRowIndex(e){return 0}init(){}externalFilterChanged(e){}isFilterable(){return!1}doSort(e){return!1}isEditable(e,t){return!1}setValue(e,t,s){return!1}isSelectable(e,t){return!1}changeColumnOrder(e,t){}}class Ii{flattenTree(e,t=[]){var s;for(const o of e)this.isVisible(o)&&(t.push(o),o.expanded&&((s=o.children)!=null&&s.length)&&this.flattenVisibleChildren(o.children,t));return t}flattenVisibleChildren(e,t){var s;for(const o of e)t.push(o),o.expanded&&((s=o.children)!=null&&s.length)&&this.flattenVisibleChildren(o.children,t)}isVisible(e){return e.parent?e.parent.expanded?this.isVisible(e.parent):!1:!0}}class Se extends Gt{constructor(e,t,s,o=[]){super(e,o,s),this.areaIdent=e,this.rows=t,this.defaultRowHeight=s,this.columnDefs=o,this.type="AreaModelTree",this.sorterService=new Bs,this.service=new Ii,this.filteredFlattenRows=[],this.flattenRows=[],this.keepMarked=!1,this.showValuesCache=new Map,this.properties=o.map(i=>i.property),this.refreshDisplayedRows()}changeColumnOrder(e,t){this.arrayMove(this.properties,e,t),super.changeColumnOrder(e,t)}recalcVisibleTreeRows(e=!0){this.refreshDisplayedRows(e)}getDisplayedRootRows(){return this.lastPredictFn?this.rows.filter(e=>e.keep):this.rows}hasDisplayedChildren(e){var t;return(t=e.children)!=null&&t.length?!this.lastPredictFn||e.children.some(s=>s.keep):!1}getDisplayedChildren(e){var t;return(t=e.children)!=null&&t.length?this.lastPredictFn?e.children.filter(s=>s.keep):e.children:[]}getLeafRows(e=!0){const t=!e||!this.lastPredictFn;return this.collectAllRows(this.rows??[],[]).filter(s=>{var o;return!((o=s.children)!=null&&o.length)&&(t||s.keep)})}getFilteredFlattenRows(){return this.filteredFlattenRows}getRowCount(){return this.filteredFlattenRows.length}getUnfilteredRowCount(){return this.flattenRows.length}canMoveRows(e,t){if(this.getRowCount()!==this.getUnfilteredRowCount())return!1;const s=this.getDragRows(e);return s.length>0&&$s(s,this.getRowByIndex(t.rowIndex))}moveRows(e,t){if(!this.canMoveRows(e,t))return!1;const s=this.getRowByIndex(t.rowIndex),o=_o(this.rows,this.getDragRows(e),s,t.position);return o&&(this.showValuesCache.clear(),this.invalidateColumnValues(),this.refreshDisplayedRows(!0)),o}getDragRows(e){const t=xe(e,this.getRowCount()).map(s=>this.getRowByIndex(s)).filter(s=>!!s);return Hs(t)}getValueAt(e,t){const s=this.getRowByIndex(e);if(s){const o=this.properties[t];if(o){const i=this.getRawValueOfRow(s,o),r=this.getColumnValues().getShowValuesAs(o);return r?this.applyShowValuesAs(s,o,i,r):i}}return""}getRawValueOfRow(e,t){return this.getColumnValues().getter(t)?this.getColumnValues().get(e.data,t):t.includes(".")?this.getPropertyValue(e.data,t.split(".")):e.data[t]}getTextValueAt(e,t){const s=this.getValueAt(e,t);return this.getCalculatedText(this.properties[t],s)??""+s}getCellRenderer(e,t){return super.getCellRenderer(e,t)??this.getCalculatedRenderer(this.properties[t])}getTooltipAt(e,t){const s=this.properties[t];if(s!==void 0&&this.getColumnValues().isCalculated(s)){const o=this.getValueAt(e,t);if(v(o))return o.message}return super.getTooltipAt(e,t)}invalidateDerivedValues(e){this.invalidateColumnValues(),this.showValuesCache.clear()}applyShowValuesAs(e,t,s,o){if(v(s))return s;let i=this.showValuesCache.get(t);switch(i||(i={byRow:new Map},this.showValuesCache.set(t,i)),o.mode){case"percentOfColumnTotal":case"percentOfGrandTotal":return i.total===void 0&&(i.total=$t(this.getLeafRows(!0).map(r=>this.getRawValueOfRow(r,t)))),typeof s=="number"&&!Number.isNaN(s)&&i.total!==0?s/i.total:void 0;case"percentOfRowTotal":return s;default:{if(!i.byRow.has(e)){const r=e.parent?this.getDisplayedChildren(e.parent):this.getDisplayedRootRows(),n=Ns(r.map(a=>this.getRawValueOfRow(a,t)),o.mode);r.forEach((a,c)=>i.byRow.set(a,n[c]))}return i.byRow.get(e)}}}readPropertyPath(e,t){return t.includes(".")?this.getPropertyValue(e,t.split(".")):e[t]}getAggregationSourceForValues(){return{signal:this.rows,length:this.rows.length,rows:()=>this.getLeafRows(!0).map(e=>e.data)}}getRowHeight(e){return this.defaultRowHeight}getConstantRowHeight(){return this.getRowHeight===Se.prototype.getRowHeight&&this.defaultRowHeight>0?this.defaultRowHeight:void 0}getCustomClassesAt(e,t){const s=this.filteredFlattenRows[e];return this.addCalculatedClasses(["ge-table-tree-cell","ge-table-tree-deep-"+s.deep],this.properties[t],()=>this.getValueAt(e,t))}getRowByIndex(e){return this.filteredFlattenRows[e]}getValueByT(e,t){if(!e||!t)return;const s=this.getColumnValues();return s.getter(t)?s.get(e,t):t.includes(".")?this.getPropertyValue(e,t.split(".")):e[t]}externalFilterChanged(e){this.lastPredictFn=e,this.showValuesCache.clear(),this.invalidateColumnValues(),this.refreshDisplayedRows(!0)}doSort(e){if(!e.length)return!1;const t=e.map(({columnIndex:s,sortState:o})=>{const i=o==="asc"?1:o==="desc"?-1:0;return this.genericTreeTableSortComparator(this.properties[s],i)});return this.showValuesCache.clear(),this.treeSortWith(this.rows,(s,o)=>{for(const i of t){const r=i(s,o);if(r)return r}return 0}),this.refreshDisplayedRows(!1),!0}sort(e){this.showValuesCache.clear(),this.treeSortWith(this.rows,e),this.refreshDisplayedRows(!1)}toggleExpandCollapseAll(e){this.expandAllRecursive(this.rows,e),this.refreshDisplayedRows(!1)}setAllParentsOk(e){return e.parent&&(e.parent.keep=!0,this.setAllParentsOk(e.parent)),!1}setValue(e,t,s){var r;const o=(r=this.columnDefs[t])==null?void 0:r.editInputPipe;o&&(s=o(s,e,t));const i=this.getRowByIndex(e);if(i){const n=i.data,a=this.columnDefs[t];if(this.areaIdent==="body"&&(a!=null&&a.valueGetter))return this.setCalculatedValue(n,a,s);const c=this.columnDefs[t].property;return c.includes(".")?this.setPropertyValue(n,c.split("."),s):(n[c]=s,!0)}return!1}genericTreeTableSortComparator(e,t){const s=this.columnDefs.find(n=>n.property===e),o=this.getColumnValues().isCalculated(e),i=o?new Map:void 0,r=n=>{if(!i)return this.getValueByT(n,e);if(i.has(n))return i.get(n);const a=this.getValueByT(n,e),c=v(a)?void 0:a;return i.set(n,c),c};return(n,a)=>{const c=r(n.data),h=r(a.data);return o&&(c===void 0||h===void 0)?c===h?0:c===void 0?1:-1:s!=null&&s.sortComparator?t*s.sortComparator(c,h,n.data,a.data,t):this.sorterService.genericSortComparator(c,h,t)}}expandAllRecursive(e,t){for(const s of e)s.expanded=t,s.children&&this.expandAllRecursive(s.children,t)}refreshDisplayedRows(e=!0){if(this.flattenRows=this.service.flattenTree(this.rows??[]),!this.lastPredictFn){this.filteredFlattenRows=[...this.flattenRows];return}(e||!this.keepMarked)&&(this.markKeptRows(this.lastPredictFn),this.keepMarked=!0),this.filteredFlattenRows=this.flattenRows.filter(t=>t.keep)}markKeptRows(e){const t=this.collectAllRows(this.rows??[],[]);t.forEach(s=>s.keep=!1),t.forEach((s,o)=>{if(e(s,o,t)){s.keep=!0;for(let i=s.parent;i&&!i.keep;i=i.parent)i.keep=!0}})}collectAllRows(e,t){var s;for(const o of e)t.push(o),(s=o.children)!=null&&s.length&&this.collectAllRows(o.children,t);return t}getPropertyValue(e,t){const s=t.shift();let o=e[s];return o&&t.length?this.getPropertyValue(o,t):o}treeSortWith(e,t){e.sort(t);for(const s of e)s.children&&this.treeSortWith(s.children,t)}}class Oe{constructor(e=[]){this.allRootNodes=e}checkRow(e,t){this.setCheckedRecursive(e,t),this.autoCheckParent(e.parent)}checkAll(e=this.allRootNodes){for(const s of e)this.uncheckRecursive(s);const t=new Set;for(const s of e)s.parent&&t.add(s.parent);t.forEach(s=>this.autoCheckParent(s))}getCheckedRows(){const e=[];return this.addSelectedRecursive(this.allRootNodes,e),e}isRowChecked(e){return e.checked?"full":this.hasMixedDescendants(e)?"semi":"none"}hasMixedDescendants(e){let t=!1,s=!1;const o=i=>{for(const r of i??[])if(r.checked?t=!0:s=!0,t&&s||o(r.children))return!0;return!1};return o(e.children)}setCheckedRecursive(e,t){if(e.checked=t,e.children)for(const s of e.children)this.setCheckedRecursive(s,t)}setCheckedRows(e){this.addCheckedRows(e)}addCheckedRows(e){for(const t of e)t.checked=!0}autoCheckParent(e){if(e){const t=this.areAllChildrenChecked(e),s=this.areAllChildrenUnchecked(e);t?e.checked=!0:e.checked=!1,this.autoCheckParent(e.parent)}}areAllChildrenChecked(e){var t,s;if((t=e.children)!=null&&t.length){for(const o of e.children)if(!o.checked||(s=o.children)!=null&&s.length&&!this.areAllChildrenChecked(o))return!1}return!0}areAllChildrenUnchecked(e){var t,s;if((t=e.children)!=null&&t.length){for(const o of e.children)if(o.checked||(s=o.children)!=null&&s.length&&!this.areAllChildrenUnchecked(o))return!1}return!0}uncheckRecursive(e){if(e.checked=!1,e.children)for(const t of e.children)this.uncheckRecursive(t)}addSelectedRecursive(e,t){for(const s of e)s.checked&&t.push(s),s.children&&this.addSelectedRecursive(s.children,t)}}class vt{constructor(e=0,t=0,s=0,o=0){this.top=e,this.right=t,this.bottom=s,this.left=o}}class Di{constructor(){this.checkedRows=[]}getCheckedRows(){return this.checkedRows}setCheckedRows(e){this.checkedRows=e}addCheckedRows(e){this.checkedRows||(this.checkedRows=[]);for(const t of e)this.checkedRows.includes(t)||this.checkedRows.push(t)}checkRow(e,t){this.checkedRows||(this.checkedRows=[]),t?this.checkedRows.includes(e)||this.checkedRows.push(e):this.removeSelectedRow(e)}isRowChecked(e){return this.checkedRows&&this.checkedRows.includes(e)?"full":"none"}checkAll(e){this.checkedRows=[]}removeSelectedRow(e){if(this.checkedRows){const t=this.checkedRows.indexOf(e);t>-1&&this.checkedRows.splice(t,1)}}}class qn{constructor(e){this.bodyAreaModel=e}getCheckedRows(){var e;return((e=this.bodyAreaModel.rowSelectionModel)==null?void 0:e.getCheckedRows())??[]}setCheckedRows(e){var t;(t=this.bodyAreaModel.rowSelectionModel)==null||t.setCheckedRows(e)}addCheckedRows(e){var t;(t=this.bodyAreaModel.rowSelectionModel)==null||t.addCheckedRows(e)}checkRow(e,t){const s=this.bodyAreaModel.rowSelectionModel;if(s instanceof Oe){this.getTopTreeRows().forEach(o=>s.checkRow(o,t));return}this.checkAll(t?this.getBodyRows():[])}isRowChecked(e){const t=this.bodyAreaModel.rowSelectionModel;if(t instanceof Oe){const a=this.getTopTreeRows().map(c=>t.isRowChecked(c));return!a.length||a.every(c=>c==="none")?"none":a.every(c=>c==="full")?"full":"semi"}const s=this.getCheckedRows(),o=this.bodyAreaModel.getRowCount();if(!s.length||!o)return"none";if(s.length<o)return"semi";const i=this.cache;if(i&&i.checkedRows===s&&i.checkedCount===s.length&&i.rowCount===o)return i.state;const r=new Set(s);let n="full";for(let a=0;a<o;a++)if(!r.has(this.bodyAreaModel.getRowByIndex(a))){n="semi";break}return this.cache={checkedRows:s,checkedCount:s.length,rowCount:o,state:n},n}checkAll(e){const t=this.bodyAreaModel.rowSelectionModel;if(!t)return;if(!e.length){t.setCheckedRows([]);return}const s=new Set(t.getCheckedRows());e.forEach(o=>s.add(o)),t.setCheckedRows(Array.from(s))}getTopTreeRows(){const e=this.bodyAreaModel;return typeof e.getDisplayedRootRows=="function"?e.getDisplayedRootRows():this.getBodyRows().filter(t=>!t.parent)}getBodyRows(){const e=this.bodyAreaModel.getRowCount(),t=new Array(e);for(let s=0;s<e;s++)t[s]=this.bodyAreaModel.getRowByIndex(s);return t}}class Ke{constructor(e,t,s,o=0,i=0,r=!1,n=new ae,a=[],c=[],h=-1,d=0,u=400,f=()=>{}){var p,m,b,y;this.headerAreaModel=e,this.bodyAreaModel=t,this.footerAreaModel=s,this.fixedLeftColumnCount=o,this.fixedRightColumnCount=i,this.rowCheckboxVisible=r,this.defaultRowHeights=n,this.columnDefs=a,this.columnSizes=c,this.overridingColumnWidth=h,this.columnCount=d,this.parentSize=u,this.getSelectionModel=f,this.rowCount=0,this.contentHeightInPx=0,this.contentWidthInPx=0,this.padding=new vt(0,0,0,0),this.xPositions=[],this.headerVisible=!0,this.footerVisible=!0,e.areaIdent="header",t.areaIdent="body",s.areaIdent="footer",this.columnCount||((p=this.columnDefs)!=null&&p.length?this.columnCount=this.columnDefs.length:(m=this.columnSizes)!=null&&m.length&&(this.columnCount=(b=this.columnSizes)==null?void 0:b.length));const g=(y=this.columnDefs)==null?void 0:y[et(this.columnDefs)];Ce(g)&&!t.rowSelectionModel&&(t.rowSelectionModel=new Di),Ce(g)&&!e.rowSelectionModel&&(e.rowSelectionModel=new qn(t))}init(){this.recalcSize(this.parentSize),this.overridingColumnWidth===-1&&this.calcXPositions(),this.headerAreaModel&&this.headerAreaModel.init(),this.bodyAreaModel&&this.bodyAreaModel.init(),this.footerAreaModel&&this.footerAreaModel.init()}setParentWidth(e){this.parentSize=e}getColumnCount(){return this.columnCount}setColumnWidth(e,t){var s,o;if(t=Math.max(0,t),this.overridingColumnWidth!==-1&&(this.overridingColumnWidth=t),e>-1&&e<((s=this.columnSizes)==null?void 0:s.length)){this.columnSizes[e]=t;const i=(o=this.columnDefs)==null?void 0:o[e];i&&(i.width=new x(t,"px"))}this.overridingColumnWidth===-1&&this.calcXPositions(),this.recalcContentWidthInPx()}getColumnWidth(e){var s;const t=this.getColumnDef(e);return t&&t.isVisible&&!t.isVisible()?0:this.overridingColumnWidth!==-1?this.overridingColumnWidth:e>-1&&e<((s=this.columnSizes)==null?void 0:s.length)?this.columnSizes[e]:0}getXPosByColumnIndex(e){return e===0?0:this.overridingColumnWidth>-1?this.overridingColumnWidth*e:this.xPositions[e]}recalcSize(e){e>0&&(this.parentSize=e),this.recalcColumnWidths(e),this.recalcHeightAndPadding()}recalcHeightAndPadding(){const e=this.getAreaModel("body");this.rowCount=e.getRowCount(),this.contentHeightInPx=this.getAreaHeight("body"),this.recalcContentWidthInPx(),this.recalcPadding()}recalcPadding(){const e=this.getSideAreaWidth("west"),t=this.getSideAreaWidth("east"),s=this.headerVisible?this.getAreaHeight("header"):0,o=this.footerVisible?this.getAreaHeight("footer"):0;this.padding=new vt(s,t,o,e)}getPadding(){return this.padding}getContentHeightInPixel(){return this.contentHeightInPx}getContentWidthInPixel(){return this.contentWidthInPx}getRowHeight(e,t){return this.getAreaModel(e).getRowHeight(t)}getModel(e){return this.getAreaModel(e)}getAreaHeight(e){const t=this.getModel(e),s=t.getRowCount();if(this.defaultRowHeights[e])return s*this.defaultRowHeights[e];let o=0;for(let i=0;i<s;i++)o=o+t.getRowHeight(i);return o}getSideAreaWidth(e){const[t,s]=this.getSideStartAndEndColumnIndex(e);let o=0;for(let i=t;i<=s;i++)o=o+this.getColumnWidth(i);return o}getSideStartAndEndColumnIndex(e){const t=this.getFixedLeftColumnCount(),s=this.getFixedRightColumnCount();let o=0,i=this.columnCount-1;return e==="west"?i=t-1:e==="east"?o=this.columnCount-s:(o=t,i=this.columnCount-s-1),[o,i]}getColumnDef(e){if(e<this.columnDefs.length)return this.columnDefs[e]}getFixedLeftColumnCount(){return this.fixedLeftColumnCount}getFixedRightColumnCount(){return this.fixedRightColumnCount}getAreaModel(e){if(e==="header")return this.headerAreaModel;if(e==="body")return this.bodyAreaModel;if(e==="footer")return this.footerAreaModel;throw new Error("Wrong ident.")}getBodyModel(){return this.bodyAreaModel}isFooterVisibe(){var e;return this.footerVisible&&(((e=this.footerAreaModel)==null?void 0:e.getRowCount())??0)>0}isHeaderVisibe(){var e;return this.headerVisible&&(((e=this.headerAreaModel)==null?void 0:e.getRowCount())??0)>0}setHeaderVisible(e){this.headerVisible=e,this.recalcPadding()}setFooterVisible(e){this.footerVisible=e,this.recalcPadding()}setColumnVisible(e,t){var i;const s=this.findColumnDef(e);if(!s)return!1;Yo(s,t);const o=s;return typeof o.visible=="boolean"&&(o.visible=t),(i=this.columnDefs)!=null&&i.some(r=>{var n;return((n=r.width)==null?void 0:n.unit)==="weight"})&&this.recalcColumnWidths(this.parentSize),this.recalcContentWidthInPx(),this.recalcPadding(),this.calcXPositions(),!0}isColumnVisible(e){var s;const t=this.findColumnDef(e);return t?((s=t.isVisible)==null?void 0:s.call(t))!==!1:typeof e=="number"&&e>=0&&e<this.getColumnCount()}isRowCheckboxVisible(){return this.rowCheckboxVisible}externalFilterChanged(e){this.getAreaModel("body").externalFilterChanged(e)}doSort(e){return this.getAreaModel("body").doSort(e)}sort(e){return this.getAreaModel("body").sort(e)}getColumnDefs(){return this.columnDefs}getColumnProperty(e){return this.columnDefs?this.columnDefs[e].property:""}getBodyRowByIndex(e){return this.getBodyModel().getRowByIndex(e)}isSortable(e){var t;if(this.columnDefs&&e<this.columnDefs.length){const s=(t=this.columnDefs[e])==null?void 0:t.sortable;if(typeof s=="function")return s()}return!1}changeColumnOrder(e,t){var s,o,i;this.arrayMove(this.columnDefs,e,t),this.arrayMove(this.columnSizes,e,t),(s=this.headerAreaModel)==null||s.changeColumnOrder(e,t),(o=this.bodyAreaModel)==null||o.changeColumnOrder(e,t),(i=this.footerAreaModel)==null||i.changeColumnOrder(e,t),this.calcXPositions()}recalcColumnWidths(e){var t,s,o;if(!((t=this.columnDefs)!=null&&t.length)&&!((s=this.columnSizes)!=null&&s.length)&&(this.columnSizes=new Array(this.getColumnCount()).fill(this.overridingColumnWidth)),(o=this.columnDefs)!=null&&o.length){const i=this.columnDefs.filter(h=>{var d;return((d=h.width)==null?void 0:d.unit)==="weight"});this.columnSizes=this.columnDefs.map(h=>{if(h.width.unit==="%"&&e){let d=Math.floor(h.width.value*e/100);if(h.minWidth){const u=this.sizeToPixel(h.minWidth,e);d=Math.max(u,d)}if(h.maxWidth){const u=this.sizeToPixel(h.maxWidth,e);d=Math.min(u,d)}return d}else if(h.width.unit==="px"&&e)return h.width.value;return 0});const r=h=>{var d;return((d=h.isVisible)==null?void 0:d.call(h))!==!1},n=this.columnSizes.reduce((h,d,u)=>r(this.columnDefs[u])?h+d:h,0),a=e-n,c=i.filter(r);if(a>0&&c.length){const h=c.map(d=>d.width.value).reduce((d,u)=>d+u);for(let d=0;d<this.columnDefs.length;d++){const u=this.columnDefs[d];u.width.unit==="weight"&&r(u)&&(this.columnSizes[d]=u.width.value*a/h)}}}}sizeToPixel(e,t){return e.unit==="px"?e.value:e.unit==="%"?Math.floor(e.value*t/100):-1}findColumnDef(e){const t=this.columnDefs??[];if(typeof e=="number")return e>=0?t[e]:void 0;if(typeof e=="string"){for(const s of t)if(s.property===e)return s;return}return t.indexOf(e)>-1?e:void 0}arrayMove(e,t,s){const o=e.splice(t,1)[0];return e.splice(s,0,o),e}recalcContentWidthInPx(){this.contentWidthInPx=this.getSideAreaWidth("center")}calcXPositions(){const e=this.getColumnCount();this.xPositions=new Array(e+1),this.xPositions[0]=0;for(let t=0;t<e;t++)this.xPositions[t+1]=this.getColumnWidth(t)+this.xPositions[t]}setTableScope(e){this.tableScope=e}getTableScope(){return this.tableScope}}class ws extends K{constructor(e,t,s,o,i="ge-selected-row",r="ge-focused-row"){super(e,t,o,s,i,r),this.areaIdent=e,this.rows=t,this.columnDefs=s,this.defaultRowHeight=o}}class ki{constructor(e){this.columnDef=e,this.type="RowNumberCellRenderer"}render(e,t,s,o,i,r,n){const a=this.columnDef.getRowNumberText(t,i),c=n.createElement("div");n.addClass(c,"ge-table-label-div");const h=n.createElement("div");n.addClass(h,"ge-table-label"),n.setAttribute(h,"data-row-index",`${t}`),n.setAttribute(h,"data-col-index",`${s}`),n.setAttribute(h,"data-area",o),n.appendChild(h,n.createText(a)),n.appendChild(c,h),n.appendChild(e,c)}}class ys{constructor(){this.mode="display",this.format=Zn,this.headerLabel="#",this.exported=!1,this.minWidthInPx=36}}function Zn(l){return String(l)}class Xt{constructor(e={}){this.type="RowNumberColumnDef",this.property="RowNumberColumn",this.maxWidth=new x(400,"px"),this.classes=new V(["ge-table-row-number-header","ge-table-text-align-right"],["ge-table-row-number","ge-table-text-align-right"],["ge-table-row-number-footer"]),this.isVisible=He,this.options={...new ys,...e},this.headerLabel=this.options.headerLabel,this.width=new x(this.options.minWidthInPx,"px"),this.minWidth=new x(this.options.minWidthInPx,"px"),this.rendererMap=new V(void 0,new ki(this),void 0)}getRowNumber(e,t){if(this.options.mode==="original"){const s=this.getOriginalPosition(t.getRowByIndex(e),t);if(s!==void 0)return s+1}return e+1}getRowNumberText(e,t){return this.options.format(this.getRowNumber(e,t))}getWidestText(e){var s;let t=e.getRowCount();return this.options.mode==="original"&&this.hasAllRows(e)&&(t=((s=e.getUnfilteredRowCount)==null?void 0:s.call(e))??e.getAllRows().length),this.options.format(Math.max(1,t))}hasDefaultFormat(){return this.options.format===new ys().format}hasAllRows(e){return typeof e.getAllRows=="function"}getOriginalPosition(e,t){if(!this.hasAllRows(t))return;const s=t.getAllRows();if(!Array.isArray(s))return;let o=this.originalIndex;(!o||o.rows!==s||o.length!==s.length)&&(o=this.buildOriginalIndex(s));const i=o.index.get(e);if(i!==void 0&&s[i]===e)return i;if(i!==void 0||!o.missRebuilt){o=this.buildOriginalIndex(s),o.missRebuilt=!0;const r=o.index.get(e);return r!==void 0&&s[r]===e?r:void 0}}buildOriginalIndex(e){const t=new Map;for(let s=0;s<e.length;s++)t.has(e[s])||t.set(e[s],s);return this.originalIndex={rows:e,length:e.length,index:t,missRebuilt:!1},this.originalIndex}}class Xs{constructor(){this.areaIdent="body",this.rowSelectionModel=void 0}changeColumnOrder(e,t){}doSort(e){return!1}sort(e){}externalFilterChanged(e){}getCellRenderer(e,t){}getColspanAt(e,t){return 0}getCustomClassesAt(e,t){return[]}getCustomStyleAt(e,t){}getMaxColspan(){return 0}getMaxRowspan(){return 0}getRowByIndex(e){}getRowCount(){return 0}getRowHeight(e){return 0}getRowspanAt(e,t){return 0}getTooltipAt(e,t){}getValueAt(e,t){}getTextValueAt(e,t){return""}getYPosByRowIndex(e){const t=this.getConstantRowHeight();if(t!==void 0&&t>0)return e*t;let s=0;for(let o=0;o<e;o++)s+=this.getRowHeight(o);return s}getConstantRowHeight(){}init(){}isEditable(e,t){return!1}isFilterable(){return!1}isRowCheckable(e){return!1}isRowChecked(e){}isSelectable(e,t){return!0}setRowChecked(e,t){}setValue(e,t,s){return!1}}const Qn={sum:"Sum",count:"Count",avg:"Average",min:"Min",max:"Max",countDistinct:"Distinct",first:"First",last:"Last"},el=new Intl.NumberFormat("en-US");class ot extends Xs{constructor(e,t,s){super(),this.columnDefs=t,this.type="AreaModelAggregateFooter",this.textRenderer=new _e,this.areaIdent="footer",this.getBody=typeof e=="function"?e:()=>e,this.options=ot.toOptions(s),this.defaultRowHeight=this.options.rowHeight??34,this.footerRows=this.options.rows.map(o=>{const i=Object.keys(o.aggregates).map(r=>nt(r,o.aggregates[r]));return{row:o,specs:i,byKey:new Map(i.map(r=>[r.key,r]))}})}static toOptions(e){if(Array.isArray(e))return{rows:e};const t=e;return Array.isArray(t.rows)?t:{rows:[{aggregates:e}]}}getRowCount(){return this.footerRows.length}getRowHeight(e){return this.defaultRowHeight}getConstantRowHeight(){return this.defaultRowHeight}invalidateDerivedValues(){this.cache=void 0}getResults(e=0){return this.compute().results[e]??{}}getAggregationRowCount(){return this.compute().rowCount}isLabelCell(e,t){return e>=0&&e<this.footerRows.length&&this.getLabelColumnIndex(e)===t}getValueAt(e,t){var i;const s=this.footerRows[e],o=(i=this.columnDefs[t])==null?void 0:i.property;return!s||o===void 0?"":s.byKey.has(o)?this.getResults(e)[o]:this.isLabelCell(e,t)?this.getLabel(e):""}getTextValueAt(e,t){var r;const s=this.footerRows[e],o=(r=this.columnDefs[t])==null?void 0:r.property;if(!s||o===void 0)return"";const i=s.byKey.get(o);if(i){const n=this.getResults(e)[o];return i.format?i.format(n):Ne(n)}return this.isLabelCell(e,t)?this.getLabel(e):""}getCellRenderer(e,t){var i,r;const s=(i=this.columnDefs[t])==null?void 0:i.property,o=this.footerRows[e];if(!(!o||s===void 0))return o.byKey.has(s)?((r=this.columnDefs[t].rendererMap)==null?void 0:r.footer)??this.textRenderer:this.isLabelCell(e,t)?this.textRenderer:void 0}getCustomClassesAt(e,t){var r,n;const s=(r=this.columnDefs[t])==null?void 0:r.property;if(s!==void 0&&((n=this.footerRows[e])!=null&&n.byKey.has(s)))return["ge-table-footer-aggregate"];if(!this.isLabelCell(e,t))return[];const o=this.columnDefs[t+1];return!o||!this.footerRows[e].byKey.has(o.property)?["ge-table-footer-label","ge-table-footer-label-overflow"]:["ge-table-footer-label"]}getLabelColumnIndex(e){const t=this.footerRows[e].byKey,s=this.options.labelProperty;return s!==void 0?t.has(s)?-1:this.columnDefs.findIndex(o=>o.property===s):this.columnDefs.findIndex(o=>{var i;return!L(o)&&!Ce(o)&&((i=o.isVisible)==null?void 0:i.call(o))!==!1&&!t.has(o.property)})}getLabel(e){const{row:t,specs:s}=this.footerRows[e],o=this.getAggregationRowCount();if(typeof t.label=="string")return t.label;if(typeof t.label=="function")return t.label(o,this.getResults(e));if(this.footerRows.length>1&&s.length){const i=s[0].aggregator.name,r=Qn[i];if(r&&s.every(n=>n.aggregator===oe[i]))return r}return`${el.format(o)} ${o===1?"row":"rows"}`}getSource(){const e=this.getBody(),t=this.options.getRows;if(t)return{signal:t,getRows:()=>t(e)};const s=this.options.source==="all",o=e;if(typeof o.getFilteredRows=="function"&&typeof o.getAllRows=="function"){const r=s?o.getAllRows():o.getFilteredRows();return{signal:r,length:r.length,getRows:()=>r}}if(_(e)){const r=e;return{signal:r.rows,getRows:()=>r.getLeafRows(!s).map(n=>n.data)}}const i=e.getRowCount();return{signal:void 0,length:i,getRows:()=>i}}createIndexGetter(e,t){if(!t.getValue)return;if(typeof t.value=="string"){const o=this.columnDefs.findIndex(i=>i.property===t.value);if(o>=0)return i=>e.getValueAt(i,o)}const s=rt(t.value);return o=>s(e.getRowByIndex(o))}withCalculatedValues(e){const t=this.getBody();return typeof t.isCalculatedProperty!="function"||typeof t.getRowValue!="function"?e:e.map(s=>{const o=s.value;return!s.getValue||typeof o!="string"||!t.isCalculatedProperty(o)?s:{...s,getValue:i=>t.getRowValue(i,o)}})}compute(){const e=this.getSource(),t=this.cache;if(t&&t.signal===e.signal&&t.length===e.length)return t;const s=e.getRows(),o=this.withCalculatedValues(this.footerRows.flatMap(c=>c.specs));let i;if(typeof s=="number"){const c=this.getBody();i=vr(s,o.map(h=>({aggregator:h.aggregator,getValue:this.createIndexGetter(c,h)})))}else i=_t(s,o);let r=0;const n=this.footerRows.map(c=>{const h={};for(const d of c.specs)h[d.key]=d.aggregator.result(i[r++]);return h}),a=typeof s=="number"?s:s.length;return this.cache={signal:e.signal,length:e.length,rowCount:a,results:n},this.cache}}class Y{static createTableModel(e){var s,o,i,r,n,a,c,h,d,u,f,g,p,m,b,y;if(e.defaultRowHeights===void 0)if((s=e.tableOptions)!=null&&s.defaultRowHeights)e.defaultRowHeights=e.tableOptions.defaultRowHeights;else{if(e.defaultRowHeights=new ae,e.headerAreaModel&&"defaultRowHeight"in e.headerAreaModel){const w=e.headerAreaModel.defaultRowHeight;w>-1&&(e.defaultRowHeights.header=w)}if(e.bodyAreaModel&&"defaultRowHeight"in e.bodyAreaModel){const w=e.bodyAreaModel.defaultRowHeight;w>-1&&(e.defaultRowHeights.body=w)}if(e.footerAreaModel&&"defaultRowHeight"in e.footerAreaModel){const w=e.footerAreaModel.defaultRowHeight;w>-1&&(e.defaultRowHeights.footer=w)}}if(e.columnDefs===void 0&&((o=e.properties)!=null&&o.length?e.columnDefs=e.properties.map(w=>new J(w,w.toUpperCase(),St)):(i=e.rows)!=null&&i.length?e.columnDefs=Object.keys(e.rows[0]).map(w=>new J(w,w.toUpperCase(),St)):e.columnDefs=[]),Y.addRowNumberColumn(e),e.rowDrag){const w=(r=e.columnDefs)==null?void 0:r.find(S=>!L(S)&&!Ce(S));w&&(w.rowDrag=w.rowDrag||!0)}e.columnCount===void 0&&((n=e.columnDefs)!=null&&n.length?e.columnCount=e.columnDefs.length:(a=e.headerData)!=null&&a.length?e.columnCount=e.headerData[0].length:(c=e.columnSizes)!=null&&c.length?e.columnCount=(h=e.columnSizes)==null?void 0:h.length:console.warn('Property "columnCount" is missing and cannot be derived from other properties.')),e.headerAreaModel||((d=e.headerData)!=null&&d.length?e.headerAreaModel=new j("header",e.headerData,e.defaultRowHeights.header,e.columnDefs):(u=e.columnDefs)!=null&&u.length?e.headerAreaModel=new j("header",[e.columnDefs.map(w=>w.headerLabel)],e.defaultRowHeights.header,e.columnDefs):e.headerAreaModel=new W("header"));const t=Y.checkFooterAggregates(e);if(!e.footerAreaModel&&!t&&((f=e.footerData)!=null&&f.length?e.footerAreaModel=new j("footer",e.footerData,e.defaultRowHeights.footer,e.columnDefs):e.footerAreaModel=new W("footer")),!e.bodyAreaModel)if(e.rows)if((g=e.rows)!=null&&g.length&&F(e.rows[0])){const w=e.rows;e.bodyAreaModel=new Se("body",w,e.defaultRowHeights.body,e.columnDefs),(((p=e.columnDefs[et(e.columnDefs)])==null?void 0:p.property)==="CheckboxColumn"||(m=e.tableOptions)!=null&&m.showCheckboxWihoutExtraColumn)&&(e.bodyAreaModel.rowSelectionModel=new Oe(w))}else e.bodyAreaModel=new ws("body",e.rows,e.columnDefs,e.defaultRowHeights.body);else e.bodyData?e.bodyAreaModel=new j("body",e.bodyData,e.defaultRowHeights.body):e.bodyAreaModel=new W("body");if(t){const w=ot.toOptions(t);e.footerAreaModel=new ot(e.bodyAreaModel,e.columnDefs??[],{...w,rowHeight:w.rowHeight??e.defaultRowHeights.footer})}return e.fixedLeftColumnCount===void 0&&(e.fixedLeftColumnCount=0),e.fixedRightColumnCount===void 0&&(e.fixedRightColumnCount=0),e.rowCheckboxVisible===void 0&&(e.rowCheckboxVisible=!1),e.overridingColumnWidth===void 0&&(e.overridingColumnWidth=-1),!e.getSelectionModel&&((b=e.tableOptions)!=null&&b.getSelectionModel)&&(e.getSelectionModel=(y=e.tableOptions)==null?void 0:y.getSelectionModel),new Ke(e.headerAreaModel,e.bodyAreaModel,e.footerAreaModel??new W("footer"),e.fixedLeftColumnCount,e.fixedRightColumnCount,e.rowCheckboxVisible,e.defaultRowHeights,e.columnDefs,e.columnSizes,e.overridingColumnWidth,e.columnCount,e.parentSize,e.getSelectionModel)}static checkFooterAggregates(e){var t;if(e.footerAggregates){if(e.footerAreaModel){console.warn("TableFactory.createTableModel: footerAggregates is ignored – an own footerAreaModel is given.");return}return(t=e.footerData)!=null&&t.length&&console.warn("TableFactory.createTableModel: footerData is ignored – footerAggregates builds the footer."),e.footerAggregates}}static addRowNumberColumn(e){var i,r;if(!e.rowNumbersVisible)return;if(e.bodyData||e.headerAreaModel||e.bodyAreaModel||e.footerAreaModel){console.warn("TableFactory.createTableModel: rowNumbersVisible is ignored with bodyData or own area models (their columns would shift) – put a RowNumberColumnDef into the column definitions yourself.");return}const t=e.columnDefs??[];if(L(t[0]))return;const s=e.rowNumbersVisible===!0?{}:e.rowNumbersVisible,o=new Xt(s);if(e.columnDefs=[o,...t],e.fixedLeftColumnCount=(e.fixedLeftColumnCount??0)+1,e.columnCount!==void 0&&e.columnCount++,(i=e.headerData)!=null&&i.length){const n=e.headerData.length-1;e.headerData=e.headerData.map((a,c)=>[c===n?o.headerLabel:"",...a])}(r=e.footerData)!=null&&r.length&&(e.footerData=e.footerData.map(n=>["",...n]))}static buildByTypedRowsParam(e){return Y.buildByTypedRows(e.rows??[],e.columnDefs,e.tableOptions??new Ve,e.fixedLeftColumnCount??0,e.fixedRightColumnCount??0)}static buildByTypedRows(e,t,s=new Ve,o=0,i=0){var c;const r=s.defaultRowHeights,n=((c=t[et(t)])==null?void 0:c.property)==="CheckboxColumn";if(e!=null&&e.length&&F(e[0])){const h=e,d=new Se("body",h,r.body,t);return(n||s.showCheckboxWihoutExtraColumn)&&(d.rowSelectionModel=new Oe(h)),Y.createByAreaModelsParam({headerAreaModel:new j("header",[t.map(u=>u.headerLabel)],r.header),bodyAreaModel:d,footerAreaModel:new j("footer",[],r.footer),columnDefs:t,fixedLeftColumnCount:o,fixedRightColumnCount:i,defaultRowHeights:s.defaultRowHeights,rowCheckboxVisible:!1,columnSizes:[],columnCount:t.length,overridingColumnWidth:-1})}return Y.createByObjectArrayParam({rows:e,columnDefs:t,fixedLeftColumnCount:o,fixedRightColumnCount:i,defaultRowHeights:s.defaultRowHeights})}static createByObjectArrayParam(e){const t=e.rowCheckboxVisible!==void 0?e.rowCheckboxVisible:!1;return Y.createByObjectArray(e.rows,e.header??[],e.footer??[],e.fixedLeftColumnCount??0,e.fixedRightColumnCount??0,t,e.defaultRowHeights??new ae,e.columnDefs??[],e.columnSizes??[])}static createByAreaModels(e=new W,t,s=new W,o=0,i=0,r=!1,n=new ae,a,c=[],h=-1,d){return new Ke(e,t,s,o,i,r,n,a,c,h,d)}static createByAreaModelsParam(e){return Y.createByAreaModels(e.headerAreaModel??new W,e.bodyAreaModel,e.footerAreaModel??new W,e.fixedLeftColumnCount??0,e.fixedRightColumnCount??0,e.rowCheckboxVisible===void 0?!1:e.rowCheckboxVisible,e.defaultRowHeights,e.columnDefs??[],e.columnSizes??[],e.overridingColumnWidth??-1,e.columnCount??0)}static createByObjectArray(e,t=[],s=[],o=0,i=0,r=!1,n=new ae,a,c=[]){let h;t!=null&&t.length?h=new j("header",t,n.header,a):a!=null&&a.length?h=new j("header",[a.map(f=>f.headerLabel)],n.header,a):h=new W;const d=s?new j("footer",s,n.footer,a):new W,u=new ws("body",e,a,n.body);return new Ke(h,u,d,o,i,r,n,a,c)}}class Fi{constructor(e,t,s=200,o=300,i=0,r=0){this.items=e,this.cellRenderer=t,this.coverWidth=s,this.coverHeight=o,this.width=i,this.firstRowPaddingTop=r,this.rowSelectionModel=void 0,this.areaIdent="body",this.filteredItems=[],this.sorterService=new Bs,this.filteredItems=e}setParentWidth(e){this.width=e}getRowCount(){var e;return(e=this.filteredItems)!=null&&e.length?Math.floor(this.filteredItems.length/this.getColumnCount())+1:0}getUnfilteredRowCount(){var e;return(e=this.items)!=null&&e.length?Math.floor(this.items.length/this.getColumnCount())+1:0}getColumnCount(){return this.width?Math.floor(this.width/this.coverWidth):1}getValueAt(e,t){var s;return(s=this.filteredItems)==null?void 0:s[e*this.getColumnCount()+t]}getTextValueAt(e,t){return""}getTooltipAt(e,t){return""}getRowHeight(e){return e===0&&this.firstRowPaddingTop>0?this.firstRowPaddingTop+this.coverHeight:this.coverHeight}getCellRenderer(e,t){return this.cellRenderer}getColspanAt(e,t){return 0}getCustomClassesAt(e,t){return[]}getCustomStyleAt(e,t){}getRowspanAt(e,t){return 0}getRowByIndex(e){}isRowCheckable(e){return!0}isRowChecked(e){}setRowChecked(e,t){}getMaxColspan(){return 31}getMaxRowspan(){return 31}getYPosByRowIndex(e){const t=this.firstRowPaddingTop>0?this.firstRowPaddingTop:0;return this.coverHeight*e+t}init(){}externalFilterChanged(e){this.filteredItems=this.items.filter(e)}isFilterable(){return!0}doSort(e){if(!this.filteredItems)return!1;for(const t of e){const{sortState:s}=t,o=s==="asc"?1:s==="desc"?-1:0;this.filteredItems=this.filteredItems.sort((i,r)=>this.sorterService.genericSortComparator(i,r,o))}return!0}sort(e){this.filteredItems=this.filteredItems.sort(e)}isEditable(e,t){return!1}setValue(e,t,s){return!0}isSelectable(e,t){return!1}changeColumnOrder(e,t){}setPropertyValue(e,t,s){return!1}arrayMove(e,t,s){}}class Pi{constructor(e,t=0){this.bodyModel=e,this.paddingTop=t,this.headerAreaModel=new W,this.footerAreaModel=new W}changeColumnOrder(e,t){}isSortable(e){return!1}init(){}setParentWidth(e){this.bodyModel.width=e}getColumnCount(){return this.bodyModel.getColumnCount()}getXPosByColumnIndex(e){return e*this.getColumnWidth(e)}getAreaModel(e){return e==="header"?this.headerAreaModel:e==="footer"?this.footerAreaModel:this.bodyModel}getBodyModel(){return this.bodyModel}getFixedLeftColumnCount(){return 0}getFixedRightColumnCount(){return 0}isHeaderVisibe(){return!1}isFooterVisibe(){return!1}isRowCheckboxVisible(){return!1}getRowHeight(e,t){return this.bodyModel.getRowHeight(t)}getColumnDef(e){}getColumnDefs(){}getColumnProperty(e){return""}getBodyRowByIndex(e){return this.bodyModel.getRowByIndex(e)}getColumnWidth(e){return this.bodyModel.coverWidth}setColumnWidth(e,t){this.bodyModel.coverWidth=t}recalcSize(e){}recalcPadding(){}recalcHeightAndPadding(){}getPadding(){return new vt(0,0,0,0)}getContentHeightInPixel(){return this.paddingTop+this.bodyModel.getRowCount()*this.bodyModel.coverHeight}getContentWidthInPixel(){return this.bodyModel.getColumnCount()*this.bodyModel.coverWidth}externalFilterChanged(e){this.bodyModel.externalFilterChanged(e)}doSort(e){return this.bodyModel.doSort(e)}sort(e){this.bodyModel.sort(e)}getSelectionModel(){}setTableScope(e){this.tableScope=e}getTableScope(){return this.tableScope}}class Vi{constructor(){this.autoRestoreSortingState=!1,this.autoRestoreCollapsedExpandedState=!1,this.autoRestoreScrollPosition=!1,this.autoRestoreCheckedState=!1,this.autoRestoreSelectedState=!1,this.autoRestoreColumnLayout=!1,this.autoRestoreHeaderGroupState=!1,this.autoRestoreCustomState=!1,this.getStorageKeyFn=void 0,this.isSame=(e,t,s)=>{if(e&&t&&s.getRowId){const o=s.getRowId(e),i=s.getRowId(t);return o===i}return!1},this.getRowId=qr(e=>{if(e){for(const t of["id","uuid"]){const s=e[t];if(s!=null)return s}try{return JSON.stringify(e)}catch(t){console.error(t)}}return console.warn("autoRestoreOptions: getRowId() got no row – set an own getRowId (row, rowIndex) for models without row objects."),-1})}}class tl{static createCoverGridModel(e,t,s=200,o=300,i=0,r=0){const n=new Fi(e,t,s,o,i,r);return new Pi(n,r)}static createCoverGrisDefaultOptions(e,t=()=>"CoverGrid"){return{...new Ve,horizontalBorderVisible:!1,verticalBorderVisible:!1,footerSeparatorBorderVisible:!1,headerSeparatorBorderVisible:!1,fixedEastSeparatorBorderVisible:!1,fixedWestSeparatorBorderVisible:!1,tableTopBorderVisible:!1,tableBottomBorderVisible:!1,hoverColumnVisible:!1,hoverRowVisible:!1,defaultRowHeights:{header:0,body:e,footer:0},autoRestoreOptions:{...new Vi,getStorageKeyFn:t,autoRestoreCollapsedExpandedState:!1,autoRestoreScrollPosition:!0,autoRestoreSortingState:!1,autoRestoreSelectedState:!1}}}}const sl=["COPY_2_CLIPBOARD","START_EDITING","TOGGLE_SELECTION","SELECT_ALL","DESELECT_ALL","NAVIGATE_LEFT","NAVIGATE_RIGHT","NAVIGATE_UP","NAVIGATE_DOWN","NAVIGATE_ROW_START","NAVIGATE_ROW_END","NAVIGATE_FIRST_CELL","NAVIGATE_LAST_CELL","NAVIGATE_PAGE_UP","NAVIGATE_PAGE_DOWN","ACTIVATE_CELL","MOVE_ROW_UP","MOVE_ROW_DOWN","FILL_DOWN","FILL_RIGHT"];class Li{constructor(e,t){this.tableModel=e,this.tableOptions=t}}class Oi{constructor(e,t,s,o,i,r,n){this.emmitDataKey=e,this.emmitCancelKey=t,this.queryId=s,this.filter=o,this.sorting=i,this.startIndex=r,this.endIndex=n}}class ol extends Oi{constructor(e,t,s,o,i,r,n,a){super(e,t,s,o,i,r,n),this.rows=a}}class Ni{constructor(e,t){this.value=e,this.label=t}}class il{constructor(e,t){this.index=e,this.px=t}}const rl={body:["ge-table-text-align-left"]},nl={body:["ge-table-text-align-center"]},ll={body:["ge-table-text-align-right"]},al={header:["ge-table-text-align-left"],body:["ge-table-text-align-left"],footer:["ge-table-text-align-left"]},cl={header:["ge-table-text-align-center"],body:["ge-table-text-align-center"],footer:["ge-table-text-align-center"]},hl={header:["ge-table-text-align-right"],body:["ge-table-text-align-right"],footer:["ge-table-text-align-right"]};class Cs{constructor(){this.type="CheckboxCellRenderer"}render(e,t,s,o,i,r,n){if(i.isRowCheckable(t)){n.addClass(e,"ge-table-row-checkbox-div");const a=i.isRowChecked(t);e.innerText="";const c=n.createElement("input");n.setAttribute(c,"type","checkbox"),n.setAttribute(c,"data-area",`${o}`),n.setAttribute(c,"data-row-index",`${t}`),n.setAttribute(c,"data-col-index",`${s}`),n.setAttribute(c,"data-input-type","checkbox"),n.setAttribute(c,"tabindex","-1"),n.addClass(c,"ge-table-row-checkbox"),a==="full"&&(n.setAttribute(c,"checked",""),c.checked=!0),c.indeterminate=a==="semi",n.appendChild(e,c)}}}class dl{constructor(){this.type="CheckboxColumnDef",this.property="CheckboxColumn",this.headerLabel="",this.width=new x(50,"px"),this.minWidth=new x(50,"px"),this.maxWidth=new x(100,"px"),this.rendererMap=new V(new Cs,new Cs,void 0),this.classes=new V([],["ge-table-text-align-left"],[])}}class ul{static body(e){return new V(void 0,e,void 0)}}class fl{constructor(e="down",t){this.status=e,this.originalEvent=t}}class gl{constructor(e,t,s,o,i={}){this.area=e,this.rowIndex=t,this.columnIndex=s,this.value=o,this.cssClasses=i}}class Bi{constructor(e,t,s,o=!1,i="normal",r=void 0){this.data=e,this.property=t,this.toggle=s,this.closed=o,this.visibility=i,this.children=r,this.impl="CellGroup"}}class _i extends Bi{constructor(e,t=0,s=0,o){super(e.data,e.property,e.toggle,e.closed,e.visibility,e.children),this.rowIndex=t,this.childIndex=s,this.parent=o,this.impl="CellGroupExt",this.children=void 0,this.leftNeighbour=void 0,this.rightNeighbour=void 0,this.id=e.id}ownColumn(){return!!this.property}toString(){return this.data+""}getColumnIndex(){return this.parent?this.parent.getColumnIndex()+this.childIndex:(this.leftNeighbour,0)}isVisible(){return this.parent?this.visibility==="always"?this.parent.isVisible():this.visibility==="normal"||!this.visibility?this.parent.isVisible()&&!this.parent.closed:this.visibility==="inverted"?this.parent.isVisible()&&this.parent.closed:!0:!0}claimsSpace(){return this.isVisible()&&(this.ownColumn()||this.closed)}getColumnCount(e=this,t=0){var s;if(e!=null&&e.claimsSpace()&&t++,(s=e==null?void 0:e.children)!=null&&s.length)for(const o of e.children)t=this.getColumnCount(o,t);return t}getRowSpan(e=this,t){return e!=null&&e.claimsSpace()?t-this.getParentCount(e,0):1}getParentCount(e=this,t=0){return e.parent&&(t=t+1+this.getParentCount(e.parent,t)),t}log(e=10){const t=" ".substring(0,2*this.rowIndex),s=`${this.getColumnIndex()}`,o=`${this.getColumnCount(this)}`,i=`${this.getRowSpan(this,e)}`,r=`${this.getParentCount(this)}`,n=`${t+this.data}
|
|
335
|
+
}`};let Ss=Ot;class me{constructor(e,t=!0,s,o,i=0,r=!1,n=!1){this.data=e,this.expanded=t,this.children=s,this.parent=o,this.deep=i,this.checked=r,this.keep=n,this.type="TreeRow"}}class ke{static buildTreeRows(e,t="children",s=12,o=!0){const i=typeof t=="string"?{childrenProperty:t,deepMaxLimit:s,expanded:o}:t,r=i.childrenProperty??"children",n=i.deepMaxLimit??12,l=ke.toExpandedFn(i.expanded??!0),c=[];for(const h of e){const d=new me(h,l(h,0),[],void 0,0);c.push(ke.buildTreeRow(h,r,d,0,n,l))}return c}static buildTreeRow(e,t="children",s=new me(e,!0,[],void 0,0),o=0,i=12,r=!0){var c;const n=ke.toExpandedFn(r),l=e[t];if(l!=null&&l.length&&o>=i)return console.warn("Max deep limit reached: ",o),s;if(l)for(const h of l){const d=new me(h,n(h,o+1),[],s,o+1);(c=s.children)==null||c.push(d),ke.buildTreeRow(h,t,d,o+1,i,n)}return s}static toExpandedFn(e){return typeof e=="function"?e:()=>e}}class fe{constructor(e=34,t=34,s=34){this.header=e,this.body=t,this.footer=s}}class C{constructor(e=100,t="px"){this.value=e,this.unit=t}}class ee{constructor(e,t,s=new C(100,"px"),o=new V,i=new V,r=new C(100,"px"),n=new C(100,"px"),l,c,h,d,u,f,g,p,m=()=>this.visible){this.property=e,this.headerLabel=t,this.width=s,this.classes=o,this.rendererMap=i,this.minWidth=r,this.maxWidth=n,this.sortable=l,this.sortComparator=c,this.sortState=h,this.sortStatesOrder=d,this.sortIconVisible=u,this.editable=f,this.getEditRenderer=g,this.editInputPipe=p,this.isVisible=m,this.visible=!0,s.unit!=="px"&&(this.minWidth=new C(0,"px"),this.maxWidth=new C(1e5,"px"))}static bodyRenderer(e){return new V(void 0,e,void 0)}static create(e){const t=new V(e.headerRenderer,e.bodyRenderer,e.footerRenderer),s=new V(e.headerClasses,e.bodyClasses,e.footerClasses),o=e.sortIconVisible??e.sortable,i=e.editable??e.editable??qs,r=e.isVisible??e.isVisible??Ue,n=new ee(e.property??"",e.headerLabel??"",e.width??new C(100,"px"),s,t,e.minWidth??new C(100,"px"),e.maxWidth??new C(100,"px"),e.sortable,e.sortComparator,e.sortState,e.sortStatesOrder,o,i,e.getEditRenderer,e.editInputPipe,r);return e.formula!==void 0&&e.formula!==null?(n.formula=e.formula,n.valueGetter=Js(e.formula,e.formulaOptions)):e.valueGetter&&(n.valueGetter=e.valueGetter),e.valueSetter&&(n.valueSetter=e.valueSetter),e.showValuesAs&&(n.showValuesAs=e.showValuesAs),e.rowDrag!==void 0&&(n.rowDrag=e.rowDrag),e.validate&&(n.validate=e.validate),n}}const Ln=new C(500,"px"),Pn=new C(400,"px"),_i=new C(300,"px"),Vn=new C(290,"px"),On=new C(280,"px"),Bn=new C(270,"px"),Nn=new C(260,"px"),Hn=new C(250,"px"),_n=new C(240,"px"),$n=new C(230,"px"),Gn=new C(220,"px"),Wn=new C(210,"px"),Et=new C(200,"px"),Un=new C(190,"px"),zn=new C(180,"px"),Kn=new C(170,"px"),jn=new C(160,"px"),Yn=new C(150,"px"),Xn=new C(140,"px"),Jn=new C(130,"px"),qn=new C(120,"px"),Zn=new C(110,"px"),Qn=new C(100,"px"),ea=new C(90,"px"),ta=new C(80,"px"),sa=new C(70,"px"),oa=new C(60,"px"),ia=new C(50,"px"),ra=new C(40,"px"),na=new C(30,"px"),aa=new C(20,"px"),la=new C(10,"px"),ca=new C(0,"px");class J extends jt{constructor(e,t,s,o=[]){super(e,o,s),this.areaIdent=e,this.arr=t,this.defaultRowHeight=s,this.columnDefs=o,this.filteredArr=[...t]}externalFilterChanged(e){this.filteredArr=this.arr?this.arr.filter(e):[]}getRowCount(){return this.filteredArr?this.filteredArr.length:0}getUnfilteredRowCount(){var e;return((e=this.arr)==null?void 0:e.length)??0}canMoveRows(e,t){return Yt(this.filteredArr.length,this.arr.length,e,t)}moveRows(e,t){return Ys(this.filteredArr,this.arr,e,t)}getValueAt(e,t){return this.filteredArr[e][t]}setValue(e,t,s){var r;const o=(r=this.columnDefs[t])==null?void 0:r.editInputPipe;o&&(s=o(s,e,t));const i=this.filteredArr[e];return i?(i[t]=s,!0):!1}getRowByIndex(e){return this.filteredArr[e]}getRowHeight(e){return this.defaultRowHeight}getConstantRowHeight(){return this.getRowHeight===J.prototype.getRowHeight&&this.defaultRowHeight>0?this.defaultRowHeight:void 0}changeColumnOrder(e,t){this.filteredArr.forEach(s=>this.arrayMove(s,e,t)),super.changeColumnOrder(e,t)}}class j{constructor(e="body"){this.areaIdent=e,this.rowSelectionModel=void 0}sort(e){}getRowCount(){return 0}getValueAt(e,t){return""}getTextValueAt(e,t){return""}getCellRenderer(e,t){}getRowHeight(e){return 0}getColspanAt(e,t){return 0}getCustomClassesAt(e,t){return[]}getCustomStyleAt(e,t){}getRowspanAt(e,t){return 0}getRowByIndex(e){}isRowCheckable(e){return!1}isRowChecked(e){}setRowChecked(e,t){}getTooltipAt(e,t){return""}getMaxColspan(){return 0}getMaxRowspan(){return 0}getYPosByRowIndex(e){return 0}init(){}externalFilterChanged(e){}isFilterable(){return!1}doSort(e){return!1}isEditable(e,t){return!1}setValue(e,t,s){return!1}isSelectable(e,t){return!1}changeColumnOrder(e,t){}}class $i{flattenTree(e,t=[]){var s;for(const o of e)this.isVisible(o)&&(t.push(o),o.expanded&&((s=o.children)!=null&&s.length)&&this.flattenVisibleChildren(o.children,t));return t}flattenVisibleChildren(e,t){var s;for(const o of e)t.push(o),o.expanded&&((s=o.children)!=null&&s.length)&&this.flattenVisibleChildren(o.children,t)}isVisible(e){return e.parent?e.parent.expanded?this.isVisible(e.parent):!1:!0}}class Me extends jt{constructor(e,t,s,o=[]){super(e,o,s),this.areaIdent=e,this.rows=t,this.defaultRowHeight=s,this.columnDefs=o,this.type="AreaModelTree",this.sorterService=new Us,this.service=new $i,this.filteredFlattenRows=[],this.flattenRows=[],this.keepMarked=!1,this.showValuesCache=new Map,this.properties=o.map(i=>i.property),this.refreshDisplayedRows()}changeColumnOrder(e,t){this.arrayMove(this.properties,e,t),super.changeColumnOrder(e,t)}recalcVisibleTreeRows(e=!0){this.refreshDisplayedRows(e)}getDisplayedRootRows(){return this.lastPredictFn?this.rows.filter(e=>e.keep):this.rows}hasDisplayedChildren(e){var t;return(t=e.children)!=null&&t.length?!this.lastPredictFn||e.children.some(s=>s.keep):!1}getDisplayedChildren(e){var t;return(t=e.children)!=null&&t.length?this.lastPredictFn?e.children.filter(s=>s.keep):e.children:[]}getLeafRows(e=!0){const t=!e||!this.lastPredictFn;return this.collectAllRows(this.rows??[],[]).filter(s=>{var o;return!((o=s.children)!=null&&o.length)&&(t||s.keep)})}getFilteredFlattenRows(){return this.filteredFlattenRows}getRowCount(){return this.filteredFlattenRows.length}getUnfilteredRowCount(){return this.flattenRows.length}canMoveRows(e,t){if(this.getRowCount()!==this.getUnfilteredRowCount())return!1;const s=this.getDragRows(e);return s.length>0&&js(s,this.getRowByIndex(t.rowIndex))}moveRows(e,t){if(!this.canMoveRows(e,t))return!1;const s=this.getRowByIndex(t.rowIndex),o=Yo(this.rows,this.getDragRows(e),s,t.position);return o&&(this.showValuesCache.clear(),this.invalidateColumnValues(),this.refreshDisplayedRows(!0)),o}getDragRows(e){const t=Re(e,this.getRowCount()).map(s=>this.getRowByIndex(s)).filter(s=>!!s);return Ks(t)}getValueAt(e,t){const s=this.getRowByIndex(e);if(s){const o=this.properties[t];if(o){const i=this.getRawValueOfRow(s,o),r=this.getColumnValues().getShowValuesAs(o);return r?this.applyShowValuesAs(s,o,i,r):i}}return""}getRawValueOfRow(e,t){return this.getColumnValues().getter(t)?this.getColumnValues().get(e.data,t):t.includes(".")?this.getPropertyValue(e.data,t.split(".")):e.data[t]}getTextValueAt(e,t){const s=this.getValueAt(e,t);return this.getCalculatedText(this.properties[t],s)??""+s}getCellRenderer(e,t){return super.getCellRenderer(e,t)??this.getCalculatedRenderer(this.properties[t])}getTooltipAt(e,t){const s=this.properties[t];if(s!==void 0&&this.getColumnValues().isCalculated(s)){const o=this.getValueAt(e,t);if(S(o))return o.message}return super.getTooltipAt(e,t)}invalidateDerivedValues(e){this.invalidateColumnValues(),this.showValuesCache.clear()}applyShowValuesAs(e,t,s,o){if(S(s))return s;let i=this.showValuesCache.get(t);switch(i||(i={byRow:new Map},this.showValuesCache.set(t,i)),o.mode){case"percentOfColumnTotal":case"percentOfGrandTotal":return i.total===void 0&&(i.total=Kt(this.getLeafRows(!0).map(r=>this.getRawValueOfRow(r,t)))),typeof s=="number"&&!Number.isNaN(s)&&i.total!==0?s/i.total:void 0;case"percentOfRowTotal":return s;default:{if(!i.byRow.has(e)){const r=e.parent?this.getDisplayedChildren(e.parent):this.getDisplayedRootRows(),n=Ws(r.map(l=>this.getRawValueOfRow(l,t)),o.mode);r.forEach((l,c)=>i.byRow.set(l,n[c]))}return i.byRow.get(e)}}}readPropertyPath(e,t){return t.includes(".")?this.getPropertyValue(e,t.split(".")):e[t]}getAggregationSourceForValues(){return{signal:this.rows,length:this.rows.length,rows:()=>this.getLeafRows(!0).map(e=>e.data)}}getRowHeight(e){return this.defaultRowHeight}getConstantRowHeight(){return this.getRowHeight===Me.prototype.getRowHeight&&this.defaultRowHeight>0?this.defaultRowHeight:void 0}getCustomClassesAt(e,t){const s=this.filteredFlattenRows[e];return this.addCalculatedClasses(["ge-table-tree-cell","ge-table-tree-deep-"+s.deep],this.properties[t],()=>this.getValueAt(e,t))}getRowByIndex(e){return this.filteredFlattenRows[e]}getValueByT(e,t){if(!e||!t)return;const s=this.getColumnValues();return s.getter(t)?s.get(e,t):t.includes(".")?this.getPropertyValue(e,t.split(".")):e[t]}externalFilterChanged(e){this.lastPredictFn=e,this.showValuesCache.clear(),this.invalidateColumnValues(),this.refreshDisplayedRows(!0)}doSort(e){if(!e.length)return!1;const t=e.map(({columnIndex:s,sortState:o})=>{const i=o==="asc"?1:o==="desc"?-1:0;return this.genericTreeTableSortComparator(this.properties[s],i)});return this.showValuesCache.clear(),this.treeSortWith(this.rows,(s,o)=>{for(const i of t){const r=i(s,o);if(r)return r}return 0}),this.refreshDisplayedRows(!1),!0}sort(e){this.showValuesCache.clear(),this.treeSortWith(this.rows,e),this.refreshDisplayedRows(!1)}toggleExpandCollapseAll(e){this.expandAllRecursive(this.rows,e),this.refreshDisplayedRows(!1)}setAllParentsOk(e){return e.parent&&(e.parent.keep=!0,this.setAllParentsOk(e.parent)),!1}setValue(e,t,s){var r;const o=(r=this.columnDefs[t])==null?void 0:r.editInputPipe;o&&(s=o(s,e,t));const i=this.getRowByIndex(e);if(i){const n=i.data,l=this.columnDefs[t];if(this.areaIdent==="body"&&(l!=null&&l.valueGetter))return this.setCalculatedValue(n,l,s);const c=this.columnDefs[t].property;return c.includes(".")?this.setPropertyValue(n,c.split("."),s):(n[c]=s,!0)}return!1}genericTreeTableSortComparator(e,t){const s=this.columnDefs.find(n=>n.property===e),o=this.getColumnValues().isCalculated(e),i=o?new Map:void 0,r=n=>{if(!i)return this.getValueByT(n,e);if(i.has(n))return i.get(n);const l=this.getValueByT(n,e),c=S(l)?void 0:l;return i.set(n,c),c};return(n,l)=>{const c=r(n.data),h=r(l.data);return o&&(c===void 0||h===void 0)?c===h?0:c===void 0?1:-1:s!=null&&s.sortComparator?t*s.sortComparator(c,h,n.data,l.data,t):this.sorterService.genericSortComparator(c,h,t)}}expandAllRecursive(e,t){for(const s of e)s.expanded=t,s.children&&this.expandAllRecursive(s.children,t)}refreshDisplayedRows(e=!0){if(this.flattenRows=this.service.flattenTree(this.rows??[]),!this.lastPredictFn){this.filteredFlattenRows=[...this.flattenRows];return}(e||!this.keepMarked)&&(this.markKeptRows(this.lastPredictFn),this.keepMarked=!0),this.filteredFlattenRows=this.flattenRows.filter(t=>t.keep)}markKeptRows(e){const t=this.collectAllRows(this.rows??[],[]);t.forEach(s=>s.keep=!1),t.forEach((s,o)=>{if(e(s,o,t)){s.keep=!0;for(let i=s.parent;i&&!i.keep;i=i.parent)i.keep=!0}})}collectAllRows(e,t){var s;for(const o of e)t.push(o),(s=o.children)!=null&&s.length&&this.collectAllRows(o.children,t);return t}getPropertyValue(e,t){const s=t.shift();let o=e[s];return o&&t.length?this.getPropertyValue(o,t):o}treeSortWith(e,t){e.sort(t);for(const s of e)s.children&&this.treeSortWith(s.children,t)}}class _e{constructor(e=[]){this.allRootNodes=e}checkRow(e,t){this.setCheckedRecursive(e,t),this.autoCheckParent(e.parent)}checkAll(e=this.allRootNodes){for(const s of e)this.uncheckRecursive(s);const t=new Set;for(const s of e)s.parent&&t.add(s.parent);t.forEach(s=>this.autoCheckParent(s))}getCheckedRows(){const e=[];return this.addSelectedRecursive(this.allRootNodes,e),e}isRowChecked(e){return e.checked?"full":this.hasMixedDescendants(e)?"semi":"none"}hasMixedDescendants(e){let t=!1,s=!1;const o=i=>{for(const r of i??[])if(r.checked?t=!0:s=!0,t&&s||o(r.children))return!0;return!1};return o(e.children)}setCheckedRecursive(e,t){if(e.checked=t,e.children)for(const s of e.children)this.setCheckedRecursive(s,t)}setCheckedRows(e){this.addCheckedRows(e)}addCheckedRows(e){for(const t of e)t.checked=!0}autoCheckParent(e){if(e){const t=this.areAllChildrenChecked(e),s=this.areAllChildrenUnchecked(e);t?e.checked=!0:e.checked=!1,this.autoCheckParent(e.parent)}}areAllChildrenChecked(e){var t,s;if((t=e.children)!=null&&t.length){for(const o of e.children)if(!o.checked||(s=o.children)!=null&&s.length&&!this.areAllChildrenChecked(o))return!1}return!0}areAllChildrenUnchecked(e){var t,s;if((t=e.children)!=null&&t.length){for(const o of e.children)if(o.checked||(s=o.children)!=null&&s.length&&!this.areAllChildrenUnchecked(o))return!1}return!0}uncheckRecursive(e){if(e.checked=!1,e.children)for(const t of e.children)this.uncheckRecursive(t)}addSelectedRecursive(e,t){for(const s of e)s.checked&&t.push(s),s.children&&this.addSelectedRecursive(s.children,t)}}class Tt{constructor(e=0,t=0,s=0,o=0){this.top=e,this.right=t,this.bottom=s,this.left=o}}class Gi{constructor(){this.checkedRows=[]}getCheckedRows(){return this.checkedRows}setCheckedRows(e){this.checkedRows=e}addCheckedRows(e){this.checkedRows||(this.checkedRows=[]);for(const t of e)this.checkedRows.includes(t)||this.checkedRows.push(t)}checkRow(e,t){this.checkedRows||(this.checkedRows=[]),t?this.checkedRows.includes(e)||this.checkedRows.push(e):this.removeSelectedRow(e)}isRowChecked(e){return this.checkedRows&&this.checkedRows.includes(e)?"full":"none"}checkAll(e){this.checkedRows=[]}removeSelectedRow(e){if(this.checkedRows){const t=this.checkedRows.indexOf(e);t>-1&&this.checkedRows.splice(t,1)}}}class ha{constructor(e){this.bodyAreaModel=e}getCheckedRows(){var e;return((e=this.bodyAreaModel.rowSelectionModel)==null?void 0:e.getCheckedRows())??[]}setCheckedRows(e){var t;(t=this.bodyAreaModel.rowSelectionModel)==null||t.setCheckedRows(e)}addCheckedRows(e){var t;(t=this.bodyAreaModel.rowSelectionModel)==null||t.addCheckedRows(e)}checkRow(e,t){const s=this.bodyAreaModel.rowSelectionModel;if(s instanceof _e){this.getTopTreeRows().forEach(o=>s.checkRow(o,t));return}this.checkAll(t?this.getBodyRows():[])}isRowChecked(e){const t=this.bodyAreaModel.rowSelectionModel;if(t instanceof _e){const l=this.getTopTreeRows().map(c=>t.isRowChecked(c));return!l.length||l.every(c=>c==="none")?"none":l.every(c=>c==="full")?"full":"semi"}const s=this.getCheckedRows(),o=this.bodyAreaModel.getRowCount();if(!s.length||!o)return"none";if(s.length<o)return"semi";const i=this.cache;if(i&&i.checkedRows===s&&i.checkedCount===s.length&&i.rowCount===o)return i.state;const r=new Set(s);let n="full";for(let l=0;l<o;l++)if(!r.has(this.bodyAreaModel.getRowByIndex(l))){n="semi";break}return this.cache={checkedRows:s,checkedCount:s.length,rowCount:o,state:n},n}checkAll(e){const t=this.bodyAreaModel.rowSelectionModel;if(!t)return;if(!e.length){t.setCheckedRows([]);return}const s=new Set(t.getCheckedRows());e.forEach(o=>s.add(o)),t.setCheckedRows(Array.from(s))}getTopTreeRows(){const e=this.bodyAreaModel;return typeof e.getDisplayedRootRows=="function"?e.getDisplayedRootRows():this.getBodyRows().filter(t=>!t.parent)}getBodyRows(){const e=this.bodyAreaModel.getRowCount(),t=new Array(e);for(let s=0;s<e;s++)t[s]=this.bodyAreaModel.getRowByIndex(s);return t}}class Ze{constructor(e,t,s,o=0,i=0,r=!1,n=new fe,l=[],c=[],h=-1,d=0,u=400,f=()=>{}){var p,m,b,w;this.headerAreaModel=e,this.bodyAreaModel=t,this.footerAreaModel=s,this.fixedLeftColumnCount=o,this.fixedRightColumnCount=i,this.rowCheckboxVisible=r,this.defaultRowHeights=n,this.columnDefs=l,this.columnSizes=c,this.overridingColumnWidth=h,this.columnCount=d,this.parentSize=u,this.getSelectionModel=f,this.rowCount=0,this.contentHeightInPx=0,this.contentWidthInPx=0,this.padding=new Tt(0,0,0,0),this.xPositions=[],this.headerVisible=!0,this.footerVisible=!0,e.areaIdent="header",t.areaIdent="body",s.areaIdent="footer",this.columnCount||((p=this.columnDefs)!=null&&p.length?this.columnCount=this.columnDefs.length:(m=this.columnSizes)!=null&&m.length&&(this.columnCount=(b=this.columnSizes)==null?void 0:b.length));const g=(w=this.columnDefs)==null?void 0:w[rt(this.columnDefs)];Se(g)&&!t.rowSelectionModel&&(t.rowSelectionModel=new Gi),Se(g)&&!e.rowSelectionModel&&(e.rowSelectionModel=new ha(t))}init(){this.recalcSize(this.parentSize),this.overridingColumnWidth===-1&&this.calcXPositions(),this.headerAreaModel&&this.headerAreaModel.init(),this.bodyAreaModel&&this.bodyAreaModel.init(),this.footerAreaModel&&this.footerAreaModel.init()}setParentWidth(e){this.parentSize=e}getColumnCount(){return this.columnCount}setColumnWidth(e,t){var s,o;if(t=Math.max(0,t),this.overridingColumnWidth!==-1&&(this.overridingColumnWidth=t),e>-1&&e<((s=this.columnSizes)==null?void 0:s.length)){this.columnSizes[e]=t;const i=(o=this.columnDefs)==null?void 0:o[e];i&&(i.width=new C(t,"px"))}this.overridingColumnWidth===-1&&this.calcXPositions(),this.recalcContentWidthInPx()}getColumnWidth(e){var s;const t=this.getColumnDef(e);return t&&t.isVisible&&!t.isVisible()?0:this.overridingColumnWidth!==-1?this.overridingColumnWidth:e>-1&&e<((s=this.columnSizes)==null?void 0:s.length)?this.columnSizes[e]:0}getXPosByColumnIndex(e){return e===0?0:this.overridingColumnWidth>-1?this.overridingColumnWidth*e:this.xPositions[e]}recalcSize(e){e>0&&(this.parentSize=e),this.recalcColumnWidths(e),this.recalcHeightAndPadding()}recalcHeightAndPadding(){const e=this.getAreaModel("body");this.rowCount=e.getRowCount(),this.contentHeightInPx=this.getAreaHeight("body"),this.recalcContentWidthInPx(),this.recalcPadding()}recalcPadding(){const e=this.getSideAreaWidth("west"),t=this.getSideAreaWidth("east"),s=this.headerVisible?this.getAreaHeight("header"):0,o=this.footerVisible?this.getAreaHeight("footer"):0;this.padding=new Tt(s,t,o,e)}getPadding(){return this.padding}getContentHeightInPixel(){return this.contentHeightInPx}getContentWidthInPixel(){return this.contentWidthInPx}getRowHeight(e,t){return this.getAreaModel(e).getRowHeight(t)}getModel(e){return this.getAreaModel(e)}getAreaHeight(e){const t=this.getModel(e),s=t.getRowCount();if(this.defaultRowHeights[e])return s*this.defaultRowHeights[e];let o=0;for(let i=0;i<s;i++)o=o+t.getRowHeight(i);return o}getSideAreaWidth(e){const[t,s]=this.getSideStartAndEndColumnIndex(e);let o=0;for(let i=t;i<=s;i++)o=o+this.getColumnWidth(i);return o}getSideStartAndEndColumnIndex(e){const t=this.getFixedLeftColumnCount(),s=this.getFixedRightColumnCount();let o=0,i=this.columnCount-1;return e==="west"?i=t-1:e==="east"?o=this.columnCount-s:(o=t,i=this.columnCount-s-1),[o,i]}getColumnDef(e){if(e<this.columnDefs.length)return this.columnDefs[e]}getFixedLeftColumnCount(){return this.fixedLeftColumnCount}getFixedRightColumnCount(){return this.fixedRightColumnCount}getAreaModel(e){if(e==="header")return this.headerAreaModel;if(e==="body")return this.bodyAreaModel;if(e==="footer")return this.footerAreaModel;throw new Error("Wrong ident.")}getBodyModel(){return this.bodyAreaModel}isFooterVisibe(){var e;return this.footerVisible&&(((e=this.footerAreaModel)==null?void 0:e.getRowCount())??0)>0}isHeaderVisibe(){var e;return this.headerVisible&&(((e=this.headerAreaModel)==null?void 0:e.getRowCount())??0)>0}setHeaderVisible(e){this.headerVisible=e,this.recalcPadding()}setFooterVisible(e){this.footerVisible=e,this.recalcPadding()}setColumnVisible(e,t){var i;const s=this.findColumnDef(e);if(!s)return!1;ii(s,t);const o=s;return typeof o.visible=="boolean"&&(o.visible=t),(i=this.columnDefs)!=null&&i.some(r=>{var n;return((n=r.width)==null?void 0:n.unit)==="weight"})&&this.recalcColumnWidths(this.parentSize),this.recalcContentWidthInPx(),this.recalcPadding(),this.calcXPositions(),!0}isColumnVisible(e){var s;const t=this.findColumnDef(e);return t?((s=t.isVisible)==null?void 0:s.call(t))!==!1:typeof e=="number"&&e>=0&&e<this.getColumnCount()}isRowCheckboxVisible(){return this.rowCheckboxVisible}externalFilterChanged(e){this.getAreaModel("body").externalFilterChanged(e)}doSort(e){return this.getAreaModel("body").doSort(e)}sort(e){return this.getAreaModel("body").sort(e)}getColumnDefs(){return this.columnDefs}getColumnProperty(e){return this.columnDefs?this.columnDefs[e].property:""}getBodyRowByIndex(e){return this.getBodyModel().getRowByIndex(e)}isSortable(e){var t;if(this.columnDefs&&e<this.columnDefs.length){const s=(t=this.columnDefs[e])==null?void 0:t.sortable;if(typeof s=="function")return s()}return!1}changeColumnOrder(e,t){var s,o,i;this.arrayMove(this.columnDefs,e,t),this.arrayMove(this.columnSizes,e,t),(s=this.headerAreaModel)==null||s.changeColumnOrder(e,t),(o=this.bodyAreaModel)==null||o.changeColumnOrder(e,t),(i=this.footerAreaModel)==null||i.changeColumnOrder(e,t),this.calcXPositions()}recalcColumnWidths(e){var t,s,o;if(!((t=this.columnDefs)!=null&&t.length)&&!((s=this.columnSizes)!=null&&s.length)&&(this.columnSizes=new Array(this.getColumnCount()).fill(this.overridingColumnWidth)),(o=this.columnDefs)!=null&&o.length){const i=this.columnDefs.filter(h=>{var d;return((d=h.width)==null?void 0:d.unit)==="weight"});this.columnSizes=this.columnDefs.map(h=>{if(h.width.unit==="%"&&e){let d=Math.floor(h.width.value*e/100);if(h.minWidth){const u=this.sizeToPixel(h.minWidth,e);d=Math.max(u,d)}if(h.maxWidth){const u=this.sizeToPixel(h.maxWidth,e);d=Math.min(u,d)}return d}else if(h.width.unit==="px"&&e)return h.width.value;return 0});const r=h=>{var d;return((d=h.isVisible)==null?void 0:d.call(h))!==!1},n=this.columnSizes.reduce((h,d,u)=>r(this.columnDefs[u])?h+d:h,0),l=e-n,c=i.filter(r);if(l>0&&c.length){const h=c.map(d=>d.width.value).reduce((d,u)=>d+u);for(let d=0;d<this.columnDefs.length;d++){const u=this.columnDefs[d];u.width.unit==="weight"&&r(u)&&(this.columnSizes[d]=u.width.value*l/h)}}}}sizeToPixel(e,t){return e.unit==="px"?e.value:e.unit==="%"?Math.floor(e.value*t/100):-1}findColumnDef(e){const t=this.columnDefs??[];if(typeof e=="number")return e>=0?t[e]:void 0;if(typeof e=="string"){for(const s of t)if(s.property===e)return s;return}return t.indexOf(e)>-1?e:void 0}arrayMove(e,t,s){const o=e.splice(t,1)[0];return e.splice(s,0,o),e}recalcContentWidthInPx(){this.contentWidthInPx=this.getSideAreaWidth("center")}calcXPositions(){const e=this.getColumnCount();this.xPositions=new Array(e+1),this.xPositions[0]=0;for(let t=0;t<e;t++)this.xPositions[t+1]=this.getColumnWidth(t)+this.xPositions[t]}setTableScope(e){this.tableScope=e}getTableScope(){return this.tableScope}}class Rs extends q{constructor(e,t,s,o,i="ge-selected-row",r="ge-focused-row"){super(e,t,o,s,i,r),this.areaIdent=e,this.rows=t,this.columnDefs=s,this.defaultRowHeight=o}}class Wi{constructor(e){this.columnDef=e,this.type="RowNumberCellRenderer"}render(e,t,s,o,i,r,n){const l=this.columnDef.getRowNumberText(t,i),c=n.createElement("div");n.addClass(c,"ge-table-label-div");const h=n.createElement("div");n.addClass(h,"ge-table-label"),n.setAttribute(h,"data-row-index",`${t}`),n.setAttribute(h,"data-col-index",`${s}`),n.setAttribute(h,"data-area",o),n.appendChild(h,n.createText(l)),n.appendChild(c,h),n.appendChild(e,c)}}class As{constructor(){this.mode="display",this.format=da,this.headerLabel="#",this.exported=!1,this.minWidthInPx=36}}function da(a){return String(a)}class ts{constructor(e={}){this.type="RowNumberColumnDef",this.property="RowNumberColumn",this.maxWidth=new C(400,"px"),this.classes=new V(["ge-table-row-number-header","ge-table-text-align-right"],["ge-table-row-number","ge-table-text-align-right"],["ge-table-row-number-footer"]),this.isVisible=Ue,this.options={...new As,...e},this.headerLabel=this.options.headerLabel,this.width=new C(this.options.minWidthInPx,"px"),this.minWidth=new C(this.options.minWidthInPx,"px"),this.rendererMap=new V(void 0,new Wi(this),void 0)}getRowNumber(e,t){if(this.options.mode==="original"){const s=this.getOriginalPosition(t.getRowByIndex(e),t);if(s!==void 0)return s+1}return e+1}getRowNumberText(e,t){return this.options.format(this.getRowNumber(e,t))}getWidestText(e){var s;let t=e.getRowCount();return this.options.mode==="original"&&this.hasAllRows(e)&&(t=((s=e.getUnfilteredRowCount)==null?void 0:s.call(e))??e.getAllRows().length),this.options.format(Math.max(1,t))}hasDefaultFormat(){return this.options.format===new As().format}hasAllRows(e){return typeof e.getAllRows=="function"}getOriginalPosition(e,t){if(!this.hasAllRows(t))return;const s=t.getAllRows();if(!Array.isArray(s))return;let o=this.originalIndex;(!o||o.rows!==s||o.length!==s.length)&&(o=this.buildOriginalIndex(s));const i=o.index.get(e);if(i!==void 0&&s[i]===e)return i;if(i!==void 0||!o.missRebuilt){o=this.buildOriginalIndex(s),o.missRebuilt=!0;const r=o.index.get(e);return r!==void 0&&s[r]===e?r:void 0}}buildOriginalIndex(e){const t=new Map;for(let s=0;s<e.length;s++)t.has(e[s])||t.set(e[s],s);return this.originalIndex={rows:e,length:e.length,index:t,missRebuilt:!1},this.originalIndex}}class eo{constructor(){this.areaIdent="body",this.rowSelectionModel=void 0}changeColumnOrder(e,t){}doSort(e){return!1}sort(e){}externalFilterChanged(e){}getCellRenderer(e,t){}getColspanAt(e,t){return 0}getCustomClassesAt(e,t){return[]}getCustomStyleAt(e,t){}getMaxColspan(){return 0}getMaxRowspan(){return 0}getRowByIndex(e){}getRowCount(){return 0}getRowHeight(e){return 0}getRowspanAt(e,t){return 0}getTooltipAt(e,t){}getValueAt(e,t){}getTextValueAt(e,t){return""}getYPosByRowIndex(e){const t=this.getConstantRowHeight();if(t!==void 0&&t>0)return e*t;let s=0;for(let o=0;o<e;o++)s+=this.getRowHeight(o);return s}getConstantRowHeight(){}init(){}isEditable(e,t){return!1}isFilterable(){return!1}isRowCheckable(e){return!1}isRowChecked(e){}isSelectable(e,t){return!0}setRowChecked(e,t){}setValue(e,t,s){return!1}}const ua={sum:"Sum",count:"Count",avg:"Average",min:"Min",max:"Max",countDistinct:"Distinct",first:"First",last:"Last"},fa=new Intl.NumberFormat("en-US");class lt extends eo{constructor(e,t,s){super(),this.columnDefs=t,this.type="AreaModelAggregateFooter",this.textRenderer=new We,this.areaIdent="footer",this.getBody=typeof e=="function"?e:()=>e,this.options=lt.toOptions(s),this.defaultRowHeight=this.options.rowHeight??34,this.footerRows=this.options.rows.map(o=>{const i=Object.keys(o.aggregates).map(r=>dt(r,o.aggregates[r]));return{row:o,specs:i,byKey:new Map(i.map(r=>[r.key,r]))}})}static toOptions(e){if(Array.isArray(e))return{rows:e};const t=e;return Array.isArray(t.rows)?t:{rows:[{aggregates:e}]}}getRowCount(){return this.footerRows.length}getRowHeight(e){return this.defaultRowHeight}getConstantRowHeight(){return this.defaultRowHeight}invalidateDerivedValues(){this.cache=void 0}getResults(e=0){return this.compute().results[e]??{}}getAggregationRowCount(){return this.compute().rowCount}isLabelCell(e,t){return e>=0&&e<this.footerRows.length&&this.getLabelColumnIndex(e)===t}getValueAt(e,t){var i;const s=this.footerRows[e],o=(i=this.columnDefs[t])==null?void 0:i.property;return!s||o===void 0?"":s.byKey.has(o)?this.getResults(e)[o]:this.isLabelCell(e,t)?this.getLabel(e):""}getTextValueAt(e,t){var r;const s=this.footerRows[e],o=(r=this.columnDefs[t])==null?void 0:r.property;if(!s||o===void 0)return"";const i=s.byKey.get(o);if(i){const n=this.getResults(e)[o];return i.format?i.format(n):$e(n)}return this.isLabelCell(e,t)?this.getLabel(e):""}getCellRenderer(e,t){var i,r;const s=(i=this.columnDefs[t])==null?void 0:i.property,o=this.footerRows[e];if(!(!o||s===void 0))return o.byKey.has(s)?((r=this.columnDefs[t].rendererMap)==null?void 0:r.footer)??this.textRenderer:this.isLabelCell(e,t)?this.textRenderer:void 0}getCustomClassesAt(e,t){var r,n;const s=(r=this.columnDefs[t])==null?void 0:r.property;if(s!==void 0&&((n=this.footerRows[e])!=null&&n.byKey.has(s)))return["ge-table-footer-aggregate"];if(!this.isLabelCell(e,t))return[];const o=this.columnDefs[t+1];return!o||!this.footerRows[e].byKey.has(o.property)?["ge-table-footer-label","ge-table-footer-label-overflow"]:["ge-table-footer-label"]}getLabelColumnIndex(e){const t=this.footerRows[e].byKey,s=this.options.labelProperty;return s!==void 0?t.has(s)?-1:this.columnDefs.findIndex(o=>o.property===s):this.columnDefs.findIndex(o=>{var i;return!O(o)&&!Se(o)&&((i=o.isVisible)==null?void 0:i.call(o))!==!1&&!t.has(o.property)})}getLabel(e){const{row:t,specs:s}=this.footerRows[e],o=this.getAggregationRowCount();if(typeof t.label=="string")return t.label;if(typeof t.label=="function")return t.label(o,this.getResults(e));if(this.footerRows.length>1&&s.length){const i=s[0].aggregator.name,r=ua[i];if(r&&s.every(n=>n.aggregator===ae[i]))return r}return`${fa.format(o)} ${o===1?"row":"rows"}`}getSource(){const e=this.getBody(),t=this.options.getRows;if(t)return{signal:t,getRows:()=>t(e)};const s=this.options.source==="all",o=e;if(typeof o.getFilteredRows=="function"&&typeof o.getAllRows=="function"){const r=s?o.getAllRows():o.getFilteredRows();return{signal:r,length:r.length,getRows:()=>r}}if(B(e)){const r=e;return{signal:r.rows,getRows:()=>r.getLeafRows(!s).map(n=>n.data)}}const i=e.getRowCount();return{signal:void 0,length:i,getRows:()=>i}}createIndexGetter(e,t){if(!t.getValue)return;if(typeof t.value=="string"){const o=this.columnDefs.findIndex(i=>i.property===t.value);if(o>=0)return i=>e.getValueAt(i,o)}const s=ht(t.value);return o=>s(e.getRowByIndex(o))}withCalculatedValues(e){const t=this.getBody();return typeof t.isCalculatedProperty!="function"||typeof t.getRowValue!="function"?e:e.map(s=>{const o=s.value;return!s.getValue||typeof o!="string"||!t.isCalculatedProperty(o)?s:{...s,getValue:i=>t.getRowValue(i,o)}})}compute(){const e=this.getSource(),t=this.cache;if(t&&t.signal===e.signal&&t.length===e.length)return t;const s=e.getRows(),o=this.withCalculatedValues(this.footerRows.flatMap(c=>c.specs));let i;if(typeof s=="number"){const c=this.getBody();i=Vr(s,o.map(h=>({aggregator:h.aggregator,getValue:this.createIndexGetter(c,h)})))}else i=Ut(s,o);let r=0;const n=this.footerRows.map(c=>{const h={};for(const d of c.specs)h[d.key]=d.aggregator.result(i[r++]);return h}),l=typeof s=="number"?s:s.length;return this.cache={signal:e.signal,length:e.length,rowCount:l,results:n},this.cache}}class Z{static createTableModel(e){var s,o,i,r,n,l,c,h,d,u,f,g,p,m,b,w;if(e.defaultRowHeights===void 0)if((s=e.tableOptions)!=null&&s.defaultRowHeights)e.defaultRowHeights=e.tableOptions.defaultRowHeights;else{if(e.defaultRowHeights=new fe,e.headerAreaModel&&"defaultRowHeight"in e.headerAreaModel){const y=e.headerAreaModel.defaultRowHeight;y>-1&&(e.defaultRowHeights.header=y)}if(e.bodyAreaModel&&"defaultRowHeight"in e.bodyAreaModel){const y=e.bodyAreaModel.defaultRowHeight;y>-1&&(e.defaultRowHeights.body=y)}if(e.footerAreaModel&&"defaultRowHeight"in e.footerAreaModel){const y=e.footerAreaModel.defaultRowHeight;y>-1&&(e.defaultRowHeights.footer=y)}}if(e.columnDefs===void 0&&((o=e.properties)!=null&&o.length?e.columnDefs=e.properties.map(y=>new ee(y,y.toUpperCase(),Et)):(i=e.rows)!=null&&i.length?e.columnDefs=Object.keys(e.rows[0]).map(y=>new ee(y,y.toUpperCase(),Et)):e.columnDefs=[]),Z.addRowNumberColumn(e),e.rowDrag){const y=(r=e.columnDefs)==null?void 0:r.find(x=>!O(x)&&!Se(x));y&&(y.rowDrag=y.rowDrag||!0)}e.columnCount===void 0&&((n=e.columnDefs)!=null&&n.length?e.columnCount=e.columnDefs.length:(l=e.headerData)!=null&&l.length?e.columnCount=e.headerData[0].length:(c=e.columnSizes)!=null&&c.length?e.columnCount=(h=e.columnSizes)==null?void 0:h.length:console.warn('Property "columnCount" is missing and cannot be derived from other properties.')),e.headerAreaModel||((d=e.headerData)!=null&&d.length?e.headerAreaModel=new J("header",e.headerData,e.defaultRowHeights.header,e.columnDefs):(u=e.columnDefs)!=null&&u.length?e.headerAreaModel=new J("header",[e.columnDefs.map(y=>y.headerLabel)],e.defaultRowHeights.header,e.columnDefs):e.headerAreaModel=new j("header"));const t=Z.checkFooterAggregates(e);if(!e.footerAreaModel&&!t&&((f=e.footerData)!=null&&f.length?e.footerAreaModel=new J("footer",e.footerData,e.defaultRowHeights.footer,e.columnDefs):e.footerAreaModel=new j("footer")),!e.bodyAreaModel)if(e.rows)if((g=e.rows)!=null&&g.length&&L(e.rows[0])){const y=e.rows;e.bodyAreaModel=new Me("body",y,e.defaultRowHeights.body,e.columnDefs),(((p=e.columnDefs[rt(e.columnDefs)])==null?void 0:p.property)==="CheckboxColumn"||(m=e.tableOptions)!=null&&m.showCheckboxWihoutExtraColumn)&&(e.bodyAreaModel.rowSelectionModel=new _e(y))}else e.bodyAreaModel=new Rs("body",e.rows,e.columnDefs,e.defaultRowHeights.body);else e.bodyData?e.bodyAreaModel=new J("body",e.bodyData,e.defaultRowHeights.body):e.bodyAreaModel=new j("body");if(t){const y=lt.toOptions(t);e.footerAreaModel=new lt(e.bodyAreaModel,e.columnDefs??[],{...y,rowHeight:y.rowHeight??e.defaultRowHeights.footer})}return e.fixedLeftColumnCount===void 0&&(e.fixedLeftColumnCount=0),e.fixedRightColumnCount===void 0&&(e.fixedRightColumnCount=0),e.rowCheckboxVisible===void 0&&(e.rowCheckboxVisible=!1),e.overridingColumnWidth===void 0&&(e.overridingColumnWidth=-1),!e.getSelectionModel&&((b=e.tableOptions)!=null&&b.getSelectionModel)&&(e.getSelectionModel=(w=e.tableOptions)==null?void 0:w.getSelectionModel),new Ze(e.headerAreaModel,e.bodyAreaModel,e.footerAreaModel??new j("footer"),e.fixedLeftColumnCount,e.fixedRightColumnCount,e.rowCheckboxVisible,e.defaultRowHeights,e.columnDefs,e.columnSizes,e.overridingColumnWidth,e.columnCount,e.parentSize,e.getSelectionModel)}static checkFooterAggregates(e){var t;if(e.footerAggregates){if(e.footerAreaModel){console.warn("TableFactory.createTableModel: footerAggregates is ignored – an own footerAreaModel is given.");return}return(t=e.footerData)!=null&&t.length&&console.warn("TableFactory.createTableModel: footerData is ignored – footerAggregates builds the footer."),e.footerAggregates}}static addRowNumberColumn(e){var i,r;if(!e.rowNumbersVisible)return;if(e.bodyData||e.headerAreaModel||e.bodyAreaModel||e.footerAreaModel){console.warn("TableFactory.createTableModel: rowNumbersVisible is ignored with bodyData or own area models (their columns would shift) – put a RowNumberColumnDef into the column definitions yourself.");return}const t=e.columnDefs??[];if(O(t[0]))return;const s=e.rowNumbersVisible===!0?{}:e.rowNumbersVisible,o=new ts(s);if(e.columnDefs=[o,...t],e.fixedLeftColumnCount=(e.fixedLeftColumnCount??0)+1,e.columnCount!==void 0&&e.columnCount++,(i=e.headerData)!=null&&i.length){const n=e.headerData.length-1;e.headerData=e.headerData.map((l,c)=>[c===n?o.headerLabel:"",...l])}(r=e.footerData)!=null&&r.length&&(e.footerData=e.footerData.map(n=>["",...n]))}static buildByTypedRowsParam(e){return Z.buildByTypedRows(e.rows??[],e.columnDefs,e.tableOptions??new Ae,e.fixedLeftColumnCount??0,e.fixedRightColumnCount??0)}static buildByTypedRows(e,t,s=new Ae,o=0,i=0){var c;const r=s.defaultRowHeights,n=((c=t[rt(t)])==null?void 0:c.property)==="CheckboxColumn";if(e!=null&&e.length&&L(e[0])){const h=e,d=new Me("body",h,r.body,t);return(n||s.showCheckboxWihoutExtraColumn)&&(d.rowSelectionModel=new _e(h)),Z.createByAreaModelsParam({headerAreaModel:new J("header",[t.map(u=>u.headerLabel)],r.header),bodyAreaModel:d,footerAreaModel:new J("footer",[],r.footer),columnDefs:t,fixedLeftColumnCount:o,fixedRightColumnCount:i,defaultRowHeights:s.defaultRowHeights,rowCheckboxVisible:!1,columnSizes:[],columnCount:t.length,overridingColumnWidth:-1})}return Z.createByObjectArrayParam({rows:e,columnDefs:t,fixedLeftColumnCount:o,fixedRightColumnCount:i,defaultRowHeights:s.defaultRowHeights})}static createByObjectArrayParam(e){const t=e.rowCheckboxVisible!==void 0?e.rowCheckboxVisible:!1;return Z.createByObjectArray(e.rows,e.header??[],e.footer??[],e.fixedLeftColumnCount??0,e.fixedRightColumnCount??0,t,e.defaultRowHeights??new fe,e.columnDefs??[],e.columnSizes??[])}static createByAreaModels(e=new j,t,s=new j,o=0,i=0,r=!1,n=new fe,l,c=[],h=-1,d){return new Ze(e,t,s,o,i,r,n,l,c,h,d)}static createByAreaModelsParam(e){return Z.createByAreaModels(e.headerAreaModel??new j,e.bodyAreaModel,e.footerAreaModel??new j,e.fixedLeftColumnCount??0,e.fixedRightColumnCount??0,e.rowCheckboxVisible===void 0?!1:e.rowCheckboxVisible,e.defaultRowHeights,e.columnDefs??[],e.columnSizes??[],e.overridingColumnWidth??-1,e.columnCount??0)}static createByObjectArray(e,t=[],s=[],o=0,i=0,r=!1,n=new fe,l,c=[]){let h;t!=null&&t.length?h=new J("header",t,n.header,l):l!=null&&l.length?h=new J("header",[l.map(f=>f.headerLabel)],n.header,l):h=new j;const d=s?new J("footer",s,n.footer,l):new j,u=new Rs("body",e,l,n.body);return new Ze(h,u,d,o,i,r,n,l,c)}}class Ui{constructor(e,t,s=200,o=300,i=0,r=0){this.items=e,this.cellRenderer=t,this.coverWidth=s,this.coverHeight=o,this.width=i,this.firstRowPaddingTop=r,this.rowSelectionModel=void 0,this.areaIdent="body",this.filteredItems=[],this.sorterService=new Us,this.filteredItems=e}setParentWidth(e){this.width=e}getRowCount(){var e;return(e=this.filteredItems)!=null&&e.length?Math.floor(this.filteredItems.length/this.getColumnCount())+1:0}getUnfilteredRowCount(){var e;return(e=this.items)!=null&&e.length?Math.floor(this.items.length/this.getColumnCount())+1:0}getColumnCount(){return this.width?Math.floor(this.width/this.coverWidth):1}getValueAt(e,t){var s;return(s=this.filteredItems)==null?void 0:s[e*this.getColumnCount()+t]}getTextValueAt(e,t){return""}getTooltipAt(e,t){return""}getRowHeight(e){return e===0&&this.firstRowPaddingTop>0?this.firstRowPaddingTop+this.coverHeight:this.coverHeight}getCellRenderer(e,t){return this.cellRenderer}getColspanAt(e,t){return 0}getCustomClassesAt(e,t){return[]}getCustomStyleAt(e,t){}getRowspanAt(e,t){return 0}getRowByIndex(e){}isRowCheckable(e){return!0}isRowChecked(e){}setRowChecked(e,t){}getMaxColspan(){return 31}getMaxRowspan(){return 31}getYPosByRowIndex(e){const t=this.firstRowPaddingTop>0?this.firstRowPaddingTop:0;return this.coverHeight*e+t}init(){}externalFilterChanged(e){this.filteredItems=this.items.filter(e)}isFilterable(){return!0}doSort(e){if(!this.filteredItems)return!1;for(const t of e){const{sortState:s}=t,o=s==="asc"?1:s==="desc"?-1:0;this.filteredItems=this.filteredItems.sort((i,r)=>this.sorterService.genericSortComparator(i,r,o))}return!0}sort(e){this.filteredItems=this.filteredItems.sort(e)}isEditable(e,t){return!1}setValue(e,t,s){return!0}isSelectable(e,t){return!1}changeColumnOrder(e,t){}setPropertyValue(e,t,s){return!1}arrayMove(e,t,s){}}class zi{constructor(e,t=0){this.bodyModel=e,this.paddingTop=t,this.headerAreaModel=new j,this.footerAreaModel=new j}changeColumnOrder(e,t){}isSortable(e){return!1}init(){}setParentWidth(e){this.bodyModel.width=e}getColumnCount(){return this.bodyModel.getColumnCount()}getXPosByColumnIndex(e){return e*this.getColumnWidth(e)}getAreaModel(e){return e==="header"?this.headerAreaModel:e==="footer"?this.footerAreaModel:this.bodyModel}getBodyModel(){return this.bodyModel}getFixedLeftColumnCount(){return 0}getFixedRightColumnCount(){return 0}isHeaderVisibe(){return!1}isFooterVisibe(){return!1}isRowCheckboxVisible(){return!1}getRowHeight(e,t){return this.bodyModel.getRowHeight(t)}getColumnDef(e){}getColumnDefs(){}getColumnProperty(e){return""}getBodyRowByIndex(e){return this.bodyModel.getRowByIndex(e)}getColumnWidth(e){return this.bodyModel.coverWidth}setColumnWidth(e,t){this.bodyModel.coverWidth=t}recalcSize(e){}recalcPadding(){}recalcHeightAndPadding(){}getPadding(){return new Tt(0,0,0,0)}getContentHeightInPixel(){return this.paddingTop+this.bodyModel.getRowCount()*this.bodyModel.coverHeight}getContentWidthInPixel(){return this.bodyModel.getColumnCount()*this.bodyModel.coverWidth}externalFilterChanged(e){this.bodyModel.externalFilterChanged(e)}doSort(e){return this.bodyModel.doSort(e)}sort(e){this.bodyModel.sort(e)}getSelectionModel(){}setTableScope(e){this.tableScope=e}getTableScope(){return this.tableScope}}class Ki{constructor(){this.autoRestoreSortingState=!1,this.autoRestoreCollapsedExpandedState=!1,this.autoRestoreScrollPosition=!1,this.autoRestoreCheckedState=!1,this.autoRestoreSelectedState=!1,this.autoRestoreColumnLayout=!1,this.autoRestoreHeaderGroupState=!1,this.autoRestoreCustomState=!1,this.autoRestoreDetailState=!1,this.getStorageKeyFn=void 0,this.isSame=(e,t,s)=>{if(e&&t&&s.getRowId){const o=s.getRowId(e),i=s.getRowId(t);return o===i}return!1},this.getRowId=dn(e=>{if(e){for(const t of["id","uuid"]){const s=e[t];if(s!=null)return s}try{return JSON.stringify(e)}catch(t){console.error(t)}}return console.warn("autoRestoreOptions: getRowId() got no row – set an own getRowId (row, rowIndex) for models without row objects."),-1})}}class ga{static createCoverGridModel(e,t,s=200,o=300,i=0,r=0){const n=new Ui(e,t,s,o,i,r);return new zi(n,r)}static createCoverGrisDefaultOptions(e,t=()=>"CoverGrid"){return{...new Ae,horizontalBorderVisible:!1,verticalBorderVisible:!1,footerSeparatorBorderVisible:!1,headerSeparatorBorderVisible:!1,fixedEastSeparatorBorderVisible:!1,fixedWestSeparatorBorderVisible:!1,tableTopBorderVisible:!1,tableBottomBorderVisible:!1,hoverColumnVisible:!1,hoverRowVisible:!1,defaultRowHeights:{header:0,body:e,footer:0},autoRestoreOptions:{...new Ki,getStorageKeyFn:t,autoRestoreCollapsedExpandedState:!1,autoRestoreScrollPosition:!0,autoRestoreSortingState:!1,autoRestoreSelectedState:!1}}}}const pa=["COPY_2_CLIPBOARD","START_EDITING","TOGGLE_SELECTION","SELECT_ALL","DESELECT_ALL","NAVIGATE_LEFT","NAVIGATE_RIGHT","NAVIGATE_UP","NAVIGATE_DOWN","NAVIGATE_ROW_START","NAVIGATE_ROW_END","NAVIGATE_FIRST_CELL","NAVIGATE_LAST_CELL","NAVIGATE_PAGE_UP","NAVIGATE_PAGE_DOWN","ACTIVATE_CELL","MOVE_ROW_UP","MOVE_ROW_DOWN","FILL_DOWN","FILL_RIGHT"];class ji{constructor(e,t){this.tableModel=e,this.tableOptions=t}}class Yi{constructor(e,t,s,o,i,r,n){this.emmitDataKey=e,this.emmitCancelKey=t,this.queryId=s,this.filter=o,this.sorting=i,this.startIndex=r,this.endIndex=n}}class ma extends Yi{constructor(e,t,s,o,i,r,n,l){super(e,t,s,o,i,r,n),this.rows=l}}class Xi{constructor(e,t){this.value=e,this.label=t}}class ba{constructor(e,t){this.index=e,this.px=t}}const wa={body:["ge-table-text-align-left"]},ya={body:["ge-table-text-align-center"]},Ca={body:["ge-table-text-align-right"]},xa={header:["ge-table-text-align-left"],body:["ge-table-text-align-left"],footer:["ge-table-text-align-left"]},va={header:["ge-table-text-align-center"],body:["ge-table-text-align-center"],footer:["ge-table-text-align-center"]},Sa={header:["ge-table-text-align-right"],body:["ge-table-text-align-right"],footer:["ge-table-text-align-right"]};class Ms{constructor(){this.type="CheckboxCellRenderer"}render(e,t,s,o,i,r,n){if(i.isRowCheckable(t)){n.addClass(e,"ge-table-row-checkbox-div");const l=i.isRowChecked(t);e.innerText="";const c=n.createElement("input");n.setAttribute(c,"type","checkbox"),n.setAttribute(c,"data-area",`${o}`),n.setAttribute(c,"data-row-index",`${t}`),n.setAttribute(c,"data-col-index",`${s}`),n.setAttribute(c,"data-input-type","checkbox"),n.setAttribute(c,"tabindex","-1"),n.addClass(c,"ge-table-row-checkbox"),l==="full"&&(n.setAttribute(c,"checked",""),c.checked=!0),c.indeterminate=l==="semi",n.appendChild(e,c)}}}class Ra{constructor(){this.type="CheckboxColumnDef",this.property="CheckboxColumn",this.headerLabel="",this.width=new C(50,"px"),this.minWidth=new C(50,"px"),this.maxWidth=new C(100,"px"),this.rendererMap=new V(new Ms,new Ms,void 0),this.classes=new V([],["ge-table-text-align-left"],[])}}class Aa{static body(e){return new V(void 0,e,void 0)}}class Ma{constructor(e="down",t){this.status=e,this.originalEvent=t}}class Ea{constructor(e,t,s,o,i={}){this.area=e,this.rowIndex=t,this.columnIndex=s,this.value=o,this.cssClasses=i}}class Ji{constructor(e,t,s,o=!1,i="normal",r=void 0){this.data=e,this.property=t,this.toggle=s,this.closed=o,this.visibility=i,this.children=r,this.impl="CellGroup"}}class qi extends Ji{constructor(e,t=0,s=0,o){super(e.data,e.property,e.toggle,e.closed,e.visibility,e.children),this.rowIndex=t,this.childIndex=s,this.parent=o,this.impl="CellGroupExt",this.children=void 0,this.leftNeighbour=void 0,this.rightNeighbour=void 0,this.id=e.id}ownColumn(){return!!this.property}toString(){return this.data+""}getColumnIndex(){return this.parent?this.parent.getColumnIndex()+this.childIndex:(this.leftNeighbour,0)}isVisible(){return this.parent?this.visibility==="always"?this.parent.isVisible():this.visibility==="normal"||!this.visibility?this.parent.isVisible()&&!this.parent.closed:this.visibility==="inverted"?this.parent.isVisible()&&this.parent.closed:!0:!0}claimsSpace(){return this.isVisible()&&(this.ownColumn()||this.closed)}getColumnCount(e=this,t=0){var s;if(e!=null&&e.claimsSpace()&&t++,(s=e==null?void 0:e.children)!=null&&s.length)for(const o of e.children)t=this.getColumnCount(o,t);return t}getRowSpan(e=this,t){return e!=null&&e.claimsSpace()?t-this.getParentCount(e,0):1}getParentCount(e=this,t=0){return e.parent&&(t=t+1+this.getParentCount(e.parent,t)),t}log(e=10){const t=" ".substring(0,2*this.rowIndex),s=`${this.getColumnIndex()}`,o=`${this.getColumnCount(this)}`,i=`${this.getRowSpan(this,e)}`,r=`${this.getParentCount(this)}`,n=`${t+this.data}
|
|
336
336
|
childIndex:${this.childIndex}
|
|
337
337
|
row:${this.rowIndex}
|
|
338
338
|
col:${s}
|
|
@@ -344,12 +344,12 @@ render scope: this.lastFullVisibleRowIndex <- `+this.lastFullVisibleRowIndex),th
|
|
|
344
344
|
claimsSpace:${this.claimsSpace()}
|
|
345
345
|
colCount:${o}
|
|
346
346
|
rowSpan:${i}
|
|
347
|
-
pc:${r}`.replace(/[ \n]+/g," ");if(this.children)for(const
|
|
347
|
+
pc:${r}`.replace(/[ \n]+/g," ");if(this.children)for(const l of this.children)l.log(e);return n}}class U{static buildColumnDefs(e,t=[]){for(const s of e)s.property&&t.push(ee.create({property:s.property,headerLabel:s.data?s.data:s.property,isVisible:()=>typeof s.isVisible=="function"?s.isVisible():!0})),s.children&&U.buildColumnDefs(s.children,t);return t}static buildGroupExts(e,t=[],s=0,o){let i;for(let r=0;r<e.length;r++){const n=e[r],l=new qi(n,s,r,o);i&&(l.leftNeighbour=i,i.rightNeighbour=l),t.push(l),n.children&&(l.children=U.buildGroupExts(n.children,[],s+1,l)),i=l}return t}static flattenGroupExts(e,t=[]){for(const s of e)t.push(s),s.children&&U.flattenGroupExts(s.children,t);return t}static buildArrayOfArrays(e,t){var i;let s=-1,o=99999;for(const r of e){if(r.rowIndex<=o){s++;for(let n=0;n<t.length;n++)t[n][s]=null}if(t[r.rowIndex][s]=r,o=r.rowIndex,r.ownColumn()&&((i=r.children)!=null&&i.length)){for(let n=r.rowIndex+1;n<t.length;n++)t[n][s]=void 0;s++;for(let n=0;n<t.length;n++)t[n][s]=null}}return t}static iterateThrowColumns(e=[],t){var s;for(const o of t)e.push(o.data+" rowIndex:"+o.rowIndex),(s=o.children)!=null&&s.length&&U.iterateThrowColumns(e,o.children)}}const Bt=class Bt{constructor(e=new Jt){this.headerGroupOptions=e}render(e,t,s,o,i,r,n){const l=r!=null&&r.data?r.data:"";if(r){const{toggle:c,visibility:h,closed:d}=r,u=c?Bt.toggleHeaderGroup:"";if(this.addText(e,o,t,s,l,u),c&&h!=="always"){const f=this.addArrowDiv(n,e,!d,t,s,o,u),g=new Ee;n.setAttribute(f,"role","button"),n.setAttribute(f,"aria-expanded",`${!d}`),n.setAttribute(f,"data-ge-group-label",`${l}`),n.setAttribute(f,"aria-label",d?g.expandGroup(`${l}`):g.collapseGroup(`${l}`))}}else this.addText(e,o,t,s,l,"")}addText(e,t,s,o,i,r){e.innerHTML=`<span
|
|
348
348
|
data-ge-action="${r}"
|
|
349
349
|
data-area="${t}"
|
|
350
350
|
data-row-index="${s}"
|
|
351
351
|
data-col-index="${o}"
|
|
352
|
-
>${
|
|
352
|
+
>${I(i)}</span>`}addArrowDiv(e,t,s=!0,o=-1,i=-1,r="header",n){const l=e.createElement("div");e.addClass(l,"ge-table-toggle-icon-div"),e.setStyle(l,"display","inline-block"),e.setStyle(l,"position",""),e.setStyle(l,"width","20px"),e.setStyle(l,"background","transparent"),e.setStyle(l,"cursor","pointer"),e.setAttribute(l,"data-row-index",`${o}`),e.setAttribute(l,"data-col-index",`${i}`),e.setAttribute(l,"data-area",`${r}`),e.setAttribute(l,"data-ge-action",`${n}`);let c;s?c=this.headerGroupOptions.iconExpanded:c=this.headerGroupOptions.iconCollapsed;const h=c.content,d=e.createText(h);e.appendChild(l,d),c.style&&this.applyStyleString(e,l,c.style);for(const u of c.classes)e.addClass(l,u);return e.appendChild(t,l),l}applyStyleString(e,t,s){const o=s.split(";").map(i=>i.trim()).filter(i=>i);for(const i of o){const[r,n]=i.split(":");e.setStyle(t,r.trim(),n.trim())}}};Bt.toggleHeaderGroup="toggleHeaderGroup";let It=Bt;class Zi{constructor(e="header",t,s=[],o,i=new Jt){this.areaIdent=e,this.groups=t,this.columnDefs=s,this.defaultRowHeight=o,this.headerGroupOptions=i,this.gammaCells=!0,this.arr=[],this.groupExts=[],this.cellGroupExtCellRenderer=new It(this.headerGroupOptions),this.groupExts=U.buildGroupExts(t),this.init()}sort(e){}init(){var e;this.arr=this.buildArray(),!((e=this.columnDefs)!=null&&e.length)&&this.areaIdent==="header"&&(this.columnDefs=U.buildColumnDefs(this.groups),this.columnDefs.forEach(t=>is(t,t.isVisible)))}getAllLeafs(){return U.flattenGroupExts(this.groupExts).filter(t=>!t.children)}getMaxRowCount(){const e=this.getAllLeafs();return e!=null&&e.length?1+Math.max(...e.map(t=>t.getParentCount(t))):0}buildArray(){const e=U.flattenGroupExts(this.groupExts),t=1+Math.max(...e.map(r=>r.rowIndex)),s=[];U.iterateThrowColumns(s,this.groupExts);const o=Array.from(Array(t).keys()).map(r=>[]);return U.buildArrayOfArrays(e,o)}changeColumnOrder(e,t){}doSort(e){return!1}externalFilterChanged(e){}getCellRenderer(e,t){return this.cellGroupExtCellRenderer}getColspanAt(e,t){const s=this.getValueAt(e,t);return s?s.getColumnCount():0}getCustomClassesAt(e,t){return[]}getCustomStyleAt(e,t){}getMaxColspan(){return 12}getMaxRowspan(){return 12}getRowByIndex(e){}getRowCount(){return this.arr?this.arr.length:0}getRowspanAt(e,t){const s=this.getValueAt(e,t);if(s){const o=this.getRowCount();return s.getRowSpan(s,o)}return 0}getTooltipAt(e,t){return""}getValueAt(e,t){return this.arr[e][t]}getTextValueAt(e,t){return""+this.getValueAt(e,t)}getYPosByRowIndex(e){return 0}getRowHeight(e){return this.defaultRowHeight}isEditable(e,t){return!1}isFilterable(){return!1}isRowCheckable(e){return!1}isRowChecked(e){}isSelectable(e,t){return!1}setRowChecked(e,t){}setValue(e,t,s){return!1}toggleHeaderGroup(e){const t=this.arr[e.rowIdx][e.colIdx];return t!=null&&t.toggle&&t.visibility!=="always"&&(t.closed=!t.closed,this.init()),this.mergeColumnDefs()}getToggleGroupStates(){return Array.from(this.getToggleGroups(),([e,t])=>({id:e,closed:!!t.closed}))}setGroupClosed(e,t){const s=this.getToggleGroups().get(e);if(s)return!!s.closed!==t&&(s.closed=t,this.init()),this.mergeColumnDefs()}setGroups(e,t){return this.groups=e,this.groupExts=U.buildGroupExts(e),t&&(this.columnDefs=t),this.arr=this.buildArray(),this.mergeColumnDefs()}getToggleGroups(){const e=new Map,t=(s,o)=>{var i;for(const r of s??[]){const n=o?o+"/"+String(r.data):String(r.data);if((i=r.children)!=null&&i.length){if(r.toggle&&r.visibility!=="always"){let l=r.id??n;for(let c=2;e.has(l);c++)l=(r.id??n)+"#"+c;e.set(l,r)}t(r.children,n)}}};return t(this.groupExts,""),e}mergeColumnDefs(){const e=U.buildColumnDefs(this.groupExts),t=new Map(this.columnDefs.map(o=>[o.property,o])),s=e.map(o=>{const i=t.get(o.property);return i?(is(i,o.isVisible),i):(is(o,o.isVisible),o)});return this.columnDefs=s,s}}class to{constructor(e){this.getStorageKeyFn=e}autoConvertMapToObject(e){const t={};return e instanceof Map&&e.forEach((o,i)=>{t[i]=o}),t}checkAndPersistItem(e,t){const s=this.getStorageKeyFn;if(s){const o=s();if(o){const i=o+e;if((t+"").includes("Map")){const r=this.autoConvertMapToObject(t);this.persistItem(i,r)}else this.persistItem(i,t)}}}persistItem(e,t){try{t?localStorage.setItem(e,JSON.stringify(t)):localStorage.removeItem(e)}catch{}}loadFromLocalStorage(e){try{const t=localStorage.getItem(e);if(t)return JSON.parse(t)}catch{}return null}}class Ta extends to{constructor(e){super(e),this.SCROLL_STATE="scrollState",this.scrollOffset=[0,0],this.load()}getScrollOffset(){return this.scrollOffset}updateScrollOffset(e){this.scrollOffset=e,this.checkAndPersistItem(this.SCROLL_STATE,this.scrollOffset)}load(){const e=this.getStorageKeyFn;if(e){const t=e();if(t){const s=t+this.SCROLL_STATE;let o=this.loadFromLocalStorage(s);this.scrollOffset=o||[0,0]}}}}class Qi{constructor(e="collapsed",t=[],s=!1,o=!1){this.mode=e,this.rowIds=t,this.allCollapsed=s,this.allExpanded=o}}class Ia extends to{constructor(e){super(e),this.COLLAPSED_EXPANDED_STATE="collapsedExpandedState",this.collapsedExpandedState=new Qi,this.stored=!1,this.load()}hasStoredState(){return this.stored}initModeIfEmpty(e){!this.stored&&!this.collapsedExpandedState.rowIds.length&&(this.collapsedExpandedState.mode=e)}collapsedExpandedStateGet(){return this.collapsedExpandedState}collapsedExpandedStateIncludes(e){return this.collapsedExpandedState.rowIds.includes(e)}collapsedStateIdsPush(e){this.collapsedExpandedState.rowIds.includes(e)||(this.collapsedExpandedState.rowIds.push(e),this.collapsedExpandedState.allCollapsed=!1,this.collapsedExpandedState.allExpanded=!1,this.persist())}collapsedStateIdsRemove(e){const t=this.collapsedExpandedState.rowIds.indexOf(e);t!==-1&&(this.collapsedExpandedState.rowIds.splice(t,1),this.collapsedExpandedState.allCollapsed=!1,this.collapsedExpandedState.allExpanded=!1,this.persist())}collapsedStateAll(e){this.collapsedExpandedState.rowIds=[],this.collapsedExpandedState.mode=e?"collapsed":"expanded",this.collapsedExpandedState.allCollapsed=!e,this.collapsedExpandedState.allExpanded=e,this.persist()}load(){const e=this.getStorageKeyFn;if(e){const t=e();if(t){const s=t+this.COLLAPSED_EXPANDED_STATE,o=this.loadFromLocalStorage(s);o&&(this.collapsedExpandedState=o,this.stored=!0)}}}persist(){this.stored=!0,this.checkAndPersistItem(this.COLLAPSED_EXPANDED_STATE,this.collapsedExpandedState)}}class Da extends to{constructor(e){super(e),this.SORTING_STATE="sortingState",this.sortItems=[],this.load()}getSortItems(){return this.sortItems}setSortItems(e){this.sortItems=e,this.checkAndPersistItem(this.SORTING_STATE,this.sortItems)}load(){const e=this.getStorageKeyFn;if(e){const t=e();if(t){const s=t+this.SORTING_STATE,o=this.loadFromLocalStorage(s);this.sortItems=o||[]}}}}class ka{filterPredict(e,t,s=this.objectToString.bind(this)){if(!e)return!1;if(!t)return!0;t=t.toLowerCase();const o="+",i="-",r=t.toLowerCase().split(" ").filter(d=>d!==o&&d!==i&&d!==""),n=r.filter(d=>!d.startsWith(o)&&!d.startsWith(i)),l=r.filter(d=>d.startsWith(o)).map(d=>d.replace(/\+/g,"")),c=r.filter(d=>d.startsWith(i)).map(d=>d.replace(/-/g,""));let h=!n.length;for(let d=0;d<n.length;d++)(h||s(e).includes(n[d]))&&(h=!0);if(!h)return!1;for(let d=0;d<l.length;d++)if(!s(e).includes(l[d]))return!1;for(let d=0;d<c.length;d++)if(s(e).includes(c[d]))return!1;return!0}filterRows(e,t,s=o=>JSON.stringify(o).toLowerCase()){if(!e)return[];if(!t)return[...e];t=t.toLowerCase();const o="+",i="-",r=t.toLowerCase().split(" ").filter(h=>h!==o&&h!==i&&h!==""),n=r.filter(h=>!h.startsWith(o)&&!h.startsWith(i)),l=r.filter(h=>h.startsWith(o)).map(h=>h.replace(/\+/g,"")),c=r.filter(h=>h.startsWith(i)).map(h=>h.replace(/-/g,""));return e==null?void 0:e.filter(h=>{let d=!n.length;for(let u=0;u<n.length;u++)(d||s(h).includes(n[u]))&&(d=!0);if(!d)return!1;for(let u=0;u<l.length;u++)if(!s(h).includes(l[u]))return!1;for(let u=0;u<c.length;u++)if(s(h).includes(c[u]))return!1;return!0})}objectToString(e){if(!e)return"";const t=[],s=Object.keys(e);for(let o=0;o<s.length;o++){const i=s[o];t.push(e[i])}return t.join(" ").toLowerCase()}}class Fa{static bodyRenderer(e){return new V(void 0,e,void 0)}}class La{constructor(e,t=!0,s=!1){this.property=e,this.skipCheckableCheck=t,this.readonly=s}render(e,t,s,o,i,r,n){if(this.readonly||this.skipCheckableCheck||i.isRowCheckable(t)){n.addClass(e,"ge-table-row-checkbox-div");const l=i.getRowByIndex(t),h=i.getValueByT(l,this.property)===!0?"checked":"",d=this.readonly?" readonly ":"";if(n.addClass(e,"ge-padding-property-checkbox"),e.innerHTML=`
|
|
353
353
|
<input
|
|
354
354
|
type="checkbox"
|
|
355
355
|
data-area="${o}"
|
|
@@ -360,16 +360,16 @@ render scope: this.lastFullVisibleRowIndex <- `+this.lastFullVisibleRowIndex),th
|
|
|
360
360
|
tabindex="-1"
|
|
361
361
|
${h}
|
|
362
362
|
${d}
|
|
363
|
-
class="ge-input-checkbox">`,!this.readonly){const u=e.querySelector(".ge-input-checkbox");u&&u.addEventListener("click",(f,g)=>(
|
|
363
|
+
class="ge-input-checkbox">`,!this.readonly){const u=e.querySelector(".ge-input-checkbox");u&&u.addEventListener("click",(f,g)=>(l[this.property]=!l[this.property],!0))}}}}class Pa{render(e,t,s,o,i,r,n){if(r){const l=new Date(r);e.innerText=isNaN(l.getTime())?String(r):l.toISOString()}}}class Va{constructor(){this.formatter=new Intl.DateTimeFormat("de-DE",{year:"numeric",month:"2-digit",day:"2-digit"})}render(e,t,s,o,i,r,n){if(r){let l="";try{l=this.formatter.format(new Date(r))}catch{l=r}e.innerHTML=`
|
|
364
364
|
<div class="ge-table-label-div" data-row-index="${t}" data-col-index="${s}" data-area="${o}" style="position: relative; background: transparent; width: 100%; height: 100%;">
|
|
365
|
-
<div class="ge-table-label" data-row-index="${t}" data-col-index="${s}" data-area="${o}">${
|
|
366
|
-
</div>`}}}class
|
|
365
|
+
<div class="ge-table-label" data-row-index="${t}" data-col-index="${s}" data-area="${o}">${I(l)}</div>
|
|
366
|
+
</div>`}}}class Oa{render(e,t,s,o,i,r,n){if(r){const l=new Date(r);e.innerText=isNaN(l.getTime())?String(r):l.toLocaleDateString()}}}class Ba{constructor(e={male:"male",female:"female"}){this.ariaLabels=e}render(e,t,s,o,i,r,n){r==="male"||r==="m"?this.addSymbol(e,"♂",this.ariaLabels.male,n):(r==="female"||r==="f")&&this.addSymbol(e,"♀",this.ariaLabels.female,n)}addSymbol(e,t,s,o){e.innerText="";const i=o.createElement("span");o.setAttribute(i,"role","img"),o.setAttribute(i,"aria-label",s),o.appendChild(i,o.createText(t)),o.appendChild(e,i)}}class Na{constructor(e=100,t=!1,s=o=>`${Math.round(o)} %`){this.maxValue=e,this.labelVisible=t,this.ariaLabel=s}render(e,t,s,o,i,r,n){if(n.addClass(e,"ge-progressbar-div"),!isNaN(r)){const l=Number(r),c=l*100/this.maxValue,h=this.labelVisible?Math.round(c)+"%":"";e.innerHTML=`
|
|
367
367
|
<div class="ge-table-label-div"
|
|
368
368
|
data-row-index="${t}"
|
|
369
369
|
data-col-index="${s}"
|
|
370
370
|
data-area="${o}"
|
|
371
371
|
role="img"
|
|
372
|
-
aria-label="${
|
|
372
|
+
aria-label="${I(this.ariaLabel(c,l))}"
|
|
373
373
|
title="${h}"
|
|
374
374
|
style="position: relative; background: transparent; width: 100%; height: 100%;">
|
|
375
375
|
<div class="ge-table-progress-container"
|
|
@@ -384,19 +384,19 @@ render scope: this.lastFullVisibleRowIndex <- `+this.lastFullVisibleRowIndex),th
|
|
|
384
384
|
data-area="${o}">
|
|
385
385
|
</div>
|
|
386
386
|
</div>
|
|
387
|
-
</div>`}}}class
|
|
387
|
+
</div>`}}}class Ha{constructor(e={true:"Yes",false:"No"}){this.ariaLabels=e}render(e,t,s,o,i,r,n){r==="true"||r===!0?e.innerHTML=`<span class="ge-true-text-color" role="img" aria-label="${I(this.ariaLabels.true)}">✅</span>`:r==="false"||r===!1?e.innerHTML=`<span class="ge-false-text-color" role="img" aria-label="${I(this.ariaLabels.false)}">❌</span>`:e.innerText=""}}class _a{render(e,t,s,o,i,r,n){if(r){const l=new Date(r);e.innerText=isNaN(l.getTime())?String(r):l.toISOString().replace(/T/g," ").replace(/\..*/g,"")}}}class $a{constructor(e=Number.MIN_SAFE_INTEGER,t=Number.MAX_SAFE_INTEGER){this.min=e,this.max=t}render(e,t,s,o,i,r,n){(r||r===0)&&(e.innerHTML=`
|
|
388
388
|
<div class="ge-table-label-div">
|
|
389
|
-
<div class="ge-table-label">${
|
|
390
|
-
</div>`,(typeof r=="string"||isNaN(r)||r<this.min||r>this.max)&&n.addClass(e,"ge-cell-error"))}}class
|
|
389
|
+
<div class="ge-table-label">${I(r)}</div>
|
|
390
|
+
</div>`,(typeof r=="string"||isNaN(r)||r<this.min||r>this.max)&&n.addClass(e,"ge-cell-error"))}}class Ga{constructor(e,t=s=>s===1?"1 star":`${s} stars`){this.property=e,this.ariaLabel=t}render(e,t,s,o,i,r,n){n.addClass(e,"ge-star-rating-div");const l=i.getRowByIndex(t),c=+(""+i.getValueByT(l,this.property));if(!isNaN(c)){const h=[];for(let u=0;u<c;u++)h.push("★");const d=h.join(" ");e.innerHTML=`
|
|
391
391
|
<div class="ge-table-label-div" data-row-index="${t}" data-col-index="${s}" data-area="${o}" style="position: relative; background: transparent; width: 100%; height: 100%;">
|
|
392
|
-
<div class="ge-table-label" data-row-index="${t}" data-col-index="${s}" data-area="${o}" role="img" aria-label="${
|
|
393
|
-
</div>`}}}class
|
|
392
|
+
<div class="ge-table-label" data-row-index="${t}" data-col-index="${s}" data-area="${o}" role="img" aria-label="${I(this.ariaLabel(c))}">${d}</div>
|
|
393
|
+
</div>`}}}class Wa{render(e,t,s,o,i,r,n){if(r!=null&&r.length){const l=n.createElement("div");n.addClass(l,"ge-table-label-div"),n.appendChild(e,l);const c=n.createElement("div");n.addClass(c,"ge-table-label"),n.appendChild(l,c);const h=n.createText(r.join(", "));n.appendChild(c,h)}else e.innerText=""}}class Ua{constructor(e,t=100,s=!1,o=i=>`${Math.round(i)} %`){this.property=e,this.maxValue=t,this.labelVisible=s,this.ariaLabel=o}render(e,t,s,o,i,r,n){n.addClass(e,"ge-star-rating-div");const l=i.getRowByIndex(t),c=+(""+i.getValueByT(l,this.property));if(!isNaN(c)){const h=c*100/this.maxValue,d=this.labelVisible?Math.round(h)+"%":"";e.innerHTML=`
|
|
394
394
|
<div class="ge-table-label-div"
|
|
395
395
|
data-row-index="${t}"
|
|
396
396
|
data-col-index="${s}"
|
|
397
397
|
data-area="${o}"
|
|
398
398
|
role="img"
|
|
399
|
-
aria-label="${
|
|
399
|
+
aria-label="${I(this.ariaLabel(h,c))}"
|
|
400
400
|
title="${d}"
|
|
401
401
|
style="position: relative; background: transparent; width: 100%; height: 100%;">
|
|
402
402
|
<div class="ge-table-progress-container"
|
|
@@ -411,7 +411,7 @@ render scope: this.lastFullVisibleRowIndex <- `+this.lastFullVisibleRowIndex),th
|
|
|
411
411
|
data-area="${o}">
|
|
412
412
|
</div>
|
|
413
413
|
</div>
|
|
414
|
-
</div>`}}}class
|
|
414
|
+
</div>`}}}class za{render(e,t,s,o,i,r,n){if(r||r===0){e.innerHTML=`
|
|
415
415
|
<div
|
|
416
416
|
class="ge-table-label-div"
|
|
417
417
|
data-row-index="${t}"
|
|
@@ -422,13 +422,13 @@ render scope: this.lastFullVisibleRowIndex <- `+this.lastFullVisibleRowIndex),th
|
|
|
422
422
|
class="ge-table-label"
|
|
423
423
|
data-row-index="${t}"
|
|
424
424
|
data-col-index="${s}"
|
|
425
|
-
data-area="${o}">${
|
|
425
|
+
data-area="${o}">${I(r)}</div></div>`;const l=Number(r);l>0?n.addClass(e,"ge-positive-text-color"):l<0&&n.addClass(e,"ge-negative-text-color")}}}class so{constructor(e,t,s,o,i,r){this.action=e,this.area=t,this.areaModel=s,this.rowIndex=o,this.columnIndex=i,this.id=r}}class de{constructor(e,t,s="",o="",i="button",r=!0){this.action=e,this.label=t,this.icon=s,this.elementClass=o,this.elementType=i,this.enabled=r}}class er{constructor(e,t){this.actionEventListener=e,this.crudActions=t}render(e,t,s,o,i,r,n){n.addClass(e,"ge-table-row-action-div");const l=r,h=this.getCrudActions(r).map(d=>d.elementType==="button"?this.buildButtonHtml(d,o,t,s,l):this.buildLinkHtml(d,o,t,s,l));e.innerHTML=h.join(""),this.addClickEventListeners(e,o,i)}buildButtonHtml(e,t,s,o,i){const r=e.enabled?'data-listen="click"':"disabled";return`
|
|
426
426
|
<button
|
|
427
427
|
type="button"
|
|
428
428
|
tabindex="-1"
|
|
429
429
|
data-area="${t}"
|
|
430
430
|
data-action="${e.action}"
|
|
431
|
-
data-id="${
|
|
431
|
+
data-id="${I(i)}"
|
|
432
432
|
data-row-index="${s}"
|
|
433
433
|
data-col-index="${o}"
|
|
434
434
|
style="height: 100%;line-height: 1;"
|
|
@@ -441,13 +441,13 @@ render scope: this.lastFullVisibleRowIndex <- `+this.lastFullVisibleRowIndex),th
|
|
|
441
441
|
tabindex="-1"
|
|
442
442
|
data-area="${t}"
|
|
443
443
|
data-action="${e.action}"
|
|
444
|
-
data-id="${
|
|
444
|
+
data-id="${I(i)}"
|
|
445
445
|
data-row-index="${s}"
|
|
446
446
|
data-col-index="${o}"
|
|
447
447
|
${r}
|
|
448
448
|
class="ge-table-cell-action ge-table-cell-link ${e.elementClass}">
|
|
449
449
|
${e.label}
|
|
450
|
-
</a>`}addClickEventListeners(e,t,s){e.querySelectorAll(".ge-table-cell-action").forEach(i=>{i.addEventListener("click",r=>{const n=r.target;if(n){const
|
|
450
|
+
</a>`}addClickEventListeners(e,t,s){e.querySelectorAll(".ge-table-cell-action").forEach(i=>{i.addEventListener("click",r=>{const n=r.target;if(n){const l=this.createActionEvent(n,s);l&&this.actionEventListener.onActionEvent(l)}})})}createActionEvent(e,t){const s=e.getAttribute("data-area"),o=e.getAttribute("data-row-index"),i=e.getAttribute("data-col-index"),r=e.getAttribute("data-action")??"unknown",n=e.getAttribute("data-id")??"unknown";if(s&&o&&i){const l=ct(s),c=Number(o),h=Number(i);return new so(r,l,t,c,h,n)}return null}getCrudActions(e){return Array.isArray(e)&&e.every(t=>t instanceof de)?e:this.crudActions}}const Ka=function(a,e,t){return a===""||a===null||a===void 0?"":Number(a)};class oo{constructor(e){this.options=e}static create(e){return new oo(e.map(t=>new Xi(t,t)))}render(e,t,s,o,i,r,n){if(i.isEditable(t,s)){n.addClass(e,"ge-table-row-select-div");const l=r!==void 0?r:i.getValueAt(t,s);let c=[];for(let d of this.options){const u=d.value===l?" selected ":"";c.push(`<option value="${I(d.value)}" ${u}>${I(d.label)}</option>`)}const h=c.join("");e.innerHTML=`
|
|
451
451
|
<select
|
|
452
452
|
autofocus
|
|
453
453
|
data-listen="change"
|
|
@@ -455,8 +455,8 @@ render scope: this.lastFullVisibleRowIndex <- `+this.lastFullVisibleRowIndex),th
|
|
|
455
455
|
data-row-index="${t}"
|
|
456
456
|
data-col-index="${s}"
|
|
457
457
|
data-input-type="text"
|
|
458
|
-
style="width:100%;height:100%;border:0;padding:0
|
|
459
|
-
class="ge-table-cell-editor-select">${h}</select>`}}}class
|
|
458
|
+
style="width:100%;height:100%;border:0;padding:0;padding-inline-start:8px;"
|
|
459
|
+
class="ge-table-cell-editor-select">${h}</select>`}}}class ja extends pe{constructor(e){super("row","multi"),this.model=e}getSelectedRowItems(e){if(this.isAllSelected()&&!this.negativeRanges.length)return e;const t=new Set(this.getMergedRowIndices(e.length));return e.filter((s,o)=>t.has(o))}selectRow(e){this.addRange(A.singleRow(e))}unselectRow(e){this.removeSelection(A.singleRow(e))}toggleSelection(){if(this.isAllSelected())this.clear();else if(this.hasNoSelection())this.selectAll();else{const e=this.model.getAllRows();this.silent=!0;for(let t=0;t<e.length;t++)this.toggleRow(t);this.silent=!1,this.fireChangeEvent()}}toggleFilteredRowsSelection(){if(this.isAllSelected())this.clear();else if(this.hasNoSelection()){const e=this.model.getFilteredRows();this.silent=!0;for(let t=0;t<e.length;t++)this.selectRow(t);this.silent=!1,this.fireChangeEvent()}else{const e=this.model.getFilteredRows();this.silent=!0;for(let t=0;t<e.length;t++)this.toggleRow(t);this.silent=!1,this.fireChangeEvent()}}toggleRow(e){this.isSelected(e,0)?this.unselectRow(e):this.reselectPoint(e,0)?this.fireChangeEvent():this.selectRow(e)}}class Ya{constructor(e,t,s){this.r=e,this.g=t,this.b=s}}class Es{constructor(e,t,s,o){this.minValue=e,this.minColor=t,this.maxValue=s,this.maxColor=o}}class Qe{static normalize(e,t,s,o=0,i=1){return(e-t)/(s-t)*(i-o)+o}static getTwoColorGradientRGB(e,t){const s=Qe.normalize(e,t.minValue,t.maxValue,0,1),o=t.maxColor.r-t.minColor.r,i=t.maxColor.g-t.minColor.g,r=t.maxColor.b-t.minColor.b,n=o*s+t.minColor.r,l=i*s+t.minColor.g,c=r*s+t.minColor.b;return`rgb(${Math.round(n)}, ${Math.round(l)}, ${Math.round(c)})`}static getThreeColorGradientRGB(e,t){return e<t.middleValue?Qe.getTwoColorGradientRGB(e,new Es(t.minValue,t.minColor,t.middleValue,t.middleColor)):e>t.middleValue?Qe.getTwoColorGradientRGB(e,new Es(t.middleValue,t.middleColor,t.maxValue,t.maxColor)):`rgb(${t.middleColor.r}, ${t.middleColor.g}, ${t.middleColor.b})`}}class Xa{constructor(e,t,s,o,i,r){this.minValue=e,this.minColor=t,this.middleValue=s,this.middleColor=o,this.maxValue=i,this.maxColor=r}}class tr{constructor(e=!0,t=!0,s=(r,n)=>r*10+10,o=50,i=450){this.autoCalc=e,this.takeHeaderLabelsIntoAccount=t,this.charCountToWidth=s,this.minWidth=o,this.maxWidth=i}}class sr{constructor(e){this.object=e}openDialog(){const e=document.createElement("dialog");e.classList.add("ge-table-crud-object-view"),this.direction&&e.setAttribute("dir",this.direction),e.innerHTML=`
|
|
460
460
|
<div class="ge-table-dialog-header">Item</div>
|
|
461
461
|
<div class="ge-table-dialog-content">
|
|
462
462
|
${this.generateHtmlTable(this.object)}
|
|
@@ -476,10 +476,10 @@ render scope: this.lastFullVisibleRowIndex <- `+this.lastFullVisibleRowIndex),th
|
|
|
476
476
|
</tbody>
|
|
477
477
|
</table>`}generateTableRows(e,t=""){const s=[],o=(i,r=null,n=!1)=>`
|
|
478
478
|
<tr>
|
|
479
|
-
<td${n?' class="ge-table-crud-object-view-object-child"':""}>${
|
|
480
|
-
<td>${
|
|
481
|
-
</tr>`;for(const i in e){if(!e.hasOwnProperty(i))continue;const r=e[i],n=this.getCombinedKey(t,i),
|
|
482
|
-
<div class="ge-table-dialog-header">${
|
|
479
|
+
<td${n?' class="ge-table-crud-object-view-object-child"':""}>${I(i)}</td>
|
|
480
|
+
<td>${I(r)}</td>
|
|
481
|
+
</tr>`;for(const i in e){if(!e.hasOwnProperty(i))continue;const r=e[i],n=this.getCombinedKey(t,i),l=this.getLabel(n);typeof r=="object"&&r!==null?(s.push(o(l,null,!0)),s.push(this.generateTableRows(r,n))):s.push(o(l,String(r)))}return s.join("")}}const Mo=new Set(["__proto__","constructor","prototype"]);class Pe{constructor(e,t,s="Edit Item"){this.idKey=e,this.dialogTitle=s,this.fieldPaths=[],this.object=Pe.deepCopy(t)}openDialog(e){const t=document.createElement("dialog");t.classList.add("ge-table-crud-object-edit"),this.direction&&t.setAttribute("dir",this.direction),this.fieldPaths=[],t.innerHTML=`
|
|
482
|
+
<div class="ge-table-dialog-header">${I(this.dialogTitle)}</div>
|
|
483
483
|
<div class="ge-table-dialog-content">
|
|
484
484
|
<form>${this.generateFields(this.object)}</form>
|
|
485
485
|
</div>
|
|
@@ -487,9 +487,9 @@ render scope: this.lastFullVisibleRowIndex <- `+this.lastFullVisibleRowIndex),th
|
|
|
487
487
|
<button class="ge-table-dialog-footer-save-button primary">Save</button>
|
|
488
488
|
<button class="ge-table-dialog-footer-cancel-button">Cancel</button>
|
|
489
489
|
</div>
|
|
490
|
-
`,document.body.appendChild(t),t.addEventListener("close",()=>t.remove());const s=t.querySelector("form");s.addEventListener("submit",r=>r.preventDefault());const o=t.querySelector(".ge-table-dialog-footer-save-button"),i=t.querySelector(".ge-table-dialog-footer-cancel-button");o.addEventListener("click",()=>{s.querySelectorAll("input[data-field-index]").forEach(r=>{const n=this.fieldPaths[Number(r.dataset.fieldIndex)];if(n){const
|
|
490
|
+
`,document.body.appendChild(t),t.addEventListener("close",()=>t.remove());const s=t.querySelector("form");s.addEventListener("submit",r=>r.preventDefault());const o=t.querySelector(".ge-table-dialog-footer-save-button"),i=t.querySelector(".ge-table-dialog-footer-cancel-button");o.addEventListener("click",()=>{s.querySelectorAll("input[data-field-index]").forEach(r=>{const n=this.fieldPaths[Number(r.dataset.fieldIndex)];if(n){const l=this.getNestedValue(this.object,n);this.setNestedValue(this.object,n,this.readInput(r,l))}}),e(this.object),t.close("save")}),i.addEventListener("click",()=>t.close("cancel")),t.showModal()}generateFields(e,t=[]){const s=[];for(const o in e){if(!Object.prototype.hasOwnProperty.call(e,o)||this.idKey===o||Mo.has(o))continue;const i=[...t,o],r=i.join(" "),n=e[o];if(typeof n=="object"&&n!==null){s.push(`<fieldset class="form-group"><legend>${I(r)}</legend>${this.generateFields(n,i)}</fieldset>`);continue}const l=I(i.join(".")),c=`id="${l}" name="${l}" data-field-index="${this.fieldPaths.push(i)-1}"`;let h;typeof n=="number"?h=`<input type="number" step="any" ${c} value="${I(n)}" />`:typeof n=="boolean"?h=`<input type="checkbox" ${c} ${n?"checked":""} />`:h=`<input type="text" ${c} value="${I(n)}" />`,s.push(`
|
|
491
491
|
<div class="form-field">
|
|
492
|
-
<label for="${
|
|
492
|
+
<label for="${l}">${I(r)}</label>
|
|
493
493
|
${h}
|
|
494
494
|
</div>
|
|
495
|
-
`)}return s.join("")}readInput(e,t){return e.type==="checkbox"?e.checked:e.type==="number"?e.value===""?null:Number(e.value):t==null&&e.value===""?t:e.value}getNestedValue(e,t){let s=e;for(const o of t){if(s===null||typeof s!="object")return;s=s[o]}return s}setNestedValue(e,t,s){if(t.some(i=>vo.has(i)))return;let o=e;for(let i=0;i<t.length-1;i++){const r=t[i];(o[r]===null||typeof o[r]!="object")&&(o[r]={}),o=o[r]}o[t[t.length-1]]=s}static deepCopy(e){try{return structuredClone(e)}catch{return JSON.parse(JSON.stringify(e))}}}class zi{constructor(){this.urls={list:{url:"",method:"GET"}},this.singleRowActions=[new le("VIEW","View","","","link"),new le("EDIT","Edit","","","link"),new le("CLONE","Clone","","","link"),new le("DELETE","Delete","","","link")],this.tableActions=[new le("CREATE","Create","","","button"),new le("DELETE_SELECTED","Delete Selected","","","button")],this.autoAddActionColumn=!0,this.columnWidths=new Wi,this.calcFixedRightColumnCount=e=>e>6?1:0,this.getHeadersInit=()=>({}),this.getIdKey=()=>"id",this.getIdByObject=e=>{const t=this.getIdKey()??"id";return e?e[t]:void 0},this.fetchList=e=>Ue(e,"list","GET",{}),this.fetchItem=(e,t)=>Ue(e,"read","GET",{id:t}),this.updateItem=(e,t,s)=>Ue(e,"update","PATCH",{id:t,item:s}),this.createItem=(e,t)=>Ue(e,"create","POST",{item:t}),this.deleteItem=(e,t)=>Ue(e,"delete","DELETE",{id:t}),this.getEmptyItem=()=>{}}}function Ue(l,e,t,s){var n;const o=(n=l.urls)==null?void 0:n[e];if(!(o!=null&&o.url))return Promise.reject(new Error(`CrudOptions: no URL for "${e}" (set urls.${e}.url)`));const i="id"in s?o.url.split("{id}").join(encodeURIComponent(String(s.id))):o.url,r={headers:l.getHeadersInit?l.getHeadersInit():{},method:o.method??t};if("item"in s){const a=new Headers(r.headers);a.has("Content-Type")||a.set("Content-Type","application/json"),r.headers=a,r.body=JSON.stringify(s.item)}return fetch(i,r).then(a=>Nl(a,r.method,i))}function Nl(l,e,t){return l.ok?l.text().then(s=>s?JSON.parse(s):void 0):Promise.reject(new Error(`CrudOptions: ${e} ${t} failed: ${l.status} ${l.statusText}`.trim()))}class Bl{constructor(){this.crudOptions=new zi,this.listenActionEvent=e=>{},this.pendingRequests=0}createTableModel(e,t,s=i=>{},o=i=>{}){this.crudOptions=e,this.listenActionEvent=o,e.fetchList(e).then(i=>{var r,n,a,c;if(t.rows=i,i!=null&&i.length){const h=(r=t.columnDefs)!=null&&r.length?t.columnDefs.map(y=>y.property):this.extractProperties(i[0]),d=new he("row","multi"),u=()=>d;this.tableOptions={...new Ve,...t.tableOptions,hoverColumnVisible:!1,getSelectionModel:u};const f=this.calcAutoColumnWidths(i,h),g=(n=t.columnDefs)!=null&&n.length?t.columnDefs:h.map(((y,w)=>new J(y,y.toUpperCase(),new x(f[w],"px"))));if((a=e==null?void 0:e.columnWidths)!=null&&a.autoCalc)for(let y=0;y<g.length;y++){const w=g[y];w.width=new x(f[y],"px")}if(e.autoAddActionColumn){let y=new J(this.getIdKey(),"Actions",Ti,new V(["ge-table-text-align-left"],["ge-table-text-align-left ge-table-actions-cell"],void 0));y.rendererMap=new V(void 0,new Gi(this,e.singleRowActions),void 0),g.push(y)}const p=0,m=e.calcFixedRightColumnCount(g.length);this.tableModel=Y.buildByTypedRowsParam({rows:i,columnDefs:g,tableOptions:this.tableOptions,fixedLeftColumnCount:p,fixedRightColumnCount:m}),this.tableModel.getSelectionModel=u,this.bodyModel=(c=this.tableModel)==null?void 0:c.getBodyModel();const b=new Li(this.tableModel,this.tableOptions);s(b)}},i=>this.logError("loading the list",i))}openDialogForCreate(){if(this.bodyModel){const e=new qs("CREATE","body",this.bodyModel,-1,-1,null);this.onActionEvent(e)}}onActionEvent(e){this.listenActionEvent&&this.listenActionEvent(e);const t=this.crudOptions,s=this.getIdKey(),o=e.action,i=e.id;o==="VIEW"?this.whileLoading(()=>t.fetchItem(t,i)).then(r=>new Ui(r).openDialog()).catch(r=>this.logError(o,r)):o==="EDIT"?this.whileLoading(()=>t.fetchItem(t,i)).then(r=>new Ie(s,r).openDialog(n=>this.whileLoading(()=>t.updateItem(t,i,n)).then(a=>this.updateRow(i,this.isItemWithId(a)?a:n)).catch(a=>this.logError(o,a)))).catch(r=>this.logError(o,r)):o==="CLONE"?this.whileLoading(()=>t.fetchItem(t,i)).then(r=>new Ie(s,r,"Clone Item").openDialog(n=>this.createItem(o,n))).catch(r=>this.logError(o,r)):o==="CREATE"?new Ie(s,t.getEmptyItem()??{},"Create Item").openDialog(r=>this.createItem(o,r)):o==="DELETE"&&this.whileLoading(()=>t.deleteItem(t,i)).then(()=>{var r,n,a,c,h,d,u;(r=this.bodyModel)==null||r.filterRowsByPredict(f=>!this.hasId(f,i)),(a=(n=this.tableModel)==null?void 0:n.getTableScope())==null||a.clearSelection(!0),(h=(c=this.tableModel)==null?void 0:c.getTableScope())==null||h.invalidateAggregates(),(u=(d=this.tableModel)==null?void 0:d.getTableScope())==null||u.repaintHard()}).catch(r=>this.logError(o,r))}createItem(e,t){const s=this.crudOptions,{[this.getIdKey()]:o,...i}=t;this.whileLoading(()=>s.createItem(s,i).then(r=>this.isItemWithId(r)?this.addRow(r):this.reloadRows())).catch(r=>this.logError(e,r))}updateRow(e,t){var o,i,r,n,a;const s=(o=this.bodyModel)==null?void 0:o.getAllRows().find(c=>this.hasId(c,e));s&&(Object.assign(s,t),(r=(i=this.tableModel)==null?void 0:i.getTableScope())==null||r.invalidateAggregates(),(a=(n=this.tableModel)==null?void 0:n.getTableScope())==null||a.repaint())}addRow(e){var s,o,i,r;const t=this.bodyModel;if(t){const n=t.getAllRows(),a=t.getFilteredRows();n.push(e),a!==n&&a.push(e),(o=(s=this.tableModel)==null?void 0:s.getTableScope())==null||o.invalidateAggregates(),(r=(i=this.tableModel)==null?void 0:i.getTableScope())==null||r.repaintHard()}}reloadRows(){const e=this.crudOptions;return e.fetchList(e).then(t=>{var o,i;(o=this.bodyModel)==null||o.setRows(t??[]);const s=(i=this.tableModel)==null?void 0:i.getTableScope();s==null||s.externalFilterChanged(!1),s==null||s.repaintHard()})}whileLoading(e){var o;const t=(o=this.tableModel)==null?void 0:o.getTableScope();this.pendingRequests++,t==null||t.showLoadingOverlay();const s=()=>{this.pendingRequests=Math.max(0,this.pendingRequests-1),this.pendingRequests===0&&(t==null||t.hideOverlay())};return Promise.resolve().then(e).then(i=>(s(),i),i=>{throw s(),i})}getIdKey(){var e,t;return((t=(e=this.crudOptions).getIdKey)==null?void 0:t.call(e))??"id"}hasId(e,t){const s=this.getValueByT(e,this.getIdKey());return s!=null&&String(s)===String(t)}isItemWithId(e){if(e===null||typeof e!="object"||Array.isArray(e))return!1;const t=this.getValueByT(e,this.getIdKey());return t!=null}logError(e,t){console.error(`CrudTableModelFactory: ${e} failed`,t)}calcAutoColumnWidths(e,t,s=t){var c;const o=t.length;if(!((c=this.crudOptions.columnWidths)!=null&&c.autoCalc))return new Array(o).fill(200);const i=e.length??0,r=new Array(o).fill(0);for(let h=0;h<i;h++)for(let d=0;d<o;d++){const u=t[d],f=this.getValueByT(e[h],u),g=(f==null?void 0:f.toString().length)||0;g>r[d]&&(r[d]=g)}if(this.crudOptions.columnWidths.takeHeaderLabelsIntoAccount)for(let h=0;h<o;h++){const d=s[h].length||0;d>r[h]&&(r[h]=d)}const n=this.crudOptions.columnWidths.minWidth,a=this.crudOptions.columnWidths.maxWidth;return r.map((h,d)=>Math.min(a,Math.max(this.crudOptions.columnWidths.charCountToWidth(h,d),n)))}getValueByT(e,t){return t.includes(".")?this.getPropertyValue(e,t.split(".")):e[t]}getPropertyValue(e,t){const s=t.shift(),o=e[s];return o&&t.length?this.getPropertyValue(o,t):o}extractProperties(e,t="",s=[]){for(const o in e)if(e.hasOwnProperty(o)){const i=t?`${t}.${o}`:o;typeof e[o]=="object"&&e[o]!==null&&!Array.isArray(e[o])?this.extractProperties(e[o],i,s):s.push(i)}return s}}class _l{constructor(e,t){this.method=e,this.url=t}}class ji{constructor(e,t,s,o,i,r,n,a){this.key=e,this.label=t,this.level=s,this.field=o,this.path=i,this.parent=r,this.source=n,this.type="RowGroup",this.children=[],this.count=0,this.results={},this.sourceIndices=[],this.states=[],this.idParts=[...(r==null?void 0:r.idParts)??[],[o,a]]}get id(){return"rowgroup:"+JSON.stringify(this.idParts)}isLeaf(){return this.children.length===0}getRows(e=!0){return this.collectIndices(e,[]).map(t=>this.source[t])}collectIndices(e,t){if(this.isLeaf()){const s=e?this.accept:void 0;for(const o of this.sourceIndices)(!s||s(o))&&t.push(o)}else for(const s of this.children)s.collectIndices(e,t);return t}}function At(l,e,t){var r;const s=[],o=e.length;if(!o)return s;const i={byKey:new Map};for(let n=0;n<l.length;n++){const a=l[n];let c=i,h;for(let d=0;d<o;d++){const u=e[d];let f=u.getKey(a);Le(f)&&(f=sn);let g;const p=f instanceof Date?f.getTime():void 0;if(p!==void 0?g=(r=c.byTime)==null?void 0:r.get(p):g=c.byKey.get(f),!g){const m=u.format&&!Le(f)?u.format(f):nn(f,t),b=new ji(f,`${m??""}`,d,u.name,h?[...h.path,f]:[f],h,l,ye(f));g=[b,{byKey:new Map}],p!==void 0?(c.byTime??(c.byTime=new Map)).set(p,g):c.byKey.set(f,g),(h?h.children:s).push(b)}h=g[0],c=g[1]}h.sourceIndices.push(n)}return Ki(s,e),s}function Ki(l,e){var s;if(!l.length)return;const t=(s=e[l[0].level])==null?void 0:s.compare;t&&l.sort((o,i)=>t(o.key,i.key));for(const o of l)Ki(o.children,e)}function Yi(l,e,t){for(const s of l)Ji(s,e,t);return Xi(l,e)}function Xi(l,e){const t=e.map(o=>o.aggregator.init());for(const o of l)e.forEach((i,r)=>t[r]=i.aggregator.merge(t[r],o.states[r]));const s={};return e.forEach((o,i)=>s[o.key]=o.aggregator.result(t[i])),s}function Ji(l,e,t){if(l.isLeaf()){qi(l,e,t);return}for(const s of l.children)Ji(s,e,t);Zi(l,e)}function qi(l,e,t){const s=l.source;let o=l.sourceIndices;if(t){o=[];for(const n of l.sourceIndices)t(n)&&o.push(n)}const i=o.length,r=e.map(n=>{const a=n.aggregator,c=n.getValue;let h=a.init();for(let d=0;d<i;d++){const u=s[o[d]];h=a.add(h,c?c(u):u)}return h});l.accept=t,l.states=r,l.count=i,l.results=Qi(r,e)}function Zi(l,e){const t=e.map(o=>o.aggregator.init());let s=0;for(const o of l.children)s+=o.count,e.forEach((i,r)=>t[r]=i.aggregator.merge(t[r],o.states[r]));l.states=t,l.count=s,l.results=Qi(t,e)}function Qi(l,e){const t={};return e.forEach((s,o)=>t[s.key]=s.aggregator.result(l[o])),t}const Hl="(empty)";function $l(l,e,t={}){return At(l,ie(e),t.emptyLabel??Hl)}function Gl(l,e,t){const s=Object.keys(e??{}).map(o=>nt(o,e[o]));return Yi(l,s,t)}const Pt=class Pt extends J{constructor(e={}){const t={width:new x(220,"px"),showCount:!0,fixed:!0,...e};super(Pt.PROPERTY,t.headerLabel??"Group",t.width,new V(["ge-table-row-group-column-header"],["ge-table-row-group-column"],[]),new V,new x(60,"px"),new x(2e3,"px"),He),this.type="RowGroupColumnDef",this.options=t,this.autoHeaderLabel=e.headerLabel===void 0}};Pt.PROPERTY="RowGroupColumn";let P=Pt;class ge extends de{constructor(e,t,s,o){super(e,!1,void 0,t,s),this.sourceIndex=o}}const Wl=new Intl.NumberFormat("en-US");class er extends Se{constructor(e,t,s,o=34){super("body",[],o,t),this.kind="AreaModelRowGroups",this.hiddenColumnProperties=[],this.fields=[],this.groups=[],this.textRenderer=new _e,this.groupRowById=new Map,this.detailRows=[],this.allDirty=!0,this.dirtyLeaves=new Set,this.totals={},this.batchDepth=0,this.regroupPending=!1,this.builds=0,this.sourceRows=e??[],this.options={...s,groupBy:[...s.groupBy??[]]};const i=s.aggregations??{};this.specs=Object.keys(i).map(r=>this.withCalculatedValue(nt(r,i[r]))),this.specByKey=new Map(this.specs.map(r=>[r.key,r])),this.fields=this.withCalculatedKeys(ie(this.options.groupBy)),this.build(!1)}getSourceRows(){return this.sourceRows}setRows(e){this.sourceRows=e??[],this.build(!0)}getGroupBy(){return[...this.options.groupBy]}setGroupBy(e){const t=ie(e??[]);this.options.groupBy=[...e??[]],this.fields=this.withCalculatedKeys(t),this.build(!0)}regroup(){this.build(!0)}getGroups(){return this.ensureAggregates(),this.groups}findGroup(e){this.ensureAggregates();let t=this.groups,s;for(const o of e){const i=ye(o);if(s=t.find(r=>ye(r.key)===i),!s)return;t=s.children}return s}getRowGroup(e){var s;const t=(s=this.getRowByIndex(e))==null?void 0:s.data;if($(t))return this.ensureAggregates(),t}getDetailRow(e){const t=this.getRowByIndex(e);return t&&!$(t.data)?t.data:void 0}isGroupRowIndex(e){var t;return $((t=this.getRowByIndex(e))==null?void 0:t.data)}getTotals(){return this.ensureAggregates(),this.totals}getCheckedRows(){const e=[];return this.detailRows.forEach(t=>{t.checked&&e.push(t.data)}),e}expandToLevel(e){this.groupRowById.forEach(t=>t.expanded=t.data.level<e),this.recalcVisibleTreeRows(!1)}getBuildCount(){return this.builds}batch(e){this.batchDepth++;try{e()}finally{this.batchDepth--}return this.batchDepth||!this.regroupPending?!1:(this.regroupPending=!1,this.build(!0),!0)}getRawValueOfRow(e,t){if($(e.data)){this.ensureAggregates();const s=e.data;return t===P.PROPERTY?this.getGroupLabel(s):this.specByKey.has(t)?s.results[t]:""}return t===P.PROPERTY?"":super.getRawValueOfRow(e,t)}canMoveRows(e,t){return!1}moveRows(e,t){return!1}getTextValueAt(e,t){const s=this.getRowByIndex(e),o=this.properties[t];if(s&&o!==void 0&&o!==P.PROPERTY&&this.getColumnValues().getShowValuesAs(o))return this.getCalculatedText(o,this.getValueAt(e,t))??"";if(s&&$(s.data)&&o!==P.PROPERTY){const r=o!==void 0?this.specByKey.get(o):void 0;if(!r)return"";const n=this.getValueAt(e,t);return r.format?r.format(n):Ne(n)}const i=this.getValueAt(e,t);return i==null?"":`${i}`}getCellRenderer(e,t){const s=this.getRowByIndex(e),o=this.properties[t];return s&&$(s.data)?o!==void 0&&this.specByKey.has(o)?this.textRenderer:void 0:o===P.PROPERTY?void 0:super.getCellRenderer(e,t)}getCustomClassesAt(e,t){const s=super.getCustomClassesAt(e,t),o=this.getRowByIndex(e);if(!o||!$(o.data))return s;const i=this.properties[t],r=o.data.level,n=[...s,"ge-table-row-group",`ge-table-row-group-level-${r}`];return i===P.PROPERTY?n.push("ge-table-row-group-label"):i!==void 0&&this.specByKey.has(i)&&n.push("ge-table-row-group-aggregate"),n}isGroupLabelCell(e,t){return this.properties[t]===P.PROPERTY&&this.isGroupRowIndex(e)}isEditable(e,t){return this.properties[t]===P.PROPERTY||this.isGroupRowIndex(e)?!1:super.isEditable(e,t)}setValue(e,t,s){const o=this.getRowByIndex(e);if(!(o instanceof ge)||this.properties[t]===P.PROPERTY)return!1;const i=this.keysOf(o.data);if(!super.setValue(e,t,s))return!1;const n=this.keysOf(o.data);return i.some((a,c)=>ye(a)!==ye(n[c]))?this.batchDepth?this.regroupPending=!0:this.build(!0):this.markRowDirty(o),!0}externalFilterChanged(e){this.userFilter=e;const t=this.sourceRows,s=new Uint8Array(t.length);for(let o=0;o<t.length;o++)s[o]=e(t[o],o,t)?1:0;this.accepted=s,this.allDirty=!0,super.externalFilterChanged(o=>o instanceof ge&&s[o.sourceIndex]===1)}doSort(e){if(!e.length)return!1;this.lastSort={items:[...e]},this.ensureAggregates();const t=e.map(({columnIndex:s,sortState:o})=>{const i=o==="asc"?1:o==="desc"?-1:0;return this.createRowComparator(this.properties[s],i)});return super.sort((s,o)=>{for(const i of t){const r=i(s,o);if(r)return r}return 0}),this.syncGroupOrder(),this.allDirty=!0,!0}sort(e){this.lastSort={compareFn:e},super.sort((t,s)=>t instanceof ge&&s instanceof ge?e(t.data,s.data):0),this.syncGroupOrder(),this.allDirty=!0}invalidateDerivedValues(e){if(super.invalidateDerivedValues(e),(e==null?void 0:e.area)==="body"&&Array.isArray(e.rowIndices)){for(const t of e.rowIndices){const s=this.getRowByIndex(t);s instanceof ge?this.markRowDirty(s):this.allDirty=!0}return}this.allDirty=!0}withCalculatedValue(e){const t=e.value,s=e.getValue;return!s||typeof t!="string"?e:{...e,getValue:o=>this.isCalculatedProperty(t)?this.getValueByT(o,t):s(o)}}withCalculatedKeys(e){return e.map(t=>{const s=t.path,o=t.getKey;return s===void 0?t:{...t,getKey:i=>this.isCalculatedProperty(s)?this.getValueByT(i,s):o(i)}})}syncGroupOrder(){const e=t=>(t??[]).filter(s=>$(s.data)).map(s=>{const o=s.data;if(o.isLeaf()){const i=(s.children??[]).map(r=>r.sourceIndex);o.sourceIndices.length=0;for(const r of i)o.sourceIndices.push(r)}else{const i=e(s.children);o.children.length=0,o.children.push(...i)}return o});this.groups=e(this.rows)}getGroupLabel(e){const t=this.options.groupColumn;return t!=null&&t.label?`${t.label(e)??""}`:(t==null?void 0:t.showCount)===!1?e.label:`${e.label} (${Wl.format(e.count)})`}ensureAggregates(){if(!this.allDirty&&!this.dirtyLeaves.size)return;const e=this.accepted?(s=>o=>s[o]===1)(this.accepted):void 0;if(!this.fields.length){if(this.allDirty||this.dirtyLeaves.size){const s=e?this.sourceRows.filter((i,r)=>e(r)):this.sourceRows,o=_t(s,this.specs);this.totals={},this.specs.forEach((i,r)=>this.totals[i.key]=i.aggregator.result(o[r])),this.allDirty=!1,this.dirtyLeaves.clear()}return}if(this.allDirty){this.totals=Yi(this.groups,this.specs,e),this.allDirty=!1,this.dirtyLeaves.clear();return}if(!this.dirtyLeaves.size)return;const t=new Set;this.dirtyLeaves.forEach(s=>{qi(s,this.specs,e);for(let o=s.parent;o;o=o.parent)t.add(o)}),this.dirtyLeaves.clear(),Array.from(t).sort((s,o)=>o.level-s.level).forEach(s=>Zi(s,this.specs)),this.totals=Xi(this.groups,this.specs)}markRowDirty(e){var s;const t=(s=e.parent)==null?void 0:s.data;$(t)?this.dirtyLeaves.add(t):this.allDirty=!0}keysOf(e){return this.fields.map(t=>t.getKey(e))}createRowComparator(e,t){if(!t||e===void 0)return()=>0;const s=this.genericTreeTableSortComparator(e,t),o=this.specByKey.has(e),i=e===P.PROPERTY;return(r,n)=>{const a=$(r.data),c=$(n.data);if(a&&c){const h=r.data,d=n.data;if(o)return this.sorterService.genericSortComparator(h.results[e],d.results[e],t);const u=this.fields[h.level];if(i||(u==null?void 0:u.path)===e){const f=u==null?void 0:u.compare;return f?t*f(h.key,d.key):0}return 0}return!a&&!c&&!i?s(r,n):0}}build(e){const t=new Map,s=new Set;e&&(this.groupRowById.forEach((n,a)=>t.set(a,n.expanded)),this.detailRows.forEach(n=>n.checked&&s.add(n.data))),this.builds++;const o=this.options.emptyLabel??"(empty)";this.groups=At(this.sourceRows,this.fields,o),this.groupRowById=new Map,this.detailRows=new Array(this.sourceRows.length);const i=[];if(this.fields.length)for(const n of this.groups)i.push(this.createGroupRow(n,void 0,t));else for(let n=0;n<this.sourceRows.length;n++)i.push(this.detailRows[n]=new ge(this.sourceRows[n],void 0,0,n));this.rows.length=0;for(const n of i)this.rows.push(n);s.size&&(this.detailRows.forEach(n=>n.checked=s.has(n.data)),this.rows.forEach(n=>tr(n))),this.allDirty=!0,this.dirtyLeaves.clear(),this.userFilter?this.externalFilterChanged(this.userFilter):this.recalcVisibleTreeRows(!1);const r=this.lastSort;r&&"items"in r?this.doSort(r.items):r&&this.sort(r.compareFn)}createGroupRow(e,t,s){const o=e.id,i=s.get(o)??this.isExpandedByDefault(e),r=new de(e,i,[],t,e.level);if(this.groupRowById.set(o,r),e.isLeaf()){const n=e.level+1;for(const a of e.sourceIndices){const c=new ge(this.sourceRows[a],r,n,a);this.detailRows[a]=c,r.children.push(c)}}else for(const n of e.children)r.children.push(this.createGroupRow(n,r,s));return r}isExpandedByDefault(e){const t=this.options.expanded??!0;return typeof t=="function"?!!t(e):typeof t=="number"?e.level<t:t}}function tr(l){var t;if(!((t=l.children)!=null&&t.length))return l.checked;let e=!0;for(const s of l.children)tr(s)||(e=!1);return l.checked=e,e}class Qs{static createTableModel(e){var d,u;const t=e.rows??[];let s=e.columnDefs?[...e.columnDefs]:t.length?Object.keys(t[0]).map(f=>new J(f,f.toUpperCase(),St)):[];const o=e.defaultRowHeights??((d=e.tableOptions)==null?void 0:d.defaultRowHeights)??new ae;let i=e.fixedLeftColumnCount??0;e.rowNumbersVisible&&!L(s[0])&&(s=[new Xt(e.rowNumbersVisible===!0?{}:e.rowNumbersVisible),...s],i++);let r=L(s[0])?1:0;const n=Ce(s[r]);n&&r++;const a=new P(e.groupColumn??{});a.autoHeaderLabel&&(a.headerLabel=ai(e.groupBy??[],s)),s.splice(r,0,a),a.options.fixed&&(i=Math.max(i,r)+1);const c=new er(t,s,{groupBy:e.groupBy??[],aggregations:e.aggregations,expanded:e.expanded,emptyLabel:e.emptyLabel,groupColumn:a.options,hideGroupedColumns:e.hideGroupedColumns},o.body);(n||(u=e.tableOptions)!=null&&u.showCheckboxWihoutExtraColumn)&&(c.rowSelectionModel=new Oe(c.rows));const h=Y.createTableModel({columnDefs:s,bodyAreaModel:c,footerAggregates:Qs.footerConfig(e),fixedLeftColumnCount:i,fixedRightColumnCount:e.fixedRightColumnCount??0,rowCheckboxVisible:e.rowCheckboxVisible??n,defaultRowHeights:o,getSelectionModel:e.getSelectionModel,tableOptions:e.tableOptions});return gs(h),h}static updateLayout(e){return gs(e)}static footerConfig(e){const t=e.footerAggregates;if(t!==!1)return t===void 0||t===!0?e.aggregations&&Object.keys(e.aggregations).length?e.aggregations:void 0:t}}class sr extends J{constructor(e,t,s,o=new x(100,"px")){super(e,t,o,new V(["ge-table-pivot-header",`ge-table-pivot-header-${s.kind}`],[],[]),new V,new x(40,"px"),new x(2e3,"px"),He),this.pivot=s,this.type="PivotColumnDef"}}const Ul=1e3,eo="Total";function zl(l){const e=l??[];if(!e.length)throw new Error('Pivot: at least one value is needed (values: ["amount"]).');const t=new Set;return e.map((s,o)=>{const i=typeof s=="string"||typeof s=="function"?{value:s}:s;if(!i||typeof i.value!="string"&&typeof i.value!="function")throw new Error(`Pivot: value ${o} has no value (a property path or a function).`);const r=Bt(i.aggregator??"sum"),n=typeof i.value=="string"?i.value:`value${o}`;let a=i.name??`${r.name}(${n})`;if(t.has(a)){let c=2;for(;t.has(`${a}#${c}`);)c++;a=`${a}#${c}`}return t.add(a),{name:a,label:i.label??a,aggregator:r,format:i.format,showValuesAs:Be(i.showValuesAs),getValue:r===oe.count?void 0:rt(i.value)}})}const jl="(empty)";class Mt{constructor(e,t,s){this.source=e,this.allColumnLeaves=[],this.shownColumns=new Set,this.columnParentsPostOrder=[],this.rowParentsPostOrder=[],this.rowLeaves=[],this.cells=new Map,this.resolved=zl(t.values),this.values=this.resolved;const o=t.emptyLabel??jl;this.rowGroups=At(e,ie(t.rowFields??[]),o),this.columnGroups=At(e,ie(t.columnFields??[]),o);const i=Math.max(0,t.maxColumns??Ul),r=this.allColumnLeaves;ut(this.columnGroups,r),this.truncated=r.length>i,this.truncated&&console.warn(`Pivot: ${r.length} column keys, only the first ${i} are shown (maxColumns). Totals and subtotals count all rows.`),this.columnLeaves=this.truncated?r.slice(0,i):r,this.columnLeafOf=new Int32Array(e.length).fill(-1),r.forEach((n,a)=>{for(const c of n.sourceIndices)this.columnLeafOf[c]=a});for(const n of this.columnLeaves)for(let a=n;a&&!this.shownColumns.has(a);a=a.parent)this.shownColumns.add(a);Ss(this.columnGroups,this.columnParentsPostOrder,()=>!0),Ss(this.rowGroups,this.rowParentsPostOrder,()=>!0),ut(this.rowGroups,this.rowLeaves),this.compute(s)}compute(e){this.accept=e;const t=new Map;if(this.rowGroups.length){for(const a of this.rowLeaves)a.accept=e,t.set(a,this.leafCells(a.sourceIndices));for(const a of this.rowParentsPostOrder){const c=new Map;for(const h of a.children)this.mergeMap(c,t.get(h));t.set(a,c)}const n=new Map;for(const a of this.rowGroups)this.mergeMap(n,t.get(a));t.set(null,n)}else{const n=[];for(let a=0;a<this.source.length;a++)n.push(a);t.set(null,this.leafCells(n))}this.cells=t;const s=(n,a)=>{n.count=(a==null?void 0:a.count)??0;const c={};this.values.forEach((h,d)=>c[h.name]=a&&a.count?h.aggregator.result(a.states[d]):void 0),n.results=c},o=n=>n.forEach(a=>{var c;s(a,(c=t.get(a))==null?void 0:c.get(null)),o(a.children)});o(this.rowGroups);const i=t.get(null),r=n=>n.forEach(a=>{a.isLeaf()&&(a.accept=e),s(a,i.get(a)),r(a.children)});r(this.columnGroups)}getValue(e,t,s=0){const o=this.valueIndex(s),i=this.cell(e,t);if(!(!i||!i.count||o<0))return this.values[o].aggregator.result(i.states[o])}getCount(e,t){var s;return((s=this.cell(e,t))==null?void 0:s.count)??0}getSourceRows(e,t){let s;if(e)s=e.collectIndices(!1,[]).sort((n,a)=>n-a);else{s=[];for(let n=0;n<this.source.length;n++)s.push(n)}const o=this.accept;let i;if(t){i=new Set;const n=[];ut([t],n);for(const a of n){const c=this.allColumnLeaves.indexOf(a);c>=0&&i.add(c)}}const r=[];for(const n of s)o&&!o(n)||i&&!i.has(this.columnLeafOf[n])||r.push(this.source[n]);return r}isColumnShown(e){return this.shownColumns.has(e)}valueIndex(e){return typeof e=="number"?e>=0&&e<this.values.length?e:-1:this.values.findIndex(t=>t.name===e)}cell(e,t){var s;return(s=this.cells.get(e??null))==null?void 0:s.get(t??null)}newCell(){return{count:0,states:this.values.map(e=>e.aggregator.init())}}leafCells(e){const t=this.resolved,s=t.length,o=this.accept,i=this.source,r=this.columnLeafOf,n=new Array(this.allColumnLeaves.length),a=this.newCell(),c=new Array(s);for(let d=0;d<e.length;d++){const u=e[d];if(o&&!o(u))continue;const f=i[u],g=r[u],p=g>=0?n[g]??(n[g]=this.newCell()):void 0;a.count++;for(let m=0;m<s;m++){const b=t[m].getValue;c[m]=b?b(f):f,a.states[m]=t[m].aggregator.add(a.states[m],c[m])}if(p){p.count++;for(let m=0;m<s;m++)p.states[m]=t[m].aggregator.add(p.states[m],c[m])}}const h=new Map;for(let d=0;d<n.length;d++){const u=n[d];u&&h.set(this.allColumnLeaves[d],u)}for(const d of this.columnParentsPostOrder){let u;for(const f of d.children){const g=h.get(f);g&&(u??(u=this.newCell()),this.mergeInto(u,g))}u&&h.set(d,u)}return h.set(null,a),h}mergeInto(e,t){e.count+=t.count,this.values.forEach((s,o)=>e.states[o]=s.aggregator.merge(e.states[o],t.states[o]))}mergeMap(e,t){t.forEach((s,o)=>{let i=e.get(o);i||(i=this.newCell(),e.set(o,i)),this.mergeInto(i,s)})}}function Kl(l,e,t){return new Mt(l??[],e,t)}function ut(l,e){for(const t of l)t.isLeaf()?e.push(t):ut(t.children,e)}function Ss(l,e,t){for(const s of l)s.isLeaf()||!t(s)||(Ss(s.children,e,t),e.push(s))}function or(l,e){return"pivot:"+JSON.stringify([...l.idParts,e.name])}function ir(l,e){return"pivot:subtotal:"+JSON.stringify([...l.idParts,e.name])}function vs(l){return"pivot:total:"+JSON.stringify([l.name])}function Yl(l){const e=l.slice(l.lastIndexOf(".")+1);return e.charAt(0).toUpperCase()+e.slice(1)}function rr(l){return li(ie(l),Yl).join(" › ")}function Xl(l){var e;return l.columnSubtotals??(((e=l.columnFields)==null?void 0:e.length)??0)>1}function nr(l,e,t,s={}){var m;const o=l.values,i=o.length>1,r=e.totalLabel??eo,n=Xl(e),a=(((m=e.columnFields)==null?void 0:m.length)??0)>0,c=s.valueWidth??new x(100,"px"),h=[...t],d=t.map(b=>({data:b.headerLabel,property:b.property})),u=(b,y,w)=>{var S;return h.push(new sr(b,y,w,((S=s.widths)==null?void 0:S.get(b))??c)),{data:y,property:b}},f=(b,y,w,S,C)=>i?{data:b,visibility:C,children:o.map((A,I)=>u(S(A),A.label,{kind:y,column:w,value:A,valueIndex:I}))}:{...u(S(o[0]),b,{kind:y,column:w,value:o[0],valueIndex:0}),visibility:C},g=b=>{var w;if(!l.isColumnShown(b))return;if(b.isLeaf())return f(b.label,"value",b,S=>or(b,S));const y=b.children.map(g).filter(S=>!!S);return n&&y.push(f(`${b.label} ${r}`,"subtotal",b,S=>ir(b,S),"always")),{id:b.id,data:b.label,toggle:n,closed:n&&!!((w=s.closedIds)!=null&&w.has(b.id)),children:y}};let p=0;if(a){for(const b of l.columnGroups){const y=g(b);y&&d.push(y)}e.totalColumn!==!1&&(d.push(f(r,"total",void 0,b=>vs(b))),(e.totalColumn===void 0||e.totalColumn==="fixed")&&(p=o.length))}else o.forEach((b,y)=>d.push(u(vs(b),b.label,{kind:"total",value:b,valueIndex:y})));return{columnDefs:h,cellGroups:d,fixedRightColumnCount:p}}class lr extends Ke{constructor(e,t,s,o,i,r,n,a,c,h){super(e,t,s,n,r,!1,a,i,[],-1,0,400,c),this.leadingColumnDefs=o,this.valueWidth=h,this.kind="PivotTableModel",this.pivotFixedRightColumnCount=r}getFixedRightColumnCount(){return this.pivotFixedRightColumnCount}getPivotBody(){return this.bodyAreaModel}getPivotConfig(){return this.getPivotBody().getConfig()}setPivotConfig(e,t){const s=this.getPivotBody(),o={...s.getConfig(),...e};s.configure(o,t),this.relayout()}relayout(){const e=this.getPivotBody(),t=this.headerAreaModel,s=e.getConfig(),o=this.leadingColumnDefs.find(Ee);o!=null&&o.autoHeaderLabel&&(o.headerLabel=rr(s.rowFields??[]));const i=new Set(t.getToggleGroupStates().filter(d=>d.closed).map(d=>d.id)),r=this.columnDefs.filter(Ot),n=new Map(r.map(d=>[d.property,d.width])),a=new Set(r.filter(d=>!ds(d)).map(d=>d.property)),c=nr(e.getResult(),s,this.leadingColumnDefs,{valueWidth:this.valueWidth,closedIds:i,widths:n}),h=t.setGroups(c.cellGroups,c.columnDefs);h.filter(d=>a.has(d.property)).forEach(d=>Yo(d,!1)),this.columnDefs=h,this.columnCount=h.length,this.columnSizes=[],this.pivotFixedRightColumnCount=c.fixedRightColumnCount,e.setColumnDefs(h)}}const Jl=new Intl.NumberFormat("en-US");class ar extends Se{constructor(e,t,s={},o=34){super("body",[],o,[]),this.kind="AreaModelPivot",this.rowFields=[],this.textRenderer=new _e,this.infoByProperty=new Map,this.dirty=!1,this.builds=0,this.sourceRows=e??[],this.config={...t},this.groupColumnOptions=s,this.build(!1)}getConfig(){return{...this.config}}getResult(){return this.ensureComputed(),this.result}getSourceRows(){return this.sourceRows}getBuildCount(){return this.builds}configure(e,t){const s=new Mt(t??this.sourceRows,e);this.config={...e},t&&(this.sourceRows=t),this.build(!0,s)}setColumnDefs(e){this.columnDefs=e,this.properties.length=0;for(const t of e)this.properties.push(t.property);this.infoByProperty=new Map;for(const t of e)Ot(t)&&this.infoByProperty.set(t.property,t.pivot)}getPropertyAt(e){return this.properties[e]}getRowGroup(e){var s;const t=(s=this.getRowByIndex(e))==null?void 0:s.data;return t&&t.type==="RowGroup"?t:void 0}getColumnInfo(e){const t=this.properties[e];return t===void 0?void 0:this.infoByProperty.get(t)}getColumnProperty(e,t=0){const s=this.result,o=s.values[s.valueIndex(t)];if(!o)return;if(!e.length){const a=vs(o);return this.infoByProperty.has(a)?a:void 0}let i=s.columnGroups,r;for(const a of e){const c=ye(a);if(r=i.find(h=>ye(h.key)===c),!r)return;i=r.children}const n=r.isLeaf()?or(r,o):ir(r,o);return this.infoByProperty.has(n)?n:void 0}getColumnIndex(e,t=0){const s=this.getColumnProperty(e,t);return s===void 0?-1:this.properties.indexOf(s)}getCellSourceRows(e,t){const s=this.getResult(),o=this.getRowGroup(e);if(!o&&this.rowFields.length)return[];const i=this.getColumnInfo(t);return s.getSourceRows(o,(i==null?void 0:i.kind)==="total"||i==null?void 0:i.column)}getValueAt(e,t){if(!this.getRowByIndex(e))return"";const o=this.properties[t],i=this.getRowGroup(e);if(o===P.PROPERTY)return i?this.getGroupLabel(i):this.config.totalLabel??eo;const r=o===void 0?void 0:this.infoByProperty.get(o);if(!r)return"";if(!(i&&i.children.length>0&&this.config.subtotals===!1))return this.getShownValue(i,r)}getShownValue(e,t){const s=this.getResult(),o=s.getValue(e,t.column,t.valueIndex),i=t.value.showValuesAs;if(!i||typeof o!="number")return o;let r;switch(i.mode){case"percentOfRowTotal":r=s.getValue(e,void 0,t.valueIndex);break;case"percentOfColumnTotal":r=s.getValue(void 0,t.column,t.valueIndex);break;case"percentOfGrandTotal":r=s.getValue(void 0,void 0,t.valueIndex);break;case"percentOfParentTotal":{const n=e==null?void 0:e.parent;r=s.getValue(e?n??void 0:void 0,t.column,t.valueIndex);break}default:return o}return typeof r=="number"&&r!==0?o/r:void 0}canMoveRows(e,t){return!1}moveRows(e,t){return!1}getTextValueAt(e,t){const s=this.properties[t],o=s===void 0?void 0:this.infoByProperty.get(s),i=this.getValueAt(e,t);return o?i===void 0?this.isSubtotalSuppressed(e)?"":this.config.emptyText??"":o.value.showValuesAs?Ht(i,o.value.showValuesAs):o.value.format?o.value.format(i):Ne(i):i==null?"":`${i}`}getCellRenderer(e,t){const s=this.properties[t];if(s!==void 0&&this.infoByProperty.has(s))return this.textRenderer}getCustomClassesAt(e,t){const s=super.getCustomClassesAt(e,t),o=this.properties[t],i=this.getRowGroup(e),r=[...s,`ge-table-pivot-level-${(i==null?void 0:i.level)??0}`],n=!!i&&i.children.length>0;if(o===P.PROPERTY)return r.push("ge-table-pivot-label"),n&&r.push("ge-table-pivot-subtotal"),r;const a=o===void 0?void 0:this.infoByProperty.get(o);return a&&(r.push("ge-table-pivot-value"),(n||a.kind==="subtotal")&&r.push("ge-table-pivot-subtotal"),a.kind==="total"&&r.push("ge-table-pivot-total"),this.getValueAt(e,t)===void 0&&r.push("ge-table-pivot-empty")),r}isRowHeaderCell(e,t){return this.properties[t]===P.PROPERTY&&!!this.getRowByIndex(e)}isEditable(e,t){return!1}setValue(e,t,s){return!1}externalFilterChanged(e){this.userFilter=e,this.accepted=this.acceptedBy(this.userFilter),this.dirty=!0,this.ensureComputed();const t=this.result;super.externalFilterChanged(s=>{var o;return!((o=s.children)!=null&&o.length)&&(!this.rowFields.length||t.getCount(s.data)>0)})}doSort(e){if(!e.length)return!1;this.ensureComputed();const t=e.map(({columnIndex:s,sortState:o})=>{const i=o==="asc"?1:o==="desc"?-1:0;return this.createRowComparator(this.properties[s],i)});return super.sort((s,o)=>{for(const i of t){const r=i(s,o);if(r)return r}return 0}),!0}sort(e){super.sort((t,s)=>e(t.data,s.data))}invalidateDerivedValues(){super.invalidateDerivedValues(),this.dirty=!0}isSubtotalSuppressed(e){const t=this.getRowGroup(e);return this.config.subtotals===!1&&!!t&&t.children.length>0}getGroupLabel(e){const t=this.groupColumnOptions;return t.label?`${t.label(e)??""}`:t.showCount?`${e.label} (${Jl.format(e.count)})`:e.label}ensureComputed(){var t;if(!this.dirty)return;this.dirty=!1,this.userFilter&&((t=this.accepted)==null?void 0:t.length)!==this.sourceRows.length&&(this.accepted=this.acceptedBy(this.userFilter));const e=this.accepted;this.result.compute(e?(s=>e[s]===1):void 0)}acceptedBy(e){const t=this.sourceRows,s=new Uint8Array(t.length);for(let o=0;o<t.length;o++)s[o]=e(t[o],o,t)?1:0;return s}createRowComparator(e,t){if(!t||e===void 0)return()=>0;if(e===P.PROPERTY)return(i,r)=>{var h;const n=i.data,a=r.data,c=(h=this.rowFields[n.level])==null?void 0:h.compare;return c?t*c(n.key,a.key):0};const s=this.infoByProperty.get(e);if(!s)return()=>0;const o=this.columnDefs.find(i=>i.property===e);return(i,r)=>{const n=this.getShownValue(i.data,s),a=this.getShownValue(r.data,s);return n===void 0||a===void 0?n===a?0:n===void 0?1:-1:o!=null&&o.sortComparator?t*o.sortComparator(n,a,i.data,r.data,t):this.sorterService.genericSortComparator(n,a,t)}}build(e,t){const s=new Map;if(e){const i=r=>r.forEach(n=>{var a;((a=n.data)==null?void 0:a.type)==="RowGroup"&&s.set(n.data.id,n.expanded),n.children&&i(n.children)});i(this.rows)}this.builds++,this.rowFields=ie(this.config.rowFields??[]),this.result=t??new Mt(this.sourceRows,this.config),this.dirty=!1;const o=[];if(this.rowFields.length)for(const i of this.result.rowGroups)o.push(this.createRow(i,void 0,s));else o.push(new de({type:"PivotTotal"},!0,void 0,void 0,0));this.rows.length=0;for(const i of o)this.rows.push(i);this.userFilter?this.externalFilterChanged(this.userFilter):this.recalcVisibleTreeRows(!1)}createRow(e,t,s){const o=s.get(e.id)??this.isExpandedByDefault(e),i=e.isLeaf()?void 0:[],r=new de(e,o,i,t,e.level);for(const n of e.children)i.push(this.createRow(n,r,s));return r}isExpandedByDefault(e){const t=this.config.expanded??!0;return typeof t=="function"?!!t(e):typeof t=="number"?e.level<t:t}}class cr extends Xs{constructor(e,t=34){super(),this.body=e,this.defaultRowHeight=t,this.type="AreaModelPivotFooter",this.textRenderer=new _e,this.areaIdent="footer"}getRowCount(){var t;const e=this.body.getConfig();return e.totalRow===!1||!((t=e.rowFields)!=null&&t.length)?0:1}getRowHeight(e){return this.defaultRowHeight}getConstantRowHeight(){return this.defaultRowHeight}getValueAt(e,t){if(e!==0)return"";if(this.isRowHeaderCell(e,t))return this.body.getConfig().totalLabel??eo;const s=this.body.getColumnInfo(t);return s?this.body.getShownValue(void 0,s):""}getTextValueAt(e,t){const s=this.body.getColumnInfo(t),o=this.getValueAt(e,t);return s?o===void 0?this.body.getConfig().emptyText??"":s.value.showValuesAs?Ht(o,s.value.showValuesAs):s.value.format?s.value.format(o):Ne(o):o==null?"":`${o}`}getCellRenderer(e,t){return this.body.getColumnInfo(t)||this.isLabelColumn(t)?this.textRenderer:void 0}getCustomClassesAt(e,t){if(this.isLabelColumn(t))return["ge-table-pivot-total","ge-table-pivot-label"];if(!this.body.getColumnInfo(t))return[];const o=["ge-table-pivot-value","ge-table-pivot-total"];return this.getValueAt(e,t)===void 0&&o.push("ge-table-pivot-empty"),o}isRowHeaderCell(e,t){return e===0&&this.isLabelColumn(t)}isLabelColumn(e){return this.body.getPropertyAt(e)===P.PROPERTY}}class ql extends Hi{getCustomClassesAt(e,t){const s=this.getValueAt(e,t);return s?s.ownColumn()?["ge-table-pivot-header-column"]:["ge-table-pivot-header-group"]:[]}}class to{static createTableModel(e){var f,g,p;const t=e.defaultRowHeights??((f=e.tableOptions)==null?void 0:f.defaultRowHeights)??new ae,s=to.toConfig(e),o=[];e.rowNumbersVisible&&o.push(new Xt(e.rowNumbersVisible===!0?{}:e.rowNumbersVisible));const i={showCount:!1,...e.groupColumn??{}},r=new P(i);r.autoHeaderLabel&&(r.headerLabel=rr(s.rowFields??[])),o.push(r);const n=r.options.fixed?o.length:o.length-1,a=new ar(e.rows??[],s,r.options,t.body),c=nr(a.getResult(),s,o,{valueWidth:e.valueColumnWidth}),h=new ql("header",c.cellGroups,c.columnDefs,t.header,(g=e.tableOptions)==null?void 0:g.headerGroupOptions);c.columnDefs=h.setGroups(c.cellGroups,c.columnDefs),a.setColumnDefs(c.columnDefs);const d=new cr(a,t.footer),u=e.getSelectionModel??((p=e.tableOptions)==null?void 0:p.getSelectionModel)??(()=>{});return new lr(h,a,d,o,c.columnDefs,c.fixedRightColumnCount,n,t,u,e.valueColumnWidth)}static toConfig(e){return{rowFields:e.rowFields??[],columnFields:e.columnFields??[],values:e.values,subtotals:e.subtotals,columnSubtotals:e.columnSubtotals,totalColumn:e.totalColumn,totalRow:e.totalRow,maxColumns:e.maxColumns,expanded:e.expanded,emptyLabel:e.emptyLabel,emptyText:e.emptyText,totalLabel:e.totalLabel}}}exports.ALL_TABLE_STATE_PARTS=ne;exports.AbstractAreaModel=Gt;exports.ActionEvent=qs;exports.ActionsCellRenderer=Gi;exports.AggregateCellRenderer=_e;exports.Aggregators=oe;exports.AnyPropertyType=Ts;exports.AreaMapFactory=ul;exports.AreaModel=Xs;exports.AreaModelAggregateFooter=ot;exports.AreaModelArrayOfArrays=j;exports.AreaModelCellGroups=Hi;exports.AreaModelHidden=W;exports.AreaModelObjectArray=K;exports.AreaModelObjectArrayWithColumndefs=ws;exports.AreaModelPivot=ar;exports.AreaModelPivotFooter=cr;exports.AreaModelRowGroups=er;exports.AreaModelTree=Se;exports.AreaObjectMap=V;exports.AriaGridInfo=tt;exports.AriaIds=Ze;exports.AriaTexts=ve;exports.ArrayPropertyType=ce;exports.AutoRestoreOptions=Vi;exports.AvoidDoubleExecution=ur;exports.BatchEditOptions=Kt;exports.BatchEditService=mi;exports.BooleanPropertyType=To;exports.CellGroup=Bi;exports.CellGroupExt=_i;exports.CellGroupExtCellRenderer=Rt;exports.CellRange=R;exports.CellgroupFactory=G;exports.CheckboxBooleanPropertyCellRenderer=Cl;exports.CheckboxCellRenderer=Cs;exports.CheckboxColumnDef=dl;exports.CheckboxModel=Di;exports.ChunkData=ol;exports.ColAndRowspanModel=zo;exports.CollapsedExpandedData=$i;exports.ColorRgb=Ll;exports.ColumnDef=J;exports.ColumnDefGenerator=fr;exports.ColumnWidths=Wi;exports.ConvenienceDomService=ft;exports.CopyService=Te;exports.CoverGridBodyModel=Fi;exports.CoverGridFactory=tl;exports.CoverGridTableModel=Pi;exports.CrudAction=le;exports.CrudObjectEdit=Ie;exports.CrudObjectView=Ui;exports.CrudOptions=zi;exports.CrudTableModelFactory=Bl;exports.CssVars=bs;exports.DateToIntlDDMMYYYYCellRenderer=Sl;exports.DateToIsoCellRenderer=xl;exports.DateToLocaleDateCellRenderer=vl;exports.DateToTecCellRenderer=El;exports.DefaultRowHeights=ae;exports.EleScope=Qe;exports.EventAdapter=Ct;exports.EventCheckboxChangedHandler=yn;exports.ExcelService=hi;exports.FORMULA_FUNCTION_NAMES=Jr;exports.FalseFn=js;exports.FillHandleOptions=st;exports.FillHandleService=Ei;exports.FocusModel=Uo;exports.FormulaError=T;exports.GeBatchEditEvent=pi;exports.GeCellIndices=fs;exports.GeCssColorUtil=Ye;exports.GeFilterService=wl;exports.GeKeyEvent=fl;exports.GeModelChangeEvent=Pe;exports.GeMouseEvent=Nt;exports.GeRowDragEvent=di;exports.GeScrollEvent=ei;exports.GeStateChangeEvent=qo;exports.GeoData=q;exports.HeaderGroupOptions=zt;exports.Icon=Z;exports.IndexAndPx=il;exports.InputCellRenderer=ni;exports.InputHandler=Qo;exports.JsonService=os;exports.LicenseManager=be;exports.LiveAnnouncer=xt;exports.MaleFemaleToIconCellRenderer=Rl;exports.MouseHandler=Vo;exports.MouseTargetData=gt;exports.MultiRowsSelectionModel=Vl;exports.NullPropertyType=Ao;exports.NumberCellProgressBarCellRenderer=Al;exports.NumberCellRenderer=Tl;exports.NumberPropertyType=Eo;exports.ObjectPropertyType=X;exports.OsxShortcutActionIdMapping=si;exports.OverlayOptions=Ut;exports.PROPERTY_TYPE_KEY_ANY=Rs;exports.PROPERTY_TYPE_KEY_ARRAY=Es;exports.PROPERTY_TYPE_KEY_BOOLEAN=Lt;exports.PROPERTY_TYPE_KEY_NULL=As;exports.PROPERTY_TYPE_KEY_NUMBER=Vt;exports.PROPERTY_TYPE_KEY_OBJECT=ke;exports.PROPERTY_TYPE_KEY_STRING=Ms;exports.PROPERTY_TYPE_KEY_UNDEFINED=De;exports.Padding=vt;exports.PendingCellChanges=gi;exports.PivotColumnDef=sr;exports.PivotFactory=to;exports.PivotResult=Mt;exports.PivotTableModel=lr;exports.PositiveAndNegativeNumberRenderer=Fl;exports.ProgressBarCellRenderer=kl;exports.PropertyItem=Is;exports.PropertyTypeService=gr;exports.RenderScope=Ko;exports.Renderer=yl;exports.RequestChunk=Oi;exports.ResizeHandler=ci;exports.RowDragOptions=jt;exports.RowDragService=ui;exports.RowGroup=ji;exports.RowGroupColumnDef=P;exports.RowGroupFactory=Qs;exports.RowNumberCellRenderer=ki;exports.RowNumberColumnDef=Xt;exports.RowNumberOptions=ys;exports.SHOW_VALUES_AS_MODES=No;exports.SchemeGenerator=pr;exports.SelectCellRenderer=Zs;exports.SelectionAggregator=pt;exports.SelectionModel=he;exports.SelectionService=we;exports.ShortcutService=ii;exports.SimpleArrayCellRenderer=Dl;exports.SimpleDomService=ri;exports.Size=x;exports.SortItem=bt;exports.SortedOptions=Ps;exports.StarRatingCellRenderer=Il;exports.StoreStateCollapsedExpandService=ml;exports.StoreStateScrollPosService=pl;exports.StoreStateSortingService=bl;exports.StringPropertyType=Mo;exports.TableApi=Go;exports.TableCellUpdateEvent=gl;exports.TableFactory=Y;exports.TableModel=Ke;exports.TableModelAndOptions=Li;exports.TableOptions=Ve;exports.TableOverlay=Wo;exports.TableScope=ms;exports.TableStateService=yt;exports.ThreeColorGradientArg=Ol;exports.TreeAriaInfo=jo;exports.TreeCheckboxModel=Oe;exports.TreeFactory=Me;exports.TreeOptions=Fs;exports.TreeRow=de;exports.TreeRowService=Ii;exports.TrueFalseCellRenderer=Ml;exports.TrueFn=He;exports.TwoColorGradientArg=xs;exports.UNIMPORTANT_TYPES=Je;exports.UndefinedPropertyType=dt;exports.UrlInfo=_l;exports.ValueInfo=Io;exports.ValueLabel=Ni;exports.WindowsShortcutActionIdMapping=ti;exports.actionIds=sl;exports.aggregate=Rr;exports.aggregateColumns=Ar;exports.aggregateRowGroups=Gl;exports.allCenter=cl;exports.allLeft=al;exports.allRight=hl;exports.bodyCenter=nl;exports.bodyLeft=rl;exports.bodyRight=ll;exports.calcMoveToIndex=ls;exports.calcOverlayKind=hs;exports.calculateShowValuesAs=Ns;exports.canMoveFlatRows=Wt;exports.canMoveTreeRows=$s;exports.compileFormula=Us;exports.computeFillChanges=Mi;exports.computeFillValues=yi;exports.createFormulaValueGetter=zs;exports.createHarmonizedShortcutByKeyboardEvent=oi;exports.createValueGetter=rt;exports.debounce=Ro;exports.editInputPipeForNumber=Pl;exports.entitySuffix=is;exports.escapeHtml=D;exports.findRowIndexAtY=Ws;exports.firstLetterUppercase=Fo;exports.formatAggregateValue=Ne;exports.formatShowValuesAs=Ht;exports.getAggregator=Bt;exports.getAreaIdentByString=it;exports.getEntityName=Do;exports.getFillRange=Ys;exports.getInsertBeforeIndex=_s;exports.getLeadingRowNumberColumnCount=et;exports.getTopmostTreeRows=Hs;exports.groupRows=$l;exports.harmonizeShortcut=Ks;exports.isAreaModelAggregateFooter=Po;exports.isAreaModelPivot=ns;exports.isAreaModelRowGroups=z;exports.isAreaModelTree=_;exports.isCheckboxCellRenderer=Ds;exports.isCheckboxColumnDef=Ce;exports.isExcelFormattedValue=ps;exports.isFillSeries=Ci;exports.isFormulaError=v;exports.isGroupRow=rs;exports.isPercentShowValuesAs=Os;exports.isPivotColumnDef=Ot;exports.isPivotTableModel=ks;exports.isRowGroup=$;exports.isRowGroupColumnDef=Ee;exports.isRowNumberColumnDef=L;exports.isSameCellValue=fi;exports.isTreeRow=F;exports.moveArrayItems=Bo;exports.moveFlatRows=Gs;exports.moveTreeRows=_o;exports.normalizeRowIndices=xe;exports.pivotRows=Kl;exports.px0=Jn;exports.px10=Xn;exports.px100=Hn;exports.px110=_n;exports.px120=Bn;exports.px130=Nn;exports.px140=On;exports.px150=Ln;exports.px160=Vn;exports.px170=Pn;exports.px180=Fn;exports.px190=kn;exports.px20=Yn;exports.px200=St;exports.px210=Dn;exports.px220=In;exports.px230=Tn;exports.px240=En;exports.px250=Mn;exports.px260=An;exports.px270=Rn;exports.px280=vn;exports.px290=Sn;exports.px30=Kn;exports.px300=Ti;exports.px40=jn;exports.px400=xn;exports.px50=zn;exports.px500=Cn;exports.px60=Un;exports.px70=Wn;exports.px80=Gn;exports.px90=$n;exports.readLegacyState=Zo;exports.removeLegacyState=us;exports.resolveShowValuesAs=Be;exports.sumOfNumbers=$t;exports.throttle=hr;exports.trimArraySuffixes=ko;
|
|
495
|
+
`)}return s.join("")}readInput(e,t){return e.type==="checkbox"?e.checked:e.type==="number"?e.value===""?null:Number(e.value):t==null&&e.value===""?t:e.value}getNestedValue(e,t){let s=e;for(const o of t){if(s===null||typeof s!="object")return;s=s[o]}return s}setNestedValue(e,t,s){if(t.some(i=>Mo.has(i)))return;let o=e;for(let i=0;i<t.length-1;i++){const r=t[i];(o[r]===null||typeof o[r]!="object")&&(o[r]={}),o=o[r]}o[t[t.length-1]]=s}static deepCopy(e){try{return structuredClone(e)}catch{return JSON.parse(JSON.stringify(e))}}}class or{constructor(){this.urls={list:{url:"",method:"GET"}},this.singleRowActions=[new de("VIEW","View","","","link"),new de("EDIT","Edit","","","link"),new de("CLONE","Clone","","","link"),new de("DELETE","Delete","","","link")],this.tableActions=[new de("CREATE","Create","","","button"),new de("DELETE_SELECTED","Delete Selected","","","button")],this.autoAddActionColumn=!0,this.columnWidths=new tr,this.calcFixedRightColumnCount=e=>e>6?1:0,this.getHeadersInit=()=>({}),this.getIdKey=()=>"id",this.getIdByObject=e=>{const t=this.getIdKey()??"id";return e?e[t]:void 0},this.fetchList=e=>Ye(e,"list","GET",{}),this.fetchItem=(e,t)=>Ye(e,"read","GET",{id:t}),this.updateItem=(e,t,s)=>Ye(e,"update","PATCH",{id:t,item:s}),this.createItem=(e,t)=>Ye(e,"create","POST",{item:t}),this.deleteItem=(e,t)=>Ye(e,"delete","DELETE",{id:t}),this.getEmptyItem=()=>{}}}function Ye(a,e,t,s){var n;const o=(n=a.urls)==null?void 0:n[e];if(!(o!=null&&o.url))return Promise.reject(new Error(`CrudOptions: no URL for "${e}" (set urls.${e}.url)`));const i="id"in s?o.url.split("{id}").join(encodeURIComponent(String(s.id))):o.url,r={headers:a.getHeadersInit?a.getHeadersInit():{},method:o.method??t};if("item"in s){const l=new Headers(r.headers);l.has("Content-Type")||l.set("Content-Type","application/json"),r.headers=l,r.body=JSON.stringify(s.item)}return fetch(i,r).then(l=>Ja(l,r.method,i))}function Ja(a,e,t){return a.ok?a.text().then(s=>s?JSON.parse(s):void 0):Promise.reject(new Error(`CrudOptions: ${e} ${t} failed: ${a.status} ${a.statusText}`.trim()))}class qa{constructor(){this.crudOptions=new or,this.listenActionEvent=e=>{},this.pendingRequests=0}createTableModel(e,t,s=i=>{},o=i=>{}){this.crudOptions=e,this.listenActionEvent=o,e.fetchList(e).then(i=>{var r,n,l,c;if(t.rows=i,i!=null&&i.length){const h=(r=t.columnDefs)!=null&&r.length?t.columnDefs.map(w=>w.property):this.extractProperties(i[0]),d=new pe("row","multi"),u=()=>d;this.tableOptions={...new Ae,...t.tableOptions,hoverColumnVisible:!1,getSelectionModel:u};const f=this.calcAutoColumnWidths(i,h),g=(n=t.columnDefs)!=null&&n.length?t.columnDefs:h.map(((w,y)=>new ee(w,w.toUpperCase(),new C(f[y],"px"))));if((l=e==null?void 0:e.columnWidths)!=null&&l.autoCalc)for(let w=0;w<g.length;w++){const y=g[w];y.width=new C(f[w],"px")}if(e.autoAddActionColumn){let w=new ee(this.getIdKey(),"Actions",_i,new V(["ge-table-text-align-left"],["ge-table-text-align-left ge-table-actions-cell"],void 0));w.rendererMap=new V(void 0,new er(this,e.singleRowActions),void 0),g.push(w)}const p=0,m=e.calcFixedRightColumnCount(g.length);this.tableModel=Z.buildByTypedRowsParam({rows:i,columnDefs:g,tableOptions:this.tableOptions,fixedLeftColumnCount:p,fixedRightColumnCount:m}),this.tableModel.getSelectionModel=u,this.bodyModel=(c=this.tableModel)==null?void 0:c.getBodyModel();const b=new ji(this.tableModel,this.tableOptions);s(b)}},i=>this.logError("loading the list",i))}openDialogForCreate(){if(this.bodyModel){const e=new so("CREATE","body",this.bodyModel,-1,-1,null);this.onActionEvent(e)}}withDirection(e){var t,s;return e.direction=(s=(t=this.tableModel)==null?void 0:t.getTableScope())==null?void 0:s.direction,e}onActionEvent(e){this.listenActionEvent&&this.listenActionEvent(e);const t=this.crudOptions,s=this.getIdKey(),o=e.action,i=e.id;o==="VIEW"?this.whileLoading(()=>t.fetchItem(t,i)).then(r=>this.withDirection(new sr(r)).openDialog()).catch(r=>this.logError(o,r)):o==="EDIT"?this.whileLoading(()=>t.fetchItem(t,i)).then(r=>this.withDirection(new Pe(s,r)).openDialog(n=>this.whileLoading(()=>t.updateItem(t,i,n)).then(l=>this.updateRow(i,this.isItemWithId(l)?l:n)).catch(l=>this.logError(o,l)))).catch(r=>this.logError(o,r)):o==="CLONE"?this.whileLoading(()=>t.fetchItem(t,i)).then(r=>this.withDirection(new Pe(s,r,"Clone Item")).openDialog(n=>this.createItem(o,n))).catch(r=>this.logError(o,r)):o==="CREATE"?this.withDirection(new Pe(s,t.getEmptyItem()??{},"Create Item")).openDialog(r=>this.createItem(o,r)):o==="DELETE"&&this.whileLoading(()=>t.deleteItem(t,i)).then(()=>{var r,n,l,c,h,d,u;(r=this.bodyModel)==null||r.filterRowsByPredict(f=>!this.hasId(f,i)),(l=(n=this.tableModel)==null?void 0:n.getTableScope())==null||l.clearSelection(!0),(h=(c=this.tableModel)==null?void 0:c.getTableScope())==null||h.invalidateAggregates(),(u=(d=this.tableModel)==null?void 0:d.getTableScope())==null||u.repaintHard()}).catch(r=>this.logError(o,r))}createItem(e,t){const s=this.crudOptions,{[this.getIdKey()]:o,...i}=t;this.whileLoading(()=>s.createItem(s,i).then(r=>this.isItemWithId(r)?this.addRow(r):this.reloadRows())).catch(r=>this.logError(e,r))}updateRow(e,t){var o,i,r,n,l;const s=(o=this.bodyModel)==null?void 0:o.getAllRows().find(c=>this.hasId(c,e));s&&(Object.assign(s,t),(r=(i=this.tableModel)==null?void 0:i.getTableScope())==null||r.invalidateAggregates(),(l=(n=this.tableModel)==null?void 0:n.getTableScope())==null||l.repaint())}addRow(e){var s,o,i,r;const t=this.bodyModel;if(t){const n=t.getAllRows(),l=t.getFilteredRows();n.push(e),l!==n&&l.push(e),(o=(s=this.tableModel)==null?void 0:s.getTableScope())==null||o.invalidateAggregates(),(r=(i=this.tableModel)==null?void 0:i.getTableScope())==null||r.repaintHard()}}reloadRows(){const e=this.crudOptions;return e.fetchList(e).then(t=>{var o,i;(o=this.bodyModel)==null||o.setRows(t??[]);const s=(i=this.tableModel)==null?void 0:i.getTableScope();s==null||s.externalFilterChanged(!1),s==null||s.repaintHard()})}whileLoading(e){var o;const t=(o=this.tableModel)==null?void 0:o.getTableScope();this.pendingRequests++,t==null||t.showLoadingOverlay();const s=()=>{this.pendingRequests=Math.max(0,this.pendingRequests-1),this.pendingRequests===0&&(t==null||t.hideOverlay())};return Promise.resolve().then(e).then(i=>(s(),i),i=>{throw s(),i})}getIdKey(){var e,t;return((t=(e=this.crudOptions).getIdKey)==null?void 0:t.call(e))??"id"}hasId(e,t){const s=this.getValueByT(e,this.getIdKey());return s!=null&&String(s)===String(t)}isItemWithId(e){if(e===null||typeof e!="object"||Array.isArray(e))return!1;const t=this.getValueByT(e,this.getIdKey());return t!=null}logError(e,t){console.error(`CrudTableModelFactory: ${e} failed`,t)}calcAutoColumnWidths(e,t,s=t){var c;const o=t.length;if(!((c=this.crudOptions.columnWidths)!=null&&c.autoCalc))return new Array(o).fill(200);const i=e.length??0,r=new Array(o).fill(0);for(let h=0;h<i;h++)for(let d=0;d<o;d++){const u=t[d],f=this.getValueByT(e[h],u),g=(f==null?void 0:f.toString().length)||0;g>r[d]&&(r[d]=g)}if(this.crudOptions.columnWidths.takeHeaderLabelsIntoAccount)for(let h=0;h<o;h++){const d=s[h].length||0;d>r[h]&&(r[h]=d)}const n=this.crudOptions.columnWidths.minWidth,l=this.crudOptions.columnWidths.maxWidth;return r.map((h,d)=>Math.min(l,Math.max(this.crudOptions.columnWidths.charCountToWidth(h,d),n)))}getValueByT(e,t){return t.includes(".")?this.getPropertyValue(e,t.split(".")):e[t]}getPropertyValue(e,t){const s=t.shift(),o=e[s];return o&&t.length?this.getPropertyValue(o,t):o}extractProperties(e,t="",s=[]){for(const o in e)if(e.hasOwnProperty(o)){const i=t?`${t}.${o}`:o;typeof e[o]=="object"&&e[o]!==null&&!Array.isArray(e[o])?this.extractProperties(e[o],i,s):s.push(i)}return s}}class Za{constructor(e,t){this.method=e,this.url=t}}class ir{constructor(e,t,s,o,i,r,n,l){this.key=e,this.label=t,this.level=s,this.field=o,this.path=i,this.parent=r,this.source=n,this.type="RowGroup",this.children=[],this.count=0,this.results={},this.sourceIndices=[],this.states=[],this.idParts=[...(r==null?void 0:r.idParts)??[],[o,l]]}get id(){return"rowgroup:"+JSON.stringify(this.idParts)}isLeaf(){return this.children.length===0}getRows(e=!0){return this.collectIndices(e,[]).map(t=>this.source[t])}collectIndices(e,t){if(this.isLeaf()){const s=e?this.accept:void 0;for(const o of this.sourceIndices)(!s||s(o))&&t.push(o)}else for(const s of this.children)s.collectIndices(e,t);return t}}function Dt(a,e,t){var r;const s=[],o=e.length;if(!o)return s;const i={byKey:new Map};for(let n=0;n<a.length;n++){const l=a[n];let c=i,h;for(let d=0;d<o;d++){const u=e[d];let f=u.getKey(l);He(f)&&(f=pn);let g;const p=f instanceof Date?f.getTime():void 0;if(p!==void 0?g=(r=c.byTime)==null?void 0:r.get(p):g=c.byKey.get(f),!g){const m=u.format&&!He(f)?u.format(f):wn(f,t),b=new ir(f,`${m??""}`,d,u.name,h?[...h.path,f]:[f],h,a,ve(f));g=[b,{byKey:new Map}],p!==void 0?(c.byTime??(c.byTime=new Map)).set(p,g):c.byKey.set(f,g),(h?h.children:s).push(b)}h=g[0],c=g[1]}h.sourceIndices.push(n)}return rr(s,e),s}function rr(a,e){var s;if(!a.length)return;const t=(s=e[a[0].level])==null?void 0:s.compare;t&&a.sort((o,i)=>t(o.key,i.key));for(const o of a)rr(o.children,e)}function nr(a,e,t){for(const s of a)lr(s,e,t);return ar(a,e)}function ar(a,e){const t=e.map(o=>o.aggregator.init());for(const o of a)e.forEach((i,r)=>t[r]=i.aggregator.merge(t[r],o.states[r]));const s={};return e.forEach((o,i)=>s[o.key]=o.aggregator.result(t[i])),s}function lr(a,e,t){if(a.isLeaf()){cr(a,e,t);return}for(const s of a.children)lr(s,e,t);hr(a,e)}function cr(a,e,t){const s=a.source;let o=a.sourceIndices;if(t){o=[];for(const n of a.sourceIndices)t(n)&&o.push(n)}const i=o.length,r=e.map(n=>{const l=n.aggregator,c=n.getValue;let h=l.init();for(let d=0;d<i;d++){const u=s[o[d]];h=l.add(h,c?c(u):u)}return h});a.accept=t,a.states=r,a.count=i,a.results=dr(r,e)}function hr(a,e){const t=e.map(o=>o.aggregator.init());let s=0;for(const o of a.children)s+=o.count,e.forEach((i,r)=>t[r]=i.aggregator.merge(t[r],o.states[r]));a.states=t,a.count=s,a.results=dr(t,e)}function dr(a,e){const t={};return e.forEach((s,o)=>t[s.key]=s.aggregator.result(a[o])),t}const Qa="(empty)";function el(a,e,t={}){return Dt(a,le(e),t.emptyLabel??Qa)}function tl(a,e,t){const s=Object.keys(e??{}).map(o=>dt(o,e[o]));return nr(a,s,t)}const Nt=class Nt extends ee{constructor(e={}){const t={width:new C(220,"px"),showCount:!0,fixed:!0,...e};super(Nt.PROPERTY,t.headerLabel??"Group",t.width,new V(["ge-table-row-group-column-header"],["ge-table-row-group-column"],[]),new V,new C(60,"px"),new C(2e3,"px"),Ue),this.type="RowGroupColumnDef",this.options=t,this.autoHeaderLabel=e.headerLabel===void 0}};Nt.PROPERTY="RowGroupColumn";let P=Nt;class we extends me{constructor(e,t,s,o){super(e,!1,void 0,t,s),this.sourceIndex=o}}const sl=new Intl.NumberFormat("en-US");class ur extends Me{constructor(e,t,s,o=34){super("body",[],o,t),this.kind="AreaModelRowGroups",this.hiddenColumnProperties=[],this.fields=[],this.groups=[],this.textRenderer=new We,this.groupRowById=new Map,this.detailRows=[],this.allDirty=!0,this.dirtyLeaves=new Set,this.totals={},this.batchDepth=0,this.regroupPending=!1,this.builds=0,this.sourceRows=e??[],this.options={...s,groupBy:[...s.groupBy??[]]};const i=s.aggregations??{};this.specs=Object.keys(i).map(r=>this.withCalculatedValue(dt(r,i[r]))),this.specByKey=new Map(this.specs.map(r=>[r.key,r])),this.fields=this.withCalculatedKeys(le(this.options.groupBy)),this.build(!1)}getSourceRows(){return this.sourceRows}setRows(e){this.sourceRows=e??[],this.build(!0)}getGroupBy(){return[...this.options.groupBy]}setGroupBy(e){const t=le(e??[]);this.options.groupBy=[...e??[]],this.fields=this.withCalculatedKeys(t),this.build(!0)}regroup(){this.build(!0)}getGroups(){return this.ensureAggregates(),this.groups}findGroup(e){this.ensureAggregates();let t=this.groups,s;for(const o of e){const i=ve(o);if(s=t.find(r=>ve(r.key)===i),!s)return;t=s.children}return s}getRowGroup(e){var s;const t=(s=this.getRowByIndex(e))==null?void 0:s.data;if(W(t))return this.ensureAggregates(),t}getDetailRow(e){const t=this.getRowByIndex(e);return t&&!W(t.data)?t.data:void 0}isGroupRowIndex(e){var t;return W((t=this.getRowByIndex(e))==null?void 0:t.data)}getTotals(){return this.ensureAggregates(),this.totals}getCheckedRows(){const e=[];return this.detailRows.forEach(t=>{t.checked&&e.push(t.data)}),e}expandToLevel(e){this.groupRowById.forEach(t=>t.expanded=t.data.level<e),this.recalcVisibleTreeRows(!1)}getBuildCount(){return this.builds}batch(e){this.batchDepth++;try{e()}finally{this.batchDepth--}return this.batchDepth||!this.regroupPending?!1:(this.regroupPending=!1,this.build(!0),!0)}getRawValueOfRow(e,t){if(W(e.data)){this.ensureAggregates();const s=e.data;return t===P.PROPERTY?this.getGroupLabel(s):this.specByKey.has(t)?s.results[t]:""}return t===P.PROPERTY?"":super.getRawValueOfRow(e,t)}canMoveRows(e,t){return!1}moveRows(e,t){return!1}getTextValueAt(e,t){const s=this.getRowByIndex(e),o=this.properties[t];if(s&&o!==void 0&&o!==P.PROPERTY&&this.getColumnValues().getShowValuesAs(o))return this.getCalculatedText(o,this.getValueAt(e,t))??"";if(s&&W(s.data)&&o!==P.PROPERTY){const r=o!==void 0?this.specByKey.get(o):void 0;if(!r)return"";const n=this.getValueAt(e,t);return r.format?r.format(n):$e(n)}const i=this.getValueAt(e,t);return i==null?"":`${i}`}getCellRenderer(e,t){const s=this.getRowByIndex(e),o=this.properties[t];return s&&W(s.data)?o!==void 0&&this.specByKey.has(o)?this.textRenderer:void 0:o===P.PROPERTY?void 0:super.getCellRenderer(e,t)}getCustomClassesAt(e,t){const s=super.getCustomClassesAt(e,t),o=this.getRowByIndex(e);if(!o||!W(o.data))return s;const i=this.properties[t],r=o.data.level,n=[...s,"ge-table-row-group",`ge-table-row-group-level-${r}`];return i===P.PROPERTY?n.push("ge-table-row-group-label"):i!==void 0&&this.specByKey.has(i)&&n.push("ge-table-row-group-aggregate"),n}isGroupLabelCell(e,t){return this.properties[t]===P.PROPERTY&&this.isGroupRowIndex(e)}isEditable(e,t){return this.properties[t]===P.PROPERTY||this.isGroupRowIndex(e)?!1:super.isEditable(e,t)}setValue(e,t,s){const o=this.getRowByIndex(e);if(!(o instanceof we)||this.properties[t]===P.PROPERTY)return!1;const i=this.keysOf(o.data);if(!super.setValue(e,t,s))return!1;const n=this.keysOf(o.data);return i.some((l,c)=>ve(l)!==ve(n[c]))?this.batchDepth?this.regroupPending=!0:this.build(!0):this.markRowDirty(o),!0}externalFilterChanged(e){this.userFilter=e;const t=this.sourceRows,s=new Uint8Array(t.length);for(let o=0;o<t.length;o++)s[o]=e(t[o],o,t)?1:0;this.accepted=s,this.allDirty=!0,super.externalFilterChanged(o=>o instanceof we&&s[o.sourceIndex]===1)}doSort(e){if(!e.length)return!1;this.lastSort={items:[...e]},this.ensureAggregates();const t=e.map(({columnIndex:s,sortState:o})=>{const i=o==="asc"?1:o==="desc"?-1:0;return this.createRowComparator(this.properties[s],i)});return super.sort((s,o)=>{for(const i of t){const r=i(s,o);if(r)return r}return 0}),this.syncGroupOrder(),this.allDirty=!0,!0}sort(e){this.lastSort={compareFn:e},super.sort((t,s)=>t instanceof we&&s instanceof we?e(t.data,s.data):0),this.syncGroupOrder(),this.allDirty=!0}invalidateDerivedValues(e){if(super.invalidateDerivedValues(e),(e==null?void 0:e.area)==="body"&&Array.isArray(e.rowIndices)){for(const t of e.rowIndices){const s=this.getRowByIndex(t);s instanceof we?this.markRowDirty(s):this.allDirty=!0}return}this.allDirty=!0}withCalculatedValue(e){const t=e.value,s=e.getValue;return!s||typeof t!="string"?e:{...e,getValue:o=>this.isCalculatedProperty(t)?this.getValueByT(o,t):s(o)}}withCalculatedKeys(e){return e.map(t=>{const s=t.path,o=t.getKey;return s===void 0?t:{...t,getKey:i=>this.isCalculatedProperty(s)?this.getValueByT(i,s):o(i)}})}syncGroupOrder(){const e=t=>(t??[]).filter(s=>W(s.data)).map(s=>{const o=s.data;if(o.isLeaf()){const i=(s.children??[]).map(r=>r.sourceIndex);o.sourceIndices.length=0;for(const r of i)o.sourceIndices.push(r)}else{const i=e(s.children);o.children.length=0,o.children.push(...i)}return o});this.groups=e(this.rows)}getGroupLabel(e){const t=this.options.groupColumn;return t!=null&&t.label?`${t.label(e)??""}`:(t==null?void 0:t.showCount)===!1?e.label:`${e.label} (${sl.format(e.count)})`}ensureAggregates(){if(!this.allDirty&&!this.dirtyLeaves.size)return;const e=this.accepted?(s=>o=>s[o]===1)(this.accepted):void 0;if(!this.fields.length){if(this.allDirty||this.dirtyLeaves.size){const s=e?this.sourceRows.filter((i,r)=>e(r)):this.sourceRows,o=Ut(s,this.specs);this.totals={},this.specs.forEach((i,r)=>this.totals[i.key]=i.aggregator.result(o[r])),this.allDirty=!1,this.dirtyLeaves.clear()}return}if(this.allDirty){this.totals=nr(this.groups,this.specs,e),this.allDirty=!1,this.dirtyLeaves.clear();return}if(!this.dirtyLeaves.size)return;const t=new Set;this.dirtyLeaves.forEach(s=>{cr(s,this.specs,e);for(let o=s.parent;o;o=o.parent)t.add(o)}),this.dirtyLeaves.clear(),Array.from(t).sort((s,o)=>o.level-s.level).forEach(s=>hr(s,this.specs)),this.totals=ar(this.groups,this.specs)}markRowDirty(e){var s;const t=(s=e.parent)==null?void 0:s.data;W(t)?this.dirtyLeaves.add(t):this.allDirty=!0}keysOf(e){return this.fields.map(t=>t.getKey(e))}createRowComparator(e,t){if(!t||e===void 0)return()=>0;const s=this.genericTreeTableSortComparator(e,t),o=this.specByKey.has(e),i=e===P.PROPERTY;return(r,n)=>{const l=W(r.data),c=W(n.data);if(l&&c){const h=r.data,d=n.data;if(o)return this.sorterService.genericSortComparator(h.results[e],d.results[e],t);const u=this.fields[h.level];if(i||(u==null?void 0:u.path)===e){const f=u==null?void 0:u.compare;return f?t*f(h.key,d.key):0}return 0}return!l&&!c&&!i?s(r,n):0}}build(e){const t=new Map,s=new Set;e&&(this.groupRowById.forEach((n,l)=>t.set(l,n.expanded)),this.detailRows.forEach(n=>n.checked&&s.add(n.data))),this.builds++;const o=this.options.emptyLabel??"(empty)";this.groups=Dt(this.sourceRows,this.fields,o),this.groupRowById=new Map,this.detailRows=new Array(this.sourceRows.length);const i=[];if(this.fields.length)for(const n of this.groups)i.push(this.createGroupRow(n,void 0,t));else for(let n=0;n<this.sourceRows.length;n++)i.push(this.detailRows[n]=new we(this.sourceRows[n],void 0,0,n));this.rows.length=0;for(const n of i)this.rows.push(n);s.size&&(this.detailRows.forEach(n=>n.checked=s.has(n.data)),this.rows.forEach(n=>fr(n))),this.allDirty=!0,this.dirtyLeaves.clear(),this.userFilter?this.externalFilterChanged(this.userFilter):this.recalcVisibleTreeRows(!1);const r=this.lastSort;r&&"items"in r?this.doSort(r.items):r&&this.sort(r.compareFn)}createGroupRow(e,t,s){const o=e.id,i=s.get(o)??this.isExpandedByDefault(e),r=new me(e,i,[],t,e.level);if(this.groupRowById.set(o,r),e.isLeaf()){const n=e.level+1;for(const l of e.sourceIndices){const c=new we(this.sourceRows[l],r,n,l);this.detailRows[l]=c,r.children.push(c)}}else for(const n of e.children)r.children.push(this.createGroupRow(n,r,s));return r}isExpandedByDefault(e){const t=this.options.expanded??!0;return typeof t=="function"?!!t(e):typeof t=="number"?e.level<t:t}}function fr(a){var t;if(!((t=a.children)!=null&&t.length))return a.checked;let e=!0;for(const s of a.children)fr(s)||(e=!1);return a.checked=e,e}class io{static createTableModel(e){var d,u;const t=e.rows??[];let s=e.columnDefs?[...e.columnDefs]:t.length?Object.keys(t[0]).map(f=>new ee(f,f.toUpperCase(),Et)):[];const o=e.defaultRowHeights??((d=e.tableOptions)==null?void 0:d.defaultRowHeights)??new fe;let i=e.fixedLeftColumnCount??0;e.rowNumbersVisible&&!O(s[0])&&(s=[new ts(e.rowNumbersVisible===!0?{}:e.rowNumbersVisible),...s],i++);let r=O(s[0])?1:0;const n=Se(s[r]);n&&r++;const l=new P(e.groupColumn??{});l.autoHeaderLabel&&(l.headerLabel=wi(e.groupBy??[],s)),s.splice(r,0,l),l.options.fixed&&(i=Math.max(i,r)+1);const c=new ur(t,s,{groupBy:e.groupBy??[],aggregations:e.aggregations,expanded:e.expanded,emptyLabel:e.emptyLabel,groupColumn:l.options,hideGroupedColumns:e.hideGroupedColumns},o.body);(n||(u=e.tableOptions)!=null&&u.showCheckboxWihoutExtraColumn)&&(c.rowSelectionModel=new _e(c.rows));const h=Z.createTableModel({columnDefs:s,bodyAreaModel:c,footerAggregates:io.footerConfig(e),fixedLeftColumnCount:i,fixedRightColumnCount:e.fixedRightColumnCount??0,rowCheckboxVisible:e.rowCheckboxVisible??n,defaultRowHeights:o,getSelectionModel:e.getSelectionModel,tableOptions:e.tableOptions});return Cs(h),h}static updateLayout(e){return Cs(e)}static footerConfig(e){const t=e.footerAggregates;if(t!==!1)return t===void 0||t===!0?e.aggregations&&Object.keys(e.aggregations).length?e.aggregations:void 0:t}}class gr extends ee{constructor(e,t,s,o=new C(100,"px")){super(e,t,o,new V(["ge-table-pivot-header",`ge-table-pivot-header-${s.kind}`],[],[]),new V,new C(40,"px"),new C(2e3,"px"),Ue),this.pivot=s,this.type="PivotColumnDef"}}const ol=1e3,ro="Total";function il(a){const e=a??[];if(!e.length)throw new Error('Pivot: at least one value is needed (values: ["amount"]).');const t=new Set;return e.map((s,o)=>{const i=typeof s=="string"||typeof s=="function"?{value:s}:s;if(!i||typeof i.value!="string"&&typeof i.value!="function")throw new Error(`Pivot: value ${o} has no value (a property path or a function).`);const r=Wt(i.aggregator??"sum"),n=typeof i.value=="string"?i.value:`value${o}`;let l=i.name??`${r.name}(${n})`;if(t.has(l)){let c=2;for(;t.has(`${l}#${c}`);)c++;l=`${l}#${c}`}return t.add(l),{name:l,label:i.label??l,aggregator:r,format:i.format,showValuesAs:Ge(i.showValuesAs),getValue:r===ae.count?void 0:ht(i.value)}})}const rl="(empty)";class kt{constructor(e,t,s){this.source=e,this.allColumnLeaves=[],this.shownColumns=new Set,this.columnParentsPostOrder=[],this.rowParentsPostOrder=[],this.rowLeaves=[],this.cells=new Map,this.resolved=il(t.values),this.values=this.resolved;const o=t.emptyLabel??rl;this.rowGroups=Dt(e,le(t.rowFields??[]),o),this.columnGroups=Dt(e,le(t.columnFields??[]),o);const i=Math.max(0,t.maxColumns??ol),r=this.allColumnLeaves;bt(this.columnGroups,r),this.truncated=r.length>i,this.truncated&&console.warn(`Pivot: ${r.length} column keys, only the first ${i} are shown (maxColumns). Totals and subtotals count all rows.`),this.columnLeaves=this.truncated?r.slice(0,i):r,this.columnLeafOf=new Int32Array(e.length).fill(-1),r.forEach((n,l)=>{for(const c of n.sourceIndices)this.columnLeafOf[c]=l});for(const n of this.columnLeaves)for(let l=n;l&&!this.shownColumns.has(l);l=l.parent)this.shownColumns.add(l);Ts(this.columnGroups,this.columnParentsPostOrder,()=>!0),Ts(this.rowGroups,this.rowParentsPostOrder,()=>!0),bt(this.rowGroups,this.rowLeaves),this.compute(s)}compute(e){this.accept=e;const t=new Map;if(this.rowGroups.length){for(const l of this.rowLeaves)l.accept=e,t.set(l,this.leafCells(l.sourceIndices));for(const l of this.rowParentsPostOrder){const c=new Map;for(const h of l.children)this.mergeMap(c,t.get(h));t.set(l,c)}const n=new Map;for(const l of this.rowGroups)this.mergeMap(n,t.get(l));t.set(null,n)}else{const n=[];for(let l=0;l<this.source.length;l++)n.push(l);t.set(null,this.leafCells(n))}this.cells=t;const s=(n,l)=>{n.count=(l==null?void 0:l.count)??0;const c={};this.values.forEach((h,d)=>c[h.name]=l&&l.count?h.aggregator.result(l.states[d]):void 0),n.results=c},o=n=>n.forEach(l=>{var c;s(l,(c=t.get(l))==null?void 0:c.get(null)),o(l.children)});o(this.rowGroups);const i=t.get(null),r=n=>n.forEach(l=>{l.isLeaf()&&(l.accept=e),s(l,i.get(l)),r(l.children)});r(this.columnGroups)}getValue(e,t,s=0){const o=this.valueIndex(s),i=this.cell(e,t);if(!(!i||!i.count||o<0))return this.values[o].aggregator.result(i.states[o])}getCount(e,t){var s;return((s=this.cell(e,t))==null?void 0:s.count)??0}getSourceRows(e,t){let s;if(e)s=e.collectIndices(!1,[]).sort((n,l)=>n-l);else{s=[];for(let n=0;n<this.source.length;n++)s.push(n)}const o=this.accept;let i;if(t){i=new Set;const n=[];bt([t],n);for(const l of n){const c=this.allColumnLeaves.indexOf(l);c>=0&&i.add(c)}}const r=[];for(const n of s)o&&!o(n)||i&&!i.has(this.columnLeafOf[n])||r.push(this.source[n]);return r}isColumnShown(e){return this.shownColumns.has(e)}valueIndex(e){return typeof e=="number"?e>=0&&e<this.values.length?e:-1:this.values.findIndex(t=>t.name===e)}cell(e,t){var s;return(s=this.cells.get(e??null))==null?void 0:s.get(t??null)}newCell(){return{count:0,states:this.values.map(e=>e.aggregator.init())}}leafCells(e){const t=this.resolved,s=t.length,o=this.accept,i=this.source,r=this.columnLeafOf,n=new Array(this.allColumnLeaves.length),l=this.newCell(),c=new Array(s);for(let d=0;d<e.length;d++){const u=e[d];if(o&&!o(u))continue;const f=i[u],g=r[u],p=g>=0?n[g]??(n[g]=this.newCell()):void 0;l.count++;for(let m=0;m<s;m++){const b=t[m].getValue;c[m]=b?b(f):f,l.states[m]=t[m].aggregator.add(l.states[m],c[m])}if(p){p.count++;for(let m=0;m<s;m++)p.states[m]=t[m].aggregator.add(p.states[m],c[m])}}const h=new Map;for(let d=0;d<n.length;d++){const u=n[d];u&&h.set(this.allColumnLeaves[d],u)}for(const d of this.columnParentsPostOrder){let u;for(const f of d.children){const g=h.get(f);g&&(u??(u=this.newCell()),this.mergeInto(u,g))}u&&h.set(d,u)}return h.set(null,l),h}mergeInto(e,t){e.count+=t.count,this.values.forEach((s,o)=>e.states[o]=s.aggregator.merge(e.states[o],t.states[o]))}mergeMap(e,t){t.forEach((s,o)=>{let i=e.get(o);i||(i=this.newCell(),e.set(o,i)),this.mergeInto(i,s)})}}function nl(a,e,t){return new kt(a??[],e,t)}function bt(a,e){for(const t of a)t.isLeaf()?e.push(t):bt(t.children,e)}function Ts(a,e,t){for(const s of a)s.isLeaf()||!t(s)||(Ts(s.children,e,t),e.push(s))}function pr(a,e){return"pivot:"+JSON.stringify([...a.idParts,e.name])}function mr(a,e){return"pivot:subtotal:"+JSON.stringify([...a.idParts,e.name])}function Is(a){return"pivot:total:"+JSON.stringify([a.name])}function al(a){const e=a.slice(a.lastIndexOf(".")+1);return e.charAt(0).toUpperCase()+e.slice(1)}function br(a){return bi(le(a),al).join(" › ")}function ll(a){var e;return a.columnSubtotals??(((e=a.columnFields)==null?void 0:e.length)??0)>1}function wr(a,e,t,s={}){var m;const o=a.values,i=o.length>1,r=e.totalLabel??ro,n=ll(e),l=(((m=e.columnFields)==null?void 0:m.length)??0)>0,c=s.valueWidth??new C(100,"px"),h=[...t],d=t.map(b=>({data:b.headerLabel,property:b.property})),u=(b,w,y)=>{var x;return h.push(new gr(b,w,y,((x=s.widths)==null?void 0:x.get(b))??c)),{data:w,property:b}},f=(b,w,y,x,R)=>i?{data:b,visibility:R,children:o.map((M,D)=>u(x(M),M.label,{kind:w,column:y,value:M,valueIndex:D}))}:{...u(x(o[0]),b,{kind:w,column:y,value:o[0],valueIndex:0}),visibility:R},g=b=>{var y;if(!a.isColumnShown(b))return;if(b.isLeaf())return f(b.label,"value",b,x=>pr(b,x));const w=b.children.map(g).filter(x=>!!x);return n&&w.push(f(`${b.label} ${r}`,"subtotal",b,x=>mr(b,x),"always")),{id:b.id,data:b.label,toggle:n,closed:n&&!!((y=s.closedIds)!=null&&y.has(b.id)),children:w}};let p=0;if(l){for(const b of a.columnGroups){const w=g(b);w&&d.push(w)}e.totalColumn!==!1&&(d.push(f(r,"total",void 0,b=>Is(b))),(e.totalColumn===void 0||e.totalColumn==="fixed")&&(p=o.length))}else o.forEach((b,w)=>d.push(u(Is(b),b.label,{kind:"total",value:b,valueIndex:w})));return{columnDefs:h,cellGroups:d,fixedRightColumnCount:p}}class yr extends Ze{constructor(e,t,s,o,i,r,n,l,c,h){super(e,t,s,n,r,!1,l,i,[],-1,0,400,c),this.leadingColumnDefs=o,this.valueWidth=h,this.kind="PivotTableModel",this.pivotFixedRightColumnCount=r}getFixedRightColumnCount(){return this.pivotFixedRightColumnCount}getPivotBody(){return this.bodyAreaModel}getPivotConfig(){return this.getPivotBody().getConfig()}setPivotConfig(e,t){const s=this.getPivotBody(),o={...s.getConfig(),...e};s.configure(o,t),this.relayout()}relayout(){const e=this.getPivotBody(),t=this.headerAreaModel,s=e.getConfig(),o=this.leadingColumnDefs.find(Fe);o!=null&&o.autoHeaderLabel&&(o.headerLabel=br(s.rowFields??[]));const i=new Set(t.getToggleGroupStates().filter(d=>d.closed).map(d=>d.id)),r=this.columnDefs.filter($t),n=new Map(r.map(d=>[d.property,d.width])),l=new Set(r.filter(d=>!ms(d)).map(d=>d.property)),c=wr(e.getResult(),s,this.leadingColumnDefs,{valueWidth:this.valueWidth,closedIds:i,widths:n}),h=t.setGroups(c.cellGroups,c.columnDefs);h.filter(d=>l.has(d.property)).forEach(d=>ii(d,!1)),this.columnDefs=h,this.columnCount=h.length,this.columnSizes=[],this.pivotFixedRightColumnCount=c.fixedRightColumnCount,e.setColumnDefs(h)}}const cl=new Intl.NumberFormat("en-US");class Cr extends Me{constructor(e,t,s={},o=34){super("body",[],o,[]),this.kind="AreaModelPivot",this.rowFields=[],this.textRenderer=new We,this.infoByProperty=new Map,this.dirty=!1,this.builds=0,this.sourceRows=e??[],this.config={...t},this.groupColumnOptions=s,this.build(!1)}getConfig(){return{...this.config}}getResult(){return this.ensureComputed(),this.result}getSourceRows(){return this.sourceRows}getBuildCount(){return this.builds}configure(e,t){const s=new kt(t??this.sourceRows,e);this.config={...e},t&&(this.sourceRows=t),this.build(!0,s)}setColumnDefs(e){this.columnDefs=e,this.properties.length=0;for(const t of e)this.properties.push(t.property);this.infoByProperty=new Map;for(const t of e)$t(t)&&this.infoByProperty.set(t.property,t.pivot)}getPropertyAt(e){return this.properties[e]}getRowGroup(e){var s;const t=(s=this.getRowByIndex(e))==null?void 0:s.data;return t&&t.type==="RowGroup"?t:void 0}getColumnInfo(e){const t=this.properties[e];return t===void 0?void 0:this.infoByProperty.get(t)}getColumnProperty(e,t=0){const s=this.result,o=s.values[s.valueIndex(t)];if(!o)return;if(!e.length){const l=Is(o);return this.infoByProperty.has(l)?l:void 0}let i=s.columnGroups,r;for(const l of e){const c=ve(l);if(r=i.find(h=>ve(h.key)===c),!r)return;i=r.children}const n=r.isLeaf()?pr(r,o):mr(r,o);return this.infoByProperty.has(n)?n:void 0}getColumnIndex(e,t=0){const s=this.getColumnProperty(e,t);return s===void 0?-1:this.properties.indexOf(s)}getCellSourceRows(e,t){const s=this.getResult(),o=this.getRowGroup(e);if(!o&&this.rowFields.length)return[];const i=this.getColumnInfo(t);return s.getSourceRows(o,(i==null?void 0:i.kind)==="total"||i==null?void 0:i.column)}getValueAt(e,t){if(!this.getRowByIndex(e))return"";const o=this.properties[t],i=this.getRowGroup(e);if(o===P.PROPERTY)return i?this.getGroupLabel(i):this.config.totalLabel??ro;const r=o===void 0?void 0:this.infoByProperty.get(o);if(!r)return"";if(!(i&&i.children.length>0&&this.config.subtotals===!1))return this.getShownValue(i,r)}getShownValue(e,t){const s=this.getResult(),o=s.getValue(e,t.column,t.valueIndex),i=t.value.showValuesAs;if(!i||typeof o!="number")return o;let r;switch(i.mode){case"percentOfRowTotal":r=s.getValue(e,void 0,t.valueIndex);break;case"percentOfColumnTotal":r=s.getValue(void 0,t.column,t.valueIndex);break;case"percentOfGrandTotal":r=s.getValue(void 0,void 0,t.valueIndex);break;case"percentOfParentTotal":{const n=e==null?void 0:e.parent;r=s.getValue(e?n??void 0:void 0,t.column,t.valueIndex);break}default:return o}return typeof r=="number"&&r!==0?o/r:void 0}canMoveRows(e,t){return!1}moveRows(e,t){return!1}getTextValueAt(e,t){const s=this.properties[t],o=s===void 0?void 0:this.infoByProperty.get(s),i=this.getValueAt(e,t);return o?i===void 0?this.isSubtotalSuppressed(e)?"":this.config.emptyText??"":o.value.showValuesAs?zt(i,o.value.showValuesAs):o.value.format?o.value.format(i):$e(i):i==null?"":`${i}`}getCellRenderer(e,t){const s=this.properties[t];if(s!==void 0&&this.infoByProperty.has(s))return this.textRenderer}getCustomClassesAt(e,t){const s=super.getCustomClassesAt(e,t),o=this.properties[t],i=this.getRowGroup(e),r=[...s,`ge-table-pivot-level-${(i==null?void 0:i.level)??0}`],n=!!i&&i.children.length>0;if(o===P.PROPERTY)return r.push("ge-table-pivot-label"),n&&r.push("ge-table-pivot-subtotal"),r;const l=o===void 0?void 0:this.infoByProperty.get(o);return l&&(r.push("ge-table-pivot-value"),(n||l.kind==="subtotal")&&r.push("ge-table-pivot-subtotal"),l.kind==="total"&&r.push("ge-table-pivot-total"),this.getValueAt(e,t)===void 0&&r.push("ge-table-pivot-empty")),r}isRowHeaderCell(e,t){return this.properties[t]===P.PROPERTY&&!!this.getRowByIndex(e)}isEditable(e,t){return!1}setValue(e,t,s){return!1}externalFilterChanged(e){this.userFilter=e,this.accepted=this.acceptedBy(this.userFilter),this.dirty=!0,this.ensureComputed();const t=this.result;super.externalFilterChanged(s=>{var o;return!((o=s.children)!=null&&o.length)&&(!this.rowFields.length||t.getCount(s.data)>0)})}doSort(e){if(!e.length)return!1;this.ensureComputed();const t=e.map(({columnIndex:s,sortState:o})=>{const i=o==="asc"?1:o==="desc"?-1:0;return this.createRowComparator(this.properties[s],i)});return super.sort((s,o)=>{for(const i of t){const r=i(s,o);if(r)return r}return 0}),!0}sort(e){super.sort((t,s)=>e(t.data,s.data))}invalidateDerivedValues(){super.invalidateDerivedValues(),this.dirty=!0}isSubtotalSuppressed(e){const t=this.getRowGroup(e);return this.config.subtotals===!1&&!!t&&t.children.length>0}getGroupLabel(e){const t=this.groupColumnOptions;return t.label?`${t.label(e)??""}`:t.showCount?`${e.label} (${cl.format(e.count)})`:e.label}ensureComputed(){var t;if(!this.dirty)return;this.dirty=!1,this.userFilter&&((t=this.accepted)==null?void 0:t.length)!==this.sourceRows.length&&(this.accepted=this.acceptedBy(this.userFilter));const e=this.accepted;this.result.compute(e?(s=>e[s]===1):void 0)}acceptedBy(e){const t=this.sourceRows,s=new Uint8Array(t.length);for(let o=0;o<t.length;o++)s[o]=e(t[o],o,t)?1:0;return s}createRowComparator(e,t){if(!t||e===void 0)return()=>0;if(e===P.PROPERTY)return(i,r)=>{var h;const n=i.data,l=r.data,c=(h=this.rowFields[n.level])==null?void 0:h.compare;return c?t*c(n.key,l.key):0};const s=this.infoByProperty.get(e);if(!s)return()=>0;const o=this.columnDefs.find(i=>i.property===e);return(i,r)=>{const n=this.getShownValue(i.data,s),l=this.getShownValue(r.data,s);return n===void 0||l===void 0?n===l?0:n===void 0?1:-1:o!=null&&o.sortComparator?t*o.sortComparator(n,l,i.data,r.data,t):this.sorterService.genericSortComparator(n,l,t)}}build(e,t){const s=new Map;if(e){const i=r=>r.forEach(n=>{var l;((l=n.data)==null?void 0:l.type)==="RowGroup"&&s.set(n.data.id,n.expanded),n.children&&i(n.children)});i(this.rows)}this.builds++,this.rowFields=le(this.config.rowFields??[]),this.result=t??new kt(this.sourceRows,this.config),this.dirty=!1;const o=[];if(this.rowFields.length)for(const i of this.result.rowGroups)o.push(this.createRow(i,void 0,s));else o.push(new me({type:"PivotTotal"},!0,void 0,void 0,0));this.rows.length=0;for(const i of o)this.rows.push(i);this.userFilter?this.externalFilterChanged(this.userFilter):this.recalcVisibleTreeRows(!1)}createRow(e,t,s){const o=s.get(e.id)??this.isExpandedByDefault(e),i=e.isLeaf()?void 0:[],r=new me(e,o,i,t,e.level);for(const n of e.children)i.push(this.createRow(n,r,s));return r}isExpandedByDefault(e){const t=this.config.expanded??!0;return typeof t=="function"?!!t(e):typeof t=="number"?e.level<t:t}}class xr extends eo{constructor(e,t=34){super(),this.body=e,this.defaultRowHeight=t,this.type="AreaModelPivotFooter",this.textRenderer=new We,this.areaIdent="footer"}getRowCount(){var t;const e=this.body.getConfig();return e.totalRow===!1||!((t=e.rowFields)!=null&&t.length)?0:1}getRowHeight(e){return this.defaultRowHeight}getConstantRowHeight(){return this.defaultRowHeight}getValueAt(e,t){if(e!==0)return"";if(this.isRowHeaderCell(e,t))return this.body.getConfig().totalLabel??ro;const s=this.body.getColumnInfo(t);return s?this.body.getShownValue(void 0,s):""}getTextValueAt(e,t){const s=this.body.getColumnInfo(t),o=this.getValueAt(e,t);return s?o===void 0?this.body.getConfig().emptyText??"":s.value.showValuesAs?zt(o,s.value.showValuesAs):s.value.format?s.value.format(o):$e(o):o==null?"":`${o}`}getCellRenderer(e,t){return this.body.getColumnInfo(t)||this.isLabelColumn(t)?this.textRenderer:void 0}getCustomClassesAt(e,t){if(this.isLabelColumn(t))return["ge-table-pivot-total","ge-table-pivot-label"];if(!this.body.getColumnInfo(t))return[];const o=["ge-table-pivot-value","ge-table-pivot-total"];return this.getValueAt(e,t)===void 0&&o.push("ge-table-pivot-empty"),o}isRowHeaderCell(e,t){return e===0&&this.isLabelColumn(t)}isLabelColumn(e){return this.body.getPropertyAt(e)===P.PROPERTY}}class hl extends Zi{getCustomClassesAt(e,t){const s=this.getValueAt(e,t);return s?s.ownColumn()?["ge-table-pivot-header-column"]:["ge-table-pivot-header-group"]:[]}}class no{static createTableModel(e){var f,g,p;const t=e.defaultRowHeights??((f=e.tableOptions)==null?void 0:f.defaultRowHeights)??new fe,s=no.toConfig(e),o=[];e.rowNumbersVisible&&o.push(new ts(e.rowNumbersVisible===!0?{}:e.rowNumbersVisible));const i={showCount:!1,...e.groupColumn??{}},r=new P(i);r.autoHeaderLabel&&(r.headerLabel=br(s.rowFields??[])),o.push(r);const n=r.options.fixed?o.length:o.length-1,l=new Cr(e.rows??[],s,r.options,t.body),c=wr(l.getResult(),s,o,{valueWidth:e.valueColumnWidth}),h=new hl("header",c.cellGroups,c.columnDefs,t.header,(g=e.tableOptions)==null?void 0:g.headerGroupOptions);c.columnDefs=h.setGroups(c.cellGroups,c.columnDefs),l.setColumnDefs(c.columnDefs);const d=new xr(l,t.footer),u=e.getSelectionModel??((p=e.tableOptions)==null?void 0:p.getSelectionModel)??(()=>{});return new yr(h,l,d,o,c.columnDefs,c.fixedRightColumnCount,n,t,u,e.valueColumnWidth)}static toConfig(e){return{rowFields:e.rowFields??[],columnFields:e.columnFields??[],values:e.values,subtotals:e.subtotals,columnSubtotals:e.columnSubtotals,totalColumn:e.totalColumn,totalRow:e.totalRow,maxColumns:e.maxColumns,expanded:e.expanded,emptyLabel:e.emptyLabel,emptyText:e.emptyText,totalLabel:e.totalLabel}}}exports.ALL_TABLE_STATE_PARTS=he;exports.AbstractAreaModel=jt;exports.ActionEvent=so;exports.ActionsCellRenderer=er;exports.AggregateCellRenderer=We;exports.Aggregators=ae;exports.AnyPropertyType=Ps;exports.AreaMapFactory=Aa;exports.AreaModel=eo;exports.AreaModelAggregateFooter=lt;exports.AreaModelArrayOfArrays=J;exports.AreaModelCellGroups=Zi;exports.AreaModelHidden=j;exports.AreaModelObjectArray=q;exports.AreaModelObjectArrayWithColumndefs=Rs;exports.AreaModelPivot=Cr;exports.AreaModelPivotFooter=xr;exports.AreaModelRowGroups=ur;exports.AreaModelTree=Me;exports.AreaObjectMap=V;exports.AriaGridInfo=nt;exports.AriaIds=ot;exports.AriaTexts=Ee;exports.ArrayPropertyType=ge;exports.AutoRestoreOptions=Ki;exports.AvoidDoubleExecution=Rr;exports.BatchEditOptions=Zt;exports.BatchEditService=Mi;exports.BooleanPropertyType=ko;exports.CellGroup=Ji;exports.CellGroupExt=qi;exports.CellGroupExtCellRenderer=It;exports.CellRange=A;exports.CellgroupFactory=U;exports.CheckboxBooleanPropertyCellRenderer=La;exports.CheckboxCellRenderer=Ms;exports.CheckboxColumnDef=Ra;exports.CheckboxModel=Gi;exports.ChunkData=ma;exports.ColAndRowspanModel=ei;exports.CollapsedExpandedData=Qi;exports.ColorRgb=Ya;exports.ColumnDef=ee;exports.ColumnDefGenerator=Ar;exports.ColumnWidths=tr;exports.ConvenienceDomService=yt;exports.CopyService=Le;exports.CoverGridBodyModel=Ui;exports.CoverGridFactory=ga;exports.CoverGridTableModel=zi;exports.CrudAction=de;exports.CrudObjectEdit=Pe;exports.CrudObjectView=sr;exports.CrudOptions=or;exports.CrudTableModelFactory=qa;exports.CssVars=Ss;exports.DateToIntlDDMMYYYYCellRenderer=Va;exports.DateToIsoCellRenderer=Pa;exports.DateToLocaleDateCellRenderer=Oa;exports.DateToTecCellRenderer=_a;exports.DefaultRowHeights=fe;exports.EleScope=it;exports.EventAdapter=qe;exports.EventCheckboxChangedHandler=Fn;exports.ExcelService=Ci;exports.FORMULA_FUNCTION_NAMES=hn;exports.FalseFn=qs;exports.FillHandleOptions=at;exports.FillHandleService=Bi;exports.FocusModel=Qo;exports.FormulaError=E;exports.GeBatchEditEvent=Ai;exports.GeCellIndices=ws;exports.GeCssColorUtil=Qe;exports.GeDetailEvent=Hi;exports.GeFilterService=ka;exports.GeKeyEvent=Ma;exports.GeModelChangeEvent=Ne;exports.GeMouseEvent=Gt;exports.GeRowDragEvent=xi;exports.GeScrollEvent=di;exports.GeStateChangeEvent=li;exports.GeoData=te;exports.HeaderGroupOptions=Jt;exports.Icon=se;exports.IndexAndPx=ba;exports.InputCellRenderer=mi;exports.InputHandler=hi;exports.JsonService=ls;exports.LicenseManager=Ce;exports.LiveAnnouncer=Mt;exports.MaleFemaleToIconCellRenderer=Ba;exports.MasterDetailOptions=es;exports.MasterDetailService=Ni;exports.MouseHandler=Wo;exports.MouseTargetData=Ct;exports.MultiRowsSelectionModel=ja;exports.NullPropertyType=To;exports.NumberCellProgressBarCellRenderer=Na;exports.NumberCellRenderer=$a;exports.NumberPropertyType=Do;exports.ObjectPropertyType=Q;exports.OsxShortcutActionIdMapping=fi;exports.OverlayOptions=Xt;exports.PROPERTY_TYPE_KEY_ANY=Ds;exports.PROPERTY_TYPE_KEY_ARRAY=Ls;exports.PROPERTY_TYPE_KEY_BOOLEAN=_t;exports.PROPERTY_TYPE_KEY_NULL=ks;exports.PROPERTY_TYPE_KEY_NUMBER=Ht;exports.PROPERTY_TYPE_KEY_OBJECT=Oe;exports.PROPERTY_TYPE_KEY_STRING=Fs;exports.PROPERTY_TYPE_KEY_UNDEFINED=Ve;exports.Padding=Tt;exports.PendingCellChanges=Ri;exports.PivotColumnDef=gr;exports.PivotFactory=no;exports.PivotResult=kt;exports.PivotTableModel=yr;exports.PositiveAndNegativeNumberRenderer=za;exports.ProgressBarCellRenderer=Ua;exports.PropertyItem=Vs;exports.PropertyTypeService=Mr;exports.RenderScope=oi;exports.Renderer=Fa;exports.RequestChunk=Yi;exports.ResizeHandler=yi;exports.RowDragOptions=qt;exports.RowDragService=vi;exports.RowGroup=ir;exports.RowGroupColumnDef=P;exports.RowGroupFactory=io;exports.RowLayout=si;exports.RowNumberCellRenderer=Wi;exports.RowNumberColumnDef=ts;exports.RowNumberOptions=As;exports.SHOW_VALUES_AS_MODES=Ko;exports.SchemeGenerator=Er;exports.SelectCellRenderer=oo;exports.SelectionAggregator=xt;exports.SelectionModel=pe;exports.SelectionService=xe;exports.ShortcutService=pi;exports.SimpleArrayCellRenderer=Wa;exports.SimpleDomService=ys;exports.Size=C;exports.SortItem=St;exports.SortedOptions=Hs;exports.StarRatingCellRenderer=Ga;exports.StoreStateCollapsedExpandService=Ia;exports.StoreStateScrollPosService=Ta;exports.StoreStateSortingService=Da;exports.StringPropertyType=Io;exports.TableApi=qo;exports.TableCellUpdateEvent=Ea;exports.TableFactory=Z;exports.TableModel=Ze;exports.TableModelAndOptions=ji;exports.TableOptions=Ae;exports.TableOverlay=Zo;exports.TableScope=vs;exports.TableStateService=At;exports.ThreeColorGradientArg=Xa;exports.TreeAriaInfo=ti;exports.TreeCheckboxModel=_e;exports.TreeFactory=ke;exports.TreeOptions=Ns;exports.TreeRow=me;exports.TreeRowService=$i;exports.TrueFalseCellRenderer=Ha;exports.TrueFn=Ue;exports.TwoColorGradientArg=Es;exports.UNIMPORTANT_TYPES=tt;exports.UndefinedPropertyType=mt;exports.UrlInfo=Za;exports.ValueInfo=Fo;exports.ValueLabel=Xi;exports.WindowsShortcutActionIdMapping=ui;exports.actionIds=pa;exports.aggregate=Or;exports.aggregateColumns=Br;exports.aggregateRowGroups=tl;exports.allCenter=va;exports.allLeft=xa;exports.allRight=Sa;exports.bodyCenter=ya;exports.bodyLeft=wa;exports.bodyRight=Ca;exports.calcMoveToIndex=us;exports.calcOverlayKind=ps;exports.calculateShowValuesAs=Ws;exports.canMoveFlatRows=Yt;exports.canMoveTreeRows=js;exports.canScrollHorizontally=_o;exports.compileFormula=Xs;exports.computeFillChanges=Oi;exports.computeFillValues=Ii;exports.createFormulaValueGetter=Js;exports.createHarmonizedShortcutByKeyboardEvent=gi;exports.createValueGetter=ht;exports.debounce=Eo;exports.editInputPipeForNumber=Ka;exports.entitySuffix=cs;exports.escapeHtml=I;exports.findRowIndexAtY=Ur;exports.firstLetterUppercase=Vo;exports.formatAggregateValue=$e;exports.formatShowValuesAs=zt;exports.getAggregator=Wt;exports.getAreaIdentByString=ct;exports.getEntityName=Lo;exports.getFillRange=Qs;exports.getInsertBeforeIndex=zs;exports.getLeadingRowNumberColumnCount=rt;exports.getLogicalScrollLeft=No;exports.getTopmostTreeRows=Ks;exports.groupRows=el;exports.harmonizeShortcut=Zs;exports.isAreaModelAggregateFooter=Oo;exports.isAreaModelPivot=ds;exports.isAreaModelRowGroups=X;exports.isAreaModelTree=B;exports.isCheckboxCellRenderer=Os;exports.isCheckboxColumnDef=Se;exports.isExcelFormattedValue=xs;exports.isFillSeries=Di;exports.isFormulaError=S;exports.isGroupRow=hs;exports.isPercentShowValuesAs=Gs;exports.isPivotColumnDef=$t;exports.isPivotTableModel=Bs;exports.isRowGroup=W;exports.isRowGroupColumnDef=Fe;exports.isRowNumberColumnDef=O;exports.isSameCellValue=Si;exports.isTreeRow=L;exports.mirrorArrowKeys=Go;exports.moveArrayItems=jo;exports.moveFlatRows=Ys;exports.moveTreeRows=Yo;exports.normalizeRowIndices=Re;exports.pivotRows=nl;exports.px0=ca;exports.px10=la;exports.px100=Qn;exports.px110=Zn;exports.px120=qn;exports.px130=Jn;exports.px140=Xn;exports.px150=Yn;exports.px160=jn;exports.px170=Kn;exports.px180=zn;exports.px190=Un;exports.px20=aa;exports.px200=Et;exports.px210=Wn;exports.px220=Gn;exports.px230=$n;exports.px240=_n;exports.px250=Hn;exports.px260=Nn;exports.px270=Bn;exports.px280=On;exports.px290=Vn;exports.px30=na;exports.px300=_i;exports.px40=ra;exports.px400=Pn;exports.px50=ia;exports.px500=Ln;exports.px60=oa;exports.px70=sa;exports.px80=ta;exports.px90=ea;exports.readLegacyState=ci;exports.removeLegacyState=bs;exports.resolveShowValuesAs=Ge;exports.resolveTableDirection=Bo;exports.setLogicalScrollLeft=Ho;exports.sumOfNumbers=Kt;exports.throttle=vr;exports.toLogicalX=$o;exports.toPhysicalScrollLeft=wt;exports.trimArraySuffixes=Po;
|