@guiexpert/table 1.1.90 → 1.1.91

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.
Files changed (205) hide show
  1. package/README.md +3 -1
  2. package/css/main.css +50 -4
  3. package/css/table-classes.css +30 -0
  4. package/css/table-color-classes.css +3 -1
  5. package/css/table-color-vars.css +4 -2
  6. package/css/table-tree.css +13 -1
  7. package/index.cjs +80 -89
  8. package/index.d.ts +192 -184
  9. package/index.js +3229 -1580
  10. package/lib/common/debounce.d.ts +1 -0
  11. package/lib/common/decorator/avoid-double-execution.decorator.d.ts +2 -0
  12. package/lib/common/escape-html.d.ts +22 -0
  13. package/lib/common/generator/column-def-generator-service.d.ts +2 -1
  14. package/lib/common/generator/domain/property-type.d.ts +19 -0
  15. package/lib/common/generator/domain/value-info.d.ts +2 -1
  16. package/lib/common/generator/json-service.d.ts +1 -0
  17. package/lib/common/generator/property-type.service.d.ts +3 -2
  18. package/lib/common/generator/scheme-generator-service.d.ts +3 -1
  19. package/lib/common/generator/string-util.d.ts +7 -0
  20. package/lib/common/throttle.d.ts +1 -0
  21. package/lib/table/action/action-id.type.d.ts +5 -1
  22. package/lib/table/action/on-action-triggered.if.d.ts +2 -1
  23. package/lib/table/action/osx-shortcut-actionId-mapping.d.ts +3 -1
  24. package/lib/table/action/shortcut-actionid-mapping.type.d.ts +3 -1
  25. package/lib/table/action/shortcut-util.d.ts +12 -0
  26. package/lib/table/action/shortcut.service.d.ts +5 -3
  27. package/lib/table/action/windows-shortcut-actionId-mapping.d.ts +3 -1
  28. package/lib/table/aria/aria-grid-info.d.ts +76 -0
  29. package/lib/table/aria/aria-ids.d.ts +56 -0
  30. package/lib/table/aria/aria-texts.d.ts +34 -0
  31. package/lib/table/aria/aria-texts.if.d.ts +88 -0
  32. package/lib/table/aria/live-announcer.d.ts +53 -0
  33. package/lib/table/aria/tree-aria-info.d.ts +58 -0
  34. package/lib/table/checkbox/all-rows-checkbox-model.d.ts +31 -0
  35. package/lib/table/checkbox/checkbox-model.d.ts +3 -2
  36. package/lib/table/checkbox/checkbox-model.if.d.ts +2 -1
  37. package/lib/table/checkbox/tree-checkbox-model.d.ts +19 -4
  38. package/lib/table/color/color-rgb.d.ts +2 -1
  39. package/lib/table/color/color-rgb.if.d.ts +2 -0
  40. package/lib/table/color/ge-css-color-util.d.ts +25 -2
  41. package/lib/table/color/three-color-gradient-arg.d.ts +3 -2
  42. package/lib/table/color/three-color-gradient-arg.if.d.ts +3 -1
  43. package/lib/table/color/two-color-gradient-arg.d.ts +3 -2
  44. package/lib/table/color/two-color-gradient-arg.if.d.ts +3 -1
  45. package/lib/table/crud/column-widths.d.ts +2 -1
  46. package/lib/table/crud/column-widths.if.d.ts +1 -0
  47. package/lib/table/crud/crud-action.d.ts +1 -0
  48. package/lib/table/crud/crud-object-edit.d.ts +25 -3
  49. package/lib/table/crud/crud-object-view.d.ts +6 -0
  50. package/lib/table/crud/crud-options.d.ts +35 -4
  51. package/lib/table/crud/crud-options.if.d.ts +3 -2
  52. package/lib/table/crud/crud-table-model-factory.d.ts +64 -8
  53. package/lib/table/crud/url-info.d.ts +2 -1
  54. package/lib/table/crud/url-info.if.d.ts +1 -0
  55. package/lib/table/crud/urls.if.d.ts +2 -1
  56. package/lib/table/css-vars.d.ts +1 -0
  57. package/lib/table/data/chunk/chunk.data-event.d.ts +3 -2
  58. package/lib/table/data/chunk/chunk.data-event.if.d.ts +2 -1
  59. package/lib/table/data/chunk/request-chunk.d.ts +2 -1
  60. package/lib/table/data/chunk/request-chunk.if.d.ts +1 -0
  61. package/lib/table/data/common/aligns.d.ts +18 -0
  62. package/lib/table/data/common/area-map-factory.d.ts +3 -2
  63. package/lib/table/data/common/area-map.d.ts +3 -1
  64. package/lib/table/data/common/area-map.type.d.ts +1 -0
  65. package/lib/table/data/common/args-adjust-columns-to-row-parent-params.d.ts +6 -4
  66. package/lib/table/data/common/args-render-cell-div.d.ts +5 -3
  67. package/lib/table/data/common/boolean-function.d.ts +10 -0
  68. package/lib/table/data/common/cell-range.d.ts +16 -7
  69. package/lib/table/data/common/checkbox-column-def.d.ts +6 -4
  70. package/lib/table/data/common/checked-type.d.ts +2 -0
  71. package/lib/table/data/common/event/ge-cell-indices.d.ts +2 -0
  72. package/lib/table/data/common/event/ge-key-event.d.ts +2 -0
  73. package/lib/table/data/common/event/ge-model-change-event.d.ts +16 -2
  74. package/lib/table/data/common/event/ge-mouse-event.d.ts +52 -4
  75. package/lib/table/data/common/event/ge-scroll-event.d.ts +27 -1
  76. package/lib/table/data/common/event/input/table-cell-update-event.d.ts +14 -10
  77. package/lib/table/data/common/event/input/table-cell-update-event.if.d.ts +3 -1
  78. package/lib/table/data/common/filter-function.d.ts +2 -0
  79. package/lib/table/data/common/get-t.d.ts +2 -0
  80. package/lib/table/data/common/index-and-px.d.ts +2 -0
  81. package/lib/table/data/common/size-unit.type.d.ts +2 -0
  82. package/lib/table/data/common/size.d.ts +13 -2
  83. package/lib/table/data/common/size.if.d.ts +3 -1
  84. package/lib/table/data/common/sizes.d.ts +133 -1
  85. package/lib/table/data/common/sort-item.d.ts +16 -3
  86. package/lib/table/data/common/sort-state.type.d.ts +2 -0
  87. package/lib/table/data/common/tree-arrow.type.d.ts +2 -0
  88. package/lib/table/data/common/tree-row-if.d.ts +22 -1
  89. package/lib/table/data/common/tree-row.d.ts +3 -1
  90. package/lib/table/data/common/value-label.d.ts +2 -1
  91. package/lib/table/data/common/value-label.if.d.ts +1 -0
  92. package/lib/table/data/div-scope.type.d.ts +2 -0
  93. package/lib/table/data/event/mouse-target-data.d.ts +5 -3
  94. package/lib/table/data/geo-data.d.ts +2 -0
  95. package/lib/table/data/options/auto-restore-options.d.ts +32 -1
  96. package/lib/table/data/options/auto-restore-options.if.d.ts +8 -0
  97. package/lib/table/data/options/default-row-heights.d.ts +20 -2
  98. package/lib/table/data/options/default-row-heights.if.d.ts +4 -1
  99. package/lib/table/data/options/header-group-options.d.ts +3 -2
  100. package/lib/table/data/options/header-group-options.if.d.ts +3 -4
  101. package/lib/table/data/options/icon.d.ts +2 -1
  102. package/lib/table/data/options/icon.if.d.ts +2 -0
  103. package/lib/table/data/options/sorted-options.d.ts +3 -2
  104. package/lib/table/data/options/sorted-options.if.d.ts +3 -1
  105. package/lib/table/data/options/table-options.d.ts +37 -13
  106. package/lib/table/data/options/table-options.if.d.ts +117 -44
  107. package/lib/table/data/options/tree-options.d.ts +3 -2
  108. package/lib/table/data/options/tree-options.if.d.ts +3 -1
  109. package/lib/table/data/side-ident.type.d.ts +2 -0
  110. package/lib/table/data/table-model-and-options.d.ts +5 -3
  111. package/lib/table/data/table-model-and-options.if.d.ts +4 -2
  112. package/lib/table/data/tablemodel/area-ident.type.d.ts +4 -0
  113. package/lib/table/data/tablemodel/areamodel/abstract-area-model.d.ts +10 -9
  114. package/lib/table/data/tablemodel/areamodel/area-model-array-of-arrays.d.ts +6 -4
  115. package/lib/table/data/tablemodel/areamodel/area-model-cell-groups.d.ts +13 -12
  116. package/lib/table/data/tablemodel/areamodel/area-model-hidden.d.ts +9 -7
  117. package/lib/table/data/tablemodel/areamodel/area-model-object-array-with-columndefs.d.ts +16 -14
  118. package/lib/table/data/tablemodel/areamodel/area-model-object-array.d.ts +35 -31
  119. package/lib/table/data/tablemodel/areamodel/area-model-tree.d.ts +153 -11
  120. package/lib/table/data/tablemodel/areamodel/area-model.d.ts +66 -104
  121. package/lib/table/data/tablemodel/areamodel/area-model.if.d.ts +56 -50
  122. package/lib/table/data/tablemodel/areamodel/async-area-model-object-array.d.ts +5 -5
  123. package/lib/table/data/tablemodel/areamodel/col-and-rowspan-model.d.ts +14 -3
  124. package/lib/table/data/tablemodel/areamodel/cover-grid-body-model.d.ts +10 -8
  125. package/lib/table/data/tablemodel/areamodel/has-default-row-height-if.d.ts +1 -0
  126. package/lib/table/data/tablemodel/areamodel/object-array-holder.if.d.ts +1 -0
  127. package/lib/table/data/tablemodel/cellgroup/cell-group-ext.d.ts +3 -2
  128. package/lib/table/data/tablemodel/cellgroup/cell-group.d.ts +2 -1
  129. package/lib/table/data/tablemodel/cellgroup/cell-group.if.d.ts +28 -0
  130. package/lib/table/data/tablemodel/cellgroup/cellgroup-factory.d.ts +4 -3
  131. package/lib/table/data/tablemodel/column/column-def.d.ts +67 -10
  132. package/lib/table/data/tablemodel/column/column-def.if.d.ts +63 -96
  133. package/lib/table/data/tablemodel/column/column-visibility.d.ts +6 -0
  134. package/lib/table/data/tablemodel/cover-grid-table-model.d.ts +11 -10
  135. package/lib/table/data/tablemodel/padding.d.ts +2 -0
  136. package/lib/table/data/tablemodel/table-model.d.ts +75 -14
  137. package/lib/table/data/tablemodel/table-model.if.d.ts +52 -8
  138. package/lib/table/ele-scope.d.ts +36 -5
  139. package/lib/table/event-adapter.d.ts +17 -10
  140. package/lib/table/event-checkbox-changed-handler.d.ts +2 -1
  141. package/lib/table/event-listener.if.d.ts +42 -9
  142. package/lib/table/factory/cover-grid-factory.d.ts +4 -3
  143. package/lib/table/factory/table-factory.d.ts +103 -64
  144. package/lib/table/factory/tree-factory.d.ts +45 -3
  145. package/lib/table/focus/event-focus-changed-listener.if.d.ts +5 -3
  146. package/lib/table/focus/focus-model.d.ts +7 -5
  147. package/lib/table/focus/focus-model.if.d.ts +22 -1
  148. package/lib/table/focus/focus.type.d.ts +2 -0
  149. package/lib/table/input-handler.d.ts +5 -1
  150. package/lib/table/instanceof-workaround.d.ts +16 -0
  151. package/lib/table/license-manager.d.ts +2 -0
  152. package/lib/table/mouse-handler.d.ts +18 -9
  153. package/lib/table/render-scope.d.ts +115 -25
  154. package/lib/table/renderer/action/action-event-listener.if.d.ts +2 -1
  155. package/lib/table/renderer/action/action-event.d.ts +4 -3
  156. package/lib/table/renderer/action/action-event.if.d.ts +2 -1
  157. package/lib/table/renderer/action/actions-cell-renderer.d.ts +8 -7
  158. package/lib/table/renderer/cell-group-ext-cell-renderer.d.ts +8 -7
  159. package/lib/table/renderer/cell-render.if.d.ts +41 -4
  160. package/lib/table/renderer/checkbox-boolean-property-cell-renderer.d.ts +7 -5
  161. package/lib/table/renderer/checkbox-cell-renderer.d.ts +8 -5
  162. package/lib/table/renderer/date-to-int-date-cell-renderer.d.ts +6 -5
  163. package/lib/table/renderer/date-to-iso-cell-renderer.d.ts +6 -5
  164. package/lib/table/renderer/date-to-locale-date-cell-renderer.d.ts +6 -5
  165. package/lib/table/renderer/date-to-tec-cell-renderer.d.ts +6 -5
  166. package/lib/table/renderer/edit/edit-cell-renderer.type.d.ts +2 -1
  167. package/lib/table/renderer/edit/edit-input-pipe-for-number.d.ts +2 -1
  168. package/lib/table/renderer/edit/edit-input-pipe.if.d.ts +2 -0
  169. package/lib/table/renderer/edit/input-cell-renderer.d.ts +6 -5
  170. package/lib/table/renderer/edit/select-cell-renderer.d.ts +7 -6
  171. package/lib/table/renderer/male-female-to-icon-cell-renderer.d.ts +19 -6
  172. package/lib/table/renderer/number-cell-progress-bar-cell-renderer.d.ts +11 -6
  173. package/lib/table/renderer/number-cell-renderer.d.ts +6 -5
  174. package/lib/table/renderer/positive-and-negative-number-renderer.d.ts +6 -5
  175. package/lib/table/renderer/progress-bar-cell-renderer.d.ts +12 -6
  176. package/lib/table/renderer/renderer-cleanup-fn.type.d.ts +1 -0
  177. package/lib/table/renderer/renderer.d.ts +3 -2
  178. package/lib/table/renderer/simple-array-cell-renderer.d.ts +6 -5
  179. package/lib/table/renderer/star-rating-cell-renderer.d.ts +12 -6
  180. package/lib/table/renderer/true-false-cell-renderer.d.ts +17 -5
  181. package/lib/table/resize-handler.d.ts +3 -1
  182. package/lib/table/selection/event-selection-changed-listener.if.d.ts +2 -1
  183. package/lib/table/selection/multi-rows-selection-model.d.ts +7 -4
  184. package/lib/table/selection/selection-model.d.ts +112 -10
  185. package/lib/table/selection/selection-model.if.d.ts +48 -3
  186. package/lib/table/selection/selection-service.d.ts +35 -7
  187. package/lib/table/selection/selection.type.d.ts +3 -0
  188. package/lib/table/service/abstract-store-state.service.d.ts +1 -1
  189. package/lib/table/service/convenience-dom.service.d.ts +36 -13
  190. package/lib/table/service/copy-service.d.ts +18 -4
  191. package/lib/table/service/copy-service.if.d.ts +4 -3
  192. package/lib/table/service/data/collapsed-expanded.data.d.ts +1 -0
  193. package/lib/table/service/data/html-style.type.d.ts +1 -0
  194. package/lib/table/service/dom-service.if.d.ts +30 -0
  195. package/lib/table/service/excel-service.d.ts +24 -1
  196. package/lib/table/service/excel-service.if.d.ts +7 -0
  197. package/lib/table/service/ge-filter.service.d.ts +1 -0
  198. package/lib/table/service/simple-dom-service.d.ts +3 -1
  199. package/lib/table/service/store-state-collapsed-expand.service.d.ts +4 -3
  200. package/lib/table/service/store-state-scroll-pos.service.d.ts +3 -2
  201. package/lib/table/service/store-state-sorting.service.d.ts +4 -3
  202. package/lib/table/service/tree-row.service.d.ts +5 -1
  203. package/lib/table/table-api.d.ts +296 -550
  204. package/lib/table/table-scope.d.ts +213 -86
  205. package/package.json +23 -8
