@guiexpert/table 1.1.93 → 1.1.94
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 +13 -0
- package/css/main.css +142 -0
- package/css/table-classes.css +34 -0
- package/css/table-color-vars.css +32 -0
- package/css/table-pivot.css +42 -0
- package/css/table-row-group.css +25 -0
- package/css/table-tree.css +9 -0
- package/index.cjs +44 -36
- package/index.d.ts +39 -0
- package/index.js +6247 -3509
- package/lib/table/aggregation/aggregate-internals.d.ts +30 -0
- package/lib/table/aggregation/aggregate-spec.if.d.ts +51 -0
- package/lib/table/aggregation/aggregate.d.ts +58 -0
- package/lib/table/aggregation/aggregator-name.type.d.ts +39 -0
- package/lib/table/aggregation/aggregator.if.d.ts +51 -0
- package/lib/table/aggregation/aggregators.d.ts +37 -0
- package/lib/table/aggregation/create-value-getter.d.ts +18 -0
- package/lib/table/aggregation/selection-aggregates.if.d.ts +35 -0
- package/lib/table/aggregation/value-accessor.type.d.ts +13 -0
- package/lib/table/data/common/row-number-column-def.d.ts +107 -0
- package/lib/table/data/common/row-number-columns.d.ts +17 -0
- package/lib/table/data/common/row-number-options.d.ts +19 -0
- package/lib/table/data/common/row-number-options.if.d.ts +44 -0
- package/lib/table/data/tablemodel/areamodel/aggregate-footer-options.if.d.ts +73 -0
- package/lib/table/data/tablemodel/areamodel/area-model-aggregate-footer.d.ts +145 -0
- package/lib/table/data/tablemodel/areamodel/area-model-cell-groups.d.ts +18 -1
- package/lib/table/data/tablemodel/areamodel/area-model-pivot-footer.d.ts +47 -0
- package/lib/table/data/tablemodel/areamodel/area-model-pivot.d.ts +250 -0
- package/lib/table/data/tablemodel/areamodel/area-model-row-groups.d.ts +314 -0
- package/lib/table/data/tablemodel/areamodel/area-model-tree.d.ts +14 -0
- package/lib/table/data/tablemodel/areamodel/area-model.if.d.ts +39 -0
- package/lib/table/data/tablemodel/areamodel/derived-values-change.if.d.ts +30 -0
- package/lib/table/factory/pivot-factory.d.ts +63 -0
- package/lib/table/factory/pivot-table-model-para.if.d.ts +44 -0
- package/lib/table/factory/row-group-factory.d.ts +70 -0
- package/lib/table/factory/row-group-table-model-para.if.d.ts +66 -0
- package/lib/table/factory/table-factory.d.ts +45 -1
- package/lib/table/instanceof-workaround.d.ts +143 -6
- package/lib/table/pivot/area-model-pivot-header.d.ts +9 -0
- package/lib/table/pivot/pivot-column-def.d.ts +28 -0
- package/lib/table/pivot/pivot-column-info.if.d.ts +25 -0
- package/lib/table/pivot/pivot-config.if.d.ts +58 -0
- package/lib/table/pivot/pivot-internals.d.ts +13 -0
- package/lib/table/pivot/pivot-layout.d.ts +40 -0
- package/lib/table/pivot/pivot-result.d.ts +157 -0
- package/lib/table/pivot/pivot-table-model.d.ts +86 -0
- package/lib/table/pivot/pivot-value.type.d.ts +67 -0
- package/lib/table/render-scope.d.ts +61 -4
- package/lib/table/renderer/aggregate-cell-renderer.d.ts +27 -0
- package/lib/table/renderer/row-number-cell-renderer.d.ts +27 -0
- package/lib/table/rowgroup/group-rows-internals.d.ts +14 -0
- package/lib/table/rowgroup/group-rows-options.if.d.ts +13 -0
- package/lib/table/rowgroup/group-rows.d.ts +48 -0
- package/lib/table/rowgroup/row-group-column-def.d.ts +26 -0
- package/lib/table/rowgroup/row-group-column-options.if.d.ts +27 -0
- package/lib/table/rowgroup/row-group-detail-row.d.ts +8 -0
- package/lib/table/rowgroup/row-group-field.type.d.ts +56 -0
- package/lib/table/rowgroup/row-group-internals.d.ts +31 -0
- package/lib/table/rowgroup/row-group-layout.d.ts +13 -0
- package/lib/table/rowgroup/row-group-model-options.if.d.ts +39 -0
- package/lib/table/rowgroup/row-group.d.ts +51 -0
- package/lib/table/rowgroup/row-group.if.d.ts +48 -0
- package/lib/table/selection/selection-aggregator.d.ts +37 -0
- package/lib/table/selection/selection-service.d.ts +7 -0
- package/lib/table/service/convenience-dom.service.d.ts +5 -0
- package/lib/table/table-api.d.ts +112 -1
- package/lib/table/table-scope.d.ts +19 -0
- package/package.json +3 -2
package/index.cjs
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});function
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});function Ho(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 xs(a,e=500){let t=null;return function(...s){t&&window.clearTimeout(t),t=window.setTimeout(()=>{a.apply(this,s),t=null},e)}}const $o={"&":"&","<":"<",">":">",'"':""","'":"'"};function E(a){return a==null?"":String(a).replace(/[&<>"']/g,e=>$o[e])}function Wo(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 $t="any",be="undefined",Wt="null",zt="string",mt="number",bt="boolean",jt="Array",we="object",Pe=[Wt,be,$t];class Ut{constructor(e){this.propertyName=e,this.type=$t}}class Ye{constructor(e){this.propertyName=e,this.type=be}}class Ss{constructor(e){this.propertyName=e,this.type=Wt}}class vs{constructor(e){this.propertyName=e,this.type=zt}}class Rs{constructor(e){this.propertyName=e,this.type=mt}}class As{constructor(e){this.propertyName=e,this.type=bt}}class se{constructor(e,t=[]){this.propertyName=e,this.items=t,this.type=jt}}class Kt{constructor(e,t=[]){this.propertyName=e,this.types=t}toString(){return`PropertyItem(propertyName: ${this.propertyName}, types: [${this.types.map(e=>e.type).join(", ")}])`}}class G{constructor(e,t,s=[]){this.propertyName=e,this.className=t,this.properties=s,this.type=we}}class zo{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 se){const o=e.items.find(i=>i.type===we);if(o&&o instanceof G){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=>!Pe.includes(n.type));if(r.length===1){let n=r[0];const l=s?[s,n.propertyName].join("."):n.propertyName;if(n instanceof G)this.iteratePropertyItems(e,n.properties,l);else{let c="";if(n instanceof se){const g=n.items.find(p=>p.type===we);g&&g instanceof G&&(c=g.className)}const h=this.getReadableColumnLabel(l);let d=100,u="",f="ge-table-text-align-left";if(n.type===jt){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===mt?(u=" bodyRenderer: new NumberCellRenderer(),",f="ge-table-text-align-right"):n.type===bt&&(u=" bodyRenderer: new TrueFalseCellRenderer(),",f="ge-table-text-align-center",d=80);e.push(` ColumnDef.create({
|
|
2
2
|
property: "${l}",
|
|
3
|
-
headerLabel: "${
|
|
3
|
+
headerLabel: "${h}",
|
|
4
4
|
width: new Size(${d}, "px"),
|
|
5
|
-
bodyClasses: ["${
|
|
6
|
-
headerClasses: ["${
|
|
5
|
+
bodyClasses: ["${f}"],
|
|
6
|
+
headerClasses: ["${f}"],`),u&&e.push(u),e.push(" }),")}}}}transformLabel(e){return this.LABEL_MAPPINGS[e]||e}getReadableColumnLabel(e){const s=e.split(".").map(o=>{const i=o.replace(/([a-z])([A-Z])/g,"$1 $2");return i.charAt(0).toUpperCase()+i.slice(1)});for(let o=0;o<s.length;o++)s[o]=this.transformLabel(s[o]);return s.join(" ")}renderCumstomCellRenderer(e,t){this.bufCustomRenderer.push(`
|
|
7
7
|
// --------------------------------------------------------------
|
|
8
8
|
|
|
9
9
|
import { AreaModelIf, CellRendererIf, DomServiceIf, AreaIdent, RendererCleanupFnType } from "@guiexpert/table";
|
|
@@ -38,10 +38,10 @@ export class ${t} implements CellRendererIf {
|
|
|
38
38
|
|
|
39
39
|
}
|
|
40
40
|
|
|
41
|
-
`)}}class Ze{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 _t{constructor(){this.property="",this.value="",this.path="",this.propertyItem=new ft("",[new pt("")])}toString(){var e;return`${this.path} -> : ${((e=this.propertyItem)==null?void 0:e.toString())??""}`}}const Qe="Entity";function Vt(h){let e=Ot(Ht(h));return e.includes(Qe)||(e=e+Qe),e}function Ot(h){if(!h||h.length===0)return h;const e=["Array","Arr","List","s"];for(const t of e)if(h.endsWith(t))return h.slice(0,-t.length);return h}function Ht(h){return!h||h.length===0?"":h[0].toUpperCase()+h.slice(1)}class Es{constructor(){this.debugging=!1}json2PropertyType(e,t=""){let s;if(typeof e=="string"){const o=new Ze().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 Ze().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(a=>!me.includes(a.type));if(l.length===1){const a=l[0];if(a instanceof Y){n=!0;for(const c of o.propertyItem.types)a.items.push(c)}else a instanceof V&&(n=!0,a.properties.push(o.propertyItem))}if(!n)for(const a of o.propertyItem.types)r.propertyItem.types.push(a)}}}return t||new pt("")}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 a=(l==null?void 0:l.value.length)??0,c=this.countPath(e,i.path);a>c&&(i.propertyItem.types.some(d=>d.type===re)||i.propertyItem.types.push(new Me(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 _t;let a=r.split("/").pop()||"";if(a==="[]"?a=n:a==="root"&&(a=t),l.property=a,l.value=i,l.path=r,l.propertyItem=this.createPropertyItem(i,l.property),s.push(l),i&&typeof i===ne&&!Array.isArray(i)){for(const c in i)if(i.hasOwnProperty(c)){const d=r?`${r}/${c}`:c;o(i[c],d,a)}}else Array.isArray(i)&&i.forEach((c,d)=>{const u=`${r}/[]`;o(c,u,a)})};return o(e,"root",t),s.sort((i,r)=>i.path.localeCompare(r.path))}createPropertyItem(e,t){return new ft(t,[this.createPropertyType(e,t)])}createPropertyType(e,t){return e===null?new Ft(t):e===void 0?new Me(t):typeof e===ht?new Dt(t):typeof e===Ge&&!isNaN(e)?new Pt(t):typeof e===ze?new Lt(t):Array.isArray(e)?new Y(t):typeof e===ne?new V(t,Vt(t)):new Me(t)}}class Ts{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 Y){for(const o of e.items)if(this.renderTypeScriptInterfacesRecursive(o,t,s),o instanceof V){const i=o;i!==this.rootPropertyType&&this.renderTypeScriptInterfacesFifo.push(i)}}else if(e instanceof V){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 a of r.types)if(a instanceof V)a!==this.rootPropertyType&&this.renderTypeScriptInterfacesFifo.push(a);else if(a instanceof Y)for(const c of a.items)c instanceof V&&this.renderTypeScriptInterfacesFifo.push(c)}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!==re).sort((i,r)=>me.includes(i)?100:me.includes(r)?-100:i.localeCompare(r)).join(this.orOperator);return t.includes(this.orOperator)?"("+t+")":t}renderType(e,t){if(e instanceof Y){const s=e.items.map(o=>this.renderType(o,t)).join(this.orOperator);return s.includes(this.orOperator)?`(${s})[]`:`${s}[]`}return e instanceof V?e.className:e.type}containsUndefinedPropertyType(e){for(const t of e.types)if(t.type===re)return!0;return!1}}class Q{constructor(){this.alreadySet=!1}static getInstance(){return Q.instance||(Q.instance=new Q),Q.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 N(h){return h&&h.type==="TreeRow"}function B(h){return h&&h.type==="AreaModelTree"}function gt(h){return!!h&&h.type==="CheckboxCellRenderer"}function et(h){return h&&h.type==="CheckboxColumnDef"}class je{constructor(e=-1,t=-1,s=-1,o=-1,i,r,n,l=0,a=0,c=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=a,this.draggingY=c,this.action=d}clone(){return new je(this.rowIndex,this.rowTop,this.columnIndex,this.columnLeft,this.areaIdent,this.sideIdent,this.originalEvent,this.clickCount,this.draggingX,this.draggingY,this.action)}}class H{constructor(e=">",t="",s=[]){this.content=e,this.style=t,this.classes=s}}class mt{constructor(e=new H(">","transform: rotate(90deg) translate(66%, -66%); transform-origin: 0 0;",["gt-table-tree-arrow-expanded"]),t=new H(">","",["ge-table-tree-arrow-collapsed"]),s=new H(">","color:transparent;",["gt-table-tree-arrow-hidden"]),o=new H("↕","",["gt-table-tree-arrow-expanded-all"])){this.arrowExpanded=e,this.arrowCollapsed=t,this.arrowPlaceholder=s,this.arrowExpandCollapseAll=o}}class bt{constructor(e=new H("↑","",["ge-header-sorted-asc"]),t=new H("↓","",["ge-header-sorted-desc"]),s=new H("↑","color:transparent;",[])){this.iconAsc=e,this.iconDesc=t,this.iconPlaceholder=s}}const He=class He{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,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 a=((t==null?void 0:t.index)??0)%2===0?"even":"odd";this.domService.addClass(l,`ge-table-row-${a}`)}if(this.domService.setStyle(l,"display","clip"),this.domService.setStyle(l,"position","absolute"),this.domService.setStyle(l,"left",`${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 a=this.domService.createText(r);this.domService.appendChild(l,a)}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:a,tableOptions:c,checkedType:d=void 0,sortState:u,checkboxAriaLabel:p}=e,f=c==null?void 0:c.treeOptions,m=c==null?void 0:c.showCheckboxWihoutExtraColumn,g=this.domService.createElement("div");this.domService.addClass(g,"ge-table-col-div"),m&&this.domService.addClass(g,"ge-with-checkbox"),this.domService.addClass(g,`ge-table-col-div-${s.index}`),this.domService.setAttribute(g,"data-col-index",`${s.index}`),this.domService.setAttribute(g,"data-row-index",`${o}`),this.domService.setAttribute(g,"data-area",`${r}`);const C=((s==null?void 0:s.index)??0)%2===0?"even":"odd";if(r==="body"&&n==="center"&&this.domService.addClass(g,`ge-table-column-${C}`),this.domService.setStyle(g,"display","clip"),this.domService.setStyle(g,"position","absolute"),this.domService.setStyle(g,"left",`${s.left}px`),this.domService.setStyle(g,"top",`${s.top}px`),this.domService.setStyle(g,"width",`${s.width}px`),this.domService.setStyle(g,"height",`${s.height}px`),a&&a!=="none"&&(this.domService.addClass(g,"ge-table-col-tree"),this.addArrowDiv(g,a,f,o,i,r)),m&&i===0&&d&&this.addCheckboxToDiv(g,d,r,o,p),l){const b=a!=="none"&&i===0;this.addLabelDiv(g,l,b,o,i,r)}return u&&this.addSortedIcon(g,u,c==null?void 0:c.sortedOptions,i),this.domService.appendChild(t,g),g}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 a=this.domService.createText(t);this.domService.addClass(l,"ge-table-label"),this.domService.appendChild(l,a),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 bt,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,l=this.domService.createText(n);this.domService.appendChild(i,l),r.style&&this.applyStyleString(i,r.style);for(const a of r.classes)this.domService.addClass(i,a);return this.domService.appendChild(e,i),i}addArrowDiv(e,t="none",s=new mt,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 a=l.content,c=this.domService.createText(a);this.domService.appendChild(n,c),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,"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=He.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,a]of i){const c=this.domService.createElement("div");this.domService.addClass(c,"ge-table-focus-border"),this.setAriaHidden(c),this.domService.setStyle(c,"display","clip"),this.domService.setStyle(c,"position","absolute"),this.domService.setStyle(c,"left",`${r}px`),this.domService.setStyle(c,"top",`${n}px`),this.domService.setStyle(c,"width",`${l}px`),this.domService.setStyle(c,"height",`${a}px`),this.domService.setStyle(c,"z-index","9999"),this.applyStyle(c,s),this.domService.appendChild(e,c)}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)}};He.focusBorderWidthInPx=2;let Ie=He;const ve=h=>h==="header"?"header":h==="footer"?"footer":"body";class ke{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=ve(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 Bt{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 ke(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(N(r.row)&&r.areaModel){const l=r.colIdx===this.getArrowColumnIndex()&&e.altKey,a=r.className.includes("ge-table-tree-arrow-div");if(l||a){e.preventDefault(),e.stopPropagation();const c=r.row;this.tableScope.setTreeRowExpanded(c,!c.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 ke(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,a=ve(l),c=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(a);if(l&&a==="header")this.tableScope.tableModel.isSortable(d)&&(this.tableScope.clearSelection(),this.tableScope.onHeaderDblClicked(e,c,d));else if(n.getAttribute("data-row-index")){const p=u.getRowByIndex(c);if(l&&a==="body"&&u.isEditable(c,d)&&(this.tableScope.clearSelection(),this.tableScope.initRenderEditor(c,d)),N(p)&&d===this.getArrowColumnIndex()){e.preventDefault(),e.stopPropagation();const f=p;this.tableScope.setTreeRowExpanded(f,!f.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(){return this.tableScope.tableModel.isRowCheckboxVisible()?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}}class Ue{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((i=s==null?void 0:s.editable)==null?void 0:i.call(s))??!1}setValue(e,t,s){var n;const o=(n=this.columnDefs[t])==null?void 0:n.editInputPipe;o&&(s=o(s,e,t));const i=this.getRowByIndex(e),r=this.columnDefs[t].property;return r.includes(".")?this.setPropertyValue(i,r.split("."),s):(i[r]=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]}}class yt{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)}}class _ extends Ue{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 yt,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]}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}getValueAt(e,t){const s=this.properties[t];let o=this.filteredRows[e];return N(o)&&(o=o.data),o?this.getValueByT(o,s):""}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===_.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):[]}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 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)}getValueByT(e,t){if(e&&t)return 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){const s=super.getCustomClassesAt(e,t);return this.getRowByIndex(e).selected&&s.push(this.selectedRowClass),this._focusedRowIndex===e&&s.push(this.focusedRowClass),s}genericFlatTableSortComparator(e,t){const s=this.columnDefs.find(o=>o.property===e);return(o,i)=>{const r=this.getValueByT(o,e),n=this.getValueByT(i,e);return s!=null&&s.sortComparator?t*s.sortComparator(r,n,o,i,t):this.sorterService.genericSortComparator(r,n,t)}}getPropertyValue(e,t){const s=t.shift(),o=e[s];return o&&t.length?this.getPropertyValue(o,t):o}}class Nt{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.repaint()}destroy(){this.tableScope.destroy()}repaintHard(){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){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,l;const s=[],o=this.tableScope.tableModel,i=[];for(let a=0;a<o.getColumnCount();a++)((l=(n=o.getColumnDef(a))==null?void 0:n.isVisible)==null?void 0:l.call(n))!==!1&&i.push(a);const r=["header","body","footer"];for(const a of r){const c=o.getAreaModel(a),d=(c==null?void 0:c.getRowCount())??0;for(let u=0;u<d;u++)s.push(i.map(p=>c.getValueAt(u,p)))}return Promise.resolve(this.tableScope.excelService.downloadExcel(s,e,t))}getTableScope(){return this.tableScope}getSelectionModel(){return this.tableScope.selectionModel()}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){const t=this.getBodyModel();t instanceof _?t.setRows(e):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 _){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 _){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 _){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 _?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 _)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 _)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 _){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 N(s)?this.tableScope.setTreeRowExpanded(s,t):!1}sort(e){this.tableScope.sort(e)}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 O{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 ge=class ge{constructor(e){this.prefix=e}static createPrefix(e){const t=(e??"").trim();return t?`ge-${t.replace(/\s+/g,"_")}`:(ge.counter++,`ge-t${ge.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`}};ge.counter=0;let be=ge;class Ke{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 Ke;if(e)for(const s of Object.keys(e))e[s]!==void 0&&(t[s]=e[s]);return t}}function tt(h){return h.manual?h.manual:!h.autoNoRows||h.rowCount!==0?"none":(h.unfilteredRowCount??0)>0?"noMatches":"noRows"}const Mt={none:"",loading:"ge-table-overlay-loading",noRows:"ge-table-overlay-no-rows",noMatches:"ge-table-overlay-no-matches"};class $t{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=Ke.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?tt({rowCount:e,unfilteredRowCount:t,autoNoRows:s}):tt({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(Mt[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 ${Mt[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 Be=class Be{constructor(e,t,s,o){this.hostElement=e,this.tableModel=t,this.dom=s,this.tableOptions=o,this.scrollTop=0,this.areaBodyWestGeo=new O,this.areaBodyCenterGeo=new O,this.areaBodyEastGeo=new O,this.hostAttributesBefore=new Map;const i=this.hostElement;i.innerText="",this.dom.setAttribute(i,"tabindex","0"),this.ariaIds=new be(be.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 l of["west","center","east"]){const a=this.ariaIds.rowGroup(n,l),c=this.getAreaChild(n,l);s.setAttribute(c,"id",a),s.setAttribute(c,"role","presentation"),r.push(a)}this.setHostAriaAttribute("aria-owns",r.join(" ")),this.tableOverlay=new $t(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=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.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,Be.maxScrollHeightInPx)}px`;this.dom.setStyle(this.contentWrapperDiv,"width",e),this.dom.setStyle(this.contentWrapperDiv,"height",s)}};Be.maxScrollHeightInPx=8e6;let ye=Be;class v{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 v(e.rowIndex1,e.columnIndex1,e.rowIndex2,e.columnIndex2,e.gammaRange)}static singleCell(e,t){return new v(e,t,e,t)}static singleRow(e){return new v(e,0,e,Number.MAX_SAFE_INTEGER)}static singleColumn(e){return new v(0,e,Number.MAX_SAFE_INTEGER,e)}isInRange(e,t){return e>=this.r1&&e<=this.r2&&t>=this.c1&&t<=this.c2}}class X{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(v.singleRow(e)):this.selectionType==="column"?this.addRange(v.singleColumn(t)):(this.selectionType==="cell"||this.selectionType==="range")&&this.addRange(v.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 v(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(a=>X.intersects(a,i));for(let a=r;a<=n;a++)!o.has(a)&&(!l.length||!X.coversColumns(l,a,i.c1,i.c2))&&o.add(a)}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 v(e.r1,0,e.r2,Number.MAX_SAFE_INTEGER):this.selectionType==="column"&&(t=new v(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(v.singleCell(e,t)):this.reselectPoint(e,t)?this.fireChangeEvent():this.addSelection(v.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(v.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 v(s.r1,s.c1,o-1,s.c2,s.gammaRange)),i<s.r2&&t.push(new v(i+1,s.c1,s.r2,s.c2,s.gammaRange)),s.c1<r&&t.push(new v(o,s.c1,i,r-1,s.gammaRange)),n<s.c2&&t.push(new v(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=>X.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 v(e.r1,e.c1,s-1,e.c2)),o<e.r2&&n.push(new v(o+1,e.c1,e.r2,e.c2)),e.c1<i&&n.push(new v(s,e.c1,o,i-1)),r<e.c2&&n.push(new v(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 Wt{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 Gt{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 v(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 D{constructor(e,t,s){this.header=e,this.body=t,this.footer=s}}class we{constructor(e,t,s,o){this.headerRowCount=e,this.bodyRowCount=t,this.footerRowCount=s,this.colIndexMap=o}static create(e){var l,a,c;const t=e.isHeaderVisibe()?Math.max(0,((l=e.getAreaModel("header"))==null?void 0:l.getRowCount())??0):0,s=e.isFooterVisibe()?Math.max(0,((a=e.getAreaModel("footer"))==null?void 0:a.getRowCount())??0):0,o=((c=e.getAreaModel("body"))==null?void 0:c.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 we(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 zt{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((a,c)=>r.set(a,c+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 Re{static create(e){const t=new Re;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"}}class jt extends ye{constructor(e,t,s,o){var r,n,l,a;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 D,this.draggingTargetColumnIndex=-1,this.contentScrollTop=0,this.removables=[],this.treeAriaInfo=new zt,this.ariaSelectionKind="none",this.renderedSpanCells=new Set,this.ariaTexts=Re.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 c=new X;this.getSelectionModel=()=>c}if((a=this.tableOptions)!=null&&a.getFocusModel)this.getFocusModel=this.tableOptions.getFocusModel;else{const c=new Wt("cell");this.getFocusModel=()=>c}B(t.getAreaModel("body"))&&(this.tree=!0),["header","body","footer"].forEach(c=>{var d;this.colAndRowspanModels[c]=new Gt(t,t.getAreaModel(c)),(d=this.colAndRowspanModels[c])==null||d.init()})}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()}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(){for(const i of this.removables)i.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 i=this.getContentScrollRangeY();Math.abs(this.scrollTop-this.pendingContentScroll.scrollTop)<=1&&i>0?this.scrollFactorY=Math.min(1,Math.max(0,this.pendingContentScroll.contentTop/i)):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=we.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 O(0,e,1,0),this.hostElement,"ge-table-border")),this.tableOptions.tableBottomBorderVisible&&this.removables.push(this.dom.addHorizontalBorder(new O(0,e,1,t-1),this.hostElement,"ge-table-border")),this.tableModel.getFixedLeftColumnCount()>0&&this.removables.push(this.dom.addVerticalBorder(new O(s,1,t,0),this.hostElement,"ge-table-body-west-vertical-border")),this.tableModel.isHeaderVisibe()&&this.removables.push(this.dom.addHorizontalBorder(new O(0,e,1,o),this.hostElement,"ge-table-body-west-vertical-border")),this.updateOverlay(),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){e.forEach(s=>{this.tableModel.getAreaModel(s.area).setValue(s.rowIndex,s.columnIndex,s.value),t||this.rerenderCellContent(s)}),t&&this.repaint()}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 a;const c=e==="body"&&this.editorRenderer&&this.editorRendererRow===t&&this.editorRendererColumn===s;let d;if(c?d=this.editorRenderer:d=r.getCellRenderer(t,s),l.innerText="",this.applyCssClasses(l,i),d)a=d.render(l,t,s,e,r,o,this.dom.domService),a&&this.cleanupFunctions[e].push(a);else{const f=`${o}`;this.dom.addLabelDiv(l,f,!1,t,s,e)}const u=r.getCustomClassesAt(t,s);u.length&&this.dom.addClasses(u,l);const p=r.getCustomStyleAt(t,s);if(p)for(const f in p)this.dom.setStyle(l,f,p[f])}}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>ye.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 b,x,I;const s=this.getArea(e,"west"),o=this.getArea(e,"center"),i=this.getArea(e,"east"),r=((b=this.areaHeightsOfRenderPass)==null?void 0:b[e])??o.child.clientHeight;s.child.innerText="",o.child.innerText="",i.child.innerText="";const n=0,l=this.areaBodyCenterGeo.width,a=this.tableModel.getPadding(),c=this.tableModel.getAreaModel(e),d=c.getRowCount();for(;this.cleanupFunctions[e].length;){const w=this.cleanupFunctions[e].shift();w&&w()}if(e==="header"&&!this.tableModel.isHeaderVisibe()||e==="footer"&&!this.tableModel.isFooterVisibe()){this.updateRowGroupRoles(s,o,i);return}let u=t;const p=this.tableModel.getColumnCount(),f=this.tableModel.getFixedRightColumnCount(),m=this.tableModel.getFixedLeftColumnCount();e==="body"&&(this.firstVisibleRowIndex=-1,this.firstFullVisibleRowIndex=-1,this.lastVisibleRowIndex=-1,this.lastFullVisibleRowIndex=-1);let g=0;const C=(x=c.getConstantRowHeight)==null?void 0:x.call(c);if(C!==void 0&&C>0&&u<0){for(g=Math.min(d,Math.floor(-u/C));g>0&&u+g*C>0;)g--;u=u+g*C}for(let w=g;w<d;w++){const A=u,R=w===d-1,M=this.tableModel.getRowHeight(e,w);if(A+M>0){e==="body"&&this.firstVisibleRowIndex===-1&&(this.firstVisibleRowIndex=w,this.firstFullVisibleRowIndex=A<-this.pixelLimitForFullVisible?this.firstVisibleRowIndex+1:this.firstVisibleRowIndex);let T={left:n,width:l,height:M,top:A,index:w},k=this.dom.addRowDiv(o,T,w,e,"center");this.applyRowAria(k,e,c,w);const ee=[k],ce=m;this.adjustColumnsToRowParent({areaIdent:e,sideIdent:"center",areaModel:c,geo:T,parent:k,rowIndex:w,columnIndexStart:ce,columnIndexEnd:p-f-1,verticalFixed:!1,lastRowOfModel:R}),a.left>0&&(T={left:n,width:this.areaBodyWestGeo.width,height:M,top:A,index:w},k=this.dom.addRowDiv(s,T,w,e,"west"),this.applyRowAria(k,e,c,w),ee.push(k),this.adjustColumnsToRowParent({areaIdent:e,sideIdent:"west",areaModel:c,geo:T,parent:k,rowIndex:w,columnIndexStart:0,columnIndexEnd:ce-1,verticalFixed:!0,lastRowOfModel:R})),a.right>0&&(T={left:n,width:this.areaBodyEastGeo.width,height:M,top:A,index:w},k=this.dom.addRowDiv(i,T,w,e,"east"),this.applyRowAria(k,e,c,w),this.adjustColumnsToRowParent({areaIdent:e,sideIdent:"east",areaModel:c,geo:T,parent:k,rowIndex:w,columnIndexStart:p-f,columnIndexEnd:p-1,verticalFixed:!0,lastRowOfModel:R}));const z=e==="header"&&this.tree&&w===d-1?this.findCellDiv(ee,this.getTreeArrowColumnIndex()):void 0;if(z!=null&&z.parentElement){const de=(parseFloat(z.style.left)||0)+16,he=this.dom.applyStyle(this.dom.setAttribute(this.dom.addDiv(z.parentElement,new O(de,20,20,8)),"data-ge-action","toggleExpandCollapseAll"),{cursor:"pointer"}),S=this.tableOptions.treeOptions.arrowExpandCollapseAll;if(S){const ue=this.dom.domService.createText(S.content);this.dom.domService.appendChild(he,ue),S.style&&this.dom.applyStyleString(he,S.style)}}}if(u=u+M,u>r){e==="body"&&(this.lastVisibleRowIndex=w,this.lastFullVisibleRowIndex=r-u<-this.pixelLimitForFullVisible?w-1:w,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 Tt{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 Ms{constructor(){this.property="",this.value="",this.path="",this.propertyItem=new Kt("",[new Ut("")])}toString(){var e;return`${this.path} -> : ${((e=this.propertyItem)==null?void 0:e.toString())??""}`}}const It="Entity";function Es(a){let e=Ts(Is(a));return e.includes(It)||(e=e+It),e}function Ts(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 Is(a){return!a||a.length===0?"":a[0].toUpperCase()+a.slice(1)}class jo{constructor(){this.debugging=!1}json2PropertyType(e,t=""){let s;if(typeof e=="string"){const o=new Tt().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 Tt().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=>!Pe.includes(c.type));if(l.length===1){const c=l[0];if(c instanceof se){n=!0;for(const h of o.propertyItem.types)c.items.push(h)}else c instanceof G&&(n=!0,c.properties.push(o.propertyItem))}if(!n)for(const c of o.propertyItem.types)r.propertyItem.types.push(c)}}}return t||new Ut("")}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===be)||i.propertyItem.types.push(new Ye(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 Ms;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===we&&!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 Kt(t,[this.createPropertyType(e,t)])}createPropertyType(e,t){return e===null?new Ss(t):e===void 0?new Ye(t):typeof e===zt?new vs(t):typeof e===mt&&!isNaN(e)?new Rs(t):typeof e===bt?new As(t):Array.isArray(e)?new se(t):typeof e===we?new G(t,Es(t)):new Ye(t)}}class Uo{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 se){for(const o of e.items)if(this.renderTypeScriptInterfacesRecursive(o,t,s),o instanceof G){const i=o;i!==this.rootPropertyType&&this.renderTypeScriptInterfacesFifo.push(i)}}else if(e instanceof G){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 G)c!==this.rootPropertyType&&this.renderTypeScriptInterfacesFifo.push(c);else if(c instanceof se)for(const h of c.items)h instanceof G&&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!==be).sort((i,r)=>Pe.includes(i)?100:Pe.includes(r)?-100:i.localeCompare(r)).join(this.orOperator);return t.includes(this.orOperator)?"("+t+")":t}renderType(e,t){if(e instanceof se){const s=e.items.map(o=>this.renderType(o,t)).join(this.orOperator);return s.includes(this.orOperator)?`(${s})[]`:`${s}[]`}return e instanceof G?e.className:e.type}containsUndefinedPropertyType(e){for(const t of e.types)if(t.type===be)return!0;return!1}}class ae{constructor(){this.alreadySet=!1}static getInstance(){return ae.instance||(ae.instance=new ae),ae.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 $(a){return a&&a.type==="TreeRow"}function H(a){return a&&a.type==="AreaModelTree"}function Yt(a){return!!a&&a.type==="CheckboxCellRenderer"}function ye(a){return a&&a.type==="CheckboxColumnDef"}function F(a){return!!a&&a.type==="RowNumberColumnDef"}function ks(a){return!!a&&a.type==="AreaModelAggregateFooter"}function L(a){return!!a&&a.type==="RowGroup"}function Ko(a){return $(a)&&L(a.data)}function X(a){return!!a&&a.kind==="AreaModelRowGroups"}function ge(a){return!!a&&a.type==="RowGroupColumnDef"}function Xt(a){return!!a&&a.kind==="PivotTableModel"}function Yo(a){return!!a&&a.kind==="AreaModelPivot"}function Jt(a){return!!a&&a.type==="PivotColumnDef"}class wt{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 wt(this.rowIndex,this.rowTop,this.columnIndex,this.columnLeft,this.areaIdent,this.sideIdent,this.originalEvent,this.clickCount,this.draggingX,this.draggingY,this.action)}}class j{constructor(e=">",t="",s=[]){this.content=e,this.style=t,this.classes=s}}class qt{constructor(e=new j(">","transform: rotate(90deg) translate(66%, -66%); transform-origin: 0 0;",["gt-table-tree-arrow-expanded"]),t=new j(">","",["ge-table-tree-arrow-collapsed"]),s=new j(">","color:transparent;",["gt-table-tree-arrow-hidden"]),o=new j("↕","",["gt-table-tree-arrow-expanded-all"])){this.arrowExpanded=e,this.arrowCollapsed=t,this.arrowPlaceholder=s,this.arrowExpandCollapseAll=o}}class Zt{constructor(e=new j("↑","",["ge-header-sorted-asc"]),t=new j("↓","",["ge-header-sorted-desc"]),s=new j("↑","color:transparent;",[])){this.iconAsc=e,this.iconDesc=t,this.iconPlaceholder=s}}const ct=class ct{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,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,"left",`${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,w=h==null?void 0:h.showCheckboxWihoutExtraColumn,m=this.domService.createElement("div");this.domService.addClass(m,"ge-table-col-div"),w&&this.domService.addClass(m,"ge-with-checkbox"),this.domService.addClass(m,`ge-table-col-div-${s.index}`),this.domService.setAttribute(m,"data-col-index",`${s.index}`),this.domService.setAttribute(m,"data-row-index",`${o}`),this.domService.setAttribute(m,"data-area",`${r}`);const b=((s==null?void 0:s.index)??0)%2===0?"even":"odd";if(r==="body"&&n==="center"&&this.domService.addClass(m,`ge-table-column-${b}`),this.domService.setStyle(m,"display","clip"),this.domService.setStyle(m,"position","absolute"),this.domService.setStyle(m,"left",`${s.left}px`),this.domService.setStyle(m,"top",`${s.top}px`),this.domService.setStyle(m,"width",`${s.width}px`),this.domService.setStyle(m,"height",`${s.height}px`),c&&c!=="none"&&(this.domService.addClass(m,"ge-table-col-tree"),this.addArrowDiv(m,c,p,o,i,r)),w&&i===g&&d&&this.addCheckboxToDiv(m,d,r,o,f),l){const x=c!=="none"&&i===g;this.addLabelDiv(m,l,x,o,i,r)}return u&&this.addSortedIcon(m,u,h==null?void 0:h.sortedOptions,i),this.domService.appendChild(t,m),m}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 Zt,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,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 qt,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,"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=ct.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,"left",`${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,"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)}};ct.focusBorderWidthInPx=2;let Je=ct;const Be=a=>a==="header"?"header":a==="footer"?"footer":"body";class qe{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=Be(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 Ds{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 qe(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($(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.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 qe(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=Be(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)),$(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}}class yt{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((i=s==null?void 0:s.editable)==null?void 0:i.call(s))??!1}setValue(e,t,s){var n;const o=(n=this.columnDefs[t])==null?void 0:n.editInputPipe;o&&(s=o(s,e,t));const i=this.getRowByIndex(e),r=this.columnDefs[t].property;return r.includes(".")?this.setPropertyValue(i,r.split("."),s):(i[r]=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]}}class Qt{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)}}class B extends yt{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 Qt,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]}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}getValueAt(e,t){const s=this.properties[t];let o=this.filteredRows[e];return $(o)&&(o=o.data),o?this.getValueByT(o,s):""}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===B.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):[]}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 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)}getValueByT(e,t){if(e&&t)return 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){const s=super.getCustomClassesAt(e,t);return this.getRowByIndex(e).selected&&s.push(this.selectedRowClass),this._focusedRowIndex===e&&s.push(this.focusedRowClass),s}genericFlatTableSortComparator(e,t){const s=this.columnDefs.find(o=>o.property===e);return(o,i)=>{const r=this.getValueByT(o,e),n=this.getValueByT(i,e);return s!=null&&s.sortComparator?t*s.sortComparator(r,n,o,i,t):this.sorterService.genericSortComparator(r,n,t)}}getPropertyValue(e,t){const s=t.shift(),o=e[s];return o&&t.length?this.getPropertyValue(o,t):o}}class v{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 v(e.rowIndex1,e.columnIndex1,e.rowIndex2,e.columnIndex2,e.gammaRange)}static singleCell(e,t){return new v(e,t,e,t)}static singleRow(e){return new v(e,0,e,Number.MAX_SAFE_INTEGER)}static singleColumn(e){return new v(0,e,Number.MAX_SAFE_INTEGER,e)}isInRange(e,t){return e>=this.r1&&e<=this.r2&&t>=this.c1&&t<=this.c2}}function es(a){return typeof a=="number"&&!Number.isNaN(a)}function Xo(a){if(es(a))return a;if(a instanceof Date){const e=a.getTime();return Number.isNaN(e)?void 0:e}}function ts(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 Ps(a){return Number.isFinite(a.sum)?a.sum+a.compensation:a.sum}function Fs(a,e){ts(a,e.sum),a.compensation+=e.compensation}const Jo={name:"sum",init:()=>({sum:0,compensation:0}),add:(a,e)=>(es(e)&&ts(a,e),a),merge:(a,e)=>(Fs(a,e),a),result:a=>Ps(a)},qo={name:"count",init:()=>0,add:a=>a+1,merge:(a,e)=>a+e,result:a=>a},Zo={name:"avg",init:()=>({sum:0,compensation:0,count:0}),add:(a,e)=>(es(e)&&(ts(a,e),a.count++),a),merge:(a,e)=>(Fs(a,e),a.count+=e.count,a),result:a=>a.count?Ps(a)/a.count:void 0};function fs(a,e){return{name:a,init:()=>({has:!1,value:void 0,key:0}),add:(t,s)=>{const o=Xo(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 Qo={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},ei={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},ti={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},de=Object.freeze({sum:Jo,count:qo,avg:Zo,min:fs("min",(a,e)=>a<e),max:fs("max",(a,e)=>a>e),countDistinct:Qo,first:ei,last:ti});function ss(a){if(typeof a!="string")return a;const e=de[a];if(!e)throw new Error(`Unknown aggregator "${a}" – use one of: ${Object.keys(de).join(", ")}, or an own AggregatorIf.`);return e}const ht=class ht{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 v(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,w)=>p+(w.r2-w.r1+1)*w.columns.length,0)>ht.maxCells)return s.capped=!0,s;const{sum:c,min:h,max:d}=de;let u=c.init(),f=h.init(),g=d.init();return n.forEach((p,w)=>{const m=n.slice(0,w);for(let b=p.r1;b<=p.r2;b++)for(const x of p.columns){if(m.length&&m.some(C=>b>=C.r1&&b<=C.r2&&C.columns.includes(x))||!t.isSelected(b,x))continue;s.count++;const S=o.getValueAt(b,x);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||F(n)||ye(n)||o.push(r)}return o}};ht.maxCells=1e6;let Ze=ht;class Ls{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){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 l=0;l<o.getColumnCount();l++){const c=o.getColumnDef(l);((n=c==null?void 0:c.isVisible)==null?void 0:n.call(c))!==!1&&(F(c)&&!c.options.exported||i.push(l))}const r=["header","body","footer"];for(const l of r){const c=o.getAreaModel(l),h=(c==null?void 0:c.getRowCount())??0;for(let d=0;d<h;d++)s.push(i.map(u=>this.getExportValue(o,l,c,d,u)))}return Promise.resolve(this.tableScope.excelService.downloadExcel(s,e,t))}getExportValue(e,t,s,o,i){const r=e.getColumnDef(i);return F(r)&&t!=="header"?t!=="body"?"":r.hasDefaultFormat()?r.getRowNumber(o,s):r.getRowNumberText(o,s):s.getValueAt(o,i)}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 Ze().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){const t=this.getBodyModel();t instanceof B?t.setRows(e):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 B){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 B){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 B){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 B?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 B)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 B)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 B){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 $(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 Xt(e)?e.getPivotConfig():void 0}sort(e){this.tableScope.sort(e)}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 z{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 De=class De{constructor(e){this.prefix=e}static createPrefix(e){const t=(e??"").trim();return t?`ge-${t.replace(/\s+/g,"_")}`:(De.counter++,`ge-t${De.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`}};De.counter=0;let Fe=De;class Ct{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 Ct;if(e)for(const s of Object.keys(e))e[s]!==void 0&&(t[s]=e[s]);return t}}function kt(a){return a.manual?a.manual:!a.autoNoRows||a.rowCount!==0?"none":(a.unfilteredRowCount??0)>0?"noMatches":"noRows"}const gs={none:"",loading:"ge-table-overlay-loading",noRows:"ge-table-overlay-no-rows",noMatches:"ge-table-overlay-no-matches"};class Vs{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=Ct.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?kt({rowCount:e,unfilteredRowCount:t,autoNoRows:s}):kt({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(gs[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 ${gs[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 dt=class dt{constructor(e,t,s,o){this.hostElement=e,this.tableModel=t,this.dom=s,this.tableOptions=o,this.scrollTop=0,this.areaBodyWestGeo=new z,this.areaBodyCenterGeo=new z,this.areaBodyEastGeo=new z,this.hostAttributesBefore=new Map;const i=this.hostElement;i.innerText="",this.dom.setAttribute(i,"tabindex","0"),this.ariaIds=new Fe(Fe.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 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 Vs(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=H(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,dt.maxScrollHeightInPx)}px`;this.dom.setStyle(this.contentWrapperDiv,"width",e),this.dom.setStyle(this.contentWrapperDiv,"height",s)}};dt.maxScrollHeightInPx=8e6;let Le=dt;class oe{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(v.singleRow(e)):this.selectionType==="column"?this.addRange(v.singleColumn(t)):(this.selectionType==="cell"||this.selectionType==="range")&&this.addRange(v.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 v(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=>oe.intersects(c,i));for(let c=r;c<=n;c++)!o.has(c)&&(!l.length||!oe.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 v(e.r1,0,e.r2,Number.MAX_SAFE_INTEGER):this.selectionType==="column"&&(t=new v(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(v.singleCell(e,t)):this.reselectPoint(e,t)?this.fireChangeEvent():this.addSelection(v.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(v.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 v(s.r1,s.c1,o-1,s.c2,s.gammaRange)),i<s.r2&&t.push(new v(i+1,s.c1,s.r2,s.c2,s.gammaRange)),s.c1<r&&t.push(new v(o,s.c1,i,r-1,s.gammaRange)),n<s.c2&&t.push(new v(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=>oe.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 v(e.r1,e.c1,s-1,e.c2)),o<e.r2&&n.push(new v(o+1,e.c1,e.r2,e.c2)),e.c1<i&&n.push(new v(s,e.c1,o,i-1)),r<e.c2&&n.push(new v(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 Os{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 _s{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 v(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 D{constructor(e,t,s){this.header=e,this.body=t,this.footer=s}}function Ve(a){return a!=null&&a.length&&F(a[0])?1:0}class Oe{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 Oe(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 Bs{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 Ne{static create(e){const t=new Ne;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"}}class Ns extends Le{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 D,this.draggingTargetColumnIndex=-1,this.contentScrollTop=0,this.removables=[],this.treeAriaInfo=new Bs,this.ariaSelectionKind="none",this.renderedSpanCells=new Set,this.adjustingRowNumberWidth=!1,this.rowNumberRemeasureScheduled=!1,this.ariaTexts=Ne.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 oe;this.getSelectionModel=()=>h}if((c=this.tableOptions)!=null&&c.getFocusModel)this.getFocusModel=this.tableOptions.getFocusModel;else{const h=new Os("cell");this.getFocusModel=()=>h}H(t.getAreaModel("body"))&&(this.tree=!0),["header","body","footer"].forEach(h=>{var d;this.colAndRowspanModels[h]=new _s(t,t.getAreaModel(h)),(d=this.colAndRowspanModels[h])==null||d.init()})}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,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.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=Oe.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 z(0,e,1,0),this.hostElement,"ge-table-border")),this.tableOptions.tableBottomBorderVisible&&this.removables.push(this.dom.addHorizontalBorder(new z(0,e,1,t-1),this.hostElement,"ge-table-border")),this.tableModel.getFixedLeftColumnCount()>0&&this.removables.push(this.dom.addVerticalBorder(new z(s,1,t,0),this.hostElement,"ge-table-body-west-vertical-border")),this.tableModel.isHeaderVisibe()&&this.removables.push(this.dom.addHorizontalBorder(new z(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())}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.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.tableModel.getContentHeightInPixel()+1>Le.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 b,x,S;const s=this.getArea(e,"west"),o=this.getArea(e,"center"),i=this.getArea(e,"east"),r=((b=this.areaHeightsOfRenderPass)==null?void 0:b[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 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 w=0;const m=(x=h.getConstantRowHeight)==null?void 0:x.call(h);if(m!==void 0&&m>0&&u<0){for(w=Math.min(d,Math.floor(-u/m));w>0&&u+w*m>0;)w--;u=u+w*m}for(let C=w;C<d;C++){const R=u,T=C===d-1,M=this.tableModel.getRowHeight(e,C);if(R+M>0){e==="body"&&this.firstVisibleRowIndex===-1&&(this.firstVisibleRowIndex=C,this.firstFullVisibleRowIndex=R<-this.pixelLimitForFullVisible?this.firstVisibleRowIndex+1:this.firstVisibleRowIndex);let I={left:n,width:l,height:M,top:R,index:C},A=this.dom.addRowDiv(o,I,C,e,"center");this.applyRowAria(A,e,h,C);const Ae=[A],Me=p;this.adjustColumnsToRowParent({areaIdent:e,sideIdent:"center",areaModel:h,geo:I,parent:A,rowIndex:C,columnIndexStart:Me,columnIndexEnd:f-g-1,verticalFixed:!1,lastRowOfModel:T}),c.left>0&&(I={left:n,width:this.areaBodyWestGeo.width,height:M,top:R,index:C},A=this.dom.addRowDiv(s,I,C,e,"west"),this.applyRowAria(A,e,h,C),Ae.push(A),this.adjustColumnsToRowParent({areaIdent:e,sideIdent:"west",areaModel:h,geo:I,parent:A,rowIndex:C,columnIndexStart:0,columnIndexEnd:Me-1,verticalFixed:!0,lastRowOfModel:T})),c.right>0&&(I={left:n,width:this.areaBodyEastGeo.width,height:M,top:R,index:C},A=this.dom.addRowDiv(i,I,C,e,"east"),this.applyRowAria(A,e,h,C),this.adjustColumnsToRowParent({areaIdent:e,sideIdent:"east",areaModel:h,geo:I,parent:A,rowIndex:C,columnIndexStart:f-g,columnIndexEnd:f-1,verticalFixed:!0,lastRowOfModel:T}));const q=e==="header"&&this.tree&&C===d-1?this.findCellDiv(Ae,this.getTreeArrowColumnIndex()):void 0;if(q!=null&&q.parentElement){const ze=(parseFloat(q.style.left)||0)+16,Ee=this.dom.applyStyle(this.dom.setAttribute(this.dom.addDiv(q.parentElement,new z(ze,20,20,8)),"data-ge-action","toggleExpandCollapseAll"),{cursor:"pointer"}),Z=this.tableOptions.treeOptions.arrowExpandCollapseAll;if(Z){const je=this.dom.domService.createText(Z.content);this.dom.domService.appendChild(Ee,je),Z.style&&this.dom.applyStyleString(Ee,Z.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+`
|
|
42
42
|
render scope: this.firstFullVisibleRowIndex <- `+this.firstFullVisibleRowIndex+`
|
|
43
43
|
render scope: this.lastVisibleRowIndex <- `+this.lastVisibleRowIndex+`
|
|
44
|
-
render scope: this.lastFullVisibleRowIndex <- `+this.lastFullVisibleRowIndex),this.pruneRowDivCache(s),this.pruneRowDivCache(o),this.pruneRowDivCache(i),this.colAndRowspanModels&&this.colAndRowspanModels[e]){const w=((I=this.colAndRowspanModels[e])==null?void 0:I.getRanges())??[];if(w.length)for(const A of w){if(A.r1>=d||A.c1>=p)continue;let R=0,M=o.child,T="center";if(A.c1<m)M=s.child,T="west";else if(f>0&&A.c1>=p-f)M=i.child,T="east";else{const k=this.areaBodyCenterGeo.width-this.tableModel.getContentWidthInPixel();R=this.snapToDevicePixel(this.scrollFactorX*k)-this.areaBodyWestGeo.width,T="center"}this.drawBigCell(A,R,t,c,M,T)}}this.updateRowGroupRoles(s,o,i)}getAriaGridInfo(){return this.ariaGridInfo||(this.ariaGridInfo=we.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&&B(s)){const l=this.treeAriaInfo.get(s,o);l&&(r.setAttribute(e,"aria-level",`${l.level}`),r.setAttribute(e,"aria-setsize",`${l.setSize}`),r.setAttribute(e,"aria-posinset",`${l.posInSet}`),l.expanded===void 0?this.dom.removeAttribute(e,"aria-expanded"):r.setAttribute(e,"aria-expanded",`${l.expanded}`))}if(this.ariaSelectionKind==="row"){const l=(n=this.getSelectionModel)==null?void 0:n.call(this);r.setAttribute(e,"aria-selected",l&&l.getSelectionCount(o,0)>0?"true":"false")}else e.hasAttribute("aria-selected")&&this.dom.removeAttribute(e,"aria-selected")}}applyCellAria(e,t,s,o,i){var u;const r=this.dom.domService,n=this.getAriaGridInfo(),l=t==="header";r.setAttribute(e,"role",l?"columnheader":"gridcell");const a=n.colIndex(i);a>0&&r.setAttribute(e,"aria-colindex",`${a}`);const c=Math.max(1,s.getRowspanAt(o,i)||1),d=Math.max(1,s.getColspanAt(o,i)||1);if(d>1&&r.setAttribute(e,"aria-colspan",`${n.colSpan(i,d)}`),c>1&&r.setAttribute(e,"aria-rowspan",`${c}`),(c>1||d>1)&&this.renderedSpanCells.add(`${t}:${o}:${i}`),l&&o+c>=n.headerRowCount&&d===1){const p=this.tableModel.getColumnDef(i);if((u=p==null?void 0:p.sortable)!=null&&u.call(p)){const f=p.sortState;r.setAttribute(e,"aria-sort",f==="asc"?"ascending":f==="desc"?"descending":"none")}}return[c,d]}updateRowGroupRoles(...e){for(const t of e){const s=t.child.firstElementChild?"rowgroup":"presentation";t.child.getAttribute("role")!==s&&this.dom.domService.setAttribute(t.child,"role",s)}}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(gt(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")??"",a=n.getAttribute("aria-expanded")==="true";this.dom.domService.setAttribute(n,"aria-label",a?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+this.getRowHeights(0,e.r1-1,o).reduce((b,x)=>b+x,0),l=this.tableModel.getColumnCount(),a=this.tableModel.getFixedRightColumnCount();let c=0;a>0&&e.c1>=l-a&&(c=l-a);const d=t+this.getColumnWidths(c,e.c1-1).reduce((b,x)=>b+x,0),u=this.getRowHeights(e.r1,e.r2,o).reduce((b,x)=>b+x,0),p=this.getColumnWidths(e.c1,e.c2).reduce((b,x)=>b+x,0);let f=!1;const m=this.getSelectionModel?this.getSelectionModel():void 0;m&&(f=m.getSelectionCount(e.r1,e.c1)>0);const g=o.areaIdent,C=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(`${g}:${e.r1}:${e.c1}`)?this.dom.setAriaHidden(C):this.applyRowAria(C,g,o,e.r1,!1),i=C,e.gammaRange?this.renderCell({areaModel:o,areaIdent:o.areaIdent,sideIdent:r,rowIndex:e.r1,columnIndex:e.c1,left:d,top:n,width:p,height:u,parent:i,cellSelected:f,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:p,height:u,parent:i,cellSelected:f,lastRowOfModel:!0,gammaRange:e.gammaRange}),o.areaIdent==="header"&&this.tableOptions.columnsResizable&&this.renderHeaderCellResizeHandle({rowIndex:e.r1,columnIndex:e.c1,cellLeft:d,cellTop:n,cellWidth:p,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:a=!1,lastRowOfModel:c=!1}){var m;let d=0;if(!a){const g=this.areaBodyCenterGeo.width-this.tableModel.getContentWidthInPixel();d=this.snapToDevicePixel(this.scrollFactorX*g)}const u=0,p=!!(e==="body"&&t);let f=d;for(let g=n;g<=l;g++){const C=f,b=this.tableModel.getColumnWidth(g);if(b>0&&C+b>0){let x=o.height;const I=s.getRowspanAt(r,g),w=s.getColspanAt(r,g);I>1&&(x=this.getRowHeights(r,r+I-1,s).reduce((M,T)=>M+T,0));let A=b;w>1&&(A=this.getColumnWidths(g,g+w-1).reduce((M,T)=>M+T,0));let R=!1;if(this.colAndRowspanModels&&this.colAndRowspanModels[e]&&(m=this.colAndRowspanModels[e])!=null&&m.isInRange(r,g)&&(R=!0),this.draggingTargetColumnIndex===g&&e!=="header"){this.renderDragTargetDiv(i,C,u,A,x);const M={left:C,top:u,width:A,height:x};this.dom.addColumnBorderDivs(this.tableOptions,i,M,e,t)}else{const M=this.renderSelectedBackgroundDiv(R,p,t,s,r,g,i,C,u,A,x);"gammaCells"in s&&s.getValueAt(r,g)&&(R=!1),R||this.renderCell({areaModel:s,areaIdent:e,sideIdent:t,rowIndex:r,columnIndex:g,left:C,top:u,width:A,height:x,parent:i,cellSelected:M,lastRowOfModel:c,gammaRange:!0}),e==="header"&&this.tableOptions.columnsResizable&&this.renderHeaderCellResizeHandle({rowIndex:r,columnIndex:g,cellLeft:C,cellTop:u,cellWidth:A,cellHeight:x,parent:i})}}if(f=f+b,f>this.areaBodyCenterGeo.width)break}this.tableOptions.verticalBorderVisible&&this.dom.addVerticalBorder(new O(f-1,1,o.height,0),i)}getTreeArrowColumnIndex(){return this.tableOptions.showCheckboxWihoutExtraColumn?0:this.tableModel.isRowCheckboxVisible()?1:0}addAndRenderCellDiv({areaModel:e,areaIdent:t,sideIdent:s,rowIndex:o,index:i,left:r,width:n,height:l,top:a,parent:c,lastRowOfModel:d}){var he;const u=t==="body"&&this.editorRenderer&&this.editorRendererRow===o&&this.editorRendererColumn===i,p=u?this.editorRenderer:e.getCellRenderer(o,i),f={left:r,width:n,height:l,top:a,index:i},m=e.getRowByIndex(o);let g="none";if(i===this.getTreeArrowColumnIndex()&&N(m)){const S=m;("hasDisplayedChildren"in e&&typeof e.hasDisplayedChildren=="function"?e.hasDisplayedChildren(S):!!((he=S.children)!=null&&he.length))?S.expanded?g="expanded":g="collapsed":g="hidden"}let b;if(t==="header"){const S=this.tableModel.getColumnDef(i);(!(S!=null&&S.sortIconVisible)||S!=null&&S.sortIconVisible())&&(b=S==null?void 0:S.sortState)}const x=e.getValueAt(o,i),I=p?"":`${x??""}`,w=e.isRowChecked(o),A=this.tableOptions.showCheckboxWihoutExtraColumn&&i===0&&w?this.getCheckboxAriaLabel(t,o):void 0,R=this.dom.addColumnDiv({parent:c,geo:f,rowIndex:o,columnIndex:i,areaIdent:t,sideIdent:s,text:I,treeArrow:g,tableOptions:this.tableOptions,checkedType:w,sortState:b,checkboxAriaLabel:A}),[M,T]=this.applyCellAria(R,t,e,o,i),k=e.getTooltipAt(o,i);k&&this.dom.setAttribute(R,"title",k);const ee=this.tableModel.getColumnDef(i);ee&&ee.classes[t]&&this.dom.addClasses(ee.classes[t],R);let ce;if(p)if(ce=p.render(R,o,i,t,e,x,this.dom.domService),u){const S=R.querySelector("input, select");S&&(this.labelControl(S,this.getColumnAriaLabel(i)),S.contains(document.activeElement)||S.focus())}else this.labelRendererControls(R,p,t,o,i);const z=e.getCustomClassesAt(o,i);if(z.length&&this.dom.addClasses(z,R),this.dom.addColumnBorderDivs(this.tableOptions,c,f,t,s),d&&this.dom.addHorizontalBorder({left:r,width:n,height:l,top:a+l},c),this.getFocusModel&&t==="body"&&!this.headerFocus){const S=this.getFocusModel();if(S!=null&&S.hasFocus(o,i))this.dom.addFocusBorderDivs(c,f,{}),this.setAriaFocusedCell(R,t,o,i);else if(S&&(M>1||T>1)){const[ue,At]=S.getFocus();ue>=o&&ue<o+M&&At>=i&&At<i+T&&this.setAriaFocusedCell(R,t,o,i)}}else t==="header"&&this.headerFocus&&this.headerFocus[0]===o&&this.headerFocus[1]===i&&(this.dom.addFocusBorderDivs(c,f,{}),this.setAriaFocusedCell(R,t,o,i));t==="header"&&this.dom.setAttribute(R,"data-ge-action","drag-column");const de=e.getCustomStyleAt(o,i);if(de)for(const S in de)this.dom.setStyle(R,S,de[S]);return[R,ce]}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 c={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,c),s&&this.renderContentOfDraggingColumn(c)}}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),l=n==null?void 0:n.getRowCount();if(l){const a=e.index??0,c=this.draggingColumn;for(let d=o;d<l&&s<i;d++){const u=s,p=n.getRowHeight(d),f={left:0,width:e.width,height:p,top:u,index:d},m=n.getValueAt(d,a),g=n.getCellRenderer(d,a),C=g?"":`${m??""}`,b={parent:c,geo:f,rowIndex:d,columnIndex:a,areaIdent:t,sideIdent:r,text:C},x=this.dom.addColumnDiv(b);let I;g&&(I=g.render(x,d,a,t,n,m,this.dom.domService),I&&this.cleanupFunctions[t].push(I));const w=n.getCustomClassesAt(d,a);w.length&&this.dom.addClasses(w,x);const A=this.tableModel.getColumnDef(a);A&&A.classes[t]&&this.dom.addClasses(A.classes[t],x),this.dom.addColumnBorderDivs(this.tableOptions,c,f,t,r);const R=n.getCustomStyleAt(d,a);if(R)for(const M in R)this.dom.setStyle(x,M,R[M]);s=s+p}}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,a,c,d){let u=!1;if(!e&&t&&o.isSelectable(i,r)&&this.getSelectionModel){const p=this.getSelectionModel();if(p){const f=p.getSelectionCount(i,r);u=f>0;for(let m=0;m<f;m++){const g=this.dom.applyStylePosistionAbsolute(this.dom.setAriaHidden(this.dom.createDivWithClass(`ge-table-${o.areaIdent}-${s}-selected-range`,n)));this.dom.setStyle(g,"left",`${l}px`),this.dom.setStyle(g,"top",`${a}px`),this.dom.setStyle(g,"width",`${c}px`),this.dom.setStyle(g,"height",`${d}px`)}}}return u}renderCell({areaModel:e,areaIdent:t,sideIdent:s,rowIndex:o,columnIndex:i,left:r,top:n,width:l,height:a,parent:c,cellSelected:d,lastRowOfModel:u}){const[p,f]=this.addAndRenderCellDiv({areaModel:e,areaIdent:t,sideIdent:s,rowIndex:o,index:i,left:r,width:l,height:a,top:n,parent:c,lastRowOfModel:u});d&&this.dom.addClass(`ge-table-${t}-${s}-selected-range`,p),t==="body"&&this.ariaSelectionKind==="cell"&&this.dom.domService.setAttribute(p,"aria-selected",d?"true":"false"),f&&this.cleanupFunctions[t].push(f)}renderHeaderCellResizeHandle({rowIndex:e,columnIndex:t,cellLeft:s,cellTop:o,cellWidth:i,cellHeight:r,parent:n}){const l=this.dom.domService,a=this.tableOptions.columnResizeHandleWidthInPx??2,c=l.createElement("div");l.setAttribute(c,"data-col-index",`${t}`),l.setAttribute(c,"data-row-index",`${e}`),l.setAttribute(c,"data-area","header"),l.setAttribute(c,"data-ge-action","resize-column"),l.addClass(c,"ge-table-column-resize-handle"),l.setAttribute(c,"aria-hidden","true"),l.setStyle(c,"display","clip"),l.setStyle(c,"position","absolute"),l.setStyle(c,"cursor","col-resize"),l.setStyle(c,"left",`${s+i-a}px`),l.setStyle(c,"top",`${o}px`),l.setStyle(c,"width",`${a}px`),l.setStyle(c,"height",`${r}px`),l.appendChild(n,c)}}class Fe{constructor(e,t){this.columnIndex=e,this.sortState=t}}const wt=()=>!0,Ct=()=>!1,le=new WeakSet,De=new WeakMap;function Is(h,e){e?le.delete(h):le.add(h),Ut(h)}function Je(h,e){e?De.set(h,e):De.delete(h),Ut(h)}function Et(h){var e;return De.has(h)?!le.has(h):!le.has(h)&&((e=h.isVisible)==null?void 0:e.call(h))!==!1}function Ut(h){const e=De.get(h),t=!le.has(h);e?h.isVisible=()=>!le.has(h)&&e():h.isVisible=t?wt:Ct}const Kt=new WeakSet;function ks(h){return Kt.add(h),h}function Fs(h){return typeof h=="function"&&Kt.has(h)}class Yt{constructor(e,t){this.state=e,this.changedParts=t}}const j=Object.freeze(["headerGroups","columns","tree","sort","checked","selection","scroll","custom"]),Ds=["sortingState","scrollState","collapsedExpandedState"];function qe(h,e){try{const t=h.getItem(e);return t?JSON.parse(t):void 0}catch{return}}function Xt(h,e,t){const s={version:1};let o=!1;const i=qe(h,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 a=t[l.columnIndex],c=l.sortState;return a?{property:a,sortState:c}:{columnIndex:l.columnIndex,sortState:c}}));const r=qe(h,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=qe(h,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 st(h,e){for(const t of Ds)try{h.removeItem(e+t)}catch{}}const Ps={headerGroups:"autoRestoreHeaderGroupState",columns:"autoRestoreColumnLayout",tree:"autoRestoreCollapsedExpandedState",sort:"autoRestoreSortingState",checked:"autoRestoreCheckedState",selection:"autoRestoreSelectedState",scroll:"autoRestoreScrollPosition",custom:"autoRestoreCustomState"},q=h=>h==="checked"?"checkedRowIds":h,$=Number.MAX_SAFE_INTEGER,W=class W{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[q(s)]!==void 0,t=this.getState(j.filter(s=>s!=="headerGroups"&&s!=="scroll"&&s!=="custom"&&(!W.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(j.filter(e=>!W.EXPENSIVE.includes(e)))))}getState(e=j){const t={version:1};for(const s of e)this.computePart(s,t);return t}applyState(e,t=j){if(!e||typeof e!="object")return;const s=r=>t.includes(r)&&e[q(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+W.STORAGE_SUFFIX),st(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=j.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=q(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 Yt(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?j.filter(t=>!!e[Ps[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+W.STORAGE_SUFFIX);if(n){const l=JSON.parse(n);l&&typeof l=="object"&&l.version===1&&(i=l,this.lastPersisted=n)}}catch{}i||(i=Xt(o,s,this.columnDefs().map(n=>n.property)));const r={...e};if(i)for(const n of t){const l=q(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=q(n);e[l]!==void 0&&(i[l]=e[l])}const r=JSON.stringify(i);if(r!==this.lastPersisted)try{o.setItem(s+W.STORAGE_SUFFIX,r),this.lastPersisted=r,this.legacyRemoved||(st(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 j)q(t)in e&&this.lastReported.set(t,this.partJson(e,t))}partJson(e,t){const s=e[q(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=Et(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?$: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(!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}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,a;const s={},o=Math.min(e.r1,e.r2),i=Math.max(e.r1,e.r2);if(!(o<=0&&i>=$)){const c=this.idAt(o,t);if(c===void 0)return;if(s.fromRowId=c,i<$){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>=$)){const c=this.columnDefs(),d=(l=c[r])==null?void 0:l.property;if(!d)return;if(s.fromProperty=d,n<$){const u=(a=c[n])==null?void 0:a.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 p=u>0?n.lastIndexOf(r[u-1]):-1;n.splice(p+1,0,d)});for(let d=0;d<n.length;d++){const p=s.getColumnDefs().map(f=>f.property).indexOf(n[d],d);p>d&&s.changeColumnOrder(p,d)}let a=!1;return this.columnDefs().forEach((d,u)=>{var f;const p=i.get(d.property);if(p){if(typeof p.visible=="boolean"&&Et(d)!==p.visible&&((f=s.setColumnVisible)==null||f.call(s,u,p.visible)),typeof p.width=="number"&&p.width>=0)s.setColumnWidth(u,p.width);else if(t){const m=this.initialWidths.get(d);m&&(m.value!==d.width.value||m.unit!==d.width.unit)&&(m.unit==="px"?s.setColumnWidth(u,m.value):a=!0,d.width=m)}}}),a}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 Fe(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 a=this.idOfRow(l,-1,!1);a!==void 0&&o.has(a)&&!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 a=this.idOfRow(n,i.getAllRows?-1:l,!1);return a!==void 0&&o.has(a)}))}applySelection(e){const t=this.scope.selectionModel();if(!t||!e||!Array.isArray(e.ranges))return;const o=[...e.ranges,...e.negativeRanges??[]].some(a=>a&&(a.fromRowId!==void 0||a.toRowId!==void 0))?this.rowIndexMap():new Map,i=this.columnDefs(),r=a=>{if(!a)return;let c=0,d=$,u=0,p=$;if(a.fromRowId!==void 0||a.toRowId!==void 0){const f=o.get(a.fromRowId??a.toRowId),m=a.toRowId===void 0?$:o.get(a.toRowId);if(f===void 0||m===void 0)return;c=Math.min(f,m),d=Math.max(f,m)}if(a.fromProperty!==void 0||a.toProperty!==void 0){const f=i.findIndex(g=>g.property===(a.fromProperty??a.toProperty)),m=a.toProperty===void 0?$:i.findIndex(g=>g.property===a.toProperty);if(f<0||m<0)return;u=Math.min(f,m),p=Math.max(f,m)}return new v(c,u,d,p)},n=a=>(a??[]).map(r).filter(c=>!!c),l={ranges:n(e.ranges),negativeRanges:n(e.negativeRanges),allSelected:!!e.allSelected};t.restoreSnapshot?t.restoreSnapshot(l):(t.clear(),l.ranges.forEach(a=>t.addSelection(a)))}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&&!Fs(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=N(e)?e.data:e;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)}};W.STORAGE_SUFFIX="tableState",W.EXPENSIVE=["tree","checked","selection"];let Pe=W;class Jt{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=ve(s),n=Number(o),l=Number(i);this.tableScope.updateModelValueAfterEdit(r,n,l,t.value)}}}}class qt{constructor(e=-1,t=-1){this.rowIndex=e,this.columnIndex=t}}class Ye{constructor(e){this.cells=e}static createSingle(e,t){return new Ye([new qt(e,t)])}}class Zt{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 Ce{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,a;!!((n=t.originalEvent)!=null&&n.ctrlKey||(l=t.originalEvent)!=null&&l.metaKey)&&Ce.hasSnapshots(s)?(this.dragSnapshot=this.dragSnapshot??s.createSnapshot(),s.restoreSnapshot(this.dragSnapshot)):s.clear(),s.addSelection(this.createRangeByEvents(e,t));const r=(a=this.getFocusModel)==null?void 0:a.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!=="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 c,d,u,p;i.hasFocus(e.rowIndex,e.columnIndex)||i.setFocus(e.rowIndex,e.columnIndex);const r=!!((c=e.originalEvent)!=null&&c.shiftKey),n=!!((d=e.originalEvent)!=null&&d.ctrlKey||(u=e.originalEvent)!=null&&u.metaKey),l=!!((p=e.originalEvent)!=null&&p.altKey);if(r&&this.previousEvt){if(this.anchorRanges.length&&Ce.hasSnapshots(o)){const m=o.createSnapshot();o.restoreSnapshot({...m,ranges:m.ranges.filter(g=>!this.anchorRanges.includes(g))})}const f=this.createRangeByEvents(e,this.previousEvt);o.addSelection(f),this.anchorRanges=[f],this.tableScope.onSelectionChanged(o);return}const a=o.getRanges().slice();n&&l?o.removeSelection(v.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(f=>!a.includes(f)),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 o.togglePoint(r,n),this.tableScope.repaint(),!0}}}return!1}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 v.create({rowIndex1:s,columnIndex1:i,rowIndex2:o,columnIndex2:r})}}class Qt{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","meta+c":"COPY_2_CLIPBOARD","ctrl+c":"COPY_2_CLIPBOARD"}}}class es{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","meta+c":"COPY_2_CLIPBOARD","ctrl+c":"COPY_2_CLIPBOARD"}}}const Ls={arrowup:"up",arrowdown:"down",arrowleft:"left",arrowright:"right"};function xt(h){return h.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=>Ls[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 ts(h){let e=h.key.toLowerCase();if(e===" "&&(e="space"),e==="arrowleft"&&(e="left"),e==="arrowright"&&(e="right"),e==="arrowup"&&(e="up"),e==="arrowdown"&&(e="down"),e==="delete"&&h.code==="Delete"&&(e="delete"),e==="backspace"&&(e="backspace"),e==="escape"&&(e="esc"),e==="return"&&(e="enter"),h.code.startsWith("Numpad")){const s=h.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}h.code.match(/^F\d+$/)&&(e=h.code.toLowerCase()),h.code.match(/^Digit\d+$/)&&(e=h.code.replace(/Digit/g,""));let t="";return h.ctrlKey&&(t+=" ctrl"),h.altKey&&(t+=t+" alt"),h.shiftKey&&(t+=t+" shift"),h.metaKey&&(t+=t+" cmd"),xt(t+" "+e)}class ss{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 es().get()):Object.assign(this.shortcutActionIdMapping,new Qt().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=ts(e);this.isDebug()&&console.debug("ShortcutService shortcut :",t);for(const s in this.shortcutActionIdMapping)if(xt(s)===t)return this.isDebug()&&console.debug("ShortcutService action :",this.shortcutActionIdMapping[s]),this.shortcutActionIdMapping[s]}getShortcutActionMapping(){return this.shortcutActionIdMapping}}class Le{onCheckboxChanged(e){}onContextmenu(e){}onModelChanged(e){}onMouseClicked(e){}onMouseDragging(e){}onMouseDraggingEnd(e){}onMouseMoved(e){}onScroll(e){}onSelectionChanged(e){}onFocusChanged(e){}onStateChanged(e){}}class os{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 is{render(e,t,s,o,i,r,n){if(i.isEditable(t,s)){n.addClass(e,"ge-table-row-input-div");const l=i.getValueAt(t,s);e.innerHTML=`
|
|
44
|
+
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 R of C){if(R.r1>=d||R.c1>=f)continue;let T=0,M=o.child,I="center";if(R.c1<p)M=s.child,I="west";else if(g>0&&R.c1>=f-g)M=i.child,I="east";else{const A=this.areaBodyCenterGeo.width-this.tableModel.getContentWidthInPixel();T=this.snapToDevicePixel(this.scrollFactorX*A)-this.areaBodyWestGeo.width,I="center"}this.drawBigCell(R,T,t,h,M,I)}}this.updateRowGroupRoles(s,o,i)}getAriaGridInfo(){return this.ariaGridInfo||(this.ariaGridInfo=Oe.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&&H(s)){const l=this.treeAriaInfo.get(s,o);l&&(r.setAttribute(e,"aria-level",`${l.level}`),r.setAttribute(e,"aria-setsize",`${l.setSize}`),r.setAttribute(e,"aria-posinset",`${l.posInSet}`),l.expanded===void 0?this.dom.removeAttribute(e,"aria-expanded"):r.setAttribute(e,"aria-expanded",`${l.expanded}`))}if(this.ariaSelectionKind==="row"){const l=(n=this.getSelectionModel)==null?void 0:n.call(this);r.setAttribute(e,"aria-selected",l&&l.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"&&F(this.tableModel.getColumnDef(i))||t==="footer"&&ks(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 w=p.sortState;r.setAttribute(e,"aria-sort",w==="asc"?"ascending":w==="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(Yt(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+this.getRowHeights(0,e.r1-1,o).reduce((b,x)=>b+x,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((b,x)=>b+x,0),u=this.getRowHeights(e.r1,e.r2,o).reduce((b,x)=>b+x,0),f=this.getColumnWidths(e.c1,e.c2).reduce((b,x)=>b+x,0);let g=!1;const p=this.getSelectionModel?this.getSelectionModel():void 0;p&&(g=p.getSelectionCount(e.r1,e.c1)>0);const w=o.areaIdent,m=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(`${w}:${e.r1}:${e.c1}`)?this.dom.setAriaHidden(m):this.applyRowAria(m,w,o,e.r1,!1),i=m,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 w=this.areaBodyCenterGeo.width-this.tableModel.getContentWidthInPixel();d=this.snapToDevicePixel(this.scrollFactorX*w)}const u=0,f=!!(e==="body"&&t);let g=d;for(let w=n;w<=l;w++){const m=g,b=this.tableModel.getColumnWidth(w);if(b>0&&m+b>0){let x=o.height;const S=s.getRowspanAt(r,w),C=s.getColspanAt(r,w);S>1&&(x=this.getRowHeights(r,r+S-1,s).reduce((M,I)=>M+I,0));let R=b;C>1&&(R=this.getColumnWidths(w,w+C-1).reduce((M,I)=>M+I,0));let T=!1;if(this.colAndRowspanModels&&this.colAndRowspanModels[e]&&(p=this.colAndRowspanModels[e])!=null&&p.isInRange(r,w)&&(T=!0),this.draggingTargetColumnIndex===w&&e!=="header"){this.renderDragTargetDiv(i,m,u,R,x);const M={left:m,top:u,width:R,height:x};this.dom.addColumnBorderDivs(this.tableOptions,i,M,e,t)}else{const M=this.renderSelectedBackgroundDiv(T,f,t,s,r,w,i,m,u,R,x);"gammaCells"in s&&s.getValueAt(r,w)&&(T=!1),T||this.renderCell({areaModel:s,areaIdent:e,sideIdent:t,rowIndex:r,columnIndex:w,left:m,top:u,width:R,height:x,parent:i,cellSelected:M,lastRowOfModel:h,gammaRange:!0}),e==="header"&&this.tableOptions.columnsResizable&&this.isColumnResizable(w)&&this.renderHeaderCellResizeHandle({rowIndex:r,columnIndex:w,cellLeft:m,cellTop:u,cellWidth:R,cellHeight:x,parent:i})}}if(g=g+b,g>this.areaBodyCenterGeo.width)break}this.tableOptions.verticalBorderVisible&&this.dom.addVerticalBorder(new z(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 Ve((t=(e=this.tableModel).getColumnDefs)==null?void 0:t.call(e))}isColumnResizable(e){return!F(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 je;const u=t==="body"&&this.editorRenderer&&this.editorRendererRow===o&&this.editorRendererColumn===i,f=this.tableModel.getColumnDef(i),g=F(f),p=u?this.editorRenderer:(g&&t==="body"?f.rendererMap.body:void 0)??e.getCellRenderer(o,i),w={left:r,width:n,height:l,top:c,index:i},m=e.getRowByIndex(o);let b="none";if(i===this.getTreeArrowColumnIndex()&&$(m)){const P=m;("hasDisplayedChildren"in e&&typeof e.hasDisplayedChildren=="function"?e.hasDisplayedChildren(P):!!((je=P.children)!=null&&je.length))?P.expanded?b="expanded":b="collapsed":b="hidden"}let S;t==="header"&&(!(f!=null&&f.sortIconVisible)||f!=null&&f.sortIconVisible())&&(S=f==null?void 0:f.sortState);const C=e.getValueAt(o,i),R=p||g&&t==="footer"?"":`${C??""}`,T=e.isRowChecked(o),M=this.getFirstDataColumnIndex(),I=this.tableOptions.showCheckboxWihoutExtraColumn&&i===M&&T?this.getCheckboxAriaLabel(t,o):void 0,A=this.dom.addColumnDiv({parent:h,geo:w,rowIndex:o,columnIndex:i,areaIdent:t,sideIdent:s,text:R,treeArrow:b,tableOptions:this.tableOptions,checkedType:T,sortState:S,checkboxAriaLabel:I,firstDataColumnIndex:M}),[Ae,Me]=this.applyCellAria(A,t,e,o,i),q=e.getTooltipAt(o,i);q&&this.dom.setAttribute(A,"title",q),f&&f.classes[t]&&this.dom.addClasses(f.classes[t],A);let ze;if(p)if(ze=p.render(A,o,i,t,e,C,this.dom.domService),u){const P=A.querySelector("input, select");P&&(this.labelControl(P,this.getColumnAriaLabel(i)),P.contains(document.activeElement)||P.focus())}else this.labelRendererControls(A,p,t,o,i);const Ee=e.getCustomClassesAt(o,i);if(Ee.length&&this.dom.addClasses(Ee,A),this.dom.addColumnBorderDivs(this.tableOptions,h,w,t,s),d&&this.dom.addHorizontalBorder({left:r,width:n,height:l,top:c+l},h),this.getFocusModel&&t==="body"&&!this.headerFocus){const P=this.getFocusModel();if(P!=null&&P.hasFocus(o,i))this.dom.addFocusBorderDivs(h,w,{}),this.setAriaFocusedCell(A,t,o,i);else if(P&&(Ae>1||Me>1)){const[At,us]=P.getFocus();At>=o&&At<o+Ae&&us>=i&&us<i+Me&&this.setAriaFocusedCell(A,t,o,i)}}else t==="header"&&this.headerFocus&&this.headerFocus[0]===o&&this.headerFocus[1]===i&&(this.dom.addFocusBorderDivs(h,w,{}),this.setAriaFocusedCell(A,t,o,i));t==="header"&&!g&&this.dom.setAttribute(A,"data-ge-action","drag-column");const Z=e.getCustomStyleAt(o,i);if(Z)for(const P in Z)this.dom.setStyle(A,P,Z[P]);return[A,ze]}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),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),w=n.getCellRenderer(d,c),m=w?"":`${p??""}`,b={parent:h,geo:g,rowIndex:d,columnIndex:c,areaIdent:t,sideIdent:r,text:m},x=this.dom.addColumnDiv(b);let S;w&&(S=w.render(x,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,x);const R=this.tableModel.getColumnDef(c);R&&R.classes[t]&&this.dom.addClasses(R.classes[t],x),this.dom.addColumnBorderDivs(this.tableOptions,h,g,t,r);const T=n.getCustomStyleAt(d,c);if(T)for(const M in T)this.dom.setStyle(x,M,T[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,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 w=this.dom.applyStylePosistionAbsolute(this.dom.setAriaHidden(this.dom.createDivWithClass(`ge-table-${o.areaIdent}-${s}-selected-range`,n)));this.dom.setStyle(w,"left",`${l}px`),this.dom.setStyle(w,"top",`${c}px`),this.dom.setStyle(w,"width",`${h}px`),this.dom.setStyle(w,"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"),l.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 Qe{constructor(e,t){this.columnIndex=e,this.sortState=t}}const Re=()=>!0,os=()=>!1,Ce=new WeakSet,et=new WeakMap;function Gs(a,e){e?Ce.delete(a):Ce.add(a),Hs(a)}function Mt(a,e){e?et.set(a,e):et.delete(a),Hs(a)}function Dt(a){var e;return et.has(a)?!Ce.has(a):!Ce.has(a)&&((e=a.isVisible)==null?void 0:e.call(a))!==!1}function Hs(a){const e=et.get(a),t=!Ce.has(a);e?a.isVisible=()=>!Ce.has(a)&&e():a.isVisible=t?Re:os}const $s=new WeakSet;function si(a){return $s.add(a),a}function oi(a){return typeof a=="function"&&$s.has(a)}class Ws{constructor(e,t){this.state=e,this.changedParts=t}}const Q=Object.freeze(["headerGroups","columns","tree","sort","checked","selection","scroll","custom"]),ii=["sortingState","scrollState","collapsedExpandedState"];function Et(a,e){try{const t=a.getItem(e);return t?JSON.parse(t):void 0}catch{return}}function zs(a,e,t){const s={version:1};let o=!1;const i=Et(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=Et(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=Et(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 Pt(a,e){for(const t of ii)try{a.removeItem(e+t)}catch{}}const ri={headerGroups:"autoRestoreHeaderGroupState",columns:"autoRestoreColumnLayout",tree:"autoRestoreCollapsedExpandedState",sort:"autoRestoreSortingState",checked:"autoRestoreCheckedState",selection:"autoRestoreSelectedState",scroll:"autoRestoreScrollPosition",custom:"autoRestoreCustomState"},re=a=>a==="checked"?"checkedRowIds":a,U=Number.MAX_SAFE_INTEGER,K=class K{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[re(s)]!==void 0,t=this.getState(Q.filter(s=>s!=="headerGroups"&&s!=="scroll"&&s!=="custom"&&(!K.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(Q.filter(e=>!K.EXPENSIVE.includes(e)))))}getState(e=Q){const t={version:1};for(const s of e)this.computePart(s,t);return t}applyState(e,t=Q){if(!e||typeof e!="object")return;const s=r=>t.includes(r)&&e[re(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+K.STORAGE_SUFFIX),Pt(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=Q.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=re(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 Ws(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?Q.filter(t=>!!e[ri[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+K.STORAGE_SUFFIX);if(n){const l=JSON.parse(n);l&&typeof l=="object"&&l.version===1&&(i=l,this.lastPersisted=n)}}catch{}i||(i=zs(o,s,this.columnDefs().map(n=>n.property)));const r={...e};if(i)for(const n of t){const l=re(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=re(n);e[l]!==void 0&&(i[l]=e[l])}const r=JSON.stringify(i);if(r!==this.lastPersisted)try{o.setItem(s+K.STORAGE_SUFFIX,r),this.lastPersisted=r,this.legacyRemoved||(Pt(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 Q)re(t)in e&&this.lastReported.set(t,this.partJson(e,t))}partJson(e,t){const s=e[re(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=Dt(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?U: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(!H(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 l,c;const s={},o=Math.min(e.r1,e.r2),i=Math.max(e.r1,e.r2);if(!(o<=0&&i>=U)){const h=this.idAt(o,t);if(h===void 0)return;if(s.fromRowId=h,i<U){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>=U)){const h=this.columnDefs(),d=(l=h[r])==null?void 0:l.property;if(!d)return;if(s.fromProperty=d,n<U){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"&&Dt(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(!H(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 Qe(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(H(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=U,u=0,f=U;if(c.fromRowId!==void 0||c.toRowId!==void 0){const g=o.get(c.fromRowId??c.toRowId),p=c.toRowId===void 0?U: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(w=>w.property===(c.fromProperty??c.toProperty)),p=c.toProperty===void 0?U:i.findIndex(w=>w.property===c.toProperty);if(g<0||p<0)return;u=Math.min(g,p),f=Math.max(g,p)}return new v(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(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&&!oi(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=$(e)?e.data:e;if(L(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)}};K.STORAGE_SUFFIX="tableState",K.EXPENSIVE=["tree","checked","selection"];let tt=K;class js{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=Be(s),n=Number(o),l=Number(i);this.tableScope.updateModelValueAfterEdit(r,n,l,t.value)}}}}class Us{constructor(e=-1,t=-1){this.rowIndex=e,this.columnIndex=t}}class xt{constructor(e){this.cells=e}static createSingle(e,t){return new xt([new Us(e,t)])}}class Ks{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 ce{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)&&ce.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)&&ce.isRangeSelection(o);if(r&&this.previousEvt){if(this.anchorRanges.length&&ce.hasSnapshots(o)){const w=o.createSnapshot();o.restoreSnapshot({...w,ranges:w.ranges.filter(m=>!this.anchorRanges.includes(m))})}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(v.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)&&ce.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&&F((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 v(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 v.create({rowIndex1:s,columnIndex1:i,rowIndex2:o,columnIndex2:r})}}class Ys{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","meta+c":"COPY_2_CLIPBOARD","ctrl+c":"COPY_2_CLIPBOARD"}}}class Xs{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","meta+c":"COPY_2_CLIPBOARD","ctrl+c":"COPY_2_CLIPBOARD"}}}const ni={arrowup:"up",arrowdown:"down",arrowleft:"left",arrowright:"right"};function is(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=>ni[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 Js(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"),is(t+" "+e)}class qs{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 Xs().get()):Object.assign(this.shortcutActionIdMapping,new Ys().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=Js(e);this.isDebug()&&console.debug("ShortcutService shortcut :",t);for(const s in this.shortcutActionIdMapping)if(is(s)===t)return this.isDebug()&&console.debug("ShortcutService action :",this.shortcutActionIdMapping[s]),this.shortcutActionIdMapping[s]}getShortcutActionMapping(){return this.shortcutActionIdMapping}}class st{onCheckboxChanged(e){}onContextmenu(e){}onModelChanged(e){}onMouseClicked(e){}onMouseDragging(e){}onMouseDraggingEnd(e){}onMouseMoved(e){}onScroll(e){}onSelectionChanged(e){}onFocusChanged(e){}onStateChanged(e){}}class Zs{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 Qs{render(e,t,s,o,i,r,n){if(i.isEditable(t,s)){n.addClass(e,"ge-table-row-input-div");const l=i.getValueAt(t,s);e.innerHTML=`
|
|
45
45
|
<input
|
|
46
46
|
type="text"
|
|
47
47
|
value="${E(l)}"
|
|
@@ -53,24 +53,24 @@ render scope: this.lastFullVisibleRowIndex <- `+this.lastFullVisibleRowIndex),th
|
|
|
53
53
|
data-col-index="${s}"
|
|
54
54
|
data-input-type="text"
|
|
55
55
|
style="width:calc(100% - 8px);height:100%;border:0;padding:0 0 0 8px;"
|
|
56
|
-
class="ge-table-cell-editor-input">`}}}class
|
|
57
|
-
`;let
|
|
56
|
+
class="ge-table-cell-editor-input">`}}}class St{constructor(e=new j("❯","",["gt-table-icon-expanded"]),t=new j("❯","transform: rotate(180deg) translate(-100%, -100%); transform-origin: 0 0;",["ge-table-icon-collapsed"])){this.iconExpanded=e,this.iconCollapsed=t}}class xe{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 qt,this.headerGroupOptions=new St,this.showCheckboxWihoutExtraColumn=!1,this.externalFilterFunction=void 0,this.sortedOptions=new Zt,this.sortOrder=["asc","desc"],this.shortcutActionsDisabled=!1,this.resizeEventDebounceDelay=500,this.getEditRenderer=(e,t)=>new Qs,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}}function Ge(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}}const li=null;function Se(a){return a==null||a===""}const ps=new Intl.Collator("en",{numeric:!0});function ms(a){return typeof a=="number"||typeof a=="bigint"?0:a instanceof Date?1:typeof a=="boolean"?2:typeof a=="string"?3:4}function bs(a,e){const t=ms(a),s=ms(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 ps.compare(a,e);default:return ps.compare(String(a),String(e))}}function Ue(a){return(e,t)=>{const s=Se(e),o=Se(t);return s||o?s===o?0:s?1:-1:a(e,t)}}function ai(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=Ue(bs):o==="desc"?i=Ue((r,n)=>bs(n,r)):typeof o=="function"?i=Ue(o):i=Ue(()=>0),{name:t.name??s??`level${e}`,label:t.label,path:s,getKey:Ge(t.value),format:t.format,compare:i}}function J(a){return(a??[]).map((e,t)=>ai(e,t))}const ws=new WeakMap;let ci=1;function he(a){if(Se(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=ws.get(a);return e===void 0&&(e=ci++,ws.set(a,e)),"o:"+e}default:return"u:"+String(a)}}function hi(a,e){return Se(a)?e:a instanceof Date?Number.isNaN(a.getTime())?"Invalid Date":a.toLocaleDateString("en-US"):String(a)}function eo(a,e){return a.map(t=>t.label??(t.path!==void 0?e(t.path):void 0)??t.name)}function to(a,e){const t=eo(J(a),s=>{var o;return(o=e.find(i=>i.property===s&&!ge(i)))==null?void 0:o.headerLabel});return t.length?t.join(" › "):"Group"}function Ft(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?[]:J(s).map(h=>h.path).filter(h=>h!==void 0&&t.some(d=>d.property===h&&!ge(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)||!di(t,h)||((c=a.setColumnVisible)==null||c.call(a,h,!1),i.push(h));e.hiddenColumnProperties=i;const r=t.findIndex(ge),n=t[r];if(n&&ge(n)&&n.autoHeaderLabel){const h=to(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 di(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 Y=class Y{createContent(e,t,s){return new Promise((o,i)=>{var r;if(t!=null&&t.hasSelection()){const n=t.isAllSelected()?new v(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>Y.maxCopyCells)return i(`Cannot copy ${l} cells – more than CopyService.maxCopyCells (${Y.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=F(f)?f:void 0;if(g&&!g.options.exported)continue;const p=t.isSelected(h,u),w=e.getBodyModel(),m=p?g?g.getRowNumberText(h,w):w.getTextValueAt(h,u):"";d.push(m)}c.push(d.join(Y.columnSeparatorChar))}return o(c.join(Y.rowSeparatorChar))}}if(s){const[n,l]=s.getFocus(),c=e.getColumnDef(l),h=F(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 v(s.r1,s.c1,s.r2,s.c2);return t}};Y.maxCopyCells=1e6,Y.columnSeparatorChar=" ",Y.rowSeparatorChar=`
|
|
57
|
+
`;let pe=Y;class so{constructor(e,t=500){this.tableScope=e,this.debounceDelay=t,this.disconnected=!1,this.resizeObserver=new ResizeObserver(xs(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)}}let Ke;function ys(a){if(!Ke){Ke=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;Ke[t]=s>>>0}}let e=4294967295;for(let t=0;t<a.length;t++)e=Ke[(e^a[t])&255]^e>>>8;return(e^4294967295)>>>0}async function ui(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 oo{downloadExcel(e,t="file.xlsx",s=""){if(!Array.isArray(e)||e.some(o=>!Array.isArray(o)))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).then(o=>{const i=URL.createObjectURL(o),r=document.createElement("a");r.href=i,r.download=t,document.body.appendChild(r),r.click(),document.body.removeChild(r),setTimeout(()=>URL.revokeObjectURL(i),1e3)}).catch(o=>{throw console.error("Error generating Excel file:",o),new Error("Failed to download Excel file.")})}async createExcelBlob(e,t=""){const s=await this.createZipCompressed(this.generateMap(e,t));return new Blob([s],{type:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"})}generateMap(e,t=""){const s=`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
|
58
58
|
<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>`,o=`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
|
59
59
|
<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>`,i=`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
|
60
60
|
<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>`,r=`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
|
61
61
|
<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>`,n=`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
|
62
62
|
<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>`,l=`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
|
63
|
-
<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>`,
|
|
64
|
-
<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>`,
|
|
63
|
+
<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>`,c=`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
|
64
|
+
<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>`,h=`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
|
65
65
|
<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>`,d=`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
|
66
|
-
<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>`,u=new Map;return u.set("_rels/.rels",s),u.set("docProps/app.xml",o),u.set("docProps/core.xml",i),u.set("xl/_rels/workbook.xml.rels",r),u.set("xl/theme/theme1.xml",n),u.set("xl/worksheets/sheet1.xml",this.getX1WorksheetsSheet1Xml(e)),u.set("xl/sharedStrings.xml",l),u.set("xl/styles.xml",
|
|
66
|
+
<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>`,u=new Map;return u.set("_rels/.rels",s),u.set("docProps/app.xml",o),u.set("docProps/core.xml",i),u.set("xl/_rels/workbook.xml.rels",r),u.set("xl/theme/theme1.xml",n),u.set("xl/worksheets/sheet1.xml",this.getX1WorksheetsSheet1Xml(e)),u.set("xl/sharedStrings.xml",l),u.set("xl/styles.xml",c),u.set("xl/workbook.xml",h),u.set("[Content_Types].xml",d),u}getX1WorksheetsSheet1Xml(e){const t=e.reduce((i,r)=>Math.max(i,r.length),1),s=e.length?`A1:${this.getCellAddress(e.length-1,t-1)}`:"A1",o=[];o.push(`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
|
67
67
|
<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}">
|
|
68
68
|
<dimension ref="${s}"/>
|
|
69
69
|
<sheetViews>
|
|
70
70
|
<sheetView tabSelected="1" workbookViewId="0"/></sheetViews>
|
|
71
71
|
<sheetFormatPr baseColWidth="10" defaultRowHeight="16" x14ac:dyDescent="0.2"/>
|
|
72
|
-
<sheetData>`);for(let i=0;i<e.length;i++){const r=e[i];o.push(`<row r="${i+1}" spans="1:${t}" x14ac:dyDescent="0.2">`);for(let n=0;n<r.length;n++){const l=r[n],
|
|
73
|
-
`)}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:Tt(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 _s(i),n=!!r&&r.length<i.length;t.push({path:new TextEncoder().encode(s),data:n?r:i,size:i.length,crc:Tt(i),method:n?8:0})}return this.assembleZip(t)}assembleZip(e){const t=[],s=[];let o=0;for(const c of e){const d=new Uint8Array(30+c.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,c.method,!0),u.setUint16(10,0,!0),u.setUint16(12,33,!0),u.setUint32(14,c.crc,!0),u.setUint32(18,c.data.length,!0),u.setUint32(22,c.size,!0),u.setUint16(26,c.path.length,!0),u.setUint16(28,0,!0),d.set(c.path,30),t.push(d,c.data),s.push(o),o+=d.length+c.data.length}const i=o;e.forEach((c,d)=>{const u=new Uint8Array(46+c.path.length),p=new DataView(u.buffer);u.set([80,75,1,2],0),p.setUint16(4,20,!0),p.setUint16(6,20,!0),p.setUint16(8,0,!0),p.setUint16(10,c.method,!0),p.setUint16(12,0,!0),p.setUint16(14,33,!0),p.setUint32(16,c.crc,!0),p.setUint32(20,c.data.length,!0),p.setUint32(24,c.size,!0),p.setUint16(28,c.path.length,!0),p.setUint16(30,0,!0),p.setUint16(32,0,!0),p.setUint16(34,0,!0),p.setUint16(36,0,!0),p.setUint32(38,0,!0),p.setUint32(42,s[d],!0),u.set(c.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((c,d)=>c+d.length,0));let a=0;for(const c of t)l.set(c,a),a+=c.length;return l}}const Ne=class Ne{constructor(e,t,s){this.document=e,this.id=t,this.domService=s}announce(e,t=Ne.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}};Ne.defaultDelayInMs=150;let _e=Ne;const Z=class Z extends jt{constructor(e,t,s,o,i,r=new oe,n=new ns){var d;super(e,t,new Ie(s),o),this.eventListener=i,this.copyService=r,this.excelService=n,this.licenseManager=Q.getInstance(),this.listenerAbortController=new AbortController,this.destroyed=!1,this.selectionService=new Ce(this),this.api=new Nt(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 _e(e.ownerDocument,this.ariaIds.liveRegion(),s),i||(this.eventListener=new Le),this.stateService=new Pe(this),this.mouseHandler=new Bt(this),this.inputHandler=new Jt(this),this.resizeHandler=new rs(this,o.resizeEventDebounceDelay),this.shortcutService=new ss(this),this.shortcutService.addListener(this.selectionService);const l=this.getSelectionModel?this.getSelectionModel():void 0;l&&l.addEventSelectionChangedListener(this);const a=this.getFocusModel?this.getFocusModel():void 0;a&&a.addEventFocusChangedListener(this);const c=this.listenerAbortController.signal;(d=e.ownerDocument)==null||d.addEventListener("keydown",u=>{u.key==="Tab"&&(this.lastTabKeyTime=Date.now())},{capture:!0,signal:c}),e.addEventListener("focus",()=>this.onHostKeyboardFocus(),{signal:c}),this.scrollViewport.addEventListener("focus",()=>this.hostElement.focus({preventScroll:!0}),{signal:c})}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 ae,o=new Le,i=new os,r=new oe){return new Z(e,t,i,s,o,r)}onActionTriggered(e){if(!this.headerFocus&&this.tableOverlay.isBlocking()&&Z.actionsBlockedWhileLoading.includes(e))return!0;if(this.headerFocus){const s=this.onHeaderAction(e);if(s!==void 0)return s}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 s=this.getFocusModel();if(s){const[o,i]=s.getFocus();this.tableModel.getBodyModel().isEditable(o,i)&&(this.clearSelection(),this.initRenderEditor(o,i))}return!0}if(e==="COPY_2_CLIPBOARD"){const s=this.getSelectionModel?this.getSelectionModel():void 0,o=this.getFocusModel?this.getFocusModel():void 0;this.copyService.createContent(this.tableModel,s,o).then(i=>this.copyService.copyContent(i).then(()=>this.announceCopied(i))).catch(i=>console.warn("GuiExpert Table – copy to clipboard failed:",i))}return!1}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 p,f;return((f=(p=this.tableModel.getColumnDef(u))==null?void 0:p.isVisible)==null?void 0:f.call(p))!==!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))),a=Math.max(0,Math.min(...r.map(u=>u.c1))),c=Math.min(s-1,Math.max(...r.map(u=>u.c2)));if((l-n+1)*(c-a+1)>oe.maxCopyCells)return 0;let d=0;for(let u=n;u<=l;u++)for(let p=a;p<=c;p++)o(p)&&e.isSelected(u,p)&&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,a=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-a),l);case"NAVIGATE_PAGE_DOWN":return this.setFocusCell(Math.min(o-1,n+a),l);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===0||gt(s.getCellRenderer(e,t))))return this.toggleRowCheckbox(e,t,"body"),!0;const i=s.getRowByIndex(e);if(N(i)&&B(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),l=Math.max(1,o.getRowspanAt(t,s)||1);switch(e){case"NAVIGATE_LEFT":{const a=this.getNextShownColumnIndex(s,-1,r);return a!==s&&this.setHeaderFocus(t,a),!0}case"NAVIGATE_RIGHT":{const a=this.getNextShownColumnIndex(s+n-1,1,r);return a>s+n-1&&this.setHeaderFocus(t,a),!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 a=new ke(null,this);return a.rowIdx=e,a.colIdx=t,a.areaIdent="header",a.areaModel=i,this.toggleHeaderGroup(a),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 i,r;e==="body"&&this.tableModel.getAreaModel(e).setValue(t,s,o)&&(this.resetEditorRenderer(),this.repaint(),(r=(i=this.eventListener).onModelChanged)==null||r.call(i,Ye.createSingle(t,s)),this.hostElement.focus())}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(){if(this.destroyed)return;try{this.stateService.destroy()}catch(s){console.error(s)}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 je;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)&&(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=e.columnIndex,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)}toggleRowCheckbox(e,t,s){var l,a,c;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();(c=(a=this.eventListener).onCheckboxChanged)==null||c.call(a,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;(e=this.stateService)==null||e.rendered()}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.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),Z.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 c;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 Fe(s,n),a=this.tableModel.doSort([l]);return a&&(this.lastSortCompareFn=void 0,(c=this.tableModel.getColumnDefs())==null||c.forEach(d=>d.sortState=""),o.sortState=n),this.repaint(),a&&this.stateService.sortedByColumn(n?o.property:void 0),a&&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 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 Zt(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),a=this.getNextShownColumnIndex(n,e,i);return(l!==r||a!==n)&&(s.setFocus(l,a),this.ensureColumnIsVisible(a),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){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 m,g;const p=this.tableModel.getAreaModel(u),f=(p==null?void 0:p.getRowCount())??0;for(let C=0;C<f;C++)for(let b=0;b<t;b++){const x=((m=p.getTextValueAt)==null?void 0:m.call(p,C,b))||(((g=p.getValueAt(C,b))==null?void 0:g.toString())??""),I=x.length;I>i[b]&&(i[b]=I,o[b].forEach(w=>{w.length<I-2&&o[b].delete(w)})),I>=i[b]-2&&o[b].size<s&&o[b].add(x)}};r("header"),r("body"),r("footer");const n=this.hostElement.querySelector(".ge-table-label"),l=getComputedStyle(n??this.hostElement),a=n?(parseFloat(l.paddingLeft)||0)+(parseFloat(l.paddingRight)||0):20;let c=null;try{c=document.createElement("canvas").getContext("2d")}catch{c=null}c&&(c.font=l.font||`${l.fontSize} ${l.fontFamily}`);const d=u=>c?c.measureText(u).width:u.length*8;return o.map(u=>{let p=0;return u.forEach(f=>{p=Math.max(p,d(f))}),Math.max(Math.ceil(p+a+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++){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.repaint()}sort(e){var t;this.tableModel.sort(e),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))}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 Fe(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,l=i.scrollWidth-i.clientWidth;if(o<=0||n<=0||l<=0)return!1;let a=0;for(let p=t;p<e;p++)a+=this.tableModel.getColumnWidth(p);const c=Math.min(1,Math.max(0,i.scrollLeft/l))*n;let d;if(a<c-.5)d=a;else if(a+o>c+r+.5)d=o>r?a:a+o-r;else return!1;const u=Math.min(1,Math.max(0,d/n))*l;return i.scrollLeft=d===a?Math.floor(u):Math.ceil(u),this.adjustAfterScrolling(),!0}};Z.actionsBlockedWhileLoading=["START_EDITING","TOGGLE_SELECTION","ACTIVATE_CELL"],Z.filterAnnouncementDelayInMs=400;let ot=Z;class Vs extends Le{constructor(e){super(),this.onCheckboxChangedCallback=e,super.onCheckboxChanged=t=>{this.onCheckboxChangedCallback(t)}}}const $e=class $e{};$e.themes=["light","combat","paper","blackboard"],$e.vars={light:`html[data-theme="light"] {
|
|
72
|
+
<sheetData>`);for(let i=0;i<e.length;i++){const r=e[i];o.push(`<row r="${i+1}" spans="1:${t}" x14ac:dyDescent="0.2">`);for(let n=0;n<r.length;n++){const l=r[n],c=this.getCellAddress(i,n);if(typeof l=="number")o.push(`<c r="${c}"><v>${l}</v></c>`);else if(l instanceof Date){const h=l;o.push(`<c r="${c}" t="inlineStr"><is><t>${h.toISOString()}</t></is></c>`)}else{const h=l!=null?this.escapeXml(String(l)):"";o.push(`<c r="${c}" t="inlineStr"><is><t>${h}</t></is></c>`)}}o.push("</row>")}return o.push(""),o.push(""),o.push('</sheetData><pageMargins left="0.7" right="0.7" top="0.75" bottom="0.75" header="0.3" footer="0.3"/>'),o.push("</worksheet>"),o.join(`
|
|
73
|
+
`)}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:ys(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 ui(i),n=!!r&&r.length<i.length;t.push({path:new TextEncoder().encode(s),data:n?r:i,size:i.length,crc:ys(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 ut=class ut{constructor(e,t,s){this.document=e,this.id=t,this.domService=s}announce(e,t=ut.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}};ut.defaultDelayInMs=150;let ot=ut;const le=class le extends Ns{constructor(e,t,s,o,i,r=new pe,n=new oo){var d;super(e,t,new Je(s),o),this.eventListener=i,this.copyService=r,this.excelService=n,this.licenseManager=ae.getInstance(),this.listenerAbortController=new AbortController,this.destroyed=!1,this.selectionService=new ce(this),this.api=new Ls(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 ot(e.ownerDocument,this.ariaIds.liveRegion(),s),i||(this.eventListener=new st),this.stateService=new tt(this),this.mouseHandler=new Ds(this),this.inputHandler=new js(this),this.resizeHandler=new so(this,o.resizeEventDebounceDelay),this.shortcutService=new qs(this),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})}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 xe,o=new st,i=new Zs,r=new pe){return new le(e,t,i,s,o,r)}onActionTriggered(e){if(!this.headerFocus&&this.tableOverlay.isBlocking()&&le.actionsBlockedWhileLoading.includes(e))return!0;if(this.headerFocus){const s=this.onHeaderAction(e);if(s!==void 0)return s}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 s=this.getFocusModel();if(s){const[o,i]=s.getFocus();this.tableModel.getBodyModel().isEditable(o,i)&&(this.clearSelection(),this.initRenderEditor(o,i))}return!0}if(e==="COPY_2_CLIPBOARD"){const s=this.getSelectionModel?this.getSelectionModel():void 0,o=this.getFocusModel?this.getFocusModel():void 0;this.copyService.createContent(this.tableModel,s,o).then(i=>this.copyService.copyContent(i).then(()=>this.announceCopied(i))).catch(i=>console.warn("GuiExpert Table – copy to clipboard failed:",i))}return!1}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)>pe.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){const s=this.tableModel.getBodyModel();if(s.isRowCheckable(e)&&(this.tableOptions.showCheckboxWihoutExtraColumn&&t===this.getFirstDataColumnIndex()||Yt(s.getCellRenderer(e,t))))return this.toggleRowCheckbox(e,t,"body"),!0;const i=s.getRowByIndex(e);if($(i)&&H(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),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 qe(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 i,r;if(e==="body"){const n=this.tableModel.getAreaModel(e),l=n.getRowCount(),c=X(n)?n.getBuildCount():0;if(n.setValue(t,s,o)){this.resetEditorRenderer();const d={area:"body",rowIndices:[t]};this.invalidateAggregates(d),X(n)&&n.getBuildCount()!==c||n.getRowCount()!==l?this.repaintHard():this.repaint(),this.invalidateAggregates(d),(r=(i=this.eventListener).onModelChanged)==null||r.call(i,xt.createSingle(t,s)),this.hostElement.focus()}}}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(){if(this.destroyed)return;try{this.stateService.destroy()}catch(s){console.error(s)}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 wt;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)&&!F(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();H(t)&&(t.toggleExpandCollapseAll(e),this.allExpanded=e,this.repaintHard(),this.stateService.markDirty("tree"))}setTreeRowExpanded(e,t){const s=this.tableModel.getBodyModel();return!H(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),Ft(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(!Xt(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;(e=this.stateService)==null||e.rendered()}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),le.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 Qe(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(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 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 Ks(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){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,w;const f=this.tableModel.getAreaModel(u),g=(f==null?void 0:f.getRowCount())??0;for(let m=0;m<g;m++)for(let b=0;b<t;b++){const x=((p=f.getTextValueAt)==null?void 0:p.call(f,m,b))||(((w=f.getValueAt(m,b))==null?void 0:w.toString())??""),S=x.length;S>i[b]&&(i[b]=S,o[b].forEach(C=>{C.length<S-2&&o[b].delete(C)})),S>=i[b]-2&&o[b].size<s&&o[b].add(x)}};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(F(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 Qe(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,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,i.scrollLeft/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 i.scrollLeft=d===c?Math.floor(u):Math.ceil(u),this.adjustAfterScrolling(),!0}};le.actionsBlockedWhileLoading=["START_EDITING","TOGGLE_SELECTION","ACTIVATE_CELL"],le.filterAnnouncementDelayInMs=400;let Lt=le;class fi extends st{constructor(e){super(),this.onCheckboxChangedCallback=e,super.onCheckboxChanged=t=>{this.onCheckboxChangedCallback(t)}}}const ft=class ft{};ft.themes=["light","combat","paper","blackboard"],ft.vars={light:`html[data-theme="light"] {
|
|
74
74
|
--ge-table-bg: rgba(255,255,255, 0.5);
|
|
75
75
|
--ge-table-header-west-bg: rgba(233, 233, 233, 0.5);
|
|
76
76
|
--ge-table-header-center-bg: rgba(233, 233, 233, 0.5);
|
|
@@ -133,6 +133,8 @@ render scope: this.lastFullVisibleRowIndex <- `+this.lastFullVisibleRowIndex),th
|
|
|
133
133
|
--ge-table-spinner-color: #1a73e8;
|
|
134
134
|
--ge-table-spinner-track-color: rgba(0, 0, 0, 0.12);
|
|
135
135
|
--ge-table-spinner-size: 28px;
|
|
136
|
+
--ge-table-row-number-bg: var(--ge-table-header-west-bg);
|
|
137
|
+
--ge-table-row-number-color: #555;
|
|
136
138
|
}`,combat:`html[data-theme="combat"] {
|
|
137
139
|
--ge-table-bg: #101010;
|
|
138
140
|
--ge-table-header-west-bg: #101010;
|
|
@@ -196,6 +198,8 @@ render scope: this.lastFullVisibleRowIndex <- `+this.lastFullVisibleRowIndex),th
|
|
|
196
198
|
--ge-table-spinner-color: #00e0ff;
|
|
197
199
|
--ge-table-spinner-track-color: rgba(255, 255, 255, 0.18);
|
|
198
200
|
--ge-table-spinner-size: 28px;
|
|
201
|
+
--ge-table-row-number-bg: var(--ge-table-header-west-bg);
|
|
202
|
+
--ge-table-row-number-color: #a0a0a0;
|
|
199
203
|
}`,paper:`html[data-theme="paper"] {
|
|
200
204
|
--ge-table-bg: #e7e5df;
|
|
201
205
|
--ge-table-header-west-bg: oklch(80% 0.02 99 / 48%);
|
|
@@ -259,6 +263,8 @@ render scope: this.lastFullVisibleRowIndex <- `+this.lastFullVisibleRowIndex),th
|
|
|
259
263
|
--ge-table-spinner-color: #6b4f2a;
|
|
260
264
|
--ge-table-spinner-track-color: rgba(0, 0, 0, 0.12);
|
|
261
265
|
--ge-table-spinner-size: 28px;
|
|
266
|
+
--ge-table-row-number-bg: var(--ge-table-header-west-bg);
|
|
267
|
+
--ge-table-row-number-color: #5a4a35;
|
|
262
268
|
}`,blackboard:`html[data-theme="dark"] {
|
|
263
269
|
--ge-table-bg: #0c1021;
|
|
264
270
|
--ge-table-header-west-bg: #0c1021;
|
|
@@ -322,7 +328,9 @@ render scope: this.lastFullVisibleRowIndex <- `+this.lastFullVisibleRowIndex),th
|
|
|
322
328
|
--ge-table-spinner-color: #e0df85;
|
|
323
329
|
--ge-table-spinner-track-color: rgba(255, 255, 255, 0.18);
|
|
324
330
|
--ge-table-spinner-size: 28px;
|
|
325
|
-
}`};let it=$e;class Ee{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 te{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=te.toExpandedFn(i.expanded??!0),a=[];for(const c of e){const d=new Ee(c,l(c,0),[],void 0,0);a.push(te.buildTreeRow(c,r,d,0,n,l))}return a}static buildTreeRow(e,t="children",s=new Ee(e,!0,[],void 0,0),o=0,i=12,r=!0){var a;const n=te.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 c of l){const d=new Ee(c,n(c,o+1),[],s,o+1);(a=s.children)==null||a.push(d),te.buildTreeRow(c,t,d,o+1,i,n)}return s}static toExpandedFn(e){return typeof e=="function"?e:()=>e}}class se{constructor(e=34,t=34,s=34){this.header=e,this.body=t,this.footer=s}}class y{constructor(e=100,t="px"){this.value=e,this.unit=t}}class J{constructor(e,t,s=new y(100,"px"),o=new D,i=new D,r=new y(100,"px"),n=new y(100,"px"),l,a,c,d,u,p,f,m,g=()=>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=a,this.sortState=c,this.sortStatesOrder=d,this.sortIconVisible=u,this.editable=p,this.getEditRenderer=f,this.editInputPipe=m,this.isVisible=g,this.visible=!0,s.unit!=="px"&&(this.minWidth=new y(0,"px"),this.maxWidth=new y(1e5,"px"))}static bodyRenderer(e){return new D(void 0,e,void 0)}static create(e){const t=new D(e.headerRenderer,e.bodyRenderer,e.footerRenderer),s=new D(e.headerClasses,e.bodyClasses,e.footerClasses),o=e.sortIconVisible??e.sortable,i=e.editable??e.editable??Ct,r=e.isVisible??e.isVisible??wt;return new J(e.property??"",e.headerLabel??"",e.width??new y(100,"px"),s,t,e.minWidth??new y(100,"px"),e.maxWidth??new y(100,"px"),e.sortable,e.sortComparator,e.sortState,e.sortStatesOrder,o,i,e.getEditRenderer,e.editInputPipe,r)}}const Os=new y(500,"px"),Hs=new y(400,"px"),ls=new y(300,"px"),Bs=new y(290,"px"),Ns=new y(280,"px"),$s=new y(270,"px"),Ws=new y(260,"px"),Gs=new y(250,"px"),zs=new y(240,"px"),js=new y(230,"px"),Us=new y(220,"px"),Ks=new y(210,"px"),rt=new y(200,"px"),Ys=new y(190,"px"),Xs=new y(180,"px"),Js=new y(170,"px"),qs=new y(160,"px"),Zs=new y(150,"px"),Qs=new y(140,"px"),eo=new y(130,"px"),to=new y(120,"px"),so=new y(110,"px"),oo=new y(100,"px"),io=new y(90,"px"),ro=new y(80,"px"),no=new y(70,"px"),lo=new y(60,"px"),ao=new y(50,"px"),co=new y(40,"px"),ho=new y(30,"px"),uo=new y(20,"px"),po=new y(10,"px"),fo=new y(0,"px");class P extends Ue{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}getValueAt(e,t){return this.filteredArr[e][t]}setValue(e,t,s){var i;const o=(i=this.columnDefs[t])==null?void 0:i.editInputPipe;return o&&(s=o(s,e,t)),this.arr[e][t]=s,!0}getRowByIndex(e){return this.filteredArr[e]}getRowHeight(e){return this.defaultRowHeight}getConstantRowHeight(){return this.getRowHeight===P.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 L{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 as{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 xe extends Ue{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 yt,this.service=new as,this.filteredFlattenRows=[],this.flattenRows=[],this.keepMarked=!1,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:[]}getFilteredFlattenRows(){return this.filteredFlattenRows}getRowCount(){return this.filteredFlattenRows.length}getUnfilteredRowCount(){return this.flattenRows.length}getValueAt(e,t){const s=this.getRowByIndex(e);if(s){const o=this.properties[t];if(o)return o.includes(".")?this.getPropertyValue(s.data,o.split(".")):s.data[o]}return""}getRowHeight(e){return this.defaultRowHeight}getConstantRowHeight(){return this.getRowHeight===xe.prototype.getRowHeight&&this.defaultRowHeight>0?this.defaultRowHeight:void 0}getCustomClassesAt(e,t){return["ge-table-tree-cell","ge-table-tree-deep-"+this.filteredFlattenRows[e].deep]}getRowByIndex(e){return this.filteredFlattenRows[e]}getValueByT(e,t){if(e&&t)return t.includes(".")?this.getPropertyValue(e,t.split(".")):e[t]}externalFilterChanged(e){this.lastPredictFn=e,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.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.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].property;return l.includes(".")?this.setPropertyValue(n,l.split("."),s):(n[l]=s,!0)}return!1}genericTreeTableSortComparator(e,t){const s=this.columnDefs.find(o=>o.property===e);return(o,i)=>{const r=this.getValueByT(o.data,e),n=this.getValueByT(i.data,e);return s!=null&&s.sortComparator?t*s.sortComparator(r,n,o.data,i.data,t):this.sorterService.genericSortComparator(r,n,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 Se{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 Ve{constructor(e=0,t=0,s=0,o=0){this.top=e,this.right=t,this.bottom=s,this.left=o}}class cs{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 go{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 Se){this.getTopTreeRows().forEach(o=>s.checkRow(o,t));return}this.checkAll(t?this.getBodyRows():[])}isRowChecked(e){const t=this.bodyAreaModel.rowSelectionModel;if(t instanceof Se){const l=this.getTopTreeRows().map(a=>t.isRowChecked(a));return!l.length||l.every(a=>a==="none")?"none":l.every(a=>a==="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 Te{constructor(e,t,s,o=0,i=0,r=!1,n=new se,l=[],a=[],c=-1,d=0,u=400,p=()=>{}){var f,m,g,C,b;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=a,this.overridingColumnWidth=c,this.columnCount=d,this.parentSize=u,this.getSelectionModel=p,this.rowCount=0,this.contentHeightInPx=0,this.contentWidthInPx=0,this.padding=new Ve(0,0,0,0),this.xPositions=[],this.headerVisible=!0,this.footerVisible=!0,e.areaIdent="header",t.areaIdent="body",s.areaIdent="footer",this.columnCount||((f=this.columnDefs)!=null&&f.length?this.columnCount=this.columnDefs.length:(m=this.columnSizes)!=null&&m.length&&(this.columnCount=(g=this.columnSizes)==null?void 0:g.length)),(C=this.columnDefs)!=null&&C.length&&et(this.columnDefs[0])&&!t.rowSelectionModel&&(t.rowSelectionModel=new cs),(b=this.columnDefs)!=null&&b.length&&et(this.columnDefs[0])&&!e.rowSelectionModel&&(e.rowSelectionModel=new go(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 y(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 Ve(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;Is(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(c=>{var d;return((d=c.width)==null?void 0:d.unit)==="weight"});this.columnSizes=this.columnDefs.map(c=>{if(c.width.unit==="%"&&e){let d=Math.floor(c.width.value*e/100);if(c.minWidth){const u=this.sizeToPixel(c.minWidth,e);d=Math.max(u,d)}if(c.maxWidth){const u=this.sizeToPixel(c.maxWidth,e);d=Math.min(u,d)}return d}else if(c.width.unit==="px"&&e)return c.width.value;return 0});const r=c=>{var d;return((d=c.isVisible)==null?void 0:d.call(c))!==!1},n=this.columnSizes.reduce((c,d,u)=>r(this.columnDefs[u])?c+d:c,0),l=e-n,a=i.filter(r);if(l>0&&a.length){const c=a.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/c)}}}}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 nt extends _{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 K{static createTableModel(e){var t,s,o,i,r,n,l,a,c,d,u,p,f,m;if(e.defaultRowHeights===void 0)if((t=e.tableOptions)!=null&&t.defaultRowHeights)e.defaultRowHeights=e.tableOptions.defaultRowHeights;else{if(e.defaultRowHeights=new se,e.headerAreaModel&&"defaultRowHeight"in e.headerAreaModel){const g=e.headerAreaModel.defaultRowHeight;g>-1&&(e.defaultRowHeights.header=g)}if(e.bodyAreaModel&&"defaultRowHeight"in e.bodyAreaModel){const g=e.bodyAreaModel.defaultRowHeight;g>-1&&(e.defaultRowHeights.body=g)}if(e.footerAreaModel&&"defaultRowHeight"in e.footerAreaModel){const g=e.footerAreaModel.defaultRowHeight;g>-1&&(e.defaultRowHeights.footer=g)}}if(e.columnDefs===void 0&&((s=e.properties)!=null&&s.length?e.columnDefs=e.properties.map(g=>new J(g,g.toUpperCase(),rt)):(o=e.rows)!=null&&o.length?e.columnDefs=Object.keys(e.rows[0]).map(g=>new J(g,g.toUpperCase(),rt)):e.columnDefs=[]),e.columnCount===void 0&&((i=e.columnDefs)!=null&&i.length?e.columnCount=e.columnDefs.length:(r=e.headerData)!=null&&r.length?e.columnCount=e.headerData[0].length:(n=e.columnSizes)!=null&&n.length?e.columnCount=(l=e.columnSizes)==null?void 0:l.length:console.warn('Property "columnCount" is missing and cannot be derived from other properties.')),e.headerAreaModel||((a=e.headerData)!=null&&a.length?e.headerAreaModel=new P("header",e.headerData,e.defaultRowHeights.header,e.columnDefs):(c=e.columnDefs)!=null&&c.length?e.headerAreaModel=new P("header",[e.columnDefs.map(g=>g.headerLabel)],e.defaultRowHeights.header,e.columnDefs):e.headerAreaModel=new L("header")),e.footerAreaModel||((d=e.footerData)!=null&&d.length?e.footerAreaModel=new P("footer",e.footerData,e.defaultRowHeights.footer,e.columnDefs):e.footerAreaModel=new L("footer")),!e.bodyAreaModel)if(e.rows)if((u=e.rows)!=null&&u.length&&N(e.rows[0])){const g=e.rows;e.bodyAreaModel=new xe("body",g,e.defaultRowHeights.body,e.columnDefs),(e.columnDefs[0].property==="CheckboxColumn"||(p=e.tableOptions)!=null&&p.showCheckboxWihoutExtraColumn)&&(e.bodyAreaModel.rowSelectionModel=new Se(g))}else e.bodyAreaModel=new nt("body",e.rows,e.columnDefs,e.defaultRowHeights.body);else e.bodyData?e.bodyAreaModel=new P("body",e.bodyData,e.defaultRowHeights.body):e.bodyAreaModel=new L("body");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&&((f=e.tableOptions)!=null&&f.getSelectionModel)&&(e.getSelectionModel=(m=e.tableOptions)==null?void 0:m.getSelectionModel),new Te(e.headerAreaModel,e.bodyAreaModel,e.footerAreaModel,e.fixedLeftColumnCount,e.fixedRightColumnCount,e.rowCheckboxVisible,e.defaultRowHeights,e.columnDefs,e.columnSizes,e.overridingColumnWidth,e.columnCount,e.parentSize,e.getSelectionModel)}static buildByTypedRowsParam(e){return K.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){const r=s.defaultRowHeights,n=t[0].property==="CheckboxColumn";if(e!=null&&e.length&&N(e[0])){const a=e,c=new xe("body",a,r.body,t);return(n||s.showCheckboxWihoutExtraColumn)&&(c.rowSelectionModel=new Se(a)),K.createByAreaModelsParam({headerAreaModel:new P("header",[t.map(d=>d.headerLabel)],r.header),bodyAreaModel:c,footerAreaModel:new P("footer",[],r.footer),columnDefs:t,fixedLeftColumnCount:o,fixedRightColumnCount:i,defaultRowHeights:s.defaultRowHeights,rowCheckboxVisible:!1,columnSizes:[],columnCount:t.length,overridingColumnWidth:-1})}return K.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 K.createByObjectArray(e.rows,e.header??[],e.footer??[],e.fixedLeftColumnCount??0,e.fixedRightColumnCount??0,t,e.defaultRowHeights??new se,e.columnDefs??[],e.columnSizes??[])}static createByAreaModels(e=new L,t,s=new L,o=0,i=0,r=!1,n=new se,l,a=[],c=-1,d){return new Te(e,t,s,o,i,r,n,l,a,c,d)}static createByAreaModelsParam(e){return K.createByAreaModels(e.headerAreaModel??new L,e.bodyAreaModel,e.footerAreaModel??new L,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 se,l,a=[]){let c;t!=null&&t.length?c=new P("header",t,n.header,l):l!=null&&l.length?c=new P("header",[l.map(p=>p.headerLabel)],n.header,l):c=new L;const d=s?new P("footer",s,n.footer,l):new L,u=new nt("body",e,l,n.body);return new Te(c,u,d,o,i,r,n,l,a)}}class ds{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 yt,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 hs{constructor(e,t=0){this.bodyModel=e,this.paddingTop=t,this.headerAreaModel=new L,this.footerAreaModel=new L}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 Ve(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 us{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=ks(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 mo{static createCoverGridModel(e,t,s=200,o=300,i=0,r=0){const n=new ds(e,t,s,o,i,r);return new hs(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 us,getStorageKeyFn:t,autoRestoreCollapsedExpandedState:!1,autoRestoreScrollPosition:!0,autoRestoreSortingState:!1,autoRestoreSelectedState:!1}}}}const bo=["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"];class ps{constructor(e,t){this.tableModel=e,this.tableOptions=t}}class fs{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 yo extends fs{constructor(e,t,s,o,i,r,n,l){super(e,t,s,o,i,r,n),this.rows=l}}class gs{constructor(e,t){this.value=e,this.label=t}}class wo{constructor(e,t){this.index=e,this.px=t}}const Co={body:["ge-table-text-align-left"]},xo={body:["ge-table-text-align-center"]},So={body:["ge-table-text-align-right"]},vo={header:["ge-table-text-align-left"],body:["ge-table-text-align-left"],footer:["ge-table-text-align-left"]},Ro={header:["ge-table-text-align-center"],body:["ge-table-text-align-center"],footer:["ge-table-text-align-center"]},Ao={header:["ge-table-text-align-right"],body:["ge-table-text-align-right"],footer:["ge-table-text-align-right"]};class lt{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 a=n.createElement("input");n.setAttribute(a,"type","checkbox"),n.setAttribute(a,"data-area",`${o}`),n.setAttribute(a,"data-row-index",`${t}`),n.setAttribute(a,"data-col-index",`${s}`),n.setAttribute(a,"data-input-type","checkbox"),n.setAttribute(a,"tabindex","-1"),n.addClass(a,"ge-table-row-checkbox"),l==="full"&&(n.setAttribute(a,"checked",""),a.checked=!0),a.indeterminate=l==="semi",n.appendChild(e,a)}}}class Mo{constructor(){this.type="CheckboxColumnDef",this.property="CheckboxColumn",this.headerLabel="",this.width=new y(50,"px"),this.minWidth=new y(50,"px"),this.maxWidth=new y(100,"px"),this.rendererMap=new D(new lt,new lt,void 0),this.classes=new D([],["ge-table-text-align-left"],[])}}class Eo{static body(e){return new D(void 0,e,void 0)}}class To{constructor(e="down",t){this.status=e,this.originalEvent=t}}class Io{constructor(e,t,s,o,i={}){this.area=e,this.rowIndex=t,this.columnIndex=s,this.value=o,this.cssClasses=i}}class ms{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 bs extends ms{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}
|
|
331
|
+
--ge-table-row-number-bg: var(--ge-table-header-west-bg);
|
|
332
|
+
--ge-table-row-number-color: #c9c86f;
|
|
333
|
+
}`};let Vt=ft;class ie{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 fe{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=fe.toExpandedFn(i.expanded??!0),c=[];for(const h of e){const d=new ie(h,l(h,0),[],void 0,0);c.push(fe.buildTreeRow(h,r,d,0,n,l))}return c}static buildTreeRow(e,t="children",s=new ie(e,!0,[],void 0,0),o=0,i=12,r=!0){var c;const n=fe.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 ie(h,n(h,o+1),[],s,o+1);(c=s.children)==null||c.push(d),fe.buildTreeRow(h,t,d,o+1,i,n)}return s}static toExpandedFn(e){return typeof e=="function"?e:()=>e}}class te{constructor(e=34,t=34,s=34){this.header=e,this.body=t,this.footer=s}}class y{constructor(e=100,t="px"){this.value=e,this.unit=t}}class W{constructor(e,t,s=new y(100,"px"),o=new D,i=new D,r=new y(100,"px"),n=new y(100,"px"),l,c,h,d,u,f,g,p,w=()=>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=w,this.visible=!0,s.unit!=="px"&&(this.minWidth=new y(0,"px"),this.maxWidth=new y(1e5,"px"))}static bodyRenderer(e){return new D(void 0,e,void 0)}static create(e){const t=new D(e.headerRenderer,e.bodyRenderer,e.footerRenderer),s=new D(e.headerClasses,e.bodyClasses,e.footerClasses),o=e.sortIconVisible??e.sortable,i=e.editable??e.editable??os,r=e.isVisible??e.isVisible??Re;return new W(e.property??"",e.headerLabel??"",e.width??new y(100,"px"),s,t,e.minWidth??new y(100,"px"),e.maxWidth??new y(100,"px"),e.sortable,e.sortComparator,e.sortState,e.sortStatesOrder,o,i,e.getEditRenderer,e.editInputPipe,r)}}const gi=new y(500,"px"),pi=new y(400,"px"),io=new y(300,"px"),mi=new y(290,"px"),bi=new y(280,"px"),wi=new y(270,"px"),yi=new y(260,"px"),Ci=new y(250,"px"),xi=new y(240,"px"),Si=new y(230,"px"),vi=new y(220,"px"),Ri=new y(210,"px"),it=new y(200,"px"),Ai=new y(190,"px"),Mi=new y(180,"px"),Ei=new y(170,"px"),Ti=new y(160,"px"),Ii=new y(150,"px"),ki=new y(140,"px"),Di=new y(130,"px"),Pi=new y(120,"px"),Fi=new y(110,"px"),Li=new y(100,"px"),Vi=new y(90,"px"),Oi=new y(80,"px"),_i=new y(70,"px"),Bi=new y(60,"px"),Ni=new y(50,"px"),Gi=new y(40,"px"),Hi=new y(30,"px"),$i=new y(20,"px"),Wi=new y(10,"px"),zi=new y(0,"px");class _ extends yt{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}getValueAt(e,t){return this.filteredArr[e][t]}setValue(e,t,s){var i;const o=(i=this.columnDefs[t])==null?void 0:i.editInputPipe;return o&&(s=o(s,e,t)),this.arr[e][t]=s,!0}getRowByIndex(e){return this.filteredArr[e]}getRowHeight(e){return this.defaultRowHeight}getConstantRowHeight(){return this.getRowHeight===_.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 O{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 ro{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 ue extends yt{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 Qt,this.service=new ro,this.filteredFlattenRows=[],this.flattenRows=[],this.keepMarked=!1,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}getValueAt(e,t){const s=this.getRowByIndex(e);if(s){const o=this.properties[t];if(o)return o.includes(".")?this.getPropertyValue(s.data,o.split(".")):s.data[o]}return""}getRowHeight(e){return this.defaultRowHeight}getConstantRowHeight(){return this.getRowHeight===ue.prototype.getRowHeight&&this.defaultRowHeight>0?this.defaultRowHeight:void 0}getCustomClassesAt(e,t){return["ge-table-tree-cell","ge-table-tree-deep-"+this.filteredFlattenRows[e].deep]}getRowByIndex(e){return this.filteredFlattenRows[e]}getValueByT(e,t){if(e&&t)return t.includes(".")?this.getPropertyValue(e,t.split(".")):e[t]}externalFilterChanged(e){this.lastPredictFn=e,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.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.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].property;return l.includes(".")?this.setPropertyValue(n,l.split("."),s):(n[l]=s,!0)}return!1}genericTreeTableSortComparator(e,t){const s=this.columnDefs.find(o=>o.property===e);return(o,i)=>{const r=this.getValueByT(o.data,e),n=this.getValueByT(i.data,e);return s!=null&&s.sortComparator?t*s.sortComparator(r,n,o.data,i.data,t):this.sorterService.genericSortComparator(r,n,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 ve{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 rt{constructor(e=0,t=0,s=0,o=0){this.top=e,this.right=t,this.bottom=s,this.left=o}}class no{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 ji{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 ve){this.getTopTreeRows().forEach(o=>s.checkRow(o,t));return}this.checkAll(t?this.getBodyRows():[])}isRowChecked(e){const t=this.bodyAreaModel.rowSelectionModel;if(t instanceof ve){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 Ie{constructor(e,t,s,o=0,i=0,r=!1,n=new te,l=[],c=[],h=-1,d=0,u=400,f=()=>{}){var p,w,m,b;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 rt(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:(w=this.columnSizes)!=null&&w.length&&(this.columnCount=(m=this.columnSizes)==null?void 0:m.length));const g=(b=this.columnDefs)==null?void 0:b[Ve(this.columnDefs)];ye(g)&&!t.rowSelectionModel&&(t.rowSelectionModel=new no),ye(g)&&!e.rowSelectionModel&&(e.rowSelectionModel=new ji(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 y(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 rt(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;Gs(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 Ot extends B{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 lo{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 _t{constructor(){this.mode="display",this.format=Ui,this.headerLabel="#",this.exported=!1,this.minWidthInPx=36}}function Ui(a){return String(a)}class vt{constructor(e={}){this.type="RowNumberColumnDef",this.property="RowNumberColumn",this.maxWidth=new y(400,"px"),this.classes=new D(["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=Re,this.options={...new _t,...e},this.headerLabel=this.options.headerLabel,this.width=new y(this.options.minWidthInPx,"px"),this.minWidth=new y(this.options.minWidthInPx,"px"),this.rendererMap=new D(void 0,new lo(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 _t().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 rs{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}}function He(a,e){const t=typeof e=="string"||!("aggregator"in e)?{aggregator:e}:e,s=ss(t.aggregator),o=t.value??a;return{key:a,aggregator:s,value:o,getValue:s===de.count?void 0:Ge(o),format:t.format}}function Rt(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 Ki(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 Yi(a,e,t){const s=He("",{aggregator:t,value:e}),[o]=Rt(a,[s]);return s.aggregator.result(o)}function Xi(a,e){const t=Object.keys(e).map(i=>He(i,e[i])),s=Rt(a,t),o={};return t.forEach((i,r)=>o[i.key]=i.aggregator.result(s[r])),o}const Ji=new Intl.NumberFormat("en-US",{maximumFractionDigits:2});function $e(a){return a==null?"":typeof a=="number"?Number.isFinite(a)?Ji.format(a):String(a):a instanceof Date?Number.isNaN(a.getTime())?"":a.toLocaleDateString("en-US"):String(a)}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)}}const qi={sum:"Sum",count:"Count",avg:"Average",min:"Min",max:"Max",countDistinct:"Distinct",first:"First",last:"Last"},Zi=new Intl.NumberFormat("en-US");class _e extends rs{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=_e.toOptions(s),this.defaultRowHeight=this.options.rowHeight??34,this.footerRows=this.options.rows.map(o=>{const i=Object.keys(o.aggregates).map(r=>He(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!F(o)&&!ye(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=qi[i];if(r&&s.every(n=>n.aggregator===de[i]))return r}return`${Zi.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(H(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=Ge(t.value);return o=>s(e.getRowByIndex(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.footerRows.flatMap(c=>c.specs);let i;if(typeof s=="number"){const c=this.getBody();i=Ki(s,o.map(h=>({aggregator:h.aggregator,getValue:this.createIndexGetter(c,h)})))}else i=Rt(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 N{static createTableModel(e){var s,o,i,r,n,l,c,h,d,u,f,g,p,w,m;if(e.defaultRowHeights===void 0)if((s=e.tableOptions)!=null&&s.defaultRowHeights)e.defaultRowHeights=e.tableOptions.defaultRowHeights;else{if(e.defaultRowHeights=new te,e.headerAreaModel&&"defaultRowHeight"in e.headerAreaModel){const b=e.headerAreaModel.defaultRowHeight;b>-1&&(e.defaultRowHeights.header=b)}if(e.bodyAreaModel&&"defaultRowHeight"in e.bodyAreaModel){const b=e.bodyAreaModel.defaultRowHeight;b>-1&&(e.defaultRowHeights.body=b)}if(e.footerAreaModel&&"defaultRowHeight"in e.footerAreaModel){const b=e.footerAreaModel.defaultRowHeight;b>-1&&(e.defaultRowHeights.footer=b)}}e.columnDefs===void 0&&((o=e.properties)!=null&&o.length?e.columnDefs=e.properties.map(b=>new W(b,b.toUpperCase(),it)):(i=e.rows)!=null&&i.length?e.columnDefs=Object.keys(e.rows[0]).map(b=>new W(b,b.toUpperCase(),it)):e.columnDefs=[]),N.addRowNumberColumn(e),e.columnCount===void 0&&((r=e.columnDefs)!=null&&r.length?e.columnCount=e.columnDefs.length:(n=e.headerData)!=null&&n.length?e.columnCount=e.headerData[0].length:(l=e.columnSizes)!=null&&l.length?e.columnCount=(c=e.columnSizes)==null?void 0:c.length:console.warn('Property "columnCount" is missing and cannot be derived from other properties.')),e.headerAreaModel||((h=e.headerData)!=null&&h.length?e.headerAreaModel=new _("header",e.headerData,e.defaultRowHeights.header,e.columnDefs):(d=e.columnDefs)!=null&&d.length?e.headerAreaModel=new _("header",[e.columnDefs.map(b=>b.headerLabel)],e.defaultRowHeights.header,e.columnDefs):e.headerAreaModel=new O("header"));const t=N.checkFooterAggregates(e);if(!e.footerAreaModel&&!t&&((u=e.footerData)!=null&&u.length?e.footerAreaModel=new _("footer",e.footerData,e.defaultRowHeights.footer,e.columnDefs):e.footerAreaModel=new O("footer")),!e.bodyAreaModel)if(e.rows)if((f=e.rows)!=null&&f.length&&$(e.rows[0])){const b=e.rows;e.bodyAreaModel=new ue("body",b,e.defaultRowHeights.body,e.columnDefs),(((g=e.columnDefs[Ve(e.columnDefs)])==null?void 0:g.property)==="CheckboxColumn"||(p=e.tableOptions)!=null&&p.showCheckboxWihoutExtraColumn)&&(e.bodyAreaModel.rowSelectionModel=new ve(b))}else e.bodyAreaModel=new Ot("body",e.rows,e.columnDefs,e.defaultRowHeights.body);else e.bodyData?e.bodyAreaModel=new _("body",e.bodyData,e.defaultRowHeights.body):e.bodyAreaModel=new O("body");if(t){const b=_e.toOptions(t);e.footerAreaModel=new _e(e.bodyAreaModel,e.columnDefs??[],{...b,rowHeight:b.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&&((w=e.tableOptions)!=null&&w.getSelectionModel)&&(e.getSelectionModel=(m=e.tableOptions)==null?void 0:m.getSelectionModel),new Ie(e.headerAreaModel,e.bodyAreaModel,e.footerAreaModel??new O("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(F(t[0]))return;const s=e.rowNumbersVisible===!0?{}:e.rowNumbersVisible,o=new vt(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 N.buildByTypedRows(e.rows??[],e.columnDefs,e.tableOptions??new xe,e.fixedLeftColumnCount??0,e.fixedRightColumnCount??0)}static buildByTypedRows(e,t,s=new xe,o=0,i=0){var c;const r=s.defaultRowHeights,n=((c=t[Ve(t)])==null?void 0:c.property)==="CheckboxColumn";if(e!=null&&e.length&&$(e[0])){const h=e,d=new ue("body",h,r.body,t);return(n||s.showCheckboxWihoutExtraColumn)&&(d.rowSelectionModel=new ve(h)),N.createByAreaModelsParam({headerAreaModel:new _("header",[t.map(u=>u.headerLabel)],r.header),bodyAreaModel:d,footerAreaModel:new _("footer",[],r.footer),columnDefs:t,fixedLeftColumnCount:o,fixedRightColumnCount:i,defaultRowHeights:s.defaultRowHeights,rowCheckboxVisible:!1,columnSizes:[],columnCount:t.length,overridingColumnWidth:-1})}return N.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 N.createByObjectArray(e.rows,e.header??[],e.footer??[],e.fixedLeftColumnCount??0,e.fixedRightColumnCount??0,t,e.defaultRowHeights??new te,e.columnDefs??[],e.columnSizes??[])}static createByAreaModels(e=new O,t,s=new O,o=0,i=0,r=!1,n=new te,l,c=[],h=-1,d){return new Ie(e,t,s,o,i,r,n,l,c,h,d)}static createByAreaModelsParam(e){return N.createByAreaModels(e.headerAreaModel??new O,e.bodyAreaModel,e.footerAreaModel??new O,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 te,l,c=[]){let h;t!=null&&t.length?h=new _("header",t,n.header,l):l!=null&&l.length?h=new _("header",[l.map(f=>f.headerLabel)],n.header,l):h=new O;const d=s?new _("footer",s,n.footer,l):new O,u=new Ot("body",e,l,n.body);return new Ie(h,u,d,o,i,r,n,l,c)}}class ao{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 Qt,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 co{constructor(e,t=0){this.bodyModel=e,this.paddingTop=t,this.headerAreaModel=new O,this.footerAreaModel=new O}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 rt(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 ho{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=si(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 Qi{static createCoverGridModel(e,t,s=200,o=300,i=0,r=0){const n=new ao(e,t,s,o,i,r);return new co(n,r)}static createCoverGrisDefaultOptions(e,t=()=>"CoverGrid"){return{...new xe,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 ho,getStorageKeyFn:t,autoRestoreCollapsedExpandedState:!1,autoRestoreScrollPosition:!0,autoRestoreSortingState:!1,autoRestoreSelectedState:!1}}}}const er=["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"];class uo{constructor(e,t){this.tableModel=e,this.tableOptions=t}}class fo{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 tr extends fo{constructor(e,t,s,o,i,r,n,l){super(e,t,s,o,i,r,n),this.rows=l}}class go{constructor(e,t){this.value=e,this.label=t}}class sr{constructor(e,t){this.index=e,this.px=t}}const or={body:["ge-table-text-align-left"]},ir={body:["ge-table-text-align-center"]},rr={body:["ge-table-text-align-right"]},nr={header:["ge-table-text-align-left"],body:["ge-table-text-align-left"],footer:["ge-table-text-align-left"]},lr={header:["ge-table-text-align-center"],body:["ge-table-text-align-center"],footer:["ge-table-text-align-center"]},ar={header:["ge-table-text-align-right"],body:["ge-table-text-align-right"],footer:["ge-table-text-align-right"]};class Bt{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 cr{constructor(){this.type="CheckboxColumnDef",this.property="CheckboxColumn",this.headerLabel="",this.width=new y(50,"px"),this.minWidth=new y(50,"px"),this.maxWidth=new y(100,"px"),this.rendererMap=new D(new Bt,new Bt,void 0),this.classes=new D([],["ge-table-text-align-left"],[])}}class hr{static body(e){return new D(void 0,e,void 0)}}class dr{constructor(e="down",t){this.status=e,this.originalEvent=t}}class ur{constructor(e,t,s,o,i={}){this.area=e,this.rowIndex=t,this.columnIndex=s,this.value=o,this.cssClasses=i}}class po{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 mo extends po{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}
|
|
326
334
|
childIndex:${this.childIndex}
|
|
327
335
|
row:${this.rowIndex}
|
|
328
336
|
col:${s}
|
|
@@ -334,12 +342,12 @@ render scope: this.lastFullVisibleRowIndex <- `+this.lastFullVisibleRowIndex),th
|
|
|
334
342
|
claimsSpace:${this.claimsSpace()}
|
|
335
343
|
colCount:${o}
|
|
336
344
|
rowSpan:${i}
|
|
337
|
-
pc:${r}`.replace(/[ \n]+/g," ");if(this.children)for(const l of this.children)l.log(e);return n}}class
|
|
345
|
+
pc:${r}`.replace(/[ \n]+/g," ");if(this.children)for(const l of this.children)l.log(e);return n}}class V{static buildColumnDefs(e,t=[]){for(const s of e)s.property&&t.push(W.create({property:s.property,headerLabel:s.data?s.data:s.property,isVisible:()=>typeof s.isVisible=="function"?s.isVisible():!0})),s.children&&V.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 mo(n,s,r,o);i&&(l.leftNeighbour=i,i.rightNeighbour=l),t.push(l),n.children&&(l.children=V.buildGroupExts(n.children,[],s+1,l)),i=l}return t}static flattenGroupExts(e,t=[]){for(const s of e)t.push(s),s.children&&V.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&&V.iterateThrowColumns(e,o.children)}}const gt=class gt{constructor(e=new St){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?gt.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 Ne;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
|
|
338
346
|
data-ge-action="${r}"
|
|
339
347
|
data-area="${t}"
|
|
340
348
|
data-row-index="${s}"
|
|
341
349
|
data-col-index="${o}"
|
|
342
|
-
>${E(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
|
|
350
|
+
>${E(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())}}};gt.toggleHeaderGroup="toggleHeaderGroup";let nt=gt;class bo{constructor(e="header",t,s=[],o,i=new St){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 nt(this.headerGroupOptions),this.groupExts=V.buildGroupExts(t),this.init()}sort(e){}init(){var e;this.arr=this.buildArray(),!((e=this.columnDefs)!=null&&e.length)&&this.areaIdent==="header"&&(this.columnDefs=V.buildColumnDefs(this.groups),this.columnDefs.forEach(t=>Mt(t,t.isVisible)))}getAllLeafs(){return V.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=V.flattenGroupExts(this.groupExts),t=1+Math.max(...e.map(r=>r.rowIndex)),s=[];V.iterateThrowColumns(s,this.groupExts);const o=Array.from(Array(t).keys()).map(r=>[]);return V.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=V.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=V.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?(Mt(i,o.isVisible),i):(Mt(o,o.isVisible),o)});return this.columnDefs=s,s}}class ns{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 fr extends ns{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 wo{constructor(e="collapsed",t=[],s=!1,o=!1){this.mode=e,this.rowIds=t,this.allCollapsed=s,this.allExpanded=o}}class gr extends ns{constructor(e){super(e),this.COLLAPSED_EXPANDED_STATE="collapsedExpandedState",this.collapsedExpandedState=new wo,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 pr extends ns{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 mr{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 br{static bodyRenderer(e){return new D(void 0,e,void 0)}}class wr{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=`
|
|
343
351
|
<input
|
|
344
352
|
type="checkbox"
|
|
345
353
|
data-area="${o}"
|
|
@@ -348,19 +356,19 @@ render scope: this.lastFullVisibleRowIndex <- `+this.lastFullVisibleRowIndex),th
|
|
|
348
356
|
data-property-index="${this.property}"
|
|
349
357
|
data-input-type="checkbox"
|
|
350
358
|
tabindex="-1"
|
|
351
|
-
${
|
|
359
|
+
${h}
|
|
352
360
|
${d}
|
|
353
|
-
class="ge-input-checkbox">`,!this.readonly){const u=e.querySelector(".ge-input-checkbox");u&&u.addEventListener("click",(
|
|
361
|
+
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 yr{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 Cr{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=`
|
|
354
362
|
<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%;">
|
|
355
363
|
<div class="ge-table-label" data-row-index="${t}" data-col-index="${s}" data-area="${o}">${E(l)}</div>
|
|
356
|
-
</div>`}}}class
|
|
364
|
+
</div>`}}}class xr{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 Sr{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 vr{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=`
|
|
357
365
|
<div class="ge-table-label-div"
|
|
358
366
|
data-row-index="${t}"
|
|
359
367
|
data-col-index="${s}"
|
|
360
368
|
data-area="${o}"
|
|
361
369
|
role="img"
|
|
362
|
-
aria-label="${E(this.ariaLabel(
|
|
363
|
-
title="${
|
|
370
|
+
aria-label="${E(this.ariaLabel(c,l))}"
|
|
371
|
+
title="${h}"
|
|
364
372
|
style="position: relative; background: transparent; width: 100%; height: 100%;">
|
|
365
373
|
<div class="ge-table-progress-container"
|
|
366
374
|
style="width:100%;height:50%;padding:0;margin-top:6px;"
|
|
@@ -368,25 +376,25 @@ render scope: this.lastFullVisibleRowIndex <- `+this.lastFullVisibleRowIndex),th
|
|
|
368
376
|
data-col-index="${s}"
|
|
369
377
|
data-area="${o}">
|
|
370
378
|
<div class="ge-table-progress-bar"
|
|
371
|
-
style="width:${
|
|
379
|
+
style="width:${c}%;height:100%;padding:0;margin:0;"
|
|
372
380
|
data-row-index="${t}"
|
|
373
381
|
data-col-index="${s}"
|
|
374
382
|
data-area="${o}">
|
|
375
383
|
</div>
|
|
376
384
|
</div>
|
|
377
|
-
</div>`}}}class
|
|
385
|
+
</div>`}}}class Rr{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="${E(this.ariaLabels.true)}">✅</span>`:r==="false"||r===!1?e.innerHTML=`<span class="ge-false-text-color" role="img" aria-label="${E(this.ariaLabels.false)}">❌</span>`:e.innerText=""}}class Ar{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 Mr{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=`
|
|
378
386
|
<div class="ge-table-label-div">
|
|
379
387
|
<div class="ge-table-label">${E(r)}</div>
|
|
380
|
-
</div>`,(typeof r=="string"||isNaN(r)||r<this.min||r>this.max)&&n.addClass(e,"ge-cell-error"))}}class
|
|
388
|
+
</div>`,(typeof r=="string"||isNaN(r)||r<this.min||r>this.max)&&n.addClass(e,"ge-cell-error"))}}class Er{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=`
|
|
381
389
|
<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%;">
|
|
382
|
-
<div class="ge-table-label" data-row-index="${t}" data-col-index="${s}" data-area="${o}" role="img" aria-label="${E(this.ariaLabel(
|
|
383
|
-
</div>`}}}class
|
|
390
|
+
<div class="ge-table-label" data-row-index="${t}" data-col-index="${s}" data-area="${o}" role="img" aria-label="${E(this.ariaLabel(c))}">${d}</div>
|
|
391
|
+
</div>`}}}class Tr{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 Ir{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=`
|
|
384
392
|
<div class="ge-table-label-div"
|
|
385
393
|
data-row-index="${t}"
|
|
386
394
|
data-col-index="${s}"
|
|
387
395
|
data-area="${o}"
|
|
388
396
|
role="img"
|
|
389
|
-
aria-label="${E(this.ariaLabel(c
|
|
397
|
+
aria-label="${E(this.ariaLabel(h,c))}"
|
|
390
398
|
title="${d}"
|
|
391
399
|
style="position: relative; background: transparent; width: 100%; height: 100%;">
|
|
392
400
|
<div class="ge-table-progress-container"
|
|
@@ -395,13 +403,13 @@ render scope: this.lastFullVisibleRowIndex <- `+this.lastFullVisibleRowIndex),th
|
|
|
395
403
|
data-col-index="${s}"
|
|
396
404
|
data-area="${o}">
|
|
397
405
|
<div class="ge-table-progress-bar"
|
|
398
|
-
style="width:${
|
|
406
|
+
style="width:${h}%;height:100%;padding:0;margin:0;"
|
|
399
407
|
data-row-index="${t}"
|
|
400
408
|
data-col-index="${s}"
|
|
401
409
|
data-area="${o}">
|
|
402
410
|
</div>
|
|
403
411
|
</div>
|
|
404
|
-
</div>`}}}class
|
|
412
|
+
</div>`}}}class kr{render(e,t,s,o,i,r,n){if(r||r===0){e.innerHTML=`
|
|
405
413
|
<div
|
|
406
414
|
class="ge-table-label-div"
|
|
407
415
|
data-row-index="${t}"
|
|
@@ -412,7 +420,7 @@ render scope: this.lastFullVisibleRowIndex <- `+this.lastFullVisibleRowIndex),th
|
|
|
412
420
|
class="ge-table-label"
|
|
413
421
|
data-row-index="${t}"
|
|
414
422
|
data-col-index="${s}"
|
|
415
|
-
data-area="${o}">${E(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
|
|
423
|
+
data-area="${o}">${E(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 ls{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 ee{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 yo{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`
|
|
416
424
|
<button
|
|
417
425
|
type="button"
|
|
418
426
|
tabindex="-1"
|
|
@@ -437,7 +445,7 @@ render scope: this.lastFullVisibleRowIndex <- `+this.lastFullVisibleRowIndex),th
|
|
|
437
445
|
${r}
|
|
438
446
|
class="ge-table-cell-action ge-table-cell-link ${e.elementClass}">
|
|
439
447
|
${e.label}
|
|
440
|
-
</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=
|
|
448
|
+
</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=Be(s),c=Number(o),h=Number(i);return new ls(r,l,t,c,h,n)}return null}getCrudActions(e){return Array.isArray(e)&&e.every(t=>t instanceof ee)?e:this.crudActions}}const Dr=function(a,e,t){return a?Number(a):""};class as{constructor(e){this.options=e}static create(e){return new as(e.map(t=>new go(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=i.getValueAt(t,s);let c=[];for(let d of this.options){const u=d.value===l?" selected ":"";c.push(`<option value="${E(d.value)}" ${u}>${E(d.label)}</option>`)}const h=c.join("");e.innerHTML=`
|
|
441
449
|
<select
|
|
442
450
|
autofocus
|
|
443
451
|
data-listen="change"
|
|
@@ -446,7 +454,7 @@ render scope: this.lastFullVisibleRowIndex <- `+this.lastFullVisibleRowIndex),th
|
|
|
446
454
|
data-col-index="${s}"
|
|
447
455
|
data-input-type="text"
|
|
448
456
|
style="width:100%;height:100%;border:0;padding:0 0 0 8px;"
|
|
449
|
-
class="ge-table-cell-editor-select">${
|
|
457
|
+
class="ge-table-cell-editor-select">${h}</select>`}}}class Pr extends oe{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(v.singleRow(e))}unselectRow(e){this.removeSelection(v.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 Fr{constructor(e,t,s){this.r=e,this.g=t,this.b=s}}class Nt{constructor(e,t,s,o){this.minValue=e,this.minColor=t,this.maxValue=s,this.maxColor=o}}class ke{static normalize(e,t,s,o=0,i=1){return(e-t)/(s-t)*(i-o)+o}static getTwoColorGradientRGB(e,t){const s=ke.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?ke.getTwoColorGradientRGB(e,new Nt(t.minValue,t.minColor,t.middleValue,t.middleColor)):e>t.middleValue?ke.getTwoColorGradientRGB(e,new Nt(t.middleValue,t.middleColor,t.maxValue,t.maxColor)):`rgb(${t.middleColor.r}, ${t.middleColor.g}, ${t.middleColor.b})`}}class Lr{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 Co{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 xo{constructor(e){this.object=e}openDialog(){const e=document.createElement("dialog");e.classList.add("ge-table-crud-object-view"),e.innerHTML=`
|
|
450
458
|
<div class="ge-table-dialog-header">Item</div>
|
|
451
459
|
<div class="ge-table-dialog-content">
|
|
452
460
|
${this.generateHtmlTable(this.object)}
|
|
@@ -468,7 +476,7 @@ render scope: this.lastFullVisibleRowIndex <- `+this.lastFullVisibleRowIndex),th
|
|
|
468
476
|
<tr>
|
|
469
477
|
<td${n?' class="ge-table-crud-object-view-object-child"':""}>${E(i)}</td>
|
|
470
478
|
<td>${E(r)}</td>
|
|
471
|
-
</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
|
|
479
|
+
</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 Cs=new Set(["__proto__","constructor","prototype"]);class me{constructor(e,t,s="Edit Item"){this.idKey=e,this.dialogTitle=s,this.fieldPaths=[],this.object=me.deepCopy(t)}openDialog(e){const t=document.createElement("dialog");t.classList.add("ge-table-crud-object-edit"),this.fieldPaths=[],t.innerHTML=`
|
|
472
480
|
<div class="ge-table-dialog-header">${E(this.dialogTitle)}</div>
|
|
473
481
|
<div class="ge-table-dialog-content">
|
|
474
482
|
<form>${this.generateFields(this.object)}</form>
|
|
@@ -477,9 +485,9 @@ render scope: this.lastFullVisibleRowIndex <- `+this.lastFullVisibleRowIndex),th
|
|
|
477
485
|
<button class="ge-table-dialog-footer-save-button primary">Save</button>
|
|
478
486
|
<button class="ge-table-dialog-footer-cancel-button">Cancel</button>
|
|
479
487
|
</div>
|
|
480
|
-
`,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||
|
|
488
|
+
`,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||Cs.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>${E(r)}</legend>${this.generateFields(n,i)}</fieldset>`);continue}const l=E(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="${E(n)}" />`:typeof n=="boolean"?h=`<input type="checkbox" ${c} ${n?"checked":""} />`:h=`<input type="text" ${c} value="${E(n)}" />`,s.push(`
|
|
481
489
|
<div class="form-field">
|
|
482
490
|
<label for="${l}">${E(r)}</label>
|
|
483
|
-
${
|
|
491
|
+
${h}
|
|
484
492
|
</div>
|
|
485
|
-
`)}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=>It.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 Ss{constructor(){this.urls={list:{url:"",method:"GET"}},this.singleRowActions=[new U("VIEW","View","","","link"),new U("EDIT","Edit","","","link"),new U("CLONE","Clone","","","link"),new U("DELETE","Delete","","","link")],this.tableActions=[new U("CREATE","Create","","","button"),new U("DELETE_SELECTED","Delete Selected","","","button")],this.autoAddActionColumn=!0,this.columnWidths=new Cs,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=>pe(e,"list","GET",{}),this.fetchItem=(e,t)=>pe(e,"read","GET",{id:t}),this.updateItem=(e,t,s)=>pe(e,"update","PATCH",{id:t,item:s}),this.createItem=(e,t)=>pe(e,"create","POST",{item:t}),this.deleteItem=(e,t)=>pe(e,"delete","DELETE",{id:t}),this.getEmptyItem=()=>{}}}function pe(h,e,t,s){var n;const o=(n=h.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:h.getHeadersInit?h.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=>ei(l,r.method,i))}function ei(h,e,t){return h.ok?h.text().then(s=>s?JSON.parse(s):void 0):Promise.reject(new Error(`CrudOptions: ${e} ${t} failed: ${h.status} ${h.statusText}`.trim()))}class ti{constructor(){this.crudOptions=new Ss,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,a;if(t.rows=i,i!=null&&i.length){const c=(r=t.columnDefs)!=null&&r.length?t.columnDefs.map(b=>b.property):this.extractProperties(i[0]),d=new X("row","multi"),u=()=>d;this.tableOptions={...new ae,...t.tableOptions,hoverColumnVisible:!1,getSelectionModel:u};const p=this.calcAutoColumnWidths(i,c),f=(n=t.columnDefs)!=null&&n.length?t.columnDefs:c.map(((b,x)=>new J(b,b.toUpperCase(),new y(p[x],"px"))));if((l=e==null?void 0:e.columnWidths)!=null&&l.autoCalc)for(let b=0;b<f.length;b++){const x=f[b];x.width=new y(p[b],"px")}if(e.autoAddActionColumn){let b=new J(this.getIdKey(),"Actions",ls,new D(["ge-table-text-align-left"],["ge-table-text-align-left ge-table-actions-cell"],void 0));b.rendererMap=new D(void 0,new ws(this,e.singleRowActions),void 0),f.push(b)}const m=0,g=e.calcFixedRightColumnCount(f.length);this.tableModel=K.buildByTypedRowsParam({rows:i,columnDefs:f,tableOptions:this.tableOptions,fixedLeftColumnCount:m,fixedRightColumnCount:g}),this.tableModel.getSelectionModel=u,this.bodyModel=(a=this.tableModel)==null?void 0:a.getBodyModel();const C=new ps(this.tableModel,this.tableOptions);s(C)}},i=>this.logError("loading the list",i))}openDialogForCreate(){if(this.bodyModel){const e=new vt("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 xs(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(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=>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,l,a,c;(r=this.bodyModel)==null||r.filterRowsByPredict(d=>!this.hasId(d,i)),(l=(n=this.tableModel)==null?void 0:n.getTableScope())==null||l.clearSelection(!0),(c=(a=this.tableModel)==null?void 0:a.getTableScope())==null||c.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;const s=(o=this.bodyModel)==null?void 0:o.getAllRows().find(n=>this.hasId(n,e));s&&(Object.assign(s,t),(r=(i=this.tableModel)==null?void 0:i.getTableScope())==null||r.repaint())}addRow(e){var s,o;const t=this.bodyModel;if(t){const i=t.getAllRows(),r=t.getFilteredRows();i.push(e),r!==i&&r.push(e),(o=(s=this.tableModel)==null?void 0:s.getTableScope())==null||o.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 a;const o=t.length;if(!((a=this.crudOptions.columnWidths)!=null&&a.autoCalc))return new Array(o).fill(200);const i=e.length??0,r=new Array(o).fill(0);for(let c=0;c<i;c++)for(let d=0;d<o;d++){const u=t[d],p=this.getValueByT(e[c],u),f=(p==null?void 0:p.toString().length)||0;f>r[d]&&(r[d]=f)}if(this.crudOptions.columnWidths.takeHeaderLabelsIntoAccount)for(let c=0;c<o;c++){const d=s[c].length||0;d>r[c]&&(r[c]=d)}const n=this.crudOptions.columnWidths.minWidth,l=this.crudOptions.columnWidths.maxWidth;return r.map((c,d)=>Math.min(l,Math.max(this.crudOptions.columnWidths.charCountToWidth(c,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 si{constructor(e,t){this.method=e,this.url=t}}exports.ALL_TABLE_STATE_PARTS=j;exports.AbstractAreaModel=Ue;exports.ActionEvent=vt;exports.ActionsCellRenderer=ws;exports.AnyPropertyType=pt;exports.AreaMapFactory=Eo;exports.AreaModel=ko;exports.AreaModelArrayOfArrays=P;exports.AreaModelCellGroups=Fo;exports.AreaModelHidden=L;exports.AreaModelObjectArray=_;exports.AreaModelObjectArrayWithColumndefs=nt;exports.AreaModelTree=xe;exports.AreaObjectMap=D;exports.AriaGridInfo=we;exports.AriaIds=be;exports.AriaTexts=Re;exports.ArrayPropertyType=Y;exports.AutoRestoreOptions=us;exports.AvoidDoubleExecution=As;exports.BooleanPropertyType=Lt;exports.CellGroup=ms;exports.CellGroupExt=bs;exports.CellGroupExtCellRenderer=Oe;exports.CellRange=v;exports.CellgroupFactory=F;exports.CheckboxBooleanPropertyCellRenderer=Oo;exports.CheckboxCellRenderer=lt;exports.CheckboxColumnDef=Mo;exports.CheckboxModel=cs;exports.ChunkData=yo;exports.ColAndRowspanModel=Gt;exports.CollapsedExpandedData=ys;exports.ColorRgb=Zo;exports.ColumnDef=J;exports.ColumnDefGenerator=Ms;exports.ColumnWidths=Cs;exports.ConvenienceDomService=Ie;exports.CopyService=oe;exports.CoverGridBodyModel=ds;exports.CoverGridFactory=mo;exports.CoverGridTableModel=hs;exports.CrudAction=U;exports.CrudObjectEdit=ie;exports.CrudObjectView=xs;exports.CrudOptions=Ss;exports.CrudTableModelFactory=ti;exports.CssVars=it;exports.DateToIntlDDMMYYYYCellRenderer=Bo;exports.DateToIsoCellRenderer=Ho;exports.DateToLocaleDateCellRenderer=No;exports.DateToTecCellRenderer=zo;exports.DefaultRowHeights=se;exports.EleScope=ye;exports.EventAdapter=Le;exports.EventCheckboxChangedHandler=Vs;exports.ExcelService=ns;exports.FalseFn=Ct;exports.FocusModel=Wt;exports.GeCellIndices=qt;exports.GeCssColorUtil=fe;exports.GeFilterService=_o;exports.GeKeyEvent=To;exports.GeModelChangeEvent=Ye;exports.GeMouseEvent=je;exports.GeScrollEvent=Zt;exports.GeStateChangeEvent=Yt;exports.GeoData=O;exports.HeaderGroupOptions=Xe;exports.Icon=H;exports.IndexAndPx=wo;exports.InputCellRenderer=is;exports.InputHandler=Jt;exports.JsonService=Ze;exports.LicenseManager=Q;exports.LiveAnnouncer=_e;exports.MaleFemaleToIconCellRenderer=$o;exports.MouseHandler=Bt;exports.MouseTargetData=ke;exports.MultiRowsSelectionModel=qo;exports.NullPropertyType=Ft;exports.NumberCellProgressBarCellRenderer=Wo;exports.NumberCellRenderer=jo;exports.NumberPropertyType=Pt;exports.ObjectPropertyType=V;exports.OsxShortcutActionIdMapping=es;exports.OverlayOptions=Ke;exports.PROPERTY_TYPE_KEY_ANY=ct;exports.PROPERTY_TYPE_KEY_ARRAY=ut;exports.PROPERTY_TYPE_KEY_BOOLEAN=ze;exports.PROPERTY_TYPE_KEY_NULL=dt;exports.PROPERTY_TYPE_KEY_NUMBER=Ge;exports.PROPERTY_TYPE_KEY_OBJECT=ne;exports.PROPERTY_TYPE_KEY_STRING=ht;exports.PROPERTY_TYPE_KEY_UNDEFINED=re;exports.Padding=Ve;exports.PositiveAndNegativeNumberRenderer=Xo;exports.ProgressBarCellRenderer=Yo;exports.PropertyItem=ft;exports.PropertyTypeService=Es;exports.RenderScope=jt;exports.Renderer=Vo;exports.RequestChunk=fs;exports.ResizeHandler=rs;exports.SchemeGenerator=Ts;exports.SelectCellRenderer=Rt;exports.SelectionModel=X;exports.SelectionService=Ce;exports.ShortcutService=ss;exports.SimpleArrayCellRenderer=Ko;exports.SimpleDomService=os;exports.Size=y;exports.SortItem=Fe;exports.SortedOptions=bt;exports.StarRatingCellRenderer=Uo;exports.StoreStateCollapsedExpandService=Po;exports.StoreStateScrollPosService=Do;exports.StoreStateSortingService=Lo;exports.StringPropertyType=Dt;exports.TableApi=Nt;exports.TableCellUpdateEvent=Io;exports.TableFactory=K;exports.TableModel=Te;exports.TableModelAndOptions=ps;exports.TableOptions=ae;exports.TableOverlay=$t;exports.TableScope=ot;exports.TableStateService=Pe;exports.ThreeColorGradientArg=Qo;exports.TreeAriaInfo=zt;exports.TreeCheckboxModel=Se;exports.TreeFactory=te;exports.TreeOptions=mt;exports.TreeRow=Ee;exports.TreeRowService=as;exports.TrueFalseCellRenderer=Go;exports.TrueFn=wt;exports.TwoColorGradientArg=at;exports.UNIMPORTANT_TYPES=me;exports.UndefinedPropertyType=Me;exports.UrlInfo=si;exports.ValueInfo=_t;exports.ValueLabel=gs;exports.WindowsShortcutActionIdMapping=Qt;exports.actionIds=bo;exports.allCenter=Ro;exports.allLeft=vo;exports.allRight=Ao;exports.bodyCenter=xo;exports.bodyLeft=Co;exports.bodyRight=So;exports.calcOverlayKind=tt;exports.createHarmonizedShortcutByKeyboardEvent=ts;exports.debounce=kt;exports.editInputPipeForNumber=Jo;exports.entitySuffix=Qe;exports.escapeHtml=E;exports.firstLetterUppercase=Ht;exports.getAreaIdentByString=ve;exports.getEntityName=Vt;exports.harmonizeShortcut=xt;exports.isAreaModelTree=B;exports.isCheckboxCellRenderer=gt;exports.isCheckboxColumnDef=et;exports.isTreeRow=N;exports.px0=fo;exports.px10=po;exports.px100=oo;exports.px110=so;exports.px120=to;exports.px130=eo;exports.px140=Qs;exports.px150=Zs;exports.px160=qs;exports.px170=Js;exports.px180=Xs;exports.px190=Ys;exports.px20=uo;exports.px200=rt;exports.px210=Ks;exports.px220=Us;exports.px230=js;exports.px240=zs;exports.px250=Gs;exports.px260=Ws;exports.px270=$s;exports.px280=Ns;exports.px290=Bs;exports.px30=ho;exports.px300=ls;exports.px40=co;exports.px400=Hs;exports.px50=ao;exports.px500=Os;exports.px60=lo;exports.px70=no;exports.px80=ro;exports.px90=io;exports.readLegacyState=Xt;exports.removeLegacyState=st;exports.throttle=vs;exports.trimArraySuffixes=Ot;
|
|
493
|
+
`)}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=>Cs.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 So{constructor(){this.urls={list:{url:"",method:"GET"}},this.singleRowActions=[new ee("VIEW","View","","","link"),new ee("EDIT","Edit","","","link"),new ee("CLONE","Clone","","","link"),new ee("DELETE","Delete","","","link")],this.tableActions=[new ee("CREATE","Create","","","button"),new ee("DELETE_SELECTED","Delete Selected","","","button")],this.autoAddActionColumn=!0,this.columnWidths=new Co,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=>Te(e,"list","GET",{}),this.fetchItem=(e,t)=>Te(e,"read","GET",{id:t}),this.updateItem=(e,t,s)=>Te(e,"update","PATCH",{id:t,item:s}),this.createItem=(e,t)=>Te(e,"create","POST",{item:t}),this.deleteItem=(e,t)=>Te(e,"delete","DELETE",{id:t}),this.getEmptyItem=()=>{}}}function Te(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=>Vr(l,r.method,i))}function Vr(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 Or{constructor(){this.crudOptions=new So,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(b=>b.property):this.extractProperties(i[0]),d=new oe("row","multi"),u=()=>d;this.tableOptions={...new xe,...t.tableOptions,hoverColumnVisible:!1,getSelectionModel:u};const f=this.calcAutoColumnWidths(i,h),g=(n=t.columnDefs)!=null&&n.length?t.columnDefs:h.map(((b,x)=>new W(b,b.toUpperCase(),new y(f[x],"px"))));if((l=e==null?void 0:e.columnWidths)!=null&&l.autoCalc)for(let b=0;b<g.length;b++){const x=g[b];x.width=new y(f[b],"px")}if(e.autoAddActionColumn){let b=new W(this.getIdKey(),"Actions",io,new D(["ge-table-text-align-left"],["ge-table-text-align-left ge-table-actions-cell"],void 0));b.rendererMap=new D(void 0,new yo(this,e.singleRowActions),void 0),g.push(b)}const p=0,w=e.calcFixedRightColumnCount(g.length);this.tableModel=N.buildByTypedRowsParam({rows:i,columnDefs:g,tableOptions:this.tableOptions,fixedLeftColumnCount:p,fixedRightColumnCount:w}),this.tableModel.getSelectionModel=u,this.bodyModel=(c=this.tableModel)==null?void 0:c.getBodyModel();const m=new uo(this.tableModel,this.tableOptions);s(m)}},i=>this.logError("loading the list",i))}openDialogForCreate(){if(this.bodyModel){const e=new ls("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 xo(r).openDialog()).catch(r=>this.logError(o,r)):o==="EDIT"?this.whileLoading(()=>t.fetchItem(t,i)).then(r=>new me(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=>new me(s,r,"Clone Item").openDialog(n=>this.createItem(o,n))).catch(r=>this.logError(o,r)):o==="CREATE"?new me(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 _r{constructor(e,t){this.method=e,this.url=t}}class vo{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 lt(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);Se(f)&&(f=li);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 w=u.format&&!Se(f)?u.format(f):hi(f,t),m=new vo(f,`${w??""}`,d,u.name,h?[...h.path,f]:[f],h,a,he(f));g=[m,{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(m)}h=g[0],c=g[1]}h.sourceIndices.push(n)}return Ro(s,e),s}function Ro(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)Ro(o.children,e)}function Ao(a,e,t){for(const s of a)Eo(s,e,t);return Mo(a,e)}function Mo(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 Eo(a,e,t){if(a.isLeaf()){To(a,e,t);return}for(const s of a.children)Eo(s,e,t);Io(a,e)}function To(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=ko(r,e)}function Io(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=ko(t,e)}function ko(a,e){const t={};return e.forEach((s,o)=>t[s.key]=s.aggregator.result(a[o])),t}const Br="(empty)";function Nr(a,e,t={}){return lt(a,J(e),t.emptyLabel??Br)}function Gr(a,e,t){const s=Object.keys(e??{}).map(o=>He(o,e[o]));return Ao(a,s,t)}const pt=class pt extends W{constructor(e={}){const t={width:new y(220,"px"),showCount:!0,fixed:!0,...e};super(pt.PROPERTY,t.headerLabel??"Group",t.width,new D(["ge-table-row-group-column-header"],["ge-table-row-group-column"],[]),new D,new y(60,"px"),new y(2e3,"px"),Re),this.type="RowGroupColumnDef",this.options=t,this.autoHeaderLabel=e.headerLabel===void 0}};pt.PROPERTY="RowGroupColumn";let k=pt;class ne extends ie{constructor(e,t,s,o){super(e,!1,void 0,t,s),this.sourceIndex=o}}const Hr=new Intl.NumberFormat("en-US");class Do extends ue{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=>He(r,i[r])),this.specByKey=new Map(this.specs.map(r=>[r.key,r])),this.fields=J(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=J(e??[]);this.options.groupBy=[...e??[]],this.fields=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=he(o);if(s=t.find(r=>he(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(L(t))return this.ensureAggregates(),t}getDetailRow(e){const t=this.getRowByIndex(e);return t&&!L(t.data)?t.data:void 0}isGroupRowIndex(e){var t;return L((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)}getValueAt(e,t){const s=this.getRowByIndex(e);if(!s)return"";const o=this.properties[t];if(L(s.data)){this.ensureAggregates();const i=s.data;return o===k.PROPERTY?this.getGroupLabel(i):o!==void 0&&this.specByKey.has(o)?i.results[o]:""}return o===k.PROPERTY?"":super.getValueAt(e,t)}getTextValueAt(e,t){const s=this.getRowByIndex(e),o=this.properties[t];if(s&&L(s.data)&&o!==k.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&&L(s.data)?o!==void 0&&this.specByKey.has(o)?this.textRenderer:void 0:o===k.PROPERTY?void 0:super.getCellRenderer(e,t)}getCustomClassesAt(e,t){const s=super.getCustomClassesAt(e,t),o=this.getRowByIndex(e);if(!o||!L(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===k.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]===k.PROPERTY&&this.isGroupRowIndex(e)}isEditable(e,t){return this.properties[t]===k.PROPERTY||this.isGroupRowIndex(e)?!1:super.isEditable(e,t)}setValue(e,t,s){const o=this.getRowByIndex(e);if(!(o instanceof ne)||this.properties[t]===k.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)=>he(l)!==he(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 ne&&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 ne&&s instanceof ne?e(t.data,s.data):0),this.syncGroupOrder(),this.allDirty=!0}invalidateDerivedValues(e){if((e==null?void 0:e.area)==="body"&&Array.isArray(e.rowIndices)){for(const t of e.rowIndices){const s=this.getRowByIndex(t);s instanceof ne?this.markRowDirty(s):this.allDirty=!0}return}this.allDirty=!0}syncGroupOrder(){const e=t=>(t??[]).filter(s=>L(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} (${Hr.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=Rt(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=Ao(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=>{To(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=>Io(s,this.specs)),this.totals=Mo(this.groups,this.specs)}markRowDirty(e){var s;const t=(s=e.parent)==null?void 0:s.data;L(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===k.PROPERTY;return(r,n)=>{const l=L(r.data),c=L(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=lt(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 ne(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=>Po(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 ie(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 ne(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 Po(a){var t;if(!((t=a.children)!=null&&t.length))return a.checked;let e=!0;for(const s of a.children)Po(s)||(e=!1);return a.checked=e,e}class cs{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 W(f,f.toUpperCase(),it)):[];const o=e.defaultRowHeights??((d=e.tableOptions)==null?void 0:d.defaultRowHeights)??new te;let i=e.fixedLeftColumnCount??0;e.rowNumbersVisible&&!F(s[0])&&(s=[new vt(e.rowNumbersVisible===!0?{}:e.rowNumbersVisible),...s],i++);let r=F(s[0])?1:0;const n=ye(s[r]);n&&r++;const l=new k(e.groupColumn??{});l.autoHeaderLabel&&(l.headerLabel=to(e.groupBy??[],s)),s.splice(r,0,l),l.options.fixed&&(i=Math.max(i,r)+1);const c=new Do(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 ve(c.rows));const h=N.createTableModel({columnDefs:s,bodyAreaModel:c,footerAggregates:cs.footerConfig(e),fixedLeftColumnCount:i,fixedRightColumnCount:e.fixedRightColumnCount??0,rowCheckboxVisible:e.rowCheckboxVisible??n,defaultRowHeights:o,getSelectionModel:e.getSelectionModel,tableOptions:e.tableOptions});return Ft(h),h}static updateLayout(e){return Ft(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 Fo extends W{constructor(e,t,s,o=new y(100,"px")){super(e,t,o,new D(["ge-table-pivot-header",`ge-table-pivot-header-${s.kind}`],[],[]),new D,new y(40,"px"),new y(2e3,"px"),Re),this.pivot=s,this.type="PivotColumnDef"}}const $r=1e3,hs="Total";function Wr(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=ss(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,getValue:r===de.count?void 0:Ge(i.value)}})}const zr="(empty)";class at{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=Wr(t.values),this.values=this.resolved;const o=t.emptyLabel??zr;this.rowGroups=lt(e,J(t.rowFields??[]),o),this.columnGroups=lt(e,J(t.columnFields??[]),o);const i=Math.max(0,t.maxColumns??$r),r=this.allColumnLeaves;Xe(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);Gt(this.columnGroups,this.columnParentsPostOrder,()=>!0),Gt(this.rowGroups,this.rowParentsPostOrder,()=>!0),Xe(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=[];Xe([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 w=0;w<s;w++){const m=t[w].getValue;c[w]=m?m(f):f,l.states[w]=t[w].aggregator.add(l.states[w],c[w])}if(p){p.count++;for(let w=0;w<s;w++)p.states[w]=t[w].aggregator.add(p.states[w],c[w])}}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 jr(a,e,t){return new at(a??[],e,t)}function Xe(a,e){for(const t of a)t.isLeaf()?e.push(t):Xe(t.children,e)}function Gt(a,e,t){for(const s of a)s.isLeaf()||!t(s)||(Gt(s.children,e,t),e.push(s))}function Lo(a,e){return"pivot:"+JSON.stringify([...a.idParts,e.name])}function Vo(a,e){return"pivot:subtotal:"+JSON.stringify([...a.idParts,e.name])}function Ht(a){return"pivot:total:"+JSON.stringify([a.name])}function Ur(a){const e=a.slice(a.lastIndexOf(".")+1);return e.charAt(0).toUpperCase()+e.slice(1)}function Oo(a){return eo(J(a),Ur).join(" › ")}function Kr(a){var e;return a.columnSubtotals??(((e=a.columnFields)==null?void 0:e.length)??0)>1}function _o(a,e,t,s={}){var w;const o=a.values,i=o.length>1,r=e.totalLabel??hs,n=Kr(e),l=(((w=e.columnFields)==null?void 0:w.length)??0)>0,c=s.valueWidth??new y(100,"px"),h=[...t],d=t.map(m=>({data:m.headerLabel,property:m.property})),u=(m,b,x)=>{var S;return h.push(new Fo(m,b,x,((S=s.widths)==null?void 0:S.get(m))??c)),{data:b,property:m}},f=(m,b,x,S,C)=>i?{data:m,visibility:C,children:o.map((R,T)=>u(S(R),R.label,{kind:b,column:x,value:R,valueIndex:T}))}:{...u(S(o[0]),m,{kind:b,column:x,value:o[0],valueIndex:0}),visibility:C},g=m=>{var x;if(!a.isColumnShown(m))return;if(m.isLeaf())return f(m.label,"value",m,S=>Lo(m,S));const b=m.children.map(g).filter(S=>!!S);return n&&b.push(f(`${m.label} ${r}`,"subtotal",m,S=>Vo(m,S),"always")),{id:m.id,data:m.label,toggle:n,closed:n&&!!((x=s.closedIds)!=null&&x.has(m.id)),children:b}};let p=0;if(l){for(const m of a.columnGroups){const b=g(m);b&&d.push(b)}e.totalColumn!==!1&&(d.push(f(r,"total",void 0,m=>Ht(m))),(e.totalColumn===void 0||e.totalColumn==="fixed")&&(p=o.length))}else o.forEach((m,b)=>d.push(u(Ht(m),m.label,{kind:"total",value:m,valueIndex:b})));return{columnDefs:h,cellGroups:d,fixedRightColumnCount:p}}class Bo extends Ie{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(ge);o!=null&&o.autoHeaderLabel&&(o.headerLabel=Oo(s.rowFields??[]));const i=new Set(t.getToggleGroupStates().filter(d=>d.closed).map(d=>d.id)),r=this.columnDefs.filter(Jt),n=new Map(r.map(d=>[d.property,d.width])),l=new Set(r.filter(d=>!Dt(d)).map(d=>d.property)),c=_o(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=>Gs(d,!1)),this.columnDefs=h,this.columnCount=h.length,this.columnSizes=[],this.pivotFixedRightColumnCount=c.fixedRightColumnCount,e.setColumnDefs(h)}}const Yr=new Intl.NumberFormat("en-US");class No extends ue{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 at(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)Jt(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=Ht(o);return this.infoByProperty.has(l)?l:void 0}let i=s.columnGroups,r;for(const l of e){const c=he(l);if(r=i.find(h=>he(h.key)===c),!r)return;i=r.children}const n=r.isLeaf()?Lo(r,o):Vo(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===k.PROPERTY)return i?this.getGroupLabel(i):this.config.totalLabel??hs;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.getResult().getValue(i,r.column,r.valueIndex)}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.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===k.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]===k.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(){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} (${Yr.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===k.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.result.getValue(i.data,s.column,s.valueIndex),l=this.result.getValue(r.data,s.column,s.valueIndex);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=J(this.config.rowFields??[]),this.result=t??new at(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 ie({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 ie(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 Go extends rs{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??hs;const s=this.body.getColumnInfo(t);return s?this.body.getResult().getValue(void 0,s.column,s.valueIndex):""}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.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)===k.PROPERTY}}class Xr extends bo{getCustomClassesAt(e,t){const s=this.getValueAt(e,t);return s?s.ownColumn()?["ge-table-pivot-header-column"]:["ge-table-pivot-header-group"]:[]}}class ds{static createTableModel(e){var f,g,p;const t=e.defaultRowHeights??((f=e.tableOptions)==null?void 0:f.defaultRowHeights)??new te,s=ds.toConfig(e),o=[];e.rowNumbersVisible&&o.push(new vt(e.rowNumbersVisible===!0?{}:e.rowNumbersVisible));const i={showCount:!1,...e.groupColumn??{}},r=new k(i);r.autoHeaderLabel&&(r.headerLabel=Oo(s.rowFields??[])),o.push(r);const n=r.options.fixed?o.length:o.length-1,l=new No(e.rows??[],s,r.options,t.body),c=_o(l.getResult(),s,o,{valueWidth:e.valueColumnWidth}),h=new Xr("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 Go(l,t.footer),u=e.getSelectionModel??((p=e.tableOptions)==null?void 0:p.getSelectionModel)??(()=>{});return new Bo(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=Q;exports.AbstractAreaModel=yt;exports.ActionEvent=ls;exports.ActionsCellRenderer=yo;exports.AggregateCellRenderer=We;exports.Aggregators=de;exports.AnyPropertyType=Ut;exports.AreaMapFactory=hr;exports.AreaModel=rs;exports.AreaModelAggregateFooter=_e;exports.AreaModelArrayOfArrays=_;exports.AreaModelCellGroups=bo;exports.AreaModelHidden=O;exports.AreaModelObjectArray=B;exports.AreaModelObjectArrayWithColumndefs=Ot;exports.AreaModelPivot=No;exports.AreaModelPivotFooter=Go;exports.AreaModelRowGroups=Do;exports.AreaModelTree=ue;exports.AreaObjectMap=D;exports.AriaGridInfo=Oe;exports.AriaIds=Fe;exports.AriaTexts=Ne;exports.ArrayPropertyType=se;exports.AutoRestoreOptions=ho;exports.AvoidDoubleExecution=Wo;exports.BooleanPropertyType=As;exports.CellGroup=po;exports.CellGroupExt=mo;exports.CellGroupExtCellRenderer=nt;exports.CellRange=v;exports.CellgroupFactory=V;exports.CheckboxBooleanPropertyCellRenderer=wr;exports.CheckboxCellRenderer=Bt;exports.CheckboxColumnDef=cr;exports.CheckboxModel=no;exports.ChunkData=tr;exports.ColAndRowspanModel=_s;exports.CollapsedExpandedData=wo;exports.ColorRgb=Fr;exports.ColumnDef=W;exports.ColumnDefGenerator=zo;exports.ColumnWidths=Co;exports.ConvenienceDomService=Je;exports.CopyService=pe;exports.CoverGridBodyModel=ao;exports.CoverGridFactory=Qi;exports.CoverGridTableModel=co;exports.CrudAction=ee;exports.CrudObjectEdit=me;exports.CrudObjectView=xo;exports.CrudOptions=So;exports.CrudTableModelFactory=Or;exports.CssVars=Vt;exports.DateToIntlDDMMYYYYCellRenderer=Cr;exports.DateToIsoCellRenderer=yr;exports.DateToLocaleDateCellRenderer=xr;exports.DateToTecCellRenderer=Ar;exports.DefaultRowHeights=te;exports.EleScope=Le;exports.EventAdapter=st;exports.EventCheckboxChangedHandler=fi;exports.ExcelService=oo;exports.FalseFn=os;exports.FocusModel=Os;exports.GeCellIndices=Us;exports.GeCssColorUtil=ke;exports.GeFilterService=mr;exports.GeKeyEvent=dr;exports.GeModelChangeEvent=xt;exports.GeMouseEvent=wt;exports.GeScrollEvent=Ks;exports.GeStateChangeEvent=Ws;exports.GeoData=z;exports.HeaderGroupOptions=St;exports.Icon=j;exports.IndexAndPx=sr;exports.InputCellRenderer=Qs;exports.InputHandler=js;exports.JsonService=Tt;exports.LicenseManager=ae;exports.LiveAnnouncer=ot;exports.MaleFemaleToIconCellRenderer=Sr;exports.MouseHandler=Ds;exports.MouseTargetData=qe;exports.MultiRowsSelectionModel=Pr;exports.NullPropertyType=Ss;exports.NumberCellProgressBarCellRenderer=vr;exports.NumberCellRenderer=Mr;exports.NumberPropertyType=Rs;exports.ObjectPropertyType=G;exports.OsxShortcutActionIdMapping=Xs;exports.OverlayOptions=Ct;exports.PROPERTY_TYPE_KEY_ANY=$t;exports.PROPERTY_TYPE_KEY_ARRAY=jt;exports.PROPERTY_TYPE_KEY_BOOLEAN=bt;exports.PROPERTY_TYPE_KEY_NULL=Wt;exports.PROPERTY_TYPE_KEY_NUMBER=mt;exports.PROPERTY_TYPE_KEY_OBJECT=we;exports.PROPERTY_TYPE_KEY_STRING=zt;exports.PROPERTY_TYPE_KEY_UNDEFINED=be;exports.Padding=rt;exports.PivotColumnDef=Fo;exports.PivotFactory=ds;exports.PivotResult=at;exports.PivotTableModel=Bo;exports.PositiveAndNegativeNumberRenderer=kr;exports.ProgressBarCellRenderer=Ir;exports.PropertyItem=Kt;exports.PropertyTypeService=jo;exports.RenderScope=Ns;exports.Renderer=br;exports.RequestChunk=fo;exports.ResizeHandler=so;exports.RowGroup=vo;exports.RowGroupColumnDef=k;exports.RowGroupFactory=cs;exports.RowNumberCellRenderer=lo;exports.RowNumberColumnDef=vt;exports.RowNumberOptions=_t;exports.SchemeGenerator=Uo;exports.SelectCellRenderer=as;exports.SelectionAggregator=Ze;exports.SelectionModel=oe;exports.SelectionService=ce;exports.ShortcutService=qs;exports.SimpleArrayCellRenderer=Tr;exports.SimpleDomService=Zs;exports.Size=y;exports.SortItem=Qe;exports.SortedOptions=Zt;exports.StarRatingCellRenderer=Er;exports.StoreStateCollapsedExpandService=gr;exports.StoreStateScrollPosService=fr;exports.StoreStateSortingService=pr;exports.StringPropertyType=vs;exports.TableApi=Ls;exports.TableCellUpdateEvent=ur;exports.TableFactory=N;exports.TableModel=Ie;exports.TableModelAndOptions=uo;exports.TableOptions=xe;exports.TableOverlay=Vs;exports.TableScope=Lt;exports.TableStateService=tt;exports.ThreeColorGradientArg=Lr;exports.TreeAriaInfo=Bs;exports.TreeCheckboxModel=ve;exports.TreeFactory=fe;exports.TreeOptions=qt;exports.TreeRow=ie;exports.TreeRowService=ro;exports.TrueFalseCellRenderer=Rr;exports.TrueFn=Re;exports.TwoColorGradientArg=Nt;exports.UNIMPORTANT_TYPES=Pe;exports.UndefinedPropertyType=Ye;exports.UrlInfo=_r;exports.ValueInfo=Ms;exports.ValueLabel=go;exports.WindowsShortcutActionIdMapping=Ys;exports.actionIds=er;exports.aggregate=Yi;exports.aggregateColumns=Xi;exports.aggregateRowGroups=Gr;exports.allCenter=lr;exports.allLeft=nr;exports.allRight=ar;exports.bodyCenter=ir;exports.bodyLeft=or;exports.bodyRight=rr;exports.calcOverlayKind=kt;exports.createHarmonizedShortcutByKeyboardEvent=Js;exports.createValueGetter=Ge;exports.debounce=xs;exports.editInputPipeForNumber=Dr;exports.entitySuffix=It;exports.escapeHtml=E;exports.firstLetterUppercase=Is;exports.formatAggregateValue=$e;exports.getAggregator=ss;exports.getAreaIdentByString=Be;exports.getEntityName=Es;exports.getLeadingRowNumberColumnCount=Ve;exports.groupRows=Nr;exports.harmonizeShortcut=is;exports.isAreaModelAggregateFooter=ks;exports.isAreaModelPivot=Yo;exports.isAreaModelRowGroups=X;exports.isAreaModelTree=H;exports.isCheckboxCellRenderer=Yt;exports.isCheckboxColumnDef=ye;exports.isGroupRow=Ko;exports.isPivotColumnDef=Jt;exports.isPivotTableModel=Xt;exports.isRowGroup=L;exports.isRowGroupColumnDef=ge;exports.isRowNumberColumnDef=F;exports.isTreeRow=$;exports.pivotRows=jr;exports.px0=zi;exports.px10=Wi;exports.px100=Li;exports.px110=Fi;exports.px120=Pi;exports.px130=Di;exports.px140=ki;exports.px150=Ii;exports.px160=Ti;exports.px170=Ei;exports.px180=Mi;exports.px190=Ai;exports.px20=$i;exports.px200=it;exports.px210=Ri;exports.px220=vi;exports.px230=Si;exports.px240=xi;exports.px250=Ci;exports.px260=yi;exports.px270=wi;exports.px280=bi;exports.px290=mi;exports.px30=Hi;exports.px300=io;exports.px40=Gi;exports.px400=pi;exports.px50=Ni;exports.px500=gi;exports.px60=Bi;exports.px70=_i;exports.px80=Oi;exports.px90=Vi;exports.readLegacyState=zs;exports.removeLegacyState=Pt;exports.throttle=Ho;exports.trimArraySuffixes=Ts;
|