smart-webcomponents-react 25.0.0 → 25.0.3

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 (253) hide show
  1. package/package.json +1 -1
  2. package/source/modules/smart.3dchart.js +2 -2
  3. package/source/modules/smart.accordion.js +2 -2
  4. package/source/modules/smart.array.js +2 -2
  5. package/source/modules/smart.barcode.js +2 -2
  6. package/source/modules/smart.breadcrumb.js +2 -2
  7. package/source/modules/smart.button.js +2 -2
  8. package/source/modules/smart.buttongroup.js +2 -2
  9. package/source/modules/smart.calendar.js +2 -2
  10. package/source/modules/smart.card.js +2 -2
  11. package/source/modules/smart.cardview.js +2 -2
  12. package/source/modules/smart.carousel.js +2 -2
  13. package/source/modules/smart.chart.js +2 -2
  14. package/source/modules/smart.checkbox.js +2 -2
  15. package/source/modules/smart.checkinput.js +2 -2
  16. package/source/modules/smart.chip.js +2 -2
  17. package/source/modules/smart.colorinput.js +2 -2
  18. package/source/modules/smart.colorpanel.js +2 -2
  19. package/source/modules/smart.colorpicker.js +2 -2
  20. package/source/modules/smart.combobox.js +2 -2
  21. package/source/modules/smart.common.js +2 -2
  22. package/source/modules/smart.countryinput.js +2 -2
  23. package/source/modules/smart.dateinput.js +2 -2
  24. package/source/modules/smart.daterangeinput.js +2 -2
  25. package/source/modules/smart.datetimepicker.js +2 -2
  26. package/source/modules/smart.dockinglayout.js +2 -2
  27. package/source/modules/smart.dropdownbutton.js +2 -2
  28. package/source/modules/smart.dropdownlist.js +2 -2
  29. package/source/modules/smart.editor.js +2 -2
  30. package/source/modules/smart.element.js +2 -2
  31. package/source/modules/smart.fileupload.js +2 -2
  32. package/source/modules/smart.form.js +2 -2
  33. package/source/modules/smart.formulaparser.js +2 -2
  34. package/source/modules/smart.ganttchart.js +3 -3
  35. package/source/modules/smart.gauge.js +2 -2
  36. package/source/modules/smart.grid.js +9 -9
  37. package/source/modules/smart.gridpanel.js +2 -2
  38. package/source/modules/smart.gridview.js +9 -9
  39. package/source/modules/smart.input.js +2 -2
  40. package/source/modules/smart.kanban.js +2 -2
  41. package/source/modules/smart.layout.js +2 -2
  42. package/source/modules/smart.led.js +2 -2
  43. package/source/modules/smart.listbox.js +2 -2
  44. package/source/modules/smart.listmenu.js +2 -2
  45. package/source/modules/smart.map.js +2 -2
  46. package/source/modules/smart.maskedtextbox.js +2 -2
  47. package/source/modules/smart.menu.js +2 -2
  48. package/source/modules/smart.multicomboinput.js +2 -2
  49. package/source/modules/smart.multiinput.js +2 -2
  50. package/source/modules/smart.multilinetextbox.js +2 -2
  51. package/source/modules/smart.multisplitbutton.js +2 -2
  52. package/source/modules/smart.numberinput.js +2 -2
  53. package/source/modules/smart.numerictextbox.js +2 -2
  54. package/source/modules/smart.pager.js +2 -2
  55. package/source/modules/smart.passwordinput.js +2 -2
  56. package/source/modules/smart.passwordtextbox.js +2 -2
  57. package/source/modules/smart.path.js +2 -2
  58. package/source/modules/smart.phoneinput.js +2 -2
  59. package/source/modules/smart.pivottable.js +2 -2
  60. package/source/modules/smart.progressbar.js +2 -2
  61. package/source/modules/smart.qrcode.js +2 -2
  62. package/source/modules/smart.querybuilder.js +2 -2
  63. package/source/modules/smart.radiobutton.js +2 -2
  64. package/source/modules/smart.rating.js +2 -2
  65. package/source/modules/smart.ribbon.js +2 -2
  66. package/source/modules/smart.router.js +2 -2
  67. package/source/modules/smart.scheduler.js +2 -2
  68. package/source/modules/smart.scrollbar.js +2 -2
  69. package/source/modules/smart.slider.js +2 -2
  70. package/source/modules/smart.sortable.js +2 -2
  71. package/source/modules/smart.splitter.js +2 -2
  72. package/source/modules/smart.switchbutton.js +2 -2
  73. package/source/modules/smart.table.js +2 -2
  74. package/source/modules/smart.tabs.js +2 -2
  75. package/source/modules/smart.tank.js +2 -2
  76. package/source/modules/smart.textarea.js +2 -2
  77. package/source/modules/smart.textbox.js +2 -2
  78. package/source/modules/smart.timeinput.js +2 -2
  79. package/source/modules/smart.timeline.js +2 -2
  80. package/source/modules/smart.timepicker.js +2 -2
  81. package/source/modules/smart.toast.js +2 -2
  82. package/source/modules/smart.tooltip.js +2 -2
  83. package/source/modules/smart.tree.js +2 -2
  84. package/source/modules/smart.validator.js +2 -2
  85. package/source/modules/smart.window.js +2 -2
  86. package/source/smart.3dchart.js +1 -1
  87. package/source/smart.accordion.js +1 -1
  88. package/source/smart.ajax.js +1 -1
  89. package/source/smart.array.js +1 -1
  90. package/source/smart.barcode.js +1 -1
  91. package/source/smart.bootstrap.js +1 -1
  92. package/source/smart.breadcrumb.js +1 -1
  93. package/source/smart.button.js +1 -1
  94. package/source/smart.buttongroup.js +1 -1
  95. package/source/smart.calendar.js +1 -1
  96. package/source/smart.card.js +1 -1
  97. package/source/smart.cardview.js +1 -1
  98. package/source/smart.carousel.js +1 -1
  99. package/source/smart.chart.annotations.js +1 -1
  100. package/source/smart.chart.api.js +1 -1
  101. package/source/smart.chart.core.js +1 -1
  102. package/source/smart.chart.js +1 -1
  103. package/source/smart.chart.rangeselector.js +1 -1
  104. package/source/smart.chart.waterfall.js +1 -1
  105. package/source/smart.checkbox.js +1 -1
  106. package/source/smart.checkinput.js +1 -1
  107. package/source/smart.chip.js +1 -1
  108. package/source/smart.colorinput.js +1 -1
  109. package/source/smart.colorpanel.js +1 -1
  110. package/source/smart.colorpicker.js +1 -1
  111. package/source/smart.combobox.js +1 -1
  112. package/source/smart.complex.js +1 -1
  113. package/source/smart.core.js +1 -1
  114. package/source/smart.countryinput.js +1 -1
  115. package/source/smart.data.js +1 -1
  116. package/source/smart.date.js +1 -1
  117. package/source/smart.dateformatpanel.js +1 -1
  118. package/source/smart.dateinput.js +1 -1
  119. package/source/smart.daterangeinput.js +1 -1
  120. package/source/smart.datetimepicker.js +1 -1
  121. package/source/smart.dockinglayout.js +1 -1
  122. package/source/smart.draw.js +1 -1
  123. package/source/smart.dropdownbutton.js +1 -1
  124. package/source/smart.dropdownlist.js +1 -1
  125. package/source/smart.editor.js +1 -1
  126. package/source/smart.element.js +1 -1
  127. package/source/smart.elements.js +9 -9
  128. package/source/smart.export.js +1 -1
  129. package/source/smart.fileupload.js +1 -1
  130. package/source/smart.filter.js +1 -1
  131. package/source/smart.filterbuilder.js +1 -1
  132. package/source/smart.filterpanel.js +1 -1
  133. package/source/smart.form.js +1 -1
  134. package/source/smart.format.js +1 -1
  135. package/source/smart.formulaparser.js +1 -1
  136. package/source/smart.ganttchart.js +2 -2
  137. package/source/smart.gauge.js +1 -1
  138. package/source/smart.grid.cell.js +2 -2
  139. package/source/smart.grid.chart.js +1 -1
  140. package/source/smart.grid.column.js +2 -2
  141. package/source/smart.grid.core.js +2 -2
  142. package/source/smart.grid.dialog.js +1 -1
  143. package/source/smart.grid.edit.js +1 -1
  144. package/source/smart.grid.export.js +1 -1
  145. package/source/smart.grid.filter.js +2 -2
  146. package/source/smart.grid.group.js +1 -1
  147. package/source/smart.grid.js +1 -1
  148. package/source/smart.grid.menu.js +2 -2
  149. package/source/smart.grid.pager.js +1 -1
  150. package/source/smart.grid.reorder.js +1 -1
  151. package/source/smart.grid.resize.js +1 -1
  152. package/source/smart.grid.row.js +1 -1
  153. package/source/smart.grid.select.js +2 -2
  154. package/source/smart.grid.sort.js +1 -1
  155. package/source/smart.grid.toolbar.js +2 -2
  156. package/source/smart.grid.tree.js +1 -1
  157. package/source/smart.grid.view.js +1 -1
  158. package/source/smart.gridpanel.js +1 -1
  159. package/source/smart.input.js +1 -1
  160. package/source/smart.kanban.js +1 -1
  161. package/source/smart.layout.js +1 -1
  162. package/source/smart.led.js +1 -1
  163. package/source/smart.listbox.js +1 -1
  164. package/source/smart.listmenu.js +1 -1
  165. package/source/smart.map.js +1 -1
  166. package/source/smart.maskedtextbox.js +1 -1
  167. package/source/smart.math.js +1 -1
  168. package/source/smart.menu.js +1 -1
  169. package/source/smart.multicomboinput.js +1 -1
  170. package/source/smart.multiinput.js +1 -1
  171. package/source/smart.multilinetextbox.js +1 -1
  172. package/source/smart.multisplitbutton.js +1 -1
  173. package/source/smart.numberformatpanel.js +1 -1
  174. package/source/smart.numberinput.js +1 -1
  175. package/source/smart.numeric.js +1 -1
  176. package/source/smart.numerictextbox.js +1 -1
  177. package/source/smart.pager.js +1 -1
  178. package/source/smart.passwordinput.js +1 -1
  179. package/source/smart.passwordtextbox.js +1 -1
  180. package/source/smart.path.js +1 -1
  181. package/source/smart.phoneinput.js +1 -1
  182. package/source/smart.pivottable.js +1 -1
  183. package/source/smart.powerbutton.js +1 -1
  184. package/source/smart.progressbar.js +1 -1
  185. package/source/smart.qrcode.js +1 -1
  186. package/source/smart.radiobutton.js +1 -1
  187. package/source/smart.rating.js +1 -1
  188. package/source/smart.ribbon.js +1 -1
  189. package/source/smart.router.js +1 -1
  190. package/source/smart.scheduler.js +1 -1
  191. package/source/smart.scrollbar.js +1 -1
  192. package/source/smart.slider.js +1 -1
  193. package/source/smart.sortable.js +1 -1
  194. package/source/smart.sparkline.js +1 -1
  195. package/source/smart.splitter.js +1 -1
  196. package/source/smart.switchbutton.js +1 -1
  197. package/source/smart.table.js +1 -1
  198. package/source/smart.tabs.js +1 -1
  199. package/source/smart.tank.js +1 -1
  200. package/source/smart.textarea.js +1 -1
  201. package/source/smart.textbox.js +1 -1
  202. package/source/smart.tickintervalhandler.js +1 -1
  203. package/source/smart.timeinput.js +1 -1
  204. package/source/smart.timeline.js +1 -1
  205. package/source/smart.timepicker.js +1 -1
  206. package/source/smart.toast.js +1 -1
  207. package/source/smart.tooltip.js +1 -1
  208. package/source/smart.tree.js +1 -1
  209. package/source/smart.validationpanel.js +1 -1
  210. package/source/smart.validator.js +1 -1
  211. package/source/smart.window.js +1 -1
  212. package/source/styles/bootstrap/dark/smart.bootstrap.blue.css +3373 -3373
  213. package/source/styles/bootstrap/dark/smart.bootstrap.css +3373 -3373
  214. package/source/styles/bootstrap/dark/smart.bootstrap.cyan.css +3373 -3373
  215. package/source/styles/bootstrap/dark/smart.bootstrap.green.css +3373 -3373
  216. package/source/styles/bootstrap/dark/smart.bootstrap.indigo.css +3373 -3373
  217. package/source/styles/bootstrap/dark/smart.bootstrap.orange.css +3373 -3373
  218. package/source/styles/bootstrap/dark/smart.bootstrap.pink.css +3373 -3373
  219. package/source/styles/bootstrap/dark/smart.bootstrap.purple.css +3373 -3373
  220. package/source/styles/bootstrap/dark/smart.bootstrap.red.css +3373 -3373
  221. package/source/styles/bootstrap/dark/smart.bootstrap.teal.css +3373 -3373
  222. package/source/styles/bootstrap/dark/smart.bootstrap.turquoise.css +3373 -3373
  223. package/source/styles/bootstrap/light/smart.bootstrap.blue.css +3373 -3373
  224. package/source/styles/bootstrap/light/smart.bootstrap.css +3373 -3373
  225. package/source/styles/bootstrap/light/smart.bootstrap.cyan.css +3373 -3373
  226. package/source/styles/bootstrap/light/smart.bootstrap.green.css +3373 -3373
  227. package/source/styles/bootstrap/light/smart.bootstrap.indigo.css +3373 -3373
  228. package/source/styles/bootstrap/light/smart.bootstrap.orange.css +3373 -3373
  229. package/source/styles/bootstrap/light/smart.bootstrap.pink.css +3373 -3373
  230. package/source/styles/bootstrap/light/smart.bootstrap.purple.css +3373 -3373
  231. package/source/styles/bootstrap/light/smart.bootstrap.red.css +3373 -3373
  232. package/source/styles/bootstrap/light/smart.bootstrap.teal.css +3373 -3373
  233. package/source/styles/bootstrap/light/smart.bootstrap.turquoise.css +3373 -3373
  234. package/source/styles/bootstrap/smart.bootstrap.blue.css +234 -215
  235. package/source/styles/bootstrap/smart.bootstrap.css +277 -286
  236. package/source/styles/bootstrap/smart.bootstrap.cyan.css +234 -215
  237. package/source/styles/bootstrap/smart.bootstrap.green.css +234 -215
  238. package/source/styles/bootstrap/smart.bootstrap.indigo.css +234 -215
  239. package/source/styles/bootstrap/smart.bootstrap.orange.css +234 -215
  240. package/source/styles/bootstrap/smart.bootstrap.pink.css +237 -215
  241. package/source/styles/bootstrap/smart.bootstrap.purple.css +237 -215
  242. package/source/styles/bootstrap/smart.bootstrap.red.css +234 -215
  243. package/source/styles/bootstrap/smart.bootstrap.teal.css +234 -215
  244. package/source/styles/bootstrap/smart.bootstrap.turquoise.css +234 -215
  245. package/source/styles/components/smart.datetimeformatpanel.css +1 -1
  246. package/source/styles/components/smart.dropdownbutton.css +1 -1
  247. package/source/styles/components/smart.grid.css +1 -1
  248. package/source/styles/components/smart.ribbon.css +1 -1
  249. package/source/styles/default/scss/smart.dropdownbutton.scss +21 -20
  250. package/source/styles/default/scss/smart.grid.scss +195 -116
  251. package/source/styles/default/smart.dropdownbutton.css +5 -3
  252. package/source/styles/default/smart.grid.css +41 -18
  253. package/source/styles/smart.default.css +2 -2
@@ -1,5 +1,5 @@
1
1
 
2
- /* Smart UI v25.0.0 (2025-11-26)
2
+ /* Smart UI v25.0.1 (2025-11-26)
3
3
  Copyright (c) 2011-2024 jQWidgets.
4
4
  License: https://htmlelements.com/license/ */ //
5
5
 
@@ -1425,7 +1425,7 @@ Smart.Utilities.Assign("ConditionalFormatter",class{constructor(e){const t=this;
1425
1425
  /***/ 9719:
1426
1426
  /***/ (() => {
1427
1427
 
1428
- (()=>{Smart.Utilities.Assign("Grid.Cell",class{constructor(e,t){const l=this;if(l.row=e,l.column=t,l.grid=e.grid,l.rowSpan=1,l.colSpan=1,l.value=void 0,l.fontSize=null,l.fontWeight=null,l.fontFamily=null,l.fontStyle=null,l.color=null,l.background=null,l.textDecoration=null,l.tooltip=null,l.align=null,l.verticalAlign=null,l.readonly=!1,l.oldValue=void 0,l._updating=!1,l.styleChanged=!0,l.editor=null,l.template=null,l.isEditing=!1,l.canNotify=!0,l.selected=!1,l.focused=!1,l.error=!1,l.format=null,l.formula=null,e._style){const a=e._style;t.autoGenerated||(l.color=void 0!==a.color?a.color:null,l.background=void 0!==a.background?a.background:null,l.fontFamily=void 0!==a.fontFamily?a.fontFamily:null,l.fontSize=void 0!==a.fontSize?a.fontSize:null,l.fontStyle=void 0!==a.fontStyle?a.fontStyle:null,l.textDecoration=void 0!==a.textDecoration?a.textDecoration:null,l.fontWeight=void 0!==a.fontWeight?a.fontWeight:null),a[t.dataField]&&["color","background","textDecoration","fontStyle","fontFamily","fontWeight","fontSize"].forEach((e=>{a[t.dataField][e]&&(l[e]=a[t.dataField][e],l._styleChanged=!0)}))}if(l.grid&&l.grid.formulas){let a=e.data[t.dataField];t.formula&&(l.formula=l._parseFormula(t.formula)),a&&(""+a).startsWith("=")&&(l.formula=l._parseFormula(""+a)),l._formula=t.formula}return new Proxy(l,{deleteProperty:function(e,t){return delete e[t],!0},get:function(a,i){if("value"===i){const a=l.column.displayField?l.row.data[l.column.displayField]:l.row.data[l.column.dataField];if(l.grid&&l.grid.formulas&&(l.formula||t.formula)){const a=l.grid._formulaParser;if(a){if(l.grid&&l.grid.formulas&&l._formula!==t.formula){let a=e.data[t.dataField];t.formula&&(l.formula=l._parseFormula(t.formula)),a&&(""+a).startsWith("=")&&(l.formula=l._parseFormula(""+a)),l._formula=t.formula}return a.parse(l.formula.slice(1))}}return a}if("editor"===i||"template"===i)return a[i]||l.column[i];if("focused"===i){if(l.grid.selection.allowCellSelection&&l.grid._selection.focusedCell&&l.grid._selection.focusedCell.id===l.row.id&&l.grid._selection.focusedCell.dataField===l.column.dataField)return!(l.grid&&l.grid.dataSource.virtualDataSource&&!l.grid.dataSource.id)||l.grid._selection.focusedCell.id===l.row.index;if(l.grid.selection.allowRowSelection&&l.grid._selection.focusedCell&&l.grid._selection.focusedCell.id===l.row.id&&l.grid._selection.focusedCell.dataField===l.column.dataField)return!(l.grid&&l.grid.dataSource.virtualDataSource&&!l.grid.dataSource.id)||l.grid._selection.focusedCell.id===l.row.index;const e=l.parent();return!!(e&&l.grid.selection.allowCellSelection&&l.grid._selection.focusedCell&&l.grid._selection.focusedCell.id===e.row.id&&l.grid._selection.focusedCell.dataField===e.column.dataField)}if("selected"===i)return!0===l.row.getProperty("selected")||(!0===l.column.getProperty("selected")||!!l.grid._selection.cells["row"+l.row.id]&&l.grid._selection.cells["row"+l.row.id][l.column.dataField]);if("modifiedValue"===i){l.grid._cellsUpdatedValues||(l.grid._cellsUpdatedValues=[]);const e=l.grid._cellsUpdatedValues[l.row.id+"_"+l.column.dataField];return void 0!==e?e:a.value}return a[i]},set:function(e,a,i){const r=this.get(e,a);if(r===i)return!0;if(e[a]=i,"element"===a||"isEditing"===a||"oldValue"===a||"_updating"===a||"notifyFn"===a||a.startsWith("_")||"canNotify"===a)return!0;if("error"===a)return!0;if("focused"===a&&(l.grid._selection.focusedCell={id:l.row.id,dataField:l.column.dataField,value:l.value,index:l.row.index}),"colSpan"!==a&&"rowSpan"!==a||i>=0&&-1===l.grid._cellsMerge.indexOf(l)&&l.grid._cellsMerge.push(l),"row"===a||"column"===a||"grid"===a||"styleChanged"===a||"formula"===a)return"formula"===a&&(l.formula=l._parseFormula(l.formula)),!0;if("background"!==a&&"fontSize"!==a&&"fontWeight"!==a&&"fontFamily"!==a&&"textDecoration"!==a&&"color"!==a&&"fontStyle"!==a||(l.grid._cellStyles["row"+l.row.id]=!0,l.grid._cellStyles.length++,l._styleChanged=!0),"value"===a){void 0===l.oldValue&&(l.oldValue=r),null==i&&delete l._formula;(()=>{if(l.grid.dataSource.boundSource.canNotify=!1,null===i&&(l.column.allowNull||(i="number"===l.column.dataType||"int"===l.column.dataType||"float"===l.column.dataType||"integer"===l.column.dataType?0:"date"===l.column.dataType?new Date:"boolean"!==l.column.dataType&&"bool"!==t.dataType&&"")),void 0===i&&(i=null),null!==i&&void 0!==i.label&&void 0!==i.value)l.row.data[l.column.displayField]=i.label,l.row.data[l.column.dataField]=i.value;else if(l.column.valueField&&(l.row.data[l.column.valueField]=i),l.row.data[l.column.dataField]=i,l.column.displayField!==l.column.dataField&&"object"!=typeof i)if(l.column._dataSource){let e=i;for(let t=0;t<l.column._dataSource.length;t++)if(l.column._dataSource[t].value===i){e=l.column._dataSource[t].label;break}l.row.data[l.column.displayField]=e}else l.row.data[l.column.displayField]=i;const e=l.grid.dataSource.dataItemById[l.row.id];if(e){const t=e.$.index;if(l.grid.dataSource)if(null!==i&&i.label&&i.value&&l.column.displayField!==l.column.dataField)l.grid._sortedColumns&&l.grid._sortedColumns.length>0?(e[l.column.dataField]=i.value,e[l.column.displayField]=i.label):(l.grid.dataSource.boundSource[t][l.column.dataField]=i.value,l.grid.dataSource.boundSource[t][l.column.displayField]=i.label);else if(i!==l.grid.dataSource.boundSource[t][l.column.dataField])if(l.grid._sortedColumns&&l.grid._sortedColumns.length>0)e[l.column.dataField]=i;else if(l.grid.dataSource.boundHierarchy&&l.grid.dataSource.childrenDataField){const t=(e=>function e(t,a){for(let i=0;i<t.length;i++){const r=t[i];if(r.id===a)return r;if(r[l.grid.dataSource.childrenDataField]&&r[l.grid.dataSource.childrenDataField].length>0){const t=e(r[l.grid.dataSource.childrenDataField],a);if(t)return t}}return null}(l.grid.dataSource.boundSource,e))(e.$.id);t&&(t[l.column.dataField]=i),e[l.column.dataField]=i}else l.grid.dataSource.boundSource[t][l.column.dataField]=i}l.grid.dataSource.boundSource.canNotify=!0,l.grid.onCellValueChanged&&i!==r&&l.grid.onCellValueChanged({id:l.row.id,dataField:l.column.dataField,value:i,oldValue:r})})()}return"selected"===a?(l.grid._selection.cells["row"+l.row.id]&&(delete l.grid._selection.cells["row"+l.row.id][l.column.dataField],1===Object.getOwnPropertyNames(l.grid._selection.cells["row"+l.row.id]).length&&delete l.grid._selection.cells["row"+l.row.id]),l.grid._selection.cells["column"+l.column.dataField]&&(delete l.grid._selection.cells["column"+l.column.dataField][l.row.id],1===Object.getOwnPropertyNames(l.grid._selection.cells["column"+l.column.dataField]).length&&delete l.grid._selection.cells["column"+l.column.dataField]),i&&(l.grid._selection.cells["row"+l.row.id]||(l.grid._selection.cells["row"+l.row.id]=[]),l.grid._selection.cells["column"+l.column.dataField]||(l.grid._selection.cells["column"+l.column.dataField]=[]),l.grid._selection.cells["row"+l.row.id][l.column.dataField]=!0,l.grid._selection.cells["column"+l.column.dataField][l.row.id]=!0),l.grid._recycle(!1,!0,!1),l.propertyChanged&&l.propertyChanged(name.substring(1),r),!0):!(!l._updating&&l.canNotify)||(l.grid._recycle(),!l.row.canNotify||(l.propertyChanged&&l.propertyChanged(name.substring(1),r),!0))}})}_parseFormula(e){const t=this.row;if(!e)return e;return"string"!=typeof e&&(e=""+e),!1===e.startsWith("=")&&(e="="+e),e=function(e,t){return e.replace(/COL\(([^)]+)\)/g,((e,l)=>`${l}${t}`))}(e,1+t.index)}setStyle(e){this.setProperties(e)}_setStyle(e){const t=this;if(t._styleChanged){if(!t.grid._cellStyles.length)return;let l="";const a={background:"background",color:"color",fontSize:"font-size",fontFamily:"font-family",fontWeight:"font-weight",fontStyle:"font-style",textDecoration:"text-decoration"},i=e=>{const i=t[e];if(""===i||null===i)return;const r=a[e];l+=`${r}: ${i};`},r=["background","color","fontSize","fontFamily","fontWeight","fontStyle","textDecoration"];for(let e=0;e<r.length;e++)i(r[e]);e.getAttribute("style")!==l&&(""===l?e.removeAttribute("style"):e.setAttribute("style",l)),""!==e.style.paddingBottom&&(e.style.paddingBottom=""),t._styleChanged=!1}t.grid&&!t.grid.appearance.showSelectionOnTop||t.selected&&(t.background||t.color)&&(e.style.background="",e.style.color="")}getFormattedValue(e,t){const l=this;if(null==e||""===e)return e;if(l.column.placeholder&&e===l.column.placeholder)return e;if(!t)return""+e;if(l.column._cellsCachedValues||(l.column._cellsCachedValues=[]),l.column._cellsCachedValues[""+e+t+l.column.grid.locale])return l.column._cellsCachedValues[""+e+t+l.column.grid.locale];if("date"===l.column.dataType||"datetime"===l.column.dataType||"time"===l.column.dataType){if("dateRangeInput"===l.column.editor.template){if(Array.isArray(e)){const a=l.formatDate(e[0],t)+" - "+l.formatDate(e[1],t);return l.column._cellsCachedValues[""+e+t+l.column.grid.locale]=a,a}{const a=l.formatDate(e,t);return l.column._cellsCachedValues[""+e+t+l.column.grid.locale]=a,a}}let a=l.formatDate(e,t);return"1/1/0001 12:00 AM"===a&&(a=""),l.column._cellsCachedValues[""+e+t+l.column.grid.locale]=a,a}if("int"===l.column.dataType||"int64"===l.column.dataType||"float"===l.column.dataType||"number"===l.column.dataType){let a=l.formatNumber(e,t);return"NaN"===a&&(a=""),l.column._cellsCachedValues[""+e+t+l.column.grid.locale]=a,a}if("any"===l.column.dataType||"string"===l.column.dataType&&t&&t.length){let a=!1;const i=""+e;if((i.indexOf("/")>=0||i.indexOf("-")>=0||i.indexOf(":")>=0)&&(t.indexOf("d")>=0&&t.indexOf("M")>=0&&(a=!0),(t.indexOf("d")>=0||t.indexOf("M")>=0||t.indexOf("y")>=0||t.indexOf("h")>=0||t.indexOf("H")>=0||t.indexOf("m")>=0)&&(a=!0)),a){let a=l.formatDate(e,t);return"1/1/0001 12:00 AM"===a&&(a=""),l.column._cellsCachedValues[""+e+t+l.column.grid.locale]=a,a}{"string"==typeof e&&(e=parseFloat(e));let a=l.formatNumber(e,t);return"NaN"===a&&(a=""),l.column._cellsCachedValues[""+e+t+l.column.grid.locale]=a,a}}return e}formatDate(e,t){if(!Smart.Utilities.DateTime)return e;const l=this,a=l.grid;if(l.column.formatSettings.Intl&&l.column.formatSettings.Intl.DateTimeFormat){return new Intl.DateTimeFormat(this.grid.locale,l.column.formatSettings.Intl.DateTimeFormat).format(e)}!t&&l.column.formatSettings.dateFormat&&(t=l.column.formatSettings.dateFormat);try{const l=new Smart.Utilities.DateTime(e);l.calendar.locale=a.locale,a.messages[a.locale]&&a.messages[a.locale].calendar&&(a.messages[a.locale].calendar.months&&(l.calendar.months=a.messages[a.locale].calendar.months),a.messages[a.locale].calendar.days&&(l.calendar.days=a.messages[a.locale].calendar.days),void 0!==a.messages[a.locale].calendar.firstDay&&(l.calendar.firstDay=a.messages[a.locale].calendar.firstDay),void 0!==a.messages[a.locale].calendar.eras&&(l.calendar.eras=a.messages[a.locale].calendar.eras),void 0!==a.messages[a.locale].calendar.AM&&(l.calendar.AM=a.messages[a.locale].calendar.AM),void 0!==a.messages[a.locale].calendar.PM&&(l.calendar.PM=a.messages[a.locale].calendar.PM),void 0!==a.messages[a.locale].calendar["/"]&&(l.calendar["/"]=a.messages[a.locale].calendar["/"]),void 0!==a.messages[a.locale].calendar[":"]&&(l.calendar[":"]=a.messages[a.locale].calendar[":"]),l.calendar.today=a.messages[a.locale].today);let i=l.toString(t);return i!==a.messages[a.locale].today||a.showTodayDateAsString||(l.showTodayDateAsString=!1,i=l.toString(t),delete l.showTodayDateAsString),i}catch(t){return e}}formatNumber(e,t){if(!Smart.Utilities.NumberRenderer)return e;const l=this,a=l.grid;if(l.column.formatSettings.Intl&&l.column.formatSettings.Intl.NumberFormat){if(l.column.formatSettings.Intl.NumberFormat.currency&&Smart.Utilities.CurrencyFormatter){const a=t.NumberFormat&&void 0!==t.NumberFormat.maximumFractionDigits?t.NumberFormat.maximumFractionDigits:2,i=(new Smart.Utilities.CurrencyFormatter).format(e,{decimalPlaces:a,currency:l.column.formatSettings.Intl.NumberFormat.currency});return"accounting"===l.column.formatSettings.Intl.NumberFormat.currency.currencySign&&e<0?"("+i.replace("-","")+")":i}if(l.column.formatSettings.Intl.NumberFormat.locale){return new Intl.NumberFormat(l.column.formatSettings.Intl.NumberFormat.locale,t.NumberFormat).format(e)}{const a=new Intl.NumberFormat(this.grid.locale,t.NumberFormat).format(e);if("percent"===l.column.formatSettings.Intl.NumberFormat.style){const t=void 0!==l.column.formatSettings.Intl.NumberFormat.minimumFractionDigits?l.column.formatSettings.Intl.NumberFormat.minimumFractionDigits:2;return new Intl.NumberFormat(this.grid.locale,{style:"decimal",minimumFractionDigits:t}).format(100*e)+" %"}return"squaremeter"===l.column.formatSettings.Intl.NumberFormat.type?a+" m²":"cubicmeter"===l.column.formatSettings.Intl.NumberFormat.type?a+" m³":a}}const i=new Smart.Utilities.NumberRenderer;if(i.localizationObject){const e=l.column.formatSettings,t=a.messages[a.locale]?a.messages[a.locale].calendar:{};e.decimalPlaces&&(i.localizationObject.decimalPlaces=e.decimalPlaces),(e.decimalSeparator||t.decimalSeparator)&&(i.localizationObject.decimalSeparator=e.decimalSeparator||t.decimalSeparator,i.localizationObject.decimalseparator=i.localizationObject.decimalSeparator),(e.thousandsSeparator||t.thousandsSeparator)&&(i.localizationObject.thousandsSeparator=e.thousandsSeparator||t.thousandsSeparator,i.localizationObject.thousandsseparator=i.localizationObject.thousandsSeparator),i.localizationObject.currencysymbol=t.currencySymbol,i.localizationObject.currencysymbolposition=t.currencySymbolPosition,e.prefix&&(i.localizationObject.currencysymbol=e.prefix),e.sufix&&(i.localizationObject.currencysymbol=e.sufix,i.localizationObject.currencysymbolposition="after")}const r=i.formatNumber(e,t);return void 0===r?e:e<0&&l.column.formatSettings.negativeWithBrackets?"("+r+")":r}refresh(){const e=this;if(e.element){const t=e.element.firstChild;e._setStyle(t)}}autoWrap(){const e=this;e.element&&e.element._autoWrap()}setProperties(e){const t=this;t._updating=!0;for(let l in e)t[l]=e[l];t._updating=!1,t.grid._recycle()}createElement(){const e=document.createElement("smart-grid-cell");return e.setAttribute("role","gridcell"),this.element=e,e._initialize(this),e}render(){this.element&&this.element._render()}parent(e){const t=this,l=t.row,a=t.column.dataField,i=t.grid;if(!i._cellsMerge.length)return null;if(t.__parentCells&&void 0!==t.__parentCells["row"+l.id+"_column_"+a])return t.__parentCells["row"+l.id+"_column_"+a];let r=i.getVisibleRows();i.paging.enabled&&"page"===i.selection.selectAllMode&&(r=r.slice(i.paging.pageIndex*i.paging.pageSize,(i.paging.pageIndex+1)*i.paging.pageSize)),t.__parentCells||(t.__parentCells=[]);for(let n=0;n<i._cellsMerge.length;n++){const s=i._cellsMerge[n];let o=[],d=[];if(o.push(s.row),s.rowspan>1){const e=r.indexOf(s.row);if(e>=0)for(let t=e;t<e+s.rowSpan;t++)r[t]&&-1===o.indexOf(r[t])&&o.push(r[t])}if(d.push(s.column.dataField),s.colspan>1){const e=i.columns.indexOf(i.columnByDataField[s.column.dataField]);for(let t=e;t<e+s.colSpan;t++)i.columns[t]&&-1===d.indexOf(i.columns[t].dataField)&&d.push(i.columns[t].dataField)}if(o.indexOf(l)>=0&&d.indexOf(a)>=0){if(e){const e={cell:s.row.getCell(s.column.dataField),rows:o,columns:d,row:s.row,column:s.column,endRow:o[o.length-1],endColumn:i.columnByDataField[d[d.length-1]]};return t.__parentCells["row"+l.id+"_column_"+a]=e,e}const r=s.row.getCell(s.column.dataField);return t.__parentCells["row"+l.id+"_column_"+a]=r,r}}return t.__parentCells["row"+l.id+"_column_"+a]=null,null}}),Smart("smart-grid-cell",class extends Smart.BaseElement{static get properties(){return{}}get hasStyleObserver(){return!1}get enableShadowDOM(){return!1}addThemeClass(){}addDefaultClass(){}get isUtilityElement(){return!0}_refresh(){const e=this;e.innerHTML="",e._initialize(e.cell)}_createToggleButton(e,t){const l=this,a=document.createElement("div"),i=document.createElement("button"),r=document.createElement("div"),n=document.createElement("div"),s=document.createElement("div"),o=document.createElement("span"),d=t.grid;t.row.expanded?i.setAttribute("toggled",""):i.removeAttribute("toggled",""),i.tabIndex=-1,l.toggleButton=i,l.checkbox=s,e.appendChild(a),e.appendChild(n),n.setAttribute("content",""),a.setAttribute("indent",""),r.setAttribute("label",""),i.setAttribute("toggle-button",""),i.setAttribute("role","presentation"),i.setAttribute("aria-label","Expand/Collapse Row"),s.setAttribute("checkbox",""),s.setAttribute("role","checkbox"),s.setAttribute("aria-checked","false"),s.setAttribute("aria-label","Select Row"),l.setAttribute("has-toggle-button",""),n.appendChild(i),n.appendChild(s),o.classList.add("smart-input"),s.appendChild(o),d.checkBoxes.visible?o.classList.remove("smart-hidden"):o.classList.add("smart-hidden"),n.appendChild(r),l.content=r}_initialize(e){const t=this,l=document.createElement("div"),a=e.column,i=e.grid;t._properties=[],t.cell=e,t.appendChild(l);let r=!1;if(a&&a._treeColumn&&i.dataSource.boundHierarchy&&(r=!0,e.row.filterRow&&(r=!1),!i.grouping.enabled&&i.dataSource.groupBy&&i.dataSource.groupBy.length>0&&(r=!1),i.grouping.enabled&&i.dataSource.groupBy&&0===i.dataSource.groupBy.length&&(r=!1)),r)return t._createToggleButton(l,e),void(t.isRendered=!0);{const e=document.createElement("div");l.appendChild(e)}t.content=l,t.isRendered=!0}_renderCommands(){const e=this,t=e.cell.grid;if(t.__cellsCommandTemplate)return e.firstChild.innerHTML=t.__cellsCommandTemplate,void t._updateCommandColumnCommandsVisibility(e.firstChild,e.cell.row);const l=t._getCommandColumnCommandsTemplate();e.firstChild.innerHTML=l,t._updateCommandColumnCommandsVisibility(e.firstChild,e.cell.row),t.__cellsCommandTemplate=l}_renderGroupCell(){const e=this,t=e.cell.grid,l=e.cell.column,a=e.cell.row;[...e.attributes].forEach((t=>e.removeAttribute(t.name))),e.setAttribute("group",""),e.setAttribute("role","gridcell");const i=l===t._firstRenderedColumn;e.style.width!==l.computedWidth+"px"&&(e.style.width=l.computedWidth+"px"),i||(t.rightToLeft?e.style.right!==l.left+"px"&&(e.style.right=l.left+"px"):e.style.left!==l.left+"px"&&(e.style.left=l.left+"px")),e.classList.contains("smart-hidden")&&e.classList.remove("smart-hidden"),l===t._firstRenderedColumn||a.summaryRow||e.classList.add("smart-hidden"),l.autoGenerated&&(e.style.width="0px");let r=a.label;const n=function(e,t,l){if(!t)return[];for(let a=0;a<t.length;a++){const i=t[a];i.$&&!1===i.$.filtered||(void 0!==i[e]&&l.push(i),i.summaryRow||(i.children||i.data&&i.data.children)&&n(e,i.children,l))}return l};let s="";if(void 0!==a.label){let o="",d=[];if(t.grouping.summaryRow.visible){let r=[];const s={},c=i?l.summary.length>0?l.summary:["count"]:l.summary;c.length&&(r=n(l.dataField,a.summaryRow?a.parent.data.children:a.data.children,[])),s[l.dataField]=c;const m=c.length>0?t.dataSource.summarize([s],r):null;if(m)for(let r=0;r<c.length;r++){const n=c[r];r>0&&(o+=", ");let u=m[l.dataField][n];const p=l.cellsFormat;if(void 0!==u){if(p&&(u=e.cell.getFormattedValue(u,p)),i){const i=t.columnByDataField[a.groupDataField];if(i){s[i.dataField]=c,m[i.dataField]=m[l.dataField],u=m[i.dataField][n];const t=i.cellsFormat;t&&(u=e.cell.getFormattedValue(u,t))}}o+=t.localize(n,{value:u}),m[l.dataField]&&m[l.dataField][n]&&d.push(m[l.dataField][n])}}}if(t.dataSource.virtualDataSourceOnExpand&&(o=""),i){const l=t.columnByDataField[a.groupDataField],i=l?l.label:"";if("advanced"===t.grouping.renderMode){if(a.summaryRow)r="<div header group-advanced><span group></span><span value></span>",o&&(r+="<div summary>",r+=o,r+="</div>");else{let e=a.label?a.label:t.localize("blankSummary");a.label||"taskStatus"!==a.groupDataField||(e="");let n="";if(l&&l.editor&&l.editor.dataSource){const t=l.editor.dataSource.find((t=>t.value===e||t.label===e));t&&t.color?(n=`--smart-primary: ${t.color}`,t.label&&(e=t.label)):t&&t.label&&(e=t.label)}if(a.label||"taskStatus"!==a.groupDataField||(e=t.localize("uncategorized")),"object"==typeof e&&l.cellsFormat){const t=a.getCell(l.dataField);e=t.getFormattedValue(e,l.cellsFormat)}else if("object"==typeof e&&e&&e instanceof Date){const t=a.getCell(l.dataField);e=t.getFormattedValue(e,"d")}const s=t.editing.addNewRow.visible?'<span add-row class="smart-grid-icon smart-icon-plus-circled show"></span>':"";if(r=`<div style="${n}" header group-advanced><span group>${s}${i}: </span><span value>${e}</span>`,e=""+e,e&&e.indexOf(",")>=0){let t="";r=`<div style="display: flex;" header group-advanced><span group>${s}${i}: </span>`;let a=e.split(",");for(let e=0;e<a.length;e++){let i=a[e].trim();if(l&&l.editor&&l.editor.dataSource){const e=l.editor.dataSource.find((e=>e.value===i||e.label===i));e&&e.color?(n=`--smart-primary: ${e.color}`,e.label&&(i=e.label)):e&&e.label&&(i=e.label),t+=`<span style="${n}" value>${i}</span>`}}r+=t}o&&t.grouping.summaryRow.inline&&(r+="<span summary>",r+=""+o,r+="</span>")}r+="</div>",e.classList.add("smart-grid-column-border-collapse")}else if("compact"===t.grouping.renderMode){if(a.summaryRow)r="<div header><span group></span><span value></span>",o&&(r+="<div summary>",r+=o,r+="</div>");else{let e=a.label;if(l.displayField!==l.dataField&&a.data.data&&(e=a.data.data[l.displayField]),"object"==typeof e&&l.cellsFormat){e=a.getCell(l.dataField).getFormattedValue(e,l.cellsFormat)}r="<div header><span group>"+i+": </span><span value>"+e+"</span>",o&&t.grouping.summaryRow.inline&&(r+="<span summary>",r+=" ("+d+")",r+="</span>")}r+="</div>",e.classList.add("smart-grid-column-border-collapse")}else if("basic"===t.grouping.renderMode){if(r=a.label,l.displayField!==l.dataField&&a.data.data&&(r=a.data.data[l.displayField]),"object"==typeof r&&l.cellsFormat){r=a.getCell(l.dataField).getFormattedValue(r,l.cellsFormat)}a.summaryRow?o&&(r+="<div summary>",r+=o,r+="</div>"):o&&t.grouping.summaryRow.inline&&(r+="<span summary>",r+=" ("+d+")",r+="</span>"),e.classList.add("smart-grid-column-border-collapse")}else if("multipleColumns"===t.grouping.renderMode){if(r=a.label,"object"==typeof r&&l.cellsFormat){r=a.getCell(l.dataField).getFormattedValue(r,l.cellsFormat)}a.summaryRow?o&&(r+="<div summary>",r+=o,r+="</div>"):o&&t.grouping.summaryRow.inline&&(r+="<span summary>",r+=" ("+d+")",r+="</span>"),e.classList.add("smart-grid-column-border-collapse")}e.setAttribute("has-toggle-button","")}else e.removeAttribute("has-toggle-button",""),r=o;s=o}let o=e.firstChild;if(t.dataSource.boundHierarchy&&i){o.children.length<=1&&(e.innerHTML="<div></div>",o=e.firstChild,e._createToggleButton(o,e.cell),o=e.firstChild);const n=o.children[0],s=o.children[1].children[0],d=o.children[1].children[1].firstChild,c=o.children[1].children[2];n.setAttribute("indent",""),a.checked?d.setAttribute("checked",""):!1===a.checked?d.removeAttribute("checked"):null===a.checked&&d.setAttribute("checked","indeterminate"),a.leaf?s.classList.add("smart-visibility-hidden"):(s.classList.remove("smart-visibility-hidden"),a.expanded?s.setAttribute("toggled",""):s.removeAttribute("toggled",""));let m="";if(!l._treeColumn||a.summaryRow||a.filterRow?e.toggleButton.classList.add("smart-hidden"):e.toggleButton.classList.remove("smart-hidden"),l._treeColumn)if(t.grouping.enabled){let e=a.level-1;if(1+e===0)m+="",n.classList.add("smart-hidden");else{if("multipleColumns"===t.grouping.renderMode){let l=0;for(let a=0;a<t.columns.length;a++)a<1+e&&(l+=t.columns[a].computedWidth);m+='<div style="width: '+l+'px;"></div>'}else m+='<div style="width: '+(1+e)*t.grouping.groupIndent+'px;"></div>';n.classList.remove("smart-hidden")}}else for(let e=0;e<a.level;e++)m+="<div class='smart-indent'></div>";if(void 0===a.label||a.summaryRow||a.filterRow?s.classList.add("smart-hidden"):(s.classList.remove("smart-hidden"),s.style.marginLeft=""),n.innerHTML=m,c.innerHTML=r,i&&t.grouping.formatFunction){const i={row:a,column:l,groupDataField:a.groupDataField,cell:e.cell,value:r,data:a.data,template:null},n=t.grouping.formatFunction(i);n&&(i.value=n),i.value!==r?c.innerHTML=i.value:i.template&&(c.innerHTML=i.template)}t.appearance.showTooltips?c.setAttribute("title",a.label?a.label:t._unescapeString(r)):c.hasAttribute("title")&&c.removeAttribute("title")}else void 0!==a.label&&t.grouping.enabled&&!i&&(o.innerHTML=r,l.summary.length&&t.grouping.summaryRow.inline&&r&&e.classList.remove("smart-hidden"));void 0!==a.label&&t.grouping.enabled&&i&&!l._treeColumn&&l.summary.length&&t.grouping.summaryRow.inline&&r&&(t.rightToLeft||e.style.left!==l.left+"px"&&(e.style.left=l.left+"px"),e.removeAttribute("has-toggle-button",""),r=s,o.innerHTML=r);let d="smart-label";e.style.zIndex="";const c=t.editing.addNewColumn.visible&&t._addNewColumn?t._addNewColumn.width-1:0;if(i){const l=t.columnByDataField[a.groupDataField];l&&(l.cellsAlign&&(d+=" align-"+l.cellsAlign),l.cellsVerticalAlign&&(d+=" align-"+l.cellsVerticalAlign)),e.setAttribute("header",""),a.summaryRow||(e.style.width="calc(100% - "+c+"px)"),void 0!==a.label&&(e.style.zIndex=11)}else l===t._firstRenderedColumn&&(e.style.zIndex=4),e.setAttribute("header",""),a.summaryRow||(e.style.width="calc(100% - "+c+"px)"),l.summary.length&&t.grouping.summaryRow.inline&&r&&(e.style.width=l.computedWidth+"px",e.style.zIndex=11,e.classList.add("smart-grid-column-border-collapse"),l.cellsAlign&&(d+=" align-"+l.cellsAlign),l.cellsVerticalAlign&&(d+=" align-"+l.cellsVerticalAlign));if(a.summaryRow&&(e.setAttribute("header",""),e.classList.add("smart-grid-column-border-collapse"),l.cellsAlign&&(d+=" align-"+l.cellsAlign),l.cellsVerticalAlign&&(d+=" align-"+l.cellsVerticalAlign)),o.className!==d&&(o.className=d),l.formatFunction){const t={row:a,column:l,cell:e.cell,value:null,template:null,data:null,group:{value:r,template:null}},i=l.formatFunction(t);if(i&&(t.group.value=i),t.group.value!==r)if(l._treeColumn){o.children[1].children[2].innerHTML=t.group.value}else o.innerHTML=t.group.value;null!==t.group.template&&(o.innerHTML=t.group.template)}}_renderFilterCell(e){const t=this,l=t.cell.grid,a=t.cell.column;let i;const r=(e,t)=>{l._handleFilterMenuClick(e,t)};l._filterInfo||(l._filterInfo={},l._filterInfo.stringConditions=[{icon:"smart-icon-contains",command:r,value:"CONTAINS",label:l.localize("CONTAINS")},{icon:"smart-icon-does-not-contain",command:r,value:"DOES_NOT_CONTAIN",label:l.localize("DOES_NOT_CONTAIN")},{icon:"smart-icon-starts-with",command:r,value:"STARTS_WITH",label:l.localize("STARTS_WITH")},{icon:"smart-icon-ends-with",command:r,value:"ENDS_WITH",label:l.localize("ENDS_WITH")},{icon:"smart-icon-equals",command:r,value:"EQUAL",label:l.localize("EQUAL")},{icon:"smart-icon-delete",command:r,value:"CLEAR_FILTER",label:l.localize("CLEAR_FILTER")}],l._filterInfo.numberAndDateConditions=[{icon:"smart-icon-equals",command:r,value:"EQUAL",label:l.localize("EQUAL")},{icon:"smart-icon-not-equal",command:r,value:"NOT_EQUAL",label:l.localize("NOT_EQUAL")},{icon:"smart-icon-less-than",command:r,value:"LESS_THAN",label:l.localize("LESS_THAN")},{icon:"smart-icon-less-than-equal",command:r,value:"LESS_THAN_OR_EQUAL",label:l.localize("LESS_THAN_OR_EQUAL")},{icon:"smart-icon-greater-than",command:r,value:"GREATER_THAN",label:l.localize("GREATER_THAN")},{icon:"smart-icon-greater-than-equal",command:r,value:"GREATER_THAN_OR_EQUAL",label:l.localize("GREATER_THAN_OR_EQUAL")},{icon:"smart-icon-between",command:r,value:"RANGE",label:l.localize("RANGE")},{icon:"smart-icon-delete",command:r,value:"CLEAR_FILTER",label:l.localize("CLEAR_FILTER")}]);const n=l._getFilterDataType(a);i="string"===n?l._filterInfo.stringConditions:l._filterInfo.numberAndDateConditions;let s="smart-icon-search";if(a._filterInfo||(a._filterInfo={condition:""}),a.filterEditor&&a.filterEditor.condition&&(a._filterInfo.condition=a.filterEditor.condition),a.filterEditor&&a.filterEditor.value&&(a._filterInfo.value=a.filterEditor.value),a._filterInfo.dataSource=i,null===a._filterInfo.condition||void 0===a._filterInfo.condition)a._filterInfo.condition="",s="smart-icon-search";else switch(a._filterInfo.condition.toLowerCase()){case"equal":s="smart-icon-equals";break;case"starts_with":s="smart-icon-starts-with";break;case"ends_with":s="smart-icon-ends-with";break;case"not_equal":s="smart-icon-not-equal";break;case"less_than":s="smart-icon-less-than";break;case"less_than_or_equal":s="smart-icon-less-than-or-equal";break;case"greater_than":s="smart-icon-greater-than";break;case"greater_than_or_equal":s="smart-icon-greater-than-or-equal";break;case"contains":s="smart-icon-contains";break;case"does_not_contain":s="smart-icon-does-not-contain";break;case"range":s="smart-icon-between";break;default:s="smart-icon-search"}let o=`<div class="smart-filter-input-type"><i class="smart-grid-icon ${s} show"></i></div> `;if("string"===n)o+=`<input class="smart-filter-input-value" data-type="${n}" /> `,e.innerHTML=o;else if("date"===a.dataType){const i=new Smart.Utilities.DateTime;o+=`<input placeholder = "${i.expandFormat(i.calendar,a.cellsFormat||"d")}" class="smart-filter-input-value" data-type="${a.dataType}"/><div class="smart-filter-input-type"><i class="smart-grid-icon smart-icon-calendar show"></i></div>`,e.innerHTML=o,e.lastElementChild.onpointerdown=function(){l._handleFilterCalendarCellClick(t.cell)}}else if("number"===a.dataType)o+='<div class="smart-grid-cell-editor smart-filter-input-value smart-grid-number-input-cell-editor"><input class="smart-input" type="number"><div tabindex="-1" class="nav"><div tabindex="-1" class="up"></div><div tabindex="-1" class="down"></div></div></div>',e.innerHTML=o,l._handleFilterNumberCellEditor(this.cell,e);else if("boolean"===a.dataType||"bool"===a.dataType){const i=document.createElement("div");i.classList.add("smart-input"),i.classList.add("smart-grid-check-box-cell-editor"),i.classList.add("smart-filter-input-value"),e.tabIndex=0,e.style.outline="none",t.setAttribute("template","checkBox"),i.setAttribute("checked","indeterminate"),a._filterInfo&&a._filterInfo.value?i.setAttribute("checked",""):a._filterInfo&&!1===a._filterInfo.value&&i.removeAttribute("checked"),o=i.outerHTML,e.innerHTML=o,e.classList.add("align-center"),e.classList.add("smart-label"),e.onfocus=()=>{e.setAttribute("focus","")},e.onblur=()=>{e.removeAttribute("focus","")},e.onclick=e=>{e.target.classList.contains("smart-input")&&l._handleFilterCellCheckBoxClick(this.cell)}}const d=e.querySelector("input");if(d&&(e.firstElementChild.onpointerdown=function(){l._handleFilterCellIconClick(this.cell)}.bind(this),d.onpaste=function(e){setTimeout((()=>{l._handleFilterCellKeyUp(this.cell,e)}))}.bind(this),d.onfocus=function(){l._handleFilterCellFocus(this.cell)}.bind(this),d.onblur=function(){l._handleFilterCellBlur(this.cell)}.bind(this),d.onkeyup=function(e){l._handleFilterCellKeyUp(this.cell,e)}.bind(this),d.onkeydown=function(e){l._handleFilterCellKeyDown(this.cell,e)}.bind(this)),e.classList.add("smart-filter-input-container"),a._filterInfo.input=d,a._filterInfo.cell=t.cell,a._filterInfo.editor=e,a._filterInfo.value&&d&&(d.value=a._filterInfo.value,"date"===a.dataType&&(d.value=t.cell.getFormattedValue(a._filterInfo.value,a.cellsFormat))),e.removeAttribute("disabled"),a.allowFilter||(d.disabled=!0,e.setAttribute("disabled","")),a.filterEditor||"multi"===a.filterMenuMode)if("multi"===a.filterEditor.template||"multi"===a.filterMenuMode){const t=document.createElement("div");t.className="smart-arrow-down",t.style.fontSize="16px",t.style.marginRight="4px",t.style.marginLeft="4px",t.style.alignSelf="center",t.style.cursor="pointer",t.onclick=function(e){l._handleFilterCellExcelIconClick(this.cell)}.bind(this),e.appendChild(t)}else if(a.filterEditor.template){const t=a.filterEditor.template,i=document.createElement("div");if(a.filterTemplate instanceof HTMLTemplateElement)i.appendChild(t.content.cloneNode(!0));else if(t instanceof HTMLElement)i.appendChild(t);else if("checkList"===t){const e=document.createElement("smart-drop-down-list");e.className="smart-filter-check-list",e.selectionMode="checkBox",e.filterable=!0,e.style.setProperty("--smart-border-top-left-radius","0px"),e.style.setProperty("--smart-border-top-right-radius","0px"),e.style.setProperty("--smart-border-bottom-left-radius","0px"),e.style.setProperty("--smart-border-bottom-right-radius","0px"),e.style.width="100%",e.style.height="100%",e.dropDownAppendTo="body",e.dropDownButtonPosition="right",e.dataSource=a.filterEditor.dataSource||l.getColumnUniqueValues(a.dataField),e.whenRendered((()=>{e.checkAll()})),a.filterEditor.displayMember&&(e.displayMember=a.filterEditor.displayMember),a.filterEditor.valueMember&&(e.valueMember=a.filterEditor.valueMember),e.onchange=()=>{const t=this.cell.column;if(e.selectedValues.length===e.dataSource.length)return t._filterInfo.value=null,e.close(),delete t._filterInfo.excelValues,void l.removeFilter(t.dataField);t._filterInfo.excelValues=e.selectedValues,l._suspendFilterRowRefresh=!0,l._handleFilterCellValue(this.cell),l._suspendFilterRowRefresh=!1},i.appendChild(e)}else if("list"===t||"dropDownList"===t||"select"===t){const e=document.createElement("smart-input");e.className="smart-filter-list",e.readonly=!0,e.style.setProperty("--smart-border-top-left-radius","0px"),e.style.setProperty("--smart-border-top-right-radius","0px"),e.style.setProperty("--smart-border-bottom-left-radius","0px"),e.style.setProperty("--smart-border-bottom-right-radius","0px"),e.style.width="100%",e.style.height="100%",e.dropDownButtonPosition="right",a.filterEditor.displayMember&&(e.displayMember=a.filterEditor.displayMember),a.filterEditor.valueMember&&(e.valueMember=a.filterEditor.valueMember);let t=a.filterEditor.dataSource||l.getColumnUniqueValues(a.dataField);t=[{label:"-",value:null}].concat(t),e.dataSource=t,e.onchange=()=>{this.cell.column._filterInfo.value=e.selectedValue,l._suspendFilterRowRefresh=!0,l._handleFilterCellValue(this.cell),l._suspendFilterRowRefresh=!1},i.appendChild(e)}else i.innerHTML=t;e.innerHTML="",e.appendChild(i),i.style.height="100%",i.style.width="100%";const r=e.querySelector("input");r&&(r.onfocus=()=>{e.setAttribute("focus","")},r.onblur=()=>{e.removeAttribute("focus","")}),a.filterEditor.onInit&&a.filterEditor.onInit(a,i)}else void 0!==a.filterEditor.min&&(d.min=a.filterEditor.min),void 0!==a.filterEditor.max&&(d.max=a.filterEditor.max),void 0!==a.filterEditor.minLength&&(d.minLength=a.filterEditor.minLength),void 0!==a.filterEditor.maxLength&&(d.maxLength=a.filterEditor.maxLength),void 0!==a.filterEditor.placeholder&&(d.placeholder=a.filterEditor.placeholder),void 0!==a.filterEditor.value&&(d.value=a.filterEditor.value),void 0!==a.filterEditor.step&&(d.step=a.filterEditor.step),void 0!==a.filterEditor.disabled&&(d.disabled=a.filterEditor.disabled),void 0!==a.filterEditor.condition&&(a._filterInfo.condition=a.filterEditor.condition),a.filterEditor.onInit&&a.filterEditor.onInit(a,e)}_setTemplate(t,l,a){const i=this,r=i.cell.grid,n=i.cell.column;r._cellCachedValues||(r._cellCachedValues=[]);const s=()=>!!r._cellCachedValues[n.dataField+"_"+t]&&(a.innerHTML!==r._cellCachedValues[n.dataField+"_"+t]&&(a.innerHTML=r._cellCachedValues[n.dataField+"_"+t]),i.cell._setStyle(a),i.setAttribute("template",i.cell.template),!0);let o=null;switch((!r.editing.enabled||!n.allowEdit||i.cell.readonly||"none"===r.editing.action||r.editing.enabled&&r.editing.commandColumn.visible&&r.editing.editRow!==i.cell.row)&&i.setAttribute("readonly",""),n.placeholder&&t===n.placeholder&&(t=""),l){case"checkBox":case"radioButton":case"switchButton":if(a.firstElementChild&&a.firstElementChild.classList&&a.firstElementChild.classList.contains("smart-input")){if(o=a.firstElementChild,t?o.setAttribute("checked",""):null===t?o.setAttribute("checked","indeterminate"):o.removeAttribute("checked"),i.setAttribute("template",i.cell.template),o.removeAttribute("icon"),o.removeAttribute("color"),o.style.setProperty("--smart-check-template-color","var(--smart-primary)"),i.cell.column.templateSettings&&i.cell.column.templateSettings.icon){if("ok-squared"!==i.cell.column.templateSettings.icon)o.setAttribute("icon",i.cell.column.templateSettings.icon);else{const e=new Smart.Color(i.cell.column.templateSettings.color).getInvertedColor();o.style.setProperty("--smart-check-template-forecolor",e)}o.style.setProperty("--smart-check-template-color",i.cell.column.templateSettings.color),o.setAttribute("color","")}return void i.cell._setStyle(a)}if(o=document.createElement("span"),o.className="smart-input",t?o.setAttribute("checked",""):null===t?o.setAttribute("checked","indeterminate"):o.removeAttribute("checked"),i.setAttribute("template",i.cell.template),o.removeAttribute("icon"),o.removeAttribute("color"),o.style.setProperty("--smart-check-template-color","var(--smart-primary)"),i.cell.column.templateSettings&&i.cell.column.templateSettings.icon){if("ok-squared"!==i.cell.column.templateSettings.icon)o.setAttribute("icon",i.cell.column.templateSettings.icon);else{const e=new Smart.Color(i.cell.column.templateSettings.color).getInvertedColor();o.style.setProperty("--smart-check-template-forecolor",e)}o.setAttribute("color",""),o.style.setProperty("--smart-check-template-color",i.cell.column.templateSettings.color)}a.innerHTML="",a.appendChild(o),i.cell._setStyle(a);break;case"checklist":if(t&&t.indexOf("[")>=0&&(t=JSON.parse(t)),a.firstElementChild&&a.firstElementChild.hasAttribute("value")){const e=a.firstElementChild.getAttribute("value");if(t&&e===t.length)return i.cell._setStyle(a),void i.setAttribute("template",i.cell.template)}if(t&&Array.isArray(t)&&t.length>0){const e=t.filter((e=>e.completed)).length,l=["#D50000","#F4511E","#F6BF26","#33B679"],a=e+"/"+t.length;let i=l[0];e===t.length?i=l[3]:e>0&&e<t.length&&(i=l[2]),t=`<div style="display: grid; grid-template-columns: 25px auto"><div style="margin-left: 4px; align-self: center; border-radius: 50%; display: flex; align-content: center; background: ${i}; width:16px; height: 16px;"><span title="${a}" style="align-content: center; font-size: 13px; color: white;" class="smart-grid-icon show smart-icon-check"></span></div>${a}</span></div>`}else t="";o=document.createElement("span"),o.innerHTML=t,i.setAttribute("template",i.cell.template),o.setAttribute("value",t.length);break;case"createdBy":case"updatedBy":{const e=i.cell.row;let t=null,s=null;if(t="createdBy"===l?e.createdBy:e.updatedBy,e.history&&e.history.length&&(t="createdBy"===l?e.history[0].user:e.history[e.history.length-1].user),a.firstElementChild&&a.firstElementChild.hasAttribute("user-id")){if(t===parseInt(a.firstElementChild.getAttribute("user-id")))return i.cell._setStyle(a),void i.setAttribute("template",i.cell.template);if(null!=t&&-1!==t){s=r.users.find((e=>e.id===t));const e=s;if(e){const l=a.firstElementChild.firstElementChild&&a.firstElementChild.firstElementChild.firstElementChild?a.firstElementChild.firstElementChild.firstElementChild.firstElementChild:null;if(l){a.firstElementChild.setAttribute("user-id",t);const i="string"==typeof e?e:e.name,r="string"==typeof e?null:e.color;if(("string"==typeof e?null:e.image)&&(l.firstElementChild.style.backgroundImage=`url('${e.image}')`),r){const e=new Smart.Color(r).getInvertedColor();l.setAttribute("data-item",i),l.setAttribute("title",i),l.setAttribute("backgroundColor",r),l.setAttribute("color",e),l.lastElementChild.textContent=i}else l.setAttribute("data-item",i),l.setAttribute("title",i),l.setAttribute("backgroundColor",""),l.setAttribute("color","");return}}}}const d=document.createElement("div");d.classList.add("smart-multi-combo-input"),d.setAttribute("data-field",n.dataField),d.setAttribute("row-id",i.cell.row.id),d.style.width="100%",d.style.paddingRight="6px";let c='<div class="smart-flex smart-flex-auto smart-tokens-layout">';if(null!=t&&-1!==t){s=r.users.find((e=>e.id===t));const e=s;if(e){const t="string"==typeof e?e:e.name,l="string"==typeof e?null:e.color,a="string"==typeof e?null:e.image,i=document.createElement("span");if(a&&(i.style.backgroundImage=`url('${e.image}')`,i.className="smart-drop-down-list-selection-image"),l){c+='<span title="'+t+'" data-item="'+t+'" style="background: '+l+"; color: "+new Smart.Color(l).getInvertedColor()+'; overflow: visible;" class="smart-truncate smart-token">'+i.outerHTML+"<span class='smart-drop-down-list-selection-label' role=\"presentation\">"+t+"</span></span>"}else c+='<span title="'+t+'" data-item="'+t+'" class="smart-truncate smart-token">'+i.outerHTML+"<span class='smart-drop-down-list-selection-label' role=\"presentation\">"+t+"</span></span>"}else c=""}d.innerHTML=c+"</div>";const m=document.createElement("div");m.classList.add("smart-multi-combo-input-container","tokens","smart-flex","smart-flex-auto"),d.classList.add("smart-flex-auto"),m.appendChild(d),o=m,o.setAttribute("user-id",t),i.setAttribute("template",i.cell.template);break}case"collaborator":case"tags":{let e=[];if("number"==typeof t&&(t=""+t),""===t||null===t||"uncategorized"===t){let e=`\n <div class="smart-multi-combo-input-container tokens smart-flex smart-flex-auto" data-field="${n.dataField}" row-id="${i.cell.row.id}"> \n <div class="smart-multi-combo-input" data-field="${n.dataField}" row-id="${i.cell.row.id}" class="tokens smart-flex smart-flex-auto">\n <div class=" smart-flex-auto smart-flex"></div>\n </div>\n </div>\n `;return a.innerHTML!==e&&(a.firstElementChild&&a.firstElementChild.firstElementChild&&a.firstElementChild.firstElementChild.firstElementChild&&""===a.firstElementChild.firstElementChild.firstElementChild.textContent?(a.firstElementChild.setAttribute("row-id",i.cell.row.id),a.firstElementChild.firstElementChild.setAttribute("row-id",i.cell.row.id)):a.innerHTML=e),n.placeholder&&a.firstElementChild&&a.firstElementChild.firstElementChild&&(a.firstElementChild.firstElementChild.innerHTML=n.placeholder),i.cell._setStyle(a),void i.setAttribute("template",i.cell.template)}if(s())return;if(null!==t&&(e=Array.isArray(t)?e.map((e=>e.trim())):t.indexOf("{")>=0||"[]"===t?JSON.parse(t):t.split(",").map((e=>e.trim()))),a.firstElementChild&&a.firstElementChild.hasAttribute("value")&&n.editor._items&&n.editor._items[t]){if(a.firstElementChild.getAttribute("value")===t){i.cell._setStyle(a),i.setAttribute("template",i.cell.template);const e=n.editor.dots;if(a.firstElementChild&&a.firstElementChild.firstElementChild&&a.firstElementChild.firstElementChild.firstElementChild){if(a.firstElementChild.firstElementChild.firstElementChild.classList.remove("smart-flex-wrap"),a.firstElementChild.firstElementChild.firstElementChild.firstElementChild){const t=a.firstElementChild.firstElementChild.firstElementChild.firstElementChild.firstElementChild;t&&(e?t.classList.add("dots"):t.classList.remove("dots"))}if(i.cell.row.height>45){a.firstElementChild.firstElementChild.firstElementChild.classList.add("smart-flex-wrap");const e=a.firstElementChild.firstElementChild.firstElementChild;if(e.children&&e.children.length>1)for(let t=0;t<e.children.length;t++)e.children[t].style.maxWidth&&(e.children[t].style.maxWidth="")}else if(r.layout.rowHeight<=45&&i.cell.row.height<=45){const e=a.firstElementChild.firstElementChild.firstElementChild;if(e.children&&e.children.length>1){const t=parseInt(n.computedWidth/e.children.length)-5;let l=0;for(let t=0;t<e.children.length;t++)l+=e.children[t].textContent.length,e.children[t].style.maxWidth="";if(14*l*.52+20*e.children.length>n.computedWidth)for(let l=0;l<e.children.length;l++)e.children[l].style.maxWidth=t+"px"}}}return}}const d=document.createElement("div");d.classList.add("smart-multi-combo-input"),d.setAttribute("data-field",n.dataField),d.setAttribute("row-id",i.cell.row.id);let c='<div class="smart-tokens-layout smart-flex smart-flex-auto">';if(e.length>2&&i.cell.row.height>45){c='<div style="max-width: '+(n.computedWidth-10+"px")+'" class="smart-flex smart-flex-wrap">'}let m=0;if(t)for(let t=0;t<e.length;t++){const a=e[t];let i=null;if("collaborator"===l||n.editor&&n.editor.collaborator)i=r.users.find((e=>{if("string"==typeof a||"number"==typeof a){if(e.value===a||parseInt(e.value)===parseInt(a))return e;if(e.id===a||parseInt(e.id)===parseInt(a))return e}else if("object"==typeof a&&e.value===a.value)return e})),i&&(i.label=i.name);else{const e=n.editor.dataSource||n.options;if(e)if("string"==typeof a&&n.editor._items&&n.editor._items[a])i=n.editor._items[a];else{for(let t=0;t<e.length;t++){const l=e[t];if(void 0!==l.value&&void 0!==a&&void 0!==a.value&&l.value===a.value){i=l,n.editor._items||(n.editor._items=[]),n.editor._items[a]=l;break}if(void 0===l.value&&l===a||void 0!==l.value&&""+l.value===a){i=l,n.editor._items||(n.editor._items=[]),n.editor._items[a]=l;break}}n.editor.allowItemsAdd&&!i&&a&&(i=a)}else i=a}if(!i)continue;const s="string"==typeof i?i:i.label,o="string"==typeof i?null:i.color,d="string"==typeof i?null:i.image;if(""===s)continue;const u=document.createElement("span");d&&(u.style.backgroundImage=`url('${i.image}')`,u.className="smart-drop-down-list-selection-image");const p="smart-truncate";if(o&&n.editor.colorItems){const e=new Smart.Color(o).getInvertedColor(),t=n.editor.dots?" dots":"";c+='<span title="'+s+'" data-item="'+s+'" style="background: '+o+"; color: "+e+"; --smart-primary-color: "+e+'; overflow: visible;" class="'+p+' smart-token">'+u.outerHTML+"<span class='smart-drop-down-list-selection-label"+t+'\' role="presentation">'+s+"</span>"}else c+='<span title="'+s+'" data-item="'+s+'" class="'+p+' smart-token">'+u.outerHTML+"<span class='smart-drop-down-list-selection-label' role=\"presentation\">"+s+"</span>";m+=s.length;if(n.editor.dataSource||n.options){if(n.editor.singleSelect){c+="</span>";break}c+='<span class=\'smart-hidden smart-drop-down-list-unselect-button\' role="button" aria-label="Unselect"></span></span>'}else c+="</span>"}d.innerHTML=c+"</div>";const u=14*m*.52,p=d.firstElementChild;if(r.layout.rowHeight<=45&&i.cell.row.height<=45&&d&&p.children.length>1&&u+20*p.children.length>n.computedWidth){const e=parseInt(n.computedWidth/p.children.length)-5;for(let t=0;t<p.children.length;t++)p.children[t].style.maxWidth=e+"px"}if(d.style.width="100%",d.style.paddingRight="6px",d.onpointerdown=t=>{if(!r._mobile)if(t.target&&"#text"!==t.target.nodeName&&t.target.classList.contains("smart-drop-down-list-unselect-button")){let l=t.target.parentNode.getAttribute("data-item");const a=n.editor.dataSource||n.options;if(a&&"string"==typeof l&&a)for(let e=0;e<a.length;e++)a[e].label===l&&(l=a[e],l.value&&(l=l.value));if(e[0]&&e[0].label){const a=e.map((e=>e.value)).indexOf(l);if(a>=0){e.splice(a,1);const l=i.cell.value,s=e.join(", ");r.setCellValue(i.cell.row.id,n.dataField,JSON.stringify(e)),r.onCellUpdate&&r.onCellUpdate([i.cell],[l],[s],(function(){}),i),t.preventDefault(),t.stopPropagation()}}else if(e.indexOf(l)>=0){e.splice(e.indexOf(l),1);const a=i.cell.value,s=e.join(", ");r.setCellValue(i.cell.row.id,n.dataField,s),r.onCellUpdate&&r.onCellUpdate([i.cell],[a],[s],(function(){}),i),t.preventDefault(),t.stopPropagation()}}else if(t.target.classList.contains("smart-drop-down-list-selection-label")){if(r.editing.enabled&&r.editing.allowListOpenOnContentClick){const e=t.target.closest(".smart-multi-combo-input"),l=e.getAttribute("data-field"),a=e.getAttribute("row-id");r.beginEdit(a,l)}t.stopPropagation(),t.preventDefault()}},!n.cellsWrap&&n.allowEdit&&r.editing.enabled&&"card"!==r.view){let t=n.editor.dataSource&&n.editor.dataSource.length;n.editor.collaborator&&(t=r.users&&r.users.length);const l=document.createElement("div");t&&l.classList.add("items"),l.classList.add("smart-multi-combo-input-container","tokens","smart-flex","smart-flex-auto"),d.classList.add("smart-flex-auto"),d.classList.remove("smart-flex-wrap"),e.length>2&&r.layout.rowHeight>45&&(d.classList.add("smart-flex-wrap"),d.style.maxWidth=n.computedWidth-10+"px"),r.rightToLeft&&(d.style.direction="rtl"),l.appendChild(d),o=l}else if(n.cellsWrap||n.allowEdit){const t=document.createElement("div");t.classList.add("smart-multi-combo-input-container","tokens","smart-flex","smart-flex-auto"),d.classList.add("smart-flex-auto"),d.classList.remove("smart-flex-wrap"),e.length>2&&r.layout.rowHeight>45&&(d.classList.add("smart-flex-wrap"),d.style.maxWidth=n.computedWidth-10+"px"),r.rightToLeft&&(d.style.direction="rtl"),t.appendChild(d),o=t}else d.classList.add("smart-flex-auto","smart-flex","tokens"),o=d;i.setAttribute("template",i.cell.template),o.setAttribute("value",t);break}case"dropdownGrid":case"dropDownList":case"dropdownlist":case"list":{const e=document.createElement("div");if(a.firstElementChild&&a.firstElementChild.hasAttribute("value")){if(a.firstElementChild.getAttribute("value")===t&&!i.cell.column._isDirty)return i.cell._setStyle(a),void i.setAttribute("template",i.cell.template)}if("dropdownGrid"!==i.cell.template){if(s()){const e=a.querySelector(".smart-arrow-down");return void(e&&(e.onpointerdown=e=>{if(!r._mobile){if(r.editing.enabled){const t=e.target.closest("smart-grid-cell"),l=e.target.closest("smart-grid-row"),a=t.getAttribute("data-field"),n=l.getAttribute("data-id");if(r.beginEdit(n,a),i.cell.column.editor&&i.cell.column.editor.instance){const e=i.cell.column.editor,t=e.instance.element;!e.autoOpen&&t.open?t.open():!e.autoOpen&&t.firstElementChild&&t.firstElementChild.open&&setTimeout((()=>{t.firstElementChild.open()}),250)}}e.stopPropagation(),e.preventDefault()}}))}}if("dropdownGrid"===i.cell.template){const l=i.cell.column.templateSettings.dataFields;let a=i.cell.editor.dataSource?i.cell.editor.dataSource[t]:"";if(i.cell.column.relationId&&i.cell.column.relationField&&i.cell.column._isDirty&&(!i.cell.column.editor.dataSource||i.cell.column.editor.dataSource&&0===i.cell.column.editor.dataSource.length)){const e=r._getRelationData(i.cell.column.relationId,i.cell.column.relationField,i.cell.column.relationCascadingFields),l=r._getRelationColumns(i.cell.column.relationId);e&&(a=e[t]),i.cell.column.editor.columns=l,i.cell.column.editor.dataSource=e}if(e.classList.add("smart-flex","center"),e.style.alignItems="center",e.onmouseenter=()=>{e.querySelectorAll("i").forEach((e=>e.classList.add("show")))},e.onmouseleave=()=>{e.querySelectorAll("i").forEach((e=>e.classList.remove("show")))},a){e.style.justifyContent="space-between";let t="";for(let e=0;e<l.length;e++){const i=a[l[e]];i&&(t+='<span style="" class="smart-truncate smart-token smart-flex middle center ">'+i+"</span>")}e.innerHTML=t}else e.style.justifyContent="",e.innerHTML='<span class="smart-truncate"></span>'}else"card"===r.view?e.textContent=t:e.innerHTML='<span class="smart-truncate">'+t+"</span>";if(n.allowEdit&&r.editing.enabled&&"card"!==r.view){const t=document.createElement("span");t.classList.add("smart-arrow-down","arrowbtn");const l=document.createElement("div");l.classList.add("smart-multi-combo-input-container","tokens","smart-flex","smart-flex-auto"),e.classList.add("smart-flex-auto","smart-multi-combo-input"),l.appendChild(e),l.appendChild(t),l.classList.add(i.cell.template.toLowerCase()),o=l,t.onpointerdown=e=>{if(!r._mobile){if(r.editing.enabled){const t=e.target.closest("smart-grid-cell"),l=e.target.closest("smart-grid-row"),a=t.getAttribute("data-field"),n=l.getAttribute("data-id");if(r.beginEdit(n,a),i.cell.column.editor&&i.cell.column.editor.instance){const e=i.cell.column.editor,t=e.instance.element;!e.autoOpen&&t.open?t.open():!e.autoOpen&&t.firstElementChild&&t.firstElementChild.open&&setTimeout((()=>{t.firstElementChild.open()}),250)}}e.stopPropagation(),e.preventDefault()}}}else o=e;i.setAttribute("template",i.cell.template.toLowerCase()),o.setAttribute("value",t);break}case"password":a.innerHTML=t?'<span class="smart-truncate">'+t.replace(/./g,"*")+"</span>":"",i.setAttribute("template",i.cell.template);break;case"richText":if(a.innerHTML=t?'<div class="textwrap" style="height: 100%; padding-top: 5px; padding-left: 5px;">'+r._unescapeString(t)+"</div>":"",r.layout.autoWrap&&i.cell.row.height>40&&1===i.cell.colSpan&&"string"===n.dataType){null==t&&(t="");if(14*t.length*.52>n.computedWidth){const e=parseInt(i.cell.row.height/20);a.firstElementChild.style["-webkit-line-clamp"]=e}}a.onpointerdown=e=>{if(!r._mobile&&r.editing.enabled){const t=r.offset(a);if(e.pageX>t.left+a.offsetWidth-20){const t=e.target.closest("smart-grid-cell"),l=e.target.closest("smart-grid-row"),a=t.getAttribute("data-field"),i=l.getAttribute("data-id");delete r._beginEditKey,r.beginEdit(i,a)}}},o=a.firstElementChild,i.setAttribute("template",i.cell.template);break;case"color":a.innerHTML=`<span style="left: calc(50% - 12px); top: calc(50% - 12px); position: absolute; border-radius: 50%; width: 24px; height: 24px; display: block; background:${t};"></span>`,i.setAttribute("template",i.cell.template);break;case"autoNumber":o=document.createElement("span"),o.innerHTML=1+i.cell.row.visibleIndex,i.setAttribute("template",i.cell.template);break;case"uuid":{if(a.firstElementChild&&a.firstElementChild.hasAttribute("value")){const e=a.firstElementChild.getAttribute("value");if(t===e)return i.cell._setStyle(a),void i.setAttribute("template",i.cell.template)}o=document.createElement("span"),o.style.paddingLeft="7px";const e=r._generateUUID(),l=i.cell.canNotify;i.cell.canNotify=!1,t||(i.cell.value=e,r.onCellUpdate&&!r.editing.editRow&&r.onCellUpdate([i.cell],[e],[e],(function(){r.onCellUpdated&&r.onCellUpdated([i.cell.row.index],[i.cell.row],[i.cell.column],[i.cell.row.data],[i.cell.value],[i.cell.value],i)}),i)),o.textContent=i.cell.value,i.cell.canNotify=l,i.setAttribute("template",i.cell.template),o.setAttribute("value",e);break}case"ai":{if(a.firstElementChild&&a.firstElementChild.hasAttribute("value")){const e=a.firstElementChild.getAttribute("value");if(t===e)return i.cell._setStyle(a),void i.setAttribute("template",i.cell.template)}const e=(e,t)=>{const l=r.ai.url,a=r.ai.key;e.stopPropagation(),e.preventDefault();const i=e.target.closest("smart-grid-cell"),n=e.target.closest("smart-grid-row"),s=i.getAttribute("data-field"),d=n.getAttribute("data-id");t?(e.target.classList.remove("smart-icon-reload"),e.target.classList.add("smart-grid-loading")):e.target.classList.add("smart-grid-loading");let c=""+r.columnByDataField[s].AIQuery;r.columnByDataField[c]&&(c=""+r.getCellValue(d,c));for(let e=0;e<r.ai.promptVariables.length;e++){const t=r.ai.promptVariables[e],l=r.getCellValue(d,t.dataField)||"",a=new RegExp(`{{${t.name}}}`,"g");c=c.replace(a,l)}c=c.trim(),c=c.replaceAll("\n"," "),c=c.replaceAll("\r"," "),c=c.replaceAll(" "," "),c=c.substring(0,2e3),c&&l&&a?async function(e){e+="\nRespond in less than "+r.ai.maxResponseLength+" words.",e+="\nOutput always in plain text.";const t=await fetch(l,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${a}`},body:JSON.stringify({model:r.ai.model,messages:[{role:"user",content:e}],max_tokens:r.ai.maxTokens,temperature:r.ai.temperature})});if(!t.ok)throw new Error(`Error: ${t.statusText}`);return(await t.json()).choices[0].message.content.trim()}(c).then((e=>{const t=e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/'/g,"&#39;").replace(/"/g,"&quot;");r.setCellValue(d,s,t),o.setAttribute("value",t)})).catch((e=>{console.error("Error:",e)})):(r.setCellValue(d,s,r.localize("noResults")),o.setAttribute("value",r.localize("noResults")))};if(t){o=document.createElement("span"),o.style.paddingLeft="7px",o.classList.add("smart-flex");const l=i.cell.canNotify;i.cell.canNotify=!1,o.textContent=i.cell.value,i.cell.canNotify=l;const a=document.createElement("span");o.appendChild(a),a.classList.add("smart-grid-icon","show","smart-icon-reload"),a.style.position="absolute",a.style.right=a.style.top="0px",a.onpointerdown=t=>{e(t,!0)},i.setAttribute("template",i.cell.template),o.setAttribute("value",t)}else o=document.createElement("div"),o.classList.add("smart-flex","center","middle"),o.style.height="100%",o.innerHTML=`<button style="border-radius: 10px; line-height: 13px; height: 30px; padding-inline: 30px; padding-block: 2px;" class="smart-button" type="button">✨︎ ${r.localize("generate")}</button\n `,o.firstElementChild.onpointerdown=t=>{e(t)},i.setAttribute("template",i.cell.template);break}case"createdDate":case"createdTime":{const e=i.cell.row;let t=e.createdDate;if(s())return;e.history&&e.history[0]&&(t=e.history[0].date);const l=i.cell.getFormattedValue(t,"d"),r=i.cell.getFormattedValue(t,"t");if(a.firstElementChild&&a.firstElementChild.hasAttribute("created-date")){const e=l+" "+r;e!==a.firstElementChild.textContent&&(a.firstElementChild.textContent=e)}else a.innerHTML='<span created-date class="align-left smart-truncate">'+l+" "+r+"</span>";i.cell._setStyle(a),i.setAttribute("template",i.cell.template);break}case"updatedDate":case"updatedTime":if(s())return;if(i.cell.row.updatedDate){const e=i.cell.row;let t=e.updatedDate;e.history&&(t=e.history[e.history.length-1].date);const l=i.cell.getFormattedValue(t,"d"),r=i.cell.getFormattedValue(t,"t");if(a.firstElementChild&&a.firstElementChild.hasAttribute("updated-date")){const e=l+" "+r;e!==a.firstElementChild.textContent&&(a.firstElementChild.textContent=e)}else a.innerHTML='<span updated-date class="align-left smart-truncate">'+l+" "+r+"</span>"}else a.innerHTML="";i.cell._setStyle(a),i.setAttribute("template",i.cell.template);break;case"progress":{const e=t?parseInt(100*t)+"%":"0%";if(a.firstElementChild&&a.firstElementChild.hasAttribute("value")){if(e===a.firstElementChild.getAttribute("value"))return i.cell._setStyle(a),void i.setAttribute("template",i.cell.template)}const l="white",r=["#D50000","#F4511E","#F6BF26","#33B679"];let n=r[0];n=t<.25?r[0]:t<.5?r[1]:t<.75?r[2]:r[3],a.innerHTML='<div value="'+e+'" style="padding-left: 5px; padding-right: 5px; display: grid; grid-template-columns: 1fr auto"><div style="height: 100%; display: flex; align-items: center; width: '+e+';"><div title="'+e+'" style="width: 100%; height: 4px; background: '+n+"; color: "+l+';" class="smart-truncate smart-token"></div></div><span>'+e+"</span></div>",i.setAttribute("template",i.cell.template);break}case"rating":{const e=i.cell.column.editor.max?i.cell.column.editor.max:5,l=t?parseInt(t):0;if(a.firstElementChild&&a.firstElementChild.hasAttribute("value")){if(l===parseInt(a.firstElementChild.getAttribute("value")))return i.cell._setStyle(a),void i.setAttribute("template",i.cell.template);a.firstElementChild.setAttribute("value",l);for(let t=0;t<e;t++){const e=a.firstElementChild.children[t];let i="";l>0&&l>t&&(i="value"),i?e.classList.add("value"):e.classList.remove("value")}return void i.setAttribute("template",i.cell.template)}const n=t=>{let l="";for(let a=0;a<e;a++){let e="";t>0&&t>a&&(e="value"),l+=`<div rating-value title="${a+1}" value="${a+1}" class="smart-grid-icon show smart-icon-star ${e}"></div>`}return l};a.innerHTML=`<div value="${l}" class="rating">${n(l)}</div>`;const s=e=>{if(!r._mobile&&e.hasAttribute("rating-value")){const t=e.getAttribute("value"),l=e.closest("smart-grid-cell"),a=e.closest("smart-grid-row");if(l&&a){const e=l.querySelector(".rating"),s=a.getAttribute("data-id"),o=l.getAttribute("data-field"),d=r.rowById[s],c=r.getCellValue(s,o),m=l.cell;let u=null;r.storeHistory&&(u=r._stringifyRow(d)),c===t?(a.row.data[o]=0,e.innerHTML=n(0),e.setAttribute("value",0)):(a.row.data[o]=parseInt(t),e.innerHTML=n(parseInt(t)),e.setAttribute("value",t));const p=a.row.data[o];r._setCellUndoRedo(m,c,p),r.onCellUpdate&&r.onCellUpdate([m],[c],[p],(function(e){r.onCellUpdated&&r.onCellUpdated([m.row.index],[m.row],[m.column],[m.row.data],[c],[p],i),r._onCellUpdated&&r._onCellUpdated(m.row.index,m.row,m.column,m.row.data,c,p)}),i);const g=e=>{if(e!==c&&(d.updatedDate=new Date,d.updatedBy=i.currentUser,r.storeHistory)){const t=r._stringifyRow(d);t[m.column.dataField]=e,r._updateRowHistory(d,u,t)}};if(r.onCellUpdate&&r.onRowHistory){const e=r.onRowHistory;r.onRowHistory=null,g(p),setTimeout((()=>{r.onRowHistory=e}),100)}else g(p);const f=l.querySelector(".rating"),h=parseInt(t)-1;f.children[h].classList.add("down"),setTimeout((()=>{f.children[h].classList.remove("down")}),1e3)}}},o=(e,t=!0)=>{if(e&&[...e.querySelectorAll(".smart-icon-star")].forEach((e=>{e.classList.remove("hover")})),e.hasAttribute("value")){const l=[...e.parentElement.children],a=l.indexOf(e);l.forEach(((e,l)=>{e.classList.remove("hover"),l<=a&&t&&e.classList.add("hover")}))}};r.editing.enabled?(r.handleRatingClick||(r._handleRatingMove=o,r._handleRatingClick=s),a.firstElementChild.onpointerdown=e=>{s(e.target)},a.firstElementChild.onpointermove=e=>{o(e.target)},a.firstElementChild.onpointerleave=e=>{o(e.target)}):a.firstElementChild.style.pointerEvents="none",i.setAttribute("template",i.cell.template);break}case"vote":{let e=t;const l=(e,t)=>{const l=e.firstElementChild.firstElementChild,a=r.users?r.users.length:1,i=t.length*(100/a)+"%",n=t.length>0?"voted":"",s=l.firstElementChild,o=s.children[0];l.children[1].children[0].classList.remove("smart-votes-bar-animate"),r.isScrolling||l.children[1].children[0].classList.add("smart-votes-bar-animate");const d=l.children[1].firstElementChild.children[0],c=l.children[2];s.classList.remove("voted"),o.classList.remove("smart-icon-check"),n&&(o.classList.add("smart-icon-check"),s.classList.add("voted")),c.textContent=t.length,d.style.width=i,e.firstElementChild.setAttribute("value",t)};if(a.firstElementChild&&a.firstElementChild.hasAttribute("value")){const t=a.firstElementChild.getAttribute("value"),r=a.firstElementChild;return r.removeAttribute("color"),r.style.setProperty("--smart-check-template-color","var(--smart-primary)"),r.style.setProperty("--smart-check-template-forecolor","#ffffff"),i.cell.column.templateSettings&&i.cell.column.templateSettings.color&&(r.style.setProperty("--smart-check-template-color",i.cell.column.templateSettings.color),r.setAttribute("color","")),e=e?e.split():[],l(a,e),e===t?(i.cell._setStyle(a),void i.setAttribute("template",i.cell.template)):(a.firstElementChild.setAttribute("value",e),void i.setAttribute("template",i.cell.template))}const n=e=>{e&&!Array.isArray(e)&&(e=e?e.split():[]);const t=r.users?r.users.length:1,l=e.length*(100/t)+"%;";return`<div vote-value class="smart-flex middle center smart-votes-cell-component">\n <div class="smart-flex middle center smart-vote-button ${e.length>0?"voted":""}">\n <span class="smart-icon smart-grid-icon show ${e.length>0?"smart-icon-check":""}"></span>\n </div>\n <div class="smart-votes-bar-container">\n <div class="smart-votes-bar-component">\n <div class="smart-votes-bar" style="width: ${l} opacity: 1;"></div>\n <div class="smart-votes-bar-frame" style="width: 100%; opacity: 0.2;"></div>\n </div>\n </div>\n <div class="smart-voters-info">${e.length}</div>\n </div>`};a.innerHTML=`<div value="${e}" class="vote">${n(e)}</div>`,i.cell.column.templateSettings&&i.cell.column.templateSettings.color&&(o=a.firstElementChild,o.style.setProperty("--smart-check-template-forecolor","#ffffff"),o.setAttribute("color",""),o.style.setProperty("--smart-check-template-color",i.cell.column.templateSettings.color));const s=(e,t,a)=>{if(r._mobile)return;const n=e.closest("smart-grid-cell"),s=e.closest("smart-grid-row"),o=(e,t)=>{const a=r.rowById[e],o=r.getCellValue(e,t),d=n.cell;let c=null;r.storeHistory&&(c=r._stringifyRow(a));const m=o?o.split(","):[],u=r._currentUser?""+r._currentUser.info.id:null;if(void 0===u)return;m.indexOf(u)>=0?(m.splice(m.indexOf(u),1),s.row.data[t]=m.toString(),l(n.firstElementChild,m)):(m.push(u),s.row.data[t]=m.toString(),l(n.firstElementChild,m));const p=s.row.data[t];r._setCellUndoRedo(d,o,p),r.onCellUpdate&&r.onCellUpdate([d],[o],[p],(function(){r.onCellUpdated&&r.onCellUpdated([d.row.index],[d.row],[d.column],[d.row.data],[o],[p],i),r._onCellUpdated&&r._onCellUpdated(d.row.index,d.row,d.column,d.row.data,o,p)}),i);const g=e=>{if(e!==o&&(a.updatedDate=new Date,a.updatedBy=i.currentUser,r.storeHistory)){const t=r._stringifyRow(a);t[d.column.dataField]=e,r._updateRowHistory(a,c,t)}};if(r.onCellUpdate&&r.onRowHistory){const e=r.onRowHistory;r.onRowHistory=null,g(p),setTimeout((()=>{r.onRowHistory=e}),100)}else g(p)};if(n&&s){o(s.getAttribute("data-id"),n.getAttribute("data-field"))}else null!==t&&null!==a&&o(t,a)};r._handleVoteClick||(r._handleVoteClick=s),a.firstElementChild.onpointerdown=e=>{s(e.target)},a.firstElementChild.onpointerenter=e=>{const t=e.target.closest("smart-grid-cell"),l=e.target.closest("smart-grid-row");if(t&&l){const i=l.getAttribute("data-id"),n=t.getAttribute("data-field");let s=r.getCellValue(i,n);if(s){if(r.users){let e="";s=s.split(),r.users.forEach((t=>{(s.indexOf(""+t.id)>=0||s.indexOf(""+t.value)>=0)&&(e+=t.name||t.label)})),e&&(s=r.localize("votes",{value:e}))}}else s=r.localize("noVotes");r._createTooltip(e,s,a,"top")}},a.firstElementChild.onpointerleave=()=>{r._cellTooltip&&(r._cellTooltip.style.visibility="hidden")},i.setAttribute("template",i.cell.template);break}case"duration":{const e=t;if(a.firstElementChild&&a.firstElementChild.hasAttribute("value")){if(e===a.firstElementChild.getAttribute("value"))return i.cell._setStyle(a),void i.setAttribute("template",i.cell.template)}if(t){const e=864e5;let l="MMM dd",n="MMM dd";if("string"==typeof t[0]&&(Array.isArray(t)?(t[0]=new Date(t[0]),t[1]=new Date(t[1])):((t=t.split(","))[0]=new Date(t[0]),t[1]=new Date(t[1]))),Array.isArray(t)){t[0]&&"string"==typeof t[0]&&(t[0]=new Date(t[0])),t[1]&&"string"==typeof t[1]&&(t[1]=new Date(t[1])),t[1]&&t[1].getMonth()===t[0].getMonth()&&(n="dd"),t[0]&&t[0].getFullYear()!==(new Date).getFullYear()&&(l+=", yyyy","dd"===n?(l="MMM dd",n+=", yyyy"):n=l);let s=!1;t[0]&&(0===t[0].getHours()&&0===t[0].getHours()||(l+=" hh:mm","dd"===n?n=l:n+=" hh:mm",s=!0));let o=null;o=Math.round(t[1].getTime()-t[0].getTime())/e;const d=o?parseInt(Math.abs(o).toFixed(0)):0;if(d>0){const e=i.cell.getFormattedValue(t[0],l)+" - "+i.cell.getFormattedValue(t[1],n);let s="";s=r.localize("days",{value:d}),a.innerHTML=`<div style="display: grid; grid-template-columns: 5px auto 25px"><span></span><span>${e}</span><span style="font-size: 11px;" class="smart-quiet">${s}</span></div>`}else{let e="";if(s){const r=t[1]-t[0],n=Math.floor(r%864e5/36e5);let s=Math.round(r%864e5%36e5/6e4);s<10&&(s+="0"+s),e=n+":"+s;const o=i.cell.getFormattedValue(t[0],l)+" - "+i.cell.getFormattedValue(t[1],"hh:mm");a.innerHTML=`<div style="display: grid; grid-template-columns: 5px auto 25px"><span></span><span>${o}</span><span style="font-size: 11px;" class="smart-quiet">${e}</span></div>`}else{const r=i.cell.getFormattedValue(t[0],l);a.innerHTML=`<div style="display: grid; grid-template-columns: 5px auto 25px"><span></span><span>${r}</span><span style="font-size: 11px;" class="smart-quiet">${e}</span></div>`}}}}else a.innerHTML="";i.setAttribute("template",i.cell.template),a.firstElementChild&&a.firstElementChild.setAttribute("value",e);break}case"startDate":{const e=t;if(a.firstElementChild&&a.firstElementChild.hasAttribute("value")){if(e===a.firstElementChild.getAttribute("value"))return i.cell._setStyle(a),void i.setAttribute("template",i.cell.template)}if(s())return;let l=t;if(n.cellsFormat?l=i.cell.getFormattedValue(t,n.cellsFormat):n.formatSettings&&n.formatSettings.Intl&&(l=i.cell.getFormattedValue(t,n.formatSettings.Intl)),t){const e=864e5,s="string"==typeof t?new Date(t):t;let o=r.columnByDataField.taskDueDate;n.editor.boundDateField&&(o=r.columnByDataField[n.editor.boundDateField]);let d=o?i.cell.row.data[o.dataField]:"";d&&"string"==typeof d&&(d=new Date(d));let c=null;d&&(c=Math.round(s.getTime()-d.getTime())/e);const m=c?parseInt(Math.abs(c).toFixed(0)):0;if(m>0){let e="";e=r.localize("days",{value:m}),a.innerHTML=`<div style="display: grid; grid-template-columns: 25px auto 25px"><span style="color: var(--smart-primary);" title="${e}" class="smart-icon-clock smart-grid-icon show"></span><span>${l}</span><span style="font-size: 11px;" class="smart-quiet">${e}</span></div>`}else a.innerHTML='<div style="padding-left: 6px;">'+l+"</div>"}else a.innerHTML="";i.setAttribute("template",i.cell.template),i.setAttribute("value",e);break}case"dueDate":{const e=t;if(a.firstElementChild&&a.firstElementChild.hasAttribute("value")){if(e===a.firstElementChild.getAttribute("value"))return i.cell._setStyle(a),void i.setAttribute("template",i.cell.template)}if(s())return;const l=["#D50000","#F4511E","#F6BF26","#33B679"],o=new Date;o.setHours(0,0,0);let d=t;n.cellsFormat?d=i.cell.getFormattedValue(t,n.cellsFormat):n.formatSettings&&n.formatSettings.Intl&&(d=i.cell.getFormattedValue(t,n.formatSettings.Intl));const c=(e,t)=>{const l=e<=8?e/8:1;return`<div title="${t}" class="smart-element smart-circular-progress-bar" style="background: inherit; padding-left:4px; position: relative; top: calc(50% - 12px); padding-top:4px; width: 20px; height: 20px;">\n <div class="smart-container">\n <svg style="background: var(--smart-background);"width="100%" height="100%" viewPort="0 0 100 100" viewBox="0 0 100 100" role="presentation" aria-hidden="true">\n <circle id="value" class="smart-value-path" r="50" cx="50" cy="50" transform="rotate(270 50 50)"></circle>\n <circle id="value" style="stroke-dashoffset: ${100*Math.PI-(1-l)*Math.PI*100}; stroke-width: 100%;" class="smart-value" r="50" cx="50" cy="50" transform="rotate(270 50 50)"></circle>\n </svg>\n </div>\n </div>\n `};if(t){const s=864e5,m="string"==typeof t?new Date(t):t,u=Math.round(m.getTime()-o.getTime())/s,p=parseInt(Math.abs(u).toFixed(0));let g=r.columnByDataField.taskStatus;n.editor.boundDataField&&(g=r.columnByDataField[n.editor.boundDataField]);const f=g?i.cell.row.data[g.dataField]:"";if("done"===f||"complete"===f||"completed"===f||"finished"===f){let e=r.localize("done");a.innerHTML=`<div style="display: grid; grid-template-columns: 25px auto"><div style="margin-left: 4px; align-self: center; border-radius: 50%; display: flex; align-content: center; background: ${l[3]}; width:16px; height: 16px;"><span title="${e}" style="align-content: center; font-size: 13px; color: white;" class="smart-grid-icon show smart-icon-check"></span></div>${d}</span></div>`}else{let t="";t=0===p?r.localize("today"):1===p?e<o?r.localize("yesterday"):r.localize("tomorrow"):e<o?r.localize("daysOverdue",{value:p}):r.localize("daysLeft",{value:p}),a.innerHTML=e>=o?`<div style="display: grid; grid-template-columns: 25px auto">${c(p,t)}<span>${d}</span></div>`:`<div style="display: grid; grid-template-columns: 25px auto"><span title="${t}" style="font-size: 16px; color: ${l[0]}" class="smart-grid-icon show smart-icon-attention-circled"></span>${d}</span></div>`}}else a.innerHTML="";i.setAttribute("template",i.cell.template),i.setAttribute("value",e);break}case"attachments":{if(""===t||"[]"===t){const e=`<div class="file-container"><div class="attachments"><div title="${r.localize("addFiles")}" class="smart-grid-icon show smart-icon-plus"></div></div></div>`;return a.innerHTML!==e&&(a.innerHTML=e,a.onpointerdown=e=>{if(e.target.classList.contains("smart-icon-plus")){if(r._mobile)return;if(r.editing.enabled){const t=e.target.closest("smart-grid-cell"),l=t.getAttribute("data-field"),a=t.closest("smart-grid-row").getAttribute("data-id");r.beginEdit(a,l),t.querySelector(".smart-icon-plus").onpointerdown()}e.stopPropagation(),e.preventDefault()}}),i.cell._setStyle(a),void i.setAttribute("template",i.cell.template)}if(a.firstElementChild&&a.firstElementChild.hasAttribute("value")){const e=a.firstElementChild.getAttribute("value");if(t&&t.indexOf(e)>=0)return i.cell._setStyle(a),i.setAttribute("template",i.cell.template),void(a.firstElementChild.evaluateScroll&&a.firstElementChild.evaluateScroll());if(e&&t&&Array.isArray(t)&&t[0]&&t[0].value&&e.length===t[0].value.length)return i.cell._setStyle(a),void i.setAttribute("template",i.cell.template)}const e=document.createElement("div"),l=document.createElement("div");e.classList.add("file-container"),l.classList.add("attachments");let n=t;if(r._findIsFile(n)){let e="";if(n)try{e=JSON.parse(n)}catch(e){console.log(e)}n=e}if("string"==typeof n&&(n.indexOf("[{")>=0||n.indexOf("}]")>=0)){let e="";if(n)try{e=JSON.parse(n)}catch(e){console.log(e)}n=e}Array.isArray(n)&&n.forEach((t=>{const l=document.createElement("div");l.title=t.label,l.classList.add("item"),l.innerHTML="<div></div>",l.firstElementChild.classList.add("smart-grid-icon","show","attachment"),t.label||(t.label=""),t.label.indexOf("png")>=0||t.label.indexOf("jpg")>=0||t.label.indexOf("jpeg")>=0||t.label.indexOf("gif")>=0?l.firstElementChild.classList.add("smart-icon-image"):t.label.indexOf(".pdf")>=0?l.firstElementChild.classList.add("smart-icon-pdf"):t.label.indexOf(".tsv")>=0||t.label.indexOf(".txt")>=0||t.label.indexOf(".csv")>=0?l.firstElementChild.classList.add("smart-icon-text"):t.label.indexOf(".xls")>=0||t.label.indexOf(".xlsx")>=0?l.firstElementChild.classList.add("smart-icon-excel"):t.label.indexOf(".ppt")>=0?l.firstElementChild.classList.add("smart-icon-powerpoint"):t.label.indexOf(".zip")>=0||t.label.indexOf(".rar")>=0||t.label.indexOf(".7z")>=0?l.firstElementChild.classList.add("smart-icon-archive"):t.label.indexOf(".doc")>=0||t.label.indexOf(".docx")>=0?l.firstElementChild.classList.add("smart-icon-word"):t.label.indexOf(".mp3")>=0?l.firstElementChild.classList.add("smart-icon-music"):t.label.indexOf(".mp4")>=0||t.label.indexOf(".avi")>=0||t.label.indexOf(".mov")>=0||t.label.indexOf(".mp4")>=0||t.label.indexOf(".mpeg")>=0||t.label.indexOf(".webm")>=0||t.value&&t.value.indexOf("youtube")>=0?l.firstElementChild.classList.add("smart-icon-video"):l.firstElementChild.classList.add("smart-icon-file"),e.appendChild(l)}));const s=document.createElement("div");s.classList.add("smart-arrow-left","arrowbtn","smart-hidden");const d=document.createElement("div");d.classList.add("smart-arrow-right","arrowbtn");const c=document.createElement("div");if(c.classList.add("smart-icon-plus","smart-grid-icon","show"),c.title=r.localize("addFiles"),"card"!==r.view&&l.appendChild(c),l.onpointerdown=t=>{if(t.target.classList.contains("attachment")){const e=JSON.parse(i.cell.value),a=[...l.children[1].children],n=a&&a.indexOf?a.indexOf(t.target.parentNode):-1;if(e[n]){const t=document.createElement("a");if(e[n].value.indexOf(window.location.host)>=0)fetch(e[n].value).then((e=>e.blob())).then((l=>{const a=URL.createObjectURL(l);t.download=e[n].label,t.href=a,t.click()}));else{if(e[n].value.indexOf("base64")>=0){const l=r._getFileFromBase64(e[n].value);t.href=URL.createObjectURL(l)}else t.href=e[n].value;t.target="_blank",t.click()}}t.stopPropagation(),t.preventDefault()}else if("DIV"===t.target.nodeName&&t.target.classList.contains("arrowbtn")){let l=parseInt(e.style.marginLeft);isNaN(l)&&(l=0);const a=s===t.target,r=e.scrollWidth-i.offsetWidth+30;e.style.marginLeft=a?Math.min(0,l+25)+"px":Math.max(-r,l-25)+"px",l=parseInt(e.style.marginLeft),0===l?s.classList.add("smart-hidden"):s.classList.remove("smart-hidden"),t.stopPropagation(),t.preventDefault()}else if(t.target.classList.contains("smart-icon-plus")){if(r._mobile)return;if(r.editing.enabled){const e=t.target.closest("smart-grid-cell"),l=e.getAttribute("data-field"),a=e.closest("smart-grid-row").getAttribute("data-id");r.beginEdit(a,l),e.querySelector(".smart-icon-plus").onpointerdown()}t.stopPropagation(),t.preventDefault()}},e.children.length){if(l.appendChild(e),"card"!==r.view){const t=25*n.length;t-i.offsetWidth+30>30&&(l.appendChild(s),l.appendChild(d)),l.evaluateScroll=()=>{const a=t-i.offsetWidth+30;e.style.marginLeft="0px",s.classList.add("smart-hidden"),a<0?d.classList.add("smart-hidden"):d.classList.remove("smart-hidden"),a>30&&(l.appendChild(s),l.appendChild(d))}}o=l}else o=document.createElement("div");i.setAttribute("template",i.cell.template),t&&t[0]&&t[0].value?o.setAttribute("value",t[0].value):n&&n[0]&&n[0].label?o.setAttribute("value",n[0].label):o.setAttribute("value",t);break}case"images":{if(""===t||"[]"===t){const e=`<div class="file-container"><div class="images"><div title="${r.localize("addImages")}" class="smart-grid-icon show smart-icon-plus"></div></div></div>`;return e!==a.innerHTML&&(a.innerHTML=e,a.onpointerdown=e=>{if(e.target.classList.contains("smart-icon-plus")){if(r._mobile)return;if(r.editing.enabled){const t=e.target.closest("smart-grid-cell"),l=t.getAttribute("data-field"),a=t.closest("smart-grid-row").getAttribute("data-id");r.beginEdit(a,l),t.querySelector(".smart-icon-plus").onpointerdown()}e.stopPropagation(),e.preventDefault()}}),i.cell._setStyle(a),void i.setAttribute("template",i.cell.template)}if(!r._recycleFiles&&a.firstElementChild&&a.firstElementChild.hasAttribute("value")){const e=a.firstElementChild.getAttribute("value");if(t&&t.indexOf(e)>=0)return i.cell._setStyle(a),i.setAttribute("template",i.cell.template),void(a.firstElementChild.evaluateScroll&&a.firstElementChild.evaluateScroll());if(e&&t&&Array.isArray(t)&&t[0]&&t[0].value&&e.length===t[0].value.length)return i.cell._setStyle(a),void i.setAttribute("template",i.cell.template)}const e=document.createElement("div"),l=document.createElement("div"),s=document.createDocumentFragment();e.classList.add("file-container"),l.classList.add("images");let d=t;if(r._findIsFile(d)){let e="";if(d&&d.indexOf("{")>=0)try{e=JSON.parse(d)}catch(e){console.log(e)}else e=d.split(","),e=e.map((e=>({label:e,value:e})));d=e}if("string"==typeof d&&(d.indexOf("[{")>=0||d.indexOf("}]")>=0)){let e="";if(d)try{e=JSON.parse(d)}catch(e){console.log(e)}d=e}else"string"==typeof d&&d.indexOf("./")>=0&&(d=d.split(","),d=d.map((e=>({label:e,value:e}))));Array.isArray(d)&&d.forEach((e=>{if(e.label||(e.label=""),e.label.indexOf(".mp4")>=0||e.label.indexOf(".avi")>=0||e.label.indexOf(".mov")>=0||e.label.indexOf(".mp4")>=0||e.label.indexOf(".mpeg")>=0||e.label.indexOf(".webm")>=0||e.value&&e.value.indexOf("youtube")>=0){const t=document.createElement("div");t.title=e.label,t.classList.add("item"),t.innerHTML="<div></div>",t.firstElementChild.classList.add("smart-grid-icon","show","attachment"),t.firstElementChild.classList.add("smart-icon-video"),s.appendChild(t)}else{const t=document.createElement("img");t.style.display="none";let l="";l=e.label.indexOf(".gif")>=0?e.value:e.small?e.small:e.medium?e.medium:e.large?e.large:e.value,t.onload=()=>{t.style.display=""},l.indexOf("base64")>=0?t.src=l:(r._imagesCache||(r._imagesCache=[]),r.uploadSettings.url?r._imagesCache[l]?r._findUserFile(e)&&(t.src=l):(r._imagesCache[l]=!0,t.style.display="none",r._findUserFile(e)?(t.src=l,t.style.display=""):l&&l.startsWith("https://")&&(t.src=l)):t.src=l,t.onerror=()=>{t.style.display="none"}),t.title=e.label,t.setAttribute("data-url",e.large||e.value),s.appendChild(t)}}));const c=document.createElement("div");c.classList.add("smart-arrow-left","arrowbtn","smart-hidden");const m=document.createElement("div");m.classList.add("smart-arrow-right","arrowbtn");const u=document.createElement("div");u.classList.add("smart-icon-plus","smart-grid-icon","show"),u.title=r.localize("addImages");const p=document.createElement("div");if(p.classList.add("smart-navigation"),"card"!==r.view&&r.editing.enabled&&n.allowEdit&&l.appendChild(u),l.onpointerdown=t=>{if("IMG"===t.target.nodeName&&("card"!==r.view&&[...e.children].forEach((e=>e.classList.remove("smart-hidden"))),r._openImagePreviewDialog(t.target),t.stopPropagation(),t.preventDefault()),t.target.classList.contains("attachment")){const l=JSON.parse(i.cell.value),a=[...e.children].indexOf(t.target.parentNode);if(l[a]){const e=document.createElement("a");if(l[a].value.indexOf(window.location.host)>=0)fetch(l[a].value).then((e=>e.blob())).then((t=>{const i=URL.createObjectURL(t);e.download=l[a].label,e.href=i,e.click()}));else{if(l[a].value.indexOf("base64")>=0){const t=r._getFileFromBase64(l[a].value);e.href=URL.createObjectURL(t)}else e.href=l[a].value;e.target="_blank",e.click()}}t.stopPropagation(),t.preventDefault()}else if("DIV"===t.target.nodeName&&t.target.classList.contains("smart-navigation-item")){[...p.children].forEach((e=>e.classList.remove("active"))),t.target.classList.add("active"),[...e.children].forEach((e=>e.classList.add("smart-hidden")));const l=[...p.children].indexOf(t.target);e.children[l].classList.remove("smart-hidden"),t.stopPropagation(),t.preventDefault()}else if("DIV"===t.target.nodeName&&t.target.classList.contains("arrowbtn")){let l=parseInt(e.style.marginLeft);isNaN(l)&&(l=0);const a=c===t.target,r=e.scrollWidth-i.offsetWidth+30;e.style.marginLeft=a?Math.min(0,l+25)+"px":Math.max(-r,l-25)+"px",l=parseInt(e.style.marginLeft),0===l?c.classList.add("smart-hidden"):c.classList.remove("smart-hidden"),t.stopPropagation(),t.preventDefault()}else if(t.target.classList.contains("smart-icon-plus")){if(r._mobile)return;if(r.editing.enabled){const e=t.target.closest("smart-grid-cell"),l=e.getAttribute("data-field"),a=e.closest("smart-grid-row").getAttribute("data-id");r.beginEdit(a,l),e.querySelector(".smart-icon-plus").onpointerdown()}t.stopPropagation(),t.preventDefault()}},e.appendChild(s),e.children.length){if(l.appendChild(e),"card"===r.view&&l.appendChild(p),"card"!==r.view){const t=25*d.length;t-i.offsetWidth+30>30&&(l.appendChild(c),l.appendChild(m)),l.evaluateScroll=()=>{const a=t-i.offsetWidth+30;e.style.marginLeft="0px",c.classList.add("smart-hidden"),a<0?m.classList.add("smart-hidden"):m.classList.remove("smart-hidden"),a>30&&(l.appendChild(c),l.appendChild(m))}}else{for(let t=0;t<e.children.length;t++){const l=document.createElement("div");l.classList.add("smart-navigation-item"),0===t?l.classList.add("active"):e.children[t].classList.add("smart-hidden"),p.appendChild(l)}1===e.children.length&&p.classList.add("smart-visibility-hidden")}o=l}else o=document.createElement("div");i.setAttribute("template",i.cell.template),t&&t[0]&&t[0].value?o.setAttribute("value",t[0].value):d&&d[0]&&d[0].label?o.setAttribute("value",d[0].label):o.setAttribute("value",t);break}case"email":if(Smart.Validator){const e=a.firstElementChild?a.firstElementChild.getAttribute("value"):null;if(a.firstElementChild&&a.firstElementChild.hasAttribute("value")&&e===t)return i.cell._setStyle(a),void i.setAttribute("template",i.cell.template);if(s())return;o=document.createElement("span"),null===t||""===t?o.innerHTML="":Smart.Validator.email(t)?o.innerHTML=t:(o.className="url center middle",o.innerHTML='<a href="mailto:'+t+'" target="_blank" contenteditable="false" rel="noreferrer noopener">'+t+"</a>",o.firstElementChild&&(o.firstElementChild.onpointerdown=e=>{e.stopPropagation(),e.preventDefault(),o.firstElementChild.click()}))}i.setAttribute("template",i.cell.template),o.setAttribute("value",t);break;case"url":if(Smart.Validator){const e=a.firstElementChild?a.firstElementChild.getAttribute("value"):null;if(a.firstElementChild&&a.firstElementChild.hasAttribute("value")&&e===t)return i.cell._setStyle(a),void i.setAttribute("template",i.cell.template);if(s())return;const l=e=>{e.classList.add("center","middle"),null===t||""===t?e.classList.add("smart-hidden"):Smart.Validator.url(t)?(e.firstElementChild&&"A"===e.firstElementChild.nodeName?(e.firstElementChild.setAttribute("href",t),e.firstElementChild.textContent=t):e.innerHTML='<a href="https://'+t+'" target="_blank" contenteditable="false" rel="noreferrer noopener">'+t+"</a>",e.classList.remove("smart-hidden")):(e.firstElementChild&&"A"===e.firstElementChild.nodeName?(e.firstElementChild.setAttribute("href",t),e.firstElementChild.textContent=t):e.innerHTML='<a href="'+t+'" target="_blank" contenteditable="false" rel="noreferrer noopener">'+t+"</a>",e.classList.remove("smart-hidden"))};a.firstElementChild&&a.firstElementChild.classList.contains("url")?(o=a.firstElementChild,l(o)):(o=document.createElement("span"),o.className="url",l(o)),o.firstElementChild&&(o.firstElementChild.onpointerdown=e=>{e.stopPropagation(),e.preventDefault(),o.firstElementChild.click()})}i.setAttribute("template",i.cell.template),o.setAttribute("value",t);break;case"sparklines":{const l=t,o=""+n.computedWidth;if(a.firstElementChild&&a.firstElementChild.hasAttribute("value")){const e=a.firstElementChild.getAttribute("value"),t=a.firstElementChild.getAttribute("width"),n=a.firstElementChild.getAttribute("height"),s=i.cell.row.cellHeight||r.layout.rowMinHeight;if(l===e&&t===o&&s===n)return i.cell._setStyle(a),void i.setAttribute("template",i.cell.template)}const d=(e,t,l)=>{if(!1===c.tooltip)return;const a=e.pageX,i=e.pageY-10;if(!r._sparklineTooltip){const e=document.createElement("smart-button");e.classList.add("secondary"),e.style.boxShadow="var(--smart-elevation-4)",e.style.opacity=.9,e.style.transition="all cubic-bezier(0.6, 0.2, 0, 0.8) 0.2s",document.body.appendChild(e),e.style.position="absolute",e.style.zIndex=999,r._sparklineTooltip=e}const n=r._sparklineTooltip;n.innerHTML===t&&n.element===l||(n.style.top=i+25+"px",n.style.left=a-15+"px"),n.innerHTML=""+t,n.style.display=""},c=n.templateSettings,m=()=>{a.onmousemove=e=>{if("column"!==c.type&&"bar"!==c.type||a.querySelectorAll("rect").forEach((t=>{var l=t.getBoundingClientRect();t.removeAttribute("highlight"),l.left<=e.clientX&&e.clientX<=l.right&&l.top<=e.clientY&&e.clientY<=l.bottom&&(t.setAttribute("highlight",""),d(e,t.getAttribute("data-title"),t))})),"pie"===c.type){let t=!1;a.querySelectorAll("path").forEach((l=>{var a=l.getBoundingClientRect();l.removeAttribute("highlight"),t||a.left<=e.clientX&&e.clientX<=a.right&&a.top<=e.clientY&&e.clientY<=a.bottom&&(l.setAttribute("highlight",""),t=!0,d(e,l.getAttribute("data-title"),l))}))}"line"===c.type&&a.querySelectorAll("line").forEach((t=>{var l=t.getBoundingClientRect();t.removeAttribute("highlight"),l.left<=e.clientX&&e.clientX<=l.right&&(t.previousElementSibling&&(t.previousElementSibling.style.display="none"),t.nextElementSibling&&(t.nextElementSibling.style.display="none"),t.setAttribute("highlight",""),l.left+l.width/2>=e.clientX?t.previousElementSibling&&(t.previousElementSibling.style.display="",d(e,t.previousElementSibling.getAttribute("data-title"),t.previousElementSibling)):t.nextElementSibling&&(t.nextElementSibling.style.display="",d(e,t.nextElementSibling.getAttribute("data-title"),t.nextElementSibling)))}))},a.onmouseleave=()=>{r._sparklineTooltip&&(r._sparklineTooltip.style.display="none"),a.querySelectorAll("rect").forEach((e=>{e.removeAttribute("highlight")})),a.querySelectorAll("path").forEach((e=>{e.removeAttribute("highlight")})),a.querySelectorAll("line").forEach((e=>{e.removeAttribute("highlight")})),a.querySelectorAll("circle").forEach((e=>{e.style.display="none"}))}};if(s())return void m();const u=new e,p=i.cell.row.cellHeight||r.layout.rowMinHeight;if(p>=7)if(i._sparklinesRender&&cancelAnimationFrame(i._sparklinesRender),t){const e=u.render({width:o-10,height:Math.max(0,p-7),points:t,colors:c.colors,type:c.type,gap:c.gap,max:c.max,min:c.min,padding:c.padding,roundedCorners:c.roundedCorners,strokeWidth:c.strokeWidth,colorFunction:c.colorFunction,tooltipFormatFunction:c.tooltipFormatFunction});a.innerHTML=`<div height="${p}" width="${o}" value="${l}" style="padding-top: 5px; padding-left: 5px; padding-right: 5px;">${e}</div>`,m()}else a.innerHTML="",a.onmousemove=a.onmouseleave=null;i.setAttribute("template",i.cell.template);break}default:{let e=null;i.setAttribute("template","");const l=i.cell.row,s=a;let o=i.cell.getFormattedValue(t,n.cellsFormat);if(s.style.lineHeight="","function"==typeof i.cell.template){const e={row:l,column:n,cell:i.cell,oldValue:i.cell.oldValue,value:t,data:l.data,template:null},a=i.cell.column.templateSettings.React||r.React,d=i.cell.column.templateSettings.ReactDOM||r.ReactDOM;if(i.cell.column.templateSettings&&a&&d){return void d.createRoot(s).render(a.createElement(i.cell.template,e))}let c=s.querySelector(".smart-grid-cell-template");const m=l.id;r.isHScrolling&&(r._cachedTemplates||(r._cachedTemplates=[]),c&&0===c.innerHTML.length&&(c=null),!c&&r._cachedTemplates&&r._cachedTemplates[n.dataField+"_"+m]&&(0===r._cachedTemplates[n.dataField+"_"+m].innerHTML.length?delete r._cachedTemplates[n.dataField+"_"+m]:e.template=r._cachedTemplates[n.dataField+"_"+m])),c&&c.getAttribute("column")===n.dataField?e.template=c.firstElementChild:c=null,i.formattedValue!==o&&(c=null),i.cell.canNotify=!1,l.canNotify=!1;const u=Object.assign({},{background:i.cell.background,color:i.cell.color,fontSize:i.cell.fontSize,fontFamily:i.cell.fontFamily,fontWeight:i.cell.fontWeight,textDecoration:i.cell.textDecoration,fontStyle:i.cell.fontStyle});if(i.cell.template(e),!c&&e.template)if(e.template instanceof HTMLElement){const t=document.createElement("div");t.classList.add("smart-grid-cell-template"),t.setAttribute("column",n.dataField),s.innerHTML="",s.appendChild(t),t.appendChild(e.template)}else s.innerHTML='<div column="'+n.dataField+'" class="smart-grid-cell-template">'+e.template+"</div>";else c||null!==e.template||(s.innerHTML=t);if(r.isHScrolling&&!r._cachedTemplates[n.dataField+"_"+m]&&s.firstElementChild.firstElementChild){const e=s.firstElementChild.firstElementChild;e&&(r._cachedTemplates[n.dataField+"_"+m]=e)}s.style.background===u.background&&s.style.color===u.color&&s.style.fontSize===u.fontSize&&s.style.fontWeight===u.fontWeight&&s.style.fontStyle===u.fontStyle||(i.cell._styleChanged=!0,i.cell._setStyle(s)),i.cell.background!==u.background||i.cell.color!==u.color||i.cell.fontSize!==u.fontSize||i.cell.fontWeight!==u.fontWeight||i.cell.fontStyle!==u.fontStyle?(i.cell._styleChanged=!0,i.cell._setStyle(s)):i.cell._styleChanged&&i.cell._setStyle(s),void 0===i.cell.oldValue&&(i.cell.oldValue=t),i.formattedValue=o,i.cell.canNotify=!0,l.canNotify=!0}else if(Array.isArray(i.cell.template)){const e=document.createElement("div");if(s.firstElementChild&&s.firstElementChild.classList.contains("smart-grid-cell-template"))for(let e=0;e<i.cell.template.length;e++){const t=s.firstElementChild.children[e].firstElementChild,a=i.cell.template[e];if(a.length>1&&t){let e=l.data[a[1]];a[2]&&(e=a[2].length>2?a[2].replaceAll("{{value}}",e):i.cell.getFormattedValue(e,a[2])),t.src&&t.src!==e?(i._imageUpdateTimer&&clearTimeout(i._imageUpdateTimer),i._imageUpdateTimer=setTimeout((()=>{t.src=e}),50)):t.textContent!==e&&(t.textContent=e)}}else{e.classList.add("smart-grid-cell-template"),e.setAttribute("column",n.dataField),s.innerHTML="",s.appendChild(e);let t="";for(let e=0;e<i.cell.template.length;e++){const a=i.cell.template[e];if(a.length>1){let e=l.data[a[1]];a[2]&&(e=a[2].length>2?a[2].replaceAll("{{value}}",e):i.cell.getFormattedValue(e,a[2])),t+='<span class="smart-template-part">'+a[0].replaceAll("{{value}}",e)+"</span>"}}e.innerHTML=t}}else{if(""!==s.textContent&&(s.textContent=""),i.cell.template instanceof HTMLTemplateElement)e=i.cell.template;else if(i.cell.template instanceof HTMLElement){const e=i.cell.template.innerHTML.replace(/{{value}}/gi,t).replace(/{{id}}/gi,l.id);s.innerHTML!==e&&(s.innerHTML=e)}else if("function"==typeof i.cell.template&&i.cell.template.prototype&&"undefined"!=typeof ngApp){const e=ngApp.injector,l=e.get(ComponentFactoryResolver).resolveComponentFactory(i.cell.template),a=s.appendChild(l.create(e));return a.instance.value=t,void a.changeDetectorRef.detectChanges()}if(i.cell.template.startsWith&&i.cell.template.startsWith("#")&&(e=document.querySelector(i.cell.template)),e){let a=e.content.cloneNode(!0).firstElementChild;const d=t;if(t=(t=(t=t.toString()).replace(/'/gi,"\\'")).replace(/"/gi,'\\"'),a.querySelector("[smart-if]")){const e=a.querySelector("[smart-else]"),l=a.querySelectorAll("[smart-if]");let i=!1;for(let e=0;e<l.length;e++){const r=l[e],s=r.getAttribute("smart-if"),o=s.split(" "),c=o[1].trim();let m=o[2].trim();s.indexOf("'")>=0&&(m=s.substring(s.indexOf("'")+1),m=m.replaceAll("'",""));let u=t;switch("Today"===m&&(m=new Date),"date"===n.dataType&&(t=new Date(d).getTime(),m=new Date(m).getTime()),c){case">":t>parseFloat(m)&&(a=r,i=!0);break;case">=":t>=parseFloat(m)&&(a=r,i=!0);break;case"=":case"==":case"===":t===m&&(a=r,i=!0);break;case"<":t<parseFloat(m)&&(a=r,i=!0);break;case"<=":t<=parseFloat(m)&&(a=r,i=!0)}if(t=u,i)break}!i&&e&&(a=e)}let c=a.outerHTML.replace(/{{value}}/gi,t).replace(/{{id}}/gi,l.id);for(c.indexOf("{{value=")>=0&&(t?(c=c.substring(0,c.indexOf("{{value="))+t+c.substring(c.indexOf("}")),c=c.replace(/}/gi,""),c=c.replace(/{/gi,"")):(c=c.replace(/{{value=/gi,""),c=c.replace(/}}/gi,"")));c.indexOf("{{value::")>=0;){const e=c.indexOf("{{value::"),l=c.substring(e+9,c.indexOf("}}")),a=i.cell.getFormattedValue(t,l);c=c.replace(`{{value::${l}}}`,a)}if(n._treeColumn){const e=s.firstChild;if(e&&e.classList&&i.toggleButton&&n._treeColumn&&s.children[1]){const e=s.children[0],t=s.children[1].children[0],a=s.children[1].children[1].firstChild,i=s.children[1].children[2];let n="";if(r.grouping.enabled){let e=l.level-1;"multipleColumns"!==r.grouping.renderMode&&(n+='<div style="width: '+(1+e)*r.grouping.groupIndent+'px;"></div>')}else for(let e=0;e<l.level;e++)n+="<div class='smart-indent'></div>";l.checked?a.setAttribute("checked",""):!1===l.checked?a.removeAttribute("checked"):null===l.checked&&a.setAttribute("checked","indeterminate"),l.leaf?l.allowCheck?a.classList.remove("smart-visibility-hidden"):a.classList.add("smart-visibility-hidden"):l.allowCheck?a.classList.remove("smart-hidden"):a.classList.add("smart-hidden"),l.allowCheck?r.checkBoxes.visible?a.classList.remove("smart-hidden"):a.classList.add("smart-hidden"):r.checkBoxes.visible||a.classList.add("smart-hidden"),e.innerHTML=n,t.classList.add("smart-visibility-hidden"),l.leaf?t.classList.add("smart-visibility-hidden"):(t.classList.remove("smart-visibility-hidden"),l.expanded?t.setAttribute("toggled",""):t.removeAttribute("toggled","")),l.data.isEmpty&&t.classList.add("smart-visibility-hidden"),i.innerHTML=c,r.appearance.showTooltips?i.setAttribute("title",r._unescapeString(o)):i.hasAttribute("title")&&i.removeAttribute("title")}}else s.innerHTML!==c&&(s.innerHTML=c)}else if("string"==typeof i.cell.template){""===t&&(t="&nbsp;");let e=i.cell.template.replace(/{{value}}/gi,t).replace(/{{id}}/gi,l.id);if(e.indexOf("{{"))for(let t=0;t<r.dataSource.dataFields.length;t++){const a=r.dataSource.dataFields[t].name;if(e.indexOf("{{"+a+"}}")>=0&&(e=e.replace("{{"+a+"}}",l.data[a]),-1===e.indexOf("{{")))break}s.innerHTML!==e&&(s.innerHTML=e)}}if("auto"===i.cell.row.height||r.layout.allowCellsWrap||"auto"===r.layout.rowHeight){const e=s.querySelector(".smart-grid-cell-template");if(e){l._templatesHeight||(l._templatesHeight=[]);const t=(e,t)=>{if(e){const l=r.rowById[e.getAttribute("data-id")];l._templatesHeight[n.dataField]=t,l._isDirty=!0;const a=l.canNotify;l.canNotify=!1,l.autoSize(),l.canNotify=a,delete l._isDirty}};if(e.firstElementChild){if(!e.firstElementChild.resizeObserver){const l=new ResizeObserver((function(){const e=this.target.closest("smart-grid-row");this.target.offsetHeight&&(t(e,this.target.offsetHeight),r.$.scrollView.scrollTop=0)}));e.firstElementChild.resizeObserver=l,l.target=e.firstElementChild,l.observe(e.firstElementChild)}e.firstElementChild.onblur=e.firstElementChild.onchange=function(){const e=this.closest("smart-grid-row");t(e,this.offsetHeight)}}else{const l=this.closest("smart-grid-row");t(l,e.offsetHeight)}}}}}if(o)return a.innerHTML="",a.appendChild(o),r._cellCachedValues&&(r._cellCachedValues[n.dataField+"_"+t]=a.innerHTML),i.cell._setStyle(a),o;i.cell._setStyle(a),r._cellCachedValues&&(r._cellCachedValues[n.dataField+"_"+t]=a.innerHTML)}async _render(){const e=this,t=e.cell.grid,l=e.cell.column,a=e.cell.row,i=a.data,r=a._isMeasureRow?null:e.cell.format||l.cellsFormat,n=t.grouping.enabled&&t.dataSource.groupBy&&t.dataSource.groupBy.length>0;if(e.setAttribute("data-type",l.dataType),!(!1!==t._recycleValues||n||l.formatFunction||l._treeColumn||a.summaryRow||"grid"!==t.view)){if(e.cell.selected?(e.setAttribute("selected",""),e.setAttribute("aria-selected",!0)):(e.removeAttribute("selected"),e.removeAttribute("aria-selected")),e.classList.contains("smart-hidden")&&e.classList.remove("smart-hidden"),e.cell.focused?(t.selection.allowCellSelection&&e.setAttribute("focus",""),a.element.setAttribute("focus",""),a.element.toggleDetailButton&&(a.element.toggleDetailButton.classList.remove("smart-visibility-hidden"),a.element.star&&a.element.star.classList.add("smart-hidden")),e.cell.id||(e.id="gridcell_"+Math.floor(65536*(1+Math.random())).toString(16).substring(1)),t.$.content.setAttribute("aria-activedescendant",e.id)):(e.removeAttribute("focus"),a.element&&a.element.star&&t._selection.focusedCell&&t._selection.focusedCell.id!==a.id?a.element.star.classList.remove("smart-hidden"):t.appearance.showRowComments&&!a.element.hasAttribute("focus")&&a.element.toggleDetailButton&&a.element.toggleDetailButton.classList.add("smart-visibility-hidden")),e.cell.background||e.cell.color){e.cell._styleChanged=!0;const t=e.firstChild;e.cell._setStyle(t)}return}if(t.grouping.enabled&&t.dataSource.groupBy&&t.dataSource.groupBy.length>0&&"card"!==t.view){if(void 0!==a.label){let t=l.displayField?i[l.displayField]:i[l.dataField];return void 0===t&&i.data&&(t=l.displayField?i.data[l.displayField]:i.data[l.dataField]),e._renderGroupCell(t),void(a.summaryRow&&(e.cell.canNotify=!1,a.canNotify=!1,e.cell._styleChanged=!0,e.cell.background=null,e.cell.color=null,e.cell.fontFamily=null,e.cell.fontSize=null,e.cell.element&&e.cell.element.firstElementChild&&e.cell._setStyle(e.cell.element.firstElementChild),e.cell.canNotify=!0,a.canNotify=!0))}e.style.zIndex=""}else if(t.appearance.showTreeRowHeader&&t.rowHierarchy&&!1===a.leaf&&!l.autoGenerated){let t=i[a.groupDataField];return a.label=t,void e._renderGroupCell(t)}if(t.appearance.showTreeRowHeader&&e.removeAttribute("header"),t.grouping.enabled&&t.dataSource.groupBy&&t.dataSource.groupBy.length>0&&e.toggleButton&&(e.toggleButton.classList.remove("smart-hidden"),e.toggleButton.classList.remove("smart-visibility-hidden"),e.toggleButton.style.marginLeft="",l._treeColumn&&t.grouping.enabled&&t.grouping.toggleButtonIndent>0&&(e.toggleButton.style.marginLeft=a.level*(t.grouping.toggleButtonIndent-t.grouping.groupIndent)+"px")),t.grouping.enabled&&t.dataSource.groupBy&&t.dataSource.groupBy.length>0&&(e.removeAttribute("header"),e.removeAttribute("group")),!l.visible)return void(e.style.width="0px");t.appearance.showSortColumnBackground&&t.sorting.maintainSort&&!a.summaryRow?l.sorted?e.setAttribute("sort",""):e.removeAttribute("sort"):l.sorted&&e.hasAttribute("sort")&&e.removeAttribute("sort"),t.appearance.showFilterColumnBackground?l.filtered?e.setAttribute("filter",""):e.removeAttribute("filter"):l.filtered&&e.hasAttribute("filter")&&e.removeAttribute("filter"),t.dataSource.boundHierarchy&&e.hasAttribute("has-toggle-button")&&!l._treeColumn&&e.removeAttribute("has-toggle-button"),t.dataSource.boundHierarchy||!e.hasAttribute("has-toggle-button")||l._treeColumn||e.removeAttribute("has-toggle-button");let s=l.displayField?i[l.displayField]:i[l.dataField];if(e.removeAttribute("placeholder"),!l.placeholder||""!==s&&null!=s||(s=l.placeholder,e.setAttribute("placeholder","")),l.parentDataField){const e=t.columnByDataField[l.parentDataField];if(e){let i=e.editor.dataSource;e.relationId&&e.relationField&&e._isDirty&&(!e.editor.dataSource||e.editor.dataSource&&0===e.editor.dataSource.length)&&(i=t._getRelationData(e.relationId));const r=i[t.getCellValue(a.id,l.parentDataField)];if(r){s=r[l.cascadingDataField]}}}if(null!==s||l.allowNull||("int"!==l.dataType&&"number"!==l.dataType||(s=0),"string"===l.dataType&&(s=""),"boolean"!==l.dataType&&"bool"!==l.dataType||(s=!1),"date"===l.dataType&&(s=new Date)),t.formulas&&e.cell.formula&&"string"==typeof e.cell.formula&&e.cell.formula.startsWith("=")&&/=.+/.test(e.cell.formula)){const i=t._formulaParser;if(i){if(t&&t.formulas&&e.cell._formula!==l.formula){let t=a.data[l.dataField];l.formula&&(e.cell.formula=e.cell._parseFormula(l.formula)),t&&(""+t).startsWith("=")&&(e.cell.formula=e.cell._parseFormula(""+t)),e.cell._formula=l.formula}const r=i.parse(e.cell.formula.slice(1));s=isNaN(r)?"#VALUE!"===r?"":"#ERROR!"===r?"#ERROR!":r:r}}t.grouping.enabled&&"multipleColumns"===t.grouping.renderMode&&t.dataSource&&t.dataSource.groupBy&&t.dataSource.groupBy.length>0&&t.dataSource.groupBy.indexOf(l.dataField)>=0&&(s="",e.setAttribute("header","")),e.removeAttribute("highlight"),t.highlighted!==a.id||l.autoGenerated||e.setAttribute("highlight",""),t.editing.addNewRow.visible&&e.classList.remove("smart-add-new-row"),t.editing.enabled&&(e.cell.readonly||!l.allowEdit?e.classList.add("smart-readonly"):e.classList.remove("smart-readonly"));const o=t=>{if(t){if((t=""+t).startsWith("off_"))return e.classList.remove(t.substring(4)),!1;if(e.classList.add(t),e.hasAttribute("customCSS")){t=t+" "+e.getAttribute("customCSS")}return e.setAttribute("customCSS",t),!0}return e.setAttribute("highlight",""),!0};if((t.highlightedRows||t.highlightedCells)&&e.hasAttribute("customCSS")){const t=e.getAttribute("customCSS");e.removeAttribute("customCSS");const l=t.split(" ");for(let t=0;t<l.length;t++)e.classList.remove(l[t])}if(l.highlight&&!a.summaryRow&&(o(l._highlightCSS||""),e.setAttribute("highlight-data-field",l.dataField)),t.highlightedCells&&t.highlightedCells[a.id]&&!a.summaryRow&&void 0!==t.highlightedCells[a.id][l.dataField]){o(t.highlightedCells[a.id][l.dataField])}if(t.highlightedRows&&!a.summaryRow&&void 0!==t.highlightedRows[a.id]){o(t.highlightedRows[a.id])}if(t.editing.batch){if(t._cellsUpdatedValues){e.removeAttribute("update");const i=t._cellsUpdatedValues[a.id+"_"+l.dataField];void 0!==i&&(e.setAttribute("update",""),s=i)}t._rowsDeleted&&(t._rowsDeleted.indexOf(a.id)>=0?e.setAttribute("delete",""):e.removeAttribute("delete")),t._rowsAdded&&(t._rowsAdded.indexOf(a.id)>=0?e.setAttribute("add",""):e.removeAttribute("add"))}!t.onCellValue||l.rowHeaderColumn||l.selectionColumn||(e.cell._updating=!0,t.onCellValue(e.cell,t),e.cell._updating=!1,s=e.cell.value),void 0===s&&(s="");let d=s;if(r)d=e.cell.getFormattedValue(s,r);else if(l.formatSettings&&l.formatSettings.Intl)if(""===s)d="";else if(l.editor.decimalPlaces>=0){const t=JSON.parse(JSON.stringify(l.formatSettings.Intl));t.NumberFormat.minimumFractionDigits=l.editor.decimalPlaces,t.NumberFormat.maximumFractionDigits=l.editor.decimalPlaces,d=e.cell.getFormattedValue(s,t)}else d=e.cell.getFormattedValue(s,l.formatSettings.Intl);else l.formatSettings&&l.formatSettings.formatString&&(d=e.cell.getFormattedValue(s,l.formatSettings.formatString));const c=e.firstChild;if(e.content=c,l._isDirty&&(c.innerHTML=""),c.hasAttribute("data-field")&&c.getAttribute("data-field")!==l.dataField&&(c.innerHTML="",a.filterRow&&(l._filterEditorInitialized=!1)),c.setAttribute("data-field",l.dataField),t.onCellRender||l.onCellRender)if(l._cellsCachedValues||(l._cellsCachedValues=[]),l._cellsCachedValues[a.index]){const t=l._cellsCachedValues[a.index];c.firstChild&&c.removeChild(c.firstChild),e.cell.template instanceof HTMLTemplateElement||"string"==typeof e.cell.template?c.appendChild(t):c.innerHTML=t.innerHTML}else{if(e.cell._updating=!0,t.onCellRender?t.onCellRender(e.cell,a.visibleIndex,l.dataField,a.data,e):l.onCellRender(e.cell,a.visibleIndex,l.dataField,a.data,e),e.cell._updating=!1,e.cell.template!==l.template){const t=document.createElement("div");return c.firstChild&&c.removeChild(c.firstChild),e.cell.template instanceof HTMLTemplateElement?(t.appendChild(e.cell.template.content.cloneNode(!0)),l._cellsCachedValues[a.index]=t):t.appendChild(e.cell.template),void c.appendChild(t)}e.cell.value!==s&&(d=e.cell.value)}if(l.autoGenerated||e.setAttribute("data-field",l.dataField),e.cell.focused?(t.selection.allowCellSelection&&e.setAttribute("focus",""),a.element.setAttribute("focus",""),a.element.toggleDetailButton&&(a.element.toggleDetailButton.classList.remove("smart-visibility-hidden"),a.element.star&&a.element.star.classList.add("smart-hidden")),e.cell.id||(e.id="gridcell_"+Math.floor(65536*(1+Math.random())).toString(16).substring(1)),t.$.content.setAttribute("aria-activedescendant",e.id)):e.removeAttribute("focus"),e.cell.selected?(e.setAttribute("selected",""),e.setAttribute("aria-selected",!0)):(e.removeAttribute("selected"),e.removeAttribute("aria-selected")),t.dragDrop&&t.dragDrop.row===a?e.classList.add("dragged"):e.classList.remove("dragged"),e._classNames)for(let t=0;t<e._classNames.length;t++)e.classList.remove(e._classNames[t]);if(a._classNames||e._rowClassNames){if(e._rowClassNames)for(let t=0;t<e._rowClassNames.length;t++)e.classList.remove(e._rowClassNames[t]);for(let t=0;t<a._classNames.length;t++)e.classList.add(a._classNames[t]);e._rowClassNames=a._classNames}if(t.onCellClass){const i=t.onCellClass(a.visibleIndex,l.dataField,s,a.data,a,t);if(e.___classNames)for(let t=0;t<e.___classNames.length;t++)e.classList.remove(e.___classNames[t]);if(i){const t=i.trim().split(" ");for(let l=0;l<t.length;l++)e.classList.add(t[l]);e.___classNames=t}}if(l.cellsClassName)if("string"==typeof l.cellsClassName){const t=l.cellsClassName.trim().split(" ");for(let l=0;l<t.length;l++)e.classList.add(t[l]);e._classNames=t}else{const t=l.cellsClassName(a.visibleIndex,l.dataField,s,a.data,a);if(e._classNames)for(let t=0;t<e._classNames.length;t++)e.classList.remove(e._classNames[t]);if(t){const l=t.trim().split(" ");for(let t=0;t<l.length;t++)e.classList.add(l[t]);e._classNames=l}}if(l.cellsCSSRules){if(e.__classNames)for(let t=0;t<e.__classNames.length;t++)e.classList.remove(e.__classNames[t]);const i=Object.keys(l.cellsCSSRules);let r=[];for(let n=0;n<i.length;n++){let o=i[n];const d={index:a.visibleIndex,value:s,dataField:l.dataField,row:a,data:a.data,api:t};l.cellsCSSRules[o](d)&&(e.classList.add(o),r.push(o))}e.__classNames=r}t.rowDetail.enabled&&a.showDetail&&!1===t.rowDetail.dialog.enabled&&(e.style.height=a.cellHeight+"px",e.style.lineHeight=a.cellHeight+"px"),a.expanded&&a.expandHeight>0&&(e.style.height=a.cellHeight+"px",e.style.lineHeight=a.cellHeight+"px");const m=e._getCellAlignment(a,l),u=""!==e.cell.template&&t.isInitialized&&!a._isMeasureRow;let p="";if(m.align&&(p+=m.align+" "),m.verticalAlign&&(p+=m.verticalAlign+" "),l.cellsWrap)p+="wrap ";else if(t.layout.autoWrap&&a.height>40&&1===e.cell.colSpan&&"string"===l.dataType){if(14*(d||"").length*.52>l.computedWidth){if("url"!==e.cell.template&&"email"!==e.cell.template){p+="textwrap ";const e=parseInt(a.height/20);c.style["-webkit-line-clamp"]=e}}}if(p+="smart-label",e.style.width!==l.computedWidth+"px"){const a=t._isLastVisibleColumn(l);l.autoGenerated||a?e.style.width=l.computedWidth+"px":e.style.width=l.computedWidth-t._columnGap+"px"}if(l.grid.appearance.showRowComments&&l.rowHeaderColumn){const a=t.rowDetailColumn,i=a?a.width:0;e.style.width=l.computedWidth+i+"px",e.classList.add("row-number")}l===t._firstVisibleColumn?e.classList.add("smart-grid-column-border-collapse"):e.classList.remove("smart-grid-column-border-collapse"),t.appearance.showColumnGroupCellLines||l.parent&&!l.element.hasAttribute("column-group-first-child")&&e.classList.add("smart-grid-column-border-collapse"),t.grouping.enabled&&"multipleColumns"===t.grouping.renderMode&&t.dataSource&&t.dataSource.groupBy&&t.dataSource.groupBy.length>0&&t.dataSource.groupBy.indexOf(l.dataField)>=0&&e.classList.add("smart-grid-column-border-collapse"),t._columnGap>0&&t.appearance.showColumnLines&&e.classList.add("smart-grid-column-border"),t._rowGap>0&&e.classList.add("smart-grid-row-border"),t.appearance.showColumnLines?e.classList.remove("smart-grid-vertical-border-collapse"):e.classList.add("smart-grid-vertical-border-collapse"),t.appearance.showRowLines?e.classList.remove("smart-grid-horizontal-border-collapse"):e.classList.add("smart-grid-horizontal-border-collapse");let g=l.left;if(t.rightToLeft?e.style.right!==g+"px"&&(e.style.right=g+"px"):e.style.left!==g+"px"&&(e.style.left=g+"px"),e.classList.contains("smart-hidden")&&e.classList.remove("smart-hidden"),e.hasAttribute("template")&&e.removeAttribute("template"),e.hasAttribute("freeze")&&e.removeAttribute("freeze"),e.hasAttribute("detail")&&e.removeAttribute("detail"),e.hasAttribute("error")&&e.removeAttribute("error"),e.cell.error&&e.setAttribute("error",e.cell.error),a.filterRow?e.classList.add("smart-grid-filter-row-cell"):a.summaryRow?e.classList.add("smart-grid-summary-row-cell"):(l.freeze||a.freeze)&&(l.selectionColumn&&(e.setAttribute("checkbox",""),p+=" smart-input",l.grid.selection.checkBoxes.enabled&&l.grid.selection.checkBoxes.autoShow?e.setAttribute("auto-show",""):e.removeAttribute("auto-show")),(l.rowHeaderColumn||l.selectionColumn)&&(e.setAttribute("header",""),e.setAttribute("role","rowheader")),t.appearance.showFrozenColumnBackground&&l.freeze&&e.setAttribute("freeze",""),t.appearance.showFrozenRowBackground&&a.freeze&&e.setAttribute("freeze",""),l.rowDetailColumn&&(e.setAttribute("header",""),e.setAttribute("detail",""),e.setAttribute("has-toggle-button",""),e.classList.add("smart-grid-column-border-collapse")),l.commandColumn&&e.setAttribute("command","")),t.appearance.showRowComments&&(a.comments&&a.comments.length>0&&l===t._firstVisibleUserColumn?e.classList.add("row-comments"):e.classList.remove("row-comments")),l.cellsRotationAngle){if(!e._rotateCellContent(c,l,s))return}else if(a.filterRow){if(!l.toggleColumn&&!l.rowHeaderColumn)return t.grouping.enabled&&t.dataSource&&t.dataSource.groupBy&&t.dataSource.groupBy.length>0&&(l._filterEditorInitialized=!1),l._filterEditorInitialized||l.autoGenerated?void("boolean"===l.dataType||"bool"===l.dataType?e.setAttribute("template","checkBox"):e.removeAttribute("template")):(l._filterEditorInitialized=!0,void e._renderFilterCell(c));c.innerHTML=""}else if(a.summaryRow){if(l.toggleColumn||l.rowHeaderColumn)""!==c.innerHTML&&(c.innerHTML="");else if(l.autoGenerated&&""!==c.innerHTML&&(c.innerHTML=""),t.dataSource.boundHierarchy&&e.hasAttribute("has-toggle-button")&&e.removeAttribute("has-toggle-button"),!l.autoGenerated){if(l.summary&&l.summary.length>0&&t._summaryItems){const a=t._summaryItems[l.dataField],i=[];for(let r in a){if("status"===r)continue;const n=l.cellsFormat;let s=a[r];n&&n.indexOf("p")>=0&&"count"===r?s=a[r]:n&&"date"!==l.dataType&&(s=e.cell.getFormattedValue(s,n)),t.messages&&t.messages[t.locale]&&t.messages[t.locale][r]?i.push(t.localize(r,{value:s})):i.push(r+": "+s)}let r=[],n="";if(a&&a.status&&l.editor){n+='<div style="margin-right: 5px; display: flex; border-radius: 8px; align-items: center;">';const e=l.editor.dataSource,i=a.status,s=t.rows.length,o=l.computedWidth;let d=0;if(e)for(let l=0;l<e.length;l++){const a=e[l];if(i[a.value]){const e=a.label?a.label:t.localize("blankSummary"),l=i[a.value].length,c=new Number(l/s*100).toFixed(2),m=e+" "+l+"/"+s+" "+c+"%",u=o*c/100/2;r.push(m);const p=["#D50000","#F6BF26","#33B679","#039BE5","#3F51B5","#8E24AA"];d>p.length-1&&(d=0);n+='<span class="summary-value-part" title="'+m+'" style="width: '+u+"px; font-size: 11px; padding: 5px; background:"+(a.color||p[d++])+'; color: white;"></span>'}}n+="</div>"}const s=i.join(", "),o=t.summaryRow.editing?'<span class="smart-arrow-down"></span>':"";let d=`<div title = "${s}" class="smart-truncate summary-value" > <span class="label">${s}</span>${o}</div> `;r.length&&(d=`<div title = "${s}" class="smart-truncate summary-value" > <span style="align-items: center; display: flex;" class="label">${n}${s}</span>${o}</div> `);if(t.columns[0].dataField===l.dataField&&i.length<3){const e=t._recyclingRows.length;d=`<div title = "${s}" class="smart-truncate summary-value" > ${`<span style = "justify-content: flex-start" class="smart-truncate summary-value" > ${1===e?t.localize("oneRow"):t.localize("rows",{value:e})}</span> `} <span class="label">${s}</span>${o}</div> `}c.innerHTML!==d&&(c.innerHTML=d)}else if(t.summaryRow.editing&&l.allowSummary){if(t.columns[0].dataField===l.dataField){const e=t._recyclingRows.length,l=`<div class="smart-truncate summary-value"><span style="justify-content: flex-start" class="smart-truncate summary-value">${1===e?t.localize("oneRow"):t.localize("rows",{value:e})}</span><span class="smart-summary-placeholder label">${t.localize("summary")}</span><span class="smart-arrow-down"></span></div>`;c.innerHTML!==l&&(c.innerHTML=l)}else{const e=`<div class="smart-truncate summary-value"><span class="smart-summary-placeholder label">${t.localize("summary")}</span><span class="smart-arrow-down"></span></div>`;c.innerHTML!==e&&(c.innerHTML=e)}}t.summaryRow.editing&&l.allowSummary&&(t._selection&&t._selection.focusedCell&&t._selection.focusedCell.dataField===l.dataField?c.firstElementChild.setAttribute("has-summary",""):c.firstElementChild.removeAttribute("has-summary"),c.onpointerdown=e=>{e.preventDefault(),e.stopPropagation(),c._clickTarget=e.target},c.onpointerup=l=>{!0!==t._mobile&&c._clickTarget!==l.target||(l.preventDefault(),l.stopPropagation(),t._summaryRowDialog&&t._summaryRowDialog.classList.contains("open")&&t._summaryRowDialog.dataField===e.cell.column.dataField?t._summaryRowDialog.confirm():t._openSummaryRowDialog(e.cell,(()=>{})))})}}else if(t.rowDetail.enabled&&l.rowDetailColumn){let l="",i=t.appearance.showRowStatus||t.appearance.showRowComments?"smart-visibility-hidden":"";if(a.showDetail){l='<button tabindex="-1" class="'+i+' smart-animate" toggled toggle-button="" title="'+t.localize(a.showDetail?"collapseRow":"expandRow",{elementType:"Grid"})+'"></button>'}else{l='<button tabindex="-1" class="'+i+" smart-animate"+(t.rowDetail.dialog.enabled?" row-detail":"")+'" toggle-button="" title="'+t.localize(a.showDetail?"collapseRow":"expandRow",{elementType:"Grid"})+'"></button>'}if(t.appearance.showRowStatus){l=a._style&&a._style.status?`<span class="row-status custom" style = "color: ${a._style.status};" ></span> `+l:'<span class="row-status"></span>'+l,c.innerHTML===l||a.element.star?(a.element.star.classList.remove("smart-hidden"),a.element.star.classList.remove("custom"),a._style&&a._style.status?(a.element.star.style.color=a._style.status,a.element.star.classList.add("custom")):a.element.star.style.color=""):c.innerHTML=l;const i=()=>{if(a.comments&&a.comments.length>0){const e=a.comments.length;a.element.star.classList.add("comments"),a.element.star.setAttribute("title",t.localize(a.starred?"starred":"notStarred",{elementType:"Grid"})+", "+e+" "+t.localize("comments"))}else a.comments&&0===a.comments.length&&a.element.star.classList.remove("comments")};a.element.star=e.querySelector("span"),a.element.star||(c.innerHTML=l,a.element.star=e.querySelector("span")),a.element.star.onpointerdown=e=>{a.canNotify=!1,a.starred=!a.starred,a.canNotify=!0,a.data.$&&(a.data.$.starred=a.starred),a.starred?a.element.star.classList.add("starred"):a.element.star.classList.remove("starred"),a.element.star.setAttribute("title",t.localize(a.starred?"starred":"notStarred",{elementType:"Grid"})),i(),e.stopPropagation(),e.preventDefault(),t.$.fireEvent("rowStarred",{id:a.id,originalEvent:e,row:a,value:a.starred})},a.element.star.setAttribute("title",t.localize(a.starred?"starred":"notStarred",{elementType:"Grid"})),a.starred?a.element.star.classList.add("starred"):a.element.star.classList.remove("starred"),i()}else c.innerHTML!==l&&(c.innerHTML=l);if(a.element.toggleDetailButton=e.querySelector("button"),a.element.toggleDetailButton.setAttribute("title",t.localize(a.showDetail?"collapseRow":"expandRow",{elementType:"Grid"})),(t.rowDetail.template||t.onRowDetailInit)&&a.element.toggleDetailButton.classList.remove("smart-visibility-hidden"),a.comments&&a.comments.length>0){const e=a.comments.length;a.element.toggleDetailButton.classList.remove("smart-visibility-hidden"),t.appearance.showRowStatus?a.element.toggleDetailButton.querySelector(".comments-length")?a.element.toggleDetailButton.querySelector(".comments-length").innerHTML=e:a.element.toggleDetailButton.innerHTML+=`<div class="comments-length'>${e}</div>`:a.element.toggleDetailButton.innerHTML=`<div class="comments-length'>${e}</div>`,a.starred&&a.element.toggleDetailButton.classList.add("starred"),a.element.toggleDetailButton.classList.add("row-comments"),a.element.toggleDetailButton.setAttribute("title",t.localize(a.showDetail?"collapseRow":"expandRowComments",{value:e,elementType:"Grid"}))}else a.comments&&0===a.comments.length&&a.element.toggleDetailButton.classList.remove("row-comments");t.rowDetail.dialog.enabled&&a.element.toggleDetailButton.classList.add("row-detail")}else if(l.commandColumn)e._renderCommands();else if(t.appearance.showRowHeaderNumber&&l.rowHeaderColumn)if(a.addNewRow)c.textContent="";else{const l=l=>{if(e.cell.value)return e.cell.value;if("number"===t.appearance.autoGenerateRowLabelMode)return l.visibleIndex+1;{const e=l.visibleIndex%26,t=Math.floor(l.visibleIndex/26),a="A".charCodeAt(0),i=String.fromCharCode(a+e);let r="";for(let e=0;e<t;e++)r+="A";return r+i}};t._rowsAdded&&t._rowsAdded.indexOf(a.id)>=0?c.textContent="":c.textContent=l(a)}else if(u)if(e.removeAttribute("readonly"),t.appearance.displayLoadingIndicator&&!l.autoGenerated)c.innerHTML='<div class="smart-grid-cell-loading"></div>';else if(a._isMeasureRow)c.innerHTML=s;else switch(c.removeAttribute("title"),e.cell.template){case"checkBox":case"switchButton":case"radioButton":e._setTemplate(s,e.cell.template,c);break;case"tags":case"checklist":case"collaborator":case"updatedBy":case"createdBy":case"multiComboInput":e._setTemplate(s,e.cell.template,c);break;case"attachment":e._setTemplate(s,"attachments",c);break;case"image":e._setTemplate(s,"images",c);break;case"email":e._setTemplate(s,"email",c);break;case"url":e._setTemplate(s,"url",c);break;case"richText":e._setTemplate(s,"richText",c);break;default:e._setTemplate(s,e.cell.template,c)}else{const i=c.firstChild;if(i&&i.classList&&e.toggleButton&&l._treeColumn&&c.children[1]){const e=c.children[0],i=c.children[1].children[0],r=c.children[1].children[1].firstChild,n=c.children[1].children[2];let s="";if(l._treeColumn){if(t.grouping.enabled){let e=a.level-1;t.appearance.showRowHeaderNumber&&e--,t.rowDetail.enabled&&e--,e<-1?s="":"multipleColumns"!==t.grouping.renderMode&&(s+='<div style="width: '+(1+e)*t.grouping.groupIndent+'px;"></div>')}else for(let e=0;e<a.level;e++)s+="<div class='smart-indent'></div>";if(a.checked?r.setAttribute("checked",""):!1===a.checked?r.removeAttribute("checked"):null===a.checked&&r.setAttribute("checked","indeterminate"),a.leaf?a.allowCheck?r.classList.remove("smart-visibility-hidden"):r.classList.add("smart-visibility-hidden"):a.allowCheck?r.classList.remove("smart-hidden"):r.classList.add("smart-hidden"),!l.autoGenerated){const e=a["column_"+l.dataField];e&&e._setStyle(c)}}a.allowCheck?t.checkBoxes.visible?r.classList.remove("smart-hidden"):r.classList.add("smart-hidden"):t.checkBoxes.visible||r.classList.add("smart-hidden"),"card"===t.view&&(r.classList.add("smart-hidden"),i.classList.add("smart-hidden")),e.innerHTML=s,i.classList.add("smart-visibility-hidden"),a.leaf?i.classList.add("smart-visibility-hidden"):(i.classList.remove("smart-visibility-hidden"),a.expanded?i.setAttribute("toggled",""):i.removeAttribute("toggled","")),t.grouping.enabled&&i.classList.add("smart-hidden"),a.data.isEmpty&&i.classList.add("smart-visibility-hidden"),n.innerHTML=d,t.appearance.showTooltips?n.setAttribute("title",t._unescapeString(d)):n.hasAttribute("title")&&n.removeAttribute("title")}else{const i=a["column_"+l.dataField];if(e.getAttribute("rowspan")&&(e.removeAttribute("rowspan"),e.removeAttribute("aria-rowspan"),e.style.height=""),e.getAttribute("colspan")&&(e.removeAttribute("colspan"),e.removeAttribute("aria-colspan")),i){if(i.colSpan>1){const a=t.columns.indexOf(l);let r=0;for(let e=a;e<a+i.colSpan;e++){const l=t.columns[e];l&&l.visible&&(r+=l.computedWidth)}e.style.width=r+"px",e.setAttribute("colspan",""),e.setAttribute("aria-colspan",i.colSpan),i._styleChanged=!0}let r=i.rowSpan;if(i.rowSpan>1){const l=t.rows.indexOf(a);let r=0;a.element.setAttribute("rowspan","");for(let e=l;e<=l+i.rowSpan-1;e++){const l=t.rows[e];l&&l.visible&&l.filtered&&(r+=l.cellHeight)}e.style.height=r+"px",e.setAttribute("rowspan",""),e.setAttribute("aria-rowspan",i.rowSpan),i._styleChanged=!0}else if(l.rowSpan&&!a._isMeasureRow){const n="number"==typeof l.rowSpan?l.rowSpan:l.rowSpan(s,a.visibleIndex,a.data),o=a.visibleIndex;let d=!1;for(let e=0;e<t._cellRowSpan.length;e++){const l=t._cellRowSpan[e];if(o>l[0]&&o<l[1]){d=!0;break}}if(a._rowSpan=n,n&&!d){let s=0;t._cellRowSpan.push([o,o+n,l.dataField]),t._cellRowSpan.maxSpan||(t._cellRowSpan.maxSpan=1),t._cellRowSpan.maxSpan=Math.max(n,t._cellRowSpan.maxSpan),a.element.setAttribute("rowspan","");for(let e=o;e<=o+n-1;e++){const l=t.rows[e];l&&l.visible&&l.filtered&&(s+=l.cellHeight)}e.style.height=s+"px",e.setAttribute("rowspan",""),e.setAttribute("aria-rowspan",n),i._styleChanged=!0,r=n}}if(1===i.colSpan&&e.hasAttribute("colspan")&&(e.style.width=l.computedWidth+"px",e.removeAttribute("colspan"),e.removeAttribute("aria-colspan"),i._styleChanged=!0),e.hasAttribute("rowspan")&&1===r&&(e.style.height="",e.removeAttribute("rowspan"),e.removeAttribute("aria-rowspan"),i._styleChanged=!0),c.textContent===d||l.formatFunction||("string"==typeof d&&d.indexOf("&")>=0?"card"===t.view?c.innerHTML=d:t.isScrolling?requestAnimationFrame((()=>{c.innerHTML=d})):c.innerHTML=d:c.textContent=d),i.column.autoGenerated||i._setStyle(c),t.appearance.showTooltips?(d&&(""+d).indexOf("&#")>=0&&(d=t._fromHTMLEntities(d)),c.setAttribute("title",i.tooltip||t._unescapeString(d))):c.hasAttribute("title")&&c.removeAttribute("title"),t.appearance.showTooltipsOverflow&&(!t.appearance.showTooltips&&c.hasAttribute("title")&&c.removeAttribute("title"),d&&d.length)){14*(d||"").length*.52>l.computedWidth?(d&&(""+d).indexOf("&#")>=0&&(d=t._fromHTMLEntities(d)),"image"!==l.template&&"attachment"===l.template&&c.setAttribute("title",i.tooltip||t._unescapeString(d))):!t.appearance.showTooltips&&c.hasAttribute("title")&&c.removeAttribute("title")}}else c.textContent=d}}if(c.className!==p&&(c.className=p),!t.appearance.displayLoadingIndicator||l.autoGenerated||t.dataSource.boundHierarchy?t.appearance.displayLoadingIndicator&&l.selectionColumn?e.removeAttribute("selected"):!l.autoGenerated&&c.firstChild&&c.firstChild.classList&&c.firstChild.classList.contains("smart-grid-cell-loading")&&(c.firstChild.classList.remove("smart-grid-cell-loading"),e.removeAttribute("selected")):(a.element.removeAttribute("focus"),e.removeAttribute("selected"),c.innerHTML='<div class="smart-grid-cell-loading"></div>'),l.formatFunction&&!a.data.isEmpty&&t.isInitialized&&!a.summaryRow){const i={row:a,column:l,cell:e.cell,oldValue:e.cell.oldValue,value:s,data:a.data,formattedValue:d,template:null};e.cell.canNotify=!1,a.canNotify=!1;const r=Object.assign({},{background:e.cell.background,color:e.cell.color,fontSize:e.cell.fontSize,fontFamily:e.cell.fontFamily,textDecoration:e.cell.textDecoration,fontWeight:e.cell.fontWeight,fontStyle:e.cell.fontStyle});if(t.hasAttribute("smart-blazor"))await l.formatFunction(i);else{const e=l.formatFunction(i);e&&(i.value=e)}c.style.background===r.background&&c.style.color===r.color&&c.style.fontSize===r.fontSize&&c.style.fontFamily===r.fontFamily&&c.style.textDecoration===r.textDecoration&&c.style.fontWeight===r.fontWeight&&c.style.fontStyle===r.fontStyle||(e.cell._styleChanged=!0,e.cell._setStyle(c)),e.cell.background===r.background&&e.cell.color===r.color&&e.cell.fontSize===r.fontSize&&e.cell.fontWeight===r.fontWeight&&e.cell.textDecoration===r.textDecoration&&e.cell.fontFamily===r.fontFamily&&e.cell.fontStyle===r.fontStyle||(e.cell._styleChanged=!0,e.cell._setStyle(c));let n=!0;if(i.value!==s){if(e.toggleButton){c.children[1].children[2].innerHTML=i.value}else c.innerHTML=i.value;n=!1}if(null!==i.template){if(e.toggleButton){if(c.children[1]){const e=c.children[1].children[2];e.innerHTML!==i.template&&(e.innerHTML=i.template)}}else if(c.innerHTML!==i.template){const e=document.createElement("div");e.innerHTML=i.template,e.innerHTML!==c.innerHTML&&(c.innerHTML=i.template)}n=!1}n&&(l.cellsFormat?c.textContent=d:c.textContent=s),e.cell.canNotify=!0,a.canNotify=!0}if(l.tooltipRenderer&&!a.summaryRow&&!a.autoGenerated){const e=l.tooltipRenderer(a.id,l.dataField,s,d,a.data);null!=e&&""!==e&&(c.setAttribute("data-title",e),c.onmouseenter=function(l){t._createTooltip(l,e,c,"top")},c.onmouseleave=function(){t._cellTooltip&&(t._cellTooltip.style.visibility="hidden")})}if(l.cellsRenderer&&!a.summaryRow){const t=l.cellsRenderer(a.id,l.dataField,s,a.data,c);if(null!=t)if("string"==typeof t)if(e.toggleButton){if(c.children[1]){const e=c.children[1].children[2];e.innerHTML!==t&&(e.innerHTML=t)}}else c.innerHTML!==t&&(c.innerHTML=t);else t instanceof HTMLElement&&c.firstChild!==t&&(c.innerHTML="",c.appendChild(t))}if(!a.data.isEmpty&&t.isInitialized&&e._applyConditionalFormattingToCell(e.cell,t,c),t.grouping.enabled&&t.dataSource&&t.dataSource.groupBy&&t.dataSource.groupBy.length>0&&l===t._firstVisibleColumn&&t.rowDetail.enabled&&t.rowDetail.visible&&c.querySelector("[toggle-button]")){const e=c.querySelector("[toggle-button]");e.classList.remove("smart-visibility-hidden"),e.classList.add("row-detail"),a.element.toggleDetailButton=e,a.element.toggleDetailButton.setAttribute("title",t.localize(a.showDetail?"collapseRow":"expandRow",{elementType:"Grid"})),e.onpointerdown=function(e){a.showDetail=!a.showDetail,e.stopPropagation(),e.preventDefault()}}}_autoWrap(){const e=this,t=e.firstChild,l=e.cell.grid;l.layout.allowCellsWrapShortcut&&e.hasAttribute("focus")&&e.hasAttribute("selected")&&(t.offsetWidth<t.scrollWidth?e._popupCellContent(t.innerHTML,e.cell):l._cellContentPopup&&l._cellContentPopup.remove())}_popupCellContent(e,t){const l=this,a=t.grid;let i=a._cellContentPopup;if(!a._cellContentPopup){i=document.createElement("div");const t=document.createElement("span"),l=document.createElement("div"),r=document.createElement("div");i.style.minHeight="0px",i.style.minWidth="0px",i.setAttribute("theme",a.theme),i.classList.add("smart-grid-cell-content-popup"),r.appendChild(l),r.classList.add("smart-grid-text-area-container"),l.innerHTML=e,l.classList.add("smart-grid-cell-content-popup-content"),t.classList.add("smart-hidden"),t.classList.add("close-button"),t.classList.add("smart-grid-icon"),t.classList.add("smart-icon-cancel-circled"),t.onclick=function(){a._cellContentPopup.parentNode.removeChild(a._cellContentPopup)},i.classList.add("smart-grid-text-area-dialog"),i.appendChild(r),i.appendChild(t),a._cellContentPopup=i}i.querySelector(".smart-grid-cell-content-popup-content").innerHTML=e;const r=a.offset(a.$.scrollView);i.style.top=a._offsetTop(l)-r.top+"px",i.style.left=a._offsetLeft(l)-r.left+"px",i.style.width=l.offsetWidth-4+"px",a.$.scrollView.appendChild(i)}_applyConditionalFormattingToCell(e,t,l){const a=this,i=e.column.dataField,r=e.column,n=e.row,s=e.row.index,o=n._style,d=n.data&&n.data.$?n.data.$.id:null;if(e.column.autoGenerated){const l=t._conditionalColors;if(l&&e.column.rowHeaderColumn)if("border"===l.decorate){const t=l.colors;t&&t[d]?(e.element.classList.add("smart-decorate"),e.element.style.setProperty("--smart-decorate-color",t[d].color)):e.element.classList.remove("smart-decorate")}else e.element.classList.remove("smart-decorate")}else{if(t._conditionalColors){const r=t._conditionalColors,s=()=>{e.row.style&&e.row.style[e.column.dataField]&&(e._styleChanged=!0,e.row.style[e.column.dataField].background&&(e.background=e.row.style[e.column.dataField].background),e.row.style[e.column.dataField].color&&(e.color=e.row.style[e.column.dataField].color))};if("border"!==r.decorate){const t=r.colors;if(t&&t[d]){const o="cell"===r.decorate?t[d][i]:t[d].color;if(o){const t=new Smart.Color(o).getInvertedColor();a.cell.canNotify=!1,n.canNotify=!1,e.background=o,e.color=t,s(),a.cell._setStyle(l),a.cell.canNotify=!0,n.canNotify=!0}else e.background&&e.color&&(a.cell.canNotify=!1,n.canNotify=!1,e.background=null,e.color=null,s(),a.cell._setStyle(l),a.cell.canNotify=!0,n.canNotify=!0)}else e.background&&e.color&&(a.cell.canNotify=!1,n.canNotify=!1,e.background=null,e.color=null,o&&(e._styleChanged=!0,e.background=o.background,e.color=o.color),s(),a.cell._setStyle(l),a.cell.canNotify=!0,n.canNotify=!0)}else e.background&&e.color&&(a.cell.canNotify=!1,n.canNotify=!1,e.background=null,e.color=null,o&&(e._styleChanged=!0,e.background=o.background,e.color=o.color),s(),a.cell._setStyle(l),a.cell.canNotify=!0,n.canNotify=!0)}if(a.cell._customInlineStyles&&(a.cell.canNotify=!1,n.canNotify=!1,a.cell._styleChanged=!0,a.cell.background=null,a.cell.color=null,a.cell.textDecoration=null,a.cell._setStyle(l),a.cell.canNotify=!0,n.canNotify=!0),r.cellsCSSInlineRules){const e=r.cellsCSSInlineRules;for(let i=0;i<e.length;i++){const r=e[i];if(!r.field)break;const s=r.condition;let o=r.value,d=r.value2,c=n.data[r.field],m=t.columnByDataField[r.field];if("string"==typeof c&&(o=""+o,d=""+d),"date"===m.dataType||"dateTime"===m.dataType){if(o=Smart.Utilities.DateTime.ParseDate(o,m.cellsFormat),void 0!==d){d=Smart.Utilities.DateTime.ParseDate(d,m.cellsFormat)}}"number"!==m.dataType&&"float"!==m.dataType&&"decimal"!==m.dataType&&"currency"!==m.dataType||(o=parseFloat(o),void 0!==d&&(d=parseFloat(d))),"boolean"===m.dataType&&("string"==typeof o&&(o="true"===o.toLowerCase()),"1"===o&&(o=!0),"0"===o&&(o=!1),void 0!==d&&("string"==typeof d&&(d="true"===d.toLowerCase()),"1"===d&&(d=!0),"0"===d&&(d=!1)));let u=!1;switch(s){case">":u=o<c;break;case">=":u=o<=c;break;case"<":u=o>c;break;case"<=":u=o>=c;break;case"=":u=o===c;break;case"<>":u=o!==c;break;case"between":u=c>=o&&c<=d}u&&(a.cell.canNotify=!1,n.canNotify=!1,a.cell._styleChanged=!0,a.cell.background=r.background,a.cell.color=r.color,a.cell.textDecoration=r.textDecoration,a.cell._setStyle(l),a.cell.canNotify=!0,n.canNotify=!0),a.cell._customInlineStyles=!0}}if(t._conditionalFormatting&&t._conditionalFormatting[i]){const e=t._conditionalFormatting[i][s];a.cell.canNotify=!1,n.canNotify=!1,e?(a.cell._styleChanged=!0,a.cell.background=e.background,a.cell.color=e.color,a.cell.fontFamily=e.fontFamily,a.cell.fontSize=e.fontSize,a.cell._setStyle(l)):a.cell._styleChanged||(o&&o._changed?(a.cell._styleChanged=!0,a.cell.background=o.background,a.cell.color=o.color,a.cell.fontFamily=o.fontFamily,a.cell.fontSize=o.fontSize,a.cell._setStyle(l)):(a.cell._styleChanged=!0,a.cell.background=null,a.cell.color=null,a.cell.fontFamily=null,a.cell.fontSize=null,a.cell._setStyle(l))),a.cell.canNotify=!0,n.canNotify=!0}else t._conditionalFormattingChanged&&!a.cell._styleChanged&&(a.cell.canNotify=!1,n.canNotify=!1,o&&o._changed?(a.cell._styleChanged=!0,a.cell.background=o.background,a.cell.color=o.color,a.cell.fontFamily=o.fontFamily,a.cell.fontSize=o.fontSize,a.cell._setStyle(l)):(a.cell._styleChanged=!0,a.cell.background=null,a.cell.color=null,a.cell.fontFamily=null,a.cell.fontSize=null,a.cell._setStyle(l)),a.cell.canNotify=!0,n.canNotify=!0)}}_rotateCellContent(e,t,l){const a=document.createElement("span");return e.innerHTML="",a.innerHTML=l,e.appendChild(a),a.className="rotate",a.style.transform="rotate("+t.cellsRotationAngle+"deg)",this.grid._recycleRotate(e,a,t.cellsAlign,t.cellsVerticalAlign,l)}_getCellAlignment(e,t){const l=e["column_"+t.dataField],a=l&&l.verticalAlign||t.cellsVerticalAlign;let i=l&&l.align||t.cellsAlign;const r={align:"",verticalAlign:""};if(!l)return{align:"align-left",verticalAlign:"align-middle"};switch(l.grid.rightToLeft&&("left"===i?i="right":"right"===i&&(i="left")),i){case"left":r.align="align-left";break;case"center":case"middle":r.align="align-center";break;case"right":r.align="align-right"}switch(a){case"top":r.verticalAlign="align-top";break;case"center":case"middle":r.verticalAlign="align-middle";break;case"bottom":r.verticalAlign="align-bottom"}return r}template(){return""}_detach(){this.element=null,this.cell=null}onDetached(){this._detach()}});class e{render(e){const t=this,l={svg:null,roundedCorners:e.roundedCorners||0,padding:e.padding||null,width:e.width||100,height:e.height||30,gap:e.gap||5,strokeWidth:e.strokeWidth||2,type:e.type||"column",colors:e.colors||["var(--smart-primary)"],points:e.points,labels:e.labels,colorFunction:e.colorFunction,tooltipFormatFunction:e.tooltipFormatFunction,min:e.min,max:e.max};switch(l.svg=document.createElementNS("http://www.w3.org/2000/svg","svg"),l.svg.setAttribute("width",l.width),l.svg.setAttribute("height",l.height),function(e){Array.isArray(e.colors)||(e.colors=t.colors.split(",")),e.points&&(Array.isArray(e.points)?e.points=e.points.map((e=>parseInt(e,10))):(e.points&&"number"==typeof e.points&&(e.points=""+e.points),e.points=e.points.split(",").map((e=>parseInt(e,10)))))}(l),l.type){case"column":return t.column(l);case"bar":return t.bar(l);case"line":return t.line(l);case"pie":return t.pie(l);case"stacked":return t.stacked(l)}}colorFunction(e,t){const l=function(e,t){e===t&&(t=e+100);const l=(t-e)/5;return[e+l,e+2*l,e+3*l,e+4*l]}(e,t),a=["#D50000","#F4511E","#F6BF26","#039BE5","#33B679"];return e=>e<l[0]?a[0]:e<l[1]?a[1]:e<l[2]?a[2]:e<l[3]?a[3]:a[4]}column(e){const t=e.gap/e.points.length+e.width/e.points.length-e.gap,l=e.max||Math.max(...e.points),a=e.min||Math.min(...e.points),i=e.height/(Math.abs(a)+Math.abs(l)),r=Math.abs(a)*i;return e.colorFunction||(e.colorFunction=this.colorFunction(a,l)),e.points.forEach(((n,s)=>{isNaN(n)&&(n=0);const o=document.createElementNS("http://www.w3.org/2000/svg","rect"),d=Math.abs(n)*i;o.setAttribute("x",s*t+s*e.gap),o.setAttribute("point",n);let c=n>=0?"var(--smart-primary)":"var(--smart-error)";if(l>0&&a<0?n>=0?o.setAttribute("y",e.height-r-1-d):o.setAttribute("y",e.height-r-1):l>=0&&a>=0?o.setAttribute("y",e.height-d):a<=0&&l<=0&&o.setAttribute("y",d),o.setAttribute("width",t),o.setAttribute("height",d),e.colorFunction){const t=e.colorFunction(n);t&&(c=t)}o.setAttribute("fill",c);const m=e.tooltipFormatFunction?e.tooltipFormatFunction(n):n;o.setAttribute("data-title",m),e.svg.appendChild(o)})),e.svg.outerHTML}bar(e){const t=e.padding||0;let l=e.roundedCorners||0;"boolean"==typeof l&&(l=l?3:0);const a=e.height-3-2*t,i=Math.max(5,e.gap/e.points.length+a/e.points.length-e.gap),r=e.max||Math.max(...e.points),n=e.min||Math.min(...e.points);let s=e.width/(Math.abs(n)+Math.abs(r));const o=Math.abs(n)*s;return e.colorFunction||(e.colorFunction=this.colorFunction(n,r)),e.points.forEach(((a,d)=>{isNaN(a)&&(a=0);const c=document.createElementNS("http://www.w3.org/2000/svg","rect"),m=Math.abs(a)*s;c.setAttribute("y",d*i+d*e.gap+t),c.setAttribute("point",a),l>0&&(c.setAttribute("rx",l),c.setAttribute("ry",l));let u=a>=0?"var(--smart-primary)":"var(--smart-error)";if(r>0&&n<0?a>=0?c.setAttribute("x",o):c.setAttribute("x",o-m):(r>=0&&n>=0||n<=0&&r<=0)&&c.setAttribute("x",0),c.setAttribute("width",m),c.setAttribute("height",i),e.colorFunction){const t=e.colorFunction(a);t&&(u=t)}c.setAttribute("fill",u);const p=e.tooltipFormatFunction?e.tooltipFormatFunction(a):a;c.setAttribute("data-title",p),e.svg.appendChild(c)})),e.svg.outerHTML}line(e){const t=e.width/(e.points.length-1),l=e.max||Math.max(...e.points),a=e.min||Math.min(...e.points),i=e.height/(Math.abs(a)+Math.abs(l)),r=Math.abs(a)*i;e.colorFunction||(e.colorFunction=this.colorFunction(a,l));let n="var(--smart-primary)",s=[],o=[];e.svg.setAttribute("overflow","visible");for(let l=0;l<e.points.length;l++){let a=e.points[l];isNaN(a)&&(a=0);const n=l*t,d=e.height-r-a*i;o.push({x:n,y:d,point:a}),2===o.length&&(s.push(o),o=[]),s.length>0&&0===o.length&&o.push(s[s.length-1][1])}for(let t=0;t<s.length;t++){const l=s[t];if(e.colorFunction){const t=e.colorFunction(l[0].point);t&&(n=t)}if(0===t){const t=document.createElementNS("http://www.w3.org/2000/svg","circle");e.svg.appendChild(t),t.setAttribute("cx",l[0].x),t.setAttribute("cy",l[0].y),t.setAttribute("r",3),t.setAttribute("fill",n);const a=e.tooltipFormatFunction?e.tooltipFormatFunction(l[0].point):l[0].point;t.setAttribute("data-title",a),t.style.display="none"}const a=document.createElementNS("http://www.w3.org/2000/svg","line");e.svg.appendChild(a),a.setAttribute("x1",l[0].x),a.setAttribute("y1",l[0].y),a.setAttribute("x2",l[1].x),a.setAttribute("y2",l[1].y);const i=document.createElementNS("http://www.w3.org/2000/svg","circle");e.svg.appendChild(i),i.setAttribute("cx",l[1].x),i.setAttribute("cy",l[1].y),i.setAttribute("r",3),i.setAttribute("fill",n);const r=e.tooltipFormatFunction?e.tooltipFormatFunction(l[1].point):l[1].point;i.setAttribute("data-title",r),i.style.display="none",a.setAttribute("fill","none"),a.setAttribute("stroke-width",e.strokeWidth),a.setAttribute("stroke",n)}return e.svg.outerHTML}pie(e){const t=Math.min(e.width,e.height)/2,l=e.width/2,a=e.height/2,i=e.points.reduce(((e,t)=>e+Math.abs(t)),0);let r=0;const n=e.max||Math.max(...e.points),s=e.min||Math.min(...e.points);return e.colorFunction||(e.colorFunction=this.colorFunction(s,n)),e.points.forEach((n=>{isNaN(n)&&(n=0);let s=e.color;if(e.colorFunction){const t=e.colorFunction(n);t&&(s=t)}const o=Math.abs(n)/i*2*Math.PI,d=r+o,c=l+t*Math.cos(r),m=a+t*Math.sin(r),u=l+t*Math.cos(d),p=a+t*Math.sin(d),g=document.createElementNS("http://www.w3.org/2000/svg","path"),f=o>Math.PI?1:0,h=`M ${l},${a} L ${c},${m} A ${t},${t} 0 ${f} 1 ${u},${p} Z`;g.setAttribute("d",h),g.setAttribute("fill",s);const b=e.tooltipFormatFunction?e.tooltipFormatFunction(n):`${(n/i*100).toFixed(2)}%`;g.setAttribute("data-title",b),e.svg.appendChild(g),r=d})),e.svg.outerHTML}stacked(e){let t=e.points.reduce(((e,t)=>e+t),0),l=(e.points.length-1)*e.gap,a=e.width-l;const i=e.max||Math.max(...e.points),r=e.min||Math.min(...e.points);e.colorFunction||(e.colorFunction=this.colorFunction(r,i));let n=0;return e.points.forEach(((l,i)=>{isNaN(l)&&(l=0);let r=e.colors[i%e.colors.length];if(e.colorFunction){const t=e.colorFunction(l);t&&(r=t)}const s=l/t*a,o=document.createElementNS("http://www.w3.org/2000/svg","rect");o.setAttribute("x",n),o.setAttribute("y",0),o.setAttribute("width",s),o.setAttribute("height",e.height),o.setAttribute("fill",r);const d=document.createElementNS("http://www.w3.org/2000/svg","title");d.textContent=l,o.appendChild(d),e.svg.appendChild(o),n+=s+e.gap})),e.svg.outerHTML}}})();
1428
+ (()=>{Smart.Utilities.Assign("Grid.Cell",class{constructor(e,t){const l=this;if(l.row=e,l.column=t,l.grid=e.grid,l.rowSpan=1,l.colSpan=1,l.value=void 0,l.fontSize=null,l.fontWeight=null,l.fontFamily=null,l.fontStyle=null,l.color=null,l.background=null,l.textDecoration=null,l.tooltip=null,l.align=null,l.verticalAlign=null,l.readonly=!1,l.oldValue=void 0,l._updating=!1,l.styleChanged=!0,l.editor=null,l.template=null,l.isEditing=!1,l.canNotify=!0,l.selected=!1,l.focused=!1,l.error=!1,l.format=null,l.formula=null,e._style){const a=e._style;t.autoGenerated||(l.color=void 0!==a.color?a.color:null,l.background=void 0!==a.background?a.background:null,l.fontFamily=void 0!==a.fontFamily?a.fontFamily:null,l.fontSize=void 0!==a.fontSize?a.fontSize:null,l.fontStyle=void 0!==a.fontStyle?a.fontStyle:null,l.textDecoration=void 0!==a.textDecoration?a.textDecoration:null,l.fontWeight=void 0!==a.fontWeight?a.fontWeight:null),a[t.dataField]&&["color","background","textDecoration","fontStyle","fontFamily","fontWeight","fontSize"].forEach((e=>{a[t.dataField][e]&&(l[e]=a[t.dataField][e],l._styleChanged=!0)}))}if(l.grid&&l.grid.formulas){let a=e.data[t.dataField];t.formula&&(l.formula=l._parseFormula(t.formula)),a&&(""+a).startsWith("=")&&(l.formula=l._parseFormula(""+a)),l._formula=t.formula}return new Proxy(l,{deleteProperty:function(e,t){return delete e[t],!0},get:function(a,i){if("value"===i){const a=l.column.displayField?l.row.data[l.column.displayField]:l.row.data[l.column.dataField];if(l.grid&&l.grid.formulas&&(l.formula||t.formula)){const a=l.grid._formulaParser;if(a){if(l.grid&&l.grid.formulas&&l._formula!==t.formula){let a=e.data[t.dataField];t.formula&&(l.formula=l._parseFormula(t.formula)),a&&(""+a).startsWith("=")&&(l.formula=l._parseFormula(""+a)),l._formula=t.formula}return a.parse(l.formula.slice(1))}}return a}if("editor"===i||"template"===i)return a[i]||l.column[i];if("focused"===i){if(l.grid.selection.allowCellSelection&&l.grid._selection.focusedCell&&l.grid._selection.focusedCell.id===l.row.id&&l.grid._selection.focusedCell.dataField===l.column.dataField)return!(l.grid&&l.grid.dataSource.virtualDataSource&&!l.grid.dataSource.id)||l.grid._selection.focusedCell.id===l.row.index;if(l.grid.selection.allowRowSelection&&l.grid._selection.focusedCell&&l.grid._selection.focusedCell.id===l.row.id&&l.grid._selection.focusedCell.dataField===l.column.dataField)return!(l.grid&&l.grid.dataSource.virtualDataSource&&!l.grid.dataSource.id)||l.grid._selection.focusedCell.id===l.row.index;const e=l.parent();return!!(e&&l.grid.selection.allowCellSelection&&l.grid._selection.focusedCell&&l.grid._selection.focusedCell.id===e.row.id&&l.grid._selection.focusedCell.dataField===e.column.dataField)}if("selected"===i)return!0===l.row.getProperty("selected")||(!0===l.column.getProperty("selected")||!!l.grid._selection.cells["row"+l.row.id]&&l.grid._selection.cells["row"+l.row.id][l.column.dataField]);if("modifiedValue"===i){l.grid._cellsUpdatedValues||(l.grid._cellsUpdatedValues=[]);const e=l.grid._cellsUpdatedValues[l.row.id+"_"+l.column.dataField];return void 0!==e?e:a.value}return a[i]},set:function(e,a,i){const r=this.get(e,a);if(r===i)return!0;if(e[a]=i,"element"===a||"isEditing"===a||"oldValue"===a||"_updating"===a||"notifyFn"===a||a.startsWith("_")||"canNotify"===a)return!0;if("error"===a)return!0;if("focused"===a&&(l.grid._selection.focusedCell={id:l.row.id,dataField:l.column.dataField,value:l.value,index:l.row.index}),"colSpan"!==a&&"rowSpan"!==a||i>=0&&-1===l.grid._cellsMerge.indexOf(l)&&l.grid._cellsMerge.push(l),"row"===a||"column"===a||"grid"===a||"styleChanged"===a||"formula"===a)return"formula"===a&&(l.formula=l._parseFormula(l.formula)),!0;if("background"!==a&&"fontSize"!==a&&"fontWeight"!==a&&"fontFamily"!==a&&"textDecoration"!==a&&"color"!==a&&"fontStyle"!==a||(l.grid._cellStyles["row"+l.row.id]=!0,l.grid._cellStyles.length++,l._styleChanged=!0),"value"===a){void 0===l.oldValue&&(l.oldValue=r),null==i&&delete l._formula;(()=>{if(l.grid.dataSource.boundSource.canNotify=!1,null===i&&(l.column.allowNull||(i="number"===l.column.dataType||"int"===l.column.dataType||"float"===l.column.dataType||"integer"===l.column.dataType?0:"date"===l.column.dataType?new Date:"boolean"!==l.column.dataType&&"bool"!==t.dataType&&"")),void 0===i&&(i=null),null!==i&&void 0!==i.label&&void 0!==i.value)l.row.data[l.column.displayField]=i.label,l.row.data[l.column.dataField]=i.value;else if(l.column.valueField&&(l.row.data[l.column.valueField]=i),l.row.data[l.column.dataField]=i,l.column.displayField!==l.column.dataField&&"object"!=typeof i)if(l.column._dataSource){let e=i;for(let t=0;t<l.column._dataSource.length;t++)if(l.column._dataSource[t].value===i){e=l.column._dataSource[t].label;break}l.row.data[l.column.displayField]=e}else l.row.data[l.column.displayField]=i;const e=l.grid.dataSource.dataItemById[l.row.id];if(e){const t=e.$.index;if(l.grid.dataSource)if(null!==i&&i.label&&i.value&&l.column.displayField!==l.column.dataField)l.grid._sortedColumns&&l.grid._sortedColumns.length>0?(e[l.column.dataField]=i.value,e[l.column.displayField]=i.label):(l.grid.dataSource.boundSource[t][l.column.dataField]=i.value,l.grid.dataSource.boundSource[t][l.column.displayField]=i.label);else if(i!==l.grid.dataSource.boundSource[t][l.column.dataField])if(l.grid._sortedColumns&&l.grid._sortedColumns.length>0)e[l.column.dataField]=i;else if(l.grid.dataSource.boundHierarchy&&l.grid.dataSource.childrenDataField){const t=(e=>function e(t,a){for(let i=0;i<t.length;i++){const r=t[i];if(r.id===a)return r;if(r[l.grid.dataSource.childrenDataField]&&r[l.grid.dataSource.childrenDataField].length>0){const t=e(r[l.grid.dataSource.childrenDataField],a);if(t)return t}}return null}(l.grid.dataSource.boundSource,e))(e.$.id);t&&(t[l.column.dataField]=i),e[l.column.dataField]=i}else l.grid.dataSource.boundSource[t][l.column.dataField]=i}l.grid.dataSource.boundSource.canNotify=!0,l.grid.onCellValueChanged&&i!==r&&l.grid.onCellValueChanged({id:l.row.id,dataField:l.column.dataField,value:i,oldValue:r})})()}return"selected"===a?(l.grid._selection.cells["row"+l.row.id]&&(delete l.grid._selection.cells["row"+l.row.id][l.column.dataField],1===Object.getOwnPropertyNames(l.grid._selection.cells["row"+l.row.id]).length&&delete l.grid._selection.cells["row"+l.row.id]),l.grid._selection.cells["column"+l.column.dataField]&&(delete l.grid._selection.cells["column"+l.column.dataField][l.row.id],1===Object.getOwnPropertyNames(l.grid._selection.cells["column"+l.column.dataField]).length&&delete l.grid._selection.cells["column"+l.column.dataField]),i&&(l.grid._selection.cells["row"+l.row.id]||(l.grid._selection.cells["row"+l.row.id]=[]),l.grid._selection.cells["column"+l.column.dataField]||(l.grid._selection.cells["column"+l.column.dataField]=[]),l.grid._selection.cells["row"+l.row.id][l.column.dataField]=!0,l.grid._selection.cells["column"+l.column.dataField][l.row.id]=!0),l.grid._recycle(!1,!0,!1),l.propertyChanged&&l.propertyChanged(name.substring(1),r),!0):!(!l._updating&&l.canNotify)||(l.grid._recycle(),!l.row.canNotify||(l.propertyChanged&&l.propertyChanged(name.substring(1),r),!0))}})}_parseFormula(e){const t=this.row;if(!e)return e;return"string"!=typeof e&&(e=""+e),!1===e.startsWith("=")&&(e="="+e),e=function(e,t){return e.replace(/COL\(([^)]+)\)/g,((e,l)=>`${l}${t}`))}(e,1+t.index)}setStyle(e){this.setProperties(e)}_setStyle(e){const t=this;if(t._styleChanged){if(!t.grid._cellStyles.length)return;let l="";const a={background:"background",color:"color",fontSize:"font-size",fontFamily:"font-family",fontWeight:"font-weight",fontStyle:"font-style",textDecoration:"text-decoration"},i=e=>{const i=t[e];if(""===i||null===i)return;const r=a[e];l+=`${r}: ${i};`},r=["background","color","fontSize","fontFamily","fontWeight","fontStyle","textDecoration"];for(let e=0;e<r.length;e++)i(r[e]);e.getAttribute("style")!==l&&(""===l?e.removeAttribute("style"):e.setAttribute("style",l)),""!==e.style.paddingBottom&&(e.style.paddingBottom=""),t._styleChanged=!1}t.grid&&!t.grid.appearance.showSelectionOnTop||t.selected&&(t.background||t.color)&&(e.style.background="",e.style.color="")}getFormattedValue(e,t){const l=this;if(null==e||""===e)return e;if(l.column.placeholder&&e===l.column.placeholder)return e;if(!t)return""+e;if(l.column._cellsCachedValues||(l.column._cellsCachedValues=[]),l.column._cellsCachedValues[""+e+t+l.column.grid.locale])return l.column._cellsCachedValues[""+e+t+l.column.grid.locale];if("date"===l.column.dataType||"datetime"===l.column.dataType||"time"===l.column.dataType){if("dateRangeInput"===l.column.editor.template){if(Array.isArray(e)){const a=l.formatDate(e[0],t)+" - "+l.formatDate(e[1],t);return l.column._cellsCachedValues[""+e+t+l.column.grid.locale]=a,a}{const a=l.formatDate(e,t);return l.column._cellsCachedValues[""+e+t+l.column.grid.locale]=a,a}}let a=l.formatDate(e,t);return"1/1/0001 12:00 AM"===a&&(a=""),l.column._cellsCachedValues[""+e+t+l.column.grid.locale]=a,a}if("int"===l.column.dataType||"int64"===l.column.dataType||"float"===l.column.dataType||"number"===l.column.dataType){let a=l.formatNumber(e,t);return"NaN"===a&&(a=""),l.column._cellsCachedValues[""+e+t+l.column.grid.locale]=a,a}if("any"===l.column.dataType||"string"===l.column.dataType&&t&&t.length){let a=!1;const i=""+e;if((i.indexOf("/")>=0||i.indexOf("-")>=0||i.indexOf(":")>=0)&&(t.indexOf("d")>=0&&t.indexOf("M")>=0&&(a=!0),(t.indexOf("d")>=0||t.indexOf("M")>=0||t.indexOf("y")>=0||t.indexOf("h")>=0||t.indexOf("H")>=0||t.indexOf("m")>=0)&&(a=!0)),a){let a=l.formatDate(e,t);return"1/1/0001 12:00 AM"===a&&(a=""),l.column._cellsCachedValues[""+e+t+l.column.grid.locale]=a,a}{"string"==typeof e&&(e=parseFloat(e));let a=l.formatNumber(e,t);return"NaN"===a&&(a=""),l.column._cellsCachedValues[""+e+t+l.column.grid.locale]=a,a}}return e}formatDate(e,t){if(!Smart.Utilities.DateTime)return e;const l=this,a=l.grid;if(l.column.formatSettings.Intl&&l.column.formatSettings.Intl.DateTimeFormat){return new Intl.DateTimeFormat(this.grid.locale,l.column.formatSettings.Intl.DateTimeFormat).format(e)}!t&&l.column.formatSettings.dateFormat&&(t=l.column.formatSettings.dateFormat);try{const l=new Smart.Utilities.DateTime(e);l.calendar.locale=a.locale,a.messages[a.locale]&&a.messages[a.locale].calendar&&(a.messages[a.locale].calendar.months&&(l.calendar.months=a.messages[a.locale].calendar.months),a.messages[a.locale].calendar.days&&(l.calendar.days=a.messages[a.locale].calendar.days),void 0!==a.messages[a.locale].calendar.firstDay&&(l.calendar.firstDay=a.messages[a.locale].calendar.firstDay),void 0!==a.messages[a.locale].calendar.eras&&(l.calendar.eras=a.messages[a.locale].calendar.eras),void 0!==a.messages[a.locale].calendar.AM&&(l.calendar.AM=a.messages[a.locale].calendar.AM),void 0!==a.messages[a.locale].calendar.PM&&(l.calendar.PM=a.messages[a.locale].calendar.PM),void 0!==a.messages[a.locale].calendar["/"]&&(l.calendar["/"]=a.messages[a.locale].calendar["/"]),void 0!==a.messages[a.locale].calendar[":"]&&(l.calendar[":"]=a.messages[a.locale].calendar[":"]),l.calendar.today=a.messages[a.locale].today);let i=l.toString(t);return i!==a.messages[a.locale].today||a.showTodayDateAsString||(l.showTodayDateAsString=!1,i=l.toString(t),delete l.showTodayDateAsString),i}catch(t){return e}}formatNumber(e,t){if(!Smart.Utilities.NumberRenderer)return e;const l=this,a=l.grid;if(l.column.formatSettings.Intl&&l.column.formatSettings.Intl.NumberFormat){if(l.column.formatSettings.Intl.NumberFormat.currency&&Smart.Utilities.CurrencyFormatter){const a=t.NumberFormat&&void 0!==t.NumberFormat.maximumFractionDigits?t.NumberFormat.maximumFractionDigits:2,i=(new Smart.Utilities.CurrencyFormatter).format(e,{decimalPlaces:a,currency:l.column.formatSettings.Intl.NumberFormat.currency});return"accounting"===l.column.formatSettings.Intl.NumberFormat.currency.currencySign&&e<0?"("+i.replace("-","")+")":i}if(l.column.formatSettings.Intl.NumberFormat.locale){return new Intl.NumberFormat(l.column.formatSettings.Intl.NumberFormat.locale,t.NumberFormat).format(e)}{const a=new Intl.NumberFormat(this.grid.locale,t.NumberFormat).format(e);if("percent"===l.column.formatSettings.Intl.NumberFormat.style){const t=void 0!==l.column.formatSettings.Intl.NumberFormat.minimumFractionDigits?l.column.formatSettings.Intl.NumberFormat.minimumFractionDigits:2;return new Intl.NumberFormat(this.grid.locale,{style:"decimal",minimumFractionDigits:t}).format(100*e)+" %"}return"squaremeter"===l.column.formatSettings.Intl.NumberFormat.type?a+" m²":"cubicmeter"===l.column.formatSettings.Intl.NumberFormat.type?a+" m³":a}}const i=new Smart.Utilities.NumberRenderer;if(i.localizationObject){const e=l.column.formatSettings,t=a.messages[a.locale]?a.messages[a.locale].calendar:{};e.decimalPlaces&&(i.localizationObject.decimalPlaces=e.decimalPlaces),(e.decimalSeparator||t.decimalSeparator)&&(i.localizationObject.decimalSeparator=e.decimalSeparator||t.decimalSeparator,i.localizationObject.decimalseparator=i.localizationObject.decimalSeparator),(e.thousandsSeparator||t.thousandsSeparator)&&(i.localizationObject.thousandsSeparator=e.thousandsSeparator||t.thousandsSeparator,i.localizationObject.thousandsseparator=i.localizationObject.thousandsSeparator),i.localizationObject.currencysymbol=t.currencySymbol,i.localizationObject.currencysymbolposition=t.currencySymbolPosition,e.prefix&&(i.localizationObject.currencysymbol=e.prefix),e.sufix&&(i.localizationObject.currencysymbol=e.sufix,i.localizationObject.currencysymbolposition="after")}const r=i.formatNumber(e,t);return void 0===r?e:e<0&&l.column.formatSettings.negativeWithBrackets?"("+r+")":r}refresh(){const e=this;if(e.element){const t=e.element.firstChild;e._setStyle(t)}}autoWrap(){const e=this;e.element&&e.element._autoWrap()}setProperties(e){const t=this;t._updating=!0;for(let l in e)t[l]=e[l];t._updating=!1,t.grid._recycle()}createElement(){const e=document.createElement("smart-grid-cell");return e.setAttribute("role","gridcell"),this.element=e,e._initialize(this),e}render(){this.element&&this.element._render()}parent(e){const t=this,l=t.row,a=t.column.dataField,i=t.grid;if(!i._cellsMerge.length)return null;if(t.__parentCells&&void 0!==t.__parentCells["row"+l.id+"_column_"+a])return t.__parentCells["row"+l.id+"_column_"+a];let r=i.getVisibleRows();i.paging.enabled&&"page"===i.selection.selectAllMode&&(r=r.slice(i.paging.pageIndex*i.paging.pageSize,(i.paging.pageIndex+1)*i.paging.pageSize)),t.__parentCells||(t.__parentCells=[]);for(let n=0;n<i._cellsMerge.length;n++){const s=i._cellsMerge[n];let o=[],d=[];if(o.push(s.row),s.rowspan>1){const e=r.indexOf(s.row);if(e>=0)for(let t=e;t<e+s.rowSpan;t++)r[t]&&-1===o.indexOf(r[t])&&o.push(r[t])}if(d.push(s.column.dataField),s.colspan>1){const e=i.columns.indexOf(i.columnByDataField[s.column.dataField]);for(let t=e;t<e+s.colSpan;t++)i.columns[t]&&-1===d.indexOf(i.columns[t].dataField)&&d.push(i.columns[t].dataField)}if(o.indexOf(l)>=0&&d.indexOf(a)>=0){if(e){const e={cell:s.row.getCell(s.column.dataField),rows:o,columns:d,row:s.row,column:s.column,endRow:o[o.length-1],endColumn:i.columnByDataField[d[d.length-1]]};return t.__parentCells["row"+l.id+"_column_"+a]=e,e}const r=s.row.getCell(s.column.dataField);return t.__parentCells["row"+l.id+"_column_"+a]=r,r}}return t.__parentCells["row"+l.id+"_column_"+a]=null,null}}),Smart("smart-grid-cell",class extends Smart.BaseElement{static get properties(){return{}}get hasStyleObserver(){return!1}get enableShadowDOM(){return!1}addThemeClass(){}addDefaultClass(){}get isUtilityElement(){return!0}_refresh(){const e=this;e.innerHTML="",e._initialize(e.cell)}_createToggleButton(e,t){const l=this,a=document.createElement("div"),i=document.createElement("button"),r=document.createElement("div"),n=document.createElement("div"),s=document.createElement("div"),o=document.createElement("span"),d=t.grid;t.row.expanded?i.setAttribute("toggled",""):i.removeAttribute("toggled",""),i.tabIndex=-1,l.toggleButton=i,l.checkbox=s,e.appendChild(a),e.appendChild(n),n.setAttribute("content",""),a.setAttribute("indent",""),r.setAttribute("label",""),i.setAttribute("toggle-button",""),i.setAttribute("role","presentation"),i.setAttribute("aria-label","Expand/Collapse Row"),s.setAttribute("checkbox",""),s.setAttribute("role","checkbox"),s.setAttribute("aria-checked","false"),s.setAttribute("aria-label","Select Row"),l.setAttribute("has-toggle-button",""),n.appendChild(i),n.appendChild(s),o.classList.add("smart-input"),s.appendChild(o),d.checkBoxes.visible?o.classList.remove("smart-hidden"):o.classList.add("smart-hidden"),n.appendChild(r),l.content=r}_initialize(e){const t=this,l=document.createElement("div"),a=e.column,i=e.grid;t._properties=[],t.cell=e,t.appendChild(l);let r=!1;if(a&&a._treeColumn&&i.dataSource.boundHierarchy&&(r=!0,e.row.filterRow&&(r=!1),!i.grouping.enabled&&i.dataSource.groupBy&&i.dataSource.groupBy.length>0&&(r=!1),i.grouping.enabled&&i.dataSource.groupBy&&0===i.dataSource.groupBy.length&&(r=!1)),r)return t._createToggleButton(l,e),void(t.isRendered=!0);{const e=document.createElement("div");l.appendChild(e)}t.content=l,t.isRendered=!0}_renderCommands(){const e=this,t=e.cell.grid;if(t.__cellsCommandTemplate)return e.firstChild.innerHTML=t.__cellsCommandTemplate,void t._updateCommandColumnCommandsVisibility(e.firstChild,e.cell.row);const l=t._getCommandColumnCommandsTemplate();e.firstChild.innerHTML=l,t._updateCommandColumnCommandsVisibility(e.firstChild,e.cell.row),t.__cellsCommandTemplate=l}_renderGroupCell(){const e=this,t=e.cell.grid,l=e.cell.column,a=e.cell.row;[...e.attributes].forEach((t=>e.removeAttribute(t.name))),e.setAttribute("group",""),e.setAttribute("role","gridcell");const i=l===t._firstRenderedColumn;e.style.width!==l.computedWidth+"px"&&(e.style.width=l.computedWidth+"px"),i||(t.rightToLeft?e.style.right!==l.left+"px"&&(e.style.right=l.left+"px"):e.style.left!==l.left+"px"&&(e.style.left=l.left+"px")),e.classList.contains("smart-hidden")&&e.classList.remove("smart-hidden"),l===t._firstRenderedColumn||a.summaryRow||e.classList.add("smart-hidden"),l.autoGenerated&&(e.style.width="0px");let r=a.label;const n=function(e,t,l){if(!t)return[];for(let a=0;a<t.length;a++){const i=t[a];i.$&&!1===i.$.filtered||(void 0!==i[e]&&l.push(i),i.summaryRow||(i.children||i.data&&i.data.children)&&n(e,i.children,l))}return l};let s="";if(void 0!==a.label){let o="",d=[];if(t.grouping.summaryRow.visible){let r=[];const s={},c=i?l.summary.length>0?l.summary:["count"]:l.summary;c.length&&(r=n(l.dataField,a.summaryRow?a.parent.data.children:a.data.children,[])),s[l.dataField]=c;const m=c.length>0?t.dataSource.summarize([s],r):null;if(m)for(let r=0;r<c.length;r++){const n=c[r];r>0&&(o+=", ");let u=m[l.dataField][n];const p=l.cellsFormat;if(void 0!==u){if(p&&(u=e.cell.getFormattedValue(u,p)),i){const i=t.columnByDataField[a.groupDataField];if(i){s[i.dataField]=c,m[i.dataField]=m[l.dataField],u=m[i.dataField][n];const t=i.cellsFormat;t&&(u=e.cell.getFormattedValue(u,t))}}o+=t.localize(n,{value:u}),m[l.dataField]&&m[l.dataField][n]&&d.push(m[l.dataField][n])}}}if(t.dataSource.virtualDataSourceOnExpand&&(o=""),i){const l=t.columnByDataField[a.groupDataField],i=l?l.label:"";if("advanced"===t.grouping.renderMode){if(a.summaryRow)r="<div header group-advanced><span group></span><span value></span>",o&&(r+="<div summary>",r+=o,r+="</div>");else{let e=a.label?a.label:t.localize("blankSummary");a.label||"taskStatus"!==a.groupDataField||(e="");let n="";if(l&&l.editor&&l.editor.dataSource){const t=l.editor.dataSource.find((t=>t.value===e||t.label===e));t&&t.color?(n=`--smart-primary: ${t.color}`,t.label&&(e=t.label)):t&&t.label&&(e=t.label)}if(a.label||"taskStatus"!==a.groupDataField||(e=t.localize("uncategorized")),"object"==typeof e&&l.cellsFormat){const t=a.getCell(l.dataField);e=t.getFormattedValue(e,l.cellsFormat)}else if("object"==typeof e&&e&&e instanceof Date){const t=a.getCell(l.dataField);e=t.getFormattedValue(e,"d")}const s=t.editing.addNewRow.visible?'<span add-row class="smart-grid-icon smart-icon-plus-circled show"></span>':"";if(r=`<div style="${n}" header group-advanced><span group>${s}${i}: </span><span value>${e}</span>`,e=""+e,e&&e.indexOf(",")>=0){let t="";r=`<div style="display: flex;" header group-advanced><span group>${s}${i}: </span>`;let a=e.split(",");for(let e=0;e<a.length;e++){let i=a[e].trim();if(l&&l.editor&&l.editor.dataSource){const e=l.editor.dataSource.find((e=>e.value===i||e.label===i));e&&e.color?(n=`--smart-primary: ${e.color}`,e.label&&(i=e.label)):e&&e.label&&(i=e.label),t+=`<span style="${n}" value>${i}</span>`}}r+=t}o&&t.grouping.summaryRow.inline&&(r+="<span summary>",r+=""+o,r+="</span>")}r+="</div>",e.classList.add("smart-grid-column-border-collapse")}else if("compact"===t.grouping.renderMode){if(a.summaryRow)r="<div header><span group></span><span value></span>",o&&(r+="<div summary>",r+=o,r+="</div>");else{let e=a.label;if(l.displayField!==l.dataField&&a.data.data&&(e=a.data.data[l.displayField]),"object"==typeof e&&l.cellsFormat){e=a.getCell(l.dataField).getFormattedValue(e,l.cellsFormat)}r="<div header><span group>"+i+": </span><span value>"+e+"</span>",o&&t.grouping.summaryRow.inline&&(r+="<span summary>",r+=" ("+d+")",r+="</span>")}r+="</div>",e.classList.add("smart-grid-column-border-collapse")}else if("basic"===t.grouping.renderMode){if(r=a.label,l.displayField!==l.dataField&&a.data.data&&(r=a.data.data[l.displayField]),"object"==typeof r&&l.cellsFormat){r=a.getCell(l.dataField).getFormattedValue(r,l.cellsFormat)}a.summaryRow?o&&(r+="<div summary>",r+=o,r+="</div>"):o&&t.grouping.summaryRow.inline&&(r+="<span summary>",r+=" ("+d+")",r+="</span>"),e.classList.add("smart-grid-column-border-collapse")}else if("multipleColumns"===t.grouping.renderMode){if(r=a.label,"object"==typeof r&&l.cellsFormat){r=a.getCell(l.dataField).getFormattedValue(r,l.cellsFormat)}a.summaryRow?o&&(r+="<div summary>",r+=o,r+="</div>"):o&&t.grouping.summaryRow.inline&&(r+="<span summary>",r+=" ("+d+")",r+="</span>"),e.classList.add("smart-grid-column-border-collapse")}e.setAttribute("has-toggle-button","")}else e.removeAttribute("has-toggle-button",""),r=o;s=o}let o=e.firstChild;if(t.dataSource.boundHierarchy&&i){o.children.length<=1&&(e.innerHTML="<div></div>",o=e.firstChild,e._createToggleButton(o,e.cell),o=e.firstChild);const n=o.children[0],s=o.children[1].children[0],d=o.children[1].children[1].firstChild,c=o.children[1].children[2];n.setAttribute("indent",""),a.checked?d.setAttribute("checked",""):!1===a.checked?d.removeAttribute("checked"):null===a.checked&&d.setAttribute("checked","indeterminate"),a.leaf?s.classList.add("smart-visibility-hidden"):(s.classList.remove("smart-visibility-hidden"),a.expanded?s.setAttribute("toggled",""):s.removeAttribute("toggled",""));let m="";if(!l._treeColumn||a.summaryRow||a.filterRow?e.toggleButton.classList.add("smart-hidden"):e.toggleButton.classList.remove("smart-hidden"),l._treeColumn)if(t.grouping.enabled){let e=a.level-1;if(1+e===0)m+="",n.classList.add("smart-hidden");else{if("multipleColumns"===t.grouping.renderMode){let l=0;for(let a=0;a<t.columns.length;a++)a<1+e&&(l+=t.columns[a].computedWidth);m+='<div style="width: '+l+'px;"></div>'}else m+='<div style="width: '+(1+e)*t.grouping.groupIndent+'px;"></div>';n.classList.remove("smart-hidden")}}else for(let e=0;e<a.level;e++)m+="<div class='smart-indent'></div>";if(void 0===a.label||a.summaryRow||a.filterRow?s.classList.add("smart-hidden"):(s.classList.remove("smart-hidden"),s.style.marginLeft=""),n.innerHTML=m,c.innerHTML=r,i&&t.grouping.formatFunction){const i={row:a,column:l,groupDataField:a.groupDataField,cell:e.cell,value:r,data:a.data,template:null},n=t.grouping.formatFunction(i);n&&(i.value=n),i.value!==r?c.innerHTML=i.value:i.template&&(c.innerHTML=i.template)}t.appearance.showTooltips?c.setAttribute("title",a.label?a.label:t._unescapeString(r)):c.hasAttribute("title")&&c.removeAttribute("title")}else void 0!==a.label&&t.grouping.enabled&&!i&&(o.innerHTML=r,l.summary.length&&t.grouping.summaryRow.inline&&r&&e.classList.remove("smart-hidden"));void 0!==a.label&&t.grouping.enabled&&i&&!l._treeColumn&&l.summary.length&&t.grouping.summaryRow.inline&&r&&(t.rightToLeft||e.style.left!==l.left+"px"&&(e.style.left=l.left+"px"),e.removeAttribute("has-toggle-button",""),r=s,o.innerHTML=r);let d="smart-label";e.style.zIndex="";const c=t.editing.addNewColumn.visible&&t._addNewColumn?t._addNewColumn.width-1:0;if(i){const l=t.columnByDataField[a.groupDataField];l&&(l.cellsAlign&&(d+=" align-"+l.cellsAlign),l.cellsVerticalAlign&&(d+=" align-"+l.cellsVerticalAlign)),e.setAttribute("header",""),a.summaryRow||(e.style.width="calc(100% - "+c+"px)"),void 0!==a.label&&(e.style.zIndex=11)}else l===t._firstRenderedColumn&&(e.style.zIndex=4),e.setAttribute("header",""),a.summaryRow||(e.style.width="calc(100% - "+c+"px)"),l.summary.length&&t.grouping.summaryRow.inline&&r&&(e.style.width=l.computedWidth+"px",e.style.zIndex=11,e.classList.add("smart-grid-column-border-collapse"),l.cellsAlign&&(d+=" align-"+l.cellsAlign),l.cellsVerticalAlign&&(d+=" align-"+l.cellsVerticalAlign));if(a.summaryRow&&(e.setAttribute("header",""),e.classList.add("smart-grid-column-border-collapse"),l.cellsAlign&&(d+=" align-"+l.cellsAlign),l.cellsVerticalAlign&&(d+=" align-"+l.cellsVerticalAlign)),o.className!==d&&(o.className=d),l.formatFunction){const t={row:a,column:l,cell:e.cell,value:null,template:null,data:null,group:{value:r,template:null}},i=l.formatFunction(t);if(i&&(t.group.value=i),t.group.value!==r)if(l._treeColumn){o.children[1].children[2].innerHTML=t.group.value}else o.innerHTML=t.group.value;null!==t.group.template&&(o.innerHTML=t.group.template)}}_renderFilterCell(e){const t=this,l=t.cell.grid,a=t.cell.column;let i;const r=(e,t)=>{l._handleFilterMenuClick(e,t)};l._filterInfo||(l._filterInfo={},l._filterInfo.stringConditions=[{icon:"smart-icon-contains",command:r,value:"CONTAINS",label:l.localize("CONTAINS")},{icon:"smart-icon-does-not-contain",command:r,value:"DOES_NOT_CONTAIN",label:l.localize("DOES_NOT_CONTAIN")},{icon:"smart-icon-starts-with",command:r,value:"STARTS_WITH",label:l.localize("STARTS_WITH")},{icon:"smart-icon-ends-with",command:r,value:"ENDS_WITH",label:l.localize("ENDS_WITH")},{icon:"smart-icon-equals",command:r,value:"EQUAL",label:l.localize("EQUAL")},{icon:"smart-icon-delete",command:r,value:"CLEAR_FILTER",label:l.localize("CLEAR_FILTER")}],l._filterInfo.numberAndDateConditions=[{icon:"smart-icon-equals",command:r,value:"EQUAL",label:l.localize("EQUAL")},{icon:"smart-icon-not-equal",command:r,value:"NOT_EQUAL",label:l.localize("NOT_EQUAL")},{icon:"smart-icon-less-than",command:r,value:"LESS_THAN",label:l.localize("LESS_THAN")},{icon:"smart-icon-less-than-equal",command:r,value:"LESS_THAN_OR_EQUAL",label:l.localize("LESS_THAN_OR_EQUAL")},{icon:"smart-icon-greater-than",command:r,value:"GREATER_THAN",label:l.localize("GREATER_THAN")},{icon:"smart-icon-greater-than-equal",command:r,value:"GREATER_THAN_OR_EQUAL",label:l.localize("GREATER_THAN_OR_EQUAL")},{icon:"smart-icon-between",command:r,value:"RANGE",label:l.localize("RANGE")},{icon:"smart-icon-delete",command:r,value:"CLEAR_FILTER",label:l.localize("CLEAR_FILTER")}]);const n=l._getFilterDataType(a);i="string"===n?l._filterInfo.stringConditions:l._filterInfo.numberAndDateConditions;let s="smart-icon-search";if(a._filterInfo||(a._filterInfo={condition:""}),a.filterEditor&&a.filterEditor.condition&&(a._filterInfo.condition=a.filterEditor.condition),a.filterEditor&&a.filterEditor.value&&(a._filterInfo.value=a.filterEditor.value),a._filterInfo.dataSource=i,null===a._filterInfo.condition||void 0===a._filterInfo.condition)a._filterInfo.condition="",s="smart-icon-search";else switch(a._filterInfo.condition.toLowerCase()){case"equal":s="smart-icon-equals";break;case"starts_with":s="smart-icon-starts-with";break;case"ends_with":s="smart-icon-ends-with";break;case"not_equal":s="smart-icon-not-equal";break;case"less_than":s="smart-icon-less-than";break;case"less_than_or_equal":s="smart-icon-less-than-or-equal";break;case"greater_than":s="smart-icon-greater-than";break;case"greater_than_or_equal":s="smart-icon-greater-than-or-equal";break;case"contains":s="smart-icon-contains";break;case"does_not_contain":s="smart-icon-does-not-contain";break;case"range":s="smart-icon-between";break;default:s="smart-icon-search"}let o=`<div class="smart-filter-input-type"><i class="smart-grid-icon ${s} show"></i></div> `;if("string"===n)o+=`<input class="smart-filter-input-value" data-type="${n}" /> `,e.innerHTML=o;else if("date"===a.dataType){const i=new Smart.Utilities.DateTime;o+=`<input placeholder = "${i.expandFormat(i.calendar,a.cellsFormat||"d")}" class="smart-filter-input-value" data-type="${a.dataType}"/><div class="smart-filter-input-type"><i class="smart-grid-icon smart-icon-calendar show"></i></div>`,e.innerHTML=o,e.lastElementChild.onpointerdown=function(){l._handleFilterCalendarCellClick(t.cell)}}else if("number"===a.dataType)o+='<div class="smart-grid-cell-editor smart-filter-input-value smart-grid-number-input-cell-editor"><input class="smart-input" type="number"><div tabindex="-1" class="nav"><div tabindex="-1" class="up"></div><div tabindex="-1" class="down"></div></div></div>',e.innerHTML=o,l._handleFilterNumberCellEditor(this.cell,e);else if("boolean"===a.dataType||"bool"===a.dataType){const i=document.createElement("div");i.classList.add("smart-input"),i.classList.add("smart-grid-check-box-cell-editor"),i.classList.add("smart-filter-input-value"),e.tabIndex=0,e.style.outline="none",t.setAttribute("template","checkBox"),i.setAttribute("checked","indeterminate"),a._filterInfo&&a._filterInfo.value?i.setAttribute("checked",""):a._filterInfo&&!1===a._filterInfo.value&&i.removeAttribute("checked"),o=i.outerHTML,e.innerHTML=o,e.classList.add("align-center"),e.classList.add("smart-label"),e.onfocus=()=>{e.setAttribute("focus","")},e.onblur=()=>{e.removeAttribute("focus","")},e.onclick=e=>{e.target.classList.contains("smart-input")&&l._handleFilterCellCheckBoxClick(this.cell)}}const d=e.querySelector("input");if(d&&(e.firstElementChild.onpointerdown=function(){l._handleFilterCellIconClick(this.cell)}.bind(this),d.onpaste=function(e){setTimeout((()=>{l._handleFilterCellKeyUp(this.cell,e)}))}.bind(this),d.onfocus=function(){l._handleFilterCellFocus(this.cell)}.bind(this),d.onblur=function(){l._handleFilterCellBlur(this.cell)}.bind(this),d.onkeyup=function(e){l._handleFilterCellKeyUp(this.cell,e)}.bind(this),d.onkeydown=function(e){l._handleFilterCellKeyDown(this.cell,e)}.bind(this)),e.classList.add("smart-filter-input-container"),a._filterInfo.input=d,a._filterInfo.cell=t.cell,a._filterInfo.editor=e,a._filterInfo.value&&d&&(d.value=a._filterInfo.value,"date"===a.dataType&&(d.value=t.cell.getFormattedValue(a._filterInfo.value,a.cellsFormat))),e.removeAttribute("disabled"),a.allowFilter||(d.disabled=!0,e.setAttribute("disabled","")),a.filterEditor||"multi"===a.filterMenuMode)if("multi"===a.filterEditor.template||"multi"===a.filterMenuMode){const t=document.createElement("div");t.className="smart-arrow-down",t.style.fontSize="16px",t.style.marginRight="4px",t.style.marginLeft="4px",t.style.alignSelf="center",t.style.cursor="pointer",t.onclick=function(e){l._handleFilterCellExcelIconClick(this.cell)}.bind(this),e.appendChild(t)}else if(a.filterEditor.template){const t=a.filterEditor.template,i=document.createElement("div");if(a.filterTemplate instanceof HTMLTemplateElement)i.appendChild(t.content.cloneNode(!0));else if(t instanceof HTMLElement)i.appendChild(t);else if("checkList"===t){const e=document.createElement("smart-drop-down-list");e.className="smart-filter-check-list",e.selectionMode="checkBox",e.filterable=!0,e.style.setProperty("--smart-border-top-left-radius","0px"),e.style.setProperty("--smart-border-top-right-radius","0px"),e.style.setProperty("--smart-border-bottom-left-radius","0px"),e.style.setProperty("--smart-border-bottom-right-radius","0px"),e.style.width="100%",e.style.height="100%",e.dropDownAppendTo="body",e.dropDownButtonPosition="right",e.dataSource=a.filterEditor.dataSource||l.getColumnUniqueValues(a.dataField),e.whenRendered((()=>{e.checkAll()})),a.filterEditor.displayMember&&(e.displayMember=a.filterEditor.displayMember),a.filterEditor.valueMember&&(e.valueMember=a.filterEditor.valueMember),e.onchange=()=>{const t=this.cell.column;if(e.selectedValues.length===e.dataSource.length)return t._filterInfo.value=null,e.close(),delete t._filterInfo.excelValues,void l.removeFilter(t.dataField);t._filterInfo.excelValues=e.selectedValues,l._suspendFilterRowRefresh=!0,l._handleFilterCellValue(this.cell),l._suspendFilterRowRefresh=!1},i.appendChild(e)}else if("list"===t||"dropDownList"===t||"select"===t){const e=document.createElement("smart-input");e.className="smart-filter-list",e.readonly=!0,e.style.setProperty("--smart-border-top-left-radius","0px"),e.style.setProperty("--smart-border-top-right-radius","0px"),e.style.setProperty("--smart-border-bottom-left-radius","0px"),e.style.setProperty("--smart-border-bottom-right-radius","0px"),e.style.width="100%",e.style.height="100%",e.dropDownButtonPosition="right",a.filterEditor.displayMember&&(e.displayMember=a.filterEditor.displayMember),a.filterEditor.valueMember&&(e.valueMember=a.filterEditor.valueMember);let t=a.filterEditor.dataSource||l.getColumnUniqueValues(a.dataField);t=[{label:"-",value:null}].concat(t),e.dataSource=t,e.onchange=()=>{this.cell.column._filterInfo.value=e.selectedValue,l._suspendFilterRowRefresh=!0,l._handleFilterCellValue(this.cell),l._suspendFilterRowRefresh=!1},i.appendChild(e)}else i.innerHTML=t;e.innerHTML="",e.appendChild(i),i.style.height="100%",i.style.width="100%";const r=e.querySelector("input");r&&(r.onfocus=()=>{e.setAttribute("focus","")},r.onblur=()=>{e.removeAttribute("focus","")}),a.filterEditor.onInit&&a.filterEditor.onInit(a,i)}else void 0!==a.filterEditor.min&&(d.min=a.filterEditor.min),void 0!==a.filterEditor.max&&(d.max=a.filterEditor.max),void 0!==a.filterEditor.minLength&&(d.minLength=a.filterEditor.minLength),void 0!==a.filterEditor.maxLength&&(d.maxLength=a.filterEditor.maxLength),void 0!==a.filterEditor.placeholder&&(d.placeholder=a.filterEditor.placeholder),void 0!==a.filterEditor.value&&(d.value=a.filterEditor.value),void 0!==a.filterEditor.step&&(d.step=a.filterEditor.step),void 0!==a.filterEditor.disabled&&(d.disabled=a.filterEditor.disabled),void 0!==a.filterEditor.condition&&(a._filterInfo.condition=a.filterEditor.condition),a.filterEditor.onInit&&a.filterEditor.onInit(a,e)}_setTemplate(t,l,a){const i=this,r=i.cell.grid,n=i.cell.column;r._cellCachedValues||(r._cellCachedValues=[]);const s=()=>!!r._cellCachedValues[n.dataField+"_"+t]&&(a.innerHTML!==r._cellCachedValues[n.dataField+"_"+t]&&(a.innerHTML=r._cellCachedValues[n.dataField+"_"+t]),i.cell._setStyle(a),i.setAttribute("template",i.cell.template),!0);let o=null;switch((!r.editing.enabled||!n.allowEdit||i.cell.readonly||"none"===r.editing.action||r.editing.enabled&&r.editing.commandColumn.visible&&r.editing.editRow!==i.cell.row)&&i.setAttribute("readonly",""),n.placeholder&&t===n.placeholder&&(t=""),l){case"checkBox":case"radioButton":case"switchButton":if(a.firstElementChild&&a.firstElementChild.classList&&a.firstElementChild.classList.contains("smart-input")){if(o=a.firstElementChild,t?o.setAttribute("checked",""):null===t?o.setAttribute("checked","indeterminate"):o.removeAttribute("checked"),i.setAttribute("template",i.cell.template),o.removeAttribute("icon"),o.removeAttribute("color"),o.style.setProperty("--smart-check-template-color","var(--smart-primary)"),i.cell.column.templateSettings&&i.cell.column.templateSettings.icon){if("ok-squared"!==i.cell.column.templateSettings.icon)o.setAttribute("icon",i.cell.column.templateSettings.icon);else{const e=new Smart.Color(i.cell.column.templateSettings.color).getInvertedColor();o.style.setProperty("--smart-check-template-forecolor",e)}o.style.setProperty("--smart-check-template-color",i.cell.column.templateSettings.color),o.setAttribute("color","")}return void i.cell._setStyle(a)}if(o=document.createElement("span"),o.className="smart-input",t?o.setAttribute("checked",""):null===t?o.setAttribute("checked","indeterminate"):o.removeAttribute("checked"),i.setAttribute("template",i.cell.template),o.removeAttribute("icon"),o.removeAttribute("color"),o.style.setProperty("--smart-check-template-color","var(--smart-primary)"),i.cell.column.templateSettings&&i.cell.column.templateSettings.icon){if("ok-squared"!==i.cell.column.templateSettings.icon)o.setAttribute("icon",i.cell.column.templateSettings.icon);else{const e=new Smart.Color(i.cell.column.templateSettings.color).getInvertedColor();o.style.setProperty("--smart-check-template-forecolor",e)}o.setAttribute("color",""),o.style.setProperty("--smart-check-template-color",i.cell.column.templateSettings.color)}a.innerHTML="",a.appendChild(o),i.cell._setStyle(a);break;case"checklist":if(t&&t.indexOf("[")>=0&&(t=JSON.parse(t)),a.firstElementChild&&a.firstElementChild.hasAttribute("value")){const e=a.firstElementChild.getAttribute("value");if(t&&e===t.length)return i.cell._setStyle(a),void i.setAttribute("template",i.cell.template)}if(t&&Array.isArray(t)&&t.length>0){const e=t.filter((e=>e.completed)).length,l=["#D50000","#F4511E","#F6BF26","#33B679"],a=e+"/"+t.length;let i=l[0];e===t.length?i=l[3]:e>0&&e<t.length&&(i=l[2]),t=`<div style="display: grid; grid-template-columns: 25px auto"><div style="margin-left: 4px; align-self: center; border-radius: 50%; display: flex; align-content: center; background: ${i}; width:16px; height: 16px;"><span title="${a}" style="align-content: center; font-size: 13px; color: white;" class="smart-grid-icon show smart-icon-check"></span></div>${a}</span></div>`}else t="";o=document.createElement("span"),o.innerHTML=t,i.setAttribute("template",i.cell.template),o.setAttribute("value",t.length);break;case"createdBy":case"updatedBy":{const e=i.cell.row;let t=null,s=null;if(t="createdBy"===l?e.createdBy:e.updatedBy,e.history&&e.history.length&&(t="createdBy"===l?e.history[0].user:e.history[e.history.length-1].user),a.firstElementChild&&a.firstElementChild.hasAttribute("user-id")){if(t===parseInt(a.firstElementChild.getAttribute("user-id")))return i.cell._setStyle(a),void i.setAttribute("template",i.cell.template);if(null!=t&&-1!==t){s=r.users.find((e=>e.id===t));const e=s;if(e){const l=a.firstElementChild.firstElementChild&&a.firstElementChild.firstElementChild.firstElementChild?a.firstElementChild.firstElementChild.firstElementChild.firstElementChild:null;if(l){a.firstElementChild.setAttribute("user-id",t);const i="string"==typeof e?e:e.name,r="string"==typeof e?null:e.color;if(("string"==typeof e?null:e.image)&&(l.firstElementChild.style.backgroundImage=`url('${e.image}')`),r){const e=new Smart.Color(r).getInvertedColor();l.setAttribute("data-item",i),l.setAttribute("title",i),l.setAttribute("backgroundColor",r),l.setAttribute("color",e),l.lastElementChild.textContent=i}else l.setAttribute("data-item",i),l.setAttribute("title",i),l.setAttribute("backgroundColor",""),l.setAttribute("color","");return}}}}const d=document.createElement("div");d.classList.add("smart-multi-combo-input"),d.setAttribute("data-field",n.dataField),d.setAttribute("row-id",i.cell.row.id),d.style.width="100%",d.style.paddingRight="6px";let c='<div class="smart-flex smart-flex-auto smart-tokens-layout">';if(null!=t&&-1!==t){s=r.users.find((e=>e.id===t));const e=s;if(e){const t="string"==typeof e?e:e.name,l="string"==typeof e?null:e.color,a="string"==typeof e?null:e.image,i=document.createElement("span");if(a&&(i.style.backgroundImage=`url('${e.image}')`,i.className="smart-drop-down-list-selection-image"),l){c+='<span title="'+t+'" data-item="'+t+'" style="background: '+l+"; color: "+new Smart.Color(l).getInvertedColor()+'; overflow: visible;" class="smart-truncate smart-token">'+i.outerHTML+"<span class='smart-drop-down-list-selection-label' role=\"presentation\">"+t+"</span></span>"}else c+='<span title="'+t+'" data-item="'+t+'" class="smart-truncate smart-token">'+i.outerHTML+"<span class='smart-drop-down-list-selection-label' role=\"presentation\">"+t+"</span></span>"}else c=""}d.innerHTML=c+"</div>";const m=document.createElement("div");m.classList.add("smart-multi-combo-input-container","tokens","smart-flex","smart-flex-auto"),d.classList.add("smart-flex-auto"),m.appendChild(d),o=m,o.setAttribute("user-id",t),i.setAttribute("template",i.cell.template);break}case"collaborator":case"tags":{let e=[];if("number"==typeof t&&(t=""+t),""===t||null===t||"uncategorized"===t){let e=`\n <div class="smart-multi-combo-input-container tokens smart-flex smart-flex-auto" data-field="${n.dataField}" row-id="${i.cell.row.id}"> \n <div class="smart-multi-combo-input" data-field="${n.dataField}" row-id="${i.cell.row.id}" class="tokens smart-flex smart-flex-auto">\n <div class=" smart-flex-auto smart-flex"></div>\n </div>\n </div>\n `;return a.innerHTML!==e&&(a.firstElementChild&&a.firstElementChild.firstElementChild&&a.firstElementChild.firstElementChild.firstElementChild&&""===a.firstElementChild.firstElementChild.firstElementChild.textContent?(a.firstElementChild.setAttribute("row-id",i.cell.row.id),a.firstElementChild.firstElementChild.setAttribute("row-id",i.cell.row.id)):a.innerHTML=e),n.placeholder&&a.firstElementChild&&a.firstElementChild.firstElementChild&&(a.firstElementChild.firstElementChild.innerHTML=n.placeholder),i.cell._setStyle(a),void i.setAttribute("template",i.cell.template)}if(s())return;if(null!==t&&(e=Array.isArray(t)?e.map((e=>e.trim())):t.indexOf("{")>=0||"[]"===t?JSON.parse(t):t.split(",").map((e=>e.trim()))),a.firstElementChild&&a.firstElementChild.hasAttribute("value")&&n.editor._items&&n.editor._items[t]){if(a.firstElementChild.getAttribute("value")===t){i.cell._setStyle(a),i.setAttribute("template",i.cell.template);const e=n.editor.dots;if(a.firstElementChild&&a.firstElementChild.firstElementChild&&a.firstElementChild.firstElementChild.firstElementChild){if(a.firstElementChild.firstElementChild.firstElementChild.classList.remove("smart-flex-wrap"),a.firstElementChild.firstElementChild.firstElementChild.firstElementChild){const t=a.firstElementChild.firstElementChild.firstElementChild.firstElementChild.firstElementChild;t&&(e?t.classList.add("dots"):t.classList.remove("dots"))}if(i.cell.row.height>45){a.firstElementChild.firstElementChild.firstElementChild.classList.add("smart-flex-wrap");const e=a.firstElementChild.firstElementChild.firstElementChild;if(e.children&&e.children.length>1)for(let t=0;t<e.children.length;t++)e.children[t].style.maxWidth&&(e.children[t].style.maxWidth="")}else if(r.layout.rowHeight<=45&&i.cell.row.height<=45){const e=a.firstElementChild.firstElementChild.firstElementChild;if(e.children&&e.children.length>1){const t=parseInt(n.computedWidth/e.children.length)-5;let l=0;for(let t=0;t<e.children.length;t++)l+=e.children[t].textContent.length,e.children[t].style.maxWidth="";if(14*l*.52+20*e.children.length>n.computedWidth)for(let l=0;l<e.children.length;l++)e.children[l].style.maxWidth=t+"px"}}}return}}const d=document.createElement("div");d.classList.add("smart-multi-combo-input"),d.setAttribute("data-field",n.dataField),d.setAttribute("row-id",i.cell.row.id);let c='<div class="smart-tokens-layout smart-flex smart-flex-auto">';if(e.length>2&&i.cell.row.height>45){c='<div style="max-width: '+(n.computedWidth-10+"px")+'" class="smart-flex smart-flex-wrap">'}let m=0;if(t)for(let t=0;t<e.length;t++){const a=e[t];let i=null;if("collaborator"===l||n.editor&&n.editor.collaborator)i=r.users.find((e=>{if("string"==typeof a||"number"==typeof a){if(e.value===a||parseInt(e.value)===parseInt(a))return e;if(e.id===a||parseInt(e.id)===parseInt(a))return e}else if("object"==typeof a&&e.value===a.value)return e})),i&&(i.label=i.name);else{const e=n.editor.dataSource||n.options;if(e)if("string"==typeof a&&n.editor._items&&n.editor._items[a])i=n.editor._items[a];else{for(let t=0;t<e.length;t++){const l=e[t];if(void 0!==l.value&&void 0!==a&&void 0!==a.value&&l.value===a.value){i=l,n.editor._items||(n.editor._items=[]),n.editor._items[a]=l;break}if(void 0===l.value&&l===a||void 0!==l.value&&""+l.value===a){i=l,n.editor._items||(n.editor._items=[]),n.editor._items[a]=l;break}}n.editor.allowItemsAdd&&!i&&a&&(i=a)}else i=a}if(!i)continue;const s="string"==typeof i?i:i.label,o="string"==typeof i?null:i.color,d="string"==typeof i?null:i.image;if(""===s)continue;const u=document.createElement("span");d&&(u.style.backgroundImage=`url('${i.image}')`,u.className="smart-drop-down-list-selection-image");const p="smart-truncate";if(o&&n.editor.colorItems){const e=new Smart.Color(o).getInvertedColor(),t=n.editor.dots?" dots":"";c+='<span title="'+s+'" data-item="'+s+'" style="background: '+o+"; color: "+e+"; --smart-primary-color: "+e+'; overflow: visible;" class="'+p+' smart-token">'+u.outerHTML+"<span class='smart-drop-down-list-selection-label"+t+'\' role="presentation">'+s+"</span>"}else c+='<span title="'+s+'" data-item="'+s+'" class="'+p+' smart-token">'+u.outerHTML+"<span class='smart-drop-down-list-selection-label' role=\"presentation\">"+s+"</span>";m+=s.length;if(n.editor.dataSource||n.options){if(n.editor.singleSelect){c+="</span>";break}c+='<span class=\'smart-hidden smart-drop-down-list-unselect-button\' role="button" aria-label="Unselect"></span></span>'}else c+="</span>"}d.innerHTML=c+"</div>";const u=14*m*.52,p=d.firstElementChild;if(r.layout.rowHeight<=45&&i.cell.row.height<=45&&d&&p.children.length>1&&u+20*p.children.length>n.computedWidth){const e=parseInt(n.computedWidth/p.children.length)-5;for(let t=0;t<p.children.length;t++)p.children[t].style.maxWidth=e+"px"}if(d.style.width="100%",d.style.paddingRight="6px",d.onpointerdown=t=>{if(!r._mobile)if(t.target&&"#text"!==t.target.nodeName&&t.target.classList.contains("smart-drop-down-list-unselect-button")){let l=t.target.parentNode.getAttribute("data-item");const a=n.editor.dataSource||n.options;if(a&&"string"==typeof l&&a)for(let e=0;e<a.length;e++)a[e].label===l&&(l=a[e],l.value&&(l=l.value));if(e[0]&&e[0].label){const a=e.map((e=>e.value)).indexOf(l);if(a>=0){e.splice(a,1);const l=i.cell.value,s=e.join(", ");r.setCellValue(i.cell.row.id,n.dataField,JSON.stringify(e)),r.onCellUpdate&&r.onCellUpdate([i.cell],[l],[s],(function(){}),i),t.preventDefault(),t.stopPropagation()}}else if(e.indexOf(l)>=0){e.splice(e.indexOf(l),1);const a=i.cell.value,s=e.join(", ");r.setCellValue(i.cell.row.id,n.dataField,s),r.onCellUpdate&&r.onCellUpdate([i.cell],[a],[s],(function(){}),i),t.preventDefault(),t.stopPropagation()}}else if(t.target.classList.contains("smart-drop-down-list-selection-label")){if(r.editing.enabled&&r.editing.allowListOpenOnContentClick){const e=t.target.closest(".smart-multi-combo-input"),l=e.getAttribute("data-field"),a=e.getAttribute("row-id");r.beginEdit(a,l)}t.stopPropagation(),t.preventDefault()}},!n.cellsWrap&&n.allowEdit&&r.editing.enabled&&"card"!==r.view){let t=n.editor.dataSource&&n.editor.dataSource.length;n.editor.collaborator&&(t=r.users&&r.users.length);const l=document.createElement("div");t&&l.classList.add("items"),l.classList.add("smart-multi-combo-input-container","tokens","smart-flex","smart-flex-auto"),d.classList.add("smart-flex-auto"),d.classList.remove("smart-flex-wrap"),e.length>2&&r.layout.rowHeight>45&&(d.classList.add("smart-flex-wrap"),d.style.maxWidth=n.computedWidth-10+"px"),r.rightToLeft&&(d.style.direction="rtl"),l.appendChild(d),o=l}else if(n.cellsWrap||n.allowEdit){const t=document.createElement("div");t.classList.add("smart-multi-combo-input-container","tokens","smart-flex","smart-flex-auto"),d.classList.add("smart-flex-auto"),d.classList.remove("smart-flex-wrap"),e.length>2&&r.layout.rowHeight>45&&(d.classList.add("smart-flex-wrap"),d.style.maxWidth=n.computedWidth-10+"px"),r.rightToLeft&&(d.style.direction="rtl"),t.appendChild(d),o=t}else d.classList.add("smart-flex-auto","smart-flex","tokens"),o=d;i.setAttribute("template",i.cell.template),o.setAttribute("value",t);break}case"dropdownGrid":case"dropDownList":case"dropdownlist":case"list":{const e=document.createElement("div");if(a.firstElementChild&&a.firstElementChild.hasAttribute("value")){if(a.firstElementChild.getAttribute("value")===t&&!i.cell.column._isDirty)return i.cell._setStyle(a),void i.setAttribute("template",i.cell.template)}if("dropdownGrid"!==i.cell.template){if(s()){const e=a.querySelector(".smart-arrow-down");return void(e&&(e.onpointerdown=e=>{if(!r._mobile){if(r.editing.enabled){const t=e.target.closest("smart-grid-cell"),l=e.target.closest("smart-grid-row"),a=t.getAttribute("data-field"),n=l.getAttribute("data-id");if(r.beginEdit(n,a),i.cell.column.editor&&i.cell.column.editor.instance){const e=i.cell.column.editor,t=e.instance.element;!e.autoOpen&&t.open?t.open():!e.autoOpen&&t.firstElementChild&&t.firstElementChild.open&&setTimeout((()=>{t.firstElementChild.open()}),250)}}e.stopPropagation(),e.preventDefault()}}))}}if("dropdownGrid"===i.cell.template){const l=i.cell.column.templateSettings.dataFields;let a=i.cell.editor.dataSource?i.cell.editor.dataSource[t]:"";if(i.cell.column.relationId&&i.cell.column.relationField&&i.cell.column._isDirty&&(!i.cell.column.editor.dataSource||i.cell.column.editor.dataSource&&0===i.cell.column.editor.dataSource.length)){const e=r._getRelationData(i.cell.column.relationId,i.cell.column.relationField,i.cell.column.relationCascadingFields),l=r._getRelationColumns(i.cell.column.relationId);e&&(a=e[t]),i.cell.column.editor.columns=l,i.cell.column.editor.dataSource=e}if(e.classList.add("smart-flex","center"),e.style.alignItems="center",e.onmouseenter=()=>{e.querySelectorAll("i").forEach((e=>e.classList.add("show")))},e.onmouseleave=()=>{e.querySelectorAll("i").forEach((e=>e.classList.remove("show")))},a){e.style.justifyContent="space-between";let t="";for(let e=0;e<l.length;e++){const i=a[l[e]];i&&(t+='<span style="" class="smart-truncate smart-token smart-flex middle center ">'+i+"</span>")}e.innerHTML=t}else e.style.justifyContent="",e.innerHTML='<span class="smart-truncate"></span>'}else"card"===r.view?e.textContent=t:e.innerHTML='<span class="smart-truncate">'+t+"</span>";if(n.allowEdit&&r.editing.enabled&&"card"!==r.view){const t=document.createElement("span");t.classList.add("smart-arrow-down","arrowbtn");const l=document.createElement("div");l.classList.add("smart-multi-combo-input-container","tokens","smart-flex","smart-flex-auto"),e.classList.add("smart-flex-auto","smart-multi-combo-input"),l.appendChild(e),l.appendChild(t),l.classList.add(i.cell.template.toLowerCase()),o=l,t.onpointerdown=e=>{if(!r._mobile){if(r.editing.enabled){const t=e.target.closest("smart-grid-cell"),l=e.target.closest("smart-grid-row"),a=t.getAttribute("data-field"),n=l.getAttribute("data-id");if(r.beginEdit(n,a),i.cell.column.editor&&i.cell.column.editor.instance){const e=i.cell.column.editor,t=e.instance.element;!e.autoOpen&&t.open?t.open():!e.autoOpen&&t.firstElementChild&&t.firstElementChild.open&&setTimeout((()=>{t.firstElementChild.open()}),250)}}e.stopPropagation(),e.preventDefault()}}}else o=e;i.setAttribute("template",i.cell.template.toLowerCase()),o.setAttribute("value",t);break}case"password":a.innerHTML=t?'<span class="smart-truncate">'+t.replace(/./g,"*")+"</span>":"",i.setAttribute("template",i.cell.template);break;case"richText":if(a.innerHTML=t?'<div class="textwrap" style="height: 100%; padding-top: 5px; padding-left: 5px;">'+r._unescapeString(t)+"</div>":"",r.layout.autoWrap&&i.cell.row.height>40&&1===i.cell.colSpan&&"string"===n.dataType){null==t&&(t="");if(14*t.length*.52>n.computedWidth){const e=parseInt(i.cell.row.height/20);a.firstElementChild.style["-webkit-line-clamp"]=e}}a.onpointerdown=e=>{if(!r._mobile&&r.editing.enabled){const t=r.offset(a);if(e.pageX>t.left+a.offsetWidth-20){const t=e.target.closest("smart-grid-cell"),l=e.target.closest("smart-grid-row"),a=t.getAttribute("data-field"),i=l.getAttribute("data-id");delete r._beginEditKey,r.beginEdit(i,a)}}},o=a.firstElementChild,i.setAttribute("template",i.cell.template);break;case"color":a.innerHTML=`<span style="left: calc(50% - 12px); top: calc(50% - 12px); position: absolute; border-radius: 50%; width: 24px; height: 24px; display: block; background:${t};"></span>`,i.setAttribute("template",i.cell.template);break;case"autoNumber":o=document.createElement("span"),o.innerHTML=1+i.cell.row.visibleIndex,i.setAttribute("template",i.cell.template);break;case"uuid":{if(a.firstElementChild&&a.firstElementChild.hasAttribute("value")){const e=a.firstElementChild.getAttribute("value");if(t===e)return i.cell._setStyle(a),void i.setAttribute("template",i.cell.template)}o=document.createElement("span"),o.style.paddingLeft="7px";const e=r._generateUUID(),l=i.cell.canNotify;i.cell.canNotify=!1,t||(i.cell.value=e,r.onCellUpdate&&!r.editing.editRow&&r.onCellUpdate([i.cell],[e],[e],(function(){r.onCellUpdated&&r.onCellUpdated([i.cell.row.index],[i.cell.row],[i.cell.column],[i.cell.row.data],[i.cell.value],[i.cell.value],i)}),i)),o.textContent=i.cell.value,i.cell.canNotify=l,i.setAttribute("template",i.cell.template),o.setAttribute("value",e);break}case"ai":{if(a.firstElementChild&&a.firstElementChild.hasAttribute("value")){const e=a.firstElementChild.getAttribute("value");if(t===e)return i.cell._setStyle(a),void i.setAttribute("template",i.cell.template)}const e=(e,t)=>{const l=r.ai.url,a=r.ai.key;e.stopPropagation(),e.preventDefault();const i=e.target.closest("smart-grid-cell"),n=e.target.closest("smart-grid-row"),s=i.getAttribute("data-field"),d=n.getAttribute("data-id");t?(e.target.classList.remove("smart-icon-reload"),e.target.classList.add("smart-grid-loading")):e.target.classList.add("smart-grid-loading");let c=""+r.columnByDataField[s].AIQuery;r.columnByDataField[c]&&(c=""+r.getCellValue(d,c));for(let e=0;e<r.ai.promptVariables.length;e++){const t=r.ai.promptVariables[e],l=r.getCellValue(d,t.dataField)||"",a=new RegExp(`{{${t.name}}}`,"g");c=c.replace(a,l)}c=c.trim(),c=c.replaceAll("\n"," "),c=c.replaceAll("\r"," "),c=c.replaceAll(" "," "),c=c.substring(0,2e3),c&&l&&a?async function(e){e+="\nRespond in less than "+r.ai.maxResponseLength+" words.",e+="\nOutput always in plain text.";const t=await fetch(l,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${a}`},body:JSON.stringify({model:r.ai.model,messages:[{role:"user",content:e}],max_tokens:r.ai.maxTokens,temperature:r.ai.temperature})});if(!t.ok)throw new Error(`Error: ${t.statusText}`);return(await t.json()).choices[0].message.content.trim()}(c).then((e=>{const t=e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/'/g,"&#39;").replace(/"/g,"&quot;");r.setCellValue(d,s,t),o.setAttribute("value",t)})).catch((e=>{console.error("Error:",e)})):(r.setCellValue(d,s,r.localize("noResults")),o.setAttribute("value",r.localize("noResults")))};if(t){o=document.createElement("span"),o.style.paddingLeft="7px",o.classList.add("smart-flex");const l=i.cell.canNotify;i.cell.canNotify=!1,o.textContent=i.cell.value,i.cell.canNotify=l;const a=document.createElement("span");o.appendChild(a),a.classList.add("smart-grid-icon","show","smart-icon-reload"),a.style.position="absolute",a.style.right=a.style.top="0px",a.onpointerdown=t=>{e(t,!0)},i.setAttribute("template",i.cell.template),o.setAttribute("value",t)}else o=document.createElement("div"),o.classList.add("smart-flex","center","middle"),o.style.height="100%",o.innerHTML=`<button style="border-radius: 10px; line-height: 13px; height: 30px; padding-inline: 30px; padding-block: 2px;" class="smart-button" type="button">✨︎ ${r.localize("generate")}</button\n `,o.firstElementChild.onpointerdown=t=>{e(t)},i.setAttribute("template",i.cell.template);break}case"createdDate":case"createdTime":{const e=i.cell.row;let t=e.createdDate;if(s())return;e.history&&e.history[0]&&(t=e.history[0].date);const l=i.cell.getFormattedValue(t,"d"),r=i.cell.getFormattedValue(t,"t");if(a.firstElementChild&&a.firstElementChild.hasAttribute("created-date")){const e=l+" "+r;e!==a.firstElementChild.textContent&&(a.firstElementChild.textContent=e)}else a.innerHTML='<span created-date class="align-left smart-truncate">'+l+" "+r+"</span>";i.cell._setStyle(a),i.setAttribute("template",i.cell.template);break}case"updatedDate":case"updatedTime":if(s())return;if(i.cell.row.updatedDate){const e=i.cell.row;let t=e.updatedDate;e.history&&(t=e.history[e.history.length-1].date);const l=i.cell.getFormattedValue(t,"d"),r=i.cell.getFormattedValue(t,"t");if(a.firstElementChild&&a.firstElementChild.hasAttribute("updated-date")){const e=l+" "+r;e!==a.firstElementChild.textContent&&(a.firstElementChild.textContent=e)}else a.innerHTML='<span updated-date class="align-left smart-truncate">'+l+" "+r+"</span>"}else a.innerHTML="";i.cell._setStyle(a),i.setAttribute("template",i.cell.template);break;case"progress":{const e=t?parseInt(100*t)+"%":"0%";if(a.firstElementChild&&a.firstElementChild.hasAttribute("value")){if(e===a.firstElementChild.getAttribute("value"))return i.cell._setStyle(a),void i.setAttribute("template",i.cell.template)}const l="white",r=["#D50000","#F4511E","#F6BF26","#33B679"];let s=r[0];if(s=t<.25?r[0]:t<.5?r[1]:t<.75?r[2]:r[3],n.templateSettings){if(n.templateSettings.getComputedValue){const e=n.templateSettings.getComputedValue(i.cell.row.data,i.cell.row,i.cell.column,t);t=e}if(n.templateSettings.conditions){for(let e=0;e<n.templateSettings.conditions.length;e++){const l=n.templateSettings.conditions[e];null!==l.value&&t>=l.value&&(s=l.color)}let l=0,r=1;void 0!==n.templateSettings.min&&(l=n.templateSettings.min),void 0!==n.templateSettings.max&&(r=n.templateSettings.max);const o=t/(r-l)*100;return a.innerHTML=`\n <div style="height: 40%; top: 30%; position: relative; left: 5%; right:5%; width: 90%; overflow:hidden; border-radius: 8px; background: var(--smart-surface); border: 1px solid var(--smart-border);" class="smart-grid-progress-container" role="progressbar" \n aria-valuemin="0" aria-valuemax="100" aria-valuenow="${t}" \n aria-label="Progress: ${e}" tabindex="0">\n <div class="smart-grid-progress-fill" style="height: 100%; width: ${o}%; background: ${s};">\n </div>\n </div>\n `,void i.setAttribute("template",i.cell.template)}}a.innerHTML='<div value="'+e+'" style="padding-left: 5px; padding-right: 5px; display: grid; grid-template-columns: 1fr auto"><div style="height: 100%; display: flex; align-items: center; width: '+e+';"><div title="'+e+'" style="width: 100%; height: 4px; background: '+s+"; color: "+l+';" class="smart-truncate smart-token"></div></div><span>'+e+"</span></div>",i.setAttribute("template",i.cell.template);break}case"rating":{const e=i.cell.column.editor.max?i.cell.column.editor.max:5,l=t?parseInt(t):0;if(a.firstElementChild&&a.firstElementChild.hasAttribute("value")){if(l===parseInt(a.firstElementChild.getAttribute("value")))return i.cell._setStyle(a),void i.setAttribute("template",i.cell.template);a.firstElementChild.setAttribute("value",l);for(let t=0;t<e;t++){const e=a.firstElementChild.children[t];let i="";l>0&&l>t&&(i="value"),i?e.classList.add("value"):e.classList.remove("value")}return void i.setAttribute("template",i.cell.template)}const n=t=>{let l="";for(let a=0;a<e;a++){let e="";t>0&&t>a&&(e="value"),l+=`<div rating-value title="${a+1}" value="${a+1}" class="smart-grid-icon show smart-icon-star ${e}"></div>`}return l};a.innerHTML=`<div value="${l}" class="rating">${n(l)}</div>`;const s=e=>{if(!r._mobile&&e.hasAttribute("rating-value")){const t=e.getAttribute("value"),l=e.closest("smart-grid-cell"),a=e.closest("smart-grid-row");if(l&&a){const e=l.querySelector(".rating"),s=a.getAttribute("data-id"),o=l.getAttribute("data-field"),d=r.rowById[s],c=r.getCellValue(s,o),m=l.cell;let u=null;r.storeHistory&&(u=r._stringifyRow(d)),c===t?(a.row.data[o]=0,e.innerHTML=n(0),e.setAttribute("value",0)):(a.row.data[o]=parseInt(t),e.innerHTML=n(parseInt(t)),e.setAttribute("value",t));const p=a.row.data[o];r._setCellUndoRedo(m,c,p),r.onCellUpdate&&r.onCellUpdate([m],[c],[p],(function(e){r.onCellUpdated&&r.onCellUpdated([m.row.index],[m.row],[m.column],[m.row.data],[c],[p],i),r._onCellUpdated&&r._onCellUpdated(m.row.index,m.row,m.column,m.row.data,c,p)}),i);const g=e=>{if(e!==c&&(d.updatedDate=new Date,d.updatedBy=i.currentUser,r.storeHistory)){const t=r._stringifyRow(d);t[m.column.dataField]=e,r._updateRowHistory(d,u,t)}};if(r.onCellUpdate&&r.onRowHistory){const e=r.onRowHistory;r.onRowHistory=null,g(p),setTimeout((()=>{r.onRowHistory=e}),100)}else g(p);const f=l.querySelector(".rating"),h=parseInt(t)-1;f.children[h].classList.add("down"),setTimeout((()=>{f.children[h].classList.remove("down")}),1e3)}}},o=(e,t=!0)=>{if(e&&[...e.querySelectorAll(".smart-icon-star")].forEach((e=>{e.classList.remove("hover")})),e.hasAttribute("value")){const l=[...e.parentElement.children],a=l.indexOf(e);l.forEach(((e,l)=>{e.classList.remove("hover"),l<=a&&t&&e.classList.add("hover")}))}};r.editing.enabled?(r.handleRatingClick||(r._handleRatingMove=o,r._handleRatingClick=s),a.firstElementChild.onpointerdown=e=>{s(e.target)},a.firstElementChild.onpointermove=e=>{o(e.target)},a.firstElementChild.onpointerleave=e=>{o(e.target)}):a.firstElementChild.style.pointerEvents="none",i.setAttribute("template",i.cell.template);break}case"vote":{let e=t;const l=(e,t)=>{const l=e.firstElementChild.firstElementChild,a=r.users?r.users.length:1,i=t.length*(100/a)+"%",n=t.length>0?"voted":"",s=l.firstElementChild,o=s.children[0];l.children[1].children[0].classList.remove("smart-votes-bar-animate"),r.isScrolling||l.children[1].children[0].classList.add("smart-votes-bar-animate");const d=l.children[1].firstElementChild.children[0],c=l.children[2];s.classList.remove("voted"),o.classList.remove("smart-icon-check"),n&&(o.classList.add("smart-icon-check"),s.classList.add("voted")),c.textContent=t.length,d.style.width=i,e.firstElementChild.setAttribute("value",t)};if(a.firstElementChild&&a.firstElementChild.hasAttribute("value")){const t=a.firstElementChild.getAttribute("value"),r=a.firstElementChild;return r.removeAttribute("color"),r.style.setProperty("--smart-check-template-color","var(--smart-primary)"),r.style.setProperty("--smart-check-template-forecolor","#ffffff"),i.cell.column.templateSettings&&i.cell.column.templateSettings.color&&(r.style.setProperty("--smart-check-template-color",i.cell.column.templateSettings.color),r.setAttribute("color","")),e=e?e.split():[],l(a,e),e===t?(i.cell._setStyle(a),void i.setAttribute("template",i.cell.template)):(a.firstElementChild.setAttribute("value",e),void i.setAttribute("template",i.cell.template))}const n=e=>{e&&!Array.isArray(e)&&(e=e?e.split():[]);const t=r.users?r.users.length:1,l=e.length*(100/t)+"%;";return`<div vote-value class="smart-flex middle center smart-votes-cell-component">\n <div class="smart-flex middle center smart-vote-button ${e.length>0?"voted":""}">\n <span class="smart-icon smart-grid-icon show ${e.length>0?"smart-icon-check":""}"></span>\n </div>\n <div class="smart-votes-bar-container">\n <div class="smart-votes-bar-component">\n <div class="smart-votes-bar" style="width: ${l} opacity: 1;"></div>\n <div class="smart-votes-bar-frame" style="width: 100%; opacity: 0.2;"></div>\n </div>\n </div>\n <div class="smart-voters-info">${e.length}</div>\n </div>`};a.innerHTML=`<div value="${e}" class="vote">${n(e)}</div>`,i.cell.column.templateSettings&&i.cell.column.templateSettings.color&&(o=a.firstElementChild,o.style.setProperty("--smart-check-template-forecolor","#ffffff"),o.setAttribute("color",""),o.style.setProperty("--smart-check-template-color",i.cell.column.templateSettings.color));const s=(e,t,a)=>{if(r._mobile)return;const n=e.closest("smart-grid-cell"),s=e.closest("smart-grid-row"),o=(e,t)=>{const a=r.rowById[e],o=r.getCellValue(e,t),d=n.cell;let c=null;r.storeHistory&&(c=r._stringifyRow(a));const m=o?o.split(","):[],u=r._currentUser?""+r._currentUser.info.id:null;if(void 0===u)return;m.indexOf(u)>=0?(m.splice(m.indexOf(u),1),s.row.data[t]=m.toString(),l(n.firstElementChild,m)):(m.push(u),s.row.data[t]=m.toString(),l(n.firstElementChild,m));const p=s.row.data[t];r._setCellUndoRedo(d,o,p),r.onCellUpdate&&r.onCellUpdate([d],[o],[p],(function(){r.onCellUpdated&&r.onCellUpdated([d.row.index],[d.row],[d.column],[d.row.data],[o],[p],i),r._onCellUpdated&&r._onCellUpdated(d.row.index,d.row,d.column,d.row.data,o,p)}),i);const g=e=>{if(e!==o&&(a.updatedDate=new Date,a.updatedBy=i.currentUser,r.storeHistory)){const t=r._stringifyRow(a);t[d.column.dataField]=e,r._updateRowHistory(a,c,t)}};if(r.onCellUpdate&&r.onRowHistory){const e=r.onRowHistory;r.onRowHistory=null,g(p),setTimeout((()=>{r.onRowHistory=e}),100)}else g(p)};if(n&&s){o(s.getAttribute("data-id"),n.getAttribute("data-field"))}else null!==t&&null!==a&&o(t,a)};r._handleVoteClick||(r._handleVoteClick=s),a.firstElementChild.onpointerdown=e=>{s(e.target)},a.firstElementChild.onpointerenter=e=>{const t=e.target.closest("smart-grid-cell"),l=e.target.closest("smart-grid-row");if(t&&l){const i=l.getAttribute("data-id"),n=t.getAttribute("data-field");let s=r.getCellValue(i,n);if(s){if(r.users){let e="";s=s.split(),r.users.forEach((t=>{(s.indexOf(""+t.id)>=0||s.indexOf(""+t.value)>=0)&&(e+=t.name||t.label)})),e&&(s=r.localize("votes",{value:e}))}}else s=r.localize("noVotes");r._createTooltip(e,s,a,"top")}},a.firstElementChild.onpointerleave=()=>{r._cellTooltip&&(r._cellTooltip.style.visibility="hidden")},i.setAttribute("template",i.cell.template);break}case"duration":{const e=t;if(a.firstElementChild&&a.firstElementChild.hasAttribute("value")){if(e===a.firstElementChild.getAttribute("value"))return i.cell._setStyle(a),void i.setAttribute("template",i.cell.template)}if(t){const e=864e5;let l="MMM dd",n="MMM dd";if("string"==typeof t[0]&&(Array.isArray(t)?(t[0]=new Date(t[0]),t[1]=new Date(t[1])):((t=t.split(","))[0]=new Date(t[0]),t[1]=new Date(t[1]))),Array.isArray(t)){t[0]&&"string"==typeof t[0]&&(t[0]=new Date(t[0])),t[1]&&"string"==typeof t[1]&&(t[1]=new Date(t[1])),t[1]&&t[1].getMonth()===t[0].getMonth()&&(n="dd"),t[0]&&t[0].getFullYear()!==(new Date).getFullYear()&&(l+=", yyyy","dd"===n?(l="MMM dd",n+=", yyyy"):n=l);let s=!1;t[0]&&(0===t[0].getHours()&&0===t[0].getHours()||(l+=" hh:mm","dd"===n?n=l:n+=" hh:mm",s=!0));let o=null;o=Math.round(t[1].getTime()-t[0].getTime())/e;const d=o?parseInt(Math.abs(o).toFixed(0)):0;if(d>0){const e=i.cell.getFormattedValue(t[0],l)+" - "+i.cell.getFormattedValue(t[1],n);let s="";s=r.localize("days",{value:d}),a.innerHTML=`<div style="display: grid; grid-template-columns: 5px auto 25px"><span></span><span>${e}</span><span style="font-size: 11px;" class="smart-quiet">${s}</span></div>`}else{let e="";if(s){const r=t[1]-t[0],n=Math.floor(r%864e5/36e5);let s=Math.round(r%864e5%36e5/6e4);s<10&&(s+="0"+s),e=n+":"+s;const o=i.cell.getFormattedValue(t[0],l)+" - "+i.cell.getFormattedValue(t[1],"hh:mm");a.innerHTML=`<div style="display: grid; grid-template-columns: 5px auto 25px"><span></span><span>${o}</span><span style="font-size: 11px;" class="smart-quiet">${e}</span></div>`}else{const r=i.cell.getFormattedValue(t[0],l);a.innerHTML=`<div style="display: grid; grid-template-columns: 5px auto 25px"><span></span><span>${r}</span><span style="font-size: 11px;" class="smart-quiet">${e}</span></div>`}}}}else a.innerHTML="";i.setAttribute("template",i.cell.template),a.firstElementChild&&a.firstElementChild.setAttribute("value",e);break}case"startDate":{const e=t;if(a.firstElementChild&&a.firstElementChild.hasAttribute("value")){if(e===a.firstElementChild.getAttribute("value"))return i.cell._setStyle(a),void i.setAttribute("template",i.cell.template)}if(s())return;let l=t;if(n.cellsFormat?l=i.cell.getFormattedValue(t,n.cellsFormat):n.formatSettings&&n.formatSettings.Intl&&(l=i.cell.getFormattedValue(t,n.formatSettings.Intl)),t){const e=864e5,s="string"==typeof t?new Date(t):t;let o=r.columnByDataField.taskDueDate;n.editor.boundDateField?o=r.columnByDataField[n.editor.boundDateField]:n.relationField&&(o=r.columnByDataField[n.relationField]);let d=o?i.cell.row.data[o.dataField]:"";d&&"string"==typeof d&&(d=new Date(d));let c=null;d&&(c=Math.round(s.getTime()-d.getTime())/e);const m=c?parseInt(Math.abs(c).toFixed(0)):0;if(m>0){let e="";e=r.localize("days",{value:m}),a.innerHTML=`<div style="padding-right: 7px; display: grid; grid-template-columns: 25px auto 25px"><span style="color: var(--smart-primary);" title="${e}" class="smart-icon-clock smart-grid-icon show"></span><span>${l}</span><span style="font-size: 11px;" class="smart-quiet">${e}</span></div>`}else a.innerHTML='<div style="padding-left: 7px;">'+l+"</div>"}else a.innerHTML="";i.setAttribute("template",i.cell.template),i.setAttribute("value",e);break}case"dueDate":{const e=t;if(a.firstElementChild&&a.firstElementChild.hasAttribute("value")){if(e===a.firstElementChild.getAttribute("value"))return i.cell._setStyle(a),void i.setAttribute("template",i.cell.template)}if(s())return;const l=["#D50000","#F4511E","#F6BF26","#33B679"],o=n.editor.date||(n.templateSettings&&n.templateSettings.date?n.templateSettings.date:new Date)||new Date;o.setHours(0,0,0);let d=t;n.cellsFormat?d=i.cell.getFormattedValue(t,n.cellsFormat):n.formatSettings&&n.formatSettings.Intl&&(d=i.cell.getFormattedValue(t,n.formatSettings.Intl));const c=(e,t)=>{const l=e<=8?e/8:1;return`<div title="${t}" class="smart-element smart-circular-progress-bar" style="background: inherit; padding-left:4px; position: relative; top: calc(50% - 12px); padding-top:4px; width: 20px; height: 20px;">\n <div class="smart-container">\n <svg style="left: 0px; top: 0px; background: var(--smart-background);"width="100%" height="100%" viewPort="0 0 100 100" viewBox="0 0 100 100" role="presentation" aria-hidden="true">\n <circle id="value" class="smart-value-path" r="50" cx="50" cy="50" transform="rotate(270 50 50)"></circle>\n <circle id="value" style="stroke-dashoffset: ${100*Math.PI-(1-l)*Math.PI*100}; stroke-width: 100%;" class="smart-value" r="50" cx="50" cy="50" transform="rotate(270 50 50)"></circle>\n </svg>\n </div>\n </div>\n `};if(t){const s=864e5,m="string"==typeof t?new Date(t):t,u=Math.round(m.getTime()-o.getTime())/s,p=parseInt(Math.abs(u).toFixed(0));let g=r.columnByDataField.taskStatus;n.editor.boundDataField?g=r.columnByDataField[n.editor.boundDataField]:n.relationField&&(g=r.columnByDataField[n.relationField]);const f=g?i.cell.row.data[g.dataField]:"";if("done"===f||"complete"===f||"completed"===f||"finished"===f||!0===f||"done"===(""+f).toLowerCase()||"complete"===(""+f).toLowerCase()||"completed"===(""+f).toLowerCase()||"finished"===(""+f).toLowerCase()||1===f||"1"===f){let e=r.localize("done");a.innerHTML=`<div style="padding-right: 7px; display: grid; grid-template-columns: 25px auto"><div style="margin-left: 4px; align-self: center; border-radius: 50%; display: flex; align-content: center; background: ${l[3]}; width:16px; height: 16px;"><span title="${e}" style="align-content: center; font-size: 13px; color: white;" class="smart-grid-icon show smart-icon-check"></span></div>${d}</span></div>`}else{let t="";t=0===p?r.localize("today"):1===p?e<o?r.localize("yesterday"):r.localize("tomorrow"):e<o?r.localize("daysOverdue",{value:p}):r.localize("daysLeft",{value:p}),a.innerHTML=e>=o?`<div style="padding-right: 7px; display: grid; grid-template-columns: 25px auto">${c(p,t)}<span>${d}</span></div>`:`<div style="padding-right: 7px; display: grid; grid-template-columns: 25px auto"><span title="${t}" style="font-size: 16px; color: ${l[0]}" class="smart-grid-icon show smart-icon-attention-circled"></span>${d}</span></div>`}t=t+"_"+f}else a.innerHTML="";i.setAttribute("template",i.cell.template),i.setAttribute("value",e);break}case"attachments":{if(""===t||"[]"===t){const e=`<div class="file-container"><div class="attachments"><div title="${r.localize("addFiles")}" class="smart-grid-icon show smart-icon-plus"></div></div></div>`;return a.innerHTML!==e&&(a.innerHTML=e,a.onpointerdown=e=>{if(e.target.classList.contains("smart-icon-plus")){if(r._mobile)return;if(r.editing.enabled){const t=e.target.closest("smart-grid-cell"),l=t.getAttribute("data-field"),a=t.closest("smart-grid-row").getAttribute("data-id");r.beginEdit(a,l),t.querySelector(".smart-icon-plus").onpointerdown()}e.stopPropagation(),e.preventDefault()}}),i.cell._setStyle(a),void i.setAttribute("template",i.cell.template)}if(a.firstElementChild&&a.firstElementChild.hasAttribute("value")){const e=a.firstElementChild.getAttribute("value");if(t&&t.indexOf(e)>=0)return i.cell._setStyle(a),i.setAttribute("template",i.cell.template),void(a.firstElementChild.evaluateScroll&&a.firstElementChild.evaluateScroll());if(e&&t&&Array.isArray(t)&&t[0]&&t[0].value&&e.length===t[0].value.length)return i.cell._setStyle(a),void i.setAttribute("template",i.cell.template)}const e=document.createElement("div"),l=document.createElement("div");e.classList.add("file-container"),l.classList.add("attachments");let n=t;if(r._findIsFile(n)){let e="";if(n)try{e=JSON.parse(n)}catch(e){console.log(e)}n=e}if("string"==typeof n&&(n.indexOf("[{")>=0||n.indexOf("}]")>=0)){let e="";if(n)try{e=JSON.parse(n)}catch(e){console.log(e)}n=e}Array.isArray(n)&&n.forEach((t=>{const l=document.createElement("div");l.title=t.label,l.classList.add("item"),l.innerHTML="<div></div>",l.firstElementChild.classList.add("smart-grid-icon","show","attachment"),t.label||(t.label=""),t.label.indexOf("png")>=0||t.label.indexOf("jpg")>=0||t.label.indexOf("jpeg")>=0||t.label.indexOf("gif")>=0?l.firstElementChild.classList.add("smart-icon-image"):t.label.indexOf(".pdf")>=0?l.firstElementChild.classList.add("smart-icon-pdf"):t.label.indexOf(".tsv")>=0||t.label.indexOf(".txt")>=0||t.label.indexOf(".csv")>=0?l.firstElementChild.classList.add("smart-icon-text"):t.label.indexOf(".xls")>=0||t.label.indexOf(".xlsx")>=0?l.firstElementChild.classList.add("smart-icon-excel"):t.label.indexOf(".ppt")>=0?l.firstElementChild.classList.add("smart-icon-powerpoint"):t.label.indexOf(".zip")>=0||t.label.indexOf(".rar")>=0||t.label.indexOf(".7z")>=0?l.firstElementChild.classList.add("smart-icon-archive"):t.label.indexOf(".doc")>=0||t.label.indexOf(".docx")>=0?l.firstElementChild.classList.add("smart-icon-word"):t.label.indexOf(".mp3")>=0?l.firstElementChild.classList.add("smart-icon-music"):t.label.indexOf(".mp4")>=0||t.label.indexOf(".avi")>=0||t.label.indexOf(".mov")>=0||t.label.indexOf(".mp4")>=0||t.label.indexOf(".mpeg")>=0||t.label.indexOf(".webm")>=0||t.value&&t.value.indexOf("youtube")>=0?l.firstElementChild.classList.add("smart-icon-video"):l.firstElementChild.classList.add("smart-icon-file"),e.appendChild(l)}));const s=document.createElement("div");s.classList.add("smart-arrow-left","arrowbtn","smart-hidden");const d=document.createElement("div");d.classList.add("smart-arrow-right","arrowbtn");const c=document.createElement("div");if(c.classList.add("smart-icon-plus","smart-grid-icon","show"),c.title=r.localize("addFiles"),"card"!==r.view&&l.appendChild(c),l.onpointerdown=t=>{if(t.target.classList.contains("attachment")){const e=JSON.parse(i.cell.value),a=[...l.children[1].children],n=a&&a.indexOf?a.indexOf(t.target.parentNode):-1;if(e[n]){const t=document.createElement("a");if(e[n].value.indexOf(window.location.host)>=0)fetch(e[n].value).then((e=>e.blob())).then((l=>{const a=URL.createObjectURL(l);t.download=e[n].label,t.href=a,t.click()}));else{if(e[n].value.indexOf("base64")>=0){const l=r._getFileFromBase64(e[n].value);t.href=URL.createObjectURL(l)}else t.href=e[n].value;t.target="_blank",t.click()}}t.stopPropagation(),t.preventDefault()}else if("DIV"===t.target.nodeName&&t.target.classList.contains("arrowbtn")){let l=parseInt(e.style.marginLeft);isNaN(l)&&(l=0);const a=s===t.target,r=e.scrollWidth-i.offsetWidth+30;e.style.marginLeft=a?Math.min(0,l+25)+"px":Math.max(-r,l-25)+"px",l=parseInt(e.style.marginLeft),0===l?s.classList.add("smart-hidden"):s.classList.remove("smart-hidden"),t.stopPropagation(),t.preventDefault()}else if(t.target.classList.contains("smart-icon-plus")){if(r._mobile)return;if(r.editing.enabled){const e=t.target.closest("smart-grid-cell"),l=e.getAttribute("data-field"),a=e.closest("smart-grid-row").getAttribute("data-id");r.beginEdit(a,l),e.querySelector(".smart-icon-plus").onpointerdown()}t.stopPropagation(),t.preventDefault()}},e.children.length){if(l.appendChild(e),"card"!==r.view){const t=25*n.length;t-i.offsetWidth+30>30&&(l.appendChild(s),l.appendChild(d)),l.evaluateScroll=()=>{const a=t-i.offsetWidth+30;e.style.marginLeft="0px",s.classList.add("smart-hidden"),a<0?d.classList.add("smart-hidden"):d.classList.remove("smart-hidden"),a>30&&(l.appendChild(s),l.appendChild(d))}}o=l}else o=document.createElement("div");i.setAttribute("template",i.cell.template),t&&t[0]&&t[0].value?o.setAttribute("value",t[0].value):n&&n[0]&&n[0].label?o.setAttribute("value",n[0].label):o.setAttribute("value",t);break}case"images":{if(""===t||"[]"===t){const e=`<div class="file-container"><div class="images"><div title="${r.localize("addImages")}" class="smart-grid-icon show smart-icon-plus"></div></div></div>`;return e!==a.innerHTML&&(a.innerHTML=e,a.onpointerdown=e=>{if(e.target.classList.contains("smart-icon-plus")){if(r._mobile)return;if(r.editing.enabled){const t=e.target.closest("smart-grid-cell"),l=t.getAttribute("data-field"),a=t.closest("smart-grid-row").getAttribute("data-id");r.beginEdit(a,l),t.querySelector(".smart-icon-plus").onpointerdown()}e.stopPropagation(),e.preventDefault()}}),i.cell._setStyle(a),void i.setAttribute("template",i.cell.template)}if(!r._recycleFiles&&a.firstElementChild&&a.firstElementChild.hasAttribute("value")){const e=a.firstElementChild.getAttribute("value");if(t&&t.indexOf(e)>=0)return i.cell._setStyle(a),i.setAttribute("template",i.cell.template),void(a.firstElementChild.evaluateScroll&&a.firstElementChild.evaluateScroll());if(e&&t&&Array.isArray(t)&&t[0]&&t[0].value&&e.length===t[0].value.length)return i.cell._setStyle(a),void i.setAttribute("template",i.cell.template)}const e=document.createElement("div"),l=document.createElement("div"),s=document.createDocumentFragment();e.classList.add("file-container"),l.classList.add("images");let d=t;if(r._findIsFile(d)){let e="";if(d&&d.indexOf("{")>=0)try{e=JSON.parse(d)}catch(e){console.log(e)}else e=d.split(","),e=e.map((e=>({label:e,value:e})));d=e}if("string"==typeof d&&(d.indexOf("[{")>=0||d.indexOf("}]")>=0)){let e="";if(d)try{e=JSON.parse(d)}catch(e){console.log(e)}d=e}else"string"==typeof d&&d.indexOf("./")>=0&&(d=d.split(","),d=d.map((e=>({label:e,value:e}))));Array.isArray(d)&&d.forEach((e=>{if(e.label||(e.label=""),e.label.indexOf(".mp4")>=0||e.label.indexOf(".avi")>=0||e.label.indexOf(".mov")>=0||e.label.indexOf(".mp4")>=0||e.label.indexOf(".mpeg")>=0||e.label.indexOf(".webm")>=0||e.value&&e.value.indexOf("youtube")>=0){const t=document.createElement("div");t.title=e.label,t.classList.add("item"),t.innerHTML="<div></div>",t.firstElementChild.classList.add("smart-grid-icon","show","attachment"),t.firstElementChild.classList.add("smart-icon-video"),s.appendChild(t)}else{const t=document.createElement("img");t.style.display="none";let l="";l=e.label.indexOf(".gif")>=0?e.value:e.small?e.small:e.medium?e.medium:e.large?e.large:e.value,t.onload=()=>{t.style.display=""},l.indexOf("base64")>=0?t.src=l:(r._imagesCache||(r._imagesCache=[]),r.uploadSettings.url?r._imagesCache[l]?r._findUserFile(e)&&(t.src=l):(r._imagesCache[l]=!0,t.style.display="none",r._findUserFile(e)?(t.src=l,t.style.display=""):l&&l.startsWith("https://")&&(t.src=l)):t.src=l,t.onerror=()=>{t.style.display="none"}),t.title=e.label,t.setAttribute("data-url",e.large||e.value),s.appendChild(t)}}));const c=document.createElement("div");c.classList.add("smart-arrow-left","arrowbtn","smart-hidden");const m=document.createElement("div");m.classList.add("smart-arrow-right","arrowbtn");const u=document.createElement("div");u.classList.add("smart-icon-plus","smart-grid-icon","show"),u.title=r.localize("addImages");const p=document.createElement("div");if(p.classList.add("smart-navigation"),"card"!==r.view&&r.editing.enabled&&n.allowEdit&&l.appendChild(u),l.onpointerdown=t=>{if("IMG"===t.target.nodeName&&("card"!==r.view&&[...e.children].forEach((e=>e.classList.remove("smart-hidden"))),r._openImagePreviewDialog(t.target),t.stopPropagation(),t.preventDefault()),t.target.classList.contains("attachment")){const l=JSON.parse(i.cell.value),a=[...e.children].indexOf(t.target.parentNode);if(l[a]){const e=document.createElement("a");if(l[a].value.indexOf(window.location.host)>=0)fetch(l[a].value).then((e=>e.blob())).then((t=>{const i=URL.createObjectURL(t);e.download=l[a].label,e.href=i,e.click()}));else{if(l[a].value.indexOf("base64")>=0){const t=r._getFileFromBase64(l[a].value);e.href=URL.createObjectURL(t)}else e.href=l[a].value;e.target="_blank",e.click()}}t.stopPropagation(),t.preventDefault()}else if("DIV"===t.target.nodeName&&t.target.classList.contains("smart-navigation-item")){[...p.children].forEach((e=>e.classList.remove("active"))),t.target.classList.add("active"),[...e.children].forEach((e=>e.classList.add("smart-hidden")));const l=[...p.children].indexOf(t.target);e.children[l].classList.remove("smart-hidden"),t.stopPropagation(),t.preventDefault()}else if("DIV"===t.target.nodeName&&t.target.classList.contains("arrowbtn")){let l=parseInt(e.style.marginLeft);isNaN(l)&&(l=0);const a=c===t.target,r=e.scrollWidth-i.offsetWidth+30;e.style.marginLeft=a?Math.min(0,l+25)+"px":Math.max(-r,l-25)+"px",l=parseInt(e.style.marginLeft),0===l?c.classList.add("smart-hidden"):c.classList.remove("smart-hidden"),t.stopPropagation(),t.preventDefault()}else if(t.target.classList.contains("smart-icon-plus")){if(r._mobile)return;if(r.editing.enabled){const e=t.target.closest("smart-grid-cell"),l=e.getAttribute("data-field"),a=e.closest("smart-grid-row").getAttribute("data-id");r.beginEdit(a,l),e.querySelector(".smart-icon-plus").onpointerdown()}t.stopPropagation(),t.preventDefault()}},e.appendChild(s),e.children.length){if(l.appendChild(e),"card"===r.view&&l.appendChild(p),"card"!==r.view){const t=25*d.length;t-i.offsetWidth+30>30&&(l.appendChild(c),l.appendChild(m)),l.evaluateScroll=()=>{const a=t-i.offsetWidth+30;e.style.marginLeft="0px",c.classList.add("smart-hidden"),a<0?m.classList.add("smart-hidden"):m.classList.remove("smart-hidden"),a>30&&(l.appendChild(c),l.appendChild(m))}}else{for(let t=0;t<e.children.length;t++){const l=document.createElement("div");l.classList.add("smart-navigation-item"),0===t?l.classList.add("active"):e.children[t].classList.add("smart-hidden"),p.appendChild(l)}1===e.children.length&&p.classList.add("smart-visibility-hidden")}o=l}else o=document.createElement("div");i.setAttribute("template",i.cell.template),t&&t[0]&&t[0].value?o.setAttribute("value",t[0].value):d&&d[0]&&d[0].label?o.setAttribute("value",d[0].label):o.setAttribute("value",t);break}case"email":if(Smart.Validator){const e=a.firstElementChild?a.firstElementChild.getAttribute("value"):null;if(a.firstElementChild&&a.firstElementChild.hasAttribute("value")&&e===t)return i.cell._setStyle(a),void i.setAttribute("template",i.cell.template);if(s())return;o=document.createElement("span"),null===t||""===t?o.innerHTML="":Smart.Validator.email(t)?o.innerHTML=t:(o.className="url center middle",o.innerHTML='<a href="mailto:'+t+'" target="_blank" contenteditable="false" rel="noreferrer noopener">'+t+"</a>",o.firstElementChild&&(o.firstElementChild.onpointerdown=e=>{e.stopPropagation(),e.preventDefault(),o.firstElementChild.click()}))}i.setAttribute("template",i.cell.template),o.setAttribute("value",t);break;case"url":if(Smart.Validator){const e=a.firstElementChild?a.firstElementChild.getAttribute("value"):null;if(a.firstElementChild&&a.firstElementChild.hasAttribute("value")&&e===t)return i.cell._setStyle(a),void i.setAttribute("template",i.cell.template);if(s())return;const l=e=>{e.classList.add("center","middle"),null===t||""===t?e.classList.add("smart-hidden"):Smart.Validator.url(t)?(e.firstElementChild&&"A"===e.firstElementChild.nodeName?(e.firstElementChild.setAttribute("href",t),e.firstElementChild.textContent=t):e.innerHTML='<a href="https://'+t+'" target="_blank" contenteditable="false" rel="noreferrer noopener">'+t+"</a>",e.classList.remove("smart-hidden")):(e.firstElementChild&&"A"===e.firstElementChild.nodeName?(e.firstElementChild.setAttribute("href",t),e.firstElementChild.textContent=t):e.innerHTML='<a href="'+t+'" target="_blank" contenteditable="false" rel="noreferrer noopener">'+t+"</a>",e.classList.remove("smart-hidden"))};a.firstElementChild&&a.firstElementChild.classList.contains("url")?(o=a.firstElementChild,l(o)):(o=document.createElement("span"),o.className="url",l(o)),o.firstElementChild&&(o.firstElementChild.onpointerdown=e=>{e.stopPropagation(),e.preventDefault(),o.firstElementChild.click()})}i.setAttribute("template",i.cell.template),o.setAttribute("value",t);break;case"sparklines":{const l=t,o=""+n.computedWidth;if(a.firstElementChild&&a.firstElementChild.hasAttribute("value")){const e=a.firstElementChild.getAttribute("value"),t=a.firstElementChild.getAttribute("width"),n=a.firstElementChild.getAttribute("height"),s=i.cell.row.cellHeight||r.layout.rowMinHeight;if(l===e&&t===o&&s===n)return i.cell._setStyle(a),void i.setAttribute("template",i.cell.template)}const d=(e,t,l)=>{if(!1===c.tooltip)return;const a=e.pageX,i=e.pageY-10;if(!r._sparklineTooltip){const e=document.createElement("smart-button");e.classList.add("secondary"),e.style.boxShadow="var(--smart-elevation-4)",e.style.opacity=.9,e.style.transition="all cubic-bezier(0.6, 0.2, 0, 0.8) 0.2s",document.body.appendChild(e),e.style.position="absolute",e.style.zIndex=999,r._sparklineTooltip=e}const n=r._sparklineTooltip;n.innerHTML===t&&n.element===l||(n.style.top=i+25+"px",n.style.left=a-15+"px"),n.innerHTML=""+t,n.style.display=""},c=n.templateSettings,m=()=>{a.onmousemove=e=>{if("column"!==c.type&&"bar"!==c.type||a.querySelectorAll("rect").forEach((t=>{var l=t.getBoundingClientRect();t.removeAttribute("highlight"),l.left<=e.clientX&&e.clientX<=l.right&&l.top<=e.clientY&&e.clientY<=l.bottom&&(t.setAttribute("highlight",""),d(e,t.getAttribute("data-title"),t))})),"pie"===c.type){let t=!1;a.querySelectorAll("path").forEach((l=>{var a=l.getBoundingClientRect();l.removeAttribute("highlight"),t||a.left<=e.clientX&&e.clientX<=a.right&&a.top<=e.clientY&&e.clientY<=a.bottom&&(l.setAttribute("highlight",""),t=!0,d(e,l.getAttribute("data-title"),l))}))}"line"===c.type&&a.querySelectorAll("line").forEach((t=>{var l=t.getBoundingClientRect();t.removeAttribute("highlight"),l.left<=e.clientX&&e.clientX<=l.right&&(t.previousElementSibling&&(t.previousElementSibling.style.display="none"),t.nextElementSibling&&(t.nextElementSibling.style.display="none"),t.setAttribute("highlight",""),l.left+l.width/2>=e.clientX?t.previousElementSibling&&(t.previousElementSibling.style.display="",d(e,t.previousElementSibling.getAttribute("data-title"),t.previousElementSibling)):t.nextElementSibling&&(t.nextElementSibling.style.display="",d(e,t.nextElementSibling.getAttribute("data-title"),t.nextElementSibling)))}))},a.onmouseleave=()=>{r._sparklineTooltip&&(r._sparklineTooltip.style.display="none"),a.querySelectorAll("rect").forEach((e=>{e.removeAttribute("highlight")})),a.querySelectorAll("path").forEach((e=>{e.removeAttribute("highlight")})),a.querySelectorAll("line").forEach((e=>{e.removeAttribute("highlight")})),a.querySelectorAll("circle").forEach((e=>{e.style.display="none"}))}};if(s())return void m();const u=new e,p=i.cell.row.cellHeight||r.layout.rowMinHeight;if(p>=7)if(i._sparklinesRender&&cancelAnimationFrame(i._sparklinesRender),t){const e=u.render({width:o-10,height:Math.max(0,p-7),points:t,colors:c.colors,type:c.type,gap:c.gap,max:c.max,min:c.min,padding:c.padding,roundedCorners:c.roundedCorners,strokeWidth:c.strokeWidth,colorFunction:c.colorFunction,tooltipFormatFunction:c.tooltipFormatFunction});a.innerHTML=`<div height="${p}" width="${o}" value="${l}" style="padding-top: 5px; padding-left: 5px; padding-right: 5px;">${e}</div>`,m()}else a.innerHTML="",a.onmousemove=a.onmouseleave=null;i.setAttribute("template",i.cell.template);break}default:{let e=null;i.setAttribute("template","");const l=i.cell.row,s=a;let o=i.cell.getFormattedValue(t,n.cellsFormat);if(s.style.lineHeight="","function"==typeof i.cell.template){const e={row:l,column:n,cell:i.cell,oldValue:i.cell.oldValue,value:t,data:l.data,template:null},a=i.cell.column.templateSettings.React||r.React,d=i.cell.column.templateSettings.ReactDOM||r.ReactDOM;if(i.cell.column.templateSettings&&a&&d){return void d.createRoot(s).render(a.createElement(i.cell.template,e))}let c=s.querySelector(".smart-grid-cell-template");const m=l.id;r.isHScrolling&&(r._cachedTemplates||(r._cachedTemplates=[]),c&&0===c.innerHTML.length&&(c=null),!c&&r._cachedTemplates&&r._cachedTemplates[n.dataField+"_"+m]&&(0===r._cachedTemplates[n.dataField+"_"+m].innerHTML.length?delete r._cachedTemplates[n.dataField+"_"+m]:e.template=r._cachedTemplates[n.dataField+"_"+m])),c&&c.getAttribute("column")===n.dataField?e.template=c.firstElementChild:c=null,i.formattedValue!==o&&(c=null),i.cell.canNotify=!1,l.canNotify=!1;const u=Object.assign({},{background:i.cell.background,color:i.cell.color,fontSize:i.cell.fontSize,fontFamily:i.cell.fontFamily,fontWeight:i.cell.fontWeight,textDecoration:i.cell.textDecoration,fontStyle:i.cell.fontStyle});if(i.cell.template(e),!c&&e.template)if(e.template instanceof HTMLElement){const t=document.createElement("div");t.classList.add("smart-grid-cell-template"),t.setAttribute("column",n.dataField),s.innerHTML="",s.appendChild(t),t.appendChild(e.template)}else s.innerHTML='<div column="'+n.dataField+'" class="smart-grid-cell-template">'+e.template+"</div>";else c||null!==e.template||(s.innerHTML=t);if(r.isHScrolling&&!r._cachedTemplates[n.dataField+"_"+m]&&s.firstElementChild.firstElementChild){const e=s.firstElementChild.firstElementChild;e&&(r._cachedTemplates[n.dataField+"_"+m]=e)}s.style.background===u.background&&s.style.color===u.color&&s.style.fontSize===u.fontSize&&s.style.fontWeight===u.fontWeight&&s.style.fontStyle===u.fontStyle||(i.cell._styleChanged=!0,i.cell._setStyle(s)),i.cell.background!==u.background||i.cell.color!==u.color||i.cell.fontSize!==u.fontSize||i.cell.fontWeight!==u.fontWeight||i.cell.fontStyle!==u.fontStyle?(i.cell._styleChanged=!0,i.cell._setStyle(s)):i.cell._styleChanged&&i.cell._setStyle(s),void 0===i.cell.oldValue&&(i.cell.oldValue=t),i.formattedValue=o,i.cell.canNotify=!0,l.canNotify=!0}else if(Array.isArray(i.cell.template)){const e=document.createElement("div");if(s.firstElementChild&&s.firstElementChild.classList.contains("smart-grid-cell-template"))for(let e=0;e<i.cell.template.length;e++){const t=s.firstElementChild.children[e].firstElementChild,a=i.cell.template[e];if(a.length>1&&t){let e=l.data[a[1]];a[2]&&(e=a[2].length>2?a[2].replaceAll("{{value}}",e):i.cell.getFormattedValue(e,a[2])),t.src&&t.src!==e?(i._imageUpdateTimer&&clearTimeout(i._imageUpdateTimer),i._imageUpdateTimer=setTimeout((()=>{t.src=e}),50)):t.textContent!==e&&(t.textContent=e)}}else{e.classList.add("smart-grid-cell-template"),e.setAttribute("column",n.dataField),s.innerHTML="",s.appendChild(e);let t="";for(let e=0;e<i.cell.template.length;e++){const a=i.cell.template[e];if(a.length>1){let e=l.data[a[1]];a[2]&&(e=a[2].length>2?a[2].replaceAll("{{value}}",e):i.cell.getFormattedValue(e,a[2])),t+='<span class="smart-template-part">'+a[0].replaceAll("{{value}}",e)+"</span>"}}e.innerHTML=t}}else{if(""!==s.textContent&&(s.textContent=""),i.cell.template instanceof HTMLTemplateElement)e=i.cell.template;else if(i.cell.template instanceof HTMLElement){const e=i.cell.template.innerHTML.replace(/{{value}}/gi,t).replace(/{{id}}/gi,l.id);s.innerHTML!==e&&(s.innerHTML=e)}else if("function"==typeof i.cell.template&&i.cell.template.prototype&&"undefined"!=typeof ngApp){const e=ngApp.injector,l=e.get(ComponentFactoryResolver).resolveComponentFactory(i.cell.template),a=s.appendChild(l.create(e));return a.instance.value=t,void a.changeDetectorRef.detectChanges()}if(i.cell.template.startsWith&&i.cell.template.startsWith("#")&&(e=document.querySelector(i.cell.template)),e){let a=e.content.cloneNode(!0).firstElementChild;const d=t;if(t=(t=(t=t.toString()).replace(/'/gi,"\\'")).replace(/"/gi,'\\"'),a.querySelector("[smart-if]")){const e=a.querySelector("[smart-else]"),l=a.querySelectorAll("[smart-if]");let i=!1;for(let e=0;e<l.length;e++){const r=l[e],s=r.getAttribute("smart-if"),o=s.split(" "),c=o[1].trim();let m=o[2].trim();s.indexOf("'")>=0&&(m=s.substring(s.indexOf("'")+1),m=m.replaceAll("'",""));let u=t;switch("Today"===m&&(m=new Date),"date"===n.dataType&&(t=new Date(d).getTime(),m=new Date(m).getTime()),c){case">":t>parseFloat(m)&&(a=r,i=!0);break;case">=":t>=parseFloat(m)&&(a=r,i=!0);break;case"=":case"==":case"===":t===m&&(a=r,i=!0);break;case"<":t<parseFloat(m)&&(a=r,i=!0);break;case"<=":t<=parseFloat(m)&&(a=r,i=!0)}if(t=u,i)break}!i&&e&&(a=e)}let c=a.outerHTML.replace(/{{value}}/gi,t).replace(/{{id}}/gi,l.id);for(c.indexOf("{{value=")>=0&&(t?(c=c.substring(0,c.indexOf("{{value="))+t+c.substring(c.indexOf("}")),c=c.replace(/}/gi,""),c=c.replace(/{/gi,"")):(c=c.replace(/{{value=/gi,""),c=c.replace(/}}/gi,"")));c.indexOf("{{value::")>=0;){const e=c.indexOf("{{value::"),l=c.substring(e+9,c.indexOf("}}")),a=i.cell.getFormattedValue(t,l);c=c.replace(`{{value::${l}}}`,a)}if(n._treeColumn){const e=s.firstChild;if(e&&e.classList&&i.toggleButton&&n._treeColumn&&s.children[1]){const e=s.children[0],t=s.children[1].children[0],a=s.children[1].children[1].firstChild,i=s.children[1].children[2];let n="";if(r.grouping.enabled){let e=l.level-1;"multipleColumns"!==r.grouping.renderMode&&(n+='<div style="width: '+(1+e)*r.grouping.groupIndent+'px;"></div>')}else for(let e=0;e<l.level;e++)n+="<div class='smart-indent'></div>";l.checked?a.setAttribute("checked",""):!1===l.checked?a.removeAttribute("checked"):null===l.checked&&a.setAttribute("checked","indeterminate"),l.leaf?l.allowCheck?a.classList.remove("smart-visibility-hidden"):a.classList.add("smart-visibility-hidden"):l.allowCheck?a.classList.remove("smart-hidden"):a.classList.add("smart-hidden"),l.allowCheck?r.checkBoxes.visible?a.classList.remove("smart-hidden"):a.classList.add("smart-hidden"):r.checkBoxes.visible||a.classList.add("smart-hidden"),e.innerHTML=n,t.classList.add("smart-visibility-hidden"),l.leaf?t.classList.add("smart-visibility-hidden"):(t.classList.remove("smart-visibility-hidden"),l.expanded?t.setAttribute("toggled",""):t.removeAttribute("toggled","")),l.data.isEmpty&&t.classList.add("smart-visibility-hidden"),i.innerHTML=c,r.appearance.showTooltips?i.setAttribute("title",r._unescapeString(o)):i.hasAttribute("title")&&i.removeAttribute("title")}}else s.innerHTML!==c&&(s.innerHTML=c)}else if("string"==typeof i.cell.template){""===t&&(t="&nbsp;");let e=i.cell.template.replace(/{{value}}/gi,t).replace(/{{id}}/gi,l.id);if(e.indexOf("{{"))for(let t=0;t<r.dataSource.dataFields.length;t++){const a=r.dataSource.dataFields[t].name;if(e.indexOf("{{"+a+"}}")>=0&&(e=e.replace("{{"+a+"}}",l.data[a]),-1===e.indexOf("{{")))break}s.innerHTML!==e&&(s.innerHTML=e)}}if("auto"===i.cell.row.height||r.layout.allowCellsWrap||"auto"===r.layout.rowHeight){const e=s.querySelector(".smart-grid-cell-template");if(e){l._templatesHeight||(l._templatesHeight=[]);const t=(e,t)=>{if(e){const l=r.rowById[e.getAttribute("data-id")];l._templatesHeight[n.dataField]=t,l._isDirty=!0;const a=l.canNotify;l.canNotify=!1,l.autoSize(),l.canNotify=a,delete l._isDirty}};if(e.firstElementChild){if(!e.firstElementChild.resizeObserver){const l=new ResizeObserver((function(){const e=this.target.closest("smart-grid-row");this.target.offsetHeight&&(t(e,this.target.offsetHeight),r.$.scrollView.scrollTop=0)}));e.firstElementChild.resizeObserver=l,l.target=e.firstElementChild,l.observe(e.firstElementChild)}e.firstElementChild.onblur=e.firstElementChild.onchange=function(){const e=this.closest("smart-grid-row");t(e,this.offsetHeight)}}else{const l=this.closest("smart-grid-row");t(l,e.offsetHeight)}}}}}if(o)return a.innerHTML="",a.appendChild(o),r._cellCachedValues&&(r._cellCachedValues[n.dataField+"_"+t]=a.innerHTML),i.cell._setStyle(a),o;i.cell._setStyle(a),r._cellCachedValues&&(r._cellCachedValues[n.dataField+"_"+t]=a.innerHTML)}async _render(){const e=this,t=e.cell.grid,l=e.cell.column,a=e.cell.row,i=a.data,r=a._isMeasureRow?null:e.cell.format||l.cellsFormat,n=t.grouping.enabled&&t.dataSource.groupBy&&t.dataSource.groupBy.length>0;if(e.setAttribute("data-type",l.dataType),!(!1!==t._recycleValues||n||l.formatFunction||l._treeColumn||a.summaryRow||"grid"!==t.view)){if(e.cell.selected?(e.setAttribute("selected",""),e.setAttribute("aria-selected",!0)):(e.removeAttribute("selected"),e.removeAttribute("aria-selected")),e.classList.contains("smart-hidden")&&e.classList.remove("smart-hidden"),e.cell.focused?(t.selection.allowCellSelection&&e.setAttribute("focus",""),a.element.setAttribute("focus",""),a.element.toggleDetailButton&&(a.element.toggleDetailButton.classList.remove("smart-visibility-hidden"),a.element.star&&a.element.star.classList.add("smart-hidden")),e.cell.id||(e.id="gridcell_"+Math.floor(65536*(1+Math.random())).toString(16).substring(1)),t.$.content.setAttribute("aria-activedescendant",e.id)):(e.removeAttribute("focus"),a.element&&a.element.star&&t._selection.focusedCell&&t._selection.focusedCell.id!==a.id?a.element.star.classList.remove("smart-hidden"):t.appearance.showRowComments&&!a.element.hasAttribute("focus")&&a.element.toggleDetailButton&&a.element.toggleDetailButton.classList.add("smart-visibility-hidden")),e.cell.background||e.cell.color){e.cell._styleChanged=!0;const t=e.firstChild;e.cell._setStyle(t)}return}if(t.grouping.enabled&&t.dataSource.groupBy&&t.dataSource.groupBy.length>0&&"card"!==t.view){if(void 0!==a.label){let t=l.displayField?i[l.displayField]:i[l.dataField];return void 0===t&&i.data&&(t=l.displayField?i.data[l.displayField]:i.data[l.dataField]),e._renderGroupCell(t),void(a.summaryRow&&(e.cell.canNotify=!1,a.canNotify=!1,e.cell._styleChanged=!0,e.cell.background=null,e.cell.color=null,e.cell.fontFamily=null,e.cell.fontSize=null,e.cell.element&&e.cell.element.firstElementChild&&e.cell._setStyle(e.cell.element.firstElementChild),e.cell.canNotify=!0,a.canNotify=!0))}e.style.zIndex=""}else if(t.appearance.showTreeRowHeader&&t.rowHierarchy&&!1===a.leaf&&!l.autoGenerated){let t=i[a.groupDataField];return a.label=t,void e._renderGroupCell(t)}if(t.appearance.showTreeRowHeader&&e.removeAttribute("header"),t.grouping.enabled&&t.dataSource.groupBy&&t.dataSource.groupBy.length>0&&e.toggleButton&&(e.toggleButton.classList.remove("smart-hidden"),e.toggleButton.classList.remove("smart-visibility-hidden"),e.toggleButton.style.marginLeft="",l._treeColumn&&t.grouping.enabled&&t.grouping.toggleButtonIndent>0&&(e.toggleButton.style.marginLeft=a.level*(t.grouping.toggleButtonIndent-t.grouping.groupIndent)+"px")),t.grouping.enabled&&t.dataSource.groupBy&&t.dataSource.groupBy.length>0&&(e.removeAttribute("header"),e.removeAttribute("group")),!l.visible)return void(e.style.width="0px");t.appearance.showSortColumnBackground&&t.sorting.maintainSort&&!a.summaryRow?l.sorted?e.setAttribute("sort",""):e.removeAttribute("sort"):l.sorted&&e.hasAttribute("sort")&&e.removeAttribute("sort"),t.appearance.showFilterColumnBackground?l.filtered?e.setAttribute("filter",""):e.removeAttribute("filter"):l.filtered&&e.hasAttribute("filter")&&e.removeAttribute("filter"),t.dataSource.boundHierarchy&&e.hasAttribute("has-toggle-button")&&!l._treeColumn&&e.removeAttribute("has-toggle-button"),t.dataSource.boundHierarchy||!e.hasAttribute("has-toggle-button")||l._treeColumn||e.removeAttribute("has-toggle-button");let s=l.displayField?i[l.displayField]:i[l.dataField];if(e.removeAttribute("placeholder"),!l.placeholder||""!==s&&null!=s||(s=l.placeholder,e.setAttribute("placeholder","")),l.parentDataField){const e=t.columnByDataField[l.parentDataField];if(e){let i=e.editor.dataSource;e.relationId&&e.relationField&&e._isDirty&&(!e.editor.dataSource||e.editor.dataSource&&0===e.editor.dataSource.length)&&(i=t._getRelationData(e.relationId));const r=i[t.getCellValue(a.id,l.parentDataField)];if(r){s=r[l.cascadingDataField]}}}if(null!==s||l.allowNull||("int"!==l.dataType&&"number"!==l.dataType||(s=0),"string"===l.dataType&&(s=""),"boolean"!==l.dataType&&"bool"!==l.dataType||(s=!1),"date"===l.dataType&&(s=new Date)),t.formulas&&e.cell.formula&&"string"==typeof e.cell.formula&&e.cell.formula.startsWith("=")&&/=.+/.test(e.cell.formula)){const i=t._formulaParser;if(i){if(t&&t.formulas&&e.cell._formula!==l.formula){let t=a.data[l.dataField];l.formula&&(e.cell.formula=e.cell._parseFormula(l.formula)),t&&(""+t).startsWith("=")&&(e.cell.formula=e.cell._parseFormula(""+t)),e.cell._formula=l.formula}const r=i.parse(e.cell.formula.slice(1));s=isNaN(r)?"#VALUE!"===r?"":"#ERROR!"===r?"#ERROR!":r:r}}t.grouping.enabled&&"multipleColumns"===t.grouping.renderMode&&t.dataSource&&t.dataSource.groupBy&&t.dataSource.groupBy.length>0&&t.dataSource.groupBy.indexOf(l.dataField)>=0&&(s="",e.setAttribute("header","")),e.removeAttribute("highlight"),t.highlighted!==a.id||l.autoGenerated||e.setAttribute("highlight",""),t.editing.addNewRow.visible&&e.classList.remove("smart-add-new-row"),t.editing.enabled&&(e.cell.readonly||!l.allowEdit?e.classList.add("smart-readonly"):e.classList.remove("smart-readonly"));const o=t=>{if(t){if((t=""+t).startsWith("off_"))return e.classList.remove(t.substring(4)),!1;if(e.classList.add(t),e.hasAttribute("customCSS")){t=t+" "+e.getAttribute("customCSS")}return e.setAttribute("customCSS",t),!0}return e.setAttribute("highlight",""),!0};if((t.highlightedRows||t.highlightedCells)&&e.hasAttribute("customCSS")){const t=e.getAttribute("customCSS");e.removeAttribute("customCSS");const l=t.split(" ");for(let t=0;t<l.length;t++)e.classList.remove(l[t])}if(l.highlight&&!a.summaryRow&&(o(l._highlightCSS||""),e.setAttribute("highlight-data-field",l.dataField)),t.highlightedCells&&t.highlightedCells[a.id]&&!a.summaryRow&&void 0!==t.highlightedCells[a.id][l.dataField]){o(t.highlightedCells[a.id][l.dataField])}if(t.highlightedRows&&!a.summaryRow&&void 0!==t.highlightedRows[a.id]){o(t.highlightedRows[a.id])}if(t.editing.batch){if(t._cellsUpdatedValues){e.removeAttribute("update");const i=t._cellsUpdatedValues[a.id+"_"+l.dataField];void 0!==i&&(e.setAttribute("update",""),s=i)}t._rowsDeleted&&(t._rowsDeleted.indexOf(a.id)>=0?e.setAttribute("delete",""):e.removeAttribute("delete")),t._rowsAdded&&(t._rowsAdded.indexOf(a.id)>=0?e.setAttribute("add",""):e.removeAttribute("add"))}!t.onCellValue||l.rowHeaderColumn||l.selectionColumn||(e.cell._updating=!0,t.onCellValue(e.cell,t),e.cell._updating=!1,s=e.cell.value),void 0===s&&(s="");let d=s;if(r)d=e.cell.getFormattedValue(s,r);else if(l.formatSettings&&l.formatSettings.Intl)if(""===s)d="";else if(l.editor.decimalPlaces>=0){const t=JSON.parse(JSON.stringify(l.formatSettings.Intl));t.NumberFormat.minimumFractionDigits=l.editor.decimalPlaces,t.NumberFormat.maximumFractionDigits=l.editor.decimalPlaces,d=e.cell.getFormattedValue(s,t)}else d=e.cell.getFormattedValue(s,l.formatSettings.Intl);else l.formatSettings&&l.formatSettings.formatString&&(d=e.cell.getFormattedValue(s,l.formatSettings.formatString));const c=e.firstChild;if(e.content=c,l._isDirty&&(c.innerHTML=""),c.hasAttribute("data-field")&&c.getAttribute("data-field")!==l.dataField&&(c.innerHTML="",a.filterRow&&(l._filterEditorInitialized=!1)),c.setAttribute("data-field",l.dataField),t.onCellRender||l.onCellRender)if(l._cellsCachedValues||(l._cellsCachedValues=[]),l._cellsCachedValues[a.index]){const t=l._cellsCachedValues[a.index];c.firstChild&&c.removeChild(c.firstChild),e.cell.template instanceof HTMLTemplateElement||"string"==typeof e.cell.template?c.appendChild(t):c.innerHTML=t.innerHTML}else{if(e.cell._updating=!0,t.onCellRender?t.onCellRender(e.cell,a.visibleIndex,l.dataField,a.data,e):l.onCellRender(e.cell,a.visibleIndex,l.dataField,a.data,e),e.cell._updating=!1,e.cell.template!==l.template){const t=document.createElement("div");return c.firstChild&&c.removeChild(c.firstChild),e.cell.template instanceof HTMLTemplateElement?(t.appendChild(e.cell.template.content.cloneNode(!0)),l._cellsCachedValues[a.index]=t):t.appendChild(e.cell.template),void c.appendChild(t)}e.cell.value!==s&&(d=e.cell.value)}if(l.autoGenerated||e.setAttribute("data-field",l.dataField),e.cell.focused?(t.selection.allowCellSelection&&e.setAttribute("focus",""),a.element.setAttribute("focus",""),a.element.toggleDetailButton&&(a.element.toggleDetailButton.classList.remove("smart-visibility-hidden"),a.element.star&&a.element.star.classList.add("smart-hidden")),e.cell.id||(e.id="gridcell_"+Math.floor(65536*(1+Math.random())).toString(16).substring(1)),t.$.content.setAttribute("aria-activedescendant",e.id)):e.removeAttribute("focus"),e.cell.selected?(e.setAttribute("selected",""),e.setAttribute("aria-selected",!0)):(e.removeAttribute("selected"),e.removeAttribute("aria-selected")),t.dragDrop&&t.dragDrop.row===a?e.classList.add("dragged"):e.classList.remove("dragged"),e._classNames)for(let t=0;t<e._classNames.length;t++)e.classList.remove(e._classNames[t]);if(a._classNames||e._rowClassNames){if(e._rowClassNames)for(let t=0;t<e._rowClassNames.length;t++)e.classList.remove(e._rowClassNames[t]);for(let t=0;t<a._classNames.length;t++)e.classList.add(a._classNames[t]);e._rowClassNames=a._classNames}if(t.onCellClass){const i=t.onCellClass(a.visibleIndex,l.dataField,s,a.data,a,t);if(e.___classNames)for(let t=0;t<e.___classNames.length;t++)e.classList.remove(e.___classNames[t]);if(i){const t=i.trim().split(" ");for(let l=0;l<t.length;l++)e.classList.add(t[l]);e.___classNames=t}}if(l.cellsClassName)if("string"==typeof l.cellsClassName){const t=l.cellsClassName.trim().split(" ");for(let l=0;l<t.length;l++)e.classList.add(t[l]);e._classNames=t}else{const t=l.cellsClassName(a.visibleIndex,l.dataField,s,a.data,a);if(e._classNames)for(let t=0;t<e._classNames.length;t++)e.classList.remove(e._classNames[t]);if(t){const l=t.trim().split(" ");for(let t=0;t<l.length;t++)e.classList.add(l[t]);e._classNames=l}}if(l.cellsCSSRules){if(e.__classNames)for(let t=0;t<e.__classNames.length;t++)e.classList.remove(e.__classNames[t]);const i=Object.keys(l.cellsCSSRules);let r=[];for(let n=0;n<i.length;n++){let o=i[n];const d={index:a.visibleIndex,value:s,dataField:l.dataField,row:a,data:a.data,api:t};l.cellsCSSRules[o](d)&&(e.classList.add(o),r.push(o))}e.__classNames=r}t.rowDetail.enabled&&a.showDetail&&!1===t.rowDetail.dialog.enabled&&(e.style.height=a.cellHeight+"px",e.style.lineHeight=a.cellHeight+"px"),a.expanded&&a.expandHeight>0&&(e.style.height=a.cellHeight+"px",e.style.lineHeight=a.cellHeight+"px");const m=e._getCellAlignment(a,l),u=""!==e.cell.template&&t.isInitialized&&!a._isMeasureRow;let p="";if(m.align&&(p+=m.align+" "),m.verticalAlign&&(p+=m.verticalAlign+" "),l.cellsWrap)p+="wrap ";else if(t.layout.autoWrap&&a.height>40&&1===e.cell.colSpan&&"string"===l.dataType){if(14*(d||"").length*.52>l.computedWidth){if("url"!==e.cell.template&&"email"!==e.cell.template){p+="textwrap ";const e=parseInt(a.height/20);c.style["-webkit-line-clamp"]=e}}}if(p+="smart-label",e.style.width!==l.computedWidth+"px"){const a=t._isLastVisibleColumn(l);l.autoGenerated||a?e.style.width=l.computedWidth+"px":e.style.width=l.computedWidth-t._columnGap+"px"}if(l.grid.appearance.showRowComments&&l.rowHeaderColumn){const a=t.rowDetailColumn,i=a?a.width:0;e.style.width=l.computedWidth+i+"px",e.classList.add("row-number")}l===t._firstVisibleColumn?e.classList.add("smart-grid-column-border-collapse"):e.classList.remove("smart-grid-column-border-collapse"),t.appearance.showColumnGroupCellLines||l.parent&&!l.element.hasAttribute("column-group-first-child")&&e.classList.add("smart-grid-column-border-collapse"),t.grouping.enabled&&"multipleColumns"===t.grouping.renderMode&&t.dataSource&&t.dataSource.groupBy&&t.dataSource.groupBy.length>0&&t.dataSource.groupBy.indexOf(l.dataField)>=0&&e.classList.add("smart-grid-column-border-collapse"),t._columnGap>0&&t.appearance.showColumnLines&&e.classList.add("smart-grid-column-border"),t._rowGap>0&&e.classList.add("smart-grid-row-border"),t.appearance.showColumnLines?e.classList.remove("smart-grid-vertical-border-collapse"):e.classList.add("smart-grid-vertical-border-collapse"),t.appearance.showRowLines?e.classList.remove("smart-grid-horizontal-border-collapse"):e.classList.add("smart-grid-horizontal-border-collapse");let g=l.left;if(t.rightToLeft?e.style.right!==g+"px"&&(e.style.right=g+"px"):e.style.left!==g+"px"&&(e.style.left=g+"px"),e.classList.contains("smart-hidden")&&e.classList.remove("smart-hidden"),e.hasAttribute("template")&&e.removeAttribute("template"),e.hasAttribute("freeze")&&e.removeAttribute("freeze"),e.hasAttribute("detail")&&e.removeAttribute("detail"),e.hasAttribute("error")&&e.removeAttribute("error"),e.cell.error&&e.setAttribute("error",e.cell.error),a.filterRow?e.classList.add("smart-grid-filter-row-cell"):a.summaryRow?e.classList.add("smart-grid-summary-row-cell"):(l.freeze||a.freeze)&&(l.selectionColumn&&(e.setAttribute("checkbox",""),p+=" smart-input",l.grid.selection.checkBoxes.enabled&&l.grid.selection.checkBoxes.autoShow?e.setAttribute("auto-show",""):e.removeAttribute("auto-show")),(l.rowHeaderColumn||l.selectionColumn)&&(e.setAttribute("header",""),e.setAttribute("role","rowheader")),t.appearance.showFrozenColumnBackground&&l.freeze&&e.setAttribute("freeze",""),t.appearance.showFrozenRowBackground&&a.freeze&&e.setAttribute("freeze",""),l.rowDetailColumn&&(e.setAttribute("header",""),e.setAttribute("detail",""),e.setAttribute("has-toggle-button",""),e.classList.add("smart-grid-column-border-collapse")),l.commandColumn&&e.setAttribute("command","")),t.appearance.showRowComments&&(a.comments&&a.comments.length>0&&l===t._firstVisibleUserColumn?e.classList.add("row-comments"):e.classList.remove("row-comments")),l.cellsRotationAngle){if(!e._rotateCellContent(c,l,s))return}else if(a.filterRow){if(!l.toggleColumn&&!l.rowHeaderColumn)return t.grouping.enabled&&t.dataSource&&t.dataSource.groupBy&&t.dataSource.groupBy.length>0&&(l._filterEditorInitialized=!1),l._filterEditorInitialized||l.autoGenerated?void("boolean"===l.dataType||"bool"===l.dataType?e.setAttribute("template","checkBox"):e.removeAttribute("template")):(l._filterEditorInitialized=!0,void e._renderFilterCell(c));c.innerHTML=""}else if(a.summaryRow){if(l.toggleColumn||l.rowHeaderColumn)""!==c.innerHTML&&(c.innerHTML="");else if(l.autoGenerated&&""!==c.innerHTML&&(c.innerHTML=""),t.dataSource.boundHierarchy&&e.hasAttribute("has-toggle-button")&&e.removeAttribute("has-toggle-button"),!l.autoGenerated){if(l.summary&&l.summary.length>0&&t._summaryItems){const a=t._summaryItems[l.dataField],i=[];for(let r in a){if("status"===r)continue;const n=l.cellsFormat;let s=a[r];n&&n.indexOf("p")>=0&&"count"===r?s=a[r]:n&&"date"!==l.dataType&&(s=e.cell.getFormattedValue(s,n)),t.messages&&t.messages[t.locale]&&t.messages[t.locale][r]?i.push(t.localize(r,{value:s})):i.push(r+": "+s)}let r=[],n="";if(a&&a.status&&l.editor){n+='<div style="margin-right: 5px; display: flex; border-radius: 8px; align-items: center;">';const e=l.editor.dataSource,i=a.status,s=t.rows.length,o=l.computedWidth;let d=0;if(e)for(let l=0;l<e.length;l++){const a=e[l];if(i[a.value]){const e=a.label?a.label:t.localize("blankSummary"),l=i[a.value].length,c=new Number(l/s*100).toFixed(2),m=e+" "+l+"/"+s+" "+c+"%",u=o*c/100/2;r.push(m);const p=["#D50000","#F6BF26","#33B679","#039BE5","#3F51B5","#8E24AA"];d>p.length-1&&(d=0);n+='<span class="summary-value-part" title="'+m+'" style="width: '+u+"px; font-size: 11px; padding: 5px; background:"+(a.color||p[d++])+'; color: white;"></span>'}}n+="</div>"}const s=i.join(", "),o=t.summaryRow.editing?'<span class="smart-arrow-down"></span>':"";let d=`<div title = "${s}" class="smart-truncate summary-value" > <span class="label">${s}</span>${o}</div> `;r.length&&(d=`<div title = "${s}" class="smart-truncate summary-value" > <span style="align-items: center; display: flex;" class="label">${n}${s}</span>${o}</div> `);if(t.columns[0].dataField===l.dataField&&i.length<3){const e=t._recyclingRows.length;d=`<div title = "${s}" class="smart-truncate summary-value" > ${`<span style = "justify-content: flex-start" class="smart-truncate summary-value" > ${1===e?t.localize("oneRow"):t.localize("rows",{value:e})}</span> `} <span class="label">${s}</span>${o}</div> `}c.innerHTML!==d&&(c.innerHTML=d)}else if(t.summaryRow.editing&&l.allowSummary){if(t.columns[0].dataField===l.dataField){const e=t._recyclingRows.length,l=`<div class="smart-truncate summary-value"><span style="justify-content: flex-start" class="smart-truncate summary-value">${1===e?t.localize("oneRow"):t.localize("rows",{value:e})}</span><span class="smart-summary-placeholder label">${t.localize("summary")}</span><span class="smart-arrow-down"></span></div>`;c.innerHTML!==l&&(c.innerHTML=l)}else{const e=`<div class="smart-truncate summary-value"><span class="smart-summary-placeholder label">${t.localize("summary")}</span><span class="smart-arrow-down"></span></div>`;c.innerHTML!==e&&(c.innerHTML=e)}}t.summaryRow.editing&&l.allowSummary&&(t._selection&&t._selection.focusedCell&&t._selection.focusedCell.dataField===l.dataField?c.firstElementChild.setAttribute("has-summary",""):c.firstElementChild.removeAttribute("has-summary"),c.onpointerdown=e=>{e.preventDefault(),e.stopPropagation(),c._clickTarget=e.target},c.onpointerup=l=>{!0!==t._mobile&&c._clickTarget!==l.target||(l.preventDefault(),l.stopPropagation(),t._summaryRowDialog&&t._summaryRowDialog.classList.contains("open")&&t._summaryRowDialog.dataField===e.cell.column.dataField?t._summaryRowDialog.confirm():t._openSummaryRowDialog(e.cell,(()=>{})))})}}else if(t.rowDetail.enabled&&l.rowDetailColumn){let l="",i=t.appearance.showRowStatus||t.appearance.showRowComments?"smart-visibility-hidden":"";if(a.showDetail){l='<button tabindex="-1" class="'+i+' smart-animate" toggled toggle-button="" title="'+t.localize(a.showDetail?"collapseRow":"expandRow",{elementType:"Grid"})+'"></button>'}else{l='<button tabindex="-1" class="'+i+" smart-animate"+(t.rowDetail.dialog.enabled?" row-detail":"")+'" toggle-button="" title="'+t.localize(a.showDetail?"collapseRow":"expandRow",{elementType:"Grid"})+'"></button>'}if(t.appearance.showRowStatus){l=a._style&&a._style.status?`<span class="row-status custom" style = "color: ${a._style.status};" ></span> `+l:'<span class="row-status"></span>'+l,c.innerHTML===l||a.element.star?(a.element.star.classList.remove("smart-hidden"),a.element.star.classList.remove("custom"),a._style&&a._style.status?(a.element.star.style.color=a._style.status,a.element.star.classList.add("custom")):a.element.star.style.color=""):c.innerHTML=l;const i=()=>{if(a.comments&&a.comments.length>0){const e=a.comments.length;a.element.star.classList.add("comments"),a.element.star.setAttribute("title",t.localize(a.starred?"starred":"notStarred",{elementType:"Grid"})+", "+e+" "+t.localize("comments"))}else a.comments&&0===a.comments.length&&a.element.star.classList.remove("comments")};a.element.star=e.querySelector("span"),a.element.star||(c.innerHTML=l,a.element.star=e.querySelector("span")),a.element.star.onpointerdown=e=>{a.canNotify=!1,a.starred=!a.starred,a.canNotify=!0,a.data.$&&(a.data.$.starred=a.starred),a.starred?a.element.star.classList.add("starred"):a.element.star.classList.remove("starred"),a.element.star.setAttribute("title",t.localize(a.starred?"starred":"notStarred",{elementType:"Grid"})),i(),e.stopPropagation(),e.preventDefault(),t.$.fireEvent("rowStarred",{id:a.id,originalEvent:e,row:a,value:a.starred})},a.element.star.setAttribute("title",t.localize(a.starred?"starred":"notStarred",{elementType:"Grid"})),a.starred?a.element.star.classList.add("starred"):a.element.star.classList.remove("starred"),i()}else c.innerHTML!==l&&(c.innerHTML=l);if(a.element.toggleDetailButton=e.querySelector("button"),a.element.toggleDetailButton.setAttribute("title",t.localize(a.showDetail?"collapseRow":"expandRow",{elementType:"Grid"})),(t.rowDetail.template||t.onRowDetailInit)&&a.element.toggleDetailButton.classList.remove("smart-visibility-hidden"),a.comments&&a.comments.length>0){const e=a.comments.length;a.element.toggleDetailButton.classList.remove("smart-visibility-hidden"),t.appearance.showRowStatus?a.element.toggleDetailButton.querySelector(".comments-length")?a.element.toggleDetailButton.querySelector(".comments-length").innerHTML=e:a.element.toggleDetailButton.innerHTML+=`<div class="comments-length'>${e}</div>`:a.element.toggleDetailButton.innerHTML=`<div class="comments-length'>${e}</div>`,a.starred&&a.element.toggleDetailButton.classList.add("starred"),a.element.toggleDetailButton.classList.add("row-comments"),a.element.toggleDetailButton.setAttribute("title",t.localize(a.showDetail?"collapseRow":"expandRowComments",{value:e,elementType:"Grid"}))}else a.comments&&0===a.comments.length&&a.element.toggleDetailButton.classList.remove("row-comments");t.rowDetail.dialog.enabled&&a.element.toggleDetailButton.classList.add("row-detail")}else if(l.commandColumn)e._renderCommands();else if(t.appearance.showRowHeaderNumber&&l.rowHeaderColumn)if(a.addNewRow)c.textContent="";else{const l=l=>{if(e.cell.value)return e.cell.value;if("number"===t.appearance.autoGenerateRowLabelMode)return l.visibleIndex+1;{const e=l.visibleIndex%26,t=Math.floor(l.visibleIndex/26),a="A".charCodeAt(0),i=String.fromCharCode(a+e);let r="";for(let e=0;e<t;e++)r+="A";return r+i}};t._rowsAdded&&t._rowsAdded.indexOf(a.id)>=0?c.textContent="":c.textContent=l(a)}else if(u)if(e.removeAttribute("readonly"),t.appearance.displayLoadingIndicator&&!l.autoGenerated)c.innerHTML='<div class="smart-grid-cell-loading"></div>';else if(a._isMeasureRow)c.innerHTML=s;else switch(c.removeAttribute("title"),e.cell.template){case"checkBox":case"switchButton":case"radioButton":e._setTemplate(s,e.cell.template,c);break;case"tags":case"checklist":case"collaborator":case"updatedBy":case"createdBy":case"multiComboInput":e._setTemplate(s,e.cell.template,c);break;case"attachment":e._setTemplate(s,"attachments",c);break;case"image":e._setTemplate(s,"images",c);break;case"email":e._setTemplate(s,"email",c);break;case"url":e._setTemplate(s,"url",c);break;case"richText":e._setTemplate(s,"richText",c);break;default:e._setTemplate(s,e.cell.template,c)}else{const i=c.firstChild;if(i&&i.classList&&e.toggleButton&&l._treeColumn&&c.children[1]){const e=c.children[0],i=c.children[1].children[0],r=c.children[1].children[1].firstChild,n=c.children[1].children[2];let s="";if(l._treeColumn){if(t.grouping.enabled){let e=a.level-1;t.appearance.showRowHeaderNumber&&e--,t.rowDetail.enabled&&e--,e<-1?s="":"multipleColumns"!==t.grouping.renderMode&&(s+='<div style="width: '+(1+e)*t.grouping.groupIndent+'px;"></div>')}else for(let e=0;e<a.level;e++)s+="<div class='smart-indent'></div>";if(a.checked?r.setAttribute("checked",""):!1===a.checked?r.removeAttribute("checked"):null===a.checked&&r.setAttribute("checked","indeterminate"),a.leaf?a.allowCheck?r.classList.remove("smart-visibility-hidden"):r.classList.add("smart-visibility-hidden"):a.allowCheck?r.classList.remove("smart-hidden"):r.classList.add("smart-hidden"),!l.autoGenerated){const e=a["column_"+l.dataField];e&&e._setStyle(c)}}a.allowCheck?t.checkBoxes.visible?r.classList.remove("smart-hidden"):r.classList.add("smart-hidden"):t.checkBoxes.visible||r.classList.add("smart-hidden"),"card"===t.view&&(r.classList.add("smart-hidden"),i.classList.add("smart-hidden")),e.innerHTML=s,i.classList.add("smart-visibility-hidden"),a.leaf?i.classList.add("smart-visibility-hidden"):(i.classList.remove("smart-visibility-hidden"),a.expanded?i.setAttribute("toggled",""):i.removeAttribute("toggled","")),t.grouping.enabled&&i.classList.add("smart-hidden"),a.data.isEmpty&&i.classList.add("smart-visibility-hidden"),n.innerHTML=d,t.appearance.showTooltips?n.setAttribute("title",t._unescapeString(d)):n.hasAttribute("title")&&n.removeAttribute("title")}else{const i=a["column_"+l.dataField];if(e.getAttribute("rowspan")&&(e.removeAttribute("rowspan"),e.removeAttribute("aria-rowspan"),e.style.height=""),e.getAttribute("colspan")&&(e.removeAttribute("colspan"),e.removeAttribute("aria-colspan")),i){if(i.colSpan>1){const a=t.columns.indexOf(l);let r=0;for(let e=a;e<a+i.colSpan;e++){const l=t.columns[e];l&&l.visible&&(r+=l.computedWidth)}e.style.width=r+"px",e.setAttribute("colspan",""),e.setAttribute("aria-colspan",i.colSpan),i._styleChanged=!0}let r=i.rowSpan;if(i.rowSpan>1){const l=t.rows.indexOf(a);let r=0;a.element.setAttribute("rowspan","");for(let e=l;e<=l+i.rowSpan-1;e++){const l=t.rows[e];l&&l.visible&&l.filtered&&(r+=l.cellHeight)}e.style.height=r+"px",e.setAttribute("rowspan",""),e.setAttribute("aria-rowspan",i.rowSpan),i._styleChanged=!0}else if(l.rowSpan&&!a._isMeasureRow){const n="number"==typeof l.rowSpan?l.rowSpan:l.rowSpan(s,a.visibleIndex,a.data),o=a.visibleIndex;let d=!1;for(let e=0;e<t._cellRowSpan.length;e++){const l=t._cellRowSpan[e];if(o>l[0]&&o<l[1]){d=!0;break}}if(a._rowSpan=n,n&&!d){let s=0;t._cellRowSpan.push([o,o+n,l.dataField]),t._cellRowSpan.maxSpan||(t._cellRowSpan.maxSpan=1),t._cellRowSpan.maxSpan=Math.max(n,t._cellRowSpan.maxSpan),a.element.setAttribute("rowspan","");for(let e=o;e<=o+n-1;e++){const l=t.rows[e];l&&l.visible&&l.filtered&&(s+=l.cellHeight)}e.style.height=s+"px",e.setAttribute("rowspan",""),e.setAttribute("aria-rowspan",n),i._styleChanged=!0,r=n}}if(1===i.colSpan&&e.hasAttribute("colspan")&&(e.style.width=l.computedWidth+"px",e.removeAttribute("colspan"),e.removeAttribute("aria-colspan"),i._styleChanged=!0),e.hasAttribute("rowspan")&&1===r&&(e.style.height="",e.removeAttribute("rowspan"),e.removeAttribute("aria-rowspan"),i._styleChanged=!0),c.textContent===d||l.formatFunction||("string"==typeof d&&d.indexOf("&")>=0?"card"===t.view?c.innerHTML=d:t.isScrolling?requestAnimationFrame((()=>{c.innerHTML=d})):c.innerHTML=d:c.textContent=d),i.column.autoGenerated||i._setStyle(c),t.appearance.showTooltips?(d&&(""+d).indexOf("&#")>=0&&(d=t._fromHTMLEntities(d)),c.setAttribute("title",i.tooltip||t._unescapeString(d))):c.hasAttribute("title")&&c.removeAttribute("title"),t.appearance.showTooltipsOverflow&&(!t.appearance.showTooltips&&c.hasAttribute("title")&&c.removeAttribute("title"),d&&d.length)){14*(d||"").length*.52>l.computedWidth?(d&&(""+d).indexOf("&#")>=0&&(d=t._fromHTMLEntities(d)),"image"!==l.template&&"attachment"===l.template&&c.setAttribute("title",i.tooltip||t._unescapeString(d))):!t.appearance.showTooltips&&c.hasAttribute("title")&&c.removeAttribute("title")}}else c.textContent=d}}if(c.className!==p&&(c.className=p),!t.appearance.displayLoadingIndicator||l.autoGenerated||t.dataSource.boundHierarchy?t.appearance.displayLoadingIndicator&&l.selectionColumn?e.removeAttribute("selected"):!l.autoGenerated&&c.firstChild&&c.firstChild.classList&&c.firstChild.classList.contains("smart-grid-cell-loading")&&(c.firstChild.classList.remove("smart-grid-cell-loading"),e.removeAttribute("selected")):(a.element.removeAttribute("focus"),e.removeAttribute("selected"),c.innerHTML='<div class="smart-grid-cell-loading"></div>'),l.formatFunction&&!a.data.isEmpty&&t.isInitialized&&!a.summaryRow){const i={row:a,column:l,cell:e.cell,oldValue:e.cell.oldValue,value:s,data:a.data,formattedValue:d,template:null};e.cell.canNotify=!1,a.canNotify=!1;const r=Object.assign({},{background:e.cell.background,color:e.cell.color,fontSize:e.cell.fontSize,fontFamily:e.cell.fontFamily,textDecoration:e.cell.textDecoration,fontWeight:e.cell.fontWeight,fontStyle:e.cell.fontStyle});if(t.hasAttribute("smart-blazor"))await l.formatFunction(i);else{const e=l.formatFunction(i);e&&(i.value=e)}c.style.background===r.background&&c.style.color===r.color&&c.style.fontSize===r.fontSize&&c.style.fontFamily===r.fontFamily&&c.style.textDecoration===r.textDecoration&&c.style.fontWeight===r.fontWeight&&c.style.fontStyle===r.fontStyle||(e.cell._styleChanged=!0,e.cell._setStyle(c)),e.cell.background===r.background&&e.cell.color===r.color&&e.cell.fontSize===r.fontSize&&e.cell.fontWeight===r.fontWeight&&e.cell.textDecoration===r.textDecoration&&e.cell.fontFamily===r.fontFamily&&e.cell.fontStyle===r.fontStyle||(e.cell._styleChanged=!0,e.cell._setStyle(c));let n=!0;if(i.value!==s){if(e.toggleButton){c.children[1].children[2].innerHTML=i.value}else c.innerHTML=i.value;n=!1}if(null!==i.template){if(e.toggleButton){if(c.children[1]){const e=c.children[1].children[2];e.innerHTML!==i.template&&(e.innerHTML=i.template)}}else if(c.innerHTML!==i.template){const e=document.createElement("div");e.innerHTML=i.template,e.innerHTML!==c.innerHTML&&(c.innerHTML=i.template)}n=!1}n&&(l.cellsFormat?c.textContent=d:c.textContent=s),e.cell.canNotify=!0,a.canNotify=!0}if(l.tooltipRenderer&&!a.summaryRow&&!a.autoGenerated){const e=l.tooltipRenderer(a.id,l.dataField,s,d,a.data);null!=e&&""!==e&&(c.setAttribute("data-title",e),c.onmouseenter=function(l){const a=l.target.closest("smart-grid-cell");if(a&&a.cell.column){if(!a.cell.column.tooltipRenderer)return}t._createTooltip(l,e,c,"top")},c.onmouseleave=function(){t._cellTooltip&&(t._cellTooltip.style.visibility="hidden")})}if(l.cellsRenderer&&!a.summaryRow){const t=l.cellsRenderer(a.id,l.dataField,s,a.data,c);if(null!=t)if("string"==typeof t)if(e.toggleButton){if(c.children[1]){const e=c.children[1].children[2];e.innerHTML!==t&&(e.innerHTML=t)}}else c.innerHTML!==t&&(c.innerHTML=t);else t instanceof HTMLElement&&c.firstChild!==t&&(c.innerHTML="",c.appendChild(t))}if(!a.data.isEmpty&&t.isInitialized&&e._applyConditionalFormattingToCell(e.cell,t,c),t.grouping.enabled&&t.dataSource&&t.dataSource.groupBy&&t.dataSource.groupBy.length>0&&l===t._firstVisibleColumn&&t.rowDetail.enabled&&t.rowDetail.visible&&c.querySelector("[toggle-button]")){const e=c.querySelector("[toggle-button]");e.classList.remove("smart-visibility-hidden"),e.classList.add("row-detail"),a.element.toggleDetailButton=e,a.element.toggleDetailButton.setAttribute("title",t.localize(a.showDetail?"collapseRow":"expandRow",{elementType:"Grid"})),e.onpointerdown=function(e){a.showDetail=!a.showDetail,e.stopPropagation(),e.preventDefault()}}}_autoWrap(){const e=this,t=e.firstChild,l=e.cell.grid;l.layout.allowCellsWrapShortcut&&e.hasAttribute("focus")&&e.hasAttribute("selected")&&(t.offsetWidth<t.scrollWidth?e._popupCellContent(t.innerHTML,e.cell):l._cellContentPopup&&l._cellContentPopup.remove())}_popupCellContent(e,t){const l=this,a=t.grid;let i=a._cellContentPopup;if(!a._cellContentPopup){i=document.createElement("div");const t=document.createElement("span"),l=document.createElement("div"),r=document.createElement("div");i.style.minHeight="0px",i.style.minWidth="0px",i.setAttribute("theme",a.theme),i.classList.add("smart-grid-cell-content-popup"),r.appendChild(l),r.classList.add("smart-grid-text-area-container"),l.innerHTML=e,l.classList.add("smart-grid-cell-content-popup-content"),t.classList.add("smart-hidden"),t.classList.add("close-button"),t.classList.add("smart-grid-icon"),t.classList.add("smart-icon-cancel-circled"),t.onclick=function(){a._cellContentPopup.parentNode.removeChild(a._cellContentPopup)},i.classList.add("smart-grid-text-area-dialog"),i.appendChild(r),i.appendChild(t),a._cellContentPopup=i}i.querySelector(".smart-grid-cell-content-popup-content").innerHTML=e;const r=a.offset(a.$.scrollView);i.style.top=a._offsetTop(l)-r.top+"px",i.style.left=a._offsetLeft(l)-r.left+"px",i.style.width=l.offsetWidth-4+"px",a.$.scrollView.appendChild(i)}_applyConditionalFormattingToCell(e,t,l){const a=this,i=e.column.dataField,r=e.column,n=e.row,s=e.row.index,o=n._style,d=n.data&&n.data.$?n.data.$.id:null;if(e.column.autoGenerated){const l=t._conditionalColors;if(l&&e.column.rowHeaderColumn)if("border"===l.decorate){const t=l.colors;t&&t[d]?(e.element.classList.add("smart-decorate"),e.element.style.setProperty("--smart-decorate-color",t[d].color)):e.element.classList.remove("smart-decorate")}else e.element.classList.remove("smart-decorate")}else{if(t._conditionalColors){const r=t._conditionalColors,s=()=>{e.row.style&&e.row.style[e.column.dataField]&&(e._styleChanged=!0,e.row.style[e.column.dataField].background&&(e.background=e.row.style[e.column.dataField].background),e.row.style[e.column.dataField].color&&(e.color=e.row.style[e.column.dataField].color))};if("border"!==r.decorate){const t=r.colors;if(t&&t[d]){const o="cell"===r.decorate?t[d][i]:t[d].color;if(o){const t=new Smart.Color(o).getInvertedColor();a.cell.canNotify=!1,n.canNotify=!1,e.background=o,e.color=t,s(),a.cell._setStyle(l),a.cell.canNotify=!0,n.canNotify=!0}else e.background&&e.color&&(a.cell.canNotify=!1,n.canNotify=!1,e.background=null,e.color=null,s(),a.cell._setStyle(l),a.cell.canNotify=!0,n.canNotify=!0)}else e.background&&e.color&&(a.cell.canNotify=!1,n.canNotify=!1,e.background=null,e.color=null,o&&(e._styleChanged=!0,e.background=o.background,e.color=o.color),s(),a.cell._setStyle(l),a.cell.canNotify=!0,n.canNotify=!0)}else e.background&&e.color&&(a.cell.canNotify=!1,n.canNotify=!1,e.background=null,e.color=null,o&&(e._styleChanged=!0,e.background=o.background,e.color=o.color),s(),a.cell._setStyle(l),a.cell.canNotify=!0,n.canNotify=!0)}if(a.cell._customInlineStyles&&(a.cell.canNotify=!1,n.canNotify=!1,a.cell._styleChanged=!0,a.cell.background=null,a.cell.color=null,a.cell.textDecoration=null,a.cell._setStyle(l),a.cell.canNotify=!0,n.canNotify=!0),r.cellsCSSInlineRules){const e=r.cellsCSSInlineRules;for(let i=0;i<e.length;i++){const r=e[i];if(!r.field)break;const s=r.condition;let o=r.value,d=r.value2,c=n.data[r.field],m=t.columnByDataField[r.field];if("string"==typeof c&&(o=""+o,d=""+d),"date"===m.dataType||"dateTime"===m.dataType){if(o=Smart.Utilities.DateTime.ParseDate(o,m.cellsFormat),void 0!==d){d=Smart.Utilities.DateTime.ParseDate(d,m.cellsFormat)}}"number"!==m.dataType&&"float"!==m.dataType&&"decimal"!==m.dataType&&"currency"!==m.dataType||(o=parseFloat(o),void 0!==d&&(d=parseFloat(d))),"boolean"===m.dataType&&("string"==typeof o&&(o="true"===o.toLowerCase()),"1"===o&&(o=!0),"0"===o&&(o=!1),void 0!==d&&("string"==typeof d&&(d="true"===d.toLowerCase()),"1"===d&&(d=!0),"0"===d&&(d=!1)));let u=!1;switch(s){case">":u=o<c;break;case">=":u=o<=c;break;case"<":u=o>c;break;case"<=":u=o>=c;break;case"=":u=o===c;break;case"<>":u=o!==c;break;case"between":u=c>=o&&c<=d}u&&(a.cell.canNotify=!1,n.canNotify=!1,a.cell._styleChanged=!0,a.cell.background=r.background,a.cell.color=r.color,a.cell.textDecoration=r.textDecoration,a.cell._setStyle(l),a.cell.canNotify=!0,n.canNotify=!0),a.cell._customInlineStyles=!0}}if(t._conditionalFormatting&&t._conditionalFormatting[i]){const e=t._conditionalFormatting[i][s];a.cell.canNotify=!1,n.canNotify=!1,e?(a.cell._styleChanged=!0,a.cell.background=e.background,a.cell.color=e.color,a.cell.fontFamily=e.fontFamily,a.cell.fontSize=e.fontSize,a.cell._setStyle(l)):a.cell._styleChanged||(o&&o._changed?(a.cell._styleChanged=!0,a.cell.background=o.background,a.cell.color=o.color,a.cell.fontFamily=o.fontFamily,a.cell.fontSize=o.fontSize,a.cell._setStyle(l)):(a.cell._styleChanged=!0,a.cell.background=null,a.cell.color=null,a.cell.fontFamily=null,a.cell.fontSize=null,a.cell._setStyle(l))),a.cell.canNotify=!0,n.canNotify=!0}else t._conditionalFormattingChanged&&!a.cell._styleChanged&&(a.cell.canNotify=!1,n.canNotify=!1,o&&o._changed?(a.cell._styleChanged=!0,a.cell.background=o.background,a.cell.color=o.color,a.cell.fontFamily=o.fontFamily,a.cell.fontSize=o.fontSize,a.cell._setStyle(l)):(a.cell._styleChanged=!0,a.cell.background=null,a.cell.color=null,a.cell.fontFamily=null,a.cell.fontSize=null,a.cell._setStyle(l)),a.cell.canNotify=!0,n.canNotify=!0)}}_rotateCellContent(e,t,l){const a=document.createElement("span");return e.innerHTML="",a.innerHTML=l,e.appendChild(a),a.className="rotate",a.style.transform="rotate("+t.cellsRotationAngle+"deg)",this.grid._recycleRotate(e,a,t.cellsAlign,t.cellsVerticalAlign,l)}_getCellAlignment(e,t){const l=e["column_"+t.dataField],a=l&&l.verticalAlign||t.cellsVerticalAlign;let i=l&&l.align||t.cellsAlign;const r={align:"",verticalAlign:""};if(!l)return{align:"align-left",verticalAlign:"align-middle"};switch(l.grid.rightToLeft&&("left"===i?i="right":"right"===i&&(i="left")),i){case"left":r.align="align-left";break;case"center":case"middle":r.align="align-center";break;case"right":r.align="align-right"}switch(a){case"top":r.verticalAlign="align-top";break;case"center":case"middle":r.verticalAlign="align-middle";break;case"bottom":r.verticalAlign="align-bottom"}return r}template(){return""}_detach(){this.element=null,this.cell=null}onDetached(){this._detach()}});class e{render(e){const t=this,l={svg:null,roundedCorners:e.roundedCorners||0,padding:e.padding||null,width:e.width||100,height:e.height||30,gap:e.gap||5,strokeWidth:e.strokeWidth||2,type:e.type||"column",colors:e.colors||["var(--smart-primary)"],points:e.points,labels:e.labels,colorFunction:e.colorFunction,tooltipFormatFunction:e.tooltipFormatFunction,min:e.min,max:e.max};switch(l.svg=document.createElementNS("http://www.w3.org/2000/svg","svg"),l.svg.setAttribute("width",l.width),l.svg.setAttribute("height",l.height),function(e){Array.isArray(e.colors)||(e.colors=t.colors.split(",")),e.points&&(Array.isArray(e.points)?e.points=e.points.map((e=>parseInt(e,10))):(e.points&&"number"==typeof e.points&&(e.points=""+e.points),e.points=e.points.split(",").map((e=>parseInt(e,10)))))}(l),l.type){case"column":return t.column(l);case"bar":return t.bar(l);case"line":return t.line(l);case"pie":return t.pie(l);case"stacked":return t.stacked(l)}}colorFunction(e,t){const l=function(e,t){e===t&&(t=e+100);const l=(t-e)/5;return[e+l,e+2*l,e+3*l,e+4*l]}(e,t),a=["#D50000","#F4511E","#F6BF26","#039BE5","#33B679"];return e=>e<l[0]?a[0]:e<l[1]?a[1]:e<l[2]?a[2]:e<l[3]?a[3]:a[4]}column(e){const t=e.gap/e.points.length+e.width/e.points.length-e.gap,l=e.max||Math.max(...e.points),a=e.min||Math.min(...e.points),i=e.height/(Math.abs(a)+Math.abs(l)),r=Math.abs(a)*i;return e.colorFunction||(e.colorFunction=this.colorFunction(a,l)),e.points.forEach(((n,s)=>{isNaN(n)&&(n=0);const o=document.createElementNS("http://www.w3.org/2000/svg","rect"),d=Math.abs(n)*i;o.setAttribute("x",s*t+s*e.gap),o.setAttribute("point",n);let c=n>=0?"var(--smart-primary)":"var(--smart-error)";if(l>0&&a<0?n>=0?o.setAttribute("y",e.height-r-1-d):o.setAttribute("y",e.height-r-1):l>=0&&a>=0?o.setAttribute("y",e.height-d):a<=0&&l<=0&&o.setAttribute("y",d),o.setAttribute("width",t),o.setAttribute("height",d),e.colorFunction){const t=e.colorFunction(n);t&&(c=t)}o.setAttribute("fill",c);const m=e.tooltipFormatFunction?e.tooltipFormatFunction(n):n;o.setAttribute("data-title",m),e.svg.appendChild(o)})),e.svg.outerHTML}bar(e){const t=e.padding||0;let l=e.roundedCorners||0;"boolean"==typeof l&&(l=l?3:0);const a=e.height-3-2*t,i=Math.max(5,e.gap/e.points.length+a/e.points.length-e.gap),r=e.max||Math.max(...e.points),n=e.min||Math.min(...e.points);let s=e.width/(Math.abs(n)+Math.abs(r));const o=Math.abs(n)*s;return e.colorFunction||(e.colorFunction=this.colorFunction(n,r)),e.points.forEach(((a,d)=>{isNaN(a)&&(a=0);const c=document.createElementNS("http://www.w3.org/2000/svg","rect"),m=Math.abs(a)*s;c.setAttribute("y",d*i+d*e.gap+t),c.setAttribute("point",a),l>0&&(c.setAttribute("rx",l),c.setAttribute("ry",l));let u=a>=0?"var(--smart-primary)":"var(--smart-error)";if(r>0&&n<0?a>=0?c.setAttribute("x",o):c.setAttribute("x",o-m):(r>=0&&n>=0||n<=0&&r<=0)&&c.setAttribute("x",0),c.setAttribute("width",m),c.setAttribute("height",i),e.colorFunction){const t=e.colorFunction(a);t&&(u=t)}c.setAttribute("fill",u);const p=e.tooltipFormatFunction?e.tooltipFormatFunction(a):a;c.setAttribute("data-title",p),e.svg.appendChild(c)})),e.svg.outerHTML}line(e){const t=e.width/(e.points.length-1),l=e.max||Math.max(...e.points),a=e.min||Math.min(...e.points),i=e.height/(Math.abs(a)+Math.abs(l)),r=Math.abs(a)*i;e.colorFunction||(e.colorFunction=this.colorFunction(a,l));let n="var(--smart-primary)",s=[],o=[];e.svg.setAttribute("overflow","visible");for(let l=0;l<e.points.length;l++){let a=e.points[l];isNaN(a)&&(a=0);const n=l*t,d=e.height-r-a*i;o.push({x:n,y:d,point:a}),2===o.length&&(s.push(o),o=[]),s.length>0&&0===o.length&&o.push(s[s.length-1][1])}for(let t=0;t<s.length;t++){const l=s[t];if(e.colorFunction){const t=e.colorFunction(l[0].point);t&&(n=t)}if(0===t){const t=document.createElementNS("http://www.w3.org/2000/svg","circle");e.svg.appendChild(t),t.setAttribute("cx",l[0].x),t.setAttribute("cy",l[0].y),t.setAttribute("r",3),t.setAttribute("fill",n);const a=e.tooltipFormatFunction?e.tooltipFormatFunction(l[0].point):l[0].point;t.setAttribute("data-title",a),t.style.display="none"}const a=document.createElementNS("http://www.w3.org/2000/svg","line");e.svg.appendChild(a),a.setAttribute("x1",l[0].x),a.setAttribute("y1",l[0].y),a.setAttribute("x2",l[1].x),a.setAttribute("y2",l[1].y);const i=document.createElementNS("http://www.w3.org/2000/svg","circle");e.svg.appendChild(i),i.setAttribute("cx",l[1].x),i.setAttribute("cy",l[1].y),i.setAttribute("r",3),i.setAttribute("fill",n);const r=e.tooltipFormatFunction?e.tooltipFormatFunction(l[1].point):l[1].point;i.setAttribute("data-title",r),i.style.display="none",a.setAttribute("fill","none"),a.setAttribute("stroke-width",e.strokeWidth),a.setAttribute("stroke",n)}return e.svg.outerHTML}pie(e){const t=Math.min(e.width,e.height)/2,l=e.width/2,a=e.height/2,i=e.points.reduce(((e,t)=>e+Math.abs(t)),0);let r=0;const n=e.max||Math.max(...e.points),s=e.min||Math.min(...e.points);return e.colorFunction||(e.colorFunction=this.colorFunction(s,n)),e.points.forEach((n=>{isNaN(n)&&(n=0);let s=e.color;if(e.colorFunction){const t=e.colorFunction(n);t&&(s=t)}const o=Math.abs(n)/i*2*Math.PI,d=r+o,c=l+t*Math.cos(r),m=a+t*Math.sin(r),u=l+t*Math.cos(d),p=a+t*Math.sin(d),g=document.createElementNS("http://www.w3.org/2000/svg","path"),f=o>Math.PI?1:0,h=`M ${l},${a} L ${c},${m} A ${t},${t} 0 ${f} 1 ${u},${p} Z`;g.setAttribute("d",h),g.setAttribute("fill",s);const b=e.tooltipFormatFunction?e.tooltipFormatFunction(n):`${(n/i*100).toFixed(2)}%`;g.setAttribute("data-title",b),e.svg.appendChild(g),r=d})),e.svg.outerHTML}stacked(e){let t=e.points.reduce(((e,t)=>e+t),0),l=(e.points.length-1)*e.gap,a=e.width-l;const i=e.max||Math.max(...e.points),r=e.min||Math.min(...e.points);e.colorFunction||(e.colorFunction=this.colorFunction(r,i));let n=0;return e.points.forEach(((l,i)=>{isNaN(l)&&(l=0);let r=e.colors[i%e.colors.length];if(e.colorFunction){const t=e.colorFunction(l);t&&(r=t)}const s=l/t*a,o=document.createElementNS("http://www.w3.org/2000/svg","rect");o.setAttribute("x",n),o.setAttribute("y",0),o.setAttribute("width",s),o.setAttribute("height",e.height),o.setAttribute("fill",r);const d=document.createElementNS("http://www.w3.org/2000/svg","title");d.textContent=l,o.appendChild(d),e.svg.appendChild(o),n+=s+e.gap})),e.svg.outerHTML}}})();
1429
1429
 
1430
1430
  /***/ }),
1431
1431
 
@@ -1439,14 +1439,14 @@ Smart.Utilities.Assign("Grid.Chart",class{_getChartDataFields(t){const e=this,n=
1439
1439
  /***/ 8228:
1440
1440
  /***/ (() => {
1441
1441
 
1442
- Smart.Utilities.Assign("Grid.Column",class{constructor(t){const e=this;"string"!=typeof t?Object.assign(e,t):(e.label=t,e.dataField=t),e.dataField||(e.dataField="dataField_"+Math.floor(65536*(1+Math.random())).toString(16).substring(1)),e.setState(t),e.dataType||(e.dataType="string"),e.title||(e.title=""),e.tooltip||(e.tooltip=""),e.tooltipRenderer||(e.tooltipRenderer=""),e.rowSpan||(e.rowSpan=null),e.formula||(e.formula=null),e.AIQuery||(e.AIQuery=null),e.columnGroup||(e.columnGroup=""),e.canNotify=!0,(!t||t&&!t.properties)&&(e.data=t);let o="left";switch(e.dataType){case"string":case"date":o="left";break;case"number":"rating"===t.template&&(o="left");break;case"boolean":o="center"}if(e.displayField!==e.dataField&&(o="left"),e.relationId||(e.relationId=""),e.relationField||(e.relationField=""),e.relationCascadingFields||(e.relationCascadingFields=""),e.highlight||(e.highlight=!1),void 0===e.index&&(e.index=-1),void 0===e.visibleIndex&&(e.visibleIndex=-1),void 0===e.selected&&(e.selected=!1),void 0===e.freeze&&(e.freeze=!1),e.label||(e.label=""),e.menuItems||(e.menuItems=null),e.options||(e.options=null),e.displayField||(e.displayField=e.dataField),e.template||(e.template=""),e.editor||(e.editor="input"),"string"==typeof e.editor){e.editor={template:e.editor,autoFocus:!0};let t=!0;e.editor.template&&e.editor.template.indexOf("<input")>=0&&(t=!1),t&&("number"===e.dataType||"int"===e.dataType||"float"===e.dataType?"slider"!==e.editor.template&&(e.editor.template="numberInput"):"date"===e.dataType?("timeInput"!==e.editor.template&&"dateTimePicker"!==e.editor.template&&(e.editor.template="dateInput"),e.editor.autoOpen=!0,e.cellsFormat||e.formatSettings||(e.cellsFormat="M/d/yyyy")):"time"===e.dataType?e.editor.template="timeInput":"boolean"===e.dataType||"bool"===e.dataType?e.editor.template="checkBox":"string"===e.dataType&&"tags"===e.template?(e.editor={template:"multiComboInput",readonly:!0,dropDownButtonPosition:"right",colorItems:!0,autoOpen:!0,pills:!0,dots:!1,singleSelect:!0},e.options&&(e.editor.dataSource=e.options)):"string"===e.dataType&&"collaborator"===e.template&&(e.editor={template:"multiComboInput",readonly:!0,dropDownButtonPosition:"right",colorItems:!0,autoOpen:!0,pills:!0,dots:!1,collaborator:!0,singleSelect:!0}))}else if(void 0===e.editor.autoFocus&&(e.editor.autoFocus=!0),e.editor.relationId&&e.editor.relationField&&e.grid){const t=e.grid._getRelationData(e.editor.relationId,e.editor.relationField,e.editor.singleSelect);e.editor.dataSource=t}if(e.icon||(e.icon="smart-icon-font","modifiedTime"===e.template&&(e.template="updatedTime"),"modifiedBy"===e.template&&(e.template="updatedBy"),"select"===e.editor.template&&(e.icon="smart-icon-sort-down"),"multiComboInput"===e.editor.template&&(e.icon="smart-icon-list-unordered"),"textArea"!==e.editor.template&&"textarea"!==e.editor.template||(e.icon="smart-icon-fontsize"),"url"===e.template&&(e.icon="smart-icon-link"),"email"===e.template&&(e.icon="smart-icon-mail"),"color"===e.template&&(e.icon="smart-icon-color-background"),"updatedTime"!==e.template&&"createdTime"!==e.template||(e.icon="smart-icon-clock"),"multiComboInput"===e.editor.template&&e.editor.collaborator&&(e.icon="smart-icon-user"),"createdBy"!==e.template&&"updatedBy"!==e.template&&"collaborator"!==e.template||(e.icon="smart-icon-user"),"image"===e.editor.template&&(e.icon="smart-icon-image"),"attachment"===e.editor.template&&(e.icon="smart-icon-docs"),"password"===e.editor.template&&(e.icon="smart-icon-lock"),"phone"===e.editor.template?e.icon="smart-icon-phone":"checkBox"===e.editor.template||"boolean"===e.dataType?e.icon="smart-icon-ok-squared":"numberInput"===e.editor.template||"slider"===e.editor.template||"number"===e.dataType||"int"===e.dataType||"float"===e.dataType?e.icon="smart-icon-number":"dateInput"===e.editor.template||"dateTimePicker"===e.editor.template||"date"===e.dataType?(e.icon="smart-icon-calendar","timeInput"===e.editor.template&&(e.icon="smart-icon-clock")):"timeInput"===e.editor.template||"time"===e.dataType?e.icon="smart-icon-clock":"grid"===e.editor.template?e.icon="smart-icon-table-alt":e.editor.template.indexOf("multi")>=0&&"collaborator"!==e.template&&(e.editor.collaborator?e.icon="smart-icon-user":e.icon="smart-icon-list-ordered",e.editor.singleSelect&&(e.icon="smart-icon-sort-down")),e.relationId&&(e.icon="smart-icon-table-alt"),e.formula&&(e.icon="smart-icon-math"),(e.AIQuery||"ai"===e.template)&&(e.icon="smart-icon-ai"),"uuid"===e.template&&(e.icon="smart-icon-number"),"rating"!==e.editor.template&&"rating"!==e.template||(e.icon="smart-icon-star"),"sparklines"===e.template&&(e.icon="smart-icon-chart"),"vote"===e.template&&(e.icon="smart-icon-like"),"autoNumber"===e.template&&(e.icon="smart-icon-list-ordered")),e.menu=null,void 0===e.allowActionButtonAnimation&&(e.grid?e.allowActionButtonAnimation=e.grid.appearance.allowColumnActionButtonAnimation:e.allowActionButtonAnimation=!1),void 0===e.allowSortButtonAnimation&&(e.grid?e.allowSortButtonAnimation=e.grid.appearance.allowColumnSortButtonAnimation:e.allowSortButtonAnimation=!1),void 0===e.autoShowActionButton&&(e.grid?e.autoShowActionButton=e.grid.appearance.autoShowColumnActionButton:e.autoShowActionButton=!1),void 0===e.autoShowSortButton&&(e.grid?e.autoShowSortButton=e.grid.appearance.autoShowColumnSortButton:e.autoShowSortButton=!0),void 0===e.showSortButton&&(e.grid?e.showSortButton=e.grid.appearance.showColumnSortButton:e.showSortButton=!1),void 0===e.showCardLabel&&(e.showCardLabel=!0),void 0===e.cardSpan&&(e.cardSpan=!1),void 0===e.allowItemsAdd&&(e.allowItemsAdd=!1),void 0===e.dots&&(e.dots=!1),void 0===e.cardHeight&&(e.cardHeight=0,("image"===e.template||e.editor&&"textarea"===e.editor.template)&&(e.cardHeight=4)),void 0===e.showIcon&&(e.grid&&!e.autoGenerated?e.showIcon=e.grid.appearance.showColumnIcon:e.showIcon=!1),void 0===e.showDescriptionButton&&(e.grid?e.showDescriptionButton=e.grid.appearance.showColumnDescriptionButton:e.showDescriptionButton=!1),void 0===e.showCustomButton&&(e.grid?e.showCustomButton=e.grid.appearance.showColumnCustomButton:e.showCustomButton=!1),void 0===e.showActionButton&&(e.grid?e.showActionButton=e.grid.appearance.showColumnActionButton:e.showActionButton=!1),void 0===e.allowLabelAnimation&&(e.grid?e.allowLabelAnimation=e.grid.appearance.allowColumnLabelAnimation:e.allowLabelAnimation=!1),void 0===e.autoShowFilterButton&&(e.grid?e.autoShowFilterButton=e.grid.appearance.autoShowColumnFilterButton:e.autoShowFilterButton=!1),void 0===e.showFilterButton&&(e.grid?e.showFilterButton=e.grid.appearance.showColumnFilterButton:e.showFilterButton=!1),void 0===e.autoCloseMenu&&(e.grid?e.autoCloseMenu=e.grid.columnMenu.autoClose:e.autoCloseMenu=!0),void 0===e.allowNull&&(e.allowNull=!0),e.formatFunction||(e.formatFunction=null),e.cellsRenderer||(e.cellsRenderer=null),e.sortOrder||(e.sortOrder=null),void 0===e.sortIndex&&(e.sortIndex=null),e.sortComparator||(e.sortComparator=null),e.filter||(e.filter=null),e.className||(e.className=""),e.cellsClassName||(e.cellsClassName=""),e.cellsCSSRules||(e.cellsCSSRules=null),e.cellsCSSInlineRules||(e.cellsCSSInlineRules=null),e.filterMenuMode||(e.filterMenuMode="default",e.grid&&"excel"===e.grid.filtering.filterMenu.mode&&(e.filterMenuMode="excel"),e.autoGenerated&&(e.filterMenuMode="none")),e.align||(e.align=o),!e.cellsAlign)switch(e.cellsAlign=o,e.dataType){case"date":case"number":e.cellsAlign="right"}if(!(e.cellsWrap||(e.cellsWrap=!1,e.grid&&e.grid.layout.allowCellsWrap&&(e.cellsWrap=e.grid.layout.allowCellsWrap)),e.minWidth||(e.minWidth=30),e.width||(e.width=null),e.autoGenerated||e.width&&"number"==typeof e.width))if(e.grid&&e.grid.layout.columnWidth)e.width=e.grid.layout.columnWidth;else if(e.grid&&e.grid.layout.autoSizeNewColumn&&!e._autoSizeWidth){const t=e._autoSize();e.width=Math.max(e.grid.layout.autoSizeNewColumnMinWidth,t),e._autoSizeWidth=e.width}else e.width&&"string"==typeof e.width&&(isNaN(parseInt(e.width))||-1===e.width.indexOf("%")&&(e.width=parseInt(e.width)));if(void 0===e.visible&&(e.visible=!0),void 0===e.allowResize&&(e.allowResize=!0),void 0===e.allowFreeze&&(e.allowFreeze=!0),void 0===e.allowReorder&&(e.allowReorder=!0),void 0===e.allowHide&&(e.allowHide=!0),void 0===e.allowDelete&&(e.allowDelete=!0),void 0===e.allowSort&&(e.allowSort=!0),void 0===e.allowSelect&&(e.allowSelect=!0),void 0===e.allowSortToggleOnClick&&(e.allowSortToggleOnClick=!0),void 0===e.allowGroup&&(e.allowGroup=!0),void 0===e.allowFilter&&(e.allowFilter=!0),void 0===e.allowEdit&&(e.allowEdit=!0),void 0===e.allowTypeChange&&(e.allowTypeChange=!0),void 0===e.allowSummary&&(e.allowSummary=!0),void 0===e.allowHeaderEdit&&(e.allowHeaderEdit=!0),void 0===e.allowExport&&(e.allowExport=!0),void 0===e.allowCollapse&&(e.allowCollapse=!0),void 0===e.collapsed&&(e.collapsed=!1),void 0===e.description&&(e.description=""),void 0===e.group&&(e.group=!1),e.summary||(e.summary=[]),"false"===e.freeze&&(e.freeze=!1),"true"===e.freeze&&(e.freeze=!0),!1===e.allowFreeze&&(e.freeze=!1),void 0===e.defaultValue&&(e.defaultValue=null),e.disabledDialogOptions||(e.disabledDialogOptions=[]),e.formatSettings||(e.formatSettings={decimalPlaces:null,decimalSeparator:null,negativeWithBrackets:null,prefix:null,sufix:null,thousandsSeparator:null,dateFormat:"d"}),this.validationRules||(this.validationRules=[]),e.selected=!1,e.sorted=!1,e.filtered=!1,e.filter&&(e.filtered=!0),e.parent=null,e.children=[],e.templateSettings||(e.templateSettings={}),e.dataSet||(e.dataSet={}),e.grid&&e.formula){let t=e.formula;for(let o=0;o<e.grid.columns.length;o++){const l=e.grid.columns[o];-1===t.indexOf("COL("+l.dataField+")")&&-1===t.indexOf("COL("+l.label+")")&&(t.indexOf(l.label)>=0?(t=t.replaceAll(l.label,"COL("+l.dataField+")"),e.formula=t):t.indexOf(l.dataField)>=0&&(t=t.replaceAll(l.dataField,"COL("+l.dataField+")"),e.formula=t))}}if(!e.placeholder&&e.grid&&e.grid.appearance.allowColumnAutoPlaceholder&&("string"===e.dataType||"text"===e.dataType?e.placeholder=e.label:"number"===e.dataType||"int"===e.dataType||"float"===e.dataType?e.placeholder="##":"date"===e.dataType&&(e.placeholder=e.cellsFormat||"m/d/yyyy"),e._state.placeholder=e.placeholder),"createdTime"===e.template||"updatedTime"===e.template||"createdBy"===e.template||"updatedBy"===e.template){const t=[];t.createdTime="createdDate",t.updatedTime="updatedDate",t.createdDate="createdDate",t.updatedDate="updatedDate",t.createdBy="createdBy",t.updatedBy="updatedBy",e.sortComparator=function(o,l,i,n){if(e.grid){const o=e.grid.rowById[i.$.id],l=e.grid.rowById[n.$.id],a=t[e.template];if("createdDate"===a){if(o.history[0].date<l.history[0].date)return-1;if(o.history[0].date>l.history[0].date)return 1}if("updatedDate"===a){if(o.history[o.history.length-1].date<l.history[l.history.length-1].date)return-1;if(o.history[o.history.length-1].date>l.history[l.history.length-1].date)return 1}}return 0}}}refresh(){const t=this;t.element&&t.element._refresh()}render(){const t=this;t.element.column=t,t.element&&t.element._render()}get stateProps(){return["allowExport","allowCollapse","allowFreeze","allowNull","allowGroup","allowSelect","verticalAlign","columnGroup","cellsVerticalAlign","autoCloseMenu","autoShowActionButton","autoShowSortButton","autoShowFilterButton","allowLabelAnimation","allowActionButtonAnimation","allowSortButtonAnimation","allowHide","allowDelete","allowEdit","allowSummary","allowHeaderEdit","allowFilter","allowSort","allowSortToggleOnClick","allowResize","allowReorder","description","icon","menuItems","summary","cellsFormat","className","formula","AIQuery","rowSpan","cellsClassName","cellsCSSRules","cellsCSSInlineRules","templateSettings","formatSettings","formatFunction","cellsRenderer","index","sortIndex","sortOrder","sortComparator","sorted","groups","group","filtered","filterEditor","filter","filterMenuMode","defaultValue","dataField","displayField","label","labelTemplate","headerTemplate","dataType","align","cellsWrap","cellsAlign","minWidth","width","visible","_visible","freeze","showActionButton","selected","showIcon","highlight","showDescriptionButton","treeColumn","statusColumn","value","thHierarchy","dataSet","valueField","onAction","title","tooltip","tooltipRenderer","showCustomButton","showFilterButton","computedFields","showSortButton","editor","template","visibleIndex","validationRules","relationId","relationField","relationCascadingFields","parentDataField","cascadingDataField","allowItemsAdd","dots","placeholder"]}setState(t){const e=this;if(!t)return;if(e._state={},!t.dataField)return;if(t.dataField.startsWith("_"))return{};const o=e.stateProps;for(let l in t)if(!l.startsWith("_")&&o.indexOf(l)>=0)if("editor"===l){e._state[l]={};for(let t in e[l])"row"!==t&&"column"!==t&&"cell"!==t&&"columns"!==t&&"column"!==t&&"instance"!==t&&"element"!==t&&(e._state[l][t]=e[l][t])}else"groups"===l?e[l]&&e[l].length>0&&(e._state[l]=e[l]):e._state[l]=e[l]}getState(){const t=this;if(t.dataField.startsWith("_"))return{};if(t._state){t._state._visible=t._visible,t._state._dataField=t._dataField,t._state.editor={};for(let e in t.editor)"row"!==e&&"column"!==e&&"cell"!==e&&"instance"!==e&&"columns"!==e&&"element"!==e&&(t._state.editor[e]=t.editor[e])}if(!t._state){t._state={label:t.label,dataField:t.dataField,dataType:t.dataType,_visible:t._visible};const e=t.stateProps;for(let o in t)if(!o.startsWith("_")&&e.indexOf(o)>=0)if("editor"===o){t._state[o]={};for(let e in t[o])"row"!==e&&"column"!==e&&"cell"!==e&&"instance"!==e&&"columns"!==e&&"element"!==e&&(t._state[o][e]=t[o][e])}else"groups"===o?t[o]&&t[o].length>0&&(t._state[o]=t[o]):"filter"===o?t[o]&&"string"!=typeof t[o]&&(t._state[o]=t[o].toString()):t._state[o]=t[o]}return t._state}setProperty(t,e,o=!0){const l=this,i=l.getProperty(t);i!==e&&(l.canNotify=!1,l[t]=e,o&&(l.propertyChanged(t,i,e),l.grid&&l.grid.onColumnChange&&l.stateProps.indexOf(t)>=0&&l.grid.onColumnChange(l,t,i,e)),l.canNotify=!0)}getProperty(t){const e=this;if("selected"===t){let o=!1;return e.grid&&(e.grid._selection.cells["column"+e.dataField]&&(o=null),e.grid&&e.grid._selection.columns[e.dataField]&&(o=!0),e.grid.columns.canNotify=!1,e[t]!==o&&(e[t]=o),e.grid.columns.canNotify=!0),o}return"group"===t?!(!e.dataSource||!e.dataSource.groupBy)&&e.dataSource.groupBy.indexOf(e.dataField)>=0:e[t]}get properties(){return["allowExport","allowCollapse","dataSet","options","allowTypeChange","allowFreeze","allowNull","allowGroup","allowSelect","verticalAlign","columnGroup","cellsVerticalAlign","autoCloseMenu","autoShowActionButton","autoShowSortButton","autoShowFilterButton","allowLabelAnimation","allowActionButtonAnimation","allowSortButtonAnimation","allowHide","allowDelete","allowEdit","allowSummary","allowHeaderEdit","allowFilter","allowSort","allowSortToggleOnClick","allowResize","allowReorder","canNotify","data","disabledDialogOptions","description","grid","icon","menuItems","menu","summary","cellsFormat","className","cellsClassName","cellsCSSRules","cellsCSSInlineRules","templateSettings","formatSettings","formatFunction","cellsRenderer","index","sortIndex","sortOrder","sortComparator","sorted","groups","element","level","group","filtered","filterEditor","filter","filterMenuMode","defaultValue","dataField","displayField","label","labelTemplate","headerTemplate","dataType","align","cellsWrap","cellsAlign","minWidth","width","formula","AIQuery","visible","_visible","freeze","showActionButton","selected","showIcon","highlight","rowSpan","showDescriptionButton","statusColumn","treeColumn","computedWidth","computedHeight","overflowWidth","parent","showCardLabel","cardSpan","tooltip","tooltipRenderer","cardHeight","relationId","relationField","relationCascadingFields","getFilterPanel","getCellValue","updateFilterPanel","children","value","thHierarchy","valueField","onAction","left","top","title","showCustomButton","showFilterButton","showSortButton","editor","template","visibleIndex","validationRules","parentDataField","cascadingDataField","computedFields","allowItemsAdd","dots","placeholder","detailColumns","collapsed"]}propertyChanged(t,e,o){const l=this;if(l.data&&void 0!==l.data[t]&&(l.data[t]=o),l._state||(l._state={label:l.label,dataField:l.dataField,dataType:l.dataType,_visible:l._visible}),l._state&&o!==e&&l.dataField&&!l.dataField.startsWith("_"))if("editor"===t){l._state[t]={};for(let e in o)"row"!==e&&"column"!==e&&"cell"!==e&&"instance"!==e&&"element"!==e&&(l._state[t][e]=o[e])}else"filter"===t?l[t]&&"string"!=typeof o?l._state[t]=o.toString():l._state[t]=o:"sortOrder"===t?("asc"!==o&&"desc"!==o&&null!==o&&"ascending"!==o&&"descending"!==o&&(o=null),l.stateProps.indexOf(t)>=0&&(l._state[t]=o)):l.stateProps.indexOf(t)>=0&&(l._state[t]=o);if("formula"!==t)if("highlight"!==t)if("className"!==t)if("editor"!==t)if("allowSort"!==t&&"allowFilter"!==t)if("showIcon"!==t){if("visible"===t){const t=l.grid.grouping.enabled;return l.grid.refresh(t),void(t&&l.grid._filters&&l.grid.refreshFilters(t))}if("showCustomButton"===t&&(o?l.element._showCustomButton():l.element._hideCustomButton()),"showDescriptionButton"===t)return o?l.element._showDescriptionButton():l.element._hideDescriptionButton(),void l.refresh();if("description"!==t){if("filter"===t&&(l.filter?l.filter&&Array.isArray(l.filter)&&0===l.filter.length?(l.filter=null,l.filtered=!1,l.grid.removeFilter(l.dataField)):(l.grid.addFilter(l.dataField,l.filter),l.filtered=!0):(l.grid.removeFilter(l.dataField),l.filtered=!1),(l.autoShowFilterButton||l.showFilterButton)&&(o?l.element._showFilterButton():l.element._hideFilterButton()),l.grid.autoSaveState()),"sortIndex"===t)return-1===l.sortIndex&&(l.sortIndex=null),"many"===l.grid.sorting.mode&&l.grid.context===document&&l.grid.sortBy(l.dataField,l.sortOrder),null!==l.sortIndex&&-1!==l.sortIndex?l.element.setAttribute("sort-index",l.sortIndex):l.element.removeAttribute("sort-index"),void l.element._updateSortOrder();if("selected"===t){if(!1===l.allowSelect)return;l.selectionColumn&&l.refresh(),o?l.grid._selection.columns[l.dataField]||(l.grid._selection.columns[l.dataField]=!0):!1===o&&l.grid._selection.columns[l.dataField]&&delete l.grid._selection.columns[l.dataField],l.grid._recycle(!1)}if("formatSettings"===t&&l.grid._recycle(!1),"sortOrder"===t)return l.sorted=!1,null===o?l.element._hideSortButton():(l.element._showSortButton(),l.sorted=!0),"asc"!==l.sortOrder&&"desc"!==l.sortOrder&&null!==l.sortOrder&&"ascending"!==l.sortOrder&&"descending"!==l.sortOrder&&(l.sortOrder=null),l.grid.context===document&&l.grid.sortBy(l.dataField,l.sortOrder),void(l.sorted?l.element.setAttribute("aria-sort","asc"===l.sortOrder?"ascending":"descenting"):(l.element.removeAttribute("aria-sort"),l.element.removeAttribute("sort-index")));if("group"!==t){if("showActionButton"===t&&(l.element.allowAnimations=!1,o?l.element._showActionButton():l.element._hideActionButton(),l.element.allowAnimations=!0),"autoShowActionButton"===t&&(l.element.allowAnimations=!1,o?l.element._hideActionButton():l.element._showActionButton(),l.element.allowAnimations=!0),"showFilterButton"===t&&(l.element.allowAnimations=!1,void 0===l._autoShowFilterButton&&(l._autoShowFilterButton=l.autoShowFilterButton),o?(l.autoShowFilterButton=!1,l.element._showFilterButton()):(l.element._hideFilterButton(),l.autoShowFilterButton=l._autoShowFilterButton),l.element.allowAnimations=!0),"showSortButton"===t&&(l.element.allowAnimations=!1,void 0===l._autoShowSortButton&&(l._autoShowSortButton=l.autoShowSortButton),o?(l.autoShowSortButton=!1,l.element._showSortButton()):(l.element._hideSortButton(),l.autoShowSortButton=l._autoShowSortButton),l.element.allowAnimations=!0),"autoShowSortButton"===t&&(l.element.allowAnimations=!1,l._autoShowSortButton=l.autoShowSortButton,o?l.element._hideSortButton():l.element._showSortButton(),l.element.allowAnimations=!0),"menu"===t&&(o?l.element.setAttribute("aria-controls",l.menu.id):(l.element.removeAttribute("aria-controls"),l.autoShowActionButton&&l.element._hideActionButton())),"cellsFormat"!==t&&"formatSettings"!==t&&"dataField"!==t&&"displayField"!==t&&"template"!==t||l.grid._recycle(),"label"!==t&&"labelTemplate"!==t&&"width"!==t&&"minWidth"!==t||l.grid.refresh(),"freeze"===t){if(!l.allowFreeze)return;const t=l.grid,e=()=>{const e=t.context;t.context=t,t._renderColumns(),!1===o&&t._initializeRowElements(),t.refresh(),t.context=e};if(t.columnGroups&&t.columnGroups.length>0&&l.columnGroup)return void e();e()}}else l.grid.context===document&&(o?l.grid.addGroup(l.dataField):l.grid.removeGroup(l.dataField))}else l.refresh()}else l.refresh();else l.refresh();else l._editorId="_"+Math.floor(65536*(1+Math.random())).toString(16).substring(1);else l.refresh();else this.refresh();else l.grid&&l.grid._initFormulaParser()}_measureSize(t){const e=this.grid,o=function(){const o=[],l=document.createElement("div"),i=document.createElement("div"),n=Array.isArray(t)?t:[t];i.classList.add("smart-label"),l.appendChild(i),l.style.width="auto",l.style.position="static",e.$.columnHeader.appendChild(l);for(let t=0;t<n.length;t++){i.innerHTML="<span>"+n[t]+"</span>";const e=20+i.firstChild.offsetWidth,l=Math.max(30,e);o.push(l)}return e.$.columnHeader.removeChild(l),o}();return 1===o.length?o[0]:o}_autoSize(t){const e=this,o=e.grid;let l=e.label.toString();if(!t){const t=o.isInitialized?o._recyclingRows:[];for(let o=0;o<t.length;o++){const i=t[o],n=""+i.data[e.dataField];if("image"===e.template)break;n&&n.length>l.length&&(l=n),"date"===e.dataType&&n&&e.cellsFormat&&i.data[e.dataField]&&(l=new Smart.Utilities.DateTime(i.data[e.dataField]).toString(e.cellsFormat))}}const i=e._measureSize(l);return e.showIcon?i+20:i}autoSize(t){const e=this._autoSize(t);this.width=e}createElement(){const t=this,e=document.createElement("smart-grid-column");return e._initialize(t),e.setAttribute("role","columnheader"),e.setAttribute("aria-haspopup",""),t.element=e,t.grid.notify((function(e,o,l){switch(e){case"appearance_allowColumnLabelAnimation":t.setProperty("allowLabelAnimation",l);break;case"appearance_allowColumnSortAnimation":t.setProperty("allowSortAnimation",l);break;case"appearance_allowColumnSortButtonAnimation":t.setProperty("allowSortButtonAnimation",l);break;case"appearance_allowColumnActionButtonAnimation":t.setProperty("allowActionButtonAnimation",l);break;case"appearance_allowColumnFilterButtonAnimation":t.setProperty("allowFilterButtonAnimation",l);break;case"appearance_autoShowColumnActionButton":t.setProperty("autoShowActionButton",l);break;case"appearance_autoShowColumnSortButton":t.setProperty("autoShowSortButton",l);break;case"appearance_autoShowColumnFilterButton":t.setProperty("autoShowFilterButton",l);break;case"appearance_showColumnActionButton":t.setProperty("showActionButton",l);break;case"appearance_showColumnFilterButton":t.setProperty("showFilterButton",l);break;case"appearance_showColumnCustomButton":t.setProperty("showCustomButton",l);break;case"appearance_showColumnDescriptionButton":t.setProperty("showDescriptionButton",l);break;case"appearance_showColumnSortButton":t.setProperty("showSortButton",l);break;case"appearance_showFrozenColumnBackground":case"appearance_showSortColumnBackground":case"appearance_showFilterColumnBackground":t.grid._recycle(!1)}})),e}}),Smart("smart-grid-column",class extends Smart.BaseElement{_showSortButton(t){const e=this;e.column&&(e.column.autoGenerated||(e.sortButton.classList.remove("asc"),e.sortButton.classList.remove("desc"),e.column&&e.column.grid&&!1===e.column.grid.sorting.maintainSort?e.sortButton.removeAttribute("order"):(e.column.autoShowSortButton||e.column.allowSort&&e.sortButton.classList.add("smart-icon-sort","smart-grid-icon"),"asc"===e.column.sortOrder?e.sortButton.classList.add("asc"):"desc"===e.column.sortOrder&&e.sortButton.classList.add("desc"),e.column.showSortButton&&(e.sortButton.classList.add("show"),!1!==t&&e._refresh()),null!==e.column.sortIndex?e.sortButton.setAttribute("order",1+e.column.sortIndex):e.sortButton.removeAttribute("order"))))}_updateSortOrder(){const t=this;if(!t.column)return t.removeAttribute("sort-index"),void t.sortButton.removeAttribute("order");null!==t.column.sortIndex?(t.setAttribute("sort-index",t.column.sortIndex),t.sortButton.setAttribute("order",1+t.column.sortIndex)):(t.removeAttribute("sort-index"),t.sortButton.removeAttribute("order"))}_hideSortButton(t){const e=this;e.column&&(e.sortButton.classList.remove("asc"),e.sortButton.classList.remove("desc"),e.sortButton.removeAttribute("order"),e.column.showSortButton&&!e.column.autoShowSortButton||(e.sortButton.classList.remove("show"),e.sortButton.classList.remove("smart-icon-sort"),!1!==t&&e._refresh()))}_showFilterButton(t){const e=this;e.column&&!e.column.autoGenerated&&(e.filterButton.classList.add("show"),e._isInitialized&&!1!==t&&e._refresh())}_hideFilterButton(t){const e=this;e.column&&(e.filterButton.classList.remove("show"),e._isInitialized&&!1!==t&&e._refresh())}_showDescriptionButton(){const t=this;t.column&&!t.column.autoGenerated?t.hasAttribute("columnHeader")||(t.column.description?(t.descriptionButton.setAttribute("title",t.column.description),t.descriptionButton.classList.add("show")):t.descriptionButton.classList.remove("show"),t._isInitialized&&t._refresh()):t.descriptionButton.classList.remove("show")}_hideDescriptionButton(){const t=this;t.column&&(t.descriptionButton.classList.remove("show"),t._isInitialized&&t._refresh())}_showIcon(){const t=this;t.column&&!t.column.autoGenerated&&(t.icon.classList.add("show","column-icon"),t.setAttribute("has-icon",""),t._isInitialized&&t._refresh())}_hideIcon(){const t=this;t.icon.classList.remove("show","column-icon"),t.removeAttribute("has-icon"),t._refresh()}_showCustomButton(){const t=this;t.column&&!t.column.autoGenerated&&(t.customButton.classList.add("show"),t._refresh())}_hideCustomButton(){const t=this;t.column&&(t.customButton.classList.remove("show"),t._refresh())}_showActionButton(){const t=this;t.column&&t.column.showActionButton&&t.column.grid.hasColumnMenu(t.column)&&!t.column.autoGenerated&&t.actionButton&&(t.actionButton.classList.add("show"),t._refresh())}_hideActionButton(){const t=this;t.column&&t.column.showActionButton&&t.actionButton&&!t.hasAttribute("aria-controls")&&t.actionButton.classList.contains("show")&&(t.actionButton.classList.remove("show"),t._refresh())}_rotate(){const t=this,e=document.createElement("span");return t.label.innerHTML="",e.innerHTML=t.column.label,t.label.appendChild(e),e.className="rotate",e.style.transform="rotate("+t.column.rotationAngle+"deg)",t.column.grid._recycleRotate(t.label,e,t.column.align,t.column.verticalAlign,t.column.label)}_align(){const t=this;let e=t.column.align;switch(t.column.grid.rightToLeft&&("left"===e?e="right":"right"===e&&(e="left")),e){case"left":t.label.classList.add("align-left");break;case"center":t.label.classList.add("align-center");break;case"right":t.label.classList.add("align-right")}switch(t.column.verticalAlign){case"top":t.label.classList.add("align-top");break;case"middle":t.label.classList.add("align-middle");break;case"bottom":t.label.classList.add("align-bottom")}}_refresh(){const t=this;if(!t.column)return;const e=t.column.grid;if(t.sortButton.classList.remove("filter"),t.sortButton.classList.remove("action"),t.label.className="smart-label",t.label.firstElementChild&&t.column.className&&(t.label.className="smart-label "+t.column.className),t.descriptionButton&&t.descriptionButton.setAttribute("title",t.column.description),!0===t.column.autoGenerated||t.hasAttribute("columnHeader")?t.descriptionButton.classList.remove("show"):t.column.showDescriptionButton&&t.column.description?t.descriptionButton.classList.add("show"):t.descriptionButton.classList.remove("show"),t.column.highlight?t.setAttribute("highlight",""):t.removeAttribute("highlight"),t.column.visible&&"_checkBoxColumn"===t.column.dataField){const e=t.column.grid;let o=e.getVisibleRows();e.paging.enabled&&"page"===e.selection.checkBoxes.selectAllMode&&(o=o.slice(e.paging.pageIndex*e.paging.pageSize,(e.paging.pageIndex+1)*e.paging.pageSize));const l=e._getSelectedRows(!0,!1);if(e.selection.checkBoxes.autoShow?t.setAttribute("auto-show",""):t.removeAttribute("auto-show"),e._isVirtualMode()){const o=e.dataSource.virtualDataSourceLength;l>0&&l===o?t.setAttribute("selected",""):l>0&&l<o?t.setAttribute("selected","indeterminate"):0!==l&&0!==o||t.removeAttribute("selected")}else l.length>0&&l.length===o.length?t.setAttribute("selected",""):l.length>0&&l.length<o.length?t.setAttribute("selected","indeterminate"):0!==l.length&&0!==o.length||t.removeAttribute("selected");return t.removeAttribute("checkbox"),t.label.classList.remove("smart-input"),void("none"!==e.selection.checkBoxes.selectAllMode&&(t.setAttribute("checkbox",""),t.label.classList.add("smart-input")))}if("_rowHeaderColumn"===this.column.dataField){const e=t.column.grid;if(e.selection.enabled&&e.selection.allowRowHeaderSelection&&e.appearance.showRowHeaderSelectIcon){let o='<div class="smart-grid-command-item">',l=e.areAllRowsSelected()?"smart-icon-check-squared":"smart-icon-check-empty";e.isEmpty()&&(l=""),o+='<span class="smart-grid-icon '+l+'"></span>',o+="</div>",t.label.style.paddingLeft="0px",t.label.style.paddingRight="0px",t.label.innerHTML=o}}if("_commandColumn"===t.column.dataField){const e=t.column.grid,o="icon"!==e.editing.commandColumn.displayMode,l="label"!==e.editing.commandColumn.displayMode,i=e.editing.commandColumn.dataSource.commandColumnMenu;let n='<div class="smart-grid-command-item">';const a="{{messages}}"===i.label?e.localize("commandColumnMenu"):i.label,r=i.icon;l&&o?(n+='<span class="smart-grid-icon '+r+'"></span>',n+='<span class="smart-grid-label">'+a+"</span>"):l&&!o?n+='<span class="smart-grid-icon '+r+'"></span>':o&&!l&&(n+='<span class="smart-grid-label">'+a+"</span>"),n+="</div>",i.visible&&(t.label.innerHTML=n)}const o=t.column.getProperty("selected");if(!1===o&&t.hasAttribute("selected")?t.removeAttribute("selected"):!0===o?t.setAttribute("selected",""):null===o&&t.setAttribute("selected","indeterminate"),t.column.allowSortButtonAnimation?t.sortButton.classList.add("smart-animate"):t.sortButton.classList.remove("smart-animate"),e.dragDrop&&e.dragDrop.column===t.column?t.classList.add("dragged"):t.classList.remove("dragged"),t.column.sorted?t._showSortButton(!1):t._hideSortButton(!1),t.column.sorted?(t.setAttribute("aria-sort","asc"===t.column.sortOrder?"ascending":"descenting"),t._updateSortOrder()):(t.removeAttribute("aria-sort"),t.removeAttribute("sort-index")),(t.column.autoShowFilterButton||t.column.showFilterButton)&&(t.column.filtered?t._showFilterButton(!1):t._hideFilterButton(!1)),t.column.allowFilterButtonAnimation?t.filterButton.classList.add("smart-animate"):t.filterButton.classList.remove("smart-animate"),t.column.allowActionButtonAnimation&&!1!==t.allowAnimations?t.buttonsGroup.classList.add("smart-animate"):t.buttonsGroup.classList.remove("smart-animate"),t.column.allowLabelAnimation&&!1!==t.allowAnimations?t.label.classList.add("smart-animate"):t.label.classList.remove("smart-animate"),t.buttonsGroup.classList.remove("action"),t.actionButton.classList.contains("show")&&t.buttonsGroup.classList.add("action"),t.column.showIcon?(t.icon.classList.add("show","column-icon"),t.setAttribute("has-icon","")):(t.icon.classList.remove("show","column-icon"),t.removeAttribute("has-icon","")),t.icon.classList.contains("show"))if(t.icon.className="smart-grid-icon show column-icon",t.column.icon&&t.column.icon.indexOf(" ")>=0){const e=t.column.icon.trim().split(" ");for(let o=0;o<e.length;o++)t.icon.classList.add(e[o])}else t.icon.classList.add(t.column.icon);let l=t.column.showIcon?1:0;for(let e=0;e<t.buttonsGroup.children.length;e++)t.buttonsGroup.children[e].classList.contains("show")&&l++;switch(l){case 1:t.label.classList.add("one");break;case 2:t.label.classList.add("two");break;case 3:t.label.classList.add("three");break;case 4:t.label.classList.add("four");break;case 5:t.label.classList.add("five");break;case 6:t.label.classList.add("six")}t.classList.remove("smart-visibility-hidden"),t.column.grid._columnGap>0?t.classList.add("smart-grid-column-border"):t.classList.remove("smart-grid-column-border"),t.column.grid.appearance.showColumnHeaderLines?t.classList.remove("smart-grid-vertical-border-collapse"):t.classList.add("smart-grid-vertical-border-collapse"),(!t.column.rotationAngle||t._rotate())&&t._align()}_renderTemplate(){const t=this,e=t.column,o=e.labelTemplate;let l="";if("function"!=typeof o){if(o instanceof HTMLTemplateElement)l=o;else{if("string"!=typeof o||!o.startsWith||!o.startsWith("#"))return void(t.label.innerHTML=o);l=document.querySelector(o)}if(l){let o=l.content.cloneNode(!0).firstElementChild,i=e.label;i=i.toString(),i=i.replace(/'/gi,"\\'"),i=i.replace(/"/gi,'\\"');const n=o.outerHTML.replace(/{{value}}/gi,i).replace(/{{id}}/gi,e.label);t.label.innerHTML=n}}else t.label.innerHTML=o(e.label)}_render(){const t=this,e=t.column.dataField?t.column.dataField:"",o=t.column===t.column.grid._lastVisibleColumn;if(t.column.labelTemplate?t._renderTemplate():t.label.firstChild?t.label.firstChild.textContent!==t.column.label&&(t.column.label.indexOf("&")>=0||"SPAN"!==t.label.firstChild.nodeName?t.label.innerHTML="<span>"+t.column.label+"</span>":t.label.firstChild.textContent=t.column.label):t.label.innerHTML="<span>"+t.column.label+"</span>",t.column.title?t.setAttribute("title",t.column.title):t.removeAttribute("title"),t.column.tooltip&&(t.onmouseenter=e=>{t.column.grid._createTooltip(e,t.column.tooltip,t,"top")},t.onmouseleave=()=>{t.column.grid._cellTooltip&&(t.column.grid._cellTooltip.style.visibility="hidden")}),t._refresh(),t.column.autoGenerated&&t.setAttribute("auto-generated",""),t.column.autoGenerated||o){if(t.style.width=t.column.computedWidth+"px",t.column.grid.appearance.showRowComments&&t.column.rowHeaderColumn){const e=t.column.grid.rowDetailColumn,o=e?e.width:0;t.style.width=t.column.computedWidth+o+"px",t.style.zIndex=5}}else t.style.width=t.column.computedWidth-t.column.grid._columnGap+"px";if(t.style.height!==t.column.computedHeight+"px"&&(t.style.height=t.column.computedHeight+"px"),t.style.lineHeight!==t.column.computedHeight+"px"&&(t.style.lineHeight=t.column.computedHeight+"px"),t.column.grid.rightToLeft?t.style.right!==t.column.left+"px"&&(t.style.right=t.column.left+"px"):t.style.left!==t.column.left+"px"&&(t.style.left=t.column.left+"px"),t.style.top!==t.column.top+"px"&&(t.style.top=t.column.top+"px"),t.getAttribute("data-field")!==e&&t.setAttribute("data-field",e),t.setAttribute("header",""),t.column.freeze&&t.setAttribute("freeze",""),t.column.level>0&&(t.style.top=t.column.top+"px"),t.column.detailColumns&&t.column.detailColumns.length>0){const e=t.column.grid;if(t.column._collapseButton)return;const o={},l=[];for(let o=0;o<t.column.detailColumns.length;o++){const i=e.columnByDataField[t.column.detailColumns[o]];i&&l.push(i)}o.inline=!0,o.columns=l,o.collapsed=t.column.collapsed,o.column=t.column,e._initializeColumnGroupCollapsing(o);const i=o.collapseButton;i&&(o.column._collapseButton=i,o.column.element.label.appendChild(i),o.column.element.label.style.display="flex",o.column.element.label.style.justifyContent="space-between")}t.column.headerTemplate&&t.column.headerTemplate(t.label)}get hasStyleObserver(){return!1}get enableShadowDOM(){return!1}addThemeClass(){}addDefaultClass(){}get isUtilityElement(){return!0}_initialize(t){const e=this;e._isInitialized=!1;const o=document.createElement("div"),l=document.createElement("div"),i=document.createElement("div"),n=document.createElement("div"),a=document.createElement("div"),r=document.createElement("div"),s=document.createElement("div"),d=document.createElement("div"),c=document.createElement("div");e.column=t,e.classList.add("smart-visibility-hidden"),c.classList.add("smart-drag-handle"),s.classList.add("smart-icon","smart-grid-icon"),o.classList.add("smart-label"),l.classList.add("smart-sort-button","smart-grid-icon"),i.classList.add("smart-filter-button","smart-icon-filter","smart-grid-icon"),n.classList.add("smart-action-button","smart-grid-icon"),n.setAttribute("aria-haspopup",""),a.classList.add("smart-description-button","smart-icon-help-circled","smart-grid-icon"),r.classList.add("smart-custom-button",t.customButtonIcon?t.customButtonIcon:"smart-icon-tools","smart-grid-icon"),d.classList.add("smart-buttons-group"),n.innerHTML="<div></div>",e.style.width=e.column.computedWidth+"px",e.appendChild(c),e.appendChild(s),e.appendChild(o),e.appendChild(d),d.appendChild(l),d.appendChild(i),d.appendChild(a),d.appendChild(r),d.appendChild(n),e.handle=c,e.icon=s,e.label=o,e.sortButton=l,e.filterButton=i,e.actionButton=n,e.descriptionButton=a,e.customButton=r,e.buttonsGroup=d,e._properties=[];const u=window.PointerEvent?"pointerdown":"mousedown",m=window.PointerEvent?"pointerup":"mouseup";e._filterDownEvent=function(t){"col-resize"!==t.target.style.cursor&&(t.preventDefault(),t.stopPropagation(),e.column.onAction&&e.column.onAction(t))}.bind(e),e._filterUpEvent=function(t){t.preventDefault(),t.stopPropagation()},e._actionUpEvent=function(t){t.preventDefault(),t.stopPropagation()},e._actionDownEvent=function(t){t.preventDefault(),t.stopPropagation(),e.column.onAction&&e.column.onAction(t)}.bind(e),e.filterButton.addEventListener(u,e._filterDownEvent),e.filterButton.addEventListener(m,e._filterUpEvent),e.actionButton.addEventListener(m,e._actionUpEvent),e.actionButton.addEventListener(u,e._actionDownEvent),!e.column.autoShowActionButton&&e.column.showActionButton&&e._showActionButton(),!e.column.autoShowSortButton&&e.column.showSortButton&&e._showSortButton(),!e.column.autoShowFilterButton&&e.column.showFilterButton&&e._showFilterButton(),e.column.showDescriptionButton&&e._showDescriptionButton(),e.column.showCustomButton&&e._showCustomButton(),e.column.showIcon&&e._showIcon(),"_rowHeaderColumn"===e.column.dataField&&e.classList.add("top-near-corner"),e.customButton.onclick=function(t){e.column.onCustomButtonClick&&e.column.onCustomButtonClick(t)}.bind(e),e.column.sorted||e.column.sortOrder?(e.column.sorted=!0,e.setAttribute("aria-sort","asc"===e.column.sortOrder?"ascending":"descenting"),e._updateSortOrder()):(e.removeAttribute("aria-sort"),e.removeAttribute("sort-index")),e._properties=[],e._isInitialized=!0}template(){return""}_detach(){const t=this,e=window.PointerEvent?"pointerdown":"mousedown",o=window.PointerEvent?"pointerup":"mouseup";t.filterButton.removeEventListener(e,t._filterDownEven),t.filterButton.removeEventListener(o,t._filterUpEvent),t.actionButton.removeEventListener(o,t._actionUpEvent),t.actionButton.removeEventListener(e,t._actionDownEvent),t.element=null,t.column&&(t.column.grid=null,t.column.element=null),t.icon=null,t.label=null,t.sortButton=null,t.filterButton=null,t.actionButton=null,t.descriptionButton=null,t.customButton=null,t.buttonsGroup=null,t.column=null,delete t.grid,delete t.column,delete t.icon,delete t.label,delete t.sortButton,delete t.filterButton,delete t.actionButton,delete t.descriptionButton,delete t.customButton,delete t.buttonsGroup}onDetached(){this._detach()}});
1442
+ Smart.Utilities.Assign("Grid.Column",class{constructor(t){const e=this;"string"!=typeof t?Object.assign(e,t):(e.label=t,e.dataField=t),e.dataField||(e.dataField="dataField_"+Math.floor(65536*(1+Math.random())).toString(16).substring(1)),e.setState(t),e.dataType||(e.dataType="string"),e.title||(e.title=""),e.tooltip||(e.tooltip=""),e.tooltipRenderer||(e.tooltipRenderer=""),e.rowSpan||(e.rowSpan=null),e.formula||(e.formula=null),e.AIQuery||(e.AIQuery=null),e.columnGroup||(e.columnGroup=""),e.canNotify=!0,(!t||t&&!t.properties)&&(e.data=t);let o="left";switch(e.dataType){case"string":case"date":o="left";break;case"number":"rating"===t.template&&(o="left");break;case"boolean":o="center"}if(e.displayField!==e.dataField&&(o="left"),e.relationId||(e.relationId=""),e.relationField||(e.relationField=""),e.relationCascadingFields||(e.relationCascadingFields=""),e.highlight||(e.highlight=!1),void 0===e.index&&(e.index=-1),void 0===e.visibleIndex&&(e.visibleIndex=-1),void 0===e.selected&&(e.selected=!1),void 0===e.freeze&&(e.freeze=!1),e.label||(e.label=""),e.menuItems||(e.menuItems=null),e.options||(e.options=null),e.displayField||(e.displayField=e.dataField),e.template||(e.template=""),e.editor||(e.editor="input"),"string"==typeof e.editor){e.editor={template:e.editor,autoFocus:!0};let t=!0;e.editor.template&&e.editor.template.indexOf("<input")>=0&&(t=!1),t&&("number"===e.dataType||"int"===e.dataType||"float"===e.dataType?"slider"!==e.editor.template&&(e.editor.template="numberInput"):"date"===e.dataType?("timeInput"!==e.editor.template&&"dateTimePicker"!==e.editor.template&&(e.editor.template="dateInput"),e.editor.autoOpen=!0,e.cellsFormat||e.formatSettings||(e.cellsFormat="M/d/yyyy")):"time"===e.dataType?e.editor.template="timeInput":"boolean"===e.dataType||"bool"===e.dataType?e.editor.template="checkBox":"string"===e.dataType&&"tags"===e.template?(e.editor={template:"multiComboInput",readonly:!0,dropDownButtonPosition:"right",colorItems:!0,autoOpen:!0,pills:!0,dots:!1,singleSelect:!0},e.templateSettings&&!0===e.templateSettings.multiSelect&&(e.editor.singleSelect=!1),e.options&&(e.editor.dataSource=e.options)):"string"===e.dataType&&"collaborator"===e.template&&(e.editor={template:"multiComboInput",readonly:!0,dropDownButtonPosition:"right",colorItems:!0,autoOpen:!0,pills:!0,dots:!1,collaborator:!0,singleSelect:!0}))}else if(void 0===e.editor.autoFocus&&(e.editor.autoFocus=!0),e.editor.relationId&&e.editor.relationField&&e.grid){const t=e.grid._getRelationData(e.editor.relationId,e.editor.relationField,e.editor.singleSelect);e.editor.dataSource=t}if(e.icon||(e.icon="smart-icon-font","modifiedTime"===e.template&&(e.template="updatedTime"),"modifiedBy"===e.template&&(e.template="updatedBy"),"select"===e.editor.template&&(e.icon="smart-icon-sort-down"),"multiComboInput"===e.editor.template&&(e.icon="smart-icon-list-unordered"),"textArea"!==e.editor.template&&"textarea"!==e.editor.template||(e.icon="smart-icon-fontsize"),"url"===e.template&&(e.icon="smart-icon-link"),"email"===e.template&&(e.icon="smart-icon-mail"),"color"===e.template&&(e.icon="smart-icon-color-background"),"updatedTime"!==e.template&&"createdTime"!==e.template||(e.icon="smart-icon-clock"),"multiComboInput"===e.editor.template&&e.editor.collaborator&&(e.icon="smart-icon-user"),"createdBy"!==e.template&&"updatedBy"!==e.template&&"collaborator"!==e.template||(e.icon="smart-icon-user"),"image"===e.editor.template&&(e.icon="smart-icon-image"),"attachment"===e.editor.template&&(e.icon="smart-icon-docs"),"password"===e.editor.template&&(e.icon="smart-icon-lock"),"phone"===e.editor.template?e.icon="smart-icon-phone":"checkBox"===e.editor.template||"boolean"===e.dataType?e.icon="smart-icon-ok-squared":"numberInput"===e.editor.template||"slider"===e.editor.template||"number"===e.dataType||"int"===e.dataType||"float"===e.dataType?e.icon="smart-icon-number":"dateInput"===e.editor.template||"dateTimePicker"===e.editor.template||"date"===e.dataType?(e.icon="smart-icon-calendar","timeInput"===e.editor.template&&(e.icon="smart-icon-clock")):"timeInput"===e.editor.template||"time"===e.dataType?e.icon="smart-icon-clock":"grid"===e.editor.template?e.icon="smart-icon-table-alt":e.editor.template&&e.editor.template.indexOf("multi")>=0&&"collaborator"!==e.template&&(e.editor.collaborator?e.icon="smart-icon-user":e.icon="smart-icon-list-ordered",e.editor.singleSelect&&(e.icon="smart-icon-sort-down")),e.relationId&&(e.icon="smart-icon-table-alt"),e.formula&&(e.icon="smart-icon-math"),(e.AIQuery||"ai"===e.template)&&(e.icon="smart-icon-ai"),"uuid"===e.template&&(e.icon="smart-icon-number"),"rating"!==e.editor.template&&"rating"!==e.template||(e.icon="smart-icon-star"),"sparklines"===e.template&&(e.icon="smart-icon-chart"),"vote"===e.template&&(e.icon="smart-icon-like"),"autoNumber"===e.template&&(e.icon="smart-icon-list-ordered")),e.menu=null,void 0===e.allowActionButtonAnimation&&(e.grid?e.allowActionButtonAnimation=e.grid.appearance.allowColumnActionButtonAnimation:e.allowActionButtonAnimation=!1),void 0===e.allowSortButtonAnimation&&(e.grid?e.allowSortButtonAnimation=e.grid.appearance.allowColumnSortButtonAnimation:e.allowSortButtonAnimation=!1),void 0===e.autoShowActionButton&&(e.grid?e.autoShowActionButton=e.grid.appearance.autoShowColumnActionButton:e.autoShowActionButton=!1),void 0===e.autoShowSortButton&&(e.grid?e.autoShowSortButton=e.grid.appearance.autoShowColumnSortButton:e.autoShowSortButton=!0),void 0===e.showSortButton&&(e.grid?e.showSortButton=e.grid.appearance.showColumnSortButton:e.showSortButton=!1),void 0===e.showCardLabel&&(e.showCardLabel=!0),void 0===e.cardSpan&&(e.cardSpan=!1),void 0===e.allowItemsAdd&&(e.allowItemsAdd=!1),void 0===e.dots&&(e.dots=!1),void 0===e.cardHeight&&(e.cardHeight=0,("image"===e.template||e.editor&&"textarea"===e.editor.template)&&(e.cardHeight=4)),void 0===e.showIcon&&(e.grid&&!e.autoGenerated?e.showIcon=e.grid.appearance.showColumnIcon:e.showIcon=!1),void 0===e.showDescriptionButton&&(e.grid?e.showDescriptionButton=e.grid.appearance.showColumnDescriptionButton:e.showDescriptionButton=!1),void 0===e.showCustomButton&&(e.grid?e.showCustomButton=e.grid.appearance.showColumnCustomButton:e.showCustomButton=!1),void 0===e.showActionButton&&(e.grid?e.showActionButton=e.grid.appearance.showColumnActionButton:e.showActionButton=!1),void 0===e.allowLabelAnimation&&(e.grid?e.allowLabelAnimation=e.grid.appearance.allowColumnLabelAnimation:e.allowLabelAnimation=!1),void 0===e.autoShowFilterButton&&(e.grid?e.autoShowFilterButton=e.grid.appearance.autoShowColumnFilterButton:e.autoShowFilterButton=!1),void 0===e.showFilterButton&&(e.grid?e.showFilterButton=e.grid.appearance.showColumnFilterButton:e.showFilterButton=!1),void 0===e.autoCloseMenu&&(e.grid?e.autoCloseMenu=e.grid.columnMenu.autoClose:e.autoCloseMenu=!0),void 0===e.allowNull&&(e.allowNull=!0),e.formatFunction||(e.formatFunction=null),e.cellsRenderer||(e.cellsRenderer=null),e.sortOrder||(e.sortOrder=null),void 0===e.sortIndex&&(e.sortIndex=null),e.sortComparator||(e.sortComparator=null),e.filter||(e.filter=null),e.className||(e.className=""),e.cellsClassName||(e.cellsClassName=""),e.cellsCSSRules||(e.cellsCSSRules=null),e.cellsCSSInlineRules||(e.cellsCSSInlineRules=null),e.filterMenuMode||(e.filterMenuMode="default",e.grid&&"excel"===e.grid.filtering.filterMenu.mode&&(e.filterMenuMode="excel"),e.autoGenerated&&(e.filterMenuMode="none")),e.align||(e.align=o),!e.cellsAlign)switch(e.cellsAlign=o,e.dataType){case"date":case"number":e.cellsAlign="right"}if(!(e.cellsWrap||(e.cellsWrap=!1,e.grid&&e.grid.layout.allowCellsWrap&&(e.cellsWrap=e.grid.layout.allowCellsWrap)),e.minWidth||(e.minWidth=30),e.width||(e.width=null),e.autoGenerated||e.width&&"number"==typeof e.width))if(e.grid&&e.grid.layout.columnWidth)e.width=e.grid.layout.columnWidth;else if(e.grid&&e.grid.layout.autoSizeNewColumn&&!e._autoSizeWidth){const t=e._autoSize();e.width=Math.max(e.grid.layout.autoSizeNewColumnMinWidth,t),e._autoSizeWidth=e.width}else e.width&&"string"==typeof e.width&&(isNaN(parseInt(e.width))||-1===e.width.indexOf("%")&&(e.width=parseInt(e.width)));if(void 0===e.visible&&(e.visible=!0),void 0===e.allowResize&&(e.allowResize=!0),void 0===e.allowFreeze&&(e.allowFreeze=!0),void 0===e.allowReorder&&(e.allowReorder=!0),void 0===e.allowHide&&(e.allowHide=!0),void 0===e.allowDelete&&(e.allowDelete=!0),void 0===e.allowSort&&(e.allowSort=!0),void 0===e.allowSelect&&(e.allowSelect=!0),void 0===e.allowSortToggleOnClick&&(e.allowSortToggleOnClick=!0),void 0===e.allowGroup&&(e.allowGroup=!0),void 0===e.allowFilter&&(e.allowFilter=!0),void 0===e.allowEdit&&(e.allowEdit=!0),void 0===e.allowTypeChange&&(e.allowTypeChange=!0),void 0===e.allowSummary&&(e.allowSummary=!0),void 0===e.allowHeaderEdit&&(e.allowHeaderEdit=!0),void 0===e.allowExport&&(e.allowExport=!0),void 0===e.allowCollapse&&(e.allowCollapse=!0),void 0===e.collapsed&&(e.collapsed=!1),void 0===e.description&&(e.description=""),void 0===e.group&&(e.group=!1),e.summary||(e.summary=[]),"false"===e.freeze&&(e.freeze=!1),"true"===e.freeze&&(e.freeze=!0),!1===e.allowFreeze&&(e.freeze=!1),void 0===e.defaultValue&&(e.defaultValue=null),e.disabledDialogOptions||(e.disabledDialogOptions=[]),e.formatSettings||(e.formatSettings={decimalPlaces:null,decimalSeparator:null,negativeWithBrackets:null,prefix:null,sufix:null,thousandsSeparator:null,dateFormat:"d"}),this.validationRules||(this.validationRules=[]),e.selected=!1,e.sorted=!1,e.filtered=!1,e.filter&&(e.filtered=!0),e.parent=null,e.children=[],e.templateSettings||(e.templateSettings={}),e.dataSet||(e.dataSet={}),e.grid&&e.formula){let t=e.formula;for(let o=0;o<e.grid.columns.length;o++){const l=e.grid.columns[o];-1===t.indexOf("COL("+l.dataField+")")&&-1===t.indexOf("COL("+l.label+")")&&(t.indexOf(l.label)>=0?(t=t.replaceAll(l.label,"COL("+l.dataField+")"),e.formula=t):t.indexOf(l.dataField)>=0&&(t=t.replaceAll(l.dataField,"COL("+l.dataField+")"),e.formula=t))}}if(!e.placeholder&&e.grid&&e.grid.appearance.allowColumnAutoPlaceholder&&("string"===e.dataType||"text"===e.dataType?e.placeholder=e.label:"number"===e.dataType||"int"===e.dataType||"float"===e.dataType?e.placeholder="##":"date"===e.dataType&&(e.placeholder=e.cellsFormat||"m/d/yyyy"),e._state.placeholder=e.placeholder),"createdTime"===e.template||"updatedTime"===e.template||"createdBy"===e.template||"updatedBy"===e.template){const t=[];t.createdTime="createdDate",t.updatedTime="updatedDate",t.createdDate="createdDate",t.updatedDate="updatedDate",t.createdBy="createdBy",t.updatedBy="updatedBy",e.sortComparator=function(o,l,n,i){if(e.grid){const o=e.grid.rowById[n.$.id],l=e.grid.rowById[i.$.id],a=t[e.template];if("createdDate"===a){if(o.history[0].date<l.history[0].date)return-1;if(o.history[0].date>l.history[0].date)return 1}if("updatedDate"===a){if(o.history[o.history.length-1].date<l.history[l.history.length-1].date)return-1;if(o.history[o.history.length-1].date>l.history[l.history.length-1].date)return 1}}return 0}}}refresh(){const t=this;t.element&&t.element._refresh()}render(){const t=this;t.element.column=t,t.element&&t.element._render()}get stateProps(){return["allowExport","allowCollapse","allowFreeze","allowNull","allowGroup","allowSelect","verticalAlign","columnGroup","cellsVerticalAlign","autoCloseMenu","autoShowActionButton","autoShowSortButton","autoShowFilterButton","allowLabelAnimation","allowActionButtonAnimation","allowSortButtonAnimation","allowHide","allowDelete","allowEdit","allowSummary","allowHeaderEdit","allowFilter","allowSort","allowSortToggleOnClick","allowResize","allowReorder","description","icon","menuItems","summary","cellsFormat","className","formula","AIQuery","rowSpan","cellsClassName","cellsCSSRules","cellsCSSInlineRules","templateSettings","formatSettings","formatFunction","cellsRenderer","index","sortIndex","sortOrder","sortComparator","sorted","groups","group","filtered","filterEditor","filter","filterMenuMode","defaultValue","dataField","displayField","label","labelTemplate","headerTemplate","dataType","align","cellsWrap","cellsAlign","minWidth","width","visible","_visible","freeze","showActionButton","selected","showIcon","highlight","showDescriptionButton","treeColumn","statusColumn","value","thHierarchy","dataSet","valueField","onAction","title","tooltip","tooltipRenderer","showCustomButton","showFilterButton","computedFields","showSortButton","editor","template","visibleIndex","validationRules","relationId","relationField","relationCascadingFields","parentDataField","cascadingDataField","allowItemsAdd","dots","placeholder"]}setState(t){const e=this;if(!t)return;if(e._state={},!t.dataField)return;if(t.dataField.startsWith("_"))return{};const o=e.stateProps;for(let l in t)if(!l.startsWith("_")&&o.indexOf(l)>=0)if("editor"===l){e._state[l]={};for(let t in e[l])"row"!==t&&"column"!==t&&"cell"!==t&&"columns"!==t&&"column"!==t&&"instance"!==t&&"element"!==t&&(e._state[l][t]=e[l][t])}else"groups"===l?e[l]&&e[l].length>0&&(e._state[l]=e[l]):e._state[l]=e[l]}getState(){const t=this;if(t.dataField.startsWith("_"))return{};if(t._state){t._state._visible=t._visible,t._state._dataField=t._dataField,t._state.editor={};for(let e in t.editor)"row"!==e&&"column"!==e&&"cell"!==e&&"instance"!==e&&"columns"!==e&&"element"!==e&&(t._state.editor[e]=t.editor[e])}if(!t._state){t._state={label:t.label,dataField:t.dataField,dataType:t.dataType,_visible:t._visible};const e=t.stateProps;for(let o in t)if(!o.startsWith("_")&&e.indexOf(o)>=0)if("editor"===o){t._state[o]={};for(let e in t[o])"row"!==e&&"column"!==e&&"cell"!==e&&"instance"!==e&&"columns"!==e&&"element"!==e&&(t._state[o][e]=t[o][e])}else"groups"===o?t[o]&&t[o].length>0&&(t._state[o]=t[o]):"filter"===o?t[o]&&"string"!=typeof t[o]&&(t._state[o]=t[o].toString()):t._state[o]=t[o]}return t._state}setProperty(t,e,o=!0){const l=this,n=l.getProperty(t);n!==e&&(l.canNotify=!1,l[t]=e,o&&(l.propertyChanged(t,n,e),l.grid&&l.grid.onColumnChange&&l.stateProps.indexOf(t)>=0&&l.grid.onColumnChange(l,t,n,e)),l.canNotify=!0)}getProperty(t){const e=this;if("selected"===t){let o=!1;return e.grid&&(e.grid._selection.cells["column"+e.dataField]&&(o=null),e.grid&&e.grid._selection.columns[e.dataField]&&(o=!0),e.grid.columns.canNotify=!1,e[t]!==o&&(e[t]=o),e.grid.columns.canNotify=!0),o}return"group"===t?!(!e.dataSource||!e.dataSource.groupBy)&&e.dataSource.groupBy.indexOf(e.dataField)>=0:e[t]}get properties(){return["allowExport","allowCollapse","dataSet","options","allowTypeChange","allowFreeze","allowNull","allowGroup","allowSelect","verticalAlign","columnGroup","cellsVerticalAlign","autoCloseMenu","autoShowActionButton","autoShowSortButton","autoShowFilterButton","allowLabelAnimation","allowActionButtonAnimation","allowSortButtonAnimation","allowHide","allowDelete","allowEdit","allowSummary","allowHeaderEdit","allowFilter","allowSort","allowSortToggleOnClick","allowResize","allowReorder","canNotify","data","disabledDialogOptions","description","grid","icon","menuItems","menu","summary","cellsFormat","className","cellsClassName","cellsCSSRules","cellsCSSInlineRules","templateSettings","formatSettings","formatFunction","cellsRenderer","index","sortIndex","sortOrder","sortComparator","sorted","groups","element","level","group","filtered","filterEditor","filter","filterMenuMode","defaultValue","dataField","displayField","label","labelTemplate","headerTemplate","dataType","align","cellsWrap","cellsAlign","minWidth","width","formula","AIQuery","visible","_visible","freeze","showActionButton","selected","showIcon","highlight","rowSpan","showDescriptionButton","statusColumn","treeColumn","computedWidth","computedHeight","overflowWidth","parent","showCardLabel","cardSpan","tooltip","tooltipRenderer","cardHeight","relationId","relationField","relationCascadingFields","getFilterPanel","getCellValue","updateFilterPanel","children","value","thHierarchy","valueField","onAction","left","top","title","showCustomButton","showFilterButton","showSortButton","editor","template","visibleIndex","validationRules","parentDataField","cascadingDataField","computedFields","allowItemsAdd","dots","placeholder","detailColumns","collapsed"]}propertyChanged(t,e,o){const l=this;if(l.data&&void 0!==l.data[t]&&(l.data[t]=o),l._state||(l._state={label:l.label,dataField:l.dataField,dataType:l.dataType,_visible:l._visible}),l._state&&o!==e&&l.dataField&&!l.dataField.startsWith("_"))if("editor"===t){l._state[t]={};for(let e in o)"row"!==e&&"column"!==e&&"cell"!==e&&"instance"!==e&&"element"!==e&&(l._state[t][e]=o[e])}else"filter"===t?l[t]&&"string"!=typeof o?l._state[t]=o.toString():l._state[t]=o:"sortOrder"===t?("asc"!==o&&"desc"!==o&&null!==o&&"ascending"!==o&&"descending"!==o&&(o=null),l.stateProps.indexOf(t)>=0&&(l._state[t]=o)):l.stateProps.indexOf(t)>=0&&(l._state[t]=o);if("formula"!==t)if("highlight"!==t)if("className"!==t)if("editor"!==t)if("allowSort"!==t&&"allowFilter"!==t)if("showIcon"!==t){if("visible"===t){const t=l.grid.grouping.enabled;return l.grid.refresh(t),void(t&&l.grid._filters&&l.grid.refreshFilters(t))}if("showCustomButton"===t&&(o?l.element._showCustomButton():l.element._hideCustomButton()),"showDescriptionButton"===t)return o?l.element._showDescriptionButton():l.element._hideDescriptionButton(),void l.refresh();if("description"!==t){if("filter"===t&&(l.filter?l.filter&&Array.isArray(l.filter)&&0===l.filter.length?(l.filter=null,l.filtered=!1,l.grid.removeFilter(l.dataField)):(l.grid.addFilter(l.dataField,l.filter),l.filtered=!0):(l.grid.removeFilter(l.dataField),l.filtered=!1),(l.autoShowFilterButton||l.showFilterButton)&&(o?l.element._showFilterButton():l.element._hideFilterButton()),l.grid.autoSaveState()),"sortIndex"===t)return-1===l.sortIndex&&(l.sortIndex=null),"many"===l.grid.sorting.mode&&l.grid.context===document&&l.grid.sortBy(l.dataField,l.sortOrder),null!==l.sortIndex&&-1!==l.sortIndex?l.element.setAttribute("sort-index",l.sortIndex):l.element.removeAttribute("sort-index"),void l.element._updateSortOrder();if("selected"===t){if(!1===l.allowSelect)return;l.selectionColumn&&l.refresh(),o?l.grid._selection.columns[l.dataField]||(l.grid._selection.columns[l.dataField]=!0):!1===o&&l.grid._selection.columns[l.dataField]&&delete l.grid._selection.columns[l.dataField],l.grid._recycle(!1)}if("formatSettings"===t&&l.grid._recycle(!1),"sortOrder"===t)return l.sorted=!1,null===o?l.element._hideSortButton():(l.element._showSortButton(),l.sorted=!0),"asc"!==l.sortOrder&&"desc"!==l.sortOrder&&null!==l.sortOrder&&"ascending"!==l.sortOrder&&"descending"!==l.sortOrder&&(l.sortOrder=null),l.grid.context===document&&l.grid.sortBy(l.dataField,l.sortOrder),void(l.sorted?l.element.setAttribute("aria-sort","asc"===l.sortOrder?"ascending":"descenting"):(l.element.removeAttribute("aria-sort"),l.element.removeAttribute("sort-index")));if("group"!==t){if("showActionButton"===t&&(l.element.allowAnimations=!1,o?l.element._showActionButton():l.element._hideActionButton(),l.element.allowAnimations=!0),"autoShowActionButton"===t&&(l.element.allowAnimations=!1,o?l.element._hideActionButton():l.element._showActionButton(),l.element.allowAnimations=!0),"showFilterButton"===t&&(l.element.allowAnimations=!1,void 0===l._autoShowFilterButton&&(l._autoShowFilterButton=l.autoShowFilterButton),o?(l.autoShowFilterButton=!1,l.element._showFilterButton()):(l.element._hideFilterButton(),l.autoShowFilterButton=l._autoShowFilterButton),l.element.allowAnimations=!0),"showSortButton"===t&&(l.element.allowAnimations=!1,void 0===l._autoShowSortButton&&(l._autoShowSortButton=l.autoShowSortButton),o?(l.autoShowSortButton=!1,l.element._showSortButton()):(l.element._hideSortButton(),l.autoShowSortButton=l._autoShowSortButton),l.element.allowAnimations=!0),"autoShowSortButton"===t&&(l.element.allowAnimations=!1,l._autoShowSortButton=l.autoShowSortButton,o?l.element._hideSortButton():l.element._showSortButton(),l.element.allowAnimations=!0),"menu"===t&&(o?l.element.setAttribute("aria-controls",l.menu.id):(l.element.removeAttribute("aria-controls"),l.autoShowActionButton&&l.element._hideActionButton())),"cellsFormat"!==t&&"formatSettings"!==t&&"dataField"!==t&&"displayField"!==t&&"template"!==t||l.grid._recycle(),"label"!==t&&"labelTemplate"!==t&&"width"!==t&&"minWidth"!==t||l.grid.refresh(),"freeze"===t){if(!l.allowFreeze)return;const t=l.grid,e=()=>{const e=t.context;t.context=t,t._renderColumns(),!1===o&&t._initializeRowElements(),t.refresh(),t.context=e};if(t.columnGroups&&t.columnGroups.length>0&&l.columnGroup)return void e();e()}}else l.grid.context===document&&(o?l.grid.addGroup(l.dataField):l.grid.removeGroup(l.dataField))}else l.refresh()}else l.refresh();else l.refresh();else l._editorId="_"+Math.floor(65536*(1+Math.random())).toString(16).substring(1);else l.refresh();else this.refresh();else l.grid&&l.grid._initFormulaParser()}_measureSize(t){const e=this.grid,o=function(){const o=[],l=document.createElement("div"),n=document.createElement("div"),i=Array.isArray(t)?t:[t];n.classList.add("smart-label"),l.appendChild(n),l.style.width="auto",l.style.position="static",e.$.columnHeader.appendChild(l);for(let t=0;t<i.length;t++){n.innerHTML="<span>"+i[t]+"</span>";const e=20+n.firstChild.offsetWidth,l=Math.max(30,e);o.push(l)}return e.$.columnHeader.removeChild(l),o}();return 1===o.length?o[0]:o}_autoSize(t){const e=this,o=e.grid;let l=e.label.toString();if(!t){const t=o.isInitialized?o._recyclingRows:[];for(let o=0;o<t.length;o++){const n=t[o],i=""+n.data[e.dataField];if("image"===e.template)break;i&&i.length>l.length&&(l=i),"date"===e.dataType&&i&&e.cellsFormat&&n.data[e.dataField]&&(l=new Smart.Utilities.DateTime(n.data[e.dataField]).toString(e.cellsFormat))}}const n=e._measureSize(l);return e.showIcon?n+20:n}autoSize(t){const e=this._autoSize(t);this.width=e}createElement(){const t=this,e=document.createElement("smart-grid-column");return e._initialize(t),e.setAttribute("role","columnheader"),e.setAttribute("aria-haspopup",""),t.element=e,t.grid.notify((function(e,o,l){switch(e){case"appearance_allowColumnLabelAnimation":t.setProperty("allowLabelAnimation",l);break;case"appearance_allowColumnSortAnimation":t.setProperty("allowSortAnimation",l);break;case"appearance_allowColumnSortButtonAnimation":t.setProperty("allowSortButtonAnimation",l);break;case"appearance_allowColumnActionButtonAnimation":t.setProperty("allowActionButtonAnimation",l);break;case"appearance_allowColumnFilterButtonAnimation":t.setProperty("allowFilterButtonAnimation",l);break;case"appearance_autoShowColumnActionButton":t.setProperty("autoShowActionButton",l);break;case"appearance_autoShowColumnSortButton":t.setProperty("autoShowSortButton",l);break;case"appearance_autoShowColumnFilterButton":t.setProperty("autoShowFilterButton",l);break;case"appearance_showColumnActionButton":t.setProperty("showActionButton",l);break;case"appearance_showColumnFilterButton":t.setProperty("showFilterButton",l);break;case"appearance_showColumnCustomButton":t.setProperty("showCustomButton",l);break;case"appearance_showColumnDescriptionButton":t.setProperty("showDescriptionButton",l);break;case"appearance_showColumnSortButton":t.setProperty("showSortButton",l);break;case"appearance_showFrozenColumnBackground":case"appearance_showSortColumnBackground":case"appearance_showFilterColumnBackground":t.grid._recycle(!1)}})),e}}),Smart("smart-grid-column",class extends Smart.BaseElement{_showSortButton(t){const e=this;e.column&&(e.column.autoGenerated||(e.sortButton.classList.remove("asc"),e.sortButton.classList.remove("desc"),e.column&&e.column.grid&&!1===e.column.grid.sorting.maintainSort?e.sortButton.removeAttribute("order"):(e.column.autoShowSortButton||e.column.allowSort&&e.sortButton.classList.add("smart-icon-sort","smart-grid-icon"),"asc"===e.column.sortOrder?e.sortButton.classList.add("asc"):"desc"===e.column.sortOrder&&e.sortButton.classList.add("desc"),e.column.showSortButton&&(e.sortButton.classList.add("show"),!1!==t&&e._refresh()),null!==e.column.sortIndex?e.sortButton.setAttribute("order",1+e.column.sortIndex):e.sortButton.removeAttribute("order"))))}_updateSortOrder(){const t=this;if(!t.column)return t.removeAttribute("sort-index"),void t.sortButton.removeAttribute("order");null!==t.column.sortIndex?(t.setAttribute("sort-index",t.column.sortIndex),t.sortButton.setAttribute("order",1+t.column.sortIndex)):(t.removeAttribute("sort-index"),t.sortButton.removeAttribute("order"))}_hideSortButton(t){const e=this;e.column&&(e.sortButton.classList.remove("asc"),e.sortButton.classList.remove("desc"),e.sortButton.removeAttribute("order"),e.column.showSortButton&&!e.column.autoShowSortButton||(e.sortButton.classList.remove("show"),e.sortButton.classList.remove("smart-icon-sort"),!1!==t&&e._refresh()))}_showFilterButton(t){const e=this;e.column&&!e.column.autoGenerated&&(e.filterButton.classList.add("show"),e._isInitialized&&!1!==t&&e._refresh())}_hideFilterButton(t){const e=this;e.column&&(e.filterButton.classList.remove("show"),e._isInitialized&&!1!==t&&e._refresh())}_showDescriptionButton(){const t=this;t.column&&!t.column.autoGenerated?t.hasAttribute("columnHeader")||(t.column.description?(t.descriptionButton.setAttribute("title",t.column.description),t.descriptionButton.classList.add("show")):t.descriptionButton.classList.remove("show"),t._isInitialized&&t._refresh()):t.descriptionButton.classList.remove("show")}_hideDescriptionButton(){const t=this;t.column&&(t.descriptionButton.classList.remove("show"),t._isInitialized&&t._refresh())}_showIcon(){const t=this;t.column&&!t.column.autoGenerated&&(t.icon.classList.add("show","column-icon"),t.setAttribute("has-icon",""),t._isInitialized&&t._refresh())}_hideIcon(){const t=this;t.icon.classList.remove("show","column-icon"),t.removeAttribute("has-icon"),t._refresh()}_showCustomButton(){const t=this;t.column&&!t.column.autoGenerated&&(t.customButton.classList.add("show"),t._refresh())}_hideCustomButton(){const t=this;t.column&&(t.customButton.classList.remove("show"),t._refresh())}_showActionButton(){const t=this;t.column&&t.column.showActionButton&&t.column.grid.hasColumnMenu(t.column)&&!t.column.autoGenerated&&t.actionButton&&(t.actionButton.classList.add("show"),t._refresh())}_hideActionButton(){const t=this;t.column&&t.column.showActionButton&&t.actionButton&&!t.hasAttribute("aria-controls")&&t.actionButton.classList.contains("show")&&(t.actionButton.classList.remove("show"),t._refresh())}_rotate(){const t=this,e=document.createElement("span");return t.label.innerHTML="",e.innerHTML=t.column.label,t.label.appendChild(e),e.className="rotate",e.style.transform="rotate("+t.column.rotationAngle+"deg)",t.column.grid._recycleRotate(t.label,e,t.column.align,t.column.verticalAlign,t.column.label)}_align(){const t=this;let e=t.column.align;switch(t.column.grid.rightToLeft&&("left"===e?e="right":"right"===e&&(e="left")),e){case"left":t.label.classList.add("align-left");break;case"center":t.label.classList.add("align-center");break;case"right":t.label.classList.add("align-right")}switch(t.column.verticalAlign){case"top":t.label.classList.add("align-top");break;case"middle":t.label.classList.add("align-middle");break;case"bottom":t.label.classList.add("align-bottom")}}_refresh(){const t=this;if(!t.column)return;const e=t.column.grid;if(t.sortButton.classList.remove("filter"),t.sortButton.classList.remove("action"),t.label.className="smart-label",t.label.firstElementChild&&t.column.className&&(t.label.className="smart-label "+t.column.className),t.descriptionButton&&t.descriptionButton.setAttribute("title",t.column.description),!0===t.column.autoGenerated||t.hasAttribute("columnHeader")?t.descriptionButton.classList.remove("show"):t.column.showDescriptionButton&&t.column.description?t.descriptionButton.classList.add("show"):t.descriptionButton.classList.remove("show"),t.column.highlight?t.setAttribute("highlight",""):t.removeAttribute("highlight"),t.column.visible&&"_checkBoxColumn"===t.column.dataField){const e=t.column.grid;let o=e.getVisibleRows();e.paging.enabled&&"page"===e.selection.checkBoxes.selectAllMode&&(o=o.slice(e.paging.pageIndex*e.paging.pageSize,(e.paging.pageIndex+1)*e.paging.pageSize));const l=e._getSelectedRows(!0,!1);if(e.selection.checkBoxes.autoShow?t.setAttribute("auto-show",""):t.removeAttribute("auto-show"),e._isVirtualMode()){const o=e.dataSource.virtualDataSourceLength;l>0&&l===o?t.setAttribute("selected",""):l>0&&l<o?t.setAttribute("selected","indeterminate"):0!==l&&0!==o||t.removeAttribute("selected")}else l.length>0&&l.length===o.length?t.setAttribute("selected",""):l.length>0&&l.length<o.length?t.setAttribute("selected","indeterminate"):0!==l.length&&0!==o.length||t.removeAttribute("selected");return t.removeAttribute("checkbox"),t.label.classList.remove("smart-input"),void("none"!==e.selection.checkBoxes.selectAllMode&&(t.setAttribute("checkbox",""),t.label.classList.add("smart-input")))}if("_rowHeaderColumn"===this.column.dataField){const e=t.column.grid;if(e.selection.enabled&&e.selection.allowRowHeaderSelection&&e.appearance.showRowHeaderSelectIcon){let o='<div class="smart-grid-command-item">',l=e.areAllRowsSelected()?"smart-icon-check-squared":"smart-icon-check-empty";e.isEmpty()&&(l=""),o+='<span class="smart-grid-icon '+l+'"></span>',o+="</div>",t.label.style.paddingLeft="0px",t.label.style.paddingRight="0px",t.label.innerHTML=o}}if("_commandColumn"===t.column.dataField){const e=t.column.grid,o="icon"!==e.editing.commandColumn.displayMode,l="label"!==e.editing.commandColumn.displayMode,n=e.editing.commandColumn.dataSource.commandColumnMenu;let i='<div class="smart-grid-command-item">';const a="{{messages}}"===n.label?e.localize("commandColumnMenu"):n.label,r=n.icon;l&&o?(i+='<span class="smart-grid-icon '+r+'"></span>',i+='<span class="smart-grid-label">'+a+"</span>"):l&&!o?i+='<span class="smart-grid-icon '+r+'"></span>':o&&!l&&(i+='<span class="smart-grid-label">'+a+"</span>"),i+="</div>",n.visible&&(t.label.innerHTML=i)}const o=t.column.getProperty("selected");if(!1===o&&t.hasAttribute("selected")?t.removeAttribute("selected"):!0===o?t.setAttribute("selected",""):null===o&&t.setAttribute("selected","indeterminate"),t.column.allowSortButtonAnimation?t.sortButton.classList.add("smart-animate"):t.sortButton.classList.remove("smart-animate"),e.dragDrop&&e.dragDrop.column===t.column?t.classList.add("dragged"):t.classList.remove("dragged"),t.column.sorted?t._showSortButton(!1):t._hideSortButton(!1),t.column.sorted?(t.setAttribute("aria-sort","asc"===t.column.sortOrder?"ascending":"descenting"),t._updateSortOrder()):(t.removeAttribute("aria-sort"),t.removeAttribute("sort-index")),(t.column.autoShowFilterButton||t.column.showFilterButton)&&(t.column.filtered?t._showFilterButton(!1):t._hideFilterButton(!1)),t.column.allowFilterButtonAnimation?t.filterButton.classList.add("smart-animate"):t.filterButton.classList.remove("smart-animate"),t.column.allowActionButtonAnimation&&!1!==t.allowAnimations?t.buttonsGroup.classList.add("smart-animate"):t.buttonsGroup.classList.remove("smart-animate"),t.column.allowLabelAnimation&&!1!==t.allowAnimations?t.label.classList.add("smart-animate"):t.label.classList.remove("smart-animate"),t.buttonsGroup.classList.remove("action"),t.actionButton.classList.contains("show")&&t.buttonsGroup.classList.add("action"),t.column.showIcon?(t.icon.classList.add("show","column-icon"),t.setAttribute("has-icon","")):(t.icon.classList.remove("show","column-icon"),t.removeAttribute("has-icon","")),t.icon.classList.contains("show"))if(t.icon.className="smart-grid-icon show column-icon",t.column.icon&&t.column.icon.indexOf(" ")>=0){const e=t.column.icon.trim().split(" ");for(let o=0;o<e.length;o++)t.icon.classList.add(e[o])}else t.icon.classList.add(t.column.icon);let l=t.column.showIcon?1:0;for(let e=0;e<t.buttonsGroup.children.length;e++)t.buttonsGroup.children[e].classList.contains("show")&&l++;switch(l){case 1:t.label.classList.add("one");break;case 2:t.label.classList.add("two");break;case 3:t.label.classList.add("three");break;case 4:t.label.classList.add("four");break;case 5:t.label.classList.add("five");break;case 6:t.label.classList.add("six")}t.classList.remove("smart-visibility-hidden"),t.column.grid._columnGap>0?t.classList.add("smart-grid-column-border"):t.classList.remove("smart-grid-column-border"),t.column.grid.appearance.showColumnHeaderLines?t.classList.remove("smart-grid-vertical-border-collapse"):t.classList.add("smart-grid-vertical-border-collapse"),(!t.column.rotationAngle||t._rotate())&&t._align()}_renderTemplate(){const t=this,e=t.column,o=e.labelTemplate;let l="";if("function"!=typeof o){if(o instanceof HTMLTemplateElement)l=o;else{if("string"!=typeof o||!o.startsWith||!o.startsWith("#"))return void(t.label.innerHTML=o);l=document.querySelector(o)}if(l){let o=l.content.cloneNode(!0).firstElementChild,n=e.label;n=n.toString(),n=n.replace(/'/gi,"\\'"),n=n.replace(/"/gi,'\\"');const i=o.outerHTML.replace(/{{value}}/gi,n).replace(/{{id}}/gi,e.label);t.label.innerHTML=i}}else t.label.innerHTML=o(e.label)}_render(){const t=this,e=t.column.dataField?t.column.dataField:"",o=t.column===t.column.grid._lastVisibleColumn;if(t.column.labelTemplate?t._renderTemplate():t.label.firstChild?t.label.firstChild.textContent!==t.column.label&&(t.column.label.indexOf("&")>=0||"SPAN"!==t.label.firstChild.nodeName?t.label.innerHTML="<span>"+t.column.label+"</span>":t.label.firstChild.textContent=t.column.label):t.label.innerHTML="<span>"+t.column.label+"</span>",t.column.title?t.setAttribute("title",t.column.title):t.removeAttribute("title"),t.column.tooltip&&(t.onmouseenter=e=>{t.column.tooltip&&t.column.grid._createTooltip(e,t.column.tooltip,t,"top")},t.onmouseleave=()=>{t.column.grid._cellTooltip&&(t.column.grid._cellTooltip.style.visibility="hidden")}),t._refresh(),t.column.autoGenerated&&t.setAttribute("auto-generated",""),t.column.autoGenerated||o){if(t.style.width=t.column.computedWidth+"px",t.column.grid.appearance.showRowComments&&t.column.rowHeaderColumn){const e=t.column.grid.rowDetailColumn,o=e?e.width:0;t.style.width=t.column.computedWidth+o+"px",t.style.zIndex=5}}else t.style.width=t.column.computedWidth-t.column.grid._columnGap+"px";if(t.style.height!==t.column.computedHeight+"px"&&(t.style.height=t.column.computedHeight+"px"),t.style.lineHeight!==t.column.computedHeight+"px"&&(t.style.lineHeight=t.column.computedHeight+"px"),t.column.grid.rightToLeft?t.style.right!==t.column.left+"px"&&(t.style.right=t.column.left+"px"):t.style.left!==t.column.left+"px"&&(t.style.left=t.column.left+"px"),t.style.top!==t.column.top+"px"&&(t.style.top=t.column.top+"px"),t.getAttribute("data-field")!==e&&t.setAttribute("data-field",e),t.setAttribute("header",""),t.column.freeze&&t.setAttribute("freeze",""),t.column.level>0&&(t.style.top=t.column.top+"px"),t.column.detailColumns&&t.column.detailColumns.length>0){const e=t.column.grid,o=e=>{e.classList.remove("smart-hidden"),t.column.element.label.appendChild(e),t.column.element.label.style.display="flex",t.column.element.label.style.justifyContent="space-between"};if(t.column._collapseButton&&!t.column._collapseButton.parentNode&&delete t.column._collapseButton,t.column._collapseButton)return void o(t.column._collapseButton);const l={},n=[];for(let o=0;o<t.column.detailColumns.length;o++){const l=e.columnByDataField[t.column.detailColumns[o]];l&&n.push(l)}l.inline=!0,l.columns=n,l.collapsed=t.column.collapsed,l.column=t.column,e._initializeColumnGroupCollapsing(l);const i=l.collapseButton;i&&(l.column._collapseButton=i,o(i),e._detailColumns||(e._detailColumns=[]),e._detailColumns[t.column.dataField]=!0)}else{const e=t.column.grid;e._detailColumns&&!e._detailColumns[t.column.dataField]&&t.label.querySelector(".smart-grid-column-group-collapse-button")&&t.label.querySelector(".smart-grid-column-group-collapse-button").remove()}t.column.headerTemplate&&t.column.headerTemplate(t.label)}get hasStyleObserver(){return!1}get enableShadowDOM(){return!1}addThemeClass(){}addDefaultClass(){}get isUtilityElement(){return!0}_initialize(t){const e=this;e._isInitialized=!1;const o=document.createElement("div"),l=document.createElement("div"),n=document.createElement("div"),i=document.createElement("div"),a=document.createElement("div"),r=document.createElement("div"),s=document.createElement("div"),d=document.createElement("div"),c=document.createElement("div");e.column=t,e.classList.add("smart-visibility-hidden"),c.classList.add("smart-drag-handle"),s.classList.add("smart-icon","smart-grid-icon"),o.classList.add("smart-label"),l.classList.add("smart-sort-button","smart-grid-icon"),n.classList.add("smart-filter-button","smart-icon-filter","smart-grid-icon"),i.classList.add("smart-action-button","smart-grid-icon"),i.setAttribute("aria-haspopup",""),a.classList.add("smart-description-button","smart-icon-help-circled","smart-grid-icon"),r.classList.add("smart-custom-button",t.customButtonIcon?t.customButtonIcon:"smart-icon-tools","smart-grid-icon"),d.classList.add("smart-buttons-group"),i.innerHTML="<div></div>",e.style.width=e.column.computedWidth+"px",e.appendChild(c),e.appendChild(s),e.appendChild(o),e.appendChild(d),d.appendChild(l),d.appendChild(n),d.appendChild(a),d.appendChild(r),d.appendChild(i),e.handle=c,e.icon=s,e.label=o,e.sortButton=l,e.filterButton=n,e.actionButton=i,e.descriptionButton=a,e.customButton=r,e.buttonsGroup=d,e._properties=[];const u=window.PointerEvent?"pointerdown":"mousedown",m=window.PointerEvent?"pointerup":"mouseup";e._filterDownEvent=function(t){"col-resize"!==t.target.style.cursor&&(t.preventDefault(),t.stopPropagation(),e.column.onAction&&e.column.onAction(t))}.bind(e),e._filterUpEvent=function(t){t.preventDefault(),t.stopPropagation()},e._actionUpEvent=function(t){t.preventDefault(),t.stopPropagation()},e._actionDownEvent=function(t){t.preventDefault(),t.stopPropagation(),e.column.onAction&&e.column.onAction(t)}.bind(e),e.filterButton.addEventListener(u,e._filterDownEvent),e.filterButton.addEventListener(m,e._filterUpEvent),e.actionButton.addEventListener(m,e._actionUpEvent),e.actionButton.addEventListener(u,e._actionDownEvent),!e.column.autoShowActionButton&&e.column.showActionButton&&e._showActionButton(),!e.column.autoShowSortButton&&e.column.showSortButton&&e._showSortButton(),!e.column.autoShowFilterButton&&e.column.showFilterButton&&e._showFilterButton(),e.column.showDescriptionButton&&e._showDescriptionButton(),e.column.showCustomButton&&e._showCustomButton(),e.column.showIcon&&e._showIcon(),"_rowHeaderColumn"===e.column.dataField&&e.classList.add("top-near-corner"),e.customButton.onclick=function(t){e.column.onCustomButtonClick&&e.column.onCustomButtonClick(t)}.bind(e),e.column.sorted||e.column.sortOrder?(e.column.sorted=!0,e.setAttribute("aria-sort","asc"===e.column.sortOrder?"ascending":"descenting"),e._updateSortOrder()):(e.removeAttribute("aria-sort"),e.removeAttribute("sort-index")),e._properties=[],e._isInitialized=!0}template(){return""}_detach(){const t=this,e=window.PointerEvent?"pointerdown":"mousedown",o=window.PointerEvent?"pointerup":"mouseup";t.filterButton.removeEventListener(e,t._filterDownEven),t.filterButton.removeEventListener(o,t._filterUpEvent),t.actionButton.removeEventListener(o,t._actionUpEvent),t.actionButton.removeEventListener(e,t._actionDownEvent),t.element=null,t.column&&(t.column.grid=null,t.column.element=null),t.icon=null,t.label=null,t.sortButton=null,t.filterButton=null,t.actionButton=null,t.descriptionButton=null,t.customButton=null,t.buttonsGroup=null,t.column=null,delete t.grid,delete t.column,delete t.icon,delete t.label,delete t.sortButton,delete t.filterButton,delete t.actionButton,delete t.descriptionButton,delete t.customButton,delete t.buttonsGroup}onDetached(){this._detach()}});
1443
1443
 
1444
1444
  /***/ }),
1445
1445
 
1446
1446
  /***/ 5306:
1447
1447
  /***/ (() => {
1448
1448
 
1449
- Smart("smart-grid",class extends Smart.ScrollViewer{static get properties(){return{ai:{type:"any",reflectToAttribute:!1,value:{model:{value:"gpt-4.1",type:"string"},maxTokens:{value:200,type:"number"},temperature:{value:.7,type:"number"},url:{value:"https://api.openai.com/v1/chat/completions",type:"string"},key:{value:"",type:"string",reflectToAttribute:!1},maxResponseLength:{value:100,type:"number"},promptVariables:{value:null,type:"any",reflectToAttribute:!1},prompts:{value:null,type:"any",reflectToAttribute:!1},includeUserPrompts:{value:!0,type:"boolean"}}},appearance:{value:{alternationStart:{value:0,type:"int"},alternationEnd:{value:0,type:"int"},alternationCount:{value:0,type:"int"},allowHover:{value:!1,type:"boolean",defaultReflectToAttribute:!0},allowHeaderHover:{value:!0,type:"boolean",defaultReflectToAttribute:!0},allowRowToggleAnimation:{value:!1,type:"boolean"},allowRowDetailToggleAnimation:{value:!1,type:"boolean"},allowSortAnimation:{value:!1,type:"boolean"},allowColumnLabelAnimation:{value:!0,type:"boolean"},allowCheckBoxesSelectionAnimation:{value:!0,type:"boolean"},allowColumnMenuAnimation:{value:!0,type:"boolean"},allowColumnSortButtonAnimation:{value:!0,type:"boolean"},allowColumnActionButtonAnimation:{value:!0,type:"boolean"},allowColumnFilterButtonAnimation:{value:!0,type:"boolean"},allowColumnAutoPlaceholder:{value:!1,type:"boolean"},allowColumnStickyPosition:{value:!1,type:"boolean"},autoShowColumnSortButton:{value:!0,type:"boolean"},autoShowColumnActionButton:{value:!0,type:"boolean"},autoGenerateRowLabelMode:{value:"number",type:"string"},autoGenerateColumnLabelMode:{value:"letter",type:"string"},autoShowColumnFilterButton:{value:!0,type:"boolean"},cardTitleField:{value:"",type:"string"},displayLoadingIndicator:{value:!1,type:"boolean"},loadingIndicatorPlaceholder:{value:"Loading...",type:"string"},placeholder:{value:"No Rows",type:"string"},sortAnimationDuration:{value:500,type:"number"},showRowHeader:{value:!1,type:"boolean"},showRowStatus:{value:!1,type:"boolean"},showRowEditDialogDetails:{value:!1,type:"boolean"},showRowComments:{value:!1,type:"boolean"},showRowHeaderNumber:{value:!1,type:"boolean"},showRowHeaderEditIcon:{value:!1,type:"boolean",defaultReflectToAttribute:!0},showRowHeaderDragIcon:{value:!1,type:"boolean"},showColumnHeaderDragIcon:{value:!1,type:"boolean"},showRowHeaderSelectIcon:{value:!1,type:"boolean"},showRowHeaderFocusIcon:{value:!1,type:"boolean"},showColumnHeaderLines:{value:!0,type:"boolean",defaultReflectToAttribute:!0},showColumnGroupLines:{value:!0,type:"boolean",defaultReflectToAttribute:!0},showColumnGroupCellLines:{value:!0,type:"boolean",defaultReflectToAttribute:!0},showColumnLines:{value:!0,type:"boolean",defaultReflectToAttribute:!0},showRowLines:{value:!0,type:"boolean",defaultReflectToAttribute:!0},showFilterColumnBackground:{value:!1,type:"boolean"},showSortColumnBackground:{value:!1,type:"boolean"},showFrozenColumnBackground:{value:!0,type:"boolean"},showFrozenRowBackground:{value:!0,type:"boolean"},showSelectionOnTop:{value:!0,type:"boolean"},showColumnSortButton:{value:!0,type:"boolean"},showColumnFilterButton:{value:!0,type:"boolean"},showColumnDescriptionButton:{value:!1,type:"boolean"},showColumnIcon:{value:!1,type:"boolean"},showColumnCustomButton:{value:!1,type:"boolean"},showColumnActionButton:{value:!0,type:"boolean"},showColumnGroupsInColumnPanel:{value:!1,type:"boolean"},showTooltips:{value:!1,type:"boolean"},showTooltipsOverflow:{value:!0,type:"boolean"},showResizeTooltips:{value:!0,type:"boolean"},showHorizontalScrollBarOnFixedColumns:{value:!1,type:"boolean"},showVerticalScrollBarOnFixedColumns:{value:!1,type:"boolean"},showTreeRowHeader:{value:!1,type:"boolean"},showTodayDateAsString:{value:!0,type:"boolean"},showViewBar:{value:!1,type:"boolean"},showViewBarAsDropdown:{value:!1,type:"boolean"},viewBarAppendTo:{value:null,type:"any"}},type:"object"},behavior:{value:{autoDestroy:{value:!0,type:"boolean"},allowColumnAutoSizeOnDoubleClick:{value:!0,type:"boolean"},allowRowAutoSizeOnDoubleClick:{value:!0,type:"boolean"},allowColumnReorder:{value:!1,type:"boolean"},allowColumnFreeze:{value:!0,type:"boolean"},allowRowReorder:{value:!1,type:"boolean"},allowMouseWheel:{value:!0,type:"boolean"},allowRenderCache:{value:!0,type:"boolean"},doubleClickTimingDelay:{value:300,type:"number"},columnResizeMode:{value:"none",type:"string",allowedValues:["none","split","growAndShrink"]},rowResizeMode:{value:"none",type:"string",allowedValues:["none","split","growAndShrink"]}},type:"object"},layout:{value:{autoWrap:{value:!0,type:"boolean"},autoWidth:{value:!1,type:"boolean"},autoHeight:{value:!1,type:"boolean"},allowCellsWrap:{value:!1,type:"boolean"},allowCellsWrapShortcut:{value:!0,type:"boolean"},autoGenerateColumnWidth:{value:null,type:"number?"},autoSizeNewColumn:{value:!1,type:"boolean",reflectToAttribute:!1},autoSizeNewColumnMinWidth:{value:180,type:"number",reflectToAttribute:!1},cardMinWidth:{value:250,type:"any",reflectToAttribute:!1},cardRowMinHeight:{value:45,type:"any",reflectToAttribute:!1},cardsPerRow:{value:"auto",type:"any",reflectToAttribute:!1},cardVertical:{value:!0,type:"boolean",reflectToAttribute:!1},columnWidth:{value:null,type:"any",reflectToAttribute:!1},columnHeight:{value:null,type:"any",reflectToAttribute:!1},columnMinHeight:{value:30,type:"any",reflectToAttribute:!1},dropDownWidth:{value:700,type:"any",reflectToAttribute:!1},dropDownHeight:{value:500,type:"any",reflectToAttribute:!1},isDirty:{value:!1,type:"boolean"},loadingIndicatorPosition:{value:"center",allowedValues:["bottom","center","top"],type:"string"},rowMinHeight:{value:30,type:"number"},rowMobileHeight:{value:null,type:"number"},rowHeight:{value:null,type:"any",reflectToAttribute:!1},viewBarWidth:{value:200,type:"number"}},type:"object"},dataExport:{value:{header:{value:!0,type:"boolean"},filterBy:{value:null,type:"object"},groupBy:{value:null,type:"object"},style:{value:null,type:"any"},fileName:{value:"SmartGrid",type:"string?"},pageOrientation:{value:"portrait",type:"string"},expandChar:{value:"+",type:"string"},collapseChar:{value:"-",type:"string"},view:{value:!1,type:"boolean"},viewStart:{value:null,type:"number?"},viewEnd:{value:null,type:"number?"},rowIds:{value:null,type:"array?"},headerContent:{value:null,type:"any",reflectToAttribute:!1},footerContent:{value:null,type:"any",reflectToAttribute:!1},addImageToCell:{value:null,type:"any",reflectToAttribute:!1},setRowHeight:{value:null,type:"any",reflectToAttribute:!1},cellFormatFunction:{value:null,type:"any",reflectToAttribute:!1},autoConvertFormulas:{value:!0,type:"boolean"},freezeHeader:{value:!1,type:"boolean"},onlySelected:{value:!1,type:"boolean"},exportAsTable:{value:!1,type:"boolean"},exportStyles:{value:!0,type:"boolean"},formatData:{value:null,type:"any",reflectToAttribute:!1},getSpreadsheets:{value:null,type:"any",reflectToAttribute:!1}},type:"object"},clipboard:{value:{enabled:{value:!0,type:"boolean"},copyHeadersToClipboard:{value:!1,type:"boolean"},autoFillMode:{value:"copy",allowedValues:["none","copy","fillSeries"],type:"string"},onPasteValue:{value:null,type:"any"}},type:"object"},conditionalFormatting:{value:null,type:"array?",reflectToAttribute:!1},columns:{value:[],type:"any",reflectToAttribute:!1},contextMenu:{value:{selector:{value:"",type:"string"},enabled:{value:!1,type:"boolean"},width:{value:"auto",type:"any"},height:{value:null,type:"any"},customContextMenuItems:{value:null,type:"any"},dataSource:{value:{contextMenuItemChart:{value:{command:{value:"contextMenuItemChartCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:!1,type:"boolean"},icon:{value:"smart-icon-chart",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},contextMenuItemSelectRow:{value:{command:{value:"contextMenuItemSelectRowCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:!1,type:"boolean"},icon:{value:"smart-icon-check-squared",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},contextMenuItemExpand:{value:{command:{value:"contextMenuItemExpandCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:!1,type:"boolean"},icon:{value:"smart-icon-resize-full",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},contextMenuItemInsertRow:{value:{command:{value:"contextMenuItemInsertRowCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:!1,type:"boolean"},icon:{value:"smart-icon-plus",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},contextMenuItemCloneRow:{value:{command:{value:"contextMenuItemCloneRowCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:!1,type:"boolean"},icon:{value:"smart-icon-duplicate",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},contextMenuItemDelete:{value:{command:{value:"contextMenuItemDeleteCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:!1,type:"boolean"},icon:{value:"smart-icon-delete",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},contextMenuItemEdit:{value:{command:{value:"contextMenuItemEditCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:!1,type:"boolean"},icon:{value:"smart-icon-mode-edit",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},contextMenuItemCut:{value:{command:{value:"contextMenuItemCutCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:!1,type:"boolean"},icon:{value:"smart-icon-cut",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},contextMenuItemCopy:{value:{command:{value:"contextMenuItemCopyCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:!1,type:"boolean"},icon:{value:"smart-icon-copy-record",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},contextMenuItemPaste:{value:{command:{value:"contextMenuItemPasteCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:!1,type:"boolean"},icon:{value:"smart-icon-paste",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},contextMenuItemClear:{value:{command:{value:"contextMenuItemClearCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:!1,type:"boolean"},icon:{value:"smart-icon-close",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},contextMenuItemComment:{value:{command:{value:"contextMenuItemAddCommentCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:!1,type:"boolean"},icon:{value:"smart-icon-comment",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},contextMenuItemCustom:{value:{command:{value:null,type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:!1,type:"boolean"},icon:{value:"smart-icon-settings",type:"string"},label:{value:"",type:"string"}},type:"object",reflectToAttribute:!1}},type:"object",reflectToAttribute:!1}},type:"object",reflectToAttribute:!1},columnMenu:{value:{autoClose:{value:!0,type:"boolean"},dataSource:{value:{columnMenuCustomizeType:{value:{command:{value:"customizeTypeCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:!1,type:"any"},icon:{value:"smart-icon-settings",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},columnMenuItemClone:{value:{command:{value:"duplicateCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:!1,type:"any"},icon:{value:"smart-icon-duplicate",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},columnMenuItemInsert:{value:{command:{value:"insertRightCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:!1,type:"any"},icon:{value:"smart-icon-plus",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},columnMenuItemSortAsc:{value:{command:{value:"sortAscCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:"auto",type:"any"},icon:{value:"smart-icon-sort-name-up",type:"string"},iconAlt:{value:"smart-icon-sort-number-up",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},columnMenuItemSortDesc:{value:{command:{value:"sortDescCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:"auto",type:"any"},icon:{value:"smart-icon-sort-name-down",type:"string"},iconAlt:{value:"smart-icon-sort-number-down",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},columnMenuItemRemoveSort:{value:{command:{value:"removeSortCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:"auto",type:"any"},icon:{value:"smart-icon-cancel-circled",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},columnMenuItemSort:{value:{command:{value:"addSortCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:"auto",type:"any"},icon:{value:"smart-icon-sort",type:"string"},iconAlt:{value:"smart-icon-sort",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},columnMenuItemFilter:{value:{command:{value:"addFilterCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:"auto",type:"any"},icon:{value:"smart-icon-add-filter",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},columnMenuItemRemoveFilter:{value:{command:{value:"removeFilterCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:"auto",type:"any"},icon:{value:"smart-icon-cancel-circled",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},columnMenuItemGroupBy:{value:{command:{value:"groupByCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:"auto",type:"any"},icon:{value:"smart-icon-group",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},columnMenuItemRemoveGroupBy:{value:{command:{value:"removeGroupByCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:"auto",type:"any"},icon:{value:"smart-icon-ungroup",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},columnMenuItemHide:{value:{command:{value:"hideColumnCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:!1,type:"any"},icon:{value:"smart-icon-visibility-off",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},columnMenuItemDelete:{value:{command:{value:"deleteColumnCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:!1,type:"any"},icon:{value:"smart-icon-delete",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1}},type:"object",reflectToAttribute:!1},visible:{value:!1,type:"boolean"},enabled:{value:!0,type:"boolean"},width:{value:250,type:"number"},height:{value:null,type:"number?"}},type:"object",reflectToAttribute:!1},columnGroups:{value:[],type:"array",reflectToAttribute:!1},charting:{value:{appendTo:{value:null,type:"any"},enabled:{value:!1,type:"boolean"},colorScheme:{value:"scheme01",type:"string"},dialog:{value:{header:{value:"{{message}}",type:"string"},height:{value:500,type:"any"},width:{value:800,type:"any"},left:{value:"center",type:"any"},top:{value:"center",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:!1,type:"boolean"}},type:"object"},formatSettings:{value:{},type:"object"}},type:"object"},view:{value:"grid",allowedValues:["grid","kanban","card","scheduler","timeline"],type:"string"},currentUser:{value:null,type:"any",reflectToAttribute:!1},dropDownMode:{value:!1,type:"boolean",reflectToAttribute:!1},dropDownModeInput:{value:!1,type:"boolean",reflectToAttribute:!1},dropDownModeDataField:{value:"",type:"string",reflectToAttribute:!1},dataSource:{value:null,type:"any",reflectToAttribute:!1},dataSourceMap:{value:{checklist:"checklist",color:"color",comments:"comments",dueDate:"dueDate",id:"id",priority:"priority",progress:"progress",startDate:"startDate",status:"status",swimlane:"swimlane",tags:"tags",text:"text",description:"description",userId:"userId",history:"history",createdUserId:"createdUserId",createdDate:"createdDate",updatedUserId:"updatedUserId",updatedDate:"updatedDate"},type:"any",reflectToAttribute:!1},dataSourceSettings:{value:{autoGenerateColumns:{value:!1,type:"boolean"},sanitizeHTML:{value:"blackList",allowedValues:["all","blackList","none"],type:"string"},root:{value:"",type:"string"},record:{value:"",type:"string"},keyDataField:{value:"",type:"string"},parentDataField:{value:"",type:"string"},childrenDataField:{value:"",type:"string"},groupBy:{value:[],type:"array"},dataFields:{value:[],type:"array"},mapChar:{value:".",type:"string"},id:{value:"",type:"string"},relations:{value:[],type:"any",reflectToAttribute:!1},virtualDataSource:{value:null,type:"any"},virtualDataSourceOnExpand:{value:null,type:"any"}},type:"object"},formulas:{value:!1,type:"boolean"},highlighted:{value:-1,type:"any"},uploadSettings:{value:{url:{value:"",type:"string",reflectToAttribute:!1},removeUrl:{value:"",type:"string",reflectToAttribute:!1},existsUrl:{value:"",type:"string",reflectToAttribute:!1},name:{value:"userfile[]",type:"string",reflectToAttribute:!1},uploadMaxCount:{value:5,type:"number",reflectToAttribute:!1},uploadMaxSize:{value:2097152,type:"number",reflectToAttribute:!1},data:{value:null,type:"object",reflectToAttribute:!1},onUploadStarted:{value:null,type:"any",reflectToAttribute:!1},onUploadCompleted:{value:null,type:"any",reflectToAttribute:!1},onUploadRemove:{value:null,type:"any",reflectToAttribute:!1},onUploadError:{value:null,type:"any",reflectToAttribute:!1},onChange:{value:null,type:"any",reflectToAttribute:!1},onProgress:{value:null,type:"any",reflectToAttribute:!1},onAbort:{value:null,type:"any",reflectToAttribute:!1},onError:{value:null,type:"any",reflectToAttribute:!1},onSetHeaders:{value:null,type:"any",reflectToAttribute:!1},singleFilePost:{value:!0,type:"boolean",reflectToAttribute:!1},userFiles:{value:[],type:"array",reflectToAttribute:!1}},reflectToAttribute:!1,type:"object"},grouping:{value:{enabled:{value:!1,type:"boolean",reflectToAttribute:!1},allowCollapse:{value:!1,type:"boolean",reflectToAttribute:!1},autoHideGroupColumn:{value:!1,type:"boolean",reflectToAttribute:!1},autoExpandAll:{value:!1,type:"boolean",reflectToAttribute:!1},autoExpandToLevel:{value:0,type:"number",reflectToAttribute:!1},onGroupDefaultExpanded:{value:null,type:"any",reflectToAttribute:!1},expandMode:{value:"buttonClick",type:"string",allowedValues:["buttonClick","rowClick"],reflectToAttribute:!1},renderMode:{type:"string",value:"advanced",allowedValues:["basic","compact","advanced","multipleColumns"]},groupBy:{value:[],type:"array",reflectToAttribute:!1},groupRowHeight:{value:50,type:"any",reflectToAttribute:!1},toggleButtonIndent:{value:27,type:"number",reflectToAttribute:!1},groupIndent:{value:27,type:"number",reflectToAttribute:!1},groupBar:{value:{visible:{value:!1,type:"boolean",reflectToAttribute:!1},allowColumnDragDrop:{value:!0,type:"boolean",reflectToAttribute:!0},allowColumnCloseButtons:{value:!0,type:"boolean",reflectToAttribute:!0}},type:"object"},formatFunction:{value:null,type:"any",reflectToAttribute:!1},summaryRow:{value:{inline:{value:!0,type:"boolean"},visible:{value:!0,type:"boolean"}},type:"object"}},type:"object"},keys:{value:null,reflectToAttribute:!1,type:"any"},messages:{extend:!0,value:{en:{invalidColumnProperty:'{{elementType}}: Invalid property name "{{propertyName}}" set for Column: "{{type}}"',invalidRowProperty:'{{elementType}}: Invalid property name "{{propertyName}}" set for Row"',invalidCellValue:'Invalid cell value "{{value}}", Validation rule: "{{validationRule}}"',invalidValue:"Invalid value",invalidMinValue:"{{value}} above {{min}} must be filled out",invalidMaxValue:"{{value}} below {{max}} must be filled out",invalidMinLengthValue:"{{value}} is shorter than the minimum length of {{min}} characters",invalidMaxLengthValue:"{{value}} is longer than the maximum length of {{max}} characters",requiredValue:"{{value}} must be filled out",frozenColumns:"{{elementType}}: To Pin/Freeze a column group, all columns within it should be frozen.",frozenRows:"{{elementType}}: To Pin/Freeze a special cell, all rows within it should be frozen.",columnGroups:"{{elementType}}: Please, check the initialization of the SmartGrid's columns array. The columns in a column group are expected to be siblings in the columns array.",viewGrid:"Grid",viewKanban:"Kanban",viewCard:"Cards",viewScheduler:"Calendar",viewTimeline:"Timeline",kanbanNone:"Blank",schedulerDescription:"Which date column would you like to use for this view? Your data would be placed based on the dates in this column.",schedulerDescriptionInfo:"A range of data would be displayed when a start date field has an associated due date field.",kanbanDescription:'Start from a project board with columns generated by the "{{column}}" column options.',kanbanNoneDescription:"Create a new column and start from scratch with a completely blank project board. You can add columns and configure settings yourself.",kanbanBasic:"Template",kanbanBasicDescription:'Create a new column and start from a project board with columns for "To do", "in progress" and "Done".',schedulerDateColumn:"Create a new date column",schedulerPromptLabel:"Using date column(s)",schedulerDateRangeColumn:"Create a new date range",schedulerToolLabel:"Using '{{column}}'",toolLabel:"Labeled by '{{column}}'",uncategorized:"Uncategorized",toDo:"To do",inProgress:"In progress",done:"Done",min:"Min: {{value}}",max:"Max: {{value}} ",sum:"Sum: {{value}} ",avg:"Avg: {{value}} ",cells:"{{value}} cells selected",rows:"{{value}} rows",oneRow:"1 row",unique:"Unique: {{value}}",blank:"Empty: {{value}}",filled:"Filled: {{value}}",summary:"Summary",countSummary:"Count",minSummary:"Min",maxSummary:"Max",avgSummary:"Avg",blankSummary:"Empty",uniqueSummary:"Unique",filledSummary:"Filled",statusSummary:"Status",sumSummary:"Sum",completed:"Tasks Completed: {{value}}",count:"Count: {{value}} ",pagerFirstButton:"First",pagerLastButton:"Last",pagerPreviousButton:"Previous",pagerNextButton:"Next",pagerNavigateToLabel:"Go to:",pagerPageSizeLabel:"Show:",pagerNavigateToInputPlaceholder:"",pagerEllipsis:"...",pagerSummaryString:"of",pagerSummaryPrefix:"of",pagerSummarySuffix:"",columnMenuCustomizeType:"Column settings",columnMenuItemClone:"Clone column",columnMenuItemInsert:"Insert column",columnMenuItemSortAsc:"Sort {{mode}}",columnMenuItemSortDesc:"Sort {{mode}}",columnMenuItemRemoveSort:"Remove Sort",columnMenuItemFilter:"Filter column",columnMenuItemSort:"Sort column",columnMenuItemRemoveFilter:"Remove Filter",columnMenuItemGroupBy:"Group column",columnMenuItemRemoveGroupBy:"Remove Group",columnMenuItemHide:"Hide column",columnMenuItemShow:"Show column",columnMenuItemDelete:"Delete column",columnResizeTooltip:"width: {{value}}px",rowResizeTooltip:"height: {{value}}px",commandBarAddRow:"Add",commandBarDeleteRow:"Delete row",commandBarBatchRevert:"Revert",commandBarBatchSave:"Save",commandBarFilter:"Filter",commandBarSort:"Sort",commandBarSearch:"Search",commandBarCustomize:"Customize",commandBarGroup:"Group",commandColumnEdit:"Edit",commandColumnDelete:"Delete",commandColumnCancel:"Cancel",commandColumnUpdate:"Update",contextMenuItemDelete:"Delete row",contextMenuItemEditCell:"Edit cell",contextMenuItemEditRow:"Edit row",contextMenuItemSelectRow:"Select row",contextMenuItemCloneRow:"Clone row",contextMenuItemInsertRow:"Insert row",contextMenuItemChart:"Chart range",contextMenuItemAddRow:"Add {{value}} rows",commandColumnMenu:"",expandRow:"Expand row (Shift + Enter)",expandRowComments:"Expand row and see {{value}} comments",collapseRow:"Collapse row",addNewRow:"Click here to add a new row",addNewRowAlt:"<span>Add new empty row</span> <code>Ctrl</code> + <code>Space</code>",addNewRowAltSmall:"Add new empty row",addNewColumn:"Click here to add a new column",dialogChartHeader:"{{value}} Chart",dialogRowDetailHeader:"Row Id: {{value}}",dialogDescriptionHeader:"Column: {{value}}",dialogRowDetailButtonConfirm:"OK",dialogRowDetailButtonCancel:"CANCEL",dialogEditHeaderDisabled:"Row: {{value}}",dialogEditHeader:"Row: {{value}}",dialogEditHeaderMenu:"Toggle Sidebar",dialogExpandRowHeader:"Edit Record",dialogAddButtonConfirm:"ADD",dialogAddButtonCancel:"CANCEL",dialogEditButtonConfirm:"OK",dialogEditButtonSave:"Save",dialogEditButtonAutoSave:"Auto Save",dialogEditButtonCancel:"Cancel",dialogFilterButtonConfirm:"FILTER",dialogFilterButtonCancel:"CLEAR",dialogDeleteButtonConfirm:"DELETE",dialogDeleteButtonCancel:"CANCEL",dialogEditColumn:"Column: {{value}}",dialogNewColumn:"New column",dialogAddColumn:"Add Column",dialogAddColumnDate:"Choose a date column",dialogAddColumnStatus:"Choose a grouping column",dialogAddColumnStatusDescription:"Represent the status of each record",dialogAddColumnStatusNotes:"Your records will be grouped based on this column",dialogAddHeader:"Add Row",dialogDeleteHeader:"Delete Row",dialogFilterHeader:"Filter by",dialogFilterMinLabel:"Min",dialogFilterMaxLabel:"Max",dialogFileHeader:"File",dialogImageFileHeader:"Image",dialogFileDrop:"or drag and drop file(s) to upload",dialogFileUpload:"Select Files(s) to Upload",dialogFileURL:"You can also provide the URL to a file",dialogFileURLUpload:"Upload",dialogFileLink:"Link (URL)",dialogFileDevice:"My Device",dialogMyFiles:"My Files",dialogMyFilesTitle:"Select files from your already uploaded files.",dialogFileSize:'No file currently added. The "{{value}}" file cannot be uploaded. Maximum file size is {{fileSize}}.',dialogFileCount:'The following files cannot be added "{{files}}". Maximum files allowed is {{fileCount}}.',dialogFileFileUpload:"No files currently selected",dialogAddColumnName:"Name",dialogAddColumnNameInfo:"Name of the column. The name of the column will be displayed in the column header.",dialogAddColumnDescription:"Description",dialogAddColumnDescriptionInfo:"Description of the column. When the description is set, an icon will be displayed in the column header. A tooltip with the description will be displayed when you point at the icon.",dialogAddColumnNamePlaceholder:"Column name (optional)",dialogAddColumnDescriptionPlaceholder:"Describe this column (optional)",dialogAddColumnType:"Type",dialogAddColumnTypeInfo:'Type of the data in the column. Unlike a spreadsheet, Columns have specific "types" that allow you to store rich content in each record. For example, a table can contain records (rows) with images, long texts, checkboxes.',dialogAddColumnTypeText:"Text",dialogAddColumnTypeMultilineText:"Multiline text",dialogAddColumnTypeAIQuery:"AI Button",dialogAddColumnTypeSparklines:"Sparklines",dialogAddColumnAIQuery:"AI Query",dialogAddColumnTypeAIQueryInfo:"Example: Write a short description for an article or choose a column to query by it",dialogAddColumnTypeUUID:"UUID",dialogAddColumnTypeImage:"Image",dialogAddColumnTypeNumber:"Number",dialogAddColumnTypeSelect:"Select",dialogAddColumnTypeMultipleSelect:"Multiple select",dialogAddColumnTypeDate:"Date",dialogAddColumnTypeTime:"Time",dialogAddColumnTypeRating:"Rating",dialogAddColumnTypeDuration:"Duration",dialogAddColumnTypeCheckBox:"CheckBox",dialogAddColumnTypeCreatedTime:"Created time",dialogAddColumnTypeLastUpdatedTime:"Last modified time",dialogAddColumnTypeCreatedBy:"Created by",dialogAddColumnTypeLastUpdatedBy:"Last modified by",dialogAddColumnTypeCollaborator:"User",dialogAddColumnTypeFormula:"Formula",dialogAddColumnTypeFormulaInfo:'Example: COL(Name) & "-" & COL(Price) or IF(COL(Price) * COL(Quantity) > 5, "Yes", "No")',dialogAddColumnTypeSlider:"Slider",dialogAddColumnTypeStatus:"Choose a status column",dialogAddColumnTypeStatusInfo:"Connect with the relevant status column",dialogAddColumnTypeAutoNumber:"Auto number",dialogAddColumnTypeRowLink:"Link to table",dialogAddColumnTypeURL:"URL",dialogAddColumnTypeEmail:"Email",dialogAddColumnTypePassword:"Password",dialogAddColumnTypePhone:"Phone",dialogAddColumnTypeNone:"None",dialogAddColumnTypeStartDate:"Start Date",dialogAddColumnTypeDueDate:"Due Date",dialogAddColumnTypeDueDateSettings:"Set as a deadline",dialogAddColumnTypeDueDateSettingsInfo:"Set a deadline with start date or due date templates.",dialogAddColumnTypeProgress:"Progress",dialogAddColumnTypePriority:"Priority",dialogAddColumnTypeDescription:"Description",dialogAddColumnTypeTags:"Tags",dialogAddColumnTypeName:"Name",dialogAddColumnTypeColor:"Color",dialogAddColumnTypeChecklist:"Checklist",dialogAddColumnTypeAssigned:"Assignee",dialogAddColumnTypeAttachment:"Attachment",dialogAddColumnTypeVote:"Vote",dialogAddColumnDateFormat:"Date format",dialogAddColumnDateFormatInfo:"Choose the dates display format",dialogAddColumnDateFormatShort:"Short",dialogAddColumnDateFormatMonthYear:"Month & Year",dialogAddColumnDateFormatCasualUS:"Casual US",dialogAddColumnDateFormatWeekdayOnly:"Weekday",dialogAddColumnDateFormatUS:"US",dialogAddColumnDateFormatLong:"Long",dialogAddColumnDateFormatEU:"EU",dialogAddColumnDateFormatISO:"ISO",dialogAddColumnDateFormatAS:"AS",dialogAddColumnDateFormatFull:"Full",dialogAddColumnDateFormatSlash:"Slash",dialogAddColumnDateFormatHyphen:"Hyphen",dialogAddColumnDateFormatDot:"Dot",dialogAddColumnTimeFormat:"Time format",dialogAddColumnTimeFormatInfo:"Choose the time display format",dialogAddColumnTimeFormatHour:"hour",dialogAddColumnAllowTimeFormat:"Include a time field",dialogAddColumnCustomDateSeparator:"Set a custom separator",dialogAddColumnNumberFormat:"Number format",dialogAddColumnNumberFormatInfo:"Choose the number display format",dialogAddColumnNumberFormatInteger:"Integer",dialogAddColumnNumberFormatNumber:"Number",dialogAddColumnNumberFormatPercent:"Percent",dialogAddColumnNumberFormatPercentRounded:"Percent(rounded)",dialogAddColumnNumberFormatScientific:"Scientific",dialogAddColumnNumberFormatEngineering:"Engineering",dialogAddColumnNumberFormatAccounting:"Accounting",dialogAddColumnNumberFormatUnit:"Unit",dialogAddColumnNumberFormatUnitInfo:"Units of measurement",dialogAddColumnNumberFormatUnitAcre:"Acre",dialogAddColumnNumberFormatUnitCelsius:"Celsius",dialogAddColumnNumberFormatUnitFahrenheit:"Fahrenheit",dialogAddColumnNumberFormatUnitPercent:"Percent",dialogAddColumnNumberFormatUnitDegree:"Degree",dialogAddColumnNumberFormatUnitMegaByte:"Mega byte",dialogAddColumnNumberFormatUnitCentimeter:"Centimeter",dialogAddColumnNumberFormatUnitMeter:"Meter",dialogAddColumnNumberFormatUnitKilometer:"Kilometer",dialogAddColumnNumberFormatUnitMile:"Mile",dialogAddColumnNumberFormatUnitKilogram:"Kilogram",dialogAddColumnNumberFormatUnitPound:"Pound",dialogAddColumnNumberFormatUnitLiter:"Liter",dialogAddColumnNumberFormatUnitGallon:"Gallon",dialogAddColumnNumberFormatUnitSecond:"Second",dialogAddColumnNumberFormatUnitMinute:"Minute",dialogAddColumnNumberFormatUnitHour:"Hour",dialogAddColumnNumberFormatUnitDay:"Day",dialogAddColumnNumberFormatUnitWeek:"Week",dialogAddColumnNumberFormatUnitMonth:"Month",dialogAddColumnNumberFormatUnitYear:"Year",dialogAddColumnNumberFormatCurrency:"Currency",dialogAddColumnNumberFormatCurrencyRounded:"Currency(rounded)",dialogAddColumnNumberFormatCurrencyInfo:"Choose the currency display format",dialogAddColumnNumberFormatDecimalPlaces:"Decimal places",dialogAddColumnNumberFormatSeparator:"Use 1000 Separator (,)",dialogAddColumnMinLength:"Minimum length",dialogAddColumnMinLengthInfo:"Minimum text length",dialogAddColumnMaxLength:"Maximum length",dialogAddColumnMaxLengthInfo:"Maximum text length",dialogAddColumnMinValue:"Minimum value",dialogAddColumnMinValueInfo:"Minimum number",dialogAddColumnMaxValue:"Maximum value",dialogAddColumnMaxValueInfo:"Maximum number",dialogAddColumnMinDate:"Minimum date",dialogAddColumnMinDateInfo:"Minimum date",dialogAddColumnMaxDate:"Maximum date",dialogAddColumnMaxDateInfo:"Maximum date",dialogAddColumnColorItems:"Color items",dialogAddColumnDotItems:"Show Dots",dialogAddColumnCustomItems:"Custom Items",dialogAddColumnListItems:"List items",dialogAddColumnLinkListItems:"Choose a table to link to",dialogAddColumnLinkField:"Choose a lookup field",dialogAddColumnLinkFieldMore:"Cascading readonly fields",dialogAddColumnLinkSelect:"Allow linking to multiple rows",dialogAddColumnFormula:"Please enter a formula",dialogAddColumnListItemsError:"You cannot delete an item while in use.",dialogAddColumnListItemsEditError:"You cannot edit an item while in use.",dialogAddColumnDefault:"Default value",dialogAddColumnDefaultDateCurrent:"Current Date",dialogAddColumnDefaultDateSpecific:"Specific Date",dialogAddColumnAlign:"Align",dialogAddColumnAlignLeft:"Left",dialogAddColumnAlignRight:"Right",dialogAddColumnAlignCenter:"Center",dialogAddColumnAlignInfo:"Table cells text alignment",dialogAddColumnResizable:"Resizable",dialogAddColumnResizableInfo:"Select if you want to make the column resizable",dialogAddColumnRequired:"Required",dialogAddColumnRequiredInfo:"Select if you want to make the column required",dialogAddColumnSortable:"Sortable",dialogAddColumnSortableInfo:"Select if you want to sort by this column",dialogAddColumnFilterable:"Filterable",dialogAddColumnFilterableInfo:"Select if you want to filter by this column",dialogAddColumnEditable:"Editable",dialogAddColumnEditableInfo:"Select if you want to edit by this column",dialogAddColumnMultipleCollaborators:"Multiple Collaborators",dialogAddColumnMultipleCollaboratorsInfo:"Select if you want to allow multiple collaborators",dialogAddColumnBlankItem:"Blank Item",dialogAddColumnFormatting:"Rich Formatting",priority_low:"Low",priority_average:"Average",priority_high:"High",priority_critical:"Critical",strikethrough:"Strikethrough",bold:"Bold",fontStyle:"Font Style",italic:"Italic",send:"Send",copy:"copy",status:"Status",underline:"Underline",comments:"Comments",comment:"Comment",commentPlaceholder:"Leave a comment",noComments:"Leave a comment and collaborate with your team.",guestUser:"Guest",background:"Background",starred:"Starred",resetFormat:"Reset Format",notStarred:"Not starred",color:"Color",coloredItems:"Colored items",conditionalFormatting:"Conditional Formatting",groupBarLabel:"Drag a column header here to group by that column",dialogDeleteContent:"Are you sure you want to delete this row?",detailsTab:"Format",commentsTab:"Comments",historyTab:"History",historyEvent:"Event",historyAuthor:"Author",historyDetails:"Details",range:"Changed {{column}} from {{oldValue}} to {{newValue}}",nullRange:"Changed {{column}} to {{newValue}}",rowCreated:"Row Created",propertyUpdated:"{{value}} updated",propertyRemoved:"{{value}} removed",dropImages:"Drop images here",addImages:"Add images",dropFiles:"Drop files here",addFiles:"Add files",unassigned:"Unassigned",historyDate:"Date",copyURL:"Copy row URL",calendar:{"/":"/",":":":",firstDay:0,days:{names:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],namesAbbr:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],namesShort:["Su","Mo","Tu","We","Th","Fr","Sa"]},months:{names:["January","February","March","April","May","June","July","August","September","October","November","December",""],namesAbbr:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec",""]},AM:["AM","am","AM"],PM:["PM","pm","PM"],eras:[{name:"A.D.",start:null,offset:0}],currencySymbol:"$",currency:"USD",currencySymbolPosition:"before",decimalSeparator:".",thousandsSeparator:","},CONTAINS:"Contains",DOES_NOT_CONTAIN:"Does not contain",ENDS_WITH:"Ends with",EQUAL:"Equal",GREATER_THAN:"Greater than",GREATER_THAN_OR_EQUAL:"Greater than or equal",LESS_THAN:"Less than",LESS_THAN_OR_EQUAL:"Less than or equal",NOT_EQUAL:"Not equal",RANGE:"Range",CLEAR_FILTER:"Clear Filter",STARTS_WITH:"Starts with",addFilter:"+ Add filter",addAIFilter:" ✨︎ Ask AI",and:"And",apply:"Apply",applyOnce:"Apply once",booleanFirst:"☐",booleanLast:"☑",cancel:"Cancel",CONTAINS_CASE_SENSITIVE:"Contains (case sensitive)",dateFirst:"1",dateLast:"9",DOES_NOT_CONTAIN_CASE_SENSITIVE:"does not contain (case sensitive)",EMPTY:"empty",ENDS_WITH_CASE_SENSITIVE:"ends with (case sensitive)",EQUAL_CASE_SENSITIVE:"equal (case sensitive)",filter:"Filter",customize:"Hide columns",customizeOne:"1 hidden column",customizeHidden:"{{n}} hidden columns",filteredByMultiple:"{{n}} filters",filteredByOne:"1 filter",filterValuePlaceholder:"Value",find:"Find a field",findInView:"Find in view",firstBy:"Sort by",found:"{{nth}} of {{n}}",from:"from",noFilters:"No filters applied",noResults:"No results",noSorting:"No sorting applied",noOptions:"No options",NOT_EMPTY:"not empty",NOT_NULL:"not null",NULL:"null",numberFirst:"1",numberLast:"9",ok:"OK",or:"Or",pickAnother:"Pick another field to sort by",maintainSort:"Maintain sort",sort:"Sort",group:"Group",sortedByMultiple:"Sorted by {{n}} columns",sortedByOne:"Sorted by 1 column",STARTS_WITH_CASE_SENSITIVE:"starts with (case sensitive)",stringFirst:"A",stringLast:"Z",thenBy:"then by",where:"Where",collapseAll:"Collapse all",expandAll:"Expand all",noGrouping:"No grouping",groupedByMultiple:"{{n}} groups",groupedByOne:"1 group",groupedBy:"Grouped by '{{column}}'",deleteByMultiple:"Delete {{n}} rows",deleteByOne:"Delete 1 row",download:"Download",firstByGroup:"Group by",expandRecord:"Expand row",expandCell:"Expand cell",pickAnotherGroupBy:"Pick another field to group by",add:"Add condition",all:"All columns",between:"Between",close:"Close",column:"Column:",condition:"Condition:",equal:"equal",fontFamily:"Font family:",fontSize:"Font size:",format:"Format:",greaterThan:"greater than",highlight:"Highlight",lessThan:"less than",notEqual:"not equal",remove:"Remove condition",secondValue:"Second value:",text:"Text",value:"Value:",addCondition:"Add Condition",addGroup:"Add Group",blanks:"(Blanks)",clear:"Clear",contains:"contains",containsCaseSensitive:"contains (case sensitive)",dateTabLabel:"DATE",doesNotContain:"does not contain",doesNotContainCaseSensitive:"does not contain (case sensitive)",empty:"empty",endsWith:"ends with",endsWithCaseSensitive:"ends with (case sensitive)",equalCaseSensitive:"equal (case sensitive)",greaterThanOrEqual:"greater than or equal",lessThanOrEqual:"less than or equal",mismatchedProperties:'SmartFilterPanel: The "filterType" and the data type of the selected "dataField" are mismatched.',missingProperty:'SmartFilterPanel: When mode is \'excel\', either "data" and "dataField" or "dataSource" of type Array have to be set.',notEmpty:"not empty",notNull:"not null",null:"null ",placeholderBoolean:"Select value",placeholderDate:"Enter date",placeholderNumber:"Enter number",placeholderTime:"Enter time",placeholderValue:"Enter value",selectAll:"(Select All)",showRows:"Show rows where:",startsWith:"starts with",startsWithCaseSensitive:"starts with (case sensitive)",matchCase:"Match Case",timeTabLabel:"TIME",today:"Today",tomorrow:"Tomorrow",yesterday:"Yesterday",formatColumn:"Format Column",formating:"Color",formatingByMultiple:"{{n}} Colors",formatingOne:"1 color",formatingBy:"Colored by '{{value}}'",reset:"Reset",filteredRecords:"All rows are filtered",duplicateCells:"Clone column cells and settings",duplicateSettings:"Clone column settings",views:"Views",createView:"New View",newGrid:"Grid",newKanban:"Kanban",newCard:"Cards",newScheduler:"Calendar",newTimeline:"Timeline",layout:"Layout",settings:"Create view",viewNamePlaceholder:"View name",view:"View",noViews:"Found no views",kanbanView:"View your records as cards on a Kanban board",gridView:"View your records in a Table",cardView:"View your records in a Card view",schedulerView:"View your records in a Calendar view",timelineView:"View your records in a Timeline view",days:"{{value}}d",daysOverdue:"{{value}} days overdue",daysLeft:"{{value}} days left",true:"true",false:"false",TOMORROW:"Tomorrow",TODAY:"Today",YESTERDAY:"Yesterday",NEXT_WEEK:"Next week",THIS_WEEK:"This week",LAST_WEEK:"Last week",NEXT_MONTH:"Next month",THIS_MONTH:"This month",LAST_MONTH:"Last month",hideHiddenColumns:"Hide {{value}} hidden columns",showHiddenColumns:"Show {{value}} hidden columns",less:"Less",more:"More",conditions:"Conditions",colorsSingleSelect:"Which single select field should the row be colored by?",colorRows:"Color rows when they match the conditions",colorSelect:"Color rows the same as a single select value",colorLeftBorderLabel:"Left border",colorRowLabel:"Row",colorCellLabel:"Cell",colorLeftBorder:"Color the left border of a row",colorRow:"Color the background of a row",colorCell:"Color the background of a cell",loadingIndicatorPlaceholder:"Loading...",dropDownPlaceholder:"Please select...",placeholder:"No Rows",columnPlaceholder:"Placeholder",pieChart:"Pie",columnChart:"Column",barChart:"Bar",stackedChart:"Stacked",lineChart:"Line",projectStatus:"Project Status",reviewStatus:"Review Status",taskStatus:"Task Status",priority:"Priority",size:"Size",yesNo:"Yes/No/Maybe",backlog:"Backlog",notStarted:"Not Started",underReview:"Under review",approved:"Approved",rejected:"Rejected",blocked:"Blocked",completedStatus:"Completed",generate:"Generate",aiPrompt:"Enter your prompt for the AI:",agenda:"Agenda",checkStyle:"Style",noVotes:"No votes yet",votes:"Voted by {{value}}",clearContents:"Clear contents",paste:"Paste",minPromptChars:"Enter AI prompt. Min 20 chars.",aiResponse:"Response",noAIResponse:"No response from AI",promptSuggest:"Prompt Suggestions"}},type:"object"},onCellValue:{value:null,type:"any",reflectToAttribute:!1},onCellEditRequest:{value:null,type:"any",reflectToAttribute:!1},onCellUpdate:{value:null,type:"any",reflectToAttribute:!1},onCellRender:{value:null,type:"any",reflectToAttribute:!1},onCellValueChanged:{value:null,type:"any",reflectToAttribute:!1},onBeforeInit:{value:null,type:"any",reflectToAttribute:!1},onInit:{value:null,type:"any",reflectToAttribute:!1},onAfterInit:{value:null,type:"any",reflectToAttribute:!1},onKey:{value:null,type:"any",reflectToAttribute:!1},onKeyUp:{value:null,type:"any",reflectToAttribute:!1},onRender:{value:null,type:"any",reflectToAttribute:!1},onLoad:{value:null,type:"any",reflectToAttribute:!1},onChartInit:{value:null,type:"any",reflectToAttribute:!1},onComment:{value:null,type:"any",reflectToAttribute:!1},onRowInit:{value:null,type:"any",reflectToAttribute:!1},onRowClass:{value:null,type:"any",reflectToAttribute:!1},onRowChange:{value:null,type:"any",reflectToAttribute:!1},onRowDetailInit:{value:null,type:"any",reflectToAttribute:!1},onRowDetailUpdated:{value:null,type:"any",reflectToAttribute:!1},onRowInserted:{value:null,type:"any",reflectToAttribute:!1},onRowRemoved:{value:null,type:"any",reflectToAttribute:!1},onRowUpdate:{value:null,type:"any",reflectToAttribute:!1},onRowUpdated:{value:null,type:"any",reflectToAttribute:!1},onRowStarred:{value:null,type:"any",reflectToAttribute:!1},onRowHistory:{value:null,type:"any",reflectToAttribute:!1},onRowStyle:{value:null,type:"any",reflectToAttribute:!1},onRowResize:{value:null,type:"any",reflectToAttribute:!1},onColumnInit:{value:null,type:"any",reflectToAttribute:!1},onColumnInserted:{value:null,type:"any",reflectToAttribute:!1},onColumnRemoved:{value:null,type:"any",reflectToAttribute:!1},onColumnResize:{value:null,type:"any",reflectToAttribute:!1},onColumnReorder:{value:null,type:"any",reflectToAttribute:!1},onColumnSummaryChange:{value:null,type:"any",reflectToAttribute:!1},onColumnUpdated:{value:null,type:"any",reflectToAttribute:!1},onColumnClone:{value:null,type:"any",reflectToAttribute:!1},onColumnChange:{value:null,type:"any",reflectToAttribute:!1},onCommand:{value:null,reflectToAttribute:!1,type:"any"},onViewInit:{value:null,type:"any",reflectToAttribute:!1},filtering:{value:{enabled:{value:!1,type:"boolean"},operator:{value:"and",type:"string"},filter:{value:[],type:"array",reflectToAttribute:!1},filterRow:{value:{visible:{value:!1,type:"boolean"},menuVisible:{value:!1,type:"boolean"},applyMode:{value:"auto",type:"string",allowedValues:["auto","click"]},autoApplyModeDelay:{value:800,type:"number"}},type:"object"},filterMenu:{value:{visible:{value:!0,type:"boolean"},buttons:{value:["cancel","clear","filter"],type:"array"},dataSource:{value:null,type:"any"},width:{value:250,type:"number"},height:{value:200,type:"number"},mode:{value:"default",allowedValues:["default","excel"],type:"string"},messages:{value:null,type:"object"}},type:"object"}},type:"object"},editing:{value:{allowRowHeaderEdit:{value:!1,type:"boolean"},allowColumnHeaderEdit:{value:!1,type:"boolean"},autoUpdateFilterAndSort:{value:!0,type:"boolean"},allowListOpenOnContentClick:{value:!0,type:"boolean"},active:{value:!1,readonly:!0,type:"boolean"},enabled:{value:!1,type:"boolean"},batch:{value:!1,type:"boolean"},readOnlyEdit:{value:!1,type:"boolean"},action:{value:"click",type:"string",allowedValues:["none","click","doubleClick"]},commandKeys:{value:{commandKeyCancel:{value:{command:"commandKeyCancelCommand",key:"Escape"},type:"object"},commandKeyUpdate:{value:{command:"commandKeyUpdateCommand",key:"Enter | Tab"},type:"object"}},type:"object"},commandBar:{value:{visible:{value:!1,type:"boolean"},position:{value:"near",allowedValues:["near","far","both"],type:"string"},displayMode:{value:"labelAndIcon",allowedValues:["label","icon","labelAndIcon"],type:"string"},dataSource:{value:{commandBarAddRow:{value:{command:{value:"commandBarAddRowCommand",type:"any"},icon:{value:"smart-icon-plus",type:"string"},label:{value:"{{messages}}",type:"string"},visible:{value:!1,type:"any"}},type:"object"},commandBarDeleteRow:{value:{command:{value:"commandBarDeleteRowCommand",type:"any"},icon:{value:"smart-icon-delete",type:"string"},label:{value:"{{messages}}",type:"string"},visible:{value:!1,type:"any"}},type:"object"},commandBarBatchSave:{value:{command:{value:"commandBarBatchSaveCommand",type:"any"},icon:{value:"smart-icon-ok-squared",type:"string"},label:{value:"{{messages}}",type:"string"},visible:{value:!0,type:"any"}},type:"object"},commandBarBatchRevert:{value:{command:{value:"commandBarBatchRevertCommand",type:"any"},icon:{value:"smart-icon-reload",type:"string"},label:{value:"{{messages}}",type:"string"},visible:{value:!0,type:"any"}},type:"object"},commandBarCustom:{value:{command:{value:"",type:"any"},icon:{value:"smart-icon-ellipsis-vert",type:"string"},label:{value:"",type:"string"},visible:{value:!1,type:"any"}},type:"object"}},type:"object"}},type:"object"},commandColumn:{value:{visible:{value:!1,type:"boolean"},inline:{value:!1,type:"boolean"},position:{value:"far",allowedValues:["near","far"],type:"string"},displayMode:{value:"icon",allowedValues:["label","icon","labelAndIcon"],type:"string"},customCommandColumns:{value:null,type:"any"},dataSource:{value:{commandColumnMenu:{value:{command:{value:"commandColumnMenuCommand",type:"any"},icon:{value:"smart-icon-menu",type:"string"},label:{value:"{{messages}}",type:"string"},visible:{value:!1,type:"any"}},type:"object"},commandColumnEdit:{value:{command:{value:"commandColumnEditCommand",type:"any"},icon:{value:"smart-icon-mode-edit",type:"string"},label:{value:"{{messages}}",type:"string"},visible:{value:"auto",type:"any"}},type:"object"},commandColumnDelete:{value:{command:{value:"commandColumnDeleteCommand",type:"any"},icon:{value:"smart-icon-delete",type:"string"},label:{value:"{{messages}}",type:"string"},visible:{value:!0,type:"any"}},type:"object"},commandColumnUpdate:{value:{command:{value:"commandColumnUpdateCommand",type:"any"},icon:{value:"smart-icon-ok-squared",type:"string"},label:{value:"{{messages}}",type:"string"},visible:{value:"auto",type:"any"}},type:"object"},commandColumnCancel:{value:{command:{value:"commandColumnCancelCommand",type:"any"},icon:{value:"smart-icon-cancel-circled",type:"string"},label:{value:"{{messages}}",type:"string"},visible:{value:"auto",type:"any"}},type:"object"},commandColumnRowMenu:{value:{command:{value:"commandColumnRowMenuCommand",type:"any",reflectToAttribute:!1},icon:{value:"smart-icon-ellipsis-vert",type:"string"},label:{value:"{{messages}}",type:"string"},visible:{value:!1,type:"any"}},type:"object"},commandColumnCustom:{value:{command:{value:"",type:"any",reflectToAttribute:!1},icon:{value:"smart-icon-ellipsis-vert",type:"string"},label:{value:"",type:"string"},visible:{value:!1,type:"any"}},type:"object"}},type:"object"},width:{value:null,type:"number?"}},reflectToAttribute:!1,type:"object"},mode:{value:"cell",allowedValues:["cell","row"],type:"string"},addNewColumn:{value:{visible:{value:!1,type:"boolean"}},type:"object"},addNewRow:{value:{position:{value:"both",allowedValues:["near","far","both"],type:"string"},visible:{value:!1,type:"boolean"},autoEdit:{value:!0,type:"boolean"},autoCreate:{value:!1,type:"boolean"},autoSave:{value:!0,type:"boolean"},label:{value:"{{message}}",type:"string"},displayMode:{value:"row",allowedValues:["row","insertButton","button"],type:"string"}},type:"object"},dialog:{value:{header:{value:"{{message}}",type:"string"},height:{value:"auto",type:"any"},width:{value:"auto",type:"any"},sidePanel:{value:!1,type:"boolean"},left:{value:"center",type:"any"},top:{value:"center",type:"any"},enabled:{value:!1,type:"boolean"},visible:{value:!1,type:"boolean"}},type:"object"},addDialog:{value:{header:{value:"{{message}}",type:"string"},height:{value:"auto",type:"any"},width:{value:"auto",type:"any"},left:{value:"center",type:"any"},top:{value:"center",type:"any"},enabled:{value:!1,type:"boolean"},visible:{value:!1,type:"boolean"}},type:"object"},addColumnDialog:{value:{header:{value:"{{message}}",type:"string"},height:{value:"auto",type:"any"},width:{value:430,type:"any"},left:{value:"center",type:"any"},top:{value:"center",type:"any"},enabled:{value:!1,type:"boolean"},visible:{value:!1,type:"boolean"}},type:"object"},deleteDialog:{value:{header:{value:"{{message}}",type:"string"},height:{value:"auto",type:"any"},width:{value:"auto",type:"any"},left:{value:"center",type:"any"},top:{value:"center",type:"any"},enabled:{value:!1,type:"boolean"},visible:{value:!1,type:"boolean"}},type:"object"}},type:"object"},paging:{value:{enabled:{value:!1,type:"boolean"},spinner:{value:{enabled:{value:!1,type:"boolean"},step:{value:1,type:"number"}},type:"object"},pageHierarchySize:{value:2,type:"int"},pageSize:{value:10,type:"int"},pageIndex:{value:0,type:"int",validator:"pageIndexValidator"}},type:"object"},pager:{value:{autoEllipsis:{value:"both",allowedValues:["none","before","after","both"],type:"string"},position:{value:"far",allowedValues:["near","far","both"],type:"string"},template:{value:"",type:"string"},pageSizeSelector:{value:{visible:{value:!1,type:"boolean"},dataSource:{value:[10,20,50],type:"object"},position:{value:"far",allowedValues:["near","far"],type:"string"}},type:"object"},summary:{value:{position:{value:"far",allowedValues:["near","far"],type:"string"},visible:{value:!1,type:"boolean"}},type:"object"},navigationButtons:{value:{position:{value:"both",allowedValues:["near","far","both"],type:"string"},prevNextButtons:{value:{visible:{value:!0,type:"boolean"}},type:"object"},firstLastButtons:{value:{visible:{value:!0,type:"boolean"}},type:"object"},labels:{value:{visible:{value:!1,type:"boolean"}},type:"object"}},type:"object"},navigationInput:{value:{position:{value:"far",allowedValues:["near","far"],type:"string"},visible:{value:!1,type:"boolean"}},type:"object"},pageIndexSelectors:{value:{visible:{value:!0,type:"boolean"},dataSource:{value:10,type:"any"}},type:"object"},visible:{value:!1,type:"boolean"}},type:"object",reflectToAttribute:!1},rowDetail:{value:{enabled:{value:!1,type:"boolean"},inline:{value:!1,type:"boolean"},height:{value:200,type:"number"},position:{value:"near",allowedValues:["near","far"],type:"string"},template:{value:"",type:"any",reflectToAttribute:!1},visible:{value:!0,type:"boolean"},dialog:{value:{header:{value:"{{message}}",type:"string"},height:{value:300,type:"any"},width:{value:360,type:"any"},left:{value:"center",type:"any"},top:{value:"center",type:"any"},enabled:{value:!1,type:"boolean"},visible:{value:!1,type:"boolean"}},type:"object"}},type:"object"},rowCSSRules:{value:null,type:"any"},summaryRow:{value:{position:{value:"far",allowedValues:["near","far"],type:"string"},visible:{value:!1,type:"boolean"},editing:{value:!1,type:"boolean"},template:{value:"",type:"string"}},type:"object"},scrolling:{value:"physical",allowedValues:["physical","virtual","infinite","deferred"],type:"string"},columnHeader:{value:{visible:{value:!0,type:"boolean"}},type:"object"},groupHeader:{value:{visible:{value:!1,type:"boolean"},template:{value:"",type:"string"}},type:"object"},header:{value:{visible:{value:!1,type:"boolean"},template:{value:"",type:"any"},appendTo:{value:"",type:"any"},buttons:{value:["columns","filter","group","sort","format","search"],type:"array"},searchCommand:{value:"search",allowedValues:["search","filter"],type:"string"},customButton:{value:{command:{value:null,type:"any",reflectToAttribute:!1},enabled:{value:!0,type:"boolean"},visible:{value:!1,type:"boolean"},icon:{value:"smart-icon-settings",type:"string"},label:{value:"",type:"string"}},type:"object",reflectToAttribute:!1},onInit:{value:null,reflectToAttribute:!1,type:"any"}},type:"object"},footer:{value:{visible:{value:!1,type:"boolean"},template:{value:"",type:"any"}},type:"object"},stateSettings:{value:{enabled:{value:!0,type:"boolean",reflectToAttribute:!1},current:{value:"",type:"string",reflectToAttribute:!1},storage:{value:null,type:"any",reflectToAttribute:!1},autoSave:{value:!1,type:"boolean",reflectToAttribute:!1},autoLoad:{value:!1,type:"boolean",reflectToAttribute:!1},allowLocalStorage:{value:!0,type:"boolean",reflectToAttribute:!1},options:{value:[],type:"array",reflectToAttribute:!1},onStateChange:{value:null,type:"any",reflectToAttribute:!1}},type:"object",reflectToAttribute:!1},checkBoxes:{value:{visible:{value:!1,type:"boolean"},hasThreeStates:{value:!1,type:"boolean"}},type:"object"},selection:{value:{enabled:{value:!1,type:"boolean"},allowRowHeaderSelection:{value:!1,type:"boolean"},allowColumnHeaderSelection:{value:!1,type:"boolean"},allowRowSelection:{value:!0,type:"boolean"},allowCellSelection:{value:!1,type:"boolean"},allowDragSelection:{value:!0,type:"boolean"},allowDragSelectionAutoScroll:{value:!0,type:"boolean"},allowCellDragSelectionHandle:{value:!0,type:"boolean"},allowCellDragDropSelectionHandle:{value:!0,type:"boolean"},allowCellDragSelectionAutoFill:{value:!0,type:"boolean"},selectAllMode:{value:"page",allowedValues:["none","page","all"],type:"string"},mode:{value:"many",type:"string",allowedValues:["one","many","extended"]},action:{value:"click",type:"string",allowedValues:["none","click","doubleClick"]},checkBoxes:{value:{enabled:{value:!1,type:"boolean"},autoShow:{value:!1,type:"boolean"},action:{value:"click",type:"string",allowedValues:["none","click","doubleClick"]},selectAllMode:{value:"page",allowedValues:["none","page","all"],type:"string"},position:{value:"near",allowedValues:["near","far"],type:"string"}},type:"object"},selected:{value:"",type:"string"},tabKeyBehavior:{value:"default",allowedValues:["none","default"],type:"string"},defaultSelection:{value:!1,type:"boolean"}},type:"object"},sorting:{value:{enabled:{value:!1,type:"boolean"},sort:{value:[],type:"array"},mode:{value:"one",allowedValues:["one","many"],type:"string"},maintainSort:{value:!0,type:"boolean"},commandKey:{value:"",allowedValues:["","Shift","Control","Alt"],type:"string"},sortToggleThreeStates:{value:!0,type:"boolean"},sortToggleOnClick:{value:!0,type:"boolean"},sortToggleOnClickAndCommandKey:{value:!1,type:"boolean"}},type:"object"},storeHistory:{value:!1,type:"boolean"},storeHistoryItems:{value:20,type:"number"},users:{value:[],type:"array",reflectToAttribute:!1},virtualModeCachedRowsCount:{value:100,type:"int"}}}static get requires(){return{}}static get styleUrls(){return["Smart.menu.css","Smart.filterpanel.css","Smart.pager.css","Smart.grid.css","Smart.textbox.css"]}template(){return"<div class='smart-container'id='container' disabled='[[disabled]]' >\n <div id='header' role=\"toolbar\" class='smart-grid-header smart-hidden'>\n </div>\n <div id='groupHeader' role=\"presentation\" class='smart-grid-group-header smart-hidden'></div>\n <div id='headerPager' top class='smart-grid-pager smart-hidden'></div>\n <div id='headerCommandBar' header top class='smart-grid-header smart-grid-command-bar smart-hidden'></div>\n <div id='content' role='grid' class='smart-grid-content'>\n <div id='columnHeader' role=\"rowgroup\" class='smart-grid-column-header'>\n <div id='columnNearContainer' role=\"row\" class='near smart-hidden smart-grid-column-header-cell-container'>\n </div>\n <div id='columnContainer' role=\"row\" class='center smart-grid-column-header-cell-container'>\n </div>\n <div id='columnFarContainer' role=\"row\" class='far smart-hidden smart-grid-column-header-cell-container'>\n </div>\n </div>\n <div id='scrollView' role=\"rowgroup\" class ='smart-grid-scroll-view'>\n <div id='rowNearContainer' role=\"presentation\" class='near smart-hidden smart-grid-row-container'>\n </div>\n <div id='rowContainer' style=\"opacity: 0.99\" role=\"presentation\" class='center smart-grid-row-container'>\n </div>\n <div id='rowFarContainer' role=\"presentation\" class='far smart-hidden smart-grid-row-container'>\n </div>\n <div id='placeholder' class ='smart-hidden smart-placeholder smart-grid-placeholder'></div>\n <smart-scroll-bar right-to-left=\"[[rightToLeft]]\" theme=\"[[theme]]\" id='verticalScrollBar' class='smart-grid-scroll-bar' wait disabled='[[disabled]]' orientation='vertical'></smart-scroll-bar>\n <smart-scroll-bar right-to-left=\"[[rightToLeft]]\" theme=\"[[theme]]\" id='horizontalScrollBar' class='smart-grid-scroll-bar' wait disabled='[[disabled]]'></smart-scroll-bar>\n </div>\n <div id='filterFooter' class='smart-grid-filter-footer smart-hidden'></div>\n </div>\n <div class=\"smart-grid-view-content smart-hidden\" id=\"viewContent\"></div>\n <div viewbar class=\"smart-grid-view-bar smart-hidden\" id=\"viewBar\"></div>\n <div id='loadingIndicatorContainer' class='smart-loader-container'>\n <span id='loadingIndicator' class='smart-grid-loader smart-loader'></span>\n <span id='loadingIndicatorPlaceholder' class ='smart-loader-label smart-hidden'></span>\n </div>\n <div id='footerCommandBar' footer class='smart-grid-footer smart-grid-command-bar smart-hidden'></div>\n <div id='footerPager' class='smart-grid-pager smart-hidden'></div>\n <div id='footer' class='smart-grid-footer smart-hidden'></div>\n </div>"}static get listeners(){return{focus:"_focusHandler",blur:"_blurHandler",wheel:"_mouseWheelHandler","document.up":"_upHandler","document.down":"_downHandler","document.move":"_moveHandler","document.scroll":"_scrollHandler",keydown:"_keyDownHandler",keyup:"_keyUpHandler",resize:"_resizeHandler","header.click":"_headerClickHandler","columnHeader.down":"_columnDownHandler","columnHeader.click":"_columnClickHandler","columnHeader.move":"_columnMoveHandler","columnHeader.mouseleave":"_columnMouseLeaveHandler","rowNearContainer.down":"_rowDownHandler","rowContainer.down":"_rowDownHandler","rowFarContainer.down":"_rowDownHandler","container.selectstart":"_selectStartHandler",styleChanged:"_styleChangedHandler",swipeleft:"_swipeLeftHandler",swiperight:"_swipeRightHandler",contextmenu:"_contextMenuHandler","document.paste":"_clipboardPasteHandler",mouseleave:"_mouseLeaveHandler"}}_mouseLeaveHandler(){const e=this;e.editing.addNewRow._insertButton&&e.editing.addNewRow._insertButton.classList.remove("show")}_clipboardPasteHandler(e){if("paste"===e.type){const t=this;if(document.activeElement!==t)return;if(t._selection&&t._selection.focusedCell){const o=t._selection.focusedCell.id,l=t._selection.focusedCell.dataField,a=t.columnByDataField[l];if(!a)return;if(a&&("image"===a.template||"attachment"===a.template||"richText"===a.template)){e.preventDefault();let n=(e.clipboardData||e.originalEvent.clipboardData).items,i=null,r=0,s=0,d=[];for(let e=0;e<n.length;e++)if(0===n[e].type.indexOf("image")&&(i=n[e].getAsFile(),r++,null!==i)){let e={label:i.name,size:i.size},n=new FileReader;n.onload=function(n){s++;const i=n.target.result;e.value=i;let c=!1;for(let o=0;o<t.uploadSettings.userFiles.length;o++){const l=t.uploadSettings.userFiles[o];if(l.name===e.label||l.label===e.label){c=!0;break}}if(c||t.uploadSettings.userFiles.push(e),d.push(e),s===r){let e=t.getCellValue(o,l);e||(e=[]),"string"==typeof e&&(e=JSON.parse(e)),e=[...e,...d];let n=e;if("richText"===a.template){const a=document.createElement("span");for(let t=0;t<e.length;t++){const o=document.createElement("img");o.src=e[t].value,o.title=o.name=e[t].label,a.appendChild(o)}t.setCellValue(o,l,a.outerHTML),n=a.outerHTML}else t.setCellValue(o,l,e);const i=t.rowById[o].getCell(l),r="";t.onCellUpdate&&t.onCellUpdate([i],[r],[e],(function(){t.onCellUpdated&&t.onCellUpdated([i.row.index],[i.row],[i.column],[i.row.data],[r],[e],t),t._onCellUpdated&&t._onCellUpdated(i.row.index,i.row,i.column,i.row.data,r,e)}),t)}},n.readAsDataURL(i)}}}}}_contextMenuHandler(e){if(this.contextMenu.enabled)return e.preventDefault(),e.stopPropagation(),!1;this._mobile&&(e.preventDefault(),e.stopPropagation())}get _tabindex(){return this.disabled||this.unfocusable?"":' tabindex="0"'}pageIndexValidator(e,t){const o=this;if(t<0)return 0;if(o.dataSource){if(o.dataSource.virtualDataSource)return t;const e=Math.ceil(o.dataSource.length/o._pageSize);if(t>e-1)return e-1}}_offsetTop(e){return e?e.offsetTop+this._offsetTop(e.offsetParent):0}_offsetLeft(e){return e?e.offsetLeft+this._offsetLeft(e.offsetParent):0}offset(e){return{left:this._offsetLeft(e),top:this._offsetTop(e)}}getBoundingRect(e){const t=this;let o=window.pageXOffset,l=window.pageYOffset,a=e.getBoundingClientRect();if(t.isInShadowDOM){const t=e.getBoundingClientRect();let o=window.pageXOffset,l=window.pageYOffset,a=e;for(;a&&a!==document.body&&a!==document.documentElement;){const e=a.parentNode;null!==a.scrollLeft&&(o+=a.scrollLeft),null!==a.scrollTop&&(l+=a.scrollTop);const t=a.getRootNode?a.getRootNode():null;if(t&&t instanceof ShadowRoot)a=t.host;else{if(!e||1!==e.nodeType)break;a=e}}return o+=window.pageXOffset,l+=window.pageYOffset,{top:t.top+l,left:t.left+o,right:t.right+o,bottom:t.bottom+l,width:t.width,height:t.height}}if(e!==document.body){let a=e.parentNode;for(;a!==document.body&&a;){a&&(o+=a.scrollLeft,l+=a.scrollTop);let e=a;a?(a=a.parentNode,t.enableShadowDOM&&a===t.shadowRoot?a=t:!t.isInShadowDOM||a!==t.getRootNode()&&e!==t.getRootNode()||(a=t.getRootNode().host)):t.isInShadowDOM&&(a=t.getRootNode().host)}}return{bottom:a.bottom+l,height:a.height,left:a.left+o,right:a.right+o,top:a.top+l,width:a.width}}_downHandler(e){this._downTarget=e.originalEvent.target}_removeCellContentPopup(){const e=this;e._cellContentPopup&&(e._cellContentPopup.remove(),e._cellContentPopup=null),e._cellContentPopupTimer&&(clearTimeout(e._cellContentPopupTimer),e._cellContentPopupTimer=null)}_upHandler(e){const t=this,o=t.getBoundingRect(t);if(super._upHandler(),t._spinTimeout&&clearTimeout(t._spinTimeout),t._spinInterval&&clearInterval(t._spinInterval),t._tapTimer&&clearTimeout(t._tapTimer),t._mobile&&e.originalEvent&&"pointercancel"===e.originalEvent.type)return;const l=()=>{if(t.editing.isEditing&&!t.editing.dialog.enabled){if(t._hasRichTextEditor)return;setTimeout((()=>{if(!e.defaultPrevented){if(t.editing.editCell&&t.editing.editCell.editor.instance){const o=t.editing.editCell.editor.instance;if(o.element&&o.element.hasAttribute("aria-owns")){const t=o.element.getAttribute("aria-owns"),l=document.getElementById(t);if(l&&l.contains(e.originalEvent.target))return}if(o.element&&o.element&&o.element.firstElementChild&&o.element.firstElementChild.hasAttribute("aria-owns")){const t=o.element.firstElementChild.getAttribute("aria-owns"),l=document.getElementById(t);if(l&&l.contains(e.originalEvent.target))return}if(e.originalEvent.target&&e.originalEvent.target.classList.contains("smart-editor-toolbar-item"))return;if(t.editing.editCell.editor.instance.blur(e),e.defaultPrevented)return}else if(t.editing.editRow){const o=t.editing.editRow.cells;for(let t=0;t<o.length;t++){const l=o[t];if(l&&l.editor&&l.editor.instance){if(l.editor.instance.element&&l.editor.instance.element.hasAttribute("aria-owns")){const t=l.editor.instance.element.getAttribute("aria-owns"),o=document.getElementById(t);if(o&&o.contains(e.originalEvent.target))return}if(l.editor.instance.element&&l.editor.instance.element.firstElementChild&&l.editor.instance.element.firstElementChild.hasAttribute("aria-owns")){const t=l.editor.instance.element.firstElementChild.getAttribute("aria-owns"),o=document.getElementById(t);if(o&&o.contains(e.originalEvent.target))return}if(e.originalEvent.target&&e.originalEvent.target.classList.contains("smart-editor-toolbar-item"))return;if(l.editor.instance.blur(e),e.defaultPrevented)return}}}t.isAttached&&t.endEdit()}}),50)}};if(e.originalEvent&&(e.originalEvent.target===t.$.scrollView&&t._downTarget===e.originalEvent.target&&l(),e.originalEvent.target.closest(".smart-grid-dialog")))t._dialogDragDetails&&(t._dialogDragDetails.started=!1);else{if(e.pageX<o.left||e.pageX>o.right||e.pageY<o.top||e.pageY>o.bottom){let o=!1,a=e.originalEvent.target;for(;a;){if(a=a.parentNode,a===t){o=!0;break}if(t.dropDownMode&&t.$.dropDownElement===a){o=!0;break}}if(o)return t._dragSelectionEnd(e),t._endResize(e),void t._endDrag(e);if(t._summaryRowDialog&&t._summaryRowDialog.classList.contains("open")&&t._summaryRowDialog.confirm(),t._inputOverlay&&(t._inputOverlay.classList.remove("smart-input-overlay-on"),setTimeout((()=>{t._inputOverlay&&(t._inputOverlay.parentNode&&t._inputOverlay.parentNode.removeChild(t._inputOverlay),t._inputOverlay=null)}),t.behavior.doubleClickTimingDelay)),l(),t.closeDropDown(),t.menu){let o,l,a,n;if(t.enableShadowDOM||t.isInShadowDOM?(o=e.originalEvent.composedPath()[0],l=function(){let e=o.getRootNode().host;for(;e;){if(e===t)return e;e=e.getRootNode().host}}(),a=t.menu.contains(o)||t.menu.firstElementChild.shadowRoot.contains(o),n=t.menu.firstElementChild.shadowRoot):(o=e.originalEvent.target,l=t.contains(o),a=t.menu.contains(o),n=t.menu),!l&&!a){const l=n.querySelectorAll("smart-drop-down-list"),a=n.querySelectorAll("smart-date-time-picker"),i=n.querySelectorAll("smart-date-input"),r=n.querySelectorAll("smart-input");for(let e=0;e<l.length;e++)if(l[e].$.dropDownContainer.contains(o))return;for(let e=0;e<a.length;e++)if(a[e].$.dropDownContainer.contains(o))return;for(let e=0;e<i.length;e++)if(i[e].$.scrollView.contains(o))return;for(let e=0;e<r.length;e++)if(r[e].$.scrollView.contains(o))return;return t.closeMenu(),t._dragSelectionEnd(e),t._endResize(e),void t._endDrag(e)}}}t._summaryRowDialog&&t._summaryRowDialog.classList.contains("open")&&t._summaryRowDialog.confirm(),t._dragSelectionEnd(e),t._endResize(e),t._endDrag(e)}}_nextColumn(e){const t=this;for(let o=0;o<t.viewColumns.length;o++){const l=t.viewColumns[o];if(l.visibleIndex===e.visibleIndex+1)return l}return null}_nextRow(e){const t=this._recyclingRows,o=t.indexOf(e);return o>=0?t[o+1]:null}_moveHandler(e){const t=this;if(t.isInitialized&&t._selection){if(t.selection.enabled&&t.selection.allowDragSelection&&!t.editing.isEditing&&(!t._selection.selectionRect||t._selection.selectionRect&&!t._selection.selectionRect.captured)&&(!0!==t._mobile&&t._dragSelection(e),e.originalEvent)){const o=e.originalEvent.target.closest?e.originalEvent.target:void 0;Smart.Utilities.Core.isMobile&&o&&o.closest("smart-grid")===t&&(e.originalEvent.preventDefault(),e.originalEvent.stopPropagation())}t.isScrolling||("none"===t.behavior.columnResizeMode||t.classList.contains("smart-grid-row-resize-mode")||t._columnMoveResizeHandler(e),"none"===t.behavior.rowResizeMode||t.classList.contains("smart-grid-column-resize-mode")||t._rowMoveResizeHandler(e),t._drag(e))}}_hideActionButtons(){const e=this;if(e._columnElements){for(let t=0;t<e._columnElements.length;t++){const o=e._columnElements[t],l=o.column;l&&l.autoShowActionButton&&o&&o._hideActionButton()}for(let t=0;t<e._frozenNearColumns.length;t++){const o=e._frozenNearColumns[t],l=o.element;o&&o.autoShowActionButton&&l&&l._hideActionButton()}}}_columnMouseLeaveHandler(){this._mobile||this._hideActionButtons()}_columnMoveHandler(e){const t=this;if(!t.isInitialized)return;if(t._columnResizeStartLine||t._rowResizeStartLine)return;if(t._mobile)return;const o=(o,l)=>{if(o&&o.autoShowActionButton){const a=l.getBoundingClientRect(),n=t.offset(l),i=t.parentElement,r=i?i.scrollTop:0,s=i?i.scrollLeft:0;if(n.left-s<=e.pageX&&n.left-s+a.width-10>=e.pageX)if(n.top-r<=e.pageY&&n.top-r+a.height>=e.pageY){if(!t.hasColumnMenu(o))return;l._showActionButton()}else l._hideActionButton();else l._hideActionButton()}};for(let e=0;e<t._columnElements.length;e++){const l=t._columnElements[e];o(l.column,l)}for(let e=0;e<t._frozenNearColumns.length;e++){const l=t._frozenNearColumns[e];o(l,l.element)}}_headerClickHandler(e){const t=this;if(t.$.headerBar){const o=t.isInShadowDOM||t.shadowRoot?e.composedPath()[0]:e.target;t.$.headerBar._headerClickHandler(o,t)}}_columnClickHandler(e){const t=this;if(t._overlay)return;if(void 0===e.clientX)return;const o=(t.enableShadowDOM?t.shadowRoot:t.getRootNode()).elementsFromPoint(e.clientX,e.clientY);let l=null,a=null;const n=new Date-t._columnClickTime<t.behavior.doubleClickTimingDelay;t._columnClickTime=new Date;for(let e=0;e<o.length;e++){const t=o[e];if(t.classList.contains("smart-action-button"))return;if(t.getAttribute("data-field")){l=t.getAttribute("data-field"),a=t;break}}if(l){const o=a.column;if(!o)return;if(e.srcElement.classList.contains("smart-filter-button"))return;if("_addNewColumn"===o.dataField)return void t._openAddColumnDialog();if(Smart.Utilities.Core.isMobile)n&&t.sorting.sortToggleOnClick&&o.allowSortToggleOnClick&&t.sorting.enabled&&(t.sortBy(l),t.autoSaveState()),t._columnMoveHandler(e),e.originalEvent&&e.originalEvent.preventDefault();else if(!n&&t.sorting.sortToggleOnClick&&o.allowSortToggleOnClick&&t.sorting.enabled){if("none"!==t.behavior.columnResizeMode&&"col-resize"===o.element.style.cursor)return;if(t._canSort=!0,""!==t.sorting.commandKey){if("Alt"===t.sorting.commandKey&&!1===e.altKey&&(t._canSort=!1),"Shift"===t.sorting.commandKey&&!1===e.shiftKey&&(t._canSort=!1),"Control"===t.sorting.commandKey&&!1===e.metaKey&&!1===e.ctrlKey&&(t._canSort=!1),"Control"!==t.sorting.commandKey&&e.ctrlKey)return;if(!0===t.sorting.sortToggleOnClickAndCommandKey&&!t._canSort)return}t.sortBy(l),t.autoSaveState()}}}_columnDownHandler(e){const t=this,o=(t.enableShadowDOM?t.shadowRoot:t.getRootNode()).elementsFromPoint(e.clientX,e.clientY);let l=null,a=null;const n=new Date-t._clickTime<t.behavior.doubleClickTimingDelay;t.$.headerBar&&t.$.headerBar.closePanel(),t._doubleClickHandler(e);for(let e=0;e<o.length;e++){const t=o[e];if(t.classList.contains("smart-action-button"))return;if(t.getAttribute("data-field")){l=t.getAttribute("data-field"),a=t;break}}if(l){const o=a.column;if(!o)return;if("_commandColumn"===l)return void(t.editing.commandColumn.dataSource.commandColumnMenu.visible&&t._applyCommand(t.editing.commandColumn.dataSource.commandColumnMenu.command));const i=function(a){const n=o.selectionColumn?t.selection.checkBoxes.action===a&&t.selection.enabled:t.selection.action===a&&t.selection.enabled;if("col-resize"!==o.element.style.cursor&&(!t.appearance.showColumnHeaderDragIcon||!e.originalEvent.target.classList.contains("smart-drag-handle"))&&n){if(t.editing.enabled&&t.editing.editColumn===o)return;if(e.shiftKey||e.ctrlKey||e.metaKey?t._dragSelectionStartDataField=null:t._dragSelectionStartDataField=l,"_checkBoxColumn"===l)return void t._toggleColumnSelection(o);"_rowHeaderColumn"===l&&t.selection.enabled&&t.selection.allowRowHeaderSelection&&t.appearance.showRowHeaderSelectIcon&&(delete t._areAllRowsSelected,t.areAllRowsSelected()?t.clearSelection():t.selectAllRows(),o.refresh()),t.selection.allowColumnHeaderSelection&&o.allowSelect&&t._setSelection(null,o.dataField,e)}};if(t.editing.isEditing&&t.endEdit(),i("click"),t._mobile){t._hideActionButtons();const o=(o,l)=>{if(o&&o.autoShowActionButton){const a=l.getBoundingClientRect(),n=t.offset(l);if(n.left<=e.pageX&&n.left+a.width-6>=e.pageX){if(!t.hasColumnMenu(o))return;l._showActionButton()}else l._hideActionButton()}};for(let e=0;e<t._columnElements.length;e++){const l=t._columnElements[e];o(l.column,l)}}if(t.$.fireEvent("columnClick",{column:o,dataField:o.dataField,originalEvent:e.originalEvent}),n&&(t.$.fireEvent("columnDoubleClick",{column:o,dataField:o.dataField,originalEvent:e.originalEvent}),i("doubleClick"),t._onColumnDoubleClick(o,e)),Smart.Utilities.Core.isMobile){const o=t.rightToLeft?a.getBoundingClientRect().left:a.getBoundingClientRect().right,n=10;if(o-n<=e.clientX&&e.clientX<=o+n){const o=t.columnByDataField[l];if(!o||o&&!o.allowResize)return;const n=t._isLastVisibleColumn(o);if("split"===t.behavior.columnResizeMode&&n)return;a.style.cursor="col-resize",a.sortButton.style.cursor="col-resize",a.filterButton.style.cursor="col-resize",t._columnToResizeRect=t.getBoundingRect(a),t._columnToResizeElement=a,t._columnToResizeDataField=l,e.preventDefault(),e.originalEvent&&e.originalEvent.preventDefault()}}if(t._columnToResizeElement&&!t._columnResizeLine)return t._columnDownResizeHandler(e),void(t._clickTime=new Date);if(t._beginDrag(e,o),o.menu)return void(t._clickTime=new Date)}t.closeMenu(),t._clickTime=new Date}addTransformMoveStyle(e,t,o,l,a,n){e.style.opacity=n,e.style["transition-duration"]=t,e.style.transform="translate3d("+o+"px,"+l+"px,"+a+"px)"}removeTransformMoveStyle(e){e.style.opacity="",e.style["transition-duration"]="",e.style.transform=""}_rowDownHandler(e){const t=this;if(t._inputOverlay&&t._inputOverlay.classList.remove("smart-input-overlay-on"),t._doubleClickHandler(e),t._closeMenu(t.menu),t._rowResizeHandler(e),t._removeCellContentPopup(),t._toggledRow&&t.appearance.allowRowToggleAnimation)return;if(e.target&&!e.target.classList.contains("smart-grid-row-container")&&!e.target.classList.contains("smart-grid-selection-overlay")&&!e.target.classList.contains("smart-selection-overlay-content"))return;let o=e.clientX,l=e.clientY;e.touches&&(o=e.touches[0].clientX,l=e.touches[0].clientY);const a=(t.enableShadowDOM?t.shadowRoot:t.getRootNode()).elementsFromPoint(o,l);let n=null,i=null,r=null,s=null,d=null,c=null,u=null,m=null;t._lastPointerDownTime=new Date;for(let p=0;p<a.length;p++){const g=a[p];if(g.hasAttribute("toggle-button")&&(i=g),g.hasAttribute("add-row")&&(d=g),g.hasAttribute("checkbox")&&(r=g),"A"===g.nodeName&&e.ctrlKey&&g.click(),g.hasAttribute("rating-value")&&(c=g),g.hasAttribute("vote-value")&&(u=g),!s&&"smart-grid-cell"===g.nodeName.toLowerCase()){if(s=g,g.hasAttribute("data-type")&&"string"===g.getAttribute("data-type")&&t.editing.enabled&&s.cell.column.allowEdit&&!s.cell.column.autoGenerated){const l=g.getAttribute("data-field"),a=g.closest("smart-grid-row").getAttribute("data-id"),n=g.getBoundingClientRect(),i=t.columnByDataField[l];if(o>=n.right-20&&("tags"===i.template||"list"===i.template||"dropdownlist"===i.template||"combobox"===i.template))return t._setSelection(a,l,e),t.beginEdit(a,l),e.stopPropagation(),void e.preventDefault()}if(g.hasAttribute("data-type")&&"date"===g.getAttribute("data-type")&&t.editing.enabled&&s.cell.column.allowEdit){const l=g.getAttribute("data-field"),a=g.closest("smart-grid-row").getAttribute("data-id");if(o>=g.getBoundingClientRect().right-20)return t._setSelection(a,l,e),t.beginEdit(a,l),e.stopPropagation(),void e.preventDefault()}if(g.hasAttribute("data-type")&&"number"===g.getAttribute("data-type")&&t.editing.enabled&&s.cell.column.allowEdit){const a=g.getAttribute("data-field"),n=g.closest("smart-grid-row").getAttribute("data-id"),i=g.getBoundingClientRect();if(o>=i.right-20){const o=()=>{let e=t.getCellValue(n,a);null!=e&&""!==e||(e=0);const o=e;let r=1;const s=t.columnByDataField[a];s&&s.formatSettings&&s.formatSettings.Intl&&("percent"===s.formatSettings.Intl.NumberFormat.style&&(r=.01),"currency"===s.formatSettings.Intl.NumberFormat.style&&void 0===s.formatSettings.Intl.NumberFormat.minimumFractionDigits&&(r=.01),s.formatSettings.Intl.NumberFormat.minimumFractionDigits>0&&(r=.01)),l>=i.top&&l<=i.bottom-i.height/2?e+=r:e-=r,s.editor&&(e>s.editor.max&&(e=s.editor.max),e<s.editor.min&&(e=s.editor.min)),t.setCellValue(n,a,e);const d=t.rowById[n].getCell(a);t.onCellUpdate&&t.onCellUpdate([d],[o],[e],(function(){t.onCellUpdated&&t.onCellUpdated([d.row.index],[d.row],[d.column],[d.row.data],[o],[e],t),t._onCellUpdated&&t._onCellUpdated(d.row.index,d.row,d.column,d.row.data,o,e)}),t)};return o(),clearTimeout(t._spinTimeout),t._spinTimeout=setTimeout((()=>{clearTimeout(t._spinTimeout),t._spinInterval=setInterval((()=>{t._spinInterval&&o()}),50)}),150),e.stopPropagation(),void e.preventDefault()}}}if(!m&&g.classList.contains("smart-card")&&(m=g),!n&&"smart-grid-row"===g.nodeName.toLowerCase()){n=g;break}}if("card"===t.view){if(m){const o=m.getAttribute("row-id"),l=t.rowById[o];if(l){const a=e.originalEvent?e.originalEvent:e,n=3===a.which;if(l.element||l.createElement(),t.$.fireEvent("rowClick",{row:l,id:l.id,data:t.getRowData(l.id),isRightClick:n,originalEvent:a,pageX:parseInt(a.pageX),pageY:parseInt(a.pageY)}),s){const e=s.getAttribute("data-field");if(e){const o=t.columnByDataField[e],i=new Smart.Grid.Cell(l,o,this);s.cell=i,i.element=s,i&&t.$.fireEvent("cellClick",{cell:i,id:l.id,dataField:i.column.dataField,value:i.value,isRightClick:n,originalEvent:a,pageX:parseInt(a.pageX),pageY:parseInt(a.pageY)})}}const i=e.originalEvent.target;if(m.classList.contains("smart-card-header"))l.element&&l.element.row!==l&&(l.element.row=l),l.toggle();else if(l.children&&l.children.length>0&&(i.classList.contains("smart-icon-ungroup")||i.classList.contains("smart-icon-group")))l.element&&l.element.row!==l&&(l.element.row=l),l.toggle();else if(t.editing.enabled){const l=t.editing.dialog.enabled,a=t.editing.mode;if(i.scrollHeight>i.offsetHeight){const o=t.offset(i);if(e.originalEvent.pageX>=o.left+i.offsetWidth-15)return}const n=t.context;t.context=t,t.editing.dialog.enabled=!0,t.editing.mode="row",t._settingsDialogRowId=o;let r=t._isUpdating;m.setAttribute("edit",""),t.beginEdit(o),t._isUpdating=r,t._endCardRowEdit?(t.removeEventListener("endEdit",t._endCardRowEdit,null),t.removeEventListener("cancelEdit",t._endCardRowEdit,null)):t._endCardRowEdit=()=>{t.context=t,t.editing.dialog.enabled=l,t.editing.mode=a,t.editing.isEditing=!1,t.context=n,delete t._settingsDialogRowId,delete t._dialogEdit},t.addEventListener("endEdit",t._endCardRowEdit),t.addEventListener("cancelEdit",t._endCardRowEdit)}}}return}c&&(t._ratingElement=c),u&&(t._voteElement=u);const p=!!e.originalEvent&&3===e.originalEvent.which;if(n&&s){const o=s?s.cell:null;if(o.row.filterRow||t._closeMenu(t.filterRowMenu),i&&o&&!o.column.rowDetailColumn&&i!==o.row.toggleDetailButton&&!i.classList.contains("row-detail"))n.row.toggle(e);else if(t.rowDetail.enabled&&t.rowDetail.visible&&i&&o&&o.column.rowDetailColumn&&!p){const e=n.row;if(t._overlay||e.header&&"row-resize"===e.header.style.cursor||e.header&&"row-resize"===e.header.parentElement.style.cursor)return;t.editing.isEditing&&t.cancelEdit(),e.showDetail?t.hideDetail(e.id):t.showDetail(e.id)}else if(d){const e=n.row,o=e.data;let l=o.parent;const a={};for(a[o.groupDataField]=null!==e.label?e.label:null,void 0!==e.labelValue&&(a[o.groupDataField]=e.labelValue);l;){let e=null!==l.label?l.label:null;l.labelValue&&void 0!==e&&(e=l.labelValue),a[l.groupDataField]=e,l=l.parent}t.addRow(a),setTimeout((()=>{t._conditionalColors&&t._conditionalColors.update&&t._conditionalColors.update()}),100)}else{const o=n.row,l=s?s.cell:null;if(l.column._treeColumn&&r)return void(o.checked=!o.checked);l.element===o.header&&t.behavior.allowRowReorder&&t._beginDrag(e,o),t._tapTimer&&clearTimeout(t._tapTimer),t._tapTimer=setTimeout((function(){t._clickedRow===n&&t.$.fireEvent("rowTap",{row:o,id:o.id,originalEvent:e.originalEvent}),t._clickedCell===s&&t.$.fireEvent("cellTap",{cell:l,id:o.id,dataField:l.column.dataField,originalEvent:e.originalEvent})}),t.behavior.doubleClickTimingDelay);const a=function(a){if(!t.selection.enabled||o.autoGenerated||!0!==o.allowSelect)return void delete t.__selectionStarted;if(t._overlay||o.header&&"row-resize"===o.header.style.cursor||o.header&&"row-resize"===o.header.parentElement.style.cursor)return;if(o.header&&"row-resize"===o.header.style.cursor){const a=t.offset(o.header);if(t._rowToResize&&a.left<=e.originalEvent.pageX&&e.originalEvent.pageX<=a.left+o.header.offsetWidth)return o.header.style.cursor="",void(t._rowToResize.onpointerup=()=>{const a=t.editing.isEditing;t._rowToResize&&(t._rowToResize.onpointerup=null),t._clickedRow===n&&!a&&!t._rowResizeLine&&l.column.rowHeaderColumn&&t.selection.allowRowHeaderSelection&&t._setSelection(o.id,l.column.dataField,e)});o.header.style.cursor=""}const i=t.editing.isEditing;if(i&&t.editing.editCell&&t.editing.editCell.row.id===o.id&&t.editing.editCell.column.dataField===l.column.dataField)return;if(i&&t.editing.editRow&&t.editing.editRow.id===o.id)return;const r=()=>{t.focus(),setTimeout((function(){t.focus()}),50)};if(t.selection.action===a){if(e.shiftKey||e.ctrlKey||e.metaKey||!t.selection.allowRowHeaderSelection&&l.column.autoGenerated?t._dragSelectionStartRow=null:t._dragSelectionStartRow=n.row,e.shiftKey||e.ctrlKey||e.metaKey?t._dragSelectionStartDataField=null:t._dragSelectionStartDataField=l.column.dataField,l.column.rowHeaderColumn&&!t.selection.allowRowHeaderSelection)return t._dragSelectionStartRow=null,void r();t._setSelection(o.id,l.column.dataField,e),r()}else(l.column.selectionColumn&&t.selection.checkBoxes.enabled&&t.selection.checkBoxes.action===a||l.column.rowHeaderColumn&&t.selection.allowRowHeaderSelection)&&(t._setSelection(o.id,l.column.dataField,e),r())},i=l.selected;t._clickTime||(t._clickTime=new Date);const d=t._clickedCell===s&&new Date-t._clickTime<t.behavior.doubleClickTimingDelay,c=e.originalEvent?e.originalEvent:e,u=3===c.which;if(u||"_commandColumn"===l.column.dataField||a("click"),t.$.fireEvent("rowClick",{row:o,id:o.id,data:t.getRowData(o.id),isRightClick:u,originalEvent:c,pageX:parseInt(c.pageX),pageY:parseInt(c.pageY)}),t.$.fireEvent("cellClick",{cell:l,id:o.id,dataField:l.column.dataField,value:l.value,isRightClick:u,originalEvent:c,pageX:parseInt(c.pageX),pageY:parseInt(c.pageY)}),u&&t.contextMenu.enabled){t.contextMenu.id=o.id,t.contextMenu.dataField=l.column.dataField;const e=t.getSelectedCells();let a=!0;if(t.contextMenu.dataField&&!t.contextMenu.dataField.startsWith("_"))if(e.length){for(let t=0;t<e.length;t++){const n=e[t],i=n[0],r=n[1];if(""+i==""+o.id&&l.column.dataField===r){a=!1;break}}t._focusCell(o.id,l.column.dataField,a),a&&t._selectCellsRange(o,o,l.column.dataField,l.column.dataField)}else{const e=t.getSelectedRowIds();(0===e.length||e.length>1)&&(t._focusCell(o.id,l.column.dataField),t._selectCellsRange(o,o,l.column.dataField,l.column.dataField))}else t._copyRects&&t._copyRects.length&&t.clearSelection(),t.selectRow(o.id);return t.openContextMenu(c.pageX+10,c.pageY+10),void(t.contextMenu.selector&&(c.stopPropagation(),c.preventDefault()))}if(o.autoGenerated||l.column.autoGenerated||"checkBox"===l.template&&e.originalEvent&&e.originalEvent.target&&e.originalEvent.target.classList.contains("smart-input"))t._onRowClick(o.index,o,e),t._onCellClick(l,e);else if(t.selection.enabled)if(t.selection.allowCellSelection)if("extended"===t.selection.mode){if(!0===i&&i===l.selected&&!t.selection.isDragging){const a=t._selection.focusedCell;a&&t._clickedCell&&a.id===l.row.id&&a.dataField===l.column.dataField&&a.id===t._clickedCell.cell.row.id&&a.dataField===t._clickedCell.cell.column.dataField&&(t._onRowClick(o.index,o,e),t._onCellClick(l,e))}}else d||(t._onRowClick(o.index,o,e),t._onCellClick(l,e));else if(t.selection.allowRowSelection)if("extended"===t.selection.mode){if(!0===i&&i===l.selected&&!t.selection.isDragging){const a=t._selection.focusedCell;t._clickedCell&&a.id===l.row.id&&a.id===t._clickedCell.cell.row.id&&(t._onRowClick(o.index,o,e),t._onCellClick(l,e))}}else d||(t._onRowClick(o.index,o,e),t._onCellClick(l,e));else t._onRowClick(o.index,o,e),t._onCellClick(l,e);else t._onRowClick(o.index,o,e),t._onCellClick(l,e);new Date-t._clickTime<t.behavior.doubleClickTimingDelay&&(t._clickedRow===n&&(t._onRowDoubleClick(o.index,o,e,e),t.$.fireEvent("rowDoubleClick",{row:o,id:o.id,data:t.getRowData(o.id),isRightClick:u,originalEvent:e.originalEvent,pageX:parseInt(c.pageX),pageY:parseInt(c.pageY)}),a("doubleClick")),t._clickedCell===s&&(t._onCellDoubleClick(l,e),t.$.fireEvent("cellDoubleClick",{cell:l,id:o.id,dataField:l.column.dataField,value:l.value,isRightClick:u,originalEvent:e.originalEvent,pageX:parseInt(c.pageX),pageY:parseInt(c.pageY)}))),t._clickedRow=n,t._clickedCell=s,t._clickTime=new Date,t.layout.allowCellsWrapShortcut&&t._clickedCell.hasAttribute("focus")&&t._clickedCell.hasAttribute("selected")&&e.shiftKey&&(t._cellContentPopupTimer&&clearTimeout(t._cellContentPopupTimer),t.selection.isDragging?t._removeCellContentPopup():l.autoWrap())}}}showDetail(e){const t=this.rowById[e];t&&(t.showDetail=!0)}hideDetail(e){const t=this.rowById[e];t&&(t.showDetail=!1)}_focusHandler(){this._focused=!0,this.setAttribute("focus","")}_blurHandler(){this._focused=!1,this.removeAttribute("focus")}_notify(e,t,o){const l=this;if(l.notifyFn)for(let a=0;a<l.notifyFn.length;a++)l.notifyFn[a](e,t,o)}notify(e){const t=this;e&&(t.notifyFn||(t.notifyFn=[]),t.notifyFn.push(e))}_applyTemplate(e,t){let o=null;if(null!==e&&""!==e)if(e&&"function"==typeof e)e(t);else if((e.startsWith("#")||e.startsWith("."))&&(o=document.querySelector(e)),o)t.innerHTML="",o instanceof HTMLElement&&!(o instanceof HTMLTemplateElement)?t.appendChild(o):t.appendChild(o.content.cloneNode(!0).firstElementChild);else{const o=function(e){const t=document.createElement("template");return e=e.trim(),t.innerHTML=e,t.content.firstChild}(e);o&&(t.innerHTML="",t.appendChild(o))}else t.innerHTML=""}refreshRelations(){const e=this;if(e.dataSourceSettings&&e.dataSourceSettings.relations&&e.dataSourceSettings.relations.length){for(let t=0;t<e.columns.length;t++){const o=e.columns[t];"dropdownGrid"===o.template&&(o._isDirty=!0)}e._recycle(!1);for(let t=0;t<e.columns.length;t++){const o=e.columns[t];"dropdownGrid"===o.template&&delete o._isDirty}}}propertyChangedHandler(e,t,o){const l=this;if(l.isInitialized){if("object"==typeof e)return o&&o.columns&&(l.__measuredColumnHeight=null),void l.render();switch(l._notify(e,t,o),e){case"dataSourceSettings_relations":return void l.refreshRelations();case"dataSourceSettings_transpose":return void l.render();case"onRowHistory":case"onRowInserted":case"stateSettings_current":return;case"highlighted":"kanban"===l.view&&l._kanban?(l._kanban.selectTask(o),l._kanban.ensureVisible(o)):"scheduler"===l.view&&l._scheduler&&l._scheduler.focusEvent(o);break;case"view":return void(l.$.headerBar&&l.$.headerBar._setView&&l.$.headerBar._setView(o,!0));case"users":case"currentUser":l._refreshCurrentUser(),l._recycle();break;case"summaryRow_visible":{for(let e=0;e<l.columns.length;e++)l._summaryRowCount=Math.max(l._summaryRowCount,l.columns[e].summary.length);const e=l.onRowInserted;l.onRowInserted=null,l._renderRows(!0),l.onRowInserted=e;break}case"conditionalFormatting":return l._renderConditionalFormatting(),void l.refresh();case"appearance_displayLoadingIndicator":return l._setLoadingIndicatorVisibility(),void l._recycle(!1);case"appearance_placeholder":return void(l.$.placeholder.innerHTML=o);case"appearance_showColumnHeaderLines":case"appearance_showColumnGroupLines":case"appearance_showColumnLines":case"appearance_showRowLines":return void l._recycle();case"appearance_allowColumnStickyPosition":o?l._stickHeader():l._unstickHeader();break;case"appearance_showColumnIcon":for(let e=0;e<l.columns.length;e++)l.columns[e].setProperty("showIcon",l.appearance.showColumnIcon);l._recycle();break;case"appearance_showRowHeaderNumber":case"appearance_showRowHeader":{l._initializeRowNumberColumn();const e=l._frozenNearColumns[0];e.rowHeaderColumn&&e.element&&!e.element.parentNode&&l.$.columnNearContainer.appendChild(e.element),l.refresh();break}case"header_visible":if(l.header.visible&&""===l.header.template){let e=l.$.header;l.header.appendTo&&(e=document.querySelector(l.header.appendTo),e?e.onclick=e=>{l._headerClickHandler(e)}:e=l.$.header),e.innerHTML='<smart-grid-toolbar header-position="top"></smart-grid-toolbar>',l.$.headerBar=e.firstElementChild,l.$.headerBar._init(l),l.header.onInit&&l.header.onInit(l.$.headerBar)}break;case"header_buttons":l.header.visible&&""===l.header.template&&l._refreshHeaderBar();break;case"header_template":l._applyTemplate(o,l.$.header);break;case"footer_template":l._applyTemplate(o,l.$.footer);break;case"layout_columnWidth":case"columnWidth":{l.columns.canNotify=!1;let e=parseInt(o);if(isNaN(e)&&(e=null),e>=30||null===e)for(let t=0;t<l.columns.length;t++)l.columns[t].width=e;l.columns.canNotify=!0,l.refresh();break}case"checkBoxes_visible":return void l._recycle();case"checkBoxes_hasThreeStates":return l.rows.canNotify=!1,l._applyThreeStates(l.rowHierarchy),l.rows.canNotify=!0,void l._recycle();case"columnHeader_visible":l.__columnHeaderHeight=null,l.refresh();break;case"selection_checkBoxes_enabled":l._selectionColumn.visible=o;break;case"selection_checkBoxes_autoShow":l._selectionColumn.element&&(o?l._selectionColumn.element.setAttribute("auto-show",""):l._selectionColumn.element.removeAttribute("auto-show"));break;case"selection_checkBoxes_position":{let e=l.viewColumns.indexOf(l._selectionColumn);l.viewColumns.canNotify=!1,l.viewColumns.splice(e,1);const t=l._frozenNearColumns.indexOf(l._selectionColumn),a=l._frozenFarColumns.indexOf(l._selectionColumn);if(t>=0&&l._frozenNearColumns.splice(t,1),a>=0&&l._frozenFarColumns.splice(a,1),"far"===o)l._selectionColumn.canNotify=!1,l._selectionColumn.freeze="far",l._selectionColumn.canNotify=!0,l._frozenFarColumns.splice(0,0,l._selectionColumn),l.viewColumns.push(l._selectionColumn),l.$.columnFarContainer.appendChild(l._selectionColumn.element);else{let e=0,t=0;for(let o=0;o<l.viewColumns.length&&(l.viewColumns[o].autoGenerated||l.viewColumns[o].dataField!==l.columns[t++].dataField);o++)l.viewColumns[o].autoGenerated&&e++;l._selectionColumn.canNotify=!1,l._selectionColumn.freeze="near",l._selectionColumn.canNotify=!0,l._frozenNearColumns.splice(e,0,l._selectionColumn),l.viewColumns.splice(e,0,l._selectionColumn),l.$.columnNearContainer.appendChild(l._selectionColumn.element)}l.viewColumns.canNotify=!0;break}case"selection_mode":if(l._selection&&(l._selection.focusedCell=null),l.selection.allowCellSelection)l.clearSelection();else if("one"===o){const e=l.getSelection();if(l.clearSelection(),e.rows&&e.rows[0]){e.rows[0].row.selected=!0;const t=l.rowById[e.rows[0].row.id].getCell(l.columns[0].dataField);l._selection&&(l._selection.focusedCell={id:t.row.id,dataField:t.column.dataField,value:t.value,index:t.row.index})}}break;case"grouping_groupBy":return l.dataSource&&l.dataSource.groupBy&&(l.dataSource.groupBy=o),void l.refresh();case"sorting_enabled":return void l.refresh();case"sorting_maintainSort":return void l._recycle(!1);case"filtering_enabled":return o&&0===l._filterPanels.length&&l._createFilterPanels(),void(l.header.visible&&l.refresh());case"filtering_filterRow_visible":return l._initializeRows(),l._initializeRowElements(),void l.refresh();case"filtering_operator":return void l.refreshFilters();case"filtering_filter":for(let e=0;e<l.columns.length;e++){const t=l.columns[e];t.canNotify=!1,t.setProperty("filter",null),t.canNotify=!0}for(let e=0;e<l.filtering.filter.length;e++){const t=l.filtering.filter[e];if(t&&t.splice){const e=t[0],o=t.splice(1);let a=null;if(o instanceof Smart.FilterGroup)a=o;else{const t=l.columnByDataField[e];t&&(a=l.dataSource._createFilter(t.dataType,o))}a&&l.addFilter(e,a,!1)}}return void l.refreshFilters();case"messages":case"locale":{if(l.columns)for(let e=0;e<l.columns.length;e++)l.columns[e]._cellsCachedValues=[];l._dialogEdit&&(l._dialogEdit.close(),l._dialogEdit=null),l._dialogDelete&&(l._dialogDelete.close(),l._dialogDelete=null),l._dialogAddRow&&(l._dialogAddRow.close(),l._dialogAddRow=null);const e=l.$.headerPager.querySelector("smart-pager"),t=l.$.footerPager.querySelector("smart-pager");e&&(e.locale=l.locale),t&&(t.locale=l.locale);const o=(e,t)=>{l._handleFilterMenuClick(e,t)};l._filterInfo||(l._filterInfo={}),l._filterInfo.stringConditions=[{icon:"smart-icon-contains",command:o,value:"CONTAINS",label:l.localize("CONTAINS")},{icon:"smart-icon-does-not-contain",command:o,value:"DOES_NOT_CONTAIN",label:l.localize("DOES_NOT_CONTAIN")},{icon:"smart-icon-starts-with",command:o,value:"STARTS_WITH",label:l.localize("STARTS_WITH")},{icon:"smart-icon-ends-with",command:o,value:"ENDS_WITH",label:l.localize("ENDS_WITH")},{icon:"smart-icon-equals",command:o,value:"EQUAL",label:l.localize("EQUAL")},{icon:"smart-icon-delete",command:o,value:"CLEAR_FILTER",label:l.localize("CLEAR_FILTER")}],l._filterInfo.numberAndDateConditions=[{icon:"smart-icon-equals",command:o,value:"EQUAL",label:l.localize("EQUAL")},{icon:"smart-icon-not-equal",command:o,value:"NOT_EQUAL",label:l.localize("NOT_EQUAL")},{icon:"smart-icon-less-than",command:o,value:"LESS_THAN",label:l.localize("LESS_THAN")},{icon:"smart-icon-less-than-equal",command:o,value:"LESS_THAN_OR_EQUAL",label:l.localize("LESS_THAN_OR_EQUAL")},{icon:"smart-icon-greater-than",command:o,value:"GREATER_THAN",label:l.localize("GREATER_THAN")},{icon:"smart-icon-greater-than-equal",command:o,value:"GREATER_THAN_OR_EQUAL",label:l.localize("GREATER_THAN_OR_EQUAL")},{icon:"smart-icon-between",command:o,value:"RANGE",label:l.localize("RANGE")},{icon:"smart-icon-delete",command:o,value:"CLEAR_FILTER",label:l.localize("CLEAR_FILTER")}],l._refreshHeaderBar(),l.$.headerBar&&(l.$.headerBar.messages=l.messages,l.$.headerBar.locale=l.locale,l.$.headerBar._localizeHeader(),l.$.headerBar._getInnerElementMessages()),l.grouping.groupBar.visible&&l._renderGroupBar(),l._recycle();break}case"paging_spinner_enabled":l._refresh();break;case"pager_visible":return l._renderPagers(),void l._refreshPaging(!1);case"paging_pageIndex":case"pager_position":case"paging_enabled":return void l._refreshPaging(!0);case"paging_pageSize":return void l._refreshPaging(!1);case"columns":{l.__measuredColumnHeight=null,l.editing&&l.editing.isEditing&&l.cancelEdit(),l._cellEditors=[];let e=!1;if(t&&t.length)for(let o=0;o<t.length;o++)if(t[o].freeze){e=!0;break}if(l.columns&&l.columns.length)for(let t=0;t<l.columns.length;t++)if(l.columns[t].freeze){e=!0;break}if(e&&l._initializeRowElements(),l.columns&&l._sortedColumns){const e=[];l.columns.forEach((t=>{t.sortOrder&&e.push(t)})),l._sortedColumns=JSON.parse(JSON.stringify(e))}l._renderColumns(),l._refreshHeaderBar();const o=l._sortedColumns;if(o){l.clearSort();for(let e=0;e<l.columns.length;e++)delete l.columns[e]._cellsCachedValues;l._refreshSort(o)}if(l.columns&&l.filtering.enabled){l.beginUpdate();for(let e=0;e<l.columns.length;e++){const t=l.columns[e];if(t.canNotify=!1,l.removeFilter(t.dataField),t.filtered=!1,t.canNotify=!0,t.filter){let e=null,o=t.filter;e=o instanceof Smart.FilterGroup?o:l.dataSource._createFilter(t.dataType||"string",o),e&&l.addFilter(t.dataField,e,!1)}}l.refreshFilters(),l.endUpdate()}return l.layout.isDirty=!0,l._resetCachedLayout(),void l._refreshLayout()}case"columnGroups":if(l._columnGroups=[],l._columnHeights=0,l.viewColumns)for(let e=0;e<l.viewColumns.length;e++){const t=l.viewColumns[e],o=t.element;t.top=0,t.level=0,o&&(o.style.top="",o.style.height="",o.style.lineHeight="")}return l.columns.canNotify=!1,l.columns=l._initColumns,l._renderColumns(),l.columns.canNotify=!0,l.__columnHeaderHeight=null,void l.refresh();case"dataSource":delete l._isFirstVirtualDataSourceRequest,l._isUpdating&&l.endUpdate();for(let e=0;e<l.columns.length;e++){const t=l.columns[e];t.editor&&(delete t.editor.isInitialized,delete t.editor.dataSource,delete t.editor._items,t.options&&(t.editor.dataSource=t.options),t.editor.isDirty=!0),t._cellsCachedValues=[],delete l._cellCachedValues,l._cellEditors=[]}if("dataSource"===e&&t&&o){const e=l.dataSource&&l.dataSource.virtualDataSource&&!l.dataSource.virtualDataSourceOnExpand&&"infinite"!==l.scrolling,a=e=>Array.isArray(e)&&e.every((e=>Array.isArray(e)));if(o&&a(o)){const e=[];for(let t=0;t<o.length;t++){const a={};for(let e=0;e<l.columns.length;e++){const n=l.columns[e];let i=o[t][e];if(n.options){const e=n.options.find((e=>e.label===i||e.value===i));e&&(i=e.value)}"date"===n.dataType&&null!==i&&(i=new Smart.Utilities.DateTime(i).toDate()),a[n.dataField]=i}e.push(a)}o=e}if(t instanceof Smart.DataAdapter&&!e){if(t.length===o.length&&t.length>0&&o.length>0&&!l.dataSourceSettings.childrenDataField&&!l.dataSourceSettings.parentDataField&&!t.parentDataField){if(l.dataSource=t,l._cachedDataSource===o)return;return setTimeout((()=>{let e=null;if(t&&l.dataSource&&l.dataSource._expandedRowIds){let t={};for(let e in l.dataSource._expandedRowIds){let o=""+e;o=o.replace("Item","").replace(/_/gi,"."),t[o]=!0}e=t}l.beginUpdate();const a=l._sortedColumns;l._sortedColumns&&l._sortedColumns.length>0&&void 0===l._getId()&&l.clearSort();for(let e=0;e<o.length;e++){const t=o[e],a=l.dataSource[e]?l.dataSource[e].$.id:e;l._updateRow(a,t,!0)}delete l.__autoRowHeight,l._virtualOnExpandCache=[],l._cellsMerge=[],l._cellStyles=[];const n=l._filters;if(l.clearSort(),l.filtering.filterRow)for(let e=0;e<l.columns.length;e++)l.columns[e]._filterEditorInitialized=!1;for(let e=0;e<l.columns.length;e++)delete l.columns[e]._cellsCachedValues;if(a&&l._refreshSort(a),n&&n.length>0&&(l._filters=null,l.refreshFilters()),l.grouping.enabled)for(let t in e)l._expandCollapseGroup(t,!0);l.endUpdate()})),l._cachedDataSource=o,void(l.header.visible&&""===l.header.template&&l.$.headerBar._init(l))}if(l.dataSource&&l.dataSource.url&&l.filtering.enabled&&l.filtering.filterRow.visible){let e=!1;for(let t=0;t<l.columns.length;t++)l.columns[t]._filterEditorInitialized&&(e=!0),l.columns[t]._filterEditorInitialized=!1;e&&setTimeout((()=>{l._refreshFilterRowEditors(),l.refreshFilters(),l._recycle(!1)}),100)}}}return l.dataSource&&l.dataSource.length>1e4?(l.appearance.displayLoadingIndicator=!0,l._setLoadingIndicatorVisibility(),setTimeout((()=>{l.dataBind()}),100),setTimeout((()=>{l.appearance.displayLoadingIndicator=!1,l._setLoadingIndicatorVisibility(),l._recycle(!1)}),200)):(l.dataSource&&l.dataSource instanceof Smart.DataAdapter&&l.columns&&l.dataSource.dataFields&&l.dataSource.dataFields.forEach((e=>{const t=l.columnByDataField[e.name];t&&(t.dataType=e.dataType)})),l.dataBind()),void(l.header.visible&&""===l.header.template&&l.$.headerBar._init(l));case"rowDetail_dialog_width":case"rowDetail_dialog_height":case"rowDetail_dialog_enabled":case"rowDetail_dialog_visible":return;case"rowDetail_height":case"rowDetail_enabled":{l.beginUpdate(),l.rows.canNotify=!1;const e=l.appearance.allowRowDetailToggleAnimation;l.appearance.allowRowDetailToggleAnimation=!1;for(let e=0;e<l._recyclingRows.length;e++){const t=l._recyclingRows[e];t.height=null,t.setProperty("showDetail",!1),t.detailHeight=l.rowDetail.height}if(l.rows.canNotify=!0,l.rowDetail.enabled){let t=!1;for(let e=0;e<l.viewColumns.length;e++)if(l.viewColumns[e].rowDetailColumn){t=!0;break}if(!t)return l.appearance.allowRowDetailToggleAnimation=e,l.endUpdate(),void l._renderColumns(!0)}else for(let e=0;e<l.viewColumns.length;e++){const t=l.viewColumns[e];if(t.rowDetailColumn){t.visible=!1;break}}return l.appearance.allowRowDetailToggleAnimation=e,void l.endUpdate()}case"rowDetail_visible":for(let e=0;e<l.viewColumns.length;e++){const t=l.viewColumns[e];if(t.rowDetailColumn){t.visible=o;break}}return;case"displayLoadingIndicator":return void l._setLoadingIndicatorVisibility();case"filterable":return void l._refreshLayout();case"layout_allowCellsWrap":{const e=l.columns.canNotify;l.columns.canNotify=!1;for(let e=0;e<l.columns.length;e++)l.columns[e].cellsWrap=o;return l.layout.isDirty=!0,l._resetCachedLayout(),l._refreshLayout(),l.refresh(),void(l.columns.canNotify=e)}case"showViewBar":return l.layout.isDirty=!0,l._resetCachedLayout(),l._refreshLayout(),void l.refresh();case"layout_autoHeight":case"layout_autoWidth":case"layout_columnMinHeight":case"layout_rowMinHeight":case"layout_columnHeight":case"layout_rowHeight":return l.layout.isDirty=!0,l._resetCachedLayout(),l._refreshLayout(),void l.refresh();case"rightToLeft":return void l.refresh();case"selectionMode":return;case"editing_addNewColumn_visible":l._addNewColumn?(l._addNewColumn.visible=o,l.refresh()):l._renderColumns();break;case"editing_addNewRow_displayMode":{"row"===l.editing.addNewRow.displayMode&&l.editing.addNewRow._addButton&&(l.editing.addNewRow._addButton.remove(),delete l.editing.addNewRow._addButton);const e=l._scrollView.vScrollBar;return e.style.height="",e.style.top="",e.style.setProperty("--smart-scroll-bar-near-size","0px"),l._renderAddNewRow(),void l.refresh(!0)}case"editing_addNewRow_label":case"editing_addNewRow_visible":case"editing_addNewRow_position":return!1===l.editing.addNewRow.visible&&"row"!==l.editing.addNewRow.displayMode&&(l.editing.addNewRow._addButton&&l.editing.addNewRow._addButton.remove(),l._newRow&&l._newRow.element.classList.add("smart-hidden")),l._renderAddNewRow(),void l.refresh();case"editing_enabled":o?l.$.content.removeAttribute("aria-readonly"):l.$.content.setAttribute("aria-readonly",!0);break;case"editing_dialog_visible":return;case"editing_commandBar_dataSource_commandBarAddRow_visible":case"editing_commandBar_dataSource_commandBarDeleteRow_visible":case"editing_commandBar_dataSource_commandBarBatchSave_visible":case"editing_commandBar_dataSource_commandBarBatchRevert_visible":case"editing_commandBar_visible":case"editing_commandBar_displayMode":case"editing_commandBar_position":l._renderCommandBar();break;case"editing_commandColumn_position":l._renderColumns(!0);break;case"editing_commandColumn_visible":return void l.refresh(!0);case"editing_commandColumn_inline":return l._commandColumn.visible=l.editing.commandColumn.visible&&!l.editing.commandColumn.inline,void l.refresh(!0);case"layout_isDirty":return;case"editing_commandColumn_dataSource_commandColumnCustom_label":case"editing_commandColumn_dataSource_commandColumnCustom_icon":case"editing_commandColumn_dataSource_commandColumnCustom_visible":case"editing_commandColumn_dataSource_commandColumnUpdate_label":case"editing_commandColumn_dataSource_commandColumnUpdate_icon":case"editing_commandColumn_dataSource_commandColumnUpdate_visible":case"editing_commandColumn_dataSource_commandColumnEdit_label":case"editing_commandColumn_dataSource_commandColumnEdit_icon":case"editing_commandColumn_dataSource_commandColumnEdit_visible":case"editing_commandColumn_dataSource_commandColumnDelete_label":case"editing_commandColumn_dataSource_commandColumnDelete_icon":case"editing_commandColumn_dataSource_commandColumnDelete_visible":case"editing_commandColumn_displayMode":return delete l.__cellsCommandTemplate,void l.refresh(!0)}l.refresh()}}ready(){const e=this;e.disableSwipeScroll=!0,super.ready(),e._renderInDropDown();const t=e._scrollView.vScrollBar,o=e._scrollView.hScrollBar;t.hasStyleObserver=!1,o.hasStyleObserver=!1,t.hasResizeObserver=!1,o.hasResizeObserver=!1,t.wait=!1,o.wait=!1,t.onChange=e._verticalScrollbarHandler.bind(e),o.onChange=e._horizontalScrollbarHandler.bind(e),e.setFocusable(!0),e.$.loadingIndicatorPlaceholder.innerHTML=e.messages[e.locale]&&e.messages[e.locale].loadingIndicatorPlaceholder?e.localize("loadingIndicatorPlaceholder"):e.appearance.loadingIndicatorPlaceholder,e.$.placeholder.innerHTML=e.messages[e.locale]&&e.messages[e.locale].placeholder?e.localize("placeholder"):e.appearance.placeholder,e._setLoadingIndicatorVisibility(),e._cellsMerge=[],e._cellStyles=[],e._details=[],e.checkLicense()}_createFilterPanels(){const e=this;if(e._filterPanels){if(e._filterPanels.length>0)return}else e._filterPanels=[];if(e.filtering.enabled&&0===e._filterPanels.length){if(e.header.visible&&e.header.buttons.indexOf("filter")>=0)return;requestAnimationFrame((()=>{const t=document.createElement("smart-filter-panel"),o=document.createElement("smart-filter-panel"),l=document.createElement("smart-filter-panel"),a=document.createElement("smart-filter-panel");o.filterType="boolean",l.filterType="numeric",a.filterType="date",e._filterPanels.bool=o,e._filterPanels.date=a,e._filterPanels.numeric=l,e._filterPanels.string=t;for(let t in e._filterPanels){const o=e._filterPanels[t];o.rightToLeft=e.rightToLeft,o.classList.add("smart-hidden"),e.$.content.appendChild(o),o.parentNode.removeChild(o)}}))}}_applyScrolling(){const e=this,t=e._scrollView.vScrollBar;requestAnimationFrame((()=>{switch(t.largeStep=e.$.scrollView.offsetHeight,e.scrolling){case"physical":case"infinite":case"virtual":t.step=e.layout.rowMinHeight,t.mechanicalAction="switchWhileDragging";break;case"deferred":t.step=10,t.mechanicalAction="switchWhenReleased";break;case"logical":t.step=e.layout.rowMinHeight,t.mechanicalAction="switchWhileDragging"}}))}_measureRowElement(e){const t=new Smart.Grid.Row({data:e,index:999999,grid:this});if(!t)return null;const o=t.createElement();return o.classList.add("smart-grid-measure-row"),this.$.scrollView.appendChild(o),o.style.height="",o.style.lineHeight="",o.style.height="",o.style.lineHeight="",t._isMeasureRow=!0,t.render(),o}get _autoRowHeight(){const e=this;if(e.__autoRowHeight)return e.__autoRowHeight;let t=e.layout.rowMinHeight;if(!e.dataSource||e.dataSource&&0===e.dataSource.length)return t;const o=new Smart.Grid.Row({index:0,grid:e}),l=o.createElement();e.$.scrollView.appendChild(l),e.removeAttribute("grouped"),e.removeAttribute("tree"),e.grouping.enabled&&e.dataSource.groupBy&&e.dataSource.groupBy.length>0?e.setAttribute("grouped",""):e.dataSource.boundHierarchy&&e.setAttribute("tree","");const a={};if(e.dataSource.dataFields)for(let t=0;t<e.dataSource.dataFields.length;t++)a[e.dataSource.dataFields[t].name]="ABCDEFHIJLMNOPQRSTUVWXYZ1234567910|";o.data=a,o._isMeasureRow=!0,o.render(),l.style.height="",l.style.lineHeight="",t=Math.max(l.offsetHeight,t);for(let e=0;e<l.children.length;e++)l.children[e].style.height="";for(let a=0;a<l.children[1].children.length;a++){if(l.children[1].children[a].style.height="auto",e.columns[0]){const t=o.getCell(e.columns[0].dataField);t&&t.render()}t=Math.max(t,8+l.children[1].children[a].offsetHeight);break}return e.$.scrollView.removeChild(l),e.__autoRowHeight=t,e.layout.rowMinHeight&&t<e.layout.rowMinHeight&&(e.__autoRowHeight=e.layout.rowMinHeight),t}get _scrollHeight(){const e=this,t="card"===e.view;let o=e._recyclingRows,l=0,a=e._autoRowHeight,n=0,i=0;if(e.__scrollHeight)return e.__scrollHeight;if(0===o.length||0===e.columns.length||!e.hasVisibleColumn())return 0;let r=40,s=1,d=0;if(t){for(let t=0;t<e.viewColumns.length;t++){const o=e.viewColumns[t];o.visible&&!o.autoGenerated&&(r+=e.layout.cardRowMinHeight,d++,o.cardHeight&&(r-=e.layout.cardRowMinHeight,r+=o.cardHeight*e.layout.cardRowMinHeight))}let t=e.offsetWidth;!e.appearance.showViewBar||e.appearance.viewBarAppendTo||e.appearance.showViewBarAsDropdown||(t-=e.layout.viewBarWidth+5),s=t<e.layout.cardMinWidth?1:"auto"===e.layout.cardsPerRow?Math.floor(t/e.layout.cardMinWidth):e.layout.cardsPerRow,1===s&&(r+=5*d),e._cardHeight=r}e._cardsPerRow=s,e.rows.canNotify=!1;const c=e._measureRowElement(o[0].data),u=o.length;for(let s=0;s<u;s++){let d=o[s];if(!d.visible||!1===d.filtered){d.height=0,d.cellHeight=0,d.top=l;continue}const u=e.rowDetail.enabled&&d.showDetail&&!e.rowDetail.dialog.enabled;let m=!d.height||!d.cellHeight||u||"auto"===d.height||"auto"===d._height||"auto"===e.layout.rowHeight||e.layout.isDirty;if(t&&d.height!==r&&(d.height=d.cellHeight=r),m&&!d.expandHeight){if(d.detailHeight||(d.detailHeight=200),t)d.height=d.cellHeight=r;else if(e.layout.rowHeight){if(e.layout.rowHeight)if("number"==typeof e.layout.rowHeight)e.layout.rowHeight<e.layout.rowMinHeight&&(e.layout.rowHeight=e.layout.rowMinHeight),d.height=e.layout.rowHeight,d.computedHeight&&(d.height=d.computedHeight),d.minHeight>d.height&&(d.height=d.minHeight),void 0!==d.label&&"advanced"===e.grouping.renderMode&&(d.height=e.grouping.groupRowHeight),d.cellHeight=d.height,e.rowDetail.enabled&&d.showDetail&&!e.rowDetail.dialog.enabled&&(d.height+=d.detailHeight);else if("auto"===e.layout.rowHeight){e.layout.rowHeight<e.layout.rowMinHeight&&(e.layout.rowHeight=e.layout.rowMinHeight),d.element=c,d.grid=e,d.element&&d.element.classList.contains("smart-hidden")&&d.element.classList.remove("smart-hidden");const t=d.data&&e.isRendered?d._autoSize(d):a,o=d.canNotify;d.canNotify=!1,d.height=t,d.computedHeight&&(d.height=d.computedHeight),void 0!==d.label&&"advanced"===e.grouping.renderMode&&(d.height=e.grouping.groupRowHeight),d.cellHeight=d.height,e.rowDetail.enabled&&d.showDetail&&!e.rowDetail.dialog.enabled&&(d.height+=d.detailHeight),d.canNotify=o}else e.layout.rowHeight(s,d),d.height||(d.height=a),d.cellHeight=d.height,e.rowDetail.enabled&&d.showDetail&&!e.rowDetail.dialog.enabled&&(d.height+=d.detailHeight)}else{if("auto"===d.height||"auto"===d._height){d.element=c,d.element&&d.element.classList.contains("smart-hidden")&&d.element.classList.remove("smart-hidden");const t=d.data&&e.isRendered?d._autoSize(d):a;d.height=t,d._height="auto"}else d.height=a;void 0===d.label||d.summaryRow||"advanced"!==e.grouping.renderMode||(d.height=e.grouping.groupRowHeight),d.computedHeight&&(d.height=d.computedHeight),d.cellHeight=d.height,e.rowDetail.enabled&&d.showDetail&&!e.rowDetail.dialog.enabled&&(d.height+=d.detailHeight)}e._rowGap&&s<e.rows.length-1&&(d.height+=e._rowGap)}!t&&(!0===d.freeze||"near"===d.freeze?d.visible&&(n+=d.height):"far"===d.freeze&&d.visible&&(i+=d.height),d.freeze&&d.visible)?d.top=l:(d.top!==l&&(d.top=l),d.expandHeight?l+=d.cellHeight:l+=d.height)}if(e._summaryRowCount&&e.summaryRow.visible&&(l+=1*a),e.editing.addNewRow&&"row"!==e.editing.addNewRow.displayMode&&(l+=1*a),e.filtering&&e.filtering.filterRow.visible&&(n+=a),e.editing.addNewRow&&"button"!==e.editing.addNewRow.displayMode&&e.rowHierarchy&&e.editing.addNewRow.visible&&(l+=a,"far"!==e.editing.addNewRow.position&&(n+=a)),e.dataSource&&e.dataSource.virtualDataSource&&!1===e.paging.enabled){let t=e.dataSource.length>e.virtualModeCachedRowsCount?e.virtualModeCachedRowsCount:e.dataSource.length;"infinite"===e.scrolling&&(t=e.dataSource.length),"virtual"===e.scrolling&&t>=e.virtualModeCachedRowsCount&&(l=e.rows[0]?e.rows[0].height*e.dataSource.length:e.layout.rowMinHeight*e.dataSource.length)}return t&&(l=r*Math.ceil(o.length/s)),e.__scrollHeight=l,e.__frozenNearHeight=n,e.__frozenFarHeight=i,e._scrollView.scrollHeight=l-e.$.scrollView.offsetHeight+n+i,l=e.__scrollHeight+n+i-1,e.grouping.enabled&&e.dataSource.groupBy&&e.dataSource.groupBy.length>0&&e.grouping.groupIndent>0&&"advanced"===e.grouping.renderMode&&(l+=parseInt(e.grouping.groupIndent/2)),e.__scrollHeight=l,c.remove(),o[0]&&delete o[0]._isMeasureRow,e.rows.canNotify=!0,l}_measureColumnHeight(){const e=this;if(e.__measuredColumnHeight)return e.__measuredColumnHeight;const t=document.createElement("smart-grid-column");t.style.height="auto",t.style.position="static";const o=document.createElement("div");o.classList.add("smart-label"),o.innerHTML="aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRwWxXyYzZ1234567890",t.appendChild(o),e.$.columnHeader.appendChild(t);let l=e.$.columnHeader.offsetHeight;return e.$.columnHeader.removeChild(t),e._columnHeights&&e._columnHeights.length>1&&(l=e._columnHeights[0]),l<e.layout.columnMinHeight&&(l=e.layout.columnMinHeight),e.__measuredColumnHeight=l,l}_initializeColumnGroupsHierarchy(){const e=this;let t=0;e.$.columnContainer.innerHTML="";const o=JSON.parse(JSON.stringify(e.columnGroups));if(o.length>0){for(let t=0;t<o.length;t++)o[t].parent=null,o[t].groups=null,o[t].labelTemplate=e.columnGroups[t].labelTemplate;for(let t=0;t<e.viewColumns.length;t++)e.viewColumns[t].parent=null,e.viewColumns[t].groups=null;const l=function(e){for(let t=0;t<o.length;t++){let l=o[t];if(l.name===e)return l}return null},a=function(e){let t=new Array;if(e.columnGroup&&t.push(e),e.groups)for(let o=0;o<e.groups.length;o++)if(e.groups[o].columnGroup)t.push(e.groups[o]);else if(e.groups[o].groups){let l=a(e.groups[o]);for(let e=0;e<l.length;e++)t.push(l[e])}return t};for(let e=0;e<o.length;e++){let t=o[e];if(t.groups||(t.groups=null),t.parentGroup){let e=l(t.parentGroup);e&&(t.parent=e,e.groups||(e.groups=new Array),-1===e.groups.indexOf(t)&&e.groups.push(t))}}for(let t=0;t<e.viewColumns.length;t++){let o=e.viewColumns[t];if(o.columnGroup){let e=l(o.columnGroup);e&&(e.groups||(e.groups=new Array),o.parent=e,-1===e.groups.indexOf(o)&&e.groups.push(o))}}for(let o=0;o<e.viewColumns.length;o++){const l=e.viewColumns[o];let a=l;for(l.level=0;a.parent;)a=a.parent,l.level++;a=l;let n=l.level;for(t=Math.max(t,l.level);a.parent;)a=a.parent,a&&(a.level=--n)}for(let t=0;t<o.length;t++){const l=o[t],n=a(l);l.columns=n;let i=new Array,r=0,s="near";0===n.length&&(r=-1,l.visible=!1);for(let t=0;t<n.length;t++)i.push(e.viewColumns.indexOf(n[t])),n[t].freeze&&("far"===n[t].freeze&&(s="far"),r++);r===n.length?l.freeze=s:r>0&&r<n.length&&(e.classList.add("smart-visibility-hidden"),e.error(e.localize("frozenColumns",{elementType:"Grid"}))),i.sort((function(e,t){return(e=parseInt(e))<(t=parseInt(t))?-1:e>t?1:0}));for(let t=1;t<i.length;t++)i[t]!==i[t-1]+1&&(e.classList.add("smart-visibility-hidden"),e.error(e.localize("columnGroups",{elementType:"Grid"})))}}e._columnGroupsLevel=1+t,e._columnGroups=o;for(let t=0;t<e._columnGroups.length;t++){const o=e._columnGroups[t];o.collapsible&&e._initializeColumnGroupCollapsing(o)}}_initializeColumnGroupCollapsing(e){const t=this;e.collapsed=e.collapsed||!1,e.collapseButton=document.createElement("div"),e.collapseButtonIcon=document.createElement("span"),e.collapseButton.appendChild(e.collapseButtonIcon),e.collapseButton.classList.add("smart-grid-column-group-collapse-button"),e.collapseButtonIcon.classList.add("smart-grid-icon",e.collapsed?"smart-icon-right":"smart-icon-left","show"),e.collapseButton.setAttribute("role","button"),e.collapseButton.setAttribute("aria-label",t.localize(e.collapsed?"expand":"collapse"));const o=(e,l)=>{if(e.collapsed=l,e.collapseButtonIcon.classList.remove("smart-icon-left"),e.collapseButtonIcon.classList.remove("smart-icon-right"),e.collapsed?e.collapseButtonIcon.classList.add("smart-icon-right"):e.collapseButtonIcon.classList.add("smart-icon-left"),t.beginUpdate(),e.collapsed){const t=e=>{let t=0;for(let o=0;o<e.columns.length;o++){const l=e.columns[o];l.allowCollapse&&(l.visible=!1,t++)}t===e.columns.length&&e.columns[0]&&!e.inline&&(e.columns[0]._visible=!0,e.columns[0].visible=!0)};if(e.groups){let l=!1;for(let t=0;t<e.groups.length;t++){const a=e.groups[t];a.columnGroup?l=!0:o(a,e.collapsed)}l&&t(e)}else t(e)}else{const t=e=>{for(let t=0;t<e.columns.length;t++)e.columns[t].visible=!0};if(e.groups){let l=!1;for(let t=0;t<e.groups.length;t++){const a=e.groups[t];a.columnGroup?l=!0:o(a,e.collapsed)}l&&t(e)}else t(e)}t.endUpdate(),e.collapseButton.setAttribute("aria-label",t.localize(e.collapsed?"expand":"collapse"))};e.collapsed&&requestAnimationFrame((()=>{o(e,e.collapsed)})),e.collapseButton.addEventListener("click",(function(t){t.stopPropagation(),o(e,!e.collapsed)}))}_refreshColumnHeights(){const e=this;if("card"===e.view)return;e.$.columnHeader.style.height="",e._viewColumnsHeight=e._measureColumnHeight(),e._columnHeights=[];let t=0;for(let o=0;o<e._columnGroupsLevel;o++){let l=e._viewColumnsHeight;e.layout.columnHeight&&(l="number"==typeof e.layout.columnHeight?e.layout.columnHeight?e.layout.columnHeight:e._viewColumnsHeight:e.layout.columnHeight?e.columnHeight(o):e._viewColumnsHeight),l<e.layout.columnMinHeight&&(l=e.layout.columnMinHeight),l?(e._columnHeights.push(l),t+=l):(t+=e._viewColumnsHeight,e._columnHeights.push(e._viewColumnsHeight))}e._columnHeaderHeight=e._columnGroupsLevel*e._viewColumnsHeight,e._columnHeaderHeight=t,e.$.columnHeader.style.height=e._columnHeaderHeight+"px";const o=function(t){let o=0;for(let l=0;l<t.level;l++)o+=e._columnHeights[l];return o},l=function(t){let l=o(t),a=e._columnHeaderHeight-l;for(let o=t.level+1;o<e._columnHeights.length;o++){const l=o;for(let o=0;o<e.viewColumns.length;o++){const n=e.viewColumns[o];let i=!1;if(n.level===l){let o=n;for(;o.parent;){if(o.parent===t){a=e._columnHeights[l],i=!0;break}o=o.parent}if(i)break}}}return a};for(let t=0;t<e.viewColumns.length;t++){const a=e.viewColumns[t],n=l(a);a.computedHeight=n,a.top=o(a)}for(let t=0;t<e._columnGroupsLevel-1;t++)for(let a=0;a<e._columnGroups.length;a++){const n=e._columnGroups[a];if(n.level!==t)continue;if(n.groups){const e=l(n),t=o(n);n.top=t,n.computedHeight=e}const i=n.element;i&&(i.style.width=n.computedWidth+"px",e.rightToLeft?i.style.right=n.left+"px":i.style.left=n.left+"px",i.style.top=n.top+"px",i.style.height=n.computedHeight+"px",i.style.lineHeight=n.computedHeight+"px")}}_refreshColumnWidths(){const e=this;e.__clientSize=null;const t=e.$.verticalScrollBar.offsetWidth>0?e.$.verticalScrollBar.offsetWidth:0,o=e.dataSource.groupBy||[];let l=e.grouping.enabled&&"advanced"===e.grouping.renderMode?e.grouping.groupIndent*(1+o.length):0,a=0;e.selection.checkBoxes.enabled&&(a=e._selectionColumn.computedWidth?e._selectionColumn.computedWidth:e._selectionColumn.minWidth);const n=e._clientSize.width-t-l;let i=0,r=[],s=0,d=0,c=0;if(e.editing.enabled&&!e.editing.commandColumn.inline){const t=function(){const t=document.createElement("div"),o=document.createElement("div"),l=e.editing.commandColumn.dataSource;let a=0,n="",i=0;o.classList.add("smart-label");for(let t in l){const o=l[t];let a=!1;if("commandColumnMenu"===t)continue;let r=!1;a||(!0===o.visible?(i++,r=!0):"auto"===o.visible&&((e.editing.editRow||e.editing.editCell)&&!e.editing.dialog.enabled||"commandColumnEdit"!==t?!e.editing.editRow&&!e.editing.editCell||e.editing.dialog.enabled||("commandColumnUpdate"===t||"commandColumnCancel"===t)&&(i++,r=!0):(i++,r=!0)),a=!0),r&&"icon"!==e.editing.commandColumn.displayMode&&(n+="<span>"+("{{messages}}"===o.label?e.localize(t):o.label)+"</span>")}return o.innerHTML="<span>"+n+"</span>",t.appendChild(o),t.style.width="auto",t.style.position="static",e.$.columnHeader.appendChild(t),a=10+o.firstChild.offsetWidth,e.$.columnHeader.removeChild(t),"icon"===e.editing.commandColumn.displayMode?a=20+20*i:"labelAndIcon"===e.editing.commandColumn.displayMode?a+=25*i:a+=10*i,a};if(e._commandColumn.visible=e.editing.commandColumn.visible,e.editing.commandColumn.visible){const o=e.editing.commandColumn.width?e.editing.commandColumn.width:t();e.columns.canNotify=!1,e._commandColumn.width=o,e.columns.canNotify=!0}}for(let t=0;t<e.viewColumns.length;t++){const o=e.viewColumns[t];let l;"number"==typeof o.width?l=o.width:o.width&&o.width.toString().indexOf("%")>=0?(l=parseFloat(o.width)/100,l*=n-a):o.width&&(o.width.toString().indexOf("em")>=0||o.width.toString().indexOf("pt")>=0||o.width.toString().indexOf("fr")>=0)?(l=parseFloat(o.width),l*=16):"auto"===o.width?l=o._autoSize():o.visible&&(r.push(o),l=0),o.overflowWidth&&(l-=o.overflowWidth),o.visible&&(i+=l),l<o.minWidth&&(l=o.minWidth),o.computedWidth=l}if(r){let e=n-i,t=0;e<0&&(e=60*r.length);for(let o=0;o<r.length;o++){const l=r[o];let a;a=e/r.length,o===r.length-1&&(a=e-t),l.overflowWidth&&(a-=l.overflowWidth),a<l.minWidth&&(a=l.minWidth),l.computedWidth=a,t+=a}}for(let t=0;t<e.viewColumns.length;t++){let o=e.viewColumns[t];o.visible&&(l>0&&!o.autoGenerated&&(o.computedWidth+=l,l=0),o.freeze?!0===o.freeze||"near"===o.freeze?(o.left=s,c+=o.computedWidth,s+=o.computedWidth):"far"===o.freeze&&(o.left=d,d+=o.computedWidth):(o.left=c,c+=o.computedWidth))}for(let t=0;t<e._columnGroupsLevel-1;t++)for(let o=0;o<e._columnGroups.length;o++){const l=e._columnGroups[o];if(l.level!==t)continue;let a=99999;if(l.groups){const e=function(t){let o=0;for(let l=0;l<t.groups.length;l++){let n=t.groups[l];n.groups?o+=e(n):n.visible&&(a=Math.min(n.left,a),o+=n.computedWidth)}return o};l.computedWidth=e(l),l.left=a}}}_createColumnHeaderCellElements(){const e=this,t=e.$.columnContainer,o=document.createDocumentFragment();let l=0;e._columnElements=[],e.$.columnContainer.innerHTML="",e.$.columnNearContainer.innerHTML="",e.$.columnFarContainer.innerHTML="",e.rightToLeft?(e.$.columnNearContainer.classList.remove("near"),e.$.columnNearContainer.classList.add("far"),e.$.columnFarContainer.classList.remove("far"),e.$.columnFarContainer.classList.add("near")):(e.$.columnNearContainer.classList.remove("far"),e.$.columnNearContainer.classList.add("near"),e.$.columnFarContainer.classList.remove("near"),e.$.columnFarContainer.classList.add("far"));for(let t=0;t<e._frozenNearColumns.length;t++)e._frozenNearColumns[t].createElement();for(let t=0;t<e._frozenFarColumns.length;t++)e._frozenFarColumns[t].createElement();for(let t=0;t<e.viewColumns.length;t++){const a=e.viewColumns[t];if(a.freeze)continue;const n=a.createElement();void 0!==a.computedWidth?(a.parent&&n.setAttribute("column-group",a.parent.name),a.parent&&a.parent.columns&&a.parent.columns[0].dataField===a.dataField&&n.setAttribute("column-group-first-child",""),l+=a.computedWidth,e._columnElements.push(n),l<2*e._clientSize.width&&o.appendChild(n)):(e._columnElements.push(n),o.appendChild(n))}for(let t=0;t<e._columnGroups.length;t++){const l=e._columnGroups[t],a=new Smart.Grid.Column({visible:void 0===l.visible||l.visible,allowSort:!1,allowFilter:!1,allowSelect:!1,grid:e,dataField:l.name,label:l.label,labelTemplate:l.labelTemplate,align:l.align,verticalAlign:l.verticalAlign,showIcon:!1});l.column=a;const n=a.createElement();n.style.width=l.computedWidth+"px",e.rightToLeft?n.style.right=l.right+"px":n.style.left=l.left+"px",n.style.top=l.top+"px",n.style.height=l.computedHeight+"px",n.style.lineHeight=l.computedHeight+"px",o.appendChild(n),l.element=n,l.grid=this,n.onpointerdown=()=>{if(e.selection.allowColumnHeaderSelection){const t=function(e){let o=new Array;if(e.columnGroup&&o.push(e),e.groups)for(let l=0;l<e.groups.length;l++)if(e.groups[l].columnGroup)o.push(e.groups[l]);else if(e.groups[l].groups){let a=t(e.groups[l]);for(let e=0;e<a.length;e++)o.push(a[e])}return o},o=t(l);e._selectColumnsRange(o[0].dataField,o[o.length-1].dataField)}}}e.htmlColumnLastChild||(e.htmlColumnLastChild=document.createElement("smart-grid-column"),e.htmlColumnLastChild.classList.add("top-far-corner"),e.htmlColumnLastChild.onpointerdown=e=>{e.stopPropagation(),e.preventDefault()},e.$.columnHeader.appendChild(e.htmlColumnLastChild)),t.appendChild(o),t.style.width=e._computedColumnsWidth+"px",!1===e.appearance.showColumnGroupLines&&e.setAttribute("appearance_hide-column-group-lines",""),e._refreshFrozenColumns()}_refreshFrozenColumns(){const e=this;e.$.columnNearContainer.style.width=e._frozenColumnsNearWidth+"px",e.$.columnFarContainer.style.width=e._frozenColumnsFarWidth+"px";for(let t=0;t<e._columnGroups.length;t++){const o=e._columnGroups[t];o.freeze&&o.element&&(!0===o.freeze||"near"===o.freeze?e.$.columnNearContainer.appendChild(o.element):"far"===o.freeze&&e.$.columnFarContainer.appendChild(o.element))}for(let t=0;t<e.viewColumns.length;t++){const o=e.viewColumns[t];o.freeze&&o.element&&(!0===o.freeze||"near"===o.freeze?e.$.columnNearContainer.appendChild(o.element):"far"===o.freeze&&e.$.columnFarContainer.appendChild(o.element))}}get _clientSize(){const e=this;if(e.__clientSize)return e.__clientSize;const t=getComputedStyle(e.$.container),o=parseFloat(t.paddingLeft)+parseFloat(t.paddingRight),l=parseFloat(t.paddingTop)+parseFloat(t.paddingBottom),a=parseFloat(t.borderLeftWidth)+parseFloat(t.borderRightWidth),n=parseFloat(t.borderTopWidth)+parseFloat(t.borderBottomWidth);return e.__clientSize={width:e.$.container.offsetWidth-o-a,height:e.$.container.offsetHeight-l-n},e.__clientSize}_initializeRowElements(){const e=this;if(!e.rows)return;e.rows.canNotify=!1;let t=0,o=e._clientSize.height;e.$.rowNearContainer.innerHTML="",e.$.rowFarContainer.innerHTML="",e.$.rowContainer.innerHTML="",e._rowElements=[],e._overflowOffset=Math.max(o,300),e._autoHeight&&e.paging.enabled&&(e._overflowOffset=Math.max(o,e.paging.pageSize*e.layout.rowMinHeight)),e.rightToLeft?(e.$.rowNearContainer.classList.remove("near"),e.$.rowNearContainer.classList.add("far"),e.$.rowFarContainer.classList.remove("far"),e.$.rowFarContainer.classList.add("near")):(e.$.rowFarContainer.classList.remove("near"),e.$.rowFarContainer.classList.add("far"),e.$.rowNearContainer.classList.remove("far"),e.$.rowNearContainer.classList.add("near"));const l=e.offsetHeight;e.$.container.classList.add("smart-hidden");const a=e.offsetHeight;e.$.container.classList.remove("smart-hidden"),"hidden"!==e.verticalScrollBarVisibility&&l===a||(o=e._scrollHeight);const n=function(){const l=document.createDocumentFragment();if(e.rows&&0===e.rows.length)return;for(let a=0;a<e.rows.length;a++){const n=e.rows[a];if(n.freeze&&n.visible)continue;const i=n.createElement();if(l.appendChild(i),t+=e.layout.rowMinHeight,t>e._overflowOffset+o)break}e.$.rowContainer.appendChild(l);const a=e.$.rowContainer.children;for(let t=0;t<a.length;t++){const o=a[t];e.rows[t]&&(e.rows[t].element=o),e._rowElements[t]=o}};for(let t=0;t<e._frozenNearRows.length;t++){const o=e._frozenNearRows[t];o.grid=e;const l=o.createElement();o.element=l,e.$.rowNearContainer.appendChild(l)}for(let t=0;t<e._frozenFarRows.length;t++){const o=e._frozenFarRows[t];o.grid=e;const l=o.createElement();o.element=l,e.$.rowFarContainer.appendChild(l)}n();let i=0;for(;t<1.5*o&&++i<50;)n();e.rows.canNotify=!0}_refreshSummary(e){const t=this;if(t.summaryRow.visible)t._summaryUpdateTimer&&clearTimeout(t._summaryUpdateTimer),t._summaryUpdateTimer=setTimeout((()=>{if(!0!==t.editing.isEditing){t._calculateSummary();const o=t.$.headerBar;o&&o._updateTools&&o._updateTools(),!1!==e&&t._recycle(!1,!0,!1)}}),100);else{const e=t.$.headerBar;e&&e._updateTools&&e._updateTools()}}_initializeRows(){const e=this;let t=0;e._frozenNearDefaultRows=[],e._frozenFarDefaultRows=[],e.rows=[],e.rowById=[],e._frozenFarRows=[],e._frozenNearRows=[],e._frozenRowsById=[];let o=e._createdDate||new Date,l=void 0!==e._createdBy?e._createdBy:e.currentUser;const a=function(){let t=[],o=!1;for(let l=0;l<e.columns.length;l++){const a=e.columns[l];let n={};a&&a.summary&&a.summary.length>0&&(o=!0,n[a.dataField]=a.summary,t.push(n))}if(!o)return void(e._summaryItems=[]);const l=e.getSelectedRowIds();if(l.length>=1){const o=[];for(let t=0;t<l.length;t++){const a=e.dataSource.dataItemById[l[t]];a&&o.push(a)}e._summaryItems=e.dataSource.summarize(t,o)}else if(e._selection&&e._selection.cells&&Object.keys(e._selection.cells).length>2){const o=e.getSelectedCells(!1),l=[],a=[];for(let t=0;t<o.length;t++){const n=o[t],i=n[0],r=e.dataSource.dataItemById[i];-1===l.indexOf(r)&&l.push(r),-1===a.indexOf(n[1])&&a.push(n[1])}e._summaryItems=e.dataSource.summarize(t,l);const n=Object.keys(e._summaryItems);for(let t=0;t<n.length;t++){const o=n[t];-1===a.indexOf(o)&&delete e._summaryItems[o]}}else e._summaryItems=e.dataSource.summarize(t)};e._calculateSummary=a;const n=e.columns?e.columns.filter((e=>void 0!==e.getCellValue)):[],i=function(a,i,r){let s=null;if(e.isInitialized&&(o=new Date),s=a?a.grid?a:new Smart.Grid.Row({data:a,index:i,grid:e,createdBy:l,createdDate:o}):new Smart.Grid.Row({data:{},index:i,grid:e,createdBy:l,createdDate:o}),n)for(let e=0;e<n.length;e++){const t=n[e],o=t.getCellValue(s.id,t.dataField,a);void 0!==o&&(s.data[t.dataField]=o)}if(e.rowById[s.id]&&(s.id=e.rows.length,e.rowById[s.id])){const e=function(){return(65536*(1+Math.random())|0).toString(16).substring(1)};s.id=e()}if(e.onRowInit){e.onRowInit(i,s,e),30!==s.height&&(s.cellHeight=s.height);for(let t in s)-1!==s.properties.indexOf(t)||t.startsWith("_")||e.error(e.localize("invalidRowProperty",{elementType:"Grid",propertyName:t}));e._details[i]=s.showDetail}if(s.selected&&(e._selection.rows[s.id]=!0,e._selection.indexes[s.index]=s.index),s.freeze&&s.visible){if(!0===s.freeze||"near"===s.freeze){e.rows.splice(t++,0,s);const o=e.rows[t-1];-1===e._frozenNearRows.indexOf(o)&&(e._frozenNearRows.push(o),e._frozenRowsById[o.id]=!0)}else if("far"===s.freeze){e.rows.push(s);const t=e.rows[e.rows.length-1];-1===e._frozenFarRows.indexOf(t)&&(e._frozenFarRows.push(t),e._frozenRowsById[t.id]=!0)}}else e.rows[i]?(e.rows.splice(i,0,s),e.rows[i].index=e.rows.length):e.rows.push(s),s.data&&s.data.$&&(s.data.$.history=s.history,s.data.$.starred=s.starred,s.data.$.comments=s.comments,s.data.$.style=s.style);if(!("virtual"===e.scrolling||e.paging.enabled&&e.dataSource&&e.dataSource.virtualDataSource))if(e.onRowInserted){const t=void 0===i?e.rows[e.rows.length-1]:e.rows[i],o=o=>{const l=t;if(void 0!==o&&Array.isArray(o)&&(o=o[0]),void 0===o){if(e.rowById[l.id]){const t=e.dataSource.dataItemById[l.id],o=function(){return(65536*(1+Math.random())|0).toString(16).substring(1)};l.id=o(),l.data&&l.data.$?l.data.$.id=l.id:l.data.id=l.id,e._getId()&&(l.data[e._getId()]=l.id),t&&(e.dataSource.dataItemById[l.id]=l.data)}e.rowById[l.id]=l}else{const t=e.dataSource.dataItemById[l.id];l.id=o,l.data&&l.data.$?l.data.$.id=l.id:l.data.id=l.id;const a=e._getId();a&&(l.data[e._getId()]=l.id),t&&(t[a]=o,e.dataSource.dataItemById[l.id]=t,l.data=t),e.rowById[l.id]=l}-1!==l.index&&void 0!==l.index||(l.index=e.rows.length),e._setAddUndoRedo(l),!e.editing.isEditing&&e.isInitialized&&(e._recycle(!1,!0),e.grouping.groupBy.length&&e.refresh()),e._onRowInserted&&e._onRowInserted(l),r&&r(l)};if(e._rowInsertedCallback=o,void 0===i&&(i=e.rows.length-1,void 0!==t.index&&-1!==t.index||(t.index=i)),e.isInitialized){e._rowInsertTimer&&clearTimeout(e._rowInsertTimer),e._rowInsert||(e._rowInsert=[]),e._rowInsert.push({row:t,index:i});const l=e._keyboardAdd?300:150;e._rowInsertTimer=setTimeout((()=>{if(1===e._rowInsert.length)e.onRowInserted([i],[t],o,e),delete e._rowInsert,delete e._undoRedoAction;else{let t=[],o=[];for(let l=0;l<e._rowInsert.length;l++)t.push(e._rowInsert[l].index),o.push(e._rowInsert[l].row);delete e._rowInsert,e.onRowInserted(t,o,(t=>{e.beginUpdate();for(let l=0;l<o.length;l++){const a=o[l],n=t?t[l]:void 0;if(void 0!==n){const t=e.dataSource.dataItemById[a.id];a.id=a.data.id=n;const o=e._getId();o&&(a.data[e._getId()]=a.id),e.rowById[a.id]=a,t&&(t[o]=n,e.dataSource.dataItemById[a.id]=t,a.data=t)}e._setAddUndoRedo(a),-1!==a.index&&void 0!==a.index||(a.index=e.rows.length),e._onRowInserted&&e._onRowInserted(a),r&&r(a)}delete e._undoRedoAction,e.endUpdate(!1)}),e)}}),l)}else e.onRowInserted([i],[t],o,e)}else{const t=void 0===i?e.rows[e.rows.length-1]:e.rows[i];void 0===i&&(i=e.rows.length-1,void 0!==t.index&&-1!==t.index||(t.index=i)),r&&r(t)}},r=function(){const t=e.rows[e.rows.length-1];e.rows.pop(),e.onRowRemoved&&e.onRowRemoved([t.id],[t.index],e),e._onRowRemoved&&e._onRowRemoved([t.id],[t.index],e),e._setRemoveUndoRedo(t)},s=function(t){const o=e.rows[t];o.selected&&o.setProperty("selected",!1),e.rows.splice(t,1),e.onRowRemoved&&e.onRowRemoved([o.id],[t],e),e._onRowRemoved&&e._onRowRemoved([o.id],[t],e),e._setRemoveUndoRedo(o)};e._add=i,e._removeLastRow=r,e._removeAt=s,e._rowHeight=e._autoRowHeight;const d=e.dataSource.length,c=e.onRowInserted;e.onRowInserted=null,e.$.content.setAttribute("aria-rowcount",d);const u=e.dataSource&&e.dataSource.virtualDataSource&&!e.dataSource.virtualDataSourceOnExpand&&e.dataSource.length>e.virtualModeCachedRowsCount&&"infinite"!==e.scrolling;if(e.dataSource&&e.dataSource.virtualDataSource&&e.paging.enabled&&!e.dataSource.virtualDataSourceOnExpand)for(let t=0;t<e.dataSource.boundSource.length;t++){const o=e.dataSource[t],l=t+e.paging.pageIndex*e.paging.pageSize;e.dataSource.id||(o.$.id=l),i(o,l)}else if(u){let t=e.dataSource.length>e.virtualModeCachedRowsCount?e.virtualModeCachedRowsCount:e.dataSource.length;"infinite"===e.scrolling&&(t=e.dataSource.length);for(let o=0;o<t;o++){const t=e.dataSource[o];i(t,o)}}else for(let t=0;t<e.dataSource.length;t++){const o=e.dataSource[t];i(o,t)}for(let t=0;t<e._frozenFarRows.length;t++){const o=e._frozenFarRows[t];e.rows.splice(e.rows.indexOf(o),1),e.rows.push(o)}if(a(),e.onRowInserted=c,e.dataSource.notify((function(t){if(e.dataSource._updating)return;const o=t.data;e.rows.canNotify=!1;let l=!1;switch(t.action){case"add":if(!o)return;if(void 0!==o.length)for(let t=0;t<o.length;t++)i(o[t],e.dataSource.length-o.length+t);else i(o,e.dataSource.length-1);break;case"update":if(o.length){let o=[],a=[],n=[];for(let r=0;r<n.length;r++){const s=t.index[r];e.rows[s]?(e.rows[s].data=n[r],o.push(s),a.push(e.rows[s]),n.push(e.rows[s].data)):(i(n[r],n[r].$.index),l=!0)}e.onRowUpdated&&e.onRowUpdated(o,a,n,e)}else{const l=t.index;e.rows[l]?e.rows[l].data=o:i(o,e.dataSource.length-1),e.onRowUpdated&&e.onRowUpdated([l],[e.rows[l]],[e.rows[l].data],e)}break;case"insert":i(o,t.index);for(let t=0;t<e.rows.length;t++)e.rows[t].index=t;break;case"remove":s(t.index);break;case"removeLast":r();break;case"bindingComplete":if(e.dataSource&&e.dataSource.url||e.dataSource&&!e.dataSource.virtualDataSource){if(e.appearance.displayLoadingIndicator=!1,e._setLoadingIndicatorVisibility(),e._toggledRow=null,e.dataSource.length!==d){if(e.paging.enabled){const t=e.$.headerPager.querySelector("smart-pager"),o=e.$.footerPager.querySelector("smart-pager");t&&(t.pagesCount=Math.ceil(e.dataSource.length/e._pageSize),t.$&&o.$.pageSizeSelector&&(t.$.pageSizeSelector.disabled=e.dataSource.length<e.pager.pageSizeSelector.dataSource[0])),o&&(o.pagesCount=Math.ceil(e.dataSource.length/e._pageSize),o.$&&o.$.pageSizeSelector&&(o.$.pageSizeSelector.disabled=e.dataSource.length<e.pager.pageSizeSelector.dataSource[0]))}if(0===d&&0===e.columns.length&&e.dataSource.dataFields.length>0){const t=e.context;e.context=e,e.columns.canNotify=!1,e.columns=[],e._renderColumns(),e._resetCachedLayout(),e.columns.canNotify=!0,e.context=t}e._initializeRows(),e._initializeRowElements(),e.refresh()}e._recycle(),e.onLoad&&(e.onLoad(),delete e.onLoad)}}a(),("update"!==t.action||l)&&e._refreshLayout(),e._recycle(),e.rows.canNotify=!0})),e._observeRows(),e.summaryRow.visible){const t=new Smart.Grid.Row({height:e.layout.rowMinHeight,freeze:"near",visible:"near"===e.summaryRow.position,summaryRowIndex:0,summaryRow:!0}),o=new Smart.Grid.Row({height:e.layout.rowMinHeight,freeze:"far",visible:"far"===e.summaryRow.position,summaryRowIndex:0,summaryRow:!0});"near"===e.summaryRow.position&&e._frozenNearRows.splice(0,0,t),"far"===e.summaryRow.position&&e._frozenFarRows.push(o),e._frozenRowsById[o.id]=!0}if(e.filtering.enabled&&e.filtering.filterRow.visible){const t=new Smart.Grid.Row({freeze:!0,autoGenerated:!0,filterRow:!0});e._frozenNearRows.splice(0,0,t)}e._renderAddNewRow()}_observeRows(){const e=this;e._frozenNearRows=[],e._frozenFarRows=[],e.rows=new Smart.ObservableArray(e.rows,null,{allowToggle:!0,allowResize:!0,allowCheck:!0,allowSelect:!0,allowReorder:!0,expanded:!0,selected:!0,checked:!0,visible:!0,enabled:!0,minHeight:!0,height:!0,freeze:!0,showDetail:!0,data:!0,visibleIndex:!0,index:!0,comments:!0,style:!0,starred:!0,updatedBy:!0,updatedDate:!0,createdDate:!0,createdBy:!0,history:!0});for(let t=0;t<e.rows.length;t++){const o=e.rows[t];!0===o.freeze||"near"===o.freeze?(e._frozenNearRows.push(o),e._frozenRowsById[o.id]=!0):"far"===o.freeze&&(e._frozenFarRows.push(o),e._frozenRowsById[o.id]=!0),e.rowById[e.rows[t].id]=o}e.rows.notify((function(t){if(!e.rows.canNotify)return;const o=t.action;if("length"===o)return;if(t.path)return e.rows.canNotify=!1,(e.rowById[t.target.id]||"selected"===t.propertyName)&&(l=t.target,a=t.propertyName,n=t.oldValue,i=t.newValue,n===i&&"selected"!==a&&"showDetail"!==a||(l.propertyChanged(a,n,i),e.onRowChange&&l.properties.indexOf(a)>=0&&e.onRowChange(l,a,n,i,e))),void(e.rows.canNotify=!0);var l,a,n,i;if(e.rows.canNotify=!1,!e.dataSource)return;switch(e.dataSource.canNotify=!1,o){case"add":{const o=function(o){let l=e.rows[o];if(l instanceof Smart.Grid.Row==0){l=new Smart.Grid.Row(l);const a=e.rows.canNotify;e.rows.canNotify=!1,t.object[o]=l,l=t.object[o],e.rows.canNotify=a}if(l.grid=e,e.dataSource&&e.dataSource.virtualDataSource){e.rows.canNotify=!1;for(let t=0;t<e.rows.length;t++){const o=e.dataSource.boundSource[t],l=e.rows[t];o&&(l.data=o,l.id=o.$.id),e.rowById[l.id]=l}e.rows.canNotify=!0}else(()=>{if(0===e.dataSource.length&&e.dataSource.dataFields&&0===e.dataSource.dataFields.length&&e.columns&&e.columns.length){let t=[];for(let o=0;o<e.columns.length;o++){const l=e.columns[o];l.dataField||(l.dataField="dataField_"+Math.floor(65536*(1+Math.random())).toString(16).substring(1)),t.push({name:l.dataField,dataType:l.dataType||"string"}),l.displayField&&l.displayField!==l.dataField&&t.push({name:l.displayField,dataType:l.dataType||"string"})}e.dataSource.dataFields=t}if(e.dataSource.id&&(null===l.data[e.dataSource.id]||void 0===l.data[e.dataSource.id])){const t=function(){return(65536*(1+Math.random())|0).toString(16).substring(1)};l.data[e.dataSource.id]=t()}if(o<e.dataSource.length?e.dataSource.insert(o,e.rows[o].data):e.dataSource.add(e.rows[o].data),e.dataSource[o]){l.data=e.dataSource[o];for(let t=0;t<e.dataSource.dataFields.length;t++){const o=e.dataSource.dataFields[t].name;e.dataSource.id&&o===e.dataSource.id||e.dataSource.keyDataField&&o===e.dataSource.keyDataField||e.dataSource.parentDataField&&o===e.dataSource.parentDataField||e.columnByDataField[o]||delete l.data[o]}void 0!==e.dataSource[o].$.id&&(l.id=e.dataSource[o].$.id,e.rowById[l.id]=l),l.data.$&&l.history&&(l.data.$.history=l.history)}-1!==l.index&&void 0!==l.index||(l.index=o),l.selected&&(e._selection.rows[l.id]=!0,e._selection.indexes[l.index]=l.index),l.freeze&&(!0===l.freeze||"near"===l.freeze?e._frozenNearRows.push(l):"far"===l.freeze&&e._frozenFarRows.push(l),e._frozenRowsById[l.id]=!0),e._conditionalColors&&e._conditionalColors.update&&setTimeout((()=>{e._conditionalColors.update(),e._recycle(!1)}),100)})()};for(let e=0;e<t.addedCount;e++)o(t.index+e);break}case"update":if(t.target){const o=e.rowById[t.target.id],l=e.rows.indexOf(o);e.dataSource.update(l,o)}else{const o=e.rows.indexOf(t.index);e.dataSource.update(t.index,o)}break;case"remove":{if(e.dataSource&&e.dataSource.virtualDataSource){e.rows.canNotify=!1;const o=t.removed&&t.removed.length>0?t.removed[0]:null;o&&delete e.rowById[o.id];for(let t=0;t<e.dataSource.boundSource.length;t++){const o=e.dataSource.boundSource[t],l=e.rows[t];l&&(l.data=o,l.id=o.$.id,e.rowById[l.id]=l)}return e.rows.canNotify=!0,e.refresh(),void e._refreshPaging(!1)}const o=t.removed&&t.removed.length>0?t.removed[0]:null;o&&delete e.rowById[o.id],e.dataSource.removeAt(t.index);break}}if(e.dataSource.canNotify=!0,e.rows.canNotify=!0,!o)return;let r=e.isInitialized&&e._rowElements&&e._rowElements.length<e.rows.length;"add"===o&&1===t.addedCount&&r&&e._rowElements.length>0&&e._rowElements[e._rowElements.length-1].classList.contains("smart-hidden")&&(r=!1),r&&e._initializeRowElements(),e.refresh(!1,o),e._refreshPagesCount(),e._sortedColumns&&e._sortedColumns.length>0&&e.refreshSort()}))}setDropDownLabel(e){const t=this;t.$.dropDownElement&&(t.dropDownModeInput?t.$.dropDownElement.querySelector(".smart-action-button smart-input").value=e:t.$.dropDownElement.querySelector(".smart-action-button").innerHTML=e)}openDropDown(){const e=this;if(!e.dropDownMode)return;if(!e.$.dropDownPopup)return;const t=e.$.dropDownPopup,o=e.$.dropDownElement;o.setAttribute("active",""),o.querySelector(".smart-drop-down-button").setAttribute("active",""),(()=>{const l=0,a=0;if(e.layout.isDirty=!0,window.screen.availWidth<400)return t.open("left","top"),t.style.width=e.offsetWidth+"px",void(t.style.height=e.offsetHeight+"px");{const o={width:e.layout.dropDownWidth,height:e.layout.dropDownHeight};t.style.width="auto"===o.width?o.width:o.width+"px",t.style.height="auto"===o.height?o.height:o.height+"px"}const n=o;if(n){const o=e.offset(n),i=o.left-l,r=l,s=Math.max(r,i);t.open(s,o.top+n.offsetHeight-a)}else t.classList.add("center"),t.open("center","center");e.style.display=""})()}isDropDownOpened(){return!!this.$.dropDownElement.hasAttribute("active")}closeDropDown(){const e=this;e.dropDownMode&&e.$.dropDownPopup&&(e.$.dropDownElement.removeAttribute("active"),e.$.dropDownElement.querySelector(".smart-drop-down-button").removeAttribute("active"),e.$.dropDownPopup.close())}_renderInDropDown(){const e=this;if(e.dropDownMode&&(e.dropDownMode&&(e.style.display="none"),e.dropDownMode&&void 0===e._dropDownMode)){e._dropDownMode=!0;const t=document.createElement("div"),o=e._createPopup();if(o.allowDrag=!1,o.classList.add("smart-grid-drop-down-popup"),e.$.dropDownElement=t,e.$.dropDownPopup=o,t.onmouseenter=()=>{t.hasAttribute("active")||t.setAttribute("hover","")},t.onmouseleave=()=>{t.removeAttribute("hover")},t.classList.add("smart-grid-drop-down-button","smart-drop-down-box"),e.parentNode.insertBefore(t,e),t.innerHTML=`<div class="smart-container" role="presentation">\n <div class="smart-content" role="presentation">\n <div class="smart-buttons-container" role="presentation">\n <span class="smart-action-button">${e.localize("dropDownPlaceholder")}</span>\n <span class="smart-drop-down-button">\n <span class="smart-drop-down-button-icon" id="arrow" aria-hidden="true"></span>\n </span>\n </div>\n </div>\n </div>`,e.dropDownModeInput){const o=t.querySelector(".smart-action-button");o.innerHTML='<smart-input style="color: var(--smart-background-color); background: var(--smart-background); border-radius: 0px; width: calc(100% - 6px); height: calc(100% - 6px);"></smart-input>';const l=o.firstElementChild;l.onpointerdown=l.onclick=l.onpointerup=e=>{e.stopPropagation()},l.oninput=l.onchange=l.onkeyup=t=>{const o=e.rows||e.dataSource;clearTimeout(e._dropDownInputTimer),e._dropDownInputTimer=setTimeout((()=>{if(l.value.length>=2)for(let a=0;a<o.length;a++){const n=o[a],i=(""+(n.data?n.data:n)[e.dropDownModeDataField]).toLowerCase(),r=(""+l.value).toLowerCase();if(i.indexOf(r)>=0){"Enter"===t.key&&(l.value=i),e.selection.enabled&&(e.isDropDownOpened()||e.openDropDown(),e.rows&&(e.clearSelection(),e.selection.allowCellSelection?e.selectCell(n.id,e.dropDownModeDataField):e.selectRow(n.id),e.ensureVisible(n.id)));break}}}),300)}}if(t.onclick=()=>{o.classList.contains("open")?e.closeDropDown():e.openDropDown()},e.style.height="100%",e.style.width="100%",o.content.appendChild(e),e._cellsMerge=[],e._cellStyles=[],!e._popupDropDown){e._popupDropDown=o,o._refreshPosition=()=>{const l=e.offset(t),a=t.offsetHeight,n=e.offset(e);if(o.style.maxHeight="",o.style.minHeight="",l.top+a+o.offsetHeight>window.innerHeight-n.top){const e=a+l.top+o.offsetHeight-window.innerHeight+n.top;o.style.maxHeight=Math.max(250,o.offsetHeight-e)+"px",o.style.minHeight="250px"}else o.style.maxHeight="",o.style.minHeight=""};const l=()=>{if(e.selection.enabled){const o=e._selection.focusedCell;if(o){const l=e.getCellValue(o.id,o.dataField);if(e.dropDownModeInput?t.querySelector(".smart-action-button smart-input").value=l:t.querySelector(".smart-action-button").innerHTML=l,e.selection.enabled&&e.selection.allowCellSelection){const l=e.getCellValue(o.id,e.dropDownModeDataField);e.dropDownModeInput?t.querySelector(".smart-action-button smart-input").value=l:t.querySelector(".smart-action-button").innerHTML=l}}}};o.onOpen=function(){e._popupDropDown._refreshPosition(),e.$.fireEvent("dropDownGridOpen"),e.$.listen("cellClick",l)},o.onClose=function(){if(e.$.unlisten("cellClick"),e.selection.enabled){const o=e._selection.focusedCell;if(o){const l=e.getCellValue(o.id,o.dataField);if(e.dropDownModeInput?t.querySelector(".smart-action-button smart-input").value=l:t.querySelector(".smart-action-button").innerHTML=l,e.selection.enabled&&e.selection.allowCellSelection){const l=e.getCellValue(o.id,e.dropDownModeDataField);e.dropDownModeInput?t.querySelector(".smart-action-button smart-input").value=l:t.querySelector(".smart-action-button").innerHTML=l}}}e.$.fireEvent("dropDownGridClose")},o.onkeydown=function(e){"Escape"===e.key&&(o.result=!1,o.close())}}}}render(){const e=this,t=()=>0===e.offsetWidth||0===e.offsetHeight;if(t())return requestAnimationFrame((()=>{e.isInitialized||t()||(e._undoRedo=[],e._refreshCurrentUser(),e._render())})),e.$.content.setAttribute("role","grid"),e.editing.enabled||e.$.content.setAttribute("aria-readonly",!0),e.$.verticalScrollBar.removeAttribute("role"),e.$.horizontalScrollBar.removeAttribute("role"),e.$.verticalScrollBar.removeAttribute("aria-controls"),e.$.horizontalScrollBar.removeAttribute("aria-controls"),void super.render();const o=e.context;e.context=e,e.$.content.setAttribute("role","grid"),"grid"!==e.view&&e.setAttribute("view",e.view),e.editing.enabled||e.$.content.setAttribute("aria-readonly",!0),e.$.verticalScrollBar.removeAttribute("role"),e.$.horizontalScrollBar.removeAttribute("role"),e.$.verticalScrollBar.removeAttribute("aria-controls"),e.$.horizontalScrollBar.removeAttribute("aria-controls"),e._undoRedo=[],e._refreshCurrentUser(),e._render(),e.context=o,super.render()}transpose(e,t=180,o){const l=this,a=l.dataSource,n=l.columns;if(!a||!n)return null;let i=[],r=[];i=a instanceof Smart.DataAdapter?a.boundSource.toArray():a,r=n.toArray();const s=[],d=[{label:"",dataField:"field",freeze:!0,width:150}];for(let l=0;l<i.length;l++){const a={label:i[l][e]||`Row ${l+1}`,width:t,dataField:String(l)};o&&o(a),d.push(a)}for(let e of r){const t={field:e.label||e.dataField};i.forEach(((o,l)=>{t[l]=o[e.dataField]})),s.push(t)}l.beginUpdate(),l.dataSource=new Smart.DataAdapter({dataSource:s}),l.columns=d,l.endUpdate(),l.render()}_renderColumns(e){const t=this;t._initializeColumns(),t._initializeColumnGroupsHierarchy(),t._refreshColumnsResponsiveVisibility(),t._createColumnHeaderCellElements(),t._renderColumnGroupHeaders(),!1!==e&&t._refresh()}_renderRows(e){const t=this;t._initializeRows(),t._initializeRowElements(),!1!==e&&t._refresh()}_setupMobile(){const e=this;if(void 0===e._mobile&&(e._mobile=Smart.Utilities.Core.isMobile),e._mobile){e.layout.rowMobileHeight&&(e.layout.rowMinHeight=e.layout.rowHeight=e.layout.columnMinHeight=e.layout.columnHeight=e.layout.rowMobileHeight),e.behavior.rowResizeMode="none",e.behavior.allowRowReorder=!1,e.selection.allowDragSelectionAutoScroll=!1,e._scrollView.vScrollBar.showButtons=!1,e._scrollView.hScrollBar.showButtons=!1,e.style.setProperty("--smart-scroll-bar-size","12px"),document.body.style.setProperty("--smart-data-view-sort-panel-width","345px"),e._scrollContent=document.createElement("div"),e._scrollContent.style.width="100%",e._scrollContent.style.height="100%",e._scrollContent.style.position="absolute",e._scrollContent.style.left="0px",e._scrollContent.style.top="0px",e._scrollContent.style.background="white",e._scrollContent.style.zIndex=9999,e._scrollContent.style.opacity=.1,e._scrollContent.style.overflow="auto",e.addEventListener("viewChange",(()=>{"grid"===e.view?e._scrollContent.classList.remove("smart-hidden"):e._scrollContent.classList.add("smart-hidden")})),e.addEventListener("beginEdit",(()=>{e._scrollContent.classList.add("smart-hidden")})),e.addEventListener("endEdit",(()=>{e._scrollContent.classList.remove("smart-hidden")})),e._scrollContent.ontouchend=()=>{e._mobileDownTime=null},e._scrollContent.ontouchmove=t=>{if(t.stopPropagation(),!e._scrollContentScroll&&e.selection.enabled&&e.selection.allowDragSelection&&e.selection.allowCellSelection&&e._mobileDownDataField&&void 0!==e._mobileDownId&&e._mobileDownTime&&new Date-e._mobileDownTime>=800){const o=e=>new PointerEvent(e,{bubbles:!0,cancelable:!0,composed:!0,pointerId:42,pointerType:"mouse",clientX:t.changedTouches[0].clientX,clientY:t.changedTouches[0].clientY,pageX:t.changedTouches[0].pageX,pageY:t.changedTouches[0].pageY});e._mobileSelect=!0,e._dragSelection(o("mousemove")),e._mobileSelect=!1,t.preventDefault()}},e._scrollContent.ontouchstart=e=>{e.stopPropagation()},e._scrollContent.onpointerup=t=>{if(e._dragSelectionStartDataField=null,e._dragSelectionStartRow=null,e._mobileDownDataField&&void 0!==e._mobileDownId){let o=null,l=null;const a=(e.enableShadowDOM?e.shadowRoot:e.getRootNode()).elementsFromPoint(t.clientX,t.clientY);for(let t=0;t<a.length;t++){const n=a[t];if(n.closest&&n.closest("smart-grid-cell")){e._hideActionButtons();const t=n.closest("smart-grid-cell").cell;l=t.row.id,o=t.column.dataField;break}}new Date-e._mobileDownTime>=1e3&&e.editing.enabled&&e.selection.enabled&&e.selection.allowCellSelection&&o===e._mobileDownDataField&&l===e._mobileDownId&&e.beginEdit(e._mobileDownId,e._mobileDownDataField),e._mobileDownDataField=null,e._mobileDownTime=null,e._mobileDownId=null,t.preventDefault(),t.stopPropagation()}},e._scrollContent.onpointerdown=t=>{e._scrollContentScroll=!1;const o=e=>new PointerEvent(e,{bubbles:!0,cancelable:!0,composed:!0,pointerId:42,pointerType:"mouse",clientX:t.clientX,clientY:t.clientY,pageX:t.pageX,pageY:t.pageY});setTimeout((()=>{if(e._scrollContentScroll)e._hideActionButtons();else{const l=(e.enableShadowDOM?e.shadowRoot:e.getRootNode()).elementsFromPoint(t.clientX,t.clientY);if(l[2]){if(e.selection.enabled&&e.selection.allowCellSelection){const l=(e.enableShadowDOM?e.shadowRoot:e.getRootNode()).elementsFromPoint(t.clientX,t.clientY);e._mobileDownDataField=null,e._mobileDownTime=null,e._mobileDownId=null;for(let a=0;a<l.length;a++){const n=l[a];if(n.closest&&n.closest("smart-grid-cell")){e._hideActionButtons();const a=n.closest("smart-grid-cell").cell;return e._mobileDownTime=new Date,e._mobileDownId=a.row.id,e._mobileDownDataField=a.column.dataField,e._dragSelectionStartDataField=a.column.dataField,e._dragSelectionStartRow=a.row,e._mobileSelect=!0,l[2].dispatchEvent(o("pointerdown")),e._mobileSelect=!1,t.stopPropagation(),void t.preventDefault()}}}if(l[2].classList.contains("smart-grid-add-row-button"))e._hideActionButtons(),l[2].dispatchEvent(o("click"));else if(l[2].classList.contains("smart-summary-placeholder")||l[2].classList.contains("summary-value-part"))e._hideActionButtons(),l[2].dispatchEvent(o("pointerup"));else if(l[2].closest("smart-menu-item")){e._hideActionButtons();const t=l[2].closest("smart-menu-item");l[2].closest("smart-menu")._menuItemSelectionHandler(t)}else{if(l[2].dispatchEvent(o("pointerdown")),e._lastMobileClickRange){const o=e._lastMobileClickRange;let l=!0;o.left<=t.pageX&&o.left+o.right>=t.pageX&&(l=!1),l&&e._hideActionButtons()}else e._hideActionButtons();const a=(o,l)=>{if(o&&o.autoShowActionButton){const a=l.getBoundingClientRect(),n=e.offset(l);if(n.left<=t.pageX&&n.left+a.width-6>=t.pageX){if(!e.hasColumnMenu(o))return;e._lastMobileClickRange={left:n.left,right:n.left+a.width-6},l._showActionButton()}else l._hideActionButton()}};for(let t=0;t<e._columnElements.length;t++){const o=e._columnElements[t];a(o.column,o)}}}}}),300),t.stopPropagation()};let t=0;const o=()=>{const t=e._scrollContent.scrollLeft,o=e._scrollContent.scrollTop;e._scrollView.vScrollBar.value=o,e._scrollView.hScrollBar.value=t,e._scrollContentScroll=!0};e._scrollContent.onscroll=()=>{cancelAnimationFrame(t),t=0,t=requestAnimationFrame(o)},e._scrollContentView=document.createElement("div"),e._scrollContentView.style.width=e._scrollView.scrollWidth+"px",e._scrollContentView.style.height=e._scrollView.scrollHeight+"px",e._scrollContent.appendChild(e._scrollContentView),e.$.scrollView.appendChild(e._scrollContent)}}_render(){const e=this;if(e.isInitialized||(e.onBeforeInit&&(e.onBeforeInit(e),e.onBeforeInit=null),e.$.fireEvent("beforeInit",{grid:e}),e.header.visible&&(e.header.buttons.indexOf("views")>=0||e.header.buttons.indexOf("states")>=0)&&e._updateKanbanTaskFields()),e._setupMobile(),(()=>{if(null===e.dataSource)e.dataSource=new Smart.DataAdapter;else if(Array.isArray(e.dataSource)||"string"==typeof e.dataSource){let t=[];if(e.dataSourceSettings.dataFields&&e.dataSourceSettings.dataFields.length>0)e.dataSource=new Smart.DataAdapter({dataSource:e.dataSource,dataSourceType:e.dataSourceSettings.dataSourceType,dataFields:e.dataSourceSettings.dataFields,keyDataField:e.dataSourceSettings.keyDataField,parentDataField:e.dataSourceSettings.parentDataField,childrenDataField:e.dataSourceSettings.childrenDataField,groupBy:e.dataSourceSettings.groupBy||e.grouping.groupBy,mapChar:e.dataSourceSettings.mapChar,root:e.dataSourceSettings.root,record:e.dataSourceSettings.record,autoGenerateColumns:e.dataSourceSettings.autoGenerateColumns,id:e.dataSourceSettings.id,virtualDataSource:e.dataSourceSettings.virtualDataSource,virtualDataSourceOnExpand:e.dataSourceSettings.virtualDataSourceOnExpand});else if(e.columns&&e.columns.length){for(let o=0;o<e.columns.length;o++){const l=e.columns[o];l.dataField||(l.dataField="dataField_"+Math.floor(65536*(1+Math.random())).toString(16).substring(1)),t.push({name:l.dataField,dataType:l.dataType||"string"}),l.displayField&&l.displayField!==l.dataField&&t.push({name:l.displayField,dataType:l.dataType||"string"})}e.dataSource=new Smart.DataAdapter({dataSource:e.dataSource,dataFields:t,dataSourceType:e.dataSourceSettings.dataSourceType,keyDataField:e.dataSourceSettings.keyDataField,parentDataField:e.dataSourceSettings.parentDataField,childrenDataField:e.dataSourceSettings.childrenDataField,groupBy:e.dataSourceSettings.groupBy||e.grouping.groupBy,mapChar:e.dataSourceSettings.mapChar,root:e.dataSourceSettings.root,record:e.dataSourceSettings.record,autoGenerateColumns:e.dataSourceSettings.autoGenerateColumns,id:e.dataSourceSettings.id,virtualDataSource:e.dataSourceSettings.virtualDataSource,virtualDataSourceOnExpand:e.dataSourceSettings.virtualDataSourceOnExpand})}else e.dataSource=new Smart.DataAdapter({dataSource:e.dataSource,id:e.dataSourceSettings.id,autoGenerateColumns:e.dataSourceSettings.autoGenerateColumns})}})(),e._selection={rows:[],indexes:[],columns:[],cells:[]},e.dataSource&&e.dataSource.url&&(e.appearance.displayLoadingIndicator=!0,e._setLoadingIndicatorVisibility(),e.dataSource.data={sorting:e.getSortedColumns(),filtering:e.getFilteredColumns(),grouping:e.grouping.groupBy}),e.filtering.filterRow)for(let t=0;t<e.columns.length;t++)e.columns[t]._filterEditorInitialized&&(e.columns[t]._filterEditorInitialized=!1);const t=!e.isInitialized;if(t&&(e.onInit&&(e.onInit(e),e.onInit=null),e.$.fireEvent("init",{grid:e})),e._renderColumns(!1),e._renderRows(!1),e._renderPagers(),e._renderCommandBar(),e._renderConditionalFormatting(),e._initFormulaParser(),t&&e.grouping.enabled&&e.grouping.groupBy.length&&e.dataSource&&(e.dataSource.groupBy=e.grouping.groupBy),e.appearance.allowColumnStickyPosition&&e._stickHeader(),e.header.visible&&""===e.header.template){const t=document.createElement("smart-grid-toolbar");t.headerPosition="top",t.messages=e.messages,t.locale=e.locale;let o=e.$.header;e.header.appendTo&&(o=document.querySelector(e.header.appendTo),o?o.onclick=t=>{e._headerClickHandler(t)}:o=e.$.header),o.appendChild(t),e.$.headerBar&&e.$.headerBar.remove(),e.$.headerBar=o.firstElementChild,e.$.headerBar._init(e)}if(e.isInitialized)e.refreshFilters();else{let t=!1;if(e.stateSettings.autoLoad){let o=e.stateSettings.current;!o&&e.stateSettings.allowLocalStorage&&(e.stateSettings.current="SmartGrid"+e.id,o=e.stateSettings.current);let l=null;e.stateSettings.storage&&(l=e.stateSettings.storage[o]),l&&(t=!0),!l&&e.stateSettings.allowLocalStorage&&(l=window.localStorage.getItem(o),l&&(t=!0))}if(!t){const t=[];for(let o=0;o<e.viewColumns.length;o++){const l=e.viewColumns[o];l.allowSort&&l.sortOrder&&t.push(l)}if(0===t.length&&e.sorting.sort)for(let o=0;o<e.sorting.sort.length;o++){const l=e.sorting.sort[o],a=Object.keys(l)[0],n=l[a],i=e.columnByDataField[a];i&&(t.push(i),i.sortOrder=n||"asc")}t.sort(((e,t)=>e.sortIndex-t.sortIndex));for(let o=0;o<t.length;o++){const l=t[o],a=e.appearance.allowSortAnimation;e.appearance.allowSortAnimation=!1,e.sortBy(l.dataField,l.sortOrder),e.appearance.allowSortAnimation=a}if(e.filtering.filter.length>0){for(let t=0;t<e.filtering.filter.length;t++){const o=e.filtering.filter[t];if(o){if("string"==typeof o){const t=e.filtering.filter[0],o=e.columnByDataField[t],l=e.filtering.filter[1];let a=null;if(o&&(a=e.dataSource._createFilter(o.dataType,l)),a){if(e.filtering.filterRow.visible&&!o._filterInfo){let e=[];for(let t=0;t<a.filters.length;t++)e.push(a.filters[t].value),t<a.filters.length-1&&e.push(a.logicalOperators[t]);o._filterInfo={condition:a.filters[0].condition,value:e.join(" ")}}e.addFilter(t,a,!1)}break}const t=o[0],l=o.splice(1);let a=null;if(l instanceof Smart.FilterGroup)a=l;else{const o=e.columnByDataField[t];o&&(a=e.dataSource._createFilter(o.dataType,l))}if(a){if(e.filtering.filterRow.visible){const o=e.columnByDataField[t];if(!o._filterInfo){let e=[];for(let t=0;t<a.filters.length;t++)e.push(a.filters[t].value),t<a.filters.length-1&&e.push(a.logicalOperators[t]);o._filterInfo={condition:a.filters[0].condition,value:e.join(" ")}}}e.addFilter(t,a,!1)}}}e.refreshFilters()}else{for(let t=0;t<e.columns.length;t++){const o=e.columns[t];if(o.filter){let t=null,l=o.filter;if(t=l instanceof Smart.FilterGroup?l:e.dataSource._createFilter(o.dataType,l),t){if(e.filtering.filterRow.visible&&!o._filterInfo){let e=[];for(let o=0;o<t.filters.length;o++)e.push(t.filters[o].value),o<t.filters.length-1&&e.push(t.logicalOperators[o]);o._filterInfo={condition:t.filters[0].condition,value:e.join(" ")}}e.addFilter(o.dataField,t,!1)}}}e.refreshFilters()}}}if(e.viewColumns.canNotify=!0,e.isInitialized=!0,("virtual"===e.scrolling||e.paging.enabled&&e.dataSource&&e.dataSource.virtualDataSource||e.dataSource&&e.dataSource.virtualDataSource)&&e._virtualDataRequest("dataBind"),""!==e.header.template&&e._applyTemplate(e.header.template,e.$.header),""!==e.footer.template&&e._applyTemplate(e.footer.template,e.$.footer),e._createFilterPanels(),e._refresh(),e._applyScrolling(),e.grouping.enabled&&e.grouping.autoExpandAll&&e.rowHierarchy?e.expandAllRows():e.grouping.enabled&&e.grouping.autoExpandToLevel&&e.rowHierarchy&&e.expandRowsToGroupLevel(e.grouping.autoExpandToLevel),e.onRender&&(e.onRender(t),e.onRender=null),e.isRendered=!0,"auto"===e.layout.rowHeight&&(e._refreshLayout(),e.filtering.enabled&&e.filtering.filterRow.visible&&e._refreshFilterRowEditors(),e._recycle()),t){if(e.stateSettings.autoLoad){let t=e.stateSettings.current,o=null;e.stateSettings.storage&&(o=e.stateSettings.storage[t]),!t&&e.stateSettings.allowLocalStorage&&(e.stateSettings.current="SmartGrid"+e.id,t=e.stateSettings.current),!o&&e.stateSettings.allowLocalStorage&&(o=window.localStorage.getItem(t)),o&&("string"==typeof o&&(o=JSON.parse(o)),e._loadState(o))}if(e.onAfterInit&&(e.onAfterInit(e),e.onAfterInit=null),e.$.fireEvent("afterInit",{grid:e}),e.isRendering=!1,e.whenRenderedCallbacks){for(let t=0;t<e.whenRenderedCallbacks.length;t++)e.whenRenderedCallbacks[t]();e.whenRenderedCallbacks=[]}!e.dataSource||e.dataSource.url||e.dataSource.virtualDataSource||e.onLoad&&e.onLoad(e)}"kanban"===e.view?e._initKanbanView():"scheduler"===e.view&&e._initSchedulerView()}_initFormulaParser(){const e=this;if(e.formulas){class t{constructor(e){const t=this;let o;try{o=new formulaParser.Parser}catch(e){throw new Error("Smart.FormulaParser: Missing reference to 'formula-parser.min.js'.")}o.on("callCellValue",t._callCellValue.bind(t)),o.on("callRangeValue",t._callRangeValue.bind(t)),t.dataTable=e,t.parser=o}_getFormula(e){const t=this,o="A".charCodeAt(0);let l=0,a="";const n=e;if(t.dataTable._formulas||(t.dataTable._formulas=[]),t.dataTable._formulas[e])return t.dataTable._formulas[e];for(let n=0;n<t.dataTable.columns.length;n++){const i=t.dataTable.columns[n],r=String.fromCharCode(o+l);l++,l>=26&&(l=0,a+="A"),e.indexOf(i.label)>=0?e=e.replaceAll(i.label,a+r):e.indexOf(i.dataField)>=0&&(e=e.replaceAll(i.dataField,a+r))}return t.dataTable._formulas[n]=e,e}_callCellValue(e,t){const o=this,l=o.dataTable,a=e.column.index,n=e.row.index,i=l.columns[a].dataField;let r=l.dataSource[n][i];const s=l.rows[n];if(s){const e=s.getCell(i);e&&e.formula&&(r=o._getFormula(e.formula))}"string"==typeof r&&/=.+/.test(r)?r=o.parse(r.slice(1)):"string"==typeof r&&"number"===l.columns[a].dataType&&(r=parseFloat(r)),t(r)}_callRangeValue(e,t,o){const l=this.dataTable,a=l.dataSource,n=[];for(let o=e.row.index;o<=t.row.index;o++){const i=a[o],r=[];for(let o=e.column.index;o<=t.column.index;o++){let e=i[l.columns[o].dataField];e=isNaN(e)?0:parseFloat(e),isNaN(e)&&(e=0),r.push(e)}n.push(r)}n&&o(n)}parse(e){const t=this.parser.parse(this._getFormula(e));return null!==t.result?t.result:t.error}}e._formulaParser=new t(e)}}get _viewRows(){const e=this;if(e.__viewRows)return e.__viewRows;e._nearRowsAdded||(e._nearRowsAdded=[],e._farRowsAdded=[]);const t=e.rows.toArray?e.rows.toArray():[],o=e.rowHierarchy?e.rowHierarchy:t,l=[].concat(e._frozenNearDefaultRows,e._nearRowsAdded,o,e._farRowsAdded,e._frozenFarDefaultRows);return e.__viewRows=l,l}_toHex(e){if(-1!==e.indexOf("#"))return e;const t=/rgb\((\d+), (\d+), (\d+)\)/g.exec(e);return t?"#"+(parseFloat(t[1]).toString(16).padStart(2,"0")+parseFloat(t[2]).toString(16).padStart(2,"0")+parseFloat(t[3]).toString(16).padStart(2,"0")).toUpperCase():"#FFFFFF"}_renderConditionalFormatting(e){const t=this,o=t.conditionalFormatting;if(!o||0===o.length)return;if(!t._defaults){const e=getComputedStyle(t);t._defaults={fontFamily:e.fontFamily,fontSize:e.fontSize,text:t._toHex(e.color),highlight:t._toHex(e.backgroundColor)}}t._formatter||(t._formatter=new Smart.Utilities.ConditionalFormatter(t.dataSource)),e&&(t._formatter=new Smart.Utilities.ConditionalFormatter(t.dataSource),delete t._conditionalFormatting);const l=t._defaults,a=t._formatter,n=[],i=function(e){if("all"===e){if(t.columns&&t.columns.map){const e=[];for(let o=0;o<t.columns.length;o++){const l=t.columns[o];l.dataField.startsWith("task")||l.autoGenerated||"number"!==l.dataType&&"date"!==l.dataType||e.push(l.dataField)}return e}return[]}return[e]};for(let e=0;e<o.length;e++){o[e]=Object.assign({column:"all",condition:"lessThan",firstValue:0,secondValue:1,fontFamily:l.fontFamily,fontSize:l.fontSize,text:l.text,highlight:l.highlight},o[e]);const t=o[e],r=i(t.column),s=t.condition;a.color=t.highlight,a.comparator=t.firstValue,a.min=t.firstValue,a.max=t.secondValue;const d=a.format(s,r);for(let e in d){const o=d[e];for(let e in o){const l=o[e];l.color=t.text,l.fontFamily=t.fontFamily,l.fontSize=t.fontSize}}n.push(d)}if(t._formattingPanel&&(t._formattingPanel.items=o),0===n.length)return n[0];const r={};for(let e=0;e<n.length;e++){const t=n[e];for(let e in t){const o=t[e];if(0!==Object.keys(o).length){r[e]||(r[e]={});for(let t in o)r[e][t]=Object.assign({},r[e][t],o[t])}}}t._conditionalFormatting=r,e&&t._recycle(!1)}_stickHeader(){const e=this;e._stickyHeaderHandler=function(){e._handleStickyHeader()},e.$.columnHeader.style.top="",e.$.columnHeader.classList.remove("smart-columns-sticky");let t=e.parentNode;for(e.isInShadowDOM&&t===e.getRootNode()&&(t=e.getRootNode().host);t!==document&&t;)t.addEventListener("scroll",e._stickyHeaderHandler),t=t.parentNode,e.isInShadowDOM&&t===e.getRootNode()&&(t=e.getRootNode().host);try{null!==window.top&&window.top!==window.self&&window.top.document.addEventListener("scroll",e._stickyHeaderHandler)}catch(e){}e._handleStickyHeader()}_unstickHeader(){const e=this;e.$.columnHeader.style.top="",e.$.columnHeader.classList.remove("smart-columns-sticky");let t=e.parentNode;for(;t!==document.body;)t.removeEventListener("scroll",e._stickyHeaderHandler),t=t.parentNode,e.isInShadowDOM&&t===e.getRootNode()&&(t=e.getRootNode().host);try{(""!==document.referrer||window.frameElement)&&null!==window.top&&window.top!==window.self&&window.top.document.removeEventListener("scroll",e._stickyHeaderHandler)}catch(e){}}_handleStickyHeader(){const e=this;if(e.appearance.allowColumnStickyPosition)if(e.$.columnHeader.classList.add("smart-columns-sticky"),0===document.scrollTop&&0===e.parentElement.scrollTop)e.$.columnHeader.style.top="";else{let t=e.parentNode,o=0;for(;t!==document.body;)o+=parseInt(t.scrollTop),t=t.parentNode,e.isInShadowDOM&&t===e.getRootNode()&&(t=e.getRootNode().host);const l=parseInt(e.clientTop+o);e.$.columnHeader.style.top=l+"px";let a=0;window.top!==window.self&&parseInt(window.top.scrollY)>parseInt(e._offsetTop(window.frameElement))&&(a=parseInt(window.top.scrollY)-parseInt(e._offsetTop(window.frameElement))),window.scrollY+a>e.offsetTop&&(e.$.columnHeader.style.top=parseInt(window.scrollY)-parseInt(e.offsetTop)+l+a+"px")}}_scrollHandler(){this._handleStickyHeader()}_initializeRowNumberColumn(){const e=this;if(e._frozenNearColumns&&e._frozenNearColumns.length>0&&e._frozenNearColumns[0].rowHeaderColumn)return void(e._frozenNearColumns[0].visible=e.appearance.showRowHeaderNumber||e.appearance.showRowHeader);const t=new Smart.Grid.Column({dataField:"_rowHeaderColumn",label:"",allowSelect:!1,freeze:!0,visible:!0,grid:e,autoGenerated:!0,rowHeaderColumn:!0,cellsAlign:"center"}),o=e.rows?e.rows.length:e.dataSource?e.dataSource.length:0;let l=e.appearance.showRowHeaderNumber?t._measureSize(o):30;e.layout.autoGenerateColumnWidth&&(l=e.layout.autoGenerateColumnWidth),e.appearance.showRowComments&&(l=25,t.minWidth=25),t.width=l,t.createElement();const a=new Smart.Observable(t,t.observables);e.viewColumns.splice(0,0,a),e._frozenNearColumns.splice(0,0,a)}_initializeColumns(){const e=this;if("number"==typeof e.columns){const t=[],o="A".charCodeAt(0);let l="",a=0;for(let n=0;n<e.columns;n++){let i=n+1;const r=String.fromCharCode(o+a);a++;const s=l+r;"number"!==e.appearance.autoGenerateColumnLabelMode&&(i=l+r),t.push({align:"center",label:i,dataField:s,width:100}),a>=26&&(a=0,l+="A")}e._boundColumns=t}else e._boundColumns=Array.isArray(e.columns)?[...e.columns]:[...e.columns.toArray()];e._initColumns=e.columns,e.columnByDataField=[],e.viewColumns=[],e.columns=new Smart.ObservableArray,e._frozenFarColumns=[],e._frozenNearColumns=[],e._summaryRowCount=1;let t=0;const o=function(t){if(e.dataSource.dataFields){const o=e.dataSource.dataFields.find((e=>{if(e.name===t.dataField)return e})),l=o&&o.dataType||"string";t.dataType||(t.dataType=l)}};if(0===e._boundColumns.length&&e.dataSource&&e.dataSource[0]&&!1!==e.dataSource.autoGenerateColumns){const t=e.dataSource[0];if(t.$&&t.$.isEmpty&&e.dataSource.dataFields)for(let t=0;t<e.dataSource.dataFields.length;t++){const o=e.dataSource.dataFields[t],l=e._boundColumns.length,a={index:l,visibleIndex:l,label:o.name,dataField:o.name,dataType:o.dataType};e._boundColumns.push(a)}else for(let l in t){if(l.startsWith("_")||"$"===l)continue;const t=e._boundColumns.length,a={index:t,visibleIndex:t,label:l,dataField:l};o(a),e._boundColumns.push(a)}}for(let l=0;l<e._boundColumns.length;l++){let a=e._boundColumns[l];if("string"==typeof a){if(e.dataSource.dataFields){const t=e.dataSource.dataFields.find((e=>{if(e.name===a)return e}));a={label:a,dataField:a,dataType:t&&t.dataType||"string"}}}else o(a);a.visibleIndex=l,a.index=l,a.grid=e,a.label&&/<.+?>/.test(a.label)&&a.label.replace&&("all"===e.dataSourceSettings.sanitizeHTML?a.label=a.label.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/'/g,"&#39;").replace(/"/g,"&quot;"):"blackList"===e.dataSourceSettings.sanitizeHTML&&(a.label=window.Smart.Utilities.Core.escapeHTML(a.label)));const n=new Smart.Grid.Column(a);e.onColumnInit&&e.onColumnInit(l,n);for(let t in n)-1!==n.properties.indexOf(t)||t.startsWith("_")||e.error(e.localize("invalidColumnProperty",{elementType:"Grid",propertyName:t,type:n.dataField||"Column"}));delete a.grid,delete a.dataType,delete a.index,delete a.visibleIndex,n.grid=e,e.columns.push(n),n._dataField&&(e.columnByDataField[n._dataField]=n);const i=e.columns[e.columns.length-1];e._summaryRowCount=Math.max(e._summaryRowCount,n.summary.length),n.freeze?!0===n.freeze||"near"===n.freeze?(e.viewColumns.splice(t++,0,i),e._frozenNearColumns.push(i)):"far"===n.freeze&&e._frozenFarColumns.push(i):e.viewColumns.push(i),e.columnByDataField[n.dataField]?(i.parent=e.columnByDataField[n.dataField],e.columnByDataField[n.dataField].children||(e.columnByDataField[n.dataField].children=[]),e.columnByDataField[n.dataField].children.push(i),n.valueField=n.dataField,n.dataField+="_"+e.columnByDataField[n.dataField].children.length,n.displayField=n.valueField,e.columnByDataField[n.dataField]=i):e.columnByDataField[n.dataField]=i,e.onColumnInserted&&!e.isInitialized&&e.onColumnInserted(l,n.getState())}e.viewColumns=e.viewColumns.concat(e._frozenFarColumns),e.$.content.setAttribute("aria-colcount",e._boundColumns.length);let l=0;if((e.appearance.showRowHeaderNumber||e.appearance.showRowHeader)&&(e._initializeRowNumberColumn(),l++),e.rowDetail.enabled){const t=20,o=new Smart.Grid.Column({dataField:"_rowDetailColumn",allowSelect:!1,visible:e.rowDetail.visible,label:"",grid:e,freeze:!0,rowDetailColumn:!0,autoGenerated:!0,cellsAlign:"center",width:t,minWidth:t}),a=new Smart.Observable(o,o.observables);e.rowDetailColumn=a,"near"===e.rowDetail.position?(e.viewColumns.splice(l,0,a),o.freeze="near",a.freeze="near",e._frozenNearColumns.splice(l,0,a)):(e.viewColumns.push(a),e._frozenFarColumns.splice(0,0,a)),l++}const a=new Smart.Grid.Column({dataField:"_adaptiveColumn",allowSelect:!1,visible:!1,label:"",grid:e,freeze:"far",adaptiveColumn:!0,autoGenerated:!0,cellsAlign:"center",width:30});new Smart.Observable(a,a.observables).canNotify=!1;const n=new Smart.Grid.Column({dataField:"_commandColumn",allowSelect:!1,visible:e.editing.enabled&&e.editing.commandColumn.visible&&!e.editing.commandColumn.inline,label:"",grid:e,freeze:"far",commandColumn:!0,autoGenerated:!0,align:"center",cellsAlign:"center",width:""}),i=new Smart.Observable(n,n.observables);i.canNotify=!1,e.editing.commandColumn.visible&&("near"===e.editing.commandColumn.position?(n.freeze="near",i.freeze="near",e.viewColumns.splice(l,0,i),e._frozenNearColumns.splice(l,0,i)):(e.viewColumns.push(i),e._frozenFarColumns.splice(0,0,i))),e._commandColumn=i;const r=new Smart.Grid.Column({allowSelect:!1,visible:e.selection.enabled&&e.selection.checkBoxes.enabled,dataField:"_checkBoxColumn",label:"",freeze:e.selection.checkBoxes.position,grid:e,selectionColumn:!0,autoGenerated:!0,cellsAlign:"center",width:32}),s=new Smart.Observable(r,r.observables);if(e.selection.checkBoxes.enabled&&("near"===r.freeze?(e.viewColumns.splice(l,0,s),e._frozenNearColumns.splice(l,0,s)):(e.viewColumns.push(s),e._frozenFarColumns.splice(0,0,s))),e._selectionColumn=s,e._selectionColumn.canNotify=!1,e.editing.addNewColumn.visible){const t=new Smart.Grid.Column({dataField:"_addNewColumn",allowSelect:!1,visible:!0,title:e.localize("addNewColumn"),label:"",cellsClassName:"smart-add-new-column",className:"smart-add-new-column smart-icon smart-grid-icon show smart-icon-plus",grid:e,adaptiveColumn:!1,autoGenerated:!0,cellsAlign:"center",width:90}),o=new Smart.Observable(t,t.observables);e.viewColumns.push(o),e._addNewColumn=o,e._addNewColumn.canNotify=!1}e._observeColumns(),e._templateColumns()}get styleProperties(){return["grid-template-columns","--smart-grid-row-height","--smart-grid-column-header-height","--smart-grid-group-header-height","--smart-grid-filter-footer-height","--smart-grid-group-row-vertical","--smart-grid-group-row-horizontal-offset","--smart-grid-freeze-splitter-size","--smart-grid-resize-line-size","--smart-grid-footer-height","--smart-grid-header-height"]}_templateColumns(){const e=this,t=getComputedStyle(e),o=t.getPropertyValue("--smart-grid-template-columns").trim();if(e._rowGap=0,e._columnGap=0,e._maxHeight=parseInt(t.maxHeight),e._minHeight=parseInt(t.minHeight),"none"!==o){let t=0;for(let o=0;o<e.viewColumns.length;o++)e.viewColumns[o].autoGenerated&&(t+=e.viewColumns[o].visible?e.viewColumns[o].width:0);let l=[];const a=document.createElement("div");a.style.display="grid",a.style.gridTemplateColumns=o;for(let t=0;t<e.columns.length;t++)a.innerHTML+="<div></div>";a.style.width=e.clientWidth-t+"px",e.$.root.appendChild(a);const n=o.split(" ");for(let t=0;t<e.columns.length;t++)l[t]=a.children[t].offsetWidth,"auto"===n[t]&&(l[t]=null);a.parentNode.removeChild(a);let i=0;for(let t=0;t<e.viewColumns.length;t++){const o=e.viewColumns[t];o.autoGenerated||l[i]&&(o.width=o.templateWidth=l[i++])}}else for(let t=0;t<e.viewColumns.length;t++){const o=e.viewColumns[t];o.autoGenerated||o.templateWidth&&(o.width=o.templateWidth=null)}}setColumns(e){const t=this;if(null===e)return void(t.columns=[]);t.beginUpdate(),t.columns.canNotify=!1;let o=[],l=[];for(let l=0;l<e.length;l++){const a=e[l];let n=!0;for(let e=0;e<t.columns.length;e++)if(t.columns[e].dataField===a.dataField){n=!1;break}n&&o.push(a)}const a=e.map((e=>e.dataField));for(let e=0;e<t.columns.length;e++){const o=t.columns[e];-1===a.indexOf(o.dataField)&&l.push(o)}l.forEach((e=>{const o=t.columns.indexOf(e);o>=0&&t.columns.splice(o,1)}));for(let e=0;e<o.length;e++)t.columns.push(o[e]);if(t.columns.canNotify=!0,t.endUpdate(),t._columnGroups=[],t._columnHeights=0,t.viewColumns)for(let e=0;e<t.viewColumns.length;e++){const o=t.viewColumns[e],l=o.element;o.top=0,o.level=0,l&&(l.style.top="",l.style.height="",l.style.lineHeight="")}if(t._renderColumns(),t.__columnHeaderHeight=null,e){t.beginUpdate();const o=t.context;t.context=document;for(let o=0;o<e.length;o++){const l=e[o],a=t.columnByDataField[l.dataField];["allowExport","allowFreeze","allowNull","allowGroup","allowSelect","verticalAlign","columnGroup","cellsVerticalAlign","autoCloseMenu","autoShowActionButton","autoShowSortButton","autoShowFilterButton","allowLabelAnimation","allowActionButtonAnimation","allowSortButtonAnimation","allowHide","allowDelete","allowEdit","allowSummary","allowHeaderEdit","allowFilter","allowSort","allowSortToggleOnClick","allowResize","allowReorder","description","icon","menuItems","summary","cellsFormat","className","rowSpan","cellsClassName","cellsCSSRules","formatSettings","formatFunction","sortIndex","sortOrder","sortComparator","groups","group","filtered","filterEditor","filter","filterMenuMode","defaultValue","dataField","displayField","label","labelTemplate","dataType","align","cellsWrap","cellsAlign","minWidth","width","visible","_visible","freeze","showActionButton","selected","showIcon","highlight","showDescriptionButton","treeColumn","statusColumn","value","valueField","onAction","title","showCustomButton","showFilterButton","showSortButton","editor","template","visibleIndex","validationRules"].forEach((e=>{void 0!==l[e]&&(a[e]=l[e])}))}t.context=o,t.endUpdate(!1)}t.refresh()}onAttached(){const e=this;if(!e._scrollView){e._scrollView=new Smart.Utilities.Scroll(e,e.$.horizontalScrollBar,e.$.verticalScrollBar);const t=e._scrollView.hScrollBar;e._scrollView.vScrollBar.onChange=e._verticalScrollbarHandler.bind(e),t.onChange=e._horizontalScrollbarHandler.bind(e)}if(e.isRendered&&e.isCompleted&&(e._isDestroyed||e.behavior.autoDestroy)){if(e.header.visible&&""===e.header.template){let t=e.$.header;e.header.appendTo&&(t=document.querySelector(e.header.appendTo),t?t.onclick=t=>{e._headerClickHandler(t)}:t=e.$.header),t.innerHTML='<smart-grid-toolbar header-position="top"></smart-grid-toolbar>',e.$.headerBar=t.firstElementChild;const o=e.$.headerBar;o.messages=e.messages,o.locale=e.locale,e.$.headerBar._init(e),o.render(),e.header.onInit&&e.header.onInit(e.$.headerBar)}e._render()}}destroy(){const e=this;if(!e.isRendered)return;e._isDestroyed=!0,["_dialogChart","_dialogAddRow","_dialogEdit","_dialogDelete","_dialogRowDetail","_dialogAddColumn"].forEach((t=>{e[t]&&(e[t].close(),e[t]=null)})),e.menu&&(e.menu.ownerElement=null,e.menu.remove(),e.menu=null);const t=e.$.headerBar;if(t){const e=t.$.headerDropDown;e&&e.remove()}e._resetCachedLayout();const o=e._scrollView.hScrollBar,l=e._scrollView.vScrollBar;if(l.ownerElement=null,o.ownerElement=null,l.onChange=null,o.onChange=null,e._scrollView&&(e._scrollView.unlisten(),delete e._scrollView),e._columnElements)for(let t=0;t<e._columnElements.length;t++)e._columnElements[t]._detach();if(e._columnElements=null,e._rowElements)for(let t=0;t<e._rowElements.length;t++)e._rowElements[t]._detach();e._rowElements=null,e.rows=[],e.rowById=[],e._initColumns=[],e.columnByDataField=[],e.viewColumns=[],e._columnToResizeElement=null;let a=Array.isArray(e.columns)?[...e.columns]:[...e.columns.toArray()];a=a.map((e=>e.data?(void 0!==e.data.visibleIndex&&delete e.data.visibleIndex,void 0!==e.data.index&&delete e.data.index,void 0!==e.data.grid&&delete e.data.grid,e.data):e)),e.rows.notifyFn=null,e.columns.notifyFn=null,e.columns.notify=null,e.columns._array=[],e.columns=a,e._boundColumns=[],e._filterPanels=[],e._frozenFarColumns=[],e._frozenNearColumns=[],e._frozenNearDefaultRows=[],e._frozenFarDefaultRows=[],e._frozenFarRows=[],e._frozenNearRows=[],e._selection&&e._selection.selectionRect&&(e._selection.selectionRect.parentNode&&e._selection.selectionRect.parentNode.removeChild(e._selection.selectionRect),e._selection.selectionRect=null),e._selection={rows:[],indexes:[],columns:[],cells:[]},e.__autoHeightRows=null,e._visibleRows=null,e.__viewRows=null,e.__clientSize=null,e.__scrollHeight=null,e.__scrollWidth=null,e.__parentCells=null,e._selectionColumn=null,e._adaptiveColumn=null,e._commandColumn=null,delete e._columnFarContainerComputedStyle,delete e._columnContainerComputedStyle,delete e._columnNearContainerComputedStyle,e._inputOverlay&&(e._inputOverlay.parentNode&&e._inputOverlay.parentNode.removeChild(e._inputOverlay),e._inputOverlay=null),e._firstVisibleColumn=null,e._lastVisibleColumn=null,e._toggledRow=null,Smart(e._selector)&&(delete Smart(e._selector)._properties,Smart(e._selector)),delete e._selector,delete e._initProperties}onDetached(){const e=this;e.behavior.autoDestroy&&e.destroy()}_observeColumns(){const e=this,t=function(t,o,l,a){if(l!==a||"selected"===o){if(null==l&&null==a)return;if(l&&"object"==typeof l&&Array.isArray(l)&&a&&"object"==typeof a&&Array.isArray(a)&&JSON.stringify(l)===JSON.stringify(a))return;t.propertyChanged(o,l,a),e.onColumnChange?t.stateProps.indexOf(o)>=0&&e.onColumnChange(t,o,l,a):e.$.fireEvent("columnChange",{column:t,propertyName:o,oldValue:l,value:a})}};for(let o=0;o<e.viewColumns.length;o++){const l=e.viewColumns[o];l.rowHeaderColumn||(l.onAction=function(){e._openMenu(this)}),l.autoGenerated&&l.notify((function(e){l.canNotify=!1,t(l,e.propertyName,e.oldValue,e.newValue),l.canNotify=!0}))}e.columns.notify((function(o){let l=null;if(o.path)return e.columns.canNotify=!1,t(o.target,o.propertyName,o.oldValue,o.newValue),void(e.columns.canNotify=!0);e.columns.canNotify=!1;let a=0;switch(o.action){case"length":return void(e.columns.canNotify=!0);case"add":{const t=function(t){if(l=o.object[t],l instanceof Smart.Grid.Column==0){l.grid=e,l=new Smart.Grid.Column(l);const a=e.columns.canNotify;e.columns.canNotify=!1,o.object[t]=l,l=o.object[t],e.columns.canNotify=a}l.grid=e,l.onAction=function(){e._openMenu(this)},l.freeze?e._frozenNearColumns.push(l):"far"===l.freeze&&e._frozenFarColumns.push(l);let a=e.viewColumns.length-e._frozenFarColumns.length,n=0;if(e._frozenNearColumns.forEach((e=>{e.autoGenerated&&n++})),t<e.columns.length?e.viewColumns.splice(t+n,0,l):e.viewColumns.splice(a,0,l),e.columnByDataField[l.dataField]){e.columnByDataField[l.dataField].children.push(l),l.parent=e.columnByDataField[l.dataField],l.valueField=l.dataField;const t=l.dataField+"_"+l.parent.children.length;e.columnByDataField[t]=l,l.dataField=t}else e.columnByDataField[l.dataField]=l;if(e.dataSource&&e.dataSource.dataFields){let t=!1;for(let o=0;o<e.dataSource.dataFields.length;o++)e.dataSource.dataFields[o].name===l.dataField&&(t=!0);t||e.dataSource.dataFields.push({name:l.dataField,dataType:l.dataType||"string"})}if(!e._dragDrop&&e.onColumnInserted){e._onColumnInsertData||(e._onColumnInsertData=[],e._onColumnInsertIndexes=[]);const o=l.getState();o.dataField=l.dataField,e._onColumnInsertData.push(o),e._onColumnInsertIndexes.push(t),e._onColumnInsertTimer&&clearTimeout(e._onColumnInsertTimer),e._onColumnInsertTimer=setTimeout((()=>{e.onColumnInserted(e._onColumnInsertIndexes,e._onColumnInsertData),delete e._onColumnInsertIndexes,delete e._onColumnInsertData}),50)}};delete e.__measuredColumnHeight;for(let e=0;e<o.addedCount;e++)t(o.index+e);break}case"update":l=o.object[o.index],l instanceof Smart.Grid.Column==0&&(l=new Smart.Grid.Column(l)),l.grid=e;for(let t=0;t<o.index;t++)e.viewColumns[t].autoGenerated&&a++;e.viewColumns[a+o.index]=l,e.columnByDataField[l.dataField]=l,e.onColumnUpdated&&e.onColumnUpdated(o.index,l);break;case"remove":{l=o.removed[0];let t=o.index,n=e.viewColumns.indexOf(l);if(-1===n){for(let o=0;o<=t;o++)e.viewColumns[o].autoGenerated&&a++;e.viewColumns.splice(a+t,1)}else e.viewColumns.splice(n,1);if(l){if(l.filter&&e.removeFilter(l.dataField),l.sortOrder&&e.removeSort(l.dataField),e.removeGroup(l.dataField),l._dataField){const t=e.columnByDataField[l._dataField];t&&t.dataField===l.dataField&&delete e.columnByDataField[l._dataField]}delete e.columnByDataField[l.dataField]}if(e._dragDrop||e.onColumnRemoved&&e.onColumnRemoved(o.index,l),e.columnGroups&&(e._columnGroups=[],e._columnHeights=0,e.viewColumns))for(let t=0;t<e.viewColumns.length;t++){const o=e.viewColumns[t],l=o.element;o.top=0,o.level=0,l&&(l.style.top="",l.style.height="",l.style.lineHeight="")}break}}e._initializeColumnGroupsHierarchy(),e._refreshColumnsResponsiveVisibility(),e._createColumnHeaderCellElements(),e._templateColumns(),e.refresh(),e.columnGroups&&e._columnGroups.length>0&&e._renderColumnGroupHeaders(),e.columns.canNotify=!0}))}get _scrollWidth(){const e=this;if(e.__scrollWidth)return e.__scrollWidth;let t=0;for(let o=0;o<e.viewColumns.length;o++){const l=e.viewColumns[o];l.visible&&(t+=l.computedWidth)}return t=parseInt(t),"card"===e.view&&(t=0),e.__scrollWidth=t,e._scrollView.scrollWidth=t-e._clientSize.width,e.__scrollWidth}_horizontalScrollbarHandler(){const e=this;e.closeMenu(),e.isScrolling=!0,e.isHScrolling=!0,e._hScrollTimer&&clearTimeout(e._hScrollTimer),e._hScrollTimer=setTimeout((()=>{e._summaryRowDialog&&e._summaryRowDialog.classList.contains("open")&&e._summaryRowDialog.close(),e._recycle(),e.isScrolling=!1,e.isHScrolling=!1}))}_mouseWheelNative(e,t){const o=this;void 0===o._scrollWheelContent&&(o._scrollWheelContent=document.createElement("div"),o._scrollWheelContent.style.width="100%",o._scrollWheelContent.style.height="100%",o._scrollWheelContent.style.position="absolute",o._scrollWheelContent.style.left="0px",o._scrollWheelContent.style.top="0px",o._scrollWheelContent.style.background="white",o._scrollWheelContent.style.zIndex=9999,o._scrollWheelContent.style.opacity=0,o._scrollWheelContent.style.overflow="auto",o._scrollWheelContent.style.visibility="hidden");let l=0;const a=()=>{if(t){const t=o._scrollWheelContent.scrollLeft;o._scrollView.hScrollBar.value=t,t===e&&o._scrollWheelContent.remove()}else{const t=o._scrollWheelContent.scrollTop;o._scrollView.vScrollBar.value=t,t===e&&o._scrollWheelContent.remove()}};o._scrollWheelContent.onscroll=()=>{cancelAnimationFrame(l),l=0,l=requestAnimationFrame(a)},o._scrollWheelContentView||(o._scrollWheelContentView=document.createElement("div"),o._scrollWheelContent.appendChild(o._scrollWheelContentView)),o._scrollWheelContentView.style.width=o.offsetWidth+o._scrollView.scrollWidth+"px",o._scrollWheelContentView.style.height=o.offsetHeight+o._scrollView.scrollHeight+"px",o.$.scrollView.appendChild(o._scrollWheelContent),o._scrollWheelContent.scrollTop=o._scrollView.vScrollBar.value,o._scrollWheelContent.scrollLeft=o._scrollView.hScrollBar.value,!0===t?o._scrollWheelContent.scrollTo({top:o._scrollView.vScrollBar.value,left:e,behavior:"smooth"}):o._scrollWheelContent.scrollTo({top:e,left:o._scrollView.hScrollBar.value,behavior:"smooth"})}_mouseWheelHandler(e){const t=this;if(t._scrollView.hScrollBar.$.hasClass("smart-hidden")&&t._scrollView.vScrollBar.$.hasClass("smart-hidden"))return;if(42===e.pointerId)return;if(t._isUpdating)return;if(t.editing.isEditing)return;if(!t.behavior.allowMouseWheel)return;const o=t.querySelector("smart-grid-toolbar");if(o&&o.$.headerDropDown.classList.contains("open"))return;let l=!1;if(e.wheelDeltaY?120!==Math.abs(e.wheelDeltaY)&&240!==Math.abs(e.wheelDeltaY)&&360!==Math.abs(e.wheelDeltaY)&&(l=!0):0===e.deltaMode&&(l=!0),t.disabled||t._scrollView.vScrollBar.$.hasClass("smart-hidden")||e.shiftKey||!e.deltaY){if(!t.disabled&&(!t._scrollView.hScrollBar.$.hasClass("smart-hidden")||e.shiftKey)){e.stopPropagation(),e.preventDefault();let o=160;const a=0===e.deltaX?e.wheelDelta:e.deltaX;a<0&&(o=-160),Math.abs(a)>=100&&!l&&!Smart.Utilities.Core.Browser.Firefox?t._mouseWheelNative(t._scrollView.scrollLeft+o,!0):t._scrollView.scrollLeft+=a}}else{const o=t.scrollTop;if(0===o&&e.deltaY<0||o===t.scrollHeight&&e.deltaY>0)return;e.stopPropagation(),e.preventDefault();let a=15*t.layout.rowMinHeight;if(e.deltaY<=0&&(a=-15*t.layout.rowMinHeight),Math.abs(e.deltaY)>=100&&!l&&!Smart.Utilities.Core.Browser.Firefox)t._mouseWheelNative(t._scrollView.scrollTop+a);else{t._wheelrafId=0;const o=()=>{t._scrollView.scrollTop+=e.deltaY};cancelAnimationFrame(t._wheelrafId),t._wheelrafId=0,t._wheelrafId=requestAnimationFrame(o)}}}_refresh(e){const t=this;if(t._isUpdating)return;const o=t.$.verticalScrollBar.offsetWidth;t.removeAttribute("grouped"),t.removeAttribute("tree");let l=!0;t.__autoHeightRows&&(t.__autoHeightRows=null,t._refreshColumnsResponsiveVisibility(),t._recycle(),l=!1),t._groups||(t._groups=[]),t._cellCachedValues=[],t.grouping.enabled&&t.dataSource.groupBy&&t.dataSource.groupBy.length>=0&&("advanced"===t.grouping.renderMode?t.setAttribute("grouped",""):t.setAttribute("tree",""),t._groups||(t._groups=[].concat(t.dataSource.groupBy.toArray())||[]),t._renderGroupBar()),t.grouping.enabled&&t.dataSource.groupBy&&0===t.dataSource.groupBy.length?t.$.breadcrumb&&(t.$.breadcrumb.dataSource=[]):t.dataSource.boundHierarchy&&(t.setAttribute("tree",""),t.$.content.setAttribute("role","treegrid"),t.$.container.removeAttribute("role")),(t.isInitialized||l)&&t._refreshColumnsResponsiveVisibility(),t._refreshLayout(),o!==t.$.verticalScrollBar.offsetWidth&&(t.__scrollWidth=null,t._refreshColumnsResponsiveVisibility(),t._refreshScrollBars(),0===t.$.verticalScrollBar.offsetWidth&&t.isRendered&&requestAnimationFrame((()=>{t._refreshScrollBars()}))),t._refreshSelection(),t._deleteCopyRects(),t._conditionalColors&&t._conditionalColors.update&&t._conditionalColors.update(),"add"===e||"remove"===e||"update"===e?(t._rowChangeTimeout&&clearTimeout(t._rowChangeTimeout),"remove"===e?(t._recycle(!1),t._refreshHeaderBar()):t._rowChangeTimeout=setTimeout((()=>{t._recycle(!1),t._refreshHeaderBar()}),100)):(t._recycle(),t._refreshHeaderBar()),t._recyclingRows&&0===t._recyclingRows.length&&(t.$.placeholder.classList.remove("smart-hidden"),t.scrollHeight=0,t.$.placeholder.innerHTML=t.messages[t.locale]&&t.messages[t.locale].placeholder?t.localize("placeholder"):t.appearance.placeholder,t.filtering.filterRow.visible&&(t.$.placeholder.style.top="0px",t.$.placeholder.style.position="relative",t._filters&&t._filters.length&&(t.$.placeholder.style.top="12px")),t._filters&&t._filters.length&&(t.$.placeholder.innerHTML=`<span class="smart-grid-icon show smart-icon-filter" style="\n font-size: calc(2 * var(--smart-font-size));\n cursor: default;\n margin-right: 10px;\n "></span>${t.localize("filteredRecords")}`)),t.dataSource&&t.dataSource.boundHierarchy&&t.conditionalFormatting&&t._renderConditionalFormatting(!1),t.filtering.enabled&&t.filtering.filterRow.visible&&(t._suspendFilterRowRefresh||t._refreshFilterRowEditors(),t._recycle(!1)),requestAnimationFrame((()=>{t._width=t.offsetWidth,t._height=t.offsetHeight}))}_refreshHeaderBar(){const e=this;e.$.headerBar&&e.header.visible&&e.$.headerBar._refresh()}_resizeHandler(e){const t=this;if((t.enableShadowDOM?e.composedPath()[0]:e.target)===t&&!t._isUpdatingScrollBars){if(!t.isInitialized)return t._undoRedo=[],t._refreshCurrentUser(),void t._render();if(!1===t._resizeHandling||!t.offsetHeight)return void(!1===t._resizeHandling&&(t.layout.isDirty=!0));t._isUpdatingScrollBars=!0,t._autoHeight=!1,t.$.content&&t.$.content.classList.remove("auto-height");const e=t._rowElements?t._rowElements.length*t.layout.rowMinHeight:0;(e>0||"grid"!==t.view&&"card"!==t.view)&&(t.offsetHeight>=e?(t._refreshLayout(),t._initializeRowElements()):"grid"!==t.view&&t._refreshLayout()),t.refresh(),t.$.headerBar&&t.$.headerBar.refreshTools(),t._dialogAddColumn&&t._dialogAddColumn.classList.contains("open")&&t._dialogAddColumn.refresh(),t._isUpdatingScrollBars=!1}}_refreshColumnsResponsiveVisibility(){const e=this,t=e.$.columnContainer,o=e.$.columnNearContainer,l=e.$.columnFarContainer;let a=0,n=0,i=0,r=!1;const s=e.columns.canNotify;e.columns.canNotify=!1;for(let t=0;t<e.viewColumns.length;t++){const o=e.viewColumns[t];o.setProperty("_treeColumn",!1,!1),e.grouping.enabled&&e.grouping.autoHideGroupColumn&&e.dataSource.groupBy&&e.dataSource.groupBy.indexOf(o.dataField)>=0&&o.setProperty("visible",!1,!1),o.visible&&!o.autoGenerated&&!r&&e.dataSource.boundHierarchy&&(o.setProperty("_treeColumn",!0,!1),r=!0)}e._refreshColumnWidths(),e.columns.canNotify=s;let d=0,c=0;for(let t=0;t<e.viewColumns.length;t++){const o=e.viewColumns[t];o.visible&&(o.freeze&&(!0===o.freeze||"near"===o.freeze?(a+=o.computedWidth,o.autoGenerated&&(d+=o.computedWidth)):"far"===o.freeze&&(n+=o.computedWidth,o.autoGenerated&&(c+=o.computedWidth))),i+=o.computedWidth)}t.style.width=i+"px",o.style.width=a+"px",l.style.width=n+"px",l.classList.remove("smart-hidden"),o.classList.remove("smart-hidden"),0===n&&l.classList.add("smart-hidden"),0===a&&o.classList.add("smart-hidden"),l.classList.remove("border-collapse"),n===c&&l.classList.add("border-collapse"),e._autoGeneratedColumnsNearWidth=d,e._autoGeneratedColumnsFarWidth=c,e._computedColumnsWidth=i,e._frozenColumnsNearWidth=a,e._frozenColumnsFarWidth=n}_selectStartHandler(e){const t=this;t.isScrolling||t.editing.isEditing||"grid"!==t.view||t.selection.defaultSelection||e.preventDefault()}setFocusable(e){const t=this;!t.disabled&&e?t.tabIndex=0:t.removeAttribute("tabindex")}_setLoadingIndicatorVisibility(){const e=this;e.appearance.displayLoadingIndicator?e.$.loadingIndicatorContainer.classList.remove("smart-visibility-hidden"):e.$.loadingIndicatorContainer.classList.add("smart-visibility-hidden")}_refreshElementsVisibility(){const e=this,t=function(e,t){e&&(t?e.classList.remove("smart-hidden"):e.classList.add("smart-hidden"))};if(t(e.$.placeholder,!e.rows||e.rows&&0===e.rows.length||0===e.columns.length),t(e.$.footer,e.footer.visible),t(e.$.header,e.header.visible&&!e.header.appendTo),t(e.$.groupHeader,e.groupHeader.visible||e.grouping.groupBar.visible),t(e.$.columnHeader,e.columnHeader.visible&&e.columns.length>0),t(e.$.headerCommandBar,e.editing.commandBar.visible&&"far"!==e.editing.commandBar.position),t(e.$.footerCommandBar,e.editing.commandBar.visible&&"near"!==e.editing.commandBar.position),t(e.$.breadcrumb,e.groupHeader.visible||e.grouping.groupBar.visible),e.htmlColumnLastChild.classList.add("smart-visibility-hidden"),e.pager&&e.pager.visible&&e.paging.enabled)switch(e.pager.position){case"near":t(e.$.headerPager,!0),t(e.$.footerPager,!1);break;case"far":t(e.$.headerPager,!1),t(e.$.footerPager,!0);break;case"both":t(e.$.headerPager,!0),t(e.$.footerPager,!0)}else t(e.$.footerPager,!1),t(e.$.headerPager,!1)}_getId(){const e=this;return e.dataSource&&e.dataSource.id?e.dataSource.id:e.dataSourceSettings.id?e.dataSourceSettings.id:void 0}_refreshRowHierarchy(e,t=!1){const o=this;o.rowHierarchy=null;let l=0,a=!1;if(!o.grouping.enabled&&o.dataSource.groupBy&&o.dataSource.groupBy.length>0&&(a=!0),o.grouping.enabled&&o.dataSource.groupBy&&0===o.dataSource.groupBy.length)return;let n=!1;if(o.grouping.enabled&&o.dataSource.groupBy&&o.dataSource.groupBy.length>0&&o.dataSource.virtualDataSourceOnExpand&&(n=!0),o.dataSource.boundHierarchy){const i=o.dataSource.reservedNames,r=function(e){return new Smart.Grid.Row({data:e,grid:o,index:o.rows.length})};let s=0;const d=function(t,l){for(let c=0;c<t.length;c++){const u=t[c];let m=o.rowById[u.$.id];if(n&&(m=o.rows[s],m||(m=r(u),o.rows.push(m)),u[i.leaf]?m.id=u.$.id:m.id="Group_"+u.$.id,o.rowById[m.id]=m),m||(m=r(u),o.rowById[m.id]=m),m.data=u,m.leaf=u[i.leaf]||!1,m.level=u[i.level],m.groupDataField=u.groupDataField,o.hasAttribute("tree")&&o.dataSource&&o.dataSource.childrenDataField&&(m.index=s),!m.groupDataField&&o.appearance.showTreeRowHeader&&(m.groupDataField=o.columns[m.level].dataField),m.label=u.label,m.groupDataField){const e=o.columnByDataField[m.groupDataField];if(e&&e.editor.dataSource)for(let t=0;t<e.editor.dataSource.length;t++){const o=e.editor.dataSource[t];if(""+o.value===m.label){void 0!==o.label?(m.label=o.label,m.labelValue=o.value):void 0!==o.name&&(m.label=o.name,m.labelValue=o.value);break}}}if(m.children=[],m.data&&(m.filtered=void 0===m.data.$.filtered||m.data.$.filtered),u.summaryRow&&(m.summaryRow=!0),(null===o._toggledRow||o._toggledRow&&o._toggledRow.id!==m.id)&&(m.expandHeight=0),u.parent?(m.parent=o.rowById[u.parent.$.id],m.parentId=u.parent.$.id):(m.parent=null,m.parentId=null),o.grouping.onGroupDefaultExpanded&&!o.isRendered){const e=o.grouping.onGroupDefaultExpanded(u);e&&(m.expanded=u[i.expanded]=e)}o.appearance.allowRowToggleAnimation||void 0!==u[i.expanded]&&(m.expanded=u[i.expanded]);let p=!!e||m.expanded;a&&(p=!0);const g=o.dataSource&&o.dataSource.id||o.dataSourceSettings.id;if(g&&!m.data[g]&&o.grouping.enabled&&o.dataSource&&o.dataSource.groupBy.length){const e=o.dataSource.groupBy[m.level];u.parent&&u.parent.expanded&&(""===m.data[e]&&o.dataSource.id&&!m.data.data[o.dataSource.id]||m.leaf&&!m.data[g])&&(s++,m.filtered=!1)}if(!0===m.visible&&!1!==m.filtered)if(s++,p||u[i.leaf])if(l.push(m),u.children&&u.children.length>0){const e=d(u.children,new Array);0===e.length&&(m.leaf=!0);for(let t=0;t<e.length;t++)l.push(e[t]);m.children=e}else u.children&&0===u.children.length&&(o.dataSource.virtualDataSource&&o.dataSource.virtualDataSourceOnExpand?m.data._loaded&&(m.leaf=!0):m.leaf=!0);else if(l.push(m),u.children&&u.children.length>0){const e=d(u.children,new Array);0===e.length&&(m.leaf=!0),m.children=e}else u.children&&0===u.children.length&&(o.dataSource.virtualDataSource&&o.dataSource.virtualDataSourceOnExpand?m.data._loaded&&(m.leaf=!0):m.leaf=!0)}return l};let c=o.dataSource.boundHierarchy;if(o.paging.enabled&&!t){let e=[];const t=e=>{let l=[];if(0===o.dataSource.groupBy.length)return e;for(let o=0;o<e.length;o++){const a=e[o];(!a.$||void 0===a.$.filtered||a.$.filtered)&&(l.push(a),a.children&&(l=l.concat(t(a.children))))}return l};if(o.dataSource&&!o.dataSource.virtualDataSource){for(let o=0;o<c.length;o++){let l=c[o],a=!l.$||void 0===l.$.filtered||l.$.filtered;!a&&null!==a||0!==l.level||l.parent||(t(l.children).length,e.push(l))}c=e.slice(o.paging.pageIndex*o._pageSize,(o.paging.pageIndex+1)*o._pageSize)}}const u=o.rows.canNotify;o.rows.canNotify=!1,o.rowHierarchy=d(c,new Array),o.rows.canNotify=u;let m=[];for(let e=0;e<o.rowHierarchy.length;e++){const t=o.rowHierarchy[e],a=t.canNotify;t.leaf&&m.push(t),t.canNotify=!1,o.grouping.enabled&&o.dataSource&&o.dataSource.groupBy.length?t.leaf?t.visibleIndex=l++:t.visibleIndex=-1:t.visibleIndex=l++,t.canNotify=a}if(a&&(o.rowHierarchy=m),o._rowElements.length<o.rowHierarchy.length&&!o._toggledRow){o._initializeRowElements();let e=0,t=o.rows.canNotify;o.rows.canNotify=!1;for(let t=0;t<o.rowHierarchy.length;t++){const l=o.rowHierarchy[t],a=o.layout.rowHeight||o.layout.rowMinHeight;void 0===l.top&&(l.top=e,l.height=l.cellHeight=a),l.height?e+=l.height:e+=a}o.rows.canNotify=t,o._recycle(!1,!0)}if(o.grouping.summaryRow.visible&&!o.grouping.summaryRow.inline){const e=function(t,o,l,a){if(0!==t&&o.length>0&&o[o.length-1]&&!o[o.length-1].summaryRow){let e={label:" ",boundSource:[],groupDataField:l.data.groupDataField,$:{},summaryRow:!0,leaf:!0,level:t,expandHeight:0,siblings:o};e.$.id="SubRow"+a+"_"+l.data.$.id,l&&(e.parent=l.data,e.parentId=l.data.$.id),e.data=Object.assign(e),o.push(e)}for(let t=0;t<o.length;t++)o[t]&&o[t].data&&o[t].data.children&&e(o[t].level+1,o[t].data.children,o[t],t)};e(0,o.rowHierarchy,null,0)}}}applyContent(){}_refreshContentHeight(){const e=this;let t=e._clientSize.height;const o=window.scrollY;let l,a,n=!1;if((!e._contentHeight||e._maxHeight||e._autoHeight||e.__autoHeight||"hidden"===e.verticalScrollBarVisibility)&&(n=!0),n&&(l=e.offsetHeight,e.$.container.classList.add("smart-hidden"),a=e.offsetHeight,e.$.container.classList.remove("smart-hidden")),window.scrollY!==o&&window.scrollTo(window.scrollX,o),"hidden"===e.verticalScrollBarVisibility||e.layout.autoHeight||l!==a||e._minHeight&&e._minHeight===l)return t=e._scrollHeight+e.$.columnHeader.offsetHeight+e.$.filterFooter.offsetHeight,e.header.visible&&!e.header.appendTo&&(t+=e.$.header.offsetHeight),e.summaryRow.visible&&(t+=e.layout.rowMinHeight),0===e._recyclingRows.length&&0===e._scrollHeight&&(t+=e.$.scrollView.offsetTop),e._minHeight>t&&(t=e._minHeight),e.$.content.style.height=t+"px",e._contentHeight=t,void(e._maxHeight<t?(e._autoHeight=!1,e.$.content.classList.remove("auto-height"),e.$.content.style.height=e._maxHeight+"px",e.header.visible&&!e.header.appendTo?(e.$.content.style.height=e._maxHeight-e.$.header.offsetHeight+"px",e._contentHeight=e._maxHeight-e.$.header.offsetHeight):e._contentHeight=e._maxHeight):(e._autoHeight=!0,e.__autoHeight=!0,e.$.content.classList.add("auto-height"),e.filtering.filterRow.visible&&(e.filtering.filterRow.visible,e._contentHeight=t,e.$.content.style.height=e._contentHeight+"px"),e.header.visible&&!e.header.appendTo?(e._contentHeight=t-e.$.header.offsetHeight,e.$.content.style.height=e._contentHeight+"px"):e.summaryRow.visible&&(e.$.content.style.height=e._contentHeight+"px")));if(e.header.visible&&!e.header.appendTo&&(t-=e.$.header.offsetHeight),(e.groupHeader.visible||e.grouping.groupBar.visible)&&(t-=e.$.groupHeader.offsetHeight),e.footer.visible&&(t-=e.$.footer.offsetHeight),e.pager.visible&&(t-=e.$.headerPager.offsetHeight,t-=e.$.footerPager.offsetHeight),e.editing.enabled&&e.editing.commandBar.visible&&(t-=e.$.headerCommandBar.offsetHeight,t-=e.$.footerCommandBar.offsetHeight),e.$.content.style.height!==t+"px"&&(e.$.content.style.height=t+"px"),e.$.viewContent.style.height!==t+"px"&&(e.$.viewContent.style.height=t+"px"),e._contentHeight=t,!e.appearance.showViewBar||e.appearance.viewBarAppendTo||e.appearance.showViewBarAsDropdown)e.$.viewBar.classList.add("smart-hidden"),e.$.content.style.width="",e.$.viewContent.style.width="",e.$.content.style.marginLeft="",e.$.viewContent.style.marginLeft="";else{const o=e.layout.viewBarWidth+5;e.$.viewBar.classList.remove("smart-hidden"),e._mobile||(e.$.content.style.width="calc(100% - "+o+"px)",e.$.viewContent.style.width="calc(100% - "+o+"px)",e.$.content.style.marginLeft=o+"px",e.$.viewContent.style.marginLeft=o+"px"),e.$.viewBar.style.width=o+"px";let l=0;e.header.visible&&!e.header.appendTo&&(l+=e.$.header.offsetHeight),(e.groupHeader.visible||e.grouping.groupBar.visible)&&(l+=e.$.groupHeader.offsetHeight),e.pager.visible&&(l+=e.$.headerPager.offsetHeight),e.$.viewBar.style.top=l+"px",e.$.viewBar.style.height=t+"px"}}appendChild(){const e=Array.prototype.slice.call(arguments,2);return HTMLElement.prototype.appendChild.apply(this,e.concat(Array.prototype.slice.call(arguments)))}removeChild(){const e=Array.prototype.slice.call(arguments,2);return HTMLElement.prototype.removeChild.apply(this,e.concat(Array.prototype.slice.call(arguments)))}get _contentBorder(){const e=this;if(e.__contentBorder)return e.__contentBorder;const t=getComputedStyle(e.$.content),o={left:parseFloat(t.borderLeftWidth)+parseFloat(t.borderRightWidth),top:parseFloat(t.borderTopWidth)+parseFloat(t.borderBottomWidth)};return e.__contentBorder=o,o}_refreshAutoSize(){const e=this;if(e.layout.autoWidth){const t=e._isUpdatingScrollBars;e._isUpdatingScrollBars=!0;let o=2;for(let t=0;t<e.viewColumns.length;t++){const l=e.viewColumns[t];l.visible&&(o+=l.computedWidth)}o+=e.$.verticalScrollBar.offsetWidth>0?e.$.verticalScrollBar.offsetWidth:0,e.style.width=o+"px",requestAnimationFrame((()=>{e._isUpdatingScrollBars=t}))}e.layout.autoHeight&&(e.style.height="auto")}_refreshLayout(){const e=this,t=e.rows;if(e._layoutSuspended)return;e._visibleRows=null,e.__viewRows=null,e.__clientSize=null,e.__scrollHeight=null,e.__scrollWidth=null,e.__parentCells=null,e.$.columnFarContainer.classList.remove("vscroll"),e.$.columnNearContainer.classList.remove("vscroll"),e.$.scrollView.classList.remove("hscroll"),e.$.scrollView.classList.remove("vscroll"),e._refreshAutoSize(),e._refreshElementsVisibility(),e._refreshRowHierarchy(),e._refreshColumnHeights(),e._refreshContentHeight();const o=()=>{e.$.placeholder.classList.remove("smart-hidden"),e.$.placeholder.innerHTML=e.messages[e.locale]&&e.messages[e.locale].placeholder?e.localize("placeholder"):e.appearance.placeholder,e._filters&&e._filters.length&&(e.$.placeholder.innerHTML=e.localize("filteredRecords")),e.__filterFooterOffsetHeight||(e.__filterFooterOffsetHeight=e.$.filterFooter.classList.contains("smart-hidden")?0:e.$.filterFooter.offsetHeight),!e.__columnHeaderHeight&&e.$.columnHeader.offsetHeight&&(e.__columnHeaderHeight=e.$.columnHeader.offsetHeight);let t=e._contentHeight-e.__filterFooterOffsetHeight-e.__columnHeaderHeight;e.$.scrollView.style.height=t+"px",e.scrollWidth=0,e.scrollHeight=0,e.clearSelection(),e._showAddNewRowButton("float"),e.$.content.classList.contains("auto-height")&&(e.$.placeholder.style.height=t+"px")};if(t&&t.url)e._showAddNewRowButton("float");else{if(!t||null===t||0===t.length||0===e.columns.length)return o(),0!==e.columns.length&&e.hasVisibleColumn()?e.editing.addNewColumn._addButton&&e.editing.addNewColumn._addButton.classList.remove("show"):(e._showAddNewColumnButton(),e.$.columnHeader.classList.add("smart-hidden"),e.__columnHeaderHeight=0),void e._refreshScrollBars();e._showAddNewRowButton("float"),e.editing.addNewColumn._addButton&&e.editing.addNewColumn._addButton.classList.remove("show")}0!==e.columns.length&&e.hasVisibleColumn()?e.editing.addNewColumn._addButton&&e.editing.addNewColumn._addButton.classList.remove("show"):(o(),0!==e.columns.length&&e.hasVisibleColumn()||(e._showAddNewColumnButton(),e.$.columnHeader.classList.add("smart-hidden"),e.__columnHeaderHeight=0),e._showAddNewColumnButton()),"card"===e.view&&(e.__columnHeaderHeight=0),!e.__columnHeaderHeight&&e.$.columnHeader.offsetHeight&&(e.__columnHeaderHeight=e.$.columnHeader.offsetHeight),e.__filterFooterOffsetHeight||(e.__filterFooterOffsetHeight=e.$.filterFooter.classList.contains("smart-hidden")?0:e.$.filterFooter.offsetHeight);let l=e._contentHeight-e.__filterFooterOffsetHeight-e.__columnHeaderHeight;if(e.$.scrollView.style.height=l+"px",e.htmlColumnLastChild.style.height=e.__columnHeaderHeight+"px",e.paging.spinner.enabled&&e.paging.enabled){if(!e.pageScroll){const t=document.createElement("smart-scroll-bar");t.orientation="vertical",t.style.height="100%",t.style.width="100%",t.max=Math.ceil(e.dataSource.length/e._pageSize),t.step=e.paging.spinner.step,t.largeStep=e.paging.spinner.step,t.setAttribute("spinner",""),t.setAttribute("smart-id","spinner"),t.ownerElement=e,e.addPropertyBinding("[[paging_spinner_step]]","step",t,e.$.columnHeader),t.addEventListener("change",(function(t){e.paging.pageIndex=t.detail.value,e._refreshLayout(),e._refreshSelection(),e.dataSource&&e.dataSource.virtualDataSource?e._virtualDataRequest("pageIndexChange"):(e._recycle(),e._scrollUpdate&&clearTimeout(e._scrollUpdate),e._scrollUpdate=setTimeout((function(){e.isScrolling||(e.$.rowContainer.style.top=parseInt(e.$.rowContainer.style.top)+.01+"px")}),50))})),e.pageScroll=t}e.htmlColumnLastChild.appendChild(e.pageScroll)}else e.htmlColumnLastChild.innerHTML="";e._refreshScrollBars()}_refreshScrollBars(){const e=this;if(!e._scrollView)return;const t=e._scrollView.vScrollBar,o=e._scrollView.hScrollBar,l=e._contentHeight-e.__filterFooterOffsetHeight-e.__columnHeaderHeight,a=e.$.scrollView.offsetWidth,n=e._scrollWidth-a-e._contentBorder.left,i=e._scrollHeight-l-e._contentBorder.top,r=e._columnNearContainerComputedStyle?e._columnNearContainerComputedStyle:getComputedStyle(e.$.columnNearContainer),s=e._columnFarContainerComputedStyle?e._columnFarContainerComputedStyle:getComputedStyle(e.$.columnFarContainer),d=parseInt(e.$.columnNearContainer.style.width)+parseInt(r.borderRightWidth),c=parseInt(e.$.columnFarContainer.style.width)+parseInt(s.borderLeftWidth);if(e.__frozenNearWidth=d,e.__frozenFarWidth=c,e._columnNearContainerComputedStyle=r,e._columnFarContainerComputedStyle=s,e._refreshHorizontalScrollBarVisibility(n),e._refreshVerticalScrollBarVisibility(i),t.style.height=l+"px",e.computedVerticalScrollBarVisibility?(e.__scrollBarSize||(e.__scrollBarSize=t.offsetWidth),e.__scrollWidth+=e.__scrollBarSize,e._refreshHorizontalScrollBarVisibility(e._scrollWidth-a-1),e.rightToLeft?e.$.columnNearContainer.classList.add("vscroll"):e.$.columnFarContainer.classList.add("vscroll"),e._refreshVerticalScrollBarVisibility(i),e.htmlColumnLastChild.classList.remove("smart-visibility-hidden"),e.$.scrollView.classList.add("has-vscroll")):e.$.scrollView.classList.remove("has-vscroll"),o.style.width=a+"px",e.rightToLeft?o.style.right="0px":o.style.left="0px",e.computedVerticalScrollBarVisibility&&e.computedHorizontalScrollBarVisibility&&(o.style.width=a-t.offsetWidth+"px",t.style.height=l-o.offsetHeight+"px"),e.computedHorizontalScrollBarVisibility?(e.$.scrollView.classList.add("hscroll"),e._autoHeight?(e.$.content.style.height="auto",e.$.scrollView.style.height="auto",e.$.scrollView.style.paddingBottom=o.offsetHeight+"px",e.$.placeholder.style.marginTop=o.offsetHeight+"px",e.summaryRow.visible&&(e.$.scrollView.style.paddingBottom=o.offsetHeight+e.layout.rowMinHeight+"px"),e.filtering.enabled&&e.filtering.filterRow.visible&&(e.$.scrollView.style.paddingBottom=o.offsetHeight+e.layout.rowMinHeight+"px")):(e.$.scrollView.style.paddingBottom="",e.$.placeholder.style.marginTop="")):e.$.scrollView.classList.remove("hscroll"),(e.__frozenNearHeight>0||e._frozenNearRows&&e._frozenNearRows.length>0)&&!e.appearance.showVerticalScrollBarOnFixedColumns){const o=getComputedStyle(e.$.rowNearContainer),l=e.__frozenNearHeight+parseInt(o.borderBottomWidth);t.style.height=parseInt(t.style.height)-l+"px",t.style.top=l+"px",t.style.setProperty("--smart-scroll-bar-near-size",l+"px")}else e.appearance.showVerticalScrollBarOnFixedColumns&&(t.style.top="0px");if((e.__frozenFarHeight>0||e._frozenFarRows&&e._frozenFarRows.length>0)&&!e.appearance.showVerticalScrollBarOnFixedColumns){const o=getComputedStyle(e.$.rowFarContainer),l=-2+e.__frozenFarHeight+parseInt(o.borderTopWidth);t.style.height=parseInt(t.style.height)-l+"px",t.style.setProperty("--smart-scroll-bar-far-size",l+"px"),0===e.__frozenNearHeight&&(t.style.top="0px")}(d>0||c>0)&&!e.appearance.showHorizontalScrollBarOnFixedColumns&&(o.style.width=parseInt(o.style.width)-d-c+"px",e.rightToLeft?o.style.right=d+"px":o.style.left=d+"px",o.style.setProperty("--smart-scroll-bar-near-size",d+parseInt(r.borderRightWidth)+"px"),o.style.setProperty("--smart-scroll-bar-far-size",c+parseInt(r.borderLeftWidth)+"px"),e.computedVerticalScrollBarVisibility&&(e.__scrollBarSize||(e.__scrollBarSize=t.offsetWidth),o.style.setProperty("--smart-scroll-bar-far-size",c+e.__scrollBarSize+"px"))),t.refresh(),o.refresh(),e._mobile&&(e._scrollContentView.style.width=e.$.scrollView.offsetWidth+e._scrollView.scrollWidth+"px",e._scrollContentView.style.height=e.$.scrollView.offsetHeight+e._scrollView.scrollHeight+"px")}_refreshHorizontalScrollBarVisibility(e){const t=this;t.scrollWidth=e,t.computedHorizontalScrollBarVisibility||(t.scrollLeft=0)}_refreshVerticalScrollBarVisibility(e){const t=this;if(t._autoHeight)return t.scrollTop=0,void(t.scrollHeight=0);t.computedHorizontalScrollBarVisibility&&(e+=t.$.horizontalScrollBar.offsetHeight),t.scrollHeight=e,t.paging.enabled&&t.paging.spinner.visible&&t.$.verticalScrollBarVisibility.classList.remove("smart-hidden"),t.computedVerticalScrollBarVisibility||(t.scrollTop=0)}_styleChangedHandler(e){const t=this;if(!e.detail.styleProperties.overflow&&!t.classList.contains("smart-grid-resize-mode")){if(e.detail.styleProperties["grid-template-columns"])return t._templateColumns(),void t.refresh();if(e.detail.styleProperties["font-size"])return t.layout.isDirty=!0,t._resetCachedLayout(),void t.refresh();(e.detail.styleProperties["--smart-grid-row-height"]||e.detail.styleProperties["--smart-font-size"]||e.detail.styleProperties["--smart-grid-column-header-height"]||e.detail.styleProperties["--smart-grid-group-header-height"]||e.detail.styleProperties["--smart-grid-filter-footer-height"]||e.detail.styleProperties["--smart-grid-group-row-vertical"]||e.detail.styleProperties["--smart-grid-group-row-horizontal-offset"]||e.detail.styleProperties["--smart-grid-freeze-splitter-size"]||e.detail.styleProperties["--smart-grid-resize-line-size"]||e.detail.styleProperties["--smart-grid-footer-height"]||e.detail.styleProperties["--smart-grid-header-height"])&&(t.layout.isDirty=!0),t.offsetWidth&&t.offsetHeight>0&&(t._resetCachedLayout(),t._refreshLayout(),t._recycle())}}_resetCachedLayout(){const e=this;delete e._columnHeights,e.__cellsCommandTemplate=null,e.__autoRowHeight=null,e.__autoHeightRows=null,e.__measuredColumnHeight=null,e.__columnHeaderHeight=null,e.__filterFooterOffsetHeight=null}_swipeLeftHandler(){}_swipeRightHandler(){}_getRowIndexByPosition(e){const t=this;return(o=>{let l=0,a=o.length-1;if(e<=0)return 0;const n=o[o.length-1];if(-1!==n.top&&n.top<=e)return o.length-1;for(;;){const n=Math.floor((l+a)/2),i=o[n];if(t._isRowInPosition(i,e))return n;i.top<e?l=n+1:i.top>e?a=n-1:l=n+1}})(t._recyclingRows)}_getVirtualRowIndexByPosition(e){let t=this.rows[0].height;const o=(e,o)=>0!==t&&e<=o&&e+t>o;return(l=>{let a=0,n=l.length-1;if(e<=0)return 0;const i=(l.length-1)*t;if(-1!==i&&i<=e)return l.length-1;for(;;){const l=Math.floor((a+n)/2),i=l*t;if(o(i,e))return l;i<e?a=l+1:i>e?n=l-1:a=l+1}})(this.dataSource)}getRows(){return this.getViewRows()}getViewRows(){const e=this;return e.rowHierarchy?e.rowHierarchy:e.getVisibleRows()}getData(){const e=this;if(!e.dataSource)return[];const t=[];for(let o=0;o<e.dataSource.length;o++){const l=e.dataSource[o];if(l.$){const o={};for(let t=0;t<e.dataSource.dataFields.length;t++){const a=e.dataSource.dataFields[t].name;o[a]=l[a]}t.push(o)}else t.push(l)}return t}getDataFields(){const e=this;return e.columns?e.columns.map((e=>e.dataField)):[]}getColumns(){const e=this,t=[];if(!e.isInitialized)return t;if(e.columns)for(let o=0;o<e.columns.length;o++){const l=e.columns[o].getState();t.push(l)}return t}resetState(e=!0){const t=this;t._isUpdating=0,t.beginUpdate(),t.clearSort(),t.clearFilter(),t.clearGroups(),t.clearSelection(),t._conditionalColors&&(t._conditionalColors.colors=[],t._conditionalColors.conditions=[],t._conditionalColors.type="conditions",t._conditionalColors.singleSelect="",t._conditionalColors.decorate="border",t._conditionalColors.update=()=>{}),t.$.headerBar&&delete t.$.headerBar._appliedColors,delete t._labeledBy,delete t._dateStackedBySelect,t.highlighted=null,t.columns.canNotify=!1;let o=[],l=!1;for(let e=0;e<t.columns.length;e++){const a=t.columns[e];a.visible=!0,a.width=180,a.freeze=!1,a.index>=0?o[a.index]=a:o.push(a),a.index!==e&&(l=!0)}l&&(t.columns=o),"grid"!==t.view&&e&&(t.view="grid",t._hideKanbanView(),t._hideSchedulerView()),t.columns.canNotify=!0,t._scrollView.scrollLeft=t._scrollView.scrollTop=0,t.paging.enabled&&(t.paging.pageIndex=0),t.$.headerBar&&t.$.headerBar._setView&&"grid"===t.view&&t.$.headerBar._setView("grid"),t._kanban&&t._kanban._reset(),t.layout.isDirty=!0,t.endUpdate(),l&&(t._renderColumns(),t._refreshHeaderBar())}_loadState(e){const t=this;let o=!1;t.stateSettings.loading=!0;let l=!1,a=!1,n=!1;if("grid"===e.view||"card"===e.view||void 0===e.view){if(e.expandedRows&&Object.keys(e.expandedRows).length>0){o=!0,t.beginUpdate();const l=[];if(e.groups){t.dataSource.groupBy=e.groups,t._groups=[].concat(t.dataSource.groupBy.toArray())||[],t._refreshRowHierarchy();for(let o in e.expandedRows)l["Item"+o.replaceAll(".","_")]=!0,t._expandCollapseGroup(o,!0)}else if(t.grouping.enabled&&t.dataSource.groupBy.length)for(let o in e.expandedRows)l["Item"+o.replaceAll(".","_")]=!0,t._expandCollapseGroup(o,!0);t.dataSource&&(t.dataSource._expandedRowIds=l)}else if(e.groups&&e.groups.length){o=!0,t.beginUpdate();const l=[];t.dataSource&&(t.dataSource._expandedRowIds=l),e.groups&&(t.dataSource.groupBy=e.groups,t._refreshRowHierarchy())}else if(e.groups&&0===e.groups.length&&t.dataSource.groupBy&&t.dataSource.groupBy.length>0){o=!0,t.beginUpdate();const e=[];t.dataSource&&(t.dataSource._expandedRowIds=e),t.dataSource.groupBy=[],t._refreshRowHierarchy(),a=!0}if(e.paging&&t.paging.enabled&&(t.paging.index=e.paging.index,t.paging.size=e.paging.size),e.columns&&e.columns.length>0){o||(o=!0,t.beginUpdate());let a=[];for(let o=0;o<e.columns.length;o++){const i=e.columns[o];if(i.dataField){const e=t.columnByDataField[i.dataField];if(e){const r=e.canNotify;e.canNotify=!1,i.width?e.width=i.width:e.width=180,e.sortOrder="",e.sorted="",a.push(e),e.index!==o&&(n=!0),e.visible=void 0===i.visible||i.visible,e._state&&(e._state.visible=void 0===i.visible||i.visible,e._state.freeze=void 0!==i.freeze&&i.freeze,e._state.width=i.width?i.width:180);const s=e.freeze;e.freeze=void 0!==i.freeze&&i.freeze,s!==e.freeze&&(l=!0,e.freeze||t._frozenNearColumns.indexOf(e)),e.canNotify=r}}}n&&(t.columns=a)}}if(e.colors&&(t._conditionalColors=JSON.parse(JSON.stringify(e.colors)),t.$.headerBar)){let l=[];if(e.colors.conditions)for(let t=0;t<e.colors.conditions.length;t++){let o=e.colors.conditions[t],a=[];for(let e in o)a.push(o[e]);l.push(a)}o||(o=!0,t.beginUpdate());const a={type:e.colors.type,singleSelect:e.colors.singleSelect,decorate:e.colors.decorate};t.$.headerBar._appliedColors=[l,a],t._conditionalColors.update=e=>{t.$.headerBar._updateConditionalColors(e,t,a)}}if(e.sort&&Object.keys(e.sort).length>0){o||(o=!0,t.beginUpdate());const l=t.appearance.allowSortAnimation;t.appearance.allowSortAnimation=!1;let a=t.columns.canNotify;t.columns.canNotify=!1;for(let e=0;e<t.columns.length;e++)t.columns[e].sortOrder="";t.columns.canNotify=a;for(let o in e.sort){const l=e.sort[o];if(l){const e=l.sortOrder,a=l.dataField?l.dataField:o,n=t.columnByDataField[a];n&&t.sortBy(n.dataField,e)}}t.appearance.allowSortAnimation=l}if(e.filter&&Object.keys(e.filter).length>0){o||(o=!0,t.beginUpdate());for(let o in e.filter){let l=o,a=e.filter[l];if(e.filter[0]&&(l=e.filter[o].dataField,a=e.filter[o].filter),a){t.addFilter(l,a,!1);const e=t.columnByDataField[l];e&&e._filterInfo&&e.filter&&e.filter.filters&&e.filter.filters[0]&&(e._filterInfo.value=e.filter.filters[0].value,e._filterInfo.condition=e.filter.filters[0].condition)}}if(t.filtering.filterRow)for(let e=0;e<t.columns.length;e++)t.columns[e]._filterEditorInitialized&&(t.columns[e]._filterEditorInitialized=!1)}if(e.selectedCells&&(o||(o=!0,t.beginUpdate()),t.selectCellsById(e.selectedCells)),e.selectedRows&&t.selectRows(e.selectedRows),e.labeledBy&&(t._labeledBy=e.labeledBy),o){t.endUpdate(!1,!1);let o=!1;e.view&&"kanban"===e.view&&(o=!0),(l||n)&&(o=!1,a=!0,t._renderColumns()),o||(a?t.refresh(!0):t._refresh())}let i=!1;if(e.kanban&&e.kanban.stackedBy&&(void 0===t._stackedBy&&(t._stackedBy=e.kanban.stackedBy),t._stackedBy!==e.kanban.stackedBy&&(i=!0),t._stackedBy=e.kanban.stackedBy),e.scheduler&&e.scheduler.stackedBy&&(void 0===t._dateStackedBy&&(t._dateStackedBy=e.scheduler.stackedBy),t._dateStackedBy!==e.scheduler.stackedBy&&(i=!0),e.scheduler.labeledBy&&(t._labeledBy=e.scheduler.labeledBy),e.scheduler.viewType&&(t._schedulerViewType=e.scheduler.viewType),void 0===t._dateStackedBySelect&&(t._dateStackedBySelect=e.scheduler.groupBy),t._dateStackedBySelect!==e.scheduler.groupBy&&(i=!0),t._dateStackedBy&&Array.isArray(t._dateStackedBy)&&e.scheduler.stackedBy&&Array.isArray(e.scheduler.stackedBy)&&JSON.stringify(t._dateStackedBy)===JSON.stringify(e.scheduler.stackedBy)&&(i=!1),t._dateStackedBy=e.scheduler.stackedBy),(i||e.view&&t.view!==e.view)&&t.$.headerBar&&t.$.headerBar._setView&&(e.name&&(t.stateSettings.current=e.name),t.$.headerBar._setView(e.view,!0)),e.filter&&Object.keys(e.filter).length>0&&t.refreshFilters(),e.selectedCells){const o=[];let l=99999999,a=null,n=99999999,i=null,r=99999999,s=null;for(let l=0;l<e.selectedCells.length;l++){const a=e.selectedCells[l],d=a[0],c=a[1],u=t.columnByDataField[c];if(u&&(n=Math.min(n,u.index),i=Math.max(i,u.index)),!t.rowById[d])continue;const m=t.rowById[d].visibleIndex;m>=0&&(r=Math.min(r,m),s=Math.max(s,m)),o[d]||(o[d]=[]),o[d].push(c)}let d=0,c=!0;for(let e in o){const t=o[e];if(d&&t.length!==d){c=!1;break}d=t.length}if(c){const e=t.getRows(),o=e[r],d=e[s];if(l=o?o.id:-1,a=d?d.id:-1,o){const e=t.columns[n];if(e){const o=t.rowById[l].getCell(e.dataField);t._selection.focusedCell={id:o.row.id,value:o.value,dataField:o.column.dataField,index:o.row.index},setTimeout((()=>{t._selectCellsRange(t.rowById[l],t.rowById[a],t.columns[n].dataField,t.columns[i].dataField)}),50)}}}}e.name&&(t.stateSettings.current=e.name),t._refreshHeaderBar(),t.stateSettings.loading=!1}loadState(e){const t=this;if(e){if(t.stateSettings.loading=!0,t._isUpdating=0,t.beginUpdate(),t.clearSort(),t.clearFilter(),t.clearGroups(),t.clearSelection(),t._conditionalColors&&(t._conditionalColors.colors=[],t._conditionalColors.conditions=[],t._conditionalColors.type="conditions",t._conditionalColors.singleSelect="",t._conditionalColors.decorate="border"),delete t._labeledBy,delete t._dateStackedBySelect,t.$.headerBar&&delete t.$.headerBar._appliedColors,t._scrollView.scrollLeft=t._scrollView.scrollTop=0,t.paging.enabled&&(t.paging.pageIndex=0),t.endUpdate(!1,!1),"string"==typeof e){const o=t.stateSettings.storage[e];o&&t._loadState(o)}else t._loadState(e);t.stateSettings.loading=!1}else if(!t.stateSettings.autoSave){let e=t.getCurrentState();e&&t.loadState(e)}}saveState(e,t){const o=this;let l=o.getCurrentState(),a=t;!t&&o.stateSettings.options.length&&(t=o.stateSettings.options);const n=o.getState(t);let i;if(e?(i=e,o.stateSettings.current||(o.stateSettings.current=e)):i=o.stateSettings.current?o.stateSettings.current:o.stateSettings.current="View 1",l&&a)for(let e in a)l[a[e]]=n[a[e]];else l=n;function r(e,t=0,o=10){if(t>o)return"Object";const l={};if(e&&e instanceof Smart.FilterGroup)return e=e.toString();for(let a in e){let n=e[a];if(n instanceof Node)n={id:n.id};else if(n instanceof Window)n="Window";else if(n instanceof Date)n=n.toJSON();else{if(n&&Array.isArray(n)&&void 0!==n[0]&&("string"==typeof n[0]||"number"==typeof n[0]||n[0]instanceof Date||"boolean"==typeof n[0])){l[a]=n;continue}if(n&&Array.isArray(n)&&0===n.length){l[a]=n;continue}if(n&&n&&Array.isArray(n)&&void 0!==n[0]&&"object"==typeof n[0]&&"path"!==a&&!(n[0]instanceof HTMLElement))for(let e=0;e<n.length;e++)n[e]=r(n[e],t+1,o);else n instanceof Object&&(n=r(n,t+1,o))}l[a]=n}return t?l:JSON.stringify(l)}l.name=i,o.stringify_object=r;const s=r(l);return o.stateSettings.allowLocalStorage&&window.localStorage.setItem(i,s),o.stateSettings.storage||(o.stateSettings.storage={}),o.stateSettings.storage[o.stateSettings.current]&&!l.date&&o.stateSettings.storage[o.stateSettings.current].date?l.date=o.stateSettings.storage[o.stateSettings.current].date:l.date=(new Date).toJSON(),o.stateSettings.storage[o.stateSettings.current]=l,o.stateSettings.onStateChange&&(o._isUpdating<=0||void 0===this._isUpdating)||o.stateSettings.onStateChange&&o._forceStateChange?o.isCompleted&&o.stateSettings.onStateChange(l,i,o.stateSettings.storage,r):o.stateSettings.onStateChange&&"grid"!==o.view&&o.isCompleted&&o.stateSettings.onStateChange(l,i,o.stateSettings.storage,r),l}autoSaveState(){const e=this;e._savingState&&clearTimeout(e._savingState),e._savingState=setTimeout((()=>{if(!e.stateSettings.current&&e.stateSettings.autoSave&&!e.stateSettings.loading){const t=e.stateSettings.storage;if(t&&0===Object.keys(t).length||!t){let t=e.localize("newGrid")+" "+e.localize("view");"kanban"===e.view?t=e.localize("newKanban")+" "+e.localize("view"):"card"===e.view?t=e.localize("newCard")+" "+e.localize("view"):"scheduler"===e.view&&(t=e.localize("newScheduler")+" "+e.localize("view")),e.stateSettings.current=t}}e.stateSettings.autoSave&&e.stateSettings.current&&!e.stateSettings.loading&&e.saveState()}),50)}getCurrentState(){const e=this,t=e.stateSettings.current;return e.stateSettings.storage||(e.stateSettings.storage={}),e.stateSettings.storage[t]?e.stateSettings.storage[t]:null}setColors(e,t){const o=this;o._conditionalColors={type:t.type,decorate:t.decorate,conditions:e,singleSelect:t.singleSelect},o.$.headerBar.addColors(JSON.parse(JSON.stringify(e)),{type:t.type,singleSelect:t.singleSelect,decorate:t.decorate},[]),o._recycle(!1)}getColors(){const e=this;if(e._conditionalColors){const t=JSON.parse(JSON.stringify(e._conditionalColors));return{type:t.type,conditions:t.conditions,filters:t.filters,colors:t.colors,decorate:t.decorate,singleSelect:t.singleSelect}}return null}getState(e){const t=this;if(e&&!e.includes)return;const o=!e||e&&e.includes("sort")?t.getSortedColumns():null,l=!e||e&&e.includes("filter")?t.getFilteredColumns():null,a=!e||e&&e.includes("groups")?t.getGroups():null,n=!e||e&&e.includes("selection")?t.getSelectedCells(!1):null,i=!e||e&&e.includes("selection")?t.getSelectedRowIds():null,r=!e||e&&e.includes("pager")?t.$.headerPager.querySelector("smart-pager"):null,s=!e||e&&e.includes("colors")?t.getColors():null;let d=0;r&&(d=r.pagesCount);const c={count:d,index:t.paging.pageIndex,size:t._pageSize},u={};o&&o.length&&(u.sort=o),l&&l.length&&(u.filter=l),a&&a.length&&(u.groups=a),c&&t.paging.enabled&&(u.paging=c),n&&n.length&&(u.selectedCells=n),i&&i.length&&(u.selectedRows=i),s&&(delete s.colors,u.colors=s),t._labeledBy&&(u.labeledBy=t._labeledBy),(t.header.visible&&t.header.buttons.indexOf("views")>=0||t.header.buttons.indexOf("states")>=0)&&("kanban"===t.view&&(u.kanban=t.getKanbanState()),"scheduler"===t.view&&(u.scheduler=t.getSchedulerState()),u.view=t.view);const m=[];if(!e||e&&e.includes("columns")){for(let e=0;e<t.columns.length;e++){const o=t.columns[e];o&&m.push({dataField:o.dataField,width:o.computedWidth,visible:o.visible,freeze:o.freeze})}u.columns=m}if((!e||e&&e.includes("expandedRows"))&&t.dataSource&&t.dataSource._expandedRowIds){let e={};for(let o in t.dataSource._expandedRowIds){let t=""+o;t=t.replace("Item","").replace(/_/gi,"."),e[t]=!0}Object.values(e).length&&(u.expandedRows=e)}if((t.header.visible&&t.header.buttons.indexOf("views")>=0||t.header.buttons.indexOf("states")>=0)&&("kanban"!==t.view&&"scheduler"!==t.view||(delete u.expandedRows,delete u.columns,delete u.paging,delete u.selectedCells,delete u.selectedRows)),e){const t={};for(let o in e){const l=e[o];u[l]&&(t[l]=u[l])}return t}return u}get _pageSize(){const e=this;return e.dataSource&&e.grouping.enabled&&e.dataSource.groupBy&&e.dataSource.groupBy.length>0?e.paging.pageHierarchySize:e.paging.pageSize}get _recyclingRows(){const e=this;if(e.rowHierarchy)return e.rowHierarchy;let t=e.getVisibleRows();if(e.paging.enabled)if(e.dataSource.virtualDataSource)t=t.slice(0,e._pageSize);else if(t=t.slice(e.paging.pageIndex*e._pageSize,(e.paging.pageIndex+1)*e._pageSize),e.editing.addNewRow&&e.editing.addNewRow.visible&&"button"!==e.editing.addNewRow.displayMode){let t=e.getVisibleRows();return t=0===e.paging.pageIndex&&"far"!==e.editing.addNewRow.position?t.slice(1+e.paging.pageIndex*e._pageSize,1+(e.paging.pageIndex+1)*e._pageSize):0===e.paging.pageIndex&&"far"===e.editing.addNewRow.position?t.slice(e.paging.pageIndex*e._pageSize,1+(e.paging.pageIndex+1)*e._pageSize):t.slice(1+e.paging.pageIndex*e._pageSize,1+(e.paging.pageIndex+1)*e._pageSize),[].concat(e._frozenNearDefaultRows,t,e._frozenFarDefaultRows)}return t}_isRowInPosition(e,t){const o=e.top,l=e.top+e.height,a=o<=t&&l>t;return 0!==e.height&&a}_renderColumnGroupHeaders(){const e=this;for(let t=0;t<e._columnGroups.length;t++){const o=e._columnGroups[t];o.column.render(),o.column.allowReorder=!1,o.column.element.setAttribute("columnHeader",""),o.column.element.setAttribute("level",o.level),0===o.columns.length&&o.column.element.classList.add("smart-hidden");const l=o.collapseButton;l&&o.column.element.appendChild(l),0===t&&0===e.columns.indexOf(o.columns[0])&&o.column.element.classList.add("smart-grid-column-border-collapse")}}hasVisibleColumn(){const e=this;for(let t=e.viewColumns.length-1;t>=0;t--){const o=e.viewColumns[t];if(o.visible&&!o.autoGenerated)return!0}return!1}_isLastVisibleColumn(e){const t=this;for(let o=t.viewColumns.length-1;o>=0;o--){const l=t.viewColumns[o];if(l.visible)return l===e}return!1}_clearCachedTemplates(){const e=this;if(e._cachedTemplates&&Object.keys(e._cachedTemplates).length>0){e._tableCachedTemplates||(e._tableCachedTemplates=document.createElement("div"),e._tableCachedTemplates.style.display="none",document.body.appendChild(e._tableCachedTemplates));const t=document.createDocumentFragment();for(let o in e._cachedTemplates)t.appendChild(e._cachedTemplates[o]);e._tableCachedTemplates.appendChild(t)}}_recycle(e,t,o,l){const a=this;if(a._layoutSuspended||!1===a.isAttached)return;if(a._isUpdating)return;if(a.editing.isEditing&&(!0===a._disableEndEdit||a.editing.dialog.visible||a.endEdit(),a._isUpdating))return;a._recycleValues=void 0===o||o,a._removeCellContentPopup(),a._inputOverlay&&(a._inputOverlay.parentNode&&a._inputOverlay.parentNode.removeChild(a._inputOverlay),a._inputOverlay=null),a._selection.selectionRect&&a._refreshCellSelectionRect(),a._copyRects&&a._copyRects.length&&a._refreshCopyRects();const n=a._scrollView.scrollTop;let i,r=l||a._getRowIndexByPosition(n),s=a._recyclingRows,d=s[r],c=d?d.top:0,u=0,m=0,p=0,g=0;if(a._cellRowSpan&&a._cellRowSpan.maxSpan>0){let e=0;if(r>=5?e=5:r>=4?e=4:r>=3?e=3:r>=2?e=2:r>=1&&(e=1),e>0){const t=s[r-e];t&&(d=t,c=d?d.top:0,p=e*d.height,r-=e)}}a._cellRowSpan=[];for(let e=0;e<a._cellsMerge.length;e++){const t=a._cellsMerge[e],o=s.indexOf(t.row);if(r>o&&r<=o+t.rowSpan&&(r=o,d=t.row,p=Math.max(p,c-d.top),c=d.top,a.$.rowContainer.style.top=a.__frozenNearHeight-n+c+"px"),t.colSpan>1)for(let e=0;e<a.viewColumns.length;e++){const o=a.viewColumns[e];let l=o.autoGenerated?o:a.columnByDataField[o.dataField];if(l.visible&&l.left+l.computedWidth-a._scrollView.scrollLeft>=u&&l.left-l.computedWidth-a._scrollView.scrollLeft<a._clientSize.width){let e=a.columnByDataField[t.column.dataField];g=Math.max(g,l.left-e.left+l.computedWidth);break}}}a.isHScrolling&&a._clearCachedTemplates();let h=null;if(!1!==e||a._cellsMerge.length>0){if(a._columnElements)for(let e=0;e<a._columnElements.length;e++){const t=a._columnElements[e];if(!t.parentNode)break;t.set("column",null,!1),t.classList.add("smart-visibility-hidden")}for(let e=0;e<a._columnGroups.length;e++){const t=a._columnGroups[e],o=t.element;o&&(a.rightToLeft?o.style.right=t.right+"px":o.style.left=t.left+"px",o.style.width=t.computedWidth+"px")}a._firstVisibleColumn=null,a._firstVisibleUserColumn=null,a._lastVisibleColumn=null;for(let e=0;e<a.viewColumns.length;e++){let t=a.viewColumns[e];if(t.visible&&(a._firstVisibleColumn||(a._firstVisibleColumn=t),a._firstVisibleUserColumn||t.autoGenerated||(a._firstVisibleUserColumn=t),a._lastVisibleColumn=t),t.element&&(t===a._firstVisibleColumn||t.rowDetailColumn?t.element.classList.add("smart-grid-column-border-collapse"):t.element.classList.remove("smart-grid-column-border-collapse"),!1!==a.appearance.showColumnGroupCellLines&&!1!==a.appearance.showColumnGroupLines||(t.parent&&t.parent.columns&&t.parent.columns[0].dataField===t.dataField?t.element.setAttribute("column-group-first-child",""):t.parent&&t.element.removeAttribute("column-group-first-child")),t.element.removeAttribute("aria-colindex")),t.freeze){if(!0!==t.freeze&&"near"!==t.freeze||t.visible&&(u+=t.computedWidth),!t.element)continue;t.visible?(t.element.classList.remove("smart-visibility-hidden"),t.render()):t.element.classList.add("smart-visibility-hidden")}else if(t.visible&&t.left+t.computedWidth-a._scrollView.scrollLeft>=u-g&&t.left-t.computedWidth-a._scrollView.scrollLeft<a._clientSize.width){a._columnElements||(a._columnElements=[]);const o=a._columnElements[m++];o&&(o.set("column",t,!1),o.parentNode||a.$.columnContainer.appendChild(o),h||(h=t,a._firstRenderedColumn=t),t.element=o,t.render(),o.setAttribute("aria-colindex",e+1),void 0===i&&(i=t.left))}}}if(void 0===i&&(i=0),a.rightToLeft){const e=a._scrollView.scrollWidth-a._scrollView.scrollLeft-a._scrollView.vScrollBar.offsetWidth;a.$.columnContainer.style.right=e+"px",e<=0&&!a._scrollView.scrollWidth&&(a.$.columnContainer.style.right=-a.offsetWidth+a._computedColumnsWidth+"px")}else a.$.columnContainer.style.left=-a._scrollView.scrollLeft+"px";if(a.$.rowContainer.style.top=a.__frozenNearHeight-n+c+"px",a.isScrolling&&!a.isHScrolling&&(a._scrollUpdate&&clearTimeout(a._scrollUpdate),a._scrollUpdate=setTimeout((function(){a.isScrolling||(a.$.rowContainer.style.top=parseInt(a.$.rowContainer.style.top)+.01+"px")}),50)),!1===t)return;if(!a._rowElements)return;const f=a.dataSource&&a.dataSource.virtualDataSource&&!a.dataSource.virtualDataSourceOnExpand&&a.dataSource.length>a.virtualModeCachedRowsCount&&"infinite"!==a.scrolling;let y=0,w=a.behavior.allowRenderCache&&!f&&"grid"===a.view&&!a.dataSource.virtualDataSourceOnExpand&&!a.rowDetail.template&&!a.rowDetail.enabled&&!a._autoHeight&&!a.pager.visible&&!a._frozenFarColumns.length&&!a.hasAttribute("tree");if("grid"!==a.view)for(let e=0;e<a._rowElements.length;e++){const t=a._rowElements[e];t.style.transform="",t.style.top="",t.style.position=""}if(r>=0){m=0;let e=Math.max(a._clientSize.height,a._overflowOffset),t=0;if(f&&(a.rowById=[],a.rows&&a.rows.length>0&&void 0===a.rows[a.rows.length-1].top&&(a.rows[a.rows.length-1].top=(a.rows.length-1)*a.rows[0].height),a.rows&&a.rows.length>0&&(t=a._getVirtualRowIndexByPosition(n),c=t*a.rows[0].height,a.$.rowContainer.style.top=a.__frozenNearHeight-n+c+"px",a.paging.enabled||(r=0)),a.paging.enabled&&(t=a.paging.pageIndex*a._pageSize)),"card"===a.view&&a._cardHeight&&(e+=a._cardHeight),w)for(let e=0;e<a._rowElements.length;e++){const t=a._rowElements[e];delete t.isRendered,t.classList.remove("smart-hidden"),t.classList.remove("aria-rowindex"),t.style.transform="",t.style.top="",t.style.position=""}if(w){let e=Math.max(a._clientSize.height,a._overflowOffset),o=[],l=c;for(let t=r;t<s.length;t++){const i=s[t];if(0===i.height||!i.visible||!1===i.filtered||i.freeze&&i.visible)continue;const r=i.height;if(i.expandHeight&&(e+=a.offsetHeight+i.expandHeight),l+r>=n-p&&l<=n+e||a._autoHeight){for(let e=0;e<a._rowElements.length;e++){const t=a._rowElements[e];if(t.hasAttribute("data-id")&&t.getAttribute("data-id")===""+i.id){o[i.id]=t,t.isRendered=!0;break}}l+=r}}e=Math.max(a._clientSize.height,a._overflowOffset);for(let l=r;l<s.length;l++){const i=s[l];if(0===i.height||!i.visible||!1===i.filtered||i.freeze&&i.visible)continue;const r=i.height;if(i.expandHeight&&(e+=a.offsetHeight+i.expandHeight),c+r>=n-p&&c<=n+e||a._autoHeight){let e;if(e=a._rowElements[m++],!e)break;for(;e&&e.isRendered;)e=a._rowElements[m++];if(!e){console.log("Did not found a row element during the rendering.");continue}e.setAttribute("aria-rowindex",t+l+1);let n=!1;if(i.element=e,i.grid=a,o[i.id]){const a=o[i.id];a.hasAttribute("data-id")&&a.getAttribute("data-id")===""+i.id&&(a===e&&(a.isRendered=!0,n=!0,m=0),n=!0,m=0,i.element=a,e.style.top="999999px",e.setAttribute("data-id",999999),e.setAttribute("aria-rowindex",t+l+1),e=a,a.isRendered=!0)}e.style.top=y+"px",e.style.position="absolute",i.render(n),e.isRendered=!0,c+=r,y+=r}}}else{a.rowDetail.enabled&&(e+=a.offsetHeight);for(let o=r;o<s.length;o++){const l=s[o];if(0===l.height||!l.visible||!1===l.filtered||l.freeze&&l.visible)continue;const i=l.height;if(l.expandHeight&&(e+=a.offsetHeight+l.expandHeight),!(c+i>=n-p&&c<=n+e||a._autoHeight))break;{let e;if(e=a._rowElements[m++],!e)break;if(e.isRendered&&(e.classList.remove("smart-hidden"),e.classList.remove("aria-rowindex"),e.style.transform="",e.style.top="",e.style.position=""),e.setAttribute("aria-rowindex",t+o+1),l.element=e,l.grid=a,f){if(l.index=o+t,l.visibleIndex=o+t,a.selection.enabled&&a._selection){const e=a._selection.indexes,t=l.canNotify;l.canNotify=!1,l.selected=e.indexOf(l.index)>=0,l.canNotify=t}a.paging.enabled?(l.data=a.dataSource[r+m-1],l.data&&(l.id=l.data.$.id,a.rowById[l.id]=l)):(l.data=a.dataSource[m-1],l.data&&(l.id=l.data.$.id,a.rowById[l.id]=l))}l.render(),e.isRendered=!0}c+=i,y+=i}}}a._renderFrozenRows();let _=m;if(m<a._rowElements.length&&!w)for(let e=m;e<a._rowElements.length;e++){const e=a._rowElements[m++];e.classList.add("smart-hidden"),e.removeAttribute("aria-rowindex")}if(w)for(let e=0;e<a._rowElements.length;e++)if(!a._rowElements[e].isRendered){const t=a._rowElements[e];t.classList.add("smart-hidden"),t.removeAttribute("aria-rowindex")}if(a.editing.addNewRow&&a.editing.addNewRow.visible&&"row"!==a.editing.addNewRow.displayMode&&a._rowElements[_]){a._newRow||(a._newRow=new Smart.Grid.Row({data:{},index:9999999,grid:a,addNewRow:!0,inline:!0,autoGenerated:!0}));for(let e=a._rowElements.length-1;e>=0;e--)if(!a._rowElements[e].isRendered){a._newRow.element=a._rowElements[e],a._newRow.element.classList.remove("smart-hidden"),a._newRow.element.style.top=y+"px",a._newRow.element.style.position="absolute",a._newRow.render();break}}f&&(a._selection.selectionRect&&a._refreshCellSelectionRect(),a._copyRects&&a._copyRects.length&&a._refreshCopyRects())}_renderFrozenRows(){const e=this;let t=!1,o=!1;if("card"===e.view)return e.$.rowNearContainer.classList.add("smart-hidden"),void e.$.rowFarContainer.classList.add("smart-hidden");0===e._frozenNearRows.length?e.$.rowNearContainer.classList.add("smart-hidden"):e.$.rowNearContainer.classList.remove("smart-hidden");for(let o=0;o<e._frozenNearRows.length;o++){const l=e._frozenNearRows[o];l.visible||(l.element=e.$.rowNearContainer.children[o],l.element||(l.element=l.createElement(),e.$.rowNearContainer.appendChild(l.element)),l.element.classList.add("smart-hidden")),l.visible&&l.filtered&&(t=!0,l.element=e.$.rowNearContainer.children[o],l.element||(l.element=l.createElement(),e.$.rowNearContainer.appendChild(l.element)),l.render())}t||e.$.rowNearContainer.classList.add("smart-hidden"),0===e._frozenFarRows.length?e.$.rowFarContainer.classList.add("smart-hidden"):e.$.rowFarContainer.classList.remove("smart-hidden");for(let t=0;t<e._frozenFarRows.length;t++){const l=e._frozenFarRows[t];l.visible&&(o=!0),l.element=e.$.rowFarContainer.children[t],l.element||(l.element=l.createElement(),e.$.rowFarContainer.appendChild(l.element)),l.render()}o||e.$.rowFarContainer.classList.add("smart-hidden"),0!==e.columns.length&&e.hasVisibleColumn()||(e.$.rowNearContainer.classList.add("smart-hidden"),e.$.rowFarContainer.classList.add("smart-hidden"));const l=e.rows;l&&null!==l&&0!==l.length||(e.$.rowNearContainer.classList.add("smart-hidden"),e.$.rowFarContainer.classList.add("smart-hidden"),e.filtering.filterRow.visible&&e.$.rowNearContainer.classList.remove("smart-hidden"))}_recycleRotate(e,t,o,l,a){const n=t.getBoundingClientRect(),i=e.getBoundingClientRect();let r=0,s=0;return 0===i.width?(e.innerHTML=a,!1):(n.left>i.left&&(r=i.left-n.left),n.top<i.top&&(s=i.top-n.top),"left"!==o&&""!==o||(r=4),"center"===o&&(r+=i.width/2-n.width/2),"right"===o&&(r+=i.width-n.width-4),"top"!==l&&""!==l||(s=4),"center"!==l&&"middle"!==l||(s+=i.height/2-n.height/2),"bottom"===l&&(s+=i.height-n.height-4),t.style.left=r+"px",t.style.top=s+"px",!0)}_virtualDataRequest(e,t){const o=this;let l=-1,a=-1;if(!o._rowElements&&"infinite"!==o.scrolling)return;if("virtual"===o.scrolling){for(let e=0;e<o._rowElements.length;e++){const t=o._rowElements[e],n=t.row,i=0===e?n.visibleIndex:l+e;t.classList.contains("smart-hidden")||(-1===l&&(l=i),-1!==i&&(a=1+i))}0===o._rowElements.length&&(l=0,a=Math.max(20,parseInt(o.offsetHeight/o.layout.rowMinHeight*1.5)))}else"infinite"===o.scrolling?(l=1/0,a=1/0):(l=0,a=o.dataSource.length);a!==1/0&&(o.dataSource.virtualDataSourceLength||o.dataSource.length)&&(a=Math.min(a,o.dataSource.length)),o.paging.enabled&&(l=o.paging.pageIndex*o._pageSize,a=l+o._pageSize),o._toggledRow||"add"===e||"update"===e||"delete"===e||(o.appearance.displayLoadingIndicator=!0,o._setLoadingIndicatorVisibility()),o._groups||(o._groups=[].concat(o.dataSource.groupBy.toArray())||[]);const n={first:l,last:a,edit:o._editInfo||null,sorting:o.getSortedColumnsByDataField(),filtering:o.getFilteredColumnsByDataField(),filterOperator:o.filtering.operator,grouping:o._groups,row:o._toggledRow?o._toggledRow.data:null,action:e},i=o.dataSource.length,r=o.dataSource.boundSource.length;void 0===o._isFirstVirtualDataSourceRequest&&(o._isFirstVirtualDataSourceRequest=!0),o.dataSource.onVirtualDataSourceRequested((function(e){if(o.appearance.displayLoadingIndicator=!1,o._setLoadingIndicatorVisibility(),o._toggledRow=null,!e)return o._initializeRows(),o._initializeRowElements(),o.refresh(),o._refreshPagesCount(),void(o._autoHeight&&o._initializeRowElements());if("add"===e.action){if(t&&t(e.result),o._autoHeight&&o.rows.length>=o._rowElements.length-1&&(o._initializeRows(),o._initializeRowElements(),o.refresh(),o.filtering.filterRow)){for(let e=0;e<o.columns.length;e++)o.columns[e]._filterEditorInitialized&&(o.columns[e]._filterEditorInitialized=!1);const e=o.filtering.filterRow&&o.filtering.filterRow.visible&&o.filtering.filterRow.cell?o.filtering.filterRow.cell.column.dataField:null;e&&setTimeout((()=>{const t=o.columnByDataField[e];t&&t._filterInfo&&t._filterInfo.input&&t._filterInfo.input.focus()}),100)}return}if("update"===e.action)return void(t&&t(e.result));if("remove"===e.action)return void(t&&t(e.result));const l=o.context;if(o.context=o,o._isFirstVirtualDataSourceRequest&&0===o._initColumns.length&&(o.columns.canNotify=!1,o.columns=[],o._renderColumns(),o.columns.canNotify=!0),"scroll"===e.action)if("infinite"===o.scrolling){const e=o._viewRows;for(let t=0;t<e.length;t++){const l=e[t];l.data&&!l.addNewRow&&l.data.$&&(o.rowById[l.data.$.id]||(o.rowById[l.data.$.id]=l))}o._recycle(!1,!1)}else{const t=e.first>=0?e.first:0,l=e.last!==1/0?e.last:0;let a=0;for(let e=t;e<l;e++)o.rows[e]&&(o.rows[e].data=o.dataSource[a++]);o._recycle(!1,!1)}else if(o.dataSource.length!==i||o.dataSource.boundSource.length!==r||o._isFirstVirtualDataSourceRequest||"expand"===e.action||"filter"===e.action||"sort"===e.action||"pageIndexChange"===e.action||"pageSizeChange"===e.action||"sort"===e.action||"group"===e.action){o.paging.enabled&&o.$.headerPager.querySelector("smart-pager")&&(o.$.headerPager.querySelector("smart-pager").pagesCount=Math.ceil(o.dataSource.length/o._pageSize),o.$.footerPager.querySelector("smart-pager").pagesCount=Math.ceil(o.dataSource.length/o._pageSize));const e=o.filtering.filterRow&&o.filtering.filterRow.visible&&o.filtering.filterRow.cell?o.filtering.filterRow.cell.column.dataField:null;if(o._initializeRows(),o._initializeRowElements(),o.refresh(),o._refreshPagesCount(),o._autoHeight&&o._initializeRowElements(),o.filtering.filterRow){for(let e=0;e<o.columns.length;e++)o.columns[e]._filterEditorInitialized&&(o.columns[e]._filterEditorInitialized=!1);e&&setTimeout((()=>{const t=o.columnByDataField[e];t&&t._filterInfo&&t._filterInfo.input&&t._filterInfo.input.focus()}),100)}}else o.dataSource.virtualDataSourceOnExpand&&o.refresh();o._isFirstVirtualDataSourceRequest&&o.onLoad&&(o.onLoad(o),delete o.onLoad),o._isFirstVirtualDataSourceRequest=!1,o._recycle(),o.context=l,o._onDataUpdated&&o._onDataUpdated()}),n)}localizeString(e,t,o="en"){const l=this;o&&l.messages[o][e]&&(l.messages[o][e]=t,l.refresh())}localizeStrings(e,t="en"){const o=this;t&&(Object.assign(o.messages[t],e),o.refresh())}_createInsertNewRowButton(){const e=this,t=document.createElement("div");return t.className="smart-grid-add-row-button smart-grid-icon smart-icon-plus insert",t.title=e.localize("contextMenuItemInsertRow"),t.style.left=!e.appearance.showViewBar||e.appearance.viewBarAppendTo||e.appearance.showViewBarAsDropdown||e._mobile?"":10+e.layout.viewBarWidth+"px",t.style.boxShadow="var(--smart-elevation-1)",t.style.width="16px",t.style.height="16px",t.style.fontSize="12px",t.onclick=()=>{e._addRowTimer&&clearTimeout(e._addRowTimer),e._addRowTimer=setTimeout((()=>{if(e.dataSource&&e.dataSource.virtualDataSource)return void e._insertNewRowAfter();const t={};for(let o=0;o<e.columns.length;o++){const l=e.columns[o];void 0!==l.defaultValue&&null!==l.defaultValue&&("today"===l.defaultValue&&"date"===l.dataType?(e._today||(e._today=new Date,e._todayYear=e._today.getFullYear(),e._todayMonth=e._today.getMonth(),e._todayDate=e._today.getDate()),t[l.dataField]=new Date(e._todayYear,e._todayMonth,e._todayDate)):t[l.dataField]=l.defaultValue)}e._addingNewRow=!0;const o=e.editing.addNewRow._insertButton.row;o?e.insertRow(t,1+o.visibleIndex):e._add(t),e._recycle(!1),e.closeMenu(),e._addingNewRow=!1,e.editing.addNewRow.visible&&e.$.placeholder.classList.contains("smart-hidden")&&"button"!==e.editing.addNewRow.displayMode&&e.editing.addNewRow._addButton.classList.remove("show")}),0)},t}_createAddNewRowButton(){const e=this,t=document.createElement("div");return t.className="smart-grid-add-row-button smart-grid-icon smart-icon-plus",t.title=e.localize("addNewRow"),t.style.left=!e.appearance.showViewBar||e.appearance.viewBarAppendTo||e.appearance.showViewBarAsDropdown||e._mobile?"":10+e.layout.viewBarWidth+"px",e._addNewGridRow=t.onclick=()=>{e._addRowTimer&&clearTimeout(e._addRowTimer),e._addRowTimer=setTimeout((()=>{if(e.dataSource&&e.dataSource.virtualDataSource)return void e._insertNewRowAfter();const t={};for(let o=0;o<e.columns.length;o++){const l=e.columns[o];void 0!==l.defaultValue&&null!==l.defaultValue&&("today"===l.defaultValue&&"date"===l.dataType?(e._today||(e._today=new Date,e._todayYear=e._today.getFullYear(),e._todayMonth=e._today.getMonth(),e._todayDate=e._today.getDate()),t[l.dataField]=new Date(e._todayYear,e._todayMonth,e._todayDate)):t[l.dataField]=l.defaultValue)}e._addingNewRow=!0,e._add(t),e._mobile||(e._scrollView.vScrollBar.value=e._scrollView.vScrollBar.max),e._recycle(!1),e.closeMenu(),e._addingNewRow=!1,e.editing.addNewRow.visible&&e.$.placeholder.classList.contains("smart-hidden")&&"button"!==e.editing.addNewRow.displayMode&&e.editing.addNewRow._addButton.classList.remove("show")}),0)},t}removeColumn(e){const t=this;let o=-1;if(e)for(let l=0;l<t.columns.length;l++)if(t.columns[l].dataField===e){o=l;break}o>=0&&t.columns.splice(o,1)}addColumn(e,t,o=!0){const l=this;if(e){let a=-1;if(t)for(let e=0;e<l.columns.length;e++)if(l.columns[e].dataField===t){a=e,!1===o&&(a=e+1);break}if("string"==typeof e){const t=l._getKanbanTaskField(e);if(t){if(a>=0)return void l.columns.splice(a,0,t);l.columns.push(t)}return}if(a>=0&&a<l.columns.length)return void l.columns.splice(a,0,e);l.columns.push(e)}}insertColumnAfter(e,t){e&&this.addColumn(e,t,!1)}insertColumnBefore(e,t){e&&this.addColumn(e,t,!0)}addNewColumn(e){e&&this.addColumn(e)}_createAddNewColumnButton(){const e=this,t=document.createElement("div");return t.className="smart-grid-add-column-button smart-grid-icon smart-icon-plus",t.title=e.localize("addNewColumn"),t.onclick=()=>{e._openAddColumnDialog(),e.addEventListener("closeColumnDialog",(()=>{e.layout.isDirty=!0,e._resetCachedLayout(),e._refreshLayout()}))},t}_showAddNewRowButton(e){const t=this;if(!t.columns.length)return;if("grid"!==t.view&&t.editing.addNewRow._addButton)return t.editing.addNewRow._addButton.classList.add("smart-hidden"),void t.editing.addNewRow._addButton.classList.remove("show");if("grid"===t.view&&t.editing.addNewRow._addButton&&t.editing.addNewRow._addButton.classList.remove("smart-hidden"),"float"===e&&t.computedVerticalScrollBarVisibility&&t.editing.addNewRow._addButton&&!t.editing.addNewRow._addButton.classList.contains("show"))return;if("float"===e&&t._addingNewRow)return;const o=()=>{t.editing.addNewRow._addButton&&t.editing.addNewRow._addButton&&("float"!==e&&(t.appearance.showRowHeader||t.appearance.showRowHeaderNumber)&&"card"!==t.view?t.editing.addNewRow._addButton.classList.remove("float"):(!t.computedVerticalScrollBarVisibility&&t.dataSource&&0===t.dataSource.length||t.computedVerticalScrollBarVisibility&&"float"===e||"card"===t.view)&&t.editing.addNewRow._addButton.classList.add("float"),t.computedHorizontalScrollBarVisibility?t.pager.visible?t.editing.addNewRow._addButton.style.bottom="68px":t.editing.addNewRow._addButton.style.bottom="20px":t.pager.visible?t.editing.addNewRow._addButton.style.bottom="48px":t.editing.addNewRow._addButton.style.bottom="",t.grouping.enabled&&t.dataSource)&&(!(t.dataSource.groupBy&&t.dataSource.groupBy.length>0)||t.editing.addNewRow._addButton.classList.remove("show"))};t.editing.addNewRow._addButton&&t.editing.addNewRow.visible&&t.$.placeholder.classList.contains("smart-hidden")&&"button"!==t.editing.addNewRow.displayMode&&t.editing.addNewRow._addButton.classList.remove("show"),!t.editing.addNewRow.visible||"row"===t.editing.addNewRow.displayMode&&t.$.placeholder.classList.contains("smart-hidden")||(t.editing.addNewRow._addButton?requestAnimationFrame((()=>{t.editing.addNewRow._addButton&&(t.editing.addNewRow._addButton.classList.add("show"),t.editing.addNewRow._addButton.style.left=!t.appearance.showViewBar||t.appearance.viewBarAppendTo||t.appearance.showViewBarAsDropdown||t._mobile?"":10+t.layout.viewBarWidth+"px",o(),"insertButton"===t.editing.addNewRow.displayMode&&t.editing.addNewRow._addButton.classList.remove("show"),t.editing.addNewRow.visible&&!t.computedVerticalScrollBarVisibility&&t._newRow&&t.editing.addNewRow._addButton.classList.remove("show"),"insertButton"===t.editing.addNewRow.displayMode&&t.editing.addNewRow._addButton.classList.remove("show"))})):(t.editing.addNewRow._addButton=t._createAddNewRowButton(),t.editing.addNewRow._insertButton=t._createInsertNewRowButton(),t.appendChild(t.editing.addNewRow._addButton),t.appendChild(t.editing.addNewRow._insertButton),"insertButton"===t.editing.addNewRow.displayMode&&t.editing.addNewRow._addButton.classList.remove("show"),requestAnimationFrame((()=>{t.editing.addNewRow._addButton&&(t.editing.addNewRow._addButton.classList.add("show"),o(),(t.editing.addNewRow.visible&&t.$.placeholder.classList.contains("smart-hidden")&&"button"!==t.editing.addNewRow.displayMode||!t.computedVerticalScrollBarVisibility&&t.editing.addNewRow.visible&&t.$.placeholder.classList.contains("smart-hidden"))&&t.editing.addNewRow._addButton.classList.remove("show"))}))))}_showAddNewColumnButton(){const e=this,t=()=>{e.editing.addNewColumn._addButton.classList.add("float")};e.editing.addNewColumn.visible&&(e.editing.addNewColumn._addButton||(e.editing.addNewColumn._addButton=e._createAddNewColumnButton(),e.appendChild(e.editing.addNewColumn._addButton)),requestAnimationFrame((()=>{e.editing.addNewColumn._addButton.classList.add("show"),t()})))}_verticalScrollRecycle(e,t){const o=this;if(o._layoutSuspended||!1===o.isAttached)return;if(o._isUpdating)return;if(o.editing.isEditing&&(!0!==o._disableEndEdit&&o.endEdit(),o._isUpdating))return;o._removeCellContentPopup(),o._inputOverlay&&(o._inputOverlay.parentNode&&o._inputOverlay.parentNode.removeChild(o._inputOverlay),o._inputOverlay=null),o._selection.selectionRect&&o._refreshCellSelectionRect(),o._copyRects&&o._copyRects.length&&o._refreshCopyRects();const l=o._recyclingRows;let a=l[t],n=a.top,i=!1;for(let r=0;r<o._cellsMerge.length;r++){const s=o._cellsMerge[r],d=l.indexOf(s.row);t>d&&t<=d+s.rowSpan&&(t=d,a=s.row,n=a.top,o.$.rowContainer.style.top=o.__frozenNearHeight-e+n+"px",i=!0)}i||(o.$.rowContainer.style.top=o.__frozenNearHeight-e+n+"px")}_verticalScrollbarHandler(e){const t=this;t.menu&&t.menu.column&&t.closeMenu(),t.isScrolling=!0,t._scrollTimer&&clearTimeout(t._scrollTimer),t._layoutSuspended||(t._scrollTimer=setTimeout((()=>{if("virtual"===t.scrolling)t._recycle(!1);else{const e=t._scrollView.scrollTop;let o=t._getRowIndexByPosition(e);o!==t._scrollRowIndex?(t._recycle(!1,!0,!0,o),t._scrollRowIndex=o):t._verticalScrollRecycle(e,o)}if(t.isScrolling=!1,e.max===e.value&&e.max>0){if(t.$.fireEvent("scrollBottomReached"),"infinite"===t.scrolling)return t.appearance.displayLoadingIndicator=!0,t._setLoadingIndicatorVisibility(),t._virtualScrollTimer&&clearTimeout(t._virtualScrollTimer),void(t._virtualScrollTimer=setTimeout((()=>{t._virtualDataRequest("scroll"),t.appearance.displayLoadingIndicator=!1,t._setLoadingIndicatorVisibility()}),50));t.editing.addNewRow._addButton&&"card"!==t.view&&t.editing.addNewRow._addButton.classList.remove("show")}else t.editing.addNewRow.visible&&"row"!==t.editing.addNewRow.displayMode&&t.editing.addNewRow._addButton&&e.max>0&&(t.editing.addNewRow._addButton.classList.add("show"),t.editing.addNewRow._addButton.classList.remove("scroll"),t.editing.addNewRow._addButton.classList.add("float"),"grid"===t.view&&"insertButton"===t.editing.addNewRow.displayMode&&t.editing.addNewRow._addButton.classList.remove("show"));"virtual"===t.scrolling&&(t.appearance.displayLoadingIndicator=!0,t._setLoadingIndicatorVisibility(),t._virtualScrollTimer&&clearTimeout(t._virtualScrollTimer),t._virtualScrollTimer=setTimeout((()=>{t._virtualDataRequest("scroll"),t.appearance.displayLoadingIndicator=!1,t._setLoadingIndicatorVisibility()}),50)),e.min===e.value&&t.$.fireEvent("scrollTopReached")}),0))}getVerticalScrollMax(){return this.scrollHeight}getHorizontalScrollMax(){return this.scrollWidth}getHorizontalScrollValue(){return this.scrollLeft}setHorizontalScrollValue(e){this.scrollLeft=e}getVerticalScrollValue(){return this.scrollTop}setVerticalScrollValue(e){this.scrollTop=e}clearRows(){const e=this;e.dataSource=new Smart.DataAdapter({dataSource:[]}),e.rowHierarchy=null,e._visibleRows=null,e.__viewRows=null,e.rows.canNotify=!1,e.rows.length=0,e.rows.canNotify=!0,e.clearSelection(),e._refresh()}isEmpty(){const e=this;return!!(null===e.dataSource||e.dataSource&&e.dataSource.dataFields&&0===e.dataSource.length&&0===e.dataSource.dataSource.length&&!e.dataSource.virtualDataSource)}setRowStyle(e,t){const o=this,l=o.rowById[e];l&&(l.style=t,o._recycle(!1,!0))}setCellStyle(e,t,o){const l=this,a=l.rowById[e];if(a){const e=a.getCell(t);if(e){const t=e.canNotify;if(e.canNotify=!1,o)for(let t in o)void 0!==e[t]&&(e[t]=o[t]);else e.background=null,e.color=null,e.fontSize=null,e.fontFamily=null,e.fontWeight=null,e.textDecoration=null,e.fontStyle=null;e.canNotify=t,l._recycle(!1,!0)}}}setCellFormula(e,t,o){const l=this,a=l.rowById[e];if(a){const e=a.getCell(t);if(e){const t=e.canNotify;e.canNotify=!1,e.formula=o,e.canNotify=t,l._recycle(!1,!0)}}}dataBind(){const e=this;if(delete e.__autoRowHeight,e._virtualOnExpandCache=[],e._cellsMerge=[],e._cellStyles=[],null===e.dataSource||e.dataSource&&e.dataSource.dataFields&&0===e.dataSource.length&&0===e.dataSource.dataSource.length&&!e.dataSource.virtualDataSource)e.clearRows();else if(Array.isArray(e.dataSource))if(e.dataSourceSettings.dataFields&&e.dataSourceSettings.dataFields.length>0)e.dataSource=new Smart.DataAdapter({dataSource:e.dataSource,dataSourceType:e.dataSourceSettings.dataSourceType,dataFields:e.dataSourceSettings.dataFields,keyDataField:e.dataSourceSettings.keyDataField,parentDataField:e.dataSourceSettings.parentDataField,childrenDataField:e.dataSourceSettings.childrenDataField,groupBy:e.dataSourceSettings.groupBy&&e.dataSourceSettings.groupBy.length?e.dataSourceSettings.groupBy:e.grouping.groupBy,mapChar:e.dataSourceSettings.mapChar,root:e.dataSourceSettings.root,record:e.dataSourceSettings.record,autoGenerateColumns:e.dataSourceSettings.autoGenerateColumns,id:e.dataSourceSettings.id,virtualDataSource:e.dataSourceSettings.virtualDataSource,virtualDataSourceOnExpand:e.dataSourceSettings.virtualDataSourceOnExpand});else if(e.columns&&e.columns.length){let t=[];for(let o=0;o<e.columns.length;o++){const l=e.columns[o];t.push({name:l.dataField,dataType:l.dataType||"string"}),l.displayField!==l.dataField&&t.push({name:l.displayField,dataType:l.dataType||"string"})}e.dataSource=new Smart.DataAdapter({dataSource:e.dataSource,dataFields:t,dataSourceType:e.dataSourceSettings.dataSourceType,keyDataField:e.dataSourceSettings.keyDataField,parentDataField:e.dataSourceSettings.parentDataField,childrenDataField:e.dataSourceSettings.childrenDataField,groupBy:e.dataSourceSettings.groupBy&&e.dataSourceSettings.groupBy.length?e.dataSourceSettings.groupBy:e.grouping.groupBy,mapChar:e.dataSourceSettings.mapChar,root:e.dataSourceSettings.root,record:e.dataSourceSettings.record,autoGenerateColumns:e.dataSourceSettings.autoGenerateColumns,id:e.dataSourceSettings.id,virtualDataSource:e.dataSourceSettings.virtualDataSource,virtualDataSourceOnExpand:e.dataSourceSettings.virtualDataSourceOnExpand})}else e.dataSource=new Smart.DataAdapter({dataSource:e.dataSource});const t=e._filters,o=e._sortedColumns;if(e.clearSort(),e.filtering.filterRow)for(let t=0;t<e.columns.length;t++)e.columns[t]._filterEditorInitialized=!1;for(let t=0;t<e.columns.length;t++)delete e.columns[t]._cellsCachedValues;e._initColumns&&0===e._initColumns.length&&(e.columns=[],e._renderColumns(!0)),e._renderRows(),"virtual"===e.scrolling||e.paging.enabled&&e.dataSource&&e.dataSource.virtualDataSource||e.dataSource&&e.dataSource.virtualDataSource?e._virtualDataRequest("dataBind"):e.paging.enabled&&(!e.dataSource||e.dataSource&&!e.dataSource.url)&&e._refreshPagesCount(),o&&e._refreshSort(o),t&&t.length>0&&(e._filters=null,e.refreshFilters())}refresh(e,t){const o=this;o.isInitialized&&(e&&(o._initializeRows(),o._initializeRowElements()),o._refresh(t),o._refreshSummary())}refreshView(e=!0){const t=this;if(t._recycleFiles=!0,!e)return t._recycle(!1,!0),void delete t._recycleFiles;t._recycle(),delete t._recycleFiles}beginUpdate(){const e=this;e._isUpdating||(e._isUpdating=0),e._isUpdating++}endUpdate(e,t,o=!0){const l=this;l._isUpdating--,l._isUpdating<0&&(l._isUpdating=0),!1!==e?l.refresh():!1!==t&&l.refreshView(o)}_generateUUID(){const e=window.crypto,t=new Uint8Array(16);e.getRandomValues(t),t[6]=15&t[6]|64,t[8]=63&t[8]|128;const o=Array.from(t,(e=>e.toString(16).padStart(2,"0"))).join("");return`${o.substring(0,8)}-${o.substring(8,12)}-${o.substring(12,16)}-${o.substring(16,20)}-${o.substring(20)}`}}),Smart.Grid.Extend=function(e){if(!e)return;const t=Object.getOwnPropertyNames(e.prototype);for(let o in t){const l=t[o];"constructor"!==l&&(Smart.Grid.prototype[l]=e.prototype[l])}},Smart.Grid.Extend(Smart.Utilities.Grid.Resize),Smart.Grid.Extend(Smart.Utilities.Grid.Reorder),Smart.Grid.Extend(Smart.Utilities.Grid.Pager),Smart.Grid.Extend(Smart.Utilities.Grid.Filter),Smart.Grid.Extend(Smart.Utilities.Grid.Sort),Smart.Grid.Extend(Smart.Utilities.Grid.Menu),Smart.Grid.Extend(Smart.Utilities.Grid.Select),Smart.Grid.Extend(Smart.Utilities.Grid.Edit),Smart.Grid.Extend(Smart.Utilities.Grid.Dialog),Smart.Grid.Extend(Smart.Utilities.Grid.Group),Smart.Grid.Extend(Smart.Utilities.Grid.Tree),Smart.Grid.Extend(Smart.Utilities.Grid.Export),Smart.Grid.Extend(Smart.Utilities.Grid.Chart),Smart.Grid.Extend(Smart.Utilities.Grid.View),Smart.Grid.Cell=Smart.Utilities.Grid.Cell,Smart.Grid.Row=Smart.Utilities.Grid.Row,Smart.Grid.Column=Smart.Utilities.Grid.Column;
1449
+ Smart("smart-grid",class extends Smart.ScrollViewer{static get properties(){return{ai:{type:"any",reflectToAttribute:!1,value:{model:{value:"gpt-4.1",type:"string"},maxTokens:{value:200,type:"number"},temperature:{value:.7,type:"number"},maxResponseLength:{value:100,type:"number"},promptVariables:{value:null,type:"any",reflectToAttribute:!1},prompts:{value:null,type:"any",reflectToAttribute:!1},includeUserPrompts:{value:!0,type:"boolean"},url:{value:"",type:"string"},key:{value:"",type:"string"}}},appearance:{value:{alternationStart:{value:0,type:"int"},alternationEnd:{value:0,type:"int"},alternationCount:{value:0,type:"int"},allowHover:{value:!1,type:"boolean",defaultReflectToAttribute:!0},allowHeaderHover:{value:!0,type:"boolean",defaultReflectToAttribute:!0},allowRowToggleAnimation:{value:!1,type:"boolean"},allowRowDetailToggleAnimation:{value:!1,type:"boolean"},allowSortAnimation:{value:!1,type:"boolean"},allowColumnLabelAnimation:{value:!0,type:"boolean"},allowCheckBoxesSelectionAnimation:{value:!0,type:"boolean"},allowColumnMenuAnimation:{value:!0,type:"boolean"},allowColumnSortButtonAnimation:{value:!0,type:"boolean"},allowColumnActionButtonAnimation:{value:!0,type:"boolean"},allowColumnFilterButtonAnimation:{value:!0,type:"boolean"},allowColumnAutoPlaceholder:{value:!1,type:"boolean"},allowColumnStickyPosition:{value:!1,type:"boolean"},autoShowColumnSortButton:{value:!0,type:"boolean"},autoShowColumnActionButton:{value:!0,type:"boolean"},autoGenerateRowLabelMode:{value:"number",type:"string"},autoGenerateColumnLabelMode:{value:"letter",type:"string"},autoShowColumnFilterButton:{value:!0,type:"boolean"},cardTitleField:{value:"",type:"string"},displayLoadingIndicator:{value:!1,type:"boolean"},loadingIndicatorPlaceholder:{value:"Loading...",type:"string"},placeholder:{value:"No Rows",type:"string"},sortAnimationDuration:{value:500,type:"number"},showRowHeader:{value:!1,type:"boolean"},showRowStatus:{value:!1,type:"boolean"},showRowEditDialogDetails:{value:!1,type:"boolean"},showRowComments:{value:!1,type:"boolean"},showRowHeaderNumber:{value:!1,type:"boolean"},showRowHeaderEditIcon:{value:!1,type:"boolean",defaultReflectToAttribute:!0},showRowHeaderDragIcon:{value:!1,type:"boolean"},showColumnHeaderDragIcon:{value:!1,type:"boolean"},showRowHeaderSelectIcon:{value:!1,type:"boolean"},showRowHeaderFocusIcon:{value:!1,type:"boolean"},showColumnHeaderLines:{value:!0,type:"boolean",defaultReflectToAttribute:!0},showColumnGroupLines:{value:!0,type:"boolean",defaultReflectToAttribute:!0},showColumnGroupCellLines:{value:!0,type:"boolean",defaultReflectToAttribute:!0},showColumnLines:{value:!0,type:"boolean",defaultReflectToAttribute:!0},showRowLines:{value:!0,type:"boolean",defaultReflectToAttribute:!0},showFilterColumnBackground:{value:!1,type:"boolean"},showSortColumnBackground:{value:!1,type:"boolean"},showFrozenColumnBackground:{value:!0,type:"boolean"},showFrozenRowBackground:{value:!0,type:"boolean"},showSelectionOnTop:{value:!0,type:"boolean"},showColumnSortButton:{value:!0,type:"boolean"},showColumnFilterButton:{value:!0,type:"boolean"},showColumnDescriptionButton:{value:!1,type:"boolean"},showColumnIcon:{value:!1,type:"boolean"},showColumnCustomButton:{value:!1,type:"boolean"},showColumnActionButton:{value:!0,type:"boolean"},showColumnGroupsInColumnPanel:{value:!1,type:"boolean"},showTooltips:{value:!1,type:"boolean"},showTooltipsOverflow:{value:!0,type:"boolean"},showResizeTooltips:{value:!0,type:"boolean"},showHorizontalScrollBarOnFixedColumns:{value:!1,type:"boolean"},showVerticalScrollBarOnFixedColumns:{value:!1,type:"boolean"},showTreeRowHeader:{value:!1,type:"boolean"},showTodayDateAsString:{value:!0,type:"boolean"},showViewBar:{value:!1,type:"boolean"},showViewBarAsDropdown:{value:!1,type:"boolean"},viewBarAppendTo:{value:null,type:"any"}},type:"object"},behavior:{value:{autoDestroy:{value:!0,type:"boolean"},allowColumnAutoSizeOnDoubleClick:{value:!0,type:"boolean"},allowRowAutoSizeOnDoubleClick:{value:!0,type:"boolean"},allowColumnReorder:{value:!1,type:"boolean"},allowColumnFreeze:{value:!0,type:"boolean"},allowRowReorder:{value:!1,type:"boolean"},allowMouseWheel:{value:!0,type:"boolean"},allowRenderCache:{value:!0,type:"boolean"},doubleClickTimingDelay:{value:300,type:"number"},columnResizeMode:{value:"none",type:"string",allowedValues:["none","split","growAndShrink"]},rowResizeMode:{value:"none",type:"string",allowedValues:["none","split","growAndShrink"]}},type:"object"},layout:{value:{autoWrap:{value:!0,type:"boolean"},autoWidth:{value:!1,type:"boolean"},autoHeight:{value:!1,type:"boolean"},allowCellsWrap:{value:!1,type:"boolean"},allowCellsWrapShortcut:{value:!0,type:"boolean"},autoGenerateColumnWidth:{value:null,type:"number?"},autoSizeNewColumn:{value:!1,type:"boolean",reflectToAttribute:!1},autoSizeNewColumnMinWidth:{value:180,type:"number",reflectToAttribute:!1},cardMinWidth:{value:250,type:"any",reflectToAttribute:!1},cardRowMinHeight:{value:45,type:"any",reflectToAttribute:!1},cardsPerRow:{value:"auto",type:"any",reflectToAttribute:!1},cardVertical:{value:!0,type:"boolean",reflectToAttribute:!1},columnWidth:{value:null,type:"any",reflectToAttribute:!1},columnHeight:{value:null,type:"any",reflectToAttribute:!1},columnMinHeight:{value:30,type:"any",reflectToAttribute:!1},dropDownWidth:{value:700,type:"any",reflectToAttribute:!1},dropDownHeight:{value:500,type:"any",reflectToAttribute:!1},isDirty:{value:!1,type:"boolean"},loadingIndicatorPosition:{value:"center",allowedValues:["bottom","center","top"],type:"string"},rowMinHeight:{value:30,type:"number"},rowMobileHeight:{value:null,type:"number"},rowHeight:{value:null,type:"any",reflectToAttribute:!1},viewBarWidth:{value:200,type:"number"}},type:"object"},dataExport:{value:{header:{value:!0,type:"boolean"},filterBy:{value:null,type:"object"},groupBy:{value:null,type:"object"},style:{value:null,type:"any"},fileName:{value:"SmartGrid",type:"string?"},pageOrientation:{value:"portrait",type:"string"},expandChar:{value:"+",type:"string"},collapseChar:{value:"-",type:"string"},view:{value:!1,type:"boolean"},viewStart:{value:null,type:"number?"},viewEnd:{value:null,type:"number?"},rowIds:{value:null,type:"array?"},headerContent:{value:null,type:"any",reflectToAttribute:!1},footerContent:{value:null,type:"any",reflectToAttribute:!1},addImageToCell:{value:null,type:"any",reflectToAttribute:!1},setRowHeight:{value:null,type:"any",reflectToAttribute:!1},cellFormatFunction:{value:null,type:"any",reflectToAttribute:!1},autoConvertFormulas:{value:!0,type:"boolean"},freezeHeader:{value:!1,type:"boolean"},onlySelected:{value:!1,type:"boolean"},exportAsTable:{value:!1,type:"boolean"},exportStyles:{value:!0,type:"boolean"},formatData:{value:null,type:"any",reflectToAttribute:!1},getSpreadsheets:{value:null,type:"any",reflectToAttribute:!1}},type:"object"},clipboard:{value:{enabled:{value:!0,type:"boolean"},copyHeadersToClipboard:{value:!1,type:"boolean"},autoFillMode:{value:"copy",allowedValues:["none","copy","fillSeries"],type:"string"},onPasteValue:{value:null,type:"any"}},type:"object"},conditionalFormatting:{value:null,type:"array?",reflectToAttribute:!1},columns:{value:[],type:"any",reflectToAttribute:!1},contextMenu:{value:{selector:{value:"",type:"string"},enabled:{value:!1,type:"boolean"},width:{value:"auto",type:"any"},height:{value:null,type:"any"},customContextMenuItems:{value:null,type:"any"},dataSource:{value:{contextMenuItemChart:{value:{command:{value:"contextMenuItemChartCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:!1,type:"boolean"},icon:{value:"smart-icon-chart",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},contextMenuItemSelectRow:{value:{command:{value:"contextMenuItemSelectRowCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:!1,type:"boolean"},icon:{value:"smart-icon-check-squared",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},contextMenuItemExpand:{value:{command:{value:"contextMenuItemExpandCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:!1,type:"boolean"},icon:{value:"smart-icon-resize-full",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},contextMenuItemInsertRow:{value:{command:{value:"contextMenuItemInsertRowCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:!1,type:"boolean"},icon:{value:"smart-icon-plus",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},contextMenuItemCloneRow:{value:{command:{value:"contextMenuItemCloneRowCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:!1,type:"boolean"},icon:{value:"smart-icon-duplicate",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},contextMenuItemDelete:{value:{command:{value:"contextMenuItemDeleteCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:!1,type:"boolean"},icon:{value:"smart-icon-delete",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},contextMenuItemEdit:{value:{command:{value:"contextMenuItemEditCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:!1,type:"boolean"},icon:{value:"smart-icon-mode-edit",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},contextMenuItemCut:{value:{command:{value:"contextMenuItemCutCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:!1,type:"boolean"},icon:{value:"smart-icon-cut",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},contextMenuItemCopy:{value:{command:{value:"contextMenuItemCopyCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:!1,type:"boolean"},icon:{value:"smart-icon-copy-record",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},contextMenuItemPaste:{value:{command:{value:"contextMenuItemPasteCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:!1,type:"boolean"},icon:{value:"smart-icon-paste",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},contextMenuItemClear:{value:{command:{value:"contextMenuItemClearCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:!1,type:"boolean"},icon:{value:"smart-icon-close",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},contextMenuItemComment:{value:{command:{value:"contextMenuItemAddCommentCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:!1,type:"boolean"},icon:{value:"smart-icon-comment",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},contextMenuItemCustom:{value:{command:{value:null,type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:!1,type:"boolean"},icon:{value:"smart-icon-settings",type:"string"},label:{value:"",type:"string"}},type:"object",reflectToAttribute:!1}},type:"object",reflectToAttribute:!1}},type:"object",reflectToAttribute:!1},columnMenu:{value:{autoClose:{value:!0,type:"boolean"},dataSource:{value:{columnMenuCustomizeType:{value:{command:{value:"customizeTypeCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:!1,type:"any"},icon:{value:"smart-icon-settings",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},columnMenuItemClone:{value:{command:{value:"duplicateCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:!1,type:"any"},icon:{value:"smart-icon-duplicate",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},columnMenuItemInsert:{value:{command:{value:"insertRightCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:!1,type:"any"},icon:{value:"smart-icon-plus",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},columnMenuItemSortAsc:{value:{command:{value:"sortAscCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:"auto",type:"any"},icon:{value:"smart-icon-sort-name-up",type:"string"},iconAlt:{value:"smart-icon-sort-number-up",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},columnMenuItemSortDesc:{value:{command:{value:"sortDescCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:"auto",type:"any"},icon:{value:"smart-icon-sort-name-down",type:"string"},iconAlt:{value:"smart-icon-sort-number-down",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},columnMenuItemRemoveSort:{value:{command:{value:"removeSortCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:"auto",type:"any"},icon:{value:"smart-icon-cancel-circled",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},columnMenuItemSort:{value:{command:{value:"addSortCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:"auto",type:"any"},icon:{value:"smart-icon-sort",type:"string"},iconAlt:{value:"smart-icon-sort",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},columnMenuItemFilter:{value:{command:{value:"addFilterCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:"auto",type:"any"},icon:{value:"smart-icon-add-filter",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},columnMenuItemRemoveFilter:{value:{command:{value:"removeFilterCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:"auto",type:"any"},icon:{value:"smart-icon-cancel-circled",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},columnMenuItemGroupBy:{value:{command:{value:"groupByCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:"auto",type:"any"},icon:{value:"smart-icon-group",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},columnMenuItemRemoveGroupBy:{value:{command:{value:"removeGroupByCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:"auto",type:"any"},icon:{value:"smart-icon-ungroup",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},columnMenuItemHide:{value:{command:{value:"hideColumnCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:!1,type:"any"},icon:{value:"smart-icon-visibility-off",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},columnMenuItemDelete:{value:{command:{value:"deleteColumnCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:!1,type:"any"},icon:{value:"smart-icon-delete",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1}},type:"object",reflectToAttribute:!1},visible:{value:!1,type:"boolean"},enabled:{value:!0,type:"boolean"},width:{value:250,type:"number"},height:{value:null,type:"number?"}},type:"object",reflectToAttribute:!1},columnGroups:{value:[],type:"array",reflectToAttribute:!1},charting:{value:{appendTo:{value:null,type:"any"},enabled:{value:!1,type:"boolean"},colorScheme:{value:"scheme01",type:"string"},dialog:{value:{header:{value:"{{message}}",type:"string"},height:{value:500,type:"any"},width:{value:800,type:"any"},left:{value:"center",type:"any"},top:{value:"center",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:!1,type:"boolean"}},type:"object"},formatSettings:{value:{},type:"object"}},type:"object"},view:{value:"grid",allowedValues:["grid","kanban","card","scheduler","timeline"],type:"string"},currentUser:{value:null,type:"any",reflectToAttribute:!1},dropDownMode:{value:!1,type:"boolean",reflectToAttribute:!1},dropDownModeInput:{value:!1,type:"boolean",reflectToAttribute:!1},dropDownModeDataField:{value:"",type:"string",reflectToAttribute:!1},dataSource:{value:null,type:"any",reflectToAttribute:!1},dataSourceMap:{value:{checklist:"checklist",color:"color",comments:"comments",dueDate:"dueDate",id:"id",priority:"priority",progress:"progress",startDate:"startDate",status:"status",swimlane:"swimlane",tags:"tags",text:"text",description:"description",userId:"userId",history:"history",createdUserId:"createdUserId",createdDate:"createdDate",updatedUserId:"updatedUserId",updatedDate:"updatedDate"},type:"any",reflectToAttribute:!1},dataSourceSettings:{value:{autoGenerateColumns:{value:!1,type:"boolean"},sanitizeHTML:{value:"blackList",allowedValues:["all","blackList","none"],type:"string"},root:{value:"",type:"string"},record:{value:"",type:"string"},keyDataField:{value:"",type:"string"},parentDataField:{value:"",type:"string"},childrenDataField:{value:"",type:"string"},groupBy:{value:[],type:"array"},dataFields:{value:[],type:"array",reflectToAttribute:!1},mapChar:{value:".",type:"string"},id:{value:"",type:"string"},relations:{value:[],type:"any",reflectToAttribute:!1},virtualDataSource:{value:null,type:"any"},virtualDataSourceOnExpand:{value:null,type:"any"}},type:"object",reflectToAttribute:!1},formulas:{value:!1,type:"boolean"},highlighted:{value:-1,type:"any"},uploadSettings:{value:{url:{value:"",type:"string",reflectToAttribute:!1},removeUrl:{value:"",type:"string",reflectToAttribute:!1},existsUrl:{value:"",type:"string",reflectToAttribute:!1},name:{value:"userfile[]",type:"string",reflectToAttribute:!1},uploadMaxCount:{value:5,type:"number",reflectToAttribute:!1},uploadMaxSize:{value:2097152,type:"number",reflectToAttribute:!1},data:{value:null,type:"object",reflectToAttribute:!1},onUploadStarted:{value:null,type:"any",reflectToAttribute:!1},onUploadCompleted:{value:null,type:"any",reflectToAttribute:!1},onUploadRemove:{value:null,type:"any",reflectToAttribute:!1},onUploadError:{value:null,type:"any",reflectToAttribute:!1},onChange:{value:null,type:"any",reflectToAttribute:!1},onProgress:{value:null,type:"any",reflectToAttribute:!1},onAbort:{value:null,type:"any",reflectToAttribute:!1},onError:{value:null,type:"any",reflectToAttribute:!1},onSetHeaders:{value:null,type:"any",reflectToAttribute:!1},singleFilePost:{value:!0,type:"boolean",reflectToAttribute:!1},userFiles:{value:[],type:"array",reflectToAttribute:!1}},reflectToAttribute:!1,type:"object"},grouping:{value:{enabled:{value:!1,type:"boolean",reflectToAttribute:!1},allowCollapse:{value:!1,type:"boolean",reflectToAttribute:!1},autoHideGroupColumn:{value:!1,type:"boolean",reflectToAttribute:!1},autoExpandAll:{value:!1,type:"boolean",reflectToAttribute:!1},autoExpandToLevel:{value:0,type:"number",reflectToAttribute:!1},onGroupDefaultExpanded:{value:null,type:"any",reflectToAttribute:!1},expandMode:{value:"buttonClick",type:"string",allowedValues:["buttonClick","rowClick"],reflectToAttribute:!1},renderMode:{type:"string",value:"advanced",allowedValues:["basic","compact","advanced","multipleColumns"]},groupBy:{value:[],type:"array",reflectToAttribute:!1},groupRowHeight:{value:50,type:"any",reflectToAttribute:!1},toggleButtonIndent:{value:27,type:"number",reflectToAttribute:!1},groupIndent:{value:27,type:"number",reflectToAttribute:!1},groupBar:{value:{visible:{value:!1,type:"boolean",reflectToAttribute:!1},allowColumnDragDrop:{value:!0,type:"boolean",reflectToAttribute:!0},allowColumnCloseButtons:{value:!0,type:"boolean",reflectToAttribute:!0}},type:"object"},formatFunction:{value:null,type:"any",reflectToAttribute:!1},summaryRow:{value:{inline:{value:!0,type:"boolean"},visible:{value:!0,type:"boolean"}},type:"object"}},type:"object"},keys:{value:null,reflectToAttribute:!1,type:"any"},messages:{extend:!0,value:{en:{invalidColumnProperty:'{{elementType}}: Invalid property name "{{propertyName}}" set for Column: "{{type}}"',invalidRowProperty:'{{elementType}}: Invalid property name "{{propertyName}}" set for Row"',invalidCellValue:'Invalid cell value "{{value}}", Validation rule: "{{validationRule}}"',invalidValue:"Invalid value",invalidMinValue:"{{value}} above {{min}} must be filled out",invalidMaxValue:"{{value}} below {{max}} must be filled out",invalidMinLengthValue:"{{value}} is shorter than the minimum length of {{min}} characters",invalidMaxLengthValue:"{{value}} is longer than the maximum length of {{max}} characters",requiredValue:"{{value}} must be filled out",frozenColumns:"{{elementType}}: To Pin/Freeze a column group, all columns within it should be frozen.",frozenRows:"{{elementType}}: To Pin/Freeze a special cell, all rows within it should be frozen.",columnGroups:"{{elementType}}: Please, check the initialization of the SmartGrid's columns array. The columns in a column group are expected to be siblings in the columns array.",viewGrid:"Grid",viewKanban:"Kanban",viewCard:"Cards",viewScheduler:"Calendar",viewTimeline:"Timeline",kanbanNone:"Blank",schedulerDescription:"Which date column would you like to use for this view? Your data would be placed based on the dates in this column.",schedulerDescriptionInfo:"A range of data would be displayed when a start date field has an associated due date field.",kanbanDescription:'Start from a project board with columns generated by the "{{column}}" column options.',kanbanNoneDescription:"Create a new column and start from scratch with a completely blank project board. You can add columns and configure settings yourself.",kanbanBasic:"Template",kanbanBasicDescription:'Create a new column and start from a project board with columns for "To do", "in progress" and "Done".',schedulerDateColumn:"Create a new date column",schedulerPromptLabel:"Using date column(s)",schedulerDateRangeColumn:"Create a new date range",schedulerToolLabel:"Using '{{column}}'",toolLabel:"Labeled by '{{column}}'",uncategorized:"Uncategorized",toDo:"To do",inProgress:"In progress",done:"Done",min:"Min: {{value}}",max:"Max: {{value}} ",sum:"Sum: {{value}} ",avg:"Avg: {{value}} ",cells:"{{value}} cells selected",rows:"{{value}} rows",oneRow:"1 row",unique:"Unique: {{value}}",blank:"Empty: {{value}}",filled:"Filled: {{value}}",summary:"Summary",countSummary:"Count",minSummary:"Min",maxSummary:"Max",avgSummary:"Avg",blankSummary:"Empty",uniqueSummary:"Unique",filledSummary:"Filled",statusSummary:"Status",sumSummary:"Sum",completed:"Tasks Completed: {{value}}",count:"Count: {{value}} ",pagerFirstButton:"First",pagerLastButton:"Last",pagerPreviousButton:"Previous",pagerNextButton:"Next",pagerNavigateToLabel:"Go to:",pagerPageSizeLabel:"Show:",pagerNavigateToInputPlaceholder:"",pagerEllipsis:"...",pagerSummaryString:"of",pagerSummaryPrefix:"of",pagerSummarySuffix:"",columnMenuCustomizeType:"Column settings",columnMenuItemClone:"Clone column",columnMenuItemInsert:"Insert column",columnMenuItemSortAsc:"Sort {{mode}}",columnMenuItemSortDesc:"Sort {{mode}}",columnMenuItemRemoveSort:"Remove Sort",columnMenuItemFilter:"Filter column",columnMenuItemSort:"Sort column",columnMenuItemRemoveFilter:"Remove Filter",columnMenuItemGroupBy:"Group column",columnMenuItemRemoveGroupBy:"Remove Group",columnMenuItemHide:"Hide column",columnMenuItemShow:"Show column",columnMenuItemDelete:"Delete column",columnResizeTooltip:"width: {{value}}px",rowResizeTooltip:"height: {{value}}px",commandBarAddRow:"Add",commandBarDeleteRow:"Delete row",commandBarBatchRevert:"Revert",commandBarBatchSave:"Save",commandBarFilter:"Filter",commandBarSort:"Sort",commandBarSearch:"Search",commandBarCustomize:"Customize",commandBarGroup:"Group",commandColumnEdit:"Edit",commandColumnDelete:"Delete",commandColumnCancel:"Cancel",commandColumnUpdate:"Update",contextMenuItemDelete:"Delete row",contextMenuItemEditCell:"Edit cell",contextMenuItemEditRow:"Edit row",contextMenuItemSelectRow:"Select row",contextMenuItemCloneRow:"Clone row",contextMenuItemInsertRow:"Insert row",contextMenuItemChart:"Chart range",contextMenuItemAddRow:"Add {{value}} rows",commandColumnMenu:"",expandRow:"Expand row (Shift + Enter)",expandRowComments:"Expand row and see {{value}} comments",collapseRow:"Collapse row",addNewRow:"Click here to add a new row",addNewRowAlt:"<span>Add new empty row</span> <code>Ctrl</code> + <code>Space</code>",addNewRowAltSmall:"Add new empty row",addNewColumn:"Click here to add a new column",dialogChartHeader:"{{value}} Chart",dialogRowDetailHeader:"Row Id: {{value}}",dialogDescriptionHeader:"Column: {{value}}",dialogRowDetailButtonConfirm:"OK",dialogRowDetailButtonCancel:"CANCEL",dialogEditHeaderDisabled:"Row: {{value}}",dialogEditHeader:"Row: {{value}}",dialogEditHeaderMenu:"Toggle Sidebar",dialogExpandRowHeader:"Edit Record",dialogAddButtonConfirm:"ADD",dialogAddButtonCancel:"CANCEL",dialogEditButtonConfirm:"OK",dialogEditButtonSave:"Save",dialogEditButtonAutoSave:"Auto Save",dialogEditButtonCancel:"Cancel",dialogFilterButtonConfirm:"FILTER",dialogFilterButtonCancel:"CLEAR",dialogDeleteButtonConfirm:"DELETE",dialogDeleteButtonCancel:"CANCEL",dialogEditColumn:"Column: {{value}}",dialogNewColumn:"New column",dialogAddColumn:"Add Column",dialogAddColumnDate:"Choose a date column",dialogAddColumnStatus:"Choose a grouping column",dialogAddColumnStatusDescription:"Represent the status of each record",dialogAddColumnStatusNotes:"Your records will be grouped based on this column",dialogAddHeader:"Add Row",dialogDeleteHeader:"Delete Row",dialogFilterHeader:"Filter by",dialogFilterMinLabel:"Min",dialogFilterMaxLabel:"Max",dialogFileHeader:"File",dialogImageFileHeader:"Image",dialogFileDrop:"or drag and drop file(s) to upload",dialogFileUpload:"Select Files(s) to Upload",dialogFileURL:"You can also provide the URL to a file",dialogFileURLUpload:"Upload",dialogFileLink:"Link (URL)",dialogFileDevice:"My Device",dialogMyFiles:"My Files",dialogMyFilesTitle:"Select files from your already uploaded files.",dialogFileSize:'No file currently added. The "{{value}}" file cannot be uploaded. Maximum file size is {{fileSize}}.',dialogFileCount:'The following files cannot be added "{{files}}". Maximum files allowed is {{fileCount}}.',dialogFileFileUpload:"No files currently selected",dialogAddColumnName:"Name",dialogAddColumnNameInfo:"Name of the column. The name of the column will be displayed in the column header.",dialogAddColumnDescription:"Description",dialogAddColumnDescriptionInfo:"Description of the column. When the description is set, an icon will be displayed in the column header. A tooltip with the description will be displayed when you point at the icon.",dialogAddColumnNamePlaceholder:"Column name (optional)",dialogAddColumnDescriptionPlaceholder:"Describe this column (optional)",dialogAddColumnType:"Type",dialogAddColumnTypeInfo:'Type of the data in the column. Unlike a spreadsheet, Columns have specific "types" that allow you to store rich content in each record. For example, a table can contain records (rows) with images, long texts, checkboxes.',dialogAddColumnTypeText:"Text",dialogAddColumnTypeMultilineText:"Multiline text",dialogAddColumnTypeAIQuery:"AI Button",dialogAddColumnTypeSparklines:"Sparklines",dialogAddColumnAIQuery:"AI Query",dialogAddColumnTypeAIQueryInfo:"Example: Write a short description for an article or choose a column to query by it",dialogAddColumnTypeUUID:"UUID",dialogAddColumnTypeImage:"Image",dialogAddColumnTypeNumber:"Number",dialogAddColumnTypeSelect:"Select",dialogAddColumnTypeMultipleSelect:"Multiple select",dialogAddColumnTypeDate:"Date",dialogAddColumnTypeTime:"Time",dialogAddColumnTypeRating:"Rating",dialogAddColumnTypeDuration:"Duration",dialogAddColumnTypeCheckBox:"CheckBox",dialogAddColumnTypeCreatedTime:"Created time",dialogAddColumnTypeLastUpdatedTime:"Last modified time",dialogAddColumnTypeCreatedBy:"Created by",dialogAddColumnTypeLastUpdatedBy:"Last modified by",dialogAddColumnTypeCollaborator:"User",dialogAddColumnTypeFormula:"Formula",dialogAddColumnTypeFormulaInfo:'Example: COL(Name) & "-" & COL(Price) or IF(COL(Price) * COL(Quantity) > 5, "Yes", "No")',dialogAddColumnTypeSlider:"Slider",dialogAddColumnTypeStatus:"Choose a status column",dialogAddColumnTypeStatusInfo:"Connect with the relevant status column",dialogAddColumnTypeAutoNumber:"Auto number",dialogAddColumnTypeRowLink:"Link to table",dialogAddColumnTypeURL:"URL",dialogAddColumnTypeEmail:"Email",dialogAddColumnTypePassword:"Password",dialogAddColumnTypePhone:"Phone",dialogAddColumnTypeNone:"None",dialogAddColumnTypeStartDate:"Start Date",dialogAddColumnTypeDueDate:"Due Date",dialogAddColumnTypeDueDateSettings:"Set as a deadline",dialogAddColumnTypeDueDateSettingsInfo:"Set a deadline with start date or due date templates.",dialogAddColumnTypeProgress:"Progress",dialogAddColumnTypePriority:"Priority",dialogAddColumnTypeDescription:"Description",dialogAddColumnTypeTags:"Tags",dialogAddColumnTypeName:"Name",dialogAddColumnTypeColor:"Color",dialogAddColumnTypeChecklist:"Checklist",dialogAddColumnTypeAssigned:"Assignee",dialogAddColumnTypeAttachment:"Attachment",dialogAddColumnTypeVote:"Vote",dialogAddColumnDateFormat:"Date format",dialogAddColumnDateFormatInfo:"Choose the dates display format",dialogAddColumnDateFormatShort:"Short",dialogAddColumnDateFormatMonthYear:"Month & Year",dialogAddColumnDateFormatCasualUS:"Casual US",dialogAddColumnDateFormatWeekdayOnly:"Weekday",dialogAddColumnDateFormatUS:"US",dialogAddColumnDateFormatLong:"Long",dialogAddColumnDateFormatEU:"EU",dialogAddColumnDateFormatISO:"ISO",dialogAddColumnDateFormatAS:"AS",dialogAddColumnDateFormatFull:"Full",dialogAddColumnDateFormatSlash:"Slash",dialogAddColumnDateFormatHyphen:"Hyphen",dialogAddColumnDateFormatDot:"Dot",dialogAddColumnTimeFormat:"Time format",dialogAddColumnTimeFormatInfo:"Choose the time display format",dialogAddColumnTimeFormatHour:"hour",dialogAddColumnAllowTimeFormat:"Include a time field",dialogAddColumnCustomDateSeparator:"Set a custom separator",dialogAddColumnNumberFormat:"Number format",dialogAddColumnNumberFormatInfo:"Choose the number display format",dialogAddColumnNumberFormatInteger:"Integer",dialogAddColumnNumberFormatNumber:"Number",dialogAddColumnNumberFormatPercent:"Percent",dialogAddColumnNumberFormatPercentRounded:"Percent(rounded)",dialogAddColumnNumberFormatScientific:"Scientific",dialogAddColumnNumberFormatEngineering:"Engineering",dialogAddColumnNumberFormatAccounting:"Accounting",dialogAddColumnNumberFormatUnit:"Unit",dialogAddColumnNumberFormatUnitInfo:"Units of measurement",dialogAddColumnNumberFormatUnitAcre:"Acre",dialogAddColumnNumberFormatUnitCelsius:"Celsius",dialogAddColumnNumberFormatUnitFahrenheit:"Fahrenheit",dialogAddColumnNumberFormatUnitPercent:"Percent",dialogAddColumnNumberFormatUnitDegree:"Degree",dialogAddColumnNumberFormatUnitMegaByte:"Mega byte",dialogAddColumnNumberFormatUnitCentimeter:"Centimeter",dialogAddColumnNumberFormatUnitMeter:"Meter",dialogAddColumnNumberFormatUnitKilometer:"Kilometer",dialogAddColumnNumberFormatUnitMile:"Mile",dialogAddColumnNumberFormatUnitKilogram:"Kilogram",dialogAddColumnNumberFormatUnitPound:"Pound",dialogAddColumnNumberFormatUnitLiter:"Liter",dialogAddColumnNumberFormatUnitGallon:"Gallon",dialogAddColumnNumberFormatUnitSecond:"Second",dialogAddColumnNumberFormatUnitMinute:"Minute",dialogAddColumnNumberFormatUnitHour:"Hour",dialogAddColumnNumberFormatUnitDay:"Day",dialogAddColumnNumberFormatUnitWeek:"Week",dialogAddColumnNumberFormatUnitMonth:"Month",dialogAddColumnNumberFormatUnitYear:"Year",dialogAddColumnNumberFormatCurrency:"Currency",dialogAddColumnNumberFormatCurrencyRounded:"Currency(rounded)",dialogAddColumnNumberFormatCurrencyInfo:"Choose the currency display format",dialogAddColumnNumberFormatDecimalPlaces:"Decimal places",dialogAddColumnNumberFormatSeparator:"Use 1000 Separator (,)",dialogAddColumnMinLength:"Minimum length",dialogAddColumnMinLengthInfo:"Minimum text length",dialogAddColumnMaxLength:"Maximum length",dialogAddColumnMaxLengthInfo:"Maximum text length",dialogAddColumnMinValue:"Minimum value",dialogAddColumnMinValueInfo:"Minimum number",dialogAddColumnMaxValue:"Maximum value",dialogAddColumnMaxValueInfo:"Maximum number",dialogAddColumnMinDate:"Minimum date",dialogAddColumnMinDateInfo:"Minimum date",dialogAddColumnMaxDate:"Maximum date",dialogAddColumnMaxDateInfo:"Maximum date",dialogAddColumnColorItems:"Color items",dialogAddColumnDotItems:"Show Dots",dialogAddColumnCustomItems:"Custom Items",dialogAddColumnListItems:"List items",dialogAddColumnLinkListItems:"Choose a table to link to",dialogAddColumnLinkField:"Choose a lookup field",dialogAddColumnLinkFieldMore:"Cascading readonly fields",dialogAddColumnLinkSelect:"Allow linking to multiple rows",dialogAddColumnFormula:"Please enter a formula",dialogAddColumnListItemsError:"You cannot delete an item while in use.",dialogAddColumnListItemsEditError:"You cannot edit an item while in use.",dialogAddColumnDefault:"Default value",dialogAddColumnDefaultDateCurrent:"Current Date",dialogAddColumnDefaultDateSpecific:"Specific Date",dialogAddColumnAlign:"Align",dialogAddColumnAlignLeft:"Left",dialogAddColumnAlignRight:"Right",dialogAddColumnAlignCenter:"Center",dialogAddColumnAlignInfo:"Table cells text alignment",dialogAddColumnResizable:"Resizable",dialogAddColumnResizableInfo:"Select if you want to make the column resizable",dialogAddColumnRequired:"Required",dialogAddColumnRequiredInfo:"Select if you want to make the column required",dialogAddColumnSortable:"Sortable",dialogAddColumnSortableInfo:"Select if you want to sort by this column",dialogAddColumnFilterable:"Filterable",dialogAddColumnFilterableInfo:"Select if you want to filter by this column",dialogAddColumnEditable:"Editable",dialogAddColumnEditableInfo:"Select if you want to edit by this column",dialogAddColumnMultipleCollaborators:"Multiple Collaborators",dialogAddColumnMultipleCollaboratorsInfo:"Select if you want to allow multiple collaborators",dialogAddColumnBlankItem:"Blank Item",dialogAddColumnFormatting:"Rich Formatting",priority_low:"Low",priority_average:"Average",priority_high:"High",priority_critical:"Critical",strikethrough:"Strikethrough",bold:"Bold",fontStyle:"Font Style",italic:"Italic",send:"Send",copy:"copy",status:"Status",underline:"Underline",comments:"Comments",comment:"Comment",commentPlaceholder:"Leave a comment",noComments:"Leave a comment and collaborate with your team.",guestUser:"Guest",background:"Background",starred:"Starred",resetFormat:"Reset Format",notStarred:"Not starred",color:"Color",coloredItems:"Colored items",conditionalFormatting:"Conditional Formatting",groupBarLabel:"Drag a column header here to group by that column",dialogDeleteContent:"Are you sure you want to delete this row?",detailsTab:"Format",commentsTab:"Comments",historyTab:"History",historyEvent:"Event",historyAuthor:"Author",historyDetails:"Details",range:"Changed {{column}} from {{oldValue}} to {{newValue}}",nullRange:"Changed {{column}} to {{newValue}}",rowCreated:"Row Created",propertyUpdated:"{{value}} updated",propertyRemoved:"{{value}} removed",dropImages:"Drop images here",addImages:"Add images",dropFiles:"Drop files here",addFiles:"Add files",unassigned:"Unassigned",historyDate:"Date",copyURL:"Copy row URL",calendar:{"/":"/",":":":",firstDay:0,days:{names:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],namesAbbr:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],namesShort:["Su","Mo","Tu","We","Th","Fr","Sa"]},months:{names:["January","February","March","April","May","June","July","August","September","October","November","December",""],namesAbbr:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec",""]},AM:["AM","am","AM"],PM:["PM","pm","PM"],eras:[{name:"A.D.",start:null,offset:0}],currencySymbol:"$",currency:"USD",currencySymbolPosition:"before",decimalSeparator:".",thousandsSeparator:","},CONTAINS:"Contains",DOES_NOT_CONTAIN:"Does not contain",ENDS_WITH:"Ends with",EQUAL:"Equal",GREATER_THAN:"Greater than",GREATER_THAN_OR_EQUAL:"Greater than or equal",LESS_THAN:"Less than",LESS_THAN_OR_EQUAL:"Less than or equal",NOT_EQUAL:"Not equal",RANGE:"Range",CLEAR_FILTER:"Clear Filter",STARTS_WITH:"Starts with",addFilter:"+ Add filter",addAIFilter:" ✨︎ Ask AI",and:"And",apply:"Apply",applyOnce:"Apply once",booleanFirst:"☐",booleanLast:"☑",cancel:"Cancel",CONTAINS_CASE_SENSITIVE:"Contains (case sensitive)",dateFirst:"1",dateLast:"9",DOES_NOT_CONTAIN_CASE_SENSITIVE:"does not contain (case sensitive)",EMPTY:"empty",ENDS_WITH_CASE_SENSITIVE:"ends with (case sensitive)",EQUAL_CASE_SENSITIVE:"equal (case sensitive)",filter:"Filter",customize:"Hide columns",customizeOne:"1 hidden column",customizeHidden:"{{n}} hidden columns",filteredByMultiple:"{{n}} filters",filteredByOne:"1 filter",filterValuePlaceholder:"Value",find:"Find a field",findInView:"Find in view",firstBy:"Sort by",found:"{{nth}} of {{n}}",from:"from",noFilters:"No filters applied",noResults:"No results",noSorting:"No sorting applied",noOptions:"No options",NOT_EMPTY:"not empty",NOT_NULL:"not null",NULL:"null",numberFirst:"1",numberLast:"9",ok:"OK",or:"Or",pickAnother:"Pick another field to sort by",maintainSort:"Maintain sort",sort:"Sort",group:"Group",sortedByMultiple:"Sorted by {{n}} columns",sortedByOne:"Sorted by 1 column",STARTS_WITH_CASE_SENSITIVE:"starts with (case sensitive)",stringFirst:"A",stringLast:"Z",thenBy:"then by",where:"Where",collapseAll:"Collapse all",expandAll:"Expand all",noGrouping:"No grouping",groupedByMultiple:"{{n}} groups",groupedByOne:"1 group",groupedBy:"Grouped by '{{column}}'",deleteByMultiple:"Delete {{n}} rows",deleteByOne:"Delete 1 row",download:"Download",firstByGroup:"Group by",expandRecord:"Expand row",expandCell:"Expand cell",pickAnotherGroupBy:"Pick another field to group by",add:"Add condition",all:"All columns",between:"Between",close:"Close",column:"Column:",condition:"Condition:",equal:"equal",fontFamily:"Font family:",fontSize:"Font size:",format:"Format:",greaterThan:"greater than",highlight:"Highlight",lessThan:"less than",notEqual:"not equal",remove:"Remove condition",secondValue:"Second value:",text:"Text",value:"Value:",addCondition:"Add Condition",addGroup:"Add Group",blanks:"(Blanks)",clear:"Clear",contains:"contains",containsCaseSensitive:"contains (case sensitive)",dateTabLabel:"DATE",doesNotContain:"does not contain",doesNotContainCaseSensitive:"does not contain (case sensitive)",empty:"empty",endsWith:"ends with",endsWithCaseSensitive:"ends with (case sensitive)",equalCaseSensitive:"equal (case sensitive)",greaterThanOrEqual:"greater than or equal",lessThanOrEqual:"less than or equal",mismatchedProperties:'SmartFilterPanel: The "filterType" and the data type of the selected "dataField" are mismatched.',missingProperty:'SmartFilterPanel: When mode is \'excel\', either "data" and "dataField" or "dataSource" of type Array have to be set.',notEmpty:"not empty",notNull:"not null",null:"null ",placeholderBoolean:"Select value",placeholderDate:"Enter date",placeholderNumber:"Enter number",placeholderTime:"Enter time",placeholderValue:"Enter value",selectAll:"(Select All)",showRows:"Show rows where:",startsWith:"starts with",startsWithCaseSensitive:"starts with (case sensitive)",matchCase:"Match Case",timeTabLabel:"TIME",today:"Today",tomorrow:"Tomorrow",yesterday:"Yesterday",formatColumn:"Format Column",formating:"Color",formatingByMultiple:"{{n}} Colors",formatingOne:"1 color",formatingBy:"Colored by '{{value}}'",reset:"Reset",filteredRecords:"All rows are filtered",duplicateCells:"Clone column cells and settings",duplicateSettings:"Clone column settings",views:"Views",createView:"New View",newGrid:"Grid",newKanban:"Kanban",newCard:"Cards",newScheduler:"Calendar",newTimeline:"Timeline",layout:"Layout",settings:"Create view",viewNamePlaceholder:"View name",view:"View",noViews:"Found no views",kanbanView:"View your records as cards on a Kanban board",gridView:"View your records in a Table",cardView:"View your records in a Card view",schedulerView:"View your records in a Calendar view",timelineView:"View your records in a Timeline view",days:"{{value}}d",daysOverdue:"{{value}} days overdue",daysLeft:"{{value}} days left",true:"true",false:"false",TOMORROW:"Tomorrow",TODAY:"Today",YESTERDAY:"Yesterday",NEXT_WEEK:"Next week",THIS_WEEK:"This week",LAST_WEEK:"Last week",NEXT_MONTH:"Next month",THIS_MONTH:"This month",LAST_MONTH:"Last month",hideHiddenColumns:"Hide {{value}} hidden columns",showHiddenColumns:"Show {{value}} hidden columns",less:"Less",more:"More",conditions:"Conditions",colorsSingleSelect:"Which single select field should the row be colored by?",colorRows:"Color rows when they match the conditions",colorSelect:"Color rows the same as a single select value",colorLeftBorderLabel:"Left border",colorRowLabel:"Row",colorCellLabel:"Cell",colorLeftBorder:"Color the left border of a row",colorRow:"Color the background of a row",colorCell:"Color the background of a cell",loadingIndicatorPlaceholder:"Loading...",dropDownPlaceholder:"Please select...",placeholder:"No Rows",columnPlaceholder:"Placeholder",pieChart:"Pie",columnChart:"Column",barChart:"Bar",stackedChart:"Stacked",lineChart:"Line",projectStatus:"Project Status",reviewStatus:"Review Status",taskStatus:"Task Status",priority:"Priority",size:"Size",yesNo:"Yes/No/Maybe",backlog:"Backlog",notStarted:"Not Started",underReview:"Under review",approved:"Approved",rejected:"Rejected",blocked:"Blocked",completedStatus:"Completed",generate:"Generate",aiPrompt:"Enter your prompt for the AI:",agenda:"Agenda",checkStyle:"Style",noVotes:"No votes yet",votes:"Voted by {{value}}",clearContents:"Clear contents",paste:"Paste",minPromptChars:"Enter AI prompt. Min 20 chars.",aiResponse:"Response",noAIResponse:"No response from AI",promptSuggest:"Prompt Suggestions"}},type:"object"},onCellValue:{value:null,type:"any",reflectToAttribute:!1},onCellEditRequest:{value:null,type:"any",reflectToAttribute:!1},onCellUpdate:{value:null,type:"any",reflectToAttribute:!1},onCellRender:{value:null,type:"any",reflectToAttribute:!1},onCellValueChanged:{value:null,type:"any",reflectToAttribute:!1},onBeforeInit:{value:null,type:"any",reflectToAttribute:!1},onInit:{value:null,type:"any",reflectToAttribute:!1},onAfterInit:{value:null,type:"any",reflectToAttribute:!1},onKey:{value:null,type:"any",reflectToAttribute:!1},onKeyUp:{value:null,type:"any",reflectToAttribute:!1},onRender:{value:null,type:"any",reflectToAttribute:!1},onLoad:{value:null,type:"any",reflectToAttribute:!1},onChartInit:{value:null,type:"any",reflectToAttribute:!1},onComment:{value:null,type:"any",reflectToAttribute:!1},onRowInit:{value:null,type:"any",reflectToAttribute:!1},onRowClass:{value:null,type:"any",reflectToAttribute:!1},onRowChange:{value:null,type:"any",reflectToAttribute:!1},onRowDetailInit:{value:null,type:"any",reflectToAttribute:!1},onRowDetailUpdated:{value:null,type:"any",reflectToAttribute:!1},onRowInserted:{value:null,type:"any",reflectToAttribute:!1},onRowRemoved:{value:null,type:"any",reflectToAttribute:!1},onRowUpdate:{value:null,type:"any",reflectToAttribute:!1},onRowUpdated:{value:null,type:"any",reflectToAttribute:!1},onRowStarred:{value:null,type:"any",reflectToAttribute:!1},onRowHistory:{value:null,type:"any",reflectToAttribute:!1},onRowStyle:{value:null,type:"any",reflectToAttribute:!1},onRowResize:{value:null,type:"any",reflectToAttribute:!1},onColumnInit:{value:null,type:"any",reflectToAttribute:!1},onColumnInserted:{value:null,type:"any",reflectToAttribute:!1},onColumnRemoved:{value:null,type:"any",reflectToAttribute:!1},onColumnResize:{value:null,type:"any",reflectToAttribute:!1},onColumnReorder:{value:null,type:"any",reflectToAttribute:!1},onColumnSummaryChange:{value:null,type:"any",reflectToAttribute:!1},onColumnUpdated:{value:null,type:"any",reflectToAttribute:!1},onColumnClone:{value:null,type:"any",reflectToAttribute:!1},onColumnChange:{value:null,type:"any",reflectToAttribute:!1},onCommand:{value:null,reflectToAttribute:!1,type:"any"},onViewInit:{value:null,type:"any",reflectToAttribute:!1},filtering:{value:{enabled:{value:!1,type:"boolean"},operator:{value:"and",type:"string"},filter:{value:[],type:"array",reflectToAttribute:!1},filterRow:{value:{visible:{value:!1,type:"boolean"},menuVisible:{value:!1,type:"boolean"},applyMode:{value:"auto",type:"string",allowedValues:["auto","click"]},autoApplyModeDelay:{value:800,type:"number"}},type:"object"},filterMenu:{value:{visible:{value:!0,type:"boolean"},buttons:{value:["cancel","clear","filter"],type:"array"},dataSource:{value:null,type:"any"},width:{value:250,type:"number"},height:{value:200,type:"number"},mode:{value:"default",allowedValues:["default","excel"],type:"string"},messages:{value:null,type:"object"}},type:"object"}},type:"object"},editing:{value:{allowRowHeaderEdit:{value:!1,type:"boolean"},allowColumnHeaderEdit:{value:!1,type:"boolean"},autoUpdateFilterAndSort:{value:!0,type:"boolean"},allowListOpenOnContentClick:{value:!0,type:"boolean"},allowDynamicButtons:{value:!1,type:"boolean"},active:{value:!1,readonly:!0,type:"boolean"},enabled:{value:!1,type:"boolean"},batch:{value:!1,type:"boolean"},readOnlyEdit:{value:!1,type:"boolean"},action:{value:"click",type:"string",allowedValues:["none","click","doubleClick"]},commandKeys:{value:{commandKeyCancel:{value:{command:"commandKeyCancelCommand",key:"Escape"},type:"object"},commandKeyUpdate:{value:{command:"commandKeyUpdateCommand",key:"Enter | Tab"},type:"object"}},type:"object"},commandBar:{value:{visible:{value:!1,type:"boolean"},position:{value:"near",allowedValues:["near","far","both"],type:"string"},displayMode:{value:"labelAndIcon",allowedValues:["label","icon","labelAndIcon"],type:"string"},dataSource:{value:{commandBarAddRow:{value:{command:{value:"commandBarAddRowCommand",type:"any"},icon:{value:"smart-icon-plus",type:"string"},label:{value:"{{messages}}",type:"string"},visible:{value:!1,type:"any"}},type:"object"},commandBarDeleteRow:{value:{command:{value:"commandBarDeleteRowCommand",type:"any"},icon:{value:"smart-icon-delete",type:"string"},label:{value:"{{messages}}",type:"string"},visible:{value:!1,type:"any"}},type:"object"},commandBarBatchSave:{value:{command:{value:"commandBarBatchSaveCommand",type:"any"},icon:{value:"smart-icon-ok-squared",type:"string"},label:{value:"{{messages}}",type:"string"},visible:{value:!0,type:"any"}},type:"object"},commandBarBatchRevert:{value:{command:{value:"commandBarBatchRevertCommand",type:"any"},icon:{value:"smart-icon-reload",type:"string"},label:{value:"{{messages}}",type:"string"},visible:{value:!0,type:"any"}},type:"object"},commandBarCustom:{value:{command:{value:"",type:"any"},icon:{value:"smart-icon-ellipsis-vert",type:"string"},label:{value:"",type:"string"},visible:{value:!1,type:"any"}},type:"object"}},type:"object"}},type:"object"},commandColumn:{value:{visible:{value:!1,type:"boolean"},inline:{value:!1,type:"boolean"},position:{value:"far",allowedValues:["near","far"],type:"string"},displayMode:{value:"icon",allowedValues:["label","icon","labelAndIcon"],type:"string"},customCommandColumns:{value:null,type:"any"},dataSource:{value:{commandColumnMenu:{value:{command:{value:"commandColumnMenuCommand",type:"any"},icon:{value:"smart-icon-menu",type:"string"},label:{value:"{{messages}}",type:"string"},visible:{value:!1,type:"any"}},type:"object"},commandColumnEdit:{value:{command:{value:"commandColumnEditCommand",type:"any"},icon:{value:"smart-icon-mode-edit",type:"string"},label:{value:"{{messages}}",type:"string"},visible:{value:"auto",type:"any"}},type:"object"},commandColumnDelete:{value:{command:{value:"commandColumnDeleteCommand",type:"any"},icon:{value:"smart-icon-delete",type:"string"},label:{value:"{{messages}}",type:"string"},visible:{value:!0,type:"any"}},type:"object"},commandColumnUpdate:{value:{command:{value:"commandColumnUpdateCommand",type:"any"},icon:{value:"smart-icon-ok-squared",type:"string"},label:{value:"{{messages}}",type:"string"},visible:{value:"auto",type:"any"}},type:"object"},commandColumnCancel:{value:{command:{value:"commandColumnCancelCommand",type:"any"},icon:{value:"smart-icon-cancel-circled",type:"string"},label:{value:"{{messages}}",type:"string"},visible:{value:"auto",type:"any"}},type:"object"},commandColumnRowMenu:{value:{command:{value:"commandColumnRowMenuCommand",type:"any",reflectToAttribute:!1},icon:{value:"smart-icon-ellipsis-vert",type:"string"},label:{value:"{{messages}}",type:"string"},visible:{value:!1,type:"any"}},type:"object"},commandColumnCustom:{value:{command:{value:"",type:"any",reflectToAttribute:!1},icon:{value:"smart-icon-ellipsis-vert",type:"string"},label:{value:"",type:"string"},visible:{value:!1,type:"any"}},type:"object"}},type:"object"},width:{value:null,type:"number?"}},reflectToAttribute:!1,type:"object"},mode:{value:"cell",allowedValues:["cell","row"],type:"string"},addNewColumn:{value:{visible:{value:!1,type:"boolean"}},type:"object"},addNewRow:{value:{position:{value:"both",allowedValues:["near","far","both"],type:"string"},visible:{value:!1,type:"boolean"},autoEdit:{value:!0,type:"boolean"},autoCreate:{value:!1,type:"boolean"},autoSave:{value:!0,type:"boolean"},label:{value:"{{message}}",type:"string"},displayMode:{value:"row",allowedValues:["row","insertButton","button"],type:"string"}},type:"object"},dialog:{value:{header:{value:"{{message}}",type:"string"},height:{value:"auto",type:"any"},width:{value:"auto",type:"any"},sidePanel:{value:!1,type:"boolean"},left:{value:"center",type:"any"},top:{value:"center",type:"any"},enabled:{value:!1,type:"boolean"},visible:{value:!1,type:"boolean"}},type:"object"},addDialog:{value:{header:{value:"{{message}}",type:"string"},height:{value:"auto",type:"any"},width:{value:"auto",type:"any"},left:{value:"center",type:"any"},top:{value:"center",type:"any"},enabled:{value:!1,type:"boolean"},visible:{value:!1,type:"boolean"}},type:"object"},addColumnDialog:{value:{header:{value:"{{message}}",type:"string"},height:{value:"auto",type:"any"},width:{value:430,type:"any"},left:{value:"center",type:"any"},top:{value:"center",type:"any"},enabled:{value:!1,type:"boolean"},visible:{value:!1,type:"boolean"}},type:"object"},deleteDialog:{value:{header:{value:"{{message}}",type:"string"},height:{value:"auto",type:"any"},width:{value:"auto",type:"any"},left:{value:"center",type:"any"},top:{value:"center",type:"any"},enabled:{value:!1,type:"boolean"},visible:{value:!1,type:"boolean"}},type:"object"}},type:"object"},paging:{value:{enabled:{value:!1,type:"boolean"},spinner:{value:{enabled:{value:!1,type:"boolean"},step:{value:1,type:"number"}},type:"object"},pageHierarchySize:{value:2,type:"int"},pageSize:{value:10,type:"int"},pageIndex:{value:0,type:"int",validator:"pageIndexValidator"}},type:"object"},pager:{value:{autoEllipsis:{value:"both",allowedValues:["none","before","after","both"],type:"string"},position:{value:"far",allowedValues:["near","far","both"],type:"string"},template:{value:"",type:"string"},pageSizeSelector:{value:{visible:{value:!1,type:"boolean"},dataSource:{value:[10,20,50],type:"object"},position:{value:"far",allowedValues:["near","far"],type:"string"}},type:"object"},summary:{value:{position:{value:"far",allowedValues:["near","far"],type:"string"},visible:{value:!1,type:"boolean"}},type:"object"},navigationButtons:{value:{position:{value:"both",allowedValues:["near","far","both"],type:"string"},prevNextButtons:{value:{visible:{value:!0,type:"boolean"}},type:"object"},firstLastButtons:{value:{visible:{value:!0,type:"boolean"}},type:"object"},labels:{value:{visible:{value:!1,type:"boolean"}},type:"object"}},type:"object"},navigationInput:{value:{position:{value:"far",allowedValues:["near","far"],type:"string"},visible:{value:!1,type:"boolean"}},type:"object"},pageIndexSelectors:{value:{visible:{value:!0,type:"boolean"},dataSource:{value:10,type:"any"}},type:"object"},visible:{value:!1,type:"boolean"}},type:"object",reflectToAttribute:!1},rowDetail:{value:{enabled:{value:!1,type:"boolean"},inline:{value:!1,type:"boolean"},height:{value:200,type:"number"},position:{value:"near",allowedValues:["near","far"],type:"string"},template:{value:"",type:"any",reflectToAttribute:!1},visible:{value:!0,type:"boolean"},dialog:{value:{header:{value:"{{message}}",type:"string"},height:{value:300,type:"any"},width:{value:360,type:"any"},left:{value:"center",type:"any"},top:{value:"center",type:"any"},enabled:{value:!1,type:"boolean"},visible:{value:!1,type:"boolean"}},type:"object"}},type:"object"},rowCSSRules:{value:null,type:"any"},summaryRow:{value:{position:{value:"far",allowedValues:["near","far"],type:"string"},visible:{value:!1,type:"boolean"},editing:{value:!1,type:"boolean"},template:{value:"",type:"string"}},type:"object"},scrolling:{value:"physical",allowedValues:["physical","virtual","infinite","deferred"],type:"string"},columnHeader:{value:{visible:{value:!0,type:"boolean"}},type:"object"},groupHeader:{value:{visible:{value:!1,type:"boolean"},template:{value:"",type:"string"}},type:"object"},header:{value:{visible:{value:!1,type:"boolean"},template:{value:"",type:"any"},appendTo:{value:"",type:"any"},buttons:{value:["columns","filter","group","sort","format","search"],type:"array"},searchCommand:{value:"search",allowedValues:["search","filter"],type:"string"},customButton:{value:{command:{value:null,type:"any",reflectToAttribute:!1},enabled:{value:!0,type:"boolean"},visible:{value:!1,type:"boolean"},icon:{value:"smart-icon-settings",type:"string"},label:{value:"",type:"string"}},type:"object",reflectToAttribute:!1},onInit:{value:null,reflectToAttribute:!1,type:"any"}},type:"object"},footer:{value:{visible:{value:!1,type:"boolean"},template:{value:"",type:"any"}},type:"object"},stateSettings:{value:{enabled:{value:!0,type:"boolean",reflectToAttribute:!1},current:{value:"",type:"string",reflectToAttribute:!1},storage:{value:null,type:"any",reflectToAttribute:!1},autoSave:{value:!1,type:"boolean",reflectToAttribute:!1},autoLoad:{value:!1,type:"boolean",reflectToAttribute:!1},allowLocalStorage:{value:!0,type:"boolean",reflectToAttribute:!1},options:{value:[],type:"array",reflectToAttribute:!1},onStateChange:{value:null,type:"any",reflectToAttribute:!1}},type:"object",reflectToAttribute:!1},checkBoxes:{value:{visible:{value:!1,type:"boolean"},hasThreeStates:{value:!1,type:"boolean"}},type:"object"},selection:{value:{enabled:{value:!1,type:"boolean"},allowRowHeaderSelection:{value:!1,type:"boolean"},allowColumnHeaderSelection:{value:!1,type:"boolean"},allowRowSelection:{value:!0,type:"boolean"},allowCellSelection:{value:!1,type:"boolean"},allowDragSelection:{value:!0,type:"boolean"},allowDragSelectionAutoScroll:{value:!0,type:"boolean"},allowCellDragSelectionHandle:{value:!0,type:"boolean"},allowCellDragDropSelectionHandle:{value:!0,type:"boolean"},allowCellDragSelectionAutoFill:{value:!0,type:"boolean"},selectAllMode:{value:"page",allowedValues:["none","page","all"],type:"string"},mode:{value:"many",type:"string",allowedValues:["one","many","extended"]},action:{value:"click",type:"string",allowedValues:["none","click","doubleClick"]},checkBoxes:{value:{enabled:{value:!1,type:"boolean"},autoShow:{value:!1,type:"boolean"},action:{value:"click",type:"string",allowedValues:["none","click","doubleClick"]},selectAllMode:{value:"page",allowedValues:["none","page","all"],type:"string"},position:{value:"near",allowedValues:["near","far"],type:"string"}},type:"object"},selected:{value:"",type:"string"},tabKeyBehavior:{value:"default",allowedValues:["none","default"],type:"string"},defaultSelection:{value:!1,type:"boolean"}},type:"object"},sorting:{value:{enabled:{value:!1,type:"boolean"},sort:{value:[],type:"array"},mode:{value:"one",allowedValues:["one","many"],type:"string"},maintainSort:{value:!0,type:"boolean"},commandKey:{value:"",allowedValues:["","Shift","Control","Alt"],type:"string"},sortToggleThreeStates:{value:!0,type:"boolean"},sortToggleOnClick:{value:!0,type:"boolean"},sortToggleOnClickAndCommandKey:{value:!1,type:"boolean"}},type:"object"},storeHistory:{value:!1,type:"boolean"},storeHistoryItems:{value:20,type:"number"},users:{value:[],type:"array",reflectToAttribute:!1},virtualModeCachedRowsCount:{value:100,type:"int"}}}static get requires(){return{}}static get styleUrls(){return["Smart.menu.css","Smart.filterpanel.css","Smart.pager.css","Smart.grid.css","Smart.textbox.css"]}template(){return"<div class='smart-container'id='container' disabled='[[disabled]]' >\n <div id='header' role=\"toolbar\" class='smart-grid-header smart-hidden'>\n </div>\n <div id='groupHeader' role=\"presentation\" class='smart-grid-group-header smart-hidden'></div>\n <div id='headerPager' top class='smart-grid-pager smart-hidden'></div>\n <div id='headerCommandBar' header top class='smart-grid-header smart-grid-command-bar smart-hidden'></div>\n <div id='content' role='grid' class='smart-grid-content'>\n <div id='columnHeader' role=\"rowgroup\" class='smart-grid-column-header'>\n <div id='columnNearContainer' role=\"row\" class='near smart-hidden smart-grid-column-header-cell-container'>\n </div>\n <div id='columnContainer' role=\"row\" class='center smart-grid-column-header-cell-container'>\n </div>\n <div id='columnFarContainer' role=\"row\" class='far smart-hidden smart-grid-column-header-cell-container'>\n </div>\n </div>\n <div id='scrollView' role=\"rowgroup\" class ='smart-grid-scroll-view'>\n <div id='rowNearContainer' role=\"presentation\" class='near smart-hidden smart-grid-row-container'>\n </div>\n <div id='rowContainer' style=\"opacity: 0.99\" role=\"presentation\" class='center smart-grid-row-container'>\n </div>\n <div id='rowFarContainer' role=\"presentation\" class='far smart-hidden smart-grid-row-container'>\n </div>\n <div id='placeholder' class ='smart-hidden smart-placeholder smart-grid-placeholder'></div>\n <smart-scroll-bar right-to-left=\"[[rightToLeft]]\" theme=\"[[theme]]\" id='verticalScrollBar' class='smart-grid-scroll-bar' wait disabled='[[disabled]]' orientation='vertical'></smart-scroll-bar>\n <smart-scroll-bar right-to-left=\"[[rightToLeft]]\" theme=\"[[theme]]\" id='horizontalScrollBar' class='smart-grid-scroll-bar' wait disabled='[[disabled]]'></smart-scroll-bar>\n </div>\n <div id='filterFooter' class='smart-grid-filter-footer smart-hidden'></div>\n </div>\n <div class=\"smart-grid-view-content smart-hidden\" id=\"viewContent\"></div>\n <div viewbar class=\"smart-grid-view-bar smart-hidden\" id=\"viewBar\"></div>\n <div id='loadingIndicatorContainer' class='smart-loader-container'>\n <span id='loadingIndicator' class='smart-grid-loader smart-loader'></span>\n <span id='loadingIndicatorPlaceholder' class ='smart-loader-label smart-hidden'></span>\n </div>\n <div id='footerCommandBar' footer class='smart-grid-footer smart-grid-command-bar smart-hidden'></div>\n <div id='footerPager' class='smart-grid-pager smart-hidden'></div>\n <div id='footer' class='smart-grid-footer smart-hidden'></div>\n </div>"}static get listeners(){return{focus:"_focusHandler",blur:"_blurHandler",wheel:"_mouseWheelHandler","document.up":"_upHandler","document.down":"_downHandler","document.move":"_moveHandler","document.scroll":"_scrollHandler",keydown:"_keyDownHandler",keyup:"_keyUpHandler",resize:"_resizeHandler","header.click":"_headerClickHandler","columnHeader.down":"_columnDownHandler","columnHeader.click":"_columnClickHandler","columnHeader.move":"_columnMoveHandler","columnHeader.mouseleave":"_columnMouseLeaveHandler","rowNearContainer.down":"_rowDownHandler","rowContainer.down":"_rowDownHandler","rowFarContainer.down":"_rowDownHandler","container.selectstart":"_selectStartHandler",styleChanged:"_styleChangedHandler",swipeleft:"_swipeLeftHandler",swiperight:"_swipeRightHandler",contextmenu:"_contextMenuHandler","document.paste":"_clipboardPasteHandler",mouseleave:"_mouseLeaveHandler"}}_mouseLeaveHandler(){const e=this;e.editing.addNewRow._insertButton&&e.editing.addNewRow._insertButton.classList.remove("show")}_clipboardPasteHandler(e){if("paste"===e.type){const t=this;if(document.activeElement!==t)return;if(t._selection&&t._selection.focusedCell){const o=t._selection.focusedCell.id,l=t._selection.focusedCell.dataField,a=t.columnByDataField[l];if(!a)return;if(a&&("image"===a.template||"attachment"===a.template||"richText"===a.template)){e.preventDefault();let n=(e.clipboardData||e.originalEvent.clipboardData).items,i=null,r=0,s=0,d=[];for(let e=0;e<n.length;e++)if(0===n[e].type.indexOf("image")&&(i=n[e].getAsFile(),r++,null!==i)){let e={label:i.name,size:i.size},n=new FileReader;n.onload=function(n){s++;const i=n.target.result;e.value=i;let c=!1;for(let o=0;o<t.uploadSettings.userFiles.length;o++){const l=t.uploadSettings.userFiles[o];if(l.name===e.label||l.label===e.label){c=!0;break}}if(c||t.uploadSettings.userFiles.push(e),d.push(e),s===r){let e=t.getCellValue(o,l);e||(e=[]),"string"==typeof e&&(e=JSON.parse(e)),e=[...e,...d];let n=e;if("richText"===a.template){const a=document.createElement("span");for(let t=0;t<e.length;t++){const o=document.createElement("img");o.src=e[t].value,o.title=o.name=e[t].label,a.appendChild(o)}t.setCellValue(o,l,a.outerHTML),n=a.outerHTML}else t.setCellValue(o,l,e);const i=t.rowById[o].getCell(l),r="";t.onCellUpdate&&t.onCellUpdate([i],[r],[e],(function(){t.onCellUpdated&&t.onCellUpdated([i.row.index],[i.row],[i.column],[i.row.data],[r],[e],t),t._onCellUpdated&&t._onCellUpdated(i.row.index,i.row,i.column,i.row.data,r,e)}),t)}},n.readAsDataURL(i)}}}}}_contextMenuHandler(e){if(this.contextMenu.enabled)return e.preventDefault(),e.stopPropagation(),!1;this._mobile&&(e.preventDefault(),e.stopPropagation())}get _tabindex(){return this.disabled||this.unfocusable?"":' tabindex="0"'}pageIndexValidator(e,t){const o=this;if(t<0)return 0;if(o.dataSource){if(o.dataSource.virtualDataSource)return t;const e=Math.ceil(o.dataSource.length/o._pageSize);if(t>e-1)return e-1}}_offsetTop(e){return e?e.offsetTop+this._offsetTop(e.offsetParent):0}_offsetLeft(e){return e?e.offsetLeft+this._offsetLeft(e.offsetParent):0}offset(e){return{left:this._offsetLeft(e),top:this._offsetTop(e)}}getBoundingRect(e){const t=this;let o=window.pageXOffset,l=window.pageYOffset,a=e.getBoundingClientRect();if(t.isInShadowDOM){const t=e.getBoundingClientRect();let o=window.pageXOffset,l=window.pageYOffset,a=e;for(;a&&a!==document.body&&a!==document.documentElement;){const e=a.parentNode;null!==a.scrollLeft&&(o+=a.scrollLeft),null!==a.scrollTop&&(l+=a.scrollTop);const t=a.getRootNode?a.getRootNode():null;if(t&&t instanceof ShadowRoot)a=t.host;else{if(!e||1!==e.nodeType)break;a=e}}return o+=window.pageXOffset,l+=window.pageYOffset,{top:t.top+l,left:t.left+o,right:t.right+o,bottom:t.bottom+l,width:t.width,height:t.height}}if(e!==document.body){let a=e.parentNode;for(;a!==document.body&&a;){a&&(o+=a.scrollLeft,l+=a.scrollTop);let e=a;a?(a=a.parentNode,t.enableShadowDOM&&a===t.shadowRoot?a=t:!t.isInShadowDOM||a!==t.getRootNode()&&e!==t.getRootNode()||(a=t.getRootNode().host)):t.isInShadowDOM&&(a=t.getRootNode().host)}}return{bottom:a.bottom+l,height:a.height,left:a.left+o,right:a.right+o,top:a.top+l,width:a.width}}_downHandler(e){this._downTarget=e.originalEvent.target}_removeCellContentPopup(){const e=this;e._cellContentPopup&&(e._cellContentPopup.remove(),e._cellContentPopup=null),e._cellContentPopupTimer&&(clearTimeout(e._cellContentPopupTimer),e._cellContentPopupTimer=null)}_upHandler(e){const t=this,o=t.getBoundingRect(t);if(super._upHandler(),t._spinTimeout&&clearTimeout(t._spinTimeout),t._spinInterval&&clearInterval(t._spinInterval),t._tapTimer&&clearTimeout(t._tapTimer),t._mobile&&e.originalEvent&&"pointercancel"===e.originalEvent.type)return;const l=()=>{if(t.editing.isEditing&&!t.editing.dialog.enabled){if(t._hasRichTextEditor)return;setTimeout((()=>{if(!e.defaultPrevented){if(t.editing.editCell&&t.editing.editCell.editor.instance){const o=t.editing.editCell.editor.instance;if(o.element&&o.element.hasAttribute("aria-owns")){const t=o.element.getAttribute("aria-owns"),l=document.getElementById(t);if(l&&l.contains(e.originalEvent.target))return}if(o.element&&o.element&&o.element.firstElementChild&&o.element.firstElementChild.hasAttribute("aria-owns")){const t=o.element.firstElementChild.getAttribute("aria-owns"),l=document.getElementById(t);if(l&&l.contains(e.originalEvent.target))return}if(e.originalEvent.target&&e.originalEvent.target.classList.contains("smart-editor-toolbar-item"))return;if(t.editing.editCell.editor.instance.blur(e),e.defaultPrevented)return}else if(t.editing.editRow){const o=t.editing.editRow.cells;for(let t=0;t<o.length;t++){const l=o[t];if(l&&l.editor&&l.editor.instance){if(l.editor.instance.element&&l.editor.instance.element.hasAttribute("aria-owns")){const t=l.editor.instance.element.getAttribute("aria-owns"),o=document.getElementById(t);if(o&&o.contains(e.originalEvent.target))return}if(l.editor.instance.element&&l.editor.instance.element.firstElementChild&&l.editor.instance.element.firstElementChild.hasAttribute("aria-owns")){const t=l.editor.instance.element.firstElementChild.getAttribute("aria-owns"),o=document.getElementById(t);if(o&&o.contains(e.originalEvent.target))return}if(e.originalEvent.target&&e.originalEvent.target.classList.contains("smart-editor-toolbar-item"))return;if(l.editor.instance.blur(e),e.defaultPrevented)return}}}t.isAttached&&t.endEdit()}}),50)}};if(e.originalEvent&&(e.originalEvent.target===t.$.scrollView&&t._downTarget===e.originalEvent.target&&l(),e.originalEvent.target.closest(".smart-grid-dialog")))t._dialogDragDetails&&(t._dialogDragDetails.started=!1);else{if(e.pageX<o.left||e.pageX>o.right||e.pageY<o.top||e.pageY>o.bottom){let o=!1,a=e.originalEvent.target;for(;a;){if(a=a.parentNode,a===t){o=!0;break}if(t.dropDownMode&&t.$.dropDownElement===a){o=!0;break}}if(o)return t._dragSelectionEnd(e),t._endResize(e),void t._endDrag(e);if(t._summaryRowDialog&&t._summaryRowDialog.classList.contains("open")&&t._summaryRowDialog.confirm(),t._inputOverlay&&(t._inputOverlay.classList.remove("smart-input-overlay-on"),setTimeout((()=>{t._inputOverlay&&(t._inputOverlay.parentNode&&t._inputOverlay.parentNode.removeChild(t._inputOverlay),t._inputOverlay=null)}),t.behavior.doubleClickTimingDelay)),l(),t.closeDropDown(),t.menu){let o,l,a,n;if(t.enableShadowDOM||t.isInShadowDOM?(o=e.originalEvent.composedPath()[0],l=function(){let e=o.getRootNode().host;for(;e;){if(e===t)return e;e=e.getRootNode().host}}(),a=t.menu.contains(o)||t.menu.firstElementChild.shadowRoot.contains(o),n=t.menu.firstElementChild.shadowRoot):(o=e.originalEvent.target,l=t.contains(o),a=t.menu.contains(o),n=t.menu),!l&&!a){const l=n.querySelectorAll("smart-drop-down-list"),a=n.querySelectorAll("smart-date-time-picker"),i=n.querySelectorAll("smart-date-input"),r=n.querySelectorAll("smart-input");for(let e=0;e<l.length;e++)if(l[e].$.dropDownContainer.contains(o))return;for(let e=0;e<a.length;e++)if(a[e].$.dropDownContainer.contains(o))return;for(let e=0;e<i.length;e++)if(i[e].$.scrollView.contains(o))return;for(let e=0;e<r.length;e++)if(r[e].$.scrollView.contains(o))return;return t.closeMenu(),t._dragSelectionEnd(e),t._endResize(e),void t._endDrag(e)}}}t._summaryRowDialog&&t._summaryRowDialog.classList.contains("open")&&t._summaryRowDialog.confirm(),t._dragSelectionEnd(e),t._endResize(e),t._endDrag(e)}}_nextColumn(e){const t=this;for(let o=0;o<t.viewColumns.length;o++){const l=t.viewColumns[o];if(l.visibleIndex===e.visibleIndex+1)return l}return null}_nextRow(e){const t=this._recyclingRows,o=t.indexOf(e);return o>=0?t[o+1]:null}_moveHandler(e){const t=this;if(t.isInitialized&&t._selection){if(t.selection.enabled&&t.selection.allowDragSelection&&!t.editing.isEditing&&(!t._selection.selectionRect||t._selection.selectionRect&&!t._selection.selectionRect.captured)&&(!0!==t._mobile&&t._dragSelection(e),e.originalEvent)){const o=e.originalEvent.target.closest?e.originalEvent.target:void 0;Smart.Utilities.Core.isMobile&&o&&o.closest("smart-grid")===t&&(e.originalEvent.preventDefault(),e.originalEvent.stopPropagation())}t.isScrolling||("none"===t.behavior.columnResizeMode||t.classList.contains("smart-grid-row-resize-mode")||t._columnMoveResizeHandler(e),"none"===t.behavior.rowResizeMode||t.classList.contains("smart-grid-column-resize-mode")||t._rowMoveResizeHandler(e),t._drag(e))}}_hideActionButtons(){const e=this;if(e._columnElements){for(let t=0;t<e._columnElements.length;t++){const o=e._columnElements[t],l=o.column;l&&l.autoShowActionButton&&o&&o._hideActionButton()}for(let t=0;t<e._frozenNearColumns.length;t++){const o=e._frozenNearColumns[t],l=o.element;o&&o.autoShowActionButton&&l&&l._hideActionButton()}}}_columnMouseLeaveHandler(){this._mobile||this._hideActionButtons()}_columnMoveHandler(e){const t=this;if(!t.isInitialized)return;if(t._columnResizeStartLine||t._rowResizeStartLine)return;if(t._mobile)return;const o=(o,l)=>{if(o&&o.autoShowActionButton){const a=l.getBoundingClientRect(),n=t.offset(l),i=t.parentElement,r=i?i.scrollTop:0,s=i?i.scrollLeft:0;if(n.left-s<=e.pageX&&n.left-s+a.width-10>=e.pageX)if(n.top-r<=e.pageY&&n.top-r+a.height>=e.pageY){if(!t.hasColumnMenu(o))return;l._showActionButton()}else l._hideActionButton();else l._hideActionButton()}};for(let e=0;e<t._columnElements.length;e++){const l=t._columnElements[e];o(l.column,l)}for(let e=0;e<t._frozenNearColumns.length;e++){const l=t._frozenNearColumns[e];o(l,l.element)}}_headerClickHandler(e){const t=this;if(t.$.headerBar){const o=t.isInShadowDOM||t.shadowRoot?e.composedPath()[0]:e.target;t.$.headerBar._headerClickHandler(o,t)}}_columnClickHandler(e){const t=this;if(t._overlay)return;if(void 0===e.clientX)return;const o=(t.enableShadowDOM?t.shadowRoot:t.getRootNode()).elementsFromPoint(e.clientX,e.clientY);let l=null,a=null;const n=new Date-t._columnClickTime<t.behavior.doubleClickTimingDelay;t._columnClickTime=new Date;for(let e=0;e<o.length;e++){const t=o[e];if(t.classList.contains("smart-action-button"))return;if(t.getAttribute("data-field")){l=t.getAttribute("data-field"),a=t;break}}if(l){const o=a.column;if(!o)return;if(e.srcElement.classList.contains("smart-filter-button"))return;if("_addNewColumn"===o.dataField)return void t._openAddColumnDialog();if(Smart.Utilities.Core.isMobile)n&&t.sorting.sortToggleOnClick&&o.allowSortToggleOnClick&&t.sorting.enabled&&(t.sortBy(l),t.autoSaveState()),t._columnMoveHandler(e),e.originalEvent&&e.originalEvent.preventDefault();else if(!n&&t.sorting.sortToggleOnClick&&o.allowSortToggleOnClick&&t.sorting.enabled){if("none"!==t.behavior.columnResizeMode&&"col-resize"===o.element.style.cursor)return;if(t._canSort=!0,""!==t.sorting.commandKey){if("Alt"===t.sorting.commandKey&&!1===e.altKey&&(t._canSort=!1),"Shift"===t.sorting.commandKey&&!1===e.shiftKey&&(t._canSort=!1),"Control"===t.sorting.commandKey&&!1===e.metaKey&&!1===e.ctrlKey&&(t._canSort=!1),"Control"!==t.sorting.commandKey&&e.ctrlKey)return;if(!0===t.sorting.sortToggleOnClickAndCommandKey&&!t._canSort)return}t.sortBy(l),t.autoSaveState()}}}_columnDownHandler(e){const t=this,o=(t.enableShadowDOM?t.shadowRoot:t.getRootNode()).elementsFromPoint(e.clientX,e.clientY);let l=null,a=null;const n=new Date-t._clickTime<t.behavior.doubleClickTimingDelay;t.$.headerBar&&t.$.headerBar.closePanel(),t._doubleClickHandler(e);for(let e=0;e<o.length;e++){const t=o[e];if(t.classList.contains("smart-action-button"))return;if(t.getAttribute("data-field")){l=t.getAttribute("data-field"),a=t;break}}if(l){const o=a.column;if(!o)return;if("_commandColumn"===l)return void(t.editing.commandColumn.dataSource.commandColumnMenu.visible&&t._applyCommand(t.editing.commandColumn.dataSource.commandColumnMenu.command));const i=function(a){const n=o.selectionColumn?t.selection.checkBoxes.action===a&&t.selection.enabled:t.selection.action===a&&t.selection.enabled;if("col-resize"!==o.element.style.cursor&&(!t.appearance.showColumnHeaderDragIcon||!e.originalEvent.target.classList.contains("smart-drag-handle"))&&n){if(t.editing.enabled&&t.editing.editColumn===o)return;if(e.shiftKey||e.ctrlKey||e.metaKey?t._dragSelectionStartDataField=null:t._dragSelectionStartDataField=l,"_checkBoxColumn"===l)return void t._toggleColumnSelection(o);"_rowHeaderColumn"===l&&t.selection.enabled&&t.selection.allowRowHeaderSelection&&t.appearance.showRowHeaderSelectIcon&&(delete t._areAllRowsSelected,t.areAllRowsSelected()?t.clearSelection():t.selectAllRows(),o.refresh()),t.selection.allowColumnHeaderSelection&&o.allowSelect&&t._setSelection(null,o.dataField,e)}};if(t.editing.isEditing&&t.endEdit(),i("click"),t._mobile){t._hideActionButtons();const o=(o,l)=>{if(o&&o.autoShowActionButton){const a=l.getBoundingClientRect(),n=t.offset(l);if(n.left<=e.pageX&&n.left+a.width-6>=e.pageX){if(!t.hasColumnMenu(o))return;l._showActionButton()}else l._hideActionButton()}};for(let e=0;e<t._columnElements.length;e++){const l=t._columnElements[e];o(l.column,l)}}if(t.$.fireEvent("columnClick",{column:o,dataField:o.dataField,originalEvent:e.originalEvent}),n&&(t.$.fireEvent("columnDoubleClick",{column:o,dataField:o.dataField,originalEvent:e.originalEvent}),i("doubleClick"),t._onColumnDoubleClick(o,e)),Smart.Utilities.Core.isMobile){const o=t.rightToLeft?a.getBoundingClientRect().left:a.getBoundingClientRect().right,n=10;if(o-n<=e.clientX&&e.clientX<=o+n){const o=t.columnByDataField[l];if(!o||o&&!o.allowResize)return;const n=t._isLastVisibleColumn(o);if("split"===t.behavior.columnResizeMode&&n)return;a.style.cursor="col-resize",a.sortButton.style.cursor="col-resize",a.filterButton.style.cursor="col-resize",t._columnToResizeRect=t.getBoundingRect(a),t._columnToResizeElement=a,t._columnToResizeDataField=l,e.preventDefault(),e.originalEvent&&e.originalEvent.preventDefault()}}if(t._columnToResizeElement&&!t._columnResizeLine)return t._columnDownResizeHandler(e),void(t._clickTime=new Date);if(t._beginDrag(e,o),o.menu)return void(t._clickTime=new Date)}t.closeMenu(),t._clickTime=new Date}addTransformMoveStyle(e,t,o,l,a,n){e.style.opacity=n,e.style["transition-duration"]=t,e.style.transform="translate3d("+o+"px,"+l+"px,"+a+"px)"}removeTransformMoveStyle(e){e.style.opacity="",e.style["transition-duration"]="",e.style.transform=""}_rowDownHandler(e){const t=this;if(t._inputOverlay&&t._inputOverlay.classList.remove("smart-input-overlay-on"),t._doubleClickHandler(e),t._closeMenu(t.menu),t._rowResizeHandler(e),t._removeCellContentPopup(),t._toggledRow&&t.appearance.allowRowToggleAnimation)return;if(e.target&&!e.target.classList.contains("smart-grid-row-container")&&!e.target.classList.contains("smart-grid-selection-overlay")&&!e.target.classList.contains("smart-selection-overlay-content"))return;let o=e.clientX,l=e.clientY;e.touches&&(o=e.touches[0].clientX,l=e.touches[0].clientY);const a=(t.enableShadowDOM?t.shadowRoot:t.getRootNode()).elementsFromPoint(o,l);let n=null,i=null,r=null,s=null,d=null,c=null,u=null,m=null;t._lastPointerDownTime=new Date;for(let p=0;p<a.length;p++){const g=a[p];if(g.hasAttribute("toggle-button")&&(i=g),g.hasAttribute("add-row")&&(d=g),g.hasAttribute("checkbox")&&(r=g),"A"===g.nodeName&&e.ctrlKey&&g.click(),g.hasAttribute("rating-value")&&(c=g),g.hasAttribute("vote-value")&&(u=g),!s&&"smart-grid-cell"===g.nodeName.toLowerCase()&&!g.classList.contains("smart-grid-filter-row-cell")){if(s=g,g.hasAttribute("data-type")&&"string"===g.getAttribute("data-type")&&t.editing.enabled&&s.cell.column.allowEdit&&!s.cell.column.autoGenerated){const l=g.getAttribute("data-field"),a=g.closest("smart-grid-row").getAttribute("data-id"),n=g.getBoundingClientRect(),i=t.columnByDataField[l];if(o>=n.right-20&&("tags"===i.template||"list"===i.template||"dropdownlist"===i.template||"combobox"===i.template))return t._setSelection(a,l,e),t.beginEdit(a,l),e.stopPropagation(),void e.preventDefault()}if(g.hasAttribute("data-type")&&"date"===g.getAttribute("data-type")&&t.editing.enabled&&s.cell.column.allowEdit){const l=g.getAttribute("data-field"),a=g.closest("smart-grid-row").getAttribute("data-id");if(o>=g.getBoundingClientRect().right-20)return t._setSelection(a,l,e),t.beginEdit(a,l),e.stopPropagation(),void e.preventDefault()}if(g.hasAttribute("data-type")&&"number"===g.getAttribute("data-type")&&t.editing.enabled&&s.cell.column.allowEdit){const a=g.getAttribute("data-field"),n=g.closest("smart-grid-row").getAttribute("data-id"),i=g.getBoundingClientRect();if(o>=i.right-20){const o=()=>{let e=t.getCellValue(n,a);null!=e&&""!==e||(e=0);const o=e;let r=1;const s=t.columnByDataField[a];s&&s.formatSettings&&s.formatSettings.Intl&&("percent"===s.formatSettings.Intl.NumberFormat.style&&(r=.01),"currency"===s.formatSettings.Intl.NumberFormat.style&&void 0===s.formatSettings.Intl.NumberFormat.minimumFractionDigits&&(r=.01),s.formatSettings.Intl.NumberFormat.minimumFractionDigits>0&&(r=.01)),l>=i.top&&l<=i.bottom-i.height/2?e+=r:e-=r,s.editor&&(e>s.editor.max&&(e=s.editor.max),e<s.editor.min&&(e=s.editor.min)),t.setCellValue(n,a,e);const d=t.rowById[n].getCell(a);t.onCellUpdate&&t.onCellUpdate([d],[o],[e],(function(){t.onCellUpdated&&t.onCellUpdated([d.row.index],[d.row],[d.column],[d.row.data],[o],[e],t),t._onCellUpdated&&t._onCellUpdated(d.row.index,d.row,d.column,d.row.data,o,e)}),t)};return o(),clearTimeout(t._spinTimeout),t._spinTimeout=setTimeout((()=>{clearTimeout(t._spinTimeout),t._spinInterval=setInterval((()=>{t._spinInterval&&o()}),50)}),150),e.stopPropagation(),void e.preventDefault()}}}if(!m&&g.classList.contains("smart-card")&&(m=g),!n&&"smart-grid-row"===g.nodeName.toLowerCase()){n=g;break}}if("card"===t.view){if(m){const o=m.getAttribute("row-id"),l=t.rowById[o];if(l){const a=e.originalEvent?e.originalEvent:e,n=3===a.which;if(l.element||l.createElement(),t.$.fireEvent("rowClick",{row:l,id:l.id,data:t.getRowData(l.id),isRightClick:n,originalEvent:a,pageX:parseInt(a.pageX),pageY:parseInt(a.pageY)}),s){const e=s.getAttribute("data-field");if(e){const o=t.columnByDataField[e],i=new Smart.Grid.Cell(l,o,this);s.cell=i,i.element=s,i&&t.$.fireEvent("cellClick",{cell:i,id:l.id,dataField:i.column.dataField,value:i.value,isRightClick:n,originalEvent:a,pageX:parseInt(a.pageX),pageY:parseInt(a.pageY)})}}const i=e.originalEvent.target;if(m.classList.contains("smart-card-header"))l.element&&l.element.row!==l&&(l.element.row=l),l.toggle();else if(l.children&&l.children.length>0&&(i.classList.contains("smart-icon-ungroup")||i.classList.contains("smart-icon-group")))l.element&&l.element.row!==l&&(l.element.row=l),l.toggle();else if(t.editing.enabled){const l=t.editing.dialog.enabled,a=t.editing.mode;if(i.scrollHeight>i.offsetHeight){const o=t.offset(i);if(e.originalEvent.pageX>=o.left+i.offsetWidth-15)return}const n=t.context;t.context=t,t.editing.dialog.enabled=!0,t.editing.mode="row",t._settingsDialogRowId=o;let r=t._isUpdating;m.setAttribute("edit",""),t.beginEdit(o),t._isUpdating=r,t._endCardRowEdit?(t.removeEventListener("endEdit",t._endCardRowEdit,null),t.removeEventListener("cancelEdit",t._endCardRowEdit,null)):t._endCardRowEdit=()=>{t.context=t,t.editing.dialog.enabled=l,t.editing.mode=a,t.editing.isEditing=!1,t.context=n,delete t._settingsDialogRowId,delete t._dialogEdit},t.addEventListener("endEdit",t._endCardRowEdit),t.addEventListener("cancelEdit",t._endCardRowEdit)}}}return}c&&(t._ratingElement=c),u&&(t._voteElement=u);const p=!!e.originalEvent&&3===e.originalEvent.which;if(n&&s){const o=s?s.cell:null;if(o.row.filterRow||t._closeMenu(t.filterRowMenu),i&&o&&!o.column.rowDetailColumn&&i!==o.row.toggleDetailButton&&!i.classList.contains("row-detail"))n.row.toggle(e);else if(t.rowDetail.enabled&&t.rowDetail.visible&&i&&o&&o.column.rowDetailColumn&&!p){const e=n.row;if(t._overlay||e.header&&"row-resize"===e.header.style.cursor||e.header&&"row-resize"===e.header.parentElement.style.cursor)return;t.editing.isEditing&&t.cancelEdit(),e.showDetail?t.hideDetail(e.id):t.showDetail(e.id)}else if(d){const e=n.row,o=e.data;let l=o.parent;const a={};for(a[o.groupDataField]=null!==e.label?e.label:null,void 0!==e.labelValue&&(a[o.groupDataField]=e.labelValue);l;){let e=null!==l.label?l.label:null;l.labelValue&&void 0!==e&&(e=l.labelValue),a[l.groupDataField]=e,l=l.parent}t.addRow(a),setTimeout((()=>{t._conditionalColors&&t._conditionalColors.update&&t._conditionalColors.update()}),100)}else{const o=n.row,l=s?s.cell:null;if(l.column._treeColumn&&r)return void(o.checked=!o.checked);l.element===o.header&&t.behavior.allowRowReorder&&t._beginDrag(e,o),t._tapTimer&&clearTimeout(t._tapTimer),t._tapTimer=setTimeout((function(){t._clickedRow===n&&t.$.fireEvent("rowTap",{row:o,id:o.id,originalEvent:e.originalEvent}),t._clickedCell===s&&t.$.fireEvent("cellTap",{cell:l,id:o.id,dataField:l.column.dataField,originalEvent:e.originalEvent})}),t.behavior.doubleClickTimingDelay);const a=function(a){if(!t.selection.enabled||o.autoGenerated||!0!==o.allowSelect)return void delete t.__selectionStarted;if(t._overlay||o.header&&"row-resize"===o.header.style.cursor||o.header&&"row-resize"===o.header.parentElement.style.cursor)return;if(o.header&&"row-resize"===o.header.style.cursor){const a=t.offset(o.header);if(t._rowToResize&&a.left<=e.originalEvent.pageX&&e.originalEvent.pageX<=a.left+o.header.offsetWidth)return o.header.style.cursor="",void(t._rowToResize.onpointerup=()=>{const a=t.editing.isEditing;t._rowToResize&&(t._rowToResize.onpointerup=null),t._clickedRow===n&&!a&&!t._rowResizeLine&&l.column.rowHeaderColumn&&t.selection.allowRowHeaderSelection&&t._setSelection(o.id,l.column.dataField,e)});o.header.style.cursor=""}const i=t.editing.isEditing;if(i&&t.editing.editCell&&t.editing.editCell.row.id===o.id&&t.editing.editCell.column.dataField===l.column.dataField)return;if(i&&t.editing.editRow&&t.editing.editRow.id===o.id)return;const r=()=>{t.focus(),setTimeout((function(){t.focus()}),50)};if(t.selection.action===a){if(e.shiftKey||e.ctrlKey||e.metaKey||!t.selection.allowRowHeaderSelection&&l.column.autoGenerated?t._dragSelectionStartRow=null:t._dragSelectionStartRow=n.row,e.shiftKey||e.ctrlKey||e.metaKey?t._dragSelectionStartDataField=null:t._dragSelectionStartDataField=l.column.dataField,l.column.rowHeaderColumn&&!t.selection.allowRowHeaderSelection)return t._dragSelectionStartRow=null,void r();t._setSelection(o.id,l.column.dataField,e),r()}else(l.column.selectionColumn&&t.selection.checkBoxes.enabled&&t.selection.checkBoxes.action===a||l.column.rowHeaderColumn&&t.selection.allowRowHeaderSelection)&&(t._setSelection(o.id,l.column.dataField,e),r())},i=l.selected;t._clickTime||(t._clickTime=new Date);const d=t._clickedCell===s&&new Date-t._clickTime<t.behavior.doubleClickTimingDelay,c=e.originalEvent?e.originalEvent:e,u=3===c.which;if(u||"_commandColumn"===l.column.dataField||a("click"),t.$.fireEvent("rowClick",{row:o,id:o.id,data:t.getRowData(o.id),isRightClick:u,originalEvent:c,pageX:parseInt(c.pageX),pageY:parseInt(c.pageY)}),t.$.fireEvent("cellClick",{cell:l,id:o.id,dataField:l.column.dataField,value:l.value,isRightClick:u,originalEvent:c,pageX:parseInt(c.pageX),pageY:parseInt(c.pageY)}),u&&t.contextMenu.enabled){t.contextMenu.id=o.id,t.contextMenu.dataField=l.column.dataField;const e=t.getSelectedCells();let a=!0;if(t.contextMenu.dataField&&!t.contextMenu.dataField.startsWith("_"))if(e.length){for(let t=0;t<e.length;t++){const n=e[t],i=n[0],r=n[1];if(""+i==""+o.id&&l.column.dataField===r){a=!1;break}}t._focusCell(o.id,l.column.dataField,a),a&&t._selectCellsRange(o,o,l.column.dataField,l.column.dataField)}else{const e=t.getSelectedRowIds();(0===e.length||e.length>1)&&(t._focusCell(o.id,l.column.dataField),t._selectCellsRange(o,o,l.column.dataField,l.column.dataField))}else t._copyRects&&t._copyRects.length&&t.clearSelection(),t.selectRow(o.id);return t.openContextMenu(c.pageX+10,c.pageY+10),void(t.contextMenu.selector&&(c.stopPropagation(),c.preventDefault()))}if(o.autoGenerated||l.column.autoGenerated||"checkBox"===l.template&&e.originalEvent&&e.originalEvent.target&&e.originalEvent.target.classList.contains("smart-input"))t._onRowClick(o.index,o,e),t._onCellClick(l,e);else if(t.selection.enabled)if(t.selection.allowCellSelection)if("extended"===t.selection.mode){if(!0===i&&i===l.selected&&!t.selection.isDragging){const a=t._selection.focusedCell;a&&t._clickedCell&&a.id===l.row.id&&a.dataField===l.column.dataField&&a.id===t._clickedCell.cell.row.id&&a.dataField===t._clickedCell.cell.column.dataField&&(t._onRowClick(o.index,o,e),t._onCellClick(l,e))}}else d||(t._onRowClick(o.index,o,e),t._onCellClick(l,e));else if(t.selection.allowRowSelection)if("extended"===t.selection.mode){if(!0===i&&i===l.selected&&!t.selection.isDragging){const a=t._selection.focusedCell;t._clickedCell&&a.id===l.row.id&&a.id===t._clickedCell.cell.row.id&&(t._onRowClick(o.index,o,e),t._onCellClick(l,e))}}else d||(t._onRowClick(o.index,o,e),t._onCellClick(l,e));else t._onRowClick(o.index,o,e),t._onCellClick(l,e);else t._onRowClick(o.index,o,e),t._onCellClick(l,e);new Date-t._clickTime<t.behavior.doubleClickTimingDelay&&(t._clickedRow===n&&(t._onRowDoubleClick(o.index,o,e,e),t.$.fireEvent("rowDoubleClick",{row:o,id:o.id,data:t.getRowData(o.id),isRightClick:u,originalEvent:e.originalEvent,pageX:parseInt(c.pageX),pageY:parseInt(c.pageY)}),a("doubleClick")),t._clickedCell===s&&(t._onCellDoubleClick(l,e),t.$.fireEvent("cellDoubleClick",{cell:l,id:o.id,dataField:l.column.dataField,value:l.value,isRightClick:u,originalEvent:e.originalEvent,pageX:parseInt(c.pageX),pageY:parseInt(c.pageY)}))),t._clickedRow=n,t._clickedCell=s,t._clickTime=new Date,t.layout.allowCellsWrapShortcut&&t._clickedCell.hasAttribute("focus")&&t._clickedCell.hasAttribute("selected")&&e.shiftKey&&(t._cellContentPopupTimer&&clearTimeout(t._cellContentPopupTimer),t.selection.isDragging?t._removeCellContentPopup():l.autoWrap())}}}showDetail(e){const t=this.rowById[e];t&&(t.showDetail=!0)}hideDetail(e){const t=this.rowById[e];t&&(t.showDetail=!1)}_focusHandler(){this._focused=!0,this.setAttribute("focus","")}_blurHandler(){this._focused=!1,this.removeAttribute("focus")}_notify(e,t,o){const l=this;if(l.notifyFn)for(let a=0;a<l.notifyFn.length;a++)l.notifyFn[a](e,t,o)}notify(e){const t=this;e&&(t.notifyFn||(t.notifyFn=[]),t.notifyFn.push(e))}_applyTemplate(e,t){let o=null;if(null!==e&&""!==e)if(e&&"function"==typeof e)e(t);else if((e.startsWith("#")||e.startsWith("."))&&(o=document.querySelector(e)),o)t.innerHTML="",o instanceof HTMLElement&&!(o instanceof HTMLTemplateElement)?t.appendChild(o):t.appendChild(o.content.cloneNode(!0).firstElementChild);else{const o=function(e){const t=document.createElement("template");return e=e.trim(),t.innerHTML=e,t.content.firstChild}(e);o&&(t.innerHTML="",t.appendChild(o))}else t.innerHTML=""}refreshRelations(){const e=this;if(e.dataSourceSettings&&e.dataSourceSettings.relations&&e.dataSourceSettings.relations.length){for(let t=0;t<e.columns.length;t++){const o=e.columns[t];"dropdownGrid"===o.template&&(o._isDirty=!0)}e._recycle(!1);for(let t=0;t<e.columns.length;t++){const o=e.columns[t];"dropdownGrid"===o.template&&delete o._isDirty}}}propertyChangedHandler(e,t,o){const l=this;if(l.isInitialized){if("object"==typeof e)return o&&o.columns&&(l.__measuredColumnHeight=null),void l.render();switch(l._notify(e,t,o),e){case"dataSourceSettings_relations":return void l.refreshRelations();case"dataSourceSettings_transpose":return void l.render();case"onRowHistory":case"onRowInserted":case"stateSettings_current":return;case"highlighted":"kanban"===l.view&&l._kanban?(l._kanban.selectTask(o),l._kanban.ensureVisible(o)):"scheduler"===l.view&&l._scheduler&&l._scheduler.focusEvent(o);break;case"view":return void(l.$.headerBar&&l.$.headerBar._setView&&l.$.headerBar._setView(o,!0));case"users":case"currentUser":l._refreshCurrentUser(),l._recycle();break;case"summaryRow_visible":{for(let e=0;e<l.columns.length;e++)l._summaryRowCount=Math.max(l._summaryRowCount,l.columns[e].summary.length);const e=l.onRowInserted;l.onRowInserted=null,l._renderRows(!0),l.onRowInserted=e;break}case"conditionalFormatting":return l._renderConditionalFormatting(),void l.refresh();case"appearance_displayLoadingIndicator":return l._setLoadingIndicatorVisibility(),void l._recycle(!1);case"appearance_placeholder":return void(l.$.placeholder.innerHTML=o);case"appearance_showColumnHeaderLines":case"appearance_showColumnGroupLines":case"appearance_showColumnLines":case"appearance_showRowLines":return void l._recycle();case"appearance_allowColumnStickyPosition":o?l._stickHeader():l._unstickHeader();break;case"appearance_showColumnIcon":for(let e=0;e<l.columns.length;e++)l.columns[e].setProperty("showIcon",l.appearance.showColumnIcon);l._recycle();break;case"appearance_showRowHeaderNumber":case"appearance_showRowHeader":{l._initializeRowNumberColumn();const e=l._frozenNearColumns[0];e.rowHeaderColumn&&e.element&&!e.element.parentNode&&l.$.columnNearContainer.appendChild(e.element),l.refresh();break}case"header_visible":if(l.header.visible&&""===l.header.template){let e=l.$.header;l.header.appendTo&&(e=document.querySelector(l.header.appendTo),e?e.onclick=e=>{l._headerClickHandler(e)}:e=l.$.header),e.innerHTML='<smart-grid-toolbar header-position="top"></smart-grid-toolbar>',l.$.headerBar=e.firstElementChild,l.$.headerBar._init(l),l.header.onInit&&l.header.onInit(l.$.headerBar)}break;case"header_buttons":l.header.visible&&""===l.header.template&&l._refreshHeaderBar();break;case"header_template":l._applyTemplate(o,l.$.header);break;case"footer_template":l._applyTemplate(o,l.$.footer);break;case"layout_columnWidth":case"columnWidth":{l.columns.canNotify=!1;let e=parseInt(o);if(isNaN(e)&&(e=null),e>=30||null===e)for(let t=0;t<l.columns.length;t++)l.columns[t].width=e;l.columns.canNotify=!0,l.refresh();break}case"checkBoxes_visible":return void l._recycle();case"checkBoxes_hasThreeStates":return l.rows.canNotify=!1,l._applyThreeStates(l.rowHierarchy),l.rows.canNotify=!0,void l._recycle();case"columnHeader_visible":l.__columnHeaderHeight=null,l.refresh();break;case"selection_checkBoxes_enabled":l._selectionColumn.visible=o;break;case"selection_checkBoxes_autoShow":l._selectionColumn.element&&(o?l._selectionColumn.element.setAttribute("auto-show",""):l._selectionColumn.element.removeAttribute("auto-show"));break;case"selection_checkBoxes_position":{let e=l.viewColumns.indexOf(l._selectionColumn);l.viewColumns.canNotify=!1,l.viewColumns.splice(e,1);const t=l._frozenNearColumns.indexOf(l._selectionColumn),a=l._frozenFarColumns.indexOf(l._selectionColumn);if(t>=0&&l._frozenNearColumns.splice(t,1),a>=0&&l._frozenFarColumns.splice(a,1),"far"===o)l._selectionColumn.canNotify=!1,l._selectionColumn.freeze="far",l._selectionColumn.canNotify=!0,l._frozenFarColumns.splice(0,0,l._selectionColumn),l.viewColumns.push(l._selectionColumn),l.$.columnFarContainer.appendChild(l._selectionColumn.element);else{let e=0,t=0;for(let o=0;o<l.viewColumns.length&&(l.viewColumns[o].autoGenerated||l.viewColumns[o].dataField!==l.columns[t++].dataField);o++)l.viewColumns[o].autoGenerated&&e++;l._selectionColumn.canNotify=!1,l._selectionColumn.freeze="near",l._selectionColumn.canNotify=!0,l._frozenNearColumns.splice(e,0,l._selectionColumn),l.viewColumns.splice(e,0,l._selectionColumn),l.$.columnNearContainer.appendChild(l._selectionColumn.element)}l.viewColumns.canNotify=!0;break}case"selection_mode":if(l._selection&&(l._selection.focusedCell=null),l.selection.allowCellSelection)l.clearSelection();else if("one"===o){const e=l.getSelection();if(l.clearSelection(),e.rows&&e.rows[0]){e.rows[0].row.selected=!0;const t=l.rowById[e.rows[0].row.id].getCell(l.columns[0].dataField);l._selection&&(l._selection.focusedCell={id:t.row.id,dataField:t.column.dataField,value:t.value,index:t.row.index})}}break;case"grouping_groupBy":return l.dataSource&&l.dataSource.groupBy&&(l.dataSource.groupBy=o),void l.refresh();case"sorting_enabled":return void l.refresh();case"sorting_maintainSort":return void l._recycle(!1);case"filtering_enabled":return o&&0===l._filterPanels.length&&l._createFilterPanels(),void(l.header.visible&&l.refresh());case"filtering_filterRow_visible":return l._initializeRows(),l._initializeRowElements(),void l.refresh();case"filtering_operator":return void l.refreshFilters();case"filtering_filter":for(let e=0;e<l.columns.length;e++){const t=l.columns[e];t.canNotify=!1,t.setProperty("filter",null),t.canNotify=!0}for(let e=0;e<l.filtering.filter.length;e++){const t=l.filtering.filter[e];if(t&&t.splice){const e=t[0],o=t.splice(1);let a=null;if(o instanceof Smart.FilterGroup)a=o;else{const t=l.columnByDataField[e];t&&(a=l.dataSource._createFilter(t.dataType,o))}a&&l.addFilter(e,a,!1)}}return void l.refreshFilters();case"messages":case"locale":{if(l.columns)for(let e=0;e<l.columns.length;e++)l.columns[e]._cellsCachedValues=[];l._dialogEdit&&(l._dialogEdit.close(),l._dialogEdit=null),l._dialogDelete&&(l._dialogDelete.close(),l._dialogDelete=null),l._dialogAddRow&&(l._dialogAddRow.close(),l._dialogAddRow=null);const e=l.$.headerPager.querySelector("smart-pager"),t=l.$.footerPager.querySelector("smart-pager");e&&(e.locale=l.locale),t&&(t.locale=l.locale);const o=(e,t)=>{l._handleFilterMenuClick(e,t)};l._filterInfo||(l._filterInfo={}),l._filterInfo.stringConditions=[{icon:"smart-icon-contains",command:o,value:"CONTAINS",label:l.localize("CONTAINS")},{icon:"smart-icon-does-not-contain",command:o,value:"DOES_NOT_CONTAIN",label:l.localize("DOES_NOT_CONTAIN")},{icon:"smart-icon-starts-with",command:o,value:"STARTS_WITH",label:l.localize("STARTS_WITH")},{icon:"smart-icon-ends-with",command:o,value:"ENDS_WITH",label:l.localize("ENDS_WITH")},{icon:"smart-icon-equals",command:o,value:"EQUAL",label:l.localize("EQUAL")},{icon:"smart-icon-delete",command:o,value:"CLEAR_FILTER",label:l.localize("CLEAR_FILTER")}],l._filterInfo.numberAndDateConditions=[{icon:"smart-icon-equals",command:o,value:"EQUAL",label:l.localize("EQUAL")},{icon:"smart-icon-not-equal",command:o,value:"NOT_EQUAL",label:l.localize("NOT_EQUAL")},{icon:"smart-icon-less-than",command:o,value:"LESS_THAN",label:l.localize("LESS_THAN")},{icon:"smart-icon-less-than-equal",command:o,value:"LESS_THAN_OR_EQUAL",label:l.localize("LESS_THAN_OR_EQUAL")},{icon:"smart-icon-greater-than",command:o,value:"GREATER_THAN",label:l.localize("GREATER_THAN")},{icon:"smart-icon-greater-than-equal",command:o,value:"GREATER_THAN_OR_EQUAL",label:l.localize("GREATER_THAN_OR_EQUAL")},{icon:"smart-icon-between",command:o,value:"RANGE",label:l.localize("RANGE")},{icon:"smart-icon-delete",command:o,value:"CLEAR_FILTER",label:l.localize("CLEAR_FILTER")}],l._refreshHeaderBar(),l.$.headerBar&&(l.$.headerBar.messages=l.messages,l.$.headerBar.locale=l.locale,l.$.headerBar._localizeHeader(),l.$.headerBar._getInnerElementMessages()),l.grouping.groupBar.visible&&l._renderGroupBar(),l._recycle();break}case"paging_spinner_enabled":l._refresh();break;case"pager_visible":return l._renderPagers(),void l._refreshPaging(!1);case"paging_pageIndex":case"pager_position":case"paging_enabled":return void l._refreshPaging(!0);case"paging_pageSize":return void l._refreshPaging(!1);case"columns":{l.__measuredColumnHeight=null,l.editing&&l.editing.isEditing&&l.cancelEdit(),l._cellEditors=[];let e=!1;if(t&&t.length)for(let o=0;o<t.length;o++)if(t[o].freeze){e=!0;break}if(l.columns&&l.columns.length)for(let t=0;t<l.columns.length;t++)if(l.columns[t].freeze){e=!0;break}if(e&&l._initializeRowElements(),l.columns&&l._sortedColumns){const e=[];l.columns.forEach((t=>{t.sortOrder&&e.push(t)})),l._sortedColumns=JSON.parse(JSON.stringify(e))}l._renderColumns(),l._refreshHeaderBar();const o=l._sortedColumns;if(o){l.clearSort();for(let e=0;e<l.columns.length;e++)delete l.columns[e]._cellsCachedValues;l._refreshSort(o)}if(l.columns&&l.filtering.enabled){l.beginUpdate();for(let e=0;e<l.columns.length;e++){const t=l.columns[e];if(t.canNotify=!1,l.removeFilter(t.dataField),t.filtered=!1,t.canNotify=!0,t.filter){let e=null,o=t.filter;e=o instanceof Smart.FilterGroup?o:l.dataSource._createFilter(t.dataType||"string",o),e&&l.addFilter(t.dataField,e,!1)}}l.refreshFilters(),l.endUpdate()}return l.layout.isDirty=!0,l._resetCachedLayout(),void l._refreshLayout()}case"columnGroups":if(l._columnGroups=[],l._columnHeights=0,l.viewColumns)for(let e=0;e<l.viewColumns.length;e++){const t=l.viewColumns[e],o=t.element;t.top=0,t.level=0,o&&(o.style.top="",o.style.height="",o.style.lineHeight="")}return l.columns.canNotify=!1,l.columns=l._initColumns,l._renderColumns(),l.columns.canNotify=!0,l.__columnHeaderHeight=null,void l.refresh();case"dataSource":delete l._isFirstVirtualDataSourceRequest,l._isUpdating&&l.endUpdate();for(let e=0;e<l.columns.length;e++){const t=l.columns[e];t.editor&&(delete t.editor.isInitialized,delete t.editor.dataSource,delete t.editor._items,t.options&&(t.editor.dataSource=t.options),t.editor.isDirty=!0),t._cellsCachedValues=[],delete l._cellCachedValues,l._cellEditors=[]}if("dataSource"===e&&t&&o){const e=l.dataSource&&l.dataSource.virtualDataSource&&!l.dataSource.virtualDataSourceOnExpand&&"infinite"!==l.scrolling,a=e=>Array.isArray(e)&&e.every((e=>Array.isArray(e)));if(o&&a(o)){const e=[];for(let t=0;t<o.length;t++){const a={};for(let e=0;e<l.columns.length;e++){const n=l.columns[e];let i=o[t][e];if(n.options){const e=n.options.find((e=>e.label===i||e.value===i));e&&(i=e.value)}"date"===n.dataType&&null!==i&&(i=new Smart.Utilities.DateTime(i).toDate()),a[n.dataField]=i}e.push(a)}o=e}if(t instanceof Smart.DataAdapter&&!e){if(t.length===o.length&&t.length>0&&o.length>0&&!l.dataSourceSettings.childrenDataField&&!l.dataSourceSettings.parentDataField&&!t.parentDataField){if(l.dataSource=t,l._cachedDataSource===o)return;return setTimeout((()=>{let e=null;if(t&&l.dataSource&&l.dataSource._expandedRowIds){let t={};for(let e in l.dataSource._expandedRowIds){let o=""+e;o=o.replace("Item","").replace(/_/gi,"."),t[o]=!0}e=t}l.beginUpdate();const a=l._sortedColumns;l._sortedColumns&&l._sortedColumns.length>0&&void 0===l._getId()&&l.clearSort();for(let e=0;e<o.length;e++){const t=o[e],a=l.dataSource[e]?l.dataSource[e].$.id:e;l._updateRow(a,t,!0)}delete l.__autoRowHeight,l._virtualOnExpandCache=[],l._cellsMerge=[],l._cellStyles=[];const n=l._filters;if(l.clearSort(),l.filtering.filterRow)for(let e=0;e<l.columns.length;e++)l.columns[e]._filterEditorInitialized=!1;for(let e=0;e<l.columns.length;e++)delete l.columns[e]._cellsCachedValues;if(a&&l._refreshSort(a),n&&n.length>0&&(l._filters=null,l.refreshFilters()),l.grouping.enabled)for(let t in e)l._expandCollapseGroup(t,!0);l.endUpdate()})),l._cachedDataSource=o,void(l.header.visible&&""===l.header.template&&l.$.headerBar._init(l))}if(l.dataSource&&l.dataSource.url&&l.filtering.enabled&&l.filtering.filterRow.visible){let e=!1;for(let t=0;t<l.columns.length;t++)l.columns[t]._filterEditorInitialized&&(e=!0),l.columns[t]._filterEditorInitialized=!1;e&&setTimeout((()=>{l._refreshFilterRowEditors(),l.refreshFilters(),l._recycle(!1)}),100)}}}return l.dataSource&&l.dataSource.length>1e4?(l.appearance.displayLoadingIndicator=!0,l._setLoadingIndicatorVisibility(),setTimeout((()=>{l.dataBind()}),100),setTimeout((()=>{l.appearance.displayLoadingIndicator=!1,l._setLoadingIndicatorVisibility(),l._recycle(!1)}),200)):(l.dataSource&&l.dataSource instanceof Smart.DataAdapter&&l.columns&&l.dataSource.dataFields&&l.dataSource.dataFields.forEach((e=>{const t=l.columnByDataField[e.name];t&&(t.dataType=e.dataType)})),l.dataBind()),void(l.header.visible&&""===l.header.template&&l.$.headerBar._init(l));case"rowDetail_dialog_width":case"rowDetail_dialog_height":case"rowDetail_dialog_enabled":case"rowDetail_dialog_visible":return;case"rowDetail_height":case"rowDetail_enabled":{l.beginUpdate(),l.rows.canNotify=!1;const e=l.appearance.allowRowDetailToggleAnimation;l.appearance.allowRowDetailToggleAnimation=!1;for(let e=0;e<l._recyclingRows.length;e++){const t=l._recyclingRows[e];t.height=null,t.setProperty("showDetail",!1),t.detailHeight=l.rowDetail.height}if(l.rows.canNotify=!0,l.rowDetail.enabled){let t=!1;for(let e=0;e<l.viewColumns.length;e++)if(l.viewColumns[e].rowDetailColumn){t=!0;break}if(!t)return l.appearance.allowRowDetailToggleAnimation=e,l.endUpdate(),void l._renderColumns(!0)}else for(let e=0;e<l.viewColumns.length;e++){const t=l.viewColumns[e];if(t.rowDetailColumn){t.visible=!1;break}}return l.appearance.allowRowDetailToggleAnimation=e,void l.endUpdate()}case"rowDetail_visible":for(let e=0;e<l.viewColumns.length;e++){const t=l.viewColumns[e];if(t.rowDetailColumn){t.visible=o;break}}return;case"displayLoadingIndicator":return void l._setLoadingIndicatorVisibility();case"filterable":return void l._refreshLayout();case"layout_allowCellsWrap":{const e=l.columns.canNotify;l.columns.canNotify=!1;for(let e=0;e<l.columns.length;e++)l.columns[e].cellsWrap=o;return l.layout.isDirty=!0,l._resetCachedLayout(),l._refreshLayout(),l.refresh(),void(l.columns.canNotify=e)}case"showViewBar":return l.layout.isDirty=!0,l._resetCachedLayout(),l._refreshLayout(),void l.refresh();case"layout_autoHeight":case"layout_autoWidth":case"layout_columnMinHeight":case"layout_rowMinHeight":case"layout_columnHeight":case"layout_rowHeight":return l.layout.isDirty=!0,l._resetCachedLayout(),l._refreshLayout(),void l.refresh();case"rightToLeft":return void l.refresh();case"selectionMode":return;case"editing_addNewColumn_visible":l._addNewColumn?(l._addNewColumn.visible=o,l.refresh()):l._renderColumns();break;case"editing_addNewRow_displayMode":{"row"===l.editing.addNewRow.displayMode&&l.editing.addNewRow._addButton&&(l.editing.addNewRow._addButton.remove(),delete l.editing.addNewRow._addButton);const e=l._scrollView.vScrollBar;return e.style.height="",e.style.top="",e.style.setProperty("--smart-scroll-bar-near-size","0px"),l._renderAddNewRow(),void l.refresh(!0)}case"editing_addNewRow_label":case"editing_addNewRow_visible":case"editing_addNewRow_position":return!1===l.editing.addNewRow.visible&&"row"!==l.editing.addNewRow.displayMode&&(l.editing.addNewRow._addButton&&l.editing.addNewRow._addButton.remove(),l._newRow&&l._newRow.element.classList.add("smart-hidden")),l._renderAddNewRow(),void l.refresh();case"editing_enabled":o?l.$.content.removeAttribute("aria-readonly"):l.$.content.setAttribute("aria-readonly",!0);break;case"editing_dialog_visible":return;case"editing_commandBar_dataSource_commandBarAddRow_visible":case"editing_commandBar_dataSource_commandBarDeleteRow_visible":case"editing_commandBar_dataSource_commandBarBatchSave_visible":case"editing_commandBar_dataSource_commandBarBatchRevert_visible":case"editing_commandBar_visible":case"editing_commandBar_displayMode":case"editing_commandBar_position":l._renderCommandBar();break;case"editing_commandColumn_position":l._renderColumns(!0);break;case"editing_commandColumn_visible":return void l.refresh(!0);case"editing_commandColumn_inline":return l._commandColumn.visible=l.editing.commandColumn.visible&&!l.editing.commandColumn.inline,void l.refresh(!0);case"layout_isDirty":return;case"editing_commandColumn_dataSource_commandColumnCustom_label":case"editing_commandColumn_dataSource_commandColumnCustom_icon":case"editing_commandColumn_dataSource_commandColumnCustom_visible":case"editing_commandColumn_dataSource_commandColumnUpdate_label":case"editing_commandColumn_dataSource_commandColumnUpdate_icon":case"editing_commandColumn_dataSource_commandColumnUpdate_visible":case"editing_commandColumn_dataSource_commandColumnEdit_label":case"editing_commandColumn_dataSource_commandColumnEdit_icon":case"editing_commandColumn_dataSource_commandColumnEdit_visible":case"editing_commandColumn_dataSource_commandColumnDelete_label":case"editing_commandColumn_dataSource_commandColumnDelete_icon":case"editing_commandColumn_dataSource_commandColumnDelete_visible":case"editing_commandColumn_displayMode":return delete l.__cellsCommandTemplate,void l.refresh(!0)}l.refresh()}}ready(){const e=this;e.disableSwipeScroll=!0,super.ready(),e._renderInDropDown();const t=e._scrollView.vScrollBar,o=e._scrollView.hScrollBar;t.hasStyleObserver=!1,o.hasStyleObserver=!1,t.hasResizeObserver=!1,o.hasResizeObserver=!1,t.wait=!1,o.wait=!1,t.onChange=e._verticalScrollbarHandler.bind(e),o.onChange=e._horizontalScrollbarHandler.bind(e),e.setFocusable(!0),e.$.loadingIndicatorPlaceholder.innerHTML=e.messages[e.locale]&&e.messages[e.locale].loadingIndicatorPlaceholder?e.localize("loadingIndicatorPlaceholder"):e.appearance.loadingIndicatorPlaceholder,e.$.placeholder.innerHTML=e.messages[e.locale]&&e.messages[e.locale].placeholder?e.localize("placeholder"):e.appearance.placeholder,e._setLoadingIndicatorVisibility(),e._cellsMerge=[],e._cellStyles=[],e._details=[],e.checkLicense()}_createFilterPanels(){const e=this;if(e._filterPanels){if(e._filterPanels.length>0)return}else e._filterPanels=[];if(e.filtering.enabled&&0===e._filterPanels.length){if(e.header.visible&&e.header.buttons.indexOf("filter")>=0)return;requestAnimationFrame((()=>{const t=document.createElement("smart-filter-panel"),o=document.createElement("smart-filter-panel"),l=document.createElement("smart-filter-panel"),a=document.createElement("smart-filter-panel");o.filterType="boolean",l.filterType="numeric",a.filterType="date",e._filterPanels.bool=o,e._filterPanels.date=a,e._filterPanels.numeric=l,e._filterPanels.string=t;for(let t in e._filterPanels){const o=e._filterPanels[t];o.rightToLeft=e.rightToLeft,o.classList.add("smart-hidden"),e.$.content.appendChild(o),o.parentNode.removeChild(o)}}))}}_applyScrolling(){const e=this,t=e._scrollView.vScrollBar;requestAnimationFrame((()=>{switch(t.largeStep=e.$.scrollView.offsetHeight,e.scrolling){case"physical":case"infinite":case"virtual":t.step=e.layout.rowMinHeight,t.mechanicalAction="switchWhileDragging";break;case"deferred":t.step=10,t.mechanicalAction="switchWhenReleased";break;case"logical":t.step=e.layout.rowMinHeight,t.mechanicalAction="switchWhileDragging"}}))}_measureRowElement(e){const t=new Smart.Grid.Row({data:e,index:999999,grid:this});if(!t)return null;const o=t.createElement();return o.classList.add("smart-grid-measure-row"),this.$.scrollView.appendChild(o),o.style.height="",o.style.lineHeight="",o.style.height="",o.style.lineHeight="",t._isMeasureRow=!0,t.render(),o}get _autoRowHeight(){const e=this;if(e.__autoRowHeight)return e.__autoRowHeight;let t=e.layout.rowMinHeight;if(!e.dataSource||e.dataSource&&0===e.dataSource.length)return t;const o=new Smart.Grid.Row({index:0,grid:e}),l=o.createElement();e.$.scrollView.appendChild(l),e.removeAttribute("grouped"),e.removeAttribute("tree"),e.grouping.enabled&&e.dataSource.groupBy&&e.dataSource.groupBy.length>0?e.setAttribute("grouped",""):e.dataSource.boundHierarchy&&e.setAttribute("tree","");const a={};if(e.dataSource.dataFields)for(let t=0;t<e.dataSource.dataFields.length;t++)a[e.dataSource.dataFields[t].name]="ABCDEFHIJLMNOPQRSTUVWXYZ1234567910|";o.data=a,o._isMeasureRow=!0,o.render(),l.style.height="",l.style.lineHeight="",t=Math.max(l.offsetHeight,t);for(let e=0;e<l.children.length;e++)l.children[e].style.height="";for(let a=0;a<l.children[1].children.length;a++){if(l.children[1].children[a].style.height="auto",e.columns[0]){const t=o.getCell(e.columns[0].dataField);t&&t.render()}t=Math.max(t,8+l.children[1].children[a].offsetHeight);break}return e.$.scrollView.removeChild(l),e.__autoRowHeight=t,e.layout.rowMinHeight&&t<e.layout.rowMinHeight&&(e.__autoRowHeight=e.layout.rowMinHeight),t}get _scrollHeight(){const e=this,t="card"===e.view;let o=e._recyclingRows,l=0,a=e._autoRowHeight,n=0,i=0;if(e.__scrollHeight)return e.__scrollHeight;if(0===o.length||0===e.columns.length||!e.hasVisibleColumn())return 0;let r=40,s=1,d=0;if(t){for(let t=0;t<e.viewColumns.length;t++){const o=e.viewColumns[t];o.visible&&!o.autoGenerated&&(r+=e.layout.cardRowMinHeight,d++,o.cardHeight&&(r-=e.layout.cardRowMinHeight,r+=o.cardHeight*e.layout.cardRowMinHeight))}let t=e.offsetWidth;!e.appearance.showViewBar||e.appearance.viewBarAppendTo||e.appearance.showViewBarAsDropdown||(t-=e.layout.viewBarWidth+5),s=t<e.layout.cardMinWidth?1:"auto"===e.layout.cardsPerRow?Math.floor(t/e.layout.cardMinWidth):e.layout.cardsPerRow,1===s&&(r+=5*d),e._cardHeight=r}e._cardsPerRow=s,e.rows.canNotify=!1;const c=e._measureRowElement(o[0].data),u=o.length;for(let s=0;s<u;s++){let d=o[s];if(!d.visible||!1===d.filtered){d.height=0,d.cellHeight=0,d.top=l;continue}const u=e.rowDetail.enabled&&d.showDetail&&!e.rowDetail.dialog.enabled;let m=!d.height||!d.cellHeight||u||"auto"===d.height||"auto"===d._height||"auto"===e.layout.rowHeight||e.layout.isDirty;if(t&&d.height!==r&&(d.height=d.cellHeight=r),m&&!d.expandHeight){if(d.detailHeight||(d.detailHeight=200),t)d.height=d.cellHeight=r;else if(e.layout.rowHeight){if(e.layout.rowHeight)if("number"==typeof e.layout.rowHeight)e.layout.rowHeight<e.layout.rowMinHeight&&(e.layout.rowHeight=e.layout.rowMinHeight),d.height=e.layout.rowHeight,d.computedHeight&&(d.height=d.computedHeight),d.minHeight>d.height&&(d.height=d.minHeight),void 0!==d.label&&"advanced"===e.grouping.renderMode&&(d.height=e.grouping.groupRowHeight),d.cellHeight=d.height,e.rowDetail.enabled&&d.showDetail&&!e.rowDetail.dialog.enabled&&(d.height+=d.detailHeight);else if("auto"===e.layout.rowHeight){e.layout.rowHeight<e.layout.rowMinHeight&&(e.layout.rowHeight=e.layout.rowMinHeight),d.element=c,d.grid=e,d.element&&d.element.classList.contains("smart-hidden")&&d.element.classList.remove("smart-hidden");const t=d.data&&e.isRendered?d._autoSize(d):a,o=d.canNotify;d.canNotify=!1,d.height=t,d.computedHeight&&(d.height=d.computedHeight),void 0!==d.label&&"advanced"===e.grouping.renderMode&&(d.height=e.grouping.groupRowHeight),d.cellHeight=d.height,e.rowDetail.enabled&&d.showDetail&&!e.rowDetail.dialog.enabled&&(d.height+=d.detailHeight),d.canNotify=o}else e.layout.rowHeight(s,d),d.height||(d.height=a),d.cellHeight=d.height,e.rowDetail.enabled&&d.showDetail&&!e.rowDetail.dialog.enabled&&(d.height+=d.detailHeight)}else{if("auto"===d.height||"auto"===d._height){d.element=c,d.element&&d.element.classList.contains("smart-hidden")&&d.element.classList.remove("smart-hidden");const t=d.data&&e.isRendered?d._autoSize(d):a;d.height=t,d._height="auto"}else d.height=a;void 0===d.label||d.summaryRow||"advanced"!==e.grouping.renderMode||(d.height=e.grouping.groupRowHeight),d.computedHeight&&(d.height=d.computedHeight),d.cellHeight=d.height,e.rowDetail.enabled&&d.showDetail&&!e.rowDetail.dialog.enabled&&(d.height+=d.detailHeight)}e._rowGap&&s<e.rows.length-1&&(d.height+=e._rowGap)}!t&&(!0===d.freeze||"near"===d.freeze?d.visible&&(n+=d.height):"far"===d.freeze&&d.visible&&(i+=d.height),d.freeze&&d.visible)?d.top=l:(d.top!==l&&(d.top=l),d.expandHeight?l+=d.cellHeight:l+=d.height)}if(e._summaryRowCount&&e.summaryRow.visible&&(l+=1*a),e.editing.addNewRow&&"row"!==e.editing.addNewRow.displayMode&&(l+=1*a),e.filtering&&e.filtering.filterRow.visible&&(n+=a+1),e.editing.addNewRow&&"button"!==e.editing.addNewRow.displayMode&&e.rowHierarchy&&e.editing.addNewRow.visible&&(l+=a,"far"!==e.editing.addNewRow.position&&(n+=a)),e.dataSource&&e.dataSource.virtualDataSource&&!1===e.paging.enabled){let t=e.dataSource.length>e.virtualModeCachedRowsCount?e.virtualModeCachedRowsCount:e.dataSource.length;"infinite"===e.scrolling&&(t=e.dataSource.length),"virtual"===e.scrolling&&t>=e.virtualModeCachedRowsCount&&(l=e.rows[0]?e.rows[0].height*e.dataSource.length:e.layout.rowMinHeight*e.dataSource.length)}return t&&(l=r*Math.ceil(o.length/s)),e.__scrollHeight=l,e.__frozenNearHeight=n,e.__frozenFarHeight=i,e._scrollView.scrollHeight=l-e.$.scrollView.offsetHeight+n+i,l=e.__scrollHeight+n+i-1,e.grouping.enabled&&e.dataSource.groupBy&&e.dataSource.groupBy.length>0&&e.grouping.groupIndent>0&&"advanced"===e.grouping.renderMode&&(l+=parseInt(e.grouping.groupIndent/2)),e.__scrollHeight=l,c.remove(),o[0]&&delete o[0]._isMeasureRow,e.rows.canNotify=!0,l}_measureColumnHeight(){const e=this;if(e.__measuredColumnHeight)return e.__measuredColumnHeight;const t=document.createElement("smart-grid-column");t.style.height="auto",t.style.position="static";const o=document.createElement("div");o.classList.add("smart-label"),o.innerHTML="aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRwWxXyYzZ1234567890",t.appendChild(o),e.$.columnHeader.appendChild(t);let l=e.$.columnHeader.offsetHeight;return e.$.columnHeader.removeChild(t),e._columnHeights&&e._columnHeights.length>1&&(l=e._columnHeights[0]),l<e.layout.columnMinHeight&&(l=e.layout.columnMinHeight),e.__measuredColumnHeight=l,l}_initializeColumnGroupsHierarchy(){const e=this;let t=0;e.$.columnContainer.innerHTML="";const o=JSON.parse(JSON.stringify(e.columnGroups));if(o.length>0){for(let t=0;t<o.length;t++)o[t].parent=null,o[t].groups=null,o[t].labelTemplate=e.columnGroups[t].labelTemplate;for(let t=0;t<e.viewColumns.length;t++)e.viewColumns[t].parent=null,e.viewColumns[t].groups=null;const l=function(e){for(let t=0;t<o.length;t++){let l=o[t];if(l.name===e)return l}return null},a=function(e){let t=new Array;if(e.columnGroup&&t.push(e),e.groups)for(let o=0;o<e.groups.length;o++)if(e.groups[o].columnGroup)t.push(e.groups[o]);else if(e.groups[o].groups){let l=a(e.groups[o]);for(let e=0;e<l.length;e++)t.push(l[e])}return t};for(let e=0;e<o.length;e++){let t=o[e];if(t.groups||(t.groups=null),t.parentGroup){let e=l(t.parentGroup);e&&(t.parent=e,e.groups||(e.groups=new Array),-1===e.groups.indexOf(t)&&e.groups.push(t))}}for(let t=0;t<e.viewColumns.length;t++){let o=e.viewColumns[t];if(o.columnGroup){let e=l(o.columnGroup);e&&(e.groups||(e.groups=new Array),o.parent=e,-1===e.groups.indexOf(o)&&e.groups.push(o))}}for(let o=0;o<e.viewColumns.length;o++){const l=e.viewColumns[o];let a=l;for(l.level=0;a.parent;)a=a.parent,l.level++;a=l;let n=l.level;for(t=Math.max(t,l.level);a.parent;)a=a.parent,a&&(a.level=--n)}for(let t=0;t<o.length;t++){const l=o[t],n=a(l);l.columns=n;let i=new Array,r=0,s="near";0===n.length&&(r=-1,l.visible=!1);for(let t=0;t<n.length;t++)i.push(e.viewColumns.indexOf(n[t])),n[t].freeze&&("far"===n[t].freeze&&(s="far"),r++);r===n.length?l.freeze=s:r>0&&r<n.length&&(e.classList.add("smart-visibility-hidden"),e.error(e.localize("frozenColumns",{elementType:"Grid"}))),i.sort((function(e,t){return(e=parseInt(e))<(t=parseInt(t))?-1:e>t?1:0}));for(let t=1;t<i.length;t++)i[t]!==i[t-1]+1&&(e.classList.add("smart-visibility-hidden"),e.error(e.localize("columnGroups",{elementType:"Grid"})))}}e._columnGroupsLevel=1+t,e._columnGroups=o;for(let t=0;t<e._columnGroups.length;t++){const o=e._columnGroups[t];o.collapsible&&e._initializeColumnGroupCollapsing(o)}}_initializeColumnGroupCollapsing(e){const t=this;e.collapsed=e.collapsed||!1,e.collapseButton=document.createElement("div"),e.collapseButtonIcon=document.createElement("span"),e.collapseButton.appendChild(e.collapseButtonIcon),e.collapseButton.classList.add("smart-grid-column-group-collapse-button"),e.collapseButtonIcon.classList.add("smart-grid-icon",e.collapsed?"smart-icon-right":"smart-icon-left","show"),e.collapseButton.setAttribute("role","button"),e.collapseButton.setAttribute("aria-label",t.localize(e.collapsed?"expand":"collapse"));const o=(e,l)=>{if(e.collapsed=l,e.column&&(e.column.canNotify=!1,e.column.collapsed=l,e.column.canNotify=!0),e.collapseButtonIcon.classList.remove("smart-icon-left"),e.collapseButtonIcon.classList.remove("smart-icon-right"),e.collapsed?e.collapseButtonIcon.classList.add("smart-icon-right"):e.collapseButtonIcon.classList.add("smart-icon-left"),t.beginUpdate(),e.collapsed){const t=e=>{let t=0;for(let o=0;o<e.columns.length;o++){const l=e.columns[o];l.allowCollapse&&(l.visible=!1,t++)}t===e.columns.length&&e.columns[0]&&!e.inline&&(e.columns[0]._visible=!0,e.columns[0].visible=!0)};if(e.groups){let l=!1;for(let t=0;t<e.groups.length;t++){const a=e.groups[t];a.columnGroup?l=!0:o(a,e.collapsed)}l&&t(e)}else t(e)}else{const t=e=>{for(let t=0;t<e.columns.length;t++)e.columns[t].visible=!0};if(e.groups){let l=!1;for(let t=0;t<e.groups.length;t++){const a=e.groups[t];a.columnGroup?l=!0:o(a,e.collapsed)}l&&t(e)}else t(e)}t.endUpdate(),e.collapseButton.setAttribute("aria-label",t.localize(e.collapsed?"expand":"collapse"))};e.collapsed&&requestAnimationFrame((()=>{o(e,e.collapsed)})),e.collapseButton.addEventListener("click",(function(t){t.stopPropagation(),o(e,!e.collapsed)}))}_refreshColumnHeights(){const e=this;if("card"===e.view)return;e.$.columnHeader.style.height="",e._viewColumnsHeight=e._measureColumnHeight(),e._columnHeights=[];let t=0;for(let o=0;o<e._columnGroupsLevel;o++){let l=e._viewColumnsHeight;e.layout.columnHeight&&(l="number"==typeof e.layout.columnHeight?e.layout.columnHeight?e.layout.columnHeight:e._viewColumnsHeight:e.layout.columnHeight?e.columnHeight(o):e._viewColumnsHeight),l<e.layout.columnMinHeight&&(l=e.layout.columnMinHeight),l?(e._columnHeights.push(l),t+=l):(t+=e._viewColumnsHeight,e._columnHeights.push(e._viewColumnsHeight))}e._columnHeaderHeight=e._columnGroupsLevel*e._viewColumnsHeight,e._columnHeaderHeight=t,e.$.columnHeader.style.height=e._columnHeaderHeight+"px";const o=function(t){let o=0;for(let l=0;l<t.level;l++)o+=e._columnHeights[l];return o},l=function(t){let l=o(t),a=e._columnHeaderHeight-l;for(let o=t.level+1;o<e._columnHeights.length;o++){const l=o;for(let o=0;o<e.viewColumns.length;o++){const n=e.viewColumns[o];let i=!1;if(n.level===l){let o=n;for(;o.parent;){if(o.parent===t){a=e._columnHeights[l],i=!0;break}o=o.parent}if(i)break}}}return a};for(let t=0;t<e.viewColumns.length;t++){const a=e.viewColumns[t],n=l(a);a.computedHeight=n,a.top=o(a)}for(let t=0;t<e._columnGroupsLevel-1;t++)for(let a=0;a<e._columnGroups.length;a++){const n=e._columnGroups[a];if(n.level!==t)continue;if(n.groups){const e=l(n),t=o(n);n.top=t,n.computedHeight=e}const i=n.element;i&&(i.style.width=n.computedWidth+"px",e.rightToLeft?i.style.right=n.left+"px":i.style.left=n.left+"px",i.style.top=n.top+"px",i.style.height=n.computedHeight+"px",i.style.lineHeight=n.computedHeight+"px")}}_refreshColumnWidths(){const e=this;e.__clientSize=null;const t=e.$.verticalScrollBar.offsetWidth>0?e.$.verticalScrollBar.offsetWidth:0,o=e.dataSource.groupBy||[];let l=e.grouping.enabled&&"advanced"===e.grouping.renderMode?e.grouping.groupIndent*(1+o.length):0,a=0;e.selection.checkBoxes.enabled&&(a=e._selectionColumn.computedWidth?e._selectionColumn.computedWidth:e._selectionColumn.minWidth);const n=e._clientSize.width-t-l;let i=0,r=[],s=0,d=0,c=0;if(e.editing.enabled&&!e.editing.commandColumn.inline){const t=function(){const t=document.createElement("div"),o=document.createElement("div"),l=e.editing.commandColumn.dataSource;let a=0,n="",i=0;o.classList.add("smart-label");for(let t in l){const o=l[t];let a=!1;if("commandColumnMenu"===t)continue;let r=!1;a||(!0===o.visible?(i++,r=!0):"auto"===o.visible&&((e.editing.editRow||e.editing.editCell)&&!e.editing.dialog.enabled||"commandColumnEdit"!==t?!e.editing.editRow&&!e.editing.editCell||e.editing.dialog.enabled||("commandColumnUpdate"===t||"commandColumnCancel"===t)&&(i++,r=!0):(i++,r=!0)),a=!0),r&&"icon"!==e.editing.commandColumn.displayMode&&(n+="<span>"+("{{messages}}"===o.label?e.localize(t):o.label)+"</span>")}return o.innerHTML="<span>"+n+"</span>",t.appendChild(o),t.style.width="auto",t.style.position="static",e.$.columnHeader.appendChild(t),a=10+o.firstChild.offsetWidth,e.$.columnHeader.removeChild(t),"icon"===e.editing.commandColumn.displayMode?a=20+20*i:"labelAndIcon"===e.editing.commandColumn.displayMode?a+=25*i:a+=10*i,a};if(e._commandColumn.visible=e.editing.commandColumn.visible,e.editing.commandColumn.visible){const o=e.editing.commandColumn.width?e.editing.commandColumn.width:t();e.columns.canNotify=!1,e._commandColumn.width=o,e.columns.canNotify=!0}}for(let t=0;t<e.viewColumns.length;t++){const o=e.viewColumns[t];let l;"number"==typeof o.width?l=o.width:o.width&&o.width.toString().indexOf("%")>=0?(l=parseFloat(o.width)/100,l*=n-a):o.width&&(o.width.toString().indexOf("em")>=0||o.width.toString().indexOf("pt")>=0||o.width.toString().indexOf("fr")>=0)?(l=parseFloat(o.width),l*=16):"auto"===o.width?l=o._autoSize():o.visible&&(r.push(o),l=0),o.overflowWidth&&(l-=o.overflowWidth),o.visible&&(i+=l),l<o.minWidth&&(l=o.minWidth),o.computedWidth=l}if(r){let e=n-i,t=0;e<0&&(e=60*r.length);for(let o=0;o<r.length;o++){const l=r[o];let a;a=e/r.length,o===r.length-1&&(a=e-t),l.overflowWidth&&(a-=l.overflowWidth),a<l.minWidth&&(a=l.minWidth),l.computedWidth=a,t+=a}}for(let t=0;t<e.viewColumns.length;t++){let o=e.viewColumns[t];o.visible&&(l>0&&!o.autoGenerated&&(o.computedWidth+=l,l=0),o.freeze?!0===o.freeze||"near"===o.freeze?(o.left=s,c+=o.computedWidth,s+=o.computedWidth):"far"===o.freeze&&(o.left=d,d+=o.computedWidth):(o.left=c,c+=o.computedWidth))}for(let t=0;t<e._columnGroupsLevel-1;t++)for(let o=0;o<e._columnGroups.length;o++){const l=e._columnGroups[o];if(l.level!==t)continue;let a=99999;if(l.groups){const e=function(t){let o=0;for(let l=0;l<t.groups.length;l++){let n=t.groups[l];n.groups?o+=e(n):n.visible&&(a=Math.min(n.left,a),o+=n.computedWidth)}return o};l.computedWidth=e(l),l.left=a}}}_createColumnHeaderCellElements(){const e=this,t=e.$.columnContainer,o=document.createDocumentFragment();let l=0;e._columnElements=[],e.$.columnContainer.innerHTML="",e.$.columnNearContainer.innerHTML="",e.$.columnFarContainer.innerHTML="",e.rightToLeft?(e.$.columnNearContainer.classList.remove("near"),e.$.columnNearContainer.classList.add("far"),e.$.columnFarContainer.classList.remove("far"),e.$.columnFarContainer.classList.add("near")):(e.$.columnNearContainer.classList.remove("far"),e.$.columnNearContainer.classList.add("near"),e.$.columnFarContainer.classList.remove("near"),e.$.columnFarContainer.classList.add("far"));for(let t=0;t<e._frozenNearColumns.length;t++)e._frozenNearColumns[t].createElement();for(let t=0;t<e._frozenFarColumns.length;t++)e._frozenFarColumns[t].createElement();for(let t=0;t<e.viewColumns.length;t++){const a=e.viewColumns[t];if(a.freeze)continue;const n=a.createElement();void 0!==a.computedWidth?(a.parent&&n.setAttribute("column-group",a.parent.name),a.parent&&a.parent.columns&&a.parent.columns[0].dataField===a.dataField&&n.setAttribute("column-group-first-child",""),l+=a.computedWidth,e._columnElements.push(n),l<2*e._clientSize.width&&o.appendChild(n)):(e._columnElements.push(n),o.appendChild(n))}for(let t=0;t<e._columnGroups.length;t++){const l=e._columnGroups[t],a=new Smart.Grid.Column({visible:void 0===l.visible||l.visible,allowSort:!1,allowFilter:!1,allowSelect:!1,grid:e,dataField:l.name,label:l.label,labelTemplate:l.labelTemplate,align:l.align,verticalAlign:l.verticalAlign,showIcon:!1});l.column=a;const n=a.createElement();n.style.width=l.computedWidth+"px",e.rightToLeft?n.style.right=l.right+"px":n.style.left=l.left+"px",n.style.top=l.top+"px",n.style.height=l.computedHeight+"px",n.style.lineHeight=l.computedHeight+"px",o.appendChild(n),l.element=n,l.grid=this,n.onpointerdown=()=>{if(e.selection.allowColumnHeaderSelection){const t=function(e){let o=new Array;if(e.columnGroup&&o.push(e),e.groups)for(let l=0;l<e.groups.length;l++)if(e.groups[l].columnGroup)o.push(e.groups[l]);else if(e.groups[l].groups){let a=t(e.groups[l]);for(let e=0;e<a.length;e++)o.push(a[e])}return o},o=t(l);e._selectColumnsRange(o[0].dataField,o[o.length-1].dataField)}}}e.htmlColumnLastChild||(e.htmlColumnLastChild=document.createElement("smart-grid-column"),e.htmlColumnLastChild.classList.add("top-far-corner"),e.htmlColumnLastChild.onpointerdown=e=>{e.stopPropagation(),e.preventDefault()},e.$.columnHeader.appendChild(e.htmlColumnLastChild)),t.appendChild(o),t.style.width=e._computedColumnsWidth+"px",!1===e.appearance.showColumnGroupLines&&e.setAttribute("appearance_hide-column-group-lines",""),e._refreshFrozenColumns()}_refreshFrozenColumns(){const e=this;e.$.columnNearContainer.style.width=e._frozenColumnsNearWidth+"px",e.$.columnFarContainer.style.width=e._frozenColumnsFarWidth+"px";for(let t=0;t<e._columnGroups.length;t++){const o=e._columnGroups[t];o.freeze&&o.element&&(!0===o.freeze||"near"===o.freeze?e.$.columnNearContainer.appendChild(o.element):"far"===o.freeze&&e.$.columnFarContainer.appendChild(o.element))}for(let t=0;t<e.viewColumns.length;t++){const o=e.viewColumns[t];o.freeze&&o.element&&(!0===o.freeze||"near"===o.freeze?e.$.columnNearContainer.appendChild(o.element):"far"===o.freeze&&e.$.columnFarContainer.appendChild(o.element))}}get _clientSize(){const e=this;if(e.__clientSize)return e.__clientSize;const t=getComputedStyle(e.$.container),o=parseFloat(t.paddingLeft)+parseFloat(t.paddingRight),l=parseFloat(t.paddingTop)+parseFloat(t.paddingBottom),a=parseFloat(t.borderLeftWidth)+parseFloat(t.borderRightWidth),n=parseFloat(t.borderTopWidth)+parseFloat(t.borderBottomWidth);return e.__clientSize={width:e.$.container.offsetWidth-o-a,height:e.$.container.offsetHeight-l-n},e.__clientSize}_initializeRowElements(){const e=this;if(!e.rows)return;e.rows.canNotify=!1;let t=0,o=e._clientSize.height;e.$.rowNearContainer.innerHTML="",e.$.rowFarContainer.innerHTML="",e.$.rowContainer.innerHTML="",e._rowElements=[],e._overflowOffset=Math.max(o,300),e._autoHeight&&e.paging.enabled&&(e._overflowOffset=Math.max(o,e.paging.pageSize*e.layout.rowMinHeight)),e.rightToLeft?(e.$.rowNearContainer.classList.remove("near"),e.$.rowNearContainer.classList.add("far"),e.$.rowFarContainer.classList.remove("far"),e.$.rowFarContainer.classList.add("near")):(e.$.rowFarContainer.classList.remove("near"),e.$.rowFarContainer.classList.add("far"),e.$.rowNearContainer.classList.remove("far"),e.$.rowNearContainer.classList.add("near"));const l=e.offsetHeight;e.$.container.classList.add("smart-hidden");const a=e.offsetHeight;e.$.container.classList.remove("smart-hidden"),"hidden"!==e.verticalScrollBarVisibility&&l===a||(o=e._scrollHeight);const n=function(){const l=document.createDocumentFragment();if(e.rows&&0===e.rows.length)return;for(let a=0;a<e.rows.length;a++){const n=e.rows[a];if(n.freeze&&n.visible)continue;const i=n.createElement();if(l.appendChild(i),t+=e.layout.rowMinHeight,t>e._overflowOffset+o)break}e.$.rowContainer.appendChild(l);const a=e.$.rowContainer.children;for(let t=0;t<a.length;t++){const o=a[t];e.rows[t]&&(e.rows[t].element=o),e._rowElements[t]=o}};for(let t=0;t<e._frozenNearRows.length;t++){const o=e._frozenNearRows[t];o.grid=e;const l=o.createElement();o.element=l,e.$.rowNearContainer.appendChild(l)}for(let t=0;t<e._frozenFarRows.length;t++){const o=e._frozenFarRows[t];o.grid=e;const l=o.createElement();o.element=l,e.$.rowFarContainer.appendChild(l)}n();let i=0;for(;t<1.5*o&&++i<50;)n();e.rows.canNotify=!0}_refreshSummary(e){const t=this;if(t.summaryRow.visible)t._summaryUpdateTimer&&clearTimeout(t._summaryUpdateTimer),t._summaryUpdateTimer=setTimeout((()=>{if(!0!==t.editing.isEditing){t._calculateSummary();const o=t.$.headerBar;o&&o._updateTools&&o._updateTools(),!1!==e&&t._recycle(!1,!0,!1)}}),100);else{const e=t.$.headerBar;e&&e._updateTools&&e._updateTools()}}_initializeRows(){const e=this;let t=0;e._frozenNearDefaultRows=[],e._frozenFarDefaultRows=[],e.rows=[],e.rowById=[],e._frozenFarRows=[],e._frozenNearRows=[],e._frozenRowsById=[];let o=e._createdDate||new Date,l=void 0!==e._createdBy?e._createdBy:e.currentUser;const a=function(){let t=[],o=!1;for(let l=0;l<e.columns.length;l++){const a=e.columns[l];let n={};a&&a.summary&&a.summary.length>0&&(o=!0,n[a.dataField]=a.summary,t.push(n))}if(!o)return void(e._summaryItems=[]);const l=e.getSelectedRowIds();if(l.length>=1){const o=[];for(let t=0;t<l.length;t++){const a=e.dataSource.dataItemById[l[t]];a&&o.push(a)}e._summaryItems=e.dataSource.summarize(t,o)}else if(e._selection&&e._selection.cells&&Object.keys(e._selection.cells).length>2){const o=e.getSelectedCells(!1),l=[],a=[];for(let t=0;t<o.length;t++){const n=o[t],i=n[0],r=e.dataSource.dataItemById[i];-1===l.indexOf(r)&&l.push(r),-1===a.indexOf(n[1])&&a.push(n[1])}e._summaryItems=e.dataSource.summarize(t,l);const n=Object.keys(e._summaryItems);for(let t=0;t<n.length;t++){const o=n[t];-1===a.indexOf(o)&&delete e._summaryItems[o]}}else e._summaryItems=e.dataSource.summarize(t)};e._calculateSummary=a;const n=e.columns?e.columns.filter((e=>void 0!==e.getCellValue)):[],i=function(a,i,r){let s=null;if(e.isInitialized&&(o=new Date),s=a?a.grid?a:new Smart.Grid.Row({data:a,index:i,grid:e,createdBy:l,createdDate:o}):new Smart.Grid.Row({data:{},index:i,grid:e,createdBy:l,createdDate:o}),n)for(let e=0;e<n.length;e++){const t=n[e],o=t.getCellValue(s.id,t.dataField,a);void 0!==o&&(s.data[t.dataField]=o)}if(e.rowById[s.id]&&(s.id=e.rows.length,e.rowById[s.id])){const e=function(){return(65536*(1+Math.random())|0).toString(16).substring(1)};s.id=e()}if(e.onRowInit){e.onRowInit(i,s,e),30!==s.height&&(s.cellHeight=s.height);for(let t in s)-1!==s.properties.indexOf(t)||t.startsWith("_")||e.error(e.localize("invalidRowProperty",{elementType:"Grid",propertyName:t}));e._details[i]=s.showDetail}if(s.selected&&(e._selection.rows[s.id]=!0,e._selection.indexes[s.index]=s.index),s.freeze&&s.visible){if(!0===s.freeze||"near"===s.freeze){e.rows.splice(t++,0,s);const o=e.rows[t-1];-1===e._frozenNearRows.indexOf(o)&&(e._frozenNearRows.push(o),e._frozenRowsById[o.id]=!0)}else if("far"===s.freeze){e.rows.push(s);const t=e.rows[e.rows.length-1];-1===e._frozenFarRows.indexOf(t)&&(e._frozenFarRows.push(t),e._frozenRowsById[t.id]=!0)}}else e.rows[i]?(e.rows.splice(i,0,s),e.rows[i].index=e.rows.length):e.rows.push(s),s.data&&s.data.$&&(s.data.$.history=s.history,s.data.$.starred=s.starred,s.data.$.comments=s.comments,s.data.$.style=s.style);if(!("virtual"===e.scrolling||e.paging.enabled&&e.dataSource&&e.dataSource.virtualDataSource))if(e.onRowInserted){const t=void 0===i?e.rows[e.rows.length-1]:e.rows[i],o=o=>{const l=t;if(void 0!==o&&Array.isArray(o)&&(o=o[0]),void 0===o){if(e.rowById[l.id]){const t=e.dataSource.dataItemById[l.id],o=function(){return(65536*(1+Math.random())|0).toString(16).substring(1)};l.id=o(),l.data&&l.data.$?l.data.$.id=l.id:l.data.id=l.id,e._getId()&&(l.data[e._getId()]=l.id),t&&(e.dataSource.dataItemById[l.id]=l.data)}e.rowById[l.id]=l}else{const t=e.dataSource.dataItemById[l.id];l.id=o,l.data&&l.data.$?l.data.$.id=l.id:l.data.id=l.id;const a=e._getId();a&&(l.data[e._getId()]=l.id),t&&(t[a]=o,e.dataSource.dataItemById[l.id]=t,l.data=t),e.rowById[l.id]=l}-1!==l.index&&void 0!==l.index||(l.index=e.rows.length),e._setAddUndoRedo(l),!e.editing.isEditing&&e.isInitialized&&(e._recycle(!1,!0),e.grouping.groupBy.length&&e.refresh()),e._onRowInserted&&e._onRowInserted(l),r&&r(l)};if(e._rowInsertedCallback=o,void 0===i&&(i=e.rows.length-1,void 0!==t.index&&-1!==t.index||(t.index=i)),e.isInitialized){e._rowInsertTimer&&clearTimeout(e._rowInsertTimer),e._rowInsert||(e._rowInsert=[]),e._rowInsert.push({row:t,index:i});const l=e._keyboardAdd?300:150;e._rowInsertTimer=setTimeout((()=>{if(1===e._rowInsert.length)e.onRowInserted([i],[t],o,e),delete e._rowInsert,delete e._undoRedoAction;else{let t=[],o=[];for(let l=0;l<e._rowInsert.length;l++)t.push(e._rowInsert[l].index),o.push(e._rowInsert[l].row);delete e._rowInsert,e.onRowInserted(t,o,(t=>{e.beginUpdate();for(let l=0;l<o.length;l++){const a=o[l],n=t?t[l]:void 0;if(void 0!==n){const t=e.dataSource.dataItemById[a.id];a.id=a.data.id=n;const o=e._getId();o&&(a.data[e._getId()]=a.id),e.rowById[a.id]=a,t&&(t[o]=n,e.dataSource.dataItemById[a.id]=t,a.data=t)}e._setAddUndoRedo(a),-1!==a.index&&void 0!==a.index||(a.index=e.rows.length),e._onRowInserted&&e._onRowInserted(a),r&&r(a)}delete e._undoRedoAction,e.endUpdate(!1)}),e)}}),l)}else e.onRowInserted([i],[t],o,e)}else{const t=void 0===i?e.rows[e.rows.length-1]:e.rows[i];void 0===i&&(i=e.rows.length-1,void 0!==t.index&&-1!==t.index||(t.index=i)),r&&r(t)}},r=function(){const t=e.rows[e.rows.length-1];e.rows.pop(),e.onRowRemoved&&e.onRowRemoved([t.id],[t.index],e),e._onRowRemoved&&e._onRowRemoved([t.id],[t.index],e),e._setRemoveUndoRedo(t)},s=function(t){const o=e.rows[t];o.selected&&o.setProperty("selected",!1),e.rows.splice(t,1),e.onRowRemoved&&e.onRowRemoved([o.id],[t],e),e._onRowRemoved&&e._onRowRemoved([o.id],[t],e),e._setRemoveUndoRedo(o)};e._add=i,e._removeLastRow=r,e._removeAt=s,e._rowHeight=e._autoRowHeight;const d=e.dataSource.length,c=e.onRowInserted;e.onRowInserted=null,e.$.content.setAttribute("aria-rowcount",d);const u=e.dataSource&&e.dataSource.virtualDataSource&&!e.dataSource.virtualDataSourceOnExpand&&e.dataSource.length>e.virtualModeCachedRowsCount&&"infinite"!==e.scrolling;if(e.dataSource&&e.dataSource.virtualDataSource&&e.paging.enabled&&!e.dataSource.virtualDataSourceOnExpand)for(let t=0;t<e.dataSource.boundSource.length;t++){const o=e.dataSource[t],l=t+e.paging.pageIndex*e.paging.pageSize;e.dataSource.id||(o.$.id=l),i(o,l)}else if(u){let t=e.dataSource.length>e.virtualModeCachedRowsCount?e.virtualModeCachedRowsCount:e.dataSource.length;"infinite"===e.scrolling&&(t=e.dataSource.length);for(let o=0;o<t;o++){const t=e.dataSource[o];i(t,o)}}else for(let t=0;t<e.dataSource.length;t++){const o=e.dataSource[t];i(o,t)}for(let t=0;t<e._frozenFarRows.length;t++){const o=e._frozenFarRows[t];e.rows.splice(e.rows.indexOf(o),1),e.rows.push(o)}if(a(),e.onRowInserted=c,e.dataSource.notify((function(t){if(e.dataSource._updating)return;const o=t.data;e.rows.canNotify=!1;let l=!1;switch(t.action){case"add":if(!o)return;if(void 0!==o.length)for(let t=0;t<o.length;t++)i(o[t],e.dataSource.length-o.length+t);else i(o,e.dataSource.length-1);break;case"update":if(o.length){let o=[],a=[],n=[];for(let r=0;r<n.length;r++){const s=t.index[r];e.rows[s]?(e.rows[s].data=n[r],o.push(s),a.push(e.rows[s]),n.push(e.rows[s].data)):(i(n[r],n[r].$.index),l=!0)}e.onRowUpdated&&e.onRowUpdated(o,a,n,e)}else{const l=t.index;e.rows[l]?e.rows[l].data=o:i(o,e.dataSource.length-1),e.onRowUpdated&&e.onRowUpdated([l],[e.rows[l]],[e.rows[l].data],e)}break;case"insert":i(o,t.index);for(let t=0;t<e.rows.length;t++)e.rows[t].index=t;break;case"remove":s(t.index);break;case"removeLast":r();break;case"bindingComplete":if(e.dataSource&&e.dataSource.url||e.dataSource&&!e.dataSource.virtualDataSource){if(e.appearance.displayLoadingIndicator=!1,e._setLoadingIndicatorVisibility(),e._toggledRow=null,e.dataSource.length!==d){if(e.paging.enabled){const t=e.$.headerPager.querySelector("smart-pager"),o=e.$.footerPager.querySelector("smart-pager");t&&(t.pagesCount=Math.ceil(e.dataSource.length/e._pageSize),t.$&&o.$.pageSizeSelector&&(t.$.pageSizeSelector.disabled=e.dataSource.length<e.pager.pageSizeSelector.dataSource[0])),o&&(o.pagesCount=Math.ceil(e.dataSource.length/e._pageSize),o.$&&o.$.pageSizeSelector&&(o.$.pageSizeSelector.disabled=e.dataSource.length<e.pager.pageSizeSelector.dataSource[0]))}if(0===d&&0===e.columns.length&&e.dataSource.dataFields.length>0){const t=e.context;e.context=e,e.columns.canNotify=!1,e.columns=[],e._renderColumns(),e._resetCachedLayout(),e.columns.canNotify=!0,e.context=t}e._initializeRows(),e._initializeRowElements(),e.refresh()}e._recycle(),e.onLoad&&(e.onLoad(),delete e.onLoad)}}a(),("update"!==t.action||l)&&e._refreshLayout(),e._recycle(),e.rows.canNotify=!0})),e._observeRows(),e.summaryRow.visible){const t=new Smart.Grid.Row({height:e.layout.rowMinHeight,freeze:"near",visible:"near"===e.summaryRow.position,summaryRowIndex:0,summaryRow:!0}),o=new Smart.Grid.Row({height:e.layout.rowMinHeight,freeze:"far",visible:"far"===e.summaryRow.position,summaryRowIndex:0,summaryRow:!0});"near"===e.summaryRow.position&&e._frozenNearRows.splice(0,0,t),"far"===e.summaryRow.position&&e._frozenFarRows.push(o),e._frozenRowsById[o.id]=!0}if(e.filtering.enabled&&e.filtering.filterRow.visible){const t=new Smart.Grid.Row({freeze:!0,autoGenerated:!0,filterRow:!0});e._frozenNearRows.splice(0,0,t)}e._renderAddNewRow()}_observeRows(){const e=this;e._frozenNearRows=[],e._frozenFarRows=[],e.rows=new Smart.ObservableArray(e.rows,null,{allowToggle:!0,allowResize:!0,allowCheck:!0,allowSelect:!0,allowReorder:!0,expanded:!0,selected:!0,checked:!0,visible:!0,enabled:!0,minHeight:!0,height:!0,freeze:!0,showDetail:!0,data:!0,visibleIndex:!0,index:!0,comments:!0,style:!0,starred:!0,updatedBy:!0,updatedDate:!0,createdDate:!0,createdBy:!0,history:!0});for(let t=0;t<e.rows.length;t++){const o=e.rows[t];!0===o.freeze||"near"===o.freeze?(e._frozenNearRows.push(o),e._frozenRowsById[o.id]=!0):"far"===o.freeze&&(e._frozenFarRows.push(o),e._frozenRowsById[o.id]=!0),e.rowById[e.rows[t].id]=o}e.rows.notify((function(t){if(!e.rows.canNotify)return;const o=t.action;if("length"===o)return;if(t.path)return e.rows.canNotify=!1,(e.rowById[t.target.id]||"selected"===t.propertyName)&&(l=t.target,a=t.propertyName,n=t.oldValue,i=t.newValue,n===i&&"selected"!==a&&"showDetail"!==a||(l.propertyChanged(a,n,i),e.onRowChange&&l.properties.indexOf(a)>=0&&e.onRowChange(l,a,n,i,e))),void(e.rows.canNotify=!0);var l,a,n,i;if(e.rows.canNotify=!1,!e.dataSource)return;switch(e.dataSource.canNotify=!1,o){case"add":{const o=function(o){let l=e.rows[o];if(l instanceof Smart.Grid.Row==0){l=new Smart.Grid.Row(l);const a=e.rows.canNotify;e.rows.canNotify=!1,t.object[o]=l,l=t.object[o],e.rows.canNotify=a}if(l.grid=e,e.dataSource&&e.dataSource.virtualDataSource){e.rows.canNotify=!1;for(let t=0;t<e.rows.length;t++){const o=e.dataSource.boundSource[t],l=e.rows[t];o&&(l.data=o,l.id=o.$.id),e.rowById[l.id]=l}e.rows.canNotify=!0}else(()=>{if(0===e.dataSource.length&&e.dataSource.dataFields&&0===e.dataSource.dataFields.length&&e.columns&&e.columns.length){let t=[];for(let o=0;o<e.columns.length;o++){const l=e.columns[o];l.dataField||(l.dataField="dataField_"+Math.floor(65536*(1+Math.random())).toString(16).substring(1)),t.push({name:l.dataField,dataType:l.dataType||"string"}),l.displayField&&l.displayField!==l.dataField&&t.push({name:l.displayField,dataType:l.dataType||"string"})}e.dataSource.dataFields=t}if(e.dataSource.id&&(null===l.data[e.dataSource.id]||void 0===l.data[e.dataSource.id])){const t=function(){return(65536*(1+Math.random())|0).toString(16).substring(1)};l.data[e.dataSource.id]=t()}if(o<e.dataSource.length?e.dataSource.insert(o,e.rows[o].data):e.dataSource.add(e.rows[o].data),e.dataSource[o]){l.data=e.dataSource[o];for(let t=0;t<e.dataSource.dataFields.length;t++){const o=e.dataSource.dataFields[t].name;e.dataSource.id&&o===e.dataSource.id||e.dataSource.keyDataField&&o===e.dataSource.keyDataField||e.dataSource.parentDataField&&o===e.dataSource.parentDataField||e.columnByDataField[o]||delete l.data[o]}void 0!==e.dataSource[o].$.id&&(l.id=e.dataSource[o].$.id,e.rowById[l.id]=l),l.data.$&&l.history&&(l.data.$.history=l.history)}-1!==l.index&&void 0!==l.index||(l.index=o),l.selected&&(e._selection.rows[l.id]=!0,e._selection.indexes[l.index]=l.index),l.freeze&&(!0===l.freeze||"near"===l.freeze?e._frozenNearRows.push(l):"far"===l.freeze&&e._frozenFarRows.push(l),e._frozenRowsById[l.id]=!0),e._conditionalColors&&e._conditionalColors.update&&setTimeout((()=>{e._conditionalColors.update(),e._recycle(!1)}),100)})()};for(let e=0;e<t.addedCount;e++)o(t.index+e);break}case"update":if(t.target){const o=e.rowById[t.target.id],l=e.rows.indexOf(o);e.dataSource.update(l,o)}else{const o=e.rows.indexOf(t.index);e.dataSource.update(t.index,o)}break;case"remove":{if(e.dataSource&&e.dataSource.virtualDataSource){e.rows.canNotify=!1;const o=t.removed&&t.removed.length>0?t.removed[0]:null;o&&delete e.rowById[o.id];for(let t=0;t<e.dataSource.boundSource.length;t++){const o=e.dataSource.boundSource[t],l=e.rows[t];l&&(l.data=o,l.id=o.$.id,e.rowById[l.id]=l)}return e.rows.canNotify=!0,e.refresh(),void e._refreshPaging(!1)}const o=t.removed&&t.removed.length>0?t.removed[0]:null;o&&delete e.rowById[o.id],e.dataSource.removeAt(t.index);break}}if(e.dataSource.canNotify=!0,e.rows.canNotify=!0,!o)return;let r=e.isInitialized&&e._rowElements&&e._rowElements.length<e.rows.length;"add"===o&&1===t.addedCount&&r&&e._rowElements.length>0&&e._rowElements[e._rowElements.length-1].classList.contains("smart-hidden")&&(r=!1),r&&e._initializeRowElements(),e.refresh(!1,o),e._refreshPagesCount(),e._sortedColumns&&e._sortedColumns.length>0&&e.refreshSort()}))}setDropDownLabel(e){const t=this;t.$.dropDownElement&&(t.dropDownModeInput?t.$.dropDownElement.querySelector(".smart-action-button smart-input").value=e:t.$.dropDownElement.querySelector(".smart-action-button").innerHTML=e)}openDropDown(){const e=this;if(!e.dropDownMode)return;if(!e.$.dropDownPopup)return;const t=e.$.dropDownPopup,o=e.$.dropDownElement;o.setAttribute("active",""),o.querySelector(".smart-drop-down-button").setAttribute("active",""),(()=>{const l=0,a=0;if(e.layout.isDirty=!0,window.screen.availWidth<400)return t.open("left","top"),t.style.width=e.offsetWidth+"px",void(t.style.height=e.offsetHeight+"px");{const o={width:e.layout.dropDownWidth,height:e.layout.dropDownHeight};t.style.width="auto"===o.width?o.width:o.width+"px",t.style.height="auto"===o.height?o.height:o.height+"px"}const n=o;if(n){const o=e.offset(n),i=o.left-l,r=l,s=Math.max(r,i);t.open(s,o.top+n.offsetHeight-a)}else t.classList.add("center"),t.open("center","center");e.style.display=""})()}isDropDownOpened(){return!!this.$.dropDownElement.hasAttribute("active")}closeDropDown(){const e=this;e.dropDownMode&&e.$.dropDownPopup&&(e.$.dropDownElement.removeAttribute("active"),e.$.dropDownElement.querySelector(".smart-drop-down-button").removeAttribute("active"),e.$.dropDownPopup.close())}_renderInDropDown(){const e=this;if(e.dropDownMode&&(e.dropDownMode&&(e.style.display="none"),e.dropDownMode&&void 0===e._dropDownMode)){e._dropDownMode=!0;const t=document.createElement("div"),o=e._createPopup();if(o.allowDrag=!1,o.classList.add("smart-grid-drop-down-popup"),e.$.dropDownElement=t,e.$.dropDownPopup=o,t.onmouseenter=()=>{t.hasAttribute("active")||t.setAttribute("hover","")},t.onmouseleave=()=>{t.removeAttribute("hover")},t.classList.add("smart-grid-drop-down-button","smart-drop-down-box"),e.parentNode.insertBefore(t,e),t.innerHTML=`<div class="smart-container" role="presentation">\n <div class="smart-content" role="presentation">\n <div class="smart-buttons-container" role="presentation">\n <span class="smart-action-button">${e.localize("dropDownPlaceholder")}</span>\n <span class="smart-drop-down-button">\n <span class="smart-drop-down-button-icon" id="arrow" aria-hidden="true"></span>\n </span>\n </div>\n </div>\n </div>`,e.dropDownModeInput){const o=t.querySelector(".smart-action-button");o.innerHTML='<smart-input style="color: var(--smart-background-color); background: var(--smart-background); border-radius: 0px; width: calc(100% - 6px); height: calc(100% - 6px);"></smart-input>';const l=o.firstElementChild;l.onpointerdown=l.onclick=l.onpointerup=e=>{e.stopPropagation()},l.oninput=l.onchange=l.onkeyup=t=>{const o=e.rows||e.dataSource;clearTimeout(e._dropDownInputTimer),e._dropDownInputTimer=setTimeout((()=>{if(l.value.length>=2)for(let a=0;a<o.length;a++){const n=o[a],i=(""+(n.data?n.data:n)[e.dropDownModeDataField]).toLowerCase(),r=(""+l.value).toLowerCase();if(i.indexOf(r)>=0){"Enter"===t.key&&(l.value=i),e.selection.enabled&&(e.isDropDownOpened()||e.openDropDown(),e.rows&&(e.clearSelection(),e.selection.allowCellSelection?e.selectCell(n.id,e.dropDownModeDataField):e.selectRow(n.id),e.ensureVisible(n.id)));break}}}),300)}}if(t.onclick=()=>{o.classList.contains("open")?e.closeDropDown():e.openDropDown()},e.style.height="100%",e.style.width="100%",o.content.appendChild(e),e._cellsMerge=[],e._cellStyles=[],!e._popupDropDown){e._popupDropDown=o,o._refreshPosition=()=>{const l=e.offset(t),a=t.offsetHeight,n=e.offset(e);if(o.style.maxHeight="",o.style.minHeight="",l.top+a+o.offsetHeight>window.innerHeight-n.top){const e=a+l.top+o.offsetHeight-window.innerHeight+n.top;o.style.maxHeight=Math.max(250,o.offsetHeight-e)+"px",o.style.minHeight="250px"}else o.style.maxHeight="",o.style.minHeight=""};const l=()=>{if(e.selection.enabled){const o=e._selection.focusedCell;if(o){const l=e.getCellValue(o.id,o.dataField);if(e.dropDownModeInput?t.querySelector(".smart-action-button smart-input").value=l:t.querySelector(".smart-action-button").innerHTML=l,e.selection.enabled&&e.selection.allowCellSelection){const l=e.getCellValue(o.id,e.dropDownModeDataField);e.dropDownModeInput?t.querySelector(".smart-action-button smart-input").value=l:t.querySelector(".smart-action-button").innerHTML=l}}}};o.onOpen=function(){e._popupDropDown._refreshPosition(),e.$.fireEvent("dropDownGridOpen"),e.$.listen("cellClick",l)},o.onClose=function(){if(e.$.unlisten("cellClick"),e.selection.enabled){const o=e._selection.focusedCell;if(o){const l=e.getCellValue(o.id,o.dataField);if(e.dropDownModeInput?t.querySelector(".smart-action-button smart-input").value=l:t.querySelector(".smart-action-button").innerHTML=l,e.selection.enabled&&e.selection.allowCellSelection){const l=e.getCellValue(o.id,e.dropDownModeDataField);e.dropDownModeInput?t.querySelector(".smart-action-button smart-input").value=l:t.querySelector(".smart-action-button").innerHTML=l}}}e.$.fireEvent("dropDownGridClose")},o.onkeydown=function(e){"Escape"===e.key&&(o.result=!1,o.close())}}}}render(){const e=this,t=()=>0===e.offsetWidth||0===e.offsetHeight;if(t())return requestAnimationFrame((()=>{e.isInitialized||t()||(e._undoRedo=[],e._refreshCurrentUser(),e._render())})),e.$.content.setAttribute("role","grid"),e.editing.enabled||e.$.content.setAttribute("aria-readonly",!0),e.$.verticalScrollBar.removeAttribute("role"),e.$.horizontalScrollBar.removeAttribute("role"),e.$.verticalScrollBar.removeAttribute("aria-controls"),e.$.horizontalScrollBar.removeAttribute("aria-controls"),void super.render();const o=e.context;e.context=e,e.$.content.setAttribute("role","grid"),"grid"!==e.view&&e.setAttribute("view",e.view),e.editing.enabled||e.$.content.setAttribute("aria-readonly",!0),e.$.verticalScrollBar.removeAttribute("role"),e.$.horizontalScrollBar.removeAttribute("role"),e.$.verticalScrollBar.removeAttribute("aria-controls"),e.$.horizontalScrollBar.removeAttribute("aria-controls"),e._undoRedo=[],e._refreshCurrentUser(),e._render(),e.context=o,super.render()}transpose(e,t=180,o){const l=this,a=l.dataSource,n=l.columns;if(!a||!n)return null;let i=[],r=[];i=a instanceof Smart.DataAdapter?a.boundSource.toArray():a,r=n.toArray();const s=[],d=[{label:"",dataField:"field",freeze:!0,width:150}];for(let l=0;l<i.length;l++){const a={label:i[l][e]||`Row ${l+1}`,width:t,dataField:String(l)};o&&o(a),d.push(a)}for(let e of r){const t={field:e.label||e.dataField};i.forEach(((o,l)=>{t[l]=o[e.dataField]})),s.push(t)}l.beginUpdate(),l.dataSource=new Smart.DataAdapter({dataSource:s}),l.columns=d,l.endUpdate(),l.render()}_renderColumns(e){const t=this;t._initializeColumns(),t._initializeColumnGroupsHierarchy(),t._refreshColumnsResponsiveVisibility(),t._createColumnHeaderCellElements(),t._renderColumnGroupHeaders(),!1!==e&&t._refresh()}_renderRows(e){const t=this;t._initializeRows(),t._initializeRowElements(),!1!==e&&t._refresh()}_setupMobile(){const e=this;if(void 0===e._mobile&&(e._mobile=Smart.Utilities.Core.isMobile),e._mobile){e.layout.rowMobileHeight&&(e.layout.rowMinHeight=e.layout.rowHeight=e.layout.columnMinHeight=e.layout.columnHeight=e.layout.rowMobileHeight),e.behavior.rowResizeMode="none",e.behavior.allowRowReorder=!1,e.selection.allowDragSelectionAutoScroll=!1,e._scrollView.vScrollBar.showButtons=!1,e._scrollView.hScrollBar.showButtons=!1,e.style.setProperty("--smart-scroll-bar-size","12px"),document.body.style.setProperty("--smart-data-view-sort-panel-width","345px"),e._scrollContent=document.createElement("div"),e._scrollContent.style.width="100%",e._scrollContent.style.height="100%",e._scrollContent.style.position="absolute",e._scrollContent.style.left="0px",e._scrollContent.style.top="0px",e._scrollContent.style.background="white",e._scrollContent.style.zIndex=9999,e._scrollContent.style.opacity=.1,e._scrollContent.style.overflow="auto",e.addEventListener("viewChange",(()=>{"grid"===e.view?e._scrollContent.classList.remove("smart-hidden"):e._scrollContent.classList.add("smart-hidden")})),e.addEventListener("beginEdit",(()=>{e._scrollContent.classList.add("smart-hidden")})),e.addEventListener("endEdit",(()=>{e._scrollContent.classList.remove("smart-hidden")})),e._scrollContent.ontouchend=()=>{e._mobileDownTime=null},e._scrollContent.ontouchmove=t=>{if(t.stopPropagation(),!e._scrollContentScroll&&e.selection.enabled&&e.selection.allowDragSelection&&e.selection.allowCellSelection&&e._mobileDownDataField&&void 0!==e._mobileDownId&&e._mobileDownTime&&new Date-e._mobileDownTime>=800){const o=e=>new PointerEvent(e,{bubbles:!0,cancelable:!0,composed:!0,pointerId:42,pointerType:"mouse",clientX:t.changedTouches[0].clientX,clientY:t.changedTouches[0].clientY,pageX:t.changedTouches[0].pageX,pageY:t.changedTouches[0].pageY});e._mobileSelect=!0,e._dragSelection(o("mousemove")),e._mobileSelect=!1,t.preventDefault()}},e._scrollContent.selectstart=e=>{e.stopPropagation(),e.preventDefault()},e._scrollContent.ontouchstart=e=>{e.stopPropagation()},e._scrollContent.onpointerup=t=>{if(e._dragSelectionStartDataField=null,e._dragSelectionStartRow=null,e._mobileDownDataField&&void 0!==e._mobileDownId){let o=null,l=null;const a=(e.enableShadowDOM?e.shadowRoot:e.getRootNode()).elementsFromPoint(t.clientX,t.clientY);for(let t=0;t<a.length;t++){const n=a[t];if(n.closest&&n.closest("smart-grid-cell")){e._hideActionButtons();const t=n.closest("smart-grid-cell").cell;l=t.row.id,o=t.column.dataField;break}}new Date-e._mobileDownTime>=1e3&&e.editing.enabled&&e.selection.enabled&&e.selection.allowCellSelection&&o===e._mobileDownDataField&&l===e._mobileDownId&&e.beginEdit(e._mobileDownId,e._mobileDownDataField),e._mobileDownDataField=null,e._mobileDownTime=null,e._mobileDownId=null,t.preventDefault(),t.stopPropagation()}},e._scrollContent.onpointerdown=t=>{e._scrollContentScroll=!1;const o=e=>new PointerEvent(e,{bubbles:!0,cancelable:!0,composed:!0,pointerId:42,pointerType:"mouse",clientX:t.clientX,clientY:t.clientY,pageX:t.pageX,pageY:t.pageY});setTimeout((()=>{if(e._scrollContentScroll)e._hideActionButtons();else{const l=(e.enableShadowDOM?e.shadowRoot:e.getRootNode()).elementsFromPoint(t.clientX,t.clientY);if(l[2]){if(e.selection.enabled&&e.selection.allowCellSelection){const l=(e.enableShadowDOM?e.shadowRoot:e.getRootNode()).elementsFromPoint(t.clientX,t.clientY);e._mobileDownDataField=null,e._mobileDownTime=null,e._mobileDownId=null;for(let a=0;a<l.length;a++){const n=l[a];if(n.closest&&n.closest("smart-grid-cell")){e._hideActionButtons();const a=n.closest("smart-grid-cell").cell;return e._mobileDownTime=new Date,e._mobileDownId=a.row.id,e._mobileDownDataField=a.column.dataField,e._dragSelectionStartDataField=a.column.dataField,e._dragSelectionStartRow=a.row,e._mobileSelect=!0,l[2].dispatchEvent(o("pointerdown")),e._mobileSelect=!1,t.stopPropagation(),void t.preventDefault()}}}if(l[2].classList.contains("smart-grid-add-row-button"))e._hideActionButtons(),l[2].dispatchEvent(o("click"));else if(l[2].classList.contains("smart-summary-placeholder")||l[2].classList.contains("summary-value-part"))e._hideActionButtons(),l[2].dispatchEvent(o("pointerup"));else if(l[2].closest("smart-menu-item")){e._hideActionButtons();const t=l[2].closest("smart-menu-item");l[2].closest("smart-menu")._menuItemSelectionHandler(t)}else{if(l[2].dispatchEvent(o("pointerdown")),e._lastMobileClickRange){const o=e._lastMobileClickRange;let l=!0;o.left<=t.pageX&&o.left+o.right>=t.pageX&&(l=!1),l&&e._hideActionButtons()}else e._hideActionButtons();const a=(o,l)=>{if(o&&o.autoShowActionButton){const a=l.getBoundingClientRect(),n=e.offset(l);if(n.left<=t.pageX&&n.left+a.width-6>=t.pageX){if(!e.hasColumnMenu(o))return;e._lastMobileClickRange={left:n.left,right:n.left+a.width-6},l._showActionButton()}else l._hideActionButton()}};for(let t=0;t<e._columnElements.length;t++){const o=e._columnElements[t];a(o.column,o)}}}}}),300),t.stopPropagation()};let t=0;const o=()=>{const t=e._scrollContent.scrollLeft,o=e._scrollContent.scrollTop;e._scrollView.vScrollBar.value=o,e._scrollView.hScrollBar.value=t,e._scrollContentScroll=!0};e._scrollContent.onscroll=()=>{cancelAnimationFrame(t),t=0,t=requestAnimationFrame(o)},e._scrollContentView=document.createElement("div"),e._scrollContentView.style.width=e._scrollView.scrollWidth+"px",e._scrollContentView.style.height=e._scrollView.scrollHeight+"px",e._scrollContent.appendChild(e._scrollContentView),e.$.scrollView.appendChild(e._scrollContent)}}_render(){const e=this;if(e.isInitialized||(e.onBeforeInit&&(e.onBeforeInit(e),e.onBeforeInit=null),e.$.fireEvent("beforeInit",{grid:e}),e.header.visible&&(e.header.buttons.indexOf("views")>=0||e.header.buttons.indexOf("states")>=0)&&e._updateKanbanTaskFields()),e._setupMobile(),(()=>{if(null===e.dataSource)e.dataSource=new Smart.DataAdapter;else if(Array.isArray(e.dataSource)||"string"==typeof e.dataSource){let t=[];if(e.dataSourceSettings.dataFields&&e.dataSourceSettings.dataFields.length>0)e.dataSource=new Smart.DataAdapter({dataSource:e.dataSource,dataSourceType:e.dataSourceSettings.dataSourceType,dataFields:e.dataSourceSettings.dataFields,keyDataField:e.dataSourceSettings.keyDataField,parentDataField:e.dataSourceSettings.parentDataField,childrenDataField:e.dataSourceSettings.childrenDataField,groupBy:e.dataSourceSettings.groupBy||e.grouping.groupBy,mapChar:e.dataSourceSettings.mapChar,root:e.dataSourceSettings.root,record:e.dataSourceSettings.record,autoGenerateColumns:e.dataSourceSettings.autoGenerateColumns,id:e.dataSourceSettings.id,virtualDataSource:e.dataSourceSettings.virtualDataSource,virtualDataSourceOnExpand:e.dataSourceSettings.virtualDataSourceOnExpand});else if(e.columns&&e.columns.length){for(let o=0;o<e.columns.length;o++){const l=e.columns[o];l.dataField||(l.dataField="dataField_"+Math.floor(65536*(1+Math.random())).toString(16).substring(1)),t.push({name:l.dataField,dataType:l.dataType||"string"}),l.displayField&&l.displayField!==l.dataField&&t.push({name:l.displayField,dataType:l.dataType||"string"})}e.dataSource=new Smart.DataAdapter({dataSource:e.dataSource,dataFields:t,dataSourceType:e.dataSourceSettings.dataSourceType,keyDataField:e.dataSourceSettings.keyDataField,parentDataField:e.dataSourceSettings.parentDataField,childrenDataField:e.dataSourceSettings.childrenDataField,groupBy:e.dataSourceSettings.groupBy||e.grouping.groupBy,mapChar:e.dataSourceSettings.mapChar,root:e.dataSourceSettings.root,record:e.dataSourceSettings.record,autoGenerateColumns:e.dataSourceSettings.autoGenerateColumns,id:e.dataSourceSettings.id,virtualDataSource:e.dataSourceSettings.virtualDataSource,virtualDataSourceOnExpand:e.dataSourceSettings.virtualDataSourceOnExpand})}else e.dataSource=new Smart.DataAdapter({dataSource:e.dataSource,id:e.dataSourceSettings.id,autoGenerateColumns:e.dataSourceSettings.autoGenerateColumns})}})(),e._selection={rows:[],indexes:[],columns:[],cells:[]},e.dataSource&&e.dataSource.url&&(e.appearance.displayLoadingIndicator=!0,e._setLoadingIndicatorVisibility(),e.dataSource.data={sorting:e.getSortedColumns(),filtering:e.getFilteredColumns(),grouping:e.grouping.groupBy}),e.filtering.filterRow)for(let t=0;t<e.columns.length;t++)e.columns[t]._filterEditorInitialized&&(e.columns[t]._filterEditorInitialized=!1);const t=!e.isInitialized;if(t&&(e.onInit&&(e.onInit(e),e.onInit=null),e.$.fireEvent("init",{grid:e})),e._renderColumns(!1),e._renderRows(!1),e._renderPagers(),e._renderCommandBar(),e._renderConditionalFormatting(),e._initFormulaParser(),t&&e.grouping.enabled&&e.grouping.groupBy.length&&e.dataSource&&(e.dataSource.groupBy=e.grouping.groupBy),e.appearance.allowColumnStickyPosition&&e._stickHeader(),e.header.visible&&""===e.header.template){const t=document.createElement("smart-grid-toolbar");t.headerPosition="top",t.messages=e.messages,t.locale=e.locale;let o=e.$.header;e.header.appendTo&&(o=document.querySelector(e.header.appendTo),o?o.onclick=t=>{e._headerClickHandler(t)}:o=e.$.header),o.appendChild(t),e.$.headerBar&&e.$.headerBar.remove(),e.$.headerBar=o.firstElementChild,e.$.headerBar._init(e)}if(e.isInitialized)e.refreshFilters();else{let t=!1;if(e.stateSettings.autoLoad){let o=e.stateSettings.current;!o&&e.stateSettings.allowLocalStorage&&(e.stateSettings.current="SmartGrid"+e.id,o=e.stateSettings.current);let l=null;e.stateSettings.storage&&(l=e.stateSettings.storage[o]),l&&(t=!0),!l&&e.stateSettings.allowLocalStorage&&(l=window.localStorage.getItem(o),l&&(t=!0))}if(!t){const t=[];for(let o=0;o<e.viewColumns.length;o++){const l=e.viewColumns[o];l.allowSort&&l.sortOrder&&t.push(l)}if(0===t.length&&e.sorting.sort)for(let o=0;o<e.sorting.sort.length;o++){const l=e.sorting.sort[o],a=Object.keys(l)[0],n=l[a],i=e.columnByDataField[a];i&&(t.push(i),i.sortOrder=n||"asc")}t.sort(((e,t)=>e.sortIndex-t.sortIndex));for(let o=0;o<t.length;o++){const l=t[o],a=e.appearance.allowSortAnimation;e.appearance.allowSortAnimation=!1,e.sortBy(l.dataField,l.sortOrder),e.appearance.allowSortAnimation=a}if(e.filtering.filter.length>0){for(let t=0;t<e.filtering.filter.length;t++){const o=e.filtering.filter[t];if(o){if("string"==typeof o){const t=e.filtering.filter[0],o=e.columnByDataField[t],l=e.filtering.filter[1];let a=null;if(o&&(a=e.dataSource._createFilter(o.dataType,l)),a){if(e.filtering.filterRow.visible&&!o._filterInfo){let e=[];for(let t=0;t<a.filters.length;t++)e.push(a.filters[t].value),t<a.filters.length-1&&e.push(a.logicalOperators[t]);o._filterInfo={condition:a.filters[0].condition,value:e.join(" ")}}e.addFilter(t,a,!1)}break}const t=o[0],l=o.splice(1);let a=null;if(l instanceof Smart.FilterGroup)a=l;else{const o=e.columnByDataField[t];o&&(a=e.dataSource._createFilter(o.dataType,l))}if(a){if(e.filtering.filterRow.visible){const o=e.columnByDataField[t];if(!o._filterInfo){let e=[];for(let t=0;t<a.filters.length;t++)e.push(a.filters[t].value),t<a.filters.length-1&&e.push(a.logicalOperators[t]);o._filterInfo={condition:a.filters[0].condition,value:e.join(" ")}}}e.addFilter(t,a,!1)}}}e.refreshFilters()}else{for(let t=0;t<e.columns.length;t++){const o=e.columns[t];if(o.filter){let t=null,l=o.filter;if(t=l instanceof Smart.FilterGroup?l:e.dataSource._createFilter(o.dataType,l),t){if(e.filtering.filterRow.visible&&!o._filterInfo){let e=[];for(let o=0;o<t.filters.length;o++)e.push(t.filters[o].value),o<t.filters.length-1&&e.push(t.logicalOperators[o]);o._filterInfo={condition:t.filters[0].condition,value:e.join(" ")}}e.addFilter(o.dataField,t,!1)}}}e.refreshFilters()}}}if(e.viewColumns.canNotify=!0,e.isInitialized=!0,("virtual"===e.scrolling||e.paging.enabled&&e.dataSource&&e.dataSource.virtualDataSource||e.dataSource&&e.dataSource.virtualDataSource)&&e._virtualDataRequest("dataBind"),""!==e.header.template&&e._applyTemplate(e.header.template,e.$.header),""!==e.footer.template&&e._applyTemplate(e.footer.template,e.$.footer),e._createFilterPanels(),e._refresh(),e._applyScrolling(),e.grouping.enabled&&e.grouping.autoExpandAll&&e.rowHierarchy?e.expandAllRows():e.grouping.enabled&&e.grouping.autoExpandToLevel&&e.rowHierarchy&&e.expandRowsToGroupLevel(e.grouping.autoExpandToLevel),e.onRender&&(e.onRender(t),e.onRender=null),e.isRendered=!0,"auto"===e.layout.rowHeight&&(e._refreshLayout(),e.filtering.enabled&&e.filtering.filterRow.visible&&e._refreshFilterRowEditors(),e._recycle()),t){if(e.stateSettings.autoLoad){let t=e.stateSettings.current,o=null;e.stateSettings.storage&&(o=e.stateSettings.storage[t]),!t&&e.stateSettings.allowLocalStorage&&(e.stateSettings.current="SmartGrid"+e.id,t=e.stateSettings.current),!o&&e.stateSettings.allowLocalStorage&&(o=window.localStorage.getItem(t)),o&&("string"==typeof o&&(o=JSON.parse(o)),e._loadState(o))}if(e.onAfterInit&&(e.onAfterInit(e),e.onAfterInit=null),e.$.fireEvent("afterInit",{grid:e}),e.isRendering=!1,e.whenRenderedCallbacks){for(let t=0;t<e.whenRenderedCallbacks.length;t++)e.whenRenderedCallbacks[t]();e.whenRenderedCallbacks=[]}!e.dataSource||e.dataSource.url||e.dataSource.virtualDataSource||e.onLoad&&e.onLoad(e)}"kanban"===e.view?e._initKanbanView():"scheduler"===e.view&&e._initSchedulerView()}_initFormulaParser(){const e=this;if(e.formulas){class t{constructor(e){const t=this;let o;try{o=new formulaParser.Parser}catch(e){throw new Error("Smart.FormulaParser: Missing reference to 'formula-parser.min.js'.")}o.on("callCellValue",t._callCellValue.bind(t)),o.on("callRangeValue",t._callRangeValue.bind(t)),t.dataTable=e,t.parser=o}_getFormula(e){const t=this,o="A".charCodeAt(0);let l=0,a="";const n=e;if(t.dataTable._formulas||(t.dataTable._formulas=[]),t.dataTable._formulas[e])return t.dataTable._formulas[e];for(let n=0;n<t.dataTable.columns.length;n++){const i=t.dataTable.columns[n],r=String.fromCharCode(o+l);l++,l>=26&&(l=0,a+="A"),e.indexOf(i.label)>=0?e=e.replaceAll(i.label,a+r):e.indexOf(i.dataField)>=0&&(e=e.replaceAll(i.dataField,a+r))}return t.dataTable._formulas[n]=e,e}_callCellValue(e,t){const o=this,l=o.dataTable,a=e.column.index,n=e.row.index,i=l.columns[a].dataField;let r=l.dataSource[n][i];const s=l.rows[n];if(s){const e=s.getCell(i);e&&e.formula&&(r=o._getFormula(e.formula))}"string"==typeof r&&/=.+/.test(r)?r=o.parse(r.slice(1)):"string"==typeof r&&"number"===l.columns[a].dataType&&(r=parseFloat(r)),t(r)}_callRangeValue(e,t,o){const l=this.dataTable,a=l.dataSource,n=[];for(let o=e.row.index;o<=t.row.index;o++){const i=a[o],r=[];for(let o=e.column.index;o<=t.column.index;o++){let e=i[l.columns[o].dataField];e=isNaN(e)?0:parseFloat(e),isNaN(e)&&(e=0),r.push(e)}n.push(r)}n&&o(n)}parse(e){const t=this.parser.parse(this._getFormula(e));return null!==t.result?t.result:t.error}}e._formulaParser=new t(e)}}get _viewRows(){const e=this;if(e.__viewRows)return e.__viewRows;e._nearRowsAdded||(e._nearRowsAdded=[],e._farRowsAdded=[]);const t=e.rows.toArray?e.rows.toArray():[],o=e.rowHierarchy?e.rowHierarchy:t,l=[].concat(e._frozenNearDefaultRows,e._nearRowsAdded,o,e._farRowsAdded,e._frozenFarDefaultRows);return e.__viewRows=l,l}_toHex(e){if(-1!==e.indexOf("#"))return e;const t=/rgb\((\d+), (\d+), (\d+)\)/g.exec(e);return t?"#"+(parseFloat(t[1]).toString(16).padStart(2,"0")+parseFloat(t[2]).toString(16).padStart(2,"0")+parseFloat(t[3]).toString(16).padStart(2,"0")).toUpperCase():"#FFFFFF"}_renderConditionalFormatting(e){const t=this,o=t.conditionalFormatting;if(!o||0===o.length)return;if(!t._defaults){const e=getComputedStyle(t);t._defaults={fontFamily:e.fontFamily,fontSize:e.fontSize,text:t._toHex(e.color),highlight:t._toHex(e.backgroundColor)}}t._formatter||(t._formatter=new Smart.Utilities.ConditionalFormatter(t.dataSource)),e&&(t._formatter=new Smart.Utilities.ConditionalFormatter(t.dataSource),delete t._conditionalFormatting);const l=t._defaults,a=t._formatter,n=[],i=function(e){if("all"===e){if(t.columns&&t.columns.map){const e=[];for(let o=0;o<t.columns.length;o++){const l=t.columns[o];l.dataField.startsWith("task")||l.autoGenerated||"number"!==l.dataType&&"date"!==l.dataType||e.push(l.dataField)}return e}return[]}return[e]};for(let e=0;e<o.length;e++){o[e]=Object.assign({column:"all",condition:"lessThan",firstValue:0,secondValue:1,fontFamily:l.fontFamily,fontSize:l.fontSize,text:l.text,highlight:l.highlight},o[e]);const t=o[e],r=i(t.column),s=t.condition;a.color=t.highlight,a.comparator=t.firstValue,a.min=t.firstValue,a.max=t.secondValue;const d=a.format(s,r);for(let e in d){const o=d[e];for(let e in o){const l=o[e];l.color=t.text,l.fontFamily=t.fontFamily,l.fontSize=t.fontSize}}n.push(d)}if(t._formattingPanel&&(t._formattingPanel.items=o),0===n.length)return n[0];const r={};for(let e=0;e<n.length;e++){const t=n[e];for(let e in t){const o=t[e];if(0!==Object.keys(o).length){r[e]||(r[e]={});for(let t in o)r[e][t]=Object.assign({},r[e][t],o[t])}}}t._conditionalFormatting=r,e&&t._recycle(!1)}_stickHeader(){const e=this;e._stickyHeaderHandler=function(){e._handleStickyHeader()},e.$.columnHeader.style.top="",e.$.columnHeader.classList.remove("smart-columns-sticky");let t=e.parentNode;for(e.isInShadowDOM&&t===e.getRootNode()&&(t=e.getRootNode().host);t!==document&&t;)t.addEventListener("scroll",e._stickyHeaderHandler),t=t.parentNode,e.isInShadowDOM&&t===e.getRootNode()&&(t=e.getRootNode().host);try{null!==window.top&&window.top!==window.self&&window.top.document.addEventListener("scroll",e._stickyHeaderHandler)}catch(e){}e._handleStickyHeader()}_unstickHeader(){const e=this;e.$.columnHeader.style.top="",e.$.columnHeader.classList.remove("smart-columns-sticky");let t=e.parentNode;for(;t!==document.body;)t.removeEventListener("scroll",e._stickyHeaderHandler),t=t.parentNode,e.isInShadowDOM&&t===e.getRootNode()&&(t=e.getRootNode().host);try{(""!==document.referrer||window.frameElement)&&null!==window.top&&window.top!==window.self&&window.top.document.removeEventListener("scroll",e._stickyHeaderHandler)}catch(e){}}_handleStickyHeader(){const e=this;if(e.appearance.allowColumnStickyPosition)if(e.$.columnHeader.classList.add("smart-columns-sticky"),0===document.scrollTop&&0===e.parentElement.scrollTop)e.$.columnHeader.style.top="";else{let t=e.parentNode,o=0;for(;t!==document.body;)o+=parseInt(t.scrollTop),t=t.parentNode,e.isInShadowDOM&&t===e.getRootNode()&&(t=e.getRootNode().host);const l=parseInt(e.clientTop+o);e.$.columnHeader.style.top=l+"px";let a=0;window.top!==window.self&&parseInt(window.top.scrollY)>parseInt(e._offsetTop(window.frameElement))&&(a=parseInt(window.top.scrollY)-parseInt(e._offsetTop(window.frameElement))),window.scrollY+a>e.offsetTop&&(e.$.columnHeader.style.top=parseInt(window.scrollY)-parseInt(e.offsetTop)+l+a+"px")}}_scrollHandler(){this._handleStickyHeader()}_initializeRowNumberColumn(){const e=this;if(e._frozenNearColumns&&e._frozenNearColumns.length>0&&e._frozenNearColumns[0].rowHeaderColumn)return void(e._frozenNearColumns[0].visible=e.appearance.showRowHeaderNumber||e.appearance.showRowHeader);const t=new Smart.Grid.Column({dataField:"_rowHeaderColumn",label:"",allowSelect:!1,freeze:!0,visible:!0,grid:e,autoGenerated:!0,rowHeaderColumn:!0,cellsAlign:"center"}),o=e.rows?e.rows.length:e.dataSource?e.dataSource.length:0;let l=e.appearance.showRowHeaderNumber?t._measureSize(o):30;e.layout.autoGenerateColumnWidth&&(l=e.layout.autoGenerateColumnWidth),e.appearance.showRowComments&&(l=25,t.minWidth=25),t.width=l,t.createElement();const a=new Smart.Observable(t,t.observables);e.viewColumns.splice(0,0,a),e._frozenNearColumns.splice(0,0,a)}_initializeColumns(){const e=this;if("number"==typeof e.columns){const t=[],o="A".charCodeAt(0);let l="",a=0;for(let n=0;n<e.columns;n++){let i=n+1;const r=String.fromCharCode(o+a);a++;const s=l+r;"number"!==e.appearance.autoGenerateColumnLabelMode&&(i=l+r),t.push({align:"center",label:i,dataField:s,width:100}),a>=26&&(a=0,l+="A")}e._boundColumns=t}else e._boundColumns=Array.isArray(e.columns)?[...e.columns]:[...e.columns.toArray()];e._initColumns=e.columns,e.columnByDataField=[],e.viewColumns=[],e.columns=new Smart.ObservableArray,e._frozenFarColumns=[],e._frozenNearColumns=[],e._summaryRowCount=1;let t=0;const o=function(t){if(e.dataSource.dataFields){const o=e.dataSource.dataFields.find((e=>{if(e.name===t.dataField)return e})),l=o&&o.dataType||"string";t.dataType||(t.dataType=l)}};if(0===e._boundColumns.length&&e.dataSource&&e.dataSource[0]&&!1!==e.dataSource.autoGenerateColumns){const t=e.dataSource[0];if(t.$&&t.$.isEmpty&&e.dataSource.dataFields)for(let t=0;t<e.dataSource.dataFields.length;t++){const o=e.dataSource.dataFields[t],l=e._boundColumns.length,a={index:l,visibleIndex:l,label:o.name,dataField:o.name,dataType:o.dataType};e._boundColumns.push(a)}else for(let l in t){if(l.startsWith("_")||"$"===l)continue;const t=e._boundColumns.length,a={index:t,visibleIndex:t,label:l,dataField:l};o(a),e._boundColumns.push(a)}}for(let l=0;l<e._boundColumns.length;l++){let a=e._boundColumns[l];if("string"==typeof a){if(e.dataSource.dataFields){const t=e.dataSource.dataFields.find((e=>{if(e.name===a)return e}));a={label:a,dataField:a,dataType:t&&t.dataType||"string"}}}else o(a);a.visibleIndex=l,a.index=l,a.grid=e,a.label&&/<.+?>/.test(a.label)&&a.label.replace&&("all"===e.dataSourceSettings.sanitizeHTML?a.label=a.label.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/'/g,"&#39;").replace(/"/g,"&quot;"):"blackList"===e.dataSourceSettings.sanitizeHTML&&(a.label=window.Smart.Utilities.Core.escapeHTML(a.label)));const n=new Smart.Grid.Column(a);e.onColumnInit&&e.onColumnInit(l,n);for(let t in n)-1!==n.properties.indexOf(t)||t.startsWith("_")||e.error(e.localize("invalidColumnProperty",{elementType:"Grid",propertyName:t,type:n.dataField||"Column"}));delete a.grid,delete a.dataType,delete a.index,delete a.visibleIndex,n.grid=e,e.columns.push(n),n._dataField&&(e.columnByDataField[n._dataField]=n);const i=e.columns[e.columns.length-1];e._summaryRowCount=Math.max(e._summaryRowCount,n.summary.length),n.freeze?!0===n.freeze||"near"===n.freeze?(e.viewColumns.splice(t++,0,i),e._frozenNearColumns.push(i)):"far"===n.freeze&&e._frozenFarColumns.push(i):e.viewColumns.push(i),e.columnByDataField[n.dataField]?(i.parent=e.columnByDataField[n.dataField],e.columnByDataField[n.dataField].children||(e.columnByDataField[n.dataField].children=[]),e.columnByDataField[n.dataField].children.push(i),n.valueField=n.dataField,n.dataField+="_"+e.columnByDataField[n.dataField].children.length,n.displayField=n.valueField,e.columnByDataField[n.dataField]=i):e.columnByDataField[n.dataField]=i,e.onColumnInserted&&!e.isInitialized&&e.onColumnInserted(l,n.getState())}e.viewColumns=e.viewColumns.concat(e._frozenFarColumns),e.$.content.setAttribute("aria-colcount",e._boundColumns.length);let l=0;if((e.appearance.showRowHeaderNumber||e.appearance.showRowHeader)&&(e._initializeRowNumberColumn(),l++),e.rowDetail.enabled){const t=20,o=new Smart.Grid.Column({dataField:"_rowDetailColumn",allowSelect:!1,visible:e.rowDetail.visible,label:"",grid:e,freeze:!0,rowDetailColumn:!0,autoGenerated:!0,cellsAlign:"center",width:t,minWidth:t}),a=new Smart.Observable(o,o.observables);e.rowDetailColumn=a,"near"===e.rowDetail.position?(e.viewColumns.splice(l,0,a),o.freeze="near",a.freeze="near",e._frozenNearColumns.splice(l,0,a)):(e.viewColumns.push(a),e._frozenFarColumns.splice(0,0,a)),l++}const a=new Smart.Grid.Column({dataField:"_adaptiveColumn",allowSelect:!1,visible:!1,label:"",grid:e,freeze:"far",adaptiveColumn:!0,autoGenerated:!0,cellsAlign:"center",width:30});new Smart.Observable(a,a.observables).canNotify=!1;const n=new Smart.Grid.Column({dataField:"_commandColumn",allowSelect:!1,visible:e.editing.enabled&&e.editing.commandColumn.visible&&!e.editing.commandColumn.inline,label:"",grid:e,freeze:"far",commandColumn:!0,autoGenerated:!0,align:"center",cellsAlign:"center",width:""}),i=new Smart.Observable(n,n.observables);i.canNotify=!1,e.editing.commandColumn.visible&&("near"===e.editing.commandColumn.position?(n.freeze="near",i.freeze="near",e.viewColumns.splice(l,0,i),e._frozenNearColumns.splice(l,0,i)):(e.viewColumns.push(i),e._frozenFarColumns.splice(0,0,i))),e._commandColumn=i;const r=new Smart.Grid.Column({allowSelect:!1,visible:e.selection.enabled&&e.selection.checkBoxes.enabled,dataField:"_checkBoxColumn",label:"",freeze:e.selection.checkBoxes.position,grid:e,selectionColumn:!0,autoGenerated:!0,cellsAlign:"center",width:32}),s=new Smart.Observable(r,r.observables);if(e.selection.checkBoxes.enabled&&("near"===r.freeze?(e.viewColumns.splice(l,0,s),e._frozenNearColumns.splice(l,0,s)):(e.viewColumns.push(s),e._frozenFarColumns.splice(0,0,s))),e._selectionColumn=s,e._selectionColumn.canNotify=!1,e.editing.addNewColumn.visible){const t=new Smart.Grid.Column({dataField:"_addNewColumn",allowSelect:!1,visible:!0,title:e.localize("addNewColumn"),label:"",cellsClassName:"smart-add-new-column",className:"smart-add-new-column smart-icon smart-grid-icon show smart-icon-plus",grid:e,adaptiveColumn:!1,autoGenerated:!0,cellsAlign:"center",width:90}),o=new Smart.Observable(t,t.observables);e.viewColumns.push(o),e._addNewColumn=o,e._addNewColumn.canNotify=!1}e._observeColumns(),e._templateColumns()}get styleProperties(){return["grid-template-columns","--smart-grid-row-height","--smart-grid-column-header-height","--smart-grid-group-header-height","--smart-grid-filter-footer-height","--smart-grid-group-row-vertical","--smart-grid-group-row-horizontal-offset","--smart-grid-freeze-splitter-size","--smart-grid-resize-line-size","--smart-grid-footer-height","--smart-grid-header-height"]}_templateColumns(){const e=this,t=getComputedStyle(e),o=t.getPropertyValue("--smart-grid-template-columns").trim();if(e._rowGap=0,e._columnGap=0,e._maxHeight=parseInt(t.maxHeight),e._minHeight=parseInt(t.minHeight),"none"!==o){let t=0;for(let o=0;o<e.viewColumns.length;o++)e.viewColumns[o].autoGenerated&&(t+=e.viewColumns[o].visible?e.viewColumns[o].width:0);let l=[];const a=document.createElement("div");a.style.display="grid",a.style.gridTemplateColumns=o;for(let t=0;t<e.columns.length;t++)a.innerHTML+="<div></div>";a.style.width=e.clientWidth-t+"px",e.$.root.appendChild(a);const n=o.split(" ");for(let t=0;t<e.columns.length;t++)l[t]=a.children[t].offsetWidth,"auto"===n[t]&&(l[t]=null);a.parentNode.removeChild(a);let i=0;for(let t=0;t<e.viewColumns.length;t++){const o=e.viewColumns[t];o.autoGenerated||l[i]&&(o.width=o.templateWidth=l[i++])}}else for(let t=0;t<e.viewColumns.length;t++){const o=e.viewColumns[t];o.autoGenerated||o.templateWidth&&(o.width=o.templateWidth=null)}}setColumns(e){const t=this;if(null===e)return void(t.columns=[]);t.beginUpdate(),t.columns.canNotify=!1;let o=[],l=[];for(let l=0;l<e.length;l++){const a=e[l];let n=!0;for(let e=0;e<t.columns.length;e++)if(t.columns[e].dataField===a.dataField){n=!1;break}n&&o.push(a)}const a=e.map((e=>e.dataField));for(let e=0;e<t.columns.length;e++){const o=t.columns[e];-1===a.indexOf(o.dataField)&&l.push(o)}l.forEach((e=>{const o=t.columns.indexOf(e);o>=0&&t.columns.splice(o,1)}));for(let e=0;e<o.length;e++)t.columns.push(o[e]);if(t.columns.canNotify=!0,t.endUpdate(),t._columnGroups=[],t._columnHeights=0,t.viewColumns)for(let e=0;e<t.viewColumns.length;e++){const o=t.viewColumns[e],l=o.element;o.top=0,o.level=0,l&&(l.style.top="",l.style.height="",l.style.lineHeight="")}if(t._renderColumns(),t.__columnHeaderHeight=null,e){t.beginUpdate();const o=t.context;t.context=document;for(let o=0;o<e.length;o++){const l=e[o],a=t.columnByDataField[l.dataField];["allowExport","allowFreeze","allowNull","allowGroup","allowSelect","verticalAlign","columnGroup","cellsVerticalAlign","autoCloseMenu","autoShowActionButton","autoShowSortButton","autoShowFilterButton","allowLabelAnimation","allowActionButtonAnimation","allowSortButtonAnimation","allowHide","allowDelete","allowEdit","allowSummary","allowHeaderEdit","allowFilter","allowSort","allowSortToggleOnClick","allowResize","allowReorder","description","icon","menuItems","summary","cellsFormat","className","rowSpan","cellsClassName","cellsCSSRules","formatSettings","formatFunction","sortIndex","sortOrder","sortComparator","groups","group","filtered","filterEditor","filter","filterMenuMode","defaultValue","dataField","displayField","label","labelTemplate","dataType","align","cellsWrap","cellsAlign","minWidth","width","visible","_visible","freeze","showActionButton","selected","showIcon","highlight","showDescriptionButton","treeColumn","statusColumn","value","valueField","onAction","title","showCustomButton","showFilterButton","showSortButton","editor","template","visibleIndex","validationRules"].forEach((e=>{void 0!==l[e]&&(a[e]=l[e])}))}t.context=o,t.endUpdate(!1)}t.refresh()}onAttached(){const e=this;if(!e._scrollView){e._scrollView=new Smart.Utilities.Scroll(e,e.$.horizontalScrollBar,e.$.verticalScrollBar);const t=e._scrollView.hScrollBar;e._scrollView.vScrollBar.onChange=e._verticalScrollbarHandler.bind(e),t.onChange=e._horizontalScrollbarHandler.bind(e)}if(e.isRendered&&e.isCompleted&&(e._isDestroyed||e.behavior.autoDestroy)){if(e.header.visible&&""===e.header.template){let t=e.$.header;e.header.appendTo&&(t=document.querySelector(e.header.appendTo),t?t.onclick=t=>{e._headerClickHandler(t)}:t=e.$.header),t.innerHTML='<smart-grid-toolbar header-position="top"></smart-grid-toolbar>',e.$.headerBar=t.firstElementChild;const o=e.$.headerBar;o.messages=e.messages,o.locale=e.locale,e.$.headerBar._init(e),o.render(),e.header.onInit&&e.header.onInit(e.$.headerBar)}e._render()}}destroy(){const e=this;if(!e.isRendered)return;e._isDestroyed=!0,["_dialogChart","_dialogAddRow","_dialogEdit","_dialogDelete","_dialogRowDetail","_dialogAddColumn"].forEach((t=>{e[t]&&(e[t].close(),e[t]=null)})),e.menu&&(e.menu.ownerElement=null,e.menu.remove(),e.menu=null);const t=e.$.headerBar;if(t){const e=t.$.headerDropDown;e&&e.remove()}e._resetCachedLayout();const o=e._scrollView.hScrollBar,l=e._scrollView.vScrollBar;if(l.ownerElement=null,o.ownerElement=null,l.onChange=null,o.onChange=null,e._scrollView&&(e._scrollView.unlisten(),delete e._scrollView),e._columnElements)for(let t=0;t<e._columnElements.length;t++)e._columnElements[t]._detach();if(e._columnElements=null,e._rowElements)for(let t=0;t<e._rowElements.length;t++)e._rowElements[t]._detach();e._rowElements=null,e.rows=[],e.rowById=[],e._initColumns=[],e.columnByDataField=[],e.viewColumns=[],e._columnToResizeElement=null;let a=Array.isArray(e.columns)?[...e.columns]:[...e.columns.toArray()];a=a.map((e=>e.data?(void 0!==e.data.visibleIndex&&delete e.data.visibleIndex,void 0!==e.data.index&&delete e.data.index,void 0!==e.data.grid&&delete e.data.grid,e.data):e)),e.rows.notifyFn=null,e.columns.notifyFn=null,e.columns.notify=null,e.columns._array=[],e.columns=a,e._boundColumns=[],e._filterPanels=[],e._frozenFarColumns=[],e._frozenNearColumns=[],e._frozenNearDefaultRows=[],e._frozenFarDefaultRows=[],e._frozenFarRows=[],e._frozenNearRows=[],e._selection&&e._selection.selectionRect&&(e._selection.selectionRect.parentNode&&e._selection.selectionRect.parentNode.removeChild(e._selection.selectionRect),e._selection.selectionRect=null),e._selection={rows:[],indexes:[],columns:[],cells:[]},e.__autoHeightRows=null,e._visibleRows=null,e.__viewRows=null,e.__clientSize=null,e.__scrollHeight=null,e.__scrollWidth=null,e.__parentCells=null,e._selectionColumn=null,e._adaptiveColumn=null,e._commandColumn=null,delete e._columnFarContainerComputedStyle,delete e._columnContainerComputedStyle,delete e._columnNearContainerComputedStyle,e._inputOverlay&&(e._inputOverlay.parentNode&&e._inputOverlay.parentNode.removeChild(e._inputOverlay),e._inputOverlay=null),e._firstVisibleColumn=null,e._lastVisibleColumn=null,e._toggledRow=null,Smart(e._selector)&&(delete Smart(e._selector)._properties,Smart(e._selector)),delete e._selector,delete e._initProperties}onDetached(){const e=this;e.behavior.autoDestroy&&e.destroy()}_observeColumns(){const e=this,t=function(t,o,l,a){if(l!==a||"selected"===o){if(null==l&&null==a)return;if(l&&"object"==typeof l&&Array.isArray(l)&&a&&"object"==typeof a&&Array.isArray(a)&&JSON.stringify(l)===JSON.stringify(a))return;t.propertyChanged(o,l,a),e.onColumnChange?t.stateProps.indexOf(o)>=0&&e.onColumnChange(t,o,l,a):e.$.fireEvent("columnChange",{column:t,propertyName:o,oldValue:l,value:a})}};for(let o=0;o<e.viewColumns.length;o++){const l=e.viewColumns[o];l.rowHeaderColumn||(l.onAction=function(){e._openMenu(this)}),l.autoGenerated&&l.notify((function(e){l.canNotify=!1,t(l,e.propertyName,e.oldValue,e.newValue),l.canNotify=!0}))}e.columns.notify((function(o){let l=null;if(o.path)return e.columns.canNotify=!1,t(o.target,o.propertyName,o.oldValue,o.newValue),void(e.columns.canNotify=!0);e.columns.canNotify=!1;let a=0;switch(o.action){case"length":return void(e.columns.canNotify=!0);case"add":{const t=function(t){if(l=o.object[t],l instanceof Smart.Grid.Column==0){l.grid=e,l=new Smart.Grid.Column(l);const a=e.columns.canNotify;e.columns.canNotify=!1,o.object[t]=l,l=o.object[t],e.columns.canNotify=a}l.grid=e,l.onAction=function(){e._openMenu(this)},l.freeze?e._frozenNearColumns.push(l):"far"===l.freeze&&e._frozenFarColumns.push(l);let a=e.viewColumns.length-e._frozenFarColumns.length,n=0;if(e._frozenNearColumns.forEach((e=>{e.autoGenerated&&n++})),t<e.columns.length?e.viewColumns.splice(t+n,0,l):e.viewColumns.splice(a,0,l),e.columnByDataField[l.dataField]){e.columnByDataField[l.dataField].children.push(l),l.parent=e.columnByDataField[l.dataField],l.valueField=l.dataField;const t=l.dataField+"_"+l.parent.children.length;e.columnByDataField[t]=l,l.dataField=t}else e.columnByDataField[l.dataField]=l;if(e.dataSource&&e.dataSource.dataFields){let t=!1;for(let o=0;o<e.dataSource.dataFields.length;o++)e.dataSource.dataFields[o].name===l.dataField&&(t=!0);t||e.dataSource.dataFields.push({name:l.dataField,dataType:l.dataType||"string"})}if(!e._dragDrop&&e.onColumnInserted){e._onColumnInsertData||(e._onColumnInsertData=[],e._onColumnInsertIndexes=[]);const o=l.getState();o.dataField=l.dataField,e._onColumnInsertData.push(o),e._onColumnInsertIndexes.push(t),e._onColumnInsertTimer&&clearTimeout(e._onColumnInsertTimer),e._onColumnInsertTimer=setTimeout((()=>{e.onColumnInserted(e._onColumnInsertIndexes,e._onColumnInsertData),delete e._onColumnInsertIndexes,delete e._onColumnInsertData}),50)}};delete e.__measuredColumnHeight;for(let e=0;e<o.addedCount;e++)t(o.index+e);break}case"update":l=o.object[o.index],l instanceof Smart.Grid.Column==0&&(l=new Smart.Grid.Column(l)),l.grid=e;for(let t=0;t<o.index;t++)e.viewColumns[t].autoGenerated&&a++;e.viewColumns[a+o.index]=l,e.columnByDataField[l.dataField]=l,e.onColumnUpdated&&e.onColumnUpdated(o.index,l);break;case"remove":{l=o.removed[0];let t=o.index,n=e.viewColumns.indexOf(l);if(-1===n){for(let o=0;o<=t;o++)e.viewColumns[o].autoGenerated&&a++;e.viewColumns.splice(a+t,1)}else e.viewColumns.splice(n,1);if(l){if(l.filter&&e.removeFilter(l.dataField),l.sortOrder&&e.removeSort(l.dataField),e.removeGroup(l.dataField),l._dataField){const t=e.columnByDataField[l._dataField];t&&t.dataField===l.dataField&&delete e.columnByDataField[l._dataField]}delete e.columnByDataField[l.dataField]}if(e._dragDrop||e.onColumnRemoved&&e.onColumnRemoved(o.index,l),e.columnGroups&&(e._columnGroups=[],e._columnHeights=0,e.viewColumns))for(let t=0;t<e.viewColumns.length;t++){const o=e.viewColumns[t],l=o.element;o.top=0,o.level=0,l&&(l.style.top="",l.style.height="",l.style.lineHeight="")}break}}e._initializeColumnGroupsHierarchy(),e._refreshColumnsResponsiveVisibility(),e._createColumnHeaderCellElements(),e._templateColumns(),e.refresh(),e.columnGroups&&e._columnGroups.length>0&&e._renderColumnGroupHeaders(),e.columns.canNotify=!0}))}get _scrollWidth(){const e=this;if(e.__scrollWidth)return e.__scrollWidth;let t=0;for(let o=0;o<e.viewColumns.length;o++){const l=e.viewColumns[o];l.visible&&(t+=l.computedWidth)}return t=parseInt(t),"card"===e.view&&(t=0),e.__scrollWidth=t,e._scrollView.scrollWidth=t-e._clientSize.width,e.__scrollWidth}_horizontalScrollbarHandler(){const e=this;e.closeMenu(),e.isScrolling=!0,e.isHScrolling=!0,e._hScrollTimer&&clearTimeout(e._hScrollTimer),e._hScrollTimer=setTimeout((()=>{e._summaryRowDialog&&e._summaryRowDialog.classList.contains("open")&&e._summaryRowDialog.close(),e._recycle(),e.isScrolling=!1,e.isHScrolling=!1}))}_mouseWheelNative(e,t){const o=this;void 0===o._scrollWheelContent&&(o._scrollWheelContent=document.createElement("div"),o._scrollWheelContent.style.width="100%",o._scrollWheelContent.style.height="100%",o._scrollWheelContent.style.position="absolute",o._scrollWheelContent.style.left="0px",o._scrollWheelContent.style.top="0px",o._scrollWheelContent.style.background="white",o._scrollWheelContent.style.zIndex=9999,o._scrollWheelContent.style.opacity=0,o._scrollWheelContent.style.overflow="auto",o._scrollWheelContent.style.visibility="hidden");let l=0;const a=()=>{if(t){const t=o._scrollWheelContent.scrollLeft;o._scrollView.hScrollBar.value=t,t===e&&o._scrollWheelContent.remove()}else{const t=o._scrollWheelContent.scrollTop;o._scrollView.vScrollBar.value=t,t===e&&o._scrollWheelContent.remove()}};o._scrollWheelContent.onscroll=()=>{cancelAnimationFrame(l),l=0,l=requestAnimationFrame(a)},o._scrollWheelContentView||(o._scrollWheelContentView=document.createElement("div"),o._scrollWheelContent.appendChild(o._scrollWheelContentView)),o._scrollWheelContentView.style.width=o.offsetWidth+o._scrollView.scrollWidth+"px",o._scrollWheelContentView.style.height=o.offsetHeight+o._scrollView.scrollHeight+"px",o.$.scrollView.appendChild(o._scrollWheelContent),o._scrollWheelContent.scrollTop=o._scrollView.vScrollBar.value,o._scrollWheelContent.scrollLeft=o._scrollView.hScrollBar.value,!0===t?o._scrollWheelContent.scrollTo({top:o._scrollView.vScrollBar.value,left:e,behavior:"smooth"}):o._scrollWheelContent.scrollTo({top:e,left:o._scrollView.hScrollBar.value,behavior:"smooth"})}_mouseWheelHandler(e){const t=this;if(t._scrollView.hScrollBar.$.hasClass("smart-hidden")&&t._scrollView.vScrollBar.$.hasClass("smart-hidden"))return;if(42===e.pointerId)return;if(t._isUpdating)return;if(t.editing.isEditing)return;if(!t.behavior.allowMouseWheel)return;const o=t.querySelector("smart-grid-toolbar");if(o&&o.$.headerDropDown.classList.contains("open"))return;let l=!1;if(e.wheelDeltaY?120!==Math.abs(e.wheelDeltaY)&&240!==Math.abs(e.wheelDeltaY)&&360!==Math.abs(e.wheelDeltaY)&&(l=!0):0===e.deltaMode&&(l=!0),t.disabled||t._scrollView.vScrollBar.$.hasClass("smart-hidden")||e.shiftKey||!e.deltaY){if(!t.disabled&&(!t._scrollView.hScrollBar.$.hasClass("smart-hidden")||e.shiftKey)){e.stopPropagation(),e.preventDefault();let o=160;const a=0===e.deltaX?e.wheelDelta:e.deltaX;a<0&&(o=-160),Math.abs(a)>=100&&!l&&!Smart.Utilities.Core.Browser.Firefox?t._mouseWheelNative(t._scrollView.scrollLeft+o,!0):t._scrollView.scrollLeft+=a}}else{const o=t.scrollTop;if(0===o&&e.deltaY<0||o===t.scrollHeight&&e.deltaY>0)return;e.stopPropagation(),e.preventDefault();let a=15*t.layout.rowMinHeight;if(e.deltaY<=0&&(a=-15*t.layout.rowMinHeight),Math.abs(e.deltaY)>=100&&!l&&!Smart.Utilities.Core.Browser.Firefox)t._mouseWheelNative(t._scrollView.scrollTop+a);else{t._wheelrafId=0;const o=()=>{t._scrollView.scrollTop+=e.deltaY};cancelAnimationFrame(t._wheelrafId),t._wheelrafId=0,t._wheelrafId=requestAnimationFrame(o)}}}_refresh(e){const t=this;if(t._isUpdating)return;const o=t.$.verticalScrollBar.offsetWidth;t.removeAttribute("grouped"),t.removeAttribute("tree");let l=!0;t.__autoHeightRows&&(t.__autoHeightRows=null,t._refreshColumnsResponsiveVisibility(),t._recycle(),l=!1),t._groups||(t._groups=[]),t._cellCachedValues=[],t.grouping.enabled&&t.dataSource.groupBy&&t.dataSource.groupBy.length>=0&&("advanced"===t.grouping.renderMode?t.setAttribute("grouped",""):t.setAttribute("tree",""),t._groups||(t._groups=[].concat(t.dataSource.groupBy.toArray())||[]),t._renderGroupBar()),t.grouping.enabled&&t.dataSource.groupBy&&0===t.dataSource.groupBy.length?t.$.breadcrumb&&(t.$.breadcrumb.dataSource=[]):t.dataSource.boundHierarchy&&(t.setAttribute("tree",""),t.$.content.setAttribute("role","treegrid"),t.$.container.removeAttribute("role")),(t.isInitialized||l)&&t._refreshColumnsResponsiveVisibility(),t._refreshLayout(),o!==t.$.verticalScrollBar.offsetWidth&&(t.__scrollWidth=null,t._refreshColumnsResponsiveVisibility(),t._refreshScrollBars(),0===t.$.verticalScrollBar.offsetWidth&&t.isRendered&&requestAnimationFrame((()=>{t._refreshScrollBars()}))),t._refreshSelection(),t._deleteCopyRects(),t._conditionalColors&&t._conditionalColors.update&&t._conditionalColors.update(),"add"===e||"remove"===e||"update"===e?(t._rowChangeTimeout&&clearTimeout(t._rowChangeTimeout),"remove"===e?(t._recycle(!1),t._refreshHeaderBar()):t._rowChangeTimeout=setTimeout((()=>{t._recycle(!1),t._refreshHeaderBar()}),100)):(t._recycle(),t._refreshHeaderBar()),t._recyclingRows&&0===t._recyclingRows.length&&(t.$.placeholder.classList.remove("smart-hidden"),t.scrollHeight=0,t.$.placeholder.innerHTML=t.messages[t.locale]&&t.messages[t.locale].placeholder?t.localize("placeholder"):t.appearance.placeholder,t.filtering.filterRow.visible&&(t.$.placeholder.style.top="0px",t.$.placeholder.style.position="relative",t._filters&&t._filters.length&&(t.$.placeholder.style.top="12px")),t._filters&&t._filters.length&&(t.$.placeholder.innerHTML=`<span class="smart-grid-icon show smart-icon-filter" style="\n font-size: calc(2 * var(--smart-font-size));\n cursor: default;\n margin-right: 10px;\n "></span>${t.localize("filteredRecords")}`)),t.dataSource&&t.dataSource.boundHierarchy&&t.conditionalFormatting&&t._renderConditionalFormatting(!1),t.filtering.enabled&&t.filtering.filterRow.visible&&(t._suspendFilterRowRefresh||t._refreshFilterRowEditors(),t._recycle(!1)),requestAnimationFrame((()=>{t._width=t.offsetWidth,t._height=t.offsetHeight}))}_refreshHeaderBar(){const e=this;e.$.headerBar&&e.header.visible&&e.$.headerBar._refresh()}_resizeHandler(e){const t=this;if((t.enableShadowDOM?e.composedPath()[0]:e.target)===t&&!t._isUpdatingScrollBars){if(!t.isInitialized)return t._undoRedo=[],t._refreshCurrentUser(),void t._render();if(!1===t._resizeHandling||!t.offsetHeight)return void(!1===t._resizeHandling&&(t.layout.isDirty=!0));t._isUpdatingScrollBars=!0,t._autoHeight=!1,t.$.content&&t.$.content.classList.remove("auto-height");const e=t._rowElements?t._rowElements.length*t.layout.rowMinHeight:0;(e>0||"grid"!==t.view&&"card"!==t.view)&&(t.offsetHeight>=e?(t._refreshLayout(),t._initializeRowElements()):"grid"!==t.view&&t._refreshLayout()),t.refresh(),t.$.headerBar&&t.$.headerBar.refreshTools(),t._dialogAddColumn&&t._dialogAddColumn.classList.contains("open")&&t._dialogAddColumn.refresh(),t._isUpdatingScrollBars=!1}}_refreshColumnsResponsiveVisibility(){const e=this,t=e.$.columnContainer,o=e.$.columnNearContainer,l=e.$.columnFarContainer;let a=0,n=0,i=0,r=!1;const s=e.columns.canNotify;e.columns.canNotify=!1;for(let t=0;t<e.viewColumns.length;t++){const o=e.viewColumns[t];o.setProperty("_treeColumn",!1,!1),e.grouping.enabled&&e.grouping.autoHideGroupColumn&&e.dataSource.groupBy&&e.dataSource.groupBy.indexOf(o.dataField)>=0&&o.setProperty("visible",!1,!1),o.visible&&!o.autoGenerated&&!r&&e.dataSource.boundHierarchy&&(o.setProperty("_treeColumn",!0,!1),r=!0)}e._refreshColumnWidths(),e.columns.canNotify=s;let d=0,c=0;for(let t=0;t<e.viewColumns.length;t++){const o=e.viewColumns[t];o.visible&&(o.freeze&&(!0===o.freeze||"near"===o.freeze?(a+=o.computedWidth,o.autoGenerated&&(d+=o.computedWidth)):"far"===o.freeze&&(n+=o.computedWidth,o.autoGenerated&&(c+=o.computedWidth))),i+=o.computedWidth)}t.style.width=i+"px",o.style.width=a+"px",l.style.width=n+"px",l.classList.remove("smart-hidden"),o.classList.remove("smart-hidden"),0===n&&l.classList.add("smart-hidden"),0===a&&o.classList.add("smart-hidden"),l.classList.remove("border-collapse"),n===c&&l.classList.add("border-collapse"),e._autoGeneratedColumnsNearWidth=d,e._autoGeneratedColumnsFarWidth=c,e._computedColumnsWidth=i,e._frozenColumnsNearWidth=a,e._frozenColumnsFarWidth=n}_selectStartHandler(e){const t=this;t._mobile&&e.preventDefault(),t.isScrolling||t.editing.isEditing||"grid"!==t.view||t.selection.defaultSelection||e.preventDefault()}setFocusable(e){const t=this;!t.disabled&&e?t.tabIndex=0:t.removeAttribute("tabindex")}_setLoadingIndicatorVisibility(){const e=this;e.appearance.displayLoadingIndicator?e.$.loadingIndicatorContainer.classList.remove("smart-visibility-hidden"):e.$.loadingIndicatorContainer.classList.add("smart-visibility-hidden")}_refreshElementsVisibility(){const e=this,t=function(e,t){e&&(t?e.classList.remove("smart-hidden"):e.classList.add("smart-hidden"))};if(t(e.$.placeholder,!e.rows||e.rows&&0===e.rows.length||0===e.columns.length),t(e.$.footer,e.footer.visible),t(e.$.header,e.header.visible&&!e.header.appendTo),t(e.$.groupHeader,e.groupHeader.visible||e.grouping.groupBar.visible),t(e.$.columnHeader,e.columnHeader.visible&&e.columns.length>0),t(e.$.headerCommandBar,e.editing.commandBar.visible&&"far"!==e.editing.commandBar.position),t(e.$.footerCommandBar,e.editing.commandBar.visible&&"near"!==e.editing.commandBar.position),t(e.$.breadcrumb,e.groupHeader.visible||e.grouping.groupBar.visible),e.htmlColumnLastChild.classList.add("smart-visibility-hidden"),e.pager&&e.pager.visible&&e.paging.enabled)switch(e.pager.position){case"near":t(e.$.headerPager,!0),t(e.$.footerPager,!1);break;case"far":t(e.$.headerPager,!1),t(e.$.footerPager,!0);break;case"both":t(e.$.headerPager,!0),t(e.$.footerPager,!0)}else t(e.$.footerPager,!1),t(e.$.headerPager,!1)}_getId(){const e=this;return e.dataSource&&e.dataSource.id?e.dataSource.id:e.dataSourceSettings.id?e.dataSourceSettings.id:void 0}_refreshRowHierarchy(e,t=!1){const o=this;o.rowHierarchy=null;let l=0,a=!1;if(!o.grouping.enabled&&o.dataSource.groupBy&&o.dataSource.groupBy.length>0&&(a=!0),o.grouping.enabled&&o.dataSource.groupBy&&0===o.dataSource.groupBy.length)return;let n=!1;if(o.grouping.enabled&&o.dataSource.groupBy&&o.dataSource.groupBy.length>0&&o.dataSource.virtualDataSourceOnExpand&&(n=!0),o.dataSource.boundHierarchy){const i=o.dataSource.reservedNames,r=function(e){return new Smart.Grid.Row({data:e,grid:o,index:o.rows.length})};let s=0;const d=function(t,l){for(let c=0;c<t.length;c++){const u=t[c];let m=o.rowById[u.$.id];if(n&&(m=o.rows[s],m||(m=r(u),o.rows.push(m)),u[i.leaf]?m.id=u.$.id:m.id="Group_"+u.$.id,o.rowById[m.id]=m),m||(m=r(u),o.rowById[m.id]=m),m.data=u,m.leaf=u[i.leaf]||!1,m.level=u[i.level],m.groupDataField=u.groupDataField,o.hasAttribute("tree")&&o.dataSource&&o.dataSource.childrenDataField&&(m.index=s),!m.groupDataField&&o.appearance.showTreeRowHeader&&(m.groupDataField=o.columns[m.level].dataField),m.label=u.label,m.groupDataField){const e=o.columnByDataField[m.groupDataField];if(e&&e.editor.dataSource)for(let t=0;t<e.editor.dataSource.length;t++){const o=e.editor.dataSource[t];if(""+o.value===m.label){void 0!==o.label?(m.label=o.label,m.labelValue=o.value):void 0!==o.name&&(m.label=o.name,m.labelValue=o.value);break}}}if(m.children=[],m.data&&(m.filtered=void 0===m.data.$.filtered||m.data.$.filtered),u.summaryRow&&(m.summaryRow=!0),(null===o._toggledRow||o._toggledRow&&o._toggledRow.id!==m.id)&&(m.expandHeight=0),u.parent?(m.parent=o.rowById[u.parent.$.id],m.parentId=u.parent.$.id):(m.parent=null,m.parentId=null),o.grouping.onGroupDefaultExpanded&&!o.isRendered){const e=o.grouping.onGroupDefaultExpanded(u);e&&(m.expanded=u[i.expanded]=e)}o.appearance.allowRowToggleAnimation||void 0!==u[i.expanded]&&(m.expanded=u[i.expanded]);let p=!!e||m.expanded;a&&(p=!0);const g=o.dataSource&&o.dataSource.id||o.dataSourceSettings.id;if(g&&!m.data[g]&&o.grouping.enabled&&o.dataSource&&o.dataSource.groupBy.length){const e=o.dataSource.groupBy[m.level];u.parent&&u.parent.expanded&&(""===m.data[e]&&o.dataSource.id&&!m.data.data[o.dataSource.id]||m.leaf&&!m.data[g])&&(s++,m.filtered=!1)}if(!0===m.visible&&!1!==m.filtered)if(s++,p||u[i.leaf])if(l.push(m),u.children&&u.children.length>0){const e=d(u.children,new Array);0===e.length&&(m.leaf=!0);for(let t=0;t<e.length;t++)l.push(e[t]);m.children=e}else u.children&&0===u.children.length&&(o.dataSource.virtualDataSource&&o.dataSource.virtualDataSourceOnExpand?m.data._loaded&&(m.leaf=!0):m.leaf=!0);else if(l.push(m),u.children&&u.children.length>0){const e=d(u.children,new Array);0===e.length&&(m.leaf=!0),m.children=e}else u.children&&0===u.children.length&&(o.dataSource.virtualDataSource&&o.dataSource.virtualDataSourceOnExpand?m.data._loaded&&(m.leaf=!0):m.leaf=!0)}return l};let c=o.dataSource.boundHierarchy;if(o.paging.enabled&&!t){let e=[];const t=e=>{let l=[];if(0===o.dataSource.groupBy.length)return e;for(let o=0;o<e.length;o++){const a=e[o];(!a.$||void 0===a.$.filtered||a.$.filtered)&&(l.push(a),a.children&&(l=l.concat(t(a.children))))}return l};if(o.dataSource&&!o.dataSource.virtualDataSource){for(let o=0;o<c.length;o++){let l=c[o],a=!l.$||void 0===l.$.filtered||l.$.filtered;!a&&null!==a||0!==l.level||l.parent||(t(l.children).length,e.push(l))}c=e.slice(o.paging.pageIndex*o._pageSize,(o.paging.pageIndex+1)*o._pageSize)}}const u=o.rows.canNotify;o.rows.canNotify=!1,o.rowHierarchy=d(c,new Array),o.rows.canNotify=u;let m=[];for(let e=0;e<o.rowHierarchy.length;e++){const t=o.rowHierarchy[e],a=t.canNotify;t.leaf&&m.push(t),t.canNotify=!1,o.grouping.enabled&&o.dataSource&&o.dataSource.groupBy.length?t.leaf?t.visibleIndex=l++:t.visibleIndex=-1:t.visibleIndex=l++,t.canNotify=a}if(a&&(o.rowHierarchy=m),o._rowElements.length<o.rowHierarchy.length&&!o._toggledRow){o._initializeRowElements();let e=0,t=o.rows.canNotify;o.rows.canNotify=!1;for(let t=0;t<o.rowHierarchy.length;t++){const l=o.rowHierarchy[t],a=o.layout.rowHeight||o.layout.rowMinHeight;void 0===l.top&&(l.top=e,l.height=l.cellHeight=a),l.height?e+=l.height:e+=a}o.rows.canNotify=t,o._recycle(!1,!0)}if(o.grouping.summaryRow.visible&&!o.grouping.summaryRow.inline){const e=function(t,o,l,a){if(0!==t&&o.length>0&&o[o.length-1]&&!o[o.length-1].summaryRow){let e={label:" ",boundSource:[],groupDataField:l.data.groupDataField,$:{},summaryRow:!0,leaf:!0,level:t,expandHeight:0,siblings:o};e.$.id="SubRow"+a+"_"+l.data.$.id,l&&(e.parent=l.data,e.parentId=l.data.$.id),e.data=Object.assign(e),o.push(e)}for(let t=0;t<o.length;t++)o[t]&&o[t].data&&o[t].data.children&&e(o[t].level+1,o[t].data.children,o[t],t)};e(0,o.rowHierarchy,null,0)}}}applyContent(){}_refreshContentHeight(){const e=this;let t=e._clientSize.height;const o=window.scrollY;let l,a,n=!1;if((!e._contentHeight||e._maxHeight||e._autoHeight||e.__autoHeight||"hidden"===e.verticalScrollBarVisibility)&&(n=!0),n&&(l=e.offsetHeight,e.$.container.classList.add("smart-hidden"),a=e.offsetHeight,e.$.container.classList.remove("smart-hidden")),window.scrollY!==o&&window.scrollTo(window.scrollX,o),"hidden"===e.verticalScrollBarVisibility||e.layout.autoHeight||l!==a||e._minHeight&&e._minHeight===l)return t=e._scrollHeight+e.$.columnHeader.offsetHeight+e.$.filterFooter.offsetHeight,e.header.visible&&!e.header.appendTo&&(t+=e.$.header.offsetHeight),e.summaryRow.visible&&(t+=e.layout.rowMinHeight),0===e._recyclingRows.length&&0===e._scrollHeight&&(t+=e.$.scrollView.offsetTop),e._minHeight>t&&(t=e._minHeight),e.$.content.style.height=t+"px",e._contentHeight=t,void(e._maxHeight<t?(e._autoHeight=!1,e.$.content.classList.remove("auto-height"),e.$.content.style.height=e._maxHeight+"px",e.header.visible&&!e.header.appendTo?(e.$.content.style.height=e._maxHeight-e.$.header.offsetHeight+"px",e._contentHeight=e._maxHeight-e.$.header.offsetHeight):e._contentHeight=e._maxHeight):(e._autoHeight=!0,e.__autoHeight=!0,e.$.content.classList.add("auto-height"),e.filtering.filterRow.visible&&(e.filtering.filterRow.visible,e._contentHeight=t,e.$.content.style.height=e._contentHeight+"px"),e.header.visible&&!e.header.appendTo?(e._contentHeight=t-e.$.header.offsetHeight,e.$.content.style.height=e._contentHeight+"px"):e.summaryRow.visible&&(e.$.content.style.height=e._contentHeight+"px")));if(e.header.visible&&!e.header.appendTo&&(t-=e.$.header.offsetHeight),(e.groupHeader.visible||e.grouping.groupBar.visible)&&(t-=e.$.groupHeader.offsetHeight),e.footer.visible&&(t-=e.$.footer.offsetHeight),e.pager.visible&&(t-=e.$.headerPager.offsetHeight,t-=e.$.footerPager.offsetHeight),e.editing.enabled&&e.editing.commandBar.visible&&(t-=e.$.headerCommandBar.offsetHeight,t-=e.$.footerCommandBar.offsetHeight),e.$.content.style.height!==t+"px"&&(e.$.content.style.height=t+"px"),e.$.viewContent.style.height!==t+"px"&&(e.$.viewContent.style.height=t+"px"),e._contentHeight=t,!e.appearance.showViewBar||e.appearance.viewBarAppendTo||e.appearance.showViewBarAsDropdown)e.$.viewBar.classList.add("smart-hidden"),e.$.content.style.width="",e.$.viewContent.style.width="",e.$.content.style.marginLeft="",e.$.viewContent.style.marginLeft="";else{const o=e.layout.viewBarWidth+5;e.$.viewBar.classList.remove("smart-hidden"),e._mobile||(e.$.content.style.width="calc(100% - "+o+"px)",e.$.viewContent.style.width="calc(100% - "+o+"px)",e.$.content.style.marginLeft=o+"px",e.$.viewContent.style.marginLeft=o+"px"),e.$.viewBar.style.width=o+"px";let l=0;e.header.visible&&!e.header.appendTo&&(l+=e.$.header.offsetHeight),(e.groupHeader.visible||e.grouping.groupBar.visible)&&(l+=e.$.groupHeader.offsetHeight),e.pager.visible&&(l+=e.$.headerPager.offsetHeight),e.$.viewBar.style.top=l+"px",e.$.viewBar.style.height=t+"px"}}appendChild(){const e=Array.prototype.slice.call(arguments,2);return HTMLElement.prototype.appendChild.apply(this,e.concat(Array.prototype.slice.call(arguments)))}removeChild(){const e=Array.prototype.slice.call(arguments,2);return HTMLElement.prototype.removeChild.apply(this,e.concat(Array.prototype.slice.call(arguments)))}get _contentBorder(){const e=this;if(e.__contentBorder)return e.__contentBorder;const t=getComputedStyle(e.$.content),o={left:parseFloat(t.borderLeftWidth)+parseFloat(t.borderRightWidth),top:parseFloat(t.borderTopWidth)+parseFloat(t.borderBottomWidth)};return e.__contentBorder=o,o}_refreshAutoSize(){const e=this;if(e.layout.autoWidth){const t=e._isUpdatingScrollBars;e._isUpdatingScrollBars=!0;let o=2;for(let t=0;t<e.viewColumns.length;t++){const l=e.viewColumns[t];l.visible&&(o+=l.computedWidth)}o+=e.$.verticalScrollBar.offsetWidth>0?e.$.verticalScrollBar.offsetWidth:0,e.style.width=o+"px",requestAnimationFrame((()=>{e._isUpdatingScrollBars=t}))}e.layout.autoHeight&&(e.style.height="auto")}_refreshLayout(){const e=this,t=e.rows;if(e._layoutSuspended)return;e._visibleRows=null,e.__viewRows=null,e.__clientSize=null,e.__scrollHeight=null,e.__scrollWidth=null,e.__parentCells=null,e.$.columnFarContainer.classList.remove("vscroll"),e.$.columnNearContainer.classList.remove("vscroll"),e.$.scrollView.classList.remove("hscroll"),e.$.scrollView.classList.remove("vscroll"),e._refreshAutoSize(),e._refreshElementsVisibility(),e._refreshRowHierarchy(),e._refreshColumnHeights(),e._refreshContentHeight();const o=()=>{e.$.placeholder.classList.remove("smart-hidden"),e.$.placeholder.innerHTML=e.messages[e.locale]&&e.messages[e.locale].placeholder?e.localize("placeholder"):e.appearance.placeholder,e._filters&&e._filters.length&&(e.$.placeholder.innerHTML=e.localize("filteredRecords")),e.__filterFooterOffsetHeight||(e.__filterFooterOffsetHeight=e.$.filterFooter.classList.contains("smart-hidden")?0:e.$.filterFooter.offsetHeight),!e.__columnHeaderHeight&&e.$.columnHeader.offsetHeight&&(e.__columnHeaderHeight=e.$.columnHeader.offsetHeight);let t=e._contentHeight-e.__filterFooterOffsetHeight-e.__columnHeaderHeight;e.$.scrollView.style.height=t+"px",e.scrollWidth=0,e.scrollHeight=0,e.clearSelection(),e._showAddNewRowButton("float"),e.$.content.classList.contains("auto-height")&&(e.$.placeholder.style.height=t+"px")};if(t&&t.url)e._showAddNewRowButton("float");else{if(!t||null===t||0===t.length||0===e.columns.length)return o(),0!==e.columns.length&&e.hasVisibleColumn()?e.editing.addNewColumn._addButton&&e.editing.addNewColumn._addButton.classList.remove("show"):(e._showAddNewColumnButton(),e.$.columnHeader.classList.add("smart-hidden"),e.__columnHeaderHeight=0),void e._refreshScrollBars();e._showAddNewRowButton("float"),e.editing.addNewColumn._addButton&&e.editing.addNewColumn._addButton.classList.remove("show")}0!==e.columns.length&&e.hasVisibleColumn()?e.editing.addNewColumn._addButton&&e.editing.addNewColumn._addButton.classList.remove("show"):(o(),0!==e.columns.length&&e.hasVisibleColumn()||(e._showAddNewColumnButton(),e.$.columnHeader.classList.add("smart-hidden"),e.__columnHeaderHeight=0),e._showAddNewColumnButton()),"card"===e.view&&(e.__columnHeaderHeight=0),!e.__columnHeaderHeight&&e.$.columnHeader.offsetHeight&&(e.__columnHeaderHeight=e.$.columnHeader.offsetHeight),e.__filterFooterOffsetHeight||(e.__filterFooterOffsetHeight=e.$.filterFooter.classList.contains("smart-hidden")?0:e.$.filterFooter.offsetHeight);let l=e._contentHeight-e.__filterFooterOffsetHeight-e.__columnHeaderHeight;if(e.$.scrollView.style.height=l+"px",e.htmlColumnLastChild.style.height=e.__columnHeaderHeight+"px",e.paging.spinner.enabled&&e.paging.enabled){if(!e.pageScroll){const t=document.createElement("smart-scroll-bar");t.orientation="vertical",t.style.height="100%",t.style.width="100%",t.max=Math.ceil(e.dataSource.length/e._pageSize),t.step=e.paging.spinner.step,t.largeStep=e.paging.spinner.step,t.setAttribute("spinner",""),t.setAttribute("smart-id","spinner"),t.ownerElement=e,e.addPropertyBinding("[[paging_spinner_step]]","step",t,e.$.columnHeader),t.addEventListener("change",(function(t){e.paging.pageIndex=t.detail.value,e._refreshLayout(),e._refreshSelection(),e.dataSource&&e.dataSource.virtualDataSource?e._virtualDataRequest("pageIndexChange"):(e._recycle(),e._scrollUpdate&&clearTimeout(e._scrollUpdate),e._scrollUpdate=setTimeout((function(){e.isScrolling||(e.$.rowContainer.style.top=parseInt(e.$.rowContainer.style.top)+.01+"px")}),50))})),e.pageScroll=t}e.htmlColumnLastChild.appendChild(e.pageScroll)}else e.htmlColumnLastChild.innerHTML="";e._refreshScrollBars()}_refreshScrollBars(){const e=this;if(!e._scrollView)return;const t=e._scrollView.vScrollBar,o=e._scrollView.hScrollBar,l=e._contentHeight-e.__filterFooterOffsetHeight-e.__columnHeaderHeight,a=e.$.scrollView.offsetWidth,n=e._scrollWidth-a-e._contentBorder.left,i=e._scrollHeight-l-e._contentBorder.top,r=e._columnNearContainerComputedStyle?e._columnNearContainerComputedStyle:getComputedStyle(e.$.columnNearContainer),s=e._columnFarContainerComputedStyle?e._columnFarContainerComputedStyle:getComputedStyle(e.$.columnFarContainer),d=parseInt(e.$.columnNearContainer.style.width)+parseInt(r.borderRightWidth),c=parseInt(e.$.columnFarContainer.style.width)+parseInt(s.borderLeftWidth);if(e.__frozenNearWidth=d,e.__frozenFarWidth=c,e._columnNearContainerComputedStyle=r,e._columnFarContainerComputedStyle=s,e._refreshHorizontalScrollBarVisibility(n),e._refreshVerticalScrollBarVisibility(i),t.style.height=l+"px",e.computedVerticalScrollBarVisibility?(e.__scrollBarSize||(e.__scrollBarSize=t.offsetWidth),e.__scrollWidth+=e.__scrollBarSize,e._refreshHorizontalScrollBarVisibility(e._scrollWidth-a-1),e.rightToLeft?e.$.columnNearContainer.classList.add("vscroll"):e.$.columnFarContainer.classList.add("vscroll"),e._refreshVerticalScrollBarVisibility(i),e.htmlColumnLastChild.classList.remove("smart-visibility-hidden"),e.$.scrollView.classList.add("has-vscroll")):e.$.scrollView.classList.remove("has-vscroll"),o.style.width=a+"px",e.rightToLeft?o.style.right="0px":o.style.left="0px",e.computedVerticalScrollBarVisibility&&e.computedHorizontalScrollBarVisibility&&(o.style.width=a-t.offsetWidth+"px",t.style.height=l-o.offsetHeight+"px"),e.computedHorizontalScrollBarVisibility?(e.$.scrollView.classList.add("hscroll"),e._autoHeight?(e.$.content.style.height="auto",e.$.scrollView.style.height="auto",e.$.scrollView.style.paddingBottom=o.offsetHeight+"px",e.$.placeholder.style.marginTop=o.offsetHeight+"px",e.summaryRow.visible&&(e.$.scrollView.style.paddingBottom=o.offsetHeight+e.layout.rowMinHeight+"px"),e.filtering.enabled&&e.filtering.filterRow.visible&&(e.$.scrollView.style.paddingBottom=o.offsetHeight+e.layout.rowMinHeight+"px")):(e.$.scrollView.style.paddingBottom="",e.$.placeholder.style.marginTop="")):e.$.scrollView.classList.remove("hscroll"),(e.__frozenNearHeight>0||e._frozenNearRows&&e._frozenNearRows.length>0)&&!e.appearance.showVerticalScrollBarOnFixedColumns){const o=getComputedStyle(e.$.rowNearContainer),l=e.__frozenNearHeight+parseInt(o.borderBottomWidth);t.style.height=parseInt(t.style.height)-l+"px",t.style.top=l+"px",t.style.setProperty("--smart-scroll-bar-near-size",l+"px")}else e.appearance.showVerticalScrollBarOnFixedColumns&&(t.style.top="0px");if((e.__frozenFarHeight>0||e._frozenFarRows&&e._frozenFarRows.length>0)&&!e.appearance.showVerticalScrollBarOnFixedColumns){const o=getComputedStyle(e.$.rowFarContainer),l=-2+e.__frozenFarHeight+parseInt(o.borderTopWidth);t.style.height=parseInt(t.style.height)-l+"px",t.style.setProperty("--smart-scroll-bar-far-size",l+"px"),0===e.__frozenNearHeight&&(t.style.top="0px")}(d>0||c>0)&&!e.appearance.showHorizontalScrollBarOnFixedColumns&&(o.style.width=parseInt(o.style.width)-d-c+"px",e.rightToLeft?o.style.right=d+"px":o.style.left=d+"px",o.style.setProperty("--smart-scroll-bar-near-size",d+parseInt(r.borderRightWidth)+"px"),o.style.setProperty("--smart-scroll-bar-far-size",c+parseInt(r.borderLeftWidth)+"px"),e.computedVerticalScrollBarVisibility&&(e.__scrollBarSize||(e.__scrollBarSize=t.offsetWidth),o.style.setProperty("--smart-scroll-bar-far-size",c+e.__scrollBarSize+"px"))),t.refresh(),o.refresh(),e._mobile&&(e._scrollContentView.style.width=e.$.scrollView.offsetWidth+e._scrollView.scrollWidth+"px",e._scrollContentView.style.height=e.$.scrollView.offsetHeight+e._scrollView.scrollHeight+"px")}_refreshHorizontalScrollBarVisibility(e){const t=this;t.scrollWidth=e,t.computedHorizontalScrollBarVisibility||(t.scrollLeft=0)}_refreshVerticalScrollBarVisibility(e){const t=this;if(t._autoHeight)return t.scrollTop=0,void(t.scrollHeight=0);t.computedHorizontalScrollBarVisibility&&(e+=t.$.horizontalScrollBar.offsetHeight),t.scrollHeight=e,t.paging.enabled&&t.paging.spinner.visible&&t.$.verticalScrollBarVisibility.classList.remove("smart-hidden"),t.computedVerticalScrollBarVisibility||(t.scrollTop=0)}_styleChangedHandler(e){const t=this;if(!e.detail.styleProperties.overflow&&!t.classList.contains("smart-grid-resize-mode")){if(e.detail.styleProperties["grid-template-columns"])return t._templateColumns(),void t.refresh();if(e.detail.styleProperties["font-size"])return t.layout.isDirty=!0,t._resetCachedLayout(),void t.refresh();(e.detail.styleProperties["--smart-grid-row-height"]||e.detail.styleProperties["--smart-font-size"]||e.detail.styleProperties["--smart-grid-column-header-height"]||e.detail.styleProperties["--smart-grid-group-header-height"]||e.detail.styleProperties["--smart-grid-filter-footer-height"]||e.detail.styleProperties["--smart-grid-group-row-vertical"]||e.detail.styleProperties["--smart-grid-group-row-horizontal-offset"]||e.detail.styleProperties["--smart-grid-freeze-splitter-size"]||e.detail.styleProperties["--smart-grid-resize-line-size"]||e.detail.styleProperties["--smart-grid-footer-height"]||e.detail.styleProperties["--smart-grid-header-height"])&&(t.layout.isDirty=!0),t.offsetWidth&&t.offsetHeight>0&&(t._resetCachedLayout(),t._refreshLayout(),t._recycle())}}_resetCachedLayout(){const e=this;delete e._columnHeights,e.__cellsCommandTemplate=null,e.__autoRowHeight=null,e.__autoHeightRows=null,e.__measuredColumnHeight=null,e.__columnHeaderHeight=null,e.__filterFooterOffsetHeight=null}_swipeLeftHandler(){}_swipeRightHandler(){}_getRowIndexByPosition(e){const t=this;return(o=>{let l=0,a=o.length-1;if(e<=0)return 0;const n=o[o.length-1];if(-1!==n.top&&n.top<=e)return o.length-1;for(;;){const n=Math.floor((l+a)/2),i=o[n];if(t._isRowInPosition(i,e))return n;i.top<e?l=n+1:i.top>e?a=n-1:l=n+1}})(t._recyclingRows)}_getVirtualRowIndexByPosition(e){let t=this.rows[0].height;const o=(e,o)=>0!==t&&e<=o&&e+t>o;return(l=>{let a=0,n=l.length-1;if(e<=0)return 0;const i=(l.length-1)*t;if(-1!==i&&i<=e)return l.length-1;for(;;){const l=Math.floor((a+n)/2),i=l*t;if(o(i,e))return l;i<e?a=l+1:i>e?n=l-1:a=l+1}})(this.dataSource)}getRows(){return this.getViewRows()}getViewRows(){const e=this;return e.rowHierarchy?e.rowHierarchy:e.getVisibleRows()}getData(){const e=this;if(!e.dataSource)return[];const t=[];for(let o=0;o<e.dataSource.length;o++){const l=e.dataSource[o];if(l.$){const o={};for(let t=0;t<e.dataSource.dataFields.length;t++){const a=e.dataSource.dataFields[t].name;o[a]=l[a]}t.push(o)}else t.push(l)}return t}getDataFields(){const e=this;return e.columns?e.columns.map((e=>e.dataField)):[]}getColumns(){const e=this,t=[];if(!e.isInitialized)return t;if(e.columns)for(let o=0;o<e.columns.length;o++){const l=e.columns[o].getState();t.push(l)}return t}resetState(e=!0){const t=this;t._isUpdating=0,t.beginUpdate(),t.clearSort(),t.clearFilter(),t.clearGroups(),t.clearSelection(),t._conditionalColors&&(t._conditionalColors.colors=[],t._conditionalColors.conditions=[],t._conditionalColors.type="conditions",t._conditionalColors.singleSelect="",t._conditionalColors.decorate="border",t._conditionalColors.update=()=>{}),t.$.headerBar&&delete t.$.headerBar._appliedColors,delete t._labeledBy,delete t._dateStackedBySelect,t.highlighted=null,t.columns.canNotify=!1;let o=[],l=!1;for(let e=0;e<t.columns.length;e++){const a=t.columns[e];a.visible=!0,a.width=180,a.freeze=!1,a.index>=0?o[a.index]=a:o.push(a),a.index!==e&&(l=!0)}l&&(t.columns=o),"grid"!==t.view&&e&&(t.view="grid",t._hideKanbanView(),t._hideSchedulerView()),t.columns.canNotify=!0,t._scrollView.scrollLeft=t._scrollView.scrollTop=0,t.paging.enabled&&(t.paging.pageIndex=0),t.$.headerBar&&t.$.headerBar._setView&&"grid"===t.view&&t.$.headerBar._setView("grid"),t._kanban&&t._kanban._reset(),t.layout.isDirty=!0,t.endUpdate(),l&&(t._renderColumns(),t._refreshHeaderBar())}_loadState(e){const t=this;let o=!1;t.stateSettings.loading=!0;let l=!1,a=!1,n=!1;if("grid"===e.view||"card"===e.view||void 0===e.view){if(e.expandedRows&&Object.keys(e.expandedRows).length>0){o=!0,t.beginUpdate();const l=[];if(e.groups){t.dataSource.groupBy=e.groups,t._groups=[].concat(t.dataSource.groupBy.toArray())||[],t._refreshRowHierarchy();for(let o in e.expandedRows)l["Item"+o.replaceAll(".","_")]=!0,t._expandCollapseGroup(o,!0)}else if(t.grouping.enabled&&t.dataSource.groupBy.length)for(let o in e.expandedRows)l["Item"+o.replaceAll(".","_")]=!0,t._expandCollapseGroup(o,!0);t.dataSource&&(t.dataSource._expandedRowIds=l)}else if(e.groups&&e.groups.length){o=!0,t.beginUpdate();const l=[];t.dataSource&&(t.dataSource._expandedRowIds=l),e.groups&&(t.dataSource.groupBy=e.groups,t._refreshRowHierarchy())}else if(e.groups&&0===e.groups.length&&t.dataSource.groupBy&&t.dataSource.groupBy.length>0){o=!0,t.beginUpdate();const e=[];t.dataSource&&(t.dataSource._expandedRowIds=e),t.dataSource.groupBy=[],t._refreshRowHierarchy(),a=!0}if(e.paging&&t.paging.enabled&&(t.paging.index=e.paging.index,t.paging.size=e.paging.size),e.columns&&e.columns.length>0){o||(o=!0,t.beginUpdate());let a=[];for(let o=0;o<e.columns.length;o++){const i=e.columns[o];if(i.dataField){const e=t.columnByDataField[i.dataField];if(e){const r=e.canNotify;e.canNotify=!1,i.width?e.width=i.width:e.width=180,e.sortOrder="",e.sorted="",a.push(e),e.index!==o&&(n=!0),e.visible=void 0===i.visible||i.visible,e._state&&(e._state.visible=void 0===i.visible||i.visible,e._state.freeze=void 0!==i.freeze&&i.freeze,e._state.width=i.width?i.width:180);const s=e.freeze;e.freeze=void 0!==i.freeze&&i.freeze,s!==e.freeze&&(l=!0,e.freeze||t._frozenNearColumns.indexOf(e)),e.canNotify=r}}}n&&(t.columns=a)}}if(e.colors&&(t._conditionalColors=JSON.parse(JSON.stringify(e.colors)),t.$.headerBar)){let l=[];if(e.colors.conditions)for(let t=0;t<e.colors.conditions.length;t++){let o=e.colors.conditions[t],a=[];for(let e in o)a.push(o[e]);l.push(a)}o||(o=!0,t.beginUpdate());const a={type:e.colors.type,singleSelect:e.colors.singleSelect,decorate:e.colors.decorate};t.$.headerBar._appliedColors=[l,a],t._conditionalColors.update=e=>{t.$.headerBar._updateConditionalColors(e,t,a)}}if(e.sort&&Object.keys(e.sort).length>0){o||(o=!0,t.beginUpdate());const l=t.appearance.allowSortAnimation;t.appearance.allowSortAnimation=!1;let a=t.columns.canNotify;t.columns.canNotify=!1;for(let e=0;e<t.columns.length;e++)t.columns[e].sortOrder="";t.columns.canNotify=a;for(let o in e.sort){const l=e.sort[o];if(l){const e=l.sortOrder,a=l.dataField?l.dataField:o,n=t.columnByDataField[a];n&&t.sortBy(n.dataField,e)}}t.appearance.allowSortAnimation=l}if(e.filter&&Object.keys(e.filter).length>0){o||(o=!0,t.beginUpdate());for(let o in e.filter){let l=o,a=e.filter[l];if(e.filter[0]&&(l=e.filter[o].dataField,a=e.filter[o].filter),a){t.addFilter(l,a,!1);const e=t.columnByDataField[l];e&&e._filterInfo&&e.filter&&e.filter.filters&&e.filter.filters[0]&&(e._filterInfo.value=e.filter.filters[0].value,e._filterInfo.condition=e.filter.filters[0].condition)}}if(t.filtering.filterRow)for(let e=0;e<t.columns.length;e++)t.columns[e]._filterEditorInitialized&&(t.columns[e]._filterEditorInitialized=!1)}if(e.selectedCells&&(o||(o=!0,t.beginUpdate()),t.selectCellsById(e.selectedCells)),e.selectedRows&&t.selectRows(e.selectedRows),e.labeledBy&&(t._labeledBy=e.labeledBy),o){t.endUpdate(!1,!1);let o=!1;e.view&&"kanban"===e.view&&(o=!0),(l||n)&&(o=!1,a=!0,t._renderColumns()),o||(a?t.refresh(!0):t._refresh())}let i=!1;if(e.kanban&&e.kanban.stackedBy&&(void 0===t._stackedBy&&(t._stackedBy=e.kanban.stackedBy),t._stackedBy!==e.kanban.stackedBy&&(i=!0),t._stackedBy=e.kanban.stackedBy),e.scheduler&&e.scheduler.stackedBy&&(void 0===t._dateStackedBy&&(t._dateStackedBy=e.scheduler.stackedBy),t._dateStackedBy!==e.scheduler.stackedBy&&(i=!0),e.scheduler.labeledBy&&(t._labeledBy=e.scheduler.labeledBy),e.scheduler.viewType&&(t._schedulerViewType=e.scheduler.viewType),void 0===t._dateStackedBySelect&&(t._dateStackedBySelect=e.scheduler.groupBy),t._dateStackedBySelect!==e.scheduler.groupBy&&(i=!0),t._dateStackedBy&&Array.isArray(t._dateStackedBy)&&e.scheduler.stackedBy&&Array.isArray(e.scheduler.stackedBy)&&JSON.stringify(t._dateStackedBy)===JSON.stringify(e.scheduler.stackedBy)&&(i=!1),t._dateStackedBy=e.scheduler.stackedBy),(i||e.view&&t.view!==e.view)&&t.$.headerBar&&t.$.headerBar._setView&&(e.name&&(t.stateSettings.current=e.name),t.$.headerBar._setView(e.view,!0)),e.filter&&Object.keys(e.filter).length>0&&t.refreshFilters(),e.selectedCells){const o=[];let l=99999999,a=null,n=99999999,i=null,r=99999999,s=null;for(let l=0;l<e.selectedCells.length;l++){const a=e.selectedCells[l],d=a[0],c=a[1],u=t.columnByDataField[c];if(u&&(n=Math.min(n,u.index),i=Math.max(i,u.index)),!t.rowById[d])continue;const m=t.rowById[d].visibleIndex;m>=0&&(r=Math.min(r,m),s=Math.max(s,m)),o[d]||(o[d]=[]),o[d].push(c)}let d=0,c=!0;for(let e in o){const t=o[e];if(d&&t.length!==d){c=!1;break}d=t.length}if(c){const e=t.getRows(),o=e[r],d=e[s];if(l=o?o.id:-1,a=d?d.id:-1,o){const e=t.columns[n];if(e){const o=t.rowById[l].getCell(e.dataField);t._selection.focusedCell={id:o.row.id,value:o.value,dataField:o.column.dataField,index:o.row.index},setTimeout((()=>{t._selectCellsRange(t.rowById[l],t.rowById[a],t.columns[n].dataField,t.columns[i].dataField)}),50)}}}}e.name&&(t.stateSettings.current=e.name),t._refreshHeaderBar(),t.stateSettings.loading=!1}loadState(e){const t=this;if(e){if(t.stateSettings.loading=!0,t._isUpdating=0,t.beginUpdate(),t.clearSort(),t.clearFilter(),t.clearGroups(),t.clearSelection(),t._conditionalColors&&(t._conditionalColors.colors=[],t._conditionalColors.conditions=[],t._conditionalColors.type="conditions",t._conditionalColors.singleSelect="",t._conditionalColors.decorate="border"),delete t._labeledBy,delete t._dateStackedBySelect,t.$.headerBar&&delete t.$.headerBar._appliedColors,t._scrollView.scrollLeft=t._scrollView.scrollTop=0,t.paging.enabled&&(t.paging.pageIndex=0),t.endUpdate(!1,!1),"string"==typeof e){const o=t.stateSettings.storage[e];o&&t._loadState(o)}else t._loadState(e);t.stateSettings.loading=!1}else if(!t.stateSettings.autoSave){let e=t.getCurrentState();e&&t.loadState(e)}}saveState(e,t){const o=this;let l=o.getCurrentState(),a=t;!t&&o.stateSettings.options.length&&(t=o.stateSettings.options);const n=o.getState(t);let i;if(e?(i=e,o.stateSettings.current||(o.stateSettings.current=e)):i=o.stateSettings.current?o.stateSettings.current:o.stateSettings.current="View 1",l&&a)for(let e in a)l[a[e]]=n[a[e]];else l=n;function r(e,t=0,o=10){if(t>o)return"Object";const l={};if(e&&e instanceof Smart.FilterGroup)return e=e.toString();for(let a in e){let n=e[a];if(n instanceof Node)n={id:n.id};else if(n instanceof Window)n="Window";else if(n instanceof Date)n=n.toJSON();else{if(n&&Array.isArray(n)&&void 0!==n[0]&&("string"==typeof n[0]||"number"==typeof n[0]||n[0]instanceof Date||"boolean"==typeof n[0])){l[a]=n;continue}if(n&&Array.isArray(n)&&0===n.length){l[a]=n;continue}if(n&&n&&Array.isArray(n)&&void 0!==n[0]&&"object"==typeof n[0]&&"path"!==a&&!(n[0]instanceof HTMLElement))for(let e=0;e<n.length;e++)n[e]=r(n[e],t+1,o);else n instanceof Object&&(n=r(n,t+1,o))}l[a]=n}return t?l:JSON.stringify(l)}l.name=i,o.stringify_object=r;const s=r(l);return o.stateSettings.allowLocalStorage&&window.localStorage.setItem(i,s),o.stateSettings.storage||(o.stateSettings.storage={}),o.stateSettings.storage[o.stateSettings.current]&&!l.date&&o.stateSettings.storage[o.stateSettings.current].date?l.date=o.stateSettings.storage[o.stateSettings.current].date:l.date=(new Date).toJSON(),o.stateSettings.storage[o.stateSettings.current]=l,o.stateSettings.onStateChange&&(o._isUpdating<=0||void 0===this._isUpdating)||o.stateSettings.onStateChange&&o._forceStateChange?o.isCompleted&&o.stateSettings.onStateChange(l,i,o.stateSettings.storage,r):o.stateSettings.onStateChange&&"grid"!==o.view&&o.isCompleted&&o.stateSettings.onStateChange(l,i,o.stateSettings.storage,r),l}autoSaveState(){const e=this;e._savingState&&clearTimeout(e._savingState),e._savingState=setTimeout((()=>{if(!e.stateSettings.current&&e.stateSettings.autoSave&&!e.stateSettings.loading){const t=e.stateSettings.storage;if(t&&0===Object.keys(t).length||!t){let t=e.localize("newGrid")+" "+e.localize("view");"kanban"===e.view?t=e.localize("newKanban")+" "+e.localize("view"):"card"===e.view?t=e.localize("newCard")+" "+e.localize("view"):"scheduler"===e.view&&(t=e.localize("newScheduler")+" "+e.localize("view")),e.stateSettings.current=t}}e.stateSettings.autoSave&&e.stateSettings.current&&!e.stateSettings.loading&&e.saveState()}),50)}getCurrentState(){const e=this,t=e.stateSettings.current;return e.stateSettings.storage||(e.stateSettings.storage={}),e.stateSettings.storage[t]?e.stateSettings.storage[t]:null}setColors(e,t){const o=this;o._conditionalColors={type:t.type,decorate:t.decorate,conditions:e,singleSelect:t.singleSelect},o.$.headerBar.addColors(JSON.parse(JSON.stringify(e)),{type:t.type,singleSelect:t.singleSelect,decorate:t.decorate},[]),o._recycle(!1)}getColors(){const e=this;if(e._conditionalColors){const t=JSON.parse(JSON.stringify(e._conditionalColors));return{type:t.type,conditions:t.conditions,filters:t.filters,colors:t.colors,decorate:t.decorate,singleSelect:t.singleSelect}}return null}getState(e){const t=this;if(e&&!e.includes)return;const o=!e||e&&e.includes("sort")?t.getSortedColumns():null,l=!e||e&&e.includes("filter")?t.getFilteredColumns():null,a=!e||e&&e.includes("groups")?t.getGroups():null,n=!e||e&&e.includes("selection")?t.getSelectedCells(!1):null,i=!e||e&&e.includes("selection")?t.getSelectedRowIds():null,r=!e||e&&e.includes("pager")?t.$.headerPager.querySelector("smart-pager"):null,s=!e||e&&e.includes("colors")?t.getColors():null;let d=0;r&&(d=r.pagesCount);const c={count:d,index:t.paging.pageIndex,size:t._pageSize},u={};o&&o.length&&(u.sort=o),l&&l.length&&(u.filter=l),a&&a.length&&(u.groups=a),c&&t.paging.enabled&&(u.paging=c),n&&n.length&&(u.selectedCells=n),i&&i.length&&(u.selectedRows=i),s&&(delete s.colors,u.colors=s),t._labeledBy&&(u.labeledBy=t._labeledBy),(t.header.visible&&t.header.buttons.indexOf("views")>=0||t.header.buttons.indexOf("states")>=0)&&("kanban"===t.view&&(u.kanban=t.getKanbanState()),"scheduler"===t.view&&(u.scheduler=t.getSchedulerState()),u.view=t.view);const m=[];if(!e||e&&e.includes("columns")){for(let e=0;e<t.columns.length;e++){const o=t.columns[e];o&&m.push({dataField:o.dataField,width:o.computedWidth,visible:o.visible,freeze:o.freeze})}u.columns=m}if((!e||e&&e.includes("expandedRows"))&&t.dataSource&&t.dataSource._expandedRowIds){let e={};for(let o in t.dataSource._expandedRowIds){let t=""+o;t=t.replace("Item","").replace(/_/gi,"."),e[t]=!0}Object.values(e).length&&(u.expandedRows=e)}if((t.header.visible&&t.header.buttons.indexOf("views")>=0||t.header.buttons.indexOf("states")>=0)&&("kanban"!==t.view&&"scheduler"!==t.view||(delete u.expandedRows,delete u.columns,delete u.paging,delete u.selectedCells,delete u.selectedRows)),e){const t={};for(let o in e){const l=e[o];u[l]&&(t[l]=u[l])}return t}return u}get _pageSize(){const e=this;return e.dataSource&&e.grouping.enabled&&e.dataSource.groupBy&&e.dataSource.groupBy.length>0?e.paging.pageHierarchySize:e.paging.pageSize}get _recyclingRows(){const e=this;if(e.rowHierarchy)return e.rowHierarchy;let t=e.getVisibleRows();if(e.paging.enabled)if(e.dataSource.virtualDataSource)t=t.slice(0,e._pageSize);else if(t=t.slice(e.paging.pageIndex*e._pageSize,(e.paging.pageIndex+1)*e._pageSize),e.editing.addNewRow&&e.editing.addNewRow.visible&&"button"!==e.editing.addNewRow.displayMode){let t=e.getVisibleRows();return t=0===e.paging.pageIndex&&"far"!==e.editing.addNewRow.position?t.slice(1+e.paging.pageIndex*e._pageSize,1+(e.paging.pageIndex+1)*e._pageSize):0===e.paging.pageIndex&&"far"===e.editing.addNewRow.position?t.slice(e.paging.pageIndex*e._pageSize,1+(e.paging.pageIndex+1)*e._pageSize):t.slice(1+e.paging.pageIndex*e._pageSize,1+(e.paging.pageIndex+1)*e._pageSize),[].concat(e._frozenNearDefaultRows,t,e._frozenFarDefaultRows)}return t}_isRowInPosition(e,t){const o=e.top,l=e.top+e.height,a=o<=t&&l>t;return 0!==e.height&&a}_renderColumnGroupHeaders(){const e=this;for(let t=0;t<e._columnGroups.length;t++){const o=e._columnGroups[t];o.column.render(),o.column.allowReorder=!1,o.column.element.setAttribute("columnHeader",""),o.column.element.setAttribute("level",o.level),0===o.columns.length&&o.column.element.classList.add("smart-hidden");const l=o.collapseButton;l&&o.column.element.appendChild(l),0===t&&0===e.columns.indexOf(o.columns[0])&&o.column.element.classList.add("smart-grid-column-border-collapse")}}hasVisibleColumn(){const e=this;for(let t=e.viewColumns.length-1;t>=0;t--){const o=e.viewColumns[t];if(o.visible&&!o.autoGenerated)return!0}return!1}_isLastVisibleColumn(e){const t=this;for(let o=t.viewColumns.length-1;o>=0;o--){const l=t.viewColumns[o];if(l.visible)return l===e}return!1}_clearCachedTemplates(){const e=this;if(e._cachedTemplates&&Object.keys(e._cachedTemplates).length>0){e._tableCachedTemplates||(e._tableCachedTemplates=document.createElement("div"),e._tableCachedTemplates.style.display="none",document.body.appendChild(e._tableCachedTemplates));const t=document.createDocumentFragment();for(let o in e._cachedTemplates)t.appendChild(e._cachedTemplates[o]);e._tableCachedTemplates.appendChild(t)}}_recycle(e,t,o,l){const a=this;if(a._layoutSuspended||!1===a.isAttached)return;if(a._isUpdating)return;if(a.editing.isEditing&&(!0===a._disableEndEdit||a.editing.dialog.visible||a.endEdit(),a._isUpdating))return;a._recycleValues=void 0===o||o,a._removeCellContentPopup(),a._inputOverlay&&(a._inputOverlay.parentNode&&a._inputOverlay.parentNode.removeChild(a._inputOverlay),a._inputOverlay=null),a._selection.selectionRect&&a._refreshCellSelectionRect(),a._copyRects&&a._copyRects.length&&a._refreshCopyRects();const n=a._scrollView.scrollTop;let i,r=l||a._getRowIndexByPosition(n),s=a._recyclingRows,d=s[r],c=d?d.top:0,u=0,m=0,p=0,g=0;if(a._cellRowSpan&&a._cellRowSpan.maxSpan>0){let e=0;if(r>=5?e=5:r>=4?e=4:r>=3?e=3:r>=2?e=2:r>=1&&(e=1),e>0){const t=s[r-e];t&&(d=t,c=d?d.top:0,p=e*d.height,r-=e)}}a._cellRowSpan=[];for(let e=0;e<a._cellsMerge.length;e++){const t=a._cellsMerge[e],o=s.indexOf(t.row);if(r>o&&r<=o+t.rowSpan&&(r=o,d=t.row,p=Math.max(p,c-d.top),c=d.top,a.$.rowContainer.style.top=a.__frozenNearHeight-n+c+"px"),t.colSpan>1)for(let e=0;e<a.viewColumns.length;e++){const o=a.viewColumns[e];let l=o.autoGenerated?o:a.columnByDataField[o.dataField];if(l.visible&&l.left+l.computedWidth-a._scrollView.scrollLeft>=u&&l.left-l.computedWidth-a._scrollView.scrollLeft<a._clientSize.width){let e=a.columnByDataField[t.column.dataField];g=Math.max(g,l.left-e.left+l.computedWidth);break}}}a.isHScrolling&&a._clearCachedTemplates();let h=null;if(!1!==e||a._cellsMerge.length>0){if(a._columnElements)for(let e=0;e<a._columnElements.length;e++){const t=a._columnElements[e];if(!t.parentNode)break;t.set("column",null,!1),t.classList.add("smart-visibility-hidden")}for(let e=0;e<a._columnGroups.length;e++){const t=a._columnGroups[e],o=t.element;o&&(a.rightToLeft?o.style.right=t.right+"px":o.style.left=t.left+"px",o.style.width=t.computedWidth+"px")}a._firstVisibleColumn=null,a._firstVisibleUserColumn=null,a._lastVisibleColumn=null;for(let e=0;e<a.viewColumns.length;e++){let t=a.viewColumns[e];if(t.visible&&(a._firstVisibleColumn||(a._firstVisibleColumn=t),a._firstVisibleUserColumn||t.autoGenerated||(a._firstVisibleUserColumn=t),a._lastVisibleColumn=t),t.element&&(t===a._firstVisibleColumn||t.rowDetailColumn?t.element.classList.add("smart-grid-column-border-collapse"):t.element.classList.remove("smart-grid-column-border-collapse"),!1!==a.appearance.showColumnGroupCellLines&&!1!==a.appearance.showColumnGroupLines||(t.parent&&t.parent.columns&&t.parent.columns[0].dataField===t.dataField?t.element.setAttribute("column-group-first-child",""):t.parent&&t.element.removeAttribute("column-group-first-child")),t.element.removeAttribute("aria-colindex")),t.freeze){if(!0!==t.freeze&&"near"!==t.freeze||t.visible&&(u+=t.computedWidth),!t.element)continue;t.visible?(t.element.classList.remove("smart-visibility-hidden"),t.render()):t.element.classList.add("smart-visibility-hidden")}else if(t.visible&&t.left+t.computedWidth-a._scrollView.scrollLeft>=u-g&&t.left-t.computedWidth-a._scrollView.scrollLeft<a._clientSize.width){a._columnElements||(a._columnElements=[]);const o=a._columnElements[m++];o&&(o.set("column",t,!1),o.parentNode||a.$.columnContainer.appendChild(o),h||(h=t,a._firstRenderedColumn=t),t.element=o,t.render(),o.setAttribute("aria-colindex",e+1),void 0===i&&(i=t.left))}}}if(void 0===i&&(i=0),a.rightToLeft){const e=a._scrollView.scrollWidth-a._scrollView.scrollLeft-a._scrollView.vScrollBar.offsetWidth;a.$.columnContainer.style.right=e+"px",e<=0&&!a._scrollView.scrollWidth&&(a.$.columnContainer.style.right=-a.offsetWidth+a._computedColumnsWidth+"px")}else a.$.columnContainer.style.left=-a._scrollView.scrollLeft+"px";if(a.$.rowContainer.style.top=a.__frozenNearHeight-n+c+"px",a.isScrolling&&!a.isHScrolling&&(a._scrollUpdate&&clearTimeout(a._scrollUpdate),a._scrollUpdate=setTimeout((function(){a.isScrolling||(a.$.rowContainer.style.top=parseInt(a.$.rowContainer.style.top)+.01+"px")}),50)),!1===t)return;if(!a._rowElements)return;const f=a.dataSource&&a.dataSource.virtualDataSource&&!a.dataSource.virtualDataSourceOnExpand&&a.dataSource.length>a.virtualModeCachedRowsCount&&"infinite"!==a.scrolling;let y=0,w=a.behavior.allowRenderCache&&!f&&"grid"===a.view&&!a.dataSource.virtualDataSourceOnExpand&&!a.rowDetail.template&&!a.rowDetail.enabled&&!a._autoHeight&&!a.pager.visible&&!a._frozenFarColumns.length&&!a.hasAttribute("tree");if("grid"!==a.view)for(let e=0;e<a._rowElements.length;e++){const t=a._rowElements[e];t.style.transform="",t.style.top="",t.style.position=""}if(r>=0){m=0;let e=Math.max(a._clientSize.height,a._overflowOffset),t=0;if(f&&(a.rowById=[],a.rows&&a.rows.length>0&&void 0===a.rows[a.rows.length-1].top&&(a.rows[a.rows.length-1].top=(a.rows.length-1)*a.rows[0].height),a.rows&&a.rows.length>0&&(t=a._getVirtualRowIndexByPosition(n),c=t*a.rows[0].height,a.$.rowContainer.style.top=a.__frozenNearHeight-n+c+"px",a.paging.enabled||(r=0)),a.paging.enabled&&(t=a.paging.pageIndex*a._pageSize)),"card"===a.view&&a._cardHeight&&(e+=a._cardHeight),w)for(let e=0;e<a._rowElements.length;e++){const t=a._rowElements[e];delete t.isRendered,t.classList.remove("smart-hidden"),t.classList.remove("aria-rowindex"),t.style.transform="",t.style.top="",t.style.position=""}if(w){let e=Math.max(a._clientSize.height,a._overflowOffset),o=[],l=c;for(let t=r;t<s.length;t++){const i=s[t];if(0===i.height||!i.visible||!1===i.filtered||i.freeze&&i.visible)continue;const r=i.height;if(i.expandHeight&&(e+=a.offsetHeight+i.expandHeight),l+r>=n-p&&l<=n+e||a._autoHeight){for(let e=0;e<a._rowElements.length;e++){const t=a._rowElements[e];if(t.hasAttribute("data-id")&&t.getAttribute("data-id")===""+i.id){o[i.id]=t,t.isRendered=!0;break}}l+=r}}e=Math.max(a._clientSize.height,a._overflowOffset);for(let l=r;l<s.length;l++){const i=s[l];if(0===i.height||!i.visible||!1===i.filtered||i.freeze&&i.visible)continue;const r=i.height;if(i.expandHeight&&(e+=a.offsetHeight+i.expandHeight),c+r>=n-p&&c<=n+e||a._autoHeight){let e;if(e=a._rowElements[m++],!e)break;for(;e&&e.isRendered;)e=a._rowElements[m++];if(!e){console.log("Did not found a row element during the rendering.");continue}e.setAttribute("aria-rowindex",t+l+1);let n=!1;if(i.element=e,i.grid=a,o[i.id]){const a=o[i.id];a.hasAttribute("data-id")&&a.getAttribute("data-id")===""+i.id&&(a===e&&(a.isRendered=!0,n=!0,m=0),n=!0,m=0,i.element=a,e.style.top="999999px",e.setAttribute("data-id",999999),e.setAttribute("aria-rowindex",t+l+1),e=a,a.isRendered=!0)}e.style.top=y+"px",e.style.position="absolute",i.render(n),e.isRendered=!0,c+=r,y+=r}}}else{a.rowDetail.enabled&&(e+=a.offsetHeight);for(let o=r;o<s.length;o++){const l=s[o];if(0===l.height||!l.visible||!1===l.filtered||l.freeze&&l.visible)continue;const i=l.height;if(l.expandHeight&&(e+=a.offsetHeight+l.expandHeight),!(c+i>=n-p&&c<=n+e||a._autoHeight))break;{let e;if(e=a._rowElements[m++],!e)break;if(e.isRendered&&(e.classList.remove("smart-hidden"),e.classList.remove("aria-rowindex"),e.style.transform="",e.style.top="",e.style.position=""),e.setAttribute("aria-rowindex",t+o+1),l.element=e,l.grid=a,f){if(l.index=o+t,l.visibleIndex=o+t,a.selection.enabled&&a._selection){const e=a._selection.indexes,t=l.canNotify;l.canNotify=!1,l.selected=e.indexOf(l.index)>=0,l.canNotify=t}a.paging.enabled?(l.data=a.dataSource[r+m-1],l.data&&(l.id=l.data.$.id,a.rowById[l.id]=l)):(l.data=a.dataSource[m-1],l.data&&(l.id=l.data.$.id,a.rowById[l.id]=l))}l.render(),e.isRendered=!0}c+=i,y+=i}}}a._renderFrozenRows();let _=m;if(m<a._rowElements.length&&!w)for(let e=m;e<a._rowElements.length;e++){const e=a._rowElements[m++];e.classList.add("smart-hidden"),e.removeAttribute("aria-rowindex")}if(w)for(let e=0;e<a._rowElements.length;e++)if(!a._rowElements[e].isRendered){const t=a._rowElements[e];t.classList.add("smart-hidden"),t.removeAttribute("aria-rowindex")}if(a.editing.addNewRow&&a.editing.addNewRow.visible&&"row"!==a.editing.addNewRow.displayMode&&a._rowElements[_]){a._newRow||(a._newRow=new Smart.Grid.Row({data:{},index:9999999,grid:a,addNewRow:!0,inline:!0,autoGenerated:!0}));for(let e=a._rowElements.length-1;e>=0;e--)if(!a._rowElements[e].isRendered){a._newRow.element=a._rowElements[e],a._newRow.element.classList.remove("smart-hidden"),a._newRow.element.style.top=y+"px",a._newRow.element.style.position="absolute",a._newRow.render();break}}f&&(a._selection.selectionRect&&a._refreshCellSelectionRect(),a._copyRects&&a._copyRects.length&&a._refreshCopyRects())}_renderFrozenRows(){const e=this;let t=!1,o=!1;if("card"===e.view)return e.$.rowNearContainer.classList.add("smart-hidden"),void e.$.rowFarContainer.classList.add("smart-hidden");0===e._frozenNearRows.length?e.$.rowNearContainer.classList.add("smart-hidden"):e.$.rowNearContainer.classList.remove("smart-hidden");for(let o=0;o<e._frozenNearRows.length;o++){const l=e._frozenNearRows[o];l.visible||(l.element=e.$.rowNearContainer.children[o],l.element||(l.element=l.createElement(),e.$.rowNearContainer.appendChild(l.element)),l.element.classList.add("smart-hidden")),l.visible&&l.filtered&&(t=!0,l.element=e.$.rowNearContainer.children[o],l.element||(l.element=l.createElement(),e.$.rowNearContainer.appendChild(l.element)),l.render())}t||e.$.rowNearContainer.classList.add("smart-hidden"),0===e._frozenFarRows.length?e.$.rowFarContainer.classList.add("smart-hidden"):e.$.rowFarContainer.classList.remove("smart-hidden");for(let t=0;t<e._frozenFarRows.length;t++){const l=e._frozenFarRows[t];l.visible&&(o=!0),l.element=e.$.rowFarContainer.children[t],l.element||(l.element=l.createElement(),e.$.rowFarContainer.appendChild(l.element)),l.render()}o||e.$.rowFarContainer.classList.add("smart-hidden"),0!==e.columns.length&&e.hasVisibleColumn()||(e.$.rowNearContainer.classList.add("smart-hidden"),e.$.rowFarContainer.classList.add("smart-hidden"));const l=e.rows;l&&null!==l&&0!==l.length||(e.$.rowNearContainer.classList.add("smart-hidden"),e.$.rowFarContainer.classList.add("smart-hidden"),e.filtering.filterRow.visible&&e.$.rowNearContainer.classList.remove("smart-hidden"))}_recycleRotate(e,t,o,l,a){const n=t.getBoundingClientRect(),i=e.getBoundingClientRect();let r=0,s=0;return 0===i.width?(e.innerHTML=a,!1):(n.left>i.left&&(r=i.left-n.left),n.top<i.top&&(s=i.top-n.top),"left"!==o&&""!==o||(r=4),"center"===o&&(r+=i.width/2-n.width/2),"right"===o&&(r+=i.width-n.width-4),"top"!==l&&""!==l||(s=4),"center"!==l&&"middle"!==l||(s+=i.height/2-n.height/2),"bottom"===l&&(s+=i.height-n.height-4),t.style.left=r+"px",t.style.top=s+"px",!0)}_virtualDataRequest(e,t){const o=this;let l=-1,a=-1;if(!o._rowElements&&"infinite"!==o.scrolling)return;if("virtual"===o.scrolling){for(let e=0;e<o._rowElements.length;e++){const t=o._rowElements[e],n=t.row,i=0===e?n.visibleIndex:l+e;t.classList.contains("smart-hidden")||(-1===l&&(l=i),-1!==i&&(a=1+i))}0===o._rowElements.length&&(l=0,a=Math.max(20,parseInt(o.offsetHeight/o.layout.rowMinHeight*1.5)))}else"infinite"===o.scrolling?(l=1/0,a=1/0):(l=0,a=o.dataSource.length);a!==1/0&&(o.dataSource.virtualDataSourceLength||o.dataSource.length)&&(a=Math.min(a,o.dataSource.length)),o.paging.enabled&&(l=o.paging.pageIndex*o._pageSize,a=l+o._pageSize),o._toggledRow||"add"===e||"update"===e||"delete"===e||(o.appearance.displayLoadingIndicator=!0,o._setLoadingIndicatorVisibility()),o._groups||(o._groups=[].concat(o.dataSource.groupBy.toArray())||[]);const n={first:l,last:a,edit:o._editInfo||null,sorting:o.getSortedColumnsByDataField(),filtering:o.getFilteredColumnsByDataField(),filterOperator:o.filtering.operator,grouping:o._groups,row:o._toggledRow?o._toggledRow.data:null,action:e},i=o.dataSource.length,r=o.dataSource.boundSource.length;void 0===o._isFirstVirtualDataSourceRequest&&(o._isFirstVirtualDataSourceRequest=!0),o.dataSource.onVirtualDataSourceRequested((function(e){if(o.appearance.displayLoadingIndicator=!1,o._setLoadingIndicatorVisibility(),o._toggledRow=null,!e)return o._initializeRows(),o._initializeRowElements(),o.refresh(),o._refreshPagesCount(),void(o._autoHeight&&o._initializeRowElements());if("add"===e.action){if(t&&t(e.result),o._autoHeight&&o.rows.length>=o._rowElements.length-1&&(o._initializeRows(),o._initializeRowElements(),o.refresh(),o.filtering.filterRow)){for(let e=0;e<o.columns.length;e++)o.columns[e]._filterEditorInitialized&&(o.columns[e]._filterEditorInitialized=!1);const e=o.filtering.filterRow&&o.filtering.filterRow.visible&&o.filtering.filterRow.cell?o.filtering.filterRow.cell.column.dataField:null;e&&setTimeout((()=>{const t=o.columnByDataField[e];t&&t._filterInfo&&t._filterInfo.input&&t._filterInfo.input.focus()}),100)}return}if("update"===e.action)return void(t&&t(e.result));if("remove"===e.action)return void(t&&t(e.result));const l=o.context;if(o.context=o,o._isFirstVirtualDataSourceRequest&&0===o._initColumns.length&&(o.columns.canNotify=!1,o.columns=[],o._renderColumns(),o.columns.canNotify=!0),"scroll"===e.action)if("infinite"===o.scrolling){const e=o._viewRows;for(let t=0;t<e.length;t++){const l=e[t];l.data&&!l.addNewRow&&l.data.$&&(o.rowById[l.data.$.id]||(o.rowById[l.data.$.id]=l))}o._recycle(!1,!1)}else{const t=e.first>=0?e.first:0,l=e.last!==1/0?e.last:0;let a=0;for(let e=t;e<l;e++)o.rows[e]&&(o.rows[e].data=o.dataSource[a++]);o._recycle(!1,!1)}else if(o.dataSource.length!==i||o.dataSource.boundSource.length!==r||o._isFirstVirtualDataSourceRequest||"expand"===e.action||"filter"===e.action||"sort"===e.action||"pageIndexChange"===e.action||"pageSizeChange"===e.action||"sort"===e.action||"group"===e.action){o.paging.enabled&&o.$.headerPager.querySelector("smart-pager")&&(o.$.headerPager.querySelector("smart-pager").pagesCount=Math.ceil(o.dataSource.length/o._pageSize),o.$.footerPager.querySelector("smart-pager").pagesCount=Math.ceil(o.dataSource.length/o._pageSize));const e=o.filtering.filterRow&&o.filtering.filterRow.visible&&o.filtering.filterRow.cell?o.filtering.filterRow.cell.column.dataField:null;if(o._initializeRows(),o._initializeRowElements(),o.refresh(),o._refreshPagesCount(),o._autoHeight&&o._initializeRowElements(),o.filtering.filterRow){for(let e=0;e<o.columns.length;e++)o.columns[e]._filterEditorInitialized&&(o.columns[e]._filterEditorInitialized=!1);e&&setTimeout((()=>{const t=o.columnByDataField[e];t&&t._filterInfo&&t._filterInfo.input&&t._filterInfo.input.focus()}),100)}}else o.dataSource.virtualDataSourceOnExpand&&o.refresh();o._isFirstVirtualDataSourceRequest&&o.onLoad&&(o.onLoad(o),delete o.onLoad),o._isFirstVirtualDataSourceRequest=!1,o._recycle(),o.context=l,o._onDataUpdated&&o._onDataUpdated()}),n)}localizeString(e,t,o="en"){const l=this;o&&l.messages[o][e]&&(l.messages[o][e]=t,l.refresh())}localizeStrings(e,t="en"){const o=this;t&&(Object.assign(o.messages[t],e),o.refresh())}_createInsertNewRowButton(){const e=this,t=document.createElement("div");return t.className="smart-grid-add-row-button smart-grid-icon smart-icon-plus insert",t.title=e.localize("contextMenuItemInsertRow"),t.style.left=!e.appearance.showViewBar||e.appearance.viewBarAppendTo||e.appearance.showViewBarAsDropdown||e._mobile?"":10+e.layout.viewBarWidth+"px",t.style.boxShadow="var(--smart-elevation-1)",t.style.width="16px",t.style.height="16px",t.style.fontSize="12px",t.onclick=()=>{e._addRowTimer&&clearTimeout(e._addRowTimer),e._addRowTimer=setTimeout((()=>{if(e.dataSource&&e.dataSource.virtualDataSource)return void e._insertNewRowAfter();const t={};for(let o=0;o<e.columns.length;o++){const l=e.columns[o];void 0!==l.defaultValue&&null!==l.defaultValue&&("today"===l.defaultValue&&"date"===l.dataType?(e._today||(e._today=new Date,e._todayYear=e._today.getFullYear(),e._todayMonth=e._today.getMonth(),e._todayDate=e._today.getDate()),t[l.dataField]=new Date(e._todayYear,e._todayMonth,e._todayDate)):t[l.dataField]=l.defaultValue)}e._addingNewRow=!0;const o=e.editing.addNewRow._insertButton.row;o?e.insertRow(t,1+o.visibleIndex):e._add(t),e._recycle(!1),e.closeMenu(),e._addingNewRow=!1,e.editing.addNewRow.visible&&e.$.placeholder.classList.contains("smart-hidden")&&"button"!==e.editing.addNewRow.displayMode&&e.editing.addNewRow._addButton.classList.remove("show")}),0)},t}_createAddNewRowButton(){const e=this,t=document.createElement("div");return t.className="smart-grid-add-row-button smart-grid-icon smart-icon-plus",t.title=e.localize("addNewRow"),t.style.left=!e.appearance.showViewBar||e.appearance.viewBarAppendTo||e.appearance.showViewBarAsDropdown||e._mobile?"":10+e.layout.viewBarWidth+"px",e._addNewGridRow=t.onclick=()=>{e._addRowTimer&&clearTimeout(e._addRowTimer),e._addRowTimer=setTimeout((()=>{if(e.dataSource&&e.dataSource.virtualDataSource)return void e._insertNewRowAfter();const t={};for(let o=0;o<e.columns.length;o++){const l=e.columns[o];void 0!==l.defaultValue&&null!==l.defaultValue&&("today"===l.defaultValue&&"date"===l.dataType?(e._today||(e._today=new Date,e._todayYear=e._today.getFullYear(),e._todayMonth=e._today.getMonth(),e._todayDate=e._today.getDate()),t[l.dataField]=new Date(e._todayYear,e._todayMonth,e._todayDate)):t[l.dataField]=l.defaultValue)}e._addingNewRow=!0,e._add(t),e._mobile||(e._scrollView.vScrollBar.value=e._scrollView.vScrollBar.max),e._recycle(!1),e.closeMenu(),e._addingNewRow=!1,e.editing.addNewRow.visible&&e.$.placeholder.classList.contains("smart-hidden")&&"button"!==e.editing.addNewRow.displayMode&&e.editing.addNewRow._addButton.classList.remove("show")}),0)},t}removeColumn(e){const t=this;let o=-1;if(e)for(let l=0;l<t.columns.length;l++)if(t.columns[l].dataField===e){o=l;break}o>=0&&t.columns.splice(o,1)}addColumn(e,t,o=!0){const l=this;if(e){let a=-1;if(t)for(let e=0;e<l.columns.length;e++)if(l.columns[e].dataField===t){a=e,!1===o&&(a=e+1);break}if("string"==typeof e){const t=l._getKanbanTaskField(e);if(t){if(a>=0)return void l.columns.splice(a,0,t);l.columns.push(t)}return}if(a>=0&&a<l.columns.length)return void l.columns.splice(a,0,e);l.columns.push(e)}}insertColumnAfter(e,t){e&&this.addColumn(e,t,!1)}insertColumnBefore(e,t){e&&this.addColumn(e,t,!0)}addNewColumn(e){e&&this.addColumn(e)}_createAddNewColumnButton(){const e=this,t=document.createElement("div");return t.className="smart-grid-add-column-button smart-grid-icon smart-icon-plus",t.title=e.localize("addNewColumn"),t.onclick=()=>{e._openAddColumnDialog(),e.addEventListener("closeColumnDialog",(()=>{e.layout.isDirty=!0,e._resetCachedLayout(),e._refreshLayout()}))},t}_showAddNewRowButton(e){const t=this;if(!t.columns.length)return;if("grid"!==t.view&&t.editing.addNewRow._addButton)return t.editing.addNewRow._addButton.classList.add("smart-hidden"),void t.editing.addNewRow._addButton.classList.remove("show");if("grid"===t.view&&t.editing.addNewRow._addButton&&t.editing.addNewRow._addButton.classList.remove("smart-hidden"),"float"===e&&t.computedVerticalScrollBarVisibility&&t.editing.addNewRow._addButton&&!t.editing.addNewRow._addButton.classList.contains("show"))return;if("float"===e&&t._addingNewRow)return;const o=()=>{t.editing.addNewRow._addButton&&t.editing.addNewRow._addButton&&("float"!==e&&(t.appearance.showRowHeader||t.appearance.showRowHeaderNumber)&&"card"!==t.view?t.editing.addNewRow._addButton.classList.remove("float"):(!t.computedVerticalScrollBarVisibility&&t.dataSource&&0===t.dataSource.length||t.computedVerticalScrollBarVisibility&&"float"===e||"card"===t.view)&&t.editing.addNewRow._addButton.classList.add("float"),t.computedHorizontalScrollBarVisibility?t.pager.visible?t.editing.addNewRow._addButton.style.bottom="68px":t.editing.addNewRow._addButton.style.bottom="20px":t.pager.visible?t.editing.addNewRow._addButton.style.bottom="48px":t.editing.addNewRow._addButton.style.bottom="",t.grouping.enabled&&t.dataSource)&&(!(t.dataSource.groupBy&&t.dataSource.groupBy.length>0)||t.editing.addNewRow._addButton.classList.remove("show"))};t.editing.addNewRow._addButton&&t.editing.addNewRow.visible&&t.$.placeholder.classList.contains("smart-hidden")&&"button"!==t.editing.addNewRow.displayMode&&t.editing.addNewRow._addButton.classList.remove("show"),!t.editing.addNewRow.visible||"row"===t.editing.addNewRow.displayMode&&t.$.placeholder.classList.contains("smart-hidden")||(t.editing.addNewRow._addButton?requestAnimationFrame((()=>{t.editing.addNewRow._addButton&&(t.editing.addNewRow._addButton.classList.add("show"),t.editing.addNewRow._addButton.style.left=!t.appearance.showViewBar||t.appearance.viewBarAppendTo||t.appearance.showViewBarAsDropdown||t._mobile?"":10+t.layout.viewBarWidth+"px",o(),"insertButton"===t.editing.addNewRow.displayMode&&t.editing.addNewRow._addButton.classList.remove("show"),t.editing.addNewRow.visible&&!t.computedVerticalScrollBarVisibility&&t._newRow&&t.editing.addNewRow._addButton.classList.remove("show"),"insertButton"===t.editing.addNewRow.displayMode&&t.editing.addNewRow._addButton.classList.remove("show"))})):(t.editing.addNewRow._addButton=t._createAddNewRowButton(),t.editing.addNewRow._insertButton=t._createInsertNewRowButton(),t.appendChild(t.editing.addNewRow._addButton),t.appendChild(t.editing.addNewRow._insertButton),"insertButton"===t.editing.addNewRow.displayMode&&t.editing.addNewRow._addButton.classList.remove("show"),requestAnimationFrame((()=>{t.editing.addNewRow._addButton&&(t.editing.addNewRow._addButton.classList.add("show"),o(),(t.editing.addNewRow.visible&&t.$.placeholder.classList.contains("smart-hidden")&&"button"!==t.editing.addNewRow.displayMode||!t.computedVerticalScrollBarVisibility&&t.editing.addNewRow.visible&&t.$.placeholder.classList.contains("smart-hidden"))&&t.editing.addNewRow._addButton.classList.remove("show"))}))))}_showAddNewColumnButton(){const e=this,t=()=>{e.editing.addNewColumn._addButton.classList.add("float")};e.editing.addNewColumn.visible&&(e.editing.addNewColumn._addButton||(e.editing.addNewColumn._addButton=e._createAddNewColumnButton(),e.appendChild(e.editing.addNewColumn._addButton)),requestAnimationFrame((()=>{e.editing.addNewColumn._addButton.classList.add("show"),t()})))}_verticalScrollRecycle(e,t){const o=this;if(o._layoutSuspended||!1===o.isAttached)return;if(o._isUpdating)return;if(o.editing.isEditing&&(!0!==o._disableEndEdit&&o.endEdit(),o._isUpdating))return;o._removeCellContentPopup(),o._inputOverlay&&(o._inputOverlay.parentNode&&o._inputOverlay.parentNode.removeChild(o._inputOverlay),o._inputOverlay=null),o._selection.selectionRect&&o._refreshCellSelectionRect(),o._copyRects&&o._copyRects.length&&o._refreshCopyRects();const l=o._recyclingRows;let a=l[t],n=a.top,i=!1;for(let r=0;r<o._cellsMerge.length;r++){const s=o._cellsMerge[r],d=l.indexOf(s.row);t>d&&t<=d+s.rowSpan&&(t=d,a=s.row,n=a.top,o.$.rowContainer.style.top=o.__frozenNearHeight-e+n+"px",i=!0)}i||(o.$.rowContainer.style.top=o.__frozenNearHeight-e+n+"px")}_verticalScrollbarHandler(e){const t=this;t.menu&&t.menu.column&&t.closeMenu(),t.isScrolling=!0,t._scrollTimer&&clearTimeout(t._scrollTimer),t._layoutSuspended||(t._scrollTimer=setTimeout((()=>{if("virtual"===t.scrolling)t._recycle(!1);else{const e=t._scrollView.scrollTop;let o=t._getRowIndexByPosition(e);o!==t._scrollRowIndex?(t._recycle(!1,!0,!0,o),t._scrollRowIndex=o):t._verticalScrollRecycle(e,o)}if(t.isScrolling=!1,e.max===e.value&&e.max>0){if(t.$.fireEvent("scrollBottomReached"),"infinite"===t.scrolling)return t.appearance.displayLoadingIndicator=!0,t._setLoadingIndicatorVisibility(),t._virtualScrollTimer&&clearTimeout(t._virtualScrollTimer),void(t._virtualScrollTimer=setTimeout((()=>{t._virtualDataRequest("scroll"),t.appearance.displayLoadingIndicator=!1,t._setLoadingIndicatorVisibility()}),50));t.editing.addNewRow._addButton&&"card"!==t.view&&t.editing.addNewRow._addButton.classList.remove("show")}else t.editing.addNewRow.visible&&"row"!==t.editing.addNewRow.displayMode&&t.editing.addNewRow._addButton&&e.max>0&&(t.editing.addNewRow._addButton.classList.add("show"),t.editing.addNewRow._addButton.classList.remove("scroll"),t.editing.addNewRow._addButton.classList.add("float"),"grid"===t.view&&"insertButton"===t.editing.addNewRow.displayMode&&t.editing.addNewRow._addButton.classList.remove("show"));"virtual"===t.scrolling&&(t.appearance.displayLoadingIndicator=!0,t._setLoadingIndicatorVisibility(),t._virtualScrollTimer&&clearTimeout(t._virtualScrollTimer),t._virtualScrollTimer=setTimeout((()=>{t._virtualDataRequest("scroll"),t.appearance.displayLoadingIndicator=!1,t._setLoadingIndicatorVisibility()}),50)),e.min===e.value&&t.$.fireEvent("scrollTopReached")}),0))}getVerticalScrollMax(){return this.scrollHeight}getHorizontalScrollMax(){return this.scrollWidth}getHorizontalScrollValue(){return this.scrollLeft}setHorizontalScrollValue(e){this.scrollLeft=e}getVerticalScrollValue(){return this.scrollTop}setVerticalScrollValue(e){this.scrollTop=e}clearRows(){const e=this;e.dataSource=new Smart.DataAdapter({dataSource:[]}),e.rowHierarchy=null,e._visibleRows=null,e.__viewRows=null,e.rows.canNotify=!1,e.rows.length=0,e.rows.canNotify=!0,e.clearSelection(),e._refresh()}isEmpty(){const e=this;return!!(null===e.dataSource||e.dataSource&&e.dataSource.dataFields&&0===e.dataSource.length&&0===e.dataSource.dataSource.length&&!e.dataSource.virtualDataSource)}setRowStyle(e,t){const o=this,l=o.rowById[e];l&&(l.style=t,o._recycle(!1,!0))}setCellStyle(e,t,o){const l=this,a=l.rowById[e];if(a){const e=a.getCell(t);if(e){const t=e.canNotify;if(e.canNotify=!1,o)for(let t in o)void 0!==e[t]&&(e[t]=o[t]);else e.background=null,e.color=null,e.fontSize=null,e.fontFamily=null,e.fontWeight=null,e.textDecoration=null,e.fontStyle=null;e.canNotify=t,l._recycle(!1,!0)}}}setCellFormula(e,t,o){const l=this,a=l.rowById[e];if(a){const e=a.getCell(t);if(e){const t=e.canNotify;e.canNotify=!1,e.formula=o,e.canNotify=t,l._recycle(!1,!0)}}}dataBind(){const e=this;if(delete e.__autoRowHeight,e._virtualOnExpandCache=[],e._cellsMerge=[],e._cellStyles=[],null===e.dataSource||e.dataSource&&e.dataSource.dataFields&&0===e.dataSource.length&&0===e.dataSource.dataSource.length&&!e.dataSource.virtualDataSource)e.clearRows();else if(Array.isArray(e.dataSource))if(e.dataSourceSettings.dataFields&&e.dataSourceSettings.dataFields.length>0)e.dataSource=new Smart.DataAdapter({dataSource:e.dataSource,dataSourceType:e.dataSourceSettings.dataSourceType,dataFields:e.dataSourceSettings.dataFields,keyDataField:e.dataSourceSettings.keyDataField,parentDataField:e.dataSourceSettings.parentDataField,childrenDataField:e.dataSourceSettings.childrenDataField,groupBy:e.dataSourceSettings.groupBy&&e.dataSourceSettings.groupBy.length?e.dataSourceSettings.groupBy:e.grouping.groupBy,mapChar:e.dataSourceSettings.mapChar,root:e.dataSourceSettings.root,record:e.dataSourceSettings.record,autoGenerateColumns:e.dataSourceSettings.autoGenerateColumns,id:e.dataSourceSettings.id,virtualDataSource:e.dataSourceSettings.virtualDataSource,virtualDataSourceOnExpand:e.dataSourceSettings.virtualDataSourceOnExpand});else if(e.columns&&e.columns.length){let t=[];for(let o=0;o<e.columns.length;o++){const l=e.columns[o];t.push({name:l.dataField,dataType:l.dataType||"string"}),l.displayField!==l.dataField&&t.push({name:l.displayField,dataType:l.dataType||"string"})}e.dataSource=new Smart.DataAdapter({dataSource:e.dataSource,dataFields:t,dataSourceType:e.dataSourceSettings.dataSourceType,keyDataField:e.dataSourceSettings.keyDataField,parentDataField:e.dataSourceSettings.parentDataField,childrenDataField:e.dataSourceSettings.childrenDataField,groupBy:e.dataSourceSettings.groupBy&&e.dataSourceSettings.groupBy.length?e.dataSourceSettings.groupBy:e.grouping.groupBy,mapChar:e.dataSourceSettings.mapChar,root:e.dataSourceSettings.root,record:e.dataSourceSettings.record,autoGenerateColumns:e.dataSourceSettings.autoGenerateColumns,id:e.dataSourceSettings.id,virtualDataSource:e.dataSourceSettings.virtualDataSource,virtualDataSourceOnExpand:e.dataSourceSettings.virtualDataSourceOnExpand})}else e.dataSource=new Smart.DataAdapter({dataSource:e.dataSource});const t=e._filters,o=e._sortedColumns;if(e.clearSort(),e.filtering.filterRow)for(let t=0;t<e.columns.length;t++)e.columns[t]._filterEditorInitialized=!1;for(let t=0;t<e.columns.length;t++)delete e.columns[t]._cellsCachedValues;e._initColumns&&0===e._initColumns.length&&(e.columns=[],e._renderColumns(!0)),e._renderRows(),"virtual"===e.scrolling||e.paging.enabled&&e.dataSource&&e.dataSource.virtualDataSource||e.dataSource&&e.dataSource.virtualDataSource?e._virtualDataRequest("dataBind"):e.paging.enabled&&(!e.dataSource||e.dataSource&&!e.dataSource.url)&&e._refreshPagesCount(),o&&e._refreshSort(o),t&&t.length>0&&(e._filters=null,e.refreshFilters())}refresh(e,t){const o=this;o.isInitialized&&(e&&(o._initializeRows(),o._initializeRowElements()),o._refresh(t),o._refreshSummary())}refreshView(e=!0){const t=this;if(t._recycleFiles=!0,!e)return t._recycle(!1,!0),void delete t._recycleFiles;t._recycle(),delete t._recycleFiles}beginUpdate(){const e=this;e._isUpdating||(e._isUpdating=0),e._isUpdating++}endUpdate(e,t,o=!0){const l=this;l._isUpdating--,l._isUpdating<0&&(l._isUpdating=0),!1!==e?l.refresh():!1!==t&&l.refreshView(o)}_generateUUID(){const e=window.crypto,t=new Uint8Array(16);e.getRandomValues(t),t[6]=15&t[6]|64,t[8]=63&t[8]|128;const o=Array.from(t,(e=>e.toString(16).padStart(2,"0"))).join("");return`${o.substring(0,8)}-${o.substring(8,12)}-${o.substring(12,16)}-${o.substring(16,20)}-${o.substring(20)}`}}),Smart.Grid.Extend=function(e){if(!e)return;const t=Object.getOwnPropertyNames(e.prototype);for(let o in t){const l=t[o];"constructor"!==l&&(Smart.Grid.prototype[l]=e.prototype[l])}},Smart.Grid.Extend(Smart.Utilities.Grid.Resize),Smart.Grid.Extend(Smart.Utilities.Grid.Reorder),Smart.Grid.Extend(Smart.Utilities.Grid.Pager),Smart.Grid.Extend(Smart.Utilities.Grid.Filter),Smart.Grid.Extend(Smart.Utilities.Grid.Sort),Smart.Grid.Extend(Smart.Utilities.Grid.Menu),Smart.Grid.Extend(Smart.Utilities.Grid.Select),Smart.Grid.Extend(Smart.Utilities.Grid.Edit),Smart.Grid.Extend(Smart.Utilities.Grid.Dialog),Smart.Grid.Extend(Smart.Utilities.Grid.Group),Smart.Grid.Extend(Smart.Utilities.Grid.Tree),Smart.Grid.Extend(Smart.Utilities.Grid.Export),Smart.Grid.Extend(Smart.Utilities.Grid.Chart),Smart.Grid.Extend(Smart.Utilities.Grid.View),Smart.Grid.Cell=Smart.Utilities.Grid.Cell,Smart.Grid.Row=Smart.Utilities.Grid.Row,Smart.Grid.Column=Smart.Utilities.Grid.Column;
1450
1450
 
1451
1451
  /***/ }),
1452
1452
 
@@ -1474,7 +1474,7 @@ Smart.Utilities.Assign("Grid.Export",class{exportData(e,t,o){const a=this,l=new
1474
1474
  /***/ 884:
1475
1475
  /***/ (() => {
1476
1476
 
1477
- Smart.Utilities.Assign("Grid.Filter",class{addFilter(e,t,l){const a=this,i=a.columnByDataField[e];if(!i){if(!a.dataSource||!a.dataSource.dataFields)return;if(!a.dataSource.dataFields.find((e=>e.name===e)))return}const r=a._getFilterDataType(i);if("string"==typeof t?t=a.dataSource._createFilter(r,[t]):t&&Array.isArray(t)&&(t=a.dataSource._createFilter(r,t)),"string"===r&&i.editor&&i.editor.dataSource&&i.dataField===i.displayField&&i.editor.dataSource[0]){const e=i.editor.dataSource[0];void 0!==e.label&&void 0!==e.value&&i.editor.dataSource.forEach((e=>{e.value===t.filters[0].value&&(t.filters[0].value=e.label)}))}if(i&&i.canNotify){if(i.setProperty("filter",t),a._isUpdating)return;!1!==l&&(a._filterRowInputOnFocus=!0,a.refreshFilters(),delete a._filterRowInputOnFocus)}}removeFilter(e,t){const l=this,a=l.columnByDataField[e];if(a&&a.canNotify){if(a.setProperty("filter",null),l._isUpdating)return;!1!==t&&(l._filterRowInputOnFocus=!0,l.refreshFilters(),delete l._filterRowInputOnFocus)}a&&delete a._filterState}findCells(e){const t=this,l=t.find(e,null,null,"or"),a=[];"string"==typeof e&&e.indexOf(",")>=0&&(e=e.split(","));for(let i=0;i<l.length;i++){const r=l[i];for(let l=0;l<t.columns.length;l++){const i=t.columns[l],n=r[i.dataField];if(Array.isArray(e))for(let t=0;t<e.length;t++)(""+n).trim().toLowerCase()===(""+e[t]).trim().toLowerCase()&&a.push([r.$.id,i.dataField,e[t]]);else(""+n).trim().toLowerCase()===(""+e).trim().toLowerCase()&&a.push([r.$.id,i.dataField,e])}}return a}find(e,t,l,a="and"){const i=this;let r=[];if(l){const e={"=":"EQUAL","<>":"NOT_EQUAL","!=":"NOT_EQUAL",not_like:"DOES_NOT_CONTAIN",like:"CONTAINS","<":"LESS_THAN",">":"GREATER_THAN","<=":"LESS_THAN_OR_EQUAL",">=":"GREATER_THAN_OR_EQUAL",equal:"EQUAL","not equal":"NOT_EQUAL","less than":"LESS_THAN","greater than":"GREATER_THAN","greater than or equal":"GREATER_THAN_OR_EQUAL","less than or equal":"LESS_THAN_OR_EQUAL","starts with":"STARTS_WITH","ends with":"ENDS_WITH",notEqual:"NOT_EQUAL",not_equal:"NOT_EQUAL",lessThan:"LESS_THAN",greaterThan:"GREATER_THAN",greaterThanOrEqual:"GREATER_THAN_OR_EQUAL",lessThanOrEqual:"LESS_THAN_OR_EQUAL",less_than:"LESS_THAN",greater_than:"GREATER_THAN",greater_than_or_equal:"GREATER_THAN_OR_EQUAL",less_than_or_equal:"LESS_THAN_OR_EQUAL",null:"null","":"EMPTY",isblank:"EMPTY",isnotblank:"NOT_EMPTY",isBlank:"EMPTY",isNotBlank:"NOT_EMPTY",CONTAINS:"CONTAINS",DOES_NOT_CONTAIN:"DOES_NOT_CONTAIN",contains:"CONTAINS",does_not_contain:"DOES_NOT_CONTAIN","not contains":"DOES_NOT_CONTAIN",notcontains:"DOES_NOT_CONTAIN",notContains:"DOES_NOT_CONTAIN",startswith:"STARTS_WITH",endswith:"ENDS_WITH",starts_with:"STARTS_WITH",ends_with:"ENDS_WITH",startsWith:"STARTS_WITH",endsWith:"ENDS_WITH",NULL:"NULL",NOT_NULL:"NOT_NULL"};e[l]&&(l=e[l])}const n=(e,a="or")=>{let r=[];for(let n=0;n<i.columns.length;n++){const o=i.columns[n],s=new Smart.Utilities.FilterGroup;let d;t&&o.dataField!==t||("string"===o.dataType?(l||(l="CONTAINS"),d=s.createFilter("string",e,l)):"number"===o.dataType?(l||(l="EQUAL"),d=s.createFilter("number",e,l)):"date"===o.dataType&&(l||(l="EQUAL"),d=s.createFilter("date",e,l)),s.addFilter(a,d),r.push([o.dataField,s]))}return r};void 0!==e&&"string"==typeof e&&e.indexOf(",")>=0&&(e=e.split(","));let o=[];if(Array.isArray(e))for(let t=0;t<e.length;t++)o.push(n(e[t].trim()));else r=n(e);const s=i.dataSource;if(!s)return[];let d=[];const u=(e,t)=>{let l=!1;for(let a=0;a<t.length;a++){const i=t[a],r=e[i[0]];l=l||i[1].evaluate(r)}return l};for(let e=0;e<s.length;e++){const t=s[e];if(o.length)if("and"===a){let e=!0;for(let l=0;l<o.length;l++)e=e&&u(t,o[l]);e&&d.push(t)}else{let e=!1;for(let l=0;l<o.length;l++)e=e||u(t,o[l]);e&&d.push(t)}else u(t,r)&&d.push(t)}return d}_applyJSONFilters(e,t){const l=this;function a(e){for(var t={},a=0;a<e.length;a++){const d=e[a];let u=d.field;const c=d.type,f=d.operator,m=d.value,F=d.logic;for(var i=0;i<l.columns.length;i++){var r=l.columns[i];u===r.label&&r.datafield&&(u=r.datafield)}if(!t[u]){var n=new Smart.FilterGroup;t[u]={filterGroup:n,logic:F||"and"}}F&&(t[u].logic=F||"and");var o,s=t[u].filterGroup;switch(c){case"string":o=s.createFilter("stringFilter",m,f);break;case"date":o=s.createFilter("dateFilter",m,f);break;case"number":o=s.createFilter("numericFilter",m,f);break;case"boolean":case"bool":o=s.createFilter("booleanFilter",m,f);break;default:continue}s.addFilter(t[u].logic.toLowerCase(),o)}return t}if(t)t(a(e));else{l.beginUpdate(),l.clearFilter();var i=a(e);for(var r in i){var n=i[r].filterGroup;l.addFilter(r,n,!1)}l.endUpdate(),l.refreshFilters()}}filterBy(e,t,l){const a=this;let i,r=[];if(a.ai&&a.ai.key)return void(()=>{const t=e=>{a._applyJSONFilters(e,l)};(()=>{let l='You are a helpful assistant converting natural language filter queries into structured JSON filters.\n "Use only these columns:';for(let e=0;e<a.columns.length;e++){const t=a.columns[e];t.allowFilter&&(l+="- "+t.label+" ("+t.dataType+") => "+t.dataField+"\n")}l+='\n Supported operators: CONTAINS, EQUAL, NOT_EQUAL, GREATER_THAN, LESS_THAN, GREATER_THAN_OR_EQUAL, LESS_THAN_OR_EQUAL, STARTS_WITH, ENDS_WITH \n Supported types: string, number, date, boolean\n Respond in this format\n [\n {\n "field": "dataField",\n "operator": "some operator",\n "value": "some value",\n "type": "some type",\n "logic": "AND }\n ]',function(e,t,l,i,r,n){const o=e||"https://api.openai.com/v1/chat/completions",s=new XMLHttpRequest;s.open("POST",o,!0),s.setRequestHeader("Authorization","Bearer "+t),s.setRequestHeader("Content-Type","application/json"),a._aiCanFetch=!0,s.onreadystatechange=function(){if(4===s.readyState)if(s.status>=200&&s.status<300)try{var e=JSON.parse(s.responseText);if(a._aiCanFetch){var t=e.choices[0].message.content,l=JSON.parse(t);r&&"function"==typeof r&&r(l),a._aiCanFetch=!1,n(null,l)}else n(null,[])}catch(e){console.error("Failed to parse OpenAI response:",s.responseText),n(e,[])}else console.error("Error calling OpenAI API:",s.status,s.statusText),n(new Error("HTTP error: "+s.status),[])};var d=JSON.stringify({model:"gpt-4",messages:[{role:"system",content:l},{role:"user",content:"Query: "+i}],temperature:0});s.send(d)}(a.ai.url,a.ai.key,l,e,t,(function(e){}))})()})();void 0!==e&&"string"==typeof e&&e.indexOf(",")>=0&&(e=e.split(",")),r=((e,l="or")=>{let r=[];for(let n=0;n<a.columns.length;n++){const o=a.columns[n],s=new Smart.Utilities.FilterGroup;let d;t&&o.dataType!==t||("string"===o.dataType?(i="CONTAINS",d=s.createFilter("string",e,i)):"number"===o.dataType?(i="EQUAL",d=s.createFilter("number",e,i)):"date"===o.dataType&&(i="EQUAL",d=s.createFilter("date",e,i)),s.addFilter(l,d),r.push([o.dataField,s]))}return r})(e),a.beginUpdate(),a.clearFilter();const n=a.filtering.operator;a.filtering.operator="or";for(let e=0;e<r.length;e++){const t=r[e];a.addFilter(t[0],t[1],!1)}a.endUpdate(),a.refreshFilters(),a.filtering.operator=n}clearFilter(){const e=this;for(let t=0;t<e.columns.length;t++){const l=e.columns[t];l&&(l.setProperty("filter",null),l._filterInfo&&(delete l._filterInfo.value,delete l._filterInfo.condition))}e._refreshFilterRowEditors(),e.refreshFilters()}getFilteredColumns(){const e=this;if(e._filters){const t=[];for(let l=0;l<e._filters.length;l++){const a=e._filters[l];t.push({dataField:a[0],filter:a[1].toString()})}return t}return[]}getFilteredColumnsByDataField(){const e=this;if(e._filters){const t=[];for(let l=0;l<e._filters.length;l++){const a=e._filters[l];t[a[0]]=a[1],t.length++}return t}return[]}getVisibleRows(){const e=this;if(e._visibleRows)return e._visibleRows;const t=[],l=e._viewRows,a=e.editing.addNewRow.visible&&"far"!==e.editing.addNewRow.position&&"button"!==e.editing.addNewRow.displayMode?1:0,i=e.grouping.enabled&&e.dataSource.groupBy&&e.dataSource.groupBy.length>0;let r=0;for(let e=0;e<l.length;e++){const n=l[e];n.canNotify=!1,n.visibleIndex=-1,!n.visible||!1===n.filtered&&void 0!==n.filtered||(i?n.leaf?n.visibleIndex=r++:n.visibleIndex=-1:n.visibleIndex=t.length-a,t.push(n)),n.canNotify=!0}return e._visibleRows=t,t}_refreshFilterRowEditors(){const e=this;if(e.filtering.filterRow)for(let t=0;t<e.columns.length;t++)e.columns[t]._filterEditorInitialized&&(e.columns[t]._filterEditorInitialized=!1)}refreshSortAndFilters(){this._refreshDataFilters()}_refreshDataFilters(){const e=this;!1!==e.editing.autoUpdateFilterAndSort&&(e._supressFilter||(!e._filters||e._filters&&0===e._filters.length)&&(!e._sortedColumns||e._sortedColumns&&0===e._sortedColumns.length)||(e.beginUpdate(),e._sortedColumns&&e._sortedColumns.length>0&&e.refreshSort(),e._filters&&e._filters.length>0&&e.refreshFilters(!0),e.endUpdate()))}refreshFilters(e){const t=this,l=[];t._filters||(t._filters=[]);for(let e=0;e<t.columns.length;e++){const a=t.columns[e];a.filter&&l.push([a.displayField,a.filter])}if(t.scrollTop=0,t.closeMenu(),t.dataSource&&!t.dataSource.onFilter&&(t.dataSource.onFilter=function(){const e=t._viewRows;for(let t=0;t<e.length;t++){const l=e[t];if(l.data&&!l.addNewRow){if(!l.data.$){l.filtered=!0;continue}l.filtered=void 0===l.data.$.filtered||l.data.$.filtered}}t.refresh()}),JSON.stringify(t._filters)===JSON.stringify(l)&&!0!==e)return void(t._visibleRows=null);if(t._filters=l,t._visibleRows=null,t.dataSource&&t.dataSource.virtualDataSource)t.closeMenu(),t._virtualDataRequest("filter");else{const e=t._filterOperator||t.filtering.operator;t.dataSource._filter(l,e)}t.paging.enabled&&t.dataSource&&!t.dataSource.virtualDataSource&&t._refreshPagesCount();let a=[];for(let e=0;e<t.columns.length;e++){const l=t.columns[e];l.filter&&a.push(l)}let i=[],r=[],n=[];if(t._filters)for(let e=0;e<t._filters.length;e++){const l=t._filters[e];n.push(l[0]);let a="";const o=t.columnByDataField[l[0]];for(let e=0;e<l[1].filters.length;e++){const t=l[1].filters[e].condition,i=l[1].filters[e].value,r=l[1].logicalOperators[e],n=1===r||"or"===r?"or":"and";o&&"string"===o.dataType?a+=`"${t}" "${i}"`:!o||"date"!==o.dataType&&"time"!==o.dataType&&"datetime"!==o.dataType?a+=`"${t}" ${i}`:i.getFullYear?a+=`"${t}" ${i.getFullYear()+"-"+(1+i.getMonth())+"-"+i.getDate()}`:a+=`"${t}" ${""+i}`,e<l[1].filters.length-1&&(a+=` ${n} `)}r.push([l[0],a]),i.push({dataField:l[0],filter:l[1]})}t.summaryRow.visible&&(t._calculateSummary(),t._recycle(!1)),e||t.$.fireEvent("filter",{columns:a,expressions:JSON.parse(JSON.stringify(r)),dataFields:n,data:JSON.parse(JSON.stringify(i))}),t._onFilter&&t._onFilter()}_getFilterDataType(e){const t=this;let l=e.dataType;if(e.displayField!==e.dataField&&t.dataSource&&t.dataSource.dataFields){const a=t.dataSource.dataFields.find((t=>t.name===e.displayField));a&&(l=a.dataType||"string")}return l}_handleFilterCellFocus(e){const t=this,l=e.column._filterInfo,a=l.editor,i=l.input,r=e.column;let n=r.dataType;if(a.setAttribute("focus",""),t.filtering.filterRow.cell=e,"RANGE"===l.condition)t._openFilterCellDialog(e,(e=>{const l=e._filterInfo,a=l.editor,i=l.range,r=l.input,n=l.cell;if(i){const l=new Smart.FilterGroup;l.addFilter("and",l.createFilter(e.dataType,i.min,"GREATER_THAN_OR_EQUAL")),l.addFilter("and",l.createFilter(e.dataType,i.max,"LESS_THAN_OR_EQUAL")),t.addFilter(e.dataField,l)}else t.removeFilter(e.dataField);if(t.autoSaveState(),a&&r)if(r.type="",i){const t=n.getFormattedValue(i.min,e.cellsFormat),l=n.getFormattedValue(i.max,e.cellsFormat);r.value=t+" - "+l}else r.value=""}));else if(r.displayField!==r.dataField&&(n=t._getFilterDataType(r)),i.type="number"===n||"int"===n||"float"===n?"number":"",l.value&&(i.value=l.value,"date"===n)){const t=new Smart.FilterGroup;if("string"==typeof l.value?i.value=e.getFormattedValue(l.value,r.cellsFormat):i.value=e.getFormattedValue(l.value[0],r.cellsFormat),l.value.length>1){let a=[];for(let i=0;i<l.value.length;i++)t.addFilter("or",t.createFilter(r.dataType,l.value[i],l.condition||"EQUAL")),a.push(e.getFormattedValue(l.value[i],r.cellsFormat||""));i.value=a.toString()}}}_handleFilterCellBlur(e){const t=this,l=e.column._filterInfo,a=l.editor,i=l.input,r=e.column,n=l.condition,o=t._getFilterDataType(r);if(t.filtering.filterRow.cell=null,r.filterRowMenu&&r.filterRowMenu.classList.contains("open"))a.removeAttribute("focus");else{if(""!==i.value&&"RANGE"!==n)if("date"===r.dataType){let t=[];if(i.value.indexOf(",")>=0&&(t=i.value.split(","),t=t.forEach((e=>Smart.Utilities.DateTime.ParseDate(e.trim(),r.cellsFormat)))),t.length>1){l.value=t;let a=[];const n=new Smart.FilterGroup;for(let i=0;i<t.length;i++)n.addFilter("or",n.createFilter(r.dataType,t[i],l.condition||"EQUAL")),a.push(e.getFormattedValue(t[i],r.cellsFormat||""));i.value=a.toString()}else r.cellsFormat?l.value=Smart.Utilities.DateTime.ParseDate(i.value,r.cellsFormat):l.value=new Date(i.value),i.value=e.getFormattedValue(l.value,r.cellsFormat)}else"number"===o||"int"===o||"float"===o?(l.value=parseFloat(i.value),i.type="",i.value=e.getFormattedValue(l.value,r.cellsFormat)):l.value=i.value;"auto"===t.filtering.filterRow.applyMode&&t._handleFilterCellValue(e),a.removeAttribute("focus")}}getExcelFilterDataSource(e){const t=this,l=t.columnByDataField[e];if(!l)return[];let a=[];if(l.filterEditor&&l.filterEditor.dataSource)a=a.concat(l.filterEditor.dataSource.map((e=>"string"==typeof e?{label:e,value:e}:e)));else if(l.options)a=a.concat(l.options.map((e=>"string"==typeof e?{label:e,value:e}:e)));else{const e={};if(t.dataSource&&t.dataSource.length>0)for(let a=0;a<t.dataSource.length;a++){const i=t.dataSource[a][l.dataField];null!=i&&""!==i&&(e[i]=i)}a=a.concat(Object.keys(e).map((e=>({label:e,value:e}))))}return a}getExcelFilter(e,t){const l=this,a=l.columnByDataField[e];if(a&&!a._filterInfo&&t&&(a._filterInfo={excelValues:t}),!a||!a._filterInfo)return null;t&&(a._filterInfo.excelValues=t);const i=a._filterInfo.excelValues,r=new Smart.Utilities.FilterGroup;let n=!1;if(i){for(let e=0;e<i.length;e++){const t=i[e],o="string"===a.dataType?"stringFilter":"number"===a.dataType?"numericFilter":"date"===a.dataType?"dateFilter":"boolean"===a.dataType?"booleanFilter":"stringFilter",s=r.createFilter(o,t,"equal",void 0,a.formatString,l.locale,!1);r.addFilter("or",s),n=!0}if(0===i.length){const t=l.getExcelFilterDataSource(e);if(t&&t.length>0)for(let e=0;e<t.length;e++){const i=t[e].value,o="string"===a.dataType?"stringFilter":"number"===a.dataType?"numericFilter":"date"===a.dataType?"dateFilter":"boolean"===a.dataType?"booleanFilter":"stringFilter",s=r.createFilter(o,i,"not_equal",void 0,a.formatString,l.locale,!1);r.addFilter("and",s),n=!0}}}return n?(r.operator="and",r):null}getFilterRowFilter(e){const t=this.columnByDataField[e];if(!t||!t._filterInfo)return null;const l=t._filterInfo,a=l.condition,i=this._getFilterDataType(t);if("RANGE"===a){const e=l.range;if(e){const l=new Smart.FilterGroup;return l.addFilter("and",l.createFilter(t.dataType,e.min,"GREATER_THAN_OR_EQUAL")),l.addFilter("and",l.createFilter(t.dataType,e.max,"LESS_THAN_OR_EQUAL")),l}return null}{let e=l.value;if(""===e||void 0===e)return null;{const a=new Smart.FilterGroup;let r=!1;if("date"===t.dataType){let l=null;e&&"object"==typeof e&&e instanceof Date?r=!0:e&&((e.split("/").length>2||e.split("-").length>2||e.split(".").length>2)&&(r=!0),r&&t.cellsFormat&&(l=Smart.Utilities.DateTime.ParseDate(e,t.cellsFormat),null!==l&&(r=!0,e=l)))}if("date"!==t.dataType||r){if("string"==typeof e){const t=e=>{e.forEach((e=>{const t=e.trim();t.length&&a.addFilter("or",a.createFilter(i,t,l.condition||("string"===i?"CONTAINS":"EQUAL")))}))};e.indexOf(" or ")>=0?(e=e.split("or"),t(e)):e.indexOf(" and ")>=0?(e=e.split("and"),t(e)):e.indexOf(" & ")>=0?(e=e.split("&"),t(e)):e.indexOf(' | " ')>=0?(e=e.split("|"),t(e)):a.addFilter("and",a.createFilter(i,e,l.condition||("string"===i?"CONTAINS":"EQUAL")))}else a.addFilter("and",a.createFilter(i,e,l.condition||("string"===i?"CONTAINS":"EQUAL")));return a}}}}_handleFilterCellValue(e){const t=this,l=e.column._filterInfo,a=e.column,i=l.condition,r=t._getFilterDataType(a);if("RANGE"===i){const e=l.range;if(e){const l=new Smart.FilterGroup;l.addFilter("and",l.createFilter(a.dataType,e.min,"GREATER_THAN_OR_EQUAL")),l.addFilter("and",l.createFilter(a.dataType,e.max,"LESS_THAN_OR_EQUAL")),t.addFilter(a.dataField,l)}else t.removeFilter(a.dataField)}else{let e=l.value;if(""!==e&&void 0!==e){const i=new Smart.FilterGroup;let n=!1;if("date"===a.dataType){let t=null;e&&"object"==typeof e&&e instanceof Date?n=!0:e&&((e.split("/").length>2||e.split("-").length>2||e.split(".").length>2)&&(n=!0),n&&a.cellsFormat&&(t=Smart.Utilities.DateTime.ParseDate(e,a.cellsFormat),null!==t&&(n=!0,e=t)))}if("date"!==a.dataType||n){if("string"==typeof e){const t=e=>{e.forEach((e=>{const t=e.trim();t.length&&i.addFilter("or",i.createFilter(r,t,l.condition||("string"===r?"CONTAINS":"EQUAL")))}))};e.indexOf(" or ")>=0?(e=e.split("or"),t(e)):e.indexOf(" and ")>=0?(e=e.split("and"),t(e)):e.indexOf(" & ")>=0?(e=e.split("&"),t(e)):e.indexOf(' | " ')>=0?(e=e.split("|"),t(e)):i.addFilter("and",i.createFilter(r,e,l.condition||("string"===r?"CONTAINS":"EQUAL")))}else i.addFilter("and",i.createFilter(r,e,l.condition||("string"===r?"CONTAINS":"EQUAL")));const n=t.getExcelFilter(a.dataField);n&&i.addFilter("and",n),t.addFilter(a.dataField,i)}}else{const e=t.getExcelFilter(a.dataField);e?t.addFilter(a.dataField,e):t.removeFilter(a.dataField)}}t.autoSaveState()}_handleFilterCellKeyDown(e,t){const l=this,a=e.column._filterInfo.input;t.ctrlKey&&"a"===t.key?a.select():t.altKey&&"ArrowDown"===t.key&&l._handleFilterCellIconClick(e)}_handleFilterCellKeyUp(e,t){const l=e.column,a=l._filterInfo.input,i=this,r=l._filterInfo,n=t.key;r.value!==a.value&&(r.value=a.value,"Control"===n||t.ctrlKey||("Escape"===n&&(r.value="",r.range=null,a.value=""),i._suspendFilterRowRefresh=!0,"Enter"===n||"Escape"===n||""===a.value?i._handleFilterCellValue(e):"auto"===i.filtering.filterRow.applyMode&&"Ctrl"!==n&&"Shift"!==n&&(i._filterRowTimer&&clearTimeout(i._filterRowTimer),i._filterRowTimer=setTimeout((()=>{i._suspendFilterRowRefresh=!0,i._handleFilterCellValue(e),i._suspendFilterRowRefresh=!1}),i.filtering.filterRow.autoApplyModeDelay)),clearTimeout(i._suspendFilterRowTimer),i._suspedFilterRowTimer=setTimeout((()=>{i._suspendFilterRowRefresh=!1}),1e3),t.ctrlKey&&"a"===n&&a.select()))}_handleFilterCellCheckBoxClick(e){const t=this,l=e.column,a=l._filterInfo;void 0===a.value&&(a.value=null),!0===a.value?a.value=!1:!1===a.value?a.value=null:null===a.value&&(a.value=!0);const i=e.element.querySelector(".smart-input");if(a.value?i.setAttribute("checked",a.value):null===a.value?i.setAttribute("checked","indeterminate"):i.removeAttribute("checked"),null===a.value)return t.removeFilter(l.dataField),void t.autoSaveState();const r=new Smart.FilterGroup;r.addFilter("and",r.createFilter(l.dataType,!0===a.value,"EQUAL")),t.addFilter(l.dataField,r),t.autoSaveState()}_handleFilterCellExcelIconClick(e){const t=this,l=e.column;l.filterRowExcelMenu&&l.filterRowExcelMenu.classList.contains("open")?t._closeMenu(l.filterRowExcelMenu):t._openColumnFilterExcelMenu(l)}_handleFilterCellIconClick(e){const t=this,l=e.column;l.filterRowMenu&&l.filterRowMenu.classList.contains("open")?t._closeMenu(l.filterRowMenu):t._openColumnFilterMenu(l)}_handleFilterCalendarCellClick(e){const t=this;t._openFilterCellDialog(e,(l=>{const a=l._filterInfo,i=a.editor.querySelector("input"),r=a.value;if(i){if(r||"RANGE"===a.condition)if(!r&&"RANGE"===a.condition&&a.range){t.removeFilter(l.dataField,!1);const e=new Smart.FilterGroup,i=a.range;e.addFilter("and",e.createFilter(l.dataType,i.min,"GREATER_THAN_OR_EQUAL")),e.addFilter("and",e.createFilter(l.dataType,i.max,"LESS_THAN_OR_EQUAL"));const r=a.cell.getFormattedValue(i.min,l.cellsFormat),n=a.cell.getFormattedValue(i.max,l.cellsFormat);t.addFilter(l.dataField,e),a.editor.querySelector("input").value=r+" - "+n}else if(r||"RANGE"!==a.condition||a.range){i.value=e.getFormattedValue(r[0],l.cellsFormat||"");const n=new Smart.FilterGroup;if(1===r.length)n.addFilter("and",n.createFilter(l.dataType,r[0],a.condition||"EQUAL"));else{let t=[];for(let i=0;i<r.length;i++)n.addFilter("or",n.createFilter(l.dataType,r[i],a.condition||"EQUAL")),t.push(e.getFormattedValue(r[i],l.cellsFormat||""));i.value=t.toString()}t.removeFilter(l.dataField,!1),t.addFilter(l.dataField,n)}else i.value="",t.removeFilter(l.dataField);else i.value="",t.removeFilter(l.dataField);t.autoSaveState()}}))}_handleFilterMenuClick(e,t){const l=this,a=e._filterInfo,i=a.editor,r=a.input;if(i.firstElementChild.innerHTML=`<i class="smart-grid-icon ${t.icon} show"></i>`,"CLEAR_FILTER"===t.value&&(r.value="",i.firstElementChild.innerHTML='<i class="smart-grid-icon smart-icon-search show"></i>',a.condition=null,a.value="",a.range=null),r.type="","RANGE"===a.condition&&"RANGE"!==t.value){let e=a.range;a.value=e.min}else if("RANGE"===t.value&&"RANGE"!==a.condition&&null!==a.condition){let e=a.range;a.value&&(e=a.value&&Array.isArray(a.value)?{min:a.value[0],max:a.value[0]}:{min:a.value,max:a.value},a.range=e)}if("RANGE"===t.value){r.readonly=!0;const i=new Smart.FilterGroup,n=a.range;if(n){i.addFilter("and",i.createFilter(e.dataType,n.min,"GREATER_THAN_OR_EQUAL")),i.addFilter("and",i.createFilter(e.dataType,n.max,"LESS_THAN_OR_EQUAL")),l.addFilter(e.dataField,i);const t=a.cell.getFormattedValue(n.min,e.cellsFormat),o=a.cell.getFormattedValue(n.max,e.cellsFormat);r.value=t+" - "+o}else r.value="";return a.condition=t.value,void l.autoSaveState()}if(r.readonly=!1,"CLEAR_FILTER"!==t.value&&(a.condition=t.value),""===r.value)l.removeFilter(e.dataField);else{const t=new Smart.FilterGroup,i=a.value,n=l._getFilterDataType(e);t.addFilter("and",t.createFilter(n,i,a.condition||"EQUAL")),l.addFilter(e.dataField,t),r.value=a.cell.getFormattedValue(i,e.cellsFormat)}l.autoSaveState(),setTimeout((()=>{r.focus()}),25)}_handleFilterNumberCellEditor(e,t,l){const a=t.querySelector("input"),i=t.querySelector(".up"),r=t.querySelector(".down"),n=e.column,o=this;let s=t=>{const l=n._filterInfo;if("RANGE"===l.condition)return void a.focus();let i=parseFloat(l.value);if(isNaN(i))return l.value=0,void(a.value=0);(t<0?i>a.min||""===a.min:i<a.max||""===a.max)&&(a.value=i+t,l.value=a.value,a.focus(),o._handleFilterCellValue(e))};l&&(s=l);const d=(e,t)=>{let l,a;e.onpointerdown=function(e){s(t),l&&clearTimeout(l),l=setTimeout((()=>{a&&clearInterval(a),a=setInterval((()=>{s(t)}),50)}),300),e.preventDefault(),e.stopPropagation()},e.onpointerup=()=>{a&&clearInterval(a),l&&clearTimeout(l),a=null},e.onpointerenter=()=>{a&&(clearInterval(a),a=setInterval((()=>{s(1)}),50))},e.onpointerleave=()=>{clearInterval(a)},document.addEventListener("pointerup",(()=>{a&&clearInterval(a),a=null,l&&clearTimeout(l)}))};d(i,1),d(r,-1)}_openFilterCellDialog(e,t){const l=this,a=l._dialogFilter||l._createDialog(),i=l.localize("dialogFilterHeader")+" "+e.column.label,r=a.content;a.header.innerHTML=i,a.confirm=t;let n=null,o=0;l._cellEditors||(l._cellEditors=[]),l._dialogFilter||(a.modal=!0,a.btnConfirm.innerHTML=l.localize("dialogFilterButtonConfirm"),a.btnCancel.innerHTML=l.localize("dialogFilterButtonCancel"),a.onOpen=function(){a.focus();const e=l._dialogFilterCell,t=e.column._filterInfo.range,i=e.column._filterInfo.value;if("date"===e.column.dataType){const a=r.querySelector("smart-calendar");a.locale=l.locale,setTimeout((()=>{"RANGE"===e.column._filterInfo.condition&&t?(a.selectedDates=[new Date(t.min.getTime()),new Date(t.max.getTime())],a._selectMultipleDates(new Date(t.min.getTime()),new Date(t.max.getTime()))):i&&(a.selectedDates=[new Date(i[0]?i[0].getTime():i.getTime())]),a.focus()}),100),a.focus()}else{const e=r.querySelectorAll("input");e[0].focus(),t&&(e[0].value=t.min,e[1].value=t.max)}},a.onClose=function(){},a.btnCancel.onclick=function(){a.close();const e=l._dialogFilterCell;e.column._filterInfo.range=null,e.column._filterInfo.value=null,a.confirm(e.column)},a.btnClose.onclick=function(){a.close()},a.btnConfirm.onclick=function(){const e=l._dialogFilterCell;if(e.column._filterInfo.range=null,e.column._filterInfo.value=null,"date"===e.column.dataType){const t=r.querySelector("smart-calendar"),l=t.selectedDates;if("range"===t.selectionMode)e.column._filterInfo.range={min:new Date(l[0].getTime()),max:new Date(l[l.length-1].getTime())};else{const t=[];l.forEach((e=>{const l=new Date(e.getTime());t.push(l)})),e.column._filterInfo.value=t}}else{const t=r.querySelectorAll("input");let l=t[0].value,a=t[1].value;""===a&&(a=100),""===l&&(l=0),e.column._filterInfo.range={min:l,max:a}}a.confirm(e.column),a.close()},a.onkeydown=function(e){const t=e.key;"Enter"===t?a.btnConfirm.onclick():"Escape"===t&&a.close()}),r.classList.remove("smart-grid-layout"),r.innerHTML="";const s=()=>{const e=r.querySelectorAll("input");a.btnConfirm.disabled=!0,""===e[0].value&&(e[0].value=0),""===e[1].value&&(e[1].value=100),parseFloat(e[0].value)<=parseFloat(e[1].value)&&(a.btnConfirm.disabled=!1)};"date"!==e.column.dataType&&r.classList.add("smart-grid-layout");for(let t=0;t<2;t++){const a=e.column;if("date"===a.dataType){const e=document.createElement("div");"RANGE"===a._filterInfo.condition?e.innerHTML='<smart-calendar selection-mode="range"></smart-calendar>':e.innerHTML="<smart-calendar></smart-calendar>",r.appendChild(e);break}o%2==0&&(n=document.createElement("div"),n.classList.add("row"),r.appendChild(n));const i=document.createElement("div");i.classList.add("col-sm-6");const d=document.createElement("div");d.classList.add("column");const u=document.createElement("label");u.innerHTML=0===t?l.localize("dialogFilterMinLabel"):l.localize("dialogFilterMaxLabel");const c=document.createElement("div");c.classList.add("smart-grid-dialog-editor"),c.setAttribute("editor",a.dataField),c.setAttribute("template",a.editor.template),i.appendChild(d),n.appendChild(i),d.appendChild(u),d.appendChild(c),o++,c.innerHTML='<div class="smart-grid-cell-editor smart-filter-input-value smart-grid-number-input-cell-editor"><input class="smart-input" type="number"><div class="nav"><div tabindex="-1" class="up"></div><div tabindex="-1" class="down"></div></div></div>';const f=c.querySelector("input");f.onchange=()=>{s()},l._handleFilterNumberCellEditor(e,c,(e=>{let t=parseFloat(f.value);isNaN(t)?f.value=0:((e<0?t>f.min||""===f.min:t<f.max||""===f.max)&&(f.value=t+e),s())}))}l._dialogFilter=a,l._dialogFilterCell=e;const d=e.column.element.getBoundingClientRect(),u=l.offset(l);let c=d.left+window.pageXOffset-u.left,f=d.bottom+l.layout.rowMinHeight+window.pageYOffset-u.top,m=Math.max(a.offsetWidth,314);c+m>u.left+l.offsetWidth&&(c=d.left+d.width+window.pageXOffset-u.left-m),e.column.filterRowMenu&&e.column.filterRowMenu.classList.contains("open")&&l._closeMenu(e.column.filterRowMenu),a.open(c,f)}});
1477
+ Smart.Utilities.Assign("Grid.Filter",class{addFilter(e,t,l){const a=this,i=a.columnByDataField[e];if(!i){if(!a.dataSource||!a.dataSource.dataFields)return;if(!a.dataSource.dataFields.find((e=>e.name===e)))return}const r=a._getFilterDataType(i);if("string"==typeof t?t=a.dataSource._createFilter(r,[t]):t&&Array.isArray(t)&&(t=a.dataSource._createFilter(r,t)),"string"===r&&i.editor&&i.editor.dataSource&&i.dataField===i.displayField&&i.editor.dataSource[0]){const e=i.editor.dataSource[0];void 0!==e.label&&void 0!==e.value&&i.editor.dataSource.forEach((e=>{e.value===t.filters[0].value&&(t.filters[0].value=e.label)}))}if(i&&i.canNotify){if(i.setProperty("filter",t),a._isUpdating)return;!1!==l&&(a._filterRowInputOnFocus=!0,a.refreshFilters(),delete a._filterRowInputOnFocus)}}removeFilter(e,t){const l=this,a=l.columnByDataField[e];if(a&&a.canNotify){if(a.setProperty("filter",null),l._isUpdating)return;!1!==t&&(l._filterRowInputOnFocus=!0,l.refreshFilters(),delete l._filterRowInputOnFocus)}a&&delete a._filterState}findCells(e){const t=this,l=t.find(e,null,null,"or"),a=[];"string"==typeof e&&e.indexOf(",")>=0&&(e=e.split(","));for(let i=0;i<l.length;i++){const r=l[i];for(let l=0;l<t.columns.length;l++){const i=t.columns[l],n=r[i.dataField];if(Array.isArray(e))for(let t=0;t<e.length;t++)(""+n).trim().toLowerCase()===(""+e[t]).trim().toLowerCase()&&a.push([r.$.id,i.dataField,e[t]]);else(""+n).trim().toLowerCase()===(""+e).trim().toLowerCase()&&a.push([r.$.id,i.dataField,e])}}return a}find(e,t,l,a="and"){const i=this;let r=[];if(l){const e={"=":"EQUAL","<>":"NOT_EQUAL","!=":"NOT_EQUAL",not_like:"DOES_NOT_CONTAIN",like:"CONTAINS","<":"LESS_THAN",">":"GREATER_THAN","<=":"LESS_THAN_OR_EQUAL",">=":"GREATER_THAN_OR_EQUAL",equal:"EQUAL","not equal":"NOT_EQUAL","less than":"LESS_THAN","greater than":"GREATER_THAN","greater than or equal":"GREATER_THAN_OR_EQUAL","less than or equal":"LESS_THAN_OR_EQUAL","starts with":"STARTS_WITH","ends with":"ENDS_WITH",notEqual:"NOT_EQUAL",not_equal:"NOT_EQUAL",lessThan:"LESS_THAN",greaterThan:"GREATER_THAN",greaterThanOrEqual:"GREATER_THAN_OR_EQUAL",lessThanOrEqual:"LESS_THAN_OR_EQUAL",less_than:"LESS_THAN",greater_than:"GREATER_THAN",greater_than_or_equal:"GREATER_THAN_OR_EQUAL",less_than_or_equal:"LESS_THAN_OR_EQUAL",null:"null","":"EMPTY",isblank:"EMPTY",isnotblank:"NOT_EMPTY",isBlank:"EMPTY",isNotBlank:"NOT_EMPTY",CONTAINS:"CONTAINS",DOES_NOT_CONTAIN:"DOES_NOT_CONTAIN",contains:"CONTAINS",does_not_contain:"DOES_NOT_CONTAIN","not contains":"DOES_NOT_CONTAIN",notcontains:"DOES_NOT_CONTAIN",notContains:"DOES_NOT_CONTAIN",startswith:"STARTS_WITH",endswith:"ENDS_WITH",starts_with:"STARTS_WITH",ends_with:"ENDS_WITH",startsWith:"STARTS_WITH",endsWith:"ENDS_WITH",NULL:"NULL",NOT_NULL:"NOT_NULL"};e[l]&&(l=e[l])}const n=(e,a="or")=>{let r=[];for(let n=0;n<i.columns.length;n++){const o=i.columns[n],s=new Smart.Utilities.FilterGroup;let d;t&&o.dataField!==t||("string"===o.dataType?(l||(l="CONTAINS"),d=s.createFilter("string",e,l)):"number"===o.dataType?(l||(l="EQUAL"),d=s.createFilter("number",e,l)):"date"===o.dataType&&(l||(l="EQUAL"),d=s.createFilter("date",e,l)),s.addFilter(a,d),r.push([o.dataField,s]))}return r};void 0!==e&&"string"==typeof e&&e.indexOf(",")>=0&&(e=e.split(","));let o=[];if(Array.isArray(e))for(let t=0;t<e.length;t++)o.push(n(e[t].trim()));else r=n(e);const s=i.dataSource;if(!s)return[];let d=[];const c=(e,t)=>{let l=!1;for(let a=0;a<t.length;a++){const i=t[a],r=e[i[0]];l=l||i[1].evaluate(r)}return l};for(let e=0;e<s.length;e++){const t=s[e];if(o.length)if("and"===a){let e=!0;for(let l=0;l<o.length;l++)e=e&&c(t,o[l]);e&&d.push(t)}else{let e=!1;for(let l=0;l<o.length;l++)e=e||c(t,o[l]);e&&d.push(t)}else c(t,r)&&d.push(t)}return d}_applyJSONFilters(e,t){const l=this;function a(e){for(var t={},a=0;a<e.length;a++){const d=e[a];let c=d.field;const u=d.type,f=d.operator,m=d.value,F=d.logic;for(var i=0;i<l.columns.length;i++){var r=l.columns[i];c===r.label&&r.datafield&&(c=r.datafield)}if(!t[c]){var n=new Smart.FilterGroup;t[c]={filterGroup:n,logic:F||"and"}}F&&(t[c].logic=F||"and");var o,s=t[c].filterGroup;switch(u){case"string":o=s.createFilter("stringFilter",m,f);break;case"date":o=s.createFilter("dateFilter",m,f);break;case"number":o=s.createFilter("numericFilter",m,f);break;case"boolean":case"bool":o=s.createFilter("booleanFilter",m,f);break;default:continue}s.addFilter(t[c].logic.toLowerCase(),o)}return t}if(t)t(a(e));else{l.beginUpdate(),l.clearFilter();var i=a(e);for(var r in i){var n=i[r].filterGroup;l.addFilter(r,n,!1)}l.endUpdate(),l.refreshFilters()}}filterBy(e,t,l){const a=this;let i,r=[];if(a.ai&&a.ai.key)return void(()=>{const t=e=>{a._applyJSONFilters(e,l)};(()=>{let l='You are a helpful assistant converting natural language filter queries into structured JSON filters.\n "Use only these columns:';for(let e=0;e<a.columns.length;e++){const t=a.columns[e];t.allowFilter&&(l+="- "+t.label+" ("+t.dataType+") => "+t.dataField+"\n")}l+='\n Supported operators: CONTAINS, EQUAL, NOT_EQUAL, GREATER_THAN, LESS_THAN, GREATER_THAN_OR_EQUAL, LESS_THAN_OR_EQUAL, STARTS_WITH, ENDS_WITH \n Supported types: string, number, date, boolean\n Respond in this format\n [\n {\n "field": "dataField",\n "operator": "some operator",\n "value": "some value",\n "type": "some type",\n "logic": "AND }\n ]',function(e,t,l,i,r,n){const o=e||"https://api.openai.com/v1/chat/completions",s=new XMLHttpRequest;s.open("POST",o,!0),s.setRequestHeader("Authorization","Bearer "+t),s.setRequestHeader("Content-Type","application/json"),a._aiCanFetch=!0,s.onreadystatechange=function(){if(4===s.readyState)if(s.status>=200&&s.status<300)try{var e=JSON.parse(s.responseText);if(a._aiCanFetch){var t=e.choices[0].message.content,l=JSON.parse(t);r&&"function"==typeof r&&r(l),a._aiCanFetch=!1,n(null,l)}else n(null,[])}catch(e){console.error("Failed to parse OpenAI response:",s.responseText),n(e,[])}else console.error("Error calling OpenAI API:",s.status,s.statusText),n(new Error("HTTP error: "+s.status),[])};var d=JSON.stringify({model:"gpt-4",messages:[{role:"system",content:l},{role:"user",content:"Query: "+i}],temperature:0});s.send(d)}(a.ai.url,a.ai.key,l,e,t,(function(e){}))})()})();void 0!==e&&"string"==typeof e&&e.indexOf(",")>=0&&(e=e.split(",")),r=((e,l="or")=>{let r=[];for(let n=0;n<a.columns.length;n++){const o=a.columns[n],s=new Smart.Utilities.FilterGroup;let d;t&&o.dataType!==t||("string"===o.dataType?(i="CONTAINS",d=s.createFilter("string",e,i)):"number"===o.dataType?(i="EQUAL",d=s.createFilter("number",e,i)):"date"===o.dataType&&(i="EQUAL",d=s.createFilter("date",e,i)),s.addFilter(l,d),r.push([o.dataField,s]))}return r})(e),a.beginUpdate(),a.clearFilter();const n=a.filtering.operator;a.filtering.operator="or";for(let e=0;e<r.length;e++){const t=r[e];a.addFilter(t[0],t[1],!1)}a.endUpdate(),a.refreshFilters(),a.filtering.operator=n}clearFilter(){const e=this;for(let t=0;t<e.columns.length;t++){const l=e.columns[t];l&&(l.setProperty("filter",null),l._filterInfo&&(delete l._filterInfo.value,delete l._filterInfo.condition))}e._refreshFilterRowEditors(),e.refreshFilters()}getFilteredColumns(){const e=this;if(e._filters){const t=[];for(let l=0;l<e._filters.length;l++){const a=e._filters[l];t.push({dataField:a[0],filter:a[1].toString()})}return t}return[]}getFilteredColumnsByDataField(){const e=this;if(e._filters){const t=[];for(let l=0;l<e._filters.length;l++){const a=e._filters[l];t[a[0]]=a[1],t.length++}return t}return[]}getVisibleRows(){const e=this;if(e._visibleRows)return e._visibleRows;const t=[],l=e._viewRows,a=e.editing.addNewRow.visible&&"far"!==e.editing.addNewRow.position&&"button"!==e.editing.addNewRow.displayMode?1:0,i=e.grouping.enabled&&e.dataSource.groupBy&&e.dataSource.groupBy.length>0;let r=0;for(let e=0;e<l.length;e++){const n=l[e];n.canNotify=!1,n.visibleIndex=-1,!n.visible||!1===n.filtered&&void 0!==n.filtered||(i?n.leaf?n.visibleIndex=r++:n.visibleIndex=-1:n.visibleIndex=t.length-a,t.push(n)),n.canNotify=!0}return e._visibleRows=t,t}_refreshFilterRowEditors(){const e=this;if(e.filtering.filterRow)for(let t=0;t<e.columns.length;t++)e.columns[t]._filterEditorInitialized&&(e.columns[t]._filterEditorInitialized=!1)}refreshSortAndFilters(){this._refreshDataFilters()}_refreshDataFilters(){const e=this;!1!==e.editing.autoUpdateFilterAndSort&&(e._supressFilter||(!e._filters||e._filters&&0===e._filters.length)&&(!e._sortedColumns||e._sortedColumns&&0===e._sortedColumns.length)||(e.beginUpdate(),e._sortedColumns&&e._sortedColumns.length>0&&e.refreshSort(),e._filters&&e._filters.length>0&&e.refreshFilters(!0),e.endUpdate()))}refreshFilters(e){const t=this,l=[];t._filters||(t._filters=[]);for(let e=0;e<t.columns.length;e++){const a=t.columns[e];a.filter&&l.push([a.displayField,a.filter])}if(t.scrollTop=0,t.closeMenu(),t.dataSource&&!t.dataSource.onFilter&&(t.dataSource.onFilter=function(){const e=t._viewRows;for(let t=0;t<e.length;t++){const l=e[t];if(l.data&&!l.addNewRow){if(!l.data.$){l.filtered=!0;continue}l.filtered=void 0===l.data.$.filtered||l.data.$.filtered}}t.refresh()}),JSON.stringify(t._filters)===JSON.stringify(l)&&!0!==e)return void(t._visibleRows=null);if(t._filters=l,t._visibleRows=null,t.dataSource&&t.dataSource.virtualDataSource)t.closeMenu(),t._virtualDataRequest("filter");else{const e=t._filterOperator||t.filtering.operator;t.dataSource._filter(l,e)}t.paging.enabled&&t.dataSource&&!t.dataSource.virtualDataSource&&t._refreshPagesCount();let a=[];for(let e=0;e<t.columns.length;e++){const l=t.columns[e];l.filter&&a.push(l)}let i=[],r=[],n=[];if(t._filters)for(let e=0;e<t._filters.length;e++){const l=t._filters[e];n.push(l[0]);let a="";const o=t.columnByDataField[l[0]];for(let e=0;e<l[1].filters.length;e++){const t=l[1].filters[e].condition,i=l[1].filters[e].value,r=l[1].logicalOperators[e],n=1===r||"or"===r?"or":"and";o&&"string"===o.dataType?a+=`"${t}" "${i}"`:!o||"date"!==o.dataType&&"time"!==o.dataType&&"datetime"!==o.dataType?a+=`"${t}" ${i}`:i.getFullYear?a+=`"${t}" ${i.getFullYear()+"-"+(1+i.getMonth())+"-"+i.getDate()}`:a+=`"${t}" ${""+i}`,e<l[1].filters.length-1&&(a+=` ${n} `)}r.push([l[0],a]),i.push({dataField:l[0],filter:l[1]})}t.summaryRow.visible&&(t._calculateSummary(),t._recycle(!1)),e||t.$.fireEvent("filter",{columns:a,expressions:JSON.parse(JSON.stringify(r)),dataFields:n,data:JSON.parse(JSON.stringify(i))}),t._onFilter&&t._onFilter()}_getFilterDataType(e){const t=this;let l=e.dataType;if(e.displayField!==e.dataField&&t.dataSource&&t.dataSource.dataFields){const a=t.dataSource.dataFields.find((t=>t.name===e.displayField));a&&(l=a.dataType||"string")}return l}_handleFilterCellFocus(e){const t=this,l=e.column._filterInfo,a=l.editor,i=l.input,r=e.column;let n=r.dataType;if(a.setAttribute("focus",""),t.filtering.filterRow.cell=e,"RANGE"===l.condition)t._openFilterCellDialog(e,(e=>{const l=e._filterInfo,a=l.editor,i=l.range,r=l.input,n=l.cell;if(i){const l=new Smart.FilterGroup;l.addFilter("and",l.createFilter(e.dataType,i.min,"GREATER_THAN_OR_EQUAL")),l.addFilter("and",l.createFilter(e.dataType,i.max,"LESS_THAN_OR_EQUAL")),t.addFilter(e.dataField,l)}else t.removeFilter(e.dataField);if(t.autoSaveState(),a&&r)if(r.type="",i){const t=n.getFormattedValue(i.min,e.cellsFormat),l=n.getFormattedValue(i.max,e.cellsFormat);r.value=t+" - "+l}else r.value=""}));else if(r.displayField!==r.dataField&&(n=t._getFilterDataType(r)),i.type="number"===n||"int"===n||"float"===n?"number":"",l.value&&(i.value=l.value,"date"===n)){const t=new Smart.FilterGroup;if("string"==typeof l.value?i.value=e.getFormattedValue(l.value,r.cellsFormat):i.value=e.getFormattedValue(l.value[0],r.cellsFormat),l.value.length>1){let a=[];for(let i=0;i<l.value.length;i++)t.addFilter("or",t.createFilter(r.dataType,l.value[i],l.condition||"EQUAL")),a.push(e.getFormattedValue(l.value[i],r.cellsFormat||""));i.value=a.toString()}}}_handleFilterCellBlur(e){const t=this,l=e.column._filterInfo,a=l.editor,i=l.input,r=e.column,n=l.condition,o=t._getFilterDataType(r);if(t.filtering.filterRow.cell=null,r.filterRowMenu&&r.filterRowMenu.classList.contains("open"))a.removeAttribute("focus");else{if(""!==i.value&&"RANGE"!==n)if("date"===r.dataType){let t=[];if(i.value.indexOf(",")>=0&&(t=i.value.split(","),t=t.forEach((e=>Smart.Utilities.DateTime.ParseDate(e.trim(),r.cellsFormat)))),t.length>1){l.value=t;let a=[];const n=new Smart.FilterGroup;for(let i=0;i<t.length;i++)n.addFilter("or",n.createFilter(r.dataType,t[i],l.condition||"EQUAL")),a.push(e.getFormattedValue(t[i],r.cellsFormat||""));i.value=a.toString()}else r.cellsFormat?l.value=Smart.Utilities.DateTime.ParseDate(i.value,r.cellsFormat):l.value=new Date(i.value),i.value=e.getFormattedValue(l.value,r.cellsFormat)}else"number"===o||"int"===o||"float"===o?(l.value=parseFloat(i.value),i.type="",i.value=e.getFormattedValue(l.value,r.cellsFormat)):l.value=i.value;"auto"===t.filtering.filterRow.applyMode&&t._handleFilterCellValue(e),a.removeAttribute("focus")}}getExcelFilterDataSource(e){const t=this,l=t.columnByDataField[e];if(!l)return[];let a=[];if(l.filterEditor&&l.filterEditor.dataSource)a=a.concat(l.filterEditor.dataSource.map((e=>"string"==typeof e?{label:e,value:e}:e)));else if(l.options){const e=Array.isArray(l.options)?l.options.slice():[];a=a.concat(e.map((e=>"string"==typeof e?{label:e,value:e}:{label:void 0!==e.label?e.label:e.value,value:void 0!==e.value?e.value:e.label})))}else{const e={};if(t.dataSource&&t.dataSource.length>0)for(let a=0;a<t.dataSource.length;a++){const i=t.dataSource[a][l.dataField];null!=i&&""!==i&&(e[i]=i)}a=a.concat(Object.keys(e).map((e=>({label:e,value:e}))))}return a}getExcelFilter(e,t){const l=this,a=l.columnByDataField[e];if(a&&!a._filterInfo&&t&&(a._filterInfo={excelValues:t}),!a||!a._filterInfo)return null;t&&(a._filterInfo.excelValues=t);const i=a._filterInfo.excelValues,r=new Smart.Utilities.FilterGroup;let n=!1;const o="tags"===a.template&&a.templateSettings&&a.templateSettings.multiSelect;if(i){for(let e=0;e<i.length;e++){const t=i[e],s="string"===a.dataType?"stringFilter":"number"===a.dataType?"numericFilter":"date"===a.dataType?"dateFilter":"boolean"===a.dataType?"booleanFilter":"stringFilter";let d=r.createFilter(s,t,"equal",void 0,a.formatString,l.locale,!1);o&&(d=r.createFilter("stringFilter",t,"contains",void 0,a.formatString,l.locale,!1)),r.addFilter("or",d),n=!0}if(0===i.length){const t=l.getExcelFilterDataSource(e);if(t&&t.length>0)for(let e=0;e<t.length;e++){const i=t[e].value,s="string"===a.dataType?"stringFilter":"number"===a.dataType?"numericFilter":"date"===a.dataType?"dateFilter":"boolean"===a.dataType?"booleanFilter":"stringFilter";let d=r.createFilter(s,i,"not_equal",void 0,a.formatString,l.locale,!1);o&&(d=r.createFilter("stringFilter",i,"does_not_contain",void 0,a.formatString,l.locale,!1)),r.addFilter("and",d),n=!0}}}return n?(r.operator="and",r):null}getFilterRowFilter(e){const t=this.columnByDataField[e];if(!t||!t._filterInfo)return null;const l=t._filterInfo,a=l.condition,i=this._getFilterDataType(t);if("RANGE"===a){const e=l.range;if(e){const l=new Smart.FilterGroup;return l.addFilter("and",l.createFilter(t.dataType,e.min,"GREATER_THAN_OR_EQUAL")),l.addFilter("and",l.createFilter(t.dataType,e.max,"LESS_THAN_OR_EQUAL")),l}return null}{let e=l.value;if(""===e||void 0===e)return null;{const a=new Smart.FilterGroup;let r=!1;if("date"===t.dataType){let l=null;e&&"object"==typeof e&&e instanceof Date?r=!0:e&&((e.split("/").length>2||e.split("-").length>2||e.split(".").length>2)&&(r=!0),r&&t.cellsFormat&&(l=Smart.Utilities.DateTime.ParseDate(e,t.cellsFormat),null!==l&&(r=!0,e=l)))}if("date"!==t.dataType||r){if("string"==typeof e){const t=e=>{e.forEach((e=>{const t=e.trim();t.length&&a.addFilter("or",a.createFilter(i,t,l.condition||("string"===i?"CONTAINS":"EQUAL")))}))};e.indexOf(" or ")>=0?(e=e.split("or"),t(e)):e.indexOf(" and ")>=0?(e=e.split("and"),t(e)):e.indexOf(" & ")>=0?(e=e.split("&"),t(e)):e.indexOf(' | " ')>=0?(e=e.split("|"),t(e)):a.addFilter("and",a.createFilter(i,e,l.condition||("string"===i?"CONTAINS":"EQUAL")))}else a.addFilter("and",a.createFilter(i,e,l.condition||("string"===i?"CONTAINS":"EQUAL")));return a}}}}_handleFilterCellValue(e){const t=this,l=e.column._filterInfo,a=e.column,i=l.condition,r=t._getFilterDataType(a);if("RANGE"===i){const e=l.range;if(e){const l=new Smart.FilterGroup;l.addFilter("and",l.createFilter(a.dataType,e.min,"GREATER_THAN_OR_EQUAL")),l.addFilter("and",l.createFilter(a.dataType,e.max,"LESS_THAN_OR_EQUAL")),t.addFilter(a.dataField,l)}else t.removeFilter(a.dataField)}else{let e=l.value;if(""!==e&&void 0!==e){const i=new Smart.FilterGroup;let n=!1;if("date"===a.dataType){let t=null;e&&"object"==typeof e&&e instanceof Date?n=!0:e&&((e.split("/").length>2||e.split("-").length>2||e.split(".").length>2)&&(n=!0),n&&a.cellsFormat&&(t=Smart.Utilities.DateTime.ParseDate(e,a.cellsFormat),null!==t&&(n=!0,e=t)))}if("date"!==a.dataType||n){if("string"==typeof e){const t=e=>{e.forEach((e=>{const t=e.trim();t.length&&i.addFilter("or",i.createFilter(r,t,l.condition||("string"===r?"CONTAINS":"EQUAL")))}))};e.indexOf(" or ")>=0?(e=e.split("or"),t(e)):e.indexOf(" and ")>=0?(e=e.split("and"),t(e)):e.indexOf(" & ")>=0?(e=e.split("&"),t(e)):e.indexOf(' | " ')>=0?(e=e.split("|"),t(e)):i.addFilter("and",i.createFilter(r,e,l.condition||("string"===r?"CONTAINS":"EQUAL")))}else i.addFilter("and",i.createFilter(r,e,l.condition||("string"===r?"CONTAINS":"EQUAL")));const n=t.getExcelFilter(a.dataField);n&&i.addFilter("and",n),t.addFilter(a.dataField,i)}}else{const e=t.getExcelFilter(a.dataField);e?t.addFilter(a.dataField,e):t.removeFilter(a.dataField)}}t.autoSaveState()}_handleFilterCellKeyDown(e,t){const l=this,a=e.column._filterInfo.input;t.ctrlKey&&"a"===t.key?a.select():t.altKey&&"ArrowDown"===t.key&&l._handleFilterCellIconClick(e)}_handleFilterCellKeyUp(e,t){const l=e.column,a=l._filterInfo.input,i=this,r=l._filterInfo,n=t.key;r.value!==a.value&&(r.value=a.value,"Control"===n||t.ctrlKey||("Escape"===n&&(r.value="",r.range=null,a.value=""),i._suspendFilterRowRefresh=!0,"Enter"===n||"Escape"===n||""===a.value?i._handleFilterCellValue(e):"auto"===i.filtering.filterRow.applyMode&&"Ctrl"!==n&&"Shift"!==n&&(i._filterRowTimer&&clearTimeout(i._filterRowTimer),i._filterRowTimer=setTimeout((()=>{i._suspendFilterRowRefresh=!0,i._handleFilterCellValue(e),i._suspendFilterRowRefresh=!1}),i.filtering.filterRow.autoApplyModeDelay)),clearTimeout(i._suspendFilterRowTimer),i._suspedFilterRowTimer=setTimeout((()=>{i._suspendFilterRowRefresh=!1}),1e3),t.ctrlKey&&"a"===n&&a.select()))}_handleFilterCellCheckBoxClick(e){const t=this,l=e.column,a=l._filterInfo;void 0===a.value&&(a.value=null),!0===a.value?a.value=!1:!1===a.value?a.value=null:null===a.value&&(a.value=!0);const i=e.element.querySelector(".smart-input");if(a.value?i.setAttribute("checked",a.value):null===a.value?i.setAttribute("checked","indeterminate"):i.removeAttribute("checked"),null===a.value)return t.removeFilter(l.dataField),void t.autoSaveState();const r=new Smart.FilterGroup;r.addFilter("and",r.createFilter(l.dataType,!0===a.value,"EQUAL")),t.addFilter(l.dataField,r),t.autoSaveState()}_handleFilterCellExcelIconClick(e){const t=this,l=e.column;l.filterRowExcelMenu&&l.filterRowExcelMenu.classList.contains("open")?t._closeMenu(l.filterRowExcelMenu):t._openColumnFilterExcelMenu(l)}_handleFilterCellIconClick(e){const t=this,l=e.column;l.filterRowMenu&&l.filterRowMenu.classList.contains("open")?t._closeMenu(l.filterRowMenu):t._openColumnFilterMenu(l)}_handleFilterCalendarCellClick(e){const t=this;t._openFilterCellDialog(e,(l=>{const a=l._filterInfo,i=a.editor.querySelector("input"),r=a.value;if(i){if(r||"RANGE"===a.condition)if(!r&&"RANGE"===a.condition&&a.range){t.removeFilter(l.dataField,!1);const e=new Smart.FilterGroup,i=a.range;e.addFilter("and",e.createFilter(l.dataType,i.min,"GREATER_THAN_OR_EQUAL")),e.addFilter("and",e.createFilter(l.dataType,i.max,"LESS_THAN_OR_EQUAL"));const r=a.cell.getFormattedValue(i.min,l.cellsFormat),n=a.cell.getFormattedValue(i.max,l.cellsFormat);t.addFilter(l.dataField,e),a.editor.querySelector("input").value=r+" - "+n}else if(r||"RANGE"!==a.condition||a.range){i.value=e.getFormattedValue(r[0],l.cellsFormat||"");const n=new Smart.FilterGroup;if(1===r.length)n.addFilter("and",n.createFilter(l.dataType,r[0],a.condition||"EQUAL"));else{let t=[];for(let i=0;i<r.length;i++)n.addFilter("or",n.createFilter(l.dataType,r[i],a.condition||"EQUAL")),t.push(e.getFormattedValue(r[i],l.cellsFormat||""));i.value=t.toString()}t.removeFilter(l.dataField,!1),t.addFilter(l.dataField,n)}else i.value="",t.removeFilter(l.dataField);else i.value="",t.removeFilter(l.dataField);t.autoSaveState()}}))}_handleFilterMenuClick(e,t){const l=this,a=e._filterInfo,i=a.editor,r=a.input;if(i.firstElementChild.innerHTML=`<i class="smart-grid-icon ${t.icon} show"></i>`,"CLEAR_FILTER"===t.value&&(r.value="",i.firstElementChild.innerHTML='<i class="smart-grid-icon smart-icon-search show"></i>',a.condition=null,a.value="",a.range=null),r.type="","RANGE"===a.condition&&"RANGE"!==t.value){let e=a.range;a.value=e.min}else if("RANGE"===t.value&&"RANGE"!==a.condition&&null!==a.condition){let e=a.range;a.value&&(e=a.value&&Array.isArray(a.value)?{min:a.value[0],max:a.value[0]}:{min:a.value,max:a.value},a.range=e)}if("RANGE"===t.value){r.readonly=!0;const i=new Smart.FilterGroup,n=a.range;if(n){i.addFilter("and",i.createFilter(e.dataType,n.min,"GREATER_THAN_OR_EQUAL")),i.addFilter("and",i.createFilter(e.dataType,n.max,"LESS_THAN_OR_EQUAL")),l.addFilter(e.dataField,i);const t=a.cell.getFormattedValue(n.min,e.cellsFormat),o=a.cell.getFormattedValue(n.max,e.cellsFormat);r.value=t+" - "+o}else r.value="";return a.condition=t.value,void l.autoSaveState()}if(r.readonly=!1,"CLEAR_FILTER"!==t.value&&(a.condition=t.value),""===r.value)l.removeFilter(e.dataField);else{const t=new Smart.FilterGroup,i=a.value,n=l._getFilterDataType(e);t.addFilter("and",t.createFilter(n,i,a.condition||"EQUAL")),l.addFilter(e.dataField,t),r.value=a.cell.getFormattedValue(i,e.cellsFormat)}l.autoSaveState(),setTimeout((()=>{r.focus()}),25)}_handleFilterNumberCellEditor(e,t,l){const a=t.querySelector("input"),i=t.querySelector(".up"),r=t.querySelector(".down"),n=e.column,o=this;let s=t=>{const l=n._filterInfo;if("RANGE"===l.condition)return void a.focus();let i=parseFloat(l.value);if(isNaN(i))return l.value=0,void(a.value=0);(t<0?i>a.min||""===a.min:i<a.max||""===a.max)&&(a.value=i+t,l.value=a.value,a.focus(),o._handleFilterCellValue(e))};l&&(s=l);const d=(e,t)=>{let l,a;e.onpointerdown=function(e){s(t),l&&clearTimeout(l),l=setTimeout((()=>{a&&clearInterval(a),a=setInterval((()=>{s(t)}),50)}),300),e.preventDefault(),e.stopPropagation()},e.onpointerup=()=>{a&&clearInterval(a),l&&clearTimeout(l),a=null},e.onpointerenter=()=>{a&&(clearInterval(a),a=setInterval((()=>{s(1)}),50))},e.onpointerleave=()=>{clearInterval(a)},document.addEventListener("pointerup",(()=>{a&&clearInterval(a),a=null,l&&clearTimeout(l)}))};d(i,1),d(r,-1)}_openFilterCellDialog(e,t){const l=this,a=l._dialogFilter||l._createDialog(),i=l.localize("dialogFilterHeader")+" "+e.column.label,r=a.content;a.header.innerHTML=i,a.confirm=t;let n=null,o=0;l._cellEditors||(l._cellEditors=[]),l._dialogFilter||(a.modal=!0,a.btnConfirm.innerHTML=l.localize("dialogFilterButtonConfirm"),a.btnCancel.innerHTML=l.localize("dialogFilterButtonCancel"),a.onOpen=function(){a.focus();const e=l._dialogFilterCell,t=e.column._filterInfo.range,i=e.column._filterInfo.value;if("date"===e.column.dataType){const a=r.querySelector("smart-calendar");a.locale=l.locale,setTimeout((()=>{"RANGE"===e.column._filterInfo.condition&&t?(a.selectedDates=[new Date(t.min.getTime()),new Date(t.max.getTime())],a._selectMultipleDates(new Date(t.min.getTime()),new Date(t.max.getTime()))):i&&(a.selectedDates=[new Date(i[0]?i[0].getTime():i.getTime())]),a.focus()}),100),a.focus()}else{const e=r.querySelectorAll("input");e[0].focus(),t&&(e[0].value=t.min,e[1].value=t.max)}},a.onClose=function(){},a.btnCancel.onclick=function(){a.close();const e=l._dialogFilterCell;e.column._filterInfo.range=null,e.column._filterInfo.value=null,a.confirm(e.column)},a.btnClose.onclick=function(){a.close()},a.btnConfirm.onclick=function(){const e=l._dialogFilterCell;if(e.column._filterInfo.range=null,e.column._filterInfo.value=null,"date"===e.column.dataType){const t=r.querySelector("smart-calendar"),l=t.selectedDates;if("range"===t.selectionMode)e.column._filterInfo.range={min:new Date(l[0].getTime()),max:new Date(l[l.length-1].getTime())};else{const t=[];l.forEach((e=>{const l=new Date(e.getTime());t.push(l)})),e.column._filterInfo.value=t}}else{const t=r.querySelectorAll("input");let l=t[0].value,a=t[1].value;""===a&&(a=100),""===l&&(l=0),e.column._filterInfo.range={min:l,max:a}}a.confirm(e.column),a.close()},a.onkeydown=function(e){const t=e.key;"Enter"===t?a.btnConfirm.onclick():"Escape"===t&&a.close()}),r.classList.remove("smart-grid-layout"),r.innerHTML="";const s=()=>{const e=r.querySelectorAll("input");a.btnConfirm.disabled=!0,""===e[0].value&&(e[0].value=0),""===e[1].value&&(e[1].value=100),parseFloat(e[0].value)<=parseFloat(e[1].value)&&(a.btnConfirm.disabled=!1)};"date"!==e.column.dataType&&r.classList.add("smart-grid-layout");for(let t=0;t<2;t++){const a=e.column;if("date"===a.dataType){const e=document.createElement("div");"RANGE"===a._filterInfo.condition?e.innerHTML='<smart-calendar selection-mode="range"></smart-calendar>':e.innerHTML="<smart-calendar></smart-calendar>",r.appendChild(e);break}o%2==0&&(n=document.createElement("div"),n.classList.add("row"),r.appendChild(n));const i=document.createElement("div");i.classList.add("col-sm-6");const d=document.createElement("div");d.classList.add("column");const c=document.createElement("label");c.innerHTML=0===t?l.localize("dialogFilterMinLabel"):l.localize("dialogFilterMaxLabel");const u=document.createElement("div");u.classList.add("smart-grid-dialog-editor"),u.setAttribute("editor",a.dataField),u.setAttribute("template",a.editor.template),i.appendChild(d),n.appendChild(i),d.appendChild(c),d.appendChild(u),o++,u.innerHTML='<div class="smart-grid-cell-editor smart-filter-input-value smart-grid-number-input-cell-editor"><input class="smart-input" type="number"><div class="nav"><div tabindex="-1" class="up"></div><div tabindex="-1" class="down"></div></div></div>';const f=u.querySelector("input");f.onchange=()=>{s()},l._handleFilterNumberCellEditor(e,u,(e=>{let t=parseFloat(f.value);isNaN(t)?f.value=0:((e<0?t>f.min||""===f.min:t<f.max||""===f.max)&&(f.value=t+e),s())}))}l._dialogFilter=a,l._dialogFilterCell=e;const d=e.column.element.getBoundingClientRect(),c=l.offset(l);let u=d.left+window.pageXOffset-c.left,f=d.bottom+l.layout.rowMinHeight+window.pageYOffset-c.top,m=Math.max(a.offsetWidth,314);u+m>c.left+l.offsetWidth&&(u=d.left+d.width+window.pageXOffset-c.left-m),e.column.filterRowMenu&&e.column.filterRowMenu.classList.contains("open")&&l._closeMenu(e.column.filterRowMenu),a.open(u,f)}});
1478
1478
 
1479
1479
  /***/ }),
1480
1480
 
@@ -1488,7 +1488,7 @@ Smart.Utilities.Assign("Grid.Filter",class{addFilter(e,t,l){const a=this,i=a.col
1488
1488
  /***/ 7333:
1489
1489
  /***/ (() => {
1490
1490
 
1491
- Smart.Utilities.Assign("Grid.Menu",class{_openColumnChooserMenu(e){const t=this;if(e||(e=t._commandColumn),!e||t.menu&&t.menu.column===e&&e.element.hasAttribute("aria-controls"))return void t.closeMenu();t.menu||(t.menu=document.createElement("div"),t.menu.classList.add("smart-grid-column-menu"),t.menu.setAttribute("theme",t.getAttribute("theme")),t.menu.id=t.id+"_"+t.tagName.toLowerCase()+"_menu_"+Math.floor(65536*(1+Math.random())).toString(16).substring(1)),t.appearance.allowColumnMenuAnimation?t.menu.classList.add("smart-animate"):t.menu.classList.remove("smart-animate"),t._createColumnChooserMenuItems(e),t.menu.style.height=t.columnMenu.height?t.columnMenu.height+"px":"auto",t.menu.column&&t.menu.column!==e&&(t.menu.column.setProperty("menu",null),t.menu.column=null),t.isInShadowDOM?t.getRootNode().appendChild(t.menu):document.body.appendChild(t.menu),e.setProperty("menu",t.menu);const n=e.element.getBoundingClientRect();t.menu.column=e,t._filterContainer&&("none"!==e.filterMenuMode&&t.filtering.filterMenu.visible&&Smart.FilterPanel?t._filterContainer.classList.remove("smart-hidden"):t._filterContainer.classList.add("smart-hidden"));let l=n.right-n.width+window.pageXOffset,i=n.bottom+window.pageYOffset;l+t.menu.offsetWidth>window.innerWidth&&(l=n.right+window.pageXOffset-t.menu.offsetWidth,t.menu.classList.add("smart-open-right"),l+t.menu.offsetWidth>window.innerWidth&&(l=window.innerWidth-t.menu.offsetWidth)),t.menu.style.left=l+"px",t.menu.style.top=i+"px",t.menu.classList.remove("smart-hidden"),t.menu.classList.add("open")}_openColumnFilterMenu(e){const t=this;if(!e||t.filterRowMenu&&t.filterRowMenu.column===e&&e.element.hasAttribute("aria-controls"))return void t.closeMenu();t._closeMenu(t.filterRowExcelMenu),t.filterRowMenu||(t.filterRowMenu=document.createElement("div"),t.filterRowMenu.classList.add("smart-grid-column-menu"),t.filterRowMenu.setAttribute("theme",t.getAttribute("theme")),t.filterRowMenu.id=t.id+"_"+t.tagName.toLowerCase()+"_menu_"+Math.floor(65536*(1+Math.random())).toString(16).substring(1)),t.appearance.allowColumnMenuAnimation?t.filterRowMenu.classList.add("smart-animate"):t.filterRowMenu.classList.remove("smart-animate"),t._createColumnFilterMenuItems(e),t.filterRowMenu.style.height=t.columnMenu.height?t.columnMenu.height+"px":"auto",t.filterRowMenu.column&&t.filterRowMenu.column!==e&&(t.filterRowMenu.column.setProperty("menu",null),t.filterRowMenu.column=null),t.isInShadowDOM?t.getRootNode().appendChild(t.filterRowMenu):document.body.appendChild(t.filterRowMenu),e.setProperty("filterRowMenu",t.filterRowMenu);const n=e.element.getBoundingClientRect();t.filterRowMenu.column=e;let l=n.left+window.pageXOffset,i=n.bottom+t.layout.rowMinHeight+window.pageYOffset;return l+t.filterRowMenu.offsetWidth>window.innerWidth&&(l=n.right+window.pageXOffset-t.filterRowMenu.offsetWidth,l+t.filterRowMenu.offsetWidth>window.innerWidth&&(l=window.innerWidth-t.filterRowMenu.offsetWidth)),t.filterRowMenu.style.left=l+"px",t.filterRowMenu.style.top=i+"px",t.filterRowMenu.classList.remove("smart-hidden"),t.filterRowMenu.classList.add("open"),setTimeout((()=>{t.filterRowMenu.querySelector("smart-menu").focus()}),50),t.filterRowMenu}_openColumnFilterExcelMenu(e){const t=this;if(!e||t.filterRowExcelMenu&&t.filterRowExcelMenu.column===e&&e.element.hasAttribute("aria-controls"))return void t.closeMenu();t._closeMenu(t.filterRowMenu),t.filterRowExcelMenu||(t.filterRowExcelMenu=document.createElement("div"),t.filterRowExcelMenu.classList.add("smart-grid-column-menu"),t.filterRowExcelMenu.setAttribute("theme",t.getAttribute("theme")),t.filterRowExcelMenu.id=t.id+"_"+t.tagName.toLowerCase()+"_menu_"+Math.floor(65536*(1+Math.random())).toString(16).substring(1)),t.appearance.allowColumnMenuAnimation?t.filterRowExcelMenu.classList.add("smart-animate"):t.filterRowExcelMenu.classList.remove("smart-animate"),t._createColumnFilterExcelMenuItems(e),t.filterRowExcelMenu.style.height=t.columnMenu.height?t.columnMenu.height+"px":"auto",t.filterRowExcelMenu.column&&t.filterRowExcelMenu.column!==e&&(t.filterRowExcelMenu.column.setProperty("menu",null),t.filterRowExcelMenu.column=null),t.isInShadowDOM?t.getRootNode().appendChild(t.filterRowExcelMenu):document.body.appendChild(t.filterRowExcelMenu),e.setProperty("filterRowExcelMenu",t.filterRowExcelMenu);const n=e.element.getBoundingClientRect();t.filterRowExcelMenu.column=e;let l=n.left+window.pageXOffset,i=n.bottom+t.layout.rowMinHeight+window.pageYOffset;return l+t.filterRowExcelMenu.offsetWidth>window.innerWidth&&(l=n.right+window.pageXOffset-t.filterRowExcelMenu.offsetWidth,l+t.filterRowExcelMenu.offsetWidth>window.innerWidth&&(l=window.innerWidth-t.filterRowExcelMenu.offsetWidth)),t.filterRowExcelMenu.style.left=l+"px",t.filterRowExcelMenu.style.top=i+"px",t.filterRowExcelMenu.classList.remove("smart-hidden"),t.filterRowExcelMenu.classList.add("open"),setTimeout((()=>{t.filterRowExcelMenu.querySelector("smart-menu").focus()}),50),t.filterRowExcelMenu}openContextMenu(e,t){const n=this;if(n.contextMenu.selector){const l=document.querySelector(n.contextMenu.selector);l&&setTimeout((()=>{l.open(e,t)}),100)}else n._closeMenu(n._contextMenu),n._contextMenu||(n._contextMenu=document.createElement("div"),n._contextMenu.classList.add("smart-grid-column-menu"),n._contextMenu.setAttribute("theme",n.getAttribute("theme")),n._contextMenu.id=n.id+"_"+n.tagName.toLowerCase()+"_menu_"+Math.floor(65536*(1+Math.random())).toString(16).substring(1),n.menu=n._contextMenu),n.appearance.allowColumnMenuAnimation?n._contextMenu.classList.add("smart-animate"):n._contextMenu.classList.remove("smart-animate"),n.rightToLeft?n._contextMenu.setAttribute("right-to-left",""):n._contextMenu.removeAttribute("right-to-left"),n.contextMenu.dataField?n._contextMenu.column=n.columnByDataField[n.contextMenu.dataField]:n._contextMenu.column=n.columns[0],n._createContextMenuItems(n._contextMenu),n._contextMenu.style.setProperty("--smart-grid-column-menu-width","auto"),n._contextMenu.style.height=n.contextMenu.height?n.contextMenu.height+"px":"auto",n._contextMenu.style.width=n.contextMenu.width?n.contextMenu.width+"px":"auto",n.isInShadowDOM?n.getRootNode().appendChild(n.menu):document.body.appendChild(n._contextMenu),n._contextMenu.style.left=e+10+"px",n._contextMenu.style.top=t+"px",t+n._contextMenu.offsetHeight>window.innerHeight&&(n._contextMenu.style.top=window.innerHeight-n._contextMenu.offsetHeight-10+"px"),n._contextMenu.classList.remove("smart-hidden"),n._contextMenu.classList.add("open"),setTimeout((()=>{n._contextMenu&&n._contextMenu.querySelector("smart-menu").focus()}),50)}_openMenu(e){const t=this;if(!e||t.menu&&t.menu.column===e&&e.element.hasAttribute("aria-controls")||!1===t.columnMenu.enabled)return void t.closeMenu();t._closeMenu(t.filterRowMenu),t._closeMenu(t.filterRowExcelMenu),t.$.headerBar&&t.header.visible&&t.$.headerBar.closePanel(),t.menu||(t.menu=document.createElement("div"),t.menu.classList.add("smart-grid-column-menu"),t.menu.setAttribute("theme",t.getAttribute("theme")),t.menu.id=t.id+"_"+t.tagName.toLowerCase()+"_menu_"+Math.floor(65536*(1+Math.random())).toString(16).substring(1)),t.appearance.allowColumnMenuAnimation?t.menu.classList.add("smart-animate"):t.menu.classList.remove("smart-animate"),t.rightToLeft?t.menu.setAttribute("right-to-left",""):t.menu.removeAttribute("right-to-left"),t._createMenuItems(e),t._createFilterPanel(e),t._filterMenuItemsVisibility(e),t.menu.style.height=t.columnMenu.height?t.columnMenu.height+"px":"auto",t.menu.column&&t.menu.column!==e&&(t.menu.column.setProperty("menu",null),t.menu.column=null),t.isInShadowDOM?t.getRootNode().appendChild(t.menu):document.body.appendChild(t.menu),e.setProperty("menu",t.menu);const n=e.element.getBoundingClientRect();t.menu.column=e;let l=n.right-e.element.actionButton.getBoundingClientRect().width+window.pageXOffset,i=n.bottom+window.pageYOffset;t.menu.classList.remove("smart-open-right"),t.rightToLeft&&(l=n.left+window.pageXOffset-t.menu.offsetWidth+e.element.actionButton.getBoundingClientRect().width,l<0&&(l=n.left+window.pageXOffset)),l+t.menu.offsetWidth>window.innerWidth&&(l=n.right+window.pageXOffset-t.menu.offsetWidth,l+t.menu.offsetWidth>window.innerWidth&&(l=window.innerWidth-t.menu.offsetWidth),t.menu.classList.add("smart-open-right")),t.menu.style.left=l+"px",t.menu.style.top=i+"px",t.hasColumnMenu(e)?(t.menu.classList.remove("smart-hidden"),t.menu.classList.add("open"),setTimeout((()=>{t.menu&&(t.menu.querySelector(".smart-filter-panel-input")?t.menu.querySelector(".smart-filter-panel-input").focus():t.menu.querySelector("smart-menu").focus())}),50)):t.closeMenu()}_menuItemClick(e){const t=this,n=e.detail.value;if(n&&n.properties){const e=n.properties.command;"function"==typeof e?e.apply(t,[n.column,n.properties]):t[e]&&t[e].apply(t,[n.column,n.properties]),n.column&&n.column.autoCloseMenu&&t.closeMenu()}}contextMenuItemChartCommand(){}contextMenuItemCutCommand(){const e=this,t=new KeyboardEvent("keydown",{bubbles:!0,cancelable:!0,composed:!0,pointerId:42,pointerType:"mouse",ctrlKey:!0,key:"X"});e._clipboardHandler("x",t),e.columnByDataField[e.contextMenu.dataField]||(e.selectRow(e.contextMenu.id),e._createCopyRects())}contextMenuItemCopyCommand(){const e=this,t=new KeyboardEvent("keydown",{bubbles:!0,cancelable:!0,composed:!0,pointerId:42,pointerType:"mouse",ctrlKey:!0,key:"C"});e._clipboardHandler("c",t),e.columnByDataField[e.contextMenu.dataField]||(e.selectRow(e.contextMenu.id),e._createCopyRects())}contextMenuItemPasteCommand(){const e=new KeyboardEvent("keydown",{bubbles:!0,cancelable:!0,composed:!0,pointerId:42,pointerType:"mouse",ctrlKey:!0,key:"V"});this._clipboardHandler("v",e)}contextMenuItemClearCommand(){const e=this;if(e._selection)if(e._selection.rows&&Object.keys(e._selection.rows).length>0){if(void 0!==e.contextMenu.id){const t=e.getSelectedRows();if(t.length>=1)return void t.map((e=>e[0])).forEach((t=>{requestAnimationFrame((()=>{e.updateRow(t,null,null,!0)}))}))}}else if(e._selection.cells&&Object.keys(e._selection.cells).length>0){const t=new KeyboardEvent("keydown",{bubbles:!0,cancelable:!0,composed:!0,pointerId:42,pointerType:"mouse",key:"Delete"});e.closeMenu(),e.$.dispatch(t)}}contextMenuItemInsertRowCommand(){const e=this;if(void 0!==e.contextMenu.id){const t=e.rowById[e.contextMenu.id];t&&requestAnimationFrame((()=>{e.insertRow({},1+t.visibleIndex)}))}}contextMenuItemSelectRowCommand(){const e=this;void 0!==e.contextMenu.id&&e.rowById[e.contextMenu.id]&&requestAnimationFrame((()=>{e.selectRow(e.contextMenu.id),e.$.headerBar&&(e.$.headerBar.refreshTools(),e.$.headerBar._refreshDeleteButton())}))}contextMenuItemCloneRowCommand(){const e=this;if(void 0!==e.contextMenu.id){const t=e.rowById[e.contextMenu.id];t&&requestAnimationFrame((()=>{e.insertRow(e.getRowData(e.contextMenu.id),1+t.visibleIndex),e._recycle(!1,!0)}))}}contextMenuItemAddCommentCommand(){const e=this;void 0!==e.contextMenu.id&&(e._focusCommentInput=!0,e._openRowSettingsDialog(e.contextMenu.id),setTimeout((()=>{delete e._focusCommentInput}),300))}contextMenuItemExpandCommand(){const e=this;void 0!==e.contextMenu.id&&e._openRowSettingsDialog(e.contextMenu.id)}contextMenuItemDeleteCommand(){const e=this;if(void 0!==e.contextMenu.id){const t=e.getSelectedRows();if(t.length>=1){const e=t.map((e=>e[0]));return void this.removeRow(e)}e.deleteRow(e.contextMenu.id)}}contextMenuItemEditCommand(){const e=this;void 0!==e.contextMenu.id&&e.editing.enabled&&("cell"===e.editing.mode?e.beginEdit(e.contextMenu.id,e.contextMenu.dataField):e.beginEdit(e.contextMenu.id))}removeGroupByCommand(e){this.removeGroup(e.dataField),this.autoSaveState()}groupByCommand(e){const t=this;t.dataSource&&(t.$.headerBar?t.header.visible&&t.header.buttons.indexOf("group")>=0&&t.$.headerBar.openGroupPanel(e):t.addGroup(e.dataField),t.autoSaveState())}sortAscCommand(e){this.sortBy(e.dataField,"asc"),this.autoSaveState()}sortDescCommand(e){this.sortBy(e.dataField,"desc"),this.autoSaveState()}removeSortCommand(e){this.sortBy(e.dataField,null),this.autoSaveState()}addSortCommand(e){const t=this;t.$.headerBar&&t.$.headerBar.openSortPanel(e)}addFilterCommand(e){const t=this;t.$.headerBar&&t.$.headerBar.openFilterPanel(e)}removeFilterCommand(e){this.removeFilter(e.dataField)}customizeTypeCommand(e){this._openAddColumnDialog(e,"rename")}hideColumnCommand(e){e.visible=!1,this.autoSaveState()}deleteColumnCommand(e){const t=this;t.columns.splice(t.columns.indexOf(e),1);for(let n=0;n<t.rows.length;n++)delete t.rows[n].data[e.dataField]}insertRightCommand(e){this._openAddColumnDialog(null,!1,null,e)}duplicateCommand(e,t,n){const l=this,i=new Smart.Grid.Column(e);delete i._state;let o=e.dataField,a=0;if(void 0===n){let t=!1;for(let n=0;n<l.rows.length;n++)if(l.rows[n].data[e.dataField]){t=!0;break}if(t)return void l._openDescriptionDialog(e,"duplicate")}for(let e=0;e<l.columns.length;e++)l.columns[e].dataField.indexOf(o)>=0&&a++;if(i.displayField=i.dataField=e.dataField+"_"+a,"object"==typeof e.editor){const t={};for(let n in e.editor)"instance"!==n&&"cell"!==n&&"column"!==n&&"row"!==n&&"isInitialized"!==n&&(t[n]=e.editor[n]);i.editor=JSON.parse(JSON.stringify(t))}const r=l.columns.indexOf(e);if(n)for(let t=0;t<l.rows.length;t++){const n=l.rows[t],o=n.data[e.dataField];n.data[i.dataField]=o}i.label=e.label+` ${l.localize("copy")} `+a,l.columns.splice(1+r,0,i),l.onColumnClone&&setTimeout((()=>{l.onColumnClone(e.dataField,i.dataField,1+r,n)}),100)}_removeMenu(){const e=this;if(e.menu){const t=e.menu.querySelector("smart-menu");t&&e.menu.removeChild(t)}if(e.filterRowMenu){const t=e.filterRowMenu.querySelector("smart-menu");t&&e.filterRowMenu.removeChild(t)}if(e.filterRowExcelMenu){const t=e.filterRowExcelMenu.querySelector("smart-menu");t&&e.filterRowExcelMenu.removeChild(t)}if(e._contextMenu){const t=e._contextMenu.querySelector("smart-menu");t&&(e._contextMenu.removeChild(t),e._contextMenu.parentNode.removeChild(e._contextMenu))}}_createColumnChooserMenuItems(e){const t=this;t._removeMenu();const n=document.createElement("smart-menu"),l=document.createDocumentFragment();if(n.mode="vertical",n.dropDownAppendTo="body",n.checkboxes=!0,n.checkable=!0,n.classList.add("smart-grid-column-chooser-menu"),n.rightToLeft=t.rightToLeft,e&&"_addNewColumn"===e.dataField){if(t._kanbanViewColumns&&t._kanbanViewColumns.length>0)for(let e=0;e<t._kanbanViewColumns.length;e++){const n=t._kanbanViewColumns[e],i=t.columnByDataField[n.dataField];if(i&&i.visible)continue;const o=document.createElement("smart-menu-item"),a=n.showIcon?n.icon:n.visible?"smart-icon-eye":"smart-icon-eye-off";o.checked=n.visible,n.allowHide&&(n.command=function(e){t.closeMenu();const n=t.columnByDataField[e.dataField];n.visible=!0,delete n._visible;const l=t._kanbanViewColumns.indexOf(e);l>=0&&t._kanbanViewColumns.splice(l,1)},o.label=t.localize(n.label)||n.label||n.dataField,o.value={column:n,properties:n},a&&(o.label='<span class="smart-grid-icon '+a+'"></span>'+o.label),l.appendChild(o))}const e=document.createElement("smart-menu-item");e.label='<span class="smart-grid-icon smart-icon-plus"></span>'+t.localize("dialogNewColumn"),e.value={properties:{command:()=>{t.closeMenu(),t._openAddColumnDialog()}}},l.appendChild(e)}else for(let e=0;e<t.columns.length;e++){const n=t.columns[e],i=document.createElement("smart-menu-item"),o=n.showIcon?n.icon:n.visible?"smart-icon-eye":"smart-icon-eye-off";i.checked=n.visible,n.allowHide&&(n.command=function(e){e.visible=!e.visible},i.label=t.localize(n.label)||n.label||n.dataField,i.value={column:n,properties:n},o&&(i.label='<span class="smart-grid-icon '+o+'"></span>'+i.label),l.appendChild(i))}n.appendChild(l),t.menu.appendChild(n),t.menu.itemCheckChange=t._menuItemClick.bind(t),t.menu.addEventListener("itemCheckChange",t.menu.itemCheckChange),t.menu.addEventListener("keydown",t._keyDownHandler.bind(t))}_createFilterListBox(e){const t=this,n=t.columnByDataField[e];if(!n)return null;let l=t.getExcelFilterDataSource(n.dataField);const i=document.createElement("smart-list-box");return i.style.setProperty("--smart-list-item-height","24px"),i.id=t.id+"_"+t.tagName.toLowerCase()+"_filter_listbox_"+Math.floor(65536*(1+Math.random())).toString(16).substring(1),i.checkboxes=!0,i.animation="none",i.selectionMode="checkBox",i.dataSource=l,i.displayMember="label",i.valueMember="value",i.style.width="100%",i.filterable=!0,i.autoHeight=!0,i.selectAll=!0,i.rightToLeft=t.rightToLeft,i.theme=t.theme,i.locale=t.locale,i.style.height="200px",i.whenRendered((()=>{if(n.filterEditor&&n.filterEditor.values&&(n._filterInfo||(n._filterInfo={}),n._filterInfo.excelValues=n.filterEditor.values),n._filterInfo&&n._filterInfo.excelValues&&Array.isArray(n._filterInfo.excelValues)){i.clearSelection();let e=[];for(let t=0;t<n._filterInfo.excelValues.length;t++){const l=n._filterInfo.excelValues[t];e.push(l)}i.checkAll(e)}else i.checkAll();setTimeout((()=>{i.focusFilter()}),200)})),i}_createColumnFilterExcelMenuItems(e){const t=this;t._removeMenu();const n=document.createElement("smart-menu"),l=document.createDocumentFragment();n.mode="vertical",n.dropDownAppendTo="body",n.classList.add("smart-grid-column-filter-menu","filter-excel"),n.rightToLeft=t.rightToLeft,n.animation="none",n.preventHover=!0,n.style.setProperty("--smart-list-item-height","27px");const i=document.createElement("smart-menu-item");i.style.paddingLeft=i.style.paddingRight=i.style.paddingTop=i.style.paddingBottom="0px";const o=t._createFilterListBox(e.dataField),a=document.createElement("div");a.classList.add("smart-flex"),a.style.flexDirection="column",a.style.padding="5px",a.appendChild(o);const r=document.createElement("div");r.classList.add("smart-flex"),r.style.marginTop="10px",r.style.marginLeft="5px";const s=document.createElement("smart-button");s.innerHTML=t.localize("filter"),s.classList.add("primary");const m=document.createElement("smart-button");m.innerHTML=t.localize("clear"),m.style.marginLeft="10px",r.appendChild(s),r.appendChild(m),a.appendChild(r),i.appendChild(a),l.appendChild(i),m.onclick=function(){o.clearSelection(),o.checkAll(),e._filterInfo.excelValues=null,t.removeFilter(e.dataField);const n=t.getFilterRowFilter(e.dataField);n&&t.addFilter(e.dataField,n),t.closeMenu()},s.onclick=function(){const n=o.getSelectedValues();if(e._filterInfo.excelValues=n,n.length===o.getItems().length){e._filterInfo.excelValues=null;const n=t.getFilterRowFilter(e.dataField);return n?t.addFilter(e.dataField,n):t.removeFilter(e.dataField),void t.closeMenu()}const l=t.getExcelFilter(e.dataField,n),i=t.getFilterRowFilter(e.dataField);i&&l.addFilter("and",i),t.addFilter(e.dataField,l),t.closeMenu()},n.appendChild(l),t.filterRowExcelMenu.appendChild(n),t.filterRowExcelMenu.itemClick=t._menuItemClick.bind(t),t.filterRowExcelMenu.classList.add("smart-open-right"),t.filterRowExcelMenu.addEventListener("itemClick",t.filterRowExcelMenu.itemClick),t.filterRowExcelMenu.addEventListener("keydown",(e=>{"Escape"===e.key&&t._closeMenu(t.filterRowExcelMenu)}))}_createColumnFilterMenuItems(e){const t=this;t._removeMenu();const n=document.createElement("smart-menu"),l=document.createDocumentFragment();n.mode="vertical",n.dropDownAppendTo="body",n.classList.add("smart-grid-column-filter-menu"),n.rightToLeft=t.rightToLeft;const i=e._filterInfo.dataSource;for(let t=0;t<i.length;t++){const n=i[t],o=document.createElement("smart-menu-item"),a=n.icon;o.label=n.label,o.value={column:e,properties:n},a&&(o.label='<span class="smart-grid-icon '+a+'"></span>'+o.label),e._filterInfo.condition===n.value&&o.setAttribute("focus",""),l.appendChild(o)}n.appendChild(l),t.filterRowMenu.appendChild(n),t.filterRowMenu.itemClick=t._menuItemClick.bind(t),t.filterRowMenu.addEventListener("itemClick",t.filterRowMenu.itemClick),t.filterRowMenu.addEventListener("keydown",(e=>{"Escape"===e.key&&t._closeMenu(t.filterRowMenu)}))}_createMenuItems(e){const t=this;t._removeMenu();const n=document.createElement("smart-menu"),l=document.createDocumentFragment(),i=e.menuItems||t.columnMenu.dataSource;n.mode="vertical",n.dropDownAppendTo="body",n.rightToLeft=t.rightToLeft;for(let n in i){const o=i[n],a=document.createElement("smart-menu-item");let r=o.icon;a.label=t.localize(n),a.value={column:e,properties:o};const s=t=>{if(t){if("string"===e.dataType)return"A → Z";if("number"===e.dataType||"date"===e.dataType||"time"===e.dataType)return"1 → 9";if("bool"===e.dataType||"boolean"===e.dataType)return"0 → 1"}else{if("string"===e.dataType)return"Z → A";if("number"===e.dataType||"date"===e.dataType||"time"===e.dataType)return"9 → 1";if("bool"===e.dataType||"boolean"===e.dataType)return"1 → 0"}};"columnMenuItemSortAsc"===n?(a.label=t.localize(n,{mode:s(!0)}),"string"!==e.dataType&&o.iconAlt&&(r=o.iconAlt)):"columnMenuItemSortDesc"===n&&(a.label=t.localize(n,{mode:s(!1)}),"string"!==e.dataType&&o.iconAlt&&(r=o.iconAlt)),r&&(a.label='<span class="smart-grid-icon '+r+'"></span>'+a.label),l.appendChild(a)}n.appendChild(l),t._filterContainer?t.menu.insertBefore(n,t._filterContainer):t.menu.appendChild(n),t.menu.itemClick=t._menuItemClick.bind(t),t.menu.addEventListener("itemClick",t.menu.itemClick),t.menu.addEventListener("keydown",t._keyDownHandler.bind(t))}_createContextMenuItems(){const e=this;e._removeMenu();const t=document.createElement("smart-menu"),n=document.createDocumentFragment();let l=e.contextMenu.dataSource;t.mode="vertical",t.dropDownAppendTo="body",t.rightToLeft=e.rightToLeft;const i=e._selection&&e._selection.cells&&Object.keys(e._selection.cells).length>2,o=e._getSelectedRows(!0,!1);if(i){let t={};t.contextMenuItemCut=l.contextMenuItemCut,t.contextMenuItemCopy=l.contextMenuItemCopy,t.contextMenuItemPaste=l.contextMenuItemPaste,t.contextMenuItemClear=l.contextMenuItemClear,e.charting.enabled&&(t.contextMenuItemChart=l.contextMenuItemChart),l=t}else if(o.length>1){let t={};t.contextMenuItemCut=l.contextMenuItemCut,t.contextMenuItemCopy=l.contextMenuItemCopy,t.contextMenuItemPaste=l.contextMenuItemPaste,t.contextMenuItemClear=l.contextMenuItemClear,t.contextMenuItemDelete=l.contextMenuItemDelete,e.charting.enabled&&(t.contextMenuItemChart=l.contextMenuItemChart),l=t}if(null!==e.contextMenu.id&&e._newRow&&e._newRow.id===e.contextMenu.id){const t=function(t,n){const l=n.value;requestAnimationFrame((()=>{const t=[];for(let e=0;e<l;e++)t.push({});e.rows.push(t),e._recycle(!1),e.$.verticalScrollBar.value=e.$.verticalScrollBar.max}))},l=[{label:e.localize("contextMenuItemAddRow",{value:5}),value:5,command:t},{label:e.localize("contextMenuItemAddRow",{value:10}),value:10,command:t},{label:e.localize("contextMenuItemAddRow",{value:20}),value:20,command:t}];for(let e in l){const t=l[e],i=document.createElement("smart-menu-item");i.value={properties:t},i.label=t.label,n.appendChild(i)}}else for(let i in l){const o=l[i];let a=document.createElement("smart-menu-item"),r=o.icon;!0===o.visible?a.classList.remove("smart-hidden"):!1===o.visible&&a.classList.add("smart-hidden"),"contextMenuItemEdit"===i?(e.editing.enabled||(a.disabled=!0),"{{messages}}"===o.label?"cell"===e.editing.mode?a.label=e.localize("contextMenuItemEditCell"):a.label=e.localize("contextMenuItemEditRow"):a.label=o.label):"contextMenuItemClear"===i?(e.editing.enabled||(a.disabled=!0),"{{messages}}"===o.label?a.label=e.localize("clearContents"):a.label=o.label):"contextMenuItemCut"===i?(e.editing.enabled||(a.disabled=!0),"{{messages}}"===o.label?a.label=e.localize("cut").substring(0,1).toUpperCase()+e.localize("cut").substring(1):a.label=o.label):"contextMenuItemCopy"===i?(e.editing.enabled||(a.disabled=!0),"{{messages}}"===o.label?a.label=e.localize("copy").substring(0,1).toUpperCase()+e.localize("copy").substring(1):a.label=o.label):"contextMenuItemPaste"===i?(e.editing.enabled||(a.disabled=!0),"{{messages}}"===o.label?a.label=e.localize("paste"):a.label=o.label):"contextMenuItemExpand"===i?(e.editing.enabled||(a.disabled=!0),"{{messages}}"===o.label?a.label=e.localize("expandRecord"):a.label=o.label):"contextMenuItemCloneRow"===i?(e.editing.enabled||(a.disabled=!0),"{{messages}}"===o.label?a.label=e.localize("contextMenuItemCloneRow"):a.label=o.label):"contextMenuItemSelectRow"===i?(e.editing.enabled||(a.disabled=!0),"{{messages}}"===o.label?a.label=e.localize("contextMenuItemSelectRow"):a.label=o.label):"contextMenuItemComment"===i?(e.editing.enabled||(a.disabled=!0),"{{messages}}"===o.label?a.label=e.localize("commentPlaceholder"):a.label=o.label):"contextMenuItemChart"===i?(t.selectionMode="mouseenter",t.preventCloseOnCheck=!0,e.charting.enabled||(a.disabled=!0),a=document.createElement("smart-menu-items-group"),a.label=e.localize("contextMenuItemChart"),a.innerHTML='\n <smart-menu-items-group>\n Column\n <smart-menu-item type="column">Column</smart-menu-item>\n <smart-menu-item type="stackedcolumn">Stacked Column</smart-menu-item>\n <smart-menu-item type="stackedcolumn100">100% Stacked Column</smart-menu-item>\n </smart-menu-items-group>\n <smart-menu-items-group>Bar\n <smart-menu-item type="bar">Bar</smart-menu-item>\n <smart-menu-item type="stackedbar">Stacked Bar</smart-menu-item>\n <smart-menu-item type="stackedbar100" >100% Stacked Bar</smart-menu-item>\n </smart-menu-items-group>\n <smart-menu-items-group>Line\n <smart-menu-item type="line">Line</smart-menu-item>\n <smart-menu-item type="stackedline">Stacked Line</smart-menu-item>\n <smart-menu-item type="stackedline100">100% Stacked Line</smart-menu-item>\n </smart-menu-items-group>\n <smart-menu-items-group>Area\n <smart-menu-item type="area">Area</smart-menu-item>\n <smart-menu-item type="stackedarea">Stacked Area</smart-menu-item>\n <smart-menu-item type="stackedarea100">100% Stacked Area</smart-menu-item>\n </smart-menu-items-group>\n <smart-menu-items-group>Pie\n <smart-menu-item type="pie">Pie</smart-menu-item>\n <smart-menu-item type="donut">Donut</smart-menu-item>\n </smart-menu-items-group>\n <smart-menu-items-group>Scatter\n <smart-menu-item type="scatter">Scatter</smart-menu-item>\n <smart-menu-item type="bubble">Bubble</smart-menu-item>\n </smart-menu-items-group>\n <smart-menu-items-group>Funnel\n <smart-menu-item type="funnel">Funnel</smart-menu-item>\n <smart-menu-item type="pyramid">Pyramid</smart-menu-item>\n </smart-menu-items-group>\n ',a.querySelectorAll("smart-menu-item").forEach((n=>{const l=n.getAttribute("type");n.onpointerdown=n=>{n.stopPropagation(),n.preventDefault(),t.close(),e._closeMenu(e._contextMenu),e.createChart(l)},n.value={properties:{command:()=>{e.createChart(l)}}}}))):"{{messages}}"===o.label?a.label=e.localize(i):a.label=o.label,a.value={properties:o},r&&(a.label='<span class="smart-grid-icon '+r+'"></span>'+a.label),n.appendChild(a)}if(e.contextMenu.customContextMenuItems)for(let t in e.contextMenu.customContextMenuItems){const l=e.contextMenu.customContextMenuItems[t],i=document.createElement("smart-menu-item");let o=l.icon;!0===l.visible?i.classList.remove("smart-hidden"):!1===l.visible&&i.classList.add("smart-hidden"),i.label=l.label,i.value={properties:l},o&&(i.label='<span class="smart-grid-icon '+o+'"></span>'+i.label),n.appendChild(i)}[...n.querySelectorAll("smart-menu-item")].forEach((e=>{e.style.marginBottom=e.style.marginTop="0px"})),[...n.querySelectorAll("smart-menu-items-group")].forEach((e=>{e.style.marginBottom=e.style.marginTop="0px"})),t.appendChild(n),e._contextMenu.appendChild(t),""!==t.textContent||0!==t.children.length?(e._contextMenu.itemClick=t=>{t.detail.value||(t.detail.value={properties:{command:null}}),t.detail.value.column=t.detail.item.column=e._contextMenu.column;const n=t.detail.value.column;e._menuItemClick(t),e._closeMenu(e._contextMenu),e.$.fireEvent("contextMenuItemClick",{id:e._contextMenu.id,dataField:n?n.dataField:null,command:t.detail.value.properties.command})},e._contextMenu.style.minHeight="30px",e._contextMenu.addEventListener("itemClick",e._contextMenu.itemClick),e._contextMenu.addEventListener("keydown",e._keyDownHandler.bind(e))):e._removeMenu()}_getFilterType(e){const t=this;let n="string";switch(e.dataType.endsWith("?")?e.dataType.substring(0,e.dataType.length-1):e.dataType){case"number":case"int":case"float":case"int64":n="numeric";break;case"bool":case"boolean":n="bool";break;case"date":case"time":case"datetime":n="date";break;case"any":n="string"}return e.displayField!==e.dataField&&(n=t._getFilterDataType(e)),n}_createFilterPanel(e){const t=this;if(Smart.FilterPanel)if(t.filtering.enabled&&t.filtering.filterMenu.visible&&e.allowFilter&&!t.filtering.filterRow.visible&&(!t.header.visible||t.header.visible&&-1===t.header.buttons.indexOf("filter"))){const n=t._getFilterType(e);if(t._filterPanel&&t._filterPanel.parentNode&&t._filterPanel.parentNode.removeChild(t._filterPanel),t._filterPanel=t._filterPanels[n],!t._filterPanel){const e=document.createElement("smart-filter-panel");e.filterType=n,t._filterPanels[n]=e,t._filterPanel=e}t._filterPanel.dataField=e.dataField,t._filterPanel.rightToLeft=t.rightToLeft,t.filtering.filterMenu.messages?t._filterPanel.messages=t.filtering.filterMenu.messages:t._filterPanel.messages=t.messages,"excel"!==e.filterMenuMode&&"multi"!==e.filterMenuMode||(t._filterPanel.dataField=e.dataField,t._filterPanel._createFilterListBox=t._createFilterListBox.bind(t),t._filterPanel.getExcelFilter=t.getExcelFilter.bind(t),t.dataSource&&t.dataSource.boundSource&&(t._filterPanel.data=t.dataSource.boundSource.toArray?t.dataSource.boundSource.toArray():t.dataSource.boundSource)),e.filterEditor&&e.filterEditor.dataSource&&(t._filterPanel.data=[...e.filterEditor.dataSource]),t._filterPanel.mode=e.filterMenuMode,t._filterPanel.locale=t.locale;const l=t._filterPanel.querySelectorAll(".smart-filter-panel-input");for(let e=0;e<l.length;e++)l[e].onkeydown=e=>{"Enter"===e.key&&t._filterPanel.filter()};if(!t._filterContainer){const e=document.createElement("div");e.classList.add("smart-filter-container"),t._filterContainer=e,requestAnimationFrame((function(){t.menu.appendChild(e)})),t._applyFilterHandler=function(){t.addFilter(t._filterPanel.dataField,t._filterPanel.getFilter()),t.columnByDataField[t._filterPanel.dataField]._filterState=t._filterPanel.getState(),t.autoSaveState()},t._clearFilterHandler=function(){requestAnimationFrame((()=>{t.removeFilter(t._filterPanel.dataField),t.columnByDataField[t._filterPanel.dataField]._filterState=null,t.autoSaveState()}))}}t._filterContainer.appendChild(t._filterPanel),t._filterPanel.classList.remove("smart-hidden"),t._filterPanel.removeEventListener("filter",t._applyFilterHandler),t._filterPanel.removeEventListener("clear",t._clearFilterHandler),t._filterPanel.addEventListener("filter",t._applyFilterHandler),t._filterPanel.addEventListener("clear",t._clearFilterHandler);const i=t._filterContainer.querySelector(".smart-grid-custom-filter-panel");if(i&&t._filterContainer.removeChild(i),"none"!==e.filterMenuMode&&t.filtering.filterMenu.visible&&Smart.FilterPanel?t._filterContainer.classList.remove("smart-hidden"):t._filterContainer.classList.add("smart-hidden"),e.getFilterPanel)if(e._customFilterPanel)e.updateFilterPanel(e._customFilterPanel,e),t._filterContainer.removeChild(t._filterPanel),t._filterContainer.appendChild(e._customFilterPanel);else{const n=e.getFilterPanel(e);n&&(n.classList.add("smart-grid-custom-filter-panel"),e._customFilterPanel=n,t._filterContainer.removeChild(t._filterPanel),t._filterContainer.appendChild(n))}if(t._filterPanel.reset(),e.filterEditor&&!e.filter&&e.filterEditor.condition){const n=new Smart.FilterGroup,l=t._getFilterType(e),i=n.getConditions(l),o=e.filterEditor.condition?i.indexOf(e.filterEditor.condition.toUpperCase()):-1,a=e.filterEditor.condition2?i.indexOf(e.filterEditor.condition2.toUpperCase()):-1,r=e.filterEditor.value||"",s=e.filterEditor.value2||"",m=e.filterEditor.logicalOperator?["and","or"].indexOf(e.filterEditor.logicalOperator):0;e._filterState={firstFilterComparison:o,firstFilterValue:r,logicalOperator:m,secondFilterComparison:a,secondFilterValue:s},t._filterPanel.loadState(e._filterState)}if(e._filterState)t._filterPanel.loadState(e._filterState);else if(e.filter){const n=e.filter,l=t._getFilterType(e);let i=n.getFilters();for(;i.length>0&&"FilterGroup"===i[0].type;)i=i[0].value;const o=n.getConditions(l),a=i.length>0?o.indexOf(i[0].condition):-1,r=i.length>1?o.indexOf(i[1].condition):-1,s=i.length>0?i[0].value:"",m=i.length>1?i[1].value:"",u=i.length>1?["and","or"].indexOf(i[1].logicalOperator):0;"excel"===e.filterMenuMode?(e._filterState={filters:i},t._filterPanel.loadState(e._filterState)):"multi"===e.filterMenuMode?(e._filterState={filters:i,firstFilterValue:"",secondFilterValue:"",firstFilterComparison:a},t._filterPanel.loadState(e._filterState)):(e._filterState={firstFilterComparison:a,firstFilterValue:s,logicalOperator:u,secondFilterComparison:r,secondFilterValue:m},t._filterPanel.loadState(e._filterState))}}else t._filterPanel&&(t._filterPanel.parentNode&&t._filterPanel.parentNode.removeChild(t._filterPanel),e._filterState=null)}hasColumnMenu(e){const t=this;if(!1===t.columnMenu.enabled)return!1;const n=e.menuItems||t.columnMenu.dataSource;let l=0,i=0;for(let o in n){const a=n[o];if(i++,!1===a.visible)l++;else if("auto"===a.visible){if(("columnMenuItemFilter"===o||"columnMenuItemRemoveFilter"===o)&&(t.filtering.filterMenu.visible||t.filtering.filterRow.visible)&&(!t.header.visible||t.header.visible&&-1===t.header.buttons.indexOf("filter"))){l++;continue}if(!("columnMenuItemGroupBy"!==o&&"columnMenuItemRemoveGroupBy"!==o||e.allowGroup&&t.grouping.enabled)){l++;continue}if(!("columnMenuItemSort"!==o||e.allowSort&&t.sorting.enabled)){l++;continue}if(!("columnMenuItemFilter"!==o||e.allowFilter&&t.filtering.enabled)){l++;continue}if(!("columnMenuItemRemoveFilter"!==o||e.allowFilter&&t.filtering.enabled)){l++;continue}if("columnMenuItemGroupBy"===o&&!e.allowGroup){l++;continue}if(!("columnMenuItemSortAsc"!==o&&"columnMenuItemSortDesc"!==o&&"columnMenuItemRemoveSort"!==o||e.allowSort&&t.sorting.enabled)){l++;continue}}}return!(!(t.filtering.enabled&&t.filtering.filterMenu.visible&&!t.filtering.filterRow.visible&&"none"!==e.filterMenuMode&&Smart.FilterPanel||Smart.Menu&&!(l>=i))||l>=i)}_filterMenuItemsVisibility(e){const t=this,n=(t.menu.parentElement&&(t.enableShadowDOM||t.isInShadowDOM)?t.menu.firstElementChild.shadowRoot:t.menu).querySelectorAll("smart-menu-item"),l=e.menuItems||t.columnMenu.dataSource;let i=0;for(let o in l){const a=n[i++],r=l[o];if(a.disabled=!r.enabled,a.classList.remove("smart-hidden"),"columnMenuItemDelete"!==o||e.allowDelete)if("columnMenuItemHide"!==o||e.allowHide){if("columnMenuItemRemoveSort"===o&&(e.sortOrder?a.disabled=!1:a.disabled=!0),("columnMenuItemSortAsc"===o&&"asc"===e.sortOrder||"columnMenuItemSortDesc"===o&&"desc"===e.sortOrder)&&(a.disabled=!0),!0===r.visible)a.classList.remove("smart-hidden");else if(!1===r.visible)a.classList.add("smart-hidden");else if("auto"===r.visible){if("columnMenuItemFilter"!==o&&"columnMenuItemRemoveFilter"!==o||(!1===t.filtering.enabled?a.classList.add("smart-hidden"):((t.filtering.filterMenu.visible||t.filtering.filterRow.visible)&&a.classList.add("smart-hidden"),t.header.visible&&t.header.buttons.indexOf("filter")>=0?a.classList.remove("smart-hidden"):"columnMenuItemFilter"===o&&a.classList.add("smart-hidden"),e.filtered||"columnMenuItemRemoveFilter"!==o||a.classList.add("smart-hidden"))),"columnMenuItemSort"===o&&(!1===t.sorting.enabled?a.classList.add("smart-hidden"):(a.classList.add("smart-hidden"),t.header.visible&&t.header.buttons.indexOf("sort")>=0&&a.classList.remove("smart-hidden"))),"columnMenuItemGroupBy"===o){t.grouping.enabled&&e.allowGroup?a.classList.remove("smart-hidden"):a.classList.add("smart-hidden");const n=t.dataSource.groupBy.indexOf(e.dataField);a.disabled=n>=0}if("columnMenuItemRemoveGroupBy"===o){t.grouping.enabled&&e.allowGroup?a.classList.remove("smart-hidden"):a.classList.add("smart-hidden"),t.header.visible&&t.header.buttons.indexOf("group")>=0&&a.classList.add("smart-hidden");const n=t.dataSource.groupBy.indexOf(e.dataField);a.disabled=n<0}"columnMenuItemFilter"!==o||e.allowFilter||a.classList.add("smart-hidden"),"columnMenuItemSort"!==o||e.allowSort||a.classList.add("smart-hidden"),"columnMenuItemRemoveFilter"!==o||e.allowFilter||a.classList.add("smart-hidden"),"columnMenuItemSortAsc"!==o&&"columnMenuItemSortDesc"!==o&&"columnMenuItemRemoveSort"!==o||(e.allowSort&&t.sorting.enabled?a.classList.remove("smart-hidden"):a.classList.add("smart-hidden"),t.header.visible&&t.header.buttons.indexOf("sort")>=0&&a.classList.add("smart-hidden"))}}else a.classList.add("smart-hidden");else a.classList.add("smart-hidden")}}openMenu(e){const t=this.columnByDataField[e];t&&this._openMenu(t)}hasMenu(){const e=this;return!!(e.menu&&e.menu.column&&e.menu.parentNode)}_closeMenu(e){const t=this;(e=>{if(e){e.column&&(e.column.setProperty("menu",null),e.column=null);let n=e.classList.contains("open");if(e.parentNode&&(e.classList.remove("open"),t.appearance.allowColumnMenuAnimation||e.parentNode.removeChild(e)),e.removeEventListener("keydown",t._keyDownHandler.bind(t)),e.removeEventListener("itemClick",e.itemClick),e.removeEventListener("itemCheckChange",e.itemCheckChange),t._filterRowInputOnFocus)return;if(!n)return;t.focus()}})(e)}closeMenu(){const e=this,t=e.menu;if(e._closeMenu(t),e._closeMenu(e.filterRowMenu),e._closeMenu(e.filterRowExcelMenu),e._closeMenu(e._contextMenu),e._filterPanel){const t=e._filterPanel.querySelectorAll("smart-drop-down-list");for(let e=0;e<t.length;e++){const n=t[e];n.opened&&n.close()}}}});
1491
+ Smart.Utilities.Assign("Grid.Menu",class{_openColumnChooserMenu(e){const t=this;if(e||(e=t._commandColumn),!e||t.menu&&t.menu.column===e&&e.element.hasAttribute("aria-controls"))return void t.closeMenu();t.menu||(t.menu=document.createElement("div"),t.menu.classList.add("smart-grid-column-menu"),t.menu.setAttribute("theme",t.getAttribute("theme")),t.menu.id=t.id+"_"+t.tagName.toLowerCase()+"_menu_"+Math.floor(65536*(1+Math.random())).toString(16).substring(1)),t.appearance.allowColumnMenuAnimation?t.menu.classList.add("smart-animate"):t.menu.classList.remove("smart-animate"),t._createColumnChooserMenuItems(e),t.menu.style.height=t.columnMenu.height?t.columnMenu.height+"px":"auto",t.menu.column&&t.menu.column!==e&&(t.menu.column.setProperty("menu",null),t.menu.column=null),t.isInShadowDOM?t.getRootNode().appendChild(t.menu):document.body.appendChild(t.menu),e.setProperty("menu",t.menu);const n=e.element.getBoundingClientRect();t.menu.column=e,t._filterContainer&&("none"!==e.filterMenuMode&&t.filtering.filterMenu.visible&&Smart.FilterPanel?t._filterContainer.classList.remove("smart-hidden"):t._filterContainer.classList.add("smart-hidden"));let l=n.right-n.width+window.pageXOffset,i=n.bottom+window.pageYOffset;l+t.menu.offsetWidth>window.innerWidth&&(l=n.right+window.pageXOffset-t.menu.offsetWidth,t.menu.classList.add("smart-open-right"),l+t.menu.offsetWidth>window.innerWidth&&(l=window.innerWidth-t.menu.offsetWidth)),t.menu.style.left=l+"px",t.menu.style.top=i+"px",t.menu.classList.remove("smart-hidden"),t.menu.classList.add("open")}_openColumnFilterMenu(e){const t=this;if(!e||t.filterRowMenu&&t.filterRowMenu.column===e&&e.element.hasAttribute("aria-controls"))return void t.closeMenu();t._closeMenu(t.filterRowExcelMenu),t.filterRowMenu||(t.filterRowMenu=document.createElement("div"),t.filterRowMenu.classList.add("smart-grid-column-menu"),t.filterRowMenu.setAttribute("theme",t.getAttribute("theme")),t.filterRowMenu.id=t.id+"_"+t.tagName.toLowerCase()+"_menu_"+Math.floor(65536*(1+Math.random())).toString(16).substring(1)),t.appearance.allowColumnMenuAnimation?t.filterRowMenu.classList.add("smart-animate"):t.filterRowMenu.classList.remove("smart-animate"),t._createColumnFilterMenuItems(e),t.filterRowMenu.style.height=t.columnMenu.height?t.columnMenu.height+"px":"auto",t.filterRowMenu.column&&t.filterRowMenu.column!==e&&(t.filterRowMenu.column.setProperty("menu",null),t.filterRowMenu.column=null),t.isInShadowDOM?t.getRootNode().appendChild(t.filterRowMenu):document.body.appendChild(t.filterRowMenu),e.setProperty("filterRowMenu",t.filterRowMenu);const n=e.element.getBoundingClientRect();t.filterRowMenu.column=e;let l=n.left+window.pageXOffset,i=n.bottom+t.layout.rowMinHeight+window.pageYOffset;return l+t.filterRowMenu.offsetWidth>window.innerWidth&&(l=n.right+window.pageXOffset-t.filterRowMenu.offsetWidth,l+t.filterRowMenu.offsetWidth>window.innerWidth&&(l=window.innerWidth-t.filterRowMenu.offsetWidth)),t.filterRowMenu.style.left=l+"px",t.filterRowMenu.style.top=i+"px",t.filterRowMenu.classList.remove("smart-hidden"),t.filterRowMenu.classList.add("open"),setTimeout((()=>{t.filterRowMenu.querySelector("smart-menu").focus()}),50),t.filterRowMenu}_openColumnFilterExcelMenu(e){const t=this;if(!e||t.filterRowExcelMenu&&t.filterRowExcelMenu.column===e&&e.element.hasAttribute("aria-controls"))return void t.closeMenu();t._closeMenu(t.filterRowMenu),t.filterRowExcelMenu||(t.filterRowExcelMenu=document.createElement("div"),t.filterRowExcelMenu.classList.add("smart-grid-column-menu"),t.filterRowExcelMenu.setAttribute("theme",t.getAttribute("theme")),t.filterRowExcelMenu.id=t.id+"_"+t.tagName.toLowerCase()+"_menu_"+Math.floor(65536*(1+Math.random())).toString(16).substring(1)),t.appearance.allowColumnMenuAnimation?t.filterRowExcelMenu.classList.add("smart-animate"):t.filterRowExcelMenu.classList.remove("smart-animate"),t._createColumnFilterExcelMenuItems(e),t.filterRowExcelMenu.style.height=t.columnMenu.height?t.columnMenu.height+"px":"auto",t.filterRowExcelMenu.column&&t.filterRowExcelMenu.column!==e&&(t.filterRowExcelMenu.column.setProperty("menu",null),t.filterRowExcelMenu.column=null),t.isInShadowDOM?t.getRootNode().appendChild(t.filterRowExcelMenu):document.body.appendChild(t.filterRowExcelMenu),e.setProperty("filterRowExcelMenu",t.filterRowExcelMenu);const n=e.element.getBoundingClientRect();t.filterRowExcelMenu.column=e;let l=n.left+n.width-t.filterRowExcelMenu.offsetWidth+window.pageXOffset,i=n.bottom+t.layout.rowMinHeight+window.pageYOffset;return l+t.filterRowExcelMenu.offsetWidth>window.innerWidth&&(l=n.right+window.pageXOffset-t.filterRowExcelMenu.offsetWidth,l+t.filterRowExcelMenu.offsetWidth>window.innerWidth&&(l=window.innerWidth-t.filterRowExcelMenu.offsetWidth)),t.filterRowExcelMenu.style.left=l+"px",t.filterRowExcelMenu.style.top=i+"px",t.filterRowExcelMenu.classList.remove("smart-hidden"),t.filterRowExcelMenu.classList.add("open"),setTimeout((()=>{t.filterRowExcelMenu.querySelector("smart-menu").focus()}),50),t.filterRowExcelMenu}openContextMenu(e,t){const n=this;if(n.contextMenu.selector){const l=document.querySelector(n.contextMenu.selector);l&&setTimeout((()=>{l.open(e,t)}),100)}else n._closeMenu(n._contextMenu),n._contextMenu||(n._contextMenu=document.createElement("div"),n._contextMenu.classList.add("smart-grid-column-menu"),n._contextMenu.setAttribute("theme",n.getAttribute("theme")),n._contextMenu.id=n.id+"_"+n.tagName.toLowerCase()+"_menu_"+Math.floor(65536*(1+Math.random())).toString(16).substring(1),n.menu=n._contextMenu),n.appearance.allowColumnMenuAnimation?n._contextMenu.classList.add("smart-animate"):n._contextMenu.classList.remove("smart-animate"),n.rightToLeft?n._contextMenu.setAttribute("right-to-left",""):n._contextMenu.removeAttribute("right-to-left"),n.contextMenu.dataField?n._contextMenu.column=n.columnByDataField[n.contextMenu.dataField]:n._contextMenu.column=n.columns[0],n._createContextMenuItems(n._contextMenu),n._contextMenu.style.setProperty("--smart-grid-column-menu-width","auto"),n._contextMenu.style.height=n.contextMenu.height?n.contextMenu.height+"px":"auto",n._contextMenu.style.width=n.contextMenu.width?n.contextMenu.width+"px":"auto",n.isInShadowDOM?n.getRootNode().appendChild(n.menu):document.body.appendChild(n._contextMenu),n._contextMenu.style.left=e+10+"px",n._contextMenu.style.top=t+"px",t+n._contextMenu.offsetHeight>window.innerHeight&&(n._contextMenu.style.top=window.innerHeight-n._contextMenu.offsetHeight-10+"px"),n._contextMenu.classList.remove("smart-hidden"),n._contextMenu.classList.add("open"),setTimeout((()=>{n._contextMenu&&n._contextMenu.querySelector("smart-menu").focus()}),50)}_openMenu(e){const t=this;if(!e||t.menu&&t.menu.column===e&&e.element.hasAttribute("aria-controls")||!1===t.columnMenu.enabled)return void t.closeMenu();t._closeMenu(t.filterRowMenu),t._closeMenu(t.filterRowExcelMenu),t.$.headerBar&&t.header.visible&&t.$.headerBar.closePanel(),t.menu||(t.menu=document.createElement("div"),t.menu.classList.add("smart-grid-column-menu"),t.menu.setAttribute("theme",t.getAttribute("theme")),t.menu.id=t.id+"_"+t.tagName.toLowerCase()+"_menu_"+Math.floor(65536*(1+Math.random())).toString(16).substring(1)),t.appearance.allowColumnMenuAnimation?t.menu.classList.add("smart-animate"):t.menu.classList.remove("smart-animate"),t.rightToLeft?t.menu.setAttribute("right-to-left",""):t.menu.removeAttribute("right-to-left"),t._createMenuItems(e),t._createFilterPanel(e),t._filterMenuItemsVisibility(e),t.menu.style.height=t.columnMenu.height?t.columnMenu.height+"px":"auto",t.menu.column&&t.menu.column!==e&&(t.menu.column.setProperty("menu",null),t.menu.column=null),t.isInShadowDOM?t.getRootNode().appendChild(t.menu):document.body.appendChild(t.menu),e.setProperty("menu",t.menu);const n=e.element.getBoundingClientRect();t.menu.column=e;let l=n.right-e.element.actionButton.getBoundingClientRect().width+window.pageXOffset,i=n.bottom+window.pageYOffset;t.menu.classList.remove("smart-open-right"),t.rightToLeft&&(l=n.left+window.pageXOffset-t.menu.offsetWidth+e.element.actionButton.getBoundingClientRect().width,l<0&&(l=n.left+window.pageXOffset)),l+t.menu.offsetWidth>window.innerWidth&&(l=n.right+window.pageXOffset-t.menu.offsetWidth,l+t.menu.offsetWidth>window.innerWidth&&(l=window.innerWidth-t.menu.offsetWidth),t.menu.classList.add("smart-open-right")),t.menu.style.left=l+"px",t.menu.style.top=i+"px",t.hasColumnMenu(e)?(t.menu.classList.remove("smart-hidden"),t.menu.classList.add("open"),setTimeout((()=>{t.menu&&(t.menu.querySelector(".smart-filter-panel-input")?t.menu.querySelector(".smart-filter-panel-input").focus():t.menu.querySelector("smart-menu").focus())}),50)):t.closeMenu()}_menuItemClick(e){const t=this,n=e.detail.value;if(n&&n.properties){const e=n.properties.command;"function"==typeof e?e.apply(t,[n.column,n.properties]):t[e]&&t[e].apply(t,[n.column,n.properties]),n.column&&n.column.autoCloseMenu&&t.closeMenu()}}contextMenuItemChartCommand(){}contextMenuItemCutCommand(){const e=this,t=new KeyboardEvent("keydown",{bubbles:!0,cancelable:!0,composed:!0,pointerId:42,pointerType:"mouse",ctrlKey:!0,key:"X"});e._clipboardHandler("x",t),e.columnByDataField[e.contextMenu.dataField]||(e.selectRow(e.contextMenu.id),e._createCopyRects())}contextMenuItemCopyCommand(){const e=this,t=new KeyboardEvent("keydown",{bubbles:!0,cancelable:!0,composed:!0,pointerId:42,pointerType:"mouse",ctrlKey:!0,key:"C"});e._clipboardHandler("c",t),e.columnByDataField[e.contextMenu.dataField]||(e.selectRow(e.contextMenu.id),e._createCopyRects())}contextMenuItemPasteCommand(){const e=new KeyboardEvent("keydown",{bubbles:!0,cancelable:!0,composed:!0,pointerId:42,pointerType:"mouse",ctrlKey:!0,key:"V"});this._clipboardHandler("v",e)}contextMenuItemClearCommand(){const e=this;if(e._selection)if(e._selection.rows&&Object.keys(e._selection.rows).length>0){if(void 0!==e.contextMenu.id){const t=e.getSelectedRows();if(t.length>=1)return void t.map((e=>e[0])).forEach((t=>{requestAnimationFrame((()=>{e.updateRow(t,null,null,!0)}))}))}}else if(e._selection.cells&&Object.keys(e._selection.cells).length>0){const t=new KeyboardEvent("keydown",{bubbles:!0,cancelable:!0,composed:!0,pointerId:42,pointerType:"mouse",key:"Delete"});e.closeMenu(),e.$.dispatch(t)}}contextMenuItemInsertRowCommand(){const e=this;if(void 0!==e.contextMenu.id){const t=e.rowById[e.contextMenu.id];t&&requestAnimationFrame((()=>{e.insertRow({},1+t.visibleIndex)}))}}contextMenuItemSelectRowCommand(){const e=this;void 0!==e.contextMenu.id&&e.rowById[e.contextMenu.id]&&requestAnimationFrame((()=>{e.selectRow(e.contextMenu.id),e.$.headerBar&&(e.$.headerBar.refreshTools(),e.$.headerBar._refreshDeleteButton())}))}contextMenuItemCloneRowCommand(){const e=this;if(void 0!==e.contextMenu.id){const t=e.rowById[e.contextMenu.id];t&&requestAnimationFrame((()=>{e.insertRow(e.getRowData(e.contextMenu.id),1+t.visibleIndex),e._recycle(!1,!0)}))}}contextMenuItemAddCommentCommand(){const e=this;void 0!==e.contextMenu.id&&(e._focusCommentInput=!0,e._openRowSettingsDialog(e.contextMenu.id),setTimeout((()=>{delete e._focusCommentInput}),300))}contextMenuItemExpandCommand(){const e=this;void 0!==e.contextMenu.id&&e._openRowSettingsDialog(e.contextMenu.id)}contextMenuItemDeleteCommand(){const e=this;if(void 0!==e.contextMenu.id){const t=e.getSelectedRows();if(t.length>=1){const e=t.map((e=>e[0]));return void this.removeRow(e)}e.deleteRow(e.contextMenu.id)}}contextMenuItemEditCommand(){const e=this;void 0!==e.contextMenu.id&&e.editing.enabled&&("cell"===e.editing.mode?e.beginEdit(e.contextMenu.id,e.contextMenu.dataField):e.beginEdit(e.contextMenu.id))}removeGroupByCommand(e){this.removeGroup(e.dataField),this.autoSaveState()}groupByCommand(e){const t=this;t.dataSource&&(t.$.headerBar?t.header.visible&&t.header.buttons.indexOf("group")>=0&&t.$.headerBar.openGroupPanel(e):t.addGroup(e.dataField),t.autoSaveState())}sortAscCommand(e){this.sortBy(e.dataField,"asc"),this.autoSaveState()}sortDescCommand(e){this.sortBy(e.dataField,"desc"),this.autoSaveState()}removeSortCommand(e){this.sortBy(e.dataField,null),this.autoSaveState()}addSortCommand(e){const t=this;t.$.headerBar&&t.$.headerBar.openSortPanel(e)}addFilterCommand(e){const t=this;t.$.headerBar&&t.$.headerBar.openFilterPanel(e)}removeFilterCommand(e){this.removeFilter(e.dataField)}customizeTypeCommand(e){this._openAddColumnDialog(e,"rename")}hideColumnCommand(e){e.visible=!1,this.autoSaveState()}deleteColumnCommand(e){const t=this;t.columns.splice(t.columns.indexOf(e),1);for(let n=0;n<t.rows.length;n++)delete t.rows[n].data[e.dataField]}insertRightCommand(e){this._openAddColumnDialog(null,!1,null,e)}duplicateCommand(e,t,n){const l=this,i=new Smart.Grid.Column(e);delete i._state;let o=e.dataField,a=0;if(void 0===n){let t=!1;for(let n=0;n<l.rows.length;n++)if(l.rows[n].data[e.dataField]){t=!0;break}if(t)return void l._openDescriptionDialog(e,"duplicate")}for(let e=0;e<l.columns.length;e++)l.columns[e].dataField.indexOf(o)>=0&&a++;if(i.displayField=i.dataField=e.dataField+"_"+a,"object"==typeof e.editor){const t={};for(let n in e.editor)"instance"!==n&&"cell"!==n&&"column"!==n&&"row"!==n&&"isInitialized"!==n&&(t[n]=e.editor[n]);i.editor=JSON.parse(JSON.stringify(t))}const r=l.columns.indexOf(e);if(n)for(let t=0;t<l.rows.length;t++){const n=l.rows[t],o=n.data[e.dataField];n.data[i.dataField]=o}i.label=e.label+` ${l.localize("copy")} `+a,l.columns.splice(1+r,0,i),l.onColumnClone&&setTimeout((()=>{l.onColumnClone(e.dataField,i.dataField,1+r,n)}),100)}_removeMenu(){const e=this;if(e.menu){const t=e.menu.querySelector("smart-menu");t&&e.menu.removeChild(t)}if(e.filterRowMenu){const t=e.filterRowMenu.querySelector("smart-menu");t&&e.filterRowMenu.removeChild(t)}if(e.filterRowExcelMenu){const t=e.filterRowExcelMenu.querySelector("smart-menu");t&&e.filterRowExcelMenu.removeChild(t)}if(e._contextMenu){const t=e._contextMenu.querySelector("smart-menu");t&&(e._contextMenu.removeChild(t),e._contextMenu.parentNode.removeChild(e._contextMenu))}}_createColumnChooserMenuItems(e){const t=this;t._removeMenu();const n=document.createElement("smart-menu"),l=document.createDocumentFragment();if(n.mode="vertical",n.dropDownAppendTo="body",n.checkboxes=!0,n.checkable=!0,n.classList.add("smart-grid-column-chooser-menu"),n.rightToLeft=t.rightToLeft,e&&"_addNewColumn"===e.dataField){if(t._kanbanViewColumns&&t._kanbanViewColumns.length>0)for(let e=0;e<t._kanbanViewColumns.length;e++){const n=t._kanbanViewColumns[e],i=t.columnByDataField[n.dataField];if(i&&i.visible)continue;const o=document.createElement("smart-menu-item"),a=n.showIcon?n.icon:n.visible?"smart-icon-eye":"smart-icon-eye-off";o.checked=n.visible,n.allowHide&&(n.command=function(e){t.closeMenu();const n=t.columnByDataField[e.dataField];n.visible=!0,delete n._visible;const l=t._kanbanViewColumns.indexOf(e);l>=0&&t._kanbanViewColumns.splice(l,1)},o.label=t.localize(n.label)||n.label||n.dataField,o.value={column:n,properties:n},a&&(o.label='<span class="smart-grid-icon '+a+'"></span>'+o.label),l.appendChild(o))}const e=document.createElement("smart-menu-item");e.label='<span class="smart-grid-icon smart-icon-plus"></span>'+t.localize("dialogNewColumn"),e.value={properties:{command:()=>{t.closeMenu(),t._openAddColumnDialog()}}},l.appendChild(e)}else for(let e=0;e<t.columns.length;e++){const n=t.columns[e],i=document.createElement("smart-menu-item"),o=n.showIcon?n.icon:n.visible?"smart-icon-eye":"smart-icon-eye-off";i.checked=n.visible,n.allowHide&&(n.command=function(e){e.visible=!e.visible},i.label=t.localize(n.label)||n.label||n.dataField,i.value={column:n,properties:n},o&&(i.label='<span class="smart-grid-icon '+o+'"></span>'+i.label),l.appendChild(i))}n.appendChild(l),t.menu.appendChild(n),t.menu.itemCheckChange=t._menuItemClick.bind(t),t.menu.addEventListener("itemCheckChange",t.menu.itemCheckChange),t.menu.addEventListener("keydown",t._keyDownHandler.bind(t))}_createFilterListBox(e){const t=this,n=t.columnByDataField[e];if(!n)return null;let l=t.getExcelFilterDataSource(n.dataField);const i=document.createElement("smart-list-box");return i.style.setProperty("--smart-list-item-height","24px"),i.id=t.id+"_"+t.tagName.toLowerCase()+"_filter_listbox_"+Math.floor(65536*(1+Math.random())).toString(16).substring(1),i.checkboxes=!0,i.animation="none",i.selectionMode="checkBox",i.dataSource=l,i.displayMember="label",i.valueMember="value",i.style.width="100%",i.filterable=!0,i.autoHeight=!0,i.selectAll=!0,i.rightToLeft=t.rightToLeft,i.theme=t.theme,i.locale=t.locale,i.style.height="200px",i.whenRendered((()=>{if(n.filterEditor&&n.filterEditor.values&&(n._filterInfo||(n._filterInfo={}),n._filterInfo.excelValues=n.filterEditor.values),n._filterInfo&&n._filterInfo.excelValues&&Array.isArray(n._filterInfo.excelValues)){i.clearSelection();let e=[];for(let t=0;t<n._filterInfo.excelValues.length;t++){const l=n._filterInfo.excelValues[t];e.push(l)}i.checkAll(e)}else i.checkAll();setTimeout((()=>{i.focusFilter()}),200)})),i}_createColumnFilterExcelMenuItems(e){const t=this;t._removeMenu();const n=document.createElement("smart-menu"),l=document.createDocumentFragment();n.mode="vertical",n.dropDownAppendTo="body",n.classList.add("smart-grid-column-filter-menu","filter-excel"),n.rightToLeft=t.rightToLeft,n.animation="none",n.preventHover=!0,n.style.setProperty("--smart-list-item-height","27px");const i=document.createElement("smart-menu-item");i.style.paddingLeft=i.style.paddingRight=i.style.paddingTop=i.style.paddingBottom="0px";const o=t._createFilterListBox(e.dataField),a=document.createElement("div");a.classList.add("smart-flex"),a.style.flexDirection="column",a.style.padding="5px",a.appendChild(o);const r=document.createElement("div");r.classList.add("smart-flex"),r.style.marginTop="10px",r.style.marginLeft="5px";const s=document.createElement("smart-button");s.innerHTML=t.localize("filter"),s.classList.add("primary");const m=document.createElement("smart-button");m.innerHTML=t.localize("clear"),m.style.marginLeft="10px",r.appendChild(s),r.appendChild(m),a.appendChild(r),i.appendChild(a),l.appendChild(i),m.onclick=function(){o.clearSelection(),o.checkAll(),e._filterInfo.excelValues=null,t.removeFilter(e.dataField);const n=t.getFilterRowFilter(e.dataField);n&&t.addFilter(e.dataField,n),t.closeMenu()},s.onclick=function(){const n=o.getSelectedValues();if(e._filterInfo.excelValues=n,n.length===o.getItems().length){e._filterInfo.excelValues=null;const n=t.getFilterRowFilter(e.dataField);return n?t.addFilter(e.dataField,n):t.removeFilter(e.dataField),void t.closeMenu()}const l=t.getExcelFilter(e.dataField,n),i=t.getFilterRowFilter(e.dataField);i&&l.addFilter("and",i),t.addFilter(e.dataField,l),t.closeMenu()},n.appendChild(l),t.filterRowExcelMenu.appendChild(n),t.filterRowExcelMenu.itemClick=t._menuItemClick.bind(t),t.filterRowExcelMenu.classList.add("smart-open-right"),t.filterRowExcelMenu.addEventListener("itemClick",t.filterRowExcelMenu.itemClick),t.filterRowExcelMenu.addEventListener("keydown",(e=>{"Escape"===e.key&&t._closeMenu(t.filterRowExcelMenu)}))}_createColumnFilterMenuItems(e){const t=this;t._removeMenu();const n=document.createElement("smart-menu"),l=document.createDocumentFragment();n.mode="vertical",n.dropDownAppendTo="body",n.classList.add("smart-grid-column-filter-menu"),n.rightToLeft=t.rightToLeft;const i=e._filterInfo.dataSource;for(let t=0;t<i.length;t++){const n=i[t],o=document.createElement("smart-menu-item"),a=n.icon;o.label=n.label,o.value={column:e,properties:n},a&&(o.label='<span class="smart-grid-icon '+a+'"></span>'+o.label),e._filterInfo.condition===n.value&&o.setAttribute("focus",""),l.appendChild(o)}n.appendChild(l),t.filterRowMenu.appendChild(n),t.filterRowMenu.itemClick=t._menuItemClick.bind(t),t.filterRowMenu.addEventListener("itemClick",t.filterRowMenu.itemClick),t.filterRowMenu.addEventListener("keydown",(e=>{"Escape"===e.key&&t._closeMenu(t.filterRowMenu)}))}_createMenuItems(e){const t=this;t._removeMenu();const n=document.createElement("smart-menu"),l=document.createDocumentFragment(),i=e.menuItems||t.columnMenu.dataSource;n.mode="vertical",n.dropDownAppendTo="body",n.rightToLeft=t.rightToLeft;for(let n in i){const o=i[n],a=document.createElement("smart-menu-item");let r=o.icon;a.label=t.localize(n),a.value={column:e,properties:o};const s=t=>{if(t){if("string"===e.dataType)return"A → Z";if("number"===e.dataType||"date"===e.dataType||"time"===e.dataType)return"1 → 9";if("bool"===e.dataType||"boolean"===e.dataType)return"0 → 1"}else{if("string"===e.dataType)return"Z → A";if("number"===e.dataType||"date"===e.dataType||"time"===e.dataType)return"9 → 1";if("bool"===e.dataType||"boolean"===e.dataType)return"1 → 0"}};"columnMenuItemSortAsc"===n?(a.label=t.localize(n,{mode:s(!0)}),"string"!==e.dataType&&o.iconAlt&&(r=o.iconAlt)):"columnMenuItemSortDesc"===n&&(a.label=t.localize(n,{mode:s(!1)}),"string"!==e.dataType&&o.iconAlt&&(r=o.iconAlt)),r&&(a.label='<span class="smart-grid-icon '+r+'"></span>'+a.label),l.appendChild(a)}n.appendChild(l),t._filterContainer?t.menu.insertBefore(n,t._filterContainer):t.menu.appendChild(n),t.menu.itemClick=t._menuItemClick.bind(t),t.menu.addEventListener("itemClick",t.menu.itemClick),t.menu.addEventListener("keydown",t._keyDownHandler.bind(t))}_createContextMenuItems(){const e=this;e._removeMenu();const t=document.createElement("smart-menu"),n=document.createDocumentFragment();let l=e.contextMenu.dataSource;t.mode="vertical",t.dropDownAppendTo="body",t.rightToLeft=e.rightToLeft;const i=e._selection&&e._selection.cells&&Object.keys(e._selection.cells).length>2,o=e._getSelectedRows(!0,!1);if(i){let t={};t.contextMenuItemCut=l.contextMenuItemCut,t.contextMenuItemCopy=l.contextMenuItemCopy,t.contextMenuItemPaste=l.contextMenuItemPaste,t.contextMenuItemClear=l.contextMenuItemClear,e.charting.enabled&&(t.contextMenuItemChart=l.contextMenuItemChart),l=t}else if(o.length>1){let t={};t.contextMenuItemCut=l.contextMenuItemCut,t.contextMenuItemCopy=l.contextMenuItemCopy,t.contextMenuItemPaste=l.contextMenuItemPaste,t.contextMenuItemClear=l.contextMenuItemClear,t.contextMenuItemDelete=l.contextMenuItemDelete,e.charting.enabled&&(t.contextMenuItemChart=l.contextMenuItemChart),l=t}if(null!==e.contextMenu.id&&e._newRow&&e._newRow.id===e.contextMenu.id){const t=function(t,n){const l=n.value;requestAnimationFrame((()=>{const t=[];for(let e=0;e<l;e++)t.push({});e.rows.push(t),e._recycle(!1),e.$.verticalScrollBar.value=e.$.verticalScrollBar.max}))},l=[{label:e.localize("contextMenuItemAddRow",{value:5}),value:5,command:t},{label:e.localize("contextMenuItemAddRow",{value:10}),value:10,command:t},{label:e.localize("contextMenuItemAddRow",{value:20}),value:20,command:t}];for(let e in l){const t=l[e],i=document.createElement("smart-menu-item");i.value={properties:t},i.label=t.label,n.appendChild(i)}}else for(let i in l){const o=l[i];let a=document.createElement("smart-menu-item"),r=o.icon;!0===o.visible?a.classList.remove("smart-hidden"):!1===o.visible&&a.classList.add("smart-hidden"),"contextMenuItemEdit"===i?(e.editing.enabled||(a.disabled=!0),"{{messages}}"===o.label?"cell"===e.editing.mode?a.label=e.localize("contextMenuItemEditCell"):a.label=e.localize("contextMenuItemEditRow"):a.label=o.label):"contextMenuItemClear"===i?(e.editing.enabled||(a.disabled=!0),"{{messages}}"===o.label?a.label=e.localize("clearContents"):a.label=o.label):"contextMenuItemCut"===i?(e.editing.enabled||(a.disabled=!0),"{{messages}}"===o.label?a.label=e.localize("cut").substring(0,1).toUpperCase()+e.localize("cut").substring(1):a.label=o.label):"contextMenuItemCopy"===i?(e.editing.enabled||(a.disabled=!0),"{{messages}}"===o.label?a.label=e.localize("copy").substring(0,1).toUpperCase()+e.localize("copy").substring(1):a.label=o.label):"contextMenuItemPaste"===i?(e.editing.enabled||(a.disabled=!0),"{{messages}}"===o.label?a.label=e.localize("paste"):a.label=o.label):"contextMenuItemExpand"===i?(e.editing.enabled||(a.disabled=!0),"{{messages}}"===o.label?a.label=e.localize("expandRecord"):a.label=o.label):"contextMenuItemCloneRow"===i?(e.editing.enabled||(a.disabled=!0),"{{messages}}"===o.label?a.label=e.localize("contextMenuItemCloneRow"):a.label=o.label):"contextMenuItemSelectRow"===i?(e.editing.enabled||(a.disabled=!0),"{{messages}}"===o.label?a.label=e.localize("contextMenuItemSelectRow"):a.label=o.label):"contextMenuItemComment"===i?(e.editing.enabled||(a.disabled=!0),"{{messages}}"===o.label?a.label=e.localize("commentPlaceholder"):a.label=o.label):"contextMenuItemChart"===i?(t.selectionMode="mouseenter",t.preventCloseOnCheck=!0,e.charting.enabled||(a.disabled=!0),a=document.createElement("smart-menu-items-group"),a.label=e.localize("contextMenuItemChart"),a.innerHTML='\n <smart-menu-items-group>\n Column\n <smart-menu-item type="column">Column</smart-menu-item>\n <smart-menu-item type="stackedcolumn">Stacked Column</smart-menu-item>\n <smart-menu-item type="stackedcolumn100">100% Stacked Column</smart-menu-item>\n </smart-menu-items-group>\n <smart-menu-items-group>Bar\n <smart-menu-item type="bar">Bar</smart-menu-item>\n <smart-menu-item type="stackedbar">Stacked Bar</smart-menu-item>\n <smart-menu-item type="stackedbar100" >100% Stacked Bar</smart-menu-item>\n </smart-menu-items-group>\n <smart-menu-items-group>Line\n <smart-menu-item type="line">Line</smart-menu-item>\n <smart-menu-item type="stackedline">Stacked Line</smart-menu-item>\n <smart-menu-item type="stackedline100">100% Stacked Line</smart-menu-item>\n </smart-menu-items-group>\n <smart-menu-items-group>Area\n <smart-menu-item type="area">Area</smart-menu-item>\n <smart-menu-item type="stackedarea">Stacked Area</smart-menu-item>\n <smart-menu-item type="stackedarea100">100% Stacked Area</smart-menu-item>\n </smart-menu-items-group>\n <smart-menu-items-group>Pie\n <smart-menu-item type="pie">Pie</smart-menu-item>\n <smart-menu-item type="donut">Donut</smart-menu-item>\n </smart-menu-items-group>\n <smart-menu-items-group>Scatter\n <smart-menu-item type="scatter">Scatter</smart-menu-item>\n <smart-menu-item type="bubble">Bubble</smart-menu-item>\n </smart-menu-items-group>\n <smart-menu-items-group>Funnel\n <smart-menu-item type="funnel">Funnel</smart-menu-item>\n <smart-menu-item type="pyramid">Pyramid</smart-menu-item>\n </smart-menu-items-group>\n ',a.querySelectorAll("smart-menu-item").forEach((n=>{const l=n.getAttribute("type");n.onpointerdown=n=>{n.stopPropagation(),n.preventDefault(),t.close(),e._closeMenu(e._contextMenu),e.createChart(l)},n.value={properties:{command:()=>{e.createChart(l)}}}}))):"{{messages}}"===o.label?a.label=e.localize(i):a.label=o.label,a.value={properties:o},r&&(a.label='<span class="smart-grid-icon '+r+'"></span>'+a.label),n.appendChild(a)}if(e.contextMenu.customContextMenuItems)for(let t in e.contextMenu.customContextMenuItems){const l=e.contextMenu.customContextMenuItems[t],i=document.createElement("smart-menu-item");let o=l.icon;!0===l.visible?i.classList.remove("smart-hidden"):!1===l.visible&&i.classList.add("smart-hidden"),i.label=l.label,i.value={properties:l},o&&(i.label='<span class="smart-grid-icon '+o+'"></span>'+i.label),n.appendChild(i)}[...n.querySelectorAll("smart-menu-item")].forEach((e=>{e.style.marginBottom=e.style.marginTop="0px"})),[...n.querySelectorAll("smart-menu-items-group")].forEach((e=>{e.style.marginBottom=e.style.marginTop="0px"})),t.appendChild(n),e._contextMenu.appendChild(t),""!==t.textContent||0!==t.children.length?(e._contextMenu.itemClick=t=>{t.detail.value||(t.detail.value={properties:{command:null}}),t.detail.value.column=t.detail.item.column=e._contextMenu.column;const n=t.detail.value.column;e._menuItemClick(t),e._closeMenu(e._contextMenu),e.$.fireEvent("contextMenuItemClick",{id:e._contextMenu.id,dataField:n?n.dataField:null,command:t.detail.value.properties.command})},e._contextMenu.style.minHeight="30px",e._contextMenu.addEventListener("itemClick",e._contextMenu.itemClick),e._contextMenu.addEventListener("keydown",e._keyDownHandler.bind(e))):e._removeMenu()}_getFilterType(e){const t=this;let n="string";switch(e.dataType.endsWith("?")?e.dataType.substring(0,e.dataType.length-1):e.dataType){case"number":case"int":case"float":case"int64":n="numeric";break;case"bool":case"boolean":n="bool";break;case"date":case"time":case"datetime":n="date";break;case"any":n="string"}return e.displayField!==e.dataField&&(n=t._getFilterDataType(e)),n}_createFilterPanel(e){const t=this;if(Smart.FilterPanel)if(t.filtering.enabled&&t.filtering.filterMenu.visible&&e.allowFilter&&!t.filtering.filterRow.visible&&(!t.header.visible||t.header.visible&&-1===t.header.buttons.indexOf("filter"))){const n=t._getFilterType(e);if(t._filterPanel&&t._filterPanel.parentNode&&t._filterPanel.parentNode.removeChild(t._filterPanel),t._filterPanel=t._filterPanels[n],!t._filterPanel){const e=document.createElement("smart-filter-panel");e.filterType=n,t._filterPanels[n]=e,t._filterPanel=e}t._filterPanel.dataField=e.dataField,t._filterPanel.rightToLeft=t.rightToLeft,t.filtering.filterMenu.messages?t._filterPanel.messages=t.filtering.filterMenu.messages:t._filterPanel.messages=t.messages,"excel"!==e.filterMenuMode&&"multi"!==e.filterMenuMode||(t._filterPanel.dataField=e.dataField,t._filterPanel._createFilterListBox=t._createFilterListBox.bind(t),t._filterPanel.getExcelFilter=t.getExcelFilter.bind(t),t.dataSource&&t.dataSource.boundSource&&(t._filterPanel.data=t.dataSource.boundSource.toArray?t.dataSource.boundSource.toArray():t.dataSource.boundSource)),e.filterEditor&&e.filterEditor.dataSource&&(t._filterPanel.data=[...e.filterEditor.dataSource]),t._filterPanel.mode=e.filterMenuMode,t._filterPanel.locale=t.locale;const l=t._filterPanel.querySelectorAll(".smart-filter-panel-input");for(let e=0;e<l.length;e++)l[e].onkeydown=e=>{"Enter"===e.key&&t._filterPanel.filter()};if(!t._filterContainer){const e=document.createElement("div");e.classList.add("smart-filter-container"),t._filterContainer=e,requestAnimationFrame((function(){t.menu.appendChild(e)})),t._applyFilterHandler=function(){t.addFilter(t._filterPanel.dataField,t._filterPanel.getFilter()),t.columnByDataField[t._filterPanel.dataField]._filterState=t._filterPanel.getState(),t.autoSaveState()},t._clearFilterHandler=function(){requestAnimationFrame((()=>{t.removeFilter(t._filterPanel.dataField),t.columnByDataField[t._filterPanel.dataField]._filterState=null,t.autoSaveState()}))}}t._filterContainer.appendChild(t._filterPanel),t._filterPanel.classList.remove("smart-hidden"),t._filterPanel.removeEventListener("filter",t._applyFilterHandler),t._filterPanel.removeEventListener("clear",t._clearFilterHandler),t._filterPanel.addEventListener("filter",t._applyFilterHandler),t._filterPanel.addEventListener("clear",t._clearFilterHandler);const i=t._filterContainer.querySelector(".smart-grid-custom-filter-panel");if(i&&t._filterContainer.removeChild(i),"none"!==e.filterMenuMode&&t.filtering.filterMenu.visible&&Smart.FilterPanel?t._filterContainer.classList.remove("smart-hidden"):t._filterContainer.classList.add("smart-hidden"),e.getFilterPanel)if(e._customFilterPanel)e.updateFilterPanel(e._customFilterPanel,e),t._filterContainer.removeChild(t._filterPanel),t._filterContainer.appendChild(e._customFilterPanel);else{const n=e.getFilterPanel(e);n&&(n.classList.add("smart-grid-custom-filter-panel"),e._customFilterPanel=n,t._filterContainer.removeChild(t._filterPanel),t._filterContainer.appendChild(n))}if(t._filterPanel.reset(),e.filterEditor&&!e.filter&&e.filterEditor.condition){const n=new Smart.FilterGroup,l=t._getFilterType(e),i=n.getConditions(l),o=e.filterEditor.condition?i.indexOf(e.filterEditor.condition.toUpperCase()):-1,a=e.filterEditor.condition2?i.indexOf(e.filterEditor.condition2.toUpperCase()):-1,r=e.filterEditor.value||"",s=e.filterEditor.value2||"",m=e.filterEditor.logicalOperator?["and","or"].indexOf(e.filterEditor.logicalOperator):0;e._filterState={firstFilterComparison:o,firstFilterValue:r,logicalOperator:m,secondFilterComparison:a,secondFilterValue:s},t._filterPanel.loadState(e._filterState)}if(e._filterState)t._filterPanel.loadState(e._filterState);else if(e.filter){const n=e.filter,l=t._getFilterType(e);let i=n.getFilters();for(;i.length>0&&"FilterGroup"===i[0].type;)i=i[0].value;const o=n.getConditions(l),a=i.length>0?o.indexOf(i[0].condition):-1,r=i.length>1?o.indexOf(i[1].condition):-1,s=i.length>0?i[0].value:"",m=i.length>1?i[1].value:"",u=i.length>1?["and","or"].indexOf(i[1].logicalOperator):0;"excel"===e.filterMenuMode?(e._filterState={filters:i},t._filterPanel.loadState(e._filterState)):"multi"===e.filterMenuMode?(e._filterState={filters:i,firstFilterValue:"",secondFilterValue:"",firstFilterComparison:a},t._filterPanel.loadState(e._filterState)):(e._filterState={firstFilterComparison:a,firstFilterValue:s,logicalOperator:u,secondFilterComparison:r,secondFilterValue:m},t._filterPanel.loadState(e._filterState))}}else t._filterPanel&&(t._filterPanel.parentNode&&t._filterPanel.parentNode.removeChild(t._filterPanel),e._filterState=null)}hasColumnMenu(e){const t=this;if(!1===t.columnMenu.enabled)return!1;const n=e.menuItems||t.columnMenu.dataSource;let l=0,i=0;for(let o in n){const a=n[o];if(i++,!1===a.visible)l++;else if("auto"===a.visible){if(("columnMenuItemFilter"===o||"columnMenuItemRemoveFilter"===o)&&(t.filtering.filterMenu.visible||t.filtering.filterRow.visible)&&(!t.header.visible||t.header.visible&&-1===t.header.buttons.indexOf("filter"))){l++;continue}if(!("columnMenuItemGroupBy"!==o&&"columnMenuItemRemoveGroupBy"!==o||e.allowGroup&&t.grouping.enabled)){l++;continue}if(!("columnMenuItemSort"!==o||e.allowSort&&t.sorting.enabled)){l++;continue}if(!("columnMenuItemFilter"!==o||e.allowFilter&&t.filtering.enabled)){l++;continue}if(!("columnMenuItemRemoveFilter"!==o||e.allowFilter&&t.filtering.enabled)){l++;continue}if("columnMenuItemGroupBy"===o&&!e.allowGroup){l++;continue}if(!("columnMenuItemSortAsc"!==o&&"columnMenuItemSortDesc"!==o&&"columnMenuItemRemoveSort"!==o||e.allowSort&&t.sorting.enabled)){l++;continue}}}return!(!(t.filtering.enabled&&t.filtering.filterMenu.visible&&!t.filtering.filterRow.visible&&"none"!==e.filterMenuMode&&Smart.FilterPanel||Smart.Menu&&!(l>=i))||l>=i)}_filterMenuItemsVisibility(e){const t=this,n=(t.menu.parentElement&&(t.enableShadowDOM||t.isInShadowDOM)?t.menu.firstElementChild.shadowRoot:t.menu).querySelectorAll("smart-menu-item"),l=e.menuItems||t.columnMenu.dataSource;let i=0;for(let o in l){const a=n[i++],r=l[o];if(a.disabled=!r.enabled,a.classList.remove("smart-hidden"),"columnMenuItemDelete"!==o||e.allowDelete)if("columnMenuItemHide"!==o||e.allowHide){if("columnMenuItemRemoveSort"===o&&(e.sortOrder?a.disabled=!1:a.disabled=!0),("columnMenuItemSortAsc"===o&&"asc"===e.sortOrder||"columnMenuItemSortDesc"===o&&"desc"===e.sortOrder)&&(a.disabled=!0),!0===r.visible)a.classList.remove("smart-hidden");else if(!1===r.visible)a.classList.add("smart-hidden");else if("auto"===r.visible){if("columnMenuItemFilter"!==o&&"columnMenuItemRemoveFilter"!==o||(!1===t.filtering.enabled?a.classList.add("smart-hidden"):((t.filtering.filterMenu.visible||t.filtering.filterRow.visible)&&a.classList.add("smart-hidden"),t.header.visible&&t.header.buttons.indexOf("filter")>=0?a.classList.remove("smart-hidden"):"columnMenuItemFilter"===o&&a.classList.add("smart-hidden"),e.filtered||"columnMenuItemRemoveFilter"!==o||a.classList.add("smart-hidden"))),"columnMenuItemSort"===o&&(!1===t.sorting.enabled?a.classList.add("smart-hidden"):(a.classList.add("smart-hidden"),t.header.visible&&t.header.buttons.indexOf("sort")>=0&&a.classList.remove("smart-hidden"))),"columnMenuItemGroupBy"===o){t.grouping.enabled&&e.allowGroup?a.classList.remove("smart-hidden"):a.classList.add("smart-hidden");const n=t.dataSource.groupBy.indexOf(e.dataField);a.disabled=n>=0}if("columnMenuItemRemoveGroupBy"===o){t.grouping.enabled&&e.allowGroup?a.classList.remove("smart-hidden"):a.classList.add("smart-hidden"),t.header.visible&&t.header.buttons.indexOf("group")>=0&&a.classList.add("smart-hidden");const n=t.dataSource.groupBy.indexOf(e.dataField);a.disabled=n<0}"columnMenuItemFilter"!==o||e.allowFilter||a.classList.add("smart-hidden"),"columnMenuItemSort"!==o||e.allowSort||a.classList.add("smart-hidden"),"columnMenuItemRemoveFilter"!==o||e.allowFilter||a.classList.add("smart-hidden"),"columnMenuItemSortAsc"!==o&&"columnMenuItemSortDesc"!==o&&"columnMenuItemRemoveSort"!==o||(e.allowSort&&t.sorting.enabled?a.classList.remove("smart-hidden"):a.classList.add("smart-hidden"),t.header.visible&&t.header.buttons.indexOf("sort")>=0&&a.classList.add("smart-hidden"))}}else a.classList.add("smart-hidden");else a.classList.add("smart-hidden")}}openMenu(e){const t=this.columnByDataField[e];t&&this._openMenu(t)}hasMenu(){const e=this;return!!(e.menu&&e.menu.column&&e.menu.parentNode)}_closeMenu(e){const t=this;(e=>{if(e){e.column&&(e.column.setProperty("menu",null),e.column=null);let n=e.classList.contains("open");if(e.parentNode&&(e.classList.remove("open"),t.appearance.allowColumnMenuAnimation||e.parentNode.removeChild(e)),e.removeEventListener("keydown",t._keyDownHandler.bind(t)),e.removeEventListener("itemClick",e.itemClick),e.removeEventListener("itemCheckChange",e.itemCheckChange),t._filterRowInputOnFocus)return;if(!n)return;t.focus()}})(e)}closeMenu(){const e=this,t=e.menu;if(e._closeMenu(t),e._closeMenu(e.filterRowMenu),e._closeMenu(e.filterRowExcelMenu),e._closeMenu(e._contextMenu),e._filterPanel){const t=e._filterPanel.querySelectorAll("smart-drop-down-list");for(let e=0;e<t.length;e++){const n=t[e];n.opened&&n.close()}}}});
1492
1492
 
1493
1493
  /***/ }),
1494
1494
 
@@ -1523,7 +1523,7 @@ Smart.Utilities.Assign("Grid.Row",class{constructor(e){const t=this;if(e||(e={})
1523
1523
  /***/ 8469:
1524
1524
  /***/ (() => {
1525
1525
 
1526
- Smart.Utilities.Assign("Grid.Select",class{_refreshSelection(){const e=this;if(e.selection.enabled&&(e._selectionColumn.refresh(),!e._isVirtualMode()&&e._selection&&e._selection.rows))for(let t in e._selection.rows)e.rowById[t]||delete e._selection.rows[t];e._refreshCellSelectionRect()}_toggleColumnSelection(e){const t=this;if(!t.selection.enabled||"none"===t.selection.checkBoxes.selectAllMode)return void(t._inputOverlay&&t._inputOverlay.parentNode&&t._inputOverlay.parentNode.removeChild(t._inputOverlay));let l=e.element.getAttribute("selected");l="indeterminate"===l||""!==l;let n=t._recyclingRows;if(t._selectionColumn._selecting=!0,t.beginUpdate(),t.paging.enabled&&"page"===t.selection.checkBoxes.selectAllMode){let e=t.paging.pageIndex*t.paging.pageSize,l=(t.paging.pageIndex+1)*t.paging.pageSize;for(let n=e;n<l;n++)delete t._selection.indexes[n]}else t._selection.indexes=[];if(t.paging.enabled&&"all"===t.selection.checkBoxes.selectAllMode){let e=t.getVisibleRows();for(let t=0;t<e.length;t++)e[t].selected=l}else for(let e=0;e<n.length;e++)n[e].selected=l;if(t._selectionColumn._selecting=!1,t.endUpdate(!1),t._isVirtualMode())if(l)for(let e=0;e<t.dataSource.virtualDataSourceLength;e++){if(t.paging.enabled&&"page"===t.selection.checkBoxes.selectAllMode){let l=t.paging.pageIndex*t.paging.pageSize,n=(t.paging.pageIndex+1)*t.paging.pageSize;if(e<l||e>=n)continue}l&&(t._selection.indexes[e]=e,t._selection.rows[e]=e)}else{let e=!0;t.paging.enabled&&"page"===t.selection.checkBoxes.selectAllMode&&(e=!1),e&&(t._selection.indexes=[],t._selection.rows=[])}if(t._recycle(!1),t.$.fireEvent("change",{started:!1,finished:!0}),t.selection.enabled&&t.selection.checkBoxes.enabled&&"none"!==t.selection.checkBoxes.selectAllMode){const l=e.element,n=l.querySelector(".smart-input");t._inputOverlay?t._inputOverlay.parentNode!==t.$.columnHeader&&(t._inputOverlay.parentNode&&t._inputOverlay.parentNode.removeChild(t._inputOverlay),t._inputOverlay=document.createElement("div"),t.$.columnHeader.appendChild(t._inputOverlay)):(t._inputOverlay=document.createElement("div"),t.$.columnHeader.appendChild(t._inputOverlay)),t._inputOverlay.column=e,t._inputOverlay.onpointerdown=function(){t._inputOverlay||(t._inputOverlay.onpointerdown=null);const e=t._inputOverlay.column;t._inputOverlay.classList.remove("smart-animate"),t._selectionColumn._selecting=!0,t.beginUpdate();let l=e.element.hasAttribute("selected"),n=t._recyclingRows;t.paging.enabled&&"all"===t.selection.checkBoxes.selectAllMode&&(n=t.getVisibleRows());for(let e=0;e<n.length;e++)n[e].selected=!l;t._selectionColumn._selecting=!1;const o=t._inputOverlay;if(t.endUpdate(!1),t._isVirtualMode())if(l)t._selection.indexes=[],t._selection.rows=[];else for(let e=0;e<t.dataSource.virtualDataSourceLength;e++){if(t.paging.enabled&&"page"===t.selection.checkBoxes.selectAllMode){let l=t.paging.pageIndex*t.paging.pageSize,n=(t.paging.pageIndex+1)*t.paging.pageSize;if(e<l||e>=n)continue}t._selection.indexes[e]=e,t._selection.rows[e]=e}return t._recycle(),t.$.fireEvent("change",{started:!1,finished:!0}),t.$.fireEvent("columnClick",{column:e,dataField:e.dataField}),t.$.columnHeader.appendChild(o),t._inputOverlay=o,t._inputOverlay.classList.add("smart-animate"),!1},t._inputOverlay.classList.add("smart-input-overlay"),t._inputOverlay.classList.add("smart-input-overlay-column"),t.appearance.allowCheckBoxesSelectionAnimation&&t._inputOverlay.classList.add("smart-animate"),t._inputOverlay.style.top=(l.offsetHeight-n.offsetHeight)/4+1+"px";const o=t._selectionColumn.element.parentElement.offsetLeft+t._selectionColumn.element.offsetLeft;t.rightToLeft?t._inputOverlay.style.right=o+"px":t._inputOverlay.style.left=o+"px",t._inputOverlay.style.height=l.offsetWidth+"px",t._inputOverlay.style.width=l.offsetWidth+"px",t._inputOverlay.onmousedown=null,t._inputOverlay.classList.add("smart-input-overlay-on"),t._selectionColumn.refresh()}}_refreshCheckBoxColumnSelection(){const e=this;if(e.selection.enabled&&e.selection.checkBoxes.enabled){const t=e._selectionColumn.element;t&&("none"===e.selection.checkBoxes.selectAllMode?(t.removeAttribute("checkbox"),t.label.classList.remove("smart-input")):(t.setAttribute("checkbox",""),t.label.classList.add("smart-input"))),e._selectionColumn.refresh()}}_handleExtendedRowSelection(e,t){const l=this;if(!e)return;let n=l._recyclingRows;if(l.paging.enabled&&"page"===l.selection.selectAllMode&&(n=n.slice(l.paging.pageIndex*l.paging.pageSize,(l.paging.pageIndex+1)*l.paging.pageSize)),!t||t.ctrlKey||t.metaKey||(l._selection.rows=[],l._selection.indexes=[]),t&&!t.shiftKey&&(l._rangeSelectionStartRow=e,l._rangeSelectionEndRow=e),t&&t.shiftKey){l._rangeSelectionEndRow=e;const t=n.indexOf(l._rangeSelectionStartRow),o=n.indexOf(l._rangeSelectionEndRow),i=Math.min(t,o),a=Math.max(t,o);if(-1===t||-1===o)return;for(let e=i;e<=a;e++){const t=n[e];t.allowSelect&&t.setProperty("selected",!0)}}else!1!==e.allowSelect&&(t&&(t.ctrlKey||t.metaKey)?null===e.selected?e.setProperty("selected",!0):e.setProperty("selected",!e.selected):e.setProperty("selected",!0))}_setSelection(e,t,l){const n=this;if(!n.selection.enabled)return;if(delete n._areAllRowsSelected,n._lastColumnSelectionRange=null,n._lastRowSelectionRange=null,n.closeMenu(),null===e&&null===t)return void n.clearSelection();const o=function(){if(l&&!l.ctrlKey&&!l.metaKey&&!l.shiftKey||"one"===n.selection.mode){if("many"!==n.selection.mode){for(let e in n._selection.rows){const t=n.rowById[e];t&&(t.canNotify=!1,t.selected=!1,t.canNotify=!0)}n._selection.indexes=[],n._selection.rows=[],n._selection.columns=[],n._selection.cells=[]}n._selection.focusedCell=null}if(n._selection.selectionRect){const e=n._selection.selectionRect;e.parentNode.removeChild(e);const t={down:"pointerdown",move:"pointermove",up:"pointerup"};Smart.Utilities.Core.isMobile&&(t.down="touchstart",t.move="touchmove",t.up="touchend"),document.removeEventListener(t.move,e.onMove),document.removeEventListener(t.up,e.onUp),document.removeEventListener(t.down,e.onDown),n._selection.selectionRect=null}};n.beginUpdate();const i=n.columnByDataField[t],a=()=>{const t=n.rowById[e];if(t&&(t.allowSelect||null===t.allowSelect&&!l))if(n.selection.checkBoxes.enabled&&l&&l.originalEvent&&l.originalEvent.target&&l.originalEvent.target.parentNode&&l.originalEvent.target.parentNode.hasAttribute("checkbox")&&(l.ctrlKey=!0),n.selection.allowRowHeaderSelection&&"extended"===n.selection.mode)if(!Object.keys(n._selection.cells).length>0&&n.appearance.showRowHeaderSelectIcon,t.selected){const e=n._selection.focusedCell?JSON.parse(JSON.stringify(n._selection.focusedCell)):null;o(),n._selection.focusedCell=e}else o(),n._selectRow(e,l);else o(),n._selectRow(e,l)};if(n.selection.allowCellSelection&&null!=e&&i&&!i.autoGenerated){const i=n.rowById[e];if(!i)return n.endUpdate(!1),void n._recycle();let a=i.getCell(t);const s=n._getParentCell(i,t);s&&(a=s.row.getCell(s.column.dataField)),a&&a.column.allowSelect&&(o(),!l||l.ctrlKey||l.metaKey||(n._selection.rows=[],n._selection.indexes=[],n._selection.columns=[],"many"!==n.selection.mode&&(n._selection.cells=[])),"extended"===n.selection.mode?l&&(l.ctrlKey||l.metaKey)?a.selected=!a.selected:a.selected=!0:"one"===n.selection.mode?a.selected=!0:a.selected=!a.selected,(l&&!l.shiftKey||!n._selection.focusedCell)&&(n._selection.focusedCell={id:a.row.id,value:a.value,index:a.row.index,dataField:a.column.dataField}),l&&(l.shiftKey||n._selection.focusedCell.id===a.row.id&&n._selection.focusedCell.dataField===a.column.dataField&&"extended"===n.selection.mode)&&(s?n._renderCellSelectionRect(a.row,a.column,s.endRow,s.endColumn):n._renderCellSelectionRect(a.row,a.column,a.row,a.column)))}else n.selection.allowRowHeaderSelection&&null!=e&&void 0===n.columnByDataField[t]||n.selection.checkBoxes.enabled&&null!=e&&"_checkBoxColumn"===t&&void 0===n.columnByDataField[t]?a():null==e||null!=t&&void 0===n.columnByDataField[t]||!n.selection.allowRowSelection?n.selection.allowColumnHeaderSelection&&i&&(o(),n._selectColumn(t,l||new KeyboardEvent("keydown"))):a();n.endUpdate(!1,!1),n._recycle(!0,!0,!1),null==e||i||n._renderInputOverlay(e,l),n.__selectionStarted=new Date}_deleteCopyRects(){const e=this;e._copyRects&&e._copyRects.forEach((e=>{e.remove()})),delete e._copiedRows,e._copyRects=[]}_createCopyRects(){const e=this,t=e._getSelectedRows();let l=[],n=null;e._deleteCopyRects();for(let o=0;o<t.length;o++){const i=t[o];i&&(n?(n&&n.visibleIndex===i.visibleIndex-1||n&&n.visibleIndex===i.visibleIndex+1||(l.length&&e._createCopyRect(l[0],l[l.length-1]),l=[]),l.push(i.id)):l.push(i.id),n=i)}l.length&&e._createCopyRect(l[0],l[l.length-1])}_createCopyRect(e,t,l,n){const o=this,i=document.createElement("div"),a=document.createElement("div"),s=document.createElement("div");s.classList.add("smart-selection-overlay","marching-ants"),s.appendChild(a),a.appendChild(i),i.classList.add("smart-selection-overlay-content"),a.classList.add("smart-selection-overlay-border-content");const r=o.rowById[e],d=o.rowById[t];if(o._deleteCopyRects(),!r||!d)return;const c=r.top,u=d.top-r.top+d.height;let f=o.columns[0].left,p=o.columns[o.columns.length-1].left+o.columns[o.columns.length-1].computedWidth-f;if(l){let e=o.columnByDataField[l],t=o.columnByDataField[n];e.left>t.left&&(e=o.columnByDataField[n],t=o.columnByDataField[l]),e&&(f=e.left,p=t.left+t.computedWidth-f)}const m=s;return m.style.top=c-o.scrollTop-1+"px",m.style.left=Math.max(0,f-o.scrollLeft)+"px",0===r.visibleIndex&&0===c&&0===o.scrollTop&&(m.style.top="0px"),m.style.height=u+1+"px",m.style.width=p+1+"px",p>300&&m.style.setProperty("--alt-duration",12*Math.ceil(p/180)+"s"),u>60&&m.style.setProperty("--duration",12*Math.ceil(u/180)+"s"),o.$.scrollView.appendChild(s),o._copyRects||(o._copyRects=[]),s.onpointerdown=e=>{o._deleteCopyRects(),o._rowDownHandler(e)},m.row=r,m.lastRow=d,m.dataField=l,m.lastDataField=n,o._copyRects.push(m),s}_refreshCopyRects(){const e=this;e._copyRects&&e._copyRects.forEach((t=>{const l=t.row,n=t.lastRow,o=l.top,i=n.top-l.top+n.height;let a=e.columns[0].left,s=e.columns[e.columns.length-1].left+e.columns[e.columns.length-1].computedWidth-a,r=t.dataField,d=t.lastDataField,c=a-e.scrollLeft;const u=e.columns[e.columns.length-1];if(c<e._frozenColumnsNearWidth&&(c=e._frozenColumnsNearWidth,s=u.left+u.computedWidth-e.scrollLeft-e._frozenColumnsNearWidth),s=u.left+u.computedWidth-e.scrollLeft-e._frozenColumnsNearWidth,r){let t=e.columnByDataField[r],l=e.columnByDataField[d];t.left>l.left&&(t=e.columnByDataField[d],l=e.columnByDataField[r]),t&&(a=t.left,s=l.left+l.computedWidth-a,c=a-e.scrollLeft,c<e._frozenColumnsNearWidth&&(c=e._frozenColumnsNearWidth,s=l.left+l.computedWidth-e.scrollLeft-e._frozenColumnsNearWidth))}const f=t;f.style.top=o-e.scrollTop-1+"px",f.style.left=c+"px",0===l.visibleIndex&&0===o&&0===e.scrollTop&&(f.style.top="0px"),f.style.height=i+1+"px",f.style.width=s+1+"px",s<5?f.classList.add("smart-visibility-hidden"):f.classList.remove("smart-visibility-hidden")}))}_renderCellSelectionRect(e,t,l,n,o){const i=this;let a=i._recyclingRows;const s=a.indexOf(e),r=a.indexOf(l);if(!(i.grouping.enabled&&"advanced"===i.grouping.renderMode&&i.dataSource&&i.dataSource.groupBy.length>0)&&(i._mobile&&i._mobileSelect,s>=0&&r>=0)){if(!i._selection.selectionRect){const e=function(e){const t=document.createElement("div"),l=document.createElement("div"),n=document.createElement("div");return n.classList.add("smart-selection-overlay"),n.appendChild(l),l.appendChild(t),t.classList.add("smart-selection-overlay-content"),l.classList.add("smart-selection-overlay-border-content"),o&&n.classList.add(o),i.selection.allowCellDragSelectionHandle&&e&&l.classList.add("handle"),i.$.scrollView.appendChild(n),n},t=i._selection.selectionRect=e(!0);if(i.selection.allowCellDragSelectionHandle){let e=null,l=null,n=null;t.onMove=function(t){const o=i._selection.selectionRect;let s=t.clientX,r=t.clientY;t.touches&&(s=t.touches[0].clientX,r=t.touches[0].clientY);const d=function(e){const t=(i.enableShadowDOM?i.shadowRoot:i.getRootNode()).elementsFromPoint(e.clientX,e.clientY);let l=null;for(let e=0;e<t.length;e++){const n=t[e];if(n.getAttribute("data-field")){l=n.getAttribute("data-field");break}}let n=null;for(let e=0;e<t.length;e++){const l=t[e];if(l.getAttribute("data-id")){n=l.row;break}}return{column:i.columnByDataField[l],row:n}};if(o&&o.capturedDrag){let e=d({clientX:s,clientY:r}),l=d({clientX:s,clientY:r+o.top}).row,n=d({clientX:s+o.left,clientY:r}).column;if(l||(l=a[a.length-1]),n||(n=e.column),l&&n&&e.row&&e.column){o.row=e.row,o.rowId=o.row.id,o.column=e.column,o.endDragRow=o.endRow=l,o.endDragColumn=o.endColumn=n,o.endDragRowId=o.endDragRow.id,i._dragSelectionStartDataField=o.column.dataField,i._dragSelectionStartRow=o.row;const t=o.row.getCell(o.column.dataField);i._selection.focusedCell={index:t.row.index,id:t.row.id,dataField:t.column.dataField,value:t.value}}i._resizeSelectionRect(),t.preventDefault()}else if(o&&o.captured)if(i._dragSelectionStartDataField=i._selection.focusedCell.dataField,i._dragSelectionStartRow=i.rowById[i._selection.focusedCell.id],null===l&&null===n&&(Math.abs(s-e.left)>=30?l=!0:Math.abs(r-e.top)>=20&&(n=!0)),o.lastPoint&&Math.abs(o.lastPoint.top-r)>=30?(l=null,n=!0):o.lastPoint&&Math.abs(o.lastPoint.left-s)>=30&&(n=null,l=!0),l){const t=o.endDragColumn.dataField,l=d({clientX:s,clientY:e.top-5});l.row&&l.column&&(o.endDragRow=o.endRow,o.endDragColumn=l.column,o.endDragColumn.dataField!==t&&(o.lastPoint={left:s,top:r}),i._resizeSelectionRect())}else if(n){const t=o.endDragRow,l=d({clientX:e.left-5,clientY:r});l.row&&l.column&&(o.endDragRow=l.row,o.endDragColumn=o.endColumn,o.endDragRow.id&&o.endDragRow.id!==t.id&&(o.lastPoint={left:s,top:r}),i._resizeSelectionRect())}o&&o.captured&&i.selection.allowDragSelectionAutoScroll&&(i._autoScrollSelectionDragInterval&&clearInterval(i._autoScrollSelectionDragInterval),i.selection.isDragging=!0,i._autoScrollSelectionDragInterval=setInterval((function(){const e=i.$.scrollView.getBoundingClientRect();s<=e.left+20?(i.scrollLeft-=15,i._resizeSelectionRect()):s>=e.left+e.width-20&&(i.scrollLeft+=15,i._resizeSelectionRect()),r<=e.top+20?(i.scrollTop-=15,i._resizeSelectionRect()):r>=e.top+e.height-20&&(i.scrollTop+=15,i._resizeSelectionRect())}),25))},t.onUp=function(){if(!t.captured)return;i._autoScrollSelectionDragInterval&&clearInterval(i._autoScrollSelectionDragInterval),i.editing.editCell||i.editing.editRow||i.focus(),t.capturedDrag=!1,t.captured=!1,l=null,n=null,e=null,t.lastPoint=null;const o=t.cellValues;t.minRow&&t.maxRow&&t.maxRow&&t.maxColumn&&(i._selectCellsRange(t.minRow,t.maxRow,t.minColumn.dataField,t.maxColumn.dataField),t.row=t.minRow,t.rowId=t.row.id,t.column=t.minColumn,t.endColumn=t.maxColumn,t.endRow=t.maxRow,t.endRowId=t.maxRow.id,t.cellValues=o,i._resizeSelectionRect(),i.selection.allowCellDragSelectionAutoFill&&i._pasteSelectedCells({row:t.row,endRow:t.endDragRow,column:t.column,endColumn:t.endColumn},o)),t.endDragColumn=null,t.endDragRow=null,t.minColumn=null,t.minRow=null,t.maxColumn=null,t.maxRow=null},t.onDown=function(l){if(t.captured&&!e){let t=l.clientX,n=l.clientY;l.touches&&(t=l.touches[0].clientX,n=l.touches[0].clientY),e={left:t,top:n}}};const o={down:"pointerdown",move:"pointermove",up:"pointerup"};Smart.Utilities.Core.isMobile&&(o.down="touchstart",o.move="touchmove",o.up="touchend"),t["on"+o.down]=function(e){const l=t.getBoundingClientRect();let n=e.clientX,o=e.clientY;e.touches&&(n=e.touches[0].clientX,o=e.touches[0].clientY),n>=l.right-5&&o>=l.bottom-5?(t.captured=!0,t.endDragRow=t.endRow,t.endDragColumn=t.endColumn):i.selection.allowCellDragDropSelectionHandle&&o>=l.bottom-5?(t.captured=!0,t.capturedDrag=!0,t.endDragRow=t.endRow,t.endDragColumn=t.endColumn,t.left=t.endColumn.left-t.column.left,t.top=t.endRow.top-t.row.top):t.captured||i._rowDownHandler(e)},document.addEventListener(o.move,t.onMove,{passive:!1}),document.addEventListener(o.up,t.onUp,{passive:!1}),document.addEventListener(o.down,t.onDown,{passive:!1})}}const e=i._selection.selectionRect;e.row=i.rowById[i._selection.focusedCell.id],e.rowId=i._selection.focusedCell.id,e.column=i.columnByDataField[i._selection.focusedCell.dataField],e.endRow=l,e.endRowId=l.id,e.endDragRow=l,e.endColumn=n,e.endDragColumn=n,i._refreshCellSelectionRect()}}_resizeSelectionRect(){const e=this,t=e._selection.selectionRect;if(!t)return;let l=e._recyclingRows,n=t.row,o=t.endDragRow,i=t.column,a=t.endDragColumn;const s=e.viewColumns,r=l.indexOf(n),d=l.indexOf(o),c=l.indexOf(t.endRow),u=s.indexOf(i),f=s.indexOf(a),p=s.indexOf(t.endColumn),m=Math.min(c,Math.min(r,d)),g=Math.max(c,Math.max(r,d)),_=Math.min(p,Math.min(u,f)),h=Math.max(p,Math.max(u,f));c<=Math.min(r,d)?t.minRow=t.endRow:t.minRow=r<=d?n:o,c>=Math.max(r,d)?t.maxRow=t.endRow:t.maxRow=r>=d?n:o,p<=Math.min(u,f)?t.minColumn=t.endColumn:t.minColumn=u<=f?i:a,p>=Math.max(u,f)?t.maxColumn=t.endColumn:t.maxColumn=u>=f?i:a;let w=0,y=0,v=0,S=0;for(let e=m;e<=g;e++){const t=l[e];if(t){e===m&&(w=t.top),e===g&&(y=t.top+t.height-w);for(let e=_;e<=h;e++){const l=s[e].dataField,n=t.getCell(l);e===_&&(v=n.column.left),e===h&&(S=n.column.left+n.column.computedWidth-v)}}}t.style.top=w-e.scrollTop-1+"px",0===m&&0===w&&0===e.scrollTop&&(t.style.top="0px"),e._isVirtualMode()&&(t.style.top=w+parseFloat(e.$.rowContainer.style.top)-1+"px"),e.rightToLeft?t.style.right=v-e.scrollLeft+"px":t.style.left=v-e.scrollLeft+"px",t.style.height=y+1+"px",t.style.width=S+1+"px"}_getPatternValue(e,t,l){let n=[],o=0,i=[],a=[],s=[],r=[];const d={names:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],namesAbbr:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],namesShort:["Su","Mo","Tu","We","Th","Fr","Sa"]},c={names:["January","February","March","April","May","June","July","August","September","October","November","December",""],namesAbbr:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec",""]},u=function(e){if(void 0!==e&&!(e.toString().indexOf("GMT+")>=0||e.toString().indexOf("GMT-")>=0)){if(!isNaN(parseFloat(e)))return/[A-Za-z]/.test(e.toString())?void 0:parseFloat(e);if(d.names.indexOf(e)>=0)return r=d.names,d.names.indexOf(e);if(d.namesAbbr.indexOf(e)>=0)return r=d.namesAbbr,d.namesAbbr.indexOf(e);if(d.namesShort.indexOf(e)>=0)return r=d.namesShort,d.namesShort.indexOf(e);if(c.names.indexOf(e)>=0)return r=c.names,c.names.indexOf(e);if(c.namesAbbr.indexOf(e)>=0)return r=c.namesAbbr,c.namesAbbr.indexOf(e);if(void 0!==e&&(null===e&&(e=""),/\d+/.test(e.toString()))){s.push(e.toString().replace(/[0-9]/,"#")),s[s.length-1]=s[s.length-1].replace(/[0-9]/g,"");const t=parseFloat(e.toString().replace(/\D/g,""));return isNaN(t)?0:t}}};let f=0;for(let e in l){let t=l[e];n[o]=[],f=0;for(let e in t){let l=u(t[e]);void 0!==l&&(n[o].push(l),f++)}if(0===n[o].length)continue;let a=n[o][0],d=0;for(let e=0;e<n[o].length;e++){let t=u(n[o][e-1]),l=u(n[o][e]);0===e&&(t=l),a+=l,d+=l-t}a/=n[o].length,a-=n[o][0],a+=n[o][n[o].length-1],0!==d&&(d/=n[o].length-1),(r.length>0||s.length>0)&&(d=1,a=n[o][0]),n[o].length<=2&&(a=n[o][n[o].length-1]+d),i.push({step:d,stepStart:a}),o++}for(let e=0;e<f;e++){let t=n[0][e],l=0;for(let o=1;o<n.length;o++){const i=u(n[o-1][e]),a=u(n[o][e]);t+=a,l+=a-i}t/=n.length,t-=n[0][e],t+=n[n.length-1][e],0!==l&&(l/=n.length-1),(r.length>0||s.length>0)&&(l=1,t=n[0][e]),n.length<=2&&(t=n[n.length-1][e]+l),a.push({step:l,stepStart:t})}if(!n[e]){let l=n.length;for(let o=l;o<=e;o++){n[o]=[];for(let e=0;e<=t;e++)a[e]||(a[e]=a[e-1]),a[e]&&(o===l?n[o][e]=a[e].stepStart:(n[o][e]=n[o-1][e]+a[e].step,r.length>1&&n[o][e]>=r.length&&(n[o][e]=0)))}return r.length>0?r[n[e][t]]:s.length>0?s[e%s.length].replace("#",n[e][t]):n[e][t]}if(!n[e][t]){let l=f;for(let o=l;o<=t;o++)i[e]&&(o===l?n[e].push(i[e].stepStart):(n[e][o]=n[e][o-1]+i[e].step,r.length>1&&n[e][o]>=r.length&&(n[e][o]=0)));return r.length>0?r[n[e][t]]:s.length>0?s[e%s.length].replace("#",n[e][t]):n[e][t]}return n[e]&&n[e][t]?s.length>0?s[e%s.length].replace("#",n[e][t]):n[e][t]:0}_pasteDataType(e){const t=this.dataSource&&"number"==typeof this.dataSource.dataSource,l=e.cell,n=e.value;let o=l.column.dataType;return o&&!t||(o=isNaN(parseFloat(n))?"string":n instanceof Date?"date":"true"===n||"false"===n?"boolean":"number"),o}_getCellEditorDataSource(e){const t=this;if(e.column.editor){if(e.column.editor.dataSource)return e.column._dataSource=e.column.editor.dataSource,e.column.editor.dataSource;switch(e.column.editor.template){case"list":case"dropDownList":case"comboBox":case"autoComplete":case"multiInput":case"checkInput":case"multiComboInput":case"tags":if(!e.editor.dataSource){const l=t.getVisibleRows(),n=[],o=[];for(let i=0;i<l.length;i++){let a=t.dataSource[l[i].index];if(a){if(e.column.displayField!==e.column.dataField){const t=a[e.column.displayField],l=a[e.column.dataField];-1===o.indexOf(t)&&(n.push({label:t,value:l}),o.push(t));continue}if(a=a[e.column.dataField],!a)continue;-1===n.indexOf(a)&&n.push(a)}}return e.column._dataSource=n,n}if(e.column.editor.collaborator){let l=[];for(let e=0;e<t.users.length;e++)l.push({color:t.users[e].color,label:t.users[e].name,id:t.users[e].id,value:t.users[e].id,name:t.users[e].name,image:t.users[e].image});return e.column._dataSource=l,l}}}return null}_pasteModeCopy(e){const t=this,l=t.dataSource&&"number"==typeof t.dataSource.dataSource,n=t._pasteDataType(e),o=e.cell;let i=e.value;if(i&&"string"==typeof i&&(i=i.replace(/["]/g,"")),o.column.editor&&(o.column.editor.dataSource||t._getCellEditorDataSource(o))&&i){const e=e=>{let l;const n=t._getCellEditorDataSource(o);for(let t=0;t<n.length;t++){const i=n[t];if("string"!=typeof i&&(i.label===e||i.name===e))return l=i.value,o.column.editor.collaborator&&(l=i.id),l;if("string"!=typeof i&&i.label&&i.label.toLowerCase()===e)return l=i.value,o.column.editor.collaborator&&(l=i.id),l;if("string"!=typeof i&&i.value===e)return l=i.value,o.column.editor.collaborator&&(l=i.id),l;if("string"==typeof i&&i===e)return e;if("object"==typeof i&&i.label===e)return i;if("object"==typeof i&&o.column.editor.relationField&&""+e==""+t)return e}return-1};let l=-1;if(i&&-1!==i.indexOf(",")?(l=[],i.split(",").forEach((t=>{const n=e(t.trim());-1!==n&&l.push(n)})),l=l.join(",")):l=e(i),-1!==l&&(i=l),-1===l)return}if(o.column.editor)switch(o.column.editor.template){case"custom":return}let a=i;const s=e.dataField;if(a&&"string"==typeof a&&a.indexOf("[{")>=0&&"image"!==o.column.template&&"attachment"!==o.column.template)return;if(a&&"string"==typeof a&&a.indexOf("<")>=0&&(""===o.column.template&&"string"===n?a=t.clearPaste(a,"text/html","plainText"):"richText"===o.column.template&&"string"===n&&a&&a.indexOf("data-block")>=0||(a=t.clearPaste(a))),a&&"string"==typeof a&&"richText"===o.column.template&&/^(https?:\/\/)?([\w.-]+\.[a-z]{2,})(\/[^\s]*)?$/i.test(a.trim())){const e=document.createElement("a");e.innerHTML=a,e.href=a,e.target="_blank",e.title="Ctrl + Click to open link",a=e.outerHTML}let r=a,d=!1;if("string"===n){if(r=a,r){if((""+r).indexOf("&#")>=0&&(r=t._fromHTMLEntities(r)),(""+r).indexOf("GMT")>=0&&-1===a.indexOf("[{")){const e=new Smart.Utilities.DateTime(r).toString("d");e&&e.length&&(r=e)}"image"!==o.column.editor.template&&"attachment"!==o.column.editor.template&&"textarea"!==o.column.editor.template&&"richText"!==o.column.editor.template&&(r=t._unescapeString(r),o.column.editor.collaborator||(r=r.replaceAll("\\"," ").replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/'/g,"&#39;").replace(/'/g,"&quot;").replace(/[\r\n]+/g," ").replace(/(\u00a9|\u00ae|[\u2000-\u3300]|\ud83c[\ud000-\udfff]|\ud83d[\ud000-\udfff]|\ud83e[\ud000-\udfff])/gi,(e=>"&#"+e.codePointAt(0)+";"))))}d=!0}else if("bool"===n||"boolean"===n)1!==a&&"1"!==a&&!0!==a&&"true"!==a&&"TRUE"!==a&&"True"!==a||(r=!0,d=!0);else if("date"===n||"time"===n||"dateTime"===n){const e=t.columnByDataField[s];l?(r=a,d=!0):e&&e.dataType!==n?(r=null,d=!0):(r=a,"string"==typeof a&&(r=o&&o.column.cellsFormat&&"string"==typeof a?Smart.Utilities.DateTime.ParseDate(a,o.column.cellsFormat):new Date(a)),o&&"duration"===o.column.template&&(r=[r,r]),d=!0)}else if("number"===n||"float"===n||"int"===n){const e=t.columnByDataField[s];l?(r=a,d=!0):e&&e.dataType!==n?(r=null,d=!0):null!==a?"int"===n||"integer"===n?(r=parseInt(a),d=!0):(r=parseFloat(a),isNaN(r)&&(r=null),d=!0):(r=null,d=!0)}if(!1!==o.column.allowEdit&&!1!==t.editing.enabled||(d=!1),d)if(t.dataSource&&t.dataSource.virtualDataSource){const e={};e[o.column.dataField]=r,t.editing.batch?t._batchUpdateCell(o.row,o.column,r,o.value):t.updateRow(o.row.id,e)}else{const e=o.value;if(t._setCellUndoRedo(o,e,r),t.onCellUpdate){t._pasteTempValues||(t._pasteTempValues=[]),t._pasteTempValues.push({id:o.row.id,cell:o,dataField:o.column.dataField,oldValue:e,newValue:r}),t._pasteTimer&&clearTimeout(t._pasteTimer);const l=(e,l)=>{const n=e.row;if(n){let o=null;if(t.storeHistory&&(o=t._stringifyRow(n)),l!==(void 0!==e.value?e.value:"")&&(n.updatedDate=new Date,n.updatedBy=t.currentUser,t.storeHistory)){e.value=l;const i=t._stringifyRow(n);t._updateRowHistory(n,o,i)}}};t._pasteTimer=setTimeout((()=>{if(t._pasteTempValues&&t._pasteTempValues.length>1){let e=[],n=[],o=[];for(let l=0;l<t._pasteTempValues.length;l++){const i=t._pasteTempValues[l];e.push(i.cell),n.push(i.oldValue),o.push(i.newValue)}t.onCellUpdate(e,n,o,(function(n){if(n){const n=t.onRowHistory;t.onRowHistory=null,t.beginUpdate();for(let n=0;n<e.length;n++){const i=e[n];l(i,o[n]),t.formulas&&"string"==typeof o[n]&&o[n].startsWith("=")&&/=.+/.test(o[n])?i.formula=t._fromHTMLEntities(o[n]):i.value=o[n],t.flashCell(i.row.id,i.column.dataField)}t.endUpdate(!1),t.onRowHistory=n}}),t)}else t.onCellUpdate([o],[e],[r],(function(e){if(e){const e=t.onRowHistory;t.onRowHistory=null,l(o,r),t.formulas&&"string"==typeof r&&r.startsWith("=")&&/=.+/.test(r)&&-1===r.indexOf("[{")?o.formula=t._fromHTMLEntities(r):o.value=r,t.flashCell(o.row.id,o.column.dataField),t.onRowHistory=e}}),t);delete t._pasteTempValues}),100)}else if(t.onRowUpdate){const e=Object.assign({},o.row.data),l=Object.assign({},o.row.data);l[o.column.dataField]=r,o.row.updatedDate=new Date,o.row.updatedBy=t.currentUser,t.onRowUpdate([o.row.index],[o.row],[e],[l],(function(e){e&&(o.value=r)}),t)}else t.formulas&&"string"==typeof r&&r.startsWith("=")&&/=.+/.test(r)&&-1===r.indexOf("[{")?o.formula=t._fromHTMLEntities(r):t.editing.batch?t._batchUpdateCell(o.row,o.column,r,o.value):o.value=r,t.flashCell(o.row.id,o.column.dataField)}}_pasteModeFill(e){const t=this,l=t.dataSource&&"number"==typeof t.dataSource.dataSource,n=t._pasteDataType(e),o=e.cell,i=e.selectedValues,a=e.minRowIndex,s=e.minColumnIndex,r=e.currentRowIndex,d=e.currentColumnIndex,c=e.dataField;let u=e.value;if("string"===n)/\d+/.test(u.toString())?(u=t._getPatternValue(r-a,d-s,i),void 0===u&&i[r-a]&&i[r-a][d-s]&&(u=i[r-a][d-s])):(u=t._getPatternValue(r-a,d-s,i),void 0===u&&(u=i[r-a]?i[r-a][d-s]:e.value),void 0===u&&(u=e.value)),void 0!==u&&(o.value=u);else if("bool"===n||"boolean"===n)1!==u&&"1"!==u&&!0!==u&&"true"!==u&&"TRUE"!==u&&"True"!==u||(o.value=!0);else if("date"===n||"time"===n||"dateTime"===n){const e=t.columnByDataField[c];l?o.value=u:e&&e.dataType!==n&&(o.value=null),i[r-a]&&(u=i[r-a][d-s],void 0!==u&&(o.value=u))}else if("number"===n||"float"===n||"int"===n){u=t._getPatternValue(r-a,d-s,i);const e=t.columnByDataField[c];l?o.value=u:e&&e.dataType!==n?o.value=null:o.value=null!==u?"int"===n||"integer"===n?parseInt(u):parseFloat(u):null}}_pasteSelectedCells(e,t){const l=this;l.beginUpdate();let n=l._recyclingRows,o=e.row,i=e.endRow,a=e.column,s=e.endColumn;l._deleteCopyRects();const r=n.indexOf(o),d=n.indexOf(i),c=n.indexOf(e.endRow),u=l.viewColumns,f=u.indexOf(a),p=u.indexOf(s),m=u.indexOf(e.endColumn),g=Math.min(c,Math.min(r,d));let _=Math.max(c,Math.max(r,d)),h=!1,w=Object.keys(t).length;_-g<w&&(_=g+w-1,h=!0);const y=Math.min(m,Math.min(f,p));let v=Math.max(m,Math.max(f,p));if(t[0]){const e=Object.keys(t[0]).length;v-y<e-1&&(v=v+e-1,h=!0)}let S=0,R=0,C=0,x=0;for(let e in t)0===S&&(R+=Object.keys(t[e]).length),S++;let b=!1;l._selection&&l._selection.columns&&Object.keys(l._selection.columns).length>0&&(b=!0);for(let e=g;e<=_;e++){const o=n[e];if(o){C=0;for(let n=y;n<=v;n++){if(!u[n])continue;const i=u[n].dataField,a=o.getCell(i);let s=0;b&&(s=x);for(let r in t){if(s===x){let d=0,c=t[r];b&&(c=t[s]);for(let s in c){if(C===d){let r=c[s],d=!0;if(t[o.id]&&t[o.id][i]&&(d=!1),d&&"none"!==l.clipboard.autoFillMode){if(!a)continue;const o={value:r,targetValue:a.value,dataField:s,index:a.row.visibleIndex,targetDataField:i,targetRowIndex:e};if(l.clipboard.onPasteValue){l.clipboard.onPasteValue(o);const e=a.value;a.value=o.value,l._setCellUndoRedo(a,e,o.value)}else if(o.cell=a,o.selectedValues=t,o.minRowIndex=g,o.maxRowIndex=_,o.minColumnIndex=y,o.maxColumnIndex=v,o.currentColumnIndex=n,o.currentRowIndex=e,"copy"===l.clipboard.autoFillMode)if(o.value&&(""+o.value).indexOf("<")>=0){const e=document.createElement("textarea");e.value=o.value,e.style.position="fixed",e.style.left="-999999px",e.style.top="-999999px",document.body.appendChild(e),e.focus(),e.select(),setTimeout((()=>{document.execCommand("copy"),o.value=e.value,e.remove(),l.focus(),l._pasteModeCopy(o)}),25)}else l._pasteModeCopy(o);else"fillSeries"===l.clipboard.autoFillMode&&l._pasteModeFill(o)}}d++}}s++}C++,C>=R&&(C=0)}x++,x>=S&&(x=0)}}l.endUpdate(!1),h&&l.viewColumns[v]&&l.viewColumns[y]&&n[_]&&n[g]&&l._selectCellsRange(n[g],n[_],l.viewColumns[y].dataField,l.viewColumns[v].dataField),setTimeout((()=>{l._conditionalColors&&l._conditionalColors.update&&(l._conditionalColors.update(),l._recycle(!1))}),100),l._recycle(!1),l._refreshDataFilters()}_refreshCellSelectionRect(){const e=this,t=e._selection.selectionRect;if(e._copyRects&&e._copyRects.length&&e._refreshCopyRects(),!t||t&&t.captured)return;let l=e._recyclingRows,n=t.row,o=t.endRow,i=t.column,a=t.endColumn;const s=e.viewColumns;if(!a||!i)return;if(e._isVirtualMode()){if(n.id!==t.rowId&&!e.rowById[t.rowId])return t.style.height="0px",void(t.style.width="0px");if(n=e.rowById[t.rowId],o=e.rowById[t.endRowId],!o)return}if(!i.allowSelect||!a.allowSelect){if(i===a)return t.style.width="0px",void(t.style.height="0px");{const e=s.indexOf(i),l=s.indexOf(a);i=null,a=null;for(let t=e;t<l;t++){const e=s[t];e.allowSelect&&!i&&(i=e),a=e}if(!i||!a)return t.style.width="0px",void(t.style.height="0px")}}const r=l.indexOf(n),d=l.indexOf(o),c=s.indexOf(i),u=s.indexOf(a);let f=Math.min(r,d),p=Math.max(r,d),m=Math.min(c,u),g=Math.max(c,u);m=Math.max(0,m),f=Math.max(0,f);const _=function(e){const t=l.indexOf(e.row),n=l.indexOf(e.endRow),o=s.indexOf(e.column),i=s.indexOf(e.endColumn);f=Math.min(f,t),f=Math.min(f,n),f=Math.max(0,f),p=Math.max(p,t),p=Math.max(p,n),m=Math.min(m,o),m=Math.min(m,i),m=Math.max(0,m),g=Math.max(g,o),g=Math.max(g,i)},h=e._getParentCell(n,i.dataField),w=e._getParentCell(n,a.dataField),y=e._getParentCell(o,a.dataField),v=e._getParentCell(o,i.dataField);h&&_(h),w&&_(w),y&&_(y),v&&_(v);let S=0,R=0,C=0,x=0;t.cellValues=[];let b=[],F=[];for(let n=f;n<=p;n++){const o=l[n];if(n===f&&(S=o.top,!0!==o.freeze&&"near"!==o.freeze&&(S+=e.__frozenNearHeight+2),"far"===o.freeze&&(S=o.top+e.__scrollHeight+e.scrollTop-e._scrollView.hScrollBar.offsetHeight)),n===p){let t=o.top;"far"===o.freeze&&(t=o.top+e.__scrollHeight+e.scrollTop-e._scrollView.hScrollBar.offsetHeight),R=t+o.height-S,!0!==o.freeze&&"near"!==o.freeze&&(R+=e.__frozenNearHeight)}t.cellValues[o.id]=[];const i=e._isUpdating;e._isUpdating=!0,t.style.zIndex="";for(let l=m;l<=g;l++){const n=s[l].dataField,i=o.getCell(n);let a=i?i.value:"";if(void 0===a&&(a=""),s[l].freeze?b.push(s[l]):F.push(s[l]),"tags"===s[l].template)if(null!=a)if("number"==typeof a)a=null;else{const t=a.trim().split(","),n=[];if(s[l].editor&&s[l].editor.dataSource){const o=s[l].editor.collaborator?e.users:s[l].editor.dataSource;for(let e=0;e<t.length;e++)for(let l=0;l<o.length;l++){const i=o[l],a=i.value;if(t[e]===i.value||t[e]===i.id){n.push(i.label||i.name);break}if(a&&(t[e]===a.toLowerCase()||t[e]===i.id)){n.push(i.label||i.name);break}}}a=n.join(", ")}else a=null;else if("createdBy"===s[l].template||"updatedBy"===s[l].template){for(let t=0;t<e.users.length;t++)if(e.users[t].id===o[s[l].template]){a=e.users[t].label||e.users[t].name;break}}else"createdTime"===s[l].template||"createdDate"===s[l].template?(a=o.createdDate,a&&(a=new Smart.Utilities.DateTime(a).toString("d"))):"updatedTime"!==s[l].template&&"updatedDate"!==s[l].template||(a=o.updatedTime,!a)||(a=new Smart.Utilities.DateTime(a).toString("d"));if(i.formula&&(a=i.formula),t.cellValues[o.id][n]=a,l===m&&(C=i.column.left,i.column.freeze&&"far"===i.column.freeze&&(C=e.__clientSize.width-e.__frozenFarWidth+C+e.scrollLeft-e._scrollView.vScrollBar.offsetWidth)),l===g){let t=i.column.left;i.column.freeze&&"far"===i.column.freeze&&(t=e.__clientSize.width-e.__frozenFarWidth+t+e.scrollLeft-e._scrollView.vScrollBar.offsetWidth),x=t+i.column.computedWidth-C}let c=!0;-1!==r&&-1!==d||(c=!1),c&&(i.selected=!0)}e._isUpdating=i}if(S-e.scrollTop<e.layout.rowMinHeight&&e.filtering.enabled&&e.filtering.filterRow.visible){const t=S;S=e.layout.rowMinHeight+e.scrollTop,R-=S-t}if(R<=0)t.classList.add("smart-visibility-hidden");else{if(t.classList.remove("smart-visibility-hidden"),0===b.length&&(t.style.zIndex=5),t.style.top=S-e.scrollTop-1+"px",0===f&&0===S&&0===e.scrollTop&&(t.style.top="0px"),e._isVirtualMode(),e.rightToLeft)t.style.right=C-e.scrollLeft+"px";else if(t.style.left=C-e.scrollLeft+"px",C-e.scrollLeft<e.__frozenNearWidth-1){let l=0;for(let t=0;t<e._frozenNearColumns.length;t++){const n=e._frozenNearColumns[t];n&&n.autoGenerated&&n.visible&&(l+=n.width)}if(C-e.scrollLeft<l){const n=l-C+e.scrollLeft;!F.length&&b.length&&(x+=n),x-=n,t.style.left=n+C-e.scrollLeft+"px"}}t.style.height=R+1+"px",t.style.width=x+1+"px",x<0?t.classList.add("smart-visibility-hidden"):t.classList.remove("smart-visibility-hidden")}}_renderInputOverlay(e,t,l){const n=this,o=n.rowById[e];if(o&&!1!==o.allowSelect&&!o.label&&t&&n.selection.checkBoxes.enabled){n._inputOverlay&&n._inputOverlay.classList.contains("smart-input-overlay-column")&&(n._inputOverlay.parentNode&&n._inputOverlay.parentNode.removeChild(n._inputOverlay),n._inputOverlay=null),n._inputOverlay||(n._inputOverlay=document.createElement("div"),n.$.scrollView.appendChild(n._inputOverlay),n._inputOverlay.classList.add("smart-input-overlay"));let e=o.freeze?o.top:n.__frozenNearHeight+o.top;const t=Math.round((o.cellHeight-n._selectionColumn.computedWidth)/2),i=n._selectionColumn.element.parentElement.offsetLeft+n._selectionColumn.element.offsetLeft;if(n._inputOverlay.style.left=i+"px",n._inputOverlay.style.height=n._selectionColumn.computedWidth+"px",n._inputOverlay.style.width=n._selectionColumn.computedWidth+"px",n._inputOverlay.style.top=e+t-n.scrollTop+"px",o&&o.element){const e=o.element.querySelector("smart-grid-cell");e&&(n._inputOverlay.cell=e.cell)}n._inputOverlay.row=o,n._inputOverlay.onpointerdown=function(e){n._inputOverlay||(n._inputOverlay.onpointerdown=null);const t=n._inputOverlay.row,l=n._inputOverlay.cell;n.beginUpdate(),t.selected=!t.selected,n.endUpdate(!1),n.$.fireEvent("change",{started:!1,finished:!0}),n._refreshSummary(!1);const o=e.originalEvent?e.originalEvent:e,i=3===o.which;n.$.fireEvent("rowClick",{row:t,id:t.id,isRightClick:i,originalEvent:o,pageX:parseInt(o.pageX),pageY:parseInt(o.pageY)}),l&&n.$.fireEvent("cellClick",{cell:l,id:t.id,dataField:l.column.dataField,isRightClick:i,originalEvent:o,pageX:parseInt(o.pageX),pageY:parseInt(o.pageY)}),n._recycle(),n._renderInputOverlay(t.id,e,!0),e.preventDefault()},n.appearance.allowCheckBoxesSelectionAnimation&&void 0===l&&n._inputOverlay.classList.add("smart-animate"),requestAnimationFrame((()=>{n._inputOverlay&&n._inputOverlay.classList.add("smart-input-overlay-on")}))}}_selectRow(e,t){const l=this,n=l.rowById[e];if(n&&l.selection.enabled&&(!n.header||"row-resize"!==n.header.style.cursor)){if(t&&(!t.shiftKey||!l._selection.focusedCell)){const t=n.getCell(l.columns[0].dataField);l._selection.focusedCell={index:t.row.index,id:e,dataField:t.column.dataField,value:t.value}}l._lastRowsSelectionRange=null,"extended"===l.selection.mode?l._handleExtendedRowSelection(n,t):"one"===l.selection.mode?n.select():n.selected?n.unselect():n.select()}}_getParentCell(e,t){const l=this;let n=l._recyclingRows;for(let o=0;o<l._cellsMerge.length;o++){const i=l._cellsMerge[o];let a=[],s=[];if(a.push(i.row),i.rowSpan>1){const e=n.indexOf(i.row);if(e>=0)for(let t=e;t<e+i.rowSpan;t++)n[t]&&-1===a.indexOf(n[t])&&a.push(n[t])}if(s.push(i.column.dataField),i.colSpan>1){const e=l.viewColumns,t=e.indexOf(l.columnByDataField[i.column.dataField]);for(let l=t;l<t+i.colSpan;l++)e[l]&&-1===s.indexOf(e[l].dataField)&&s.push(e[l].dataField)}if(a.indexOf(e)>=0&&s.indexOf(t)>=0)return{row:i.row,column:i.column,endRow:a[a.length-1],endColumn:l.columnByDataField[s[s.length-1]]}}if(l._cellRowSpan)for(let o=0;o<l._cellRowSpan.length;o++){const o=e.visibleIndex;let i=-1,a=null;for(let e=0;e<l._cellRowSpan.length;e++){const t=l._cellRowSpan[e];if(o>t[0]&&o<t[1]){i=t[0],a=t[2];break}}if(i>=0&&a===t){const e=n[i];if(e)return{row:e,column:l.columnByDataField[t],endRow:e,endColumn:l.columnByDataField[t]}}}return null}_selectCellsRange(e,t,l,n){const o=this,i=o._selection.selectionRect;if(!e||!t)return;if(o._lastRowsSelectionRange&&o._lastRowsSelectionRange.id===e.id&&o._lastRowsSelectionRange.endId===t.id&&o._lastColumnSelectionRange&&o._lastColumnSelectionRange.dataField===l&&o._lastColumnSelectionRange.endDataField===n)return;o.beginUpdate(),o._clearSelection(),o._lastRowsSelectionRange={id:e.id,endId:t.id},o._lastColumnSelectionRange={dataField:l,endDataField:n},(!i||i&&!i.captured)&&o._selection.focusedCell&&o._renderCellSelectionRect(o.rowById[o._selection.focusedCell.id],o.columnByDataField[o._selection.focusedCell.dataField],o.rowById[o._lastRowsSelectionRange.endId],o.columnByDataField[o._lastColumnSelectionRange.endDataField]);let a=o._recyclingRows;const s=o.viewColumns;let r=-1,d=-1,c=a.indexOf(e),u=a.indexOf(t),f=-1;for(let e=0;e<s.length;e++){const t=s[e];t.allowSelect&&(-1===f&&(f=e),t.dataField===l&&(r=e),t.dataField===n&&(d=e))}if(-1===f)return o.endUpdate(!1),void o._recycle();-1===r?r=f:-1===d&&(d=f);let p=Math.min(c,u),m=Math.max(c,u),g=Math.min(r,d),_=Math.max(r,d);const h=function(e){const t=a.indexOf(e.row),l=a.indexOf(e.endRow),n=s.indexOf(e.column),o=s.indexOf(e.endColumn);p=Math.min(p,t),p=Math.min(p,l),m=Math.max(m,t),m=Math.max(m,l),g=Math.min(g,n),g=Math.min(g,o),_=Math.max(_,n),_=Math.max(_,o)},w=o._getParentCell(e,l),y=o._getParentCell(t,n);if(w&&h(w),y&&h(y),m<0||p<0||g<0||_<0)return o.endUpdate(!1),void o._recycle();for(let e=p;e<=m;e++){const t=a[e];if(t.allowSelect)for(let e=0;e<s.length;e++){const l=s[e];l.allowSelect&&e>=g&&e<=_&&(t.getCell(l.dataField).selected=!0)}}o.endUpdate(!1,!1),o._recycle(!0,!0,!1),o._selectionTimer&&clearTimeout(o._selectionTimer),o._selectionTimer=setTimeout((()=>{o.editing.isEditing||o._recycle(!0,!0,!1)}),50)}_selectRowsRange(e,t,l){const n=this;if(n._lastRowsSelectionRange&&n._lastRowsSelectionRange.id===e.id&&n._lastRowsSelectionRange.endId===t.id)return;if(n._dragDrop&&n._dragDrop.dragDetails)return;n.beginUpdate(),n._clearSelection(),n._lastRowsSelectionRange={id:e.id,endId:t.id};let o=n._recyclingRows;const i=o.indexOf(e),a=o.indexOf(t),s=Math.min(i,a),r=Math.max(i,a);if(r<0)return n.endUpdate(!1),void n._recycle();for(let e=s;e<=r;e++){const t=o[e];t&&t.allowSelect&&(t.selected=!1!==l)}n.endUpdate(!1),n._recycle()}_selectColumnsRange(e,t){const l=this;if(l._lastColumnSelectionRange&&l._lastColumnSelectionRange.dataField===e&&l._lastColumnSelectionRange.endDataField===t)return;if(l._dragDrop&&l._dragDrop.dragDetails)return;l.beginUpdate(),l._clearSelection(),l._lastColumnSelectionRange={dataField:e,endDataField:t};const n=l.viewColumns;let o=-1,i=n.length;for(let l=0;l<n.length;l++){const a=n[l];a.allowSelect&&(a.dataField===e&&(o=l),a.dataField===t&&(i=l))}const a=Math.min(o,i),s=Math.max(o,i);for(let e=0;e<n.length;e++){const t=n[e];t.allowSelect&&e>=a&&e<=s&&(t.selected=!0)}l.endUpdate(!1),l._recycle()}_selectColumn(e,t){const l=this,n=l.columnByDataField[e],o=l.viewColumns;if(!n||!l.selection.enabled||!1===n.allowSelect||!l.selection.allowColumnHeaderSelection)return;if(n&&"col-resize"===n.element.style.cursor)return;let i=!1;if(n&&(n.allowSelect||null===n.allowSelect&&!t)&&(i=!0),i&&t)if("extended"===l.selection.mode){if(t.ctrlKey||t.metaKey||t.shiftKey||(l._rangeSelectionStartColumn=n,l._rangeSelectionEndColumn=n),t.ctrlKey||t.metaKey?n.selected=!n.selected:n.selected=!0,t&&t.shiftKey){l._rangeSelectionStartColumn||(l._rangeSelectionStartColumn=n),l._rangeSelectionEndColumn=n,l._selection.columns=[];const e=o.indexOf(l._rangeSelectionStartColumn),t=o.indexOf(l._rangeSelectionEndColumn),i=Math.min(e,t),a=Math.max(e,t);for(let e=i;e<=a;e++){const t=o[e];t&&!1!==t.allowSelect&&(t.selected=!0)}}}else"one"===l.selection.mode||null===n.selected?n.selected=!0:n.selected=!n.selected}selectAllRows(){const e=this;let t=e.rows;e._selectionColumn._selecting=!0,delete e._areAllRowsSelected,e.beginUpdate();for(let e=0;e<t.length;e++)t[e].selected=!0;e._selectionColumn._selecting=!1,e.endUpdate(!1),e._refreshSummary(!1),e._recycle(!1),e._refreshCheckBoxColumnSelection(),e.$.fireEvent("change",{started:!1,finished:!0})}hasSelectedRows(){const e=this.getVisibleRows(),t=this._getSelectedRows(!0,!1);return t.length===e.length||t.length>0&&t.length<e.length||0!==t.length&&0!==e.length&&void 0}areAllRowsSelected(){const e=this;if(e._areAllRowsSelected!==this.undefined)return e._areAllRowsSelected;const t=e.getVisibleRows(),l=Object.keys(e._selection.rows).length;if(0===l||l<t.length)return!1;const n=e._getSelectedRows(!0,!1);return n.length>0&&n.length===t.length?(e._areAllRowsSelected=!0,!0):(e._areAllRowsSelected=!1,e._areAllRowsSelected)}_getSelectedRows(e,t){const l=this,n=[];let o=l.rows;if(l.rows.canNotify=!1,e&&(o=l.getVisibleRows()),l._isVirtualMode()){let e=l._selection.indexes;return l.paging.enabled&&t&&l._isVirtualMode()&&(e=e.slice(0,l.paging.pageSize)),l.rows.canNotify=!0,Object.keys(e).length}l.paging.enabled&&t&&(o=l._isVirtualMode()?o.slice(0,l.paging.pageSize):o.slice(l.paging.pageIndex*l.paging.pageSize,(l.paging.pageIndex+1)*l.paging.pageSize));for(let e=0;e<o.length;e++){const t=o[e];t.getProperty("selected")?n.push(t):(t.canNotify=!1,t.selected=!1,t.canNotify=!0)}return l.rows.canNotify=!0,n}_dragSelectionEnd(e){const t=this;t._dragSelectionStartDataField=null,t._dragSelectionStartRow=null,t.__selectionStarted&&(t.$.fireEvent("change",{started:!1,finished:!0,originalEvent:e}),t._refreshSummary(),delete t.__selectionStarted,delete t.__selectionStartedFired,t.autoSaveState()),t.selection.allowDragSelection&&t.selection.isDragging&&(t.selection.isDragging=!1,t._autoScrollSelectionDragInterval&&(clearInterval(t._autoScrollSelectionDragInterval),t.editing.isEditing||t._recycle()))}_dragSelection(e){const t=this;if("extended"!==t.selection.mode||!1===t.selection.allowDragSelection)return;if(!t._dragSelectionStartDataField&&!t._dragSelectionStartRow)return;const l=()=>{t.__selectionStarted&&!t.__selectionStartedFired&&(t.$.fireEvent("change",{started:!0,finished:!1,originalEvent:e}),t.__selectionStartedFired=!0),t.$.fireEvent("change",{started:!1,finished:!1,originalEvent:e})};if(!t.selection.allowCellSelection||!t._dragSelectionStartDataField||t._columnResizeLine||t._dragSelectionStartDataField.startsWith("_")||!t._dragSelectionStartRow||t._rowResizeLine){if(t._dragSelectionStartRow&&!t._rowResizeLine&&(t.selection.allowRowSelection&&!t._dragSelectionStartDataField.startsWith("_")||t.selection.allowRowHeaderSelection&&t._dragSelectionStartDataField.startsWith("_"))){const n=(t.enableShadowDOM?t.shadowRoot:t.getRootNode()).elementsFromPoint(e.clientX,e.clientY);let o=null;for(let e=0;e<n.length;e++){const t=n[e];if(t.getAttribute("data-id")){o=t.row,!o&&t.cell&&(o=t.cell.row);break}}let i=!0;t._lastRowsSelectionRange&&t._lastRowsSelectionRange.id===t._dragSelectionStartRow.id&&o&&t._lastRowsSelectionRange.endId===o.id&&(i=!1),o&&!o.allowSelect&&(i=!1),o&&o.allowSelect&&t._selectRowsRange(t._dragSelectionStartRow,o),t._autoScrollSelectionDragInterval&&clearInterval(t._autoScrollSelectionDragInterval),t.selection.isDragging=!0,i&&l(),t._autoScrollSelectionDragInterval=setInterval((function(){const l=t.$.scrollView.getBoundingClientRect();e.clientY<=l.top+20?t.scrollTop-=15:e.clientY>=l.top+l.height-20&&(t.scrollTop+=15)}),25)}else if(t._dragSelectionStartDataField&&!t._columnResizeLine&&!t._dragSelectionStartDataField.startsWith("_")&&t.selection.allowColumnHeaderSelection){const n=(t.enableShadowDOM?t.shadowRoot:t.getRootNode()).elementsFromPoint(e.clientX,e.clientY);let o=null;for(let e=0;e<n.length;e++){const t=n[e];if(t.getAttribute("data-field")){o=t.getAttribute("data-field");break}}o&&t._selectColumnsRange(t._dragSelectionStartDataField,o),t._autoScrollSelectionDragInterval&&clearInterval(t._autoScrollSelectionDragInterval);let i=!0;t._lastColumnSelectionRange&&t._lastColumnSelectionRange.dataField===t._dragSelectionStartDataField&&t._lastColumnSelectionRange.endDataField===o&&(i=!1),i&&l(),t.selection.isDragging=!0,t._autoScrollSelectionDragInterval=setInterval((function(){const l=t.$.scrollView.getBoundingClientRect();e.clientX<=l.left+20?t.scrollLeft-=15:e.clientX>=l.left+l.width-20&&(t.scrollLeft+=15)}),25)}}else{const n=(t.enableShadowDOM?t.shadowRoot:t.getRootNode()).elementsFromPoint(e.clientX,e.clientY);let o=null;for(let e=0;e<n.length;e++){const t=n[e];if(t.getAttribute("data-field")){o=t.getAttribute("data-field");break}}let i=null;for(let e=0;e<n.length;e++){const t=n[e];if(t.getAttribute("data-id")){i=t.row;break}}if(!i&&n.length&&n[0].classList.contains("smart-grid-scroll-view")){i=t._recyclingRows[t._recyclingRows.length-1];const l=(t.enableShadowDOM?t.shadowRoot:t.getRootNode()).elementsFromPoint(e.clientX,i.element.getBoundingClientRect().top);for(let e=0;e<l.length;e++){const t=l[e];if(t.getAttribute("data-field")){o=t.getAttribute("data-field");break}}}if(o&&i){if(i.id===t._dragSelectionStartRow.id&&t._dragSelectionStartDataField===o&&t._lastRowsSelectionRange&&t._lastRowsSelectionRange.id===t._dragSelectionStartRow.id&&t._lastRowsSelectionRange.endId===i.id&&t._lastColumnSelectionRange&&t._lastColumnSelectionRange.dataField===t._dragSelectionStartDataField&&t._lastColumnSelectionRange.endDataField===o)return;if(o&&o.startsWith("_"))return;let e=!0;if(t._lastRowsSelectionRange&&t._lastRowsSelectionRange.id===t._dragSelectionStartRow.id&&t._lastRowsSelectionRange.endId===i.id&&t._lastColumnSelectionRange&&t._lastColumnSelectionRange.dataField===t._dragSelectionStartDataField&&t._lastColumnSelectionRange.endDataField===o&&(e=!1),t._lastRowsSelectionRange&&t._lastRowsSelectionRange.id===t._dragSelectionStartRow.id&&t._lastRowsSelectionRange.endId===i.id&&t._lastColumnSelectionRange&&t._lastColumnSelectionRange.dataField===t._dragSelectionStartDataField&&t._lastColumnSelectionRange.endDataField===o)return;t._selectCellsRange(t._dragSelectionStartRow,i,t._dragSelectionStartDataField,o),t._removeCellContentPopup(),e&&l()}t.selection.allowDragSelectionAutoScroll&&(t._autoScrollSelectionDragInterval&&clearInterval(t._autoScrollSelectionDragInterval),t.selection.isDragging=!0,t._autoScrollSelectionDragInterval=setInterval((function(){const l=t.$.scrollView.getBoundingClientRect();e.clientX<=l.left+20?t.scrollLeft-=15:e.clientX>=l.left+l.width-20&&(t.scrollLeft+=15),e.clientY<=l.top+20?t.scrollTop-=15:e.clientY>=l.top+l.height-20&&(t.scrollTop+=15)}),25))}}select(e,t){const l=this;l.isInitialized&&(!t&&void 0!==e&&l._selection&&l._selection.rows[e]||(l._setSelection(e,t),l.$.fireEvent("change",{started:!1,finished:!0}),l._refreshSummary()))}selectCell(e,t){this.select(e,t)}selectRowsByIndex(e){const t=this;e||(e=[]),requestAnimationFrame((()=>{if("extended"!==t.selection.mode&&"many"!==t.selection.mode&&t._clearSelection(),t._isVirtualMode()){let l=[];for(let t=0;t<e.length;t++)l[e[t]]=!0;return t._selection.indexes=l,void t._recycle()}t.beginUpdate();for(let l in e){const n=e[l],o=t.rows[n];o&&t._setSelection(o.id)}t.endUpdate(!1),t._recycle()}))}selectRowsRange(e,t){const l=this,n=l.rowById[e],o=l.rowById[t];n&&o&&(l._selectRowsRange(n,o),l.$.fireEvent("change",{started:!1,finished:!0}),l._refreshSummary())}selectCellsByQuery(e,t){const l=this,n=e?l.findCells(e):t;requestAnimationFrame((()=>{"extended"!==l.selection.mode&&"many"!==l.selection.mode&&l._clearSelection(),l.beginUpdate();for(let e in n){const t=n[e][0],o=n[e][1];l._setSelection(t,o)}l.endUpdate(!1),l._recycle()}))}selectRowsByQuery(e,t,l){const n=this,o=n.find(e,t,l).map((e=>e.$.id));o.length&&n.selectRows(o)}selectRow(e){const t=this;"extended"!==t.selection.mode&&"many"!==t.selection.mode&&t._clearSelection(),t._setSelection(e),t._recycle(!1)}selectRows(e){const t=this;e||(e=[]),requestAnimationFrame((()=>{"extended"!==t.selection.mode&&"many"!==t.selection.mode&&t._clearSelection(),t.beginUpdate();for(let l in e)t._setSelection(e[l]);t.endUpdate(!1),t._recycle()}))}selectCellsById(e){this.selectCellsByQuery(null,e)}selectCells(e,t){const l=this;e||(e=[]),requestAnimationFrame((()=>{"extended"!==l.selection.mode&&"many"!==l.selection.mode&&l._clearSelection(),l.beginUpdate();for(let n in e)for(let o=0;o<t.length;o++)l._setSelection(e[n],t[o]);l.endUpdate(!1),l._recycle()}))}selectRange(e,t,l,n){const o=this;!function(){const i=new KeyboardEvent("keydown",{shiftKey:!0});requestAnimationFrame((()=>{"extended"!==o.selection.mode&&"many"!==o.selection.mode&&o._clearSelection(),o.beginUpdate(),o._setSelection(e,t),o._setSelection(l,n,i),o.ensureVisible(e,t),o.endUpdate(!1),o._refreshSummary(!1),o._recycle()}))}(),o.$.fireEvent("change",{started:!1,finished:!0})}unselect(e,t){const l=this;if(l._selection){if(l._selection.rows&&l._selection.rows[e]){delete l._selection.rows[e];const t=l.rowById[e];t&&t.unselect()}l._selection.columns&&l._selection.columns[t]&&delete l._selection.columns[t],l._selection.cells&&(l._selection.cells["row"+e]&&(delete l._selection.cells["row"+e][t],1===Object.getOwnPropertyNames(l._selection.cells["row"+e]).length&&delete l._selection.cells["row"+e]),l._selection.cells["column"+t]&&(delete l._selection.cells["column"+t][e],1===Object.getOwnPropertyNames(l._selection.cells["column"+t]).length&&delete l._selection.cells["column"+t])),l.$.fireEvent("change",{started:!1,finished:!0}),l._refreshSummary()}}getSelectedRows(){const e=this;let t=[];if(e._selection.rows&&Object.keys(e._selection.rows).length>0){const l=Object.keys(e._selection.rows);if(e._isVirtualMode()){for(let e in l){const n=l[e];t.push([n,{}])}return t}for(let n in l){const o=l[n],i=e.rowById[o];if(!i)continue;const a={};for(let e in i.data)switch(e){case"$":case"parent":case"level":case"leaf":case"children":continue;default:a[e]=i.data[e]}t.push([i.id,a])}}return t}getSelectedRowsData(){const e=this;let t=[];if(e._selection.rows&&Object.keys(e._selection.rows).length>0){const l=Object.keys(e._selection.rows);if(e._isVirtualMode()){for(let e in l)t.push({});return t}for(let n in l){const o=l[n],i=e.rowById[o];if(!i)continue;const a={};for(let e in i.data)switch(e){case"$":case"parent":case"level":case"leaf":case"children":continue;default:a[e]=i.data[e]}t.push(a)}}return t}getSelectedRowIndexes(){const e=this;return e._selection.indexes&&Object.keys(e._selection.indexes).length>0?e._selection.indexes:[]}getSelectedRowIds(){const e=this;let t=[];if(e._isVirtualMode())return e._selection.rows&&Object.keys(e._selection.rows).length>0?e._selection.rows:void 0;if(e._selection.rows&&Object.keys(e._selection.rows).length>0){const l=Object.keys(e._selection.rows);for(let n in l){const o=l[n],i=e.rowById[o];i&&t.push(i.id)}}return t}getSelectedCells(e){const t=this;let l=[];if(t._selection.cells)for(let n in t._selection.cells)if(n.startsWith("row")){let o=n.replace("row",""),i=null;for(let a in t._selection.cells[n])if(i=a.replace("column",""),l||(l=[]),!1===e)l.push([o,i]);else{const e=t.getCellValue(o,i);l.push([o,i,e])}}return l}getSelection(){const e=this;let t=null,l=null,n=null,o=null;if(e._selection.rows&&Object.keys(e._selection.rows).length>0){const l=Object.keys(e._selection.rows);t=[];for(let n=0;n<l.length;n++){const o=l[n],i=e.rowById[o],a={id:o};i?a.row=i:e._isVirtualMode&&e.rows[n]?a.row=e.rows[n]:e._isVirtualMode&&(a.row=null),t.push(a)}}if(e._selection.columns&&Object.keys(e._selection.columns).length>0){const t=Object.keys(e._selection.columns);l=[];for(let n=0;n<t.length;n++){const o=t[n];l.push({dataField:o,column:e.columnByDataField[o]})}}if(e._selection.cells)for(let t in e._selection.cells)if(t.startsWith("row")){let l=t.replace("row",""),o=null;for(let i in e._selection.cells[t])o=i.replace("column",""),n||(n=[]),n.push({id:l,dataField:o,column:e.columnByDataField[o],row:e.rowById[l]})}return e._selection.focusedCell&&(e._isVirtualMode(),o={index:e._selection.focusedCell.index,id:e._selection.focusedCell.id,dataField:e._selection.focusedCell.dataField}),{rows:t,columns:l,cells:n,focused:o}}focusAndSelect(e,t){const l=this;if(l.focus(),l.selection.enabled&&l.selection.allowCellSelection)l._focusCell(e,t);else{const t=l.rowById[e];if(!t)return;l.beginUpdate(),l._selection.rows=[],l._selection.columns=[],l._selection.cells=[],l._selection.indexes=[],l._setSelection(e),l._selection.focusedCell={id:t.id,value:null,index:t.index,dataField:l.columns[0].dataField},l.endUpdate(!1)}}_focusCell(e,t,l){const n=this;if(n.selection.enabled&&n.selection.allowCellSelection){const o=n.rowById[e];if(!o)return;!1!==l&&(n.beginUpdate(),n._selection.rows=[],n._selection.columns=[],n._selection.cells=[],n._selection.indexes=[],n._setSelection(e,t));const i=o.getCell(t);i&&(n._selection.focusedCell={id:i.row.id,value:i.value,dataField:t,index:i.row.index}),!1!==l&&n.endUpdate(!1)}}_clearSelection(e){const t=this;if(t._selection.rows=[],t._selection.columns=[],t._selection.cells=[],t._selection.indexes=[],e&&(t._selection.focusedCell=null,t._selection.selectionRect)){const e=t._selection.selectionRect;e.parentNode.removeChild(e);const l={down:"pointerdown",move:"pointermove",up:"pointerup"};Smart.Utilities.Core.isMobile&&(l.down="touchstart",l.move="touchmove",l.up="touchend"),document.removeEventListener(l.move,e.onMove),document.removeEventListener(l.up,e.onUp),document.removeEventListener(l.down,e.onDown),t._selection.selectionRect=null}t._recycle(),t._refreshCheckBoxColumnSelection()}_getSelectionCellValues(){const e=this;if(e._selection.selectionRect)return e._selection.selectionRect.cellValues;const t=e.viewColumns;if(e._selection.rows.length>0){let l=[];for(let n in e._selection.rows){const o=e.rowById[n];for(let e=0;e<t.length;e++){const i=t[e];i&&(l[n]||(l[n]=[]),i.autoGenerated||(l[n][i.dataField]=o.data[i.dataField]))}}return l}if(Object.keys(e._selection.columns).length>0){let t=[];for(let l in e._selection.columns){const n=e.columnByDataField[l];if(n)for(let l=0;l<e._recyclingRows.length;l++){const o=e._recyclingRows[l];o&&(t[o.id]||(t[o.id]=[]),t[o.id][n.dataField]=o.data[n.dataField])}}return t}if(e._selection.cells&&Object.keys(e._selection.cells).length>0){const t=e.getSelection();if(t.cells){let e=[];for(let l in t.cells){const n=t.cells[l],o=n.id;e[o]||(e[o]=[]),e[o][n.column.dataField]=n.row.data[n.column.dataField]}return e}}}_clipboardHandler(e,t){const l=this;if(l.clipboard.enabled){if((t.ctrlKey||t.metaKey)&&("c"===e||"x"===e)){const t=l._getSelectionCellValues();if(delete l._cutCells,delete l._cutRows,l.clipboard.copyHeadersToClipboard){let e=[];for(let n in t){for(let o in t[n]){const t=l.columnByDataField[o];t&&(e[o]=t.label,e.length++)}break}e.length&&t.splice(0,0,e)}if(l._selection.selectionRect){l._selection.selectionRect.classList.add("marching-ants");const e=l._selection.selectionRect;l._createCopyRect(e.row.id,e.endDragRow.id,e.column.dataField,e.endColumn.dataField)}else l.hasSelectedRows()&&l._createCopyRects();let n="";if(!t)return;let o=Object.keys(t).length,i=0;for(let a in t){let s="",r=Object.keys(t[a]).length,d=0;for(let e in t[a]){let n=t[a][e];""===n&&(n=`"${n}"`),void 0!==n&&"undefined"!==n&&null!==n||(n='""'),n=l._unescapeString(n),s+=n,d++,d<r&&(s+="\t")}if(n+=s,i++,i<o&&(n+="\r\n"),"x"===e&&l.editing.enabled){const e=l.getSelection();e.cells&&(l._cutCells=e.cells),e.rows&&(l._cutRows=e.rows)}}if(navigator.clipboard&&navigator.clipboard.writeText)navigator.clipboard.writeText(n).then((function(){}),(function(){})),Smart.Utilities.Core.Browser.Firefox&&(l._clipboardText=n);else{const e=document.createElement("textarea");e.value=n,e.style.position="fixed",e.style.left="-999999px",e.style.top="-999999px",document.body.appendChild(e),e.focus(),e.select(),setTimeout((()=>{document.execCommand("copy"),e.remove(),l._clipboardText=n}),25)}}if(t.ctrlKey&&" "===e&&l.editing.addNewRow.visible&&(l._keyboardAdd=!0,l._addNewGridRow(),l._keyboardAddTimer&&clearTimeout(l._keyboardAddTimer),l._keyboardAddTimer=setTimeout((()=>{l._keyboardAdd=!1}),300)),(t.ctrlKey||t.metaKey)&&"v"===e&&l.editing.enabled){const e=window.Smart.Utilities.Core.Browser.Firefox;if(navigator.clipboard&&!navigator.clipboard.readText&&!e)return;const t=e=>{if(!e)return;const t=[];let n=e.trim().split("\r");if(l._selection&&l._selection.columns&&Object.keys(l._selection.columns).length>0&&(n=e.split("\r")),1===n.length){let t=e.trim().split("\n");l._selection&&l._selection.columns&&Object.keys(l._selection.columns).length>0&&(t=e.split("\n")),t.length>1&&(n=t)}e.indexOf("<")>=0&&(n=[e.trim()]);for(let e=0;e<n.length;e++){const l=n[e].split("\t");let o={};for(let e=0;e<l.length;e++)o[e]=l[e].trim(),void 0!==o[e]&&"undefined"!==o[e]||(o[e]="");t[e]=o}const o=l._selection.selectionRect;if(o)l._pasteSelectedCells({row:o.row,endRow:o.endDragRow,column:o.column,endColumn:o.endColumn},t);else{let e=null,n=null;for(let t in l._selection.rows){const o=l.rowById[t];e||(e=o),n||(n=o),e.visibleIndex>o.visibleIndex&&(e=o),n.visibleIndex<o.visibleIndex&&(n=o)}if(e&&n&&l._pasteSelectedCells({row:e,endRow:n,column:l.firstColumn(),endColumn:l.lastColumn()},t),0===l._selection.rows.length){const o=l.getSelectedCells();let i=null,a=null;for(let t=0;t<o.length;t++){const s=l.rowById[o[t][0]];if(!s)continue;e||(e=s),n||(n=s);const r=l.columnByDataField[o[t][1]];i||(i=a=r),i&&i.visibleIndex>r.visibleIndex&&(i=r),a&&a.visibleIndex<r.visibleIndex&&(a=r),e.visibleIndex>s.visibleIndex&&(e=s),n.visibleIndex<s.visibleIndex&&(n=s)}if(null===e&&null===n&&null===i&&null===a&&Object.keys(l._selection.columns).length>0){e=l.rows[0],n=l.rows[l.rows.length-1];const t=Object.keys(l._selection.columns)[0];i=l.columnByDataField[t],a=i}l._pasteSelectedCells({row:e,endRow:n,column:i,endColumn:a},t)}}l._cutCells&&l._handleCutCells(),l._cutRows&&l._handleCutRows()};if(!window.isSecureContext||e){if(document.activeElement&&"INPUT"===document.activeElement.nodeName)return!0;const e=document.createElement("textarea");return e.style.position="absolute",e.style.left="-1000px",e.style.top="-1000px",document.body.appendChild(e),e.select(),void setTimeout((()=>{l._clipboardSelection=new Array;let n=e.value;0===n.length&&window.clipboardData&&(e.val(window.clipboardData.getData("Text")),n=e.value);let o=n.split("\n");for(let e=0;e<o.length;e++)if(o[e].split("\t").length>0){var i=o[e].split("\t");if(1===i.length&&e===o.length-1&&""===i[0])continue;i.length>0&&l._clipboardSelection.push(i)}l._clipboardText=l._clipboardSelection.toString(),t(n.trim().replaceAll("\n","\r")),e.remove(),l.focus()}),100)}const n=navigator.clipboard.read?"read":"readText";navigator.clipboard[n]().then((e=>{if(Array.isArray(e)&&e.length){const n=e[0];let o=n.types.indexOf("text/html")>-1?"text/html":"text/plain";try{l._deleteCopyRects(),n.types.length&&n.getType(o).then((e=>{e.text().then((e=>{t(e)}))}))}catch(e){console.log(e),l._deleteCopyRects()}}else"string"==typeof e&&t(e)}))}}}_handleCutRows(){const e=this,t=e._cutRows;t.length>=1?t.map((e=>e.id)).forEach((t=>{requestAnimationFrame((()=>{e.updateRow(t,null,null,!0)}))})):delete e._cutRows}_handleCutCells(){const e=this;e.beginUpdate();const t=e._cutCells;if(t){for(let l=0;l<t.length;l++){const n=t[l],o=e.rowById[n.id];if(o){const t=o.getCell(n.dataField),l=e._pasteDataType({cell:t,value:t.value});let i=null;"int"!==l&&"number"!==l||(i=0),"string"===l&&(i=""),"boolean"!==l&&"bool"!==l||(i=!1),"date"===l&&(i=new Date),t.column.allowNull&&(i=null);const a=t.oldValue;if(e.onCellUpdate)e.onCellUpdate([t],[a],[i],(function(e){e&&(t.value=i)}),e);else if(e.onRowUpdate){const l=Object.assign({},t.row.data),n=Object.assign({},t.row.data);n[t.column.dataField]=i,e.onRowUpdate([t.row.index],[t.row],[l],[n],(function(e){e&&(t.value=i)}),e)}else t.value=i}}e.endUpdate(!1),e._recycle(),delete e._cutCells}}_setRemoveUndoRedo(e){const t=this;if(!t.isInitialized)return;const l=Smart.Utilities.Core.createGUID().replace(/-/gi,"");if(!t._undoRedoAction){t._undoRedo||(t._undoRedo=[]),t._removeUndoRedoHigherIndexes();const n=t.getRowData(e.id);t._undoRedo.push({action:"remove",data:n,index:e.visibleIndex,uid:l}),t._undoRedoIndex=t._undoRedo.length-1}}_setAddUndoRedo(e){const t=this;if(!t.isInitialized)return;const l=Smart.Utilities.Core.createGUID().replace(/-/gi,"");if(!t._undoRedoAction){let n=!1;for(let l=0;l<t._undoRedo.length;l++){const o=t._undoRedo[l];"add"===o.action&&o.index===e.index&&(n=!0)}if(n)return;t._removeUndoRedoHigherIndexes();const o=t.getRowData(e.id);t._undoRedo.push({action:"add",data:o,index:e.visibleIndex,uid:l}),t._undoRedoIndex=t._undoRedo.length-1}}_removeUndoRedoHigherIndexes(){const e=this,t=e._undoRedoIndex;t>=0?e._undoRedo.splice(t+1,e._undoRedo.length-t):-1===t&&(e._undoRedo=[])}_setCellUndoRedo(e,t,l){const n=this;if(!n.isInitialized)return;const o=Smart.Utilities.Core.createGUID().replace(/-/gi,"");n._setCellUndoRedoTimer&&clearTimeout(n._setCellUndoRedoTimer),n._undoRedoAction||(n._pasteUndoRedoValues||(n._pasteUndoRedoValues=[]),void 0===t&&(t=null),n._pasteUndoRedoValues.push({cell:e,index:e.row.index,dataField:e.column.dataField,oldValue:t,newValue:l}),n._setCellUndoRedoTimer=setTimeout((()=>{delete n._setCellUndoRedoTimer,n._removeUndoRedoHigherIndexes(),n._undoRedo||(n._undoRedo=[]),n._pasteUndoRedoValues.length>1?n._undoRedo.push({action:"updateMultiple",items:n._pasteUndoRedoValues,uid:o}):n._undoRedo.push({action:"update",index:e.row.visibleIndex,cell:e,dataField:e.column.dataField,oldValue:t,newValue:l,uid:o}),n._undoRedoIndex=n._undoRedo.length-1,n._pasteUndoRedoValues=[]}),50))}_undoRedoHandler(e){const t=this,l=e.key;if(e.ctrlKey||e.metaKey){if("z"===l)return t.undo(),void e.preventDefault();if("y"===l)return t.redo(),void e.preventDefault()}}_updateMultiple(e,t){const l=this;let n=9999999,o=0,i=999999,a=0,s=l._recyclingRows,r=[],d=[],c=[];l.beginUpdate();for(let u=0;u<e.items.length;u++){const f=e.items[u],p=s[f.index];if(p){const e=p.id,s=f.dataField,u=t?f.oldValue:f.newValue,m=l.columnByDataField[s],g=l.viewColumns.indexOf(m),_=p.getCell(s);_&&(r.push(_),d.push(_.value),c.push(u)),i=Math.min(i,g),a=Math.max(a,g),n=Math.min(n,p.visibleIndex),o=Math.max(o,p.visibleIndex),l.setCellValue(e,s,u)}}l.onCellUpdate&&r.length&&l.onCellUpdate(r,d,c,(function(){}),l),l._focusCell(s[n].id,l.viewColumns[i].dataField),l._selectCellsRange(s[n],s[o],l.viewColumns[i].dataField,l.viewColumns[a].dataField),delete l._undoRedoAction,l.endUpdate(!1)}redo(){const e=this,t=e._undoRedoIndex,l=e._undoRedo[t+1];if(l)switch(e._undoRedoIndex++,e._undoRedoAction=!0,l.action){case"add":e.addRow(l.data,!0);break;case"remove":{const t=e._recyclingRows[l.index];t&&(e.removeRow(t.id),delete e._undoRedoAction);break}case"update":{const t=e.rows[l.index];if(t){const n=t.id,o=l.dataField,i=l.newValue,a=l.oldValue,s=t.getCell(o);s&&(e.setCellValue(n,o,i),e._focusCell(n,o),e.onCellUpdate&&e.onCellUpdate([s],[a],[i],(function(){e.onCellUpdated&&e.onCellUpdated([s.row.index],[s.row],[s.column],[s.row.data],[a],[i],e),e._onCellUpdated&&e._onCellUpdated(s.row.index,s.row,s.column,s.row.data,a,i)}),e))}delete e._undoRedoAction;break}case"updateMultiple":e._updateMultiple(l,!1)}else delete e._undoRedoAction}getEditChanges(){return this._undoRedo}undo(){const e=this,t=e._undoRedoIndex,l=e._undoRedo[t];if(l)switch(e._undoRedoIndex--,e._undoRedoAction=!0,l.action){case"add":{const t=e._recyclingRows[l.index];t&&(e.removeRow(t.id),delete e._undoRedoAction);break}case"remove":{const t=l.data;t&&(e._recyclingRows[l.index]?e.insertRow(t,l.index):e.addRow(t,!0));break}case"update":{const t=e.rows[l.index];if(t){const n=t.id,o=l.dataField,i=l.oldValue;let a=e._cellsUpdatedValues?e._cellsUpdatedValues[n+"_"+o]:void 0;void 0!==a&&delete e._cellsUpdatedValues[n+"_"+o];const s=t.getCell(o);s&&(void 0===a&&(a=s.value),e.setCellValue(n,o,i),e._focusCell(n,o),e.onCellUpdate&&e.onCellUpdate([s],[a],[i],(function(){e.onCellUpdated&&e.onCellUpdated([s.row.index],[s.row],[s.column],[s.row.data],[a],[i],e),e._onCellUpdated&&e._onCellUpdated(s.row.index,s.row,s.column,s.row.data,a,i)}),e))}delete e._undoRedoAction;break}case"updateMultiple":e._updateMultiple(l,!0)}else e._currentUndoRedo=e._undoRedo[0],delete e._undoRedoAction}_keyDownHandler(e){const t=this;if("grid"!==t.view)return;if(t.onKey&&(t.onKey(e),e.defaultPrevented))return;let l=e.key;if(t.disabled||t.displayLoadingIndicator)return;if(t._undoRedoHandler(e),0===t.dataSource.length)return;if("CapsLock"===l)return;if("Escape"===l&&(t.editing.editRow||t.editing.editCell)){t.closeMenu(),t.cancelEdit();let l=t.getSelection().focused;return void(l&&l.dataField&&t._setSelection(l.id,l.dataField,e))}if(!t.editing.editKeyHandling&&(t.editing.editRow||t.editing.editCell||t.filtering.filterRow.cell))return;t.rightToLeft&&("ArrowLeft"===l?l="ArrowRight":"ArrowRight"===l&&(l="ArrowLeft")),t._refreshCellSelectionRect();const n=t.getSelection();let o=n.focused;if(!n.focused){if(t.editing.enabled&&!0!==t.editing.isEditing&&("F2"===l||"Enter"===l)&&n.columns&&n.columns.length>0){const e=n.columns[n.columns.length-1];e.column.allowHeaderEdit&&t._beginColumnEdit(e.column)}return t.menu&&t.menu.classList.contains("open")&&"Escape"===l&&t.closeMenu(),void(n.columns&&n.columns.length>0&&e.ctrlKey&&("c"!==l&&"v"!==l&&"x"!==l||t._clipboardHandler(l,e)))}if(e.shiftKey&&e.ctrlKey&&" "===l){const e=t.rowById[o.id];if(e){const t=e.getCell(o.dataField);if(t)return void t.autoWrap()}}const i=t._getParentCell(t.rowById[o.id],o.dataField);if(i&&("ArrowLeft"===l?(o.id=i.row.id,o.dataField=i.column.dataField):"ArrowRight"===l?(o.id=i.row.id,o.dataField=i.endColumn.dataField):"ArrowUp"===l?(o.id=i.row.id,o.dataField=i.column.dataField):"ArrowDown"===l&&(o.id=i.endRow.id,o.dataField=i.column.dataField)),t._selection.selectionRect&&e.shiftKey&&!e.ctrlKey&&!e.metaKey?(t._selection.selectionRect.endRow&&(o.id=t._selection.selectionRect.endRow.id),t._selection.selectionRect.endColumn&&(o.dataField=t._selection.selectionRect.endColumn.dataField)):t.selection.allowRowSelection&&!t.selection.allowCellSelection&&void 0!==t._rangeSelectionEndRow&&(o.id=t._rangeSelectionEndRow.id),e.ctrlKey||e.metaKey){const n=t.$.headerBar;n&&("b"===l&&(n._boldCommand(),e.preventDefault()),"i"===l&&(n._italicCommand(),e.preventDefault()),"u"===l&&(n._underlineCommand(),e.preventDefault()),"y"===l&&(n._strikethroughCommand(),e.preventDefault()))}if(t._clipboardHandler(l,e),((e.ctrlKey||e.metaKey)&&"x"!==l&&"c"!==l&&"v"!==l&&"Control"!==l||t.selection.allowCellSelection&&"Tab"===l)&&(t._selection.rows=[],t._selection.columns=[],t._selection.cells=[],t._selection.indexes=[]),"Escape"===l)return t.closeMenu(),t.cancelEdit(),void t._setSelection(o.id,o.dataField,e);if(t.hasMenu())return;if(e.shiftKey&&"Enter"===l&&t.rowDetail.dialog.enabled&&!t.rowDetail.dialog.visible){const l=t.rowById[o.id];if(l)return l.showDetail=!0,e.preventDefault(),void e.stopPropagation()}if(e.ctrlKey||e.metaKey){let n=!1;"f"===l&&(t.$.headerBar&&t.$.headerBar.openSearchPanel(),n=!0),"s"===l&&(t.$.headerBar&&t.$.headerBar.openSortPanel(),n=!0),"d"===l&&(t.$.headerBar&&t.$.headerBar._openDownloadMenu(),n=!0),"f"===l&&(t.$.headerBar&&t.$.headerBar.openFilterPanel(),n=!0),"w"===l&&(t.$.headerBar&&t.$.headerBar._openViewsMenu(),n=!0),n&&(e.stopPropagation(),e.preventDefault())}if(e.altKey){if("ArrowDown"===l){const l=t.columnByDataField[o.dataField];l&&t.hasColumnMenu(l)&&(l.element._showActionButton(),l.onAction(),t.menu&&t.menu.querySelector("smart-menu").$.dispatch(e))}else"ArrowUp"===l&&t.closeMenu();if("s"===l.toLowerCase()){const e=t.columnByDataField[o.dataField];e&&(e.sorted?"asc"===e.sortOrder?t.sortBy(e.dataField,"desc"):t.sortBy(e.dataField,null):t.sortBy(e.dataField,"asc"))}if("g"===l.toLowerCase()){const e=t.columnByDataField[o.dataField];e&&(e.group=!e.group)}return}const a=function(l,n){const o=(l,n)=>{if("extended"!==t.selection.mode&&"many"!==t.selection.mode&&t._clearSelection(!0),"many"===t.selection.mode){if(" "===e.key)t._setSelection(l,n,e);else{const e=t.rowById[l].getCell(n);t._selection.focusedCell={id:e.row.id,value:e.value,dataField:n,index:e.row.index}}return t.ensureVisible(l,n),void t._recycle()}"ArrowDown"===e.key||"ArrowUp"===e.key||"ArrowLeft"===e.key||"ArrowRight"===e.key?(t._setSelection(l,n,e),t.ensureVisible(l,n)):(t.beginUpdate(),t._setSelection(l,n,e),t.ensureVisible(l,n),t.endUpdate(!1,!1),"ArrowDown"===e.key||"ArrowUp"===e.key?t._recycle(!1,!0):t._recycle()),e.shiftKey?t.__selectionStarted&&!t.__selectionStartedFired?(t.$.fireEvent("change",{started:!0,finished:!1}),t.__selectionStartedFired=!0):t.$.fireEvent("change",{started:!1,finished:!1}):(t.$.fireEvent("change",{started:!1,finished:!0}),t._refreshSummary())};if(t._isVirtualMode()){t._keyboardNavigationTimer&&clearTimeout(t._keyboardNavigationTimer);const e=e=>{for(let l=0;l<t.rows.length;l++){const n=t.rows[l];if(n.index===e)return n.id}return null},i=l,a=JSON.parse(JSON.stringify(t._selection.focusedCell));t._selection.focusedCell.index=i,t._selection.focusedCell.dataField=n;const s=t.rows[0],r=s.height;if(-1===i)return;const d=t._scrollView.hScrollBar,c="virtual"!==t.scrolling?s.top:i*r;let u=0;if(t.paging.enabled||(c+d.offsetHeight+t.__frozenNearHeight>t._scrollView.scrollTop+t.$.scrollView.offsetHeight-t.__frozenFarHeight?(t._scrollView.scrollTop=c-t.$.scrollView.offsetHeight-t.__frozenFarHeight+d.offsetHeight,u=50):c<=t._scrollView.scrollTop&&(t._scrollView.scrollTop=c,u=50)),t._onDataUpdated||(t._onDataUpdated=()=>{t._recycle();const l=e(t._selection.focusedCell.index);t.rowById[l]?o(l,t._selection.focusedCell.dataField):t.paging.enabled&&(t._selection.focusedCell=a),t._onDataUpdated=null}),t.paging.enabled){const l=e(t._selection.focusedCell.index);t.rowById[l]?o(l,t._selection.focusedCell.dataField):t._selection.focusedCell=a}else t._keyboardNavigationTimer=setTimeout((()=>{const l=e(t._selection.focusedCell.index);t.rowById[l]&&o(l,t._selection.focusedCell.dataField)}),u)}else requestAnimationFrame((()=>{o(l,n)})),e.stopPropagation(),e.preventDefault()};if(t.keys&&t.keys[l]){const n=t.keys[l];switch(n){case"delete":if(o){const l=o.id,n=t.rowById[l];if(n)return t.updateRow(l,null,null,!0),e.stopPropagation(),e.preventDefault(),void t.$.fireEvent("endEdit",{id:l,dataField:null,row:n,column:null,cell:null,data:n?n.data:null,value:null})}break;case"deleteCell":if(o){const l=o.id,n=t.rowById[l],i=o.dataField;if(n){const o=t.columnByDataField[i];return void(o.allowEdit&&(t.setCellValue(l,i,""),e.stopPropagation(),e.preventDefault(),t.$.fireEvent("endEdit",{id:l,dataField:i,row:n,column:o,cell:n?n.getCell(i):null,data:n?n.data:null,value:null})))}}break;case"copy":case"copyPrev":case"copyNext":if(o){const l=o.id,i=t.rowById[l];if(i){if("copy"===n)return t._clipboardHandler("c",e),e.stopPropagation(),void e.preventDefault();if("copyPrev"===n){const l=t.prevRow(o.id);if(l)return t.updateRow(l.id,i.data,null,!0),e.stopPropagation(),e.preventDefault(),void t.$.fireEvent("endEdit",{id:l.id,dataField:null,row:l,column:null,cell:null,data:i?i.data:null,value:null})}else if("copyNext"===n){const l=t.nextRow(o.id);if(l)return t.updateRow(l.id,i.data,null,!0),e.stopPropagation(),e.preventDefault(),void t.$.fireEvent("endEdit",{id:l.id,dataField:null,row:l,column:null,cell:null,data:i?i.data:null,value:null})}}}break;default:if(["Backspace","Tab","Enter","Shift","Control","Alt","Pause","CapsLock","Escape","Space","PageUp","PageDown","End","Home","ArrowLeft","ArrowUp","ArrowRight","ArrowDown","Insert","Delete","0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","F1","F2","F3","F4","F5","F6","F7","F8","F9","F10","F11","F12","NumLock","ScrollLock","Semicolon","Equal","Comma","Minus","Period","Slash","Backquote","BracketLeft","Backslash","BracketRight","Quote"].indexOf(n)>=0)l=n;else{const l=o.id,i=t.rowById[l];if(t[n]&&"function"==typeof t[n])return t[n](t,i,e),e.stopPropagation(),void e.preventDefault();if(window[n]&&"function"==typeof window[n])return window[n](t,i,e),e.stopPropagation(),void e.preventDefault();if("function"==typeof n)return n(t,e),e.stopPropagation(),void e.preventDefault()}}t.$.fireEvent("keyPressed",e)}switch("Enter"!==l||!t.editing.enabled||"cell"!==t.editing.mode||t.editing.isEditing||t._editDownKey||(l="F2"),l){case"Tab":{if("none"===t.selection.tabKeyBehavior)return;const l=e.shiftKey?t.prevColumn(o.dataField):t.nextColumn(o.dataField);if(l&&t.selection.allowCellSelection){const n=t.rowById[o.id].getCell(l.dataField);t._selection.focusedCell={id:n.row.id,value:n.value,dataField:l.dataField,index:n.row.index},t._setSelection(o.id,l.dataField,e),t.ensureVisible(o.id,l.dataField),t.focus(),e.stopPropagation(),e.preventDefault()}else{let l=e.shiftKey?t.prevRow(o.id):t.nextRow(o.id),n=e.shiftKey?t.lastColumn().dataField:t.firstColumn().dataField;if(t.editing.addNewRow.autoCreate&&!e.shiftKey&&o.id===t.lastRow().id&&(t.addUnboundRow(1),l=t.lastRow()),!l)return;e.shiftKey&&(t._selection.focusedCell=null),a(t._isVirtualMode()?l.index:l.id,n)}t.$.fireEvent("change",{started:!1,finished:!0}),t._refreshSummary();break}case" ":case"F2":{const n=t.rowById[o.id];if(!n||t.editing.editCell)return;if(e.ctrlKey||e.metaKey)return;if(" "===l&&t.dataSource.boundHierarchy&&(n.checked=!n.checked),t.editing.enabled&&!e.shiftKey){const e=t.getSelectedCells();let i=!1;if(e.length>0){let l=[];for(let n=0;n<e.length;n++){const o=e[n],i=o[1],a=t.columnByDataField[i];!a||"bool"!==a.dataType&&"boolean"!==a.dataType||l.push(o)}if(l.length>0){i=!0,t.beginUpdate();const e=l[0],o=e[1],a=e[0],s=e[2],r=t.columnByDataField[o];t.$.fireEvent("beginEdit",{id:null,dataField:o,row:a,column:r,cell:null,data:null,value:s});const d=[],c=[],u=[],f=[],p=[];for(let e=0;e<l.length;e++){const n=l[e],o=n[1],i=n[0],a=n[2],s=t.rowById[i],m=s.getCell(o);p.push(s),f.push(t.columnByDataField[r]),u.push(m),c.push(!a),d.push(a),t.setCellValue(i,o,!a)}t.onCellUpdate&&t.onCellUpdate(u,d,c,(function(){}),t),t.$.fireEvent("endEdit",{id:n?n.id:null,dataField:o,row:n,column:r,cell:e,data:n?n.data:null,value:!s}),t.endUpdate(!1)}}i||(t._beginEdit(n,o.dataField),setTimeout((function(){if(t.editing.editCell&&t.editing.editCell.column.dataType.indexOf("bool")>=0){const e=t.editing.editCell.editor.instance,n=e.getValue();" "===l&&e.setValue(!n)}}),50))}else t.selection.enabled&&"many"===t.selection.mode&&(t._isVirtualMode()?a(o.index,o.dataField):a(o.id,o.dataField));break}case"Delete":case"Backspace":{const e=t.rowById[o.id];if(!e||t.editing.editCell)return;if(t.editing.enabled)if(e.getCell(o.dataField).value,n.cells){t.beginUpdate();for(let e=0;e<n.cells.length;e++){const l=n.cells[e],o=t.rowById[l.id];if(o){const e=o.getCell(l.dataField);if(!e.column.allowEdit)continue;if("image"===e.column.template){const l=e.value,n=l&&l.indexOf("[{")>=0?JSON.parse(l):[];for(let e=0;e<n.length;e++){if(t.uploadSettings.removeUrl){let l=new FormData,o=new XMLHttpRequest,i=n[e].value;l.append(t.uploadSettings.name,i),o.open("POST",t.uploadSettings.removeUrl),o.send(l)}t.uploadSettings.onUploadRemove&&t.uploadSettings.onUploadRemove(n[e])}}const n=t._pasteDataType({cell:e,value:e.value});let i=null;"int"!==n&&"number"!==n||(i=0),"string"===n&&(i=""),"boolean"!==n&&"bool"!==n||(i=!1),"date"===n&&(i=new Date),e.column.allowNull&&(i=null),e.formula=null;const a=e.value;if(t.dataSource&&t.dataSource.virtualDataSource){const n={};if(t.onCellUpdate){t._pasteTempValues||(t._pasteTempValues=[]);const n=i;t._pasteTempValues.push({id:e.row.id,cell:e,dataField:l.column.dataField,oldValue:a,newValue:n}),t._pasteTimer&&clearTimeout(t._pasteTimer),t._pasteTimer=setTimeout((()=>{const l=(e,l)=>{const n=e.row;if(n){let o=null;if(t.storeHistory&&(o=t._stringifyRow(n)),l!==(void 0!==e.value?e.value:"")&&(n.updatedDate=new Date,n.updatedBy=t.currentUser,t.storeHistory)){e.value=l;const i=t._stringifyRow(n);t._updateRowHistory(n,o,i)}}};if(t._pasteTempValues&&t._pasteTempValues.length>1){let e=[],n=[],o=[];for(let l=0;l<t._pasteTempValues.length;l++){const i=t._pasteTempValues[l];e.push(i.cell),n.push(i.oldValue),o.push(i.newValue)}t.onCellUpdate(e,n,o,(function(n){if(n){const n=t.onRowHistory;t.onRowHistory=null,t.beginUpdate();for(let t=0;t<e.length;t++){const n=e[t];l(n,o[t]),n.value=o[t]}t.endUpdate(!1),t.onRowHistory=n}}),t)}else t.onCellUpdate([e],[a],[n],(function(o){if(o){const o=t.onRowHistory;t.onRowHistory=null,l(e,n),e.value=n,t.onRowHistory=o}}),t);delete t._pasteTempValues}),100)}else if(t.onRowUpdate){const l=Object.assign({},e.row.data),n=Object.assign({},e.row.data);n[e.column.dataField]=i,t.onRowUpdate(e.row.index,e.row,l,n,(function(t){t&&(e.value=i)}),t)}else n[e.column.dataField]=i;t.editing.batch?t._batchUpdateCell(e.row,e.column,i,e.value):t.updateRow(e.row.id,n)}else if(t._setCellUndoRedo(e,a,i),t.onCellUpdate){t._pasteTempValues||(t._pasteTempValues=[]);const n=i;t._pasteTempValues.push({id:e.row.id,cell:e,dataField:l.column.dataField,oldValue:a,newValue:n}),t._pasteTimer&&clearTimeout(t._pasteTimer),t._pasteTimer=setTimeout((()=>{const l=(e,l)=>{const n=e.row;if(n){let o=null;if(t.storeHistory&&(o=t._stringifyRow(n)),l!==(void 0!==e.value?e.value:"")&&(n.updatedDate=new Date,n.updatedBy=t.currentUser,t.storeHistory)){e.value=l;const i=t._stringifyRow(n);t._updateRowHistory(n,o,i)}}};if(t._pasteTempValues&&t._pasteTempValues.length>1){let e=[],n=[],o=[];for(let l=0;l<t._pasteTempValues.length;l++){const i=t._pasteTempValues[l];e.push(i.cell),n.push(i.oldValue),o.push(i.newValue)}t.onCellUpdate(e,n,o,(function(n){if(n){const n=t.onRowHistory;t.onRowHistory=null,t.beginUpdate();for(let t=0;t<e.length;t++){const n=e[t];l(n,o[t]),n.value=o[t]}t.endUpdate(!1),t.onRowHistory=n}}),t)}else t.onCellUpdate([e],[a],[n],(function(o){if(o){const o=t.onRowHistory;t.onRowHistory=null,l(e,n),e.value=n,t.onRowHistory=o}}),t);delete t._pasteTempValues}),100)}else if(t.onRowUpdate){const l=Object.assign({},e.row.data),n=Object.assign({},e.row.data);n[e.column.dataField]=i,t.onRowUpdate(e.row.index,e.row,l,n,(function(t){t&&(e.value=i)}),t)}else e.value=i;t._conditionalColors&&t._conditionalColors.update&&setTimeout((()=>{t._conditionalColors.update(),t._recycle(!1)}),100)}}t.endUpdate(!1),t._recycle(),t._refreshDataFilters()}else{const e=t._getSelectedRows();if(e&&e.length&&t._selection.rows&&Object.keys(t._selection.rows).length>0){const e=t.getSelectedRows();if(e.length>=1)return void e.map((e=>e[0])).forEach((e=>{requestAnimationFrame((()=>{t.updateRow(e,null,null,!0)}))}))}}break}default:if(t.editing.enabled&&!t.editing.editCell&&!e.ctrlKey&&!e.metaKey&&!e.altKey&&!t.editing.editRow){const e=t.rowById[o.id];if(!e)return;if(["F1","F2","F3","F4","F5","F6","F7","F8","F9","F10","F11","F12","Shift","Up","Down","Left","Right","Control","F2","Esc"," ","Home","End","PageUp","PageDown"].indexOf(l)>=0)return;t._beginEditKey=l,t._beginEdit(e,o.dataField),setTimeout((function(){if(t.editing.editCell)t.editing.editCell.editor.instance.setValue(t._beginEditKey);else if(t.editing.editRow){const e=t.editing.editRow.getCell(o.dataField);if(!e)return;e.editor.instance.setValue(t._beginEditKey)}delete t._beginEditKey}),50)}break;case"Home":{const l=t.firstRow();if(t.paging.enabled&&e.shiftKey)return t.firstPage(),e.stopPropagation(),void e.preventDefault();if(!l)return;a(l.id,o.dataField);break}case"End":{if(t.paging.enabled&&e.shiftKey)return t.lastPage(),e.stopPropagation(),void e.preventDefault();const l=t.lastRow();if(!l)return;a(l.id,o.dataField);break}case"PageUp":{const l=t._recyclingRows,n=t.rowById[o.id],i=l.indexOf(n);if(t.paging.enabled&&e.shiftKey)return t.prevPage(),e.stopPropagation(),void e.preventDefault();if(t._isVirtualMode()){const e=Math.round(t.$.scrollView.offsetHeight/t.rows[0].height);a(Math.max(o.index-e,0),o.dataField)}else{for(let e=i;e>=0;e--){const i=l[e];if(n.top-i.top>=t.$.scrollView.offsetHeight)return void a(i.id,o.dataField)}a(t.firstRow().id,o.dataField)}break}case"PageDown":{const l=t._recyclingRows,n=t.rowById[o.id],i=l.indexOf(n);if(t.paging.enabled&&e.shiftKey)return t.nextPage(),e.stopPropagation(),void e.preventDefault();if(t._isVirtualMode()){const e=Math.round(t.$.scrollView.offsetHeight/t.rows[0].height);a(Math.min(o.index+e,t.dataSource.virtualDataSourceLength-1),o.dataField)}else{for(let e=i;e<l.length;e++){const i=l[e];if(i.top-n.top>=t.$.scrollView.offsetHeight)return void a(i.id,o.dataField)}a(t.lastRow().id,o.dataField)}break}case"Enter":case"ArrowDown":if(t._isVirtualMode())a(e.ctrlKey||e.metaKey?t.lastRow():o.index+1,o.dataField);else{let n=e.ctrlKey||e.metaKey?t.lastRow():t.nextRow(o.id);if(!t.editing.addNewRow.autoCreate||"Enter"!==l||o.id!==t.lastRow().id||e.ctrlKey||e.metaKey||(t.addUnboundRow(1),n=t.lastRow()),!n)return;let i=!0;"Enter"===l&&(e.ctrlKey||e.metaKey)&&(i=!1),i&&a(n.id,o.dataField)}break;case"ArrowUp":if(t._isVirtualMode())a(e.ctrlKey||e.metaKey?t.lastRow():Math.max(0,o.index-1),o.dataField);else{const l=e.ctrlKey||e.metaKey?t.firstRow():t.prevRow(o.id);if(!l)return;a(l.id,o.dataField)}break;case"ArrowRight":{const l=t.rowById[o.id],n=!!t.columnByDataField[o.dataField]&&t.columnByDataField[o.dataField]._treeColumn;if((!t.selection.allowCellSelection||n)&&!1===l.leaf){if(!l.expanded)return l.expand(),e.stopPropagation(),void e.preventDefault();{const e=t.nextRow(o.id);if(e)return void a(e.id,o.dataField)}}const i=e.ctrlKey||e.metaKey?t.lastColumn():t.nextColumn(o.dataField);if(!i)return;a(t._isVirtualMode()?o.index:o.id,i.dataField);break}case"ArrowLeft":{const l=t.rowById[o.id],n=!!t.columnByDataField[o.dataField]&&t.columnByDataField[o.dataField]._treeColumn;if(!t.selection.allowCellSelection||n){if(!1===l.leaf)return void(l.expanded?(l.collapse(),e.stopPropagation(),e.preventDefault()):l.parent&&a(l.parent.id,o.dataField));if(!0===l.leaf&&l.parent)return void a(l.parent.id,o.dataField)}const i=e.ctrlKey||e.metaKey?t.firstColumn():t.prevColumn(o.dataField);if(!i)return;a(t._isVirtualMode()?o.index:o.id,i.dataField);break}}["Shift","Up","Down","Left","Right","Control","F2","Esc"," ","Home","End","PageUp","PageDown"].indexOf(l)<0||(e.stopPropagation(),e.preventDefault())}_keyUpHandler(e){const t=this;"Escape"===e.key&&t._dragDrop&&t._endDrag(e),t._focused&&("Shift"===e.key&&(t.$.fireEvent("change",{started:!1,finished:!0}),t._refreshSummary()),!t.onKeyUp||(t.onKeyUp(e),e.defaultPrevented))}firstRow(){const e=this._recyclingRows;if(this._isVirtualMode())return{id:0};if(e&&e.length>0){if(!e[0].autoGenerated&&e[0].allowSelect)return e[0];for(let t=0;t<e.length;t++)if(!e[t].autoGenerated&&e[t].allowSelect)return e[t]}return null}lastRow(){const e=this,t=e._recyclingRows;if(e._isVirtualMode())return{id:e.dataSource.virtualDataSourceLength-1};if(t&&t.length>0){const e=t[t.length-1];if(!e.autoGenerated&&e.allowSelect)return e;for(let e=t.length-1;e>=0;e--)if(!t[e].autoGenerated&&t[e].allowSelect)return t[e]}return null}nextRow(e){const t=this._recyclingRows,l=this.rowById[e],n=t.indexOf(l);let o=1;if(l&&void 0!==l._rowSpan&&(o=l._rowSpan),n>=0&&t[n+o]&&!t[n+o].autoGenerated){const e=t[n+o];if(e.allowSelect&&!e.disabled)return e;for(let e=n+o;e<t.length;e++){const l=t[e];if(l.allowSelect&&!l.disabled)return l}}return null}_isVirtualMode(){const e=this;return e.dataSource&&e.dataSource.virtualDataSource&&!e.dataSource.virtualDataSourceOnExpand&&e.dataSource.length>e.virtualModeCachedRowsCount&&"infinite"!==e.scrolling}prevRow(e){const t=this,l=t._recyclingRows,n=t.rowById[e],o=l.indexOf(n);if(t._isVirtualMode())return 0===e?null:{id:n.index-1};if(o>=0&&l[o-1]&&!l[o-1].autoGenerated){const e=l[o-1];if(e.allowSelect&&!e.disabled)return e;for(let e=o-1;e>=0;e--){const t=l[e];if(t.allowSelect&&!t.disabled)return t}}return null}firstColumn(){const e=this.viewColumns;if(e&&e.length>0)for(let t=0;t<e.length;t++){const l=e[t];if(l.allowSelect&&!l.autoGenerated)return l}return null}lastColumn(){const e=this.viewColumns;if(e&&e.length>0)for(let t=e.length-1;t>=0;t--){const l=e[t];if(l.allowSelect&&!l.autoGenerated)return l}return null}nextColumn(e){const t=this.viewColumns,l=this.columnByDataField[e];let n=t.indexOf(l);for(;n<t.length;){const e=t[n+1];if(!e)return null;if(e.autoGenerated)return null;if(e.visible)return e;n++}return null}prevColumn(e){const t=this.viewColumns,l=this.columnByDataField[e];let n=t.indexOf(l);for(;n>0;){const e=t[n-1];if(e.autoGenerated)return null;if(e.visible)return e;n--}return null}isJSON(e){if("string"!=typeof e)return!1;const t=e.trim();if(!t)return!1;if(t.startsWith("{")&&t.endsWith("}")||t.startsWith("[")&&t.endsWith("]"))try{const e=new Function("return "+t)();return e&&"object"==typeof e}catch(e){return!1}return!1}isVisible(e,t){const l=this,n=l._scrollView.vScrollBar,o=l._scrollView.hScrollBar,i=l.rowById[e],a=l.columnByDataField[t];return{row:function(e){if(!e)return!1;const t=e.visibleIndex;if(-1===t)return!1;const n=l.dataSource&&l.dataSource.virtualDataSource&&!l.dataSource.virtualDataSourceOnExpand&&l.dataSource.length>l.virtualModeCachedRowsCount&&"infinite"!==l.scrolling;let i=e.top;return n&&(i=t*l.rows[0].height),!(i+e.height+o.offsetHeight+l.__frozenNearHeight>=l._scrollView.scrollTop+l.$.scrollView.offsetHeight-l.__frozenFarHeight||i<=l._scrollView.scrollTop)}(i),column:function(e){return!!t&&!(-1===e.visibleIndex||e.left+e.computedWidth+n.offsetWidth>=l._scrollView.scrollLeft+l._clientSize.width||e.left<=l._scrollView.scrollLeft)}(a)}}_ensureRowVisible(e){const t=this;if(!t._scrollView)return;const l=t._scrollView.hScrollBar;if(!e)return;const n=e.visibleIndex;if(-1===n)return;const o="virtual"!==t.scrolling?e.top:n*t.rows[0].height,i=t.summaryRow.visible?t.layout.rowMinHeight:0;if(o+e.height+l.offsetHeight+t.__frozenNearHeight>=t._scrollView.scrollTop+t.$.scrollView.offsetHeight-t.__frozenFarHeight-i&&(t._scrollView.scrollTop=o+e.height-t.$.scrollView.offsetHeight+t.__frozenNearHeight+t.__frozenFarHeight+l.offsetHeight+i),o<=t._scrollView.scrollTop&&(t._scrollView.scrollTop=o),t.paging.enabled){const o=t.paging.pageSize,i=Math.floor(n/o);if(t.paging.pageIndex!==i)return t.goToPage(i),t._scrollView.scrollTop=0,void setTimeout((()=>{e.top+e.height+l.offsetHeight+t.__frozenNearHeight>=t._scrollView.scrollTop+t.$.scrollView.offsetHeight-t.__frozenFarHeight&&(t._scrollView.scrollTop=e.top+e.height),e.top<=t._scrollView.scrollTop&&(t._scrollView.scrollTop=e.top)}),50)}0===n?t._scrollView.scrollTop=0:n===t.dataSource.length-1&&(t.hasAttribute("tree")?n===t.getViewRows().length-1&&(t._scrollView.scrollTop=t._scrollView.scrollHeight):t._scrollView.scrollTop=t._scrollView.scrollHeight)}_ensureColumnVisible(e){const t=this,l=t._scrollView.vScrollBar;if(!e)return;const n=e.visibleIndex;-1!==n&&(e.left+e.computedWidth+l.offsetWidth>=t._scrollView.scrollLeft+t._clientSize.width&&(t._scrollView.scrollLeft=t._scrollView.scrollLeft+e.computedWidth),e.left<=t._scrollView.scrollLeft&&(t._scrollView.scrollLeft=e.left),e.left<=t._frozenColumnsNearWidth+t._scrollView.scrollLeft&&!e.freeze&&t._frozenNearColumns.length>1&&(t._scrollView.scrollLeft=e.left-t._frozenColumnsNearWidth),0===n?t._scrollView.scrollLeft=0:n===t.columns.length-1&&(t._scrollView.scrollLeft=t._scrollView.scrollWidth))}ensureVisible(e,t){const l=this,n=l.rowById[e],o=l.columnByDataField[t];if("virtual"===l.scrolling){const e=l._scrollView.hScrollBar,t=n.visibleIndex*l.rows[0].height,i=l.summaryRow.visible?l.layout.rowMinHeight:0;return t+n.height+e.offsetHeight+l.__frozenNearHeight>=l._scrollView.scrollTop+l.$.scrollView.offsetHeight-l.__frozenFarHeight-i&&l.setVerticalScrollValue(t),void l._ensureColumnVisible(o)}l._ensureRowVisible(n),l._ensureColumnVisible(o)}clearPaste(e,t="text/html",l="keepFormat"){let n;if(e=e.replace(/<!--StartFragment-->|<!--EndFragment-->/gi,""),!t||"plainText"===l){const t=document.createElement("div");t.innerHTML=e,e=t.innerText}const o=e.toLocaleLowerCase();if(n=document.createElement("span"),e=(e=>{let t=document.createElement("div");t.innerHTML=e,["o:p","w:","v:","xml"].forEach((e=>{let l=t.getElementsByTagName(e);for(;l.length>0;)l[0].remove()})),t.querySelectorAll("b").forEach((e=>e.outerHTML=e.outerHTML.replace("<b","<strong").replace("</b>","</strong>"))),t.querySelectorAll("i").forEach((e=>e.outerHTML=e.outerHTML.replace("<i","<em").replace("</i>","</em>"))),t.querySelectorAll("*[style]").forEach((e=>{const t=["color","background-color","font-weight","font-style"],l=e.getAttribute("style");if(l){let n="";l.split(";").forEach((e=>{let[l,o]=e.split(":");l=l&&l.trim(),o=o&&o.trim(),t.includes(l)&&(n+=`${l}: ${o}; `)})),n.trim()?e.setAttribute("style",n.trim()):e.removeAttribute("style")}})),t.innerHTML=t.innerHTML.replace(/\r?\n|\r/g," "),t.innerHTML=t.innerHTML.replace(/(<br\s*\/?>\s*){2,}/g,"<br>"),t.innerHTML=t.innerHTML.replace(/(<p>(\s|&nbsp;)*<\/p>\s*){2,}/g,"<p></p>"),t.innerHTML=t.innerHTML.replace(/(\s|&nbsp;){2,}/g," "),t.innerHTML=t.innerHTML.replace(/>\s+</g,"><"),t.innerHTML=t.innerHTML.replaceAll("·",""),t.innerHTML=t.innerHTML.replaceAll('class="MsoNormal"',""),t.innerHTML=t.innerHTML.replace(/<!--.*?-->/gs,""),["div","span"].forEach((e=>{let l=t.getElementsByTagName(e);Array.from(l).forEach((e=>{let t=e.parentNode;for(;e.firstChild;)t.insertBefore(e.firstChild,e);t.removeChild(e)}))})),t.querySelectorAll("p, div, span").forEach((e=>{e.textContent.trim()||e.querySelector("img")||e.querySelector("a")||e.remove()}));let l=t.innerHTML;return l.replace(/[\u2018\u2019]/g,"'").replace(/[\u201C\u201D]/g,'"').replace(/\u2013/g,"-").replace(/\u2014/g,"--").replace(/\u2026/g,"...").replace(/\u00A0/g," ").replace(/\uFEFF/g,"").replace(/[\u200B-\u200D]/g,"").replace(/[\u202A-\u202E]/g,""),l})(e),n.innerHTML=e,o.indexOf("<video")>-1||o.indexOf("<iframe")>-1||o.indexOf("smart-editor-image-caption")>-1){const e=n.querySelectorAll("video, iframe"),t=n.querySelector(".smart-editor-image-caption"),l=e.length>0;let o=document.createDocumentFragment();for(let t=0,l=e.length;t<l;t+=1)o.appendChild(e[t]);if(t&&(t.removeAttribute("style"),o.appendChild(t)),l||t){const e=document.createElement("span");n.classList.add("smart-editor-image-container"),l&&n.classList.add("smart-editor-video-container"),n.setAttribute("contenteditable",!1),o.childElementCount&&(n.innerHTML="",n.appendChild(o)),e.appendChild(n),n=e}}return"keepFormat"===l&&(e=>{if(e&&e.nodeType!==Node.TEXT_NODE){const t=e.querySelectorAll("style, [style]");for(let e=0,l=t.length;e<l;e+=1){const l=t[e];"style"===l.nodeName.toLowerCase()?l.remove():t[e].removeAttribute("style")}e.removeAttribute("style")}})(n),n.innerHTML}clearSelection(){const e=this;delete e._rangeSelectionStartRow,delete e._rangeSelectionEndRow,delete e._areAllRowsSelected,e._clearSelection(!0),e.$.fireEvent("change",{started:!1,finished:!0}),e._refreshSummary()}});
1526
+ Smart.Utilities.Assign("Grid.Select",class{_refreshSelection(){const e=this;if(e.selection.enabled&&(e._selectionColumn.refresh(),!e._isVirtualMode()&&e._selection&&e._selection.rows))for(let t in e._selection.rows)e.rowById[t]||delete e._selection.rows[t];e._refreshCellSelectionRect()}_toggleColumnSelection(e){const t=this;if(!t.selection.enabled||"none"===t.selection.checkBoxes.selectAllMode)return void(t._inputOverlay&&t._inputOverlay.parentNode&&t._inputOverlay.parentNode.removeChild(t._inputOverlay));let l=e.element.getAttribute("selected");l="indeterminate"===l||""!==l;let n=t._recyclingRows;if(t._selectionColumn._selecting=!0,t.beginUpdate(),t.paging.enabled&&"page"===t.selection.checkBoxes.selectAllMode){let e=t.paging.pageIndex*t.paging.pageSize,l=(t.paging.pageIndex+1)*t.paging.pageSize;for(let n=e;n<l;n++)delete t._selection.indexes[n]}else t._selection.indexes=[];if(t.paging.enabled&&"all"===t.selection.checkBoxes.selectAllMode){let e=t.getVisibleRows();for(let t=0;t<e.length;t++)e[t].selected=l}else for(let e=0;e<n.length;e++)n[e].selected=l;if(t._selectionColumn._selecting=!1,t.endUpdate(!1),t._isVirtualMode())if(l)for(let e=0;e<t.dataSource.virtualDataSourceLength;e++){if(t.paging.enabled&&"page"===t.selection.checkBoxes.selectAllMode){let l=t.paging.pageIndex*t.paging.pageSize,n=(t.paging.pageIndex+1)*t.paging.pageSize;if(e<l||e>=n)continue}l&&(t._selection.indexes[e]=e,t._selection.rows[e]=e)}else{let e=!0;t.paging.enabled&&"page"===t.selection.checkBoxes.selectAllMode&&(e=!1),e&&(t._selection.indexes=[],t._selection.rows=[])}if(t._recycle(!1),t.$.fireEvent("change",{started:!1,finished:!0}),t.selection.enabled&&t.selection.checkBoxes.enabled&&"none"!==t.selection.checkBoxes.selectAllMode){const l=e.element,n=l.querySelector(".smart-input");t._inputOverlay?t._inputOverlay.parentNode!==t.$.columnHeader&&(t._inputOverlay.parentNode&&t._inputOverlay.parentNode.removeChild(t._inputOverlay),t._inputOverlay=document.createElement("div"),t.$.columnHeader.appendChild(t._inputOverlay)):(t._inputOverlay=document.createElement("div"),t.$.columnHeader.appendChild(t._inputOverlay)),t._inputOverlay.column=e,t._inputOverlay.onpointerdown=function(){t._inputOverlay||(t._inputOverlay.onpointerdown=null);const e=t._inputOverlay.column;t._inputOverlay.classList.remove("smart-animate"),t._selectionColumn._selecting=!0,t.beginUpdate();let l=e.element.hasAttribute("selected"),n=t._recyclingRows;t.paging.enabled&&"all"===t.selection.checkBoxes.selectAllMode&&(n=t.getVisibleRows());for(let e=0;e<n.length;e++)n[e].selected=!l;t._selectionColumn._selecting=!1;const o=t._inputOverlay;if(t.endUpdate(!1),t._isVirtualMode())if(l)t._selection.indexes=[],t._selection.rows=[];else for(let e=0;e<t.dataSource.virtualDataSourceLength;e++){if(t.paging.enabled&&"page"===t.selection.checkBoxes.selectAllMode){let l=t.paging.pageIndex*t.paging.pageSize,n=(t.paging.pageIndex+1)*t.paging.pageSize;if(e<l||e>=n)continue}t._selection.indexes[e]=e,t._selection.rows[e]=e}return t._recycle(),t.$.fireEvent("change",{started:!1,finished:!0}),t.$.fireEvent("columnClick",{column:e,dataField:e.dataField}),t.$.columnHeader.appendChild(o),t._inputOverlay=o,t._inputOverlay.classList.add("smart-animate"),!1},t._inputOverlay.classList.add("smart-input-overlay"),t._inputOverlay.classList.add("smart-input-overlay-column"),t.appearance.allowCheckBoxesSelectionAnimation&&t._inputOverlay.classList.add("smart-animate"),t._inputOverlay.style.top=(l.offsetHeight-n.offsetHeight)/4+1+"px";const o=t._selectionColumn.element.parentElement.offsetLeft+t._selectionColumn.element.offsetLeft;t.rightToLeft?t._inputOverlay.style.right=o+"px":t._inputOverlay.style.left=o+"px",t._inputOverlay.style.height=l.offsetWidth+"px",t._inputOverlay.style.width=l.offsetWidth+"px",t._inputOverlay.onmousedown=null,t._inputOverlay.classList.add("smart-input-overlay-on"),t._selectionColumn.refresh()}}_refreshCheckBoxColumnSelection(){const e=this;if(e.selection.enabled&&e.selection.checkBoxes.enabled){const t=e._selectionColumn.element;t&&("none"===e.selection.checkBoxes.selectAllMode?(t.removeAttribute("checkbox"),t.label.classList.remove("smart-input")):(t.setAttribute("checkbox",""),t.label.classList.add("smart-input"))),e._selectionColumn.refresh()}}_handleExtendedRowSelection(e,t){const l=this;if(!e)return;let n=l._recyclingRows;if(l.paging.enabled&&"page"===l.selection.selectAllMode&&(n=n.slice(l.paging.pageIndex*l.paging.pageSize,(l.paging.pageIndex+1)*l.paging.pageSize)),!t||t.ctrlKey||t.metaKey||(l._selection.rows=[],l._selection.indexes=[]),t&&!t.shiftKey&&(l._rangeSelectionStartRow=e,l._rangeSelectionEndRow=e),t&&t.shiftKey){l._rangeSelectionEndRow=e;const t=n.indexOf(l._rangeSelectionStartRow),o=n.indexOf(l._rangeSelectionEndRow),i=Math.min(t,o),a=Math.max(t,o);if(-1===t||-1===o)return;for(let e=i;e<=a;e++){const t=n[e];t.allowSelect&&t.setProperty("selected",!0)}}else!1!==e.allowSelect&&(t&&(t.ctrlKey||t.metaKey)?null===e.selected?e.setProperty("selected",!0):e.setProperty("selected",!e.selected):e.setProperty("selected",!0))}_setSelection(e,t,l){const n=this;if(!n.selection.enabled)return;if(delete n._areAllRowsSelected,n._lastColumnSelectionRange=null,n._lastRowSelectionRange=null,n.closeMenu(),null===e&&null===t)return void n.clearSelection();const o=function(){if(l&&!l.ctrlKey&&!l.metaKey&&!l.shiftKey||"one"===n.selection.mode){if("many"!==n.selection.mode){for(let e in n._selection.rows){const t=n.rowById[e];t&&(t.canNotify=!1,t.selected=!1,t.canNotify=!0)}n._selection.indexes=[],n._selection.rows=[],n._selection.columns=[],n._selection.cells=[]}n._selection.focusedCell=null}if(n._selection.selectionRect){const e=n._selection.selectionRect;e.parentNode.removeChild(e);const t={down:"pointerdown",move:"pointermove",up:"pointerup"};Smart.Utilities.Core.isMobile&&(t.down="touchstart",t.move="touchmove",t.up="touchend"),document.removeEventListener(t.move,e.onMove),document.removeEventListener(t.up,e.onUp),document.removeEventListener(t.down,e.onDown),n._selection.selectionRect=null}};n.beginUpdate();const i=n.columnByDataField[t],a=()=>{const t=n.rowById[e];if(t&&(t.allowSelect||null===t.allowSelect&&!l))if(n.selection.checkBoxes.enabled&&l&&l.originalEvent&&l.originalEvent.target&&l.originalEvent.target.parentNode&&l.originalEvent.target.parentNode.hasAttribute("checkbox")&&(l.ctrlKey=!0),n.selection.allowRowHeaderSelection&&"extended"===n.selection.mode)if(!Object.keys(n._selection.cells).length>0&&n.appearance.showRowHeaderSelectIcon,t.selected){const e=n._selection.focusedCell?JSON.parse(JSON.stringify(n._selection.focusedCell)):null;o(),n._selection.focusedCell=e}else o(),n._selectRow(e,l);else o(),n._selectRow(e,l)};if(n.selection.allowCellSelection&&null!=e&&i&&!i.autoGenerated){const i=n.rowById[e];if(!i)return n.endUpdate(!1),void n._recycle();let a=i.getCell(t);const s=n._getParentCell(i,t);s&&(a=s.row.getCell(s.column.dataField)),a&&a.column.allowSelect&&(o(),!l||l.ctrlKey||l.metaKey||(n._selection.rows=[],n._selection.indexes=[],n._selection.columns=[],"many"!==n.selection.mode&&(n._selection.cells=[])),"extended"===n.selection.mode?l&&(l.ctrlKey||l.metaKey)?a.selected=!a.selected:a.selected=!0:"one"===n.selection.mode?a.selected=!0:a.selected=!a.selected,(l&&!l.shiftKey||!n._selection.focusedCell)&&(n._selection.focusedCell={id:a.row.id,value:a.value,index:a.row.index,dataField:a.column.dataField}),l&&(l.shiftKey||n._selection.focusedCell.id===a.row.id&&n._selection.focusedCell.dataField===a.column.dataField&&"extended"===n.selection.mode)&&(s?n._renderCellSelectionRect(a.row,a.column,s.endRow,s.endColumn):n._renderCellSelectionRect(a.row,a.column,a.row,a.column)))}else n.selection.allowRowHeaderSelection&&null!=e&&void 0===n.columnByDataField[t]||n.selection.checkBoxes.enabled&&null!=e&&"_checkBoxColumn"===t&&void 0===n.columnByDataField[t]?a():null==e||null!=t&&void 0===n.columnByDataField[t]||!n.selection.allowRowSelection?n.selection.allowColumnHeaderSelection&&i&&(o(),n._selectColumn(t,l||new KeyboardEvent("keydown"))):a();n.endUpdate(!1,!1),n._recycle(!0,!0,!1),null==e||i||n._renderInputOverlay(e,l),n.__selectionStarted=new Date}_deleteCopyRects(){const e=this;e._copyRects&&e._copyRects.forEach((e=>{e.remove()})),delete e._copiedRows,e._copyRects=[]}_createCopyRects(){const e=this,t=e._getSelectedRows();let l=[],n=null;e._deleteCopyRects();for(let o=0;o<t.length;o++){const i=t[o];i&&(n?(n&&n.visibleIndex===i.visibleIndex-1||n&&n.visibleIndex===i.visibleIndex+1||(l.length&&e._createCopyRect(l[0],l[l.length-1]),l=[]),l.push(i.id)):l.push(i.id),n=i)}l.length&&e._createCopyRect(l[0],l[l.length-1])}_createCopyRect(e,t,l,n){const o=this,i=document.createElement("div"),a=document.createElement("div"),s=document.createElement("div");s.classList.add("smart-selection-overlay","marching-ants"),s.appendChild(a),a.appendChild(i),i.classList.add("smart-selection-overlay-content"),a.classList.add("smart-selection-overlay-border-content");const r=o.rowById[e],d=o.rowById[t];if(o._deleteCopyRects(),!r||!d)return;let c=r.top;!0!==r.freeze&&"near"!==r.freeze&&(c+=o.__frozenNearHeight);const u=d.top-r.top+d.height;let f=o.columns[0].left,p=o.columns[o.columns.length-1].left+o.columns[o.columns.length-1].computedWidth-f;if(l){let e=o.columnByDataField[l],t=o.columnByDataField[n];e.left>t.left&&(e=o.columnByDataField[n],t=o.columnByDataField[l]),e&&(f=e.left,p=t.left+t.computedWidth-f)}const m=s;return m.style.top=c-o.scrollTop-1+"px",m.style.left=Math.max(0,f-o.scrollLeft)+"px",0===r.visibleIndex&&0===c&&0===o.scrollTop&&(m.style.top="0px"),m.style.height=u+1+"px",m.style.width=p+1+"px",p>300&&m.style.setProperty("--alt-duration",12*Math.ceil(p/180)+"s"),u>60&&m.style.setProperty("--duration",12*Math.ceil(u/180)+"s"),o.$.scrollView.appendChild(s),o._copyRects||(o._copyRects=[]),s.onpointerdown=e=>{o._deleteCopyRects(),o._rowDownHandler(e)},m.row=r,m.lastRow=d,m.dataField=l,m.lastDataField=n,o._copyRects.push(m),s}_refreshCopyRects(){const e=this;e._copyRects&&e._copyRects.forEach((t=>{const l=t.row,n=t.lastRow;let o=l.top;!0!==l.freeze&&"near"!==l.freeze&&(o+=e.__frozenNearHeight);const i=n.top-l.top+n.height;let a=e.columns[0].left,s=e.columns[e.columns.length-1].left+e.columns[e.columns.length-1].computedWidth-a,r=t.dataField,d=t.lastDataField,c=a-e.scrollLeft;const u=e.columns[e.columns.length-1];if(c<e._frozenColumnsNearWidth&&(c=e._frozenColumnsNearWidth,s=u.left+u.computedWidth-e.scrollLeft-e._frozenColumnsNearWidth),s=u.left+u.computedWidth-e.scrollLeft-e._frozenColumnsNearWidth,r){let t=e.columnByDataField[r],l=e.columnByDataField[d];t.left>l.left&&(t=e.columnByDataField[d],l=e.columnByDataField[r]),t&&(a=t.left,s=l.left+l.computedWidth-a,c=a-e.scrollLeft,c<e._frozenColumnsNearWidth&&(c=e._frozenColumnsNearWidth,s=l.left+l.computedWidth-e.scrollLeft-e._frozenColumnsNearWidth))}const f=t;f.style.top=o-e.scrollTop-1+"px",f.style.left=c+"px",0===l.visibleIndex&&0===o&&0===e.scrollTop&&(f.style.top="0px"),f.style.height=i+1+"px",f.style.width=s+1+"px",s<5?f.classList.add("smart-visibility-hidden"):f.classList.remove("smart-visibility-hidden")}))}_renderCellSelectionRect(e,t,l,n,o){const i=this;let a=i._recyclingRows;const s=a.indexOf(e),r=a.indexOf(l);if(!(i.grouping.enabled&&"advanced"===i.grouping.renderMode&&i.dataSource&&i.dataSource.groupBy.length>0)&&(i._mobile&&i._mobileSelect,s>=0&&r>=0)){if(!i._selection.selectionRect){const e=function(e){const t=document.createElement("div"),l=document.createElement("div"),n=document.createElement("div");return n.classList.add("smart-selection-overlay"),n.appendChild(l),l.appendChild(t),t.classList.add("smart-selection-overlay-content"),l.classList.add("smart-selection-overlay-border-content"),o&&n.classList.add(o),i.selection.allowCellDragSelectionHandle&&e&&l.classList.add("handle"),i.$.scrollView.appendChild(n),n},t=i._selection.selectionRect=e(!0);if(i.selection.allowCellDragSelectionHandle){let e=null,l=null,n=null;t.onMove=function(t){const o=i._selection.selectionRect;let s=t.clientX,r=t.clientY;t.touches&&(s=t.touches[0].clientX,r=t.touches[0].clientY);const d=function(e){const t=(i.enableShadowDOM?i.shadowRoot:i.getRootNode()).elementsFromPoint(e.clientX,e.clientY);let l=null;for(let e=0;e<t.length;e++){const n=t[e];if(n.getAttribute("data-field")){l=n.getAttribute("data-field");break}}let n=null;for(let e=0;e<t.length;e++){const l=t[e];if(l.getAttribute("data-id")){n=l.row;break}}return{column:i.columnByDataField[l],row:n}};if(o&&o.capturedDrag){let e=d({clientX:s,clientY:r}),l=d({clientX:s,clientY:r+o.top}).row,n=d({clientX:s+o.left,clientY:r}).column;if(l||(l=a[a.length-1]),n||(n=e.column),l&&n&&e.row&&e.column){o.row=e.row,o.rowId=o.row.id,o.column=e.column,o.endDragRow=o.endRow=l,o.endDragColumn=o.endColumn=n,o.endDragRowId=o.endDragRow.id,i._dragSelectionStartDataField=o.column.dataField,i._dragSelectionStartRow=o.row;const t=o.row.getCell(o.column.dataField);i._selection.focusedCell={index:t.row.index,id:t.row.id,dataField:t.column.dataField,value:t.value}}i._resizeSelectionRect(),t.preventDefault()}else if(o&&o.captured)if(i._dragSelectionStartDataField=i._selection.focusedCell.dataField,i._dragSelectionStartRow=i.rowById[i._selection.focusedCell.id],null===l&&null===n&&(Math.abs(s-e.left)>=30?l=!0:Math.abs(r-e.top)>=20&&(n=!0)),o.lastPoint&&Math.abs(o.lastPoint.top-r)>=30?(l=null,n=!0):o.lastPoint&&Math.abs(o.lastPoint.left-s)>=30&&(n=null,l=!0),l){const t=o.endDragColumn.dataField,l=d({clientX:s,clientY:e.top-5});l.row&&l.column&&(o.endDragRow=o.endRow,o.endDragColumn=l.column,o.endDragColumn.dataField!==t&&(o.lastPoint={left:s,top:r}),i._resizeSelectionRect())}else if(n){const t=o.endDragRow,l=d({clientX:e.left-5,clientY:r});l.row&&l.column&&(o.endDragRow=l.row,o.endDragColumn=o.endColumn,o.endDragRow.id&&o.endDragRow.id!==t.id&&(o.lastPoint={left:s,top:r}),i._resizeSelectionRect())}o&&o.captured&&i.selection.allowDragSelectionAutoScroll&&(i._autoScrollSelectionDragInterval&&clearInterval(i._autoScrollSelectionDragInterval),i.selection.isDragging=!0,i._autoScrollSelectionDragInterval=setInterval((function(){const e=i.$.scrollView.getBoundingClientRect();s<=e.left+20?(i.scrollLeft-=15,i._resizeSelectionRect()):s>=e.left+e.width-20&&(i.scrollLeft+=15,i._resizeSelectionRect()),r<=e.top+20?(i.scrollTop-=15,i._resizeSelectionRect()):r>=e.top+e.height-20&&(i.scrollTop+=15,i._resizeSelectionRect())}),25))},t.onUp=function(){if(!t.captured)return;i._autoScrollSelectionDragInterval&&clearInterval(i._autoScrollSelectionDragInterval),i.editing.editCell||i.editing.editRow||i.focus(),t.capturedDrag=!1,t.captured=!1,l=null,n=null,e=null,t.lastPoint=null;const o=t.cellValues;t.minRow&&t.maxRow&&t.maxRow&&t.maxColumn&&(i._selectCellsRange(t.minRow,t.maxRow,t.minColumn.dataField,t.maxColumn.dataField),t.row=t.minRow,t.rowId=t.row.id,t.column=t.minColumn,t.endColumn=t.maxColumn,t.endRow=t.maxRow,t.endRowId=t.maxRow.id,t.cellValues=o,i._resizeSelectionRect(),i.selection.allowCellDragSelectionAutoFill&&i._pasteSelectedCells({row:t.row,endRow:t.endDragRow,column:t.column,endColumn:t.endColumn},o)),t.endDragColumn=null,t.endDragRow=null,t.minColumn=null,t.minRow=null,t.maxColumn=null,t.maxRow=null},t.onDown=function(l){if(t.captured&&!e){let t=l.clientX,n=l.clientY;l.touches&&(t=l.touches[0].clientX,n=l.touches[0].clientY),e={left:t,top:n}}};const o={down:"pointerdown",move:"pointermove",up:"pointerup"};Smart.Utilities.Core.isMobile&&(o.down="touchstart",o.move="touchmove",o.up="touchend"),t["on"+o.down]=function(e){const l=t.getBoundingClientRect();let n=e.clientX,o=e.clientY;e.touches&&(n=e.touches[0].clientX,o=e.touches[0].clientY),n>=l.right-5&&o>=l.bottom-5?(t.captured=!0,t.endDragRow=t.endRow,t.endDragColumn=t.endColumn):i.selection.allowCellDragDropSelectionHandle&&o>=l.bottom-5?(t.captured=!0,t.capturedDrag=!0,t.endDragRow=t.endRow,t.endDragColumn=t.endColumn,t.left=t.endColumn.left-t.column.left,t.top=t.endRow.top-t.row.top):t.captured||i._rowDownHandler(e)},document.addEventListener(o.move,t.onMove,{passive:!1}),document.addEventListener(o.up,t.onUp,{passive:!1}),document.addEventListener(o.down,t.onDown,{passive:!1})}}const e=i._selection.selectionRect;e.row=i.rowById[i._selection.focusedCell.id],e.rowId=i._selection.focusedCell.id,e.column=i.columnByDataField[i._selection.focusedCell.dataField],e.endRow=l,e.endRowId=l.id,e.endDragRow=l,e.endColumn=n,e.endDragColumn=n,i._refreshCellSelectionRect()}}_resizeSelectionRect(){const e=this,t=e._selection.selectionRect;if(!t)return;let l=e._recyclingRows,n=t.row,o=t.endDragRow,i=t.column,a=t.endDragColumn;const s=e.viewColumns,r=l.indexOf(n),d=l.indexOf(o),c=l.indexOf(t.endRow),u=s.indexOf(i),f=s.indexOf(a),p=s.indexOf(t.endColumn),m=Math.min(c,Math.min(r,d)),g=Math.max(c,Math.max(r,d)),_=Math.min(p,Math.min(u,f)),h=Math.max(p,Math.max(u,f));c<=Math.min(r,d)?t.minRow=t.endRow:t.minRow=r<=d?n:o,c>=Math.max(r,d)?t.maxRow=t.endRow:t.maxRow=r>=d?n:o,p<=Math.min(u,f)?t.minColumn=t.endColumn:t.minColumn=u<=f?i:a,p>=Math.max(u,f)?t.maxColumn=t.endColumn:t.maxColumn=u>=f?i:a;let w=0,y=0,v=0,S=0;for(let e=m;e<=g;e++){const t=l[e];if(t){e===m&&(w=t.top),e===g&&(y=t.top+t.height-w);for(let e=_;e<=h;e++){const l=s[e].dataField,n=t.getCell(l);e===_&&(v=n.column.left),e===h&&(S=n.column.left+n.column.computedWidth-v)}}}t.style.top=w-e.scrollTop-1+"px",0===m&&0===w&&0===e.scrollTop&&(t.style.top="0px"),e._isVirtualMode()&&(t.style.top=w+parseFloat(e.$.rowContainer.style.top)-1+"px"),e.rightToLeft?t.style.right=v-e.scrollLeft+"px":t.style.left=v-e.scrollLeft+"px",t.style.height=y+1+"px",t.style.width=S+1+"px"}_getPatternValue(e,t,l){let n=[],o=0,i=[],a=[],s=[],r=[];const d={names:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],namesAbbr:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],namesShort:["Su","Mo","Tu","We","Th","Fr","Sa"]},c={names:["January","February","March","April","May","June","July","August","September","October","November","December",""],namesAbbr:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec",""]},u=function(e){if(void 0!==e&&!(e.toString().indexOf("GMT+")>=0||e.toString().indexOf("GMT-")>=0)){if(!isNaN(parseFloat(e)))return/[A-Za-z]/.test(e.toString())?void 0:parseFloat(e);if(d.names.indexOf(e)>=0)return r=d.names,d.names.indexOf(e);if(d.namesAbbr.indexOf(e)>=0)return r=d.namesAbbr,d.namesAbbr.indexOf(e);if(d.namesShort.indexOf(e)>=0)return r=d.namesShort,d.namesShort.indexOf(e);if(c.names.indexOf(e)>=0)return r=c.names,c.names.indexOf(e);if(c.namesAbbr.indexOf(e)>=0)return r=c.namesAbbr,c.namesAbbr.indexOf(e);if(void 0!==e&&(null===e&&(e=""),/\d+/.test(e.toString()))){s.push(e.toString().replace(/[0-9]/,"#")),s[s.length-1]=s[s.length-1].replace(/[0-9]/g,"");const t=parseFloat(e.toString().replace(/\D/g,""));return isNaN(t)?0:t}}};let f=0;for(let e in l){let t=l[e];n[o]=[],f=0;for(let e in t){let l=u(t[e]);void 0!==l&&(n[o].push(l),f++)}if(0===n[o].length)continue;let a=n[o][0],d=0;for(let e=0;e<n[o].length;e++){let t=u(n[o][e-1]),l=u(n[o][e]);0===e&&(t=l),a+=l,d+=l-t}a/=n[o].length,a-=n[o][0],a+=n[o][n[o].length-1],0!==d&&(d/=n[o].length-1),(r.length>0||s.length>0)&&(d=1,a=n[o][0]),n[o].length<=2&&(a=n[o][n[o].length-1]+d),i.push({step:d,stepStart:a}),o++}for(let e=0;e<f;e++){let t=n[0][e],l=0;for(let o=1;o<n.length;o++){const i=u(n[o-1][e]),a=u(n[o][e]);t+=a,l+=a-i}t/=n.length,t-=n[0][e],t+=n[n.length-1][e],0!==l&&(l/=n.length-1),(r.length>0||s.length>0)&&(l=1,t=n[0][e]),n.length<=2&&(t=n[n.length-1][e]+l),a.push({step:l,stepStart:t})}if(!n[e]){let l=n.length;for(let o=l;o<=e;o++){n[o]=[];for(let e=0;e<=t;e++)a[e]||(a[e]=a[e-1]),a[e]&&(o===l?n[o][e]=a[e].stepStart:(n[o][e]=n[o-1][e]+a[e].step,r.length>1&&n[o][e]>=r.length&&(n[o][e]=0)))}return r.length>0?r[n[e][t]]:s.length>0?s[e%s.length].replace("#",n[e][t]):n[e][t]}if(!n[e][t]){let l=f;for(let o=l;o<=t;o++)i[e]&&(o===l?n[e].push(i[e].stepStart):(n[e][o]=n[e][o-1]+i[e].step,r.length>1&&n[e][o]>=r.length&&(n[e][o]=0)));return r.length>0?r[n[e][t]]:s.length>0?s[e%s.length].replace("#",n[e][t]):n[e][t]}return n[e]&&n[e][t]?s.length>0?s[e%s.length].replace("#",n[e][t]):n[e][t]:0}_pasteDataType(e){const t=this.dataSource&&"number"==typeof this.dataSource.dataSource,l=e.cell,n=e.value;let o=l.column.dataType;return o&&!t||(o=isNaN(parseFloat(n))?"string":n instanceof Date?"date":"true"===n||"false"===n?"boolean":"number"),o}_getCellEditorDataSource(e){const t=this;if(e.column.editor){if(e.column.editor.dataSource)return e.column._dataSource=e.column.editor.dataSource,e.column.editor.dataSource;switch(e.column.editor.template){case"list":case"dropDownList":case"comboBox":case"autoComplete":case"multiInput":case"checkInput":case"multiComboInput":case"tags":if(!e.editor.dataSource){const l=t.getVisibleRows(),n=[],o=[];for(let i=0;i<l.length;i++){let a=t.dataSource[l[i].index];if(a){if(e.column.displayField!==e.column.dataField){const t=a[e.column.displayField],l=a[e.column.dataField];-1===o.indexOf(t)&&(n.push({label:t,value:l}),o.push(t));continue}if(a=a[e.column.dataField],!a)continue;-1===n.indexOf(a)&&n.push(a)}}return e.column._dataSource=n,n}if(e.column.editor.collaborator){let l=[];for(let e=0;e<t.users.length;e++)l.push({color:t.users[e].color,label:t.users[e].name,id:t.users[e].id,value:t.users[e].id,name:t.users[e].name,image:t.users[e].image});return e.column._dataSource=l,l}}}return null}_pasteModeCopy(e){const t=this,l=t.dataSource&&"number"==typeof t.dataSource.dataSource,n=t._pasteDataType(e),o=e.cell;let i=e.value;if(i&&"string"==typeof i&&(i=i.replace(/["]/g,"")),o.column.editor&&(o.column.editor.dataSource||t._getCellEditorDataSource(o))&&i){const e=e=>{let l;const n=t._getCellEditorDataSource(o);for(let t=0;t<n.length;t++){const i=n[t];if("string"!=typeof i&&(i.label===e||i.name===e))return l=i.value,o.column.editor.collaborator&&(l=i.id),l;if("string"!=typeof i&&i.label&&i.label.toLowerCase()===e)return l=i.value,o.column.editor.collaborator&&(l=i.id),l;if("string"!=typeof i&&i.value===e)return l=i.value,o.column.editor.collaborator&&(l=i.id),l;if("string"==typeof i&&i===e)return e;if("object"==typeof i&&i.label===e)return i;if("object"==typeof i&&o.column.editor.relationField&&""+e==""+t)return e}return-1};let l=-1;if(i&&-1!==i.indexOf(",")?(l=[],i.split(",").forEach((t=>{const n=e(t.trim());-1!==n&&l.push(n)})),l=l.join(",")):l=e(i),-1!==l&&(i=l),-1===l)return}if(o.column.editor)switch(o.column.editor.template){case"custom":return}let a=i;const s=e.dataField;if(a&&"string"==typeof a&&a.indexOf("[{")>=0&&"image"!==o.column.template&&"attachment"!==o.column.template)return;if(a&&"string"==typeof a&&a.indexOf("<")>=0&&(""===o.column.template&&"string"===n?a=t.clearPaste(a,"text/html","plainText"):"richText"===o.column.template&&"string"===n&&a&&a.indexOf("data-block")>=0||(a=t.clearPaste(a))),a&&"string"==typeof a&&"richText"===o.column.template&&/^(https?:\/\/)?([\w.-]+\.[a-z]{2,})(\/[^\s]*)?$/i.test(a.trim())){const e=document.createElement("a");e.innerHTML=a,e.href=a,e.target="_blank",e.title="Ctrl + Click to open link",a=e.outerHTML}let r=a,d=!1;if("string"===n){if(r=a,r){if((""+r).indexOf("&#")>=0&&(r=t._fromHTMLEntities(r)),(""+r).indexOf("GMT")>=0&&-1===a.indexOf("[{")){const e=new Smart.Utilities.DateTime(r).toString("d");e&&e.length&&(r=e)}"image"!==o.column.editor.template&&"attachment"!==o.column.editor.template&&"textarea"!==o.column.editor.template&&"richText"!==o.column.editor.template&&(r=t._unescapeString(r),o.column.editor.collaborator||(r=r.replaceAll("\\"," ").replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/'/g,"&#39;").replace(/'/g,"&quot;").replace(/[\r\n]+/g," ").replace(/(\u00a9|\u00ae|[\u2000-\u3300]|\ud83c[\ud000-\udfff]|\ud83d[\ud000-\udfff]|\ud83e[\ud000-\udfff])/gi,(e=>"&#"+e.codePointAt(0)+";"))))}d=!0}else if("bool"===n||"boolean"===n)1!==a&&"1"!==a&&!0!==a&&"true"!==a&&"TRUE"!==a&&"True"!==a||(r=!0,d=!0);else if("date"===n||"time"===n||"dateTime"===n){const e=t.columnByDataField[s];l?(r=a,d=!0):e&&e.dataType!==n?(r=null,d=!0):(r=a,"string"==typeof a&&(r=o&&o.column.cellsFormat&&"string"==typeof a?Smart.Utilities.DateTime.ParseDate(a,o.column.cellsFormat):new Date(a)),o&&"duration"===o.column.template&&(r=[r,r]),d=!0)}else if("number"===n||"float"===n||"int"===n){const e=t.columnByDataField[s];l?(r=a,d=!0):e&&e.dataType!==n?(r=null,d=!0):null!==a?"int"===n||"integer"===n?(r=parseInt(a),d=!0):(r=parseFloat(a),isNaN(r)&&(r=null),d=!0):(r=null,d=!0)}if(!1!==o.column.allowEdit&&!1!==t.editing.enabled||(d=!1),d)if(t.dataSource&&t.dataSource.virtualDataSource){const e={};e[o.column.dataField]=r,t.editing.batch?t._batchUpdateCell(o.row,o.column,r,o.value):t.updateRow(o.row.id,e)}else{const e=o.value;if(t._setCellUndoRedo(o,e,r),t.onCellUpdate){t._pasteTempValues||(t._pasteTempValues=[]),t._pasteTempValues.push({id:o.row.id,cell:o,dataField:o.column.dataField,oldValue:e,newValue:r}),t._pasteTimer&&clearTimeout(t._pasteTimer);const l=(e,l)=>{const n=e.row;if(n){let o=null;if(t.storeHistory&&(o=t._stringifyRow(n)),l!==(void 0!==e.value?e.value:"")&&(n.updatedDate=new Date,n.updatedBy=t.currentUser,t.storeHistory)){e.value=l;const i=t._stringifyRow(n);t._updateRowHistory(n,o,i)}}};t._pasteTimer=setTimeout((()=>{if(t._pasteTempValues&&t._pasteTempValues.length>1){let e=[],n=[],o=[];for(let l=0;l<t._pasteTempValues.length;l++){const i=t._pasteTempValues[l];e.push(i.cell),n.push(i.oldValue),o.push(i.newValue)}t.onCellUpdate(e,n,o,(function(n){if(n){const n=t.onRowHistory;t.onRowHistory=null,t.beginUpdate();for(let n=0;n<e.length;n++){const i=e[n];l(i,o[n]),t.formulas&&"string"==typeof o[n]&&o[n].startsWith("=")&&/=.+/.test(o[n])?i.formula=t._fromHTMLEntities(o[n]):i.value=o[n],t.flashCell(i.row.id,i.column.dataField)}t.endUpdate(!1),t.onRowHistory=n}}),t)}else t.onCellUpdate([o],[e],[r],(function(e){if(e){const e=t.onRowHistory;t.onRowHistory=null,l(o,r),t.formulas&&"string"==typeof r&&r.startsWith("=")&&/=.+/.test(r)&&-1===r.indexOf("[{")?o.formula=t._fromHTMLEntities(r):o.value=r,t.flashCell(o.row.id,o.column.dataField),t.onRowHistory=e}}),t);delete t._pasteTempValues}),100)}else if(t.onRowUpdate){const e=Object.assign({},o.row.data),l=Object.assign({},o.row.data);l[o.column.dataField]=r,o.row.updatedDate=new Date,o.row.updatedBy=t.currentUser,t.onRowUpdate([o.row.index],[o.row],[e],[l],(function(e){e&&(o.value=r)}),t)}else t.formulas&&"string"==typeof r&&r.startsWith("=")&&/=.+/.test(r)&&-1===r.indexOf("[{")?o.formula=t._fromHTMLEntities(r):t.editing.batch?t._batchUpdateCell(o.row,o.column,r,o.value):o.value=r,t.flashCell(o.row.id,o.column.dataField)}}_pasteModeFill(e){const t=this,l=t.dataSource&&"number"==typeof t.dataSource.dataSource,n=t._pasteDataType(e),o=e.cell,i=e.selectedValues,a=e.minRowIndex,s=e.minColumnIndex,r=e.currentRowIndex,d=e.currentColumnIndex,c=e.dataField;let u=e.value;if("string"===n)/\d+/.test(u.toString())?(u=t._getPatternValue(r-a,d-s,i),void 0===u&&i[r-a]&&i[r-a][d-s]&&(u=i[r-a][d-s])):(u=t._getPatternValue(r-a,d-s,i),void 0===u&&(u=i[r-a]?i[r-a][d-s]:e.value),void 0===u&&(u=e.value)),void 0!==u&&(o.value=u);else if("bool"===n||"boolean"===n)1!==u&&"1"!==u&&!0!==u&&"true"!==u&&"TRUE"!==u&&"True"!==u||(o.value=!0);else if("date"===n||"time"===n||"dateTime"===n){const e=t.columnByDataField[c];l?o.value=u:e&&e.dataType!==n&&(o.value=null),i[r-a]&&(u=i[r-a][d-s],void 0!==u&&(o.value=u))}else if("number"===n||"float"===n||"int"===n){u=t._getPatternValue(r-a,d-s,i);const e=t.columnByDataField[c];l?o.value=u:e&&e.dataType!==n?o.value=null:o.value=null!==u?"int"===n||"integer"===n?parseInt(u):parseFloat(u):null}}_pasteSelectedCells(e,t){const l=this;l.beginUpdate();let n=l._recyclingRows,o=e.row,i=e.endRow,a=e.column,s=e.endColumn;l._deleteCopyRects();const r=n.indexOf(o),d=n.indexOf(i),c=n.indexOf(e.endRow),u=l.viewColumns,f=u.indexOf(a),p=u.indexOf(s),m=u.indexOf(e.endColumn),g=Math.min(c,Math.min(r,d));let _=Math.max(c,Math.max(r,d)),h=!1,w=Object.keys(t).length;_-g<w&&(_=g+w-1,h=!0);const y=Math.min(m,Math.min(f,p));let v=Math.max(m,Math.max(f,p));if(t[0]){const e=Object.keys(t[0]).length;v-y<e-1&&(v=v+e-1,h=!0)}let S=0,R=0,C=0,x=0;for(let e in t)0===S&&(R+=Object.keys(t[e]).length),S++;let b=!1;l._selection&&l._selection.columns&&Object.keys(l._selection.columns).length>0&&(b=!0);for(let e=g;e<=_;e++){const o=n[e];if(o){C=0;for(let n=y;n<=v;n++){if(!u[n])continue;const i=u[n].dataField,a=o.getCell(i);let s=0;b&&(s=x);for(let r in t){if(s===x){let d=0,c=t[r];b&&(c=t[s]);for(let s in c){if(C===d){let r=c[s],d=!0;if(t[o.id]&&t[o.id][i]&&(d=!1),d&&"none"!==l.clipboard.autoFillMode){if(!a)continue;const o={value:r,targetValue:a.value,dataField:s,index:a.row.visibleIndex,targetDataField:i,targetRowIndex:e};if(l.clipboard.onPasteValue){l.clipboard.onPasteValue(o);const e=a.value;a.value=o.value,l._setCellUndoRedo(a,e,o.value)}else if(o.cell=a,o.selectedValues=t,o.minRowIndex=g,o.maxRowIndex=_,o.minColumnIndex=y,o.maxColumnIndex=v,o.currentColumnIndex=n,o.currentRowIndex=e,"copy"===l.clipboard.autoFillMode)if(o.value&&(""+o.value).indexOf("<")>=0){const e=document.createElement("textarea");e.value=o.value,e.style.position="fixed",e.style.left="-999999px",e.style.top="-999999px",document.body.appendChild(e),e.focus(),e.select(),setTimeout((()=>{document.execCommand("copy"),o.value=e.value,e.remove(),l.focus(),l._pasteModeCopy(o)}),25)}else l._pasteModeCopy(o);else"fillSeries"===l.clipboard.autoFillMode&&l._pasteModeFill(o)}}d++}}s++}C++,C>=R&&(C=0)}x++,x>=S&&(x=0)}}l.endUpdate(!1),h&&l.viewColumns[v]&&l.viewColumns[y]&&n[_]&&n[g]&&l._selectCellsRange(n[g],n[_],l.viewColumns[y].dataField,l.viewColumns[v].dataField),setTimeout((()=>{l._conditionalColors&&l._conditionalColors.update&&(l._conditionalColors.update(),l._recycle(!1))}),100),l._recycle(!1),l._refreshDataFilters()}_refreshCellSelectionRect(){const e=this,t=e._selection.selectionRect;if(e._copyRects&&e._copyRects.length&&e._refreshCopyRects(),!t||t&&t.captured)return;let l=e._recyclingRows,n=t.row,o=t.endRow,i=t.column,a=t.endColumn;const s=e.viewColumns;if(!a||!i)return;if(e._isVirtualMode()){if(n.id!==t.rowId&&!e.rowById[t.rowId])return t.style.height="0px",void(t.style.width="0px");if(n=e.rowById[t.rowId],o=e.rowById[t.endRowId],!o)return}if(!i.allowSelect||!a.allowSelect){if(i===a)return t.style.width="0px",void(t.style.height="0px");{const e=s.indexOf(i),l=s.indexOf(a);i=null,a=null;for(let t=e;t<l;t++){const e=s[t];e.allowSelect&&!i&&(i=e),a=e}if(!i||!a)return t.style.width="0px",void(t.style.height="0px")}}const r=l.indexOf(n),d=l.indexOf(o),c=s.indexOf(i),u=s.indexOf(a);let f=Math.min(r,d),p=Math.max(r,d),m=Math.min(c,u),g=Math.max(c,u);m=Math.max(0,m),f=Math.max(0,f);const _=function(e){const t=l.indexOf(e.row),n=l.indexOf(e.endRow),o=s.indexOf(e.column),i=s.indexOf(e.endColumn);f=Math.min(f,t),f=Math.min(f,n),f=Math.max(0,f),p=Math.max(p,t),p=Math.max(p,n),m=Math.min(m,o),m=Math.min(m,i),m=Math.max(0,m),g=Math.max(g,o),g=Math.max(g,i)},h=e._getParentCell(n,i.dataField),w=e._getParentCell(n,a.dataField),y=e._getParentCell(o,a.dataField),v=e._getParentCell(o,i.dataField);h&&_(h),w&&_(w),y&&_(y),v&&_(v);let S=0,R=0,C=0,x=0;t.cellValues=[];let b=[],F=[];for(let n=f;n<=p;n++){const o=l[n];if(n===f&&(S=o.top,!0!==o.freeze&&"near"!==o.freeze&&(0===S&&(S+=2),S+=e.__frozenNearHeight),"far"===o.freeze&&(S=o.top+e.__scrollHeight+e.scrollTop-e._scrollView.hScrollBar.offsetHeight)),n===p){let t=o.top;"far"===o.freeze&&(t=o.top+e.__scrollHeight+e.scrollTop-e._scrollView.hScrollBar.offsetHeight),R=t+o.height-S,!0!==o.freeze&&"near"!==o.freeze&&(R+=e.__frozenNearHeight)}t.cellValues[o.id]=[];const i=e._isUpdating;e._isUpdating=!0,t.style.zIndex="";for(let l=m;l<=g;l++){const n=s[l].dataField,i=o.getCell(n);let a=i?i.value:"";if(void 0===a&&(a=""),s[l].freeze?b.push(s[l]):F.push(s[l]),"tags"===s[l].template)if(null!=a)if("number"==typeof a)a=null;else{const t=a.trim().split(","),n=[];if(s[l].editor&&s[l].editor.dataSource){const o=s[l].editor.collaborator?e.users:s[l].editor.dataSource;for(let e=0;e<t.length;e++)for(let l=0;l<o.length;l++){const i=o[l],a=i.value;if(t[e]===i.value||t[e]===i.id){n.push(i.label||i.name);break}if(a&&(t[e]===a.toLowerCase()||t[e]===i.id)){n.push(i.label||i.name);break}}}a=n.join(", ")}else a=null;else if("createdBy"===s[l].template||"updatedBy"===s[l].template){for(let t=0;t<e.users.length;t++)if(e.users[t].id===o[s[l].template]){a=e.users[t].label||e.users[t].name;break}}else"createdTime"===s[l].template||"createdDate"===s[l].template?(a=o.createdDate,a&&(a=new Smart.Utilities.DateTime(a).toString("d"))):"updatedTime"!==s[l].template&&"updatedDate"!==s[l].template||(a=o.updatedTime,!a)||(a=new Smart.Utilities.DateTime(a).toString("d"));if(i.formula&&(a=i.formula),t.cellValues[o.id][n]=a,l===m&&(C=i.column.left,i.column.freeze&&"far"===i.column.freeze&&(C=e.__clientSize.width-e.__frozenFarWidth+C+e.scrollLeft-e._scrollView.vScrollBar.offsetWidth)),l===g){let t=i.column.left;i.column.freeze&&"far"===i.column.freeze&&(t=e.__clientSize.width-e.__frozenFarWidth+t+e.scrollLeft-e._scrollView.vScrollBar.offsetWidth),x=t+i.column.computedWidth-C}let c=!0;-1!==r&&-1!==d||(c=!1),c&&(i.selected=!0)}e._isUpdating=i}if(S-e.scrollTop<e.layout.rowMinHeight&&e.filtering.enabled&&e.filtering.filterRow.visible){const t=S;S=e.layout.rowMinHeight+e.scrollTop,R-=S-t}if(R<=0)t.classList.add("smart-visibility-hidden");else{if(t.classList.remove("smart-visibility-hidden"),0===b.length&&(t.style.zIndex=5),t.style.top=S-e.scrollTop-1+"px",0===f&&0===S&&0===e.scrollTop&&(t.style.top="0px"),e._isVirtualMode(),e.rightToLeft)t.style.right=C-e.scrollLeft+"px";else if(t.style.left=C-e.scrollLeft+"px",C-e.scrollLeft<e.__frozenNearWidth-1){let l=0;for(let t=0;t<e._frozenNearColumns.length;t++){const n=e._frozenNearColumns[t];n&&n.autoGenerated&&n.visible&&(l+=n.width)}if(C-e.scrollLeft<l){const n=l-C+e.scrollLeft;!F.length&&b.length&&(x+=n),x-=n,t.style.left=n+C-e.scrollLeft+"px"}}t.style.height=R+1+"px",t.style.width=x+1+"px",x<0?t.classList.add("smart-visibility-hidden"):t.classList.remove("smart-visibility-hidden")}}_renderInputOverlay(e,t,l){const n=this,o=n.rowById[e];if(o&&!1!==o.allowSelect&&!o.label&&t&&n.selection.checkBoxes.enabled){n._inputOverlay&&n._inputOverlay.classList.contains("smart-input-overlay-column")&&(n._inputOverlay.parentNode&&n._inputOverlay.parentNode.removeChild(n._inputOverlay),n._inputOverlay=null),n._inputOverlay||(n._inputOverlay=document.createElement("div"),n.$.scrollView.appendChild(n._inputOverlay),n._inputOverlay.classList.add("smart-input-overlay"));let e=o.freeze?o.top:n.__frozenNearHeight+o.top;const t=Math.round((o.cellHeight-n._selectionColumn.computedWidth)/2),i=n._selectionColumn.element.parentElement.offsetLeft+n._selectionColumn.element.offsetLeft;if(n._inputOverlay.style.left=i+"px",n._inputOverlay.style.height=n._selectionColumn.computedWidth+"px",n._inputOverlay.style.width=n._selectionColumn.computedWidth+"px",n._inputOverlay.style.top=e+t-n.scrollTop+"px",o&&o.element){const e=o.element.querySelector("smart-grid-cell");e&&(n._inputOverlay.cell=e.cell)}n._inputOverlay.row=o,n._inputOverlay.onpointerdown=function(e){n._inputOverlay||(n._inputOverlay.onpointerdown=null);const t=n._inputOverlay.row,l=n._inputOverlay.cell;n.beginUpdate(),t.selected=!t.selected,n.endUpdate(!1),n.$.fireEvent("change",{started:!1,finished:!0}),n._refreshSummary(!1);const o=e.originalEvent?e.originalEvent:e,i=3===o.which;n.$.fireEvent("rowClick",{row:t,id:t.id,isRightClick:i,originalEvent:o,pageX:parseInt(o.pageX),pageY:parseInt(o.pageY)}),l&&n.$.fireEvent("cellClick",{cell:l,id:t.id,dataField:l.column.dataField,isRightClick:i,originalEvent:o,pageX:parseInt(o.pageX),pageY:parseInt(o.pageY)}),n._recycle(),n._renderInputOverlay(t.id,e,!0),e.preventDefault()},n.appearance.allowCheckBoxesSelectionAnimation&&void 0===l&&n._inputOverlay.classList.add("smart-animate"),requestAnimationFrame((()=>{n._inputOverlay&&n._inputOverlay.classList.add("smart-input-overlay-on")}))}}_selectRow(e,t){const l=this,n=l.rowById[e];if(n&&l.selection.enabled&&(!n.header||"row-resize"!==n.header.style.cursor)){if(t&&(!t.shiftKey||!l._selection.focusedCell)){const t=n.getCell(l.columns[0].dataField);l._selection.focusedCell={index:t.row.index,id:e,dataField:t.column.dataField,value:t.value}}l._lastRowsSelectionRange=null,"extended"===l.selection.mode?l._handleExtendedRowSelection(n,t):"one"===l.selection.mode?n.select():n.selected?n.unselect():n.select()}}_getParentCell(e,t){const l=this;let n=l._recyclingRows;for(let o=0;o<l._cellsMerge.length;o++){const i=l._cellsMerge[o];let a=[],s=[];if(a.push(i.row),i.rowSpan>1){const e=n.indexOf(i.row);if(e>=0)for(let t=e;t<e+i.rowSpan;t++)n[t]&&-1===a.indexOf(n[t])&&a.push(n[t])}if(s.push(i.column.dataField),i.colSpan>1){const e=l.viewColumns,t=e.indexOf(l.columnByDataField[i.column.dataField]);for(let l=t;l<t+i.colSpan;l++)e[l]&&-1===s.indexOf(e[l].dataField)&&s.push(e[l].dataField)}if(a.indexOf(e)>=0&&s.indexOf(t)>=0)return{row:i.row,column:i.column,endRow:a[a.length-1],endColumn:l.columnByDataField[s[s.length-1]]}}if(l._cellRowSpan)for(let o=0;o<l._cellRowSpan.length;o++){const o=e.visibleIndex;let i=-1,a=null;for(let e=0;e<l._cellRowSpan.length;e++){const t=l._cellRowSpan[e];if(o>t[0]&&o<t[1]){i=t[0],a=t[2];break}}if(i>=0&&a===t){const e=n[i];if(e)return{row:e,column:l.columnByDataField[t],endRow:e,endColumn:l.columnByDataField[t]}}}return null}_selectCellsRange(e,t,l,n){const o=this,i=o._selection.selectionRect;if(!e||!t)return;if(o._lastRowsSelectionRange&&o._lastRowsSelectionRange.id===e.id&&o._lastRowsSelectionRange.endId===t.id&&o._lastColumnSelectionRange&&o._lastColumnSelectionRange.dataField===l&&o._lastColumnSelectionRange.endDataField===n)return;o.beginUpdate(),o._clearSelection(),o._lastRowsSelectionRange={id:e.id,endId:t.id},o._lastColumnSelectionRange={dataField:l,endDataField:n},(!i||i&&!i.captured)&&o._selection.focusedCell&&o._renderCellSelectionRect(o.rowById[o._selection.focusedCell.id],o.columnByDataField[o._selection.focusedCell.dataField],o.rowById[o._lastRowsSelectionRange.endId],o.columnByDataField[o._lastColumnSelectionRange.endDataField]);let a=o._recyclingRows;const s=o.viewColumns;let r=-1,d=-1,c=a.indexOf(e),u=a.indexOf(t),f=-1;for(let e=0;e<s.length;e++){const t=s[e];t.allowSelect&&(-1===f&&(f=e),t.dataField===l&&(r=e),t.dataField===n&&(d=e))}if(-1===f)return o.endUpdate(!1),void o._recycle();-1===r?r=f:-1===d&&(d=f);let p=Math.min(c,u),m=Math.max(c,u),g=Math.min(r,d),_=Math.max(r,d);const h=function(e){const t=a.indexOf(e.row),l=a.indexOf(e.endRow),n=s.indexOf(e.column),o=s.indexOf(e.endColumn);p=Math.min(p,t),p=Math.min(p,l),m=Math.max(m,t),m=Math.max(m,l),g=Math.min(g,n),g=Math.min(g,o),_=Math.max(_,n),_=Math.max(_,o)},w=o._getParentCell(e,l),y=o._getParentCell(t,n);if(w&&h(w),y&&h(y),m<0||p<0||g<0||_<0)return o.endUpdate(!1),void o._recycle();for(let e=p;e<=m;e++){const t=a[e];if(t.allowSelect)for(let e=0;e<s.length;e++){const l=s[e];l.allowSelect&&e>=g&&e<=_&&(t.getCell(l.dataField).selected=!0)}}o.endUpdate(!1,!1),o._recycle(!0,!0,!1),o._selectionTimer&&clearTimeout(o._selectionTimer),o._selectionTimer=setTimeout((()=>{o.editing.isEditing||o._recycle(!0,!0,!1)}),50)}_selectRowsRange(e,t,l){const n=this;if(n._lastRowsSelectionRange&&n._lastRowsSelectionRange.id===e.id&&n._lastRowsSelectionRange.endId===t.id)return;if(n._dragDrop&&n._dragDrop.dragDetails)return;n.beginUpdate(),n._clearSelection(),n._lastRowsSelectionRange={id:e.id,endId:t.id};let o=n._recyclingRows;const i=o.indexOf(e),a=o.indexOf(t),s=Math.min(i,a),r=Math.max(i,a);if(r<0)return n.endUpdate(!1),void n._recycle();for(let e=s;e<=r;e++){const t=o[e];t&&t.allowSelect&&(t.selected=!1!==l)}n.endUpdate(!1),n._recycle()}_selectColumnsRange(e,t){const l=this;if(l._lastColumnSelectionRange&&l._lastColumnSelectionRange.dataField===e&&l._lastColumnSelectionRange.endDataField===t)return;if(l._dragDrop&&l._dragDrop.dragDetails)return;l.beginUpdate(),l._clearSelection(),l._lastColumnSelectionRange={dataField:e,endDataField:t};const n=l.viewColumns;let o=-1,i=n.length;for(let l=0;l<n.length;l++){const a=n[l];a.allowSelect&&(a.dataField===e&&(o=l),a.dataField===t&&(i=l))}const a=Math.min(o,i),s=Math.max(o,i);for(let e=0;e<n.length;e++){const t=n[e];t.allowSelect&&e>=a&&e<=s&&(t.selected=!0)}l.endUpdate(!1),l._recycle()}_selectColumn(e,t){const l=this,n=l.columnByDataField[e],o=l.viewColumns;if(!n||!l.selection.enabled||!1===n.allowSelect||!l.selection.allowColumnHeaderSelection)return;if(n&&"col-resize"===n.element.style.cursor)return;let i=!1;if(n&&(n.allowSelect||null===n.allowSelect&&!t)&&(i=!0),i&&t)if("extended"===l.selection.mode){if(t.ctrlKey||t.metaKey||t.shiftKey||(l._rangeSelectionStartColumn=n,l._rangeSelectionEndColumn=n),t.ctrlKey||t.metaKey?n.selected=!n.selected:n.selected=!0,t&&t.shiftKey){l._rangeSelectionStartColumn||(l._rangeSelectionStartColumn=n),l._rangeSelectionEndColumn=n,l._selection.columns=[];const e=o.indexOf(l._rangeSelectionStartColumn),t=o.indexOf(l._rangeSelectionEndColumn),i=Math.min(e,t),a=Math.max(e,t);for(let e=i;e<=a;e++){const t=o[e];t&&!1!==t.allowSelect&&(t.selected=!0)}}}else"one"===l.selection.mode||null===n.selected?n.selected=!0:n.selected=!n.selected}selectAllRows(){const e=this;let t=e.rows;e._selectionColumn._selecting=!0,delete e._areAllRowsSelected,e.beginUpdate();for(let e=0;e<t.length;e++)t[e].selected=!0;e._selectionColumn._selecting=!1,e.endUpdate(!1),e._refreshSummary(!1),e._recycle(!1),e._refreshCheckBoxColumnSelection(),e.$.fireEvent("change",{started:!1,finished:!0})}hasSelectedRows(){const e=this.getVisibleRows(),t=this._getSelectedRows(!0,!1);return t.length===e.length||t.length>0&&t.length<e.length||0!==t.length&&0!==e.length&&void 0}areAllRowsSelected(){const e=this;if(e._areAllRowsSelected!==this.undefined)return e._areAllRowsSelected;const t=e.getVisibleRows(),l=Object.keys(e._selection.rows).length;if(0===l||l<t.length)return!1;const n=e._getSelectedRows(!0,!1);return n.length>0&&n.length===t.length?(e._areAllRowsSelected=!0,!0):(e._areAllRowsSelected=!1,e._areAllRowsSelected)}_getSelectedRows(e,t){const l=this,n=[];let o=l.rows;if(l.rows.canNotify=!1,e&&(o=l.getVisibleRows()),l._isVirtualMode()){let e=l._selection.indexes;return l.paging.enabled&&t&&l._isVirtualMode()&&(e=e.slice(0,l.paging.pageSize)),l.rows.canNotify=!0,Object.keys(e).length}l.paging.enabled&&t&&(o=l._isVirtualMode()?o.slice(0,l.paging.pageSize):o.slice(l.paging.pageIndex*l.paging.pageSize,(l.paging.pageIndex+1)*l.paging.pageSize));for(let e=0;e<o.length;e++){const t=o[e];t.getProperty("selected")?n.push(t):(t.canNotify=!1,t.selected=!1,t.canNotify=!0)}return l.rows.canNotify=!0,n}_dragSelectionEnd(e){const t=this;t._dragSelectionStartDataField=null,t._dragSelectionStartRow=null,t.__selectionStarted&&(t.$.fireEvent("change",{started:!1,finished:!0,originalEvent:e}),t._refreshSummary(),delete t.__selectionStarted,delete t.__selectionStartedFired,t.autoSaveState()),t.selection.allowDragSelection&&t.selection.isDragging&&(t.selection.isDragging=!1,t._autoScrollSelectionDragInterval&&(clearInterval(t._autoScrollSelectionDragInterval),t.editing.isEditing||t._recycle()))}_dragSelection(e){const t=this;if("extended"!==t.selection.mode||!1===t.selection.allowDragSelection)return;if(!t._dragSelectionStartDataField&&!t._dragSelectionStartRow)return;const l=()=>{t.__selectionStarted&&!t.__selectionStartedFired&&(t.$.fireEvent("change",{started:!0,finished:!1,originalEvent:e}),t.__selectionStartedFired=!0),t.$.fireEvent("change",{started:!1,finished:!1,originalEvent:e})};if(!t.selection.allowCellSelection||!t._dragSelectionStartDataField||t._columnResizeLine||t._dragSelectionStartDataField.startsWith("_")||!t._dragSelectionStartRow||t._rowResizeLine){if(t._dragSelectionStartRow&&!t._rowResizeLine&&(t.selection.allowRowSelection&&!t._dragSelectionStartDataField.startsWith("_")||t.selection.allowRowHeaderSelection&&t._dragSelectionStartDataField.startsWith("_"))){const n=(t.enableShadowDOM?t.shadowRoot:t.getRootNode()).elementsFromPoint(e.clientX,e.clientY);let o=null;for(let e=0;e<n.length;e++){const t=n[e];if(t.getAttribute("data-id")){o=t.row,!o&&t.cell&&(o=t.cell.row);break}}let i=!0;t._lastRowsSelectionRange&&t._lastRowsSelectionRange.id===t._dragSelectionStartRow.id&&o&&t._lastRowsSelectionRange.endId===o.id&&(i=!1),o&&!o.allowSelect&&(i=!1),o&&o.allowSelect&&t._selectRowsRange(t._dragSelectionStartRow,o),t._autoScrollSelectionDragInterval&&clearInterval(t._autoScrollSelectionDragInterval),t.selection.isDragging=!0,i&&l(),t._autoScrollSelectionDragInterval=setInterval((function(){const l=t.$.scrollView.getBoundingClientRect();e.clientY<=l.top+20?t.scrollTop-=15:e.clientY>=l.top+l.height-20&&(t.scrollTop+=15)}),25)}else if(t._dragSelectionStartDataField&&!t._columnResizeLine&&!t._dragSelectionStartDataField.startsWith("_")&&t.selection.allowColumnHeaderSelection){const n=(t.enableShadowDOM?t.shadowRoot:t.getRootNode()).elementsFromPoint(e.clientX,e.clientY);let o=null;for(let e=0;e<n.length;e++){const t=n[e];if(t.getAttribute("data-field")){o=t.getAttribute("data-field");break}}o&&t._selectColumnsRange(t._dragSelectionStartDataField,o),t._autoScrollSelectionDragInterval&&clearInterval(t._autoScrollSelectionDragInterval);let i=!0;t._lastColumnSelectionRange&&t._lastColumnSelectionRange.dataField===t._dragSelectionStartDataField&&t._lastColumnSelectionRange.endDataField===o&&(i=!1),i&&l(),t.selection.isDragging=!0,t._autoScrollSelectionDragInterval=setInterval((function(){const l=t.$.scrollView.getBoundingClientRect();e.clientX<=l.left+20?t.scrollLeft-=15:e.clientX>=l.left+l.width-20&&(t.scrollLeft+=15)}),25)}}else{const n=(t.enableShadowDOM?t.shadowRoot:t.getRootNode()).elementsFromPoint(e.clientX,e.clientY);let o=null;for(let e=0;e<n.length;e++){const t=n[e];if(t.getAttribute("data-field")){o=t.getAttribute("data-field");break}}let i=null;for(let e=0;e<n.length;e++){const t=n[e];if(t.getAttribute("data-id")){i=t.row;break}}if(!i&&n.length&&n[0].classList.contains("smart-grid-scroll-view")){i=t._recyclingRows[t._recyclingRows.length-1];const l=(t.enableShadowDOM?t.shadowRoot:t.getRootNode()).elementsFromPoint(e.clientX,i.element.getBoundingClientRect().top);for(let e=0;e<l.length;e++){const t=l[e];if(t.getAttribute("data-field")){o=t.getAttribute("data-field");break}}}if(o&&i){if(i.id===t._dragSelectionStartRow.id&&t._dragSelectionStartDataField===o&&t._lastRowsSelectionRange&&t._lastRowsSelectionRange.id===t._dragSelectionStartRow.id&&t._lastRowsSelectionRange.endId===i.id&&t._lastColumnSelectionRange&&t._lastColumnSelectionRange.dataField===t._dragSelectionStartDataField&&t._lastColumnSelectionRange.endDataField===o)return;if(o&&o.startsWith("_"))return;let e=!0;if(t._lastRowsSelectionRange&&t._lastRowsSelectionRange.id===t._dragSelectionStartRow.id&&t._lastRowsSelectionRange.endId===i.id&&t._lastColumnSelectionRange&&t._lastColumnSelectionRange.dataField===t._dragSelectionStartDataField&&t._lastColumnSelectionRange.endDataField===o&&(e=!1),t._lastRowsSelectionRange&&t._lastRowsSelectionRange.id===t._dragSelectionStartRow.id&&t._lastRowsSelectionRange.endId===i.id&&t._lastColumnSelectionRange&&t._lastColumnSelectionRange.dataField===t._dragSelectionStartDataField&&t._lastColumnSelectionRange.endDataField===o)return;t._selectCellsRange(t._dragSelectionStartRow,i,t._dragSelectionStartDataField,o),t._removeCellContentPopup(),e&&l()}t.selection.allowDragSelectionAutoScroll&&(t._autoScrollSelectionDragInterval&&clearInterval(t._autoScrollSelectionDragInterval),t.selection.isDragging=!0,t._autoScrollSelectionDragInterval=setInterval((function(){const l=t.$.scrollView.getBoundingClientRect();e.clientX<=l.left+20?t.scrollLeft-=15:e.clientX>=l.left+l.width-20&&(t.scrollLeft+=15),e.clientY<=l.top+20?t.scrollTop-=15:e.clientY>=l.top+l.height-20&&(t.scrollTop+=15)}),25))}}select(e,t){const l=this;l.isInitialized&&(!t&&void 0!==e&&l._selection&&l._selection.rows[e]||(l._setSelection(e,t),l.$.fireEvent("change",{started:!1,finished:!0}),l._refreshSummary()))}selectCell(e,t){this.select(e,t)}selectRowsByIndex(e){const t=this;e||(e=[]),requestAnimationFrame((()=>{if("extended"!==t.selection.mode&&"many"!==t.selection.mode&&t._clearSelection(),t._isVirtualMode()){let l=[];for(let t=0;t<e.length;t++)l[e[t]]=!0;return t._selection.indexes=l,void t._recycle()}t.beginUpdate();for(let l in e){const n=e[l],o=t.rows[n];o&&t._setSelection(o.id)}t.endUpdate(!1),t._recycle()}))}selectRowsRange(e,t){const l=this,n=l.rowById[e],o=l.rowById[t];n&&o&&(l._selectRowsRange(n,o),l.$.fireEvent("change",{started:!1,finished:!0}),l._refreshSummary())}selectCellsByQuery(e,t){const l=this,n=e?l.findCells(e):t;requestAnimationFrame((()=>{"extended"!==l.selection.mode&&"many"!==l.selection.mode&&l._clearSelection(),l.beginUpdate();for(let e in n){const t=n[e][0],o=n[e][1];l._setSelection(t,o)}l.endUpdate(!1),l._recycle()}))}selectRowsByQuery(e,t,l){const n=this,o=n.find(e,t,l).map((e=>e.$.id));o.length&&n.selectRows(o)}selectRow(e){const t=this;"extended"!==t.selection.mode&&"many"!==t.selection.mode&&t._clearSelection(),t._setSelection(e),t._recycle(!1)}selectRows(e){const t=this;e||(e=[]),requestAnimationFrame((()=>{"extended"!==t.selection.mode&&"many"!==t.selection.mode&&t._clearSelection(),t.beginUpdate();for(let l in e)t._setSelection(e[l]);t.endUpdate(!1),t._recycle()}))}selectCellsById(e){this.selectCellsByQuery(null,e)}selectCells(e,t){const l=this;e||(e=[]),requestAnimationFrame((()=>{"extended"!==l.selection.mode&&"many"!==l.selection.mode&&l._clearSelection(),l.beginUpdate();for(let n in e)for(let o=0;o<t.length;o++)l._setSelection(e[n],t[o]);l.endUpdate(!1),l._recycle()}))}selectRange(e,t,l,n){const o=this;!function(){const i=new KeyboardEvent("keydown",{shiftKey:!0});requestAnimationFrame((()=>{"extended"!==o.selection.mode&&"many"!==o.selection.mode&&o._clearSelection(),o.beginUpdate(),o._setSelection(e,t),o._setSelection(l,n,i),o.ensureVisible(e,t),o.endUpdate(!1),o._refreshSummary(!1),o._recycle()}))}(),o.$.fireEvent("change",{started:!1,finished:!0})}unselect(e,t){const l=this;if(l._selection){if(l._selection.rows&&l._selection.rows[e]){delete l._selection.rows[e];const t=l.rowById[e];t&&t.unselect()}l._selection.columns&&l._selection.columns[t]&&delete l._selection.columns[t],l._selection.cells&&(l._selection.cells["row"+e]&&(delete l._selection.cells["row"+e][t],1===Object.getOwnPropertyNames(l._selection.cells["row"+e]).length&&delete l._selection.cells["row"+e]),l._selection.cells["column"+t]&&(delete l._selection.cells["column"+t][e],1===Object.getOwnPropertyNames(l._selection.cells["column"+t]).length&&delete l._selection.cells["column"+t])),l.$.fireEvent("change",{started:!1,finished:!0}),l._refreshSummary()}}getSelectedRows(){const e=this;let t=[];if(e._selection.rows&&Object.keys(e._selection.rows).length>0){const l=Object.keys(e._selection.rows);if(e._isVirtualMode()){for(let e in l){const n=l[e];t.push([n,{}])}return t}for(let n in l){const o=l[n],i=e.rowById[o];if(!i)continue;const a={};for(let e in i.data)switch(e){case"$":case"parent":case"level":case"leaf":case"children":continue;default:a[e]=i.data[e]}t.push([i.id,a])}}return t}getSelectedRowsData(){const e=this;let t=[];if(e._selection.rows&&Object.keys(e._selection.rows).length>0){const l=Object.keys(e._selection.rows);if(e._isVirtualMode()){for(let e in l)t.push({});return t}for(let n in l){const o=l[n],i=e.rowById[o];if(!i)continue;const a={};for(let e in i.data)switch(e){case"$":case"parent":case"level":case"leaf":case"children":continue;default:a[e]=i.data[e]}t.push(a)}}return t}getSelectedRowIndexes(){const e=this;return e._selection.indexes&&Object.keys(e._selection.indexes).length>0?e._selection.indexes:[]}getSelectedRowIds(){const e=this;let t=[];if(e._isVirtualMode())return e._selection.rows&&Object.keys(e._selection.rows).length>0?e._selection.rows:void 0;if(e._selection.rows&&Object.keys(e._selection.rows).length>0){const l=Object.keys(e._selection.rows);for(let n in l){const o=l[n],i=e.rowById[o];i&&t.push(i.id)}}return t}getSelectedCells(e){const t=this;let l=[];if(t._selection.cells)for(let n in t._selection.cells)if(n.startsWith("row")){let o=n.replace("row",""),i=null;for(let a in t._selection.cells[n])if(i=a.replace("column",""),l||(l=[]),!1===e)l.push([o,i]);else{const e=t.getCellValue(o,i);l.push([o,i,e])}}return l}getSelection(){const e=this;let t=null,l=null,n=null,o=null;if(e._selection.rows&&Object.keys(e._selection.rows).length>0){const l=Object.keys(e._selection.rows);t=[];for(let n=0;n<l.length;n++){const o=l[n],i=e.rowById[o],a={id:o};i?a.row=i:e._isVirtualMode&&e.rows[n]?a.row=e.rows[n]:e._isVirtualMode&&(a.row=null),t.push(a)}}if(e._selection.columns&&Object.keys(e._selection.columns).length>0){const t=Object.keys(e._selection.columns);l=[];for(let n=0;n<t.length;n++){const o=t[n];l.push({dataField:o,column:e.columnByDataField[o]})}}if(e._selection.cells)for(let t in e._selection.cells)if(t.startsWith("row")){let l=t.replace("row",""),o=null;for(let i in e._selection.cells[t])o=i.replace("column",""),n||(n=[]),n.push({id:l,dataField:o,column:e.columnByDataField[o],row:e.rowById[l]})}return e._selection.focusedCell&&(e._isVirtualMode(),o={index:e._selection.focusedCell.index,id:e._selection.focusedCell.id,dataField:e._selection.focusedCell.dataField}),{rows:t,columns:l,cells:n,focused:o}}focusAndSelect(e,t){const l=this;if(l.focus(),l.selection.enabled&&l.selection.allowCellSelection)l._focusCell(e,t);else{const t=l.rowById[e];if(!t)return;l.beginUpdate(),l._selection.rows=[],l._selection.columns=[],l._selection.cells=[],l._selection.indexes=[],l._setSelection(e),l._selection.focusedCell={id:t.id,value:null,index:t.index,dataField:l.columns[0].dataField},l.endUpdate(!1)}}_focusCell(e,t,l){const n=this;if(n.selection.enabled&&n.selection.allowCellSelection){const o=n.rowById[e];if(!o)return;!1!==l&&(n.beginUpdate(),n._selection.rows=[],n._selection.columns=[],n._selection.cells=[],n._selection.indexes=[],n._setSelection(e,t));const i=o.getCell(t);i&&(n._selection.focusedCell={id:i.row.id,value:i.value,dataField:t,index:i.row.index}),!1!==l&&n.endUpdate(!1)}}_clearSelection(e){const t=this;if(t._selection.rows=[],t._selection.columns=[],t._selection.cells=[],t._selection.indexes=[],e&&(t._selection.focusedCell=null,t._selection.selectionRect)){const e=t._selection.selectionRect;e.parentNode.removeChild(e);const l={down:"pointerdown",move:"pointermove",up:"pointerup"};Smart.Utilities.Core.isMobile&&(l.down="touchstart",l.move="touchmove",l.up="touchend"),document.removeEventListener(l.move,e.onMove),document.removeEventListener(l.up,e.onUp),document.removeEventListener(l.down,e.onDown),t._selection.selectionRect=null}t._recycle(),t._refreshCheckBoxColumnSelection()}_getSelectionCellValues(){const e=this;if(e._selection.selectionRect)return e._selection.selectionRect.cellValues;const t=e.viewColumns;if(e._selection.rows.length>0){let l=[];for(let n in e._selection.rows){const o=e.rowById[n];for(let e=0;e<t.length;e++){const i=t[e];i&&(l[n]||(l[n]=[]),i.autoGenerated||(l[n][i.dataField]=o.data[i.dataField]))}}return l}if(Object.keys(e._selection.columns).length>0){let t=[];for(let l in e._selection.columns){const n=e.columnByDataField[l];if(n)for(let l=0;l<e._recyclingRows.length;l++){const o=e._recyclingRows[l];o&&(t[o.id]||(t[o.id]=[]),t[o.id][n.dataField]=o.data[n.dataField])}}return t}if(e._selection.cells&&Object.keys(e._selection.cells).length>0){const t=e.getSelection();if(t.cells){let e=[];for(let l in t.cells){const n=t.cells[l],o=n.id;e[o]||(e[o]=[]),e[o][n.column.dataField]=n.row.data[n.column.dataField]}return e}}}_clipboardHandler(e,t){const l=this;if(l.clipboard.enabled){if((t.ctrlKey||t.metaKey)&&("c"===e||"x"===e)){const t=l._getSelectionCellValues();if(delete l._cutCells,delete l._cutRows,l.clipboard.copyHeadersToClipboard){let e=[];for(let n in t){for(let o in t[n]){const t=l.columnByDataField[o];t&&(e[o]=t.label,e.length++)}break}e.length&&t.splice(0,0,e)}if(l._selection.selectionRect){l._selection.selectionRect.classList.add("marching-ants");const e=l._selection.selectionRect;l._createCopyRect(e.row.id,e.endDragRow.id,e.column.dataField,e.endColumn.dataField)}else l.hasSelectedRows()&&l._createCopyRects();let n="";if(!t)return;let o=Object.keys(t).length,i=0;for(let a in t){let s="",r=Object.keys(t[a]).length,d=0;for(let e in t[a]){let n=t[a][e];""===n&&(n=`"${n}"`),void 0!==n&&"undefined"!==n&&null!==n||(n='""'),n=l._unescapeString(n),s+=n,d++,d<r&&(s+="\t")}if(n+=s,i++,i<o&&(n+="\r\n"),"x"===e&&l.editing.enabled){const e=l.getSelection();e.cells&&(l._cutCells=e.cells),e.rows&&(l._cutRows=e.rows)}}if(navigator.clipboard&&navigator.clipboard.writeText)navigator.clipboard.writeText(n).then((function(){}),(function(){})),Smart.Utilities.Core.Browser.Firefox&&(l._clipboardText=n);else{const e=document.createElement("textarea");e.value=n,e.style.position="fixed",e.style.left="-999999px",e.style.top="-999999px",document.body.appendChild(e),e.focus(),e.select(),setTimeout((()=>{document.execCommand("copy"),e.remove(),l._clipboardText=n}),25)}}if(t.ctrlKey&&" "===e&&l.editing.addNewRow.visible&&(l._keyboardAdd=!0,l._addNewGridRow(),l._keyboardAddTimer&&clearTimeout(l._keyboardAddTimer),l._keyboardAddTimer=setTimeout((()=>{l._keyboardAdd=!1}),300)),(t.ctrlKey||t.metaKey)&&"v"===e&&l.editing.enabled){const e=window.Smart.Utilities.Core.Browser.Firefox;if(navigator.clipboard&&!navigator.clipboard.readText&&!e)return;const t=e=>{if(!e)return;const t=[];let n=e.trim().split("\r");if(l._selection&&l._selection.columns&&Object.keys(l._selection.columns).length>0&&(n=e.split("\r")),1===n.length){let t=e.trim().split("\n");l._selection&&l._selection.columns&&Object.keys(l._selection.columns).length>0&&(t=e.split("\n")),t.length>1&&(n=t)}e.indexOf("<")>=0&&(n=[e.trim()]);for(let e=0;e<n.length;e++){const l=n[e].split("\t");let o={};for(let e=0;e<l.length;e++)o[e]=l[e].trim(),void 0!==o[e]&&"undefined"!==o[e]||(o[e]="");t[e]=o}const o=l._selection.selectionRect;if(o)l._pasteSelectedCells({row:o.row,endRow:o.endDragRow,column:o.column,endColumn:o.endColumn},t);else{let e=null,n=null;for(let t in l._selection.rows){const o=l.rowById[t];e||(e=o),n||(n=o),e.visibleIndex>o.visibleIndex&&(e=o),n.visibleIndex<o.visibleIndex&&(n=o)}if(e&&n&&l._pasteSelectedCells({row:e,endRow:n,column:l.firstColumn(),endColumn:l.lastColumn()},t),0===l._selection.rows.length){const o=l.getSelectedCells();let i=null,a=null;for(let t=0;t<o.length;t++){const s=l.rowById[o[t][0]];if(!s)continue;e||(e=s),n||(n=s);const r=l.columnByDataField[o[t][1]];i||(i=a=r),i&&i.visibleIndex>r.visibleIndex&&(i=r),a&&a.visibleIndex<r.visibleIndex&&(a=r),e.visibleIndex>s.visibleIndex&&(e=s),n.visibleIndex<s.visibleIndex&&(n=s)}if(null===e&&null===n&&null===i&&null===a&&Object.keys(l._selection.columns).length>0){e=l.rows[0],n=l.rows[l.rows.length-1];const t=Object.keys(l._selection.columns)[0];i=l.columnByDataField[t],a=i}l._pasteSelectedCells({row:e,endRow:n,column:i,endColumn:a},t)}}l._cutCells&&l._handleCutCells(),l._cutRows&&l._handleCutRows()};if(!window.isSecureContext||e){if(document.activeElement&&"INPUT"===document.activeElement.nodeName)return!0;const e=document.createElement("textarea");return e.style.position="absolute",e.style.left="-1000px",e.style.top="-1000px",document.body.appendChild(e),e.select(),void setTimeout((()=>{l._clipboardSelection=new Array;let n=e.value;0===n.length&&window.clipboardData&&(e.val(window.clipboardData.getData("Text")),n=e.value);let o=n.split("\n");for(let e=0;e<o.length;e++)if(o[e].split("\t").length>0){var i=o[e].split("\t");if(1===i.length&&e===o.length-1&&""===i[0])continue;i.length>0&&l._clipboardSelection.push(i)}l._clipboardText=l._clipboardSelection.toString(),t(n.trim().replaceAll("\n","\r")),e.remove(),l.focus()}),100)}const n=navigator.clipboard.read?"read":"readText";navigator.clipboard[n]().then((e=>{if(Array.isArray(e)&&e.length){const n=e[0];let o=n.types.indexOf("text/html")>-1?"text/html":"text/plain";try{l._deleteCopyRects(),n.types.length&&n.getType(o).then((e=>{e.text().then((e=>{t(e)}))}))}catch(e){console.log(e),l._deleteCopyRects()}}else"string"==typeof e&&t(e)}))}}}_handleCutRows(){const e=this,t=e._cutRows;t.length>=1?t.map((e=>e.id)).forEach((t=>{requestAnimationFrame((()=>{e.updateRow(t,null,null,!0)}))})):delete e._cutRows}_handleCutCells(){const e=this;e.beginUpdate();const t=e._cutCells;if(t){for(let l=0;l<t.length;l++){const n=t[l],o=e.rowById[n.id];if(o){const t=o.getCell(n.dataField),l=e._pasteDataType({cell:t,value:t.value});let i=null;"int"!==l&&"number"!==l||(i=0),"string"===l&&(i=""),"boolean"!==l&&"bool"!==l||(i=!1),"date"===l&&(i=new Date),t.column.allowNull&&(i=null);const a=t.oldValue;if(e.onCellUpdate)e.onCellUpdate([t],[a],[i],(function(e){e&&(t.value=i)}),e);else if(e.onRowUpdate){const l=Object.assign({},t.row.data),n=Object.assign({},t.row.data);n[t.column.dataField]=i,e.onRowUpdate([t.row.index],[t.row],[l],[n],(function(e){e&&(t.value=i)}),e)}else t.value=i}}e.endUpdate(!1),e._recycle(),delete e._cutCells}}_setRemoveUndoRedo(e){const t=this;if(!t.isInitialized)return;const l=Smart.Utilities.Core.createGUID().replace(/-/gi,"");if(!t._undoRedoAction){t._undoRedo||(t._undoRedo=[]),t._removeUndoRedoHigherIndexes();const n=t.getRowData(e.id);t._undoRedo.push({action:"remove",data:n,index:e.visibleIndex,uid:l}),t._undoRedoIndex=t._undoRedo.length-1}}_setAddUndoRedo(e){const t=this;if(!t.isInitialized)return;const l=Smart.Utilities.Core.createGUID().replace(/-/gi,"");if(!t._undoRedoAction){let n=!1;for(let l=0;l<t._undoRedo.length;l++){const o=t._undoRedo[l];"add"===o.action&&o.index===e.index&&(n=!0)}if(n)return;t._removeUndoRedoHigherIndexes();const o=t.getRowData(e.id);t._undoRedo.push({action:"add",data:o,index:e.visibleIndex,uid:l}),t._undoRedoIndex=t._undoRedo.length-1}}_removeUndoRedoHigherIndexes(){const e=this,t=e._undoRedoIndex;t>=0?e._undoRedo.splice(t+1,e._undoRedo.length-t):-1===t&&(e._undoRedo=[])}_setCellUndoRedo(e,t,l){const n=this;if(!n.isInitialized)return;const o=Smart.Utilities.Core.createGUID().replace(/-/gi,"");n._setCellUndoRedoTimer&&clearTimeout(n._setCellUndoRedoTimer),n._undoRedoAction||(n._pasteUndoRedoValues||(n._pasteUndoRedoValues=[]),void 0===t&&(t=null),n._pasteUndoRedoValues.push({cell:e,index:e.row.index,dataField:e.column.dataField,oldValue:t,newValue:l}),n._setCellUndoRedoTimer=setTimeout((()=>{delete n._setCellUndoRedoTimer,n._removeUndoRedoHigherIndexes(),n._undoRedo||(n._undoRedo=[]),n._pasteUndoRedoValues.length>1?n._undoRedo.push({action:"updateMultiple",items:n._pasteUndoRedoValues,uid:o}):n._undoRedo.push({action:"update",index:e.row.visibleIndex,cell:e,dataField:e.column.dataField,oldValue:t,newValue:l,uid:o}),n._undoRedoIndex=n._undoRedo.length-1,n._pasteUndoRedoValues=[]}),50))}_undoRedoHandler(e){const t=this,l=e.key;if(e.ctrlKey||e.metaKey){if("z"===l)return t.undo(),void e.preventDefault();if("y"===l)return t.redo(),void e.preventDefault()}}_updateMultiple(e,t){const l=this;let n=9999999,o=0,i=999999,a=0,s=l._recyclingRows,r=[],d=[],c=[];l.beginUpdate();for(let u=0;u<e.items.length;u++){const f=e.items[u],p=s[f.index];if(p){const e=p.id,s=f.dataField,u=t?f.oldValue:f.newValue,m=l.columnByDataField[s],g=l.viewColumns.indexOf(m),_=p.getCell(s);_&&(r.push(_),d.push(_.value),c.push(u)),i=Math.min(i,g),a=Math.max(a,g),n=Math.min(n,p.visibleIndex),o=Math.max(o,p.visibleIndex),l.setCellValue(e,s,u)}}l.onCellUpdate&&r.length&&l.onCellUpdate(r,d,c,(function(){}),l),l._focusCell(s[n].id,l.viewColumns[i].dataField),l._selectCellsRange(s[n],s[o],l.viewColumns[i].dataField,l.viewColumns[a].dataField),delete l._undoRedoAction,l.endUpdate(!1)}redo(){const e=this,t=e._undoRedoIndex,l=e._undoRedo[t+1];if(l)switch(e._undoRedoIndex++,e._undoRedoAction=!0,l.action){case"add":e.addRow(l.data,!0);break;case"remove":{const t=e._recyclingRows[l.index];t&&(e.removeRow(t.id),delete e._undoRedoAction);break}case"update":{const t=e.rows[l.index];if(t){const n=t.id,o=l.dataField,i=l.newValue,a=l.oldValue,s=t.getCell(o);s&&(e.setCellValue(n,o,i),e._focusCell(n,o),e.onCellUpdate&&e.onCellUpdate([s],[a],[i],(function(){e.onCellUpdated&&e.onCellUpdated([s.row.index],[s.row],[s.column],[s.row.data],[a],[i],e),e._onCellUpdated&&e._onCellUpdated(s.row.index,s.row,s.column,s.row.data,a,i)}),e))}delete e._undoRedoAction;break}case"updateMultiple":e._updateMultiple(l,!1)}else delete e._undoRedoAction}getEditChanges(){return this._undoRedo}undo(){const e=this,t=e._undoRedoIndex,l=e._undoRedo[t];if(l)switch(e._undoRedoIndex--,e._undoRedoAction=!0,l.action){case"add":{const t=e._recyclingRows[l.index];t&&(e.removeRow(t.id),delete e._undoRedoAction);break}case"remove":{const t=l.data;t&&(e._recyclingRows[l.index]?e.insertRow(t,l.index):e.addRow(t,!0));break}case"update":{const t=e.rows[l.index];if(t){const n=t.id,o=l.dataField,i=l.oldValue;let a=e._cellsUpdatedValues?e._cellsUpdatedValues[n+"_"+o]:void 0;void 0!==a&&delete e._cellsUpdatedValues[n+"_"+o];const s=t.getCell(o);s&&(void 0===a&&(a=s.value),e.setCellValue(n,o,i),e._focusCell(n,o),e.onCellUpdate&&e.onCellUpdate([s],[a],[i],(function(){e.onCellUpdated&&e.onCellUpdated([s.row.index],[s.row],[s.column],[s.row.data],[a],[i],e),e._onCellUpdated&&e._onCellUpdated(s.row.index,s.row,s.column,s.row.data,a,i)}),e))}delete e._undoRedoAction;break}case"updateMultiple":e._updateMultiple(l,!0)}else e._currentUndoRedo=e._undoRedo[0],delete e._undoRedoAction}_keyDownHandler(e){const t=this;if("grid"!==t.view)return;if(t.onKey&&(t.onKey(e),e.defaultPrevented))return;let l=e.key;if(t.disabled||t.displayLoadingIndicator)return;if(t._undoRedoHandler(e),0===t.dataSource.length)return;if("CapsLock"===l)return;if("Escape"===l&&(t.editing.editRow||t.editing.editCell)){t.closeMenu(),t.cancelEdit();let l=t.getSelection().focused;return void(l&&l.dataField&&t._setSelection(l.id,l.dataField,e))}if(!t.editing.editKeyHandling&&(t.editing.editRow||t.editing.editCell||t.filtering.filterRow.cell))return;t.rightToLeft&&("ArrowLeft"===l?l="ArrowRight":"ArrowRight"===l&&(l="ArrowLeft")),t._refreshCellSelectionRect();const n=t.getSelection();let o=n.focused;if(!n.focused){if(t.editing.enabled&&!0!==t.editing.isEditing&&("F2"===l||"Enter"===l)&&n.columns&&n.columns.length>0){const e=n.columns[n.columns.length-1];e.column.allowHeaderEdit&&t._beginColumnEdit(e.column)}return t.menu&&t.menu.classList.contains("open")&&"Escape"===l&&t.closeMenu(),void(n.columns&&n.columns.length>0&&e.ctrlKey&&("c"!==l&&"v"!==l&&"x"!==l||t._clipboardHandler(l,e)))}if(e.shiftKey&&e.ctrlKey&&" "===l){const e=t.rowById[o.id];if(e){const t=e.getCell(o.dataField);if(t)return void t.autoWrap()}}const i=t._getParentCell(t.rowById[o.id],o.dataField);if(i&&("ArrowLeft"===l?(o.id=i.row.id,o.dataField=i.column.dataField):"ArrowRight"===l?(o.id=i.row.id,o.dataField=i.endColumn.dataField):"ArrowUp"===l?(o.id=i.row.id,o.dataField=i.column.dataField):"ArrowDown"===l&&(o.id=i.endRow.id,o.dataField=i.column.dataField)),t._selection.selectionRect&&e.shiftKey&&!e.ctrlKey&&!e.metaKey?(t._selection.selectionRect.endRow&&(o.id=t._selection.selectionRect.endRow.id),t._selection.selectionRect.endColumn&&(o.dataField=t._selection.selectionRect.endColumn.dataField)):t.selection.allowRowSelection&&!t.selection.allowCellSelection&&void 0!==t._rangeSelectionEndRow&&(o.id=t._rangeSelectionEndRow.id),e.ctrlKey||e.metaKey){const n=t.$.headerBar;n&&("b"===l&&(n._boldCommand(),e.preventDefault()),"i"===l&&(n._italicCommand(),e.preventDefault()),"u"===l&&(n._underlineCommand(),e.preventDefault()),"y"===l&&(n._strikethroughCommand(),e.preventDefault()))}if(t._clipboardHandler(l,e),((e.ctrlKey||e.metaKey)&&"x"!==l&&"c"!==l&&"v"!==l&&"Control"!==l||t.selection.allowCellSelection&&"Tab"===l)&&(t._selection.rows=[],t._selection.columns=[],t._selection.cells=[],t._selection.indexes=[]),"Escape"===l)return t.closeMenu(),t.cancelEdit(),void t._setSelection(o.id,o.dataField,e);if(t.hasMenu())return;if(e.shiftKey&&"Enter"===l&&t.rowDetail.dialog.enabled&&!t.rowDetail.dialog.visible){const l=t.rowById[o.id];if(l)return l.showDetail=!0,e.preventDefault(),void e.stopPropagation()}if(e.ctrlKey||e.metaKey){let n=!1;"f"===l&&(t.$.headerBar&&t.$.headerBar.openSearchPanel(),n=!0),"s"===l&&(t.$.headerBar&&t.$.headerBar.openSortPanel(),n=!0),"d"===l&&(t.$.headerBar&&t.$.headerBar._openDownloadMenu(),n=!0),"f"===l&&(t.$.headerBar&&t.$.headerBar.openFilterPanel(),n=!0),"w"===l&&(t.$.headerBar&&t.$.headerBar._openViewsMenu(),n=!0),n&&(e.stopPropagation(),e.preventDefault())}if(e.altKey){if("ArrowDown"===l){const l=t.columnByDataField[o.dataField];l&&t.hasColumnMenu(l)&&(l.element._showActionButton(),l.onAction(),t.menu&&t.menu.querySelector("smart-menu").$.dispatch(e))}else"ArrowUp"===l&&t.closeMenu();if("s"===l.toLowerCase()){const e=t.columnByDataField[o.dataField];e&&(e.sorted?"asc"===e.sortOrder?t.sortBy(e.dataField,"desc"):t.sortBy(e.dataField,null):t.sortBy(e.dataField,"asc"))}if("g"===l.toLowerCase()){const e=t.columnByDataField[o.dataField];e&&(e.group=!e.group)}return}const a=function(l,n){const o=(l,n)=>{if("extended"!==t.selection.mode&&"many"!==t.selection.mode&&t._clearSelection(!0),"many"===t.selection.mode){if(" "===e.key)t._setSelection(l,n,e);else{const e=t.rowById[l].getCell(n);t._selection.focusedCell={id:e.row.id,value:e.value,dataField:n,index:e.row.index}}return t.ensureVisible(l,n),void t._recycle()}"ArrowDown"===e.key||"ArrowUp"===e.key||"ArrowLeft"===e.key||"ArrowRight"===e.key?(t._setSelection(l,n,e),t.ensureVisible(l,n)):(t.beginUpdate(),t._setSelection(l,n,e),t.ensureVisible(l,n),t.endUpdate(!1,!1),"ArrowDown"===e.key||"ArrowUp"===e.key?t._recycle(!1,!0):t._recycle()),e.shiftKey?t.__selectionStarted&&!t.__selectionStartedFired?(t.$.fireEvent("change",{started:!0,finished:!1}),t.__selectionStartedFired=!0):t.$.fireEvent("change",{started:!1,finished:!1}):(t.$.fireEvent("change",{started:!1,finished:!0}),t._refreshSummary())};if(t._isVirtualMode()){t._keyboardNavigationTimer&&clearTimeout(t._keyboardNavigationTimer);const e=e=>{for(let l=0;l<t.rows.length;l++){const n=t.rows[l];if(n.index===e)return n.id}return null},i=l,a=JSON.parse(JSON.stringify(t._selection.focusedCell));t._selection.focusedCell.index=i,t._selection.focusedCell.dataField=n;const s=t.rows[0],r=s.height;if(-1===i)return;const d=t._scrollView.hScrollBar,c="virtual"!==t.scrolling?s.top:i*r;let u=0;if(t.paging.enabled||(c+d.offsetHeight+t.__frozenNearHeight>t._scrollView.scrollTop+t.$.scrollView.offsetHeight-t.__frozenFarHeight?(t._scrollView.scrollTop=c-t.$.scrollView.offsetHeight-t.__frozenFarHeight+d.offsetHeight,u=50):c<=t._scrollView.scrollTop&&(t._scrollView.scrollTop=c,u=50)),t._onDataUpdated||(t._onDataUpdated=()=>{t._recycle();const l=e(t._selection.focusedCell.index);t.rowById[l]?o(l,t._selection.focusedCell.dataField):t.paging.enabled&&(t._selection.focusedCell=a),t._onDataUpdated=null}),t.paging.enabled){const l=e(t._selection.focusedCell.index);t.rowById[l]?o(l,t._selection.focusedCell.dataField):t._selection.focusedCell=a}else t._keyboardNavigationTimer=setTimeout((()=>{const l=e(t._selection.focusedCell.index);t.rowById[l]&&o(l,t._selection.focusedCell.dataField)}),u)}else requestAnimationFrame((()=>{o(l,n)})),e.stopPropagation(),e.preventDefault()};if(t.keys&&t.keys[l]){const n=t.keys[l];switch(n){case"delete":if(o){const l=o.id,n=t.rowById[l];if(n)return t.updateRow(l,null,null,!0),e.stopPropagation(),e.preventDefault(),void t.$.fireEvent("endEdit",{id:l,dataField:null,row:n,column:null,cell:null,data:n?n.data:null,value:null})}break;case"deleteCell":if(o){const l=o.id,n=t.rowById[l],i=o.dataField;if(n){const o=t.columnByDataField[i];return void(o.allowEdit&&(t.setCellValue(l,i,""),e.stopPropagation(),e.preventDefault(),t.$.fireEvent("endEdit",{id:l,dataField:i,row:n,column:o,cell:n?n.getCell(i):null,data:n?n.data:null,value:null})))}}break;case"copy":case"copyPrev":case"copyNext":if(o){const l=o.id,i=t.rowById[l];if(i){if("copy"===n)return t._clipboardHandler("c",e),e.stopPropagation(),void e.preventDefault();if("copyPrev"===n){const l=t.prevRow(o.id);if(l)return t.updateRow(l.id,i.data,null,!0),e.stopPropagation(),e.preventDefault(),void t.$.fireEvent("endEdit",{id:l.id,dataField:null,row:l,column:null,cell:null,data:i?i.data:null,value:null})}else if("copyNext"===n){const l=t.nextRow(o.id);if(l)return t.updateRow(l.id,i.data,null,!0),e.stopPropagation(),e.preventDefault(),void t.$.fireEvent("endEdit",{id:l.id,dataField:null,row:l,column:null,cell:null,data:i?i.data:null,value:null})}}}break;default:if(["Backspace","Tab","Enter","Shift","Control","Alt","Pause","CapsLock","Escape","Space","PageUp","PageDown","End","Home","ArrowLeft","ArrowUp","ArrowRight","ArrowDown","Insert","Delete","0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","F1","F2","F3","F4","F5","F6","F7","F8","F9","F10","F11","F12","NumLock","ScrollLock","Semicolon","Equal","Comma","Minus","Period","Slash","Backquote","BracketLeft","Backslash","BracketRight","Quote"].indexOf(n)>=0)l=n;else{const l=o.id,i=t.rowById[l];if(t[n]&&"function"==typeof t[n])return t[n](t,i,e),e.stopPropagation(),void e.preventDefault();if(window[n]&&"function"==typeof window[n])return window[n](t,i,e),e.stopPropagation(),void e.preventDefault();if("function"==typeof n)return n(t,e),e.stopPropagation(),void e.preventDefault()}}t.$.fireEvent("keyPressed",e)}switch("Enter"!==l||!t.editing.enabled||"cell"!==t.editing.mode||t.editing.isEditing||t._editDownKey||(l="F2"),l){case"Tab":{if("none"===t.selection.tabKeyBehavior)return;const l=e.shiftKey?t.prevColumn(o.dataField):t.nextColumn(o.dataField);if(l&&t.selection.allowCellSelection){const n=t.rowById[o.id].getCell(l.dataField);t._selection.focusedCell={id:n.row.id,value:n.value,dataField:l.dataField,index:n.row.index},t._setSelection(o.id,l.dataField,e),t.ensureVisible(o.id,l.dataField),t.focus(),e.stopPropagation(),e.preventDefault()}else{let l=e.shiftKey?t.prevRow(o.id):t.nextRow(o.id),n=e.shiftKey?t.lastColumn().dataField:t.firstColumn().dataField;if(t.editing.addNewRow.autoCreate&&!e.shiftKey&&o.id===t.lastRow().id&&(t.addUnboundRow(1),l=t.lastRow()),!l)return;e.shiftKey&&(t._selection.focusedCell=null),a(t._isVirtualMode()?l.index:l.id,n)}t.$.fireEvent("change",{started:!1,finished:!0}),t._refreshSummary();break}case" ":case"F2":{const n=t.rowById[o.id];if(!n||t.editing.editCell)return;if(e.ctrlKey||e.metaKey)return;if(" "===l&&t.dataSource.boundHierarchy&&(n.checked=!n.checked),t.editing.enabled&&!e.shiftKey){const e=t.getSelectedCells();let i=!1;if(e.length>0){let l=[];for(let n=0;n<e.length;n++){const o=e[n],i=o[1],a=t.columnByDataField[i];!a||"bool"!==a.dataType&&"boolean"!==a.dataType||l.push(o)}if(l.length>0){i=!0,t.beginUpdate();const e=l[0],o=e[1],a=e[0],s=e[2],r=t.columnByDataField[o];t.$.fireEvent("beginEdit",{id:null,dataField:o,row:a,column:r,cell:null,data:null,value:s});const d=[],c=[],u=[],f=[],p=[];for(let e=0;e<l.length;e++){const n=l[e],o=n[1],i=n[0],a=n[2],s=t.rowById[i],m=s.getCell(o);p.push(s),f.push(t.columnByDataField[r]),u.push(m),c.push(!a),d.push(a),t.setCellValue(i,o,!a)}t.onCellUpdate&&t.onCellUpdate(u,d,c,(function(){}),t),t.$.fireEvent("endEdit",{id:n?n.id:null,dataField:o,row:n,column:r,cell:e,data:n?n.data:null,value:!s}),t.endUpdate(!1)}}i||(t._beginEdit(n,o.dataField),setTimeout((function(){if(t.editing.editCell&&t.editing.editCell.column.dataType.indexOf("bool")>=0){const e=t.editing.editCell.editor.instance,n=e.getValue();" "===l&&e.setValue(!n)}}),50))}else t.selection.enabled&&"many"===t.selection.mode&&(t._isVirtualMode()?a(o.index,o.dataField):a(o.id,o.dataField));break}case"Delete":case"Backspace":{const e=t.rowById[o.id];if(!e||t.editing.editCell)return;if(t.editing.enabled)if(e.getCell(o.dataField).value,n.cells){t.beginUpdate();for(let e=0;e<n.cells.length;e++){const l=n.cells[e],o=t.rowById[l.id];if(o){const e=o.getCell(l.dataField);if(!e.column.allowEdit)continue;if("image"===e.column.template){const l=e.value,n=l&&l.indexOf("[{")>=0?JSON.parse(l):[];for(let e=0;e<n.length;e++){if(t.uploadSettings.removeUrl){let l=new FormData,o=new XMLHttpRequest,i=n[e].value;l.append(t.uploadSettings.name,i),o.open("POST",t.uploadSettings.removeUrl),o.send(l)}t.uploadSettings.onUploadRemove&&t.uploadSettings.onUploadRemove(n[e])}}const n=t._pasteDataType({cell:e,value:e.value});let i=null;"int"!==n&&"number"!==n||(i=0),"string"===n&&(i=""),"boolean"!==n&&"bool"!==n||(i=!1),"date"===n&&(i=new Date),e.column.allowNull&&(i=null),e.formula=null;const a=e.value;if(t.dataSource&&t.dataSource.virtualDataSource){const n={};if(t.onCellUpdate){t._pasteTempValues||(t._pasteTempValues=[]);const n=i;t._pasteTempValues.push({id:e.row.id,cell:e,dataField:l.column.dataField,oldValue:a,newValue:n}),t._pasteTimer&&clearTimeout(t._pasteTimer),t._pasteTimer=setTimeout((()=>{const l=(e,l)=>{const n=e.row;if(n){let o=null;if(t.storeHistory&&(o=t._stringifyRow(n)),l!==(void 0!==e.value?e.value:"")&&(n.updatedDate=new Date,n.updatedBy=t.currentUser,t.storeHistory)){e.value=l;const i=t._stringifyRow(n);t._updateRowHistory(n,o,i)}}};if(t._pasteTempValues&&t._pasteTempValues.length>1){let e=[],n=[],o=[];for(let l=0;l<t._pasteTempValues.length;l++){const i=t._pasteTempValues[l];e.push(i.cell),n.push(i.oldValue),o.push(i.newValue)}t.onCellUpdate(e,n,o,(function(n){if(n){const n=t.onRowHistory;t.onRowHistory=null,t.beginUpdate();for(let t=0;t<e.length;t++){const n=e[t];l(n,o[t]),n.value=o[t]}t.endUpdate(!1),t.onRowHistory=n}}),t)}else t.onCellUpdate([e],[a],[n],(function(o){if(o){const o=t.onRowHistory;t.onRowHistory=null,l(e,n),e.value=n,t.onRowHistory=o}}),t);delete t._pasteTempValues}),100)}else if(t.onRowUpdate){const l=Object.assign({},e.row.data),n=Object.assign({},e.row.data);n[e.column.dataField]=i,t.onRowUpdate(e.row.index,e.row,l,n,(function(t){t&&(e.value=i)}),t)}else n[e.column.dataField]=i;t.editing.batch?t._batchUpdateCell(e.row,e.column,i,e.value):t.updateRow(e.row.id,n)}else if(t._setCellUndoRedo(e,a,i),t.onCellUpdate){t._pasteTempValues||(t._pasteTempValues=[]);const n=i;t._pasteTempValues.push({id:e.row.id,cell:e,dataField:l.column.dataField,oldValue:a,newValue:n}),t._pasteTimer&&clearTimeout(t._pasteTimer),t._pasteTimer=setTimeout((()=>{const l=(e,l)=>{const n=e.row;if(n){let o=null;if(t.storeHistory&&(o=t._stringifyRow(n)),l!==(void 0!==e.value?e.value:"")&&(n.updatedDate=new Date,n.updatedBy=t.currentUser,t.storeHistory)){e.value=l;const i=t._stringifyRow(n);t._updateRowHistory(n,o,i)}}};if(t._pasteTempValues&&t._pasteTempValues.length>1){let e=[],n=[],o=[];for(let l=0;l<t._pasteTempValues.length;l++){const i=t._pasteTempValues[l];e.push(i.cell),n.push(i.oldValue),o.push(i.newValue)}t.onCellUpdate(e,n,o,(function(n){if(n){const n=t.onRowHistory;t.onRowHistory=null,t.beginUpdate();for(let t=0;t<e.length;t++){const n=e[t];l(n,o[t]),n.value=o[t]}t.endUpdate(!1),t.onRowHistory=n}}),t)}else t.onCellUpdate([e],[a],[n],(function(o){if(o){const o=t.onRowHistory;t.onRowHistory=null,l(e,n),e.value=n,t.onRowHistory=o}}),t);delete t._pasteTempValues}),100)}else if(t.onRowUpdate){const l=Object.assign({},e.row.data),n=Object.assign({},e.row.data);n[e.column.dataField]=i,t.onRowUpdate(e.row.index,e.row,l,n,(function(t){t&&(e.value=i)}),t)}else e.value=i;t._conditionalColors&&t._conditionalColors.update&&setTimeout((()=>{t._conditionalColors.update(),t._recycle(!1)}),100)}}t.endUpdate(!1),t._recycle(),t._refreshDataFilters()}else{const e=t._getSelectedRows();if(e&&e.length&&t._selection.rows&&Object.keys(t._selection.rows).length>0){const e=t.getSelectedRows();if(e.length>=1)return void e.map((e=>e[0])).forEach((e=>{requestAnimationFrame((()=>{t.updateRow(e,null,null,!0)}))}))}}break}default:if(t.editing.enabled&&!t.editing.editCell&&!e.ctrlKey&&!e.metaKey&&!e.altKey&&!t.editing.editRow){const e=t.rowById[o.id];if(!e)return;if(["F1","F2","F3","F4","F5","F6","F7","F8","F9","F10","F11","F12","Shift","Up","Down","Left","Right","Control","F2","Esc"," ","Home","End","PageUp","PageDown"].indexOf(l)>=0)return;t._beginEditKey=l,t._beginEdit(e,o.dataField),setTimeout((function(){if(t.editing.editCell)t.editing.editCell.editor.instance.setValue(t._beginEditKey);else if(t.editing.editRow){const e=t.editing.editRow.getCell(o.dataField);if(!e)return;e.editor.instance.setValue(t._beginEditKey)}delete t._beginEditKey}),50)}break;case"Home":{const l=t.firstRow();if(t.paging.enabled&&e.shiftKey)return t.firstPage(),e.stopPropagation(),void e.preventDefault();if(!l)return;a(l.id,o.dataField);break}case"End":{if(t.paging.enabled&&e.shiftKey)return t.lastPage(),e.stopPropagation(),void e.preventDefault();const l=t.lastRow();if(!l)return;a(l.id,o.dataField);break}case"PageUp":{const l=t._recyclingRows,n=t.rowById[o.id],i=l.indexOf(n);if(t.paging.enabled&&e.shiftKey)return t.prevPage(),e.stopPropagation(),void e.preventDefault();if(t._isVirtualMode()){const e=Math.round(t.$.scrollView.offsetHeight/t.rows[0].height);a(Math.max(o.index-e,0),o.dataField)}else{for(let e=i;e>=0;e--){const i=l[e];if(n.top-i.top>=t.$.scrollView.offsetHeight)return void a(i.id,o.dataField)}a(t.firstRow().id,o.dataField)}break}case"PageDown":{const l=t._recyclingRows,n=t.rowById[o.id],i=l.indexOf(n);if(t.paging.enabled&&e.shiftKey)return t.nextPage(),e.stopPropagation(),void e.preventDefault();if(t._isVirtualMode()){const e=Math.round(t.$.scrollView.offsetHeight/t.rows[0].height);a(Math.min(o.index+e,t.dataSource.virtualDataSourceLength-1),o.dataField)}else{for(let e=i;e<l.length;e++){const i=l[e];if(i.top-n.top>=t.$.scrollView.offsetHeight)return void a(i.id,o.dataField)}a(t.lastRow().id,o.dataField)}break}case"Enter":case"ArrowDown":if(t._isVirtualMode())a(e.ctrlKey||e.metaKey?t.lastRow():o.index+1,o.dataField);else{let n=e.ctrlKey||e.metaKey?t.lastRow():t.nextRow(o.id);if(!t.editing.addNewRow.autoCreate||"Enter"!==l||o.id!==t.lastRow().id||e.ctrlKey||e.metaKey||(t.addUnboundRow(1),n=t.lastRow()),!n)return;let i=!0;"Enter"===l&&(e.ctrlKey||e.metaKey)&&(i=!1),i&&a(n.id,o.dataField)}break;case"ArrowUp":if(t._isVirtualMode())a(e.ctrlKey||e.metaKey?t.lastRow():Math.max(0,o.index-1),o.dataField);else{const l=e.ctrlKey||e.metaKey?t.firstRow():t.prevRow(o.id);if(!l)return;a(l.id,o.dataField)}break;case"ArrowRight":{const l=t.rowById[o.id],n=!!t.columnByDataField[o.dataField]&&t.columnByDataField[o.dataField]._treeColumn;if((!t.selection.allowCellSelection||n)&&!1===l.leaf){if(!l.expanded)return l.expand(),e.stopPropagation(),void e.preventDefault();{const e=t.nextRow(o.id);if(e)return void a(e.id,o.dataField)}}const i=e.ctrlKey||e.metaKey?t.lastColumn():t.nextColumn(o.dataField);if(!i)return;a(t._isVirtualMode()?o.index:o.id,i.dataField);break}case"ArrowLeft":{const l=t.rowById[o.id],n=!!t.columnByDataField[o.dataField]&&t.columnByDataField[o.dataField]._treeColumn;if(!t.selection.allowCellSelection||n){if(!1===l.leaf)return void(l.expanded?(l.collapse(),e.stopPropagation(),e.preventDefault()):l.parent&&a(l.parent.id,o.dataField));if(!0===l.leaf&&l.parent)return void a(l.parent.id,o.dataField)}const i=e.ctrlKey||e.metaKey?t.firstColumn():t.prevColumn(o.dataField);if(!i)return;a(t._isVirtualMode()?o.index:o.id,i.dataField);break}}["Shift","Up","Down","Left","Right","Control","F2","Esc"," ","Home","End","PageUp","PageDown"].indexOf(l)<0||(e.stopPropagation(),e.preventDefault())}_keyUpHandler(e){const t=this;"Escape"===e.key&&t._dragDrop&&t._endDrag(e),t._focused&&("Shift"===e.key&&(t.$.fireEvent("change",{started:!1,finished:!0}),t._refreshSummary()),!t.onKeyUp||(t.onKeyUp(e),e.defaultPrevented))}firstRow(){const e=this._recyclingRows;if(this._isVirtualMode())return{id:0};if(e&&e.length>0){if(!e[0].autoGenerated&&e[0].allowSelect)return e[0];for(let t=0;t<e.length;t++)if(!e[t].autoGenerated&&e[t].allowSelect)return e[t]}return null}lastRow(){const e=this,t=e._recyclingRows;if(e._isVirtualMode())return{id:e.dataSource.virtualDataSourceLength-1};if(t&&t.length>0){const e=t[t.length-1];if(!e.autoGenerated&&e.allowSelect)return e;for(let e=t.length-1;e>=0;e--)if(!t[e].autoGenerated&&t[e].allowSelect)return t[e]}return null}nextRow(e){const t=this._recyclingRows,l=this.rowById[e],n=t.indexOf(l);let o=1;if(l&&void 0!==l._rowSpan&&(o=l._rowSpan),n>=0&&t[n+o]&&!t[n+o].autoGenerated){const e=t[n+o];if(e.allowSelect&&!e.disabled)return e;for(let e=n+o;e<t.length;e++){const l=t[e];if(l.allowSelect&&!l.disabled)return l}}return null}_isVirtualMode(){const e=this;return e.dataSource&&e.dataSource.virtualDataSource&&!e.dataSource.virtualDataSourceOnExpand&&e.dataSource.length>e.virtualModeCachedRowsCount&&"infinite"!==e.scrolling}prevRow(e){const t=this,l=t._recyclingRows,n=t.rowById[e],o=l.indexOf(n);if(t._isVirtualMode())return 0===e?null:{id:n.index-1};if(o>=0&&l[o-1]&&!l[o-1].autoGenerated){const e=l[o-1];if(e.allowSelect&&!e.disabled)return e;for(let e=o-1;e>=0;e--){const t=l[e];if(t.allowSelect&&!t.disabled)return t}}return null}firstColumn(){const e=this.viewColumns;if(e&&e.length>0)for(let t=0;t<e.length;t++){const l=e[t];if(l.allowSelect&&!l.autoGenerated)return l}return null}lastColumn(){const e=this.viewColumns;if(e&&e.length>0)for(let t=e.length-1;t>=0;t--){const l=e[t];if(l.allowSelect&&!l.autoGenerated)return l}return null}nextColumn(e){const t=this.viewColumns,l=this.columnByDataField[e];let n=t.indexOf(l);for(;n<t.length;){const e=t[n+1];if(!e)return null;if(e.autoGenerated)return null;if(e.visible)return e;n++}return null}prevColumn(e){const t=this.viewColumns,l=this.columnByDataField[e];let n=t.indexOf(l);for(;n>0;){const e=t[n-1];if(e.autoGenerated)return null;if(e.visible)return e;n--}return null}isJSON(e){if("string"!=typeof e)return!1;const t=e.trim();if(!t)return!1;if(t.startsWith("{")&&t.endsWith("}")||t.startsWith("[")&&t.endsWith("]"))try{const e=new Function("return "+t)();return e&&"object"==typeof e}catch(e){return!1}return!1}isVisible(e,t){const l=this,n=l._scrollView.vScrollBar,o=l._scrollView.hScrollBar,i=l.rowById[e],a=l.columnByDataField[t];return{row:function(e){if(!e)return!1;const t=e.visibleIndex;if(-1===t)return!1;const n=l.dataSource&&l.dataSource.virtualDataSource&&!l.dataSource.virtualDataSourceOnExpand&&l.dataSource.length>l.virtualModeCachedRowsCount&&"infinite"!==l.scrolling;let i=e.top;return n&&(i=t*l.rows[0].height),!(i+e.height+o.offsetHeight+l.__frozenNearHeight>=l._scrollView.scrollTop+l.$.scrollView.offsetHeight-l.__frozenFarHeight||i<=l._scrollView.scrollTop)}(i),column:function(e){return!!t&&!(-1===e.visibleIndex||e.left+e.computedWidth+n.offsetWidth>=l._scrollView.scrollLeft+l._clientSize.width||e.left<=l._scrollView.scrollLeft)}(a)}}_ensureRowVisible(e){const t=this;if(!t._scrollView)return;const l=t._scrollView.hScrollBar;if(!e)return;const n=e.visibleIndex;if(-1===n)return;const o="virtual"!==t.scrolling?e.top:n*t.rows[0].height,i=t.summaryRow.visible?t.layout.rowMinHeight:0;if(o+e.height+l.offsetHeight+t.__frozenNearHeight>=t._scrollView.scrollTop+t.$.scrollView.offsetHeight-t.__frozenFarHeight-i&&(t._scrollView.scrollTop=o+e.height-t.$.scrollView.offsetHeight+t.__frozenNearHeight+t.__frozenFarHeight+l.offsetHeight+i),o<=t._scrollView.scrollTop&&(t._scrollView.scrollTop=o),t.paging.enabled){const o=t.paging.pageSize,i=Math.floor(n/o);if(t.paging.pageIndex!==i)return t.goToPage(i),t._scrollView.scrollTop=0,void setTimeout((()=>{e.top+e.height+l.offsetHeight+t.__frozenNearHeight>=t._scrollView.scrollTop+t.$.scrollView.offsetHeight-t.__frozenFarHeight&&(t._scrollView.scrollTop=e.top+e.height),e.top<=t._scrollView.scrollTop&&(t._scrollView.scrollTop=e.top)}),50)}0===n?t._scrollView.scrollTop=0:n===t.dataSource.length-1&&(t.hasAttribute("tree")?n===t.getViewRows().length-1&&(t._scrollView.scrollTop=t._scrollView.scrollHeight):t._scrollView.scrollTop=t._scrollView.scrollHeight)}_ensureColumnVisible(e){const t=this,l=t._scrollView.vScrollBar;if(!e)return;const n=e.visibleIndex;-1!==n&&(e.left+e.computedWidth+l.offsetWidth>=t._scrollView.scrollLeft+t._clientSize.width&&(t._scrollView.scrollLeft=t._scrollView.scrollLeft+e.computedWidth),e.left<=t._scrollView.scrollLeft&&(t._scrollView.scrollLeft=e.left),e.left<=t._frozenColumnsNearWidth+t._scrollView.scrollLeft&&!e.freeze&&t._frozenNearColumns.length>1&&(t._scrollView.scrollLeft=e.left-t._frozenColumnsNearWidth),0===n?t._scrollView.scrollLeft=0:n===t.columns.length-1&&(t._scrollView.scrollLeft=t._scrollView.scrollWidth))}ensureVisible(e,t){const l=this,n=l.rowById[e],o=l.columnByDataField[t];if("virtual"===l.scrolling){const e=l._scrollView.hScrollBar,t=n.visibleIndex*l.rows[0].height,i=l.summaryRow.visible?l.layout.rowMinHeight:0;return t+n.height+e.offsetHeight+l.__frozenNearHeight>=l._scrollView.scrollTop+l.$.scrollView.offsetHeight-l.__frozenFarHeight-i&&l.setVerticalScrollValue(t),void l._ensureColumnVisible(o)}l._ensureRowVisible(n),l._ensureColumnVisible(o)}clearPaste(e,t="text/html",l="keepFormat"){let n;if(e=e.replace(/<!--StartFragment-->|<!--EndFragment-->/gi,""),!t||"plainText"===l){const t=document.createElement("div");t.innerHTML=e,e=t.innerText}const o=e.toLocaleLowerCase();if(n=document.createElement("span"),e=(e=>{let t=document.createElement("div");t.innerHTML=e,["o:p","w:","v:","xml"].forEach((e=>{let l=t.getElementsByTagName(e);for(;l.length>0;)l[0].remove()})),t.querySelectorAll("b").forEach((e=>e.outerHTML=e.outerHTML.replace("<b","<strong").replace("</b>","</strong>"))),t.querySelectorAll("i").forEach((e=>e.outerHTML=e.outerHTML.replace("<i","<em").replace("</i>","</em>"))),t.querySelectorAll("*[style]").forEach((e=>{const t=["color","background-color","font-weight","font-style"],l=e.getAttribute("style");if(l){let n="";l.split(";").forEach((e=>{let[l,o]=e.split(":");l=l&&l.trim(),o=o&&o.trim(),t.includes(l)&&(n+=`${l}: ${o}; `)})),n.trim()?e.setAttribute("style",n.trim()):e.removeAttribute("style")}})),t.innerHTML=t.innerHTML.replace(/\r?\n|\r/g," "),t.innerHTML=t.innerHTML.replace(/(<br\s*\/?>\s*){2,}/g,"<br>"),t.innerHTML=t.innerHTML.replace(/(<p>(\s|&nbsp;)*<\/p>\s*){2,}/g,"<p></p>"),t.innerHTML=t.innerHTML.replace(/(\s|&nbsp;){2,}/g," "),t.innerHTML=t.innerHTML.replace(/>\s+</g,"><"),t.innerHTML=t.innerHTML.replaceAll("·",""),t.innerHTML=t.innerHTML.replaceAll('class="MsoNormal"',""),t.innerHTML=t.innerHTML.replace(/<!--.*?-->/gs,""),["div","span"].forEach((e=>{let l=t.getElementsByTagName(e);Array.from(l).forEach((e=>{let t=e.parentNode;for(;e.firstChild;)t.insertBefore(e.firstChild,e);t.removeChild(e)}))})),t.querySelectorAll("p, div, span").forEach((e=>{e.textContent.trim()||e.querySelector("img")||e.querySelector("a")||e.remove()}));let l=t.innerHTML;return l.replace(/[\u2018\u2019]/g,"'").replace(/[\u201C\u201D]/g,'"').replace(/\u2013/g,"-").replace(/\u2014/g,"--").replace(/\u2026/g,"...").replace(/\u00A0/g," ").replace(/\uFEFF/g,"").replace(/[\u200B-\u200D]/g,"").replace(/[\u202A-\u202E]/g,""),l})(e),n.innerHTML=e,o.indexOf("<video")>-1||o.indexOf("<iframe")>-1||o.indexOf("smart-editor-image-caption")>-1){const e=n.querySelectorAll("video, iframe"),t=n.querySelector(".smart-editor-image-caption"),l=e.length>0;let o=document.createDocumentFragment();for(let t=0,l=e.length;t<l;t+=1)o.appendChild(e[t]);if(t&&(t.removeAttribute("style"),o.appendChild(t)),l||t){const e=document.createElement("span");n.classList.add("smart-editor-image-container"),l&&n.classList.add("smart-editor-video-container"),n.setAttribute("contenteditable",!1),o.childElementCount&&(n.innerHTML="",n.appendChild(o)),e.appendChild(n),n=e}}return"keepFormat"===l&&(e=>{if(e&&e.nodeType!==Node.TEXT_NODE){const t=e.querySelectorAll("style, [style]");for(let e=0,l=t.length;e<l;e+=1){const l=t[e];"style"===l.nodeName.toLowerCase()?l.remove():t[e].removeAttribute("style")}e.removeAttribute("style")}})(n),n.innerHTML}clearSelection(){const e=this;delete e._rangeSelectionStartRow,delete e._rangeSelectionEndRow,delete e._areAllRowsSelected,e._clearSelection(!0),e.$.fireEvent("change",{started:!1,finished:!0}),e._refreshSummary()}});
1527
1527
 
1528
1528
  /***/ }),
1529
1529
 
@@ -1537,7 +1537,7 @@ Smart.Utilities.Assign("Grid.Sort",class{clearSort(){const t=this;if(!t._isSorti
1537
1537
  /***/ 238:
1538
1538
  /***/ (() => {
1539
1539
 
1540
- Smart("smart-grid-toolbar",class extends Smart.DataView{template(){return'<div id="container" role="presentation">\n <div id="header" class="smart-data-view-header" role="toolbar">\n <div id="viewStatesButton" class="smart-data-view-header-button smart-data-view-states-button smart-unselectable" role="button" aria-expanded="false" aria-haspopup="dialog" aria-label="ViewStates"><div class="smart-tool-label" role="presentation"></div></div>\n <div id="viewsButton" class="smart-data-view-header-button smart-data-view-views-button smart-unselectable" role="button" aria-expanded="false" aria-haspopup="dialog" aria-label="Views"><div class="smart-tool-label" role="presentation"></div></div>\n <div id="customizeButton" class="smart-data-view-header-button smart-data-view-customize-button smart-unselectable" role="button" aria-expanded="false" aria-haspopup="dialog" aria-label="Customize cards"><div class="smart-tool-label" role="presentation"></div></div>\n <div id="filterButton" class="smart-data-view-header-button smart-data-view-filter-button smart-unselectable" role="button" aria-expanded="false" aria-haspopup="dialog" aria-label="Filter"><div class="smart-tool-label" role="presentation"></div></div>\n <div id="sortButton" class="smart-data-view-header-button smart-data-view-sort-button smart-unselectable" role="button" aria-expanded="false" aria-haspopup="dialog" aria-label="Sort"><div class="smart-tool-label" role="presentation"></div></div>\n <div id="groupButton" class="smart-data-view-header-button smart-data-view-group-button smart-unselectable" role="button" aria-expanded="false" aria-haspopup="dialog" aria-label="Group"><div class="smart-tool-label" role="presentation"></div></div>\n <div id="aiButton" class="smart-data-view-header-button smart-data-view-ai-button smart-unselectable" role="button" aria-expanded="false" aria-haspopup="dialog" aria-label="ai"></div>\n <div id="resourceButton" class="smart-data-view-header-button smart-data-view-resource-button smart-unselectable" role="button" aria-expanded="false" aria-haspopup="dialog" aria-label="Resource"><div class="smart-tool-label" role="presentation"></div></div>\n <div id="labelButton" class="smart-data-view-header-button smart-data-view-label-button smart-unselectable" role="button" aria-expanded="false" aria-haspopup="dialog" aria-label="Lael"><div class="smart-tool-label" role="presentation"></div></div>\n <div id="formatButton" class="smart-data-view-header-button smart-data-view-format-button smart-unselectable" role="button" aria-expanded="false" aria-haspopup="dialog" aria-label="Format"><div class="smart-tool-label" role="presentation"></div></div>\n <div id="colorsButton" class="smart-data-view-header-button smart-data-view-colors-button smart-unselectable" role="button" aria-expanded="false" aria-haspopup="dialog" aria-label="Colors"><div class="smart-tool-label" role="presentation"></div></div>\n <div id="deleteButton" class="smart-data-view-header-button smart-data-view-delete-button smart-unselectable" role="button" aria-expanded="false" aria-haspopup="dialog" aria-label="Delete"><div class="smart-tool-label" role="presentation"></div></div>\n <div id="customButton" class="smart-data-view-header-button smart-data-view-custom-button smart-unselectable" role="button" aria-expanded="false" aria-haspopup="dialog" aria-label="Custom"><div class="smart-tool-label" role="presentation"></div></div>\n <div id="downloadButton" class="smart-data-view-header-button smart-data-view-download-button smart-unselectable" role="button" aria-expanded="false" aria-haspopup="dialog" aria-label="Download"><div class="smart-tool-label" role="presentation"></div></div>\n <div id="boldButton" class="smart-data-view-header-button smart-data-view-bold-button smart-unselectable" role="button" aria-expanded="false" aria-haspopup="dialog" aria-label="Bold"><div class="smart-tool-label" role="presentation"></div></div>\n <div id="italicButton" class="smart-data-view-header-button smart-data-view-italic-button smart-unselectable"\n role="button" aria-expanded="false" aria-haspopup="dialog" aria-label="Italic">\n <div class="smart-tool-label" role="presentation"></div>\n </div>\n <div id="underlineButton" class="smart-data-view-header-button smart-data-view-underline-button smart-unselectable"\n role="button" aria-expanded="false" aria-haspopup="dialog" aria-label="Underline">\n <div class="smart-tool-label" role="presentation"></div>\n </div>\n <div id="strikethroughButton" class="smart-data-view-header-button smart-data-view-strikethrough-button smart-unselectable"\n role="button" aria-expanded="false" aria-haspopup="dialog" aria-label="Strikethrough">\n <div class="smart-tool-label" role="presentation"></div>\n </div>\n <div id="fontFamilyButton" class="smart-data-view-header-button smart-data-view-fontfamily-button smart-unselectable"\n role="button" aria-expanded="false" aria-haspopup="dialog" aria-label="Font Family">\n <div class="smart-tool-label" role="presentation"></div>\n </div>\n <div id="fontSizeButton" class="smart-data-view-header-button smart-data-view-fontsize-button smart-unselectable"\n role="button" aria-expanded="false" aria-haspopup="dialog" aria-label="Font Size">\n <div class="smart-tool-label" role="presentation"></div>\n </div>\n <div id="backgroundButton" class="smart-data-view-header-button smart-data-view-background-button smart-unselectable"\n role="button" aria-expanded="false" aria-haspopup="dialog" aria-label="Background">\n <div class="smart-tool-label" role="presentation"></div>\n </div>\n <div id="colorButton" class="smart-data-view-header-button smart-data-view-textcolor-button smart-unselectable"\n role="button" aria-expanded="false" aria-haspopup="dialog" aria-label="Text Color">\n <div class="smart-tool-label" role="presentation"></div>\n </div>\n <div id="searchButton" class="smart-data-view-header-button smart-data-view-search-button smart-unselectable" role="button" aria-expanded="false" aria-haspopup="dialog" aria-label="Search"></div>\n <div id="headerDropDown" owner class="smart-data-view-header-drop-down smart-visibility-hidden" role="dialog">\n <div id="view" class="smart-hidden" role="presentation"></div>\n <div id="customize" class="smart-hidden" role="presentation"></div>\n <div id="filter" class="smart-hidden" role="presentation"></div>\n <div id="sort" class="smart-hidden" role="presentation"></div>\n <div id="ai" class="smart-hidden" role="presentation"></div>\n <div id="group" class="smart-hidden" role="presentation"></div>\n <div id="format" class="smart-hidden" role="presentation"></div>\n <div id="colors" class="smart-hidden" role="presentation"></div>\n <div id="search" class="smart-data-view-search-box smart-hidden" role="presentation">\n <input type="text" id="searchInput" spellcheck="false" aria-label="Search" />\n <div id="searchLabel" class="smart-data-view-search-label smart-unselectable"></div>\n <div id="searchPrev" class="smart-data-view-search-prev" role="button" aria-label="Previous"></div>\n <div id="searchNext" class="smart-data-view-search-next" role="button" aria-label="Next"></div>\n <div id="searchClose" class="smart-data-view-search-close" role="button" aria-label="Close search box"></div>\n </div>\n </div>\n </div>\n </div>'}_refreshMobileViewTools(){const e=this;e.grid.offsetWidth<600?e.querySelectorAll(".smart-tool-label").forEach((e=>{e.classList.add("smart-hidden"),e.parentNode.classList.add("mobile")})):e.querySelectorAll(".smart-tool-label").forEach((e=>{e.classList.remove("smart-hidden"),e.parentNode.classList.remove("mobile")}))}refreshTools(){const e=this;if(e.isRendered&&e.grid&&(e._refreshMobileViewTools(),e.refreshHeaderDropDownPosition(),e.grid)){const t=e.grid;if(t.dataSource&&t.dataSource.boundSource){const a=t.dataSource&&t.dataSource.virtualDataSource&&!t.dataSource.virtualDataSourceOnExpand&&t.dataSource.length>t.virtualModeCachedRowsCount&&"infinite"!==t.scrolling;if(e.dataSource&&t.dataSource&&e.dataSource.length!==t.dataSource.length||a)if(a){const a=Array.isArray(t.dataSource.boundSource)?t.dataSource.boundSource:t.dataSource.boundSource.toArray();e.dataSource=new Smart.DataAdapter({observable:!1,dataSource:[...a],dataFields:t.dataSource.dataFields})}else e.dataSource=t.dataSource;const o=t=>{const a=t?"add":"remove";e.$.filterButton.classList[a]("smart-disabled"),e.$.sortButton.classList[a]("smart-disabled"),e.$.groupButton.classList[a]("smart-disabled"),e.$.formatButton.classList[a]("smart-disabled"),e.$.colorsButton.classList[a]("smart-disabled"),e.$.searchButton.classList[a]("smart-disabled"),e.$.downloadButton.classList[a]("smart-disabled"),e.$.resourceButton.classList[a]("smart-disabled"),e.$.labelButton.classList[a]("smart-disabled")};o(e.dataSource&&0===e.dataSource.length),t.dataSource&&t.dataSource.virtualDataSource&&!t.dataSource.virtualDataSourceOnExpand&&"infinite"!==t.scrolling&&o(!1),0===t.columns.length?e.$.customizeButton.classList.add("smart-disabled"):e.$.customizeButton.classList.remove("smart-disabled")}}}get hasStyleObserver(){return!1}render(){const e=this;e._appliedFiltering={filters:[],operator:"and"},e._appliedSorting={dataFields:[],dataTypes:[],orderBy:[]},e._localizeHeader(),e._getInnerElementMessages(),super.render()}openFormatPanel(){const e=this,t=e.dataSource;if(!t||0===t.length||e.disabled||"none"===e.headerPosition)return;let a;if(e._refreshColumns("format"),e.grid.closeMenu(),e._editInfo&&e._editInfo.window.close(),e._closeDownloadMenu(),e._closeViewsMenu(),e._closeResourceMenu(),e._closeLabelMenu(),e._closeColorMenu(),e._closeFontSizeMenu(),e._closeFontFamilyMenu(),e.$.headerDropDown.classList.add("format-panel"),e.$.headerDropDown.classList.remove("customize-panel","colors-panel","sort-panel","search-panel","filter-panel"),e.$.format.classList.remove("smart-hidden"),e.$.customize.classList.add("smart-hidden"),e.$.sort.classList.add("smart-hidden"),e.$.colors.classList.add("smart-hidden"),e.$.filter.classList.add("smart-hidden"),e.$.ai.classList.add("smart-hidden"),e.$.group&&e.$.group.classList.add("smart-hidden"),e.$.search.classList.add("smart-hidden"),e._closeSearchPanel(),e._formatPartCreated)a=e.$.format.firstElementChild,a.columns=e.columns,a.dataSource=e.dataSource,a.locale=e.locale,a.messages=e._innerElementMessages.formattingPanel,a.rightToLeft=e.rightToLeft;else{a=document.createElement("smart-formatting-panel"),a.animation=e.animation,a.columns=e.columns,a.dataSource=e.dataSource,a.locale=e.locale,a.messages=e._innerElementMessages.formattingPanel,a.rightToLeft=e.rightToLeft,a.theme=e.theme,a.unfocusable=!1,a.ownerElement=e,a.dropDownAppendTo="body",e._formattingPanel=a,e.$.format.appendChild(a);const t=document.createElement("div");t.className="smart-format-panel smart-grid-panel-container-footer",t.setAttribute("role","presentation"),t.innerHTML=`<div id="buttonsContainer" class="smart-grid-panel-buttons-container smart-unselectable" role="presentation"><span class="smart-grid-panel-cancel-button" role="button">${e.localize("cancel")}</span><span class="smart-grid-panel-apply-button" role="button">${e.localize("apply")}</span></div>`,e._formattingPanel.$.apply=t.querySelector(".smart-grid-panel-apply-button"),e._formattingPanel.$.cancel=t.querySelector(".smart-grid-panel-cancel-button"),e.$.format.appendChild(t),e._formatPartCreated=!0,t.applyButton=t.querySelector(".smart-grid-panel-apply-button"),t.cancelButton=t.querySelector(".smart-grid-panel-cancel-button"),t.applyButton.onclick=()=>{a.$.fireEvent("apply"),e.grid._conditionalFormattingChanged=!0,e.grid._conditionalFormatting=a.apply(),e.grid.conditionalFormatting=a.getItems(),e.grid._recycle(!1),e.grid._conditionalFormattingChanged=!1},t.cancelButton.onclick=()=>{a.$.fireEvent("cancel")},e.grid.conditionalFormatting&&(a.items=e.grid.conditionalFormatting)}a.focus(),e._openHeaderDropDown(e.$.formatButton)}_openHeaderDropDown(e){const t=this;t.$.headerDropDown.parentElement!==document.body&&(document.body.appendChild(t.$.headerDropDown),t.$.headerDropDown.addEventListener("apply",(e=>{const a=t._getDropDownType();t._applyHandler(e),t.grid.$.fireEvent("batchChange",{type:a})})),t.$.headerDropDown.addEventListener("cancel",(()=>{const e=t._getDropDownType();t.closePanel(),t.grid.$.fireEvent("batchCancel",{type:e})}))),t.$.headerDropDown.addEventListener("close",(()=>{t._dropDownCloseDate=new Date})),super._openHeaderDropDown(e),t.refreshHeaderDropDownPosition(e)}refreshHeaderDropDownPosition(e){const t=this;if(!t.$.headerDropDown||t.$.headerDropDown&&!t.$.headerDropDown.classList.contains("open"))return void(t._dropDownTarget=e);e?t._dropDownTarget=e:t._dropDownTarget&&(e=t._dropDownTarget);const a=t.grid.parentElement,o=a?a.scrollTop:0;if(t.grid.header.appendTo){const e=document.querySelector(t.grid.header.appendTo);t.$.headerDropDown.style.top=t.grid.offset(e).top+e.offsetHeight-o+"px"}else t.$.headerDropDown.style.top=t.grid.offset(t.grid).top+t.grid.$.header.offsetHeight-o+"px";const s=()=>{if(e){const a=t.grid.offset(e);if(a.left+t.$.headerDropDown.offsetWidth<document.body.scrollLeft+document.body.offsetWidth?t.$.headerDropDown.style.left=a.left+"px":t.$.headerDropDown.style.left=document.body.scrollLeft+document.body.offsetWidth-t.$.headerDropDown.offsetWidth+"px",a.top+t.$.headerDropDown.offsetHeight>=document.documentElement.clientHeight-40){let e=t.grid.offset(t.grid).top-t.$.headerDropDown.offsetHeight;if(t.grid.header.appendTo){const a=document.querySelector(t.grid.header.appendTo);e=t.grid.offset(a).top-t.$.headerDropDown.offsetHeight}e<0&&(e=0),t.$.headerDropDown.style.top=e+"px"}}else t.$.headerDropDown.style.left=t.grid.offset(t.grid).left+"px"};t.grid.offsetWidth<600&&t.$.headerDropDown.offsetWidth>t.grid.offsetWidth?(t.$.headerDropDown.style.width="90%",t.$.headerDropDown.style.left=t.grid.offset(t.grid).left+"px"):(t.$.headerDropDown.style.width="",s())}openFilterPanel(e){const t=this,a=t.dataSource;t._refreshColumns("filter"),t.$.view.classList.add("smart-hidden"),t.$.ai.classList.add("smart-hidden");const o=this.columns.map((e=>{const t=Object.assign({},e),o=a.dataFields.find((e=>e.name===t.dataField));return o&&(t.dataType=o.dataType),t})).filter((e=>e.allowFilter));super.openFilterPanel(o,null),t._closeDownloadMenu(),t._closeViewsMenu(),t._closeResourceMenu(),t._closeLabelMenu(),t._closeColorMenu(),t._closeFontSizeMenu(),t._closeFontFamilyMenu();const s=t.grid;if(s.closeMenu(),e){const a=t.$.headerDropDown.querySelector("smart-multi-column-filter-panel");a.$.itemsContainer.appendChild(a._createItem(t.columns.find((t=>t.dataField===e.dataField)),"string"===e.dataType?"CONTAINS":"EQUAL",""));const o=a.querySelectorAll(".smart-grid-panel-item");setTimeout((()=>{o[o.length-1].querySelector(".editor").focus()}),350)}const n=t.$.headerDropDown.querySelector("smart-multi-column-filter-panel");n&&s.ai&&s.ai.key&&(n.$.addAIFilterButton.classList.remove("smart-hidden"),n.$.aiFilterPrompt.classList.add("smart-hidden"),n.$.spinner.classList.add("smart-hidden"),n.$.addAIFilterButton.onclick=()=>{n.$.aiFilterPrompt.placeholder=s.localize("dialogFilterHeader"),n.$.aiFilterPrompt.classList.toggle("smart-hidden"),n.$.spinner.classList.remove("smart-hidden"),n.$.aiFilterPrompt.focus(),n.$.aiFilterPrompt.parentElement.style.display="flex",n.$.aiFilterPrompt.parentElement.style.flexDirection="column",n.$.aiFilterPrompt.onchange=n.$.aiFilterPrompt.oninput=e=>{const t=()=>{let e=0;const t=setInterval((()=>{n.$.spinner.innerHTML=`\rThinking${".".repeat(e%4)} `,e++}),500);try{s.filterBy(n.$.aiFilterPrompt.value,null,(e=>{n.$.spinner.innerHTML="",n.$.spinner.classList.add("smart-hidden"),clearInterval(t);const a=[];for(let t in e){const o=e[t].filterGroup;for(let e=0;e<o.filters.length;e++){const s=o.filters[e];a.push([t,s.condition,s.value])}}n.value=a}))}catch(e){n.$.spinner.innerHTML=s.localize("noResults"),clearInterval(t)}};"Enter"===e.key?(n.aiTimer&&clearTimeout(n.aiTimer),t()):(n.aiTimer&&clearTimeout(n.aiTimer),n.aiTimer=setTimeout((()=>{t()}),800))}})}openColorsPanel(){const e=this,t=e.dataSource;e._refreshColumns("colors"),e.$.view.classList.add("smart-hidden"),e.$.ai.classList.add("smart-hidden");const a=this.columns.map((e=>{const a=Object.assign({},e),o=t.dataFields.find((e=>e.name===a.dataField));return o&&(a.dataType=o.dataType),a}));super.openColorsPanel(a,null,e.grid),e._closeDownloadMenu(),e._closeViewsMenu(),e._closeResourceMenu(),e._closeLabelMenu(),e._closeColorMenu(),e._closeFontSizeMenu(),e._closeFontFamilyMenu(),e.grid.closeMenu()}openViewPanel(){const e=this;if(e.disabled||"none"===e.headerPosition)return;if(!1===e.grid.appearance.showViewBarAsDropdown)return;let t;e.$.headerDropDown.classList.add("view-panel"),e.$.headerDropDown.classList.remove("customize-panel","filter-panel","sort-panel","search-panel","group-panel","format-panel","colors-panel"),e.$.view.classList.remove("smart-hidden"),e.$.colors.classList.add("smart-hidden"),e.$.filter.classList.add("smart-hidden"),e.$.sort.classList.add("smart-hidden"),e.$.search.classList.add("smart-hidden"),e.$.group.classList.add("smart-hidden"),e.$.format.classList.add("smart-hidden"),e.$.customize.classList.add("smart-hidden"),e.$.ai.classList.add("smart-hidden"),e.$.format&&e.$.format.classList.add("smart-hidden"),e.$.group&&e.$.group.classList.add("smart-hidden"),e.$.search.classList.add("smart-hidden"),e._closeSearchPanel(),e._viewPartCreated?t=e.$.view.firstElementChild:(t=document.createElement("div"),t.classList.add("smart-view-panel","smart-grid-view-bar"),e.$.view.appendChild(t),e.$.viewPanel=t,e._viewPartCreated=!0,e._updateViews()),e._openHeaderDropDown(e.$.viewStatesButton)}openSortPanel(e){const t=this,a=t.dataSource;t._refreshColumns("sort"),t.$.view.classList.add("smart-hidden"),t.$.ai.classList.add("smart-hidden");const o=t.columns.map((e=>{const o=Object.assign({},e),s=t._appliedSorting.dataFields.indexOf(o.dataField),n=a.dataFields.find((e=>e.name===o.dataField));return n&&(o.dataType=n.dataType,o.sortIndex=s,-1!==s&&(o.sortDirection=t._appliedSorting.orderBy[s])),o})).filter((e=>e.allowSort));if(e&&t._appliedSorting&&-1===t._appliedSorting.dataFields.indexOf(e.dataField)){const a=o.find((t=>t.dataField===e.dataField));a.sortDirection="ascending",a.sortIndex=t._appliedSorting.dataFields.length}super.openSortPanel(o),t._closeDownloadMenu(),t._closeViewsMenu(),t._closeResourceMenu(),t._closeLabelMenu(),t._closeColorMenu(),t._closeFontSizeMenu(),t._closeFontFamilyMenu();const s=t.grid;s.closeMenu();const n=t.$.headerDropDown.querySelector("smart-sort-panel");if(!n)return;n.grid=s,n.$.maintainSortContainer.classList.remove("smart-hidden"),s.sorting.maintainSort?n.$.maintainSortContainer.firstElementChild.setAttribute("active",""):n.$.maintainSortContainer.firstElementChild.removeAttribute("active"),n._changeApplyButtonText();const i=n.$.inputNotSorted,r=()=>{const e=n.querySelectorAll(".smart-grid-panel-item");"many"===t.grid.sorting.mode||e.length<1?i.classList.remove("smart-visibility-hidden"):e.length>=1&&i.classList.add("smart-visibility-hidden")};n.onDataSourceChange=()=>{r()},r()}openCustomizePanel(){const e=this;if(e.disabled||"none"===e.headerPosition)return;e._closeDownloadMenu(),e._closeViewsMenu(),e._closeResourceMenu(),e._closeLabelMenu(),e._closeColorMenu(),e._closeFontSizeMenu(),e._closeFontFamilyMenu(),e._refreshColumns("customize");let t=e.columns;const a=e.grid;a.closeMenu(),a.appearance.showColumnGroupsInColumnPanel&&(t=[],a.columns.forEach((e=>{if(!e.columnGroup){const a={label:e.label,dataField:e.dataField,level:0,parentDataField:null,dataType:e.dataType||"string",columnGroup:e.columnGroup||null,allowHide:void 0===e.allowHide||e.allowHide,allowSort:void 0===e.allowSort||e.allowSort,allowFilter:void 0===e.allowFilter||e.allowFilter,allowGroup:void 0===e.allowGroup||e.allowGroup,visible:void 0===e.visible||e.visible};t.push(a)}})),a._columnGroups.forEach((e=>{const a={dataField:e.name,label:e.label,level:0,disableDrag:!0,disableToggle:!1,allowHide:!0};if(t.push(a),e.columns){let o=e.columns.length,s=0,n=[],i=[];e.columns.forEach((a=>{const r={label:a.label,dataField:a.dataField,level:1,parentDataField:e.name,dataType:a.dataType||"string",columnGroup:a.columnGroup||null,allowHide:void 0===a.allowHide||a.allowHide,allowSort:void 0===a.allowSort||a.allowSort,allowFilter:void 0===a.allowFilter||a.allowFilter,allowGroup:void 0===a.allowGroup||a.allowGroup,visible:void 0===a.visible||a.visible};!1===r.allowHide&&(o--,i.push(r.dataField)),r.visible||(s++,n.push(r.dataField)),t.push(r)})),o<=0&&(a.allowHide=!1,a.disableToggle=!0),e.columns.length===s||o===s&&i.toString()!==n.toString()?a.visible=!1:a.visible=!0}})));const o=e.$.customize,s=t.map((t=>{const a={};return a.visible=t.visible,a.label=t.label,a.dataField=t.dataField,-1!==[e.coverField,e.titleField].indexOf(a.dataField)?a.disableToggle=!0:a.disableToggle=!1,void 0!==t.level&&(a.level=t.level),t.disableDrag&&(a.disableDrag=!0),t.parentDataField&&(a.parentDataField=t.parentDataField),t.allowHide||(a.disableToggle=!0),a}));let n;if(e._closeDialog(),e.$.headerDropDown.classList.add("customize-panel"),e.$.headerDropDown.classList.remove("view-panel","colors-panel","filter-panel","sort-panel","search-panel","group-panel","format-panel"),o.classList.remove("smart-hidden"),e.$.filter.classList.add("smart-hidden"),e.$.sort.classList.add("smart-hidden"),e.$.search.classList.add("smart-hidden"),e.$.group.classList.add("smart-hidden"),e.$.format.classList.add("smart-hidden"),e.$.view.classList.add("smart-hidden"),e.$.colors.classList.add("smart-hidden"),e.$.ai.classList.add("smart-hidden"),e._closeSearchPanel(),e._customizePartCreated)n=o.querySelector("smart-column-panel"),n.locale=e.locale,n.messages=e._innerElementMessages.columnPanel,n.set("dataSource",s),n.propertyChangedHandler("dataSource",void 0,s),n.rightToLeft=e.rightToLeft;else{const t=document.createDocumentFragment(),a=document.createElement("smart-column-panel");a.rightToLeft=e.rightToLeft,a.animation=e.animation,a.dataSource=s,a.locale=e.locale,a.messages=e._innerElementMessages.columnPanel,a.theme=e.theme,t.appendChild(a),e.$.customize.appendChild(t),e._customizePartCreated=!0}e._changedVisibility=new Map,e._openHeaderDropDown(e.$.customizeButton)}_applyFilter(e,t){const a=this;a.grid.beginUpdate(),a.grid.context=a.grid,a.grid.clearFilter();for(let t=0;t<e.length;t++){const o=e[t],s=o[0],n=o[1];a.grid.columnByDataField[s].filter=n}a.grid._filterOperator=t,a.grid.endUpdate(),a.grid.refreshFilters(),a.grid.context=document,a.grid.autoSaveState()}_applySort(){const e=this,t=e._appliedSorting;e.grid.beginUpdate(),e.grid.sorting.maintainSort=t.maintainSort,e.grid.context=e.grid,e.grid.clearSort();for(let a=0;a<t.dataFields.length;a++)e.grid.sortBy(t.dataFields[a],t.orderBy[a]);e.grid.endUpdate(),e.grid.context=document,e.grid.autoSaveState()}_getDropDownType(){const e=this;let t=null;return e.$.headerDropDown.classList.contains("filter-panel")?t="filter":e.$.headerDropDown.classList.contains("sort-panel")?t="sort":e.$.headerDropDown.classList.contains("search-panel")?t="search":e.$.headerDropDown.classList.contains("group-panel")?t="group":e.$.headerDropDown.classList.contains("format-panel")?t="format":e.$.headerDropDown.classList.contains("customize-panel")?t="customize":e.$.headerDropDown.classList.contains("view-panel")?t="view":e.$.headerDropDown.classList.contains("colors-panel")&&(t="colors"),t}_applyHandler(e){const t=this,a=e.target,o=e.detail,s=t.$.customize;if(t.grid&&"kanban"===t.grid.view&&t.grid._kanban&&s.contains(a))return t.grid._kanban._applyHandler(e,"customize"),void t.closePanel();t.$.ai.contains(a)&&t._applyAI(),s.contains(a)?t._applyColumns(o.value,o.moves):t.$.filter.contains(a)?t.addFilter(o.filters,o.operator,o.value):t.$.sort.contains(a)?t.addSort(o.sortByInfo):t.$.colors.contains(a)&&t.addColors(o.value,o.decorator,o.filters),t.closePanel()}_documentUpHandler(e){const t=this;let a=e.originalEvent.target,o=t.grid?t.grid.$.header:null;if(t.grid&&t.grid.header.appendTo&&(o=document.querySelector(t.grid.header.appendTo)),!o)return;t.shadowRoot&&a===t&&(a=e.originalEvent.composedPath()[0]);const s=e.originalEvent.composedPath();for(let e=0;e<s.length;e++){const t=s[e];if(t&&t.classList&&t.classList.contains("smart-menu-item")){const e=t.closest("smart-menu");if(e&&e.classList.contains("smart-grid-views-menu"))return;if(e&&e.classList.contains("smart-grid-download-menu"))return}}if(t._closeDownloadMenu(),t._closeViewsMenu(),t._closeResourceMenu(),t._closeLabelMenu(),a!==t.$.colorButton&&a!==t.$.backgroundButton&&t._closeColorMenu(),a!==t.$.fontSizeButton&&t._closeFontSizeMenu(),a!==t.$.fontFamilyButton&&t._closeFontFamilyMenu(),!("none"===t.headerPosition||t.$.headerDropDown.classList.contains("smart-visibility-hidden")||a!==o&&o.contains(a))){const s=a.closest("smart-scroll-viewer"),n=a.closest(".smart-drop-down");if((!s||!o.contains(s.ownerElement))&&(!n||n.ownerElement&&!o.contains(n.ownerElement))){const a=e.originalEvent.composedPath();for(let e=0;e<a.length;e++){const t=a[e];if(t&&t.classList&&t.classList.contains("smart-data-view-header-drop-down"))return;if(t&&t.classList&&t.classList.contains("smart-formatting-panel-popup"))return}if(s&&s.ownerElement){const e=s.ownerElement.parents;for(let t=0;t<e.length;t++){const a=e[t];if(a&&a.classList&&a.classList.contains("smart-data-view-header-drop-down"))return}}if(n&&n.ownerElement){const e=n.ownerElement.parents;for(let t=0;t<e.length;t++){const a=e[t];if(a&&a.classList&&a.classList.contains("smart-data-view-header-drop-down"))return}}if(t.$.headerDropDown.querySelector("[open]"))return;if(t._dropDownCloseDate&&new Date-t._dropDownCloseDate<500)return;t.closePanel()}}}_refreshColumns(e){const t=this,a=t.grid;let o,s=new Map;if("kanban"===a.view&&a._kanban)switch(e){case"customize":return o=a._kanban._getCustomizeColumnPanelDataSource(),o=JSON.parse(JSON.stringify(o)),t._refreshCustomizeButton(),void(t.columns=o)}o=Array.isArray(a.columns)?[...a.columns]:[...a.columns.toArray()],o=o.filter((t=>!(!t||!1===t._visible||("filter"===e||"sort"===e)&&("sort"===e&&!t.sortOrder||"filter"===e&&!t.filter)&&!1===t.visible))),o=o.map((e=>{let t=e.allowHide;return a.grouping&&a.grouping.autoHideGroupColumn&&a.dataSource.groupBy.indexOf(e.dataField)>=0&&(t=!1),{label:e.label,dataField:e.dataField,dataType:e.dataType||"string",columnGroup:e.columnGroup||null,allowHide:void 0===e.allowHide||t,allowSort:void 0===e.allowSort||e.allowSort,allowFilter:void 0===e.allowFilter||e.allowFilter,allowGroup:void 0===e.allowGroup||e.allowGroup,visible:void 0===e.visible||e.visible,sortIndex:void 0!==e.sortIndex&&null!==e.sortIndex?e.sortIndex:-1,sortDirection:void 0!==e.sortOrder?e.sortOrder:null,options:e.editor&&e.editor.dataSource?e.editor.dataSource:null}})),o=JSON.parse(JSON.stringify(o)),o.forEach((e=>{let t=e.columnGroup?e.columnGroup+"."+e.label:e.label,a=1;for(;s.get(t);)t=e.columnGroup?e.columnGroup+"."+e.label+` (${a})`:e.label+` (${a})`,a++;s.set(t,e),e.label=t})),t.columns=o,t._refreshCustomizeButton()}_init(e){const t=this;if(t.grid=e,e.dataSource&&e.dataSource.boundSource){t._refreshColumns("init");const a=Array.isArray(e.dataSource.boundSource)?e.dataSource.boundSource:e.dataSource.boundSource.toArray();t.dataSource=new Smart.DataAdapter({observable:!1,dataSource:[...a],dataFields:e.dataSource.dataFields})}t.rightToLeft=t.grid.rightToLeft,t.refreshTools(),t.$.headerDropDown.onclick=e=>{t.grid._headerClickHandler(e),e.stopPropagation(),e.preventDefault()},t.grid.removeEventListener("change",t._refreshFromSelection),t.grid.addEventListener("change",t._refreshFromSelection),t.grid.appearance.showViewBarAsDropdown||t._updateViews(),e.header.onInit&&e.header.onInit(t)}_removeFontFamilyMenu(){const e=this;if(e.fontFamilyMenu){const t=e.fontFamilyMenu.querySelector("smart-menu");t&&e.fontFamilyMenu.removeChild(t)}}_removeFontSizeMenu(){const e=this;if(e.fontSizeMenu){const t=e.fontSizeMenu.querySelector("smart-menu");t&&e.fontSizeMenu.removeChild(t)}}_removeMenu(){const e=this;if(e.downloadMenu){const t=e.downloadMenu.querySelector("smart-menu");t&&e.downloadMenu.removeChild(t)}}_removeLabelMenu(){const e=this;if(e.labelMenu){const t=e.labelMenu.querySelector("smart-menu");t&&e.labelMenu.removeChild(t);const a=e.labelMenu.querySelector(".label");a&&e.labelMenu.removeChild(a)}}_removeResourceMenu(){const e=this;if(e.resourceMenu){const t=e.resourceMenu.querySelector("smart-menu");t&&e.resourceMenu.removeChild(t);const a=e.resourceMenu.querySelector(".label");a&&e.resourceMenu.removeChild(a)}}_removeViewsMenu(){const e=this;if(e.viewsMenu){const t=e.viewsMenu.querySelector("smart-menu");t&&e.viewsMenu.removeChild(t);const a=e.viewsMenu.querySelector(".label");a&&e.viewsMenu.removeChild(a)}}_createViewsMenuItems(){const e=this,t=e.grid;e._removeViewsMenu();const a=document.createElement("smart-menu"),o=document.createDocumentFragment();a.classList.add("smart-grid-views-menu"),a.checkable=!0,a.checkboxes=!0,a.style.width="100%",a.mode="vertical",a.dropDownAppendTo="body",a.rightToLeft=t.rightToLeft,a.style.minWidth="150px";const s=(e,a,o)=>{const s=document.createElement("smart-menu-item");let n="smart-icon-grid-alt";switch(a){case"grid":n="smart-icon-grid-alt","grid"===t.view&&o&&(s.setAttribute("focus",""),s.checked=!0),s.title=t.localize("gridView");break;case"kanban":n="smart-icon-kanban-alt","kanban"===t.view&&o&&(s.setAttribute("focus",""),s.checked=!0),s.title=t.localize("kanbanView");break;case"card":n="smart-icon-card-alt","card"===t.view&&o&&(s.setAttribute("focus",""),s.checked=!0),s.title=t.localize("cardView");break;case"scheduler":n="smart-icon-scheduler","scheduler"===t.view&&o&&(s.setAttribute("focus",""),s.checked=!0),s.title=t.localize("schedulerView");break;case"timeline":n="smart-icon-timeline","timeline"===t.view&&o&&(s.setAttribute("focus",""),s.checked=!0),s.title=t.localize("timelineView")}return s.label='<span class="smart-grid-icon '+n+'"></span>'+e,s.value=a,s};o.appendChild(s(t.localize("viewGrid"),"grid",!0)),o.appendChild(s(t.localize("viewKanban"),"kanban",!0)),o.appendChild(s(t.localize("viewCard"),"card",!0)),o.appendChild(s(t.localize("viewScheduler"),"scheduler",!0)),a.appendChild(o),e.viewsMenu.insertBefore(a,e.viewsMenu.children[e.viewsMenu.children.length-1]),e.viewsMenu.onpointerup=()=>!1,a.onItemClick=a=>{e._setView(a.detail.value),e._closeViewsMenu(),t.autoSaveState(),e._updateViews()}}_createResourceMenuItems(){const e=this,t=e.grid;e._removeResourceMenu();const a=document.createElement("smart-menu"),o=document.createDocumentFragment();a.classList.add("smart-grid-views-menu"),a.checkable=!0,a.checkboxes=!0,a.style.width="100%",a.mode="vertical",a.dropDownAppendTo="body",a.rightToLeft=t.rightToLeft,a.style.minWidth="150px";const s=(e,a,o,s)=>{const n=document.createElement("smart-menu-item");return n.label='<span class="smart-grid-icon '+a+'"></span>'+e,t._dateStackedBySelect===s&&(n.setAttribute("focus",""),n.checked=!0),n.value=s,n};let n=!1;for(let e=0;e<t.columns.length;e++){const a=t.columns[e];a.editor&&a.editor.dataSource&&a.editor.singleSelect&&a.editor.dataSource.length&&("collaborator"===a.template||"tags"===a.template)&&(o.appendChild(s(a.label,a.icon,0,a.dataField)),n=!0)}if(a.appendChild(o),n&&e.resourceMenu.insertBefore(a,e.resourceMenu.children[e.resourceMenu.children.length-1]),e.resourceMenu.onpointerup=()=>!1,!n){const a=document.createElement("div");a.classList.add("label","smart-flex","middle","center","smart-quiet"),a.style.minHeight="60px",a.style.height="100%",a.innerHTML=t.localize("noGrouping"),e.resourceMenu.appendChild(a)}a.onItemClick=a=>{t._dateStackedBySelect===a.detail.item.value?delete t._dateStackedBySelect:t._dateStackedBySelect=a.detail.item.value,t._onSort&&t._onSort(),e._closeResourceMenu(),t.autoSaveState()}}_updateViews(){const e=this,t=e.grid;if(t.appearance.showViewBarAsDropdown||e.$.viewStatesButton.removeAttribute("aria-expanded"),t.stateSettings.enabled&&t.appearance.showViewBar){const a=e=>{(!t.users.length||!1!==t.currentUser&&null!==t.currentUser&&void 0!==t.currentUser)&&(delete t.stateSettings.storage[e.valueName],t.stateSettings.current===e.valueName&&(t.stateSettings.current=""),t.stateSettings.onStateChange&&t.stateSettings.onStateChange(t.stateSettings.storage[t.stateSettings.current],e.valueName,t.stateSettings.storage,t.stringify_object),e.remove())},o=a=>{const o=document.createElement("input");if(o.value=a.valueName,t.users.length&&(!1===t.currentUser||null===t.currentUser||void 0===t.currentUser))return;const s=()=>{if(o.value){if(t.stateSettings.storage[o.value])return;const s=t.stateSettings.storage[a.valueName];t.stateSettings.current===a.valueName&&(t.stateSettings.current=o.value),delete t.stateSettings.storage[s.name],s.name=o.value,t.stateSettings.storage[s.name]=s,t.stateSettings.onStateChange&&t.stateSettings.onStateChange(t.stateSettings.storage[t.stateSettings.current],s.name,t.stateSettings.storage,t.stringify_object),delete t.stateSettings.storage[a.valueName],o.remove();const n=o.value;a.valueName=n;let i="smart-icon-grid-alt";switch(s.view){case"grid":i="smart-icon-grid-alt";break;case"kanban":i="smart-icon-kanban-alt";break;case"card":i="smart-icon-card-alt";break;case"scheduler":i="smart-icon-scheduler";break;case"timeline":i="smart-icon-timeline"}n===t.stateSettings.current?(a.selected=!0,a.label='<span class="show smart-grid-icon '+i+'"></span><span style="overflow: hidden; text-overflow: ellipsis;">'+n+'</span><span class="show smart-grid-icon smart-icon-mode-edit"></span><span class="smart-grid-icon smart-icon-delete"></span>'):a.label='<span class="show smart-grid-icon '+i+'"></span><span style="overflow: hidden; text-overflow: ellipsis;">'+n+'</span><span class="show smart-grid-icon smart-icon-mode-edit"></span><span class="show smart-grid-icon smart-icon-delete"></span>',e._refreshViewsButton()}};o.onselectstart=e=>{e.stopPropagation()},o.onpointerdown=o.onpointerup=e=>{e.stopPropagation()},o.onkeydown=e=>{e.stopPropagation()},o.onkeyup=e=>{"Escape"===e.key&&(o.onchange=o.onblur=null,o.remove()),"Enter"===e.key&&(o.onchange=o.onblur=null,s()),e.stopPropagation()},o.onchange=()=>{o.onblur=null,o.onkeyup=null,s()},o.onblur=()=>{o.remove()},o.style.width="100%",o.style.height="100%",o.style.position="absolute",o.style.left="0px",o.style.top="0px",o.style.zIndex=99,o.classList.add("smart-input"),o.classList.add("underlined"),o.style.backgroundColor="var(--smart-background)",o.style.color="var(--smart-background-color)",a.querySelector(".smart-list-item-label-element").appendChild(o),setTimeout((()=>{o.focus()}),50)},s=(e,a,o)=>{const s=document.createElement("smart-list-item");let n="smart-icon-grid-alt";switch(a){case"grid":n="smart-icon-grid-alt";break;case"kanban":n="smart-icon-kanban-alt";break;case"card":n="smart-icon-card-alt";break;case"scheduler":n="smart-icon-scheduler";break;case"timeline":n="smart-icon-timeline"}return s.value=o,s.valueName=e,e===t.stateSettings.current?(s.selected=!0,s.label='<span class="show smart-grid-icon '+n+'"></span><span style="overflow: hidden; text-overflow: ellipsis;">'+e+'</span><span class="show smart-grid-icon smart-icon-mode-edit"></span><span class="smart-grid-icon smart-icon-delete"></span>'):s.label='<span class="show smart-grid-icon '+n+'"></span><span style="overflow: hidden; text-overflow: ellipsis;">'+e+'</span><span class="show smart-grid-icon smart-icon-mode-edit"></span><span class="show smart-grid-icon smart-icon-delete"></span>',t.users.length&&(!1!==t.currentUser&&null!==t.currentUser&&void 0!==t.currentUser||(e===t.stateSettings.current?(s.selected=!0,s.label='<span class="show smart-grid-icon '+n+'"></span><span style="overflow: hidden; text-overflow: ellipsis;">'+e+'</span><span class="smart-visibility-hidden smart-grid-icon smart-icon-mode-edit"></span><span class="smart-visibility-hidden smart-grid-icon smart-icon-delete"></span>'):s.label='<span class="show smart-grid-icon '+n+'"></span><span style="overflow: hidden; text-overflow: ellipsis;">'+e+'</span><span class="smart-visibility-hidden smart-grid-icon smart-icon-mode-edit"></span><span class="smart-visibility-hidden smart-grid-icon smart-icon-delete"></span>')),s};t.appearance.showViewBarAsDropdown||e.$.viewStatesButton.setAttribute("aria-expanded",!0);let n=t.$.viewBar;if(t.appearance.showViewBarAsDropdown&&(n=e.$.viewPanel),t.appearance.viewBarAppendTo&&(n=document.querySelector(t.appearance.viewBarAppendTo),n&&n.classList.add("smart-grid-view-bar")),n&&!n.querySelector(".smart-grid-view-chooser-container")){const a=document.createElement("div");a.classList.add("smart-grid-view-chooser-container","smart-container");const o=document.createElement("div");o.classList.add("new-view"),!1===t.editing.enabled&&o.classList.add("smart-hidden");const s=(a,o)=>{a.stopPropagation(),a.preventDefault(),t.beginUpdate();let s=0,i=[];if(t.stateSettings.storage){for(;t.stateSettings.storage[t.localize("view")+" "+s];)s++;for(let e in t.stateSettings.storage){const a=t.stateSettings.storage[e];i[a.view]=1+i[a.view]||1}}let r="";switch(o){case"grid":r=t.localize("viewGrid");break;case"kanban":r=t.localize("viewKanban");break;case"card":r=t.localize("viewCard");break;case"scheduler":r=t.localize("viewScheduler");break;case"timeline":r=t.localize("viewTimeline")}if(i[o]||(i[o]=""),t.stateSettings.storage){let e=i[o]?t.localize("view")+" "+i[o]:t.localize("view");for(;t.stateSettings.storage[r+" "+e];)e=t.localize("view")+" "+i[o],i[o]++}const l=i[o]?t.localize("view")+" "+i[o]:t.localize("view");if(!n){let a=t.$.viewBar;t.appearance.showViewBarAsDropdown&&(a=e.$.viewPanel),t.appearance.viewBarAppendTo&&(a=document.querySelector(t.appearance.viewBarAppendTo),a&&a.classList.add("smart-grid-view-bar")),a&&(n=a)}if(!n)return void t.endUpdate();n._input.value=r+" "+l,t.stateSettings.current||(t.stateSettings.current=n._input.value),t.saveState(),t.stateSettings.current=n._input.value,e._closeViewsMenu(),t.resetState(!1);const d=t.view;t.set("view","grid",!1),t._kanban&&t._kanban._reset(),delete t.columnByDataField.taskStatus,"grid"===o&&"grid"!==d?e._setView("grid",!0):"kanban"===o?e._setView("kanban"):"card"===o?e._setView("card"):"scheduler"===o?e._setView("scheduler"):"timeline"===o&&e._setView("timeline"),t.saveState(),t.endUpdate(),e._updateViews(),t.$.fireEvent("viewChanged",{view:t.view})},i=document.createElement("smart-button");i.classList.add("selected"),i.classList.add("view"),i.innerHTML='<span style="display: flex; align-items: center;"><span class="show smart-grid-icon smart-icon-grid-alt"></span>'+t.localize("newGrid")+'</span><span style="font-size: 12px; color: rgba(var(--smart-secondary-rgb), 0.6);" class="show smart-grid-icon smart-icon-plus"></span>',i.title=t.localize("gridView");const r=document.createElement("smart-button");r.innerHTML='<span style="display: flex; align-items: center;"><span class="show smart-grid-icon smart-icon-kanban-alt"></span>'+t.localize("newKanban")+'</span><span style="font-size: 12px; color: rgba(var(--smart-secondary-rgb), 0.6);" class="show smart-grid-icon smart-icon-plus"></span>',r.classList.add("view"),r.title=t.localize("kanbanView");const l=document.createElement("smart-button");l.classList.add("selected"),l.classList.add("view"),l.innerHTML='<span style="display: flex; align-items: center;"><span class="show smart-grid-icon smart-icon-card-alt"></span>'+t.localize("newCard")+'</span><span style="font-size: 12px; color: rgba(var(--smart-secondary-rgb), 0.6);" class="show smart-grid-icon smart-icon-plus"></span>',l.title=t.localize("cardView");const d=document.createElement("smart-button");d.classList.add("selected"),d.classList.add("view"),d.innerHTML='<span style="display: flex; align-items: center;"><span class="show smart-grid-icon smart-icon-scheduler"></span>'+t.localize("newScheduler")+'</span><span style="font-size: 12px; color: rgba(var(--smart-secondary-rgb), 0.6);" class="show smart-grid-icon smart-icon-plus"></span>',d.title=t.localize("schedulerView");const c=document.createElement("smart-button");c.classList.add("selected"),c.classList.add("view"),c.innerHTML='<span style="display: flex; align-items: center;"><span class="show smart-grid-icon smart-icon-timeline"></span>'+t.localize("newTimeline")+'</span><span style="font-size: 12px; color: rgba(var(--smart-secondary-rgb), 0.6);" class="show smart-grid-icon smart-icon-plus"></span>',c.title=t.localize("timelineView");const u=document.createElement("div");u.classList.add("smart-grid-view-storage"),a.appendChild(u);const m=document.createElement("smart-input");m.classList.add("underlined"),m.placeholder=t.localize("viewNamePlaceholder"),m.hint=t.localize("viewNamePlaceholder"),m.onselectstart=e=>{e.stopPropagation()};const p=document.createElement("div");p.innerHTML="<span>"+t.localize("settings")+'</span><span class="smart-grid-icon show smart-icon-sort-down"></span>',p.classList.add("view-label"),o.appendChild(p);const h=document.createElement("div");o.appendChild(h),h.classList.add("footer"),t.users&&t.users.length&&(!1!==t.currentUser&&null!==t.currentUser&&void 0!==t.currentUser||(h.classList.add("smart-hidden"),p.classList.add("smart-hidden"))),h.appendChild(i),h.appendChild(r),h.appendChild(l),h.appendChild(d),p.onclick=()=>{p.classList.toggle("collapsed"),h.classList.toggle("collapsed")};const g=document.createElement("div");g.innerHTML='<span class="smart-grid-icon show smart-icon-plus"></span><span><a href="javascript:void();">'+t.localize("createView")+"</a></span>",g.classList.add("view-button"),g.onclick=e=>{let t="grid";r.classList.contains("selected")&&(t="kanban"),l.classList.contains("selected")&&(t="card"),d.classList.contains("selected")&&(t="scheduler"),c.classList.contains("selected")&&(t="timeline"),s(e,t,o)},r.onpointerdown=()=>{r.classList.add("selected"),i.classList.remove("selected"),l.classList.remove("selected"),d.classList.remove("selected"),c.classList.remove("selected"),g.click()},i.onpointerdown=()=>{i.classList.add("selected"),r.classList.remove("selected"),l.classList.remove("selected"),d.classList.remove("selected"),c.classList.remove("selected"),g.click()},l.onpointerdown=()=>{i.classList.remove("selected"),r.classList.remove("selected"),l.classList.add("selected"),d.classList.remove("selected"),c.classList.remove("selected"),g.click()},d.onpointerdown=()=>{i.classList.remove("selected"),r.classList.remove("selected"),l.classList.remove("selected"),d.classList.add("selected"),c.classList.remove("selected"),g.click()},c.onpointerdown=()=>{i.classList.remove("selected"),r.classList.remove("selected"),l.classList.remove("selected"),d.classList.remove("selected"),c.classList.add("selected"),g.click()};const v=()=>{t.stateSettings.storage&&!t.stateSettings.storage[m.value]||m.value&&!t.stateSettings.storage?g.classList.remove("disabled"):g.classList.add("disabled")};m.update=()=>v(),m.onkeyup=m.onchange=()=>{v()},v(),a.appendChild(o),n._storage=u,n._input=m,n.appendChild(a)}let i=t.stateSettings.storage;(i&&0===Object.keys(i).length||!i)&&(n._input.value||("kanban"===t.view?n._input.value=t.localize("newKanban")+" "+t.localize("view"):"card"===t.view?n._input.value=t.localize("newCard")+" "+t.localize("view"):"scheduler"===t.view?n._input.value=t.localize("newScheduler")+" "+t.localize("view"):n._input.value=t.localize("newGrid")+" "+t.localize("view")),t.stateSettings.current||(t.stateSettings.current=n._input.value),t.saveState(),t.stateSettings.current=n._input.value,i=t.stateSettings.storage);const r=n?n._storage:document.createElement("div");if(r.innerHTML="",i){let e=1;const l=document.createDocumentFragment();let d=[],c=[];for(let e in i){const t=i[e];c[t.name]||(c[t.name]=t,d.push({name:e,value:t}))}d.sort(((e,t)=>{const a=new Date(e.value.date),o=new Date(t.value.date);if(e.value&&e.value.date&&t.value&&t.value.date){if(!e.value.date||!t.value.date)return-1;if(a<o)return-1;if(a>o)return 1;if(a===o)return 0}else{if(e.name<t.name)return-1;if(e.name>t.name)return 1;if(e.name===t.name)return 0}}));let u=[],m=-1;for(let t in d){const a=d[t],o=a.name,n=a.value;e++,u[n.view]=u[n.view]++||1;const i=s(o,n.view,n);i.selected&&(m=parseInt(t),delete i.selected),l.appendChild(i)}if(e){const e=document.createElement("smart-list-box");e.style.width="100%",e.style.height="100%",e.allowDrag=!0,e.allowDrop=!0,e.itemHeight=32,e.mode="vertical",e.style.borderColor="transparent",e.classList.add("smart-grid-views-menu"),e.checkable=!0,e.checkboxes=!0,e.filterable=!0,e.filterInputPlaceholder=t.localize("commandBarSearch")+" "+t.localize("view"),e.selectionMode="one",e.disableAutoCheck=!0,e.rightToLeft=t.rightToLeft,e.ondragend=e=>{const t=e.detail.item;if(i[t.valueName]){const t=e.detail.target;if(t){const e=i[t.valueName],a=e?e.date:null;if(a){let t=new Smart.Utilities.DateTime(a);const o="top"===Smart.ListBox.DragDrop.DropDetails.position?-10:10;t=t.addSeconds(o),e.date=t.toDate().toJSON()}}}},e.onkeydown=t=>{const a=e.querySelector("smart-list-item[checked]");a&&"F2"===t.key&&o(a)},e.onDoubleClick=e=>{const t=e.target.closest("smart-list-item");o(t)},e.onClick=e=>{if(e.target&&e.target.classList.contains("smart-icon-delete")){const t=e.target.closest("smart-list-item");a(t),e.preventDefault(),e.stopPropagation()}else if(e.target&&e.target.classList.contains("smart-icon-mode-edit")){const t=e.target.closest("smart-list-item");o(t),e.preventDefault(),e.stopPropagation()}else if("INPUT"===e.target.nodeName)return},e.appendChild(l),r.appendChild(e),e.clearSelection(),e.selectedIndexes=[m],e.onchange=a=>{if(a.detail&&a.detail.selected){const o=a.detail.addedItems[0];t.loadState(o.valueName),e.querySelectorAll("smart-list-item").forEach((e=>{e.querySelector(".smart-icon-delete").classList.add("show")})),o.querySelector(".smart-icon-delete").classList.remove("show"),t.stateSettings.onStateChange&&t.stateSettings.onStateChange(t.stateSettings.storage[t.stateSettings.current],o.valueName,t.stateSettings.storage,t.stringify_object)}}}if(t.stateSettings.storage)for(;t.stateSettings.storage[t.localize("view")+" "+e];)e++;let p="";switch(t.view){case"grid":p=t.localize("viewGrid");break;case"kanban":p=t.localize("viewKanban");break;case"card":p=t.localize("viewCard");break;case"scheduler":p=t.localize("viewScheduler");break;case"timeline":p=t.localize("viewTimeline")}if(t.stateSettings.storage)for(;t.stateSettings.storage[p+" "+t.localize("view")+" "+u[t.view]];)u[t.view]++;n&&n._input&&(n._input.value=p+" "+t.localize("view")+" "+u[t.view],n._input.update())}}}_setView(e,t){const a=this,o=a.grid;if(o.view===e&&!0!==t)return;o.view;const s=o.context;if("kanban"===e)if(o.context=o,o.view="kanban",o.context=s,o._kanbanInitialized&&o.columnByDataField.taskStatus)if(o.columnByDataField.taskStatus&&o._stackedBy&&o.columnByDataField.taskStatus.dataField!==o._stackedBy){o.beginUpdate(),delete o.columnByDataField.taskStatus;const e=o.columnByDataField[o._stackedBy];o.columnByDataField.taskStatus=e,o._createKanban(e),o._refreshHeaderBar(),o.endUpdate(!1),o._hideSchedulerView(),o._showKanbanView(),a._refresh()}else o._hideSchedulerView(),o._showKanbanView(),a._refresh();else delete o._kanbanInitialized,o._initKanbanView("dynamic","grid");else"grid"===e?(o.context=o,o.view="grid",o.context=s,o._hideKanbanView(),o._hideSchedulerView(),a._refresh(),o.layout.isDirty=!0,o._resetCachedLayout(),o._refreshLayout(),o.refresh()):"card"===e?(o.context=o,o.view="card",o.context=s,o._hideKanbanView(),o._hideSchedulerView(),a._refresh(),o.layout.isDirty=!0,o._resetCachedLayout(),o._refreshLayout(),o.refresh()):"scheduler"!==e&&"timeline"!==e||(o.context=o,o.view=e,o.context=s,t?(o._hideKanbanView(),o._showSchedulerView(),a._refresh()):(o._createScheduler(),a._refresh(),o.layout.isDirty=!0,o._resetCachedLayout(),o._refreshLayout(),o.refresh()));o.$.fireEvent("viewChanged",{view:e}),a._refresh()}_createMenuItems(){const e=this,t=e.grid;e._removeMenu();const a=document.createElement("smart-menu"),o=document.createDocumentFragment();a.mode="vertical",a.dropDownAppendTo="body",a.classList.add("smart-grid-download-menu"),a.rightToLeft=t.rightToLeft;const s=(e,t)=>{const a=document.createElement("smart-menu-item");let o="#D50000";switch(t){case"csv":o="#3f51b5";break;case"pdf":o="#f4511e";break;case"xlsx":o="#0b8043";break;case"json":o="#8e24aa"}const s='<span style="position: absolute; top: 0px; font-size: 10px; color: '+o+'">'+t+"</span>";return a.label='<span style="color: '+o+'" class="smart-grid-icon smart-icon-docs"></span>'+s+e,a.value=t,a};o.appendChild(s(t.localize("download")+" CSV","csv")),o.appendChild(s(t.localize("download")+" XLSX","xlsx")),o.appendChild(s(t.localize("download")+" JSON","json")),a.appendChild(o),e.downloadMenu.appendChild(a),a.onItemClick=e=>{const a=new Date;t.dataExport.fileName="data_"+a.getFullYear()+"-"+a.getMonth()+"-"+a.getDate(),t.exportData(e.detail.value)}}closePanel(){const e=this;super.closePanel(),e.grid&&e.grid.focus(),e.downloadMenu&&e.downloadMenu.classList.contains("open")?e._closeDownloadMenu():e.viewsMenu&&e.viewsMenu.classList.contains("open")?e._closeViewsMenu():e.resourceMenu&&e.resourceMenu.classList.contains("open")?e._closeResourceMenu():e.labelMenu&&e.labelMenu.classList.contains("open")?e._closeLabelMenu():e.colorMenu&&e.colorMenu.classList.contains("open")&&e._closeColorMenu()}_closeResourceMenu(){const e=this,t=e.resourceMenu;t&&(t.parentNode&&(t.classList.remove("open"),setTimeout((()=>{t&&t.parentNode&&t.parentNode.removeChild(t)}),100)),e.$.resourceButton.classList.remove("selected"),e.$.resourceButton.removeAttribute("aria-expanded"),t.classList.remove("open"))}_openResourceMenu(){const e=this;if(e.grid.editing.isEditing&&e.grid.cancelEdit(),e.resourceMenu&&e.resourceMenu.classList.contains("open"))return void e._closeResourceMenu();e.$.headerDropDown.classList.remove("view-panel","group-panel","colors-panel","customize-panel","filter-panel","sort-panel","search-panel","format-panel"),e.$.group.classList.add("smart-hidden"),e.$.filter.classList.add("smart-hidden"),e.$.colors.classList.add("smart-hidden"),e.$.customize.classList.add("smart-hidden"),e.$.sort.classList.add("smart-hidden"),e.$.search.classList.add("smart-hidden"),e.$.format.classList.add("smart-hidden"),e.$.view.classList.add("smart-hidden"),e.$.ai.classList.add("smart-hidden"),e.closePanel(),e.$.resourceButton.classList.add("selected"),e.$.resourceButton.setAttribute("aria-expanded",!0),e.resourceMenu||(e.resourceMenu=document.createElement("div"),e.resourceMenu.classList.add("smart-grid-column-menu","smart-grid-resource-menu"),e.resourceMenu.setAttribute("theme",e.getAttribute("theme")),e.resourceMenu.id=e.id+"_"+e.tagName.toLowerCase()+"_menu_"+Math.floor(65536*(1+Math.random())).toString(16).substring(1)),e.resourceMenu.classList.add("smart-animate"),e._createResourceMenuItems(),e.resourceMenu.style.height="auto",e.isInShadowDOM?e.getRootNode().appendChild(e.resourceMenu):document.body.appendChild(e.resourceMenu);const t=e.$.resourceButton.getBoundingClientRect();let a=t.left+window.pageXOffset,o=t.bottom+window.pageYOffset;a+e.resourceMenu.offsetWidth>window.innerWidth&&(a=t.right+window.pageXOffset-e.resourceMenu.offsetWidth,a+e.resourceMenu.offsetWidth>window.innerWidth&&(a=window.innerWidth-e.resourceMenu.offsetWidth)),e.resourceMenu.style.left=a+"px",e.resourceMenu.style.top=o+"px",e.resourceMenu.classList.remove("smart-hidden"),e.resourceMenu.classList.add("open")}_closeLabelMenu(){const e=this,t=e.labelMenu;t&&(t.parentNode&&(t.classList.remove("open"),setTimeout((()=>{t&&t.parentNode&&t.parentNode.removeChild(t)}),100)),e.$.labelButton.classList.remove("selected"),e.$.labelButton.removeAttribute("aria-expanded"),t.classList.remove("open"))}_createLabelMenuItems(){const e=this,t=e.grid;e._removeLabelMenu();const a=document.createElement("smart-menu"),o=document.createDocumentFragment();a.classList.add("smart-grid-views-menu"),a.checkable=!0,a.checkboxes=!0,a.style.width="100%",a.mode="vertical",a.dropDownAppendTo="body",a.rightToLeft=t.rightToLeft,a.style.minWidth="150px";const s=(e,a,o,s)=>{const n=document.createElement("smart-menu-item");return n.label='<span class="smart-grid-icon '+a+'"></span>'+e,t._labeledBy===s&&(n.setAttribute("focus",""),n.checked=!0),n.value=s,n};for(let e=0;e<t.columns.length;e++){const a=t.columns[e];"string"!==a.dataType||a.relationField||"input"!==a.editor.template&&"textarea"!==a.editor.template||o.appendChild(s(a.label,a.icon,0,a.dataField))}a.appendChild(o),e.labelMenu.insertBefore(a,e.labelMenu.children[e.labelMenu.children.length-1]),e.labelMenu.onpointerup=()=>!1,a.onItemClick=a=>{t._labeledBy===a.detail.item.value?delete t._labeledBy:t._labeledBy=a.detail.item.value,t._onSort&&t._onSort(),e._closeLabelMenu(),t.autoSaveState()}}_closeColorMenu(){const e=this,t=e.colorMenu;t&&(t.parentNode&&(t.classList.remove("open"),setTimeout((()=>{t&&t.parentNode&&t.parentNode.removeChild(t)}),100)),e.$.colorButton.classList.remove("selected"),e.$.colorButton.removeAttribute("aria-expanded"),e.$.backgroundButton.classList.remove("selected"),e.$.backgroundButton.removeAttribute("aria-expanded"),t.classList.remove("open"))}_closeFontSizeMenu(){const e=this,t=e.fontSizeMenu;t&&(t.parentNode&&(t.classList.remove("open"),setTimeout((()=>{t&&t.parentNode&&t.parentNode.removeChild(t)}),100)),e.$.fontSizeButton.classList.remove("selected"),e.$.fontSizeButton.removeAttribute("aria-expanded"),t.classList.remove("open"))}_openFontSizeMenu(){const e=this;if(e.grid.editing.isEditing&&e.grid.cancelEdit(),e.fontSizeMenu&&e.fontSizeMenu.classList.contains("open"))return void e._closeFontSizeMenu();e.$.headerDropDown.classList.remove("view-panel","group-panel","colors-panel","customize-panel","filter-panel","sort-panel","search-panel","format-panel"),e.$.group.classList.add("smart-hidden"),e.$.filter.classList.add("smart-hidden"),e.$.colors.classList.add("smart-hidden"),e.$.customize.classList.add("smart-hidden"),e.$.sort.classList.add("smart-hidden"),e.$.search.classList.add("smart-hidden"),e.$.format.classList.add("smart-hidden"),e.$.view.classList.add("smart-hidden"),e.$.ai.classList.add("smart-hidden"),e.closePanel(),e.$.fontSizeButton.classList.add("selected"),e.$.fontSizeButton.setAttribute("aria-expanded",!0),e.fontSizeMenu||(e.fontSizeMenu=document.createElement("div"),e.fontSizeMenu.classList.add("smart-grid-column-menu","smart-grid-fontsize-menu"),e.fontSizeMenu.setAttribute("theme",e.getAttribute("theme")),e.fontSizeMenu.id=e.id+"_"+e.tagName.toLowerCase()+"_menu_"+Math.floor(65536*(1+Math.random())).toString(16).substring(1)),e.fontSizeMenu.classList.add("smart-animate");const t=e.grid;e._removeFontSizeMenu();const a=document.createElement("smart-menu"),o=document.createDocumentFragment();a.mode="vertical",a.dropDownAppendTo="body",a.classList.add("smart-grid-fontsize-menu"),a.rightToLeft=t.rightToLeft;const s=["-","8px","10px","12px","14px","18px","24px"];for(let e=0;e<s.length;e++){const t=document.createElement("smart-menu-item");t.label=s[e],t.value=s[e],o.appendChild(t)}a.appendChild(o),e.fontSizeMenu.appendChild(a),a.onItemClick=t=>{const a=t.detail.value;e._setStyle("fontSize",a)},e.fontSizeMenu.style.height="auto",e.isInShadowDOM?e.getRootNode().appendChild(e.fontSizeMenu):document.body.appendChild(e.fontSizeMenu);const n=e.$.fontSizeButton.getBoundingClientRect();let i=n.left+window.pageXOffset,r=n.bottom+window.pageYOffset;i+e.$.fontSizeButton.offsetWidth>window.innerWidth&&(i=n.right+window.pageXOffset-e.fontSizeMenu.offsetWidth,i+e.$.fontSizeButton.offsetWidth>window.innerWidth&&(i=window.innerWidth-e.$.fontSizeButton.offsetWidth)),e.fontSizeMenu.style.width="60px",e.fontSizeMenu.style.left=i+"px",e.fontSizeMenu.style.top=r+"px",e.fontSizeMenu.classList.remove("smart-hidden"),e.fontSizeMenu.classList.add("open")}_closeFontFamilyMenu(){const e=this,t=e.fontFamilyMenu;t&&(t.parentNode&&(t.classList.remove("open"),setTimeout((()=>{t&&t.parentNode&&t.parentNode.removeChild(t)}),100)),e.$.fontFamilyButton.classList.remove("selected"),e.$.fontFamilyButton.removeAttribute("aria-expanded"),t.classList.remove("open"))}_openFontFamilyMenu(){const e=this;if(e.grid.editing.isEditing&&e.grid.cancelEdit(),e.fontFamilyMenu&&e.fontFamilyMenu.classList.contains("open"))return void e._closeFontFamilyMenu();e.$.headerDropDown.classList.remove("view-panel","group-panel","colors-panel","customize-panel","filter-panel","sort-panel","search-panel","format-panel"),e.$.group.classList.add("smart-hidden"),e.$.filter.classList.add("smart-hidden"),e.$.colors.classList.add("smart-hidden"),e.$.customize.classList.add("smart-hidden"),e.$.sort.classList.add("smart-hidden"),e.$.search.classList.add("smart-hidden"),e.$.format.classList.add("smart-hidden"),e.$.view.classList.add("smart-hidden"),e.$.ai.classList.add("smart-hidden"),e.closePanel(),e.$.fontFamilyButton.classList.add("selected"),e.$.fontFamilyButton.setAttribute("aria-expanded",!0),e.fontFamilyMenu||(e.fontFamilyMenu=document.createElement("div"),e.fontFamilyMenu.classList.add("smart-grid-column-menu","smart-grid-fontfamily-menu"),e.fontFamilyMenu.setAttribute("theme",e.getAttribute("theme")),e.fontFamilyMenu.id=e.id+"_"+e.tagName.toLowerCase()+"_menu_"+Math.floor(65536*(1+Math.random())).toString(16).substring(1)),e.fontFamilyMenu.classList.add("smart-animate");const t=e.grid;e._removeFontFamilyMenu();const a=document.createElement("smart-menu"),o=document.createDocumentFragment();a.mode="vertical",a.dropDownAppendTo="body",a.classList.add("smart-grid-fontsize-menu"),a.rightToLeft=t.rightToLeft;const s=["-","Roboto","Segoe UI","Arial","Georgia","Tahoma","Times New Roman","Courier New","Verdana"];for(let e=0;e<s.length;e++){const t=document.createElement("smart-menu-item");t.label=s[e],t.value=s[e],o.appendChild(t)}a.appendChild(o),e.fontFamilyMenu.appendChild(a),a.onItemClick=t=>{e._setStyle("fontFamily",t.detail.value)},e.fontFamilyMenu.style.height="auto",e.isInShadowDOM?e.getRootNode().appendChild(e.fontFamilyMenu):document.body.appendChild(e.fontFamilyMenu);const n=e.$.fontFamilyButton.getBoundingClientRect();let i=n.left+window.pageXOffset,r=n.bottom+window.pageYOffset;i+e.$.fontFamilyButton.offsetWidth>window.innerWidth&&(i=n.right+window.pageXOffset-e.fontFamilyMenu.offsetWidth,i+e.$.fontFamilyButton.offsetWidth>window.innerWidth&&(i=window.innerWidth-e.$.fontFamilyButton.offsetWidth)),e.fontFamilyMenu.style.width="140px",e.fontFamilyMenu.style.left=i+"px",e.fontFamilyMenu.style.top=r+"px",e.fontFamilyMenu.classList.remove("smart-hidden"),e.fontFamilyMenu.classList.add("open")}_openColorMenu(e,t){const a=this;if(a.grid.editing.isEditing&&a.grid.cancelEdit(),a.colorMenu&&a.colorMenu.classList.contains("open")){if(a.colorMenu.classList.remove("open"),a.colorMenu.isBackground&&t)return void a._closeColorMenu();if(!a.colorMenu.isBackground&&!t)return void a._closeColorMenu()}a.$.headerDropDown.classList.remove("view-panel","group-panel","colors-panel","customize-panel","filter-panel","sort-panel","search-panel","format-panel"),a.$.group.classList.add("smart-hidden"),a.$.filter.classList.add("smart-hidden"),a.$.colors.classList.add("smart-hidden"),a.$.customize.classList.add("smart-hidden"),a.$.sort.classList.add("smart-hidden"),a.$.search.classList.add("smart-hidden"),a.$.format.classList.add("smart-hidden"),a.$.view.classList.add("smart-hidden"),a.$.ai.classList.add("smart-hidden"),a.closePanel(),a.$.colorButton.classList.remove("selected"),a.$.colorButton.removeAttribute("aria-expanded"),a.$.backgroundButton.classList.remove("selected"),a.$.backgroundButton.removeAttribute("aria-expanded"),t?(a.$.backgroundButton.classList.add("selected"),a.$.backgroundButton.setAttribute("aria-expanded",!0)):(a.$.colorButton.classList.add("selected"),a.$.colorButton.setAttribute("aria-expanded",!0)),a.colorMenu||(a.colorMenu=document.createElement("div"),a.colorMenu.className="smart-grid-column-menu smart-grid-color-menu smart-color-input-drop-down-menu smart-color-panel smart-input-drop-down-menu underlined-drop-down-menu smart-grid-color-input-drop-down-menu smart-drop-down-box-drop-down-menu smart-color-picker-drop-down-menu smart-grid-color-input",a.colorMenu.setAttribute("theme",a.getAttribute("theme")),a.colorMenu.id=a.id+"_"+a.tagName.toLowerCase()+"_menu_"+Math.floor(65536*(1+Math.random())).toString(16).substring(1),a.colorMenu.innerHTML=a._getColors()),a.colorMenu.classList.add("smart-animate"),a.colorMenu.isBackground=t,a.colorMenu.style.height="auto",a.isInShadowDOM?a.getRootNode().appendChild(a.colorMenu):document.body.appendChild(a.colorMenu);const o=t?a.$.backgroundButton.getBoundingClientRect():a.$.colorButton.getBoundingClientRect();let s=o.left+window.pageXOffset,n=o.bottom+window.pageYOffset;s+a.colorMenu.offsetWidth>window.innerWidth&&(s=o.right+window.pageXOffset-a.colorMenu.offsetWidth,s+a.colorMenu.offsetWidth>window.innerWidth&&(s=window.innerWidth-a.colorMenu.offsetWidth)),a.colorMenu.style.left=s+"px",a.colorMenu.style.top=n+"px",a.colorMenu.classList.remove("smart-hidden"),a.colorMenu.classList.add("open"),a.colorMenu.querySelectorAll(".color-sample").forEach((t=>{t.classList.remove("selected"),t.getAttribute("value")===e&&t.classList.add("selected")})),a.colorMenu.onpointerup=e=>{const o=e.target.getAttribute("value");void 0!==o&&(a._closeColorMenu(),t?(a.$.backgroundButton.style.setProperty("--smart-surface-color",o),a._setStyle("background",o)):(a.$.colorButton.style.setProperty("--smart-surface-color",o),a._setStyle("color",o)))}}_openLabelMenu(){const e=this;if(e.grid.editing.isEditing&&e.grid.cancelEdit(),e.labelMenu&&e.labelMenu.classList.contains("open"))return void e._closeLabelMenu();e.$.headerDropDown.classList.remove("view-panel","group-panel","colors-panel","customize-panel","filter-panel","sort-panel","search-panel","format-panel"),e.$.group.classList.add("smart-hidden"),e.$.filter.classList.add("smart-hidden"),e.$.colors.classList.add("smart-hidden"),e.$.customize.classList.add("smart-hidden"),e.$.sort.classList.add("smart-hidden"),e.$.search.classList.add("smart-hidden"),e.$.format.classList.add("smart-hidden"),e.$.view.classList.add("smart-hidden"),e.$.ai.classList.add("smart-hidden"),e.closePanel(),e.$.labelButton.classList.add("selected"),e.$.labelButton.setAttribute("aria-expanded",!0),e.labelMenu||(e.labelMenu=document.createElement("div"),e.labelMenu.classList.add("smart-grid-column-menu","smart-grid-label-menu"),e.labelMenu.setAttribute("theme",e.getAttribute("theme")),e.labelMenu.id=e.id+"_"+e.tagName.toLowerCase()+"_menu_"+Math.floor(65536*(1+Math.random())).toString(16).substring(1)),e.labelMenu.classList.add("smart-animate"),e._createLabelMenuItems(),e.labelMenu.style.height="auto",e.isInShadowDOM?e.getRootNode().appendChild(e.labelMenu):document.body.appendChild(e.labelMenu);const t=e.$.labelButton.getBoundingClientRect();let a=t.left+window.pageXOffset,o=t.bottom+window.pageYOffset;a+e.labelMenu.offsetWidth>window.innerWidth&&(a=t.right+window.pageXOffset-e.labelMenu.offsetWidth,a+e.labelMenu.offsetWidth>window.innerWidth&&(a=window.innerWidth-e.labelMenu.offsetWidth)),e.labelMenu.style.left=a+"px",e.labelMenu.style.top=o+"px",e.labelMenu.classList.remove("smart-hidden"),e.labelMenu.classList.add("open")}_closeDownloadMenu(){const e=this,t=e.downloadMenu;t&&(t.parentNode&&(t.classList.remove("open"),setTimeout((()=>{t&&t.parentNode&&t.parentNode.removeChild(t)}),100)),e.$.downloadButton.classList.remove("selected"),e.$.downloadButton.removeAttribute("aria-expanded"),t.classList.remove("open"))}_openDownloadMenu(){const e=this;if(e.grid.editing.isEditing&&e.grid.cancelEdit(),e.downloadMenu&&e.downloadMenu.classList.contains("open"))return void e._closeDownloadMenu();e.$.headerDropDown.classList.remove("view-panel","group-panel","colors-panel","customize-panel","filter-panel","sort-panel","search-panel","format-panel"),e.$.group.classList.add("smart-hidden"),e.$.filter.classList.add("smart-hidden"),e.$.colors.classList.add("smart-hidden"),e.$.customize.classList.add("smart-hidden"),e.$.sort.classList.add("smart-hidden"),e.$.search.classList.add("smart-hidden"),e.$.format.classList.add("smart-hidden"),e.$.view.classList.add("smart-hidden"),e.$.ai.classList.add("smart-hidden"),e.closePanel(),e.$.downloadButton.classList.add("selected"),e.$.downloadButton.setAttribute("aria-expanded",!0),e.downloadMenu||(e.downloadMenu=document.createElement("div"),e.downloadMenu.classList.add("smart-grid-column-menu","smart-grid-download-menu"),e.downloadMenu.setAttribute("theme",e.getAttribute("theme")),e.downloadMenu.id=e.id+"_"+e.tagName.toLowerCase()+"_menu_"+Math.floor(65536*(1+Math.random())).toString(16).substring(1)),e.downloadMenu.classList.add("smart-animate"),e._createMenuItems(),e.downloadMenu.style.height="auto",e.isInShadowDOM?e.getRootNode().appendChild(e.downloadMenu):document.body.appendChild(e.downloadMenu);const t=e.$.downloadButton.getBoundingClientRect();let a=t.left+window.pageXOffset,o=t.bottom+window.pageYOffset;a+e.downloadMenu.offsetWidth>window.innerWidth&&(a=t.right+window.pageXOffset-e.downloadMenu.offsetWidth,a+e.downloadMenu.offsetWidth>window.innerWidth&&(a=window.innerWidth-e.downloadMenu.offsetWidth)),e.downloadMenu.style.left=a+"px",e.downloadMenu.style.top=o+"px",e.downloadMenu.classList.remove("smart-hidden"),e.downloadMenu.classList.add("open")}_closeViewsMenu(){const e=this,t=e.viewsMenu;t&&(t.parentNode&&(t.classList.remove("open"),setTimeout((()=>{t&&t.parentNode&&t.parentNode.removeChild(t)}),100)),t.classList.remove("open"),e.$.viewsButton.classList.remove("selected"),e.$.viewsButton.removeAttribute("aria-expanded"))}_openViewsMenu(){const e=this;if(e.grid.editing.isEditing&&e.grid.cancelEdit(),e.viewsMenu&&e.viewsMenu.classList.contains("open"))return void e._closeViewsMenu();e.$.headerDropDown.classList.remove("view-panel","group-panel","colors-panel","customize-panel","filter-panel","sort-panel","search-panel","format-panel"),e.$.group.classList.add("smart-hidden"),e.$.filter.classList.add("smart-hidden"),e.$.colors.classList.add("smart-hidden"),e.$.customize.classList.add("smart-hidden"),e.$.sort.classList.add("smart-hidden"),e.$.search.classList.add("smart-hidden"),e.$.format.classList.add("smart-hidden"),e.$.view.classList.add("smart-hidden"),e.$.ai.classList.add("smart-hidden"),e.closePanel(),e.$.viewsButton.classList.add("selected"),e.$.viewsButton.setAttribute("aria-expanded",!0),e.viewsMenu||(e.viewsMenu=document.createElement("div"),e.viewsMenu.classList.add("smart-grid-column-menu","smart-grid-download-menu","smart-grid-view-chooser"),e.viewsMenu.setAttribute("theme",e.getAttribute("theme")),e.viewsMenu.id=e.id+"_"+e.tagName.toLowerCase()+"_menu_"+Math.floor(65536*(1+Math.random())).toString(16).substring(1)),e.viewsMenu.classList.add("smart-animate"),e._createViewsMenuItems("views"),e.viewsMenu.style.height="auto",e.isInShadowDOM?e.getRootNode().appendChild(e.viewsMenu):document.body.appendChild(e.viewsMenu);const t=e.$.viewsButton.getBoundingClientRect();let a=t.left+window.pageXOffset,o=t.bottom+window.pageYOffset;a+e.viewsMenu.offsetWidth>window.innerWidth&&(a=t.right+window.pageXOffset-e.downloadMenu.offsetWidth,a+e.viewsMenu.offsetWidth>window.innerWidth&&(a=window.innerWidth-e.viewsMenu.offsetWidth)),e.viewsMenu.style.left=a+"px",e.viewsMenu.style.top=o+"px",e.viewsMenu.classList.remove("smart-hidden"),e.viewsMenu.classList.add("open")}_setStyle(e,t){const a=this.grid;if(!a._selection)return;const o=a._selection.cells;if(o&&Object.keys(o).length>0){const o=a.getSelectedCells(!1),s={};for(let n=0;n<o.length;n++){const i=o[n],r=i[0],l=i[1],d=a.rowById[r],c=d.style?JSON.parse(JSON.stringify(d.style)):{};s[r]||(s[r]={});for(let e in c){for(let e=0;e<a.columns.length;e++){const t=a.columns[e].dataField;c[t]&&(s[r][t]=c[t])}c[e]&&["color","background","textDecoration","fontStyle","fontFamily","fontWeight","fontSize"].indexOf(e)>=0&&(s[r][e]=c[e])}const u=s[r];if(d){const a=d.getCell(l);if(a){const o=a.canNotify;a.canNotify=!1,"textDecoration"===e?(a[e]||(a[e]=""),a[e].indexOf(t)>=0?a[e]=a[e].replace(t,"").trim():a[e]+=" "+t):a[e]===t?a[e]="":a[e]=t,a.canNotify=o;const s=u[a.column.dataField]={};["color","background","textDecoration","fontStyle","fontFamily","fontWeight","fontSize"].forEach((e=>{a[e]&&(s[e]=a[e])}))}const o=d.canNotify;if(0===Object.keys(u).length){delete s[r];continue}d.canNotify=!1,d.style=u,d.canNotify=o}}if(a.onRowStyle){const e=[],t=[],o=[];Object.keys(s).forEach(((n,i)=>{const r=s[n];e.push(i),t.push(a.rowById[n]),o.push(r)})),a.onRowStyle(e,t,o)}a._recycle(!1,!0)}else{const o=a.getSelectedRowIds(),s=[],n=[],i=[];for(let r=0;r<o.length;r++){const l=o[r],d=a.rowById[l],c=d.style?JSON.parse(JSON.stringify(d.style)):{};if("textDecoration"===e?(c[e]||(c[e]=""),c[e].indexOf(t)>=0?c[e]=c[e].replace(t,"").trim():c[e]+=" "+t):c[e]===t?c[e]="":c[e]=t,a.setRowStyle(l,c),a.onRowStyle){s.push(d.index),n.push(d);const e={};["color","background","textDecoration","fontStyle","fontFamily","fontWeight","fontSize"].forEach((t=>{c[t]&&(e[t]=c[t])})),i.push(e)}}a.onRowStyle&&a.onRowStyle(s,n,i)}}_updateTools(){const e=this,t=e.grid;if(!t._selection)return;const a=t._selection.cells;if(a&&Object.keys(a).length>0){const a=t.getSelectedCells(!1);for(let o=0;o<a.length;o++){const s=a[o],n=s[0],i=s[1],r=t.rowById[n];if(r){const t=r.getCell(i);if(t){e.$.boldButton.removeAttribute("aria-expanded"),e.$.italicButton.removeAttribute("aria-expanded"),e.$.underlineButton.removeAttribute("aria-expanded"),e.$.strikethroughButton.removeAttribute("aria-expanded"),e.$.colorButton.removeAttribute("aria-expanded"),e.$.backgroundButton.removeAttribute("aria-expanded"),e.$.fontSizeButton.removeAttribute("aria-expanded"),e.$.fontFamilyButton.removeAttribute("aria-expanded"),e.$.backgroundButton.style.setProperty("--smart-surface-color","inherit"),e.$.colorButton.style.setProperty("--smart-surface-color","inherit"),e.fontSizeMenu&&e.fontSizeMenu.querySelectorAll("smart-menu-item").forEach((e=>{e.removeAttribute("focus")})),e.fontFamilyMenu&&e.fontFamilyMenu.querySelectorAll("smart-menu-item").forEach((e=>{e.removeAttribute("focus")})),t.fontWeight&&e.$.boldButton.setAttribute("aria-expanded","true"),t.background&&e.$.backgroundButton.style.setProperty("--smart-surface-color",t.background),t.color&&e.$.colorButton.style.setProperty("--smart-surface-color",t.color),t.fontStyle&&e.$.italicButton.setAttribute("aria-expanded","true"),t.textDecoration&&(t.textDecoration.indexOf("line-through")>=0&&e.$.strikethroughButton.setAttribute("aria-expanded","true"),t.textDecoration.indexOf("under")>=0&&e.$.underlineButton.setAttribute("aria-expanded","true")),t.fontSize&&e.fontSizeMenu&&e.fontSizeMenu.querySelectorAll("smart-menu-item").forEach((e=>{e.removeAttribute("focus"),e.value===t.fontSize&&e.setAttribute("focus","")})),t.fontFamily&&e.fontFamilyMenu&&e.fontFamilyMenu.querySelectorAll("smart-menu-item").forEach((e=>{e.removeAttribute("focus"),e.value===t.fontFamily&&e.setAttribute("focus","")}));break}}}t._recycle(!1,!0)}else{const a=t.getSelectedRowIds();for(let o=0;o<a.length;o++){const s=a[o],n=t.rowById[s],i=n.style?JSON.parse(JSON.stringify(n.style)):{};e.$.boldButton.removeAttribute("aria-expanded"),e.$.italicButton.removeAttribute("aria-expanded"),e.$.underlineButton.removeAttribute("aria-expanded"),e.$.strikethroughButton.removeAttribute("aria-expanded"),e.$.colorButton.removeAttribute("aria-expanded"),e.$.backgroundButton.removeAttribute("aria-expanded"),e.$.fontSizeButton.removeAttribute("aria-expanded"),e.$.fontFamilyButton.removeAttribute("aria-expanded"),i.fontWeight&&e.$.boldButton.setAttribute("aria-expanded","true"),i.background&&(e.$.backgroundButton.style.color=i.background),i.color&&(e.$.colorButton.style.color=i.color),i.fontStyle&&e.$.fontFamilyButton.setAttribute("aria-expanded","true"),i.textDecoration&&(i.textDecoration.indexOf("line-through")>=0&&e.$.strikethroughButton.setAttribute("aria-expanded","true"),i.textDecoration.indexOf("under")>=0&&e.$.underlineButton.setAttribute("aria-expanded","true"));break}}}_getColors(){return'<div class="default-samples-container grid-mode-container smart-container" role="presentation" style="">\n <div class="grid-samples-container" role="menu">\n <div id="colorInputca5bItem858b" data-label="#D50000" value="#D50000" role="menuitem" aria-label="#D50000" class="color-sample" style="background-color: rgb(213, 0, 0);"></div>\n <div id="colorInputca5bItem963b" data-label="#E67C73" value="#E67C73" role="menuitem" aria-label="#E67C73" class="color-sample" style="background-color: rgb(230, 124, 115);"></div><div id="colorInputca5bItem2f1f" data-label="#F4511E" value="#F4511E" role="menuitem" aria-label="#F4511E" class="color-sample" style="background-color: rgb(244, 81, 30);"></div><div id="colorInputca5bItem1a87" data-label="#F6BF26" value="#F6BF26" role="menuitem" aria-label="#F6BF26" class="color-sample" style="background-color: rgb(246, 191, 38);"></div><div id="colorInputca5bItem4c44" data-label="#0B8043" value="#0B8043" role="menuitem" aria-label="#0B8043" class="color-sample" style="background-color: rgb(11, 128, 67);"></div><div id="colorInputca5bItem8669" data-label="#33B679" value="#33B679" role="menuitem" aria-label="#33B679" class="color-sample" style="background-color: rgb(51, 182, 121);"></div><div id="colorInputca5bItem488c" data-label="#3F51B5" value="#3F51B5" role="menuitem" aria-label="#3F51B5" class="color-sample" style="background-color: rgb(63, 81, 181);"></div><div id="colorInputca5bItemc3aa" data-label="#039BE5" value="#039BE5" role="menuitem" aria-label="#039BE5" class="color-sample" style="background-color: rgb(3, 155, 229);"></div><div id="colorInputca5bItem4277" data-label="#7986CB" value="#7986CB" role="menuitem" aria-label="#7986CB" class="color-sample" style="background-color: rgb(121, 134, 203);"></div><div id="colorInputca5bItem3b61" data-label="#8C47FF" value="#8C47FF" role="menuitem" aria-label="#8C47FF" class="color-sample" style="background-color: rgb(140, 71, 255);"></div><div id="colorInputca5bItema4a6" data-label="#8E24AA" value="#8E24AA" role="menuitem" aria-label="#8E24AA" class="color-sample" style="background-color: rgb(142, 36, 170);"></div><div id="colorInputca5bItemdd64" data-label="#FF36C2" value="#FF36C2" role="menuitem" aria-label="#FF36C2" class="color-sample" style="background-color: rgb(255, 54, 194);"></div><div id="colorInputca5bItem07d0" data-label="#616161" value="#616161" role="menuitem" aria-label="#616161" class="color-sample" style="background-color: rgb(97, 97, 97);"></div><div id="colorInputca5bItemb2a4" data-label="#454545" value="#454545" role="menuitem" aria-label="#454545" class="color-sample" style="background-color: rgb(69, 69, 69);"></div><div id="colorInputca5bItem8de8" data-label="#949494" value="#949494" role="menuitem" aria-label="#949494" class="color-sample" style="background-color: rgb(148, 148, 148);"></div><div id="colorInputca5bItem75ce" data-label="#000000" value="#000000" role="menuitem" aria-label="#000000" class="color-sample" style="background-color: rgb(0, 0, 0);"></div></div><div class="grid-samples-container" role="menu"><div id="colorInputca5bItem932f" data-label="#FF9EB7" value="#FF9EB7" role="menuitem" aria-label="#FF9EB7" class="color-sample" style="background-color: rgb(255, 158, 183);"></div><div id="colorInputca5bItemc244" data-label="#FFCFC9" value="#FFCFC9" role="menuitem" aria-label="#FFCFC9" class="color-sample" style="background-color: rgb(255, 207, 201);"></div><div id="colorInputca5bItemcfb1" data-label="#FFD66D" value="#FFD66D" role="menuitem" aria-label="#FFD66D" class="color-sample" style="background-color: rgb(255, 214, 109);"></div><div id="colorInputca5bItem2827" data-label="#FFEBB6" value="#FFEBB6" role="menuitem" aria-label="#FFEBB6" class="color-sample" style="background-color: rgb(255, 235, 182);"></div><div id="colorInputca5bItem766c" data-label="#93DF89" value="#93DF89" role="menuitem" aria-label="#93DF89" class="color-sample" style="background-color: rgb(147, 223, 137);"></div><div id="colorInputca5bItem10b3" data-label="#D1F7C4" value="#D1F7C4" role="menuitem" aria-label="#D1F7C4" class="color-sample" style="background-color: rgb(209, 247, 196);"></div><div id="colorInputca5bItemb8a4" data-label="#9DC7FF" value="#9DC7FF" role="menuitem" aria-label="#9DC7FF" class="color-sample" style="background-color: rgb(157, 199, 255);"></div><div id="colorInputca5bItem78ff" data-label="#D0F0FD" value="#D0F0FD" role="menuitem" aria-label="#D0F0FD" class="color-sample" style="background-color: rgb(208, 240, 253);"></div><div id="colorInputca5bItem71b8" data-label="#CDAFFF" value="#CDAFFF" role="menuitem" aria-label="#CDAFFF" class="color-sample" style="background-color: rgb(205, 175, 255);"></div><div id="colorInputca5bIteme4d6" data-label="#ECE1FD" value="#ECE1FD" role="menuitem" aria-label="#ECE1FD" class="color-sample" style="background-color: rgb(236, 225, 253);"></div><div id="colorInputca5bItem3576" data-label="#FA9DE2" value="#FA9DE2" role="menuitem" aria-label="#FA9DE2" class="color-sample" style="background-color: rgb(250, 157, 226);"></div><div id="colorInputca5bItem8136" data-label="#FFDAF6" value="#FFDAF6" role="menuitem" aria-label="#FFDAF6" class="color-sample" style="background-color: rgb(255, 218, 246);"></div><div id="colorInputca5bItem26e5" data-label="#CBCBCB" value="#CBCBCB" role="menuitem" aria-label="#CBCBCB" class="color-sample" style="background-color: rgb(203, 203, 203);"></div><div id="colorInputca5bItemdc8a" data-label="#EDEDED" value="#EDEDED" role="menuitem" aria-label="#EDEDED" class="color-sample" style="background-color: rgb(237, 237, 237);"></div><div id="colorInputca5bItemd895" data-label="#FFFFFF" value="#FFFFFF" role="menuitem" aria-label="#FFFFFF" class="color-sample" style="background-color: rgb(255, 255, 255); border-color: var(--smart-border); border-style: solid; border-width: 1px;"></div><div id="colorInputca5bItem7231" data-label="" value="" role="menuitem" aria-label="" class="color-sample no-color"></div></div>\n </div>'}_boldCommand(){this._setStyle("fontWeight","bold"),this._updateTools()}_italicCommand(){this._setStyle("fontStyle","italic"),this._updateTools()}_underlineCommand(){this._setStyle("textDecoration","underline"),this._updateTools()}_strikethroughCommand(){this._setStyle("textDecoration","line-through"),this._updateTools()}_refresh(){const e=this,t=e.grid;e._refreshColumns("refresh");let a=!1;for(let t=0;t<e.columns.length;t++)if("number"===e.columns[t].dataType){a=!0;break}if(t.header.buttons.indexOf("sort")>=0&&t.sorting.enabled?e.$.sortButton.classList.remove("smart-hidden"):e.$.sortButton.classList.add("smart-hidden"),t.header.buttons.indexOf("filter")>=0&&t.filtering.enabled?e.$.filterButton.classList.remove("smart-hidden"):e.$.filterButton.classList.add("smart-hidden"),t.header.buttons.indexOf("group")>=0&&t.grouping.enabled?e.$.groupButton.classList.remove("smart-hidden"):e.$.groupButton.classList.add("smart-hidden"),t.header.buttons.indexOf("columns")>=0?e.$.customizeButton.classList.remove("smart-hidden"):e.$.customizeButton.classList.add("smart-hidden"),t.header.buttons.indexOf("search")>=0?e.$.searchButton.classList.remove("smart-hidden"):e.$.searchButton.classList.add("smart-hidden"),t.header.buttons.indexOf("format")>=0&&a?e.$.formatButton.classList.remove("smart-hidden"):e.$.formatButton.classList.add("smart-hidden"),t.header.buttons.indexOf("colors")>=0?e.$.colorsButton.classList.remove("smart-hidden"):e.$.colorsButton.classList.add("smart-hidden"),t.header.buttons.indexOf("delete")>=0&&t.editing.enabled?e.$.deleteButton.classList.remove("smart-hidden"):e.$.deleteButton.classList.add("smart-hidden"),t.header.buttons.indexOf("download")>=0?e.$.downloadButton.classList.remove("smart-hidden"):e.$.downloadButton.classList.add("smart-hidden"),t.header.buttons.indexOf("views")>=0?e.$.viewsButton.classList.remove("smart-hidden"):e.$.viewsButton.classList.add("smart-hidden"),t.header.buttons.indexOf("states")>=0&&t.stateSettings.enabled&&!t.appearance.viewBarAppendTo?e.$.viewStatesButton.classList.remove("smart-hidden"):e.$.viewStatesButton.classList.add("smart-hidden"),t.header.buttons.indexOf("formatting")>=0&&"grid"===t.view?(e.$.boldButton.classList.remove("smart-hidden"),e.$.italicButton.classList.remove("smart-hidden"),e.$.underlineButton.classList.remove("smart-hidden"),e.$.strikethroughButton.classList.remove("smart-hidden"),e.$.colorButton.classList.remove("smart-hidden"),e.$.backgroundButton.classList.remove("smart-hidden"),e.$.fontSizeButton.classList.remove("smart-hidden"),e.$.fontFamilyButton.classList.remove("smart-hidden"),e.$.boldButton.title=t.localize("bold")+" (Ctrl + B)",e.$.italicButton.title=t.localize("italic")+" (Ctrl + I)",e.$.underlineButton.title=t.localize("underline")+" (Ctrl + U)",e.$.strikethroughButton.title=t.localize("strikethrough")+" (Ctrl + Y)",e.$.colorButton.title=t.localize("color"),e.$.backgroundButton.title=t.localize("background"),e.$.fontSizeButton.title=t.localize("fontSize").replace(":",""),e.$.fontFamilyButton.title=t.localize("fontFamily").replace(":",""),e.$.boldButton.onpointerup=()=>{e._boldCommand()},e.$.italicButton.onpointerup=()=>{e._italicCommand()},e.$.underlineButton.onpointerup=()=>{e._underlineCommand()},e.$.strikethroughButton.onpointerup=()=>{e._strikethroughCommand()},e.$.colorButton.onpointerup=()=>{const t=e.$.colorButton.style.getPropertyValue("--smart-surface-color");e._openColorMenu(t)},e.$.backgroundButton.onpointerup=()=>{const t=e.$.backgroundButton.style.getPropertyValue("--smart-surface-color");e._openColorMenu(t,!0)},e.$.fontSizeButton.onpointerup=()=>{e._openFontSizeMenu(),e._updateTools()},e.$.fontFamilyButton.onpointerup=()=>{e._openFontFamilyMenu(),e._updateTools()}):(e.$.boldButton.classList.add("smart-hidden"),e.$.italicButton.classList.add("smart-hidden"),e.$.underlineButton.classList.add("smart-hidden"),e.$.strikethroughButton.classList.add("smart-hidden"),e.$.colorButton.classList.add("smart-hidden"),e.$.backgroundButton.classList.add("smart-hidden"),e.$.fontSizeButton.classList.add("smart-hidden"),e.$.fontFamilyButton.classList.add("smart-hidden")),t.users&&t.users.length&&(!1===t.currentUser||null===t.currentUser||void 0===t.currentUser)&&(t.stateSettings.storage&&Object.keys(t.stateSettings.storage).length,t.stateSettings.enabled),"scheduler"===t.view||"timeline"===t.view?(e.$.resourceButton.classList.add("smart-hidden"),e.grid._dateStackedBy&&e.$.resourceButton.classList.remove("smart-hidden"),e.$.labelButton.classList.add("smart-hidden"),e.grid._dateStackedBy&&e.$.labelButton.classList.remove("smart-hidden")):(e.$.labelButton.classList.add("smart-hidden"),e.$.resourceButton.classList.add("smart-hidden")),e.$.labelButton.onpointerup=a=>{t.closeMenu(),e._openLabelMenu(),a.stopPropagation()},e.$.resourceButton.onpointerup=a=>{t.closeMenu(),e._openResourceMenu(),a.stopPropagation()},e.$.downloadButton.onpointerup=a=>{t.closeMenu(),e._openDownloadMenu(),a.stopPropagation()},e.$.viewsButton.onpointerup=a=>{t.closeMenu(),e._openViewsMenu(),a.stopPropagation()},!1===t.appearance.showViewBarAsDropdown&&(e.$.viewStatesButton.onpointerup=a=>{t.closeMenu(),e._closeDownloadMenu(),e._closeViewsMenu(),e._closeResourceMenu(),e._closeLabelMenu(),e._closeColorMenu(),e._closeFontSizeMenu(),e._closeFontFamilyMenu(),t.appearance.showViewBar=!t.appearance.showViewBar,a.stopPropagation(),e._updateViews()}),t._sortedColumns){const a=[],o=[],s=[];for(let e=0;e<t._sortedColumns.length;e++){const n=t._sortedColumns[e];a.push(n.dataField),o.push(n.sortOrder),s.push(n.dataType)}e._appliedSorting={dataFields:a,dataTypes:s,orderBy:o},e._refreshSortButton()}if("scheduler"!==t.view&&"timeline"!==t.view&&"kanban"!==t.view||e.$.sortButton.classList.add("smart-hidden"),"grid"===t.view||"card"===t.view||"scheduler"===t.view||"timeline"===t.view||"kanban"===t.view){const a={filters:[],operator:"and"},o=t.getFilteredColumnsByDataField();if(o)for(let e in o){const t=o[e];for(let o=0;o<t.filters.length;o++){const s=t.filters[o];a.filters.push([e,s.condition,s.value])}}e._appliedFiltering&&(a.operator=e._appliedFiltering.operator),e._appliedFiltering=a,e._refreshFilterButton()}e._appliedGrouping?e._appliedGrouping.dataFields=t.dataSource.groupBy:e._appliedGrouping={dataFields:t.dataSource.groupBy,expandAll:!1,collapseAll:!1},e._refreshCustomButton(),e._refreshAIButton(),e._refreshGroupButton(),e._refreshDeleteButton(),e._refreshDownloadButton(),e._refreshResourceButton(),e._refreshLabelButton(),e._refreshCustomizeButton(),e._refreshViewsButton(),e._refreshColorsButton(),e.refreshTools(),Smart.Utilities.Core.isMobile,!1===t.editing.enabled&&(e.$.customButton.classList.add("smart-hidden"),e.$.downloadButton.classList.add("smart-hidden"),e.$.resourceButton.classList.add("smart-hidden"),e.$.labelButton.classList.add("smart-hidden"),e.$.viewsButton.classList.add("smart-hidden"))}_refreshCustomButton(){const e=this,t=e.grid;t.header.customButton.visible?(e.$.customButton.style.paddingLeft="0px",e.$.customButton.classList.remove("smart-hidden")):e.$.customButton.classList.add("smart-hidden"),t.header.customButton.enabled?e.$.customButton.classList.remove("smart-disabled"):e.$.customButton.classList.add("smart-disabled"),e.$.customButton.innerHTML=`<span class="smart-grid-icon show ${t.header.customButton.icon}"></span><div class="smart-tool-label" role="presentation">${t.header.customButton.label}</div>`,e.$.customButton.onclick=()=>{t.header.customButton.command&&t.header.customButton.command()};for(let a=0;a<t.header.buttons.length;a++){const o=t.header.buttons[a];if("object"==typeof o){const t=e.$.customButton.cloneNode(!0);t.classList.remove("smart-hidden"),t.style.paddingLeft="0px",e.$.customButton.parentNode.insertBefore(t,e.$.customButton),o.label&&(t.querySelector(".smart-tool-label").innerHTML=o.label),o.icon&&(t.querySelector(".smart-grid-icon").className="smart-grid-icon show "+o.icon),t.onclick=()=>{o.command&&o.command()}}}}_refreshViewsButton(){const e=this;if(!e.grid)return;let t=e.grid.localize("viewGrid");switch(e.$.viewsButton.classList.remove("kanban"),e.$.viewsButton.classList.remove("card"),e.$.viewsButton.classList.remove("scheduler"),e.$.viewsButton.classList.remove("timeline"),e.grid.view){case"kanban":t=e.grid.localize("viewKanban"),e.$.viewsButton.classList.add("kanban");break;case"grid":t=e.grid.localize("viewGrid");break;case"card":e.$.viewsButton.classList.add("card"),t=e.grid.localize("viewCard");break;case"scheduler":e.$.viewsButton.classList.add("scheduler"),t=e.grid.localize("viewScheduler");break;case"timeline":e.$.viewsButton.classList.add("timeline"),t=e.grid.localize("viewTimeline")}e.$.viewsButton.innerHTML='<div class="smart-tool-label" role="presentation">'+t+"</div>";let a=this.grid.stateSettings.current||"";if(a.length>30)a=a.substring(0,30)+"...";else if(!a){let e=[],t=this.grid.view,o="";switch(t){case"grid":o=this.grid.localize("viewGrid");break;case"kanban":o=this.grid.localize("viewKanban");break;case"card":o=this.grid.localize("viewCard");break;case"scheduler":o=this.grid.localize("viewScheduler");break;case"timeline":o=this.grid.localize("viewTimeline")}if(this.grid&&this.grid.stateSettings.storage)for(;this.grid.stateSettings.storage[o+" "+this.grid.localize("view")+" "+e[t]];)e[t]++;void 0===e[t]&&(e[t]=""),a=o+" "+this.grid.localize("view")+" "+e[t]}const o=""!==a?a:this.grid.localize("views");e.$.viewStatesButton.innerHTML='<div class="smart-tool-label" role="presentation">'+o+"</div>"}_refreshDownloadButton(){const e=this;e.$.downloadButton.innerHTML='<div class="smart-tool-label" role="presentation"></div>',e.$.downloadButton.title=e.grid.localize("download")}_refreshDeleteButton(){let e=this;if(e.getSelectedRows||(e=e.grid),-1===e.header.buttons.indexOf("delete"))return;const t=e.getSelectedRows().length,a=e.$.headerBar.$.deleteButton,o=a.closest("smart-grid");(!o||o._currentUser&&(!o._currentUser||o._currentUser.info&&"guest"!==o._currentUser.info))&&0!==t?(!0===e.editing.enabled?a.classList.remove("smart-hidden"):a.classList.add("smart-hidden"),a.firstElementChild.innerHTML=1===t?e.localize("deleteByOne"):e.localize("deleteByMultiple",{n:t}),a.classList.add("selected"),a.onclick=()=>{const t=e.getSelectedRows().map((e=>e[0]));this.grid.removeRow(t)}):a.classList.add("smart-hidden")}_refreshFromSelection(){this.$.headerBar._refreshDeleteButton()}openGroupPanel(e){const t=this;let a;const o=t.grid;if("kanban"===o.view||"scheduler"===o.view||"timeline"===o.view)return;t.$.headerDropDown.classList.add("group-panel"),t.$.headerDropDown.classList.remove("view-panel","colors-panel","customize-panel","filter-panel","sort-panel","search-panel","format-panel"),t.$.group.classList.remove("smart-hidden"),t.$.filter.classList.add("smart-hidden"),t.$.customize.classList.add("smart-hidden"),t.$.sort.classList.add("smart-hidden"),t.$.colors.classList.add("smart-hidden"),t.$.search.classList.add("smart-hidden"),t.$.format.classList.add("smart-hidden"),t.$.view.classList.add("smart-hidden"),t.$.ai.classList.add("smart-hidden"),t._closeDownloadMenu(),t._closeViewsMenu(),t._closeResourceMenu(),t._refreshColumns("group"),o.closeMenu();const s=t.columns.map((e=>{const a=Object.assign({},e);if(t._appliedGrouping&&t._appliedGrouping.dataFields){const e=t._appliedGrouping.dataFields.indexOf(a.dataField);a.groupIndex=e}return a})).filter((e=>e.allowGroup));e&&t._appliedGrouping&&-1===t._appliedGrouping.dataFields.indexOf(e.dataField)&&(s.find((t=>t.dataField===e.dataField)).groupIndex=t._appliedGrouping.dataFields.length),t._groupPartCreated?(a=t.$.group.firstElementChild,a.rightToLeft=t.rightToLeft,a.dataSource=s,a.locale=t.locale,a.messages=t._innerElementMessages.groupPanel):(a=document.createElement("smart-group-panel"),a.rightToLeft=t.rightToLeft,a.animation=t.animation,a.locale=t.locale,a.messages=t._innerElementMessages.groupPanel,a.theme=t.theme,a.dataSource=s,t.$.group.appendChild(a),t._groupPartCreated=!0,a.onExpandAll=()=>{if(t._appliedGrouping.expandAll)return t._appliedGrouping.expandAll=!1,void a.querySelector(".smart-group-panel-expand-button").removeAttribute("active");t._appliedGrouping.expandAll=!0,t._appliedGrouping.collapseAll=!1,a.querySelector(".smart-group-panel-expand-button").setAttribute("active",""),a.querySelector(".smart-group-panel-collapse-button").removeAttribute("active")},a.onCollapseAll=()=>{if(t._appliedGrouping.collapseAll)return t._appliedGrouping.collapseAll=!1,void a.querySelector(".smart-group-panel-collapse-button").removeAttribute("active");t._appliedGrouping.expandAll=!1,t._appliedGrouping.collapseAll=!0,a.querySelector(".smart-group-panel-collapse-button").setAttribute("active",""),a.querySelector(".smart-group-panel-expand-button").removeAttribute("active")},a.addEventListener("apply",(e=>{const a=e.detail.sortByInfo,s=t._appliedGrouping.dataFields;t._appliedGrouping.dataFields=a.dataFields;const n=o.onRowInserted;if(o.onRowInserted=null,o.beginUpdate(),o.grouping.autoHideGroupColumn&&s)for(let e=0;e<s.length;e++){const t=o.columnByDataField[s[e]];t&&(t.visible=!0)}o.clearGroups();for(let e=0;e<a.dataFields.length;e++){const t=a.dataFields[e];o.addGroup(t)}t._appliedGrouping.expandAll&&o.expandAllRows(),t._appliedGrouping.collapseAll&&o.collapseAllRows(),o.endUpdate(),o.autoSaveState();const i=[];for(let e=0;e<o.dataSource.groupBy.length;e++)i.push(o.dataSource.groupBy[e]);o.$.fireEvent("group",{groups:i}),o.paging.enabled&&o._refreshPagesCount(),o.onRowInserted=n}))),t._refreshGroupButton(),t._openHeaderDropDown(t.$.groupButton)}_refreshLabelButton(){const e=this;if(e.$.labelButton.innerHTML='<div class="smart-tool-label" role="presentation">'+e.grid.localize("toolLabel")+"</div>",e.$.labelButton.classList.remove("grouped"),e.grid&&e.grid._labeledBy){const t=e.grid.columnByDataField[e.grid._labeledBy];t&&(e.$.labelButton.innerHTML='<div class="smart-tool-label" role="presentation">'+e.grid.localize("toolLabel",{column:t.label})+"</div>",e.$.labelButton.classList.add("grouped"))}else if(e.grid)for(let t=0;t<e.columns.length;t++){const a=e.columns[t];if("string"===a.dataType){e.$.labelButton.innerHTML='<div class="smart-tool-label" role="presentation">'+e.grid.localize("toolLabel",{column:a.label})+"</div>",e.$.labelButton.classList.add("grouped");break}}}_refreshResourceButton(){const e=this;if(e.$.resourceButton.innerHTML='<div class="smart-tool-label" role="presentation">'+e.grid.localize("firstByGroup")+"</div>",e.$.resourceButton.classList.remove("grouped"),e.grid&&e.grid._dateStackedBySelect){const t=e.grid.columnByDataField[e.grid._dateStackedBySelect];t&&(e.$.resourceButton.innerHTML='<div class="smart-tool-label" role="presentation">'+e.grid.localize("groupedBy",{column:t.label})+"</div>",e.$.resourceButton.classList.add("grouped"))}}_refreshAIButton(){const e=this;e.$.aiButton.classList.add("smart-hidden"),-1!==e.grid.header.buttons.indexOf("ai")&&(e.$.aiButton.classList.remove("smart-hidden"),e.$.aiButton.style.paddingLeft="0px",e.$.aiButton.innerHTML='<div class="smart-tool-label" role="presentation" style="padding: 5px;">'+e.grid.localize("addAIFilter")+"</div>")}_applyAI(){const e=this,t=e.grid;e.closePanel();const a=e.$.ai.firstElementChild,o=a.getAIInstructions();if(t.beginUpdate(),o&&o.sort&&o.sort.length>0){t.clearSort();const e=o.sort;for(let a=0;a<e.length;a++){const o=e[a],s=o.field,n=o.order;t.sortBy(s,n)}}if(o&&o.filters&&o.filters.length>0&&t._applyJSONFilters(o.filters),o&&o.group&&o.group.length>0){t.clearGroups();let e=o.group.map((e=>e.field));e.length&&e[0]&&t.addGroup(e)}const s=a.$.aiPrompt.value,n=s.indexOf("column")>=0||s.indexOf("cells")>=0;if(t.ai.includeUserPrompts&&(t.ai.userPrompts||(t.ai.userPrompts=[]),t.ai.userPrompts.push(s)),o&&o.format&&o.format.length>0){const e=o.format;let a={};for(let o=0;o<e.length;o++){const s=e[o],i=s.field;if(i&&n)a[i]||(a[i]=[]),a[i].push({field:i,condition:s.condition,value:s.value,value2:s.value2,background:s.background,color:s.color,textDecoration:s.textDecoration});else for(let e=0;e<t.columns.length;e++){const o=t.columns[e];a[o.dataField]||(a[o.dataField]=[]),a[o.dataField].push({field:i,condition:s.condition,value:s.value,value2:s.value2,background:s.background,color:s.color,textDecoration:s.textDecoration})}}for(let e=0;e<t.columns.length;e++)t.columns[e].cellsCSSInlineRules=null;for(let e in a){const o=t.columnByDataField[e];o&&(o.cellsCSSInlineRules=a[e])}}if(o&&o.edit&&o.edit.length>0){const e=o.edit;for(let a=0;a<e.length;a++){const o=e[a],s=o.row,n=o.value,i=o.field;s>=0&&(t.setCellValue(s,i,n),t.flashCell(s,i))}}t.endUpdate()}openAIPanel(){const e=this,t=e.grid;let a;if(e.$.headerDropDown.classList.add("ai-panel"),e.$.headerDropDown.classList.remove("view-panel","search-panel","colors-panel","customize-panel","filter-panel","sort-panel","group-panel","format-panel"),e.$.search.classList.add("smart-hidden"),e.$.customize.classList.add("smart-hidden"),e.$.group.classList.add("smart-hidden"),e.$.filter.classList.add("smart-hidden"),e.$.sort.classList.add("smart-hidden"),e.$.colors.classList.add("smart-hidden"),e.$.format.classList.add("smart-hidden"),e.$.view.classList.add("smart-hidden"),e.$.ai.classList.remove("smart-hidden"),e._aiPartCreated)a=e.$.ai.firstElementChild,a.set("locale",e.locale),a.messages=e._innerElementMessages.multiColumnFilterPanel,a.editorPlaceholder=e.localize("aiPrompt"),a.$.applyButton.classList.add("smart-disabled"),a.$.aiResponse.innerHTML=`${t.localize("noAIResponse")}`,a.$.addFilterButton.classList.remove("smart-hidden"),a.$.aiPrompt.classList.remove("smart-hidden"),a.$.aiResponse.classList.add("smart-hidden"),a.$.itemsContainer.querySelectorAll(".smart-ai-tab")[0].classList.add("active"),a.$.itemsContainer.querySelectorAll(".smart-ai-tab")[1].classList.remove("active"),a.$.aiPrompt.value="",a.$.spinner.innerHTML="",a.$.spinner.classList.add("smart-hidden"),a._applyValue(),a.rightToLeft=e.rightToLeft;else{a=document.createElement("smart-grid-ai-panel"),a.rightToLeft=e.rightToLeft,a.animation=e.animation,a.locale=e.locale,a.messages=e._innerElementMessages.multiColumnFilterPanel,a.operator=e._appliedFiltering.operator,a.editorPlaceholder=e.localize("aiPrompt"),a.theme=e.theme,a.value=e._appliedFiltering.filters,e.$.ai.appendChild(a),e._aiPartCreated=!0,a.$.addFilterButton.innerHTML="↑ "+t.localize("send"),a.$.addFilterButton.classList.add("smart-ai-button-send"),a.$.addFilterButton.style.background="var(--smart-ui-state-selected)",a.$.addFilterButton.style.borderRadius="15px",a.$.addFilterButton.style.color="var(--smart-primary)",a.$.addFilterButton.style.padding="6px 14px";const o=a.querySelector(".smart-grid-panel-apply-button");a.$.applyButton=o,o.classList.add("smart-disabled"),a.$.itemsContainer.innerHTML=`<style>\n .smart-ai-tabs {\n display: flex;\n align-items: baseline;\n border-bottom: 1px solid var(--smart-border-color);\n font-family: var(--smart-font-family);\n }\n\n .smart-ai-tab {\n padding: 4px 6px;\n cursor: pointer;\n display: flex;\n color: var(--smart-background-color);\n transition: color 0.2s, border-color 0.2s;\n border-bottom: 2px solid transparent;\n }\n\n .smart-ai-tab:hover {\n color: var(--smart-ui-state-color-hover);\n }\n\n .smart-ai-tab.active {\n color: var(--smart-primary);\n border-bottom-color: var(--smart-primary);\n font-weight: 600;\n }\n\n .smart-ai-response {\n min-height: 80px;\n padding: 10px;\n margin-top: 10px;\n width: 360px;\n user-select: text;\n border-radius: var(--smart-border-radius);\n border: 1px solid var(--smart-border);\n }\n\n </style><div class="smart-ai-tabs">\n <div class="smart-ai-tab active" data-tab="add-filter">\n ${t.localize("addAIFilter")}\n </div>\n <div class="smart-ai-tab" data-tab="response">\n <span class="smart-grid-icon show smart-icon-comment"></span> ${t.localize("aiResponse")}\n </div>\n </div>\n <div class="smart-hidden smart-ai-response">\n ${t.localize("noAIResponse")}\n </div>\n `,a.$.itemsContainer.style.paddingTop="0px",a.$.aiResponse=a.$.itemsContainer.querySelector(".smart-ai-response"),a.$.itemsContainer.querySelectorAll(".smart-ai-tab").forEach((e=>{e.addEventListener("click",(()=>{a.$.itemsContainer.querySelectorAll(".smart-ai-tab").forEach((e=>e.classList.remove("active"))),e.classList.add("active"),"add-filter"===e.getAttribute("data-tab")?(a.$.addFilterButton.classList.remove("smart-hidden"),a.$.aiPrompt.classList.remove("smart-hidden"),a.$.aiResponse.classList.add("smart-hidden")):(a.$.addFilterButton.classList.add("smart-hidden"),a.$.aiPrompt.classList.add("smart-hidden"),a.$.aiResponse.classList.remove("smart-hidden"))}))}))}e._openHeaderDropDown(e.$.aiButton),e._closeDownloadMenu(),e._closeViewsMenu(),e._closeResourceMenu(),e._closeLabelMenu(),e._closeColorMenu(),e._closeFontSizeMenu(),e._closeFontFamilyMenu(),t.closeMenu();const o=e.$.headerDropDown.querySelector("smart-grid-ai-panel");if(o&&t.ai&&t.ai.key){o.$.addAIFilterButton.classList.remove("smart-hidden"),o.$.aiPrompt.classList.add("smart-hidden"),o.$.aiPrompt.placeholder=t.localize("aiPrompt"),o.$.aiPrompt.classList.toggle("smart-hidden"),o.$.spinner.classList.remove("smart-hidden"),o.$.aiPrompt.focus(),o.$.aiPrompt.maxRows=5,o.$.aiPrompt.style.minHeight="80px",o.$.aiPrompt.style.resize="none",o.$.aiPrompt.parentElement.style.display="flex",o.$.aiPrompt.parentElement.style.flexDirection="column";const a=t.ai.prompts||[];if(t.ai.includeUserPrompts&&t.ai.userPrompts)for(let e=0;e<t.ai.userPrompts.length;e++){const o=t.ai.userPrompts[e];-1===a.indexOf(o)&&a.unshift(o)}const s=o.$.aiPrompt,n=o.$.suggestions;s.onpointerdown=()=>{e._dropDownCloseDate=new Date},s.onselectionchange=()=>{e._dropDownCloseDate=new Date},n.innerHTML='<style>\n .smart-ai-suggestion {\n padding: 6px 10px;\n border-bottom: 1px solid var(--smart-border-color);\n cursor: pointer;\n max-width: 360px;\n }\n .smart-ai-suggestion:hover {\n background-color: var(--smart-ui-state-hover);\n }\n .smart-ai-suggestions-container {\n max-height: 200px;\n overflow-y: auto;\n border: 1px solid var(--smart-border-color);\n border-radius: var(--smart-border-radius);\n margin-top: 5px;\n }\n </style>\n <div class="smart-ai-suggestions-container">\n \n </div>';const i=n.querySelector(".smart-ai-suggestions-container");a.forEach((e=>{const t=document.createElement("div");t.classList.add("smart-ai-suggestion"),t.innerText=e,t.onclick=()=>{s.value=e,i.classList.add("smart-hidden"),s.focus()},i.appendChild(t)})),s.oninput=()=>{s.value.length>0?i.classList.add("smart-hidden"):i.classList.remove("smart-hidden")},o.$.addFilterButton.onclick=()=>{let a=0;o.$.spinner.classList.remove("smart-hidden");const s=setInterval((()=>{o.$.spinner.innerHTML=`\rThinking${".".repeat(a%4)} `,a++}),500);let n='\nYou are a helpful assistant that converts natural language data manipulation requests\ninto structured JSON instructions for Smart.Grid AND produces a detailed, user-friendly explanation.\n\nImportant:\nThe JSON you produce represents actions that will be applied ONLY AFTER the user clicks "Apply".\nTherefore, all natural-language explanations must describe what *will happen* once the user applies the changes.\nDo not describe the action as already completed.\n\nUse only these columns:\n';for(let t=0;t<e.columns.length;t++){const a=e.columns[t];(a.allowFilter||a.allowSort||a.allowGroup||a.allowFormat)&&(n+="- "+a.label+" ("+a.dataType+") => "+a.dataField+"\\n")}const i=t.getSelection();let r=i.rows||[],l=i.columns||[],d=i.cells||[];d&&(d=d.map((e=>({row:e.row.id,column:e.column.label,value:e.row.data[e.dataField]})))),r&&(r=r.map((e=>e.id))),l&&(l=l.map((e=>t.columnByDataField[e].label)));let c={};t.getColumnStatistics=e=>{const a=t.getData().map((t=>t[e])).filter((e=>null!=e&&""!==e));if(0===a.length)return{};const o=a.filter((e=>"number"==typeof e)),s={count:a.length,uniqueCount:new Set(a).size};if(o.length>0){const e=o.reduce(((e,t)=>e+t),0),t=e/o.length,a=Math.min(...o),n=Math.max(...o);s.sum=e,s.average=t,s.min=a,s.max=n,s.range=n-a}return s};let u={};for(let a=0;a<e.columns.length;a++){const o=e.columns[a],s=t.getColumnStatistics(o.dataField);c[o.label]=s,o.options&&Array.isArray(o.options)&&(u[o.label]=o.options.map((e=>"object"==typeof e&&null!==e?void 0!==e.label?e.label:e.value:e)))}const m=t._rowElements.filter((e=>!e.classList.contains("smart-hidden"))).map((e=>e.row.data)).map((t=>{const a={};for(let o=0;o<e.columns.length;o++){const s=e.columns[o];a[s.label]=t[s.dataField]}return a}));n+=`\n visibleRows: ${JSON.stringify(m)}\n datasetStats: ${JSON.stringify(c)}\n columnOptions: ${JSON.stringify(u)}\n CurrentSelection: rows: ${JSON.stringify(r)}, columns: ${JSON.stringify(l)}, cells: ${JSON.stringify(d)}\n\n If datasetStats lacks the required numbers for a requested metric, the assistant MUST exclude that metric rather than invent numbers.\n\nThe user may request any combination of the following actions: filtering, sorting, grouping, conditional formatting, editing or summarization.`,n+='\nSupported filter operators:\n CONTAINS, EQUAL, NOT_EQUAL, GREATER_THAN, LESS_THAN,\n GREATER_THAN_OR_EQUAL, LESS_THAN_OR_EQUAL, STARTS_WITH, ENDS_WITH\n\nRespond in this format for Filtering\n[\n {\n "field": "dataField",\n "operator": "some operator",\n "value": "some value",\n "type": "some type",\n "logic": "AND }\n]\nWhen the user requests to clear or remove or delete the Filtering\nRespond in this format for Filtering\n[\n {\n "field": null,\n "operator": "null,\n "value": null,\n "type": null,\n "logic": null\n }\n]\nSupported types:\n string, number, date, boolean\n\nThe assistant MUST understand and support operations on the user\'s current selection.\nA selection may include rows, columns, or specific cells.\n\nEDIT RULE: \nSupported edit actions include:\n- fill_empty: Fill empty cells using a source (e.g., from selection, constant value, or text).\n- translate: Translate text in the selected cells or columns.\n- replace_values: Replace or modify values inside the selection or target columns.\n- transform_text: Apply transformations such as uppercase, lowercase, trim, etc.\n\nThe assistant MUST check columnOptions when performing edit actions to ensure the requested action is allowed on the target column(s).\n\nOPTION-CONSTRAINT RULE FOR EDITING:\nSome columns contain restricted, predefined allowed values (options list).\n\nWhen performing an edit action (fill_empty, translate, replace_values, transform_text):\n- The assistant MUST verify that the target value is one of the allowed options if the column contains predefined options.\n- The assistant MUST NOT write a value that does not exist in the options list.\n- The assistant MUST NOT invent new options.\n- If a requested value is not part of the options list, the assistant MUST reply in HTML to request clarification rather than performing the edit.\n\n\nWhen the user requests an action involving selected cells, the assistant MUST include \nthe appropriate "edit" instructions in the JSON.\n\nWhen the user requests an edit action (fill, translate, replace, transform), the assistant MUST compute the actual resulting values for the affected cells using the visible data or selection provided.\nThe assistant MUST place these computed results inside the edit object.\nThe assistant MUST NOT output formulas, instructions, or placeholders. Only the final, edited values are allowed.\n\nRespond in this format for Editing\n[\n {\n "field": "dataField",\n "row": "some row id",\n "oldValue": "some old value",\n "value": "some value",\n "type": "some type",\n "editAction": "fill_empty/translate/replace_values/transform_text }\n]\n\nSORT RULE:\nWhen the user requests sorting (“sort by”, “order by”, etc.):\nRespond in this format for Sorting\n[\n {\n "field": "dataField",\n "order": "asc/desc"\n }\n]\nWhen the user requests to clear or remove or delete the sorting\nRespond in this format for Sorting\n[\n {\n "field": null,\n "order": null\n }\n]\nGROUP RULE:\nWhen the user requests grouping (“group by”, “categorize by”, etc.):\nRespond in this format for Grouping\n[\n {\n "field": "dataField"\n }\n]\nWhen the user requests to clear or remove or delete the grouping\nRespond in this format for Grouping\n[\n {\n "field": null\n }\n]\nFORMAT RULE (STRICT):\n\nWhen the user requests conditional formatting (“highlight”, “color code”, “format”, etc.):\nYou MUST respond ONLY in this exact JSON structure:\n\n[\n {\n "field": "dataField",\n "condition": "=/<>/<=/>=/</>/between",\n "value": "STRING or NUMBER or DATE or BOOLEAN",\n "background": "some color",\n "color": "some color",\n "textDecoration": "none" or "underline" or "line-through",\n }\n]\n\nif the user requests formatting for a RANGE of values (e.g., "between 10 and 20"):\nYou MUST add condition2 and value2 keys to the JSON structure like this:\n\n[\n {\n "field": "dataField",\n "condition": "between",\n "value": "lower bound STRING or NUMBER or DATE or BOOLEAN",\n "value2": "upper bound STRING or NUMBER or DATE or BOOLEAN",\n "background": "some color",\n "color": "some color",\n "textDecoration": "none" or "underline" or "line-through",\n }\n]\n\nCLEARING FORMATTING:\nWhen the user requests to clear, remove, or delete formatting:\nYou MUST respond ONLY in this structure:\n\n[\n {\n "field": null,\n "condition": "=",\n "value": "",\n "background": null,\n "color": null,\n "textDecoration": null,\n }\n]\n\nADDITIONAL STRICT RULES:\n- Do NOT add extra keys.\n- Do NOT omit required keys.\n- Do NOT output explanations, text, or comments — ONLY the JSON.\n- “condition” MUST be one of: =, <>, <, <=, >, >=.\n- “value” MUST be a STRING, NUMBER, DATE, or BOOLEAN literal.\n- Colors MUST be written as strings.\n\nSUMMARY RULE:\nWhen the user requests a summary (“give me a summary”, “summarize my data”,\n“show totals/averages/count”, etc.):\n\n1. You MUST compute actual numeric results using datasetStats and/or selection.\n - Place these results inside the "summary" JSON object.\n - NEVER output formulas or operations.\n\n2. You MUST generate a full natural-language summary report in the "message" field.\n The report MUST:\n - Use PRESENT TENSE (because summary is computed immediately).\n - Describe totals, averages, minimums, maximums, counts, and ranges.\n - Highlight notable patterns IF AND ONLY IF the stats allow it.\n - Be narrative, readable, and helpful.\n - NOT hallucinate any values not present in datasetStats or selection.\n\nYour task:\nConvert user requests about filtering, sorting, grouping, conditional formatting, editing, \nor summarization into a structured JSON format AND produce a verbose, friendly explanation.\n\nRespond ONLY in this structure:\n\n{\n "json": {\n "filters": [...],\n "sort": [...],\n "group": [...],\n "format": [...],\n "summary": {},\n "edit": []\n },\n "message": "A detailed explanation using FUTURE TENSE, describing what the changes will do once applied. The mssage should be in HTML Format. The explanation MUST be a well-structured HTML message with short paragraphs and bullet points when appropriate. It MUST NOT exceed 200 words unless summarization requires more"\n}\n\nGuidelines for the natural-language \'message\':\n- Use future tense: “will filter”, “will highlight”, “will sort”, etc.\n- Summary results are computed immediately and DO NOT depend on the Apply button.\n Therefore, the explanation for summaries may use PRESENT TENSE (e.g., “The total is 2300”).\n- Do NOT imply the action has already happened.\n- Explain clearly what the user should expect AFTER applying the settings.\n- Be helpful, descriptive, and user-friendly.\n- Avoid referencing JSON or internal logic.\n\nThe assistant MUST NOT invent additional JSON keys or structures.\nIf the user requests an unsupported action, the assistant MUST politely decline.\n\nIf the user request is ambiguous, the assistant MUST reply with a polite clarifying question\ninstead of guessing the action.\n\nIf the user asks a general question, tutorial question, or conceptual question that does NOT request\nfiltering, sorting, grouping, conditional formatting, editing, or summarization,\nthe assistant MUST NOT generate JSON.\n\nInstead, the assistant MUST reply with a natural-language explanation in HTML format.\n\nIf the user asks for help, instructions, or examples, the assistant MUST NOT perform actions.\nThe assistant MUST explain concepts in HTML using concise, user-friendly language.\n',t.ai.getAIResponse=async function(e,a){const o=t.ai.key,s=t.ai.url||"https://api.openai.com/v1/chat/completions",n={"Content-Type":"application/json",Authorization:`Bearer ${o}`},i={model:t.ai.model||"gpt-3.5-turbo",messages:[{role:"system",content:e},{role:"user",content:a}],temperature:.7,max_tokens:1e3},r=await fetch(s,{method:"POST",headers:n,body:JSON.stringify(i)});return(await r.json()).choices[0].message.content};try{t.ai.getAIResponse(n,o.$.aiPrompt.value).then((e=>{let a,n=t.localize("noAIResponse");try{const t=e.indexOf("{");a=JSON.parse(e.substring(t)),a.message&&(n=a.message)}catch(e){a={filters:[]}}if(o.$.aiResponse.innerHTML=n,o.$.spinner.innerHTML="",o.$.spinner.classList.add("smart-hidden"),clearInterval(s),o.$.itemsContainer.querySelector('.smart-ai-tab[data-tab="response"]').click(),a.json){const e=a.json.filters,t=a.json.sort,s=a.json.group,n=a.json.format,i=a.json.summary,r=a.json.edit;o.getAIInstructions=()=>({filters:e||[],sort:t||[],group:s||[],format:n||[],summary:i||{},edit:r||[]}),o.$.applyButton.classList.remove("smart-disabled")}}))}catch(e){o.$.spinner.innerHTML=t.localize("noResults"),clearInterval(s)}},o.$.applyButton.onclick=()=>{o.$.applyButton.classList.contains("smart-disabled")||e._applyAI()}}}_refreshGroupButton(){const e=this,t=e._appliedGrouping.dataFields?e._appliedGrouping.dataFields.length:0;if(e.grid&&"kanban"===e.grid.view){e.$.groupButton.onclick=()=>{"kanban"===e.grid.view&&e.grid._initKanbanView("dynamic","kanban")};const t=e.grid.columnByDataField[e.grid._stackedBy];return t?(e.$.groupButton.firstElementChild.innerHTML=e.localize("groupedBy",{column:t.label}),e.$.groupButton.classList.add("grouped")):e.$.groupButton.classList.remove("grouped"),void e.$.groupButton.classList.remove("scheduler")}if(!e.grid||"scheduler"!==e.grid.view&&"timeline"!==e.grid.view){if(0===t){const t=e.localize("group");return e.$.groupButton.firstElementChild.innerHTML!==t&&(e.$.groupButton.firstElementChild.innerHTML=t),void e.$.groupButton.classList.remove("grouped")}e.$.groupButton.firstElementChild.innerHTML=1===t?e.localize("groupedByOne"):e.localize("groupedByMultiple",{n:t}),e.$.groupButton.classList.add("grouped")}else if(e.$.groupButton.onclick=()=>{"scheduler"!==e.grid.view&&"timeline"!==e.grid.view||e.grid._createScheduler("update")},e.grid._dateStackedBy&&Array.isArray(e.grid._dateStackedBy)){const t=e.grid.columnByDataField[e.grid._dateStackedBy[0]].label,a=e.grid.columnByDataField[e.grid._dateStackedBy[1]].label;e.$.groupButton.firstElementChild.innerHTML=e.localize("schedulerToolLabel",{column:t+"-"+a}),e.$.groupButton.classList.add("scheduler"),e.$.groupButton.classList.add("grouped")}else{const t=e.grid.columnByDataField[e.grid._dateStackedBy];t?(e.$.groupButton.firstElementChild.innerHTML=e.localize("schedulerToolLabel",{column:t.label}),e.$.groupButton.classList.add("scheduler"),e.$.groupButton.classList.add("grouped")):e.$.groupButton.classList.remove("grouped")}}openSearchPanel(){this._openSearchPanel()}_closeSearchPanel(){this._search(this.$.searchInput.value,!1),super._closeSearchPanel()}_openSearchPanel(){const e=this,t=e.grid;if(e.$.headerDropDown.classList.add("search-panel"),e.$.headerDropDown.classList.remove("view-panel","colors-panel","customize-panel","filter-panel","sort-panel","group-panel","format-panel"),e.$.search.classList.remove("smart-hidden"),e.$.customize.classList.add("smart-hidden"),e.$.group.classList.add("smart-hidden"),e.$.filter.classList.add("smart-hidden"),e.$.sort.classList.add("smart-hidden"),e.$.colors.classList.add("smart-hidden"),e.$.format.classList.add("smart-hidden"),e.$.view.classList.add("smart-hidden"),e.$.ai.classList.add("smart-hidden"),e._openHeaderDropDown(e.$.searchButton),e._closeDownloadMenu(),e._closeViewsMenu(),e._closeResourceMenu(),e._closeLabelMenu(),e._closeColorMenu(),e._closeFontSizeMenu(),e._closeFontFamilyMenu(),t.closeMenu(),"filter"===t.header.searchCommand){const t=e.$.headerDropDown.querySelector(".smart-data-view-search-prev"),a=e.$.headerDropDown.querySelector(".smart-data-view-search-next");t.classList.add("smart-hidden"),a.classList.add("smart-hidden")}const a=[],o=t.getVisibleRows();for(let e=0;e<o.length;e++)a.push(Object.assign(o[e].data));const s=new Smart.DataAdapter({id:"id",observable:!1,dataSource:a,dataFields:t.dataSource.dataFields});e._searchInfo={source:s,stringDataFields:e.dataSource.dataFields.filter((e=>"string"===e.dataType)).map((e=>e.name))},""!==e.$.searchInput.value&&e._search(e.$.searchInput.value,!1)}addColors(e,t,a){const o=this,s=o.grid;let n=[e,t],i=[];if(o.closePanel(),JSON.stringify(n)===JSON.stringify(o._appliedColors))return;o._appliedColors=n;const r=[],l=o.grid.getRows();for(let e=0;e<l.length;e++)r.push(Object.assign(l[e].data));if("conditions"===t.type){const t=new Smart.DataAdapter({id:"id",observable:!1,dataSource:r,dataFields:o.grid.dataSource.dataFields});t._filter(a,"or");const n=[];for(let e=0;e<t.length;e++){const a=t[e];!1!==a.$.filtered&&n.push(a)}const l=e,d=[];for(let e=0;e<l.length;e++){const t=l[e],a=t[0],o=t[1],n=t[3]?t[2]:void 0,i=t[3]?t[3]:t[2],r=s.columnByDataField[a].dataType,c=new Smart.Utilities.FilterGroup,u=c.createFilter(r,n,o);c.addFilter("or",u),d.push({dataField:a,color:i,filterGroup:c})}for(let e=0;e<n.length;e++){const t=n[e];for(let e=0;e<d.length;e++){const a=d[e].dataField,o=d[e].filterGroup,s=d[e].color,n=t[a];o.evaluate(n)&&(void 0===i[t.$.id]&&(i[t.$.id]={}),i[t.$.id].color=s,i[t.$.id][a]=s)}}}else{const e=t.singleSelect,a=s.columnByDataField[e];if(!a)return s._conditionalColors={colors:[],type:t.type,conditions:[],update:e=>{o._updateConditionalColors(e,s,t)},singleSelect:t.singleSelect,decorate:t.decorate},s._recycle(),o._refreshColorsButton(),void(s._onColors&&s._onColors(s._conditionalColors));const n="collaborator"===a.template?s.users:a.editor.dataSource,r={};n.forEach((e=>"collaborator"===a.template?(void 0===e.id||(r[e.id]=e.color),!0):!e.value||void(r[e.value]=e.color)));for(let t=0;t<l.length;t++){const a=l[t].data,o=a[e],s=r[o];s&&(i[a.$.id]={color:s})}}s._conditionalColors={colors:i,type:t.type,conditions:e,update:e=>{o._updateConditionalColors(e,s,t)},singleSelect:t.singleSelect,decorate:t.decorate},s._recycle(!1),o._refreshColorsButton(),s.autoSaveState(),o.$.fireEvent("colors"),s._onColors&&s._onColors(s._conditionalColors)}_updateConditionalColors(e,t,a){let o=[];const s=t.getRows();if("conditions"===a.type){const a=t._conditionalColors.conditions,n=[];for(let e=0;e<a.length;e++){const o=a[e],s=o[0],i=o[1],r=o[3]?o[2]:void 0,l=o[3]?o[3]:o[2],d=t.columnByDataField[s];if(d){const e=d.dataType,t=new Smart.Utilities.FilterGroup,a=t.createFilter(e,r,i);t.addFilter("or",a),n.push({dataField:s,color:l,filterGroup:t})}}const i=e=>{for(let t=0;t<n.length;t++){const a=n[t].dataField,s=n[t].filterGroup,i=n[t].color,r=e[a];s.evaluate(r)?(void 0===o[e.$.id]&&(o[e.$.id]={}),o[e.$.id].color=i,o[e.$.id][a]=i):delete o[e.$.id]}};if(e)o=t._conditionalColors.colors,i(e.data);else for(let e=0;e<s.length;e++)i(s[e].data)}else{const n=a.singleSelect,i=t.columnByDataField[n];if(i){const a="collaborator"===i.template?t.users:i.editor.dataSource,r={};if(a.forEach((e=>"collaborator"===i.template?(void 0===e.id||(r[e.id]=e.color),!0):!e.value||void(r[e.value]=e.color))),e){o=t._conditionalColors.colors,o||(o=t._conditionalColors.colors=[]);const a=e.data,s=a[n],i=r[s];i?o[a.$.id]={color:i}:delete o[a.$.id]}else for(let e=0;e<s.length;e++){const t=s[e].data,a=t[n],i=r[a];i&&(o[t.$.id]={color:i})}}}t._conditionalColors.colors=o,t.autoSaveState(),t.summaryRow.visible||t._recycle(!1)}_search(e,t=!0){const a=this;if(!a._searchInfo)return;if(a._searchInfo.query=e,""===e)return a.$.search.classList.remove("matches","no-matches"),delete a._searchInfo.foundIdsArray,delete a._searchInfo.foundIdsObject,delete a._searchInfo.highlighted,a.grid.highlighted=null,a.grid._recycle(!1),void("filter"===a.grid.header.searchCommand&&a.grid.clearFilter());const o=a._searchInfo.source,s=[],n=[],i={};a._searchInfo.stringDataFields.forEach((t=>{const a=new Smart.Utilities.FilterGroup,o=a.createFilter("string",e,"CONTAINS");a.addFilter("or",o),s.push([t,a])})),o._filter(s,"or");for(let e=0;e<o.length;e++){const t=o[e];!1!==t.$.filtered&&(n.push(t.$.id),i[t.$.id]=!0)}if(a._searchInfo.foundIdsArray=n,a._searchInfo.foundIdsObject=i,a.grid.highlighted=null,"filter"===a.grid.header.searchCommand){a.grid.beginUpdate();const t=a.grid.filtering.operator;return a.grid.filtering.operator="or",a.grid.clearFilter(),a._searchInfo.stringDataFields.forEach((t=>{const o=new Smart.Utilities.FilterGroup,s=o.createFilter("string",e,"CONTAINS"),n=a.grid.columnByDataField[t];if(n&&n.editor&&n.editor.dataSource)return!1;n&&(o.addFilter("or",s),a.grid.addFilter(t,o),n._filterInfo&&n.filter.filters[0]&&(n._filterInfo.value=n.filter.filters[0].value,n._filterInfo.condition=n.filter.filters[0].condition))})),a.grid.endUpdate(),a.grid.refreshFilters(),void(a.grid.filtering.operator=t)}if(n.length>0)return a.$.search.classList.remove("no-matches"),a.$.search.classList.add("matches"),a.$.searchLabel.innerHTML=a.localize("found",{nth:t?1:0,n:n.length}),a._searchInfo.highlighted||(a._searchInfo.highlighted=n[0]),a.grid.highlighted=a._searchInfo.highlighted,a.grid.ensureVisible(a._searchInfo.highlighted),void a.grid._recycle(!1);a.$.search.classList.remove("matches"),a.$.search.classList.add("no-matches"),a.$.searchLabel.innerHTML=a.localize("found",{nth:0,n:0})}isGrid(){const e=this.grid;return!(e&&("kanban"===e.view&&e._kanban||"scheduler"===e.view&&e._scheduler||"timeline"===e.view&&e._scheduler))}_refreshColorsButton(){const e=this,t=e.grid;let a=0;if(a=t._conditionalColors&&t._conditionalColors.conditions?Object.keys(t._conditionalColors.conditions).length:0,t._conditionalColors&&"singleSelect"===t._conditionalColors.type){a=1;const o=t.columnByDataField[t._conditionalColors.singleSelect];return o?(e.$.colorsButton.innerHTML='<div class="smart-tool-label" role="presentation">'+t.localize("formatingBy",{value:o.label})+"</div>",e.$.colorsButton.classList.add("hidden"),e.$.colorsButton.classList.add("formatted"),void e._refreshMobileViewTools()):(e.$.colorsButton.innerHTML='<div class="smart-tool-label" role="presentation">'+t.localize("formating")+"</div>",e.$.colorsButton.classList.remove("hidden"),void e.$.colorsButton.classList.remove("formatted"))}a>0?(e.$.colorsButton.innerHTML=1===a?'<div class="smart-tool-label" role="presentation">'+t.localize("formatingOne",{n:a})+"</div>":'<div class="smart-tool-label" role="presentation">'+t.localize("formatingByMultiple",{n:a})+"</div>",e.$.colorsButton.classList.add("hidden"),e.$.colorsButton.classList.add("formatted")):(e.$.colorsButton.innerHTML='<div class="smart-tool-label" role="presentation">'+t.localize("formating")+"</div>",e.$.colorsButton.classList.remove("hidden"),e.$.colorsButton.classList.remove("formatted")),e._refreshMobileViewTools()}_refreshCustomizeButton(){const e=this,t=e.grid;let a=0;if(!e.isGrid())return t._kanban&&t._kanban.localize&&(e.$.customizeButton.innerHTML='<div class="smart-tool-label" role="presentation">'+t._kanban.localize("customize")+"</div>",e.$.customizeButton.classList.remove("hidden")),void e.$.customizeButton.classList.add("smart-hidden");for(let e=0;e<t.columns.length;e++){const o=t.columns[e];o&&(o.autoGenerated||!1!==o._visible&&(t.grouping&&t.grouping.autoHideGroupColumn&&t.dataSource.groupBy.indexOf(o.dataField)>=0||o.visible||a++))}a>0?(e.$.customizeButton.innerHTML=1===a?'<div class="smart-tool-label" role="presentation">'+t.localize("customizeOne",{n:a})+"</div>":'<div class="smart-tool-label" role="presentation">'+t.localize("customizeHidden",{n:a})+"</div>",e.$.customizeButton.classList.add("hidden")):(e.$.customizeButton.innerHTML='<div class="smart-tool-label" role="presentation">'+t.localize("customize")+"</div>",e.$.customizeButton.classList.remove("hidden")),e._refreshMobileViewTools()}_applyColumns(e,t){const a=this,o=a.grid;o.beginUpdate();let s=0,n=[],i=[],r=[];const l=o.onColumnChange;o.onColumnChange=null;for(let t in e){const a=e[t],l=o.columnByDataField[a.dataField];l&&(l.visible!==a.visible&&(n.push(a),i.push(l.visible),r.push(a.visible)),l.visible=a.visible,a.visible||s++)}o.onColumnChange=l,o.onColumnChange?o.onColumnChange(n,"visible",i,r):o.$.fireEvent("columnChange",{column:n,propertyName:"visible",oldValue:i,value:r}),s>0?(a.$.customizeButton.innerHTML='<div class="smart-tool-label" role="presentation">'+o.localize("customizeHidden",{n:s})+"</div>",a.$.customizeButton.classList.add("hidden")):(a.$.customizeButton.innerHTML='<div class="smart-tool-label" role="presentation">'+o.localize("customize")+"</div>",a.$.customizeButton.classList.remove("hidden"));for(let e=0;e<t.length;e++){const a=t[e],s=a.oldIndex,n=a.newIndex,i=o.columns[n+1],r=o.columns[n-1],l=o.columns[s];i?l.columnGroup=i.columnGroup:r&&(l.columnGroup=r.columnGroup),o.reorderColumns(s,n,!0)}if(o.filtering.enabled&&o.filtering.filterRow)for(let e=0;e<o.columns.length;e++)o.columns[e]._filterEditorInitialized=!1;o.endUpdate();const d=o.grouping.enabled;d&&o._filters&&o.refreshFilters(d),o.autoSaveState()}});
1540
+ Smart("smart-grid-toolbar",class extends Smart.DataView{template(){return'<div id="container" role="presentation">\n <div id="header" class="smart-data-view-header" role="toolbar">\n <div id="viewStatesButton" class="smart-data-view-header-button smart-data-view-states-button smart-unselectable" role="button" aria-expanded="false" aria-haspopup="dialog" aria-label="ViewStates"><div class="smart-tool-label" role="presentation"></div></div>\n <div id="viewsButton" class="smart-data-view-header-button smart-data-view-views-button smart-unselectable" role="button" aria-expanded="false" aria-haspopup="dialog" aria-label="Views"><div class="smart-tool-label" role="presentation"></div></div>\n <div id="customizeButton" class="smart-data-view-header-button smart-data-view-customize-button smart-unselectable" role="button" aria-expanded="false" aria-haspopup="dialog" aria-label="Customize cards"><div class="smart-tool-label" role="presentation"></div></div>\n <div id="filterButton" class="smart-data-view-header-button smart-data-view-filter-button smart-unselectable" role="button" aria-expanded="false" aria-haspopup="dialog" aria-label="Filter"><div class="smart-tool-label" role="presentation"></div></div>\n <div id="sortButton" class="smart-data-view-header-button smart-data-view-sort-button smart-unselectable" role="button" aria-expanded="false" aria-haspopup="dialog" aria-label="Sort"><div class="smart-tool-label" role="presentation"></div></div>\n <div id="groupButton" class="smart-data-view-header-button smart-data-view-group-button smart-unselectable" role="button" aria-expanded="false" aria-haspopup="dialog" aria-label="Group"><div class="smart-tool-label" role="presentation"></div></div>\n <div id="aiButton" class="smart-data-view-header-button smart-data-view-ai-button smart-unselectable" role="button" aria-expanded="false" aria-haspopup="dialog" aria-label="ai"></div>\n <div id="resourceButton" class="smart-data-view-header-button smart-data-view-resource-button smart-unselectable" role="button" aria-expanded="false" aria-haspopup="dialog" aria-label="Resource"><div class="smart-tool-label" role="presentation"></div></div>\n <div id="labelButton" class="smart-data-view-header-button smart-data-view-label-button smart-unselectable" role="button" aria-expanded="false" aria-haspopup="dialog" aria-label="Lael"><div class="smart-tool-label" role="presentation"></div></div>\n <div id="formatButton" class="smart-data-view-header-button smart-data-view-format-button smart-unselectable" role="button" aria-expanded="false" aria-haspopup="dialog" aria-label="Format"><div class="smart-tool-label" role="presentation"></div></div>\n <div id="colorsButton" class="smart-data-view-header-button smart-data-view-colors-button smart-unselectable" role="button" aria-expanded="false" aria-haspopup="dialog" aria-label="Colors"><div class="smart-tool-label" role="presentation"></div></div>\n <div id="deleteButton" class="smart-data-view-header-button smart-data-view-delete-button smart-unselectable" role="button" aria-expanded="false" aria-haspopup="dialog" aria-label="Delete"><div class="smart-tool-label" role="presentation"></div></div>\n <div id="customButton" class="smart-data-view-header-button smart-data-view-custom-button smart-unselectable" role="button" aria-expanded="false" aria-haspopup="dialog" aria-label="Custom"><div class="smart-tool-label" role="presentation"></div></div>\n <div id="downloadButton" class="smart-data-view-header-button smart-data-view-download-button smart-unselectable" role="button" aria-expanded="false" aria-haspopup="dialog" aria-label="Download"><div class="smart-tool-label" role="presentation"></div></div>\n <div id="boldButton" class="smart-data-view-header-button smart-data-view-bold-button smart-unselectable" role="button" aria-expanded="false" aria-haspopup="dialog" aria-label="Bold"><div class="smart-tool-label" role="presentation"></div></div>\n <div id="italicButton" class="smart-data-view-header-button smart-data-view-italic-button smart-unselectable"\n role="button" aria-expanded="false" aria-haspopup="dialog" aria-label="Italic">\n <div class="smart-tool-label" role="presentation"></div>\n </div>\n <div id="underlineButton" class="smart-data-view-header-button smart-data-view-underline-button smart-unselectable"\n role="button" aria-expanded="false" aria-haspopup="dialog" aria-label="Underline">\n <div class="smart-tool-label" role="presentation"></div>\n </div>\n <div id="strikethroughButton" class="smart-data-view-header-button smart-data-view-strikethrough-button smart-unselectable"\n role="button" aria-expanded="false" aria-haspopup="dialog" aria-label="Strikethrough">\n <div class="smart-tool-label" role="presentation"></div>\n </div>\n <div id="fontFamilyButton" class="smart-data-view-header-button smart-data-view-fontfamily-button smart-unselectable"\n role="button" aria-expanded="false" aria-haspopup="dialog" aria-label="Font Family">\n <div class="smart-tool-label" role="presentation"></div>\n </div>\n <div id="fontSizeButton" class="smart-data-view-header-button smart-data-view-fontsize-button smart-unselectable"\n role="button" aria-expanded="false" aria-haspopup="dialog" aria-label="Font Size">\n <div class="smart-tool-label" role="presentation"></div>\n </div>\n <div id="backgroundButton" class="smart-data-view-header-button smart-data-view-background-button smart-unselectable"\n role="button" aria-expanded="false" aria-haspopup="dialog" aria-label="Background">\n <div class="smart-tool-label" role="presentation"></div>\n </div>\n <div id="colorButton" class="smart-data-view-header-button smart-data-view-textcolor-button smart-unselectable"\n role="button" aria-expanded="false" aria-haspopup="dialog" aria-label="Text Color">\n <div class="smart-tool-label" role="presentation"></div>\n </div>\n <div id="searchButton" class="smart-data-view-header-button smart-data-view-search-button smart-unselectable" role="button" aria-expanded="false" aria-haspopup="dialog" aria-label="Search"></div>\n <div id="headerDropDown" owner class="smart-data-view-header-drop-down smart-visibility-hidden" role="dialog">\n <div id="view" class="smart-hidden" role="presentation"></div>\n <div id="customize" class="smart-hidden" role="presentation"></div>\n <div id="filter" class="smart-hidden" role="presentation"></div>\n <div id="sort" class="smart-hidden" role="presentation"></div>\n <div id="ai" class="smart-hidden" role="presentation"></div>\n <div id="group" class="smart-hidden" role="presentation"></div>\n <div id="format" class="smart-hidden" role="presentation"></div>\n <div id="colors" class="smart-hidden" role="presentation"></div>\n <div id="search" class="smart-data-view-search-box smart-hidden" role="presentation">\n <input type="text" id="searchInput" spellcheck="false" aria-label="Search" />\n <div id="searchLabel" class="smart-data-view-search-label smart-unselectable"></div>\n <div id="searchPrev" class="smart-data-view-search-prev" role="button" aria-label="Previous"></div>\n <div id="searchNext" class="smart-data-view-search-next" role="button" aria-label="Next"></div>\n <div id="searchClose" class="smart-data-view-search-close" role="button" aria-label="Close search box"></div>\n </div>\n </div>\n </div>\n </div>'}_refreshMobileViewTools(){const e=this;e.grid.offsetWidth<600?e.querySelectorAll(".smart-tool-label").forEach((e=>{e.classList.add("smart-hidden"),e.parentNode.classList.add("mobile")})):e.querySelectorAll(".smart-tool-label").forEach((e=>{e.classList.remove("smart-hidden"),e.parentNode.classList.remove("mobile")}))}refreshTools(){const e=this;if(e.isRendered&&e.grid&&(e._refreshMobileViewTools(),e.refreshHeaderDropDownPosition(),e.grid)){const t=e.grid;if(t.dataSource&&t.dataSource.boundSource){const a=t.dataSource&&t.dataSource.virtualDataSource&&!t.dataSource.virtualDataSourceOnExpand&&t.dataSource.length>t.virtualModeCachedRowsCount&&"infinite"!==t.scrolling;if(e.dataSource&&t.dataSource&&e.dataSource.length!==t.dataSource.length||a)if(a){const a=Array.isArray(t.dataSource.boundSource)?t.dataSource.boundSource:t.dataSource.boundSource.toArray();e.dataSource=new Smart.DataAdapter({observable:!1,dataSource:[...a],dataFields:t.dataSource.dataFields})}else e.dataSource=t.dataSource;const o=t=>{const a=t?"add":"remove";e.$.filterButton.classList[a]("smart-disabled"),e.$.sortButton.classList[a]("smart-disabled"),e.$.groupButton.classList[a]("smart-disabled"),e.$.formatButton.classList[a]("smart-disabled"),e.$.colorsButton.classList[a]("smart-disabled"),e.$.searchButton.classList[a]("smart-disabled"),e.$.downloadButton.classList[a]("smart-disabled"),e.$.resourceButton.classList[a]("smart-disabled"),e.$.labelButton.classList[a]("smart-disabled")};o(e.dataSource&&0===e.dataSource.length),t.dataSource&&t.dataSource.virtualDataSource&&!t.dataSource.virtualDataSourceOnExpand&&"infinite"!==t.scrolling&&o(!1),0===t.columns.length?e.$.customizeButton.classList.add("smart-disabled"):e.$.customizeButton.classList.remove("smart-disabled")}}}get hasStyleObserver(){return!1}render(){const e=this;e._appliedFiltering={filters:[],operator:"and"},e._appliedSorting={dataFields:[],dataTypes:[],orderBy:[]},e._localizeHeader(),e._getInnerElementMessages(),super.render()}openFormatPanel(){const e=this,t=e.dataSource;if(!t||0===t.length||e.disabled||"none"===e.headerPosition)return;let a;if(e._refreshColumns("format"),e.grid.closeMenu(),e._editInfo&&e._editInfo.window.close(),e._closeDownloadMenu(),e._closeViewsMenu(),e._closeResourceMenu(),e._closeLabelMenu(),e._closeColorMenu(),e._closeFontSizeMenu(),e._closeFontFamilyMenu(),e.$.headerDropDown.classList.add("format-panel"),e.$.headerDropDown.classList.remove("customize-panel","colors-panel","sort-panel","search-panel","filter-panel"),e.$.format.classList.remove("smart-hidden"),e.$.customize.classList.add("smart-hidden"),e.$.sort.classList.add("smart-hidden"),e.$.colors.classList.add("smart-hidden"),e.$.filter.classList.add("smart-hidden"),e.$.ai.classList.add("smart-hidden"),e.$.group&&e.$.group.classList.add("smart-hidden"),e.$.search.classList.add("smart-hidden"),e._closeSearchPanel(),e._formatPartCreated)a=e.$.format.firstElementChild,a.columns=e.columns,a.dataSource=e.dataSource,a.locale=e.locale,a.messages=e._innerElementMessages.formattingPanel,a.rightToLeft=e.rightToLeft;else{a=document.createElement("smart-formatting-panel"),a.animation=e.animation,a.columns=e.columns,a.dataSource=e.dataSource,a.locale=e.locale,a.messages=e._innerElementMessages.formattingPanel,a.rightToLeft=e.rightToLeft,a.theme=e.theme,a.unfocusable=!1,a.ownerElement=e,a.dropDownAppendTo="body",e._formattingPanel=a,e.$.format.appendChild(a);const t=document.createElement("div");t.className="smart-format-panel smart-grid-panel-container-footer",t.setAttribute("role","presentation"),t.innerHTML=`<div id="buttonsContainer" class="smart-grid-panel-buttons-container smart-unselectable" role="presentation"><span class="smart-grid-panel-cancel-button" role="button">${e.localize("cancel")}</span><span class="smart-grid-panel-apply-button" role="button">${e.localize("apply")}</span></div>`,e._formattingPanel.$.apply=t.querySelector(".smart-grid-panel-apply-button"),e._formattingPanel.$.cancel=t.querySelector(".smart-grid-panel-cancel-button"),e.$.format.appendChild(t),e._formatPartCreated=!0,t.applyButton=t.querySelector(".smart-grid-panel-apply-button"),t.cancelButton=t.querySelector(".smart-grid-panel-cancel-button"),t.applyButton.onclick=()=>{a.$.fireEvent("apply"),e.grid._conditionalFormattingChanged=!0,e.grid._conditionalFormatting=a.apply(),e.grid.conditionalFormatting=a.getItems(),e.grid._recycle(!1),e.grid._conditionalFormattingChanged=!1},t.cancelButton.onclick=()=>{a.$.fireEvent("cancel")},e.grid.conditionalFormatting&&(a.items=e.grid.conditionalFormatting)}a.focus(),e._openHeaderDropDown(e.$.formatButton)}_openHeaderDropDown(e){const t=this;t.$.headerDropDown.parentElement!==document.body&&(document.body.appendChild(t.$.headerDropDown),t.$.headerDropDown.addEventListener("apply",(e=>{const a=t._getDropDownType();t._applyHandler(e),t.grid.$.fireEvent("batchChange",{type:a})})),t.$.headerDropDown.addEventListener("cancel",(()=>{const e=t._getDropDownType();t.closePanel(),t.grid.$.fireEvent("batchCancel",{type:e})}))),t.$.headerDropDown.addEventListener("close",(()=>{t._dropDownCloseDate=new Date})),super._openHeaderDropDown(e),t.refreshHeaderDropDownPosition(e)}refreshHeaderDropDownPosition(e){const t=this;if(!t.$.headerDropDown||t.$.headerDropDown&&!t.$.headerDropDown.classList.contains("open"))return void(t._dropDownTarget=e);e?t._dropDownTarget=e:t._dropDownTarget&&(e=t._dropDownTarget);const a=t.grid.parentElement,o=a?a.scrollTop:0;if(t.grid.header.appendTo){const e=document.querySelector(t.grid.header.appendTo);t.$.headerDropDown.style.top=t.grid.offset(e).top+e.offsetHeight-o+"px"}else t.$.headerDropDown.style.top=t.grid.offset(t.grid).top+t.grid.$.header.offsetHeight-o+"px";const s=()=>{if(e){const a=t.grid.offset(e);if(a.left+t.$.headerDropDown.offsetWidth<document.body.scrollLeft+document.body.offsetWidth?t.$.headerDropDown.style.left=a.left+"px":t.$.headerDropDown.style.left=document.body.scrollLeft+document.body.offsetWidth-t.$.headerDropDown.offsetWidth+"px",a.top+t.$.headerDropDown.offsetHeight>=document.documentElement.clientHeight-40){let e=t.grid.offset(t.grid).top-t.$.headerDropDown.offsetHeight;if(t.grid.header.appendTo){const a=document.querySelector(t.grid.header.appendTo);e=t.grid.offset(a).top-t.$.headerDropDown.offsetHeight}e<0&&(e=0),t.$.headerDropDown.style.top=e+"px"}}else t.$.headerDropDown.style.left=t.grid.offset(t.grid).left+"px"};t.grid.offsetWidth<600&&t.$.headerDropDown.offsetWidth>t.grid.offsetWidth?(t.$.headerDropDown.style.width="90%",t.$.headerDropDown.style.left=t.grid.offset(t.grid).left+"px"):(t.$.headerDropDown.style.width="",s())}openFilterPanel(e){const t=this,a=t.dataSource;t._refreshColumns("filter"),t.$.view.classList.add("smart-hidden"),t.$.ai.classList.add("smart-hidden");const o=this.columns.map((e=>{const t=Object.assign({},e),o=a.dataFields.find((e=>e.name===t.dataField));return o&&(t.dataType=o.dataType),t})).filter((e=>e.allowFilter));super.openFilterPanel(o,null),t._closeDownloadMenu(),t._closeViewsMenu(),t._closeResourceMenu(),t._closeLabelMenu(),t._closeColorMenu(),t._closeFontSizeMenu(),t._closeFontFamilyMenu();const s=t.grid;if(s.closeMenu(),e){const a=t.$.headerDropDown.querySelector("smart-multi-column-filter-panel");a.$.itemsContainer.appendChild(a._createItem(t.columns.find((t=>t.dataField===e.dataField)),"string"===e.dataType?"CONTAINS":"EQUAL",""));const o=a.querySelectorAll(".smart-grid-panel-item");setTimeout((()=>{o[o.length-1].querySelector(".editor").focus()}),350)}const n=t.$.headerDropDown.querySelector("smart-multi-column-filter-panel");n&&s.ai&&s.ai.key&&(n.$.addAIFilterButton.classList.remove("smart-hidden"),n.$.aiFilterPrompt.classList.add("smart-hidden"),n.$.spinner.classList.add("smart-hidden"),n.$.addAIFilterButton.onclick=()=>{n.$.aiFilterPrompt.placeholder=s.localize("dialogFilterHeader"),n.$.aiFilterPrompt.classList.toggle("smart-hidden"),n.$.spinner.classList.remove("smart-hidden"),n.$.aiFilterPrompt.focus(),n.$.aiFilterPrompt.parentElement.style.display="flex",n.$.aiFilterPrompt.parentElement.style.flexDirection="column",n.$.aiFilterPrompt.onchange=n.$.aiFilterPrompt.oninput=e=>{const t=()=>{let e=0;const t=setInterval((()=>{n.$.spinner.innerHTML=`\rThinking${".".repeat(e%4)} `,e++}),500);try{s.filterBy(n.$.aiFilterPrompt.value,null,(e=>{n.$.spinner.innerHTML="",n.$.spinner.classList.add("smart-hidden"),clearInterval(t);const a=[];for(let t in e){const o=e[t].filterGroup;for(let e=0;e<o.filters.length;e++){const s=o.filters[e];a.push([t,s.condition,s.value])}}n.value=a}))}catch(e){n.$.spinner.innerHTML=s.localize("noResults"),clearInterval(t)}};"Enter"===e.key?(n.aiTimer&&clearTimeout(n.aiTimer),t()):(n.aiTimer&&clearTimeout(n.aiTimer),n.aiTimer=setTimeout((()=>{t()}),800))}})}openColorsPanel(){const e=this,t=e.dataSource;e._refreshColumns("colors"),e.$.view.classList.add("smart-hidden"),e.$.ai.classList.add("smart-hidden");const a=this.columns.map((e=>{const a=Object.assign({},e),o=t.dataFields.find((e=>e.name===a.dataField));return o&&(a.dataType=o.dataType),a}));super.openColorsPanel(a,null,e.grid),e._closeDownloadMenu(),e._closeViewsMenu(),e._closeResourceMenu(),e._closeLabelMenu(),e._closeColorMenu(),e._closeFontSizeMenu(),e._closeFontFamilyMenu(),e.grid.closeMenu()}openViewPanel(){const e=this;if(e.disabled||"none"===e.headerPosition)return;if(!1===e.grid.appearance.showViewBarAsDropdown)return;let t;e.$.headerDropDown.classList.add("view-panel"),e.$.headerDropDown.classList.remove("customize-panel","filter-panel","sort-panel","search-panel","group-panel","format-panel","colors-panel"),e.$.view.classList.remove("smart-hidden"),e.$.colors.classList.add("smart-hidden"),e.$.filter.classList.add("smart-hidden"),e.$.sort.classList.add("smart-hidden"),e.$.search.classList.add("smart-hidden"),e.$.group.classList.add("smart-hidden"),e.$.format.classList.add("smart-hidden"),e.$.customize.classList.add("smart-hidden"),e.$.ai.classList.add("smart-hidden"),e.$.format&&e.$.format.classList.add("smart-hidden"),e.$.group&&e.$.group.classList.add("smart-hidden"),e.$.search.classList.add("smart-hidden"),e._closeSearchPanel(),e._viewPartCreated?t=e.$.view.firstElementChild:(t=document.createElement("div"),t.classList.add("smart-view-panel","smart-grid-view-bar"),e.$.view.appendChild(t),e.$.viewPanel=t,e._viewPartCreated=!0,e._updateViews()),e._openHeaderDropDown(e.$.viewStatesButton)}openSortPanel(e){const t=this,a=t.dataSource;t._refreshColumns("sort"),t.$.view.classList.add("smart-hidden"),t.$.ai.classList.add("smart-hidden");const o=t.columns.map((e=>{const o=Object.assign({},e),s=t._appliedSorting.dataFields.indexOf(o.dataField),n=a.dataFields.find((e=>e.name===o.dataField));return n&&(o.dataType=n.dataType,o.sortIndex=s,-1!==s&&(o.sortDirection=t._appliedSorting.orderBy[s])),o})).filter((e=>e.allowSort));if(e&&t._appliedSorting&&-1===t._appliedSorting.dataFields.indexOf(e.dataField)){const a=o.find((t=>t.dataField===e.dataField));a.sortDirection="ascending",a.sortIndex=t._appliedSorting.dataFields.length}super.openSortPanel(o),t._closeDownloadMenu(),t._closeViewsMenu(),t._closeResourceMenu(),t._closeLabelMenu(),t._closeColorMenu(),t._closeFontSizeMenu(),t._closeFontFamilyMenu();const s=t.grid;s.closeMenu();const n=t.$.headerDropDown.querySelector("smart-sort-panel");if(!n)return;n.grid=s,n.$.maintainSortContainer.classList.remove("smart-hidden"),s.sorting.maintainSort?n.$.maintainSortContainer.firstElementChild.setAttribute("active",""):n.$.maintainSortContainer.firstElementChild.removeAttribute("active"),n._changeApplyButtonText();const i=n.$.inputNotSorted,r=()=>{const e=n.querySelectorAll(".smart-grid-panel-item");"many"===t.grid.sorting.mode||e.length<1?i.classList.remove("smart-visibility-hidden"):e.length>=1&&i.classList.add("smart-visibility-hidden")};n.onDataSourceChange=()=>{r()},r()}openCustomizePanel(){const e=this;if(e.disabled||"none"===e.headerPosition)return;e._closeDownloadMenu(),e._closeViewsMenu(),e._closeResourceMenu(),e._closeLabelMenu(),e._closeColorMenu(),e._closeFontSizeMenu(),e._closeFontFamilyMenu(),e._refreshColumns("customize");let t=e.columns;const a=e.grid;a.closeMenu(),a.appearance.showColumnGroupsInColumnPanel&&(t=[],a.columns.forEach((e=>{if(!e.columnGroup){const a={label:e.label,dataField:e.dataField,level:0,parentDataField:null,dataType:e.dataType||"string",columnGroup:e.columnGroup||null,allowHide:void 0===e.allowHide||e.allowHide,allowSort:void 0===e.allowSort||e.allowSort,allowFilter:void 0===e.allowFilter||e.allowFilter,allowGroup:void 0===e.allowGroup||e.allowGroup,visible:void 0===e.visible||e.visible};t.push(a)}})),a._columnGroups.forEach((e=>{const a={dataField:e.name,label:e.label,level:0,disableDrag:!0,disableToggle:!1,allowHide:!0};if(t.push(a),e.columns){let o=e.columns.length,s=0,n=[],i=[];e.columns.forEach((a=>{const r={label:a.label,dataField:a.dataField,level:1,parentDataField:e.name,dataType:a.dataType||"string",columnGroup:a.columnGroup||null,allowHide:void 0===a.allowHide||a.allowHide,allowSort:void 0===a.allowSort||a.allowSort,allowFilter:void 0===a.allowFilter||a.allowFilter,allowGroup:void 0===a.allowGroup||a.allowGroup,visible:void 0===a.visible||a.visible};!1===r.allowHide&&(o--,i.push(r.dataField)),r.visible||(s++,n.push(r.dataField)),t.push(r)})),o<=0&&(a.allowHide=!1,a.disableToggle=!0),e.columns.length===s||o===s&&i.toString()!==n.toString()?a.visible=!1:a.visible=!0}})));const o=e.$.customize,s=t.map((t=>{const a={};return a.visible=t.visible,a.label=t.label,a.dataField=t.dataField,-1!==[e.coverField,e.titleField].indexOf(a.dataField)?a.disableToggle=!0:a.disableToggle=!1,void 0!==t.level&&(a.level=t.level),t.disableDrag&&(a.disableDrag=!0),t.parentDataField&&(a.parentDataField=t.parentDataField),t.allowHide||(a.disableToggle=!0),a}));let n;if(e._closeDialog(),e.$.headerDropDown.classList.add("customize-panel"),e.$.headerDropDown.classList.remove("view-panel","colors-panel","filter-panel","sort-panel","search-panel","group-panel","format-panel"),o.classList.remove("smart-hidden"),e.$.filter.classList.add("smart-hidden"),e.$.sort.classList.add("smart-hidden"),e.$.search.classList.add("smart-hidden"),e.$.group.classList.add("smart-hidden"),e.$.format.classList.add("smart-hidden"),e.$.view.classList.add("smart-hidden"),e.$.colors.classList.add("smart-hidden"),e.$.ai.classList.add("smart-hidden"),e._closeSearchPanel(),e._customizePartCreated)n=o.querySelector("smart-column-panel"),n.locale=e.locale,n.messages=e._innerElementMessages.columnPanel,n.set("dataSource",s),n.propertyChangedHandler("dataSource",void 0,s),n.rightToLeft=e.rightToLeft;else{const t=document.createDocumentFragment(),a=document.createElement("smart-column-panel");a.rightToLeft=e.rightToLeft,a.animation=e.animation,a.dataSource=s,a.locale=e.locale,a.messages=e._innerElementMessages.columnPanel,a.theme=e.theme,t.appendChild(a),e.$.customize.appendChild(t),e._customizePartCreated=!0}e._changedVisibility=new Map,e._openHeaderDropDown(e.$.customizeButton)}_applyFilter(e,t){const a=this;a.grid.beginUpdate(),a.grid.context=a.grid,a.grid.clearFilter();for(let t=0;t<e.length;t++){const o=e[t],s=o[0],n=o[1];a.grid.columnByDataField[s].filter=n}a.grid._filterOperator=t,a.grid.endUpdate(),a.grid.refreshFilters(),a.grid.context=document,a.grid.autoSaveState()}_applySort(){const e=this,t=e._appliedSorting;e.grid.beginUpdate(),e.grid.sorting.maintainSort=t.maintainSort,e.grid.context=e.grid,e.grid.clearSort();for(let a=0;a<t.dataFields.length;a++)e.grid.sortBy(t.dataFields[a],t.orderBy[a]);e.grid.endUpdate(),e.grid.context=document,e.grid.autoSaveState()}_getDropDownType(){const e=this;let t=null;return e.$.headerDropDown.classList.contains("filter-panel")?t="filter":e.$.headerDropDown.classList.contains("sort-panel")?t="sort":e.$.headerDropDown.classList.contains("search-panel")?t="search":e.$.headerDropDown.classList.contains("group-panel")?t="group":e.$.headerDropDown.classList.contains("format-panel")?t="format":e.$.headerDropDown.classList.contains("customize-panel")?t="customize":e.$.headerDropDown.classList.contains("view-panel")?t="view":e.$.headerDropDown.classList.contains("colors-panel")&&(t="colors"),t}_applyHandler(e){const t=this,a=e.target,o=e.detail,s=t.$.customize;if(t.grid&&"kanban"===t.grid.view&&t.grid._kanban&&s.contains(a))return t.grid._kanban._applyHandler(e,"customize"),void t.closePanel();t.$.ai.contains(a)&&t._applyAI(),s.contains(a)?t._applyColumns(o.value,o.moves):t.$.filter.contains(a)?t.addFilter(o.filters,o.operator,o.value):t.$.sort.contains(a)?t.addSort(o.sortByInfo):t.$.colors.contains(a)&&t.addColors(o.value,o.decorator,o.filters),t.closePanel()}_documentUpHandler(e){const t=this;let a=e.originalEvent.target,o=t.grid?t.grid.$.header:null;if(t.grid&&t.grid.header.appendTo&&(o=document.querySelector(t.grid.header.appendTo)),!o)return;t.shadowRoot&&a===t&&(a=e.originalEvent.composedPath()[0]);const s=e.originalEvent.composedPath();for(let e=0;e<s.length;e++){const t=s[e];if(t&&t.classList&&t.classList.contains("smart-menu-item")){const e=t.closest("smart-menu");if(e&&e.classList.contains("smart-grid-views-menu"))return;if(e&&e.classList.contains("smart-grid-download-menu"))return}}if(t._closeDownloadMenu(),t._closeViewsMenu(),t._closeResourceMenu(),t._closeLabelMenu(),a!==t.$.colorButton&&a!==t.$.backgroundButton&&t._closeColorMenu(),a!==t.$.fontSizeButton&&t._closeFontSizeMenu(),a!==t.$.fontFamilyButton&&t._closeFontFamilyMenu(),!("none"===t.headerPosition||t.$.headerDropDown.classList.contains("smart-visibility-hidden")||a!==o&&o.contains(a))){const s=a.closest("smart-scroll-viewer"),n=a.closest(".smart-drop-down");if((!s||!o.contains(s.ownerElement))&&(!n||n.ownerElement&&!o.contains(n.ownerElement))){const a=e.originalEvent.composedPath();for(let e=0;e<a.length;e++){const t=a[e];if(t&&t.classList&&t.classList.contains("smart-data-view-header-drop-down"))return;if(t&&t.classList&&t.classList.contains("smart-formatting-panel-popup"))return}if(s&&s.ownerElement){const e=s.ownerElement.parents;for(let t=0;t<e.length;t++){const a=e[t];if(a&&a.classList&&a.classList.contains("smart-data-view-header-drop-down"))return}}if(n&&n.ownerElement){const e=n.ownerElement.parents;for(let t=0;t<e.length;t++){const a=e[t];if(a&&a.classList&&a.classList.contains("smart-data-view-header-drop-down"))return}}if(t.$.headerDropDown.querySelector("[open]"))return;if(t._dropDownCloseDate&&new Date-t._dropDownCloseDate<500)return;t.closePanel()}}}_refreshColumns(e){const t=this,a=t.grid;let o,s=new Map;if("kanban"===a.view&&a._kanban)switch(e){case"customize":return o=a._kanban._getCustomizeColumnPanelDataSource(),o=JSON.parse(JSON.stringify(o)),t._refreshCustomizeButton(),void(t.columns=o)}o=Array.isArray(a.columns)?[...a.columns]:[...a.columns.toArray()],o=o.filter((t=>!(!t||!1===t._visible||("filter"===e||"sort"===e)&&("sort"===e&&!t.sortOrder||"filter"===e&&!t.filter)&&!1===t.visible))),o=o.map((e=>{let t=e.allowHide;return a.grouping&&a.grouping.autoHideGroupColumn&&a.dataSource.groupBy.indexOf(e.dataField)>=0&&(t=!1),{label:e.label,dataField:e.dataField,dataType:e.dataType||"string",columnGroup:e.columnGroup||null,allowHide:void 0===e.allowHide||t,allowSort:void 0===e.allowSort||e.allowSort,allowFilter:void 0===e.allowFilter||e.allowFilter,allowGroup:void 0===e.allowGroup||e.allowGroup,visible:void 0===e.visible||e.visible,sortIndex:void 0!==e.sortIndex&&null!==e.sortIndex?e.sortIndex:-1,sortDirection:void 0!==e.sortOrder?e.sortOrder:null,options:e.editor&&e.editor.dataSource?e.editor.dataSource:null}})),o=JSON.parse(JSON.stringify(o)),o.forEach((e=>{let t=e.columnGroup?e.columnGroup+"."+e.label:e.label,a=1;for(;s.get(t);)t=e.columnGroup?e.columnGroup+"."+e.label+` (${a})`:e.label+` (${a})`,a++;s.set(t,e),e.label=t})),t.columns=o,t._refreshCustomizeButton()}_init(e){const t=this;if(t.grid=e,e.dataSource&&e.dataSource.boundSource){t._refreshColumns("init");const a=Array.isArray(e.dataSource.boundSource)?e.dataSource.boundSource:e.dataSource.boundSource.toArray();t.dataSource=new Smart.DataAdapter({observable:!1,dataSource:[...a],dataFields:e.dataSource.dataFields})}t.rightToLeft=t.grid.rightToLeft,t.refreshTools(),t.$.headerDropDown.onclick=e=>{t.grid._headerClickHandler(e),e.stopPropagation(),e.preventDefault()},t.grid.removeEventListener("change",t._refreshFromSelection),t.grid.addEventListener("change",t._refreshFromSelection),t.grid.appearance.showViewBarAsDropdown||t._updateViews(),e.header.onInit&&e.header.onInit(t)}_removeFontFamilyMenu(){const e=this;if(e.fontFamilyMenu){const t=e.fontFamilyMenu.querySelector("smart-menu");t&&e.fontFamilyMenu.removeChild(t)}}_removeFontSizeMenu(){const e=this;if(e.fontSizeMenu){const t=e.fontSizeMenu.querySelector("smart-menu");t&&e.fontSizeMenu.removeChild(t)}}_removeMenu(){const e=this;if(e.downloadMenu){const t=e.downloadMenu.querySelector("smart-menu");t&&e.downloadMenu.removeChild(t)}}_removeLabelMenu(){const e=this;if(e.labelMenu){const t=e.labelMenu.querySelector("smart-menu");t&&e.labelMenu.removeChild(t);const a=e.labelMenu.querySelector(".label");a&&e.labelMenu.removeChild(a)}}_removeResourceMenu(){const e=this;if(e.resourceMenu){const t=e.resourceMenu.querySelector("smart-menu");t&&e.resourceMenu.removeChild(t);const a=e.resourceMenu.querySelector(".label");a&&e.resourceMenu.removeChild(a)}}_removeViewsMenu(){const e=this;if(e.viewsMenu){const t=e.viewsMenu.querySelector("smart-menu");t&&e.viewsMenu.removeChild(t);const a=e.viewsMenu.querySelector(".label");a&&e.viewsMenu.removeChild(a)}}_createViewsMenuItems(){const e=this,t=e.grid;e._removeViewsMenu();const a=document.createElement("smart-menu"),o=document.createDocumentFragment();a.classList.add("smart-grid-views-menu"),a.checkable=!0,a.checkboxes=!0,a.style.width="100%",a.mode="vertical",a.dropDownAppendTo="body",a.rightToLeft=t.rightToLeft,a.style.minWidth="150px";const s=(e,a,o)=>{const s=document.createElement("smart-menu-item");let n="smart-icon-grid-alt";switch(a){case"grid":n="smart-icon-grid-alt","grid"===t.view&&o&&(s.setAttribute("focus",""),s.checked=!0),s.title=t.localize("gridView");break;case"kanban":n="smart-icon-kanban-alt","kanban"===t.view&&o&&(s.setAttribute("focus",""),s.checked=!0),s.title=t.localize("kanbanView");break;case"card":n="smart-icon-card-alt","card"===t.view&&o&&(s.setAttribute("focus",""),s.checked=!0),s.title=t.localize("cardView");break;case"scheduler":n="smart-icon-scheduler","scheduler"===t.view&&o&&(s.setAttribute("focus",""),s.checked=!0),s.title=t.localize("schedulerView");break;case"timeline":n="smart-icon-timeline","timeline"===t.view&&o&&(s.setAttribute("focus",""),s.checked=!0),s.title=t.localize("timelineView")}return s.label='<span class="smart-grid-icon '+n+'"></span>'+e,s.value=a,s};o.appendChild(s(t.localize("viewGrid"),"grid",!0)),o.appendChild(s(t.localize("viewKanban"),"kanban",!0)),o.appendChild(s(t.localize("viewCard"),"card",!0)),o.appendChild(s(t.localize("viewScheduler"),"scheduler",!0)),a.appendChild(o),e.viewsMenu.insertBefore(a,e.viewsMenu.children[e.viewsMenu.children.length-1]),e.viewsMenu.onpointerup=()=>!1,a.onItemClick=a=>{e._setView(a.detail.value),e._closeViewsMenu(),t.autoSaveState(),e._updateViews()}}_createResourceMenuItems(){const e=this,t=e.grid;e._removeResourceMenu();const a=document.createElement("smart-menu"),o=document.createDocumentFragment();a.classList.add("smart-grid-views-menu"),a.checkable=!0,a.checkboxes=!0,a.style.width="100%",a.mode="vertical",a.dropDownAppendTo="body",a.rightToLeft=t.rightToLeft,a.style.minWidth="150px";const s=(e,a,o,s)=>{const n=document.createElement("smart-menu-item");return n.label='<span class="smart-grid-icon '+a+'"></span>'+e,t._dateStackedBySelect===s&&(n.setAttribute("focus",""),n.checked=!0),n.value=s,n};let n=!1;for(let e=0;e<t.columns.length;e++){const a=t.columns[e];a.editor&&a.editor.dataSource&&a.editor.singleSelect&&a.editor.dataSource.length&&("collaborator"===a.template||"tags"===a.template)&&(o.appendChild(s(a.label,a.icon,0,a.dataField)),n=!0)}if(a.appendChild(o),n&&e.resourceMenu.insertBefore(a,e.resourceMenu.children[e.resourceMenu.children.length-1]),e.resourceMenu.onpointerup=()=>!1,!n){const a=document.createElement("div");a.classList.add("label","smart-flex","middle","center","smart-quiet"),a.style.minHeight="60px",a.style.height="100%",a.innerHTML=t.localize("noGrouping"),e.resourceMenu.appendChild(a)}a.onItemClick=a=>{t._dateStackedBySelect===a.detail.item.value?delete t._dateStackedBySelect:t._dateStackedBySelect=a.detail.item.value,t._onSort&&t._onSort(),e._closeResourceMenu(),t.autoSaveState()}}_updateViews(){const e=this,t=e.grid;if(t.appearance.showViewBarAsDropdown||e.$.viewStatesButton.removeAttribute("aria-expanded"),t.stateSettings.enabled&&t.appearance.showViewBar){const a=e=>{(!t.users.length||!1!==t.currentUser&&null!==t.currentUser&&void 0!==t.currentUser)&&(delete t.stateSettings.storage[e.valueName],t.stateSettings.current===e.valueName&&(t.stateSettings.current=""),t.stateSettings.onStateChange&&t.stateSettings.onStateChange(t.stateSettings.storage[t.stateSettings.current],e.valueName,t.stateSettings.storage,t.stringify_object),e.remove())},o=a=>{const o=document.createElement("input");if(o.value=a.valueName,t.users.length&&(!1===t.currentUser||null===t.currentUser||void 0===t.currentUser))return;const s=()=>{if(o.value){if(t.stateSettings.storage[o.value])return;const s=t.stateSettings.storage[a.valueName];t.stateSettings.current===a.valueName&&(t.stateSettings.current=o.value),delete t.stateSettings.storage[s.name],s.name=o.value,t.stateSettings.storage[s.name]=s,t.stateSettings.onStateChange&&t.stateSettings.onStateChange(t.stateSettings.storage[t.stateSettings.current],s.name,t.stateSettings.storage,t.stringify_object),delete t.stateSettings.storage[a.valueName],o.remove();const n=o.value;a.valueName=n;let i="smart-icon-grid-alt";switch(s.view){case"grid":i="smart-icon-grid-alt";break;case"kanban":i="smart-icon-kanban-alt";break;case"card":i="smart-icon-card-alt";break;case"scheduler":i="smart-icon-scheduler";break;case"timeline":i="smart-icon-timeline"}n===t.stateSettings.current?(a.selected=!0,a.label='<span class="show smart-grid-icon '+i+'"></span><span style="overflow: hidden; text-overflow: ellipsis;">'+n+'</span><span class="show smart-grid-icon smart-icon-mode-edit"></span><span class="smart-grid-icon smart-icon-delete"></span>'):a.label='<span class="show smart-grid-icon '+i+'"></span><span style="overflow: hidden; text-overflow: ellipsis;">'+n+'</span><span class="show smart-grid-icon smart-icon-mode-edit"></span><span class="show smart-grid-icon smart-icon-delete"></span>',e._refreshViewsButton()}};o.onselectstart=e=>{e.stopPropagation()},o.onpointerdown=o.onpointerup=e=>{e.stopPropagation()},o.onkeydown=e=>{e.stopPropagation()},o.onkeyup=e=>{"Escape"===e.key&&(o.onchange=o.onblur=null,o.remove()),"Enter"===e.key&&(o.onchange=o.onblur=null,s()),e.stopPropagation()},o.onchange=()=>{o.onblur=null,o.onkeyup=null,s()},o.onblur=()=>{o.remove()},o.style.width="100%",o.style.height="100%",o.style.position="absolute",o.style.left="0px",o.style.top="0px",o.style.zIndex=99,o.classList.add("smart-input"),o.classList.add("underlined"),o.style.backgroundColor="var(--smart-background)",o.style.color="var(--smart-background-color)",a.querySelector(".smart-list-item-label-element").appendChild(o),setTimeout((()=>{o.focus()}),50)},s=(e,a,o)=>{const s=document.createElement("smart-list-item");let n="smart-icon-grid-alt";switch(a){case"grid":n="smart-icon-grid-alt";break;case"kanban":n="smart-icon-kanban-alt";break;case"card":n="smart-icon-card-alt";break;case"scheduler":n="smart-icon-scheduler";break;case"timeline":n="smart-icon-timeline"}return s.value=o,s.valueName=e,e===t.stateSettings.current?(s.selected=!0,s.label='<span class="show smart-grid-icon '+n+'"></span><span style="overflow: hidden; text-overflow: ellipsis;">'+e+'</span><span class="show smart-grid-icon smart-icon-mode-edit"></span><span class="smart-grid-icon smart-icon-delete"></span>'):s.label='<span class="show smart-grid-icon '+n+'"></span><span style="overflow: hidden; text-overflow: ellipsis;">'+e+'</span><span class="show smart-grid-icon smart-icon-mode-edit"></span><span class="show smart-grid-icon smart-icon-delete"></span>',t.users.length&&(!1!==t.currentUser&&null!==t.currentUser&&void 0!==t.currentUser||(e===t.stateSettings.current?(s.selected=!0,s.label='<span class="show smart-grid-icon '+n+'"></span><span style="overflow: hidden; text-overflow: ellipsis;">'+e+'</span><span class="smart-visibility-hidden smart-grid-icon smart-icon-mode-edit"></span><span class="smart-visibility-hidden smart-grid-icon smart-icon-delete"></span>'):s.label='<span class="show smart-grid-icon '+n+'"></span><span style="overflow: hidden; text-overflow: ellipsis;">'+e+'</span><span class="smart-visibility-hidden smart-grid-icon smart-icon-mode-edit"></span><span class="smart-visibility-hidden smart-grid-icon smart-icon-delete"></span>')),s};t.appearance.showViewBarAsDropdown||e.$.viewStatesButton.setAttribute("aria-expanded",!0);let n=t.$.viewBar;if(t.appearance.showViewBarAsDropdown&&(n=e.$.viewPanel),t.appearance.viewBarAppendTo&&(n=document.querySelector(t.appearance.viewBarAppendTo),n&&n.classList.add("smart-grid-view-bar")),n&&!n.querySelector(".smart-grid-view-chooser-container")){const a=document.createElement("div");a.classList.add("smart-grid-view-chooser-container","smart-container");const o=document.createElement("div");o.classList.add("new-view"),!1===t.editing.enabled&&o.classList.add("smart-hidden");const s=(a,o)=>{a.stopPropagation(),a.preventDefault(),t.beginUpdate();let s=0,i=[];if(t.stateSettings.storage){for(;t.stateSettings.storage[t.localize("view")+" "+s];)s++;for(let e in t.stateSettings.storage){const a=t.stateSettings.storage[e];i[a.view]=1+i[a.view]||1}}let r="";switch(o){case"grid":r=t.localize("viewGrid");break;case"kanban":r=t.localize("viewKanban");break;case"card":r=t.localize("viewCard");break;case"scheduler":r=t.localize("viewScheduler");break;case"timeline":r=t.localize("viewTimeline")}if(i[o]||(i[o]=""),t.stateSettings.storage){let e=i[o]?t.localize("view")+" "+i[o]:t.localize("view");for(;t.stateSettings.storage[r+" "+e];)e=t.localize("view")+" "+i[o],i[o]++}const l=i[o]?t.localize("view")+" "+i[o]:t.localize("view");if(!n){let a=t.$.viewBar;t.appearance.showViewBarAsDropdown&&(a=e.$.viewPanel),t.appearance.viewBarAppendTo&&(a=document.querySelector(t.appearance.viewBarAppendTo),a&&a.classList.add("smart-grid-view-bar")),a&&(n=a)}if(!n)return void t.endUpdate();n._input.value=r+" "+l,t.stateSettings.current||(t.stateSettings.current=n._input.value),t.saveState(),t.stateSettings.current=n._input.value,e._closeViewsMenu(),t.resetState(!1);const d=t.view;t.set("view","grid",!1),t._kanban&&t._kanban._reset(),delete t.columnByDataField.taskStatus,"grid"===o&&"grid"!==d?e._setView("grid",!0):"kanban"===o?e._setView("kanban"):"card"===o?e._setView("card"):"scheduler"===o?e._setView("scheduler"):"timeline"===o&&e._setView("timeline"),t.saveState(),t.endUpdate(),e._updateViews(),t.$.fireEvent("viewChanged",{view:t.view})},i=document.createElement("smart-button");i.classList.add("selected"),i.classList.add("view"),i.innerHTML='<span style="display: flex; align-items: center;"><span class="show smart-grid-icon smart-icon-grid-alt"></span>'+t.localize("newGrid")+'</span><span style="font-size: 12px; color: rgba(var(--smart-secondary-rgb), 0.6);" class="show smart-grid-icon smart-icon-plus"></span>',i.title=t.localize("gridView");const r=document.createElement("smart-button");r.innerHTML='<span style="display: flex; align-items: center;"><span class="show smart-grid-icon smart-icon-kanban-alt"></span>'+t.localize("newKanban")+'</span><span style="font-size: 12px; color: rgba(var(--smart-secondary-rgb), 0.6);" class="show smart-grid-icon smart-icon-plus"></span>',r.classList.add("view"),r.title=t.localize("kanbanView");const l=document.createElement("smart-button");l.classList.add("selected"),l.classList.add("view"),l.innerHTML='<span style="display: flex; align-items: center;"><span class="show smart-grid-icon smart-icon-card-alt"></span>'+t.localize("newCard")+'</span><span style="font-size: 12px; color: rgba(var(--smart-secondary-rgb), 0.6);" class="show smart-grid-icon smart-icon-plus"></span>',l.title=t.localize("cardView");const d=document.createElement("smart-button");d.classList.add("selected"),d.classList.add("view"),d.innerHTML='<span style="display: flex; align-items: center;"><span class="show smart-grid-icon smart-icon-scheduler"></span>'+t.localize("newScheduler")+'</span><span style="font-size: 12px; color: rgba(var(--smart-secondary-rgb), 0.6);" class="show smart-grid-icon smart-icon-plus"></span>',d.title=t.localize("schedulerView");const c=document.createElement("smart-button");c.classList.add("selected"),c.classList.add("view"),c.innerHTML='<span style="display: flex; align-items: center;"><span class="show smart-grid-icon smart-icon-timeline"></span>'+t.localize("newTimeline")+'</span><span style="font-size: 12px; color: rgba(var(--smart-secondary-rgb), 0.6);" class="show smart-grid-icon smart-icon-plus"></span>',c.title=t.localize("timelineView");const u=document.createElement("div");u.classList.add("smart-grid-view-storage"),a.appendChild(u);const m=document.createElement("smart-input");m.classList.add("underlined"),m.placeholder=t.localize("viewNamePlaceholder"),m.hint=t.localize("viewNamePlaceholder"),m.onselectstart=e=>{e.stopPropagation()};const p=document.createElement("div");p.innerHTML="<span>"+t.localize("settings")+'</span><span class="smart-grid-icon show smart-icon-sort-down"></span>',p.classList.add("view-label"),o.appendChild(p);const h=document.createElement("div");o.appendChild(h),h.classList.add("footer"),t.users&&t.users.length&&(!1!==t.currentUser&&null!==t.currentUser&&void 0!==t.currentUser||(h.classList.add("smart-hidden"),p.classList.add("smart-hidden"))),h.appendChild(i),h.appendChild(r),h.appendChild(l),h.appendChild(d),p.onclick=()=>{p.classList.toggle("collapsed"),h.classList.toggle("collapsed")};const g=document.createElement("div");g.innerHTML='<span class="smart-grid-icon show smart-icon-plus"></span><span><a href="javascript:void();">'+t.localize("createView")+"</a></span>",g.classList.add("view-button"),g.onclick=e=>{let t="grid";r.classList.contains("selected")&&(t="kanban"),l.classList.contains("selected")&&(t="card"),d.classList.contains("selected")&&(t="scheduler"),c.classList.contains("selected")&&(t="timeline"),s(e,t,o)},r.onpointerdown=()=>{r.classList.add("selected"),i.classList.remove("selected"),l.classList.remove("selected"),d.classList.remove("selected"),c.classList.remove("selected"),g.click()},i.onpointerdown=()=>{i.classList.add("selected"),r.classList.remove("selected"),l.classList.remove("selected"),d.classList.remove("selected"),c.classList.remove("selected"),g.click()},l.onpointerdown=()=>{i.classList.remove("selected"),r.classList.remove("selected"),l.classList.add("selected"),d.classList.remove("selected"),c.classList.remove("selected"),g.click()},d.onpointerdown=()=>{i.classList.remove("selected"),r.classList.remove("selected"),l.classList.remove("selected"),d.classList.add("selected"),c.classList.remove("selected"),g.click()},c.onpointerdown=()=>{i.classList.remove("selected"),r.classList.remove("selected"),l.classList.remove("selected"),d.classList.remove("selected"),c.classList.add("selected"),g.click()};const v=()=>{t.stateSettings.storage&&!t.stateSettings.storage[m.value]||m.value&&!t.stateSettings.storage?g.classList.remove("disabled"):g.classList.add("disabled")};m.update=()=>v(),m.onkeyup=m.onchange=()=>{v()},v(),a.appendChild(o),n._storage=u,n._input=m,n.appendChild(a)}let i=t.stateSettings.storage;(i&&0===Object.keys(i).length||!i)&&(n._input.value||("kanban"===t.view?n._input.value=t.localize("newKanban")+" "+t.localize("view"):"card"===t.view?n._input.value=t.localize("newCard")+" "+t.localize("view"):"scheduler"===t.view?n._input.value=t.localize("newScheduler")+" "+t.localize("view"):n._input.value=t.localize("newGrid")+" "+t.localize("view")),t.stateSettings.current||(t.stateSettings.current=n._input.value),t.saveState(),t.stateSettings.current=n._input.value,i=t.stateSettings.storage);const r=n?n._storage:document.createElement("div");if(r.innerHTML="",i){let e=1;const l=document.createDocumentFragment();let d=[],c=[];for(let e in i){const t=i[e];c[t.name]||(c[t.name]=t,d.push({name:e,value:t}))}d.sort(((e,t)=>{const a=new Date(e.value.date),o=new Date(t.value.date);if(e.value&&e.value.date&&t.value&&t.value.date){if(!e.value.date||!t.value.date)return-1;if(a<o)return-1;if(a>o)return 1;if(a===o)return 0}else{if(e.name<t.name)return-1;if(e.name>t.name)return 1;if(e.name===t.name)return 0}}));let u=[],m=-1;for(let t in d){const a=d[t],o=a.name,n=a.value;e++,u[n.view]=u[n.view]++||1;const i=s(o,n.view,n);i.selected&&(m=parseInt(t),delete i.selected),l.appendChild(i)}if(e){const e=document.createElement("smart-list-box");e.style.width="100%",e.style.height="100%",e.allowDrag=!0,e.allowDrop=!0,e.itemHeight=32,e.mode="vertical",e.style.borderColor="transparent",e.classList.add("smart-grid-views-menu"),e.checkable=!0,e.checkboxes=!0,e.filterable=!0,e.filterInputPlaceholder=t.localize("commandBarSearch")+" "+t.localize("view"),e.selectionMode="one",e.disableAutoCheck=!0,e.rightToLeft=t.rightToLeft,e.ondragend=e=>{const t=e.detail.item;if(i[t.valueName]){const t=e.detail.target;if(t){const e=i[t.valueName],a=e?e.date:null;if(a){let t=new Smart.Utilities.DateTime(a);const o="top"===Smart.ListBox.DragDrop.DropDetails.position?-10:10;t=t.addSeconds(o),e.date=t.toDate().toJSON()}}}},e.onkeydown=t=>{const a=e.querySelector("smart-list-item[checked]");a&&"F2"===t.key&&o(a)},e.onDoubleClick=e=>{const t=e.target.closest("smart-list-item");o(t)},e.onClick=e=>{if(e.target&&e.target.classList.contains("smart-icon-delete")){const t=e.target.closest("smart-list-item");a(t),e.preventDefault(),e.stopPropagation()}else if(e.target&&e.target.classList.contains("smart-icon-mode-edit")){const t=e.target.closest("smart-list-item");o(t),e.preventDefault(),e.stopPropagation()}else if("INPUT"===e.target.nodeName)return},e.appendChild(l),r.appendChild(e),e.clearSelection(),e.selectedIndexes=[m],e.onchange=a=>{if(a.detail&&a.detail.selected){const o=a.detail.addedItems[0];t.loadState(o.valueName),e.querySelectorAll("smart-list-item").forEach((e=>{e.querySelector(".smart-icon-delete").classList.add("show")})),o.querySelector(".smart-icon-delete").classList.remove("show"),t.stateSettings.onStateChange&&t.stateSettings.onStateChange(t.stateSettings.storage[t.stateSettings.current],o.valueName,t.stateSettings.storage,t.stringify_object)}}}if(t.stateSettings.storage)for(;t.stateSettings.storage[t.localize("view")+" "+e];)e++;let p="";switch(t.view){case"grid":p=t.localize("viewGrid");break;case"kanban":p=t.localize("viewKanban");break;case"card":p=t.localize("viewCard");break;case"scheduler":p=t.localize("viewScheduler");break;case"timeline":p=t.localize("viewTimeline")}if(t.stateSettings.storage)for(;t.stateSettings.storage[p+" "+t.localize("view")+" "+u[t.view]];)u[t.view]++;n&&n._input&&(n._input.value=p+" "+t.localize("view")+" "+u[t.view],n._input.update())}}}_setView(e,t){const a=this,o=a.grid;if(o.view===e&&!0!==t)return;o.view;const s=o.context;if("kanban"===e)if(o.context=o,o.view="kanban",o.context=s,o._kanbanInitialized&&o.columnByDataField.taskStatus)if(o.columnByDataField.taskStatus&&o._stackedBy&&o.columnByDataField.taskStatus.dataField!==o._stackedBy){o.beginUpdate(),delete o.columnByDataField.taskStatus;const e=o.columnByDataField[o._stackedBy];o.columnByDataField.taskStatus=e,o._createKanban(e),o._refreshHeaderBar(),o.endUpdate(!1),o._hideSchedulerView(),o._showKanbanView(),a._refresh()}else o._hideSchedulerView(),o._showKanbanView(),a._refresh();else delete o._kanbanInitialized,o._initKanbanView("dynamic","grid");else"grid"===e?(o.context=o,o.view="grid",o.context=s,o._hideKanbanView(),o._hideSchedulerView(),a._refresh(),o.layout.isDirty=!0,o._resetCachedLayout(),o._refreshLayout(),o.refresh()):"card"===e?(o.context=o,o.view="card",o.context=s,o._hideKanbanView(),o._hideSchedulerView(),a._refresh(),o.layout.isDirty=!0,o._resetCachedLayout(),o._refreshLayout(),o.refresh()):"scheduler"!==e&&"timeline"!==e||(o.context=o,o.view=e,o.context=s,t?(o._hideKanbanView(),o._showSchedulerView(),a._refresh()):(o._createScheduler(),a._refresh(),o.layout.isDirty=!0,o._resetCachedLayout(),o._refreshLayout(),o.refresh()));o.$.fireEvent("viewChanged",{view:e}),a._refresh()}_createMenuItems(){const e=this,t=e.grid;e._removeMenu();const a=document.createElement("smart-menu"),o=document.createDocumentFragment();a.mode="vertical",a.dropDownAppendTo="body",a.classList.add("smart-grid-download-menu"),a.rightToLeft=t.rightToLeft;const s=(e,t)=>{const a=document.createElement("smart-menu-item");let o="#D50000";switch(t){case"csv":o="#3f51b5";break;case"pdf":o="#f4511e";break;case"xlsx":o="#0b8043";break;case"json":o="#8e24aa"}const s='<span style="position: absolute; top: 0px; font-size: 10px; color: '+o+'">'+t+"</span>";return a.label='<span style="color: '+o+'" class="smart-grid-icon smart-icon-docs"></span>'+s+e,a.value=t,a};o.appendChild(s(t.localize("download")+" CSV","csv")),o.appendChild(s(t.localize("download")+" XLSX","xlsx")),o.appendChild(s(t.localize("download")+" JSON","json")),a.appendChild(o),e.downloadMenu.appendChild(a),a.onItemClick=e=>{const a=new Date;t.dataExport.fileName="data_"+a.getFullYear()+"-"+a.getMonth()+"-"+a.getDate(),t.exportData(e.detail.value)}}closePanel(){const e=this;super.closePanel(),e.grid&&e.grid.focus(),e.downloadMenu&&e.downloadMenu.classList.contains("open")?e._closeDownloadMenu():e.viewsMenu&&e.viewsMenu.classList.contains("open")?e._closeViewsMenu():e.resourceMenu&&e.resourceMenu.classList.contains("open")?e._closeResourceMenu():e.labelMenu&&e.labelMenu.classList.contains("open")?e._closeLabelMenu():e.colorMenu&&e.colorMenu.classList.contains("open")&&e._closeColorMenu()}_closeResourceMenu(){const e=this,t=e.resourceMenu;t&&(t.parentNode&&(t.classList.remove("open"),setTimeout((()=>{t&&t.parentNode&&t.parentNode.removeChild(t)}),100)),e.$.resourceButton.classList.remove("selected"),e.$.resourceButton.removeAttribute("aria-expanded"),t.classList.remove("open"))}_openResourceMenu(){const e=this;if(e.grid.editing.isEditing&&e.grid.cancelEdit(),e.resourceMenu&&e.resourceMenu.classList.contains("open"))return void e._closeResourceMenu();e.$.headerDropDown.classList.remove("view-panel","group-panel","colors-panel","customize-panel","filter-panel","sort-panel","search-panel","format-panel"),e.$.group.classList.add("smart-hidden"),e.$.filter.classList.add("smart-hidden"),e.$.colors.classList.add("smart-hidden"),e.$.customize.classList.add("smart-hidden"),e.$.sort.classList.add("smart-hidden"),e.$.search.classList.add("smart-hidden"),e.$.format.classList.add("smart-hidden"),e.$.view.classList.add("smart-hidden"),e.$.ai.classList.add("smart-hidden"),e.closePanel(),e.$.resourceButton.classList.add("selected"),e.$.resourceButton.setAttribute("aria-expanded",!0),e.resourceMenu||(e.resourceMenu=document.createElement("div"),e.resourceMenu.classList.add("smart-grid-column-menu","smart-grid-resource-menu"),e.resourceMenu.setAttribute("theme",e.getAttribute("theme")),e.resourceMenu.id=e.id+"_"+e.tagName.toLowerCase()+"_menu_"+Math.floor(65536*(1+Math.random())).toString(16).substring(1)),e.resourceMenu.classList.add("smart-animate"),e._createResourceMenuItems(),e.resourceMenu.style.height="auto",e.isInShadowDOM?e.getRootNode().appendChild(e.resourceMenu):document.body.appendChild(e.resourceMenu);const t=e.$.resourceButton.getBoundingClientRect();let a=t.left+window.pageXOffset,o=t.bottom+window.pageYOffset;a+e.resourceMenu.offsetWidth>window.innerWidth&&(a=t.right+window.pageXOffset-e.resourceMenu.offsetWidth,a+e.resourceMenu.offsetWidth>window.innerWidth&&(a=window.innerWidth-e.resourceMenu.offsetWidth)),e.resourceMenu.style.left=a+"px",e.resourceMenu.style.top=o+"px",e.resourceMenu.classList.remove("smart-hidden"),e.resourceMenu.classList.add("open")}_closeLabelMenu(){const e=this,t=e.labelMenu;t&&(t.parentNode&&(t.classList.remove("open"),setTimeout((()=>{t&&t.parentNode&&t.parentNode.removeChild(t)}),100)),e.$.labelButton.classList.remove("selected"),e.$.labelButton.removeAttribute("aria-expanded"),t.classList.remove("open"))}_createLabelMenuItems(){const e=this,t=e.grid;e._removeLabelMenu();const a=document.createElement("smart-menu"),o=document.createDocumentFragment();a.classList.add("smart-grid-views-menu"),a.checkable=!0,a.checkboxes=!0,a.style.width="100%",a.mode="vertical",a.dropDownAppendTo="body",a.rightToLeft=t.rightToLeft,a.style.minWidth="150px";const s=(e,a,o,s)=>{const n=document.createElement("smart-menu-item");return n.label='<span class="smart-grid-icon '+a+'"></span>'+e,t._labeledBy===s&&(n.setAttribute("focus",""),n.checked=!0),n.value=s,n};for(let e=0;e<t.columns.length;e++){const a=t.columns[e];"string"!==a.dataType||a.relationField||"input"!==a.editor.template&&"textarea"!==a.editor.template||o.appendChild(s(a.label,a.icon,0,a.dataField))}a.appendChild(o),e.labelMenu.insertBefore(a,e.labelMenu.children[e.labelMenu.children.length-1]),e.labelMenu.onpointerup=()=>!1,a.onItemClick=a=>{t._labeledBy===a.detail.item.value?delete t._labeledBy:t._labeledBy=a.detail.item.value,t._onSort&&t._onSort(),e._closeLabelMenu(),t.autoSaveState()}}_closeColorMenu(){const e=this,t=e.colorMenu;t&&(t.parentNode&&(t.classList.remove("open"),setTimeout((()=>{t&&t.parentNode&&t.parentNode.removeChild(t)}),100)),e.$.colorButton.classList.remove("selected"),e.$.colorButton.removeAttribute("aria-expanded"),e.$.backgroundButton.classList.remove("selected"),e.$.backgroundButton.removeAttribute("aria-expanded"),t.classList.remove("open"))}_closeFontSizeMenu(){const e=this,t=e.fontSizeMenu;t&&(t.parentNode&&(t.classList.remove("open"),setTimeout((()=>{t&&t.parentNode&&t.parentNode.removeChild(t)}),100)),e.$.fontSizeButton.classList.remove("selected"),e.$.fontSizeButton.removeAttribute("aria-expanded"),t.classList.remove("open"))}_openFontSizeMenu(){const e=this;if(e.grid.editing.isEditing&&e.grid.cancelEdit(),e.fontSizeMenu&&e.fontSizeMenu.classList.contains("open"))return void e._closeFontSizeMenu();e.$.headerDropDown.classList.remove("view-panel","group-panel","colors-panel","customize-panel","filter-panel","sort-panel","search-panel","format-panel"),e.$.group.classList.add("smart-hidden"),e.$.filter.classList.add("smart-hidden"),e.$.colors.classList.add("smart-hidden"),e.$.customize.classList.add("smart-hidden"),e.$.sort.classList.add("smart-hidden"),e.$.search.classList.add("smart-hidden"),e.$.format.classList.add("smart-hidden"),e.$.view.classList.add("smart-hidden"),e.$.ai.classList.add("smart-hidden"),e.closePanel(),e.$.fontSizeButton.classList.add("selected"),e.$.fontSizeButton.setAttribute("aria-expanded",!0),e.fontSizeMenu||(e.fontSizeMenu=document.createElement("div"),e.fontSizeMenu.classList.add("smart-grid-column-menu","smart-grid-fontsize-menu"),e.fontSizeMenu.setAttribute("theme",e.getAttribute("theme")),e.fontSizeMenu.id=e.id+"_"+e.tagName.toLowerCase()+"_menu_"+Math.floor(65536*(1+Math.random())).toString(16).substring(1)),e.fontSizeMenu.classList.add("smart-animate");const t=e.grid;e._removeFontSizeMenu();const a=document.createElement("smart-menu"),o=document.createDocumentFragment();a.mode="vertical",a.dropDownAppendTo="body",a.classList.add("smart-grid-fontsize-menu"),a.rightToLeft=t.rightToLeft;const s=["-","8px","10px","12px","14px","18px","24px"];for(let e=0;e<s.length;e++){const t=document.createElement("smart-menu-item");t.label=s[e],t.value=s[e],o.appendChild(t)}a.appendChild(o),e.fontSizeMenu.appendChild(a),a.onItemClick=t=>{const a=t.detail.value;e._setStyle("fontSize",a)},e.fontSizeMenu.style.height="auto",e.isInShadowDOM?e.getRootNode().appendChild(e.fontSizeMenu):document.body.appendChild(e.fontSizeMenu);const n=e.$.fontSizeButton.getBoundingClientRect();let i=n.left+window.pageXOffset,r=n.bottom+window.pageYOffset;i+e.$.fontSizeButton.offsetWidth>window.innerWidth&&(i=n.right+window.pageXOffset-e.fontSizeMenu.offsetWidth,i+e.$.fontSizeButton.offsetWidth>window.innerWidth&&(i=window.innerWidth-e.$.fontSizeButton.offsetWidth)),e.fontSizeMenu.style.width="60px",e.fontSizeMenu.style.left=i+"px",e.fontSizeMenu.style.top=r+"px",e.fontSizeMenu.classList.remove("smart-hidden"),e.fontSizeMenu.classList.add("open")}_closeFontFamilyMenu(){const e=this,t=e.fontFamilyMenu;t&&(t.parentNode&&(t.classList.remove("open"),setTimeout((()=>{t&&t.parentNode&&t.parentNode.removeChild(t)}),100)),e.$.fontFamilyButton.classList.remove("selected"),e.$.fontFamilyButton.removeAttribute("aria-expanded"),t.classList.remove("open"))}_openFontFamilyMenu(){const e=this;if(e.grid.editing.isEditing&&e.grid.cancelEdit(),e.fontFamilyMenu&&e.fontFamilyMenu.classList.contains("open"))return void e._closeFontFamilyMenu();e.$.headerDropDown.classList.remove("view-panel","group-panel","colors-panel","customize-panel","filter-panel","sort-panel","search-panel","format-panel"),e.$.group.classList.add("smart-hidden"),e.$.filter.classList.add("smart-hidden"),e.$.colors.classList.add("smart-hidden"),e.$.customize.classList.add("smart-hidden"),e.$.sort.classList.add("smart-hidden"),e.$.search.classList.add("smart-hidden"),e.$.format.classList.add("smart-hidden"),e.$.view.classList.add("smart-hidden"),e.$.ai.classList.add("smart-hidden"),e.closePanel(),e.$.fontFamilyButton.classList.add("selected"),e.$.fontFamilyButton.setAttribute("aria-expanded",!0),e.fontFamilyMenu||(e.fontFamilyMenu=document.createElement("div"),e.fontFamilyMenu.classList.add("smart-grid-column-menu","smart-grid-fontfamily-menu"),e.fontFamilyMenu.setAttribute("theme",e.getAttribute("theme")),e.fontFamilyMenu.id=e.id+"_"+e.tagName.toLowerCase()+"_menu_"+Math.floor(65536*(1+Math.random())).toString(16).substring(1)),e.fontFamilyMenu.classList.add("smart-animate");const t=e.grid;e._removeFontFamilyMenu();const a=document.createElement("smart-menu"),o=document.createDocumentFragment();a.mode="vertical",a.dropDownAppendTo="body",a.classList.add("smart-grid-fontsize-menu"),a.rightToLeft=t.rightToLeft;const s=["-","Roboto","Segoe UI","Arial","Georgia","Tahoma","Times New Roman","Courier New","Verdana"];for(let e=0;e<s.length;e++){const t=document.createElement("smart-menu-item");t.label=s[e],t.value=s[e],o.appendChild(t)}a.appendChild(o),e.fontFamilyMenu.appendChild(a),a.onItemClick=t=>{e._setStyle("fontFamily",t.detail.value)},e.fontFamilyMenu.style.height="auto",e.isInShadowDOM?e.getRootNode().appendChild(e.fontFamilyMenu):document.body.appendChild(e.fontFamilyMenu);const n=e.$.fontFamilyButton.getBoundingClientRect();let i=n.left+window.pageXOffset,r=n.bottom+window.pageYOffset;i+e.$.fontFamilyButton.offsetWidth>window.innerWidth&&(i=n.right+window.pageXOffset-e.fontFamilyMenu.offsetWidth,i+e.$.fontFamilyButton.offsetWidth>window.innerWidth&&(i=window.innerWidth-e.$.fontFamilyButton.offsetWidth)),e.fontFamilyMenu.style.width="140px",e.fontFamilyMenu.style.left=i+"px",e.fontFamilyMenu.style.top=r+"px",e.fontFamilyMenu.classList.remove("smart-hidden"),e.fontFamilyMenu.classList.add("open")}_openColorMenu(e,t){const a=this;if(a.grid.editing.isEditing&&a.grid.cancelEdit(),a.colorMenu&&a.colorMenu.classList.contains("open")){if(a.colorMenu.classList.remove("open"),a.colorMenu.isBackground&&t)return void a._closeColorMenu();if(!a.colorMenu.isBackground&&!t)return void a._closeColorMenu()}a.$.headerDropDown.classList.remove("view-panel","group-panel","colors-panel","customize-panel","filter-panel","sort-panel","search-panel","format-panel"),a.$.group.classList.add("smart-hidden"),a.$.filter.classList.add("smart-hidden"),a.$.colors.classList.add("smart-hidden"),a.$.customize.classList.add("smart-hidden"),a.$.sort.classList.add("smart-hidden"),a.$.search.classList.add("smart-hidden"),a.$.format.classList.add("smart-hidden"),a.$.view.classList.add("smart-hidden"),a.$.ai.classList.add("smart-hidden"),a.closePanel(),a.$.colorButton.classList.remove("selected"),a.$.colorButton.removeAttribute("aria-expanded"),a.$.backgroundButton.classList.remove("selected"),a.$.backgroundButton.removeAttribute("aria-expanded"),t?(a.$.backgroundButton.classList.add("selected"),a.$.backgroundButton.setAttribute("aria-expanded",!0)):(a.$.colorButton.classList.add("selected"),a.$.colorButton.setAttribute("aria-expanded",!0)),a.colorMenu||(a.colorMenu=document.createElement("div"),a.colorMenu.className="smart-grid-column-menu smart-grid-color-menu smart-color-input-drop-down-menu smart-color-panel smart-input-drop-down-menu underlined-drop-down-menu smart-grid-color-input-drop-down-menu smart-drop-down-box-drop-down-menu smart-color-picker-drop-down-menu smart-grid-color-input",a.colorMenu.setAttribute("theme",a.getAttribute("theme")),a.colorMenu.id=a.id+"_"+a.tagName.toLowerCase()+"_menu_"+Math.floor(65536*(1+Math.random())).toString(16).substring(1),a.colorMenu.innerHTML=a._getColors()),a.colorMenu.classList.add("smart-animate"),a.colorMenu.isBackground=t,a.colorMenu.style.height="auto",a.isInShadowDOM?a.getRootNode().appendChild(a.colorMenu):document.body.appendChild(a.colorMenu);const o=t?a.$.backgroundButton.getBoundingClientRect():a.$.colorButton.getBoundingClientRect();let s=o.left+window.pageXOffset,n=o.bottom+window.pageYOffset;s+a.colorMenu.offsetWidth>window.innerWidth&&(s=o.right+window.pageXOffset-a.colorMenu.offsetWidth,s+a.colorMenu.offsetWidth>window.innerWidth&&(s=window.innerWidth-a.colorMenu.offsetWidth)),a.colorMenu.style.left=s+"px",a.colorMenu.style.top=n+"px",a.colorMenu.classList.remove("smart-hidden"),a.colorMenu.classList.add("open"),a.colorMenu.querySelectorAll(".color-sample").forEach((t=>{t.classList.remove("selected"),t.getAttribute("value")===e&&t.classList.add("selected")})),a.colorMenu.onpointerup=e=>{const o=e.target.getAttribute("value");void 0!==o&&(a._closeColorMenu(),t?(a.$.backgroundButton.style.setProperty("--smart-surface-color",o),a._setStyle("background",o)):(a.$.colorButton.style.setProperty("--smart-surface-color",o),a._setStyle("color",o)))}}_openLabelMenu(){const e=this;if(e.grid.editing.isEditing&&e.grid.cancelEdit(),e.labelMenu&&e.labelMenu.classList.contains("open"))return void e._closeLabelMenu();e.$.headerDropDown.classList.remove("view-panel","group-panel","colors-panel","customize-panel","filter-panel","sort-panel","search-panel","format-panel"),e.$.group.classList.add("smart-hidden"),e.$.filter.classList.add("smart-hidden"),e.$.colors.classList.add("smart-hidden"),e.$.customize.classList.add("smart-hidden"),e.$.sort.classList.add("smart-hidden"),e.$.search.classList.add("smart-hidden"),e.$.format.classList.add("smart-hidden"),e.$.view.classList.add("smart-hidden"),e.$.ai.classList.add("smart-hidden"),e.closePanel(),e.$.labelButton.classList.add("selected"),e.$.labelButton.setAttribute("aria-expanded",!0),e.labelMenu||(e.labelMenu=document.createElement("div"),e.labelMenu.classList.add("smart-grid-column-menu","smart-grid-label-menu"),e.labelMenu.setAttribute("theme",e.getAttribute("theme")),e.labelMenu.id=e.id+"_"+e.tagName.toLowerCase()+"_menu_"+Math.floor(65536*(1+Math.random())).toString(16).substring(1)),e.labelMenu.classList.add("smart-animate"),e._createLabelMenuItems(),e.labelMenu.style.height="auto",e.isInShadowDOM?e.getRootNode().appendChild(e.labelMenu):document.body.appendChild(e.labelMenu);const t=e.$.labelButton.getBoundingClientRect();let a=t.left+window.pageXOffset,o=t.bottom+window.pageYOffset;a+e.labelMenu.offsetWidth>window.innerWidth&&(a=t.right+window.pageXOffset-e.labelMenu.offsetWidth,a+e.labelMenu.offsetWidth>window.innerWidth&&(a=window.innerWidth-e.labelMenu.offsetWidth)),e.labelMenu.style.left=a+"px",e.labelMenu.style.top=o+"px",e.labelMenu.classList.remove("smart-hidden"),e.labelMenu.classList.add("open")}_closeDownloadMenu(){const e=this,t=e.downloadMenu;t&&(t.parentNode&&(t.classList.remove("open"),setTimeout((()=>{t&&t.parentNode&&t.parentNode.removeChild(t)}),100)),e.$.downloadButton.classList.remove("selected"),e.$.downloadButton.removeAttribute("aria-expanded"),t.classList.remove("open"))}_openDownloadMenu(){const e=this;if(e.grid.editing.isEditing&&e.grid.cancelEdit(),e.downloadMenu&&e.downloadMenu.classList.contains("open"))return void e._closeDownloadMenu();e.$.headerDropDown.classList.remove("view-panel","group-panel","colors-panel","customize-panel","filter-panel","sort-panel","search-panel","format-panel"),e.$.group.classList.add("smart-hidden"),e.$.filter.classList.add("smart-hidden"),e.$.colors.classList.add("smart-hidden"),e.$.customize.classList.add("smart-hidden"),e.$.sort.classList.add("smart-hidden"),e.$.search.classList.add("smart-hidden"),e.$.format.classList.add("smart-hidden"),e.$.view.classList.add("smart-hidden"),e.$.ai.classList.add("smart-hidden"),e.closePanel(),e.$.downloadButton.classList.add("selected"),e.$.downloadButton.setAttribute("aria-expanded",!0),e.downloadMenu||(e.downloadMenu=document.createElement("div"),e.downloadMenu.classList.add("smart-grid-column-menu","smart-grid-download-menu"),e.downloadMenu.setAttribute("theme",e.getAttribute("theme")),e.downloadMenu.id=e.id+"_"+e.tagName.toLowerCase()+"_menu_"+Math.floor(65536*(1+Math.random())).toString(16).substring(1)),e.downloadMenu.classList.add("smart-animate"),e._createMenuItems(),e.downloadMenu.style.height="auto",e.isInShadowDOM?e.getRootNode().appendChild(e.downloadMenu):document.body.appendChild(e.downloadMenu);const t=e.$.downloadButton.getBoundingClientRect();let a=t.left+window.pageXOffset,o=t.bottom+window.pageYOffset;a+e.downloadMenu.offsetWidth>window.innerWidth&&(a=t.right+window.pageXOffset-e.downloadMenu.offsetWidth,a+e.downloadMenu.offsetWidth>window.innerWidth&&(a=window.innerWidth-e.downloadMenu.offsetWidth)),e.downloadMenu.style.left=a+"px",e.downloadMenu.style.top=o+"px",e.downloadMenu.classList.remove("smart-hidden"),e.downloadMenu.classList.add("open")}_closeViewsMenu(){const e=this,t=e.viewsMenu;t&&(t.parentNode&&(t.classList.remove("open"),setTimeout((()=>{t&&t.parentNode&&t.parentNode.removeChild(t)}),100)),t.classList.remove("open"),e.$.viewsButton.classList.remove("selected"),e.$.viewsButton.removeAttribute("aria-expanded"))}_openViewsMenu(){const e=this;if(e.grid.editing.isEditing&&e.grid.cancelEdit(),e.viewsMenu&&e.viewsMenu.classList.contains("open"))return void e._closeViewsMenu();e.$.headerDropDown.classList.remove("view-panel","group-panel","colors-panel","customize-panel","filter-panel","sort-panel","search-panel","format-panel"),e.$.group.classList.add("smart-hidden"),e.$.filter.classList.add("smart-hidden"),e.$.colors.classList.add("smart-hidden"),e.$.customize.classList.add("smart-hidden"),e.$.sort.classList.add("smart-hidden"),e.$.search.classList.add("smart-hidden"),e.$.format.classList.add("smart-hidden"),e.$.view.classList.add("smart-hidden"),e.$.ai.classList.add("smart-hidden"),e.closePanel(),e.$.viewsButton.classList.add("selected"),e.$.viewsButton.setAttribute("aria-expanded",!0),e.viewsMenu||(e.viewsMenu=document.createElement("div"),e.viewsMenu.classList.add("smart-grid-column-menu","smart-grid-download-menu","smart-grid-view-chooser"),e.viewsMenu.setAttribute("theme",e.getAttribute("theme")),e.viewsMenu.id=e.id+"_"+e.tagName.toLowerCase()+"_menu_"+Math.floor(65536*(1+Math.random())).toString(16).substring(1)),e.viewsMenu.classList.add("smart-animate"),e._createViewsMenuItems("views"),e.viewsMenu.style.height="auto",e.isInShadowDOM?e.getRootNode().appendChild(e.viewsMenu):document.body.appendChild(e.viewsMenu);const t=e.$.viewsButton.getBoundingClientRect();let a=t.left+window.pageXOffset,o=t.bottom+window.pageYOffset;a+e.viewsMenu.offsetWidth>window.innerWidth&&(a=t.right+window.pageXOffset-e.downloadMenu.offsetWidth,a+e.viewsMenu.offsetWidth>window.innerWidth&&(a=window.innerWidth-e.viewsMenu.offsetWidth)),e.viewsMenu.style.left=a+"px",e.viewsMenu.style.top=o+"px",e.viewsMenu.classList.remove("smart-hidden"),e.viewsMenu.classList.add("open")}_setStyle(e,t){const a=this.grid;if(!a._selection)return;const o=a._selection.cells;if(o&&Object.keys(o).length>0){const o=a.getSelectedCells(!1),s={};for(let n=0;n<o.length;n++){const i=o[n],r=i[0],l=i[1],d=a.rowById[r],c=d.style?JSON.parse(JSON.stringify(d.style)):{};s[r]||(s[r]={});for(let e in c){for(let e=0;e<a.columns.length;e++){const t=a.columns[e].dataField;c[t]&&(s[r][t]=c[t])}c[e]&&["color","background","textDecoration","fontStyle","fontFamily","fontWeight","fontSize"].indexOf(e)>=0&&(s[r][e]=c[e])}const u=s[r];if(d){const a=d.getCell(l);if(a){const o=a.canNotify;a.canNotify=!1,"textDecoration"===e?(a[e]||(a[e]=""),a[e].indexOf(t)>=0?a[e]=a[e].replace(t,"").trim():a[e]+=" "+t):a[e]===t?a[e]="":a[e]=t,a.canNotify=o;const s=u[a.column.dataField]={};["color","background","textDecoration","fontStyle","fontFamily","fontWeight","fontSize"].forEach((e=>{a[e]&&(s[e]=a[e])}))}const o=d.canNotify;if(0===Object.keys(u).length){delete s[r];continue}d.canNotify=!1,d.style=u,d.canNotify=o}}if(a.onRowStyle){const e=[],t=[],o=[];Object.keys(s).forEach(((n,i)=>{const r=s[n];e.push(i),t.push(a.rowById[n]),o.push(r)})),a.onRowStyle(e,t,o)}a._recycle(!1,!0)}else{const o=a.getSelectedRowIds(),s=[],n=[],i=[];for(let r=0;r<o.length;r++){const l=o[r],d=a.rowById[l],c=d.style?JSON.parse(JSON.stringify(d.style)):{};if("textDecoration"===e?(c[e]||(c[e]=""),c[e].indexOf(t)>=0?c[e]=c[e].replace(t,"").trim():c[e]+=" "+t):c[e]===t?c[e]="":c[e]=t,a.setRowStyle(l,c),a.onRowStyle){s.push(d.index),n.push(d);const e={};["color","background","textDecoration","fontStyle","fontFamily","fontWeight","fontSize"].forEach((t=>{c[t]&&(e[t]=c[t])})),i.push(e)}}a.onRowStyle&&a.onRowStyle(s,n,i)}}_updateTools(){const e=this,t=e.grid;if(!t._selection)return;const a=t._selection.cells;if(a&&Object.keys(a).length>0){const a=t.getSelectedCells(!1);for(let o=0;o<a.length;o++){const s=a[o],n=s[0],i=s[1],r=t.rowById[n];if(r){const t=r.getCell(i);if(t){e.$.boldButton.removeAttribute("aria-expanded"),e.$.italicButton.removeAttribute("aria-expanded"),e.$.underlineButton.removeAttribute("aria-expanded"),e.$.strikethroughButton.removeAttribute("aria-expanded"),e.$.colorButton.removeAttribute("aria-expanded"),e.$.backgroundButton.removeAttribute("aria-expanded"),e.$.fontSizeButton.removeAttribute("aria-expanded"),e.$.fontFamilyButton.removeAttribute("aria-expanded"),e.$.backgroundButton.style.setProperty("--smart-surface-color","inherit"),e.$.colorButton.style.setProperty("--smart-surface-color","inherit"),e.fontSizeMenu&&e.fontSizeMenu.querySelectorAll("smart-menu-item").forEach((e=>{e.removeAttribute("focus")})),e.fontFamilyMenu&&e.fontFamilyMenu.querySelectorAll("smart-menu-item").forEach((e=>{e.removeAttribute("focus")})),t.fontWeight&&e.$.boldButton.setAttribute("aria-expanded","true"),t.background&&e.$.backgroundButton.style.setProperty("--smart-surface-color",t.background),t.color&&e.$.colorButton.style.setProperty("--smart-surface-color",t.color),t.fontStyle&&e.$.italicButton.setAttribute("aria-expanded","true"),t.textDecoration&&(t.textDecoration.indexOf("line-through")>=0&&e.$.strikethroughButton.setAttribute("aria-expanded","true"),t.textDecoration.indexOf("under")>=0&&e.$.underlineButton.setAttribute("aria-expanded","true")),t.fontSize&&e.fontSizeMenu&&e.fontSizeMenu.querySelectorAll("smart-menu-item").forEach((e=>{e.removeAttribute("focus"),e.value===t.fontSize&&e.setAttribute("focus","")})),t.fontFamily&&e.fontFamilyMenu&&e.fontFamilyMenu.querySelectorAll("smart-menu-item").forEach((e=>{e.removeAttribute("focus"),e.value===t.fontFamily&&e.setAttribute("focus","")}));break}}}}else{const a=t.getSelectedRowIds();for(let o=0;o<a.length;o++){const s=a[o],n=t.rowById[s],i=n.style?JSON.parse(JSON.stringify(n.style)):{};e.$.boldButton.removeAttribute("aria-expanded"),e.$.italicButton.removeAttribute("aria-expanded"),e.$.underlineButton.removeAttribute("aria-expanded"),e.$.strikethroughButton.removeAttribute("aria-expanded"),e.$.colorButton.removeAttribute("aria-expanded"),e.$.backgroundButton.removeAttribute("aria-expanded"),e.$.fontSizeButton.removeAttribute("aria-expanded"),e.$.fontFamilyButton.removeAttribute("aria-expanded"),i.fontWeight&&e.$.boldButton.setAttribute("aria-expanded","true"),i.background&&(e.$.backgroundButton.style.color=i.background),i.color&&(e.$.colorButton.style.color=i.color),i.fontStyle&&e.$.fontFamilyButton.setAttribute("aria-expanded","true"),i.textDecoration&&(i.textDecoration.indexOf("line-through")>=0&&e.$.strikethroughButton.setAttribute("aria-expanded","true"),i.textDecoration.indexOf("under")>=0&&e.$.underlineButton.setAttribute("aria-expanded","true"));break}}}_getColors(){return'<div class="default-samples-container grid-mode-container smart-container" role="presentation" style="">\n <div class="grid-samples-container" role="menu">\n <div id="colorInputca5bItem858b" data-label="#D50000" value="#D50000" role="menuitem" aria-label="#D50000" class="color-sample" style="background-color: rgb(213, 0, 0);"></div>\n <div id="colorInputca5bItem963b" data-label="#E67C73" value="#E67C73" role="menuitem" aria-label="#E67C73" class="color-sample" style="background-color: rgb(230, 124, 115);"></div><div id="colorInputca5bItem2f1f" data-label="#F4511E" value="#F4511E" role="menuitem" aria-label="#F4511E" class="color-sample" style="background-color: rgb(244, 81, 30);"></div><div id="colorInputca5bItem1a87" data-label="#F6BF26" value="#F6BF26" role="menuitem" aria-label="#F6BF26" class="color-sample" style="background-color: rgb(246, 191, 38);"></div><div id="colorInputca5bItem4c44" data-label="#0B8043" value="#0B8043" role="menuitem" aria-label="#0B8043" class="color-sample" style="background-color: rgb(11, 128, 67);"></div><div id="colorInputca5bItem8669" data-label="#33B679" value="#33B679" role="menuitem" aria-label="#33B679" class="color-sample" style="background-color: rgb(51, 182, 121);"></div><div id="colorInputca5bItem488c" data-label="#3F51B5" value="#3F51B5" role="menuitem" aria-label="#3F51B5" class="color-sample" style="background-color: rgb(63, 81, 181);"></div><div id="colorInputca5bItemc3aa" data-label="#039BE5" value="#039BE5" role="menuitem" aria-label="#039BE5" class="color-sample" style="background-color: rgb(3, 155, 229);"></div><div id="colorInputca5bItem4277" data-label="#7986CB" value="#7986CB" role="menuitem" aria-label="#7986CB" class="color-sample" style="background-color: rgb(121, 134, 203);"></div><div id="colorInputca5bItem3b61" data-label="#8C47FF" value="#8C47FF" role="menuitem" aria-label="#8C47FF" class="color-sample" style="background-color: rgb(140, 71, 255);"></div><div id="colorInputca5bItema4a6" data-label="#8E24AA" value="#8E24AA" role="menuitem" aria-label="#8E24AA" class="color-sample" style="background-color: rgb(142, 36, 170);"></div><div id="colorInputca5bItemdd64" data-label="#FF36C2" value="#FF36C2" role="menuitem" aria-label="#FF36C2" class="color-sample" style="background-color: rgb(255, 54, 194);"></div><div id="colorInputca5bItem07d0" data-label="#616161" value="#616161" role="menuitem" aria-label="#616161" class="color-sample" style="background-color: rgb(97, 97, 97);"></div><div id="colorInputca5bItemb2a4" data-label="#454545" value="#454545" role="menuitem" aria-label="#454545" class="color-sample" style="background-color: rgb(69, 69, 69);"></div><div id="colorInputca5bItem8de8" data-label="#949494" value="#949494" role="menuitem" aria-label="#949494" class="color-sample" style="background-color: rgb(148, 148, 148);"></div><div id="colorInputca5bItem75ce" data-label="#000000" value="#000000" role="menuitem" aria-label="#000000" class="color-sample" style="background-color: rgb(0, 0, 0);"></div></div><div class="grid-samples-container" role="menu"><div id="colorInputca5bItem932f" data-label="#FF9EB7" value="#FF9EB7" role="menuitem" aria-label="#FF9EB7" class="color-sample" style="background-color: rgb(255, 158, 183);"></div><div id="colorInputca5bItemc244" data-label="#FFCFC9" value="#FFCFC9" role="menuitem" aria-label="#FFCFC9" class="color-sample" style="background-color: rgb(255, 207, 201);"></div><div id="colorInputca5bItemcfb1" data-label="#FFD66D" value="#FFD66D" role="menuitem" aria-label="#FFD66D" class="color-sample" style="background-color: rgb(255, 214, 109);"></div><div id="colorInputca5bItem2827" data-label="#FFEBB6" value="#FFEBB6" role="menuitem" aria-label="#FFEBB6" class="color-sample" style="background-color: rgb(255, 235, 182);"></div><div id="colorInputca5bItem766c" data-label="#93DF89" value="#93DF89" role="menuitem" aria-label="#93DF89" class="color-sample" style="background-color: rgb(147, 223, 137);"></div><div id="colorInputca5bItem10b3" data-label="#D1F7C4" value="#D1F7C4" role="menuitem" aria-label="#D1F7C4" class="color-sample" style="background-color: rgb(209, 247, 196);"></div><div id="colorInputca5bItemb8a4" data-label="#9DC7FF" value="#9DC7FF" role="menuitem" aria-label="#9DC7FF" class="color-sample" style="background-color: rgb(157, 199, 255);"></div><div id="colorInputca5bItem78ff" data-label="#D0F0FD" value="#D0F0FD" role="menuitem" aria-label="#D0F0FD" class="color-sample" style="background-color: rgb(208, 240, 253);"></div><div id="colorInputca5bItem71b8" data-label="#CDAFFF" value="#CDAFFF" role="menuitem" aria-label="#CDAFFF" class="color-sample" style="background-color: rgb(205, 175, 255);"></div><div id="colorInputca5bIteme4d6" data-label="#ECE1FD" value="#ECE1FD" role="menuitem" aria-label="#ECE1FD" class="color-sample" style="background-color: rgb(236, 225, 253);"></div><div id="colorInputca5bItem3576" data-label="#FA9DE2" value="#FA9DE2" role="menuitem" aria-label="#FA9DE2" class="color-sample" style="background-color: rgb(250, 157, 226);"></div><div id="colorInputca5bItem8136" data-label="#FFDAF6" value="#FFDAF6" role="menuitem" aria-label="#FFDAF6" class="color-sample" style="background-color: rgb(255, 218, 246);"></div><div id="colorInputca5bItem26e5" data-label="#CBCBCB" value="#CBCBCB" role="menuitem" aria-label="#CBCBCB" class="color-sample" style="background-color: rgb(203, 203, 203);"></div><div id="colorInputca5bItemdc8a" data-label="#EDEDED" value="#EDEDED" role="menuitem" aria-label="#EDEDED" class="color-sample" style="background-color: rgb(237, 237, 237);"></div><div id="colorInputca5bItemd895" data-label="#FFFFFF" value="#FFFFFF" role="menuitem" aria-label="#FFFFFF" class="color-sample" style="background-color: rgb(255, 255, 255); border-color: var(--smart-border); border-style: solid; border-width: 1px;"></div><div id="colorInputca5bItem7231" data-label="" value="" role="menuitem" aria-label="" class="color-sample no-color"></div></div>\n </div>'}_boldCommand(){this._setStyle("fontWeight","bold"),this._updateTools()}_italicCommand(){this._setStyle("fontStyle","italic"),this._updateTools()}_underlineCommand(){this._setStyle("textDecoration","underline"),this._updateTools()}_strikethroughCommand(){this._setStyle("textDecoration","line-through"),this._updateTools()}_refresh(){const e=this,t=e.grid;e._refreshColumns("refresh");let a=!1;for(let t=0;t<e.columns.length;t++)if("number"===e.columns[t].dataType){a=!0;break}if(t.header.buttons.indexOf("sort")>=0&&t.sorting.enabled?e.$.sortButton.classList.remove("smart-hidden"):e.$.sortButton.classList.add("smart-hidden"),t.header.buttons.indexOf("filter")>=0&&t.filtering.enabled?e.$.filterButton.classList.remove("smart-hidden"):e.$.filterButton.classList.add("smart-hidden"),t.header.buttons.indexOf("group")>=0&&t.grouping.enabled?e.$.groupButton.classList.remove("smart-hidden"):e.$.groupButton.classList.add("smart-hidden"),t.header.buttons.indexOf("columns")>=0?e.$.customizeButton.classList.remove("smart-hidden"):e.$.customizeButton.classList.add("smart-hidden"),t.header.buttons.indexOf("search")>=0?e.$.searchButton.classList.remove("smart-hidden"):e.$.searchButton.classList.add("smart-hidden"),t.header.buttons.indexOf("format")>=0&&a?e.$.formatButton.classList.remove("smart-hidden"):e.$.formatButton.classList.add("smart-hidden"),t.header.buttons.indexOf("colors")>=0?e.$.colorsButton.classList.remove("smart-hidden"):e.$.colorsButton.classList.add("smart-hidden"),t.header.buttons.indexOf("delete")>=0&&t.editing.enabled?e.$.deleteButton.classList.remove("smart-hidden"):e.$.deleteButton.classList.add("smart-hidden"),t.header.buttons.indexOf("download")>=0?e.$.downloadButton.classList.remove("smart-hidden"):e.$.downloadButton.classList.add("smart-hidden"),t.header.buttons.indexOf("views")>=0?e.$.viewsButton.classList.remove("smart-hidden"):e.$.viewsButton.classList.add("smart-hidden"),t.header.buttons.indexOf("states")>=0&&t.stateSettings.enabled&&!t.appearance.viewBarAppendTo?e.$.viewStatesButton.classList.remove("smart-hidden"):e.$.viewStatesButton.classList.add("smart-hidden"),t.header.buttons.indexOf("formatting")>=0&&"grid"===t.view?(e.$.boldButton.classList.remove("smart-hidden"),e.$.italicButton.classList.remove("smart-hidden"),e.$.underlineButton.classList.remove("smart-hidden"),e.$.strikethroughButton.classList.remove("smart-hidden"),e.$.colorButton.classList.remove("smart-hidden"),e.$.backgroundButton.classList.remove("smart-hidden"),e.$.fontSizeButton.classList.remove("smart-hidden"),e.$.fontFamilyButton.classList.remove("smart-hidden"),e.$.boldButton.title=t.localize("bold")+" (Ctrl + B)",e.$.italicButton.title=t.localize("italic")+" (Ctrl + I)",e.$.underlineButton.title=t.localize("underline")+" (Ctrl + U)",e.$.strikethroughButton.title=t.localize("strikethrough")+" (Ctrl + Y)",e.$.colorButton.title=t.localize("color"),e.$.backgroundButton.title=t.localize("background"),e.$.fontSizeButton.title=t.localize("fontSize").replace(":",""),e.$.fontFamilyButton.title=t.localize("fontFamily").replace(":",""),e.$.boldButton.onpointerup=()=>{e._boldCommand()},e.$.italicButton.onpointerup=()=>{e._italicCommand()},e.$.underlineButton.onpointerup=()=>{e._underlineCommand()},e.$.strikethroughButton.onpointerup=()=>{e._strikethroughCommand()},e.$.colorButton.onpointerup=()=>{const t=e.$.colorButton.style.getPropertyValue("--smart-surface-color");e._openColorMenu(t)},e.$.backgroundButton.onpointerup=()=>{const t=e.$.backgroundButton.style.getPropertyValue("--smart-surface-color");e._openColorMenu(t,!0)},e.$.fontSizeButton.onpointerup=()=>{e._openFontSizeMenu(),e._updateTools()},e.$.fontFamilyButton.onpointerup=()=>{e._openFontFamilyMenu(),e._updateTools()}):(e.$.boldButton.classList.add("smart-hidden"),e.$.italicButton.classList.add("smart-hidden"),e.$.underlineButton.classList.add("smart-hidden"),e.$.strikethroughButton.classList.add("smart-hidden"),e.$.colorButton.classList.add("smart-hidden"),e.$.backgroundButton.classList.add("smart-hidden"),e.$.fontSizeButton.classList.add("smart-hidden"),e.$.fontFamilyButton.classList.add("smart-hidden")),t.users&&t.users.length&&(!1===t.currentUser||null===t.currentUser||void 0===t.currentUser)&&(t.stateSettings.storage&&Object.keys(t.stateSettings.storage).length,t.stateSettings.enabled),"scheduler"===t.view||"timeline"===t.view?(e.$.resourceButton.classList.add("smart-hidden"),e.grid._dateStackedBy&&e.$.resourceButton.classList.remove("smart-hidden"),e.$.labelButton.classList.add("smart-hidden"),e.grid._dateStackedBy&&e.$.labelButton.classList.remove("smart-hidden")):(e.$.labelButton.classList.add("smart-hidden"),e.$.resourceButton.classList.add("smart-hidden")),e.$.labelButton.onpointerup=a=>{t.closeMenu(),e._openLabelMenu(),a.stopPropagation()},e.$.resourceButton.onpointerup=a=>{t.closeMenu(),e._openResourceMenu(),a.stopPropagation()},e.$.downloadButton.onpointerup=a=>{t.closeMenu(),e._openDownloadMenu(),a.stopPropagation()},e.$.viewsButton.onpointerup=a=>{t.closeMenu(),e._openViewsMenu(),a.stopPropagation()},!1===t.appearance.showViewBarAsDropdown&&(e.$.viewStatesButton.onpointerup=a=>{t.closeMenu(),e._closeDownloadMenu(),e._closeViewsMenu(),e._closeResourceMenu(),e._closeLabelMenu(),e._closeColorMenu(),e._closeFontSizeMenu(),e._closeFontFamilyMenu(),t.appearance.showViewBar=!t.appearance.showViewBar,a.stopPropagation(),e._updateViews()}),t._sortedColumns){const a=[],o=[],s=[];for(let e=0;e<t._sortedColumns.length;e++){const n=t._sortedColumns[e];a.push(n.dataField),o.push(n.sortOrder),s.push(n.dataType)}e._appliedSorting={dataFields:a,dataTypes:s,orderBy:o},e._refreshSortButton()}if("scheduler"!==t.view&&"timeline"!==t.view&&"kanban"!==t.view||e.$.sortButton.classList.add("smart-hidden"),"grid"===t.view||"card"===t.view||"scheduler"===t.view||"timeline"===t.view||"kanban"===t.view){const a={filters:[],operator:"and"},o=t.getFilteredColumnsByDataField();if(o)for(let e in o){const t=o[e];for(let o=0;o<t.filters.length;o++){const s=t.filters[o];a.filters.push([e,s.condition,s.value])}}e._appliedFiltering&&(a.operator=e._appliedFiltering.operator),e._appliedFiltering=a,e._refreshFilterButton()}e._appliedGrouping?e._appliedGrouping.dataFields=t.dataSource.groupBy:e._appliedGrouping={dataFields:t.dataSource.groupBy,expandAll:!1,collapseAll:!1},e._refreshCustomButton(),e._refreshAIButton(),e._refreshGroupButton(),e._refreshDeleteButton(),e._refreshDownloadButton(),e._refreshResourceButton(),e._refreshLabelButton(),e._refreshCustomizeButton(),e._refreshViewsButton(),e._refreshColorsButton(),e.refreshTools(),Smart.Utilities.Core.isMobile,!1===t.editing.enabled&&(e.$.customButton.classList.add("smart-hidden"),e.$.downloadButton.classList.add("smart-hidden"),e.$.resourceButton.classList.add("smart-hidden"),e.$.labelButton.classList.add("smart-hidden"),e.$.viewsButton.classList.add("smart-hidden"))}_refreshCustomButton(){const e=this,t=e.grid;t.header.customButton.visible?(e.$.customButton.style.paddingLeft="0px",e.$.customButton.classList.remove("smart-hidden")):e.$.customButton.classList.add("smart-hidden"),t.header.customButton.enabled?e.$.customButton.classList.remove("smart-disabled"):e.$.customButton.classList.add("smart-disabled"),e.$.customButton.innerHTML=`<span class="smart-grid-icon show ${t.header.customButton.icon}"></span><div class="smart-tool-label" role="presentation">${t.header.customButton.label}</div>`,e.$.customButton.onclick=()=>{t.header.customButton.command&&t.header.customButton.command()};for(let a=0;a<t.header.buttons.length;a++){const o=t.header.buttons[a];if("object"==typeof o){const t=e.$.customButton.cloneNode(!0);t.classList.remove("smart-hidden"),t.style.paddingLeft="0px",e.$.customButton.parentNode.insertBefore(t,e.$.customButton),o.label&&(t.querySelector(".smart-tool-label").innerHTML=o.label),o.icon&&(t.querySelector(".smart-grid-icon").className="smart-grid-icon show "+o.icon),t.onclick=()=>{o.command&&o.command()}}}}_refreshViewsButton(){const e=this;if(!e.grid)return;let t=e.grid.localize("viewGrid");switch(e.$.viewsButton.classList.remove("kanban"),e.$.viewsButton.classList.remove("card"),e.$.viewsButton.classList.remove("scheduler"),e.$.viewsButton.classList.remove("timeline"),e.grid.view){case"kanban":t=e.grid.localize("viewKanban"),e.$.viewsButton.classList.add("kanban");break;case"grid":t=e.grid.localize("viewGrid");break;case"card":e.$.viewsButton.classList.add("card"),t=e.grid.localize("viewCard");break;case"scheduler":e.$.viewsButton.classList.add("scheduler"),t=e.grid.localize("viewScheduler");break;case"timeline":e.$.viewsButton.classList.add("timeline"),t=e.grid.localize("viewTimeline")}e.$.viewsButton.innerHTML='<div class="smart-tool-label" role="presentation">'+t+"</div>";let a=this.grid.stateSettings.current||"";if(a.length>30)a=a.substring(0,30)+"...";else if(!a){let e=[],t=this.grid.view,o="";switch(t){case"grid":o=this.grid.localize("viewGrid");break;case"kanban":o=this.grid.localize("viewKanban");break;case"card":o=this.grid.localize("viewCard");break;case"scheduler":o=this.grid.localize("viewScheduler");break;case"timeline":o=this.grid.localize("viewTimeline")}if(this.grid&&this.grid.stateSettings.storage)for(;this.grid.stateSettings.storage[o+" "+this.grid.localize("view")+" "+e[t]];)e[t]++;void 0===e[t]&&(e[t]=""),a=o+" "+this.grid.localize("view")+" "+e[t]}const o=""!==a?a:this.grid.localize("views");e.$.viewStatesButton.innerHTML='<div class="smart-tool-label" role="presentation">'+o+"</div>"}_refreshDownloadButton(){const e=this;e.$.downloadButton.innerHTML='<div class="smart-tool-label" role="presentation"></div>',e.$.downloadButton.title=e.grid.localize("download")}_refreshDeleteButton(){let e=this;if(e.getSelectedRows||(e=e.grid),-1===e.header.buttons.indexOf("delete"))return;const t=e.getSelectedRows().length,a=e.$.headerBar.$.deleteButton,o=a.closest("smart-grid");(!o||o._currentUser&&(!o._currentUser||o._currentUser.info&&"guest"!==o._currentUser.info))&&0!==t?(!0===e.editing.enabled?a.classList.remove("smart-hidden"):a.classList.add("smart-hidden"),a.firstElementChild.innerHTML=1===t?e.localize("deleteByOne"):e.localize("deleteByMultiple",{n:t}),a.classList.add("selected"),a.onclick=()=>{const t=e.getSelectedRows().map((e=>e[0]));this.grid.removeRow(t)}):a.classList.add("smart-hidden")}_refreshFromSelection(){this.$.headerBar._refreshDeleteButton()}openGroupPanel(e){const t=this;let a;const o=t.grid;if("kanban"===o.view||"scheduler"===o.view||"timeline"===o.view)return;t.$.headerDropDown.classList.add("group-panel"),t.$.headerDropDown.classList.remove("view-panel","colors-panel","customize-panel","filter-panel","sort-panel","search-panel","format-panel"),t.$.group.classList.remove("smart-hidden"),t.$.filter.classList.add("smart-hidden"),t.$.customize.classList.add("smart-hidden"),t.$.sort.classList.add("smart-hidden"),t.$.colors.classList.add("smart-hidden"),t.$.search.classList.add("smart-hidden"),t.$.format.classList.add("smart-hidden"),t.$.view.classList.add("smart-hidden"),t.$.ai.classList.add("smart-hidden"),t._closeDownloadMenu(),t._closeViewsMenu(),t._closeResourceMenu(),t._refreshColumns("group"),o.closeMenu();const s=t.columns.map((e=>{const a=Object.assign({},e);if(t._appliedGrouping&&t._appliedGrouping.dataFields){const e=t._appliedGrouping.dataFields.indexOf(a.dataField);a.groupIndex=e}return a})).filter((e=>e.allowGroup));e&&t._appliedGrouping&&-1===t._appliedGrouping.dataFields.indexOf(e.dataField)&&(s.find((t=>t.dataField===e.dataField)).groupIndex=t._appliedGrouping.dataFields.length),t._groupPartCreated?(a=t.$.group.firstElementChild,a.rightToLeft=t.rightToLeft,a.dataSource=s,a.locale=t.locale,a.messages=t._innerElementMessages.groupPanel):(a=document.createElement("smart-group-panel"),a.rightToLeft=t.rightToLeft,a.animation=t.animation,a.locale=t.locale,a.messages=t._innerElementMessages.groupPanel,a.theme=t.theme,a.dataSource=s,t.$.group.appendChild(a),t._groupPartCreated=!0,a.onExpandAll=()=>{if(t._appliedGrouping.expandAll)return t._appliedGrouping.expandAll=!1,void a.querySelector(".smart-group-panel-expand-button").removeAttribute("active");t._appliedGrouping.expandAll=!0,t._appliedGrouping.collapseAll=!1,a.querySelector(".smart-group-panel-expand-button").setAttribute("active",""),a.querySelector(".smart-group-panel-collapse-button").removeAttribute("active")},a.onCollapseAll=()=>{if(t._appliedGrouping.collapseAll)return t._appliedGrouping.collapseAll=!1,void a.querySelector(".smart-group-panel-collapse-button").removeAttribute("active");t._appliedGrouping.expandAll=!1,t._appliedGrouping.collapseAll=!0,a.querySelector(".smart-group-panel-collapse-button").setAttribute("active",""),a.querySelector(".smart-group-panel-expand-button").removeAttribute("active")},a.addEventListener("apply",(e=>{const a=e.detail.sortByInfo,s=t._appliedGrouping.dataFields;t._appliedGrouping.dataFields=a.dataFields;const n=o.onRowInserted;if(o.onRowInserted=null,o.beginUpdate(),o.grouping.autoHideGroupColumn&&s)for(let e=0;e<s.length;e++){const t=o.columnByDataField[s[e]];t&&(t.visible=!0)}o.clearGroups();for(let e=0;e<a.dataFields.length;e++){const t=a.dataFields[e];o.addGroup(t)}t._appliedGrouping.expandAll&&o.expandAllRows(),t._appliedGrouping.collapseAll&&o.collapseAllRows(),o.endUpdate(),o.autoSaveState();const i=[];for(let e=0;e<o.dataSource.groupBy.length;e++)i.push(o.dataSource.groupBy[e]);o.$.fireEvent("group",{groups:i}),o.paging.enabled&&o._refreshPagesCount(),o.onRowInserted=n}))),t._refreshGroupButton(),t._openHeaderDropDown(t.$.groupButton)}_refreshLabelButton(){const e=this;if(e.$.labelButton.innerHTML='<div class="smart-tool-label" role="presentation">'+e.grid.localize("toolLabel")+"</div>",e.$.labelButton.classList.remove("grouped"),e.grid&&e.grid._labeledBy){const t=e.grid.columnByDataField[e.grid._labeledBy];t&&(e.$.labelButton.innerHTML='<div class="smart-tool-label" role="presentation">'+e.grid.localize("toolLabel",{column:t.label})+"</div>",e.$.labelButton.classList.add("grouped"))}else if(e.grid)for(let t=0;t<e.columns.length;t++){const a=e.columns[t];if("string"===a.dataType){e.$.labelButton.innerHTML='<div class="smart-tool-label" role="presentation">'+e.grid.localize("toolLabel",{column:a.label})+"</div>",e.$.labelButton.classList.add("grouped");break}}}_refreshResourceButton(){const e=this;if(e.$.resourceButton.innerHTML='<div class="smart-tool-label" role="presentation">'+e.grid.localize("firstByGroup")+"</div>",e.$.resourceButton.classList.remove("grouped"),e.grid&&e.grid._dateStackedBySelect){const t=e.grid.columnByDataField[e.grid._dateStackedBySelect];t&&(e.$.resourceButton.innerHTML='<div class="smart-tool-label" role="presentation">'+e.grid.localize("groupedBy",{column:t.label})+"</div>",e.$.resourceButton.classList.add("grouped"))}}_refreshAIButton(){const e=this;e.$.aiButton.classList.add("smart-hidden"),-1!==e.grid.header.buttons.indexOf("ai")&&(e.$.aiButton.classList.remove("smart-hidden"),e.$.aiButton.style.paddingLeft="0px",e.$.aiButton.innerHTML='<div class="smart-tool-label" role="presentation" style="padding: 5px;">'+e.grid.localize("addAIFilter")+"</div>")}_applyAI(){const e=this,t=e.grid;e.closePanel();const a=e.$.ai.firstElementChild,o=a.getAIInstructions();if(t.beginUpdate(),o&&o.sort&&o.sort.length>0){t.clearSort();const e=o.sort;for(let a=0;a<e.length;a++){const o=e[a],s=o.field,n=o.order;t.sortBy(s,n)}}if(o&&o.filters&&o.filters.length>0&&t._applyJSONFilters(o.filters),o&&o.group&&o.group.length>0){t.clearGroups();let e=o.group.map((e=>e.field));e.length&&e[0]&&t.addGroup(e)}const s=a.$.aiPrompt.value,n=s.indexOf("column")>=0||s.indexOf("cells")>=0;if(t.ai.includeUserPrompts&&(t.ai.userPrompts||(t.ai.userPrompts=[]),t.ai.userPrompts.push(s)),o&&o.format&&o.format.length>0){const e=o.format;let a={};for(let o=0;o<e.length;o++){const s=e[o],i=s.field;if(i&&n)a[i]||(a[i]=[]),a[i].push({field:i,condition:s.condition,value:s.value,value2:s.value2,background:s.background,color:s.color,textDecoration:s.textDecoration});else for(let e=0;e<t.columns.length;e++){const o=t.columns[e];a[o.dataField]||(a[o.dataField]=[]),a[o.dataField].push({field:i,condition:s.condition,value:s.value,value2:s.value2,background:s.background,color:s.color,textDecoration:s.textDecoration})}}for(let e=0;e<t.columns.length;e++)t.columns[e].cellsCSSInlineRules=null;for(let e in a){const o=t.columnByDataField[e];o&&(o.cellsCSSInlineRules=a[e])}}if(o&&o.edit&&o.edit.length>0){const e=o.edit;for(let a=0;a<e.length;a++){const o=e[a],s=o.row,n=o.value,i=o.field;s>=0&&(t.setCellValue(s,i,n),t.flashCell(s,i))}}t.endUpdate()}openAIPanel(){const e=this,t=e.grid;let a;if(e.$.headerDropDown.classList.add("ai-panel"),e.$.headerDropDown.classList.remove("view-panel","search-panel","colors-panel","customize-panel","filter-panel","sort-panel","group-panel","format-panel"),e.$.search.classList.add("smart-hidden"),e.$.customize.classList.add("smart-hidden"),e.$.group.classList.add("smart-hidden"),e.$.filter.classList.add("smart-hidden"),e.$.sort.classList.add("smart-hidden"),e.$.colors.classList.add("smart-hidden"),e.$.format.classList.add("smart-hidden"),e.$.view.classList.add("smart-hidden"),e.$.ai.classList.remove("smart-hidden"),e._aiPartCreated)a=e.$.ai.firstElementChild,a.set("locale",e.locale),a.messages=e._innerElementMessages.multiColumnFilterPanel,a.editorPlaceholder=e.localize("aiPrompt"),a.$.applyButton.classList.add("smart-disabled"),a.$.aiResponse.innerHTML=`${t.localize("noAIResponse")}`,a.$.addFilterButton.classList.remove("smart-hidden"),a.$.aiPrompt.classList.remove("smart-hidden"),a.$.aiResponse.classList.add("smart-hidden"),a.$.itemsContainer.querySelectorAll(".smart-ai-tab")[0].classList.add("active"),a.$.itemsContainer.querySelectorAll(".smart-ai-tab")[1].classList.remove("active"),a.$.aiPrompt.value="",a.$.spinner.innerHTML="",a.$.spinner.classList.add("smart-hidden"),a._applyValue(),a.rightToLeft=e.rightToLeft;else{a=document.createElement("smart-grid-ai-panel"),a.rightToLeft=e.rightToLeft,a.animation=e.animation,a.locale=e.locale,a.messages=e._innerElementMessages.multiColumnFilterPanel,a.operator=e._appliedFiltering.operator,a.editorPlaceholder=e.localize("aiPrompt"),a.theme=e.theme,a.value=e._appliedFiltering.filters,e.$.ai.appendChild(a),e._aiPartCreated=!0,a.$.addFilterButton.innerHTML="↑ "+t.localize("send"),a.$.addFilterButton.classList.add("smart-ai-button-send"),a.$.addFilterButton.style.background="var(--smart-ui-state-selected)",a.$.addFilterButton.style.borderRadius="15px",a.$.addFilterButton.style.color="var(--smart-primary)",a.$.addFilterButton.style.padding="6px 14px";const o=a.querySelector(".smart-grid-panel-apply-button");a.$.applyButton=o,o.classList.add("smart-disabled"),a.$.itemsContainer.innerHTML=`<style>\n .smart-ai-tabs {\n display: flex;\n align-items: baseline;\n border-bottom: 1px solid var(--smart-border-color);\n font-family: var(--smart-font-family);\n }\n\n .smart-ai-tab {\n padding: 4px 6px;\n cursor: pointer;\n display: flex;\n color: var(--smart-background-color);\n transition: color 0.2s, border-color 0.2s;\n border-bottom: 2px solid transparent;\n }\n\n .smart-ai-tab:hover {\n color: var(--smart-ui-state-color-hover);\n }\n\n .smart-ai-tab.active {\n color: var(--smart-primary);\n border-bottom-color: var(--smart-primary);\n font-weight: 600;\n }\n\n .smart-ai-response {\n min-height: 80px;\n padding: 10px;\n margin-top: 10px;\n width: 360px;\n user-select: text;\n border-radius: var(--smart-border-radius);\n border: 1px solid var(--smart-border);\n }\n\n </style><div class="smart-ai-tabs">\n <div class="smart-ai-tab active" data-tab="add-filter">\n ${t.localize("addAIFilter")}\n </div>\n <div class="smart-ai-tab" data-tab="response">\n <span class="smart-grid-icon show smart-icon-comment"></span> ${t.localize("aiResponse")}\n </div>\n </div>\n <div class="smart-hidden smart-ai-response">\n ${t.localize("noAIResponse")}\n </div>\n `,a.$.itemsContainer.style.paddingTop="0px",a.$.aiResponse=a.$.itemsContainer.querySelector(".smart-ai-response"),a.$.itemsContainer.querySelectorAll(".smart-ai-tab").forEach((e=>{e.addEventListener("click",(()=>{a.$.itemsContainer.querySelectorAll(".smart-ai-tab").forEach((e=>e.classList.remove("active"))),e.classList.add("active"),"add-filter"===e.getAttribute("data-tab")?(a.$.addFilterButton.classList.remove("smart-hidden"),a.$.aiPrompt.classList.remove("smart-hidden"),a.$.aiResponse.classList.add("smart-hidden")):(a.$.addFilterButton.classList.add("smart-hidden"),a.$.aiPrompt.classList.add("smart-hidden"),a.$.aiResponse.classList.remove("smart-hidden"))}))}))}e._openHeaderDropDown(e.$.aiButton),e._closeDownloadMenu(),e._closeViewsMenu(),e._closeResourceMenu(),e._closeLabelMenu(),e._closeColorMenu(),e._closeFontSizeMenu(),e._closeFontFamilyMenu(),t.closeMenu();const o=e.$.headerDropDown.querySelector("smart-grid-ai-panel");if(o){o.$.addAIFilterButton.classList.remove("smart-hidden"),o.$.aiPrompt.classList.add("smart-hidden"),o.$.aiPrompt.placeholder=t.localize("aiPrompt"),o.$.aiPrompt.classList.toggle("smart-hidden"),o.$.spinner.classList.remove("smart-hidden"),o.$.aiPrompt.focus(),o.$.aiPrompt.maxRows=5,o.$.aiPrompt.style.minHeight="80px",o.$.aiPrompt.style.resize="none",o.$.aiPrompt.parentElement.style.display="flex",o.$.aiPrompt.parentElement.style.flexDirection="column",t.ai&&!t.ai.key&&o.$.aiPrompt.classList.add("smart-disabled");const a=t.ai.prompts||[];if(t.ai.includeUserPrompts&&t.ai.userPrompts)for(let e=0;e<t.ai.userPrompts.length;e++){const o=t.ai.userPrompts[e];-1===a.indexOf(o)&&a.unshift(o)}const s=o.$.aiPrompt,n=o.$.suggestions;s.onpointerdown=()=>{e._dropDownCloseDate=new Date},s.onselectionchange=()=>{e._dropDownCloseDate=new Date},n.innerHTML='<style>\n .smart-ai-suggestion {\n padding: 6px 10px;\n border-bottom: 1px solid var(--smart-border-color);\n cursor: pointer;\n max-width: 360px;\n }\n .smart-ai-suggestion:hover {\n background-color: var(--smart-ui-state-hover);\n }\n .smart-ai-suggestions-container {\n max-height: 200px;\n overflow-y: auto;\n border: 1px solid var(--smart-border-color);\n border-radius: var(--smart-border-radius);\n margin-top: 5px;\n }\n </style>\n <div class="smart-ai-suggestions-container">\n \n </div>';const i=n.querySelector(".smart-ai-suggestions-container");t.ai&&t.ai.key&&a.forEach((e=>{const t=document.createElement("div");t.classList.add("smart-ai-suggestion"),t.innerText=e,t.onclick=()=>{s.value=e,i.classList.add("smart-hidden"),s.focus()},i.appendChild(t)})),s.oninput=()=>{s.value.length>0?i.classList.add("smart-hidden"):i.classList.remove("smart-hidden")},o.$.addFilterButton.onclick=()=>{let a=0;o.$.spinner.classList.remove("smart-hidden");const s=setInterval((()=>{o.$.spinner.innerHTML=`\rThinking${".".repeat(a%4)} `,a++}),500);let n='\nYou are a helpful assistant that converts natural language data manipulation requests\ninto structured JSON instructions for Smart.Grid AND produces a detailed, user-friendly explanation.\n\nImportant:\nThe JSON you produce represents actions that will be applied ONLY AFTER the user clicks "Apply".\nTherefore, all natural-language explanations must describe what *will happen* once the user applies the changes.\nDo not describe the action as already completed.\n\nUse only these columns:\n';for(let t=0;t<e.columns.length;t++){const a=e.columns[t];(a.allowFilter||a.allowSort||a.allowGroup||a.allowFormat)&&(n+="- "+a.label+" ("+a.dataType+") => "+a.dataField+"\\n")}const i=t.getSelection();let r=i.rows||[],l=i.columns||[],d=i.cells||[];d&&(d=d.map((e=>({row:e.row.id,column:e.column.label,value:e.row.data[e.dataField]})))),r&&(r=r.map((e=>e.id))),l&&(l=l.map((e=>t.columnByDataField[e].label)));let c={};t.getColumnStatistics=e=>{const a=t.getData().map((t=>t[e])).filter((e=>null!=e&&""!==e));if(0===a.length)return{};const o=a.filter((e=>"number"==typeof e)),s={count:a.length,uniqueCount:new Set(a).size};if(o.length>0){const e=o.reduce(((e,t)=>e+t),0),t=e/o.length,a=Math.min(...o),n=Math.max(...o);s.sum=e,s.average=t,s.min=a,s.max=n,s.range=n-a}return s};let u={};for(let a=0;a<e.columns.length;a++){const o=e.columns[a],s=t.getColumnStatistics(o.dataField);c[o.label]=s,o.options&&Array.isArray(o.options)&&(u[o.label]=o.options.map((e=>"object"==typeof e&&null!==e?void 0!==e.label?e.label:e.value:e)))}const m=t._rowElements.filter((e=>!e.classList.contains("smart-hidden"))).map((e=>e.row.data)).map((t=>{const a={};for(let o=0;o<e.columns.length;o++){const s=e.columns[o];a[s.label]=t[s.dataField]}return a}));n+=`\n visibleRows: ${JSON.stringify(m)}\n datasetStats: ${JSON.stringify(c)}\n columnOptions: ${JSON.stringify(u)}\n CurrentSelection: rows: ${JSON.stringify(r)}, columns: ${JSON.stringify(l)}, cells: ${JSON.stringify(d)}\n\n If datasetStats lacks the required numbers for a requested metric, the assistant MUST exclude that metric rather than invent numbers.\n\nThe user may request any combination of the following actions: filtering, sorting, grouping, conditional formatting, editing or summarization.`,n+='\nSupported filter operators:\n CONTAINS, EQUAL, NOT_EQUAL, GREATER_THAN, LESS_THAN,\n GREATER_THAN_OR_EQUAL, LESS_THAN_OR_EQUAL, STARTS_WITH, ENDS_WITH\n\nRespond in this format for Filtering\n[\n {\n "field": "dataField",\n "operator": "some operator",\n "value": "some value",\n "type": "some type",\n "logic": "AND }\n]\nWhen the user requests to clear or remove or delete the Filtering\nRespond in this format for Filtering\n[\n {\n "field": null,\n "operator": "null,\n "value": null,\n "type": null,\n "logic": null\n }\n]\nSupported types:\n string, number, date, boolean\n\nThe assistant MUST understand and support operations on the user\'s current selection.\nA selection may include rows, columns, or specific cells.\n\nEDIT RULE: \nSupported edit actions include:\n- fill_empty: Fill empty cells using a source (e.g., from selection, constant value, or text).\n- translate: Translate text in the selected cells or columns.\n- replace_values: Replace or modify values inside the selection or target columns.\n- transform_text: Apply transformations such as uppercase, lowercase, trim, etc.\n\nThe assistant MUST check columnOptions when performing edit actions to ensure the requested action is allowed on the target column(s).\n\nOPTION-CONSTRAINT RULE FOR EDITING:\nSome columns contain restricted, predefined allowed values (options list).\n\nWhen performing an edit action (fill_empty, translate, replace_values, transform_text):\n- The assistant MUST verify that the target value is one of the allowed options if the column contains predefined options.\n- The assistant MUST NOT write a value that does not exist in the options list.\n- The assistant MUST NOT invent new options.\n- If a requested value is not part of the options list, the assistant MUST reply in HTML to request clarification rather than performing the edit.\n\n\nWhen the user requests an action involving selected cells, the assistant MUST include \nthe appropriate "edit" instructions in the JSON.\n\nWhen the user requests an edit action (fill, translate, replace, transform), the assistant MUST compute the actual resulting values for the affected cells using the visible data or selection provided.\nThe assistant MUST place these computed results inside the edit object.\nThe assistant MUST NOT output formulas, instructions, or placeholders. Only the final, edited values are allowed.\n\nRespond in this format for Editing\n[\n {\n "field": "dataField",\n "row": "some row id",\n "oldValue": "some old value",\n "value": "some value",\n "type": "some type",\n "editAction": "fill_empty/translate/replace_values/transform_text }\n]\n\nSORT RULE:\nWhen the user requests sorting (“sort by”, “order by”, etc.):\nRespond in this format for Sorting\n[\n {\n "field": "dataField",\n "order": "asc/desc"\n }\n]\nWhen the user requests to clear or remove or delete the sorting\nRespond in this format for Sorting\n[\n {\n "field": null,\n "order": null\n }\n]\nGROUP RULE:\nWhen the user requests grouping (“group by”, “categorize by”, etc.):\nRespond in this format for Grouping\n[\n {\n "field": "dataField"\n }\n]\nWhen the user requests to clear or remove or delete the grouping\nRespond in this format for Grouping\n[\n {\n "field": null\n }\n]\nFORMAT RULE (STRICT):\n\nWhen the user requests conditional formatting (“highlight”, “color code”, “format”, etc.):\nYou MUST respond ONLY in this exact JSON structure:\n\n[\n {\n "field": "dataField",\n "condition": "=/<>/<=/>=/</>/between",\n "value": "STRING or NUMBER or DATE or BOOLEAN",\n "background": "some color",\n "color": "some color",\n "textDecoration": "none" or "underline" or "line-through",\n }\n]\n\nif the user requests formatting for a RANGE of values (e.g., "between 10 and 20"):\nYou MUST add condition2 and value2 keys to the JSON structure like this:\n\n[\n {\n "field": "dataField",\n "condition": "between",\n "value": "lower bound STRING or NUMBER or DATE or BOOLEAN",\n "value2": "upper bound STRING or NUMBER or DATE or BOOLEAN",\n "background": "some color",\n "color": "some color",\n "textDecoration": "none" or "underline" or "line-through",\n }\n]\n\nCLEARING FORMATTING:\nWhen the user requests to clear, remove, or delete formatting:\nYou MUST respond ONLY in this structure:\n\n[\n {\n "field": null,\n "condition": "=",\n "value": "",\n "background": null,\n "color": null,\n "textDecoration": null,\n }\n]\n\nADDITIONAL STRICT RULES:\n- Do NOT add extra keys.\n- Do NOT omit required keys.\n- Do NOT output explanations, text, or comments — ONLY the JSON.\n- “condition” MUST be one of: =, <>, <, <=, >, >=.\n- “value” MUST be a STRING, NUMBER, DATE, or BOOLEAN literal.\n- Colors MUST be written as strings.\n\nSUMMARY RULE:\nWhen the user requests a summary (“give me a summary”, “summarize my data”,\n“show totals/averages/count”, etc.):\n\n1. You MUST compute actual numeric results using datasetStats and/or selection.\n - Place these results inside the "summary" JSON object.\n - NEVER output formulas or operations.\n\n2. You MUST generate a full natural-language summary report in the "message" field.\n The report MUST:\n - Use PRESENT TENSE (because summary is computed immediately).\n - Describe totals, averages, minimums, maximums, counts, and ranges.\n - Highlight notable patterns IF AND ONLY IF the stats allow it.\n - Be narrative, readable, and helpful.\n - NOT hallucinate any values not present in datasetStats or selection.\n\nYour task:\nConvert user requests about filtering, sorting, grouping, conditional formatting, editing, \nor summarization into a structured JSON format AND produce a verbose, friendly explanation.\n\nRespond ONLY in this structure:\n\n{\n "json": {\n "filters": [...],\n "sort": [...],\n "group": [...],\n "format": [...],\n "summary": {},\n "edit": []\n },\n "message": "A detailed explanation using FUTURE TENSE, describing what the changes will do once applied. The mssage should be in HTML Format. The explanation MUST be a well-structured HTML message with short paragraphs and bullet points when appropriate. It MUST NOT exceed 200 words unless summarization requires more"\n}\n\nGuidelines for the natural-language \'message\':\n- Use future tense: “will filter”, “will highlight”, “will sort”, etc.\n- Summary results are computed immediately and DO NOT depend on the Apply button.\n Therefore, the explanation for summaries may use PRESENT TENSE (e.g., “The total is 2300”).\n- Do NOT imply the action has already happened.\n- Explain clearly what the user should expect AFTER applying the settings.\n- Be helpful, descriptive, and user-friendly.\n- Avoid referencing JSON or internal logic.\n\nThe assistant MUST NOT invent additional JSON keys or structures.\nIf the user requests an unsupported action, the assistant MUST politely decline.\n\nIf the user request is ambiguous, the assistant MUST reply with a polite clarifying question\ninstead of guessing the action.\n\nIf the user asks a general question, tutorial question, or conceptual question that does NOT request\nfiltering, sorting, grouping, conditional formatting, editing, or summarization,\nthe assistant MUST NOT generate JSON.\n\nInstead, the assistant MUST reply with a natural-language explanation in HTML format.\n\nIf the user asks for help, instructions, or examples, the assistant MUST NOT perform actions.\nThe assistant MUST explain concepts in HTML using concise, user-friendly language.\n',t.ai.getAIResponse=async function(e,a){const o=t.ai.key,s=t.ai.url||"https://api.openai.com/v1/chat/completions",n={"Content-Type":"application/json",Authorization:`Bearer ${o}`},i={model:t.ai.model||"gpt-3.5-turbo",messages:[{role:"system",content:e},{role:"user",content:a}],temperature:.7,max_tokens:1e3},r=await fetch(s,{method:"POST",headers:n,body:JSON.stringify(i)});return(await r.json()).choices[0].message.content};try{t.ai.getAIResponse(n,o.$.aiPrompt.value).then((e=>{let a,n=t.localize("noAIResponse");try{const t=e.indexOf("{");a=JSON.parse(e.substring(t)),a.message&&(n=a.message)}catch(e){a={filters:[]}}if(o.$.aiResponse.innerHTML=n,o.$.spinner.innerHTML="",o.$.spinner.classList.add("smart-hidden"),clearInterval(s),o.$.itemsContainer.querySelector('.smart-ai-tab[data-tab="response"]').click(),a.json){const e=a.json.filters,t=a.json.sort,s=a.json.group,n=a.json.format,i=a.json.summary,r=a.json.edit;o.getAIInstructions=()=>({filters:e||[],sort:t||[],group:s||[],format:n||[],summary:i||{},edit:r||[]}),o.$.applyButton.classList.remove("smart-disabled")}}))}catch(e){o.$.spinner.innerHTML=t.localize("noResults"),clearInterval(s)}},o.$.applyButton.onclick=()=>{o.$.applyButton.classList.contains("smart-disabled")||e._applyAI()}}}_refreshGroupButton(){const e=this,t=e._appliedGrouping.dataFields?e._appliedGrouping.dataFields.length:0;if(e.grid&&"kanban"===e.grid.view){e.$.groupButton.onclick=()=>{"kanban"===e.grid.view&&e.grid._initKanbanView("dynamic","kanban")};const t=e.grid.columnByDataField[e.grid._stackedBy];return t?(e.$.groupButton.firstElementChild.innerHTML=e.localize("groupedBy",{column:t.label}),e.$.groupButton.classList.add("grouped")):e.$.groupButton.classList.remove("grouped"),void e.$.groupButton.classList.remove("scheduler")}if(!e.grid||"scheduler"!==e.grid.view&&"timeline"!==e.grid.view){if(0===t){const t=e.localize("group");return e.$.groupButton.firstElementChild.innerHTML!==t&&(e.$.groupButton.firstElementChild.innerHTML=t),void e.$.groupButton.classList.remove("grouped")}e.$.groupButton.firstElementChild.innerHTML=1===t?e.localize("groupedByOne"):e.localize("groupedByMultiple",{n:t}),e.$.groupButton.classList.add("grouped")}else if(e.$.groupButton.onclick=()=>{"scheduler"!==e.grid.view&&"timeline"!==e.grid.view||e.grid._createScheduler("update")},e.grid._dateStackedBy&&Array.isArray(e.grid._dateStackedBy)){const t=e.grid.columnByDataField[e.grid._dateStackedBy[0]].label,a=e.grid.columnByDataField[e.grid._dateStackedBy[1]].label;e.$.groupButton.firstElementChild.innerHTML=e.localize("schedulerToolLabel",{column:t+"-"+a}),e.$.groupButton.classList.add("scheduler"),e.$.groupButton.classList.add("grouped")}else{const t=e.grid.columnByDataField[e.grid._dateStackedBy];t?(e.$.groupButton.firstElementChild.innerHTML=e.localize("schedulerToolLabel",{column:t.label}),e.$.groupButton.classList.add("scheduler"),e.$.groupButton.classList.add("grouped")):e.$.groupButton.classList.remove("grouped")}}openSearchPanel(){this._openSearchPanel()}_closeSearchPanel(){this._search(this.$.searchInput.value,!1),super._closeSearchPanel()}_openSearchPanel(){const e=this,t=e.grid;if(e.$.headerDropDown.classList.add("search-panel"),e.$.headerDropDown.classList.remove("view-panel","colors-panel","customize-panel","filter-panel","sort-panel","group-panel","format-panel"),e.$.search.classList.remove("smart-hidden"),e.$.customize.classList.add("smart-hidden"),e.$.group.classList.add("smart-hidden"),e.$.filter.classList.add("smart-hidden"),e.$.sort.classList.add("smart-hidden"),e.$.colors.classList.add("smart-hidden"),e.$.format.classList.add("smart-hidden"),e.$.view.classList.add("smart-hidden"),e.$.ai.classList.add("smart-hidden"),e._openHeaderDropDown(e.$.searchButton),e._closeDownloadMenu(),e._closeViewsMenu(),e._closeResourceMenu(),e._closeLabelMenu(),e._closeColorMenu(),e._closeFontSizeMenu(),e._closeFontFamilyMenu(),t.closeMenu(),"filter"===t.header.searchCommand){const t=e.$.headerDropDown.querySelector(".smart-data-view-search-prev"),a=e.$.headerDropDown.querySelector(".smart-data-view-search-next");t.classList.add("smart-hidden"),a.classList.add("smart-hidden")}const a=[],o=t.getVisibleRows();for(let e=0;e<o.length;e++)a.push(Object.assign(o[e].data));const s=new Smart.DataAdapter({id:"id",observable:!1,dataSource:a,dataFields:t.dataSource.dataFields});e._searchInfo={source:s,stringDataFields:e.dataSource.dataFields.filter((e=>"string"===e.dataType)).map((e=>e.name))},""!==e.$.searchInput.value&&e._search(e.$.searchInput.value,!1)}addColors(e,t,a){const o=this,s=o.grid;let n=[e,t],i=[];if(o.closePanel(),JSON.stringify(n)===JSON.stringify(o._appliedColors))return;o._appliedColors=n;const r=[],l=o.grid.getRows();for(let e=0;e<l.length;e++)r.push(Object.assign(l[e].data));if("conditions"===t.type){const t=new Smart.DataAdapter({id:"id",observable:!1,dataSource:r,dataFields:o.grid.dataSource.dataFields});t._filter(a,"or");const n=[];for(let e=0;e<t.length;e++){const a=t[e];!1!==a.$.filtered&&n.push(a)}const l=e,d=[];for(let e=0;e<l.length;e++){const t=l[e],a=t[0],o=t[1],n=t[3]?t[2]:void 0,i=t[3]?t[3]:t[2],r=s.columnByDataField[a].dataType,c=new Smart.Utilities.FilterGroup,u=c.createFilter(r,n,o);c.addFilter("or",u),d.push({dataField:a,color:i,filterGroup:c})}for(let e=0;e<n.length;e++){const t=n[e];for(let e=0;e<d.length;e++){const a=d[e].dataField,o=d[e].filterGroup,s=d[e].color,n=t[a];o.evaluate(n)&&(void 0===i[t.$.id]&&(i[t.$.id]={}),i[t.$.id].color=s,i[t.$.id][a]=s)}}}else{const e=t.singleSelect,a=s.columnByDataField[e];if(!a)return s._conditionalColors={colors:[],type:t.type,conditions:[],update:e=>{o._updateConditionalColors(e,s,t)},singleSelect:t.singleSelect,decorate:t.decorate},s._recycle(),o._refreshColorsButton(),void(s._onColors&&s._onColors(s._conditionalColors));const n="collaborator"===a.template?s.users:a.editor.dataSource,r={};n.forEach((e=>"collaborator"===a.template?(void 0===e.id||(r[e.id]=e.color),!0):!e.value||void(r[e.value]=e.color)));for(let t=0;t<l.length;t++){const a=l[t].data,o=a[e],s=r[o];s&&(i[a.$.id]={color:s})}}s._conditionalColors={colors:i,type:t.type,conditions:e,update:e=>{o._updateConditionalColors(e,s,t)},singleSelect:t.singleSelect,decorate:t.decorate},s._recycle(!1),o._refreshColorsButton(),s.autoSaveState(),o.$.fireEvent("colors"),s._onColors&&s._onColors(s._conditionalColors)}_updateConditionalColors(e,t,a){let o=[];const s=t.getRows();if("conditions"===a.type){const a=t._conditionalColors.conditions,n=[];for(let e=0;e<a.length;e++){const o=a[e],s=o[0],i=o[1],r=o[3]?o[2]:void 0,l=o[3]?o[3]:o[2],d=t.columnByDataField[s];if(d){const e=d.dataType,t=new Smart.Utilities.FilterGroup,a=t.createFilter(e,r,i);t.addFilter("or",a),n.push({dataField:s,color:l,filterGroup:t})}}const i=e=>{for(let t=0;t<n.length;t++){const a=n[t].dataField,s=n[t].filterGroup,i=n[t].color,r=e[a];s.evaluate(r)?(void 0===o[e.$.id]&&(o[e.$.id]={}),o[e.$.id].color=i,o[e.$.id][a]=i):delete o[e.$.id]}};if(e)o=t._conditionalColors.colors,i(e.data);else for(let e=0;e<s.length;e++)i(s[e].data)}else{const n=a.singleSelect,i=t.columnByDataField[n];if(i){const a="collaborator"===i.template?t.users:i.editor.dataSource,r={};if(a.forEach((e=>"collaborator"===i.template?(void 0===e.id||(r[e.id]=e.color),!0):!e.value||void(r[e.value]=e.color))),e){o=t._conditionalColors.colors,o||(o=t._conditionalColors.colors=[]);const a=e.data,s=a[n],i=r[s];i?o[a.$.id]={color:i}:delete o[a.$.id]}else for(let e=0;e<s.length;e++){const t=s[e].data,a=t[n],i=r[a];i&&(o[t.$.id]={color:i})}}}t._conditionalColors.colors=o,t.autoSaveState(),t.summaryRow.visible||t._recycle(!1)}_search(e,t=!0){const a=this;if(!a._searchInfo)return;if(a._searchInfo.query=e,""===e)return a.$.search.classList.remove("matches","no-matches"),delete a._searchInfo.foundIdsArray,delete a._searchInfo.foundIdsObject,delete a._searchInfo.highlighted,a.grid.highlighted=null,a.grid._recycle(!1),void("filter"===a.grid.header.searchCommand&&a.grid.clearFilter());const o=a._searchInfo.source,s=[],n=[],i={};a._searchInfo.stringDataFields.forEach((t=>{const a=new Smart.Utilities.FilterGroup,o=a.createFilter("string",e,"CONTAINS");a.addFilter("or",o),s.push([t,a])})),o._filter(s,"or");for(let e=0;e<o.length;e++){const t=o[e];!1!==t.$.filtered&&(n.push(t.$.id),i[t.$.id]=!0)}if(a._searchInfo.foundIdsArray=n,a._searchInfo.foundIdsObject=i,a.grid.highlighted=null,"filter"===a.grid.header.searchCommand){a.grid.beginUpdate();const t=a.grid.filtering.operator;return a.grid.filtering.operator="or",a.grid.clearFilter(),a._searchInfo.stringDataFields.forEach((t=>{const o=new Smart.Utilities.FilterGroup,s=o.createFilter("string",e,"CONTAINS"),n=a.grid.columnByDataField[t];if(n&&n.editor&&n.editor.dataSource)return!1;n&&(o.addFilter("or",s),a.grid.addFilter(t,o),n._filterInfo&&n.filter.filters[0]&&(n._filterInfo.value=n.filter.filters[0].value,n._filterInfo.condition=n.filter.filters[0].condition))})),a.grid.endUpdate(),a.grid.refreshFilters(),void(a.grid.filtering.operator=t)}if(n.length>0)return a.$.search.classList.remove("no-matches"),a.$.search.classList.add("matches"),a.$.searchLabel.innerHTML=a.localize("found",{nth:t?1:0,n:n.length}),a._searchInfo.highlighted||(a._searchInfo.highlighted=n[0]),a.grid.highlighted=a._searchInfo.highlighted,a.grid.ensureVisible(a._searchInfo.highlighted),void a.grid._recycle(!1);a.$.search.classList.remove("matches"),a.$.search.classList.add("no-matches"),a.$.searchLabel.innerHTML=a.localize("found",{nth:0,n:0})}isGrid(){const e=this.grid;return!(e&&("kanban"===e.view&&e._kanban||"scheduler"===e.view&&e._scheduler||"timeline"===e.view&&e._scheduler))}_refreshColorsButton(){const e=this,t=e.grid;let a=0;if(a=t._conditionalColors&&t._conditionalColors.conditions?Object.keys(t._conditionalColors.conditions).length:0,t._conditionalColors&&"singleSelect"===t._conditionalColors.type){a=1;const o=t.columnByDataField[t._conditionalColors.singleSelect];return o?(e.$.colorsButton.innerHTML='<div class="smart-tool-label" role="presentation">'+t.localize("formatingBy",{value:o.label})+"</div>",e.$.colorsButton.classList.add("hidden"),e.$.colorsButton.classList.add("formatted"),void e._refreshMobileViewTools()):(e.$.colorsButton.innerHTML='<div class="smart-tool-label" role="presentation">'+t.localize("formating")+"</div>",e.$.colorsButton.classList.remove("hidden"),void e.$.colorsButton.classList.remove("formatted"))}a>0?(e.$.colorsButton.innerHTML=1===a?'<div class="smart-tool-label" role="presentation">'+t.localize("formatingOne",{n:a})+"</div>":'<div class="smart-tool-label" role="presentation">'+t.localize("formatingByMultiple",{n:a})+"</div>",e.$.colorsButton.classList.add("hidden"),e.$.colorsButton.classList.add("formatted")):(e.$.colorsButton.innerHTML='<div class="smart-tool-label" role="presentation">'+t.localize("formating")+"</div>",e.$.colorsButton.classList.remove("hidden"),e.$.colorsButton.classList.remove("formatted")),e._refreshMobileViewTools()}_refreshCustomizeButton(){const e=this,t=e.grid;let a=0;if(!e.isGrid())return t._kanban&&t._kanban.localize&&(e.$.customizeButton.innerHTML='<div class="smart-tool-label" role="presentation">'+t._kanban.localize("customize")+"</div>",e.$.customizeButton.classList.remove("hidden")),void e.$.customizeButton.classList.add("smart-hidden");for(let e=0;e<t.columns.length;e++){const o=t.columns[e];o&&(o.autoGenerated||!1!==o._visible&&(t.grouping&&t.grouping.autoHideGroupColumn&&t.dataSource.groupBy.indexOf(o.dataField)>=0||o.visible||a++))}a>0?(e.$.customizeButton.innerHTML=1===a?'<div class="smart-tool-label" role="presentation">'+t.localize("customizeOne",{n:a})+"</div>":'<div class="smart-tool-label" role="presentation">'+t.localize("customizeHidden",{n:a})+"</div>",e.$.customizeButton.classList.add("hidden")):(e.$.customizeButton.innerHTML='<div class="smart-tool-label" role="presentation">'+t.localize("customize")+"</div>",e.$.customizeButton.classList.remove("hidden")),e._refreshMobileViewTools()}_applyColumns(e,t){const a=this,o=a.grid;o.beginUpdate();let s=0,n=[],i=[],r=[];const l=o.onColumnChange;o.onColumnChange=null;for(let t in e){const a=e[t],l=o.columnByDataField[a.dataField];l&&(l.visible!==a.visible&&(n.push(a),i.push(l.visible),r.push(a.visible)),l.visible=a.visible,a.visible||s++)}o.onColumnChange=l,o.onColumnChange?o.onColumnChange(n,"visible",i,r):o.$.fireEvent("columnChange",{column:n,propertyName:"visible",oldValue:i,value:r}),s>0?(a.$.customizeButton.innerHTML='<div class="smart-tool-label" role="presentation">'+o.localize("customizeHidden",{n:s})+"</div>",a.$.customizeButton.classList.add("hidden")):(a.$.customizeButton.innerHTML='<div class="smart-tool-label" role="presentation">'+o.localize("customize")+"</div>",a.$.customizeButton.classList.remove("hidden"));for(let e=0;e<t.length;e++){const a=t[e],s=a.oldIndex,n=a.newIndex,i=o.columns[n+1],r=o.columns[n-1],l=o.columns[s];i?l.columnGroup=i.columnGroup:r&&(l.columnGroup=r.columnGroup),o.reorderColumns(s,n,!0)}if(o.filtering.enabled&&o.filtering.filterRow)for(let e=0;e<o.columns.length;e++)o.columns[e]._filterEditorInitialized=!1;o.endUpdate();const d=o.grouping.enabled;d&&o._filters&&o.refreshFilters(d),o.autoSaveState()}});
1541
1541
 
1542
1542
  /***/ }),
1543
1543
 
@@ -1889,7 +1889,7 @@ var __webpack_exports__ = {};
1889
1889
  /* harmony import */ var _smart_grid_core_js__WEBPACK_IMPORTED_MODULE_61__ = __webpack_require__(5306);
1890
1890
  /* harmony import */ var _smart_grid_core_js__WEBPACK_IMPORTED_MODULE_61___default = /*#__PURE__*/__webpack_require__.n(_smart_grid_core_js__WEBPACK_IMPORTED_MODULE_61__);
1891
1891
 
1892
- /* Smart UI v25.0.0 (2025-11-26)
1892
+ /* Smart UI v25.0.1 (2025-11-26)
1893
1893
  Copyright (c) 2011-2025 jQWidgets.
1894
1894
  License: https://htmlelements.com/license/ */ //
1895
1895