package/index.cjs CHANGED
@@ -1,9 +1,9 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});function zt(h,e=500){let t=null,o=0;return function(...s){const i=Date.now(),r=e-(i-o);r<=0?(h.apply(this,s),o=i):t||(t=window.setTimeout(()=>{h.apply(this,s),o=Date.now(),t=null},r))}}function Ue(h,e=500){let t=null;return function(...o){t&&window.clearTimeout(t),t=window.setTimeout(()=>{h.apply(this,o),t=null},e)}}function jt(h=500){return function(e,t,o){let s=0;const i=o.value;return o.value=function(...r){if(!(Date.now()-s<h))return s=Date.now(),i.apply(this,r)},o}}const Fe="any",K="undefined",_e="null",Le="string",me="number",be="boolean",Oe="Array",X="object",Q=[_e,K,Fe];class Ve{constructor(e){this.propertyName=e,this.type=Fe}}class re{constructor(e){this.propertyName=e,this.type=K}}class Ke{constructor(e){this.propertyName=e,this.type=_e}}class Xe{constructor(e){this.propertyName=e,this.type=Le}}class Je{constructor(e){this.propertyName=e,this.type=me}}class qe{constructor(e){this.propertyName=e,this.type=be}}class ${constructor(e,t=[]){this.propertyName=e,this.items=t,this.type=Oe}}class He{constructor(e,t=[]){this.propertyName=e,this.types=t}toString(){return`PropertyItem(propertyName: ${this.propertyName}, types: [${this.types.map(e=>e.type).join(", ")}])`}}class L{constructor(e,t,o=[]){this.propertyName=e,this.className=t,this.properties=o,this.type=X}}class Yt{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 o=[];if(!this.rootPropertyType)return o;if(e instanceof $){const s=e.items.find(i=>i.type===X);if(s&&s instanceof L){const i=s.properties;o.push(" const columnDefs: ColumnDefIf[] = ["),this.iteratePropertyItems(o,i,""),o.push(" ];")}}return[...o,...this.bufCustomRenderer]}iteratePropertyItems(e,t,o=""){for(let s=0;s<t.length;s++){let r=t[s].types.filter(n=>!Q.includes(n.type));if(r.length===1){let n=r[0];const l=o?[o,n.propertyName].join("."):n.propertyName;if(n instanceof L)this.iteratePropertyItems(e,n.properties,l);else{let c="";if(n instanceof $){const f=n.items.find(m=>m.type===X);f&&f instanceof L&&(c=f.className)}const a=this.getReadableColumnLabel(l);let d=100,u="",p="ge-table-text-align-left";if(n.type===Oe){if(this.allowCustomRenderer&&c){const f=`${c}ArrayCellRenderer`;u=` bodyRenderer: new ${f}(),`,p="",this.renderCumstomCellRenderer(c,f)}else u=" bodyRenderer: new SimpleArrayCellRenderer(),";d=250}else n.type===me?(u=" bodyRenderer: new NumberCellRenderer(),",p="ge-table-text-align-right"):n.type===be&&(u=" bodyRenderer: new TrueFalseCellRenderer(),",p="ge-table-text-align-center",d=80);e.push(` ColumnDef.create({
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});function hs(h,e=500){let t=null,s=0;return function(...o){const i=Date.now(),r=e-(i-s);r<=0?(h.apply(this,o),s=i):t||(t=window.setTimeout(()=>{h.apply(this,o),s=Date.now(),t=null},r))}}function wt(h,e=500){let t=null;return function(...s){t&&window.clearTimeout(t),t=window.setTimeout(()=>{h.apply(this,s),t=null},e)}}const us={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"};function E(h){return h==null?"":String(h).replace(/[&<>"']/g,e=>us[e])}function ps(h=500){return function(e,t,s){let o=0;const i=s.value;return s.value=function(...r){if(!(Date.now()-o<h))return o=Date.now(),i.apply(this,r)},s}}const et="any",ee="undefined",tt="null",st="string",Ve="number",He="boolean",ot="Array",te="object",he=[tt,ee,et];class it{constructor(e){this.propertyName=e,this.type=et}}class xe{constructor(e){this.propertyName=e,this.type=ee}}class Ct{constructor(e){this.propertyName=e,this.type=tt}}class xt{constructor(e){this.propertyName=e,this.type=st}}class St{constructor(e){this.propertyName=e,this.type=Ve}}class At{constructor(e){this.propertyName=e,this.type=He}}class j{constructor(e,t=[]){this.propertyName=e,this.items=t,this.type=ot}}class rt{constructor(e,t=[]){this.propertyName=e,this.types=t}toString(){return`PropertyItem(propertyName: ${this.propertyName}, types: [${this.types.map(e=>e.type).join(", ")}])`}}class V{constructor(e,t,s=[]){this.propertyName=e,this.className=t,this.properties=s,this.type=te}}class fs{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 j){const o=e.items.find(i=>i.type===te);if(o&&o instanceof V){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=>!he.includes(n.type));if(r.length===1){let n=r[0];const l=s?[s,n.propertyName].join("."):n.propertyName;if(n instanceof V)this.iteratePropertyItems(e,n.properties,l);else{let c="";if(n instanceof j){const g=n.items.find(w=>w.type===te);g&&g instanceof V&&(c=g.className)}const a=this.getReadableColumnLabel(l);let d=100,u="",p="ge-table-text-align-left";if(n.type===ot){if(this.allowCustomRenderer&&c){const g=`${c}ArrayCellRenderer`;u=` bodyRenderer: new ${g}(),`,p="",this.renderCumstomCellRenderer(c,g)}else u=" bodyRenderer: new SimpleArrayCellRenderer(),";d=250}else n.type===Ve?(u=" bodyRenderer: new NumberCellRenderer(),",p="ge-table-text-align-right"):n.type===He&&(u=" bodyRenderer: new TrueFalseCellRenderer(),",p="ge-table-text-align-center",d=80);e.push(` ColumnDef.create({
2
2
  property: "${l}",
3
3
  headerLabel: "${a}",
4
4
  width: new Size(${d}, "px"),
5
5
  bodyClasses: ["${p}"],
6
- headerClasses: ["${p}"],`),u&&e.push(u),e.push(" }),")}}}}transformLabel(e){return this.LABEL_MAPPINGS[e]||e}getReadableColumnLabel(e){const o=e.split(".").map(s=>{const i=s.replace(/([a-z])([A-Z])/g,"$1 $2");return i.charAt(0).toUpperCase()+i.slice(1)});for(let s=0;s<o.length;s++)o[s]=this.transformLabel(o[s]);return o.join(" ")}renderCumstomCellRenderer(e,t){this.bufCustomRenderer.push(`
6
+ headerClasses: ["${p}"],`),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,31 +38,24 @@ export class ${t} implements CellRendererIf {
38
38
 
39
39
  }
40
40
 
41
- `)}}class ve{fixJSON(e){const t=[];let o="",s=!1,i=!1;for(let r=0;r<e.length;r++){const n=e[r];if(o+=n,n==='"'&&!i&&(s=!s),n==="\\"&&!i){i=!0;continue}else i=!1;if(!s){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==="{"?o+="}":r==="["&&(o+="]")}return o}}class Ze{constructor(){this.property="",this.value="",this.path="",this.propertyItem=new He("",[new Ve("")])}toString(){var e;return`${this.path} -> : ${((e=this.propertyItem)==null?void 0:e.toString())??""}`}}const Re="Entity";function Qe(h){let e=et(tt(h));return e.includes(Re)||(e=e+Re),e}function et(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 tt(h){return!h||h.length===0?"":h[0].toUpperCase()+h.slice(1)}class Ut{constructor(){this.debugging=!1}json2PropertyType(e,t=""){let o;if(typeof e=="string"){const s=new ve().fixJSON(e);o=this.json2Object(s)}else o=e;return this.object2PropertyType(o,t)}json2Object(e){return JSON.parse(e)}object2PropertyType(e,t=""){const o=this.object2ValueInfos(e,t);this.debugging&&this.logValueInfos(o);const s=this.valueInfos2PropertyType(o);return"name"in s&&(s.name=t),s}json2ValueInfos(e,t=""){let o;if(typeof e=="string"){const s=new ve().fixJSON(e);o=this.json2Object(s)}else o=e;return this.object2ValueInfos(o,t)}object2ValueInfos(e,t=""){const o=this.extractValueInfos(e,t),s=this.mergeValueInfos(o);return s.length>0&&(s[0].propertyItem.propertyName=t),this.debugging&&this.logValueInfos(s),s}getParentPath(e){const t=e.lastIndexOf("/");return t===-1?"":e.substring(0,t)}valueInfos2PropertyType(e){const t=e[0].propertyItem.types[0],o=new Map;for(const s of e)o.set(s.path,s);for(const s of e){const i=this.getParentPath(s.path);if(i){const r=o.get(i);if(r){let n=!1;const l=r.propertyItem.types.filter(c=>!Q.includes(c.type));if(l.length===1){const c=l[0];if(c instanceof $){n=!0;for(const a of s.propertyItem.types)c.items.push(a)}else c instanceof L&&(n=!0,c.properties.push(s.propertyItem))}if(!n)for(const c of s.propertyItem.types)r.propertyItem.types.push(c)}}}return t||new Ve("")}logValueInfos(e){for(let t=0;t<e.length;t++){const o=e[t];o.value=null;const s=t.toString().padStart(2,"0");console.info(s+") "+o.toString()+" parent: "+this.getParentPath(o.path))}}mergeValueInfos(e){const t=[];let o=e.length-1;t.push(e[o]);let s=e[o].path;for(let i=o-1;i>=0;i--){if(e[i].path===s){const r=e[i].propertyItem.types[0];e[o].propertyItem.types.some(n=>n.type===r.type)||e[o].propertyItem.types.push(r)}(i===0||e[i].path!==s)&&(o=i,t.push(e[i]),s=e[o].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,a=this.countPath(e,i.path);c>a&&(i.propertyItem.types.some(d=>d.type===K)||i.propertyItem.types.push(new re(i.property)))}}}}return t.reverse(),t}countPath(e,t){let o=0;for(const s of e)s.path===t&&o++;return o}getFirstValueInfoByPath(e,t){for(let o=e.length-1;o>=0;o--)if(e[o].path===t)return e[o];return null}extractValueInfos(e,t){const o=[],s=(i,r,n)=>{const l=new Ze;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),o.push(l),i&&typeof i===X&&!Array.isArray(i)){for(const a in i)if(i.hasOwnProperty(a)){const d=r?`${r}/${a}`:a;s(i[a],d,c)}}else Array.isArray(i)&&i.forEach((a,d)=>{const u=`${r}/[]`;s(a,u,c)})};return s(e,"root",t),o.sort((i,r)=>i.path.localeCompare(r.path))}createPropertyItem(e,t){return new He(t,[this.createPropertyType(e,t)])}createPropertyType(e,t){return e===null?new Ke(t):e===void 0?new re(t):typeof e===Le?new Xe(t):typeof e===me&&!isNaN(e)?new Je(t):typeof e===be?new qe(t):Array.isArray(e)?new $(t):typeof e===X?new L(t,Qe(t)):new re(t)}}class Kt{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 o=this.renderTypeScriptInterfacesFifo.shift();o&&this.renderTypeScriptInterfacesRecursive(o,e,o.propertyName)}}renderTypeScriptInterfacesRecursive(e=this.rootPropertyType,t=[],o=this.rootName){if(!e)return t;if(e instanceof $){for(const s of e.items)if(this.renderTypeScriptInterfacesRecursive(s,t,o),s instanceof L){const i=s;i!==this.rootPropertyType&&this.renderTypeScriptInterfacesFifo.push(i)}}else if(e instanceof L){const s=e,i=s.className;if(!this.renderTypeScriptInterfacesDone.includes(i)){this.renderTypeScriptInterfacesDone.push(i),t.push(`export interface ${i} {`);for(const r of s.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 L)c!==this.rootPropertyType&&this.renderTypeScriptInterfacesFifo.push(c);else if(c instanceof $)for(const a of c.items)a instanceof L&&this.renderTypeScriptInterfacesFifo.push(a)}t.push("}"),t.push("")}}return t}propertyItem2InterfaceDateType(e){var o,s;if(((o=e.types)==null?void 0:o.length)===0)return"any";if(((s=e.types)==null?void 0:s.length)===1)return this.renderType(e.types[0],e);const t=e.types.map(i=>this.renderType(i,e)).filter(i=>i!==K).sort((i,r)=>Q.includes(i)?100:Q.includes(r)?-100:i.localeCompare(r)).join(this.orOperator);return t.includes(this.orOperator)?"("+t+")":t}renderType(e,t){if(e instanceof $){const o=e.items.map(s=>this.renderType(s,t)).join(this.orOperator);return o.includes(this.orOperator)?`(${o})[]`:`${o}[]`}return e instanceof L?e.className:e.type}containsUndefinedPropertyType(e){for(const t of e.types)if(t.type===K)return!0;return!1}}class N{constructor(){this.alreadySet=!1}static getInstance(){return N.instance||(N.instance=new N),N.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 G(h){return h&&h.type==="TreeRow"}function ce(h){return h&&h.type==="AreaModelTree"}function ot(h){return h&&h.type==="CheckboxColumnDef"}class ye{constructor(e=-1,t=-1,o=-1,s=-1,i,r,n,l=0,c=0,a=0,d=""){this.rowIndex=e,this.rowTop=t,this.columnIndex=o,this.columnLeft=s,this.areaIdent=i,this.sideIdent=r,this.originalEvent=n,this.clickCount=l,this.draggingX=c,this.draggingY=a,this.action=d}clone(){return new ye(this.rowIndex,this.rowTop,this.columnIndex,this.columnLeft,this.areaIdent,this.sideIdent,this.originalEvent,this.clickCount,this.draggingX,this.draggingY,this.action)}}class V{constructor(e=">",t="",o=[]){this.content=e,this.style=t,this.classes=o}}class Be{constructor(e=new V(">","transform: rotate(90deg) translate(66%, -66%); transform-origin: 0 0;",["gt-table-tree-arrow-expanded"]),t=new V(">","",["ge-table-tree-arrow-collapsed"]),o=new V(">","color:transparent;",["gt-table-tree-arrow-hidden"]),s=new V("↕","",["gt-table-tree-arrow-expanded-all"])){this.arrowExpanded=e,this.arrowCollapsed=t,this.arrowPlaceholder=o,this.arrowExpandCollapseAll=s}}class $e{constructor(e=new V("↑","",["ge-header-sorted-asc"]),t=new V("↓","",["ge-header-sorted-desc"]),o=new V("↑","color:transparent;",[])){this.iconAsc=e,this.iconDesc=t,this.iconPlaceholder=o}}class st{constructor(e){this.domService=e}setStyle(e,t,o){return this.domService.setStyle(e,t,o),e}applyStyle(e,t){for(const o in t)this.domService.setStyle(e,o,t[o]);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(([o,s])=>this.domService.setStyle(e,o,s+"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",o){return this.domService.setStyle(o,"overflow-x",e),this.domService.setStyle(o,"overflow-y",t),o}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 o=this.domService.createText(t);return this.domService.appendChild(e,o),o}addClass(e,t){return e.includes(" ")?e.split(" ").forEach(o=>this.domService.addClass(t,o)):this.domService.addClass(t,e),t}removeClass(e,t){return e.includes(" ")?e.split(" ").forEach(o=>this.domService.removeClass(t,o)):this.domService.removeClass(t,e),t}addClasses(e,t){if(e)for(const o of e)this.domService.addClass(t,o);return t}setAttribute(e,t,o){return t&&o&&this.domService.setAttribute(e,t,o),e}createAreaDivWithClass(e,t,o,s){const i=this.domService.createElement("div");return this.addClass(e,i),this.domService.setAttribute(i,"data-area",o),this.domService.setAttribute(i,"data-side",s),this.domService.appendChild(t,i),i}createDivWithClass(e,t){const o=this.domService.createElement("div");return this.addClass(e,o),this.domService.appendChild(t,o),o}addRowDiv(e,t,o=-1,s,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}`),s==="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",`${o}`),this.domService.setAttribute(l,"data-area",`${s}`),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:o,rowIndex:s=-1,columnIndex:i=-1,areaIdent:r,sideIdent:n,text:l="",treeArrow:c,tableOptions:a,checkedType:d=void 0,sortState:u}=e,p=a==null?void 0:a.treeOptions,f=a==null?void 0:a.showCheckboxWihoutExtraColumn,m=this.domService.createElement("div");this.domService.addClass(m,"ge-table-col-div"),f&&this.domService.addClass(m,"ge-with-checkbox"),this.domService.addClass(m,`ge-table-col-div-${o.index}`),this.domService.setAttribute(m,"data-col-index",`${o.index}`),this.domService.setAttribute(m,"data-row-index",`${s}`),this.domService.setAttribute(m,"data-area",`${r}`);const g=((o==null?void 0:o.index)??0)%2===0?"even":"odd";if(r==="body"&&n==="center"&&this.domService.addClass(m,`ge-table-column-${g}`),this.domService.setStyle(m,"display","clip"),this.domService.setStyle(m,"position","absolute"),this.domService.setStyle(m,"left",`${o.left}px`),this.domService.setStyle(m,"top",`${o.top}px`),this.domService.setStyle(m,"width",`${o.width}px`),this.domService.setStyle(m,"height",`${o.height}px`),c&&c!=="none"&&(this.domService.addClass(m,"ge-table-col-tree"),this.addArrowDiv(m,c,p,s,i,r)),f&&i===0&&d&&this.addCheckboxToDiv(m,d,r,s),l){const y=c!=="none"&&i===0;this.addLabelDiv(m,l,y,s,i,r)}return u&&this.addSortedIcon(m,u,a==null?void 0:a.sortedOptions,i),this.domService.appendChild(t,m),m}addCheckboxToDiv(e,t,o,s){const i=this.domService.createElement("div"),r=t==="full"?"checked":"";return i.innerHTML=`
42
- <input
43
- type="checkbox"
44
- data-area="${o}"
45
- data-row-index="${s}"
46
- data-input-type="checkbox"
47
- ${r}
48
- class="ge-table-row-checkbox"> `,this.domService.setStyle(i,"display","inline"),this.domService.setStyle(i,"width","inherit"),this.domService.setAttribute(i,"data-row-index",`${s}`),this.domService.appendChild(e,i),i}addLabelDiv(e,t="",o=!1,s=-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",`${s}`),this.domService.setAttribute(n,"data-col-index",`${i}`),this.domService.setAttribute(n,"data-area",`${r}`),t)if(o){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",`${s}`),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="",o=new $e,s=-1){const i=this.domService.createElement("div");this.domService.addClass(i,"ge-table-sorted-icon-div"),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",`${s}`),this.domService.setAttribute(i,"data-area","header");let r;t==="asc"?r=o.iconAsc:t==="desc"?r=o.iconDesc:r=o.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",o=new Be,s=-1,i=-1,r="body"){const n=this.domService.createElement("div");this.domService.addClass(n,"ge-table-tree-arrow-div"),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",`${s}`),this.domService.setAttribute(n,"data-col-index",`${i}`),this.domService.setAttribute(n,"data-area",`${r}`);let l;t==="expanded"?l=o.arrowExpanded:t==="collapsed"?l=o.arrowCollapsed:l=o.arrowPlaceholder;const c=l.content,a=this.domService.createText(c);this.domService.appendChild(n,a),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,o,s,i){if(e.verticalBorderVisible){const r=`ge-table-${s}-${i}-vertical-border`;this.addVerticalBorder(o,t,r)}if(e.horizontalBorderVisible){const r=`ge-table-${s}-${i}-horizontal-border`;this.addHorizontalBorder(o,t,r)}return t}addHorizontalBorder(e,t,o="ge-table-body-center-horizontal-border"){const s=this.domService.createElement("div");return this.domService.addClass(s,o),this.domService.setStyle(s,"display","clip"),this.domService.setStyle(s,"position","absolute"),this.domService.setStyle(s,"left",`${e.left}px`),this.domService.setStyle(s,"top",`${e.top}px`),this.domService.setStyle(s,"width",`${e.width}px`),this.domService.setStyle(s,"height","1px"),this.domService.appendChild(t,s),s}addFocusBorderDivs(e,t,o){t={...t,width:t.width+1,height:t.height+1};let s=this.domService.createElement("div");return this.domService.addClass(s,"ge-table-focus-border"),this.domService.setStyle(s,"display","clip"),this.domService.setStyle(s,"position","absolute"),this.domService.setStyle(s,"left",`${t.left}px`),this.domService.setStyle(s,"top",`${t.top}px`),this.domService.setStyle(s,"width","1px"),this.domService.setStyle(s,"height",`${t.height}px`),this.domService.setStyle(s,"z-index","9999"),this.applyStyle(s,o),this.domService.appendChild(e,s),s=this.domService.createElement("div"),this.domService.addClass(s,"ge-table-focus-border"),this.domService.setStyle(s,"display","clip"),this.domService.setStyle(s,"position","absolute"),this.domService.setStyle(s,"left",`${t.left+t.width-1}px`),this.domService.setStyle(s,"top",`${t.top}px`),this.domService.setStyle(s,"width","1px"),this.domService.setStyle(s,"height",`${t.height}px`),this.domService.setStyle(s,"z-index","9999"),this.applyStyle(s,o),this.domService.appendChild(e,s),s=this.domService.createElement("div"),this.domService.addClass(s,"ge-table-focus-border"),this.domService.setStyle(s,"display","clip"),this.domService.setStyle(s,"position","absolute"),this.domService.setStyle(s,"left",`${t.left}px`),this.domService.setStyle(s,"top",`${t.top}px`),this.domService.setStyle(s,"width",`${t.width}px`),this.domService.setStyle(s,"height","1px"),this.domService.setStyle(s,"z-index","9999"),this.applyStyle(s,o),this.domService.appendChild(e,s),s=this.domService.createElement("div"),this.domService.addClass(s,"ge-table-focus-border"),this.domService.setStyle(s,"display","clip"),this.domService.setStyle(s,"position","absolute"),this.domService.setStyle(s,"left",`${t.left}px`),this.domService.setStyle(s,"top",`${t.top+t.height-1}px`),this.domService.setStyle(s,"width",`${t.width}px`),this.domService.setStyle(s,"height","1px"),this.domService.setStyle(s,"z-index","9999"),this.applyStyle(s,o),this.domService.appendChild(e,s),e}addVerticalBorder(e,t,o="ge-table-body-center-vertical-border"){const s=this.domService.createElement("div");return this.domService.addClass(s,o),this.domService.setStyle(s,"display","clip"),this.domService.setStyle(s,"position","absolute"),this.domService.setStyle(s,"left",`${e.left}px`),this.domService.setStyle(s,"top",`${e.top}px`),this.domService.setStyle(s,"width","1px"),this.domService.setStyle(s,"height",`${e.height}px`),this.domService.appendChild(t,s),s}addDiv(e,t,o=""){const s=this.domService.createElement("div");return o&&this.domService.addClass(s,o),this.domService.setStyle(s,"display","clip"),this.domService.setStyle(s,"position","absolute"),this.domService.setStyle(s,"left",`${t.left}px`),this.domService.setStyle(s,"top",`${t.top}px`),this.domService.setStyle(s,"width",`${t.width}px`),this.domService.setStyle(s,"height",`${t.height}px`),this.domService.appendChild(e,s),s}applyStyleString(e,t){const o=t.split(";").map(s=>s.trim()).filter(s=>s);for(const s of o){const[i,r]=s.split(":");this.domService.setStyle(e,i.trim(),r.trim())}}getDivOrCreateDiv(e,t){let o=t.cache[e];return o?(o.innerText="",o):(o=this.domService.createElement("div"),t.cache[e]=o,o)}}const se=h=>h==="header"?"header":h==="footer"?"footer":"body";class it{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 o=e.getAttribute("data-area");if(o&&(this.areaIdent=se(o),this.areaModel=t.tableModel.getAreaModel(this.areaIdent),this.row=this.areaModel.getRowByIndex(this.rowIdx)),e instanceof HTMLInputElement){const s=e;this.value=s.value}}}}class rt{constructor(e){this.tableScope=e,this.doubleClickDelay=500,this.expandedAll=!0,this.lastClickedCellKey="",this.mouseDown=!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(o=>o.addEventListener("resize",this.tableScope.adjustContainersAndRows.bind(this.tableScope),{signal:t}))}onContextmenu(e){this.mouseEvent=e;const t=this.tableScope.createGeMouseEvent(this.mouseEvent);this.tableScope.contextmenu(t)}onHostElementClicked(e){var r;const t=Date.now(),o=e.target,s=(r=o==null?void 0:o.closest)!=null&&r.call(o,"[data-col-index]")?["data-area","data-row-index","data-col-index"].map(n=>{var l;return((l=o.closest("["+n+"]"))==null?void 0:l.getAttribute(n))??""}).join(":"):"";if(t-this.lastClicked<this.doubleClickDelay&&s===this.lastClickedCellKey){this.lastClicked=t,this.publishGeMouseEvent(e,2);return}this.lastClicked=t,this.lastClickedCellKey=s;const i=new it(e.target,this.tableScope);if(i.action==="toggleExpandCollapseAll")this.expandedAll=!this.expandedAll,this.tableScope.toggleExpandCollapseAll(this.expandedAll),e.preventDefault(),e.stopPropagation();else if(i.action==="toggleHeaderGroup")this.tableScope.toggleHeaderGroup(i),e.preventDefault(),e.stopPropagation();else if(i.inputType==="checkbox"&&i.areaIdent)this.tableScope.toggleRowCheckbox(i.rowIdx,i.colIdx,i.areaIdent),e.preventDefault(),e.stopPropagation();else if(G(i.row)&&i.areaModel){const n=i.colIdx===this.getArrowColumnIndex()&&e.altKey,l=i.className.includes("ge-table-tree-arrow-div");if(n||l){e.preventDefault(),e.stopPropagation();const c=i.row;c.expanded=!c.expanded,"recalcVisibleTreeRows"in i.areaModel&&i.areaModel.recalcVisibleTreeRows(),this.tableScope.tableModel.recalcSize(this.tableScope.hostElement.clientWidth),this.tableScope.adjustContainersAndRows(),this.updateCollapsedExpandedState(c)}}if(i.areaIdent==="body"){const n=this.tableScope.focusModel();n==null||n.clear(),n==null||n.setFocus(i.rowIdx,i.colIdx)}this.publishGeMouseEvent(e,1)}onHostElementDblClicked(e){var t,o;if(this.lastClicked=Date.now(),e.target instanceof HTMLElement){const s=e.target.closest("[data-col-index]")??e.target,i=((t=s.closest("[data-area]"))==null?void 0:t.getAttribute("data-area"))??null,r=se(i),n=Number((o=s.closest("[data-row-index]"))==null?void 0:o.getAttribute("data-row-index")),l=Number(s.getAttribute("data-col-index")),c=this.tableScope.tableModel.getAreaModel(r);if(i&&r==="header")this.tableScope.tableModel.isSortable(l)&&(this.tableScope.clearSelection(),this.tableScope.onHeaderDblClicked(e,n,l));else if(s.getAttribute("data-row-index")){const a=c.getRowByIndex(n);if(i&&r==="body"&&c.isEditable(n,l)&&(this.tableScope.clearSelection(),this.tableScope.initRenderEditor(n,l)),G(a)&&l===this.getArrowColumnIndex()){e.preventDefault(),e.stopPropagation();const d=a;d.expanded=!d.expanded,"recalcVisibleTreeRows"in c&&c.recalcVisibleTreeRows(),this.tableScope.tableModel.recalcSize(this.tableScope.hostElement.clientWidth),this.tableScope.adjustContainersAndRows(),this.updateCollapsedExpandedState(d)}}}this.publishGeMouseEvent(e,2)}publishGeMouseEvent(e,t){var o;this.mouseEvent=e,this.geMouseEventOld=(o=this.geMouseEvent)==null?void 0:o.clone(),this.geMouseEvent=this.tableScope.createGeMouseEvent(e),this.geMouseEvent&&(this.geMouseEvent.clickCount=t),this.tableScope.onMouseClicked(this.geMouseEvent,this.geMouseEventOld),this.tableScope.publishGeMouseEvent(this.geMouseEvent)}updateCollapsedExpandedState(e){var o,s,i,r,n,l;const t=(s=(o=this.tableScope.tableOptions)==null?void 0:o.autoRestoreOptions)==null?void 0:s.getRowId;if(t){(i=this.tableScope.storeStateCollapsedExpandService)==null||i.initModeIfEmpty(e.expanded?"expanded":"collapsed");const c=(r=this.tableScope.storeStateCollapsedExpandService)==null?void 0:r.collapsedExpandedStateGet().mode,a=c==="collapsed"&&!e.expanded||c==="expanded"&&e.expanded,d=c==="collapsed"&&e.expanded||c==="expanded"&&!e.expanded,u=t(e.data);a?(n=this.tableScope.storeStateCollapsedExpandService)==null||n.collapsedStateIdsPush(u):d&&((l=this.tableScope.storeStateCollapsedExpandService)==null||l.collapsedStateIdsRemove(u))}}getArrowColumnIndex(){return this.tableScope.tableModel.isRowCheckboxVisible()?1:0}onMouseDown(e){this.dragging||(this.mouseEvent=e,this.startMouseEvent=this.tableScope.createGeMouseEvent(this.mouseEvent),this.tableScope.onMouseDown(this.startMouseEvent),this.mouseDown=!0)}onMouseMove(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.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)}}}class we{constructor(e,t=[],o=-1){this.areaIdent=e,this.columnDefs=t,this.defaultRowHeight=o,this.rowSelectionModel=void 0,this.yPositions=[],this.cellRenderers=t.map(s=>s.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 o;const t=this.getRowByIndex(e);return(o=this.rowSelectionModel)==null?void 0:o.isRowChecked(t)}setRowChecked(e,t){if(this.rowSelectionModel){const o=this.getRowByIndex(e);this.rowSelectionModel.checkRow(o,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 s,i;const o=(s=this.columnDefs)==null?void 0:s[t];return((i=o==null?void 0:o.editable)==null?void 0:i.call(o))??!1}setValue(e,t,o){var n;const s=(n=this.columnDefs[t])==null?void 0:n.editInputPipe;s&&(o=s(o,e,t));const i=this.getRowByIndex(e),r=this.columnDefs[t].property;return r.includes(".")?this.setPropertyValue(i,r.split("."),o):(i[r]=o,!0)}isSelectable(e,t){return!0}changeColumnOrder(e,t){this.arrayMove(this.cellRenderers,e,t)}setPropertyValue(e,t,o){const s=t.shift();if(s){const i=e[s];return i&&t.length?this.setPropertyValue(i,t,o):(e[s]=o,!0)}return!1}arrayMove(e,t,o){const s=e.splice(t,1)[0];return e.splice(o,0,s),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 We{genericSortComparator(e,t,o){if(typeof e=="number"&&typeof t=="number")return o*(e-t);if(typeof e=="string"&&typeof t=="string")return o*e.localeCompare(t);if(typeof e=="boolean"&&typeof t=="boolean")return o*((e?-1:1)-(t?-1:1));if(e instanceof Date&&t instanceof Date)return o*(e.getTime()-t.getTime());if(e instanceof Array&&t instanceof Array){const s=e,i=t;if(s.length&&i.length)return this.genericSortComparator(s[0],i[0],o)}return o*(""+e).localeCompare(""+t)}}class F extends we{constructor(e,t,o,s=[],i="ge-selected-row",r="ge-focused-row"){super(e,s,o),this.areaIdent=e,this.rows=t,this.defaultRowHeight=o,this.columnDefs=s,this.selectedRowClass=i,this.focusedRowClass=r,this.sorterService=new We,this._focusedRowIndex=0,this.filteredRows=[...t],this.properties=s.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}getValueAt(e,t){const o=this.properties[t];let s=this.filteredRows[e];return G(s)&&(s=s.data),s?this.getValueByT(s,o):""}getFilteredRows(){return this.filteredRows}getAllRows(){return this.rows}findRowFromFilteredRowsByAllCriteria(e,t){return this.getFilteredRows().find(o=>t(e,o))}findRowFromAllRowsByAllCriteria(e,t){return this.getAllRows().find(o=>t(e,o))}getRowHeight(e){return this.defaultRowHeight}getConstantRowHeight(){return this.getRowHeight===F.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){for(const t of e){const{columnIndex:o,sortState:s}=t,i=s==="asc"?1:s==="desc"?-1:0,r=this.properties[o];this.filteredRows=this.filteredRows.sort(this.genericFlatTableSortComparator(r,i))}return!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 o=super.getCustomClassesAt(e,t);return this.getRowByIndex(e).selected&&o.push(this.selectedRowClass),this._focusedRowIndex===e&&o.push(this.focusedRowClass),o}genericFlatTableSortComparator(e,t){const o=this.columnDefs.find(s=>s.property===e);return(s,i)=>{const r=this.getValueByT(s,e),n=this.getValueByT(i,e);return o!=null&&o.sortComparator?t*o.sortComparator(r,n,s,i,t):this.sorterService.genericSortComparator(r,n,t)}}getPropertyValue(e,t){const o=t.shift(),s=e[o];return s&&t.length?this.getPropertyValue(s,t):s}}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){}setColumnVisible(e,t=!0){}isColumnVisible(e){return!0}isHeaderVisible(){return!0}setFooterVisible(e=!0){}isFooterVisible(){return!0}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())}downloadExcel(e="table.xlsx",t=""){var n,l;const o=[],s=this.tableScope.tableModel,i=[];for(let c=0;c<s.getColumnCount();c++)((l=(n=s.getColumnDef(c))==null?void 0:n.isVisible)==null?void 0:l.call(n))!==!1&&i.push(c);const r=["header","body","footer"];for(const c of r){const a=s.getAreaModel(c),d=(a==null?void 0:a.getRowCount())??0;for(let u=0;u<d;u++)o.push(i.map(p=>a.getValueAt(u,p)))}return this.tableScope.excelService.downloadExcel(o,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 F?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 F){const o=t;let s=o.getAllRows();o.setRows([...s,...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 o=this.getBodyModel();if(o instanceof F){const s=o;let i=s.getAllRows();s.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 o,o)}removeRows(e,t=(o,s)=>o===s){const o=this.getBodyModel();if(o instanceof F){const s=o,i=s.getAllRows().filter(r=>!e.some(n=>t(r,n)));s.setRows(i)}else console.warn("removeRows<T>(rows: T[]) only works with AreaModelObjectArray<T>, but this body area model is ",typeof o,o)}findRows(e,t=(o,s)=>o===s){const o=this.getBodyModel();return o instanceof F?o.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 o,o),[])}findRowFromFilteredRowsByAllCriteria(e,t){const o=this.getBodyModel();if(o instanceof F)return o.getFilteredRows().find(i=>t(e,i));console.warn("findRowFromFilteredRowsByAllCriteria(...) only works with AreaModelObjectArray<T>, but this body area model is ",typeof o,o)}findRowFromAllRowsByAllCriteria(e,t){const o=this.getBodyModel();if(o instanceof F)return o.getAllRows().find(i=>t(e,i));console.warn("findRowFromAllRowsByAllCriteria(...) only works with AreaModelObjectArray<T>, but this body area model is ",typeof o,o)}updateRows(e,t=(o,s)=>o===s){const o=this.getBodyModel();if(o instanceof F){let i=o.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 o,o)}sortByColumn(e,t){return this.tableScope.sortByColumn(e,t)}reSort(){this.tableScope.reSort()}sort(e){this.tableScope.sort(e)}ensureRowIsVisible(e){return this.tableScope.ensureRowIsVisible(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 Ne{constructor(e){this.getStorageKeyFn=e}autoConvertMapToObject(e){const t={};return e instanceof Map&&e.forEach((s,i)=>{t[i]=s}),t}checkAndPersistItem(e,t){const o=this.getStorageKeyFn;if(o){const s=o();if(s){const i=s+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 lt extends Ne{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 o=t+this.SCROLL_STATE;let s=this.loadFromLocalStorage(o);this.scrollOffset=s||[0,0]}}}}class at{constructor(e="collapsed",t=[],o=!1,s=!1){this.mode=e,this.rowIds=t,this.allCollapsed=o,this.allExpanded=s}}class ct extends Ne{constructor(e){super(e),this.COLLAPSED_EXPANDED_STATE="collapsedExpandedState",this.collapsedExpandedState=new at,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 o=t+this.COLLAPSED_EXPANDED_STATE,s=this.loadFromLocalStorage(o);s&&(this.collapsedExpandedState=s,this.stored=!0)}}}persist(){this.stored=!0,this.checkAndPersistItem(this.COLLAPSED_EXPANDED_STATE,this.collapsedExpandedState)}}class dt extends Ne{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 o=t+this.SORTING_STATE,s=this.loadFromLocalStorage(o);this.sortItems=s||[]}}}}class O{constructor(e=0,t=0,o=0,s=0,i){this.left=e,this.width=t,this.height=o,this.top=s,this.index=i}}const pe=class pe{constructor(e,t,o,s){this.hostElement=e,this.tableModel=t,this.dom=o,this.tableOptions=s,this.scrollTop=0,this.areaBodyWestGeo=new O,this.areaBodyCenterGeo=new O,this.areaBodyEastGeo=new O;const i=this.hostElement;i.innerText="",this.dom.setAttribute(i,"tabindex","0"),this.dom.setStyle(this.dom.addClass("ge-table",i),"position","relative"),this.hoverRow=o.applyStylePosistionAbsolute(o.createDivWithClass("ge-table-hover-row",i)),this.hoverColumn=o.applyStylePosistionAbsolute(o.createDivWithClass("ge-table-hover-column",i)),this.draggingColumn=o.applyStylePosistionAbsolute(o.createDivWithClass("ge-table-dragging-column",i)),this.areaHeaderWest=o.appendRelativeChildDiv(o.applyStylePosistionAbsolute(o.createAreaDivWithClass("ge-table-header ge-table-header-west",i,"header","west"))),this.areaHeaderCenter=o.appendRelativeChildDiv(o.applyStylePosistionAbsolute(o.createAreaDivWithClass("ge-table-header ge-table-header-center",i,"header","center"))),this.areaHeaderEast=o.appendRelativeChildDiv(o.applyStylePosistionAbsolute(o.createAreaDivWithClass("ge-table-header ge-table-header-east",i,"body","east"))),this.areaBodyWest=o.appendRelativeChildDiv(o.applyStylePosistionAbsolute(o.createAreaDivWithClass("ge-table-body ge-table-body-west",i,"body","west"))),this.areaBodyEast=o.appendRelativeChildDiv(o.applyStylePosistionAbsolute(o.createAreaDivWithClass("ge-table-body ge-table-body-east",i,"body","east"))),this.areaFooterWest=o.appendRelativeChildDiv(o.applyStylePosistionAbsolute(o.createAreaDivWithClass("ge-table-footer ge-table-footer-west",i,"footer","west"))),this.areaFooterCenter=o.appendRelativeChildDiv(o.applyStylePosistionAbsolute(o.createAreaDivWithClass("ge-table-footer ge-table-footer-center",i,"footer","center"))),this.areaFooterEast=o.appendRelativeChildDiv(o.applyStylePosistionAbsolute(o.createAreaDivWithClass("ge-table-footer ge-table-footer-east",i,"footer","east"))),this.scrollViewport=o.applyStyleOverflowAuto(this.tableOptions.overflowX??"auto",this.tableOptions.overflowY??"auto",o.applyStyleNoPadding(o.applyStylePosistionAbsolute(o.createAreaDivWithClass("ge-table-scroll-viewport",i,"body","center")))),this.contentWrapperDiv=o.applyStyleNoPadding(o.applyStylePosistionRelative(o.createDivWithClass("ge-table-scroll-content-wrapper",this.scrollViewport))),this.contentDiv=o.applyStyleNoPadding(o.applyStylePosistionRelative(o.createDivWithClass("ge-table-scroll-content",this.contentWrapperDiv))),this.areaBodyCenter=o.appendRelativeChildDiv(o.createDivWithClass("ge-table-body-center",this.contentDiv)),this.borderHeaderBottom=o.applyStylePosistionAbsolute(o.createDivWithClass("ge-table-header-border",i)),this.borderFixedWest=o.applyStylePosistionAbsolute(o.createDivWithClass("ge-table-west-fixed-column-border",i)),this.borderFixedEast=o.applyStylePosistionAbsolute(o.createDivWithClass("ge-table-east-fixed-column-border",i)),this.borderFooterTop=o.applyStylePosistionAbsolute(o.createDivWithClass("ge-table-footer-border",i))}adjustContainersAndRows(){const e=this.tableModel.getPadding(),t=this.hostElement.clientWidth,o=this.hostElement.clientHeight;this.dom.applyStyle(this.scrollViewport,{width:`${t-e.left}px`,height:`${o-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=o-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=o-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.getFixedLeftColumnCount()?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=o-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:`${o-e.bottom}px`,left:"0"}),this.dom.applyStyle(this.areaFooterCenter.parent,{width:`${t-e.left-e.right}px`,height:`${e.bottom}px`,top:`${o-e.bottom}px`,left:`${e.left}px`}),this.dom.applyStyle(this.areaFooterEast.parent,{width:`${e.right}px`,height:`${e.bottom}px`,top:`${o-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:`${o-e.bottom}px`,left:"0px"})):this.dom.applyDisplayNoneStyle(this.borderFooterTop),this.adjustAfterScrolling()}adjustAfterScrolling(){}resetSizeOfWrapperDiv(){const e=`${this.tableModel.getContentWidthInPixel()}px`,t=this.tableModel.getContentHeightInPixel()+1,o=`${Math.min(t,pe.maxScrollHeightInPx)}px`;this.dom.setStyle(this.contentWrapperDiv,"width",e),this.dom.setStyle(this.contentWrapperDiv,"height",o)}};pe.maxScrollHeightInPx=8e6;let ee=pe;class M{constructor(e,t,o,s,i=!1){this.r1=e,this.c1=t,this.r2=o,this.c2=s,this.gammaRange=i}static create(e){return e.gammaRange===void 0&&(e.gammaRange=!1),new M(e.rowIndex1,e.columnIndex1,e.rowIndex2,e.columnIndex2,e.gammaRange)}static singleCell(e,t){return new M(e,t,e,t)}static singleRow(e){return new M(e,0,e,Number.MAX_SAFE_INTEGER)}static singleColumn(e){return new M(0,e,Number.MAX_SAFE_INTEGER,e)}isInRange(e,t){return e>=this.r1&&e<=this.r2&&t>=this.c1&&t<=this.c2}}class xe{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(M.singleRow(e)):this.selectionType==="column"&&this.addRange(M.singleColumn(t))}getSelectionCount(e,t){let o=0;for(const s of this.ranges)s.isInRange(e,t)&&o++;return this.allSelected&&o++,this.isInNegativeRange(e,t)&&(o=0),o}isInNegativeRange(e,t){for(const o of this.negativeRanges)if(o.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(){const e=new Set;for(const t of this.ranges)for(let o=t.r1;o<=t.r2;o++)!e.has(o)&&!this.isInNegativeRange(o,0)&&e.add(o);return Array.from(e)}selectAll(){this.allSelected=!0,this.fireChangeEvent()}isAllSelected(){return this.allSelected}addSelection(e){this.addRange(e),this.fireChangeEvent()}removeSelection(e){if(this.selectionType==="none")return;let t=e;this.selectionType==="row"?t=M.singleRow(e.r1):this.selectionType==="column"&&(t=M.singleColumn(e.c1)),this.negativeRanges.push(t),this.fireChangeEvent()}togglePoint(e,t){this.getSelectionCount(e,t)>0?this.removeSelection(M.singleCell(e,t)):this.addSelection(M.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.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,this.ranges.push(e),this.fireChangeEvent())}}class ht{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 ut{constructor(e,t){this.tableModel=e,this.areaModel=t,this.colAndRowspanRanges=void 0}init(){if(this.areaModel.getMaxColspan()<2&&this.areaModel.getMaxRowspan()<2)return;this.colAndRowspanRanges=[];const e=this.areaModel.getRowCount(),t=this.tableModel.getColumnCount();for(let o=0;o<e;o++)for(let s=0;s<t;s++){let i=this.areaModel.getColspanAt(o,s),r=this.areaModel.getRowspanAt(o,s);if(i>1||r>1){i===0&&(i=1),r===0&&(r=1);const n="gammaCells"in this.areaModel;this.colAndRowspanRanges.push(new M(o,s,o+r-1,s+i-1,n))}}}getRanges(){return this.colAndRowspanRanges?this.colAndRowspanRanges:[]}isInRange(e,t){if(this.colAndRowspanRanges){for(const o of this.colAndRowspanRanges)if(o.isInRange(e,t))return!0}return!1}}class k{constructor(e,t,o){this.header=e,this.body=t,this.footer=o}}class pt extends ee{constructor(e,t,o,s){var r,n,l,c;if(super(e,t,o,s),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 k,this.draggingTargetColumnIndex=-1,this.contentScrollTop=0,this.removables=[],(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 a=new xe;this.getSelectionModel=()=>a}if((c=this.tableOptions)!=null&&c.getFocusModel)this.getFocusModel=this.tableOptions.getFocusModel;else{const a=new ht("cell");this.getFocusModel=()=>a}ce(t.getAreaModel("body"))&&(this.tree=!0),["header","body","footer"].forEach(a=>{var d;this.colAndRowspanModels[a]=new ut(t,t.getAreaModel(a)),(d=this.colAndRowspanModels[a])==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 s;let o=(s=this.tableModel.getColumnDef(t))==null?void 0:s.getEditRenderer;if(o||(o=this.tableOptions.getEditRenderer),o)if(this.editorRenderer=o(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(){this.tableModel.recalcHeightAndPadding(),this.resetSizeOfWrapperDiv(),this.adjustContainersAndRows(),this.adjustAfterScrolling()}recalcColumnWidths(e){let t=(!e||e>this.scrollViewport.offsetWidth)&&this.scrollViewport.offsetWidth>100?this.scrollViewport.offsetWidth:this.scrollViewport.clientWidth;this.tableModel.setParentWidth(t),this.tableModel.init(),this.repaintHard()}adjustAfterScrolling(){var i;for(const r of this.removables)r.remove();if(this.hideHoverRow(),this.hideHoverColumn(),this.scrollTop=this.scrollViewport.scrollTop,this.scrollLeft=this.scrollViewport.scrollLeft,this.scrollViewportLeft=this.scrollLeft,this.scrollPosSaveTimeout&&clearTimeout(this.scrollPosSaveTimeout),this.scrollPosSaveTimeout=setTimeout(()=>this.checkForScrollPosSaving(),500),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 r=this.getContentScrollRangeY();Math.abs(this.scrollTop-this.pendingContentScroll.scrollTop)<=1&&r>0?this.scrollFactorY=Math.min(1,Math.max(0,this.pendingContentScroll.contentTop/r)):this.pendingContentScroll=void 0}isNaN(this.scrollFactorX)&&(this.scrollFactorX=0);const e=this.hostElement.clientWidth,t=this.hostElement.clientHeight,o=this.areaBodyWest.child.clientWidth,s=this.areaHeaderCenter.child.clientHeight;this.areaHeightsOfRenderPass={body:this.areaBodyCenter.child.clientHeight,footer:this.areaFooterCenter.child.clientHeight,header:s};try{this.adjustBody(),this.adjustArea("footer"),this.adjustArea("header")}finally{this.areaHeightsOfRenderPass=void 0}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(o,1,t,0),this.hostElement,"ge-table-body-west-vertical-border")),((i=this.tableModel.getAreaModel("header"))==null?void 0:i.getRowCount())>0&&this.removables.push(this.dom.addHorizontalBorder(new O(0,e,1,s),this.hostElement,"ge-table-body-west-vertical-border"))}checkForScrollPosSaving(){var e,t;this.storeScrollPosStateService&&((t=(e=this.tableOptions)==null?void 0:e.autoRestoreOptions)!=null&&t.autoRestoreScrollPosition)&&this.storeScrollPosStateService.updateScrollOffset([this.scrollLeft,this.scrollTop])}updateCells(e,t=!1){e.forEach(o=>{this.tableModel.getAreaModel(o.area).setValue(o.rowIndex,o.columnIndex,o.value),t||this.rerenderCellContent(o)}),t&&this.repaint()}rerenderCellContent({area:e,rowIndex:t,columnIndex:o,value:s,cssClasses:i}){const r=this.tableModel.getAreaModel(e),n='div[data-col-index="'+o+'"][data-row-index="'+t+'"][data-area="'+e+'"]',l=this.hostElement.querySelector(n);if(l){let c;const a=e==="body"&&this.editorRenderer&&this.editorRendererRow===t&&this.editorRendererColumn===o;let d;if(a?d=this.editorRenderer:d=r.getCellRenderer(t,o),l.innerText="",this.applyCssClasses(l,i),d)c=d.render(l,t,o,e,r,s,this.dom.domService),c&&this.cleanupFunctions[e].push(c);else{const f=`${s}`;this.dom.addLabelDiv(l,f,!1,t,o,e)}const u=r.getCustomClassesAt(t,o);u.length&&this.dom.addClasses(u,l);const p=r.getCustomStyleAt(t,o);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,o)=>this.tableModel.getColumnWidth(o)))}getAreaAndSideIdentByAttr(e){if(e){const t=this.getStringByAttr(e,"data-area"),o=this.getStringByAttr(e,"data-side");if(o&&t)return[t,o]}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>ee.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(),o=this.getScrollerRangeY();if(t<=0||o<=0)return;const s=o/t,i=e.deltaMode===1?16:e.deltaMode===2?this.scrollViewport.clientHeight:1;e.preventDefault(),e.deltaY&&(this.scrollViewport.scrollTop+=e.deltaY*i*s),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 o=this.areaHeightsOfRenderPass?this.scrollLeft:this.scrollViewport.scrollLeft;this.dom.setStyle(this.contentDiv,"left",`${o}px`),this.adjustArea("body",t)}getNumberByAttr(e,t){var o;if(e){const s=(o=e.closest("["+t+"]"))==null?void 0:o.getAttribute(t);if(s)return Number(s)}return-1}getStringByAttr(e,t){var o;if(e){const s=(o=e.closest("["+t+"]"))==null?void 0:o.getAttribute(t);if(s)return s}return""}adjustArea(e,t=0){var w,v,T;const o=this.getArea(e,"west"),s=this.getArea(e,"center"),i=this.getArea(e,"east"),r=((w=this.areaHeightsOfRenderPass)==null?void 0:w[e])??s.child.clientHeight;o.child.innerText="",s.child.innerText="",i.child.innerText="";const n=0,l=this.areaBodyCenterGeo.width,c=this.tableModel.getPadding(),a=this.tableModel.getAreaModel(e),d=a.getRowCount();for(;this.cleanupFunctions[e].length;){const x=this.cleanupFunctions[e].shift();x&&x()}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 y=(v=a.getConstantRowHeight)==null?void 0:v.call(a);if(y!==void 0&&y>0&&u<0){for(g=Math.min(d,Math.floor(-u/y));g>0&&u+g*y>0;)g--;u=u+g*y}for(let x=g;x<d;x++){const S=u,E=x===d-1,R=this.tableModel.getRowHeight(e,x);if(S+R>0){e==="body"&&this.firstVisibleRowIndex===-1&&(this.firstVisibleRowIndex=x,this.firstFullVisibleRowIndex=S<-this.pixelLimitForFullVisible?this.firstVisibleRowIndex+1:this.firstVisibleRowIndex);let A={left:n,width:l,height:R,top:S,index:x},_=this.dom.addRowDiv(s,A,x,e,"center");const z=m;if(this.adjustColumnsToRowParent({areaIdent:e,sideIdent:"center",areaModel:a,geo:A,parent:_,rowIndex:x,columnIndexStart:z,columnIndexEnd:p-f-1,verticalFixed:!1,lastRowOfModel:E}),c.left>0&&(A={left:n,width:this.areaBodyWestGeo.width,height:R,top:S,index:x},_=this.dom.addRowDiv(o,A,x,e,"west"),this.adjustColumnsToRowParent({areaIdent:e,sideIdent:"west",areaModel:a,geo:A,parent:_,rowIndex:x,columnIndexStart:0,columnIndexEnd:z-1,verticalFixed:!0,lastRowOfModel:E})),c.right>0&&(A={left:n,width:this.areaBodyEastGeo.width,height:R,top:S,index:x},_=this.dom.addRowDiv(i,A,x,e,"east"),this.adjustColumnsToRowParent({areaIdent:e,sideIdent:"east",areaModel:a,geo:A,parent:_,rowIndex:x,columnIndexStart:p-f,columnIndexEnd:p-1,verticalFixed:!0,lastRowOfModel:E})),e==="header"&&this.tree&&x===d-1){const q=this.dom.applyStyle(this.dom.setAttribute(this.dom.addDiv(_,new O(16,20,20,8)),"data-ge-action","toggleExpandCollapseAll"),{cursor:"pointer"}),C=this.tableOptions.treeOptions.arrowExpandCollapseAll;if(C){const Gt=this.dom.domService.createText(C.content);this.dom.domService.appendChild(q,Gt),C.style&&this.dom.applyStyleString(q,C.style)}}}if(u=u+R,u>r){e==="body"&&(this.lastVisibleRowIndex=x,this.lastFullVisibleRowIndex=r-u<-this.pixelLimitForFullVisible?x-1:x,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 Ge{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 Rt{constructor(){this.property="",this.value="",this.path="",this.propertyItem=new rt("",[new it("")])}toString(){var e;return`${this.path} -> : ${((e=this.propertyItem)==null?void 0:e.toString())??""}`}}const ze="Entity";function vt(h){let e=Mt(Et(h));return e.includes(ze)||(e=e+ze),e}function Mt(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 Et(h){return!h||h.length===0?"":h[0].toUpperCase()+h.slice(1)}class gs{constructor(){this.debugging=!1}json2PropertyType(e,t=""){let s;if(typeof e=="string"){const o=new Ge().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 Ge().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=>!he.includes(c.type));if(l.length===1){const c=l[0];if(c instanceof j){n=!0;for(const a of o.propertyItem.types)c.items.push(a)}else c instanceof V&&(n=!0,c.properties.push(o.propertyItem))}if(!n)for(const c of o.propertyItem.types)r.propertyItem.types.push(c)}}}return t||new it("")}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,a=this.countPath(e,i.path);c>a&&(i.propertyItem.types.some(d=>d.type===ee)||i.propertyItem.types.push(new xe(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 Rt;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===te&&!Array.isArray(i)){for(const a in i)if(i.hasOwnProperty(a)){const d=r?`${r}/${a}`:a;o(i[a],d,c)}}else Array.isArray(i)&&i.forEach((a,d)=>{const u=`${r}/[]`;o(a,u,c)})};return o(e,"root",t),s.sort((i,r)=>i.path.localeCompare(r.path))}createPropertyItem(e,t){return new rt(t,[this.createPropertyType(e,t)])}createPropertyType(e,t){return e===null?new Ct(t):e===void 0?new xe(t):typeof e===st?new xt(t):typeof e===Ve&&!isNaN(e)?new St(t):typeof e===He?new At(t):Array.isArray(e)?new j(t):typeof e===te?new V(t,vt(t)):new xe(t)}}class bs{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 j){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 c of r.types)if(c instanceof V)c!==this.rootPropertyType&&this.renderTypeScriptInterfacesFifo.push(c);else if(c instanceof j)for(const a of c.items)a instanceof V&&this.renderTypeScriptInterfacesFifo.push(a)}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!==ee).sort((i,r)=>he.includes(i)?100:he.includes(r)?-100:i.localeCompare(r)).join(this.orOperator);return t.includes(this.orOperator)?"("+t+")":t}renderType(e,t){if(e instanceof j){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===ee)return!0;return!1}}class K{constructor(){this.alreadySet=!1}static getInstance(){return K.instance||(K.instance=new K),K.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 $(h){return h&&h.type==="TreeRow"}function z(h){return h&&h.type==="AreaModelTree"}function nt(h){return!!h&&h.type==="CheckboxCellRenderer"}function je(h){return h&&h.type==="CheckboxColumnDef"}class Oe{constructor(e=-1,t=-1,s=-1,o=-1,i,r,n,l=0,c=0,a=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=a,this.action=d}clone(){return new Oe(this.rowIndex,this.rowTop,this.columnIndex,this.columnLeft,this.areaIdent,this.sideIdent,this.originalEvent,this.clickCount,this.draggingX,this.draggingY,this.action)}}class O{constructor(e=">",t="",s=[]){this.content=e,this.style=t,this.classes=s}}class lt{constructor(e=new O(">","transform: rotate(90deg) translate(66%, -66%); transform-origin: 0 0;",["gt-table-tree-arrow-expanded"]),t=new O(">","",["ge-table-tree-arrow-collapsed"]),s=new O(">","color:transparent;",["gt-table-tree-arrow-hidden"]),o=new O("↕","",["gt-table-tree-arrow-expanded-all"])){this.arrowExpanded=e,this.arrowCollapsed=t,this.arrowPlaceholder=s,this.arrowExpandCollapseAll=o}}class at{constructor(e=new O("↑","",["ge-header-sorted-asc"]),t=new O("↓","",["ge-header-sorted-desc"]),s=new O("↑","color:transparent;",[])){this.iconAsc=e,this.iconDesc=t,this.iconPlaceholder=s}}const Fe=class Fe{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:a,checkedType:d=void 0,sortState:u,checkboxAriaLabel:p}=e,g=a==null?void 0:a.treeOptions,w=a==null?void 0:a.showCheckboxWihoutExtraColumn,f=this.domService.createElement("div");this.domService.addClass(f,"ge-table-col-div"),w&&this.domService.addClass(f,"ge-with-checkbox"),this.domService.addClass(f,`ge-table-col-div-${s.index}`),this.domService.setAttribute(f,"data-col-index",`${s.index}`),this.domService.setAttribute(f,"data-row-index",`${o}`),this.domService.setAttribute(f,"data-area",`${r}`);const C=((s==null?void 0:s.index)??0)%2===0?"even":"odd";if(r==="body"&&n==="center"&&this.domService.addClass(f,`ge-table-column-${C}`),this.domService.setStyle(f,"display","clip"),this.domService.setStyle(f,"position","absolute"),this.domService.setStyle(f,"left",`${s.left}px`),this.domService.setStyle(f,"top",`${s.top}px`),this.domService.setStyle(f,"width",`${s.width}px`),this.domService.setStyle(f,"height",`${s.height}px`),c&&c!=="none"&&(this.domService.addClass(f,"ge-table-col-tree"),this.addArrowDiv(f,c,g,o,i,r)),w&&i===0&&d&&this.addCheckboxToDiv(f,d,r,o,p),l){const b=c!=="none"&&i===0;this.addLabelDiv(f,l,b,o,i,r)}return u&&this.addSortedIcon(f,u,a==null?void 0:a.sortedOptions,i),this.domService.appendChild(t,f),f}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 at,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 lt,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,a=this.domService.createText(c);this.domService.appendChild(n,a),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=Fe.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 a=this.domService.createElement("div");this.domService.addClass(a,"ge-table-focus-border"),this.setAriaHidden(a),this.domService.setStyle(a,"display","clip"),this.domService.setStyle(a,"position","absolute"),this.domService.setStyle(a,"left",`${r}px`),this.domService.setStyle(a,"top",`${n}px`),this.domService.setStyle(a,"width",`${l}px`),this.domService.setStyle(a,"height",`${c}px`),this.domService.setStyle(a,"z-index","9999"),this.applyStyle(a,s),this.domService.appendChild(e,a)}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)}};Fe.focusBorderWidthInPx=2;let Re=Fe;const ye=h=>h==="header"?"header":h==="footer"?"footer":"body";class ve{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=ye(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 Tt{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(!(e instanceof MouseEvent))return;this.mouseEvent=e;const t=this.tableScope.createGeMouseEvent(this.mouseEvent);this.tableScope.contextmenu(t)}onHostElementClicked(e){var n;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 ve(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 a=r.row;this.tableScope.setTreeRowExpanded(a,!a.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;this.lastClicked=Date.now();const t=this.tableScope.getMouseEventTarget(e),s=this.tableScope.createGeMouseEvent(e);if(t instanceof HTMLElement&&!this.isClickAction(new ve(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=ye(l),a=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,a,d));else if(n.getAttribute("data-row-index")){const p=u.getRowByIndex(a);if(l&&c==="body"&&u.isEditable(a,d)&&(this.tableScope.clearSelection(),this.tableScope.initRenderEditor(a,d)),$(p)&&d===this.getArrowColumnIndex()){e.preventDefault(),e.stopPropagation();const g=p;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(){return this.tableScope.tableModel.isRowCheckboxVisible()?1:0}onMouseDown(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.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)}}}class Be{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 ct{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 L extends Be{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 ct,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}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===L.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 It{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)}getHeaderFocus(){return this.tableScope.getHeaderFocus()}downloadExcel(e="table.xlsx",t=""){var n,l;const s=[],o=this.tableScope.tableModel,i=[];for(let c=0;c<o.getColumnCount();c++)((l=(n=o.getColumnDef(c))==null?void 0:n.isVisible)==null?void 0:l.call(n))!==!1&&i.push(c);const r=["header","body","footer"];for(const c of r){const a=o.getAreaModel(c),d=(a==null?void 0:a.getRowCount())??0;for(let u=0;u<d;u++)s.push(i.map(p=>a.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 L?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 L){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 L){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 L){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 L?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 L)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 L)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 L){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}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 dt{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 kt extends dt{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 Ft{constructor(e="collapsed",t=[],s=!1,o=!1){this.mode=e,this.rowIds=t,this.allCollapsed=s,this.allExpanded=o}}class Dt extends dt{constructor(e){super(e),this.COLLAPSED_EXPANDED_STATE="collapsedExpandedState",this.collapsedExpandedState=new Ft,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 Pt extends dt{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 H{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 ce=class ce{constructor(e){this.prefix=e}static createPrefix(e){const t=(e??"").trim();return t?`ge-${t.replace(/\s+/g,"_")}`:(ce.counter++,`ge-t${ce.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`}};ce.counter=0;let ue=ce;const De=class De{constructor(e,t,s,o){this.hostElement=e,this.tableModel=t,this.dom=s,this.tableOptions=o,this.scrollTop=0,this.areaBodyWestGeo=new H,this.areaBodyCenterGeo=new H,this.areaBodyEastGeo=new H,this.hostAttributesBefore=new Map;const i=this.hostElement;i.innerText="",this.dom.setAttribute(i,"tabindex","0"),this.ariaIds=new ue(ue.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),a=this.getAreaChild(n,l);s.setAttribute(a,"id",c),s.setAttribute(a,"role","presentation"),r.push(c)}this.setHostAriaAttribute("aria-owns",r.join(" "))}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)}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=z(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.adjustAfterScrolling()}adjustAfterScrolling(){}resetSizeOfWrapperDiv(){const e=`${this.tableModel.getContentWidthInPixel()}px`,t=this.tableModel.getContentHeightInPixel()+1,s=`${Math.min(t,De.maxScrollHeightInPx)}px`;this.dom.setStyle(this.contentWrapperDiv,"width",e),this.dom.setStyle(this.contentWrapperDiv,"height",s)}};De.maxScrollHeightInPx=8e6;let pe=De;class A{constructor(e,t,s,o,i=!1){this.r1=e,this.c1=t,this.r2=s,this.c2=o,this.gammaRange=i}static create(e){return e.gammaRange===void 0&&(e.gammaRange=!1),new A(e.rowIndex1,e.columnIndex1,e.rowIndex2,e.columnIndex2,e.gammaRange)}static singleCell(e,t){return new A(e,t,e,t)}static singleRow(e){return new A(e,0,e,Number.MAX_SAFE_INTEGER)}static singleColumn(e){return new A(0,e,Number.MAX_SAFE_INTEGER,e)}isInRange(e,t){return e>=this.r1&&e<=this.r2&&t>=this.c1&&t<=this.c2}}class Y{constructor(e="none",t="single"){this.selectionType=e,this.selectionMode=t,this.ranges=[],this.negativeRanges=[],this.allSelected=!1,this.silent=!1,this.listenerArr=[]}getEventSelectionChangedListeners(){return this.listenerArr}addEventSelectionChangedListener(e){this.listenerArr.includes(e)||this.listenerArr.push(e)}removeEventSelectionChangedListener(e){const t=this.listenerArr.indexOf(e,0);t>-1&&this.listenerArr.splice(t,1)}fireChangeEvent(){this.silent||this.listenerArr.forEach(e=>e.onSelectionChanged(this))}firstClick(e,t){this.selectionType==="row"?this.addRange(A.singleRow(e)):this.selectionType==="column"?this.addRange(A.singleColumn(t)):(this.selectionType==="cell"||this.selectionType==="range")&&this.addRange(A.singleCell(e,t))}createSnapshot(){return{ranges:[...this.ranges],negativeRanges:[...this.negativeRanges],allSelected:this.allSelected}}restoreSnapshot(e){this.ranges=[...e.ranges],this.negativeRanges=[...e.negativeRanges],this.allSelected=e.allSelected,this.fireChangeEvent()}getSelectionCount(e,t){let s=0;for(const o of this.ranges)o.isInRange(e,t)&&s++;return this.allSelected&&s++,this.isInNegativeRange(e,t)&&(s=0),s}isInNegativeRange(e,t){for(const s of this.negativeRanges)if(s.isInRange(e,t))return!0;return!1}getRanges(){return this.ranges}clear(){this.ranges=[],this.negativeRanges=[],this.allSelected=!1,this.fireChangeEvent()}hasSelection(){return this.allSelected||!!this.ranges.length}hasNoSelection(){return!this.hasSelection()}getMergedRowIndices(e){const t=e===void 0?void 0:e-1,s=[...this.ranges];this.allSelected&&t!==void 0&&s.push(new A(0,0,t,Number.MAX_SAFE_INTEGER));const o=new Set;for(const i of s){const r=Math.max(i.r1,0),n=t===void 0?i.r2:Math.min(i.r2,t);if(t===void 0&&!(n<Number.MAX_SAFE_INTEGER))continue;const l=this.negativeRanges.filter(c=>Y.intersects(c,i));for(let c=r;c<=n;c++)!o.has(c)&&(!l.length||!Y.coversColumns(l,c,i.c1,i.c2))&&o.add(c)}return Array.from(o).sort((i,r)=>i-r)}selectAll(){this.selectionType!=="none"&&(this.allSelected=!0,this.negativeRanges=[],this.fireChangeEvent())}isAllSelected(){return this.allSelected}addSelection(e){this.addRange(e)}removeSelection(e){if(this.selectionType==="none")return;let t=e;this.selectionType==="row"?t=new A(e.r1,0,e.r2,Number.MAX_SAFE_INTEGER):this.selectionType==="column"&&(t=new A(0,e.c1,Number.MAX_SAFE_INTEGER,e.c2)),this.negativeRanges.push(t),this.ranges=this.ranges.filter(s=>!this.isCoveredByNegativeRanges(s)),this.fireChangeEvent()}togglePoint(e,t){this.getSelectionCount(e,t)>0?this.removeSelection(A.singleCell(e,t)):this.reselectPoint(e,t)?this.fireChangeEvent():this.addSelection(A.singleCell(e,t))}isSelected(e,t){return this.getSelectionCount(e,t)>0}addRange(e){this.selectionType!=="none"&&(this.allSelected=!1,this.selectionMode==="single"&&(this.ranges=[],this.negativeRanges=[]),this.adjustRangeToSelectionType(e),this.liftNegativeRanges(e),this.ranges.push(e),this.fireChangeEvent())}adjustRangeToSelectionType(e){return this.selectionType==="row"?(e.c1=0,e.c2=Number.MAX_SAFE_INTEGER):this.selectionType==="column"?(e.r1=0,e.r2=Number.MAX_SAFE_INTEGER):this.selectionType==="cell"?(e.r2=e.r1,e.c2=e.c1):this.selectionType,e}reselectPoint(e,t){return this.selectionType==="none"||!this.isInNegativeRange(e,t)||!this.allSelected&&!this.ranges.some(s=>s.isInRange(e,t))?!1:(this.liftNegativeRanges(this.adjustRangeToSelectionType(A.singleCell(e,t))),!0)}liftNegativeRanges(e){if(!this.negativeRanges.length)return;const t=[];for(const s of this.negativeRanges){const o=Math.max(s.r1,e.r1),i=Math.min(s.r2,e.r2),r=Math.max(s.c1,e.c1),n=Math.min(s.c2,e.c2);if(o>i||r>n){t.push(s);continue}s.r1<o&&t.push(new A(s.r1,s.c1,o-1,s.c2,s.gammaRange)),i<s.r2&&t.push(new A(i+1,s.c1,s.r2,s.c2,s.gammaRange)),s.c1<r&&t.push(new A(o,s.c1,i,r-1,s.gammaRange)),n<s.c2&&t.push(new A(o,n+1,i,s.c2,s.gammaRange))}this.negativeRanges=t}isCoveredByNegativeRanges(e){let t=[e];for(const s of this.negativeRanges)if(t=t.flatMap(o=>Y.difference(o,s)),!t.length)return!0;return!1}static difference(e,t){const s=Math.max(e.r1,t.r1),o=Math.min(e.r2,t.r2),i=Math.max(e.c1,t.c1),r=Math.min(e.c2,t.c2);if(s>o||i>r)return[e];const n=[];return e.r1<s&&n.push(new A(e.r1,e.c1,s-1,e.c2)),o<e.r2&&n.push(new A(o+1,e.c1,e.r2,e.c2)),e.c1<i&&n.push(new A(s,e.c1,o,i-1)),r<e.c2&&n.push(new A(s,r+1,o,e.c2)),n}static intersects(e,t){return Math.max(e.r1,t.r1)<=Math.min(e.r2,t.r2)&&Math.max(e.c1,t.c1)<=Math.min(e.c2,t.c2)}static coversColumns(e,t,s,o){const i=e.filter(n=>n.r1<=t&&t<=n.r2&&n.c1<=n.c2).sort((n,l)=>n.c1-l.c1);let r=s;for(const n of i){if(n.c1>r)return!1;if(n.c2>=r&&(r=n.c2+1),r>o)return!0}return r>o}}class _t{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 Lt{constructor(e,t){this.tableModel=e,this.areaModel=t,this.colAndRowspanRanges=void 0,this.rowCountAtInit=-1}init(){if(this.rowCountAtInit=this.areaModel.getRowCount(),this.areaModel.getMaxColspan()<2&&this.areaModel.getMaxRowspan()<2){this.colAndRowspanRanges=void 0;return}this.colAndRowspanRanges=[];const e=this.areaModel.getRowCount(),t=this.tableModel.getColumnCount();for(let s=0;s<e;s++)for(let o=0;o<t;o++){let i=this.areaModel.getColspanAt(s,o),r=this.areaModel.getRowspanAt(s,o);if(i>1||r>1){i===0&&(i=1),r===0&&(r=1);const n="gammaCells"in this.areaModel;this.colAndRowspanRanges.push(new A(s,o,s+r-1,o+i-1,n))}}}initIfRowCountChanged(){return this.areaModel.getRowCount()===this.rowCountAtInit?!1:(this.init(),!0)}getRanges(){return this.colAndRowspanRanges?this.colAndRowspanRanges:[]}isInRange(e,t){if(this.colAndRowspanRanges){for(const s of this.colAndRowspanRanges)if(s.isInRange(e,t))return!0}return!1}}class D{constructor(e,t,s){this.header=e,this.body=t,this.footer=s}}class fe{constructor(e,t,s,o){this.headerRowCount=e,this.bodyRowCount=t,this.footerRowCount=s,this.colIndexMap=o}static create(e){var l,c,a;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=((a=e.getAreaModel("body"))==null?void 0:a.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 fe(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 Vt{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,a)=>r.set(c,a+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 we{static create(e){const t=new we;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 Ht extends pe{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 Vt,this.ariaSelectionKind="none",this.renderedSpanCells=new Set,this.ariaTexts=we.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 a=new Y;this.getSelectionModel=()=>a}if((c=this.tableOptions)!=null&&c.getFocusModel)this.getFocusModel=this.tableOptions.getFocusModel;else{const a=new _t("cell");this.getFocusModel=()=>a}z(t.getAreaModel("body"))&&(this.tree=!0),["header","body","footer"].forEach(a=>{var d;this.colAndRowspanModels[a]=new Lt(t,t.getAreaModel(a)),(d=this.colAndRowspanModels[a])==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.scrollPosSaveTimeout&&clearTimeout(this.scrollPosSaveTimeout),this.scrollPosSaveTimeout=setTimeout(()=>this.checkForScrollPosSaving(),500),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=fe.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 H(0,e,1,0),this.hostElement,"ge-table-border")),this.tableOptions.tableBottomBorderVisible&&this.removables.push(this.dom.addHorizontalBorder(new H(0,e,1,t-1),this.hostElement,"ge-table-border")),this.tableModel.getFixedLeftColumnCount()>0&&this.removables.push(this.dom.addVerticalBorder(new H(s,1,t,0),this.hostElement,"ge-table-body-west-vertical-border")),this.tableModel.isHeaderVisibe()&&this.removables.push(this.dom.addHorizontalBorder(new H(0,e,1,o),this.hostElement,"ge-table-body-west-vertical-border"))}checkForScrollPosSaving(){var e,t;this.storeScrollPosStateService&&((t=(e=this.tableOptions)==null?void 0:e.autoRestoreOptions)!=null&&t.autoRestoreScrollPosition)&&this.storeScrollPosStateService.updateScrollOffset([this.scrollLeft,this.scrollTop])}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 c;const a=e==="body"&&this.editorRenderer&&this.editorRendererRow===t&&this.editorRendererColumn===s;let d;if(a?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 p=r.getCustomStyleAt(t,s);if(p)for(const g in p)this.dom.setStyle(l,g,p[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>pe.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,c=this.tableModel.getPadding(),a=this.tableModel.getAreaModel(e),d=a.getRowCount();for(;this.cleanupFunctions[e].length;){const y=this.cleanupFunctions[e].shift();y&&y()}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(),g=this.tableModel.getFixedRightColumnCount(),w=this.tableModel.getFixedLeftColumnCount();e==="body"&&(this.firstVisibleRowIndex=-1,this.firstFullVisibleRowIndex=-1,this.lastVisibleRowIndex=-1,this.lastFullVisibleRowIndex=-1);let f=0;const C=(x=a.getConstantRowHeight)==null?void 0:x.call(a);if(C!==void 0&&C>0&&u<0){for(f=Math.min(d,Math.floor(-u/C));f>0&&u+f*C>0;)f--;u=u+f*C}for(let y=f;y<d;y++){const v=u,R=y===d-1,M=this.tableModel.getRowHeight(e,y);if(v+M>0){e==="body"&&this.firstVisibleRowIndex===-1&&(this.firstVisibleRowIndex=y,this.firstFullVisibleRowIndex=v<-this.pixelLimitForFullVisible?this.firstVisibleRowIndex+1:this.firstVisibleRowIndex);let T={left:n,width:l,height:M,top:v,index:y},k=this.dom.addRowDiv(o,T,y,e,"center");this.applyRowAria(k,e,a,y);const X=[k],oe=w;this.adjustColumnsToRowParent({areaIdent:e,sideIdent:"center",areaModel:a,geo:T,parent:k,rowIndex:y,columnIndexStart:oe,columnIndexEnd:p-g-1,verticalFixed:!1,lastRowOfModel:R}),c.left>0&&(T={left:n,width:this.areaBodyWestGeo.width,height:M,top:v,index:y},k=this.dom.addRowDiv(s,T,y,e,"west"),this.applyRowAria(k,e,a,y),X.push(k),this.adjustColumnsToRowParent({areaIdent:e,sideIdent:"west",areaModel:a,geo:T,parent:k,rowIndex:y,columnIndexStart:0,columnIndexEnd:oe-1,verticalFixed:!0,lastRowOfModel:R})),c.right>0&&(T={left:n,width:this.areaBodyEastGeo.width,height:M,top:v,index:y},k=this.dom.addRowDiv(i,T,y,e,"east"),this.applyRowAria(k,e,a,y),this.adjustColumnsToRowParent({areaIdent:e,sideIdent:"east",areaModel:a,geo:T,parent:k,rowIndex:y,columnIndexStart:p-g,columnIndexEnd:p-1,verticalFixed:!0,lastRowOfModel:R}));const N=e==="header"&&this.tree&&y===d-1?this.findCellDiv(X,this.getTreeArrowColumnIndex()):void 0;if(N!=null&&N.parentElement){const ie=(parseFloat(N.style.left)||0)+16,re=this.dom.applyStyle(this.dom.setAttribute(this.dom.addDiv(N.parentElement,new H(ie,20,20,8)),"data-ge-action","toggleExpandCollapseAll"),{cursor:"pointer"}),S=this.tableOptions.treeOptions.arrowExpandCollapseAll;if(S){const ne=this.dom.domService.createText(S.content);this.dom.domService.appendChild(re,ne),S.style&&this.dom.applyStyleString(re,S.style)}}}if(u=u+M,u>r){e==="body"&&(this.lastVisibleRowIndex=y,this.lastFullVisibleRowIndex=r-u<-this.pixelLimitForFullVisible?y-1:y,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+`
49
42
  render scope: this.firstFullVisibleRowIndex <- `+this.firstFullVisibleRowIndex+`
50
43
  render scope: this.lastVisibleRowIndex <- `+this.lastVisibleRowIndex+`
51
- render scope: this.lastFullVisibleRowIndex <- `+this.lastFullVisibleRowIndex),this.colAndRowspanModels&&this.colAndRowspanModels[e]){const x=((T=this.colAndRowspanModels[e])==null?void 0:T.getRanges())??[];if(x.length)for(const S of x){let E=0,R=s.child,A="center";if(S.c1<m)R=o.child,A="west";else if(f>0&&S.c1>=p-f)R=i.child,A="east";else{const _=this.areaBodyCenterGeo.width-this.tableModel.getContentWidthInPixel();E=this.snapToDevicePixel(this.scrollFactorX*_)-this.areaBodyWestGeo.width,A="center"}this.drawBigCell(S,E,t,a,R,A)}}}drawBigCell(e,t,o,s,i,r){const n=o+this.getRowHeights(0,e.r1-1,s).reduce((g,y)=>g+y,0),l=this.tableModel.getColumnCount(),c=this.tableModel.getFixedRightColumnCount();let a=0;c>0&&e.c1>=l-c&&(a=l-c);const d=t+this.getColumnWidths(a,e.c1-1).reduce((g,y)=>g+y,0),u=this.getRowHeights(e.r1,e.r2,s).reduce((g,y)=>g+y,0),p=this.getColumnWidths(e.c1,e.c2).reduce((g,y)=>g+y,0);let f=!1;const m=this.getSelectionModel?this.getSelectionModel():void 0;m&&(f=m.getSelectionCount(e.r1,e.c1)>0),e.gammaRange?this.renderCell({areaModel:s,areaIdent:s.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:s,areaIdent:s.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}),s.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,o){const s=e.getMaxRowspan();for(let i=t-1;i>-1;i--){const r=e.getRowspanAt(i,o);if(r>1&&i+r+1>=t)return i;if(t-i>s)return-1}return-1}adjustColumnsToRowParent({areaIdent:e,sideIdent:t,areaModel:o,geo:s,parent:i,rowIndex:r,columnIndexStart:n,columnIndexEnd:l,verticalFixed:c=!1,lastRowOfModel:a=!1}){var m;let d=0;if(!c){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 y=f,w=this.tableModel.getColumnWidth(g);if(w>0&&y+w>0){let v=s.height;const T=o.getRowspanAt(r,g),x=o.getColspanAt(r,g);T>1&&(v=this.getRowHeights(r,r+T-1,o).reduce((R,A)=>R+A,0));let S=w;x>1&&(S=this.getColumnWidths(g,g+x-1).reduce((R,A)=>R+A,0));let E=!1;if(this.colAndRowspanModels&&this.colAndRowspanModels[e]&&(m=this.colAndRowspanModels[e])!=null&&m.isInRange(r,g)&&(E=!0),this.draggingTargetColumnIndex===g&&e!=="header"){this.renderDragTargetDiv(i,y,u,S,v);const R={left:y,top:u,width:S,height:v};this.dom.addColumnBorderDivs(this.tableOptions,i,R,e,t)}else{const R=this.renderSelectedBackgroundDiv(E,p,t,o,r,g,i,y,u,S,v);"gammaCells"in o&&o.getValueAt(r,g)&&(E=!1),E||this.renderCell({areaModel:o,areaIdent:e,sideIdent:t,rowIndex:r,columnIndex:g,left:y,top:u,width:S,height:v,parent:i,cellSelected:R,lastRowOfModel:a,gammaRange:!0}),e==="header"&&this.tableOptions.columnsResizable&&this.renderHeaderCellResizeHandle({rowIndex:r,columnIndex:g,cellLeft:y,cellTop:u,cellWidth:S,cellHeight:v,parent:i})}}if(f=f+w,f>this.areaBodyCenterGeo.width)break}this.tableOptions.verticalBorderVisible&&this.dom.addVerticalBorder(new O(f-1,1,s.height,0),i)}getTreeArrowColumnIndex(){return this.tableOptions.showCheckboxWihoutExtraColumn?0:this.tableModel.isRowCheckboxVisible()?1:0}addAndRenderCellDiv({areaModel:e,areaIdent:t,sideIdent:o,rowIndex:s,index:i,left:r,width:n,height:l,top:c,parent:a,lastRowOfModel:d}){var q;const u=t==="body"&&this.editorRenderer&&this.editorRendererRow===s&&this.editorRendererColumn===i,p=u?this.editorRenderer:e.getCellRenderer(s,i),f={left:r,width:n,height:l,top:c,index:i},m=e.getRowByIndex(s);let g="none";if(i===this.getTreeArrowColumnIndex()&&G(m)){const C=m;(q=C.children)!=null&&q.length?C.expanded?g="expanded":g="collapsed":g="hidden"}let w;if(t==="header"){const C=this.tableModel.getColumnDef(i);(!(C!=null&&C.sortIconVisible)||C!=null&&C.sortIconVisible())&&(w=C==null?void 0:C.sortState)}const v=e.getValueAt(s,i),T=p?"":`${v??""}`,x=e.isRowChecked(s),S=this.dom.addColumnDiv({parent:a,geo:f,rowIndex:s,columnIndex:i,areaIdent:t,sideIdent:o,text:T,treeArrow:g,tableOptions:this.tableOptions,checkedType:x,sortState:w}),E=e.getTooltipAt(s,i);E&&this.dom.setAttribute(S,"title",E);const R=this.tableModel.getColumnDef(i);R&&R.classes[t]&&this.dom.addClasses(R.classes[t],S);let A;if(p&&(A=p.render(S,s,i,t,e,v,this.dom.domService),u)){const C=S.querySelector("input, select");C&&!C.contains(document.activeElement)&&C.focus()}const _=e.getCustomClassesAt(s,i);if(_.length&&this.dom.addClasses(_,S),this.dom.addColumnBorderDivs(this.tableOptions,a,f,t,o),d&&this.dom.addHorizontalBorder({left:r,width:n,height:l,top:c+l},a),this.getFocusModel&&t==="body"){const C=this.getFocusModel();C!=null&&C.hasFocus(s,i)&&this.dom.addFocusBorderDivs(a,f,{})}t==="header"&&this.dom.setAttribute(S,"data-ge-action","drag-column");const z=e.getCustomStyleAt(s,i);if(z)for(const C in z)this.dom.setStyle(S,C,z[C]);return[S,A]}applyCssClasses(e,t={}){e&&Object.entries(t).forEach(([o,s])=>{s?this.dom.addClass(o,e):this.dom.removeClass(o,e)})}getColumnWidths(e,t){const o=[];for(let s=e;s<=t;s++)o.push(this.tableModel.getColumnWidth(s));return o}getRowHeights(e,t,o){const s=[];for(let i=e;i<=t;i++)s.push(o.getRowHeight(i));return s}adjustHoverRows(e){if(this.tableOptions.hoverRowVisible&&e.rowIndex>-1){const t=this.hostElement.clientWidth,o=this.tableModel.getAreaModel("body").getRowHeight(e.rowIndex),s=this.isScrollHeightCapped()?this.contentScrollTop:this.scrollTop,i=e.rowTop+this.areaHeaderCenter.parent.clientHeight-s;this.dom.applyStyle(this.hoverRow,{left:"0",top:i+"px",width:t+"px",height:o+"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,o=this.tableModel.getColumnWidth(e.columnIndex),s=this.areaBodyWestGeo.width,i=e.columnLeft+this.tableModel.getPadding().left-this.scrollLeft-s;this.dom.applyStyle(this.hoverColumn,{left:i+"px",top:"0px",width:o+"px",height:t+"px",display:"block"})}else this.hideHoverColumn()}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(e.bind(this),t)}adjustDraggingColumn(e,t,o){var s,i;if(this.dragging){const r=this.hostElement.clientHeight,n=this.storedColumnWidths[t];if((s=e.originalEvent)!=null&&s.clientX){const a={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",overfllow:"clip"}),this.dom.applyStyleInPx(this.draggingColumn,a),o&&this.renderContentOfDraggingColumn(a)}}else this.hideDraggingColumn()}renderContentOfDraggingColumn(e){const t=this.renderContentOfDraggingColumnForArea(e,"header",0);this.renderContentOfDraggingColumnForArea(e,"body",t)}renderContentOfDraggingColumnForArea(e,t,o=0){const s="center",i=this.tableModel.getAreaModel(t),r=i==null?void 0:i.getRowCount();if(r){const n=e.index??0,l=this.draggingColumn;for(let c=0;c<r;c++){const a=o,d=i.getRowHeight(c),u={left:0,width:e.width,height:d,top:a,index:c},p=i.getValueAt(c,n),f=i.getCellRenderer(c,n),m=f?"":`${p??""}`,g={parent:l,geo:u,rowIndex:c,columnIndex:n,areaIdent:t,sideIdent:s,text:m},y=this.dom.addColumnDiv(g);let w;f&&(w=f.render(y,c,n,t,i,p,this.dom.domService),w&&this.cleanupFunctions[t].push(w));const v=i.getCustomClassesAt(c,n);v.length&&this.dom.addClasses(v,y);const T=this.tableModel.getColumnDef(n);T&&T.classes[t]&&this.dom.addClasses(T.classes[t],y),this.dom.addColumnBorderDivs(this.tableOptions,l,u,t,s);const x=i.getCustomStyleAt(c,n);if(x)for(const S in x)this.dom.setStyle(y,S,x[S]);o=o+d}}return o}hideDraggingColumn(){this.dom.applyStyle(this.draggingColumn,{display:"none"})}renderDragTargetDiv(e,t,o,s,i){const r=this.dom.applyStylePosistionAbsolute(this.dom.createDivWithClass("ge-table-drop-zone",e));return this.dom.setStyle(r,"left",`${t}px`),this.dom.setStyle(r,"top",`${o}px`),this.dom.setStyle(r,"width",`${s}px`),this.dom.setStyle(r,"height",`${i}px`),r}renderSelectedBackgroundDiv(e,t,o,s,i,r,n,l,c,a,d){let u=!1;if(!e&&t&&s.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.createDivWithClass(`ge-table-${s.areaIdent}-${o}-selected-range`,n));this.dom.setStyle(g,"left",`${l}px`),this.dom.setStyle(g,"top",`${c}px`),this.dom.setStyle(g,"width",`${a}px`),this.dom.setStyle(g,"height",`${d}px`)}}}return u}renderCell({areaModel:e,areaIdent:t,sideIdent:o,rowIndex:s,columnIndex:i,left:r,top:n,width:l,height:c,parent:a,cellSelected:d,lastRowOfModel:u}){const[p,f]=this.addAndRenderCellDiv({areaModel:e,areaIdent:t,sideIdent:o,rowIndex:s,index:i,left:r,width:l,height:c,top:n,parent:a,lastRowOfModel:u});d&&this.dom.addClass(`ge-table-${t}-${o}-selected-range`,p),f&&this.cleanupFunctions[t].push(f)}renderHeaderCellResizeHandle({rowIndex:e,columnIndex:t,cellLeft:o,cellTop:s,cellWidth:i,cellHeight:r,parent:n}){const l=this.dom.domService,c=this.tableOptions.columnResizeHandleWidthInPx??2,a=l.createElement("div");l.setAttribute(a,"data-col-index",`${t}`),l.setAttribute(a,"data-row-index",`${e}`),l.setAttribute(a,"data-area","header"),l.setAttribute(a,"data-ge-action","resize-column"),l.addClass(a,"ge-table-column-resize-handle"),l.setStyle(a,"display","clip"),l.setStyle(a,"position","absolute"),l.setStyle(a,"cursor","col-resize"),l.setStyle(a,"left",`${o+i-c}px`),l.setStyle(a,"top",`${s}px`),l.setStyle(a,"width",`${c}px`),l.setStyle(a,"height",`${r}px`),l.appendChild(n,a)}}class Ae{constructor(e,t){this.columnIndex=e,this.sortState=t}}class gt{constructor(e){this.tableScope=e,this.tableScope.hostElement.addEventListener("change",this.onHostElementChanged.bind(this),{signal:this.tableScope.listenerAbortController.signal})}onHostElementChanged(e){if(e.target instanceof HTMLInputElement||e.target instanceof HTMLSelectElement||e.target instanceof HTMLTextAreaElement){const t=e.target,o=t.getAttribute("data-area"),s=t.getAttribute("data-row-index"),i=t.getAttribute("data-col-index");if(o&&s&&i){const r=se(o),n=Number(s),l=Number(i);this.tableScope.updateModelValueAfterEdit(r,n,l,t.value)}}}}class ft{constructor(e=-1,t=-1){this.rowIndex=e,this.columnIndex=t}}class Se{constructor(e){this.cells=e}static createSingle(e,t){return new Se([new ft(e,t)])}}class mt{constructor(e,t,o,s,i,r,n,l){this.scrollTop=e,this.scrollLeft=t,this.scrollHeight=o,this.scrollWidth=s,this.clientHeight=i,this.clientWidth=r,this.scrollFactorY=n,this.scrollFactorX=l}}class bt{constructor(e){this.tableScope=e,this.ignoreNextClick=!1,this.getSelectionModel=()=>this.tableScope.selectionModel(),this.getFocusModel=()=>this.tableScope.focusModel()}onMouseDown(){this.ignoreNextClick=!1}onMouseDragging(e,t){var i,r;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 o=(i=this.getSelectionModel)==null?void 0:i.call(this);if(!o||!("selectionType"in o)||o.selectionType!=="range")return!1;o.clear(),o.addSelection(this.createRangeByEvents(e,t));const s=(r=this.getFocusModel)==null?void 0:r.call(this);return s&&!s.hasFocus(t.rowIndex,t.columnIndex)&&(s.setFocus(t.rowIndex,t.columnIndex),this.tableScope.onFocusChanged(s)),this.previousEvt=t.clone(),this.ignoreNextClick=e.rowIndex!==t.rowIndex||e.columnIndex!==t.columnIndex,this.tableScope.onSelectionChanged(o),!0}onMouseClicked(e,t){var i,r,n,l,c,a,d;if(this.ignoreNextClick)return this.ignoreNextClick=!1,!1;let o=!1,s=!1;if(this.getSelectionModel&&this.getFocusModel){const u=this.getSelectionModel(),p=this.getFocusModel();u&&p&&(p.hasFocus(e.rowIndex,e.columnIndex)||(p.setFocus(e.rowIndex,e.columnIndex),this.tableScope.onFocusChanged(p),o=!0),(i=e.originalEvent)!=null&&i.shiftKey||u.hasSelection()&&(u.clear(),o=!0),(r=e.originalEvent)!=null&&r.shiftKey&&this.previousEvt?(u.addSelection(this.createRangeByEvents(e,this.previousEvt)),s=!0,o=!0):(n=e.originalEvent)!=null&&n.altKey&&((l=e.originalEvent)!=null&&l.ctrlKey||(c=e.originalEvent)!=null&&c.metaKey)?(u.removeSelection(M.singleCell(e.rowIndex,e.columnIndex)),s=!0,o=!0):(a=e.originalEvent)!=null&&a.ctrlKey||(d=e.originalEvent)!=null&&d.metaKey?(u.addSelection(M.singleCell(e.rowIndex,e.columnIndex)),s=!0,o=!0):(u.firstClick(e.rowIndex,e.columnIndex),o=!0),this.tableScope.onSelectionChanged(u))}return s?this.previousEvt=void 0:this.previousEvt=e==null?void 0:e.clone(),o}onActionTriggered(e){if(this.getSelectionModel&&this.getFocusModel){const t=this.getSelectionModel(),o=this.getFocusModel();if(t&&o){if(e==="SELECT_ALL")return t.selectAll(),this.tableScope.repaint(),!0;if(e==="DESELECT_ALL")return t.clear(),this.tableScope.repaint(),!0;if(e==="TOGGLE_SELECTION"){const[s,i]=o.getFocus();return t.togglePoint(s,i),this.tableScope.repaint(),!0}}}return!1}createRangeByEvents(e,t){t||(t=e);const o=Math.min(e.rowIndex,t==null?void 0:t.rowIndex),s=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 M.create({rowIndex1:o,columnIndex1:i,rowIndex2:s,columnIndex2:r})}}class yt{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","meta+c":"COPY_2_CLIPBOARD","ctrl+c":"COPY_2_CLIPBOARD"}}}class wt{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","meta+c":"COPY_2_CLIPBOARD","ctrl+c":"COPY_2_CLIPBOARD"}}}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).filter((e,t,o)=>o.indexOf(e)===t).sort((e,t)=>{const o={cmd:1,ctrl:2,alt:3,shift:4},s=o[e]||5,i=o[t]||5;return s!==i?s-i:e.localeCompare(t)}).join(" ")}function Me(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 o=h.code.replace("Numpad","").toLowerCase();o==="add"?e="num_add":o==="subtract"?e="num_subtract":o==="multiply"?e="num_multiply":o==="divide"?e="num_divide":o==="decimal"?e="num_decimal":o==="enter"?e="num_enter":e="num_"+o}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 St{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 wt().get()):Object.assign(this.shortcutActionIdMapping,new yt().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"].includes(t.tagName)))return;const o=this.findEntity(e);o&&this.emit(o)&&(e.preventDefault(),e.stopPropagation())}emit(e){this.isDebug()&&console.debug("ShortcutService emit :",e);let t=!1;for(const o of this.listener)o.onActionTriggered(e)&&(t=!0);return t}findEntity(e){const t=Me(e);this.isDebug()&&console.debug("ShortcutService shortcut :",t);for(const o in this.shortcutActionIdMapping)if(Me(e)===t)return this.isDebug()&&console.debug("ShortcutService action :",this.shortcutActionIdMapping[o]),this.shortcutActionIdMapping[o]}getShortcutActionMapping(){return this.shortcutActionIdMapping}}class de{onCheckboxChanged(e){}onContextmenu(e){}onModelChanged(e){}onMouseClicked(e){}onMouseDragging(e){}onMouseDraggingEnd(e){}onMouseMoved(e){}onScroll(e){}onSelectionChanged(e){}onFocusChanged(e){}}class Ct{setStyle(e,t,o){return e.style[t]=o,e}appendText(e,t){const o=this.createText(t);return this.appendChild(e,o),o}addClass(e,t){return t.includes(" ")?t.split(" ").forEach(o=>e.classList.add(o)):e.classList.add(t),e}removeClass(e,t){return t.includes(" ")?t.split(" ").forEach(o=>e.classList.remove(o)):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,o){e.setAttribute(t,o)}}class vt{render(e,t,o,s,i,r,n){if(i.isEditable(t,o)){n.addClass(e,"ge-table-row-input-div");const l=i.getValueAt(t,o);e.innerHTML=`
44
+ render scope: this.lastFullVisibleRowIndex <- `+this.lastFullVisibleRowIndex),this.pruneRowDivCache(s),this.pruneRowDivCache(o),this.pruneRowDivCache(i),this.colAndRowspanModels&&this.colAndRowspanModels[e]){const y=((I=this.colAndRowspanModels[e])==null?void 0:I.getRanges())??[];if(y.length)for(const v of y){if(v.r1>=d||v.c1>=p)continue;let R=0,M=o.child,T="center";if(v.c1<w)M=s.child,T="west";else if(g>0&&v.c1>=p-g)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(v,R,t,a,M,T)}}this.updateRowGroupRoles(s,o,i)}getAriaGridInfo(){return this.ariaGridInfo||(this.ariaGridInfo=fe.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&&z(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 c=n.colIndex(i);c>0&&r.setAttribute(e,"aria-colindex",`${c}`);const a=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)}`),a>1&&r.setAttribute(e,"aria-rowspan",`${a}`),(a>1||d>1)&&this.renderedSpanCells.add(`${t}:${o}:${i}`),l&&o+a>=n.headerRowCount&&d===1){const p=this.tableModel.getColumnDef(i);if((u=p==null?void 0:p.sortable)!=null&&u.call(p)){const g=p.sortState;r.setAttribute(e,"aria-sort",g==="asc"?"ascending":g==="desc"?"descending":"none")}}return[a,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(nt(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 a=0;c>0&&e.c1>=l-c&&(a=l-c);const d=t+this.getColumnWidths(a,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 g=!1;const w=this.getSelectionModel?this.getSelectionModel():void 0;w&&(g=w.getSelectionCount(e.r1,e.c1)>0);const f=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(`${f}:${e.r1}:${e.c1}`)?this.dom.setAriaHidden(C):this.applyRowAria(C,f,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: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:p,height:u,parent:i,cellSelected:g,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:c=!1,lastRowOfModel:a=!1}){var w;let d=0;if(!c){const f=this.areaBodyCenterGeo.width-this.tableModel.getContentWidthInPixel();d=this.snapToDevicePixel(this.scrollFactorX*f)}const u=0,p=!!(e==="body"&&t);let g=d;for(let f=n;f<=l;f++){const C=g,b=this.tableModel.getColumnWidth(f);if(b>0&&C+b>0){let x=o.height;const I=s.getRowspanAt(r,f),y=s.getColspanAt(r,f);I>1&&(x=this.getRowHeights(r,r+I-1,s).reduce((M,T)=>M+T,0));let v=b;y>1&&(v=this.getColumnWidths(f,f+y-1).reduce((M,T)=>M+T,0));let R=!1;if(this.colAndRowspanModels&&this.colAndRowspanModels[e]&&(w=this.colAndRowspanModels[e])!=null&&w.isInRange(r,f)&&(R=!0),this.draggingTargetColumnIndex===f&&e!=="header"){this.renderDragTargetDiv(i,C,u,v,x);const M={left:C,top:u,width:v,height:x};this.dom.addColumnBorderDivs(this.tableOptions,i,M,e,t)}else{const M=this.renderSelectedBackgroundDiv(R,p,t,s,r,f,i,C,u,v,x);"gammaCells"in s&&s.getValueAt(r,f)&&(R=!1),R||this.renderCell({areaModel:s,areaIdent:e,sideIdent:t,rowIndex:r,columnIndex:f,left:C,top:u,width:v,height:x,parent:i,cellSelected:M,lastRowOfModel:a,gammaRange:!0}),e==="header"&&this.tableOptions.columnsResizable&&this.renderHeaderCellResizeHandle({rowIndex:r,columnIndex:f,cellLeft:C,cellTop:u,cellWidth:v,cellHeight:x,parent:i})}}if(g=g+b,g>this.areaBodyCenterGeo.width)break}this.tableOptions.verticalBorderVisible&&this.dom.addVerticalBorder(new H(g-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:c,parent:a,lastRowOfModel:d}){var re;const u=t==="body"&&this.editorRenderer&&this.editorRendererRow===o&&this.editorRendererColumn===i,p=u?this.editorRenderer:e.getCellRenderer(o,i),g={left:r,width:n,height:l,top:c,index:i},w=e.getRowByIndex(o);let f="none";if(i===this.getTreeArrowColumnIndex()&&$(w)){const S=w;("hasDisplayedChildren"in e&&typeof e.hasDisplayedChildren=="function"?e.hasDisplayedChildren(S):!!((re=S.children)!=null&&re.length))?S.expanded?f="expanded":f="collapsed":f="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??""}`,y=e.isRowChecked(o),v=this.tableOptions.showCheckboxWihoutExtraColumn&&i===0&&y?this.getCheckboxAriaLabel(t,o):void 0,R=this.dom.addColumnDiv({parent:a,geo:g,rowIndex:o,columnIndex:i,areaIdent:t,sideIdent:s,text:I,treeArrow:f,tableOptions:this.tableOptions,checkedType:y,sortState:b,checkboxAriaLabel:v}),[M,T]=this.applyCellAria(R,t,e,o,i),k=e.getTooltipAt(o,i);k&&this.dom.setAttribute(R,"title",k);const X=this.tableModel.getColumnDef(i);X&&X.classes[t]&&this.dom.addClasses(X.classes[t],R);let oe;if(p)if(oe=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 N=e.getCustomClassesAt(o,i);if(N.length&&this.dom.addClasses(N,R),this.dom.addColumnBorderDivs(this.tableOptions,a,g,t,s),d&&this.dom.addHorizontalBorder({left:r,width:n,height:l,top:c+l},a),this.getFocusModel&&t==="body"&&!this.headerFocus){const S=this.getFocusModel();if(S!=null&&S.hasFocus(o,i))this.dom.addFocusBorderDivs(a,g,{}),this.setAriaFocusedCell(R,t,o,i);else if(S&&(M>1||T>1)){const[ne,bt]=S.getFocus();ne>=o&&ne<o+M&&bt>=i&&bt<i+T&&this.setAriaFocusedCell(R,t,o,i)}}else t==="header"&&this.headerFocus&&this.headerFocus[0]===o&&this.headerFocus[1]===i&&(this.dom.addFocusBorderDivs(a,g,{}),this.setAriaFocusedCell(R,t,o,i));t==="header"&&this.dom.setAttribute(R,"data-ge-action","drag-column");const ie=e.getCustomStyleAt(o,i);if(ie)for(const S in ie)this.dom.setStyle(R,S,ie[S]);return[R,oe]}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 a={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,a),s&&this.renderContentOfDraggingColumn(a)}}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,a=this.draggingColumn;for(let d=o;d<l&&s<i;d++){const u=s,p=n.getRowHeight(d),g={left:0,width:e.width,height:p,top:u,index:d},w=n.getValueAt(d,c),f=n.getCellRenderer(d,c),C=f?"":`${w??""}`,b={parent:a,geo:g,rowIndex:d,columnIndex:c,areaIdent:t,sideIdent:r,text:C},x=this.dom.addColumnDiv(b);let I;f&&(I=f.render(x,d,c,t,n,w,this.dom.domService),I&&this.cleanupFunctions[t].push(I));const y=n.getCustomClassesAt(d,c);y.length&&this.dom.addClasses(y,x);const v=this.tableModel.getColumnDef(c);v&&v.classes[t]&&this.dom.addClasses(v.classes[t],x),this.dom.addColumnBorderDivs(this.tableOptions,a,g,t,r);const R=n.getCustomStyleAt(d,c);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,c,a,d){let u=!1;if(!e&&t&&o.isSelectable(i,r)&&this.getSelectionModel){const p=this.getSelectionModel();if(p){const g=p.getSelectionCount(i,r);u=g>0;for(let w=0;w<g;w++){const f=this.dom.applyStylePosistionAbsolute(this.dom.setAriaHidden(this.dom.createDivWithClass(`ge-table-${o.areaIdent}-${s}-selected-range`,n)));this.dom.setStyle(f,"left",`${l}px`),this.dom.setStyle(f,"top",`${c}px`),this.dom.setStyle(f,"width",`${a}px`),this.dom.setStyle(f,"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:a,cellSelected:d,lastRowOfModel:u}){const[p,g]=this.addAndRenderCellDiv({areaModel:e,areaIdent:t,sideIdent:s,rowIndex:o,index:i,left:r,width:l,height:c,top:n,parent:a,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"),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,a=l.createElement("div");l.setAttribute(a,"data-col-index",`${t}`),l.setAttribute(a,"data-row-index",`${e}`),l.setAttribute(a,"data-area","header"),l.setAttribute(a,"data-ge-action","resize-column"),l.addClass(a,"ge-table-column-resize-handle"),l.setAttribute(a,"aria-hidden","true"),l.setStyle(a,"display","clip"),l.setStyle(a,"position","absolute"),l.setStyle(a,"cursor","col-resize"),l.setStyle(a,"left",`${s+i-c}px`),l.setStyle(a,"top",`${o}px`),l.setStyle(a,"width",`${c}px`),l.setStyle(a,"height",`${r}px`),l.appendChild(n,a)}}class Ye{constructor(e,t){this.columnIndex=e,this.sortState=t}}class Ot{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=ye(s),n=Number(o),l=Number(i);this.tableScope.updateModelValueAfterEdit(r,n,l,t.value)}}}}class Bt{constructor(e=-1,t=-1){this.rowIndex=e,this.columnIndex=t}}class $e{constructor(e){this.cells=e}static createSingle(e,t){return new $e([new Bt(e,t)])}}class $t{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 ge{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)&&ge.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!=="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 a,d,u,p;i.hasFocus(e.rowIndex,e.columnIndex)||i.setFocus(e.rowIndex,e.columnIndex);const r=!!((a=e.originalEvent)!=null&&a.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&&ge.hasSnapshots(o)){const w=o.createSnapshot();o.restoreSnapshot({...w,ranges:w.ranges.filter(f=>!this.anchorRanges.includes(f))})}const g=this.createRangeByEvents(e,this.previousEvt);o.addSelection(g),this.anchorRanges=[g],this.tableScope.onSelectionChanged(o);return}const c=o.getRanges().slice();n&&l?o.removeSelection(A.singleCell(e.rowIndex,e.columnIndex)):n?o.togglePoint(e.rowIndex,e.columnIndex):(!r&&o.hasSelection()&&o.clear(),o.firstClick(e.rowIndex,e.columnIndex)),this.anchorRanges=o.getRanges().filter(g=>!c.includes(g)),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 A.create({rowIndex1:s,columnIndex1:i,rowIndex2:o,columnIndex2:r})}}class Nt{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 Wt{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 ms={arrowup:"up",arrowdown:"down",arrowleft:"left",arrowright:"right"};function ht(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=>ms[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 Gt(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"),ht(t+" "+e)}class zt{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 Wt().get()):Object.assign(this.shortcutActionIdMapping,new Nt().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=Gt(e);this.isDebug()&&console.debug("ShortcutService shortcut :",t);for(const s in this.shortcutActionIdMapping)if(ht(s)===t)return this.isDebug()&&console.debug("ShortcutService action :",this.shortcutActionIdMapping[s]),this.shortcutActionIdMapping[s]}getShortcutActionMapping(){return this.shortcutActionIdMapping}}class Me{onCheckboxChanged(e){}onContextmenu(e){}onModelChanged(e){}onMouseClicked(e){}onMouseDragging(e){}onMouseDraggingEnd(e){}onMouseMoved(e){}onScroll(e){}onSelectionChanged(e){}onFocusChanged(e){}}class jt{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 Yt{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=`
52
45
  <input
53
46
  type="text"
54
- value="${l}"
47
+ value="${E(l)}"
55
48
  autofocus
56
49
  onfocus="this.setSelectionRange(0, this.value.length)"
57
50
  data-listen="change"
58
- data-area="${s}"
51
+ data-area="${o}"
59
52
  data-row-index="${t}"
60
- data-col-index="${o}"
53
+ data-col-index="${s}"
61
54
  data-input-type="text"
62
55
  style="width:calc(100% - 8px);height:100%;border:0;padding:0 0 0 8px;"
63
- class="ge-table-cell-editor-input">`}}}class Ce{constructor(e=new V("❯","",["gt-table-icon-expanded"]),t=new V("❯","transform: rotate(180deg) translate(-100%, -100%); transform-origin: 0 0;",["ge-table-icon-collapsed"])){this.iconExpanded=e,this.iconCollapsed=t}}class J{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 Be,this.headerGroupOptions=new Ce,this.showCheckboxWihoutExtraColumn=!1,this.externalFilterFunction=void 0,this.sortedOptions=new $e,this.sortOrder=["asc","desc"],this.shortcutActionsDisabled=!1,this.resizeEventDebounceDelay=500,this.getEditRenderer=(e,t)=>new vt,this.getSelectionModel=void 0,this.getFocusModel=void 0}}const U=class U{createContent(e,t,o){return new Promise((s,i)=>{var r,n;if(t!=null&&t.hasSelection()){const l=this.mergeRanges(t.getRanges());if(l){l.c2=Math.min(l.c2,e.getColumnCount()-1),l.r2=Math.min(l.r2,e.getBodyModel().getRowCount()-1);const c=[];for(let a=l.r1;a<=l.r2;a++){const d=[];for(let u=l.c1;u<=l.c2;u++){if(((n=(r=e.getColumnDef(u))==null?void 0:r.isVisible)==null?void 0:n.call(r))===!1)continue;const p=t.isSelected(a,u)?e.getBodyModel().getTextValueAt(a,u):"";d.push(p)}c.push(d.join(U.columnSeparatorChar))}return s(c.join(U.rowSeparatorChar))}}if(o){const[l,c]=o.getFocus(),a=e.getBodyModel().getTextValueAt(l,c);return s(a)}i("Cannot copy, neither selection nor focus defined.")})}copyContent(e){return navigator.clipboard.writeText(e)}copyToClipboard(e,t,o){return new Promise((s,i)=>{this.createContent(e,t,o).then(r=>{r?this.copyContent(r).then(n=>{s(r)}).catch(n=>{i()}):s("")}).catch(r=>{i()})})}mergeRanges(e){let t;for(const o of e)t?(t.r1=Math.min(t.r1,o.r1),t.c1=Math.min(t.c1,o.c1),t.r2=Math.max(t.r2,o.r2),t.c2=Math.max(t.c2,o.c2)):t=new M(o.r1,o.c1,o.r2,o.c2);return t}};U.columnSeparatorChar=" ",U.rowSeparatorChar=`
64
- `;let te=U;class Rt{constructor(e,t=500){this.tableScope=e,this.debounceDelay=t,this.disconnected=!1,this.resizeObserver=new ResizeObserver(Ue(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:o}=t.contentRect;this.tableScope.recalcColumnWidths(o)}}let ie;function Ye(h){if(!ie){ie=new Uint32Array(256);for(let t=0;t<256;t++){let o=t;for(let s=0;s<8;s++)o=o&1?3988292384^o>>>1:o>>>1;ie[t]=o>>>0}}let e=4294967295;for(let t=0;t<h.length;t++)e=ie[(e^h[t])&255]^e>>>8;return(e^4294967295)>>>0}async function Xt(h){const e=globalThis.CompressionStream;if(!(!e||typeof Response>"u"||typeof Blob>"u"))try{const t=new Blob([h]).stream().pipeThrough(new e("deflate-raw"));return new Uint8Array(await new Response(t).arrayBuffer())}catch{return}}class At{downloadExcel(e,t="file.xlsx",o=""){if(!Array.isArray(e)||e.some(s=>!Array.isArray(s)))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,o).then(s=>{const i=URL.createObjectURL(s),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(s=>{throw console.error("Error generating Excel file:",s),new Error("Failed to download Excel file.")})}async createExcelBlob(e,t=""){const o=await this.createZipCompressed(this.generateMap(e,t));return new Blob([o],{type:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"})}generateMap(e,t=""){const o=`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
65
- <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>`,s=`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
56
+ class="ge-table-cell-editor-input">`}}}class Ne{constructor(e=new O("❯","",["gt-table-icon-expanded"]),t=new O("❯","transform: rotate(180deg) translate(-100%, -100%); transform-origin: 0 0;",["ge-table-icon-collapsed"])){this.iconExpanded=e,this.iconCollapsed=t}}class se{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 lt,this.headerGroupOptions=new Ne,this.showCheckboxWihoutExtraColumn=!1,this.externalFilterFunction=void 0,this.sortedOptions=new at,this.sortOrder=["asc","desc"],this.shortcutActionsDisabled=!1,this.resizeEventDebounceDelay=500,this.getEditRenderer=(e,t)=>new Yt,this.getSelectionModel=void 0,this.getFocusModel=void 0,this.ariaLabel=void 0,this.ariaLabelledBy=void 0,this.ariaDescribedBy=void 0,this.ariaTexts=void 0}}const B=class B{createContent(e,t,s){return new Promise((o,i)=>{var r,n;if(t!=null&&t.hasSelection()){const l=t.isAllSelected()?new A(0,0,Number.MAX_SAFE_INTEGER,Number.MAX_SAFE_INTEGER):this.mergeRanges(t.getRanges());if(l){l.c2=Math.min(l.c2,e.getColumnCount()-1),l.r2=Math.min(l.r2,e.getBodyModel().getRowCount()-1);const c=Math.max(0,l.r2-l.r1+1)*Math.max(0,l.c2-l.c1+1);if(c>B.maxCopyCells)return i(`Cannot copy ${c} cells – more than CopyService.maxCopyCells (${B.maxCopyCells}).`);const a=[];for(let d=l.r1;d<=l.r2;d++){const u=[];for(let p=l.c1;p<=l.c2;p++){if(((n=(r=e.getColumnDef(p))==null?void 0:r.isVisible)==null?void 0:n.call(r))===!1)continue;const g=t.isSelected(d,p)?e.getBodyModel().getTextValueAt(d,p):"";u.push(g)}a.push(u.join(B.columnSeparatorChar))}return o(a.join(B.rowSeparatorChar))}}if(s){const[l,c]=s.getFocus(),a=e.getBodyModel().getTextValueAt(l,c);return o(a)}i("Cannot copy, neither selection nor focus defined.")})}copyContent(e){return navigator.clipboard.writeText(e)}copyToClipboard(e,t,s){return new Promise((o,i)=>{this.createContent(e,t,s).then(r=>{r?this.copyContent(r).then(n=>{o(r)}).catch(n=>{i()}):o("")}).catch(r=>{i()})})}mergeRanges(e){let t;for(const s of e)t?(t.r1=Math.min(t.r1,s.r1),t.c1=Math.min(t.c1,s.c1),t.r2=Math.max(t.r2,s.r2),t.c2=Math.max(t.c2,s.c2)):t=new A(s.r1,s.c1,s.r2,s.c2);return t}};B.maxCopyCells=1e6,B.columnSeparatorChar=" ",B.rowSeparatorChar=`
57
+ `;let Z=B;class Ut{constructor(e,t=500){this.tableScope=e,this.debounceDelay=t,this.disconnected=!1,this.resizeObserver=new ResizeObserver(wt(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 Ce;function mt(h){if(!Ce){Ce=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;Ce[t]=s>>>0}}let e=4294967295;for(let t=0;t<h.length;t++)e=Ce[(e^h[t])&255]^e>>>8;return(e^4294967295)>>>0}async function ys(h){const e=globalThis.CompressionStream;if(!(!e||typeof Response>"u"||typeof Blob>"u"))try{const t=new Blob([h]).stream().pipeThrough(new e("deflate-raw"));return new Uint8Array(await new Response(t).arrayBuffer())}catch{return}}class Kt{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
+ <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"?>
66
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"?>
67
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"?>
68
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"?>
@@ -70,14 +63,14 @@ render scope: this.lastFullVisibleRowIndex <- `+this.lastFullVisibleRowIndex),th
70
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"?>
71
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>`,a=`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
72
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"?>
73
- <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",o),u.set("docProps/app.xml",s),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",a),u.set("[Content_Types].xml",d),u}getX1WorksheetsSheet1Xml(e){const t=e.reduce((i,r)=>Math.max(i,r.length),1),o=e.length?`A1:${this.getCellAddress(e.length-1,t-1)}`:"A1",s=[];s.push(`<?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",c),u.set("xl/workbook.xml",a),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"?>
74
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}">
75
- <dimension ref="${o}"/>
68
+ <dimension ref="${s}"/>
76
69
  <sheetViews>
77
70
  <sheetView tabSelected="1" workbookViewId="0"/></sheetViews>
78
71
  <sheetFormatPr baseColWidth="10" defaultRowHeight="16" x14ac:dyDescent="0.2"/>
79
- <sheetData>`);for(let i=0;i<e.length;i++){const r=e[i];s.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")s.push(`<c r="${c}"><v>${l}</v></c>`);else if(l instanceof Date){const a=l;s.push(`<c r="${c}" t="inlineStr"><is><t>${a.toISOString()}</t></is></c>`)}else{const a=l!=null?this.escapeXml(String(l)):"";s.push(`<c r="${c}" t="inlineStr"><is><t>${a}</t></is></c>`)}}s.push("</row>")}return s.push(""),s.push(""),s.push('</sheetData><pageMargins left="0.7" right="0.7" top="0.75" bottom="0.75" header="0.3" footer="0.3"/>'),s.push("</worksheet>"),s.join(`
80
- `)}escapeXml(e){return e==null?"":String(e).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&apos;")}getCellAddress(e,t){const o="ABCDEFGHIJKLMNOPQRSTUVWXYZ";let s="";for(;t>=0;)s=o[t%26]+s,t=Math.floor(t/26)-1;return`${s}${e+1}`}createZip(e){const t=[];return e.forEach((o,s)=>{const i=new TextEncoder().encode(o);t.push({path:new TextEncoder().encode(s),data:i,size:i.length,crc:Ye(i),method:0})}),this.assembleZip(t)}async createZipCompressed(e){const t=[];for(const[o,s]of Array.from(e.entries())){const i=new TextEncoder().encode(s),r=await Xt(i),n=!!r&&r.length<i.length;t.push({path:new TextEncoder().encode(o),data:n?r:i,size:i.length,crc:Ye(i),method:n?8:0})}return this.assembleZip(t)}assembleZip(e){const t=[],o=[];let s=0;for(const a of e){const d=new Uint8Array(30+a.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,a.method,!0),u.setUint16(10,0,!0),u.setUint16(12,33,!0),u.setUint32(14,a.crc,!0),u.setUint32(18,a.data.length,!0),u.setUint32(22,a.size,!0),u.setUint16(26,a.path.length,!0),u.setUint16(28,0,!0),d.set(a.path,30),t.push(d,a.data),o.push(s),s+=d.length+a.data.length}const i=s;e.forEach((a,d)=>{const u=new Uint8Array(46+a.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,a.method,!0),p.setUint16(12,0,!0),p.setUint16(14,33,!0),p.setUint32(16,a.crc,!0),p.setUint32(20,a.data.length,!0),p.setUint32(24,a.size,!0),p.setUint16(28,a.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,o[d],!0),u.set(a.path,46),t.push(u),s+=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,s-i,!0),n.setUint32(16,i,!0),t.push(r);const l=new Uint8Array(t.reduce((a,d)=>a+d.length,0));let c=0;for(const a of t)l.set(a,c),c+=a.length;return l}}class Ge extends pt{constructor(e,t,o,s,i,r=new te,n=new At){var a;if(super(e,t,new st(o),s),this.eventListener=i,this.copyService=r,this.excelService=n,this.licenseManager=N.getInstance(),this.listenerAbortController=new AbortController,this.destroyed=!1,this.selectionService=new bt(this),this.api=new nt(this),this.mouseStartAction="",this.mouseStartWidth=-1,this.mouseStartColumnIndex=-1,this.dragFrom=-1,this.dragTo=-1,this.lastDragFrom=-1,this.lastDragTo=-1,this.firstDraggingRendering=!0,this.lastContextmenu=Date.now(),t.setTableScope(this),i||(this.eventListener=new de),(a=this.tableOptions)!=null&&a.autoRestoreOptions){const d=this.tableOptions.autoRestoreOptions,u=d.getStorageKeyFn;u&&(d.autoRestoreScrollPosition&&(this.storeScrollPosStateService=new lt(u)),d.autoRestoreCollapsedExpandedState&&(this.storeStateCollapsedExpandService=new ct(u)),d.autoRestoreSortingState&&(this.storeSortingService=new dt(u)))}this.mouseHandler=new rt(this),this.inputHandler=new gt(this),this.resizeHandler=new Rt(this,s.resizeEventDebounceDelay),this.shortcutService=new St(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)}static create(e,t,o=new J,s=new de,i=new Ct,r=new te){return new Ge(e,t,i,o,s,r)}onActionTriggered(e){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 t=this.getFocusModel();if(t){const[o,s]=t.getFocus();this.tableModel.getBodyModel().isEditable(o,s)&&(this.clearSelection(),this.initRenderEditor(o,s))}return!0}if(e==="COPY_2_CLIPBOARD"){const t=this.getSelectionModel?this.getSelectionModel():void 0,o=this.getFocusModel?this.getFocusModel():void 0;this.copyService.createContent(this.tableModel,t,o).then(s=>this.copyService.copyContent(s))}return!1}updateModelValueAfterEdit(e,t,o,s){var i,r;e==="body"&&this.tableModel.getAreaModel(e).setValue(t,o,s)&&(this.resetEditorRenderer(),this.repaint(),(r=(i=this.eventListener).onModelChanged)==null||r.call(i,Se.createSingle(t,o)),this.hostElement.focus())}getApi(){return this.api}firstInit(){var e;return this.tableModel.init(),(e=this.tableOptions)!=null&&e.externalFilterFunction&&this.externalFilterChanged(!1),this.autoRestoreCollapsedExpandedState(),this.autoRestoreSortingState(),this.resetSizeOfWrapperDiv(),this.adjustContainersAndRows(),this.autoRestoreScrollPosition(),this}destroy(){if(this.destroyed)return;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.hostElement.innerText=""}isDestroyed(){return this.destroyed}createGeMouseEvent(e){const t=new ye;if(t.originalEvent=e,e){const o=e.target;if([t.areaIdent,t.sideIdent]=this.getAreaAndSideIdentByAttr(o),t.rowIndex=this.getNumberByAttr(o,"data-row-index"),t.columnIndex=this.getNumberByAttr(o,"data-col-index"),t.action=this.getStringByAttr(o,"data-ge-action"),t.areaIdent){const s=this.tableModel.getAreaModel(t.areaIdent);t.rowTop=s.getYPosByRowIndex(t.rowIndex)}if(t.columnLeft=this.tableModel.getXPosByColumnIndex(t.columnIndex),e.ctrlKey&&e.altKey){const s=e.clientY-this.hostElement.offsetTop-this.areaHeaderCenter.parent.clientHeight,i=e.clientX-this.hostElement.offsetLeft-this.areaBodyWestGeo.width;this.debugOnce(i,s)}}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 o,s;(s=(o=this.eventListener).onMouseDragging)==null||s.call(o,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,t.columnIndex,this.firstDraggingRendering),this.firstDraggingRendering=!1),this.repaint())}mouseDraggingEndOnFrame(e){var t,o;(o=(t=this.eventListener).onMouseDraggingEnd)==null||o.call(t,e),this.draggingTargetColumnIndex=-1,this.mouseStartAction==="resize-column"?this.resizeColumn(e):this.mouseStartAction==="drag-column"&&(this.hideDraggingColumn(),this.repaint()),this.mouseStartWidth=-1,this.mouseStartColumnIndex=-1,this.dragFrom=-1,this.dragTo=-1,this.firstDraggingRendering=!0,this.mouseStartAction=""}mouseMove(e){var t,o;(o=(t=this.eventListener).onMouseMoved)==null||o.call(t,e),this.adjustHoverRows(e),this.adjustHoverColumns(e)}contextmenu(e){var o,s,i,r;const t=Date.now();if(t-this.lastContextmenu<50){this.lastContextmenu=t,(o=e.originalEvent)==null||o.preventDefault(),(s=e.originalEvent)==null||s.stopImmediatePropagation();return}this.lastContextmenu=t,(r=(i=this.eventListener).onContextmenu)==null||r.call(i,e)}toggleExpandCollapseAll(e=!0){var o;const t=this.tableModel.getBodyModel();ce(t)&&(t.toggleExpandCollapseAll(e),this.repaint(),(o=this.storeStateCollapsedExpandService)==null||o.collapsedStateAll(e))}toggleRowCheckbox(e,t,o){var l,c,a;const s=this.tableModel.getAreaModel(o),i=s.isRowChecked(e),r=i===void 0||i==="semi"||i==="none";s.setRowChecked(e,r),this.repaint();const n=(l=s.rowSelectionModel)==null?void 0:l.getCheckedRows();(a=(c=this.eventListener).onCheckboxChanged)==null||a.call(c,n||[])}onMouseClicked(e,t){let o=this.selectionService.onMouseClicked(e,t);if(!o&&this.getFocusModel){this.resetEditorRenderer();const s=this.getFocusModel();s&&(o=s.hasChanged(),s.clearChanged())}return o}debounceRepaint(){this.debounce(this.repaint.bind(this),1)}publishGeMouseEvent(e){var t,o;(o=(t=this.eventListener).onMouseClicked)==null||o.call(t,e)}onFocusChanged(e){var t,o;(o=(t=this.eventListener).onFocusChanged)==null||o.call(t,e)}onSelectionChanged(e){var t,o;(o=(t=this.eventListener).onSelectionChanged)==null||o.call(t,e)}externalFilterChanged(e=!0){const t=this.tableOptions.externalFilterFunction;t&&(e&&this.clearSelectionModel(),this.tableModel.externalFilterChanged(t),this.reapplySorting(),this.scrollViewport.scrollTo(0,0),this.tableModel.recalcHeightAndPadding(),this.resetSizeOfWrapperDiv(),this.repaint())}onHeaderDblClicked(e,t,o){const s=this.tableModel.getColumnDef(o);s!=null&&s.sortable&&s.sortable()&&(e.preventDefault(),e.stopPropagation(),this.sortByColumn(o))}sortByColumn(e,t){var a,d;const o=typeof e=="number"?e:(this.tableModel.getColumnDefs()??[]).findIndex(u=>u.property===e),s=this.tableModel.getColumnDef(o);if(!s)return!1;const i=s.sortStatesOrder?s.sortStatesOrder:this.tableOptions.sortOrder,r=s.sortState??"",n=t??i[(i.indexOf(r)+1)%i.length],l=new Ae(o,n);return this.tableModel.doSort([l])&&(this.lastSortCompareFn=void 0,(a=this.tableModel.getColumnDefs())==null||a.forEach(u=>u.sortState=""),s.sortState=n),this.repaint(),(d=this.storeSortingService)==null||d.setSortItems([l]),!0}scrollToPixel(e,t){if(this.isScrollHeightCapped()){const o=this.getContentScrollRangeY(),s=this.getScrollerRangeY();if(o>0&&s>0){const i=Math.min(o,Math.max(0,t)),r=i/o*s;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 s=this.tableModel.getAreaModel("body").getYPosByRowIndex(t);this.scrollToPixel(0,s)}adjustAfterScrolling(){var t,o;super.adjustAfterScrolling();const e=this.scrollViewport;(o=(t=this.eventListener).onScroll)==null||o.call(t,new mt(this.scrollTop,this.scrollLeft,e.scrollHeight,e.scrollWidth,e.clientHeight,e.clientWidth,this.scrollFactorY,this.scrollFactorX))}setSelectionModel(e,t=!1){const o=()=>e;this.tableOptions.getSelectionModel=o,this.getSelectionModel=o,this.selectionService.getSelectionModel=o,t&&this.repaint()}toggleHeaderGroup(e){const t=this.tableModel.getAreaModel("header");"columnDefs"in this.tableModel&&(this.tableModel.columnDefs=t.toggleHeaderGroup(e)),this.firstInit()}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 o=this.getFocusModel();if(o){const[s,i]=o.getFocus();return o.setFocus(s+t,i+e),this.repaint(),!0}}return!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())}debugOnce(e,t){var o;console.clear(),console.info("this.hostElement.offsetTop",this.hostElement.offsetTop),console.info("this.hostElement.scrollHeight",this.hostElement.scrollHeight),console.info("this.scrollViewportTop",this.scrollTop),console.info("this.areaHeaderCenter.parent.clientHeight",this.areaHeaderCenter.parent.clientHeight),console.info("bodyY",t),console.info("bodyX",e),console.info("rows",this.firstVisibleRowIndex),console.info(""),console.info("this.tableModel",this.tableModel),console.info(""),console.info("this.mouseMoveEvent.clientX",(o=this.mouseHandler.mouseEvent)==null?void 0:o.clientX),console.info("this.hostElement.offsetLeft",this.hostElement.offsetLeft),console.info("this.areaBodyWestGeo.width",this.areaBodyWestGeo.width)}autoRestoreScrollPosition(){var e;if((e=this.tableOptions)!=null&&e.autoRestoreOptions&&this.storeScrollPosStateService&&this.tableOptions.autoRestoreOptions.autoRestoreScrollPosition){const o=this.storeScrollPosStateService.getScrollOffset();o&&this.scrollViewport.scrollTo(...o)}}autoRestoreSortingState(){var e,t;if((t=(e=this.tableOptions)==null?void 0:e.autoRestoreOptions)!=null&&t.autoRestoreSortingState&&this.storeSortingService){const o=this.storeSortingService.getSortItems();if(o!=null&&o.length){this.tableModel.getBodyModel().doSort(o);const i=this.tableModel.getColumnDefs();i&&(i.forEach(r=>r.sortState=""),o.forEach(r=>{const n=i[r.columnIndex];n&&(n.sortState=r.sortState)}))}}}autoRestoreCollapsedExpandedState(){var i;const e=this.storeStateCollapsedExpandService,t=(i=this.tableOptions)==null?void 0:i.autoRestoreOptions,o=t==null?void 0:t.getRowId;if(!e||!o||!(t!=null&&t.autoRestoreCollapsedExpandedState)||!e.hasStoredState())return;const s=this.tableModel.getAreaModel("body");if(ce(s)){const r=s,n=e.collapsedExpandedStateGet(),l=c=>c==null?void 0:c.forEach(a=>{if(n.allExpanded)a.expanded=!0;else if(n.allCollapsed)a.expanded=!1;else{const d=e.collapsedExpandedStateIncludes(o(a.data));a.expanded=n.mode==="expanded"?d:!d}l(a.children)});l(r.rows),r.recalcVisibleTreeRows()}}calcAutoColumnWidths(){const e=this.tableModel.getBodyModel(),t=this.tableModel.getColumnCount();if(!e)return console.warn("Body model is not available."),[];const o=30,s=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 y=0;y<f;y++)for(let w=0;w<t;w++){const v=((m=p.getTextValueAt)==null?void 0:m.call(p,y,w))||(((g=p.getValueAt(y,w))==null?void 0:g.toString())??""),T=v.length;T>i[w]&&(i[w]=T,s[w].forEach(x=>{x.length<T-2&&s[w].delete(x)})),T>=i[w]-2&&s[w].size<o&&s[w].add(v)}};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 a=null;try{a=document.createElement("canvas").getContext("2d")}catch{a=null}a&&(a.font=l.font||`${l.fontSize} ${l.fontFamily}`);const d=u=>a?a.measureText(u).width:u.length*8;return s.map(u=>{let p=0;return u.forEach(f=>{p=Math.max(p,d(f))}),Math.max(Math.ceil(p+c+2),50)})}setColumnWidth(e,t){this.tableModel.setColumnWidth(e,t)}autoResizeColumns(e=!0){const t=this.calcAutoColumnWidths();for(let o=0;o<t.length;o++){const s=t[o];this.tableModel.setColumnWidth(o,s)}e&&this.recalcWrappers()}recalcWrappers(){this.tableModel.recalcPadding(),this.resetSizeOfWrapperDiv(),this.adjustContainersAndRows()}reSort(){var t;let e=((t=this.storeSortingService)==null?void 0:t.getSortItems())??[];this.tableModel.doSort(e),this.repaint()}sort(e){var t;this.tableModel.sort(e),this.lastSortCompareFn=e,(t=this.tableModel.getColumnDefs())==null||t.forEach(o=>o.sortState=""),this.repaint()}reapplySorting(){var t;if(this.lastSortCompareFn){this.tableModel.sort(this.lastSortCompareFn);return}const e=[];(t=this.tableModel.getColumnDefs())==null||t.forEach((o,s)=>{o.sortState&&e.push(new Ae(s,o.sortState))}),e.length&&this.tableModel.doSort(e)}ensureRowIsVisible(e){const t=this.getFirstFullVisibleRowIndex(),o=this.getLastFullVisibleRowIndex(),s=this.getDisplayedRowCount();return e<t?(this.scrollToIndex(0,e),!0):e>o?(this.scrollToIndex(0,e-s+1),!0):!1}}class Jt extends de{constructor(e){super(),this.onCheckboxChangedCallback=e,super.onCheckboxChanged=t=>{this.onCheckboxChangedCallback(t)}}}const ge=class ge{};ge.themes=["light","combat","paper","blackboard"],ge.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 a=l;o.push(`<c r="${c}" t="inlineStr"><is><t>${a.toISOString()}</t></is></c>`)}else{const a=l!=null?this.escapeXml(String(l)):"";o.push(`<c r="${c}" t="inlineStr"><is><t>${a}</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,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&apos;")}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:mt(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 ys(i),n=!!r&&r.length<i.length;t.push({path:new TextEncoder().encode(s),data:n?r:i,size:i.length,crc:mt(i),method:n?8:0})}return this.assembleZip(t)}assembleZip(e){const t=[],s=[];let o=0;for(const a of e){const d=new Uint8Array(30+a.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,a.method,!0),u.setUint16(10,0,!0),u.setUint16(12,33,!0),u.setUint32(14,a.crc,!0),u.setUint32(18,a.data.length,!0),u.setUint32(22,a.size,!0),u.setUint16(26,a.path.length,!0),u.setUint16(28,0,!0),d.set(a.path,30),t.push(d,a.data),s.push(o),o+=d.length+a.data.length}const i=o;e.forEach((a,d)=>{const u=new Uint8Array(46+a.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,a.method,!0),p.setUint16(12,0,!0),p.setUint16(14,33,!0),p.setUint32(16,a.crc,!0),p.setUint32(20,a.data.length,!0),p.setUint32(24,a.size,!0),p.setUint16(28,a.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(a.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((a,d)=>a+d.length,0));let c=0;for(const a of t)l.set(a,c),c+=a.length;return l}}const Pe=class Pe{constructor(e,t,s){this.document=e,this.id=t,this.domService=s}announce(e,t=Pe.defaultDelayInMs){const s=this.getOrCreateElement();s&&(this.timeout&&clearTimeout(this.timeout),s.textContent="",this.timeout=setTimeout(()=>{this.timeout=void 0,s.textContent=e},Math.max(0,t)))}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}};Pe.defaultDelayInMs=150;let Ee=Pe;const de=class de extends Ht{constructor(e,t,s,o,i,r=new Z,n=new Kt){var d,u;if(super(e,t,new Re(s),o),this.eventListener=i,this.copyService=r,this.excelService=n,this.licenseManager=K.getInstance(),this.listenerAbortController=new AbortController,this.destroyed=!1,this.selectionService=new ge(this),this.api=new It(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 Ee(e.ownerDocument,this.ariaIds.liveRegion(),s),i||(this.eventListener=new Me),(d=this.tableOptions)!=null&&d.autoRestoreOptions){const p=this.tableOptions.autoRestoreOptions,g=p.getStorageKeyFn;g&&(p.autoRestoreScrollPosition&&(this.storeScrollPosStateService=new kt(g)),p.autoRestoreCollapsedExpandedState&&(this.storeStateCollapsedExpandService=new Dt(g)),p.autoRestoreSortingState&&(this.storeSortingService=new Pt(g)))}this.mouseHandler=new Tt(this),this.inputHandler=new Ot(this),this.resizeHandler=new Ut(this,o.resizeEventDebounceDelay),this.shortcutService=new zt(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 a=this.listenerAbortController.signal;(u=e.ownerDocument)==null||u.addEventListener("keydown",p=>{p.key==="Tab"&&(this.lastTabKeyTime=Date.now())},{capture:!0,signal:a}),e.addEventListener("focus",()=>this.onHostKeyboardFocus(),{signal:a}),this.scrollViewport.addEventListener("focus",()=>this.hostElement.focus({preventScroll:!0}),{signal:a})}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 se,o=new Me,i=new jt,r=new Z){return new de(e,t,i,s,o,r)}onActionTriggered(e){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)}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,g;return((g=(p=this.tableModel.getColumnDef(u))==null?void 0:p.isVisible)==null?void 0:g.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))),c=Math.max(0,Math.min(...r.map(u=>u.c1))),a=Math.min(s-1,Math.max(...r.map(u=>u.c2)));if((l-n+1)*(a-c+1)>Z.maxCopyCells)return 0;let d=0;for(let u=n;u<=l;u++)for(let p=c;p<=a;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,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===0||nt(s.getCellRenderer(e,t))))return this.toggleRowCheckbox(e,t,"body"),!0;const i=s.getRowByIndex(e);if($(i)&&z(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 ve(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;e==="body"&&this.tableModel.getAreaModel(e).setValue(t,s,o)&&(this.resetEditorRenderer(),this.repaint(),(r=(i=this.eventListener).onModelChanged)==null||r.call(i,$e.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.tableModel.init(),(t=this.tableOptions)!=null&&t.externalFilterFunction&&this.externalFilterChanged(!1),this.autoRestoreCollapsedExpandedState(),this.autoRestoreSortingState(),this.resetSizeOfWrapperDiv(),this.adjustContainersAndRows(),this.autoRestoreScrollPosition(),this.liveAnnouncer.getElement(),this.initialized=!0,this}destroy(){if(this.destroyed)return;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.liveAnnouncer.destroy(),this.removeHostAria(),this.hostElement.innerText=""}isDestroyed(){return this.destroyed}createGeMouseEvent(e){const t=new Oe;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.mouseStartAction==="drag-column"&&(this.hideDraggingColumn(),this.repaint()),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){var s;const t=this.tableModel.getBodyModel();z(t)&&(t.toggleExpandCollapseAll(e),this.allExpanded=e,this.repaintHard(),(s=this.storeStateCollapsedExpandService)==null||s.collapsedStateAll(e))}setTreeRowExpanded(e,t){const s=this.tableModel.getBodyModel();return!z(s)||e.expanded===t?!1:(e.expanded=t,s.recalcVisibleTreeRows(!1),this.repaintHard(),this.storeTreeRowState(e),!0)}storeTreeRowState(e){var o,i;const t=(i=(o=this.tableOptions)==null?void 0:o.autoRestoreOptions)==null?void 0:i.getRowId,s=this.storeStateCollapsedExpandService;if(t&&s){s.initModeIfEmpty(e.expanded?"expanded":"collapsed");const r=s.collapsedExpandedStateGet().mode,n=r==="collapsed"&&!e.expanded||r==="expanded"&&e.expanded,l=r==="collapsed"&&e.expanded||r==="expanded"&&!e.expanded,c=t(e.data);n?s.collapsedStateIdsPush(c):l&&s.collapsedStateIdsRemove(c)}}toggleRowCheckbox(e,t,s){var l,c,a;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();(a=(c=this.eventListener).onCheckboxChanged)==null||a.call(c,n?n.slice():[])}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)}onSelectionChanged(e){var t,s;if(this.selectionEventsHeld>0){this.heldSelectionModel=e;return}(s=(t=this.eventListener).onSelectionChanged)==null||s.call(t,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),de.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 a,d;const s=typeof e=="number"?e:(this.tableModel.getColumnDefs()??[]).findIndex(u=>u.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 Ye(s,n),c=this.tableModel.doSort([l]);return c&&(this.lastSortCompareFn=void 0,(a=this.tableModel.getColumnDefs())==null||a.forEach(u=>u.sortState=""),o.sortState=n),this.repaint(),(d=this.storeSortingService)==null||d.setSortItems([l]),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 $t(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.firstInit()}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())}autoRestoreScrollPosition(){var e;if((e=this.tableOptions)!=null&&e.autoRestoreOptions&&this.storeScrollPosStateService&&this.tableOptions.autoRestoreOptions.autoRestoreScrollPosition){const s=this.storeScrollPosStateService.getScrollOffset();s&&this.scrollViewport.scrollTo(...s)}}autoRestoreSortingState(){var e,t;if((t=(e=this.tableOptions)==null?void 0:e.autoRestoreOptions)!=null&&t.autoRestoreSortingState&&this.storeSortingService){const s=this.storeSortingService.getSortItems();if(s!=null&&s.length){this.tableModel.getBodyModel().doSort(s);const i=this.tableModel.getColumnDefs();i&&(i.forEach(r=>r.sortState=""),s.forEach(r=>{const n=i[r.columnIndex];n&&(n.sortState=r.sortState)}))}}}autoRestoreCollapsedExpandedState(){var i;const e=this.storeStateCollapsedExpandService,t=(i=this.tableOptions)==null?void 0:i.autoRestoreOptions,s=t==null?void 0:t.getRowId;if(!e||!s||!(t!=null&&t.autoRestoreCollapsedExpandedState)||!e.hasStoredState())return;const o=this.tableModel.getAreaModel("body");if(z(o)){const r=o,n=e.collapsedExpandedStateGet(),l=c=>c==null?void 0:c.forEach(a=>{if(n.allExpanded)a.expanded=!0;else if(n.allCollapsed)a.expanded=!1;else{const d=e.collapsedExpandedStateIncludes(s(a.data));a.expanded=n.mode==="expanded"?d:!d}l(a.children)});l(r.rows),r.recalcVisibleTreeRows(!1)}}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 w,f;const p=this.tableModel.getAreaModel(u),g=(p==null?void 0:p.getRowCount())??0;for(let C=0;C<g;C++)for(let b=0;b<t;b++){const x=((w=p.getTextValueAt)==null?void 0:w.call(p,C,b))||(((f=p.getValueAt(C,b))==null?void 0:f.toString())??""),I=x.length;I>i[b]&&(i[b]=I,o[b].forEach(y=>{y.length<I-2&&o[b].delete(y)})),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),c=n?(parseFloat(l.paddingLeft)||0)+(parseFloat(l.paddingRight)||0):20;let a=null;try{a=document.createElement("canvas").getContext("2d")}catch{a=null}a&&(a.font=l.font||`${l.fontSize} ${l.fontFamily}`);const d=u=>a?a.measureText(u).width:u.length*8;return o.map(u=>{let p=0;return u.forEach(g=>{p=Math.max(p,d(g))}),Math.max(Math.ceil(p+c+2),50)})}setColumnWidth(e,t){this.tableModel.setColumnWidth(e,t)}setColumnVisible(e,t){var s,o;return(o=(s=this.tableModel).setColumnVisible)!=null&&o.call(s,e,t)?(this.recalcWrappers(),!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()}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()}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 Ye(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 p=t;p<e;p++)c+=this.tableModel.getColumnWidth(p);const a=Math.min(1,Math.max(0,i.scrollLeft/l))*n;let d;if(c<a-.5)d=c;else if(c+o>a+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}};de.filterAnnouncementDelayInMs=400;let Ue=de;class ws extends Me{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"] {
81
74
  --ge-table-bg: rgba(255,255,255, 0.5);
82
75
  --ge-table-header-west-bg: rgba(233, 233, 233, 0.5);
83
76
  --ge-table-header-center-bg: rgba(233, 233, 233, 0.5);
@@ -305,133 +298,131 @@ render scope: this.lastFullVisibleRowIndex <- `+this.lastFullVisibleRowIndex),th
305
298
  --ge-table-column-resize-handle-border: oklch(0% 0 0);
306
299
  --ge-table-dragged-col-div-bg: #2c2e33;
307
300
  --ge-table-drop-zone-bg: #758129;
308
- }`};let Te=ge;class ne{constructor(e,t=!0,o,s,i=0,r=!1,n=!1){this.data=e,this.expanded=t,this.children=o,this.parent=s,this.deep=i,this.checked=r,this.keep=n,this.type="TreeRow"}}class j{static buildTreeRows(e,t="children",o=12,s=!0){const i=typeof t=="string"?{childrenProperty:t,deepMaxLimit:o,expanded:s}:t,r=i.childrenProperty??"children",n=i.deepMaxLimit??12,l=j.toExpandedFn(i.expanded??!0),c=[];for(const a of e){const d=new ne(a,l(a,0),[],void 0,0);c.push(j.buildTreeRow(a,r,d,0,n,l))}return c}static buildTreeRow(e,t="children",o=new ne(e,!0,[],void 0,0),s=0,i=12,r=!0){var c;if(s>i)return console.warn("Max deep limit reached: ",s),o;const n=j.toExpandedFn(r),l=e[t];if(l)for(const a of l){const d=new ne(a,n(a,s+1),[],o,s+1);(c=o.children)==null||c.push(d),j.buildTreeRow(a,t,d,s+1,i,n)}return o}static toExpandedFn(e){return typeof e=="function"?e:()=>e}}class Y{constructor(e=34,t=34,o=34){this.header=e,this.body=t,this.footer=o}}class b{constructor(e=100,t="px"){this.value=e,this.unit=t}}const Mt=()=>!0,Tt=()=>!1;class W{constructor(e,t,o=new b(100,"px"),s=new k,i=new k,r=new b(100,"px"),n=new b(100,"px"),l,c,a,d,u,p,f,m,g=()=>this.visible){this.property=e,this.headerLabel=t,this.width=o,this.classes=s,this.rendererMap=i,this.minWidth=r,this.maxWidth=n,this.sortable=l,this.sortComparator=c,this.sortState=a,this.sortStatesOrder=d,this.sortIconVisible=u,this.editable=p,this.getEditRenderer=f,this.editInputPipe=m,this.isVisible=g,this.visible=!0,o.unit!=="px"&&(this.minWidth=new b(0,"px"),this.maxWidth=new b(1e5,"px"))}static bodyRenderer(e){return new k(void 0,e,void 0)}static create(e){const t=new k(e.headerRenderer,e.bodyRenderer,e.footerRenderer),o=new k(e.headerClasses,e.bodyClasses,e.footerClasses),s=e.sortIconVisible??e.sortable,i=e.editable??e.editable??Tt,r=e.isVisible??e.isVisible??Mt;return new W(e.property??"",e.headerLabel??"",e.width??new b(100,"px"),o,t,e.minWidth??new b(100,"px"),e.maxWidth??new b(100,"px"),e.sortable,e.sortComparator,e.sortState,e.sortStatesOrder,s,i,e.getEditRenderer,e.editInputPipe,r)}}const qt=new b(500,"px"),Zt=new b(400,"px"),Et=new b(300,"px"),Qt=new b(290,"px"),eo=new b(280,"px"),to=new b(270,"px"),oo=new b(260,"px"),so=new b(250,"px"),io=new b(240,"px"),ro=new b(230,"px"),no=new b(220,"px"),lo=new b(210,"px"),Ee=new b(200,"px"),ao=new b(190,"px"),co=new b(180,"px"),ho=new b(170,"px"),uo=new b(160,"px"),po=new b(150,"px"),go=new b(140,"px"),fo=new b(130,"px"),mo=new b(120,"px"),bo=new b(110,"px"),yo=new b(100,"px"),wo=new b(90,"px"),xo=new b(80,"px"),So=new b(70,"px"),Co=new b(60,"px"),vo=new b(50,"px"),Ro=new b(40,"px"),Ao=new b(30,"px"),Mo=new b(20,"px"),To=new b(10,"px"),Eo=new b(0,"px");class D extends we{constructor(e,t,o,s=[]){super(e,s,o),this.areaIdent=e,this.arr=t,this.defaultRowHeight=o,this.columnDefs=s,this.filteredArr=[...t]}externalFilterChanged(e){this.filteredArr=this.arr?this.arr.filter(e):[]}getRowCount(){return this.filteredArr?this.filteredArr.length:0}getValueAt(e,t){return this.filteredArr[e][t]}setValue(e,t,o){var i;const s=(i=this.columnDefs[t])==null?void 0:i.editInputPipe;return s&&(o=s(o,e,t)),this.arr[e][t]=o,!0}getRowByIndex(e){return this.filteredArr[e]}getRowHeight(e){return this.defaultRowHeight}getConstantRowHeight(){return this.getRowHeight===D.prototype.getRowHeight&&this.defaultRowHeight>0?this.defaultRowHeight:void 0}changeColumnOrder(e,t){this.filteredArr.forEach(o=>this.arrayMove(o,e,t)),super.changeColumnOrder(e,t)}}class P{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,o){return!1}isSelectable(e,t){return!1}changeColumnOrder(e,t){}}class It{flattenTree(e,t=[]){var o;for(const s of e)this.isVisible(s)&&t.push(s),(o=s.children)!=null&&o.length&&this.flattenTree(s.children,t);return t}isVisible(e){return e.parent?e.parent.expanded?this.isVisible(e.parent):!1:!0}}class oe extends we{constructor(e,t,o,s=[]){super(e,s,o),this.areaIdent=e,this.rows=t,this.defaultRowHeight=o,this.columnDefs=s,this.type="AreaModelTree",this.sorterService=new We,this.service=new It,this.properties=s.map(i=>i.property),this.flattenRows=this.service.flattenTree(t),this.filteredFlattenRows=[...this.flattenRows]}changeColumnOrder(e,t){this.arrayMove(this.properties,e,t),super.changeColumnOrder(e,t)}recalcVisibleTreeRows(){this.filteredFlattenRows=this.service.flattenTree(this.rows)}getFilteredFlattenRows(){return this.filteredFlattenRows}getRowCount(){let e=0;for(const t of this.filteredFlattenRows)this.service.isVisible(t)&&e++;return e}getValueAt(e,t){const o=this.getRowByIndex(e);if(o){const s=this.properties[t];if(s)return s.includes(".")?this.getPropertyValue(o.data,s.split(".")):o.data[s]}return""}getRowHeight(e){return this.defaultRowHeight}getConstantRowHeight(){return this.getRowHeight===oe.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.doFiltering()}doSort(e){const{columnIndex:t,sortState:o}=e[e.length-1],s=o==="asc"?1:o==="desc"?-1:0,i=this.properties[t];return this.treeSort(this.rows,i,s),this.flattenRows=this.service.flattenTree(this.rows),this.filteredFlattenRows=[...this.flattenRows],!0}toggleExpandCollapseAll(e){this.expandAllRecursive(this.rows,e),this.flattenRows=this.service.flattenTree(this.rows),this.doFiltering()}setAllParentsOk(e){return e.parent&&(e.parent.keep=!0,this.setAllParentsOk(e.parent)),!1}setValue(e,t,o){var r;const s=(r=this.columnDefs[t])==null?void 0:r.editInputPipe;s&&(o=s(o,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("."),o):(n[l]=o,!0)}return!1}genericTreeTableSortComparator(e,t){const o=this.columnDefs.find(s=>s.property===e);return(s,i)=>{const r=this.getValueByT(s.data,e),n=this.getValueByT(i.data,e);return o!=null&&o.sortComparator?t*o.sortComparator(r,n,s.data,i.data,t):this.sorterService.genericSortComparator(r,n,t)}}expandAllRecursive(e,t){for(const o of e)o.expanded=t,o.children&&this.expandAllRecursive(o.children,t)}doFiltering(){if(!this.lastPredictFn)this.filteredFlattenRows=[...this.flattenRows?this.flattenRows:[]];else{this.flattenRows||(this.flattenRows=[]);let e=0;this.flattenRows.forEach(o=>{e=Math.max(e,o.deep)});const t=this.flattenRows.filter((o,s,i)=>this.lastPredictFn(o,s,i));this.flattenRows.forEach(o=>o.keep=!1),this.flattenRows.forEach(o=>{t.includes(o)&&(o.keep=!0,this.setAllParentsOk(o))}),this.filteredFlattenRows=this.flattenRows.filter((o,s,i)=>o.keep)}}getPropertyValue(e,t){const o=t.shift();let s=e[o];return s&&t.length?this.getPropertyValue(s,t):s}treeSort(e,t,o){e.sort(this.genericTreeTableSortComparator(t,o));for(const s of e)s.children&&this.treeSort(s.children,t,o)}}class Ie{constructor(e=[]){this.allRootNodes=e}checkRow(e,t){if(e.checked=t,e.children)for(const o of e.children)this.checkRow(o,t);this.autoCheckParent(e.parent)}checkAll(e){for(const t of this.allRootNodes)t.checked=!1,t.children&&this.checkAll(t.children)}getCheckedRows(){const e=[];return this.addSelectedRecursive(this.allRootNodes,e),e}isRowChecked(e){if(e.checked)return"full";const t=this.areAllChildrenChecked(e),o=this.areAllChildrenUnchecked(e);return!t&&!o?"semi":"none"}setCheckedRows(e){this.addCheckedRows(e)}addCheckedRows(e){for(const t of e)t.checked=!0}autoCheckParent(e){if(e){const t=this.areAllChildrenChecked(e),o=this.areAllChildrenUnchecked(e);t?e.checked=!0:e.checked=!1,this.autoCheckParent(e.parent)}}areAllChildrenChecked(e){var t,o;if((t=e.children)!=null&&t.length){for(const s of e.children)if(!s.checked||(o=s.children)!=null&&o.length&&!this.areAllChildrenChecked(s))return!1}return!0}areAllChildrenUnchecked(e){var t,o;if((t=e.children)!=null&&t.length){for(const s of e.children)if(s.checked||(o=s.children)!=null&&o.length&&!this.areAllChildrenUnchecked(s))return!1}return!0}addSelectedRecursive(e,t){for(const o of e)o.checked&&t.push(o),o.children&&this.addSelectedRecursive(o.children,t)}}class he{constructor(e=0,t=0,o=0,s=0){this.top=e,this.right=t,this.bottom=o,this.left=s}}class kt{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 le{constructor(e,t,o,s=0,i=0,r=!1,n=new Y,l=[],c=[],a=-1,d=0,u=400,p=()=>{}){var f,m,g,y;this.headerAreaModel=e,this.bodyAreaModel=t,this.footerAreaModel=o,this.fixedLeftColumnCount=s,this.fixedRightColumnCount=i,this.rowCheckboxVisible=r,this.defaultRowHeights=n,this.columnDefs=l,this.columnSizes=c,this.overridingColumnWidth=a,this.columnCount=d,this.parentSize=u,this.getSelectionModel=p,this.rowCount=0,this.contentHeightInPx=0,this.contentWidthInPx=0,this.padding=new he(0,0,0,0),this.xPositions=[],e.areaIdent="header",t.areaIdent="body",o.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)),(y=this.columnDefs)!=null&&y.length&&ot(this.columnDefs[0])&&!t.rowSelectionModel&&(t.rowSelectionModel=new kt)}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 o;t=Math.max(0,t),this.overridingColumnWidth!==-1&&(this.overridingColumnWidth=t),e>-1&&e<((o=this.columnSizes)==null?void 0:o.length)&&(this.columnSizes[e]=t),this.recalcContentWidthInPx()}getColumnWidth(e){var o;const t=this.getColumnDef(e);return t&&t.isVisible&&!t.isVisible()?0:this.overridingColumnWidth!==-1?this.overridingColumnWidth:e>-1&&e<((o=this.columnSizes)==null?void 0:o.length)?this.columnSizes[e]:0}getXPosByColumnIndex(e){return e===0?0:this.overridingColumnWidth>-1?this.overridingColumnWidth*e:this.xPositions[e]}recalcSize(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"),o=this.getAreaHeight("header"),s=this.getAreaHeight("footer");this.padding=new he(o,t,s,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),o=t.getRowCount();if(this.defaultRowHeights[e])return o*this.defaultRowHeights[e];let s=0;for(let i=0;i<o;i++)s=s+t.getRowHeight(i);return s}getSideAreaWidth(e){const[t,o]=this.getSideStartAndEndColumnIndex(e);let s=0;for(let i=t;i<=o;i++)s=s+this.getColumnWidth(i);return s}getSideStartAndEndColumnIndex(e){const t=this.getFixedLeftColumnCount(),o=this.getFixedRightColumnCount();let s=0,i=this.columnCount-1;return e==="west"?i=t-1:e==="east"?s=this.columnCount-o:(s=t,i=this.columnCount-o-1),[s,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(((e=this.footerAreaModel)==null?void 0:e.getRowCount())??0)>0}isHeaderVisibe(){var e;return(((e=this.headerAreaModel)==null?void 0:e.getRowCount())??0)>0}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 o=(t=this.columnDefs[e])==null?void 0:t.sortable;if(typeof o=="function")return o()}return!1}changeColumnOrder(e,t){var o,s,i;this.arrayMove(this.columnDefs,e,t),this.arrayMove(this.columnSizes,e,t),(o=this.headerAreaModel)==null||o.changeColumnOrder(e,t),(s=this.bodyAreaModel)==null||s.changeColumnOrder(e,t),(i=this.footerAreaModel)==null||i.changeColumnOrder(e,t),this.calcXPositions()}recalcColumnWidths(e){var t,o,s;if(!((t=this.columnDefs)!=null&&t.length)&&!((o=this.columnSizes)!=null&&o.length)&&(this.columnSizes=new Array(this.getColumnCount()).fill(this.overridingColumnWidth)),(s=this.columnDefs)!=null&&s.length){const i=this.columnDefs.filter(l=>{var c;return((c=l.width)==null?void 0:c.unit)==="weight"});this.columnSizes=this.columnDefs.map(l=>{if(l.width.unit==="%"&&e){let c=Math.floor(l.width.value*e/100);if(l.minWidth){const a=this.sizeToPixel(l.minWidth,e);c=Math.max(a,c)}if(l.maxWidth){const a=this.sizeToPixel(l.maxWidth,e);c=Math.min(a,c)}return c}else if(l.width.unit==="px"&&e)return l.width.value;return 0});const r=this.columnSizes.reduce((l,c)=>l+c),n=e-r;if(n>0&&i.length){const l=i.map(c=>c.width.value).reduce((c,a)=>c+a);for(let c=0;c<this.columnDefs.length;c++){const a=this.columnDefs[c];a.width.unit==="weight"&&(this.columnSizes[c]=a.width.value*n/l)}}}}sizeToPixel(e,t){return e.unit==="px"?e.value:e.unit==="%"?Math.floor(e.value*t/100):-1}arrayMove(e,t,o){const s=e.splice(t,1)[0];return e.splice(o,0,s),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 ke extends F{constructor(e,t,o,s,i="ge-selected-row",r="ge-focused-row"){super(e,t,s,o,i,r),this.areaIdent=e,this.rows=t,this.columnDefs=o,this.defaultRowHeight=s}}class B{static createTableModel(e){var t,o,s,i,r,n,l,c,a,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 Y,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&&((o=e.properties)!=null&&o.length?e.columnDefs=e.properties.map(g=>new W(g,g.toUpperCase(),Ee)):(s=e.rows)!=null&&s.length?e.columnDefs=Object.keys(e.rows[0]).map(g=>new W(g,g.toUpperCase(),Ee)):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||((c=e.headerData)!=null&&c.length?e.headerAreaModel=new D("header",e.headerData,e.defaultRowHeights.header,e.columnDefs):(a=e.columnDefs)!=null&&a.length?e.headerAreaModel=new D("header",[e.columnDefs.map(g=>g.headerLabel)],e.defaultRowHeights.header,e.columnDefs):e.headerAreaModel=new P("header")),e.footerAreaModel||((d=e.footerData)!=null&&d.length?e.footerAreaModel=new D("footer",e.footerData,e.defaultRowHeights.footer,e.columnDefs):e.footerAreaModel=new P("footer")),!e.bodyAreaModel)if(e.rows)if((u=e.rows)!=null&&u.length&&G(e.rows[0])){const g=e.rows;e.bodyAreaModel=new oe("body",g,e.defaultRowHeights.body,e.columnDefs),(e.columnDefs[0].property==="CheckboxColumn"||(p=e.tableOptions)!=null&&p.showCheckboxWihoutExtraColumn)&&(e.bodyAreaModel.rowSelectionModel=new Ie(g))}else e.bodyAreaModel=new ke("body",e.rows,e.columnDefs,e.defaultRowHeights.body);else e.bodyData?e.bodyAreaModel=new D("body",e.bodyData,e.defaultRowHeights.body):e.bodyAreaModel=new P("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 le(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 B.buildByTypedRows(e.rows??[],e.columnDefs,e.tableOptions??new J,e.fixedLeftColumnCount??0,e.fixedRightColumnCount??0)}static buildByTypedRows(e,t,o=new J,s=0,i=0){const r=o.defaultRowHeights,n=t[0].property==="CheckboxColumn";if(e!=null&&e.length&&G(e[0])){const c=e,a=new oe("body",c,r.body,t);return(n||o.showCheckboxWihoutExtraColumn)&&(a.rowSelectionModel=new Ie(c)),B.createByAreaModelsParam({headerAreaModel:new D("header",[t.map(d=>d.headerLabel)],r.header),bodyAreaModel:a,footerAreaModel:new D("footer",[],r.footer),columnDefs:t,fixedLeftColumnCount:s,fixedRightColumnCount:i,defaultRowHeights:o.defaultRowHeights,rowCheckboxVisible:!1,columnSizes:[],columnCount:t.length,overridingColumnWidth:-1})}return B.createByObjectArrayParam({rows:e,columnDefs:t,fixedLeftColumnCount:s,fixedRightColumnCount:i,defaultRowHeights:o.defaultRowHeights})}static createByObjectArrayParam(e){const t=e.rowCheckboxVisible!==void 0?e.rowCheckboxVisible:!1;return B.createByObjectArray(e.rows,e.header??[],e.footer??[],e.fixedLeftColumnCount??0,e.fixedRightColumnCount??0,t,e.defaultRowHeights??new Y,e.columnDefs??[],e.columnSizes??[])}static createByAreaModels(e=new P,t,o=new P,s=0,i=0,r=!1,n=new Y,l,c=[],a=-1,d){return new le(e,t,o,s,i,r,n,l,c,a,d)}static createByAreaModelsParam(e){return B.createByAreaModels(e.headerAreaModel??new P,e.bodyAreaModel,e.footerAreaModel??new P,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=[],o=[],s=0,i=0,r=!1,n=new Y,l,c=[]){let a;t!=null&&t.length?a=new D("header",t,n.header,l):l!=null&&l.length?a=new D("header",[l.map(p=>p.headerLabel)],n.header,l):a=new P;const d=o?new D("footer",o,n.footer,l):new P,u=new ke("body",e,l,n.body);return new le(a,u,d,s,i,r,n,l,c)}}class Dt{constructor(e,t,o=200,s=300,i=0,r=0){this.items=e,this.cellRenderer=t,this.coverWidth=o,this.coverHeight=s,this.width=i,this.firstRowPaddingTop=r,this.rowSelectionModel=void 0,this.areaIdent="body",this.filteredItems=[],this.sorterService=new We,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}getColumnCount(){return this.width?Math.floor(this.width/this.coverWidth):1}getValueAt(e,t){var o;return(o=this.filteredItems)==null?void 0:o[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:o}=t,s=o==="asc"?1:o==="desc"?-1:0;this.filteredItems=this.filteredItems.sort((i,r)=>this.sorterService.genericSortComparator(i,r,s))}return!0}sort(e){this.filteredItems=this.filteredItems.sort(e)}isEditable(e,t){return!1}setValue(e,t,o){return!0}isSelectable(e,t){return!1}changeColumnOrder(e,t){}setPropertyValue(e,t,o){return!1}arrayMove(e,t,o){}}class Pt{constructor(e,t=0){this.bodyModel=e,this.paddingTop=t,this.headerAreaModel=new P,this.footerAreaModel=new P}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 he(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 Ft{constructor(){this.autoRestoreSortingState=!1,this.autoRestoreCollapsedExpandedState=!1,this.autoRestoreScrollPosition=!1,this.autoRestoreCheckedState=!1,this.autoRestoreSelectedState=!1,this.getStorageKeyFn=void 0,this.isSame=(e,t,o)=>{if(e&&t&&o.getRowId){const s=o.getRowId(e),i=o.getRowId(t);return s===i}return!1},this.getRowId=e=>{if(e){for(const t of["id","uuid"]){const o=e[t];if(o!=null)return o}try{return JSON.stringify(e)}catch(t){console.error(t)}}return console.warn('One of following options set to true without a valid "getRowId()": autoRestoreExpandedState, autoRestoreCheckedState.'),-1}}}class Io{static createCoverGridModel(e,t,o=200,s=300,i=0,r=0){const n=new Dt(e,t,o,s,i,r);return new Pt(n,r)}static createCoverGrisDefaultOptions(e,t=()=>"CoverGrid"){return{...new J,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 Ft,getStorageKeyFn:t,autoRestoreCollapsedExpandedState:!1,autoRestoreScrollPosition:!0,autoRestoreSortingState:!1,autoRestoreSelectedState:!1}}}}const ko=["COPY_2_CLIPBOARD","START_EDITING","TOGGLE_SELECTION","SELECT_ALL","DESELECT_ALL","NAVIGATE_LEFT","NAVIGATE_RIGHT","NAVIGATE_UP","NAVIGATE_DOWN"];class _t{constructor(e,t){this.tableModel=e,this.tableOptions=t}}class Lt{constructor(e,t,o,s,i,r,n){this.emmitDataKey=e,this.emmitCancelKey=t,this.queryId=o,this.filter=s,this.sorting=i,this.startIndex=r,this.endIndex=n}}class Do extends Lt{constructor(e,t,o,s,i,r,n,l){super(e,t,o,s,i,r,n),this.rows=l}}class Ot{constructor(e,t){this.value=e,this.label=t}}class Po{constructor(e,t){this.index=e,this.px=t}}const Fo={body:["ge-table-text-align-left"]},_o={body:["ge-table-text-align-center"]},Lo={body:["ge-table-text-align-right"]},Oo={header:["ge-table-text-align-left"],body:["ge-table-text-align-left"],footer:["ge-table-text-align-left"]},Vo={header:["ge-table-text-align-center"],body:["ge-table-text-align-center"],footer:["ge-table-text-align-center"]},Ho={header:["ge-table-text-align-right"],body:["ge-table-text-align-right"],footer:["ge-table-text-align-right"]};class De{render(e,t,o,s,i,r,n){if(i.isRowCheckable(t)){n.addClass(e,"ge-table-row-checkbox-div");const l=i.isRowChecked(t),c=l==="full"?"checked":"",a=l==="semi"?'<span style="opacity: 0.4;">✓<span>':"";e.innerHTML=`
309
- <input
310
- type="checkbox"
311
- data-area="${s}"
312
- data-row-index="${t}"
313
- data-col-index="${o}"
314
- data-input-type="checkbox"
315
- ${c}
316
- class="ge-table-row-checkbox">
317
- ${a} `}}}class Bo{constructor(){this.type="CheckboxColumnDef",this.property="CheckboxColumn",this.headerLabel="",this.width=new b(50,"px"),this.minWidth=new b(50,"px"),this.maxWidth=new b(100,"px"),this.rendererMap=new k(new De,new De,void 0),this.classes=new k([],["ge-table-text-align-left"],[])}}class $o{static body(e){return new k(void 0,e,void 0)}}class Wo{constructor(e="down",t){this.status=e,this.originalEvent=t}}class No{constructor(e,t,o,s,i={}){this.area=e,this.rowIndex=t,this.columnIndex=o,this.value=s,this.cssClasses=i}}class Vt{constructor(e,t,o,s=!1,i="normal",r=void 0){this.data=e,this.property=t,this.toggle=o,this.closed=s,this.visibility=i,this.children=r,this.impl="CellGroup"}}class Ht extends Vt{constructor(e,t=0,o=0,s){super(e.data,e.property,e.toggle,e.closed,e.visibility,e.children),this.rowIndex=t,this.childIndex=o,this.parent=s,this.impl="CellGroupExt",this.children=void 0,this.leftNeighbour=void 0,this.rightNeighbour=void 0}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 o;if(e!=null&&e.claimsSpace()&&t++,(o=e==null?void 0:e.children)!=null&&o.length)for(const s of e.children)t=this.getColumnCount(s,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),o=`${this.getColumnIndex()}`,s=`${this.getColumnCount(this)}`,i=`${this.getRowSpan(this,e)}`,r=`${this.getParentCount(this)}`,n=`${t+this.data}
301
+ }`};let Ke=_e;class Se{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 J{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=J.toExpandedFn(i.expanded??!0),c=[];for(const a of e){const d=new Se(a,l(a,0),[],void 0,0);c.push(J.buildTreeRow(a,r,d,0,n,l))}return c}static buildTreeRow(e,t="children",s=new Se(e,!0,[],void 0,0),o=0,i=12,r=!0){var c;const n=J.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 a of l){const d=new Se(a,n(a,o+1),[],s,o+1);(c=s.children)==null||c.push(d),J.buildTreeRow(a,t,d,o+1,i,n)}return s}static toExpandedFn(e){return typeof e=="function"?e:()=>e}}class q{constructor(e=34,t=34,s=34){this.header=e,this.body=t,this.footer=s}}class m{constructor(e=100,t="px"){this.value=e,this.unit=t}}const ut=()=>!0,pt=()=>!1;class U{constructor(e,t,s=new m(100,"px"),o=new D,i=new D,r=new m(100,"px"),n=new m(100,"px"),l,c,a,d,u,p,g,w,f=()=>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=a,this.sortStatesOrder=d,this.sortIconVisible=u,this.editable=p,this.getEditRenderer=g,this.editInputPipe=w,this.isVisible=f,this.visible=!0,s.unit!=="px"&&(this.minWidth=new m(0,"px"),this.maxWidth=new m(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??pt,r=e.isVisible??e.isVisible??ut;return new U(e.property??"",e.headerLabel??"",e.width??new m(100,"px"),s,t,e.minWidth??new m(100,"px"),e.maxWidth??new m(100,"px"),e.sortable,e.sortComparator,e.sortState,e.sortStatesOrder,o,i,e.getEditRenderer,e.editInputPipe,r)}}const Cs=new m(500,"px"),xs=new m(400,"px"),Xt=new m(300,"px"),Ss=new m(290,"px"),As=new m(280,"px"),Rs=new m(270,"px"),vs=new m(260,"px"),Ms=new m(250,"px"),Es=new m(240,"px"),Ts=new m(230,"px"),Is=new m(220,"px"),ks=new m(210,"px"),Xe=new m(200,"px"),Fs=new m(190,"px"),Ds=new m(180,"px"),Ps=new m(170,"px"),_s=new m(160,"px"),Ls=new m(150,"px"),Vs=new m(140,"px"),Hs=new m(130,"px"),Os=new m(120,"px"),Bs=new m(110,"px"),$s=new m(100,"px"),Ns=new m(90,"px"),Ws=new m(80,"px"),Gs=new m(70,"px"),zs=new m(60,"px"),js=new m(50,"px"),Ys=new m(40,"px"),Us=new m(30,"px"),Ks=new m(20,"px"),Xs=new m(10,"px"),Js=new m(0,"px");class P extends Be{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}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 _{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 Jt{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 be extends Be{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 ct,this.service=new Jt,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}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===be.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 me{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 Te{constructor(e=0,t=0,s=0,o=0){this.top=e,this.right=t,this.bottom=s,this.left=o}}class qt{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 qs{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 me){this.getTopTreeRows().forEach(o=>s.checkRow(o,t));return}this.checkAll(t?this.getBodyRows():[])}isRowChecked(e){const t=this.bodyAreaModel.rowSelectionModel;if(t instanceof me){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}}const Ie=new WeakSet,Je=new WeakMap;function Zs(h,e){e?Ie.delete(h):Ie.add(h),Zt(h)}function We(h,e){e?Je.set(h,e):Je.delete(h),Zt(h)}function Zt(h){const e=Je.get(h),t=!Ie.has(h);e?h.isVisible=()=>!Ie.has(h)&&e():h.isVisible=t?ut:pt}class Ae{constructor(e,t,s,o=0,i=0,r=!1,n=new q,l=[],c=[],a=-1,d=0,u=400,p=()=>{}){var g,w,f,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=c,this.overridingColumnWidth=a,this.columnCount=d,this.parentSize=u,this.getSelectionModel=p,this.rowCount=0,this.contentHeightInPx=0,this.contentWidthInPx=0,this.padding=new Te(0,0,0,0),this.xPositions=[],this.headerVisible=!0,this.footerVisible=!0,e.areaIdent="header",t.areaIdent="body",s.areaIdent="footer",this.columnCount||((g=this.columnDefs)!=null&&g.length?this.columnCount=this.columnDefs.length:(w=this.columnSizes)!=null&&w.length&&(this.columnCount=(f=this.columnSizes)==null?void 0:f.length)),(C=this.columnDefs)!=null&&C.length&&je(this.columnDefs[0])&&!t.rowSelectionModel&&(t.rowSelectionModel=new qt),(b=this.columnDefs)!=null&&b.length&&je(this.columnDefs[0])&&!e.rowSelectionModel&&(e.rowSelectionModel=new qs(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 m(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 Te(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;Zs(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(a=>{var d;return((d=a.width)==null?void 0:d.unit)==="weight"});this.columnSizes=this.columnDefs.map(a=>{if(a.width.unit==="%"&&e){let d=Math.floor(a.width.value*e/100);if(a.minWidth){const u=this.sizeToPixel(a.minWidth,e);d=Math.max(u,d)}if(a.maxWidth){const u=this.sizeToPixel(a.maxWidth,e);d=Math.min(u,d)}return d}else if(a.width.unit==="px"&&e)return a.width.value;return 0});const r=a=>{var d;return((d=a.isVisible)==null?void 0:d.call(a))!==!1},n=this.columnSizes.reduce((a,d,u)=>r(this.columnDefs[u])?a+d:a,0),l=e-n,c=i.filter(r);if(l>0&&c.length){const a=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/a)}}}}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 qe extends L{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 G{static createTableModel(e){var t,s,o,i,r,n,l,c,a,d,u,p,g,w;if(e.defaultRowHeights===void 0)if((t=e.tableOptions)!=null&&t.defaultRowHeights)e.defaultRowHeights=e.tableOptions.defaultRowHeights;else{if(e.defaultRowHeights=new q,e.headerAreaModel&&"defaultRowHeight"in e.headerAreaModel){const f=e.headerAreaModel.defaultRowHeight;f>-1&&(e.defaultRowHeights.header=f)}if(e.bodyAreaModel&&"defaultRowHeight"in e.bodyAreaModel){const f=e.bodyAreaModel.defaultRowHeight;f>-1&&(e.defaultRowHeights.body=f)}if(e.footerAreaModel&&"defaultRowHeight"in e.footerAreaModel){const f=e.footerAreaModel.defaultRowHeight;f>-1&&(e.defaultRowHeights.footer=f)}}if(e.columnDefs===void 0&&((s=e.properties)!=null&&s.length?e.columnDefs=e.properties.map(f=>new U(f,f.toUpperCase(),Xe)):(o=e.rows)!=null&&o.length?e.columnDefs=Object.keys(e.rows[0]).map(f=>new U(f,f.toUpperCase(),Xe)):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||((c=e.headerData)!=null&&c.length?e.headerAreaModel=new P("header",e.headerData,e.defaultRowHeights.header,e.columnDefs):(a=e.columnDefs)!=null&&a.length?e.headerAreaModel=new P("header",[e.columnDefs.map(f=>f.headerLabel)],e.defaultRowHeights.header,e.columnDefs):e.headerAreaModel=new _("header")),e.footerAreaModel||((d=e.footerData)!=null&&d.length?e.footerAreaModel=new P("footer",e.footerData,e.defaultRowHeights.footer,e.columnDefs):e.footerAreaModel=new _("footer")),!e.bodyAreaModel)if(e.rows)if((u=e.rows)!=null&&u.length&&$(e.rows[0])){const f=e.rows;e.bodyAreaModel=new be("body",f,e.defaultRowHeights.body,e.columnDefs),(e.columnDefs[0].property==="CheckboxColumn"||(p=e.tableOptions)!=null&&p.showCheckboxWihoutExtraColumn)&&(e.bodyAreaModel.rowSelectionModel=new me(f))}else e.bodyAreaModel=new qe("body",e.rows,e.columnDefs,e.defaultRowHeights.body);else e.bodyData?e.bodyAreaModel=new P("body",e.bodyData,e.defaultRowHeights.body):e.bodyAreaModel=new _("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&&((g=e.tableOptions)!=null&&g.getSelectionModel)&&(e.getSelectionModel=(w=e.tableOptions)==null?void 0:w.getSelectionModel),new Ae(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 G.buildByTypedRows(e.rows??[],e.columnDefs,e.tableOptions??new se,e.fixedLeftColumnCount??0,e.fixedRightColumnCount??0)}static buildByTypedRows(e,t,s=new se,o=0,i=0){const r=s.defaultRowHeights,n=t[0].property==="CheckboxColumn";if(e!=null&&e.length&&$(e[0])){const c=e,a=new be("body",c,r.body,t);return(n||s.showCheckboxWihoutExtraColumn)&&(a.rowSelectionModel=new me(c)),G.createByAreaModelsParam({headerAreaModel:new P("header",[t.map(d=>d.headerLabel)],r.header),bodyAreaModel:a,footerAreaModel:new P("footer",[],r.footer),columnDefs:t,fixedLeftColumnCount:o,fixedRightColumnCount:i,defaultRowHeights:s.defaultRowHeights,rowCheckboxVisible:!1,columnSizes:[],columnCount:t.length,overridingColumnWidth:-1})}return G.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 G.createByObjectArray(e.rows,e.header??[],e.footer??[],e.fixedLeftColumnCount??0,e.fixedRightColumnCount??0,t,e.defaultRowHeights??new q,e.columnDefs??[],e.columnSizes??[])}static createByAreaModels(e=new _,t,s=new _,o=0,i=0,r=!1,n=new q,l,c=[],a=-1,d){return new Ae(e,t,s,o,i,r,n,l,c,a,d)}static createByAreaModelsParam(e){return G.createByAreaModels(e.headerAreaModel??new _,e.bodyAreaModel,e.footerAreaModel??new _,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 q,l,c=[]){let a;t!=null&&t.length?a=new P("header",t,n.header,l):l!=null&&l.length?a=new P("header",[l.map(p=>p.headerLabel)],n.header,l):a=new _;const d=s?new P("footer",s,n.footer,l):new _,u=new qe("body",e,l,n.body);return new Ae(a,u,d,o,i,r,n,l,c)}}class Qt{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 ct,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}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 es{constructor(e,t=0){this.bodyModel=e,this.paddingTop=t,this.headerAreaModel=new _,this.footerAreaModel=new _}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 Te(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 ts{constructor(){this.autoRestoreSortingState=!1,this.autoRestoreCollapsedExpandedState=!1,this.autoRestoreScrollPosition=!1,this.autoRestoreCheckedState=!1,this.autoRestoreSelectedState=!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=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('One of following options set to true without a valid "getRowId()": autoRestoreExpandedState, autoRestoreCheckedState.'),-1}}}class Qs{static createCoverGridModel(e,t,s=200,o=300,i=0,r=0){const n=new Qt(e,t,s,o,i,r);return new es(n,r)}static createCoverGrisDefaultOptions(e,t=()=>"CoverGrid"){return{...new se,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 ts,getStorageKeyFn:t,autoRestoreCollapsedExpandedState:!1,autoRestoreScrollPosition:!0,autoRestoreSortingState:!1,autoRestoreSelectedState:!1}}}}const eo=["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 ss{constructor(e,t){this.tableModel=e,this.tableOptions=t}}class os{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 to extends os{constructor(e,t,s,o,i,r,n,l){super(e,t,s,o,i,r,n),this.rows=l}}class is{constructor(e,t){this.value=e,this.label=t}}class so{constructor(e,t){this.index=e,this.px=t}}const oo={body:["ge-table-text-align-left"]},io={body:["ge-table-text-align-center"]},ro={body:["ge-table-text-align-right"]},no={header:["ge-table-text-align-left"],body:["ge-table-text-align-left"],footer:["ge-table-text-align-left"]},lo={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 Ze{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 co{constructor(){this.type="CheckboxColumnDef",this.property="CheckboxColumn",this.headerLabel="",this.width=new m(50,"px"),this.minWidth=new m(50,"px"),this.maxWidth=new m(100,"px"),this.rendererMap=new D(new Ze,new Ze,void 0),this.classes=new D([],["ge-table-text-align-left"],[])}}class ho{static body(e){return new D(void 0,e,void 0)}}class uo{constructor(e="down",t){this.status=e,this.originalEvent=t}}class po{constructor(e,t,s,o,i={}){this.area=e,this.rowIndex=t,this.columnIndex=s,this.value=o,this.cssClasses=i}}class rs{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 ns extends rs{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}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}
318
302
  childIndex:${this.childIndex}
319
303
  row:${this.rowIndex}
320
- col:${o}
304
+ col:${s}
321
305
  vis:${this.visibility}
322
306
  toggle:${this.toggle}
323
307
  closed:${this.closed}
324
308
  isVisible:${this.isVisible()}
325
309
  ownColumn:${this.ownColumn()}
326
310
  claimsSpace:${this.claimsSpace()}
327
- colCount:${s}
311
+ colCount:${o}
328
312
  rowSpan:${i}
329
- pc:${r}`.replace(/[ \n]+/g," ");if(this.children)for(const l of this.children)l.log(e);return n}}class I{static buildColumnDefs(e,t=[]){for(const o of e)o.property&&t.push(W.create({property:o.property,headerLabel:o.data?o.data:o.property,isVisible:()=>typeof o.isVisible=="function"?o.isVisible():!0})),o.children&&I.buildColumnDefs(o.children,t);return t}static buildGroupExts(e,t=[],o=0,s){let i;for(let r=0;r<e.length;r++){const n=e[r],l=new Ht(n,o,r,s);i&&(l.leftNeighbour=i,i.rightNeighbour=l),t.push(l),n.children&&(l.children=I.buildGroupExts(n.children,[],o+1,l)),i=l}return t}static flattenGroupExts(e,t=[]){for(const o of e)t.push(o),o.children&&I.flattenGroupExts(o.children,t);return t}static buildArrayOfArrays(e,t){var i;let o=-1,s=99999;for(const r of e){if(r.rowIndex<=s){o++;for(let n=0;n<t.length;n++)t[n][o]=null}if(t[r.rowIndex][o]=r,s=r.rowIndex,r.ownColumn()&&((i=r.children)!=null&&i.length)){for(let n=r.rowIndex+1;n<t.length;n++)t[n][o]=void 0;o++;for(let n=0;n<t.length;n++)t[n][o]=null}}return t}static iterateThrowColumns(e=[],t){var o;for(const s of t)e.push(s.data+" rowIndex:"+s.rowIndex),(o=s.children)!=null&&o.length&&I.iterateThrowColumns(e,s.children)}}class Go{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 o=0;for(let s=0;s<e;s++)o+=this.getRowHeight(s);return o}getConstantRowHeight(){}init(){}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,o){return!1}}const fe=class fe{constructor(e=new Ce){this.headerGroupOptions=e}render(e,t,o,s,i,r,n){const l=r!=null&&r.data?r.data:"";if(r){const{toggle:c,visibility:a,closed:d}=r,u=c?fe.toggleHeaderGroup:"";this.addText(e,s,t,o,l,u),c&&a!=="always"&&this.addArrowDiv(n,e,!d,t,o,s,u)}else this.addText(e,s,t,o,l,"")}addText(e,t,o,s,i,r){e.innerHTML=`<span
313
+ pc:${r}`.replace(/[ \n]+/g," ");if(this.children)for(const l of this.children)l.log(e);return n}}class F{static buildColumnDefs(e,t=[]){for(const s of e)s.property&&t.push(U.create({property:s.property,headerLabel:s.data?s.data:s.property,isVisible:()=>typeof s.isVisible=="function"?s.isVisible():!0})),s.children&&F.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 ns(n,s,r,o);i&&(l.leftNeighbour=i,i.rightNeighbour=l),t.push(l),n.children&&(l.children=F.buildGroupExts(n.children,[],s+1,l)),i=l}return t}static flattenGroupExts(e,t=[]){for(const s of e)t.push(s),s.children&&F.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&&F.iterateThrowColumns(e,o.children)}}class fo{constructor(){this.areaIdent="body",this.rowSelectionModel=void 0}changeColumnOrder(e,t){}doSort(e){return!1}sort(e){}externalFilterChanged(e){}getCellRenderer(e,t){}getColspanAt(e,t){return 0}getCustomClassesAt(e,t){return[]}getCustomStyleAt(e,t){}getMaxColspan(){return 0}getMaxRowspan(){return 0}getRowByIndex(e){}getRowCount(){return 0}getRowHeight(e){return 0}getRowspanAt(e,t){return 0}getTooltipAt(e,t){}getValueAt(e,t){}getTextValueAt(e,t){return""}getYPosByRowIndex(e){const t=this.getConstantRowHeight();if(t!==void 0&&t>0)return e*t;let s=0;for(let o=0;o<e;o++)s+=this.getRowHeight(o);return s}getConstantRowHeight(){}init(){}isEditable(e,t){return!1}isFilterable(){return!1}isRowCheckable(e){return!1}isRowChecked(e){}isSelectable(e,t){return!0}setRowChecked(e,t){}setValue(e,t,s){return!1}}const Le=class Le{constructor(e=new Ne){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:a,closed:d}=r,u=c?Le.toggleHeaderGroup:"";if(this.addText(e,o,t,s,l,u),c&&a!=="always"){const p=this.addArrowDiv(n,e,!d,t,s,o,u),g=new we;n.setAttribute(p,"role","button"),n.setAttribute(p,"aria-expanded",`${!d}`),n.setAttribute(p,"data-ge-group-label",`${l}`),n.setAttribute(p,"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
330
314
  data-ge-action="${r}"
331
315
  data-area="${t}"
332
- data-row-index="${o}"
333
- data-col-index="${s}"
334
- >${i}</span>`}addArrowDiv(e,t,o=!0,s=-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",`${s}`),e.setAttribute(l,"data-col-index",`${i}`),e.setAttribute(l,"data-area",`${r}`),e.setAttribute(l,"data-ge-action",`${n}`);let c;o?c=this.headerGroupOptions.iconExpanded:c=this.headerGroupOptions.iconCollapsed;const a=c.content,d=e.createText(a);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,o){const s=o.split(";").map(i=>i.trim()).filter(i=>i);for(const i of s){const[r,n]=i.split(":");e.setStyle(t,r.trim(),n.trim())}}};fe.toggleHeaderGroup="toggleHeaderGroup";let ue=fe;class zo{constructor(e="header",t,o=[],s,i=new Ce){this.areaIdent=e,this.groups=t,this.columnDefs=o,this.defaultRowHeight=s,this.headerGroupOptions=i,this.gammaCells=!0,this.arr=[],this.groupExts=[],this.cellGroupExtCellRenderer=new ue(this.headerGroupOptions),this.groupExts=I.buildGroupExts(t),this.init()}sort(e){}init(){var e;for(const t of this.groupExts)t.log(this.getMaxRowCount());this.arr=this.buildArray(),!((e=this.columnDefs)!=null&&e.length)&&this.areaIdent==="header"&&(this.columnDefs=I.buildColumnDefs(this.groups))}getAllLeafs(){return I.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=I.flattenGroupExts(this.groupExts),t=1+Math.max(...e.map(r=>r.rowIndex)),o=[];I.iterateThrowColumns(o,this.groupExts);const s=Array.from(Array(t).keys()).map(r=>[]),i=I.buildArrayOfArrays(e,s);return console.table(i),i}changeColumnOrder(e,t){}doSort(e){return!1}externalFilterChanged(e){}getCellRenderer(e,t){return this.cellGroupExtCellRenderer}getColspanAt(e,t){const o=this.getValueAt(e,t);return o?o.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 o=this.getValueAt(e,t);if(o){const s=this.getRowCount();return o.getRowSpan(o,s)}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,o){return!1}toggleHeaderGroup(e){const t=this.arr[e.rowIdx][e.colIdx];t!=null&&t.toggle&&t.visibility!=="always"&&(t.closed=!t.closed,this.init());const o=I.buildColumnDefs(this.groupExts),s=new Map(this.columnDefs.map(r=>[r.property,r])),i=o.map(r=>{const n=s.get(r.property);return n?(n.isVisible=r.isVisible,n):r});return this.columnDefs=i,i}}class jo{filterPredict(e,t,o=this.objectToString.bind(this)){if(!e)return!1;if(!t)return!0;t=t.toLowerCase();const s="+",i="-",r=t.toLowerCase().split(" ").filter(d=>d!==s&&d!==i&&d!==""),n=r.filter(d=>!d.startsWith(s)&&!d.startsWith(i)),l=r.filter(d=>d.startsWith(s)).map(d=>d.replace(/\+/g,"")),c=r.filter(d=>d.startsWith(i)).map(d=>d.replace(/-/g,""));let a=!n.length;for(let d=0;d<n.length;d++)(a||o(e).includes(n[d]))&&(a=!0);if(!a)return!1;for(let d=0;d<l.length;d++)if(!o(e).includes(l[d]))return!1;for(let d=0;d<c.length;d++)if(o(e).includes(c[d]))return!1;return!0}filterRows(e,t,o=s=>JSON.stringify(s).toLowerCase()){if(!e)return[];if(!t)return[...e];t=t.toLowerCase();const s="+",i="-",r=t.toLowerCase().split(" ").filter(a=>a!==s&&a!==i&&a!==""),n=r.filter(a=>!a.startsWith(s)&&!a.startsWith(i)),l=r.filter(a=>a.startsWith(s)).map(a=>a.replace(/\+/g,"")),c=r.filter(a=>a.startsWith(i)).map(a=>a.replace(/-/g,""));return e==null?void 0:e.filter(a=>{let d=!n.length;for(let u=0;u<n.length;u++)(d||o(a).includes(n[u]))&&(d=!0);if(!d)return!1;for(let u=0;u<l.length;u++)if(!o(a).includes(l[u]))return!1;for(let u=0;u<c.length;u++)if(o(a).includes(c[u]))return!1;return!0})}objectToString(e){if(!e)return"";const t=[],o=Object.keys(e);for(let s=0;s<o.length;s++){const i=o[s];t.push(e[i])}return t.join(" ").toLowerCase()}}class Yo{static bodyRenderer(e){return new k(void 0,e,void 0)}}class Uo{constructor(e,t=!0,o=!1){this.property=e,this.skipCheckableCheck=t,this.readonly=o}render(e,t,o,s,i,r,n){if(this.readonly||this.skipCheckableCheck||i.isRowCheckable(t)){n.addClass(e,"ge-table-row-checkbox-div");const l=i.getRowByIndex(t),a=i.getValueByT(l,this.property)===!0?"checked":"",d=this.readonly?" readonly ":"";if(n.addClass(e,"ge-padding-property-checkbox"),e.innerHTML=`
316
+ data-row-index="${s}"
317
+ data-col-index="${o}"
318
+ >${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 a=c.content,d=e.createText(a);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())}}};Le.toggleHeaderGroup="toggleHeaderGroup";let ke=Le;class go{constructor(e="header",t,s=[],o,i=new Ne){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 ke(this.headerGroupOptions),this.groupExts=F.buildGroupExts(t),this.init()}sort(e){}init(){var e;this.arr=this.buildArray(),!((e=this.columnDefs)!=null&&e.length)&&this.areaIdent==="header"&&(this.columnDefs=F.buildColumnDefs(this.groups),this.columnDefs.forEach(t=>We(t,t.isVisible)))}getAllLeafs(){return F.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=F.flattenGroupExts(this.groupExts),t=1+Math.max(...e.map(r=>r.rowIndex)),s=[];F.iterateThrowColumns(s,this.groupExts);const o=Array.from(Array(t).keys()).map(r=>[]);return F.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];t!=null&&t.toggle&&t.visibility!=="always"&&(t.closed=!t.closed,this.init());const s=F.buildColumnDefs(this.groupExts),o=new Map(this.columnDefs.map(r=>[r.property,r])),i=s.map(r=>{const n=o.get(r.property);return n?(We(n,r.isVisible),n):(We(r,r.isVisible),r)});return this.columnDefs=i,i}}class bo{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 a=!n.length;for(let d=0;d<n.length;d++)(a||s(e).includes(n[d]))&&(a=!0);if(!a)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(a=>a!==o&&a!==i&&a!==""),n=r.filter(a=>!a.startsWith(o)&&!a.startsWith(i)),l=r.filter(a=>a.startsWith(o)).map(a=>a.replace(/\+/g,"")),c=r.filter(a=>a.startsWith(i)).map(a=>a.replace(/-/g,""));return e==null?void 0:e.filter(a=>{let d=!n.length;for(let u=0;u<n.length;u++)(d||s(a).includes(n[u]))&&(d=!0);if(!d)return!1;for(let u=0;u<l.length;u++)if(!s(a).includes(l[u]))return!1;for(let u=0;u<c.length;u++)if(s(a).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 mo{static bodyRenderer(e){return new D(void 0,e,void 0)}}class yo{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),a=i.getValueByT(l,this.property)===!0?"checked":"",d=this.readonly?" readonly ":"";if(n.addClass(e,"ge-padding-property-checkbox"),e.innerHTML=`
335
319
  <input
336
320
  type="checkbox"
337
- data-area="${s}"
321
+ data-area="${o}"
338
322
  data-row-index="${t}"
339
- data-col-index="${o}"
323
+ data-col-index="${s}"
340
324
  data-property-index="${this.property}"
341
325
  data-input-type="checkbox"
326
+ tabindex="-1"
342
327
  ${a}
343
328
  ${d}
344
- class="ge-input-checkbox">`,!this.readonly){const u=e.querySelector(".ge-input-checkbox");u&&u.addEventListener("click",(p,f)=>(l[this.property]=!l[this.property],!0))}}}}class Ko{render(e,t,o,s,i,r,n){r&&(e.innerText=new Date(r).toISOString())}}class Xo{constructor(){this.formatter=new Intl.DateTimeFormat("de-DE",{year:"numeric",month:"2-digit",day:"2-digit"})}render(e,t,o,s,i,r,n){if(r){let l="";try{l=this.formatter.format(new Date(r))}catch{l=r}e.innerHTML=`
345
- <div class="ge-table-label-div" data-row-index="${t}" data-col-index="${o}" data-area="${s}" style="position: relative; background: transparent; width: 100%; height: 100%;">
346
- <div class="ge-table-label" data-row-index="${t}" data-col-index="${o}" data-area="${s}">${l}</div>
347
- </div>`}}}class Jo{render(e,t,o,s,i,r,n){r&&(e.innerText=new Date(r).toLocaleDateString())}}class qo{render(e,t,o,s,i,r,n){r==="male"||r==="m"?e.innerText="♂":(r==="female"||r==="f")&&(e.innerText="♀")}}class Zo{constructor(e=100,t=!1){this.maxValue=e,this.labelVisible=t}render(e,t,o,s,i,r,n){if(n.addClass(e,"ge-progressbar-div"),!isNaN(r)){const c=Number(r)*100/this.maxValue,a=this.labelVisible?Math.round(c)+"%":"";e.innerHTML=`
329
+ class="ge-input-checkbox">`,!this.readonly){const u=e.querySelector(".ge-input-checkbox");u&&u.addEventListener("click",(p,g)=>(l[this.property]=!l[this.property],!0))}}}}class wo{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 Co{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=`
330
+ <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%;">
331
+ <div class="ge-table-label" data-row-index="${t}" data-col-index="${s}" data-area="${o}">${E(l)}</div>
332
+ </div>`}}}class xo{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 So{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 Ao{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,a=this.labelVisible?Math.round(c)+"%":"";e.innerHTML=`
348
333
  <div class="ge-table-label-div"
349
334
  data-row-index="${t}"
350
- data-col-index="${o}"
351
- data-area="${s}"
335
+ data-col-index="${s}"
336
+ data-area="${o}"
337
+ role="img"
338
+ aria-label="${E(this.ariaLabel(c,l))}"
352
339
  title="${a}"
353
340
  style="position: relative; background: transparent; width: 100%; height: 100%;">
354
341
  <div class="ge-table-progress-container"
355
342
  style="width:100%;height:50%;padding:0;margin-top:6px;"
356
343
  data-row-index="${t}"
357
- data-col-index="${o}"
358
- data-area="${s}">
344
+ data-col-index="${s}"
345
+ data-area="${o}">
359
346
  <div class="ge-table-progress-bar"
360
347
  style="width:${c}%;height:100%;padding:0;margin:0;"
361
348
  data-row-index="${t}"
362
- data-col-index="${o}"
363
- data-area="${s}">&nbsp;
349
+ data-col-index="${s}"
350
+ data-area="${o}">&nbsp;
364
351
  </div>
365
352
  </div>
366
- </div>`}}}class Qo{render(e,t,o,s,i,r,n){r==="true"||r===!0?e.innerHTML='<span class="ge-true-text-color">✅</span>':r==="false"||r===!1?e.innerHTML='<span class="ge-false-text-color">❌</span>':e.innerText=""}}class es{render(e,t,o,s,i,r,n){r&&(e.innerText=new Date(r).toISOString().replace(/T/g," ").replace(/\..*/g,""))}}class ts{constructor(e=Number.MIN_SAFE_INTEGER,t=Number.MAX_SAFE_INTEGER){this.min=e,this.max=t}render(e,t,o,s,i,r,n){r&&(e.innerHTML=`
353
+ </div>`}}}class Ro{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 vo{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 Mo{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=`
367
354
  <div class="ge-table-label-div">
368
- <div class="ge-table-label">${r}</div>
369
- </div>`,(typeof r=="string"||isNaN(r)||r<this.min||r>this.max)&&n.addClass(e,"ge-cell-error"))}}class os{constructor(e){this.property=e}render(e,t,o,s,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 a=[];for(let u=0;u<c;u++)a.push("★");const d=a.join(" ");e.innerHTML=`
370
- <div class="ge-table-label-div" data-row-index="${t}" data-col-index="${o}" data-area="${s}" style="position: relative; background: transparent; width: 100%; height: 100%;">
371
- <div class="ge-table-label" data-row-index="${t}" data-col-index="${o}" data-area="${s}">${d}</div>
372
- </div>`}}}class ss{render(e,t,o,s,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 a=n.createText(r.join(", "));n.appendChild(c,a)}else e.innerText=""}}class is{constructor(e,t=100,o=!1){this.property=e,this.maxValue=t,this.labelVisible=o}render(e,t,o,s,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 a=c*100/this.maxValue,d=this.labelVisible?Math.round(a)+"%":"";e.innerHTML=`
355
+ <div class="ge-table-label">${E(r)}</div>
356
+ </div>`,(typeof r=="string"||isNaN(r)||r<this.min||r>this.max)&&n.addClass(e,"ge-cell-error"))}}class Eo{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 a=[];for(let u=0;u<c;u++)a.push("★");const d=a.join(" ");e.innerHTML=`
357
+ <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%;">
358
+ <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>
359
+ </div>`}}}class To{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 a=n.createText(r.join(", "));n.appendChild(c,a)}else e.innerText=""}}class Io{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 a=c*100/this.maxValue,d=this.labelVisible?Math.round(a)+"%":"";e.innerHTML=`
373
360
  <div class="ge-table-label-div"
374
361
  data-row-index="${t}"
375
- data-col-index="${o}"
376
- data-area="${s}"
362
+ data-col-index="${s}"
363
+ data-area="${o}"
364
+ role="img"
365
+ aria-label="${E(this.ariaLabel(a,c))}"
377
366
  title="${d}"
378
367
  style="position: relative; background: transparent; width: 100%; height: 100%;">
379
368
  <div class="ge-table-progress-container"
380
369
  style="width:100%;height:50%;padding:0;margin-top:6px;"
381
370
  data-row-index="${t}"
382
- data-col-index="${o}"
383
- data-area="${s}">
371
+ data-col-index="${s}"
372
+ data-area="${o}">
384
373
  <div class="ge-table-progress-bar"
385
374
  style="width:${a}%;height:100%;padding:0;margin:0;"
386
375
  data-row-index="${t}"
387
- data-col-index="${o}"
388
- data-area="${s}">&nbsp;
376
+ data-col-index="${s}"
377
+ data-area="${o}">&nbsp;
389
378
  </div>
390
379
  </div>
391
- </div>`}}}class rs{render(e,t,o,s,i,r,n){if(r){e.innerHTML=`
380
+ </div>`}}}class ko{render(e,t,s,o,i,r,n){if(r||r===0){e.innerHTML=`
392
381
  <div
393
382
  class="ge-table-label-div"
394
- data-row-index=${t}"
395
- data-col-index="${o}"
396
- data-area="${s}"
383
+ data-row-index="${t}"
384
+ data-col-index="${s}"
385
+ data-area="${o}"
397
386
  style="position: relative; background: transparent; width: 100%; height: 100%;">
398
387
  <div
399
388
  class="ge-table-label"
400
389
  data-row-index="${t}"
401
- data-col-index="${o}"
402
- data-area="${s}">${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 ze{constructor(e,t,o,s,i,r){this.action=e,this.area=t,this.areaModel=o,this.rowIndex=s,this.columnIndex=i,this.id=r}}class H{constructor(e,t,o="",s="",i="button",r=!0){this.action=e,this.label=t,this.icon=o,this.elementClass=s,this.elementType=i,this.enabled=r}}class Bt{constructor(e,t){this.actionEventListener=e,this.crudActions=t}render(e,t,o,s,i,r,n){n.addClass(e,"ge-table-row-action-div");const l=r,a=this.getCrudActions(r).map(d=>d.elementType==="button"?this.buildButtonHtml(d,s,t,o,l):this.buildLinkHtml(d,s,t,o,l));e.innerHTML=a.join(""),this.addClickEventListeners(e,s,i)}buildButtonHtml(e,t,o,s,i){const r=e.enabled?'data-listen="click"':"disabled";return`
390
+ data-col-index="${s}"
391
+ 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 ft{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 W{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 ls{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,a=this.getCrudActions(r).map(d=>d.elementType==="button"?this.buildButtonHtml(d,o,t,s,l):this.buildLinkHtml(d,o,t,s,l));e.innerHTML=a.join(""),this.addClickEventListeners(e,o,i)}buildButtonHtml(e,t,s,o,i){const r=e.enabled?'data-listen="click"':"disabled";return`
403
392
  <button
404
393
  type="button"
394
+ tabindex="-1"
405
395
  data-area="${t}"
406
396
  data-action="${e.action}"
407
- data-id="${i}"
408
- data-row-index="${o}"
409
- data-col-index="${s}"
397
+ data-id="${E(i)}"
398
+ data-row-index="${s}"
399
+ data-col-index="${o}"
410
400
  style="height: 100%;line-height: 1;"
411
401
  ${r}
412
402
  class="ge-table-cell-action ge-table-cell-button ${e.elementClass}">
413
403
  ${e.label}
414
- </button>`}buildLinkHtml(e,t,o,s,i){const r=e.enabled?'data-listen="click"':"disabled";return`
404
+ </button>`}buildLinkHtml(e,t,s,o,i){const r=e.enabled?'data-listen="click"':"disabled";return`
415
405
  <a
416
406
  href="javascript:void(0)"
407
+ tabindex="-1"
417
408
  data-area="${t}"
418
409
  data-action="${e.action}"
419
- data-id="${i}"
420
- data-row-index="${o}"
421
- data-col-index="${s}"
410
+ data-id="${E(i)}"
411
+ data-row-index="${s}"
412
+ data-col-index="${o}"
422
413
  ${r}
423
414
  class="ge-table-cell-action ge-table-cell-link ${e.elementClass}">
424
415
  ${e.label}
425
- </a>`}addClickEventListeners(e,t,o){e.querySelectorAll(".ge-table-cell-action").forEach(i=>{i.addEventListener("click",r=>{const n=r.target;if(n){const l=this.createActionEvent(n,o);l&&this.actionEventListener.onActionEvent(l)}})})}createActionEvent(e,t){const o=e.getAttribute("data-area"),s=e.getAttribute("data-row-index"),i=e.getAttribute("data-col-index"),r=e.getAttribute("data-action")??"unknown",n=e.getAttribute("data-id")??"unknown";if(o&&s&&i){const l=se(o),c=Number(s),a=Number(i);return new ze(r,l,t,c,a,n)}return null}getCrudActions(e){return Array.isArray(e)&&e.every(t=>t instanceof H)?e:this.crudActions}}const ns=function(h,e,t){return h?Number(h):""};class je{constructor(e){this.options=e}static create(e){return new je(e.map(t=>new Ot(t,t)))}render(e,t,o,s,i,r,n){if(i.isEditable(t,o)){n.addClass(e,"ge-table-row-select-div");const l=i.getValueAt(t,o);let c=[];for(let d of this.options){const u=d.value===l?" selected ":"";c.push(`<option value="${d.value}" ${u}>${d.label}</option>`)}const a=c.join("");e.innerHTML=`
416
+ </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=ye(s),c=Number(o),a=Number(i);return new ft(r,l,t,c,a,n)}return null}getCrudActions(e){return Array.isArray(e)&&e.every(t=>t instanceof W)?e:this.crudActions}}const Fo=function(h,e,t){return h?Number(h):""};class gt{constructor(e){this.options=e}static create(e){return new gt(e.map(t=>new is(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 a=c.join("");e.innerHTML=`
426
417
  <select
427
418
  autofocus
428
419
  data-listen="change"
429
- data-area="${s}"
420
+ data-area="${o}"
430
421
  data-row-index="${t}"
431
- data-col-index="${o}"
422
+ data-col-index="${s}"
432
423
  data-input-type="text"
433
424
  style="width:100%;height:100%;border:0;padding:0 0 0 8px;"
434
- class="ge-table-cell-editor-select">${a}</select>`}}}class ls extends xe{constructor(e){super("row","multi"),this.model=e}getSelectedRowItems(e){const t=this.getMergedRowIndices();return this.isAllSelected()?e:e.filter((o,s)=>t.includes(s))}selectRow(e){this.addRange(M.singleRow(e))}unselectRow(e){this.removeSelection(M.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.selectRow(e)}}class as{constructor(e,t,o){this.r=e,this.g=t,this.b=o}}class Pe{constructor(e,t,o,s){this.minValue=e,this.minColor=t,this.maxValue=o,this.maxColor=s}}class Z{static normalize(e,t,o,s=0,i=1){return(e-t)/(o-t)*(i-s)+s}static getTwoColorGradientRGB(e,t){const o=Z.normalize(e,t.minValue,t.maxValue,0,1),s=t.maxColor.r-t.minColor.r,i=t.maxColor.g-t.minColor.g,r=t.maxColor.b-t.minColor.b,n=s*o+t.minColor.r,l=i*o+t.minColor.g,c=r*o+t.minColor.b;return`rgb(${Math.round(n)}, ${Math.round(l)}, ${Math.round(c)})`}static getThreeColorGradientRGB(e,t){return e<t.middleValue?Z.getTwoColorGradientRGB(e,new Pe(t.minValue,t.minColor,t.middleValue,t.middleColor)):e>t.middleValue?Z.getTwoColorGradientRGB(e,new Pe(t.middleValue,t.middleColor,t.maxValue,t.maxColor)):`rgb(${t.middleColor.r}, ${t.middleColor.g}, ${t.middleColor.b})`}}class cs{constructor(e,t,o,s,i,r){this.minValue=e,this.minColor=t,this.middleValue=o,this.middleColor=s,this.maxValue=i,this.maxColor=r}}class $t{constructor(e=!0,t=!0,o=(r,n)=>r*10+10,s=50,i=450){this.autoCalc=e,this.takeHeaderLabelsIntoAccount=t,this.charCountToWidth=o,this.minWidth=s,this.maxWidth=i}}class Wt{constructor(e){this.object=e}openDialog(){const e=document.createElement("dialog");e.classList.add("ge-table-crud-object-view"),e.innerHTML=`
425
+ class="ge-table-cell-editor-select">${a}</select>`}}}class Do extends Y{constructor(e){super("row","multi"),this.model=e}getSelectedRowItems(e){if(this.isAllSelected()&&!this.negativeRanges.length)return e;const t=new Set(this.getMergedRowIndices(e.length));return e.filter((s,o)=>t.has(o))}selectRow(e){this.addRange(A.singleRow(e))}unselectRow(e){this.removeSelection(A.singleRow(e))}toggleSelection(){if(this.isAllSelected())this.clear();else if(this.hasNoSelection())this.selectAll();else{const e=this.model.getAllRows();this.silent=!0;for(let t=0;t<e.length;t++)this.toggleRow(t);this.silent=!1,this.fireChangeEvent()}}toggleFilteredRowsSelection(){if(this.isAllSelected())this.clear();else if(this.hasNoSelection()){const e=this.model.getFilteredRows();this.silent=!0;for(let t=0;t<e.length;t++)this.selectRow(t);this.silent=!1,this.fireChangeEvent()}else{const e=this.model.getFilteredRows();this.silent=!0;for(let t=0;t<e.length;t++)this.toggleRow(t);this.silent=!1,this.fireChangeEvent()}}toggleRow(e){this.isSelected(e,0)?this.unselectRow(e):this.reselectPoint(e,0)?this.fireChangeEvent():this.selectRow(e)}}class Po{constructor(e,t,s){this.r=e,this.g=t,this.b=s}}class Qe{constructor(e,t,s,o){this.minValue=e,this.minColor=t,this.maxValue=s,this.maxColor=o}}class ae{static normalize(e,t,s,o=0,i=1){return(e-t)/(s-t)*(i-o)+o}static getTwoColorGradientRGB(e,t){const s=ae.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?ae.getTwoColorGradientRGB(e,new Qe(t.minValue,t.minColor,t.middleValue,t.middleColor)):e>t.middleValue?ae.getTwoColorGradientRGB(e,new Qe(t.middleValue,t.middleColor,t.maxValue,t.maxColor)):`rgb(${t.middleColor.r}, ${t.middleColor.g}, ${t.middleColor.b})`}}class _o{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 as{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 cs{constructor(e){this.object=e}openDialog(){const e=document.createElement("dialog");e.classList.add("ge-table-crud-object-view"),e.innerHTML=`
435
426
  <div class="ge-table-dialog-header">Item</div>
436
427
  <div class="ge-table-dialog-content">
437
428
  ${this.generateHtmlTable(this.object)}
@@ -439,7 +430,7 @@ render scope: this.lastFullVisibleRowIndex <- `+this.lastFullVisibleRowIndex),th
439
430
  <div class="ge-table-dialog-footer">
440
431
  <button class="ge-table-dialog-footer-close-button primary" style="">Close</button>
441
432
  </div>
442
- `,document.body.appendChild(e),e.querySelector(".ge-table-dialog-footer-close-button").addEventListener("click",()=>{e.close("close"),e.remove()}),e.showModal()}getCombinedKey(e,t){return e?`${e}.${t}`:t}getLabel(e){return e.replace(/\./g," ")}generateHtmlTable(e){return`<table>
433
+ `,document.body.appendChild(e),e.addEventListener("close",()=>e.remove()),e.querySelector(".ge-table-dialog-footer-close-button").addEventListener("click",()=>e.close("close")),e.showModal()}getCombinedKey(e,t){return e?`${e}.${t}`:t}getLabel(e){return e.replace(/\./g," ")}generateHtmlTable(e){return`<table>
443
434
  <thead>
444
435
  <tr>
445
436
  <th>Property</th>
@@ -449,22 +440,22 @@ render scope: this.lastFullVisibleRowIndex <- `+this.lastFullVisibleRowIndex),th
449
440
  <tbody>
450
441
  ${this.generateTableRows(e)}
451
442
  </tbody>
452
- </table>`}generateTableRows(e,t=""){const o=[],s=(i,r=null,n=!1)=>`
443
+ </table>`}generateTableRows(e,t=""){const s=[],o=(i,r=null,n=!1)=>`
453
444
  <tr>
454
- <td${n?' class="ge-table-crud-object-view-object-child"':""}>${i}</td>
455
- <td>${r??""}</td>
456
- </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?(o.push(s(l,null,!0)),o.push(this.generateTableRows(r,n))):o.push(s(l,String(r)))}return o.join("")}}class ae{constructor(e,t,o="Edit Item"){this.idKey=e,this.dialogTitle=o,this.object={...t}}openDialog(e){const t=document.createElement("dialog");t.classList.add("ge-table-crud-object-edit"),t.innerHTML=`
457
- <div class="ge-table-dialog-header">${this.dialogTitle}</div>
445
+ <td${n?' class="ge-table-crud-object-view-object-child"':""}>${E(i)}</td>
446
+ <td>${E(r)}</td>
447
+ </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 yt=new Set(["__proto__","constructor","prototype"]);class Q{constructor(e,t,s="Edit Item"){this.idKey=e,this.dialogTitle=s,this.fieldPaths=[],this.object=Q.deepCopy(t)}openDialog(e){const t=document.createElement("dialog");t.classList.add("ge-table-crud-object-edit"),this.fieldPaths=[],t.innerHTML=`
448
+ <div class="ge-table-dialog-header">${E(this.dialogTitle)}</div>
458
449
  <div class="ge-table-dialog-content">
459
- ${this.generateForm(this.object)}
450
+ <form>${this.generateFields(this.object)}</form>
460
451
  </div>
461
452
  <div class="ge-table-dialog-footer">
462
453
  <button class="ge-table-dialog-footer-save-button primary">Save</button>
463
454
  <button class="ge-table-dialog-footer-cancel-button">Cancel</button>
464
455
  </div>
465
- `,document.body.appendChild(t);const o=t.querySelector(".ge-table-dialog-footer-save-button"),s=t.querySelector(".ge-table-dialog-footer-cancel-button");o.addEventListener("click",()=>{const i=t.querySelector("form"),r=new FormData(i);for(const[n,l]of r)this.setNestedValue(this.object,n,l);e(this.object),t.close(),t.remove()}),s.addEventListener("click",()=>{t.close(),t.remove()}),t.showModal()}generateForm(e,t=""){const o=[];for(const s in e){if(!e.hasOwnProperty(s)||this.idKey===s)continue;const i=this.getCombinedKey(t,s),r=this.getLabel(i),n=e[s];if(typeof n=="object"&&n!==null)o.push(this.generateForm(n,i));else{let l;typeof n=="string"?l=`<input type="text" id="${i}" name="${i}" value="${n}" />`:typeof n=="number"?l=`<input type="number" id="${i}" name="${i}" value="${n}" />`:typeof n=="boolean"?l=`<input type="checkbox" id="${i}" name="${i}" ${n?"checked":""} />`:l=`<input type="text" id="${i}" name="${i}" value="${n}" />`,o.push(`
456
+ `,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||yt.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 a;typeof n=="number"?a=`<input type="number" step="any" ${c} value="${E(n)}" />`:typeof n=="boolean"?a=`<input type="checkbox" ${c} ${n?"checked":""} />`:a=`<input type="text" ${c} value="${E(n)}" />`,s.push(`
466
457
  <div class="form-field">
467
- <label for="${i}">${r}</label>
468
- ${l}
458
+ <label for="${l}">${E(r)}</label>
459
+ ${a}
469
460
  </div>
470
- `)}}return`<form>${o.join("")}</form>`}setNestedValue(e,t,o){const s=t.split(".");let i=e;for(let r=0;r<s.length-1;r++)i[s[r]]||(i[s[r]]={}),i=i[s[r]];i[s[s.length-1]]=o}getCombinedKey(e,t){return e?`${e}.${t}`:t}getLabel(e){return e.replace(/\./g," ")}}class Nt{constructor(){this.urls={list:{url:"",method:"GET"}},this.singleRowActions=[new H("VIEW","View","","","link"),new H("EDIT","Edit","","","link"),new H("CLONE","Clone","","","link"),new H("DELETE","Delete","","","link")],this.tableActions=[new H("CREATE","Create","","","button"),new H("DELETE_SELECTED","Delete Selected","","","button")],this.autoAddActionColumn=!0,this.columnWidths=new $t,this.calcFixedRightColumnCount=e=>e>6?1:0,this.getHeadersInit=()=>({}),this.getIdKey=()=>"id",this.getIdByObject=e=>(this.getIdKey()??"id")in e?e.id:e,this.fetchList=e=>{const t=e.getHeadersInit?e.getHeadersInit():{};let o=e.urls.list.url,s=e.urls.list.method??"GET";return fetch(o,{headers:t,method:s}).then(i=>i.json())},this.fetchItem=(e,t)=>{var r,n;const o=e.getHeadersInit?e.getHeadersInit():{};let s=((r=e.urls.read)==null?void 0:r.url)??"";s=s.replace("{id}",t);let i=((n=e.urls.read)==null?void 0:n.method)??"GET";return fetch(s,{headers:o,method:i}).then(l=>l.json())},this.updateItem=(e,t,o)=>{var n,l;const s=e.getHeadersInit?e.getHeadersInit():{};let i=((n=e.urls.update)==null?void 0:n.url)??"";i=i.replace("{id}",t);let r=((l=e.urls.update)==null?void 0:l.method)??"PATCH";return fetch(i,{headers:s,method:r,body:JSON.stringify(o)}).then(c=>c.json())},this.createItem=(e,t)=>{var r,n;const o=e.getHeadersInit?e.getHeadersInit():{};let s=((r=e.urls.create)==null?void 0:r.url)??"",i=((n=e.urls.create)==null?void 0:n.method)??"POST";return fetch(s,{headers:o,method:i,body:JSON.stringify(t)}).then(l=>l.json())},this.deleteItem=(e,t)=>{var r,n;const o=e.getHeadersInit?e.getHeadersInit():{};let s=((r=e.urls.delete)==null?void 0:r.url)??"";s=s.replace("{id}",t);let i=((n=e.urls.delete)==null?void 0:n.method)??"GET";return fetch(s,{headers:o,method:i}).then(l=>l.json())},this.getEmptyItem=()=>{}}}class ds{constructor(){this.crudOptions=new Nt,this.listenActionEvent=e=>{}}createTableModel(e,t,o=i=>{},s=i=>{}){this.crudOptions=e,this.listenActionEvent=s,e.fetchList(e).then(i=>{var r,n,l,c;if(t.rows=i,i!=null&&i.length){const a=(r=t.columnDefs)!=null&&r.length?t.columnDefs.map(w=>w.property):this.extractProperties(i[0]),d=new xe("row","multi"),u=()=>d;this.tableOptions={...new J,...t.tableOptions,hoverColumnVisible:!1,getSelectionModel:u};const p=this.calcAutoColumnWidths(i,a),f=(n=t.columnDefs)!=null&&n.length?t.columnDefs:a.map(((w,v)=>new W(w,w.toUpperCase(),new b(p[v],"px"))));if((l=e==null?void 0:e.columnWidths)!=null&&l.autoCalc)for(let w=0;w<f.length;w++){const v=f[w];v.width=new b(p[w],"px")}if(e.autoAddActionColumn){let w=new W("id","Actions",Et,new k(["ge-table-text-align-left"],["ge-table-text-align-left ge-table-actions-cell"],void 0));w.rendererMap=new k(void 0,new Bt(this,e.singleRowActions),void 0),f.push(w)}const m=0,g=e.calcFixedRightColumnCount(f.length);this.tableModel=B.buildByTypedRowsParam({rows:i,columnDefs:f,tableOptions:this.tableOptions,fixedLeftColumnCount:m,fixedRightColumnCount:g}),this.tableModel.getSelectionModel=u,this.bodyModel=(c=this.tableModel)==null?void 0:c.getBodyModel();const y=new _t(this.tableModel,this.tableOptions);o(y)}})}openDialogForCreate(){if(this.bodyModel){const e=new ze("CREATE","body",this.bodyModel,-1,-1,null);this.onActionEvent(e)}}onActionEvent(e){var t,o,s,i;if(this.listenActionEvent&&this.listenActionEvent(e),e.action==="VIEW"){let r=e.id;(t=this.crudOptions)==null||t.fetchItem(this.crudOptions,r).then(n=>(console.info(n),new Wt(n).openDialog(),n))}else if(e.action==="EDIT"){let r=e.id;const n=this.crudOptions.getIdKey()??"id";(o=this.crudOptions)==null||o.fetchItem(this.crudOptions,r).then(l=>(console.info(l),new ae(n,l).openDialog(c=>{console.info(c),this.crudOptions.updateItem(this.crudOptions,r,c)}),l))}else if(e.action==="CLONE"){let r=e.id;const n=this.crudOptions.getIdKey()??"id";(s=this.crudOptions)==null||s.fetchItem(this.crudOptions,r).then(l=>{const c=JSON.parse(JSON.stringify(l));return new ae(n,c,"Clone Item").openDialog(a=>{console.info(a),this.crudOptions.createItem(this.crudOptions,a)}),c})}else if(e.action==="CREATE"){const r=this.crudOptions.getIdKey()??"id",n=JSON.parse(JSON.stringify(this.crudOptions.getEmptyItem()));return new ae(r,n,"Create Item").openDialog(l=>{console.info(l),this.crudOptions.createItem(this.crudOptions,n)}),n}else if(e.action==="DELETE"){let r=e.id;(i=this.crudOptions)==null||i.deleteItem(this.crudOptions,r).then(n=>{var l,c,a,d,u;return(l=this.bodyModel)==null||l.filterRowsByPredict(p=>p.id!=r),(a=(c=this.tableModel)==null?void 0:c.getTableScope())==null||a.clearSelection(!0),(u=(d=this.tableModel)==null?void 0:d.getTableScope())==null||u.repaintHard(),n})}}calcAutoColumnWidths(e,t,o=t){var c;const s=t.length;if(!((c=this.crudOptions.columnWidths)!=null&&c.autoCalc))return new Array(s).fill(200);const i=e.length??0,r=new Array(s).fill(0);for(let a=0;a<i;a++)for(let d=0;d<s;d++){const u=t[d],p=this.getValueByT(e[a],u),f=(p==null?void 0:p.toString().length)||0;f>r[d]&&(r[d]=f)}if(this.crudOptions.columnWidths.takeHeaderLabelsIntoAccount)for(let a=0;a<s;a++){const d=o[a].length||0;d>r[a]&&(r[a]=d)}const n=this.crudOptions.columnWidths.minWidth,l=this.crudOptions.columnWidths.maxWidth;return r.map((a,d)=>Math.min(l,Math.max(this.crudOptions.columnWidths.charCountToWidth(a,d),n)))}getValueByT(e,t){return t.includes(".")?this.getPropertyValue(e,t.split(".")):e[t]}getPropertyValue(e,t){const o=t.shift(),s=e[o];return s&&t.length?this.getPropertyValue(s,t):s}extractProperties(e,t="",o=[]){for(const s in e)if(e.hasOwnProperty(s)){const i=t?`${t}.${s}`:s;typeof e[s]=="object"&&e[s]!==null&&!Array.isArray(e[s])?this.extractProperties(e[s],i,o):o.push(i)}return o}}class hs{constructor(e,t){this.method=e,this.url=t}}exports.AbstractAreaModel=we;exports.ActionEvent=ze;exports.ActionsCellRenderer=Bt;exports.AnyPropertyType=Ve;exports.AreaMapFactory=$o;exports.AreaModel=Go;exports.AreaModelArrayOfArrays=D;exports.AreaModelCellGroups=zo;exports.AreaModelHidden=P;exports.AreaModelObjectArray=F;exports.AreaModelObjectArrayWithColumndefs=ke;exports.AreaModelTree=oe;exports.AreaObjectMap=k;exports.ArrayPropertyType=$;exports.AutoRestoreOptions=Ft;exports.AvoidDoubleExecution=jt;exports.BooleanPropertyType=qe;exports.CellGroup=Vt;exports.CellGroupExt=Ht;exports.CellGroupExtCellRenderer=ue;exports.CellRange=M;exports.CellgroupFactory=I;exports.CheckboxBooleanPropertyCellRenderer=Uo;exports.CheckboxCellRenderer=De;exports.CheckboxColumnDef=Bo;exports.CheckboxModel=kt;exports.ChunkData=Do;exports.ColAndRowspanModel=ut;exports.CollapsedExpandedData=at;exports.ColorRgb=as;exports.ColumnDef=W;exports.ColumnDefGenerator=Yt;exports.ColumnWidths=$t;exports.ConvenienceDomService=st;exports.CopyService=te;exports.CoverGridBodyModel=Dt;exports.CoverGridFactory=Io;exports.CoverGridTableModel=Pt;exports.CrudAction=H;exports.CrudObjectEdit=ae;exports.CrudObjectView=Wt;exports.CrudOptions=Nt;exports.CrudTableModelFactory=ds;exports.CssVars=Te;exports.DateToIntlDDMMYYYYCellRenderer=Xo;exports.DateToIsoCellRenderer=Ko;exports.DateToLocaleDateCellRenderer=Jo;exports.DateToTecCellRenderer=es;exports.DefaultRowHeights=Y;exports.EleScope=ee;exports.EventAdapter=de;exports.EventCheckboxChangedHandler=Jt;exports.ExcelService=At;exports.FalseFn=Tt;exports.FocusModel=ht;exports.GeCellIndices=ft;exports.GeCssColorUtil=Z;exports.GeFilterService=jo;exports.GeKeyEvent=Wo;exports.GeModelChangeEvent=Se;exports.GeMouseEvent=ye;exports.GeScrollEvent=mt;exports.GeoData=O;exports.HeaderGroupOptions=Ce;exports.Icon=V;exports.IndexAndPx=Po;exports.InputCellRenderer=vt;exports.InputHandler=gt;exports.JsonService=ve;exports.LicenseManager=N;exports.MaleFemaleToIconCellRenderer=qo;exports.MouseHandler=rt;exports.MouseTargetData=it;exports.MultiRowsSelectionModel=ls;exports.NullPropertyType=Ke;exports.NumberCellProgressBarCellRenderer=Zo;exports.NumberCellRenderer=ts;exports.NumberPropertyType=Je;exports.ObjectPropertyType=L;exports.OsxShortcutActionIdMapping=wt;exports.PROPERTY_TYPE_KEY_ANY=Fe;exports.PROPERTY_TYPE_KEY_ARRAY=Oe;exports.PROPERTY_TYPE_KEY_BOOLEAN=be;exports.PROPERTY_TYPE_KEY_NULL=_e;exports.PROPERTY_TYPE_KEY_NUMBER=me;exports.PROPERTY_TYPE_KEY_OBJECT=X;exports.PROPERTY_TYPE_KEY_STRING=Le;exports.PROPERTY_TYPE_KEY_UNDEFINED=K;exports.Padding=he;exports.PositiveAndNegativeNumberRenderer=rs;exports.ProgressBarCellRenderer=is;exports.PropertyItem=He;exports.PropertyTypeService=Ut;exports.RenderScope=pt;exports.Renderer=Yo;exports.RequestChunk=Lt;exports.ResizeHandler=Rt;exports.SchemeGenerator=Kt;exports.SelectCellRenderer=je;exports.SelectionModel=xe;exports.SelectionService=bt;exports.ShortcutService=St;exports.SimpleArrayCellRenderer=ss;exports.SimpleDomService=Ct;exports.Size=b;exports.SortItem=Ae;exports.SortedOptions=$e;exports.StarRatingCellRenderer=os;exports.StoreStateCollapsedExpandService=ct;exports.StoreStateScrollPosService=lt;exports.StoreStateSortingService=dt;exports.StringPropertyType=Xe;exports.TableApi=nt;exports.TableCellUpdateEvent=No;exports.TableFactory=B;exports.TableModel=le;exports.TableModelAndOptions=_t;exports.TableOptions=J;exports.TableScope=Ge;exports.ThreeColorGradientArg=cs;exports.TreeCheckboxModel=Ie;exports.TreeFactory=j;exports.TreeOptions=Be;exports.TreeRow=ne;exports.TreeRowService=It;exports.TrueFalseCellRenderer=Qo;exports.TrueFn=Mt;exports.TwoColorGradientArg=Pe;exports.UNIMPORTANT_TYPES=Q;exports.UndefinedPropertyType=re;exports.UrlInfo=hs;exports.ValueInfo=Ze;exports.ValueLabel=Ot;exports.WindowsShortcutActionIdMapping=yt;exports.actionIds=ko;exports.allCenter=Vo;exports.allLeft=Oo;exports.allRight=Ho;exports.bodyCenter=_o;exports.bodyLeft=Fo;exports.bodyRight=Lo;exports.createHarmonizedShortcutByKeyboardEvent=Me;exports.debounce=Ue;exports.editInputPipeForNumber=ns;exports.entitySuffix=Re;exports.firstLetterUppercase=tt;exports.getAreaIdentByString=se;exports.getEntityName=Qe;exports.harmonizeShortcut=xt;exports.isAreaModelTree=ce;exports.isCheckboxColumnDef=ot;exports.isTreeRow=G;exports.px0=Eo;exports.px10=To;exports.px100=yo;exports.px110=bo;exports.px120=mo;exports.px130=fo;exports.px140=go;exports.px150=po;exports.px160=uo;exports.px170=ho;exports.px180=co;exports.px190=ao;exports.px20=Mo;exports.px200=Ee;exports.px210=lo;exports.px220=no;exports.px230=ro;exports.px240=io;exports.px250=so;exports.px260=oo;exports.px270=to;exports.px280=eo;exports.px290=Qt;exports.px30=Ao;exports.px300=Et;exports.px40=Ro;exports.px400=Zt;exports.px50=vo;exports.px500=qt;exports.px60=Co;exports.px70=So;exports.px80=xo;exports.px90=wo;exports.throttle=zt;exports.trimArraySuffixes=et;
461
+ `)}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=>yt.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 ds{constructor(){this.urls={list:{url:"",method:"GET"}},this.singleRowActions=[new W("VIEW","View","","","link"),new W("EDIT","Edit","","","link"),new W("CLONE","Clone","","","link"),new W("DELETE","Delete","","","link")],this.tableActions=[new W("CREATE","Create","","","button"),new W("DELETE_SELECTED","Delete Selected","","","button")],this.autoAddActionColumn=!0,this.columnWidths=new as,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=>le(e,"list","GET",{}),this.fetchItem=(e,t)=>le(e,"read","GET",{id:t}),this.updateItem=(e,t,s)=>le(e,"update","PATCH",{id:t,item:s}),this.createItem=(e,t)=>le(e,"create","POST",{item:t}),this.deleteItem=(e,t)=>le(e,"delete","DELETE",{id:t}),this.getEmptyItem=()=>{}}}function le(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=>Lo(l,r.method,i))}function Lo(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 Vo{constructor(){this.crudOptions=new ds,this.listenActionEvent=e=>{}}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 a=(r=t.columnDefs)!=null&&r.length?t.columnDefs.map(b=>b.property):this.extractProperties(i[0]),d=new Y("row","multi"),u=()=>d;this.tableOptions={...new se,...t.tableOptions,hoverColumnVisible:!1,getSelectionModel:u};const p=this.calcAutoColumnWidths(i,a),g=(n=t.columnDefs)!=null&&n.length?t.columnDefs:a.map(((b,x)=>new U(b,b.toUpperCase(),new m(p[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 m(p[b],"px")}if(e.autoAddActionColumn){let b=new U(this.getIdKey(),"Actions",Xt,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 ls(this,e.singleRowActions),void 0),g.push(b)}const w=0,f=e.calcFixedRightColumnCount(g.length);this.tableModel=G.buildByTypedRowsParam({rows:i,columnDefs:g,tableOptions:this.tableOptions,fixedLeftColumnCount:w,fixedRightColumnCount:f}),this.tableModel.getSelectionModel=u,this.bodyModel=(c=this.tableModel)==null?void 0:c.getBodyModel();const C=new ss(this.tableModel,this.tableOptions);s(C)}},i=>this.logError("loading the list",i))}openDialogForCreate(){if(this.bodyModel){const e=new ft("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"?t.fetchItem(t,i).then(r=>new cs(r).openDialog()).catch(r=>this.logError(o,r)):o==="EDIT"?t.fetchItem(t,i).then(r=>new Q(s,r).openDialog(n=>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"?t.fetchItem(t,i).then(r=>new Q(s,r,"Clone Item").openDialog(n=>this.createItem(o,n))).catch(r=>this.logError(o,r)):o==="CREATE"?new Q(s,t.getEmptyItem()??{},"Create Item").openDialog(r=>this.createItem(o,r)):o==="DELETE"&&t.deleteItem(t,i).then(()=>{var r,n,l,c,a;(r=this.bodyModel)==null||r.filterRowsByPredict(d=>!this.hasId(d,i)),(l=(n=this.tableModel)==null?void 0:n.getTableScope())==null||l.clearSelection(!0),(a=(c=this.tableModel)==null?void 0:c.getTableScope())==null||a.repaintHard()}).catch(r=>this.logError(o,r))}createItem(e,t){const s=this.crudOptions,{[this.getIdKey()]:o,...i}=t;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()})}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 a=0;a<i;a++)for(let d=0;d<o;d++){const u=t[d],p=this.getValueByT(e[a],u),g=(p==null?void 0:p.toString().length)||0;g>r[d]&&(r[d]=g)}if(this.crudOptions.columnWidths.takeHeaderLabelsIntoAccount)for(let a=0;a<o;a++){const d=s[a].length||0;d>r[a]&&(r[a]=d)}const n=this.crudOptions.columnWidths.minWidth,l=this.crudOptions.columnWidths.maxWidth;return r.map((a,d)=>Math.min(l,Math.max(this.crudOptions.columnWidths.charCountToWidth(a,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 Ho{constructor(e,t){this.method=e,this.url=t}}exports.AbstractAreaModel=Be;exports.ActionEvent=ft;exports.ActionsCellRenderer=ls;exports.AnyPropertyType=it;exports.AreaMapFactory=ho;exports.AreaModel=fo;exports.AreaModelArrayOfArrays=P;exports.AreaModelCellGroups=go;exports.AreaModelHidden=_;exports.AreaModelObjectArray=L;exports.AreaModelObjectArrayWithColumndefs=qe;exports.AreaModelTree=be;exports.AreaObjectMap=D;exports.AriaGridInfo=fe;exports.AriaIds=ue;exports.AriaTexts=we;exports.ArrayPropertyType=j;exports.AutoRestoreOptions=ts;exports.AvoidDoubleExecution=ps;exports.BooleanPropertyType=At;exports.CellGroup=rs;exports.CellGroupExt=ns;exports.CellGroupExtCellRenderer=ke;exports.CellRange=A;exports.CellgroupFactory=F;exports.CheckboxBooleanPropertyCellRenderer=yo;exports.CheckboxCellRenderer=Ze;exports.CheckboxColumnDef=co;exports.CheckboxModel=qt;exports.ChunkData=to;exports.ColAndRowspanModel=Lt;exports.CollapsedExpandedData=Ft;exports.ColorRgb=Po;exports.ColumnDef=U;exports.ColumnDefGenerator=fs;exports.ColumnWidths=as;exports.ConvenienceDomService=Re;exports.CopyService=Z;exports.CoverGridBodyModel=Qt;exports.CoverGridFactory=Qs;exports.CoverGridTableModel=es;exports.CrudAction=W;exports.CrudObjectEdit=Q;exports.CrudObjectView=cs;exports.CrudOptions=ds;exports.CrudTableModelFactory=Vo;exports.CssVars=Ke;exports.DateToIntlDDMMYYYYCellRenderer=Co;exports.DateToIsoCellRenderer=wo;exports.DateToLocaleDateCellRenderer=xo;exports.DateToTecCellRenderer=vo;exports.DefaultRowHeights=q;exports.EleScope=pe;exports.EventAdapter=Me;exports.EventCheckboxChangedHandler=ws;exports.ExcelService=Kt;exports.FalseFn=pt;exports.FocusModel=_t;exports.GeCellIndices=Bt;exports.GeCssColorUtil=ae;exports.GeFilterService=bo;exports.GeKeyEvent=uo;exports.GeModelChangeEvent=$e;exports.GeMouseEvent=Oe;exports.GeScrollEvent=$t;exports.GeoData=H;exports.HeaderGroupOptions=Ne;exports.Icon=O;exports.IndexAndPx=so;exports.InputCellRenderer=Yt;exports.InputHandler=Ot;exports.JsonService=Ge;exports.LicenseManager=K;exports.LiveAnnouncer=Ee;exports.MaleFemaleToIconCellRenderer=So;exports.MouseHandler=Tt;exports.MouseTargetData=ve;exports.MultiRowsSelectionModel=Do;exports.NullPropertyType=Ct;exports.NumberCellProgressBarCellRenderer=Ao;exports.NumberCellRenderer=Mo;exports.NumberPropertyType=St;exports.ObjectPropertyType=V;exports.OsxShortcutActionIdMapping=Wt;exports.PROPERTY_TYPE_KEY_ANY=et;exports.PROPERTY_TYPE_KEY_ARRAY=ot;exports.PROPERTY_TYPE_KEY_BOOLEAN=He;exports.PROPERTY_TYPE_KEY_NULL=tt;exports.PROPERTY_TYPE_KEY_NUMBER=Ve;exports.PROPERTY_TYPE_KEY_OBJECT=te;exports.PROPERTY_TYPE_KEY_STRING=st;exports.PROPERTY_TYPE_KEY_UNDEFINED=ee;exports.Padding=Te;exports.PositiveAndNegativeNumberRenderer=ko;exports.ProgressBarCellRenderer=Io;exports.PropertyItem=rt;exports.PropertyTypeService=gs;exports.RenderScope=Ht;exports.Renderer=mo;exports.RequestChunk=os;exports.ResizeHandler=Ut;exports.SchemeGenerator=bs;exports.SelectCellRenderer=gt;exports.SelectionModel=Y;exports.SelectionService=ge;exports.ShortcutService=zt;exports.SimpleArrayCellRenderer=To;exports.SimpleDomService=jt;exports.Size=m;exports.SortItem=Ye;exports.SortedOptions=at;exports.StarRatingCellRenderer=Eo;exports.StoreStateCollapsedExpandService=Dt;exports.StoreStateScrollPosService=kt;exports.StoreStateSortingService=Pt;exports.StringPropertyType=xt;exports.TableApi=It;exports.TableCellUpdateEvent=po;exports.TableFactory=G;exports.TableModel=Ae;exports.TableModelAndOptions=ss;exports.TableOptions=se;exports.TableScope=Ue;exports.ThreeColorGradientArg=_o;exports.TreeAriaInfo=Vt;exports.TreeCheckboxModel=me;exports.TreeFactory=J;exports.TreeOptions=lt;exports.TreeRow=Se;exports.TreeRowService=Jt;exports.TrueFalseCellRenderer=Ro;exports.TrueFn=ut;exports.TwoColorGradientArg=Qe;exports.UNIMPORTANT_TYPES=he;exports.UndefinedPropertyType=xe;exports.UrlInfo=Ho;exports.ValueInfo=Rt;exports.ValueLabel=is;exports.WindowsShortcutActionIdMapping=Nt;exports.actionIds=eo;exports.allCenter=lo;exports.allLeft=no;exports.allRight=ao;exports.bodyCenter=io;exports.bodyLeft=oo;exports.bodyRight=ro;exports.createHarmonizedShortcutByKeyboardEvent=Gt;exports.debounce=wt;exports.editInputPipeForNumber=Fo;exports.entitySuffix=ze;exports.escapeHtml=E;exports.firstLetterUppercase=Et;exports.getAreaIdentByString=ye;exports.getEntityName=vt;exports.harmonizeShortcut=ht;exports.isAreaModelTree=z;exports.isCheckboxCellRenderer=nt;exports.isCheckboxColumnDef=je;exports.isTreeRow=$;exports.px0=Js;exports.px10=Xs;exports.px100=$s;exports.px110=Bs;exports.px120=Os;exports.px130=Hs;exports.px140=Vs;exports.px150=Ls;exports.px160=_s;exports.px170=Ps;exports.px180=Ds;exports.px190=Fs;exports.px20=Ks;exports.px200=Xe;exports.px210=ks;exports.px220=Is;exports.px230=Ts;exports.px240=Es;exports.px250=Ms;exports.px260=vs;exports.px270=Rs;exports.px280=As;exports.px290=Ss;exports.px30=Us;exports.px300=Xt;exports.px40=Ys;exports.px400=xs;exports.px50=js;exports.px500=Cs;exports.px60=zs;exports.px70=Gs;exports.px80=Ws;exports.px90=Ns;exports.throttle=hs;exports.trimArraySuffixes=Mt;