smart-webcomponents-react 25.0.1 → 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 +2 -2
  35. package/source/modules/smart.gauge.js +2 -2
  36. package/source/modules/smart.grid.js +6 -6
  37. package/source/modules/smart.gridpanel.js +2 -2
  38. package/source/modules/smart.gridview.js +6 -6
  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 +5 -5
  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 +1 -1
  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 +1 -1
  146. package/source/smart.grid.group.js +1 -1
  147. package/source/smart.grid.js +1 -1
  148. package/source/smart.grid.menu.js +1 -1
  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 +1 -1
  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 +190 -115
  251. package/source/styles/default/smart.dropdownbutton.css +5 -3
  252. package/source/styles/default/smart.grid.css +34 -15
  253. package/source/styles/smart.default.css +2 -2
@@ -1,6 +1,6 @@
1
1
 
2
- /* Smart UI v25.0.2 (2025-11-27)
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
 
6
- (()=>{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="width: ${o}%; background: ${s};">\n <span class="smart-grid-progress-label">${e}</span>\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){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}}})();
6
+ (()=>{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}}})();