smart-webcomponents-react 19.0.0 → 19.0.5

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 (334) hide show
  1. package/chart/ganttchart.d.ts +1 -1
  2. package/ganttchart/ganttchart.d.ts +1 -1
  3. package/ganttchart/ganttchart.esm.js +3 -3
  4. package/ganttchart/ganttchart.umd.js +3 -3
  5. package/index.d.ts +1 -2
  6. package/package.json +1 -1
  7. package/source/modules/smart.3dchart.js +1 -1
  8. package/source/modules/smart.accordion.js +1 -1
  9. package/source/modules/smart.array.js +1 -1
  10. package/source/modules/smart.barcode.js +1 -1
  11. package/source/modules/smart.breadcrumb.js +1 -1
  12. package/source/modules/smart.button.js +1 -1
  13. package/source/modules/smart.buttongroup.js +1 -1
  14. package/source/modules/smart.calendar.js +1 -1
  15. package/source/modules/smart.card.js +1 -1
  16. package/source/modules/smart.cardview.js +3 -3
  17. package/source/modules/smart.carousel.js +1 -1
  18. package/source/modules/smart.chart.js +2 -2
  19. package/source/modules/smart.checkbox.js +1 -1
  20. package/source/modules/smart.checkinput.js +1 -1
  21. package/source/modules/smart.chip.js +1 -1
  22. package/source/modules/smart.colorinput.js +1 -1
  23. package/source/modules/smart.colorpanel.js +1 -1
  24. package/source/modules/smart.colorpicker.js +1 -1
  25. package/source/modules/smart.combobox.js +1 -1
  26. package/source/modules/smart.common.js +2 -2
  27. package/source/modules/smart.countryinput.js +1 -1
  28. package/source/modules/smart.dateinput.js +1 -1
  29. package/source/modules/smart.daterangeinput.js +1 -1
  30. package/source/modules/smart.datetimepicker.js +1 -1
  31. package/source/modules/smart.dockinglayout.js +1 -1
  32. package/source/modules/smart.dropdownbutton.js +1 -1
  33. package/source/modules/smart.dropdownlist.js +1 -1
  34. package/source/modules/smart.editor.js +2 -2
  35. package/source/modules/smart.element.js +1 -1
  36. package/source/modules/smart.fileupload.js +1 -1
  37. package/source/modules/smart.form.js +1 -1
  38. package/source/modules/smart.formulaparser.js +1 -1
  39. package/source/modules/smart.ganttchart.js +4 -4
  40. package/source/modules/smart.gauge.js +1 -1
  41. package/source/modules/smart.grid.js +8 -8
  42. package/source/modules/smart.gridpanel.js +3 -3
  43. package/source/modules/smart.input.js +1 -1
  44. package/source/modules/smart.kanban.js +3 -3
  45. package/source/modules/smart.layout.js +1 -1
  46. package/source/modules/smart.led.js +1 -1
  47. package/source/modules/smart.listbox.js +1 -1
  48. package/source/modules/smart.listmenu.js +1 -1
  49. package/source/modules/smart.map.js +1 -1
  50. package/source/modules/smart.maskedtextbox.js +1 -1
  51. package/source/modules/smart.menu.js +1 -1
  52. package/source/modules/smart.multicomboinput.js +1 -1
  53. package/source/modules/smart.multiinput.js +1 -1
  54. package/source/modules/smart.multilinetextbox.js +1 -1
  55. package/source/modules/smart.multisplitbutton.js +1 -1
  56. package/source/modules/smart.numberinput.js +1 -1
  57. package/source/modules/smart.numerictextbox.js +1 -1
  58. package/source/modules/smart.pager.js +1 -1
  59. package/source/modules/smart.passwordinput.js +1 -1
  60. package/source/modules/smart.passwordtextbox.js +1 -1
  61. package/source/modules/smart.path.js +1 -1
  62. package/source/modules/smart.phoneinput.js +1 -1
  63. package/source/modules/smart.pivottable.js +3 -3
  64. package/source/modules/smart.progressbar.js +1 -1
  65. package/source/modules/smart.qrcode.js +1 -1
  66. package/source/modules/smart.querybuilder.js +1 -1
  67. package/source/modules/smart.radiobutton.js +1 -1
  68. package/source/modules/smart.rating.js +1 -1
  69. package/source/modules/smart.ribbon.js +1 -1
  70. package/source/modules/smart.router.js +2 -2
  71. package/source/modules/smart.scheduler.js +2 -2
  72. package/source/modules/smart.scrollbar.js +1 -1
  73. package/source/modules/smart.slider.js +1 -1
  74. package/source/modules/smart.sortable.js +1 -1
  75. package/source/modules/smart.splitter.js +1 -1
  76. package/source/modules/smart.switchbutton.js +1 -1
  77. package/source/modules/smart.table.js +3 -3
  78. package/source/modules/smart.tabs.js +1 -1
  79. package/source/modules/smart.tank.js +1 -1
  80. package/source/modules/smart.textarea.js +1 -1
  81. package/source/modules/smart.textbox.js +1 -1
  82. package/source/modules/smart.timeinput.js +1 -1
  83. package/source/modules/smart.timepicker.js +1 -1
  84. package/source/modules/smart.toast.js +1 -1
  85. package/source/modules/smart.tooltip.js +1 -1
  86. package/source/modules/smart.tree.js +1 -1
  87. package/source/modules/smart.validator.js +1 -1
  88. package/source/modules/smart.window.js +1 -1
  89. package/source/smart.3dchart.js +1 -1
  90. package/source/smart.accordion.js +1 -1
  91. package/source/smart.ajax.js +1 -1
  92. package/source/smart.array.js +1 -1
  93. package/source/smart.barcode.js +1 -1
  94. package/source/smart.bootstrap.js +1 -1
  95. package/source/smart.breadcrumb.js +1 -1
  96. package/source/smart.button.js +1 -1
  97. package/source/smart.buttongroup.js +1 -1
  98. package/source/smart.calendar.js +1 -1
  99. package/source/smart.card.js +1 -1
  100. package/source/smart.cardview.js +1 -1
  101. package/source/smart.carousel.js +1 -1
  102. package/source/smart.chart.annotations.js +1 -1
  103. package/source/smart.chart.api.js +1 -1
  104. package/source/smart.chart.core.js +1 -1
  105. package/source/smart.chart.js +1 -1
  106. package/source/smart.chart.rangeselector.js +1 -1
  107. package/source/smart.chart.waterfall.js +1 -1
  108. package/source/smart.checkbox.js +1 -1
  109. package/source/smart.checkinput.js +1 -1
  110. package/source/smart.chip.js +1 -1
  111. package/source/smart.colorinput.js +1 -1
  112. package/source/smart.colorpanel.js +1 -1
  113. package/source/smart.colorpicker.js +1 -1
  114. package/source/smart.combobox.js +1 -1
  115. package/source/smart.complex.js +1 -1
  116. package/source/smart.core.js +1 -1
  117. package/source/smart.countryinput.js +1 -1
  118. package/source/smart.data.js +2 -2
  119. package/source/smart.date.js +1 -1
  120. package/source/smart.dateformatpanel.js +1 -1
  121. package/source/smart.dateinput.js +1 -1
  122. package/source/smart.daterangeinput.js +1 -1
  123. package/source/smart.datetimepicker.js +1 -1
  124. package/source/smart.dockinglayout.js +1 -1
  125. package/source/smart.draw.js +1 -1
  126. package/source/smart.dropdownbutton.js +1 -1
  127. package/source/smart.dropdownlist.js +1 -1
  128. package/source/smart.editor.js +2 -2
  129. package/source/smart.element.js +1 -1
  130. package/source/smart.elements.js +10 -10
  131. package/source/smart.export.js +1 -1
  132. package/source/smart.fileupload.js +1 -1
  133. package/source/smart.filter.js +1 -1
  134. package/source/smart.filterbuilder.js +1 -1
  135. package/source/smart.filterpanel.js +1 -1
  136. package/source/smart.form.js +1 -1
  137. package/source/smart.format.js +1 -1
  138. package/source/smart.formulaparser.js +1 -1
  139. package/source/smart.ganttchart.js +2 -2
  140. package/source/smart.gauge.js +1 -1
  141. package/source/smart.grid.cell.js +1 -1
  142. package/source/smart.grid.chart.js +1 -1
  143. package/source/smart.grid.column.js +1 -1
  144. package/source/smart.grid.core.js +2 -2
  145. package/source/smart.grid.dialog.js +2 -2
  146. package/source/smart.grid.edit.js +2 -2
  147. package/source/smart.grid.export.js +1 -1
  148. package/source/smart.grid.filter.js +1 -1
  149. package/source/smart.grid.group.js +1 -1
  150. package/source/smart.grid.js +1 -1
  151. package/source/smart.grid.menu.js +1 -1
  152. package/source/smart.grid.pager.js +1 -1
  153. package/source/smart.grid.reorder.js +1 -1
  154. package/source/smart.grid.resize.js +1 -1
  155. package/source/smart.grid.row.js +2 -2
  156. package/source/smart.grid.select.js +1 -1
  157. package/source/smart.grid.sort.js +2 -2
  158. package/source/smart.grid.toolbar.js +1 -1
  159. package/source/smart.grid.tree.js +1 -1
  160. package/source/smart.grid.view.js +1 -1
  161. package/source/smart.gridpanel.js +2 -2
  162. package/source/smart.input.js +1 -1
  163. package/source/smart.kanban.js +1 -1
  164. package/source/smart.layout.js +1 -1
  165. package/source/smart.led.js +1 -1
  166. package/source/smart.listbox.js +1 -1
  167. package/source/smart.listmenu.js +1 -1
  168. package/source/smart.map.js +1 -1
  169. package/source/smart.maskedtextbox.js +1 -1
  170. package/source/smart.math.js +1 -1
  171. package/source/smart.menu.js +1 -1
  172. package/source/smart.multicomboinput.js +1 -1
  173. package/source/smart.multiinput.js +1 -1
  174. package/source/smart.multilinetextbox.js +1 -1
  175. package/source/smart.multisplitbutton.js +1 -1
  176. package/source/smart.numberformatpanel.js +1 -1
  177. package/source/smart.numberinput.js +1 -1
  178. package/source/smart.numeric.js +1 -1
  179. package/source/smart.numerictextbox.js +1 -1
  180. package/source/smart.pager.js +1 -1
  181. package/source/smart.passwordinput.js +1 -1
  182. package/source/smart.passwordtextbox.js +1 -1
  183. package/source/smart.path.js +1 -1
  184. package/source/smart.phoneinput.js +1 -1
  185. package/source/smart.pivottable.js +1 -1
  186. package/source/smart.powerbutton.js +1 -1
  187. package/source/smart.progressbar.js +1 -1
  188. package/source/smart.qrcode.js +1 -1
  189. package/source/smart.radiobutton.js +1 -1
  190. package/source/smart.rating.js +1 -1
  191. package/source/smart.ribbon.js +1 -1
  192. package/source/smart.router.js +1 -1
  193. package/source/smart.scheduler.js +1 -1
  194. package/source/smart.scrollbar.js +1 -1
  195. package/source/smart.slider.js +1 -1
  196. package/source/smart.sortable.js +1 -1
  197. package/source/smart.sparkline.js +1 -1
  198. package/source/smart.splitter.js +1 -1
  199. package/source/smart.switchbutton.js +1 -1
  200. package/source/smart.table.js +1 -1
  201. package/source/smart.tabs.js +1 -1
  202. package/source/smart.tank.js +1 -1
  203. package/source/smart.textarea.js +1 -1
  204. package/source/smart.textbox.js +1 -1
  205. package/source/smart.tickintervalhandler.js +1 -1
  206. package/source/smart.timeinput.js +1 -1
  207. package/source/smart.timepicker.js +1 -1
  208. package/source/smart.toast.js +1 -1
  209. package/source/smart.tooltip.js +1 -1
  210. package/source/smart.tree.js +1 -1
  211. package/source/smart.validationpanel.js +1 -1
  212. package/source/smart.validator.js +1 -1
  213. package/source/smart.window.js +1 -1
  214. package/source/styles/bootstrap/smart.bootstrap.blue.css +3369 -3372
  215. package/source/styles/bootstrap/smart.bootstrap.css +3369 -3372
  216. package/source/styles/bootstrap/smart.bootstrap.cyan.css +3369 -3372
  217. package/source/styles/bootstrap/smart.bootstrap.green.css +3369 -3372
  218. package/source/styles/bootstrap/smart.bootstrap.indigo.css +3369 -3372
  219. package/source/styles/bootstrap/smart.bootstrap.orange.css +3369 -3372
  220. package/source/styles/bootstrap/smart.bootstrap.pink.css +3369 -3372
  221. package/source/styles/bootstrap/smart.bootstrap.purple.css +3369 -3372
  222. package/source/styles/bootstrap/smart.bootstrap.red.css +3369 -3372
  223. package/source/styles/bootstrap/smart.bootstrap.teal.css +3369 -3372
  224. package/source/styles/bootstrap/smart.bootstrap.turquoise.css +3369 -3372
  225. package/source/styles/components/smart.array.css +1 -1
  226. package/source/styles/components/smart.calendar.css +2 -2
  227. package/source/styles/components/smart.cardview.css +2 -2
  228. package/source/styles/components/smart.checkinput.css +1 -1
  229. package/source/styles/components/smart.colorinput.css +1 -1
  230. package/source/styles/components/smart.columnpanel.css +1 -1
  231. package/source/styles/components/smart.countryinput.css +1 -1
  232. package/source/styles/components/smart.dateinput.css +2 -2
  233. package/source/styles/components/smart.daterangeinput.css +2 -2
  234. package/source/styles/components/smart.datetimeformatpanel.css +1 -1
  235. package/source/styles/components/smart.datetimepicker.css +1 -1
  236. package/source/styles/components/smart.editor.css +2 -2
  237. package/source/styles/components/smart.filterbuilder.css +2 -2
  238. package/source/styles/components/smart.filterpanel.css +1 -1
  239. package/source/styles/components/smart.ganttchart.css +2 -2
  240. package/source/styles/components/smart.grid.css +3 -3
  241. package/source/styles/components/smart.gridpanel.css +1 -1
  242. package/source/styles/components/smart.input.css +1 -1
  243. package/source/styles/components/smart.kanban.css +2 -2
  244. package/source/styles/components/smart.maskedtextbox.css +1 -1
  245. package/source/styles/components/smart.multicolumnfilterpanel.css +2 -2
  246. package/source/styles/components/smart.multicomboinput.css +1 -1
  247. package/source/styles/components/smart.multiinput.css +1 -1
  248. package/source/styles/components/smart.multilinetextbox.css +1 -1
  249. package/source/styles/components/smart.numberformatpanel.css +1 -1
  250. package/source/styles/components/smart.numberinput.css +1 -1
  251. package/source/styles/components/smart.pager.css +1 -1
  252. package/source/styles/components/smart.passwordinput.css +1 -1
  253. package/source/styles/components/smart.passwordtextbox.css +1 -1
  254. package/source/styles/components/smart.phoneinput.css +1 -1
  255. package/source/styles/components/smart.pivottable.css +1 -1
  256. package/source/styles/components/smart.querybuilder.css +3 -3
  257. package/source/styles/components/smart.ribbon.css +1 -1
  258. package/source/styles/components/smart.scheduler.css +2 -2
  259. package/source/styles/components/smart.sortpanel.css +1 -1
  260. package/source/styles/components/smart.table.css +1 -1
  261. package/source/styles/components/smart.textarea.css +1 -1
  262. package/source/styles/components/smart.textbox.css +1 -1
  263. package/source/styles/components/smart.timeinput.css +1 -1
  264. package/source/styles/components/smart.validationpanel.css +1 -1
  265. package/source/styles/components/smart.window.css +1 -1
  266. package/source/styles/default/scss/textbox/_multi-combo-input.scss +5 -0
  267. package/source/styles/default/smart.accordion.css +309 -309
  268. package/source/styles/default/smart.array.css +77 -77
  269. package/source/styles/default/smart.badge.css +50 -50
  270. package/source/styles/default/smart.barcode.css +3 -3
  271. package/source/styles/default/smart.breadcrumb.css +324 -324
  272. package/source/styles/default/smart.button.css +515 -515
  273. package/source/styles/default/smart.calendar.css +742 -742
  274. package/source/styles/default/smart.card.css +53 -53
  275. package/source/styles/default/smart.chart.css +119 -119
  276. package/source/styles/default/smart.checkbox.css +148 -148
  277. package/source/styles/default/smart.chip.css +101 -101
  278. package/source/styles/default/smart.colorpanel.css +617 -617
  279. package/source/styles/default/smart.colorpicker.css +132 -132
  280. package/source/styles/default/smart.currencyformatpanel.css +71 -71
  281. package/source/styles/default/smart.dateformatpanel.css +105 -105
  282. package/source/styles/default/smart.datetimepicker.css +611 -611
  283. package/source/styles/default/smart.dockinglayout.css +748 -748
  284. package/source/styles/default/smart.dropdownbutton.css +257 -257
  285. package/source/styles/default/smart.editor.css +1528 -1527
  286. package/source/styles/default/smart.editors.css +150 -150
  287. package/source/styles/default/smart.fileupload.css +498 -498
  288. package/source/styles/default/smart.ganttchart.css +1594 -1594
  289. package/source/styles/default/smart.gauge.css +145 -145
  290. package/source/styles/default/smart.inputgroup.css +483 -483
  291. package/source/styles/default/smart.layout.css +465 -465
  292. package/source/styles/default/smart.layouts.css +483 -483
  293. package/source/styles/default/smart.led.css +144 -144
  294. package/source/styles/default/smart.link-button.css +321 -321
  295. package/source/styles/default/smart.listbox.css +564 -564
  296. package/source/styles/default/smart.listmenu.css +661 -661
  297. package/source/styles/default/smart.loader.css +203 -203
  298. package/source/styles/default/smart.maskedtextbox.css +27 -27
  299. package/source/styles/default/smart.multilinetextbox.css +190 -190
  300. package/source/styles/default/smart.multisplitbutton.css +225 -225
  301. package/source/styles/default/smart.numberformatpanel.css +72 -72
  302. package/source/styles/default/smart.numerictextbox.css +522 -522
  303. package/source/styles/default/smart.pager.css +253 -253
  304. package/source/styles/default/smart.passwordtextbox.css +129 -129
  305. package/source/styles/default/smart.path.css +581 -581
  306. package/source/styles/default/smart.pivottable.css +800 -800
  307. package/source/styles/default/smart.powerbutton.css +100 -100
  308. package/source/styles/default/smart.progressbar.css +501 -501
  309. package/source/styles/default/smart.qrcode.css +3 -3
  310. package/source/styles/default/smart.querybuilder.css +624 -623
  311. package/source/styles/default/smart.radiobutton.css +137 -137
  312. package/source/styles/default/smart.rating.css +17 -17
  313. package/source/styles/default/smart.scheduler.css +2789 -2789
  314. package/source/styles/default/smart.scrollbar.css +118 -118
  315. package/source/styles/default/smart.scrollviewer.css +109 -109
  316. package/source/styles/default/smart.slider.css +464 -464
  317. package/source/styles/default/smart.sortable.css +114 -114
  318. package/source/styles/default/smart.splitter.css +395 -395
  319. package/source/styles/default/smart.switchbutton.css +293 -293
  320. package/source/styles/default/smart.table.css +2025 -2025
  321. package/source/styles/default/smart.tabs.css +923 -923
  322. package/source/styles/default/smart.tank.css +661 -661
  323. package/source/styles/default/smart.textbox.css +3431 -3427
  324. package/source/styles/default/smart.timepicker.css +150 -150
  325. package/source/styles/default/smart.toast.css +252 -252
  326. package/source/styles/default/smart.toggle.css +175 -175
  327. package/source/styles/default/smart.tooltip.css +124 -124
  328. package/source/styles/default/smart.tree.css +783 -783
  329. package/source/styles/default/smart.validationpanel.css +116 -116
  330. package/source/styles/default/smart.window.css +829 -829
  331. package/source/styles/smart.default.css +4 -4
  332. package/source/styles/smart.fluent.css +3313 -3313
  333. package/source/typescript/smart.elements.d.ts +1 -2
  334. package/source/typescript/smart.ganttchart.d.ts +1 -2
@@ -1327,7 +1327,7 @@ Smart("smart-country-input",class extends Smart.Input{static get properties(){re
1327
1327
  /***/ 6057:
1328
1328
  /***/ (() => {
1329
1329
 
1330
- (()=>{Smart.DataAdapter=window.smartDataAdapter=class{constructor(e){e||(e={});const t=Object.assign(this,e);t.key=(65536*(1+Math.random())|0).toString(16).substring(1),t.$document=Smart.Utilities.Extend(document),t.boundSource=!1===t.observable||t.virtualDataSource?[]:new Smart.ObservableArray,t.dataItemById=[],void 0===t.allowAdd&&(t.allowAdd=!0),void 0===t.allowRemove&&(t.allowRemove=!0),void 0===t.allowUpdate&&(t.allowUpdate=!0),void 0===t.mapChar&&(t.mapChar="."),void 0!==e.observable||t.virtualDataSource?t.observable=!1:t.observable=!0,void 0===t.sanitizeHTML&&(t.sanitizeHTML="blackList"),t._expandedRowIds=[],e.dataSource||(t.dataSource=[]),e.dataFields||(t.dataFields=[]),e.dataSourceType||(t.dataSourceType="array"),e.id||(t.id=null),e.autoFetch||(t.autoFetch=!0),void 0===e.skipFirstRow&&(t.skipFirstRow=!1),e.dataFields&&(t.dataFields=e.dataFields),Object.defineProperty(t,"groupBy",{configurable:!1,enumerable:!0,get:()=>t._groupBy?t._groupBy:[],set(e){const a=()=>{t.boundHierarchy=null,t.refreshHierarchy(),t.onGroup&&t.onGroup()};t._groupBy=new Smart.ObservableArray(e),t._groupBy.notify((function(){a()})),t.isInitialized&&a()}}),e.groupBy?e.groupBy.toArray?t.groupBy=e.groupBy.toArray():t.groupBy=e.groupBy:t.groupBy=[],e&&!1!==e.autoBind&&t.dataBind(),t.isInitialized=!0}beginUpdate(){this.isUpdating=!0}endUpdate(){const e=this;e.isUpdating=!1,e.refreshIndexes(),e.refreshHierarchy()}get expandHierarchy(){return void 0===this._expandHierarchy&&(this._expandHierarchy=!1),this._expandHierarchy}set expandHierarchy(e){const t=this;t._expandHierarchy=e,t.isInitialized&&t.refreshHierarchy()}_getDataField(e){switch(e.name){case"leaf":case"parent":case"expanded":case"checked":case"selected":case"level":case"icon":case"data":case"group":case"children":case"items":e.map?e.map=e.map.replace(e.name,"$"+e.name):e.map=e.name,e.name="$"+e.name}}get dataFields(){return this._dataFields}set dataFields(e){const t=this;return t._dataFields=t._getDataFieldObjects(e),t._dataFields}_getDataFieldObjects(e){const t=this;let a=[];if("number"==typeof e){const t="A".charCodeAt(0);let n="",r=0;for(let i=0;i<e;i++){const e=String.fromCharCode(t+r);r++;const i=n+e;a.push({name:i,dataType:"string"}),r>=26&&(r=0,n+="A")}}else if(Array.isArray(e)&&e.length>0)for(let n=0;n<e.length;n++){const r=e[n];if("string"==typeof r){const e=r.split(":"),t=e[0].trim(),n=e.length>1?e[1].trim():"string";a.push({name:t,dataType:n})}else a.push(r);t._getDataField(a[a.length-1])}return a}get dataSource(){const e=this;return e._dataSource||(e._dataSource=[]),e._dataSource}set dataSource(e){const t=this;t._dataSource=e,t.isInitialized&&(t.boundSource=!1===t.observable||t.virtualDataSource?[]:new Smart.ObservableArray,t.dataItemById=[],t.bindingCompleted=!1,t.dataBind(),t.refreshIndexes())}get canNotify(){const e=this;return void 0===e._canNotify&&(e._canNotify=!0),e._canNotify}set canNotify(e){this._canNotify=e}_notify(e){const t=this;t.canNotify&&t.notifyFn&&t.notifyFn(e)}notify(e){e&&(this.notifyFn=e)}toArray(){const e=this;return!1===e.observable?e.boundSource:e.boundSource.toArray()}forEach(e){const t=this;if(e)if(t.boundHierarchy&&t.boundHierarchy.length>0){const a=(e=>{let t=[];for(;e;){t=t.concat(e);for(let a=0;a<e.length;a++)e[a].children&&(t=t.concat(e[a].children));e=e.children}return t})(t.boundHierarchy);for(let t=0;t<a.length;t++){e(a[t],t)}}else for(let a=0;a<t.boundSource.length;a++){e(t.boundSource[a],a)}}dataBind(){const t=this;t.bindingCompleted=!1,t.clear();const a=()=>{t.observable&&(t.boundSource.notify||(t.boundSource=new Smart.ObservableArray),t.boundSource.notify((function(e){if("update"===e.action&&e.path&&e.path.indexOf(".")>=0&&-1===e.path.indexOf("children")&&-1===e.path.indexOf("parent")&&-1===e.path.indexOf("loaded")&&-1===e.path.indexOf("level")&&-1===e.path.indexOf("leaf")&&-1===e.path.indexOf("expanded")){let a=!1;for(let n=0;n<t.dataFields.length;n++){const r=t.dataFields[n].name;e.path.indexOf(r)>=0&&(a=!0)}t._notify&&a&&t._notify({action:"update",data:e.target,index:e.index})}}))),t._onBindingComplete()};if("string"==typeof t.dataSource&&(t.dataSource.indexOf(".json")>=0||"json"===t.dataSourceType))t.url=t.dataSource,t.dataSourceType="json",new e(t,(e=>{t.dataSource=e}));else if("string"==typeof t.dataSource&&t.dataSource.indexOf(".xml")>=0)t.url=t.dataSource,t.dataSourceType="xml",new e(t,(e=>{t.dataSource=e}));else if("string"==typeof t.dataSource&&t.dataSource.indexOf(".xlsx")>=0)t.url=t.dataSource,t.dataSourceType="xlsx",new e(t,(e=>{if(!e[0])return e=[],t._bindToArray(),void a();const n=Object.keys(e[0]),r={},i=[];if(!1!==t.exportHeader){let a=0;for(let e in n){r[n[e]]=t.dataFields[a++].name}for(let t=1;t<e.length;t++){const a=e[t],o={};for(let e in n){const t=n[e];o[r[t]]=a[t]}i.push(o)}t.dataSource=i}t._bindToArray(),a()}));else if("string"==typeof t.dataSource&&t.dataSource.indexOf(".csv")>=0)t.url=t.dataSource,t.dataSourceType="csv",new e(t,(e=>{t.dataSource=e}));else if("string"==typeof t.dataSource&&t.dataSource.indexOf(".tsv")>=0)t.url=t.dataSource,t.dataSourceType="tsv",new e(t,(e=>{t.dataSource=e}));else if("string"==typeof t.dataSource&&(t.dataSource.indexOf(".ics")>=0||t.dataSource.indexOf(".php")>=0&&"ics"===t.dataSourceType||t.dataSource.indexOf(".txt")>=0&&"ics"===t.dataSourceType))t.url=t.dataSource,t.dataSourceType="ics",new e(t,(e=>{t.dataSource=e}));else if("string"==typeof t.dataSource&&(t.dataSource.indexOf("BEGIN:VCALENDAR")>=0||"ics"===t.dataSourceType))t._bindToICS(),a();else if("string"==typeof t.dataSource&&(t.dataSource.indexOf("<?xml")>=0||"xml"===t.dataSourceType))t._bindToXML(),a();else if("string"==typeof t.dataSource&&(t.dataSource.indexOf(" ")>=0||t.dataSource.indexOf(",")>=0||"tsv"===t.dataSourceType||"csv"===t.dataSourceType||"tab"===t.dataSourceType))t._bindToCSV(),a();else if("array"===t.dataSourceType)t._bindToArray(),a();else if("json"===t.dataSourceType){if(t.dataSource&&t.dataSource.url)return t.url=t.dataSource.url,t.dataSource.method&&(t.type=t.dataSource.method),t.dataSource.type&&(t.type=t.dataSource.type),t.dataSource.data&&(t.data=t.dataSource.data),void new e(t,(e=>{t.dataSource=e}));t._bindToJSON(),a()}}_bindToXML(){const e=this;let t=null,a=null;window.DOMParser&&(t=new DOMParser,a=t.parseFromString(e.dataSource,"text/xml")),void 0===e.root&&(e.root=""),void 0===e.record&&(e.record="");const n=a.querySelectorAll(e.root+" "+e.record),r=n.length,i=[];let o=e.dataFields?e.dataFields.length:0;if(0===o){const t=n[0],a=new Array;for(let e in t){const t=e;a[a.length]={name:t}}e.dataFields=a,o=a.length}for(let t=0;t<r;t++){const a=n[t],r={};if(void 0===a)break;if(e.id){const t=a.querySelector(e.id);r[e.id]=t.textContent}for(let t=0;t<o;t++){const n=e.dataFields[t],i=a.querySelector(n.map||n.name);r[n.name]=i.textContent}i[t]=r}e.canNotify=!1,e.dataSource=i,e.canNotify=!0,e._bindToArray()}static BindToCSV(e,t=!1){const a=""+e,n=-1===a.indexOf(",")?"\t":",",r=a.split("\r"),i=new Array,o=[];let d=a.split("\n"),l=d.length;1===l&&r.length>1&&(d=r,l=d.length);const s=!0===t;for(let e=0;e<l;e++){const t={},a=d[e].split(n);for(let n=0;n<a.length;n++){let r=o[n],i=a[n];if(r||(o.push({name:i.trim()}),r=o[o.length-1]),i=i.trim(),1!==e||s)switch(r.dataType){case"boolean":i="false"!==i;break;case"number":i=parseFloat(i);break;case"date":i=new Date(i)}else{let e="string";"false"===i||"true"===i?(e="boolean",i="false"!==i):isNaN(parseInt(i)&&-1===i.indexOf("/"))?(i.indexOf("-")>=0||i.indexOf("/")>=0||i.indexOf(":")>=0)&&"Invalid Date"!==new Date(i).toString()&&(e="date",i=new Date(i)):(e="number",i=parseFloat(i)),r.dataType||(r.dataType=e)}t[r.name]=i}(s||e>0)&&i.push(t)}return i}_bindToCSV(){const e=this,t=""+e.dataSource,a=-1===t.indexOf(",")?"\t":",",n=t.split("\r"),r=new Array;let i=t.split("\n"),o=i.length;1===o&&n.length>1&&(i=n,o=i.length);const d=e.dataFields.length>0;for(let t=0;t<o;t++){const n=i[t],o={};let l=i[t].split(a);if(t>0){let e=[],a=0,n=!1,r=i[t];for(let t=0;t<r.length;t++)if('"'===r.charAt(t))n=!n;else if(","===r.charAt(t)&&!n){let n=r.substring(a,t);n=n.trim(),n=n.replaceAll('"',""),e.push(n),a=t+1}let o=r.substring(a);o=o.trim(),o=o.replaceAll('"',""),","===o?e.push('""'):e.push(o),l=e}for(let a=0;a<l.length;a++){let r=e.dataFields[a],i=l[a];if(r||(e.dataFields.push({name:i.trim()}),r=e.dataFields[e.dataFields.length-1]),r.map&&(i=n[r.map]),i=i.trim(),1!==t||d)switch(r.dataType){case"boolean":i="false"!==i;break;case"number":i=parseFloat(i);break;case"date":i=new Date(i)}else{let e="string";"false"===i||"true"===i?(e="boolean",i="false"!==i):isNaN(parseInt(i)&&-1===i.indexOf("/")&&-1===i.indexOf("-"))?(i.indexOf("-")>=0||i.indexOf("/")>=0||i.indexOf(":")>=0)&&"Invalid Date"!==new Date(i).toString()&&(e="date",i=new Date(i)):i.indexOf(".")>=0&&i.lastIndexOf(".")!==i.indexOf(".")?-1===i.indexOf(",")&&(e="date",i=new Date(i)):(e="number",i=parseFloat(i)),r.dataType||(r.dataType=e)}o[r.map||r.name||a.toString()]=i}0===t&&e.skipFirstRow||(d||t>0)&&r.push(o)}e.canNotify=!1,e.dataSource=r,e.canNotify=!0,e._bindToArray()}_onBindingComplete(){const e=this;e._buildHierarchy(),e.onBindingComplete&&e.onBindingComplete({data:e.boundSource}),e._notify&&e._notify({action:"bindingComplete",data:e.boundSource}),e.bindingCompleted=!0}refreshHierarchy(){this.isUpdating||this._buildHierarchy()}find(){return this.boundSource.find.apply(this.boundSource,arguments)}onVirtualDataSourceRequested(e,t){const a=this;let n=t?t.first:1/0,r=t?t.last:1/0,i=t?t.row:null;if(void 0===n&&(n=1/0),void 0===r&&(r=1/0),a.virtualFirstIndex=n,a.virtualLastIndex=r,a.virtualDataSource){const o=function(r){void 0!==r.virtualDataSourceLength&&(a.virtualDataSourceLength=r.virtualDataSourceLength),new Smart.DataAdapter({dataSource:r.dataSource,dataFields:r.dataFields||a.dataFields,data:t,keyDataField:r.keyDataField,parentDataField:r.parentDataField,observable:!1,id:r.id||a.id,onBindingComplete(r){if(void 0===t.result&&(t.result=!0),t.data=r.data,a.virtualDataSourceOnExpand&&i)return a.groupBy.length>0?r.data&&r.data.length>0&&a.add(r.data):r.data&&r.data.length>0?a.add(r.data,i.$.id):i.leaf=!0,a.onFilter&&a.onFilter(),void e(t);n===1/0&&"scroll"===t.action?r.data&&r.data.length&&a.add(r.data):"filter"===t.action||"group"===t.action?(a.canNotify=!1,a.dataSource=r.data,a.canNotify=!0):("add"===t.action||"update"===t.action||t.action,a.canNotify=!1,a.dataSource=r.data,a.canNotify=!0),a.onFilter&&a.onFilter(),e(t)}})};let d={};if(t.sorting&&t.sorting.length>0){let e=[];for(let a in t.sorting)e.push(a+" "+t.sorting[a].sortOrder.toUpperCase());const a=" ORDER BY "+e.join(", ");d.orderBy=a}else d.orderBy="";if(void 0===n||void 0===r||0===n&&0===r)d.limit="";else{const e=r-n,t=" LIMIT "+e+" OFFSET "+n;d.limit=t,isNaN(e)&&(d.limit="")}if(t.grouping&&t.grouping.length>0){const e=" GROUP BY "+t.grouping[0];d.groupBy=e}else d.groupBy="";if(t.filtering&&t.filtering.length>0){const e=(e,t)=>{switch(t.condition){case"EMPTY":return e+" = ''";case"NOT_EMPTY":return e+" != ''";case"EQUAL":return e+" = '"+t.value+"'";case"NOT_EQUAL":return e+" != '"+t.value+"'";case"CONTAINS_CASE_SENSITIVE":case"CONTAINS":return e+" LIKE '%"+t.value+"%'";case"DOES_NOT_CONTAIN_CASE_SENSITIVE":case"DOES_NOT_CONTAIN":return e+" NOT LIKE '%"+t.value+"%'";case"STARTS_WITH_CASE_SENSITIVE":case"STARTS_WITH":return e+" LIKE '"+t.value+"%'";case"ENDS_WITH_CASE_SENSITIVE":case"ENDS_WITH":return e+" LIKE '%"+t.value+"'";case"NULL":return e+" IS NULL";case"NOT_NULL":return e+" IS NOT NULL"}},a=(e,t)=>{let a=t.value,n=t.valueTo;if(a&&a instanceof Date){a=`'${new Smart.Utilities.DateTime(a).toString("yyyy-MM-dd")}'`}if(t.valueTo&&t.valueTo instanceof Date){n=`'${new Smart.Utilities.DateTime(n).toString("yyyy-MM-dd")}'`}switch(t.condition){case"EQUAL":return e+" = "+a;case"NOT_EQUAL":return e+" != "+a;case"GREATER_THAN":return e+" > "+a;case"GREATER_THAN_OR_EQUAL":return e+" >= "+a;case"LESS_THAN":return e+" < "+a;case"LESS_THAN_OR_EQUAL":return e+" <= "+a;case"NULL":return e+" IS NULL";case"NOT_NULL":return e+" IS NOT NULL";case"RANGE":return"("+e+" >= "+a+" and "+e+" <= "+n+")"}},n=(e,t,a)=>{if(a.operator){var n=e(t,a.condition1),r=e(t,a.condition2);return"("+n+" "+a.operator+" "+r+")"}return e(t,a)};let r=[];for(let i in t.filtering){const o=t.filtering[i];let d=o.filters,l=[],s=" AND ";for(let t=0;t<d.length;t++){const r=d[t];switch(r.type){case"stringFilter":l.push(n(e,i,r));break;case"numericFilter":case"dateFilter":case"booleanFilter":l.push(n(a,i,r))}1!==o.logicalOperators[t]&&"or"!==o.logicalOperators[t]||(s=" OR ")}l.length&&r.push("("+l.join(s)+")")}if(r.length>0){let e=" AND ";t.filterOperator&&"or"===t.filterOperator.toLowerCase()&&(e=" OR "),d.where=" WHERE "+r.join(e).replace(/</g,"&lt;").replace(/>/g,"&gt;")}else d.where=""}else d.where="";if("dataBind"===t.action&&a.virtualDataSourceOnExpand&&a.keyDataField&&a.parentDataField&&(d.where?d.where+=" AND "+a.parentDataField+" IS NULL":d.where=" WHERE "+a.parentDataField+" IS NULL"),"update"===t.action){const e=[];for(let n in t.edit.row)"$"!==n&&n!==a.id&&e.push(n+"='"+t.edit.row[n].replace(/</g,"&lt;").replace(/>/g,"&gt;")+"'");null===a.id?d.update=" SET "+e.join(", "):d.update=" SET "+e.join(", ")+" WHERE "+a.id+"="+t.edit.row[a.id]}if("remove"===t.action){const e=[];for(let n in t.edit.row)"$"!==n&&n!==a.id&&e.push(n+" = '"+t.edit.row[n]+"'");d.remove=" WHERE "+a.id+"="+t.edit.row[a.id]}if("add"===t.action){const e=[],a=[];for(let n in t.edit.row)"$"!==n&&(a.push(n),null!==t.edit.row[n]?e.push("'"+t.edit.row[n]+"'"):e.push("null"));d.add=" ("+a.join(", ")+") VALUES ("+e.join(", ")+")"}"expand"===t.action?(a.groupDataField?d.where?d.where+=" AND "+a.groupDataField+" = '"+i[a.groupDataField]+"'":d.where=" WHERE "+a.groupDataField+" = '"+i[a.groupDataField]+"'":a.keyDataField&&a.parentDataField?d.where?d.where+=" AND "+a.parentDataField+" = "+i[a.keyDataField]:d.where=" WHERE "+a.parentDataField+" = "+i[a.keyDataField]:d.where?d.where+=" AND "+i.groupDataField+" = '"+i.label+"'":d.where=" WHERE "+i.groupDataField+" = '"+i.label+"'",d.where.indexOf("undefined")>=0&&(d.where=""),d.limit="",d.groupBy="",a.virtualDataSourceOnExpand(o,{first:n,last:r,row:t.row,sorting:t.sorting,filtering:t.filtering,grouping:t.grouping,action:t.action,query:d})):a.virtualDataSource(o,{first:n,last:r,sorting:t.sorting,edit:t.edit,filtering:t.filtering,filterOperator:t.filterOperator||"and",grouping:t.grouping,action:t.action,query:d})}else e()}add(e,t){const a=this;if(!e)return;let n=!0;const r=function(e){const r=a._getDataItem(e,a.boundSource.length);if(a.dataItemById[r.$.id])return void 0!==t&&(r.$.parentId=t),null;a[a.boundSource.length]=r,a.dataItemById[r.$.id]=r;const i=a.boundSource.push(r);return void 0!==t&&(r.$.parentId=t),i||(n=!1),r};if(e.length){let t=[];for(let a=0;a<e.length;a++){const n=r(e[a]);n&&t.push(n)}a._notify({action:"add",data:t})}else{const t=r(e);a._notify({action:"add",data:t})}return a.refreshHierarchy(),n}refreshIndexes(){const e=this;for(let t=0;t<e.boundSource.length;t++)e[t]=e.boundSource[t],e[t].$.index=t,e.dataItemById[e[t].$.id]=e[t];let t=e.boundSource.length;for(;e[t];)delete e[t],t++}removeLast(){const e=this;delete e[e.boundSource.length-1];const t=e.boundSource.pop();return delete e.dataItemById[t.$.id],e._notify({action:"removeLast",data:t}),e.refreshHierarchy(),t}removeById(e){const t=this,a=t.indexOf(t.dataItemById[e]);t.boundSource[a]&&t.removeAt(a)}remove(e){const t=this;let a=t.indexOf(e);-1===a&&e&&e.$&&(a=t.indexOf(t.dataItemById[e.$.id]));t.boundSource[a]&&t.removeAt(a)}removeAt(e){const t=this,a=t.boundSource[e];if(!a)throw new Error("Invalid Item Index");t.boundSource.splice(e,1),delete t.dataItemById[a.$.id],t.refreshIndexes(),t._notify({action:"remove",index:e,data:a}),t.refreshHierarchy()}update(e,t){const a=this;if(Smart.Utilities.Types.isArray(e)&&Smart.Utilities.Types.isArray(t)&&0===e.length&&0===t.length)return void a.refreshHierarchy();if(t.length&&e.length){let n=[];for(let r=0;r<e.length;r++){const i=a._getDataItem(t[r],e[r]),o=e[r];n.push(i),a.boundSource[o]=i,a[o]=a.boundSource[o],a.dataItemById[i.$.id]=a[o]}return a._notify({action:"update",index:e,data:n}),void a.refreshHierarchy()}const n=a._getDataItem(t,e),r=a.boundSource[e].$.id;return n.$.id=r,a.boundSource[e]=n,a[e]=a.boundSource[e],a.dataItemById[n.$.id]=a[e],a._notify({action:"update",index:e,data:n}),a.refreshHierarchy(),n}insert(e,t){const a=this;if(t.length){const n=[];for(let r=0;r<t.length;r++){const i=a._getDataItem(t[r],e+r);n.push(i)}t=n}else t=a._getDataItem(t,e);const n=a.boundSource.splice(e,0,t);return a.refreshIndexes(),a._notify({action:"insert",index:e,data:t}),a.refreshHierarchy(),n}move(e,t){if(t>e&&t-e==1||e===t)return;const a=this,n=a.boundSource.splice(e,1)[0];t>e?(t--,a.boundSource.splice(t,0,n)):a.boundSource.splice(t,0,n),a.refreshIndexes(),a._notify({action:"move",index:t,data:a.boundSource[t]}),a.refreshHierarchy()}indexOf(e){return this.boundSource.indexOf(e)}get length(){const e=this;return void 0!==e.virtualDataSourceLength?e.virtualDataSourceLength:e.dataSourceLength?e.dataSourceLength:"number"==typeof e.dataSource?e.dataSource:e.bindingCompleted?e.boundSource.length:e.dataSource&&"string"!=typeof e.dataSource&&e.dataSource.length?e.dataSource.length:e.boundSource.length}clear(){const e=this;if(!e.isInitialized)return e._cachedValues=[],void(e.dataItemById=[]);for(let t=0;t<e.boundSource.length;t++)delete e[t];e._expandedRowIds=[],e._cachedValues=[],e.boundSource=e.observable?new Smart.ObservableArray:[],e.dataItemById=[],e.refreshHierarchy()}_getId(e,t,a){if(null===e||void 0===e.name||!e.name||!t.getAttribute){if(e&&e.toString().length>0&&t.getAttribute){let a=t.getAttribute(e);if(null!==a&&a.toString().length>0)return a.trim().split(" ").join("").replace(/([ #;?%&,.+*~\':'!^$[\]()=>|\/@])/g,"");{let a=e.split(this.mapChar);if(a.length>1){let e=t;for(let t=0;t<a.length;t++)void 0!==e&&(e=e[a[t]]);if(void 0!==e)return e}else if(void 0!==t[e])return t[e]}}return a}{let n=t.getAttribute(e.name);if(null!==n&&n.toString().length>0)return n;if(e.map)try{let a=t.getAttribute(e.map);if(null!==a&&a.toString().length>0)return a}catch(e){return a}}}_buildHierarchy(){const e=this;if(e.reservedNames){const t=e.reservedNames;t.leaf||(t.leaf="leaf"),t.parent||(t.parent="parent"),t.expanded||(t.expanded="expanded"),t.checked||(t.checked="checked"),t.selected||(t.selected="selected"),t.level||(t.level="level"),t.data||(t.data="data")}else e.reservedNames={leaf:"leaf",parent:"parent",expanded:"expanded",checked:"checked",selected:"selected",level:"level",icon:"icon",data:"data"};const t=e.reservedNames;if(e.childrenDataField){const a=[];for(let n=0;n<e.boundSource.length;n++){const r=JSON.parse(JSON.stringify(e.boundSource[n]));if(!r)continue;a.push(r);const i=function(a){const n=e.childrenDataField.split(e.mapChar);let r=null;if(n.length>1){let e=a;for(let t=0;t<n.length;t++)void 0!==e&&(e=e[n[t]]);r=e}else r=a.children;a.children=r,(null===a.children||void 0===a.children||a.children&&0===a.children.length)&&(a[t.leaf]=!0)};i(r),r[t.level]=0,r.$||(r.$={}),r[t.parent]=null,r[t.data]=r,void 0===r[t.expanded]&&(r[t.expanded]=!1,e.expandHierarchy&&(r[t.expanded]=!0));const o=function(a,n){if(n)for(let r=0;r<n.length;r++){let d=e._getDataItem(n[r],r);if(d){if(i(d),!e.id){const e=function(){const e=function(){return(65536*(1+Math.random())|0).toString(16).substring(1)};return e()+e()};d.$.id=e()}d[t.level]=a[t.level]+1,d[t.parent]=a,d[t.data]=Object.assign({},d),a&&(a.children[r]=d),void 0===d[t.expanded]&&(d[t.expanded]=!1,e.expandHierarchy&&(d[t.expanded]=!0)),o(d,d.children)}}else a.children=new Array};o(r,r.children)}if(e.boundHierarchy=a,!e._boundSourceUpdate){for(let t=0;t<e.boundHierarchy.length;t++){const a=e.boundHierarchy[t];if(a.children){const t=function(a){if(e.dataItemById[a.$.id]||(e.boundSource.canNotify=!1,e.dataItemById[a.$.id]=a,e.boundSource.canNotify=!0),a.children)for(let e=0;e<a.children.length;e++){const n=a.children[e];n.children&&t(n)}};t(a)}}e._boundSourceUpdate=!0}}if(e.xmlRoot&&"xml"===e.dataSourceType&&(e.boundHierarchy=this._getHierarchy("uid","_parentuid","children",null,e.boundSource)),e.keyDataField&&e.parentDataField)return["keyDataField","parentDataField"].forEach((t=>{switch(e[t]){case"parent":e[t]="$"+e[t]}})),void(e.boundHierarchy=this._getHierarchy(e.keyDataField,e.parentDataField,"children",null,e.boundSource));e.groupBy&&e.groupBy.length>0?e.boundHierarchy=this._getGroupHierarchy(e.groupBy,"children","label",null,"data",null,"parent",e.boundSource):e.virtualDataSourceOnExpand&&(e.boundHierarchy=this._getHierarchy("id","parentId","children",null,e.boundSource))}_getGroupHierarchy(e,t,a,n,r,i,o,d,l){let s=this;l||(l=0);let c=s.reservedNames;const u=s.boundSource.canNotify;s.boundSource.canNotify=!1;const f=function(){function e(){return Math.floor(65536*(1+Math.random())).toString(16).substring(1)}return e()+e()+"-"+e()+"-"+e()+"-"+e()+"-"+e()+e()+e()};let h=new Array;for(let t=0;t<e.length;t++)h[t]=f();t||(t="children"),a||(a="group"),r||(r="item"),o||(o="parent"),void 0===i&&(i="value");const p=new Array,g=new Array;let S=0;const y=function(t){let a=t;for(let n=0;n<e.length;n++){if(void 0===t[e[n]]){a=s._getDataItem(t,t.$.index);break}}if(n)for(let e in n){const t=n[e];t.name&&t.map&&(a[t.map]=a[t.name])}return a};let m=!1;for(let n=0;n<d.length;n++){let u=y(d[n]);u[c.leaf]=!1;let T=new Array,b=0;for(let t=0;t<e.length;t++){const a=e[t],n=u[a];null!=n?((""===n||void 0===n&&0===t)&&(m=!0),T[b++]={value:n,group:a,hash:h[t]}):(T[b++]={value:null,group:a,hash:h[t]},0===t&&(m=!0))}if(T.length!==e.length)break;let x=null,v="";for(let e=0;e<T.length;e++){const n=T[e].value,d=T[e].group;if(v=v+"_"+T[e].hash+"_"+n,void 0===g[v]||null===g[v]){if(null===x){x={$:{}},x[c.level]=0,x[c.leaf]=!1,x[o]=null,x[a]=n,x[r]=u,x.groupDataField=d,x[d]||(x[d]=x.data[d]),void 0!==u[c.expanded]?x[c.expanded]=u[c.expanded]:(x[c.expanded]=!1,s.expandHierarchy&&(x[c.expanded]=!0)),i&&(x[i]=u[i]),x[t]=new Array;let e=p.length+l;this.id&&"number"!=typeof u.$.id&&!isFinite(u.$.id)||(e="Item"+e),void 0===x.$.id&&(x.$.id=e),s._expandedRowIds[x.$.id]&&(x[c.expanded]=!0),s.expandHierarchy&&s._collapsedIds&&s._collapsedIds[x.$.id]&&(x[c.expanded]=!1),p[S++]=x}else{const e={$:{}};e[c.level]=x[c.level]+1,e[o]=x,e[a]=n,e[t]=new Array,e[r]=u,e.groupDataField=d,e[c.leaf]=!1,e[d]||(e[d]=e.data[d]),void 0!==u[c.expanded]?e[c.expanded]=u[c.expanded]:(e[c.expanded]=!1,s.expandHierarchy&&(e[c.expanded]=!0)),i&&(e[i]=u[i]),void 0===e.$.id&&(e.$.id=x.$.id+"_"+x[t].length),s.expandHierarchy&&s._collapsedIds&&s._collapsedIds[e.$.id]&&(e[c.expanded]=!1),s._expandedRowIds[e.$.id]&&(e[c.expanded]=!0),x[t][x[t].length]=e,x=e}g[v]=x}else x=g[v]}u&&(u[c.leaf]=!0),null!==x?(null===this.id?void 0===u.$.id&&(u.$.id=x.$.id+"_"+x[t].length):void 0===u.$.id&&-1===u.$.id.toString().indexOf(x.$.id)&&(u.$.id=x.$.id+"_"+u.$.id),u[o]=x,u[c.level]=x[c.level]+1,x[t][x[t].length]=u):void 0===u.$.id&&(u.$.id=f())}if(m){let e=null,t=!1;for(let a=0;a<p.length;a++){const n=p[a];if(!n[n.groupDataField]){e=n,e.$.id.toString().startsWith("Item")&&(t=!0),p.splice(a,1);break}}if(e&&(p.push(e),t))for(let e=0;e<p.length;e++){const t=p[e];t.$.id="Item"+e,Object.keys(s._expandedRowIds).length>0&&(s._expandedRowIds[t.$.id]?t[c.expanded]=!0:t[c.expanded]=!1,s.expandHierarchy&&(t[c.expanded]=!0,s._collapsedIds&&s._collapsedIds[t.$.id]&&(t[c.expanded]=!1)))}}return s.boundSource.canNotify=u,p}_getHierarchy(e,t,a,n,r){const i=this,o=new Array;let d=this.boundSource;if(r&&(d=r),0===this.boundSource.length)return null;const l=null!==a?a:"children";let s=new Array,c=d,u=c.length,f=i.reservedNames;const h=function(e){let t=e;if(n)for(let e in n){const a=n[e];a.name&&a.map&&(t[a.map]=t[a.name])}return t};for(let a=0;a<u;a++){let n=c[a],r=n[t],o=n[e];"parentId"===t&&(r=n.$.parentId),"id"===e&&(o=n.$.id),null===o&&(o=n[e]=n.$.id),n[l]=new Array,i.expandHierarchy&&void 0===n[f.expanded]&&(n[f.expanded]=i.expandHierarchy),s[o]={parentId:r,item:n}}for(let a=0;a<u;a++){const n=c[a];let r=n[t],i=n[e];if("parentId"===t&&(r=n.$.parentId),"id"===e&&(i=n.$.id),void 0!==s[r]){let e={parentId:r,item:s[i].item},t=s[r].item;t[l]||(t[l]=new Array);let a=t[l].length;e=e.item,f?e[f.parent]=t:e.parent=t;const n=h(e);t[l][a]=n,s[r].item=t,s[i].item=e}else{let e=s[i].item;f?void 0===e[f.parent]&&(e[f.parent]=null):void 0===e.parent&&(e.parent=null);const t=h(e);f?t[f.level]=0:t.level=0,o[o.length]=t}}if(0!==o.length){let e=function(t,a){for(let n=0;n<a.length;n++){const r=a[n];f?r[f.level]=t:r.level=t;const o=r[l];o&&o.length>0?(r.leaf=!1,e(t+1,o)):i.virtualDataSourceOnExpand?void 0===r.leaf&&(r.leaf=!1):f?r[f.leaf]=!0:r.leaf=!0}};e(0,o)}return o}summarize(e,t){const a=this;Array.isArray(e)||(e=[e]);let n=[];for(let t=0;t<e.length;t++){const a=e[t];for(let e in a){const t=a[e];n.push({dataField:e,functions:t})}}e=n;let r={},i=new Array;t||(t=a.boundSource);let o=t.length,d=0;if(0!==o&&void 0!==o){for(let a=0;a<o;a++){let n=t[a];if((!n||!n.$||!1!==n.$.filtered)&&n){d++;for(let t=0;t<e.length;t++){const o=e[t];let d=n[o.dataField];if(void 0!==d&&"uncategorized"!==d||(d=""),o.functions&&o.functions.length>0){r[o.dataField]=r[o.dataField]||{},i[o.dataField]=i[o.dataField]||0,i[o.dataField]++;const e=function(e){for(let t in e){let a=r[o.dataField][t];null==a&&(r[o.dataField][t]=0,a=0),"function"==typeof e[t]&&(a=e[t](a,d,o.dataField,n)),r[o.dataField][t]=a}},t=d;let l=parseFloat(d);l=!isNaN(l),t&&t.toDate&&(l=!1),"string"==typeof d&&d.startsWith("+")&&(l=!1),l&&(d=parseFloat(d)),"number"==typeof d&&isFinite(d)?o.functions.forEach((function(t){let n=r[o.dataField][t];if(null==n&&(n=0,"min"===t&&(n=9999999999999),"max"===t&&(n=-9999999999999),"median"===t&&(n=[])),"sum"===t||"avg"===t||"stdev"===t||"stdevp"===t||"var"===t||"varp"===t)n+=parseFloat(d);else if("product"===t)0===a?n=parseFloat(d):n*=parseFloat(d);else if("min"===t)n=Math.min(n,parseFloat(d));else if("max"===t)n=Math.max(n,parseFloat(d));else if("count"===t)n++;else if("median"===t)n.push(parseFloat(d));else if("blank"===t)n=r[o.dataField][t],null==n&&(n=0),d||n++;else if("filled"===t)n=r[o.dataField][t],null==n&&(n=0),void 0!==d&&n++;else if("unique"===t)n=r[o.dataField][t],null==n&&(n=[]),-1===n.indexOf(d)&&n.push(d);else if("status"===t)n=r[o.dataField][t],null==n&&(n=[]),n[d]||(n[d]=[]),n[d].push(d);else if("object"==typeof t)return void e(t);r[o.dataField][t]=n})):o.functions.forEach((function(t){if("min"===t||"max"===t||"count"===t||"product"===t||"sum"===t||"avg"===t||"stdev"===t||"stdevp"===t||"var"===t||"varp"===t){if(null===d&&"count"!==t)return!0;let e=r[o.dataField][t];return null==e&&(e=0),r[o.dataField][t]=e,!0}if("blank"===t){let e=r[o.dataField][t];null==e&&(e=0),d||e++,r[o.dataField][t]=e}else if("filled"===t){let e=r[o.dataField][t];null==e&&(e=0),d&&e++,r[o.dataField][t]=e}else if("unique"===t){let e=r[o.dataField][t];null==e&&(e=[]),-1===e.indexOf(d)&&e.push(d),r[o.dataField][t]=e}else if("status"===t){let e=r[o.dataField][t];null==e&&(e=[]),e[d]||(e[d]=[]),e[d].push(d),r[o.dataField][t]=e}"object"==typeof t&&e(t)}))}}}}for(let a=0;a<e.length;a++){const n=e[a];if(n.functions&&(!n.functions||0!==n.functions.length)){if(r[n.dataField]||(r[n.dataField]={},n.functions.forEach((function(e){r[n.dataField][e]=0}))),void 0!==r[n.dataField].avg){const e=r[n.dataField].avg,t=i[n.dataField];r[n.dataField].avg=0===t||void 0===t?0:e/t}else void 0!==r[n.dataField].count&&(r[n.dataField].count=d);if(void 0!==r[n.dataField].unique){const e=r[n.dataField].unique;r[n.dataField].unique=e.length}if(void 0!==r[n.dataField].status){const e=r[n.dataField].status;r[n.dataField].status=e}if(void 0!==r[n.dataField].median){let e=r[n.dataField].median;e.sort((function(e,t){return e-t})),r[n.dataField].median=.5*(e[Math.floor((e.length+1)/2)-1]+e[Math.ceil((e.length+1)/2)-1])}(r[n.dataField].stdev||r[n.dataField].stdevp||r[n.dataField].var||r[n.dataField].varp)&&n.functions.forEach((function(e){if("stdev"===e||"var"===e||"varp"===e||"stdevp"===e){const a=r[n.dataField][e],i=o,d=a/o;let l=0;for(let e=0;e<o;e++){let a=t[e][n.dataField];l+=(a-d)*(a-d)}let s="stdevp"===e||"varp"===e?i:i-1;0===s&&(s=1),"var"===e||"varp"===e?r[n.dataField][e]=l/s:"stdevp"!==e&&"stdev"!==e||(r[n.dataField][e]=Math.sqrt(l/s))}}))}}return r}}_getDataItem(e,t){const a=this,n={},r="number"==typeof a.dataSource||a.dataSourceLength;if(!e)return{$:{id:t,isEmpty:!0,index:t}};if("string"==typeof e&&(e={"":e}),r){for(let e=0;e<a.dataFields.length;e++){n[(a.dataFields?a.dataFields[e]:{}).name]=""}return n.$={},n.$.id=t,n.$.index=t,n}const i=e;if(void 0!==i.expanded&&(n.expanded=i.expanded,"true"===i.expanded||!0===i.expanded||1===i.expanded?n.expanded=!0:n.expanded=!1),a.childrenDataField?void 0!==i[a.childrenDataField]&&(n.children=i[a.childrenDataField]):void 0!==i.children?n.children=i.children:void 0!==i.items&&(n.children=i.items),void 0!==i.leaf&&(n.leaf=i.leaf),void 0!==i.level&&(n.level=i.level),a.keyDataField&&void 0!==i[a.keyDataField]&&(n[a.keyDataField]=i[a.keyDataField]),a.parentDataField&&void 0!==i[a.parentDataField]&&(n[a.parentDataField]=i[a.parentDataField]),0===a.dataFields.length){const t=Object.getOwnPropertyNames(e);for(let e=0;e<t.length;e++)"$"!==t[e]&&a.dataFields.push({name:t[e],dataType:"string"})}for(let t=0;t<a.dataFields.length;t++){const r=a.dataFields?a.dataFields[t]:{};let o="";if(null==r)continue;if(e.length&&(o=e[t]),r.map){let e=r.map.split(a.mapChar);if(e.length>0){let t=i;for(let a=0;a<e.length;a++)i&&t&&(t=t[e[a]]);o=t}else o=i[r.map]}null!=o?o=o.toString():void 0===o&&null!==o&&(o="");let d=!1;if(""===o&&(d=!0,o=e[r.name],void 0===r.dataType&&(r.dataType="any"),null!=o?"array"!==r.dataType&&("any"===r.dataType?o=Array.isArray(e[r.name])?[...e[r.name]]:"object"==typeof e[r.name]?Object.assign({},e[r.name]):e[r.name]:"date"!==r.dataType&&(o=o.toString())):o=void 0===o&&"any"===r.dataType?null:""),"[object Object]"===o&&r.map&&d&&(o=""),a._cachedValues[o+"_"+r.dataType])o=a._cachedValues[o+"_"+r.dataType];else{if("bool"===r.dataType||"boolean"===r.dataType)"true"===o||"1"===o?o=!0:"false"!==o&&"0"!==o||(o=!1);else if("number"===r.dataType)-1===o.indexOf(".")&&o.indexOf(",")>=0&&o.substring(1+o.indexOf(",")).length<3&&(o=o.replace(",",".")),o=a.$document.deserialize(""+o,r.dataType,!0);else if("date"===r.dataType){if(o&&"string"==typeof o&&o.indexOf("[")>=0){const e=JSON.parse(o);if(r.formatString&&Smart.Utilities.DateTime){const t=Smart.Utilities.DateTime.ParseDate(e[0],r.formatString),a=Smart.Utilities.DateTime.ParseDate(e[1],r.formatString);e[0]=t,e[1]=a}else{const t=a.$document.deserialize(""+e[0],r.dataType,!0),n=a.$document.deserialize(""+e[1],r.dataType,!0);e[0]=t,e[1]=n}o=e,n[r.name]=o;continue}if(r.formatString&&Smart.Utilities.DateTime){o=Smart.Utilities.DateTime.ParseDate(o,r.formatString)}else o=a.$document.deserialize(""+o,r.dataType,!0)}else"any"!==r.dataType&&(o="string"===r.dataType&&"null"===o?"null":a.$document.deserialize(""+o,r.dataType,!0));"any"!==r.dataType&&(a._cachedValues[o+"_"+r.dataType]=o)}"string"!==r.dataType&&"boolean"!==r.dataType&&"bool"!==r.dataType&&"any"!==r.dataType&&(isNaN(o)||o===-1/0||o===1/0)&&(o="date"===r.dataType||"number"===r.dataType?null:0),"parent"!==r.name&&"group"!==r.name&&"leaf"!==r.name&&"level"!==r.name?("string"===r.dataType&&/<.+?>/.test(o)&&o.replace&&("all"===a.sanitizeHTML?o=o.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/'/g,"&#39;").replace(/"/g,"&quot;"):"blackList"===a.sanitizeHTML&&(o=window.Smart.Utilities.Core.sanitizeHTML(o),o.indexOf("<br")>=0&&(o=o.replaceAll("<br/>","\n\r"),o=o.replaceAll("<br>","\n\r")))),n[r.name]=o):n.$[r.name]=o}let o=t;if(a.id){if(o=i[a.id],void 0===o)if(void 0!==n[a.id])o=n[a.id];else{const e=function(){return(65536*(1+Math.random())|0).toString(16).substring(1)};o=e()+e()}"object"==typeof o&&(o=t),i.$&&void 0!==i.$.id&&(o=i.$.id)}else if(!a.virtualDataSource&&a.dataItemById&&a.dataItemById[o])for(o=a.length;a.dataItemById[o];)o++;return n.$||(n.$={}),n.$.id=o,n.$.index=t,new Object(n)}_bindToArray(){const e=this,t="number"==typeof e.dataSource||e.dataSourceLength,a=[];e.boundSource.canNotify=!1;const n=t?"number"==typeof e.dataSource?e.dataSource:e.dataSource.length:e.observable?e.length:e.dataSource.length;for(let r=0;r<n;r++){const n=t?{}:e.dataSource[r],i=e._getDataItem(n,r);a.push(i)}if(t&&e.dataSourceLength&&e.dataSource.length>0)for(let t=0;t<e.dataSource.length;t++){const n=e.dataSource[t].cell,r=e.dataSource[t].value,i=n.replace(/[^0-9]/g,""),o=n.replace(/[0-9]/g,"");a[i-1][o]=r}e.boundSource=!1===e.observable||e.virtualDataSource?[]:new Smart.ObservableArray(a),e.observable&&(e.boundSource=new Smart.ObservableArray(a));for(let t=0;t<n;t++)e.observable?e[t]=e.boundSource[t]:e[t]=a[t],e.dataItemById[e[t].$.id]=e[t];!1===e.observable&&(e.boundSource=a),e.boundSource.canNotify=!0}_bindToICS(){const e=this,t=""+e.dataSource,a=e.rowDelimiter||"\n",n=t.split("\r"),r=[];let i=t.split(a),o=i.length;1===o&&n.length>1&&(i=n,o=i.length);const d=function(e,t){var a=/^(\d{4})(\d{2})(\d{2})(T(\d{2})(\d{2})(\d{2})Z)?$/.exec(e);if(!a)throw new Error("Invalid UNTIL value: "+e);return t?new Date(a[1],a[2]-1,a[3],0,0,0,0):new Date(Date.UTC(a[1],a[2]-1,a[3],a[5]||0,a[6]||0,a[7]||0))};for(let e=0;e<o;e++){const t=i[e].trim();if(t.indexOf("BEGIN:VEVENT")>=0)var l={};else if(l)if(t.indexOf("BEGIN:VALARM")>=0)var s={};else{if(s){if(t.indexOf("ACTION")>=0){s.ACTION=t.substring(t.indexOf("ACTION")+7);continue}if(t.indexOf("DESCRIPTION")>=0){s.DESCRIPTION=t.substring(t.indexOf("DESCRIPTION")+12);continue}if(t.indexOf("TRIGGER")>=0){s.TRIGGER=t.substring(t.indexOf("TRIGGER")+8);continue}if(t.indexOf("END:VALARM")>=0){l.ALARM||(l.ALARM=[]),l.ALARM.push(s),s=void 0;continue}}if(t.indexOf("SUMMARY")>=0)l.SUMMARY=t.substring(t.indexOf("SUMMARY")+8);else if(t.indexOf("LOCATION")>=0)l.LOCATION=t.substring(t.indexOf("LOCATION")+9);else if(t.indexOf("DESCRIPTION")>=0)l.DESCRIPTION=t.substring(t.indexOf("DESCRIPTION")+12);else if(t.indexOf("RRULE")>=0)l.RRULE=t.substring(t.indexOf("RRULE")+6);else if(t.indexOf("RECURRENCE-ID")>=0)l.RECURRENCEID=t.substring(t.indexOf("RECURRENCE-ID")+14);else if(t.indexOf("RECURRENCE-ID;VALUE=DATE")>=0)l.RECURRENCEID=t.substring(t.indexOf("RECURRENCE-ID;VALUE=DATE")+25);else if(t.indexOf("EXDATE;VALUE=DATE")>=0){const e=t.substring(t.indexOf("EXDATE;VALUE=DATE")+20);l.EXDATE=e}else if(t.indexOf("EXDATE")>=0){const e=t.substring(t.indexOf("EXDATE")+7);l.EXDATE=e}else t.indexOf("DTEND;VALUE=DATE")>=0?l.DTEND=d(t.substring(t.indexOf("DTEND;VALUE=DATE")+17),!0):t.indexOf("DTEND")>=0?l.DTEND=d(t.substring(t.indexOf("DTEND")+6)):t.indexOf("DTSTART;VALUE=DATE")>=0?l.DTSTART=d(t.substring(t.indexOf("DTSTART;VALUE=DATE")+19),!0):t.indexOf("DTSTART")>=0?l.DTSTART=d(t.substring(t.indexOf("DTSTART")+8)):t.indexOf("UID")>=0?l.uid=l.UID=t.substring(t.indexOf("UID")+4):t.indexOf("STATUS")>=0?l.STATUS=t.substring(t.indexOf("STATUS")+7):t.indexOf("TITLE")>=0?l.TITLE=t.substring(t.indexOf("TITLE")+6):t.indexOf("CATEGORIES")>=0?l.CATEGORIES=t.substring(t.indexOf("CATEGORIES")+11):t.indexOf("END:VEVENT")>=0&&(r.push(l),l.ALARM&&(l.ALARM=JSON.stringify(l.ALARM)),s=void 0)}}e.canNotify=!1,e.dataSource=r,e.canNotify=!0,e._bindToArray()}_bindToJSON(){const e=this,t=[],a=e.dataSource.length?e.dataSource:Object.entries(e.dataSource);e.boundSource.canNotify=!1;for(let n=0;n<a.length;n++){const r=a[n],i=e._getDataItem(r,n);t.push(i)}e.boundSource=!1===e.observable||e.virtualDataSource?[]:new Smart.ObservableArray(t);for(let t=0;t<e.length;t++)e[t]=e.boundSource[t],e.dataItemById[e[t].$.id]=e[t];!1===e.observable&&(e.boundSource=t),e.boundSource.canNotify=!0}sortBy(e,t,a){const n=this;if(!t)for(let a=0;a<n.dataFields.length;a++){const r=n.dataFields[a];if(r.name===e){t=r.dataType;break}}if(n.boundHierarchy){if((!e||0===e.length)&&n.groupBy.length>0)return void n.refreshHierarchy();const r=(e=>{let t=[];for(;e;){t=t.concat(e);for(let a=0;a<e.length;a++)e[a].children&&(t=t.concat(e[a].children));e=e.children}return t})(n.boundHierarchy);if(r){r.find((e=>{if(e.summaryRow)return e}))&&n.refreshHierarchy()}const i=function(r){n._sort(r,e,a,t);for(let n=0;n<r.length;n++){const o=r[n];o.children&&i(o.children,e,a,t)}};i(n.boundHierarchy)}else n._sort(n.boundSource,e,a,t)}_createFilter(e,t){const a={"=":"EQUAL","<>":"NOT_EQUAL","!=":"NOT_EQUAL",not_like:"DOES_NOT_CONTAIN",like:"CONTAINS","<":"LESS_THAN",">":"GREATER_THAN","<=":"LESS_THAN_OR_EQUAL",">=":"GREATER_THAN_OR_EQUAL",equal:"EQUAL","not equal":"NOT_EQUAL","less than":"LESS_THAN","greater than":"GREATER_THAN","greater than or equal":"GREATER_THAN_OR_EQUAL","less than or equal":"LESS_THAN_OR_EQUAL","starts with":"STARTS_WITH","ends with":"ENDS_WITH",notEqual:"NOT_EQUAL",not_equal:"NOT_EQUAL",lessThan:"LESS_THAN",greaterThan:"GREATER_THAN",greaterThanOrEqual:"GREATER_THAN_OR_EQUAL",lessThanOrEqual:"LESS_THAN_OR_EQUAL",less_than:"LESS_THAN",greater_than:"GREATER_THAN",greater_than_or_equal:"GREATER_THAN_OR_EQUAL",less_than_or_equal:"LESS_THAN_OR_EQUAL",null:"null","":"EMPTY",isblank:"EMPTY",isnotblank:"NOT_EMPTY",isBlank:"EMPTY",isNotBlank:"NOT_EMPTY",CONTAINS:"CONTAINS",DOES_NOT_CONTAIN:"DOES_NOT_CONTAIN",contains:"CONTAINS",does_not_contain:"DOES_NOT_CONTAIN","not contains":"DOES_NOT_CONTAIN",notcontains:"DOES_NOT_CONTAIN",notContains:"DOES_NOT_CONTAIN",startswith:"STARTS_WITH",endswith:"ENDS_WITH",starts_with:"STARTS_WITH",ends_with:"ENDS_WITH",startsWith:"STARTS_WITH",endsWith:"ENDS_WITH",NULL:"NULL",NOT_NULL:"NOT_NULL"};let n=[];"string"==typeof t&&(t=[t]);for(let e=0;e<t.length;e++){const a=t[e],r=-1===a.indexOf('"')?a.split(" "):a.split('"');let i=[];for(let e=0;e<r.length;e++){const t=r[e];if(""!==t&&" "!==t){if("true"===t.trim()){i.push(!0);continue}if("false"===t.trim()){i.push(!1);continue}if(t.indexOf(" GMT")>=0)i.push(t.trim());else if(t.indexOf("or ")>=0||t.indexOf("and ")>=0||t.indexOf("1 ")>=0||t.indexOf("0 ")>=0||t.indexOf("| ")>=0||t.indexOf("& ")>=0){const e=t.trim().split(" ");if(e.length>1){const t=e[0].trim(),a=e[1].trim();"1"===t?i.push("or"):"0"===t?i.push("and"):i.push(t),i.push(a)}else i.push(t.trim())}else i.push(t.trim())}}n.push(i)}const r=new Smart.FilterGroup,i=[],o=[];for(let t=0;t<n.length;t++){const r=n[t];if(r.length>1){const t=new Smart.FilterGroup;let n=r.length>2?"":"and",i=0,d=[];for(let o=0;o<r.length;o++){let l=r[o];if("and"!==l&&"or"!==l){if(i++,2===i){let s=a[r[o-1]];s||(s=r[o-1]),"number"===e&&(l=parseFloat(l)),"date"===e&&(l=new Date(l));const c=t.createFilter(e,l,s);if(i=0,d.push(c),n){for(let e=0;e<d.length;e++)t.addFilter(n,d[e]);d=[]}}}else n=l}o.push(t)}else{let e=r[0];if(e&&a[e]&&(e="and"),"and"!==e&&"or"!==e)throw new Error('Filter Exprresion expects "AND" or "OR", but the token is: '+e);i.push(e)}}let d=0;if(1===o.length)return o[0];for(let e=0;e<o.length;e++){let t=i[d];(e+1)%2==0&&d++,t||(t="and"),r.addFilter(t,o[e])}return r}filterBy(e,...t){const a=this,n=(()=>{for(let t=0;t<a.dataFields.length;t++){const n=a.dataFields[t];if(n.name===e)return n.dataType}})(),r=a._createFilter(n,t);return a.boundSource.filter((t=>r.evaluate(t[e])))}_filter(e,t="and"){const a=this,n=[],r=[];if(0===e.length)return void a.clearFilter();const i=e=>{for(let t=0;t<a.dataFields.length;t++){const n=a.dataFields[t];if(n.name===e)return n.dataType}};let o,d;"and"===t?(o=!0,d=function(e,t,a){return e&&t.evaluate(a[t.dataField])}):(o=!1,d=function(e,t,a){return e||t.evaluate(a[t.dataField])});for(let t=0;t<e.length;t++){const o=e[t],d=o[0];let l=null;l=o[1]instanceof Smart.FilterGroup?o[1]:a._createFilter(i(d),o.splice(1)),l&&(r.push(d),l.dataField=d,n.push(l))}if(a.boundHierarchy){const e=function(e){let t=o;for(let a=0;a<n.length;a++){const r=n[a];t=d(t,r,e)}return e.$.filtered=t,t},t=function(n,r,i){let o=0;for(let a=0;a<n.length;a++){const i=n[a];e(i),i.$.filtered&&o++,i.children&&t(i.children,i,r)}o>0&&a.groupBy.length>0&&r?(r.$.filtered=!0,i&&!i.$.filtered&&(i.$.filtered=!0)):o>0&&o!==n.length&&r?(r.$.filtered=null,i&&!i.$.filtered&&(i.$.filtered=null)):o>0&&o===n.length&&r&&(r.$.filtered=!0,i&&!i.$.filtered&&(i.$.filtered=!0))};t(a.boundHierarchy,null,null)}else for(let e=0;e<a.boundSource.length;e++){const t=a.boundSource[e];let r=o;for(let e=0;e<n.length;e++){const a=n[e];r=d(r,a,t)}t.$.filtered=r}a.onFilter&&a.onFilter()}clearGroup(){const e=this;e.groupBy=[],e.boundHierarchy=null,e.refreshHierarchy(),e.onGroup&&e.onGroup()}clearFilter(){const e=this;for(let t=0;t<e.boundSource.length;t++){e.boundSource[t].$.filtered=!0}if(e.boundHierarchy){const t=function(e,a,n){for(let n=0;n<e.length;n++){const r=e[n];r.$.filtered=!0,r.$.filtered,r.children&&t(r.children,r,a)}a&&(a.$.filtered=!0,n&&!n.$.filtered&&(n.$.filtered=!0))};t(e.boundHierarchy,null,null)}e.onFilter&&e.onFilter()}clearSort(){this._sort(this.boundSource,[],[],[])}_sort(e,t,a,n,r,i){const o=this;let d=!1;if(0===e.length)return;if(e&&e.constructor&&e instanceof Smart.ObservableArray&&(d=!0),(!e||!Array.isArray(e)||0===e.length||!t||Array.isArray(t)&&0===t.length)&&!d&&!o.boundHierarchy){if(o.virtualDataSource)return;throw new Error("sort: Missing or Invalid arguments!")}"string"==typeof t&&(t=[t]);const l=[],s=[];void 0===a&&(a=[]);const c=function(e,t){let a;switch(t||typeof e){case"string":a=(new Intl.Collator).compare;break;case"number":case"int":case"bigInt":case"float":case"double":a=function(e,t){return e-t};break;case"boolean":case"bool":a=function(e,t){return e===t?0:!1===e?-1:1};break;case"date":case"time":case"dateTime":a=e instanceof Date?function(e,t){return e||t?e?t?e.getTime()-t.getTime():1:-1:0}:e instanceof Smart.Utilities.DateTime||e instanceof Smart.Utilities.BigNumber?function(e,t){return e.compare(t)}:function(e,t){return e-t};break;case"object":if(e instanceof Date)a=function(e,t){return e||t?e?t?e.getTime()-t.getTime():1:-1:0};else if(e instanceof Smart.Utilities.DateTime||e instanceof Smart.Utilities.BigNumber)a=function(e,t){return e.compare(t)};else if(e instanceof Smart.Utilities.Complex||window.NIComplex&&e instanceof window.NIComplex){const e=new Smart.Utilities.ComplexNumericProcessor;a=function(t,a){return e.compareComplexNumbers(t,a)}}}return a};for(let r=0;r<t.length;r++){void 0===a[r]||"asc"===a[r]||"ascending"===a[r]?l[r]=1:l[r]=-1;let d=e[0][t[r]];if(void 0===d&&e[0]&&e[0].children&&e[0].data&&(d=e[0].data[t[r]]),i&&i){const e=t[r];if(i[e]){s[r]=i[e];continue}}o.sortComparators&&o.sortComparators[t[r]]?s[r]=o.sortComparators[t[r]]:s[r]=c(d,n[r])}t.length>0&&r?r(e,t,a,s):e.sort((function(e,a){for(let n=0;n<t.length;n++){const r=s[n](e[t[n]],a[t[n]]);if(0===r){if(t[n+1])continue;return void 0!==e.$.index?(e.$.index-a.$.index)*l[n]:0}return r*l[n]}if(0===t.length)return e.$.index<a.$.index?-1:e.$.index>a.$.index?1:0}));for(let t=0;t<e.length;t++)o[t]=e[t]}static Filter(e,t,a,n,r="and"){let i,o;"and"===r?(i=!0,o=function(e,t,a,r){return n?e&&n(t,a,r):e&&r.evaluate(t[a])}):(i=!1,o=function(e,t,a,r){return n?e||n(t,a,r):e||r.evaluate(t[a])});return e.filter((e=>{let n=i;for(let r=0;r<a.length;r++){const i=a[r],d=t[r];n=o(n,e,d,i)}return n}))}filter(e,t,a){Smart.DataAdapter.Filter(this.boundSource,e,t,a)}sort(e,t,a){Smart.DataAdapter.Sort(this.boundSource,e,t,a)}static Sort(e,t,a,n){const r=function(e){let t;switch(typeof e){case"string":if(e.indexOf("-")>=0||e.indexOf("/")>=0){const t=new Date(e);if(t&&"Invalid Date"!==t.toString()){return function(e,t){const a=new Date(e),n=new Date(t);return a||n?a?n?a.getTime()-n.getTime():1:-1:0}}}t=(new Intl.Collator).compare;break;case"number":t=function(e,t){return e-t};break;case"boolean":t=function(e,t){return e===t?0:!1===e?-1:1};break;case"object":if(e instanceof Date)t=function(e,t){return e||t?e?t?e.getTime()-t.getTime():1:-1:0};else if(e instanceof Smart.Utilities.DateTime||e instanceof Smart.Utilities.BigNumber)t=function(e,t){return e.compare(t)};else if(e instanceof Smart.Utilities.Complex||window.NIComplex&&e instanceof window.NIComplex){const e=new Smart.Utilities.ComplexNumericProcessor;t=function(t,a){return e.compareComplexNumbers(t,a)}}else t=function(e,t){return e-t}}return t};if(!e||!Array.isArray(e)||0===e.length||!t||Array.isArray(t)&&0===t.length)return;"string"==typeof t&&(t=[t]);const i=[],o=[];void 0===a&&(a=[]);for(let n=0;n<t.length;n++)void 0===a[n]||"asc"===a[n]||"ascending"===a[n]?i[n]=1:i[n]=-1,o[n]=r(e[0][t[n]]);if(n)return void n(e,t,a,o);const d=e.slice(0);return d.sort((function(e,a){for(let n=0;n<t.length;n++){const r=o[n](e[t[n]],a[t[n]]);if(0===r){if(t[n+1])continue;return void 0!==e._index?(e._index-a._index)*i[n]:0}return r*i[n]}})),d}};class e{constructor(e,t){const a=this;a.config=e,a.callback=t,!1!==e.autoFetch&&a.call(e)}call(e){const t=this;e||(e=t.config);let a="GET",n=e.url,r=null,i=!0;if(e.type&&(a=e.type),e.data)if("GET"===a){n+="?";for(let t in e.data)Object.prototype.hasOwnProperty.call(e.data,t)&&(n+=encodeURI(t+"="+e.data[t]+"&"));"&"===n.charAt(n.length-1)&&(n=n.slice(0,n.length-1))}else"POST"===a&&(r=JSON.stringify(e.data));e&&!1===e.async&&"xlsx"!==e.dataSourceType&&(i=!1),void 0!==window.fetch&&i?t.ajaxFetch(e,a,n,r):t.ajaxXMLHttpRequest(e,a,n,r,i)}ajaxFetch(e,t,a,n){const r=this,i={method:t};let o,d,l,s;switch(e.dataSourceType){case"json":o="json";break;case"xlsx":o="arrayBuffer";break;default:o="text"}if(e&&e.contentType&&(i.headers=new Headers({"Content-Type":e.contentType})),null!==n&&(i.body=n),e.timeout&&(l=setTimeout((function(){s=!0}),e.timeout)),e.beforeSend){if(!1===e.beforeSend(i,e))return}fetch(a,i).then((function(e){if(s)throw d=408,new Error("timeout");if(l&&clearTimeout(l),d=e.status,!e.ok)throw new Error(e.statusText);return e[o]()})).then((function(t){if("arrayBuffer"===o)return JSZip.loadAsync(t).then((function(t){return t.files["xl/worksheets/sheet1.xml"].async("text").then((function(a){return t.files["xl/sharedStrings.xml"].async("text").then((function(t){const n=r.parseXLSXData(a,t);r.ajaxComplete(e,n,d)}))}))}));r.ajaxComplete(e,t,d)})).catch((function(t){"JSZip is not defined"===t.message&&(t.message="JSZip is not defined. Please include a reference to JSZip to be able to load data from XLSX files."),e&&e.loadError&&e.loadError(d,t),r.callback&&r.callback(t,d)}))}ajaxXMLHttpRequest(e,t,a,n,r){const i=new XMLHttpRequest,o=this;if(i.open(t,a,r),i.ontimeout=function(){e&&e.loadError&&e.loadError(408,"timeout")},i.onload=function(){if(4===i.readyState){const t=i.status;let a=i.response;t>=200&&t<=299?("json"===e.dataSourceType&&(a=JSON.parse(a)),o.ajaxComplete(e,a,t)):e&&e.loadError&&e.loadError(t,a)}},i.onerror=function(){e&&e.loadError&&e.loadError(i.status,i.response)},e&&e.contentType&&i.setRequestHeader("Content-Type",e.contentType),r&&e.timeout&&(i.timeout=e.timeout),e.beforeSend){if(!1===e.beforeSend(i,e))return}i.send(n)}ajaxComplete(e,t,a){if(e){if(e.beforeLoadComplete){const a=e.beforeLoadComplete(t);a&&(t=a)}e.loadComplete&&e.loadComplete(t,a),this.callback&&this.callback(t,a)}}parseXLSXData(e,t){const a=new DOMParser,n=a.parseFromString(t,"text/xml"),r=Array.from(n.getElementsByTagName("si")),i=[],o=a.parseFromString(e,"text/xml"),d=Array.from(o.getElementsByTagName("row")),l=[];return r.forEach((function(e){let t=e.getElementsByTagName("t");if(1===t.length)i.push(t[0].innerHTML);else{let e="";t=Array.from(t),t.forEach((function(t){e+=t.innerHTML})),i.push(e)}})),d.forEach((function(e){const t={};Array.from(e.getElementsByTagName("c")).forEach((function(e){const a=e.getAttribute("r").match(/\D+/)[0],n=e.getAttribute("t"),r=e.getElementsByTagName("v")[0].innerHTML;let o;switch(n){case"s":o=i[parseFloat(r)];break;case"b":o=1===parseFloat(r);break;default:o=parseFloat(r)}t[a]=o})),l.push(t)})),l}}Smart.Ajax=window.Ajax=e})();
1330
+ (()=>{Smart.DataAdapter=window.smartDataAdapter=class{constructor(e){e||(e={});const t=Object.assign(this,e);t.key=(65536*(1+Math.random())|0).toString(16).substring(1),t.$document=Smart.Utilities.Extend(document),t.boundSource=!1===t.observable||t.virtualDataSource?[]:new Smart.ObservableArray,t.dataItemById=[],void 0===t.allowAdd&&(t.allowAdd=!0),void 0===t.allowRemove&&(t.allowRemove=!0),void 0===t.allowUpdate&&(t.allowUpdate=!0),void 0===t.mapChar&&(t.mapChar="."),void 0!==e.observable||t.virtualDataSource?t.observable=!1:t.observable=!0,void 0===t.sanitizeHTML&&(t.sanitizeHTML="blackList"),t._expandedRowIds=[],e.dataSource||(t.dataSource=[]),e.dataFields||(t.dataFields=[]),e.dataSourceType||(t.dataSourceType="array"),e.id||(t.id=null),e.autoFetch||(t.autoFetch=!0),void 0===e.skipFirstRow&&(t.skipFirstRow=!1),e.dataFields&&(t.dataFields=e.dataFields),Object.defineProperty(t,"groupBy",{configurable:!1,enumerable:!0,get:()=>t._groupBy?t._groupBy:[],set(e){const a=()=>{t.boundHierarchy=null,t.refreshHierarchy(),t.onGroup&&t.onGroup()};t._groupBy=new Smart.ObservableArray(e),t._groupBy.notify((function(){a()})),t.isInitialized&&a()}}),e.groupBy?e.groupBy.toArray?t.groupBy=e.groupBy.toArray():t.groupBy=e.groupBy:t.groupBy=[],e&&!1!==e.autoBind&&t.dataBind(),t.isInitialized=!0}beginUpdate(){this.isUpdating=!0}endUpdate(){const e=this;e.isUpdating=!1,e.refreshIndexes(),e.refreshHierarchy()}get expandHierarchy(){return void 0===this._expandHierarchy&&(this._expandHierarchy=!1),this._expandHierarchy}set expandHierarchy(e){const t=this;t._expandHierarchy=e,t.isInitialized&&t.refreshHierarchy()}_getDataField(e){switch(e.name){case"leaf":case"parent":case"expanded":case"checked":case"selected":case"level":case"icon":case"data":case"group":case"children":case"items":e.map?e.map=e.map.replace(e.name,"$"+e.name):e.map=e.name,e.name="$"+e.name}}get dataFields(){return this._dataFields}set dataFields(e){const t=this;return t._dataFields=t._getDataFieldObjects(e),t._dataFields}_getDataFieldObjects(e){const t=this;let a=[];if("number"==typeof e){const t="A".charCodeAt(0);let n="",r=0;for(let i=0;i<e;i++){const e=String.fromCharCode(t+r);r++;const i=n+e;a.push({name:i,dataType:"string"}),r>=26&&(r=0,n+="A")}}else if(Array.isArray(e)&&e.length>0)for(let n=0;n<e.length;n++){const r=e[n];if("string"==typeof r){const e=r.split(":"),t=e[0].trim(),n=e.length>1?e[1].trim():"string";a.push({name:t,dataType:n})}else a.push(r);t._getDataField(a[a.length-1])}return a}get dataSource(){const e=this;return e._dataSource||(e._dataSource=[]),e._dataSource}set dataSource(e){const t=this;t._dataSource=e,t.isInitialized&&(t.boundSource=!1===t.observable||t.virtualDataSource?[]:new Smart.ObservableArray,t.dataItemById=[],t.bindingCompleted=!1,t.dataBind(),t.refreshIndexes())}get canNotify(){const e=this;return void 0===e._canNotify&&(e._canNotify=!0),e._canNotify}set canNotify(e){this._canNotify=e}_notify(e){const t=this;t.canNotify&&t.notifyFn&&t.notifyFn(e)}notify(e){e&&(this.notifyFn=e)}toArray(){const e=this;return!1===e.observable?e.boundSource:e.boundSource.toArray()}forEach(e){const t=this;if(e)if(t.boundHierarchy&&t.boundHierarchy.length>0){const a=(e=>{let t=[];for(;e;){t=t.concat(e);for(let a=0;a<e.length;a++)e[a].children&&(t=t.concat(e[a].children));e=e.children}return t})(t.boundHierarchy);for(let t=0;t<a.length;t++){e(a[t],t)}}else for(let a=0;a<t.boundSource.length;a++){e(t.boundSource[a],a)}}dataBind(){const t=this;t.bindingCompleted=!1,t.clear();const a=()=>{t.observable&&(t.boundSource.notify||(t.boundSource=new Smart.ObservableArray),t.boundSource.notify((function(e){if("update"===e.action&&e.path&&e.path.indexOf(".")>=0&&-1===e.path.indexOf("children")&&-1===e.path.indexOf("parent")&&-1===e.path.indexOf("loaded")&&-1===e.path.indexOf("level")&&-1===e.path.indexOf("leaf")&&-1===e.path.indexOf("expanded")){let a=!1;for(let n=0;n<t.dataFields.length;n++){const r=t.dataFields[n].name;e.path.indexOf(r)>=0&&(a=!0)}t._notify&&a&&t._notify({action:"update",data:e.target,index:e.index})}}))),t._onBindingComplete()};if("string"==typeof t.dataSource&&(t.dataSource.indexOf(".json")>=0||"json"===t.dataSourceType))t.url=t.dataSource,t.dataSourceType="json",new e(t,(e=>{t.dataSource=e}));else if("string"==typeof t.dataSource&&t.dataSource.indexOf(".xml")>=0)t.url=t.dataSource,t.dataSourceType="xml",new e(t,(e=>{t.dataSource=e}));else if("string"==typeof t.dataSource&&t.dataSource.indexOf(".xlsx")>=0)t.url=t.dataSource,t.dataSourceType="xlsx",new e(t,(e=>{if(!e[0])return e=[],t._bindToArray(),void a();const n=Object.keys(e[0]),r={},i=[];if(!1!==t.exportHeader){let a=0;for(let e in n){r[n[e]]=t.dataFields[a++].name}for(let t=1;t<e.length;t++){const a=e[t],o={};for(let e in n){const t=n[e];o[r[t]]=a[t]}i.push(o)}t.dataSource=i}t._bindToArray(),a()}));else if("string"==typeof t.dataSource&&t.dataSource.indexOf(".csv")>=0)t.url=t.dataSource,t.dataSourceType="csv",new e(t,(e=>{t.dataSource=e}));else if("string"==typeof t.dataSource&&t.dataSource.indexOf(".tsv")>=0)t.url=t.dataSource,t.dataSourceType="tsv",new e(t,(e=>{t.dataSource=e}));else if("string"==typeof t.dataSource&&(t.dataSource.indexOf(".ics")>=0||t.dataSource.indexOf(".php")>=0&&"ics"===t.dataSourceType||t.dataSource.indexOf(".txt")>=0&&"ics"===t.dataSourceType))t.url=t.dataSource,t.dataSourceType="ics",new e(t,(e=>{t.dataSource=e}));else if("string"==typeof t.dataSource&&(t.dataSource.indexOf("BEGIN:VCALENDAR")>=0||"ics"===t.dataSourceType))t._bindToICS(),a();else if("string"==typeof t.dataSource&&(t.dataSource.indexOf("<?xml")>=0||"xml"===t.dataSourceType))t._bindToXML(),a();else if("string"==typeof t.dataSource&&(t.dataSource.indexOf(" ")>=0||t.dataSource.indexOf(",")>=0||"tsv"===t.dataSourceType||"csv"===t.dataSourceType||"tab"===t.dataSourceType))t._bindToCSV(),a();else if("array"===t.dataSourceType)t._bindToArray(),a();else if("json"===t.dataSourceType){if(t.dataSource&&t.dataSource.url)return t.url=t.dataSource.url,t.dataSource.method&&(t.type=t.dataSource.method),t.dataSource.type&&(t.type=t.dataSource.type),t.dataSource.data&&(t.data=t.dataSource.data),void new e(t,(e=>{t.dataSource=e}));t._bindToJSON(),a()}}_bindToXML(){const e=this;let t=null,a=null;window.DOMParser&&(t=new DOMParser,a=t.parseFromString(e.dataSource,"text/xml")),void 0===e.root&&(e.root=""),void 0===e.record&&(e.record="");const n=a.querySelectorAll(e.root+" "+e.record),r=n.length,i=[];let o=e.dataFields?e.dataFields.length:0;if(0===o){const t=n[0],a=new Array;for(let e in t){const t=e;a[a.length]={name:t}}e.dataFields=a,o=a.length}for(let t=0;t<r;t++){const a=n[t],r={};if(void 0===a)break;if(e.id){const t=a.querySelector(e.id);r[e.id]=t.textContent}for(let t=0;t<o;t++){const n=e.dataFields[t],i=a.querySelector(n.map||n.name);r[n.name]=i.textContent}i[t]=r}e.canNotify=!1,e.dataSource=i,e.canNotify=!0,e._bindToArray()}static BindToCSV(e,t=!1){const a=""+e,n=-1===a.indexOf(",")?"\t":",",r=a.split("\r"),i=new Array,o=[];let d=a.split("\n"),l=d.length;1===l&&r.length>1&&(d=r,l=d.length);const s=!0===t;for(let e=0;e<l;e++){const t={},a=d[e].split(n);for(let n=0;n<a.length;n++){let r=o[n],i=a[n];if(r||(o.push({name:i.trim()}),r=o[o.length-1]),i=i.trim(),1!==e||s)switch(r.dataType){case"boolean":i="false"!==i;break;case"number":i=parseFloat(i);break;case"date":i=new Date(i)}else{let e="string";"false"===i||"true"===i?(e="boolean",i="false"!==i):isNaN(parseInt(i)&&-1===i.indexOf("/"))?(i.indexOf("-")>=0||i.indexOf("/")>=0||i.indexOf(":")>=0)&&"Invalid Date"!==new Date(i).toString()&&(e="date",i=new Date(i)):(e="number",i=parseFloat(i)),r.dataType||(r.dataType=e)}t[r.name]=i}(s||e>0)&&i.push(t)}return i}_bindToCSV(){const e=this,t=""+e.dataSource,a=-1===t.indexOf(",")?"\t":",",n=t.split("\r"),r=new Array;let i=t.split("\n"),o=i.length;1===o&&n.length>1&&(i=n,o=i.length);const d=e.dataFields.length>0;for(let t=0;t<o;t++){const n=i[t],o={};let l=i[t].split(a);if(t>0){let e=[],a=0,n=!1,r=i[t];for(let t=0;t<r.length;t++)if('"'===r.charAt(t))n=!n;else if(","===r.charAt(t)&&!n){let n=r.substring(a,t);n=n.trim(),n=n.replaceAll('"',""),e.push(n),a=t+1}let o=r.substring(a);o=o.trim(),o=o.replaceAll('"',""),","===o?e.push('""'):e.push(o),l=e}for(let a=0;a<l.length;a++){let r=e.dataFields[a],i=l[a];if(r||(e.dataFields.push({name:i.trim()}),r=e.dataFields[e.dataFields.length-1]),r.map&&(i=n[r.map]),i=i.trim(),1!==t||d)switch(r.dataType){case"boolean":i="false"!==i;break;case"number":i=parseFloat(i);break;case"date":i=new Date(i)}else{let e="string";"false"===i||"true"===i?(e="boolean",i="false"!==i):isNaN(parseInt(i)&&-1===i.indexOf("/")&&-1===i.indexOf("-"))?(i.indexOf("-")>=0||i.indexOf("/")>=0||i.indexOf(":")>=0)&&"Invalid Date"!==new Date(i).toString()&&(e="date",i=new Date(i)):i.indexOf(".")>=0&&i.lastIndexOf(".")!==i.indexOf(".")?-1===i.indexOf(",")&&(e="date",i=new Date(i)):(e="number",i=parseFloat(i)),r.dataType||(r.dataType=e)}o[r.map||r.name||a.toString()]=i}0===t&&e.skipFirstRow||(d||t>0)&&r.push(o)}e.canNotify=!1,e.dataSource=r,e.canNotify=!0,e._bindToArray()}_onBindingComplete(){const e=this;e._buildHierarchy(),e.onBindingComplete&&e.onBindingComplete({data:e.boundSource}),e._notify&&e._notify({action:"bindingComplete",data:e.boundSource}),e.bindingCompleted=!0}refreshHierarchy(){this.isUpdating||this._buildHierarchy()}find(){return this.boundSource.find.apply(this.boundSource,arguments)}onVirtualDataSourceRequested(e,t){const a=this;let n=t?t.first:1/0,r=t?t.last:1/0,i=t?t.row:null;if(void 0===n&&(n=1/0),void 0===r&&(r=1/0),a.virtualFirstIndex=n,a.virtualLastIndex=r,a.virtualDataSource){const o=function(r){void 0!==r.virtualDataSourceLength&&(a.virtualDataSourceLength=r.virtualDataSourceLength),new Smart.DataAdapter({dataSource:r.dataSource,dataFields:r.dataFields||a.dataFields,data:t,keyDataField:r.keyDataField,parentDataField:r.parentDataField,observable:!1,id:r.id||a.id,onBindingComplete(r){if(void 0===t.result&&(t.result=!0),t.data=r.data,a.virtualDataSourceOnExpand&&i)return a.groupBy.length>0?r.data&&r.data.length>0&&a.add(r.data):r.data&&r.data.length>0?a.add(r.data,i.$.id):i.leaf=!0,a.onFilter&&a.onFilter(),void e(t);n===1/0&&"scroll"===t.action?r.data&&r.data.length&&a.add(r.data):"filter"===t.action||"group"===t.action?(a.canNotify=!1,a.dataSource=r.data,a.canNotify=!0):("add"===t.action||"update"===t.action||t.action,a.canNotify=!1,a.dataSource=r.data,a.canNotify=!0),a.onFilter&&a.onFilter(),e(t)}})};let d={};if(t.sorting&&t.sorting.length>0){let e=[];for(let a in t.sorting)e.push(a+" "+t.sorting[a].sortOrder.toUpperCase());const a=" ORDER BY "+e.join(", ");d.orderBy=a}else d.orderBy="";if(void 0===n||void 0===r||0===n&&0===r)d.limit="";else{const e=r-n,t=" LIMIT "+e+" OFFSET "+n;d.limit=t,isNaN(e)&&(d.limit="")}if(t.grouping&&t.grouping.length>0){const e=" GROUP BY "+t.grouping[0];d.groupBy=e}else d.groupBy="";if(t.filtering&&t.filtering.length>0){const e=(e,t)=>{switch(t.condition){case"EMPTY":return e+" = ''";case"NOT_EMPTY":return e+" != ''";case"EQUAL":return e+" = '"+t.value+"'";case"NOT_EQUAL":return e+" != '"+t.value+"'";case"CONTAINS_CASE_SENSITIVE":case"CONTAINS":return e+" LIKE '%"+t.value+"%'";case"DOES_NOT_CONTAIN_CASE_SENSITIVE":case"DOES_NOT_CONTAIN":return e+" NOT LIKE '%"+t.value+"%'";case"STARTS_WITH_CASE_SENSITIVE":case"STARTS_WITH":return e+" LIKE '"+t.value+"%'";case"ENDS_WITH_CASE_SENSITIVE":case"ENDS_WITH":return e+" LIKE '%"+t.value+"'";case"NULL":return e+" IS NULL";case"NOT_NULL":return e+" IS NOT NULL"}},a=(e,t)=>{let a=t.value,n=t.valueTo;if(a&&a instanceof Date){a=`'${new Smart.Utilities.DateTime(a).toString("yyyy-MM-dd")}'`}if(t.valueTo&&t.valueTo instanceof Date){n=`'${new Smart.Utilities.DateTime(n).toString("yyyy-MM-dd")}'`}switch(t.condition){case"EQUAL":return e+" = "+a;case"NOT_EQUAL":return e+" != "+a;case"GREATER_THAN":return e+" > "+a;case"GREATER_THAN_OR_EQUAL":return e+" >= "+a;case"LESS_THAN":return e+" < "+a;case"LESS_THAN_OR_EQUAL":return e+" <= "+a;case"NULL":return e+" IS NULL";case"NOT_NULL":return e+" IS NOT NULL";case"RANGE":return"("+e+" >= "+a+" and "+e+" <= "+n+")"}},n=(e,t,a)=>{if(a.operator){var n=e(t,a.condition1),r=e(t,a.condition2);return"("+n+" "+a.operator+" "+r+")"}return e(t,a)};let r=[];for(let i in t.filtering){const o=t.filtering[i];let d=o.filters,l=[],s=" AND ";for(let t=0;t<d.length;t++){const r=d[t];switch(r.type){case"stringFilter":l.push(n(e,i,r));break;case"numericFilter":case"dateFilter":case"booleanFilter":l.push(n(a,i,r))}1!==o.logicalOperators[t]&&"or"!==o.logicalOperators[t]||(s=" OR ")}l.length&&r.push("("+l.join(s)+")")}if(r.length>0){let e=" AND ";t.filterOperator&&"or"===t.filterOperator.toLowerCase()&&(e=" OR "),d.where=" WHERE "+r.join(e).replace(/</g,"&lt;").replace(/>/g,"&gt;")}else d.where=""}else d.where="";if("dataBind"===t.action&&a.virtualDataSourceOnExpand&&a.keyDataField&&a.parentDataField&&(d.where?d.where+=" AND "+a.parentDataField+" IS NULL":d.where=" WHERE "+a.parentDataField+" IS NULL"),"update"===t.action){const e=[];for(let n in t.edit.row){if("$"===n||n===a.id)continue;const r=null===t.edit.row[n]?"":t.edit.row[n]+"";e.push(n+"='"+r.replace(/</g,"&lt;").replace(/>/g,"&gt;")+"'")}null===a.id?d.update=" SET "+e.join(", "):d.update=" SET "+e.join(", ")+" WHERE "+a.id+"="+t.edit.row[a.id]}if("remove"===t.action){const e=[];for(let n in t.edit.row)"$"!==n&&n!==a.id&&e.push(n+" = '"+t.edit.row[n]+"'");d.remove=" WHERE "+a.id+"="+t.edit.row[a.id]}if("add"===t.action){const e=[],a=[];for(let n in t.edit.row)"$"!==n&&(a.push(n),null!==t.edit.row[n]?e.push("'"+t.edit.row[n]+"'"):e.push("null"));d.add=" ("+a.join(", ")+") VALUES ("+e.join(", ")+")"}"expand"===t.action?(a.groupDataField?d.where?d.where+=" AND "+a.groupDataField+" = '"+i[a.groupDataField]+"'":d.where=" WHERE "+a.groupDataField+" = '"+i[a.groupDataField]+"'":a.keyDataField&&a.parentDataField?d.where?d.where+=" AND "+a.parentDataField+" = "+i[a.keyDataField]:d.where=" WHERE "+a.parentDataField+" = "+i[a.keyDataField]:d.where?d.where+=" AND "+i.groupDataField+" = '"+i.label+"'":d.where=" WHERE "+i.groupDataField+" = '"+i.label+"'",d.where.indexOf("undefined")>=0&&(d.where=""),d.limit="",d.groupBy="",a.virtualDataSourceOnExpand(o,{first:n,last:r,row:t.row,sorting:t.sorting,filtering:t.filtering,grouping:t.grouping,action:t.action,query:d})):a.virtualDataSource(o,{first:n,last:r,sorting:t.sorting,edit:t.edit,filtering:t.filtering,filterOperator:t.filterOperator||"and",grouping:t.grouping,action:t.action,query:d})}else e()}add(e,t){const a=this;if(!e)return;let n=!0;const r=function(e){const r=a._getDataItem(e,a.boundSource.length);if(a.dataItemById[r.$.id])return void 0!==t&&(r.$.parentId=t),null;a[a.boundSource.length]=r,a.dataItemById[r.$.id]=r;const i=a.boundSource.push(r);return void 0!==t&&(r.$.parentId=t),i||(n=!1),r};if(e.length){let t=[];for(let a=0;a<e.length;a++){const n=r(e[a]);n&&t.push(n)}a._notify({action:"add",data:t})}else{const t=r(e);a._notify({action:"add",data:t})}return a.refreshHierarchy(),n}refreshIndexes(){const e=this;for(let t=0;t<e.boundSource.length;t++)e[t]=e.boundSource[t],e[t].$.index=t,e.dataItemById[e[t].$.id]=e[t];let t=e.boundSource.length;for(;e[t];)delete e[t],t++}removeLast(){const e=this;delete e[e.boundSource.length-1];const t=e.boundSource.pop();return delete e.dataItemById[t.$.id],e._notify({action:"removeLast",data:t}),e.refreshHierarchy(),t}removeById(e){const t=this,a=t.indexOf(t.dataItemById[e]);t.boundSource[a]&&t.removeAt(a)}remove(e){const t=this;let a=t.indexOf(e);-1===a&&e&&e.$&&(a=t.indexOf(t.dataItemById[e.$.id]));t.boundSource[a]&&t.removeAt(a)}removeAt(e){const t=this,a=t.boundSource[e];if(!a)throw new Error("Invalid Item Index");t.boundSource.splice(e,1),delete t.dataItemById[a.$.id],t.refreshIndexes(),t._notify({action:"remove",index:e,data:a}),t.refreshHierarchy()}update(e,t){const a=this;if(Smart.Utilities.Types.isArray(e)&&Smart.Utilities.Types.isArray(t)&&0===e.length&&0===t.length)return void a.refreshHierarchy();if(t.length&&e.length){let n=[];for(let r=0;r<e.length;r++){const i=a._getDataItem(t[r],e[r]),o=e[r];n.push(i),a.boundSource[o]=i,a[o]=a.boundSource[o],a.dataItemById[i.$.id]=a[o]}return a._notify({action:"update",index:e,data:n}),void a.refreshHierarchy()}const n=a._getDataItem(t,e),r=a.boundSource[e].$.id;return n.$.id=r,a.boundSource[e]=n,a[e]=a.boundSource[e],a.dataItemById[n.$.id]=a[e],a._notify({action:"update",index:e,data:n}),a.refreshHierarchy(),n}insert(e,t){const a=this;if(t.length){const n=[];for(let r=0;r<t.length;r++){const i=a._getDataItem(t[r],e+r);n.push(i)}t=n}else t=a._getDataItem(t,e);const n=a.boundSource.splice(e,0,t);return a.refreshIndexes(),a._notify({action:"insert",index:e,data:t}),a.refreshHierarchy(),n}move(e,t){if(t>e&&t-e==1||e===t)return;const a=this,n=a.boundSource.splice(e,1)[0];t>e?(t--,a.boundSource.splice(t,0,n)):a.boundSource.splice(t,0,n),a.refreshIndexes(),a._notify({action:"move",index:t,data:a.boundSource[t]}),a.refreshHierarchy()}indexOf(e){return this.boundSource.indexOf(e)}get length(){const e=this;return void 0!==e.virtualDataSourceLength?e.virtualDataSourceLength:e.dataSourceLength?e.dataSourceLength:"number"==typeof e.dataSource?e.dataSource:e.bindingCompleted?e.boundSource.length:e.dataSource&&"string"!=typeof e.dataSource&&e.dataSource.length?e.dataSource.length:e.boundSource.length}clear(){const e=this;if(!e.isInitialized)return e._cachedValues=[],void(e.dataItemById=[]);for(let t=0;t<e.boundSource.length;t++)delete e[t];e._expandedRowIds=[],e._cachedValues=[],e.boundSource=e.observable?new Smart.ObservableArray:[],e.dataItemById=[],e.refreshHierarchy()}_getId(e,t,a){if(null===e||void 0===e.name||!e.name||!t.getAttribute){if(e&&e.toString().length>0&&t.getAttribute){let a=t.getAttribute(e);if(null!==a&&a.toString().length>0)return a.trim().split(" ").join("").replace(/([ #;?%&,.+*~\':'!^$[\]()=>|\/@])/g,"");{let a=e.split(this.mapChar);if(a.length>1){let e=t;for(let t=0;t<a.length;t++)void 0!==e&&(e=e[a[t]]);if(void 0!==e)return e}else if(void 0!==t[e])return t[e]}}return a}{let n=t.getAttribute(e.name);if(null!==n&&n.toString().length>0)return n;if(e.map)try{let a=t.getAttribute(e.map);if(null!==a&&a.toString().length>0)return a}catch(e){return a}}}_buildHierarchy(){const e=this;if(e.reservedNames){const t=e.reservedNames;t.leaf||(t.leaf="leaf"),t.parent||(t.parent="parent"),t.expanded||(t.expanded="expanded"),t.checked||(t.checked="checked"),t.selected||(t.selected="selected"),t.level||(t.level="level"),t.data||(t.data="data")}else e.reservedNames={leaf:"leaf",parent:"parent",expanded:"expanded",checked:"checked",selected:"selected",level:"level",icon:"icon",data:"data"};const t=e.reservedNames;if(e.childrenDataField){const a=[];for(let n=0;n<e.boundSource.length;n++){const r=JSON.parse(JSON.stringify(e.boundSource[n]));if(!r)continue;a.push(r);const i=function(a){const n=e.childrenDataField.split(e.mapChar);let r=null;if(n.length>1){let e=a;for(let t=0;t<n.length;t++)void 0!==e&&(e=e[n[t]]);r=e}else r=a.children;a.children=r,(null===a.children||void 0===a.children||a.children&&0===a.children.length)&&(a[t.leaf]=!0)};i(r),r[t.level]=0,r.$||(r.$={}),r[t.parent]=null,r[t.data]=r,void 0===r[t.expanded]&&(r[t.expanded]=!1,e.expandHierarchy&&(r[t.expanded]=!0));const o=function(a,n){if(n)for(let r=0;r<n.length;r++){let d=e._getDataItem(n[r],r);if(d){if(i(d),!e.id){const e=function(){const e=function(){return(65536*(1+Math.random())|0).toString(16).substring(1)};return e()+e()};d.$.id=e()}d[t.level]=a[t.level]+1,d[t.parent]=a,d[t.data]=Object.assign({},d),a&&(a.children[r]=d),void 0===d[t.expanded]&&(d[t.expanded]=!1,e.expandHierarchy&&(d[t.expanded]=!0)),o(d,d.children)}}else a.children=new Array};o(r,r.children)}if(e.boundHierarchy=a,!e._boundSourceUpdate){for(let t=0;t<e.boundHierarchy.length;t++){const a=e.boundHierarchy[t];if(a.children){const t=function(a){if(e.dataItemById[a.$.id]||(e.boundSource.canNotify=!1,e.dataItemById[a.$.id]=a,e.boundSource.canNotify=!0),a.children)for(let e=0;e<a.children.length;e++){const n=a.children[e];n.children&&t(n)}};t(a)}}e._boundSourceUpdate=!0}}if(e.xmlRoot&&"xml"===e.dataSourceType&&(e.boundHierarchy=this._getHierarchy("uid","_parentuid","children",null,e.boundSource)),e.keyDataField&&e.parentDataField)return["keyDataField","parentDataField"].forEach((t=>{switch(e[t]){case"parent":e[t]="$"+e[t]}})),void(e.boundHierarchy=this._getHierarchy(e.keyDataField,e.parentDataField,"children",null,e.boundSource));e.groupBy&&e.groupBy.length>0?e.boundHierarchy=this._getGroupHierarchy(e.groupBy,"children","label",null,"data",null,"parent",e.boundSource):e.virtualDataSourceOnExpand&&(e.boundHierarchy=this._getHierarchy("id","parentId","children",null,e.boundSource))}_getGroupHierarchy(e,t,a,n,r,i,o,d,l){let s=this;l||(l=0);let c=s.reservedNames;const u=s.boundSource.canNotify;s.boundSource.canNotify=!1;const f=function(){function e(){return Math.floor(65536*(1+Math.random())).toString(16).substring(1)}return e()+e()+"-"+e()+"-"+e()+"-"+e()+"-"+e()+e()+e()};let h=new Array;for(let t=0;t<e.length;t++)h[t]=f();t||(t="children"),a||(a="group"),r||(r="item"),o||(o="parent"),void 0===i&&(i="value");const p=new Array,g=new Array;let S=0;const y=function(t){let a=t;for(let n=0;n<e.length;n++){if(void 0===t[e[n]]){a=s._getDataItem(t,t.$.index);break}}if(n)for(let e in n){const t=n[e];t.name&&t.map&&(a[t.map]=a[t.name])}return a};let m=!1;for(let n=0;n<d.length;n++){let u=y(d[n]);u[c.leaf]=!1;let T=new Array,b=0;for(let t=0;t<e.length;t++){const a=e[t],n=u[a];null!=n?((""===n||void 0===n&&0===t)&&(m=!0),T[b++]={value:n,group:a,hash:h[t]}):(T[b++]={value:null,group:a,hash:h[t]},0===t&&(m=!0))}if(T.length!==e.length)break;let x=null,v="";for(let e=0;e<T.length;e++){const n=T[e].value,d=T[e].group;if(v=v+"_"+T[e].hash+"_"+n,void 0===g[v]||null===g[v]){if(null===x){x={$:{}},x[c.level]=0,x[c.leaf]=!1,x[o]=null,x[a]=n,x[r]=u,x.groupDataField=d,x[d]||(x[d]=x.data[d]),void 0!==u[c.expanded]?x[c.expanded]=u[c.expanded]:(x[c.expanded]=!1,s.expandHierarchy&&(x[c.expanded]=!0)),i&&(x[i]=u[i]),x[t]=new Array;let e=p.length+l;this.id&&"number"!=typeof u.$.id&&!isFinite(u.$.id)||(e="Item"+e),void 0===x.$.id&&(x.$.id=e),s._expandedRowIds[x.$.id]&&(x[c.expanded]=!0),s.expandHierarchy&&s._collapsedIds&&s._collapsedIds[x.$.id]&&(x[c.expanded]=!1),p[S++]=x}else{const e={$:{}};e[c.level]=x[c.level]+1,e[o]=x,e[a]=n,e[t]=new Array,e[r]=u,e.groupDataField=d,e[c.leaf]=!1,e[d]||(e[d]=e.data[d]),void 0!==u[c.expanded]?e[c.expanded]=u[c.expanded]:(e[c.expanded]=!1,s.expandHierarchy&&(e[c.expanded]=!0)),i&&(e[i]=u[i]),void 0===e.$.id&&(e.$.id=x.$.id+"_"+x[t].length),s.expandHierarchy&&s._collapsedIds&&s._collapsedIds[e.$.id]&&(e[c.expanded]=!1),s._expandedRowIds[e.$.id]&&(e[c.expanded]=!0),x[t][x[t].length]=e,x=e}g[v]=x}else x=g[v]}u&&(u[c.leaf]=!0),null!==x?(null===this.id?void 0===u.$.id&&(u.$.id=x.$.id+"_"+x[t].length):void 0===u.$.id&&-1===u.$.id.toString().indexOf(x.$.id)&&(u.$.id=x.$.id+"_"+u.$.id),u[o]=x,u[c.level]=x[c.level]+1,x[t][x[t].length]=u):void 0===u.$.id&&(u.$.id=f())}if(m){let e=null,t=!1;for(let a=0;a<p.length;a++){const n=p[a];if(!n[n.groupDataField]){e=n,e.$.id.toString().startsWith("Item")&&(t=!0),p.splice(a,1);break}}if(e&&(p.push(e),t))for(let e=0;e<p.length;e++){const t=p[e];t.$.id="Item"+e,Object.keys(s._expandedRowIds).length>0&&(s._expandedRowIds[t.$.id]?t[c.expanded]=!0:t[c.expanded]=!1,s.expandHierarchy&&(t[c.expanded]=!0,s._collapsedIds&&s._collapsedIds[t.$.id]&&(t[c.expanded]=!1)))}}return s.boundSource.canNotify=u,p}_getHierarchy(e,t,a,n,r){const i=this,o=new Array;let d=this.boundSource;if(r&&(d=r),0===this.boundSource.length)return null;const l=null!==a?a:"children";let s=new Array,c=d,u=c.length,f=i.reservedNames;const h=function(e){let t=e;if(n)for(let e in n){const a=n[e];a.name&&a.map&&(t[a.map]=t[a.name])}return t};for(let a=0;a<u;a++){let n=c[a],r=n[t],o=n[e];"parentId"===t&&(r=n.$.parentId),"id"===e&&(o=n.$.id),null===o&&(o=n[e]=n.$.id),n[l]=new Array,i.expandHierarchy&&void 0===n[f.expanded]&&(n[f.expanded]=i.expandHierarchy),s[o]={parentId:r,item:n}}for(let a=0;a<u;a++){const n=c[a];let r=n[t],i=n[e];if("parentId"===t&&(r=n.$.parentId),"id"===e&&(i=n.$.id),void 0!==s[r]){let e={parentId:r,item:s[i].item},t=s[r].item;t[l]||(t[l]=new Array);let a=t[l].length;e=e.item,f?e[f.parent]=t:e.parent=t;const n=h(e);t[l][a]=n,s[r].item=t,s[i].item=e}else{let e=s[i].item;f?void 0===e[f.parent]&&(e[f.parent]=null):void 0===e.parent&&(e.parent=null);const t=h(e);f?t[f.level]=0:t.level=0,o[o.length]=t}}if(0!==o.length){let e=function(t,a){for(let n=0;n<a.length;n++){const r=a[n];f?r[f.level]=t:r.level=t;const o=r[l];o&&o.length>0?(r.leaf=!1,e(t+1,o)):i.virtualDataSourceOnExpand?void 0===r.leaf&&(r.leaf=!1):f?r[f.leaf]=!0:r.leaf=!0}};e(0,o)}return o}summarize(e,t){const a=this;Array.isArray(e)||(e=[e]);let n=[];for(let t=0;t<e.length;t++){const a=e[t];for(let e in a){const t=a[e];n.push({dataField:e,functions:t})}}e=n;let r={},i=new Array;t||(t=a.boundSource);let o=t.length,d=0;if(0!==o&&void 0!==o){for(let a=0;a<o;a++){let n=t[a];if((!n||!n.$||!1!==n.$.filtered)&&n){d++;for(let t=0;t<e.length;t++){const o=e[t];let d=n[o.dataField];if(void 0!==d&&"uncategorized"!==d||(d=""),o.functions&&o.functions.length>0){r[o.dataField]=r[o.dataField]||{},i[o.dataField]=i[o.dataField]||0,i[o.dataField]++;const e=function(e){for(let t in e){let a=r[o.dataField][t];null==a&&(r[o.dataField][t]=0,a=0),"function"==typeof e[t]&&(a=e[t](a,d,o.dataField,n)),r[o.dataField][t]=a}},t=d;let l=parseFloat(d);l=!isNaN(l),t&&t.toDate&&(l=!1),"string"==typeof d&&d.startsWith("+")&&(l=!1),l&&(d=parseFloat(d)),"number"==typeof d&&isFinite(d)?o.functions.forEach((function(t){let n=r[o.dataField][t];if(null==n&&(n=0,"min"===t&&(n=9999999999999),"max"===t&&(n=-9999999999999),"median"===t&&(n=[])),"sum"===t||"avg"===t||"stdev"===t||"stdevp"===t||"var"===t||"varp"===t)n+=parseFloat(d);else if("product"===t)0===a?n=parseFloat(d):n*=parseFloat(d);else if("min"===t)n=Math.min(n,parseFloat(d));else if("max"===t)n=Math.max(n,parseFloat(d));else if("count"===t)n++;else if("median"===t)n.push(parseFloat(d));else if("blank"===t)n=r[o.dataField][t],null==n&&(n=0),d||n++;else if("filled"===t)n=r[o.dataField][t],null==n&&(n=0),void 0!==d&&n++;else if("unique"===t)n=r[o.dataField][t],null==n&&(n=[]),-1===n.indexOf(d)&&n.push(d);else if("status"===t)n=r[o.dataField][t],null==n&&(n=[]),n[d]||(n[d]=[]),n[d].push(d);else if("object"==typeof t)return void e(t);r[o.dataField][t]=n})):o.functions.forEach((function(t){if("min"===t||"max"===t||"count"===t||"product"===t||"sum"===t||"avg"===t||"stdev"===t||"stdevp"===t||"var"===t||"varp"===t){if(null===d&&"count"!==t)return!0;let e=r[o.dataField][t];return null==e&&(e=0),r[o.dataField][t]=e,!0}if("blank"===t){let e=r[o.dataField][t];null==e&&(e=0),d||e++,r[o.dataField][t]=e}else if("filled"===t){let e=r[o.dataField][t];null==e&&(e=0),d&&e++,r[o.dataField][t]=e}else if("unique"===t){let e=r[o.dataField][t];null==e&&(e=[]),-1===e.indexOf(d)&&e.push(d),r[o.dataField][t]=e}else if("status"===t){let e=r[o.dataField][t];null==e&&(e=[]),e[d]||(e[d]=[]),e[d].push(d),r[o.dataField][t]=e}"object"==typeof t&&e(t)}))}}}}for(let a=0;a<e.length;a++){const n=e[a];if(n.functions&&(!n.functions||0!==n.functions.length)){if(r[n.dataField]||(r[n.dataField]={},n.functions.forEach((function(e){r[n.dataField][e]=0}))),void 0!==r[n.dataField].avg){const e=r[n.dataField].avg,t=i[n.dataField];r[n.dataField].avg=0===t||void 0===t?0:e/t}else void 0!==r[n.dataField].count&&(r[n.dataField].count=d);if(void 0!==r[n.dataField].unique){const e=r[n.dataField].unique;r[n.dataField].unique=e.length}if(void 0!==r[n.dataField].status){const e=r[n.dataField].status;r[n.dataField].status=e}if(void 0!==r[n.dataField].median){let e=r[n.dataField].median;e.sort((function(e,t){return e-t})),r[n.dataField].median=.5*(e[Math.floor((e.length+1)/2)-1]+e[Math.ceil((e.length+1)/2)-1])}(r[n.dataField].stdev||r[n.dataField].stdevp||r[n.dataField].var||r[n.dataField].varp)&&n.functions.forEach((function(e){if("stdev"===e||"var"===e||"varp"===e||"stdevp"===e){const a=r[n.dataField][e],i=o,d=a/o;let l=0;for(let e=0;e<o;e++){let a=t[e][n.dataField];l+=(a-d)*(a-d)}let s="stdevp"===e||"varp"===e?i:i-1;0===s&&(s=1),"var"===e||"varp"===e?r[n.dataField][e]=l/s:"stdevp"!==e&&"stdev"!==e||(r[n.dataField][e]=Math.sqrt(l/s))}}))}}return r}}_getDataItem(e,t){const a=this,n={},r="number"==typeof a.dataSource||a.dataSourceLength;if(!e)return{$:{id:t,isEmpty:!0,index:t}};if("string"==typeof e&&(e={"":e}),r){for(let e=0;e<a.dataFields.length;e++){n[(a.dataFields?a.dataFields[e]:{}).name]=""}return n.$={},n.$.id=t,n.$.index=t,n}const i=e;if(void 0!==i.expanded&&(n.expanded=i.expanded,"true"===i.expanded||!0===i.expanded||1===i.expanded?n.expanded=!0:n.expanded=!1),a.childrenDataField?void 0!==i[a.childrenDataField]&&(n.children=i[a.childrenDataField]):void 0!==i.children?n.children=i.children:void 0!==i.items&&(n.children=i.items),void 0!==i.leaf&&(n.leaf=i.leaf),void 0!==i.level&&(n.level=i.level),a.keyDataField&&void 0!==i[a.keyDataField]&&(n[a.keyDataField]=i[a.keyDataField]),a.parentDataField&&void 0!==i[a.parentDataField]&&(n[a.parentDataField]=i[a.parentDataField]),0===a.dataFields.length){const t=Object.getOwnPropertyNames(e);for(let e=0;e<t.length;e++)"$"!==t[e]&&a.dataFields.push({name:t[e],dataType:"string"})}for(let t=0;t<a.dataFields.length;t++){const r=a.dataFields?a.dataFields[t]:{};let o="";if(null==r)continue;if(e.length&&(o=e[t]),r.map){let e=r.map.split(a.mapChar);if(e.length>0){let t=i;for(let a=0;a<e.length;a++)i&&t&&(t=t[e[a]]);o=t}else o=i[r.map]}null!=o?o=o.toString():void 0===o&&null!==o&&(o="");let d=!1;if(""===o&&(d=!0,o=e[r.name],void 0===r.dataType&&(r.dataType="any"),null!=o?"array"!==r.dataType&&("any"===r.dataType?o=Array.isArray(e[r.name])?[...e[r.name]]:"object"==typeof e[r.name]?Object.assign({},e[r.name]):e[r.name]:"date"!==r.dataType&&(o=o.toString())):o=void 0===o&&"any"===r.dataType?null:""),"[object Object]"===o&&r.map&&d&&(o=""),a._cachedValues[o+"_"+r.dataType])o=a._cachedValues[o+"_"+r.dataType];else{if("bool"===r.dataType||"boolean"===r.dataType)"true"===o||"1"===o?o=!0:"false"!==o&&"0"!==o||(o=!1);else if("number"===r.dataType)-1===o.indexOf(".")&&o.indexOf(",")>=0&&o.substring(1+o.indexOf(",")).length<3&&(o=o.replace(",",".")),o=a.$document.deserialize(""+o,r.dataType,!0);else if("date"===r.dataType){if(o&&"string"==typeof o&&o.indexOf("[")>=0){const e=JSON.parse(o);if(r.formatString&&Smart.Utilities.DateTime){const t=Smart.Utilities.DateTime.ParseDate(e[0],r.formatString),a=Smart.Utilities.DateTime.ParseDate(e[1],r.formatString);e[0]=t,e[1]=a}else{const t=a.$document.deserialize(""+e[0],r.dataType,!0),n=a.$document.deserialize(""+e[1],r.dataType,!0);e[0]=t,e[1]=n}o=e,n[r.name]=o;continue}if(r.formatString&&Smart.Utilities.DateTime){o=Smart.Utilities.DateTime.ParseDate(o,r.formatString)}else o=a.$document.deserialize(""+o,r.dataType,!0)}else"any"!==r.dataType&&(o="string"===r.dataType&&"null"===o?"null":a.$document.deserialize(""+o,r.dataType,!0));"any"!==r.dataType&&(a._cachedValues[o+"_"+r.dataType]=o)}"string"!==r.dataType&&"boolean"!==r.dataType&&"bool"!==r.dataType&&"any"!==r.dataType&&(isNaN(o)||o===-1/0||o===1/0)&&(o="date"===r.dataType||"number"===r.dataType?null:0),"parent"!==r.name&&"group"!==r.name&&"leaf"!==r.name&&"level"!==r.name?("string"===r.dataType&&/<.+?>/.test(o)&&o.replace&&("all"===a.sanitizeHTML?o=o.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/'/g,"&#39;").replace(/"/g,"&quot;"):"blackList"===a.sanitizeHTML&&(o=window.Smart.Utilities.Core.sanitizeHTML(o),o.indexOf("<br")>=0&&(o=o.replaceAll("<br/>","\n\r"),o=o.replaceAll("<br>","\n\r")))),n[r.name]=o):n.$[r.name]=o}let o=t;if(a.id){if(o=i[a.id],void 0===o)if(void 0!==n[a.id])o=n[a.id];else{const e=function(){return(65536*(1+Math.random())|0).toString(16).substring(1)};o=e()+e()}"object"==typeof o&&(o=t),i.$&&void 0!==i.$.id&&(o=i.$.id)}else if(!a.virtualDataSource&&a.dataItemById&&a.dataItemById[o])for(o=a.length;a.dataItemById[o];)o++;return n.$||(n.$={}),n.$.id=o,n.$.index=t,new Object(n)}_bindToArray(){const e=this,t="number"==typeof e.dataSource||e.dataSourceLength,a=[];e.boundSource.canNotify=!1;const n=t?"number"==typeof e.dataSource?e.dataSource:e.dataSource.length:e.observable?e.length:e.dataSource.length;for(let r=0;r<n;r++){const n=t?{}:e.dataSource[r],i=e._getDataItem(n,r);a.push(i)}if(t&&e.dataSourceLength&&e.dataSource.length>0)for(let t=0;t<e.dataSource.length;t++){const n=e.dataSource[t].cell,r=e.dataSource[t].value,i=n.replace(/[^0-9]/g,""),o=n.replace(/[0-9]/g,"");a[i-1][o]=r}e.boundSource=!1===e.observable||e.virtualDataSource?[]:new Smart.ObservableArray(a),e.observable&&(e.boundSource=new Smart.ObservableArray(a));for(let t=0;t<n;t++)e.observable?e[t]=e.boundSource[t]:e[t]=a[t],e.dataItemById[e[t].$.id]=e[t];!1===e.observable&&(e.boundSource=a),e.boundSource.canNotify=!0}_bindToICS(){const e=this,t=""+e.dataSource,a=e.rowDelimiter||"\n",n=t.split("\r"),r=[];let i=t.split(a),o=i.length;1===o&&n.length>1&&(i=n,o=i.length);const d=function(e,t){var a=/^(\d{4})(\d{2})(\d{2})(T(\d{2})(\d{2})(\d{2})Z)?$/.exec(e);if(!a)throw new Error("Invalid UNTIL value: "+e);return t?new Date(a[1],a[2]-1,a[3],0,0,0,0):new Date(Date.UTC(a[1],a[2]-1,a[3],a[5]||0,a[6]||0,a[7]||0))};for(let e=0;e<o;e++){const t=i[e].trim();if(t.indexOf("BEGIN:VEVENT")>=0)var l={};else if(l)if(t.indexOf("BEGIN:VALARM")>=0)var s={};else{if(s){if(t.indexOf("ACTION")>=0){s.ACTION=t.substring(t.indexOf("ACTION")+7);continue}if(t.indexOf("DESCRIPTION")>=0){s.DESCRIPTION=t.substring(t.indexOf("DESCRIPTION")+12);continue}if(t.indexOf("TRIGGER")>=0){s.TRIGGER=t.substring(t.indexOf("TRIGGER")+8);continue}if(t.indexOf("END:VALARM")>=0){l.ALARM||(l.ALARM=[]),l.ALARM.push(s),s=void 0;continue}}if(t.indexOf("SUMMARY")>=0)l.SUMMARY=t.substring(t.indexOf("SUMMARY")+8);else if(t.indexOf("LOCATION")>=0)l.LOCATION=t.substring(t.indexOf("LOCATION")+9);else if(t.indexOf("DESCRIPTION")>=0)l.DESCRIPTION=t.substring(t.indexOf("DESCRIPTION")+12);else if(t.indexOf("RRULE")>=0)l.RRULE=t.substring(t.indexOf("RRULE")+6);else if(t.indexOf("RECURRENCE-ID")>=0)l.RECURRENCEID=t.substring(t.indexOf("RECURRENCE-ID")+14);else if(t.indexOf("RECURRENCE-ID;VALUE=DATE")>=0)l.RECURRENCEID=t.substring(t.indexOf("RECURRENCE-ID;VALUE=DATE")+25);else if(t.indexOf("EXDATE;VALUE=DATE")>=0){const e=t.substring(t.indexOf("EXDATE;VALUE=DATE")+20);l.EXDATE=e}else if(t.indexOf("EXDATE")>=0){const e=t.substring(t.indexOf("EXDATE")+7);l.EXDATE=e}else t.indexOf("DTEND;VALUE=DATE")>=0?l.DTEND=d(t.substring(t.indexOf("DTEND;VALUE=DATE")+17),!0):t.indexOf("DTEND")>=0?l.DTEND=d(t.substring(t.indexOf("DTEND")+6)):t.indexOf("DTSTART;VALUE=DATE")>=0?l.DTSTART=d(t.substring(t.indexOf("DTSTART;VALUE=DATE")+19),!0):t.indexOf("DTSTART")>=0?l.DTSTART=d(t.substring(t.indexOf("DTSTART")+8)):t.indexOf("UID")>=0?l.uid=l.UID=t.substring(t.indexOf("UID")+4):t.indexOf("STATUS")>=0?l.STATUS=t.substring(t.indexOf("STATUS")+7):t.indexOf("TITLE")>=0?l.TITLE=t.substring(t.indexOf("TITLE")+6):t.indexOf("CATEGORIES")>=0?l.CATEGORIES=t.substring(t.indexOf("CATEGORIES")+11):t.indexOf("END:VEVENT")>=0&&(r.push(l),l.ALARM&&(l.ALARM=JSON.stringify(l.ALARM)),s=void 0)}}e.canNotify=!1,e.dataSource=r,e.canNotify=!0,e._bindToArray()}_bindToJSON(){const e=this,t=[],a=e.dataSource.length?e.dataSource:Object.entries(e.dataSource);e.boundSource.canNotify=!1;for(let n=0;n<a.length;n++){const r=a[n],i=e._getDataItem(r,n);t.push(i)}e.boundSource=!1===e.observable||e.virtualDataSource?[]:new Smart.ObservableArray(t);for(let t=0;t<e.length;t++)e[t]=e.boundSource[t],e.dataItemById[e[t].$.id]=e[t];!1===e.observable&&(e.boundSource=t),e.boundSource.canNotify=!0}sortBy(e,t,a){const n=this;if(!t)for(let a=0;a<n.dataFields.length;a++){const r=n.dataFields[a];if(r.name===e){t=r.dataType;break}}if(n.boundHierarchy){if((!e||0===e.length)&&n.groupBy.length>0)return void n.refreshHierarchy();const r=(e=>{let t=[];for(;e;){t=t.concat(e);for(let a=0;a<e.length;a++)e[a].children&&(t=t.concat(e[a].children));e=e.children}return t})(n.boundHierarchy);if(r){r.find((e=>{if(e.summaryRow)return e}))&&n.refreshHierarchy()}const i=function(r){n._sort(r,e,a,t);for(let n=0;n<r.length;n++){const o=r[n];o.children&&i(o.children,e,a,t)}};i(n.boundHierarchy)}else n._sort(n.boundSource,e,a,t)}_createFilter(e,t){const a={"=":"EQUAL","<>":"NOT_EQUAL","!=":"NOT_EQUAL",not_like:"DOES_NOT_CONTAIN",like:"CONTAINS","<":"LESS_THAN",">":"GREATER_THAN","<=":"LESS_THAN_OR_EQUAL",">=":"GREATER_THAN_OR_EQUAL",equal:"EQUAL","not equal":"NOT_EQUAL","less than":"LESS_THAN","greater than":"GREATER_THAN","greater than or equal":"GREATER_THAN_OR_EQUAL","less than or equal":"LESS_THAN_OR_EQUAL","starts with":"STARTS_WITH","ends with":"ENDS_WITH",notEqual:"NOT_EQUAL",not_equal:"NOT_EQUAL",lessThan:"LESS_THAN",greaterThan:"GREATER_THAN",greaterThanOrEqual:"GREATER_THAN_OR_EQUAL",lessThanOrEqual:"LESS_THAN_OR_EQUAL",less_than:"LESS_THAN",greater_than:"GREATER_THAN",greater_than_or_equal:"GREATER_THAN_OR_EQUAL",less_than_or_equal:"LESS_THAN_OR_EQUAL",null:"null","":"EMPTY",isblank:"EMPTY",isnotblank:"NOT_EMPTY",isBlank:"EMPTY",isNotBlank:"NOT_EMPTY",CONTAINS:"CONTAINS",DOES_NOT_CONTAIN:"DOES_NOT_CONTAIN",contains:"CONTAINS",does_not_contain:"DOES_NOT_CONTAIN","not contains":"DOES_NOT_CONTAIN",notcontains:"DOES_NOT_CONTAIN",notContains:"DOES_NOT_CONTAIN",startswith:"STARTS_WITH",endswith:"ENDS_WITH",starts_with:"STARTS_WITH",ends_with:"ENDS_WITH",startsWith:"STARTS_WITH",endsWith:"ENDS_WITH",NULL:"NULL",NOT_NULL:"NOT_NULL"};let n=[];"string"==typeof t&&(t=[t]);for(let e=0;e<t.length;e++){const a=t[e],r=-1===a.indexOf('"')?a.split(" "):a.split('"');let i=[];for(let e=0;e<r.length;e++){const t=r[e];if(""!==t&&" "!==t){if("true"===t.trim()){i.push(!0);continue}if("false"===t.trim()){i.push(!1);continue}if(t.indexOf(" GMT")>=0)i.push(t.trim());else if(t.indexOf("or ")>=0||t.indexOf("and ")>=0||t.indexOf("1 ")>=0||t.indexOf("0 ")>=0||t.indexOf("| ")>=0||t.indexOf("& ")>=0){const e=t.trim().split(" ");if(e.length>1){const t=e[0].trim(),a=e[1].trim();"1"===t?i.push("or"):"0"===t?i.push("and"):i.push(t),i.push(a)}else i.push(t.trim())}else i.push(t.trim())}}n.push(i)}const r=new Smart.FilterGroup,i=[],o=[];for(let t=0;t<n.length;t++){const r=n[t];if(r.length>1){const t=new Smart.FilterGroup;let n=r.length>2?"":"and",i=0,d=[];for(let o=0;o<r.length;o++){let l=r[o];if("and"!==l&&"or"!==l){if(i++,2===i){let s=a[r[o-1]];s||(s=r[o-1]),"number"===e&&(l=parseFloat(l)),"date"===e&&(l=new Date(l));const c=t.createFilter(e,l,s);if(i=0,d.push(c),n){for(let e=0;e<d.length;e++)t.addFilter(n,d[e]);d=[]}}}else n=l}o.push(t)}else{let e=r[0];if(e&&a[e]&&(e="and"),"and"!==e&&"or"!==e)throw new Error('Filter Exprresion expects "AND" or "OR", but the token is: '+e);i.push(e)}}let d=0;if(1===o.length)return o[0];for(let e=0;e<o.length;e++){let t=i[d];(e+1)%2==0&&d++,t||(t="and"),r.addFilter(t,o[e])}return r}filterBy(e,...t){const a=this,n=(()=>{for(let t=0;t<a.dataFields.length;t++){const n=a.dataFields[t];if(n.name===e)return n.dataType}})(),r=a._createFilter(n,t);return a.boundSource.filter((t=>r.evaluate(t[e])))}_filter(e,t="and"){const a=this,n=[],r=[];if(0===e.length)return void a.clearFilter();const i=e=>{for(let t=0;t<a.dataFields.length;t++){const n=a.dataFields[t];if(n.name===e)return n.dataType}};let o,d;"and"===t?(o=!0,d=function(e,t,a){return e&&t.evaluate(a[t.dataField])}):(o=!1,d=function(e,t,a){return e||t.evaluate(a[t.dataField])});for(let t=0;t<e.length;t++){const o=e[t],d=o[0];let l=null;l=o[1]instanceof Smart.FilterGroup?o[1]:a._createFilter(i(d),o.splice(1)),l&&(r.push(d),l.dataField=d,n.push(l))}if(a.boundHierarchy){const e=function(e){let t=o;for(let a=0;a<n.length;a++){const r=n[a];t=d(t,r,e)}return e.$.filtered=t,t},t=function(n,r,i){let o=0;for(let a=0;a<n.length;a++){const i=n[a];e(i),i.$.filtered&&o++,i.children&&t(i.children,i,r)}o>0&&a.groupBy.length>0&&r?(r.$.filtered=!0,i&&!i.$.filtered&&(i.$.filtered=!0)):o>0&&o!==n.length&&r?(r.$.filtered=null,i&&!i.$.filtered&&(i.$.filtered=null)):o>0&&o===n.length&&r&&(r.$.filtered=!0,i&&!i.$.filtered&&(i.$.filtered=!0))};t(a.boundHierarchy,null,null)}else for(let e=0;e<a.boundSource.length;e++){const t=a.boundSource[e];let r=o;for(let e=0;e<n.length;e++){const a=n[e];r=d(r,a,t)}t.$.filtered=r}a.onFilter&&a.onFilter()}clearGroup(){const e=this;e.groupBy=[],e.boundHierarchy=null,e.refreshHierarchy(),e.onGroup&&e.onGroup()}clearFilter(){const e=this;for(let t=0;t<e.boundSource.length;t++){e.boundSource[t].$.filtered=!0}if(e.boundHierarchy){const t=function(e,a,n){for(let n=0;n<e.length;n++){const r=e[n];r.$.filtered=!0,r.$.filtered,r.children&&t(r.children,r,a)}a&&(a.$.filtered=!0,n&&!n.$.filtered&&(n.$.filtered=!0))};t(e.boundHierarchy,null,null)}e.onFilter&&e.onFilter()}clearSort(){this._sort(this.boundSource,[],[],[])}_sort(e,t,a,n,r,i){const o=this;let d=!1;if(0===e.length)return;if(e&&e.constructor&&e instanceof Smart.ObservableArray&&(d=!0),(!e||!Array.isArray(e)||0===e.length||!t||Array.isArray(t)&&0===t.length)&&!d&&!o.boundHierarchy){if(o.virtualDataSource)return;throw new Error("sort: Missing or Invalid arguments!")}"string"==typeof t&&(t=[t]);const l=[],s=[];void 0===a&&(a=[]);const c=function(e,t){let a;switch(t||typeof e){case"string":a=(new Intl.Collator).compare;break;case"number":case"int":case"bigInt":case"float":case"double":a=function(e,t){return e-t};break;case"boolean":case"bool":a=function(e,t){return e===t?0:!1===e?-1:1};break;case"date":case"time":case"dateTime":a=e instanceof Date?function(e,t){return e||t?e?t?e.getTime()-t.getTime():1:-1:0}:e instanceof Smart.Utilities.DateTime||e instanceof Smart.Utilities.BigNumber?function(e,t){return e.compare(t)}:function(e,t){return e-t};break;case"object":if(e instanceof Date)a=function(e,t){return e||t?e?t?e.getTime()-t.getTime():1:-1:0};else if(e instanceof Smart.Utilities.DateTime||e instanceof Smart.Utilities.BigNumber)a=function(e,t){return e.compare(t)};else if(e instanceof Smart.Utilities.Complex||window.NIComplex&&e instanceof window.NIComplex){const e=new Smart.Utilities.ComplexNumericProcessor;a=function(t,a){return e.compareComplexNumbers(t,a)}}}return a};for(let r=0;r<t.length;r++){void 0===a[r]||"asc"===a[r]||"ascending"===a[r]?l[r]=1:l[r]=-1;let d=e[0][t[r]];if(void 0===d&&e[0]&&e[0].children&&e[0].data&&(d=e[0].data[t[r]]),i&&i){const e=t[r];if(i[e]){s[r]=i[e];continue}}o.sortComparators&&o.sortComparators[t[r]]?s[r]=o.sortComparators[t[r]]:s[r]=c(d,n[r])}t.length>0&&r?r(e,t,a,s):e.sort((function(e,a){for(let n=0;n<t.length;n++){const r=s[n](e[t[n]],a[t[n]]);if(0===r){if(t[n+1])continue;return void 0!==e.$.index?(e.$.index-a.$.index)*l[n]:0}return r*l[n]}if(0===t.length)return e.$.index<a.$.index?-1:e.$.index>a.$.index?1:0}));for(let t=0;t<e.length;t++)o[t]=e[t]}static Filter(e,t,a,n,r="and"){let i,o;"and"===r?(i=!0,o=function(e,t,a,r){return n?e&&n(t,a,r):e&&r.evaluate(t[a])}):(i=!1,o=function(e,t,a,r){return n?e||n(t,a,r):e||r.evaluate(t[a])});return e.filter((e=>{let n=i;for(let r=0;r<a.length;r++){const i=a[r],d=t[r];n=o(n,e,d,i)}return n}))}filter(e,t,a){Smart.DataAdapter.Filter(this.boundSource,e,t,a)}sort(e,t,a){Smart.DataAdapter.Sort(this.boundSource,e,t,a)}static Sort(e,t,a,n){const r=function(e){let t;switch(typeof e){case"string":if(e.indexOf("-")>=0||e.indexOf("/")>=0){const t=new Date(e);if(t&&"Invalid Date"!==t.toString()){return function(e,t){const a=new Date(e),n=new Date(t);return a||n?a?n?a.getTime()-n.getTime():1:-1:0}}}t=(new Intl.Collator).compare;break;case"number":t=function(e,t){return e-t};break;case"boolean":t=function(e,t){return e===t?0:!1===e?-1:1};break;case"object":if(e instanceof Date)t=function(e,t){return e||t?e?t?e.getTime()-t.getTime():1:-1:0};else if(e instanceof Smart.Utilities.DateTime||e instanceof Smart.Utilities.BigNumber)t=function(e,t){return e.compare(t)};else if(e instanceof Smart.Utilities.Complex||window.NIComplex&&e instanceof window.NIComplex){const e=new Smart.Utilities.ComplexNumericProcessor;t=function(t,a){return e.compareComplexNumbers(t,a)}}else t=function(e,t){return e-t}}return t};if(!e||!Array.isArray(e)||0===e.length||!t||Array.isArray(t)&&0===t.length)return;"string"==typeof t&&(t=[t]);const i=[],o=[];void 0===a&&(a=[]);for(let n=0;n<t.length;n++)void 0===a[n]||"asc"===a[n]||"ascending"===a[n]?i[n]=1:i[n]=-1,o[n]=r(e[0][t[n]]);if(n)return void n(e,t,a,o);const d=e.slice(0);return d.sort((function(e,a){for(let n=0;n<t.length;n++){const r=o[n](e[t[n]],a[t[n]]);if(0===r){if(t[n+1])continue;return void 0!==e._index?(e._index-a._index)*i[n]:0}return r*i[n]}})),d}};class e{constructor(e,t){const a=this;a.config=e,a.callback=t,!1!==e.autoFetch&&a.call(e)}call(e){const t=this;e||(e=t.config);let a="GET",n=e.url,r=null,i=!0;if(e.type&&(a=e.type),e.data)if("GET"===a){n+="?";for(let t in e.data)Object.prototype.hasOwnProperty.call(e.data,t)&&(n+=encodeURI(t+"="+e.data[t]+"&"));"&"===n.charAt(n.length-1)&&(n=n.slice(0,n.length-1))}else"POST"===a&&(r=JSON.stringify(e.data));e&&!1===e.async&&"xlsx"!==e.dataSourceType&&(i=!1),void 0!==window.fetch&&i?t.ajaxFetch(e,a,n,r):t.ajaxXMLHttpRequest(e,a,n,r,i)}ajaxFetch(e,t,a,n){const r=this,i={method:t};let o,d,l,s;switch(e.dataSourceType){case"json":o="json";break;case"xlsx":o="arrayBuffer";break;default:o="text"}if(e&&e.contentType&&(i.headers=new Headers({"Content-Type":e.contentType})),null!==n&&(i.body=n),e.timeout&&(l=setTimeout((function(){s=!0}),e.timeout)),e.beforeSend){if(!1===e.beforeSend(i,e))return}fetch(a,i).then((function(e){if(s)throw d=408,new Error("timeout");if(l&&clearTimeout(l),d=e.status,!e.ok)throw new Error(e.statusText);return e[o]()})).then((function(t){if("arrayBuffer"===o)return JSZip.loadAsync(t).then((function(t){return t.files["xl/worksheets/sheet1.xml"].async("text").then((function(a){return t.files["xl/sharedStrings.xml"].async("text").then((function(t){const n=r.parseXLSXData(a,t);r.ajaxComplete(e,n,d)}))}))}));r.ajaxComplete(e,t,d)})).catch((function(t){"JSZip is not defined"===t.message&&(t.message="JSZip is not defined. Please include a reference to JSZip to be able to load data from XLSX files."),e&&e.loadError&&e.loadError(d,t),r.callback&&r.callback(t,d)}))}ajaxXMLHttpRequest(e,t,a,n,r){const i=new XMLHttpRequest,o=this;if(i.open(t,a,r),i.ontimeout=function(){e&&e.loadError&&e.loadError(408,"timeout")},i.onload=function(){if(4===i.readyState){const t=i.status;let a=i.response;t>=200&&t<=299?("json"===e.dataSourceType&&(a=JSON.parse(a)),o.ajaxComplete(e,a,t)):e&&e.loadError&&e.loadError(t,a)}},i.onerror=function(){e&&e.loadError&&e.loadError(i.status,i.response)},e&&e.contentType&&i.setRequestHeader("Content-Type",e.contentType),r&&e.timeout&&(i.timeout=e.timeout),e.beforeSend){if(!1===e.beforeSend(i,e))return}i.send(n)}ajaxComplete(e,t,a){if(e){if(e.beforeLoadComplete){const a=e.beforeLoadComplete(t);a&&(t=a)}e.loadComplete&&e.loadComplete(t,a),this.callback&&this.callback(t,a)}}parseXLSXData(e,t){const a=new DOMParser,n=a.parseFromString(t,"text/xml"),r=Array.from(n.getElementsByTagName("si")),i=[],o=a.parseFromString(e,"text/xml"),d=Array.from(o.getElementsByTagName("row")),l=[];return r.forEach((function(e){let t=e.getElementsByTagName("t");if(1===t.length)i.push(t[0].innerHTML);else{let e="";t=Array.from(t),t.forEach((function(t){e+=t.innerHTML})),i.push(e)}})),d.forEach((function(e){const t={};Array.from(e.getElementsByTagName("c")).forEach((function(e){const a=e.getAttribute("r").match(/\D+/)[0],n=e.getAttribute("t"),r=e.getElementsByTagName("v")[0].innerHTML;let o;switch(n){case"s":o=i[parseFloat(r)];break;case"b":o=1===parseFloat(r);break;default:o=parseFloat(r)}t[a]=o})),l.push(t)})),l}}Smart.Ajax=window.Ajax=e})();
1331
1331
 
1332
1332
  /***/ }),
1333
1333
 
@@ -1439,21 +1439,21 @@ Smart.Utilities.Assign("Grid.Column",class{constructor(t){const e=this;"string"!
1439
1439
  /***/ 5306:
1440
1440
  /***/ (() => {
1441
1441
 
1442
- Smart("smart-grid",class extends Smart.ScrollViewer{static get properties(){return{appearance:{value:{alternationStart:{value:0,type:"int"},alternationEnd:{value:0,type:"int"},alternationCount:{value:0,type:"int"},allowHover:{value:!1,type:"boolean",defaultReflectToAttribute:!0},allowHeaderHover:{value:!0,type:"boolean",defaultReflectToAttribute:!0},allowRowToggleAnimation:{value:!1,type:"boolean"},allowRowDetailToggleAnimation:{value:!1,type:"boolean"},allowSortAnimation:{value:!1,type:"boolean"},allowColumnLabelAnimation:{value:!0,type:"boolean"},allowCheckBoxesSelectionAnimation:{value:!0,type:"boolean"},allowColumnMenuAnimation:{value:!0,type:"boolean"},allowColumnSortButtonAnimation:{value:!0,type:"boolean"},allowColumnActionButtonAnimation:{value:!0,type:"boolean"},allowColumnFilterButtonAnimation:{value:!0,type:"boolean"},allowColumnStickyPosition:{value:!1,type:"boolean"},autoShowColumnSortButton:{value:!0,type:"boolean"},autoShowColumnActionButton:{value:!0,type:"boolean"},autoGenerateRowLabelMode:{value:"number",type:"string"},autoGenerateColumnLabelMode:{value:"letter",type:"string"},autoShowColumnFilterButton:{value:!0,type:"boolean"},cardTitleField:{value:"",type:"string"},displayLoadingIndicator:{value:!1,type:"boolean"},loadingIndicatorPlaceholder:{value:"Loading...",type:"string"},placeholder:{value:"No Rows",type:"string"},sortAnimationDuration:{value:500,type:"number"},showRowHeader:{value:!1,type:"boolean"},showRowStatus:{value:!1,type:"boolean"},showRowComments:{value:!1,type:"boolean"},showRowHeaderNumber:{value:!1,type:"boolean"},showRowHeaderEditIcon:{value:!0,type:"boolean",defaultReflectToAttribute:!0},showRowHeaderDragIcon:{value:!1,type:"boolean"},showColumnHeaderDragIcon:{value:!1,type:"boolean"},showRowHeaderSelectIcon:{value:!1,type:"boolean"},showRowHeaderFocusIcon:{value:!1,type:"boolean"},showColumnHeaderLines:{value:!0,type:"boolean",defaultReflectToAttribute:!0},showColumnGroupLines:{value:!0,type:"boolean",defaultReflectToAttribute:!0},showColumnGroupCellLines:{value:!0,type:"boolean",defaultReflectToAttribute:!0},showColumnLines:{value:!0,type:"boolean",defaultReflectToAttribute:!0},showRowLines:{value:!0,type:"boolean",defaultReflectToAttribute:!0},showFilterColumnBackground:{value:!1,type:"boolean"},showSortColumnBackground:{value:!1,type:"boolean"},showFrozenColumnBackground:{value:!0,type:"boolean"},showFrozenRowBackground:{value:!0,type:"boolean"},showSelectionOnTop:{value:!0,type:"boolean"},showColumnSortButton:{value:!0,type:"boolean"},showColumnFilterButton:{value:!0,type:"boolean"},showColumnDescriptionButton:{value:!1,type:"boolean"},showColumnIcon:{value:!1,type:"boolean"},showColumnCustomButton:{value:!1,type:"boolean"},showColumnActionButton:{value:!0,type:"boolean"},showColumnGroupsInColumnPanel:{value:!1,type:"boolean"},showTooltips:{value:!1,type:"boolean"},showTooltipsOverflow:{value:!0,type:"boolean"},showResizeTooltips:{value:!0,type:"boolean"},showHorizontalScrollBarOnFixedColumns:{value:!1,type:"boolean"},showVerticalScrollBarOnFixedColumns:{value:!1,type:"boolean"},showTreeRowHeader:{value:!1,type:"boolean"},showTodayDateAsString:{value:!0,type:"boolean"},showViewBar:{value:!1,type:"boolean"},showViewBarAsDropdown:{value:!1,type:"boolean"},viewBarAppendTo:{value:null,type:"any"}},type:"object"},behavior:{value:{autoDestroy:{value:!0,type:"boolean"},allowColumnAutoSizeOnDoubleClick:{value:!0,type:"boolean"},allowRowAutoSizeOnDoubleClick:{value:!0,type:"boolean"},allowColumnReorder:{value:!1,type:"boolean"},allowColumnFreeze:{value:!0,type:"boolean"},allowRowReorder:{value:!1,type:"boolean"},allowMouseWheel:{value:!0,type:"boolean"},doubleClickTimingDelay:{value:300,type:"number"},columnResizeMode:{value:"none",type:"string",allowedValues:["none","split","growAndShrink"]},rowResizeMode:{value:"none",type:"string",allowedValues:["none","split","growAndShrink"]}},type:"object"},layout:{value:{autoWrap:{value:!0,type:"boolean"},autoWidth:{value:!1,type:"boolean"},autoHeight:{value:!1,type:"boolean"},allowCellsWrap:{value:!1,type:"boolean"},allowCellsWrapShortcut:{value:!0,type:"boolean"},autoGenerateColumnWidth:{value:null,type:"number?"},autoSizeNewColumn:{value:!1,type:"boolean",reflectToAttribute:!1},autoSizeNewColumnMinWidth:{value:180,type:"number",reflectToAttribute:!1},cardMinWidth:{value:250,type:"any",reflectToAttribute:!1},cardRowMinHeight:{value:45,type:"any",reflectToAttribute:!1},cardsPerRow:{value:"auto",type:"any",reflectToAttribute:!1},cardVertical:{value:!0,type:"boolean",reflectToAttribute:!1},columnWidth:{value:null,type:"any",reflectToAttribute:!1},columnHeight:{value:null,type:"any",reflectToAttribute:!1},columnMinHeight:{value:30,type:"any",reflectToAttribute:!1},dropDownWidth:{value:700,type:"any",reflectToAttribute:!1},dropDownHeight:{value:500,type:"any",reflectToAttribute:!1},isDirty:{value:!1,type:"boolean"},loadingIndicatorPosition:{value:"center",allowedValues:["bottom","center","top"],type:"string"},rowMinHeight:{value:30,type:"number"},rowHeight:{value:null,type:"any",reflectToAttribute:!1},viewBarWidth:{value:200,type:"number"}},type:"object"},dataExport:{value:{header:{value:!0,type:"boolean"},filterBy:{value:null,type:"object"},groupBy:{value:null,type:"object"},style:{value:null,type:"object"},fileName:{value:"smartGrid",type:"string?"},pageOrientation:{value:"portrait",type:"string"},expandChar:{value:"+",type:"string"},collapseChar:{value:"-",type:"string"},view:{value:!1,type:"boolean"},viewStart:{value:null,type:"number?"},viewEnd:{value:null,type:"number?"},rowIds:{value:null,type:"array?"}},type:"object"},clipboard:{value:{enabled:{value:!0,type:"boolean"},autoFillMode:{value:"copy",allowedValues:["none","copy","fillSeries"],type:"string"},onPasteValue:{value:null,type:"any"}},type:"object"},conditionalFormatting:{value:null,type:"array?",reflectToAttribute:!1},columns:{value:[],type:"any",reflectToAttribute:!1},contextMenu:{value:{selector:{value:"",type:"string"},enabled:{value:!1,type:"boolean"},width:{value:150,type:"number"},height:{value:null,type:"number?"},customContextMenuItems:{value:null,type:"any"},dataSource:{value:{contextMenuItemDelete:{value:{command:{value:"contextMenuItemDeleteCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:!0,type:"boolean"},icon:{value:"smart-icon-delete",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},contextMenuItemEdit:{value:{command:{value:"contextMenuItemEditCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:!0,type:"boolean"},icon:{value:"smart-icon-mode-edit",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},contextMenuItemCustom:{value:{command:{value:null,type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:!1,type:"boolean"},icon:{value:"smart-icon-settings",type:"string"},label:{value:"",type:"string"}},type:"object",reflectToAttribute:!1}},type:"object",reflectToAttribute:!1}},type:"object",reflectToAttribute:!1},columnMenu:{value:{autoClose:{value:!0,type:"boolean"},dataSource:{value:{columnMenuCustomizeType:{value:{command:{value:"customizeTypeCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:!1,type:"any"},icon:{value:"smart-icon-settings",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},columnMenuItemClone:{value:{command:{value:"duplicateCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:!1,type:"any"},icon:{value:"smart-icon-duplicate",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},columnMenuItemInsertLeft:{value:{command:{value:"insertLeftCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:!1,type:"any"},icon:{value:"smart-icon-insert-left",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},columnMenuItemInsertRight:{value:{command:{value:"insertRightCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:!1,type:"any"},icon:{value:"smart-icon-insert-right",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},columnMenuItemSortAsc:{value:{command:{value:"sortAscCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:"auto",type:"any"},icon:{value:"smart-icon-sort-name-up",type:"string"},iconAlt:{value:"smart-icon-sort-number-up",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},columnMenuItemSortDesc:{value:{command:{value:"sortDescCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:"auto",type:"any"},icon:{value:"smart-icon-sort-name-down",type:"string"},iconAlt:{value:"smart-icon-sort-number-down",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},columnMenuItemRemoveSort:{value:{command:{value:"removeSortCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:"auto",type:"any"},icon:{value:"smart-icon-cancel-circled",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},columnMenuItemSort:{value:{command:{value:"addSortCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:"auto",type:"any"},icon:{value:"smart-icon-sort",type:"string"},iconAlt:{value:"smart-icon-sort",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},columnMenuItemFilter:{value:{command:{value:"addFilterCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:"auto",type:"any"},icon:{value:"smart-icon-add-filter",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},columnMenuItemRemoveFilter:{value:{command:{value:"removeFilterCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:"auto",type:"any"},icon:{value:"smart-icon-cancel-circled",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},columnMenuItemGroupBy:{value:{command:{value:"groupByCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:"auto",type:"any"},icon:{value:"smart-icon-group",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},columnMenuItemRemoveGroupBy:{value:{command:{value:"removeGroupByCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:"auto",type:"any"},icon:{value:"smart-icon-ungroup",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},columnMenuItemHide:{value:{command:{value:"hideColumnCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:!1,type:"any"},icon:{value:"smart-icon-visibility-off",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},columnMenuItemDelete:{value:{command:{value:"deleteColumnCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:!1,type:"any"},icon:{value:"smart-icon-delete",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1}},type:"object",reflectToAttribute:!1},visible:{value:!1,type:"boolean"},enabled:{value:!0,type:"boolean"},width:{value:250,type:"number"},height:{value:null,type:"number?"}},type:"object",reflectToAttribute:!1},columnGroups:{value:[],type:"array",reflectToAttribute:!1},charting:{value:{appendTo:{value:null,type:"any"},enabled:{value:!1,type:"boolean"},colorScheme:{value:"scheme01",type:"string"},description:{value:"",type:"string"},dialog:{value:{header:{value:"{{message}}",type:"string"},height:{value:400,type:"any"},width:{value:400,type:"any"},left:{value:"center",type:"any"},top:{value:"center",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:!1,type:"boolean"}},type:"object"},formatSettings:{value:{},type:"object"}},type:"object"},view:{value:"grid",allowedValues:["grid","kanban","card"],type:"string"},currentUser:{value:null,type:"any",reflectToAttribute:!1},dropDownMode:{value:!1,type:"boolean",reflectToAttribute:!1},dataSource:{value:null,type:"any",reflectToAttribute:!1},dataSourceMap:{value:{checklist:"checklist",color:"color",comments:"comments",dueDate:"dueDate",id:"id",priority:"priority",progress:"progress",startDate:"startDate",status:"status",swimlane:"swimlane",tags:"tags",text:"text",description:"description",userId:"userId",history:"history",createdUserId:"createdUserId",createdDate:"createdDate",updatedUserId:"updatedUserId",updatedDate:"updatedDate"},type:"any",reflectToAttribute:!1},dataSourceSettings:{value:{autoGenerateColumns:{value:!1,type:"boolean"},sanitizeHTML:{value:"blackList",allowedValues:["all","blackList","none"],type:"string"},root:{value:"",type:"string"},record:{value:"",type:"string"},keyDataField:{value:"",type:"string"},parentDataField:{value:"",type:"string"},childrenDataField:{value:"",type:"string"},groupBy:{value:[],type:"array"},dataFields:{value:[],type:"array"},mapChar:{value:".",type:"string"},id:{value:"",type:"string"},relations:{value:[],type:"any",reflectToAttribute:!1},virtualDataSource:{value:null,type:"any"},virtualDataSourceOnExpand:{value:null,type:"any"}},type:"object"},formulas:{value:!1,type:"boolean"},highlighted:{value:-1,type:"any"},uploadSettings:{value:{url:{value:"",type:"string",reflectToAttribute:!1},removeUrl:{value:"",type:"string",reflectToAttribute:!1},existsUrl:{value:"",type:"string",reflectToAttribute:!1},name:{value:"userfile[]",type:"string",reflectToAttribute:!1},uploadMaxCount:{value:5,type:"number",reflectToAttribute:!1},uploadMaxSize:{value:2097152,type:"number",reflectToAttribute:!1},data:{value:null,type:"object",reflectToAttribute:!1},onUploadStarted:{value:null,type:"any",reflectToAttribute:!1},onUploadCompleted:{value:null,type:"any",reflectToAttribute:!1},onUploadRemove:{value:null,type:"any",reflectToAttribute:!1},onUploadError:{value:null,type:"any",reflectToAttribute:!1},onChange:{value:null,type:"any",reflectToAttribute:!1},onProgress:{value:null,type:"any",reflectToAttribute:!1},onAbort:{value:null,type:"any",reflectToAttribute:!1},onError:{value:null,type:"any",reflectToAttribute:!1},onSetHeaders:{value:null,type:"any",reflectToAttribute:!1},singleFilePost:{value:!0,type:"boolean",reflectToAttribute:!1},userFiles:{value:[],type:"array",reflectToAttribute:!1}},reflectToAttribute:!1,type:"object"},grouping:{value:{enabled:{value:!1,type:"boolean",reflectToAttribute:!1},allowCollapse:{value:!1,type:"boolean",reflectToAttribute:!1},autoHideGroupColumn:{value:!1,type:"boolean",reflectToAttribute:!1},autoExpandAll:{value:!1,type:"boolean",reflectToAttribute:!1},autoExpandToLevel:{value:0,type:"number",reflectToAttribute:!1},onGroupDefaultExpanded:{value:null,type:"any",reflectToAttribute:!1},expandMode:{value:"buttonClick",type:"string",allowedValues:["buttonClick","rowClick"],reflectToAttribute:!1},renderMode:{type:"string",value:"advanced",allowedValues:["basic","compact","advanced","multipleColumns"]},groupBy:{value:[],type:"array",reflectToAttribute:!1},groupRowHeight:{value:50,type:"any",reflectToAttribute:!1},toggleButtonIndent:{value:27,type:"number",reflectToAttribute:!1},groupIndent:{value:27,type:"number",reflectToAttribute:!1},groupBar:{value:{visible:{value:!1,type:"boolean",reflectToAttribute:!1},allowColumnDragDrop:{value:!0,type:"boolean",reflectToAttribute:!0},allowColumnCloseButtons:{value:!0,type:"boolean",reflectToAttribute:!0}},type:"object"},formatFunction:{value:null,type:"any",reflectToAttribute:!1},summaryRow:{value:{inline:{value:!0,type:"boolean"},visible:{value:!0,type:"boolean"}},type:"object"}},type:"object"},messages:{extend:!0,value:{en:{invalidColumnProperty:'{{elementType}}: Invalid property name "{{propertyName}}" set for Column: "{{type}}"',invalidRowProperty:'{{elementType}}: Invalid property name "{{propertyName}}" set for Row"',invalidCellValue:'Invalid cell value "{{value}}", Validation rule: "{{validationRule}}"',invalidValue:"Invalid value",invalidMinValue:"{{value}} above {{min}} must be filled out",invalidMaxValue:"{{value}} below {{max}} must be filled out",invalidMinLengthValue:"{{value}} is shorter than the minimum length of {{min}} characters",invalidMaxLengthValue:"{{value}} is longer than the maximum length of {{max}} characters",requiredValue:"{{value}} must be filled out",frozenColumns:"{{elementType}}: To Pin/Freeze a column group, all columns within it should be frozen.",frozenRows:"{{elementType}}: To Pin/Freeze a special cell, all rows within it should be frozen.",columnGroups:"{{elementType}}: Please, check the initialization of the smartGrid's columns array. The columns in a column group are expected to be siblings in the columns array.",viewGrid:"Grid",viewKanban:"Kanban",viewCard:"Cards",kanbanNone:"Blank",kanbanDescription:'Start from a project board with columns generated by the "{{column}}" column options.',kanbanNoneDescription:"Create a new column and start from scratch with a completely blank project board. You can add columns and configure settings yourself.",kanbanBasic:"Template",kanbanBasicDescription:'Create a new column and start from a project board with columns for "To do", "in progress" and "Done".',uncategorized:"Uncategorized",toDo:"To do",inProgress:"In progress",done:"Done",min:"Min: {{value}}",max:"Max: {{value}} ",sum:"Sum: {{value}} ",avg:"Avg: {{value}} ",cells:"{{value}} cells selected",rows:"{{value}} rows",oneRow:"1 row",unique:"Unique: {{value}}",blank:"Empty: {{value}}",filled:"Filled: {{value}}",summary:"Summary",countSummary:"Count",minSummary:"Min",maxSummary:"Max",avgSummary:"Avg",blankSummary:"Empty",uniqueSummary:"Unique",filledSummary:"Filled",statusSummary:"Status",sumSummary:"Sum",completed:"Tasks Completed: {{value}}",count:"Count: {{value}} ",pagerFirstButton:"First",pagerLastButton:"Last",pagerPreviousButton:"Previous",pagerNextButton:"Next",pagerNavigateToLabel:"Go to:",pagerPageSizeLabel:"Show:",pagerNavigateToInputPlaceholder:"",pagerEllipsis:"...",pagerSummaryString:"of",pagerSummaryPrefix:"of",pagerSummarySuffix:"",columnMenuCustomizeType:"Column settings",columnMenuItemClone:"Clone column",columnMenuItemInsertLeft:"Insert left",columnMenuItemInsertRight:"Insert right",columnMenuItemSortAsc:"Sort {{mode}}",columnMenuItemSortDesc:"Sort {{mode}}",columnMenuItemRemoveSort:"Remove Sort",columnMenuItemFilter:"Filter column",columnMenuItemSort:"Sort column",columnMenuItemRemoveFilter:"Remove Filter",columnMenuItemGroupBy:"Group column",columnMenuItemRemoveGroupBy:"Remove Group",columnMenuItemHide:"Hide column",columnMenuItemShow:"Show column",columnMenuItemDelete:"Delete column",columnResizeTooltip:"width: {{value}}px",rowResizeTooltip:"height: {{value}}px",commandBarAddRow:"Add",commandBarDeleteRow:"Delete row",commandBarBatchRevert:"Revert",commandBarBatchSave:"Save",commandBarFilter:"Filter",commandBarSort:"Sort",commandBarSearch:"Search",commandBarCustomize:"Customize",commandBarGroup:"Group",commandColumnEdit:"Edit",commandColumnDelete:"Delete",commandColumnCancel:"Cancel",commandColumnUpdate:"Update",contextMenuItemDelete:"Delete row",contextMenuItemEditCell:"Edit cell",contextMenuItemEditRow:"Edit row",commandColumnMenu:"",expandRow:"Expand row (Shift + Enter)",expandRowComments:"Expand row and see {{value}} comments",collapseRow:"Collapse row",addNewRow:"Click here to add a new row",addNewRowAlt:"<span>Add new empty row</span> <code>Shift</code> + <code>Space</code>",addNewRowAltSmall:"Add new empty row",addNewColumn:"Click here to add a new column",dialogChartHeader:"{{value}} Chart",dialogRowDetailHeader:"Row Id: {{value}}",dialogDescriptionHeader:"Column: {{value}}",dialogRowDetailButtonConfirm:"OK",dialogRowDetailButtonCancel:"CANCEL",dialogEditHeaderDisabled:"Row: {{value}}",dialogEditHeader:"Row: {{value}}",dialogEditHeaderMenu:"Toggle Sidebar",dialogExpandRowHeader:"Edit Record",dialogAddButtonConfirm:"ADD",dialogAddButtonCancel:"CANCEL",dialogEditButtonConfirm:"OK",dialogEditButtonSave:"Save",dialogEditButtonAutoSave:"Auto Save",dialogEditButtonCancel:"Cancel",dialogFilterButtonConfirm:"FILTER",dialogFilterButtonCancel:"CLEAR",dialogDeleteButtonConfirm:"DELETE",dialogDeleteButtonCancel:"CANCEL",dialogEditColumn:"Column: {{value}}",dialogNewColumn:"New column",dialogAddColumn:"Add Column",dialogAddColumnStatus:"Choose a grouping column",dialogAddColumnStatusDescription:"Represent the status of each record",dialogAddColumnStatusNotes:"Your records will be grouped based on this column",dialogAddHeader:"Add Row",dialogDeleteHeader:"Delete Row",dialogFilterHeader:"Filter by",dialogFilterMinLabel:"Min",dialogFilterMaxLabel:"Max",dialogFileHeader:"File",dialogImageFileHeader:"Image",dialogFileDrop:"or drag and drop file(s) to upload",dialogFileUpload:"Select Files(s) to Upload",dialogFileURL:"You can also provide the URL to a file",dialogFileURLUpload:"Upload",dialogFileLink:"Link (URL)",dialogFileDevice:"My Device",dialogMyFiles:"My Files",dialogMyFilesTitle:"Select files from your already uploaded files.",dialogFileSize:'No file currently added. The "{{value}}" file cannot be uploaded. Maximum file size is {{fileSize}}.',dialogFileCount:'The following files cannot be added "{{files}}". Maximum files allowed is {{fileCount}}.',dialogFileFileUpload:"No files currently selected",dialogAddColumnName:"Name",dialogAddColumnNameInfo:"Name of the column. The name of the column will be displayed in the column header.",dialogAddColumnDescription:"Description",dialogAddColumnDescriptionInfo:"Description of the column. When the description is set, an icon will be displayed in the column header. A tooltip with the description will be displayed when you point at the icon.",dialogAddColumnNamePlaceholder:"Column name (optional)",dialogAddColumnDescriptionPlaceholder:"Describe this column (optional)",dialogAddColumnType:"Type",dialogAddColumnTypeInfo:'Type of the data in the column. Unlike a spreadsheet, Columns have specific "types" that allow you to store rich content in each record. For example, a table can contain records (rows) with images, long texts, checkboxes.',dialogAddColumnTypeText:"Text",dialogAddColumnTypeMultilineText:"Multiline text",dialogAddColumnTypeImage:"Image",dialogAddColumnTypeNumber:"Number",dialogAddColumnTypeSelect:"Select",dialogAddColumnTypeMultipleSelect:"Multiple select",dialogAddColumnTypeDate:"Date",dialogAddColumnTypeTime:"Time",dialogAddColumnTypeRating:"Rating",dialogAddColumnTypeDuration:"Duration",dialogAddColumnTypeCheckBox:"CheckBox",dialogAddColumnTypeCreatedTime:"Created time",dialogAddColumnTypeLastUpdatedTime:"Last modified time",dialogAddColumnTypeCreatedBy:"Created by",dialogAddColumnTypeLastUpdatedBy:"Last modified by",dialogAddColumnTypeCollaborator:"User",dialogAddColumnTypeFormula:"Formula",dialogAddColumnTypeFormulaInfo:'Example: COL(Name) & "-" & COL(Price) or IF(COL(Price) * COL(Quantity) > 5, "Yes", "No")',dialogAddColumnTypeSlider:"Slider",dialogAddColumnTypeStatus:"Choose a status column",dialogAddColumnTypeStatusInfo:"Connect with the relevant status column",dialogAddColumnTypeAutoNumber:"Auto number",dialogAddColumnTypeRowLink:"Link to table",dialogAddColumnTypeURL:"URL",dialogAddColumnTypeEmail:"Email",dialogAddColumnTypePassword:"Password",dialogAddColumnTypePhone:"Phone",dialogAddColumnTypeNone:"None",dialogAddColumnTypeStartDate:"Start Date",dialogAddColumnTypeDueDate:"Due Date",dialogAddColumnTypeDueDateSettings:"Set as a deadline",dialogAddColumnTypeDueDateSettingsInfo:"Set a deadline with start date or due date templates.",dialogAddColumnTypeProgress:"Progress",dialogAddColumnTypePriority:"Priority",dialogAddColumnTypeDescription:"Description",dialogAddColumnTypeTags:"Tags",dialogAddColumnTypeName:"Name",dialogAddColumnTypeColor:"Color",dialogAddColumnTypeChecklist:"Checklist",dialogAddColumnTypeAssigned:"Assignee",dialogAddColumnTypeAttachment:"Attachment",dialogAddColumnDateFormat:"Date format",dialogAddColumnDateFormatInfo:"Choose the dates display format",dialogAddColumnDateFormatShort:"Short",dialogAddColumnDateFormatLong:"Long",dialogAddColumnDateFormatEU:"EU",dialogAddColumnDateFormatISO:"ISO",dialogAddColumnDateFormatAS:"AS",dialogAddColumnDateFormatFull:"Full",dialogAddColumnDateFormatSlash:"Slash",dialogAddColumnDateFormatHyphen:"Hyphen",dialogAddColumnDateFormatDot:"Dot",dialogAddColumnTimeFormat:"Time format",dialogAddColumnTimeFormatInfo:"Choose the time display format",dialogAddColumnTimeFormatHour:"hour",dialogAddColumnAllowTimeFormat:"Include a time field",dialogAddColumnCustomDateSeparator:"Set a custom separator",dialogAddColumnNumberFormat:"Number format",dialogAddColumnNumberFormatInfo:"Choose the number display format",dialogAddColumnNumberFormatInteger:"Integer",dialogAddColumnNumberFormatNumber:"Number",dialogAddColumnNumberFormatPercent:"Percent",dialogAddColumnNumberFormatPercentRounded:"Percent(rounded)",dialogAddColumnNumberFormatScientific:"Scientific",dialogAddColumnNumberFormatEngineering:"Engineering",dialogAddColumnNumberFormatAccounting:"Accounting",dialogAddColumnNumberFormatUnit:"Unit",dialogAddColumnNumberFormatUnitInfo:"Units of measurement",dialogAddColumnNumberFormatUnitAcre:"Acre",dialogAddColumnNumberFormatUnitCelsius:"Celsius",dialogAddColumnNumberFormatUnitFahrenheit:"Fahrenheit",dialogAddColumnNumberFormatUnitPercent:"Percent",dialogAddColumnNumberFormatUnitDegree:"Degree",dialogAddColumnNumberFormatUnitMegaByte:"Mega byte",dialogAddColumnNumberFormatUnitCentimeter:"Centimeter",dialogAddColumnNumberFormatUnitMeter:"Meter",dialogAddColumnNumberFormatUnitKilometer:"Kilometer",dialogAddColumnNumberFormatUnitMile:"Mile",dialogAddColumnNumberFormatUnitKilogram:"Kilogram",dialogAddColumnNumberFormatUnitPound:"Pound",dialogAddColumnNumberFormatUnitLiter:"Liter",dialogAddColumnNumberFormatUnitGallon:"Gallon",dialogAddColumnNumberFormatUnitSecond:"Second",dialogAddColumnNumberFormatUnitMinute:"Minute",dialogAddColumnNumberFormatUnitHour:"Hour",dialogAddColumnNumberFormatUnitDay:"Day",dialogAddColumnNumberFormatUnitWeek:"Week",dialogAddColumnNumberFormatUnitMonth:"Month",dialogAddColumnNumberFormatUnitYear:"Year",dialogAddColumnNumberFormatCurrency:"Currency",dialogAddColumnNumberFormatCurrencyRounded:"Currency(rounded)",dialogAddColumnNumberFormatCurrencyInfo:"Choose the currency display format",dialogAddColumnNumberFormatSeparator:"Use 1000 Separator (,)",dialogAddColumnMinLength:"Minimum length",dialogAddColumnMinLengthInfo:"Minimum text length",dialogAddColumnMaxLength:"Maximum length",dialogAddColumnMaxLengthInfo:"Maximum text length",dialogAddColumnMinValue:"Minimum value",dialogAddColumnMinValueInfo:"Minimum number",dialogAddColumnMaxValue:"Maximum value",dialogAddColumnMaxValueInfo:"Maximum number",dialogAddColumnMinDate:"Minimum date",dialogAddColumnMinDateInfo:"Minimum date",dialogAddColumnMaxDate:"Maximum date",dialogAddColumnMaxDateInfo:"Maximum date",dialogAddColumnColorItems:"Color items",dialogAddColumnListItems:"List items",dialogAddColumnLinkListItems:"Choose a table to link to",dialogAddColumnLinkField:"Choose a lookup field",dialogAddColumnLinkSelect:"Allow linking to multiple rows",dialogAddColumnFormula:"Please enter a formula",dialogAddColumnListItemsError:"You cannot delete an item while in use.",dialogAddColumnDefault:"Default value",dialogAddColumnDefaultDateCurrent:"Current Date",dialogAddColumnDefaultDateSpecific:"Specific Date",dialogAddColumnAlign:"Align",dialogAddColumnAlignLeft:"Left",dialogAddColumnAlignRight:"Right",dialogAddColumnAlignCenter:"Center",dialogAddColumnAlignInfo:"Table cells text alignment",dialogAddColumnResizable:"Resizable",dialogAddColumnResizableInfo:"Select if you want to make the column resizable",dialogAddColumnRequired:"Required",dialogAddColumnRequiredInfo:"Select if you want to make the column required",dialogAddColumnSortable:"Sortable",dialogAddColumnSortableInfo:"Select if you want to sort by this column",dialogAddColumnFilterable:"Filterable",dialogAddColumnFilterableInfo:"Select if you want to filter by this column",dialogAddColumnEditable:"Editable",dialogAddColumnEditableInfo:"Select if you want to edit by this column",dialogAddColumnMultipleCollaborators:"Multiple Collaborators",dialogAddColumnMultipleCollaboratorsInfo:"Select if you want to allow multiple collaborators",dialogAddColumnCheckItems:"Show Checkbox",dialogAddColumnFormatting:"Rich Formatting",priority_low:"Low",priority_average:"Average",priority_high:"High",priority_critical:"Critical",bold:"Bold",fontStyle:"Font Style",italic:"Italic",send:"Send",copy:"copy",status:"Status",underline:"Underline",comments:"Comments",comment:"Comment",commentPlaceholder:"Leave a comment",noComments:"Leave a comment and collaborate with your team.",guestUser:"Guest",background:"Background",starred:"Starred",resetFormat:"Reset Format",notStarred:"Not starred",color:"Color",coloredItems:"Colored items",conditionalFormatting:"Conditional Formatting",groupBarLabel:"Drag a column header here to group by that column",dialogDeleteContent:"Are you sure you want to delete this row?",detailsTab:"Format",commentsTab:"Comments",historyTab:"History",historyEvent:"Event",historyAuthor:"Author",historyDetails:"Details",range:"Changed {{column}} from {{oldValue}} to {{newValue}}",nullRange:"Changed {{column}} to {{newValue}}",rowCreated:"Row Created",propertyUpdated:"{{value}} updated",propertyRemoved:"{{value}} removed",dropImages:"Drop images here",addImages:"Add images",dropFiles:"Drop files here",addFiles:"Add files",unassigned:"Unassigned",historyDate:"Date",copyURL:"Copy row URL",calendar:{"/":"/",":":":",firstDay:0,days:{names:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],namesAbbr:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],namesShort:["Su","Mo","Tu","We","Th","Fr","Sa"]},months:{names:["January","February","March","April","May","June","July","August","September","October","November","December",""],namesAbbr:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec",""]},AM:["AM","am","AM"],PM:["PM","pm","PM"],eras:[{name:"A.D.",start:null,offset:0}],currencySymbol:"$",currency:"USD",currencySymbolPosition:"before",decimalSeparator:".",thousandsSeparator:","},CONTAINS:"Contains",DOES_NOT_CONTAIN:"Does not contain",ENDS_WITH:"Ends with",EQUAL:"Equal",GREATER_THAN:"Greater than",GREATER_THAN_OR_EQUAL:"Greater than or equal",LESS_THAN:"Less than",LESS_THAN_OR_EQUAL:"Less than or equal",NOT_EQUAL:"Not equal",RANGE:"Range",CLEAR_FILTER:"Clear Filter",STARTS_WITH:"Starts with",addFilter:"+ Add filter",and:"And",apply:"Apply",applyOnce:"Apply once",booleanFirst:"☐",booleanLast:"☑",cancel:"Cancel",CONTAINS_CASE_SENSITIVE:"Contains (case sensitive)",dateFirst:"1",dateLast:"9",DOES_NOT_CONTAIN_CASE_SENSITIVE:"does not contain (case sensitive)",EMPTY:"empty",ENDS_WITH_CASE_SENSITIVE:"ends with (case sensitive)",EQUAL_CASE_SENSITIVE:"equal (case sensitive)",filter:"Filter",customize:"Hide columns",customizeOne:"1 hidden column",customizeHidden:"{{n}} hidden columns",filteredByMultiple:"{{n}} filters",filteredByOne:"1 filter",filterValuePlaceholder:"Value",find:"Find a field",findInView:"Find in view",firstBy:"Sort by",found:"{{nth}} of {{n}}",from:"from",noFilters:"No filters applied",noResults:"No results",noSorting:"No sorting applied",noOptions:"No options",NOT_EMPTY:"not empty",NOT_NULL:"not null",NULL:"null",numberFirst:"1",numberLast:"9",ok:"OK",or:"Or",pickAnother:"Pick another field to sort by",maintainSort:"Maintain sort",sort:"Sort",group:"Group",sortedByMultiple:"Sorted by {{n}} columns",sortedByOne:"Sorted by 1 column",STARTS_WITH_CASE_SENSITIVE:"starts with (case sensitive)",stringFirst:"A",stringLast:"Z",thenBy:"then by",where:"Where",collapseAll:"Collapse all",expandAll:"Expand all",noGrouping:"No grouping",groupedByMultiple:"{{n}} groups",groupedByOne:"1 group",groupedBy:"Grouped by {{column}}",deleteByMultiple:"Delete {{n}} rows",deleteByOne:"Delete 1 row",download:"Download",firstByGroup:"Group by",expandRecord:"Expand row",expandCell:"Expand cell",pickAnotherGroupBy:"Pick another field to group by",add:"Add condition",all:"All columns",between:"Between",close:"Close",column:"Column:",condition:"Condition:",equal:"equal",fontFamily:"Font family:",fontSize:"Font size:",format:"Format:",greaterThan:"greater than",highlight:"Highlight",lessThan:"less than",notEqual:"not equal",remove:"Remove condition",secondValue:"Second value:",text:"Text",value:"Value:",addCondition:"Add Condition",addGroup:"Add Group",blanks:"(Blanks)",clear:"Clear",contains:"contains",containsCaseSensitive:"contains (case sensitive)",dateTabLabel:"DATE",doesNotContain:"does not contain",doesNotContainCaseSensitive:"does not contain (case sensitive)",empty:"empty",endsWith:"ends with",endsWithCaseSensitive:"ends with (case sensitive)",equalCaseSensitive:"equal (case sensitive)",greaterThanOrEqual:"greater than or equal",lessThanOrEqual:"less than or equal",mismatchedProperties:'smartFilterPanel: The "filterType" and the data type of the selected "dataField" are mismatched.',missingProperty:'smartFilterPanel: When mode is \'excel\', either "data" and "dataField" or "dataSource" of type Array have to be set.',notEmpty:"not empty",notNull:"not null",null:"null ",placeholderBoolean:"Select value",placeholderDate:"Enter date",placeholderNumber:"Enter number",placeholderTime:"Enter time",placeholderValue:"Enter value",selectAll:"(Select All)",showRows:"Show rows where:",startsWith:"starts with",startsWithCaseSensitive:"starts with (case sensitive)",matchCase:"Match Case",timeTabLabel:"TIME",today:"Today",tomorrow:"Tomorrow",yesterday:"Yesterday",formatColumn:"Format Column",formating:"Colors",formatingByMultiple:"{{n}} Colors",formatingOne:"1 color",reset:"Reset",filteredRecords:"All rows are filtered",duplicateCells:"Clone column cells and settings",duplicateSettings:"Clone column settings",views:"Views",createView:"New View",newGrid:"Grid",newKanban:"Kanban",newCard:"Cards",layout:"Layout",settings:"Create view",viewNamePlaceholder:"View name",view:"View",noViews:"Found no views",kanbanView:"View your records as cards on a Kanban board",gridView:"View your records in a Table",cardView:"View your records in a Card view",days:"{{value}}d",daysOverdue:"{{value}} days overdue",daysLeft:"{{value}} days left",true:"true",false:"false",TOMORROW:"Tomorrow",TODAY:"Today",YESTERDAY:"Yesterday",NEXT_WEEK:"Next week",THIS_WEEK:"This week",LAST_WEEK:"Last week",NEXT_MONTH:"Next month",THIS_MONTH:"This month",LAST_MONTH:"Last month",hideHiddenColumns:"Hide {{value}} hidden columns",showHiddenColumns:"Show {{value}} hidden columns",less:"Less",more:"More",conditions:"Conditions",colorsSingleSelect:"Which single select field should the row be colored by?",colorRows:"Color rows when they match the conditions",colorSelect:"Color rows the same as a single select value",colorLeftBorderLabel:"Left border",colorRowLabel:"Row",colorCellLabel:"Cell",colorLeftBorder:"Color the left border of a row",colorRow:"Color the background of a row",colorCell:"Color the background of a cell",loadingIndicatorPlaceholder:"Loading...",dropDownPlaceholder:"Please select...",placeholder:"No Rows"}},type:"object"},onCellValue:{value:null,type:"any",reflectToAttribute:!1},onCellEditRequest:{value:null,type:"any",reflectToAttribute:!1},onCellUpdate:{value:null,type:"any",reflectToAttribute:!1},onCellRender:{value:null,type:"any",reflectToAttribute:!1},onBeforeInit:{value:null,type:"any",reflectToAttribute:!1},onInit:{value:null,type:"any",reflectToAttribute:!1},onAfterInit:{value:null,type:"any",reflectToAttribute:!1},onKey:{value:null,type:"any",reflectToAttribute:!1},onKeyUp:{value:null,type:"any",reflectToAttribute:!1},onRender:{value:null,type:"any",reflectToAttribute:!1},onLoad:{value:null,type:"any",reflectToAttribute:!1},onChartInit:{value:null,type:"any",reflectToAttribute:!1},onComment:{value:null,type:"any",reflectToAttribute:!1},onRowInit:{value:null,type:"any",reflectToAttribute:!1},onRowClass:{value:null,type:"any",reflectToAttribute:!1},onRowChange:{value:null,type:"any",reflectToAttribute:!1},onRowDetailInit:{value:null,type:"any",reflectToAttribute:!1},onRowDetailUpdated:{value:null,type:"any",reflectToAttribute:!1},onRowInserted:{value:null,type:"any",reflectToAttribute:!1},onRowRemoved:{value:null,type:"any",reflectToAttribute:!1},onRowUpdate:{value:null,type:"any",reflectToAttribute:!1},onRowUpdated:{value:null,type:"any",reflectToAttribute:!1},onRowStarred:{value:null,type:"any",reflectToAttribute:!1},onRowHistory:{value:null,type:"any",reflectToAttribute:!1},onRowStyle:{value:null,type:"any",reflectToAttribute:!1},onRowResize:{value:null,type:"any",reflectToAttribute:!1},onColumnInit:{value:null,type:"any",reflectToAttribute:!1},onColumnInserted:{value:null,type:"any",reflectToAttribute:!1},onColumnRemoved:{value:null,type:"any",reflectToAttribute:!1},onColumnResize:{value:null,type:"any",reflectToAttribute:!1},onColumnReorder:{value:null,type:"any",reflectToAttribute:!1},onColumnSummaryChange:{value:null,type:"any",reflectToAttribute:!1},onColumnUpdated:{value:null,type:"any",reflectToAttribute:!1},onColumnClone:{value:null,type:"any",reflectToAttribute:!1},onColumnChange:{value:null,type:"any",reflectToAttribute:!1},onCommand:{value:null,reflectToAttribute:!1,type:"any"},onViewInit:{value:null,type:"any",reflectToAttribute:!1},filtering:{value:{enabled:{value:!1,type:"boolean"},operator:{value:"and",type:"string"},filter:{value:[],type:"array",reflectToAttribute:!1},filterRow:{value:{visible:{value:!1,type:"boolean"},menuVisible:{value:!1,type:"boolean"},applyMode:{value:"auto",type:"string",allowedValues:["auto","click"]},autoApplyModeDelay:{value:800,type:"number"}},type:"object"},filterMenu:{value:{visible:{value:!0,type:"boolean"},buttons:{value:["cancel","clear","filter"],type:"array"},dataSource:{value:null,type:"any"},width:{value:250,type:"number"},height:{value:200,type:"number"},mode:{value:"default",allowedValues:["default","excel"],type:"string"},messages:{value:null,type:"object"}},type:"object"}},type:"object"},editing:{value:{allowRowHeaderEdit:{value:!1,type:"boolean"},allowColumnHeaderEdit:{value:!1,type:"boolean"},autoUpdateFilterAndSort:{value:!0,type:"boolean"},active:{value:!1,readonly:!0,type:"boolean"},enabled:{value:!1,type:"boolean"},batch:{value:!1,type:"boolean"},readOnlyEdit:{value:!1,type:"boolean"},action:{value:"click",type:"string",allowedValues:["none","click","doubleClick"]},commandKeys:{value:{commandKeyCancel:{value:{command:"commandKeyCancelCommand",key:"Escape"},type:"object"},commandKeyUpdate:{value:{command:"commandKeyUpdateCommand",key:"Enter | Tab"},type:"object"}},type:"object"},commandBar:{value:{visible:{value:!1,type:"boolean"},position:{value:"near",allowedValues:["near","far","both"],type:"string"},displayMode:{value:"labelAndIcon",allowedValues:["label","icon","labelAndIcon"],type:"string"},dataSource:{value:{commandBarAddRow:{value:{command:{value:"commandBarAddRowCommand",type:"any"},icon:{value:"smart-icon-plus",type:"string"},label:{value:"{{messages}}",type:"string"},visible:{value:!1,type:"any"}},type:"object"},commandBarDeleteRow:{value:{command:{value:"commandBarDeleteRowCommand",type:"any"},icon:{value:"smart-icon-delete",type:"string"},label:{value:"{{messages}}",type:"string"},visible:{value:!1,type:"any"}},type:"object"},commandBarBatchSave:{value:{command:{value:"commandBarBatchSaveCommand",type:"any"},icon:{value:"smart-icon-ok-squared",type:"string"},label:{value:"{{messages}}",type:"string"},visible:{value:!0,type:"any"}},type:"object"},commandBarBatchRevert:{value:{command:{value:"commandBarBatchRevertCommand",type:"any"},icon:{value:"smart-icon-reload",type:"string"},label:{value:"{{messages}}",type:"string"},visible:{value:!0,type:"any"}},type:"object"},commandBarCustom:{value:{command:{value:"",type:"any"},icon:{value:"smart-icon-ellipsis-vert",type:"string"},label:{value:"",type:"string"},visible:{value:!1,type:"any"}},type:"object"}},type:"object"}},type:"object"},commandColumn:{value:{visible:{value:!1,type:"boolean"},inline:{value:!1,type:"boolean"},position:{value:"far",allowedValues:["near","far"],type:"string"},displayMode:{value:"icon",allowedValues:["label","icon","labelAndIcon"],type:"string"},dataSource:{value:{commandColumnMenu:{value:{command:{value:"commandColumnMenuCommand",type:"any"},icon:{value:"smart-icon-menu",type:"string"},label:{value:"{{messages}}",type:"string"},visible:{value:!1,type:"any"}},type:"object"},commandColumnEdit:{value:{command:{value:"commandColumnEditCommand",type:"any"},icon:{value:"smart-icon-mode-edit",type:"string"},label:{value:"{{messages}}",type:"string"},visible:{value:"auto",type:"any"}},type:"object"},commandColumnDelete:{value:{command:{value:"commandColumnDeleteCommand",type:"any"},icon:{value:"smart-icon-delete",type:"string"},label:{value:"{{messages}}",type:"string"},visible:{value:!0,type:"any"}},type:"object"},commandColumnUpdate:{value:{command:{value:"commandColumnUpdateCommand",type:"any"},icon:{value:"smart-icon-ok-squared",type:"string"},label:{value:"{{messages}}",type:"string"},visible:{value:"auto",type:"any"}},type:"object"},commandColumnCancel:{value:{command:{value:"commandColumnCancelCommand",type:"any"},icon:{value:"smart-icon-cancel-circled",type:"string"},label:{value:"{{messages}}",type:"string"},visible:{value:"auto",type:"any"}},type:"object"},commandColumnRowMenu:{value:{command:{value:"commandColumnRowMenuCommand",type:"any",reflectToAttribute:!1},icon:{value:"smart-icon-ellipsis-vert",type:"string"},label:{value:"{{messages}}",type:"string"},visible:{value:!1,type:"any"}},type:"object"},commandColumnCustom:{value:{command:{value:"",type:"any",reflectToAttribute:!1},icon:{value:"smart-icon-ellipsis-vert",type:"string"},label:{value:"",type:"string"},visible:{value:!1,type:"any"}},type:"object"}},type:"object"},width:{value:null,type:"number?"}},reflectToAttribute:!1,type:"object"},mode:{value:"cell",allowedValues:["cell","row"],type:"string"},addNewColumn:{value:{visible:{value:!1,type:"boolean"}},type:"object"},addNewRow:{value:{position:{value:"both",allowedValues:["near","far","both"],type:"string"},visible:{value:!1,type:"boolean"},autoEdit:{value:!0,type:"boolean"},autoCreate:{value:!1,type:"boolean"},autoSave:{value:!0,type:"boolean"},label:{value:"{{message}}",type:"string"},displayMode:{value:"row",allowedValues:["row","button"],type:"string"}},type:"object"},dialog:{value:{header:{value:"{{message}}",type:"string"},height:{value:"auto",type:"any"},width:{value:"auto",type:"any"},left:{value:"center",type:"any"},top:{value:"center",type:"any"},enabled:{value:!1,type:"boolean"},visible:{value:!1,type:"boolean"}},type:"object"},addDialog:{value:{header:{value:"{{message}}",type:"string"},height:{value:"auto",type:"any"},width:{value:"auto",type:"any"},left:{value:"center",type:"any"},top:{value:"center",type:"any"},enabled:{value:!1,type:"boolean"},visible:{value:!1,type:"boolean"}},type:"object"},addColumnDialog:{value:{header:{value:"{{message}}",type:"string"},height:{value:"auto",type:"any"},width:{value:430,type:"any"},left:{value:"center",type:"any"},top:{value:"center",type:"any"},enabled:{value:!1,type:"boolean"},visible:{value:!1,type:"boolean"}},type:"object"},deleteDialog:{value:{header:{value:"{{message}}",type:"string"},height:{value:"auto",type:"any"},width:{value:"auto",type:"any"},left:{value:"center",type:"any"},top:{value:"center",type:"any"},enabled:{value:!1,type:"boolean"},visible:{value:!1,type:"boolean"}},type:"object"}},type:"object"},paging:{value:{enabled:{value:!1,type:"boolean"},spinner:{value:{enabled:{value:!1,type:"boolean"},step:{value:1,type:"number"}},type:"object"},pageHierarchySize:{value:2,type:"int"},pageSize:{value:10,type:"int"},pageIndex:{value:0,type:"int",validator:"pageIndexValidator"}},type:"object"},pager:{value:{autoEllipsis:{value:"both",allowedValues:["none","before","after","both"],type:"string"},position:{value:"far",allowedValues:["near","far","both"],type:"string"},template:{value:"",type:"string"},pageSizeSelector:{value:{visible:{value:!1,type:"boolean"},dataSource:{value:[10,20,50],type:"object"},position:{value:"far",allowedValues:["near","far"],type:"string"}},type:"object"},summary:{value:{position:{value:"far",allowedValues:["near","far"],type:"string"},visible:{value:!1,type:"boolean"}},type:"object"},navigationButtons:{value:{position:{value:"both",allowedValues:["near","far","both"],type:"string"},prevNextButtons:{value:{visible:{value:!0,type:"boolean"}},type:"object"},firstLastButtons:{value:{visible:{value:!0,type:"boolean"}},type:"object"},labels:{value:{visible:{value:!1,type:"boolean"}},type:"object"}},type:"object"},navigationInput:{value:{position:{value:"far",allowedValues:["near","far"],type:"string"},visible:{value:!1,type:"boolean"}},type:"object"},pageIndexSelectors:{value:{visible:{value:!0,type:"boolean"},dataSource:{value:10,type:"any"}},type:"object"},visible:{value:!1,type:"boolean"}},type:"object",reflectToAttribute:!1},rowDetail:{value:{enabled:{value:!1,type:"boolean"},inline:{value:!1,type:"boolean"},height:{value:200,type:"number"},position:{value:"near",allowedValues:["near","far"],type:"string"},template:{value:"",type:"any",reflectToAttribute:!1},visible:{value:!0,type:"boolean"},dialog:{value:{header:{value:"{{message}}",type:"string"},height:{value:300,type:"any"},width:{value:360,type:"any"},left:{value:"center",type:"any"},top:{value:"center",type:"any"},enabled:{value:!1,type:"boolean"},visible:{value:!1,type:"boolean"}},type:"object"}},type:"object"},rowCSSRules:{value:null,type:"any"},summaryRow:{value:{position:{value:"far",allowedValues:["near","far"],type:"string"},visible:{value:!1,type:"boolean"},editing:{value:!1,type:"boolean"},template:{value:"",type:"string"}},type:"object"},scrolling:{value:"physical",allowedValues:["physical","virtual","infinite","deferred"],type:"string"},columnHeader:{value:{visible:{value:!0,type:"boolean"}},type:"object"},groupHeader:{value:{visible:{value:!1,type:"boolean"},template:{value:"",type:"string"}},type:"object"},header:{value:{visible:{value:!1,type:"boolean"},template:{value:"",type:"any"},appendTo:{value:"",type:"any"},buttons:{value:["columns","filter","group","sort","format","search"],type:"array"},searchCommand:{value:"search",allowedValues:["search","filter"],type:"string"},customButton:{value:{command:{value:null,type:"any",reflectToAttribute:!1},enabled:{value:!0,type:"boolean"},visible:{value:!1,type:"boolean"},icon:{value:"smart-icon-settings",type:"string"},label:{value:"",type:"string"}},type:"object",reflectToAttribute:!1},onInit:{value:null,reflectToAttribute:!1,type:"any"}},type:"object"},footer:{value:{visible:{value:!1,type:"boolean"},template:{value:"",type:"any"}},type:"object"},stateSettings:{value:{enabled:{value:!0,type:"boolean",reflectToAttribute:!1},current:{value:"",type:"string",reflectToAttribute:!1},storage:{value:null,type:"any",reflectToAttribute:!1},autoSave:{value:!1,type:"boolean",reflectToAttribute:!1},autoLoad:{value:!1,type:"boolean",reflectToAttribute:!1},allowLocalStorage:{value:!0,type:"boolean",reflectToAttribute:!1},options:{value:[],type:"array",reflectToAttribute:!1},onStateChange:{value:null,type:"any",reflectToAttribute:!1}},type:"object",reflectToAttribute:!1},checkBoxes:{value:{visible:{value:!1,type:"boolean"},hasThreeStates:{value:!1,type:"boolean"}},type:"object"},selection:{value:{enabled:{value:!1,type:"boolean"},allowRowHeaderSelection:{value:!1,type:"boolean"},allowColumnHeaderSelection:{value:!1,type:"boolean"},allowRowSelection:{value:!0,type:"boolean"},allowCellSelection:{value:!1,type:"boolean"},allowDragSelection:{value:!0,type:"boolean"},allowDragSelectionAutoScroll:{value:!0,type:"boolean"},allowCellDragSelectionHandle:{value:!0,type:"boolean"},allowCellDragDropSelectionHandle:{value:!0,type:"boolean"},allowCellDragSelectionAutoFill:{value:!0,type:"boolean"},selectAllMode:{value:"page",allowedValues:["none","page","all"],type:"string"},mode:{value:"many",type:"string",allowedValues:["one","many","extended"]},action:{value:"click",type:"string",allowedValues:["none","click","doubleClick"]},checkBoxes:{value:{enabled:{value:!1,type:"boolean"},autoShow:{value:!1,type:"boolean"},action:{value:"click",type:"string",allowedValues:["none","click","doubleClick"]},selectAllMode:{value:"page",allowedValues:["none","page","all"],type:"string"},position:{value:"near",allowedValues:["near","far"],type:"string"}},type:"object"},selected:{value:"",type:"string"},tabKeyBehavior:{value:"default",allowedValues:["none","default"],type:"string"},defaultSelection:{value:!1,type:"boolean"}},type:"object"},sorting:{value:{enabled:{value:!1,type:"boolean"},sort:{value:[],type:"array"},mode:{value:"one",allowedValues:["one","many"],type:"string"},maintainSort:{value:!0,type:"boolean"},commandKey:{value:"",allowedValues:["","Shift","Control","Alt"],type:"string"},sortToggleThreeStates:{value:!0,type:"boolean"},sortToggleOnClick:{value:!0,type:"boolean"},sortToggleOnClickAndCommandKey:{value:!1,type:"boolean"}},type:"object"},storeHistory:{value:!1,type:"boolean"},storeHistoryItems:{value:20,type:"number"},users:{value:[],type:"array",reflectToAttribute:!1},virtualModeCachedRowsCount:{value:100,type:"int"}}}static get requires(){return{}}static get styleUrls(){return["smart.menu.css","smart.filterpanel.css","smart.pager.css","smart.grid.css","smart.textbox.css"]}template(){return"<div class='smart-container'id='container' disabled='[[disabled]]' role='grid'>\n <div id='header' role=\"toolbar\" class='smart-grid-header smart-hidden'>\n </div>\n <div id='groupHeader' role=\"presentation\" class='smart-grid-group-header smart-hidden'></div>\n <div id='headerPager' top class='smart-grid-pager smart-hidden'></div>\n <div id='headerCommandBar' header top class='smart-grid-header smart-grid-command-bar smart-hidden'></div>\n <div id='content' class='smart-grid-content'>\n <div id='columnHeader' role=\"rowgroup\" class='smart-grid-column-header'>\n <div id='columnNearContainer' role=\"row\" class='near smart-hidden smart-grid-column-header-cell-container'>\n </div>\n <div id='columnContainer' role=\"row\" class='center smart-grid-column-header-cell-container'>\n </div>\n <div id='columnFarContainer' role=\"row\" class='far smart-hidden smart-grid-column-header-cell-container'>\n </div>\n </div>\n <div id='scrollView' role=\"rowgroup\" class ='smart-grid-scroll-view'>\n <div id='rowNearContainer' role=\"presentation\" class='near smart-hidden smart-grid-row-container'>\n </div>\n <div id='rowContainer' role=\"presentation\" class='center smart-grid-row-container'>\n </div>\n <div id='rowFarContainer' role=\"presentation\" class='far smart-hidden smart-grid-row-container'>\n </div>\n <div id='placeholder' class ='smart-hidden smart-placeholder smart-grid-placeholder'></div>\n <smart-scroll-bar right-to-left=\"[[rightToLeft]]\" theme=\"[[theme]]\" id='verticalScrollBar' class='smart-grid-scroll-bar' wait disabled='[[disabled]]' orientation='vertical'></smart-scroll-bar>\n <smart-scroll-bar right-to-left=\"[[rightToLeft]]\" theme=\"[[theme]]\" id='horizontalScrollBar' class='smart-grid-scroll-bar' wait disabled='[[disabled]]'></smart-scroll-bar>\n </div>\n <div id='filterFooter' class='smart-grid-filter-footer smart-hidden'></div>\n </div>\n <div class=\"smart-grid-view-content smart-hidden\" id=\"viewContent\"></div>\n <div viewbar class=\"smart-grid-view-bar smart-hidden\" id=\"viewBar\"></div>\n <div id='loadingIndicatorContainer' class='smart-loader-container'>\n <span id='loadingIndicator' class='smart-grid-loader smart-loader'></span>\n <span id='loadingIndicatorPlaceholder' class ='smart-loader-label smart-hidden'></span>\n </div>\n <div id='footerCommandBar' footer class='smart-grid-footer smart-grid-command-bar smart-hidden'></div>\n <div id='footerPager' class='smart-grid-pager smart-hidden'></div>\n <div id='footer' class='smart-grid-footer smart-hidden'></div>\n </div>"}static get listeners(){return{focus:"_focusHandler",blur:"_blurHandler",wheel:"_mouseWheelHandler","document.up":"_upHandler","document.down":"_downHandler","document.move":"_moveHandler","document.scroll":"_scrollHandler",keydown:"_keyDownHandler",keyup:"_keyUpHandler",resize:"_resizeHandler","header.click":"_headerClickHandler","columnHeader.down":"_columnDownHandler","columnHeader.click":"_columnClickHandler","columnHeader.move":"_columnMoveHandler","columnHeader.mouseleave":"_columnMouseLeaveHandler","rowNearContainer.down":"_rowDownHandler","rowContainer.down":"_rowDownHandler","rowFarContainer.down":"_rowDownHandler","container.selectstart":"_selectStartHandler",styleChanged:"_styleChangedHandler",swipeleft:"_swipeLeftHandler",swiperight:"_swipeRightHandler",contextmenu:"_contextMenuHandler","document.paste":"_clipboardPasteHandler"}}_clipboardPasteHandler(e){if("paste"===e.type){const t=this;if(document.activeElement!==t)return;if(t._selection&&t._selection.focusedCell){const o=t._selection.focusedCell.id,l=t._selection.focusedCell.dataField,a=t.columnByDataField[l];if(!a)return;if(a&&("image"===a.template||"attachment"===a.template)){e.preventDefault();let a=(e.clipboardData||e.originalEvent.clipboardData).items,n=null,i=0,r=0,s=[];for(let e=0;e<a.length;e++)if(0===a[e].type.indexOf("image")&&(n=a[e].getAsFile(),i++,null!==n)){let e={label:n.name,size:n.size},a=new FileReader;a.onload=function(a){r++;const n=a.target.result;e.value=n;let d=!1;for(let o=0;o<t.uploadSettings.userFiles.length;o++){const l=t.uploadSettings.userFiles[o];if(l.name===e.label||l.label===e.label){d=!0;break}}if(d||t.uploadSettings.userFiles.push(e),s.push(e),r===i){let e=t.getCellValue(o,l);e||(e=[]),"string"==typeof e&&(e=JSON.parse(e)),e=[...e,...s],t.setCellValue(o,l,e)}},a.readAsDataURL(n)}}}}}_contextMenuHandler(e){if(this.contextMenu.enabled)return e.preventDefault(),e.stopPropagation(),!1}get _tabindex(){return this.disabled||this.unfocusable?"":' tabindex="0"'}pageIndexValidator(e,t){const o=this;if(t<0)return 0;if(o.dataSource){if(o.dataSource.virtualDataSource)return t;const e=Math.ceil(o.dataSource.length/o._pageSize);if(t>e-1)return e-1}}_offsetTop(e){return e?e.offsetTop+this._offsetTop(e.offsetParent):0}_offsetLeft(e){return e?e.offsetLeft+this._offsetLeft(e.offsetParent):0}offset(e){return{left:this._offsetLeft(e),top:this._offsetTop(e)}}getBoundingRect(e){const t=this;let o=window.pageXOffset,l=window.pageYOffset,a=e.getBoundingClientRect();if(e!==document.body){let a=e.parentNode;for(;a!==document.body&&a;){a&&(o+=a.scrollLeft,l+=a.scrollTop);let e=a;a?(a=a.parentNode,t.enableShadowDOM&&a===t.shadowRoot?a=t:!t.isInShadowDOM||a!==t.getRootNode()&&e!==t.getRootNode()||(a=t.getRootNode().host)):t.isInShadowDOM&&(a=t.getRootNode().host)}}return{bottom:a.bottom+l,height:a.height,left:a.left+o,right:a.right+o,top:a.top+l,width:a.width}}_downHandler(e){this._downTarget=e.originalEvent.target}_removeCellContentPopup(){const e=this;e._cellContentPopup&&(e._cellContentPopup.remove(),e._cellContentPopup=null),e._cellContentPopupTimer&&(clearTimeout(e._cellContentPopupTimer),e._cellContentPopupTimer=null)}_upHandler(e){const t=this,o=t.getBoundingRect(t);super._upHandler(),t._tapTimer&&clearTimeout(t._tapTimer);const l=()=>{t.editing.isEditing&&!t.editing.dialog.enabled&&setTimeout((()=>{if(!e.defaultPrevented){if(t.editing.editCell&&t.editing.editCell.editor.instance){const o=t.editing.editCell.editor.instance;if(o.element&&o.element.hasAttribute("aria-owns")){const t=o.element.getAttribute("aria-owns"),l=document.getElementById(t);if(l&&l.contains(e.originalEvent.target))return}if(t.editing.editCell.editor.instance.blur(e),e.defaultPrevented)return}t.isAttached&&t.endEdit()}}),50)};if(e.originalEvent&&(e.originalEvent.target===t.$.scrollView&&t._downTarget===e.originalEvent.target&&l(),e.originalEvent.target.closest(".smart-grid-dialog")))t._dialogDragDetails&&(t._dialogDragDetails.started=!1);else{if(e.pageX<o.left||e.pageX>o.right||e.pageY<o.top||e.pageY>o.bottom){let o=!1,a=e.originalEvent.target;for(;a;){if(a=a.parentNode,a===t){o=!0;break}if(t.dropDownMode&&t.$.dropDownElement===a){o=!0;break}}if(o)return t._dragSelectionEnd(e),t._endResize(e),void t._endDrag(e);if(t._summaryRowDialog&&t._summaryRowDialog.classList.contains("open")&&t._summaryRowDialog.confirm(),t._inputOverlay&&(t._inputOverlay.classList.remove("smart-input-overlay-on"),setTimeout((()=>{t._inputOverlay&&(t._inputOverlay.parentNode&&t._inputOverlay.parentNode.removeChild(t._inputOverlay),t._inputOverlay=null)}),t.behavior.doubleClickTimingDelay)),l(),t.closeDropDown(),t.menu){let o,l,a,n;if(t.enableShadowDOM||t.isInShadowDOM?(o=e.originalEvent.composedPath()[0],l=function(){let e=o.getRootNode().host;for(;e;){if(e===t)return e;e=e.getRootNode().host}}(),a=t.menu.contains(o)||t.menu.firstElementChild.shadowRoot.contains(o),n=t.menu.firstElementChild.shadowRoot):(o=e.originalEvent.target,l=t.contains(o),a=t.menu.contains(o),n=t.menu),!l&&!a){const e=n.querySelectorAll("smart-drop-down-list"),l=n.querySelectorAll("smart-date-time-picker"),a=n.querySelectorAll("smart-date-input"),i=n.querySelectorAll("smart-input");for(let t=0;t<e.length;t++)if(e[t].$.dropDownContainer.contains(o))return;for(let e=0;e<l.length;e++)if(l[e].$.dropDownContainer.contains(o))return;for(let e=0;e<a.length;e++)if(a[e].$.scrollView.contains(o))return;for(let e=0;e<i.length;e++)if(i[e].$.scrollView.contains(o))return;return void t.closeMenu()}}}t._summaryRowDialog&&t._summaryRowDialog.classList.contains("open")&&t._summaryRowDialog.confirm(),t._dragSelectionEnd(e),t._endResize(e),t._endDrag(e)}}_nextColumn(e){const t=this;for(let o=0;o<t.viewColumns.length;o++){const l=t.viewColumns[o];if(l.visibleIndex===e.visibleIndex+1)return l}return null}_nextRow(e){const t=this._recyclingRows,o=t.indexOf(e);return o>=0?t[o+1]:null}_moveHandler(e){const t=this;if(t.isInitialized&&t._selection){if(t.selection.enabled&&t.selection.allowDragSelection&&!t.editing.isEditing&&(!t._selection.selectionRect||t._selection.selectionRect&&!t._selection.selectionRect.captured)&&(!0!==t._mobile&&t._dragSelection(e),e.originalEvent)){const o=e.originalEvent.target.closest?e.originalEvent.target:void 0;Smart.Utilities.Core.isMobile&&o&&o.closest("smart-grid")===t&&e.originalEvent.preventDefault()}t.isScrolling||("none"===t.behavior.columnResizeMode||t.classList.contains("smart-grid-row-resize-mode")||t._columnMoveResizeHandler(e),"none"===t.behavior.rowResizeMode||t.classList.contains("smart-grid-column-resize-mode")||t._rowMoveResizeHandler(e),t._drag(e))}}_hideActionButtons(){const e=this;if(e._columnElements){for(let t=0;t<e._columnElements.length;t++){const o=e._columnElements[t],l=o.column;l&&l.autoShowActionButton&&o._hideActionButton()}for(let t=0;t<e._frozenNearColumns.length;t++){const o=e._frozenNearColumns[t],l=o.element;o&&o.autoShowActionButton&&l._hideActionButton()}}}_columnMouseLeaveHandler(){this._mobile||this._hideActionButtons()}_columnMoveHandler(e){const t=this;if(!t.isInitialized)return;if(t._columnResizeStartLine||t._rowResizeStartLine)return;if(t._mobile)return;const o=(o,l)=>{if(o&&o.autoShowActionButton){const a=l.getBoundingClientRect(),n=t.offset(l),i=t.parentElement,r=i?i.scrollTop:0;if(n.left<=e.pageX&&n.left+a.width-6>=e.pageX)if(n.top-r<=e.pageY&&n.top-r+a.height>=e.pageY){if(!t.hasColumnMenu(o))return;l._showActionButton()}else l._hideActionButton();else l._hideActionButton()}};for(let e=0;e<t._columnElements.length;e++){const l=t._columnElements[e];o(l.column,l)}for(let e=0;e<t._frozenNearColumns.length;e++){const l=t._frozenNearColumns[e];o(l,l.element)}}_headerClickHandler(e){const t=this;if(t.$.headerBar){const o=t.isInShadowDOM||t.shadowRoot?e.composedPath()[0]:e.target;t.$.headerBar._headerClickHandler(o,t)}}_columnClickHandler(e){const t=this;if(t._overlay)return;if(void 0===e.clientX)return;const o=(t.enableShadowDOM?t.shadowRoot:t.getRootNode()).elementsFromPoint(e.clientX,e.clientY);let l=null,a=null;const n=new Date-t._columnClickTime<t.behavior.doubleClickTimingDelay;t._columnClickTime=new Date;for(let e=0;e<o.length;e++){const t=o[e];if(t.classList.contains("smart-action-button"))return;if(t.getAttribute("data-field")){l=t.getAttribute("data-field"),a=t;break}}if(l){const o=a.column;if(!o)return;if(e.srcElement.classList.contains("smart-filter-button"))return;if("_addNewColumn"===o.dataField)return void t._openAddColumnDialog();if(Smart.Utilities.Core.isMobile)n&&t.sorting.sortToggleOnClick&&o.allowSortToggleOnClick&&t.sorting.enabled&&(t.sortBy(l),t.autoSaveState()),t._columnMoveHandler(e),e.originalEvent&&e.originalEvent.preventDefault();else if(!n&&t.sorting.sortToggleOnClick&&o.allowSortToggleOnClick&&t.sorting.enabled){if("none"!==t.behavior.columnResizeMode&&"col-resize"===o.element.style.cursor)return;if(t._canSort=!0,""!==t.sorting.commandKey){if("Alt"===t.sorting.commandKey&&!1===e.altKey&&(t._canSort=!1),"Shift"===t.sorting.commandKey&&!1===e.shiftKey&&(t._canSort=!1),"Control"===t.sorting.commandKey&&!1===e.metaKey&&!1===e.ctrlKey&&(t._canSort=!1),"Control"!==t.sorting.commandKey&&e.ctrlKey)return;if(!0===t.sorting.sortToggleOnClickAndCommandKey&&!t._canSort)return}t.sortBy(l),t.autoSaveState()}}}_columnDownHandler(e){const t=this,o=(t.enableShadowDOM?t.shadowRoot:t.getRootNode()).elementsFromPoint(e.clientX,e.clientY);let l=null,a=null;const n=new Date-t._clickTime<t.behavior.doubleClickTimingDelay;t.$.headerBar&&t.$.headerBar.closePanel(),t._doubleClickHandler(e);for(let e=0;e<o.length;e++){const t=o[e];if(t.classList.contains("smart-action-button"))return;if(t.getAttribute("data-field")){l=t.getAttribute("data-field"),a=t;break}}if(l){const o=a.column;if(!o)return;if("_commandColumn"===l)return void(t.editing.commandColumn.dataSource.commandColumnMenu.visible&&t._applyCommand(t.editing.commandColumn.dataSource.commandColumnMenu.command));const i=function(a){const n=o.selectionColumn?t.selection.checkBoxes.action===a&&t.selection.enabled:t.selection.action===a&&t.selection.enabled;if("col-resize"!==o.element.style.cursor&&(!t.appearance.showColumnHeaderDragIcon||!e.originalEvent.target.classList.contains("smart-drag-handle"))&&n){if(t.editing.enabled&&t.editing.editColumn===o)return;if(e.shiftKey||e.ctrlKey||e.metaKey?t._dragSelectionStartDataField=null:t._dragSelectionStartDataField=l,"_checkBoxColumn"===l)return void t._toggleColumnSelection(o);"_rowHeaderColumn"===l&&t.selection.enabled&&t.selection.allowRowHeaderSelection&&t.appearance.showRowHeaderSelectIcon&&(delete t._areAllRowsSelected,t.areAllRowsSelected()?t.clearSelection():t.selectAllRows(),o.refresh()),t.selection.allowColumnHeaderSelection&&o.allowSelect&&t._setSelection(null,o.dataField,e)}};if(t.editing.isEditing&&t.endEdit(),i("click"),t._mobile){t._hideActionButtons();const o=(o,l)=>{if(o&&o.autoShowActionButton){const a=l.getBoundingClientRect(),n=t.offset(l);if(n.left<=e.pageX&&n.left+a.width-6>=e.pageX){if(!t.hasColumnMenu(o))return;l._showActionButton()}else l._hideActionButton()}};for(let e=0;e<t._columnElements.length;e++){const l=t._columnElements[e];o(l.column,l)}}if(t.$.fireEvent("columnClick",{column:o,dataField:o.dataField}),n&&(t.$.fireEvent("columnDoubleClick",{column:o,dataField:o.dataField}),i("doubleClick"),t._onColumnDoubleClick(o,e)),Smart.Utilities.Core.isMobile){const o=t.rightToLeft?a.getBoundingClientRect().left:a.getBoundingClientRect().right,n=10;if(o-n<=e.clientX&&e.clientX<=o+n){const o=t.columnByDataField[l];if(!o||o&&!o.allowResize)return;const n=t._isLastVisibleColumn(o);if("split"===t.behavior.columnResizeMode&&n)return;a.style.cursor="col-resize",a.sortButton.style.cursor="col-resize",a.filterButton.style.cursor="col-resize",t._columnToResizeRect=t.getBoundingRect(a),t._columnToResizeElement=a,t._columnToResizeDataField=l,e.preventDefault(),e.originalEvent&&e.originalEvent.preventDefault()}}if(t._columnToResizeElement&&!t._columnResizeLine)return t._columnDownResizeHandler(e),void(t._clickTime=new Date);if(t._beginDrag(e,o),o.menu)return void(t._clickTime=new Date)}t.closeMenu(),t._clickTime=new Date}addTransformMoveStyle(e,t,o,l,a,n){e.style.opacity=n,e.style["transition-duration"]=t,e.style.transform="translate3d("+o+"px,"+l+"px,"+a+"px)"}removeTransformMoveStyle(e){e.style.opacity="",e.style["transition-duration"]="",e.style.transform=""}_rowDownHandler(e){const t=this;if(t._inputOverlay&&t._inputOverlay.classList.remove("smart-input-overlay-on"),t._doubleClickHandler(e),t._closeMenu(t.menu),t._rowResizeHandler(e),t._removeCellContentPopup(),t._toggledRow&&t.appearance.allowRowToggleAnimation)return;if(e.target&&!e.target.classList.contains("smart-grid-row-container")&&!e.target.classList.contains("smart-grid-selection-overlay")&&!e.target.classList.contains("smart-selection-overlay-content"))return;let o=e.clientX,l=e.clientY;e.touches&&(o=e.touches[0].clientX,l=e.touches[0].clientY);const a=(t.enableShadowDOM?t.shadowRoot:t.getRootNode()).elementsFromPoint(o,l);let n=null,i=null,r=null,s=null,d=null,u=null,c=null;t._lastPointerDownTime=new Date;for(let e=0;e<a.length;e++){const t=a[e];if(t.hasAttribute("toggle-button")&&(i=t),t.hasAttribute("add-row")&&(d=t),t.hasAttribute("checkbox")&&(r=t),t.hasAttribute("rating-value")&&(u=t),s||"smart-grid-cell"!==t.nodeName.toLowerCase()||(s=t),!c&&t.classList.contains("smart-card")&&(c=t),!n&&"smart-grid-row"===t.nodeName.toLowerCase()){n=t;break}}if("card"!==t.view){if(u&&(t._ratingElement=u),n&&s){const o=s?s.cell:null;if(o.row.filterRow||t._closeMenu(t.filterRowMenu),i&&o&&!o.column.rowDetailColumn&&i!==o.row.toggleDetailButton&&!i.classList.contains("row-detail"))n.row.toggle(e);else if(t.rowDetail.enabled&&t.rowDetail.visible&&i&&o&&o.column.rowDetailColumn){const e=n.row;t.editing.isEditing&&t.cancelEdit(),e.showDetail?t.hideDetail(e.id):t.showDetail(e.id)}else if(d){const e=n.row,o=e.data;let l=o.parent;const a={};for(a[o.groupDataField]=null!==e.label?e.label:null,void 0!==e.labelValue&&(a[o.groupDataField]=e.labelValue);l;){let e=null!==l.label?l.label:null;l.labelValue&&void 0!==e&&(e=l.labelValue),a[l.groupDataField]=e,l=l.parent}t.addRow(a),setTimeout((()=>{t._conditionalColors&&t._conditionalColors.update&&t._conditionalColors.update()}),100)}else{const o=n.row,l=s?s.cell:null;if(l.column._treeColumn&&r)return void(o.checked=!o.checked);l.element===o.header&&t.behavior.allowRowReorder&&t._beginDrag(e,o),t._tapTimer&&clearTimeout(t._tapTimer),t._tapTimer=setTimeout((function(){t._clickedRow===n&&t.$.fireEvent("rowTap",{row:o,id:o.id,originalEvent:e.originalEvent}),t._clickedCell===s&&t.$.fireEvent("cellTap",{cell:l,id:o.id,dataField:l.column.dataField,originalEvent:e.originalEvent})}),t.behavior.doubleClickTimingDelay);const a=function(a){if(!t.selection.enabled||o.autoGenerated||!0!==o.allowSelect)return void delete t.__selectionStarted;if(o.header&&"row-resize"===o.header.style.cursor){const a=t.offset(o.header);if(t._rowToResize&&a.left<=e.originalEvent.pageX&&e.originalEvent.pageX<=a.left+o.header.offsetWidth)return o.header.style.cursor="",void(t._rowToResize.onpointerup=()=>{const a=t.editing.isEditing;t._rowToResize.onpointerup=null,t._clickedRow===n&&!a&&!t._rowResizeLine&&l.column.rowHeaderColumn&&t.selection.allowRowHeaderSelection&&t._setSelection(o.id,l.column.dataField,e)});o.header.style.cursor=""}const i=t.editing.isEditing;if(i&&t.editing.editCell&&t.editing.editCell.row.id===o.id&&t.editing.editCell.column.dataField===l.column.dataField)return;if(i&&t.editing.editRow&&t.editing.editRow.id===o.id)return;const r=()=>{t.focus(),setTimeout((function(){t.focus()}),50)};if(t.selection.action===a){if(e.shiftKey||e.ctrlKey||e.metaKey||!t.selection.allowRowHeaderSelection&&l.column.autoGenerated?t._dragSelectionStartRow=null:t._dragSelectionStartRow=n.row,e.shiftKey||e.ctrlKey||e.metaKey?t._dragSelectionStartDataField=null:t._dragSelectionStartDataField=l.column.dataField,l.column.rowHeaderColumn&&!t.selection.allowRowHeaderSelection)return t._dragSelectionStartRow=null,void r();t._setSelection(o.id,l.column.dataField,e),r()}else(l.column.selectionColumn&&t.selection.checkBoxes.enabled&&t.selection.checkBoxes.action===a||l.column.rowHeaderColumn&&t.selection.allowRowHeaderSelection)&&(t._setSelection(o.id,l.column.dataField,e),r())},i=l.selected;t._clickTime||(t._clickTime=new Date);const d=t._clickedCell===s&&new Date-t._clickTime<t.behavior.doubleClickTimingDelay,u=e.originalEvent?e.originalEvent:e,c=3===u.which;if(c||"_commandColumn"===l.column.dataField||a("click"),t.$.fireEvent("rowClick",{row:o,id:o.id,data:t.getRowData(o.id),isRightClick:c,originalEvent:u,pageX:parseInt(u.pageX),pageY:parseInt(u.pageY)}),t.$.fireEvent("cellClick",{cell:l,id:o.id,dataField:l.column.dataField,value:l.value,isRightClick:c,originalEvent:u,pageX:parseInt(u.pageX),pageY:parseInt(u.pageY)}),c&&t.contextMenu.enabled)return t.contextMenu.id=o.id,t.contextMenu.dataField=l.column.dataField,t._focusCell(o.id,l.column.dataField),t.openContextMenu(u.pageX+10,u.pageY+10),void(t.contextMenu.selector&&(u.stopPropagation(),u.preventDefault()));if(o.autoGenerated||l.column.autoGenerated||"checkBox"===l.template&&e.originalEvent&&e.originalEvent.target&&e.originalEvent.target.classList.contains("smart-input"))t._onRowClick(o.index,o,e),t._onCellClick(l,e);else if(t.selection.enabled)if(t.selection.allowCellSelection)if("extended"===t.selection.mode){if(!0===i&&i===l.selected&&!t.selection.isDragging){const a=t._selection.focusedCell;a&&t._clickedCell&&a.id===l.row.id&&a.dataField===l.column.dataField&&a.id===t._clickedCell.cell.row.id&&a.dataField===t._clickedCell.cell.column.dataField&&(t._onRowClick(o.index,o,e),t._onCellClick(l,e))}}else d||(t._onRowClick(o.index,o,e),t._onCellClick(l,e));else if(t.selection.allowRowSelection)if("extended"===t.selection.mode){if(!0===i&&i===l.selected&&!t.selection.isDragging){const a=t._selection.focusedCell;t._clickedCell&&a.id===l.row.id&&a.id===t._clickedCell.cell.row.id&&(t._onRowClick(o.index,o,e),t._onCellClick(l,e))}}else d||(t._onRowClick(o.index,o,e),t._onCellClick(l,e));else t._onRowClick(o.index,o,e),t._onCellClick(l,e);else t._onRowClick(o.index,o,e),t._onCellClick(l,e);new Date-t._clickTime<t.behavior.doubleClickTimingDelay&&(t._clickedRow===n&&(t._onRowDoubleClick(o.index,o,e,e),t.$.fireEvent("rowDoubleClick",{row:o,id:o.id,data:t.getRowData(o.id),isRightClick:c,originalEvent:e.originalEvent,pageX:parseInt(u.pageX),pageY:parseInt(u.pageY)}),a("doubleClick")),t._clickedCell===s&&(t._onCellDoubleClick(l,e),t.$.fireEvent("cellDoubleClick",{cell:l,id:o.id,dataField:l.column.dataField,value:l.value,isRightClick:c,originalEvent:e.originalEvent,pageX:parseInt(u.pageX),pageY:parseInt(u.pageY)}))),t._clickedRow=n,t._clickedCell=s,t._clickTime=new Date,t.layout.allowCellsWrapShortcut&&t._clickedCell.hasAttribute("focus")&&t._clickedCell.hasAttribute("selected")&&e.shiftKey&&(t._cellContentPopupTimer&&clearTimeout(t._cellContentPopupTimer),t.selection.isDragging?t._removeCellContentPopup():l.autoWrap())}}}else if(c){const o=c.getAttribute("row-id"),l=t.rowById[o];if(l){const a=e.originalEvent?e.originalEvent:e,n=3===a.which;if(l.element||l.createElement(),t.$.fireEvent("rowClick",{row:l,id:l.id,data:t.getRowData(l.id),isRightClick:n,originalEvent:a,pageX:parseInt(a.pageX),pageY:parseInt(a.pageY)}),s){const e=s.getAttribute("data-field");if(e){const o=t.columnByDataField[e],i=new Smart.Grid.Cell(l,o,this);s.cell=i,i.element=s,i&&t.$.fireEvent("cellClick",{cell:i,id:l.id,dataField:i.column.dataField,value:i.value,isRightClick:n,originalEvent:a,pageX:parseInt(a.pageX),pageY:parseInt(a.pageY)})}}const i=e.originalEvent.target;if(c.classList.contains("smart-card-header"))l.element&&l.element.row!==l&&(l.element.row=l),l.toggle();else if(l.children&&l.children.length>0&&(i.classList.contains("smart-icon-ungroup")||i.classList.contains("smart-icon-group")))l.element&&l.element.row!==l&&(l.element.row=l),l.toggle();else if(t.editing.enabled){const l=t.editing.dialog.enabled,a=t.editing.mode;if(i.scrollHeight>i.offsetHeight){const o=t.offset(i);if(e.originalEvent.pageX>=o.left+i.offsetWidth-15)return}const n=t.context;t.context=t,t.editing.dialog.enabled=!0,t.editing.mode="row",t._settingsDialogRowId=o;let r=t._isUpdating;c.setAttribute("edit",""),t.beginEdit(o),t._isUpdating=r,t._endCardRowEdit?(t.removeEventListener("endEdit",t._endCardRowEdit,null),t.removeEventListener("cancelEdit",t._endCardRowEdit,null)):t._endCardRowEdit=()=>{t.context=t,t.editing.dialog.enabled=l,t.editing.mode=a,t.editing.isEditing=!1,t.context=n,delete t._settingsDialogRowId,delete t._dialogEdit},t.addEventListener("endEdit",t._endCardRowEdit),t.addEventListener("cancelEdit",t._endCardRowEdit)}}}}showDetail(e){const t=this.rowById[e];t&&(t.showDetail=!0)}hideDetail(e){const t=this.rowById[e];t&&(t.showDetail=!1)}_focusHandler(){this._focused=!0,this.setAttribute("focus","")}_blurHandler(){this._focused=!1,this.removeAttribute("focus")}_notify(e,t,o){const l=this;if(l.notifyFn)for(let a=0;a<l.notifyFn.length;a++)l.notifyFn[a](e,t,o)}notify(e){const t=this;e&&(t.notifyFn||(t.notifyFn=[]),t.notifyFn.push(e))}_applyTemplate(e,t){let o=null;if(null!==e&&""!==e)if(e&&"function"==typeof e)e(t);else if((e.startsWith("#")||e.startsWith("."))&&(o=document.querySelector(e)),o)t.innerHTML="",o instanceof HTMLElement&&!(o instanceof HTMLTemplateElement)?t.appendChild(o):t.appendChild(o.content.cloneNode(!0).firstElementChild);else{const o=function(e){const t=document.createElement("template");return e=e.trim(),t.innerHTML=e,t.content.firstChild}(e);o&&(t.innerHTML="",t.appendChild(o))}else t.innerHTML=""}propertyChangedHandler(e,t,o){const l=this;if(l.isInitialized){switch(l._notify(e,t,o),e){case"onRowHistory":case"onRowInserted":case"stateSettings_current":return;case"highlighted":"kanban"===l.view&&l._kanban&&(l._kanban.selectTask(o),l._kanban.ensureVisible(o));break;case"view":return void(l.$.headerBar&&l.$.headerBar._setView&&l.$.headerBar._setView(o,!0));case"users":case"currentUser":l._refreshCurrentUser(),l._recycle();break;case"summaryRow_visible":{for(let e=0;e<l.columns.length;e++)l._summaryRowCount=Math.max(l._summaryRowCount,l.columns[e].summary.length);const e=l.onRowInserted;l.onRowInserted=null,l._renderRows(!0),l.onRowInserted=e;break}case"conditionalFormatting":return l._renderConditionalFormatting(),void l.refresh();case"appearance_displayLoadingIndicator":return void l._setLoadingIndicatorVisibility();case"appearance_placeholder":return void(l.$.placeholder.innerHTML=o);case"appearance_showColumnHeaderLines":case"appearance_showColumnGroupLines":case"appearance_showColumnLines":case"appearance_showRowLines":return void l._recycle();case"appearance_allowColumnStickyPosition":o?l._stickHeader():l._unstickHeader();break;case"appearance_showColumnIcon":for(let e=0;e<l.columns.length;e++)l.columns[e].setProperty("showIcon",l.appearance.showColumnIcon);l._recycle();break;case"appearance_showRowHeaderNumber":case"appearance_showRowHeader":{l._initializeRowNumberColumn();const e=l._frozenNearColumns[0];e.rowHeaderColumn&&e.element&&!e.element.parentNode&&l.$.columnNearContainer.appendChild(e.element),l.refresh();break}case"header_visible":if(l.header.visible&&""===l.header.template){let e=l.$.header;l.header.appendTo&&(e=document.querySelector(l.header.appendTo),e?e.onclick=e=>{l._headerClickHandler(e)}:e=l.$.header),e.innerHTML='<smart-grid-toolbar header-position="top"></smart-grid-toolbar>',l.$.headerBar=e.firstElementChild,l.$.headerBar._init(l),l.header.onInit&&l.header.onInit(l.$.headerBar)}break;case"header_buttons":l.header.visible&&""===l.header.template&&l._refreshHeaderBar();break;case"header_template":l._applyTemplate(o,l.$.header);break;case"footer_template":l._applyTemplate(o,l.$.footer);break;case"layout_columnWidth":case"columnWidth":{l.columns.canNotify=!1;let e=parseInt(o);if(isNaN(e)&&(e=null),e>=30||null===e)for(let t=0;t<l.columns.length;t++)l.columns[t].width=e;l.columns.canNotify=!0,l.refresh();break}case"checkBoxes_visible":return void l._recycle();case"checkBoxes_hasThreeStates":return l.rows.canNotify=!1,l._applyThreeStates(l.rowHierarchy),l.rows.canNotify=!0,void l._recycle();case"columnHeader_visible":l.__columnHeaderHeight=null,l.refresh();break;case"selection_checkBoxes_enabled":l._selectionColumn.visible=o;break;case"selection_checkBoxes_autoShow":l._selectionColumn.element&&(o?l._selectionColumn.element.setAttribute("auto-show",""):l._selectionColumn.element.removeAttribute("auto-show"));break;case"selection_checkBoxes_position":{let e=l.viewColumns.indexOf(l._selectionColumn);l.viewColumns.canNotify=!1,l.viewColumns.splice(e,1);const t=l._frozenNearColumns.indexOf(l._selectionColumn),a=l._frozenFarColumns.indexOf(l._selectionColumn);if(t>=0&&l._frozenNearColumns.splice(t,1),a>=0&&l._frozenFarColumns.splice(a,1),"far"===o)l._selectionColumn.canNotify=!1,l._selectionColumn.freeze="far",l._selectionColumn.canNotify=!0,l._frozenFarColumns.splice(0,0,l._selectionColumn),l.viewColumns.push(l._selectionColumn),l.$.columnFarContainer.appendChild(l._selectionColumn.element);else{let e=0,t=0;for(let o=0;o<l.viewColumns.length&&(l.viewColumns[o].autoGenerated||l.viewColumns[o].dataField!==l.columns[t++].dataField);o++)l.viewColumns[o].autoGenerated&&e++;l._selectionColumn.canNotify=!1,l._selectionColumn.freeze="near",l._selectionColumn.canNotify=!0,l._frozenNearColumns.splice(e,0,l._selectionColumn),l.viewColumns.splice(e,0,l._selectionColumn),l.$.columnNearContainer.appendChild(l._selectionColumn.element)}l.viewColumns.canNotify=!0;break}case"selection_mode":if(l._selection&&(l._selection.focusedCell=null),l.selection.allowCellSelection)l.clearSelection();else if("one"===o){const e=l.getSelection();if(l.clearSelection(),e.rows&&e.rows[0]){e.rows[0].row.selected=!0;const t=l.rowById[e.rows[0].row.id].getCell(l.columns[0].dataField);l._selection.focusedCell={id:t.row.id,dataField:t.column.dataField,value:t.value,index:t.row.index}}}break;case"grouping_groupBy":return l.dataSource&&l.dataSource.groupBy&&(l.dataSource.groupBy=o),void l.refresh();case"sorting_enabled":return void l.refresh();case"sorting_maintainSort":return void l._recycle(!1);case"filtering_enabled":return o&&0===l._filterPanels.length&&l._createFilterPanels(),void(l.header.visible&&l.refresh());case"filtering_filterRow_visible":return l._initializeRows(),l._initializeRowElements(),void l.refresh();case"filtering_operator":return void l.refreshFilters();case"filtering_filter":for(let e=0;e<l.columns.length;e++){const t=l.columns[e];t.canNotify=!1,t.setProperty("filter",null),t.canNotify=!0}for(let e=0;e<l.filtering.filter.length;e++){const t=l.filtering.filter[e];if(t&&t.splice){const e=t[0],o=t.splice(1);let a=null;if(o instanceof Smart.FilterGroup)a=o;else{const t=l.columnByDataField[e];t&&(a=l.dataSource._createFilter(t.dataType,o))}a&&l.addFilter(e,a,!1)}}return void l.refreshFilters();case"messages":case"locale":{if(l.columns)for(let e=0;e<l.columns.length;e++)l.columns[e]._cellsCachedValues=[];l._dialogEdit&&(l._dialogEdit.close(),l._dialogEdit=null),l._dialogDelete&&(l._dialogDelete.close(),l._dialogDelete=null),l._dialogAddRow&&(l._dialogAddRow.close(),l._dialogAddRow=null);const e=l.$.headerPager.querySelector("smart-pager"),t=l.$.footerPager.querySelector("smart-pager");e&&(e.locale=l.locale),t&&(t.locale=l.locale);const o=(e,t)=>{l._handleFilterMenuClick(e,t)};l._filterInfo||(l._filterInfo={}),l._filterInfo.stringConditions=[{icon:"smart-icon-contains",command:o,value:"CONTAINS",label:l.localize("CONTAINS")},{icon:"smart-icon-does-not-contain",command:o,value:"DOES_NOT_CONTAIN",label:l.localize("DOES_NOT_CONTAIN")},{icon:"smart-icon-starts-with",command:o,value:"STARTS_WITH",label:l.localize("STARTS_WITH")},{icon:"smart-icon-ends-with",command:o,value:"ENDS_WITH",label:l.localize("ENDS_WITH")},{icon:"smart-icon-equals",command:o,value:"EQUAL",label:l.localize("EQUAL")},{icon:"smart-icon-delete",command:o,value:"CLEAR_FILTER",label:l.localize("CLEAR_FILTER")}],l._filterInfo.numberAndDateConditions=[{icon:"smart-icon-equals",command:o,value:"EQUAL",label:l.localize("EQUAL")},{icon:"smart-icon-not-equal",command:o,value:"NOT_EQUAL",label:l.localize("NOT_EQUAL")},{icon:"smart-icon-less-than",command:o,value:"LESS_THAN",label:l.localize("LESS_THAN")},{icon:"smart-icon-less-than-equal",command:o,value:"LESS_THAN_OR_EQUAL",label:l.localize("LESS_THAN_OR_EQUAL")},{icon:"smart-icon-greater-than",command:o,value:"GREATER_THAN",label:l.localize("GREATER_THAN")},{icon:"smart-icon-greater-than-equal",command:o,value:"GREATER_THAN_OR_EQUAL",label:l.localize("GREATER_THAN_OR_EQUAL")},{icon:"smart-icon-between",command:o,value:"RANGE",label:l.localize("RANGE")},{icon:"smart-icon-delete",command:o,value:"CLEAR_FILTER",label:l.localize("CLEAR_FILTER")}],l._refreshHeaderBar(),l.$.headerBar&&(l.$.headerBar.messages=l.messages,l.$.headerBar.locale=l.locale,l.$.headerBar._localizeHeader(),l.$.headerBar._getInnerElementMessages()),l.grouping.groupBar.visible&&l._renderGroupBar(),l._recycle();break}case"paging_spinner_enabled":l._refresh();break;case"pager_visible":return l._renderPagers(),void l._refreshPaging(!1);case"paging_pageIndex":case"pager_position":case"paging_enabled":return void l._refreshPaging(!0);case"paging_pageSize":return void l._refreshPaging(!1);case"columns":{l.__measuredColumnHeight=null,l.editing&&l.editing.isEditing&&l.cancelEdit(),l._cellEditors=[];let e=!1;if(t&&t.length)for(let o=0;o<t.length;o++)if(t[o].freeze){e=!0;break}if(l.columns&&l.columns.length)for(let t=0;t<l.columns.length;t++)if(l.columns[t].freeze){e=!0;break}if(e&&l._initializeRowElements(),l.columns&&l._sortedColumns){const e=[];l.columns.forEach((t=>{t.sortOrder&&e.push(t)})),l._sortedColumns=JSON.parse(JSON.stringify(e))}l._renderColumns(),l._refreshHeaderBar();const o=l._sortedColumns;if(o){l.clearSort();for(let e=0;e<l.columns.length;e++)delete l.columns[e]._cellsCachedValues;l._refreshSort(o)}if(l.columns&&l.filtering.enabled){l.beginUpdate();for(let e=0;e<l.columns.length;e++){const t=l.columns[e];if(t.canNotify=!1,l.removeFilter(t.dataField),t.filtered=!1,t.canNotify=!0,t.filter){let e=null,o=t.filter;e=o instanceof Smart.FilterGroup?o:l.dataSource._createFilter(t.dataType||"string",o),e&&l.addFilter(t.dataField,e,!1)}}l.refreshFilters(),l.endUpdate()}return l.layout.isDirty=!0,l._resetCachedLayout(),void l._refreshLayout()}case"columnGroups":if(l._columnGroups=[],l._columnHeights=0,l.viewColumns)for(let e=0;e<l.viewColumns.length;e++){const t=l.viewColumns[e],o=t.element;t.top=0,t.level=0,o&&(o.style.top="",o.style.height="",o.style.lineHeight="")}return l.columns.canNotify=!1,l.columns=l._initColumns,l._renderColumns(),l.columns.canNotify=!0,l.__columnHeaderHeight=null,void l.refresh();case"dataSource":if(delete l._isFirstVirtualDataSourceRequest,"dataSource"===e&&t&&o){const e=l.dataSource&&l.dataSource.virtualDataSource&&!l.dataSource.virtualDataSourceOnExpand&&"infinite"!==l.scrolling;if(t instanceof Smart.DataAdapter&&!e&&t.length===o.length&&t.length>0&&o.length>0&&!l.dataSourceSettings.childrenDataField&&!l.dataSourceSettings.parentDataField&&!t.parentDataField){if(l.dataSource=t,l._cachedDataSource===o)return;return setTimeout((()=>{let e=null;if(t&&l.dataSource&&l.dataSource._expandedRowIds){let t={};for(let e in l.dataSource._expandedRowIds){let o=""+e;o=o.replace("Item","").replace(/_/gi,"."),t[o]=!0}e=t}if(l.beginUpdate(),l._sortedColumns&&l._sortedColumns.length>0&&void 0===l._getId())for(let e=0;e<o.length;e++){const t=l.dataSource[e],a=o[e];l._updateRow(t,a,!0)}else for(let e=0;e<o.length;e++){const t=o[e],a=l.dataSource[e].$.id;l._updateRow(a,t,!0)}delete l.__autoRowHeight,l._virtualOnExpandCache=[],l._cellsMerge=[],l._cellStyles=[];const a=l._filters,n=l._sortedColumns;if(l.clearSort(),l.filtering.filterRow)for(let e=0;e<l.columns.length;e++)l.columns[e]._filterEditorInitialized=!1;for(let e=0;e<l.columns.length;e++)delete l.columns[e]._cellsCachedValues;if(n&&l._refreshSort(n),a&&a.length>0&&(l._filters=null,l.refreshFilters()),l.grouping.enabled)for(let t in e)l._expandCollapseGroup(t,!0);l.endUpdate()})),l._cachedDataSource=o,void(l.header.visible&&""===l.header.template&&l.$.headerBar._init(l))}}return l.dataSource.length>1e4?(l.appearance.displayLoadingIndicator=!0,l._setLoadingIndicatorVisibility(),setTimeout((()=>{l.dataBind()}),100),setTimeout((()=>{l.appearance.displayLoadingIndicator=!1,l._setLoadingIndicatorVisibility(),l._recycle(!1)}),200)):(l.dataSource&&l.dataSource instanceof Smart.DataAdapter&&l.columns&&l.dataSource.dataFields&&l.dataSource.dataFields.forEach((e=>{const t=l.columnByDataField[e.name];t&&(t.dataType=e.dataType)})),l.dataBind()),void(l.header.visible&&""===l.header.template&&l.$.headerBar._init(l));case"rowDetail_dialog_width":case"rowDetail_dialog_height":case"rowDetail_dialog_enabled":case"rowDetail_dialog_visible":return;case"rowDetail_height":case"rowDetail_enabled":{l.beginUpdate(),l.rows.canNotify=!1;const e=l.appearance.allowRowDetailToggleAnimation;l.appearance.allowRowDetailToggleAnimation=!1;for(let e=0;e<l._recyclingRows.length;e++){const t=l._recyclingRows[e];t.height=null,t.setProperty("showDetail",!1),t.detailHeight=l.rowDetail.height}if(l.rows.canNotify=!0,l.rowDetail.enabled){let t=!1;for(let e=0;e<l.viewColumns.length;e++)if(l.viewColumns[e].rowDetailColumn){t=!0;break}if(!t)return l.appearance.allowRowDetailToggleAnimation=e,l.endUpdate(),void l._renderColumns(!0)}else for(let e=0;e<l.viewColumns.length;e++){const t=l.viewColumns[e];if(t.rowDetailColumn){t.visible=!1;break}}return l.appearance.allowRowDetailToggleAnimation=e,void l.endUpdate()}case"rowDetail_visible":for(let e=0;e<l.viewColumns.length;e++){const t=l.viewColumns[e];if(t.rowDetailColumn){t.visible=o;break}}return;case"displayLoadingIndicator":return void l._setLoadingIndicatorVisibility();case"filterable":return void l._refreshLayout();case"layout_allowCellsWrap":{const e=l.columns.canNotify;l.columns.canNotify=!1;for(let e=0;e<l.columns.length;e++)l.columns[e].cellsWrap=o;return l.layout.isDirty=!0,l._resetCachedLayout(),l._refreshLayout(),l.refresh(),void(l.columns.canNotify=e)}case"showViewBar":return l.layout.isDirty=!0,l._resetCachedLayout(),l._refreshLayout(),void l.refresh();case"layout_autoHeight":case"layout_autoWidth":case"layout_columnMinHeight":case"layout_rowMinHeight":case"layout_columnHeight":case"layout_rowHeight":return l.layout.isDirty=!0,l._resetCachedLayout(),l._refreshLayout(),void l.refresh();case"rightToLeft":return void l.refresh();case"selectionMode":return;case"editing_addNewColumn_visible":l._addNewColumn?(l._addNewColumn.visible=o,l.refresh()):l._renderColumns();break;case"editing_addNewRow_displayMode":{"row"===l.editing.addNewRow.displayMode&&l.editing.addNewRow._addButton&&(l.editing.addNewRow._addButton.remove(),delete l.editing.addNewRow._addButton);const e=l._scrollView.vScrollBar;return e.style.height="",e.style.top="",e.style.setProperty("--smart-scroll-bar-near-size","0px"),l._renderAddNewRow(),void l.refresh(!0)}case"editing_addNewRow_label":case"editing_addNewRow_visible":case"editing_addNewRow_position":return!1===l.editing.addNewRow.visible&&"button"===l.editing.addNewRow.displayMode&&(l.editing.addNewRow._addButton&&l.editing.addNewRow._addButton.remove(),l._newRow&&l._newRow.element.classList.add("smart-hidden")),l._renderAddNewRow(),void l.refresh();case"editing_enabled":o?l.removeAttribute("aria-readonly"):l.setAttribute("aria-readonly",!0);break;case"editing_dialog_visible":return;case"editing_commandBar_dataSource_commandBarAddRow_visible":case"editing_commandBar_dataSource_commandBarDeleteRow_visible":case"editing_commandBar_dataSource_commandBarBatchSave_visible":case"editing_commandBar_dataSource_commandBarBatchRevert_visible":case"editing_commandBar_visible":case"editing_commandBar_displayMode":case"editing_commandBar_position":l._renderCommandBar();break;case"editing_commandColumn_position":l._renderColumns(!0);break;case"editing_commandColumn_visible":return void l.refresh(!0);case"editing_commandColumn_inline":return l._commandColumn.visible=l.editing.commandColumn.visible&&!l.editing.commandColumn.inline,void l.refresh(!0);case"layout_isDirty":return;case"editing_commandColumn_dataSource_commandColumnCustom_label":case"editing_commandColumn_dataSource_commandColumnCustom_icon":case"editing_commandColumn_dataSource_commandColumnCustom_visible":case"editing_commandColumn_dataSource_commandColumnUpdate_label":case"editing_commandColumn_dataSource_commandColumnUpdate_icon":case"editing_commandColumn_dataSource_commandColumnUpdate_visible":case"editing_commandColumn_dataSource_commandColumnEdit_label":case"editing_commandColumn_dataSource_commandColumnEdit_icon":case"editing_commandColumn_dataSource_commandColumnEdit_visible":case"editing_commandColumn_dataSource_commandColumnDelete_label":case"editing_commandColumn_dataSource_commandColumnDelete_icon":case"editing_commandColumn_dataSource_commandColumnDelete_visible":case"editing_commandColumn_displayMode":return delete l.__cellsCommandTemplate,void l.refresh(!0)}l.refresh()}}ready(){super.ready();const e=this;e._renderInDropDown();const t=e._scrollView.vScrollBar,o=e._scrollView.hScrollBar;t.hasStyleObserver=!1,o.hasStyleObserver=!1,t.hasResizeObserver=!1,o.hasResizeObserver=!1,t.wait=!1,o.wait=!1,t.onChange=e._verticalScrollbarHandler.bind(e),o.onChange=e._horizontalScrollbarHandler.bind(e),e.setFocusable(!0),e.$.loadingIndicatorPlaceholder.innerHTML=e.messages[e.locale]&&e.messages[e.locale].loadingIndicatorPlaceholder?e.localize("loadingIndicatorPlaceholder"):e.appearance.loadingIndicatorPlaceholder,e.$.placeholder.innerHTML=e.messages[e.locale]&&e.messages[e.locale].placeholder?e.localize("placeholder"):e.appearance.placeholder,e._setLoadingIndicatorVisibility(),e._cellsMerge=[],e._cellStyles=[],e.checkLicense()}_createFilterPanels(){const e=this;if(e._filterPanels){if(e._filterPanels.length>0)return}else e._filterPanels=[];e.filtering.enabled&&0===e._filterPanels.length&&requestAnimationFrame((()=>{const t=document.createElement("smart-filter-panel"),o=document.createElement("smart-filter-panel"),l=document.createElement("smart-filter-panel"),a=document.createElement("smart-filter-panel");o.filterType="boolean",l.filterType="numeric",a.filterType="date",e._filterPanels.bool=o,e._filterPanels.date=a,e._filterPanels.numeric=l,e._filterPanels.string=t;for(let t in e._filterPanels){const o=e._filterPanels[t];o.rightToLeft=e.rightToLeft,o.classList.add("smart-hidden"),e.$.content.appendChild(o),o.parentNode.removeChild(o)}}))}_applyScrolling(){const e=this,t=e._scrollView.vScrollBar;requestAnimationFrame((()=>{switch(t.largeStep=e.$.scrollView.offsetHeight,e.scrolling){case"physical":case"infinite":case"virtual":t.step=e.layout.rowMinHeight,t.mechanicalAction="switchWhileDragging";break;case"deferred":t.step=10,t.mechanicalAction="switchWhenReleased";break;case"logical":t.step=e.layout.rowMinHeight,t.mechanicalAction="switchWhileDragging"}}))}_measureRowElement(e){const t=new Smart.Grid.Row({data:e,index:999999,grid:this});if(!t)return null;const o=t.createElement();return o.classList.add("smart-grid-measure-row"),this.$.scrollView.appendChild(o),o.style.height="",o.style.lineHeight="",o.style.height="",o.style.lineHeight="",t._isMeasureRow=!0,t.render(),o}get _autoRowHeight(){const e=this;if(e.__autoRowHeight)return e.__autoRowHeight;let t=e.layout.rowMinHeight;if(!e.dataSource||e.dataSource&&0===e.dataSource.length)return t;const o=new Smart.Grid.Row({index:0,grid:e}),l=o.createElement();e.$.scrollView.appendChild(l),e.removeAttribute("grouped"),e.removeAttribute("tree"),e.grouping.enabled&&e.dataSource.groupBy&&e.dataSource.groupBy.length>0?e.setAttribute("grouped",""):e.dataSource.boundHierarchy&&e.setAttribute("tree","");const a={};for(let t=0;t<e.dataSource.dataFields.length;t++)a[e.dataSource.dataFields[t].name]="ABCDEFHIJLMNOPQRSTUVWXYZ1234567910|";o.data=a,o._isMeasureRow=!0,o.render(),l.style.height="",l.style.lineHeight="",t=Math.max(l.offsetHeight,t);for(let e=0;e<l.children.length;e++)l.children[e].style.height="";for(let a=0;a<l.children[1].children.length;a++){if(l.children[1].children[a].style.height="auto",e.columns[0]){const t=o.getCell(e.columns[0].dataField);t&&t.render()}t=Math.max(t,8+l.children[1].children[a].offsetHeight);break}return e.$.scrollView.removeChild(l),e.__autoRowHeight=t,e.layout.rowMinHeight&&t<e.layout.rowMinHeight&&(e.__autoRowHeight=e.layout.rowMinHeight),t}get _scrollHeight(){const e=this,t="card"===e.view;let o=e._recyclingRows,l=0,a=e._autoRowHeight,n=0,i=0;if(e.__scrollHeight)return e.__scrollHeight;if(0===o.length||0===e.columns.length||!e.hasVisibleColumn())return 0;let r=40,s=1,d=0;if(t){for(let t=0;t<e.viewColumns.length;t++){const o=e.viewColumns[t];o.visible&&!o.autoGenerated&&(r+=e.layout.cardRowMinHeight,d++,o.cardHeight&&(r-=e.layout.cardRowMinHeight,r+=o.cardHeight*e.layout.cardRowMinHeight))}let t=e.offsetWidth;!e.appearance.showViewBar||e.appearance.viewBarAppendTo||e.appearance.showViewBarAsDropdown||(t-=e.layout.viewBarWidth+5),s=t<e.layout.cardMinWidth?1:"auto"===e.layout.cardsPerRow?Math.floor(t/e.layout.cardMinWidth):e.layout.cardsPerRow,1===s&&(r+=5*d),e._cardHeight=r}e._cardsPerRow=s,e.rows.canNotify=!1;const u=e._measureRowElement(o[0].data),c=o.length;for(let s=0;s<c;s++){let d=o[s];if(!d.visible||!1===d.filtered){d.height=0,d.cellHeight=0,d.top=l;continue}const c=e.rowDetail.enabled&&d.showDetail&&!e.rowDetail.dialog.enabled;let m=!d.height||!d.cellHeight||c||"auto"===d.height||"auto"===d._height||"auto"===e.layout.rowHeight||e.layout.isDirty;if(t&&d.height!==r&&(d.height=d.cellHeight=r),m&&!d.expandHeight){if(d.detailHeight||(d.detailHeight=200),t)d.height=d.cellHeight=r;else if(e.layout.rowHeight){if(e.layout.rowHeight)if("number"==typeof e.layout.rowHeight)e.layout.rowHeight<e.layout.rowMinHeight&&(e.layout.rowHeight=e.layout.rowMinHeight),d.height=e.layout.rowHeight,d.computedHeight&&(d.height=d.computedHeight),d.minHeight>d.height&&(d.height=d.minHeight),void 0!==d.label&&"advanced"===e.grouping.renderMode&&(d.height=e.grouping.groupRowHeight),d.cellHeight=d.height,e.rowDetail.enabled&&d.showDetail&&!e.rowDetail.dialog.enabled&&(d.height+=d.detailHeight);else if("auto"===e.layout.rowHeight){e.layout.rowHeight<e.layout.rowMinHeight&&(e.layout.rowHeight=e.layout.rowMinHeight),d.element=u,d.grid=e,d.element&&d.element.classList.contains("smart-hidden")&&d.element.classList.remove("smart-hidden");const t=d.data&&e.isRendered?d._autoSize(d):a,o=d.canNotify;d.canNotify=!1,d.height=t,d.computedHeight&&(d.height=d.computedHeight),void 0!==d.label&&"advanced"===e.grouping.renderMode&&(d.height=e.grouping.groupRowHeight),d.cellHeight=d.height,e.rowDetail.enabled&&d.showDetail&&!e.rowDetail.dialog.enabled&&(d.height+=d.detailHeight),d.canNotify=o}else e.layout.rowHeight(s,d),d.height||(d.height=a),d.cellHeight=d.height,e.rowDetail.enabled&&d.showDetail&&!e.rowDetail.dialog.enabled&&(d.height+=d.detailHeight)}else{if("auto"===d.height||"auto"===d._height){d.element=u,d.element&&d.element.classList.contains("smart-hidden")&&d.element.classList.remove("smart-hidden");const t=d.data&&e.isRendered?d._autoSize(d):a;d.height=t,d._height="auto"}else d.height=a;void 0===d.label||d.summaryRow||"advanced"!==e.grouping.renderMode||(d.height=e.grouping.groupRowHeight),d.computedHeight&&(d.height=d.computedHeight),d.cellHeight=d.height,e.rowDetail.enabled&&d.showDetail&&!e.rowDetail.dialog.enabled&&(d.height+=d.detailHeight)}e._rowGap&&s<e.rows.length-1&&(d.height+=e._rowGap)}!t&&(!0===d.freeze||"near"===d.freeze?d.visible&&(n+=d.height):"far"===d.freeze&&d.visible&&(i+=d.height),d.freeze&&d.visible)?d.top=l:(d.top!==l&&(d.top=l),d.expandHeight?l+=d.cellHeight:l+=d.height)}if(e._summaryRowCount&&e.summaryRow.visible&&(l+=1*a),e.editing.addNewRow&&"button"===e.editing.addNewRow.displayMode&&(l+=1*a),e.filtering&&e.filtering.filterRow.visible&&(n+=a),e.editing.addNewRow&&"button"!==e.editing.addNewRow.displayMode&&e.rowHierarchy&&e.editing.addNewRow.visible&&(l+=a,"far"!==e.editing.addNewRow.position&&(n+=a)),e.dataSource&&e.dataSource.virtualDataSource&&!1===e.paging.enabled){let t=e.dataSource.length>e.virtualModeCachedRowsCount?e.virtualModeCachedRowsCount:e.dataSource.length;"infinite"===e.scrolling&&(t=e.dataSource.length),"virtual"===e.scrolling&&t>=e.virtualModeCachedRowsCount&&(l=e.rows[0]?e.rows[0].height*e.dataSource.length:e.layout.rowMinHeight*e.dataSource.length)}return t&&(l=r*Math.ceil(o.length/s)),e.__scrollHeight=l,e.__frozenNearHeight=n,e.__frozenFarHeight=i,e._scrollView.scrollHeight=l-e.$.scrollView.offsetHeight+n+i,l=e.__scrollHeight+n+i-1,e.grouping.enabled&&e.dataSource.groupBy.length>0&&e.grouping.groupIndent>0&&"advanced"===e.grouping.renderMode&&(l+=parseInt(e.grouping.groupIndent/2)),e.__scrollHeight=l,u.remove(),o[0]&&delete o[0]._isMeasureRow,e.rows.canNotify=!0,l}_measureColumnHeight(){const e=this;if(e.__measuredColumnHeight)return e.__measuredColumnHeight;const t=document.createElement("smart-grid-column");t.style.height="auto",t.style.position="static";const o=document.createElement("div");o.classList.add("smart-label"),o.innerHTML="aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRwWxXyYzZ1234567890",t.appendChild(o),e.$.columnHeader.appendChild(t);let l=e.$.columnHeader.offsetHeight;return e.$.columnHeader.removeChild(t),e._columnHeights&&e._columnHeights.length>1&&(l=e._columnHeights[0]),l<e.layout.columnMinHeight&&(l=e.layout.columnMinHeight),e.__measuredColumnHeight=l,l}_initializeColumnGroupsHierarchy(){const e=this;let t=0;e.$.columnContainer.innerHTML="";const o=JSON.parse(JSON.stringify(e.columnGroups));if(o.length>0){for(let t=0;t<o.length;t++)o[t].parent=null,o[t].groups=null,o[t].labelTemplate=e.columnGroups[t].labelTemplate;for(let t=0;t<e.viewColumns.length;t++)e.viewColumns[t].parent=null,e.viewColumns[t].groups=null;const l=function(e){for(let t=0;t<o.length;t++){let l=o[t];if(l.name===e)return l}return null},a=function(e){let t=new Array;if(e.columnGroup&&t.push(e),e.groups)for(let o=0;o<e.groups.length;o++)if(e.groups[o].columnGroup)t.push(e.groups[o]);else if(e.groups[o].groups){let l=a(e.groups[o]);for(let e=0;e<l.length;e++)t.push(l[e])}return t};for(let e=0;e<o.length;e++){let t=o[e];if(t.groups||(t.groups=null),t.parentGroup){let e=l(t.parentGroup);e&&(t.parent=e,e.groups||(e.groups=new Array),-1===e.groups.indexOf(t)&&e.groups.push(t))}}for(let t=0;t<e.viewColumns.length;t++){let o=e.viewColumns[t];if(o.columnGroup){let e=l(o.columnGroup);e&&(e.groups||(e.groups=new Array),o.parent=e,-1===e.groups.indexOf(o)&&e.groups.push(o))}}for(let o=0;o<e.viewColumns.length;o++){const l=e.viewColumns[o];let a=l;for(l.level=0;a.parent;)a=a.parent,l.level++;a=l;let n=l.level;for(t=Math.max(t,l.level);a.parent;)a=a.parent,a&&(a.level=--n)}for(let t=0;t<o.length;t++){const l=o[t],n=a(l);l.columns=n;let i=new Array,r=0,s="near";0===n.length&&(r=-1,l.visible=!1);for(let t=0;t<n.length;t++)i.push(e.viewColumns.indexOf(n[t])),n[t].freeze&&("far"===n[t].freeze&&(s="far"),r++);r===n.length?l.freeze=s:r>0&&r<n.length&&(e.classList.add("smart-visibility-hidden"),e.error(e.localize("frozenColumns",{elementType:"Grid"}))),i.sort((function(e,t){return(e=parseInt(e))<(t=parseInt(t))?-1:e>t?1:0}));for(let t=1;t<i.length;t++)i[t]!==i[t-1]+1&&(e.classList.add("smart-visibility-hidden"),e.error(e.localize("columnGroups",{elementType:"Grid"})))}}e._columnGroupsLevel=1+t,e._columnGroups=o}_refreshColumnHeights(){const e=this;if("card"===e.view)return;e.$.columnHeader.style.height="",e._viewColumnsHeight=e._measureColumnHeight(),e._columnHeights=[];let t=0;for(let o=0;o<e._columnGroupsLevel;o++){let l=e._viewColumnsHeight;e.layout.columnHeight&&(l="number"==typeof e.layout.columnHeight?e.layout.columnHeight?e.layout.columnHeight:e._viewColumnsHeight:e.layout.columnHeight?e.columnHeight(o):e._viewColumnsHeight),l<e.layout.columnMinHeight&&(l=e.layout.columnMinHeight),l?(e._columnHeights.push(l),t+=l):(t+=e._viewColumnsHeight,e._columnHeights.push(e._viewColumnsHeight))}e._columnHeaderHeight=e._columnGroupsLevel*e._viewColumnsHeight,e._columnHeaderHeight=t,e.$.columnHeader.style.height=e._columnHeaderHeight+"px";const o=function(t){let o=0;for(let l=0;l<t.level;l++)o+=e._columnHeights[l];return o},l=function(t){let l=o(t),a=e._columnHeaderHeight-l;for(let o=t.level+1;o<e._columnHeights.length;o++){const l=o;for(let o=0;o<e.viewColumns.length;o++){const n=e.viewColumns[o];let i=!1;if(n.level===l){let o=n;for(;o.parent;){if(o.parent===t){a=e._columnHeights[l],i=!0;break}o=o.parent}if(i)break}}}return a};for(let t=0;t<e.viewColumns.length;t++){const a=e.viewColumns[t],n=l(a);a.computedHeight=n,a.top=o(a)}for(let t=0;t<e._columnGroupsLevel-1;t++)for(let a=0;a<e._columnGroups.length;a++){const n=e._columnGroups[a];if(n.level!==t)continue;if(n.groups){const e=l(n),t=o(n);n.top=t,n.computedHeight=e}const i=n.element;i&&(i.style.width=n.computedWidth+"px",e.rightToLeft?i.style.right=n.left+"px":i.style.left=n.left+"px",i.style.top=n.top+"px",i.style.height=n.computedHeight+"px",i.style.lineHeight=n.computedHeight+"px")}}_refreshColumnWidths(){const e=this;e.__clientSize=null;const t=e.$.verticalScrollBar.offsetWidth>0?e.$.verticalScrollBar.offsetWidth:0,o=e.dataSource.groupBy||[];let l=e.grouping.enabled&&"advanced"===e.grouping.renderMode?e.grouping.groupIndent*(1+o.length):0,a=0;e.selection.checkBoxes.enabled&&(a=e._selectionColumn.computedWidth?e._selectionColumn.computedWidth:e._selectionColumn.minWidth);const n=e._clientSize.width-t-l;let i=0,r=[],s=0,d=0,u=0;if(e.editing.enabled&&!e.editing.commandColumn.inline){const t=function(){const t=document.createElement("div"),o=document.createElement("div"),l=e.editing.commandColumn.dataSource;let a=0,n="",i=0;o.classList.add("smart-label");for(let t in l){const o=l[t];let a=!1;if("commandColumnMenu"===t)continue;let r=!1;a||(!0===o.visible?(i++,r=!0):"auto"===o.visible&&((e.editing.editRow||e.editing.editCell)&&!e.editing.dialog.enabled||"commandColumnEdit"!==t?!e.editing.editRow&&!e.editing.editCell||e.editing.dialog.enabled||("commandColumnUpdate"===t||"commandColumnCancel"===t)&&(i++,r=!0):(i++,r=!0)),a=!0),r&&"icon"!==e.editing.commandColumn.displayMode&&(n+="<span>"+("{{messages}}"===o.label?e.localize(t):o.label)+"</span>")}return o.innerHTML="<span>"+n+"</span>",t.appendChild(o),t.style.width="auto",t.style.position="static",e.$.columnHeader.appendChild(t),a=10+o.firstChild.offsetWidth,e.$.columnHeader.removeChild(t),"icon"===e.editing.commandColumn.displayMode?a=20+20*i:"labelAndIcon"===e.editing.commandColumn.displayMode?a+=25*i:a+=10*i,a};if(e._commandColumn.visible=e.editing.commandColumn.visible,e.editing.commandColumn.visible){const o=e.editing.commandColumn.width?e.editing.commandColumn.width:t();e.columns.canNotify=!1,e._commandColumn.width=o,e.columns.canNotify=!0}}for(let t=0;t<e.viewColumns.length;t++){const o=e.viewColumns[t];let l;"number"==typeof o.width?l=o.width:o.width&&o.width.toString().indexOf("%")>=0?(l=parseFloat(o.width)/100,l*=n-a):o.width&&(o.width.toString().indexOf("em")>=0||o.width.toString().indexOf("pt")>=0||o.width.toString().indexOf("fr")>=0)?(l=parseFloat(o.width),l*=16):"auto"===o.width?l=o._autoSize():o.visible&&(r.push(o),l=0),o.overflowWidth&&(l-=o.overflowWidth),o.visible&&(i+=l),l<o.minWidth&&(l=o.minWidth),o.computedWidth=l}if(r){let e=n-i,t=0;e<0&&(e=60*r.length);for(let o=0;o<r.length;o++){const l=r[o];let a;a=e/r.length,o===r.length-1&&(a=e-t),l.overflowWidth&&(a-=l.overflowWidth),a<l.minWidth&&(a=l.minWidth),l.computedWidth=a,t+=a}}for(let t=0;t<e.viewColumns.length;t++){let o=e.viewColumns[t];o.visible&&(l>0&&!o.autoGenerated&&(o.computedWidth+=l,l=0),o.freeze?!0===o.freeze||"near"===o.freeze?(o.left=s,u+=o.computedWidth,s+=o.computedWidth):"far"===o.freeze&&(o.left=d,d+=o.computedWidth):(o.left=u,u+=o.computedWidth))}for(let t=0;t<e._columnGroupsLevel-1;t++)for(let o=0;o<e._columnGroups.length;o++){const l=e._columnGroups[o];if(l.level!==t)continue;let a=99999;if(l.groups){const e=function(t){let o=0;for(let l=0;l<t.groups.length;l++){let n=t.groups[l];n.groups?o+=e(n):n.visible&&(a=Math.min(n.left,a),o+=n.computedWidth)}return o};l.computedWidth=e(l),l.left=a}}}_createColumnHeaderCellElements(){const e=this,t=e.$.columnContainer,o=document.createDocumentFragment();let l=0;e._columnElements=[],e.$.columnContainer.innerHTML="",e.$.columnNearContainer.innerHTML="",e.$.columnFarContainer.innerHTML="",e.rightToLeft?(e.$.columnNearContainer.classList.remove("near"),e.$.columnNearContainer.classList.add("far"),e.$.columnFarContainer.classList.remove("far"),e.$.columnFarContainer.classList.add("near")):(e.$.columnNearContainer.classList.remove("far"),e.$.columnNearContainer.classList.add("near"),e.$.columnFarContainer.classList.remove("near"),e.$.columnFarContainer.classList.add("far"));for(let t=0;t<e._frozenNearColumns.length;t++)e._frozenNearColumns[t].createElement();for(let t=0;t<e._frozenFarColumns.length;t++)e._frozenFarColumns[t].createElement();for(let t=0;t<e.viewColumns.length;t++){const a=e.viewColumns[t];if(a.freeze)continue;const n=a.createElement();void 0!==a.computedWidth?(a.parent&&n.setAttribute("column-group",a.parent.name),a.parent&&a.parent.columns&&a.parent.columns[0].dataField===a.dataField&&n.setAttribute("column-group-first-child",""),l+=a.computedWidth,e._columnElements.push(n),l<2*e._clientSize.width&&o.appendChild(n)):(e._columnElements.push(n),o.appendChild(n))}for(let t=0;t<e._columnGroups.length;t++){const l=e._columnGroups[t],a=new Smart.Grid.Column({visible:void 0===l.visible||l.visible,allowSort:!1,allowFilter:!1,allowSelect:!1,grid:e,dataField:l.name,label:l.label,labelTemplate:l.labelTemplate,align:l.align,verticalAlign:l.verticalAlign,showIcon:!1});l.column=a;const n=a.createElement();n.style.width=l.computedWidth+"px",e.rightToLeft?n.style.right=l.right+"px":n.style.left=l.left+"px",n.style.top=l.top+"px",n.style.height=l.computedHeight+"px",n.style.lineHeight=l.computedHeight+"px",o.appendChild(n),l.element=n,l.grid=this,n.onpointerdown=()=>{if(e.selection.allowColumnHeaderSelection){const t=function(e){let o=new Array;if(e.columnGroup&&o.push(e),e.groups)for(let l=0;l<e.groups.length;l++)if(e.groups[l].columnGroup)o.push(e.groups[l]);else if(e.groups[l].groups){let a=t(e.groups[l]);for(let e=0;e<a.length;e++)o.push(a[e])}return o},o=t(l);e._selectColumnsRange(o[0].dataField,o[o.length-1].dataField)}}}e.htmlColumnLastChild||(e.htmlColumnLastChild=document.createElement("smart-grid-column"),e.htmlColumnLastChild.classList.add("top-far-corner"),e.htmlColumnLastChild.onpointerdown=e=>{e.stopPropagation(),e.preventDefault()},e.$.columnHeader.appendChild(e.htmlColumnLastChild)),t.appendChild(o),t.style.width=e._computedColumnsWidth+"px",!1===e.appearance.showColumnGroupLines&&e.setAttribute("appearance_hide-column-group-lines",""),e._refreshFrozenColumns()}_refreshFrozenColumns(){const e=this;e.$.columnNearContainer.style.width=e._frozenColumnsNearWidth+"px",e.$.columnFarContainer.style.width=e._frozenColumnsFarWidth+"px";for(let t=0;t<e._columnGroups.length;t++){const o=e._columnGroups[t];o.freeze&&o.element&&(!0===o.freeze||"near"===o.freeze?e.$.columnNearContainer.appendChild(o.element):"far"===o.freeze&&e.$.columnFarContainer.appendChild(o.element))}for(let t=0;t<e.viewColumns.length;t++){const o=e.viewColumns[t];o.freeze&&o.element&&(!0===o.freeze||"near"===o.freeze?e.$.columnNearContainer.appendChild(o.element):"far"===o.freeze&&e.$.columnFarContainer.appendChild(o.element))}}get _clientSize(){const e=this;if(e.__clientSize)return e.__clientSize;const t=getComputedStyle(e.$.container),o=parseFloat(t.paddingLeft)+parseFloat(t.paddingRight),l=parseFloat(t.paddingTop)+parseFloat(t.paddingBottom),a=parseFloat(t.borderLeftWidth)+parseFloat(t.borderRightWidth),n=parseFloat(t.borderTopWidth)+parseFloat(t.borderBottomWidth);return e.__clientSize={width:e.$.container.offsetWidth-o-a,height:e.$.container.offsetHeight-l-n},e.__clientSize}_initializeRowElements(){const e=this;if(!e.rows)return;e.rows.canNotify=!1;let t=0,o=e._clientSize.height;e.$.rowNearContainer.innerHTML="",e.$.rowFarContainer.innerHTML="",e.$.rowContainer.innerHTML="",e._rowElements=[],e._overflowOffset=Math.max(o,300),e.rightToLeft?(e.$.rowNearContainer.classList.remove("near"),e.$.rowNearContainer.classList.add("far"),e.$.rowFarContainer.classList.remove("far"),e.$.rowFarContainer.classList.add("near")):(e.$.rowFarContainer.classList.remove("near"),e.$.rowFarContainer.classList.add("far"),e.$.rowNearContainer.classList.remove("far"),e.$.rowNearContainer.classList.add("near"));const l=e.offsetHeight;e.$.container.classList.add("smart-hidden");const a=e.offsetHeight;e.$.container.classList.remove("smart-hidden"),"hidden"!==e.verticalScrollBarVisibility&&l===a||(o=e._scrollHeight);const n=function(){const l=document.createDocumentFragment();if(e.rows&&0===e.rows.length)return;for(let a=0;a<e.rows.length;a++){const n=e.rows[a];if(n.freeze&&n.visible)continue;const i=n.createElement();if(l.appendChild(i),t+=e.layout.rowMinHeight,t>e._overflowOffset+o)break}e.$.rowContainer.appendChild(l);const a=e.$.rowContainer.children;for(let t=0;t<a.length;t++){const o=a[t];e.rows[t]&&(e.rows[t].element=o),e._rowElements[t]=o}};for(let t=0;t<e._frozenNearRows.length;t++){const o=e._frozenNearRows[t];o.grid=e;const l=o.createElement();o.element=l,e.$.rowNearContainer.appendChild(l)}for(let t=0;t<e._frozenFarRows.length;t++){const o=e._frozenFarRows[t];o.grid=e;const l=o.createElement();o.element=l,e.$.rowFarContainer.appendChild(l)}n();let i=0;for(;t<1.5*o&&++i<50;)n();e.rows.canNotify=!0}_refreshSummary(e){const t=this;t.summaryRow.visible&&(t._summaryUpdateTimer&&clearTimeout(t._summaryUpdateTimer),t._summaryUpdateTimer=setTimeout((()=>{!0!==t.editing.isEditing&&(t._calculateSummary(),!1!==e&&t._recycle(!1,!0,!1))}),100))}_initializeRows(){const e=this;let t=0;e._frozenNearDefaultRows=[],e._frozenFarDefaultRows=[],e.rows=[],e.rowById=[],e._frozenFarRows=[],e._frozenNearRows=[];let o=e._createdDate||new Date,l=void 0!==e._createdBy?e._createdBy:e.currentUser;const a=function(){let t=[],o=!1;for(let l=0;l<e.columns.length;l++){const a=e.columns[l];let n={};a.summary&&a.summary.length>0&&(o=!0,n[a.dataField]=a.summary,t.push(n))}if(!o)return void(e._summaryItems=[]);const l=e.getSelectedRowIds();if(l.length>=1){const o=[];for(let t=0;t<l.length;t++){const a=e.dataSource.dataItemById[l[t]];a&&o.push(a)}e._summaryItems=e.dataSource.summarize(t,o)}else if(e._selection&&e._selection.cells&&Object.keys(e._selection.cells).length>2){const o=e.getSelectedCells(!1),l=[],a=[];for(let t=0;t<o.length;t++){const n=o[t],i=n[0],r=e.dataSource.dataItemById[i];-1===l.indexOf(r)&&l.push(r),-1===a.indexOf(n[1])&&a.push(n[1])}e._summaryItems=e.dataSource.summarize(t,l);const n=Object.keys(e._summaryItems);for(let t=0;t<n.length;t++){const o=n[t];-1===a.indexOf(o)&&delete e._summaryItems[o]}}else e._summaryItems=e.dataSource.summarize(t)};e._calculateSummary=a;const n=e.columns?e.columns.filter((e=>void 0!==e.getCellValue)):[],i=function(a,i,r){let s=null;if(e.isInitialized&&(o=new Date),s=a?a.grid?a:new Smart.Grid.Row({data:a,index:i,grid:e,createdBy:l,createdDate:o}):new Smart.Grid.Row({data:{},index:i,grid:e,createdBy:l,createdDate:o}),n)for(let e=0;e<n.length;e++){const t=n[e],o=t.getCellValue(s.id,t.dataField,a);void 0!==o&&(s.data[t.dataField]=o)}if(e.rowById[s.id]&&(s.id=e.rows.length,e.rowById[s.id])){const e=function(){return(65536*(1+Math.random())|0).toString(16).substring(1)};s.id=e()}if(e.onRowInit){e.onRowInit(i,s,e),30!==s.height&&(s.cellHeight=s.height);for(let t in s)-1!==s.properties.indexOf(t)||t.startsWith("_")||e.error(e.localize("invalidRowProperty",{elementType:"Grid",propertyName:t}))}if(s.selected&&(e._selection.rows[s.id]=!0,e._selection.indexes[s.index]=s.index),s.freeze&&s.visible){if(!0===s.freeze||"near"===s.freeze){e.rows.splice(t++,0,s);const o=e.rows[t-1];-1===e._frozenNearRows.indexOf(o)&&e._frozenNearRows.push(o)}else if("far"===s.freeze){e.rows.push(s);const t=e.rows[e.rows.length-1];-1===e._frozenFarRows.indexOf(t)&&e._frozenFarRows.push(t)}}else e.rows[i]?e.rows.splice(i,0,s):e.rows.push(s),s.data&&s.data.$&&(s.data.$.history=s.history,s.data.$.starred=s.starred,s.data.$.comments=s.comments,s.data.$.style=s.style);if(!("virtual"===e.scrolling||e.paging.enabled&&e.dataSource&&e.dataSource.virtualDataSource))if(e.onRowInserted){const t=void 0===i?e.rows[e.rows.length-1]:e.rows[i],o=o=>{const l=t;if(void 0!==o&&Array.isArray(o)&&(o=o[0]),void 0===o){if(e.rowById[l.id]){const t=e.dataSource.dataItemById[l.id],o=function(){return(65536*(1+Math.random())|0).toString(16).substring(1)};l.id=o(),l.data&&l.data.$?l.data.$.id=l.id:l.data.id=l.id,e._getId()&&(l.data[e._getId()]=l.id),t&&(e.dataSource.dataItemById[l.id]=l.data)}e.rowById[l.id]=l}else{const t=e.dataSource.dataItemById[l.id];l.id=o,l.data&&l.data.$?l.data.$.id=l.id:l.data.id=l.id;const a=e._getId();a&&(l.data[e._getId()]=l.id),t&&(t[a]=o,e.dataSource.dataItemById[l.id]=t,l.data=t),e.rowById[l.id]=l}-1!==l.index&&void 0!==l.index||(l.index=e.rows.length),e._setAddUndoRedo(l),!e.editing.isEditing&&e.isInitialized&&(e._recycle(!1,!0),e.grouping.groupBy.length&&e.refresh()),e._onRowInserted&&e._onRowInserted(l),r&&r(l)};if(void 0===i&&(i=e.rows.length-1,void 0!==t.index&&-1!==t.index||(t.index=i)),e.isInitialized){e._rowInsertTimer&&clearTimeout(e._rowInsertTimer),e._rowInsert||(e._rowInsert=[]),e._rowInsert.push({row:t,index:i});const l=e._keyboardAdd?300:150;e._rowInsertTimer=setTimeout((()=>{if(1===e._rowInsert.length)e.onRowInserted([i],[t],o,e),delete e._rowInsert,delete e._undoRedoAction;else{let t=[],o=[];for(let l=0;l<e._rowInsert.length;l++)t.push(e._rowInsert[l].index),o.push(e._rowInsert[l].row);delete e._rowInsert,e.onRowInserted(t,o,(t=>{e.beginUpdate();for(let l=0;l<o.length;l++){const a=o[l],n=t?t[l]:void 0;if(void 0!==n){const t=e.dataSource.dataItemById[a.id];a.id=a.data.id=n;const o=e._getId();o&&(a.data[e._getId()]=a.id),e.rowById[a.id]=a,t&&(t[o]=n,e.dataSource.dataItemById[a.id]=t,a.data=t)}e._setAddUndoRedo(a),-1!==a.index&&void 0!==a.index||(a.index=e.rows.length),e._onRowInserted&&e._onRowInserted(a),r&&r(a)}delete e._undoRedoAction,e.endUpdate(!1)}),e)}}),l)}else e.onRowInserted([i],[t],o,e)}else{const t=void 0===i?e.rows[e.rows.length-1]:e.rows[i];void 0===i&&(i=e.rows.length-1,void 0!==t.index&&-1!==t.index||(t.index=i)),r&&r(t)}},r=function(){const t=e.rows[e.rows.length-1];e.rows.pop(),e.onRowRemoved&&e.onRowRemoved([t.id],[t.index],e),e._onRowRemoved&&e._onRowRemoved([t.id],[t.index],e),e._setRemoveUndoRedo(t)},s=function(t){const o=e.rows[t];o.selected&&o.setProperty("selected",!1),e.rows.splice(t,1),e.onRowRemoved&&e.onRowRemoved([o.id],[t],e),e._onRowRemoved&&e._onRowRemoved([o.id],[t],e),e._setRemoveUndoRedo(o)};e._add=i,e._removeLastRow=r,e._removeAt=s,e._rowHeight=e._autoRowHeight;const d=e.dataSource.length,u=e.onRowInserted;e.onRowInserted=null,e.setAttribute("aria-rowcount",d);const c=e.dataSource&&e.dataSource.virtualDataSource&&!e.dataSource.virtualDataSourceOnExpand&&e.dataSource.length>e.virtualModeCachedRowsCount&&"infinite"!==e.scrolling;if(e.dataSource&&e.dataSource.virtualDataSource&&e.paging.enabled&&!e.dataSource.virtualDataSourceOnExpand)for(let t=0;t<e.dataSource.boundSource.length;t++){const o=e.dataSource[t],l=t+e.paging.pageIndex*e.paging.pageSize;e.dataSource.id||(o.$.id=l),i(o,l)}else if(c){let t=e.dataSource.length>e.virtualModeCachedRowsCount?e.virtualModeCachedRowsCount:e.dataSource.length;"infinite"===e.scrolling&&(t=e.dataSource.length);for(let o=0;o<t;o++){const t=e.dataSource[o];i(t,o)}}else for(let t=0;t<e.dataSource.length;t++){const o=e.dataSource[t];i(o,t)}for(let t=0;t<e._frozenFarRows.length;t++){const o=e._frozenFarRows[t];e.rows.splice(e.rows.indexOf(o),1),e.rows.push(o)}if(a(),e.onRowInserted=u,e.dataSource.notify((function(t){if(e.dataSource._updating)return;const o=t.data;e.rows.canNotify=!1;let l=!1;switch(t.action){case"add":if(!o)return;if(void 0!==o.length)for(let t=0;t<o.length;t++)i(o[t],e.dataSource.length-o.length+t);else i(o,e.dataSource.length-1);break;case"update":if(o.length){let o=[],a=[],n=[];for(let r=0;r<n.length;r++){const s=t.index[r];e.rows[s]?(e.rows[s].data=n[r],o.push(s),a.push(e.rows[s]),n.push(e.rows[s].data)):(i(n[r],n[r].$.index),l=!0)}e.onRowUpdated&&e.onRowUpdated(o,a,n,e)}else{const l=t.index;e.rows[l]?e.rows[l].data=o:i(o,e.dataSource.length-1),e.onRowUpdated&&e.onRowUpdated([l],[e.rows[l]],[e.rows[l].data],e)}break;case"insert":i(o,t.index);for(let t=0;t<e.rows.length;t++)e.rows[t].index=t;break;case"remove":s(t.index);break;case"removeLast":r();break;case"bindingComplete":if(e.dataSource&&e.dataSource.url||e.dataSource&&!e.dataSource.virtualDataSource){if(e.appearance.displayLoadingIndicator=!1,e._setLoadingIndicatorVisibility(),e._toggledRow=null,e.dataSource.length!==d){if(e.paging.enabled){const t=e.$.headerPager.querySelector("smart-pager"),o=e.$.footerPager.querySelector("smart-pager");t&&(t.pagesCount=Math.ceil(e.dataSource.length/e._pageSize)),o&&(o.pagesCount=Math.ceil(e.dataSource.length/e._pageSize))}if(0===d&&0===e.columns.length&&e.dataSource.dataFields.length>0){const t=e.context;e.context=e,e.columns.canNotify=!1,e.columns=[],e._renderColumns(),e._resetCachedLayout(),e.columns.canNotify=!0,e.context=t}e._initializeRows(),e._initializeRowElements(),e.refresh()}e._recycle(),e.onLoad&&(e.onLoad(),delete e.onLoad)}}a(),("update"!==t.action||l)&&e._refreshLayout(),e._recycle(),e.rows.canNotify=!0})),e._observeRows(),e.summaryRow.visible){const t=new Smart.Grid.Row({height:e.layout.rowMinHeight,freeze:"near",visible:"near"===e.summaryRow.position,summaryRowIndex:0,summaryRow:!0}),o=new Smart.Grid.Row({height:e.layout.rowMinHeight,freeze:"far",visible:"far"===e.summaryRow.position,summaryRowIndex:0,summaryRow:!0});"near"===e.summaryRow.position&&e._frozenNearRows.splice(0,0,t),"far"===e.summaryRow.position&&e._frozenFarRows.push(o)}if(e.filtering.enabled&&e.filtering.filterRow.visible){const t=new Smart.Grid.Row({freeze:!0,autoGenerated:!0,filterRow:!0});e._frozenNearRows.splice(0,0,t)}e._renderAddNewRow()}_observeRows(){const e=this;e._frozenNearRows=[],e._frozenFarRows=[],e.rows=new Smart.ObservableArray(e.rows,null,{allowToggle:!0,allowResize:!0,allowCheck:!0,allowSelect:!0,allowReorder:!0,expanded:!0,selected:!0,checked:!0,visible:!0,enabled:!0,minHeight:!0,height:!0,freeze:!0,showDetail:!0,data:!0,visibleIndex:!0,index:!0,comments:!0,style:!0,starred:!0,updatedBy:!0,updatedDate:!0,createdDate:!0,createdBy:!0,history:!0});for(let t=0;t<e.rows.length;t++){const o=e.rows[t];!0===o.freeze||"near"===o.freeze?e._frozenNearRows.push(o):"far"===o.freeze&&e._frozenFarRows.push(o),e.rowById[e.rows[t].id]=o}e.rows.notify((function(t){if(!e.rows.canNotify)return;const o=t.action;if("length"===o)return;if(t.path)return e.rows.canNotify=!1,(e.rowById[t.target.id]||"selected"===t.propertyName)&&(l=t.target,a=t.propertyName,n=t.oldValue,i=t.newValue,n===i&&"selected"!==a&&"showDetail"!==a||(l.propertyChanged(a,n,i),e.onRowChange&&l.properties.indexOf(a)>=0&&e.onRowChange(l,a,n,i,e))),void(e.rows.canNotify=!0);var l,a,n,i;if(e.rows.canNotify=!1,!e.dataSource)return;switch(e.dataSource.canNotify=!1,o){case"add":{const o=function(o){let l=e.rows[o];if(l instanceof Smart.Grid.Row==0){l=new Smart.Grid.Row(l);const a=e.rows.canNotify;e.rows.canNotify=!1,t.object[o]=l,l=t.object[o],e.rows.canNotify=a}if(l.grid=e,e.dataSource&&e.dataSource.virtualDataSource){e.rows.canNotify=!1;for(let t=0;t<e.rows.length;t++){const o=e.dataSource.boundSource[t],l=e.rows[t];o&&(l.data=o,l.id=o.$.id),e.rowById[l.id]=l}e.rows.canNotify=!0}else(()=>{if(0===e.dataSource.length&&e.dataSource.dataFields&&0===e.dataSource.dataFields.length&&e.columns&&e.columns.length){let t=[];for(let o=0;o<e.columns.length;o++){const l=e.columns[o];t.push({name:l.dataField,dataType:l.dataType||"string"}),l.displayField&&l.displayField!==l.dataField&&t.push({name:l.displayField,dataType:l.dataType||"string"})}e.dataSource.dataFields=t}if(o<e.dataSource.length?e.dataSource.insert(o,e.rows[o].data):e.dataSource.add(e.rows[o].data),e.dataSource[o]){l.data=e.dataSource[o];for(let t=0;t<e.dataSource.dataFields.length;t++){const o=e.dataSource.dataFields[t].name;e.columnByDataField[o]||delete l.data[o]}void 0!==e.dataSource[o].$.id&&(l.id=e.dataSource[o].$.id,e.rowById[l.id]=l),l.data.$&&l.history&&(l.data.$.history=l.history)}-1!==l.index&&void 0!==l.index||(l.index=o),l.selected&&(e._selection.rows[l.id]=!0,e._selection.indexes[l.index]=l.index),l.freeze&&(!0===l.freeze||"near"===l.freeze?e._frozenNearRows.push(l):"far"===l.freeze&&e._frozenFarRows.push(l)),e._conditionalColors&&e._conditionalColors.update&&setTimeout((()=>{e._conditionalColors.update(),e._recycle(!1)}),100)})()};for(let e=0;e<t.addedCount;e++)o(t.index+e);break}case"update":if(t.target){const o=e.rowById[t.target.id],l=e.rows.indexOf(o);e.dataSource.update(l,o)}else{const o=e.rows.indexOf(t.index);e.dataSource.update(t.index,o)}break;case"remove":{if(e.dataSource&&e.dataSource.virtualDataSource){e.rows.canNotify=!1;const o=t.removed&&t.removed.length>0?t.removed[0]:null;o&&delete e.rowById[o.id];for(let t=0;t<e.dataSource.boundSource.length;t++){const o=e.dataSource.boundSource[t],l=e.rows[t];l&&(l.data=o,l.id=o.$.id,e.rowById[l.id]=l)}return e.rows.canNotify=!0,e.refresh(),void e._refreshPaging(!1)}const o=t.removed&&t.removed.length>0?t.removed[0]:null;o&&delete e.rowById[o.id],e.dataSource.removeAt(t.index);break}}if(e.dataSource.canNotify=!0,e.rows.canNotify=!0,!o)return;let r=e.isInitialized&&e._rowElements&&e._rowElements.length<e.rows.length;"add"===o&&1===t.addedCount&&r&&e._rowElements.length>0&&e._rowElements[e._rowElements.length-1].classList.contains("smart-hidden")&&(r=!1),r&&e._initializeRowElements(),e.refresh(!1,o),e._refreshPagesCount(),e._sortedColumns&&e._sortedColumns.length>0&&e.refreshSort()}))}setDropDownLabel(e){const t=this;t.$.dropDownElement&&(t.$.dropDownElement.querySelector(".smart-action-button").innerHTML=e)}openDropDown(){const e=this;if(!e.dropDownMode)return;if(!e.$.dropDownPopup)return;const t=e.$.dropDownPopup,o=e.$.dropDownElement;o.setAttribute("active",""),o.querySelector(".smart-drop-down-button").setAttribute("active",""),(()=>{const l=0,a=0;if(e.layout.isDirty=!0,window.screen.availWidth<400)return t.open("left","top"),t.style.width=e.offsetWidth+"px",void(t.style.height=e.offsetHeight+"px");{const o={width:e.layout.dropDownWidth,height:e.layout.dropDownHeight};t.style.width="auto"===o.width?o.width:o.width+"px",t.style.height="auto"===o.height?o.height:o.height+"px"}const n=o;if(n){const o=e.offset(n),i=o.left-l,r=l,s=Math.max(r,i);t.open(s,o.top+n.offsetHeight-a)}else t.classList.add("center"),t.open("center","center");e.style.display=""})()}closeDropDown(){const e=this;e.dropDownMode&&e.$.dropDownPopup&&(e.$.dropDownElement.removeAttribute("active"),e.$.dropDownElement.querySelector(".smart-drop-down-button").removeAttribute("active"),e.$.dropDownPopup.close())}_renderInDropDown(){const e=this;if(e.dropDownMode&&(e.dropDownMode&&(e.style.display="none"),e.dropDownMode&&void 0===e._dropDownMode)){e._dropDownMode=!0;const t=document.createElement("div"),o=e._createPopup();o.allowDrag=!1,o.classList.add("smart-grid-drop-down-popup"),e.$.dropDownElement=t,e.$.dropDownPopup=o,t.onmouseenter=()=>{t.hasAttribute("active")||t.setAttribute("hover","")},t.onmouseleave=()=>{t.removeAttribute("hover")},t.classList.add("smart-grid-drop-down-button","smart-drop-down-box"),e.parentNode.insertBefore(t,e),t.innerHTML=`<div class="smart-container" role="presentation">\n <div class="smart-content" role="presentation">\n <div class="smart-buttons-container" role="presentation">\n <span class="smart-action-button">${e.localize("dropDownPlaceholder")}</span>\n <span class="smart-drop-down-button">\n <span class="smart-drop-down-button-icon" id="arrow" aria-hidden="true"></span>\n </span>\n </div>\n </div>\n </div>`,t.onclick=()=>{o.classList.contains("open")?e.closeDropDown():e.openDropDown()},e.style.height="100%",e.style.width="100%",o.content.appendChild(e),e._cellsMerge=[],e._cellStyles=[],e._popupDropDown||(e._popupDropDown=o,o._refreshPosition=()=>{const l=e.offset(t),a=t.offsetHeight,n=e.offset(e);if(o.style.maxHeight="",o.style.minHeight="",l.top+a+o.offsetHeight>window.innerHeight-n.top){const e=a+l.top+o.offsetHeight-window.innerHeight+n.top;o.style.maxHeight=Math.max(250,o.offsetHeight-e)+"px",o.style.minHeight="250px"}else o.style.maxHeight="",o.style.minHeight=""},o.onOpen=function(){e._popupDropDown._refreshPosition(),e.$.fireEvent("dropDownGridOpen")},o.onClose=function(){e.$.fireEvent("dropDownGridClose")},o.onkeydown=function(e){"Escape"===e.key&&(o.result=!1,o.close())})}}render(){const e=this,t=()=>0===e.offsetWidth||0===e.offsetHeight;if(t())return requestAnimationFrame((()=>{e.isInitialized||t()||(e._undoRedo=[],e._refreshCurrentUser(),e._render())})),e.setAttribute("role","grid"),e.editing.enabled||e.setAttribute("aria-readonly",!0),void super.render();const o=e.context;e.context=e,e.setAttribute("role","grid"),"grid"!==e.view&&e.setAttribute("view",e.view),e.editing.enabled||e.setAttribute("aria-readonly",!0),e._undoRedo=[],e._refreshCurrentUser(),e._render(),e.context=o,super.render()}_renderColumns(e){const t=this;t._initializeColumns(),t._initializeColumnGroupsHierarchy(),t._refreshColumnsResponsiveVisibility(),t._createColumnHeaderCellElements(),t._renderColumnGroupHeaders(),!1!==e&&t._refresh()}_renderRows(e){const t=this;t._initializeRows(),t._initializeRowElements(),!1!==e&&t._refresh()}_setupMobile(){const e=this;if(void 0===e._mobile&&(e._mobile=Smart.Utilities.Core.isMobile),e._mobile){e.editing.addNewColumn.visible=!1,e.layout.rowMinHeight=e.layout.rowHeight=e.layout.columnMinHeight=e.layout.columnHeight=25,e.layout.columnWidth=180,e.behavior.rowResizeMode="none",e.behavior.allowRowReorder=!1,e.editing.action="none",e.appearance.showViewBar=!1,e._scrollView.vScrollBar.showButtons=!1,e._scrollView.hScrollBar.showButtons=!1,e.style.setProperty("--smart-scroll-bar-size","12px"),document.body.style.setProperty("--smart-data-view-sort-panel-width","345px"),e._scrollContent=document.createElement("div"),e._scrollContent.style.width="100%",e._scrollContent.style.height="100%",e._scrollContent.style.position="absolute",e._scrollContent.style.left="0px",e._scrollContent.style.top="0px",e._scrollContent.style.background="white",e._scrollContent.style.zIndex=9999,e._scrollContent.style.opacity=.1,e._scrollContent.style.overflow="auto",e.addEventListener("viewChange",(()=>{"grid"===e.view?e._scrollContent.classList.remove("smart-hidden"):e._scrollContent.classList.add("smart-hidden")})),e.addEventListener("beginEdit",(()=>{e._scrollContent.classList.add("smart-hidden")})),e.addEventListener("endEdit",(()=>{e._scrollContent.classList.remove("smart-hidden")})),e._scrollContent.ontouchmove=e=>{e.stopPropagation()},e._scrollContent.ontouchstart=e=>{e.stopPropagation()},e._scrollContent.onpointerdown=t=>{e._scrollContentScroll=!1,setTimeout((()=>{const o=e=>new PointerEvent(e,{bubbles:!0,cancelable:!0,composed:!0,pointerId:42,pointerType:"mouse",clientX:t.clientX,clientY:t.clientY,pageX:t.pageX,pageY:t.pageY});if(e._scrollContentScroll)e._hideActionButtons();else{const l=(e.enableShadowDOM?e.shadowRoot:e.getRootNode()).elementsFromPoint(t.clientX,t.clientY);if(l[2])if(l[2].classList.contains("smart-grid-add-row-button"))e._hideActionButtons(),l[2].dispatchEvent(o("click"));else if(l[2].classList.contains("smart-summary-placeholder")||l[2].classList.contains("summary-value-part"))e._hideActionButtons(),l[2].dispatchEvent(o("pointerup"));else if(l[2].closest("smart-menu-item")){e._hideActionButtons();const t=l[2].closest("smart-menu-item");l[2].closest("smart-menu")._menuItemSelectionHandler(t)}else{if(l[2].dispatchEvent(o("pointerdown")),e._lastMobileClickRange){const o=e._lastMobileClickRange;let l=!0;o.left<=t.pageX&&o.left+o.right>=t.pageX&&(l=!1),l&&e._hideActionButtons()}else e._hideActionButtons();const a=(o,l)=>{if(o&&o.autoShowActionButton){const a=l.getBoundingClientRect(),n=e.offset(l);if(n.left<=t.pageX&&n.left+a.width-6>=t.pageX){if(!e.hasColumnMenu(o))return;e._lastMobileClickRange={left:n.left,right:n.left+a.width-6},l._showActionButton()}else l._hideActionButton()}};for(let t=0;t<e._columnElements.length;t++){const o=e._columnElements[t];a(o.column,o)}}}}),300),t.stopPropagation()};let t=0;const o=()=>{const t=e._scrollContent.scrollLeft,o=e._scrollContent.scrollTop;e._scrollView.vScrollBar.value=o,e._scrollView.hScrollBar.value=t,e._scrollContentScroll=!0};e._scrollContent.onscroll=()=>{cancelAnimationFrame(t),t=0,t=requestAnimationFrame(o)},e._scrollContentView=document.createElement("div"),e._scrollContentView.style.width=e._scrollView.scrollWidth+"px",e._scrollContentView.style.height=e._scrollView.scrollHeight+"px",e._scrollContent.appendChild(e._scrollContentView),e.$.scrollView.appendChild(e._scrollContent)}}_render(){const e=this;if(e.isInitialized||(e.onBeforeInit&&(e.onBeforeInit(e),e.onBeforeInit=null),e.$.fireEvent("beforeInit",{grid:e}),e.header.visible&&(e.header.buttons.indexOf("views")>=0||e.header.buttons.indexOf("states")>=0)&&e._updateKanbanTaskFields()),e._setupMobile(),(()=>{if(null===e.dataSource)e.dataSource=new Smart.DataAdapter;else if(Array.isArray(e.dataSource)||"string"==typeof e.dataSource){let t=[];if(e.dataSourceSettings.dataFields&&e.dataSourceSettings.dataFields.length>0)e.dataSource=new Smart.DataAdapter({dataSource:e.dataSource,dataSourceType:e.dataSourceSettings.dataSourceType,dataFields:e.dataSourceSettings.dataFields,keyDataField:e.dataSourceSettings.keyDataField,parentDataField:e.dataSourceSettings.parentDataField,childrenDataField:e.dataSourceSettings.childrenDataField,groupBy:e.dataSourceSettings.groupBy||e.grouping.groupBy,mapChar:e.dataSourceSettings.mapChar,root:e.dataSourceSettings.root,record:e.dataSourceSettings.record,autoGenerateColumns:e.autoGenerateColumns,id:e.dataSourceSettings.id,virtualDataSource:e.dataSourceSettings.virtualDataSource,virtualDataSourceOnExpand:e.dataSourceSettings.virtualDataSourceOnExpand});else if(e.columns&&e.columns.length){for(let o=0;o<e.columns.length;o++){const l=e.columns[o];t.push({name:l.dataField,dataType:l.dataType||"string"}),l.displayField&&l.displayField!==l.dataField&&t.push({name:l.displayField,dataType:l.dataType||"string"})}e.dataSource=new Smart.DataAdapter({dataSource:e.dataSource,dataFields:t,dataSourceType:e.dataSourceSettings.dataSourceType,keyDataField:e.dataSourceSettings.keyDataField,parentDataField:e.dataSourceSettings.parentDataField,childrenDataField:e.dataSourceSettings.childrenDataField,groupBy:e.dataSourceSettings.groupBy||e.grouping.groupBy,mapChar:e.dataSourceSettings.mapChar,root:e.dataSourceSettings.root,record:e.dataSourceSettings.record,autoGenerateColumns:e.autoGenerateColumns,id:e.dataSourceSettings.id,virtualDataSource:e.dataSourceSettings.virtualDataSource,virtualDataSourceOnExpand:e.dataSourceSettings.virtualDataSourceOnExpand})}else e.dataSource=new Smart.DataAdapter({dataSource:e.dataSource})}})(),e._selection={rows:[],indexes:[],columns:[],cells:[]},e.dataSource&&e.dataSource.url&&(e.appearance.displayLoadingIndicator=!0,e._setLoadingIndicatorVisibility(),e.dataSource.data={sorting:e.getSortedColumns(),filtering:e.getFilteredColumns(),grouping:e.grouping.groupBy}),e.filtering.filterRow)for(let t=0;t<e.columns.length;t++)e.columns[t]._filterEditorInitialized&&(e.columns[t]._filterEditorInitialized=!1);const t=!e.isInitialized;if(t&&(e.onInit&&(e.onInit(e),e.onInit=null),e.$.fireEvent("init",{grid:e})),e._renderColumns(!1),e._renderRows(!1),e._renderPagers(),e._renderCommandBar(),e._renderConditionalFormatting(),e._initFormulaParser(),t&&e.grouping.enabled&&e.grouping.groupBy.length&&e.dataSource&&(e.dataSource.groupBy=e.grouping.groupBy),e.appearance.allowColumnStickyPosition&&e._stickHeader(),e.header.visible&&""===e.header.template){const t=document.createElement("smart-grid-toolbar");t.headerPosition="top",t.messages=e.messages,t.locale=e.locale;let o=e.$.header;e.header.appendTo&&(o=document.querySelector(e.header.appendTo),o?o.onclick=t=>{e._headerClickHandler(t)}:o=e.$.header),o.appendChild(t),e.$.headerBar&&e.$.headerBar.remove(),e.$.headerBar=o.firstElementChild,e.$.headerBar._init(e)}if(e.isInitialized)e.refreshFilters();else{let t=!1;if(e.stateSettings.autoLoad){let o=e.stateSettings.current;!o&&e.stateSettings.allowLocalStorage&&(e.stateSettings.current="View 1",o=e.stateSettings.current);let l=null;e.stateSettings.storage&&(l=e.stateSettings.storage[o]),l&&(t=!0),!l&&e.stateSettings.allowLocalStorage&&(l=window.localStorage.getItem(o),l&&(t=!0))}if(!t){const t=[];for(let o=0;o<e.viewColumns.length;o++){const l=e.viewColumns[o];l.allowSort&&l.sortOrder&&t.push(l)}if(0===t.length&&e.sorting.sort)for(let o=0;o<e.sorting.sort.length;o++){const l=e.sorting.sort[o],a=Object.keys(l)[0],n=l[a],i=e.columnByDataField[a];i&&(t.push(i),i.sortOrder=n||"asc")}t.sort(((e,t)=>e.sortIndex-t.sortIndex));for(let o=0;o<t.length;o++){const l=t[o],a=e.appearance.allowSortAnimation;e.appearance.allowSortAnimation=!1,e.sortBy(l.dataField,l.sortOrder),e.appearance.allowSortAnimation=a}if(e.filtering.filter.length>0){for(let t=0;t<e.filtering.filter.length;t++){const o=e.filtering.filter[t];if(o){if("string"==typeof o){const t=e.filtering.filter[0],o=e.columnByDataField[t],l=e.filtering.filter[1];let a=null;if(o&&(a=e.dataSource._createFilter(o.dataType,l)),a){if(e.filtering.filterRow.visible&&!o._filterInfo){let e=[];for(let t=0;t<a.filters.length;t++)e.push(a.filters[t].value),t<a.filters.length-1&&e.push(a.logicalOperators[t]);o._filterInfo={condition:a.filters[0].condition,value:e.join(" ")}}e.addFilter(t,a,!1)}break}const t=o[0],l=o.splice(1);let a=null;if(l instanceof Smart.FilterGroup)a=l;else{const o=e.columnByDataField[t];o&&(a=e.dataSource._createFilter(o.dataType,l))}if(a){if(e.filtering.filterRow.visible){const o=e.columnByDataField[t];if(!o._filterInfo){let e=[];for(let t=0;t<a.filters.length;t++)e.push(a.filters[t].value),t<a.filters.length-1&&e.push(a.logicalOperators[t]);o._filterInfo={condition:a.filters[0].condition,value:e.join(" ")}}}e.addFilter(t,a,!1)}}}e.refreshFilters()}else{for(let t=0;t<e.columns.length;t++){const o=e.columns[t];if(o.filter){let t=null,l=o.filter;if(t=l instanceof Smart.FilterGroup?l:e.dataSource._createFilter(o.dataType,l),t){if(e.filtering.filterRow.visible&&!o._filterInfo){let e=[];for(let o=0;o<t.filters.length;o++)e.push(t.filters[o].value),o<t.filters.length-1&&e.push(t.logicalOperators[o]);o._filterInfo={condition:t.filters[0].condition,value:e.join(" ")}}e.addFilter(o.dataField,t,!1)}}}e.refreshFilters()}}}if(e.viewColumns.canNotify=!0,e.isInitialized=!0,("virtual"===e.scrolling||e.paging.enabled&&e.dataSource&&e.dataSource.virtualDataSource||e.dataSource&&e.dataSource.virtualDataSource)&&e._virtualDataRequest("dataBind"),""!==e.header.template&&e._applyTemplate(e.header.template,e.$.header),""!==e.footer.template&&e._applyTemplate(e.footer.template,e.$.footer),e._createFilterPanels(),e._refresh(),e._applyScrolling(),e.grouping.enabled&&e.grouping.autoExpandAll&&e.rowHierarchy?e.expandAllRows():e.grouping.enabled&&e.grouping.autoExpandToLevel&&e.rowHierarchy&&e.expandRowsToGroupLevel(e.grouping.autoExpandToLevel),e.onRender&&(e.onRender(t),e.onRender=null),e.isRendered=!0,"auto"===e.layout.rowHeight&&(e._refreshLayout(),e._recycle()),t){if(e.stateSettings.autoLoad){let t=e.stateSettings.current,o=null;e.stateSettings.storage&&(o=e.stateSettings.storage[t]),!t&&e.stateSettings.allowLocalStorage&&(e.stateSettings.current="smartGrid"+e.id,t=e.stateSettings.current),!o&&e.stateSettings.allowLocalStorage&&(o=window.localStorage.getItem(t)),o&&("string"==typeof o&&(o=JSON.parse(o)),e._loadState(o))}if(e.onAfterInit&&(e.onAfterInit(e),e.onAfterInit=null),e.$.fireEvent("afterInit",{grid:e}),e.isRendering=!1,e.whenRenderedCallbacks){for(let t=0;t<e.whenRenderedCallbacks.length;t++)e.whenRenderedCallbacks[t]();e.whenRenderedCallbacks=[]}!e.dataSource||e.dataSource.url||e.dataSource.virtualDataSource||e.onLoad&&e.onLoad(e)}"kanban"===e.view&&e._initKanbanView()}_initFormulaParser(){const e=this;if(e.formulas){class t{constructor(e){const t=this;let o;try{o=new formulaParser.Parser}catch(e){throw new Error("Smart.FormulaParser: Missing reference to 'formula-parser.min.js'.")}o.on("callCellValue",t._callCellValue.bind(t)),o.on("callRangeValue",t._callRangeValue.bind(t)),t.dataTable=e,t.parser=o}_getFormula(e){const t=this,o="A".charCodeAt(0);let l=0,a="";const n=e;if(t.dataTable._formulas||(t.dataTable._formulas=[]),t.dataTable._formulas[e])return t.dataTable._formulas[e];for(let n=0;n<t.dataTable.columns.length;n++){const i=t.dataTable.columns[n],r=String.fromCharCode(o+l);l++,l>=26&&(l=0,a+="A"),e.indexOf(i.label)>=0?e=e.replaceAll(i.label,a+r):e.indexOf(i.dataField)>=0&&(e=e.replaceAll(i.dataField,a+r))}return t.dataTable._formulas[n]=e,e}_callCellValue(e,t){const o=this,l=o.dataTable,a=e.column.index,n=e.row.index,i=l.columns[a].dataField;let r=l.dataSource[n][i];const s=l.rows[n];if(s){const e=s.getCell(i);e&&e.formula&&(r=o._getFormula(e.formula))}"string"==typeof r&&/=.+/.test(r)&&(r=o.parse(r.slice(1))),t(r)}_callRangeValue(e,t,o){const l=this.dataTable,a=l.dataSource,n=[];for(let o=e.row.index;o<=t.row.index;o++){const i=a[o],r=[];for(let o=e.column.index;o<=t.column.index;o++){let e=i[l.columns[o].dataField];e=isNaN(e)?0:parseFloat(e),isNaN(e)&&(e=0),r.push(e)}n.push(r)}n&&o(n)}parse(e){const t=this.parser.parse(this._getFormula(e));return null!==t.result?t.result:t.error}}e._formulaParser=new t(e)}}get _viewRows(){const e=this;if(e.__viewRows)return e.__viewRows;e._nearRowsAdded||(e._nearRowsAdded=[],e._farRowsAdded=[]);const t=e.rows.toArray?e.rows.toArray():[],o=e.rowHierarchy?e.rowHierarchy:t,l=[].concat(e._frozenNearDefaultRows,e._nearRowsAdded,o,e._farRowsAdded,e._frozenFarDefaultRows);return e.__viewRows=l,l}_toHex(e){if(-1!==e.indexOf("#"))return e;const t=/rgb\((\d+), (\d+), (\d+)\)/g.exec(e);return t?"#"+(parseFloat(t[1]).toString(16).padStart(2,"0")+parseFloat(t[2]).toString(16).padStart(2,"0")+parseFloat(t[3]).toString(16).padStart(2,"0")).toUpperCase():"#FFFFFF"}_renderConditionalFormatting(){const e=this,t=e.conditionalFormatting;if(!t||0===t.length)return;if(!e._defaults){const t=getComputedStyle(e);e._defaults={fontFamily:t.fontFamily,fontSize:t.fontSize,text:e._toHex(t.color),highlight:e._toHex(t.backgroundColor)}}e._formatter||(e._formatter=new Smart.Utilities.ConditionalFormatter(e.dataSource));const o=e._defaults,l=e._formatter,a=[],n=function(t){if("all"===t){if(e.columns&&e.columns.map){const t=[];for(let o=0;o<e.columns.length;o++){const l=e.columns[o];l.dataField.startsWith("task")||l.autoGenerated||"number"!==l.dataType&&"date"!==l.dataType||t.push(l.dataField)}return t}return[]}return[t]};for(let e=0;e<t.length;e++){t[e]=Object.assign({column:"all",condition:"lessThan",firstValue:0,secondValue:1,fontFamily:o.fontFamily,fontSize:o.fontSize,text:o.text,highlight:o.highlight},t[e]);const i=t[e],r=n(i.column),s=i.condition;l.color=i.highlight,l.comparator=i.firstValue,l.min=i.firstValue,l.max=i.secondValue;const d=l.format(s,r);for(let e in d){const t=d[e];for(let e in t){const o=t[e];o.color=i.text,o.fontFamily=i.fontFamily,o.fontSize=i.fontSize}}a.push(d)}if(e._formattingPanel&&(e._formattingPanel.items=t),0===a.length)return a[0];const i={};for(let e=0;e<a.length;e++){const t=a[e];for(let e in t){const o=t[e];if(0!==Object.keys(o).length){i[e]||(i[e]={});for(let t in o)i[e][t]=Object.assign({},i[e][t],o[t])}}}e._conditionalFormatting=i}_stickHeader(){const e=this;e._stickyHeaderHandler=function(){e._handleStickyHeader()},e.$.columnHeader.style.top="",e.$.columnHeader.classList.remove("smart-columns-sticky");let t=e.parentNode;for(e.isInShadowDOM&&t===e.getRootNode()&&(t=e.getRootNode().host);t!==document&&t;)t.addEventListener("scroll",e._stickyHeaderHandler),t=t.parentNode,e.isInShadowDOM&&t===e.getRootNode()&&(t=e.getRootNode().host);try{null!==window.top&&window.top!==window.self&&window.top.document.addEventListener("scroll",e._stickyHeaderHandler)}catch(e){}e._handleStickyHeader()}_unstickHeader(){const e=this;e.$.columnHeader.style.top="",e.$.columnHeader.classList.remove("smart-columns-sticky");let t=e.parentNode;for(;t!==document.body;)t.removeEventListener("scroll",e._stickyHeaderHandler),t=t.parentNode,e.isInShadowDOM&&t===e.getRootNode()&&(t=e.getRootNode().host);try{(""!==document.referrer||window.frameElement)&&null!==window.top&&window.top!==window.self&&window.top.document.removeEventListener("scroll",e._stickyHeaderHandler)}catch(e){}}_handleStickyHeader(){const e=this;if(e.appearance.allowColumnStickyPosition)if(e.$.columnHeader.classList.add("smart-columns-sticky"),0===document.scrollTop&&0===e.parentElement.scrollTop)e.$.columnHeader.style.top="";else{let t=e.parentNode,o=0;for(;t!==document.body;)o+=parseInt(t.scrollTop),t=t.parentNode,e.isInShadowDOM&&t===e.getRootNode()&&(t=e.getRootNode().host);const l=parseInt(e.clientTop+o);e.$.columnHeader.style.top=l+"px";let a=0;window.top!==window.self&&parseInt(window.top.scrollY)>parseInt(e._offsetTop(window.frameElement))&&(a=parseInt(window.top.scrollY)-parseInt(e._offsetTop(window.frameElement))),window.scrollY+a>e.offsetTop&&(e.$.columnHeader.style.top=parseInt(window.scrollY)-parseInt(e.offsetTop)+l+a+"px")}}_scrollHandler(){this._handleStickyHeader()}_initializeRowNumberColumn(){const e=this;if(e._frozenNearColumns&&e._frozenNearColumns.length>0&&e._frozenNearColumns[0].rowHeaderColumn)return void(e._frozenNearColumns[0].visible=e.appearance.showRowHeaderNumber||e.appearance.showRowHeader);const t=new Smart.Grid.Column({dataField:"_rowHeaderColumn",label:"",allowSelect:!1,freeze:!0,visible:!0,grid:e,autoGenerated:!0,rowHeaderColumn:!0,cellsAlign:"center"}),o=e.rows?e.rows.length:e.dataSource?e.dataSource.length:0;let l=e.appearance.showRowHeaderNumber?t._measureSize(o):30;e.layout.autoGenerateColumnWidth&&(l=e.layout.autoGenerateColumnWidth),e.appearance.showRowComments&&(l=25,t.minWidth=25),t.width=l,t.createElement();const a=new Smart.Observable(t,t.observables);e.viewColumns.splice(0,0,a),e._frozenNearColumns.splice(0,0,a)}_initializeColumns(){const e=this;if("number"==typeof e.columns){const t=[],o="A".charCodeAt(0);let l="",a=0;for(let n=0;n<e.columns;n++){let i=n+1;const r=String.fromCharCode(o+a);a++;const s=l+r;"number"!==e.appearance.autoGenerateColumnLabelMode&&(i=l+r),t.push({align:"center",label:i,dataField:s,width:100}),a>=26&&(a=0,l+="A")}e._boundColumns=t}else e._boundColumns=Array.isArray(e.columns)?[...e.columns]:[...e.columns.toArray()];e._initColumns=e.columns,e.columnByDataField=[],e.viewColumns=[],e.columns=new Smart.ObservableArray,e._frozenFarColumns=[],e._frozenNearColumns=[],e._summaryRowCount=1;let t=0;const o=function(t){if(e.dataSource.dataFields){const o=e.dataSource.dataFields.find((e=>{if(e.name===t.dataField)return e})),l=o&&o.dataType||"string";t.dataType||(t.dataType=l)}};if(0===e._boundColumns.length&&e.dataSource&&e.dataSource[0]&&!1!==e.dataSource.autoGenerateColumns){const t=e.dataSource[0];if(t.$&&t.$.isEmpty&&e.dataSource.dataFields)for(let t=0;t<e.dataSource.dataFields.length;t++){const o=e.dataSource.dataFields[t],l=e._boundColumns.length,a={index:l,visibleIndex:l,label:o.name,dataField:o.name,dataType:o.dataType};e._boundColumns.push(a)}else for(let l in t){if(l.startsWith("_")||"$"===l)continue;const t=e._boundColumns.length,a={index:t,visibleIndex:t,label:l,dataField:l};o(a),e._boundColumns.push(a)}}for(let l=0;l<e._boundColumns.length;l++){let a=e._boundColumns[l];if("string"==typeof a){if(e.dataSource.dataFields){const t=e.dataSource.dataFields.find((e=>{if(e.name===a)return e}));a={label:a,dataField:a,dataType:t&&t.dataType||"string"}}}else o(a);a.visibleIndex=l,a.index=l,a.grid=e,a.label&&/<.+?>/.test(a.label)&&a.label.replace&&("all"===e.dataSourceSettings.sanitizeHTML?a.label=a.label.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/'/g,"&#39;").replace(/"/g,"&quot;"):"blackList"===e.dataSourceSettings.sanitizeHTML&&(a.label=window.Smart.Utilities.Core.escapeHTML(a.label)));const n=new Smart.Grid.Column(a);e.onColumnInit&&e.onColumnInit(l,n);for(let t in n)-1!==n.properties.indexOf(t)||t.startsWith("_")||e.error(e.localize("invalidColumnProperty",{elementType:"Grid",propertyName:t,type:n.dataField||"Column"}));delete a.grid,delete a.dataType,delete a.index,delete a.visibleIndex,n.grid=e,e.columns.push(n),n._dataField&&(e.columnByDataField[n._dataField]=n);const i=e.columns[e.columns.length-1];e._summaryRowCount=Math.max(e._summaryRowCount,n.summary.length),n.freeze?!0===n.freeze||"near"===n.freeze?(e.viewColumns.splice(t++,0,i),e._frozenNearColumns.push(i)):"far"===n.freeze&&e._frozenFarColumns.push(i):e.viewColumns.push(i),e.columnByDataField[n.dataField]?(i.parent=e.columnByDataField[n.dataField],e.columnByDataField[n.dataField].children||(e.columnByDataField[n.dataField].children=[]),e.columnByDataField[n.dataField].children.push(i),n.valueField=n.dataField,n.dataField+="_"+e.columnByDataField[n.dataField].children.length,n.displayField=n.valueField,e.columnByDataField[n.dataField]=i):e.columnByDataField[n.dataField]=i,e.onColumnInserted&&!e.isInitialized&&e.onColumnInserted(l,n.getState())}e.viewColumns=e.viewColumns.concat(e._frozenFarColumns),e.setAttribute("aria-colcount",e._boundColumns.length);let l=0;if((e.appearance.showRowHeaderNumber||e.appearance.showRowHeader)&&(e._initializeRowNumberColumn(),l++),e.rowDetail.enabled){const t=20,o=new Smart.Grid.Column({dataField:"_rowDetailColumn",allowSelect:!1,visible:e.rowDetail.visible,label:"",grid:e,freeze:!0,rowDetailColumn:!0,autoGenerated:!0,cellsAlign:"center",width:t,minWidth:t}),a=new Smart.Observable(o,o.observables);e.rowDetailColumn=a,"near"===e.rowDetail.position?(e.viewColumns.splice(l,0,a),o.freeze="near",a.freeze="near",e._frozenNearColumns.splice(l,0,a)):(e.viewColumns.push(a),e._frozenFarColumns.splice(0,0,a)),l++}const a=new Smart.Grid.Column({dataField:"_adaptiveColumn",allowSelect:!1,visible:!1,label:"",grid:e,freeze:"far",adaptiveColumn:!0,autoGenerated:!0,cellsAlign:"center",width:30});new Smart.Observable(a,a.observables).canNotify=!1;const n=new Smart.Grid.Column({dataField:"_commandColumn",allowSelect:!1,visible:e.editing.enabled&&e.editing.commandColumn.visible&&!e.editing.commandColumn.inline,label:"",grid:e,freeze:"far",commandColumn:!0,autoGenerated:!0,align:"center",cellsAlign:"center",width:""}),i=new Smart.Observable(n,n.observables);i.canNotify=!1,e.editing.commandColumn.visible&&("near"===e.editing.commandColumn.position?(n.freeze="near",i.freeze="near",e.viewColumns.splice(l,0,i),e._frozenNearColumns.splice(l,0,i)):(e.viewColumns.push(i),e._frozenFarColumns.splice(0,0,i))),e._commandColumn=i;const r=new Smart.Grid.Column({allowSelect:!1,visible:e.selection.enabled&&e.selection.checkBoxes.enabled,dataField:"_checkBoxColumn",label:"",freeze:e.selection.checkBoxes.position,grid:e,selectionColumn:!0,autoGenerated:!0,cellsAlign:"center",width:32}),s=new Smart.Observable(r,r.observables);if(e.selection.checkBoxes.enabled&&("near"===r.freeze?(e.viewColumns.splice(l,0,s),e._frozenNearColumns.splice(l,0,s)):(e.viewColumns.push(s),e._frozenFarColumns.splice(0,0,s))),e._selectionColumn=s,e._selectionColumn.canNotify=!1,e.editing.addNewColumn.visible){const t=new Smart.Grid.Column({dataField:"_addNewColumn",allowSelect:!1,visible:!0,title:e.localize("addNewColumn"),label:"",cellsClassName:"smart-add-new-column",className:"smart-add-new-column smart-icon smart-grid-icon show smart-icon-plus",grid:e,adaptiveColumn:!1,autoGenerated:!0,cellsAlign:"center",width:90}),o=new Smart.Observable(t,t.observables);e.viewColumns.push(o),e._addNewColumn=o,e._addNewColumn.canNotify=!1}e._observeColumns(),e._templateColumns()}get styleProperties(){return["grid-template-columns","--smart-grid-row-height","--smart-grid-column-header-height","--smart-grid-group-header-height","--smart-grid-filter-footer-height","--smart-grid-group-row-vertical","--smart-grid-group-row-horizontal-offset","--smart-grid-freeze-splitter-size","--smart-grid-resize-line-size","--smart-grid-footer-height","--smart-grid-header-height"]}_templateColumns(){const e=this,t=getComputedStyle(e),o=t.getPropertyValue("--smart-grid-template-columns").trim();if(e._rowGap=0,e._columnGap=0,e._maxHeight=parseInt(t.maxHeight),e._minHeight=parseInt(t.minHeight),"none"!==o){let t=0;for(let o=0;o<e.viewColumns.length;o++)e.viewColumns[o].autoGenerated&&(t+=e.viewColumns[o].visible?e.viewColumns[o].width:0);let l=[];const a=document.createElement("div");a.style.display="grid",a.style.gridTemplateColumns=o;for(let t=0;t<e.columns.length;t++)a.innerHTML+="<div></div>";a.style.width=e.clientWidth-t+"px",e.$.root.appendChild(a);const n=o.split(" ");for(let t=0;t<e.columns.length;t++)l[t]=a.children[t].offsetWidth,"auto"===n[t]&&(l[t]=null);a.parentNode.removeChild(a);let i=0;for(let t=0;t<e.viewColumns.length;t++){const o=e.viewColumns[t];o.autoGenerated||l[i]&&(o.width=o.templateWidth=l[i++])}}else for(let t=0;t<e.viewColumns.length;t++){const o=e.viewColumns[t];o.autoGenerated||o.templateWidth&&(o.width=o.templateWidth=null)}}setColumns(e){const t=this;if(null===e)return void(t.columns=[]);t.beginUpdate(),t.columns.canNotify=!1;let o=[],l=[];for(let l=0;l<e.length;l++){const a=e[l];let n=!0;for(let e=0;e<t.columns.length;e++)if(t.columns[e].dataField===a.dataField){n=!1;break}n&&o.push(a)}const a=e.map((e=>e.dataField));for(let e=0;e<t.columns.length;e++){const o=t.columns[e];-1===a.indexOf(o.dataField)&&l.push(o)}l.forEach((e=>{const o=t.columns.indexOf(e);o>=0&&t.columns.splice(o,1)}));for(let e=0;e<o.length;e++)t.columns.push(o[e]);if(t.columns.canNotify=!0,t.endUpdate(),t._columnGroups=[],t._columnHeights=0,t.viewColumns)for(let e=0;e<t.viewColumns.length;e++){const o=t.viewColumns[e],l=o.element;o.top=0,o.level=0,l&&(l.style.top="",l.style.height="",l.style.lineHeight="")}if(t._renderColumns(),t.__columnHeaderHeight=null,e){t.beginUpdate();const o=t.context;t.context=document;for(let o=0;o<e.length;o++){const l=e[o],a=t.columnByDataField[l.dataField];["allowExport","allowFreeze","allowNull","allowGroup","allowSelect","verticalAlign","columnGroup","cellsVerticalAlign","autoCloseMenu","autoShowActionButton","autoShowSortButton","autoShowFilterButton","allowLabelAnimation","allowActionButtonAnimation","allowSortButtonAnimation","allowHide","allowDelete","allowEdit","allowSummary","allowHeaderEdit","allowFilter","allowSort","allowSortToggleOnClick","allowResize","allowReorder","description","icon","menuItems","summary","cellsFormat","className","rowSpan","cellsClassName","cellsCSSRules","formatSettings","formatFunction","sortIndex","sortOrder","sortComparator","groups","group","filtered","filterEditor","filter","filterMenuMode","defaultValue","dataField","displayField","label","labelTemplate","dataType","align","cellsWrap","cellsAlign","minWidth","width","visible","_visible","freeze","showActionButton","selected","showIcon","highlight","showDescriptionButton","treeColumn","statusColumn","value","valueField","onAction","title","showCustomButton","showFilterButton","showSortButton","editor","template","visibleIndex","validationRules"].forEach((e=>{void 0!==l[e]&&(a[e]=l[e])}))}t.context=o,t.endUpdate(!1)}t.refresh()}onAttached(){const e=this;if(!e._scrollView){e._scrollView=new Smart.Utilities.Scroll(e,e.$.horizontalScrollBar,e.$.verticalScrollBar);const t=e._scrollView.hScrollBar;e._scrollView.vScrollBar.onChange=e._verticalScrollbarHandler.bind(e),t.onChange=e._horizontalScrollbarHandler.bind(e)}if(e.isRendered&&e.isCompleted&&(e._isDestroyed||e.behavior.autoDestroy)){if(e.header.visible&&""===e.header.template){let t=e.$.header;e.header.appendTo&&(t=document.querySelector(e.header.appendTo),t?t.onclick=t=>{e._headerClickHandler(t)}:t=e.$.header),t.innerHTML='<smart-grid-toolbar header-position="top"></smart-grid-toolbar>',e.$.headerBar=t.firstElementChild;const o=e.$.headerBar;o.messages=e.messages,o.locale=e.locale,e.$.headerBar._init(e),o.render(),e.header.onInit&&e.header.onInit(e.$.headerBar)}e._render()}}destroy(){const e=this;if(!e.isRendered)return;e._isDestroyed=!0,["_dialogChart","_dialogAddRow","_dialogEdit","_dialogDelete","_dialogRowDetail","_dialogAddColumn"].forEach((t=>{e[t]&&(e[t].close(),e[t]=null)})),e.menu&&(e.menu.ownerElement=null,e.menu.remove(),e.menu=null);const t=e.$.headerBar;if(t){const e=t.$.headerDropDown;e&&e.remove()}e._resetCachedLayout();const o=e._scrollView.hScrollBar,l=e._scrollView.vScrollBar;if(l.ownerElement=null,o.ownerElement=null,l.onChange=null,o.onChange=null,e._scrollView&&(e._scrollView.unlisten(),delete e._scrollView),e._columnElements)for(let t=0;t<e._columnElements.length;t++)e._columnElements[t]._detach();if(e._columnElements=null,e._rowElements)for(let t=0;t<e._rowElements.length;t++)e._rowElements[t]._detach();e._rowElements=null,e.rows=[],e.rowById=[],e._initColumns=[],e.columnByDataField=[],e.viewColumns=[],e._columnToResizeElement=null;let a=Array.isArray(e.columns)?[...e.columns]:[...e.columns.toArray()];a=a.map((e=>e.data?(void 0!==e.data.visibleIndex&&delete e.data.visibleIndex,void 0!==e.data.index&&delete e.data.index,void 0!==e.data.grid&&delete e.data.grid,e.data):e)),e.rows.notifyFn=null,e.columns.notifyFn=null,e.columns.notify=null,e.columns._array=[],e.columns=a,e._boundColumns=[],e._filterPanels=[],e._frozenFarColumns=[],e._frozenNearColumns=[],e._frozenNearDefaultRows=[],e._frozenFarDefaultRows=[],e._frozenFarRows=[],e._frozenNearRows=[],e._selection&&e._selection.selectionRect&&(e._selection.selectionRect.parentNode&&e._selection.selectionRect.parentNode.removeChild(e._selection.selectionRect),e._selection.selectionRect=null),e._selection={rows:[],indexes:[],columns:[],cells:[]},e.__autoHeightRows=null,e._visibleRows=null,e.__viewRows=null,e.__clientSize=null,e.__scrollHeight=null,e.__scrollWidth=null,e.__parentCells=null,e._selectionColumn=null,e._adaptiveColumn=null,e._commandColumn=null,delete e._columnFarContainerComputedStyle,delete e._columnContainerComputedStyle,delete e._columnNearContainerComputedStyle,e._inputOverlay&&(e._inputOverlay.parentNode&&e._inputOverlay.parentNode.removeChild(e._inputOverlay),e._inputOverlay=null),e._firstVisibleColumn=null,e._lastVisibleColumn=null,e._toggledRow=null,Smart(e._selector)&&(delete Smart(e._selector)._properties,Smart(e._selector)),delete e._selector,delete e._initProperties}onDetached(){const e=this;e.behavior.autoDestroy&&e.destroy()}_observeColumns(){const e=this,t=function(t,o,l,a){l===a&&"selected"!==o||(t.propertyChanged(o,l,a),e.onColumnChange?t.stateProps.indexOf(o)>=0&&e.onColumnChange(t,o,l,a):e.$.fireEvent("columnChange",{column:t,propertyName:o,oldValue:l,value:a}))};for(let o=0;o<e.viewColumns.length;o++){const l=e.viewColumns[o];l.rowHeaderColumn||(l.onAction=function(){e._openMenu(this)}),l.autoGenerated&&l.notify((function(e){l.canNotify=!1,t(l,e.propertyName,e.oldValue,e.newValue),l.canNotify=!0}))}e.columns.notify((function(o){let l=null;if(o.path)return e.columns.canNotify=!1,t(o.target,o.propertyName,o.oldValue,o.newValue),void(e.columns.canNotify=!0);e.columns.canNotify=!1;let a=0;switch(o.action){case"length":return void(e.columns.canNotify=!0);case"add":{const t=function(t){if(l=o.object[t],l instanceof Smart.Grid.Column==0){l.grid=e,l=new Smart.Grid.Column(l);const a=e.columns.canNotify;e.columns.canNotify=!1,o.object[t]=l,l=o.object[t],e.columns.canNotify=a}l.grid=e,l.onAction=function(){e._openMenu(this)},l.freeze?e._frozenNearColumns.push(l):"far"===l.freeze&&e._frozenFarColumns.push(l);let a=e.viewColumns.length-e._frozenFarColumns.length,n=0;if(e._frozenNearColumns.forEach((e=>{e.autoGenerated&&n++})),t<e.columns.length?e.viewColumns.splice(t+n,0,l):e.viewColumns.splice(a,0,l),e.columnByDataField[l.dataField]){e.columnByDataField[l.dataField].children.push(l),l.parent=e.columnByDataField[l.dataField],l.valueField=l.dataField;const t=l.dataField+"_"+l.parent.children.length;e.columnByDataField[t]=l,l.dataField=t}else e.columnByDataField[l.dataField]=l;if(e.dataSource&&e.dataSource.dataFields){let t=!1;for(let o=0;o<e.dataSource.dataFields.length;o++)e.dataSource.dataFields[o].name===l.dataField&&(t=!0);t||e.dataSource.dataFields.push({name:l.dataField,dataType:l.dataType||"string"})}if(!e._dragDrop&&e.onColumnInserted){e._onColumnInsertData||(e._onColumnInsertData=[],e._onColumnInsertIndexes=[]);const o=l.getState();o.dataField=l.dataField,e._onColumnInsertData.push(o),e._onColumnInsertIndexes.push(t),e._onColumnInsertTimer&&clearTimeout(e._onColumnInsertTimer),e._onColumnInsertTimer=setTimeout((()=>{e.onColumnInserted(e._onColumnInsertIndexes,e._onColumnInsertData),delete e._onColumnInsertIndexes,delete e._onColumnInsertData}),50)}};delete e.__measuredColumnHeight;for(let e=0;e<o.addedCount;e++)t(o.index+e);break}case"update":l=o.object[o.index],l instanceof Smart.Grid.Column==0&&(l=new Smart.Grid.Column(l)),l.grid=e;for(let t=0;t<o.index;t++)e.viewColumns[t].autoGenerated&&a++;e.viewColumns[a+o.index]=l,e.columnByDataField[l.dataField]=l,e.onColumnUpdated&&e.onColumnUpdated(o.index,l);break;case"remove":{l=o.removed[0];let t=o.index,n=e.viewColumns.indexOf(l);if(-1===n){for(let o=0;o<=t;o++)e.viewColumns[o].autoGenerated&&a++;e.viewColumns.splice(a+t,1)}else e.viewColumns.splice(n,1);if(l){if(l.filter&&e.removeFilter(l.dataField),l.sortOrder&&e.removeSort(l.dataField),e.removeGroup(l.dataField),l._dataField){const t=e.columnByDataField[l._dataField];t&&t.dataField===l.dataField&&delete e.columnByDataField[l._dataField]}delete e.columnByDataField[l.dataField]}if(e._dragDrop||e.onColumnRemoved&&e.onColumnRemoved(o.index,l),e.columnGroups&&(e._columnGroups=[],e._columnHeights=0,e.viewColumns))for(let t=0;t<e.viewColumns.length;t++){const o=e.viewColumns[t],l=o.element;o.top=0,o.level=0,l&&(l.style.top="",l.style.height="",l.style.lineHeight="")}break}}e._initializeColumnGroupsHierarchy(),e._refreshColumnsResponsiveVisibility(),e._createColumnHeaderCellElements(),e._templateColumns(),e.refresh(),e.columnGroups&&e._columnGroups.length>0&&e._renderColumnGroupHeaders(),e.columns.canNotify=!0}))}get _scrollWidth(){const e=this;if(e.__scrollWidth)return e.__scrollWidth;let t=0;for(let o=0;o<e.viewColumns.length;o++){const l=e.viewColumns[o];l.visible&&(t+=l.computedWidth)}return t=parseInt(t),"card"===e.view&&(t=0),e.__scrollWidth=t,e._scrollView.scrollWidth=t-e._clientSize.width,e.__scrollWidth}_horizontalScrollbarHandler(){const e=this;e.closeMenu(),e.isScrolling=!0,e.isHScrolling=!0,requestAnimationFrame((()=>{e._summaryRowDialog&&e._summaryRowDialog.classList.contains("open")&&e._summaryRowDialog.close(),e._recycle(),e.isScrolling=!1,e.isHScrolling=!1}))}_mouseWheelNative(e,t){const o=this;void 0===o._scrollWheelContent&&(o._scrollWheelContent=document.createElement("div"),o._scrollWheelContent.style.width="100%",o._scrollWheelContent.style.height="100%",o._scrollWheelContent.style.position="absolute",o._scrollWheelContent.style.left="0px",o._scrollWheelContent.style.top="0px",o._scrollWheelContent.style.background="white",o._scrollWheelContent.style.zIndex=9999,o._scrollWheelContent.style.opacity=0,o._scrollWheelContent.style.overflow="auto",o._scrollWheelContent.style.visibility="hidden");let l=0;const a=()=>{if(t){const t=o._scrollWheelContent.scrollLeft;o._scrollView.hScrollBar.value=t,t===e&&o._scrollWheelContent.remove()}else{const t=o._scrollWheelContent.scrollTop;o._scrollView.vScrollBar.value=t,t===e&&o._scrollWheelContent.remove()}};o._scrollWheelContent.onscroll=()=>{cancelAnimationFrame(l),l=0,l=requestAnimationFrame(a)},o._scrollWheelContentView||(o._scrollWheelContentView=document.createElement("div"),o._scrollWheelContent.appendChild(o._scrollWheelContentView)),o._scrollWheelContentView.style.width=o.offsetWidth+o._scrollView.scrollWidth+"px",o._scrollWheelContentView.style.height=o.offsetHeight+o._scrollView.scrollHeight+"px",o.$.scrollView.appendChild(o._scrollWheelContent),o._scrollWheelContent.scrollTop=o._scrollView.vScrollBar.value,o._scrollWheelContent.scrollLeft=o._scrollView.hScrollBar.value,!0===t?o._scrollWheelContent.scrollTo({top:o._scrollView.vScrollBar.value,left:e,behavior:"smooth"}):o._scrollWheelContent.scrollTo({top:e,left:o._scrollView.hScrollBar.value,behavior:"smooth"})}_mouseWheelHandler(e){const t=this;if(t._scrollView.hScrollBar.$.hasClass("smart-hidden")&&t._scrollView.vScrollBar.$.hasClass("smart-hidden"))return;if(42===e.pointerId)return;if(t._isUpdating)return;if(t.editing.isEditing)return;if(!t.behavior.allowMouseWheel)return;const o=t.querySelector("smart-grid-toolbar");if(o&&o.$.headerDropDown.classList.contains("open"))return;let l=!1;if(e.wheelDeltaY?120!==Math.abs(e.wheelDeltaY)&&240!==Math.abs(e.wheelDeltaY)&&360!==Math.abs(e.wheelDeltaY)&&(l=!0):0===e.deltaMode&&(l=!0),t.disabled||t._scrollView.vScrollBar.$.hasClass("smart-hidden")||e.shiftKey||!e.deltaY){if(!t.disabled&&(!t._scrollView.hScrollBar.$.hasClass("smart-hidden")||e.shiftKey)){e.stopPropagation(),e.preventDefault();let o=160;const a=0===e.deltaX?e.wheelDelta:e.deltaX;a<0&&(o=-160),Math.abs(a)>=100&&!l&&!Smart.Utilities.Core.Browser.Firefox?t._mouseWheelNative(t._scrollView.scrollLeft+o,!0):t._scrollView.scrollLeft+=a}}else{const o=t.scrollTop;if(0===o&&e.deltaY<0||o===t.scrollHeight&&e.deltaY>0)return;e.stopPropagation(),e.preventDefault();let a=7*t.layout.rowMinHeight;if(e.deltaY<=0&&(a=-7*t.layout.rowMinHeight),Math.abs(e.deltaY)>=100&&!l&&!Smart.Utilities.Core.Browser.Firefox)t._mouseWheelNative(t._scrollView.scrollTop+a);else{t._wheelrafId=0;const o=()=>{t._scrollView.scrollTop+=e.deltaY};cancelAnimationFrame(t._wheelrafId),t._wheelrafId=0,t._wheelrafId=requestAnimationFrame(o)}}}_refresh(e){const t=this;if(t._isUpdating)return;const o=t.$.verticalScrollBar.offsetWidth;t.removeAttribute("grouped"),t.removeAttribute("tree");let l=!0;t.__autoHeightRows&&(t.__autoHeightRows=null,t._refreshColumnsResponsiveVisibility(),t._recycle(),l=!1),t._groups||(t._groups=[]),t.grouping.enabled&&t.dataSource.groupBy&&t.dataSource.groupBy.length>=0&&("advanced"===t.grouping.renderMode?t.setAttribute("grouped",""):t.setAttribute("tree",""),t._groups||(t._groups=[].concat(t.dataSource.groupBy.toArray())||[]),t._renderGroupBar()),t.grouping.enabled&&t.dataSource.groupBy&&0===t.dataSource.groupBy.length?t.$.breadcrumb&&(t.$.breadcrumb.dataSource=[]):t.dataSource.boundHierarchy&&(t.setAttribute("tree",""),t.setAttribute("role","treegrid")),(t.isInitialized||l)&&t._refreshColumnsResponsiveVisibility(),t._refreshLayout(),o!==t.$.verticalScrollBar.offsetWidth&&(t.__scrollWidth=null,t._refreshColumnsResponsiveVisibility(),t._refreshScrollBars(),0===t.$.verticalScrollBar.offsetWidth&&t.isRendered&&requestAnimationFrame((()=>{t._refreshScrollBars()}))),t._refreshSelection(),t._conditionalColors&&t._conditionalColors.update&&t._conditionalColors.update(),"add"===e||"remove"===e||"update"===e?(t._rowChangeTimeout&&clearTimeout(t._rowChangeTimeout),t._rowChangeTimeout=setTimeout((()=>{t._recycle(!1),t._refreshHeaderBar()}),100)):(t._recycle(),t._refreshHeaderBar()),t._recyclingRows&&0===t._recyclingRows.length&&(t.$.placeholder.classList.remove("smart-hidden"),t.scrollHeight=0,t.$.placeholder.innerHTML=t.messages[t.locale]&&t.messages[t.locale].placeholder?t.localize("placeholder"):t.appearance.placeholder,t.filtering.filterRow.visible&&(t.$.placeholder.style.top="0px",t.$.placeholder.style.position="relative",t._filters&&t._filters.length&&(t.$.placeholder.style.top="12px")),t._filters&&t._filters.length&&(t.$.placeholder.innerHTML=`<span class="smart-grid-icon show smart-icon-filter" style="\n font-size: calc(2 * var(--smart-font-size));\n cursor: default;\n margin-right: 10px;\n "></span>${t.localize("filteredRecords")}`)),requestAnimationFrame((()=>{t._width=t.offsetWidth,t._height=t.offsetHeight}))}_refreshHeaderBar(){const e=this;e.$.headerBar&&e.header.visible&&e.$.headerBar._refresh()}_resizeHandler(e){const t=this;if((t.enableShadowDOM?e.composedPath()[0]:e.target)===t&&!t._isUpdatingScrollBars){if(!t.isInitialized)return t._undoRedo=[],t._refreshCurrentUser(),void t._render();if(!1===t._resizeHandling||!t.offsetHeight)return void(!1===t._resizeHandling&&(t.layout.isDirty=!0));t._isUpdatingScrollBars=!0,t._autoHeight=!1,t.$.content&&t.$.content.classList.remove("auto-height");const e=t._rowElements?t._rowElements.length*t.layout.rowMinHeight:0;(e>0||"grid"!==t.view&&"card"!==t.view)&&(t.offsetHeight>=e?(t._refreshLayout(),t._initializeRowElements()):"grid"!==t.view&&t._refreshLayout()),t.refresh(),t.$.headerBar&&t.$.headerBar.refreshTools(),t._dialogAddColumn&&t._dialogAddColumn.classList.contains("open")&&t._dialogAddColumn.refresh(),t._isUpdatingScrollBars=!1}}_refreshColumnsResponsiveVisibility(){const e=this,t=e.$.columnContainer,o=e.$.columnNearContainer,l=e.$.columnFarContainer;let a=0,n=0,i=0,r=!1;const s=e.columns.canNotify;e.columns.canNotify=!1;for(let t=0;t<e.viewColumns.length;t++){const o=e.viewColumns[t];o.setProperty("_treeColumn",!1,!1),e.grouping.enabled&&e.grouping.autoHideGroupColumn&&e.dataSource.groupBy&&e.dataSource.groupBy.indexOf(o.dataField)>=0&&o.setProperty("visible",!1,!1),o.visible&&!o.autoGenerated&&!r&&e.dataSource.boundHierarchy&&(o.setProperty("_treeColumn",!0,!1),r=!0)}e._refreshColumnWidths(),e.columns.canNotify=s;let d=0,u=0;for(let t=0;t<e.viewColumns.length;t++){const o=e.viewColumns[t];o.visible&&(o.freeze&&(!0===o.freeze||"near"===o.freeze?(a+=o.computedWidth,o.autoGenerated&&(d+=o.computedWidth)):"far"===o.freeze&&(n+=o.computedWidth,o.autoGenerated&&(u+=o.computedWidth))),i+=o.computedWidth)}t.style.width=i+"px",o.style.width=a+"px",l.style.width=n+"px",l.classList.remove("smart-hidden"),o.classList.remove("smart-hidden"),0===n&&l.classList.add("smart-hidden"),0===a&&o.classList.add("smart-hidden"),l.classList.remove("border-collapse"),n===u&&l.classList.add("border-collapse"),e._autoGeneratedColumnsNearWidth=d,e._autoGeneratedColumnsFarWidth=u,e._computedColumnsWidth=i,e._frozenColumnsNearWidth=a,e._frozenColumnsFarWidth=n}_selectStartHandler(e){const t=this;t.isScrolling||t.editing.isEditing||"grid"!==t.view||t.selection.defaultSelection||e.preventDefault()}setFocusable(e){const t=this;!t.disabled&&e?t.tabIndex=0:t.removeAttribute("tabindex")}_setLoadingIndicatorVisibility(){const e=this;e.appearance.displayLoadingIndicator?e.$.loadingIndicatorContainer.classList.remove("smart-visibility-hidden"):e.$.loadingIndicatorContainer.classList.add("smart-visibility-hidden")}_refreshElementsVisibility(){const e=this,t=function(e,t){e&&(t?e.classList.remove("smart-hidden"):e.classList.add("smart-hidden"))};if(t(e.$.placeholder,!e.rows||e.rows&&0===e.rows.length||0===e.columns.length),t(e.$.footer,e.footer.visible),t(e.$.header,e.header.visible&&!e.header.appendTo),t(e.$.groupHeader,e.groupHeader.visible||e.grouping.groupBar.visible),t(e.$.columnHeader,e.columnHeader.visible&&e.columns.length>0),t(e.$.headerCommandBar,e.editing.commandBar.visible&&"far"!==e.editing.commandBar.position),t(e.$.footerCommandBar,e.editing.commandBar.visible&&"near"!==e.editing.commandBar.position),t(e.$.breadcrumb,e.groupHeader.visible||e.grouping.groupBar.visible),e.htmlColumnLastChild.classList.add("smart-visibility-hidden"),e.pager&&e.pager.visible&&e.paging.enabled)switch(e.pager.position){case"near":t(e.$.headerPager,!0),t(e.$.footerPager,!1);break;case"far":t(e.$.headerPager,!1),t(e.$.footerPager,!0);break;case"both":t(e.$.headerPager,!0),t(e.$.footerPager,!0)}else t(e.$.footerPager,!1),t(e.$.headerPager,!1)}_getId(){const e=this;return e.dataSource&&e.dataSource.id?e.dataSource.id:e.dataSourceSettings.id?e.dataSourceSettings.id:void 0}_refreshRowHierarchy(e,t=!1){const o=this;o.rowHierarchy=null;let l=0,a=!1;if(!o.grouping.enabled&&o.dataSource.groupBy&&o.dataSource.groupBy.length>0&&(a=!0),o.grouping.enabled&&o.dataSource.groupBy&&0===o.dataSource.groupBy.length)return;let n=!1;if(o.grouping.enabled&&o.dataSource.groupBy&&o.dataSource.groupBy.length>0&&o.dataSource.virtualDataSourceOnExpand&&(n=!0),o.dataSource.boundHierarchy){const i=o.dataSource.reservedNames,r=function(e){return new Smart.Grid.Row({data:e,grid:o,index:o.rows.length})};let s=0;const d=function(t,l){for(let u=0;u<t.length;u++){const c=t[u];let m=o.rowById[c.$.id];if(n&&(m=o.rows[s],m||(m=r(c),o.rows.push(m)),c[i.leaf]?m.id=c.$.id:m.id="Group_"+c.$.id,o.rowById[m.id]=m),m||(m=r(c),o.rowById[m.id]=m),m.data=c,m.leaf=c[i.leaf]||!1,m.level=c[i.level],m.groupDataField=c.groupDataField,!m.groupDataField&&o.appearance.showTreeRowHeader&&(m.groupDataField=o.columns[m.level].dataField),m.label=c.label,m.groupDataField){const e=o.columnByDataField[m.groupDataField];if(e&&e.editor.dataSource)for(let t=0;t<e.editor.dataSource.length;t++){const o=e.editor.dataSource[t];if(""+o.value===m.label){void 0!==o.label?(m.label=o.label,m.labelValue=o.value):void 0!==o.name&&(m.label=o.name,m.labelValue=o.value);break}}}if(m.children=[],m.data&&(m.filtered=void 0===m.data.$.filtered||m.data.$.filtered),c.summaryRow&&(m.summaryRow=!0),(null===o._toggledRow||o._toggledRow&&o._toggledRow.id!==m.id)&&(m.expandHeight=0),c.parent?(m.parent=o.rowById[c.parent.$.id],m.parentId=c.parent.$.id):(m.parent=null,m.parentId=null),o.grouping.onGroupDefaultExpanded&&!o.isRendered){const e=o.grouping.onGroupDefaultExpanded(c);e&&(m.expanded=c[i.expanded]=e)}o.appearance.allowRowToggleAnimation||void 0!==c[i.expanded]&&(m.expanded=c[i.expanded]);let g=!!e||m.expanded;a&&(g=!0);const p=o.dataSource&&o.dataSource.id||o.dataSourceSettings.id;if(p&&!m.data[p]&&o.grouping.enabled&&o.dataSource&&o.dataSource.groupBy.length){const e=o.dataSource.groupBy[m.level];c.parent&&c.parent.expanded&&(""===m.data[e]&&o.dataSource.id&&!m.data.data[o.dataSource.id]||m.leaf&&!m.data[p])&&(s++,m.filtered=!1)}if(!0===m.visible&&!1!==m.filtered)if(s++,g||c[i.leaf])if(l.push(m),c.children&&c.children.length>0){const e=d(c.children,new Array);0===e.length&&(m.leaf=!0);for(let t=0;t<e.length;t++)l.push(e[t]);m.children=e}else c.children&&0===c.children.length&&(o.dataSource.virtualDataSource&&o.dataSource.virtualDataSourceOnExpand?m.data._loaded&&(m.leaf=!0):m.leaf=!0);else if(l.push(m),c.children&&c.children.length>0){const e=d(c.children,new Array);0===e.length&&(m.leaf=!0),m.children=e}else c.children&&0===c.children.length&&(o.dataSource.virtualDataSource&&o.dataSource.virtualDataSourceOnExpand?m.data._loaded&&(m.leaf=!0):m.leaf=!0)}return l};let u=o.dataSource.boundHierarchy;if(o.paging.enabled&&!t){let e=[];const t=e=>{let l=[];if(0===o.dataSource.groupBy.length)return e;for(let o=0;o<e.length;o++){const a=e[o];(!a.$||void 0===a.$.filtered||a.$.filtered)&&(l.push(a),a.children&&(l=l.concat(t(a.children))))}return l};if(o.dataSource&&!o.dataSource.virtualDataSource){for(let o=0;o<u.length;o++){let l=u[o],a=!l.$||void 0===l.$.filtered||l.$.filtered;!a&&null!==a||0!==l.level||l.parent||(t(l.children).length,e.push(l))}u=e.slice(o.paging.pageIndex*o._pageSize,(o.paging.pageIndex+1)*o._pageSize)}}const c=o.rows.canNotify;o.rows.canNotify=!1,o.rowHierarchy=d(u,new Array),o.rows.canNotify=c;let m=[];for(let e=0;e<o.rowHierarchy.length;e++){const t=o.rowHierarchy[e],a=t.canNotify;t.leaf&&m.push(t),t.canNotify=!1,o.grouping.enabled&&o.dataSource&&o.dataSource.groupBy.length?t.leaf?t.visibleIndex=l++:t.visibleIndex=-1:t.visibleIndex=l++,t.canNotify=a}if(a&&(o.rowHierarchy=m),o._rowElements.length<o.rowHierarchy.length&&!o._toggledRow&&o._initializeRowElements(),o.grouping.summaryRow.visible&&!o.grouping.summaryRow.inline){const e=function(t,o,l,a){if(0!==t&&o.length>0&&o[o.length-1]&&!o[o.length-1].summaryRow){let e={label:" ",boundSource:[],groupDataField:l.data.groupDataField,$:{},summaryRow:!0,leaf:!0,level:t,expandHeight:0,siblings:o};e.$.id="SubRow"+a+"_"+l.data.$.id,l&&(e.parent=l.data,e.parentId=l.data.$.id),e.data=Object.assign(e),o.push(e)}for(let t=0;t<o.length;t++)o[t]&&o[t].data&&o[t].data.children&&e(o[t].level+1,o[t].data.children,o[t],t)};e(0,o.rowHierarchy,null,0)}}}applyContent(){}_refreshContentHeight(){const e=this;let t=e._clientSize.height;const o=window.scrollY;let l,a,n=!1;if((!e._contentHeight||e._maxHeight||e._autoHeight||e.__autoHeight||"hidden"===e.verticalScrollBarVisibility)&&(n=!0),n&&(l=e.offsetHeight,e.$.container.classList.add("smart-hidden"),a=e.offsetHeight,e.$.container.classList.remove("smart-hidden")),window.scrollY!==o&&window.scrollTo(window.scrollX,o),"hidden"===e.verticalScrollBarVisibility||e.layout.autoHeight||l!==a||e._minHeight&&e._minHeight===l)return t=e._scrollHeight+e.$.columnHeader.offsetHeight+e.$.filterFooter.offsetHeight,e.header.visible&&!e.header.appendTo&&(t+=e.$.header.offsetHeight),e.summaryRow.visible&&(t+=e.layout.rowMinHeight),0===e._recyclingRows.length&&0===e._scrollHeight&&(t+=e.$.scrollView.offsetTop),e._minHeight>t&&(t=e._minHeight),e.$.content.style.height=t+"px",e._contentHeight=t,void(e._maxHeight<t?(e._autoHeight=!1,e.$.content.classList.remove("auto-height"),e.$.content.style.height=e._maxHeight+"px",e.header.visible&&!e.header.appendTo?(e.$.content.style.height=e._maxHeight-e.$.header.offsetHeight+"px",e._contentHeight=e._maxHeight-e.$.header.offsetHeight):e._contentHeight=e._maxHeight):(e._autoHeight=!0,e.__autoHeight=!0,e.$.content.classList.add("auto-height"),e.filtering.filterRow.visible&&(e.filtering.filterRow.visible&&(t+=e.layout.rowMinHeight),e._contentHeight=t,e.$.content.style.height=e._contentHeight+"px"),e.header.visible&&!e.header.appendTo?(e._contentHeight=t-e.$.header.offsetHeight,e.$.content.style.height=e._contentHeight+"px"):e.summaryRow.visible&&(e.$.content.style.height=e._contentHeight+"px")));if(e.header.visible&&!e.header.appendTo&&(t-=e.$.header.offsetHeight),(e.groupHeader.visible||e.grouping.groupBar.visible)&&(t-=e.$.groupHeader.offsetHeight),e.footer.visible&&(t-=e.$.footer.offsetHeight),e.pager.visible&&(t-=e.$.headerPager.offsetHeight,t-=e.$.footerPager.offsetHeight),e.editing.enabled&&e.editing.commandBar.visible&&(t-=e.$.headerCommandBar.offsetHeight,t-=e.$.footerCommandBar.offsetHeight),e.$.content.style.height!==t+"px"&&(e.$.content.style.height=t+"px"),e.$.viewContent.style.height!==t+"px"&&(e.$.viewContent.style.height=t+"px"),e._contentHeight=t,!e.appearance.showViewBar||e.appearance.viewBarAppendTo||e.appearance.showViewBarAsDropdown)e.$.viewBar.classList.add("smart-hidden"),e.$.content.style.width="",e.$.viewContent.style.width="",e.$.content.style.marginLeft="",e.$.viewContent.style.marginLeft="";else{const o=e.layout.viewBarWidth+5;e.$.viewBar.classList.remove("smart-hidden"),e._mobile||(e.$.content.style.width="calc(100% - "+o+"px)",e.$.viewContent.style.width="calc(100% - "+o+"px)",e.$.content.style.marginLeft=o+"px",e.$.viewContent.style.marginLeft=o+"px"),e.$.viewBar.style.width=o+"px";let l=0;e.header.visible&&!e.header.appendTo&&(l+=e.$.header.offsetHeight),(e.groupHeader.visible||e.grouping.groupBar.visible)&&(l+=e.$.groupHeader.offsetHeight),e.pager.visible&&(l+=e.$.headerPager.offsetHeight),e.$.viewBar.style.top=l+"px",e.$.viewBar.style.height=t+"px"}}appendChild(){const e=Array.prototype.slice.call(arguments,2);return HTMLElement.prototype.appendChild.apply(this,e.concat(Array.prototype.slice.call(arguments)))}removeChild(){const e=Array.prototype.slice.call(arguments,2);return HTMLElement.prototype.removeChild.apply(this,e.concat(Array.prototype.slice.call(arguments)))}get _contentBorder(){const e=this;if(e.__contentBorder)return e.__contentBorder;const t=getComputedStyle(e.$.content),o={left:parseFloat(t.borderLeftWidth)+parseFloat(t.borderRightWidth),top:parseFloat(t.borderTopWidth)+parseFloat(t.borderBottomWidth)};return e.__contentBorder=o,o}_refreshAutoSize(){const e=this;if(e.layout.autoWidth){const t=e._isUpdatingScrollBars;e._isUpdatingScrollBars=!0;let o=2;for(let t=0;t<e.viewColumns.length;t++){const l=e.viewColumns[t];l.visible&&(o+=l.computedWidth)}o+=e.$.verticalScrollBar.offsetWidth>0?e.$.verticalScrollBar.offsetWidth:0,e.style.width=o+"px",requestAnimationFrame((()=>{e._isUpdatingScrollBars=t}))}e.layout.autoHeight&&(e.style.height="auto")}_refreshLayout(){const e=this,t=e.rows;if(e._layoutSuspended)return;e._visibleRows=null,e.__viewRows=null,e.__clientSize=null,e.__scrollHeight=null,e.__scrollWidth=null,e.__parentCells=null,e.$.columnFarContainer.classList.remove("vscroll"),e.$.columnNearContainer.classList.remove("vscroll"),e.$.scrollView.classList.remove("hscroll"),e.$.scrollView.classList.remove("vscroll"),e._refreshAutoSize(),e._refreshElementsVisibility(),e._refreshRowHierarchy(),e._refreshColumnHeights(),e._refreshContentHeight();const o=()=>{e.$.placeholder.classList.remove("smart-hidden"),e.$.placeholder.innerHTML=e.messages[e.locale]&&e.messages[e.locale].placeholder?e.localize("placeholder"):e.appearance.placeholder,e._filters&&e._filters.length&&(e.$.placeholder.innerHTML=e.localize("filteredRecords")),e.__filterFooterOffsetHeight||(e.__filterFooterOffsetHeight=e.$.filterFooter.classList.contains("smart-hidden")?0:e.$.filterFooter.offsetHeight),!e.__columnHeaderHeight&&e.$.columnHeader.offsetHeight&&(e.__columnHeaderHeight=e.$.columnHeader.offsetHeight);let t=e._contentHeight-e.__filterFooterOffsetHeight-e.__columnHeaderHeight;e.$.scrollView.style.height=t+"px",e.scrollWidth=0,e.scrollHeight=0,e.clearSelection(),e._showAddNewRowButton("float"),e.$.content.classList.contains("auto-height")&&(e.$.placeholder.style.height=t+"px")};if(t&&t.url)e._showAddNewRowButton("float");else{if(!t||null===t||0===t.length||0===e.columns.length)return o(),0!==e.columns.length&&e.hasVisibleColumn()?e.editing.addNewColumn._addButton&&e.editing.addNewColumn._addButton.classList.remove("show"):(e._showAddNewColumnButton(),e.$.columnHeader.classList.add("smart-hidden"),e.__columnHeaderHeight=0),void e._refreshScrollBars();e._showAddNewRowButton("float"),e.editing.addNewColumn._addButton&&e.editing.addNewColumn._addButton.classList.remove("show")}0!==e.columns.length&&e.hasVisibleColumn()?e.editing.addNewColumn._addButton&&e.editing.addNewColumn._addButton.classList.remove("show"):(o(),0!==e.columns.length&&e.hasVisibleColumn()||(e._showAddNewColumnButton(),e.$.columnHeader.classList.add("smart-hidden"),e.__columnHeaderHeight=0),e._showAddNewColumnButton()),"card"===e.view&&(e.__columnHeaderHeight=0),!e.__columnHeaderHeight&&e.$.columnHeader.offsetHeight&&(e.__columnHeaderHeight=e.$.columnHeader.offsetHeight),e.__filterFooterOffsetHeight||(e.__filterFooterOffsetHeight=e.$.filterFooter.classList.contains("smart-hidden")?0:e.$.filterFooter.offsetHeight);let l=e._contentHeight-e.__filterFooterOffsetHeight-e.__columnHeaderHeight;if(e.$.scrollView.style.height=l+"px",e.htmlColumnLastChild.style.height=e.__columnHeaderHeight+"px",e.paging.spinner.enabled&&e.paging.enabled){if(!e.pageScroll){const t=document.createElement("smart-scroll-bar");t.orientation="vertical",t.style.height="100%",t.style.width="100%",t.max=Math.ceil(e.dataSource.length/e._pageSize),t.step=e.paging.spinner.step,t.largeStep=e.paging.spinner.step,t.setAttribute("spinner",""),t.setAttribute("smart-id","spinner"),t.ownerElement=e,e.addPropertyBinding("[[paging_spinner_step]]","step",t,e.$.columnHeader),t.addEventListener("change",(function(t){e.paging.pageIndex=t.detail.value,e._refreshLayout(),e._refreshSelection(),e.dataSource&&e.dataSource.virtualDataSource?e._virtualDataRequest("pageIndexChange"):(e._recycle(),e._scrollUpdate&&clearTimeout(e._scrollUpdate),e._scrollUpdate=setTimeout((function(){e.isScrolling||(e.$.rowContainer.style.top=parseInt(e.$.rowContainer.style.top)+.01+"px")}),50))})),e.pageScroll=t}e.htmlColumnLastChild.appendChild(e.pageScroll)}else e.htmlColumnLastChild.innerHTML="";e._refreshScrollBars()}_refreshScrollBars(){const e=this;if(!e._scrollView)return;const t=e._scrollView.vScrollBar,o=e._scrollView.hScrollBar,l=e._contentHeight-e.__filterFooterOffsetHeight-e.__columnHeaderHeight,a=e.$.scrollView.offsetWidth,n=e._scrollWidth-a-e._contentBorder.left,i=e._scrollHeight-l-e._contentBorder.top,r=e._columnNearContainerComputedStyle?e._columnNearContainerComputedStyle:getComputedStyle(e.$.columnNearContainer),s=e._columnFarContainerComputedStyle?e._columnFarContainerComputedStyle:getComputedStyle(e.$.columnFarContainer),d=parseInt(e.$.columnNearContainer.style.width)+parseInt(r.borderRightWidth),u=parseInt(e.$.columnFarContainer.style.width)+parseInt(s.borderLeftWidth);if(e.__frozenNearWidth=d,e.__frozenFarWidth=u,e._columnNearContainerComputedStyle=r,e._columnFarContainerComputedStyle=s,e._refreshHorizontalScrollBarVisibility(n),e._refreshVerticalScrollBarVisibility(i),t.style.height=l+"px",e.computedVerticalScrollBarVisibility?(e.__scrollBarSize||(e.__scrollBarSize=t.offsetWidth),e.__scrollWidth+=e.__scrollBarSize,e._refreshHorizontalScrollBarVisibility(e._scrollWidth-a-1),e.rightToLeft?e.$.columnNearContainer.classList.add("vscroll"):e.$.columnFarContainer.classList.add("vscroll"),e._refreshVerticalScrollBarVisibility(i),e.htmlColumnLastChild.classList.remove("smart-visibility-hidden"),e.$.scrollView.classList.add("has-vscroll")):e.$.scrollView.classList.remove("has-vscroll"),o.style.width=a+"px",e.rightToLeft?o.style.right="0px":o.style.left="0px",e.computedVerticalScrollBarVisibility&&e.computedHorizontalScrollBarVisibility&&(o.style.width=a-t.offsetWidth+"px",t.style.height=l-o.offsetHeight+"px"),e.computedHorizontalScrollBarVisibility?(e.$.scrollView.classList.add("hscroll"),e._autoHeight?(e.$.content.style.height="auto",e.$.scrollView.style.height="auto",e.$.scrollView.style.paddingBottom=o.offsetHeight+"px",e.$.placeholder.style.marginTop=o.offsetHeight+"px",e.summaryRow.visible&&(e.$.scrollView.style.paddingBottom=o.offsetHeight+e.layout.rowMinHeight+"px"),e.filtering.enabled&&e.filtering.filterRow.visible&&(e.$.scrollView.style.paddingBottom=o.offsetHeight+e.layout.rowMinHeight+"px")):(e.$.scrollView.style.paddingBottom="",e.$.placeholder.style.marginTop="")):e.$.scrollView.classList.remove("hscroll"),(e.__frozenNearHeight>0||e._frozenNearRows&&e._frozenNearRows.length>0)&&!e.appearance.showVerticalScrollBarOnFixedColumns){const o=getComputedStyle(e.$.rowNearContainer),l=e.__frozenNearHeight+parseInt(o.borderBottomWidth);t.style.height=parseInt(t.style.height)-l+"px",t.style.top=l+"px",t.style.setProperty("--smart-scroll-bar-near-size",l+"px")}else e.appearance.showVerticalScrollBarOnFixedColumns&&(t.style.top="0px");if((e.__frozenFarHeight>0||e._frozenFarRows&&e._frozenFarRows.length>0)&&!e.appearance.showVerticalScrollBarOnFixedColumns){const o=getComputedStyle(e.$.rowFarContainer),l=-2+e.__frozenFarHeight+parseInt(o.borderTopWidth);t.style.height=parseInt(t.style.height)-l+"px",t.style.setProperty("--smart-scroll-bar-far-size",l+"px"),0===e.__frozenNearHeight&&(t.style.top="0px")}(d>0||u>0)&&!e.appearance.showHorizontalScrollBarOnFixedColumns&&(o.style.width=parseInt(o.style.width)-d-u+"px",e.rightToLeft?o.style.right=d+"px":o.style.left=d+"px",o.style.setProperty("--smart-scroll-bar-near-size",d+parseInt(r.borderRightWidth)+"px"),o.style.setProperty("--smart-scroll-bar-far-size",u+parseInt(r.borderLeftWidth)+"px"),e.computedVerticalScrollBarVisibility&&(e.__scrollBarSize||(e.__scrollBarSize=t.offsetWidth),o.style.setProperty("--smart-scroll-bar-far-size",u+e.__scrollBarSize+"px"))),t.refresh(),o.refresh(),e._mobile&&(e._scrollContentView.style.width=e.$.scrollView.offsetWidth+e._scrollView.scrollWidth+"px",e._scrollContentView.style.height=e.$.scrollView.offsetHeight+e._scrollView.scrollHeight+"px")}_refreshHorizontalScrollBarVisibility(e){const t=this;t.scrollWidth=e,t.computedHorizontalScrollBarVisibility||(t.scrollLeft=0)}_refreshVerticalScrollBarVisibility(e){const t=this;if(t._autoHeight)return t.scrollTop=0,void(t.scrollHeight=0);t.computedHorizontalScrollBarVisibility&&(e+=t.$.horizontalScrollBar.offsetHeight),t.scrollHeight=e,t.paging.enabled&&t.paging.spinner.visible&&t.$.verticalScrollBarVisibility.classList.remove("smart-hidden"),t.computedVerticalScrollBarVisibility||(t.scrollTop=0)}_styleChangedHandler(e){const t=this;if(!e.detail.styleProperties.overflow&&!t.classList.contains("smart-grid-resize-mode")){if(e.detail.styleProperties["grid-template-columns"])return t._templateColumns(),void t.refresh();if(e.detail.styleProperties["font-size"])return t.layout.isDirty=!0,t._resetCachedLayout(),void t.refresh();(e.detail.styleProperties["--smart-grid-row-height"]||e.detail.styleProperties["--smart-font-size"]||e.detail.styleProperties["--smart-grid-column-header-height"]||e.detail.styleProperties["--smart-grid-group-header-height"]||e.detail.styleProperties["--smart-grid-filter-footer-height"]||e.detail.styleProperties["--smart-grid-group-row-vertical"]||e.detail.styleProperties["--smart-grid-group-row-horizontal-offset"]||e.detail.styleProperties["--smart-grid-freeze-splitter-size"]||e.detail.styleProperties["--smart-grid-resize-line-size"]||e.detail.styleProperties["--smart-grid-footer-height"]||e.detail.styleProperties["--smart-grid-header-height"])&&(t.layout.isDirty=!0),t.offsetWidth&&t.offsetHeight>0&&(t._resetCachedLayout(),t._refreshLayout(),t._recycle())}}_resetCachedLayout(){const e=this;delete e._columnHeights,e.__cellsCommandTemplate=null,e.__autoRowHeight=null,e.__autoHeightRows=null,e.__measuredColumnHeight=null,e.__columnHeaderHeight=null,e.__filterFooterOffsetHeight=null}_swipeLeftHandler(){}_swipeRightHandler(){}_getRowIndexByPosition(e){const t=this;return(o=>{let l=0,a=o.length-1;if(e<=0)return 0;const n=o[o.length-1];if(-1!==n.top&&n.top<=e)return o.length-1;for(;;){const n=Math.floor((l+a)/2),i=o[n];if(t._isRowInPosition(i,e))return n;i.top<e?l=n+1:i.top>e?a=n-1:l=n+1}})(t._recyclingRows)}_getVirtualRowIndexByPosition(e){let t=this.rows[0].height;const o=(e,o)=>0!==t&&e<=o&&e+t>o;return(l=>{let a=0,n=l.length-1;if(e<=0)return 0;const i=(l.length-1)*t;if(-1!==i&&i<=e)return l.length-1;for(;;){const l=Math.floor((a+n)/2),i=l*t;if(o(i,e))return l;i<e?a=l+1:i>e?n=l-1:a=l+1}})(this.dataSource)}getRows(){return this.getViewRows()}getViewRows(){const e=this;return e.rowHierarchy?e.rowHierarchy:e.getVisibleRows()}getData(){const e=this;if(!e.dataSource)return[];const t=[];for(let o=0;o<e.dataSource.length;o++){const l=e.dataSource[o];if(l.$){const o={};for(let t=0;t<e.dataSource.dataFields.length;t++){const a=e.dataSource.dataFields[t].name;o[a]=l[a]}t.push(o)}else t.push(l)}return t}getDataFields(){const e=this;return e.columns?e.columns.map((e=>e.dataField)):[]}getColumns(){const e=this,t=[];if(!e.isInitialized)return t;if(e.columns)for(let o=0;o<e.columns.length;o++){const l=e.columns[o].getState();t.push(l)}return t}resetState(){const e=this;e._isUpdating=0,e.beginUpdate(),e.clearSort(),e.clearFilter(),e.clearGroups(),e.clearSelection(),e._conditionalColors&&(e._conditionalColors.colors=[],e._conditionalColors.conditions=[],e._conditionalColors.type="conditions",e._conditionalColors.singleSelect="",e._conditionalColors.decorate="border"),e.$.headerBar&&delete e.$.headerBar._appliedColors,e.columns.canNotify=!1;let t=[],o=!1;for(let l=0;l<e.columns.length;l++){const a=e.columns[l];a.visible=!0,a.width=180,a.freeze=!1,a.index>=0?t[a.index]=a:t.push(a),a.index!==l&&(o=!0)}o&&(e.columns=t),"grid"!==e.view&&(e.view="grid",e._hideKanbanView()),e.columns.canNotify=!0,e._scrollView.scrollLeft=e._scrollView.scrollTop=0,e.paging.enabled&&(e.paging.pageIndex=0),e.$.headerBar&&e.$.headerBar._setView&&e.$.headerBar._setView("grid"),e._kanban&&e._kanban._reset(),e.layout.isDirty=!0,e.endUpdate(),o&&(e._renderColumns(),e._refreshHeaderBar())}_loadState(e){const t=this;let o=!1;t.stateSettings.loading=!0;let l=!1,a=!1;if("grid"===e.view||"card"===e.view){if(e.expandedRows&&Object.keys(e.expandedRows).length>0){o=!0,t.beginUpdate();const l=[];if(e.groups){t.dataSource.groupBy=e.groups,t._groups=[].concat(t.dataSource.groupBy.toArray())||[],t._refreshRowHierarchy();for(let o in e.expandedRows)l["Item"+o.replaceAll(".","_")]=!0,t._expandCollapseGroup(o,!0)}t.dataSource&&(t.dataSource._expandedRowIds=l)}else if(e.groups&&e.groups.length){o=!0,t.beginUpdate();const l=[];t.dataSource&&(t.dataSource._expandedRowIds=l),e.groups&&(t.dataSource.groupBy=e.groups,t._refreshRowHierarchy())}else if(e.groups&&0===e.groups.length&&t.dataSource.groupBy.length>0){o=!0,t.beginUpdate();const e=[];t.dataSource&&(t.dataSource._expandedRowIds=e),t.dataSource.groupBy=[],t._refreshRowHierarchy(),a=!0}if(e.paging&&t.paging.enabled&&(t.paging.index=e.paging.index,t.paging.size=e.paging.size),e.colors&&(t._conditionalColors=JSON.parse(JSON.stringify(e.colors)),t.$.headerBar)){let o=[];for(let t=0;t<e.colors.conditions.length;t++){let l=e.colors.conditions[t],a=[];for(let e in l)a.push(l[e]);o.push(a)}t.$.headerBar._appliedColors=[o,{type:e.colors.type,singleSelect:e.colors.singleSelect,decorate:e.colors.decorate}]}if(e.columns&&e.columns.length>0){o||(o=!0,t.beginUpdate());for(let o=0;o<e.columns.length;o++){const a=e.columns[o];if(a.dataField){const e=t.columnByDataField[a.dataField];if(e){const o=e.canNotify;e.canNotify=!1,a.width?e.width=a.width:e.width=180,e.visible=void 0===a.visible||a.visible,e._state&&(e._state.visible=void 0===a.visible||a.visible,e._state.freeze=void 0!==a.freeze&&a.freeze,e._state.width=a.width?a.width:180);const n=e.freeze;e.freeze=void 0!==a.freeze&&a.freeze,n!==e.freeze&&(l=!0,e.freeze||t._frozenNearColumns.indexOf(e)),e.canNotify=o}}}}}if(e.sort&&Object.keys(e.sort).length>0){o||(o=!0,t.beginUpdate());const l=t.appearance.allowSortAnimation;t.appearance.allowSortAnimation=!1;let a=t.columns.canNotify;t.columns.canNotify=!1;for(let e=0;e<t.columns.length;e++)t.columns[e].sortOrder="";t.columns.canNotify=a;for(let o in e.sort)if(e.sort[o]){const l=e.sort[o].sortOrder,a=t.columnByDataField[o];t.sortBy(a.dataField,l)}t.appearance.allowSortAnimation=l}if(e.filter&&Object.keys(e.filter).length>0){o||(o=!0,t.beginUpdate());for(let o in e.filter){const l=e.filter[o];if(l){t.addFilter(o,l,!1);const e=t.columnByDataField[o];e&&e._filterInfo&&e.filter&&e.filter.filters&&e.filter.filters[0]&&(e._filterInfo.value=e.filter.filters[0].value,e._filterInfo.condition=e.filter.filters[0].condition)}}if(t.filtering.filterRow)for(let e=0;e<t.columns.length;e++)t.columns[e]._filterEditorInitialized&&(t.columns[e]._filterEditorInitialized=!1)}if(o){t.endUpdate(!1,!1);let o=!1;e.view&&"kanban"===e.view&&(o=!0),l&&(o=!1,a=!0,t._renderColumns()),o||(a?t.refresh(!0):t._refresh())}let n=!1;e.kanban&&e.kanban.stackedBy&&(void 0===t._stackedBy&&(t._stackedBy=e.kanban.stackedBy),t._stackedBy!==e.kanban.stackedBy&&(n=!0),t._stackedBy=e.kanban.stackedBy),(n||e.view&&t.view!==e.view)&&t.$.headerBar&&t.$.headerBar._setView&&(e.name&&(t.stateSettings.current=e.name),t.$.headerBar._setView(e.view,!0)),e.filter&&Object.keys(e.filter).length>0&&t.refreshFilters(),e.name&&(t.stateSettings.current=e.name),t._refreshHeaderBar(),t.stateSettings.loading=!1}loadState(e){const t=this;if(e){if(t.stateSettings.loading=!0,t._isUpdating=0,t.beginUpdate(),t.clearSort(),t.clearFilter(),t.clearGroups(),t.clearSelection(),t._conditionalColors&&(t._conditionalColors.colors=[],t._conditionalColors.conditions=[],t._conditionalColors.type="conditions",t._conditionalColors.singleSelect="",t._conditionalColors.decorate="border"),t.$.headerBar&&delete t.$.headerBar._appliedColors,t._scrollView.scrollLeft=t._scrollView.scrollTop=0,t.paging.enabled&&(t.paging.pageIndex=0),t.endUpdate(!1,!1),"string"==typeof e){const o=t.stateSettings.storage[e];o&&t._loadState(o)}else t._loadState(e);t.stateSettings.loading=!1}else if(!t.stateSettings.autoSave){let e=t.getCurrentState();e&&t.loadState(e)}}saveState(e,t){const o=this;let l=o.getCurrentState(),a=t;!t&&o.stateSettings.options.length&&(t=o.stateSettings.options);const n=o.getState(t);let i;if(e?(i=e,o.stateSettings.current||(o.stateSettings.current=e)):i=o.stateSettings.current?o.stateSettings.current:o.stateSettings.current="View 1",l&&a)for(let e in a)l[a[e]]=n[a[e]];else l=n;function r(e,t=0,o=10){if(t>o)return"Object";const l={};if(e&&e instanceof Smart.FilterGroup)return e=e.toString();for(let a in e){let n=e[a];if(n instanceof Node)n={id:n.id};else if(n instanceof Window)n="Window";else if(n instanceof Date)n=n.toJSON();else{if(n&&Array.isArray(n)&&void 0!==n[0]&&("string"==typeof n[0]||"number"==typeof n[0]||n[0]instanceof Date||"boolean"==typeof n[0])){l[a]=n;continue}if(n&&Array.isArray(n)&&0===n.length){l[a]=n;continue}if(n&&n&&Array.isArray(n)&&void 0!==n[0]&&"object"==typeof n[0]&&"path"!==a&&!(n[0]instanceof HTMLElement))for(let e=0;e<n.length;e++)n[e]=r(n[e],t+1,o);else n instanceof Object&&(n=r(n,t+1,o))}l[a]=n}return t?l:JSON.stringify(l)}l.name=i,o.stringify_object=r;const s=r(l);return o.stateSettings.allowLocalStorage&&window.localStorage.setItem(i,s),o.stateSettings.storage||(o.stateSettings.storage={}),o.stateSettings.storage[o.stateSettings.current]&&!l.date&&o.stateSettings.storage[o.stateSettings.current].date?l.date=o.stateSettings.storage[o.stateSettings.current].date:l.date=(new Date).toJSON(),o.stateSettings.storage[o.stateSettings.current]=l,o.stateSettings.onStateChange&&(o._isUpdating<=0||void 0===this._isUpdating)&&o.isCompleted&&o.stateSettings.onStateChange(l,i,o.stateSettings.storage,r),l}autoSaveState(){const e=this;if(!e.stateSettings.current&&e.stateSettings.autoSave&&!e.stateSettings.loading){const t=e.stateSettings.storage;if(t&&0===Object.keys(t).length||!t){const t=e.localize("newGrid")+" "+e.localize("view");e.stateSettings.current=t}}e.stateSettings.autoSave&&e.stateSettings.current&&!e.stateSettings.loading&&e.saveState()}getCurrentState(){const e=this,t=e.stateSettings.current;return e.stateSettings.storage||(e.stateSettings.storage={}),e.stateSettings.storage[t]?e.stateSettings.storage[t]:null}setColors(e,t,o,l,a){const n=this;n._conditionalColors={type:t,colors:e,decorate:o,conditions:l,singleSelect:a},n.$.headerBar._appliedColors=[l,{type:t,singleSelect:a,decorate:o}],n._recycle(!1)}getColors(){const e=this;if(e._conditionalColors){const t=JSON.parse(JSON.stringify(e._conditionalColors));return{type:t.type,conditions:t.conditions,filters:t.filters,colors:t.colors,decorate:t.decorate,singleSelect:t.singleSelect}}return null}getState(e){const t=this;if(e&&!e.includes)return;const o=!e||e&&e.includes("sort")?t.getSortedColumns():null,l=!e||e&&e.includes("filter")?t.getFilteredColumns():null,a=!e||e&&e.includes("groups")?t.getGroups():null,n=!e||e&&e.includes("selection")?t.getSelectedCells():null,i=!e||e&&e.includes("selection")?t.getSelectedRows():null,r=!e||e&&e.includes("pager")?t.$.headerPager.querySelector("smart-pager"):null,s=!e||e&&e.includes("colors")?t.getColors():null;let d=0;r&&(d=r.pagesCount);const u={sort:o,filter:l,groups:a,paging:{count:d,index:t.paging.pageIndex,size:t._pageSize},selectedCells:n,selectedRows:i};s&&(delete s.colors,u.colors=s),(t.header.visible&&t.header.buttons.indexOf("views")>=0||t.header.buttons.indexOf("states")>=0)&&(u.kanban=t.getKanbanState(),u.view=t.view);const c=[];if(!e||e&&e.includes("columns")){for(let e=0;e<t.columns.length;e++){const o=t.columns[e];c.push({dataField:o.dataField,width:o.computedWidth,visible:o.visible,freeze:o.freeze})}u.columns=c}if((!e||e&&e.includes("expandedRows"))&&t.dataSource&&t.dataSource._expandedRowIds){let e={};for(let o in t.dataSource._expandedRowIds){let t=""+o;t=t.replace("Item","").replace(/_/gi,"."),e[t]=!0}u.expandedRows=e}if(e){const t={};for(let o in e){const l=e[o];u[l]&&(t[l]=u[l])}return t}return u}get _pageSize(){const e=this;return e.dataSource&&e.grouping.enabled&&e.dataSource.groupBy.length>0?e.paging.pageHierarchySize:e.paging.pageSize}get _recyclingRows(){const e=this;if(e.rowHierarchy)return e.rowHierarchy;let t=e.getVisibleRows();if(e.paging.enabled)if(e.dataSource.virtualDataSource)t=t.slice(0,e._pageSize);else if(t=t.slice(e.paging.pageIndex*e._pageSize,(e.paging.pageIndex+1)*e._pageSize),e.editing.addNewRow&&e.editing.addNewRow.visible&&"button"!==e.editing.addNewRow.displayMode){let t=e.getVisibleRows();return t=0===e.paging.pageIndex&&"far"!==e.editing.addNewRow.position?t.slice(1+e.paging.pageIndex*e._pageSize,1+(e.paging.pageIndex+1)*e._pageSize):0===e.paging.pageIndex&&"far"===e.editing.addNewRow.position?t.slice(e.paging.pageIndex*e._pageSize,1+(e.paging.pageIndex+1)*e._pageSize):t.slice(1+e.paging.pageIndex*e._pageSize,1+(e.paging.pageIndex+1)*e._pageSize),[].concat(e._frozenNearDefaultRows,t,e._frozenFarDefaultRows)}return t}_isRowInPosition(e,t){const o=e.top,l=e.top+e.height,a=o<=t&&l>t;return 0!==e.height&&a}_renderColumnGroupHeaders(){const e=this;for(let t=0;t<e._columnGroups.length;t++){const o=e._columnGroups[t];o.column.render(),o.column.allowReorder=!1,o.column.element.setAttribute("columnHeader",""),o.column.element.setAttribute("level",o.level),0===o.columns.length&&o.column.element.classList.add("smart-hidden"),0===t&&0===e.columns.indexOf(o.columns[0])&&o.column.element.classList.add("smart-grid-column-border-collapse")}}hasVisibleColumn(){const e=this;for(let t=e.viewColumns.length-1;t>=0;t--){const o=e.viewColumns[t];if(o.visible&&!o.autoGenerated)return!0}return!1}_isLastVisibleColumn(e){const t=this;for(let o=t.viewColumns.length-1;o>=0;o--){const l=t.viewColumns[o];if(l.visible)return l===e}return!1}_clearCachedTemplates(){const e=this;if(e._cachedTemplates&&Object.keys(e._cachedTemplates).length>0){e._tableCachedTemplates||(e._tableCachedTemplates=document.createElement("div"),e._tableCachedTemplates.style.display="none",document.body.appendChild(e._tableCachedTemplates));const t=document.createDocumentFragment();for(let o in e._cachedTemplates)t.appendChild(e._cachedTemplates[o]);e._tableCachedTemplates.appendChild(t)}}_recycle(e,t,o,l){const a=this;if(a._layoutSuspended||!1===a.isAttached)return;if(a._isUpdating)return;if(a.editing.isEditing&&(!0!==a._disableEndEdit&&a.endEdit(),a._isUpdating))return;a._recycleValues=void 0===o||o,a._removeCellContentPopup(),a._inputOverlay&&(a._inputOverlay.parentNode&&a._inputOverlay.parentNode.removeChild(a._inputOverlay),a._inputOverlay=null),a._selection.selectionRect&&a._refreshCellSelectionRect();const n=a._scrollView.scrollTop;let i,r=l||a._getRowIndexByPosition(n),s=a._recyclingRows,d=s[r],u=d?d.top:0,c=0,m=0,g=0,p=0;if(a._cellRowSpan&&a._cellRowSpan.maxSpan>0){let e=0;if(r>=5?e=5:r>=4?e=4:r>=3?e=3:r>=2?e=2:r>=1&&(e=1),e>0){const t=s[r-e];t&&(d=t,u=d?d.top:0,g=e*d.height,r-=e)}}a._cellRowSpan=[];for(let e=0;e<a._cellsMerge.length;e++){const t=a._cellsMerge[e],o=s.indexOf(t.row);if(r>o&&r<=o+t.rowSpan&&(r=o,d=t.row,g=Math.max(g,u-d.top),u=d.top,a.$.rowContainer.style.top=a.__frozenNearHeight-n+u+"px"),t.colSpan>1)for(let e=0;e<a.viewColumns.length;e++){const o=a.viewColumns[e];let l=o.autoGenerated?o:a.columnByDataField[o.dataField];if(l.visible&&l.left+l.computedWidth-a._scrollView.scrollLeft>=c&&l.left-l.computedWidth-a._scrollView.scrollLeft<a._clientSize.width){let e=a.columnByDataField[t.column.dataField];p=Math.max(p,l.left-e.left+l.computedWidth);break}}}a.isHScrolling&&a._clearCachedTemplates();let h=null;if(!1!==e||a._cellsMerge.length>0){if(a._columnElements)for(let e=0;e<a._columnElements.length;e++){const t=a._columnElements[e];if(!t.parentNode)break;t.set("column",null,!1),t.classList.add("smart-visibility-hidden")}for(let e=0;e<a._columnGroups.length;e++){const t=a._columnGroups[e],o=t.element;o&&(a.rightToLeft?o.style.right=t.right+"px":o.style.left=t.left+"px",o.style.width=t.computedWidth+"px")}a._firstVisibleColumn=null,a._firstVisibleUserColumn=null,a._lastVisibleColumn=null;for(let e=0;e<a.viewColumns.length;e++){let t=a.viewColumns[e];if(t.visible&&(a._firstVisibleColumn||(a._firstVisibleColumn=t),a._firstVisibleUserColumn||t.autoGenerated||(a._firstVisibleUserColumn=t),a._lastVisibleColumn=t),t.element&&(t===a._firstVisibleColumn||t.rowDetailColumn?t.element.classList.add("smart-grid-column-border-collapse"):t.element.classList.remove("smart-grid-column-border-collapse"),!1!==a.appearance.showColumnGroupCellLines&&!1!==a.appearance.showColumnGroupLines||(t.parent&&t.parent.columns&&t.parent.columns[0].dataField===t.dataField?t.element.setAttribute("column-group-first-child",""):t.parent&&t.element.removeAttribute("column-group-first-child")),t.element.removeAttribute("aria-colindex")),t.freeze){if(!0!==t.freeze&&"near"!==t.freeze||t.visible&&(c+=t.computedWidth),!t.element)continue;t.visible?(t.element.classList.remove("smart-visibility-hidden"),t.render()):t.element.classList.add("smart-visibility-hidden")}else if(t.visible&&t.left+t.computedWidth-a._scrollView.scrollLeft>=c-p&&t.left-t.computedWidth-a._scrollView.scrollLeft<a._clientSize.width){a._columnElements||(a._columnElements=[]);const o=a._columnElements[m++];o&&(o.set("column",t,!1),o.parentNode||a.$.columnContainer.appendChild(o),h||(h=t,a._firstRenderedColumn=t),t.element=o,t.render(),o.setAttribute("aria-colindex",e+1),void 0===i&&(i=t.left))}}}if(void 0===i&&(i=0),a.rightToLeft){const e=a._scrollView.scrollWidth-a._scrollView.scrollLeft-a._scrollView.vScrollBar.offsetWidth;a.$.columnContainer.style.right=e+"px",e<=0&&!a._scrollView.scrollWidth&&(a.$.columnContainer.style.right=-a.offsetWidth+a._computedColumnsWidth+"px")}else a.$.columnContainer.style.left=-a._scrollView.scrollLeft+"px";if(a.$.rowContainer.style.top=a.__frozenNearHeight-n+u+"px",a.isScrolling&&!a.isHScrolling&&(a._scrollUpdate&&clearTimeout(a._scrollUpdate),a._scrollUpdate=setTimeout((function(){a.isScrolling||(a.$.rowContainer.style.top=parseInt(a.$.rowContainer.style.top)+.01+"px")}),50)),!1===t)return;if(!a._rowElements)return;const f=a.dataSource&&a.dataSource.virtualDataSource&&!a.dataSource.virtualDataSourceOnExpand&&a.dataSource.length>a.virtualModeCachedRowsCount&&"infinite"!==a.scrolling;if(r>=0){m=0;let e=Math.max(a._clientSize.height,a._overflowOffset),t=0;f&&(a.rowById=[],a.rows&&a.rows.length>0&&void 0===a.rows[a.rows.length-1].top&&(a.rows[a.rows.length-1].top=(a.rows.length-1)*a.rows[0].height),a.rows&&a.rows.length>0&&(t=a._getVirtualRowIndexByPosition(n),u=t*a.rows[0].height,a.$.rowContainer.style.top=a.__frozenNearHeight-n+u+"px",a.paging.enabled||(r=0)),a.paging.enabled&&(t=a.paging.pageIndex*a._pageSize)),"card"===a.view&&a._cardHeight&&(e+=a._cardHeight);for(let o=r;o<s.length;o++){const l=s[o];if(0===l.height||!l.visible||!1===l.filtered||l.freeze&&l.visible)continue;const i=l.height;if(l.expandHeight&&(e+=a.offsetHeight+l.expandHeight),!(u+i>=n-g&&u<=n+e||a._autoHeight))break;{const e=a._rowElements[m++];if(!e)break;if(e.setAttribute("aria-rowindex",t+o+1),l.element=e,l.grid=a,f){if(l.index=o+t,l.visibleIndex=o+t,a.selection.enabled&&a._selection){const e=a._selection.indexes,t=l.canNotify;l.canNotify=!1,l.selected=e.indexOf(l.index)>=0,l.canNotify=t}a.paging.enabled?(l.data=a.dataSource[r+m-1],l.data&&(l.id=l.data.$.id,a.rowById[l.id]=l)):(l.data=a.dataSource[m-1],l.data&&(l.id=l.data.$.id,a.rowById[l.id]=l))}l.render()}u+=i}}a._renderFrozenRows();let y=m;if(m<a._rowElements.length)for(let e=m;e<a._rowElements.length;e++){const e=a._rowElements[m++];e.classList.add("smart-hidden"),e.removeAttribute("aria-rowindex")}a.editing.addNewRow&&a.editing.addNewRow.visible&&"button"===a.editing.addNewRow.displayMode&&a._rowElements[y]&&(a._newRow||(a._newRow=new Smart.Grid.Row({data:{},index:9999999,grid:a,addNewRow:!0,inline:!0,autoGenerated:!0})),a._newRow.element=a._rowElements[y],a._newRow.element.classList.remove("smart-hidden"),a._newRow.render()),f&&a._selection.selectionRect&&a._refreshCellSelectionRect()}_renderFrozenRows(){const e=this;let t=!1,o=!1;if("card"===e.view)return e.$.rowNearContainer.classList.add("smart-hidden"),void e.$.rowFarContainer.classList.add("smart-hidden");0===e._frozenNearRows.length?e.$.rowNearContainer.classList.add("smart-hidden"):e.$.rowNearContainer.classList.remove("smart-hidden");for(let o=0;o<e._frozenNearRows.length;o++){const l=e._frozenNearRows[o];l.visible||(l.element=e.$.rowNearContainer.children[o],l.element||(l.element=l.createElement(),e.$.rowNearContainer.appendChild(l.element)),l.element.classList.add("smart-hidden")),l.visible&&l.filtered&&(t=!0,l.element=e.$.rowNearContainer.children[o],l.element||(l.element=l.createElement(),e.$.rowNearContainer.appendChild(l.element)),l.render())}t||e.$.rowNearContainer.classList.add("smart-hidden"),0===e._frozenFarRows.length?e.$.rowFarContainer.classList.add("smart-hidden"):e.$.rowFarContainer.classList.remove("smart-hidden");for(let t=0;t<e._frozenFarRows.length;t++){const l=e._frozenFarRows[t];l.visible&&(o=!0),l.element=e.$.rowFarContainer.children[t],l.element||(l.element=l.createElement(),e.$.rowFarContainer.appendChild(l.element)),l.render()}o||e.$.rowFarContainer.classList.add("smart-hidden"),0!==e.columns.length&&e.hasVisibleColumn()||(e.$.rowNearContainer.classList.add("smart-hidden"),e.$.rowFarContainer.classList.add("smart-hidden"));const l=e.rows;l&&null!==l&&0!==l.length||(e.$.rowNearContainer.classList.add("smart-hidden"),e.$.rowFarContainer.classList.add("smart-hidden"),e._filters&&e._filters.length&&e.filtering.filterRow.visible&&e.$.rowNearContainer.classList.remove("smart-hidden"))}_recycleRotate(e,t,o,l,a){const n=t.getBoundingClientRect(),i=e.getBoundingClientRect();let r=0,s=0;return 0===i.width?(e.innerHTML=a,!1):(n.left>i.left&&(r=i.left-n.left),n.top<i.top&&(s=i.top-n.top),"left"!==o&&""!==o||(r=4),"center"===o&&(r+=i.width/2-n.width/2),"right"===o&&(r+=i.width-n.width-4),"top"!==l&&""!==l||(s=4),"center"!==l&&"middle"!==l||(s+=i.height/2-n.height/2),"bottom"===l&&(s+=i.height-n.height-4),t.style.left=r+"px",t.style.top=s+"px",!0)}_virtualDataRequest(e,t){const o=this;let l=-1,a=-1;if(!o._rowElements&&"infinite"!==o.scrolling)return;if("virtual"===o.scrolling){for(let e=0;e<o._rowElements.length;e++){const t=o._rowElements[e],n=t.row,i=0===e?n.visibleIndex:l+e;t.classList.contains("smart-hidden")||(-1===l&&(l=i),-1!==i&&(a=1+i))}0===o._rowElements.length&&(l=0,a=Math.max(20,parseInt(o.offsetHeight/o.layout.rowMinHeight*1.5)))}else"infinite"===o.scrolling?(l=1/0,a=1/0):(l=0,a=o.dataSource.length);a!==1/0&&(o.dataSource.virtualDataSourceLength||o.dataSource.length)&&(a=Math.min(a,o.dataSource.length)),o.paging.enabled&&(l=o.paging.pageIndex*o._pageSize,a=l+o._pageSize),o._toggledRow||(o.appearance.displayLoadingIndicator=!0,o._setLoadingIndicatorVisibility()),o._groups||(o._groups=[].concat(o.dataSource.groupBy.toArray())||[]);const n={first:l,last:a,edit:o._editInfo||null,sorting:o.getSortedColumns(),filtering:o.getFilteredColumns(),filterOperator:o.filtering.operator,grouping:o._groups,row:o._toggledRow?o._toggledRow.data:null,action:e},i=o.dataSource.length,r=o.dataSource.boundSource.length;void 0===o._isFirstVirtualDataSourceRequest&&(o._isFirstVirtualDataSourceRequest=!0),o.dataSource.onVirtualDataSourceRequested((function(e){if(o.appearance.displayLoadingIndicator=!1,o._setLoadingIndicatorVisibility(),o._toggledRow=null,!e)return o._initializeRows(),o._initializeRowElements(),o.refresh(),o._refreshPagesCount(),void(o._autoHeight&&o._initializeRowElements());if("add"===e.action)return void(t&&t(e.result));if("update"===e.action)return void(t&&t(e.result));if("remove"===e.action)return void(t&&t(e.result));const l=o.context;if(o.context=o,o._isFirstVirtualDataSourceRequest&&0===o._initColumns.length&&(o.columns.canNotify=!1,o.columns=[],o._renderColumns(),o.columns.canNotify=!0),"scroll"===e.action)if("infinite"===o.scrolling){const e=o._viewRows;for(let t=0;t<e.length;t++){const l=e[t];l.data&&!l.addNewRow&&l.data.$&&(o.rowById[l.data.$.id]||(o.rowById[l.data.$.id]=l))}o._recycle(!1,!1)}else{const t=e.first>=0?e.first:0,l=e.last!==1/0?e.last:0;let a=0;for(let e=t;e<l;e++)o.rows[e]&&(o.rows[e].data=o.dataSource[a++]);o._recycle(!1,!1)}else if(o.dataSource.length!==i||o.dataSource.boundSource.length!==r||o._isFirstVirtualDataSourceRequest||"expand"===e.action||"filter"===e.action||"sort"===e.action||"pageIndexChange"===e.action||"pageSizeChange"===e.action||"sort"===e.action||"group"===e.action){o.paging.enabled&&o.$.headerPager.querySelector("smart-pager")&&(o.$.headerPager.querySelector("smart-pager").pagesCount=Math.ceil(o.dataSource.length/o._pageSize),o.$.footerPager.querySelector("smart-pager").pagesCount=Math.ceil(o.dataSource.length/o._pageSize));const e=o.filtering.filterRow&&o.filtering.filterRow.visible&&o.filtering.filterRow.cell?o.filtering.filterRow.cell.column.dataField:null;if(o._initializeRows(),o._initializeRowElements(),o.refresh(),o._refreshPagesCount(),o._autoHeight&&o._initializeRowElements(),o.filtering.filterRow){for(let e=0;e<o.columns.length;e++)o.columns[e]._filterEditorInitialized&&(o.columns[e]._filterEditorInitialized=!1);e&&setTimeout((()=>{const t=o.columnByDataField[e];t&&t._filterInfo&&t._filterInfo.input&&t._filterInfo.input.focus()}),100)}}else o.dataSource.virtualDataSourceOnExpand&&o.refresh();o._isFirstVirtualDataSourceRequest&&o.onLoad&&(o.onLoad(o),delete o.onLoad),o._isFirstVirtualDataSourceRequest=!1,o._recycle(),o.context=l,o._onDataUpdated&&o._onDataUpdated()}),n)}_createAddNewRowButton(){const e=this,t=document.createElement("div");return t.className="smart-grid-add-row-button smart-grid-icon smart-icon-plus",t.title=e.localize("addNewRow"),t.style.left=!e.appearance.showViewBar||e.appearance.viewBarAppendTo||e.appearance.showViewBarAsDropdown||e._mobile?"":10+e.layout.viewBarWidth+"px",e._addNewGridRow=t.onclick=()=>{e._addRowTimer&&clearTimeout(e._addRowTimer),e._addRowTimer=setTimeout((()=>{if(e.dataSource&&e.dataSource.virtualDataSource)return void e._insertNewRowAfter();const t={};for(let o=0;o<e.columns.length;o++){const l=e.columns[o];void 0!==l.defaultValue&&null!==l.defaultValue&&("today"===l.defaultValue&&"date"===l.dataType?(e._today||(e._today=new Date,e._todayYear=e._today.getFullYear(),e._todayMonth=e._today.getMonth(),e._todayDate=e._today.getDate()),t[l.dataField]=new Date(e._todayYear,e._todayMonth,e._todayDate)):t[l.dataField]=l.defaultValue)}e._addingNewRow=!0,e._add(t),e._mobile||(e._scrollView.vScrollBar.value=e._scrollView.vScrollBar.max),e.closeMenu(),e._addingNewRow=!1,e.editing.addNewRow.visible&&e.$.placeholder.classList.contains("smart-hidden")&&"button"!==e.editing.addNewRow.displayMode&&e.editing.addNewRow._addButton.classList.remove("show")}),0)},t}addColumn(e,t,o=!0){const l=this;if(e){let a=-1;if(t)for(let e=0;e<l.columns.length;e++)if(l.columns[e].dataField===t){a=e,!1===o&&(a=e+1);break}if("string"==typeof e){const t=l._getKanbanTaskField(e);if(t){if(a>=0)return void l.columns.splice(a,0,t);l.columns.push(t)}return}if(a>=0&&a<l.columns.length)return void l.columns.splice(a,0,e);l.columns.push(e)}}insertColumnAfter(e,t){e&&this.addColumn(e,t,!1)}insertColumnBefore(e,t){e&&this.addColumn(e,t,!0)}addNewColumn(e){e&&this.addColumn(e)}_createAddNewColumnButton(){const e=this,t=document.createElement("div");return t.className="smart-grid-add-column-button smart-grid-icon smart-icon-plus",t.title=e.localize("addNewColumn"),t.onclick=()=>{e._openAddColumnDialog(),e.addEventListener("closeColumnDialog",(()=>{e.layout.isDirty=!0,e._resetCachedLayout(),e._refreshLayout()}))},t}_showAddNewRowButton(e){const t=this;if(!t.columns.length)return;if("grid"!==t.view&&t.editing.addNewRow._addButton)return void t.editing.addNewRow._addButton.classList.add("smart-hidden");if("grid"===t.view&&t.editing.addNewRow._addButton&&t.editing.addNewRow._addButton.classList.remove("smart-hidden"),"float"===e&&t.computedVerticalScrollBarVisibility&&t.editing.addNewRow._addButton&&!t.editing.addNewRow._addButton.classList.contains("show"))return;if("float"===e&&t._addingNewRow)return;const o=()=>{t.editing.addNewRow._addButton&&t.editing.addNewRow._addButton&&("float"!==e&&(t.appearance.showRowHeader||t.appearance.showRowHeaderNumber)&&"card"!==t.view?t.editing.addNewRow._addButton.classList.remove("float"):(!t.computedVerticalScrollBarVisibility&&t.dataSource&&0===t.dataSource.length||t.computedVerticalScrollBarVisibility&&"float"===e||"card"===t.view)&&t.editing.addNewRow._addButton.classList.add("float"),t.computedHorizontalScrollBarVisibility?t.pager.visible?t.editing.addNewRow._addButton.style.bottom="68px":t.editing.addNewRow._addButton.style.bottom="20px":t.pager.visible?t.editing.addNewRow._addButton.style.bottom="48px":t.editing.addNewRow._addButton.style.bottom="",t.grouping.enabled&&t.dataSource)&&(!(t.dataSource.groupBy.length>0)||t.editing.addNewRow._addButton.classList.remove("show"))};t.editing.addNewRow._addButton&&t.editing.addNewRow.visible&&t.$.placeholder.classList.contains("smart-hidden")&&"button"!==t.editing.addNewRow.displayMode&&t.editing.addNewRow._addButton.classList.remove("show"),!t.editing.addNewRow.visible||"button"!==t.editing.addNewRow.displayMode&&t.$.placeholder.classList.contains("smart-hidden")||(t.editing.addNewRow._addButton?requestAnimationFrame((()=>{t.editing.addNewRow._addButton&&(t.editing.addNewRow._addButton.classList.add("show"),t.editing.addNewRow._addButton.style.left=!t.appearance.showViewBar||t.appearance.viewBarAppendTo||t.appearance.showViewBarAsDropdown||t._mobile?"":10+t.layout.viewBarWidth+"px",o(),t.editing.addNewRow.visible&&!t.computedVerticalScrollBarVisibility&&t.editing.addNewRow._addButton.classList.remove("show"))})):(t.editing.addNewRow._addButton=t._createAddNewRowButton(),t.appendChild(t.editing.addNewRow._addButton),requestAnimationFrame((()=>{t.editing.addNewRow._addButton&&(t.editing.addNewRow._addButton.classList.add("show"),o(),(t.editing.addNewRow.visible&&t.$.placeholder.classList.contains("smart-hidden")&&"button"!==t.editing.addNewRow.displayMode||!t.computedVerticalScrollBarVisibility&&t.editing.addNewRow.visible&&t.$.placeholder.classList.contains("smart-hidden"))&&t.editing.addNewRow._addButton.classList.remove("show"))}))))}_showAddNewColumnButton(){const e=this,t=()=>{e.editing.addNewColumn._addButton.classList.add("float")};e.editing.addNewColumn.visible&&(e.editing.addNewColumn._addButton||(e.editing.addNewColumn._addButton=e._createAddNewColumnButton(),e.appendChild(e.editing.addNewColumn._addButton)),requestAnimationFrame((()=>{e.editing.addNewColumn._addButton.classList.add("show"),t()})))}_verticalScrollRecycle(e,t){const o=this;if(o._layoutSuspended||!1===o.isAttached)return;if(o._isUpdating)return;if(o.editing.isEditing&&(!0!==o._disableEndEdit&&o.endEdit(),o._isUpdating))return;o._removeCellContentPopup(),o._inputOverlay&&(o._inputOverlay.parentNode&&o._inputOverlay.parentNode.removeChild(o._inputOverlay),o._inputOverlay=null),o._selection.selectionRect&&o._refreshCellSelectionRect();const l=o._recyclingRows;let a=l[t],n=a.top,i=!1;for(let r=0;r<o._cellsMerge.length;r++){const s=o._cellsMerge[r],d=l.indexOf(s.row);t>d&&t<=d+s.rowSpan&&(t=d,a=s.row,n=a.top,o.$.rowContainer.style.top=o.__frozenNearHeight-e+n+"px",i=!0)}i||(o.$.rowContainer.style.top=o.__frozenNearHeight-e+n+"px")}_verticalScrollbarHandler(e){const t=this;t.menu&&t.menu.column&&t.closeMenu(),t.isScrolling=!0,t._scrollTimer&&clearTimeout(t._scrollTimer),t._layoutSuspended||(t._scrollTimer=setTimeout((()=>{if("virtual"===t.scrolling)t._recycle(!1);else{const e=t._scrollView.scrollTop;let o=t._getRowIndexByPosition(e);o!==t._scrollRowIndex?(t._recycle(!1,!0,!0,o),t._scrollRowIndex=o):t._verticalScrollRecycle(e,o)}if(t.isScrolling=!1,e.max===e.value&&e.max>0){if(t.$.fireEvent("scrollBottomReached"),"infinite"===t.scrolling)return t.appearance.displayLoadingIndicator=!0,t._setLoadingIndicatorVisibility(),t._virtualScrollTimer&&clearTimeout(t._virtualScrollTimer),void(t._virtualScrollTimer=setTimeout((()=>{t._virtualDataRequest("scroll"),t.appearance.displayLoadingIndicator=!1,t._setLoadingIndicatorVisibility()}),50));t.editing.addNewRow._addButton&&"card"!==t.view&&t.editing.addNewRow._addButton.classList.remove("show")}else t.editing.addNewRow.visible&&"button"===t.editing.addNewRow.displayMode&&t.editing.addNewRow._addButton&&e.max>0&&(t.editing.addNewRow._addButton.classList.add("show"),t.editing.addNewRow._addButton.classList.remove("scroll"),t.editing.addNewRow._addButton.classList.add("float"));"virtual"===t.scrolling&&(t.appearance.displayLoadingIndicator=!0,t._setLoadingIndicatorVisibility(),t._virtualScrollTimer&&clearTimeout(t._virtualScrollTimer),t._virtualScrollTimer=setTimeout((()=>{t._virtualDataRequest("scroll"),t.appearance.displayLoadingIndicator=!1,t._setLoadingIndicatorVisibility()}),50)),e.min===e.value&&t.$.fireEvent("scrollTopReached")}),0))}getVerticalScrollMax(){return this.scrollHeight}getHorizontalScrollMax(){return this.scrollWidth}getHorizontalScrollValue(){return this.scrollLeft}setHorizontalScrollValue(e){this.scrollLeft=e}getVerticalScrollValue(){return this.scrollTop}setVerticalScrollValue(e){this.scrollTop=e}clearRows(){const e=this;e.dataSource=new Smart.DataAdapter({dataSource:[]}),e.rowHierarchy=null,e._visibleRows=null,e.__viewRows=null,e.rows.canNotify=!1,e.rows.length=0,e.rows.canNotify=!0,e.clearSelection(),e._refresh()}isEmpty(){const e=this;return!!(null===e.dataSource||e.dataSource&&e.dataSource.dataFields&&0===e.dataSource.length&&0===e.dataSource.dataSource.length&&!e.dataSource.virtualDataSource)}setRowStyle(e,t){const o=this,l=o.rowById[e];l&&(l.style=t,o._recycle(!1,!0))}setCellStyle(e,t,o){const l=this,a=l.rowById[e];if(a){const e=a.getCell(t);if(e){const t=e.canNotify;if(e.canNotify=!1,o)for(let t in o)void 0!==e[t]&&(e[t]=o[t]);else e.background=null,e.color=null,e.fontSize=null,e.fontFamily=null,e.fontWeight=null,e.textDecoration=null,e.fontStyle=null;e.canNotify=t,l._recycle(!1,!0)}}}setCellFormula(e,t,o){const l=this,a=l.rowById[e];if(a){const e=a.getCell(t);if(e){const t=e.canNotify;e.canNotify=!1,e.formula=o,e.canNotify=t,l._recycle(!1,!0)}}}dataBind(){const e=this;if(delete e.__autoRowHeight,e._virtualOnExpandCache=[],e._cellsMerge=[],e._cellStyles=[],null===e.dataSource||e.dataSource&&e.dataSource.dataFields&&0===e.dataSource.length&&0===e.dataSource.dataSource.length&&!e.dataSource.virtualDataSource)e.clearRows();else if(Array.isArray(e.dataSource))if(e.dataSourceSettings.dataFields&&e.dataSourceSettings.dataFields.length>0)e.dataSource=new Smart.DataAdapter({dataSource:e.dataSource,dataSourceType:e.dataSourceSettings.dataSourceType,dataFields:e.dataSourceSettings.dataFields,keyDataField:e.dataSourceSettings.keyDataField,parentDataField:e.dataSourceSettings.parentDataField,childrenDataField:e.dataSourceSettings.childrenDataField,groupBy:e.dataSourceSettings.groupBy&&e.dataSourceSettings.groupBy.length?e.dataSourceSettings.groupBy:e.grouping.groupBy,mapChar:e.dataSourceSettings.mapChar,root:e.dataSourceSettings.root,record:e.dataSourceSettings.record,autoGenerateColumns:e.autoGenerateColumns,id:e.dataSourceSettings.id,virtualDataSource:e.dataSourceSettings.virtualDataSource,virtualDataSourceOnExpand:e.dataSourceSettings.virtualDataSourceOnExpand});else if(e.columns&&e.columns.length){let t=[];for(let o=0;o<e.columns.length;o++){const l=e.columns[o];t.push({name:l.dataField,dataType:l.dataType||"string"}),l.displayField!==l.dataField&&t.push({name:l.displayField,dataType:l.dataType||"string"})}e.dataSource=new Smart.DataAdapter({dataSource:e.dataSource,dataFields:t,dataSourceType:e.dataSourceSettings.dataSourceType,keyDataField:e.dataSourceSettings.keyDataField,parentDataField:e.dataSourceSettings.parentDataField,childrenDataField:e.dataSourceSettings.childrenDataField,groupBy:e.dataSourceSettings.groupBy&&e.dataSourceSettings.groupBy.length?e.dataSourceSettings.groupBy:e.grouping.groupBy,mapChar:e.dataSourceSettings.mapChar,root:e.dataSourceSettings.root,record:e.dataSourceSettings.record,autoGenerateColumns:e.autoGenerateColumns,id:e.dataSourceSettings.id,virtualDataSource:e.dataSourceSettings.virtualDataSource,virtualDataSourceOnExpand:e.dataSourceSettings.virtualDataSourceOnExpand})}else e.dataSource=new Smart.DataAdapter({dataSource:e.dataSource});const t=e._filters,o=e._sortedColumns;if(e.clearSort(),e.filtering.filterRow)for(let t=0;t<e.columns.length;t++)e.columns[t]._filterEditorInitialized=!1;for(let t=0;t<e.columns.length;t++)delete e.columns[t]._cellsCachedValues;e._initColumns&&0===e._initColumns.length&&(e.columns=[],e._renderColumns(!0)),e._renderRows(),"virtual"===e.scrolling||e.paging.enabled&&e.dataSource&&e.dataSource.virtualDataSource||e.dataSource&&e.dataSource.virtualDataSource?e._virtualDataRequest("dataBind"):e.paging.enabled&&(!e.dataSource||e.dataSource&&!e.dataSource.url)&&e._refreshPagesCount(),o&&e._refreshSort(o),t&&t.length>0&&(e._filters=null,e.refreshFilters())}refresh(e,t){const o=this;o.isInitialized&&(e&&(o._initializeRows(),o._initializeRowElements()),o._refresh(t),o._refreshSummary())}refreshView(){const e=this;e._recycleFiles=!0,e._recycle(),delete e._recycleFiles}beginUpdate(){const e=this;e._isUpdating||(e._isUpdating=0),e._isUpdating++}endUpdate(e,t){const o=this;o._isUpdating--,o._isUpdating<0&&(o._isUpdating=0),!1!==e?o.refresh():!1!==t&&o.refreshView()}}),Smart.Grid.Extend=function(e){if(!e)return;const t=Object.getOwnPropertyNames(e.prototype);for(let o in t){const l=t[o];"constructor"!==l&&(Smart.Grid.prototype[l]=e.prototype[l])}},Smart.Grid.Extend(Smart.Utilities.Grid.Resize),Smart.Grid.Extend(Smart.Utilities.Grid.Reorder),Smart.Grid.Extend(Smart.Utilities.Grid.Pager),Smart.Grid.Extend(Smart.Utilities.Grid.Filter),Smart.Grid.Extend(Smart.Utilities.Grid.Sort),Smart.Grid.Extend(Smart.Utilities.Grid.Menu),Smart.Grid.Extend(Smart.Utilities.Grid.Select),Smart.Grid.Extend(Smart.Utilities.Grid.Edit),Smart.Grid.Extend(Smart.Utilities.Grid.Dialog),Smart.Grid.Extend(Smart.Utilities.Grid.Group),Smart.Grid.Extend(Smart.Utilities.Grid.Tree),Smart.Grid.Extend(Smart.Utilities.Grid.Export),Smart.Grid.Extend(Smart.Utilities.Grid.Chart),Smart.Grid.Extend(Smart.Utilities.Grid.View),Smart.Grid.Cell=Smart.Utilities.Grid.Cell,Smart.Grid.Row=Smart.Utilities.Grid.Row,Smart.Grid.Column=Smart.Utilities.Grid.Column;
1442
+ Smart("smart-grid",class extends Smart.ScrollViewer{static get properties(){return{appearance:{value:{alternationStart:{value:0,type:"int"},alternationEnd:{value:0,type:"int"},alternationCount:{value:0,type:"int"},allowHover:{value:!1,type:"boolean",defaultReflectToAttribute:!0},allowHeaderHover:{value:!0,type:"boolean",defaultReflectToAttribute:!0},allowRowToggleAnimation:{value:!1,type:"boolean"},allowRowDetailToggleAnimation:{value:!1,type:"boolean"},allowSortAnimation:{value:!1,type:"boolean"},allowColumnLabelAnimation:{value:!0,type:"boolean"},allowCheckBoxesSelectionAnimation:{value:!0,type:"boolean"},allowColumnMenuAnimation:{value:!0,type:"boolean"},allowColumnSortButtonAnimation:{value:!0,type:"boolean"},allowColumnActionButtonAnimation:{value:!0,type:"boolean"},allowColumnFilterButtonAnimation:{value:!0,type:"boolean"},allowColumnStickyPosition:{value:!1,type:"boolean"},autoShowColumnSortButton:{value:!0,type:"boolean"},autoShowColumnActionButton:{value:!0,type:"boolean"},autoGenerateRowLabelMode:{value:"number",type:"string"},autoGenerateColumnLabelMode:{value:"letter",type:"string"},autoShowColumnFilterButton:{value:!0,type:"boolean"},cardTitleField:{value:"",type:"string"},displayLoadingIndicator:{value:!1,type:"boolean"},loadingIndicatorPlaceholder:{value:"Loading...",type:"string"},placeholder:{value:"No Rows",type:"string"},sortAnimationDuration:{value:500,type:"number"},showRowHeader:{value:!1,type:"boolean"},showRowStatus:{value:!1,type:"boolean"},showRowComments:{value:!1,type:"boolean"},showRowHeaderNumber:{value:!1,type:"boolean"},showRowHeaderEditIcon:{value:!0,type:"boolean",defaultReflectToAttribute:!0},showRowHeaderDragIcon:{value:!1,type:"boolean"},showColumnHeaderDragIcon:{value:!1,type:"boolean"},showRowHeaderSelectIcon:{value:!1,type:"boolean"},showRowHeaderFocusIcon:{value:!1,type:"boolean"},showColumnHeaderLines:{value:!0,type:"boolean",defaultReflectToAttribute:!0},showColumnGroupLines:{value:!0,type:"boolean",defaultReflectToAttribute:!0},showColumnGroupCellLines:{value:!0,type:"boolean",defaultReflectToAttribute:!0},showColumnLines:{value:!0,type:"boolean",defaultReflectToAttribute:!0},showRowLines:{value:!0,type:"boolean",defaultReflectToAttribute:!0},showFilterColumnBackground:{value:!1,type:"boolean"},showSortColumnBackground:{value:!1,type:"boolean"},showFrozenColumnBackground:{value:!0,type:"boolean"},showFrozenRowBackground:{value:!0,type:"boolean"},showSelectionOnTop:{value:!0,type:"boolean"},showColumnSortButton:{value:!0,type:"boolean"},showColumnFilterButton:{value:!0,type:"boolean"},showColumnDescriptionButton:{value:!1,type:"boolean"},showColumnIcon:{value:!1,type:"boolean"},showColumnCustomButton:{value:!1,type:"boolean"},showColumnActionButton:{value:!0,type:"boolean"},showColumnGroupsInColumnPanel:{value:!1,type:"boolean"},showTooltips:{value:!1,type:"boolean"},showTooltipsOverflow:{value:!0,type:"boolean"},showResizeTooltips:{value:!0,type:"boolean"},showHorizontalScrollBarOnFixedColumns:{value:!1,type:"boolean"},showVerticalScrollBarOnFixedColumns:{value:!1,type:"boolean"},showTreeRowHeader:{value:!1,type:"boolean"},showTodayDateAsString:{value:!0,type:"boolean"},showViewBar:{value:!1,type:"boolean"},showViewBarAsDropdown:{value:!1,type:"boolean"},viewBarAppendTo:{value:null,type:"any"}},type:"object"},behavior:{value:{autoDestroy:{value:!0,type:"boolean"},allowColumnAutoSizeOnDoubleClick:{value:!0,type:"boolean"},allowRowAutoSizeOnDoubleClick:{value:!0,type:"boolean"},allowColumnReorder:{value:!1,type:"boolean"},allowColumnFreeze:{value:!0,type:"boolean"},allowRowReorder:{value:!1,type:"boolean"},allowMouseWheel:{value:!0,type:"boolean"},doubleClickTimingDelay:{value:300,type:"number"},columnResizeMode:{value:"none",type:"string",allowedValues:["none","split","growAndShrink"]},rowResizeMode:{value:"none",type:"string",allowedValues:["none","split","growAndShrink"]}},type:"object"},layout:{value:{autoWrap:{value:!0,type:"boolean"},autoWidth:{value:!1,type:"boolean"},autoHeight:{value:!1,type:"boolean"},allowCellsWrap:{value:!1,type:"boolean"},allowCellsWrapShortcut:{value:!0,type:"boolean"},autoGenerateColumnWidth:{value:null,type:"number?"},autoSizeNewColumn:{value:!1,type:"boolean",reflectToAttribute:!1},autoSizeNewColumnMinWidth:{value:180,type:"number",reflectToAttribute:!1},cardMinWidth:{value:250,type:"any",reflectToAttribute:!1},cardRowMinHeight:{value:45,type:"any",reflectToAttribute:!1},cardsPerRow:{value:"auto",type:"any",reflectToAttribute:!1},cardVertical:{value:!0,type:"boolean",reflectToAttribute:!1},columnWidth:{value:null,type:"any",reflectToAttribute:!1},columnHeight:{value:null,type:"any",reflectToAttribute:!1},columnMinHeight:{value:30,type:"any",reflectToAttribute:!1},dropDownWidth:{value:700,type:"any",reflectToAttribute:!1},dropDownHeight:{value:500,type:"any",reflectToAttribute:!1},isDirty:{value:!1,type:"boolean"},loadingIndicatorPosition:{value:"center",allowedValues:["bottom","center","top"],type:"string"},rowMinHeight:{value:30,type:"number"},rowHeight:{value:null,type:"any",reflectToAttribute:!1},viewBarWidth:{value:200,type:"number"}},type:"object"},dataExport:{value:{header:{value:!0,type:"boolean"},filterBy:{value:null,type:"object"},groupBy:{value:null,type:"object"},style:{value:null,type:"object"},fileName:{value:"smartGrid",type:"string?"},pageOrientation:{value:"portrait",type:"string"},expandChar:{value:"+",type:"string"},collapseChar:{value:"-",type:"string"},view:{value:!1,type:"boolean"},viewStart:{value:null,type:"number?"},viewEnd:{value:null,type:"number?"},rowIds:{value:null,type:"array?"}},type:"object"},clipboard:{value:{enabled:{value:!0,type:"boolean"},autoFillMode:{value:"copy",allowedValues:["none","copy","fillSeries"],type:"string"},onPasteValue:{value:null,type:"any"}},type:"object"},conditionalFormatting:{value:null,type:"array?",reflectToAttribute:!1},columns:{value:[],type:"any",reflectToAttribute:!1},contextMenu:{value:{selector:{value:"",type:"string"},enabled:{value:!1,type:"boolean"},width:{value:150,type:"number"},height:{value:null,type:"number?"},customContextMenuItems:{value:null,type:"any"},dataSource:{value:{contextMenuItemDelete:{value:{command:{value:"contextMenuItemDeleteCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:!0,type:"boolean"},icon:{value:"smart-icon-delete",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},contextMenuItemEdit:{value:{command:{value:"contextMenuItemEditCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:!0,type:"boolean"},icon:{value:"smart-icon-mode-edit",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},contextMenuItemCustom:{value:{command:{value:null,type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:!1,type:"boolean"},icon:{value:"smart-icon-settings",type:"string"},label:{value:"",type:"string"}},type:"object",reflectToAttribute:!1}},type:"object",reflectToAttribute:!1}},type:"object",reflectToAttribute:!1},columnMenu:{value:{autoClose:{value:!0,type:"boolean"},dataSource:{value:{columnMenuCustomizeType:{value:{command:{value:"customizeTypeCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:!1,type:"any"},icon:{value:"smart-icon-settings",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},columnMenuItemClone:{value:{command:{value:"duplicateCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:!1,type:"any"},icon:{value:"smart-icon-duplicate",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},columnMenuItemInsertLeft:{value:{command:{value:"insertLeftCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:!1,type:"any"},icon:{value:"smart-icon-insert-left",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},columnMenuItemInsertRight:{value:{command:{value:"insertRightCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:!1,type:"any"},icon:{value:"smart-icon-insert-right",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},columnMenuItemSortAsc:{value:{command:{value:"sortAscCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:"auto",type:"any"},icon:{value:"smart-icon-sort-name-up",type:"string"},iconAlt:{value:"smart-icon-sort-number-up",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},columnMenuItemSortDesc:{value:{command:{value:"sortDescCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:"auto",type:"any"},icon:{value:"smart-icon-sort-name-down",type:"string"},iconAlt:{value:"smart-icon-sort-number-down",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},columnMenuItemRemoveSort:{value:{command:{value:"removeSortCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:"auto",type:"any"},icon:{value:"smart-icon-cancel-circled",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},columnMenuItemSort:{value:{command:{value:"addSortCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:"auto",type:"any"},icon:{value:"smart-icon-sort",type:"string"},iconAlt:{value:"smart-icon-sort",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},columnMenuItemFilter:{value:{command:{value:"addFilterCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:"auto",type:"any"},icon:{value:"smart-icon-add-filter",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},columnMenuItemRemoveFilter:{value:{command:{value:"removeFilterCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:"auto",type:"any"},icon:{value:"smart-icon-cancel-circled",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},columnMenuItemGroupBy:{value:{command:{value:"groupByCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:"auto",type:"any"},icon:{value:"smart-icon-group",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},columnMenuItemRemoveGroupBy:{value:{command:{value:"removeGroupByCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:"auto",type:"any"},icon:{value:"smart-icon-ungroup",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},columnMenuItemHide:{value:{command:{value:"hideColumnCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:!1,type:"any"},icon:{value:"smart-icon-visibility-off",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},columnMenuItemDelete:{value:{command:{value:"deleteColumnCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:!1,type:"any"},icon:{value:"smart-icon-delete",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1}},type:"object",reflectToAttribute:!1},visible:{value:!1,type:"boolean"},enabled:{value:!0,type:"boolean"},width:{value:250,type:"number"},height:{value:null,type:"number?"}},type:"object",reflectToAttribute:!1},columnGroups:{value:[],type:"array",reflectToAttribute:!1},charting:{value:{appendTo:{value:null,type:"any"},enabled:{value:!1,type:"boolean"},colorScheme:{value:"scheme01",type:"string"},description:{value:"",type:"string"},dialog:{value:{header:{value:"{{message}}",type:"string"},height:{value:400,type:"any"},width:{value:400,type:"any"},left:{value:"center",type:"any"},top:{value:"center",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:!1,type:"boolean"}},type:"object"},formatSettings:{value:{},type:"object"}},type:"object"},view:{value:"grid",allowedValues:["grid","kanban","card"],type:"string"},currentUser:{value:null,type:"any",reflectToAttribute:!1},dropDownMode:{value:!1,type:"boolean",reflectToAttribute:!1},dataSource:{value:null,type:"any",reflectToAttribute:!1},dataSourceMap:{value:{checklist:"checklist",color:"color",comments:"comments",dueDate:"dueDate",id:"id",priority:"priority",progress:"progress",startDate:"startDate",status:"status",swimlane:"swimlane",tags:"tags",text:"text",description:"description",userId:"userId",history:"history",createdUserId:"createdUserId",createdDate:"createdDate",updatedUserId:"updatedUserId",updatedDate:"updatedDate"},type:"any",reflectToAttribute:!1},dataSourceSettings:{value:{autoGenerateColumns:{value:!1,type:"boolean"},sanitizeHTML:{value:"blackList",allowedValues:["all","blackList","none"],type:"string"},root:{value:"",type:"string"},record:{value:"",type:"string"},keyDataField:{value:"",type:"string"},parentDataField:{value:"",type:"string"},childrenDataField:{value:"",type:"string"},groupBy:{value:[],type:"array"},dataFields:{value:[],type:"array"},mapChar:{value:".",type:"string"},id:{value:"",type:"string"},relations:{value:[],type:"any",reflectToAttribute:!1},virtualDataSource:{value:null,type:"any"},virtualDataSourceOnExpand:{value:null,type:"any"}},type:"object"},formulas:{value:!1,type:"boolean"},highlighted:{value:-1,type:"any"},uploadSettings:{value:{url:{value:"",type:"string",reflectToAttribute:!1},removeUrl:{value:"",type:"string",reflectToAttribute:!1},existsUrl:{value:"",type:"string",reflectToAttribute:!1},name:{value:"userfile[]",type:"string",reflectToAttribute:!1},uploadMaxCount:{value:5,type:"number",reflectToAttribute:!1},uploadMaxSize:{value:2097152,type:"number",reflectToAttribute:!1},data:{value:null,type:"object",reflectToAttribute:!1},onUploadStarted:{value:null,type:"any",reflectToAttribute:!1},onUploadCompleted:{value:null,type:"any",reflectToAttribute:!1},onUploadRemove:{value:null,type:"any",reflectToAttribute:!1},onUploadError:{value:null,type:"any",reflectToAttribute:!1},onChange:{value:null,type:"any",reflectToAttribute:!1},onProgress:{value:null,type:"any",reflectToAttribute:!1},onAbort:{value:null,type:"any",reflectToAttribute:!1},onError:{value:null,type:"any",reflectToAttribute:!1},onSetHeaders:{value:null,type:"any",reflectToAttribute:!1},singleFilePost:{value:!0,type:"boolean",reflectToAttribute:!1},userFiles:{value:[],type:"array",reflectToAttribute:!1}},reflectToAttribute:!1,type:"object"},grouping:{value:{enabled:{value:!1,type:"boolean",reflectToAttribute:!1},allowCollapse:{value:!1,type:"boolean",reflectToAttribute:!1},autoHideGroupColumn:{value:!1,type:"boolean",reflectToAttribute:!1},autoExpandAll:{value:!1,type:"boolean",reflectToAttribute:!1},autoExpandToLevel:{value:0,type:"number",reflectToAttribute:!1},onGroupDefaultExpanded:{value:null,type:"any",reflectToAttribute:!1},expandMode:{value:"buttonClick",type:"string",allowedValues:["buttonClick","rowClick"],reflectToAttribute:!1},renderMode:{type:"string",value:"advanced",allowedValues:["basic","compact","advanced","multipleColumns"]},groupBy:{value:[],type:"array",reflectToAttribute:!1},groupRowHeight:{value:50,type:"any",reflectToAttribute:!1},toggleButtonIndent:{value:27,type:"number",reflectToAttribute:!1},groupIndent:{value:27,type:"number",reflectToAttribute:!1},groupBar:{value:{visible:{value:!1,type:"boolean",reflectToAttribute:!1},allowColumnDragDrop:{value:!0,type:"boolean",reflectToAttribute:!0},allowColumnCloseButtons:{value:!0,type:"boolean",reflectToAttribute:!0}},type:"object"},formatFunction:{value:null,type:"any",reflectToAttribute:!1},summaryRow:{value:{inline:{value:!0,type:"boolean"},visible:{value:!0,type:"boolean"}},type:"object"}},type:"object"},messages:{extend:!0,value:{en:{invalidColumnProperty:'{{elementType}}: Invalid property name "{{propertyName}}" set for Column: "{{type}}"',invalidRowProperty:'{{elementType}}: Invalid property name "{{propertyName}}" set for Row"',invalidCellValue:'Invalid cell value "{{value}}", Validation rule: "{{validationRule}}"',invalidValue:"Invalid value",invalidMinValue:"{{value}} above {{min}} must be filled out",invalidMaxValue:"{{value}} below {{max}} must be filled out",invalidMinLengthValue:"{{value}} is shorter than the minimum length of {{min}} characters",invalidMaxLengthValue:"{{value}} is longer than the maximum length of {{max}} characters",requiredValue:"{{value}} must be filled out",frozenColumns:"{{elementType}}: To Pin/Freeze a column group, all columns within it should be frozen.",frozenRows:"{{elementType}}: To Pin/Freeze a special cell, all rows within it should be frozen.",columnGroups:"{{elementType}}: Please, check the initialization of the smartGrid's columns array. The columns in a column group are expected to be siblings in the columns array.",viewGrid:"Grid",viewKanban:"Kanban",viewCard:"Cards",kanbanNone:"Blank",kanbanDescription:'Start from a project board with columns generated by the "{{column}}" column options.',kanbanNoneDescription:"Create a new column and start from scratch with a completely blank project board. You can add columns and configure settings yourself.",kanbanBasic:"Template",kanbanBasicDescription:'Create a new column and start from a project board with columns for "To do", "in progress" and "Done".',uncategorized:"Uncategorized",toDo:"To do",inProgress:"In progress",done:"Done",min:"Min: {{value}}",max:"Max: {{value}} ",sum:"Sum: {{value}} ",avg:"Avg: {{value}} ",cells:"{{value}} cells selected",rows:"{{value}} rows",oneRow:"1 row",unique:"Unique: {{value}}",blank:"Empty: {{value}}",filled:"Filled: {{value}}",summary:"Summary",countSummary:"Count",minSummary:"Min",maxSummary:"Max",avgSummary:"Avg",blankSummary:"Empty",uniqueSummary:"Unique",filledSummary:"Filled",statusSummary:"Status",sumSummary:"Sum",completed:"Tasks Completed: {{value}}",count:"Count: {{value}} ",pagerFirstButton:"First",pagerLastButton:"Last",pagerPreviousButton:"Previous",pagerNextButton:"Next",pagerNavigateToLabel:"Go to:",pagerPageSizeLabel:"Show:",pagerNavigateToInputPlaceholder:"",pagerEllipsis:"...",pagerSummaryString:"of",pagerSummaryPrefix:"of",pagerSummarySuffix:"",columnMenuCustomizeType:"Column settings",columnMenuItemClone:"Clone column",columnMenuItemInsertLeft:"Insert left",columnMenuItemInsertRight:"Insert right",columnMenuItemSortAsc:"Sort {{mode}}",columnMenuItemSortDesc:"Sort {{mode}}",columnMenuItemRemoveSort:"Remove Sort",columnMenuItemFilter:"Filter column",columnMenuItemSort:"Sort column",columnMenuItemRemoveFilter:"Remove Filter",columnMenuItemGroupBy:"Group column",columnMenuItemRemoveGroupBy:"Remove Group",columnMenuItemHide:"Hide column",columnMenuItemShow:"Show column",columnMenuItemDelete:"Delete column",columnResizeTooltip:"width: {{value}}px",rowResizeTooltip:"height: {{value}}px",commandBarAddRow:"Add",commandBarDeleteRow:"Delete row",commandBarBatchRevert:"Revert",commandBarBatchSave:"Save",commandBarFilter:"Filter",commandBarSort:"Sort",commandBarSearch:"Search",commandBarCustomize:"Customize",commandBarGroup:"Group",commandColumnEdit:"Edit",commandColumnDelete:"Delete",commandColumnCancel:"Cancel",commandColumnUpdate:"Update",contextMenuItemDelete:"Delete row",contextMenuItemEditCell:"Edit cell",contextMenuItemEditRow:"Edit row",commandColumnMenu:"",expandRow:"Expand row (Shift + Enter)",expandRowComments:"Expand row and see {{value}} comments",collapseRow:"Collapse row",addNewRow:"Click here to add a new row",addNewRowAlt:"<span>Add new empty row</span> <code>Shift</code> + <code>Space</code>",addNewRowAltSmall:"Add new empty row",addNewColumn:"Click here to add a new column",dialogChartHeader:"{{value}} Chart",dialogRowDetailHeader:"Row Id: {{value}}",dialogDescriptionHeader:"Column: {{value}}",dialogRowDetailButtonConfirm:"OK",dialogRowDetailButtonCancel:"CANCEL",dialogEditHeaderDisabled:"Row: {{value}}",dialogEditHeader:"Row: {{value}}",dialogEditHeaderMenu:"Toggle Sidebar",dialogExpandRowHeader:"Edit Record",dialogAddButtonConfirm:"ADD",dialogAddButtonCancel:"CANCEL",dialogEditButtonConfirm:"OK",dialogEditButtonSave:"Save",dialogEditButtonAutoSave:"Auto Save",dialogEditButtonCancel:"Cancel",dialogFilterButtonConfirm:"FILTER",dialogFilterButtonCancel:"CLEAR",dialogDeleteButtonConfirm:"DELETE",dialogDeleteButtonCancel:"CANCEL",dialogEditColumn:"Column: {{value}}",dialogNewColumn:"New column",dialogAddColumn:"Add Column",dialogAddColumnStatus:"Choose a grouping column",dialogAddColumnStatusDescription:"Represent the status of each record",dialogAddColumnStatusNotes:"Your records will be grouped based on this column",dialogAddHeader:"Add Row",dialogDeleteHeader:"Delete Row",dialogFilterHeader:"Filter by",dialogFilterMinLabel:"Min",dialogFilterMaxLabel:"Max",dialogFileHeader:"File",dialogImageFileHeader:"Image",dialogFileDrop:"or drag and drop file(s) to upload",dialogFileUpload:"Select Files(s) to Upload",dialogFileURL:"You can also provide the URL to a file",dialogFileURLUpload:"Upload",dialogFileLink:"Link (URL)",dialogFileDevice:"My Device",dialogMyFiles:"My Files",dialogMyFilesTitle:"Select files from your already uploaded files.",dialogFileSize:'No file currently added. The "{{value}}" file cannot be uploaded. Maximum file size is {{fileSize}}.',dialogFileCount:'The following files cannot be added "{{files}}". Maximum files allowed is {{fileCount}}.',dialogFileFileUpload:"No files currently selected",dialogAddColumnName:"Name",dialogAddColumnNameInfo:"Name of the column. The name of the column will be displayed in the column header.",dialogAddColumnDescription:"Description",dialogAddColumnDescriptionInfo:"Description of the column. When the description is set, an icon will be displayed in the column header. A tooltip with the description will be displayed when you point at the icon.",dialogAddColumnNamePlaceholder:"Column name (optional)",dialogAddColumnDescriptionPlaceholder:"Describe this column (optional)",dialogAddColumnType:"Type",dialogAddColumnTypeInfo:'Type of the data in the column. Unlike a spreadsheet, Columns have specific "types" that allow you to store rich content in each record. For example, a table can contain records (rows) with images, long texts, checkboxes.',dialogAddColumnTypeText:"Text",dialogAddColumnTypeMultilineText:"Multiline text",dialogAddColumnTypeImage:"Image",dialogAddColumnTypeNumber:"Number",dialogAddColumnTypeSelect:"Select",dialogAddColumnTypeMultipleSelect:"Multiple select",dialogAddColumnTypeDate:"Date",dialogAddColumnTypeTime:"Time",dialogAddColumnTypeRating:"Rating",dialogAddColumnTypeDuration:"Duration",dialogAddColumnTypeCheckBox:"CheckBox",dialogAddColumnTypeCreatedTime:"Created time",dialogAddColumnTypeLastUpdatedTime:"Last modified time",dialogAddColumnTypeCreatedBy:"Created by",dialogAddColumnTypeLastUpdatedBy:"Last modified by",dialogAddColumnTypeCollaborator:"User",dialogAddColumnTypeFormula:"Formula",dialogAddColumnTypeFormulaInfo:'Example: COL(Name) & "-" & COL(Price) or IF(COL(Price) * COL(Quantity) > 5, "Yes", "No")',dialogAddColumnTypeSlider:"Slider",dialogAddColumnTypeStatus:"Choose a status column",dialogAddColumnTypeStatusInfo:"Connect with the relevant status column",dialogAddColumnTypeAutoNumber:"Auto number",dialogAddColumnTypeRowLink:"Link to table",dialogAddColumnTypeURL:"URL",dialogAddColumnTypeEmail:"Email",dialogAddColumnTypePassword:"Password",dialogAddColumnTypePhone:"Phone",dialogAddColumnTypeNone:"None",dialogAddColumnTypeStartDate:"Start Date",dialogAddColumnTypeDueDate:"Due Date",dialogAddColumnTypeDueDateSettings:"Set as a deadline",dialogAddColumnTypeDueDateSettingsInfo:"Set a deadline with start date or due date templates.",dialogAddColumnTypeProgress:"Progress",dialogAddColumnTypePriority:"Priority",dialogAddColumnTypeDescription:"Description",dialogAddColumnTypeTags:"Tags",dialogAddColumnTypeName:"Name",dialogAddColumnTypeColor:"Color",dialogAddColumnTypeChecklist:"Checklist",dialogAddColumnTypeAssigned:"Assignee",dialogAddColumnTypeAttachment:"Attachment",dialogAddColumnDateFormat:"Date format",dialogAddColumnDateFormatInfo:"Choose the dates display format",dialogAddColumnDateFormatShort:"Short",dialogAddColumnDateFormatLong:"Long",dialogAddColumnDateFormatEU:"EU",dialogAddColumnDateFormatISO:"ISO",dialogAddColumnDateFormatAS:"AS",dialogAddColumnDateFormatFull:"Full",dialogAddColumnDateFormatSlash:"Slash",dialogAddColumnDateFormatHyphen:"Hyphen",dialogAddColumnDateFormatDot:"Dot",dialogAddColumnTimeFormat:"Time format",dialogAddColumnTimeFormatInfo:"Choose the time display format",dialogAddColumnTimeFormatHour:"hour",dialogAddColumnAllowTimeFormat:"Include a time field",dialogAddColumnCustomDateSeparator:"Set a custom separator",dialogAddColumnNumberFormat:"Number format",dialogAddColumnNumberFormatInfo:"Choose the number display format",dialogAddColumnNumberFormatInteger:"Integer",dialogAddColumnNumberFormatNumber:"Number",dialogAddColumnNumberFormatPercent:"Percent",dialogAddColumnNumberFormatPercentRounded:"Percent(rounded)",dialogAddColumnNumberFormatScientific:"Scientific",dialogAddColumnNumberFormatEngineering:"Engineering",dialogAddColumnNumberFormatAccounting:"Accounting",dialogAddColumnNumberFormatUnit:"Unit",dialogAddColumnNumberFormatUnitInfo:"Units of measurement",dialogAddColumnNumberFormatUnitAcre:"Acre",dialogAddColumnNumberFormatUnitCelsius:"Celsius",dialogAddColumnNumberFormatUnitFahrenheit:"Fahrenheit",dialogAddColumnNumberFormatUnitPercent:"Percent",dialogAddColumnNumberFormatUnitDegree:"Degree",dialogAddColumnNumberFormatUnitMegaByte:"Mega byte",dialogAddColumnNumberFormatUnitCentimeter:"Centimeter",dialogAddColumnNumberFormatUnitMeter:"Meter",dialogAddColumnNumberFormatUnitKilometer:"Kilometer",dialogAddColumnNumberFormatUnitMile:"Mile",dialogAddColumnNumberFormatUnitKilogram:"Kilogram",dialogAddColumnNumberFormatUnitPound:"Pound",dialogAddColumnNumberFormatUnitLiter:"Liter",dialogAddColumnNumberFormatUnitGallon:"Gallon",dialogAddColumnNumberFormatUnitSecond:"Second",dialogAddColumnNumberFormatUnitMinute:"Minute",dialogAddColumnNumberFormatUnitHour:"Hour",dialogAddColumnNumberFormatUnitDay:"Day",dialogAddColumnNumberFormatUnitWeek:"Week",dialogAddColumnNumberFormatUnitMonth:"Month",dialogAddColumnNumberFormatUnitYear:"Year",dialogAddColumnNumberFormatCurrency:"Currency",dialogAddColumnNumberFormatCurrencyRounded:"Currency(rounded)",dialogAddColumnNumberFormatCurrencyInfo:"Choose the currency display format",dialogAddColumnNumberFormatSeparator:"Use 1000 Separator (,)",dialogAddColumnMinLength:"Minimum length",dialogAddColumnMinLengthInfo:"Minimum text length",dialogAddColumnMaxLength:"Maximum length",dialogAddColumnMaxLengthInfo:"Maximum text length",dialogAddColumnMinValue:"Minimum value",dialogAddColumnMinValueInfo:"Minimum number",dialogAddColumnMaxValue:"Maximum value",dialogAddColumnMaxValueInfo:"Maximum number",dialogAddColumnMinDate:"Minimum date",dialogAddColumnMinDateInfo:"Minimum date",dialogAddColumnMaxDate:"Maximum date",dialogAddColumnMaxDateInfo:"Maximum date",dialogAddColumnColorItems:"Color items",dialogAddColumnListItems:"List items",dialogAddColumnLinkListItems:"Choose a table to link to",dialogAddColumnLinkField:"Choose a lookup field",dialogAddColumnLinkSelect:"Allow linking to multiple rows",dialogAddColumnFormula:"Please enter a formula",dialogAddColumnListItemsError:"You cannot delete an item while in use.",dialogAddColumnDefault:"Default value",dialogAddColumnDefaultDateCurrent:"Current Date",dialogAddColumnDefaultDateSpecific:"Specific Date",dialogAddColumnAlign:"Align",dialogAddColumnAlignLeft:"Left",dialogAddColumnAlignRight:"Right",dialogAddColumnAlignCenter:"Center",dialogAddColumnAlignInfo:"Table cells text alignment",dialogAddColumnResizable:"Resizable",dialogAddColumnResizableInfo:"Select if you want to make the column resizable",dialogAddColumnRequired:"Required",dialogAddColumnRequiredInfo:"Select if you want to make the column required",dialogAddColumnSortable:"Sortable",dialogAddColumnSortableInfo:"Select if you want to sort by this column",dialogAddColumnFilterable:"Filterable",dialogAddColumnFilterableInfo:"Select if you want to filter by this column",dialogAddColumnEditable:"Editable",dialogAddColumnEditableInfo:"Select if you want to edit by this column",dialogAddColumnMultipleCollaborators:"Multiple Collaborators",dialogAddColumnMultipleCollaboratorsInfo:"Select if you want to allow multiple collaborators",dialogAddColumnCheckItems:"Show Checkbox",dialogAddColumnFormatting:"Rich Formatting",priority_low:"Low",priority_average:"Average",priority_high:"High",priority_critical:"Critical",bold:"Bold",fontStyle:"Font Style",italic:"Italic",send:"Send",copy:"copy",status:"Status",underline:"Underline",comments:"Comments",comment:"Comment",commentPlaceholder:"Leave a comment",noComments:"Leave a comment and collaborate with your team.",guestUser:"Guest",background:"Background",starred:"Starred",resetFormat:"Reset Format",notStarred:"Not starred",color:"Color",coloredItems:"Colored items",conditionalFormatting:"Conditional Formatting",groupBarLabel:"Drag a column header here to group by that column",dialogDeleteContent:"Are you sure you want to delete this row?",detailsTab:"Format",commentsTab:"Comments",historyTab:"History",historyEvent:"Event",historyAuthor:"Author",historyDetails:"Details",range:"Changed {{column}} from {{oldValue}} to {{newValue}}",nullRange:"Changed {{column}} to {{newValue}}",rowCreated:"Row Created",propertyUpdated:"{{value}} updated",propertyRemoved:"{{value}} removed",dropImages:"Drop images here",addImages:"Add images",dropFiles:"Drop files here",addFiles:"Add files",unassigned:"Unassigned",historyDate:"Date",copyURL:"Copy row URL",calendar:{"/":"/",":":":",firstDay:0,days:{names:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],namesAbbr:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],namesShort:["Su","Mo","Tu","We","Th","Fr","Sa"]},months:{names:["January","February","March","April","May","June","July","August","September","October","November","December",""],namesAbbr:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec",""]},AM:["AM","am","AM"],PM:["PM","pm","PM"],eras:[{name:"A.D.",start:null,offset:0}],currencySymbol:"$",currency:"USD",currencySymbolPosition:"before",decimalSeparator:".",thousandsSeparator:","},CONTAINS:"Contains",DOES_NOT_CONTAIN:"Does not contain",ENDS_WITH:"Ends with",EQUAL:"Equal",GREATER_THAN:"Greater than",GREATER_THAN_OR_EQUAL:"Greater than or equal",LESS_THAN:"Less than",LESS_THAN_OR_EQUAL:"Less than or equal",NOT_EQUAL:"Not equal",RANGE:"Range",CLEAR_FILTER:"Clear Filter",STARTS_WITH:"Starts with",addFilter:"+ Add filter",and:"And",apply:"Apply",applyOnce:"Apply once",booleanFirst:"☐",booleanLast:"☑",cancel:"Cancel",CONTAINS_CASE_SENSITIVE:"Contains (case sensitive)",dateFirst:"1",dateLast:"9",DOES_NOT_CONTAIN_CASE_SENSITIVE:"does not contain (case sensitive)",EMPTY:"empty",ENDS_WITH_CASE_SENSITIVE:"ends with (case sensitive)",EQUAL_CASE_SENSITIVE:"equal (case sensitive)",filter:"Filter",customize:"Hide columns",customizeOne:"1 hidden column",customizeHidden:"{{n}} hidden columns",filteredByMultiple:"{{n}} filters",filteredByOne:"1 filter",filterValuePlaceholder:"Value",find:"Find a field",findInView:"Find in view",firstBy:"Sort by",found:"{{nth}} of {{n}}",from:"from",noFilters:"No filters applied",noResults:"No results",noSorting:"No sorting applied",noOptions:"No options",NOT_EMPTY:"not empty",NOT_NULL:"not null",NULL:"null",numberFirst:"1",numberLast:"9",ok:"OK",or:"Or",pickAnother:"Pick another field to sort by",maintainSort:"Maintain sort",sort:"Sort",group:"Group",sortedByMultiple:"Sorted by {{n}} columns",sortedByOne:"Sorted by 1 column",STARTS_WITH_CASE_SENSITIVE:"starts with (case sensitive)",stringFirst:"A",stringLast:"Z",thenBy:"then by",where:"Where",collapseAll:"Collapse all",expandAll:"Expand all",noGrouping:"No grouping",groupedByMultiple:"{{n}} groups",groupedByOne:"1 group",groupedBy:"Grouped by {{column}}",deleteByMultiple:"Delete {{n}} rows",deleteByOne:"Delete 1 row",download:"Download",firstByGroup:"Group by",expandRecord:"Expand row",expandCell:"Expand cell",pickAnotherGroupBy:"Pick another field to group by",add:"Add condition",all:"All columns",between:"Between",close:"Close",column:"Column:",condition:"Condition:",equal:"equal",fontFamily:"Font family:",fontSize:"Font size:",format:"Format:",greaterThan:"greater than",highlight:"Highlight",lessThan:"less than",notEqual:"not equal",remove:"Remove condition",secondValue:"Second value:",text:"Text",value:"Value:",addCondition:"Add Condition",addGroup:"Add Group",blanks:"(Blanks)",clear:"Clear",contains:"contains",containsCaseSensitive:"contains (case sensitive)",dateTabLabel:"DATE",doesNotContain:"does not contain",doesNotContainCaseSensitive:"does not contain (case sensitive)",empty:"empty",endsWith:"ends with",endsWithCaseSensitive:"ends with (case sensitive)",equalCaseSensitive:"equal (case sensitive)",greaterThanOrEqual:"greater than or equal",lessThanOrEqual:"less than or equal",mismatchedProperties:'smartFilterPanel: The "filterType" and the data type of the selected "dataField" are mismatched.',missingProperty:'smartFilterPanel: When mode is \'excel\', either "data" and "dataField" or "dataSource" of type Array have to be set.',notEmpty:"not empty",notNull:"not null",null:"null ",placeholderBoolean:"Select value",placeholderDate:"Enter date",placeholderNumber:"Enter number",placeholderTime:"Enter time",placeholderValue:"Enter value",selectAll:"(Select All)",showRows:"Show rows where:",startsWith:"starts with",startsWithCaseSensitive:"starts with (case sensitive)",matchCase:"Match Case",timeTabLabel:"TIME",today:"Today",tomorrow:"Tomorrow",yesterday:"Yesterday",formatColumn:"Format Column",formating:"Colors",formatingByMultiple:"{{n}} Colors",formatingOne:"1 color",reset:"Reset",filteredRecords:"All rows are filtered",duplicateCells:"Clone column cells and settings",duplicateSettings:"Clone column settings",views:"Views",createView:"New View",newGrid:"Grid",newKanban:"Kanban",newCard:"Cards",layout:"Layout",settings:"Create view",viewNamePlaceholder:"View name",view:"View",noViews:"Found no views",kanbanView:"View your records as cards on a Kanban board",gridView:"View your records in a Table",cardView:"View your records in a Card view",days:"{{value}}d",daysOverdue:"{{value}} days overdue",daysLeft:"{{value}} days left",true:"true",false:"false",TOMORROW:"Tomorrow",TODAY:"Today",YESTERDAY:"Yesterday",NEXT_WEEK:"Next week",THIS_WEEK:"This week",LAST_WEEK:"Last week",NEXT_MONTH:"Next month",THIS_MONTH:"This month",LAST_MONTH:"Last month",hideHiddenColumns:"Hide {{value}} hidden columns",showHiddenColumns:"Show {{value}} hidden columns",less:"Less",more:"More",conditions:"Conditions",colorsSingleSelect:"Which single select field should the row be colored by?",colorRows:"Color rows when they match the conditions",colorSelect:"Color rows the same as a single select value",colorLeftBorderLabel:"Left border",colorRowLabel:"Row",colorCellLabel:"Cell",colorLeftBorder:"Color the left border of a row",colorRow:"Color the background of a row",colorCell:"Color the background of a cell",loadingIndicatorPlaceholder:"Loading...",dropDownPlaceholder:"Please select...",placeholder:"No Rows"}},type:"object"},onCellValue:{value:null,type:"any",reflectToAttribute:!1},onCellEditRequest:{value:null,type:"any",reflectToAttribute:!1},onCellUpdate:{value:null,type:"any",reflectToAttribute:!1},onCellRender:{value:null,type:"any",reflectToAttribute:!1},onBeforeInit:{value:null,type:"any",reflectToAttribute:!1},onInit:{value:null,type:"any",reflectToAttribute:!1},onAfterInit:{value:null,type:"any",reflectToAttribute:!1},onKey:{value:null,type:"any",reflectToAttribute:!1},onKeyUp:{value:null,type:"any",reflectToAttribute:!1},onRender:{value:null,type:"any",reflectToAttribute:!1},onLoad:{value:null,type:"any",reflectToAttribute:!1},onChartInit:{value:null,type:"any",reflectToAttribute:!1},onComment:{value:null,type:"any",reflectToAttribute:!1},onRowInit:{value:null,type:"any",reflectToAttribute:!1},onRowClass:{value:null,type:"any",reflectToAttribute:!1},onRowChange:{value:null,type:"any",reflectToAttribute:!1},onRowDetailInit:{value:null,type:"any",reflectToAttribute:!1},onRowDetailUpdated:{value:null,type:"any",reflectToAttribute:!1},onRowInserted:{value:null,type:"any",reflectToAttribute:!1},onRowRemoved:{value:null,type:"any",reflectToAttribute:!1},onRowUpdate:{value:null,type:"any",reflectToAttribute:!1},onRowUpdated:{value:null,type:"any",reflectToAttribute:!1},onRowStarred:{value:null,type:"any",reflectToAttribute:!1},onRowHistory:{value:null,type:"any",reflectToAttribute:!1},onRowStyle:{value:null,type:"any",reflectToAttribute:!1},onRowResize:{value:null,type:"any",reflectToAttribute:!1},onColumnInit:{value:null,type:"any",reflectToAttribute:!1},onColumnInserted:{value:null,type:"any",reflectToAttribute:!1},onColumnRemoved:{value:null,type:"any",reflectToAttribute:!1},onColumnResize:{value:null,type:"any",reflectToAttribute:!1},onColumnReorder:{value:null,type:"any",reflectToAttribute:!1},onColumnSummaryChange:{value:null,type:"any",reflectToAttribute:!1},onColumnUpdated:{value:null,type:"any",reflectToAttribute:!1},onColumnClone:{value:null,type:"any",reflectToAttribute:!1},onColumnChange:{value:null,type:"any",reflectToAttribute:!1},onCommand:{value:null,reflectToAttribute:!1,type:"any"},onViewInit:{value:null,type:"any",reflectToAttribute:!1},filtering:{value:{enabled:{value:!1,type:"boolean"},operator:{value:"and",type:"string"},filter:{value:[],type:"array",reflectToAttribute:!1},filterRow:{value:{visible:{value:!1,type:"boolean"},menuVisible:{value:!1,type:"boolean"},applyMode:{value:"auto",type:"string",allowedValues:["auto","click"]},autoApplyModeDelay:{value:800,type:"number"}},type:"object"},filterMenu:{value:{visible:{value:!0,type:"boolean"},buttons:{value:["cancel","clear","filter"],type:"array"},dataSource:{value:null,type:"any"},width:{value:250,type:"number"},height:{value:200,type:"number"},mode:{value:"default",allowedValues:["default","excel"],type:"string"},messages:{value:null,type:"object"}},type:"object"}},type:"object"},editing:{value:{allowRowHeaderEdit:{value:!1,type:"boolean"},allowColumnHeaderEdit:{value:!1,type:"boolean"},autoUpdateFilterAndSort:{value:!0,type:"boolean"},active:{value:!1,readonly:!0,type:"boolean"},enabled:{value:!1,type:"boolean"},batch:{value:!1,type:"boolean"},readOnlyEdit:{value:!1,type:"boolean"},action:{value:"click",type:"string",allowedValues:["none","click","doubleClick"]},commandKeys:{value:{commandKeyCancel:{value:{command:"commandKeyCancelCommand",key:"Escape"},type:"object"},commandKeyUpdate:{value:{command:"commandKeyUpdateCommand",key:"Enter | Tab"},type:"object"}},type:"object"},commandBar:{value:{visible:{value:!1,type:"boolean"},position:{value:"near",allowedValues:["near","far","both"],type:"string"},displayMode:{value:"labelAndIcon",allowedValues:["label","icon","labelAndIcon"],type:"string"},dataSource:{value:{commandBarAddRow:{value:{command:{value:"commandBarAddRowCommand",type:"any"},icon:{value:"smart-icon-plus",type:"string"},label:{value:"{{messages}}",type:"string"},visible:{value:!1,type:"any"}},type:"object"},commandBarDeleteRow:{value:{command:{value:"commandBarDeleteRowCommand",type:"any"},icon:{value:"smart-icon-delete",type:"string"},label:{value:"{{messages}}",type:"string"},visible:{value:!1,type:"any"}},type:"object"},commandBarBatchSave:{value:{command:{value:"commandBarBatchSaveCommand",type:"any"},icon:{value:"smart-icon-ok-squared",type:"string"},label:{value:"{{messages}}",type:"string"},visible:{value:!0,type:"any"}},type:"object"},commandBarBatchRevert:{value:{command:{value:"commandBarBatchRevertCommand",type:"any"},icon:{value:"smart-icon-reload",type:"string"},label:{value:"{{messages}}",type:"string"},visible:{value:!0,type:"any"}},type:"object"},commandBarCustom:{value:{command:{value:"",type:"any"},icon:{value:"smart-icon-ellipsis-vert",type:"string"},label:{value:"",type:"string"},visible:{value:!1,type:"any"}},type:"object"}},type:"object"}},type:"object"},commandColumn:{value:{visible:{value:!1,type:"boolean"},inline:{value:!1,type:"boolean"},position:{value:"far",allowedValues:["near","far"],type:"string"},displayMode:{value:"icon",allowedValues:["label","icon","labelAndIcon"],type:"string"},dataSource:{value:{commandColumnMenu:{value:{command:{value:"commandColumnMenuCommand",type:"any"},icon:{value:"smart-icon-menu",type:"string"},label:{value:"{{messages}}",type:"string"},visible:{value:!1,type:"any"}},type:"object"},commandColumnEdit:{value:{command:{value:"commandColumnEditCommand",type:"any"},icon:{value:"smart-icon-mode-edit",type:"string"},label:{value:"{{messages}}",type:"string"},visible:{value:"auto",type:"any"}},type:"object"},commandColumnDelete:{value:{command:{value:"commandColumnDeleteCommand",type:"any"},icon:{value:"smart-icon-delete",type:"string"},label:{value:"{{messages}}",type:"string"},visible:{value:!0,type:"any"}},type:"object"},commandColumnUpdate:{value:{command:{value:"commandColumnUpdateCommand",type:"any"},icon:{value:"smart-icon-ok-squared",type:"string"},label:{value:"{{messages}}",type:"string"},visible:{value:"auto",type:"any"}},type:"object"},commandColumnCancel:{value:{command:{value:"commandColumnCancelCommand",type:"any"},icon:{value:"smart-icon-cancel-circled",type:"string"},label:{value:"{{messages}}",type:"string"},visible:{value:"auto",type:"any"}},type:"object"},commandColumnRowMenu:{value:{command:{value:"commandColumnRowMenuCommand",type:"any",reflectToAttribute:!1},icon:{value:"smart-icon-ellipsis-vert",type:"string"},label:{value:"{{messages}}",type:"string"},visible:{value:!1,type:"any"}},type:"object"},commandColumnCustom:{value:{command:{value:"",type:"any",reflectToAttribute:!1},icon:{value:"smart-icon-ellipsis-vert",type:"string"},label:{value:"",type:"string"},visible:{value:!1,type:"any"}},type:"object"}},type:"object"},width:{value:null,type:"number?"}},reflectToAttribute:!1,type:"object"},mode:{value:"cell",allowedValues:["cell","row"],type:"string"},addNewColumn:{value:{visible:{value:!1,type:"boolean"}},type:"object"},addNewRow:{value:{position:{value:"both",allowedValues:["near","far","both"],type:"string"},visible:{value:!1,type:"boolean"},autoEdit:{value:!0,type:"boolean"},autoCreate:{value:!1,type:"boolean"},autoSave:{value:!0,type:"boolean"},label:{value:"{{message}}",type:"string"},displayMode:{value:"row",allowedValues:["row","button"],type:"string"}},type:"object"},dialog:{value:{header:{value:"{{message}}",type:"string"},height:{value:"auto",type:"any"},width:{value:"auto",type:"any"},left:{value:"center",type:"any"},top:{value:"center",type:"any"},enabled:{value:!1,type:"boolean"},visible:{value:!1,type:"boolean"}},type:"object"},addDialog:{value:{header:{value:"{{message}}",type:"string"},height:{value:"auto",type:"any"},width:{value:"auto",type:"any"},left:{value:"center",type:"any"},top:{value:"center",type:"any"},enabled:{value:!1,type:"boolean"},visible:{value:!1,type:"boolean"}},type:"object"},addColumnDialog:{value:{header:{value:"{{message}}",type:"string"},height:{value:"auto",type:"any"},width:{value:430,type:"any"},left:{value:"center",type:"any"},top:{value:"center",type:"any"},enabled:{value:!1,type:"boolean"},visible:{value:!1,type:"boolean"}},type:"object"},deleteDialog:{value:{header:{value:"{{message}}",type:"string"},height:{value:"auto",type:"any"},width:{value:"auto",type:"any"},left:{value:"center",type:"any"},top:{value:"center",type:"any"},enabled:{value:!1,type:"boolean"},visible:{value:!1,type:"boolean"}},type:"object"}},type:"object"},paging:{value:{enabled:{value:!1,type:"boolean"},spinner:{value:{enabled:{value:!1,type:"boolean"},step:{value:1,type:"number"}},type:"object"},pageHierarchySize:{value:2,type:"int"},pageSize:{value:10,type:"int"},pageIndex:{value:0,type:"int",validator:"pageIndexValidator"}},type:"object"},pager:{value:{autoEllipsis:{value:"both",allowedValues:["none","before","after","both"],type:"string"},position:{value:"far",allowedValues:["near","far","both"],type:"string"},template:{value:"",type:"string"},pageSizeSelector:{value:{visible:{value:!1,type:"boolean"},dataSource:{value:[10,20,50],type:"object"},position:{value:"far",allowedValues:["near","far"],type:"string"}},type:"object"},summary:{value:{position:{value:"far",allowedValues:["near","far"],type:"string"},visible:{value:!1,type:"boolean"}},type:"object"},navigationButtons:{value:{position:{value:"both",allowedValues:["near","far","both"],type:"string"},prevNextButtons:{value:{visible:{value:!0,type:"boolean"}},type:"object"},firstLastButtons:{value:{visible:{value:!0,type:"boolean"}},type:"object"},labels:{value:{visible:{value:!1,type:"boolean"}},type:"object"}},type:"object"},navigationInput:{value:{position:{value:"far",allowedValues:["near","far"],type:"string"},visible:{value:!1,type:"boolean"}},type:"object"},pageIndexSelectors:{value:{visible:{value:!0,type:"boolean"},dataSource:{value:10,type:"any"}},type:"object"},visible:{value:!1,type:"boolean"}},type:"object",reflectToAttribute:!1},rowDetail:{value:{enabled:{value:!1,type:"boolean"},inline:{value:!1,type:"boolean"},height:{value:200,type:"number"},position:{value:"near",allowedValues:["near","far"],type:"string"},template:{value:"",type:"any",reflectToAttribute:!1},visible:{value:!0,type:"boolean"},dialog:{value:{header:{value:"{{message}}",type:"string"},height:{value:300,type:"any"},width:{value:360,type:"any"},left:{value:"center",type:"any"},top:{value:"center",type:"any"},enabled:{value:!1,type:"boolean"},visible:{value:!1,type:"boolean"}},type:"object"}},type:"object"},rowCSSRules:{value:null,type:"any"},summaryRow:{value:{position:{value:"far",allowedValues:["near","far"],type:"string"},visible:{value:!1,type:"boolean"},editing:{value:!1,type:"boolean"},template:{value:"",type:"string"}},type:"object"},scrolling:{value:"physical",allowedValues:["physical","virtual","infinite","deferred"],type:"string"},columnHeader:{value:{visible:{value:!0,type:"boolean"}},type:"object"},groupHeader:{value:{visible:{value:!1,type:"boolean"},template:{value:"",type:"string"}},type:"object"},header:{value:{visible:{value:!1,type:"boolean"},template:{value:"",type:"any"},appendTo:{value:"",type:"any"},buttons:{value:["columns","filter","group","sort","format","search"],type:"array"},searchCommand:{value:"search",allowedValues:["search","filter"],type:"string"},customButton:{value:{command:{value:null,type:"any",reflectToAttribute:!1},enabled:{value:!0,type:"boolean"},visible:{value:!1,type:"boolean"},icon:{value:"smart-icon-settings",type:"string"},label:{value:"",type:"string"}},type:"object",reflectToAttribute:!1},onInit:{value:null,reflectToAttribute:!1,type:"any"}},type:"object"},footer:{value:{visible:{value:!1,type:"boolean"},template:{value:"",type:"any"}},type:"object"},stateSettings:{value:{enabled:{value:!0,type:"boolean",reflectToAttribute:!1},current:{value:"",type:"string",reflectToAttribute:!1},storage:{value:null,type:"any",reflectToAttribute:!1},autoSave:{value:!1,type:"boolean",reflectToAttribute:!1},autoLoad:{value:!1,type:"boolean",reflectToAttribute:!1},allowLocalStorage:{value:!0,type:"boolean",reflectToAttribute:!1},options:{value:[],type:"array",reflectToAttribute:!1},onStateChange:{value:null,type:"any",reflectToAttribute:!1}},type:"object",reflectToAttribute:!1},checkBoxes:{value:{visible:{value:!1,type:"boolean"},hasThreeStates:{value:!1,type:"boolean"}},type:"object"},selection:{value:{enabled:{value:!1,type:"boolean"},allowRowHeaderSelection:{value:!1,type:"boolean"},allowColumnHeaderSelection:{value:!1,type:"boolean"},allowRowSelection:{value:!0,type:"boolean"},allowCellSelection:{value:!1,type:"boolean"},allowDragSelection:{value:!0,type:"boolean"},allowDragSelectionAutoScroll:{value:!0,type:"boolean"},allowCellDragSelectionHandle:{value:!0,type:"boolean"},allowCellDragDropSelectionHandle:{value:!0,type:"boolean"},allowCellDragSelectionAutoFill:{value:!0,type:"boolean"},selectAllMode:{value:"page",allowedValues:["none","page","all"],type:"string"},mode:{value:"many",type:"string",allowedValues:["one","many","extended"]},action:{value:"click",type:"string",allowedValues:["none","click","doubleClick"]},checkBoxes:{value:{enabled:{value:!1,type:"boolean"},autoShow:{value:!1,type:"boolean"},action:{value:"click",type:"string",allowedValues:["none","click","doubleClick"]},selectAllMode:{value:"page",allowedValues:["none","page","all"],type:"string"},position:{value:"near",allowedValues:["near","far"],type:"string"}},type:"object"},selected:{value:"",type:"string"},tabKeyBehavior:{value:"default",allowedValues:["none","default"],type:"string"},defaultSelection:{value:!1,type:"boolean"}},type:"object"},sorting:{value:{enabled:{value:!1,type:"boolean"},sort:{value:[],type:"array"},mode:{value:"one",allowedValues:["one","many"],type:"string"},maintainSort:{value:!0,type:"boolean"},commandKey:{value:"",allowedValues:["","Shift","Control","Alt"],type:"string"},sortToggleThreeStates:{value:!0,type:"boolean"},sortToggleOnClick:{value:!0,type:"boolean"},sortToggleOnClickAndCommandKey:{value:!1,type:"boolean"}},type:"object"},storeHistory:{value:!1,type:"boolean"},storeHistoryItems:{value:20,type:"number"},users:{value:[],type:"array",reflectToAttribute:!1},virtualModeCachedRowsCount:{value:100,type:"int"}}}static get requires(){return{}}static get styleUrls(){return["smart.menu.css","smart.filterpanel.css","smart.pager.css","smart.grid.css","smart.textbox.css"]}template(){return"<div class='smart-container'id='container' disabled='[[disabled]]' role='grid'>\n <div id='header' role=\"toolbar\" class='smart-grid-header smart-hidden'>\n </div>\n <div id='groupHeader' role=\"presentation\" class='smart-grid-group-header smart-hidden'></div>\n <div id='headerPager' top class='smart-grid-pager smart-hidden'></div>\n <div id='headerCommandBar' header top class='smart-grid-header smart-grid-command-bar smart-hidden'></div>\n <div id='content' class='smart-grid-content'>\n <div id='columnHeader' role=\"rowgroup\" class='smart-grid-column-header'>\n <div id='columnNearContainer' role=\"row\" class='near smart-hidden smart-grid-column-header-cell-container'>\n </div>\n <div id='columnContainer' role=\"row\" class='center smart-grid-column-header-cell-container'>\n </div>\n <div id='columnFarContainer' role=\"row\" class='far smart-hidden smart-grid-column-header-cell-container'>\n </div>\n </div>\n <div id='scrollView' role=\"rowgroup\" class ='smart-grid-scroll-view'>\n <div id='rowNearContainer' role=\"presentation\" class='near smart-hidden smart-grid-row-container'>\n </div>\n <div id='rowContainer' role=\"presentation\" class='center smart-grid-row-container'>\n </div>\n <div id='rowFarContainer' role=\"presentation\" class='far smart-hidden smart-grid-row-container'>\n </div>\n <div id='placeholder' class ='smart-hidden smart-placeholder smart-grid-placeholder'></div>\n <smart-scroll-bar right-to-left=\"[[rightToLeft]]\" theme=\"[[theme]]\" id='verticalScrollBar' class='smart-grid-scroll-bar' wait disabled='[[disabled]]' orientation='vertical'></smart-scroll-bar>\n <smart-scroll-bar right-to-left=\"[[rightToLeft]]\" theme=\"[[theme]]\" id='horizontalScrollBar' class='smart-grid-scroll-bar' wait disabled='[[disabled]]'></smart-scroll-bar>\n </div>\n <div id='filterFooter' class='smart-grid-filter-footer smart-hidden'></div>\n </div>\n <div class=\"smart-grid-view-content smart-hidden\" id=\"viewContent\"></div>\n <div viewbar class=\"smart-grid-view-bar smart-hidden\" id=\"viewBar\"></div>\n <div id='loadingIndicatorContainer' class='smart-loader-container'>\n <span id='loadingIndicator' class='smart-grid-loader smart-loader'></span>\n <span id='loadingIndicatorPlaceholder' class ='smart-loader-label smart-hidden'></span>\n </div>\n <div id='footerCommandBar' footer class='smart-grid-footer smart-grid-command-bar smart-hidden'></div>\n <div id='footerPager' class='smart-grid-pager smart-hidden'></div>\n <div id='footer' class='smart-grid-footer smart-hidden'></div>\n </div>"}static get listeners(){return{focus:"_focusHandler",blur:"_blurHandler",wheel:"_mouseWheelHandler","document.up":"_upHandler","document.down":"_downHandler","document.move":"_moveHandler","document.scroll":"_scrollHandler",keydown:"_keyDownHandler",keyup:"_keyUpHandler",resize:"_resizeHandler","header.click":"_headerClickHandler","columnHeader.down":"_columnDownHandler","columnHeader.click":"_columnClickHandler","columnHeader.move":"_columnMoveHandler","columnHeader.mouseleave":"_columnMouseLeaveHandler","rowNearContainer.down":"_rowDownHandler","rowContainer.down":"_rowDownHandler","rowFarContainer.down":"_rowDownHandler","container.selectstart":"_selectStartHandler",styleChanged:"_styleChangedHandler",swipeleft:"_swipeLeftHandler",swiperight:"_swipeRightHandler",contextmenu:"_contextMenuHandler","document.paste":"_clipboardPasteHandler"}}_clipboardPasteHandler(e){if("paste"===e.type){const t=this;if(document.activeElement!==t)return;if(t._selection&&t._selection.focusedCell){const o=t._selection.focusedCell.id,l=t._selection.focusedCell.dataField,a=t.columnByDataField[l];if(!a)return;if(a&&("image"===a.template||"attachment"===a.template)){e.preventDefault();let a=(e.clipboardData||e.originalEvent.clipboardData).items,n=null,i=0,r=0,s=[];for(let e=0;e<a.length;e++)if(0===a[e].type.indexOf("image")&&(n=a[e].getAsFile(),i++,null!==n)){let e={label:n.name,size:n.size},a=new FileReader;a.onload=function(a){r++;const n=a.target.result;e.value=n;let d=!1;for(let o=0;o<t.uploadSettings.userFiles.length;o++){const l=t.uploadSettings.userFiles[o];if(l.name===e.label||l.label===e.label){d=!0;break}}if(d||t.uploadSettings.userFiles.push(e),s.push(e),r===i){let e=t.getCellValue(o,l);e||(e=[]),"string"==typeof e&&(e=JSON.parse(e)),e=[...e,...s],t.setCellValue(o,l,e)}},a.readAsDataURL(n)}}}}}_contextMenuHandler(e){if(this.contextMenu.enabled)return e.preventDefault(),e.stopPropagation(),!1}get _tabindex(){return this.disabled||this.unfocusable?"":' tabindex="0"'}pageIndexValidator(e,t){const o=this;if(t<0)return 0;if(o.dataSource){if(o.dataSource.virtualDataSource)return t;const e=Math.ceil(o.dataSource.length/o._pageSize);if(t>e-1)return e-1}}_offsetTop(e){return e?e.offsetTop+this._offsetTop(e.offsetParent):0}_offsetLeft(e){return e?e.offsetLeft+this._offsetLeft(e.offsetParent):0}offset(e){return{left:this._offsetLeft(e),top:this._offsetTop(e)}}getBoundingRect(e){const t=this;let o=window.pageXOffset,l=window.pageYOffset,a=e.getBoundingClientRect();if(e!==document.body){let a=e.parentNode;for(;a!==document.body&&a;){a&&(o+=a.scrollLeft,l+=a.scrollTop);let e=a;a?(a=a.parentNode,t.enableShadowDOM&&a===t.shadowRoot?a=t:!t.isInShadowDOM||a!==t.getRootNode()&&e!==t.getRootNode()||(a=t.getRootNode().host)):t.isInShadowDOM&&(a=t.getRootNode().host)}}return{bottom:a.bottom+l,height:a.height,left:a.left+o,right:a.right+o,top:a.top+l,width:a.width}}_downHandler(e){this._downTarget=e.originalEvent.target}_removeCellContentPopup(){const e=this;e._cellContentPopup&&(e._cellContentPopup.remove(),e._cellContentPopup=null),e._cellContentPopupTimer&&(clearTimeout(e._cellContentPopupTimer),e._cellContentPopupTimer=null)}_upHandler(e){const t=this,o=t.getBoundingRect(t);super._upHandler(),t._tapTimer&&clearTimeout(t._tapTimer);const l=()=>{t.editing.isEditing&&!t.editing.dialog.enabled&&setTimeout((()=>{if(!e.defaultPrevented){if(t.editing.editCell&&t.editing.editCell.editor.instance){const o=t.editing.editCell.editor.instance;if(o.element&&o.element.hasAttribute("aria-owns")){const t=o.element.getAttribute("aria-owns"),l=document.getElementById(t);if(l&&l.contains(e.originalEvent.target))return}if(t.editing.editCell.editor.instance.blur(e),e.defaultPrevented)return}t.isAttached&&t.endEdit()}}),50)};if(e.originalEvent&&(e.originalEvent.target===t.$.scrollView&&t._downTarget===e.originalEvent.target&&l(),e.originalEvent.target.closest(".smart-grid-dialog")))t._dialogDragDetails&&(t._dialogDragDetails.started=!1);else{if(e.pageX<o.left||e.pageX>o.right||e.pageY<o.top||e.pageY>o.bottom){let o=!1,a=e.originalEvent.target;for(;a;){if(a=a.parentNode,a===t){o=!0;break}if(t.dropDownMode&&t.$.dropDownElement===a){o=!0;break}}if(o)return t._dragSelectionEnd(e),t._endResize(e),void t._endDrag(e);if(t._summaryRowDialog&&t._summaryRowDialog.classList.contains("open")&&t._summaryRowDialog.confirm(),t._inputOverlay&&(t._inputOverlay.classList.remove("smart-input-overlay-on"),setTimeout((()=>{t._inputOverlay&&(t._inputOverlay.parentNode&&t._inputOverlay.parentNode.removeChild(t._inputOverlay),t._inputOverlay=null)}),t.behavior.doubleClickTimingDelay)),l(),t.closeDropDown(),t.menu){let o,l,a,n;if(t.enableShadowDOM||t.isInShadowDOM?(o=e.originalEvent.composedPath()[0],l=function(){let e=o.getRootNode().host;for(;e;){if(e===t)return e;e=e.getRootNode().host}}(),a=t.menu.contains(o)||t.menu.firstElementChild.shadowRoot.contains(o),n=t.menu.firstElementChild.shadowRoot):(o=e.originalEvent.target,l=t.contains(o),a=t.menu.contains(o),n=t.menu),!l&&!a){const e=n.querySelectorAll("smart-drop-down-list"),l=n.querySelectorAll("smart-date-time-picker"),a=n.querySelectorAll("smart-date-input"),i=n.querySelectorAll("smart-input");for(let t=0;t<e.length;t++)if(e[t].$.dropDownContainer.contains(o))return;for(let e=0;e<l.length;e++)if(l[e].$.dropDownContainer.contains(o))return;for(let e=0;e<a.length;e++)if(a[e].$.scrollView.contains(o))return;for(let e=0;e<i.length;e++)if(i[e].$.scrollView.contains(o))return;return void t.closeMenu()}}}t._summaryRowDialog&&t._summaryRowDialog.classList.contains("open")&&t._summaryRowDialog.confirm(),t._dragSelectionEnd(e),t._endResize(e),t._endDrag(e)}}_nextColumn(e){const t=this;for(let o=0;o<t.viewColumns.length;o++){const l=t.viewColumns[o];if(l.visibleIndex===e.visibleIndex+1)return l}return null}_nextRow(e){const t=this._recyclingRows,o=t.indexOf(e);return o>=0?t[o+1]:null}_moveHandler(e){const t=this;if(t.isInitialized&&t._selection){if(t.selection.enabled&&t.selection.allowDragSelection&&!t.editing.isEditing&&(!t._selection.selectionRect||t._selection.selectionRect&&!t._selection.selectionRect.captured)&&(!0!==t._mobile&&t._dragSelection(e),e.originalEvent)){const o=e.originalEvent.target.closest?e.originalEvent.target:void 0;Smart.Utilities.Core.isMobile&&o&&o.closest("smart-grid")===t&&e.originalEvent.preventDefault()}t.isScrolling||("none"===t.behavior.columnResizeMode||t.classList.contains("smart-grid-row-resize-mode")||t._columnMoveResizeHandler(e),"none"===t.behavior.rowResizeMode||t.classList.contains("smart-grid-column-resize-mode")||t._rowMoveResizeHandler(e),t._drag(e))}}_hideActionButtons(){const e=this;if(e._columnElements){for(let t=0;t<e._columnElements.length;t++){const o=e._columnElements[t],l=o.column;l&&l.autoShowActionButton&&o._hideActionButton()}for(let t=0;t<e._frozenNearColumns.length;t++){const o=e._frozenNearColumns[t],l=o.element;o&&o.autoShowActionButton&&l._hideActionButton()}}}_columnMouseLeaveHandler(){this._mobile||this._hideActionButtons()}_columnMoveHandler(e){const t=this;if(!t.isInitialized)return;if(t._columnResizeStartLine||t._rowResizeStartLine)return;if(t._mobile)return;const o=(o,l)=>{if(o&&o.autoShowActionButton){const a=l.getBoundingClientRect(),n=t.offset(l),i=t.parentElement,r=i?i.scrollTop:0;if(n.left<=e.pageX&&n.left+a.width-6>=e.pageX)if(n.top-r<=e.pageY&&n.top-r+a.height>=e.pageY){if(!t.hasColumnMenu(o))return;l._showActionButton()}else l._hideActionButton();else l._hideActionButton()}};for(let e=0;e<t._columnElements.length;e++){const l=t._columnElements[e];o(l.column,l)}for(let e=0;e<t._frozenNearColumns.length;e++){const l=t._frozenNearColumns[e];o(l,l.element)}}_headerClickHandler(e){const t=this;if(t.$.headerBar){const o=t.isInShadowDOM||t.shadowRoot?e.composedPath()[0]:e.target;t.$.headerBar._headerClickHandler(o,t)}}_columnClickHandler(e){const t=this;if(t._overlay)return;if(void 0===e.clientX)return;const o=(t.enableShadowDOM?t.shadowRoot:t.getRootNode()).elementsFromPoint(e.clientX,e.clientY);let l=null,a=null;const n=new Date-t._columnClickTime<t.behavior.doubleClickTimingDelay;t._columnClickTime=new Date;for(let e=0;e<o.length;e++){const t=o[e];if(t.classList.contains("smart-action-button"))return;if(t.getAttribute("data-field")){l=t.getAttribute("data-field"),a=t;break}}if(l){const o=a.column;if(!o)return;if(e.srcElement.classList.contains("smart-filter-button"))return;if("_addNewColumn"===o.dataField)return void t._openAddColumnDialog();if(Smart.Utilities.Core.isMobile)n&&t.sorting.sortToggleOnClick&&o.allowSortToggleOnClick&&t.sorting.enabled&&(t.sortBy(l),t.autoSaveState()),t._columnMoveHandler(e),e.originalEvent&&e.originalEvent.preventDefault();else if(!n&&t.sorting.sortToggleOnClick&&o.allowSortToggleOnClick&&t.sorting.enabled){if("none"!==t.behavior.columnResizeMode&&"col-resize"===o.element.style.cursor)return;if(t._canSort=!0,""!==t.sorting.commandKey){if("Alt"===t.sorting.commandKey&&!1===e.altKey&&(t._canSort=!1),"Shift"===t.sorting.commandKey&&!1===e.shiftKey&&(t._canSort=!1),"Control"===t.sorting.commandKey&&!1===e.metaKey&&!1===e.ctrlKey&&(t._canSort=!1),"Control"!==t.sorting.commandKey&&e.ctrlKey)return;if(!0===t.sorting.sortToggleOnClickAndCommandKey&&!t._canSort)return}t.sortBy(l),t.autoSaveState()}}}_columnDownHandler(e){const t=this,o=(t.enableShadowDOM?t.shadowRoot:t.getRootNode()).elementsFromPoint(e.clientX,e.clientY);let l=null,a=null;const n=new Date-t._clickTime<t.behavior.doubleClickTimingDelay;t.$.headerBar&&t.$.headerBar.closePanel(),t._doubleClickHandler(e);for(let e=0;e<o.length;e++){const t=o[e];if(t.classList.contains("smart-action-button"))return;if(t.getAttribute("data-field")){l=t.getAttribute("data-field"),a=t;break}}if(l){const o=a.column;if(!o)return;if("_commandColumn"===l)return void(t.editing.commandColumn.dataSource.commandColumnMenu.visible&&t._applyCommand(t.editing.commandColumn.dataSource.commandColumnMenu.command));const i=function(a){const n=o.selectionColumn?t.selection.checkBoxes.action===a&&t.selection.enabled:t.selection.action===a&&t.selection.enabled;if("col-resize"!==o.element.style.cursor&&(!t.appearance.showColumnHeaderDragIcon||!e.originalEvent.target.classList.contains("smart-drag-handle"))&&n){if(t.editing.enabled&&t.editing.editColumn===o)return;if(e.shiftKey||e.ctrlKey||e.metaKey?t._dragSelectionStartDataField=null:t._dragSelectionStartDataField=l,"_checkBoxColumn"===l)return void t._toggleColumnSelection(o);"_rowHeaderColumn"===l&&t.selection.enabled&&t.selection.allowRowHeaderSelection&&t.appearance.showRowHeaderSelectIcon&&(delete t._areAllRowsSelected,t.areAllRowsSelected()?t.clearSelection():t.selectAllRows(),o.refresh()),t.selection.allowColumnHeaderSelection&&o.allowSelect&&t._setSelection(null,o.dataField,e)}};if(t.editing.isEditing&&t.endEdit(),i("click"),t._mobile){t._hideActionButtons();const o=(o,l)=>{if(o&&o.autoShowActionButton){const a=l.getBoundingClientRect(),n=t.offset(l);if(n.left<=e.pageX&&n.left+a.width-6>=e.pageX){if(!t.hasColumnMenu(o))return;l._showActionButton()}else l._hideActionButton()}};for(let e=0;e<t._columnElements.length;e++){const l=t._columnElements[e];o(l.column,l)}}if(t.$.fireEvent("columnClick",{column:o,dataField:o.dataField}),n&&(t.$.fireEvent("columnDoubleClick",{column:o,dataField:o.dataField}),i("doubleClick"),t._onColumnDoubleClick(o,e)),Smart.Utilities.Core.isMobile){const o=t.rightToLeft?a.getBoundingClientRect().left:a.getBoundingClientRect().right,n=10;if(o-n<=e.clientX&&e.clientX<=o+n){const o=t.columnByDataField[l];if(!o||o&&!o.allowResize)return;const n=t._isLastVisibleColumn(o);if("split"===t.behavior.columnResizeMode&&n)return;a.style.cursor="col-resize",a.sortButton.style.cursor="col-resize",a.filterButton.style.cursor="col-resize",t._columnToResizeRect=t.getBoundingRect(a),t._columnToResizeElement=a,t._columnToResizeDataField=l,e.preventDefault(),e.originalEvent&&e.originalEvent.preventDefault()}}if(t._columnToResizeElement&&!t._columnResizeLine)return t._columnDownResizeHandler(e),void(t._clickTime=new Date);if(t._beginDrag(e,o),o.menu)return void(t._clickTime=new Date)}t.closeMenu(),t._clickTime=new Date}addTransformMoveStyle(e,t,o,l,a,n){e.style.opacity=n,e.style["transition-duration"]=t,e.style.transform="translate3d("+o+"px,"+l+"px,"+a+"px)"}removeTransformMoveStyle(e){e.style.opacity="",e.style["transition-duration"]="",e.style.transform=""}_rowDownHandler(e){const t=this;if(t._inputOverlay&&t._inputOverlay.classList.remove("smart-input-overlay-on"),t._doubleClickHandler(e),t._closeMenu(t.menu),t._rowResizeHandler(e),t._removeCellContentPopup(),t._toggledRow&&t.appearance.allowRowToggleAnimation)return;if(e.target&&!e.target.classList.contains("smart-grid-row-container")&&!e.target.classList.contains("smart-grid-selection-overlay")&&!e.target.classList.contains("smart-selection-overlay-content"))return;let o=e.clientX,l=e.clientY;e.touches&&(o=e.touches[0].clientX,l=e.touches[0].clientY);const a=(t.enableShadowDOM?t.shadowRoot:t.getRootNode()).elementsFromPoint(o,l);let n=null,i=null,r=null,s=null,d=null,u=null,c=null;t._lastPointerDownTime=new Date;for(let e=0;e<a.length;e++){const t=a[e];if(t.hasAttribute("toggle-button")&&(i=t),t.hasAttribute("add-row")&&(d=t),t.hasAttribute("checkbox")&&(r=t),t.hasAttribute("rating-value")&&(u=t),s||"smart-grid-cell"!==t.nodeName.toLowerCase()||(s=t),!c&&t.classList.contains("smart-card")&&(c=t),!n&&"smart-grid-row"===t.nodeName.toLowerCase()){n=t;break}}if("card"!==t.view){if(u&&(t._ratingElement=u),n&&s){const o=s?s.cell:null;if(o.row.filterRow||t._closeMenu(t.filterRowMenu),i&&o&&!o.column.rowDetailColumn&&i!==o.row.toggleDetailButton&&!i.classList.contains("row-detail"))n.row.toggle(e);else if(t.rowDetail.enabled&&t.rowDetail.visible&&i&&o&&o.column.rowDetailColumn){const e=n.row;t.editing.isEditing&&t.cancelEdit(),e.showDetail?t.hideDetail(e.id):t.showDetail(e.id)}else if(d){const e=n.row,o=e.data;let l=o.parent;const a={};for(a[o.groupDataField]=null!==e.label?e.label:null,void 0!==e.labelValue&&(a[o.groupDataField]=e.labelValue);l;){let e=null!==l.label?l.label:null;l.labelValue&&void 0!==e&&(e=l.labelValue),a[l.groupDataField]=e,l=l.parent}t.addRow(a),setTimeout((()=>{t._conditionalColors&&t._conditionalColors.update&&t._conditionalColors.update()}),100)}else{const o=n.row,l=s?s.cell:null;if(l.column._treeColumn&&r)return void(o.checked=!o.checked);l.element===o.header&&t.behavior.allowRowReorder&&t._beginDrag(e,o),t._tapTimer&&clearTimeout(t._tapTimer),t._tapTimer=setTimeout((function(){t._clickedRow===n&&t.$.fireEvent("rowTap",{row:o,id:o.id,originalEvent:e.originalEvent}),t._clickedCell===s&&t.$.fireEvent("cellTap",{cell:l,id:o.id,dataField:l.column.dataField,originalEvent:e.originalEvent})}),t.behavior.doubleClickTimingDelay);const a=function(a){if(!t.selection.enabled||o.autoGenerated||!0!==o.allowSelect)return void delete t.__selectionStarted;if(o.header&&"row-resize"===o.header.style.cursor){const a=t.offset(o.header);if(t._rowToResize&&a.left<=e.originalEvent.pageX&&e.originalEvent.pageX<=a.left+o.header.offsetWidth)return o.header.style.cursor="",void(t._rowToResize.onpointerup=()=>{const a=t.editing.isEditing;t._rowToResize.onpointerup=null,t._clickedRow===n&&!a&&!t._rowResizeLine&&l.column.rowHeaderColumn&&t.selection.allowRowHeaderSelection&&t._setSelection(o.id,l.column.dataField,e)});o.header.style.cursor=""}const i=t.editing.isEditing;if(i&&t.editing.editCell&&t.editing.editCell.row.id===o.id&&t.editing.editCell.column.dataField===l.column.dataField)return;if(i&&t.editing.editRow&&t.editing.editRow.id===o.id)return;const r=()=>{t.focus(),setTimeout((function(){t.focus()}),50)};if(t.selection.action===a){if(e.shiftKey||e.ctrlKey||e.metaKey||!t.selection.allowRowHeaderSelection&&l.column.autoGenerated?t._dragSelectionStartRow=null:t._dragSelectionStartRow=n.row,e.shiftKey||e.ctrlKey||e.metaKey?t._dragSelectionStartDataField=null:t._dragSelectionStartDataField=l.column.dataField,l.column.rowHeaderColumn&&!t.selection.allowRowHeaderSelection)return t._dragSelectionStartRow=null,void r();t._setSelection(o.id,l.column.dataField,e),r()}else(l.column.selectionColumn&&t.selection.checkBoxes.enabled&&t.selection.checkBoxes.action===a||l.column.rowHeaderColumn&&t.selection.allowRowHeaderSelection)&&(t._setSelection(o.id,l.column.dataField,e),r())},i=l.selected;t._clickTime||(t._clickTime=new Date);const d=t._clickedCell===s&&new Date-t._clickTime<t.behavior.doubleClickTimingDelay,u=e.originalEvent?e.originalEvent:e,c=3===u.which;if(c||"_commandColumn"===l.column.dataField||a("click"),t.$.fireEvent("rowClick",{row:o,id:o.id,data:t.getRowData(o.id),isRightClick:c,originalEvent:u,pageX:parseInt(u.pageX),pageY:parseInt(u.pageY)}),t.$.fireEvent("cellClick",{cell:l,id:o.id,dataField:l.column.dataField,value:l.value,isRightClick:c,originalEvent:u,pageX:parseInt(u.pageX),pageY:parseInt(u.pageY)}),c&&t.contextMenu.enabled)return t.contextMenu.id=o.id,t.contextMenu.dataField=l.column.dataField,t._focusCell(o.id,l.column.dataField),t.openContextMenu(u.pageX+10,u.pageY+10),void(t.contextMenu.selector&&(u.stopPropagation(),u.preventDefault()));if(o.autoGenerated||l.column.autoGenerated||"checkBox"===l.template&&e.originalEvent&&e.originalEvent.target&&e.originalEvent.target.classList.contains("smart-input"))t._onRowClick(o.index,o,e),t._onCellClick(l,e);else if(t.selection.enabled)if(t.selection.allowCellSelection)if("extended"===t.selection.mode){if(!0===i&&i===l.selected&&!t.selection.isDragging){const a=t._selection.focusedCell;a&&t._clickedCell&&a.id===l.row.id&&a.dataField===l.column.dataField&&a.id===t._clickedCell.cell.row.id&&a.dataField===t._clickedCell.cell.column.dataField&&(t._onRowClick(o.index,o,e),t._onCellClick(l,e))}}else d||(t._onRowClick(o.index,o,e),t._onCellClick(l,e));else if(t.selection.allowRowSelection)if("extended"===t.selection.mode){if(!0===i&&i===l.selected&&!t.selection.isDragging){const a=t._selection.focusedCell;t._clickedCell&&a.id===l.row.id&&a.id===t._clickedCell.cell.row.id&&(t._onRowClick(o.index,o,e),t._onCellClick(l,e))}}else d||(t._onRowClick(o.index,o,e),t._onCellClick(l,e));else t._onRowClick(o.index,o,e),t._onCellClick(l,e);else t._onRowClick(o.index,o,e),t._onCellClick(l,e);new Date-t._clickTime<t.behavior.doubleClickTimingDelay&&(t._clickedRow===n&&(t._onRowDoubleClick(o.index,o,e,e),t.$.fireEvent("rowDoubleClick",{row:o,id:o.id,data:t.getRowData(o.id),isRightClick:c,originalEvent:e.originalEvent,pageX:parseInt(u.pageX),pageY:parseInt(u.pageY)}),a("doubleClick")),t._clickedCell===s&&(t._onCellDoubleClick(l,e),t.$.fireEvent("cellDoubleClick",{cell:l,id:o.id,dataField:l.column.dataField,value:l.value,isRightClick:c,originalEvent:e.originalEvent,pageX:parseInt(u.pageX),pageY:parseInt(u.pageY)}))),t._clickedRow=n,t._clickedCell=s,t._clickTime=new Date,t.layout.allowCellsWrapShortcut&&t._clickedCell.hasAttribute("focus")&&t._clickedCell.hasAttribute("selected")&&e.shiftKey&&(t._cellContentPopupTimer&&clearTimeout(t._cellContentPopupTimer),t.selection.isDragging?t._removeCellContentPopup():l.autoWrap())}}}else if(c){const o=c.getAttribute("row-id"),l=t.rowById[o];if(l){const a=e.originalEvent?e.originalEvent:e,n=3===a.which;if(l.element||l.createElement(),t.$.fireEvent("rowClick",{row:l,id:l.id,data:t.getRowData(l.id),isRightClick:n,originalEvent:a,pageX:parseInt(a.pageX),pageY:parseInt(a.pageY)}),s){const e=s.getAttribute("data-field");if(e){const o=t.columnByDataField[e],i=new Smart.Grid.Cell(l,o,this);s.cell=i,i.element=s,i&&t.$.fireEvent("cellClick",{cell:i,id:l.id,dataField:i.column.dataField,value:i.value,isRightClick:n,originalEvent:a,pageX:parseInt(a.pageX),pageY:parseInt(a.pageY)})}}const i=e.originalEvent.target;if(c.classList.contains("smart-card-header"))l.element&&l.element.row!==l&&(l.element.row=l),l.toggle();else if(l.children&&l.children.length>0&&(i.classList.contains("smart-icon-ungroup")||i.classList.contains("smart-icon-group")))l.element&&l.element.row!==l&&(l.element.row=l),l.toggle();else if(t.editing.enabled){const l=t.editing.dialog.enabled,a=t.editing.mode;if(i.scrollHeight>i.offsetHeight){const o=t.offset(i);if(e.originalEvent.pageX>=o.left+i.offsetWidth-15)return}const n=t.context;t.context=t,t.editing.dialog.enabled=!0,t.editing.mode="row",t._settingsDialogRowId=o;let r=t._isUpdating;c.setAttribute("edit",""),t.beginEdit(o),t._isUpdating=r,t._endCardRowEdit?(t.removeEventListener("endEdit",t._endCardRowEdit,null),t.removeEventListener("cancelEdit",t._endCardRowEdit,null)):t._endCardRowEdit=()=>{t.context=t,t.editing.dialog.enabled=l,t.editing.mode=a,t.editing.isEditing=!1,t.context=n,delete t._settingsDialogRowId,delete t._dialogEdit},t.addEventListener("endEdit",t._endCardRowEdit),t.addEventListener("cancelEdit",t._endCardRowEdit)}}}}showDetail(e){const t=this.rowById[e];t&&(t.showDetail=!0)}hideDetail(e){const t=this.rowById[e];t&&(t.showDetail=!1)}_focusHandler(){this._focused=!0,this.setAttribute("focus","")}_blurHandler(){this._focused=!1,this.removeAttribute("focus")}_notify(e,t,o){const l=this;if(l.notifyFn)for(let a=0;a<l.notifyFn.length;a++)l.notifyFn[a](e,t,o)}notify(e){const t=this;e&&(t.notifyFn||(t.notifyFn=[]),t.notifyFn.push(e))}_applyTemplate(e,t){let o=null;if(null!==e&&""!==e)if(e&&"function"==typeof e)e(t);else if((e.startsWith("#")||e.startsWith("."))&&(o=document.querySelector(e)),o)t.innerHTML="",o instanceof HTMLElement&&!(o instanceof HTMLTemplateElement)?t.appendChild(o):t.appendChild(o.content.cloneNode(!0).firstElementChild);else{const o=function(e){const t=document.createElement("template");return e=e.trim(),t.innerHTML=e,t.content.firstChild}(e);o&&(t.innerHTML="",t.appendChild(o))}else t.innerHTML=""}propertyChangedHandler(e,t,o){const l=this;if(l.isInitialized){switch(l._notify(e,t,o),e){case"onRowHistory":case"onRowInserted":case"stateSettings_current":return;case"highlighted":"kanban"===l.view&&l._kanban&&(l._kanban.selectTask(o),l._kanban.ensureVisible(o));break;case"view":return void(l.$.headerBar&&l.$.headerBar._setView&&l.$.headerBar._setView(o,!0));case"users":case"currentUser":l._refreshCurrentUser(),l._recycle();break;case"summaryRow_visible":{for(let e=0;e<l.columns.length;e++)l._summaryRowCount=Math.max(l._summaryRowCount,l.columns[e].summary.length);const e=l.onRowInserted;l.onRowInserted=null,l._renderRows(!0),l.onRowInserted=e;break}case"conditionalFormatting":return l._renderConditionalFormatting(),void l.refresh();case"appearance_displayLoadingIndicator":return void l._setLoadingIndicatorVisibility();case"appearance_placeholder":return void(l.$.placeholder.innerHTML=o);case"appearance_showColumnHeaderLines":case"appearance_showColumnGroupLines":case"appearance_showColumnLines":case"appearance_showRowLines":return void l._recycle();case"appearance_allowColumnStickyPosition":o?l._stickHeader():l._unstickHeader();break;case"appearance_showColumnIcon":for(let e=0;e<l.columns.length;e++)l.columns[e].setProperty("showIcon",l.appearance.showColumnIcon);l._recycle();break;case"appearance_showRowHeaderNumber":case"appearance_showRowHeader":{l._initializeRowNumberColumn();const e=l._frozenNearColumns[0];e.rowHeaderColumn&&e.element&&!e.element.parentNode&&l.$.columnNearContainer.appendChild(e.element),l.refresh();break}case"header_visible":if(l.header.visible&&""===l.header.template){let e=l.$.header;l.header.appendTo&&(e=document.querySelector(l.header.appendTo),e?e.onclick=e=>{l._headerClickHandler(e)}:e=l.$.header),e.innerHTML='<smart-grid-toolbar header-position="top"></smart-grid-toolbar>',l.$.headerBar=e.firstElementChild,l.$.headerBar._init(l),l.header.onInit&&l.header.onInit(l.$.headerBar)}break;case"header_buttons":l.header.visible&&""===l.header.template&&l._refreshHeaderBar();break;case"header_template":l._applyTemplate(o,l.$.header);break;case"footer_template":l._applyTemplate(o,l.$.footer);break;case"layout_columnWidth":case"columnWidth":{l.columns.canNotify=!1;let e=parseInt(o);if(isNaN(e)&&(e=null),e>=30||null===e)for(let t=0;t<l.columns.length;t++)l.columns[t].width=e;l.columns.canNotify=!0,l.refresh();break}case"checkBoxes_visible":return void l._recycle();case"checkBoxes_hasThreeStates":return l.rows.canNotify=!1,l._applyThreeStates(l.rowHierarchy),l.rows.canNotify=!0,void l._recycle();case"columnHeader_visible":l.__columnHeaderHeight=null,l.refresh();break;case"selection_checkBoxes_enabled":l._selectionColumn.visible=o;break;case"selection_checkBoxes_autoShow":l._selectionColumn.element&&(o?l._selectionColumn.element.setAttribute("auto-show",""):l._selectionColumn.element.removeAttribute("auto-show"));break;case"selection_checkBoxes_position":{let e=l.viewColumns.indexOf(l._selectionColumn);l.viewColumns.canNotify=!1,l.viewColumns.splice(e,1);const t=l._frozenNearColumns.indexOf(l._selectionColumn),a=l._frozenFarColumns.indexOf(l._selectionColumn);if(t>=0&&l._frozenNearColumns.splice(t,1),a>=0&&l._frozenFarColumns.splice(a,1),"far"===o)l._selectionColumn.canNotify=!1,l._selectionColumn.freeze="far",l._selectionColumn.canNotify=!0,l._frozenFarColumns.splice(0,0,l._selectionColumn),l.viewColumns.push(l._selectionColumn),l.$.columnFarContainer.appendChild(l._selectionColumn.element);else{let e=0,t=0;for(let o=0;o<l.viewColumns.length&&(l.viewColumns[o].autoGenerated||l.viewColumns[o].dataField!==l.columns[t++].dataField);o++)l.viewColumns[o].autoGenerated&&e++;l._selectionColumn.canNotify=!1,l._selectionColumn.freeze="near",l._selectionColumn.canNotify=!0,l._frozenNearColumns.splice(e,0,l._selectionColumn),l.viewColumns.splice(e,0,l._selectionColumn),l.$.columnNearContainer.appendChild(l._selectionColumn.element)}l.viewColumns.canNotify=!0;break}case"selection_mode":if(l._selection&&(l._selection.focusedCell=null),l.selection.allowCellSelection)l.clearSelection();else if("one"===o){const e=l.getSelection();if(l.clearSelection(),e.rows&&e.rows[0]){e.rows[0].row.selected=!0;const t=l.rowById[e.rows[0].row.id].getCell(l.columns[0].dataField);l._selection.focusedCell={id:t.row.id,dataField:t.column.dataField,value:t.value,index:t.row.index}}}break;case"grouping_groupBy":return l.dataSource&&l.dataSource.groupBy&&(l.dataSource.groupBy=o),void l.refresh();case"sorting_enabled":return void l.refresh();case"sorting_maintainSort":return void l._recycle(!1);case"filtering_enabled":return o&&0===l._filterPanels.length&&l._createFilterPanels(),void(l.header.visible&&l.refresh());case"filtering_filterRow_visible":return l._initializeRows(),l._initializeRowElements(),void l.refresh();case"filtering_operator":return void l.refreshFilters();case"filtering_filter":for(let e=0;e<l.columns.length;e++){const t=l.columns[e];t.canNotify=!1,t.setProperty("filter",null),t.canNotify=!0}for(let e=0;e<l.filtering.filter.length;e++){const t=l.filtering.filter[e];if(t&&t.splice){const e=t[0],o=t.splice(1);let a=null;if(o instanceof Smart.FilterGroup)a=o;else{const t=l.columnByDataField[e];t&&(a=l.dataSource._createFilter(t.dataType,o))}a&&l.addFilter(e,a,!1)}}return void l.refreshFilters();case"messages":case"locale":{if(l.columns)for(let e=0;e<l.columns.length;e++)l.columns[e]._cellsCachedValues=[];l._dialogEdit&&(l._dialogEdit.close(),l._dialogEdit=null),l._dialogDelete&&(l._dialogDelete.close(),l._dialogDelete=null),l._dialogAddRow&&(l._dialogAddRow.close(),l._dialogAddRow=null);const e=l.$.headerPager.querySelector("smart-pager"),t=l.$.footerPager.querySelector("smart-pager");e&&(e.locale=l.locale),t&&(t.locale=l.locale);const o=(e,t)=>{l._handleFilterMenuClick(e,t)};l._filterInfo||(l._filterInfo={}),l._filterInfo.stringConditions=[{icon:"smart-icon-contains",command:o,value:"CONTAINS",label:l.localize("CONTAINS")},{icon:"smart-icon-does-not-contain",command:o,value:"DOES_NOT_CONTAIN",label:l.localize("DOES_NOT_CONTAIN")},{icon:"smart-icon-starts-with",command:o,value:"STARTS_WITH",label:l.localize("STARTS_WITH")},{icon:"smart-icon-ends-with",command:o,value:"ENDS_WITH",label:l.localize("ENDS_WITH")},{icon:"smart-icon-equals",command:o,value:"EQUAL",label:l.localize("EQUAL")},{icon:"smart-icon-delete",command:o,value:"CLEAR_FILTER",label:l.localize("CLEAR_FILTER")}],l._filterInfo.numberAndDateConditions=[{icon:"smart-icon-equals",command:o,value:"EQUAL",label:l.localize("EQUAL")},{icon:"smart-icon-not-equal",command:o,value:"NOT_EQUAL",label:l.localize("NOT_EQUAL")},{icon:"smart-icon-less-than",command:o,value:"LESS_THAN",label:l.localize("LESS_THAN")},{icon:"smart-icon-less-than-equal",command:o,value:"LESS_THAN_OR_EQUAL",label:l.localize("LESS_THAN_OR_EQUAL")},{icon:"smart-icon-greater-than",command:o,value:"GREATER_THAN",label:l.localize("GREATER_THAN")},{icon:"smart-icon-greater-than-equal",command:o,value:"GREATER_THAN_OR_EQUAL",label:l.localize("GREATER_THAN_OR_EQUAL")},{icon:"smart-icon-between",command:o,value:"RANGE",label:l.localize("RANGE")},{icon:"smart-icon-delete",command:o,value:"CLEAR_FILTER",label:l.localize("CLEAR_FILTER")}],l._refreshHeaderBar(),l.$.headerBar&&(l.$.headerBar.messages=l.messages,l.$.headerBar.locale=l.locale,l.$.headerBar._localizeHeader(),l.$.headerBar._getInnerElementMessages()),l.grouping.groupBar.visible&&l._renderGroupBar(),l._recycle();break}case"paging_spinner_enabled":l._refresh();break;case"pager_visible":return l._renderPagers(),void l._refreshPaging(!1);case"paging_pageIndex":case"pager_position":case"paging_enabled":return void l._refreshPaging(!0);case"paging_pageSize":return void l._refreshPaging(!1);case"columns":{l.__measuredColumnHeight=null,l.editing&&l.editing.isEditing&&l.cancelEdit(),l._cellEditors=[];let e=!1;if(t&&t.length)for(let o=0;o<t.length;o++)if(t[o].freeze){e=!0;break}if(l.columns&&l.columns.length)for(let t=0;t<l.columns.length;t++)if(l.columns[t].freeze){e=!0;break}if(e&&l._initializeRowElements(),l.columns&&l._sortedColumns){const e=[];l.columns.forEach((t=>{t.sortOrder&&e.push(t)})),l._sortedColumns=JSON.parse(JSON.stringify(e))}l._renderColumns(),l._refreshHeaderBar();const o=l._sortedColumns;if(o){l.clearSort();for(let e=0;e<l.columns.length;e++)delete l.columns[e]._cellsCachedValues;l._refreshSort(o)}if(l.columns&&l.filtering.enabled){l.beginUpdate();for(let e=0;e<l.columns.length;e++){const t=l.columns[e];if(t.canNotify=!1,l.removeFilter(t.dataField),t.filtered=!1,t.canNotify=!0,t.filter){let e=null,o=t.filter;e=o instanceof Smart.FilterGroup?o:l.dataSource._createFilter(t.dataType||"string",o),e&&l.addFilter(t.dataField,e,!1)}}l.refreshFilters(),l.endUpdate()}return l.layout.isDirty=!0,l._resetCachedLayout(),void l._refreshLayout()}case"columnGroups":if(l._columnGroups=[],l._columnHeights=0,l.viewColumns)for(let e=0;e<l.viewColumns.length;e++){const t=l.viewColumns[e],o=t.element;t.top=0,t.level=0,o&&(o.style.top="",o.style.height="",o.style.lineHeight="")}return l.columns.canNotify=!1,l.columns=l._initColumns,l._renderColumns(),l.columns.canNotify=!0,l.__columnHeaderHeight=null,void l.refresh();case"dataSource":if(delete l._isFirstVirtualDataSourceRequest,"dataSource"===e&&t&&o){const e=l.dataSource&&l.dataSource.virtualDataSource&&!l.dataSource.virtualDataSourceOnExpand&&"infinite"!==l.scrolling;if(t instanceof Smart.DataAdapter&&!e&&t.length===o.length&&t.length>0&&o.length>0&&!l.dataSourceSettings.childrenDataField&&!l.dataSourceSettings.parentDataField&&!t.parentDataField){if(l.dataSource=t,l._cachedDataSource===o)return;return setTimeout((()=>{let e=null;if(t&&l.dataSource&&l.dataSource._expandedRowIds){let t={};for(let e in l.dataSource._expandedRowIds){let o=""+e;o=o.replace("Item","").replace(/_/gi,"."),t[o]=!0}e=t}if(l.beginUpdate(),l._sortedColumns&&l._sortedColumns.length>0&&void 0===l._getId())for(let e=0;e<o.length;e++){const t=l.dataSource[e],a=o[e];l._updateRow(t,a,!0)}else for(let e=0;e<o.length;e++){const t=o[e],a=l.dataSource[e].$.id;l._updateRow(a,t,!0)}delete l.__autoRowHeight,l._virtualOnExpandCache=[],l._cellsMerge=[],l._cellStyles=[];const a=l._filters,n=l._sortedColumns;if(l.clearSort(),l.filtering.filterRow)for(let e=0;e<l.columns.length;e++)l.columns[e]._filterEditorInitialized=!1;for(let e=0;e<l.columns.length;e++)delete l.columns[e]._cellsCachedValues;if(n&&l._refreshSort(n),a&&a.length>0&&(l._filters=null,l.refreshFilters()),l.grouping.enabled)for(let t in e)l._expandCollapseGroup(t,!0);l.endUpdate()})),l._cachedDataSource=o,void(l.header.visible&&""===l.header.template&&l.$.headerBar._init(l))}}return l.dataSource.length>1e4?(l.appearance.displayLoadingIndicator=!0,l._setLoadingIndicatorVisibility(),setTimeout((()=>{l.dataBind()}),100),setTimeout((()=>{l.appearance.displayLoadingIndicator=!1,l._setLoadingIndicatorVisibility(),l._recycle(!1)}),200)):(l.dataSource&&l.dataSource instanceof Smart.DataAdapter&&l.columns&&l.dataSource.dataFields&&l.dataSource.dataFields.forEach((e=>{const t=l.columnByDataField[e.name];t&&(t.dataType=e.dataType)})),l.dataBind()),void(l.header.visible&&""===l.header.template&&l.$.headerBar._init(l));case"rowDetail_dialog_width":case"rowDetail_dialog_height":case"rowDetail_dialog_enabled":case"rowDetail_dialog_visible":return;case"rowDetail_height":case"rowDetail_enabled":{l.beginUpdate(),l.rows.canNotify=!1;const e=l.appearance.allowRowDetailToggleAnimation;l.appearance.allowRowDetailToggleAnimation=!1;for(let e=0;e<l._recyclingRows.length;e++){const t=l._recyclingRows[e];t.height=null,t.setProperty("showDetail",!1),t.detailHeight=l.rowDetail.height}if(l.rows.canNotify=!0,l.rowDetail.enabled){let t=!1;for(let e=0;e<l.viewColumns.length;e++)if(l.viewColumns[e].rowDetailColumn){t=!0;break}if(!t)return l.appearance.allowRowDetailToggleAnimation=e,l.endUpdate(),void l._renderColumns(!0)}else for(let e=0;e<l.viewColumns.length;e++){const t=l.viewColumns[e];if(t.rowDetailColumn){t.visible=!1;break}}return l.appearance.allowRowDetailToggleAnimation=e,void l.endUpdate()}case"rowDetail_visible":for(let e=0;e<l.viewColumns.length;e++){const t=l.viewColumns[e];if(t.rowDetailColumn){t.visible=o;break}}return;case"displayLoadingIndicator":return void l._setLoadingIndicatorVisibility();case"filterable":return void l._refreshLayout();case"layout_allowCellsWrap":{const e=l.columns.canNotify;l.columns.canNotify=!1;for(let e=0;e<l.columns.length;e++)l.columns[e].cellsWrap=o;return l.layout.isDirty=!0,l._resetCachedLayout(),l._refreshLayout(),l.refresh(),void(l.columns.canNotify=e)}case"showViewBar":return l.layout.isDirty=!0,l._resetCachedLayout(),l._refreshLayout(),void l.refresh();case"layout_autoHeight":case"layout_autoWidth":case"layout_columnMinHeight":case"layout_rowMinHeight":case"layout_columnHeight":case"layout_rowHeight":return l.layout.isDirty=!0,l._resetCachedLayout(),l._refreshLayout(),void l.refresh();case"rightToLeft":return void l.refresh();case"selectionMode":return;case"editing_addNewColumn_visible":l._addNewColumn?(l._addNewColumn.visible=o,l.refresh()):l._renderColumns();break;case"editing_addNewRow_displayMode":{"row"===l.editing.addNewRow.displayMode&&l.editing.addNewRow._addButton&&(l.editing.addNewRow._addButton.remove(),delete l.editing.addNewRow._addButton);const e=l._scrollView.vScrollBar;return e.style.height="",e.style.top="",e.style.setProperty("--smart-scroll-bar-near-size","0px"),l._renderAddNewRow(),void l.refresh(!0)}case"editing_addNewRow_label":case"editing_addNewRow_visible":case"editing_addNewRow_position":return!1===l.editing.addNewRow.visible&&"button"===l.editing.addNewRow.displayMode&&(l.editing.addNewRow._addButton&&l.editing.addNewRow._addButton.remove(),l._newRow&&l._newRow.element.classList.add("smart-hidden")),l._renderAddNewRow(),void l.refresh();case"editing_enabled":o?l.removeAttribute("aria-readonly"):l.setAttribute("aria-readonly",!0);break;case"editing_dialog_visible":return;case"editing_commandBar_dataSource_commandBarAddRow_visible":case"editing_commandBar_dataSource_commandBarDeleteRow_visible":case"editing_commandBar_dataSource_commandBarBatchSave_visible":case"editing_commandBar_dataSource_commandBarBatchRevert_visible":case"editing_commandBar_visible":case"editing_commandBar_displayMode":case"editing_commandBar_position":l._renderCommandBar();break;case"editing_commandColumn_position":l._renderColumns(!0);break;case"editing_commandColumn_visible":return void l.refresh(!0);case"editing_commandColumn_inline":return l._commandColumn.visible=l.editing.commandColumn.visible&&!l.editing.commandColumn.inline,void l.refresh(!0);case"layout_isDirty":return;case"editing_commandColumn_dataSource_commandColumnCustom_label":case"editing_commandColumn_dataSource_commandColumnCustom_icon":case"editing_commandColumn_dataSource_commandColumnCustom_visible":case"editing_commandColumn_dataSource_commandColumnUpdate_label":case"editing_commandColumn_dataSource_commandColumnUpdate_icon":case"editing_commandColumn_dataSource_commandColumnUpdate_visible":case"editing_commandColumn_dataSource_commandColumnEdit_label":case"editing_commandColumn_dataSource_commandColumnEdit_icon":case"editing_commandColumn_dataSource_commandColumnEdit_visible":case"editing_commandColumn_dataSource_commandColumnDelete_label":case"editing_commandColumn_dataSource_commandColumnDelete_icon":case"editing_commandColumn_dataSource_commandColumnDelete_visible":case"editing_commandColumn_displayMode":return delete l.__cellsCommandTemplate,void l.refresh(!0)}l.refresh()}}ready(){super.ready();const e=this;e._renderInDropDown();const t=e._scrollView.vScrollBar,o=e._scrollView.hScrollBar;t.hasStyleObserver=!1,o.hasStyleObserver=!1,t.hasResizeObserver=!1,o.hasResizeObserver=!1,t.wait=!1,o.wait=!1,t.onChange=e._verticalScrollbarHandler.bind(e),o.onChange=e._horizontalScrollbarHandler.bind(e),e.setFocusable(!0),e.$.loadingIndicatorPlaceholder.innerHTML=e.messages[e.locale]&&e.messages[e.locale].loadingIndicatorPlaceholder?e.localize("loadingIndicatorPlaceholder"):e.appearance.loadingIndicatorPlaceholder,e.$.placeholder.innerHTML=e.messages[e.locale]&&e.messages[e.locale].placeholder?e.localize("placeholder"):e.appearance.placeholder,e._setLoadingIndicatorVisibility(),e._cellsMerge=[],e._cellStyles=[],e.checkLicense()}_createFilterPanels(){const e=this;if(e._filterPanels){if(e._filterPanels.length>0)return}else e._filterPanels=[];e.filtering.enabled&&0===e._filterPanels.length&&requestAnimationFrame((()=>{const t=document.createElement("smart-filter-panel"),o=document.createElement("smart-filter-panel"),l=document.createElement("smart-filter-panel"),a=document.createElement("smart-filter-panel");o.filterType="boolean",l.filterType="numeric",a.filterType="date",e._filterPanels.bool=o,e._filterPanels.date=a,e._filterPanels.numeric=l,e._filterPanels.string=t;for(let t in e._filterPanels){const o=e._filterPanels[t];o.rightToLeft=e.rightToLeft,o.classList.add("smart-hidden"),e.$.content.appendChild(o),o.parentNode.removeChild(o)}}))}_applyScrolling(){const e=this,t=e._scrollView.vScrollBar;requestAnimationFrame((()=>{switch(t.largeStep=e.$.scrollView.offsetHeight,e.scrolling){case"physical":case"infinite":case"virtual":t.step=e.layout.rowMinHeight,t.mechanicalAction="switchWhileDragging";break;case"deferred":t.step=10,t.mechanicalAction="switchWhenReleased";break;case"logical":t.step=e.layout.rowMinHeight,t.mechanicalAction="switchWhileDragging"}}))}_measureRowElement(e){const t=new Smart.Grid.Row({data:e,index:999999,grid:this});if(!t)return null;const o=t.createElement();return o.classList.add("smart-grid-measure-row"),this.$.scrollView.appendChild(o),o.style.height="",o.style.lineHeight="",o.style.height="",o.style.lineHeight="",t._isMeasureRow=!0,t.render(),o}get _autoRowHeight(){const e=this;if(e.__autoRowHeight)return e.__autoRowHeight;let t=e.layout.rowMinHeight;if(!e.dataSource||e.dataSource&&0===e.dataSource.length)return t;const o=new Smart.Grid.Row({index:0,grid:e}),l=o.createElement();e.$.scrollView.appendChild(l),e.removeAttribute("grouped"),e.removeAttribute("tree"),e.grouping.enabled&&e.dataSource.groupBy&&e.dataSource.groupBy.length>0?e.setAttribute("grouped",""):e.dataSource.boundHierarchy&&e.setAttribute("tree","");const a={};for(let t=0;t<e.dataSource.dataFields.length;t++)a[e.dataSource.dataFields[t].name]="ABCDEFHIJLMNOPQRSTUVWXYZ1234567910|";o.data=a,o._isMeasureRow=!0,o.render(),l.style.height="",l.style.lineHeight="",t=Math.max(l.offsetHeight,t);for(let e=0;e<l.children.length;e++)l.children[e].style.height="";for(let a=0;a<l.children[1].children.length;a++){if(l.children[1].children[a].style.height="auto",e.columns[0]){const t=o.getCell(e.columns[0].dataField);t&&t.render()}t=Math.max(t,8+l.children[1].children[a].offsetHeight);break}return e.$.scrollView.removeChild(l),e.__autoRowHeight=t,e.layout.rowMinHeight&&t<e.layout.rowMinHeight&&(e.__autoRowHeight=e.layout.rowMinHeight),t}get _scrollHeight(){const e=this,t="card"===e.view;let o=e._recyclingRows,l=0,a=e._autoRowHeight,n=0,i=0;if(e.__scrollHeight)return e.__scrollHeight;if(0===o.length||0===e.columns.length||!e.hasVisibleColumn())return 0;let r=40,s=1,d=0;if(t){for(let t=0;t<e.viewColumns.length;t++){const o=e.viewColumns[t];o.visible&&!o.autoGenerated&&(r+=e.layout.cardRowMinHeight,d++,o.cardHeight&&(r-=e.layout.cardRowMinHeight,r+=o.cardHeight*e.layout.cardRowMinHeight))}let t=e.offsetWidth;!e.appearance.showViewBar||e.appearance.viewBarAppendTo||e.appearance.showViewBarAsDropdown||(t-=e.layout.viewBarWidth+5),s=t<e.layout.cardMinWidth?1:"auto"===e.layout.cardsPerRow?Math.floor(t/e.layout.cardMinWidth):e.layout.cardsPerRow,1===s&&(r+=5*d),e._cardHeight=r}e._cardsPerRow=s,e.rows.canNotify=!1;const u=e._measureRowElement(o[0].data),c=o.length;for(let s=0;s<c;s++){let d=o[s];if(!d.visible||!1===d.filtered){d.height=0,d.cellHeight=0,d.top=l;continue}const c=e.rowDetail.enabled&&d.showDetail&&!e.rowDetail.dialog.enabled;let m=!d.height||!d.cellHeight||c||"auto"===d.height||"auto"===d._height||"auto"===e.layout.rowHeight||e.layout.isDirty;if(t&&d.height!==r&&(d.height=d.cellHeight=r),m&&!d.expandHeight){if(d.detailHeight||(d.detailHeight=200),t)d.height=d.cellHeight=r;else if(e.layout.rowHeight){if(e.layout.rowHeight)if("number"==typeof e.layout.rowHeight)e.layout.rowHeight<e.layout.rowMinHeight&&(e.layout.rowHeight=e.layout.rowMinHeight),d.height=e.layout.rowHeight,d.computedHeight&&(d.height=d.computedHeight),d.minHeight>d.height&&(d.height=d.minHeight),void 0!==d.label&&"advanced"===e.grouping.renderMode&&(d.height=e.grouping.groupRowHeight),d.cellHeight=d.height,e.rowDetail.enabled&&d.showDetail&&!e.rowDetail.dialog.enabled&&(d.height+=d.detailHeight);else if("auto"===e.layout.rowHeight){e.layout.rowHeight<e.layout.rowMinHeight&&(e.layout.rowHeight=e.layout.rowMinHeight),d.element=u,d.grid=e,d.element&&d.element.classList.contains("smart-hidden")&&d.element.classList.remove("smart-hidden");const t=d.data&&e.isRendered?d._autoSize(d):a,o=d.canNotify;d.canNotify=!1,d.height=t,d.computedHeight&&(d.height=d.computedHeight),void 0!==d.label&&"advanced"===e.grouping.renderMode&&(d.height=e.grouping.groupRowHeight),d.cellHeight=d.height,e.rowDetail.enabled&&d.showDetail&&!e.rowDetail.dialog.enabled&&(d.height+=d.detailHeight),d.canNotify=o}else e.layout.rowHeight(s,d),d.height||(d.height=a),d.cellHeight=d.height,e.rowDetail.enabled&&d.showDetail&&!e.rowDetail.dialog.enabled&&(d.height+=d.detailHeight)}else{if("auto"===d.height||"auto"===d._height){d.element=u,d.element&&d.element.classList.contains("smart-hidden")&&d.element.classList.remove("smart-hidden");const t=d.data&&e.isRendered?d._autoSize(d):a;d.height=t,d._height="auto"}else d.height=a;void 0===d.label||d.summaryRow||"advanced"!==e.grouping.renderMode||(d.height=e.grouping.groupRowHeight),d.computedHeight&&(d.height=d.computedHeight),d.cellHeight=d.height,e.rowDetail.enabled&&d.showDetail&&!e.rowDetail.dialog.enabled&&(d.height+=d.detailHeight)}e._rowGap&&s<e.rows.length-1&&(d.height+=e._rowGap)}!t&&(!0===d.freeze||"near"===d.freeze?d.visible&&(n+=d.height):"far"===d.freeze&&d.visible&&(i+=d.height),d.freeze&&d.visible)?d.top=l:(d.top!==l&&(d.top=l),d.expandHeight?l+=d.cellHeight:l+=d.height)}if(e._summaryRowCount&&e.summaryRow.visible&&(l+=1*a),e.editing.addNewRow&&"button"===e.editing.addNewRow.displayMode&&(l+=1*a),e.filtering&&e.filtering.filterRow.visible&&(n+=a),e.editing.addNewRow&&"button"!==e.editing.addNewRow.displayMode&&e.rowHierarchy&&e.editing.addNewRow.visible&&(l+=a,"far"!==e.editing.addNewRow.position&&(n+=a)),e.dataSource&&e.dataSource.virtualDataSource&&!1===e.paging.enabled){let t=e.dataSource.length>e.virtualModeCachedRowsCount?e.virtualModeCachedRowsCount:e.dataSource.length;"infinite"===e.scrolling&&(t=e.dataSource.length),"virtual"===e.scrolling&&t>=e.virtualModeCachedRowsCount&&(l=e.rows[0]?e.rows[0].height*e.dataSource.length:e.layout.rowMinHeight*e.dataSource.length)}return t&&(l=r*Math.ceil(o.length/s)),e.__scrollHeight=l,e.__frozenNearHeight=n,e.__frozenFarHeight=i,e._scrollView.scrollHeight=l-e.$.scrollView.offsetHeight+n+i,l=e.__scrollHeight+n+i-1,e.grouping.enabled&&e.dataSource.groupBy.length>0&&e.grouping.groupIndent>0&&"advanced"===e.grouping.renderMode&&(l+=parseInt(e.grouping.groupIndent/2)),e.__scrollHeight=l,u.remove(),o[0]&&delete o[0]._isMeasureRow,e.rows.canNotify=!0,l}_measureColumnHeight(){const e=this;if(e.__measuredColumnHeight)return e.__measuredColumnHeight;const t=document.createElement("smart-grid-column");t.style.height="auto",t.style.position="static";const o=document.createElement("div");o.classList.add("smart-label"),o.innerHTML="aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRwWxXyYzZ1234567890",t.appendChild(o),e.$.columnHeader.appendChild(t);let l=e.$.columnHeader.offsetHeight;return e.$.columnHeader.removeChild(t),e._columnHeights&&e._columnHeights.length>1&&(l=e._columnHeights[0]),l<e.layout.columnMinHeight&&(l=e.layout.columnMinHeight),e.__measuredColumnHeight=l,l}_initializeColumnGroupsHierarchy(){const e=this;let t=0;e.$.columnContainer.innerHTML="";const o=JSON.parse(JSON.stringify(e.columnGroups));if(o.length>0){for(let t=0;t<o.length;t++)o[t].parent=null,o[t].groups=null,o[t].labelTemplate=e.columnGroups[t].labelTemplate;for(let t=0;t<e.viewColumns.length;t++)e.viewColumns[t].parent=null,e.viewColumns[t].groups=null;const l=function(e){for(let t=0;t<o.length;t++){let l=o[t];if(l.name===e)return l}return null},a=function(e){let t=new Array;if(e.columnGroup&&t.push(e),e.groups)for(let o=0;o<e.groups.length;o++)if(e.groups[o].columnGroup)t.push(e.groups[o]);else if(e.groups[o].groups){let l=a(e.groups[o]);for(let e=0;e<l.length;e++)t.push(l[e])}return t};for(let e=0;e<o.length;e++){let t=o[e];if(t.groups||(t.groups=null),t.parentGroup){let e=l(t.parentGroup);e&&(t.parent=e,e.groups||(e.groups=new Array),-1===e.groups.indexOf(t)&&e.groups.push(t))}}for(let t=0;t<e.viewColumns.length;t++){let o=e.viewColumns[t];if(o.columnGroup){let e=l(o.columnGroup);e&&(e.groups||(e.groups=new Array),o.parent=e,-1===e.groups.indexOf(o)&&e.groups.push(o))}}for(let o=0;o<e.viewColumns.length;o++){const l=e.viewColumns[o];let a=l;for(l.level=0;a.parent;)a=a.parent,l.level++;a=l;let n=l.level;for(t=Math.max(t,l.level);a.parent;)a=a.parent,a&&(a.level=--n)}for(let t=0;t<o.length;t++){const l=o[t],n=a(l);l.columns=n;let i=new Array,r=0,s="near";0===n.length&&(r=-1,l.visible=!1);for(let t=0;t<n.length;t++)i.push(e.viewColumns.indexOf(n[t])),n[t].freeze&&("far"===n[t].freeze&&(s="far"),r++);r===n.length?l.freeze=s:r>0&&r<n.length&&(e.classList.add("smart-visibility-hidden"),e.error(e.localize("frozenColumns",{elementType:"Grid"}))),i.sort((function(e,t){return(e=parseInt(e))<(t=parseInt(t))?-1:e>t?1:0}));for(let t=1;t<i.length;t++)i[t]!==i[t-1]+1&&(e.classList.add("smart-visibility-hidden"),e.error(e.localize("columnGroups",{elementType:"Grid"})))}}e._columnGroupsLevel=1+t,e._columnGroups=o}_refreshColumnHeights(){const e=this;if("card"===e.view)return;e.$.columnHeader.style.height="",e._viewColumnsHeight=e._measureColumnHeight(),e._columnHeights=[];let t=0;for(let o=0;o<e._columnGroupsLevel;o++){let l=e._viewColumnsHeight;e.layout.columnHeight&&(l="number"==typeof e.layout.columnHeight?e.layout.columnHeight?e.layout.columnHeight:e._viewColumnsHeight:e.layout.columnHeight?e.columnHeight(o):e._viewColumnsHeight),l<e.layout.columnMinHeight&&(l=e.layout.columnMinHeight),l?(e._columnHeights.push(l),t+=l):(t+=e._viewColumnsHeight,e._columnHeights.push(e._viewColumnsHeight))}e._columnHeaderHeight=e._columnGroupsLevel*e._viewColumnsHeight,e._columnHeaderHeight=t,e.$.columnHeader.style.height=e._columnHeaderHeight+"px";const o=function(t){let o=0;for(let l=0;l<t.level;l++)o+=e._columnHeights[l];return o},l=function(t){let l=o(t),a=e._columnHeaderHeight-l;for(let o=t.level+1;o<e._columnHeights.length;o++){const l=o;for(let o=0;o<e.viewColumns.length;o++){const n=e.viewColumns[o];let i=!1;if(n.level===l){let o=n;for(;o.parent;){if(o.parent===t){a=e._columnHeights[l],i=!0;break}o=o.parent}if(i)break}}}return a};for(let t=0;t<e.viewColumns.length;t++){const a=e.viewColumns[t],n=l(a);a.computedHeight=n,a.top=o(a)}for(let t=0;t<e._columnGroupsLevel-1;t++)for(let a=0;a<e._columnGroups.length;a++){const n=e._columnGroups[a];if(n.level!==t)continue;if(n.groups){const e=l(n),t=o(n);n.top=t,n.computedHeight=e}const i=n.element;i&&(i.style.width=n.computedWidth+"px",e.rightToLeft?i.style.right=n.left+"px":i.style.left=n.left+"px",i.style.top=n.top+"px",i.style.height=n.computedHeight+"px",i.style.lineHeight=n.computedHeight+"px")}}_refreshColumnWidths(){const e=this;e.__clientSize=null;const t=e.$.verticalScrollBar.offsetWidth>0?e.$.verticalScrollBar.offsetWidth:0,o=e.dataSource.groupBy||[];let l=e.grouping.enabled&&"advanced"===e.grouping.renderMode?e.grouping.groupIndent*(1+o.length):0,a=0;e.selection.checkBoxes.enabled&&(a=e._selectionColumn.computedWidth?e._selectionColumn.computedWidth:e._selectionColumn.minWidth);const n=e._clientSize.width-t-l;let i=0,r=[],s=0,d=0,u=0;if(e.editing.enabled&&!e.editing.commandColumn.inline){const t=function(){const t=document.createElement("div"),o=document.createElement("div"),l=e.editing.commandColumn.dataSource;let a=0,n="",i=0;o.classList.add("smart-label");for(let t in l){const o=l[t];let a=!1;if("commandColumnMenu"===t)continue;let r=!1;a||(!0===o.visible?(i++,r=!0):"auto"===o.visible&&((e.editing.editRow||e.editing.editCell)&&!e.editing.dialog.enabled||"commandColumnEdit"!==t?!e.editing.editRow&&!e.editing.editCell||e.editing.dialog.enabled||("commandColumnUpdate"===t||"commandColumnCancel"===t)&&(i++,r=!0):(i++,r=!0)),a=!0),r&&"icon"!==e.editing.commandColumn.displayMode&&(n+="<span>"+("{{messages}}"===o.label?e.localize(t):o.label)+"</span>")}return o.innerHTML="<span>"+n+"</span>",t.appendChild(o),t.style.width="auto",t.style.position="static",e.$.columnHeader.appendChild(t),a=10+o.firstChild.offsetWidth,e.$.columnHeader.removeChild(t),"icon"===e.editing.commandColumn.displayMode?a=20+20*i:"labelAndIcon"===e.editing.commandColumn.displayMode?a+=25*i:a+=10*i,a};if(e._commandColumn.visible=e.editing.commandColumn.visible,e.editing.commandColumn.visible){const o=e.editing.commandColumn.width?e.editing.commandColumn.width:t();e.columns.canNotify=!1,e._commandColumn.width=o,e.columns.canNotify=!0}}for(let t=0;t<e.viewColumns.length;t++){const o=e.viewColumns[t];let l;"number"==typeof o.width?l=o.width:o.width&&o.width.toString().indexOf("%")>=0?(l=parseFloat(o.width)/100,l*=n-a):o.width&&(o.width.toString().indexOf("em")>=0||o.width.toString().indexOf("pt")>=0||o.width.toString().indexOf("fr")>=0)?(l=parseFloat(o.width),l*=16):"auto"===o.width?l=o._autoSize():o.visible&&(r.push(o),l=0),o.overflowWidth&&(l-=o.overflowWidth),o.visible&&(i+=l),l<o.minWidth&&(l=o.minWidth),o.computedWidth=l}if(r){let e=n-i,t=0;e<0&&(e=60*r.length);for(let o=0;o<r.length;o++){const l=r[o];let a;a=e/r.length,o===r.length-1&&(a=e-t),l.overflowWidth&&(a-=l.overflowWidth),a<l.minWidth&&(a=l.minWidth),l.computedWidth=a,t+=a}}for(let t=0;t<e.viewColumns.length;t++){let o=e.viewColumns[t];o.visible&&(l>0&&!o.autoGenerated&&(o.computedWidth+=l,l=0),o.freeze?!0===o.freeze||"near"===o.freeze?(o.left=s,u+=o.computedWidth,s+=o.computedWidth):"far"===o.freeze&&(o.left=d,d+=o.computedWidth):(o.left=u,u+=o.computedWidth))}for(let t=0;t<e._columnGroupsLevel-1;t++)for(let o=0;o<e._columnGroups.length;o++){const l=e._columnGroups[o];if(l.level!==t)continue;let a=99999;if(l.groups){const e=function(t){let o=0;for(let l=0;l<t.groups.length;l++){let n=t.groups[l];n.groups?o+=e(n):n.visible&&(a=Math.min(n.left,a),o+=n.computedWidth)}return o};l.computedWidth=e(l),l.left=a}}}_createColumnHeaderCellElements(){const e=this,t=e.$.columnContainer,o=document.createDocumentFragment();let l=0;e._columnElements=[],e.$.columnContainer.innerHTML="",e.$.columnNearContainer.innerHTML="",e.$.columnFarContainer.innerHTML="",e.rightToLeft?(e.$.columnNearContainer.classList.remove("near"),e.$.columnNearContainer.classList.add("far"),e.$.columnFarContainer.classList.remove("far"),e.$.columnFarContainer.classList.add("near")):(e.$.columnNearContainer.classList.remove("far"),e.$.columnNearContainer.classList.add("near"),e.$.columnFarContainer.classList.remove("near"),e.$.columnFarContainer.classList.add("far"));for(let t=0;t<e._frozenNearColumns.length;t++)e._frozenNearColumns[t].createElement();for(let t=0;t<e._frozenFarColumns.length;t++)e._frozenFarColumns[t].createElement();for(let t=0;t<e.viewColumns.length;t++){const a=e.viewColumns[t];if(a.freeze)continue;const n=a.createElement();void 0!==a.computedWidth?(a.parent&&n.setAttribute("column-group",a.parent.name),a.parent&&a.parent.columns&&a.parent.columns[0].dataField===a.dataField&&n.setAttribute("column-group-first-child",""),l+=a.computedWidth,e._columnElements.push(n),l<2*e._clientSize.width&&o.appendChild(n)):(e._columnElements.push(n),o.appendChild(n))}for(let t=0;t<e._columnGroups.length;t++){const l=e._columnGroups[t],a=new Smart.Grid.Column({visible:void 0===l.visible||l.visible,allowSort:!1,allowFilter:!1,allowSelect:!1,grid:e,dataField:l.name,label:l.label,labelTemplate:l.labelTemplate,align:l.align,verticalAlign:l.verticalAlign,showIcon:!1});l.column=a;const n=a.createElement();n.style.width=l.computedWidth+"px",e.rightToLeft?n.style.right=l.right+"px":n.style.left=l.left+"px",n.style.top=l.top+"px",n.style.height=l.computedHeight+"px",n.style.lineHeight=l.computedHeight+"px",o.appendChild(n),l.element=n,l.grid=this,n.onpointerdown=()=>{if(e.selection.allowColumnHeaderSelection){const t=function(e){let o=new Array;if(e.columnGroup&&o.push(e),e.groups)for(let l=0;l<e.groups.length;l++)if(e.groups[l].columnGroup)o.push(e.groups[l]);else if(e.groups[l].groups){let a=t(e.groups[l]);for(let e=0;e<a.length;e++)o.push(a[e])}return o},o=t(l);e._selectColumnsRange(o[0].dataField,o[o.length-1].dataField)}}}e.htmlColumnLastChild||(e.htmlColumnLastChild=document.createElement("smart-grid-column"),e.htmlColumnLastChild.classList.add("top-far-corner"),e.htmlColumnLastChild.onpointerdown=e=>{e.stopPropagation(),e.preventDefault()},e.$.columnHeader.appendChild(e.htmlColumnLastChild)),t.appendChild(o),t.style.width=e._computedColumnsWidth+"px",!1===e.appearance.showColumnGroupLines&&e.setAttribute("appearance_hide-column-group-lines",""),e._refreshFrozenColumns()}_refreshFrozenColumns(){const e=this;e.$.columnNearContainer.style.width=e._frozenColumnsNearWidth+"px",e.$.columnFarContainer.style.width=e._frozenColumnsFarWidth+"px";for(let t=0;t<e._columnGroups.length;t++){const o=e._columnGroups[t];o.freeze&&o.element&&(!0===o.freeze||"near"===o.freeze?e.$.columnNearContainer.appendChild(o.element):"far"===o.freeze&&e.$.columnFarContainer.appendChild(o.element))}for(let t=0;t<e.viewColumns.length;t++){const o=e.viewColumns[t];o.freeze&&o.element&&(!0===o.freeze||"near"===o.freeze?e.$.columnNearContainer.appendChild(o.element):"far"===o.freeze&&e.$.columnFarContainer.appendChild(o.element))}}get _clientSize(){const e=this;if(e.__clientSize)return e.__clientSize;const t=getComputedStyle(e.$.container),o=parseFloat(t.paddingLeft)+parseFloat(t.paddingRight),l=parseFloat(t.paddingTop)+parseFloat(t.paddingBottom),a=parseFloat(t.borderLeftWidth)+parseFloat(t.borderRightWidth),n=parseFloat(t.borderTopWidth)+parseFloat(t.borderBottomWidth);return e.__clientSize={width:e.$.container.offsetWidth-o-a,height:e.$.container.offsetHeight-l-n},e.__clientSize}_initializeRowElements(){const e=this;if(!e.rows)return;e.rows.canNotify=!1;let t=0,o=e._clientSize.height;e.$.rowNearContainer.innerHTML="",e.$.rowFarContainer.innerHTML="",e.$.rowContainer.innerHTML="",e._rowElements=[],e._overflowOffset=Math.max(o,300),e.rightToLeft?(e.$.rowNearContainer.classList.remove("near"),e.$.rowNearContainer.classList.add("far"),e.$.rowFarContainer.classList.remove("far"),e.$.rowFarContainer.classList.add("near")):(e.$.rowFarContainer.classList.remove("near"),e.$.rowFarContainer.classList.add("far"),e.$.rowNearContainer.classList.remove("far"),e.$.rowNearContainer.classList.add("near"));const l=e.offsetHeight;e.$.container.classList.add("smart-hidden");const a=e.offsetHeight;e.$.container.classList.remove("smart-hidden"),"hidden"!==e.verticalScrollBarVisibility&&l===a||(o=e._scrollHeight);const n=function(){const l=document.createDocumentFragment();if(e.rows&&0===e.rows.length)return;for(let a=0;a<e.rows.length;a++){const n=e.rows[a];if(n.freeze&&n.visible)continue;const i=n.createElement();if(l.appendChild(i),t+=e.layout.rowMinHeight,t>e._overflowOffset+o)break}e.$.rowContainer.appendChild(l);const a=e.$.rowContainer.children;for(let t=0;t<a.length;t++){const o=a[t];e.rows[t]&&(e.rows[t].element=o),e._rowElements[t]=o}};for(let t=0;t<e._frozenNearRows.length;t++){const o=e._frozenNearRows[t];o.grid=e;const l=o.createElement();o.element=l,e.$.rowNearContainer.appendChild(l)}for(let t=0;t<e._frozenFarRows.length;t++){const o=e._frozenFarRows[t];o.grid=e;const l=o.createElement();o.element=l,e.$.rowFarContainer.appendChild(l)}n();let i=0;for(;t<1.5*o&&++i<50;)n();e.rows.canNotify=!0}_refreshSummary(e){const t=this;t.summaryRow.visible&&(t._summaryUpdateTimer&&clearTimeout(t._summaryUpdateTimer),t._summaryUpdateTimer=setTimeout((()=>{!0!==t.editing.isEditing&&(t._calculateSummary(),!1!==e&&t._recycle(!1,!0,!1))}),100))}_initializeRows(){const e=this;let t=0;e._frozenNearDefaultRows=[],e._frozenFarDefaultRows=[],e.rows=[],e.rowById=[],e._frozenFarRows=[],e._frozenNearRows=[];let o=e._createdDate||new Date,l=void 0!==e._createdBy?e._createdBy:e.currentUser;const a=function(){let t=[],o=!1;for(let l=0;l<e.columns.length;l++){const a=e.columns[l];let n={};a.summary&&a.summary.length>0&&(o=!0,n[a.dataField]=a.summary,t.push(n))}if(!o)return void(e._summaryItems=[]);const l=e.getSelectedRowIds();if(l.length>=1){const o=[];for(let t=0;t<l.length;t++){const a=e.dataSource.dataItemById[l[t]];a&&o.push(a)}e._summaryItems=e.dataSource.summarize(t,o)}else if(e._selection&&e._selection.cells&&Object.keys(e._selection.cells).length>2){const o=e.getSelectedCells(!1),l=[],a=[];for(let t=0;t<o.length;t++){const n=o[t],i=n[0],r=e.dataSource.dataItemById[i];-1===l.indexOf(r)&&l.push(r),-1===a.indexOf(n[1])&&a.push(n[1])}e._summaryItems=e.dataSource.summarize(t,l);const n=Object.keys(e._summaryItems);for(let t=0;t<n.length;t++){const o=n[t];-1===a.indexOf(o)&&delete e._summaryItems[o]}}else e._summaryItems=e.dataSource.summarize(t)};e._calculateSummary=a;const n=e.columns?e.columns.filter((e=>void 0!==e.getCellValue)):[],i=function(a,i,r){let s=null;if(e.isInitialized&&(o=new Date),s=a?a.grid?a:new Smart.Grid.Row({data:a,index:i,grid:e,createdBy:l,createdDate:o}):new Smart.Grid.Row({data:{},index:i,grid:e,createdBy:l,createdDate:o}),n)for(let e=0;e<n.length;e++){const t=n[e],o=t.getCellValue(s.id,t.dataField,a);void 0!==o&&(s.data[t.dataField]=o)}if(e.rowById[s.id]&&(s.id=e.rows.length,e.rowById[s.id])){const e=function(){return(65536*(1+Math.random())|0).toString(16).substring(1)};s.id=e()}if(e.onRowInit){e.onRowInit(i,s,e),30!==s.height&&(s.cellHeight=s.height);for(let t in s)-1!==s.properties.indexOf(t)||t.startsWith("_")||e.error(e.localize("invalidRowProperty",{elementType:"Grid",propertyName:t}))}if(s.selected&&(e._selection.rows[s.id]=!0,e._selection.indexes[s.index]=s.index),s.freeze&&s.visible){if(!0===s.freeze||"near"===s.freeze){e.rows.splice(t++,0,s);const o=e.rows[t-1];-1===e._frozenNearRows.indexOf(o)&&e._frozenNearRows.push(o)}else if("far"===s.freeze){e.rows.push(s);const t=e.rows[e.rows.length-1];-1===e._frozenFarRows.indexOf(t)&&e._frozenFarRows.push(t)}}else e.rows[i]?e.rows.splice(i,0,s):e.rows.push(s),s.data&&s.data.$&&(s.data.$.history=s.history,s.data.$.starred=s.starred,s.data.$.comments=s.comments,s.data.$.style=s.style);if(!("virtual"===e.scrolling||e.paging.enabled&&e.dataSource&&e.dataSource.virtualDataSource))if(e.onRowInserted){const t=void 0===i?e.rows[e.rows.length-1]:e.rows[i],o=o=>{const l=t;if(void 0!==o&&Array.isArray(o)&&(o=o[0]),void 0===o){if(e.rowById[l.id]){const t=e.dataSource.dataItemById[l.id],o=function(){return(65536*(1+Math.random())|0).toString(16).substring(1)};l.id=o(),l.data&&l.data.$?l.data.$.id=l.id:l.data.id=l.id,e._getId()&&(l.data[e._getId()]=l.id),t&&(e.dataSource.dataItemById[l.id]=l.data)}e.rowById[l.id]=l}else{const t=e.dataSource.dataItemById[l.id];l.id=o,l.data&&l.data.$?l.data.$.id=l.id:l.data.id=l.id;const a=e._getId();a&&(l.data[e._getId()]=l.id),t&&(t[a]=o,e.dataSource.dataItemById[l.id]=t,l.data=t),e.rowById[l.id]=l}-1!==l.index&&void 0!==l.index||(l.index=e.rows.length),e._setAddUndoRedo(l),!e.editing.isEditing&&e.isInitialized&&(e._recycle(!1,!0),e.grouping.groupBy.length&&e.refresh()),e._onRowInserted&&e._onRowInserted(l),r&&r(l)};if(void 0===i&&(i=e.rows.length-1,void 0!==t.index&&-1!==t.index||(t.index=i)),e.isInitialized){e._rowInsertTimer&&clearTimeout(e._rowInsertTimer),e._rowInsert||(e._rowInsert=[]),e._rowInsert.push({row:t,index:i});const l=e._keyboardAdd?300:150;e._rowInsertTimer=setTimeout((()=>{if(1===e._rowInsert.length)e.onRowInserted([i],[t],o,e),delete e._rowInsert,delete e._undoRedoAction;else{let t=[],o=[];for(let l=0;l<e._rowInsert.length;l++)t.push(e._rowInsert[l].index),o.push(e._rowInsert[l].row);delete e._rowInsert,e.onRowInserted(t,o,(t=>{e.beginUpdate();for(let l=0;l<o.length;l++){const a=o[l],n=t?t[l]:void 0;if(void 0!==n){const t=e.dataSource.dataItemById[a.id];a.id=a.data.id=n;const o=e._getId();o&&(a.data[e._getId()]=a.id),e.rowById[a.id]=a,t&&(t[o]=n,e.dataSource.dataItemById[a.id]=t,a.data=t)}e._setAddUndoRedo(a),-1!==a.index&&void 0!==a.index||(a.index=e.rows.length),e._onRowInserted&&e._onRowInserted(a),r&&r(a)}delete e._undoRedoAction,e.endUpdate(!1)}),e)}}),l)}else e.onRowInserted([i],[t],o,e)}else{const t=void 0===i?e.rows[e.rows.length-1]:e.rows[i];void 0===i&&(i=e.rows.length-1,void 0!==t.index&&-1!==t.index||(t.index=i)),r&&r(t)}},r=function(){const t=e.rows[e.rows.length-1];e.rows.pop(),e.onRowRemoved&&e.onRowRemoved([t.id],[t.index],e),e._onRowRemoved&&e._onRowRemoved([t.id],[t.index],e),e._setRemoveUndoRedo(t)},s=function(t){const o=e.rows[t];o.selected&&o.setProperty("selected",!1),e.rows.splice(t,1),e.onRowRemoved&&e.onRowRemoved([o.id],[t],e),e._onRowRemoved&&e._onRowRemoved([o.id],[t],e),e._setRemoveUndoRedo(o)};e._add=i,e._removeLastRow=r,e._removeAt=s,e._rowHeight=e._autoRowHeight;const d=e.dataSource.length,u=e.onRowInserted;e.onRowInserted=null,e.setAttribute("aria-rowcount",d);const c=e.dataSource&&e.dataSource.virtualDataSource&&!e.dataSource.virtualDataSourceOnExpand&&e.dataSource.length>e.virtualModeCachedRowsCount&&"infinite"!==e.scrolling;if(e.dataSource&&e.dataSource.virtualDataSource&&e.paging.enabled&&!e.dataSource.virtualDataSourceOnExpand)for(let t=0;t<e.dataSource.boundSource.length;t++){const o=e.dataSource[t],l=t+e.paging.pageIndex*e.paging.pageSize;e.dataSource.id||(o.$.id=l),i(o,l)}else if(c){let t=e.dataSource.length>e.virtualModeCachedRowsCount?e.virtualModeCachedRowsCount:e.dataSource.length;"infinite"===e.scrolling&&(t=e.dataSource.length);for(let o=0;o<t;o++){const t=e.dataSource[o];i(t,o)}}else for(let t=0;t<e.dataSource.length;t++){const o=e.dataSource[t];i(o,t)}for(let t=0;t<e._frozenFarRows.length;t++){const o=e._frozenFarRows[t];e.rows.splice(e.rows.indexOf(o),1),e.rows.push(o)}if(a(),e.onRowInserted=u,e.dataSource.notify((function(t){if(e.dataSource._updating)return;const o=t.data;e.rows.canNotify=!1;let l=!1;switch(t.action){case"add":if(!o)return;if(void 0!==o.length)for(let t=0;t<o.length;t++)i(o[t],e.dataSource.length-o.length+t);else i(o,e.dataSource.length-1);break;case"update":if(o.length){let o=[],a=[],n=[];for(let r=0;r<n.length;r++){const s=t.index[r];e.rows[s]?(e.rows[s].data=n[r],o.push(s),a.push(e.rows[s]),n.push(e.rows[s].data)):(i(n[r],n[r].$.index),l=!0)}e.onRowUpdated&&e.onRowUpdated(o,a,n,e)}else{const l=t.index;e.rows[l]?e.rows[l].data=o:i(o,e.dataSource.length-1),e.onRowUpdated&&e.onRowUpdated([l],[e.rows[l]],[e.rows[l].data],e)}break;case"insert":i(o,t.index);for(let t=0;t<e.rows.length;t++)e.rows[t].index=t;break;case"remove":s(t.index);break;case"removeLast":r();break;case"bindingComplete":if(e.dataSource&&e.dataSource.url||e.dataSource&&!e.dataSource.virtualDataSource){if(e.appearance.displayLoadingIndicator=!1,e._setLoadingIndicatorVisibility(),e._toggledRow=null,e.dataSource.length!==d){if(e.paging.enabled){const t=e.$.headerPager.querySelector("smart-pager"),o=e.$.footerPager.querySelector("smart-pager");t&&(t.pagesCount=Math.ceil(e.dataSource.length/e._pageSize)),o&&(o.pagesCount=Math.ceil(e.dataSource.length/e._pageSize))}if(0===d&&0===e.columns.length&&e.dataSource.dataFields.length>0){const t=e.context;e.context=e,e.columns.canNotify=!1,e.columns=[],e._renderColumns(),e._resetCachedLayout(),e.columns.canNotify=!0,e.context=t}e._initializeRows(),e._initializeRowElements(),e.refresh()}e._recycle(),e.onLoad&&(e.onLoad(),delete e.onLoad)}}a(),("update"!==t.action||l)&&e._refreshLayout(),e._recycle(),e.rows.canNotify=!0})),e._observeRows(),e.summaryRow.visible){const t=new Smart.Grid.Row({height:e.layout.rowMinHeight,freeze:"near",visible:"near"===e.summaryRow.position,summaryRowIndex:0,summaryRow:!0}),o=new Smart.Grid.Row({height:e.layout.rowMinHeight,freeze:"far",visible:"far"===e.summaryRow.position,summaryRowIndex:0,summaryRow:!0});"near"===e.summaryRow.position&&e._frozenNearRows.splice(0,0,t),"far"===e.summaryRow.position&&e._frozenFarRows.push(o)}if(e.filtering.enabled&&e.filtering.filterRow.visible){const t=new Smart.Grid.Row({freeze:!0,autoGenerated:!0,filterRow:!0});e._frozenNearRows.splice(0,0,t)}e._renderAddNewRow()}_observeRows(){const e=this;e._frozenNearRows=[],e._frozenFarRows=[],e.rows=new Smart.ObservableArray(e.rows,null,{allowToggle:!0,allowResize:!0,allowCheck:!0,allowSelect:!0,allowReorder:!0,expanded:!0,selected:!0,checked:!0,visible:!0,enabled:!0,minHeight:!0,height:!0,freeze:!0,showDetail:!0,data:!0,visibleIndex:!0,index:!0,comments:!0,style:!0,starred:!0,updatedBy:!0,updatedDate:!0,createdDate:!0,createdBy:!0,history:!0});for(let t=0;t<e.rows.length;t++){const o=e.rows[t];!0===o.freeze||"near"===o.freeze?e._frozenNearRows.push(o):"far"===o.freeze&&e._frozenFarRows.push(o),e.rowById[e.rows[t].id]=o}e.rows.notify((function(t){if(!e.rows.canNotify)return;const o=t.action;if("length"===o)return;if(t.path)return e.rows.canNotify=!1,(e.rowById[t.target.id]||"selected"===t.propertyName)&&(l=t.target,a=t.propertyName,n=t.oldValue,i=t.newValue,n===i&&"selected"!==a&&"showDetail"!==a||(l.propertyChanged(a,n,i),e.onRowChange&&l.properties.indexOf(a)>=0&&e.onRowChange(l,a,n,i,e))),void(e.rows.canNotify=!0);var l,a,n,i;if(e.rows.canNotify=!1,!e.dataSource)return;switch(e.dataSource.canNotify=!1,o){case"add":{const o=function(o){let l=e.rows[o];if(l instanceof Smart.Grid.Row==0){l=new Smart.Grid.Row(l);const a=e.rows.canNotify;e.rows.canNotify=!1,t.object[o]=l,l=t.object[o],e.rows.canNotify=a}if(l.grid=e,e.dataSource&&e.dataSource.virtualDataSource){e.rows.canNotify=!1;for(let t=0;t<e.rows.length;t++){const o=e.dataSource.boundSource[t],l=e.rows[t];o&&(l.data=o,l.id=o.$.id),e.rowById[l.id]=l}e.rows.canNotify=!0}else(()=>{if(0===e.dataSource.length&&e.dataSource.dataFields&&0===e.dataSource.dataFields.length&&e.columns&&e.columns.length){let t=[];for(let o=0;o<e.columns.length;o++){const l=e.columns[o];t.push({name:l.dataField,dataType:l.dataType||"string"}),l.displayField&&l.displayField!==l.dataField&&t.push({name:l.displayField,dataType:l.dataType||"string"})}e.dataSource.dataFields=t}if(o<e.dataSource.length?e.dataSource.insert(o,e.rows[o].data):e.dataSource.add(e.rows[o].data),e.dataSource[o]){l.data=e.dataSource[o];for(let t=0;t<e.dataSource.dataFields.length;t++){const o=e.dataSource.dataFields[t].name;e.columnByDataField[o]||delete l.data[o]}void 0!==e.dataSource[o].$.id&&(l.id=e.dataSource[o].$.id,e.rowById[l.id]=l),l.data.$&&l.history&&(l.data.$.history=l.history)}-1!==l.index&&void 0!==l.index||(l.index=o),l.selected&&(e._selection.rows[l.id]=!0,e._selection.indexes[l.index]=l.index),l.freeze&&(!0===l.freeze||"near"===l.freeze?e._frozenNearRows.push(l):"far"===l.freeze&&e._frozenFarRows.push(l)),e._conditionalColors&&e._conditionalColors.update&&setTimeout((()=>{e._conditionalColors.update(),e._recycle(!1)}),100)})()};for(let e=0;e<t.addedCount;e++)o(t.index+e);break}case"update":if(t.target){const o=e.rowById[t.target.id],l=e.rows.indexOf(o);e.dataSource.update(l,o)}else{const o=e.rows.indexOf(t.index);e.dataSource.update(t.index,o)}break;case"remove":{if(e.dataSource&&e.dataSource.virtualDataSource){e.rows.canNotify=!1;const o=t.removed&&t.removed.length>0?t.removed[0]:null;o&&delete e.rowById[o.id];for(let t=0;t<e.dataSource.boundSource.length;t++){const o=e.dataSource.boundSource[t],l=e.rows[t];l&&(l.data=o,l.id=o.$.id,e.rowById[l.id]=l)}return e.rows.canNotify=!0,e.refresh(),void e._refreshPaging(!1)}const o=t.removed&&t.removed.length>0?t.removed[0]:null;o&&delete e.rowById[o.id],e.dataSource.removeAt(t.index);break}}if(e.dataSource.canNotify=!0,e.rows.canNotify=!0,!o)return;let r=e.isInitialized&&e._rowElements&&e._rowElements.length<e.rows.length;"add"===o&&1===t.addedCount&&r&&e._rowElements.length>0&&e._rowElements[e._rowElements.length-1].classList.contains("smart-hidden")&&(r=!1),r&&e._initializeRowElements(),e.refresh(!1,o),e._refreshPagesCount(),e._sortedColumns&&e._sortedColumns.length>0&&e.refreshSort()}))}setDropDownLabel(e){const t=this;t.$.dropDownElement&&(t.$.dropDownElement.querySelector(".smart-action-button").innerHTML=e)}openDropDown(){const e=this;if(!e.dropDownMode)return;if(!e.$.dropDownPopup)return;const t=e.$.dropDownPopup,o=e.$.dropDownElement;o.setAttribute("active",""),o.querySelector(".smart-drop-down-button").setAttribute("active",""),(()=>{const l=0,a=0;if(e.layout.isDirty=!0,window.screen.availWidth<400)return t.open("left","top"),t.style.width=e.offsetWidth+"px",void(t.style.height=e.offsetHeight+"px");{const o={width:e.layout.dropDownWidth,height:e.layout.dropDownHeight};t.style.width="auto"===o.width?o.width:o.width+"px",t.style.height="auto"===o.height?o.height:o.height+"px"}const n=o;if(n){const o=e.offset(n),i=o.left-l,r=l,s=Math.max(r,i);t.open(s,o.top+n.offsetHeight-a)}else t.classList.add("center"),t.open("center","center");e.style.display=""})()}closeDropDown(){const e=this;e.dropDownMode&&e.$.dropDownPopup&&(e.$.dropDownElement.removeAttribute("active"),e.$.dropDownElement.querySelector(".smart-drop-down-button").removeAttribute("active"),e.$.dropDownPopup.close())}_renderInDropDown(){const e=this;if(e.dropDownMode&&(e.dropDownMode&&(e.style.display="none"),e.dropDownMode&&void 0===e._dropDownMode)){e._dropDownMode=!0;const t=document.createElement("div"),o=e._createPopup();o.allowDrag=!1,o.classList.add("smart-grid-drop-down-popup"),e.$.dropDownElement=t,e.$.dropDownPopup=o,t.onmouseenter=()=>{t.hasAttribute("active")||t.setAttribute("hover","")},t.onmouseleave=()=>{t.removeAttribute("hover")},t.classList.add("smart-grid-drop-down-button","smart-drop-down-box"),e.parentNode.insertBefore(t,e),t.innerHTML=`<div class="smart-container" role="presentation">\n <div class="smart-content" role="presentation">\n <div class="smart-buttons-container" role="presentation">\n <span class="smart-action-button">${e.localize("dropDownPlaceholder")}</span>\n <span class="smart-drop-down-button">\n <span class="smart-drop-down-button-icon" id="arrow" aria-hidden="true"></span>\n </span>\n </div>\n </div>\n </div>`,t.onclick=()=>{o.classList.contains("open")?e.closeDropDown():e.openDropDown()},e.style.height="100%",e.style.width="100%",o.content.appendChild(e),e._cellsMerge=[],e._cellStyles=[],e._popupDropDown||(e._popupDropDown=o,o._refreshPosition=()=>{const l=e.offset(t),a=t.offsetHeight,n=e.offset(e);if(o.style.maxHeight="",o.style.minHeight="",l.top+a+o.offsetHeight>window.innerHeight-n.top){const e=a+l.top+o.offsetHeight-window.innerHeight+n.top;o.style.maxHeight=Math.max(250,o.offsetHeight-e)+"px",o.style.minHeight="250px"}else o.style.maxHeight="",o.style.minHeight=""},o.onOpen=function(){e._popupDropDown._refreshPosition(),e.$.fireEvent("dropDownGridOpen")},o.onClose=function(){e.$.fireEvent("dropDownGridClose")},o.onkeydown=function(e){"Escape"===e.key&&(o.result=!1,o.close())})}}render(){const e=this,t=()=>0===e.offsetWidth||0===e.offsetHeight;if(t())return requestAnimationFrame((()=>{e.isInitialized||t()||(e._undoRedo=[],e._refreshCurrentUser(),e._render())})),e.setAttribute("role","grid"),e.editing.enabled||e.setAttribute("aria-readonly",!0),void super.render();const o=e.context;e.context=e,e.setAttribute("role","grid"),"grid"!==e.view&&e.setAttribute("view",e.view),e.editing.enabled||e.setAttribute("aria-readonly",!0),e._undoRedo=[],e._refreshCurrentUser(),e._render(),e.context=o,super.render()}_renderColumns(e){const t=this;t._initializeColumns(),t._initializeColumnGroupsHierarchy(),t._refreshColumnsResponsiveVisibility(),t._createColumnHeaderCellElements(),t._renderColumnGroupHeaders(),!1!==e&&t._refresh()}_renderRows(e){const t=this;t._initializeRows(),t._initializeRowElements(),!1!==e&&t._refresh()}_setupMobile(){const e=this;if(void 0===e._mobile&&(e._mobile=Smart.Utilities.Core.isMobile),e._mobile){e.editing.addNewColumn.visible=!1,e.layout.rowMinHeight=e.layout.rowHeight=e.layout.columnMinHeight=e.layout.columnHeight=25,e.layout.columnWidth=180,e.behavior.rowResizeMode="none",e.behavior.allowRowReorder=!1,e.editing.action="none",e.appearance.showViewBar=!1,e._scrollView.vScrollBar.showButtons=!1,e._scrollView.hScrollBar.showButtons=!1,e.style.setProperty("--smart-scroll-bar-size","12px"),document.body.style.setProperty("--smart-data-view-sort-panel-width","345px"),e._scrollContent=document.createElement("div"),e._scrollContent.style.width="100%",e._scrollContent.style.height="100%",e._scrollContent.style.position="absolute",e._scrollContent.style.left="0px",e._scrollContent.style.top="0px",e._scrollContent.style.background="white",e._scrollContent.style.zIndex=9999,e._scrollContent.style.opacity=.1,e._scrollContent.style.overflow="auto",e.addEventListener("viewChange",(()=>{"grid"===e.view?e._scrollContent.classList.remove("smart-hidden"):e._scrollContent.classList.add("smart-hidden")})),e.addEventListener("beginEdit",(()=>{e._scrollContent.classList.add("smart-hidden")})),e.addEventListener("endEdit",(()=>{e._scrollContent.classList.remove("smart-hidden")})),e._scrollContent.ontouchmove=e=>{e.stopPropagation()},e._scrollContent.ontouchstart=e=>{e.stopPropagation()},e._scrollContent.onpointerdown=t=>{e._scrollContentScroll=!1,setTimeout((()=>{const o=e=>new PointerEvent(e,{bubbles:!0,cancelable:!0,composed:!0,pointerId:42,pointerType:"mouse",clientX:t.clientX,clientY:t.clientY,pageX:t.pageX,pageY:t.pageY});if(e._scrollContentScroll)e._hideActionButtons();else{const l=(e.enableShadowDOM?e.shadowRoot:e.getRootNode()).elementsFromPoint(t.clientX,t.clientY);if(l[2])if(l[2].classList.contains("smart-grid-add-row-button"))e._hideActionButtons(),l[2].dispatchEvent(o("click"));else if(l[2].classList.contains("smart-summary-placeholder")||l[2].classList.contains("summary-value-part"))e._hideActionButtons(),l[2].dispatchEvent(o("pointerup"));else if(l[2].closest("smart-menu-item")){e._hideActionButtons();const t=l[2].closest("smart-menu-item");l[2].closest("smart-menu")._menuItemSelectionHandler(t)}else{if(l[2].dispatchEvent(o("pointerdown")),e._lastMobileClickRange){const o=e._lastMobileClickRange;let l=!0;o.left<=t.pageX&&o.left+o.right>=t.pageX&&(l=!1),l&&e._hideActionButtons()}else e._hideActionButtons();const a=(o,l)=>{if(o&&o.autoShowActionButton){const a=l.getBoundingClientRect(),n=e.offset(l);if(n.left<=t.pageX&&n.left+a.width-6>=t.pageX){if(!e.hasColumnMenu(o))return;e._lastMobileClickRange={left:n.left,right:n.left+a.width-6},l._showActionButton()}else l._hideActionButton()}};for(let t=0;t<e._columnElements.length;t++){const o=e._columnElements[t];a(o.column,o)}}}}),300),t.stopPropagation()};let t=0;const o=()=>{const t=e._scrollContent.scrollLeft,o=e._scrollContent.scrollTop;e._scrollView.vScrollBar.value=o,e._scrollView.hScrollBar.value=t,e._scrollContentScroll=!0};e._scrollContent.onscroll=()=>{cancelAnimationFrame(t),t=0,t=requestAnimationFrame(o)},e._scrollContentView=document.createElement("div"),e._scrollContentView.style.width=e._scrollView.scrollWidth+"px",e._scrollContentView.style.height=e._scrollView.scrollHeight+"px",e._scrollContent.appendChild(e._scrollContentView),e.$.scrollView.appendChild(e._scrollContent)}}_render(){const e=this;if(e.isInitialized||(e.onBeforeInit&&(e.onBeforeInit(e),e.onBeforeInit=null),e.$.fireEvent("beforeInit",{grid:e}),e.header.visible&&(e.header.buttons.indexOf("views")>=0||e.header.buttons.indexOf("states")>=0)&&e._updateKanbanTaskFields()),e._setupMobile(),(()=>{if(null===e.dataSource)e.dataSource=new Smart.DataAdapter;else if(Array.isArray(e.dataSource)||"string"==typeof e.dataSource){let t=[];if(e.dataSourceSettings.dataFields&&e.dataSourceSettings.dataFields.length>0)e.dataSource=new Smart.DataAdapter({dataSource:e.dataSource,dataSourceType:e.dataSourceSettings.dataSourceType,dataFields:e.dataSourceSettings.dataFields,keyDataField:e.dataSourceSettings.keyDataField,parentDataField:e.dataSourceSettings.parentDataField,childrenDataField:e.dataSourceSettings.childrenDataField,groupBy:e.dataSourceSettings.groupBy||e.grouping.groupBy,mapChar:e.dataSourceSettings.mapChar,root:e.dataSourceSettings.root,record:e.dataSourceSettings.record,autoGenerateColumns:e.autoGenerateColumns,id:e.dataSourceSettings.id,virtualDataSource:e.dataSourceSettings.virtualDataSource,virtualDataSourceOnExpand:e.dataSourceSettings.virtualDataSourceOnExpand});else if(e.columns&&e.columns.length){for(let o=0;o<e.columns.length;o++){const l=e.columns[o];t.push({name:l.dataField,dataType:l.dataType||"string"}),l.displayField&&l.displayField!==l.dataField&&t.push({name:l.displayField,dataType:l.dataType||"string"})}e.dataSource=new Smart.DataAdapter({dataSource:e.dataSource,dataFields:t,dataSourceType:e.dataSourceSettings.dataSourceType,keyDataField:e.dataSourceSettings.keyDataField,parentDataField:e.dataSourceSettings.parentDataField,childrenDataField:e.dataSourceSettings.childrenDataField,groupBy:e.dataSourceSettings.groupBy||e.grouping.groupBy,mapChar:e.dataSourceSettings.mapChar,root:e.dataSourceSettings.root,record:e.dataSourceSettings.record,autoGenerateColumns:e.autoGenerateColumns,id:e.dataSourceSettings.id,virtualDataSource:e.dataSourceSettings.virtualDataSource,virtualDataSourceOnExpand:e.dataSourceSettings.virtualDataSourceOnExpand})}else e.dataSource=new Smart.DataAdapter({dataSource:e.dataSource})}})(),e._selection={rows:[],indexes:[],columns:[],cells:[]},e.dataSource&&e.dataSource.url&&(e.appearance.displayLoadingIndicator=!0,e._setLoadingIndicatorVisibility(),e.dataSource.data={sorting:e.getSortedColumns(),filtering:e.getFilteredColumns(),grouping:e.grouping.groupBy}),e.filtering.filterRow)for(let t=0;t<e.columns.length;t++)e.columns[t]._filterEditorInitialized&&(e.columns[t]._filterEditorInitialized=!1);const t=!e.isInitialized;if(t&&(e.onInit&&(e.onInit(e),e.onInit=null),e.$.fireEvent("init",{grid:e})),e._renderColumns(!1),e._renderRows(!1),e._renderPagers(),e._renderCommandBar(),e._renderConditionalFormatting(),e._initFormulaParser(),t&&e.grouping.enabled&&e.grouping.groupBy.length&&e.dataSource&&(e.dataSource.groupBy=e.grouping.groupBy),e.appearance.allowColumnStickyPosition&&e._stickHeader(),e.header.visible&&""===e.header.template){const t=document.createElement("smart-grid-toolbar");t.headerPosition="top",t.messages=e.messages,t.locale=e.locale;let o=e.$.header;e.header.appendTo&&(o=document.querySelector(e.header.appendTo),o?o.onclick=t=>{e._headerClickHandler(t)}:o=e.$.header),o.appendChild(t),e.$.headerBar&&e.$.headerBar.remove(),e.$.headerBar=o.firstElementChild,e.$.headerBar._init(e)}if(e.isInitialized)e.refreshFilters();else{let t=!1;if(e.stateSettings.autoLoad){let o=e.stateSettings.current;!o&&e.stateSettings.allowLocalStorage&&(e.stateSettings.current="View 1",o=e.stateSettings.current);let l=null;e.stateSettings.storage&&(l=e.stateSettings.storage[o]),l&&(t=!0),!l&&e.stateSettings.allowLocalStorage&&(l=window.localStorage.getItem(o),l&&(t=!0))}if(!t){const t=[];for(let o=0;o<e.viewColumns.length;o++){const l=e.viewColumns[o];l.allowSort&&l.sortOrder&&t.push(l)}if(0===t.length&&e.sorting.sort)for(let o=0;o<e.sorting.sort.length;o++){const l=e.sorting.sort[o],a=Object.keys(l)[0],n=l[a],i=e.columnByDataField[a];i&&(t.push(i),i.sortOrder=n||"asc")}t.sort(((e,t)=>e.sortIndex-t.sortIndex));for(let o=0;o<t.length;o++){const l=t[o],a=e.appearance.allowSortAnimation;e.appearance.allowSortAnimation=!1,e.sortBy(l.dataField,l.sortOrder),e.appearance.allowSortAnimation=a}if(e.filtering.filter.length>0){for(let t=0;t<e.filtering.filter.length;t++){const o=e.filtering.filter[t];if(o){if("string"==typeof o){const t=e.filtering.filter[0],o=e.columnByDataField[t],l=e.filtering.filter[1];let a=null;if(o&&(a=e.dataSource._createFilter(o.dataType,l)),a){if(e.filtering.filterRow.visible&&!o._filterInfo){let e=[];for(let t=0;t<a.filters.length;t++)e.push(a.filters[t].value),t<a.filters.length-1&&e.push(a.logicalOperators[t]);o._filterInfo={condition:a.filters[0].condition,value:e.join(" ")}}e.addFilter(t,a,!1)}break}const t=o[0],l=o.splice(1);let a=null;if(l instanceof Smart.FilterGroup)a=l;else{const o=e.columnByDataField[t];o&&(a=e.dataSource._createFilter(o.dataType,l))}if(a){if(e.filtering.filterRow.visible){const o=e.columnByDataField[t];if(!o._filterInfo){let e=[];for(let t=0;t<a.filters.length;t++)e.push(a.filters[t].value),t<a.filters.length-1&&e.push(a.logicalOperators[t]);o._filterInfo={condition:a.filters[0].condition,value:e.join(" ")}}}e.addFilter(t,a,!1)}}}e.refreshFilters()}else{for(let t=0;t<e.columns.length;t++){const o=e.columns[t];if(o.filter){let t=null,l=o.filter;if(t=l instanceof Smart.FilterGroup?l:e.dataSource._createFilter(o.dataType,l),t){if(e.filtering.filterRow.visible&&!o._filterInfo){let e=[];for(let o=0;o<t.filters.length;o++)e.push(t.filters[o].value),o<t.filters.length-1&&e.push(t.logicalOperators[o]);o._filterInfo={condition:t.filters[0].condition,value:e.join(" ")}}e.addFilter(o.dataField,t,!1)}}}e.refreshFilters()}}}if(e.viewColumns.canNotify=!0,e.isInitialized=!0,("virtual"===e.scrolling||e.paging.enabled&&e.dataSource&&e.dataSource.virtualDataSource||e.dataSource&&e.dataSource.virtualDataSource)&&e._virtualDataRequest("dataBind"),""!==e.header.template&&e._applyTemplate(e.header.template,e.$.header),""!==e.footer.template&&e._applyTemplate(e.footer.template,e.$.footer),e._createFilterPanels(),e._refresh(),e._applyScrolling(),e.grouping.enabled&&e.grouping.autoExpandAll&&e.rowHierarchy?e.expandAllRows():e.grouping.enabled&&e.grouping.autoExpandToLevel&&e.rowHierarchy&&e.expandRowsToGroupLevel(e.grouping.autoExpandToLevel),e.onRender&&(e.onRender(t),e.onRender=null),e.isRendered=!0,"auto"===e.layout.rowHeight&&(e._refreshLayout(),e._recycle()),t){if(e.stateSettings.autoLoad){let t=e.stateSettings.current,o=null;e.stateSettings.storage&&(o=e.stateSettings.storage[t]),!t&&e.stateSettings.allowLocalStorage&&(e.stateSettings.current="smartGrid"+e.id,t=e.stateSettings.current),!o&&e.stateSettings.allowLocalStorage&&(o=window.localStorage.getItem(t)),o&&("string"==typeof o&&(o=JSON.parse(o)),e._loadState(o))}if(e.onAfterInit&&(e.onAfterInit(e),e.onAfterInit=null),e.$.fireEvent("afterInit",{grid:e}),e.isRendering=!1,e.whenRenderedCallbacks){for(let t=0;t<e.whenRenderedCallbacks.length;t++)e.whenRenderedCallbacks[t]();e.whenRenderedCallbacks=[]}!e.dataSource||e.dataSource.url||e.dataSource.virtualDataSource||e.onLoad&&e.onLoad(e)}"kanban"===e.view&&e._initKanbanView()}_initFormulaParser(){const e=this;if(e.formulas){class t{constructor(e){const t=this;let o;try{o=new formulaParser.Parser}catch(e){throw new Error("Smart.FormulaParser: Missing reference to 'formula-parser.min.js'.")}o.on("callCellValue",t._callCellValue.bind(t)),o.on("callRangeValue",t._callRangeValue.bind(t)),t.dataTable=e,t.parser=o}_getFormula(e){const t=this,o="A".charCodeAt(0);let l=0,a="";const n=e;if(t.dataTable._formulas||(t.dataTable._formulas=[]),t.dataTable._formulas[e])return t.dataTable._formulas[e];for(let n=0;n<t.dataTable.columns.length;n++){const i=t.dataTable.columns[n],r=String.fromCharCode(o+l);l++,l>=26&&(l=0,a+="A"),e.indexOf(i.label)>=0?e=e.replaceAll(i.label,a+r):e.indexOf(i.dataField)>=0&&(e=e.replaceAll(i.dataField,a+r))}return t.dataTable._formulas[n]=e,e}_callCellValue(e,t){const o=this,l=o.dataTable,a=e.column.index,n=e.row.index,i=l.columns[a].dataField;let r=l.dataSource[n][i];const s=l.rows[n];if(s){const e=s.getCell(i);e&&e.formula&&(r=o._getFormula(e.formula))}"string"==typeof r&&/=.+/.test(r)&&(r=o.parse(r.slice(1))),t(r)}_callRangeValue(e,t,o){const l=this.dataTable,a=l.dataSource,n=[];for(let o=e.row.index;o<=t.row.index;o++){const i=a[o],r=[];for(let o=e.column.index;o<=t.column.index;o++){let e=i[l.columns[o].dataField];e=isNaN(e)?0:parseFloat(e),isNaN(e)&&(e=0),r.push(e)}n.push(r)}n&&o(n)}parse(e){const t=this.parser.parse(this._getFormula(e));return null!==t.result?t.result:t.error}}e._formulaParser=new t(e)}}get _viewRows(){const e=this;if(e.__viewRows)return e.__viewRows;e._nearRowsAdded||(e._nearRowsAdded=[],e._farRowsAdded=[]);const t=e.rows.toArray?e.rows.toArray():[],o=e.rowHierarchy?e.rowHierarchy:t,l=[].concat(e._frozenNearDefaultRows,e._nearRowsAdded,o,e._farRowsAdded,e._frozenFarDefaultRows);return e.__viewRows=l,l}_toHex(e){if(-1!==e.indexOf("#"))return e;const t=/rgb\((\d+), (\d+), (\d+)\)/g.exec(e);return t?"#"+(parseFloat(t[1]).toString(16).padStart(2,"0")+parseFloat(t[2]).toString(16).padStart(2,"0")+parseFloat(t[3]).toString(16).padStart(2,"0")).toUpperCase():"#FFFFFF"}_renderConditionalFormatting(e){const t=this,o=t.conditionalFormatting;if(!o||0===o.length)return;if(!t._defaults){const e=getComputedStyle(t);t._defaults={fontFamily:e.fontFamily,fontSize:e.fontSize,text:t._toHex(e.color),highlight:t._toHex(e.backgroundColor)}}t._formatter||(t._formatter=new Smart.Utilities.ConditionalFormatter(t.dataSource)),e&&(t._formatter=new Smart.Utilities.ConditionalFormatter(t.dataSource),delete t._conditionalFormatting);const l=t._defaults,a=t._formatter,n=[],i=function(e){if("all"===e){if(t.columns&&t.columns.map){const e=[];for(let o=0;o<t.columns.length;o++){const l=t.columns[o];l.dataField.startsWith("task")||l.autoGenerated||"number"!==l.dataType&&"date"!==l.dataType||e.push(l.dataField)}return e}return[]}return[e]};for(let e=0;e<o.length;e++){o[e]=Object.assign({column:"all",condition:"lessThan",firstValue:0,secondValue:1,fontFamily:l.fontFamily,fontSize:l.fontSize,text:l.text,highlight:l.highlight},o[e]);const t=o[e],r=i(t.column),s=t.condition;a.color=t.highlight,a.comparator=t.firstValue,a.min=t.firstValue,a.max=t.secondValue;const d=a.format(s,r);for(let e in d){const o=d[e];for(let e in o){const l=o[e];l.color=t.text,l.fontFamily=t.fontFamily,l.fontSize=t.fontSize}}n.push(d)}if(t._formattingPanel&&(t._formattingPanel.items=o),0===n.length)return n[0];const r={};for(let e=0;e<n.length;e++){const t=n[e];for(let e in t){const o=t[e];if(0!==Object.keys(o).length){r[e]||(r[e]={});for(let t in o)r[e][t]=Object.assign({},r[e][t],o[t])}}}t._conditionalFormatting=r,e&&t._recycle(!1)}_stickHeader(){const e=this;e._stickyHeaderHandler=function(){e._handleStickyHeader()},e.$.columnHeader.style.top="",e.$.columnHeader.classList.remove("smart-columns-sticky");let t=e.parentNode;for(e.isInShadowDOM&&t===e.getRootNode()&&(t=e.getRootNode().host);t!==document&&t;)t.addEventListener("scroll",e._stickyHeaderHandler),t=t.parentNode,e.isInShadowDOM&&t===e.getRootNode()&&(t=e.getRootNode().host);try{null!==window.top&&window.top!==window.self&&window.top.document.addEventListener("scroll",e._stickyHeaderHandler)}catch(e){}e._handleStickyHeader()}_unstickHeader(){const e=this;e.$.columnHeader.style.top="",e.$.columnHeader.classList.remove("smart-columns-sticky");let t=e.parentNode;for(;t!==document.body;)t.removeEventListener("scroll",e._stickyHeaderHandler),t=t.parentNode,e.isInShadowDOM&&t===e.getRootNode()&&(t=e.getRootNode().host);try{(""!==document.referrer||window.frameElement)&&null!==window.top&&window.top!==window.self&&window.top.document.removeEventListener("scroll",e._stickyHeaderHandler)}catch(e){}}_handleStickyHeader(){const e=this;if(e.appearance.allowColumnStickyPosition)if(e.$.columnHeader.classList.add("smart-columns-sticky"),0===document.scrollTop&&0===e.parentElement.scrollTop)e.$.columnHeader.style.top="";else{let t=e.parentNode,o=0;for(;t!==document.body;)o+=parseInt(t.scrollTop),t=t.parentNode,e.isInShadowDOM&&t===e.getRootNode()&&(t=e.getRootNode().host);const l=parseInt(e.clientTop+o);e.$.columnHeader.style.top=l+"px";let a=0;window.top!==window.self&&parseInt(window.top.scrollY)>parseInt(e._offsetTop(window.frameElement))&&(a=parseInt(window.top.scrollY)-parseInt(e._offsetTop(window.frameElement))),window.scrollY+a>e.offsetTop&&(e.$.columnHeader.style.top=parseInt(window.scrollY)-parseInt(e.offsetTop)+l+a+"px")}}_scrollHandler(){this._handleStickyHeader()}_initializeRowNumberColumn(){const e=this;if(e._frozenNearColumns&&e._frozenNearColumns.length>0&&e._frozenNearColumns[0].rowHeaderColumn)return void(e._frozenNearColumns[0].visible=e.appearance.showRowHeaderNumber||e.appearance.showRowHeader);const t=new Smart.Grid.Column({dataField:"_rowHeaderColumn",label:"",allowSelect:!1,freeze:!0,visible:!0,grid:e,autoGenerated:!0,rowHeaderColumn:!0,cellsAlign:"center"}),o=e.rows?e.rows.length:e.dataSource?e.dataSource.length:0;let l=e.appearance.showRowHeaderNumber?t._measureSize(o):30;e.layout.autoGenerateColumnWidth&&(l=e.layout.autoGenerateColumnWidth),e.appearance.showRowComments&&(l=25,t.minWidth=25),t.width=l,t.createElement();const a=new Smart.Observable(t,t.observables);e.viewColumns.splice(0,0,a),e._frozenNearColumns.splice(0,0,a)}_initializeColumns(){const e=this;if("number"==typeof e.columns){const t=[],o="A".charCodeAt(0);let l="",a=0;for(let n=0;n<e.columns;n++){let i=n+1;const r=String.fromCharCode(o+a);a++;const s=l+r;"number"!==e.appearance.autoGenerateColumnLabelMode&&(i=l+r),t.push({align:"center",label:i,dataField:s,width:100}),a>=26&&(a=0,l+="A")}e._boundColumns=t}else e._boundColumns=Array.isArray(e.columns)?[...e.columns]:[...e.columns.toArray()];e._initColumns=e.columns,e.columnByDataField=[],e.viewColumns=[],e.columns=new Smart.ObservableArray,e._frozenFarColumns=[],e._frozenNearColumns=[],e._summaryRowCount=1;let t=0;const o=function(t){if(e.dataSource.dataFields){const o=e.dataSource.dataFields.find((e=>{if(e.name===t.dataField)return e})),l=o&&o.dataType||"string";t.dataType||(t.dataType=l)}};if(0===e._boundColumns.length&&e.dataSource&&e.dataSource[0]&&!1!==e.dataSource.autoGenerateColumns){const t=e.dataSource[0];if(t.$&&t.$.isEmpty&&e.dataSource.dataFields)for(let t=0;t<e.dataSource.dataFields.length;t++){const o=e.dataSource.dataFields[t],l=e._boundColumns.length,a={index:l,visibleIndex:l,label:o.name,dataField:o.name,dataType:o.dataType};e._boundColumns.push(a)}else for(let l in t){if(l.startsWith("_")||"$"===l)continue;const t=e._boundColumns.length,a={index:t,visibleIndex:t,label:l,dataField:l};o(a),e._boundColumns.push(a)}}for(let l=0;l<e._boundColumns.length;l++){let a=e._boundColumns[l];if("string"==typeof a){if(e.dataSource.dataFields){const t=e.dataSource.dataFields.find((e=>{if(e.name===a)return e}));a={label:a,dataField:a,dataType:t&&t.dataType||"string"}}}else o(a);a.visibleIndex=l,a.index=l,a.grid=e,a.label&&/<.+?>/.test(a.label)&&a.label.replace&&("all"===e.dataSourceSettings.sanitizeHTML?a.label=a.label.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/'/g,"&#39;").replace(/"/g,"&quot;"):"blackList"===e.dataSourceSettings.sanitizeHTML&&(a.label=window.Smart.Utilities.Core.escapeHTML(a.label)));const n=new Smart.Grid.Column(a);e.onColumnInit&&e.onColumnInit(l,n);for(let t in n)-1!==n.properties.indexOf(t)||t.startsWith("_")||e.error(e.localize("invalidColumnProperty",{elementType:"Grid",propertyName:t,type:n.dataField||"Column"}));delete a.grid,delete a.dataType,delete a.index,delete a.visibleIndex,n.grid=e,e.columns.push(n),n._dataField&&(e.columnByDataField[n._dataField]=n);const i=e.columns[e.columns.length-1];e._summaryRowCount=Math.max(e._summaryRowCount,n.summary.length),n.freeze?!0===n.freeze||"near"===n.freeze?(e.viewColumns.splice(t++,0,i),e._frozenNearColumns.push(i)):"far"===n.freeze&&e._frozenFarColumns.push(i):e.viewColumns.push(i),e.columnByDataField[n.dataField]?(i.parent=e.columnByDataField[n.dataField],e.columnByDataField[n.dataField].children||(e.columnByDataField[n.dataField].children=[]),e.columnByDataField[n.dataField].children.push(i),n.valueField=n.dataField,n.dataField+="_"+e.columnByDataField[n.dataField].children.length,n.displayField=n.valueField,e.columnByDataField[n.dataField]=i):e.columnByDataField[n.dataField]=i,e.onColumnInserted&&!e.isInitialized&&e.onColumnInserted(l,n.getState())}e.viewColumns=e.viewColumns.concat(e._frozenFarColumns),e.setAttribute("aria-colcount",e._boundColumns.length);let l=0;if((e.appearance.showRowHeaderNumber||e.appearance.showRowHeader)&&(e._initializeRowNumberColumn(),l++),e.rowDetail.enabled){const t=20,o=new Smart.Grid.Column({dataField:"_rowDetailColumn",allowSelect:!1,visible:e.rowDetail.visible,label:"",grid:e,freeze:!0,rowDetailColumn:!0,autoGenerated:!0,cellsAlign:"center",width:t,minWidth:t}),a=new Smart.Observable(o,o.observables);e.rowDetailColumn=a,"near"===e.rowDetail.position?(e.viewColumns.splice(l,0,a),o.freeze="near",a.freeze="near",e._frozenNearColumns.splice(l,0,a)):(e.viewColumns.push(a),e._frozenFarColumns.splice(0,0,a)),l++}const a=new Smart.Grid.Column({dataField:"_adaptiveColumn",allowSelect:!1,visible:!1,label:"",grid:e,freeze:"far",adaptiveColumn:!0,autoGenerated:!0,cellsAlign:"center",width:30});new Smart.Observable(a,a.observables).canNotify=!1;const n=new Smart.Grid.Column({dataField:"_commandColumn",allowSelect:!1,visible:e.editing.enabled&&e.editing.commandColumn.visible&&!e.editing.commandColumn.inline,label:"",grid:e,freeze:"far",commandColumn:!0,autoGenerated:!0,align:"center",cellsAlign:"center",width:""}),i=new Smart.Observable(n,n.observables);i.canNotify=!1,e.editing.commandColumn.visible&&("near"===e.editing.commandColumn.position?(n.freeze="near",i.freeze="near",e.viewColumns.splice(l,0,i),e._frozenNearColumns.splice(l,0,i)):(e.viewColumns.push(i),e._frozenFarColumns.splice(0,0,i))),e._commandColumn=i;const r=new Smart.Grid.Column({allowSelect:!1,visible:e.selection.enabled&&e.selection.checkBoxes.enabled,dataField:"_checkBoxColumn",label:"",freeze:e.selection.checkBoxes.position,grid:e,selectionColumn:!0,autoGenerated:!0,cellsAlign:"center",width:32}),s=new Smart.Observable(r,r.observables);if(e.selection.checkBoxes.enabled&&("near"===r.freeze?(e.viewColumns.splice(l,0,s),e._frozenNearColumns.splice(l,0,s)):(e.viewColumns.push(s),e._frozenFarColumns.splice(0,0,s))),e._selectionColumn=s,e._selectionColumn.canNotify=!1,e.editing.addNewColumn.visible){const t=new Smart.Grid.Column({dataField:"_addNewColumn",allowSelect:!1,visible:!0,title:e.localize("addNewColumn"),label:"",cellsClassName:"smart-add-new-column",className:"smart-add-new-column smart-icon smart-grid-icon show smart-icon-plus",grid:e,adaptiveColumn:!1,autoGenerated:!0,cellsAlign:"center",width:90}),o=new Smart.Observable(t,t.observables);e.viewColumns.push(o),e._addNewColumn=o,e._addNewColumn.canNotify=!1}e._observeColumns(),e._templateColumns()}get styleProperties(){return["grid-template-columns","--smart-grid-row-height","--smart-grid-column-header-height","--smart-grid-group-header-height","--smart-grid-filter-footer-height","--smart-grid-group-row-vertical","--smart-grid-group-row-horizontal-offset","--smart-grid-freeze-splitter-size","--smart-grid-resize-line-size","--smart-grid-footer-height","--smart-grid-header-height"]}_templateColumns(){const e=this,t=getComputedStyle(e),o=t.getPropertyValue("--smart-grid-template-columns").trim();if(e._rowGap=0,e._columnGap=0,e._maxHeight=parseInt(t.maxHeight),e._minHeight=parseInt(t.minHeight),"none"!==o){let t=0;for(let o=0;o<e.viewColumns.length;o++)e.viewColumns[o].autoGenerated&&(t+=e.viewColumns[o].visible?e.viewColumns[o].width:0);let l=[];const a=document.createElement("div");a.style.display="grid",a.style.gridTemplateColumns=o;for(let t=0;t<e.columns.length;t++)a.innerHTML+="<div></div>";a.style.width=e.clientWidth-t+"px",e.$.root.appendChild(a);const n=o.split(" ");for(let t=0;t<e.columns.length;t++)l[t]=a.children[t].offsetWidth,"auto"===n[t]&&(l[t]=null);a.parentNode.removeChild(a);let i=0;for(let t=0;t<e.viewColumns.length;t++){const o=e.viewColumns[t];o.autoGenerated||l[i]&&(o.width=o.templateWidth=l[i++])}}else for(let t=0;t<e.viewColumns.length;t++){const o=e.viewColumns[t];o.autoGenerated||o.templateWidth&&(o.width=o.templateWidth=null)}}setColumns(e){const t=this;if(null===e)return void(t.columns=[]);t.beginUpdate(),t.columns.canNotify=!1;let o=[],l=[];for(let l=0;l<e.length;l++){const a=e[l];let n=!0;for(let e=0;e<t.columns.length;e++)if(t.columns[e].dataField===a.dataField){n=!1;break}n&&o.push(a)}const a=e.map((e=>e.dataField));for(let e=0;e<t.columns.length;e++){const o=t.columns[e];-1===a.indexOf(o.dataField)&&l.push(o)}l.forEach((e=>{const o=t.columns.indexOf(e);o>=0&&t.columns.splice(o,1)}));for(let e=0;e<o.length;e++)t.columns.push(o[e]);if(t.columns.canNotify=!0,t.endUpdate(),t._columnGroups=[],t._columnHeights=0,t.viewColumns)for(let e=0;e<t.viewColumns.length;e++){const o=t.viewColumns[e],l=o.element;o.top=0,o.level=0,l&&(l.style.top="",l.style.height="",l.style.lineHeight="")}if(t._renderColumns(),t.__columnHeaderHeight=null,e){t.beginUpdate();const o=t.context;t.context=document;for(let o=0;o<e.length;o++){const l=e[o],a=t.columnByDataField[l.dataField];["allowExport","allowFreeze","allowNull","allowGroup","allowSelect","verticalAlign","columnGroup","cellsVerticalAlign","autoCloseMenu","autoShowActionButton","autoShowSortButton","autoShowFilterButton","allowLabelAnimation","allowActionButtonAnimation","allowSortButtonAnimation","allowHide","allowDelete","allowEdit","allowSummary","allowHeaderEdit","allowFilter","allowSort","allowSortToggleOnClick","allowResize","allowReorder","description","icon","menuItems","summary","cellsFormat","className","rowSpan","cellsClassName","cellsCSSRules","formatSettings","formatFunction","sortIndex","sortOrder","sortComparator","groups","group","filtered","filterEditor","filter","filterMenuMode","defaultValue","dataField","displayField","label","labelTemplate","dataType","align","cellsWrap","cellsAlign","minWidth","width","visible","_visible","freeze","showActionButton","selected","showIcon","highlight","showDescriptionButton","treeColumn","statusColumn","value","valueField","onAction","title","showCustomButton","showFilterButton","showSortButton","editor","template","visibleIndex","validationRules"].forEach((e=>{void 0!==l[e]&&(a[e]=l[e])}))}t.context=o,t.endUpdate(!1)}t.refresh()}onAttached(){const e=this;if(!e._scrollView){e._scrollView=new Smart.Utilities.Scroll(e,e.$.horizontalScrollBar,e.$.verticalScrollBar);const t=e._scrollView.hScrollBar;e._scrollView.vScrollBar.onChange=e._verticalScrollbarHandler.bind(e),t.onChange=e._horizontalScrollbarHandler.bind(e)}if(e.isRendered&&e.isCompleted&&(e._isDestroyed||e.behavior.autoDestroy)){if(e.header.visible&&""===e.header.template){let t=e.$.header;e.header.appendTo&&(t=document.querySelector(e.header.appendTo),t?t.onclick=t=>{e._headerClickHandler(t)}:t=e.$.header),t.innerHTML='<smart-grid-toolbar header-position="top"></smart-grid-toolbar>',e.$.headerBar=t.firstElementChild;const o=e.$.headerBar;o.messages=e.messages,o.locale=e.locale,e.$.headerBar._init(e),o.render(),e.header.onInit&&e.header.onInit(e.$.headerBar)}e._render()}}destroy(){const e=this;if(!e.isRendered)return;e._isDestroyed=!0,["_dialogChart","_dialogAddRow","_dialogEdit","_dialogDelete","_dialogRowDetail","_dialogAddColumn"].forEach((t=>{e[t]&&(e[t].close(),e[t]=null)})),e.menu&&(e.menu.ownerElement=null,e.menu.remove(),e.menu=null);const t=e.$.headerBar;if(t){const e=t.$.headerDropDown;e&&e.remove()}e._resetCachedLayout();const o=e._scrollView.hScrollBar,l=e._scrollView.vScrollBar;if(l.ownerElement=null,o.ownerElement=null,l.onChange=null,o.onChange=null,e._scrollView&&(e._scrollView.unlisten(),delete e._scrollView),e._columnElements)for(let t=0;t<e._columnElements.length;t++)e._columnElements[t]._detach();if(e._columnElements=null,e._rowElements)for(let t=0;t<e._rowElements.length;t++)e._rowElements[t]._detach();e._rowElements=null,e.rows=[],e.rowById=[],e._initColumns=[],e.columnByDataField=[],e.viewColumns=[],e._columnToResizeElement=null;let a=Array.isArray(e.columns)?[...e.columns]:[...e.columns.toArray()];a=a.map((e=>e.data?(void 0!==e.data.visibleIndex&&delete e.data.visibleIndex,void 0!==e.data.index&&delete e.data.index,void 0!==e.data.grid&&delete e.data.grid,e.data):e)),e.rows.notifyFn=null,e.columns.notifyFn=null,e.columns.notify=null,e.columns._array=[],e.columns=a,e._boundColumns=[],e._filterPanels=[],e._frozenFarColumns=[],e._frozenNearColumns=[],e._frozenNearDefaultRows=[],e._frozenFarDefaultRows=[],e._frozenFarRows=[],e._frozenNearRows=[],e._selection&&e._selection.selectionRect&&(e._selection.selectionRect.parentNode&&e._selection.selectionRect.parentNode.removeChild(e._selection.selectionRect),e._selection.selectionRect=null),e._selection={rows:[],indexes:[],columns:[],cells:[]},e.__autoHeightRows=null,e._visibleRows=null,e.__viewRows=null,e.__clientSize=null,e.__scrollHeight=null,e.__scrollWidth=null,e.__parentCells=null,e._selectionColumn=null,e._adaptiveColumn=null,e._commandColumn=null,delete e._columnFarContainerComputedStyle,delete e._columnContainerComputedStyle,delete e._columnNearContainerComputedStyle,e._inputOverlay&&(e._inputOverlay.parentNode&&e._inputOverlay.parentNode.removeChild(e._inputOverlay),e._inputOverlay=null),e._firstVisibleColumn=null,e._lastVisibleColumn=null,e._toggledRow=null,Smart(e._selector)&&(delete Smart(e._selector)._properties,Smart(e._selector)),delete e._selector,delete e._initProperties}onDetached(){const e=this;e.behavior.autoDestroy&&e.destroy()}_observeColumns(){const e=this,t=function(t,o,l,a){l===a&&"selected"!==o||(t.propertyChanged(o,l,a),e.onColumnChange?t.stateProps.indexOf(o)>=0&&e.onColumnChange(t,o,l,a):e.$.fireEvent("columnChange",{column:t,propertyName:o,oldValue:l,value:a}))};for(let o=0;o<e.viewColumns.length;o++){const l=e.viewColumns[o];l.rowHeaderColumn||(l.onAction=function(){e._openMenu(this)}),l.autoGenerated&&l.notify((function(e){l.canNotify=!1,t(l,e.propertyName,e.oldValue,e.newValue),l.canNotify=!0}))}e.columns.notify((function(o){let l=null;if(o.path)return e.columns.canNotify=!1,t(o.target,o.propertyName,o.oldValue,o.newValue),void(e.columns.canNotify=!0);e.columns.canNotify=!1;let a=0;switch(o.action){case"length":return void(e.columns.canNotify=!0);case"add":{const t=function(t){if(l=o.object[t],l instanceof Smart.Grid.Column==0){l.grid=e,l=new Smart.Grid.Column(l);const a=e.columns.canNotify;e.columns.canNotify=!1,o.object[t]=l,l=o.object[t],e.columns.canNotify=a}l.grid=e,l.onAction=function(){e._openMenu(this)},l.freeze?e._frozenNearColumns.push(l):"far"===l.freeze&&e._frozenFarColumns.push(l);let a=e.viewColumns.length-e._frozenFarColumns.length,n=0;if(e._frozenNearColumns.forEach((e=>{e.autoGenerated&&n++})),t<e.columns.length?e.viewColumns.splice(t+n,0,l):e.viewColumns.splice(a,0,l),e.columnByDataField[l.dataField]){e.columnByDataField[l.dataField].children.push(l),l.parent=e.columnByDataField[l.dataField],l.valueField=l.dataField;const t=l.dataField+"_"+l.parent.children.length;e.columnByDataField[t]=l,l.dataField=t}else e.columnByDataField[l.dataField]=l;if(e.dataSource&&e.dataSource.dataFields){let t=!1;for(let o=0;o<e.dataSource.dataFields.length;o++)e.dataSource.dataFields[o].name===l.dataField&&(t=!0);t||e.dataSource.dataFields.push({name:l.dataField,dataType:l.dataType||"string"})}if(!e._dragDrop&&e.onColumnInserted){e._onColumnInsertData||(e._onColumnInsertData=[],e._onColumnInsertIndexes=[]);const o=l.getState();o.dataField=l.dataField,e._onColumnInsertData.push(o),e._onColumnInsertIndexes.push(t),e._onColumnInsertTimer&&clearTimeout(e._onColumnInsertTimer),e._onColumnInsertTimer=setTimeout((()=>{e.onColumnInserted(e._onColumnInsertIndexes,e._onColumnInsertData),delete e._onColumnInsertIndexes,delete e._onColumnInsertData}),50)}};delete e.__measuredColumnHeight;for(let e=0;e<o.addedCount;e++)t(o.index+e);break}case"update":l=o.object[o.index],l instanceof Smart.Grid.Column==0&&(l=new Smart.Grid.Column(l)),l.grid=e;for(let t=0;t<o.index;t++)e.viewColumns[t].autoGenerated&&a++;e.viewColumns[a+o.index]=l,e.columnByDataField[l.dataField]=l,e.onColumnUpdated&&e.onColumnUpdated(o.index,l);break;case"remove":{l=o.removed[0];let t=o.index,n=e.viewColumns.indexOf(l);if(-1===n){for(let o=0;o<=t;o++)e.viewColumns[o].autoGenerated&&a++;e.viewColumns.splice(a+t,1)}else e.viewColumns.splice(n,1);if(l){if(l.filter&&e.removeFilter(l.dataField),l.sortOrder&&e.removeSort(l.dataField),e.removeGroup(l.dataField),l._dataField){const t=e.columnByDataField[l._dataField];t&&t.dataField===l.dataField&&delete e.columnByDataField[l._dataField]}delete e.columnByDataField[l.dataField]}if(e._dragDrop||e.onColumnRemoved&&e.onColumnRemoved(o.index,l),e.columnGroups&&(e._columnGroups=[],e._columnHeights=0,e.viewColumns))for(let t=0;t<e.viewColumns.length;t++){const o=e.viewColumns[t],l=o.element;o.top=0,o.level=0,l&&(l.style.top="",l.style.height="",l.style.lineHeight="")}break}}e._initializeColumnGroupsHierarchy(),e._refreshColumnsResponsiveVisibility(),e._createColumnHeaderCellElements(),e._templateColumns(),e.refresh(),e.columnGroups&&e._columnGroups.length>0&&e._renderColumnGroupHeaders(),e.columns.canNotify=!0}))}get _scrollWidth(){const e=this;if(e.__scrollWidth)return e.__scrollWidth;let t=0;for(let o=0;o<e.viewColumns.length;o++){const l=e.viewColumns[o];l.visible&&(t+=l.computedWidth)}return t=parseInt(t),"card"===e.view&&(t=0),e.__scrollWidth=t,e._scrollView.scrollWidth=t-e._clientSize.width,e.__scrollWidth}_horizontalScrollbarHandler(){const e=this;e.closeMenu(),e.isScrolling=!0,e.isHScrolling=!0,requestAnimationFrame((()=>{e._summaryRowDialog&&e._summaryRowDialog.classList.contains("open")&&e._summaryRowDialog.close(),e._recycle(),e.isScrolling=!1,e.isHScrolling=!1}))}_mouseWheelNative(e,t){const o=this;void 0===o._scrollWheelContent&&(o._scrollWheelContent=document.createElement("div"),o._scrollWheelContent.style.width="100%",o._scrollWheelContent.style.height="100%",o._scrollWheelContent.style.position="absolute",o._scrollWheelContent.style.left="0px",o._scrollWheelContent.style.top="0px",o._scrollWheelContent.style.background="white",o._scrollWheelContent.style.zIndex=9999,o._scrollWheelContent.style.opacity=0,o._scrollWheelContent.style.overflow="auto",o._scrollWheelContent.style.visibility="hidden");let l=0;const a=()=>{if(t){const t=o._scrollWheelContent.scrollLeft;o._scrollView.hScrollBar.value=t,t===e&&o._scrollWheelContent.remove()}else{const t=o._scrollWheelContent.scrollTop;o._scrollView.vScrollBar.value=t,t===e&&o._scrollWheelContent.remove()}};o._scrollWheelContent.onscroll=()=>{cancelAnimationFrame(l),l=0,l=requestAnimationFrame(a)},o._scrollWheelContentView||(o._scrollWheelContentView=document.createElement("div"),o._scrollWheelContent.appendChild(o._scrollWheelContentView)),o._scrollWheelContentView.style.width=o.offsetWidth+o._scrollView.scrollWidth+"px",o._scrollWheelContentView.style.height=o.offsetHeight+o._scrollView.scrollHeight+"px",o.$.scrollView.appendChild(o._scrollWheelContent),o._scrollWheelContent.scrollTop=o._scrollView.vScrollBar.value,o._scrollWheelContent.scrollLeft=o._scrollView.hScrollBar.value,!0===t?o._scrollWheelContent.scrollTo({top:o._scrollView.vScrollBar.value,left:e,behavior:"smooth"}):o._scrollWheelContent.scrollTo({top:e,left:o._scrollView.hScrollBar.value,behavior:"smooth"})}_mouseWheelHandler(e){const t=this;if(t._scrollView.hScrollBar.$.hasClass("smart-hidden")&&t._scrollView.vScrollBar.$.hasClass("smart-hidden"))return;if(42===e.pointerId)return;if(t._isUpdating)return;if(t.editing.isEditing)return;if(!t.behavior.allowMouseWheel)return;const o=t.querySelector("smart-grid-toolbar");if(o&&o.$.headerDropDown.classList.contains("open"))return;let l=!1;if(e.wheelDeltaY?120!==Math.abs(e.wheelDeltaY)&&240!==Math.abs(e.wheelDeltaY)&&360!==Math.abs(e.wheelDeltaY)&&(l=!0):0===e.deltaMode&&(l=!0),t.disabled||t._scrollView.vScrollBar.$.hasClass("smart-hidden")||e.shiftKey||!e.deltaY){if(!t.disabled&&(!t._scrollView.hScrollBar.$.hasClass("smart-hidden")||e.shiftKey)){e.stopPropagation(),e.preventDefault();let o=160;const a=0===e.deltaX?e.wheelDelta:e.deltaX;a<0&&(o=-160),Math.abs(a)>=100&&!l&&!Smart.Utilities.Core.Browser.Firefox?t._mouseWheelNative(t._scrollView.scrollLeft+o,!0):t._scrollView.scrollLeft+=a}}else{const o=t.scrollTop;if(0===o&&e.deltaY<0||o===t.scrollHeight&&e.deltaY>0)return;e.stopPropagation(),e.preventDefault();let a=7*t.layout.rowMinHeight;if(e.deltaY<=0&&(a=-7*t.layout.rowMinHeight),Math.abs(e.deltaY)>=100&&!l&&!Smart.Utilities.Core.Browser.Firefox)t._mouseWheelNative(t._scrollView.scrollTop+a);else{t._wheelrafId=0;const o=()=>{t._scrollView.scrollTop+=e.deltaY};cancelAnimationFrame(t._wheelrafId),t._wheelrafId=0,t._wheelrafId=requestAnimationFrame(o)}}}_refresh(e){const t=this;if(t._isUpdating)return;const o=t.$.verticalScrollBar.offsetWidth;t.removeAttribute("grouped"),t.removeAttribute("tree");let l=!0;t.__autoHeightRows&&(t.__autoHeightRows=null,t._refreshColumnsResponsiveVisibility(),t._recycle(),l=!1),t._groups||(t._groups=[]),t.grouping.enabled&&t.dataSource.groupBy&&t.dataSource.groupBy.length>=0&&("advanced"===t.grouping.renderMode?t.setAttribute("grouped",""):t.setAttribute("tree",""),t._groups||(t._groups=[].concat(t.dataSource.groupBy.toArray())||[]),t._renderGroupBar()),t.grouping.enabled&&t.dataSource.groupBy&&0===t.dataSource.groupBy.length?t.$.breadcrumb&&(t.$.breadcrumb.dataSource=[]):t.dataSource.boundHierarchy&&(t.setAttribute("tree",""),t.setAttribute("role","treegrid")),(t.isInitialized||l)&&t._refreshColumnsResponsiveVisibility(),t._refreshLayout(),o!==t.$.verticalScrollBar.offsetWidth&&(t.__scrollWidth=null,t._refreshColumnsResponsiveVisibility(),t._refreshScrollBars(),0===t.$.verticalScrollBar.offsetWidth&&t.isRendered&&requestAnimationFrame((()=>{t._refreshScrollBars()}))),t._refreshSelection(),t._conditionalColors&&t._conditionalColors.update&&t._conditionalColors.update(),"add"===e||"remove"===e||"update"===e?(t._rowChangeTimeout&&clearTimeout(t._rowChangeTimeout),t._rowChangeTimeout=setTimeout((()=>{t._recycle(!1),t._refreshHeaderBar()}),100)):(t._recycle(),t._refreshHeaderBar()),t._recyclingRows&&0===t._recyclingRows.length&&(t.$.placeholder.classList.remove("smart-hidden"),t.scrollHeight=0,t.$.placeholder.innerHTML=t.messages[t.locale]&&t.messages[t.locale].placeholder?t.localize("placeholder"):t.appearance.placeholder,t.filtering.filterRow.visible&&(t.$.placeholder.style.top="0px",t.$.placeholder.style.position="relative",t._filters&&t._filters.length&&(t.$.placeholder.style.top="12px")),t._filters&&t._filters.length&&(t.$.placeholder.innerHTML=`<span class="smart-grid-icon show smart-icon-filter" style="\n font-size: calc(2 * var(--smart-font-size));\n cursor: default;\n margin-right: 10px;\n "></span>${t.localize("filteredRecords")}`)),requestAnimationFrame((()=>{t._width=t.offsetWidth,t._height=t.offsetHeight}))}_refreshHeaderBar(){const e=this;e.$.headerBar&&e.header.visible&&e.$.headerBar._refresh()}_resizeHandler(e){const t=this;if((t.enableShadowDOM?e.composedPath()[0]:e.target)===t&&!t._isUpdatingScrollBars){if(!t.isInitialized)return t._undoRedo=[],t._refreshCurrentUser(),void t._render();if(!1===t._resizeHandling||!t.offsetHeight)return void(!1===t._resizeHandling&&(t.layout.isDirty=!0));t._isUpdatingScrollBars=!0,t._autoHeight=!1,t.$.content&&t.$.content.classList.remove("auto-height");const e=t._rowElements?t._rowElements.length*t.layout.rowMinHeight:0;(e>0||"grid"!==t.view&&"card"!==t.view)&&(t.offsetHeight>=e?(t._refreshLayout(),t._initializeRowElements()):"grid"!==t.view&&t._refreshLayout()),t.refresh(),t.$.headerBar&&t.$.headerBar.refreshTools(),t._dialogAddColumn&&t._dialogAddColumn.classList.contains("open")&&t._dialogAddColumn.refresh(),t._isUpdatingScrollBars=!1}}_refreshColumnsResponsiveVisibility(){const e=this,t=e.$.columnContainer,o=e.$.columnNearContainer,l=e.$.columnFarContainer;let a=0,n=0,i=0,r=!1;const s=e.columns.canNotify;e.columns.canNotify=!1;for(let t=0;t<e.viewColumns.length;t++){const o=e.viewColumns[t];o.setProperty("_treeColumn",!1,!1),e.grouping.enabled&&e.grouping.autoHideGroupColumn&&e.dataSource.groupBy&&e.dataSource.groupBy.indexOf(o.dataField)>=0&&o.setProperty("visible",!1,!1),o.visible&&!o.autoGenerated&&!r&&e.dataSource.boundHierarchy&&(o.setProperty("_treeColumn",!0,!1),r=!0)}e._refreshColumnWidths(),e.columns.canNotify=s;let d=0,u=0;for(let t=0;t<e.viewColumns.length;t++){const o=e.viewColumns[t];o.visible&&(o.freeze&&(!0===o.freeze||"near"===o.freeze?(a+=o.computedWidth,o.autoGenerated&&(d+=o.computedWidth)):"far"===o.freeze&&(n+=o.computedWidth,o.autoGenerated&&(u+=o.computedWidth))),i+=o.computedWidth)}t.style.width=i+"px",o.style.width=a+"px",l.style.width=n+"px",l.classList.remove("smart-hidden"),o.classList.remove("smart-hidden"),0===n&&l.classList.add("smart-hidden"),0===a&&o.classList.add("smart-hidden"),l.classList.remove("border-collapse"),n===u&&l.classList.add("border-collapse"),e._autoGeneratedColumnsNearWidth=d,e._autoGeneratedColumnsFarWidth=u,e._computedColumnsWidth=i,e._frozenColumnsNearWidth=a,e._frozenColumnsFarWidth=n}_selectStartHandler(e){const t=this;t.isScrolling||t.editing.isEditing||"grid"!==t.view||t.selection.defaultSelection||e.preventDefault()}setFocusable(e){const t=this;!t.disabled&&e?t.tabIndex=0:t.removeAttribute("tabindex")}_setLoadingIndicatorVisibility(){const e=this;e.appearance.displayLoadingIndicator?e.$.loadingIndicatorContainer.classList.remove("smart-visibility-hidden"):e.$.loadingIndicatorContainer.classList.add("smart-visibility-hidden")}_refreshElementsVisibility(){const e=this,t=function(e,t){e&&(t?e.classList.remove("smart-hidden"):e.classList.add("smart-hidden"))};if(t(e.$.placeholder,!e.rows||e.rows&&0===e.rows.length||0===e.columns.length),t(e.$.footer,e.footer.visible),t(e.$.header,e.header.visible&&!e.header.appendTo),t(e.$.groupHeader,e.groupHeader.visible||e.grouping.groupBar.visible),t(e.$.columnHeader,e.columnHeader.visible&&e.columns.length>0),t(e.$.headerCommandBar,e.editing.commandBar.visible&&"far"!==e.editing.commandBar.position),t(e.$.footerCommandBar,e.editing.commandBar.visible&&"near"!==e.editing.commandBar.position),t(e.$.breadcrumb,e.groupHeader.visible||e.grouping.groupBar.visible),e.htmlColumnLastChild.classList.add("smart-visibility-hidden"),e.pager&&e.pager.visible&&e.paging.enabled)switch(e.pager.position){case"near":t(e.$.headerPager,!0),t(e.$.footerPager,!1);break;case"far":t(e.$.headerPager,!1),t(e.$.footerPager,!0);break;case"both":t(e.$.headerPager,!0),t(e.$.footerPager,!0)}else t(e.$.footerPager,!1),t(e.$.headerPager,!1)}_getId(){const e=this;return e.dataSource&&e.dataSource.id?e.dataSource.id:e.dataSourceSettings.id?e.dataSourceSettings.id:void 0}_refreshRowHierarchy(e,t=!1){const o=this;o.rowHierarchy=null;let l=0,a=!1;if(!o.grouping.enabled&&o.dataSource.groupBy&&o.dataSource.groupBy.length>0&&(a=!0),o.grouping.enabled&&o.dataSource.groupBy&&0===o.dataSource.groupBy.length)return;let n=!1;if(o.grouping.enabled&&o.dataSource.groupBy&&o.dataSource.groupBy.length>0&&o.dataSource.virtualDataSourceOnExpand&&(n=!0),o.dataSource.boundHierarchy){const i=o.dataSource.reservedNames,r=function(e){return new Smart.Grid.Row({data:e,grid:o,index:o.rows.length})};let s=0;const d=function(t,l){for(let u=0;u<t.length;u++){const c=t[u];let m=o.rowById[c.$.id];if(n&&(m=o.rows[s],m||(m=r(c),o.rows.push(m)),c[i.leaf]?m.id=c.$.id:m.id="Group_"+c.$.id,o.rowById[m.id]=m),m||(m=r(c),o.rowById[m.id]=m),m.data=c,m.leaf=c[i.leaf]||!1,m.level=c[i.level],m.groupDataField=c.groupDataField,!m.groupDataField&&o.appearance.showTreeRowHeader&&(m.groupDataField=o.columns[m.level].dataField),m.label=c.label,m.groupDataField){const e=o.columnByDataField[m.groupDataField];if(e&&e.editor.dataSource)for(let t=0;t<e.editor.dataSource.length;t++){const o=e.editor.dataSource[t];if(""+o.value===m.label){void 0!==o.label?(m.label=o.label,m.labelValue=o.value):void 0!==o.name&&(m.label=o.name,m.labelValue=o.value);break}}}if(m.children=[],m.data&&(m.filtered=void 0===m.data.$.filtered||m.data.$.filtered),c.summaryRow&&(m.summaryRow=!0),(null===o._toggledRow||o._toggledRow&&o._toggledRow.id!==m.id)&&(m.expandHeight=0),c.parent?(m.parent=o.rowById[c.parent.$.id],m.parentId=c.parent.$.id):(m.parent=null,m.parentId=null),o.grouping.onGroupDefaultExpanded&&!o.isRendered){const e=o.grouping.onGroupDefaultExpanded(c);e&&(m.expanded=c[i.expanded]=e)}o.appearance.allowRowToggleAnimation||void 0!==c[i.expanded]&&(m.expanded=c[i.expanded]);let g=!!e||m.expanded;a&&(g=!0);const p=o.dataSource&&o.dataSource.id||o.dataSourceSettings.id;if(p&&!m.data[p]&&o.grouping.enabled&&o.dataSource&&o.dataSource.groupBy.length){const e=o.dataSource.groupBy[m.level];c.parent&&c.parent.expanded&&(""===m.data[e]&&o.dataSource.id&&!m.data.data[o.dataSource.id]||m.leaf&&!m.data[p])&&(s++,m.filtered=!1)}if(!0===m.visible&&!1!==m.filtered)if(s++,g||c[i.leaf])if(l.push(m),c.children&&c.children.length>0){const e=d(c.children,new Array);0===e.length&&(m.leaf=!0);for(let t=0;t<e.length;t++)l.push(e[t]);m.children=e}else c.children&&0===c.children.length&&(o.dataSource.virtualDataSource&&o.dataSource.virtualDataSourceOnExpand?m.data._loaded&&(m.leaf=!0):m.leaf=!0);else if(l.push(m),c.children&&c.children.length>0){const e=d(c.children,new Array);0===e.length&&(m.leaf=!0),m.children=e}else c.children&&0===c.children.length&&(o.dataSource.virtualDataSource&&o.dataSource.virtualDataSourceOnExpand?m.data._loaded&&(m.leaf=!0):m.leaf=!0)}return l};let u=o.dataSource.boundHierarchy;if(o.paging.enabled&&!t){let e=[];const t=e=>{let l=[];if(0===o.dataSource.groupBy.length)return e;for(let o=0;o<e.length;o++){const a=e[o];(!a.$||void 0===a.$.filtered||a.$.filtered)&&(l.push(a),a.children&&(l=l.concat(t(a.children))))}return l};if(o.dataSource&&!o.dataSource.virtualDataSource){for(let o=0;o<u.length;o++){let l=u[o],a=!l.$||void 0===l.$.filtered||l.$.filtered;!a&&null!==a||0!==l.level||l.parent||(t(l.children).length,e.push(l))}u=e.slice(o.paging.pageIndex*o._pageSize,(o.paging.pageIndex+1)*o._pageSize)}}const c=o.rows.canNotify;o.rows.canNotify=!1,o.rowHierarchy=d(u,new Array),o.rows.canNotify=c;let m=[];for(let e=0;e<o.rowHierarchy.length;e++){const t=o.rowHierarchy[e],a=t.canNotify;t.leaf&&m.push(t),t.canNotify=!1,o.grouping.enabled&&o.dataSource&&o.dataSource.groupBy.length?t.leaf?t.visibleIndex=l++:t.visibleIndex=-1:t.visibleIndex=l++,t.canNotify=a}if(a&&(o.rowHierarchy=m),o._rowElements.length<o.rowHierarchy.length&&!o._toggledRow&&o._initializeRowElements(),o.grouping.summaryRow.visible&&!o.grouping.summaryRow.inline){const e=function(t,o,l,a){if(0!==t&&o.length>0&&o[o.length-1]&&!o[o.length-1].summaryRow){let e={label:" ",boundSource:[],groupDataField:l.data.groupDataField,$:{},summaryRow:!0,leaf:!0,level:t,expandHeight:0,siblings:o};e.$.id="SubRow"+a+"_"+l.data.$.id,l&&(e.parent=l.data,e.parentId=l.data.$.id),e.data=Object.assign(e),o.push(e)}for(let t=0;t<o.length;t++)o[t]&&o[t].data&&o[t].data.children&&e(o[t].level+1,o[t].data.children,o[t],t)};e(0,o.rowHierarchy,null,0)}}}applyContent(){}_refreshContentHeight(){const e=this;let t=e._clientSize.height;const o=window.scrollY;let l,a,n=!1;if((!e._contentHeight||e._maxHeight||e._autoHeight||e.__autoHeight||"hidden"===e.verticalScrollBarVisibility)&&(n=!0),n&&(l=e.offsetHeight,e.$.container.classList.add("smart-hidden"),a=e.offsetHeight,e.$.container.classList.remove("smart-hidden")),window.scrollY!==o&&window.scrollTo(window.scrollX,o),"hidden"===e.verticalScrollBarVisibility||e.layout.autoHeight||l!==a||e._minHeight&&e._minHeight===l)return t=e._scrollHeight+e.$.columnHeader.offsetHeight+e.$.filterFooter.offsetHeight,e.header.visible&&!e.header.appendTo&&(t+=e.$.header.offsetHeight),e.summaryRow.visible&&(t+=e.layout.rowMinHeight),0===e._recyclingRows.length&&0===e._scrollHeight&&(t+=e.$.scrollView.offsetTop),e._minHeight>t&&(t=e._minHeight),e.$.content.style.height=t+"px",e._contentHeight=t,void(e._maxHeight<t?(e._autoHeight=!1,e.$.content.classList.remove("auto-height"),e.$.content.style.height=e._maxHeight+"px",e.header.visible&&!e.header.appendTo?(e.$.content.style.height=e._maxHeight-e.$.header.offsetHeight+"px",e._contentHeight=e._maxHeight-e.$.header.offsetHeight):e._contentHeight=e._maxHeight):(e._autoHeight=!0,e.__autoHeight=!0,e.$.content.classList.add("auto-height"),e.filtering.filterRow.visible&&(e.filtering.filterRow.visible,e._contentHeight=t,e.$.content.style.height=e._contentHeight+"px"),e.header.visible&&!e.header.appendTo?(e._contentHeight=t-e.$.header.offsetHeight,e.$.content.style.height=e._contentHeight+"px"):e.summaryRow.visible&&(e.$.content.style.height=e._contentHeight+"px")));if(e.header.visible&&!e.header.appendTo&&(t-=e.$.header.offsetHeight),(e.groupHeader.visible||e.grouping.groupBar.visible)&&(t-=e.$.groupHeader.offsetHeight),e.footer.visible&&(t-=e.$.footer.offsetHeight),e.pager.visible&&(t-=e.$.headerPager.offsetHeight,t-=e.$.footerPager.offsetHeight),e.editing.enabled&&e.editing.commandBar.visible&&(t-=e.$.headerCommandBar.offsetHeight,t-=e.$.footerCommandBar.offsetHeight),e.$.content.style.height!==t+"px"&&(e.$.content.style.height=t+"px"),e.$.viewContent.style.height!==t+"px"&&(e.$.viewContent.style.height=t+"px"),e._contentHeight=t,!e.appearance.showViewBar||e.appearance.viewBarAppendTo||e.appearance.showViewBarAsDropdown)e.$.viewBar.classList.add("smart-hidden"),e.$.content.style.width="",e.$.viewContent.style.width="",e.$.content.style.marginLeft="",e.$.viewContent.style.marginLeft="";else{const o=e.layout.viewBarWidth+5;e.$.viewBar.classList.remove("smart-hidden"),e._mobile||(e.$.content.style.width="calc(100% - "+o+"px)",e.$.viewContent.style.width="calc(100% - "+o+"px)",e.$.content.style.marginLeft=o+"px",e.$.viewContent.style.marginLeft=o+"px"),e.$.viewBar.style.width=o+"px";let l=0;e.header.visible&&!e.header.appendTo&&(l+=e.$.header.offsetHeight),(e.groupHeader.visible||e.grouping.groupBar.visible)&&(l+=e.$.groupHeader.offsetHeight),e.pager.visible&&(l+=e.$.headerPager.offsetHeight),e.$.viewBar.style.top=l+"px",e.$.viewBar.style.height=t+"px"}}appendChild(){const e=Array.prototype.slice.call(arguments,2);return HTMLElement.prototype.appendChild.apply(this,e.concat(Array.prototype.slice.call(arguments)))}removeChild(){const e=Array.prototype.slice.call(arguments,2);return HTMLElement.prototype.removeChild.apply(this,e.concat(Array.prototype.slice.call(arguments)))}get _contentBorder(){const e=this;if(e.__contentBorder)return e.__contentBorder;const t=getComputedStyle(e.$.content),o={left:parseFloat(t.borderLeftWidth)+parseFloat(t.borderRightWidth),top:parseFloat(t.borderTopWidth)+parseFloat(t.borderBottomWidth)};return e.__contentBorder=o,o}_refreshAutoSize(){const e=this;if(e.layout.autoWidth){const t=e._isUpdatingScrollBars;e._isUpdatingScrollBars=!0;let o=2;for(let t=0;t<e.viewColumns.length;t++){const l=e.viewColumns[t];l.visible&&(o+=l.computedWidth)}o+=e.$.verticalScrollBar.offsetWidth>0?e.$.verticalScrollBar.offsetWidth:0,e.style.width=o+"px",requestAnimationFrame((()=>{e._isUpdatingScrollBars=t}))}e.layout.autoHeight&&(e.style.height="auto")}_refreshLayout(){const e=this,t=e.rows;if(e._layoutSuspended)return;e._visibleRows=null,e.__viewRows=null,e.__clientSize=null,e.__scrollHeight=null,e.__scrollWidth=null,e.__parentCells=null,e.$.columnFarContainer.classList.remove("vscroll"),e.$.columnNearContainer.classList.remove("vscroll"),e.$.scrollView.classList.remove("hscroll"),e.$.scrollView.classList.remove("vscroll"),e._refreshAutoSize(),e._refreshElementsVisibility(),e._refreshRowHierarchy(),e._refreshColumnHeights(),e._refreshContentHeight();const o=()=>{e.$.placeholder.classList.remove("smart-hidden"),e.$.placeholder.innerHTML=e.messages[e.locale]&&e.messages[e.locale].placeholder?e.localize("placeholder"):e.appearance.placeholder,e._filters&&e._filters.length&&(e.$.placeholder.innerHTML=e.localize("filteredRecords")),e.__filterFooterOffsetHeight||(e.__filterFooterOffsetHeight=e.$.filterFooter.classList.contains("smart-hidden")?0:e.$.filterFooter.offsetHeight),!e.__columnHeaderHeight&&e.$.columnHeader.offsetHeight&&(e.__columnHeaderHeight=e.$.columnHeader.offsetHeight);let t=e._contentHeight-e.__filterFooterOffsetHeight-e.__columnHeaderHeight;e.$.scrollView.style.height=t+"px",e.scrollWidth=0,e.scrollHeight=0,e.clearSelection(),e._showAddNewRowButton("float"),e.$.content.classList.contains("auto-height")&&(e.$.placeholder.style.height=t+"px")};if(t&&t.url)e._showAddNewRowButton("float");else{if(!t||null===t||0===t.length||0===e.columns.length)return o(),0!==e.columns.length&&e.hasVisibleColumn()?e.editing.addNewColumn._addButton&&e.editing.addNewColumn._addButton.classList.remove("show"):(e._showAddNewColumnButton(),e.$.columnHeader.classList.add("smart-hidden"),e.__columnHeaderHeight=0),void e._refreshScrollBars();e._showAddNewRowButton("float"),e.editing.addNewColumn._addButton&&e.editing.addNewColumn._addButton.classList.remove("show")}0!==e.columns.length&&e.hasVisibleColumn()?e.editing.addNewColumn._addButton&&e.editing.addNewColumn._addButton.classList.remove("show"):(o(),0!==e.columns.length&&e.hasVisibleColumn()||(e._showAddNewColumnButton(),e.$.columnHeader.classList.add("smart-hidden"),e.__columnHeaderHeight=0),e._showAddNewColumnButton()),"card"===e.view&&(e.__columnHeaderHeight=0),!e.__columnHeaderHeight&&e.$.columnHeader.offsetHeight&&(e.__columnHeaderHeight=e.$.columnHeader.offsetHeight),e.__filterFooterOffsetHeight||(e.__filterFooterOffsetHeight=e.$.filterFooter.classList.contains("smart-hidden")?0:e.$.filterFooter.offsetHeight);let l=e._contentHeight-e.__filterFooterOffsetHeight-e.__columnHeaderHeight;if(e.$.scrollView.style.height=l+"px",e.htmlColumnLastChild.style.height=e.__columnHeaderHeight+"px",e.paging.spinner.enabled&&e.paging.enabled){if(!e.pageScroll){const t=document.createElement("smart-scroll-bar");t.orientation="vertical",t.style.height="100%",t.style.width="100%",t.max=Math.ceil(e.dataSource.length/e._pageSize),t.step=e.paging.spinner.step,t.largeStep=e.paging.spinner.step,t.setAttribute("spinner",""),t.setAttribute("smart-id","spinner"),t.ownerElement=e,e.addPropertyBinding("[[paging_spinner_step]]","step",t,e.$.columnHeader),t.addEventListener("change",(function(t){e.paging.pageIndex=t.detail.value,e._refreshLayout(),e._refreshSelection(),e.dataSource&&e.dataSource.virtualDataSource?e._virtualDataRequest("pageIndexChange"):(e._recycle(),e._scrollUpdate&&clearTimeout(e._scrollUpdate),e._scrollUpdate=setTimeout((function(){e.isScrolling||(e.$.rowContainer.style.top=parseInt(e.$.rowContainer.style.top)+.01+"px")}),50))})),e.pageScroll=t}e.htmlColumnLastChild.appendChild(e.pageScroll)}else e.htmlColumnLastChild.innerHTML="";e._refreshScrollBars()}_refreshScrollBars(){const e=this;if(!e._scrollView)return;const t=e._scrollView.vScrollBar,o=e._scrollView.hScrollBar,l=e._contentHeight-e.__filterFooterOffsetHeight-e.__columnHeaderHeight,a=e.$.scrollView.offsetWidth,n=e._scrollWidth-a-e._contentBorder.left,i=e._scrollHeight-l-e._contentBorder.top,r=e._columnNearContainerComputedStyle?e._columnNearContainerComputedStyle:getComputedStyle(e.$.columnNearContainer),s=e._columnFarContainerComputedStyle?e._columnFarContainerComputedStyle:getComputedStyle(e.$.columnFarContainer),d=parseInt(e.$.columnNearContainer.style.width)+parseInt(r.borderRightWidth),u=parseInt(e.$.columnFarContainer.style.width)+parseInt(s.borderLeftWidth);if(e.__frozenNearWidth=d,e.__frozenFarWidth=u,e._columnNearContainerComputedStyle=r,e._columnFarContainerComputedStyle=s,e._refreshHorizontalScrollBarVisibility(n),e._refreshVerticalScrollBarVisibility(i),t.style.height=l+"px",e.computedVerticalScrollBarVisibility?(e.__scrollBarSize||(e.__scrollBarSize=t.offsetWidth),e.__scrollWidth+=e.__scrollBarSize,e._refreshHorizontalScrollBarVisibility(e._scrollWidth-a-1),e.rightToLeft?e.$.columnNearContainer.classList.add("vscroll"):e.$.columnFarContainer.classList.add("vscroll"),e._refreshVerticalScrollBarVisibility(i),e.htmlColumnLastChild.classList.remove("smart-visibility-hidden"),e.$.scrollView.classList.add("has-vscroll")):e.$.scrollView.classList.remove("has-vscroll"),o.style.width=a+"px",e.rightToLeft?o.style.right="0px":o.style.left="0px",e.computedVerticalScrollBarVisibility&&e.computedHorizontalScrollBarVisibility&&(o.style.width=a-t.offsetWidth+"px",t.style.height=l-o.offsetHeight+"px"),e.computedHorizontalScrollBarVisibility?(e.$.scrollView.classList.add("hscroll"),e._autoHeight?(e.$.content.style.height="auto",e.$.scrollView.style.height="auto",e.$.scrollView.style.paddingBottom=o.offsetHeight+"px",e.$.placeholder.style.marginTop=o.offsetHeight+"px",e.summaryRow.visible&&(e.$.scrollView.style.paddingBottom=o.offsetHeight+e.layout.rowMinHeight+"px"),e.filtering.enabled&&e.filtering.filterRow.visible&&(e.$.scrollView.style.paddingBottom=o.offsetHeight+e.layout.rowMinHeight+"px")):(e.$.scrollView.style.paddingBottom="",e.$.placeholder.style.marginTop="")):e.$.scrollView.classList.remove("hscroll"),(e.__frozenNearHeight>0||e._frozenNearRows&&e._frozenNearRows.length>0)&&!e.appearance.showVerticalScrollBarOnFixedColumns){const o=getComputedStyle(e.$.rowNearContainer),l=e.__frozenNearHeight+parseInt(o.borderBottomWidth);t.style.height=parseInt(t.style.height)-l+"px",t.style.top=l+"px",t.style.setProperty("--smart-scroll-bar-near-size",l+"px")}else e.appearance.showVerticalScrollBarOnFixedColumns&&(t.style.top="0px");if((e.__frozenFarHeight>0||e._frozenFarRows&&e._frozenFarRows.length>0)&&!e.appearance.showVerticalScrollBarOnFixedColumns){const o=getComputedStyle(e.$.rowFarContainer),l=-2+e.__frozenFarHeight+parseInt(o.borderTopWidth);t.style.height=parseInt(t.style.height)-l+"px",t.style.setProperty("--smart-scroll-bar-far-size",l+"px"),0===e.__frozenNearHeight&&(t.style.top="0px")}(d>0||u>0)&&!e.appearance.showHorizontalScrollBarOnFixedColumns&&(o.style.width=parseInt(o.style.width)-d-u+"px",e.rightToLeft?o.style.right=d+"px":o.style.left=d+"px",o.style.setProperty("--smart-scroll-bar-near-size",d+parseInt(r.borderRightWidth)+"px"),o.style.setProperty("--smart-scroll-bar-far-size",u+parseInt(r.borderLeftWidth)+"px"),e.computedVerticalScrollBarVisibility&&(e.__scrollBarSize||(e.__scrollBarSize=t.offsetWidth),o.style.setProperty("--smart-scroll-bar-far-size",u+e.__scrollBarSize+"px"))),t.refresh(),o.refresh(),e._mobile&&(e._scrollContentView.style.width=e.$.scrollView.offsetWidth+e._scrollView.scrollWidth+"px",e._scrollContentView.style.height=e.$.scrollView.offsetHeight+e._scrollView.scrollHeight+"px")}_refreshHorizontalScrollBarVisibility(e){const t=this;t.scrollWidth=e,t.computedHorizontalScrollBarVisibility||(t.scrollLeft=0)}_refreshVerticalScrollBarVisibility(e){const t=this;if(t._autoHeight)return t.scrollTop=0,void(t.scrollHeight=0);t.computedHorizontalScrollBarVisibility&&(e+=t.$.horizontalScrollBar.offsetHeight),t.scrollHeight=e,t.paging.enabled&&t.paging.spinner.visible&&t.$.verticalScrollBarVisibility.classList.remove("smart-hidden"),t.computedVerticalScrollBarVisibility||(t.scrollTop=0)}_styleChangedHandler(e){const t=this;if(!e.detail.styleProperties.overflow&&!t.classList.contains("smart-grid-resize-mode")){if(e.detail.styleProperties["grid-template-columns"])return t._templateColumns(),void t.refresh();if(e.detail.styleProperties["font-size"])return t.layout.isDirty=!0,t._resetCachedLayout(),void t.refresh();(e.detail.styleProperties["--smart-grid-row-height"]||e.detail.styleProperties["--smart-font-size"]||e.detail.styleProperties["--smart-grid-column-header-height"]||e.detail.styleProperties["--smart-grid-group-header-height"]||e.detail.styleProperties["--smart-grid-filter-footer-height"]||e.detail.styleProperties["--smart-grid-group-row-vertical"]||e.detail.styleProperties["--smart-grid-group-row-horizontal-offset"]||e.detail.styleProperties["--smart-grid-freeze-splitter-size"]||e.detail.styleProperties["--smart-grid-resize-line-size"]||e.detail.styleProperties["--smart-grid-footer-height"]||e.detail.styleProperties["--smart-grid-header-height"])&&(t.layout.isDirty=!0),t.offsetWidth&&t.offsetHeight>0&&(t._resetCachedLayout(),t._refreshLayout(),t._recycle())}}_resetCachedLayout(){const e=this;delete e._columnHeights,e.__cellsCommandTemplate=null,e.__autoRowHeight=null,e.__autoHeightRows=null,e.__measuredColumnHeight=null,e.__columnHeaderHeight=null,e.__filterFooterOffsetHeight=null}_swipeLeftHandler(){}_swipeRightHandler(){}_getRowIndexByPosition(e){const t=this;return(o=>{let l=0,a=o.length-1;if(e<=0)return 0;const n=o[o.length-1];if(-1!==n.top&&n.top<=e)return o.length-1;for(;;){const n=Math.floor((l+a)/2),i=o[n];if(t._isRowInPosition(i,e))return n;i.top<e?l=n+1:i.top>e?a=n-1:l=n+1}})(t._recyclingRows)}_getVirtualRowIndexByPosition(e){let t=this.rows[0].height;const o=(e,o)=>0!==t&&e<=o&&e+t>o;return(l=>{let a=0,n=l.length-1;if(e<=0)return 0;const i=(l.length-1)*t;if(-1!==i&&i<=e)return l.length-1;for(;;){const l=Math.floor((a+n)/2),i=l*t;if(o(i,e))return l;i<e?a=l+1:i>e?n=l-1:a=l+1}})(this.dataSource)}getRows(){return this.getViewRows()}getViewRows(){const e=this;return e.rowHierarchy?e.rowHierarchy:e.getVisibleRows()}getData(){const e=this;if(!e.dataSource)return[];const t=[];for(let o=0;o<e.dataSource.length;o++){const l=e.dataSource[o];if(l.$){const o={};for(let t=0;t<e.dataSource.dataFields.length;t++){const a=e.dataSource.dataFields[t].name;o[a]=l[a]}t.push(o)}else t.push(l)}return t}getDataFields(){const e=this;return e.columns?e.columns.map((e=>e.dataField)):[]}getColumns(){const e=this,t=[];if(!e.isInitialized)return t;if(e.columns)for(let o=0;o<e.columns.length;o++){const l=e.columns[o].getState();t.push(l)}return t}resetState(){const e=this;e._isUpdating=0,e.beginUpdate(),e.clearSort(),e.clearFilter(),e.clearGroups(),e.clearSelection(),e._conditionalColors&&(e._conditionalColors.colors=[],e._conditionalColors.conditions=[],e._conditionalColors.type="conditions",e._conditionalColors.singleSelect="",e._conditionalColors.decorate="border"),e.$.headerBar&&delete e.$.headerBar._appliedColors,e.columns.canNotify=!1;let t=[],o=!1;for(let l=0;l<e.columns.length;l++){const a=e.columns[l];a.visible=!0,a.width=180,a.freeze=!1,a.index>=0?t[a.index]=a:t.push(a),a.index!==l&&(o=!0)}o&&(e.columns=t),"grid"!==e.view&&(e.view="grid",e._hideKanbanView()),e.columns.canNotify=!0,e._scrollView.scrollLeft=e._scrollView.scrollTop=0,e.paging.enabled&&(e.paging.pageIndex=0),e.$.headerBar&&e.$.headerBar._setView&&e.$.headerBar._setView("grid"),e._kanban&&e._kanban._reset(),e.layout.isDirty=!0,e.endUpdate(),o&&(e._renderColumns(),e._refreshHeaderBar())}_loadState(e){const t=this;let o=!1;t.stateSettings.loading=!0;let l=!1,a=!1;if("grid"===e.view||"card"===e.view){if(e.expandedRows&&Object.keys(e.expandedRows).length>0){o=!0,t.beginUpdate();const l=[];if(e.groups){t.dataSource.groupBy=e.groups,t._groups=[].concat(t.dataSource.groupBy.toArray())||[],t._refreshRowHierarchy();for(let o in e.expandedRows)l["Item"+o.replaceAll(".","_")]=!0,t._expandCollapseGroup(o,!0)}t.dataSource&&(t.dataSource._expandedRowIds=l)}else if(e.groups&&e.groups.length){o=!0,t.beginUpdate();const l=[];t.dataSource&&(t.dataSource._expandedRowIds=l),e.groups&&(t.dataSource.groupBy=e.groups,t._refreshRowHierarchy())}else if(e.groups&&0===e.groups.length&&t.dataSource.groupBy.length>0){o=!0,t.beginUpdate();const e=[];t.dataSource&&(t.dataSource._expandedRowIds=e),t.dataSource.groupBy=[],t._refreshRowHierarchy(),a=!0}if(e.paging&&t.paging.enabled&&(t.paging.index=e.paging.index,t.paging.size=e.paging.size),e.colors&&(t._conditionalColors=JSON.parse(JSON.stringify(e.colors)),t.$.headerBar)){let o=[];for(let t=0;t<e.colors.conditions.length;t++){let l=e.colors.conditions[t],a=[];for(let e in l)a.push(l[e]);o.push(a)}t.$.headerBar._appliedColors=[o,{type:e.colors.type,singleSelect:e.colors.singleSelect,decorate:e.colors.decorate}]}if(e.columns&&e.columns.length>0){o||(o=!0,t.beginUpdate());for(let o=0;o<e.columns.length;o++){const a=e.columns[o];if(a.dataField){const e=t.columnByDataField[a.dataField];if(e){const o=e.canNotify;e.canNotify=!1,a.width?e.width=a.width:e.width=180,e.visible=void 0===a.visible||a.visible,e._state&&(e._state.visible=void 0===a.visible||a.visible,e._state.freeze=void 0!==a.freeze&&a.freeze,e._state.width=a.width?a.width:180);const n=e.freeze;e.freeze=void 0!==a.freeze&&a.freeze,n!==e.freeze&&(l=!0,e.freeze||t._frozenNearColumns.indexOf(e)),e.canNotify=o}}}}}if(e.sort&&Object.keys(e.sort).length>0){o||(o=!0,t.beginUpdate());const l=t.appearance.allowSortAnimation;t.appearance.allowSortAnimation=!1;let a=t.columns.canNotify;t.columns.canNotify=!1;for(let e=0;e<t.columns.length;e++)t.columns[e].sortOrder="";t.columns.canNotify=a;for(let o in e.sort)if(e.sort[o]){const l=e.sort[o].sortOrder,a=t.columnByDataField[o];t.sortBy(a.dataField,l)}t.appearance.allowSortAnimation=l}if(e.filter&&Object.keys(e.filter).length>0){o||(o=!0,t.beginUpdate());for(let o in e.filter){const l=e.filter[o];if(l){t.addFilter(o,l,!1);const e=t.columnByDataField[o];e&&e._filterInfo&&e.filter&&e.filter.filters&&e.filter.filters[0]&&(e._filterInfo.value=e.filter.filters[0].value,e._filterInfo.condition=e.filter.filters[0].condition)}}if(t.filtering.filterRow)for(let e=0;e<t.columns.length;e++)t.columns[e]._filterEditorInitialized&&(t.columns[e]._filterEditorInitialized=!1)}if(o){t.endUpdate(!1,!1);let o=!1;e.view&&"kanban"===e.view&&(o=!0),l&&(o=!1,a=!0,t._renderColumns()),o||(a?t.refresh(!0):t._refresh())}let n=!1;e.kanban&&e.kanban.stackedBy&&(void 0===t._stackedBy&&(t._stackedBy=e.kanban.stackedBy),t._stackedBy!==e.kanban.stackedBy&&(n=!0),t._stackedBy=e.kanban.stackedBy),(n||e.view&&t.view!==e.view)&&t.$.headerBar&&t.$.headerBar._setView&&(e.name&&(t.stateSettings.current=e.name),t.$.headerBar._setView(e.view,!0)),e.filter&&Object.keys(e.filter).length>0&&t.refreshFilters(),e.name&&(t.stateSettings.current=e.name),t._refreshHeaderBar(),t.stateSettings.loading=!1}loadState(e){const t=this;if(e){if(t.stateSettings.loading=!0,t._isUpdating=0,t.beginUpdate(),t.clearSort(),t.clearFilter(),t.clearGroups(),t.clearSelection(),t._conditionalColors&&(t._conditionalColors.colors=[],t._conditionalColors.conditions=[],t._conditionalColors.type="conditions",t._conditionalColors.singleSelect="",t._conditionalColors.decorate="border"),t.$.headerBar&&delete t.$.headerBar._appliedColors,t._scrollView.scrollLeft=t._scrollView.scrollTop=0,t.paging.enabled&&(t.paging.pageIndex=0),t.endUpdate(!1,!1),"string"==typeof e){const o=t.stateSettings.storage[e];o&&t._loadState(o)}else t._loadState(e);t.stateSettings.loading=!1}else if(!t.stateSettings.autoSave){let e=t.getCurrentState();e&&t.loadState(e)}}saveState(e,t){const o=this;let l=o.getCurrentState(),a=t;!t&&o.stateSettings.options.length&&(t=o.stateSettings.options);const n=o.getState(t);let i;if(e?(i=e,o.stateSettings.current||(o.stateSettings.current=e)):i=o.stateSettings.current?o.stateSettings.current:o.stateSettings.current="View 1",l&&a)for(let e in a)l[a[e]]=n[a[e]];else l=n;function r(e,t=0,o=10){if(t>o)return"Object";const l={};if(e&&e instanceof Smart.FilterGroup)return e=e.toString();for(let a in e){let n=e[a];if(n instanceof Node)n={id:n.id};else if(n instanceof Window)n="Window";else if(n instanceof Date)n=n.toJSON();else{if(n&&Array.isArray(n)&&void 0!==n[0]&&("string"==typeof n[0]||"number"==typeof n[0]||n[0]instanceof Date||"boolean"==typeof n[0])){l[a]=n;continue}if(n&&Array.isArray(n)&&0===n.length){l[a]=n;continue}if(n&&n&&Array.isArray(n)&&void 0!==n[0]&&"object"==typeof n[0]&&"path"!==a&&!(n[0]instanceof HTMLElement))for(let e=0;e<n.length;e++)n[e]=r(n[e],t+1,o);else n instanceof Object&&(n=r(n,t+1,o))}l[a]=n}return t?l:JSON.stringify(l)}l.name=i,o.stringify_object=r;const s=r(l);return o.stateSettings.allowLocalStorage&&window.localStorage.setItem(i,s),o.stateSettings.storage||(o.stateSettings.storage={}),o.stateSettings.storage[o.stateSettings.current]&&!l.date&&o.stateSettings.storage[o.stateSettings.current].date?l.date=o.stateSettings.storage[o.stateSettings.current].date:l.date=(new Date).toJSON(),o.stateSettings.storage[o.stateSettings.current]=l,o.stateSettings.onStateChange&&(o._isUpdating<=0||void 0===this._isUpdating)&&o.isCompleted&&o.stateSettings.onStateChange(l,i,o.stateSettings.storage,r),l}autoSaveState(){const e=this;if(!e.stateSettings.current&&e.stateSettings.autoSave&&!e.stateSettings.loading){const t=e.stateSettings.storage;if(t&&0===Object.keys(t).length||!t){const t=e.localize("newGrid")+" "+e.localize("view");e.stateSettings.current=t}}e.stateSettings.autoSave&&e.stateSettings.current&&!e.stateSettings.loading&&e.saveState()}getCurrentState(){const e=this,t=e.stateSettings.current;return e.stateSettings.storage||(e.stateSettings.storage={}),e.stateSettings.storage[t]?e.stateSettings.storage[t]:null}setColors(e,t){const o=this;o._conditionalColors={type:t.type,decorate:t.decorate,conditions:e,singleSelect:t.singleSelect},o.$.headerBar.addColors(JSON.parse(JSON.stringify(e)),{type:t.type,singleSelect:t.singleSelect,decorate:t.decorate},[]),o._recycle(!1)}getColors(){const e=this;if(e._conditionalColors){const t=JSON.parse(JSON.stringify(e._conditionalColors));return{type:t.type,conditions:t.conditions,filters:t.filters,colors:t.colors,decorate:t.decorate,singleSelect:t.singleSelect}}return null}getState(e){const t=this;if(e&&!e.includes)return;const o=!e||e&&e.includes("sort")?t.getSortedColumns():null,l=!e||e&&e.includes("filter")?t.getFilteredColumns():null,a=!e||e&&e.includes("groups")?t.getGroups():null,n=!e||e&&e.includes("selection")?t.getSelectedCells():null,i=!e||e&&e.includes("selection")?t.getSelectedRows():null,r=!e||e&&e.includes("pager")?t.$.headerPager.querySelector("smart-pager"):null,s=!e||e&&e.includes("colors")?t.getColors():null;let d=0;r&&(d=r.pagesCount);const u={sort:o,filter:l,groups:a,paging:{count:d,index:t.paging.pageIndex,size:t._pageSize},selectedCells:n,selectedRows:i};s&&(delete s.colors,u.colors=s),(t.header.visible&&t.header.buttons.indexOf("views")>=0||t.header.buttons.indexOf("states")>=0)&&(u.kanban=t.getKanbanState(),u.view=t.view);const c=[];if(!e||e&&e.includes("columns")){for(let e=0;e<t.columns.length;e++){const o=t.columns[e];c.push({dataField:o.dataField,width:o.computedWidth,visible:o.visible,freeze:o.freeze})}u.columns=c}if((!e||e&&e.includes("expandedRows"))&&t.dataSource&&t.dataSource._expandedRowIds){let e={};for(let o in t.dataSource._expandedRowIds){let t=""+o;t=t.replace("Item","").replace(/_/gi,"."),e[t]=!0}u.expandedRows=e}if(e){const t={};for(let o in e){const l=e[o];u[l]&&(t[l]=u[l])}return t}return u}get _pageSize(){const e=this;return e.dataSource&&e.grouping.enabled&&e.dataSource.groupBy.length>0?e.paging.pageHierarchySize:e.paging.pageSize}get _recyclingRows(){const e=this;if(e.rowHierarchy)return e.rowHierarchy;let t=e.getVisibleRows();if(e.paging.enabled)if(e.dataSource.virtualDataSource)t=t.slice(0,e._pageSize);else if(t=t.slice(e.paging.pageIndex*e._pageSize,(e.paging.pageIndex+1)*e._pageSize),e.editing.addNewRow&&e.editing.addNewRow.visible&&"button"!==e.editing.addNewRow.displayMode){let t=e.getVisibleRows();return t=0===e.paging.pageIndex&&"far"!==e.editing.addNewRow.position?t.slice(1+e.paging.pageIndex*e._pageSize,1+(e.paging.pageIndex+1)*e._pageSize):0===e.paging.pageIndex&&"far"===e.editing.addNewRow.position?t.slice(e.paging.pageIndex*e._pageSize,1+(e.paging.pageIndex+1)*e._pageSize):t.slice(1+e.paging.pageIndex*e._pageSize,1+(e.paging.pageIndex+1)*e._pageSize),[].concat(e._frozenNearDefaultRows,t,e._frozenFarDefaultRows)}return t}_isRowInPosition(e,t){const o=e.top,l=e.top+e.height,a=o<=t&&l>t;return 0!==e.height&&a}_renderColumnGroupHeaders(){const e=this;for(let t=0;t<e._columnGroups.length;t++){const o=e._columnGroups[t];o.column.render(),o.column.allowReorder=!1,o.column.element.setAttribute("columnHeader",""),o.column.element.setAttribute("level",o.level),0===o.columns.length&&o.column.element.classList.add("smart-hidden"),0===t&&0===e.columns.indexOf(o.columns[0])&&o.column.element.classList.add("smart-grid-column-border-collapse")}}hasVisibleColumn(){const e=this;for(let t=e.viewColumns.length-1;t>=0;t--){const o=e.viewColumns[t];if(o.visible&&!o.autoGenerated)return!0}return!1}_isLastVisibleColumn(e){const t=this;for(let o=t.viewColumns.length-1;o>=0;o--){const l=t.viewColumns[o];if(l.visible)return l===e}return!1}_clearCachedTemplates(){const e=this;if(e._cachedTemplates&&Object.keys(e._cachedTemplates).length>0){e._tableCachedTemplates||(e._tableCachedTemplates=document.createElement("div"),e._tableCachedTemplates.style.display="none",document.body.appendChild(e._tableCachedTemplates));const t=document.createDocumentFragment();for(let o in e._cachedTemplates)t.appendChild(e._cachedTemplates[o]);e._tableCachedTemplates.appendChild(t)}}_recycle(e,t,o,l){const a=this;if(a._layoutSuspended||!1===a.isAttached)return;if(a._isUpdating)return;if(a.editing.isEditing&&(!0!==a._disableEndEdit&&a.endEdit(),a._isUpdating))return;a._recycleValues=void 0===o||o,a._removeCellContentPopup(),a._inputOverlay&&(a._inputOverlay.parentNode&&a._inputOverlay.parentNode.removeChild(a._inputOverlay),a._inputOverlay=null),a._selection.selectionRect&&a._refreshCellSelectionRect();const n=a._scrollView.scrollTop;let i,r=l||a._getRowIndexByPosition(n),s=a._recyclingRows,d=s[r],u=d?d.top:0,c=0,m=0,g=0,p=0;if(a._cellRowSpan&&a._cellRowSpan.maxSpan>0){let e=0;if(r>=5?e=5:r>=4?e=4:r>=3?e=3:r>=2?e=2:r>=1&&(e=1),e>0){const t=s[r-e];t&&(d=t,u=d?d.top:0,g=e*d.height,r-=e)}}a._cellRowSpan=[];for(let e=0;e<a._cellsMerge.length;e++){const t=a._cellsMerge[e],o=s.indexOf(t.row);if(r>o&&r<=o+t.rowSpan&&(r=o,d=t.row,g=Math.max(g,u-d.top),u=d.top,a.$.rowContainer.style.top=a.__frozenNearHeight-n+u+"px"),t.colSpan>1)for(let e=0;e<a.viewColumns.length;e++){const o=a.viewColumns[e];let l=o.autoGenerated?o:a.columnByDataField[o.dataField];if(l.visible&&l.left+l.computedWidth-a._scrollView.scrollLeft>=c&&l.left-l.computedWidth-a._scrollView.scrollLeft<a._clientSize.width){let e=a.columnByDataField[t.column.dataField];p=Math.max(p,l.left-e.left+l.computedWidth);break}}}a.isHScrolling&&a._clearCachedTemplates();let h=null;if(!1!==e||a._cellsMerge.length>0){if(a._columnElements)for(let e=0;e<a._columnElements.length;e++){const t=a._columnElements[e];if(!t.parentNode)break;t.set("column",null,!1),t.classList.add("smart-visibility-hidden")}for(let e=0;e<a._columnGroups.length;e++){const t=a._columnGroups[e],o=t.element;o&&(a.rightToLeft?o.style.right=t.right+"px":o.style.left=t.left+"px",o.style.width=t.computedWidth+"px")}a._firstVisibleColumn=null,a._firstVisibleUserColumn=null,a._lastVisibleColumn=null;for(let e=0;e<a.viewColumns.length;e++){let t=a.viewColumns[e];if(t.visible&&(a._firstVisibleColumn||(a._firstVisibleColumn=t),a._firstVisibleUserColumn||t.autoGenerated||(a._firstVisibleUserColumn=t),a._lastVisibleColumn=t),t.element&&(t===a._firstVisibleColumn||t.rowDetailColumn?t.element.classList.add("smart-grid-column-border-collapse"):t.element.classList.remove("smart-grid-column-border-collapse"),!1!==a.appearance.showColumnGroupCellLines&&!1!==a.appearance.showColumnGroupLines||(t.parent&&t.parent.columns&&t.parent.columns[0].dataField===t.dataField?t.element.setAttribute("column-group-first-child",""):t.parent&&t.element.removeAttribute("column-group-first-child")),t.element.removeAttribute("aria-colindex")),t.freeze){if(!0!==t.freeze&&"near"!==t.freeze||t.visible&&(c+=t.computedWidth),!t.element)continue;t.visible?(t.element.classList.remove("smart-visibility-hidden"),t.render()):t.element.classList.add("smart-visibility-hidden")}else if(t.visible&&t.left+t.computedWidth-a._scrollView.scrollLeft>=c-p&&t.left-t.computedWidth-a._scrollView.scrollLeft<a._clientSize.width){a._columnElements||(a._columnElements=[]);const o=a._columnElements[m++];o&&(o.set("column",t,!1),o.parentNode||a.$.columnContainer.appendChild(o),h||(h=t,a._firstRenderedColumn=t),t.element=o,t.render(),o.setAttribute("aria-colindex",e+1),void 0===i&&(i=t.left))}}}if(void 0===i&&(i=0),a.rightToLeft){const e=a._scrollView.scrollWidth-a._scrollView.scrollLeft-a._scrollView.vScrollBar.offsetWidth;a.$.columnContainer.style.right=e+"px",e<=0&&!a._scrollView.scrollWidth&&(a.$.columnContainer.style.right=-a.offsetWidth+a._computedColumnsWidth+"px")}else a.$.columnContainer.style.left=-a._scrollView.scrollLeft+"px";if(a.$.rowContainer.style.top=a.__frozenNearHeight-n+u+"px",a.isScrolling&&!a.isHScrolling&&(a._scrollUpdate&&clearTimeout(a._scrollUpdate),a._scrollUpdate=setTimeout((function(){a.isScrolling||(a.$.rowContainer.style.top=parseInt(a.$.rowContainer.style.top)+.01+"px")}),50)),!1===t)return;if(!a._rowElements)return;const f=a.dataSource&&a.dataSource.virtualDataSource&&!a.dataSource.virtualDataSourceOnExpand&&a.dataSource.length>a.virtualModeCachedRowsCount&&"infinite"!==a.scrolling;if(r>=0){m=0;let e=Math.max(a._clientSize.height,a._overflowOffset),t=0;f&&(a.rowById=[],a.rows&&a.rows.length>0&&void 0===a.rows[a.rows.length-1].top&&(a.rows[a.rows.length-1].top=(a.rows.length-1)*a.rows[0].height),a.rows&&a.rows.length>0&&(t=a._getVirtualRowIndexByPosition(n),u=t*a.rows[0].height,a.$.rowContainer.style.top=a.__frozenNearHeight-n+u+"px",a.paging.enabled||(r=0)),a.paging.enabled&&(t=a.paging.pageIndex*a._pageSize)),"card"===a.view&&a._cardHeight&&(e+=a._cardHeight);for(let o=r;o<s.length;o++){const l=s[o];if(0===l.height||!l.visible||!1===l.filtered||l.freeze&&l.visible)continue;const i=l.height;if(l.expandHeight&&(e+=a.offsetHeight+l.expandHeight),!(u+i>=n-g&&u<=n+e||a._autoHeight))break;{const e=a._rowElements[m++];if(!e)break;if(e.setAttribute("aria-rowindex",t+o+1),l.element=e,l.grid=a,f){if(l.index=o+t,l.visibleIndex=o+t,a.selection.enabled&&a._selection){const e=a._selection.indexes,t=l.canNotify;l.canNotify=!1,l.selected=e.indexOf(l.index)>=0,l.canNotify=t}a.paging.enabled?(l.data=a.dataSource[r+m-1],l.data&&(l.id=l.data.$.id,a.rowById[l.id]=l)):(l.data=a.dataSource[m-1],l.data&&(l.id=l.data.$.id,a.rowById[l.id]=l))}l.render()}u+=i}}a._renderFrozenRows();let y=m;if(m<a._rowElements.length)for(let e=m;e<a._rowElements.length;e++){const e=a._rowElements[m++];e.classList.add("smart-hidden"),e.removeAttribute("aria-rowindex")}a.editing.addNewRow&&a.editing.addNewRow.visible&&"button"===a.editing.addNewRow.displayMode&&a._rowElements[y]&&(a._newRow||(a._newRow=new Smart.Grid.Row({data:{},index:9999999,grid:a,addNewRow:!0,inline:!0,autoGenerated:!0})),a._newRow.element=a._rowElements[y],a._newRow.element.classList.remove("smart-hidden"),a._newRow.render()),f&&a._selection.selectionRect&&a._refreshCellSelectionRect()}_renderFrozenRows(){const e=this;let t=!1,o=!1;if("card"===e.view)return e.$.rowNearContainer.classList.add("smart-hidden"),void e.$.rowFarContainer.classList.add("smart-hidden");0===e._frozenNearRows.length?e.$.rowNearContainer.classList.add("smart-hidden"):e.$.rowNearContainer.classList.remove("smart-hidden");for(let o=0;o<e._frozenNearRows.length;o++){const l=e._frozenNearRows[o];l.visible||(l.element=e.$.rowNearContainer.children[o],l.element||(l.element=l.createElement(),e.$.rowNearContainer.appendChild(l.element)),l.element.classList.add("smart-hidden")),l.visible&&l.filtered&&(t=!0,l.element=e.$.rowNearContainer.children[o],l.element||(l.element=l.createElement(),e.$.rowNearContainer.appendChild(l.element)),l.render())}t||e.$.rowNearContainer.classList.add("smart-hidden"),0===e._frozenFarRows.length?e.$.rowFarContainer.classList.add("smart-hidden"):e.$.rowFarContainer.classList.remove("smart-hidden");for(let t=0;t<e._frozenFarRows.length;t++){const l=e._frozenFarRows[t];l.visible&&(o=!0),l.element=e.$.rowFarContainer.children[t],l.element||(l.element=l.createElement(),e.$.rowFarContainer.appendChild(l.element)),l.render()}o||e.$.rowFarContainer.classList.add("smart-hidden"),0!==e.columns.length&&e.hasVisibleColumn()||(e.$.rowNearContainer.classList.add("smart-hidden"),e.$.rowFarContainer.classList.add("smart-hidden"));const l=e.rows;l&&null!==l&&0!==l.length||(e.$.rowNearContainer.classList.add("smart-hidden"),e.$.rowFarContainer.classList.add("smart-hidden"),e._filters&&e._filters.length&&e.filtering.filterRow.visible&&e.$.rowNearContainer.classList.remove("smart-hidden"))}_recycleRotate(e,t,o,l,a){const n=t.getBoundingClientRect(),i=e.getBoundingClientRect();let r=0,s=0;return 0===i.width?(e.innerHTML=a,!1):(n.left>i.left&&(r=i.left-n.left),n.top<i.top&&(s=i.top-n.top),"left"!==o&&""!==o||(r=4),"center"===o&&(r+=i.width/2-n.width/2),"right"===o&&(r+=i.width-n.width-4),"top"!==l&&""!==l||(s=4),"center"!==l&&"middle"!==l||(s+=i.height/2-n.height/2),"bottom"===l&&(s+=i.height-n.height-4),t.style.left=r+"px",t.style.top=s+"px",!0)}_virtualDataRequest(e,t){const o=this;let l=-1,a=-1;if(!o._rowElements&&"infinite"!==o.scrolling)return;if("virtual"===o.scrolling){for(let e=0;e<o._rowElements.length;e++){const t=o._rowElements[e],n=t.row,i=0===e?n.visibleIndex:l+e;t.classList.contains("smart-hidden")||(-1===l&&(l=i),-1!==i&&(a=1+i))}0===o._rowElements.length&&(l=0,a=Math.max(20,parseInt(o.offsetHeight/o.layout.rowMinHeight*1.5)))}else"infinite"===o.scrolling?(l=1/0,a=1/0):(l=0,a=o.dataSource.length);a!==1/0&&(o.dataSource.virtualDataSourceLength||o.dataSource.length)&&(a=Math.min(a,o.dataSource.length)),o.paging.enabled&&(l=o.paging.pageIndex*o._pageSize,a=l+o._pageSize),o._toggledRow||"add"===e||"update"===e||"delete"===e||(o.appearance.displayLoadingIndicator=!0,o._setLoadingIndicatorVisibility()),o._groups||(o._groups=[].concat(o.dataSource.groupBy.toArray())||[]);const n={first:l,last:a,edit:o._editInfo||null,sorting:o.getSortedColumns(),filtering:o.getFilteredColumns(),filterOperator:o.filtering.operator,grouping:o._groups,row:o._toggledRow?o._toggledRow.data:null,action:e},i=o.dataSource.length,r=o.dataSource.boundSource.length;void 0===o._isFirstVirtualDataSourceRequest&&(o._isFirstVirtualDataSourceRequest=!0),o.dataSource.onVirtualDataSourceRequested((function(e){if(o.appearance.displayLoadingIndicator=!1,o._setLoadingIndicatorVisibility(),o._toggledRow=null,!e)return o._initializeRows(),o._initializeRowElements(),o.refresh(),o._refreshPagesCount(),void(o._autoHeight&&o._initializeRowElements());if("add"===e.action){if(t&&t(e.result),o._autoHeight&&o.rows.length>=o._rowElements.length-1&&(o._initializeRows(),o._initializeRowElements(),o.refresh(),o.filtering.filterRow)){for(let e=0;e<o.columns.length;e++)o.columns[e]._filterEditorInitialized&&(o.columns[e]._filterEditorInitialized=!1);const e=o.filtering.filterRow&&o.filtering.filterRow.visible&&o.filtering.filterRow.cell?o.filtering.filterRow.cell.column.dataField:null;e&&setTimeout((()=>{const t=o.columnByDataField[e];t&&t._filterInfo&&t._filterInfo.input&&t._filterInfo.input.focus()}),100)}return}if("update"===e.action)return void(t&&t(e.result));if("remove"===e.action)return void(t&&t(e.result));const l=o.context;if(o.context=o,o._isFirstVirtualDataSourceRequest&&0===o._initColumns.length&&(o.columns.canNotify=!1,o.columns=[],o._renderColumns(),o.columns.canNotify=!0),"scroll"===e.action)if("infinite"===o.scrolling){const e=o._viewRows;for(let t=0;t<e.length;t++){const l=e[t];l.data&&!l.addNewRow&&l.data.$&&(o.rowById[l.data.$.id]||(o.rowById[l.data.$.id]=l))}o._recycle(!1,!1)}else{const t=e.first>=0?e.first:0,l=e.last!==1/0?e.last:0;let a=0;for(let e=t;e<l;e++)o.rows[e]&&(o.rows[e].data=o.dataSource[a++]);o._recycle(!1,!1)}else if(o.dataSource.length!==i||o.dataSource.boundSource.length!==r||o._isFirstVirtualDataSourceRequest||"expand"===e.action||"filter"===e.action||"sort"===e.action||"pageIndexChange"===e.action||"pageSizeChange"===e.action||"sort"===e.action||"group"===e.action){o.paging.enabled&&o.$.headerPager.querySelector("smart-pager")&&(o.$.headerPager.querySelector("smart-pager").pagesCount=Math.ceil(o.dataSource.length/o._pageSize),o.$.footerPager.querySelector("smart-pager").pagesCount=Math.ceil(o.dataSource.length/o._pageSize));const e=o.filtering.filterRow&&o.filtering.filterRow.visible&&o.filtering.filterRow.cell?o.filtering.filterRow.cell.column.dataField:null;if(o._initializeRows(),o._initializeRowElements(),o.refresh(),o._refreshPagesCount(),o._autoHeight&&o._initializeRowElements(),o.filtering.filterRow){for(let e=0;e<o.columns.length;e++)o.columns[e]._filterEditorInitialized&&(o.columns[e]._filterEditorInitialized=!1);e&&setTimeout((()=>{const t=o.columnByDataField[e];t&&t._filterInfo&&t._filterInfo.input&&t._filterInfo.input.focus()}),100)}}else o.dataSource.virtualDataSourceOnExpand&&o.refresh();o._isFirstVirtualDataSourceRequest&&o.onLoad&&(o.onLoad(o),delete o.onLoad),o._isFirstVirtualDataSourceRequest=!1,o._recycle(),o.context=l,o._onDataUpdated&&o._onDataUpdated()}),n)}_createAddNewRowButton(){const e=this,t=document.createElement("div");return t.className="smart-grid-add-row-button smart-grid-icon smart-icon-plus",t.title=e.localize("addNewRow"),t.style.left=!e.appearance.showViewBar||e.appearance.viewBarAppendTo||e.appearance.showViewBarAsDropdown||e._mobile?"":10+e.layout.viewBarWidth+"px",e._addNewGridRow=t.onclick=()=>{e._addRowTimer&&clearTimeout(e._addRowTimer),e._addRowTimer=setTimeout((()=>{if(e.dataSource&&e.dataSource.virtualDataSource)return void e._insertNewRowAfter();const t={};for(let o=0;o<e.columns.length;o++){const l=e.columns[o];void 0!==l.defaultValue&&null!==l.defaultValue&&("today"===l.defaultValue&&"date"===l.dataType?(e._today||(e._today=new Date,e._todayYear=e._today.getFullYear(),e._todayMonth=e._today.getMonth(),e._todayDate=e._today.getDate()),t[l.dataField]=new Date(e._todayYear,e._todayMonth,e._todayDate)):t[l.dataField]=l.defaultValue)}e._addingNewRow=!0,e._add(t),e._mobile||(e._scrollView.vScrollBar.value=e._scrollView.vScrollBar.max),e.closeMenu(),e._addingNewRow=!1,e.editing.addNewRow.visible&&e.$.placeholder.classList.contains("smart-hidden")&&"button"!==e.editing.addNewRow.displayMode&&e.editing.addNewRow._addButton.classList.remove("show")}),0)},t}addColumn(e,t,o=!0){const l=this;if(e){let a=-1;if(t)for(let e=0;e<l.columns.length;e++)if(l.columns[e].dataField===t){a=e,!1===o&&(a=e+1);break}if("string"==typeof e){const t=l._getKanbanTaskField(e);if(t){if(a>=0)return void l.columns.splice(a,0,t);l.columns.push(t)}return}if(a>=0&&a<l.columns.length)return void l.columns.splice(a,0,e);l.columns.push(e)}}insertColumnAfter(e,t){e&&this.addColumn(e,t,!1)}insertColumnBefore(e,t){e&&this.addColumn(e,t,!0)}addNewColumn(e){e&&this.addColumn(e)}_createAddNewColumnButton(){const e=this,t=document.createElement("div");return t.className="smart-grid-add-column-button smart-grid-icon smart-icon-plus",t.title=e.localize("addNewColumn"),t.onclick=()=>{e._openAddColumnDialog(),e.addEventListener("closeColumnDialog",(()=>{e.layout.isDirty=!0,e._resetCachedLayout(),e._refreshLayout()}))},t}_showAddNewRowButton(e){const t=this;if(!t.columns.length)return;if("grid"!==t.view&&t.editing.addNewRow._addButton)return void t.editing.addNewRow._addButton.classList.add("smart-hidden");if("grid"===t.view&&t.editing.addNewRow._addButton&&t.editing.addNewRow._addButton.classList.remove("smart-hidden"),"float"===e&&t.computedVerticalScrollBarVisibility&&t.editing.addNewRow._addButton&&!t.editing.addNewRow._addButton.classList.contains("show"))return;if("float"===e&&t._addingNewRow)return;const o=()=>{t.editing.addNewRow._addButton&&t.editing.addNewRow._addButton&&("float"!==e&&(t.appearance.showRowHeader||t.appearance.showRowHeaderNumber)&&"card"!==t.view?t.editing.addNewRow._addButton.classList.remove("float"):(!t.computedVerticalScrollBarVisibility&&t.dataSource&&0===t.dataSource.length||t.computedVerticalScrollBarVisibility&&"float"===e||"card"===t.view)&&t.editing.addNewRow._addButton.classList.add("float"),t.computedHorizontalScrollBarVisibility?t.pager.visible?t.editing.addNewRow._addButton.style.bottom="68px":t.editing.addNewRow._addButton.style.bottom="20px":t.pager.visible?t.editing.addNewRow._addButton.style.bottom="48px":t.editing.addNewRow._addButton.style.bottom="",t.grouping.enabled&&t.dataSource)&&(!(t.dataSource.groupBy.length>0)||t.editing.addNewRow._addButton.classList.remove("show"))};t.editing.addNewRow._addButton&&t.editing.addNewRow.visible&&t.$.placeholder.classList.contains("smart-hidden")&&"button"!==t.editing.addNewRow.displayMode&&t.editing.addNewRow._addButton.classList.remove("show"),!t.editing.addNewRow.visible||"button"!==t.editing.addNewRow.displayMode&&t.$.placeholder.classList.contains("smart-hidden")||(t.editing.addNewRow._addButton?requestAnimationFrame((()=>{t.editing.addNewRow._addButton&&(t.editing.addNewRow._addButton.classList.add("show"),t.editing.addNewRow._addButton.style.left=!t.appearance.showViewBar||t.appearance.viewBarAppendTo||t.appearance.showViewBarAsDropdown||t._mobile?"":10+t.layout.viewBarWidth+"px",o(),t.editing.addNewRow.visible&&!t.computedVerticalScrollBarVisibility&&t.editing.addNewRow._addButton.classList.remove("show"))})):(t.editing.addNewRow._addButton=t._createAddNewRowButton(),t.appendChild(t.editing.addNewRow._addButton),requestAnimationFrame((()=>{t.editing.addNewRow._addButton&&(t.editing.addNewRow._addButton.classList.add("show"),o(),(t.editing.addNewRow.visible&&t.$.placeholder.classList.contains("smart-hidden")&&"button"!==t.editing.addNewRow.displayMode||!t.computedVerticalScrollBarVisibility&&t.editing.addNewRow.visible&&t.$.placeholder.classList.contains("smart-hidden"))&&t.editing.addNewRow._addButton.classList.remove("show"))}))))}_showAddNewColumnButton(){const e=this,t=()=>{e.editing.addNewColumn._addButton.classList.add("float")};e.editing.addNewColumn.visible&&(e.editing.addNewColumn._addButton||(e.editing.addNewColumn._addButton=e._createAddNewColumnButton(),e.appendChild(e.editing.addNewColumn._addButton)),requestAnimationFrame((()=>{e.editing.addNewColumn._addButton.classList.add("show"),t()})))}_verticalScrollRecycle(e,t){const o=this;if(o._layoutSuspended||!1===o.isAttached)return;if(o._isUpdating)return;if(o.editing.isEditing&&(!0!==o._disableEndEdit&&o.endEdit(),o._isUpdating))return;o._removeCellContentPopup(),o._inputOverlay&&(o._inputOverlay.parentNode&&o._inputOverlay.parentNode.removeChild(o._inputOverlay),o._inputOverlay=null),o._selection.selectionRect&&o._refreshCellSelectionRect();const l=o._recyclingRows;let a=l[t],n=a.top,i=!1;for(let r=0;r<o._cellsMerge.length;r++){const s=o._cellsMerge[r],d=l.indexOf(s.row);t>d&&t<=d+s.rowSpan&&(t=d,a=s.row,n=a.top,o.$.rowContainer.style.top=o.__frozenNearHeight-e+n+"px",i=!0)}i||(o.$.rowContainer.style.top=o.__frozenNearHeight-e+n+"px")}_verticalScrollbarHandler(e){const t=this;t.menu&&t.menu.column&&t.closeMenu(),t.isScrolling=!0,t._scrollTimer&&clearTimeout(t._scrollTimer),t._layoutSuspended||(t._scrollTimer=setTimeout((()=>{if("virtual"===t.scrolling)t._recycle(!1);else{const e=t._scrollView.scrollTop;let o=t._getRowIndexByPosition(e);o!==t._scrollRowIndex?(t._recycle(!1,!0,!0,o),t._scrollRowIndex=o):t._verticalScrollRecycle(e,o)}if(t.isScrolling=!1,e.max===e.value&&e.max>0){if(t.$.fireEvent("scrollBottomReached"),"infinite"===t.scrolling)return t.appearance.displayLoadingIndicator=!0,t._setLoadingIndicatorVisibility(),t._virtualScrollTimer&&clearTimeout(t._virtualScrollTimer),void(t._virtualScrollTimer=setTimeout((()=>{t._virtualDataRequest("scroll"),t.appearance.displayLoadingIndicator=!1,t._setLoadingIndicatorVisibility()}),50));t.editing.addNewRow._addButton&&"card"!==t.view&&t.editing.addNewRow._addButton.classList.remove("show")}else t.editing.addNewRow.visible&&"button"===t.editing.addNewRow.displayMode&&t.editing.addNewRow._addButton&&e.max>0&&(t.editing.addNewRow._addButton.classList.add("show"),t.editing.addNewRow._addButton.classList.remove("scroll"),t.editing.addNewRow._addButton.classList.add("float"));"virtual"===t.scrolling&&(t.appearance.displayLoadingIndicator=!0,t._setLoadingIndicatorVisibility(),t._virtualScrollTimer&&clearTimeout(t._virtualScrollTimer),t._virtualScrollTimer=setTimeout((()=>{t._virtualDataRequest("scroll"),t.appearance.displayLoadingIndicator=!1,t._setLoadingIndicatorVisibility()}),50)),e.min===e.value&&t.$.fireEvent("scrollTopReached")}),0))}getVerticalScrollMax(){return this.scrollHeight}getHorizontalScrollMax(){return this.scrollWidth}getHorizontalScrollValue(){return this.scrollLeft}setHorizontalScrollValue(e){this.scrollLeft=e}getVerticalScrollValue(){return this.scrollTop}setVerticalScrollValue(e){this.scrollTop=e}clearRows(){const e=this;e.dataSource=new Smart.DataAdapter({dataSource:[]}),e.rowHierarchy=null,e._visibleRows=null,e.__viewRows=null,e.rows.canNotify=!1,e.rows.length=0,e.rows.canNotify=!0,e.clearSelection(),e._refresh()}isEmpty(){const e=this;return!!(null===e.dataSource||e.dataSource&&e.dataSource.dataFields&&0===e.dataSource.length&&0===e.dataSource.dataSource.length&&!e.dataSource.virtualDataSource)}setRowStyle(e,t){const o=this,l=o.rowById[e];l&&(l.style=t,o._recycle(!1,!0))}setCellStyle(e,t,o){const l=this,a=l.rowById[e];if(a){const e=a.getCell(t);if(e){const t=e.canNotify;if(e.canNotify=!1,o)for(let t in o)void 0!==e[t]&&(e[t]=o[t]);else e.background=null,e.color=null,e.fontSize=null,e.fontFamily=null,e.fontWeight=null,e.textDecoration=null,e.fontStyle=null;e.canNotify=t,l._recycle(!1,!0)}}}setCellFormula(e,t,o){const l=this,a=l.rowById[e];if(a){const e=a.getCell(t);if(e){const t=e.canNotify;e.canNotify=!1,e.formula=o,e.canNotify=t,l._recycle(!1,!0)}}}dataBind(){const e=this;if(delete e.__autoRowHeight,e._virtualOnExpandCache=[],e._cellsMerge=[],e._cellStyles=[],null===e.dataSource||e.dataSource&&e.dataSource.dataFields&&0===e.dataSource.length&&0===e.dataSource.dataSource.length&&!e.dataSource.virtualDataSource)e.clearRows();else if(Array.isArray(e.dataSource))if(e.dataSourceSettings.dataFields&&e.dataSourceSettings.dataFields.length>0)e.dataSource=new Smart.DataAdapter({dataSource:e.dataSource,dataSourceType:e.dataSourceSettings.dataSourceType,dataFields:e.dataSourceSettings.dataFields,keyDataField:e.dataSourceSettings.keyDataField,parentDataField:e.dataSourceSettings.parentDataField,childrenDataField:e.dataSourceSettings.childrenDataField,groupBy:e.dataSourceSettings.groupBy&&e.dataSourceSettings.groupBy.length?e.dataSourceSettings.groupBy:e.grouping.groupBy,mapChar:e.dataSourceSettings.mapChar,root:e.dataSourceSettings.root,record:e.dataSourceSettings.record,autoGenerateColumns:e.autoGenerateColumns,id:e.dataSourceSettings.id,virtualDataSource:e.dataSourceSettings.virtualDataSource,virtualDataSourceOnExpand:e.dataSourceSettings.virtualDataSourceOnExpand});else if(e.columns&&e.columns.length){let t=[];for(let o=0;o<e.columns.length;o++){const l=e.columns[o];t.push({name:l.dataField,dataType:l.dataType||"string"}),l.displayField!==l.dataField&&t.push({name:l.displayField,dataType:l.dataType||"string"})}e.dataSource=new Smart.DataAdapter({dataSource:e.dataSource,dataFields:t,dataSourceType:e.dataSourceSettings.dataSourceType,keyDataField:e.dataSourceSettings.keyDataField,parentDataField:e.dataSourceSettings.parentDataField,childrenDataField:e.dataSourceSettings.childrenDataField,groupBy:e.dataSourceSettings.groupBy&&e.dataSourceSettings.groupBy.length?e.dataSourceSettings.groupBy:e.grouping.groupBy,mapChar:e.dataSourceSettings.mapChar,root:e.dataSourceSettings.root,record:e.dataSourceSettings.record,autoGenerateColumns:e.autoGenerateColumns,id:e.dataSourceSettings.id,virtualDataSource:e.dataSourceSettings.virtualDataSource,virtualDataSourceOnExpand:e.dataSourceSettings.virtualDataSourceOnExpand})}else e.dataSource=new Smart.DataAdapter({dataSource:e.dataSource});const t=e._filters,o=e._sortedColumns;if(e.clearSort(),e.filtering.filterRow)for(let t=0;t<e.columns.length;t++)e.columns[t]._filterEditorInitialized=!1;for(let t=0;t<e.columns.length;t++)delete e.columns[t]._cellsCachedValues;e._initColumns&&0===e._initColumns.length&&(e.columns=[],e._renderColumns(!0)),e._renderRows(),"virtual"===e.scrolling||e.paging.enabled&&e.dataSource&&e.dataSource.virtualDataSource||e.dataSource&&e.dataSource.virtualDataSource?e._virtualDataRequest("dataBind"):e.paging.enabled&&(!e.dataSource||e.dataSource&&!e.dataSource.url)&&e._refreshPagesCount(),o&&e._refreshSort(o),t&&t.length>0&&(e._filters=null,e.refreshFilters())}refresh(e,t){const o=this;o.isInitialized&&(e&&(o._initializeRows(),o._initializeRowElements()),o._refresh(t),o._refreshSummary())}refreshView(){const e=this;e._recycleFiles=!0,e._recycle(),delete e._recycleFiles}beginUpdate(){const e=this;e._isUpdating||(e._isUpdating=0),e._isUpdating++}endUpdate(e,t){const o=this;o._isUpdating--,o._isUpdating<0&&(o._isUpdating=0),!1!==e?o.refresh():!1!==t&&o.refreshView()}}),Smart.Grid.Extend=function(e){if(!e)return;const t=Object.getOwnPropertyNames(e.prototype);for(let o in t){const l=t[o];"constructor"!==l&&(Smart.Grid.prototype[l]=e.prototype[l])}},Smart.Grid.Extend(Smart.Utilities.Grid.Resize),Smart.Grid.Extend(Smart.Utilities.Grid.Reorder),Smart.Grid.Extend(Smart.Utilities.Grid.Pager),Smart.Grid.Extend(Smart.Utilities.Grid.Filter),Smart.Grid.Extend(Smart.Utilities.Grid.Sort),Smart.Grid.Extend(Smart.Utilities.Grid.Menu),Smart.Grid.Extend(Smart.Utilities.Grid.Select),Smart.Grid.Extend(Smart.Utilities.Grid.Edit),Smart.Grid.Extend(Smart.Utilities.Grid.Dialog),Smart.Grid.Extend(Smart.Utilities.Grid.Group),Smart.Grid.Extend(Smart.Utilities.Grid.Tree),Smart.Grid.Extend(Smart.Utilities.Grid.Export),Smart.Grid.Extend(Smart.Utilities.Grid.Chart),Smart.Grid.Extend(Smart.Utilities.Grid.View),Smart.Grid.Cell=Smart.Utilities.Grid.Cell,Smart.Grid.Row=Smart.Utilities.Grid.Row,Smart.Grid.Column=Smart.Utilities.Grid.Column;
1443
1443
 
1444
1444
  /***/ }),
1445
1445
 
1446
1446
  /***/ 5110:
1447
1447
  /***/ (() => {
1448
1448
 
1449
- Smart.Utilities.Assign("Grid.Dialog",class{_createOverlay(){const e=document.createElement("div");return e.onpointerdown=function(){return!1},e.onmousedown=function(){return!1},e.onclick=function(){},e.classList.add("smart-grid-dialog-overlay"),e}updateRelation(e,t){const a=this;for(let l=0;l<a.dataSourceSettings.relations.length;){const i=a.dataSourceSettings.relations[l];if(i.id===e){t.label&&(i.label=t.label),t.label&&(i.label=t.label),t.columns&&(i.columns=t.columns),t.dataSource&&(i.dataSource=t.dataSource);for(let t=0;t<a.columns.length;t++){const l=a.columns[t];if(l.relationField&&l.relationId&&l.relationId===e){const e=!l.editor||l.editor.singleSelect,t=a._getRelationData(l.relationId,l.relationField,e);l.editor?(l.editor.isDirty=!0,l.editor.dataSource=t):l.editor={template:"multiComboInput",readonly:!0,colorItems:!0,dropDownButtonPosition:"right",autoOpen:!0,relationId:l.relationId,relationField:l.relationField,pills:!0,singleSelect:!0,dataSource:t}}}a._recycle();break}}}_dragDialog(e,t){const a=this,l=a._dialogDragDetails.dialog;if(!e||l.pinned||l.maximized)return;if(!a._dialogDragDetails.started)return;let i,n;i=e.pageX-a._dialogDragDetails.x,n=e.pageY-a._dialogDragDetails.y;const o=Math.max(a._windowParent.element.clientHeight,a._windowParent.scrollElement.scrollHeight),s=Math.max(a._windowParent.element.clientWidth,a._windowParent.scrollElement.scrollWidth);switch(t){case"horizontal":a._dialogDragDetails.windowX=Math.max(0,Math.min(a._dialogDragDetails.windowX+i,s-l.offsetWidth)),l.style.left=a._dialogDragDetails.windowX+"px";break;case"vertical":a._dialogDragDetails.windowY=Math.max(0,Math.min(a._dialogDragDetails.windowY+n,o-l.offsetHeight)),l.style.top=a._dialogDragDetails.windowY+"px";break;case"both":a._dialogDragDetails.windowX=Math.max(0,Math.min(a._dialogDragDetails.windowX+i,s-l.offsetWidth)),a._dialogDragDetails.windowY=Math.max(0,Math.min(a._dialogDragDetails.windowY+n,o-l.offsetHeight)),l.style.left=a._dialogDragDetails.windowX+"px",l.style.top=a._dialogDragDetails.windowY+"px"}a._dialogDragDetails.top=l.offsetTop,a._dialogDragDetails.left=l.offsetLeft,a._dialogDragDetails.x=Math.max(a._windowParent.offsetLeft+a._dialogDragDetails.offsetX-a._windowParent.scrollElement.scrollLeft,Math.min(a._windowParent.offsetLeft+a._windowParent.element.offsetWidth-(a._windowParent.element.offsetWidth-l.offsetLeft)+a._dialogDragDetails.offsetX,e.pageX)),a._dialogDragDetails.y=Math.max(a._windowParent.offsetTop+a._dialogDragDetails.offsetY-a._windowParent.scrollElement.scrollTop,Math.min(a._windowParent.offsetTop+a._windowParent.element.offsetHeight-(a._windowParent.element.offsetHeight-l.offsetTop)+a._dialogDragDetails.offsetY,e.pageY))}_updateDialogDragDetails(e,t,a){const l=this;if(l._windowParent={initialParent:t.parentElement,element:document.documentElement,scrollElement:document.scrollingElement},l._dialogDragDetails||(l._dialogDragDetails={}),void 0===l._dialogDragDetails.minWidth||void 0===l._dialogDragDetails.minHeight||void 0===l._dialogDragDetails.maxWidth||void 0===l._dialogDragDetails.maxHeight){const e=getComputedStyle(t);l._dialogDragDetails.minWidth=parseFloat(e.getPropertyValue("min-width"))||0,l._dialogDragDetails.minHeight=parseFloat(e.getPropertyValue("min-height"))||0,l._dialogDragDetails.maxWidth=parseFloat(e.getPropertyValue("max-width"))||0,l._dialogDragDetails.maxHeight=parseFloat(e.getPropertyValue("max-height"))||0}l._dialogDragDetails.dialog=t,l._dialogDragDetails.windowX=t.offsetLeft,l._dialogDragDetails.windowY=t.offsetTop;const i=t.getBoundingClientRect(),n=t.parentElement===document.body?document.documentElement.getBoundingClientRect():t.parentElement?t.parentElement.getBoundingClientRect():document.documentElement.getBoundingClientRect(),o=window.scrollX||window.pageXOffset,s=window.scrollY||window.pageYOffset;l._windowParent.offsetLeft=n.left+o,l._windowParent.offsetTop=n.top+s,a&&"object"==typeof a&&(l._dialogDragDetails.offsetX=a.clientX-i.left,l._dialogDragDetails.offsetY=a.clientY-i.top),t.collapsed||(l.hasAnimation&&"minimize"===e?(l._dialogDragDetails.width=l._dialogDragDetails.width?l._dialogDragDetails.width:t.offsetWidth,l._dialogDragDetails.height=l._dialogDragDetails.height?l._dialogDragDetails.height:t.offsetHeight):(l._dialogDragDetails.width=t.offsetWidth,l._dialogDragDetails.height=t.offsetHeight),(t.style.width||t.style.height)&&(l._dialogDragDetails.resized=!0)),"minimize"!==e&&e&&(l._dialogDragDetails.type=e,l._dialogDragDetails.started=!0,l._dialogDragDetails.snapWindowWidth=t.offsetWidth,l._dialogDragDetails.snapWindowHeight=t.offsetHeight,a&&"object"==typeof a?(l._dialogDragDetails.x=a.pageX,l._dialogDragDetails.y=a.pageY):(l._dialogDragDetails.x=t.offsetLeft,l._dialogDragDetails.y=t.offsetTop))}_createPopup(e){const t=this;let a=document.createElement("div");return a.setAttribute("animation","none"),a.classList.add("smart-window","smart-grid-popup"),e||(e=t.editing.dialog),a.style.width="auto"===e.width?e.width:e.width+"px",a.style.height="auto"===e.height?e.height:e.height+"px",e.width&&"string"==typeof e.width&&(a.style.width=e.width),e.height&&"string"==typeof e.height&&(a.style.height=e.height),a.style.left="",a.style.top="",a.innerHTML='<div class="smart-container">\n <div class ="smart-content-container" smart-id="container">\n <div class="smart-content"><div class="smart-content-container"></div></div>\n </div>\n </div>\n ',a.querySelector&&a.querySelector(".smart-content")&&(a.content=a.querySelector(".smart-content").firstChild),document.body.appendChild(a),a.remove=function(){},a.close=function(){a.classList.contains("open")&&(a.classList.remove("open"),delete t._resizeHandling,a.addEventListener("transitionend",a.remove),a.addEventListener("transitioncancel",a.remove),a.onClose&&a.onClose())},a.open=function(l,i){a.removeEventListener("transitionend",a.remove),a.removeEventListener("transitioncancel",a.remove),t._resizeHandling=!1,void 0===l&&(l=e.left),void 0===i&&(i=e.top),requestAnimationFrame((function(){a.classList.add("open");const e=a.querySelector('[bind="name"]');if(e){const a=e.querySelector("smart-input");a&&t.editing.enabled&&a.focus()}const n=function(e,l){let i=t.offset(t);switch(t.dropDownMode&&(i={left:0,top:0}),"center"===e&&"horizontal"===l&&(e="middle"),e){case"top":return i.top;case"bottom":return Math.max(i.top,i.top+t.offsetHeight-a.offsetHeight);case"center":return Math.max(i.top,i.top+t.offsetHeight/2-a.offsetHeight/2);case"left":return i.left;case"middle":return i.left+t.offsetWidth/2-a.offsetWidth/2;case"right":return i.left+t.offsetWidth-a.offsetWidth}return"horizontal"===l?parseInt(e)+i.left:"vertical"===l?parseInt(e)+i.top:"number"==typeof e?e:parseInt(e)};a.style.left=n(l,"horizontal")+"px",a.style.top=n(i,"vertical")+"px",a.setPosition=(e,t)=>{t?a.style.left=n(e,"horizontal")+"px":a.style.top=n(e,"vertical")+"px"},"center"===l&&parseInt(a.style.left)<0&&(a.style.left="5%",a.style.maxWidth="90%"),"screenMiddle"===l&&(a.style.left="calc(50% - "+a.offsetWidth/2+"px)"),"screenCenter"===i&&(a.style.top="calc(50% - "+a.offsetHeight/2+"px)")})),a.onOpen&&a.onOpen()},a}_createDialog(e){const t=this;let a=document.createElement("div");e||(e=t.editing.dialog),void 0!==e.modal&&(a.modal=e.modal),void 0!==e.screenModal&&(a.screenModal=e.screenModal),a.setAttribute("animation","none"),a.classList.add("smart-window","smart-grid-dialog"),a.style.width="auto"===e.width?e.width:e.width+"px",a.style.height="auto"===e.height?e.height:e.height+"px",e.width&&"string"==typeof e.width&&(a.style.width=e.width),e.height&&"string"==typeof e.height&&(a.style.height=e.height),a.style.left="",a.style.top="",a.innerHTML=`<div class="smart-container">\n <div class ="smart-content-container" smart-id="container">\n <div id="headerSection" class="smart-header-section">\n <div class="smart-header">\n </div>\n <div class="smart-buttons-container">\n <button title="${t.localize("contextMenuItemDelete")}" tabindex=-1 class="smart-visibility-hidden smart-hidden smart-delete-button smart-grid-icon smart-icon-delete show smart-button smart-element" aria-label="Delete Row" smart-id="deleteButton"></button>\n <button title="${t.localize("copyURL")}" tabindex=-1 class="smart-visibility-hidden smart-hidden smart-copy-row-button smart-grid-icon smart-icon-link show smart-button smart-element" aria-label="Copy URL" smart-id="urlButton"></button>\n <button title="${t.localize("dialogEditHeaderMenu")}" tabindex=-1 class ="smart-visibility-hidden smart-hidden checked smart-comments-button smart-grid-icon smart-icon-menu show smart-button smart-element" aria-label="Comments" smart-id="commentsButton"></button>\n <button title="${t.localize("close")}" class ="smart-button smart-element smart-close-button" aria-label="Close" smart-id="closeButton"></button>\n </div>\n </div>\n <div class="smart-content"><div class="smart-content-container"></div></div>\n <div class ="smart-footer">\n \n <div class ="smart-stack-layout right spacing">\n <smart-button class ="smart-confirm-button item primary">Ok</smart-button>\n <smart-button class ="smart-cancel-button item">Cancel</smart-button>\n </div>\n </div>\n </div>\n </div>\n `,a.querySelector&&a.querySelector(".smart-content")&&(a.content=a.querySelector(".smart-content").firstChild),a.footer=a.querySelector(".smart-footer"),a.header=a.querySelector(".smart-header"),a.btnConfirm=a.querySelector(".smart-confirm-button"),a.btnCancel=a.querySelector(".smart-cancel-button"),a.btnDelete=a.querySelector(".smart-delete-button"),a.btnClose=a.querySelector(".smart-close-button"),a.btnComments=a.querySelector(".smart-comments-button"),a.btnLink=a.querySelector(".smart-copy-row-button"),a.headerSection=a.querySelector(".smart-header-section"),a.btnLink.onclick=()=>{let e=document.createElement("input"),t=window.location.href+"#activeRows="+a.row.id;navigator.clipboard&&navigator.clipboard.writeText?navigator.clipboard.writeText(t).then((()=>{})):(document.body.appendChild(e),e.value=t,e.select(),document.execCommand("copy"),document.body.removeChild(e))},a.btnDelete.onclick=()=>{const e=a.row.id,l=t.editing.deleteDialog.enabled;t.editing.deleteDialog.enabled=!0,t.cancelEdit(),a.close(),t._openDeleteRowDialog(e,(function(e){t._endToolbarEdit&&t._endToolbarEdit(),t.deleteRow(e)})),t.editing.deleteDialog.enabled=l,a.close()},a.btnComments.onclick=()=>{const e=a.querySelector(".smart-grid-edit-dialog-layout");e&&e.classList.toggle("hide-activity"),a.btnComments.classList.toggle("checked")},!1!==a.allowDrag&&(a.headerSection.onpointerdown=e=>{t._updateDialogDragDetails("drag",a,e)},a.headerSection.onpointerup=()=>{t._dialogDragDetails&&(t._dialogDragDetails.started=!1)});const l=document.createElement("div");return l.classList.add("smart-grid-dialog-overlay"),l.onclick=function(){a.overlayClick&&a.overlayClick()},a.overlay=l,a.remove=function(){a.parentNode&&a.parentNode.removeChild(a)},a.close=function(){a.classList.contains("open")&&(a.classList.remove("open"),delete t._resizeHandling,a.addEventListener("transitionend",a.remove),a.addEventListener("transitioncancel",a.remove),a.modal&&a.overlay.parentNode&&a.overlay.parentNode.removeChild(a.overlay),t.layout.isDirty&&"grid"===t.view&&(t._resetCachedLayout(),t._refreshLayout(),t.refresh()),a.onClose&&a.onClose())},a.open=function(l,i){a.removeEventListener("transitionend",a.remove),a.removeEventListener("transitioncancel",a.remove),t.isInShadowDOM?t.getRootNode().appendChild(a):document.body.appendChild(a),t._resizeHandling=!1,void 0===l&&(l=e.left),void 0===i&&(i=e.top),requestAnimationFrame((function(){a.classList.add("open");const e=a.querySelector('[bind="name"]');if(e){const a=e.querySelector("smart-input");a&&t.editing.enabled&&a.focus()}const n=function(e,l){const i=t.offset(t);switch("center"===e&&"horizontal"===l&&(e="middle"),e){case"top":return i.top;case"bottom":return Math.max(i.top,i.top+t.offsetHeight-a.offsetHeight);case"center":return Math.max(i.top,i.top+t.offsetHeight/2-a.offsetHeight/2);case"left":return i.left;case"middle":return i.left+t.offsetWidth/2-a.offsetWidth/2;case"right":return i.left+t.offsetWidth-a.offsetWidth}return"horizontal"===l?parseInt(e)+i.left:"vertical"===l?parseInt(e)+i.top:"number"==typeof e?e:parseInt(e)};a.style.left=n(l,"horizontal")+"px",a.style.top=n(i,"vertical")+"px",a.setPosition=(e,t)=>{t?a.style.left=n(e,"horizontal")+"px":a.style.top=n(e,"vertical")+"px"},"center"===l&&parseInt(a.style.left)<0&&(a.style.left="5%",a.style.maxWidth="90%"),"screenMiddle"===l&&(a.style.left="calc(50% - "+a.offsetWidth/2+"px)"),"screenCenter"===i&&(a.style.top="calc(50% - "+a.offsetHeight/2+"px)")})),a.modal&&(a.screenModal?t.isInShadowDOM?t.getRootNode().appendChild(a.overlay):document.body.appendChild(a.overlay):t.appendChild(a.overlay)),a.onOpen&&a.onOpen()},a}_openAddRowDialog(e,t){const a=this;if(!a.editing.addDialog.enabled)return!1;const l=a._dialogAddRow||a._createDialog(),i="{{message}}"===a.editing.dialog.header?a.localize("dialogAddHeader"):a.editing.dialog.header,n=l.content;l.header.innerHTML=i,e.grid=a,void 0===e.index&&(e.index=a.rows.length,a._rowsAdded&&(e.index+=a._rowsAdded.length));const o=e.cells;let s=null,r=0;if(a._cellEditors||(a._cellEditors=[]),!a._dialogAddRow){l.modal=!0,l.btnConfirm.innerHTML=a.localize("dialogAddButtonConfirm"),l.btnCancel.innerHTML=a.localize("dialogAddButtonCancel"),l.onOpen=function(){a.editing.dialog.visible=!0},l.onClose=function(){a.editing.dialog.visible=!1},l.btnCancel.onclick=function(){l.close()},l.btnClose.onclick=function(){l.close()},l.btnConfirm.onclick=function(){const e={};for(let t=0;t<o.length;t++){const l=o[t],i=a._getEditorValue(l),n=a._getEditorId(l),s=a._cellEditors[n];s&&(i&&i.error?(e[l.column.dataField]=i.value,s.detach()):(e[l.column.dataField]=i,s.detach()))}const i=a._rowsAdded?a._rowsAdded.length:0,n=new Smart.Grid.Row({index:a.rows.length+i,id:Smart.Utilities.Core.createGUID(),grid:a,data:e});l.close(),t(n,0===l.index)},l.onkeydown=function(e){const t=e.key;"Enter"===t?l.btnConfirm.onclick():"Escape"===t&&l.close()},n.classList.add("smart-grid-layout");for(let e=0;e<a.columns.length;e++){const t=a.columns[e];if(!t.allowEdit)continue;r%2==0&&(s=document.createElement("div"),s.classList.add("smart-grid-edit-dialog-row"),n.appendChild(s));const l=document.createElement("div");l.classList.add("col-sm-6");const i=document.createElement("div");i.classList.add("column");const o=document.createElement("label");o.innerHTML=a.columns[e].label;const d=document.createElement("div");d.classList.add("smart-grid-dialog-editor"),d.setAttribute("editor",t.dataField),d.setAttribute("template",t.editor.template),l.appendChild(i),s.appendChild(l),i.appendChild(o),i.appendChild(d),r++}}l.open(),l.index=e.index;let d=0;for(let e=0;e<o.length;e++){const t=o[e],i=t.column,n=i.dataField,s=l.querySelector("[editor="+n+"]");if(!s)continue;s.innerHTML="";let r="";void 0!==t.value&&(r=t.value),"int64"!==i.dataType&&"number"!==i.dataType&&"int"!==i.dataType&&"float"!==i.dataType||(r=0),"date"===i.dataType&&(r=new Date),"bool"!==i.dataType&&"boolean"!==i.dataType||(r=!1);let c=null;switch(t.editor.template){default:case"custom":c=a._getCustomCellEditor(t);break;case"image":c=a._getImageCellEditor(t);break;case"checkBox":c=a._getCheckBoxCellEditor(t);break;case"autoComplete":c=a._getAutoCompleteCellEditor(t);break;case"dropDownList":c=a._getAutoCompleteCellEditor(t),c.readonly=!0,c.dropDownButtonPosition="right";break;case"comboBox":c=a._getAutoCompleteCellEditor(t),c.readonly=!1,c.dropDownButtonPosition="right";break;case"maskedTextBox":c=a._getMaskCellEditor(t);break;case"checkInput":c=a._getCheckInputCellEditor(t),c.readonly=!0,c.dropDownButtonPosition="right";break;case"multiInput":c=a._getMultiInputCellEditor(t),c.readonly=!0,c.dropDownButtonPosition="right";break;case"multiComboInput":c=a._getMultiComboInputCellEditor(t),c.readonly=!0,c.dropDownButtonPosition="right";break;case"time":case"timeInput":c=a._getTimeInputCellEditor(t);break;case"date":case"dateInput":c=a._getDateInputCellEditor(t);break;case"dateRangeInput":c=a._getDateRangeInputCellEditor(t);break;case"dateTimePicker":c=a._getDateTimePickerCellEditor(t);break;case"textArea":case"textarea":c=a._getTextAreaCellEditor(t);break;case"numberInput":case"text":case"input":c="numberInput"===t.editor.template?a._getNumberInputCellEditor(t):a._getInputCellEditor(t)}if(c.attach(),t.editor.instance=c,c.setValue(r),0===d&&setTimeout((()=>{a.editing.enabled&&c.focus()}),100),!t.editor.isInitialized&&(t.editor.isInitialized=!0,t.editor.onInit)){const e=t.editor.onInit(t.row.index,t.column.dataField,t.editor.instance.element,t.row.data);if(e&&e instanceof Promise)e.then((e=>{const a="custom"===t.editor.template?t.editor.instance.element.firstElementChild:t.editor.instance.element;for(let t in e)a[t]=e[t]}));else if(e){const a=e,l="custom"===t.editor.template?t.editor.instance.element.firstElementChild:t.editor.instance.element;for(let e in a)l[e]=a[e]}}if(t.editor.onRender){const e=t.editor.onRender(t.row.index,t.column.dataField,t.editor.instance.element,t.row.data);if(e&&e instanceof Promise)e.then((e=>{const a="custom"===t.editor.template?t.editor.instance.element.firstElementChild:t.editor.instance.element;for(let t in e)a[t]=e[t]}));else if(e){const a=e,l="custom"===t.editor.template?t.editor.instance.element.firstElementChild:t.editor.instance.element;for(let e in a)l[e]=a[e]}}s.appendChild(c.element),c.element.onfocus=()=>{s.setAttribute("focus","")},c.element.onblur=()=>{s.removeAttribute("focus")},d++}a._dialogAddRow=l}_openEditDialog(e,t){const a=this;if(!a.editing.dialog.enabled)return!1;const l=a._dialogEdit||a._createDialog();let i="{{message}}"===a.editing.dialog.header?a.localize("dialogEditHeader",{value:a.editing.editRow?e.row.visibleIndex+1:e.column.label}):a.editing.dialog.header;const n=l.content;!1===a.editing.enabled?(l.classList.add("disable-edit"),i="{{message}}"===a.editing.dialog.header?a.localize("dialogEditHeaderDisabled",{value:a.editing.editRow?e.row.visibleIndex+1:e.column.label}):a.editing.dialog.header):l.classList.remove("disable-edit"),l.header.innerHTML=i,l.footer.classList.add("smart-hidden"),l.row=a.editing.editRow;const o=l.row.canNotify;l.row.canNotify=!1,l.row.showDetail=!1,l.row.canNotify=o,l.overlayClick=()=>{l.btnConfirm.click()};let s,r,d=null,c=0;if(void 0!==a._settingsDialogRowId){const e=`<div class="smart-buttons-container">\n <button title="${a.localize("pagerPreviousButton")}" tabindex=-1 class =" smart-button smart-element smart-prev-button" aria-label="Previous Record" smart-id="prevButton"></button>\n <button title="${a.localize("pagerNextButton")}" tabindex=-1 class =" smart-button smart-element smart-next-button" aria-label="Next Record" smart-id="nextButton"></button>\n </div>`;l.header.innerHTML=e+"<span>"+i+"</span>",l.btnPrev=l.querySelector(".smart-prev-button"),l.btnNext=l.querySelector(".smart-next-button"),l.header.style.display="flex",l.header.style.alignItems="center",a.editing.enabled?(l.btnDelete.classList.remove("smart-hidden"),l.btnComments.classList.remove("smart-hidden"),l.btnLink.classList.remove("smart-hidden"),l.btnDelete.classList.remove("smart-visibility-hidden"),l.btnComments.classList.remove("smart-visibility-hidden"),l.btnLink.classList.remove("smart-visibility-hidden"),0===a.users.length||a.users.length&&"guest"===a._currentUser.info?(l.btnLink.classList.add("smart-visibility-hidden"),l.btnDelete.classList.add("smart-visibility-hidden"),l.btnComments.classList.add("smart-visibility-hidden")):(l.btnLink.classList.remove("smart-visibility-hidden"),l.btnDelete.classList.remove("smart-visibility-hidden"),l.btnComments.classList.remove("smart-visibility-hidden"))):l.btnLink.style.width=l.btnDelete.style.width=l.btnComments.style.width="0px";const t=e=>{const t=a.editing.editRow,i=a._recyclingRows.indexOf(t);let o=e?a._recyclingRows[i+1]:a._recyclingRows[i-1];if(a.grouping.enabled&&a.dataSource.groupBy&&a.dataSource.groupBy.length>0){let t=1;for(;o&&!o.leaf;)o=e?a._recyclingRows[i+t]:a._recyclingRows[i-t],t++}const s=t;if(void 0!==a._settingsDialogRowId&&a.editing.dialog.autoSave){const e=a.rowById[a._settingsDialogRowId];e&&(l.saveRowData(e,!1),a._disableEndEdit=!0,a._recycle(!1,!0),a._disableEndEdit=!1)}if(o){if(a.editing.recordNavigation=!0,a.editing.editRow=o,a._settingsDialogRowId=o.id,s.isEditing=!1,s.element.removeAttribute("edit"),"gallery"===a.view){const e=a.querySelector('.smart-card[row-id="'+l.row.id+'"]');e&&e.removeAttribute("edit");const t=a.querySelector('.smart-card[row-id="'+o.id+'"]');t&&t.setAttribute("edit","")}const e=o,t=s.cells,i=e.cells;"kanban"===a.view&&a._kanban&&a._kanban.selectTask(e.id),l.row=o,l.header.querySelector("span").innerHTML=a.localize("dialogEditHeader",{value:a.editing.editRow.visibleIndex+1}),"gallery"!==a.view&&e.element.row.data.$.id===e.data.$.id&&e.element.setAttribute("edit","");for(let a=0;a<i.length;a++){const l=i[a],n=l.column;if(!n.allowEdit||!1===n._visible)continue;l.isEditing=!0,t[a].isEditing=!1;const o=e.data[n.dataField];l.editor&&l.editor.instance&&l.editor.instance.setValue(o)}a._applySettingsDialogLayout(l,n,a.editing.editRow,!0),a.editing.enabled&&setTimeout((()=>{const e=l.querySelector(".smart-grid-dialog-editor input");e&&e.focus()}),100)}};l.btnNext.onmousedown=e=>{t(!0),e.preventDefault(),e.stopPropagation()},l.btnPrev.onmousedown=e=>{t(!1),e.preventDefault(),e.stopPropagation()}}if(!a._dialogEdit){l.modal=!0,l.btnConfirm.innerHTML=a.localize("dialogEditButtonConfirm"),l.btnCancel.innerHTML=a.localize("dialogEditButtonCancel"),l.onOpen=function(){a.editing.dialog.visible||(a.editing.dialog.visible=!0,void 0!==a._settingsDialogRowId&&l.editorsContent&&l.editorsContent.offsetHeight&&(l.editorsContent.style.maxHeight=l.editorsContent.offsetHeight+40+"px",l.editorsContent.offsetWidth>a.offsetWidth||l.editorsContent.offsetHeight>window.innerHeight||l.editorsContent.offsetWidth>window.innerWidth?setTimeout((()=>{const e=a.offset(a);l.style.left=e.left+"px",l.style.top=e.top+"px",l.style.width=l.style.minWidth=a.offsetWidth+"px",l.style.height=l.style.minHeight=a.offsetHeight+"px",l.editorsContent.style.maxHeight=""})):(l.style.width=l.style.minWidth="",l.style.height=l.style.minHeight="",400!==a.editing.dialog.height&&(l.style.height=l.style.minHeight=a.editing.dialog.height+"px",l.editorsContent.style.maxHeight=l.editorsContent.offsetHeight+40+"px"),400!==a.editing.dialog.width&&(l.style.width=l.style.minWidth=a.editing.dialog.width+"px"),"gallery"===a.view&&setTimeout((()=>{a.querySelector('.smart-card[row-id="'+l.row.id+'"]')}))),a.editing.enabled&&setTimeout((()=>{const e=l.querySelector(".smart-grid-dialog-editor input");e&&e.focus()}),100)))},l.onClose=function(){a.editing.dialog.visible=!1,l.row&&(l.row.showDetail=!1)},l.btnCancel.onclick=function(){a.editing.isEditing=!0,a.cancelEdit()},l.btnClose.onclick=function(){a.editing.isEditing=!0,a.cancelEdit()};const t=(e,t=!0)=>{if(!e)return!1;const i=e.cells;let n={};e.element.removeAttribute("error");for(let e=0;e<i.length;e++){const t=i[e],l=a._getEditorValue(t);n[t.column.dataField]=l}const o=a.validateRow(e.id,n);if(Object.keys(o).length>0){let e=!0;for(let t=0;t<i.length;t++){const n=i[t],s=o[n.column.dataField],r=l.querySelector(`[label-for="${n.column.dataField}"]`);if(r&&(r.innerHTML=""),s)for(let t in s){const l=s[t];let i="";if(!l)continue;let o=l[t];"minLength"!==t&&"maxLength"!==t||(o=l[t.toLowerCase()]),i=l.message?l.message:"required"===t||"valueMissing"===t?a.localize("requiredValue",{value:n.column.label}):"min"===t?a.localize("invalidMinValue",{value:n.column.label,min:o.min}):"max"===t?a.localize("invalidMaxValue",{value:n.column.label,max:o.max}):"minLength"===t?a.localize("invalidMinLengthValue",{value:n.column.label,min:o.requiredLength}):"maxLength"===t?a.localize("invalidMaxLengthValue",{value:n.column.label,max:o.requiredLength}):a.localize("invalidValue"),e=!1,r&&(r.innerHTML=i)}}if(!e)return!1}const s=e.style;e.updatedDate=new Date,e.updatedBy=a.currentUser,e.style=l._rowStyle,e.comments=l._rowComments;const r=a.dataSource.dataItemById[e.id];if(r){const t=r.$.index;a.dataSource&&e.comments!==a.dataSource.boundSource[t].comments&&(a._sortedColumns&&a._sortedColumns.length>0?r.comments=e.comments:a.dataSource.boundSource[t].comments=e.comments)}if(e.style=l._rowStyle,a.onRowStyle&&s!==e.style&&(null===s?a.onRowStyle(e.index,e,e.style):s.background===e.style.background&&s.color===e.style.color&&s.fontSize===e.style.fontSize&&s.fontStyle===e.style.fontStyle&&s.fontFamily===e.style.fontFamily&&s.fontWeight===e.style.fontWeight&&s.status===e.style.status&&s.textDecoration===e.style.textDecoration||a.onRowStyle(e.index,e,e.style)),!t){for(let t=0;t<i.length;t++){const l=i[t],n=a._getEditorValue(l),o=l.column.dataField;if(e.canNotify=!1,e.data.canNotify=!1,e.data[o]=n,r){const e=r.$.index;a.dataSource&&(a._sortedColumns&&a._sortedColumns.length>0?r[o]=n:a.dataSource.boundSource[e][o]=n)}e.canNotify=!0,e.data.canNotify=!0}a._onSaveRowData&&a._onSaveRowData(e)}return!0};if(l.saveRowData=t,l.btnConfirm.onclick=function(){if(void 0!==a._settingsDialogRowId){const e=a.rowById[a._settingsDialogRowId];let i=!0;if(e&&(i=t(e)),!i)return;if(l.columnVisibility){let e=!1;const t=a.columns.canNotify;a.columns.canNotify=!1;for(let t in l.columnVisibility){const i=a.columnByDataField[t];i.visible!==l.columnVisibility[t]&&(i.visible=l.columnVisibility[t],e=!0)}if(a.columns.canNotify=t,e)return a.endEdit(),a.refresh(!1),void(a.dataSource&&a.dataSource.boundHierarchy&&(a.dataSource.refreshHierarchy(),a._refreshRowHierarchy(),a.refresh()))}}a.endEdit(),a.dataSource&&a.dataSource.boundHierarchy&&(a.dataSource.refreshHierarchy(),a._refreshRowHierarchy(),a.refresh())},l.onkeydown=function(e){const t=e.key,l=a.editing.commandKeys;for(let e in l){const i=l[e];if(t===i.key){a._applyCommand(i.command);break}}},a.editing.editRow)if(void 0!==a._settingsDialogRowId)a._applySettingsDialogLayout(l,n,a.editing.editRow);else{n.classList.add("smart-grid-layout");for(let e=0;e<a.columns.length;e++){const t=a.columns[e];if(!t.allowEdit)continue;c%2==0&&(d=document.createElement("div"),d.classList.add("smart-grid-edit-dialog-row"),n.appendChild(d));const l=document.createElement("div");l.classList.add("col-sm-6");const i=document.createElement("div");i.classList.add("column");const o=a._settingsDialogRowId?document.createElement("div"):document.createElement("label");o.innerHTML=a.columns[e].label;const s=document.createElement("div");s.classList.add("smart-grid-dialog-editor"),s.setAttribute("editor",t.dataField),s.setAttribute("template",t.editor.template),l.appendChild(i),d.appendChild(l),i.appendChild(o),i.appendChild(s),c++}}else{const t=e.column,a=document.createElement("div");a.classList.add("smart-grid-dialog-editor"),a.setAttribute("editor",""),a.setAttribute("template",t.editor.template),n.appendChild(a)}}if(a._dialogEditPosition){const e=a.offset(a);s=parseInt(a._dialogEditPosition.left)-e.left,r=parseInt(a._dialogEditPosition.top)-e.top}if(a.editing.dialog.visible||l.open(s,r),a.editing.editRow){const a=l.querySelector("[editor="+e.column.dataField+"]");a&&(a.innerHTML="",a.appendChild(t.element),a.editor=t,a.editorValue=t.getValue(),t.element.onfocus=()=>{a.setAttribute("focus",""),a.setAttribute("touched",""),a.editorValue=t.getValue()},t.element.onblur=()=>{a.removeAttribute("focus"),a.editorValue!==t.getValue()&&a.setAttribute("pending","")})}else{const a=e.column,i=l.querySelector("[editor]");i.innerHTML="",i.setAttribute("template",a.editor.template),i.appendChild(t.element),i.editor=t,i.editorValue=t.getValue(),t.element.onfocus=()=>{i.setAttribute("focus",""),i.setAttribute("touched",""),i.editorValue=t.getValue()},t.element.onblur=()=>{i.removeAttribute("focus"),i.editorValue!==t.getValue()&&i.setAttribute("pending","")}}a._dialogEdit=l}_refreshCurrentUser(){const e=this,t=e.users;let a=e.currentUser,l=!0,i=!0,n=e.editing.enabled,o=!0;t&&null!==a&&(a=t.find((e=>e.id===a)),a&&(l=!1!==a.allowAdd,i=!1!==a.allowComment,n=n&&!1!==a.allowEdit,o=!1!==a.allowRemove)),t&&t.length&&(null!==e.currentUser&&!1!==e.currentUser||(l=!1,i=!1,n=!1,o=!1,a="guest")),e._currentUser={allowAdd:l,allowComment:i,allowEdit:n,allowRemove:o,info:a}}_getColorInput(){const e=document.createElement("smart-color-input");return e.dataSource=["#D50000","#E67C73","#F4511E","#F6BF26","#0B8043","#33B679","#3F51B5","#039BE5","#7986CB","#8C47FF","#8E24AA","#FF36C2","#616161","#454545","#949494","#000000"],e.additionalColors=["#FF9EB7","#FF9EB7","#FFD66D","#FFEBB6","#93DF89","#D1F7C4","#9DC7FF","#D0F0FD","#CDAFFF","#ECE1FD","#FA9DE2","#FFDAF6","#CBCBCB","#EDEDED","#FFFFFF",""],e.valueDisplayMode="colorBox",e.classList.add("underlined","smart-grid-color-input"),e.style.width="auto",e.readonly=!0,e.onRender=()=>{const t=e.$.scrollView;t&&t.classList.add("smart-grid-color-input")},e}_applySettingsDialogLayout(e,t,a,l){const i=this;e.classList.add("smart-grid-dialog-expand-row");const n=e._rowStyle=JSON.parse(JSON.stringify(a._style)),o=e._rowComments=JSON.parse(JSON.stringify(a.comments));l&&e.activityContent.remove();const s=[];e.columnVisibility=s;let r=document.createElement("div"),d=document.createElement("div"),c=document.createElement("div"),u=document.createElement("div");l?(r=e.editorsContent,c=e.layoutContent,c.appendChild(d)):(c.appendChild(r),c.appendChild(u),c.appendChild(d),t.appendChild(c)),c.classList.add("smart-grid-edit-dialog-layout"),r.classList.add("smart-grid-edit-dialog-editors-container"),d.classList.add("smart-grid-edit-dialog-activity-container"),u.classList.add("smart-footer"),Smart.Utilities.Core.isMobile&&(c.classList.add("hide-activity"),e.btnComments.classList.remove("checked")),(0===i.users.length||i.users.length&&i._currentUser&&i._currentUser.info&&"guest"===i._currentUser.info)&&(d.classList.add("smart-hidden"),e.btnComments.classList.add("smart-hidden"),c.classList.add("hide-activity"),e.btnComments.classList.remove("checked"),e.btnComments.classList.add("smart-hidden"),e.btnLink.classList.add("smart-hidden"));const m=document.createElement("smart-button");m.innerHTML=`<span>${i.localize("dialogEditButtonSave")}</span>`,m.classList.add("primary");const p=document.createElement("smart-button");p.innerHTML=`<span>${i.localize("dialogEditButtonCancel")}</span>`;const g=document.createElement("div");g.classList.add("smart-flex"),g.style.flexDirection="row-reverse",g.appendChild(m),g.appendChild(p),p.style.marginRight="10px",u.appendChild(g);const b=document.createElement("div");b.classList.add("smart-flex"),b.style.alignItems="center",b.innerHTML=`<label style="margin-right: 5px;">${i.localize("dialogEditButtonAutoSave")}</label>\n <label title="${i.localize("dialogEditButtonAutoSave")}" class="smart-switch">\n <input type="checkbox">\n <span class="slider round"></span>\n </label>`,u.appendChild(b),i.users&&i.users.length&&(!1!==i.currentUser&&null!==i.currentUser&&void 0!==i.currentUser||u.classList.add("smart-hidden"));const f=b.querySelector("input");f.onchange=()=>{i.editing.dialog.autoSave=f.checked},i._currentUser.info&&!i._currentUser.allowEdit&&(u.classList.add("smart-hidden"),e.btnComments.classList.add("smart-hidden"),e.btnLink.classList.add("smart-hidden"),e.btnDelete.classList.add("smart-hidden")),!0===i.editing.dialog.autoSave&&(f.checked=!0),p.onclick=()=>{e.btnCancel.click()},m.onclick=()=>{e.btnConfirm.click()},Smart.Utilities.Core.isMobile&&(c.setAttribute("mobile",""),e.setAttribute("mobile",""));let h=0;for(let e=0;e<i.columns.length;e++){const t=i.columns[e];t.allowEdit&&!1!==t._visible&&h++}h>=8?r.classList.add("many"):r.classList.remove("many"),e.editorsContent=r,e.activityContent=d,e.layoutContent=c,e.footerContent=u,setTimeout((()=>{e.editorsContent.scrollHeight>e.editorsContent.offsetHeight?(u.style.setProperty("--smart-background","var(--smart-surface)"),u.style.borderTopStyle="solid",u.style.borderTopColor="var(--smart-border)",u.style.borderTopWidth="1px",p.classList.add("flat")):(u.style.setProperty("--smart-background",""),u.style.borderTopStyle="",u.style.borderTopColor="",u.style.borderTopWidth="",p.classList.remove("flat"))}),200);const y=document.createElement("div"),v=document.createElement("div");d.appendChild(y),d.appendChild(v);let C=o&&o.length?" ("+o.length+")":"";y.innerHTML=`\n <div class="tabs">\n <div view="comments" class="active tab"><div class="smart-flex tab-label"><span class="smart-grid-icon smart-icon-comment show"></span><span>${i.localize("commentsTab")}<span>${C}</span></span></div></div>\n <div view="history" class="tab smart-hidden"><div class="smart-flex tab-label"><span class="smart-grid-icon smart-icon-history show"></span>${i.localize("historyTab")}</div></div>\n <div view="details" class="tab"><div class="smart-flex tab-label"><span class="smart-grid-icon smart-icon-font show"></span>${i.localize("detailsTab")}</div></div>\n </div>\n <div class="smart-hidden details-tab">\n <div class="smart-grid-edit-dialog-row" style="grid-template-rows: 50px 50px 50px 50px 50px 1fr;"><div class="column"><div class="header smart-grid-edit-dialog-column-info">${i.localize("format").replace(":","")}\n <span title="${i.localize("resetFormat")}" class="reset-format smart-grid-icon smart-icon-reload show"></span>\n </div>\n </div>\n <div class="format-layout">\n <div title="${i.localize("background")}" class="smart-hidden format smart-grid-edit-dialog-column-info">\n <span class="smart-grid-icon smart-icon-color-background show"></span><div class="background"></div>\n </div>\n <div title="${i.localize("color")}" class="smart-hidden format smart-grid-edit-dialog-column-info">\n <span style="border-bottom: 2px solid #46CA78;" color="#46CA78" class="format smart-grid-icon smart-icon-font show"></span><div class="color"></div>\n </div>\n <div class="format-layout button-group">\n <span title="${i.localize("bold")}" class="formatbtn bold smart-grid-icon smart-icon-bold show"></span>\n <span title="${i.localize("italic")}" class="formatbtn italic smart-grid-icon smart-icon-italic show"></span>\n <span title="${i.localize("underline")}" class="formatbtn underline smart-grid-icon smart-icon-underline show"></span>\n <span style="text-decoration: line-through;" title="${i.localize("linethrough")}" class="formatbtn linethrough smart-grid-icon smart-icon-font show"></span>\n </div>\n </div>\n <div style="display: flex; flex-direction: column; margin-bottom: 20px;" class="format-layout font-group smart-flex">\n <span>${i.localize("fontFamily").replace(":","")}</span>\n <div title="${i.localize("fontFamily").replace(":","")}" class="format smart-grid-edit-dialog-column-info">\n <span class="smart-grid-icon smart-icon-font show"></span><div class="font-family"></div>\n </div>\n </div>\n <div style="margin-top: 20px; display: flex; flex-direction: column;" class="font-family format-layout font-group">\n <span>${i.localize("fontSize").replace(":","")}</span>\n <div title="${i.localize("fontSize").replace(":","")}" class="font-family format smart-grid-edit-dialog-column-info">\n <span class="smart-grid-icon smart-icon-fontsize show"></span><div class="font-size"></div>\n </div> \n </div>\n <div class="format-layout smart-hidden font-group">\n <div title="${i.localize("status").replace(":","")}" class="format smart-grid-edit-dialog-column-info">\n <span color="#F1C58B" class="smart-grid-icon smart-icon-star show"></span><div class="status"></div>\n </div>\n </div>\n </div>\n </div>\n <div class="comments-tab">\n <div class="column smart-hidden"><div class="smart-hidden comments-header smart-grid-edit-dialog-column-info">${i.localize("comments").replace(":","")}</div></div>\n <div class="comments-layout">\n <div class="comments"><span class="no-comments"><span>${i.localize("noComments")}</span></span></div>\n <div class="footer">\n <smart-text-area hint="${i.localize("comment")}" placeholder="${i.localize("commentPlaceholder")}" class="smart-text-area success underlined"></smart-text-area>\n <smart-button class="success">${i.localize("send")}</smart-button>\n </div>\n </div>\n </div>\n <div class="history-tab smart-hidden">\n <div class="history-layout">\n <div class="history"></div>\n </div>\n </div>\n `;const S=y.querySelectorAll(".tab");i.storeHistory&&(!i._currentUser||i._currentUser&&!i._currentUser.info?S[S.length-1].classList.add("smart-hidden"):S[S.length-1].classList.remove("smart-hidden")),!i.users||i.users&&0===i.users.length||!i._currentUser||i._currentUser&&!i._currentUser.info?S[S.length-2].classList.add("smart-hidden"):S[S.length-2].classList.remove("smart-hidden"),y.querySelector(".tabs").onpointerdown=e=>{const t=e.target.closest(".tab");if(t){const e=t.getAttribute("view"),a=y.querySelector(".details-tab"),l=y.querySelector(".comments-tab"),n=y.querySelector(".history-tab");a.classList.add("smart-hidden"),l.classList.add("smart-hidden"),n.classList.add("smart-hidden");for(let e=0;e<S.length;e++)S[e].classList.remove("active");switch(t.classList.add("active"),e){case"details":a.classList.remove("smart-hidden");break;case"comments":l.classList.remove("smart-hidden");break;case"history":n.classList.remove("smart-hidden"),i._refreshHistory()}}};const w=i._getColorInput();y.querySelector(".background").appendChild(w),w.onchange=()=>{n.background=w.value},n.background&&(w.value=n.background);const _=i._getColorInput();y.querySelector(".color").appendChild(_),_.onchange=()=>{n.color=_.value},n.color&&(_.value=n.color);const D=i._getColorInput();y.querySelector(".status").appendChild(D),D.onchange=()=>{n.status=D.value},n.status&&(D.value=n.status);const L=document.createElement("smart-input");L.style.width="auto",L.classList.add("underlined"),L.dropDownButtonPosition="right",L.readonly=!0,L.dropDownHeight="auto",L.dataSource=["-","Segoe UI","Arial","Georgia","Impact","Tahoma","Times New Roman","Verdana"],L.onchange=()=>{n.fontFamily=L.value},n.fontFamily?L.value=n.fontFamily:L.selectedIndex=0,y.querySelector(".font-family").appendChild(L);const x=document.createElement("smart-input");x.style.width="auto",x.classList.add("underlined"),x.dropDownButtonPosition="right",x.readonly=!0,x.dropDownHeight="auto",x.dataSource=["-","8px","10px","12px","14px","18px","24px"],x.onchange=()=>{n.fontSize=x.value},n.fontSize?x.value=n.fontSize:x.selectedIndex=0,y.querySelector(".font-size").appendChild(x);const k=y.querySelector(".button-group");k.onclick=e=>{const t=e.target.closest(".formatbtn");let a;t.classList.contains("checked")?(t.classList.remove("checked"),a=!1):(t.classList.add("checked"),a=!0),t.classList.contains("bold")?n.fontWeight=a?"bold":null:t.classList.contains("italic")?n.fontStyle=a?"italic":null:t.classList.contains("underline")?n.textDecoration=a?"underline":null:t.classList.contains("linethrough")&&(n.textDecoration=a?"line-through":null)},n.fontWeight?k.children[0].classList.add("checked"):k.children[0].classList.remove("checked"),n.fontStyle?k.children[1].classList.add("checked"):k.children[1].classList.remove("checked"),n.textDecoration?k.children[2].classList.add("checked"):k.children[2].classList.remove("checked"),y.querySelector(".reset-format").onclick=()=>{for(let e=0;e<k.children.length;e++)k.children[e].classList.remove("checked");L.selectedIndex=0,x.selectedIndex=0,_.value="",w.value="",D.value="",n.fontWeight=null,n.fontStyle=null,n.textDecoration=null,n.fontSize=null,n.fontFamily=null};const F=y.querySelector(".comments-header"),A=y.querySelector('[view="comments"]'),T=y.querySelector(".comments-layout smart-text-area"),z=y.querySelector(".comments-layout smart-button"),E=y.querySelector(".comments-layout .footer"),I=y.querySelector(".comments-layout .comments");T.users=i.users,z.disabled=!0,I.innerHTML=`<span class="no-comments"><span>${i.localize("noComments")}</span></span>`;const M=()=>{const e=I.querySelector(".no-comments");0===o.length?e.classList.remove("smart-hidden"):e.classList.add("smart-hidden")},H=()=>{i._commentEditing&&(i._commentEditing.parentNode&&i._commentEditing.parentNode.removeChild(i._commentEditing),delete i._commentEditing)};H();const R=e=>{const t=e.querySelector(".remove-button");H(),t.onclick=e=>{const t=e.target,l=o.indexOf(t.comment);if(H(),l>-1){const e=o[l];o.splice(l,1),i.$.fireEvent("commentRemove",{id:a.id,value:e}),i.onComment&&i.onComment(a.id,o),t.element.remove();const n=o.length?"("+o.length+")":"";F.innerHTML=A.lastElementChild.lastElementChild.innerHTML=`${i.localize("comments").replace(":","")} <span>${n}</span>`,M()}}},B=e=>{const t=e.querySelector(".edit-button");H();const a=e.querySelector(".comment-body");t.onclick=t=>{H();const a=t.target,l=o.indexOf(a.comment);if(!i._commentEditing&&l>-1){const t=o[l];let n=!1;if(i._currentUser.info&&t.userId===i._currentUser.info.id&&i._currentUser.allowComment&&(n=!0),!n)return;const s=document.createElement("smart-text-area");s.users=i.users;const r=e.querySelector(".comment-body");r.appendChild(s),r.style.position="relative",r.classList.add("edit"),s.style.width="100%",s.style.height="100%",s.style.minHeight="50px",s.style.minWidth="150px",s.style.left=s.style.top="0px",s.style.position="absolute",s.value=t.text,s.style.zIndex=5,s.style.boxShadow="var(--smart-elevation-2)",s.onkeydown=e=>{"Escape"===e.key&&(e.preventDefault(),e.stopPropagation(),s.onblur=s.onchange=null,r.classList.remove("edit"),H())},s.onchange=s.onblur=()=>{if(t.text=s.value,""===s.value)return void e.querySelector(".remove-button").click();const l=i._createComment(t);a.element.parentNode===I&&(I.insertBefore(l,a.element),a.element.parentNode.removeChild(a.element),delete i._commentEditing),R(l),B(l)},s.focus(),i._commentEditing=s}},a.ondblclick=e=>{t.click()}};for(let e=0;e<o.length;e++){const t=o[e],a=i._createComment(t);R(a),B(a),I.appendChild(a)}if(setTimeout((()=>{I.scrollTop=I.scrollHeight}),200),i._commentUpdateInterval=setInterval((()=>{e.classList.contains("open")?i._commentEditing:clearInterval(i._commentUpdateInterval)}),5e3),F.innerHTML=`${i.localize("comments").replace(":","")} ${C}`,M(),T.onfocus=()=>{E.classList.add("focus")},T.onblur=()=>{E.classList.remove("focus")},T.onkeyup=()=>{z.disabled=""===T.value},z.onclick=t=>{if(""===T.value)return;i._refreshCurrentUser();const l={text:T.value,id:function(){const e=function(){return(65536*(1+Math.random())|0).toString(16).substring(1)};return e()+e()}(),userId:i._currentUser.info?i._currentUser.info.id:-1,time:new Date},n=i._createComment(l);if(!n)return t.preventDefault(),void t.stopPropagation();R(n),B(n),o.push(l),i.$.fireEvent("commentAdd",{id:a.id,value:l}),i.onComment&&i.onComment(a.id,o),T.value="",z.disabled=!0,M(),I.appendChild(n),(()=>{const t=e._rowComments;if(H(),I.innerHTML=`<span class="no-comments"><span>${i.localize("noComments")}</span></span>`,M(),e.classList.contains("open"))for(let e=0;e<t.length;e++){const a=t[e],l=i._createComment(a);R(l),B(l),I.appendChild(l)}else clearInterval(i._commentUpdateInterval)})(),T.focus();const s=o.length?"("+o.length+")":"";F.innerHTML=A.lastElementChild.lastElementChild.innerHTML=`${i.localize("comments").replace(":","")} <span>${s}</span>`,I.scrollTop=I.scrollHeight,t.preventDefault(),t.stopPropagation()},l)return;const q=e=>{if(!e.allowEdit||!1===e._visible)return;const t=document.createElement("div");t.classList.add("smart-grid-edit-dialog-row"),r.appendChild(t),t.style.gridColumn="span 2",!1===e.visible&&t.classList.add("hidden-column");const a=document.createElement("div"),l=i._settingsDialogRowId?document.createElement("div"):document.createElement("label"),n=e.validationRules&&e.validationRules.length>0?"*":"";l.innerHTML=`<div class="smart-grid-edit-dialog-column-info"><span class="smart-grid-icon ${e.icon} show"></span><label>`+e.label+n+'</label><span toggle class="smart-grid-icon smart-icon-visibility-on show"</div>';const o=document.createElement("div");o.classList.add("smart-grid-dialog-editor"),o.setAttribute("editor",e.dataField),o.setAttribute("template",e.editor.template);const d=l.querySelector("[toggle]");d.column=e,s[e.dataField]=e.visible,d.title=i.localize("columnMenuItemHide"),!1===i.editing.enabled&&d.classList.add("smart-visibility-hidden"),d.onclick=()=>{s[d.column.dataField]=!d.column.visible,d.classList.contains("smart-icon-visibility-on")?(d.classList.remove("smart-icon-visibility-on"),d.classList.add("smart-icon-visibility-off"),d.title=i.localize("columnMenuItemShow")):(d.classList.add("smart-icon-visibility-on"),d.classList.remove("smart-icon-visibility-off"),d.title=i.localize("columnMenuItemHide"))},e.visible||(d.classList.remove("smart-icon-visibility-on"),d.title=i.localize("columnMenuItemShow")),e.visible?d.classList.add("smart-icon-visibility-on"):d.classList.add("smart-icon-visibility-off"),a.appendChild(l),a.appendChild(o);const c=document.createElement("label");c.classList.add("smart-field-editor-error-label"),c.setAttribute("label-for",e.dataField),a.appendChild(c),t.appendChild(a)},N=[];for(let e=0;e<i.columns.length;e++){const t=i.columns[e];t.visible?q(t):N.push(t)}if(N.length){const e=document.createElement("div");e.classList.add("smart-grid-edit-dialog-row"),r.appendChild(e),e.innerHTML=`<div class="smart-grid-edit-dialog-columns-separator"><span></span><div><div class="show toggle-button smart-flex">${i.localize("hideHiddenColumns",{value:N.length})}<span style="font-family: var(--smart-font-family-icon); font-size: 16px; margin-left: 5px; border:none;" class="smart-prev-button"></span></div></div><span></span></div>`,e.style.gridColumn="span 2",e.querySelector(".toggle-button").onclick=()=>{const t=r.querySelectorAll(".hidden-column"),a=e.querySelector(".toggle-button");a.classList.contains("show")?(a.innerHTML=`${i.localize("showHiddenColumns",{value:N.length})}<span style="font-family: var(--smart-font-family-icon); margin-left: 10px; border:none;" class="smart-next-button"></span>`,a.classList.remove("show")):(a.innerHTML=`${i.localize("hideHiddenColumns",{value:N.length})}<span style="font-family: var(--smart-font-family-icon); margin-left: 10px; border:none;" class="smart-prev-button"></span>`,a.classList.add("show")),t.forEach((e=>{e.classList.toggle("smart-hidden")}))};for(let e=0;e<N.length;e++)q(N[e])}}_getDateFormat(e){const t=new Smart.Utilities.DateTime(e),a=((new Date).getTime()-e.getTime())/1e3,l=Math.floor(Math.abs(a));if(""===this.locale||"en"===this.locale)return 0===l?"now":l<60?l+"s ago":l<3600?Math.floor(l/60)+"m ago":l<86400?Math.floor(l/3600)+"h ago":t.toString("dd/MM/yyyy hh:mm");t.toString("dd/MM/yyyy hh:mm")}_refreshHistory(){const e=this,t=e._dialogEdit;if(!t)return;const a=t.querySelector(".history");if(!e.storeHistory)return void a.classList.add("smart-hidden");if(!e._currentUser||e._currentUser&&!e._currentUser.info)return void a.classList.add("smart-hidden");a.classList.remove("smart-hidden");const l=t.row.history;if(!l)return;let i="\n ";for(let t=0;t<l.length;t++){const a=l[t];let n="";if(e._kanban)n=e._kanban._getHistoryItemLabel(a);else if("created"===a.action)n=e.localize("rowCreated",{value:a.action});else{const t=e.columnByDataField[a.action];n=e.localize("propertyUpdated",{value:t?"<strong>"+t.label+"</strong>":"<strong>"+a.action+"</strong>"})}i+='<div class="history-row">';const o=t=>{const a=t?t.image:null;let l=t?t.name||t.id:e.localize("guestUser");const i=a?"image":"",n=a?`background-image: url('${a}');`:"";return e._currentUser.info&&t.id===e._currentUser.info.id&&(""!==e.locale&&"en"!==e.locale||(l="You")),{image:n,label:l,cssClass:i}};let s="";if(void 0!==a.user){const t=o(e.users.find((e=>e.id===a.user)));i+=`<div class="history-indent"><div class="user-icon smart-icon ${t.cssClass}" style="${t.image}"></div></div>`,s=`<div class="history-header"><div class="user-name">${t.label}</div><div class="time">${e._getDateFormat(new Smart.Utilities.DateTime(a.date).toDate())}</div></div>`}else i+='<div class="history-indent"><div class="user-icon smart-icon"></div></div>',s='<div class="history-header"><div class="user-name"></div><div class="time"></div></div>';if(i+='<div class="history-main">',i+=s,i+=`<div class="history-body"><div class="title">${n}</div>`,"created"!==a.action){let t=a.details.oldValue,l=a.details.value;if("user"===a.action){const a=e.users.find((e=>e.id===t||e.id===parseFloat(t))),i=e.users.find((e=>e.id===l||e.id===parseFloat(l)));a?t=a.name:(t="",t||(t=e.localize("unassigned"))),i?l=i.name:(l="",l||(l=e.localize("unassigned")))}if("subtasks"===a.action){let t=[];"string"==typeof a.details.value?a.details.value.split(",").forEach((e=>{e.indexOf(": Y")>=0&&t.push(e)})):t=a.details.value.filter((e=>e.completed)),e._kanban?i+=`<span class="detail">${e._kanban.localize("taskSubtasksCompleted",{value:t.length+"/"+a.details.value.length})}</span>`:i+=`<span class="detail">${e.localize("completed",{value:t.length})}</span>`}else{t&&"object"==typeof t&&t instanceof Date&&(t=e._getDateFormat(t)),l&&"object"==typeof l&&l instanceof Date&&(l=e._getDateFormat(l));let n=e.columnByDataField[a.action];if(n||(n=e.columnByDataField["task"+a.action.substring(0,1).toUpperCase()+a.action.substring(1)]),"user"===a.action&&(n=e.columnByDataField.taskUserId),n&&n.editor&&n.editor.dataSource){for(let e=0;e<n.editor.dataSource.length;e++){const a=n.editor.dataSource[e];a.value===t&&(t=a.label),a.value===l&&(l=a.label)}t||(t=e.localize("unassigned")),l||(l=e.localize("unassigned"))}let o="";n&&n.label&&(o="<strong>"+n.label+"</strong>"),n&&"date"===n.dataType?(t&&"string"==typeof t&&(t=e._getDateFormat(new Date(t))),l&&"string"==typeof l&&(l=e._getDateFormat(new Date(l)))):(t&&"string"==typeof t&&(t=e._fromHTMLEntities(t)),l&&"string"==typeof l&&(l=e._fromHTMLEntities(l))),i+=t?`<div class="detail">${e.localize("range",{column:o,oldValue:"<i>"+t+"</i>",newValue:"<i>"+l+"</i>"})}</div>`:`<div class="detail">${e.localize("nullRange",{column:o,oldValue:"<i>"+t+"</i>",newValue:"<i>"+l+"</i>"})}</div>`}}else i+=`<div>${a.details.value}</div>`;i+="",i+="</div>",i+="</div>\n </div>"}i+="",a.innerHTML=i,setTimeout((()=>{a.scrollTop=a.scrollHeight}))}_createComment(e){const t=this,a=t.users.find((t=>t.id===e.userId));if(!a)return;const l=document.createElement("div"),i=a?a.name||a.id:t.localize("guestUser"),n=a.image?a.image:"";let o=a?a.name:t.localize("guestUser");t._currentUser.info&&a.id===t._currentUser.info.id&&(""!==t.locale&&"en"!==t.locale||(o="You")),e.text&&/<.+?>/.test(e.text)&&e.text.replace&&("all"===t.dataSourceSettings.sanitizeHTML?e.text=e.text.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/'/g,"&#39;").replace(/"/g,"&quot;"):"blackList"===t.dataSourceSettings.sanitizeHTML&&(e.text=window.Smart.Utilities.Core.escapeHTML(e.text)));let s=e.text;if(s.indexOf("@")>=0)for(let e=0;e<t.users.length;e++){const a=t.users[e];if(s.indexOf("@"+a.name)>=0){let e=`<div style="border:1px solid var(--smart-border); position:relative; top: -3px; border-radius: 15px; padding-right: 6px; background: var(--smart-surface); align-items: center; display: inline-flex;"><div class="user-icon smart-icon" role="img" aria-label="Icon of user ${a.name}"></div><span>${a.name}</span></div>`;a.image&&(e=`<div style="border:1px solid var(--smart-border); position:relative; top: -3px; border-radius: 15px; padding-right: 6px; background: var(--smart-surface); align-items: center; display: inline-flex;"><div style="width: 24px; height: 24px; background-image: url('${a.image}');" class="image user-icon smart-icon" role="img" aria-label="Icon of user ${a.name}"></div><span>${a.name}</span></div>`),s=s.replaceAll("@"+a.name,e)}}l.className="comment",l.setAttribute("role","listitem");let r=e.time?e.time:"";if(""!==r){r=new Smart.Utilities.DateTime(e.time);const a=((new Date).getTime()-r.toDate().getTime())/1e3,l=Math.floor(Math.abs(a));r=""!==t.locale&&"en"!==t.locale?r.toString("dd/MM/yyyy hh:mm"):0===l?"now":l<60?l+"s ago":l<3600?Math.floor(l/60)+"m ago":l<86400?Math.floor(l/3600)+"h ago":r.toString("dd/MM/yyyy hh:mm")}if(l.innerHTML=`<div class="comment-indent" role="presentation">\n<div class="user-icon smart-icon" role="img" aria-label="Icon of user ${i}"></div>\n</div>\n<div class="comment-main" role="presentation">\n<div class="comment-header" role="presentation">\n <div class="user-name" aria-label="User name">${o}</div>\n <div class="edit-button${t._currentUser.info&&a.id===t._currentUser.info.id&&t._currentUser.allowComment?" enabled":""}" role="button" aria-haspopup="menu" aria-label="Comment settings"></div>\n <div class="remove-button${t._currentUser.info&&a.id===t._currentUser.info.id&&t._currentUser.allowComment?" enabled":""}" role="button" aria-haspopup="menu" aria-label="Comment settings"></div>\n <div class="time" aria-label="Comment time">${r}</div>\n</div>\n<div class="comment-body" aria-label="Comment text">${s||""}</div >\n</div>`,n){const e=l.querySelector(".user-icon");e.style.backgroundImage=`url('${n}')`,e.classList.add("image")}l.comment=e;const d=l.querySelector(".remove-button");d.comment=e,d.element=l,e.userId!==t._currentUser.info.id&&d.classList.add("smart-visibility-hidden");const c=l.querySelector(".edit-button");return c.comment=e,c.element=l,e.userId!==t._currentUser.info.id&&c.classList.add("smart-visibility-hidden"),l}_openSummaryRowDialog(e){const t=this,a=t._summaryRowDialog||t._createDialog(),l="{{message}}"===t.editing.dialog.header?t.localize("summary"):t.editing.dialog.header;if(a.header.innerHTML=l,!a.listBox){const e=document.createElement("smart-list-box");e.selectionMode="checkBox",e.style.borderColor="transparent",a.content.innerHTML="",a.listBox=e}const i=a.listBox;a.summaryValueElement&&a.summaryValueElement.classList.remove("summary-chooser");const n=e.element.querySelector(".summary-value");if(!n)return;n.classList.add("summary-chooser"),a.summaryValueElement=n;let o=[];a.dataField=e.column.dataField,"string"===e.column.dataType?(o=[{label:t.localize("countSummary"),value:"count"},{label:t.localize("blankSummary"),value:"blank"},{label:t.localize("filledSummary"),value:"filled"},{label:t.localize("uniqueSummary"),value:"unique"}],e.column.editor&&e.column.editor.dataSource&&e.column.editor.singleSelect&&o.push({label:t.localize("statusSummary"),value:"status"})):o="boolean"===e.column.dataType||"any"===e.column.dataType?[{label:t.localize("countSummary"),value:"count"},{label:t.localize("blankSummary"),value:"blank"},{label:t.localize("filledSummary"),value:"filled"}]:"date"===e.column.dataType?[{label:t.localize("countSummary"),value:"count"},{label:t.localize("blankSummary"),value:"blank"},{label:t.localize("filledSummary"),value:"filled"},{label:t.localize("uniqueSummary"),value:"unique"}]:[{label:t.localize("countSummary"),value:"count"},{label:t.localize("minSummary"),value:"min"},{label:t.localize("maxSummary"),value:"max"},{label:t.localize("sumSummary"),value:"sum"},{label:t.localize("avgSummary"),value:"avg"}],i.dataSource=o,i.style.position="absolute",i.style.visibility="hidden",i.style.height="auto",t.isInShadowDOM?t.getRootNode().appendChild(i):document.body.appendChild(i);const s=e.column;s.summary&&s.summary.forEach((e=>{i.select(e)}));const r=i.offsetHeight;a.column=s,a.content.appendChild(i),a.classList.add("smart-grid-dialog-summary"),a.header.parentElement.classList.add("smart-hidden"),a.footer.classList.add("smart-hidden"),i.style.visibility="",i.style.position="",i.style.width="100%",t._summaryRowDialog||(a.btnConfirm.innerHTML=t.localize("apply"),a.btnCancel.innerHTML=t.localize("cancel"),a.style.width=a.style.minWidth="120px",a.onOpen=function(){t.editing.dialog.visible=!0},a.onClose=function(){t.editing.dialog.visible=!1,a.summaryValueElement&&a.summaryValueElement.classList.remove("summary-chooser")},a.btnCancel.onclick=function(){a.close()},a.btnClose.onclick=function(){a.close()},a.btnConfirm.onclick=function(){const e=a.column.summary;a.column.summary=i.selectedValues,t.$.fireEvent("columnSummaryChange",{column:a.column,dataField:s.dataField,oldSummary:[...e],summary:[...a.column.summary]}),a.close(),t._calculateSummary(),t._recycle(!1)},a.confirm=function(){a.btnConfirm.click()},a.onkeydown=function(e){"Escape"===e.key&&a.close()},t._summaryRowDialog=a);const d=e.element,c=t.offset(d),u=t.offset(t);let m=d.offsetWidth+c.left-u.left-120;m<0&&(m=c.left-u.left),a.open(m,c.top-u.top-r-0),setTimeout((function(){a.btnConfirm.focus()}),100)}_openTextAreaDialog(e,t,a){const l=this;delete l._dialogTextArea;const i=l._dialogTextArea||l._createDialog();if(i.header.innerHTML=e.label,i.column=e,i.classList.add("smart-grid-textarea-dialog"),i.style.minWidth="250px",i.style.minHeight="250px",i.style.zIndex=99999,i.textarea=t,"richText"!==e.template?i.initialValue=t.value:i.initialValue=t.getHTML(),i.cell=a,!l._dialogTextArea){i.modal=!0,i.btnConfirm.innerHTML=l.localize("dialogEditButtonSave"),i.btnCancel.innerHTML=l.localize("dialogEditButtonCancel"),i.onOpen=function(){const t=i.querySelector("smart-text-area");t.value=i.textarea.value,t.onchange=t.oninput=()=>{setTimeout((()=>{"richText"===e.template?i.textarea.setHTML(t.getHTML()):i.textarea.value=t.value}))},l.editing.enabled&&setTimeout((()=>{t.focus()}),250)},i.onClose=function(){};const t=()=>{const e=document.querySelector(".smart-grid-text-area-dialog");e&&e.remove()};i.btnCancel.onclick=function(){if(i.close(),l.editing.dialog.enabled)return i.textarea.value=i.initialValue,void t();l.cancelEdit(),t()},i.btnClose.onclick=function(){if(i.close(),l.editing.dialog.enabled)return i.textarea.value=i.initialValue,void t();l.cancelEdit(),t()},i.btnConfirm.onclick=function(){if(i.close(),l.editing.dialog.enabled)return t(),void i.cell.editor.instance.setValue(i.textarea.value);i.cell.editor.instance.setValue(i.textarea.value),t(),l.endEdit()},i.onkeydown=function(e){"Escape"===e.key&&i.close()},l._dialogTextArea=i;const a=document.createElement("smart-text-area");a.classList.add("smart-text-area"),a.resize="both","richText"===e.template&&(a.richText=!0),a.users=l.users,a.style.resize="both",a.minWidth=350,a.style.minWidth="350px",a.style.minHeight="250px",a.style.width="450px",a.style.height="400px",a.minHeight=250,i.input=a,i.content.appendChild(a)}const n=l.offset(t),o=l.offset(l);i.open(n.left-o.left+e.computedWidth,n.top-o.top),setTimeout((function(){if("auto"!==i.style.height){const e=i.input;e.style.width="450px",e.style.height="400px",i.style.height="auto",i.style.width="auto",e.resize="both"}if(i.offsetHeight+n.top-o.top>window.innerHeight&&(i.style.top=o.top+"px",i.style.left=o.left+"px",i.style.width=l.offsetWidth+"px",i.style.height=l.offsetHeight+"px",i.input.style.width=l.offsetWidth-20+"px",i.input.style.height=l.offsetHeight-20+"px",i.input.resize="none"),n.left-o.left+e.computedWidth+i.offsetWidth>window.innerWidth){let t=n.left-o.left+e.computedWidth-i.offsetWidth;i.style.left=Math.max(t,0)+"px"}i.btnConfirm.focus()}),100)}_openDescriptionDialog(e,t){const a=this,l=a._dialogDescription||a._createDialog(),i=a.localize("dialogDescriptionHeader",{value:e.label});if(l.header.innerHTML=i,l.column=e,l.command=t,l.classList.add("smart-grid-dialog-add-column"),!a._dialogDescription){l.modal=!0,l.btnConfirm.innerHTML=a.localize("dialogEditButtonConfirm"),l.btnCancel.innerHTML=a.localize("dialogEditButtonCancel"),l.onOpen=function(){const e=l.querySelector("smart-input");"duplicate"!==t&&setTimeout((()=>{e.select()}),250)},l.onClose=function(){},l.btnCancel.onclick=function(){l.close()},l.btnClose.onclick=function(){l.close()},l.btnConfirm.onclick=function(){const e=l.querySelector("smart-input");switch(l.command){case"duplicate":0===e.selectedIndex?a.duplicateCommand(l.column,null,!0):a.duplicateCommand(l.column,null,!1);break;case"rename":l.column.label=e.value;break;case"editDescription":l.column.description=e.value}l.close()},l.onkeydown=function(e){"Escape"===e.key&&l.close()},a._dialogDescription=l;const e=document.createElement("smart-input");e.classList.add("underlined"),e.dataSource="duplicate"!==t?[]:[{label:a.localize("duplicateCells"),value:"cells"},{label:a.localize("duplicateSettings"),value:"settings"}],l.content.appendChild(e)}const n=e.element,o=a.offset(n),s=a.offset(a);l.open(o.left-s.left,o.top+n.offsetHeight-s.top);const r=l.querySelector("smart-input");switch(r.selectedIndex=0,r.readonly=!0,r.dropDownButtonPosition="right",t){case"rename":r.value=e.label;break;case"editDescription":r.value=e.description}setTimeout((function(){l.btnConfirm.focus()}),100)}_openDeleteRowDialog(e,t){const a=this;if(!a.editing.deleteDialog.enabled)return!1;const l=a._dialogDelete||a._createDialog(),i="{{message}}"===a.editing.dialog.header?a.localize("dialogDeleteHeader",{value:e.visibleIndex+1}):a.editing.dialog.header;l.header.innerHTML=i,l.content.innerHTML=a.localize("dialogDeleteContent"),l.row=e,a._dialogDelete||(l.modal=!0,l.btnConfirm.innerHTML=a.localize("dialogDeleteButtonConfirm"),l.btnCancel.innerHTML=a.localize("dialogDeleteButtonCancel"),l.onOpen=function(){a.editing.dialog.visible=!0},l.onClose=function(){a.editing.dialog.visible=!1},l.btnCancel.onclick=function(){l.close()},l.btnClose.onclick=function(){l.close()},l.btnConfirm.onclick=function(){t(l.row),l.close()},l.onkeydown=function(e){"Escape"===e.key&&l.close()},a._dialogDelete=l),l.open(),setTimeout((function(){l.btnConfirm.focus()}),100)}_getTypesList(){const e=this,t=[{value:"string",prefix:'<span class="smart-grid-icon visible smart-icon-font"></span>',label:e.localize("dialogAddColumnTypeText")},{value:"multiText",prefix:'<span class="smart-grid-icon visible smart-icon-fontsize"></span>',label:e.localize("dialogAddColumnTypeMultilineText")},{value:"image",prefix:'<span class="smart-grid-icon visible smart-icon-image"></span>',label:e.localize("dialogAddColumnTypeImage")},{value:"number",prefix:'<span class="smart-grid-icon visible smart-icon-number"></span>',label:e.localize("dialogAddColumnTypeNumber")},{value:"select",prefix:'<span class="smart-grid-icon visible smart-icon-sort-down"></span>',label:e.localize("dialogAddColumnTypeSelect")},{value:"multiSelect",prefix:'<span class="smart-grid-icon visible smart-icon-list-unordered"></span>',label:e.localize("dialogAddColumnTypeMultipleSelect")},{value:"boolean",prefix:'<span class="smart-grid-icon visible smart-icon-check-squared"></span>',label:e.localize("dialogAddColumnTypeCheckBox")},{value:"attachment",prefix:'<span class="smart-grid-icon visible smart-icon-docs"></span>',label:e.localize("dialogAddColumnTypeAttachment")},{value:"date",prefix:'<span class="smart-grid-icon visible smart-icon-calendar"></span>',label:e.localize("dialogAddColumnTypeDate")},{value:"duration",prefix:'<span class="smart-grid-icon visible smart-icon-calendar"></span>',label:e.localize("dialogAddColumnTypeDuration")},{value:"time",prefix:'<span class="smart-grid-icon visible smart-icon-clock"></span>',label:e.localize("dialogAddColumnTypeTime")},{value:"createdTime",prefix:'<span class="smart-grid-icon visible smart-icon-clock"></span>',label:e.localize("dialogAddColumnTypeCreatedTime")},{value:"updatedTime",prefix:'<span class="smart-grid-icon visible smart-icon-clock"></span>',label:e.localize("dialogAddColumnTypeLastUpdatedTime")},{value:"createdBy",prefix:'<span class="smart-grid-icon visible smart-icon-user"></span>',label:e.localize("dialogAddColumnTypeCreatedBy")},{value:"updatedBy",prefix:'<span class="smart-grid-icon visible smart-icon-user"></span>',label:e.localize("dialogAddColumnTypeLastUpdatedBy")},{value:"collaborator",prefix:'<span class="smart-grid-icon visible smart-icon-user"></span>',label:e.localize("dialogAddColumnTypeCollaborator")},{value:"slider",prefix:'<span class="smart-grid-icon visible smart-icon-number"></span>',label:e.localize("dialogAddColumnTypeSlider")},{value:"formula",prefix:'<span class="smart-grid-icon visible smart-icon-math"></span>',label:e.localize("dialogAddColumnTypeFormula")},{value:"autoNumber",prefix:'<span class="smart-grid-icon visible smart-icon-list-ordered"></span>',label:e.localize("dialogAddColumnTypeAutoNumber")},{value:"url",prefix:'<span class="smart-grid-icon visible smart-icon-link"></span>',label:e.localize("dialogAddColumnTypeURL")},{value:"email",prefix:'<span class="smart-grid-icon visible smart-icon-mail"></span>',label:e.localize("dialogAddColumnTypeEmail")},{value:"phone",prefix:'<span class="smart-grid-icon visible smart-icon-phone"></span>',label:e.localize("dialogAddColumnTypePhone")},{value:"password",prefix:'<span class="smart-grid-icon visible smart-icon-lock"></span>',label:e.localize("dialogAddColumnTypePassword")},{value:"rating",prefix:'<span class="smart-grid-icon visible smart-icon-star"></span>',label:e.localize("dialogAddColumnTypeRating")}];if(e.dataSourceSettings.relations&&e.dataSourceSettings.relations.length&&t.splice(17,0,{value:"relationId",prefix:'<span class="smart-grid-icon visible smart-icon-table-alt"></span>',label:e.localize("dialogAddColumnTypeRowLink")}),e.header.visible&&e.header.buttons.indexOf("views")>=0){const a={value:"progress",prefix:'<span class="smart-grid-icon visible smart-icon-number"></span>',label:e.localize("dialogAddColumnTypeProgress")},l={value:"priority",prefix:'<span class="smart-grid-icon visible smart-icon-sort-down"></span>',label:e.localize("dialogAddColumnTypePriority")},i={value:"status",prefix:'<span class="smart-grid-icon visible smart-icon-sort-down"></span>',label:e.localize("status")},n={value:"tags",prefix:'<span class="smart-grid-icon visible smart-icon-list-unordered"></span>',label:e.localize("dialogAddColumnTypeTags")},o={value:"checklist",prefix:'<span class="smart-grid-icon visible smart-icon-list-ordered"></span>',label:e.localize("dialogAddColumnTypeChecklist")},s={value:"color",prefix:'<span class="smart-grid-icon visible smart-icon-color-background"></span>',label:e.localize("dialogAddColumnTypeColor")};t.push(a),t.push(l),t.push(n),t.push(o),t.push(s),t.push(i)}return t}_getAddStackColumnDialogTemplate(){const e=this,t=[];let a=!1,l="";for(let i=0;i<e.columns.length;i++){const n=e.columns[i];(n.statusColumn||"taskStatus"===n.dataField||"taskStatus"===n._dataField||n.editor&&n.editor.dataSource&&n.editor.dataSource.length&&n.editor.singleSelect)&&(t.push({label:n.label,value:n.dataField}),e._stackedBy===n.dataField&&(t[t.length-1].checked=!0,a=!0,l=t[t.length-1].label))}const i=t.concat([{value:"blank",label:e.localize("kanbanNone")},{value:"basic",label:e.localize("kanbanBasic")}]);return a||(i[0].checked=!0,l=i[0].label),[{bind:"kanban",name:"kanban",type:"radio",label:2===i.length?e.localize("kanbanNoneDescription"):e.localize("kanbanDescription",{column:l}),filter:"kanban",options:i},{bind:"kanbanNotes",name:"kanbanNotes",type:"label",label:e.localize("dialogAddColumnStatusNotes"),filter:"kanban"},{bind:"name",type:"input",label:e.localize("dialogAddColumnName"),filter:"any",placeholder:e.localize("dialogAddColumnNamePlaceholder"),info:e.localize("dialogAddColumnNameInfo")},{bind:"allowColorItems",type:"boolean",label:e.localize("dialogAddColumnColorItems"),filter:"list, collaborator",value:!0,info:""},{bind:"options",name:"listitems",type:"items",label:e.localize("dialogAddColumnListItems"),filter:"list",info:""}]}_getAddColumnDialogTemplate(){const e=this,t=(new Date).getFullYear().toString(),a=new Date(t,6,30);return[{bind:"kanban",name:"kanban",type:"radio",label:e.localize("kanbanNoneDescription"),filter:"kanban",options:[{value:"blank",checked:!0,label:e.localize("kanbanNone")},{value:"basic",label:e.localize("kanbanBasic")}]},{bind:"kanbanNotes",name:"kanbanNotes",type:"label",label:e.localize("dialogAddColumnStatusNotes"),filter:"kanban"},{bind:"name",type:"input",label:e.localize("dialogAddColumnName"),filter:"any",placeholder:e.localize("dialogAddColumnNamePlaceholder"),info:e.localize("dialogAddColumnNameInfo")},{bind:"type",name:"typeslist",type:"dropDownList",filter:"any",label:e.localize("dialogAddColumnType"),icon:"smart-icon-font",options:e._getTypesList(),info:e.localize("dialogAddColumnTypeInfo")},{bind:"dateFormat",name:"dateformat",type:"dropDownList",label:e.localize("dialogAddColumnDateFormat"),options:[{value:"M/d/yyyy",label:e.localize("dialogAddColumnDateFormatShort")+" ("+new Smart.Utilities.DateTime(a).toString("d")+")"},{value:"dddd, MMMM dd, yyyy",label:e.localize("dialogAddColumnDateFormatLong")+" ("+new Smart.Utilities.DateTime(a).toString("D")+")"},{value:"yyyy-MM-ddTHH:mm:ss.sssZ",label:e.localize("dialogAddColumnDateFormatISO")+" ("+new Smart.Utilities.DateTime(a).toString("ISO8601")+")"},{value:"d/M/yyyy",label:e.localize("dialogAddColumnDateFormatEU")+" (30/7/"+t+")"},{value:"yyyy-MM-dd",label:e.localize("dialogAddColumnDateFormatAS")+" ("+t+"-30-07)"},{value:"MMMM, dd, yyyy",label:e.localize("dialogAddColumnDateFormatFull")+" (July, 30, "+t+")"}],filter:"date",info:e.localize("dialogAddColumnDateFormatInfo")},{bind:"timeFormat",name:"timeformat",type:"dropDownList",label:e.localize("dialogAddColumnTimeFormat"),filter:"time",width:"50%",options:[{value:"hh:mm tt",label:"12 "+e.localize("dialogAddColumnTimeFormatHour")},{value:"HH:mm",label:"24 "+e.localize("dialogAddColumnTimeFormatHour")}],info:e.localize("dialogAddColumnTimeFormatInfo")},{bind:"allowTimeFormat",type:"boolean",label:e.localize("dialogAddColumnAllowTimeFormat"),filter:"date",width:"50%",value:!1,info:""},{bind:"allowCustomDateSeparator",type:"boolean",label:e.localize("dialogAddColumnCustomDateSeparator"),filter:"date",width:"50%",value:!1,info:""},{bind:"dateFormatSeparator",name:"dateFormatSeparator",type:"radio",label:"",filter:"date",width:"100%",columns:3,options:[{value:"/",label:e.localize("dialogAddColumnDateFormatSlash")+" (/)"},{value:"-",label:e.localize("dialogAddColumnDateFormatHyphen")+" (-)"},{value:".",label:e.localize("dialogAddColumnDateFormatDot")+" (.)"}]},{bind:"numberFormat",name:"numberFormat",type:"dropDownList",label:e.localize("dialogAddColumnNumberFormat"),filter:"number",options:[{value:{style:"decimal",maximumFractionDigits:0},label:e.localize("dialogAddColumnNumberFormatInteger")+" 1,000"},{value:{style:"decimal",minimumFractionDigits:2},label:e.localize("dialogAddColumnNumberFormatNumber")+" 1,000.12"},{value:{style:"percent",minimumFractionDigits:2},label:e.localize("dialogAddColumnNumberFormatPercent")+" 10.12%"},{value:{style:"percent",maximumFractionDigits:0,minimumFractionDigits:0},label:e.localize("dialogAddColumnNumberFormatPercentRounded")+" 10%"},{value:{style:"decimal",notation:"scientific"},label:e.localize("dialogAddColumnNumberFormatScientific")+" 1.01E+03"},{value:{style:"decimal",notation:"engineering"},label:e.localize("dialogAddColumnNumberFormatEngineering")+" 34.284 x 10^9"},{value:{style:"currency",currency:e.messages[e.locale].calendar.currency,currencySign:"accounting"},label:e.localize("dialogAddColumnNumberFormatAccounting")+" $(1,000.12)"},{value:{style:"unit",unit:"kilogram"},label:e.localize("dialogAddColumnNumberFormatUnit")+" 10.12 kg"},{value:{style:"currency",currency:e.messages[e.locale].calendar.currency},label:e.localize("dialogAddColumnNumberFormatCurrency")+" $1,000.12"},{value:{style:"currency",currency:e.messages[e.locale].calendar.currency,maximumFractionDigits:0,minimumFractionDigits:0},label:e.localize("dialogAddColumnNumberFormatCurrencyRounded")+" $1,000"}],required:!1,info:e.localize("dialogAddColumnNumberFormatInfo")},{bind:"currency",name:"currency",type:"dropDownList",filter:"number",required:!1,options:e._getCurrencies(),label:e.localize("dialogAddColumnNumberFormatCurrency"),info:e.localize("dialogAddColumnNumberFormatCurrencyInfo")},{bind:"unit",name:"unit",type:"dropDownList",filter:"number",required:!1,options:[{value:"acre",label:e.localize("dialogAddColumnNumberFormatUnitAcre")},{value:"percent",label:e.localize("dialogAddColumnNumberFormatUnitPercent")},{value:"degree",label:e.localize("dialogAddColumnNumberFormatUnitDegree")},{value:"megabyte",label:e.localize("dialogAddColumnNumberFormatUnitMegaByte")},{value:"centimeter",label:e.localize("dialogAddColumnNumberFormatUnitCentimeter")},{value:"meter",label:e.localize("dialogAddColumnNumberFormatUnitMeter")},{value:"squaremeter",label:e.localize("dialogAddColumnNumberFormatUnitMeter")+"²"},{value:"cubicmeter",label:e.localize("dialogAddColumnNumberFormatUnitMeter")+"³"},{value:"kilometer",label:e.localize("dialogAddColumnNumberFormatUnitKilometer")},{value:"mile",label:e.localize("dialogAddColumnNumberFormatUnitMile")},{value:"celsius",label:e.localize("dialogAddColumnNumberFormatUnitCelsius")},{value:"fahrenheit",label:e.localize("dialogAddColumnNumberFormatUnitFahrenheit")},{value:"kilogram",label:e.localize("dialogAddColumnNumberFormatUnitKilogram")},{value:"pound",label:e.localize("dialogAddColumnNumberFormatUnitPound")},{value:"liter",label:e.localize("dialogAddColumnNumberFormatUnitLiter")},{value:"gallon",label:e.localize("dialogAddColumnNumberFormatUnitGallon")},{value:"second",label:e.localize("dialogAddColumnNumberFormatUnitSecond")},{value:"minute",label:e.localize("dialogAddColumnNumberFormatUnitMinute")},{value:"hour",label:e.localize("dialogAddColumnNumberFormatUnitHour")},{value:"day",label:e.localize("dialogAddColumnNumberFormatUnitDay")},{value:"week",label:e.localize("dialogAddColumnNumberFormatUnitWeek")},{value:"month",label:e.localize("dialogAddColumnNumberFormatUnitMonth")},{value:"year",label:e.localize("dialogAddColumnNumberFormatUnitYear")}],label:e.localize("dialogAddColumnNumberFormatUnit"),info:e.localize("dialogAddColumnNumberFormatUnitInfo")},{bind:"allowThousandsSeparator",name:"allowThousandsSeparator",type:"boolean",label:e.localize("dialogAddColumnNumberFormatSeparator"),filter:"number",value:!0,info:""},{bind:"minLength",name:"minlength",width:"50%",type:"number",filter:"text",required:!1,label:e.localize("dialogAddColumnMinLength"),info:e.localize("dialogAddColumnMinLengthInfo")},{bind:"maxLength",name:"maxlength",width:"50%",filter:"text",type:"number",required:!1,label:e.localize("dialogAddColumnMaxLength"),info:e.localize("dialogAddColumnMaxLengthInfo")},{bind:"minValue",name:"minvalue",width:"50%",filter:"number",type:"number",required:!1,label:e.localize("dialogAddColumnMinValue"),info:e.localize("dialogAddColumnMinValueInfo")},{bind:"maxValue",name:"maxvalue",width:"50%",filter:"number",type:"number",required:!1,label:e.localize("dialogAddColumnMaxValue"),info:e.localize("dialogAddColumnMaxValueInfo")},{bind:"minDateTime",name:"mindatetime",type:"datetime",filter:"date",width:"50%",label:e.localize("dialogAddColumnMinDate"),info:e.localize("dialogAddColumnMinDateInfo")},{bind:"maxDateTime",name:"maxdatetime",type:"datetime",width:"50%",filter:"date",label:e.localize("dialogAddColumnMaxDate"),info:e.localize("dialogAddColumnMaxDateInfo")},{bind:"deadline",name:"deadline",type:"dropDownList",label:e.localize("dialogAddColumnTypeDueDateSettings"),info:e.localize("dialogAddColumnTypeDueDateSettingsInfo"),filter:"date",options:[{value:"",label:e.localize("dialogAddColumnTypeNone")},{value:"dueDate",label:e.localize("dialogAddColumnTypeDueDate")},{value:"startDate",label:e.localize("dialogAddColumnTypeStartDate")}]},{bind:"deadlineStatus",name:"deadlineStatus",type:"dropDownList",label:e.localize("dialogAddColumnTypeStatus"),info:e.localize("dialogAddColumnTypeStatusInfo"),filter:"date",options:[]},{bind:"deadlineDueDate",name:"deadlineDueDate",type:"dropDownList",label:e.localize("dialogAddColumnTypeDueDate"),info:"",filter:"date",options:[]},{bind:"allowColorItems",type:"boolean",label:e.localize("dialogAddColumnColorItems"),filter:"list, collaborator",value:!0,info:""},{bind:"allowCheckItems",type:"boolean",filter:"hidden",value:!1,label:e.localize("dialogAddColumnCheckItems"),info:""},{bind:"allowMultipleCollaborators",type:"boolean",filter:"collaborator",value:!1,label:e.localize("dialogAddColumnMultipleCollaborators"),info:e.localize("dialogAddColumnMultipleCollaboratorsInfo")},{bind:"options",name:"listitems",type:"items",label:e.localize("dialogAddColumnListItems"),filter:"list",info:""},{bind:"users",name:"users",type:"items",label:e.localize("dialogAddColumnListItems"),filter:"collaborator",info:""},{bind:"formula",type:"formula",filter:"formula",info:e.localize("dialogAddColumnFormulaInfo"),label:e.localize("dialogAddColumnFormula")},{bind:"relationMultiField",name:"relationMultiField",type:"boolean",value:!1,filter:"relationId",label:e.localize("dialogAddColumnLinkSelect")},{bind:"relationId",name:"relationId",type:"relationId",label:e.localize("dialogAddColumnLinkListItems"),filter:"relationId",info:""},{bind:"description",type:"input",label:e.localize("dialogAddColumnDescription"),filter:"any",placeholder:e.localize("dialogAddColumnDescriptionPlaceholder"),info:e.localize("dialogAddColumnDescriptionInfo")},{name:"align",bind:"cellsAlign",type:"dropDownList",label:e.localize("dialogAddColumnAlign"),required:!1,options:[{value:"left",label:e.localize("dialogAddColumnAlignLeft")},{value:"right",label:e.localize("dialogAddColumnAlignRight")},{value:"center",label:e.localize("dialogAddColumnAlignCenter")}],filter:"any",info:e.localize("dialogAddColumnAlignInfo")},{bind:"defaultString",name:"defaultString",type:"input",filter:"text",required:!1,label:e.localize("dialogAddColumnDefault")},{bind:"defaultNumber",name:"defaultNumber",type:"number",filter:"number",required:!1,label:e.localize("dialogAddColumnDefault")},{bind:"defaultDate",name:"defaultDate",type:"dropDownList",label:e.localize("dialogAddColumnDefault"),filter:"date",options:[{value:"current",label:e.localize("dialogAddColumnDefaultDateCurrent")},{value:"specific",label:e.localize("dialogAddColumnDefaultDateSpecific")}]},{bind:"defaultDateValue",name:"defaultDateValue",type:"datetime",filter:"date",label:e.localize("placeholderValue")},{bind:"setDefaultValue",type:"boolean",label:e.localize("dialogAddColumnDefault"),width:"50%",filter:"any",value:!1,info:""},{bind:"allowResize",type:"boolean",filter:"any",width:"50%",label:e.localize("dialogAddColumnResizable"),info:e.localize("dialogAddColumnResizableInfo")},{bind:"allowRichText",type:"boolean",filter:"multiText",width:"50%",value:!1,label:e.localize("dialogAddColumnFormatting"),info:""},{bind:"required",type:"boolean",width:"50%",filter:"any",value:!1,label:e.localize("dialogAddColumnRequired"),info:e.localize("dialogAddColumnRequiredInfo")},{bind:"allowSort",type:"boolean",width:"50%",filter:"any",label:e.localize("dialogAddColumnSortable"),info:e.localize("dialogAddColumnSortableInfo")},{bind:"allowFilter",type:"boolean",align:"left",width:"50%",filter:"any",label:e.localize("dialogAddColumnFilterable"),info:e.localize("dialogAddColumnFilterableInfo")},{bind:"allowEdit",type:"boolean",width:"50%",filter:"any",label:e.localize("dialogAddColumnEditable"),info:e.localize("dialogAddColumnEditableInfo")}]}_getKanbanFields(){return["startDate","dueDate","progress","checklist","priority","tags","name","color","description","status"]}_addColumnDialogShowHideEditors(e){const t=this,a=e.editColumn,l=e.querySelector('[bind="type"]'),i=l?l.querySelector("smart-input"):null,n=l?i.getSelectedItem().value:"kanban",o=e.querySelectorAll(".smart-grid-dialog-editor"),s=t._getKanbanFields(),r=e.querySelector('[field-name="kanbanNotes"]');r&&("kanban"!==t.view?r.classList.add("smart-hidden"):r.classList.remove("smart-hidden"));const d=t=>{const a=e.querySelector('[field-name="defaultDate"]'),l=e.querySelector('[field-name="defaultDateValue"]');if(!t)return a.classList.add("smart-hidden"),void l.classList.add("smart-hidden");a.classList.remove("smart-hidden"),"specific"===t?(l.classList.remove("smart-hidden"),l.style.width="50%",l.style.float="left",a.style.width="50%",a.style.float="left",a.style.clear="both"):(l.classList.add("smart-hidden"),l.style.width="",l.style.float="",a.style.width="",a.style.float="")};let c=!!a;if(a){switch(e.columnType||n){case"createdTime":case"updatedTime":case"createdBy":case"updatedBy":case"autoNumber":case"image":case"progress":case"color":case"collaborator":case"attachment":c=!0;break;default:c=!1}"checklist"!==a.template&&"color"!==a.template||(c=!0),!1===a.allowTypeChange&&(c=!0)}for(let l=0;l<o.length;l++){const i=o[l],r=i.getAttribute("filter"),u=i.getAttribute("bind"),m=i.parentNode;if("deadlineStatus"!==u&&"deadlineDueDate"!==u)if(m.classList.add("smart-hidden"),"cellsAlign"===u&&("boolean"===n||"attachment"===n||"image"===n||"email"===n||"url"===n||"collaborator"===n||"createdBy"===n||"password"===n||"phone"===n||"createdTime"===n||"rating"===n||"updatedBy"===n||"updatedTime"===n||s.indexOf(n)>=0))m.classList.add("smart-hidden");else if("type"===u&&c)m.classList.add("smart-hidden");else if("allowEdit"!==u||!1!==t.editing.enabled&&"autoNumber"!==n&&"createdBy"!==n&&"updatedBy"!==n&&"createdTime"!==n&&"updatedTime"!==n)if("allowResize"!==u||"none"!==t.behavior.columnResizeMode)if("allowFilter"!==u||!1!==t.filtering.enabled)if("allowSort"!==u||!1!==t.sorting.enabled)if("required"!==u||!1!==t.editing.enabled&&("string"===n||"multiText"===n||"name"===n||"description"===n||"select"===n||"collaborator"===n||"multiSelect"===n||"select"===n||"priority"===n))if(a&&a.disabledDialogOptions&&a.disabledDialogOptions.length>0&&a.disabledDialogOptions.indexOf(u)>=0)m.classList.add("smart-hidden");else{if(a&&"kanban"===t.view){switch(u){case"options":case"allowColorItems":case"allowSort":case"allowFilter":case"align":case"cellsAlign":case"allowResize":case"allowEdit":m.classList.add("smart-hidden");continue}"kanban"===t.view&&"kanban"===r&&m.classList.remove("smart-hidden")}if("deadline"!==u)if("setDefaultValue"!==u){if(a&&a.editor&&a.editor.collaborator)switch(u){case"options":m.classList.add("smart-hidden");continue;case"users":m.classList.remove("smart-hidden");continue}if("name"!==u||"kanban"!==t.view)if("any"!==r)switch(n){default:case"text":"text"!==r&&"multiText"!==r||("multiText"===r&&"string"===n?m.classList.add("smart-hidden"):m.classList.remove("smart-hidden")),a&&"any"===a.dataType&&m.classList.add("smart-hidden");break;case"slider":case"number":if("number"===r&&m.classList.remove("smart-hidden"),"unit"===u||"currency"===u||"allowThousandsSeparator"===u){m.classList.add("smart-hidden");const t=e.querySelector('[field-name="allowThousandsSeparator"]'),a=e.querySelector('[field-name="numberFormat"]'),l=e.querySelector('[field-name="unit"]'),i=e.querySelector('[field-name="currency"]'),n=a.querySelector("smart-input"),o=()=>{const e=n.getSelectedItem();i.classList.add("smart-hidden"),t.classList.add("smart-hidden"),e&&"decimal"===e.value.style&&!e.value.notation&&t.classList.remove("smart-hidden"),e&&"unit"===e.value.style?l.classList.remove("smart-hidden"):e&&"currency"===e.value.style?i.classList.remove("smart-hidden"):l.classList.add("smart-hidden")};a.onchange=()=>{o()},o()}break;case"select":case"multiSelect":r.indexOf("list")>=0&&m.classList.remove("smart-hidden");break;case"collaborator":r.indexOf("collaborator")>=0&&m.classList.remove("smart-hidden");break;case"createdBy":case"updatedBy":case"autoNumber":case"createdTime":case"updatedTime":case"url":case"email":case"image":case"attachment":case"phone":case"password":case"progress":case"rating":case"checklist":case"priority":case"tags":case"name":case"description":case"assigned":case"status":case"color":case"boolean":if("status"===n||"priority"===n||"tags"===n){r.indexOf("list")>=0&&m.classList.remove("smart-hidden");break}break;case"time":{const t=e.querySelector('[field-filter="time"]');t.classList.remove("smart-hidden"),t.style.width="",t.style.float="";break}case"formula":"formula"===u&&m.classList.remove("smart-hidden");break;case"relationId":"relationId"!==u&&"relationMultiField"!==u||m.classList.remove("smart-hidden");break;case"duration":break;case"dueDate":case"startDate":case"date":{const t=e.querySelector('[field-name="dateFormat"]').querySelector(".smart-input").value;if("defaultDate"===u||"defaultDateValue"===u){const t=e.querySelector('[field-name="defaultDate"]'),l=e.querySelector('[field-name="defaultDateValue"]'),i=t.querySelector(".smart-input"),n=l.querySelector(".smart-input");a&&a.defaultValue?"today"===a.defaultValue?(i.selectedValues=["current"],n.value=null):(i.selectedValues=["specific"],n.value=a.defaultValue):(i.selectedValues=["current"],n.value=null),d(i.selectedValue)}"date"===r&&m.classList.remove("smart-hidden");const l=t=>{const a=e.querySelector('[field-filter="time"]'),l=e.querySelector('[field-name="dateFormat"]');t?(a.classList.remove("smart-hidden"),l.style.width="50%",l.style.float="left"):(a.classList.add("smart-hidden"),l.style.width="",l.style.float="")},n=t=>{const a=e.querySelector('[field-name="allowTimeFormat"]'),l=a.querySelector(".smart-grid-dialog-editor");t.indexOf("T")>=0?(a.classList.add("smart-hidden"),l.uncheck()):a.classList.remove("smart-hidden")},o=t=>{const a=e.querySelector('[field-name="dateFormatSeparator"]');t?a.classList.remove("smart-hidden"):a.classList.add("smart-hidden")};if("allowTimeFormat"===u){const e=i.querySelector(".smart-input").value;i.onchange=e=>{l(e)},l(e)}if("dateFormat"===u){const e=i.querySelector(".smart-input").value;i.onchange=e=>{n(e.detail.value)},n(e)}if("defaultDate"===u){const e=i.querySelector(".smart-input").value;i.onchange=e=>{d(e.detail.value)},d(e)}if("dateFormatSeparator"===u){const t=e.querySelector('[field-name="allowCustomDateSeparator"]').querySelector(".smart-input").value;o(t)}if("allowCustomDateSeparator"===u){t.indexOf("T")>=0&&t.indexOf("-")>0&&i.uncheck();const e=i.querySelector(".smart-input").value;i.onchange=e=>{o(e)},o(e)}n(t);break}}else m.classList.remove("smart-hidden");else{const e=t._getAddStackColumnDialogTemplate().find((e=>{if("kanban"===e.bind)return e}));e.options[e.options.length-1].checked||e.options[e.options.length-2].checked?i.classList.remove("smart-hidden"):i.classList.add("smart-hidden")}}else{switch(a&&a.defaultValue&&m.classList.remove("smart-hidden"),n){case"string":case"multiText":case"name":case"description":case"multiSelect":case"boolean":case"date":case"dueDate":case"startDate":case"collaborator":case"number":case"priority":case"status":case"select":m.classList.remove("smart-hidden");break;default:m.classList.add("smart-hidden")}const t=t=>{const a=e.querySelector('[bind="type"]'),l=a?a.querySelector("smart-input"):null,i=a?l.getSelectedItem().value:"kanban",n=e.querySelector('[field-name="defaultDate"]'),o=e.querySelector('[field-name="defaultNumber"]'),s=e.querySelector('[field-name="defaultString"]'),r=e.querySelector('[field-name="defaultDateValue"]'),c=e.querySelectorAll(".smart-default-item-container");n&&(n.classList.add("smart-hidden"),r.classList.add("smart-hidden")),o&&o.classList.add("smart-hidden"),s&&s.classList.add("smart-hidden");for(let e=0;e<c.length;e++)c[e].classList.add("smart-hidden");if(t)if("date"===i||"dueDate"===i||"startDate"===i){if(n){n.classList.remove("smart-hidden"),r.classList.remove("smart-hidden");const e=n.querySelector("smart-input").selectedValues;d(e&&e.length?e[0]:"current")}}else if("number"===i||"slider"===i)o&&o.classList.remove("smart-hidden");else if("string"===i||"multiText"===i||"name"===i||"description"===i)s&&s.classList.remove("smart-hidden");else for(let e=0;e<c.length;e++)c[e].classList.remove("smart-hidden")};i.onchange=e=>{t(e)};const l=e.querySelector('[field-name="setDefaultValue"]'),o=!(!a||null===a.defaultValue||void 0===a.defaultValue)||l.value;t(o)}else m.classList.add("smart-hidden"),t.header.visible&&t.header.buttons.indexOf("views")>=0&&"date"===n&&m.classList.remove("smart-hidden")}else m.classList.add("smart-hidden");else m.classList.add("smart-hidden");else m.classList.add("smart-hidden");else m.classList.add("smart-hidden");else m.classList.add("smart-hidden")}}_addColumnDialogInitEditors(e,t,a){const l=this,i=e.editColumn,n=()=>{const e=a.deadline.parentElement.querySelector(".smart-input"),t=a.deadlineStatus.parentElement,l=a.deadlineDueDate.parentElement,i=t.querySelector("smart-input"),n=l.querySelector("smart-input");t.classList.add("smart-hidden"),l.classList.add("smart-hidden"),2===e.selectedIndex?l.classList.remove("smart-hidden"):1===e.selectedIndex&&t.classList.remove("smart-hidden"),i.dataSource&&0===i.dataSource.length&&t.classList.add("smart-hidden"),n.dataSource&&0===n.dataSource.length&&l.classList.add("smart-hidden")};for(let o in a){const s=a[o],r=s.querySelector("input"),d=s.querySelector("smart-input");switch(o){case"allowTimeFormat":{const e=s.querySelector(".smart-input");i&&i.editor?"dateInput"===i.editor.template?(e.value=!1,e.removeAttribute("checked")):(e.value=!0,e.setAttribute("checked","")):(e.value=!1,e.removeAttribute("checked"));break}case"allowRichText":{const e=s.querySelector(".smart-input");i&&"richText"===i.template?(e.value=!0,e.setAttribute("checked","")):(e.value=!1,e.removeAttribute("checked"));break}case"allowCustomDateSeparator":{const e=s.querySelector(".smart-input");e.value=!1,e.removeAttribute("checked");let t=0;i&&i.cellsFormat&&(i.cellsFormat.indexOf(".")>=0?(e.value=!0,e.setAttribute("checked",""),t=2):(i.cellsFormat.indexOf("M-d-yyyy")>=0||i.cellsFormat.indexOf("d-M-yyyy")>=0||i.cellsFormat.indexOf("yyyy/MM/dd")>=0)&&(e.value=!0,e.setAttribute("checked",""),t=1));const l=a.dateFormatSeparator.querySelectorAll(".smart-grid-dialog-boolean-field");l.forEach((e=>{e.value=!1,e.removeAttribute("checked")})),l[t].setAttribute("checked",""),l[t].click(),l[t].value=!0;break}case"kanban":{const t=s.querySelectorAll(".smart-grid-dialog-boolean-field");for(let a=0;a<t.length;a++){const i=t[a];i.onchange=a=>{const n=[...a.parentElement.children].indexOf(a),o=a.parentElement.parentElement.previousElementSibling,s=e.querySelector('[field-name="options"]'),r=e.querySelector('[field-name="allowColorItems"]'),d=e.querySelector('[field-name="name"]'),c=()=>{const t=s.querySelector("smart-sortable");t&&(t._validate(),e&&e.offsetHeight&&e.setPosition("center"))};n===t.length-1?(o.innerHTML=l.localize("kanbanBasicDescription"),r.classList.remove("smart-hidden"),s.classList.remove("smart-hidden"),d.classList.remove("smart-hidden"),d.querySelector(".smart-grid-dialog-editor ").classList.remove("smart-hidden"),d.querySelector("smart-input").value=l.localize("dialogNewColumn"),c()):n===t.length-2?(o.innerHTML=l.localize("kanbanNoneDescription"),r.classList.add("smart-hidden"),s.classList.add("smart-hidden"),d.classList.remove("smart-hidden"),d.querySelector(".smart-grid-dialog-editor ").classList.remove("smart-hidden"),d.querySelector("smart-input").value=l.localize("dialogNewColumn"),c()):(o.innerHTML=l.localize("kanbanDescription",{column:i.label.innerHTML}),r.classList.add("smart-hidden"),s.classList.remove("smart-hidden"),s.classList.add("smart-hidden"),d.classList.add("smart-hidden"),d.querySelector("smart-input").value=i.label.innerHTML,d.querySelector(".smart-grid-dialog-editor").classList.add("smart-hidden"),c())}}break}case"dateFormat":i&&i.cellsFormat?i.cellsFormat.indexOf("M/d/yyyy")>=0?d.selectedIndex=0:i.cellsFormat.indexOf("dddd, MMMM dd, yyyy")>=0?d.selectedIndex=1:i.cellsFormat.indexOf("yyyy-MM-ddTHH:mm:ss.sssZ")>=0?d.selectedIndex=2:i.cellsFormat.indexOf("d/M/yyyy")>=0?d.selectedIndex=3:i.cellsFormat.indexOf("yyyy-MM-dd")>=0?d.selectedIndex=4:i.cellsFormat.indexOf("MMMM, dd, yyyy")>=0&&(d.selectedIndex=5):d.selectedIndex=0;break;case"timeFormat":i&&i.cellsFormat&&i.cellsFormat.indexOf("HH")>=0&&-1===i.cellsFormat.indexOf("T")?d.selectedIndex=1:d.selectedIndex=0;break;case"allowMultipleCollaborators":{let e=!1;i&&i.editor&&i.editor.singleSelect&&(e=!1);const t=s.querySelector(".smart-input");i&&e?(t.value=!0,t.setAttribute("checked","")):(t.value=!1,t.removeAttribute("checked"));break}case"allowThousandsSeparator":{const e=s.querySelector(".smart-input");i&&i.editor&&"numberInput"===i.editor.template&&"progress"!==i.template&&"rating"!==i.template?(e.value=!0,e.setAttribute("checked",""),i.editor.numberFormat&&("decimal"!==i.editor.numberFormat.style||i.editor.numberFormat.notation||i.editor.numberFormat.useGrouping||(e.value=!1,e.removeAttribute("checked")))):(e.value=!0,e.setAttribute("checked",""));break}case"numberFormat":if(i&&"numberInput"===i.editor.template&&i.editor.numberFormat)if("decimal"===i.editor.numberFormat.style&&0===i.editor.numberFormat.maximumFractionDigits)d.selectedIndex=0;else if("decimal"===i.editor.numberFormat.style&&2===i.editor.numberFormat.minimumFractionDigits)d.selectedIndex=1;else if("percent"===i.editor.numberFormat.style&&2===i.editor.numberFormat.minimumFractionDigits)d.selectedIndex=2;else if("percent"===i.editor.numberFormat.style&&0===i.editor.numberFormat.maximumFractionDigits)d.selectedIndex=3;else if("decimal"===i.editor.numberFormat.style&&"scientific"===i.editor.numberFormat.notation)d.selectedIndex=4;else if("decimal"===i.editor.numberFormat.style&&"engineering"===i.editor.numberFormat.notation)d.selectedIndex=5;else if("currency"===i.editor.numberFormat.style&&"accounting"===i.editor.numberFormat.currencySign)d.selectedIndex=6;else if("unit"===i.editor.numberFormat.style){d.selectedIndex=7;const e=i.editor.numberFormat.unit,t=a.unit.querySelector("smart-input");t.dataSource.forEach(((a,l)=>{if(a.value===e)return t.selectedIndex=l,!0}))}else"currency"===i.editor.numberFormat.style&&0===i.editor.numberFormat.maximumFractionDigits&&0===i.editor.numberFormat.minimumFractionDigits?d.selectedIndex=9:"currency"===i.editor.numberFormat.style&&(d.selectedIndex=8);else d.selectedIndex=0;break;case"currency":if(i&&"numberInput"===i.editor.template&&i.editor.numberFormat){if("currency"===i.editor.numberFormat.style){const e=l._getCurrencies().findIndex((e=>e.value===i.editor.numberFormat.currency));e>=0&&(d.selectedIndex=e)}}else d.selectedIndex=0;break;case"allowCheckItems":{const e=s.querySelector(".smart-input");i?i.editor&&!i.editor.pills?(e.value=!0,e.setAttribute("checked","")):!1===i[o]&&(e.value=!1,e.removeAttribute("checked")):(e.value=!0,e.setAttribute("checked",""));break}case"allowColorItems":{const e=s.querySelector(".smart-input");i?i.editor&&i.editor.colorItems?(e.value=!0,e.setAttribute("checked","")):!1===i[o]&&(e.value=!1,e.removeAttribute("checked")):(e.value=!0,e.setAttribute("checked",""));break}case"setDefaultValue":{const e=s.querySelector(".smart-input");i?(e.value=!1,e.removeAttribute("checked"),i&&void 0!==i.defaultValue&&null!==i.defaultValue&&(e.value=!0,e.setAttribute("checked",""))):(e.value=!1,e.removeAttribute("checked"));break}case"defaultString":{const e=s.querySelector("smart-input");i&&void 0!==i.defaultValue&&null!==i.defaultValue?e.value=i.defaultValue:e.value="";break}case"defaultNumber":{const e=s.querySelector("smart-number-input");i&&void 0!==i.defaultValue&&null!==i.defaultValue?e.value=i.defaultValue:e.value=0;break}case"deadline":{const e=s.querySelector(".smart-input");e.selectedIndex=0,e.onchange=()=>{n()},i&&i.editor&&(e.selectedIndex=0,i.editor.onValidate&&"dueDate"!==i.template&&(e.selectedIndex=2),"dueDate"===i.template&&(e.selectedIndex=1)),n();break}case"deadlineStatus":{const t=s.querySelector(".smart-input"),a=[];for(let e=0;e<l.columns.length;e++){const t=l.columns[e];t&&t.editor&&t.editor.dataSource&&t.editor.singleSelect&&a.push({label:t.label,value:t.dataField})}a.length?t.dataSource=[{label:l.localize("dialogAddColumnTypeNone"),value:"none"}].concat(a):t.dataSource=a,e.editColumn&&(t.selectedValue="",e.editColumn&&e.editColumn.editor.boundDataField&&(t.selectedValue=e.editColumn.editor.boundDataField)),a.length||s.parentElement.classList.add("smart-hidden"),n();break}case"deadlineDueDate":{const t=s.querySelector(".smart-input"),a=[];for(let e=0;e<l.columns.length;e++){const t=l.columns[e];t&&"dueDate"===t.template&&a.push({label:t.label,value:t.dataField})}t.dataSource=a,e.editColumn&&(t.selectedValue="",e.editColumn&&e.editColumn.editor.boundDataField&&(t.selectedValue=e.editColumn.editor.boundDataField)),a.length||s.parentElement.classList.add("smart-hidden"),n();break}case"formula":{const t=s.querySelector(".smart-input");t.clearValue(),e.editColumn&&e.editColumn.formula&&(t.value=e.editColumn.formula);break}case"relationId":{const e=s.querySelector(".smart-input");e.dataSource=l._getRelations(),e.clearValue(),e.selectedValue=i?i.relationId:"";const t=s.querySelector(".field-input");t.dataSource=l._getRelationFieldsData(i?i.relationId:-1),t.clearValue(),i&&i.relationField&&(t.selectedValue=i.relationField);break}case"allowResize":case"allowSort":case"allowEdit":case"allowFilter":case"required":{const e=s.querySelector(".smart-input"),a=t.find((e=>{if(e.bind===o)return e}));i?i[o]?(e.value=!0,e.setAttribute("checked","")):!1===i[o]&&(e.value=!1,e.removeAttribute("checked")):(e.value=!0,a&&void 0!==a.value&&(e.value=a.value),e.value&&e.setAttribute("checked",""));break}}if(!i||"options"!==o&&"users"!==o){const e=s.querySelector("smart-sortable");if(e&&e._init)if("users"===o){let t=[];for(let e=0;e<l.users.length;e++)t.push({color:l.users[e].color,label:l.users[e].name,id:l.users[e].id,value:l.users[e].id,image:l.users[e].image});e._init(t)}else e._init()}else{const e=s.querySelector("smart-sortable");if(e&&e._init)if(i.editor.singleSelect){const t=i.editor.dataSource.filter((e=>""!==e));e._init(t)}else if("multiComboInput"===i.editor.template)if("users"===o){let t=[];for(let e=0;e<l.users.length;e++)t.push({color:l.users[e].color,label:l.users[e].name,id:l.users[e].id,value:l.users[e].id,image:l.users[e].image});e._init(t)}else e._init(JSON.parse(JSON.stringify(i.editor.dataSource)))}if(i&&"type"===o?(d.dataSource=l._getTypesList(),"number"===i.dataType||"int"===i.dataType?d.dataSource.length>3&&(d.selectedIndex=3):"date"===i.dataType?d.dataSource.length>3&&(d.selectedIndex=7):"bool"!==i.dataType&&"boolean"!==i.dataType||d.dataSource.length>3&&(d.selectedIndex=6),i.editor&&i.editor.template&&d.dataSource.forEach(((e,t)=>{switch(e.value){case"string":"input"===i.editor.template&&(d.selectedIndex=t);break;case"number":"numberInput"===i.editor.template&&"progress"!==i.template&&"rating"!==i.template&&(d.selectedIndex=t);break;case"select":"multiComboInput"===i.editor.template&&i.editor.singleSelect&&"tags"===i.template&&!i.relationId&&(d.selectedIndex=t);break;case"multiSelect":"multiComboInput"!==i.editor.template||i.editor.singleSelect||"tags"!==i.template||i.relationId||(d.selectedIndex=t);break;case"multiText":"textarea"===i.editor.template&&(d.selectedIndex=t);break;case"date":"dateInput"!==i.editor.template&&"dateTimePicker"!==i.editor.template||(d.selectedIndex=t);break;case"duration":"dateRangeInput"===i.editor.template&&(d.selectedIndex=t);break;case"time":"timeInput"===i.editor.template&&(d.selectedIndex=t);break;case"checkBox":"checkBox"===i.editor.template&&(d.selectedIndex=t);break;case"slider":"slider"===i.editor.template&&(d.selectedIndex=t);break;case"image":"image"===i.editor.template&&(d.selectedIndex=t);break;case"attachment":"attachment"===i.editor.template&&(d.selectedIndex=t);break;case"updatedTime":"updatedTime"===i.template&&(d.selectedIndex=t);break;case"createdTime":"createdTime"===i.template&&(d.selectedIndex=t);break;case"createdBy":"createdBy"===i.template&&(d.selectedIndex=t);break;case"updatedBy":"updatedBy"===i.template&&(d.selectedIndex=t);break;case"collaborator":("collaborator"===i.template&&i.editor&&i.editor.collaborator||"tags"===i.template&&i.editor&&i.editor.collaborator)&&(d.selectedIndex=t);break;case"autoNumber":"autoNumber"===i.template&&(d.selectedIndex=t);break;case"phone":"phone"===i.template&&(d.selectedIndex=t);break;case"password":"password"===i.template&&(d.selectedIndex=t);break;case"url":"url"===i.template&&(d.selectedIndex=t);break;case"email":"email"===i.template&&(d.selectedIndex=t);break;case"dueDate":"dueDate"===i.template&&(d.selectedIndex=t);break;case"rating":"rating"===i.template&&(d.selectedIndex=t);break;case"progress":"progress"===i.template&&(d.selectedIndex=t);break;case"color":"color"===i.template&&(d.selectedIndex=t);break;case"formula":i.formula&&(d.selectedIndex=t);break;case"relationId":i.relationId&&(d.selectedIndex=t)}}))):"type"===o&&(d.selectedIndex=0,d.dropDownOpenPosition="auto",d.dataSource=l._getTypesList()),"cellsAlign"===o&&i&&("center"===i.cellsAlign||"middle"===i.cellsAlign?d.selectedIndex=2:"right"===i.cellsAlign&&(d.selectedIndex=1)),!r)continue;if("dataField"!==o&&"type"!==o&&"deadline"!==o&&"timeFormat"!==o&&"dateFormat"!==o&&"deadlineStatus"!==o&&"deadlineDueDate"!==o&&"relationId"!==o&&"formula"!==o&&"numberFormat"!==o&&"currency"!==o&&"unit"!==o&&"cellsAlign"!==o&&d&&(d.selectedIndex=0),"name"===o){if(i){const e=i.label;d.value=l._unescapeString(e)}else d.value="";d.placeholder=t.find((e=>{if(e.bind===o)return e})).placeholder}"description"===o&&(d.value=i?l._unescapeString(i.description):"",d.placeholder=t.find((e=>{if(e.bind===o)return e})).placeholder);const c=(e,t)=>{i&&i.validationRules.forEach((a=>"minDate"===a.type&&"minDateTime"===e||"maxDate"===a.type&&"maxDateTime"===e||"min"===a.type&&"minValue"===e||"max"===a.type&&"maxValue"===e||a.type===e?(t.value=a.value,!0):void 0))};if("minValue"===o?(r.value=-9999999,c(o,r)):"maxValue"===o?(r.value=9999999,c(o,r)):"minLength"===o?(r.value=0,c(o,r)):"maxLength"===o&&(r.value=500,c(o,r)),"minDateTime"===o){const e=s.querySelector("smart-date-input");e.value=new Date(1900,0,1),c(o,e)}else if("maxDateTime"===o){const e=s.querySelector("smart-date-input");e.value=new Date(2100,0,1),c(o,e)}}}_createColumnBooleanEditor(e,t,a,l,i){e.setAttribute("template","checkBox"),e.setAttribute("editor","");const n=document.createElement("div");return n.classList.add("smart-input"),n.classList.add("smart-grid-cell-editor"),n.classList.add("smart-grid-check-box-cell-editor"),n.setAttribute("checked",""),n.value=!0,t.width&&(a.style.width=t.width,a.style.float="left"),!1===t.value&&(n.value=!1,n.removeAttribute("checked")),e.appendChild(n),e.getValue=function(){return n.value},e.check=function(){n.setAttribute("checked",""),n.value=!0,e.onchange&&e.onchange(n.value)},e.uncheck=function(){n.removeAttribute("checked"),n.value=!1,e.onchange&&e.onchange(n.value)},e.toggle=function(){!0!==n.value&&!1!==n.value&&null!==n.value&&(n.value=!1),null===n.value?n.value=!1:n.value=!n.value,!1===n.value?n.removeAttribute("checked"):n.setAttribute("checked",n.value?"":"indeterminate"),e.onchange&&e.onchange(n.value)},e.onclick=i.onclick=()=>{e.toggle()},e.setAttribute("tabindex",0),e.onkeydown=t=>{" "!==t.key&&"Enter"!==t.key||e.toggle()},l.appendChild(a),a.classList.add("smart-grid-dialog-boolean-field"),a.appendChild(e),a.appendChild(i),e}_getColumnTemplateByType(e,t){switch(e){case"boolean":case"bool":return"checkBox";case"image":return"image";case"rating":return"rating";case"attachment":return"attachment";case"createdBy":case"updatedBy":return e;case"collaborator":return"collaborator";case"relationId":return"tags";case"select":case"multiSelect":return"tags";case"url":return"url";case"email":return"email";case"autoNumber":return"autoNumber";case"password":return"password";case"createdTime":return"createdTime";case"updatedTime":return"updatedTime";case"dueDate":return"dueDate";case"duration":return"duration";case"multiText":return t.allowRichText?"richText":"";default:return""}}_getRelations(){const e=this;let t=[];t.push({label:"",menuLabel:"&nbsp;",value:""});for(let a=0;a<e.dataSourceSettings.relations.length;a++){const l=e.dataSourceSettings.relations[a];t.push({value:l.id,label:l.label})}return t}_getRelationFieldsData(e){const t=this;let a={};for(let e=0;e<t.dataSourceSettings.relations.length;e++){const l=t.dataSourceSettings.relations[e];a[l.id]=l}const l=a[e];return l?("string"==typeof l.columns?JSON.parse(l.columns):l.columns).filter((e=>!e.template||"tags"===e.template||"collaborator"===e.template||"dropdownlist"===e.template||"list"===e.template)).map((e=>({label:e.label,value:e.dataField}))):[]}_getRelationData(e,t,a){const l=this,i=[];if(!l.dataSourceSettings.relations||!l.dataSourceSettings.relations.length)return;let n=0;const o=["#D50000","#E67C73","#F4511E","#F6BF26","#33B679","#0B8043","#039BE5","#3F51B5","#7986CB","#8E24AA","#616161"];for(let a=0;a<l.dataSourceSettings.relations.length;a++){const n=l.dataSourceSettings.relations[a];if(n.id===e){const e=t,a=[];if(n.dataSource)for(let t=0;t<n.dataSource.length;t++){const l=n.dataSource[t][e];null!=l&&""!==l&&(a[l]||(a[l]=!0,i.push({value:l,label:l})))}break}}i.length&&(a&&i.push({value:"",label:""}),i.sort(((e,t)=>e.label<t.label?-1:e.label>t.label?1:0)));for(let e=0;e<i.length;e++)i[e].color=o[n],n++,n>=o.length-1&&(n=0);return i}_confirmAddColumnDialog(e){const t=this,a=e.querySelectorAll(".smart-grid-dialog-editor"),l=[];let i,n,o={};e===t._dialogAddStackColumn&&(o.type="select");for(let e=0;e<a.length;e++){const l=a[e],i=l.querySelector(".smart-input"),n=l.getAttribute("bind"),s=l.parentElement;if("kanban"!==n)if("name"!==n&&"description"!==n)if("minLength"!==n&&"maxLength"!==n&&"minValue"!==n&&"maxValue"!==n&&"minDateTime"!==n&&"maxDateTime"!==n)if("options"!==n&&"users"!==n){if("relationId"===n)o.relationIdLabel=i.value,o.relationField=l.querySelector(".field-input").selectedValue,o.relationFieldLabel=l.querySelector(".field-input").value;else if("formula"===n){if("formula"!==o.type)continue;o.formula=i.value}else if("allowEdit"===n&&s.classList.contains("smart-hidden"))i.value=!1;else if("required"===n&&s.classList.contains("smart-hidden"))i.value=!1;else if("dateFormatSeparator"===n){const e=l.querySelectorAll(".smart-grid-dialog-boolean-field");for(let t=0;t<e.length;t++)if(e[t].querySelector("[checked]")){switch(t){case 0:o.dateFormatSeparatorType="/";break;case 1:o.dateFormatSeparatorType="-";break;case 2:o.dateFormatSeparatorType="."}break}}i&&(i.getSelectedItem?o[n]=i.getSelectedItem().value:o[n]=i.value)}else{const e=[],a=l.querySelectorAll(".smart-grid-add-column-dialog-color-item .edit-column-input"),i=l.querySelectorAll(".smart-grid-add-column-dialog-color-item smart-color-input");for(let t=0;t<a.length;t++){const l=a[t],n={label:l.value.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/'/g,"&#39;").replace(/"/g,"&quot;").replace(/\\/g,""),value:l.getAttribute("data-item-value").replace(/\\/g,""),id:parseInt(l.getAttribute("data-id")),color:i[t].value};n.color=i[t].value,e.push(n)}if("users"===n&&"collaborator"===o.type){t.users||(t.users=[]);for(let a=0;a<e.length;a++){const l=e[a],i=t.users.find((e=>e.id===l.id));i&&(i.name=l.label,i.color=l.color)}}o[n]=e;const s=l.querySelector(".smart-default-item");o["default_"+n]=s.selectedValues?s.selectedValues[0]:null}else o[n]=i.getValue();else o[n]=i.value.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/'/g,"&#39;").replace(/"/g,"&quot;");else{const e=l.querySelectorAll(".smart-grid-dialog-boolean-field");for(let t=0;t<e.length;t++){const a=e[t];if(a.querySelector("[checked]")){o.kanban=a.name;break}}}}e.data=o;let s={},r={},d="";if(i=o.minDateTime,n=o.maxDateTime,"date"===o.type||"dueDate"===o.type||"startDate"===o.type){s={template:"dateInput",min:i,max:n};let e=!1;o.deadlineStatus&&(s.boundDataField=o.deadlineStatus),"-"!==o.dateFormat&&(d=o.dateFormat,o.allowCustomDateSeparator&&(d.indexOf("/")>=0?d=d.replaceAll("/",o.dateFormatSeparatorType):d.indexOf("-")>=0?d=d.replaceAll("-",o.dateFormatSeparatorType):d.indexOf(".")>=0&&(d=d.replaceAll(".",o.dateFormatSeparatorType))),o.dateFormat.indexOf("T")>=0&&(s.template="dateTimePicker",s.dropDownDisplayMode="auto",s.formatString=d),e=!0),s.autoOpen=!0,o.allowTimeFormat&&"-"!==o.timeFormat&&(e&&(d+=" "),d+=o.timeFormat,s.template="dateTimePicker",s.dropDownDisplayMode="auto",s.formatString=d),o.cellsFormat=d,l.push({type:"minDate",value:i}),l.push({type:"maxDate",value:n})}else if("time"===o.type)s={template:"timeInput",hour12:!0},o.timeFormat.indexOf("HH")>=0&&(s.hour12=!1),s.autoOpen=!0,d=o.timeFormat,o.cellsFormat=d;else if("duration"===o.type)s={template:"dateRangeInput"},d="MM/dd/yyyy hh:mm",o.cellsFormat=d;else if("number"===o.type||"slider"===o.type){i=parseInt(o.minValue),n=parseInt(o.maxValue),o.numberFormat=JSON.parse(JSON.stringify(o.numberFormat)),"unit"===o.numberFormat.style&&(o.numberFormat.unit=o.unit);let e=null,a=null;"currency"===o.numberFormat.style&&(o.numberFormat.currency=o.currency,o.numberFormat.locale=t._getLocaleByCurrency(o.currency)),"decimal"!==o.numberFormat.style||o.numberFormat.notation||(o.numberFormat.useGrouping=o.allowThousandsSeparator),"squaremeter"===o.numberFormat.unit&&(o.numberFormat={type:"squaremeter",style:"decimal",maximumFractionDigits:0}),"cubicmeter"===o.numberFormat.unit&&(o.numberFormat={type:"cubicmeter",style:"decimal",maximumFractionDigits:0}),s={template:"number"===o.type?"numberInput":"slider",min:i,max:n,numberFormat:o.numberFormat},r={Intl:{NumberFormat:o.numberFormat}},a&&(r=a),d="d",e&&(d=e),l.push({type:"min",value:i}),l.push({type:"max",value:n})}else if("rating"===o.type)s={template:"rating"};else if("boolean"===o.type)s={template:"checkBox"};else if("image"===o.type)s={template:"image"};else if("attachment"===o.type)s={template:"attachment"};else if("relationId"===o.type){const e=!o.relationMultiField;let a=t._getRelationData(o.relationId,o.relationField,e);s={template:"multiComboInput",readonly:!0,colorItems:!0,dropDownButtonPosition:"right",autoOpen:!0,relationId:o.relationId,relationField:o.relationField,pills:!0,singleSelect:e,dataSource:a}}else if("select"===o.type||"multiSelect"===o.type||"tags"===o.type){let a=o.options,l=!1;if("select"===o.type)if(e.editColumn&&!e.editColumn.editor.allowEmptyItem){a=o.options;const i=[];for(let e=0;e<o.options.length;e++)if(""===o.options[e].label)o.options[e].value="";else if(""===o.options[e].value){const t=o.options[e].label.trim();if(i[t])continue;o.options[e].value=t,i.push(t)}else if(!isNaN(parseInt(o.options[e].value))){const t=o.options[e].label.trim();if(i[t])continue;o.options[e].value=t,i.push(t)}if(e.editColumn._dataField&&"taskStatus"===e.editColumn._dataField||e===t._dialogAddStackColumn)for(let e=0;e<o.options.length;e++){const t=o.options[e];isNaN(parseInt(t.value))||(t.value=t.label.replaceAll(" ",""))}a=o.options;let n=!1;for(let e=0;e<o.options.length;e++)if(""===o.options[e].label){n=!0,l=!0,o.options[e].value="";break}a=!n&&o.options.length?[{color:"#F47A54",value:"",label:""}].concat(o.options):o.options}else{const e=[];let t=!1;for(let a=0;a<o.options.length;a++)if(""===o.options[a].label)t=!0,l=!0,o.options[a].value="";else if(""===o.options[a].value){const t=o.options[a].label.trim();if(e[t])continue;o.options[a].value=t,e.push(t)}else if(!isNaN(parseInt(o.options[a].value))){const t=o.options[a].label.trim();if(e[t])continue;o.options[a].value=t,e.push(t)}a=!t&&o.options.length?[{color:"#F4511E",value:"",label:""}].concat(o.options):o.options}else if("multiSelect"===o.type){const e=[];for(let t=0;t<o.options.length;t++)if(""===o.options[t].label)o.options[t].value="";else if(""===o.options[t].value){const a=o.options[t].label.trim();if(e[a])continue;o.options[t].value=a,e.push(a)}else if(!isNaN(parseInt(o.options[t].value))){const a=o.options[t].label.trim();if(e[a])continue;o.options[t].value=a,e.push(a)}a=o.options}a.length&&""===a[0]&&!l&&o.required&&(a=a.splice(1)),s={template:"multiComboInput",readonly:!0,dropDownButtonPosition:"right",colorItems:o.allowColorItems,autoOpen:!0,pills:!0,singleSelect:"select"===o.type,dataSource:a}}else if("collaborator"===o.type){let e=o.users;o.allowMultipleCollaborators||e&&e.length&&""!==e[0].value&&(e=[{label:"",value:"",color:"#F47A54"}].concat(o.users));for(let a=0;a<t.users.length;a++)e.forEach((e=>{e.value!==t.users[a].id&&e.value!==""+t.users[a].id||(e.image=t.users[a].image,e.id=t.users[a].id)}));s={template:"multiComboInput",readonly:!0,collaborator:!0,colorItems:o.allowColorItems,dropDownButtonPosition:"right",autoOpen:!0,pills:!0,singleSelect:!o.allowMultipleCollaborators,dataSource:e}}else"multiText"===o.type?(i=o.minLength,n=o.maxLength,s={template:"textarea",min:i,max:n,required:o.required},l.push({type:"minLength",value:i}),l.push({type:"maxLength",value:n})):"password"===o.type?(i=o.minLength,n=o.maxLength,s={template:"password",min:i,max:n,required:o.required},l.push({type:"minLength",value:i}),l.push({type:"maxLength",value:n})):"phone"===o.type?s={template:"phone",required:o.required}:(i=o.minLength,n=o.maxLength,s={template:"input",min:i,max:n,required:o.required},l.push({type:"minLength",value:i}),l.push({type:"maxLength",value:n}));let c="string";switch(o.type){case"boolean":case"bool":c="boolean";break;case"createdTime":case"updatedTime":case"duration":case"date":case"time":c="date";break;case"autoNumber":case"slider":case"rating":case"number":c="number"}const u=e=>{if(o.setDefaultValue)switch(o.type){case"string":case"multiText":case"description":case"name":e.defaultValue=o.defaultString;break;case"number":case"slider":e.defaultValue=o.defaultNumber;break;case"date":case"dueDate":case"startDate":e.defaultValue="current"===o.defaultDate?"today":o.defaultDateValue;break;case"collaborator":void 0!==o.default_users?e.defaultValue=o.default_users:e.defaultValue=null;break;case"select":case"multiSelect":case"status":case"priority":o.default_options?e.defaultValue=o.default_options:e.defaultValue=null}else e.defaultValue=null};if(e.editColumn){const a=e.editColumn;a.canNotify=!1,a.label=o.name,void 0!==o.description&&(a.description=o.description),a.showDescriptionButton=!0,void 0!==o.allowResize&&(a.allowResize=o.allowResize),void 0!==o.allowSort&&(a.allowSort=o.allowSort),void 0!==o.allowFilter&&(a.allowFilter=o.allowFilter),void 0!==o.allowEdit&&(a.allowEdit=o.allowEdit),void 0!==o.cellsAlign&&(a.align=a.cellsAlign=o.cellsAlign),void 0!==o.cellsFormat&&(a.cellsFormat=d),void 0!==o.formula?a.formula=o.formula:a.formula="";const i=a._editorId?a._editorId:"",n=s.template+"_"+a.dataField+i;t._cellEditors[n]&&delete t._cellEditors[n];let m=!0;"list"!==a.template&&"dropDownList"!==a.template||(m=!1),"autoNumber"!==a.template&&"createdBy"!==a.template&&"updatedBy"!==a.template&&"createdTime"!==a.template&&"progress"!==a.template&&"updatedTime"!==a.template&&"checklist"!==a.template&&"color"!==a.template||(m=!1),a.editor&&a.editor.template.indexOf("custom")>=0&&(m=!1),a.editor&&a.editor.disabledDialogOptions&&(m=!1),u(a),m&&(a.editor=JSON.parse(JSON.stringify(s)),a.template=t._getColumnTemplateByType(o.type,o),a._cellsCachedValues=[]),"date"===o.type&&("dueDate"===o.deadline?(s=t._getKanbanTaskField("dueDate").editor,o.deadlineStatus&&(s.boundDataField=o.deadlineStatus),a.template="dueDate"):"startDate"===o.deadline?(s=t._getKanbanTaskField("startDate").editor,o.deadlineDueDate&&(s.boundDataField=o.deadlineDueDate),a.template="startDate"):(a.template="",s.template="dateInput",s.onValidate=null)),"relationId"===o.type&&(a.relationId=o.relationId,a.relationField=o.relationField),a.formatSettings=r,o.type!==e.columnType&&e.columnType&&(a.dataType=c),a.icon=t._getIconByType(o.type),a._isDirty=!0,o.required&&l.push({type:"required"}),a.validationRules=l,a._state&&["label","description","defaultValue","showDescriptionButton","dataSet","dataType","editor","formatSettings","template","summary","validationRules","allowResize","allowSort","allowFilter","allowEdit","align","cellsAlign","cellsFormat"].forEach((e=>{a._state[e]=a[e]})),a.canNotify=!0,t.$.fireEvent("closeColumnDialog",{dataField:a.dataField}),t.onColumnUpdated&&t.onColumnUpdated(t.columns.indexOf(a),a),t._onColumnUpdated&&t._onColumnUpdated(a,o),t._recycle(!0),a.refresh(),a._isDirty=!1}else{let e=[];"number"===c&&(e=["sum"]);const a=t._getColumnLabel(o),i=new Smart.Grid.Column({label:a,description:o.description,dataField:o.dataField||"dataField"+Math.floor(65536*(1+Math.random())).toString(16).substring(1),allowResize:o.allowResize,allowSort:o.allowSort,allowFilter:o.allowFilter,allowEdit:o.allowEdit,showDescriptionButton:!0,dataType:c,editor:s,summary:e,template:t._getColumnTemplateByType(o.type,o),formatSettings:r,cellsAlign:o.cellsAlign,align:o.cellsAlign,cellsFormat:d,visibleIndex:t.columns.length-1,formula:o.formula,relationId:o.relationId,relationField:o.relationField,grid:t});if("autoNumber"===i.template&&(i.autoGenerated=!0,e=[]),u(i),o.required&&(l.push({type:"required"}),i.validationRules=l),"date"===o.type&&("dueDate"===o.deadline?o.type="dueDate":"startDate"===o.deadline&&(o.type="startDate")),"collaborator"===o.type){let e=!1;for(let a=0;a<t.columns.length;a++)if("taskUserId"===t.columns[a]._dataField){e=!0;break}e||(i._dataField="taskUserId")}if(t._getKanbanFields().indexOf(o.type)>=0){const e=t._getKanbanTaskField(o.type);switch(u(e),"startDate"===o.type&&o.deadlineDueDate&&(e.editor.boundDataField=o.deadlineDueDate),"dueDate"===o.type&&o.deadlineStatus&&(e.editor.boundDataField=o.deadlineStatus),delete e._state,o.description&&(e.description=o.description),o.name&&(e.label=o.name),e.allowFilter=o.allowFilter,e.allowResize=o.allowResize,e.allowSort=o.allowSort,o.type){case"priority":case"status":case"tags":e.editor.dataSource=JSON.parse(JSON.stringify(o.options))}let a=t.columnByDataField[e.dataField];if("status"===o.type||"name"===o.type||"description"===o.type)for(let e=0;e<t.columns.length;e++){const l=t.columns[e];if(l._dataField&&!t.columnByDataField[l._dataField]&&(t.columnByDataField[l._dataField]=l),l.statusColumn||"taskStatus"===l._dataField){a=l;break}}a&&!1===a._visible?(a.visible=!0,delete a._visible):(a&&(e.dataField=e.displayField="dataField"+Math.floor(65536*(1+Math.random())).toString(16).substring(1),"object"==typeof e.editor&&e.editor.dataSource&&(e.editor.dataSource=JSON.parse(JSON.stringify(e.editor.dataSource))),o.name||(e.label=e.label+" "+t.localize("copy"))),t.columns.push(e))}else t.columns.push(i);t._refreshHeaderBar(),t.$.fireEvent("closeColumnDialog",{dataField:i.dataField})}}_getColumnLabel(e){const t=this;let a=e.name;if(!a){let a="";switch(e.type){case"string":a=t.localize("dialogAddColumnTypeText");break;case"multiText":a=t.localize("dialogAddColumnTypeMultilineText");break;case"image":a=t.localize("dialogAddColumnTypeImage");break;case"attachment":a=t.localize("dialogAddColumnTypeAttachment");break;case"number":a=t.localize("dialogAddColumnTypeNumber");break;case"select":a=t.localize("dialogAddColumnTypeSelect");break;case"multiSelect":a=t.localize("dialogAddColumnTypeMultipleSelect");break;case"boolean":a=t.localize("dialogAddColumnTypeCheckBox");break;case"date":a=t.localize("dialogAddColumnTypeDate");break;case"time":a=t.localize("dialogAddColumnTypeTime");break;case"duration":a=t.localize("dialogAddColumnTypeDuration");break;case"createdTime":a=t.localize("dialogAddColumnTypeCreatedTime");break;case"updatedTime":a=t.localize("dialogAddColumnTypeLastUpdatedTime");break;case"createdBy":a=t.localize("dialogAddColumnTypeCreatedBy");break;case"updatedBy":a=t.localize("dialogAddColumnTypeLastUpdatedBy");break;case"collaborator":a=t.localize("dialogAddColumnTypeCollaborator");break;case"slider":a=t.localize("dialogAddColumnTypeSlider");break;case"autoNumber":a=t.localize("dialogAddColumnTypeAutoNumber");break;case"url":a=t.localize("dialogAddColumnTypeURL");break;case"relationId":a=t.localize("dialogAddColumnTypeRowLink"),e.relationFieldLabel&&e.relationIdLabel&&(a=e.relationFieldLabel+" ("+e.relationIdLabel+")");break;case"formula":a=t.localize("dialogAddColumnTypeFormula");break;case"email":a=t.localize("dialogAddColumnTypeEmail");break;case"phone":a=t.localize("dialogAddColumnTypePhone");break;case"password":a=t.localize("dialogAddColumnTypePassword");break;case"rating":a=t.localize("dialogAddColumnTypeRating")}let l=1;for(let e=0;e<t.columns.length;e++)t.columns[e].label.indexOf(a)>=0&&l++;return 1===l?a:a+" "+l}return a}_openAddColumnDialog(e,t,a){const l=this,i=l._dialogAddColumn||l._createDialog(l.editing.addColumnDialog),n=e?l.localize("dialogEditColumn",{value:e.label}):l.localize("dialogAddColumn"),o=i.querySelector(".smart-footer").querySelector(".smart-stack-layout");i.classList.add("smart-grid-dialog-add-column"),i.type=e?"customize":"add",i.editColumn=e||null,delete i._randomOptionIndex,e&&e.element?e.element.setAttribute("focus",""):l._addNewColumn&&l._addNewColumn.element.setAttribute("focus",""),o.classList.remove("right"),o.classList.add("center"),l._cellEditors||(l._cellEditors=[]);const s=l._getAddColumnDialogTemplate();if(i.header.innerHTML=n,i.header.parentElement.classList.add("smart-hidden"),i.callback=a,!0===t&&(i.header.parentElement.classList.remove("smart-hidden"),"kanban"===l.view?(i.header.innerHTML=l.localize("dialogAddColumnStatus"),i.header.parentElement.querySelector(".smart-close-button").classList.add("smart-hidden"),i.classList.add("view")):i.classList.remove("kanban")),i.stackLabel&&i.stackLabel.classList.add("smart-hidden"),"kanban"===l.view?i.btnCancel.classList.add("smart-hidden"):i.btnCancel.classList.remove("smart-hidden"),l.cancelEdit(),!l._dialogAddColumn){i.modal=!0,i.btnConfirm.innerHTML=l.localize("dialogEditButtonConfirm"),i.btnCancel.innerHTML=l.localize("dialogEditButtonCancel"),i._refreshPosition=()=>{const e=l.offset(l.$.columnHeader),t=l.$.columnHeader.offsetHeight,a=l.offset(l);if(i.style.maxHeight="",i.style.minHeight="",e.top+t+i.offsetHeight>window.innerHeight-a.top){const l=t+e.top+i.offsetHeight-window.innerHeight+a.top;i.style.maxHeight=Math.max(250,i.offsetHeight-l)+"px",i.style.minHeight="250px"}else i.style.maxHeight="",i.style.minHeight=""},i.onOpen=function(){const e=l._dialogAddColumn,t=l._getAddColumnDialogTemplate(),a=l._addColumnDialogEditors;if(delete e.columnType,l._addColumnDialogInitEditors(e,t,a),l._addColumnDialogShowHideEditors(e),e.editColumn){const t=e.querySelector('[bind="type"]'),a=t?t.querySelector("smart-input"):null,l=t?a.getSelectedItem().value:"kanban";e.columnType=l}else delete e.columnType;l._filterColumnTypes(),l.$.fireEvent("openColumnDialog",{dataField:e.editColumn?e.editColumn.dataField:null}),e._refreshPosition()},i.onClose=function(){i.editColumn&&i.editColumn.element&&i.editColumn.element.removeAttribute("focus"),l._addNewColumn&&l._addNewColumn.element.removeAttribute("focus"),i.classList.remove("view"),i.callback&&i.callback(i.result)},i.btnCancel.onclick=function(){i.result=!1,i.close()},i.btnClose.onclick=function(){i.result=!1,i.close()},i.btnConfirm.onclick=function(){l._confirmAddColumnDialog(i),i.result=!0,i.close()},i.onkeydown=function(e){"Escape"===e.key&&"kanban"!==l.view&&(i.result=!1,i.close())},l._dialogAddColumn=i;const e=document.createElement("div");e.classList.add("smart-content-layout-container"),i.content.appendChild(e),l._addColumnDialogEditors=[];const t=l._addColumnDialogEditors;l._initAddColumnDialogEditors(t,s,i,e)}const r=()=>{const t=parseInt(i.style.width),a=l.offset(l);if(window.screen.availWidth<400)return i.open("left","top"),i.style.width=l.offsetWidth+"px",void(i.style.height=l.offsetHeight+"px");{const e=l.editing.addColumnDialog;i.style.width="auto"===e.width?e.width:e.width+"px",i.style.height="auto"===e.height?e.height:e.height+"px"}if(e){const n=e.element;if(n){const e=l.offset(n),o=e.left-a.left,s=a.left,r=Math.max(s,o);if(r+t+n.offsetWidth>a.left+l.offsetWidth){const l=r-t+n.offsetWidth;l<0?i.open("center",e.top+n.offsetHeight-a.top):i.open(Math.max(s,l),e.top+n.offsetHeight-a.top)}else i.open(r,e.top+n.offsetHeight-a.top)}else i.classList.add("center"),i.open("center","center")}else if(l._addNewColumn){let e=l._addNewColumn.element,n=l.offset(e),o=n.left-a.left-t+e.offsetWidth,s=a.left,r=Math.max(s,o);l.editing.addNewColumn._addButton&&l.editing.addNewColumn._addButton.classList.contains("show")&&(e=l.editing.addNewColumn._addButton,n=l.offset(l.editing.addNewColumn._addButton),o=n.left-a.left-t+e.offsetWidth,s=a.left,r=Math.max(s,o)),i.open(r,n.top+e.offsetHeight-a.top)}else i.open("center","center"),i.classList.add("center")};r(),i.refresh=()=>{r()}}_filterColumnTypes(){const e=this,t=e._dialogAddColumn;if(!t)return;const a=e._dialogAddColumn.querySelector('[bind="type"]').querySelector("smart-input");if(t.columnType){const l=e._getTypesList().find((e=>{if(e.value===t.columnType)return e}));if(l)if("string"===t.columnType||"multiText"===t.columnType)a.dataSource=e._getTypesList().filter((e=>!(["createdTime","updatedTime","createdBy","updatedBy","autoNumber","image","color","checklist","progress","collaborator","attachment"].indexOf(e.value)>=0)));else if("select"===t.columnType||"multiSelect"===t.columnType){const t=[{value:"string",prefix:'<span class="smart-grid-icon visible smart-icon-font"></span>',label:e.localize("dialogAddColumnTypeText")},{value:"multiText",prefix:'<span class="smart-grid-icon visible smart-icon-fontsize"></span>',label:e.localize("dialogAddColumnTypeMultilineText")},{value:"select",prefix:'<span class="smart-grid-icon visible smart-icon-sort-down"></span>',label:e.localize("dialogAddColumnTypeSelect")},{value:"multiSelect",prefix:'<span class="smart-grid-icon visible smart-icon-list-unordered"></span>',label:e.localize("dialogAddColumnTypeMultipleSelect")}];a.dataSource=t}else{const t=[{value:"string",prefix:'<span class="smart-grid-icon visible smart-icon-font"></span>',label:e.localize("dialogAddColumnTypeText")},{value:"multiText",prefix:'<span class="smart-grid-icon visible smart-icon-fontsize"></span>',label:e.localize("dialogAddColumnTypeMultilineText")}].concat(l);a.dataSource=t}else a.dataSource=e._getTypesList()}else t.editColumn||(a.dataSource=e._getTypesList(),a.selectedIndex=0)}_getIconByType(e){let t="smart-icon-font";switch(e){case"multiText":t="smart-icon-fontsize";break;case"image":t="smart-icon-image";break;case"attachment":t="smart-icon-docs";break;case"number":case"progress":t="smart-icon-number";break;case"priority":case"status":case"select":t="smart-icon-sort-down";break;case"multiSelect":t="smart-icon-list-unordered";break;case"boolean":t="smart-icon-check-squared";break;case"date":case"startDate":case"duration":case"dueDate":t="smart-icon-calendar";break;case"time":case"createdTime":case"updatedTime":t="smart-icon-clock";break;case"createdBy":case"updatedBy":case"collaborator":t="smart-icon-user";break;case"slider":t="smart-icon-number";break;case"autoNumber":case"checklist":t="smart-icon-list-ordered";break;case"url":t="smart-icon-link";break;case"email":t="smart-icon-mail";break;case"password":t="smart-icon-lock";break;case"phone":t="smart-icon-phone";break;case"name":t="smart-icon-font";break;case"description":t="smart-icon-fontsize";break;case"tags":t="smart-icon-list-ordered";break;case"color":t="smart-icon-color-background";break;case"assigned":t="smart-icon-user";break;case"rating":t="smart-icon-star";break;case"relationId":t="smart-icon-table-alt";break;case"formula":t="smart-icon-math"}return t}_initAddColumnDialogEditors(e,t,a,l){const i=this;for(let n=0;n<t.length;n++){const o=t[n],s=document.createElement("div"),r=document.createElement("label");r.innerHTML=o.label;const d=document.createElement("div");if(d.classList.add("smart-grid-dialog-editor","add-column"),d.innerHTML="",d.setAttribute("filter",o.filter),d.setAttribute("bind",o.bind),s.setAttribute("field-name",o.bind),s.setAttribute("field-filter",o.filter),e[o.bind]=d,"type"===o.bind&&d.addEventListener("change",(()=>{i._addColumnDialogShowHideEditors(a),a.editColumn&&i._filterColumnTypes();const t=i._dialogAddColumn.querySelector('[bind="type"]'),l=t.querySelector("smart-input"),n=l.getSelectedItem().value,o=i._getIconByType(n);if(e.type.icon=o,e.name.querySelector("input").setAttribute("data-label",l.value),t.firstElementChild.className="smart-grid-icon show smart-description-button "+o,"select"===n||"multiSelect"===n){const t=e.options.querySelector("smart-sortable");if(t&&t._validate){if(a.editColumn)if(a.editColumn.editor.dataSource){let e=[...a.editColumn.editor.dataSource];"multiSelect"===n&&""===e[0].value&&e.shift(),t._init(e)}else{const e=[];for(let t=0;t<i.rows.length;t++){const l=i.rows[t].data[a.editColumn.dataField];if(l&&l.indexOf(",")>=0){const t=l.split(",");for(let a=0;a<t.length;a++)-1===e.indexOf(t[a].trim())&&e.push(t[a].trim())}else if(-1===e.indexOf(l)&&void 0!==l){if(""===l&&"multiSelect"===n)continue;e.push(l)}}e.length?t._init(e.map((e=>({value:e,label:e})))):t._init()}else t._init();t._validate()}}else if("priority"===n||"status"===n||"tags"===n){const t=e.options.querySelector("smart-sortable"),a=i._getKanbanTaskField(n);t&&t._validate&&(t._init([...a.editor.dataSource]),t._validate())}else a.btnConfirm.disabled=!1})),"boolean"===o.type)i._createColumnBooleanEditor(d,o,s,l,r);else{if("label"===o.type){l.appendChild(s),s.classList.add("smart-grid-dialog-field"),s.appendChild(r);const e=document.createElement("div");e.style.height="10px",s.appendChild(e);continue}if("relationId"===o.type){let e=document.createElement("smart-input");e.classList.add("underlined","edit-column-input"),e.style.width="calc(100% - 25px)",e.style.height="30px",o.width&&(s.style.width=o.width,s.style.float="left"),e.readonly=!0,e.dropDownButtonPosition="right",e.dropDownHeight="auto";let a=i._getRelations(),c={};for(let e=0;e<i.dataSourceSettings.relations.length;e++){const t=i.dataSourceSettings.relations[e];c[t.id]=t}let u=document.createElement("smart-input");u.classList.add("underlined","smart-hidden","edit-column-input","field-input"),u.style.width="calc(100% - 25px)",u.style.height="30px",u.readonly=!0,u.dropDownButtonPosition="right",u.dropDownHeight="auto";const m=document.createElement("div"),p=document.createElement("div");if(p.style.marginTop="5px",p.innerHTML=i.localize("dialogAddColumnLinkField"),p.classList.add("smart-hidden"),e.dataSource=a,e.onchange=()=>{if(u.dataSource=null,u.clearValue(),""===e.value)u.classList.add("smart-hidden"),p.classList.add("smart-hidden");else{p.classList.remove("smart-hidden"),u.classList.remove("smart-hidden");const t=c[e.selectedValue];t&&(u.dataSource=i._getRelationFieldsData(t.id),u.dataSource.length>0&&(u.selectedValue=u.dataSource[0].value))}},o.width&&(s.style.width=o.width,s.style.float="left"),d.style.height="auto",m.classList.add("smart-flex"),m.style.width="100%",m.style.flexDirection="column",m.appendChild(e),m.appendChild(p),m.appendChild(u),d.appendChild(m),l.appendChild(s),s.classList.add("smart-grid-dialog-field"),s.appendChild(r),s.appendChild(d),o.width&&!t[n+1].width){const e=document.createElement("div");e.style.clear="both",l.appendChild(e)}}else if("formula"===o.type){let e=document.createElement("smart-input");e.classList.add("underlined","edit-column-input"),e.style.width="100%",o.width&&(s.style.width=o.width,s.style.float="left"),d.appendChild(e),l.appendChild(s),s.classList.add("smart-grid-dialog-field"),s.appendChild(r),s.appendChild(d);const a=document.createElement("div");if(a.innerHTML=i.localize("dialogAddColumnTypeFormulaInfo"),a.style.color="var(--smart-primary)",a.style.fontSize="12px",a.style.marginBottom="10px",s.appendChild(a),o.width&&!t[n+1].width){const e=document.createElement("div");e.style.clear="both",l.appendChild(e)}}else{let c=document.createElement("smart-input");if(c.classList.add("underlined","edit-column-input"),c.style.width="100%",c.style.height="30px",o.width&&(s.style.width=o.width,s.style.float="left"),"items"===o.type){const t=document.createElement("smart-button");t.classList.add("primary"),t.innerHTML='<div style="align-items: center; white-space: nowrap; display: flex;"><span class="smart-grid-icon show smart-icon-plus"></span><span>'+i.localize("commandBarAddRow")+"</span></div>";const l=document.createElement("div");l.classList.add("smart-grid-add-column-dialog-color-panel");const n=document.createElement("smart-sortable");n.disableMode="manual",n.dragMode="handle",n.handlePosition="left",n.handleVisibility="visible";const s=()=>{if(a.btnConfirm.disabled=!1,0===l.offsetHeight)return;let e=0;l.querySelectorAll(".edit-column-input").forEach((t=>{""===t.value&&e++;const l=a.querySelector('[field-name="type"]');l&&("multiSelect"===l.querySelector("smart-input").selectedValues[0]&&e>=1&&(a.btnConfirm.disabled=!0),e>1&&(a.btnConfirm.disabled=!0))})),n._updateDefaultInput()},r=(l,r,d,c)=>{const u=document.createElement("div"),m=i._getColorInput(),p=document.createElement("div"),g=document.createElement("smart-input"),b=e.allowColorItems;if(void 0!==d)g.setAttribute("data-id",d),g.setAttribute("data-item-value",d);else{const e=n.querySelectorAll(".smart-sortable-item").length;g.setAttribute("data-id",e),g.setAttribute("data-item-value",e)}if(void 0!==c&&g.setAttribute("data-item-value",c),m.disabled=!b.querySelector(".smart-input").value,p.className="smart-grid-icon smart-icon-close show",p.setAttribute("role","button"),p.setAttribute("aria-label","button"),g.classList.add("underlined","edit-column-input"),g.style.width="100%",g.style.height="30px",g.required=!0,(a.editColumn&&"collaborator"===a.editColumn.template||"users"===o.bind)&&(g.disabled=!0),l&&(g.value=i._unescapeString(l)),r)m.value=r;else if(!m.disabled){void 0!==a._randomOptionIndex?a._randomOptionIndex++:a._randomOptionIndex=2;const e=a._randomOptionIndex;e>=m.dataSource.length-1&&delete a._randomOptionIndex;const t=m.dataSource[e];m.value=t}if(g.onkeyup=g.onchange=g.onblur=e=>{s(),"Enter"===e.key&&(g.parentElement.nextElementSibling||(t.performClick(),s()))},m.onchange=()=>{n._updateDefaultInput()},u.appendChild(m),u.appendChild(g),"users"!==o.bind&&u.appendChild(p),p.onmouseenter=()=>{if(i._dialogAddColumn&&i._dialogAddColumn.editColumn){if(p.title="",p.classList.remove("smart-quiet"),!c)return;const e=i._dialogAddColumn.editColumn;if(e)for(let t=0;t<i.rows.length;t++)if(i.rows[t].data[e.dataField]===c){p.title=i.localize("dialogAddColumnListItemsError"),p.classList.add("smart-quiet");break}}},c&&i._dialogAddColumn){const e=i._dialogAddColumn.editColumn;if(e)for(let t=0;t<i.rows.length;t++)if(i.rows[t].data[e.dataField]===c){p.title=i.localize("dialogAddColumnListItemsError"),p.classList.add("smart-quiet");break}}return p.onclick=()=>{p.title||(u.remove(),n.updateItems(),s())},u.classList.add("smart-sortable-item","smart-grid-add-column-dialog-color-item"),"users"===o.bind&&u.setAttribute("disable-drag",""),u};if(n._getOptions=e=>{const t=[],a=l.querySelectorAll(".smart-grid-add-column-dialog-color-item .edit-column-input"),n=l.querySelectorAll(".smart-grid-add-column-dialog-color-item smart-color-input");for(let e=0;e<a.length;e++){const l=a[e],i={label:l.value.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/'/g,"&#39;").replace(/"/g,"&quot;").replace(/\\/g,""),value:l.getAttribute("data-item-value").replace(/\\/g,""),id:parseInt(l.getAttribute("data-id")),color:n[e].value};i.color=n[e].value;const o=parseInt(i.value);if(!isNaN(o)){const e=i.label.trim();i.value=e}t.push(i)}if("users"===e.bind){i.users||(i.users=[]);for(let e=0;e<t.length;e++){const a=t[e],l=i.users.find((e=>e.id===a.id));l&&(l.name=a.label,l.color=a.color)}}return t},n._updateDefaultInput=e=>{e||(e=n._getOptions(o)),n._defaultInput&&(n._defaultInput.dataSource=e,n._defaultInput.selectedValues=[],!e||e&&!e.length||"kanban"===i.view?(n._defaultInput.classList.add("smart-hidden"),n._defaultOption.classList.add("smart-hidden")):(a.editColumn&&a.editColumn.defaultValue&&(n._defaultInput.selectedValues=[a.editColumn.defaultValue]),n._defaultInput.classList.remove("smart-hidden"),n._defaultOption.classList.remove("smart-hidden")))},n._init=e=>{n.clearContent(),"users"===o.bind?(n.handleVisibility="none",n.handlePosition="none"):(n.handleVisibility="visible",n.handlePosition="left"),e&&(e.forEach(((e,t)=>{const a=void 0!==e.id?e.id:t,l=r(e.label,e.color,a,e.value,t);n.$.container.appendChild(l)})),n.updateItems()),n._updateDefaultInput(e)},n._validate=s,e.allowColorItems.onchange=t=>{let a=e.allowColorItems.parentElement.nextElementSibling,l=null;for(;a;){if("options"===a.getAttribute("field-name")){if(l=a,l&&l.classList.contains("smart-hidden")){a=a.nextElementSibling;continue}break}if("users"===a.getAttribute("field-name")){if(l=a,l&&l.classList.contains("smart-hidden")){a=a.nextElementSibling;continue}break}a=a.nextElementSibling}l&&l.querySelectorAll("smart-color-input").forEach((e=>{e.disabled=!t}))},l.appendChild(n),"users"!==o.bind){l.appendChild(t);const e=()=>{const e=r();n.$.container.appendChild(e),n.updateItems(),e.querySelector(".edit-column-input").focus(),a.btnConfirm.disabled=!0,a._refreshPosition&&a._refreshPosition(),event.preventDefault()};t.performClick=()=>{e()},t.onpointerdown=()=>{e()},t.onkeydown=t=>{"Enter"===t.key&&e()}}const u=document.createElement("div");u.innerHTML=i.localize("dialogAddColumnDefault");const m=document.createElement("smart-multi-combo-input");m.singleSelect=!0,m.readonly=!0,m.dropDownButtonPosition="right",m.colorItems=!0,m.autoOpen=!0,m.pills=!0,m.style.setProperty("--smart-surface","--smart-background"),m.style.width="100%",m.classList.add("smart-default-item","underlined");const p=document.createElement("div");p.style.display="flex",p.style.flexDirection="column",p.style.marginTop="5px",p.classList.add("smart-default-item-container"),p.appendChild(u),p.appendChild(m),l.appendChild(p),n._defaultInput=m,n._defaultOption=u,c=l,d.style.height="auto"}else if("number"===o.type)c=document.createElement("smart-number-input"),c.classList.add("underlined"),c.style.width="100%",c.style.height="30px","minValue"===o.bind?(c.value=0,c.min=-9999999,c.max=9999999):"maxValue"===o.bind?(c.value=1e6,c.min=-9999999,c.max=9999999):"minLength"===o.bind?c.value=0:"maxLength"===o.bind&&(c.value=500);else if("datetime"===o.type)c=document.createElement("smart-date-input"),c.classList.add("underlined"),c.style.width="100%",c.style.height="30px","minDateTime"===o.bind?c.value=new Date(1900,0,1):"maxDateTime"===o.bind&&(c.value=new Date(2100,0,1));else if("radio"===o.type){const e=(e,t,a)=>{const l=document.createElement("div"),i=document.createElement("label"),n=document.createElement("div");return i.innerHTML=e,n.classList.add("smart-input"),n.classList.add("smart-grid-cell-editor"),n.classList.add("smart-grid-check-box-cell-editor"),t&&n.setAttribute("checked",""),n.value=void 0!==t&&t,d.appendChild(n),l.onclick=function(){if(n.value=!0,!1===n.value?n.removeAttribute("checked"):n.setAttribute("checked",n.value?"":"indeterminate"),l.onchange&&l.onchange(l),n.value){const e=n.parentElement.parentElement.parentElement;e.querySelectorAll(".smart-grid-cell-editor").forEach((e=>{e.value=!1,e.removeAttribute("checked")})),n.value=!0,n.setAttribute("checked",n.value?"":"indeterminate"),e.value=a}},l.setAttribute("tabindex",0),l.onkeydown=e=>{" "!==e.key&&"Enter"!==e.key||l.click()},l.appendChild(n),l.appendChild(i),l.classList.add("smart-grid-dialog-boolean-field"),l.setAttribute("template","checkBox"),l.setAttribute("editor",""),l.label=i,l.value=t,l.name=a,l},t=document.createElement("div");t.classList.add("smart-grid-dialog-radio-field"),d.classList.add("radio-group");for(let a=0;a<o.options.length;a++){const l=o.options[a],i=e(l.label,l.checked,l.value);if(o.columns){const e=100/o.columns;i.style.width=e+"%",i.style.float="left"}t.appendChild(i),l.checked&&(d.value=l.value)}const a=document.createElement("div");a.style.clear="both",t.appendChild(a),c=t}if(o.options){c.readonly=!0;let e=o.options;"type"===o.bind&&(void 0!==i.currentUser&&null!==i.currentUser||(e=e.filter((e=>"updatedBy"!==e.value&&"createdBy"!==e.value))),(void 0===i.users||null===i.users||i.users&&0===i.users.length)&&(e=e.filter((e=>"collaborator"!==e.value)))),c.dataSource=e,c.dropDownButtonPosition="right","dataField"!==o.bind&&(c.selectedIndex=0),o.options.length<15?c.dropDownHeight="auto":c.dropDownHeight=300}if(o.icon){const e=document.createElement("span");e.classList.add("smart-grid-icon",o.icon,"show","smart-description-button"),d.appendChild(e),c.style.width="calc(100% - 25px)"}if(d.appendChild(c),o.info){const e=document.createElement("span");e.classList.add("smart-grid-icon","smart-icon-attention-circled","show","smart-description-button"),e.title=o.info,d.appendChild(e),c.style.width="calc(100% - 25px)"}if(l.appendChild(s),s.classList.add("smart-grid-dialog-field"),s.appendChild(r),s.appendChild(d),o.width&&!t[n+1].width){const e=document.createElement("div");e.style.clear="both",l.appendChild(e)}}}}if(!a.querySelector(".smart-grid-edit-dialog-columns-separator")){const e=document.createElement("div"),t=a.querySelector('[field-name="description"]');t&&l.insertBefore(e,t),e.innerHTML=`<div class="smart-grid-edit-dialog-columns-separator"><span></span><div><div class="show toggle-button smart-flex">${i.localize("less")}<span style="font-family: var(--smart-font-family-icon); font-size: 16px; margin-left: 5px; border:none;" class="show smart-grid-icon smart-icon-sort-up"></span></div></div><span></span></div>`,e.querySelector(".toggle-button").onclick=()=>{const t=e.querySelector(".toggle-button");t.classList.contains("show")?(t.innerHTML=`${i.localize("more")}<span style="font-family: var(--smart-font-family-icon); font-size: 16px; margin-left: 5px; border:none;" class="show smart-grid-icon smart-icon-sort-down"></span>`,t.classList.remove("show"),a.compact=!0):(t.innerHTML=`${i.localize("less")}<span style="font-family: var(--smart-font-family-icon); font-size: 16px; margin-left: 5px; border:none;" class="show smart-grid-icon smart-icon-sort-up"></span>`,t.classList.add("show"),a.compact=!1),i._updateAddColumnDialogCompact(a)}}}_updateAddColumnDialogCompact(e){const t=e.querySelectorAll(".smart-grid-dialog-editor");for(let a=0;a<t.length;a++){const l=t[a],i=l.getAttribute("bind"),n=l.parentNode;switch(i){case"description":case"cellsAlign":case"defaultString":case"defaultNumber":case"defaultDate":case"defaultDateValue":case"setDefaultValue":case"allowResize":case"allowRichText":case"required":case"allowSort":case"allowFilter":case"allowEdit":e.compact?n.classList.add("smart-collapse"):n.classList.remove("smart-collapse")}}}_getDefaultLocales(){return{AED:"ar_AE",AFN:"fa_AF",ALL:"sq",AMD:"hy",ANG:"nl",AOA:"pt_AO",ARS:"es_AR",AUD:"en",AWG:"nl_AW",AZN:"az",BAM:"bs",BBD:"en_BB",BDT:"bn_BD",BGN:"bg",BHD:"ar_BH",BIF:"fr_BI",BMD:"en_BM",BND:"ms_BN",BOB:"es_BO",BRL:"pt_BR",BSD:"en_BS",BTN:"dz",BWP:"en_BW",BYN:"be",BYR:"be",BZD:"en_BZ",CAD:"en_CA",CDF:"fr_CD",CHF:"de_CH",CLP:"es_CL",CNY:"zh_Hans_CN",COP:"es_CO",CRC:"es_CR",CUP:"es_CU",CVE:"pt_CV",CZK:"cs",DJF:"fr_DJ",DKK:"da_DK",DOP:"es_DO",DZD:"ar_DZ",EGP:"ar_EG",ERN:"ti_ER",ETB:"am",EUR:"de",FJD:"en_FJ",FKP:"en_FK",GBP:"en",GEL:"ka",GHS:"en_GH",GIP:"en_GI",GMD:"en_GM",GNF:"fr_GN",GTQ:"es_GT",GYD:"en_GY",HKD:"zh_Hans_HK",HNL:"es_HN",HRK:"hr_HR",HTG:"en",HUF:"hu_HU",IDR:"id",ILS:"he",INR:"en_IN",IQD:"ar_IQ",IRR:"fa_IR",ISK:"is",JMD:"en_JM",JOD:"ar_JO",JPY:"ja",KES:"en_KE",KGS:"ky",KHR:"km",KMF:"ar",KPW:"ko_KP",KRW:"ko_KR",KWD:"ar_KW",KYD:"en_KY",KZT:"kk",LAK:"lo",LBP:"ar_LB",LKR:"si",LRD:"en_LR",LSL:"en_LS",LYD:"ar_LY",MAD:"ar",MDL:"ro",MGA:"fr_MG",MKD:"mk",MMK:"my",MNT:"mn",MOP:"zh",MRO:"ar_MR",MRU:"ar_MR",MUR:"en_MU",MVR:"en",MWK:"en",MXN:"es_MX",MYR:"ms_MY",MZN:"pt_MZ",NAD:"en_NA",NGN:"en_NG",NIO:"es_NI",NOK:"nb_NO",NPR:"ne",NZD:"en_NZ",OMR:"ar_OM",PAB:"es_PA",PEN:"es_PE",PGK:"en_PG",PHP:"fil",PKR:"ur_PK",PLN:"pl",PYG:"es_PY",QAR:"ar_QA",RON:"ro",RSD:"sr",RUB:"ru",RWF:"rw",SAR:"ar_SA",SBD:"en_SB",SCR:"en_SC",SDG:"ar_SD",SEK:"sv_SE",SGD:"en_SG",SHP:"en_SH",SLL:"en_SL",SOS:"so_SO",SRD:"nl_SR",SSP:"en",STD:"pt_ST",STN:"pt_ST",SYP:"ar_SY",SZL:"en_SZ",THB:"th",TJS:"en",TMT:"tk",TND:"ar_TN",TOP:"to",TRY:"tr_TR",TTD:"en_TT",TWD:"zh_Hant_TW",TZS:"sw_TZ",UAH:"uk",UGX:"en_UG",USD:"en_US",UYU:"es_UY",UZS:"uz",VEF:"es_VE",VND:"vi",VUV:"en_BI",WST:"en_AS",XAF:"fr",XCD:"en",XOF:"fr",XPF:"fr_PF",YER:"ar_YE",ZAR:"zu",ZMW:"en_ZM",ZWL:"en_ZW"}}_getLocaleByCurrency(e){const t=this._getDefaultLocales();return t[e]?t[e].replace("_","-"):"en-US"}_getCurrencyByLocale(e){const t=this;if(t._currencyByLocale||(t._currencyByLocale={}),t._currencyByLocale[e])return t._currencyByLocale[e];const a=t._getCurrencies(),l=t._getDefaultLocales(),i=Object.keys(l);for(let n of i)if(l[n].replace("_","-")===e){const l=n;for(let i=0;i<a.length;i++)if(a[i].abbreviation===l){t._currencyByLocale[e]=a[i].sign;break}}return t._currencyByLocale[e]?t._currencyByLocale[e]:null}_getCurrencies(){return[{currency:"US Dollar",sign:"$",abbreviation:"USD"},{currency:"Euro",sign:"€",abbreviation:"EUR"},{currency:"Afghan Afghani",sign:"Af.",abbreviation:"AFN"},{currency:"Albanian Lek",sign:"Lek",abbreviation:"ALL"},{currency:"Algerian Dinar",sign:"din",abbreviation:"DZD"},{currency:"Angolan Kwanza",sign:"Kz",abbreviation:"AOA"},{currency:"Argentine Peso",sign:"$",abbreviation:"ARS"},{currency:"Armenian Dram",sign:"Dram",abbreviation:"AMD"},{currency:"Aruban Florin",sign:"Afl.",abbreviation:"AWG"},{currency:"Australian Dollar",sign:"$",abbreviation:"AUD"},{currency:"Azerbaijani Manat",sign:"₼",abbreviation:"AZN"},{currency:"Bahamian Dollar",sign:"$",abbreviation:"BSD"},{currency:"Bahraini Dinar",sign:"din",abbreviation:"BHD"},{currency:"Bangladeshi Taka",sign:"৳",abbreviation:"BDT"},{currency:"Barbadian Dollar",sign:"$",abbreviation:"BBD"},{currency:"Belarusian Ruble",sign:"р.",abbreviation:"BYN"},{currency:"Belarusian Ruble",sign:"р.",abbreviation:"BYR"},{currency:"Belize Dollar",sign:"$",abbreviation:"BZD"},{currency:"Bermudan Dollar",sign:"$",abbreviation:"BMD"},{currency:"Bhutanese Ngultrum",sign:"Nu.",abbreviation:"BTN"},{currency:"Bolivian Boliviano",sign:"Bs",abbreviation:"BOB"},{currency:"Bosnia-Herzegovina Convertible Mark",sign:"KM",abbreviation:"BAM"},{currency:"Botswanan Pula",sign:"P",abbreviation:"BWP"},{currency:"Brazilian Real",sign:"R$",abbreviation:"BRL"},{currency:"British Pound Sterling",sign:"£",abbreviation:"GBP"},{currency:"Brunei Dollar",sign:"$",abbreviation:"BND"},{currency:"Bulgarian Lev",sign:"лв.",abbreviation:"BGN"},{currency:"Burundian Franc",sign:"FBu",abbreviation:"BIF"},{currency:"Cambodian Riel",sign:"Riel",abbreviation:"KHR"},{currency:"Canadian Dollar",sign:"$",abbreviation:"CAD"},{currency:"Cape Verdean Escudo",sign:"CVE",abbreviation:"CVE"},{currency:"Cayman Islands Dollar",sign:"$",abbreviation:"KYD"},{currency:"CFA Franc BCEAO",sign:"CFA",abbreviation:"XOF"},{currency:"CFA Franc BEAC",sign:"FCFA",abbreviation:"XAF"},{currency:"CFP Franc",sign:"FCFP",abbreviation:"XPF"},{currency:"Chilean Peso",sign:"$",abbreviation:"CLP"},{currency:"Chinese Yuan",sign:"¥",abbreviation:"CNY"},{currency:"Chinese Yuan (offshore)",sign:"¥",abbreviation:"RMB"},{currency:"Colombian Peso",sign:"$",abbreviation:"COP"},{currency:"Comorian Franc",sign:"CF",abbreviation:"KMF"},{currency:"Congolese Franc",sign:"FrCD",abbreviation:"CDF"},{currency:"Costa Rican Colon",sign:"₡",abbreviation:"CRC"},{currency:"Croatian Kuna",sign:"kn",abbreviation:"HRK"},{currency:"Cuban Convertible Peso",sign:"$",abbreviation:"CUC"},{currency:"Cuban Peso",sign:"$",abbreviation:"CUP"},{currency:"Czech Republic Koruna",sign:"Kč",abbreviation:"CZK"},{currency:"Danish Krone",sign:"kr.",abbreviation:"DKK"},{currency:"Djiboutian Franc",sign:"Fdj",abbreviation:"DJF"},{currency:"Dominican Peso",sign:"RD$",abbreviation:"DOP"},{currency:"East Caribbean Dollar",sign:"$",abbreviation:"XCD"},{currency:"Egyptian Pound",sign:"£",abbreviation:"EGP"},{currency:"Eritrean Nakfa",sign:"Nfk",abbreviation:"ERN"},{currency:"Ethiopian Birr",sign:"Birr",abbreviation:"ETB"},{currency:"Falkland Islands Pound",sign:"£",abbreviation:"FKP"},{currency:"Fijian Dollar",sign:"$",abbreviation:"FJD"},{currency:"Gambian Dalasi",sign:"GMD",abbreviation:"GMD"},{currency:"Georgian Lari",sign:"GEL",abbreviation:"GEL"},{currency:"Ghanaian Cedi",sign:"GHS",abbreviation:"GHS"},{currency:"Gibraltar Pound",sign:"£",abbreviation:"GIP"},{currency:"Guatemalan Quetzal",sign:"Q",abbreviation:"GTQ"},{currency:"Guinean Franc",sign:"FG",abbreviation:"GNF"},{currency:"Guyanaese Dollar",sign:"$",abbreviation:"GYD"},{currency:"Haitian Gourde",sign:"HTG",abbreviation:"HTG"},{currency:"Honduran Lempira",sign:"L",abbreviation:"HNL"},{currency:"Hong Kong Dollar",sign:"$",abbreviation:"HKD"},{currency:"Hungarian Forint",sign:"Ft",abbreviation:"HUF"},{currency:"Icelandic Krona",sign:"kr",abbreviation:"ISK"},{currency:"Indian Rupee",sign:"₹",abbreviation:"INR"},{currency:"Indonesian Rupiah",sign:"Rp",abbreviation:"IDR"},{currency:"Iranian Rial",sign:"Rial",abbreviation:"IRR"},{currency:"Iraqi Dinar",sign:"din",abbreviation:""},{currency:"Israeli New Sheqel",sign:" ₪",abbreviation:"ILS"},{currency:"Jamaican Dollar",sign:"$",abbreviation:"JMD"},{currency:"Japanese Yen",sign:"¥",abbreviation:"JPY"},{currency:"Jordanian Dinar",sign:"din",abbreviation:"JOD"},{currency:"Kazakhstani Tenge",sign:"₸",abbreviation:"KZT"},{currency:"Kenyan Shilling",sign:"Ksh",abbreviation:"KES"},{currency:"Kuwaiti Dinar",sign:"din",abbreviation:"KWD"},{currency:"Kyrgystani Som",sign:"KGS",abbreviation:"KGS"},{currency:"Laotian Kip",sign:"₭",abbreviation:"LAK"},{currency:"Lebanese Pound",sign:"L£",abbreviation:"LBP"},{currency:"Lesotho Loti",sign:"LSL",abbreviation:"LSL"},{currency:"Liberian Dollar",sign:"$",abbreviation:"LRD"},{currency:"Libyan Dinar",sign:"din",abbreviation:"LYD"},{currency:"Lithuanian Litas",sign:"Lt",abbreviation:"LTL"},{currency:"Macanese Pataca",sign:"MOP",abbreviation:"MOP"},{currency:"Macedonian Denar",sign:"din",abbreviation:"MKD"},{currency:"Malagasy Ariary",sign:"Ar",abbreviation:"MGA"},{currency:"Malawian Kwacha",sign:"MWK",abbreviation:"MWK"},{currency:"Malaysian Ringgit",sign:"RM",abbreviation:"MYR"},{currency:"Maldivian Rufiyaa",sign:"Rf",abbreviation:"MVR"},{currency:"Mauritanian Ouguiya",sign:"MRO",abbreviation:"MRO"},{currency:"Mauritian Rupee",sign:"MURs",abbreviation:"MUR"},{currency:"Mexican Peso",sign:"$",abbreviation:"MXN"},{currency:"Moldovan Leu",sign:"MDL",abbreviation:"MDL"},{currency:"Mongolian Tugrik",sign:"₮",abbreviation:"MNT"},{currency:"Moroccan Dirham",sign:"dh",abbreviation:"MAD"},{currency:"Mozambican Metical",sign:"MTn",abbreviation:"MZN"},{currency:"Myanma Kyat",sign:"K",abbreviation:"MMK"},{currency:"Namibian Dollar",sign:"$",abbreviation:"NAD"},{currency:"Nepalese Rupee",sign:"Rs",abbreviation:"NPR"},{currency:"Netherlands Antillean Guilder",sign:"NAf.",abbreviation:"ANG"},{currency:"New Taiwan Dollar",sign:"NT$",abbreviation:"TWD"},{currency:"New Zealand Dollar",sign:"$",abbreviation:"NZD"},{currency:"Nicaraguan Cordoba",sign:"C$",abbreviation:"NIO"},{currency:"Nigerian Naira",sign:"₦",abbreviation:"NGN"},{currency:"North Korean Won",sign:"₩KP",abbreviation:"KPW"},{currency:"Norwegian Krone",sign:"kr",abbreviation:"NOK"},{currency:"Omani Rial",sign:"Rial",abbreviation:"OMR"},{currency:"Pakistani Rupee",sign:"Rs",abbreviation:"PKR"},{currency:"Panamanian Balboa",sign:"B/.",abbreviation:"PAB"},{currency:"Papua New Guinean Kina",sign:"PGK",abbreviation:"PGK"},{currency:"Paraguayan Guarani",sign:"Gs.",abbreviation:"PYG"},{currency:"Peruvian Nuevo Sol",sign:"S/.",abbreviation:"PEN"},{currency:"Philippine Peso",sign:"₱",abbreviation:"PHP"},{currency:"Polish Zloty",sign:"zł",abbreviation:"PLN"},{currency:"Qatari Rial",sign:"Rial",abbreviation:"QAR"},{currency:"Romanian Leu",sign:"RON",abbreviation:"RON"},{currency:"Russian Ruble",sign:"₽",abbreviation:"RUB"},{currency:"Rwandan Franc",sign:"RF",abbreviation:"RWF"},{currency:"Saint Helena Pound",sign:"£",abbreviation:"SHP"},{currency:"Samoan Tala",sign:"WST",abbreviation:"WST"},{currency:"Sao Tomean Dobra",sign:"Db",abbreviation:"STD"},{currency:"Saudi Riyal",sign:"Rial",abbreviation:"SAR"},{currency:"Serbian Dinar",sign:"din",abbreviation:"RSD"},{currency:"Seychellois Rupee",sign:"SCR",abbreviation:"SCR"},{currency:"Sierra Leonean Leone",sign:"SLL",abbreviation:"SLL"},{currency:"Singapore Dollar",sign:"$",abbreviation:"SGD"},{currency:"Solomon Islands Dollar",sign:"$",abbreviation:"SBD"},{currency:"Somali Shilling",sign:"SOS",abbreviation:"SOS"},{currency:"South African Rand",sign:"R",abbreviation:"ZAR"},{currency:"South Korean Won",sign:"₩",abbreviation:"KRW"},{currency:"South Sudanese Pound",sign:"£",abbreviation:"SSP"},{currency:"Sri Lankan Rupee",sign:"Rs",abbreviation:"LKR"},{currency:"Sudanese Pound",sign:"SDG",abbreviation:"SDG"},{currency:"Surinamese Dollar",sign:"$",abbreviation:"SRD"},{currency:"Swazi Lilangeni",sign:"SZL",abbreviation:"SZL"},{currency:"Swedish Krona",sign:"kr",abbreviation:"SEK"},{currency:"Swiss Franc",sign:"CHF",abbreviation:"CHF"},{currency:"Syrian Pound",sign:"£",abbreviation:"SYP"},{currency:"Tajikistani Somoni",sign:"Som",abbreviation:"TJS"},{currency:"Tanzanian Shilling",sign:"TSh",abbreviation:"TZS"},{currency:"Thai Baht",sign:"฿",abbreviation:"THB"},{currency:"Tongan Pa'anga",sign:"T$",abbreviation:"TOP"},{currency:"Trinidad and Tobago Dollar",sign:"$",abbreviation:"TTD"},{currency:"Tunisian Dinar",sign:"din",abbreviation:"TND"},{currency:"Turkish Lira",sign:"₺",abbreviation:"TRY"},{currency:"Turkmenistani Manat",sign:"m",abbreviation:"TMT"},{currency:"Ugandan Shilling",sign:"UGX",abbreviation:"UGX"},{currency:"Ukrainian Hryvnia",sign:"грн.",abbreviation:"UAH"},{currency:"United Arab Emirates Dirham",sign:"dh",abbreviation:"AED"},{currency:"Uruguayan Peso",sign:"$",abbreviation:"UYU"},{currency:"Uzbekistan Som",sign:"soʼm",abbreviation:"UZS"},{currency:"Vanuatu Vatu",sign:"VUV",abbreviation:"VUV"},{currency:"Venezuelan Bolivar",sign:"Bs",abbreviation:"VEF"},{currency:"Venezuelan Bolivar",sign:"Bs",abbreviation:"VES"},{currency:"Vietnamese Dong",sign:"₫",abbreviation:"VND"},{currency:"Yemeni Rial",sign:"Rial",abbreviation:"YER"},{currency:"Zambian Kwacha",sign:"ZMW",abbreviation:"ZMW"},{currency:"Zimbabwean Dollar",sign:"$",abbreviation:"ZWD"}].map((e=>(e.label=e.currency,e.menuLabel='<div style="display: flex; justify-content: space-between;"><span>'+e.currency+'</span><span style="opacity: 0.7;">'+e.sign+" 1,000.00</span></div>",e.value=e.abbreviation,e)))}_openAddStackColumnDialog(e,t,a){const l=this,i=l._dialogAddStackColumn||l._createDialog(l.editing.addColumnDialog),n=e?l.localize("dialogEditColumn",{value:e.label}):l.localize("dialogAddColumn"),o=i.querySelector(".smart-footer").querySelector(".smart-stack-layout"),s=l._getAddStackColumnDialogTemplate();i.classList.add("smart-grid-dialog-add-column"),i.type="add",i.editColumn=e||null,e&&e.element&&e.element.setAttribute("focus",""),o.classList.remove("right"),o.classList.add("center"),l._cellEditors||(l._cellEditors=[]),i.header.innerHTML=n,i.header.parentElement.classList.add("smart-hidden"),i.callback=a,!0===t&&(i.header.parentElement.classList.remove("smart-hidden"),"kanban"===l.view?(i.header.innerHTML=l.localize("dialogAddColumnStatus"),i.header.parentElement.querySelector(".smart-close-button").classList.add("smart-hidden"),i.classList.add("view")):i.classList.remove("kanban")),i.stackLabel&&i.stackLabel.classList.add("smart-hidden"),l.cancelEdit(),i.content&&(i.content.innerHTML="");const r=document.createElement("div");r.classList.add("smart-content-layout-container"),i.content.appendChild(r),l._addStackColumnDialogEditors=[];const d=l._addStackColumnDialogEditors;if(l._initAddColumnDialogEditors(d,s,i,r),!l._dialogAddStackColumn){i.modal=!0,i.btnConfirm.innerHTML=l.localize("dialogEditButtonConfirm"),i.btnCancel.innerHTML=l.localize("dialogEditButtonCancel"),i.onOpen=function(){const e=l._dialogAddStackColumn,t=l._getAddStackColumnDialogTemplate(),a=l._addStackColumnDialogEditors;l._addColumnDialogInitEditors(e,t,a),l._addColumnDialogShowHideEditors(e);const i=l.offset(l.$.columnHeader),n=l.$.columnHeader.offsetHeight,o=l.offset(l);if(e.style.maxHeight="",e.style.minHeight="",i.top+n+e.offsetHeight>window.innerHeight-o.top){const t=n+i.top+e.offsetHeight-window.innerHeight+o.top;e.style.maxHeight=Math.max(250,e.offsetHeight-t)+"px",e.style.minHeight="250px"}else e.style.maxHeight="",e.style.minHeight=""},i.onClose=function(){i.editColumn&&i.editColumn.element&&i.editColumn.element.removeAttribute("focus"),i.classList.remove("view"),i.callback&&i.callback(i.result)},i.btnCancel.onclick=function(){i.result=!1,i.close()},i.btnClose.onclick=function(){i.result=!1,i.close()},i.btnConfirm.onclick=function(){l._confirmAddColumnDialog(i),i.result=!0,i.close()},i.onkeydown=function(e){"Escape"===e.key&&(i.result=!1,i.close())},l._dialogAddStackColumn=i;const e=document.createElement("div");e.classList.add("smart-content-layout-container"),i.content.appendChild(e)}const c=()=>{if(window.screen.availWidth<400)return i.open("left","top"),i.style.width=l.offsetWidth+"px",void(i.style.height=l.offsetHeight+"px");{const e=l.editing.addColumnDialog;i.style.width="auto"===e.width?e.width:e.width+"px",i.style.height="auto"===e.height?e.height:e.height+"px"}i.open("center","center"),setTimeout((()=>{i.btnConfirm.focus()}),100),i.classList.add("center")};c(),i.refresh=()=>{c()}}_openImagePreviewDialog(e){const t=this,a=e?[...e.parentNode.parentNode.querySelectorAll("img")]:[];let l=e.hasAttribute("data-url")?e.getAttribute("data-url"):e.src;if((e=e.cloneNode()).src=l,!t._dialogImagePreview){t._dialogImagePreview=t._createDialog({modal:!0,screenModal:!0,left:"screenMiddle",top:"screenCenter",width:"80%",height:"80%"}),t._dialogImagePreview.content.innerHTML='<div style="width: 100%; height: 100%;"><div class="images-container"></div><div class="image-preview"></div></div>';const e=t._dialogImagePreview.content.firstElementChild;e.style.display="grid",e.style.gridTemplateColumns="50px 1fr"}const i=t._dialogImagePreview.querySelector(".images-container");i.innerHTML="";const n=(e,a)=>{e.width=e.naturalWidth,e.height=e.naturalHeight;const l=150+Math.min(850,e.naturalWidth),i=150+Math.min(650,e.naturalHeight);t._dialogImagePreview.style.width=l+"px",t._dialogImagePreview.style.height=i+"px",!1!==a&&(t._dialogImagePreview.style.left="calc(50% - "+Math.min(850,t._dialogImagePreview.offsetWidth/2)+"px)",t._dialogImagePreview.style.top="calc(50% - "+Math.min(650,t._dialogImagePreview.offsetHeight/2)+"px)");const n=getComputedStyle(t._dialogImagePreview),o=parseInt(n.top),s=parseInt(n.left);if((window.offsetWidth<l||window.offsetHeight<i||o<0||s<0)&&(t._dialogImagePreview.style.left="0px",t._dialogImagePreview.style.top="0px",t._dialogImagePreview.style.width="100%",t._dialogImagePreview.style.height="100%"),o+i>window.innerHeight){const e=o+i-window.innerHeight;t._dialogImagePreview.style.height=i-e-20+"px"}e.style.maxWidth="100%",e.style.objectFit="contain",e.style.width="100%",e.style.height="calc(100% - 10px)"},o=()=>{const e=t._dialogImagePreview.querySelector(".images-container");let a=-1;return e.querySelectorAll("img").forEach(((e,t)=>{if(e.hasAttribute("active"))return a=t,!0})),a},s=e=>{const a=t._dialogImagePreview.querySelector(".images-container");e&&(e.hasAttribute("active")||a.querySelectorAll("img").forEach((t=>{t.style.borderColor="transparent",t.removeAttribute("active");let a=t.hasAttribute("data-url")?t.getAttribute("data-url").replaceAll("\\","/"):"";if(t.src===e.src||a===e.src){t.style.borderColor="var(--smart-primary)",t.setAttribute("active","");let e=t.src;t.hasAttribute("data-url")&&(e=t.getAttribute("data-url")),r.innerHTML=`<img src="${e}"/>`;const a=r.querySelector("img");a.onload=()=>{n(a,!1)}}})))};if(a.length>1)for(let t=0;t<a.length;t++){const l=a[t].cloneNode();l.style.width="40px",l.style.height="40px",l.style.cursor="pointer",l.style.borderStyle="solid",l.style.borderWidth="1px",l.style.borderColor="transparent",l.style.borderRadius="var(--smart-border)",l.style.marginTop="10px",l.classList.remove("smart-hidden"),l.title=a[t].title||a[t].parentNode.title,a[t].src===e.src&&(l.style.borderColor="var(--smart-primary)",l.setAttribute("active","")),i.appendChild(l),l.onmouseenter=()=>{l.style.borderColor="var(--smart-primary)"},l.onmouseleave=()=>{l.hasAttribute("active")||(l.style.borderColor="transparent")},l.onclick=()=>{s(l)}}const r=t._dialogImagePreview.content.querySelector(".image-preview");r.innerHTML="",r.style.overflow="auto",r.appendChild(e),t._dialogImagePreview.btnClose.onclick=e=>{t._dialogImagePreview.close(),e.preventDefault(),e.stopPropagation()},e.style.marginLeft="auto",e.style.marginRight="auto",e.style.maxWidth="",e.style.width="",e.style.height="",e.onload=()=>{n(e)},t._dialogImagePreview.content.onpointerdown=t._dialogImagePreview.content.onpointerup=e=>{e.preventDefault(),e.stopPropagation()},t._dialogImagePreview.onkeydown=function(e){if("Escape"===e.key&&t._dialogImagePreview.close(),"ArrowUp"===e.key||"ArrowLeft"===e.key){const t=o();s(a[t-1]),e.stopPropagation(),e.preventDefault()}else if("ArrowDown"===e.key||"ArrowRight"===e.key){const t=o();s(a[t+1]),e.stopPropagation(),e.preventDefault()}},t._dialogImagePreview.btnClose.tabIndex=0,t._dialogImagePreview.onOpen=()=>{setTimeout((()=>{t._dialogImagePreview.btnClose.focus()}),100)},t._dialogImagePreview.footer.remove(),t._dialogImagePreview.header.parentNode.style.backgroundColor="var(--smart-background)",t._dialogImagePreview.open(),e&&s(e)}_getFileFromBase64(e,t){let a=e.split(","),l=a[0].match(/:(.*?);/)[1],i=atob(a[1]),n=i.length,o=new Uint8Array(n);for(;n--;)o[n]=i.charCodeAt(n);return new File([o],t,{type:l})}_getBase64(e,t){var a=new FileReader;a.readAsDataURL(e),a.onload=function(){t(a.result)},a.onerror=function(){t("error")}}_findIsFile(e){return"string"==typeof e&&(e.indexOf("http")>=0||e.indexOf("base64")>=0||e.indexOf('[{"value":"/')>=0)}_findUserFile(e){const t=this;if(e&&e.value.startsWith("/"))return!0;if(t.uploadSettings.userFiles)for(let a=0;a<t.uploadSettings.userFiles.length;a++){const l=t.uploadSettings.userFiles[a];if(l){let t=e.name||e.label;if(!t&&!e.label&&e.value){const a=e.value.split("/");t=a[a.length-1]}if(l.label===t)return l;if(l.label.indexOf("_")>=0&&(l.label.substring(0,l.label.lastIndexOf("_"))+l.label.substring(l.label.indexOf("."))).indexOf(t)>=0)return l;const a=l.value.replaceAll("\\","/");if(a===e.value||a===e.url)return l}}return null}_removeFiles(){const e=this,t=e._dialogFile,a=(t.preview.querySelectorAll(".item"),t.fileUpload),l=t.cell.value&&t.cell.value.indexOf("[{")>=0?JSON.parse(t.cell.value):[];if(e.uploadSettings.removeUrl){let i=new FormData,n=new XMLHttpRequest;for(let n=0;n<a.files.length;n++){let o=l[n]?l[n]:e.uploadSettings.url+"/"+a.files[n].name;if(t&&t.cell&&t.cell.value&&t.cell.value.indexOf("[")>=0){const e=JSON.parse(t.cell.value);for(let t=0;t<e.length;t++)if(e[t].label===a.files[n].name){o=e[t].value;break}}e._findUserFile(a.files[n])||i.append(e.uploadSettings.name,a.files[n])}for(let a=0;a<t.uploadedWithLink.length;a++){const l=t.uploadedWithLink[a];e._findUserFile(l)||i.append(e.uploadSettings.name,l)}n.open("POST",e.uploadSettings.removeUrl),n.send(i)}if(e.uploadSettings.onUploadRemove){const l=t.cell.value&&t.cell.value.indexOf("[{")>=0?JSON.parse(t.cell.value):[];for(let t=0;t<a.files.length;t++)l&&l[t]?e.uploadSettings.onUploadRemove(l[t]):e.uploadSettings.removeUrl&&e.uploadSettings.onUploadRemove(e.uploadSettings.removeUrl+"/"+a.files[t].name)}t.uploadedWithLink=[],a.value="",t.input.value="",e._updateFilePreview(),t.tabs[2].classList.contains("active")&&t.tabs[2].click()}_removeFile(e){const t=this,a=t._dialogFile,l=a.preview.querySelectorAll(".item"),i=e.name||e.label,n=a.fileUpload,o=new DataTransfer;l.forEach((e=>{let t=!0;e.file.name!==i&&e.file.label!==i||(t=!1),e.file.value&&(t=!1),t&&o.items.add(e.file)})),n.files=o.files,a.clearButton&&0===l.length&&a.clearButton.classList.remove("show");let s=t.uploadSettings.url+"/"+i;if(a&&a.cell&&a.cell.value&&a.cell.value.indexOf("[")>=0){const e=JSON.parse(a.cell.value);for(let t=0;t<e.length;t++)if(e[t].label===i){s=e[t].value;break}}let r=-1;for(let e=0;e<a.uploadedWithLink.length;e++){const t=a.uploadedWithLink[e];if(t&&t.label===i){r=e;break}}if(r>=0&&a.uploadedWithLink.splice(r,1),t.uploadSettings.userFiles)for(let e=0;e<t.uploadSettings.userFiles.length;e++){const l=t.uploadSettings.userFiles[e];if(l&&l.label===i)return void(a.tabs[2].classList.contains("active")&&a.tabs[2].click())}if(t.uploadSettings.onUploadRemove){let e=s;t.uploadSettings.onUploadRemove(e)}if(t.uploadSettings.removeUrl){let e=new FormData,a=new XMLHttpRequest;e.append(t.uploadSettings.name,s),a.open("POST",t.uploadSettings.removeUrl),a.send(e)}}getFileTypes(e){return e?["image/apng","image/bmp","image/gif","image/jpeg","image/jpg","image/pjpeg","image/png","image/svg+xml","image/tiff","image/webp","image/x-icon","video/x-msvideo","text/csv","application/msword","application/vnd.openxmlformats-officedocument.wordprocessingml.document","application/vnd.ms-fontobject","image/gif","application/json","text/plain","application/xml","application/zip","application/gzip","application/pdf","application/vnd.ms-powerpoint","application/vnd.openxmlformats-officedocument.presentationml.presentation","application/x-7z-compressed","application/vnd.rar","application/rtf","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet","application/x-zip-compressed"]:["image/apng","image/bmp","image/gif","image/jpeg","image/jpg","image/pjpeg","image/png","image/svg+xml","image/tiff","image/webp","image/x-icon"]}_getFileSize(e){return"string"==typeof e?e:e<1024?e+"bytes":e>=1024&&e<1048576?((e/1024).toFixed(1)+"KB").replace(".0",""):e>=1048576?(e/1048576).toFixed(1)+"MB":void 0}_getFileListItem(e){const t=this,a=t._dialogFile,l=a.acceptFiles,i=document.createElement("div");e.name||(e.name=e.label);const n=e.size||0;i.classList.add("item"),i.onpointerdown=n=>{const o=i.getBoundingClientRect();if(a.input.value="",n.clientY>=o.bottom-12)n.clientX>o.left+o.width/2-13&&n.clientX<o.left+o.width/2+13&&(i.remove(),t._removeFile(i.file));else if(l){if(e.value){const t=document.createElement("a");return t.href=e.value,t.target="_blank",void t.click()}const t=URL.createObjectURL(e),a=document.createElement("a");a.download=e.name,a.href=t,a.click()}else t._openImagePreviewDialog(i.querySelector("img"))};const o=document.createElement("div"),s=n?`, ${t._getFileSize(e.size)}.`:"";let r;return o.textContent=o.textContentTitle=`${e.name}${s}`,o.textContent.length>20&&(o.textContent=`${e.name.substring(0,5)}...${e.name.substring(e.name.length-4)} ${s}`),a.objectURL||(a.objectURL=[]),a.objectURL[e.name+"_"+n]||(e.small?a.objectURL[e.name+"_"+n]=e.small?e.small:URL.createObjectURL(e):e.medium?a.objectURL[e.name+"_"+n]=e.medium?e.medium:URL.createObjectURL(e):a.objectURL[e.name+"_"+n]=e.value?e.value:URL.createObjectURL(e)),l?(r=document.createElement("div"),r.classList.add("attachment","smart-grid-icon","show"),e.name.indexOf(".pdf")>=0?r.classList.add("smart-icon-pdf"):e.name.indexOf(".png")>=0||e.name.indexOf(".jpg")>=0||e.name.indexOf(".jpeg")>=0||e.name.indexOf(".gif")>=0?r.classList.add("smart-icon-image"):e.name.indexOf(".tsv")>=0||e.name.indexOf(".txt")>=0||e.name.indexOf(".csv")>=0?r.classList.add("smart-icon-text"):e.name.indexOf(".xls")>=0||e.name.indexOf(".xlsx")>=0?r.classList.add("smart-icon-excel"):e.name.indexOf(".ppt")>=0?r.classList.add("smart-icon-powerpoint"):e.name.indexOf(".zip")>=0||e.name.indexOf(".rar")>=0||e.name.indexOf(".7z")>=0?r.classList.add("smart-icon-archive"):e.name.indexOf(".doc")>=0||e.name.indexOf(".docx")>=0?r.classList.add("smart-icon-word"):r.classList.add("smart-icon-file")):(r=document.createElement("img"),r.loading="lazy",r.src=a.objectURL[e.name+"_"+n],r.onerror=()=>{if(i.style.display="none",a.uploadedWithLink.length){const t=a.uploadedWithLink.indexOf(e);t>=0&&a.uploadedWithLink.splice(t,1)}}),i.file=e,i.title=o.textContentTitle||o.textContent,i.appendChild(r),i.appendChild(o),i}_updateFilePreview(){const e=this,t=e._dialogFile,a=t.preview,l=t.fileUpload;for(;a.firstChild;)a.removeChild(a.firstChild);const i=()=>{const l=document.createElement("div");l.classList.add("list");const i=document.createElement("div");i.classList.add("smart-grid-icon","show","smart-icon-delete"),i.title=e.localize("clear"),a.appendChild(i),i.onclick=()=>{e._removeFiles()},t.clearButton=i,a.appendChild(l)},n=l.files;if(0===n.length)if(0===t.uploadedWithLink.length){const t=document.createElement("p");t.textContent=e.localize("dialogFileFileUpload"),a.appendChild(t)}else i();else{i();const o=new DataTransfer,s=t.column.editor.maxImages||e.uploadSettings.uploadMaxCount||5,r=t.column.editor.maxImageSize||e.uploadSettings.uploadMaxSize||524288;let d=0,c=[];for(const l of n){if(!e._validateFileType(l))continue;const i=e._getFileListItem(l);if(d>=s)c.push(l.name);else if(l.size>r){const t=document.createElement("p");t.textContent=t.textContentTitle=e.localize("dialogFileSize",{value:l.name,fileSize:e._getFileSize(r)}),a.appendChild(t)}else o.items.add(l),t.preview.querySelector(".list").appendChild(i),d++}if(c.length>0){const t=document.createElement("p");t.textContent=e.localize("dialogFileCount",{files:c.toString(),fileCount:s}),a.appendChild(t)}l.files=o.files}if(t.uploadedWithLink&&t.uploadedWithLink.length)for(let a=0;a<t.uploadedWithLink.length;a++){const l=t.uploadedWithLink[a];if(l){const a=e._getFileListItem(l);l.name=l.label,a.file=l,t.preview.lastChild.appendChild(a)}}}_validateFileType(e){return this.getFileTypes(this._dialogFile.acceptFiles).includes(e.type)}_getFileIndex(e){const t=this._dialogFile;let a=-1;for(let l=0;l<t.uploadedWithLink.length;l++){const i=t.uploadedWithLink[l];if(i.label===e.name||i.label===e.label&&(void 0!==i.label||void 0!==e.label)){a=l;break}if(i.name===e.name||i.name===e.label){a=l;break}if(e.label.indexOf(i.name.substring(0,i.name.indexOf(".")))>=0){a=l;break}}for(let l=0;l<t.fileUpload.files.length;l++){const i=t.fileUpload.files[l];if(i.label===e.name||i.label===e.label&&(void 0!==i.label||void 0!==e.label)){a=l;break}if(i.name===e.name||i.name===e.label){a=l;break}if(e.label&&e.label.indexOf(i.name.substring(0,i.name.indexOf(".")))>=0){a=l;break}if(e.name&&e.name.indexOf(i.name.substring(0,i.name.indexOf(".")))>=0){a=l;break}}return a}_openFileDialog(e,t=!1){const a=this,l=a._dialogFile||a._createDialog(),i='<span class="smart-grid-icon '+(!1===t?"smart-icon-image":"smart-icon-docs")+' show"></span>'+(!1===t?a.localize("dialogImageFileHeader"):a.localize("dialogFileHeader"));if(l.cell=e,l.header.innerHTML=i,l.column=e.column,l.acceptFiles=t,l.classList.add("smart-grid-image-dialog"),!a._dialogFile){l.modal=!0,l.btnConfirm.innerHTML=a.localize("dialogEditButtonConfirm"),l.btnCancel.innerHTML=a.localize("dialogEditButtonCancel");const e=()=>{l.loader&&l.loader.classList.add("smart-hidden"),l.close()};l.onOpen=function(){l.fileUpload.value="",l.input.value="",l.uploadedWithLink=[];let e=l.cell.editor.instance.getValue();if("[]"===e)return void l.tabs[0].click();l.tabs[0].click();let t=!0;const i=new DataTransfer;if("string"==typeof e&&e.indexOf("base64")>=0||"string"==typeof e&&e.indexOf("[{")>=0?e=JSON.parse(e):"string"==typeof e&&e.indexOf("./")>=0&&(e=e.split(","),e=e.map((e=>({label:e,value:e})))),Array.isArray(e)){let n=0;e.forEach((async o=>{if(t=!1,"string"==typeof o.value&&o.value.indexOf("base64")>=0&&(t=!0),t)i.items.add(a._getFileFromBase64(o.value,o.label));else{const t=(t,i)=>{a.uploadSettings.url&&(a._findUserFile(t)?(l.uploadedWithLink.push(t),n++,n===e.length&&a._updateFilePreview()):i("error"))};o.value.indexOf(window.location.host)>=0?t(o,(t=>{"error"!==t&&i.items.add(t),n++,n===e.length&&(l.fileUpload.files=i.files,a._updateFilePreview())})):(l.uploadedWithLink.push(o),n++,n===e.length&&a._updateFilePreview())}})),l.fileUpload.files=i.files,a._updateFilePreview()}else a._updateFilePreview()},l.onClose=function(){},l.btnCancel.onclick=function(){l.close()},l.btnClose.onclick=function(){l.close()},l.btnConfirm.onclick=function(){let i=[],n=[...l.fileUpload.files];l.loader?l.loader.classList.remove("smart-hidden"):(l.loader=document.createElement("div"),l.loader.classList.add("smart-grid-loader"),l.loader.style.width=l.loader.style.height="24px",l.btnConfirm.parentNode.insertBefore(l.loader,l.btnConfirm)),l.uploadedWithLink&&l.uploadedWithLink&&l.uploadedWithLink.length&&(i=i.concat(l.uploadedWithLink)),(()=>{if(l.cell.value&&"string"==typeof l.cell.value){const e=JSON.parse(l.cell.value);e&&e.length&&(n=n.filter((t=>{let a=!0;return e.forEach((e=>{if(e.label===t.name&&(a=!1,!a)){const t={value:e.value,label:e.label};e.small&&(t.small=e.small),e.medium&&(t.medium=e.medium),e.large&&(t.large=e.large),i.push(t)}})),a})))}})();const o=()=>{const t=l.cell.value;l.cell.editor.instance.setValue(i),!(a.editing.dialog.enabled&&a.editing.dialog.visible)&&(a._endCellEdit(l.cell),a._handleFileColumnHistory(l.cell.row,l.cell.column.dataField,t,i)),e()};if(a.uploadSettings.url){const s=(t,i)=>{const n=t.filter((e=>-1!==e.value.indexOf(window.location.host)));if(i&&i[0]&&"error"===i[0].response&&(a.cancelEdit(),e()),n.length===l.fileUpload.files.length+l.uploadedWithLink.length){(i.files||i[0])&&a.uploadSettings.onUploadCompleted&&a.uploadSettings.onUploadCompleted({files:l.fileUpload.files,status:200,serverResponse:i});const t=l.cell.column.dataField;let o=l.cell.value;l.cell.editor.instance.setValue(n),!(a.editing.dialog.enabled&&a.editing.dialog.visible)&&(a._endCellEdit(l.cell),a._handleFileColumnHistory(l.cell.row,t,o,n)),e()}};if(0===n.length&&0===l.uploadedWithLink.length)l.cell.editor.instance.setValue(i),!(a.editing.dialog.enabled&&a.editing.dialog.visible)&&a._endCellEdit(l.cell),e();else if(a.uploadSettings.singleFilePost){let e=!1;for(let o=0;o<n.length;o++){const r=[];r.push(n[o]),a._handleFileUpload(l,r,i,t?"file":"image",s),e=!0}for(let t=0;t<l.uploadedWithLink.length;t++){const n=[];a._findUserFile(l.uploadedWithLink[t])||(n.push(l.uploadedWithLink[t].value),a._handleFileUpload(l,n,i,"url",s),e=!0)}e||o()}else if(n.length&&a._handleFileUpload(l,n,i,t?"file":"image",s),l.uploadedWithLink.length){const e=l.uploadedWithLink.filter((e=>!a._findUserFile(e)));if(e.length){const t=e.map((e=>e.value));a._handleFileUpload(l,t,i,"url",s)}else i.length===l.fileUpload.files.length+l.uploadedWithLink.length&&o()}}else{let e=0;for(let t=0;t<n.length;t++){const l=n[t];a._getBase64(l,(t=>{"error"===t&&console.log("Image load error"),e++,i.push({value:t,label:l.name}),e===n.length&&o()}))}0===n.length&&o()}},l.onkeydown=function(e){"Escape"===e.key&&l.close()},a._dialogFile=l,l.content.innerHTML=`\n <div>\n <div>\n <div class="tabs">\n <div class="active tab">\n <span class="smart-grid-icon smart-icon-plus show"></span><label>${a.localize("dialogFileDevice")}</label>\n </div>\n <div class="tab">\n <span class="smart-grid-icon smart-icon-link show"></span><label>${a.localize("dialogFileLink")}</label>\n </div>\n <div class="tab">\n <span class="smart-grid-icon smart-icon-cloud show"></span><label>${a.localize("dialogMyFiles")}</label>\n </div>\n </div>\n </div>\n <div class="smart-grid-drop-zone">\n <div>\n <div class="title"><span class="smart-grid-icon smart-icon-plus show"></span><label>${a.localize("dialogFileUpload")}</label></div>\n <div class="subtitle"><span class="smart-grid-icon smart-icon-docs show"></span><label>${a.localize("dialogFileDrop")}</label></div>\n </div> \n <input accept=".jpg, .jpeg, .png" type="file" multiple="multiple" style="display: none;">\n </div>\n <div class="smart-hidden url-zone">\n <div class="url-title">\n ${a.localize("dialogFileURL")}\n </div>\n <div class="upload">\n <smart-input placeholder="https://example.com/image.png" class="underlined"></smart-input>\n <br/>\n <smart-button disabled class="success">${a.localize("dialogFileURLUpload")}</smart-button>\n </div>\n </div>\n <div class="smart-hidden smart-grid-file-zone">\n \n <div class="files">\n </div>\n <div class="subtitle"><span class="smart-grid-icon smart-icon-attention-circled show"></span><label>${a.localize("dialogMyFilesTitle")}</label></div>\n </div>\n <div class="preview">\n </div>\n <br/>\n </div>`,l.input=l.querySelector("smart-input"),l.dropZone=l.querySelector(".smart-grid-drop-zone"),l.upload=l.querySelector(".title"),l.fileUpload=l.querySelector("input"),l.preview=l.querySelector(".preview"),l.tabs=l.querySelectorAll(".tab"),l.urlZone=l.querySelector(".url-zone"),l.fileZone=l.querySelector(".smart-grid-file-zone"),l.files=l.querySelector(".smart-grid-file-zone .files"),l.uploadButton=l.querySelector("smart-button"),l.input.accept=t?".jpg, .jpeg, .png, .pdf, .xls, .xlsx, .doc, .docx, .gif, .csv, .txt, .xml, .zip, .rtf, .ppt, .pptx, .avi, .html, .htm":".jpg, .jpeg, .png, .gif",l.dropZone.ondrop=l.dropZone.dropHere=e=>{if(e.preventDefault(),e.dataTransfer.items){let t=0;const i=l.column.editor.maxImages||5;for(let l=0;l<e.dataTransfer.items.length;l++)if("file"===e.dataTransfer.items[l].kind){const i=e.dataTransfer.items[l].getAsFile();a._validateFileType(i)&&t++}if(t===e.dataTransfer.files.length||t===i){const t=new DataTransfer;let n=[...e.dataTransfer.files],o=[...l.fileUpload.files];n.length>i&&(n=n.slice(0,5)),o.length>i&&(o=o.slice(0,5)),o.forEach(((e,a)=>{a<i&&t.items.add(e)})),n.forEach(((e,a)=>{a<i&&t.items.add(e)})),l.fileUpload.files=t.files,a._updateFilePreview()}}else l.fileUpload.files=e.dataTransfer.files,a._updateFilePreview()},l.dropZone.ondragover=e=>{e.preventDefault()},l.tabs[0].onclick=()=>{l.tabs[0].classList.add("active"),l.tabs[1].classList.remove("active"),l.tabs[2].classList.remove("active"),l.dropZone.classList.remove("smart-hidden"),l.fileZone.classList.add("smart-hidden"),l.urlZone.classList.add("smart-hidden")},l.tabs[1].onclick=()=>{l.tabs[0].classList.remove("active"),l.tabs[1].classList.add("active"),l.tabs[2].classList.remove("active"),l.dropZone.classList.add("smart-hidden"),l.fileZone.classList.add("smart-hidden"),l.urlZone.classList.remove("smart-hidden")},l.tabs[2].onclick=()=>{if(l.tabs[0].classList.remove("active"),l.tabs[1].classList.remove("active"),l.tabs[2].classList.add("active"),l.dropZone.classList.add("smart-hidden"),l.urlZone.classList.add("smart-hidden"),l.fileZone.classList.remove("smart-hidden"),l.files.innerHTML="",a.uploadSettings.userFiles&&a.uploadSettings.userFiles.length){const e=document.createDocumentFragment();a.uploadSettings.userFiles.forEach((t=>{Array.isArray(t)&&(t=t[0]);let i=t;"string"==typeof t.value&&t.value.indexOf("base64")>=0&&(t=a._getFileFromBase64(t.value,t.label)),t.type||(t.type="unknown");const n=a._getFileListItem(t);a._validateFileType(t)&&(a._getFileIndex(t)>=0&&n.classList.add("active"),n.onpointerdown=()=>{n.classList.toggle("active");let e=a._getFileIndex(t);n.classList.contains("active")?e<0&&l.uploadedWithLink.push({label:i.name||i.label,value:i.value}):a._removeFile(i),a._updateFilePreview()},e.appendChild(n))})),l.files.appendChild(e)}},l.uploadButton.onclick=()=>{const e=this,t=l.input.value,a=t.split("/"),i=a[a.length-1];if(l.column&&l.column.editor&&e.uploadSettings.url){const a={value:t,label:i},n=e._findUserFile(a);for(let e=0;e<l.uploadedWithLink.length;e++){if(l.uploadedWithLink[e].label===i)return;if(n&&l.uploadedWithLink[e].label===n.label)return}l.uploadedWithLink.push(n||a),e._updateFilePreview()}else{const a={value:t,label:i};for(let e=0;e<l.uploadedWithLink.length;e++)if(l.uploadedWithLink[e].label===i)return;l.uploadedWithLink.push(a),e._updateFilePreview()}l.input.value="",l.uploadButton.disabled=!0},l.fileUpload.onchange=()=>{if(0===l.fileUpload.files.length&&l._tempFiles)l.fileUpload.files=l._tempFiles;else if(l._tempFiles){const e=new DataTransfer,t=[...l.fileUpload.files],i=[...l._tempFiles];i.forEach((t=>{e.items.add(t)})),t.forEach((t=>{let l=!0;a._validateFileType(t)||(l=!1),i.forEach((e=>{e.name===t.name&&e.size===t.size&&e.lastModified===t.lastModified&&(l=!1)})),l&&e.items.add(t)})),l.fileUpload.files=e.files}a._updateFilePreview()},l.input.onchange=l.input.onblur=l.input.onkeyup=()=>{l.uploadButton.disabled=!l.input.value||!l.input.value.startsWith("https://");const e=l.input.value,t=e.split("/"),i=t[t.length-1];if(l.column&&l.column.editor&&a.uploadSettings.url){const t={value:e,label:i},n=a._findUserFile(t);for(let e=0;e<l.uploadedWithLink.length;e++)l.uploadedWithLink[e].label===i&&(l.uploadButton.disabled=!0),n&&l.uploadedWithLink[e].label===n.label&&(l.uploadButton.disabled=!0)}},l.upload.onclick=()=>{l._tempFiles=[];const e=new DataTransfer;[...l.fileUpload.files].forEach((t=>{e.items.add(t)})),l._tempFiles=e.files,l.fileUpload.click()}}l.fileUpload.accept=t?".jpg, .jpeg, .png, .pdf, .xls, .xlsx, .doc, .docx, .gif, .csv, .txt, .xml, .zip, .rtf, .ppt, .pptx, .avi, .html, .htm":".jpg, .jpeg, .png, .gif",l.open(),setTimeout((function(){l.btnConfirm.focus()}),100)}_handleFileUpload(e,t,a,l,i){const n=this;if(l||(l="image"),e.column&&e.column.editor&&n.uploadSettings.url){const o=new FormData,s=n.uploadSettings.url;let r=!1;const d=t[0],c=n.uploadSettings.data;c&&""!==c&&("string"==typeof c?o.append("postData",c):o.append("postData",JSON.stringify(c))),o.append("fileType",l);for(let e=0;e<t.length;e++)o.append(n.uploadSettings.name,t[e]),r=!0;let u=new XMLHttpRequest;u.open("POST",s),n.uploadSettings.onSetHeaders&&"function"==typeof n.uploadSettings.onSetHeaders&&n.uploadSettings.onSetHeaders(u,d),r&&n.$.fireEvent("uploadStarted",{files:t,size:d.size}),n.uploadSettings.onUploadStarted&&n.uploadSettings.onUploadStarted({files:t,status:u.status}),u.upload.onprogress=function(e){n.uploadSettings.onProgress&&n.uploadSettings.onProgress(e)},u.onabort=function(e){n.uploadSettings.onAbort&&n.uploadSettings.onAbort(e)},u.onerror=function(e){n.uploadSettings.onError&&n.uploadSettings.onError(e)},u.onload=function(){let e=!1;if(u.response&&("string"==typeof u.response?(e=u.response,e.indexOf("[{")>=0&&(e=JSON.parse(u.response))):e=JSON.parse(u.response)),u.status>=200&&u.status<=299){const o=(e,t)=>{if(e.response&&e.response.response&&"success"!==e.response.response)return null;let a=!1;u.fileURL&&(a=u.file_url);let l={};e&&e.file_url?a=e.file_url:e&&e[0]&&e[0].file_url&&(a=e[0].file_url);let i=!1;e&&e.file_url_small?i=e.file_url_small:e&&e[0]&&e[0].file_url_small&&(i=e[0].file_url_small);let n=!1;e&&e.file_url_medium?n=e.file_url_medium:e&&e[0]&&e[0].file_url_medium&&(n=e[0].file_url_medium);let o=!1;return e&&e.file_url_large?o=e.file_url_large:e&&e[0]&&e[0].file_url_large&&(o=e[0].file_url_large),a&&(l.value=a),i&&(l.small=i),n&&(l.medium=n),o&&(l.large=o),l.label=t,l};for(let i=0;i<t.length;i++){const s=t[i].name?[]:t[i].split("/"),r="url"===l?s[s.length-1]:t[i].name;n.uploadSettings.url;const d=o((e.files||e[0]&&e[0].files||[e[0]])[i],r);d&&a.push(d)}i(a,e)}else i(a,e),n.uploadSettings.onUploadError&&n.uploadSettings.onUploadError({files:t,status:u.status,serverResponse:e})},u.onreadystatechange=function(){e.column.editor.responseHandler&&"function"==typeof e.column.editor.responseHandler&&e.column.editor.responseHandler(u)},r&&u.send(o),n.uploadSettings.onChange&&n.uploadSettings.onChange(t)}}_handleFileColumnHistory(e,t,a,l){const i=this;if(i.storeHistory){a&&"string"==typeof a&&(a=(a=(a=JSON.parse(a)).map((e=>e.label))).toString()),a&&(Array.isArray(a)&&(a=a.map((e=>e.label))),a=a.toString()),null==a&&(a=""),l&&"string"==typeof l&&(l=(l=(l=JSON.parse(l)).map((e=>e.label))).toString()),null==l&&(l=""),l&&(Array.isArray(l)&&(l=l.map((e=>e.label))),l=l.toString());const n={user:i._currentUser.info.id,date:e.updatedDate};n.action=t,n.details={oldValue:a,value:l},e.addHistory(n)}}});
1449
+ Smart.Utilities.Assign("Grid.Dialog",class{_createOverlay(){const e=document.createElement("div");return e.onpointerdown=function(){return!1},e.onmousedown=function(){return!1},e.onclick=function(){},e.classList.add("smart-grid-dialog-overlay"),e}updateRelation(e,t){const a=this;for(let l=0;l<a.dataSourceSettings.relations.length;){const i=a.dataSourceSettings.relations[l];if(i.id===e){t.label&&(i.label=t.label),t.label&&(i.label=t.label),t.columns&&(i.columns=t.columns),t.dataSource&&(i.dataSource=t.dataSource);for(let t=0;t<a.columns.length;t++){const l=a.columns[t];if(l.relationField&&l.relationId&&l.relationId===e){const e=!l.editor||l.editor.singleSelect,t=a._getRelationData(l.relationId,l.relationField,e);l.editor?(l.editor.isDirty=!0,l.editor.dataSource=t):l.editor={template:"multiComboInput",readonly:!0,colorItems:!0,dropDownButtonPosition:"right",autoOpen:!0,relationId:l.relationId,relationField:l.relationField,pills:!0,singleSelect:!0,dataSource:t}}}a._recycle();break}}}_dragDialog(e,t){const a=this,l=a._dialogDragDetails.dialog;if(!e||l.pinned||l.maximized)return;if(!a._dialogDragDetails.started)return;let i,n;i=e.pageX-a._dialogDragDetails.x,n=e.pageY-a._dialogDragDetails.y;const o=Math.max(a._windowParent.element.clientHeight,a._windowParent.scrollElement.scrollHeight),s=Math.max(a._windowParent.element.clientWidth,a._windowParent.scrollElement.scrollWidth);switch(t){case"horizontal":a._dialogDragDetails.windowX=Math.max(0,Math.min(a._dialogDragDetails.windowX+i,s-l.offsetWidth)),l.style.left=a._dialogDragDetails.windowX+"px";break;case"vertical":a._dialogDragDetails.windowY=Math.max(0,Math.min(a._dialogDragDetails.windowY+n,o-l.offsetHeight)),l.style.top=a._dialogDragDetails.windowY+"px";break;case"both":a._dialogDragDetails.windowX=Math.max(0,Math.min(a._dialogDragDetails.windowX+i,s-l.offsetWidth)),a._dialogDragDetails.windowY=Math.max(0,Math.min(a._dialogDragDetails.windowY+n,o-l.offsetHeight)),l.style.left=a._dialogDragDetails.windowX+"px",l.style.top=a._dialogDragDetails.windowY+"px"}a._dialogDragDetails.top=l.offsetTop,a._dialogDragDetails.left=l.offsetLeft,a._dialogDragDetails.x=Math.max(a._windowParent.offsetLeft+a._dialogDragDetails.offsetX-a._windowParent.scrollElement.scrollLeft,Math.min(a._windowParent.offsetLeft+a._windowParent.element.offsetWidth-(a._windowParent.element.offsetWidth-l.offsetLeft)+a._dialogDragDetails.offsetX,e.pageX)),a._dialogDragDetails.y=Math.max(a._windowParent.offsetTop+a._dialogDragDetails.offsetY-a._windowParent.scrollElement.scrollTop,Math.min(a._windowParent.offsetTop+a._windowParent.element.offsetHeight-(a._windowParent.element.offsetHeight-l.offsetTop)+a._dialogDragDetails.offsetY,e.pageY))}_updateDialogDragDetails(e,t,a){const l=this;if(l._windowParent={initialParent:t.parentElement,element:document.documentElement,scrollElement:document.scrollingElement},l._dialogDragDetails||(l._dialogDragDetails={}),void 0===l._dialogDragDetails.minWidth||void 0===l._dialogDragDetails.minHeight||void 0===l._dialogDragDetails.maxWidth||void 0===l._dialogDragDetails.maxHeight){const e=getComputedStyle(t);l._dialogDragDetails.minWidth=parseFloat(e.getPropertyValue("min-width"))||0,l._dialogDragDetails.minHeight=parseFloat(e.getPropertyValue("min-height"))||0,l._dialogDragDetails.maxWidth=parseFloat(e.getPropertyValue("max-width"))||0,l._dialogDragDetails.maxHeight=parseFloat(e.getPropertyValue("max-height"))||0}l._dialogDragDetails.dialog=t,l._dialogDragDetails.windowX=t.offsetLeft,l._dialogDragDetails.windowY=t.offsetTop;const i=t.getBoundingClientRect(),n=t.parentElement===document.body?document.documentElement.getBoundingClientRect():t.parentElement?t.parentElement.getBoundingClientRect():document.documentElement.getBoundingClientRect(),o=window.scrollX||window.pageXOffset,s=window.scrollY||window.pageYOffset;l._windowParent.offsetLeft=n.left+o,l._windowParent.offsetTop=n.top+s,a&&"object"==typeof a&&(l._dialogDragDetails.offsetX=a.clientX-i.left,l._dialogDragDetails.offsetY=a.clientY-i.top),t.collapsed||(l.hasAnimation&&"minimize"===e?(l._dialogDragDetails.width=l._dialogDragDetails.width?l._dialogDragDetails.width:t.offsetWidth,l._dialogDragDetails.height=l._dialogDragDetails.height?l._dialogDragDetails.height:t.offsetHeight):(l._dialogDragDetails.width=t.offsetWidth,l._dialogDragDetails.height=t.offsetHeight),(t.style.width||t.style.height)&&(l._dialogDragDetails.resized=!0)),"minimize"!==e&&e&&(l._dialogDragDetails.type=e,l._dialogDragDetails.started=!0,l._dialogDragDetails.snapWindowWidth=t.offsetWidth,l._dialogDragDetails.snapWindowHeight=t.offsetHeight,a&&"object"==typeof a?(l._dialogDragDetails.x=a.pageX,l._dialogDragDetails.y=a.pageY):(l._dialogDragDetails.x=t.offsetLeft,l._dialogDragDetails.y=t.offsetTop))}_createPopup(e){const t=this;let a=document.createElement("div");return a.setAttribute("animation","none"),a.classList.add("smart-window","smart-grid-popup"),e||(e=t.editing.dialog),a.style.width="auto"===e.width?e.width:e.width+"px",a.style.height="auto"===e.height?e.height:e.height+"px",e.width&&"string"==typeof e.width&&(a.style.width=e.width),e.height&&"string"==typeof e.height&&(a.style.height=e.height),a.style.left="",a.style.top="",a.innerHTML='<div class="smart-container">\n <div class ="smart-content-container" smart-id="container">\n <div class="smart-content"><div class="smart-content-container"></div></div>\n </div>\n </div>\n ',a.querySelector&&a.querySelector(".smart-content")&&(a.content=a.querySelector(".smart-content").firstChild),document.body.appendChild(a),a.remove=function(){},a.close=function(){a.classList.contains("open")&&(a.classList.remove("open"),delete t._resizeHandling,a.addEventListener("transitionend",a.remove),a.addEventListener("transitioncancel",a.remove),a.onClose&&a.onClose())},a.open=function(l,i){a.removeEventListener("transitionend",a.remove),a.removeEventListener("transitioncancel",a.remove),t._resizeHandling=!1,void 0===l&&(l=e.left),void 0===i&&(i=e.top),requestAnimationFrame((function(){a.classList.add("open");const e=a.querySelector('[bind="name"]');if(e){const a=e.querySelector("smart-input");a&&t.editing.enabled&&a.focus()}const n=function(e,l){let i=t.offset(t);switch(t.dropDownMode&&(i={left:0,top:0}),"center"===e&&"horizontal"===l&&(e="middle"),e){case"top":return i.top;case"bottom":return Math.max(i.top,i.top+t.offsetHeight-a.offsetHeight);case"center":return Math.max(i.top,i.top+t.offsetHeight/2-a.offsetHeight/2);case"left":return i.left;case"middle":return i.left+t.offsetWidth/2-a.offsetWidth/2;case"right":return i.left+t.offsetWidth-a.offsetWidth}return"horizontal"===l?parseInt(e)+i.left:"vertical"===l?parseInt(e)+i.top:"number"==typeof e?e:parseInt(e)};a.style.left=n(l,"horizontal")+"px",a.style.top=n(i,"vertical")+"px",a.setPosition=(e,t)=>{t?a.style.left=n(e,"horizontal")+"px":a.style.top=n(e,"vertical")+"px"},"center"===l&&parseInt(a.style.left)<0&&(a.style.left="5%",a.style.maxWidth="90%"),"screenMiddle"===l&&(a.style.left="calc(50% - "+a.offsetWidth/2+"px)"),"screenCenter"===i&&(a.style.top="calc(50% - "+a.offsetHeight/2+"px)")})),a.onOpen&&a.onOpen()},a}_createDialog(e){const t=this;let a=document.createElement("div");e||(e=t.editing.dialog),void 0!==e.modal&&(a.modal=e.modal),void 0!==e.screenModal&&(a.screenModal=e.screenModal),a.setAttribute("animation","none"),a.classList.add("smart-window","smart-grid-dialog"),a.style.width="auto"===e.width?e.width:e.width+"px",a.style.height="auto"===e.height?e.height:e.height+"px",e.width&&"string"==typeof e.width&&(a.style.width=e.width),e.height&&"string"==typeof e.height&&(a.style.height=e.height),a.style.left="",a.style.top="",a.innerHTML=`<div class="smart-container">\n <div class ="smart-content-container" smart-id="container">\n <div id="headerSection" class="smart-header-section">\n <div class="smart-header">\n </div>\n <div class="smart-buttons-container">\n <button title="${t.localize("contextMenuItemDelete")}" tabindex=-1 class="smart-visibility-hidden smart-hidden smart-delete-button smart-grid-icon smart-icon-delete show smart-button smart-element" aria-label="Delete Row" smart-id="deleteButton"></button>\n <button title="${t.localize("copyURL")}" tabindex=-1 class="smart-visibility-hidden smart-hidden smart-copy-row-button smart-grid-icon smart-icon-link show smart-button smart-element" aria-label="Copy URL" smart-id="urlButton"></button>\n <button title="${t.localize("dialogEditHeaderMenu")}" tabindex=-1 class ="smart-visibility-hidden smart-hidden checked smart-comments-button smart-grid-icon smart-icon-menu show smart-button smart-element" aria-label="Comments" smart-id="commentsButton"></button>\n <button title="${t.localize("close")}" class ="smart-button smart-element smart-close-button" aria-label="Close" smart-id="closeButton"></button>\n </div>\n </div>\n <div class="smart-content"><div class="smart-content-container"></div></div>\n <div class ="smart-footer">\n \n <div class ="smart-stack-layout right spacing">\n <smart-button class ="smart-confirm-button item primary">Ok</smart-button>\n <smart-button class ="smart-cancel-button item">Cancel</smart-button>\n </div>\n </div>\n </div>\n </div>\n `,a.querySelector&&a.querySelector(".smart-content")&&(a.content=a.querySelector(".smart-content").firstChild),a.footer=a.querySelector(".smart-footer"),a.header=a.querySelector(".smart-header"),a.btnConfirm=a.querySelector(".smart-confirm-button"),a.btnCancel=a.querySelector(".smart-cancel-button"),a.btnDelete=a.querySelector(".smart-delete-button"),a.btnClose=a.querySelector(".smart-close-button"),a.btnComments=a.querySelector(".smart-comments-button"),a.btnLink=a.querySelector(".smart-copy-row-button"),a.headerSection=a.querySelector(".smart-header-section"),a.btnLink.onclick=()=>{let e=document.createElement("input"),t=window.location.href+"#activeRows="+a.row.id;navigator.clipboard&&navigator.clipboard.writeText?navigator.clipboard.writeText(t).then((()=>{})):(document.body.appendChild(e),e.value=t,e.select(),document.execCommand("copy"),document.body.removeChild(e))},a.btnDelete.onclick=()=>{const e=a.row.id,l=t.editing.deleteDialog.enabled;t.editing.deleteDialog.enabled=!0,t.cancelEdit(),a.close(),t._openDeleteRowDialog(e,(function(e){t._endToolbarEdit&&t._endToolbarEdit(),t.deleteRow(e)})),t.editing.deleteDialog.enabled=l,a.close()},a.btnComments.onclick=()=>{const e=a.querySelector(".smart-grid-edit-dialog-layout");e&&e.classList.toggle("hide-activity"),a.btnComments.classList.toggle("checked")},!1!==a.allowDrag&&(a.headerSection.onpointerdown=e=>{t._updateDialogDragDetails("drag",a,e)},a.headerSection.onpointerup=()=>{t._dialogDragDetails&&(t._dialogDragDetails.started=!1)});const l=document.createElement("div");return l.classList.add("smart-grid-dialog-overlay"),l.onclick=function(){a.overlayClick&&a.overlayClick()},a.overlay=l,a.remove=function(){a.parentNode&&a.parentNode.removeChild(a)},a.close=function(){a.classList.contains("open")&&(a.classList.remove("open"),delete t._resizeHandling,a.addEventListener("transitionend",a.remove),a.addEventListener("transitioncancel",a.remove),a.modal&&a.overlay.parentNode&&a.overlay.parentNode.removeChild(a.overlay),t.layout.isDirty&&"grid"===t.view&&(t._resetCachedLayout(),t._refreshLayout(),t.refresh()),a.onClose&&a.onClose())},a.open=function(l,i){a.removeEventListener("transitionend",a.remove),a.removeEventListener("transitioncancel",a.remove),t.isInShadowDOM?t.getRootNode().appendChild(a):document.body.appendChild(a),t._resizeHandling=!1,void 0===l&&(l=e.left),void 0===i&&(i=e.top),requestAnimationFrame((function(){a.classList.add("open");const e=a.querySelector('[bind="name"]');if(e){const a=e.querySelector("smart-input");a&&t.editing.enabled&&a.focus()}const n=function(e,l){const i=t.offset(t);switch("center"===e&&"horizontal"===l&&(e="middle"),e){case"top":return i.top;case"bottom":return Math.max(i.top,i.top+t.offsetHeight-a.offsetHeight);case"center":return Math.max(i.top,i.top+t.offsetHeight/2-a.offsetHeight/2);case"left":return i.left;case"middle":return i.left+t.offsetWidth/2-a.offsetWidth/2;case"right":return i.left+t.offsetWidth-a.offsetWidth}return"horizontal"===l?parseInt(e)+i.left:"vertical"===l?parseInt(e)+i.top:"number"==typeof e?e:parseInt(e)};a.style.left=n(l,"horizontal")+"px",a.style.top=n(i,"vertical")+"px",a.setPosition=(e,t)=>{t?a.style.left=n(e,"horizontal")+"px":a.style.top=n(e,"vertical")+"px"},"center"===l&&parseInt(a.style.left)<0&&(a.style.left="5%",a.style.maxWidth="90%"),"screenMiddle"===l&&(a.style.left="calc(50% - "+a.offsetWidth/2+"px)"),"screenCenter"===i&&(a.style.top="calc(50% - "+a.offsetHeight/2+"px)")})),a.modal&&(a.screenModal?t.isInShadowDOM?t.getRootNode().appendChild(a.overlay):document.body.appendChild(a.overlay):t.appendChild(a.overlay)),a.onOpen&&a.onOpen()},a}_openAddRowDialog(e,t){const a=this;if(!a.editing.addDialog.enabled)return!1;const l=a._dialogAddRow||a._createDialog(),i="{{message}}"===a.editing.dialog.header?a.localize("dialogAddHeader"):a.editing.dialog.header,n=l.content;l.header.innerHTML=i,e.grid=a,void 0===e.index&&(e.index=a.rows.length,a._rowsAdded&&(e.index+=a._rowsAdded.length));const o=e.cells;let s=null,r=0;if(a._cellEditors||(a._cellEditors=[]),!a._dialogAddRow){l.modal=!0,l.btnConfirm.innerHTML=a.localize("dialogAddButtonConfirm"),l.btnCancel.innerHTML=a.localize("dialogAddButtonCancel"),l.onOpen=function(){a.editing.dialog.visible=!0},l.onClose=function(){a.editing.dialog.visible=!1},l.btnCancel.onclick=function(){l.close()},l.btnClose.onclick=function(){l.close()},l.btnConfirm.onclick=function(){const e={};for(let t=0;t<o.length;t++){const l=o[t],i=a._getEditorValue(l),n=a._getEditorId(l),s=a._cellEditors[n];s&&(i&&i.error?(e[l.column.dataField]=i.value,s.detach()):(e[l.column.dataField]=i,s.detach()))}const i=a._rowsAdded?a._rowsAdded.length:0,n=new Smart.Grid.Row({index:a.rows.length+i,id:Smart.Utilities.Core.createGUID(),grid:a,data:e});l.close(),t(n,0===l.index)},l.onkeydown=function(e){const t=e.key;"Enter"===t?l.btnConfirm.onclick():"Escape"===t&&l.close()},n.classList.add("smart-grid-layout");for(let e=0;e<a.columns.length;e++){const t=a.columns[e];if(!t.allowEdit)continue;r%2==0&&(s=document.createElement("div"),s.classList.add("smart-grid-edit-dialog-row"),n.appendChild(s));const l=document.createElement("div");l.classList.add("col-sm-6");const i=document.createElement("div");i.classList.add("column");const o=document.createElement("label");o.innerHTML=a.columns[e].label;const d=document.createElement("div");d.classList.add("smart-grid-dialog-editor"),d.setAttribute("editor",t.dataField),d.setAttribute("template",t.editor.template),l.appendChild(i),s.appendChild(l),i.appendChild(o),i.appendChild(d),r++}}l.open(),l.index=e.index;let d=0;for(let e=0;e<o.length;e++){const t=o[e],i=t.column,n=i.dataField,s=l.querySelector("[editor="+n+"]");if(!s)continue;s.innerHTML="";let r="";void 0!==t.value&&(r=t.value),"int64"!==i.dataType&&"number"!==i.dataType&&"int"!==i.dataType&&"float"!==i.dataType||(r=0),"date"===i.dataType&&(r=new Date),"bool"!==i.dataType&&"boolean"!==i.dataType||(r=!1);let c=null;switch(t.editor.template){default:case"custom":c=a._getCustomCellEditor(t);break;case"image":c=a._getImageCellEditor(t);break;case"checkBox":c=a._getCheckBoxCellEditor(t);break;case"autoComplete":c=a._getAutoCompleteCellEditor(t);break;case"dropDownList":c=a._getAutoCompleteCellEditor(t),c.readonly=!0,c.dropDownButtonPosition="right";break;case"comboBox":c=a._getAutoCompleteCellEditor(t),c.readonly=!1,c.dropDownButtonPosition="right";break;case"maskedTextBox":c=a._getMaskCellEditor(t);break;case"checkInput":c=a._getCheckInputCellEditor(t),c.readonly=!0,c.dropDownButtonPosition="right";break;case"multiInput":c=a._getMultiInputCellEditor(t),c.readonly=!0,c.dropDownButtonPosition="right";break;case"multiComboInput":c=a._getMultiComboInputCellEditor(t),c.readonly=!0,c.dropDownButtonPosition="right";break;case"time":case"timeInput":c=a._getTimeInputCellEditor(t);break;case"date":case"dateInput":c=a._getDateInputCellEditor(t);break;case"dateRangeInput":c=a._getDateRangeInputCellEditor(t);break;case"dateTimePicker":c=a._getDateTimePickerCellEditor(t);break;case"textArea":case"textarea":c=a._getTextAreaCellEditor(t);break;case"numberInput":case"text":case"input":c="numberInput"===t.editor.template?a._getNumberInputCellEditor(t):a._getInputCellEditor(t)}if(c.attach(),t.editor.instance=c,c.setValue(r),0===d&&setTimeout((()=>{a.editing.enabled&&c.focus()}),100),!t.editor.isInitialized&&(t.editor.isInitialized=!0,t.editor.onInit)){const e=t.editor.onInit(t.row.index,t.column.dataField,t.editor.instance.element,t.row.data);if(e&&e instanceof Promise)e.then((e=>{const a="custom"===t.editor.template?t.editor.instance.element.firstElementChild:t.editor.instance.element;for(let t in e)a[t]=e[t]}));else if(e){const a=e,l="custom"===t.editor.template?t.editor.instance.element.firstElementChild:t.editor.instance.element;for(let e in a)l[e]=a[e]}}if(t.editor.onRender){const e=t.editor.onRender(t.row.index,t.column.dataField,t.editor.instance.element,t.row.data);if(e&&e instanceof Promise)e.then((e=>{const a="custom"===t.editor.template?t.editor.instance.element.firstElementChild:t.editor.instance.element;for(let t in e)a[t]=e[t]}));else if(e){const a=e,l="custom"===t.editor.template?t.editor.instance.element.firstElementChild:t.editor.instance.element;for(let e in a)l[e]=a[e]}}s.appendChild(c.element),c.element.onfocus=()=>{s.setAttribute("focus","")},c.element.onblur=()=>{s.removeAttribute("focus")},d++}a._dialogAddRow=l}_openEditDialog(e,t){const a=this;if(!a.editing.dialog.enabled)return!1;const l=a._dialogEdit||a._createDialog();let i="{{message}}"===a.editing.dialog.header?a.localize("dialogEditHeader",{value:a.editing.editRow?e.row.visibleIndex+1:e.column.label}):a.editing.dialog.header;const n=l.content;!1===a.editing.enabled?(l.classList.add("disable-edit"),i="{{message}}"===a.editing.dialog.header?a.localize("dialogEditHeaderDisabled",{value:a.editing.editRow?e.row.visibleIndex+1:e.column.label}):a.editing.dialog.header):l.classList.remove("disable-edit"),l.header.innerHTML=i,l.footer.classList.add("smart-hidden"),l.row=a.editing.editRow;const o=l.row.canNotify;l.row.canNotify=!1,l.row.showDetail=!1,l.row.canNotify=o,l.overlayClick=()=>{l.btnConfirm.click()};let s,r,d=null,c=0;if(void 0!==a._settingsDialogRowId){const e=`<div class="smart-buttons-container">\n <button title="${a.localize("pagerPreviousButton")}" tabindex=-1 class =" smart-button smart-element smart-prev-button" aria-label="Previous Record" smart-id="prevButton"></button>\n <button title="${a.localize("pagerNextButton")}" tabindex=-1 class =" smart-button smart-element smart-next-button" aria-label="Next Record" smart-id="nextButton"></button>\n </div>`;l.header.innerHTML=e+"<span>"+i+"</span>",l.btnPrev=l.querySelector(".smart-prev-button"),l.btnNext=l.querySelector(".smart-next-button"),l.header.style.display="flex",l.header.style.alignItems="center",a.editing.enabled?(l.btnDelete.classList.remove("smart-hidden"),l.btnComments.classList.remove("smart-hidden"),l.btnLink.classList.remove("smart-hidden"),l.btnDelete.classList.remove("smart-visibility-hidden"),l.btnComments.classList.remove("smart-visibility-hidden"),l.btnLink.classList.remove("smart-visibility-hidden"),0===a.users.length||a.users.length&&"guest"===a._currentUser.info?(l.btnLink.classList.add("smart-visibility-hidden"),l.btnDelete.classList.add("smart-visibility-hidden"),l.btnComments.classList.add("smart-visibility-hidden")):(l.btnLink.classList.remove("smart-visibility-hidden"),l.btnDelete.classList.remove("smart-visibility-hidden"),l.btnComments.classList.remove("smart-visibility-hidden"))):l.btnLink.style.width=l.btnDelete.style.width=l.btnComments.style.width="0px";const t=e=>{const t=a.editing.editRow,i=a._recyclingRows.indexOf(t);let o=e?a._recyclingRows[i+1]:a._recyclingRows[i-1];if(a.grouping.enabled&&a.dataSource.groupBy&&a.dataSource.groupBy.length>0){let t=1;for(;o&&!o.leaf;)o=e?a._recyclingRows[i+t]:a._recyclingRows[i-t],t++}const s=t;if(void 0!==a._settingsDialogRowId&&a.editing.dialog.autoSave){const e=a.rowById[a._settingsDialogRowId];e&&(l.saveRowData(e,!1),a._disableEndEdit=!0,a._recycle(!1,!0),a._disableEndEdit=!1)}if(o){if(a.editing.recordNavigation=!0,a.editing.editRow=o,a._settingsDialogRowId=o.id,s.isEditing=!1,s.element.removeAttribute("edit"),"gallery"===a.view){const e=a.querySelector('.smart-card[row-id="'+l.row.id+'"]');e&&e.removeAttribute("edit");const t=a.querySelector('.smart-card[row-id="'+o.id+'"]');t&&t.setAttribute("edit","")}const e=o,t=s.cells,i=e.cells;"kanban"===a.view&&a._kanban&&a._kanban.selectTask(e.id),l.row=o,l.header.querySelector("span").innerHTML=a.localize("dialogEditHeader",{value:a.editing.editRow.visibleIndex+1}),"gallery"!==a.view&&e.element.row.data.$.id===e.data.$.id&&e.element.setAttribute("edit","");for(let a=0;a<i.length;a++){const l=i[a],n=l.column;if(!n.allowEdit||!1===n._visible)continue;l.isEditing=!0,t[a].isEditing=!1;const o=e.data[n.dataField];l.editor&&l.editor.instance&&l.editor.instance.setValue(o)}a._applySettingsDialogLayout(l,n,a.editing.editRow,!0),a.editing.enabled&&setTimeout((()=>{const e=l.querySelector(".smart-grid-dialog-editor input");e&&e.focus()}),100)}};l.btnNext.onmousedown=e=>{t(!0),e.preventDefault(),e.stopPropagation()},l.btnPrev.onmousedown=e=>{t(!1),e.preventDefault(),e.stopPropagation()}}if(!a._dialogEdit){l.modal=!0,l.btnConfirm.innerHTML=a.localize("dialogEditButtonConfirm"),l.btnCancel.innerHTML=a.localize("dialogEditButtonCancel"),l.onOpen=function(){a.editing.dialog.visible||(a.editing.dialog.visible=!0,void 0!==a._settingsDialogRowId&&l.editorsContent&&l.editorsContent.offsetHeight&&(l.editorsContent.style.maxHeight=l.editorsContent.offsetHeight+40+"px",l.editorsContent.offsetWidth>a.offsetWidth||l.editorsContent.offsetHeight>window.innerHeight||l.editorsContent.offsetWidth>window.innerWidth?setTimeout((()=>{const e=a.offset(a);l.style.left=e.left+"px",l.style.top=e.top+"px",l.style.width=l.style.minWidth=a.offsetWidth+"px",l.style.height=l.style.minHeight=a.offsetHeight+"px",l.editorsContent.style.maxHeight=""})):(l.style.width=l.style.minWidth="",l.style.height=l.style.minHeight="",400!==a.editing.dialog.height&&(l.style.height=l.style.minHeight=a.editing.dialog.height+"px",l.editorsContent.style.maxHeight=l.editorsContent.offsetHeight+40+"px"),400!==a.editing.dialog.width&&(l.style.width=l.style.minWidth=a.editing.dialog.width+"px"),"gallery"===a.view&&setTimeout((()=>{a.querySelector('.smart-card[row-id="'+l.row.id+'"]')}))),a.editing.enabled&&setTimeout((()=>{const e=l.querySelector(".smart-grid-dialog-editor input");e&&e.focus()}),100)))},l.onClose=function(){a.editing.dialog.visible=!1,l.row&&(l.row.showDetail=!1)},l.btnCancel.onclick=function(){a.editing.isEditing=!0,a.cancelEdit()},l.btnClose.onclick=function(){a.editing.isEditing=!0,a.cancelEdit()};const t=(e,t=!0)=>{if(!e)return!1;const i=e.cells;let n={};e.element.removeAttribute("error");for(let e=0;e<i.length;e++){const t=i[e],l=a._getEditorValue(t);n[t.column.dataField]=l}const o=a.validateRow(e.id,n);if(Object.keys(o).length>0){let e=!0;for(let t=0;t<i.length;t++){const n=i[t],s=o[n.column.dataField],r=l.querySelector(`[label-for="${n.column.dataField}"]`);if(r&&(r.innerHTML=""),s)for(let t in s){const l=s[t];let i="";if(!l)continue;let o=l[t];"minLength"!==t&&"maxLength"!==t||(o=l[t.toLowerCase()]),i=l.message?l.message:"required"===t||"valueMissing"===t?a.localize("requiredValue",{value:n.column.label}):"min"===t?a.localize("invalidMinValue",{value:n.column.label,min:o.min}):"max"===t?a.localize("invalidMaxValue",{value:n.column.label,max:o.max}):"minLength"===t?a.localize("invalidMinLengthValue",{value:n.column.label,min:o.requiredLength}):"maxLength"===t?a.localize("invalidMaxLengthValue",{value:n.column.label,max:o.requiredLength}):a.localize("invalidValue"),e=!1,r&&(r.innerHTML=i)}}if(!e)return!1}const s=e.style;e.updatedDate=new Date,e.updatedBy=a.currentUser,e.style=l._rowStyle,e.comments=l._rowComments;const r=a.dataSource.dataItemById[e.id];if(r){const t=r.$.index;a.dataSource&&e.comments!==a.dataSource.boundSource[t].comments&&(a._sortedColumns&&a._sortedColumns.length>0?r.comments=e.comments:a.dataSource.boundSource[t].comments=e.comments)}if(e.style=l._rowStyle,a.onRowStyle&&s!==e.style&&(null===s?a.onRowStyle(e.index,e,e.style):s.background===e.style.background&&s.color===e.style.color&&s.fontSize===e.style.fontSize&&s.fontStyle===e.style.fontStyle&&s.fontFamily===e.style.fontFamily&&s.fontWeight===e.style.fontWeight&&s.status===e.style.status&&s.textDecoration===e.style.textDecoration||a.onRowStyle(e.index,e,e.style)),!t){for(let t=0;t<i.length;t++){const l=i[t],n=a._getEditorValue(l),o=l.column.dataField;if(e.canNotify=!1,e.data.canNotify=!1,e.data[o]=n,r){const e=r.$.index;a.dataSource&&(a._sortedColumns&&a._sortedColumns.length>0?r[o]=n:a.dataSource.boundSource[e][o]=n)}e.canNotify=!0,e.data.canNotify=!0}a._onSaveRowData&&a._onSaveRowData(e)}return!0};if(l.saveRowData=t,l.btnConfirm.onclick=function(){if(void 0!==a._settingsDialogRowId){const e=a.rowById[a._settingsDialogRowId];let i=!0;if(e&&(i=t(e)),!i)return;if(l.columnVisibility){let e=!1;const t=a.columns.canNotify;a.columns.canNotify=!1;for(let t in l.columnVisibility){const i=a.columnByDataField[t];i.visible!==l.columnVisibility[t]&&(i.visible=l.columnVisibility[t],e=!0)}if(a.columns.canNotify=t,e)return a.endEdit(),a.refresh(!1),void(a.dataSource&&a.dataSource.boundHierarchy&&(a.dataSource.refreshHierarchy(),a._refreshRowHierarchy(),a.refresh()))}}a.endEdit(),a.dataSource&&a.dataSource.boundHierarchy&&(a.dataSource.refreshHierarchy(),a._refreshRowHierarchy(),a.refresh())},l.onkeydown=function(e){const t=e.key,l=a.editing.commandKeys;for(let e in l){const i=l[e];if(t===i.key){a._applyCommand(i.command);break}}},a.editing.editRow)if(void 0!==a._settingsDialogRowId)a._applySettingsDialogLayout(l,n,a.editing.editRow);else{n.classList.add("smart-grid-layout");for(let e=0;e<a.columns.length;e++){const t=a.columns[e];if(!t.allowEdit)continue;c%2==0&&(d=document.createElement("div"),d.classList.add("smart-grid-edit-dialog-row"),n.appendChild(d));const l=document.createElement("div");l.classList.add("col-sm-6");const i=document.createElement("div");i.classList.add("column");const o=a._settingsDialogRowId?document.createElement("div"):document.createElement("label");o.innerHTML=a.columns[e].label;const s=document.createElement("div");s.classList.add("smart-grid-dialog-editor"),s.setAttribute("editor",t.dataField),s.setAttribute("template",t.editor.template),l.appendChild(i),d.appendChild(l),i.appendChild(o),i.appendChild(s),c++}}else{const t=e.column,a=document.createElement("div");a.classList.add("smart-grid-dialog-editor"),a.setAttribute("editor",""),a.setAttribute("template",t.editor.template),n.appendChild(a)}}if(a._dialogEditPosition){const e=a.offset(a);s=parseInt(a._dialogEditPosition.left)-e.left,r=parseInt(a._dialogEditPosition.top)-e.top}if(a.editing.dialog.visible||l.open(s,r),a.editing.editRow){const a=l.querySelector("[editor="+e.column.dataField+"]");a&&(a.innerHTML="",a.appendChild(t.element),a.editor=t,a.editorValue=t.getValue(),t.element.onfocus=()=>{a.setAttribute("focus",""),a.setAttribute("touched",""),a.editorValue=t.getValue()},t.element.onblur=()=>{a.removeAttribute("focus"),a.editorValue!==t.getValue()&&a.setAttribute("pending","")})}else{const a=e.column,i=l.querySelector("[editor]");i.innerHTML="",i.setAttribute("template",a.editor.template),i.appendChild(t.element),i.editor=t,i.editorValue=t.getValue(),t.element.onfocus=()=>{i.setAttribute("focus",""),i.setAttribute("touched",""),i.editorValue=t.getValue()},t.element.onblur=()=>{i.removeAttribute("focus"),i.editorValue!==t.getValue()&&i.setAttribute("pending","")}}a._dialogEdit=l}_refreshCurrentUser(){const e=this,t=e.users;let a=e.currentUser,l=!0,i=!0,n=e.editing.enabled,o=!0;t&&null!==a&&(a=t.find((e=>e.id===a)),a&&(l=!1!==a.allowAdd,i=!1!==a.allowComment,n=n&&!1!==a.allowEdit,o=!1!==a.allowRemove)),t&&t.length&&(null!==e.currentUser&&!1!==e.currentUser||(l=!1,i=!1,n=!1,o=!1,a="guest")),e._currentUser={allowAdd:l,allowComment:i,allowEdit:n,allowRemove:o,info:a}}_getColorInput(){const e=document.createElement("smart-color-input");return e.dataSource=["#D50000","#E67C73","#F4511E","#F6BF26","#0B8043","#33B679","#3F51B5","#039BE5","#7986CB","#8C47FF","#8E24AA","#FF36C2","#616161","#454545","#949494","#000000"],e.additionalColors=["#FF9EB7","#FF9EB7","#FFD66D","#FFEBB6","#93DF89","#D1F7C4","#9DC7FF","#D0F0FD","#CDAFFF","#ECE1FD","#FA9DE2","#FFDAF6","#CBCBCB","#EDEDED","#FFFFFF",""],e.valueDisplayMode="colorBox",e.classList.add("underlined","smart-grid-color-input"),e.style.width="auto",e.readonly=!0,e.onRender=()=>{const t=e.$.scrollView;t&&t.classList.add("smart-grid-color-input")},e}_applySettingsDialogLayout(e,t,a,l){const i=this;e.classList.add("smart-grid-dialog-expand-row");const n=e._rowStyle=JSON.parse(JSON.stringify(a._style)),o=e._rowComments=JSON.parse(JSON.stringify(a.comments));l&&e.activityContent.remove();const s=[];e.columnVisibility=s;let r=document.createElement("div"),d=document.createElement("div"),c=document.createElement("div"),u=document.createElement("div");l?(r=e.editorsContent,c=e.layoutContent,c.appendChild(d)):(c.appendChild(r),c.appendChild(u),c.appendChild(d),t.appendChild(c)),c.classList.add("smart-grid-edit-dialog-layout"),r.classList.add("smart-grid-edit-dialog-editors-container"),d.classList.add("smart-grid-edit-dialog-activity-container"),u.classList.add("smart-footer"),Smart.Utilities.Core.isMobile&&(c.classList.add("hide-activity"),e.btnComments.classList.remove("checked")),!1===i.editing.enabled&&d.classList.add("smart-hidden"),(0===i.users.length||i.users.length&&i._currentUser&&i._currentUser.info&&"guest"===i._currentUser.info)&&(d.classList.add("smart-hidden"),e.btnComments.classList.add("smart-hidden"),c.classList.add("hide-activity"),e.btnComments.classList.remove("checked"),e.btnComments.classList.add("smart-hidden"),e.btnLink.classList.add("smart-hidden"));const m=document.createElement("smart-button");m.innerHTML=`<span>${i.localize("dialogEditButtonSave")}</span>`,m.classList.add("primary");const p=document.createElement("smart-button");p.innerHTML=`<span>${i.localize("dialogEditButtonCancel")}</span>`;const g=document.createElement("div");g.classList.add("smart-flex"),g.style.flexDirection="row-reverse",g.appendChild(m),g.appendChild(p),p.style.marginRight="10px",u.appendChild(g);const b=document.createElement("div");b.classList.add("smart-flex"),b.style.alignItems="center",b.innerHTML=`<label style="margin-right: 5px;">${i.localize("dialogEditButtonAutoSave")}</label>\n <label title="${i.localize("dialogEditButtonAutoSave")}" class="smart-switch">\n <input type="checkbox">\n <span class="slider round"></span>\n </label>`,u.appendChild(b),i.users&&i.users.length&&(!1!==i.currentUser&&null!==i.currentUser&&void 0!==i.currentUser||u.classList.add("smart-hidden"));const f=b.querySelector("input");f.onchange=()=>{i.editing.dialog.autoSave=f.checked},i._currentUser.info&&!i._currentUser.allowEdit&&(u.classList.add("smart-hidden"),e.btnComments.classList.add("smart-hidden"),e.btnLink.classList.add("smart-hidden"),e.btnDelete.classList.add("smart-hidden")),!0===i.editing.dialog.autoSave&&(f.checked=!0),p.onclick=()=>{e.btnCancel.click()},m.onclick=()=>{e.btnConfirm.click()},Smart.Utilities.Core.isMobile&&(c.setAttribute("mobile",""),e.setAttribute("mobile",""));let h=0;for(let e=0;e<i.columns.length;e++){const t=i.columns[e];t.allowEdit&&!1!==t._visible&&h++}h>=8?r.classList.add("many"):r.classList.remove("many"),e.editorsContent=r,e.activityContent=d,e.layoutContent=c,e.footerContent=u,setTimeout((()=>{e.editorsContent.scrollHeight>e.editorsContent.offsetHeight?(u.style.setProperty("--smart-background","var(--smart-surface)"),u.style.borderTopStyle="solid",u.style.borderTopColor="var(--smart-border)",u.style.borderTopWidth="1px",p.classList.add("flat")):(u.style.setProperty("--smart-background",""),u.style.borderTopStyle="",u.style.borderTopColor="",u.style.borderTopWidth="",p.classList.remove("flat"))}),200);const y=document.createElement("div"),v=document.createElement("div");d.appendChild(y),d.appendChild(v);let C=o&&o.length?" ("+o.length+")":"";y.innerHTML=`\n <div class="tabs">\n <div view="comments" class="active tab"><div class="smart-flex tab-label"><span class="smart-grid-icon smart-icon-comment show"></span><span>${i.localize("commentsTab")}<span>${C}</span></span></div></div>\n <div view="history" class="tab smart-hidden"><div class="smart-flex tab-label"><span class="smart-grid-icon smart-icon-history show"></span>${i.localize("historyTab")}</div></div>\n <div view="details" class="tab"><div class="smart-flex tab-label"><span class="smart-grid-icon smart-icon-font show"></span>${i.localize("detailsTab")}</div></div>\n </div>\n <div class="smart-hidden details-tab">\n <div class="smart-grid-edit-dialog-row" style="grid-template-rows: 50px 50px 50px 50px 50px 1fr;"><div class="column"><div class="header smart-grid-edit-dialog-column-info">${i.localize("format").replace(":","")}\n <span title="${i.localize("resetFormat")}" class="reset-format smart-grid-icon smart-icon-reload show"></span>\n </div>\n </div>\n <div class="format-layout">\n <div title="${i.localize("background")}" class="smart-hidden format smart-grid-edit-dialog-column-info">\n <span class="smart-grid-icon smart-icon-color-background show"></span><div class="background"></div>\n </div>\n <div title="${i.localize("color")}" class="smart-hidden format smart-grid-edit-dialog-column-info">\n <span style="border-bottom: 2px solid #46CA78;" color="#46CA78" class="format smart-grid-icon smart-icon-font show"></span><div class="color"></div>\n </div>\n <div class="format-layout button-group">\n <span title="${i.localize("bold")}" class="formatbtn bold smart-grid-icon smart-icon-bold show"></span>\n <span title="${i.localize("italic")}" class="formatbtn italic smart-grid-icon smart-icon-italic show"></span>\n <span title="${i.localize("underline")}" class="formatbtn underline smart-grid-icon smart-icon-underline show"></span>\n <span style="text-decoration: line-through;" title="${i.localize("linethrough")}" class="formatbtn linethrough smart-grid-icon smart-icon-font show"></span>\n </div>\n </div>\n <div style="display: flex; flex-direction: column; margin-bottom: 20px;" class="format-layout font-group smart-flex">\n <span>${i.localize("fontFamily").replace(":","")}</span>\n <div title="${i.localize("fontFamily").replace(":","")}" class="format smart-grid-edit-dialog-column-info">\n <span class="smart-grid-icon smart-icon-font show"></span><div class="font-family"></div>\n </div>\n </div>\n <div style="margin-top: 20px; display: flex; flex-direction: column;" class="font-family format-layout font-group">\n <span>${i.localize("fontSize").replace(":","")}</span>\n <div title="${i.localize("fontSize").replace(":","")}" class="font-family format smart-grid-edit-dialog-column-info">\n <span class="smart-grid-icon smart-icon-fontsize show"></span><div class="font-size"></div>\n </div> \n </div>\n <div class="format-layout smart-hidden font-group">\n <div title="${i.localize("status").replace(":","")}" class="format smart-grid-edit-dialog-column-info">\n <span color="#F1C58B" class="smart-grid-icon smart-icon-star show"></span><div class="status"></div>\n </div>\n </div>\n </div>\n </div>\n <div class="comments-tab">\n <div class="column smart-hidden"><div class="smart-hidden comments-header smart-grid-edit-dialog-column-info">${i.localize("comments").replace(":","")}</div></div>\n <div class="comments-layout">\n <div class="comments"><span class="no-comments"><span>${i.localize("noComments")}</span></span></div>\n <div class="footer">\n <smart-text-area hint="${i.localize("comment")}" placeholder="${i.localize("commentPlaceholder")}" class="smart-text-area success underlined"></smart-text-area>\n <smart-button class="success">${i.localize("send")}</smart-button>\n </div>\n </div>\n </div>\n <div class="history-tab smart-hidden">\n <div class="history-layout">\n <div class="history"></div>\n </div>\n </div>\n `;const S=y.querySelectorAll(".tab");i.storeHistory&&(!i._currentUser||i._currentUser&&!i._currentUser.info?S[S.length-1].classList.add("smart-hidden"):S[S.length-1].classList.remove("smart-hidden")),!i.users||i.users&&0===i.users.length||!i._currentUser||i._currentUser&&!i._currentUser.info?S[S.length-2].classList.add("smart-hidden"):S[S.length-2].classList.remove("smart-hidden"),y.querySelector(".tabs").onpointerdown=e=>{const t=e.target.closest(".tab");if(t){const e=t.getAttribute("view"),a=y.querySelector(".details-tab"),l=y.querySelector(".comments-tab"),n=y.querySelector(".history-tab");a.classList.add("smart-hidden"),l.classList.add("smart-hidden"),n.classList.add("smart-hidden");for(let e=0;e<S.length;e++)S[e].classList.remove("active");switch(t.classList.add("active"),e){case"details":a.classList.remove("smart-hidden");break;case"comments":l.classList.remove("smart-hidden");break;case"history":n.classList.remove("smart-hidden"),i._refreshHistory()}}};const w=i._getColorInput();y.querySelector(".background").appendChild(w),w.onchange=()=>{n.background=w.value},n.background&&(w.value=n.background);const _=i._getColorInput();y.querySelector(".color").appendChild(_),_.onchange=()=>{n.color=_.value},n.color&&(_.value=n.color);const D=i._getColorInput();y.querySelector(".status").appendChild(D),D.onchange=()=>{n.status=D.value},n.status&&(D.value=n.status);const L=document.createElement("smart-input");L.style.width="auto",L.classList.add("underlined"),L.dropDownButtonPosition="right",L.readonly=!0,L.dropDownHeight="auto",L.dataSource=["-","Segoe UI","Arial","Georgia","Impact","Tahoma","Times New Roman","Verdana"],L.onchange=()=>{n.fontFamily=L.value},n.fontFamily?L.value=n.fontFamily:L.selectedIndex=0,y.querySelector(".font-family").appendChild(L);const x=document.createElement("smart-input");x.style.width="auto",x.classList.add("underlined"),x.dropDownButtonPosition="right",x.readonly=!0,x.dropDownHeight="auto",x.dataSource=["-","8px","10px","12px","14px","18px","24px"],x.onchange=()=>{n.fontSize=x.value},n.fontSize?x.value=n.fontSize:x.selectedIndex=0,y.querySelector(".font-size").appendChild(x);const k=y.querySelector(".button-group");k.onclick=e=>{const t=e.target.closest(".formatbtn");let a;t.classList.contains("checked")?(t.classList.remove("checked"),a=!1):(t.classList.add("checked"),a=!0),t.classList.contains("bold")?n.fontWeight=a?"bold":null:t.classList.contains("italic")?n.fontStyle=a?"italic":null:t.classList.contains("underline")?n.textDecoration=a?"underline":null:t.classList.contains("linethrough")&&(n.textDecoration=a?"line-through":null)},n.fontWeight?k.children[0].classList.add("checked"):k.children[0].classList.remove("checked"),n.fontStyle?k.children[1].classList.add("checked"):k.children[1].classList.remove("checked"),n.textDecoration?k.children[2].classList.add("checked"):k.children[2].classList.remove("checked"),y.querySelector(".reset-format").onclick=()=>{for(let e=0;e<k.children.length;e++)k.children[e].classList.remove("checked");L.selectedIndex=0,x.selectedIndex=0,_.value="",w.value="",D.value="",n.fontWeight=null,n.fontStyle=null,n.textDecoration=null,n.fontSize=null,n.fontFamily=null};const F=y.querySelector(".comments-header"),A=y.querySelector('[view="comments"]'),T=y.querySelector(".comments-layout smart-text-area"),z=y.querySelector(".comments-layout smart-button"),E=y.querySelector(".comments-layout .footer"),I=y.querySelector(".comments-layout .comments");T.users=i.users,z.disabled=!0,I.innerHTML=`<span class="no-comments"><span>${i.localize("noComments")}</span></span>`;const M=()=>{const e=I.querySelector(".no-comments");0===o.length?e.classList.remove("smart-hidden"):e.classList.add("smart-hidden")},H=()=>{i._commentEditing&&(i._commentEditing.parentNode&&i._commentEditing.parentNode.removeChild(i._commentEditing),delete i._commentEditing)};H();const R=e=>{const t=e.querySelector(".remove-button");H(),t.onclick=e=>{const t=e.target,l=o.indexOf(t.comment);if(H(),l>-1){const e=o[l];o.splice(l,1),i.$.fireEvent("commentRemove",{id:a.id,value:e}),i.onComment&&i.onComment(a.id,o),t.element.remove();const n=o.length?"("+o.length+")":"";F.innerHTML=A.lastElementChild.lastElementChild.innerHTML=`${i.localize("comments").replace(":","")} <span>${n}</span>`,M()}}},B=e=>{const t=e.querySelector(".edit-button");H();const a=e.querySelector(".comment-body");t.onclick=t=>{H();const a=t.target,l=o.indexOf(a.comment);if(!i._commentEditing&&l>-1){const t=o[l];let n=!1;if(i._currentUser.info&&t.userId===i._currentUser.info.id&&i._currentUser.allowComment&&(n=!0),!n)return;const s=document.createElement("smart-text-area");s.users=i.users;const r=e.querySelector(".comment-body");r.appendChild(s),r.style.position="relative",r.classList.add("edit"),s.style.width="100%",s.style.height="100%",s.style.minHeight="50px",s.style.minWidth="150px",s.style.left=s.style.top="0px",s.style.position="absolute",s.value=t.text,s.style.zIndex=5,s.style.boxShadow="var(--smart-elevation-2)",s.onkeydown=e=>{"Escape"===e.key&&(e.preventDefault(),e.stopPropagation(),s.onblur=s.onchange=null,r.classList.remove("edit"),H())},s.onchange=s.onblur=()=>{if(t.text=s.value,""===s.value)return void e.querySelector(".remove-button").click();const l=i._createComment(t);a.element.parentNode===I&&(I.insertBefore(l,a.element),a.element.parentNode.removeChild(a.element),delete i._commentEditing),R(l),B(l)},s.focus(),i._commentEditing=s}},a.ondblclick=e=>{t.click()}};for(let e=0;e<o.length;e++){const t=o[e],a=i._createComment(t);R(a),B(a),I.appendChild(a)}if(setTimeout((()=>{I.scrollTop=I.scrollHeight}),200),i._commentUpdateInterval=setInterval((()=>{e.classList.contains("open")?i._commentEditing:clearInterval(i._commentUpdateInterval)}),5e3),F.innerHTML=`${i.localize("comments").replace(":","")} ${C}`,M(),T.onfocus=()=>{E.classList.add("focus")},T.onblur=()=>{E.classList.remove("focus")},T.onkeyup=()=>{z.disabled=""===T.value},z.onclick=t=>{if(""===T.value)return;i._refreshCurrentUser();const l={text:T.value,id:function(){const e=function(){return(65536*(1+Math.random())|0).toString(16).substring(1)};return e()+e()}(),userId:i._currentUser.info?i._currentUser.info.id:-1,time:new Date},n=i._createComment(l);if(!n)return t.preventDefault(),void t.stopPropagation();R(n),B(n),o.push(l),i.$.fireEvent("commentAdd",{id:a.id,value:l}),i.onComment&&i.onComment(a.id,o),T.value="",z.disabled=!0,M(),I.appendChild(n),(()=>{const t=e._rowComments;if(H(),I.innerHTML=`<span class="no-comments"><span>${i.localize("noComments")}</span></span>`,M(),e.classList.contains("open"))for(let e=0;e<t.length;e++){const a=t[e],l=i._createComment(a);R(l),B(l),I.appendChild(l)}else clearInterval(i._commentUpdateInterval)})(),T.focus();const s=o.length?"("+o.length+")":"";F.innerHTML=A.lastElementChild.lastElementChild.innerHTML=`${i.localize("comments").replace(":","")} <span>${s}</span>`,I.scrollTop=I.scrollHeight,t.preventDefault(),t.stopPropagation()},l)return;const q=e=>{if(!e.allowEdit||!1===e._visible)return;const t=document.createElement("div");t.classList.add("smart-grid-edit-dialog-row"),r.appendChild(t),t.style.gridColumn="span 2",!1===e.visible&&t.classList.add("hidden-column");const a=document.createElement("div"),l=i._settingsDialogRowId?document.createElement("div"):document.createElement("label"),n=e.validationRules&&e.validationRules.length>0?"*":"";l.innerHTML=`<div class="smart-grid-edit-dialog-column-info"><span class="smart-grid-icon ${e.icon} show"></span><label>`+e.label+n+'</label><span toggle class="smart-grid-icon smart-icon-visibility-on show"</div>';const o=document.createElement("div");o.classList.add("smart-grid-dialog-editor"),o.setAttribute("editor",e.dataField),o.setAttribute("template",e.editor.template);const d=l.querySelector("[toggle]");d.column=e,s[e.dataField]=e.visible,d.title=i.localize("columnMenuItemHide"),!1===i.editing.enabled&&d.classList.add("smart-visibility-hidden"),d.onclick=()=>{s[d.column.dataField]=!d.column.visible,d.classList.contains("smart-icon-visibility-on")?(d.classList.remove("smart-icon-visibility-on"),d.classList.add("smart-icon-visibility-off"),d.title=i.localize("columnMenuItemShow")):(d.classList.add("smart-icon-visibility-on"),d.classList.remove("smart-icon-visibility-off"),d.title=i.localize("columnMenuItemHide"))},e.visible||(d.classList.remove("smart-icon-visibility-on"),d.title=i.localize("columnMenuItemShow")),e.visible?d.classList.add("smart-icon-visibility-on"):d.classList.add("smart-icon-visibility-off"),a.appendChild(l),a.appendChild(o);const c=document.createElement("label");c.classList.add("smart-field-editor-error-label"),c.setAttribute("label-for",e.dataField),a.appendChild(c),t.appendChild(a)},N=[];for(let e=0;e<i.columns.length;e++){const t=i.columns[e];t.visible?q(t):N.push(t)}if(N.length){const e=document.createElement("div");e.classList.add("smart-grid-edit-dialog-row"),r.appendChild(e),e.innerHTML=`<div class="smart-grid-edit-dialog-columns-separator"><span></span><div><div class="show toggle-button smart-flex">${i.localize("hideHiddenColumns",{value:N.length})}<span style="font-family: var(--smart-font-family-icon); font-size: 16px; margin-left: 5px; border:none;" class="smart-prev-button"></span></div></div><span></span></div>`,e.style.gridColumn="span 2",e.querySelector(".toggle-button").onclick=()=>{const t=r.querySelectorAll(".hidden-column"),a=e.querySelector(".toggle-button");a.classList.contains("show")?(a.innerHTML=`${i.localize("showHiddenColumns",{value:N.length})}<span style="font-family: var(--smart-font-family-icon); margin-left: 10px; border:none;" class="smart-next-button"></span>`,a.classList.remove("show")):(a.innerHTML=`${i.localize("hideHiddenColumns",{value:N.length})}<span style="font-family: var(--smart-font-family-icon); margin-left: 10px; border:none;" class="smart-prev-button"></span>`,a.classList.add("show")),t.forEach((e=>{e.classList.toggle("smart-hidden")}))};for(let e=0;e<N.length;e++)q(N[e])}}_getDateFormat(e){const t=new Smart.Utilities.DateTime(e),a=((new Date).getTime()-e.getTime())/1e3,l=Math.floor(Math.abs(a));if(""===this.locale||"en"===this.locale)return 0===l?"now":l<60?l+"s ago":l<3600?Math.floor(l/60)+"m ago":l<86400?Math.floor(l/3600)+"h ago":t.toString("dd/MM/yyyy hh:mm");t.toString("dd/MM/yyyy hh:mm")}_refreshHistory(){const e=this,t=e._dialogEdit;if(!t)return;const a=t.querySelector(".history");if(!e.storeHistory)return void a.classList.add("smart-hidden");if(!e._currentUser||e._currentUser&&!e._currentUser.info)return void a.classList.add("smart-hidden");a.classList.remove("smart-hidden");const l=t.row.history;if(!l)return;let i="\n ";for(let t=0;t<l.length;t++){const a=l[t];let n="";if(e._kanban)n=e._kanban._getHistoryItemLabel(a);else if("created"===a.action)n=e.localize("rowCreated",{value:a.action});else{const t=e.columnByDataField[a.action];n=e.localize("propertyUpdated",{value:t?"<strong>"+t.label+"</strong>":"<strong>"+a.action+"</strong>"})}i+='<div class="history-row">';const o=t=>{const a=t?t.image:null;let l=t?t.name||t.id:e.localize("guestUser");const i=a?"image":"",n=a?`background-image: url('${a}');`:"";return e._currentUser.info&&t.id===e._currentUser.info.id&&(""!==e.locale&&"en"!==e.locale||(l="You")),{image:n,label:l,cssClass:i}};let s="";if(void 0!==a.user){const t=o(e.users.find((e=>e.id===a.user)));i+=`<div class="history-indent"><div class="user-icon smart-icon ${t.cssClass}" style="${t.image}"></div></div>`,s=`<div class="history-header"><div class="user-name">${t.label}</div><div class="time">${e._getDateFormat(new Smart.Utilities.DateTime(a.date).toDate())}</div></div>`}else i+='<div class="history-indent"><div class="user-icon smart-icon"></div></div>',s='<div class="history-header"><div class="user-name"></div><div class="time"></div></div>';if(i+='<div class="history-main">',i+=s,i+=`<div class="history-body"><div class="title">${n}</div>`,"created"!==a.action){let t=a.details.oldValue,l=a.details.value;if("user"===a.action){const a=e.users.find((e=>e.id===t||e.id===parseFloat(t))),i=e.users.find((e=>e.id===l||e.id===parseFloat(l)));a?t=a.name:(t="",t||(t=e.localize("unassigned"))),i?l=i.name:(l="",l||(l=e.localize("unassigned")))}if("subtasks"===a.action){let t=[];"string"==typeof a.details.value?a.details.value.split(",").forEach((e=>{e.indexOf(": Y")>=0&&t.push(e)})):t=a.details.value.filter((e=>e.completed)),e._kanban?i+=`<span class="detail">${e._kanban.localize("taskSubtasksCompleted",{value:t.length+"/"+a.details.value.length})}</span>`:i+=`<span class="detail">${e.localize("completed",{value:t.length})}</span>`}else{t&&"object"==typeof t&&t instanceof Date&&(t=e._getDateFormat(t)),l&&"object"==typeof l&&l instanceof Date&&(l=e._getDateFormat(l));let n=e.columnByDataField[a.action];if(n||(n=e.columnByDataField["task"+a.action.substring(0,1).toUpperCase()+a.action.substring(1)]),"user"===a.action&&(n=e.columnByDataField.taskUserId),n&&n.editor&&n.editor.dataSource){for(let e=0;e<n.editor.dataSource.length;e++){const a=n.editor.dataSource[e];a.value===t&&(t=a.label),a.value===l&&(l=a.label)}t||(t=e.localize("unassigned")),l||(l=e.localize("unassigned"))}let o="";n&&n.label&&(o="<strong>"+n.label+"</strong>"),n&&"date"===n.dataType?(t&&"string"==typeof t&&(t=e._getDateFormat(new Date(t))),l&&"string"==typeof l&&(l=e._getDateFormat(new Date(l)))):(t&&"string"==typeof t&&(t=e._fromHTMLEntities(t)),l&&"string"==typeof l&&(l=e._fromHTMLEntities(l))),i+=t?`<div class="detail">${e.localize("range",{column:o,oldValue:"<i>"+t+"</i>",newValue:"<i>"+l+"</i>"})}</div>`:`<div class="detail">${e.localize("nullRange",{column:o,oldValue:"<i>"+t+"</i>",newValue:"<i>"+l+"</i>"})}</div>`}}else i+=`<div>${a.details.value}</div>`;i+="",i+="</div>",i+="</div>\n </div>"}i+="",a.innerHTML=i,setTimeout((()=>{a.scrollTop=a.scrollHeight}))}_createComment(e){const t=this,a=t.users.find((t=>t.id===e.userId));if(!a)return;const l=document.createElement("div"),i=a?a.name||a.id:t.localize("guestUser"),n=a.image?a.image:"";let o=a?a.name:t.localize("guestUser");t._currentUser.info&&a.id===t._currentUser.info.id&&(""!==t.locale&&"en"!==t.locale||(o="You")),e.text&&/<.+?>/.test(e.text)&&e.text.replace&&("all"===t.dataSourceSettings.sanitizeHTML?e.text=e.text.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/'/g,"&#39;").replace(/"/g,"&quot;"):"blackList"===t.dataSourceSettings.sanitizeHTML&&(e.text=window.Smart.Utilities.Core.escapeHTML(e.text)));let s=e.text;if(s.indexOf("@")>=0)for(let e=0;e<t.users.length;e++){const a=t.users[e];if(s.indexOf("@"+a.name)>=0){let e=`<div style="border:1px solid var(--smart-border); position:relative; top: -3px; border-radius: 15px; padding-right: 6px; background: var(--smart-surface); align-items: center; display: inline-flex;"><div class="user-icon smart-icon" role="img" aria-label="Icon of user ${a.name}"></div><span>${a.name}</span></div>`;a.image&&(e=`<div style="border:1px solid var(--smart-border); position:relative; top: -3px; border-radius: 15px; padding-right: 6px; background: var(--smart-surface); align-items: center; display: inline-flex;"><div style="width: 24px; height: 24px; background-image: url('${a.image}');" class="image user-icon smart-icon" role="img" aria-label="Icon of user ${a.name}"></div><span>${a.name}</span></div>`),s=s.replaceAll("@"+a.name,e)}}l.className="comment",l.setAttribute("role","listitem");let r=e.time?e.time:"";if(""!==r){r=new Smart.Utilities.DateTime(e.time);const a=((new Date).getTime()-r.toDate().getTime())/1e3,l=Math.floor(Math.abs(a));r=""!==t.locale&&"en"!==t.locale?r.toString("dd/MM/yyyy hh:mm"):0===l?"now":l<60?l+"s ago":l<3600?Math.floor(l/60)+"m ago":l<86400?Math.floor(l/3600)+"h ago":r.toString("dd/MM/yyyy hh:mm")}if(l.innerHTML=`<div class="comment-indent" role="presentation">\n<div class="user-icon smart-icon" role="img" aria-label="Icon of user ${i}"></div>\n</div>\n<div class="comment-main" role="presentation">\n<div class="comment-header" role="presentation">\n <div class="user-name" aria-label="User name">${o}</div>\n <div class="edit-button${t._currentUser.info&&a.id===t._currentUser.info.id&&t._currentUser.allowComment?" enabled":""}" role="button" aria-haspopup="menu" aria-label="Comment settings"></div>\n <div class="remove-button${t._currentUser.info&&a.id===t._currentUser.info.id&&t._currentUser.allowComment?" enabled":""}" role="button" aria-haspopup="menu" aria-label="Comment settings"></div>\n <div class="time" aria-label="Comment time">${r}</div>\n</div>\n<div class="comment-body" aria-label="Comment text">${s||""}</div >\n</div>`,n){const e=l.querySelector(".user-icon");e.style.backgroundImage=`url('${n}')`,e.classList.add("image")}l.comment=e;const d=l.querySelector(".remove-button");d.comment=e,d.element=l,e.userId!==t._currentUser.info.id&&d.classList.add("smart-visibility-hidden");const c=l.querySelector(".edit-button");return c.comment=e,c.element=l,e.userId!==t._currentUser.info.id&&c.classList.add("smart-visibility-hidden"),l}_openSummaryRowDialog(e){const t=this,a=t._summaryRowDialog||t._createDialog(),l="{{message}}"===t.editing.dialog.header?t.localize("summary"):t.editing.dialog.header;if(a.header.innerHTML=l,!a.listBox){const e=document.createElement("smart-list-box");e.selectionMode="checkBox",e.style.borderColor="transparent",a.content.innerHTML="",a.listBox=e}const i=a.listBox;a.summaryValueElement&&a.summaryValueElement.classList.remove("summary-chooser");const n=e.element.querySelector(".summary-value");if(!n)return;n.classList.add("summary-chooser"),a.summaryValueElement=n;let o=[];a.dataField=e.column.dataField,"string"===e.column.dataType?(o=[{label:t.localize("countSummary"),value:"count"},{label:t.localize("blankSummary"),value:"blank"},{label:t.localize("filledSummary"),value:"filled"},{label:t.localize("uniqueSummary"),value:"unique"}],e.column.editor&&e.column.editor.dataSource&&e.column.editor.singleSelect&&o.push({label:t.localize("statusSummary"),value:"status"})):o="boolean"===e.column.dataType||"any"===e.column.dataType?[{label:t.localize("countSummary"),value:"count"},{label:t.localize("blankSummary"),value:"blank"},{label:t.localize("filledSummary"),value:"filled"}]:"date"===e.column.dataType?[{label:t.localize("countSummary"),value:"count"},{label:t.localize("blankSummary"),value:"blank"},{label:t.localize("filledSummary"),value:"filled"},{label:t.localize("uniqueSummary"),value:"unique"}]:[{label:t.localize("countSummary"),value:"count"},{label:t.localize("minSummary"),value:"min"},{label:t.localize("maxSummary"),value:"max"},{label:t.localize("sumSummary"),value:"sum"},{label:t.localize("avgSummary"),value:"avg"}],i.dataSource=o,i.style.position="absolute",i.style.visibility="hidden",i.style.height="auto",t.isInShadowDOM?t.getRootNode().appendChild(i):document.body.appendChild(i);const s=e.column;s.summary&&s.summary.forEach((e=>{i.select(e)}));const r=i.offsetHeight;a.column=s,a.content.appendChild(i),a.classList.add("smart-grid-dialog-summary"),a.header.parentElement.classList.add("smart-hidden"),a.footer.classList.add("smart-hidden"),i.style.visibility="",i.style.position="",i.style.width="100%",t._summaryRowDialog||(a.btnConfirm.innerHTML=t.localize("apply"),a.btnCancel.innerHTML=t.localize("cancel"),a.style.width=a.style.minWidth="120px",a.onOpen=function(){t.editing.dialog.visible=!0},a.onClose=function(){t.editing.dialog.visible=!1,a.summaryValueElement&&a.summaryValueElement.classList.remove("summary-chooser")},a.btnCancel.onclick=function(){a.close()},a.btnClose.onclick=function(){a.close()},a.btnConfirm.onclick=function(){const e=a.column.summary;a.column.summary=i.selectedValues,t.$.fireEvent("columnSummaryChange",{column:a.column,dataField:s.dataField,oldSummary:[...e],summary:[...a.column.summary]}),a.close(),t._calculateSummary(),t._recycle(!1)},a.confirm=function(){a.btnConfirm.click()},a.onkeydown=function(e){"Escape"===e.key&&a.close()},t._summaryRowDialog=a);const d=e.element,c=t.offset(d),u=t.offset(t);let m=d.offsetWidth+c.left-u.left-120;m<0&&(m=c.left-u.left),a.open(m,c.top-u.top-r-0),setTimeout((function(){a.btnConfirm.focus()}),100)}_openTextAreaDialog(e,t,a){const l=this;delete l._dialogTextArea;const i=l._dialogTextArea||l._createDialog();if(i.header.innerHTML=e.label,i.column=e,i.classList.add("smart-grid-textarea-dialog"),i.style.minWidth="250px",i.style.minHeight="250px",i.style.zIndex=99999,i.textarea=t,"richText"!==e.template?i.initialValue=t.value:i.initialValue=t.getHTML(),i.cell=a,!l._dialogTextArea){i.modal=!0,i.btnConfirm.innerHTML=l.localize("dialogEditButtonSave"),i.btnCancel.innerHTML=l.localize("dialogEditButtonCancel"),i.onOpen=function(){const t=i.querySelector("smart-text-area");t.value=i.textarea.value,t.onchange=t.oninput=()=>{setTimeout((()=>{"richText"===e.template?i.textarea.setHTML(t.getHTML()):i.textarea.value=t.value}))},l.editing.enabled&&setTimeout((()=>{t.focus()}),250)},i.onClose=function(){};const t=()=>{const e=document.querySelector(".smart-grid-text-area-dialog");e&&e.remove()};i.btnCancel.onclick=function(){if(i.close(),l.editing.dialog.enabled)return i.textarea.value=i.initialValue,void t();l.cancelEdit(),t()},i.btnClose.onclick=function(){if(i.close(),l.editing.dialog.enabled)return i.textarea.value=i.initialValue,void t();l.cancelEdit(),t()},i.btnConfirm.onclick=function(){if(i.close(),l.editing.dialog.enabled)return t(),void i.cell.editor.instance.setValue(i.textarea.value);i.cell.editor.instance.setValue(i.textarea.value),t(),l.endEdit()},i.onkeydown=function(e){"Escape"===e.key&&i.close()},l._dialogTextArea=i;const a=document.createElement("smart-text-area");a.classList.add("smart-text-area"),a.resize="both","richText"===e.template&&(a.richText=!0),a.users=l.users,a.style.resize="both",a.minWidth=350,a.style.minWidth="350px",a.style.minHeight="250px",a.style.width="450px",a.style.height="400px",a.minHeight=250,i.input=a,i.content.appendChild(a)}const n=l.offset(t),o=l.offset(l);i.open(n.left-o.left+e.computedWidth,n.top-o.top),setTimeout((function(){if("auto"!==i.style.height){const e=i.input;e.style.width="450px",e.style.height="400px",i.style.height="auto",i.style.width="auto",e.resize="both"}if(i.offsetHeight+n.top-o.top>window.innerHeight&&(i.style.top=o.top+"px",i.style.left=o.left+"px",i.style.width=l.offsetWidth+"px",i.style.height=l.offsetHeight+"px",i.input.style.width=l.offsetWidth-20+"px",i.input.style.height=l.offsetHeight-20+"px",i.input.resize="none"),n.left-o.left+e.computedWidth+i.offsetWidth>window.innerWidth){let t=n.left-o.left+e.computedWidth-i.offsetWidth;i.style.left=Math.max(t,0)+"px"}i.btnConfirm.focus()}),100)}_openDescriptionDialog(e,t){const a=this,l=a._dialogDescription||a._createDialog(),i=a.localize("dialogDescriptionHeader",{value:e.label});if(l.header.innerHTML=i,l.column=e,l.command=t,l.classList.add("smart-grid-dialog-add-column"),!a._dialogDescription){l.modal=!0,l.btnConfirm.innerHTML=a.localize("dialogEditButtonConfirm"),l.btnCancel.innerHTML=a.localize("dialogEditButtonCancel"),l.onOpen=function(){const e=l.querySelector("smart-input");"duplicate"!==t&&setTimeout((()=>{e.select()}),250)},l.onClose=function(){},l.btnCancel.onclick=function(){l.close()},l.btnClose.onclick=function(){l.close()},l.btnConfirm.onclick=function(){const e=l.querySelector("smart-input");switch(l.command){case"duplicate":0===e.selectedIndex?a.duplicateCommand(l.column,null,!0):a.duplicateCommand(l.column,null,!1);break;case"rename":l.column.label=e.value;break;case"editDescription":l.column.description=e.value}l.close()},l.onkeydown=function(e){"Escape"===e.key&&l.close()},a._dialogDescription=l;const e=document.createElement("smart-input");e.classList.add("underlined"),e.dataSource="duplicate"!==t?[]:[{label:a.localize("duplicateCells"),value:"cells"},{label:a.localize("duplicateSettings"),value:"settings"}],l.content.appendChild(e)}const n=e.element,o=a.offset(n),s=a.offset(a);l.open(o.left-s.left,o.top+n.offsetHeight-s.top);const r=l.querySelector("smart-input");switch(r.selectedIndex=0,r.readonly=!0,r.dropDownButtonPosition="right",t){case"rename":r.value=e.label;break;case"editDescription":r.value=e.description}setTimeout((function(){l.btnConfirm.focus()}),100)}_openDeleteRowDialog(e,t){const a=this;if(!a.editing.deleteDialog.enabled)return!1;const l=a._dialogDelete||a._createDialog(),i="{{message}}"===a.editing.dialog.header?a.localize("dialogDeleteHeader",{value:e.visibleIndex+1}):a.editing.dialog.header;l.header.innerHTML=i,l.content.innerHTML=a.localize("dialogDeleteContent"),l.row=e,a._dialogDelete||(l.modal=!0,l.btnConfirm.innerHTML=a.localize("dialogDeleteButtonConfirm"),l.btnCancel.innerHTML=a.localize("dialogDeleteButtonCancel"),l.onOpen=function(){a.editing.dialog.visible=!0},l.onClose=function(){a.editing.dialog.visible=!1},l.btnCancel.onclick=function(){l.close()},l.btnClose.onclick=function(){l.close()},l.btnConfirm.onclick=function(){t(l.row),l.close()},l.onkeydown=function(e){"Escape"===e.key&&l.close()},a._dialogDelete=l),l.open(),setTimeout((function(){l.btnConfirm.focus()}),100)}_getTypesList(){const e=this,t=[{value:"string",prefix:'<span class="smart-grid-icon visible smart-icon-font"></span>',label:e.localize("dialogAddColumnTypeText")},{value:"multiText",prefix:'<span class="smart-grid-icon visible smart-icon-fontsize"></span>',label:e.localize("dialogAddColumnTypeMultilineText")},{value:"image",prefix:'<span class="smart-grid-icon visible smart-icon-image"></span>',label:e.localize("dialogAddColumnTypeImage")},{value:"number",prefix:'<span class="smart-grid-icon visible smart-icon-number"></span>',label:e.localize("dialogAddColumnTypeNumber")},{value:"select",prefix:'<span class="smart-grid-icon visible smart-icon-sort-down"></span>',label:e.localize("dialogAddColumnTypeSelect")},{value:"multiSelect",prefix:'<span class="smart-grid-icon visible smart-icon-list-unordered"></span>',label:e.localize("dialogAddColumnTypeMultipleSelect")},{value:"boolean",prefix:'<span class="smart-grid-icon visible smart-icon-check-squared"></span>',label:e.localize("dialogAddColumnTypeCheckBox")},{value:"attachment",prefix:'<span class="smart-grid-icon visible smart-icon-docs"></span>',label:e.localize("dialogAddColumnTypeAttachment")},{value:"date",prefix:'<span class="smart-grid-icon visible smart-icon-calendar"></span>',label:e.localize("dialogAddColumnTypeDate")},{value:"duration",prefix:'<span class="smart-grid-icon visible smart-icon-calendar"></span>',label:e.localize("dialogAddColumnTypeDuration")},{value:"time",prefix:'<span class="smart-grid-icon visible smart-icon-clock"></span>',label:e.localize("dialogAddColumnTypeTime")},{value:"createdTime",prefix:'<span class="smart-grid-icon visible smart-icon-clock"></span>',label:e.localize("dialogAddColumnTypeCreatedTime")},{value:"updatedTime",prefix:'<span class="smart-grid-icon visible smart-icon-clock"></span>',label:e.localize("dialogAddColumnTypeLastUpdatedTime")},{value:"createdBy",prefix:'<span class="smart-grid-icon visible smart-icon-user"></span>',label:e.localize("dialogAddColumnTypeCreatedBy")},{value:"updatedBy",prefix:'<span class="smart-grid-icon visible smart-icon-user"></span>',label:e.localize("dialogAddColumnTypeLastUpdatedBy")},{value:"collaborator",prefix:'<span class="smart-grid-icon visible smart-icon-user"></span>',label:e.localize("dialogAddColumnTypeCollaborator")},{value:"slider",prefix:'<span class="smart-grid-icon visible smart-icon-number"></span>',label:e.localize("dialogAddColumnTypeSlider")},{value:"formula",prefix:'<span class="smart-grid-icon visible smart-icon-math"></span>',label:e.localize("dialogAddColumnTypeFormula")},{value:"autoNumber",prefix:'<span class="smart-grid-icon visible smart-icon-list-ordered"></span>',label:e.localize("dialogAddColumnTypeAutoNumber")},{value:"url",prefix:'<span class="smart-grid-icon visible smart-icon-link"></span>',label:e.localize("dialogAddColumnTypeURL")},{value:"email",prefix:'<span class="smart-grid-icon visible smart-icon-mail"></span>',label:e.localize("dialogAddColumnTypeEmail")},{value:"phone",prefix:'<span class="smart-grid-icon visible smart-icon-phone"></span>',label:e.localize("dialogAddColumnTypePhone")},{value:"password",prefix:'<span class="smart-grid-icon visible smart-icon-lock"></span>',label:e.localize("dialogAddColumnTypePassword")},{value:"rating",prefix:'<span class="smart-grid-icon visible smart-icon-star"></span>',label:e.localize("dialogAddColumnTypeRating")}];if(e.dataSourceSettings.relations&&e.dataSourceSettings.relations.length&&t.splice(17,0,{value:"relationId",prefix:'<span class="smart-grid-icon visible smart-icon-table-alt"></span>',label:e.localize("dialogAddColumnTypeRowLink")}),e.header.visible&&e.header.buttons.indexOf("views")>=0){const a={value:"progress",prefix:'<span class="smart-grid-icon visible smart-icon-number"></span>',label:e.localize("dialogAddColumnTypeProgress")},l={value:"priority",prefix:'<span class="smart-grid-icon visible smart-icon-sort-down"></span>',label:e.localize("dialogAddColumnTypePriority")},i={value:"status",prefix:'<span class="smart-grid-icon visible smart-icon-sort-down"></span>',label:e.localize("status")},n={value:"tags",prefix:'<span class="smart-grid-icon visible smart-icon-list-unordered"></span>',label:e.localize("dialogAddColumnTypeTags")},o={value:"checklist",prefix:'<span class="smart-grid-icon visible smart-icon-list-ordered"></span>',label:e.localize("dialogAddColumnTypeChecklist")},s={value:"color",prefix:'<span class="smart-grid-icon visible smart-icon-color-background"></span>',label:e.localize("dialogAddColumnTypeColor")};t.push(a),t.push(l),t.push(n),t.push(o),t.push(s),t.push(i)}return t}_getAddStackColumnDialogTemplate(){const e=this,t=[];let a=!1,l="";for(let i=0;i<e.columns.length;i++){const n=e.columns[i];(n.statusColumn||"taskStatus"===n.dataField||"taskStatus"===n._dataField||n.editor&&n.editor.dataSource&&n.editor.dataSource.length&&n.editor.singleSelect)&&(t.push({label:n.label,value:n.dataField}),e._stackedBy===n.dataField&&(t[t.length-1].checked=!0,a=!0,l=t[t.length-1].label))}const i=t.concat([{value:"blank",label:e.localize("kanbanNone")},{value:"basic",label:e.localize("kanbanBasic")}]);return a||(i[0].checked=!0,l=i[0].label),[{bind:"kanban",name:"kanban",type:"radio",label:2===i.length?e.localize("kanbanNoneDescription"):e.localize("kanbanDescription",{column:l}),filter:"kanban",options:i},{bind:"kanbanNotes",name:"kanbanNotes",type:"label",label:e.localize("dialogAddColumnStatusNotes"),filter:"kanban"},{bind:"name",type:"input",label:e.localize("dialogAddColumnName"),filter:"any",placeholder:e.localize("dialogAddColumnNamePlaceholder"),info:e.localize("dialogAddColumnNameInfo")},{bind:"allowColorItems",type:"boolean",label:e.localize("dialogAddColumnColorItems"),filter:"list, collaborator",value:!0,info:""},{bind:"options",name:"listitems",type:"items",label:e.localize("dialogAddColumnListItems"),filter:"list",info:""}]}_getAddColumnDialogTemplate(){const e=this,t=(new Date).getFullYear().toString(),a=new Date(t,6,30);return[{bind:"kanban",name:"kanban",type:"radio",label:e.localize("kanbanNoneDescription"),filter:"kanban",options:[{value:"blank",checked:!0,label:e.localize("kanbanNone")},{value:"basic",label:e.localize("kanbanBasic")}]},{bind:"kanbanNotes",name:"kanbanNotes",type:"label",label:e.localize("dialogAddColumnStatusNotes"),filter:"kanban"},{bind:"name",type:"input",label:e.localize("dialogAddColumnName"),filter:"any",placeholder:e.localize("dialogAddColumnNamePlaceholder"),info:e.localize("dialogAddColumnNameInfo")},{bind:"type",name:"typeslist",type:"dropDownList",filter:"any",label:e.localize("dialogAddColumnType"),icon:"smart-icon-font",options:e._getTypesList(),info:e.localize("dialogAddColumnTypeInfo")},{bind:"dateFormat",name:"dateformat",type:"dropDownList",label:e.localize("dialogAddColumnDateFormat"),options:[{value:"M/d/yyyy",label:e.localize("dialogAddColumnDateFormatShort")+" ("+new Smart.Utilities.DateTime(a).toString("d")+")"},{value:"dddd, MMMM dd, yyyy",label:e.localize("dialogAddColumnDateFormatLong")+" ("+new Smart.Utilities.DateTime(a).toString("D")+")"},{value:"yyyy-MM-ddTHH:mm:ss.sssZ",label:e.localize("dialogAddColumnDateFormatISO")+" ("+new Smart.Utilities.DateTime(a).toString("ISO8601")+")"},{value:"d/M/yyyy",label:e.localize("dialogAddColumnDateFormatEU")+" (30/7/"+t+")"},{value:"yyyy-MM-dd",label:e.localize("dialogAddColumnDateFormatAS")+" ("+t+"-30-07)"},{value:"MMMM, dd, yyyy",label:e.localize("dialogAddColumnDateFormatFull")+" (July, 30, "+t+")"}],filter:"date",info:e.localize("dialogAddColumnDateFormatInfo")},{bind:"timeFormat",name:"timeformat",type:"dropDownList",label:e.localize("dialogAddColumnTimeFormat"),filter:"time",width:"50%",options:[{value:"hh:mm tt",label:"12 "+e.localize("dialogAddColumnTimeFormatHour")},{value:"HH:mm",label:"24 "+e.localize("dialogAddColumnTimeFormatHour")}],info:e.localize("dialogAddColumnTimeFormatInfo")},{bind:"allowTimeFormat",type:"boolean",label:e.localize("dialogAddColumnAllowTimeFormat"),filter:"date",width:"50%",value:!1,info:""},{bind:"allowCustomDateSeparator",type:"boolean",label:e.localize("dialogAddColumnCustomDateSeparator"),filter:"date",width:"50%",value:!1,info:""},{bind:"dateFormatSeparator",name:"dateFormatSeparator",type:"radio",label:"",filter:"date",width:"100%",columns:3,options:[{value:"/",label:e.localize("dialogAddColumnDateFormatSlash")+" (/)"},{value:"-",label:e.localize("dialogAddColumnDateFormatHyphen")+" (-)"},{value:".",label:e.localize("dialogAddColumnDateFormatDot")+" (.)"}]},{bind:"numberFormat",name:"numberFormat",type:"dropDownList",label:e.localize("dialogAddColumnNumberFormat"),filter:"number",options:[{value:{style:"decimal",maximumFractionDigits:0},label:e.localize("dialogAddColumnNumberFormatInteger")+" 1,000"},{value:{style:"decimal",minimumFractionDigits:2},label:e.localize("dialogAddColumnNumberFormatNumber")+" 1,000.12"},{value:{style:"percent",minimumFractionDigits:2},label:e.localize("dialogAddColumnNumberFormatPercent")+" 10.12%"},{value:{style:"percent",maximumFractionDigits:0,minimumFractionDigits:0},label:e.localize("dialogAddColumnNumberFormatPercentRounded")+" 10%"},{value:{style:"decimal",notation:"scientific"},label:e.localize("dialogAddColumnNumberFormatScientific")+" 1.01E+03"},{value:{style:"decimal",notation:"engineering"},label:e.localize("dialogAddColumnNumberFormatEngineering")+" 34.284 x 10^9"},{value:{style:"currency",currency:e.messages[e.locale].calendar.currency,currencySign:"accounting"},label:e.localize("dialogAddColumnNumberFormatAccounting")+" $(1,000.12)"},{value:{style:"unit",unit:"kilogram"},label:e.localize("dialogAddColumnNumberFormatUnit")+" 10.12 kg"},{value:{style:"currency",currency:e.messages[e.locale].calendar.currency},label:e.localize("dialogAddColumnNumberFormatCurrency")+" $1,000.12"},{value:{style:"currency",currency:e.messages[e.locale].calendar.currency,maximumFractionDigits:0,minimumFractionDigits:0},label:e.localize("dialogAddColumnNumberFormatCurrencyRounded")+" $1,000"}],required:!1,info:e.localize("dialogAddColumnNumberFormatInfo")},{bind:"currency",name:"currency",type:"dropDownList",filter:"number",required:!1,options:e._getCurrencies(),label:e.localize("dialogAddColumnNumberFormatCurrency"),info:e.localize("dialogAddColumnNumberFormatCurrencyInfo")},{bind:"unit",name:"unit",type:"dropDownList",filter:"number",required:!1,options:[{value:"acre",label:e.localize("dialogAddColumnNumberFormatUnitAcre")},{value:"percent",label:e.localize("dialogAddColumnNumberFormatUnitPercent")},{value:"degree",label:e.localize("dialogAddColumnNumberFormatUnitDegree")},{value:"megabyte",label:e.localize("dialogAddColumnNumberFormatUnitMegaByte")},{value:"centimeter",label:e.localize("dialogAddColumnNumberFormatUnitCentimeter")},{value:"meter",label:e.localize("dialogAddColumnNumberFormatUnitMeter")},{value:"squaremeter",label:e.localize("dialogAddColumnNumberFormatUnitMeter")+"²"},{value:"cubicmeter",label:e.localize("dialogAddColumnNumberFormatUnitMeter")+"³"},{value:"kilometer",label:e.localize("dialogAddColumnNumberFormatUnitKilometer")},{value:"mile",label:e.localize("dialogAddColumnNumberFormatUnitMile")},{value:"celsius",label:e.localize("dialogAddColumnNumberFormatUnitCelsius")},{value:"fahrenheit",label:e.localize("dialogAddColumnNumberFormatUnitFahrenheit")},{value:"kilogram",label:e.localize("dialogAddColumnNumberFormatUnitKilogram")},{value:"pound",label:e.localize("dialogAddColumnNumberFormatUnitPound")},{value:"liter",label:e.localize("dialogAddColumnNumberFormatUnitLiter")},{value:"gallon",label:e.localize("dialogAddColumnNumberFormatUnitGallon")},{value:"second",label:e.localize("dialogAddColumnNumberFormatUnitSecond")},{value:"minute",label:e.localize("dialogAddColumnNumberFormatUnitMinute")},{value:"hour",label:e.localize("dialogAddColumnNumberFormatUnitHour")},{value:"day",label:e.localize("dialogAddColumnNumberFormatUnitDay")},{value:"week",label:e.localize("dialogAddColumnNumberFormatUnitWeek")},{value:"month",label:e.localize("dialogAddColumnNumberFormatUnitMonth")},{value:"year",label:e.localize("dialogAddColumnNumberFormatUnitYear")}],label:e.localize("dialogAddColumnNumberFormatUnit"),info:e.localize("dialogAddColumnNumberFormatUnitInfo")},{bind:"allowThousandsSeparator",name:"allowThousandsSeparator",type:"boolean",label:e.localize("dialogAddColumnNumberFormatSeparator"),filter:"number",value:!0,info:""},{bind:"minLength",name:"minlength",width:"50%",type:"number",filter:"text",required:!1,label:e.localize("dialogAddColumnMinLength"),info:e.localize("dialogAddColumnMinLengthInfo")},{bind:"maxLength",name:"maxlength",width:"50%",filter:"text",type:"number",required:!1,label:e.localize("dialogAddColumnMaxLength"),info:e.localize("dialogAddColumnMaxLengthInfo")},{bind:"minValue",name:"minvalue",width:"50%",filter:"number",type:"number",required:!1,label:e.localize("dialogAddColumnMinValue"),info:e.localize("dialogAddColumnMinValueInfo")},{bind:"maxValue",name:"maxvalue",width:"50%",filter:"number",type:"number",required:!1,label:e.localize("dialogAddColumnMaxValue"),info:e.localize("dialogAddColumnMaxValueInfo")},{bind:"minDateTime",name:"mindatetime",type:"datetime",filter:"date",width:"50%",label:e.localize("dialogAddColumnMinDate"),info:e.localize("dialogAddColumnMinDateInfo")},{bind:"maxDateTime",name:"maxdatetime",type:"datetime",width:"50%",filter:"date",label:e.localize("dialogAddColumnMaxDate"),info:e.localize("dialogAddColumnMaxDateInfo")},{bind:"deadline",name:"deadline",type:"dropDownList",label:e.localize("dialogAddColumnTypeDueDateSettings"),info:e.localize("dialogAddColumnTypeDueDateSettingsInfo"),filter:"date",options:[{value:"",label:e.localize("dialogAddColumnTypeNone")},{value:"dueDate",label:e.localize("dialogAddColumnTypeDueDate")},{value:"startDate",label:e.localize("dialogAddColumnTypeStartDate")}]},{bind:"deadlineStatus",name:"deadlineStatus",type:"dropDownList",label:e.localize("dialogAddColumnTypeStatus"),info:e.localize("dialogAddColumnTypeStatusInfo"),filter:"date",options:[]},{bind:"deadlineDueDate",name:"deadlineDueDate",type:"dropDownList",label:e.localize("dialogAddColumnTypeDueDate"),info:"",filter:"date",options:[]},{bind:"allowColorItems",type:"boolean",label:e.localize("dialogAddColumnColorItems"),filter:"list, collaborator",value:!0,info:""},{bind:"allowCheckItems",type:"boolean",filter:"hidden",value:!1,label:e.localize("dialogAddColumnCheckItems"),info:""},{bind:"allowMultipleCollaborators",type:"boolean",filter:"collaborator",value:!1,label:e.localize("dialogAddColumnMultipleCollaborators"),info:e.localize("dialogAddColumnMultipleCollaboratorsInfo")},{bind:"options",name:"listitems",type:"items",label:e.localize("dialogAddColumnListItems"),filter:"list",info:""},{bind:"users",name:"users",type:"items",label:e.localize("dialogAddColumnListItems"),filter:"collaborator",info:""},{bind:"formula",type:"formula",filter:"formula",info:e.localize("dialogAddColumnFormulaInfo"),label:e.localize("dialogAddColumnFormula")},{bind:"relationMultiField",name:"relationMultiField",type:"boolean",value:!1,filter:"relationId",label:e.localize("dialogAddColumnLinkSelect")},{bind:"relationId",name:"relationId",type:"relationId",label:e.localize("dialogAddColumnLinkListItems"),filter:"relationId",info:""},{bind:"description",type:"input",label:e.localize("dialogAddColumnDescription"),filter:"any",placeholder:e.localize("dialogAddColumnDescriptionPlaceholder"),info:e.localize("dialogAddColumnDescriptionInfo")},{name:"align",bind:"cellsAlign",type:"dropDownList",label:e.localize("dialogAddColumnAlign"),required:!1,options:[{value:"left",label:e.localize("dialogAddColumnAlignLeft")},{value:"right",label:e.localize("dialogAddColumnAlignRight")},{value:"center",label:e.localize("dialogAddColumnAlignCenter")}],filter:"any",info:e.localize("dialogAddColumnAlignInfo")},{bind:"defaultString",name:"defaultString",type:"input",filter:"text",required:!1,label:e.localize("dialogAddColumnDefault")},{bind:"defaultNumber",name:"defaultNumber",type:"number",filter:"number",required:!1,label:e.localize("dialogAddColumnDefault")},{bind:"defaultDate",name:"defaultDate",type:"dropDownList",label:e.localize("dialogAddColumnDefault"),filter:"date",options:[{value:"current",label:e.localize("dialogAddColumnDefaultDateCurrent")},{value:"specific",label:e.localize("dialogAddColumnDefaultDateSpecific")}]},{bind:"defaultDateValue",name:"defaultDateValue",type:"datetime",filter:"date",label:e.localize("placeholderValue")},{bind:"setDefaultValue",type:"boolean",label:e.localize("dialogAddColumnDefault"),width:"50%",filter:"any",value:!1,info:""},{bind:"allowResize",type:"boolean",filter:"any",width:"50%",label:e.localize("dialogAddColumnResizable"),info:e.localize("dialogAddColumnResizableInfo")},{bind:"allowRichText",type:"boolean",filter:"multiText",width:"50%",value:!1,label:e.localize("dialogAddColumnFormatting"),info:""},{bind:"required",type:"boolean",width:"50%",filter:"any",value:!1,label:e.localize("dialogAddColumnRequired"),info:e.localize("dialogAddColumnRequiredInfo")},{bind:"allowSort",type:"boolean",width:"50%",filter:"any",label:e.localize("dialogAddColumnSortable"),info:e.localize("dialogAddColumnSortableInfo")},{bind:"allowFilter",type:"boolean",align:"left",width:"50%",filter:"any",label:e.localize("dialogAddColumnFilterable"),info:e.localize("dialogAddColumnFilterableInfo")},{bind:"allowEdit",type:"boolean",width:"50%",filter:"any",label:e.localize("dialogAddColumnEditable"),info:e.localize("dialogAddColumnEditableInfo")}]}_getKanbanFields(){return["startDate","dueDate","progress","checklist","priority","tags","name","color","description","status"]}_addColumnDialogShowHideEditors(e){const t=this,a=e.editColumn,l=e.querySelector('[bind="type"]'),i=l?l.querySelector("smart-input"):null,n=l?i.getSelectedItem().value:"kanban",o=e.querySelectorAll(".smart-grid-dialog-editor"),s=t._getKanbanFields(),r=e.querySelector('[field-name="kanbanNotes"]');r&&("kanban"!==t.view?r.classList.add("smart-hidden"):r.classList.remove("smart-hidden"));const d=t=>{const a=e.querySelector('[field-name="defaultDate"]'),l=e.querySelector('[field-name="defaultDateValue"]');if(!t)return a.classList.add("smart-hidden"),void l.classList.add("smart-hidden");a.classList.remove("smart-hidden"),"specific"===t?(l.classList.remove("smart-hidden"),l.style.width="50%",l.style.float="left",a.style.width="50%",a.style.float="left",a.style.clear="both"):(l.classList.add("smart-hidden"),l.style.width="",l.style.float="",a.style.width="",a.style.float="")};let c=!!a;if(a){switch(e.columnType||n){case"createdTime":case"updatedTime":case"createdBy":case"updatedBy":case"autoNumber":case"image":case"progress":case"color":case"collaborator":case"attachment":c=!0;break;default:c=!1}"checklist"!==a.template&&"color"!==a.template||(c=!0),!1===a.allowTypeChange&&(c=!0)}for(let l=0;l<o.length;l++){const i=o[l],r=i.getAttribute("filter"),u=i.getAttribute("bind"),m=i.parentNode;if("deadlineStatus"!==u&&"deadlineDueDate"!==u)if(m.classList.add("smart-hidden"),"cellsAlign"===u&&("boolean"===n||"attachment"===n||"image"===n||"email"===n||"url"===n||"collaborator"===n||"createdBy"===n||"password"===n||"phone"===n||"createdTime"===n||"rating"===n||"updatedBy"===n||"updatedTime"===n||s.indexOf(n)>=0))m.classList.add("smart-hidden");else if("type"===u&&c)m.classList.add("smart-hidden");else if("allowEdit"!==u||!1!==t.editing.enabled&&"autoNumber"!==n&&"createdBy"!==n&&"updatedBy"!==n&&"createdTime"!==n&&"updatedTime"!==n)if("allowResize"!==u||"none"!==t.behavior.columnResizeMode)if("allowFilter"!==u||!1!==t.filtering.enabled)if("allowSort"!==u||!1!==t.sorting.enabled)if("required"!==u||!1!==t.editing.enabled&&("string"===n||"multiText"===n||"name"===n||"description"===n||"select"===n||"collaborator"===n||"multiSelect"===n||"select"===n||"priority"===n))if(a&&a.disabledDialogOptions&&a.disabledDialogOptions.length>0&&a.disabledDialogOptions.indexOf(u)>=0)m.classList.add("smart-hidden");else{if(a&&"kanban"===t.view){switch(u){case"options":case"allowColorItems":case"allowSort":case"allowFilter":case"align":case"cellsAlign":case"allowResize":case"allowEdit":m.classList.add("smart-hidden");continue}"kanban"===t.view&&"kanban"===r&&m.classList.remove("smart-hidden")}if("deadline"!==u)if("setDefaultValue"!==u){if(a&&a.editor&&a.editor.collaborator)switch(u){case"options":m.classList.add("smart-hidden");continue;case"users":m.classList.remove("smart-hidden");continue}if("name"!==u||"kanban"!==t.view)if("any"!==r)switch(n){default:case"text":"text"!==r&&"multiText"!==r||("multiText"===r&&"string"===n?m.classList.add("smart-hidden"):m.classList.remove("smart-hidden")),a&&"any"===a.dataType&&m.classList.add("smart-hidden");break;case"slider":case"number":if("number"===r&&m.classList.remove("smart-hidden"),"unit"===u||"currency"===u||"allowThousandsSeparator"===u){m.classList.add("smart-hidden");const t=e.querySelector('[field-name="allowThousandsSeparator"]'),a=e.querySelector('[field-name="numberFormat"]'),l=e.querySelector('[field-name="unit"]'),i=e.querySelector('[field-name="currency"]'),n=a.querySelector("smart-input"),o=()=>{const e=n.getSelectedItem();i.classList.add("smart-hidden"),t.classList.add("smart-hidden"),e&&"decimal"===e.value.style&&!e.value.notation&&t.classList.remove("smart-hidden"),e&&"unit"===e.value.style?l.classList.remove("smart-hidden"):e&&"currency"===e.value.style?i.classList.remove("smart-hidden"):l.classList.add("smart-hidden")};a.onchange=()=>{o()},o()}break;case"select":case"multiSelect":r.indexOf("list")>=0&&m.classList.remove("smart-hidden");break;case"collaborator":r.indexOf("collaborator")>=0&&m.classList.remove("smart-hidden");break;case"createdBy":case"updatedBy":case"autoNumber":case"createdTime":case"updatedTime":case"url":case"email":case"image":case"attachment":case"phone":case"password":case"progress":case"rating":case"checklist":case"priority":case"tags":case"name":case"description":case"assigned":case"status":case"color":case"boolean":if("status"===n||"priority"===n||"tags"===n){r.indexOf("list")>=0&&m.classList.remove("smart-hidden");break}break;case"time":{const t=e.querySelector('[field-filter="time"]');t.classList.remove("smart-hidden"),t.style.width="",t.style.float="";break}case"formula":"formula"===u&&m.classList.remove("smart-hidden");break;case"relationId":"relationId"!==u&&"relationMultiField"!==u||m.classList.remove("smart-hidden");break;case"duration":break;case"dueDate":case"startDate":case"date":{const t=e.querySelector('[field-name="dateFormat"]').querySelector(".smart-input").value;if("defaultDate"===u||"defaultDateValue"===u){const t=e.querySelector('[field-name="defaultDate"]'),l=e.querySelector('[field-name="defaultDateValue"]'),i=t.querySelector(".smart-input"),n=l.querySelector(".smart-input");a&&a.defaultValue?"today"===a.defaultValue?(i.selectedValues=["current"],n.value=null):(i.selectedValues=["specific"],n.value=a.defaultValue):(i.selectedValues=["current"],n.value=null),d(i.selectedValue)}"date"===r&&m.classList.remove("smart-hidden");const l=t=>{const a=e.querySelector('[field-filter="time"]'),l=e.querySelector('[field-name="dateFormat"]');t?(a.classList.remove("smart-hidden"),l.style.width="50%",l.style.float="left"):(a.classList.add("smart-hidden"),l.style.width="",l.style.float="")},n=t=>{const a=e.querySelector('[field-name="allowTimeFormat"]'),l=a.querySelector(".smart-grid-dialog-editor");t.indexOf("T")>=0?(a.classList.add("smart-hidden"),l.uncheck()):a.classList.remove("smart-hidden")},o=t=>{const a=e.querySelector('[field-name="dateFormatSeparator"]');t?a.classList.remove("smart-hidden"):a.classList.add("smart-hidden")};if("allowTimeFormat"===u){const e=i.querySelector(".smart-input").value;i.onchange=e=>{l(e)},l(e)}if("dateFormat"===u){const e=i.querySelector(".smart-input").value;i.onchange=e=>{n(e.detail.value)},n(e)}if("defaultDate"===u){const e=i.querySelector(".smart-input").value;i.onchange=e=>{d(e.detail.value)},d(e)}if("dateFormatSeparator"===u){const t=e.querySelector('[field-name="allowCustomDateSeparator"]').querySelector(".smart-input").value;o(t)}if("allowCustomDateSeparator"===u){t.indexOf("T")>=0&&t.indexOf("-")>0&&i.uncheck();const e=i.querySelector(".smart-input").value;i.onchange=e=>{o(e)},o(e)}n(t);break}}else m.classList.remove("smart-hidden");else{const e=t._getAddStackColumnDialogTemplate().find((e=>{if("kanban"===e.bind)return e}));e.options[e.options.length-1].checked||e.options[e.options.length-2].checked?i.classList.remove("smart-hidden"):i.classList.add("smart-hidden")}}else{switch(a&&a.defaultValue&&m.classList.remove("smart-hidden"),n){case"string":case"multiText":case"name":case"description":case"multiSelect":case"boolean":case"date":case"dueDate":case"startDate":case"collaborator":case"number":case"priority":case"status":case"select":m.classList.remove("smart-hidden");break;default:m.classList.add("smart-hidden")}const t=t=>{const a=e.querySelector('[bind="type"]'),l=a?a.querySelector("smart-input"):null,i=a?l.getSelectedItem().value:"kanban",n=e.querySelector('[field-name="defaultDate"]'),o=e.querySelector('[field-name="defaultNumber"]'),s=e.querySelector('[field-name="defaultString"]'),r=e.querySelector('[field-name="defaultDateValue"]'),c=e.querySelectorAll(".smart-default-item-container");n&&(n.classList.add("smart-hidden"),r.classList.add("smart-hidden")),o&&o.classList.add("smart-hidden"),s&&s.classList.add("smart-hidden");for(let e=0;e<c.length;e++)c[e].classList.add("smart-hidden");if(t)if("date"===i||"dueDate"===i||"startDate"===i){if(n){n.classList.remove("smart-hidden"),r.classList.remove("smart-hidden");const e=n.querySelector("smart-input").selectedValues;d(e&&e.length?e[0]:"current")}}else if("number"===i||"slider"===i)o&&o.classList.remove("smart-hidden");else if("string"===i||"multiText"===i||"name"===i||"description"===i)s&&s.classList.remove("smart-hidden");else for(let e=0;e<c.length;e++)c[e].classList.remove("smart-hidden")};i.onchange=e=>{t(e)};const l=e.querySelector('[field-name="setDefaultValue"]'),o=!(!a||null===a.defaultValue||void 0===a.defaultValue)||l.value;t(o)}else m.classList.add("smart-hidden"),t.header.visible&&t.header.buttons.indexOf("views")>=0&&"date"===n&&m.classList.remove("smart-hidden")}else m.classList.add("smart-hidden");else m.classList.add("smart-hidden");else m.classList.add("smart-hidden");else m.classList.add("smart-hidden");else m.classList.add("smart-hidden")}}_addColumnDialogInitEditors(e,t,a){const l=this,i=e.editColumn,n=()=>{const e=a.deadline.parentElement.querySelector(".smart-input"),t=a.deadlineStatus.parentElement,l=a.deadlineDueDate.parentElement,i=t.querySelector("smart-input"),n=l.querySelector("smart-input");t.classList.add("smart-hidden"),l.classList.add("smart-hidden"),2===e.selectedIndex?l.classList.remove("smart-hidden"):1===e.selectedIndex&&t.classList.remove("smart-hidden"),i.dataSource&&0===i.dataSource.length&&t.classList.add("smart-hidden"),n.dataSource&&0===n.dataSource.length&&l.classList.add("smart-hidden")};for(let o in a){const s=a[o],r=s.querySelector("input"),d=s.querySelector("smart-input");switch(o){case"allowTimeFormat":{const e=s.querySelector(".smart-input");i&&i.editor?"dateInput"===i.editor.template?(e.value=!1,e.removeAttribute("checked")):(e.value=!0,e.setAttribute("checked","")):(e.value=!1,e.removeAttribute("checked"));break}case"allowRichText":{const e=s.querySelector(".smart-input");i&&"richText"===i.template?(e.value=!0,e.setAttribute("checked","")):(e.value=!1,e.removeAttribute("checked"));break}case"allowCustomDateSeparator":{const e=s.querySelector(".smart-input");e.value=!1,e.removeAttribute("checked");let t=0;i&&i.cellsFormat&&(i.cellsFormat.indexOf(".")>=0?(e.value=!0,e.setAttribute("checked",""),t=2):(i.cellsFormat.indexOf("M-d-yyyy")>=0||i.cellsFormat.indexOf("d-M-yyyy")>=0||i.cellsFormat.indexOf("yyyy/MM/dd")>=0)&&(e.value=!0,e.setAttribute("checked",""),t=1));const l=a.dateFormatSeparator.querySelectorAll(".smart-grid-dialog-boolean-field");l.forEach((e=>{e.value=!1,e.removeAttribute("checked")})),l[t].setAttribute("checked",""),l[t].click(),l[t].value=!0;break}case"kanban":{const t=s.querySelectorAll(".smart-grid-dialog-boolean-field");for(let a=0;a<t.length;a++){const i=t[a];i.onchange=a=>{const n=[...a.parentElement.children].indexOf(a),o=a.parentElement.parentElement.previousElementSibling,s=e.querySelector('[field-name="options"]'),r=e.querySelector('[field-name="allowColorItems"]'),d=e.querySelector('[field-name="name"]'),c=()=>{const t=s.querySelector("smart-sortable");t&&(t._validate(),e&&e.offsetHeight&&e.setPosition("center"))};n===t.length-1?(o.innerHTML=l.localize("kanbanBasicDescription"),r.classList.remove("smart-hidden"),s.classList.remove("smart-hidden"),d.classList.remove("smart-hidden"),d.querySelector(".smart-grid-dialog-editor ").classList.remove("smart-hidden"),d.querySelector("smart-input").value=l.localize("dialogNewColumn"),c()):n===t.length-2?(o.innerHTML=l.localize("kanbanNoneDescription"),r.classList.add("smart-hidden"),s.classList.add("smart-hidden"),d.classList.remove("smart-hidden"),d.querySelector(".smart-grid-dialog-editor ").classList.remove("smart-hidden"),d.querySelector("smart-input").value=l.localize("dialogNewColumn"),c()):(o.innerHTML=l.localize("kanbanDescription",{column:i.label.innerHTML}),r.classList.add("smart-hidden"),s.classList.remove("smart-hidden"),s.classList.add("smart-hidden"),d.classList.add("smart-hidden"),d.querySelector("smart-input").value=i.label.innerHTML,d.querySelector(".smart-grid-dialog-editor").classList.add("smart-hidden"),c())}}break}case"dateFormat":i&&i.cellsFormat?i.cellsFormat.indexOf("M/d/yyyy")>=0?d.selectedIndex=0:i.cellsFormat.indexOf("dddd, MMMM dd, yyyy")>=0?d.selectedIndex=1:i.cellsFormat.indexOf("yyyy-MM-ddTHH:mm:ss.sssZ")>=0?d.selectedIndex=2:i.cellsFormat.indexOf("d/M/yyyy")>=0?d.selectedIndex=3:i.cellsFormat.indexOf("yyyy-MM-dd")>=0?d.selectedIndex=4:i.cellsFormat.indexOf("MMMM, dd, yyyy")>=0&&(d.selectedIndex=5):d.selectedIndex=0;break;case"timeFormat":i&&i.cellsFormat&&i.cellsFormat.indexOf("HH")>=0&&-1===i.cellsFormat.indexOf("T")?d.selectedIndex=1:d.selectedIndex=0;break;case"allowMultipleCollaborators":{let e=!1;i&&i.editor&&i.editor.singleSelect&&(e=!1);const t=s.querySelector(".smart-input");i&&e?(t.value=!0,t.setAttribute("checked","")):(t.value=!1,t.removeAttribute("checked"));break}case"allowThousandsSeparator":{const e=s.querySelector(".smart-input");i&&i.editor&&"numberInput"===i.editor.template&&"progress"!==i.template&&"rating"!==i.template?(e.value=!0,e.setAttribute("checked",""),i.editor.numberFormat&&("decimal"!==i.editor.numberFormat.style||i.editor.numberFormat.notation||i.editor.numberFormat.useGrouping||(e.value=!1,e.removeAttribute("checked")))):(e.value=!0,e.setAttribute("checked",""));break}case"numberFormat":if(i&&"numberInput"===i.editor.template&&i.editor.numberFormat)if("decimal"===i.editor.numberFormat.style&&0===i.editor.numberFormat.maximumFractionDigits)d.selectedIndex=0;else if("decimal"===i.editor.numberFormat.style&&2===i.editor.numberFormat.minimumFractionDigits)d.selectedIndex=1;else if("percent"===i.editor.numberFormat.style&&2===i.editor.numberFormat.minimumFractionDigits)d.selectedIndex=2;else if("percent"===i.editor.numberFormat.style&&0===i.editor.numberFormat.maximumFractionDigits)d.selectedIndex=3;else if("decimal"===i.editor.numberFormat.style&&"scientific"===i.editor.numberFormat.notation)d.selectedIndex=4;else if("decimal"===i.editor.numberFormat.style&&"engineering"===i.editor.numberFormat.notation)d.selectedIndex=5;else if("currency"===i.editor.numberFormat.style&&"accounting"===i.editor.numberFormat.currencySign)d.selectedIndex=6;else if("unit"===i.editor.numberFormat.style){d.selectedIndex=7;const e=i.editor.numberFormat.unit,t=a.unit.querySelector("smart-input");t.dataSource.forEach(((a,l)=>{if(a.value===e)return t.selectedIndex=l,!0}))}else"currency"===i.editor.numberFormat.style&&0===i.editor.numberFormat.maximumFractionDigits&&0===i.editor.numberFormat.minimumFractionDigits?d.selectedIndex=9:"currency"===i.editor.numberFormat.style&&(d.selectedIndex=8);else d.selectedIndex=0;break;case"currency":if(i&&"numberInput"===i.editor.template&&i.editor.numberFormat){if("currency"===i.editor.numberFormat.style){const e=l._getCurrencies().findIndex((e=>e.value===i.editor.numberFormat.currency));e>=0&&(d.selectedIndex=e)}}else d.selectedIndex=0;break;case"allowCheckItems":{const e=s.querySelector(".smart-input");i?i.editor&&!i.editor.pills?(e.value=!0,e.setAttribute("checked","")):!1===i[o]&&(e.value=!1,e.removeAttribute("checked")):(e.value=!0,e.setAttribute("checked",""));break}case"allowColorItems":{const e=s.querySelector(".smart-input");i?i.editor&&i.editor.colorItems?(e.value=!0,e.setAttribute("checked","")):!1===i[o]&&(e.value=!1,e.removeAttribute("checked")):(e.value=!0,e.setAttribute("checked",""));break}case"setDefaultValue":{const e=s.querySelector(".smart-input");i?(e.value=!1,e.removeAttribute("checked"),i&&void 0!==i.defaultValue&&null!==i.defaultValue&&(e.value=!0,e.setAttribute("checked",""))):(e.value=!1,e.removeAttribute("checked"));break}case"defaultString":{const e=s.querySelector("smart-input");i&&void 0!==i.defaultValue&&null!==i.defaultValue?e.value=i.defaultValue:e.value="";break}case"defaultNumber":{const e=s.querySelector("smart-number-input");i&&void 0!==i.defaultValue&&null!==i.defaultValue?e.value=i.defaultValue:e.value=0;break}case"deadline":{const e=s.querySelector(".smart-input");e.selectedIndex=0,e.onchange=()=>{n()},i&&i.editor&&(e.selectedIndex=0,i.editor.onValidate&&"dueDate"!==i.template&&(e.selectedIndex=2),"dueDate"===i.template&&(e.selectedIndex=1)),n();break}case"deadlineStatus":{const t=s.querySelector(".smart-input"),a=[];for(let e=0;e<l.columns.length;e++){const t=l.columns[e];t&&t.editor&&t.editor.dataSource&&t.editor.singleSelect&&a.push({label:t.label,value:t.dataField})}a.length?t.dataSource=[{label:l.localize("dialogAddColumnTypeNone"),value:"none"}].concat(a):t.dataSource=a,e.editColumn&&(t.selectedValue="",e.editColumn&&e.editColumn.editor.boundDataField&&(t.selectedValue=e.editColumn.editor.boundDataField)),a.length||s.parentElement.classList.add("smart-hidden"),n();break}case"deadlineDueDate":{const t=s.querySelector(".smart-input"),a=[];for(let e=0;e<l.columns.length;e++){const t=l.columns[e];t&&"dueDate"===t.template&&a.push({label:t.label,value:t.dataField})}t.dataSource=a,e.editColumn&&(t.selectedValue="",e.editColumn&&e.editColumn.editor.boundDataField&&(t.selectedValue=e.editColumn.editor.boundDataField)),a.length||s.parentElement.classList.add("smart-hidden"),n();break}case"formula":{const t=s.querySelector(".smart-input");t.clearValue(),e.editColumn&&e.editColumn.formula&&(t.value=e.editColumn.formula);break}case"relationId":{const e=s.querySelector(".smart-input");e.dataSource=l._getRelations(),e.clearValue(),e.selectedValue=i?i.relationId:"";const t=s.querySelector(".field-input");t.dataSource=l._getRelationFieldsData(i?i.relationId:-1),t.clearValue(),i&&i.relationField&&(t.selectedValue=i.relationField);break}case"allowResize":case"allowSort":case"allowEdit":case"allowFilter":case"required":{const e=s.querySelector(".smart-input"),a=t.find((e=>{if(e.bind===o)return e}));i?i[o]?(e.value=!0,e.setAttribute("checked","")):!1===i[o]&&(e.value=!1,e.removeAttribute("checked")):(e.value=!0,a&&void 0!==a.value&&(e.value=a.value),e.value&&e.setAttribute("checked",""));break}}if(!i||"options"!==o&&"users"!==o){const e=s.querySelector("smart-sortable");if(e&&e._init)if("users"===o){let t=[];for(let e=0;e<l.users.length;e++)t.push({color:l.users[e].color,label:l.users[e].name,id:l.users[e].id,value:l.users[e].id,image:l.users[e].image});e._init(t)}else e._init()}else{const e=s.querySelector("smart-sortable");if(e&&e._init)if(i.editor.singleSelect){const t=i.editor.dataSource.filter((e=>""!==e));e._init(t)}else if("multiComboInput"===i.editor.template)if("users"===o){let t=[];for(let e=0;e<l.users.length;e++)t.push({color:l.users[e].color,label:l.users[e].name,id:l.users[e].id,value:l.users[e].id,image:l.users[e].image});e._init(t)}else e._init(JSON.parse(JSON.stringify(i.editor.dataSource)))}if(i&&"type"===o?(d.dataSource=l._getTypesList(),"number"===i.dataType||"int"===i.dataType?d.dataSource.length>3&&(d.selectedIndex=3):"date"===i.dataType?d.dataSource.length>3&&(d.selectedIndex=7):"bool"!==i.dataType&&"boolean"!==i.dataType||d.dataSource.length>3&&(d.selectedIndex=6),i.editor&&i.editor.template&&d.dataSource.forEach(((e,t)=>{switch(e.value){case"string":"input"===i.editor.template&&(d.selectedIndex=t);break;case"number":"numberInput"===i.editor.template&&"progress"!==i.template&&"rating"!==i.template&&(d.selectedIndex=t);break;case"select":"multiComboInput"===i.editor.template&&i.editor.singleSelect&&"tags"===i.template&&!i.relationId&&(d.selectedIndex=t);break;case"multiSelect":"multiComboInput"!==i.editor.template||i.editor.singleSelect||"tags"!==i.template||i.relationId||(d.selectedIndex=t);break;case"multiText":"textarea"===i.editor.template&&(d.selectedIndex=t);break;case"date":"dateInput"!==i.editor.template&&"dateTimePicker"!==i.editor.template||(d.selectedIndex=t);break;case"duration":"dateRangeInput"===i.editor.template&&(d.selectedIndex=t);break;case"time":"timeInput"===i.editor.template&&(d.selectedIndex=t);break;case"checkBox":"checkBox"===i.editor.template&&(d.selectedIndex=t);break;case"slider":"slider"===i.editor.template&&(d.selectedIndex=t);break;case"image":"image"===i.editor.template&&(d.selectedIndex=t);break;case"attachment":"attachment"===i.editor.template&&(d.selectedIndex=t);break;case"updatedTime":"updatedTime"===i.template&&(d.selectedIndex=t);break;case"createdTime":"createdTime"===i.template&&(d.selectedIndex=t);break;case"createdBy":"createdBy"===i.template&&(d.selectedIndex=t);break;case"updatedBy":"updatedBy"===i.template&&(d.selectedIndex=t);break;case"collaborator":("collaborator"===i.template&&i.editor&&i.editor.collaborator||"tags"===i.template&&i.editor&&i.editor.collaborator)&&(d.selectedIndex=t);break;case"autoNumber":"autoNumber"===i.template&&(d.selectedIndex=t);break;case"phone":"phone"===i.template&&(d.selectedIndex=t);break;case"password":"password"===i.template&&(d.selectedIndex=t);break;case"url":"url"===i.template&&(d.selectedIndex=t);break;case"email":"email"===i.template&&(d.selectedIndex=t);break;case"dueDate":"dueDate"===i.template&&(d.selectedIndex=t);break;case"rating":"rating"===i.template&&(d.selectedIndex=t);break;case"progress":"progress"===i.template&&(d.selectedIndex=t);break;case"color":"color"===i.template&&(d.selectedIndex=t);break;case"formula":i.formula&&(d.selectedIndex=t);break;case"relationId":i.relationId&&(d.selectedIndex=t)}}))):"type"===o&&(d.selectedIndex=0,d.dropDownOpenPosition="auto",d.dataSource=l._getTypesList()),"cellsAlign"===o&&i&&("center"===i.cellsAlign||"middle"===i.cellsAlign?d.selectedIndex=2:"right"===i.cellsAlign&&(d.selectedIndex=1)),!r)continue;if("dataField"!==o&&"type"!==o&&"deadline"!==o&&"timeFormat"!==o&&"dateFormat"!==o&&"deadlineStatus"!==o&&"deadlineDueDate"!==o&&"relationId"!==o&&"formula"!==o&&"numberFormat"!==o&&"currency"!==o&&"unit"!==o&&"cellsAlign"!==o&&d&&(d.selectedIndex=0),"name"===o){if(i){const e=i.label;d.value=l._unescapeString(e)}else d.value="";d.placeholder=t.find((e=>{if(e.bind===o)return e})).placeholder}"description"===o&&(d.value=i?l._unescapeString(i.description):"",d.placeholder=t.find((e=>{if(e.bind===o)return e})).placeholder);const c=(e,t)=>{i&&i.validationRules.forEach((a=>"minDate"===a.type&&"minDateTime"===e||"maxDate"===a.type&&"maxDateTime"===e||"min"===a.type&&"minValue"===e||"max"===a.type&&"maxValue"===e||a.type===e?(t.value=a.value,!0):void 0))};if("minValue"===o?(r.value=-9999999,c(o,r)):"maxValue"===o?(r.value=9999999,c(o,r)):"minLength"===o?(r.value=0,c(o,r)):"maxLength"===o&&(r.value=500,c(o,r)),"minDateTime"===o){const e=s.querySelector("smart-date-input");e.value=new Date(1900,0,1),c(o,e)}else if("maxDateTime"===o){const e=s.querySelector("smart-date-input");e.value=new Date(2100,0,1),c(o,e)}}}_createColumnBooleanEditor(e,t,a,l,i){e.setAttribute("template","checkBox"),e.setAttribute("editor","");const n=document.createElement("div");return n.classList.add("smart-input"),n.classList.add("smart-grid-cell-editor"),n.classList.add("smart-grid-check-box-cell-editor"),n.setAttribute("checked",""),n.value=!0,t.width&&(a.style.width=t.width,a.style.float="left"),!1===t.value&&(n.value=!1,n.removeAttribute("checked")),e.appendChild(n),e.getValue=function(){return n.value},e.check=function(){n.setAttribute("checked",""),n.value=!0,e.onchange&&e.onchange(n.value)},e.uncheck=function(){n.removeAttribute("checked"),n.value=!1,e.onchange&&e.onchange(n.value)},e.toggle=function(){!0!==n.value&&!1!==n.value&&null!==n.value&&(n.value=!1),null===n.value?n.value=!1:n.value=!n.value,!1===n.value?n.removeAttribute("checked"):n.setAttribute("checked",n.value?"":"indeterminate"),e.onchange&&e.onchange(n.value)},e.onclick=i.onclick=()=>{e.toggle()},e.setAttribute("tabindex",0),e.onkeydown=t=>{" "!==t.key&&"Enter"!==t.key||e.toggle()},l.appendChild(a),a.classList.add("smart-grid-dialog-boolean-field"),a.appendChild(e),a.appendChild(i),e}_getColumnTemplateByType(e,t){switch(e){case"boolean":case"bool":return"checkBox";case"image":return"image";case"rating":return"rating";case"attachment":return"attachment";case"createdBy":case"updatedBy":return e;case"collaborator":return"collaborator";case"relationId":return"tags";case"select":case"multiSelect":return"tags";case"url":return"url";case"email":return"email";case"autoNumber":return"autoNumber";case"password":return"password";case"createdTime":return"createdTime";case"updatedTime":return"updatedTime";case"dueDate":return"dueDate";case"duration":return"duration";case"multiText":return t.allowRichText?"richText":"";default:return""}}_getRelations(){const e=this;let t=[];t.push({label:"",menuLabel:"&nbsp;",value:""});for(let a=0;a<e.dataSourceSettings.relations.length;a++){const l=e.dataSourceSettings.relations[a];t.push({value:l.id,label:l.label})}return t}_getRelationFieldsData(e){const t=this;let a={};for(let e=0;e<t.dataSourceSettings.relations.length;e++){const l=t.dataSourceSettings.relations[e];a[l.id]=l}const l=a[e];return l?("string"==typeof l.columns?JSON.parse(l.columns):l.columns).filter((e=>!e.template||"tags"===e.template||"collaborator"===e.template||"dropdownlist"===e.template||"list"===e.template)).map((e=>({label:e.label,value:e.dataField}))):[]}_getRelationData(e,t,a){const l=this,i=[];if(!l.dataSourceSettings.relations||!l.dataSourceSettings.relations.length)return;let n=0;const o=["#D50000","#E67C73","#F4511E","#F6BF26","#33B679","#0B8043","#039BE5","#3F51B5","#7986CB","#8E24AA","#616161"];for(let a=0;a<l.dataSourceSettings.relations.length;a++){const n=l.dataSourceSettings.relations[a];if(n.id===e){const e=t,a=[];if(n.dataSource)for(let t=0;t<n.dataSource.length;t++){const l=n.dataSource[t][e];null!=l&&""!==l&&(a[l]||(a[l]=!0,i.push({value:l,label:l})))}break}}i.length&&(a&&i.push({value:"",label:""}),i.sort(((e,t)=>e.label<t.label?-1:e.label>t.label?1:0)));for(let e=0;e<i.length;e++)i[e].color=o[n],n++,n>=o.length-1&&(n=0);return i}_confirmAddColumnDialog(e){const t=this,a=e.querySelectorAll(".smart-grid-dialog-editor"),l=[];let i,n,o={};e===t._dialogAddStackColumn&&(o.type="select");for(let e=0;e<a.length;e++){const l=a[e],i=l.querySelector(".smart-input"),n=l.getAttribute("bind"),s=l.parentElement;if("kanban"!==n)if("name"!==n&&"description"!==n)if("minLength"!==n&&"maxLength"!==n&&"minValue"!==n&&"maxValue"!==n&&"minDateTime"!==n&&"maxDateTime"!==n)if("options"!==n&&"users"!==n){if("relationId"===n)o.relationIdLabel=i.value,o.relationField=l.querySelector(".field-input").selectedValue,o.relationFieldLabel=l.querySelector(".field-input").value;else if("formula"===n){if("formula"!==o.type)continue;o.formula=i.value}else if("allowEdit"===n&&s.classList.contains("smart-hidden"))i.value=!1;else if("required"===n&&s.classList.contains("smart-hidden"))i.value=!1;else if("dateFormatSeparator"===n){const e=l.querySelectorAll(".smart-grid-dialog-boolean-field");for(let t=0;t<e.length;t++)if(e[t].querySelector("[checked]")){switch(t){case 0:o.dateFormatSeparatorType="/";break;case 1:o.dateFormatSeparatorType="-";break;case 2:o.dateFormatSeparatorType="."}break}}i&&(i.getSelectedItem?o[n]=i.getSelectedItem().value:o[n]=i.value)}else{const e=[],a=l.querySelectorAll(".smart-grid-add-column-dialog-color-item .edit-column-input"),i=l.querySelectorAll(".smart-grid-add-column-dialog-color-item smart-color-input");for(let t=0;t<a.length;t++){const l=a[t],n={label:l.value.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/'/g,"&#39;").replace(/"/g,"&quot;").replace(/\\/g,""),value:l.getAttribute("data-item-value").replace(/\\/g,""),id:parseInt(l.getAttribute("data-id")),color:i[t].value};n.color=i[t].value,e.push(n)}if("users"===n&&"collaborator"===o.type){t.users||(t.users=[]);for(let a=0;a<e.length;a++){const l=e[a],i=t.users.find((e=>e.id===l.id));i&&(i.name=l.label,i.color=l.color)}}o[n]=e;const s=l.querySelector(".smart-default-item");o["default_"+n]=s.selectedValues?s.selectedValues[0]:null}else o[n]=i.getValue();else o[n]=i.value.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/'/g,"&#39;").replace(/"/g,"&quot;");else{const e=l.querySelectorAll(".smart-grid-dialog-boolean-field");for(let t=0;t<e.length;t++){const a=e[t];if(a.querySelector("[checked]")){o.kanban=a.name;break}}}}e.data=o;let s={},r={},d="";if(i=o.minDateTime,n=o.maxDateTime,"date"===o.type||"dueDate"===o.type||"startDate"===o.type){s={template:"dateInput",min:i,max:n};let e=!1;o.deadlineStatus&&(s.boundDataField=o.deadlineStatus),"-"!==o.dateFormat&&(d=o.dateFormat,o.allowCustomDateSeparator&&(d.indexOf("/")>=0?d=d.replaceAll("/",o.dateFormatSeparatorType):d.indexOf("-")>=0?d=d.replaceAll("-",o.dateFormatSeparatorType):d.indexOf(".")>=0&&(d=d.replaceAll(".",o.dateFormatSeparatorType))),o.dateFormat.indexOf("T")>=0&&(s.template="dateTimePicker",s.dropDownDisplayMode="auto",s.formatString=d),e=!0),s.autoOpen=!0,o.allowTimeFormat&&"-"!==o.timeFormat&&(e&&(d+=" "),d+=o.timeFormat,s.template="dateTimePicker",s.dropDownDisplayMode="auto",s.formatString=d),o.cellsFormat=d,l.push({type:"minDate",value:i}),l.push({type:"maxDate",value:n})}else if("time"===o.type)s={template:"timeInput",hour12:!0},o.timeFormat.indexOf("HH")>=0&&(s.hour12=!1),s.autoOpen=!0,d=o.timeFormat,o.cellsFormat=d;else if("duration"===o.type)s={template:"dateRangeInput"},d="MM/dd/yyyy hh:mm",o.cellsFormat=d;else if("number"===o.type||"slider"===o.type){i=parseInt(o.minValue),n=parseInt(o.maxValue),o.numberFormat=JSON.parse(JSON.stringify(o.numberFormat)),"unit"===o.numberFormat.style&&(o.numberFormat.unit=o.unit);let e=null,a=null;"currency"===o.numberFormat.style&&(o.numberFormat.currency=o.currency,o.numberFormat.locale=t._getLocaleByCurrency(o.currency)),"decimal"!==o.numberFormat.style||o.numberFormat.notation||(o.numberFormat.useGrouping=o.allowThousandsSeparator),"squaremeter"===o.numberFormat.unit&&(o.numberFormat={type:"squaremeter",style:"decimal",maximumFractionDigits:0}),"cubicmeter"===o.numberFormat.unit&&(o.numberFormat={type:"cubicmeter",style:"decimal",maximumFractionDigits:0}),s={template:"number"===o.type?"numberInput":"slider",min:i,max:n,numberFormat:o.numberFormat},r={Intl:{NumberFormat:o.numberFormat}},a&&(r=a),d="d",e&&(d=e),l.push({type:"min",value:i}),l.push({type:"max",value:n})}else if("rating"===o.type)s={template:"rating"};else if("boolean"===o.type)s={template:"checkBox"};else if("image"===o.type)s={template:"image"};else if("attachment"===o.type)s={template:"attachment"};else if("relationId"===o.type){const e=!o.relationMultiField;let a=t._getRelationData(o.relationId,o.relationField,e);s={template:"multiComboInput",readonly:!0,colorItems:!0,dropDownButtonPosition:"right",autoOpen:!0,relationId:o.relationId,relationField:o.relationField,pills:!0,singleSelect:e,dataSource:a}}else if("select"===o.type||"multiSelect"===o.type||"tags"===o.type){let a=o.options,l=!1;if("select"===o.type)if(e.editColumn&&!e.editColumn.editor.allowEmptyItem){a=o.options;const i=[];for(let e=0;e<o.options.length;e++)if(""===o.options[e].label)o.options[e].value="";else if(""===o.options[e].value){const t=o.options[e].label.trim();if(i[t])continue;o.options[e].value=t,i.push(t)}else if(!isNaN(parseInt(o.options[e].value))){const t=o.options[e].label.trim();if(i[t])continue;o.options[e].value=t,i.push(t)}if(e.editColumn._dataField&&"taskStatus"===e.editColumn._dataField||e===t._dialogAddStackColumn)for(let e=0;e<o.options.length;e++){const t=o.options[e];isNaN(parseInt(t.value))||(t.value=t.label.replaceAll(" ",""))}a=o.options;let n=!1;for(let e=0;e<o.options.length;e++)if(""===o.options[e].label){n=!0,l=!0,o.options[e].value="";break}a=!n&&o.options.length?[{color:"#F47A54",value:"",label:""}].concat(o.options):o.options}else{const e=[];let t=!1;for(let a=0;a<o.options.length;a++)if(""===o.options[a].label)t=!0,l=!0,o.options[a].value="";else if(""===o.options[a].value){const t=o.options[a].label.trim();if(e[t])continue;o.options[a].value=t,e.push(t)}else if(!isNaN(parseInt(o.options[a].value))){const t=o.options[a].label.trim();if(e[t])continue;o.options[a].value=t,e.push(t)}a=!t&&o.options.length?[{color:"#F4511E",value:"",label:""}].concat(o.options):o.options}else if("multiSelect"===o.type){const e=[];for(let t=0;t<o.options.length;t++)if(""===o.options[t].label)o.options[t].value="";else if(""===o.options[t].value){const a=o.options[t].label.trim();if(e[a])continue;o.options[t].value=a,e.push(a)}else if(!isNaN(parseInt(o.options[t].value))){const a=o.options[t].label.trim();if(e[a])continue;o.options[t].value=a,e.push(a)}a=o.options}a.length&&""===a[0]&&!l&&o.required&&(a=a.splice(1)),s={template:"multiComboInput",readonly:!0,dropDownButtonPosition:"right",colorItems:o.allowColorItems,autoOpen:!0,pills:!0,singleSelect:"select"===o.type,dataSource:a}}else if("collaborator"===o.type){let e=o.users;o.allowMultipleCollaborators||e&&e.length&&""!==e[0].value&&(e=[{label:"",value:"",color:"#F47A54"}].concat(o.users));for(let a=0;a<t.users.length;a++)e.forEach((e=>{e.value!==t.users[a].id&&e.value!==""+t.users[a].id||(e.image=t.users[a].image,e.id=t.users[a].id)}));s={template:"multiComboInput",readonly:!0,collaborator:!0,colorItems:o.allowColorItems,dropDownButtonPosition:"right",autoOpen:!0,pills:!0,singleSelect:!o.allowMultipleCollaborators,dataSource:e}}else"multiText"===o.type?(i=o.minLength,n=o.maxLength,s={template:"textarea",min:i,max:n,required:o.required},l.push({type:"minLength",value:i}),l.push({type:"maxLength",value:n})):"password"===o.type?(i=o.minLength,n=o.maxLength,s={template:"password",min:i,max:n,required:o.required},l.push({type:"minLength",value:i}),l.push({type:"maxLength",value:n})):"phone"===o.type?s={template:"phone",required:o.required}:(i=o.minLength,n=o.maxLength,s={template:"input",min:i,max:n,required:o.required},l.push({type:"minLength",value:i}),l.push({type:"maxLength",value:n}));let c="string";switch(o.type){case"boolean":case"bool":c="boolean";break;case"createdTime":case"updatedTime":case"duration":case"date":case"time":c="date";break;case"autoNumber":case"slider":case"rating":case"number":c="number"}const u=e=>{if(o.setDefaultValue)switch(o.type){case"string":case"multiText":case"description":case"name":e.defaultValue=o.defaultString;break;case"number":case"slider":e.defaultValue=o.defaultNumber;break;case"date":case"dueDate":case"startDate":e.defaultValue="current"===o.defaultDate?"today":o.defaultDateValue;break;case"collaborator":void 0!==o.default_users?e.defaultValue=o.default_users:e.defaultValue=null;break;case"select":case"multiSelect":case"status":case"priority":o.default_options?e.defaultValue=o.default_options:e.defaultValue=null}else e.defaultValue=null};if(e.editColumn){const a=e.editColumn;a.canNotify=!1,a.label=o.name,void 0!==o.description&&(a.description=o.description),a.showDescriptionButton=!0,void 0!==o.allowResize&&(a.allowResize=o.allowResize),void 0!==o.allowSort&&(a.allowSort=o.allowSort),void 0!==o.allowFilter&&(a.allowFilter=o.allowFilter),void 0!==o.allowEdit&&(a.allowEdit=o.allowEdit),void 0!==o.cellsAlign&&(a.align=a.cellsAlign=o.cellsAlign),void 0!==o.cellsFormat&&(a.cellsFormat=d),void 0!==o.formula?a.formula=o.formula:a.formula="";const i=a._editorId?a._editorId:"",n=s.template+"_"+a.dataField+i;t._cellEditors[n]&&delete t._cellEditors[n];let m=!0;"list"!==a.template&&"dropDownList"!==a.template||(m=!1),"autoNumber"!==a.template&&"createdBy"!==a.template&&"updatedBy"!==a.template&&"createdTime"!==a.template&&"progress"!==a.template&&"updatedTime"!==a.template&&"checklist"!==a.template&&"color"!==a.template||(m=!1),a.editor&&a.editor.template.indexOf("custom")>=0&&(m=!1),a.editor&&a.editor.disabledDialogOptions&&(m=!1),u(a),m&&(a.editor=JSON.parse(JSON.stringify(s)),a.template=t._getColumnTemplateByType(o.type,o),a._cellsCachedValues=[]),"date"===o.type&&("dueDate"===o.deadline?(s=t._getKanbanTaskField("dueDate").editor,o.deadlineStatus&&(s.boundDataField=o.deadlineStatus),a.template="dueDate"):"startDate"===o.deadline?(s=t._getKanbanTaskField("startDate").editor,o.deadlineDueDate&&(s.boundDataField=o.deadlineDueDate),a.template="startDate"):(a.template="",s.template="dateInput",s.onValidate=null)),"relationId"===o.type&&(a.relationId=o.relationId,a.relationField=o.relationField),a.formatSettings=r,o.type!==e.columnType&&e.columnType&&(a.dataType=c),a.icon=t._getIconByType(o.type),a._isDirty=!0,o.required&&l.push({type:"required"}),a.validationRules=l,a._state&&["label","description","defaultValue","showDescriptionButton","dataSet","dataType","editor","formatSettings","template","summary","validationRules","allowResize","allowSort","allowFilter","allowEdit","align","cellsAlign","cellsFormat"].forEach((e=>{a._state[e]=a[e]})),a.canNotify=!0,t.$.fireEvent("closeColumnDialog",{dataField:a.dataField}),t.onColumnUpdated&&t.onColumnUpdated(t.columns.indexOf(a),a),t._onColumnUpdated&&t._onColumnUpdated(a,o),t._recycle(!0),a.refresh(),a._isDirty=!1}else{let e=[];"number"===c&&(e=["sum"]);const a=t._getColumnLabel(o),i=new Smart.Grid.Column({label:a,description:o.description,dataField:o.dataField||"dataField"+Math.floor(65536*(1+Math.random())).toString(16).substring(1),allowResize:o.allowResize,allowSort:o.allowSort,allowFilter:o.allowFilter,allowEdit:o.allowEdit,showDescriptionButton:!0,dataType:c,editor:s,summary:e,template:t._getColumnTemplateByType(o.type,o),formatSettings:r,cellsAlign:o.cellsAlign,align:o.cellsAlign,cellsFormat:d,visibleIndex:t.columns.length-1,formula:o.formula,relationId:o.relationId,relationField:o.relationField,grid:t});if("autoNumber"===i.template&&(i.autoGenerated=!0,e=[]),u(i),o.required&&(l.push({type:"required"}),i.validationRules=l),"date"===o.type&&("dueDate"===o.deadline?o.type="dueDate":"startDate"===o.deadline&&(o.type="startDate")),"collaborator"===o.type){let e=!1;for(let a=0;a<t.columns.length;a++)if("taskUserId"===t.columns[a]._dataField){e=!0;break}e||(i._dataField="taskUserId")}if(t._getKanbanFields().indexOf(o.type)>=0){const e=t._getKanbanTaskField(o.type);switch(u(e),"startDate"===o.type&&o.deadlineDueDate&&(e.editor.boundDataField=o.deadlineDueDate),"dueDate"===o.type&&o.deadlineStatus&&(e.editor.boundDataField=o.deadlineStatus),delete e._state,o.description&&(e.description=o.description),o.name&&(e.label=o.name),e.allowFilter=o.allowFilter,e.allowResize=o.allowResize,e.allowSort=o.allowSort,o.type){case"priority":case"status":case"tags":e.editor.dataSource=JSON.parse(JSON.stringify(o.options))}let a=t.columnByDataField[e.dataField];if("status"===o.type||"name"===o.type||"description"===o.type)for(let e=0;e<t.columns.length;e++){const l=t.columns[e];if(l._dataField&&!t.columnByDataField[l._dataField]&&(t.columnByDataField[l._dataField]=l),l.statusColumn||"taskStatus"===l._dataField){a=l;break}}a&&!1===a._visible?(a.visible=!0,delete a._visible):(a&&(e.dataField=e.displayField="dataField"+Math.floor(65536*(1+Math.random())).toString(16).substring(1),"object"==typeof e.editor&&e.editor.dataSource&&(e.editor.dataSource=JSON.parse(JSON.stringify(e.editor.dataSource))),o.name||(e.label=e.label+" "+t.localize("copy"))),t.columns.push(e))}else t.columns.push(i);t._refreshHeaderBar(),t.$.fireEvent("closeColumnDialog",{dataField:i.dataField})}}_getColumnLabel(e){const t=this;let a=e.name;if(!a){let a="";switch(e.type){case"string":a=t.localize("dialogAddColumnTypeText");break;case"multiText":a=t.localize("dialogAddColumnTypeMultilineText");break;case"image":a=t.localize("dialogAddColumnTypeImage");break;case"attachment":a=t.localize("dialogAddColumnTypeAttachment");break;case"number":a=t.localize("dialogAddColumnTypeNumber");break;case"select":a=t.localize("dialogAddColumnTypeSelect");break;case"multiSelect":a=t.localize("dialogAddColumnTypeMultipleSelect");break;case"boolean":a=t.localize("dialogAddColumnTypeCheckBox");break;case"date":a=t.localize("dialogAddColumnTypeDate");break;case"time":a=t.localize("dialogAddColumnTypeTime");break;case"duration":a=t.localize("dialogAddColumnTypeDuration");break;case"createdTime":a=t.localize("dialogAddColumnTypeCreatedTime");break;case"updatedTime":a=t.localize("dialogAddColumnTypeLastUpdatedTime");break;case"createdBy":a=t.localize("dialogAddColumnTypeCreatedBy");break;case"updatedBy":a=t.localize("dialogAddColumnTypeLastUpdatedBy");break;case"collaborator":a=t.localize("dialogAddColumnTypeCollaborator");break;case"slider":a=t.localize("dialogAddColumnTypeSlider");break;case"autoNumber":a=t.localize("dialogAddColumnTypeAutoNumber");break;case"url":a=t.localize("dialogAddColumnTypeURL");break;case"relationId":a=t.localize("dialogAddColumnTypeRowLink"),e.relationFieldLabel&&e.relationIdLabel&&(a=e.relationFieldLabel+" ("+e.relationIdLabel+")");break;case"formula":a=t.localize("dialogAddColumnTypeFormula");break;case"email":a=t.localize("dialogAddColumnTypeEmail");break;case"phone":a=t.localize("dialogAddColumnTypePhone");break;case"password":a=t.localize("dialogAddColumnTypePassword");break;case"rating":a=t.localize("dialogAddColumnTypeRating")}let l=1;for(let e=0;e<t.columns.length;e++)t.columns[e].label.indexOf(a)>=0&&l++;return 1===l?a:a+" "+l}return a}_openAddColumnDialog(e,t,a){const l=this,i=l._dialogAddColumn||l._createDialog(l.editing.addColumnDialog),n=e?l.localize("dialogEditColumn",{value:e.label}):l.localize("dialogAddColumn"),o=i.querySelector(".smart-footer").querySelector(".smart-stack-layout");i.classList.add("smart-grid-dialog-add-column"),i.type=e?"customize":"add",i.editColumn=e||null,delete i._randomOptionIndex,e&&e.element?e.element.setAttribute("focus",""):l._addNewColumn&&l._addNewColumn.element.setAttribute("focus",""),o.classList.remove("right"),o.classList.add("center"),l._cellEditors||(l._cellEditors=[]);const s=l._getAddColumnDialogTemplate();if(i.header.innerHTML=n,i.header.parentElement.classList.add("smart-hidden"),i.callback=a,!0===t&&(i.header.parentElement.classList.remove("smart-hidden"),"kanban"===l.view?(i.header.innerHTML=l.localize("dialogAddColumnStatus"),i.header.parentElement.querySelector(".smart-close-button").classList.add("smart-hidden"),i.classList.add("view")):i.classList.remove("kanban")),i.stackLabel&&i.stackLabel.classList.add("smart-hidden"),"kanban"===l.view?i.btnCancel.classList.add("smart-hidden"):i.btnCancel.classList.remove("smart-hidden"),l.cancelEdit(),!l._dialogAddColumn){i.modal=!0,i.btnConfirm.innerHTML=l.localize("dialogEditButtonConfirm"),i.btnCancel.innerHTML=l.localize("dialogEditButtonCancel"),i._refreshPosition=()=>{const e=l.offset(l.$.columnHeader),t=l.$.columnHeader.offsetHeight,a=l.offset(l);if(i.style.maxHeight="",i.style.minHeight="",e.top+t+i.offsetHeight>window.innerHeight-a.top){const l=t+e.top+i.offsetHeight-window.innerHeight+a.top;i.style.maxHeight=Math.max(250,i.offsetHeight-l)+"px",i.style.minHeight="250px"}else i.style.maxHeight="",i.style.minHeight=""},i.onOpen=function(){const e=l._dialogAddColumn,t=l._getAddColumnDialogTemplate(),a=l._addColumnDialogEditors;if(delete e.columnType,l._addColumnDialogInitEditors(e,t,a),l._addColumnDialogShowHideEditors(e),e.editColumn){const t=e.querySelector('[bind="type"]'),a=t?t.querySelector("smart-input"):null,l=t?a.getSelectedItem().value:"kanban";e.columnType=l}else delete e.columnType;l._filterColumnTypes(),l.$.fireEvent("openColumnDialog",{dataField:e.editColumn?e.editColumn.dataField:null}),e._refreshPosition()},i.onClose=function(){i.editColumn&&i.editColumn.element&&i.editColumn.element.removeAttribute("focus"),l._addNewColumn&&l._addNewColumn.element.removeAttribute("focus"),i.classList.remove("view"),i.callback&&i.callback(i.result)},i.btnCancel.onclick=function(){i.result=!1,i.close()},i.btnClose.onclick=function(){i.result=!1,i.close()},i.btnConfirm.onclick=function(){l._confirmAddColumnDialog(i),i.result=!0,i.close()},i.onkeydown=function(e){"Escape"===e.key&&"kanban"!==l.view&&(i.result=!1,i.close())},l._dialogAddColumn=i;const e=document.createElement("div");e.classList.add("smart-content-layout-container"),i.content.appendChild(e),l._addColumnDialogEditors=[];const t=l._addColumnDialogEditors;l._initAddColumnDialogEditors(t,s,i,e)}const r=()=>{const t=parseInt(i.style.width),a=l.offset(l);if(window.screen.availWidth<400)return i.open("left","top"),i.style.width=l.offsetWidth+"px",void(i.style.height=l.offsetHeight+"px");{const e=l.editing.addColumnDialog;i.style.width="auto"===e.width?e.width:e.width+"px",i.style.height="auto"===e.height?e.height:e.height+"px"}if(e){const n=e.element;if(n){const e=l.offset(n),o=e.left-a.left,s=a.left,r=Math.max(s,o);if(r+t+n.offsetWidth>a.left+l.offsetWidth){const l=r-t+n.offsetWidth;l<0?i.open("center",e.top+n.offsetHeight-a.top):i.open(Math.max(s,l),e.top+n.offsetHeight-a.top)}else i.open(r,e.top+n.offsetHeight-a.top)}else i.classList.add("center"),i.open("center","center")}else if(l._addNewColumn){let e=l._addNewColumn.element,n=l.offset(e),o=n.left-a.left-t+e.offsetWidth,s=a.left,r=Math.max(s,o);l.editing.addNewColumn._addButton&&l.editing.addNewColumn._addButton.classList.contains("show")&&(e=l.editing.addNewColumn._addButton,n=l.offset(l.editing.addNewColumn._addButton),o=n.left-a.left-t+e.offsetWidth,s=a.left,r=Math.max(s,o)),i.open(r,n.top+e.offsetHeight-a.top)}else i.open("center","center"),i.classList.add("center")};r(),i.refresh=()=>{r()}}_filterColumnTypes(){const e=this,t=e._dialogAddColumn;if(!t)return;const a=e._dialogAddColumn.querySelector('[bind="type"]').querySelector("smart-input");if(t.columnType){const l=e._getTypesList().find((e=>{if(e.value===t.columnType)return e}));if(l)if("string"===t.columnType||"multiText"===t.columnType)a.dataSource=e._getTypesList().filter((e=>!(["createdTime","updatedTime","createdBy","updatedBy","autoNumber","image","color","checklist","progress","collaborator","attachment"].indexOf(e.value)>=0)));else if("select"===t.columnType||"multiSelect"===t.columnType){const t=[{value:"string",prefix:'<span class="smart-grid-icon visible smart-icon-font"></span>',label:e.localize("dialogAddColumnTypeText")},{value:"multiText",prefix:'<span class="smart-grid-icon visible smart-icon-fontsize"></span>',label:e.localize("dialogAddColumnTypeMultilineText")},{value:"select",prefix:'<span class="smart-grid-icon visible smart-icon-sort-down"></span>',label:e.localize("dialogAddColumnTypeSelect")},{value:"multiSelect",prefix:'<span class="smart-grid-icon visible smart-icon-list-unordered"></span>',label:e.localize("dialogAddColumnTypeMultipleSelect")}];a.dataSource=t}else{const t=[{value:"string",prefix:'<span class="smart-grid-icon visible smart-icon-font"></span>',label:e.localize("dialogAddColumnTypeText")},{value:"multiText",prefix:'<span class="smart-grid-icon visible smart-icon-fontsize"></span>',label:e.localize("dialogAddColumnTypeMultilineText")}].concat(l);a.dataSource=t}else a.dataSource=e._getTypesList()}else t.editColumn||(a.dataSource=e._getTypesList(),a.selectedIndex=0)}_getIconByType(e){let t="smart-icon-font";switch(e){case"multiText":t="smart-icon-fontsize";break;case"image":t="smart-icon-image";break;case"attachment":t="smart-icon-docs";break;case"number":case"progress":t="smart-icon-number";break;case"priority":case"status":case"select":t="smart-icon-sort-down";break;case"multiSelect":t="smart-icon-list-unordered";break;case"boolean":t="smart-icon-check-squared";break;case"date":case"startDate":case"duration":case"dueDate":t="smart-icon-calendar";break;case"time":case"createdTime":case"updatedTime":t="smart-icon-clock";break;case"createdBy":case"updatedBy":case"collaborator":t="smart-icon-user";break;case"slider":t="smart-icon-number";break;case"autoNumber":case"checklist":t="smart-icon-list-ordered";break;case"url":t="smart-icon-link";break;case"email":t="smart-icon-mail";break;case"password":t="smart-icon-lock";break;case"phone":t="smart-icon-phone";break;case"name":t="smart-icon-font";break;case"description":t="smart-icon-fontsize";break;case"tags":t="smart-icon-list-ordered";break;case"color":t="smart-icon-color-background";break;case"assigned":t="smart-icon-user";break;case"rating":t="smart-icon-star";break;case"relationId":t="smart-icon-table-alt";break;case"formula":t="smart-icon-math"}return t}_initAddColumnDialogEditors(e,t,a,l){const i=this;for(let n=0;n<t.length;n++){const o=t[n],s=document.createElement("div"),r=document.createElement("label");r.innerHTML=o.label;const d=document.createElement("div");if(d.classList.add("smart-grid-dialog-editor","add-column"),d.innerHTML="",d.setAttribute("filter",o.filter),d.setAttribute("bind",o.bind),s.setAttribute("field-name",o.bind),s.setAttribute("field-filter",o.filter),e[o.bind]=d,"type"===o.bind&&d.addEventListener("change",(()=>{i._addColumnDialogShowHideEditors(a),a.editColumn&&i._filterColumnTypes();const t=i._dialogAddColumn.querySelector('[bind="type"]'),l=t.querySelector("smart-input"),n=l.getSelectedItem().value,o=i._getIconByType(n);if(e.type.icon=o,e.name.querySelector("input").setAttribute("data-label",l.value),t.firstElementChild.className="smart-grid-icon show smart-description-button "+o,"select"===n||"multiSelect"===n){const t=e.options.querySelector("smart-sortable");if(t&&t._validate){if(a.editColumn)if(a.editColumn.editor.dataSource){let e=[...a.editColumn.editor.dataSource];"multiSelect"===n&&""===e[0].value&&e.shift(),t._init(e)}else{const e=[];for(let t=0;t<i.rows.length;t++){const l=i.rows[t].data[a.editColumn.dataField];if(l&&l.indexOf(",")>=0){const t=l.split(",");for(let a=0;a<t.length;a++)-1===e.indexOf(t[a].trim())&&e.push(t[a].trim())}else if(-1===e.indexOf(l)&&void 0!==l){if(""===l&&"multiSelect"===n)continue;e.push(l)}}e.length?t._init(e.map((e=>({value:e,label:e})))):t._init()}else t._init();t._validate()}}else if("priority"===n||"status"===n||"tags"===n){const t=e.options.querySelector("smart-sortable"),a=i._getKanbanTaskField(n);t&&t._validate&&(t._init([...a.editor.dataSource]),t._validate())}else a.btnConfirm.disabled=!1})),"boolean"===o.type)i._createColumnBooleanEditor(d,o,s,l,r);else{if("label"===o.type){l.appendChild(s),s.classList.add("smart-grid-dialog-field"),s.appendChild(r);const e=document.createElement("div");e.style.height="10px",s.appendChild(e);continue}if("relationId"===o.type){let e=document.createElement("smart-input");e.classList.add("underlined","edit-column-input"),e.style.width="calc(100% - 25px)",e.style.height="30px",o.width&&(s.style.width=o.width,s.style.float="left"),e.readonly=!0,e.dropDownButtonPosition="right",e.dropDownHeight="auto";let a=i._getRelations(),c={};for(let e=0;e<i.dataSourceSettings.relations.length;e++){const t=i.dataSourceSettings.relations[e];c[t.id]=t}let u=document.createElement("smart-input");u.classList.add("underlined","smart-hidden","edit-column-input","field-input"),u.style.width="calc(100% - 25px)",u.style.height="30px",u.readonly=!0,u.dropDownButtonPosition="right",u.dropDownHeight="auto";const m=document.createElement("div"),p=document.createElement("div");if(p.style.marginTop="5px",p.innerHTML=i.localize("dialogAddColumnLinkField"),p.classList.add("smart-hidden"),e.dataSource=a,e.onchange=()=>{if(u.dataSource=null,u.clearValue(),""===e.value)u.classList.add("smart-hidden"),p.classList.add("smart-hidden");else{p.classList.remove("smart-hidden"),u.classList.remove("smart-hidden");const t=c[e.selectedValue];t&&(u.dataSource=i._getRelationFieldsData(t.id),u.dataSource.length>0&&(u.selectedValue=u.dataSource[0].value))}},o.width&&(s.style.width=o.width,s.style.float="left"),d.style.height="auto",m.classList.add("smart-flex"),m.style.width="100%",m.style.flexDirection="column",m.appendChild(e),m.appendChild(p),m.appendChild(u),d.appendChild(m),l.appendChild(s),s.classList.add("smart-grid-dialog-field"),s.appendChild(r),s.appendChild(d),o.width&&!t[n+1].width){const e=document.createElement("div");e.style.clear="both",l.appendChild(e)}}else if("formula"===o.type){let e=document.createElement("smart-input");e.classList.add("underlined","edit-column-input"),e.style.width="100%",o.width&&(s.style.width=o.width,s.style.float="left"),d.appendChild(e),l.appendChild(s),s.classList.add("smart-grid-dialog-field"),s.appendChild(r),s.appendChild(d);const a=document.createElement("div");if(a.innerHTML=i.localize("dialogAddColumnTypeFormulaInfo"),a.style.color="var(--smart-primary)",a.style.fontSize="12px",a.style.marginBottom="10px",s.appendChild(a),o.width&&!t[n+1].width){const e=document.createElement("div");e.style.clear="both",l.appendChild(e)}}else{let c=document.createElement("smart-input");if(c.classList.add("underlined","edit-column-input"),c.style.width="100%",c.style.height="30px",o.width&&(s.style.width=o.width,s.style.float="left"),"items"===o.type){const t=document.createElement("smart-button");t.classList.add("primary"),t.innerHTML='<div style="align-items: center; white-space: nowrap; display: flex;"><span class="smart-grid-icon show smart-icon-plus"></span><span>'+i.localize("commandBarAddRow")+"</span></div>";const l=document.createElement("div");l.classList.add("smart-grid-add-column-dialog-color-panel");const n=document.createElement("smart-sortable");n.disableMode="manual",n.dragMode="handle",n.handlePosition="left",n.handleVisibility="visible";const s=()=>{if(a.btnConfirm.disabled=!1,0===l.offsetHeight)return;let e=0;l.querySelectorAll(".edit-column-input").forEach((t=>{""===t.value&&e++;const l=a.querySelector('[field-name="type"]');l&&("multiSelect"===l.querySelector("smart-input").selectedValues[0]&&e>=1&&(a.btnConfirm.disabled=!0),e>1&&(a.btnConfirm.disabled=!0))})),n._updateDefaultInput()},r=(l,r,d,c)=>{const u=document.createElement("div"),m=i._getColorInput(),p=document.createElement("div"),g=document.createElement("smart-input"),b=e.allowColorItems;if(void 0!==d)g.setAttribute("data-id",d),g.setAttribute("data-item-value",d);else{const e=n.querySelectorAll(".smart-sortable-item").length;g.setAttribute("data-id",e),g.setAttribute("data-item-value",e)}if(void 0!==c&&g.setAttribute("data-item-value",c),m.disabled=!b.querySelector(".smart-input").value,p.className="smart-grid-icon smart-icon-close show",p.setAttribute("role","button"),p.setAttribute("aria-label","button"),g.classList.add("underlined","edit-column-input"),g.style.width="100%",g.style.height="30px",g.required=!0,(a.editColumn&&"collaborator"===a.editColumn.template||"users"===o.bind)&&(g.disabled=!0),l&&(g.value=i._unescapeString(l)),r)m.value=r;else if(!m.disabled){void 0!==a._randomOptionIndex?a._randomOptionIndex++:a._randomOptionIndex=2;const e=a._randomOptionIndex;e>=m.dataSource.length-1&&delete a._randomOptionIndex;const t=m.dataSource[e];m.value=t}if(g.onkeyup=g.onchange=g.onblur=e=>{s(),"Enter"===e.key&&(g.parentElement.nextElementSibling||(t.performClick(),s()))},m.onchange=()=>{n._updateDefaultInput()},u.appendChild(m),u.appendChild(g),"users"!==o.bind&&u.appendChild(p),p.onmouseenter=()=>{if(i._dialogAddColumn&&i._dialogAddColumn.editColumn){if(p.title="",p.classList.remove("smart-quiet"),!c)return;const e=i._dialogAddColumn.editColumn;if(e)for(let t=0;t<i.rows.length;t++)if(i.rows[t].data[e.dataField]===c){p.title=i.localize("dialogAddColumnListItemsError"),p.classList.add("smart-quiet");break}}},c&&i._dialogAddColumn){const e=i._dialogAddColumn.editColumn;if(e)for(let t=0;t<i.rows.length;t++)if(i.rows[t].data[e.dataField]===c){p.title=i.localize("dialogAddColumnListItemsError"),p.classList.add("smart-quiet");break}}return p.onclick=()=>{p.title||(u.remove(),n.updateItems(),s())},u.classList.add("smart-sortable-item","smart-grid-add-column-dialog-color-item"),"users"===o.bind&&u.setAttribute("disable-drag",""),u};if(n._getOptions=e=>{const t=[],a=l.querySelectorAll(".smart-grid-add-column-dialog-color-item .edit-column-input"),n=l.querySelectorAll(".smart-grid-add-column-dialog-color-item smart-color-input");for(let e=0;e<a.length;e++){const l=a[e],i={label:l.value.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/'/g,"&#39;").replace(/"/g,"&quot;").replace(/\\/g,""),value:l.getAttribute("data-item-value").replace(/\\/g,""),id:parseInt(l.getAttribute("data-id")),color:n[e].value};i.color=n[e].value;const o=parseInt(i.value);if(!isNaN(o)){const e=i.label.trim();i.value=e}t.push(i)}if("users"===e.bind){i.users||(i.users=[]);for(let e=0;e<t.length;e++){const a=t[e],l=i.users.find((e=>e.id===a.id));l&&(l.name=a.label,l.color=a.color)}}return t},n._updateDefaultInput=e=>{e||(e=n._getOptions(o)),n._defaultInput&&(n._defaultInput.dataSource=e,n._defaultInput.selectedValues=[],!e||e&&!e.length||"kanban"===i.view?(n._defaultInput.classList.add("smart-hidden"),n._defaultOption.classList.add("smart-hidden")):(a.editColumn&&a.editColumn.defaultValue&&(n._defaultInput.selectedValues=[a.editColumn.defaultValue]),n._defaultInput.classList.remove("smart-hidden"),n._defaultOption.classList.remove("smart-hidden")))},n._init=e=>{n.clearContent(),"users"===o.bind?(n.handleVisibility="none",n.handlePosition="none"):(n.handleVisibility="visible",n.handlePosition="left"),e&&(e.forEach(((e,t)=>{const a=void 0!==e.id?e.id:t,l=r(e.label,e.color,a,e.value,t);n.$.container.appendChild(l)})),n.updateItems()),n._updateDefaultInput(e)},n._validate=s,e.allowColorItems.onchange=t=>{let a=e.allowColorItems.parentElement.nextElementSibling,l=null;for(;a;){if("options"===a.getAttribute("field-name")){if(l=a,l&&l.classList.contains("smart-hidden")){a=a.nextElementSibling;continue}break}if("users"===a.getAttribute("field-name")){if(l=a,l&&l.classList.contains("smart-hidden")){a=a.nextElementSibling;continue}break}a=a.nextElementSibling}l&&l.querySelectorAll("smart-color-input").forEach((e=>{e.disabled=!t}))},l.appendChild(n),"users"!==o.bind){l.appendChild(t);const e=()=>{const e=r();n.$.container.appendChild(e),n.updateItems(),e.querySelector(".edit-column-input").focus(),a.btnConfirm.disabled=!0,a._refreshPosition&&a._refreshPosition(),event.preventDefault()};t.performClick=()=>{e()},t.onpointerdown=()=>{e()},t.onkeydown=t=>{"Enter"===t.key&&e()}}const u=document.createElement("div");u.innerHTML=i.localize("dialogAddColumnDefault");const m=document.createElement("smart-multi-combo-input");m.singleSelect=!0,m.readonly=!0,m.dropDownButtonPosition="right",m.colorItems=!0,m.autoOpen=!0,m.pills=!0,m.style.setProperty("--smart-surface","--smart-background"),m.style.width="100%",m.classList.add("smart-default-item","underlined");const p=document.createElement("div");p.style.display="flex",p.style.flexDirection="column",p.style.marginTop="5px",p.classList.add("smart-default-item-container"),p.appendChild(u),p.appendChild(m),l.appendChild(p),n._defaultInput=m,n._defaultOption=u,c=l,d.style.height="auto"}else if("number"===o.type)c=document.createElement("smart-number-input"),c.classList.add("underlined"),c.style.width="100%",c.style.height="30px","minValue"===o.bind?(c.value=0,c.min=-9999999,c.max=9999999):"maxValue"===o.bind?(c.value=1e6,c.min=-9999999,c.max=9999999):"minLength"===o.bind?c.value=0:"maxLength"===o.bind&&(c.value=500);else if("datetime"===o.type)c=document.createElement("smart-date-input"),c.classList.add("underlined"),c.style.width="100%",c.style.height="30px","minDateTime"===o.bind?c.value=new Date(1900,0,1):"maxDateTime"===o.bind&&(c.value=new Date(2100,0,1));else if("radio"===o.type){const e=(e,t,a)=>{const l=document.createElement("div"),i=document.createElement("label"),n=document.createElement("div");return i.innerHTML=e,n.classList.add("smart-input"),n.classList.add("smart-grid-cell-editor"),n.classList.add("smart-grid-check-box-cell-editor"),t&&n.setAttribute("checked",""),n.value=void 0!==t&&t,d.appendChild(n),l.onclick=function(){if(n.value=!0,!1===n.value?n.removeAttribute("checked"):n.setAttribute("checked",n.value?"":"indeterminate"),l.onchange&&l.onchange(l),n.value){const e=n.parentElement.parentElement.parentElement;e.querySelectorAll(".smart-grid-cell-editor").forEach((e=>{e.value=!1,e.removeAttribute("checked")})),n.value=!0,n.setAttribute("checked",n.value?"":"indeterminate"),e.value=a}},l.setAttribute("tabindex",0),l.onkeydown=e=>{" "!==e.key&&"Enter"!==e.key||l.click()},l.appendChild(n),l.appendChild(i),l.classList.add("smart-grid-dialog-boolean-field"),l.setAttribute("template","checkBox"),l.setAttribute("editor",""),l.label=i,l.value=t,l.name=a,l},t=document.createElement("div");t.classList.add("smart-grid-dialog-radio-field"),d.classList.add("radio-group");for(let a=0;a<o.options.length;a++){const l=o.options[a],i=e(l.label,l.checked,l.value);if(o.columns){const e=100/o.columns;i.style.width=e+"%",i.style.float="left"}t.appendChild(i),l.checked&&(d.value=l.value)}const a=document.createElement("div");a.style.clear="both",t.appendChild(a),c=t}if(o.options){c.readonly=!0;let e=o.options;"type"===o.bind&&(void 0!==i.currentUser&&null!==i.currentUser||(e=e.filter((e=>"updatedBy"!==e.value&&"createdBy"!==e.value))),(void 0===i.users||null===i.users||i.users&&0===i.users.length)&&(e=e.filter((e=>"collaborator"!==e.value)))),c.dataSource=e,c.dropDownButtonPosition="right","dataField"!==o.bind&&(c.selectedIndex=0),o.options.length<15?c.dropDownHeight="auto":c.dropDownHeight=300}if(o.icon){const e=document.createElement("span");e.classList.add("smart-grid-icon",o.icon,"show","smart-description-button"),d.appendChild(e),c.style.width="calc(100% - 25px)"}if(d.appendChild(c),o.info){const e=document.createElement("span");e.classList.add("smart-grid-icon","smart-icon-attention-circled","show","smart-description-button"),e.title=o.info,d.appendChild(e),c.style.width="calc(100% - 25px)"}if(l.appendChild(s),s.classList.add("smart-grid-dialog-field"),s.appendChild(r),s.appendChild(d),o.width&&!t[n+1].width){const e=document.createElement("div");e.style.clear="both",l.appendChild(e)}}}}if(!a.querySelector(".smart-grid-edit-dialog-columns-separator")){const e=document.createElement("div"),t=a.querySelector('[field-name="description"]');t&&l.insertBefore(e,t),e.innerHTML=`<div class="smart-grid-edit-dialog-columns-separator"><span></span><div><div class="show toggle-button smart-flex">${i.localize("less")}<span style="font-family: var(--smart-font-family-icon); font-size: 16px; margin-left: 5px; border:none;" class="show smart-grid-icon smart-icon-sort-up"></span></div></div><span></span></div>`,e.querySelector(".toggle-button").onclick=()=>{const t=e.querySelector(".toggle-button");t.classList.contains("show")?(t.innerHTML=`${i.localize("more")}<span style="font-family: var(--smart-font-family-icon); font-size: 16px; margin-left: 5px; border:none;" class="show smart-grid-icon smart-icon-sort-down"></span>`,t.classList.remove("show"),a.compact=!0):(t.innerHTML=`${i.localize("less")}<span style="font-family: var(--smart-font-family-icon); font-size: 16px; margin-left: 5px; border:none;" class="show smart-grid-icon smart-icon-sort-up"></span>`,t.classList.add("show"),a.compact=!1),i._updateAddColumnDialogCompact(a)}}}_updateAddColumnDialogCompact(e){const t=e.querySelectorAll(".smart-grid-dialog-editor");for(let a=0;a<t.length;a++){const l=t[a],i=l.getAttribute("bind"),n=l.parentNode;switch(i){case"description":case"cellsAlign":case"defaultString":case"defaultNumber":case"defaultDate":case"defaultDateValue":case"setDefaultValue":case"allowResize":case"allowRichText":case"required":case"allowSort":case"allowFilter":case"allowEdit":e.compact?n.classList.add("smart-collapse"):n.classList.remove("smart-collapse")}}}_getDefaultLocales(){return{AED:"ar_AE",AFN:"fa_AF",ALL:"sq",AMD:"hy",ANG:"nl",AOA:"pt_AO",ARS:"es_AR",AUD:"en",AWG:"nl_AW",AZN:"az",BAM:"bs",BBD:"en_BB",BDT:"bn_BD",BGN:"bg",BHD:"ar_BH",BIF:"fr_BI",BMD:"en_BM",BND:"ms_BN",BOB:"es_BO",BRL:"pt_BR",BSD:"en_BS",BTN:"dz",BWP:"en_BW",BYN:"be",BYR:"be",BZD:"en_BZ",CAD:"en_CA",CDF:"fr_CD",CHF:"de_CH",CLP:"es_CL",CNY:"zh_Hans_CN",COP:"es_CO",CRC:"es_CR",CUP:"es_CU",CVE:"pt_CV",CZK:"cs",DJF:"fr_DJ",DKK:"da_DK",DOP:"es_DO",DZD:"ar_DZ",EGP:"ar_EG",ERN:"ti_ER",ETB:"am",EUR:"de",FJD:"en_FJ",FKP:"en_FK",GBP:"en",GEL:"ka",GHS:"en_GH",GIP:"en_GI",GMD:"en_GM",GNF:"fr_GN",GTQ:"es_GT",GYD:"en_GY",HKD:"zh_Hans_HK",HNL:"es_HN",HRK:"hr_HR",HTG:"en",HUF:"hu_HU",IDR:"id",ILS:"he",INR:"en_IN",IQD:"ar_IQ",IRR:"fa_IR",ISK:"is",JMD:"en_JM",JOD:"ar_JO",JPY:"ja",KES:"en_KE",KGS:"ky",KHR:"km",KMF:"ar",KPW:"ko_KP",KRW:"ko_KR",KWD:"ar_KW",KYD:"en_KY",KZT:"kk",LAK:"lo",LBP:"ar_LB",LKR:"si",LRD:"en_LR",LSL:"en_LS",LYD:"ar_LY",MAD:"ar",MDL:"ro",MGA:"fr_MG",MKD:"mk",MMK:"my",MNT:"mn",MOP:"zh",MRO:"ar_MR",MRU:"ar_MR",MUR:"en_MU",MVR:"en",MWK:"en",MXN:"es_MX",MYR:"ms_MY",MZN:"pt_MZ",NAD:"en_NA",NGN:"en_NG",NIO:"es_NI",NOK:"nb_NO",NPR:"ne",NZD:"en_NZ",OMR:"ar_OM",PAB:"es_PA",PEN:"es_PE",PGK:"en_PG",PHP:"fil",PKR:"ur_PK",PLN:"pl",PYG:"es_PY",QAR:"ar_QA",RON:"ro",RSD:"sr",RUB:"ru",RWF:"rw",SAR:"ar_SA",SBD:"en_SB",SCR:"en_SC",SDG:"ar_SD",SEK:"sv_SE",SGD:"en_SG",SHP:"en_SH",SLL:"en_SL",SOS:"so_SO",SRD:"nl_SR",SSP:"en",STD:"pt_ST",STN:"pt_ST",SYP:"ar_SY",SZL:"en_SZ",THB:"th",TJS:"en",TMT:"tk",TND:"ar_TN",TOP:"to",TRY:"tr_TR",TTD:"en_TT",TWD:"zh_Hant_TW",TZS:"sw_TZ",UAH:"uk",UGX:"en_UG",USD:"en_US",UYU:"es_UY",UZS:"uz",VEF:"es_VE",VND:"vi",VUV:"en_BI",WST:"en_AS",XAF:"fr",XCD:"en",XOF:"fr",XPF:"fr_PF",YER:"ar_YE",ZAR:"zu",ZMW:"en_ZM",ZWL:"en_ZW"}}_getLocaleByCurrency(e){const t=this._getDefaultLocales();return t[e]?t[e].replace("_","-"):"en-US"}_getCurrencyByLocale(e){const t=this;if(t._currencyByLocale||(t._currencyByLocale={}),t._currencyByLocale[e])return t._currencyByLocale[e];const a=t._getCurrencies(),l=t._getDefaultLocales(),i=Object.keys(l);for(let n of i)if(l[n].replace("_","-")===e){const l=n;for(let i=0;i<a.length;i++)if(a[i].abbreviation===l){t._currencyByLocale[e]=a[i].sign;break}}return t._currencyByLocale[e]?t._currencyByLocale[e]:null}_getCurrencies(){return[{currency:"US Dollar",sign:"$",abbreviation:"USD"},{currency:"Euro",sign:"€",abbreviation:"EUR"},{currency:"Afghan Afghani",sign:"Af.",abbreviation:"AFN"},{currency:"Albanian Lek",sign:"Lek",abbreviation:"ALL"},{currency:"Algerian Dinar",sign:"din",abbreviation:"DZD"},{currency:"Angolan Kwanza",sign:"Kz",abbreviation:"AOA"},{currency:"Argentine Peso",sign:"$",abbreviation:"ARS"},{currency:"Armenian Dram",sign:"Dram",abbreviation:"AMD"},{currency:"Aruban Florin",sign:"Afl.",abbreviation:"AWG"},{currency:"Australian Dollar",sign:"$",abbreviation:"AUD"},{currency:"Azerbaijani Manat",sign:"₼",abbreviation:"AZN"},{currency:"Bahamian Dollar",sign:"$",abbreviation:"BSD"},{currency:"Bahraini Dinar",sign:"din",abbreviation:"BHD"},{currency:"Bangladeshi Taka",sign:"৳",abbreviation:"BDT"},{currency:"Barbadian Dollar",sign:"$",abbreviation:"BBD"},{currency:"Belarusian Ruble",sign:"р.",abbreviation:"BYN"},{currency:"Belarusian Ruble",sign:"р.",abbreviation:"BYR"},{currency:"Belize Dollar",sign:"$",abbreviation:"BZD"},{currency:"Bermudan Dollar",sign:"$",abbreviation:"BMD"},{currency:"Bhutanese Ngultrum",sign:"Nu.",abbreviation:"BTN"},{currency:"Bolivian Boliviano",sign:"Bs",abbreviation:"BOB"},{currency:"Bosnia-Herzegovina Convertible Mark",sign:"KM",abbreviation:"BAM"},{currency:"Botswanan Pula",sign:"P",abbreviation:"BWP"},{currency:"Brazilian Real",sign:"R$",abbreviation:"BRL"},{currency:"British Pound Sterling",sign:"£",abbreviation:"GBP"},{currency:"Brunei Dollar",sign:"$",abbreviation:"BND"},{currency:"Bulgarian Lev",sign:"лв.",abbreviation:"BGN"},{currency:"Burundian Franc",sign:"FBu",abbreviation:"BIF"},{currency:"Cambodian Riel",sign:"Riel",abbreviation:"KHR"},{currency:"Canadian Dollar",sign:"$",abbreviation:"CAD"},{currency:"Cape Verdean Escudo",sign:"CVE",abbreviation:"CVE"},{currency:"Cayman Islands Dollar",sign:"$",abbreviation:"KYD"},{currency:"CFA Franc BCEAO",sign:"CFA",abbreviation:"XOF"},{currency:"CFA Franc BEAC",sign:"FCFA",abbreviation:"XAF"},{currency:"CFP Franc",sign:"FCFP",abbreviation:"XPF"},{currency:"Chilean Peso",sign:"$",abbreviation:"CLP"},{currency:"Chinese Yuan",sign:"¥",abbreviation:"CNY"},{currency:"Chinese Yuan (offshore)",sign:"¥",abbreviation:"RMB"},{currency:"Colombian Peso",sign:"$",abbreviation:"COP"},{currency:"Comorian Franc",sign:"CF",abbreviation:"KMF"},{currency:"Congolese Franc",sign:"FrCD",abbreviation:"CDF"},{currency:"Costa Rican Colon",sign:"₡",abbreviation:"CRC"},{currency:"Croatian Kuna",sign:"kn",abbreviation:"HRK"},{currency:"Cuban Convertible Peso",sign:"$",abbreviation:"CUC"},{currency:"Cuban Peso",sign:"$",abbreviation:"CUP"},{currency:"Czech Republic Koruna",sign:"Kč",abbreviation:"CZK"},{currency:"Danish Krone",sign:"kr.",abbreviation:"DKK"},{currency:"Djiboutian Franc",sign:"Fdj",abbreviation:"DJF"},{currency:"Dominican Peso",sign:"RD$",abbreviation:"DOP"},{currency:"East Caribbean Dollar",sign:"$",abbreviation:"XCD"},{currency:"Egyptian Pound",sign:"£",abbreviation:"EGP"},{currency:"Eritrean Nakfa",sign:"Nfk",abbreviation:"ERN"},{currency:"Ethiopian Birr",sign:"Birr",abbreviation:"ETB"},{currency:"Falkland Islands Pound",sign:"£",abbreviation:"FKP"},{currency:"Fijian Dollar",sign:"$",abbreviation:"FJD"},{currency:"Gambian Dalasi",sign:"GMD",abbreviation:"GMD"},{currency:"Georgian Lari",sign:"GEL",abbreviation:"GEL"},{currency:"Ghanaian Cedi",sign:"GHS",abbreviation:"GHS"},{currency:"Gibraltar Pound",sign:"£",abbreviation:"GIP"},{currency:"Guatemalan Quetzal",sign:"Q",abbreviation:"GTQ"},{currency:"Guinean Franc",sign:"FG",abbreviation:"GNF"},{currency:"Guyanaese Dollar",sign:"$",abbreviation:"GYD"},{currency:"Haitian Gourde",sign:"HTG",abbreviation:"HTG"},{currency:"Honduran Lempira",sign:"L",abbreviation:"HNL"},{currency:"Hong Kong Dollar",sign:"$",abbreviation:"HKD"},{currency:"Hungarian Forint",sign:"Ft",abbreviation:"HUF"},{currency:"Icelandic Krona",sign:"kr",abbreviation:"ISK"},{currency:"Indian Rupee",sign:"₹",abbreviation:"INR"},{currency:"Indonesian Rupiah",sign:"Rp",abbreviation:"IDR"},{currency:"Iranian Rial",sign:"Rial",abbreviation:"IRR"},{currency:"Iraqi Dinar",sign:"din",abbreviation:""},{currency:"Israeli New Sheqel",sign:" ₪",abbreviation:"ILS"},{currency:"Jamaican Dollar",sign:"$",abbreviation:"JMD"},{currency:"Japanese Yen",sign:"¥",abbreviation:"JPY"},{currency:"Jordanian Dinar",sign:"din",abbreviation:"JOD"},{currency:"Kazakhstani Tenge",sign:"₸",abbreviation:"KZT"},{currency:"Kenyan Shilling",sign:"Ksh",abbreviation:"KES"},{currency:"Kuwaiti Dinar",sign:"din",abbreviation:"KWD"},{currency:"Kyrgystani Som",sign:"KGS",abbreviation:"KGS"},{currency:"Laotian Kip",sign:"₭",abbreviation:"LAK"},{currency:"Lebanese Pound",sign:"L£",abbreviation:"LBP"},{currency:"Lesotho Loti",sign:"LSL",abbreviation:"LSL"},{currency:"Liberian Dollar",sign:"$",abbreviation:"LRD"},{currency:"Libyan Dinar",sign:"din",abbreviation:"LYD"},{currency:"Lithuanian Litas",sign:"Lt",abbreviation:"LTL"},{currency:"Macanese Pataca",sign:"MOP",abbreviation:"MOP"},{currency:"Macedonian Denar",sign:"din",abbreviation:"MKD"},{currency:"Malagasy Ariary",sign:"Ar",abbreviation:"MGA"},{currency:"Malawian Kwacha",sign:"MWK",abbreviation:"MWK"},{currency:"Malaysian Ringgit",sign:"RM",abbreviation:"MYR"},{currency:"Maldivian Rufiyaa",sign:"Rf",abbreviation:"MVR"},{currency:"Mauritanian Ouguiya",sign:"MRO",abbreviation:"MRO"},{currency:"Mauritian Rupee",sign:"MURs",abbreviation:"MUR"},{currency:"Mexican Peso",sign:"$",abbreviation:"MXN"},{currency:"Moldovan Leu",sign:"MDL",abbreviation:"MDL"},{currency:"Mongolian Tugrik",sign:"₮",abbreviation:"MNT"},{currency:"Moroccan Dirham",sign:"dh",abbreviation:"MAD"},{currency:"Mozambican Metical",sign:"MTn",abbreviation:"MZN"},{currency:"Myanma Kyat",sign:"K",abbreviation:"MMK"},{currency:"Namibian Dollar",sign:"$",abbreviation:"NAD"},{currency:"Nepalese Rupee",sign:"Rs",abbreviation:"NPR"},{currency:"Netherlands Antillean Guilder",sign:"NAf.",abbreviation:"ANG"},{currency:"New Taiwan Dollar",sign:"NT$",abbreviation:"TWD"},{currency:"New Zealand Dollar",sign:"$",abbreviation:"NZD"},{currency:"Nicaraguan Cordoba",sign:"C$",abbreviation:"NIO"},{currency:"Nigerian Naira",sign:"₦",abbreviation:"NGN"},{currency:"North Korean Won",sign:"₩KP",abbreviation:"KPW"},{currency:"Norwegian Krone",sign:"kr",abbreviation:"NOK"},{currency:"Omani Rial",sign:"Rial",abbreviation:"OMR"},{currency:"Pakistani Rupee",sign:"Rs",abbreviation:"PKR"},{currency:"Panamanian Balboa",sign:"B/.",abbreviation:"PAB"},{currency:"Papua New Guinean Kina",sign:"PGK",abbreviation:"PGK"},{currency:"Paraguayan Guarani",sign:"Gs.",abbreviation:"PYG"},{currency:"Peruvian Nuevo Sol",sign:"S/.",abbreviation:"PEN"},{currency:"Philippine Peso",sign:"₱",abbreviation:"PHP"},{currency:"Polish Zloty",sign:"zł",abbreviation:"PLN"},{currency:"Qatari Rial",sign:"Rial",abbreviation:"QAR"},{currency:"Romanian Leu",sign:"RON",abbreviation:"RON"},{currency:"Russian Ruble",sign:"₽",abbreviation:"RUB"},{currency:"Rwandan Franc",sign:"RF",abbreviation:"RWF"},{currency:"Saint Helena Pound",sign:"£",abbreviation:"SHP"},{currency:"Samoan Tala",sign:"WST",abbreviation:"WST"},{currency:"Sao Tomean Dobra",sign:"Db",abbreviation:"STD"},{currency:"Saudi Riyal",sign:"Rial",abbreviation:"SAR"},{currency:"Serbian Dinar",sign:"din",abbreviation:"RSD"},{currency:"Seychellois Rupee",sign:"SCR",abbreviation:"SCR"},{currency:"Sierra Leonean Leone",sign:"SLL",abbreviation:"SLL"},{currency:"Singapore Dollar",sign:"$",abbreviation:"SGD"},{currency:"Solomon Islands Dollar",sign:"$",abbreviation:"SBD"},{currency:"Somali Shilling",sign:"SOS",abbreviation:"SOS"},{currency:"South African Rand",sign:"R",abbreviation:"ZAR"},{currency:"South Korean Won",sign:"₩",abbreviation:"KRW"},{currency:"South Sudanese Pound",sign:"£",abbreviation:"SSP"},{currency:"Sri Lankan Rupee",sign:"Rs",abbreviation:"LKR"},{currency:"Sudanese Pound",sign:"SDG",abbreviation:"SDG"},{currency:"Surinamese Dollar",sign:"$",abbreviation:"SRD"},{currency:"Swazi Lilangeni",sign:"SZL",abbreviation:"SZL"},{currency:"Swedish Krona",sign:"kr",abbreviation:"SEK"},{currency:"Swiss Franc",sign:"CHF",abbreviation:"CHF"},{currency:"Syrian Pound",sign:"£",abbreviation:"SYP"},{currency:"Tajikistani Somoni",sign:"Som",abbreviation:"TJS"},{currency:"Tanzanian Shilling",sign:"TSh",abbreviation:"TZS"},{currency:"Thai Baht",sign:"฿",abbreviation:"THB"},{currency:"Tongan Pa'anga",sign:"T$",abbreviation:"TOP"},{currency:"Trinidad and Tobago Dollar",sign:"$",abbreviation:"TTD"},{currency:"Tunisian Dinar",sign:"din",abbreviation:"TND"},{currency:"Turkish Lira",sign:"₺",abbreviation:"TRY"},{currency:"Turkmenistani Manat",sign:"m",abbreviation:"TMT"},{currency:"Ugandan Shilling",sign:"UGX",abbreviation:"UGX"},{currency:"Ukrainian Hryvnia",sign:"грн.",abbreviation:"UAH"},{currency:"United Arab Emirates Dirham",sign:"dh",abbreviation:"AED"},{currency:"Uruguayan Peso",sign:"$",abbreviation:"UYU"},{currency:"Uzbekistan Som",sign:"soʼm",abbreviation:"UZS"},{currency:"Vanuatu Vatu",sign:"VUV",abbreviation:"VUV"},{currency:"Venezuelan Bolivar",sign:"Bs",abbreviation:"VEF"},{currency:"Venezuelan Bolivar",sign:"Bs",abbreviation:"VES"},{currency:"Vietnamese Dong",sign:"₫",abbreviation:"VND"},{currency:"Yemeni Rial",sign:"Rial",abbreviation:"YER"},{currency:"Zambian Kwacha",sign:"ZMW",abbreviation:"ZMW"},{currency:"Zimbabwean Dollar",sign:"$",abbreviation:"ZWD"}].map((e=>(e.label=e.currency,e.menuLabel='<div style="display: flex; justify-content: space-between;"><span>'+e.currency+'</span><span style="opacity: 0.7;">'+e.sign+" 1,000.00</span></div>",e.value=e.abbreviation,e)))}_openAddStackColumnDialog(e,t,a){const l=this,i=l._dialogAddStackColumn||l._createDialog(l.editing.addColumnDialog),n=e?l.localize("dialogEditColumn",{value:e.label}):l.localize("dialogAddColumn"),o=i.querySelector(".smart-footer").querySelector(".smart-stack-layout"),s=l._getAddStackColumnDialogTemplate();i.classList.add("smart-grid-dialog-add-column"),i.type="add",i.editColumn=e||null,e&&e.element&&e.element.setAttribute("focus",""),o.classList.remove("right"),o.classList.add("center"),l._cellEditors||(l._cellEditors=[]),i.header.innerHTML=n,i.header.parentElement.classList.add("smart-hidden"),i.callback=a,!0===t&&(i.header.parentElement.classList.remove("smart-hidden"),"kanban"===l.view?(i.header.innerHTML=l.localize("dialogAddColumnStatus"),i.header.parentElement.querySelector(".smart-close-button").classList.add("smart-hidden"),i.classList.add("view")):i.classList.remove("kanban")),i.stackLabel&&i.stackLabel.classList.add("smart-hidden"),l.cancelEdit(),i.content&&(i.content.innerHTML="");const r=document.createElement("div");r.classList.add("smart-content-layout-container"),i.content.appendChild(r),l._addStackColumnDialogEditors=[];const d=l._addStackColumnDialogEditors;if(l._initAddColumnDialogEditors(d,s,i,r),!l._dialogAddStackColumn){i.modal=!0,i.btnConfirm.innerHTML=l.localize("dialogEditButtonConfirm"),i.btnCancel.innerHTML=l.localize("dialogEditButtonCancel"),i.onOpen=function(){const e=l._dialogAddStackColumn,t=l._getAddStackColumnDialogTemplate(),a=l._addStackColumnDialogEditors;l._addColumnDialogInitEditors(e,t,a),l._addColumnDialogShowHideEditors(e);const i=l.offset(l.$.columnHeader),n=l.$.columnHeader.offsetHeight,o=l.offset(l);if(e.style.maxHeight="",e.style.minHeight="",i.top+n+e.offsetHeight>window.innerHeight-o.top){const t=n+i.top+e.offsetHeight-window.innerHeight+o.top;e.style.maxHeight=Math.max(250,e.offsetHeight-t)+"px",e.style.minHeight="250px"}else e.style.maxHeight="",e.style.minHeight=""},i.onClose=function(){i.editColumn&&i.editColumn.element&&i.editColumn.element.removeAttribute("focus"),i.classList.remove("view"),i.callback&&i.callback(i.result)},i.btnCancel.onclick=function(){i.result=!1,i.close()},i.btnClose.onclick=function(){i.result=!1,i.close()},i.btnConfirm.onclick=function(){l._confirmAddColumnDialog(i),i.result=!0,i.close()},i.onkeydown=function(e){"Escape"===e.key&&(i.result=!1,i.close())},l._dialogAddStackColumn=i;const e=document.createElement("div");e.classList.add("smart-content-layout-container"),i.content.appendChild(e)}const c=()=>{if(window.screen.availWidth<400)return i.open("left","top"),i.style.width=l.offsetWidth+"px",void(i.style.height=l.offsetHeight+"px");{const e=l.editing.addColumnDialog;i.style.width="auto"===e.width?e.width:e.width+"px",i.style.height="auto"===e.height?e.height:e.height+"px"}i.open("center","center"),setTimeout((()=>{i.btnConfirm.focus()}),100),i.classList.add("center")};c(),i.refresh=()=>{c()}}_openImagePreviewDialog(e){const t=this,a=e?[...e.parentNode.parentNode.querySelectorAll("img")]:[];let l=e.hasAttribute("data-url")?e.getAttribute("data-url"):e.src;if((e=e.cloneNode()).src=l,!t._dialogImagePreview){t._dialogImagePreview=t._createDialog({modal:!0,screenModal:!0,left:"screenMiddle",top:"screenCenter",width:"80%",height:"80%"}),t._dialogImagePreview.content.innerHTML='<div style="width: 100%; height: 100%;"><div class="images-container"></div><div class="image-preview"></div></div>';const e=t._dialogImagePreview.content.firstElementChild;e.style.display="grid",e.style.gridTemplateColumns="50px 1fr"}const i=t._dialogImagePreview.querySelector(".images-container");i.innerHTML="";const n=(e,a)=>{e.width=e.naturalWidth,e.height=e.naturalHeight;const l=150+Math.min(850,e.naturalWidth),i=150+Math.min(650,e.naturalHeight);t._dialogImagePreview.style.width=l+"px",t._dialogImagePreview.style.height=i+"px",!1!==a&&(t._dialogImagePreview.style.left="calc(50% - "+Math.min(850,t._dialogImagePreview.offsetWidth/2)+"px)",t._dialogImagePreview.style.top="calc(50% - "+Math.min(650,t._dialogImagePreview.offsetHeight/2)+"px)");const n=getComputedStyle(t._dialogImagePreview),o=parseInt(n.top),s=parseInt(n.left);if((window.offsetWidth<l||window.offsetHeight<i||o<0||s<0)&&(t._dialogImagePreview.style.left="0px",t._dialogImagePreview.style.top="0px",t._dialogImagePreview.style.width="100%",t._dialogImagePreview.style.height="100%"),o+i>window.innerHeight){const e=o+i-window.innerHeight;t._dialogImagePreview.style.height=i-e-20+"px"}e.style.maxWidth="100%",e.style.objectFit="contain",e.style.width="100%",e.style.height="calc(100% - 10px)"},o=()=>{const e=t._dialogImagePreview.querySelector(".images-container");let a=-1;return e.querySelectorAll("img").forEach(((e,t)=>{if(e.hasAttribute("active"))return a=t,!0})),a},s=e=>{const a=t._dialogImagePreview.querySelector(".images-container");e&&(e.hasAttribute("active")||a.querySelectorAll("img").forEach((t=>{t.style.borderColor="transparent",t.removeAttribute("active");let a=t.hasAttribute("data-url")?t.getAttribute("data-url").replaceAll("\\","/"):"";if(t.src===e.src||a===e.src){t.style.borderColor="var(--smart-primary)",t.setAttribute("active","");let e=t.src;t.hasAttribute("data-url")&&(e=t.getAttribute("data-url")),r.innerHTML=`<img src="${e}"/>`;const a=r.querySelector("img");a.onload=()=>{n(a,!1)}}})))};if(a.length>1)for(let t=0;t<a.length;t++){const l=a[t].cloneNode();l.style.width="40px",l.style.height="40px",l.style.cursor="pointer",l.style.borderStyle="solid",l.style.borderWidth="1px",l.style.borderColor="transparent",l.style.borderRadius="var(--smart-border)",l.style.marginTop="10px",l.classList.remove("smart-hidden"),l.title=a[t].title||a[t].parentNode.title,a[t].src===e.src&&(l.style.borderColor="var(--smart-primary)",l.setAttribute("active","")),i.appendChild(l),l.onmouseenter=()=>{l.style.borderColor="var(--smart-primary)"},l.onmouseleave=()=>{l.hasAttribute("active")||(l.style.borderColor="transparent")},l.onclick=()=>{s(l)}}const r=t._dialogImagePreview.content.querySelector(".image-preview");r.innerHTML="",r.style.overflow="auto",r.appendChild(e),t._dialogImagePreview.btnClose.onclick=e=>{t.layout.isDirty=!1,t._dialogImagePreview.close(),e.preventDefault(),e.stopPropagation()},e.style.marginLeft="auto",e.style.marginRight="auto",e.style.maxWidth="",e.style.width="",e.style.height="",e.onload=()=>{n(e)},t._dialogImagePreview.content.onpointerdown=t._dialogImagePreview.content.onpointerup=e=>{e.preventDefault(),e.stopPropagation()},t._dialogImagePreview.onkeydown=function(e){if("Escape"===e.key&&t._dialogImagePreview.close(),"ArrowUp"===e.key||"ArrowLeft"===e.key){const t=o();s(a[t-1]),e.stopPropagation(),e.preventDefault()}else if("ArrowDown"===e.key||"ArrowRight"===e.key){const t=o();s(a[t+1]),e.stopPropagation(),e.preventDefault()}},t._dialogImagePreview.btnClose.tabIndex=0,t._dialogImagePreview.onOpen=()=>{setTimeout((()=>{t._dialogImagePreview.btnClose.focus()}),100)},t._dialogImagePreview.footer.remove(),t._dialogImagePreview.header.parentNode.style.backgroundColor="var(--smart-background)",t._dialogImagePreview.open(),e&&s(e)}_getFileFromBase64(e,t){let a=e.split(","),l=a[0].match(/:(.*?);/)[1],i=atob(a[1]),n=i.length,o=new Uint8Array(n);for(;n--;)o[n]=i.charCodeAt(n);return new File([o],t,{type:l})}_getBase64(e,t){var a=new FileReader;a.readAsDataURL(e),a.onload=function(){t(a.result)},a.onerror=function(){t("error")}}_findIsFile(e){return"string"==typeof e&&(e.indexOf("http")>=0||e.indexOf("base64")>=0||e.indexOf('[{"value":"/')>=0)}_findUserFile(e){const t=this;if(e&&e.value.startsWith("/"))return!0;if(t.uploadSettings.userFiles)for(let a=0;a<t.uploadSettings.userFiles.length;a++){const l=t.uploadSettings.userFiles[a];if(l){let t=e.name||e.label;if(!t&&!e.label&&e.value){const a=e.value.split("/");t=a[a.length-1]}if(l.label===t)return l;if(l.label.indexOf("_")>=0&&(l.label.substring(0,l.label.lastIndexOf("_"))+l.label.substring(l.label.indexOf("."))).indexOf(t)>=0)return l;const a=l.value.replaceAll("\\","/");if(a===e.value||a===e.url)return l}}return null}_removeFiles(){const e=this,t=e._dialogFile,a=(t.preview.querySelectorAll(".item"),t.fileUpload),l=t.cell.value&&t.cell.value.indexOf("[{")>=0?JSON.parse(t.cell.value):[];if(e.uploadSettings.removeUrl){let i=new FormData,n=new XMLHttpRequest;for(let n=0;n<a.files.length;n++){let o=l[n]?l[n]:e.uploadSettings.url+"/"+a.files[n].name;if(t&&t.cell&&t.cell.value&&t.cell.value.indexOf("[")>=0){const e=JSON.parse(t.cell.value);for(let t=0;t<e.length;t++)if(e[t].label===a.files[n].name){o=e[t].value;break}}e._findUserFile(a.files[n])||i.append(e.uploadSettings.name,a.files[n])}for(let a=0;a<t.uploadedWithLink.length;a++){const l=t.uploadedWithLink[a];e._findUserFile(l)||i.append(e.uploadSettings.name,l)}n.open("POST",e.uploadSettings.removeUrl),n.send(i)}if(e.uploadSettings.onUploadRemove){const l=t.cell.value&&t.cell.value.indexOf("[{")>=0?JSON.parse(t.cell.value):[];for(let t=0;t<a.files.length;t++)l&&l[t]?e.uploadSettings.onUploadRemove(l[t]):e.uploadSettings.removeUrl&&e.uploadSettings.onUploadRemove(e.uploadSettings.removeUrl+"/"+a.files[t].name)}t.uploadedWithLink=[],a.value="",t.input.value="",e._updateFilePreview(),t.tabs[2].classList.contains("active")&&t.tabs[2].click()}_removeFile(e){const t=this,a=t._dialogFile,l=a.preview.querySelectorAll(".item"),i=e.name||e.label,n=a.fileUpload,o=new DataTransfer;l.forEach((e=>{let t=!0;e.file.name!==i&&e.file.label!==i||(t=!1),e.file.value&&(t=!1),t&&o.items.add(e.file)})),n.files=o.files,a.clearButton&&0===l.length&&a.clearButton.classList.remove("show");let s=t.uploadSettings.url+"/"+i;if(a&&a.cell&&a.cell.value&&a.cell.value.indexOf("[")>=0){const e=JSON.parse(a.cell.value);for(let t=0;t<e.length;t++)if(e[t].label===i){s=e[t].value;break}}let r=-1;for(let e=0;e<a.uploadedWithLink.length;e++){const t=a.uploadedWithLink[e];if(t&&t.label===i){r=e;break}}if(r>=0&&a.uploadedWithLink.splice(r,1),t.uploadSettings.userFiles)for(let e=0;e<t.uploadSettings.userFiles.length;e++){const l=t.uploadSettings.userFiles[e];if(l&&l.label===i)return void(a.tabs[2].classList.contains("active")&&a.tabs[2].click())}if(t.uploadSettings.onUploadRemove){let e=s;t.uploadSettings.onUploadRemove(e)}if(t.uploadSettings.removeUrl){let e=new FormData,a=new XMLHttpRequest;e.append(t.uploadSettings.name,s),a.open("POST",t.uploadSettings.removeUrl),a.send(e)}}getFileTypes(e){return e?["image/apng","image/bmp","image/gif","image/jpeg","image/jpg","image/pjpeg","image/png","image/svg+xml","image/tiff","image/webp","image/x-icon","video/x-msvideo","text/csv","application/msword","application/vnd.openxmlformats-officedocument.wordprocessingml.document","application/vnd.ms-fontobject","image/gif","application/json","text/plain","application/xml","application/zip","application/gzip","application/pdf","application/vnd.ms-powerpoint","application/vnd.openxmlformats-officedocument.presentationml.presentation","application/x-7z-compressed","application/vnd.rar","application/rtf","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet","application/x-zip-compressed"]:["image/apng","image/bmp","image/gif","image/jpeg","image/jpg","image/pjpeg","image/png","image/svg+xml","image/tiff","image/webp","image/x-icon"]}_getFileSize(e){return"string"==typeof e?e:e<1024?e+"bytes":e>=1024&&e<1048576?((e/1024).toFixed(1)+"KB").replace(".0",""):e>=1048576?(e/1048576).toFixed(1)+"MB":void 0}_getFileListItem(e){const t=this,a=t._dialogFile,l=a.acceptFiles,i=document.createElement("div");e.name||(e.name=e.label);const n=e.size||0;i.classList.add("item"),i.onpointerdown=n=>{const o=i.getBoundingClientRect();if(a.input.value="",n.clientY>=o.bottom-12)n.clientX>o.left+o.width/2-13&&n.clientX<o.left+o.width/2+13&&(i.remove(),t._removeFile(i.file));else if(l){if(e.value){const t=document.createElement("a");return t.href=e.value,t.target="_blank",void t.click()}const t=URL.createObjectURL(e),a=document.createElement("a");a.download=e.name,a.href=t,a.click()}else t._openImagePreviewDialog(i.querySelector("img"))};const o=document.createElement("div"),s=n?`, ${t._getFileSize(e.size)}.`:"";let r;return o.textContent=o.textContentTitle=`${e.name}${s}`,o.textContent.length>20&&(o.textContent=`${e.name.substring(0,5)}...${e.name.substring(e.name.length-4)} ${s}`),a.objectURL||(a.objectURL=[]),a.objectURL[e.name+"_"+n]||(e.small?a.objectURL[e.name+"_"+n]=e.small?e.small:URL.createObjectURL(e):e.medium?a.objectURL[e.name+"_"+n]=e.medium?e.medium:URL.createObjectURL(e):a.objectURL[e.name+"_"+n]=e.value?e.value:URL.createObjectURL(e)),l?(r=document.createElement("div"),r.classList.add("attachment","smart-grid-icon","show"),e.name.indexOf(".pdf")>=0?r.classList.add("smart-icon-pdf"):e.name.indexOf(".png")>=0||e.name.indexOf(".jpg")>=0||e.name.indexOf(".jpeg")>=0||e.name.indexOf(".gif")>=0?r.classList.add("smart-icon-image"):e.name.indexOf(".tsv")>=0||e.name.indexOf(".txt")>=0||e.name.indexOf(".csv")>=0?r.classList.add("smart-icon-text"):e.name.indexOf(".xls")>=0||e.name.indexOf(".xlsx")>=0?r.classList.add("smart-icon-excel"):e.name.indexOf(".ppt")>=0?r.classList.add("smart-icon-powerpoint"):e.name.indexOf(".zip")>=0||e.name.indexOf(".rar")>=0||e.name.indexOf(".7z")>=0?r.classList.add("smart-icon-archive"):e.name.indexOf(".doc")>=0||e.name.indexOf(".docx")>=0?r.classList.add("smart-icon-word"):r.classList.add("smart-icon-file")):(r=document.createElement("img"),r.loading="lazy",r.src=a.objectURL[e.name+"_"+n],r.onerror=()=>{if(i.style.display="none",a.uploadedWithLink.length){const t=a.uploadedWithLink.indexOf(e);t>=0&&a.uploadedWithLink.splice(t,1)}}),i.file=e,i.title=o.textContentTitle||o.textContent,i.appendChild(r),i.appendChild(o),i}_updateFilePreview(){const e=this,t=e._dialogFile,a=t.preview,l=t.fileUpload;for(;a.firstChild;)a.removeChild(a.firstChild);const i=()=>{const l=document.createElement("div");l.classList.add("list");const i=document.createElement("div");i.classList.add("smart-grid-icon","show","smart-icon-delete"),i.title=e.localize("clear"),a.appendChild(i),i.onclick=()=>{e._removeFiles()},t.clearButton=i,a.appendChild(l)},n=l.files;if(0===n.length)if(0===t.uploadedWithLink.length){const t=document.createElement("p");t.textContent=e.localize("dialogFileFileUpload"),a.appendChild(t)}else i();else{i();const o=new DataTransfer,s=t.column.editor.maxImages||e.uploadSettings.uploadMaxCount||5,r=t.column.editor.maxImageSize||e.uploadSettings.uploadMaxSize||524288;let d=0,c=[];for(const l of n){if(!e._validateFileType(l))continue;const i=e._getFileListItem(l);if(d>=s)c.push(l.name);else if(l.size>r){const t=document.createElement("p");t.textContent=t.textContentTitle=e.localize("dialogFileSize",{value:l.name,fileSize:e._getFileSize(r)}),a.appendChild(t)}else o.items.add(l),t.preview.querySelector(".list").appendChild(i),d++}if(c.length>0){const t=document.createElement("p");t.textContent=e.localize("dialogFileCount",{files:c.toString(),fileCount:s}),a.appendChild(t)}l.files=o.files}if(t.uploadedWithLink&&t.uploadedWithLink.length)for(let a=0;a<t.uploadedWithLink.length;a++){const l=t.uploadedWithLink[a];if(l){const a=e._getFileListItem(l);l.name=l.label,a.file=l,t.preview.lastChild.appendChild(a)}}}_validateFileType(e){return this.getFileTypes(this._dialogFile.acceptFiles).includes(e.type)}_getFileIndex(e){const t=this._dialogFile;let a=-1;for(let l=0;l<t.uploadedWithLink.length;l++){const i=t.uploadedWithLink[l];if(i.label===e.name||i.label===e.label&&(void 0!==i.label||void 0!==e.label)){a=l;break}if(i.name===e.name||i.name===e.label){a=l;break}if(e.label.indexOf(i.name.substring(0,i.name.indexOf(".")))>=0){a=l;break}}for(let l=0;l<t.fileUpload.files.length;l++){const i=t.fileUpload.files[l];if(i.label===e.name||i.label===e.label&&(void 0!==i.label||void 0!==e.label)){a=l;break}if(i.name===e.name||i.name===e.label){a=l;break}if(e.label&&e.label.indexOf(i.name.substring(0,i.name.indexOf(".")))>=0){a=l;break}if(e.name&&e.name.indexOf(i.name.substring(0,i.name.indexOf(".")))>=0){a=l;break}}return a}_openFileDialog(e,t=!1){const a=this,l=a._dialogFile||a._createDialog(),i='<span class="smart-grid-icon '+(!1===t?"smart-icon-image":"smart-icon-docs")+' show"></span>'+(!1===t?a.localize("dialogImageFileHeader"):a.localize("dialogFileHeader"));if(l.cell=e,l.header.innerHTML=i,l.column=e.column,l.acceptFiles=t,l.classList.add("smart-grid-image-dialog"),!a._dialogFile){l.modal=!0,l.btnConfirm.innerHTML=a.localize("dialogEditButtonConfirm"),l.btnCancel.innerHTML=a.localize("dialogEditButtonCancel");const e=()=>{l.loader&&l.loader.classList.add("smart-hidden"),l.close()};l.onOpen=function(){l.fileUpload.value="",l.input.value="",l.uploadedWithLink=[];let e=l.cell.editor.instance.getValue();if("[]"===e)return void l.tabs[0].click();l.tabs[0].click();let t=!0;const i=new DataTransfer;if("string"==typeof e&&e.indexOf("base64")>=0||"string"==typeof e&&e.indexOf("[{")>=0?e=JSON.parse(e):"string"==typeof e&&e.indexOf("./")>=0&&(e=e.split(","),e=e.map((e=>({label:e,value:e})))),Array.isArray(e)){let n=0;e.forEach((async o=>{if(t=!1,"string"==typeof o.value&&o.value.indexOf("base64")>=0&&(t=!0),t)i.items.add(a._getFileFromBase64(o.value,o.label));else{const t=(t,i)=>{a.uploadSettings.url&&(a._findUserFile(t)?(l.uploadedWithLink.push(t),n++,n===e.length&&a._updateFilePreview()):i("error"))};o.value.indexOf(window.location.host)>=0?t(o,(t=>{"error"!==t&&i.items.add(t),n++,n===e.length&&(l.fileUpload.files=i.files,a._updateFilePreview())})):(l.uploadedWithLink.push(o),n++,n===e.length&&a._updateFilePreview())}})),l.fileUpload.files=i.files,a._updateFilePreview()}else a._updateFilePreview()},l.onClose=function(){},l.btnCancel.onclick=function(){l.close()},l.btnClose.onclick=function(){l.close()},l.btnConfirm.onclick=function(){let i=[],n=[...l.fileUpload.files];l.loader?l.loader.classList.remove("smart-hidden"):(l.loader=document.createElement("div"),l.loader.classList.add("smart-grid-loader"),l.loader.style.width=l.loader.style.height="24px",l.btnConfirm.parentNode.insertBefore(l.loader,l.btnConfirm)),l.uploadedWithLink&&l.uploadedWithLink&&l.uploadedWithLink.length&&(i=i.concat(l.uploadedWithLink)),(()=>{if(l.cell.value&&"string"==typeof l.cell.value){const e=l.cell.value.indexOf("[{")>=0?JSON.parse(l.cell.value):[];e&&e.length&&(n=n.filter((t=>{let a=!0;return e.forEach((e=>{if(e.label===t.name&&(a=!1,!a)){const t={value:e.value,label:e.label};e.small&&(t.small=e.small),e.medium&&(t.medium=e.medium),e.large&&(t.large=e.large),i.push(t)}})),a})))}})();const o=()=>{const t=l.cell.value;l.cell.editor.instance.setValue(i),!(a.editing.dialog.enabled&&a.editing.dialog.visible)&&(a._endCellEdit(l.cell),a._handleFileColumnHistory(l.cell.row,l.cell.column.dataField,t,i)),e()};if(a.uploadSettings.url){const s=(t,i)=>{const n=t.filter((e=>-1!==e.value.indexOf(window.location.host)));if(i&&i[0]&&"error"===i[0].response&&(a.cancelEdit(),e()),n.length===l.fileUpload.files.length+l.uploadedWithLink.length){(i.files||i[0])&&a.uploadSettings.onUploadCompleted&&a.uploadSettings.onUploadCompleted({files:l.fileUpload.files,status:200,serverResponse:i});const t=l.cell.column.dataField;let o=l.cell.value;l.cell.editor.instance.setValue(n),!(a.editing.dialog.enabled&&a.editing.dialog.visible)&&(a._endCellEdit(l.cell),a._handleFileColumnHistory(l.cell.row,t,o,n)),e()}};if(0===n.length&&0===l.uploadedWithLink.length)l.cell.editor.instance.setValue(i),!(a.editing.dialog.enabled&&a.editing.dialog.visible)&&a._endCellEdit(l.cell),e();else if(a.uploadSettings.singleFilePost){let e=!1;for(let o=0;o<n.length;o++){const r=[];r.push(n[o]),a._handleFileUpload(l,r,i,t?"file":"image",s),e=!0}for(let t=0;t<l.uploadedWithLink.length;t++){const n=[];a._findUserFile(l.uploadedWithLink[t])||(n.push(l.uploadedWithLink[t].value),a._handleFileUpload(l,n,i,"url",s),e=!0)}e||o()}else if(n.length&&a._handleFileUpload(l,n,i,t?"file":"image",s),l.uploadedWithLink.length){const e=l.uploadedWithLink.filter((e=>!a._findUserFile(e)));if(e.length){const t=e.map((e=>e.value));a._handleFileUpload(l,t,i,"url",s)}else i.length===l.fileUpload.files.length+l.uploadedWithLink.length&&o()}}else{let e=0;for(let t=0;t<n.length;t++){const l=n[t];a._getBase64(l,(t=>{"error"===t&&console.log("Image load error"),e++,i.push({value:t,label:l.name}),e===n.length&&o()}))}0===n.length&&o()}},l.onkeydown=function(e){"Escape"===e.key&&l.close()},a._dialogFile=l,l.content.innerHTML=`\n <div>\n <div>\n <div class="tabs">\n <div class="active tab">\n <span class="smart-grid-icon smart-icon-plus show"></span><label>${a.localize("dialogFileDevice")}</label>\n </div>\n <div class="tab">\n <span class="smart-grid-icon smart-icon-link show"></span><label>${a.localize("dialogFileLink")}</label>\n </div>\n <div class="tab">\n <span class="smart-grid-icon smart-icon-cloud show"></span><label>${a.localize("dialogMyFiles")}</label>\n </div>\n </div>\n </div>\n <div class="smart-grid-drop-zone">\n <div>\n <div class="title"><span class="smart-grid-icon smart-icon-plus show"></span><label>${a.localize("dialogFileUpload")}</label></div>\n <div class="subtitle"><span class="smart-grid-icon smart-icon-docs show"></span><label>${a.localize("dialogFileDrop")}</label></div>\n </div> \n <input accept=".jpg, .jpeg, .png" type="file" multiple="multiple" style="display: none;">\n </div>\n <div class="smart-hidden url-zone">\n <div class="url-title">\n ${a.localize("dialogFileURL")}\n </div>\n <div class="upload">\n <smart-input placeholder="https://example.com/image.png" class="underlined"></smart-input>\n <br/>\n <smart-button disabled class="success">${a.localize("dialogFileURLUpload")}</smart-button>\n </div>\n </div>\n <div class="smart-hidden smart-grid-file-zone">\n \n <div class="files">\n </div>\n <div class="subtitle"><span class="smart-grid-icon smart-icon-attention-circled show"></span><label>${a.localize("dialogMyFilesTitle")}</label></div>\n </div>\n <div class="preview">\n </div>\n <br/>\n </div>`,l.input=l.querySelector("smart-input"),l.dropZone=l.querySelector(".smart-grid-drop-zone"),l.upload=l.querySelector(".title"),l.fileUpload=l.querySelector("input"),l.preview=l.querySelector(".preview"),l.tabs=l.querySelectorAll(".tab"),l.urlZone=l.querySelector(".url-zone"),l.fileZone=l.querySelector(".smart-grid-file-zone"),l.files=l.querySelector(".smart-grid-file-zone .files"),l.uploadButton=l.querySelector("smart-button"),l.input.accept=t?".jpg, .jpeg, .png, .pdf, .xls, .xlsx, .doc, .docx, .gif, .csv, .txt, .xml, .zip, .rtf, .ppt, .pptx, .avi, .html, .htm":".jpg, .jpeg, .png, .gif",l.dropZone.ondrop=l.dropZone.dropHere=e=>{if(e.preventDefault(),e.dataTransfer.items){let t=0;const i=l.column.editor.maxImages||5;for(let l=0;l<e.dataTransfer.items.length;l++)if("file"===e.dataTransfer.items[l].kind){const i=e.dataTransfer.items[l].getAsFile();a._validateFileType(i)&&t++}if(t===e.dataTransfer.files.length||t===i){const t=new DataTransfer;let n=[...e.dataTransfer.files],o=[...l.fileUpload.files];n.length>i&&(n=n.slice(0,5)),o.length>i&&(o=o.slice(0,5)),o.forEach(((e,a)=>{a<i&&t.items.add(e)})),n.forEach(((e,a)=>{a<i&&t.items.add(e)})),l.fileUpload.files=t.files,a._updateFilePreview()}}else l.fileUpload.files=e.dataTransfer.files,a._updateFilePreview()},l.dropZone.ondragover=e=>{e.preventDefault()},l.tabs[0].onclick=()=>{l.tabs[0].classList.add("active"),l.tabs[1].classList.remove("active"),l.tabs[2].classList.remove("active"),l.dropZone.classList.remove("smart-hidden"),l.fileZone.classList.add("smart-hidden"),l.urlZone.classList.add("smart-hidden")},l.tabs[1].onclick=()=>{l.tabs[0].classList.remove("active"),l.tabs[1].classList.add("active"),l.tabs[2].classList.remove("active"),l.dropZone.classList.add("smart-hidden"),l.fileZone.classList.add("smart-hidden"),l.urlZone.classList.remove("smart-hidden")},l.tabs[2].onclick=()=>{if(l.tabs[0].classList.remove("active"),l.tabs[1].classList.remove("active"),l.tabs[2].classList.add("active"),l.dropZone.classList.add("smart-hidden"),l.urlZone.classList.add("smart-hidden"),l.fileZone.classList.remove("smart-hidden"),l.files.innerHTML="",a.uploadSettings.userFiles&&a.uploadSettings.userFiles.length){const e=document.createDocumentFragment();a.uploadSettings.userFiles.forEach((t=>{Array.isArray(t)&&(t=t[0]);let i=t;"string"==typeof t.value&&t.value.indexOf("base64")>=0&&(t=a._getFileFromBase64(t.value,t.label)),t.type||(t.type="unknown");const n=a._getFileListItem(t);a._validateFileType(t)&&(a._getFileIndex(t)>=0&&n.classList.add("active"),n.onpointerdown=()=>{n.classList.toggle("active");let e=a._getFileIndex(t);n.classList.contains("active")?e<0&&l.uploadedWithLink.push({label:i.name||i.label,value:i.value}):a._removeFile(i),a._updateFilePreview()},e.appendChild(n))})),l.files.appendChild(e)}},l.uploadButton.onclick=()=>{const e=this,t=l.input.value,a=t.split("/"),i=a[a.length-1];if(l.column&&l.column.editor&&e.uploadSettings.url){const a={value:t,label:i},n=e._findUserFile(a);for(let e=0;e<l.uploadedWithLink.length;e++){if(l.uploadedWithLink[e].label===i)return;if(n&&l.uploadedWithLink[e].label===n.label)return}l.uploadedWithLink.push(n||a),e._updateFilePreview()}else{const a={value:t,label:i};for(let e=0;e<l.uploadedWithLink.length;e++)if(l.uploadedWithLink[e].label===i)return;l.uploadedWithLink.push(a),e._updateFilePreview()}l.input.value="",l.uploadButton.disabled=!0},l.fileUpload.onchange=()=>{if(0===l.fileUpload.files.length&&l._tempFiles)l.fileUpload.files=l._tempFiles;else if(l._tempFiles){const e=new DataTransfer,t=[...l.fileUpload.files],i=[...l._tempFiles];i.forEach((t=>{e.items.add(t)})),t.forEach((t=>{let l=!0;a._validateFileType(t)||(l=!1),i.forEach((e=>{e.name===t.name&&e.size===t.size&&e.lastModified===t.lastModified&&(l=!1)})),l&&e.items.add(t)})),l.fileUpload.files=e.files}a._updateFilePreview()},l.input.onchange=l.input.onblur=l.input.onkeyup=()=>{l.uploadButton.disabled=!l.input.value||!l.input.value.startsWith("https://");const e=l.input.value,t=e.split("/"),i=t[t.length-1];if(l.column&&l.column.editor&&a.uploadSettings.url){const t={value:e,label:i},n=a._findUserFile(t);for(let e=0;e<l.uploadedWithLink.length;e++)l.uploadedWithLink[e].label===i&&(l.uploadButton.disabled=!0),n&&l.uploadedWithLink[e].label===n.label&&(l.uploadButton.disabled=!0)}},l.upload.onclick=()=>{l._tempFiles=[];const e=new DataTransfer;[...l.fileUpload.files].forEach((t=>{e.items.add(t)})),l._tempFiles=e.files,l.fileUpload.click()}}l.fileUpload.accept=t?".jpg, .jpeg, .png, .pdf, .xls, .xlsx, .doc, .docx, .gif, .csv, .txt, .xml, .zip, .rtf, .ppt, .pptx, .avi, .html, .htm":".jpg, .jpeg, .png, .gif",l.open(),setTimeout((function(){l.btnConfirm.focus()}),100)}_handleFileUpload(e,t,a,l,i){const n=this;if(l||(l="image"),e.column&&e.column.editor&&n.uploadSettings.url){const o=new FormData,s=n.uploadSettings.url;let r=!1;const d=t[0],c=n.uploadSettings.data;c&&""!==c&&("string"==typeof c?o.append("postData",c):o.append("postData",JSON.stringify(c))),o.append("fileType",l);for(let e=0;e<t.length;e++)o.append(n.uploadSettings.name,t[e]),r=!0;let u=new XMLHttpRequest;u.open("POST",s),n.uploadSettings.onSetHeaders&&"function"==typeof n.uploadSettings.onSetHeaders&&n.uploadSettings.onSetHeaders(u,d),r&&n.$.fireEvent("uploadStarted",{files:t,size:d.size}),n.uploadSettings.onUploadStarted&&n.uploadSettings.onUploadStarted({files:t,status:u.status}),u.upload.onprogress=function(e){n.uploadSettings.onProgress&&n.uploadSettings.onProgress(e)},u.onabort=function(e){n.uploadSettings.onAbort&&n.uploadSettings.onAbort(e)},u.onerror=function(e){n.uploadSettings.onError&&n.uploadSettings.onError(e)},u.onload=function(){let e=!1;if(u.response&&("string"==typeof u.response?(e=u.response,e.indexOf("[{")>=0&&(e=JSON.parse(u.response))):e=JSON.parse(u.response)),u.status>=200&&u.status<=299){const o=(e,t)=>{if(e.response&&e.response.response&&"success"!==e.response.response)return null;let a=!1;u.fileURL&&(a=u.file_url);let l={};e&&e.file_url?a=e.file_url:e&&e[0]&&e[0].file_url&&(a=e[0].file_url);let i=!1;e&&e.file_url_small?i=e.file_url_small:e&&e[0]&&e[0].file_url_small&&(i=e[0].file_url_small);let n=!1;e&&e.file_url_medium?n=e.file_url_medium:e&&e[0]&&e[0].file_url_medium&&(n=e[0].file_url_medium);let o=!1;return e&&e.file_url_large?o=e.file_url_large:e&&e[0]&&e[0].file_url_large&&(o=e[0].file_url_large),a&&(l.value=a),i&&(l.small=i),n&&(l.medium=n),o&&(l.large=o),l.label=t,l};for(let i=0;i<t.length;i++){const s=t[i].name?[]:t[i].split("/"),r="url"===l?s[s.length-1]:t[i].name;n.uploadSettings.url;const d=o((e.files||e[0]&&e[0].files||[e[0]])[i],r);d&&a.push(d)}i(a,e)}else i(a,e),n.uploadSettings.onUploadError&&n.uploadSettings.onUploadError({files:t,status:u.status,serverResponse:e})},u.onreadystatechange=function(){e.column.editor.responseHandler&&"function"==typeof e.column.editor.responseHandler&&e.column.editor.responseHandler(u)},r&&u.send(o),n.uploadSettings.onChange&&n.uploadSettings.onChange(t)}}_handleFileColumnHistory(e,t,a,l){const i=this;if(i.storeHistory){a&&"string"==typeof a&&(a=(a=(a=JSON.parse(a)).map((e=>e.label))).toString()),a&&(Array.isArray(a)&&(a=a.map((e=>e.label))),a=a.toString()),null==a&&(a=""),l&&"string"==typeof l&&(l=(l=(l=JSON.parse(l)).map((e=>e.label))).toString()),null==l&&(l=""),l&&(Array.isArray(l)&&(l=l.map((e=>e.label))),l=l.toString());const n={user:i._currentUser.info.id,date:e.updatedDate};n.action=t,n.details={oldValue:a,value:l},e.addHistory(n)}}});
1450
1450
 
1451
1451
  /***/ }),
1452
1452
 
1453
1453
  /***/ 7422:
1454
1454
  /***/ (() => {
1455
1455
 
1456
- (()=>{Smart.Utilities.Assign("Grid.Edit",class{_renderCommandBar(){const e=this,t=e.editing.commandBar.dataSource,i="icon"!==e.editing.commandBar.displayMode,n="label"!==e.editing.commandBar.displayMode,o=o=>{for(let l in t){const a=t[l],r=document.createElement("div");r.classList.add("smart-grid-command-item"),r.label="{{messages}}"===a.label?e.localize(l):a.label;const d=r.label;let s="";n&&i?(s+='<span class="smart-grid-icon '+a.icon+'"></span>',s+='<span class="smart-grid-label">'+d+"</span>"):n&&!i?s+='<span title="'+d+'" class="smart-grid-icon '+a.icon+'"></span>':i&&!n&&(s+='<span class="smart-grid-label">'+d+"</span>"),r.innerHTML=s,a.visible||r.classList.add("smart-hidden"),r.command=a.command,r.onclick=function(){const t=r.command;e._applyCommand(t,[])},o.appendChild(r)}};e.editing.enabled&&e.editing.commandBar.visible&&(e.$.headerCommandBar.innerHTML="",e.$.footerCommandBar.innerHTML="","far"!==e.editing.commandBar.position&&o(e.$.headerCommandBar),"near"!==e.editing.commandBar.position&&o(e.$.footerCommandBar))}commandKeyEditCommand(){const e=this;if(e._selection&&e._selection.focusedCell&&void 0!==e._selection.focusedCell.id){const t=e.rowById[e._selection.focusedCell.id];e.beginEdit(t.id)}}commandKeyCancelCommand(){this.cancelEdit()}commandKeyUpdateCommand(){this.endEdit()}commandColumnMenuCommand(){this._openColumnChooserMenu(this._commandColumn)}commandColumnEditCommand(e){this.beginEdit(e.id)}commandColumnUpdateCommand(){this.endEdit()}commandColumnRowMenuCommand(){}commandColumnCancelCommand(e){const t=this;if(t.editing.batch){const i=t._rowsDeleted?t._rowsDeleted.indexOf(e):-1;i>=0&&t._rowsDeleted.splice(i,1);for(let i=0;i<t.columns.length;i++){const n=t.columns[i].dataField;t._cellsUpdatedValues&&t._cellsUpdatedValues[e.id+"_"+n]&&(delete t._cellsUpdatedValues[e.id+"_"+n],t._cellsUpdatedValues.length--)}t._recycle(!1)}t.cancelEdit()}commandColumnDeleteCommand(e){this.deleteRow(e.id)}_renderAddNewRow(){const e=this;e._frozenNearDefaultRows=[],e._frozenFarDefaultRows=[];const t=new Smart.Grid.Row({data:{},index:-1,grid:e,freeze:"near",visible:"far"!==e.editing.addNewRow.position,autoGenerated:!0,addNewRow:!0}),i=new Smart.Grid.Row({data:{},index:-2,grid:e,freeze:"far",visible:"near"!==e.editing.addNewRow.position,autoGenerated:!0,addNewRow:!0});if(e._newNearRow){const t=e._frozenNearRows.indexOf(e._newNearRow);if(t>=0&&(e._frozenNearRows.splice(t,1),e.$.rowNearContainer.children.length>0)){const t=e.$.rowNearContainer.children[0];t.parentNode.removeChild(t)}}if(e._newFarRow){const t=e._frozenFarRows.indexOf(e._newFarRow);if(t>=0&&(e._frozenFarRows.splice(t,1),e.$.rowFarContainer.children.length>0)){const t=e.$.rowFarContainer.children[e.$.rowFarContainer.children.length-1];t.parentNode.removeChild(t)}}e.editing.addNewRow.visible&&"button"!==e.editing.addNewRow.displayMode&&(e._frozenNearDefaultRows.push(t),e._frozenFarDefaultRows.push(i),e._frozenNearRows.splice(0,0,t),e._frozenFarRows.push(i));const n=()=>{e.editing.addNewRow.autoCreate&&e._scrollView.vScrollBar.value===e._scrollView.vScrollBar.max&&(e.addUnboundRow(1),e._scrollView.vScrollBar.value=e._scrollView.vScrollBar.max),"button"===e.editing.addNewRow.displayMode&&e._scrollView.vScrollBar.value===e._scrollView.vScrollBar.max&&(e._add({}),e._scrollView.vScrollBar.value=e._scrollView.vScrollBar.max)};if(e._addRowOnButtonClickHandler||(e._addRowOnButtonClickHandler=n),e._scrollView&&e._scrollView.vScrollBar&&(e._scrollView.vScrollBar.$.farButton.removeEventListener("click",e._addRowOnButtonClickHandler),e._scrollView.vScrollBar.$.farButton.addEventListener("click",e._addRowOnButtonClickHandler)),e._newNearRow=t,e._newFarRow=i,e.editing.addNewRow.visible&&"button"!==e.editing.addNewRow.displayMode){if(!e._newNearRow.element){const t=e._newNearRow,i=t.createElement();t.visible="far"!==e.editing.addNewRow.position,t.element=i,e.$.rowNearContainer.children.length>0?e.$.rowNearContainer.insertBefore(i,e.$.rowNearContainer.children[0]):e.$.rowNearContainer.appendChild(i)}if(!e._newFarRow.element){const t=e._newFarRow,i=t.createElement();t.visible="near"!==e.editing.addNewRow.position,t.element=i,e.$.rowFarContainer.children.length>0?e.$.rowFarContainer.insertBefore(i,e.$.rowFarContainer.children[0]):e.$.rowFarContainer.appendChild(i)}}}_insertNewRowAfter(e){return this._insertNewRowBefore(e,!0)}_insertNewRowBefore(e,t=!1){const i=this,n=new Smart.Grid.Row({index:t?0:-1,id:Smart.Utilities.Core.createGUID(),grid:i}),o={};for(let e=0;e<i.columns.length;e++){const t=i.columns[e];void 0!==t.defaultValue&&(o[t.dataField]=t.defaultValue)}n.data=o;const l=function(t,n){i._suppressSort=i._suppressFilter=!0;const o=e=>{i._supressEnter=!0,i.scrollTop=n?i.scrollHeight:0,i.editing.addDialog.enabled||setTimeout((function(){if(i.editing.enabled&&i.editing.addNewRow.autoEdit){i.ensureVisible(e.id);let t=null;if(!t)if(i.columns[0]&&i.columns[0].allowEdit&&i.columns[0].visible)t=i.columns[0].dataField;else for(let e=0;e<i.columns.length;e++)if(i.columns[e].allowEdit&&i.columns[e].visible){t=i.columns[e].dataField;break}const n=()=>{i._selection.focusedCell={id:e.id,dataField:t,index:e.index},i._selection.rows=[],i._selection.columns=[],i._selection.cells=[],i._setSelection(e.id,t)};i.paging.enabled?setTimeout((()=>{if(!e.element){const t=e.createElement();e.element=t}n(),i._beginEdit(e)}),200):(n(),i._beginEdit(e))}}),100),i._suppressSort=i._suppressFilter=!1};!0===i.editing.batch||i.editing.batch&&i.editing.batch.indexOf("add")>=0?(i._batchAddRow(t,n?i.rows.length:0),o(t),e&&e(t)):i.addRow(t.data,n,(t=>{o(t),e&&e(t)}))}.bind(this);return i.editing.addDialog.enabled?i._openAddRowDialog(n,l):l(n,t),!0}commandBarBatchSaveCommand(){this._saveBatchEdit()}commandBarAddRowCommand(){this._insertNewRowAfter()}commandBarAddTopRowCommand(){this._insertNewRowBefore()}commandBarDeleteRowCommand(){const e=this;let t=1,i=e.rows[e.rows.length-t];for(e._rowsDeleted||(e._rowsDeleted=[]);e._rowsDeleted.indexOf(e.rows[e.rows.length-t])>=0;)t++;if(i=e.rows[e.rows.length-t],e.selection.enabled)if(e.selection.allowCellSelection){const t=e.getSelectedCells();if(t.length>0){const n=t[0][0];i=e.rowById[n]}}else{const t=e.getSelectedRowIds();t.length>0&&(i=e.rowById[t[0]])}i&&e.commandColumnDeleteCommand(i)}commandBarBatchRevertCommand(){this.revertBatchEdit()}_beginEdit(e,t){const i=this;if(!t)if(i.columns[0]&&i.columns[0].allowEdit&&i.columns[0].visible)t=i.columns[0].dataField;else for(let e=0;e<i.columns.length;e++)if(i.columns[e].allowEdit&&i.columns[e].visible){t=i.columns[e].dataField;break}const n=i.columnByDataField[t];if(i.editing.allowColumnHeaderEdit&&!e&&n)return void i._beginColumnEdit(n);if(!e||!n||n&&n.autoGenerated)return!1;const o=e.getCell(t);if(!o)return!1;i.$.fireEvent("beginEdit",{id:e.id,dataField:n.dataField,row:e,column:n,cell:o,data:o.row.data,value:o.value}).defaultPrevented||("cell"===i.editing.mode?i._beginCellEdit(o):"row"===i.editing.mode&&i._beginRowEdit(e,o))}_saveUnboundRows(e){const t=this;if(t._unboundRows&&t._unboundRows.length>0&&t.editing.addNewRow.autoSave){const i=t.rowById[e];if(!i.unbound)return;const n=t._unboundRows.indexOf(i);if(n<0)return;const o=n+1;t.beginUpdate();for(let e=0;e<o;e++){const i=t._unboundRows[e];if(!i)continue;delete t.rowById[i.id],i.unbound=!1;let n=!1;t._selection.focusedCell&&t._selection.focusedCell.id===i.id&&(n=!0),t._nearRowsAdded&&t._nearRowsAdded.indexOf(i)>=0?(t._nearRowsAdded.splice(t._nearRowsAdded.indexOf(i),1),t._add(0,i.data),n&&(t._selection.focusedCell.id=t.rows[0].id,t._selection.focusedCell.index=t.rows[0].index)):t._farRowsAdded&&t._farRowsAdded.indexOf(i)>=0&&(t._farRowsAdded.splice(t._farRowsAdded.indexOf(i),1),t._add(i.data),n&&(t._selection.focusedCell.id=t.rows[t.rows.length-1].id,t._selection.focusedCell.id=t.rows[t.rows.length-1].index))}t._unboundRows.splice(0,o),t.endUpdate()}}_validateCell(e,t,n){const o=this;if(o._errorOverlay&&(o._errorOverlay.remove(),o._errorMessage.remove(),o._isUpdating=!1),e.column.validationRules||n||e.column.editor&&e.column.editor.onValidate){let l={},a=e._updating;if(e._updating=!0,e.error="",n){for(let i in n)n[i]&&"valid"!==i&&(e.error=n.message),"custom"===i&&n[i].minLength?e.error=o.localize("invalidCellValue",{value:t,validationRule:"minLength: "+n[i].value}):"custom"===i&&n[i].maxLength&&(e.error=o.localize("invalidCellValue",{value:t,validationRule:"maxLength: "+n[i].value}));e.error&&(o._isUpdating=!0)}for(let n of e.column.validationRules){switch(n.type){case"min":l.min=i.min(t,n.value);break;case"max":l.max=i.max(t,n.value);break;case"minLength":l.minLength=i.minLength(t,n.value);break;case"maxLength":l.maxLength=i.maxLength(t,n.value);break;case"minDate":l.minDate=i.minDate(t,n.value);break;case"maxDate":l.maxDate=i.maxDate(t,n.value);break;case"required":l.required=i.required(t);break;case"requiredTrue":l.requiredTrue=i.requiredTrue(t);break;case"pattern":l.pattern=i.pattern(t,n.value);break;case"email":l.email=i.email(t);break;case"null":l.null=i.null(t)}l[n.type]&&(n.message?e.error=n.message:e.error=o.localize("invalidCellValue",{value:t,validationRule:void 0!==n.value?n.type+": "+n.value:n.type}),e._updating=a,o._isUpdating=!0,e.element&&e.element.setAttribute("error",e.error),e.row.element.setAttribute("error",""))}if(e.column.editor&&e.column.editor.onValidate){const i=e.column.editor.onValidate(t,e.row.data);"string"==typeof i&&(e.error=i,e._updating=a,o._isUpdating=!0,e.element&&e.element.setAttribute("error",e.error),e.row.element.setAttribute("error",""))}if(e._updating=a,e.error){o._errorOverlay=o._createOverlay(),o._errorOverlay.onpointerdown=function(){o.endEdit()};const t=document.createElement("div");t.innerHTML=e.error,t.classList.add("smart-grid-validation-error");const i=o.offset(e.element),n=e.element.getBoundingClientRect(),l=o.offset(o);return i.left=i.left,i.top=i.top,i.top+n.height+5-o.offsetTop>o.offsetHeight?t.style.top=i.top-n.height-l.top-5+"px":t.style.top=i.top+n.height-l.top+5+"px",t.style.left=i.left+"px",o._errorMessage=t,o.$.root.appendChild(o._errorOverlay),o.$.root.appendChild(o._errorMessage),e.editor&&e.editor.instance&&e.editor.instance.focus(),!1}o._isUpdating=!1}return!0}hideCellMessage(){const e=this;if(e._messageOverlay){e._messageOverlay.remove();for(let t in e._message)e._message[t].remove();delete e._message,delete e._messageOverlay}}showCellMessage(e,t,i){const n=this,o=n.rowById[e].getCell(t);n._messageOverlay||(n._messageOverlay=n._createOverlay(),n._messageOverlay.onpointerdown=function(){n.hideCellMessage()});const l=document.createElement("div");l.innerHTML=i,l.classList.add("smart-grid-cell-notification");const a=n.offset(o.element),r=o.element.getBoundingClientRect(),d=n.offset(n);a.left=a.left,a.top=a.top,a.top+r.height+5-n.offsetTop>n.offsetHeight?l.style.top=a.top-r.height-d.top-5+"px":l.style.top=a.top+r.height-d.top+5+"px",l.style.left=a.left+"px",n._message||(n._message=[]),n._message.push(l),n._messageOverlay.parentNode||n.$.root.appendChild(n._messageOverlay),n.$.root.appendChild(l)}_endCellEdit(e){const t=this,i=e||t.editing.editCell;if(!i||i&&!i.isEditing)return null;let n=t._getEditorValue(i),o=null;if(n&&n.error&&(i.canNotify=!1,i.element.setAttribute("error",""),i.row.element.setAttribute("error",""),i.error=!0,i.canNotify=!0,o=n.validity,n=n.value),"string"===i.column.dataType&&t.formulas&&n&&"string"==typeof n){if(i.formula!==n){const e=i.canNotify;i.canNotify=!1,n.startsWith("=")?i.formula=t._unescapeString(n):i.formula=null,i.canNotify=e}if(n.startsWith("=")&&i.formula){const e=t._formulaParser;if(e){let t=e.parse(i.formula.slice(1));n=isNaN(t)?"#VALUE!"===n?0:"#ERROR!"===n?"#ERROR!":t:t}}}const l=function(e,t){return"date"===i.column.dataType?e&&t?e.valueOf()===t.valueOf():!e&&!t:!("any"!==i.column.dataType||void 0===e||void 0===t||!Array.isArray(e)||0!==e.length||""!==t)||(!(null!=t&&""!==t||null!==e&&""!==e)||e===t)},a=function(){const e=t._getEditorId(i);t._cellEditors[e].detach(),i.row.element.removeAttribute("edit"),i.element&&(i.element.removeAttribute("editor"),i.element.removeAttribute("error")),i.row.element.removeAttribute("error"),i.isEditing=!1,i.element&&(i.element.content.innerHTML="");const o=function(){t.editing.editRow||(t.dataSource&&t.dataSource.boundHierarchy?(t.dataSource.refreshHierarchy(),t._refreshRowHierarchy(),t.refresh()):t.layout.allowCellsWrap?t.refresh():t._recycle(!1))},a=t._cellsUpdatedValues?t._cellsUpdatedValues[i.row.id+"_"+i.column.dataField]:void 0,r=void 0!==a?a:i.value,d=()=>{if(t._fireEndEdit){let e=i.value;if(t.editing.batch&&i.row&&i.column){const t=i.modifiedValue;void 0!==t&&(e=t)}t.$.fireEvent("endEdit",{id:i.row.id,dataField:i.column.dataField,row:i.row,column:i.column,cell:i,data:i.row.data,value:e}),t._fireEndEdit=!1}};if(l(n,r))t.editing.isEditing=!1,d(),t.editing.editCell=null,t.editing.editRow||(t.editing.isEditing=!1,o());else{const e=function(){t.editing.editCell=null,t.editing.editRow||(t.editing.isEditing=!1),delete t._editInfo};if(!0===t.editing.batch||t.editing.batch&&t.editing.batch.indexOf("update")>=0)e(),t._batchUpdateCell(i.row,i.column,n,i.value),o(),d();else{const l=function(){e(),i._updating=!0,t.editing.readOnlyEdit?t.onCellEditRequest&&t.onCellEditRequest(i.row.id,i.column.dataField,n,i.value,i.row.data,t):i.value=n,i._updating=!1,o(),d()};if(!t.editing.editRow&&t.dataSource&&t.dataSource.virtualDataSource){const e={};e[i.column.dataField]=n,t.updateRow(i.row.id,e,(()=>{l()}))}else l()}}return t.editing.commandColumn.visible&&!t.editing.commandColumn.width&&"cell"===t.editing.mode&&t.refresh(),t.focus(),!0};let r=t._validateCell(i,n,o);if(!r)return i.editor.instance&&!i.editor.autoOpen&&setTimeout((()=>{i.editor.instance.focus()}),50),!1;const d=t._cellsUpdatedValues?t._cellsUpdatedValues[i.row.id+"_"+i.column.dataField]:void 0,s=void 0!==d?d:i.value;if(l(n,s))return a(),!!r;if(t._setCellUndoRedo(i,s,n),t.onCellUpdate&&!t.editing.editRow){t.beginUpdate(),t.appearance.displayLoadingIndicator=!0,t._setLoadingIndicatorVisibility();const e=t._createOverlay();t.$.root.appendChild(e),t.onCellUpdate([i],[s],[n],(function(o){o?a():t.cancelEdit(),t.appearance.displayLoadingIndicator=!1,t._setLoadingIndicatorVisibility(),e.parentNode.removeChild(e),t.endUpdate(),t.onCellUpdated&&t.onCellUpdated([i.row.index],[i.row],[i.column],[i.row.data],[s],[n],t),t._onCellUpdated&&t._onCellUpdated(i.row.index,i.row,i.column,i.row.data,s,n)}),t)}else if(t.onRowUpdate){t.beginUpdate(),t.appearance.displayLoadingIndicator=!0,t._setLoadingIndicatorVisibility();const e=t._createOverlay();t.$.root.appendChild(e);const o=i.column.dataField,l=Object.assign({},i.row.data),r=Object.assign({},i.row.data);r[o]=n,t.onRowUpdate([i.row.index],[i.row],[l],[r],(function(n){n?a():t.cancelEdit(),t.appearance.displayLoadingIndicator=!1,t._setLoadingIndicatorVisibility(),e.parentNode.removeChild(e),t.endUpdate(),t.onRowUpdated&&t.onRowUpdated([i.row.index],[i.row],[i.row.data],t),t._onRowUpdated&&t._onRowUpdated(i.row.index,i.row,i.row.data)}),t)}else a();return!!r}_endRowEdit(){const e=this,t=e.editing.editRow;if(!t)return!1;let i=!0;const n=t.cells;let o={},l={};t.element.removeAttribute("error");for(let a=0;a<n.length;a++){const r=n[a];let d=e._getEditorValue(r),s=null;d&&d.error&&(r.canNotify=!1,r.element.setAttribute("error",""),r.row.element.setAttribute("error",""),r.error=!0,r.canNotify=!0,s=d.validity,d=d.value),d!==r.value&&(o[r.column.dataField]=r.value,l[r.column.dataField]=d);if(!e._validateCell(r,d,s))return i=!1,t.element.setAttribute("error",""),e._isUpdating=!0,r.editor.instance&&setTimeout((()=>{r.editor.instance.focus()}),50),!1}if(i){const i=function(){const i=e._fireEndEdit;e._fireEndEdit=!1;for(let t=0;t<n.length;t++){const i=n[t];e._endCellEdit(i)}e._fireEndEdit=i,e.onRowUpdate||null===e.onRowUpdated||e.onRowUpdated([t.index],[t],[t.data],e),e.editing.isEditing=!1,e.editing.editRow=null,e.editing.commandColumn.visible&&!e.editing.commandColumn.width?e.refresh():e._recycle(!1)};if(!0===e.editing.batch||e.editing.batch&&e.editing.batch.indexOf("update")>=0)i();else if(e.onRowUpdate){e.beginUpdate(),e.appearance.displayLoadingIndicator=!0,e._setLoadingIndicatorVisibility();const n=e._createOverlay();e.$.root.appendChild(n);const a=e.onRowHistory;e.onRowHistory=null,t.updatedDate=new Date,t.updatedBy=e.currentUser,e.storeHistory&&e._updateRowHistory(t,o,l),setTimeout((()=>{e.onRowHistory=a}),100),e.onRowUpdate([t.index],[t],[o],[l],(function(o){const l=e.onRowUpdate,a=e.onCellUpdate;e.onRowUpdate=null,e.onCellUpdate=null,o?i():e.cancelEdit(),e.onRowUpdate=l,e.onCellUpdate=a,e.appearance.displayLoadingIndicator=!1,e._setLoadingIndicatorVisibility(),n.parentNode.removeChild(n),e.endUpdate(),e.onRowUpdated&&e.onRowUpdated([t.index],[t],[t.data])}),e)}else if(e.dataSource&&e.dataSource.virtualDataSource&&e.editing.isEditing){e.beginUpdate(),e.appearance.displayLoadingIndicator=!0,e._setLoadingIndicatorVisibility();const t=e._createOverlay();e.$.root.appendChild(t);let n=Object.assign({},e.editing.editRow.data);for(let t=0;t<e.editing.editRow.cells.length;t++){const i=e.editing.editRow.cells[t];if(!i.column.allowEdit)continue;const o=e._getEditorValue(i);void 0!==o&&(n[i.column.dataField]=o)}e._editInfo={row:n},e._virtualDataRequest("update",(function(n){n?i():e.cancelEdit(),e.appearance.displayLoadingIndicator=!1,e._setLoadingIndicatorVisibility(),t.parentNode.removeChild(t),e.endUpdate()}))}else i();return!0}return e.focus(),!1}_batchDeleteRow(e){const t=this;if(t._rowsDeleted||(t._rowsDeleted=[]),t.onRowRemove){if(!1===t.onRowRemove([e.id],t))return}t._rowsDeleted.push(e.id),t._recycle(!1),t.onRowRemoved&&t.onRowRemoved([e.id],[e.data.$.index],t)}_batchAddRow(e,t){const i=this;i._rowsAdded||(i._rowsAdded=[]),i._rowsAdded.push(e.id),i.rowById[e.id]=e,e.index=i.rows.length+(i._rowsAdded?i._rowsAdded.length:0),0===t?i._nearRowsAdded.splice(0,0,e):i._farRowsAdded.push(e);i.isInitialized&&i._rowElements&&i._rowElements.length<i.rows.length+i._rowsAdded.length&&i._initializeRowElements(),i.refresh()}_batchUpdateCell(e,t,i,n){const o=this;o._cellsUpdatedValues||(o._cellsUpdatedValues=[]);!function(e,i){return"date"===t.dataType?!(!e&&i)&&(!(e&&!i)&&e.valueOf()===i.valueOf()):e===i}(i,n)?o._cellsUpdatedValues[e.id+"_"+t.dataField]=i:delete o._cellsUpdatedValues[e.id+"_"+t.dataField],o._cellsUpdatedValues.length++}_saveBatchEdit(){const e=this;for(let t in e._cellsUpdatedValues){const i=e._cellsUpdatedValues[t],n=t.substring(0,t.indexOf("_")),o=t.substring(t.indexOf("_")+1),l=e.rowById[n],a=l.getCell(o);if(e.dataSource.virtualDataSource){const t={};t[a.column.dataField]=i,l.data.$&&l.data.$.id?e.updateRow(l.data.$.id,t):(a._updating=!0,a.value=i,a._updating=!1)}else a._updating=!0,a.value=i,a._updating=!1}const t=e._rowsDeleted&&e._rowsDeleted.length>0||e._rowsAdded&&e._rowsAdded.length>0;if(t&&e.beginUpdate(),e._rowsAdded&&e._rowsAdded.length>0)for(let t in e._rowsAdded){const i=e._rowsAdded[t],n=e.rowById[i];if(n){if(e._rowsDeleted&&e._rowsDeleted.length>0){let t=!1;for(let n=0;n<e._rowsDeleted.length;n++){if(e._rowsDeleted[n].id===i){t=!0;break}}if(t)continue}e.dataSource.virtualDataSource?e.addRow(n.data,!0):e._nearRowsAdded.indexOf(n)>=0?e.rows.splice(0,0,n):e._farRowsAdded.indexOf(n)>=0&&e.rows.push(n)}}if(e._rowsDeleted&&e._rowsDeleted.length>0)for(let t=0;t<e._rowsDeleted.length;t++){const i=e._rowsDeleted[t],n=e.rowById[i];if(n)if(e.dataSource&&e.dataSource.virtualDataSource)e._editInfo={row:n.data},e._virtualDataRequest("remove",(function(t){if(t){const t=e.rows.indexOf(n);e.rows.splice(t,1),delete e.rowById[n.id]}}));else{const t=e.rows.indexOf(n);e.rows.splice(t,1)}}t&&e.endUpdate(),e._clearBatchEdit(!1),e.$.fireEvent("saveBatchEdit")}_clearBatchEdit(){const e=this;let t=!1;e._rowsAdded&&e._rowsAdded.length>0&&(t=!0),e._cellsUpdatedValues=[],e._rowsAdded=[],e._rowsDeleted=[],e._nearRowsAdded=[],e._farRowsAdded=[],t?e.refresh():e._recycle(!1),e.$.fireEvent("clearBatchEdit")}_getEditorId(e){const t=e.column._editorId?e.column._editorId:"";return e.editor!==e.column.editor?e.editor.template+"_"+e.column.dataField+"_"+e.row.id+t:e.editor.template+"_"+e.column.dataField+t}_applyCommand(e,t){const i=this;t||(t=[]);const n=function(){"function"==typeof e?e.apply(i,t):i[e]?i[e].apply(i,t):Smart[e]?Smart[e].apply(i,t):window[e]&&window[e].apply(i,t)};if(i.onCommand){t||(t=[]),t[1]||(t[1]=null);const o={name:e,command:n,details:t[0],event:t[1],handled:!1};setTimeout((()=>{i.onCommand.apply(i,[o]),o.handled||n()}),200)}else n()}_getCommandColumnCommandsTemplate(){const e=this,t=e.editing.commandColumn.dataSource,i="icon"!==e.editing.commandColumn.displayMode,n="label"!==e.editing.commandColumn.displayMode;let o="";for(let l in t){const a=t[l];let r="<div",d=!1;if("commandColumnMenu"===l)continue;d||(r+=' item="'+l+'" command="'+a.command+'" class="smart-grid-command-item">',d=!0);const s="{{messages}}"===a.label?e.localize(l):a.label;n&&i?(r+='<span class="smart-grid-icon '+a.icon+'"></span>',r+='<span class="smart-grid-label">'+s+"</span>"):n&&!i?r+='<span title="'+s+'" class="smart-grid-icon '+a.icon+'"></span>':i&&!n&&(r+='<span class="smart-grid-label">'+s+"</span>"),r+="</div>",o+=r}return o}_updateCommandColumnCommandsVisibility(e,t){const i=this,n=e.children,o=i.editing.commandColumn.dataSource;for(let e=0;e<n.length;e++){const l=n[e],a=l.getAttribute("item"),r=o[a].visible;!0===r?l.classList.remove("smart-hidden"):!1===r?l.classList.add("smart-hidden"):"auto"===r&&(!i.editing.dialog.enabled&&(i.editing.editRow===t||i.editing.editCell&&i.editing.editCell.row===t)?"commandColumnEdit"===a?l.classList.add("smart-hidden"):"commandColumnUpdate"!==a&&"commandColumnCancel"!==a||n[e].classList.remove("smart-hidden"):"commandColumnEdit"===a?l.classList.remove("smart-hidden"):"commandColumnUpdate"!==a&&"commandColumnCancel"!==a||n[e].classList.add("smart-hidden"))}}_handleEditKeyDown(e){const t=this,i=e.key,n=t.editing.commandKeys;if(!t.editing.dialog.enabled)for(let o in n){const l=n[o],a=l.key.replace(/ /gi,"").split("|");if(("Tab"!==i||!t.editing.editRow)&&a.indexOf(i)>=0){if(t._editDownKey=i,t._applyCommand(l.command),"Enter"===i&&e){if(e.stopPropagation(),t._supressEnter)return void delete t._supressEnter;t.selection.enabled&&t.selection.allowCellSelection&&t._keyDownHandler(e)}delete t._editDownKey;break}}}_getCustomCellEditor(e){const t=this;e.editor.selector=e.editor.template,e.editor.template="custom";const i=t._getEditorId(e);if(!t._cellEditors[i]){let n=document.createElement("div");t._applyCellEditorUserSettings(n,e),n.classList.add("smart-grid-cell-editor");const o=function(e){"keydown"!==e.type||t._handleEditKeyDown(e)},l=function(){const t=e.editor.instance.element.firstElementChild;Smart.Utilities.Core.isMobile||(e.editor.focus?setTimeout((function(){e.editor.focus.apply(e.editor.instance.element,[])}),50):setTimeout((function(){t.focus()}),50))},a=function(t){const i=e.editor.instance.element.firstElementChild;e.editor.blur?e.editor.blur.apply(e.editor.instance.element,[t]):i.blur()},r=function(t){const i=e.editor.instance.element.firstElementChild;if(!e.editor.isInitialized&&e.editor.settings&&i)for(let t in e.editor.settings)i[t]=e.editor.settings[t];if(e.editor.setValue)e.editor.setValue.apply(e.editor.instance.element,[t]);else{if(i.innerHTML.indexOf("{{")>=0){const n=i.innerHTML.replace(/{{value}}/gi,t).replace(/{{id}}/gi,e.row.id);i.innerHTML=n}i.value=t,t instanceof Date&&(i.value=t.toISOString().split("T")[0]),e.editor.instance.element.value=i.value}},d=function(){if(!e.editor.instance)return"";const t=e.editor.instance.element.firstElementChild;if(e.editor.getValue){const i=t.querySelector("input");return i&&i.blur(),e.editor.getValue.apply(e.editor.instance.element,[t.value])}const i=t.value;return e.editor.settings&&e.editor.settings.valueProperty?i?Array.isArray(i)&&i.length>0?i[0][e.editor.settings.valueProperty]:i[e.editor.settings.valueProperty]:"":i||""},s=function(){n.removeEventListener("keydown",o),e.editor.detach&&e.editor.detach.apply(n,[])},c=function(){n.addEventListener("keydown",o),e.editor.attach&&e.editor.attach.apply(n,[])};let u=null;if((e.editor.selector.startsWith("#")||e.editor.selector.startsWith("."))&&(u=document.querySelector(e.editor.selector)),u)n.appendChild(u.content.cloneNode(!0).firstElementChild);else{const i=function(e){const t=document.createElement("template");return e=e.trim(),t.innerHTML=e,t.content.firstChild}(e.editor.selector);if(i){if("#text"===i.nodeName)return t._getInputCellEditor(e);n.appendChild(i)}}t._cellEditors[i]={element:n,focus:l,blur:a,getValue:d,setValue:r,attach:c,detach:s}}return t._cellEditors[i]}_getSliderCellEditor(e){const t=this,i=t._getEditorId(e),n=document.createElement("div"),o=document.createElement("input"),l=document.createElement("div"),a=document.createElement("smart-number-input");if(o.type="range",o.step="0.01",t._applyCellEditorUserSettings(n,e),"{}"===JSON.stringify(a.numberFormat)){let i={};if(e.column.cellsFormat)if(e.column.cellsFormat.indexOf("c")>=0){i={style:"currency",currency:t.messages[t.locale].calendar.currency};let n=parseInt(e.column.cellsFormat.substring(1));isNaN(n)||(i.maximumFractionDigits=n)}else if(e.column.cellsFormat.indexOf("p")>=0){i={style:"percent"};let t=parseInt(e.column.cellsFormat.substring(1));isNaN(t)||(i.maximumFractionDigits=t)}else e.column.Intl&&e.column.Intl.NumberFormat&&(i=e.column.Intl.NumberFormat);a.numberFormat=i}e.editor.min&&(o.min=a.min=e.editor.min),e.editor.max&&(o.max=a.max=e.editor.max),n.classList.add("smart-grid-cell-editor"),n.classList.add("smart-grid-slider-cell-editor"),l.classList.add("nav"),a.classList.add("smart-flex"),a.style.paddingLeft="6px",l.classList.add("smart-icon-resize-full","smart-grid-icon");const r=function(e){if("keydown"===e.type&&(t._handleEditKeyDown(e),"Backspace"!==e.key&&"Delete"!==e.key&&"Tab"!==e.key&&"Escape"!==e.key&&!e.altKey&&!e.shiftKey))return l.click(),void e.preventDefault()};l.onclick=function(){const i=document.createElement("div"),n=document.createElement("input");n.type="range";const r=e.editor.instance.element,d=document.createElement("div");d.classList.add("smart-slider-editor"),i.setAttribute("theme",t.theme),d.appendChild(n);const s=Smart.Utilities.Core.createGUID().replace(/-/gi,"");i.id="Slider"+s,r.setAttribute("aria-owns",i.id),d.classList.add("smart-grid-slider-container"),n.value=o.value,o.min&&(n.min=o.min),o.max&&(n.max=o.max),l.sliderEditorDialog=i,l.popupSlider=n,n.onchange=n.oninput=function(){a.value=parseFloat(n.value)};const c=e=>{e&&e.key&&("Enter"===e.key&&(i.parentNode.removeChild(i),o.value=parseFloat(n.value),t.endEdit()),"Escape"===e.key&&(i.parentNode.removeChild(i),t.cancelEdit()))};a.onchange=a.onkeyup=e=>{n.value=a.value,c(e)},n.onkeydown=function(e){c(e)},i.classList.add("smart-grid-slider-dialog"),i.appendChild(d),document.body.appendChild(i),i.style.top=t._offsetTop(r)+r.offsetHeight+"px",i.style.left=t._offsetLeft(r)+15+r.offsetWidth-i.offsetHeight+"px",i.style.width=r.offsetWidth+"px";const u=t._offsetLeft(t)+t.offsetWidth;t._offsetLeft(r)+i.offsetWidth>u&&(i.style.left=u-i.offsetWidth-10+"px")};let d=e.value;void 0===d&&(d=0),a.value=d,o.value=d,n.appendChild(a);const s=e=>{"Escape"===e.key&&(l.sliderEditorDialog&&l.sliderEditorDialog.parentNode.removeChild(l.sliderEditorDialog),t.cancelEdit()),"Enter"===e.key&&(l.sliderEditorDialog&&l.sliderEditorDialog.parentNode.removeChild(l.sliderEditorDialog),o.value=parseFloat(a.value),t.endEdit())};return t._cellEditors[i]={element:n,focus:function(){l.click(),Smart.Utilities.Core.isMobile||setTimeout((function(){a.focus(),t.$.scrollView.scrollTop=0}),50)},blur:function(){},setValue:function(e){o.value=void 0!==e&&""!==e?parseFloat(e):0,a.isReady&&a.setValue(e)},getValue:function(){const e=parseFloat(o.value);return l.sliderEditorDialog&&l.sliderEditorDialog.parentNode?(o.value=parseFloat(l.popupSlider.value),o.value):e},attach:function(){o.addEventListener("keydown",r),a.addEventListener("keydown",s)},detach:function(){o.removeEventListener("keydown",r),a.removeEventListener("keydown",s),l.sliderEditorDialog&&l.sliderEditorDialog.parentNode&&(o.value=l.popupSlider.value,l.sliderEditorDialog.parentNode.removeChild(l.sliderEditorDialog))}},t._cellEditors[i]}_getBeginEditKey(e){const t=this;t._beginEditKey?t._beginEditKey+=e:t._beginEditKey=e}_getTextAreaCellEditor(e){const t=this,i=t._getEditorId(e),n=document.createElement("div"),o=t.editing.dialog.enabled?document.createElement("smart-text-area"):document.createElement("textarea");o.users=t.users;const l=document.createElement("div");"richText"===e.column.template&&(o.richText=!0,o.style.setProperty("--smart-editor-label-padding","0px")),t._applyCellEditorUserSettings(n,e),o.style.direction="",t.rightToLeft&&(o.style.direction="rtl"),e.editor.min&&(o.minLength=e.editor.min),e.editor.max&&(o.maxLength=e.editor.max),o.classList.add("smart-input"),n.classList.add("smart-grid-cell-editor"),n.classList.add("smart-grid-text-area-cell-editor"),l.classList.add("nav"),l.classList.add("smart-icon-resize-full","smart-grid-icon");const a=function(e){if(t._getBeginEditKey(e.key),"keydown"===e.type&&(t._handleEditKeyDown(e),"Backspace"!==e.key&&"Delete"!==e.key&&"Tab"!==e.key&&"Escape"!==e.key&&!e.altKey&&!e.shiftKey)){if(t.editing.dialog.enabled)return;return l.click(),void e.preventDefault()}};l.onclick=function(){if(t.editing.dialog.enabled)return;const n=document.createElement("div"),a=document.createElement("smart-text-area"),r=e.editor.instance.element,d=document.createElement("div"),s=document.createElement("div");s.classList.add("smart-grid-text-area-resizer","show","smart-icon-resize-full","smart-grid-icon"),s.title=t.localize("expandCell"),s.onpointerdown=()=>{a.style.pointerEvents="none",t._openTextAreaDialog(e.column,a,e)},"richText"===e.column.template&&(a.richText=!0,a.toolbarOnFocus=!0),a.users=t.users,n.appendChild(s),l.textAreaEditorDialog&&l.textAreaEditorDialog.parentNode&&l.textAreaEditorDialog.parentNode.contains(l.textAreaEditorDialog)&&(l.textAreaEditorDialog.parentNode.removeChild(l.textAreaEditorDialog),l.textAreaEditorDialog.menu&&l.textAreaEditorDialog.menu.remove()),n.id="TextArea"+i,r.setAttribute("aria-owns",n.id),t.rightToLeft&&(a.style.direction="rtl"),n.setAttribute("theme",t.theme),d.appendChild(a),d.classList.add("smart-grid-text-area-container"),a.value=o.value,a.classList.add("smart-input"),o.minLength>=0&&(a.minLength=o.minLength),o.maxLength>=0&&(a.maxLength=o.maxLength),l.textAreaEditorDialog=n,l.popupTextArea=a,a.onkeydown=function(e){if(a._key=e.key,t._getBeginEditKey(e.key),"Escape"===e.key){try{n.parentNode.contains(n)&&(n.parentNode.removeChild(n),n.menu&&n.menu.remove())}catch(e){n.error=e}t.editing.editCell&&t.cancelEdit()}("Tab"===e.key||"Enter"===e.key&&e.shiftKey)&&(o.value=a.value,t.editing.editCell?t.endEdit():a.blur(),e.preventDefault(),e.stopPropagation())},n.classList.add("smart-grid-text-area-dialog"),n.appendChild(d),document.body.appendChild(n),t._beginEditKey&&!Smart.Utilities.Core.isMobile?a.focus():setTimeout((function(){Smart.Utilities.Core.isMobile||a.select()}),50);const c=t._offsetTop(r);if(n.style.top=c+"px",n.style.left=t._offsetLeft(r)+"px",n.style.width=r.offsetWidth+"px",c+d.offsetHeight>window.innerHeight&&(n.style.top=r.offsetHeight+c-n.offsetHeight+"px"),t.grouping.enabled&&e.column._treeColumn){const e=r.parentNode.parentNode;n.style.top=t._offsetTop(e)+"px",n.style.left=t._offsetLeft(e)+"px",n.style.width=e.offsetWidth+"px"}a.onblur=()=>{if(!t._dialogTextArea||t._dialogTextArea.classList.contains("smart-hidden")){"Escape"!==a._key&&(o.value=l.popupTextArea.value),o.focus();try{l.textAreaEditorDialog.parentNode&&(l.textAreaEditorDialog.parentNode.removeChild(l.textAreaEditorDialog),l.textAreaEditorDialog.menu&&l.textAreaEditorDialog.menu.remove())}catch(e){l.error=e}}}},n.appendChild(o);return t._cellEditors[i]={element:n,focus:function(){l.click()},blur:function(){},setValue:function(i){i&&(""+i).indexOf("&#")>=0&&(i=t._fromHTMLEntities(i)),"richText"!==e.column.template&&"string"==typeof i&&(i=i.replaceAll("<br/>","\n\r").replaceAll("<br>","\n\r")),null===i&&(i="");const n=t._unescapeString(i);o.value=n,l.popupTextArea&&(l.popupTextArea.value=o.value,l.popupTextArea.dispatchEvent(new Event("input")))},getValue:function(){let t=o.value;return"Smart-TEXT-AREA"===o.nodeName&&"richText"===e.column.template&&(t=o.getHTML()),l.textAreaEditorDialog&&l.textAreaEditorDialog.parentNode?(o.value=l.popupTextArea.value,l.popupTextArea.richText?l.popupTextArea.getHTML():o.value):t},attach:function(){o.addEventListener("keydown",a)},detach:function(){if(o.removeEventListener("keydown",a),l.textAreaEditorDialog&&l.textAreaEditorDialog.parentNode){o.value=l.popupTextArea.value;try{l.textAreaEditorDialog.parentNode&&l.textAreaEditorDialog.parentNode.removeChild(l.textAreaEditorDialog),l.textAreaEditorDialog.menu&&l.textAreaEditorDialog.menu.remove(),l.popupTextArea&&l.popupTextArea.remove();const e=document.querySelector(".smart-grid-textarea-dialog");e&&e.close()}catch(e){l.error=e}}else l.popupTextArea&&l.popupTextArea.remove()}},t._cellEditors[i]}_getColorInputCellEditor(e){const t=this,i=t._getEditorId(e);if(!t._cellEditors[i]){const n=t._getColorInput();t._applyCellEditorUserSettings(n,e),n.classList.add("smart-grid-cell-editor"),n.classList.add("smart-grid-color-input-cell-editor"),n.dropDownWidth=50,n.autocomplete="off",n.style.direction="",t.rightToLeft&&(n.rightToLeft=!0);const o=function(e){"keydown"!==e.type||t._handleEditKeyDown(e)},l=function(){Smart.Utilities.Core.isMobile||setTimeout((function(){n.select()}),50)},a=function(){},r=function(e){null==e&&(e=""),n.value=e},d=function(){return n.value},s=function(){n.removeEventListener("keydown",o)},c=function(){n.addEventListener("keydown",o)};t._cellEditors[i]={element:n,focus:l,blur:a,getValue:d,setValue:r,attach:c,detach:s}}return t._cellEditors[i]}_getInputCellEditor(e){const t=this,i=t._getEditorId(e);if(!t._cellEditors[i]){const n=document.createElement("input");t._applyCellEditorUserSettings(n,e),e.editor.min&&(n.minLength=e.editor.min),e.editor.max&&(n.maxLength=e.editor.max),n.classList.add("smart-input"),n.classList.add("smart-grid-cell-editor"),n.classList.add("smart-grid-input-cell-editor"),n.autocomplete="off",n.style.direction="",t.rightToLeft&&(n.style.direction="rtl");const o=function(i){i.key;if(t._getBeginEditKey(i.key),"keydown"===i.type)return"number"!==e.column.dataType&&"int"!==e.column.dataType&&"float"!==e.column.dataType||t.editing.editColumn||i.key.match(/[0-9]/)||"-"===i.key||1!==i.key.length?void t._handleEditKeyDown(i):(i.preventDefault(),void i.stopPropagation())},l=function(){Smart.Utilities.Core.isMobile||(t._beginEditKey?n.focus():setTimeout((function(){n.select()}),50))},a=function(){},r=function(i){if(e.column.rowHeaderColumn&&!i)return void(n.value=e.editor.row.visibleIndex+1);if("number"===e.column.dataType||"int"===e.column.dataType||"float"===e.column.dataType){if(""===i)return;if(i&&!i.toString().match(/[0-9]/)&&"-"!==i)return}i&&(""+i).indexOf("&#")>=0&&(i=t._fromHTMLEntities(i));const o=t._unescapeString(i);n.value=o},d=function(){return n.value},s=function(){n.removeEventListener("keydown",o)},c=function(){n.addEventListener("keydown",o)};t._cellEditors[i]={element:n,focus:l,blur:a,getValue:d,setValue:r,attach:c,detach:s}}return t._cellEditors[i]}_applyCellEditorUserSettings(e,t){for(let i in t.editor)"template"!==i&&("list"!==i?"onInit"!==i&&"onRender"!==i&&(e[i]=t.editor[i]):e.setAttribute(i,t.editor[i]));if(t.editor.settings)for(let i in t.editor.settings)e[i]=t.editor.settings[i]}_getCheckInputCellEditor(e){return this._getAutoCompleteCellEditor(e,"smart-check-input")}_getMultiInputCellEditor(e){return this._getAutoCompleteCellEditor(e,"smart-multi-input")}_getMultiComboInputCellEditor(e){const t=this._getAutoCompleteCellEditor(e,"smart-multi-combo-input");return"tags"!==e.column.template&&"collaborator"!==e.column.template||(t.getValue=()=>{const e=t.element.selectedItems;if(e&&0===e.length)return"";let i=[];for(let t=0;t<e.length;t++){const n=e[t];"string"==typeof n?i.push(n):i.push(n.value)}return i.toString()},t.setValue=e=>{if(null===e&&(e=""),"number"==typeof e&&(e=""+e),e&&e.indexOf("{")>=0||e&&e.indexOf("[")>=0)t.element.selectedItems=JSON.parse(e);else if(e&&e.indexOf(",")>=0)if(e=e.split(",").map((e=>e.trim())),t.element.readonly){let i=[];t.element.dataSource.forEach((t=>{for(let n=0;n<e.length;n++){const o=e[n];("string"==typeof t&&""+t===o||t&&void 0!==t.label&&""+t.value===o)&&i.push(t)}})),t.element.selectedItems=i}else t.element.selectedItems=e;else if(t.element.readonly){let i=[];t.element.dataSource.forEach((t=>{("string"==typeof t&&""+t===e||t&&void 0!==t.label&&""+t.value===e)&&i.push(t)})),t.element.selectedItems=i}else t.element.value=e},t.focus=function(){if(Smart.Utilities.Core.isMobile)return;const e=t.element;setTimeout((()=>{t.element.readonly?t.element.focus():e&&e.select&&e.select()}),50)}),t}_getAutoCompleteCellEditor(e,t){const i=this,n=i._getEditorId(e);if(i._cellEditors[n]&&e.column.editor.isDirty&&(delete e.column.editor.isDirty,delete i._cellEditors[n]),!i._cellEditors[n]){let o=document.createElement("smart-input");t&&(o=document.createElement(t)),o.dropDownPlaceholder=i.localize("noOptions"),i._applyCellEditorUserSettings(o,e),o.readonly&&(o.dropDownButtonPosition="right"),o.dropDownOpenPosition="auto";const l=function(e){o.opened||"keydown"!==e.type||i._handleEditKeyDown(e)};o.rightToLeft=i.rightToLeft,o.classList.add("smart-grid-cell-editor"),o.classList.add("smart-grid-auto-complete-cell-editor"),o.dropDownOpenPosition="auto";const a=function(){Smart.Utilities.Core.isMobile||setTimeout((()=>{o&&o.select&&o.select()}),50)},r=function(e){e&&1===e.length&&o.readonly||(o.value=null!==e?e:"")},d=function(){return o.value},s=function(){o&&o.close&&(o.value="",o.close(),o.removeEventListener("keydown",l))},c=function(){},u=function(){o.addEventListener("keydown",l)};i._cellEditors[n]={element:o,focus:a,blur:c,setValue:r,getValue:d,attach:u,detach:s}}if(e.editor.dataSource||e.editor.isInitialized){if(e.column.editor.collaborator){let t=[];for(let e=0;e<i.users.length;e++)t.push({color:i.users[e].color,label:i.users[e].name,id:i.users[e].id,value:i.users[e].id,name:i.users[e].name,image:i.users[e].image});if(e.column.editor.singleSelect&&(t=[""].concat(t)),t&&i._cellEditors[n]&&i._cellEditors[n].element&&i._cellEditors[n].element.dataSource&&JSON.stringify(t)!==JSON.stringify(i._cellEditors[n].element.dataSource)){i._cellEditors[n].element.dropDownHeight="auto";const o=i._cellEditors[n].element.dataSource;if(o)for(let e=0;e<t.length;e++){const i=t[e],n=o.find((e=>{if(e.id===i.id)return e}));n&&"object"==typeof i&&(i.color=n.color)}i._cellEditors[n].element.dataSource=t,e.column.editor.dataSource=t}}}else{const t=i.getVisibleRows(),o=[];for(let n=0;n<t.length;n++){let l=i.dataSource[t[n].index];if(l){if(l=l[e.column.dataField],!l)continue;-1===o.indexOf(l)&&o.push(l)}}o.length<7?i._cellEditors[n].element.dropDownHeight="auto":i._cellEditors[n].element.dropDownHeight=200,i._cellEditors[n].element.dataSource=o}if(e.column.relationId&&e.column.relationField){const t=i._getRelationData(e.column.relationId,e.column.relationField,e.column.editor.singleSelect);i._cellEditors[n].element.dataSource=t,e.column.editor.dataSource=t,t.length<7?i._cellEditors[n].element.dropDownHeight="auto":i._cellEditors[n].element.dropDownHeight=200}return i._cellEditors[n]}_getDateRangeInputCellEditor(e){const t=this,i=t._getEditorId(e);if(!t._cellEditors[i]){const n=document.createElement("smart-date-range-input");n.dropDownButtonPosition="right",n.dropDownAppendTo="body",n.autoClose=!0,n.selectionMode="default",n.rightToLeft=t.rightToLeft,n.timepicker=!0,n.dropDownOpenPosition="auto",t._applyCellEditorUserSettings(n,e);const o=function(e){n.opened||"keydown"!==e.type||t._handleEditKeyDown(e)};n.classList.add("smart-grid-cell-editor"),n.classList.add("smart-grid-date-time-picker-cell-editor");const l=function(){Smart.Utilities.Core.isMobile||setTimeout((()=>{n.select()}),50)},a=function(e){n.value=e,n.selectedDates=[]},r=function(){return n._performSelect(),n.selectedDates},d=function(){n.value="",n.close(),n.removeEventListener("keydown",o)},s=function(e){const i=n.getAttribute("aria-controls");if(i&&n.opened){const n=t.getBoundingRect(document.getElementById(i));e.pageX<n.left||e.pageX>n.right||e.pageY<n.top||e.pageY>n.bottom||e.preventDefault()}},c=function(){n.addEventListener("keydown",o)};t._cellEditors[i]={element:n,focus:l,blur:s,setValue:a,getValue:r,attach:c,detach:d}}return t._cellEditors[i]}_getDateTimePickerCellEditor(e){const t=this,i=t._getEditorId(e);if(!t._cellEditors[i]){const n=document.createElement("smart-date-time-picker");n.calendarButton=!0,n.dropDownAppendTo="body",n.autoClose=!0,n.dropDownDisplayMode="calendar",n.rightToLeft=t.rightToLeft,n.nullable=!0,e.column.cellsFormat&&(n.formatString=e.column.cellsFormat),t._applyCellEditorUserSettings(n,e),t.selection.enabled&&!t.selection.allowCellSelection&&n.autoOpen&&(n.autoOpen=e.editor.autoOpen=!1);const o=function(e){n.opened||"keydown"!==e.type||t._handleEditKeyDown(e)};n.classList.add("smart-grid-cell-editor"),n.classList.add("smart-grid-date-time-picker-cell-editor");const l=function(){setTimeout((()=>{if(n.autoOpen&&!t.editing.editRow)n.open();else{if(Smart.Utilities.Core.isMobile)return;n.select()}}),50)},a=function(e){if("string"==typeof e&&1===e.length){if("string"==typeof e&&n.autoOpen&&"Invalid Date"===(e=new Date(e)).toString())return;n.$.input.value=e}else n.value=e},r=function(){if(n.value&&n.value instanceof Smart.Utilities.DateTime){if(""===n.$.input.value)return n._validateValue(n.$.input.value,null),null;const e=Smart.Utilities.DateTime.ParseDate(n.$.input.value,n.formatString);return n._validateValue(e),n.value.toDate()}return n.value},d=function(){n.value="",n.close(),n.removeEventListener("keydown",o)},s=function(e){const i=n.getAttribute("aria-controls");if(i&&n.opened){const n=t.getBoundingRect(document.getElementById(i));e.pageX<n.left||e.pageX>n.right||e.pageY<n.top||e.pageY>n.bottom||e.preventDefault()}},c=function(){n.addEventListener("keydown",o)};t._cellEditors[i]={element:n,focus:l,blur:s,setValue:a,getValue:r,attach:c,detach:d}}return t._cellEditors[i]}_getTimeInputCellEditor(e){const t=this,i=t._getEditorId(e);if(!t._cellEditors[i]){const n=document.createElement("smart-time-input");n.calendarButton=!0,n.dropDownAppendTo="body",n.autoClose=!0,n.dropDownDisplayMode="calendar",n.rightToLeft=t.rightToLeft,t._applyCellEditorUserSettings(n,e);const o=function(e){n.opened||"keydown"!==e.type||t._handleEditKeyDown(e)};n.classList.add("smart-grid-cell-editor"),n.classList.add("smart-grid-date-time-picker-cell-editor");const l=function(){Smart.Utilities.Core.isMobile||setTimeout((()=>{n.select()}),50)},a=function(e){n.value=e},r=function(){const e=new Date;return e.setHours(n.value[0]),e.setMinutes(n.value[1]),"Invalid Date"===e.toString()?new Date:e},d=function(){n.value="",n.close(),n.removeEventListener("keydown",o)},s=function(e){const i=n.getAttribute("aria-controls");if(i&&n.opened){const n=t.getBoundingRect(document.getElementById(i));e.pageX<n.left||e.pageX>n.right||e.pageY<n.top||e.pageY>n.bottom||e.preventDefault()}},c=function(){n.addEventListener("keydown",o)};t._cellEditors[i]={element:n,focus:l,blur:s,setValue:a,getValue:r,attach:c,detach:d}}return t._cellEditors[i]}_getDateInputCellEditor(e){const t=this,i=t._getEditorId(e);if(!t._cellEditors[i]){const n=document.createElement("smart-date-input");n.calendarButton=!0,n.dropDownAppendTo="body",n.autoClose=!0,n.dropDownDisplayMode="calendar",n.rightToLeft=t.rightToLeft,n.formatString=(!e.column.cellsFormat||1!==e.column.cellsFormat.length&&"d"!==e.column.cellsFormat)&&e.column.cellsFormat?e.column.cellsFormat:"MM/dd/yyyy",n.dropDownOpenPosition="auto",t._applyCellEditorUserSettings(n,e),t.selection.enabled&&!t.selection.allowCellSelection&&n.autoOpen&&(n.autoOpen=e.editor.autoOpen=!1);const o=function(e){n.opened?"Enter"!==e.key&&"Escape"!==e.key||t._handleEditKeyDown(e):"keydown"!==e.type||t._handleEditKeyDown(e)};n.classList.add("smart-grid-cell-editor"),n.classList.add("smart-grid-date-time-picker-cell-editor");const l=function(){setTimeout((()=>{if(e.editor.autoOpen&&!t.editing.editRow)n.open();else{if(Smart.Utilities.Core.isMobile)return;n.select()}}),50)},a=function(e){"string"==typeof e&&e.length>1&&"Invalid Date"===(e=new Date(e)).toString()||(n.value=e)},r=function(){return n.getValue()},d=function(){n.value="",n.close(),n.removeEventListener("keydown",o)},s=function(e){const i=n.getAttribute("aria-controls");if(i&&n.opened){const n=t.getBoundingRect(document.getElementById(i));e.pageX<n.left||e.pageX>n.right||e.pageY<n.top||e.pageY>n.bottom||e.preventDefault()}},c=function(){n.addEventListener("keydown",o)};t._cellEditors[i]={element:n,focus:l,blur:s,setValue:a,getValue:r,attach:c,detach:d}}return t._cellEditors[i]}_getAttachmentCellEditor(e){const t=this,i=t._getEditorId(e);if(t._dialogFile&&(t._dialogFile.cell=e),!t._cellEditors[i]){const n=document.createElement("div");n.innerHTML=`\n <div style="display: grid;"><div title="${t.localize("addFiles")}" class="smart-grid-icon smart-icon-plus show"></div><div class="attachments"><div class="container"></div></div></div>\n `,n.rightToLeft=t.rightToLeft,n.tabIndex=0,n.firstElementChild.style.gridTemplateColumns="25px 1fr",t.rightToLeft&&(n.style.direction="rtl");const o=n.querySelector(".smart-grid-icon"),l=n.querySelector(".attachments");o.onpointerdown=()=>{t._openFileDialog(t._dialogFile?t._dialogFile.cell:e,!0)},l.onclick=e=>{const i=JSON.parse(n.value),o=[...l.children[0].children].indexOf(e.target.parentNode);if(i[o]){const e=document.createElement("a");if(i[o].value.indexOf(window.location.host)>=0)fetch(i[o].value).then((e=>e.blob())).then((t=>{const n=URL.createObjectURL(t);e.download=i[o].label,e.href=n,e.click()}));else{if(i[o].value.indexOf("base64")>=0){const n=t._getFileFromBase64(i[o].value);e.href=URL.createObjectURL(n)}else e.href=i[o].value;e.target="_blank",e.click()}}},n.ondrop=i=>{i.preventDefault(),t._openFileDialog(t._dialogFile?t._dialogFile.cell:e,!0),t._dialogFile.dropZone.dropHere(i)},n.ondragover=e=>{e.preventDefault()},t._applyCellEditorUserSettings(n,e),n.classList.add("smart-grid-cell-editor");const a=function(){n.focus(),setTimeout((()=>{n.focus()}),50)},r=function(e){n.value=e,l.innerHTML=`<div class="container"><div style="justify-content: center; align-items: center; display: flex; margin-top: 3px;" class="smart-drop-file smart-micro smart-quiet">${t.localize("dropFiles")}</div></div>`;const i=l.firstElementChild;if(t._findIsFile(e)){let t="";try{t=JSON.parse(e)}catch(e){console.log(e)}e=t}Array.isArray(e)&&(i.innerHTML="",e.forEach((e=>{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"),e.label.indexOf("png")>=0||e.label.indexOf("jpg")>=0||e.label.indexOf("jpeg")>=0||e.label.indexOf("gif")>=0?t.firstElementChild.classList.add("smart-icon-image"):e.label.indexOf(".pdf")>=0?t.firstElementChild.classList.add("smart-icon-pdf"):e.label.indexOf(".tsv")>=0||e.label.indexOf(".txt")>=0||e.label.indexOf(".csv")>=0?t.firstElementChild.classList.add("smart-icon-text"):e.label.indexOf(".xls")>=0||e.label.indexOf(".xlsx")>=0?t.firstElementChild.classList.add("smart-icon-excel"):e.label.indexOf(".ppt")>=0?t.firstElementChild.classList.add("smart-icon-powerpoint"):e.label.indexOf(".zip")>=0||e.label.indexOf(".rar")>=0||e.label.indexOf(".7z")>=0?t.firstElementChild.classList.add("smart-icon-archive"):e.label.indexOf(".doc")>=0||e.label.indexOf(".docx")>=0?t.firstElementChild.classList.add("smart-icon-word"):t.firstElementChild.classList.add("smart-icon-file"),i.appendChild(t)})))},d=function(){let e=n.value;return e&&(Array.isArray(e)||("string"==typeof e&&e.indexOf("base64"))>=0)&&Array.isArray(e)&&(e=JSON.stringify(e)),e},s=i=>{("+"===i.key||i.altKey&&"ArrowDown"===i.key)&&t._openFileDialog(t._dialogFile?t._dialogFile.cell:e.true),"Escape"===i.key&&t.cancelEdit(),"Enter"===i.key&&t.endEdit()},c=function(){n.value="",t._dialogFile&&t._dialogFile.close(),n.removeEventListener("keydown",s)},u=function(){},m=function(){n.addEventListener("keydown",s)};t._cellEditors[i]={element:n,focus:a,blur:u,setValue:r,getValue:d,attach:m,detach:c}}return t._cellEditors[i]}_getImageCellEditor(e){const t=this,i=t._getEditorId(e);if(t._dialogFile&&(t._dialogFile.cell=e),!t._cellEditors[i]){const n=document.createElement("div");n.innerHTML=`\n <div style="display: grid;"><div title="${t.localize("addImages")}" class="smart-grid-icon smart-icon-plus show"></div><div class="images"><div class="container"></div></div></div>\n `,n.rightToLeft=t.rightToLeft,n.tabIndex=0,n.firstElementChild.style.gridTemplateColumns="25px 1fr",t.rightToLeft&&(n.style.direction="rtl");const o=n.querySelector(".smart-grid-icon"),l=n.querySelector(".images");o.onpointerdown=()=>{t._openFileDialog(t._dialogFile?t._dialogFile.cell:e)},l.onclick=e=>{"IMG"===e.target.nodeName&&t._openImagePreviewDialog(e.target)},n.ondrop=i=>{i.preventDefault(),t._openFileDialog(t._dialogFile?t._dialogFile.cell:e),t._dialogFile.dropZone.dropHere(i)},n.ondragover=e=>{e.preventDefault()},t._applyCellEditorUserSettings(n,e),n.classList.add("smart-grid-cell-editor");const a=function(){n.focus(),setTimeout((()=>{n.focus()}),50)},r=function(e){n.value=e,l.innerHTML=`<div class="container"><div style="justify-content: center; align-items: center; display: flex; margin-top: 3px;" class="smart-drop-image smart-micro smart-quiet">${t.localize("dropImages")}</div></div>`;const i=l.firstElementChild;if(t._findIsFile(e)){let t="";try{t=JSON.parse(e)}catch(e){console.log(e)}e=t}e&&"string"==typeof e&&e.indexOf("./")>=0&&(e=(e=e.split(",")).map((e=>({label:e,value:e})))),Array.isArray(e)&&(i.innerHTML="",e.forEach((e=>{const n=document.createElement("img");n.style.display="none";let o="";o=e.small?e.small:e.medium?e.medium:e.large?e.large:e.value,n.onload=()=>{n.style.display=""},o.indexOf("base64")>=0?n.src=o:(t._imagesCache||(t._imagesCache=[]),t._imagesCache[o]?t.uploadSettings.url?t._findUserFile(e)?(n.src=o,n.setAttribute("data-url",e.large||e.value),n.style.display=""):n.style.display="none":(n.src=o,n.setAttribute("data-url",e.large||e.value)):(t._imagesCache[o]=!0,n.style.display="none",t.uploadSettings.url?t._findUserFile(e)?(n.src=o,n.setAttribute("data-url",e.large||e.value),n.style.display=""):n.style.display="none":(n.src=o,n.style.display="")),n.onerror=()=>{n.style.display="none"}),i.appendChild(n)})))},d=function(){let e=n.value;return e&&(Array.isArray(e)||("string"==typeof e&&e.indexOf("base64"))>=0)&&Array.isArray(e)&&(e=JSON.stringify(e)),e},s=i=>{("+"===i.key||i.altKey&&"ArrowDown"===i.key)&&t._openFileDialog(t._dialogFile?t._dialogFile.cell:e),"Escape"===i.key&&t.cancelEdit(),"Enter"===i.key&&t.endEdit()},c=function(){n.value="",t._dialogFile&&t._dialogFile.close(),t._dialogImagePreview&&t._dialogImagePreview.close(),n.removeEventListener("keydown",s)},u=function(){},m=function(){n.addEventListener("keydown",s)};t._cellEditors[i]={element:n,focus:a,blur:u,setValue:r,getValue:d,attach:m,detach:c}}return t._cellEditors[i]}_getPhoneCellEditor(e){const t=this,i=t._getEditorId(e);if(!t._cellEditors[i]){const n=document.createElement("smart-phone-input");n.rightToLeft=t.rightToLeft,t._applyCellEditorUserSettings(n,e);const o=function(e){n.opened||"keydown"!==e.type||t._handleEditKeyDown(e)};n.classList.add("smart-grid-cell-editor"),n.classList.add("smart-grid-phone-input-cell-editor");const l=function(){Smart.Utilities.Core.isMobile||setTimeout((()=>{n.select()}),50)},a=function(e){n.value=e?t._fromHTMLEntities(e):"",e&&1===e.length&&(n.$.input.value=e,n.$.input.selectionStart=n.$.input.selectionEnd=n.$.input.value.indexOf(e)+1),t._phoneNumbers&&t._phoneNumbers[e]&&(n.selectedCountry=t._phoneNumbers[e])},r=function(){return t._phoneNumbers||(t._phoneNumbers=[]),n.value&&(t._phoneNumbers[n.value]=n.selectedCountry),n.value},d=function(){n.value="",n.removeEventListener("keydown",o)},s=function(){},c=function(){n.addEventListener("keydown",o)};t._cellEditors[i]={element:n,focus:l,blur:s,setValue:a,getValue:r,attach:c,detach:d}}return t._cellEditors[i]}_getPasswordCellEditor(e){const t=this,i=t._getEditorId(e);if(!t._cellEditors[i]){const n=document.createElement("smart-password-input");n.rightToLeft=t.rightToLeft,t._applyCellEditorUserSettings(n,e);const o=function(e){n.opened||"keydown"!==e.type||t._handleEditKeyDown(e)};n.classList.add("smart-grid-cell-editor"),n.classList.add("smart-grid-password-input-cell-editor");const l=function(){Smart.Utilities.Core.isMobile||setTimeout((()=>{n.select()}),50)},a=function(e){n.value=e,1===e.length&&(n.$.input.selectionStart=n.$.input.selectionEnd=n.$.input.value.indexOf(e)+1)},r=function(){return n.value},d=function(){n.value="",n.removeEventListener("keydown",o)},s=function(){},c=function(){n.addEventListener("keydown",o)};t._cellEditors[i]={element:n,focus:l,blur:s,setValue:a,getValue:r,attach:c,detach:d}}return t._cellEditors[i]}_getMaskCellEditor(e){const t=this,i=t._getEditorId(e);if(!t._cellEditors[i]){const n=document.createElement("smart-masked-text-box");n.rightToLeft=t.rightToLeft,t._applyCellEditorUserSettings(n,e);const o=function(e){n.opened||"keydown"!==e.type||t._handleEditKeyDown(e)};n.classList.add("smart-grid-cell-editor"),n.classList.add("smart-grid-masked-text-box-cell-editor");const l=function(){Smart.Utilities.Core.isMobile||setTimeout((()=>{n.select()}),50)},a=function(e){n.value=e,1===e.length&&(n.$.input.selectionStart=n.$.input.selectionEnd=n.$.input.value.indexOf(e)+1)},r=function(){return n.value},d=function(){n.value="",n.removeEventListener("keydown",o)},s=function(){},c=function(){n.addEventListener("keydown",o)};t._cellEditors[i]={element:n,focus:l,blur:s,setValue:a,getValue:r,attach:c,detach:d}}return t._cellEditors[i]}_getNumberInputCellEditor(e){const t=this,i=t._getEditorId(e);if(!t._cellEditors[i]){const n=document.createElement("smart-number-input");if(e&&e.editor&&(void 0!==e.editor.min&&(e.editor.min=parseInt(e.editor.min)),void 0!==e.editor.max&&(e.editor.max=parseInt(e.editor.max))),t._applyCellEditorUserSettings(n,e),"{}"===JSON.stringify(n.numberFormat)){let i={};if(e.column.cellsFormat)if(e.column.cellsFormat.indexOf("c")>=0){i={style:"currency",currency:t.messages[t.locale].calendar.currency};let n=parseInt(e.column.cellsFormat.substring(1));isNaN(n)||(i.maximumFractionDigits=n)}else if(e.column.cellsFormat.indexOf("p")>=0){i={style:"percent"};let t=parseInt(e.column.cellsFormat.substring(1));isNaN(t)||(i.maximumFractionDigits=t,i.minimumFractionDigits=t)}else if(e.column.cellsFormat.indexOf("d")>=0){i={style:"decimal"};let t=parseInt(e.column.cellsFormat.substring(1));isNaN(t)||(i.maximumFractionDigits=t)}else if(e.column.cellsFormat.indexOf("f")>=0||e.column.cellsFormat.indexOf("n")>=0){i={};let t=parseInt(e.column.cellsFormat.substring(1));isNaN(t)||(i.minimumFractionDigits=t,i.maximumFractionDigits=t)}else e.column.Intl&&e.column.Intl.NumberFormat&&(i=e.column.Intl.NumberFormat);n.numberFormat=i}n.classList.add("smart-grid-cell-editor"),n.classList.add("smart-grid-number-input-cell-editor");const o=function(e){t._handleEditKeyDown(e)},l=function(){Smart.Utilities.Core.isMobile||setTimeout((function(){n.focus(),t.$.scrollView.scrollTop=0}),50)},a=function(){},r=function(e){n.isReady&&("string"==typeof e&&n.numberFormat&&n.numberFormat.style&&"percent"===n.numberFormat.style&&(e=parseFloat(e),e=""+(e/=100)),null!==e&&""!==e||(e=0),n.setValue(e))},d=function(){return n.getValue()},s=function(){n.removeEventListener("keydown",o)},c=function(){n.addEventListener("keydown",o)};t._cellEditors[i]={element:n,focus:l,blur:a,getValue:d,setValue:r,attach:c,detach:s}}return t._cellEditors[i]}_getRatingCellEditor(e){const t=this,i=t._getEditorId(e);if(!t._cellEditors[i]){const n=document.createElement("div");n.classList.add("smart-input"),n.classList.add("smart-grid-cell-editor"),n.classList.add("smart-grid-rating-cell-editor"),n.tabIndex=0;const o=e.column.editor.max?e.column.editor.max:5,l=e.value,a=l?parseInt(l):0;if(n.value=l,n.firstElementChild&&n.firstElementChild.hasAttribute("value")){if(a===n.firstElementChild.getAttribute("value"))return t.cell._setStyle(n),void t.setAttribute("template",t.cell.template)}let r='<div class="rating">';for(let e=0;e<o;e++){let t="";a>0&&a>e&&(t="value"),r+=`<div title="${e+1}" value="${e+1}" class="smart-grid-icon show smart-icon-star ${t}"></div>`}r+="</div>",n.innerHTML=r;const d=function(){},s=function(e){if(" "!==e.key){switch(e.key){case"ArrowLeft":case"ArrowDown":case"ArrowRight":case"ArrowUp":if(t.editing.dialog.enabled)return;t.endEdit()}t._handleEditKeyDown(e)}else d()},c=e=>{let t="";n.value===e&&(e=0);for(let i=0;i<o;i++){let n="";e>0&&e>i&&(n="value"),t+=`<div title="${i+1}" value="${i+1}" class="smart-grid-icon show smart-icon-star ${n}"></div>`}t+="",n.firstElementChild.innerHTML=t,n.value=e};n.firstElementChild.onpointerdown=e=>{if(e.target.hasAttribute("value")){const t=e.target.getAttribute("value");c(t)}},n.firstElementChild.onpointermove=e=>{if(e.target.hasAttribute("value")){const t=[...e.target.parentElement.children],i=t.indexOf(e.target);t.forEach(((e,t)=>{e.classList.remove("hover"),t<=i&&e.classList.add("hover")}))}},n.firstElementChild.onpointerleave=e=>{if(e.target.classList.contains("rating")){const t=[...e.target.children];t.indexOf(e.target);t.forEach(((e,t)=>{e.classList.remove("hover")}))}};const u=function(e){c(e)},m=function(){},g=function(){return n.value},p=function(){n.value=!1,n.removeEventListener("click",d),n.removeEventListener("keydown",s)},f=function(){},h=function(){n.addEventListener("keydown",s),n.addEventListener("click",d)};t._cellEditors[i]={getValue:g,setValue:u,focus:m,blur:f,element:n,detach:p,attach:h}}return t._cellEditors[i]}_getCheckBoxCellEditor(e){const t=this,i=t._getEditorId(e);if(!t._cellEditors[i]){const e=document.createElement("div");e.classList.add("smart-input"),e.classList.add("smart-grid-cell-editor"),e.classList.add("smart-grid-check-box-cell-editor"),e.tabIndex=0;const n=function(){!0!==e.value&&!1!==e.value&&null!==e.value&&(e.value=!1),null===e.value?e.value=!1:e.value=!e.value,!1===e.value?e.removeAttribute("checked"):e.setAttribute("checked",e.value?"":"indeterminate")},o=function(e){if(" "!==e.key){switch(e.key){case"ArrowLeft":case"ArrowDown":case"ArrowRight":case"ArrowUp":if(t.editing.dialog.enabled)return;t.endEdit()}t._handleEditKeyDown(e)}else n()},l=function(t){e.value="string"==typeof t?"false"!==t&&"0"!==t&&"null"!==t&&"undefined"!==t:t,!1===e.value?e.removeAttribute("checked"):e.setAttribute("checked",e.value?"":"indeterminate")},a=function(){Smart.Utilities.Core.isMobile||(e.focus(),setTimeout((function(){e.focus()}),25))},r=function(){return e.value},d=function(){e.value=!1,e.removeEventListener("click",n),e.removeEventListener("keydown",o)},s=function(){},c=function(){e.addEventListener("keydown",o),e.addEventListener("click",n)};t._cellEditors[i]={getValue:r,setValue:l,focus:a,blur:s,element:e,detach:d,attach:c}}return t._cellEditors[i]}_unescapeString(e){if(null==e)return e;if("string"!=typeof e)return e;const t=[{regex:"&",entity:"&amp;"},{regex:">",entity:"&gt;"},{regex:"<",entity:"&lt;"},{regex:'"',entity:"&quot;"},{regex:"'",entity:"&#39;"},{regex:"=",entity:"&#x3D;"},{regex:"/",entity:"&#x2F;"},{regex:"`",entity:"&#x60;"}];let i;for(let n in t)i=new RegExp(t[n].entity,"g"),e=e.replace(i,t[n].regex);return e}_fromHTMLEntities(e){const t=this,i=t._textArea?t._textArea:document.createElement("textarea");return i.innerHTML=e,t._textArea=i,i.value}_toHtmlEntities(e){return e.replace(/[^a-z0-9\s]/gmu,(e=>"&#"+e.codePointAt(0)+";"))}_getEditorValue(e){const t=this,i=t._getEditorId(e);if(!t._cellEditors)return;const n=t._cellEditors[i];if(!n)return;const o=function(t){switch(e.column.dataType){case"string":null==t?t="":void 0!==t&&"number"==typeof t?t=parseFloat(t):t&&"object"==typeof t&&t[0]&&t[0].label?t=t[0].label.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/'/g,"&#39;").replace(/"/g,"&quot;").replace(/[\r\n]+/g," ").replace(/\p{Extended_Pictographic}/gu,(e=>"&#"+e.codePointAt(0)+";")):t&&"object"==typeof t&&t instanceof Date?t=t.toLocaleString():"richText"===e.column.template?t=t.replace(/<script/g,"&lt;script").replace(/script>/g,"&gt;script"):"textarea"===e.column.editor.template?t=(t=t.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/'/g,"&#39;").replace(/"/g,"&quot;").replace(/\p{Extended_Pictographic}/gu,(e=>"&#"+e.codePointAt(0)+";"))).replaceAll("\t"," "):t.replace&&(t=(t=t.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/'/g,"&#39;").replace(/"/g,"&quot;").replace(/[\r\n]+/g," ").replace(/\p{Extended_Pictographic}/gu,(e=>"&#"+e.codePointAt(0)+";"))).replaceAll("\t"," "));break;case"float":case"int":case"number":t="int"===e.column.dataType?parseInt(t):parseFloat(t),isNaN(t)&&(t=0);break;case"bool":case"boolean":"true"!==t&&"1"!==t||(t=!0),"false"!==t&&"0"!==t||(t=!1);break;case"date":if(t instanceof Date)return t;"string"==typeof t&&(t=new Date(t));break;case"dateTime":t=new Smart.Utilities.DateTime(t)}return t};let l=null;switch(e.editor.template){case"dateRangeInput":try{l=n.getValue()}catch(t){l=e.value}if(e.editor.getValue){const t=e.editor.getValue(e,l);void 0!==t&&(l=t)}break;case"input":case"autoComplete":case"numberInput":case"slider":case"dateInput":case"timeInput":case"deteTimePicker":case"checkBox":try{l=o(n.getValue())}catch(t){l=e.value}if(e.editor.getValue){const t=e.editor.getValue(e,l);void 0!==t&&(l=t)}break;case"multiComboInput":case"attachment":case"image":l=n.getValue();break;default:l=o(n.getValue())}let a=!0,r=!1,d=!1;if(e.column.validator)a=e.column.validator.evaluate(l,e.row.data);else if("string"==typeof l){const t=e.editor.minLength||e.editor.min||0,i=e.editor.maxLength||e.editor.max||999999;(l.length<t||l>i)&&(a=!1),l.length<t&&(r=!0),l.length>i&&(d=!0),e.editor.required&&0===l.length&&(a=!1),e.editor.instance.element&&e.editor.instance.element.checkValidity&&(a=e.editor.instance.element.checkValidity())}if(a)return l;let s=null;const c=e.editor.instance.element;return c&&(s=c.validity,s&&(s.custom&&delete s.custom,r&&(s.custom={minLength:!0,value:e.editor.min}),d&&(s.custom={maxLength:!0,value:e.editor.max}),s.message=c.validationMessage)),{error:!0,validity:s,value:l}}_beginRowEdit(e,t){const i=this;if(e===i.editing.editRow)return!1;if(i.editing.editRow){if(!i.endEdit())return!1}const n=e.cells;i.editing.editRow=e,i.editing.commandColumn.visible&&(i.editing.isEditing=!1,i.refresh(),i.editing.isEditing=!0),e.isEditing=!0;let o=!1;for(let e=0;e<n.length;e++){const l=n[e],a=l.column;if(!a.allowEdit||!1===a._visible)continue;const r=i._beginCellEdit(l);if(r){if(!0!==i.editing.recordNavigation&&i.editing.enabled){if(Smart.Utilities.Core.isMobile)continue;let e=!0;switch(l.editor.template){case"textarea":case"slider":e=!1}e&&(t?l===t&&l.editor.instance.focus():r&&!o&&(o=!0,l.editor.instance.focus()))}i.editing.commandColumn.visible&&l.column.commandColumn&&l.render()}}return!0}_beginCellEdit(e,t){const i=this;if(e.isEditing&&"checkBox"!==e.column.template)return!1;if(i._isUpdating)return!1;if(i.onCellBeginEdit){if(!i.onCellBeginEdit(e.row.id,e.column.dataField,e.value,i))return!1}if(e.column.allowEdit&&"function"==typeof e.column.allowEdit){if(!e.column.allowEdit(e.row.id,e.column.dataField,e.value,e.row.data,i))return!1}let n=!1;if(e.column.autoGenerated&&e.column.rowHeaderColumn&&i.editing.allowRowHeaderEdit&&new Date-i._clickTime<i.behavior.doubleClickTimingDelay&&i._clickedCell===e.element&&(n=!0),(!e.column.allowEdit||e.column.autoGenerated||e.readonly)&&!n)return!1;if(i.editing.editCell&&!i.editing.editRow){i._fireEndEdit=!0;if(!1===i._endCellEdit())return!1}if(i._cellEditors||(i._cellEditors=[]),i.editing.editRow||(i.editing.editCell=e),i.editing.commandColumn.visible&&!i.editing.editRow&&(i.editing.isEditing=!1,i.refresh(),i.editing.isEditing=!0),!e.row.element)return!1;e.row.element.setAttribute("edit",""),i.editing.isEditing=!0,i._selection.selectionRect&&i._selection.selectionRect.classList.add("smart-visibility-hidden");const o=t=>{const n=t.element;i.editing.dialog.enabled?(i._settingsDialogRowId=e.row.id,i._openEditDialog(e,t)):(e.element||e.createElement(),e.element.setAttribute("editor","string"==typeof e.editor.template?e.editor.template:"template"),e.element.content.innerHTML="",e.element.content.appendChild(n),e.column.cellsWrap||e.element.content.classList.add("nowrap"),i.editing.editRow&&e.element.setAttribute("row-editor","")),t.attach(),e.editor.row=e.row,e.editor.column=e.column,e.editor.cell=e,e.editor.instance=t,e.isEditing=!0},l=i._cellsUpdatedValues?i._cellsUpdatedValues[e.row.id+"_"+e.column.dataField]:void 0;let a=void 0!==l?l:e.value;if(void 0===a){a="";const t=e.column;"number"===t.dataType||"int"===t.dataType||"float"===t.dataType?a=0:"date"===t.dataType&&(a=new Date,a.setHours(0,0,0))}switch(e.editor||(e.editor="input"),"string"==typeof e.editor&&(e.canNotify=!1,e.editor={template:e.editor,autoFocus:!0},e.canNotify=!0),e.editor.template){default:case"custom":{const t=i._getCustomCellEditor(e);o(t),t.setValue(a);break}case"attachment":{const t=i._getAttachmentCellEditor(e);o(t),t.setValue(a);break}case"image":{const t=i._getImageCellEditor(e);o(t),t.setValue(a);break}case"rating":{const t=i._getRatingCellEditor(e);o(t);let n=parseInt(a);isNaN(n)&&(n=0),t.setValue(n);break}case"checkBox":{const n=i._getCheckBoxCellEditor(e);o(n);const l=!0===a||1===a;if("checkBox"===e.template&&t){(i.enableShadowDOM?i.shadowRoot:i.getRootNode()).elementsFromPoint(t.clientX,t.clientY)[0].classList.contains("smart-input")?n.setValue(!l):n.setValue(l)}else n.setValue(l);break}case"autoComplete":{const t=i._getAutoCompleteCellEditor(e);o(t),t.setValue(a),e.editor.autoOpen&&!i.editing.editRow&&t.element.open();break}case"list":case"dropDownList":{e.editor.autoOpen=!0,e.editor.readonly=!0,e.editor.dropDownButtonPosition="right";const t=i._getAutoCompleteCellEditor(e);o(t),t.setValue(a),e.editor.autoOpen&&!i.editing.editRow&&t.element.open();break}case"comboBox":{e.editor.readonly=!1,e.editor.dropDownButtonPosition="right";const t=i._getAutoCompleteCellEditor(e);o(t),t.setValue(a),e.editor.autoOpen&&!i.editing.editRow&&t.element.open();break}case"password":{const t=i._getPasswordCellEditor(e);o(t),t.setValue(a);break}case"phone":{const t=i._getPhoneCellEditor(e);o(t),t.setValue(a);break}case"maskedTextBox":{const t=i._getMaskCellEditor(e);o(t),t.setValue(a);break}case"multiInput":{const t=i._getAutoCompleteCellEditor(e,"smart-multi-input");o(t),t.setValue(a),e.editor.autoOpen&&!i.editing.editRow&&t.element.open();break}case"checkInput":{const t=i._getAutoCompleteCellEditor(e,"smart-check-input");o(t),t.setValue(a),e.editor.autoOpen&&!i.editing.editRow&&t.element.open();break}case"tags":case"multiComboInput":{e.editor.readonly=!0,e.editor.autoOpen=!0;const t=i._getMultiComboInputCellEditor(e);o(t),t.setValue(a),e.editor.autoOpen&&!i.editing.editRow&&t.element.open();break}case"timeInput":{const t=i._getTimeInputCellEditor(e);o(t),t.setValue(a),e.editor.autoOpen&&!i.editing.editRow&&t.element.open();break}case"dateInput":{const t=i._getDateInputCellEditor(e);o(t),t.setValue(a);break}case"dateRangeInput":{const t=i._getDateRangeInputCellEditor(e);o(t),t.setValue(a),e.editor.autoOpen&&!i.editing.editRow&&t.element.open();break}case"dateTimePicker":{const t=i._getDateTimePickerCellEditor(e);o(t),t.setValue(a);break}case"slider":{const t=i._getSliderCellEditor(e);o(t),t.setValue(a);break}case"colorInput":{const t=i._getColorInputCellEditor(e);o(t),t.setValue(a);break}case"textarea":case"textArea":{const t=i._getTextAreaCellEditor(e);o(t),e.formula?t.setValue(e.formula):t.setValue(a);break}case"numberInput":case"text":case"input":{const t="numberInput"===e.editor.template?i._getNumberInputCellEditor(e):i._getInputCellEditor(e);o(t),e.formula?t.setValue(e.formula):t.setValue(a);break}}if(!e.editor.isInitialized&&(e.editor.isInitialized=!0,e.editor.onInit)){const t=e.editor.onInit(e.row.index,e.column.dataField,e.editor.instance.element,e.row.data);if(t&&t instanceof Promise)t.then((t=>{const i="custom"===e.editor.template?e.editor.instance.element.firstElementChild:e.editor.instance.element;for(let e in t)i[e]=t[e]}));else if(t){const i=t,n="custom"===e.editor.template?e.editor.instance.element.firstElementChild:e.editor.instance.element;for(let e in i)n[e]=i[e]}}if(e.editor.onRender){const t=e.editor.onRender(e.row.index,e.column.dataField,e.editor.instance.element,e.row.data);if(t&&t instanceof Promise)t.then((t=>{const i="custom"===e.editor.template?e.editor.instance.element.firstElementChild:e.editor.instance.element;for(let e in t)i[e]=t[e]}));else if(t){const i=t,n="custom"===e.editor.template?e.editor.instance.element.firstElementChild:e.editor.instance.element;for(let e in i)n[e]=i[e]}}return i.editing.editCell&&e.editor.instance.focus(),"checkBox"===e.editor.template&&(i._fireEndEdit=!0,i._endCellEdit()),!0}_onColumnDoubleClick(e){this._beginColumnEdit(e)}_beginColumnEdit(e){const t=this;if(t.editing.enabled&&t.editing.allowColumnHeaderEdit&&e.allowHeaderEdit){t.editing.isEditing&&t.endEdit(),t.editing.editColumn=e,t._cellEditors||(t._cellEditors=[]);const i=t._getInputCellEditor({column:e,row:t.rows[0],editor:{template:"input"}});i.element.value=e.label,i.focus(),e.headerEditor=i,e.element.setAttribute("edit",""),e.element.label.appendChild(i.element),i.attach(),t.editing.isEditing=!0;t.$.fireEvent("beginEdit",{id:null,dataField:e.dataField,row:null,column:e,cell:null,data:null,value:null}).defaultPrevented&&t.cancelEdit()}}_endColumnEdit(e){const t=this;if(!1===t.editing.isEditing||t.editing.isEditing&&null===t.editing.editColumn)return!1;const i=t.editing.editColumn;return i.canNotify=!1,i.headerEditor.detach(),i.headerEditor.element.parentNode.removeChild(i.headerEditor.element),!0!==e&&(i.label=i.headerEditor.getValue()),i.headerEditor=null,t.editing.isEditing=!1,i.element.removeAttribute("edit"),i.element.scrollLeft=0,t.editing.editColumn=null,i.canNotify=!0,i.refresh(),t._recycle(),!0}_cancelColumnEdit(){this._endColumnEdit(!0)}_onCellClick(e,t){const i=this;if(e.row.addNewRow)e.row.inline?i._addNewGridRow():"far"===e.row.freeze?i._insertNewRowAfter():i._insertNewRowBefore();else if(!e.row.filterRow&&i.editing.enabled)if(i.editing.editColumn)i.endEdit();else{if(delete i._beginEditKey,i.editing.commandColumn.visible)if(e.column.commandColumn){const n=(i.enableShadowDOM?i.shadowRoot:i.getRootNode()).elementsFromPoint(t.clientX,t.clientY);let o=null;for(let e=0;e<n.length;e++)if(n[e].classList.contains("smart-grid-command-item")){o=n[e];break}if(o||(o=e.element.querySelector(".smart-grid-command-item")),o&&!o.classList.contains("smart-hidden")){const n=o.getAttribute("command");return void i._applyCommand(n,[e.row,t])}}else if(i.editing.commandColumn.inline){const e=(i.enableShadowDOM?i.shadowRoot:i.getRootNode()).elementsFromPoint(t.pageX,t.pageY);for(let t=0;t<e.length;t++)if(e[t].classList.contains("smart-grid-command-item"))return}if("none"===i.editing.action&&i.editing.isEditing){let t=!1;i.editing.editCell&&i.editing.editCell.row!==e.row&&(t=!0),i.editing.editRow&&i.editing.editRow!==e.row&&(t=!0),i.editing.editColumn&&(t=!0),t&&i.endEdit()}if(e.column.autoGenerated){if(i.editing.allowRowHeaderEdit&&e.column.rowHeaderColumn){if(i.editing.isEditing&&i.endEdit(),void 0!==e.row.label)return;i._beginCellEdit(e,t),i.editing.isEditing&&i.$.fireEvent("beginEdit",{id:e.row.id,dataField:e.column.dataField,row:e.row,column:e.column,cell:e,data:e.row.data,value:e.value})}}else if("click"===i.editing.action&&(!i.selection.enabled||e.selected||"extended"!==i.selection.mode))if("cell"===i.editing.mode){const n=e.parent();if(void 0!==e.row.label)return;if("rating"===e.column.template)return void(i._handleRatingClick&&i._ratingElement&&i._handleRatingClick(i._ratingElement));!i._autoHeight&&i.ensureVisible(e.row.id,e.column.dataField),setTimeout((function(){if(n)i._beginCellEdit(n,t),i.$.fireEvent("beginEdit",{id:n.row.id,dataField:n.column.dataField,row:n.row,column:n.column,cell:n,data:n.row.data,value:n.value});else{i._beginCellEdit(e,t);i.$.fireEvent("beginEdit",{id:e.row.id,dataField:e.column.dataField,row:e.row,column:e.column,cell:e,data:e.row.data,value:e.value}).defaultPrevented&&i.cancelEdit()}}),25)}else if("row"===i.editing.mode){if(void 0!==e.row.label)return;i._beginRowEdit(e.row,e,t);i.$.fireEvent("beginEdit",{id:e.row.id,dataField:e.column.dataField,row:e.row,column:e.column,cell:e,data:e.row.data,value:e.value}).defaultPrevented&&i.cancelEdit()}}}_onCellDoubleClick(e,t){const i=this;i.editing.enabled&&("doubleClick"!==i.editing.action||i.editing.isEditing||e.column.autoGenerated||("cell"===i.editing.mode?i._beginCellEdit(e,t):"row"===i.editing.mode&&i._beginRowEdit(e.row,e,t)))}_onRowClick(){}_onRowDoubleClick(){}beginEdit(e,t){const i=this,n=i.rowById[e];n&&i._beginEdit(n,t)}cancelEdit(){const e=this;if(e.editing.isEditing){if(e._errorOverlay){if(e._errorOverlay.remove(),e._errorMessage.remove(),e.editing.editCell&&(e.editing.editCell.error=""),e.editing.editRow){const t=e.editing.editRow.cells;for(let e=0;e<t.length;e++){t[e].error=""}e.editing.editRow.element.removeAttribute("error"),e.editing.editRow.error=null}e._isUpdating=!1}if(e.editing.editRow){const t=e.editing.editRow.cells;for(let e=0;e<t.length;e++){const i=t[e],n=i.element;0===e&&i.row.element.removeAttribute("edit"),n&&(n.removeAttribute("editor"),n.removeAttribute("error"),n.content.innerHTML=""),i.isEditing=!1}e.editing.editRow=null}else e.editing.editCell?(e.editing.editCell.row.element.removeAttribute("edit"),e.editing.editCell.row.element.removeAttribute("error"),e.editing.editCell.element.removeAttribute("editor"),e.editing.editCell.element.removeAttribute("error"),e.editing.editCell.element.content.innerHTML="",e.editing.editCell.isEditing=!1,e.editing.editCell=null):e.editing.editColumn&&e._cancelColumnEdit();e.editing.dialog.visible&&e.editing.dialog.enabled&&e._dialogEdit.close(),e.editing.isEditing=!1,e._recycle(!1),e.editing.commandColumn.visible&&e.refresh(),e.$.fireEvent("cancelEdit"),e.focus()}}deleteColumn(e){const t=this,i=this.columns.findIndex((t=>t.dataField===e));i>=0&&t.columns.splice(i,1)}removeRow(e,t){return this.deleteRow(e,t)}deleteRow(e,t){const i=this;if(e&&Array.isArray(e)){if(i.onRowRemove){if(!1===i.onRowRemove(e,i))return}i.beginUpdate();const n=i.dataSource.canNotify,o=i.rows.canNotify;i.rows.canNotify=!1,i.dataSource.canNotify=!1;const l=i.onRowRemoved;i.onRowRemoved=null;let a=[];for(let n in e){const o=i.rowById[e[n]];let l=o&&o.data&&o.data.$?o.data.$.index:o.index;a.push(l),i.deleteRow(e[n],t),i.dataSource.removeAt(l)}return i.rows.canNotify=o,i.dataSource.canNotify=n,i.onRowRemoved=l,i.endUpdate(),i._refreshSummary(),void(l&&l(e,a,i))}const n=i.rowById[e];if(!n)return!1;const o=function(e){if(!0===i.editing.batch||i.editing.batch&&i.editing.batch.indexOf("delete")>=0)i._batchDeleteRow(e);else{if(i.dataSource&&i.dataSource.virtualDataSource)return i._editInfo={row:e.data},void i._virtualDataRequest("remove",(function(n){if(n){const n=i.rows.indexOf(e);i.rows.splice(n,1),delete i.rowById[e.id],t&&t(e)}}));const n=i.rows.indexOf(e);i._removeAt(n)}t&&t(e)};return i.editing.deleteDialog.enabled?i._openDeleteRowDialog(n,o):o(n),!0}addRow(e,t,i){const n=this;e||(e={});for(let t=0;t<n.columns.length;t++){const i=n.columns[t];void 0!==i.defaultValue&&void 0===e[i.dataField]&&(e[i.dataField]=i.defaultValue)}if(void 0===t&&(t=!0),n.dataSource&&n.dataSource.virtualDataSource)n._editInfo={row:e},n._virtualDataRequest("add",(o=>{o&&(n._add(e,t?n.rows.length:0),i&&i(t?n.rows[n.rows.length-1]:n.rows[0]))}));else{if(n.editing.batch)return void(t?n._insertNewRowAfter(i):n._insertNewRowBefore(i));"number"==typeof t?n._add(e,t,i):n._add(e,t?n.rows.length:0,i)}}insertRow(e,t,i){this.addRow(e,t,i)}flashCell(e,t){const i=this;i._flashTimer&&clearTimeout(i._flastTimer),i.highlightedCells&&i.highlightedCells[e]&&(i.highlightedCells[e][t]="off_smart-flash-cell"),i.highlightCell(e,t,"smart-flash-cell"),i._flashTimer=setTimeout((()=>{i.highlightedCells&&i.highlightedCells[e]&&(i.highlightedCells[e][t]="off_smart-flash-cell",delete i.highlightedCells[e][t])}),2e3)}highlightCell(e,t,i){const n=this,o=n.rowById[e],l=n.columnByDataField[t];o&&l&&(n.highlightedCells||(n.highlightedCells=[]),n.highlightedCells[e]||(n.highlightedCells[e]=[]),void 0!==n.highlightedCells[e][t]?i?n.highlightedCells[e][t].startsWith("off")?n.highlightedCells[e][t]=i||"":n.highlightedCells[e][t]="off_"+i:delete n.highlightedCells[e][t]:n.highlightedCells[e][t]=i||"",n._recycle(!1))}highlightRow(e,t){const i=this;i.rowById[e]&&(i.highlightedRows||(i.highlightedRows=[]),void 0!==i.highlightedRows[e]?t?i.highlightedRows[e].startsWith("off")?i.highlightedRows[e]=t||"":i.highlightedRows[e]="off_"+t:delete i.highlightedRows[e]:i.highlightedRows[e]=t||"",i._recycle(!1))}highlightColumn(e,t){const i=this.columnByDataField[e];i.highlight=!i.highlight,i._highlightCSS=t,this._recycle(!1)}setRowProperty(e,t,i){const n=this.rowById[e];n&&(n[t]=i)}getRowProperty(e,t){const i=this.rowById[e];if(i)return i[t]}getColumn(e){if(!this.columnByDataField)return null;const t=this.columnByDataField[e];return t||null}getColumnProperty(e,t){if(!this.columnByDataField)return null;const i=this.columnByDataField[e];return i?i[t]:void 0}setColumnProperty(e,t,i){const n=this.columnByDataField[e];n&&(n[t]=i)}getCellValue(e,t){const i=this.rowById[e],n=this.columnByDataField[t];if(!i||!n)return;return i.getCell(t).value}setCellValue(e,t,n,o){const l=this,a=l.rowById[e],r=l.columnByDataField[t];if(!a||!r)return!1;if(l.formulas&&n&&"string"==typeof n){const e=a.getCell(t);if(e){if(e.formula!==n){const t=e.canNotify;e.canNotify=!1,n.startsWith("=")?e.formula=l._unescapeString(n):e.formula=null,e.canNotify=t}if(n.startsWith("=")&&e.formula){const t=l._formulaParser;if(t){let i=t.parse(e.formula.slice(1));n=isNaN(i)?"#VALUE!"===n?0:"#ERROR!"===n?"#ERROR!":i:i}}}}let d=[];if(r.validationRules&&r.validationRules.length>0&&(d=((e,t)=>{let n=[];for(let o of e){switch(o.type){case"min":n.min=i.min(t,o.value);break;case"max":n.max=i.max(t,o.value);break;case"minLength":n.minLength=i.minLength(t,o.value);break;case"maxLength":n.maxLength=i.maxLength(t,o.value);break;case"minDate":n.minDate=i.minDate(t,o.value);break;case"maxDate":n.maxDate=i.maxDate(t,o.value);break;case"required":n.required=i.required(t);break;case"requiredTrue":n.requiredTrue=i.requiredTrue(t);break;case"pattern":n.pattern=i.pattern(t,o.value);break;case"email":n.email=i.email(t);break;case"null":n.null=i.null(t)}null===n[o.type]&&delete n[o.type]}return n})(r.validationRules,n),Object.keys(d).length>0))return!1;const s=()=>{if(!0===l.editing.batch||l.editing.batch&&l.editing.batch.indexOf("update")>=0){const e=a.getCell(t);return l._batchUpdateCell(e.row,e.column,n,e.value),o&&o(a),void l._recycle()}l.beginUpdate();const e=a.getCell(t);l._setCellUndoRedo(e,e.value,n),e.value=n,l.endUpdate(),o&&o(a)};if(l.dataSource&&l.dataSource.virtualDataSource){l.dataSource.id?a[l.dataSource.id]=e:a.id||(a.id=e);const i={};for(let e=0;e<l.columns.length;e++){const o=l.columns[e],r=a.getCell(o.dataField);i[o.dataField]=r.value,o.dataField===t&&(i[o.dataField]=n)}l._editInfo={row:i},l._virtualDataRequest("update",(function(e){e&&s(),l.appearance.displayLoadingIndicator=!1,l._setLoadingIndicatorVisibility()}))}else s()}setRowData(e,t){this.updateRow(e,t,null)}getRowData(e){const t=this.rowById[e];if(!t)return null;const i=JSON.parse(JSON.stringify((e=>{const t={};for(let i in e)"leaf"!==i&&"data"!==i&&"$"!==i&&"children"!==i&&"parent"!==i&&"history"!==i&&"comments"!==i&&"style"!==i&&(t[i]=e[i]);return t})(t.data)));return delete i.$,i}getRow(e){const t=this.rowById[e];return t||null}forEachRow(e){const t=this;if(e)for(let i=0;i<t.rows.length;i++)e(t.rows[i])}forEachRowAfterFilterAndSort(e){const t=this;if(e)for(let i=0;i<t._recyclingRows.length;i++)e(t._recyclingRows[i])}getRowById(e){return this.rowById[e]}getRowByIndex(e){const t=this.rows[e];return t||null}getRowId(e){const t=this.rows[e];if(!t)return null;return t.id}validateRow(e,t){const n=this;if(!n.rowById[e])return!1;const o=(e,t)=>{let n={};for(let o of e)switch(o.type){case"min":n.min=i.min(t,o.value);break;case"max":n.max=i.max(t,o.value);break;case"minLength":n.minLength=i.minLength(t,o.value);break;case"maxLength":n.maxLength=i.maxLength(t,o.value);break;case"minDate":n.minDate=i.minDate(t,o.value);break;case"maxDate":n.maxDate=i.maxDate(t,o.value);break;case"required":n.required=i.required(t);break;case"requiredTrue":n.requiredTrue=i.requiredTrue(t);break;case"pattern":n.pattern=i.pattern(t,o.value);break;case"email":n.email=i.email(t);break;case"null":n.null=i.null(t)}let o={};return Object.keys(n).forEach((e=>{const t=n[e];t&&(o[e]=t)})),o},l=[];for(let e=0;e<n.columns.length;e++){const i=n.columns[e];let a=[];if(void 0!==t[i.dataField])if(i.validationRules&&i.validationRules.length>0){let e=t[i.dataField];e&&e.error&&(e=e.value),a=o(i.validationRules,e),Object.keys(a).length>0&&(l[i.dataField]=a)}else{let e=null,n=t[i.dataField];n&&n.error&&(e=n.validity,n=n.value);for(let t in e)e[t]&&"valid"!==t&&"message"!==t&&(a[t]=!0),("custom"===t&&e[t].minLength||"custom"===t&&e[t].maxLength)&&(a[t]=!0);Object.keys(a).length>0&&(l[i.dataField]=a)}}return l}_getGroupAncestorSignature(e){const t=[];let i=e.parent;for(;i;)t.push({groupDataField:i.groupDataField,label:i.label}),i=i.parent;return JSON.stringify(t)}_getExpandedGroups(e){const t=this,i=[];if(!e)return[];return function e(n){n.forEach((n=>{n.expanded&&i.push({groupDataField:n.groupDataField,label:n.label,ancestorSignature:t._getGroupAncestorSignature(n)}),n.children&&n.children.length>0&&!1===n.children[0].leaf&&e(n.children)}))}(e),i}_updateRow(e,t,i){const n=this,o=n.rowById?n.rowById[e]:n.dataSource.dataItemById[e];if(!o)return;if(void 0===t)return;let l=[];n.dataSource&&n.dataSource.groupBy&&n.dataSource.groupBy.toArray&&(l=n.dataSource.groupBy.toArray().slice(0));const a=n.dataSource.boundSource.canNotify;n.dataSource.boundSource.canNotify=!1;const r=e=>{if(o.data[e]=t[e],n.dataSource.id&&o&&o.data&&o.data.$&&(o.data.$.id=t[n.dataSource.id]),o&&o.data.$&&void 0!==o.data.$.index){const i=o.data.$.index,a=n.dataSource.dataSource,r=()=>{const i=t[e];if(null==i){const t=n.columnByDataField[e];return t?"number"===t.dataType?0:"boolean"!==t.dataType&&("date"===t.dataType?new Date:""):""}return i};if(a&&a[i]&&(a[i][e]=r()),n.dataSource[i]){if(l.length>0&&!n._dirtyHierarchy){if(n.dataSource[i][e]!==r()&&l.indexOf(e)>=0){const e=n._getExpandedGroups(n.dataSource.boundHierarchy);n._dirtyHierarchy=e}}n.dataSource[i][e]=r()}}};let d=[];for(let e=0;e<n.columns.length;e++){const i=n.columns[e];void 0!==t&&(void 0!==t[i.dataField]&&(d[i.dataField]=!0,r(i.dataField)))}if(i){const e=n.dataSource.dataFields;if(e)for(let t=0;t<e.length;t++)d[e[t].name]||(e[t].map?r(e[t].map):r(e[t].name))}n.dataSource.boundSource.canNotify=a,n.__updating||n.dataSource.refreshHierarchy()}updateRow(e,t,i){const n=this,o=n.rowById[e];if(!o)return!1;const l=n.validateRow(e,t);if(Object.keys(l).length>0)return!1;const a=()=>{if(!0===n.editing.batch||n.editing.batch&&n.editing.batch.indexOf("update")>=0){for(let e in t){if("$"===e)continue;const i=o.getCell(e);i?o.data[e]&&(o.data[e]=t[e]):(n._batchUpdateCell(i.row,i.column,t[e],i.value),n._recycle())}i&&i(o)}else{n.beginUpdate();for(let e in t){if("$"===e)continue;const i=o.getCell(e);i?i.value=t[e]:o.data[e]&&(o.data[e]=t[e])}n.endUpdate(),i&&i(o)}};n.dataSource&&n.dataSource.virtualDataSource?(n.dataSource.id?t[n.dataSource.id]=e:t.id||(t.id=e),n._editInfo={row:t},n._virtualDataRequest("update",(function(e){e&&a(),n.appearance.displayLoadingIndicator=!1,n._setLoadingIndicatorVisibility()}))):n.onRowUpdate?n.onRowUpdate([e],[o],[o.data],[t],(e=>{e&&a()}),n):a()}addUnboundRow(e,t){const i=this;void 0===e&&(e=1),void 0===t&&(t="far"),i._nearRowsAdded||(i._nearRowsAdded=[],i._farRowsAdded=[]),i._unboundRows||(i._unboundRows=[]),i.beginUpdate();for(let n=0;n<e;n++){const e=Smart.Utilities.Core.createGUID().replace(/-/gi,""),n=new Smart.Grid.Row({index:-1,unbound:!0,id:e,grid:i});i.rowById[n.id]=n,"far"===t?i._farRowsAdded.push(n):i._nearRowsAdded.push(n),i._unboundRows.push(n)}i.endUpdate()}addNewRow(e){const t=this;"near"===e?t._insertNewRowBefore():t._insertNewRowAfter()}_updateRowHistory(e,t,i){const n=this;if(!n._currentUser||n._currentUser&&(!n._currentUser.info||"guest"===n._currentUser.info))return;const o="taskChecklist",l="taskColor",a="taskDueDate",r="taskPriority",d="taskProgress",s="taskStartDate",c="taskStatus",u="taskTags",m="taskText",g="taskDescription",p="taskUserId",f=()=>({user:n._currentUser.info.id,date:e.updatedDate}),h=[];if(i[p]!==t[p]){const n=f();n.action="user";let o=!0;t[p]||i[p]||(o=!1),o&&(n.details={oldValue:t[p],value:i[p]},e.addHistory(n)),h.push(p)}if(""+i[a]!=""+t[a]){const n=f();n.action="deadline",n.details={oldValue:t[a]?new Date(t[a]).toLocaleDateString():"",value:new Date(i[a]).toLocaleDateString()},e.addHistory(n),h.push(a)}if(""+i[s]!=""+t[s]){const n=f();n.action="deadline",n.details={oldValue:t[s]?new Date(t[s]).toLocaleDateString():"",value:new Date(i[s]).toLocaleDateString()},e.addHistory(n),h.push(s)}if(i[l]!==t[l]){const n=f();n.action="color",n.details={oldValue:t[l],value:i[l]},e.addHistory(n),h.push(c)}if(i[c]!==t[c]){const n=f();n.action="status",n.details={oldValue:t[c],value:i[c]},e.addHistory(n),h.push(c)}if(JSON.stringify(i[o])!==JSON.stringify(t[o])){const n=f();n.action="subtasks";let l=t[o],a=i[o];const r=e=>{let t=[];if(!e)return"";for(let i=0;i<e.length;i++)t.push(e[i].text+": "+(e[i].completed?"Y":"N"));return t.toString()};l=r(l),a=r(a),n.details={oldValue:l,value:a},e.addHistory(n),h.push(o)}else h.push(o);if(void 0!==i[d]&&parseFloat(i[d])!==parseFloat(t[d])){let n=!0;if(null===t[d]&&0===parseFloat(i[d])&&(n=!1),null===(null===t[d]&&i[d])&&(n=!1),n){const n=f();n.action="progress",n.details={oldValue:t[d]?100*t[d]+"%":"0%",value:100*i[d]+"%"},e.addHistory(n)}h.push(d)}if(i[g]!==t[g]){const n=f();n.action="description",n.details={oldValue:t[g],value:i[g]},e.addHistory(n),h.push(g)}if(i[r]!==t[r]){const n=f();n.action="priority",n.details={oldValue:t[r],value:i[r]},e.addHistory(n),h.push(r)}if(i[u]!==t[u]){const n=f();n.action="tags",n.details={oldValue:t[u],value:i[u]},e.addHistory(n),h.push(u)}if(i[m]!==t[m]){const n=f();n.action="text",n.details={oldValue:t[m],value:i[m]},e.addHistory(n),h.push(m)}for(let o=0;o<n.columns.length;o++){const l=n.columns[o].dataField;let a=t[l],r=i[l];if("image"===n.columns[o].template&&(a&&"string"==typeof a&&(a.indexOf("[{")>=0?(a=JSON.parse(a),a=a.map((e=>e.label)),a=a.toString()):a=""),null==a&&(a=""),r&&"string"==typeof r&&(r.indexOf("[{")>=0?(r=JSON.parse(r),r=r.map((e=>e.label)),r=r.toString()):r=""),null==r&&(r="")),-1===h.indexOf(l)&&a!==r){const t=f();"date"===n.columns[o].dataType?(r&&"string"==typeof r&&(r=new Date(r)),a&&"string"==typeof a&&(a=new Date(a))):"string"==typeof r&&(r=r.replaceAll("\\"," ").replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/'/g,"&#39;").replace(/"/g,"&quot;").replace(/[\r\n]+/g," ").replace(/\p{Emoji}/gu,(e=>"&#"+e.codePointAt(0)+";"))),t.action=l,t.details={oldValue:a,value:r},e.addHistory(t)}}n.onRowHistory&&(n._tempRowHistory||(n._tempRowHistory=[]),n._tempRowHistory[e.index]={index:e.index,row:e,history:e.history},n._tempRowHistoryTimer&&clearTimeout(n._tempRowHistoryTimer),n._tempRowHistoryTimer=setTimeout((()=>{const e=[],t=[],i=[];for(let o in n._tempRowHistory)t.push(o),e.push(n._tempRowHistory[o].row),i.push(n._tempRowHistory[o].history);n.onRowHistory(t,e,i,n),delete n._tempRowHistory}),50))}_stringifyRow(e){const t=this;let i={};for(let n=0;n<t.columns.length;n++){const o=t.columns[n];i[o.dataField]=e.data[o.dataField]}return i=JSON.parse(JSON.stringify(i)),i}endEdit(){const e=this;let t=!1,i=null;e.editing.dialog.enabled&&e.editing.dialog.visible&&e._dialogEdit&&e._dialogEdit.close();let n=null,o=null,l=null;e._fireEndEdit=!0;let a=null,r=null,d=null;if(e.editing.editRow){o=e.editing.editRow,i=e.editing.editRow.id;let n=null;if(e.storeHistory&&(n=e._stringifyRow(o)),t=e._endRowEdit(),a=n,t&&!e.onRowUpdate&&(o.updatedDate=new Date,o.updatedBy=e.currentUser,e.storeHistory)){const t=e._stringifyRow(o);e._updateRowHistory(o,n,t)}}else if(e.editing.editCell){o=e.editing.editCell.row,l=e.editing.editCell.column,n=e.editing.editCell,i=e.editing.editCell.row.id,d=!0;let s=null;e.storeHistory&&(s=e._stringifyRow(o));const c=void 0!==n.value?n.value:"";r=c,a=s;let u=!1;const m=t=>{if(t!==c){if(o.updatedDate=new Date,o.updatedBy=e.currentUser,e.storeHistory){const i=e._stringifyRow(o);i[n.column.dataField]=t,e._updateRowHistory(o,s,i)}u=!0}};if(e.onCellUpdate&&e.onRowHistory){const t=e.onRowHistory;e.onRowHistory=null;m(e._getEditorValue(n)),setTimeout((()=>{e.onRowHistory=t}),100)}e._getEditorValue(n)!==c&&(o.updatedDate=new Date,o.updatedBy=e.currentUser),t=e._endCellEdit(),t&&!u&&n&&m(n.value)}else e.editing.editColumn&&(i=null,l=e.editing.editColumn,t=e._endColumnEdit());if(e._saveUnboundRows(i),e._selection.selectionRect&&e._selection.selectionRect.classList.remove("smart-visibility-hidden"),e.$.scrollView.scrollTop=0,e._fireEndEdit){e.$.fireEvent("endEdit",{id:o?o.id:null,dataField:l?l.dataField:null,row:o,column:l,cell:n,data:o?o.data:null,value:n?n.value:l?l.label:null}).defaultPrevented&&(d?e.setCellValue(o.id,l.dataField,r):e.setRowData(o.id,a))}return e._conditionalColors&&e._conditionalColors.update&&e._conditionalColors.update(o),e.summaryRow.visible&&t&&(e.editing.isEditing=!1,e._calculateSummary(),e._recycle(!1)),e._refreshDataFilters(),e._renderConditionalFormatting(),t}getEditCells(){const e=this;return e.editing.editRow?e.editing.editRow.cells:e.editing.editCell?[e.editing.editCell]:[]}getBatchEditChanges(){const e=this,t=[],i=[],n=[];for(let i in e._cellsUpdatedValues){const n=e._cellsUpdatedValues[i],o=i.substring(0,i.indexOf("_")),l=i.substring(i.indexOf("_")+1),a=e.rowById[o].getCell(l);t.push({id:o,dataField:l,oldValue:a.value,newValue:n})}if(e._rowsDeleted&&e._rowsDeleted.length>0)for(let t=0;t<e._rowsDeleted.length;t++){const n=e._rowsDeleted[t],o=e.rowById[n];i.push({id:o.id,data:o.data})}if(e._rowsAdded&&e._rowsAdded.length>0)for(let t=0;t<e._rowsAdded.length;t++){const i=e._rowsAdded[t],o=e.rowById[i];n.push({id:o.id,data:o.data})}return{updated:t,deleted:i,added:n}}saveBatchEdit(){this._saveBatchEdit()}revertBatchEdit(){this._clearBatchEdit(!0)}});const e=/^(?=.{1,254}$)(?=.{1,64}@)[-!#$%&'*+/0-9=?A-Z^_`a-z{|}~]+(\.[-!#$%&'*+/0-9=?A-Z^_`a-z{|}~]+)*@[A-Za-z0-9]([A-Za-z0-9-]{0,61}[A-Za-z0-9])?(\.[A-Za-z0-9]([A-Za-z0-9-]{0,61}[A-Za-z0-9])?)*$/;function t(e){return null==e||0===e.length}class i{static null(e){return null===e}static email(i){return t(i)||e.test(i)?null:{email:!0}}static min(e,i){return(e=>{if(t(e)||t(i))return null;const n=parseFloat(e);return!isNaN(n)&&n<i?{min:{min:i,actual:n}}:null})(e)}static max(e,i){return(e=>{if(t(e)||t(i))return null;const n=parseFloat(e);return!isNaN(n)&&n>i?{max:{max:i,actual:n}}:null})(e)}static minDate(e,i){return(e=>{if(t(e)||t(i))return null;let n=e;return e&&e instanceof Smart.Utilities.DateTime&&(n=e.toDate()),!isNaN(n)&&n<i?{min:{min:i,actual:n}}:null})(e)}static maxDate(e,i){return(e=>{if(t(e)||t(i))return null;let n=e;return e&&e instanceof Smart.Utilities.DateTime&&(n=e.toDate()),!isNaN(n)&&n>i?{max:{max:i,actual:n}}:null})(e)}static required(e){return t(e)?{required:!0}:null}static requiredTrue(e){return!0===e?null:{required:!0}}static minLength(e,i){return(e=>{if(t(e)&&0===i)return null;const n=e?e.length:0;return n<i?{minlength:{requiredLength:i,actualLength:n}}:null})(e)}static maxLength(e,t){return(e=>{const i=e?e.length:0;return i>t?{maxlength:{requiredLength:t,actualLength:i}}:null})(e)}static url(e){return/^(ftp|http|https):\/\/[^ "]+$/.test(e)?null:{pattern:{requiredPattern:'^(ftp|http|https)://[^ "]+$',actualValue:e}}}static pattern(e,n){if(!n)return i.null;let o,l;return"string"==typeof n?(l="","^"!==n.charAt(0)&&(l+="^"),l+=n,"$"!==n.charAt(n.length-1)&&(l+="$"),o=new RegExp(l)):(l=n.toString(),o=n),(e=>t(e)||o.test(e)?null:{pattern:{requiredPattern:l,actualValue:e}})(e)}}window.Smart.Validator=i})();
1456
+ (()=>{Smart.Utilities.Assign("Grid.Edit",class{_renderCommandBar(){const e=this,t=e.editing.commandBar.dataSource,i="icon"!==e.editing.commandBar.displayMode,n="label"!==e.editing.commandBar.displayMode,o=o=>{for(let l in t){const a=t[l],r=document.createElement("div");r.classList.add("smart-grid-command-item"),r.label="{{messages}}"===a.label?e.localize(l):a.label;const d=r.label;let s="";n&&i?(s+='<span class="smart-grid-icon '+a.icon+'"></span>',s+='<span class="smart-grid-label">'+d+"</span>"):n&&!i?s+='<span title="'+d+'" class="smart-grid-icon '+a.icon+'"></span>':i&&!n&&(s+='<span class="smart-grid-label">'+d+"</span>"),r.innerHTML=s,a.visible||r.classList.add("smart-hidden"),r.command=a.command,r.onclick=function(){const t=r.command;e._applyCommand(t,[])},o.appendChild(r)}};e.editing.enabled&&e.editing.commandBar.visible&&(e.$.headerCommandBar.innerHTML="",e.$.footerCommandBar.innerHTML="","far"!==e.editing.commandBar.position&&o(e.$.headerCommandBar),"near"!==e.editing.commandBar.position&&o(e.$.footerCommandBar))}commandKeyEditCommand(){const e=this;if(e._selection&&e._selection.focusedCell&&void 0!==e._selection.focusedCell.id){const t=e.rowById[e._selection.focusedCell.id];e.beginEdit(t.id)}}commandKeyCancelCommand(){this.cancelEdit()}commandKeyUpdateCommand(){this.endEdit()}commandColumnMenuCommand(){this._openColumnChooserMenu(this._commandColumn)}commandColumnEditCommand(e){this.beginEdit(e.id)}commandColumnUpdateCommand(){this.endEdit()}commandColumnRowMenuCommand(){}commandColumnCancelCommand(e){const t=this;if(t.editing.batch){const i=t._rowsDeleted?t._rowsDeleted.indexOf(e):-1;i>=0&&t._rowsDeleted.splice(i,1);for(let i=0;i<t.columns.length;i++){const n=t.columns[i].dataField;t._cellsUpdatedValues&&t._cellsUpdatedValues[e.id+"_"+n]&&(delete t._cellsUpdatedValues[e.id+"_"+n],t._cellsUpdatedValues.length--)}t._recycle(!1)}t.cancelEdit()}commandColumnDeleteCommand(e){this.deleteRow(e.id)}_renderAddNewRow(){const e=this;e._frozenNearDefaultRows=[],e._frozenFarDefaultRows=[];const t=new Smart.Grid.Row({data:{},index:-1,grid:e,freeze:"near",visible:"far"!==e.editing.addNewRow.position,autoGenerated:!0,addNewRow:!0}),i=new Smart.Grid.Row({data:{},index:-2,grid:e,freeze:"far",visible:"near"!==e.editing.addNewRow.position,autoGenerated:!0,addNewRow:!0});if(e._newNearRow){const t=e._frozenNearRows.indexOf(e._newNearRow);if(t>=0&&(e._frozenNearRows.splice(t,1),e.$.rowNearContainer.children.length>0)){const t=e.$.rowNearContainer.children[0];t.parentNode.removeChild(t)}}if(e._newFarRow){const t=e._frozenFarRows.indexOf(e._newFarRow);if(t>=0&&(e._frozenFarRows.splice(t,1),e.$.rowFarContainer.children.length>0)){const t=e.$.rowFarContainer.children[e.$.rowFarContainer.children.length-1];t.parentNode.removeChild(t)}}e.editing.addNewRow.visible&&"button"!==e.editing.addNewRow.displayMode&&(e._frozenNearDefaultRows.push(t),e._frozenFarDefaultRows.push(i),e._frozenNearRows.splice(0,0,t),e._frozenFarRows.push(i));const n=()=>{e.editing.addNewRow.autoCreate&&e._scrollView.vScrollBar.value===e._scrollView.vScrollBar.max&&(e.addUnboundRow(1),e._scrollView.vScrollBar.value=e._scrollView.vScrollBar.max),"button"===e.editing.addNewRow.displayMode&&e._scrollView.vScrollBar.value===e._scrollView.vScrollBar.max&&(e._add({}),e._scrollView.vScrollBar.value=e._scrollView.vScrollBar.max)};if(e._addRowOnButtonClickHandler||(e._addRowOnButtonClickHandler=n),e._scrollView&&e._scrollView.vScrollBar&&(e._scrollView.vScrollBar.$.farButton.removeEventListener("click",e._addRowOnButtonClickHandler),e._scrollView.vScrollBar.$.farButton.addEventListener("click",e._addRowOnButtonClickHandler)),e._newNearRow=t,e._newFarRow=i,e.editing.addNewRow.visible&&"button"!==e.editing.addNewRow.displayMode){if(!e._newNearRow.element){const t=e._newNearRow,i=t.createElement();t.visible="far"!==e.editing.addNewRow.position,t.element=i,e.$.rowNearContainer.children.length>0?e.$.rowNearContainer.insertBefore(i,e.$.rowNearContainer.children[0]):e.$.rowNearContainer.appendChild(i)}if(!e._newFarRow.element){const t=e._newFarRow,i=t.createElement();t.visible="near"!==e.editing.addNewRow.position,t.element=i,e.$.rowFarContainer.children.length>0?e.$.rowFarContainer.insertBefore(i,e.$.rowFarContainer.children[0]):e.$.rowFarContainer.appendChild(i)}}}_insertNewRowAfter(e){return this._insertNewRowBefore(e,!0)}_insertNewRowBefore(e,t=!1){const i=this,n=new Smart.Grid.Row({index:t?0:-1,id:Smart.Utilities.Core.createGUID(),grid:i}),o={};for(let e=0;e<i.columns.length;e++){const t=i.columns[e];void 0!==t.defaultValue&&(o[t.dataField]=t.defaultValue)}n.data=o;const l=function(t,n){i._suppressSort=i._suppressFilter=!0;const o=e=>{i._supressEnter=!0,i.scrollTop=n?i.scrollHeight:0,i.editing.addDialog.enabled||setTimeout((function(){if(i.editing.enabled&&i.editing.addNewRow.autoEdit){i.ensureVisible(e.id);let t=null;if(!t)if(i.columns[0]&&i.columns[0].allowEdit&&i.columns[0].visible)t=i.columns[0].dataField;else for(let e=0;e<i.columns.length;e++)if(i.columns[e].allowEdit&&i.columns[e].visible){t=i.columns[e].dataField;break}const n=()=>{i._selection.focusedCell={id:e.id,dataField:t,index:e.index},i._selection.rows=[],i._selection.columns=[],i._selection.cells=[],i._setSelection(e.id,t)};i.paging.enabled?setTimeout((()=>{if(!e.element){const t=e.createElement();e.element=t}n(),i._beginEdit(e)}),200):(n(),i._beginEdit(e))}}),100),i._suppressSort=i._suppressFilter=!1},l=i.dataSource&&i.dataSource.virtualDataSource&&!i.dataSource.virtualDataSourceOnExpand&&"infinite"!==i.scrolling;!0===i.editing.batch||i.editing.batch&&i.editing.batch.indexOf("add")>=0?(i._batchAddRow(t,n?i.rows.length:0),l||o(t),e&&e(t)):i.addRow(t.data,n,(t=>{l||o(t),e&&e(t)}))}.bind(this);return i.editing.addDialog.enabled?i._openAddRowDialog(n,l):l(n,t),!0}commandBarBatchSaveCommand(){this._saveBatchEdit()}commandBarAddRowCommand(){this._insertNewRowAfter()}commandBarAddTopRowCommand(){this._insertNewRowBefore()}commandBarDeleteRowCommand(){const e=this;let t=1,i=e.rows[e.rows.length-t];for(e._rowsDeleted||(e._rowsDeleted=[]);e._rowsDeleted.indexOf(e.rows[e.rows.length-t])>=0;)t++;if(i=e.rows[e.rows.length-t],e.selection.enabled)if(e.selection.allowCellSelection){const t=e.getSelectedCells();if(t.length>0){const n=t[0][0];i=e.rowById[n]}}else{const t=e.getSelectedRowIds();t.length>0&&(i=e.rowById[t[0]])}i&&e.commandColumnDeleteCommand(i)}commandBarBatchRevertCommand(){this.revertBatchEdit()}_beginEdit(e,t){const i=this;if(!t)if(i.columns[0]&&i.columns[0].allowEdit&&i.columns[0].visible)t=i.columns[0].dataField;else for(let e=0;e<i.columns.length;e++)if(i.columns[e].allowEdit&&i.columns[e].visible){t=i.columns[e].dataField;break}const n=i.columnByDataField[t];if(i.editing.allowColumnHeaderEdit&&!e&&n)return void i._beginColumnEdit(n);if(!e||!n||n&&n.autoGenerated)return!1;const o=e.getCell(t);if(!o)return!1;i.$.fireEvent("beginEdit",{id:e.id,dataField:n.dataField,row:e,column:n,cell:o,data:o.row.data,value:o.value}).defaultPrevented||("cell"===i.editing.mode?i._beginCellEdit(o):"row"===i.editing.mode&&i._beginRowEdit(e,o))}_saveUnboundRows(e){const t=this;if(t._unboundRows&&t._unboundRows.length>0&&t.editing.addNewRow.autoSave){const i=t.rowById[e];if(!i.unbound)return;const n=t._unboundRows.indexOf(i);if(n<0)return;const o=n+1;t.beginUpdate();for(let e=0;e<o;e++){const i=t._unboundRows[e];if(!i)continue;delete t.rowById[i.id],i.unbound=!1;let n=!1;t._selection.focusedCell&&t._selection.focusedCell.id===i.id&&(n=!0),t._nearRowsAdded&&t._nearRowsAdded.indexOf(i)>=0?(t._nearRowsAdded.splice(t._nearRowsAdded.indexOf(i),1),t._add(0,i.data),n&&(t._selection.focusedCell.id=t.rows[0].id,t._selection.focusedCell.index=t.rows[0].index)):t._farRowsAdded&&t._farRowsAdded.indexOf(i)>=0&&(t._farRowsAdded.splice(t._farRowsAdded.indexOf(i),1),t._add(i.data),n&&(t._selection.focusedCell.id=t.rows[t.rows.length-1].id,t._selection.focusedCell.id=t.rows[t.rows.length-1].index))}t._unboundRows.splice(0,o),t.endUpdate()}}_validateCell(e,t,n){const o=this;if(o._errorOverlay&&(o._errorOverlay.remove(),o._errorMessage.remove(),o._isUpdating=!1),e.column.validationRules||n||e.column.editor&&e.column.editor.onValidate){let l={},a=e._updating;if(e._updating=!0,e.error="",n){for(let i in n)n[i]&&"valid"!==i&&(e.error=n.message),"custom"===i&&n[i].minLength?e.error=o.localize("invalidCellValue",{value:t,validationRule:"minLength: "+n[i].value}):"custom"===i&&n[i].maxLength&&(e.error=o.localize("invalidCellValue",{value:t,validationRule:"maxLength: "+n[i].value}));e.error&&(o._isUpdating=!0)}for(let n of e.column.validationRules){switch(n.type){case"min":l.min=i.min(t,n.value);break;case"max":l.max=i.max(t,n.value);break;case"minLength":l.minLength=i.minLength(t,n.value);break;case"maxLength":l.maxLength=i.maxLength(t,n.value);break;case"minDate":l.minDate=i.minDate(t,n.value);break;case"maxDate":l.maxDate=i.maxDate(t,n.value);break;case"required":l.required=i.required(t);break;case"requiredTrue":l.requiredTrue=i.requiredTrue(t);break;case"pattern":l.pattern=i.pattern(t,n.value);break;case"email":l.email=i.email(t);break;case"null":l.null=i.null(t)}l[n.type]&&(n.message?e.error=n.message:e.error=o.localize("invalidCellValue",{value:t,validationRule:void 0!==n.value?n.type+": "+n.value:n.type}),e._updating=a,o._isUpdating=!0,e.element&&e.element.setAttribute("error",e.error),e.row.element.setAttribute("error",""))}if(e.column.editor&&e.column.editor.onValidate){const i=e.column.editor.onValidate(t,e.row.data);"string"==typeof i&&(e.error=i,e._updating=a,o._isUpdating=!0,e.element&&e.element.setAttribute("error",e.error),e.row.element.setAttribute("error",""))}if(e._updating=a,e.error){o._errorOverlay=o._createOverlay(),o._errorOverlay.onpointerdown=function(){o.endEdit()};const t=document.createElement("div");t.innerHTML=e.error,t.classList.add("smart-grid-validation-error");const i=o.offset(e.element),n=e.element.getBoundingClientRect(),l=o.offset(o);return i.left=i.left,i.top=i.top,i.top+n.height+5-o.offsetTop>o.offsetHeight?t.style.top=i.top-n.height-l.top-5+"px":t.style.top=i.top+n.height-l.top+5+"px",t.style.left=i.left+"px",o._errorMessage=t,o.$.root.appendChild(o._errorOverlay),o.$.root.appendChild(o._errorMessage),e.editor&&e.editor.instance&&e.editor.instance.focus(),!1}o._isUpdating=!1}return!0}hideCellMessage(){const e=this;if(e._messageOverlay){e._messageOverlay.remove();for(let t in e._message)e._message[t].remove();delete e._message,delete e._messageOverlay}}showCellMessage(e,t,i){const n=this,o=n.rowById[e].getCell(t);n._messageOverlay||(n._messageOverlay=n._createOverlay(),n._messageOverlay.onpointerdown=function(){n.hideCellMessage()});const l=document.createElement("div");l.innerHTML=i,l.classList.add("smart-grid-cell-notification");const a=n.offset(o.element),r=o.element.getBoundingClientRect(),d=n.offset(n);a.left=a.left,a.top=a.top,a.top+r.height+5-n.offsetTop>n.offsetHeight?l.style.top=a.top-r.height-d.top-5+"px":l.style.top=a.top+r.height-d.top+5+"px",l.style.left=a.left+"px",n._message||(n._message=[]),n._message.push(l),n._messageOverlay.parentNode||n.$.root.appendChild(n._messageOverlay),n.$.root.appendChild(l)}_endCellEdit(e){const t=this,i=e||t.editing.editCell;if(!i||i&&!i.isEditing)return null;let n=t._getEditorValue(i),o=null;if(n&&n.error&&(i.canNotify=!1,i.element.setAttribute("error",""),i.row.element.setAttribute("error",""),i.error=!0,i.canNotify=!0,o=n.validity,n=n.value),"string"===i.column.dataType&&t.formulas&&n&&"string"==typeof n){if(i.formula!==n){const e=i.canNotify;i.canNotify=!1,n.startsWith("=")?i.formula=t._unescapeString(n):i.formula=null,i.canNotify=e}if(n.startsWith("=")&&i.formula){const e=t._formulaParser;if(e){let t=e.parse(i.formula.slice(1));n=isNaN(t)?"#VALUE!"===n?0:"#ERROR!"===n?"#ERROR!":t:t}}}const l=function(e,t){return"date"===i.column.dataType?e&&t?e.valueOf()===t.valueOf():!e&&!t:!("any"!==i.column.dataType||void 0===e||void 0===t||!Array.isArray(e)||0!==e.length||""!==t)||(!(null!=t&&""!==t||null!==e&&""!==e)||e===t)},a=function(){const e=t._getEditorId(i);t._cellEditors[e].detach(),i.row.element.removeAttribute("edit"),i.element&&(i.element.removeAttribute("editor"),i.element.removeAttribute("error")),i.row.element.removeAttribute("error"),i.isEditing=!1,i.element&&(i.element.content.innerHTML="");const o=function(){t.editing.editRow||(t.dataSource&&t.dataSource.boundHierarchy?(t.dataSource.refreshHierarchy(),t._refreshRowHierarchy(),t.refresh()):t.layout.allowCellsWrap?t.refresh():t._recycle(!1))},a=t._cellsUpdatedValues?t._cellsUpdatedValues[i.row.id+"_"+i.column.dataField]:void 0,r=void 0!==a?a:i.value,d=()=>{if(t._fireEndEdit){let e=i.value;if(t.editing.batch&&i.row&&i.column){const t=i.modifiedValue;void 0!==t&&(e=t)}t.$.fireEvent("endEdit",{id:i.row.id,dataField:i.column.dataField,row:i.row,column:i.column,cell:i,data:i.row.data,value:e}),t._fireEndEdit=!1}};if(l(n,r))t.editing.isEditing=!1,d(),t.editing.editCell=null,t.editing.editRow||(t.editing.isEditing=!1,o());else{const e=function(){t.editing.editCell=null,t.editing.editRow||(t.editing.isEditing=!1),delete t._editInfo};if(!0===t.editing.batch||t.editing.batch&&t.editing.batch.indexOf("update")>=0)e(),t._batchUpdateCell(i.row,i.column,n,i.value),o(),d();else{const l=function(){e(),i._updating=!0,t.editing.readOnlyEdit?t.onCellEditRequest&&t.onCellEditRequest(i.row.id,i.column.dataField,n,i.value,i.row.data,t):i.value=n,i._updating=!1,o(),d()};if(!t.editing.editRow&&t.dataSource&&t.dataSource.virtualDataSource){const e={};e[i.column.dataField]=n,t.updateRow(i.row.id,e,(()=>{l()}))}else l()}}return t.editing.commandColumn.visible&&!t.editing.commandColumn.width&&"cell"===t.editing.mode&&t.refresh(),t.focus(),!0};let r=t._validateCell(i,n,o);if(!r)return i.editor.instance&&!i.editor.autoOpen&&setTimeout((()=>{i.editor.instance.focus()}),50),!1;const d=t._cellsUpdatedValues?t._cellsUpdatedValues[i.row.id+"_"+i.column.dataField]:void 0,s=void 0!==d?d:i.value;if(l(n,s))return a(),!!r;if(t._setCellUndoRedo(i,s,n),t.onCellUpdate&&!t.editing.editRow){t.beginUpdate(),t.appearance.displayLoadingIndicator=!0,t._setLoadingIndicatorVisibility();const e=t._createOverlay();t.$.root.appendChild(e),t.onCellUpdate([i],[s],[n],(function(o){o?a():t.cancelEdit(),t.appearance.displayLoadingIndicator=!1,t._setLoadingIndicatorVisibility(),e.parentNode.removeChild(e),t.endUpdate(),t.onCellUpdated&&t.onCellUpdated([i.row.index],[i.row],[i.column],[i.row.data],[s],[n],t),t._onCellUpdated&&t._onCellUpdated(i.row.index,i.row,i.column,i.row.data,s,n)}),t)}else if(t.onRowUpdate){t.beginUpdate(),t.appearance.displayLoadingIndicator=!0,t._setLoadingIndicatorVisibility();const e=t._createOverlay();t.$.root.appendChild(e);const o=i.column.dataField,l=Object.assign({},i.row.data),r=Object.assign({},i.row.data);r[o]=n,t.onRowUpdate([i.row.index],[i.row],[l],[r],(function(n){n?a():t.cancelEdit(),t.appearance.displayLoadingIndicator=!1,t._setLoadingIndicatorVisibility(),e.parentNode.removeChild(e),t.endUpdate(),t.onRowUpdated&&t.onRowUpdated([i.row.index],[i.row],[i.row.data],t),t._onRowUpdated&&t._onRowUpdated(i.row.index,i.row,i.row.data)}),t)}else a();return!!r}_endRowEdit(){const e=this,t=e.editing.editRow;if(!t)return!1;let i=!0;const n=t.cells;let o={},l={};t.element.removeAttribute("error");for(let a=0;a<n.length;a++){const r=n[a];let d=e._getEditorValue(r),s=null;d&&d.error&&(r.canNotify=!1,r.element.setAttribute("error",""),r.row.element.setAttribute("error",""),r.error=!0,r.canNotify=!0,s=d.validity,d=d.value),d!==r.value&&(o[r.column.dataField]=r.value,l[r.column.dataField]=d);if(!e._validateCell(r,d,s))return i=!1,t.element.setAttribute("error",""),e._isUpdating=!0,r.editor.instance&&setTimeout((()=>{r.editor.instance.focus()}),50),!1}if(i){const i=function(){const i=e._fireEndEdit;e._fireEndEdit=!1;for(let t=0;t<n.length;t++){const i=n[t];e._endCellEdit(i)}e._fireEndEdit=i,e.onRowUpdate||null===e.onRowUpdated||e.onRowUpdated([t.index],[t],[t.data],e),e.editing.isEditing=!1,e.editing.editRow=null,e.editing.commandColumn.visible&&!e.editing.commandColumn.width?e.refresh():e._recycle(!1)};if(!0===e.editing.batch||e.editing.batch&&e.editing.batch.indexOf("update")>=0)i();else if(e.onRowUpdate){e.beginUpdate(),e.appearance.displayLoadingIndicator=!0,e._setLoadingIndicatorVisibility();const n=e._createOverlay();e.$.root.appendChild(n);const a=e.onRowHistory;e.onRowHistory=null,t.updatedDate=new Date,t.updatedBy=e.currentUser,e.storeHistory&&e._updateRowHistory(t,o,l),setTimeout((()=>{e.onRowHistory=a}),100),e.onRowUpdate([t.index],[t],[o],[l],(function(o){const l=e.onRowUpdate,a=e.onCellUpdate;e.onRowUpdate=null,e.onCellUpdate=null,o?i():e.cancelEdit(),e.onRowUpdate=l,e.onCellUpdate=a,e.appearance.displayLoadingIndicator=!1,e._setLoadingIndicatorVisibility(),n.parentNode.removeChild(n),e.endUpdate(),e.onRowUpdated&&e.onRowUpdated([t.index],[t],[t.data])}),e)}else if(e.dataSource&&e.dataSource.virtualDataSource&&e.editing.isEditing){e.beginUpdate(),e.appearance.displayLoadingIndicator=!0,e._setLoadingIndicatorVisibility();const t=e._createOverlay();e.$.root.appendChild(t);let n=Object.assign({},e.editing.editRow.data);for(let t=0;t<e.editing.editRow.cells.length;t++){const i=e.editing.editRow.cells[t];if(!i.column.allowEdit)continue;const o=e._getEditorValue(i);void 0!==o&&(n[i.column.dataField]=o)}e._editInfo={row:n},e._virtualDataRequest("update",(function(n){n?i():e.cancelEdit(),e.appearance.displayLoadingIndicator=!1,e._setLoadingIndicatorVisibility(),t.parentNode.removeChild(t),e.endUpdate()}))}else i();return!0}return e.focus(),!1}_batchDeleteRow(e){const t=this;if(t._rowsDeleted||(t._rowsDeleted=[]),t.onRowRemove){if(!1===t.onRowRemove([e.id],t))return}t._rowsDeleted.push(e.id),t._recycle(!1),t.onRowRemoved&&t.onRowRemoved([e.id],[e.data.$.index],t)}_batchAddRow(e,t){const i=this;i._rowsAdded||(i._rowsAdded=[]),i._rowsAdded.push(e.id),i.rowById[e.id]=e,e.index=i.rows.length+(i._rowsAdded?i._rowsAdded.length:0),0===t?i._nearRowsAdded.splice(0,0,e):i._farRowsAdded.push(e);i.isInitialized&&i._rowElements&&i._rowElements.length<i.rows.length+i._rowsAdded.length&&i._initializeRowElements(),i.refresh()}_batchUpdateCell(e,t,i,n){const o=this;o._cellsUpdatedValues||(o._cellsUpdatedValues=[]);!function(e,i){return"date"===t.dataType?!(!e&&i)&&(!(e&&!i)&&e.valueOf()===i.valueOf()):e===i}(i,n)?o._cellsUpdatedValues[e.id+"_"+t.dataField]=i:delete o._cellsUpdatedValues[e.id+"_"+t.dataField],o._cellsUpdatedValues.length++}_saveBatchEdit(){const e=this;for(let t in e._cellsUpdatedValues){const i=e._cellsUpdatedValues[t],n=t.substring(0,t.indexOf("_")),o=t.substring(t.indexOf("_")+1),l=e.rowById[n],a=l.getCell(o);if(e.dataSource.virtualDataSource){const t={};t[a.column.dataField]=i,l.data.$&&l.data.$.id?e.updateRow(l.data.$.id,t):(a._updating=!0,a.value=i,a._updating=!1)}else a._updating=!0,a.value=i,a._updating=!1}const t=e._rowsDeleted&&e._rowsDeleted.length>0||e._rowsAdded&&e._rowsAdded.length>0;if(t&&e.beginUpdate(),e._rowsAdded&&e._rowsAdded.length>0)for(let t in e._rowsAdded){const i=e._rowsAdded[t],n=e.rowById[i];if(n){if(e._rowsDeleted&&e._rowsDeleted.length>0){let t=!1;for(let n=0;n<e._rowsDeleted.length;n++){if(e._rowsDeleted[n].id===i){t=!0;break}}if(t)continue}e.dataSource.virtualDataSource?e.addRow(n.data,!0):e._nearRowsAdded.indexOf(n)>=0?e.rows.splice(0,0,n):e._farRowsAdded.indexOf(n)>=0&&e.rows.push(n)}}if(e._rowsDeleted&&e._rowsDeleted.length>0)for(let t=0;t<e._rowsDeleted.length;t++){const i=e._rowsDeleted[t],n=e.rowById[i];if(n)if(e.dataSource&&e.dataSource.virtualDataSource)e._editInfo={row:n.data},e._virtualDataRequest("remove",(function(t){if(t){const t=e.rows.indexOf(n);e.rows.splice(t,1),delete e.rowById[n.id]}}));else{const t=e.rows.indexOf(n);e.rows.splice(t,1)}}t&&e.endUpdate(),e._clearBatchEdit(!1),e.$.fireEvent("saveBatchEdit")}_clearBatchEdit(){const e=this;let t=!1;e._rowsAdded&&e._rowsAdded.length>0&&(t=!0),e._cellsUpdatedValues=[],e._rowsAdded=[],e._rowsDeleted=[],e._nearRowsAdded=[],e._farRowsAdded=[],t?e.refresh():e._recycle(!1),e.$.fireEvent("clearBatchEdit")}_getEditorId(e){const t=e.column._editorId?e.column._editorId:"";return e.editor!==e.column.editor?e.editor.template+"_"+e.column.dataField+"_"+e.row.id+t:e.editor.template+"_"+e.column.dataField+t}_applyCommand(e,t){const i=this;t||(t=[]);const n=function(){"function"==typeof e?e.apply(i,t):i[e]?i[e].apply(i,t):Smart[e]?Smart[e].apply(i,t):window[e]&&window[e].apply(i,t)};if(i.onCommand){t||(t=[]),t[1]||(t[1]=null);const o={name:e,command:n,details:t[0],event:t[1],handled:!1};setTimeout((()=>{i.onCommand.apply(i,[o]),o.handled||n()}),200)}else n()}_getCommandColumnCommandsTemplate(){const e=this,t=e.editing.commandColumn.dataSource,i="icon"!==e.editing.commandColumn.displayMode,n="label"!==e.editing.commandColumn.displayMode;let o="";for(let l in t){const a=t[l];let r="<div",d=!1;if("commandColumnMenu"===l)continue;d||(r+=' item="'+l+'" command="'+a.command+'" class="smart-grid-command-item">',d=!0);const s="{{messages}}"===a.label?e.localize(l):a.label;n&&i?(r+='<span class="smart-grid-icon '+a.icon+'"></span>',r+='<span class="smart-grid-label">'+s+"</span>"):n&&!i?r+='<span title="'+s+'" class="smart-grid-icon '+a.icon+'"></span>':i&&!n&&(r+='<span class="smart-grid-label">'+s+"</span>"),r+="</div>",o+=r}return o}_updateCommandColumnCommandsVisibility(e,t){const i=this,n=e.children,o=i.editing.commandColumn.dataSource;for(let e=0;e<n.length;e++){const l=n[e],a=l.getAttribute("item"),r=o[a].visible;!0===r?l.classList.remove("smart-hidden"):!1===r?l.classList.add("smart-hidden"):"auto"===r&&(!i.editing.dialog.enabled&&(i.editing.editRow===t||i.editing.editCell&&i.editing.editCell.row===t)?"commandColumnEdit"===a?l.classList.add("smart-hidden"):"commandColumnUpdate"!==a&&"commandColumnCancel"!==a||n[e].classList.remove("smart-hidden"):"commandColumnEdit"===a?l.classList.remove("smart-hidden"):"commandColumnUpdate"!==a&&"commandColumnCancel"!==a||n[e].classList.add("smart-hidden"))}}_handleEditKeyDown(e){const t=this,i=e.key,n=t.editing.commandKeys;if(!t.editing.dialog.enabled)for(let o in n){const l=n[o],a=l.key.replace(/ /gi,"").split("|");if(("Tab"!==i||!t.editing.editRow)&&a.indexOf(i)>=0){if(t._editDownKey=i,t._applyCommand(l.command),"Enter"===i&&e){if(e.stopPropagation(),t._supressEnter)return void delete t._supressEnter;t.selection.enabled&&t.selection.allowCellSelection&&t._keyDownHandler(e)}delete t._editDownKey;break}}}_getCustomCellEditor(e){const t=this;e.editor.selector=e.editor.template,e.editor.template="custom";const i=t._getEditorId(e);if(!t._cellEditors[i]){let n=document.createElement("div");t._applyCellEditorUserSettings(n,e),n.classList.add("smart-grid-cell-editor");const o=function(e){"keydown"!==e.type||t._handleEditKeyDown(e)},l=function(){const t=e.editor.instance.element.firstElementChild;Smart.Utilities.Core.isMobile||(e.editor.focus?setTimeout((function(){e.editor.focus.apply(e.editor.instance.element,[])}),50):setTimeout((function(){t.focus()}),50))},a=function(t){const i=e.editor.instance.element.firstElementChild;e.editor.blur?e.editor.blur.apply(e.editor.instance.element,[t]):i.blur()},r=function(t){const i=e.editor.instance.element.firstElementChild;if(!e.editor.isInitialized&&e.editor.settings&&i)for(let t in e.editor.settings)i[t]=e.editor.settings[t];if(e.editor.setValue)e.editor.setValue.apply(e.editor.instance.element,[t]);else{if(i.innerHTML.indexOf("{{")>=0){const n=i.innerHTML.replace(/{{value}}/gi,t).replace(/{{id}}/gi,e.row.id);i.innerHTML=n}i.value=t,t instanceof Date&&(i.value=t.toISOString().split("T")[0]),e.editor.instance.element.value=i.value}},d=function(){if(!e.editor.instance)return"";const t=e.editor.instance.element.firstElementChild;if(e.editor.getValue){const i=t.querySelector("input");return i&&i.blur(),e.editor.getValue.apply(e.editor.instance.element,[t.value])}const i=t.value;return e.editor.settings&&e.editor.settings.valueProperty?i?Array.isArray(i)&&i.length>0?i[0][e.editor.settings.valueProperty]:i[e.editor.settings.valueProperty]:"":i||""},s=function(){n.removeEventListener("keydown",o),e.editor.detach&&e.editor.detach.apply(n,[])},c=function(){n.addEventListener("keydown",o),e.editor.attach&&e.editor.attach.apply(n,[])};let u=null;if((e.editor.selector.startsWith("#")||e.editor.selector.startsWith("."))&&(u=document.querySelector(e.editor.selector)),u)n.appendChild(u.content.cloneNode(!0).firstElementChild);else{const i=function(e){const t=document.createElement("template");return e=e.trim(),t.innerHTML=e,t.content.firstChild}(e.editor.selector);if(i){if("#text"===i.nodeName)return t._getInputCellEditor(e);n.appendChild(i)}}t._cellEditors[i]={element:n,focus:l,blur:a,getValue:d,setValue:r,attach:c,detach:s}}return t._cellEditors[i]}_getSliderCellEditor(e){const t=this,i=t._getEditorId(e),n=document.createElement("div"),o=document.createElement("input"),l=document.createElement("div"),a=document.createElement("smart-number-input");if(o.type="range",o.step="0.01",t._applyCellEditorUserSettings(n,e),"{}"===JSON.stringify(a.numberFormat)){let i={};if(e.column.cellsFormat)if(e.column.cellsFormat.indexOf("c")>=0){i={style:"currency",currency:t.messages[t.locale].calendar.currency};let n=parseInt(e.column.cellsFormat.substring(1));isNaN(n)||(i.maximumFractionDigits=n)}else if(e.column.cellsFormat.indexOf("p")>=0){i={style:"percent"};let t=parseInt(e.column.cellsFormat.substring(1));isNaN(t)||(i.maximumFractionDigits=t)}else e.column.Intl&&e.column.Intl.NumberFormat&&(i=e.column.Intl.NumberFormat);a.numberFormat=i}e.editor.min&&(o.min=a.min=e.editor.min),e.editor.max&&(o.max=a.max=e.editor.max),n.classList.add("smart-grid-cell-editor"),n.classList.add("smart-grid-slider-cell-editor"),l.classList.add("nav"),a.classList.add("smart-flex"),a.style.paddingLeft="6px",l.classList.add("smart-icon-resize-full","smart-grid-icon");const r=function(e){if("keydown"===e.type&&(t._handleEditKeyDown(e),"Backspace"!==e.key&&"Delete"!==e.key&&"Tab"!==e.key&&"Escape"!==e.key&&!e.altKey&&!e.shiftKey))return l.click(),void e.preventDefault()};l.onclick=function(){const i=document.createElement("div"),n=document.createElement("input");n.type="range";const r=e.editor.instance.element,d=document.createElement("div");d.classList.add("smart-slider-editor"),i.setAttribute("theme",t.theme),d.appendChild(n);const s=Smart.Utilities.Core.createGUID().replace(/-/gi,"");i.id="Slider"+s,r.setAttribute("aria-owns",i.id),d.classList.add("smart-grid-slider-container"),n.value=o.value,o.min&&(n.min=o.min),o.max&&(n.max=o.max),l.sliderEditorDialog=i,l.popupSlider=n,n.onchange=n.oninput=function(){a.value=parseFloat(n.value)};const c=e=>{e&&e.key&&("Enter"===e.key&&(i.parentNode.removeChild(i),o.value=parseFloat(n.value),t.endEdit()),"Escape"===e.key&&(i.parentNode.removeChild(i),t.cancelEdit()))};a.onchange=a.onkeyup=e=>{n.value=a.value,c(e)},n.onkeydown=function(e){c(e)},i.classList.add("smart-grid-slider-dialog"),i.appendChild(d),document.body.appendChild(i),i.style.top=t._offsetTop(r)+r.offsetHeight+"px",i.style.left=t._offsetLeft(r)+15+r.offsetWidth-i.offsetHeight+"px",i.style.width=r.offsetWidth+"px";const u=t._offsetLeft(t)+t.offsetWidth;t._offsetLeft(r)+i.offsetWidth>u&&(i.style.left=u-i.offsetWidth-10+"px")};let d=e.value;void 0===d&&(d=0),a.value=d,o.value=d,n.appendChild(a);const s=e=>{"Escape"===e.key&&(l.sliderEditorDialog&&l.sliderEditorDialog.parentNode.removeChild(l.sliderEditorDialog),t.cancelEdit()),"Enter"===e.key&&(l.sliderEditorDialog&&l.sliderEditorDialog.parentNode.removeChild(l.sliderEditorDialog),o.value=parseFloat(a.value),t.endEdit())};return t._cellEditors[i]={element:n,focus:function(){l.click(),Smart.Utilities.Core.isMobile||setTimeout((function(){a.focus(),t.$.scrollView.scrollTop=0}),50)},blur:function(){},setValue:function(e){o.value=void 0!==e&&""!==e?parseFloat(e):0,a.isReady&&a.setValue(e)},getValue:function(){const e=parseFloat(o.value);return l.sliderEditorDialog&&l.sliderEditorDialog.parentNode?(o.value=parseFloat(l.popupSlider.value),o.value):e},attach:function(){o.addEventListener("keydown",r),a.addEventListener("keydown",s)},detach:function(){o.removeEventListener("keydown",r),a.removeEventListener("keydown",s),l.sliderEditorDialog&&l.sliderEditorDialog.parentNode&&(o.value=l.popupSlider.value,l.sliderEditorDialog.parentNode.removeChild(l.sliderEditorDialog))}},t._cellEditors[i]}_getBeginEditKey(e){const t=this;t._beginEditKey?t._beginEditKey+=e:t._beginEditKey=e}_getTextAreaCellEditor(e){const t=this,i=t._getEditorId(e),n=document.createElement("div"),o=t.editing.dialog.enabled?document.createElement("smart-text-area"):document.createElement("textarea");o.users=t.users;const l=document.createElement("div");"richText"===e.column.template&&(o.richText=!0,o.style.setProperty("--smart-editor-label-padding","0px")),t._applyCellEditorUserSettings(n,e),o.style.direction="",t.rightToLeft&&(o.style.direction="rtl"),e.editor.min&&(o.minLength=e.editor.min),e.editor.max&&(o.maxLength=e.editor.max),o.classList.add("smart-input"),n.classList.add("smart-grid-cell-editor"),n.classList.add("smart-grid-text-area-cell-editor"),l.classList.add("nav"),l.classList.add("smart-icon-resize-full","smart-grid-icon");const a=function(e){if(t._getBeginEditKey(e.key),"keydown"===e.type&&(t._handleEditKeyDown(e),"Backspace"!==e.key&&"Delete"!==e.key&&"Tab"!==e.key&&"Escape"!==e.key&&!e.altKey&&!e.shiftKey)){if(t.editing.dialog.enabled)return;return l.click(),void e.preventDefault()}};l.onclick=function(){if(t.editing.dialog.enabled)return;const n=document.createElement("div"),a=document.createElement("smart-text-area"),r=e.editor.instance.element,d=document.createElement("div"),s=document.createElement("div");s.classList.add("smart-grid-text-area-resizer","show","smart-icon-resize-full","smart-grid-icon"),s.title=t.localize("expandCell"),s.onpointerdown=()=>{a.style.pointerEvents="none",t._openTextAreaDialog(e.column,a,e)},"richText"===e.column.template&&(a.richText=!0,a.toolbarOnFocus=!0),a.users=t.users,n.appendChild(s),l.textAreaEditorDialog&&l.textAreaEditorDialog.parentNode&&l.textAreaEditorDialog.parentNode.contains(l.textAreaEditorDialog)&&(l.textAreaEditorDialog.parentNode.removeChild(l.textAreaEditorDialog),l.textAreaEditorDialog.menu&&l.textAreaEditorDialog.menu.remove()),n.id="TextArea"+i,r.setAttribute("aria-owns",n.id),t.rightToLeft&&(a.style.direction="rtl"),n.setAttribute("theme",t.theme),d.appendChild(a),d.classList.add("smart-grid-text-area-container"),a.value=o.value,a.classList.add("smart-input"),o.minLength>=0&&(a.minLength=o.minLength),o.maxLength>=0&&(a.maxLength=o.maxLength),l.textAreaEditorDialog=n,l.popupTextArea=a,a.onkeydown=function(e){if(a._key=e.key,t._getBeginEditKey(e.key),"Escape"===e.key){try{n.parentNode.contains(n)&&(n.parentNode.removeChild(n),n.menu&&n.menu.remove())}catch(e){n.error=e}t.editing.editCell&&t.cancelEdit()}("Tab"===e.key||"Enter"===e.key&&e.shiftKey)&&(o.value=a.value,t.editing.editCell?t.endEdit():a.blur(),e.preventDefault(),e.stopPropagation())},n.classList.add("smart-grid-text-area-dialog"),n.appendChild(d),document.body.appendChild(n),t._beginEditKey&&!Smart.Utilities.Core.isMobile?a.focus():setTimeout((function(){Smart.Utilities.Core.isMobile||a.select()}),50);const c=t._offsetTop(r);if(n.style.top=c+"px",n.style.left=t._offsetLeft(r)+"px",n.style.width=r.offsetWidth+"px",c+d.offsetHeight>window.innerHeight&&(n.style.top=r.offsetHeight+c-n.offsetHeight+"px"),t.grouping.enabled&&e.column._treeColumn){const e=r.parentNode.parentNode;n.style.top=t._offsetTop(e)+"px",n.style.left=t._offsetLeft(e)+"px",n.style.width=e.offsetWidth+"px"}a.onblur=()=>{if(!t._dialogTextArea||t._dialogTextArea.classList.contains("smart-hidden")){"Escape"!==a._key&&(o.value=l.popupTextArea.value),o.focus();try{l.textAreaEditorDialog.parentNode&&(l.textAreaEditorDialog.parentNode.removeChild(l.textAreaEditorDialog),l.textAreaEditorDialog.menu&&l.textAreaEditorDialog.menu.remove())}catch(e){l.error=e}}}},n.appendChild(o);return t._cellEditors[i]={element:n,focus:function(){l.click()},blur:function(){},setValue:function(i){i&&(""+i).indexOf("&#")>=0&&(i=t._fromHTMLEntities(i)),"richText"!==e.column.template&&"string"==typeof i&&(i=i.replaceAll("<br/>","\n\r").replaceAll("<br>","\n\r")),null===i&&(i="");const n=t._unescapeString(i);o.value=n,l.popupTextArea&&(l.popupTextArea.value=o.value,l.popupTextArea.dispatchEvent(new Event("input")))},getValue:function(){let t=o.value;return"Smart-TEXT-AREA"===o.nodeName&&"richText"===e.column.template&&(t=o.getHTML()),l.textAreaEditorDialog&&l.textAreaEditorDialog.parentNode?(o.value=l.popupTextArea.value,l.popupTextArea.richText?l.popupTextArea.getHTML():o.value):t},attach:function(){o.addEventListener("keydown",a)},detach:function(){if(o.removeEventListener("keydown",a),l.textAreaEditorDialog&&l.textAreaEditorDialog.parentNode){o.value=l.popupTextArea.value;try{l.textAreaEditorDialog.parentNode&&l.textAreaEditorDialog.parentNode.removeChild(l.textAreaEditorDialog),l.textAreaEditorDialog.menu&&l.textAreaEditorDialog.menu.remove(),l.popupTextArea&&l.popupTextArea.remove();const e=document.querySelector(".smart-grid-textarea-dialog");e&&e.close()}catch(e){l.error=e}}else l.popupTextArea&&l.popupTextArea.remove()}},t._cellEditors[i]}_getColorInputCellEditor(e){const t=this,i=t._getEditorId(e);if(!t._cellEditors[i]){const n=t._getColorInput();t._applyCellEditorUserSettings(n,e),n.classList.add("smart-grid-cell-editor"),n.classList.add("smart-grid-color-input-cell-editor"),n.dropDownWidth=50,n.autocomplete="off",n.style.direction="",t.rightToLeft&&(n.rightToLeft=!0);const o=function(e){"keydown"!==e.type||t._handleEditKeyDown(e)},l=function(){Smart.Utilities.Core.isMobile||setTimeout((function(){n.select()}),50)},a=function(){},r=function(e){null==e&&(e=""),n.value=e},d=function(){return n.value},s=function(){n.removeEventListener("keydown",o)},c=function(){n.addEventListener("keydown",o)};t._cellEditors[i]={element:n,focus:l,blur:a,getValue:d,setValue:r,attach:c,detach:s}}return t._cellEditors[i]}_getInputCellEditor(e){const t=this,i=t._getEditorId(e);if(!t._cellEditors[i]){const n=document.createElement("input");t._applyCellEditorUserSettings(n,e),e.editor.min&&(n.minLength=e.editor.min),e.editor.max&&(n.maxLength=e.editor.max),n.classList.add("smart-input"),n.classList.add("smart-grid-cell-editor"),n.classList.add("smart-grid-input-cell-editor"),n.autocomplete="off",n.style.direction="",t.rightToLeft&&(n.style.direction="rtl");const o=function(i){i.key;if(t._getBeginEditKey(i.key),"keydown"===i.type)return"number"!==e.column.dataType&&"int"!==e.column.dataType&&"float"!==e.column.dataType||t.editing.editColumn||i.key.match(/[0-9]/)||"-"===i.key||1!==i.key.length?void t._handleEditKeyDown(i):(i.preventDefault(),void i.stopPropagation())},l=function(){Smart.Utilities.Core.isMobile||(t._beginEditKey?n.focus():setTimeout((function(){n.select()}),50))},a=function(){},r=function(i){if(e.column.rowHeaderColumn&&!i)return void(n.value=e.editor.row.visibleIndex+1);if("number"===e.column.dataType||"int"===e.column.dataType||"float"===e.column.dataType){if(""===i)return;if(i&&!i.toString().match(/[0-9]/)&&"-"!==i)return}i&&(""+i).indexOf("&#")>=0&&(i=t._fromHTMLEntities(i));const o=t._unescapeString(i);n.value=o},d=function(){return n.value},s=function(){n.removeEventListener("keydown",o)},c=function(){n.addEventListener("keydown",o)};t._cellEditors[i]={element:n,focus:l,blur:a,getValue:d,setValue:r,attach:c,detach:s}}return t._cellEditors[i]}_applyCellEditorUserSettings(e,t){for(let i in t.editor)"template"!==i&&("list"!==i?"onInit"!==i&&"onRender"!==i&&(e[i]=t.editor[i]):e.setAttribute(i,t.editor[i]));if(t.editor.settings)for(let i in t.editor.settings)e[i]=t.editor.settings[i]}_getCheckInputCellEditor(e){return this._getAutoCompleteCellEditor(e,"smart-check-input")}_getMultiInputCellEditor(e){return this._getAutoCompleteCellEditor(e,"smart-multi-input")}_getMultiComboInputCellEditor(e){const t=this._getAutoCompleteCellEditor(e,"smart-multi-combo-input");return"tags"!==e.column.template&&"collaborator"!==e.column.template||(t.getValue=()=>{const e=t.element.selectedItems;if(e&&0===e.length)return"";let i=[];for(let t=0;t<e.length;t++){const n=e[t];"string"==typeof n?i.push(n):i.push(n.value)}return i.toString()},t.setValue=e=>{if(null===e&&(e=""),"number"==typeof e&&(e=""+e),e&&e.indexOf("{")>=0||e&&e.indexOf("[")>=0)t.element.selectedItems=JSON.parse(e);else if(e&&e.indexOf(",")>=0)if(e=e.split(",").map((e=>e.trim())),t.element.readonly){let i=[];t.element.dataSource.forEach((t=>{for(let n=0;n<e.length;n++){const o=e[n];("string"==typeof t&&""+t===o||t&&void 0!==t.label&&""+t.value===o)&&i.push(t)}})),t.element.selectedItems=i}else t.element.selectedItems=e;else if(t.element.readonly){let i=[];t.element.dataSource.forEach((t=>{("string"==typeof t&&""+t===e||t&&void 0!==t.label&&""+t.value===e)&&i.push(t)})),t.element.selectedItems=i}else t.element.value=e},t.focus=function(){if(Smart.Utilities.Core.isMobile)return;const e=t.element;setTimeout((()=>{t.element.readonly?t.element.focus():e&&e.select&&e.select()}),50)}),t}_getAutoCompleteCellEditor(e,t){const i=this,n=i._getEditorId(e);if(i._cellEditors[n]&&e.column.editor.isDirty&&(delete e.column.editor.isDirty,delete i._cellEditors[n]),!i._cellEditors[n]){let o=document.createElement("smart-input");t&&(o=document.createElement(t)),o.dropDownPlaceholder=i.localize("noOptions"),i._applyCellEditorUserSettings(o,e),o.readonly&&(o.dropDownButtonPosition="right"),o.dropDownOpenPosition="auto";const l=function(e){o.opened||"keydown"!==e.type||i._handleEditKeyDown(e)};o.rightToLeft=i.rightToLeft,o.classList.add("smart-grid-cell-editor"),o.classList.add("smart-grid-auto-complete-cell-editor"),o.dropDownOpenPosition="auto";const a=function(){Smart.Utilities.Core.isMobile||setTimeout((()=>{o&&o.select&&o.select()}),50)},r=function(e){e&&1===e.length&&o.readonly||(o.value=null!==e?e:"")},d=function(){return o.value},s=function(){o&&o.close&&(o.value="",o.close(),o.removeEventListener("keydown",l))},c=function(){},u=function(){o.addEventListener("keydown",l)};i._cellEditors[n]={element:o,focus:a,blur:c,setValue:r,getValue:d,attach:u,detach:s}}if(e.editor.dataSource||e.editor.isInitialized){if(e.column.editor.collaborator){let t=[];for(let e=0;e<i.users.length;e++)t.push({color:i.users[e].color,label:i.users[e].name,id:i.users[e].id,value:i.users[e].id,name:i.users[e].name,image:i.users[e].image});if(e.column.editor.singleSelect&&(t=[""].concat(t)),t&&i._cellEditors[n]&&i._cellEditors[n].element&&i._cellEditors[n].element.dataSource&&JSON.stringify(t)!==JSON.stringify(i._cellEditors[n].element.dataSource)){i._cellEditors[n].element.dropDownHeight="auto";const o=i._cellEditors[n].element.dataSource;if(o)for(let e=0;e<t.length;e++){const i=t[e],n=o.find((e=>{if(e.id===i.id)return e}));n&&"object"==typeof i&&(i.color=n.color)}i._cellEditors[n].element.dataSource=t,e.column.editor.dataSource=t}}}else{const t=i.getVisibleRows(),o=[];for(let n=0;n<t.length;n++){let l=i.dataSource[t[n].index];if(l){if(l=l[e.column.dataField],!l)continue;-1===o.indexOf(l)&&o.push(l)}}o.length<7?i._cellEditors[n].element.dropDownHeight="auto":i._cellEditors[n].element.dropDownHeight=200,i._cellEditors[n].element.dataSource=o}if(e.column.relationId&&e.column.relationField){const t=i._getRelationData(e.column.relationId,e.column.relationField,e.column.editor.singleSelect);i._cellEditors[n].element.dataSource=t,e.column.editor.dataSource=t,t.length<7?i._cellEditors[n].element.dropDownHeight="auto":i._cellEditors[n].element.dropDownHeight=200}return i._cellEditors[n]}_getDateRangeInputCellEditor(e){const t=this,i=t._getEditorId(e);if(!t._cellEditors[i]){const n=document.createElement("smart-date-range-input");n.dropDownButtonPosition="right",n.dropDownAppendTo="body",n.autoClose=!0,n.selectionMode="default",n.rightToLeft=t.rightToLeft,n.timepicker=!0,n.dropDownOpenPosition="auto",t._applyCellEditorUserSettings(n,e);const o=function(e){n.opened||"keydown"!==e.type||t._handleEditKeyDown(e)};n.classList.add("smart-grid-cell-editor"),n.classList.add("smart-grid-date-time-picker-cell-editor");const l=function(){Smart.Utilities.Core.isMobile||setTimeout((()=>{n.select()}),50)},a=function(e){n.value=e,n.selectedDates=[]},r=function(){return n._performSelect(),n.selectedDates},d=function(){n.value="",n.close(),n.removeEventListener("keydown",o)},s=function(e){const i=n.getAttribute("aria-controls");if(i&&n.opened){const n=t.getBoundingRect(document.getElementById(i));e.pageX<n.left||e.pageX>n.right||e.pageY<n.top||e.pageY>n.bottom||e.preventDefault()}},c=function(){n.addEventListener("keydown",o)};t._cellEditors[i]={element:n,focus:l,blur:s,setValue:a,getValue:r,attach:c,detach:d}}return t._cellEditors[i]}_getDateTimePickerCellEditor(e){const t=this,i=t._getEditorId(e);if(!t._cellEditors[i]){const n=document.createElement("smart-date-time-picker");n.calendarButton=!0,n.dropDownAppendTo="body",n.autoClose=!0,n.dropDownDisplayMode="calendar",n.rightToLeft=t.rightToLeft,n.nullable=!0,e.column.cellsFormat&&(n.formatString=e.column.cellsFormat),t._applyCellEditorUserSettings(n,e),t.selection.enabled&&!t.selection.allowCellSelection&&n.autoOpen&&(n.autoOpen=e.editor.autoOpen=!1);const o=function(e){n.opened||"keydown"!==e.type||t._handleEditKeyDown(e)};n.classList.add("smart-grid-cell-editor"),n.classList.add("smart-grid-date-time-picker-cell-editor");const l=function(){setTimeout((()=>{if(n.autoOpen&&!t.editing.editRow)n.open();else{if(Smart.Utilities.Core.isMobile)return;n.select()}}),50)},a=function(e){if("string"==typeof e&&1===e.length){if("string"==typeof e&&n.autoOpen&&"Invalid Date"===(e=new Date(e)).toString())return;n.$.input.value=e}else n.value=e},r=function(){if(n.value&&n.value instanceof Smart.Utilities.DateTime){if(""===n.$.input.value)return n._validateValue(n.$.input.value,null),null;const e=Smart.Utilities.DateTime.ParseDate(n.$.input.value,n.formatString);return n._validateValue(e),n.value.toDate()}return n.value},d=function(){n.value="",n.close(),n.removeEventListener("keydown",o)},s=function(e){const i=n.getAttribute("aria-controls");if(i&&n.opened){const n=t.getBoundingRect(document.getElementById(i));e.pageX<n.left||e.pageX>n.right||e.pageY<n.top||e.pageY>n.bottom||e.preventDefault()}},c=function(){n.addEventListener("keydown",o)};t._cellEditors[i]={element:n,focus:l,blur:s,setValue:a,getValue:r,attach:c,detach:d}}return t._cellEditors[i]}_getTimeInputCellEditor(e){const t=this,i=t._getEditorId(e);if(!t._cellEditors[i]){const n=document.createElement("smart-time-input");n.calendarButton=!0,n.dropDownAppendTo="body",n.autoClose=!0,n.dropDownDisplayMode="calendar",n.rightToLeft=t.rightToLeft,t._applyCellEditorUserSettings(n,e);const o=function(e){n.opened||"keydown"!==e.type||t._handleEditKeyDown(e)};n.classList.add("smart-grid-cell-editor"),n.classList.add("smart-grid-date-time-picker-cell-editor");const l=function(){Smart.Utilities.Core.isMobile||setTimeout((()=>{n.select()}),50)},a=function(e){n.value=e},r=function(){const e=new Date;return e.setHours(n.value[0]),e.setMinutes(n.value[1]),"Invalid Date"===e.toString()?new Date:e},d=function(){n.value="",n.close(),n.removeEventListener("keydown",o)},s=function(e){const i=n.getAttribute("aria-controls");if(i&&n.opened){const n=t.getBoundingRect(document.getElementById(i));e.pageX<n.left||e.pageX>n.right||e.pageY<n.top||e.pageY>n.bottom||e.preventDefault()}},c=function(){n.addEventListener("keydown",o)};t._cellEditors[i]={element:n,focus:l,blur:s,setValue:a,getValue:r,attach:c,detach:d}}return t._cellEditors[i]}_getDateInputCellEditor(e){const t=this,i=t._getEditorId(e);if(!t._cellEditors[i]){const n=document.createElement("smart-date-input");n.calendarButton=!0,n.dropDownAppendTo="body",n.autoClose=!0,n.dropDownDisplayMode="calendar",n.rightToLeft=t.rightToLeft,n.formatString=(!e.column.cellsFormat||1!==e.column.cellsFormat.length&&"d"!==e.column.cellsFormat)&&e.column.cellsFormat?e.column.cellsFormat:"MM/dd/yyyy",n.dropDownOpenPosition="auto",t._applyCellEditorUserSettings(n,e),t.selection.enabled&&!t.selection.allowCellSelection&&n.autoOpen&&(n.autoOpen=e.editor.autoOpen=!1);const o=function(e){n.opened?"Enter"!==e.key&&"Escape"!==e.key||t._handleEditKeyDown(e):"keydown"!==e.type||t._handleEditKeyDown(e)};n.classList.add("smart-grid-cell-editor"),n.classList.add("smart-grid-date-time-picker-cell-editor");const l=function(){setTimeout((()=>{if(e.editor.autoOpen&&!t.editing.editRow)n.open();else{if(Smart.Utilities.Core.isMobile)return;n.select()}}),50)},a=function(e){"string"==typeof e&&e.length>1&&"Invalid Date"===(e=new Date(e)).toString()||(n.value=e)},r=function(){return n.getValue()},d=function(){n.value="",n.close(),n.removeEventListener("keydown",o)},s=function(e){const i=n.getAttribute("aria-controls");if(i&&n.opened){const n=t.getBoundingRect(document.getElementById(i));e.pageX<n.left||e.pageX>n.right||e.pageY<n.top||e.pageY>n.bottom||e.preventDefault()}},c=function(){n.addEventListener("keydown",o)};t._cellEditors[i]={element:n,focus:l,blur:s,setValue:a,getValue:r,attach:c,detach:d}}return t._cellEditors[i]}_getAttachmentCellEditor(e){const t=this,i=t._getEditorId(e);if(t._dialogFile&&(t._dialogFile.cell=e),!t._cellEditors[i]){const n=document.createElement("div");n.innerHTML=`\n <div style="display: grid;"><div title="${t.localize("addFiles")}" class="smart-grid-icon smart-icon-plus show"></div><div class="attachments"><div class="container"></div></div></div>\n `,n.rightToLeft=t.rightToLeft,n.tabIndex=0,n.firstElementChild.style.gridTemplateColumns="25px 1fr",t.rightToLeft&&(n.style.direction="rtl");const o=n.querySelector(".smart-grid-icon"),l=n.querySelector(".attachments");o.onpointerdown=()=>{t._openFileDialog(t._dialogFile?t._dialogFile.cell:e,!0)},l.onclick=e=>{const i=JSON.parse(n.value),o=[...l.children[0].children].indexOf(e.target.parentNode);if(i[o]){const e=document.createElement("a");if(i[o].value.indexOf(window.location.host)>=0)fetch(i[o].value).then((e=>e.blob())).then((t=>{const n=URL.createObjectURL(t);e.download=i[o].label,e.href=n,e.click()}));else{if(i[o].value.indexOf("base64")>=0){const n=t._getFileFromBase64(i[o].value);e.href=URL.createObjectURL(n)}else e.href=i[o].value;e.target="_blank",e.click()}}},n.ondrop=i=>{i.preventDefault(),t._openFileDialog(t._dialogFile?t._dialogFile.cell:e,!0),t._dialogFile.dropZone.dropHere(i)},n.ondragover=e=>{e.preventDefault()},t._applyCellEditorUserSettings(n,e),n.classList.add("smart-grid-cell-editor");const a=function(){n.focus(),setTimeout((()=>{n.focus()}),50)},r=function(e){n.value=e,l.innerHTML=`<div class="container"><div style="justify-content: center; align-items: center; display: flex; margin-top: 3px;" class="smart-drop-file smart-micro smart-quiet">${t.localize("dropFiles")}</div></div>`;const i=l.firstElementChild;if(t._findIsFile(e)){let t="";try{t=JSON.parse(e)}catch(e){console.log(e)}e=t}Array.isArray(e)&&(i.innerHTML="",e.forEach((e=>{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"),e.label.indexOf("png")>=0||e.label.indexOf("jpg")>=0||e.label.indexOf("jpeg")>=0||e.label.indexOf("gif")>=0?t.firstElementChild.classList.add("smart-icon-image"):e.label.indexOf(".pdf")>=0?t.firstElementChild.classList.add("smart-icon-pdf"):e.label.indexOf(".tsv")>=0||e.label.indexOf(".txt")>=0||e.label.indexOf(".csv")>=0?t.firstElementChild.classList.add("smart-icon-text"):e.label.indexOf(".xls")>=0||e.label.indexOf(".xlsx")>=0?t.firstElementChild.classList.add("smart-icon-excel"):e.label.indexOf(".ppt")>=0?t.firstElementChild.classList.add("smart-icon-powerpoint"):e.label.indexOf(".zip")>=0||e.label.indexOf(".rar")>=0||e.label.indexOf(".7z")>=0?t.firstElementChild.classList.add("smart-icon-archive"):e.label.indexOf(".doc")>=0||e.label.indexOf(".docx")>=0?t.firstElementChild.classList.add("smart-icon-word"):t.firstElementChild.classList.add("smart-icon-file"),i.appendChild(t)})))},d=function(){let e=n.value;return e&&(Array.isArray(e)||("string"==typeof e&&e.indexOf("base64"))>=0)&&Array.isArray(e)&&(e=JSON.stringify(e)),e},s=i=>{("+"===i.key||i.altKey&&"ArrowDown"===i.key)&&t._openFileDialog(t._dialogFile?t._dialogFile.cell:e.true),"Escape"===i.key&&t.cancelEdit(),"Enter"===i.key&&t.endEdit()},c=function(){n.value="",t._dialogFile&&t._dialogFile.close(),n.removeEventListener("keydown",s)},u=function(){},m=function(){n.addEventListener("keydown",s)};t._cellEditors[i]={element:n,focus:a,blur:u,setValue:r,getValue:d,attach:m,detach:c}}return t._cellEditors[i]}_getImageCellEditor(e){const t=this,i=t._getEditorId(e);if(t._dialogFile&&(t._dialogFile.cell=e),!t._cellEditors[i]){const n=document.createElement("div");n.innerHTML=`\n <div style="display: grid;"><div title="${t.localize("addImages")}" class="smart-grid-icon smart-icon-plus show"></div><div class="images"><div class="container"></div></div></div>\n `,n.rightToLeft=t.rightToLeft,n.tabIndex=0,n.firstElementChild.style.gridTemplateColumns="25px 1fr",t.rightToLeft&&(n.style.direction="rtl");const o=n.querySelector(".smart-grid-icon"),l=n.querySelector(".images");o.onpointerdown=()=>{t._openFileDialog(t._dialogFile?t._dialogFile.cell:e)},l.onclick=e=>{"IMG"===e.target.nodeName&&t._openImagePreviewDialog(e.target)},n.ondrop=i=>{i.preventDefault(),t._openFileDialog(t._dialogFile?t._dialogFile.cell:e),t._dialogFile.dropZone.dropHere(i)},n.ondragover=e=>{e.preventDefault()},t._applyCellEditorUserSettings(n,e),n.classList.add("smart-grid-cell-editor");const a=function(){n.focus(),setTimeout((()=>{n.focus()}),50)},r=function(e){n.value=e,l.innerHTML=`<div class="container"><div style="justify-content: center; align-items: center; display: flex; margin-top: 3px;" class="smart-drop-image smart-micro smart-quiet">${t.localize("dropImages")}</div></div>`;const i=l.firstElementChild;if(t._findIsFile(e)){let t="";try{t=JSON.parse(e)}catch(e){console.log(e)}e=t}e&&"string"==typeof e&&e.indexOf("./")>=0&&(e=(e=e.split(",")).map((e=>({label:e,value:e})))),Array.isArray(e)&&(i.innerHTML="",e.forEach((e=>{const n=document.createElement("img");n.style.display="none";let o="";o=e.small?e.small:e.medium?e.medium:e.large?e.large:e.value,n.onload=()=>{n.style.display=""},o.indexOf("base64")>=0?n.src=o:(t._imagesCache||(t._imagesCache=[]),t._imagesCache[o]?t.uploadSettings.url?t._findUserFile(e)?(n.src=o,n.setAttribute("data-url",e.large||e.value),n.style.display=""):n.style.display="none":(n.src=o,n.setAttribute("data-url",e.large||e.value)):(t._imagesCache[o]=!0,n.style.display="none",t.uploadSettings.url?t._findUserFile(e)?(n.src=o,n.setAttribute("data-url",e.large||e.value),n.style.display=""):n.style.display="none":(n.src=o,n.style.display="")),n.onerror=()=>{n.style.display="none"}),i.appendChild(n)})))},d=function(){let e=n.value;return e&&(Array.isArray(e)||("string"==typeof e&&e.indexOf("base64"))>=0)&&Array.isArray(e)&&(e=JSON.stringify(e)),e},s=i=>{("+"===i.key||i.altKey&&"ArrowDown"===i.key)&&t._openFileDialog(t._dialogFile?t._dialogFile.cell:e),"Escape"===i.key&&t.cancelEdit(),"Enter"===i.key&&t.endEdit()},c=function(){n.value="",t._dialogFile&&t._dialogFile.close(),t._dialogImagePreview&&t._dialogImagePreview.close(),n.removeEventListener("keydown",s)},u=function(){},m=function(){n.addEventListener("keydown",s)};t._cellEditors[i]={element:n,focus:a,blur:u,setValue:r,getValue:d,attach:m,detach:c}}return t._cellEditors[i]}_getPhoneCellEditor(e){const t=this,i=t._getEditorId(e);if(!t._cellEditors[i]){const n=document.createElement("smart-phone-input");n.rightToLeft=t.rightToLeft,t._applyCellEditorUserSettings(n,e);const o=function(e){n.opened||"keydown"!==e.type||t._handleEditKeyDown(e)};n.classList.add("smart-grid-cell-editor"),n.classList.add("smart-grid-phone-input-cell-editor");const l=function(){Smart.Utilities.Core.isMobile||setTimeout((()=>{n.select()}),50)},a=function(e){n.value=e?t._fromHTMLEntities(e):"",e&&1===e.length&&(n.$.input.value=e,n.$.input.selectionStart=n.$.input.selectionEnd=n.$.input.value.indexOf(e)+1),t._phoneNumbers&&t._phoneNumbers[e]&&(n.selectedCountry=t._phoneNumbers[e])},r=function(){return t._phoneNumbers||(t._phoneNumbers=[]),n.value&&(t._phoneNumbers[n.value]=n.selectedCountry),n.value},d=function(){n.value="",n.removeEventListener("keydown",o)},s=function(){},c=function(){n.addEventListener("keydown",o)};t._cellEditors[i]={element:n,focus:l,blur:s,setValue:a,getValue:r,attach:c,detach:d}}return t._cellEditors[i]}_getPasswordCellEditor(e){const t=this,i=t._getEditorId(e);if(!t._cellEditors[i]){const n=document.createElement("smart-password-input");n.rightToLeft=t.rightToLeft,t._applyCellEditorUserSettings(n,e);const o=function(e){n.opened||"keydown"!==e.type||t._handleEditKeyDown(e)};n.classList.add("smart-grid-cell-editor"),n.classList.add("smart-grid-password-input-cell-editor");const l=function(){Smart.Utilities.Core.isMobile||setTimeout((()=>{n.select()}),50)},a=function(e){n.value=e,1===e.length&&(n.$.input.selectionStart=n.$.input.selectionEnd=n.$.input.value.indexOf(e)+1)},r=function(){return n.value},d=function(){n.value="",n.removeEventListener("keydown",o)},s=function(){},c=function(){n.addEventListener("keydown",o)};t._cellEditors[i]={element:n,focus:l,blur:s,setValue:a,getValue:r,attach:c,detach:d}}return t._cellEditors[i]}_getMaskCellEditor(e){const t=this,i=t._getEditorId(e);if(!t._cellEditors[i]){const n=document.createElement("smart-masked-text-box");n.rightToLeft=t.rightToLeft,t._applyCellEditorUserSettings(n,e);const o=function(e){n.opened||"keydown"!==e.type||t._handleEditKeyDown(e)};n.classList.add("smart-grid-cell-editor"),n.classList.add("smart-grid-masked-text-box-cell-editor");const l=function(){Smart.Utilities.Core.isMobile||setTimeout((()=>{n.select()}),50)},a=function(e){n.value=e,1===e.length&&(n.$.input.selectionStart=n.$.input.selectionEnd=n.$.input.value.indexOf(e)+1)},r=function(){return n.value},d=function(){n.value="",n.removeEventListener("keydown",o)},s=function(){},c=function(){n.addEventListener("keydown",o)};t._cellEditors[i]={element:n,focus:l,blur:s,setValue:a,getValue:r,attach:c,detach:d}}return t._cellEditors[i]}_getNumberInputCellEditor(e){const t=this,i=t._getEditorId(e);if(!t._cellEditors[i]){const n=document.createElement("smart-number-input");if(e&&e.editor&&(void 0!==e.editor.min&&(e.editor.min=parseInt(e.editor.min)),void 0!==e.editor.max&&(e.editor.max=parseInt(e.editor.max))),t._applyCellEditorUserSettings(n,e),"{}"===JSON.stringify(n.numberFormat)){let i={};if(e.column.cellsFormat)if(e.column.cellsFormat.indexOf("c")>=0){i={style:"currency",currency:t.messages[t.locale].calendar.currency};let n=parseInt(e.column.cellsFormat.substring(1));isNaN(n)||(i.maximumFractionDigits=n)}else if(e.column.cellsFormat.indexOf("p")>=0){i={style:"percent"};let t=parseInt(e.column.cellsFormat.substring(1));isNaN(t)||(i.maximumFractionDigits=t,i.minimumFractionDigits=t)}else if(e.column.cellsFormat.indexOf("d")>=0){i={style:"decimal"};let t=parseInt(e.column.cellsFormat.substring(1));isNaN(t)||(i.maximumFractionDigits=t)}else if(e.column.cellsFormat.indexOf("f")>=0||e.column.cellsFormat.indexOf("n")>=0){i={};let t=parseInt(e.column.cellsFormat.substring(1));isNaN(t)||(i.minimumFractionDigits=t,i.maximumFractionDigits=t)}else e.column.Intl&&e.column.Intl.NumberFormat&&(i=e.column.Intl.NumberFormat);n.numberFormat=i}n.classList.add("smart-grid-cell-editor"),n.classList.add("smart-grid-number-input-cell-editor");const o=function(e){t._handleEditKeyDown(e)},l=function(){Smart.Utilities.Core.isMobile||setTimeout((function(){n.focus(),t.$.scrollView.scrollTop=0}),50)},a=function(){},r=function(e){n.isReady&&("string"==typeof e&&n.numberFormat&&n.numberFormat.style&&"percent"===n.numberFormat.style&&(e=parseFloat(e),e=""+(e/=100)),null!==e&&""!==e||(e=0),n.setValue(e))},d=function(){return n.getValue()},s=function(){n.removeEventListener("keydown",o)},c=function(){n.addEventListener("keydown",o)};t._cellEditors[i]={element:n,focus:l,blur:a,getValue:d,setValue:r,attach:c,detach:s}}return t._cellEditors[i]}_getRatingCellEditor(e){const t=this,i=t._getEditorId(e);if(!t._cellEditors[i]){const n=document.createElement("div");n.classList.add("smart-input"),n.classList.add("smart-grid-cell-editor"),n.classList.add("smart-grid-rating-cell-editor"),n.tabIndex=0;const o=e.column.editor.max?e.column.editor.max:5,l=e.value,a=l?parseInt(l):0;if(n.value=l,n.firstElementChild&&n.firstElementChild.hasAttribute("value")){if(a===n.firstElementChild.getAttribute("value"))return t.cell._setStyle(n),void t.setAttribute("template",t.cell.template)}let r='<div class="rating">';for(let e=0;e<o;e++){let t="";a>0&&a>e&&(t="value"),r+=`<div title="${e+1}" value="${e+1}" class="smart-grid-icon show smart-icon-star ${t}"></div>`}r+="</div>",n.innerHTML=r;const d=function(){},s=function(e){if(" "!==e.key){switch(e.key){case"ArrowLeft":case"ArrowDown":case"ArrowRight":case"ArrowUp":if(t.editing.dialog.enabled)return;t.endEdit()}t._handleEditKeyDown(e)}else d()},c=e=>{let t="";n.value===e&&(e=0);for(let i=0;i<o;i++){let n="";e>0&&e>i&&(n="value"),t+=`<div title="${i+1}" value="${i+1}" class="smart-grid-icon show smart-icon-star ${n}"></div>`}t+="",n.firstElementChild.innerHTML=t,n.value=e};n.firstElementChild.onpointerdown=e=>{if(e.target.hasAttribute("value")){const t=e.target.getAttribute("value");c(t)}},n.firstElementChild.onpointermove=e=>{if(e.target.hasAttribute("value")){const t=[...e.target.parentElement.children],i=t.indexOf(e.target);t.forEach(((e,t)=>{e.classList.remove("hover"),t<=i&&e.classList.add("hover")}))}},n.firstElementChild.onpointerleave=e=>{if(e.target.classList.contains("rating")){const t=[...e.target.children];t.indexOf(e.target);t.forEach(((e,t)=>{e.classList.remove("hover")}))}};const u=function(e){c(e)},m=function(){},g=function(){return n.value},p=function(){n.value=!1,n.removeEventListener("click",d),n.removeEventListener("keydown",s)},f=function(){},h=function(){n.addEventListener("keydown",s),n.addEventListener("click",d)};t._cellEditors[i]={getValue:g,setValue:u,focus:m,blur:f,element:n,detach:p,attach:h}}return t._cellEditors[i]}_getCheckBoxCellEditor(e){const t=this,i=t._getEditorId(e);if(!t._cellEditors[i]){const e=document.createElement("div");e.classList.add("smart-input"),e.classList.add("smart-grid-cell-editor"),e.classList.add("smart-grid-check-box-cell-editor"),e.tabIndex=0;const n=function(){!0!==e.value&&!1!==e.value&&null!==e.value&&(e.value=!1),null===e.value?e.value=!1:e.value=!e.value,!1===e.value?e.removeAttribute("checked"):e.setAttribute("checked",e.value?"":"indeterminate")},o=function(e){if(" "!==e.key){switch(e.key){case"ArrowLeft":case"ArrowDown":case"ArrowRight":case"ArrowUp":if(t.editing.dialog.enabled)return;t.endEdit()}t._handleEditKeyDown(e)}else n()},l=function(t){e.value="string"==typeof t?"false"!==t&&"0"!==t&&"null"!==t&&"undefined"!==t:t,!1===e.value?e.removeAttribute("checked"):e.setAttribute("checked",e.value?"":"indeterminate")},a=function(){Smart.Utilities.Core.isMobile||(e.focus(),setTimeout((function(){e.focus()}),25))},r=function(){return e.value},d=function(){e.value=!1,e.removeEventListener("click",n),e.removeEventListener("keydown",o)},s=function(){},c=function(){e.addEventListener("keydown",o),e.addEventListener("click",n)};t._cellEditors[i]={getValue:r,setValue:l,focus:a,blur:s,element:e,detach:d,attach:c}}return t._cellEditors[i]}_unescapeString(e){if(null==e)return e;if("string"!=typeof e)return e;const t=[{regex:"&",entity:"&amp;"},{regex:">",entity:"&gt;"},{regex:"<",entity:"&lt;"},{regex:'"',entity:"&quot;"},{regex:"'",entity:"&#39;"},{regex:"=",entity:"&#x3D;"},{regex:"/",entity:"&#x2F;"},{regex:"`",entity:"&#x60;"}];let i;for(let n in t)i=new RegExp(t[n].entity,"g"),e=e.replace(i,t[n].regex);return e}_fromHTMLEntities(e){const t=this,i=t._textArea?t._textArea:document.createElement("textarea");return i.innerHTML=e,t._textArea=i,i.value}_toHtmlEntities(e){return e.replace(/[^a-z0-9\s]/gmu,(e=>"&#"+e.codePointAt(0)+";"))}_getEditorValue(e){const t=this,i=t._getEditorId(e);if(!t._cellEditors)return;const n=t._cellEditors[i];if(!n)return;const o=function(t){switch(e.column.dataType){case"string":null==t?t="":void 0!==t&&"number"==typeof t?t=parseFloat(t):t&&"object"==typeof t&&t[0]&&t[0].label?t=t[0].label.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/'/g,"&#39;").replace(/"/g,"&quot;").replace(/[\r\n]+/g," ").replace(/\p{Extended_Pictographic}/gu,(e=>"&#"+e.codePointAt(0)+";")):t&&"object"==typeof t&&t instanceof Date?t=t.toLocaleString():"richText"===e.column.template?t=t.replace(/<script/g,"&lt;script").replace(/script>/g,"&gt;script"):"textarea"===e.column.editor.template?t=(t=t.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/'/g,"&#39;").replace(/"/g,"&quot;").replace(/\p{Extended_Pictographic}/gu,(e=>"&#"+e.codePointAt(0)+";"))).replaceAll("\t"," "):t.replace&&(t=(t=t.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/'/g,"&#39;").replace(/"/g,"&quot;").replace(/[\r\n]+/g," ").replace(/\p{Extended_Pictographic}/gu,(e=>"&#"+e.codePointAt(0)+";"))).replaceAll("\t"," "));break;case"float":case"int":case"number":t="int"===e.column.dataType?parseInt(t):parseFloat(t),isNaN(t)&&(t=0);break;case"bool":case"boolean":"true"!==t&&"1"!==t||(t=!0),"false"!==t&&"0"!==t||(t=!1);break;case"date":if(t instanceof Date)return t;"string"==typeof t&&(t=new Date(t));break;case"dateTime":t=new Smart.Utilities.DateTime(t)}return t};let l=null;switch(e.editor.template){case"dateRangeInput":try{l=n.getValue()}catch(t){l=e.value}if(e.editor.getValue){const t=e.editor.getValue(e,l);void 0!==t&&(l=t)}break;case"input":case"autoComplete":case"numberInput":case"slider":case"dateInput":case"timeInput":case"deteTimePicker":case"checkBox":try{l=o(n.getValue())}catch(t){l=e.value}if(e.editor.getValue){const t=e.editor.getValue(e,l);void 0!==t&&(l=t)}break;case"multiComboInput":case"attachment":case"image":l=n.getValue();break;default:l=o(n.getValue())}let a=!0,r=!1,d=!1;if(e.column.validator)a=e.column.validator.evaluate(l,e.row.data);else if("string"==typeof l){const t=e.editor.minLength||e.editor.min||0,i=e.editor.maxLength||e.editor.max||999999;(l.length<t||l>i)&&(a=!1),l.length<t&&(r=!0),l.length>i&&(d=!0),e.editor.required&&0===l.length&&(a=!1),e.editor.instance.element&&e.editor.instance.element.checkValidity&&(a=e.editor.instance.element.checkValidity())}if(a)return l;let s=null;const c=e.editor.instance.element;return c&&(s=c.validity,s&&(s.custom&&delete s.custom,r&&(s.custom={minLength:!0,value:e.editor.min}),d&&(s.custom={maxLength:!0,value:e.editor.max}),s.message=c.validationMessage)),{error:!0,validity:s,value:l}}_beginRowEdit(e,t){const i=this;if(e===i.editing.editRow)return!1;if(i.editing.editRow){if(!i.endEdit())return!1}const n=e.cells;i.editing.editRow=e,i.editing.commandColumn.visible&&(i.editing.isEditing=!1,i.refresh(),i.editing.isEditing=!0),e.isEditing=!0;let o=!1;for(let e=0;e<n.length;e++){const l=n[e],a=l.column;if(!a.allowEdit||!1===a._visible)continue;const r=i._beginCellEdit(l);if(r){if(!0!==i.editing.recordNavigation&&i.editing.enabled){if(Smart.Utilities.Core.isMobile)continue;let e=!0;switch(l.editor.template){case"textarea":case"slider":e=!1}e&&(t?l===t&&l.editor.instance.focus():r&&!o&&(o=!0,l.editor.instance.focus()))}i.editing.commandColumn.visible&&l.column.commandColumn&&l.render()}}return!0}_beginCellEdit(e,t){const i=this;if(e.isEditing&&"checkBox"!==e.column.template)return!1;if(i._isUpdating)return!1;if(i.onCellBeginEdit){if(!i.onCellBeginEdit(e.row.id,e.column.dataField,e.value,i))return!1}if(e.column.allowEdit&&"function"==typeof e.column.allowEdit){if(!e.column.allowEdit(e.row.id,e.column.dataField,e.value,e.row.data,i))return!1}let n=!1;if(e.column.autoGenerated&&e.column.rowHeaderColumn&&i.editing.allowRowHeaderEdit&&new Date-i._clickTime<i.behavior.doubleClickTimingDelay&&i._clickedCell===e.element&&(n=!0),(!e.column.allowEdit||e.column.autoGenerated||e.readonly)&&!n)return!1;if(i.editing.editCell&&!i.editing.editRow){i._fireEndEdit=!0;if(!1===i._endCellEdit())return!1}if(i._cellEditors||(i._cellEditors=[]),i.editing.editRow||(i.editing.editCell=e),i.editing.commandColumn.visible&&!i.editing.editRow&&(i.editing.isEditing=!1,i.refresh(),i.editing.isEditing=!0),!e.row.element)return!1;e.row.element.setAttribute("edit",""),i.editing.isEditing=!0,i._selection.selectionRect&&i._selection.selectionRect.classList.add("smart-visibility-hidden");const o=t=>{const n=t.element;i.editing.dialog.enabled?(i._settingsDialogRowId=e.row.id,i._openEditDialog(e,t)):(e.element||e.createElement(),e.element.setAttribute("editor","string"==typeof e.editor.template?e.editor.template:"template"),e.element.content.innerHTML="",e.element.content.appendChild(n),e.column.cellsWrap||e.element.content.classList.add("nowrap"),i.editing.editRow&&e.element.setAttribute("row-editor","")),t.attach(),e.editor.row=e.row,e.editor.column=e.column,e.editor.cell=e,e.editor.instance=t,e.isEditing=!0},l=i._cellsUpdatedValues?i._cellsUpdatedValues[e.row.id+"_"+e.column.dataField]:void 0;let a=void 0!==l?l:e.value;if(void 0===a){a="";const t=e.column;"number"===t.dataType||"int"===t.dataType||"float"===t.dataType?a=0:"date"===t.dataType&&(a=new Date,a.setHours(0,0,0))}switch(e.editor||(e.editor="input"),"string"==typeof e.editor&&(e.canNotify=!1,e.editor={template:e.editor,autoFocus:!0},e.canNotify=!0),e.editor.template){default:case"custom":{const t=i._getCustomCellEditor(e);o(t),t.setValue(a);break}case"attachment":{const t=i._getAttachmentCellEditor(e);o(t),t.setValue(a);break}case"image":{const t=i._getImageCellEditor(e);o(t),t.setValue(a);break}case"rating":{const t=i._getRatingCellEditor(e);o(t);let n=parseInt(a);isNaN(n)&&(n=0),t.setValue(n);break}case"checkBox":{const n=i._getCheckBoxCellEditor(e);o(n);const l=!0===a||1===a;if("checkBox"===e.template&&t){(i.enableShadowDOM?i.shadowRoot:i.getRootNode()).elementsFromPoint(t.clientX,t.clientY)[0].classList.contains("smart-input")?n.setValue(!l):n.setValue(l)}else n.setValue(l);break}case"autoComplete":{const t=i._getAutoCompleteCellEditor(e);o(t),t.setValue(a),e.editor.autoOpen&&!i.editing.editRow&&t.element.open();break}case"list":case"dropDownList":{e.editor.autoOpen=!0,e.editor.readonly=!0,e.editor.dropDownButtonPosition="right";const t=i._getAutoCompleteCellEditor(e);o(t),t.setValue(a),e.editor.autoOpen&&!i.editing.editRow&&t.element.open();break}case"comboBox":{e.editor.readonly=!1,e.editor.dropDownButtonPosition="right";const t=i._getAutoCompleteCellEditor(e);o(t),t.setValue(a),e.editor.autoOpen&&!i.editing.editRow&&t.element.open();break}case"password":{const t=i._getPasswordCellEditor(e);o(t),t.setValue(a);break}case"phone":{const t=i._getPhoneCellEditor(e);o(t),t.setValue(a);break}case"maskedTextBox":{const t=i._getMaskCellEditor(e);o(t),t.setValue(a);break}case"multiInput":{const t=i._getAutoCompleteCellEditor(e,"smart-multi-input");o(t),t.setValue(a),e.editor.autoOpen&&!i.editing.editRow&&t.element.open();break}case"checkInput":{const t=i._getAutoCompleteCellEditor(e,"smart-check-input");o(t),t.setValue(a),e.editor.autoOpen&&!i.editing.editRow&&t.element.open();break}case"tags":case"multiComboInput":{e.editor.readonly=!0,e.editor.autoOpen=!0;const t=i._getMultiComboInputCellEditor(e);o(t),t.setValue(a),e.editor.autoOpen&&!i.editing.editRow&&t.element.open();break}case"timeInput":{const t=i._getTimeInputCellEditor(e);o(t),t.setValue(a),e.editor.autoOpen&&!i.editing.editRow&&t.element.open();break}case"dateInput":{const t=i._getDateInputCellEditor(e);o(t),t.setValue(a);break}case"dateRangeInput":{const t=i._getDateRangeInputCellEditor(e);o(t),t.setValue(a),e.editor.autoOpen&&!i.editing.editRow&&t.element.open();break}case"dateTimePicker":{const t=i._getDateTimePickerCellEditor(e);o(t),t.setValue(a);break}case"slider":{const t=i._getSliderCellEditor(e);o(t),t.setValue(a);break}case"colorInput":{const t=i._getColorInputCellEditor(e);o(t),t.setValue(a);break}case"textarea":case"textArea":{const t=i._getTextAreaCellEditor(e);o(t),e.formula?t.setValue(e.formula):t.setValue(a);break}case"numberInput":case"text":case"input":{const t="numberInput"===e.editor.template?i._getNumberInputCellEditor(e):i._getInputCellEditor(e);o(t),e.formula?t.setValue(e.formula):t.setValue(a);break}}if(!e.editor.isInitialized&&(e.editor.isInitialized=!0,e.editor.onInit)){const t=e.editor.onInit(e.row.index,e.column.dataField,e.editor.instance.element,e.row.data);if(t&&t instanceof Promise)t.then((t=>{const i="custom"===e.editor.template?e.editor.instance.element.firstElementChild:e.editor.instance.element;for(let e in t)i[e]=t[e]}));else if(t){const i=t,n="custom"===e.editor.template?e.editor.instance.element.firstElementChild:e.editor.instance.element;for(let e in i)n[e]=i[e]}}if(e.editor.onRender){const t=e.editor.onRender(e.row.index,e.column.dataField,e.editor.instance.element,e.row.data);if(t&&t instanceof Promise)t.then((t=>{const i="custom"===e.editor.template?e.editor.instance.element.firstElementChild:e.editor.instance.element;for(let e in t)i[e]=t[e]}));else if(t){const i=t,n="custom"===e.editor.template?e.editor.instance.element.firstElementChild:e.editor.instance.element;for(let e in i)n[e]=i[e]}}return i.editing.editCell&&e.editor.instance.focus(),"checkBox"===e.editor.template&&(i._fireEndEdit=!0,i._endCellEdit()),!0}_onColumnDoubleClick(e){this._beginColumnEdit(e)}_beginColumnEdit(e){const t=this;if(t.editing.enabled&&t.editing.allowColumnHeaderEdit&&e.allowHeaderEdit){t.editing.isEditing&&t.endEdit(),t.editing.editColumn=e,t._cellEditors||(t._cellEditors=[]);const i=t._getInputCellEditor({column:e,row:t.rows[0],editor:{template:"input"}});i.element.value=e.label,i.focus(),e.headerEditor=i,e.element.setAttribute("edit",""),e.element.label.appendChild(i.element),i.attach(),t.editing.isEditing=!0;t.$.fireEvent("beginEdit",{id:null,dataField:e.dataField,row:null,column:e,cell:null,data:null,value:null}).defaultPrevented&&t.cancelEdit()}}_endColumnEdit(e){const t=this;if(!1===t.editing.isEditing||t.editing.isEditing&&null===t.editing.editColumn)return!1;const i=t.editing.editColumn;return i.canNotify=!1,i.headerEditor.detach(),i.headerEditor.element.parentNode.removeChild(i.headerEditor.element),!0!==e&&(i.label=i.headerEditor.getValue()),i.headerEditor=null,t.editing.isEditing=!1,i.element.removeAttribute("edit"),i.element.scrollLeft=0,t.editing.editColumn=null,i.canNotify=!0,i.refresh(),t._recycle(),!0}_cancelColumnEdit(){this._endColumnEdit(!0)}_onCellClick(e,t){const i=this;if(e.row.addNewRow)e.row.inline?i._addNewGridRow():"far"===e.row.freeze?i._insertNewRowAfter():i._insertNewRowBefore();else if(!e.row.filterRow&&i.editing.enabled)if(i.editing.editColumn)i.endEdit();else{if(delete i._beginEditKey,i.editing.commandColumn.visible)if(e.column.commandColumn){const n=(i.enableShadowDOM?i.shadowRoot:i.getRootNode()).elementsFromPoint(t.clientX,t.clientY);let o=null;for(let e=0;e<n.length;e++)if(n[e].classList.contains("smart-grid-command-item")){o=n[e];break}if(o||(o=e.element.querySelector(".smart-grid-command-item")),o&&!o.classList.contains("smart-hidden")){const n=o.getAttribute("command");return void i._applyCommand(n,[e.row,t])}}else if(i.editing.commandColumn.inline){const e=(i.enableShadowDOM?i.shadowRoot:i.getRootNode()).elementsFromPoint(t.pageX,t.pageY);for(let t=0;t<e.length;t++)if(e[t].classList.contains("smart-grid-command-item"))return}if("none"===i.editing.action&&i.editing.isEditing){let t=!1;i.editing.editCell&&i.editing.editCell.row!==e.row&&(t=!0),i.editing.editRow&&i.editing.editRow!==e.row&&(t=!0),i.editing.editColumn&&(t=!0),t&&i.endEdit()}if(e.column.autoGenerated){if(i.editing.allowRowHeaderEdit&&e.column.rowHeaderColumn){if(i.editing.isEditing&&i.endEdit(),void 0!==e.row.label)return;i._beginCellEdit(e,t),i.editing.isEditing&&i.$.fireEvent("beginEdit",{id:e.row.id,dataField:e.column.dataField,row:e.row,column:e.column,cell:e,data:e.row.data,value:e.value})}}else if("click"===i.editing.action&&(!i.selection.enabled||e.selected||"extended"!==i.selection.mode))if("cell"===i.editing.mode){const n=e.parent();if(void 0!==e.row.label)return;if("rating"===e.column.template)return void(i._handleRatingClick&&i._ratingElement&&i._handleRatingClick(i._ratingElement));!i._autoHeight&&i.ensureVisible(e.row.id,e.column.dataField),setTimeout((function(){if(n)i._beginCellEdit(n,t),i.$.fireEvent("beginEdit",{id:n.row.id,dataField:n.column.dataField,row:n.row,column:n.column,cell:n,data:n.row.data,value:n.value});else{i._beginCellEdit(e,t);i.$.fireEvent("beginEdit",{id:e.row.id,dataField:e.column.dataField,row:e.row,column:e.column,cell:e,data:e.row.data,value:e.value}).defaultPrevented&&i.cancelEdit()}}),25)}else if("row"===i.editing.mode){if(void 0!==e.row.label)return;i._beginRowEdit(e.row,e,t);i.$.fireEvent("beginEdit",{id:e.row.id,dataField:e.column.dataField,row:e.row,column:e.column,cell:e,data:e.row.data,value:e.value}).defaultPrevented&&i.cancelEdit()}}}_onCellDoubleClick(e,t){const i=this;i.editing.enabled&&("doubleClick"!==i.editing.action||i.editing.isEditing||e.column.autoGenerated||("cell"===i.editing.mode?i._beginCellEdit(e,t):"row"===i.editing.mode&&i._beginRowEdit(e.row,e,t)))}_onRowClick(){}_onRowDoubleClick(){}beginEdit(e,t){const i=this,n=i.rowById[e];n&&i._beginEdit(n,t)}cancelEdit(){const e=this;if(e.editing.isEditing){if(e._errorOverlay){if(e._errorOverlay.remove(),e._errorMessage.remove(),e.editing.editCell&&(e.editing.editCell.error=""),e.editing.editRow){const t=e.editing.editRow.cells;for(let e=0;e<t.length;e++){t[e].error=""}e.editing.editRow.element.removeAttribute("error"),e.editing.editRow.error=null}e._isUpdating=!1}if(e.editing.editRow){const t=e.editing.editRow.cells;for(let e=0;e<t.length;e++){const i=t[e],n=i.element;0===e&&i.row.element.removeAttribute("edit"),n&&(n.removeAttribute("editor"),n.removeAttribute("error"),n.content.innerHTML=""),i.isEditing=!1}e.editing.editRow=null}else e.editing.editCell?(e.editing.editCell.row.element.removeAttribute("edit"),e.editing.editCell.row.element.removeAttribute("error"),e.editing.editCell.element.removeAttribute("editor"),e.editing.editCell.element.removeAttribute("error"),e.editing.editCell.element.content.innerHTML="",e.editing.editCell.isEditing=!1,e.editing.editCell=null):e.editing.editColumn&&e._cancelColumnEdit();e.editing.dialog.visible&&e.editing.dialog.enabled&&e._dialogEdit.close(),e.editing.isEditing=!1,e._recycle(!1),e.editing.commandColumn.visible&&e.refresh(),e.$.fireEvent("cancelEdit"),e.focus()}}deleteColumn(e){const t=this,i=this.columns.findIndex((t=>t.dataField===e));i>=0&&t.columns.splice(i,1)}removeRow(e,t){return this.deleteRow(e,t)}deleteRow(e,t){const i=this;if(e&&Array.isArray(e)){if(i.onRowRemove){if(!1===i.onRowRemove(e,i))return}i.beginUpdate();const n=i.dataSource.canNotify,o=i.rows.canNotify;i.rows.canNotify=!1,i.dataSource.canNotify=!1;const l=i.onRowRemoved;i.onRowRemoved=null;let a=[];for(let n in e){const o=i.rowById[e[n]];let l=o&&o.data&&o.data.$?o.data.$.index:o.index;a.push(l),i.deleteRow(e[n],t),i.dataSource.removeAt(l)}return i.rows.canNotify=o,i.dataSource.canNotify=n,i.onRowRemoved=l,i.endUpdate(),i._refreshSummary(),void(l&&l(e,a,i))}const n=i.rowById[e];if(!n)return!1;const o=function(e){if(!0===i.editing.batch||i.editing.batch&&i.editing.batch.indexOf("delete")>=0)i._batchDeleteRow(e);else{if(i.dataSource&&i.dataSource.virtualDataSource)return i._editInfo={row:e.data},void i._virtualDataRequest("remove",(function(n){if(n){const n=i.rows.indexOf(e);i.rows.splice(n,1),delete i.rowById[e.id],t&&t(e)}}));const n=i.rows.indexOf(e);i._removeAt(n)}t&&t(e)};return i.editing.deleteDialog.enabled?i._openDeleteRowDialog(n,o):o(n),!0}addRow(e,t,i){const n=this;e||(e={});for(let t=0;t<n.columns.length;t++){const i=n.columns[t];void 0!==i.defaultValue&&void 0===e[i.dataField]&&(e[i.dataField]=i.defaultValue)}if(void 0===t&&(t=!0),n.dataSource&&n.dataSource.virtualDataSource)n._editInfo={row:e},n._virtualDataRequest("add",(o=>{o&&(n._add(e,t?n.rows.length:0),i&&i(t?n.rows[n.rows.length-1]:n.rows[0]))}));else{if(n.editing.batch)return void(t?n._insertNewRowAfter(i):n._insertNewRowBefore(i));"number"==typeof t?n._add(e,t,i):n._add(e,t?n.rows.length:0,i)}}insertRow(e,t,i){this.addRow(e,t,i)}flashCell(e,t){const i=this;i._flashTimer&&clearTimeout(i._flastTimer),i.highlightedCells&&i.highlightedCells[e]&&(i.highlightedCells[e][t]="off_smart-flash-cell"),i.highlightCell(e,t,"smart-flash-cell"),i._flashTimer=setTimeout((()=>{i.highlightedCells&&i.highlightedCells[e]&&(i.highlightedCells[e][t]="off_smart-flash-cell",delete i.highlightedCells[e][t])}),2e3)}highlightCell(e,t,i){const n=this,o=n.rowById[e],l=n.columnByDataField[t];o&&l&&(n.highlightedCells||(n.highlightedCells=[]),n.highlightedCells[e]||(n.highlightedCells[e]=[]),void 0!==n.highlightedCells[e][t]?i?n.highlightedCells[e][t].startsWith("off")?n.highlightedCells[e][t]=i||"":n.highlightedCells[e][t]="off_"+i:delete n.highlightedCells[e][t]:n.highlightedCells[e][t]=i||"",n._recycle(!1))}highlightRow(e,t){const i=this;i.rowById[e]&&(i.highlightedRows||(i.highlightedRows=[]),void 0!==i.highlightedRows[e]?t?i.highlightedRows[e].startsWith("off")?i.highlightedRows[e]=t||"":i.highlightedRows[e]="off_"+t:delete i.highlightedRows[e]:i.highlightedRows[e]=t||"",i._recycle(!1))}highlightColumn(e,t){const i=this.columnByDataField[e];i.highlight=!i.highlight,i._highlightCSS=t,this._recycle(!1)}setRowProperty(e,t,i){const n=this.rowById[e];n&&(n[t]=i)}getRowProperty(e,t){const i=this.rowById[e];if(i)return i[t]}getColumn(e){if(!this.columnByDataField)return null;const t=this.columnByDataField[e];return t||null}getColumnProperty(e,t){if(!this.columnByDataField)return null;const i=this.columnByDataField[e];return i?i[t]:void 0}setColumnProperty(e,t,i){const n=this.columnByDataField[e];n&&(n[t]=i)}getCellValue(e,t){const i=this.rowById[e],n=this.columnByDataField[t];if(!i||!n)return;return i.getCell(t).value}setCellValue(e,t,n,o){const l=this,a=l.rowById[e],r=l.columnByDataField[t];if(!a||!r)return!1;if(l.formulas&&n&&"string"==typeof n){const e=a.getCell(t);if(e){if(e.formula!==n){const t=e.canNotify;e.canNotify=!1,n.startsWith("=")?e.formula=l._unescapeString(n):e.formula=null,e.canNotify=t}if(n.startsWith("=")&&e.formula){const t=l._formulaParser;if(t){let i=t.parse(e.formula.slice(1));n=isNaN(i)?"#VALUE!"===n?0:"#ERROR!"===n?"#ERROR!":i:i}}}}let d=[];if(r.validationRules&&r.validationRules.length>0&&(d=((e,t)=>{let n=[];for(let o of e){switch(o.type){case"min":n.min=i.min(t,o.value);break;case"max":n.max=i.max(t,o.value);break;case"minLength":n.minLength=i.minLength(t,o.value);break;case"maxLength":n.maxLength=i.maxLength(t,o.value);break;case"minDate":n.minDate=i.minDate(t,o.value);break;case"maxDate":n.maxDate=i.maxDate(t,o.value);break;case"required":n.required=i.required(t);break;case"requiredTrue":n.requiredTrue=i.requiredTrue(t);break;case"pattern":n.pattern=i.pattern(t,o.value);break;case"email":n.email=i.email(t);break;case"null":n.null=i.null(t)}null===n[o.type]&&delete n[o.type]}return n})(r.validationRules,n),Object.keys(d).length>0))return!1;const s=()=>{if(!0===l.editing.batch||l.editing.batch&&l.editing.batch.indexOf("update")>=0){const e=a.getCell(t);return l._batchUpdateCell(e.row,e.column,n,e.value),o&&o(a),void l._recycle()}l.beginUpdate();const e=a.getCell(t);l._setCellUndoRedo(e,e.value,n),e.value=n,l.endUpdate(),o&&o(a)};if(l.dataSource&&l.dataSource.virtualDataSource){l.dataSource.id?a[l.dataSource.id]=e:a.id||(a.id=e);const i={};for(let e=0;e<l.columns.length;e++){const o=l.columns[e],r=a.getCell(o.dataField);i[o.dataField]=r.value,o.dataField===t&&(i[o.dataField]=n)}l._editInfo={row:i},l._virtualDataRequest("update",(function(e){e&&s(),l.appearance.displayLoadingIndicator=!1,l._setLoadingIndicatorVisibility()}))}else s()}setRowData(e,t){this.updateRow(e,t,null)}getRowData(e){const t=this.rowById[e];if(!t)return null;const i=JSON.parse(JSON.stringify((e=>{const t={};for(let i in e)"leaf"!==i&&"data"!==i&&"$"!==i&&"children"!==i&&"parent"!==i&&"history"!==i&&"comments"!==i&&"style"!==i&&(t[i]=e[i]);return t})(t.data)));return delete i.$,i}getRow(e){const t=this.rowById[e];return t||null}forEachRow(e){const t=this;if(e)for(let i=0;i<t.rows.length;i++)e(t.rows[i])}forEachRowAfterFilterAndSort(e){const t=this;if(e)for(let i=0;i<t._recyclingRows.length;i++)e(t._recyclingRows[i])}getRowById(e){return this.rowById[e]}getRowByIndex(e){const t=this.rows[e];return t||null}getRowId(e){const t=this.rows[e];if(!t)return null;return t.id}validateRow(e,t){const n=this;if(!n.rowById[e])return!1;const o=(e,t)=>{let n={};for(let o of e)switch(o.type){case"min":n.min=i.min(t,o.value);break;case"max":n.max=i.max(t,o.value);break;case"minLength":n.minLength=i.minLength(t,o.value);break;case"maxLength":n.maxLength=i.maxLength(t,o.value);break;case"minDate":n.minDate=i.minDate(t,o.value);break;case"maxDate":n.maxDate=i.maxDate(t,o.value);break;case"required":n.required=i.required(t);break;case"requiredTrue":n.requiredTrue=i.requiredTrue(t);break;case"pattern":n.pattern=i.pattern(t,o.value);break;case"email":n.email=i.email(t);break;case"null":n.null=i.null(t)}let o={};return Object.keys(n).forEach((e=>{const t=n[e];t&&(o[e]=t)})),o},l=[];for(let e=0;e<n.columns.length;e++){const i=n.columns[e];let a=[];if(void 0!==t[i.dataField])if(i.validationRules&&i.validationRules.length>0){let e=t[i.dataField];e&&e.error&&(e=e.value),a=o(i.validationRules,e),Object.keys(a).length>0&&(l[i.dataField]=a)}else{let e=null,n=t[i.dataField];n&&n.error&&(e=n.validity,n=n.value);for(let t in e)e[t]&&"valid"!==t&&"message"!==t&&(a[t]=!0),("custom"===t&&e[t].minLength||"custom"===t&&e[t].maxLength)&&(a[t]=!0);Object.keys(a).length>0&&(l[i.dataField]=a)}}return l}_getGroupAncestorSignature(e){const t=[];let i=e.parent;for(;i;)t.push({groupDataField:i.groupDataField,label:i.label}),i=i.parent;return JSON.stringify(t)}_getExpandedGroups(e){const t=this,i=[];if(!e)return[];return function e(n){n.forEach((n=>{n.expanded&&i.push({groupDataField:n.groupDataField,label:n.label,ancestorSignature:t._getGroupAncestorSignature(n)}),n.children&&n.children.length>0&&!1===n.children[0].leaf&&e(n.children)}))}(e),i}_updateRow(e,t,i){const n=this,o=n.rowById?n.rowById[e]:n.dataSource.dataItemById[e];if(!o)return;if(void 0===t)return;let l=[];n.dataSource&&n.dataSource.groupBy&&n.dataSource.groupBy.toArray&&(l=n.dataSource.groupBy.toArray().slice(0));const a=n.dataSource.boundSource.canNotify;n.dataSource.boundSource.canNotify=!1;const r=e=>{if(o.data[e]=t[e],n.dataSource.id&&o&&o.data&&o.data.$&&(o.data.$.id=t[n.dataSource.id]),o&&o.data.$&&void 0!==o.data.$.index){const i=o.data.$.index,a=n.dataSource.dataSource,r=()=>{const i=t[e];if(null==i){const t=n.columnByDataField[e];return t?"number"===t.dataType?0:"boolean"!==t.dataType&&("date"===t.dataType?new Date:""):""}return i};if(a&&a[i]&&(a[i][e]=r()),n.dataSource[i]){if(l.length>0&&!n._dirtyHierarchy){if(n.dataSource[i][e]!==r()&&l.indexOf(e)>=0){const e=n._getExpandedGroups(n.dataSource.boundHierarchy);n._dirtyHierarchy=e}}n.dataSource[i][e]=r()}}};let d=[];for(let e=0;e<n.columns.length;e++){const i=n.columns[e];void 0!==t&&(void 0!==t[i.dataField]&&(d[i.dataField]=!0,r(i.dataField)))}if(i){const e=n.dataSource.dataFields;if(e)for(let t=0;t<e.length;t++)d[e[t].name]||(e[t].map?r(e[t].map):r(e[t].name))}n.dataSource.boundSource.canNotify=a,n.__updating||n.dataSource.refreshHierarchy()}updateRow(e,t,i){const n=this,o=n.rowById[e];if(!o)return!1;const l=n.validateRow(e,t);if(Object.keys(l).length>0)return!1;const a=()=>{if(!0===n.editing.batch||n.editing.batch&&n.editing.batch.indexOf("update")>=0){for(let e in t){if("$"===e)continue;const i=o.getCell(e);i?o.data[e]&&(o.data[e]=t[e]):(n._batchUpdateCell(i.row,i.column,t[e],i.value),n._recycle())}i&&i(o)}else{n.beginUpdate();for(let e in t){if("$"===e)continue;const i=o.getCell(e);i?i.value=t[e]:o.data[e]&&(o.data[e]=t[e])}n.endUpdate(),i&&i(o)}};n.dataSource&&n.dataSource.virtualDataSource?(n.dataSource.id?t[n.dataSource.id]=e:t.id||(t.id=e),n._editInfo={row:t},n._virtualDataRequest("update",(function(e){e&&a(),n.appearance.displayLoadingIndicator=!1,n._setLoadingIndicatorVisibility()}))):n.onRowUpdate?n.onRowUpdate([e],[o],[o.data],[t],(e=>{e&&a()}),n):a()}addUnboundRow(e,t){const i=this;void 0===e&&(e=1),void 0===t&&(t="far"),i._nearRowsAdded||(i._nearRowsAdded=[],i._farRowsAdded=[]),i._unboundRows||(i._unboundRows=[]),i.beginUpdate();for(let n=0;n<e;n++){const e=Smart.Utilities.Core.createGUID().replace(/-/gi,""),n=new Smart.Grid.Row({index:-1,unbound:!0,id:e,grid:i});i.rowById[n.id]=n,"far"===t?i._farRowsAdded.push(n):i._nearRowsAdded.push(n),i._unboundRows.push(n)}i.endUpdate()}addNewRow(e){const t=this;"near"===e?t._insertNewRowBefore():t._insertNewRowAfter()}_updateRowHistory(e,t,i){const n=this;if(!n._currentUser||n._currentUser&&(!n._currentUser.info||"guest"===n._currentUser.info))return;const o="taskChecklist",l="taskColor",a="taskDueDate",r="taskPriority",d="taskProgress",s="taskStartDate",c="taskStatus",u="taskTags",m="taskText",g="taskDescription",p="taskUserId",f=()=>({user:n._currentUser.info.id,date:e.updatedDate}),h=[];if(i[p]!==t[p]){const n=f();n.action="user";let o=!0;t[p]||i[p]||(o=!1),o&&(n.details={oldValue:t[p],value:i[p]},e.addHistory(n)),h.push(p)}if(""+i[a]!=""+t[a]){const n=f();n.action="deadline",n.details={oldValue:t[a]?new Date(t[a]).toLocaleDateString():"",value:new Date(i[a]).toLocaleDateString()},e.addHistory(n),h.push(a)}if(""+i[s]!=""+t[s]){const n=f();n.action="deadline",n.details={oldValue:t[s]?new Date(t[s]).toLocaleDateString():"",value:new Date(i[s]).toLocaleDateString()},e.addHistory(n),h.push(s)}if(i[l]!==t[l]){const n=f();n.action="color",n.details={oldValue:t[l],value:i[l]},e.addHistory(n),h.push(c)}if(i[c]!==t[c]){const n=f();n.action="status",n.details={oldValue:t[c],value:i[c]},e.addHistory(n),h.push(c)}if(JSON.stringify(i[o])!==JSON.stringify(t[o])){const n=f();n.action="subtasks";let l=t[o],a=i[o];const r=e=>{let t=[];if(!e)return"";for(let i=0;i<e.length;i++)t.push(e[i].text+": "+(e[i].completed?"Y":"N"));return t.toString()};l=r(l),a=r(a),n.details={oldValue:l,value:a},e.addHistory(n),h.push(o)}else h.push(o);if(void 0!==i[d]&&parseFloat(i[d])!==parseFloat(t[d])){let n=!0;if(null===t[d]&&0===parseFloat(i[d])&&(n=!1),null===(null===t[d]&&i[d])&&(n=!1),n){const n=f();n.action="progress",n.details={oldValue:t[d]?100*t[d]+"%":"0%",value:100*i[d]+"%"},e.addHistory(n)}h.push(d)}if(i[g]!==t[g]){const n=f();n.action="description",n.details={oldValue:t[g],value:i[g]},e.addHistory(n),h.push(g)}if(i[r]!==t[r]){const n=f();n.action="priority",n.details={oldValue:t[r],value:i[r]},e.addHistory(n),h.push(r)}if(i[u]!==t[u]){const n=f();n.action="tags",n.details={oldValue:t[u],value:i[u]},e.addHistory(n),h.push(u)}if(i[m]!==t[m]){const n=f();n.action="text",n.details={oldValue:t[m],value:i[m]},e.addHistory(n),h.push(m)}for(let o=0;o<n.columns.length;o++){const l=n.columns[o].dataField;let a=t[l],r=i[l];if("image"===n.columns[o].template&&(a&&"string"==typeof a&&(a.indexOf("[{")>=0?(a=JSON.parse(a),a=a.map((e=>e.label)),a=a.toString()):a=""),null==a&&(a=""),r&&"string"==typeof r&&(r.indexOf("[{")>=0?(r=JSON.parse(r),r=r.map((e=>e.label)),r=r.toString()):r=""),null==r&&(r="")),-1===h.indexOf(l)&&a!==r){const t=f();"date"===n.columns[o].dataType?(r&&"string"==typeof r&&(r=new Date(r)),a&&"string"==typeof a&&(a=new Date(a))):"string"==typeof r&&(r=r.replaceAll("\\"," ").replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/'/g,"&#39;").replace(/"/g,"&quot;").replace(/[\r\n]+/g," ").replace(/\p{Emoji}/gu,(e=>"&#"+e.codePointAt(0)+";"))),t.action=l,t.details={oldValue:a,value:r},e.addHistory(t)}}n.onRowHistory&&(n._tempRowHistory||(n._tempRowHistory=[]),n._tempRowHistory[e.index]={index:e.index,row:e,history:e.history},n._tempRowHistoryTimer&&clearTimeout(n._tempRowHistoryTimer),n._tempRowHistoryTimer=setTimeout((()=>{const e=[],t=[],i=[];for(let o in n._tempRowHistory)t.push(o),e.push(n._tempRowHistory[o].row),i.push(n._tempRowHistory[o].history);n.onRowHistory(t,e,i,n),delete n._tempRowHistory}),50))}_stringifyRow(e){const t=this;let i={};for(let n=0;n<t.columns.length;n++){const o=t.columns[n];i[o.dataField]=e.data[o.dataField]}return i=JSON.parse(JSON.stringify(i)),i}endEdit(){const e=this;let t=!1,i=null;e.editing.dialog.enabled&&e.editing.dialog.visible&&e._dialogEdit&&e._dialogEdit.close();let n=null,o=null,l=null;e._fireEndEdit=!0;let a=null,r=null,d=null;if(e.editing.editRow){o=e.editing.editRow,i=e.editing.editRow.id;let n=null;if(e.storeHistory&&(n=e._stringifyRow(o)),t=e._endRowEdit(),a=n,t&&!e.onRowUpdate&&(o.updatedDate=new Date,o.updatedBy=e.currentUser,e.storeHistory)){const t=e._stringifyRow(o);e._updateRowHistory(o,n,t)}}else if(e.editing.editCell){o=e.editing.editCell.row,l=e.editing.editCell.column,n=e.editing.editCell,i=e.editing.editCell.row.id,d=!0;let s=null;e.storeHistory&&(s=e._stringifyRow(o));const c=void 0!==n.value?n.value:"";r=c,a=s;let u=!1;const m=t=>{if(t!==c){if(o.updatedDate=new Date,o.updatedBy=e.currentUser,e.storeHistory){const i=e._stringifyRow(o);i[n.column.dataField]=t,e._updateRowHistory(o,s,i)}u=!0}};if(e.onCellUpdate&&e.onRowHistory){const t=e.onRowHistory;e.onRowHistory=null;m(e._getEditorValue(n)),setTimeout((()=>{e.onRowHistory=t}),100)}e._getEditorValue(n)!==c&&(o.updatedDate=new Date,o.updatedBy=e.currentUser),t=e._endCellEdit(),t&&!u&&n&&m(n.value)}else e.editing.editColumn&&(i=null,l=e.editing.editColumn,t=e._endColumnEdit());if(e._saveUnboundRows(i),e._selection.selectionRect&&e._selection.selectionRect.classList.remove("smart-visibility-hidden"),e.$.scrollView.scrollTop=0,e._fireEndEdit){e.$.fireEvent("endEdit",{id:o?o.id:null,dataField:l?l.dataField:null,row:o,column:l,cell:n,data:o?o.data:null,value:n?n.value:l?l.label:null}).defaultPrevented&&(d?e.setCellValue(o.id,l.dataField,r):e.setRowData(o.id,a))}return e._conditionalColors&&e._conditionalColors.update&&e._conditionalColors.update(o),e.summaryRow.visible&&t&&(e.editing.isEditing=!1,e._calculateSummary(),e._recycle(!1)),e._refreshDataFilters(),e._renderConditionalFormatting(),t}getEditCells(){const e=this;return e.editing.editRow?e.editing.editRow.cells:e.editing.editCell?[e.editing.editCell]:[]}getBatchEditChanges(){const e=this,t=[],i=[],n=[];for(let i in e._cellsUpdatedValues){const n=e._cellsUpdatedValues[i],o=i.substring(0,i.indexOf("_")),l=i.substring(i.indexOf("_")+1),a=e.rowById[o].getCell(l);t.push({id:o,dataField:l,oldValue:a.value,newValue:n})}if(e._rowsDeleted&&e._rowsDeleted.length>0)for(let t=0;t<e._rowsDeleted.length;t++){const n=e._rowsDeleted[t],o=e.rowById[n];i.push({id:o.id,data:o.data})}if(e._rowsAdded&&e._rowsAdded.length>0)for(let t=0;t<e._rowsAdded.length;t++){const i=e._rowsAdded[t],o=e.rowById[i];n.push({id:o.id,data:o.data})}return{updated:t,deleted:i,added:n}}saveBatchEdit(){this._saveBatchEdit()}revertBatchEdit(){this._clearBatchEdit(!0)}});const e=/^(?=.{1,254}$)(?=.{1,64}@)[-!#$%&'*+/0-9=?A-Z^_`a-z{|}~]+(\.[-!#$%&'*+/0-9=?A-Z^_`a-z{|}~]+)*@[A-Za-z0-9]([A-Za-z0-9-]{0,61}[A-Za-z0-9])?(\.[A-Za-z0-9]([A-Za-z0-9-]{0,61}[A-Za-z0-9])?)*$/;function t(e){return null==e||0===e.length}class i{static null(e){return null===e}static email(i){return t(i)||e.test(i)?null:{email:!0}}static min(e,i){return(e=>{if(t(e)||t(i))return null;const n=parseFloat(e);return!isNaN(n)&&n<i?{min:{min:i,actual:n}}:null})(e)}static max(e,i){return(e=>{if(t(e)||t(i))return null;const n=parseFloat(e);return!isNaN(n)&&n>i?{max:{max:i,actual:n}}:null})(e)}static minDate(e,i){return(e=>{if(t(e)||t(i))return null;let n=e;return e&&e instanceof Smart.Utilities.DateTime&&(n=e.toDate()),!isNaN(n)&&n<i?{min:{min:i,actual:n}}:null})(e)}static maxDate(e,i){return(e=>{if(t(e)||t(i))return null;let n=e;return e&&e instanceof Smart.Utilities.DateTime&&(n=e.toDate()),!isNaN(n)&&n>i?{max:{max:i,actual:n}}:null})(e)}static required(e){return t(e)?{required:!0}:null}static requiredTrue(e){return!0===e?null:{required:!0}}static minLength(e,i){return(e=>{if(t(e)&&0===i)return null;const n=e?e.length:0;return n<i?{minlength:{requiredLength:i,actualLength:n}}:null})(e)}static maxLength(e,t){return(e=>{const i=e?e.length:0;return i>t?{maxlength:{requiredLength:t,actualLength:i}}:null})(e)}static url(e){return/^(ftp|http|https):\/\/[^ "]+$/.test(e)?null:{pattern:{requiredPattern:'^(ftp|http|https)://[^ "]+$',actualValue:e}}}static pattern(e,n){if(!n)return i.null;let o,l;return"string"==typeof n?(l="","^"!==n.charAt(0)&&(l+="^"),l+=n,"$"!==n.charAt(n.length-1)&&(l+="$"),o=new RegExp(l)):(l=n.toString(),o=n),(e=>t(e)||o.test(e)?null:{pattern:{requiredPattern:l,actualValue:e}})(e)}}window.Smart.Validator=i})();
1457
1457
 
1458
1458
  /***/ }),
1459
1459
 
@@ -1509,7 +1509,7 @@ Smart.Utilities.Assign("Grid.Resize",class{autoSizeRows(e){const t=this,o=e||t._
1509
1509
  /***/ 1193:
1510
1510
  /***/ (() => {
1511
1511
 
1512
- Smart.Utilities.Assign("Grid.Row",class{constructor(e){const t=this;if(e||(e={}),Object.assign(t,e),e){if(void 0===t.data){const i={$:{}};if(e.grid&&e.grid.dataSource){const t=e.grid.dataSource;for(let e=0;e<t.dataFields.length;e++)i[(t.dataFields?t.dataFields[e]:{}).name]=""}else Object.assign(i,e);e.id&&(i.$.id=e.id),t.data=i}if((void 0===e.$||e.$&&void 0===e.$.id)&&(e.data?(e.data.$&&e.data.$.id&&(t.id=e.data.$.id),t.id||(t.id=e.index)):void 0===t.id&&(t.id=e.index),void 0===t.id&&(t.id=Smart.Utilities.Core.createGUID())),void 0===t.detailHeight&&(t.grid?t.detailHeight=t.grid.rowDetail.height:t.detailHeight=200),void 0===t.height&&t.grid&&(t.height=t.grid.layout.rowMinHeight,t.grid.__autoRowHeight&&(t.height=t.grid.__autoRowHeight),t.grid.layout.rowHeight&&(t.height=t.grid.layout.rowHeight)),void 0===t.cellHeight&&(t.cellHeight=t.height),void 0===t.showDetail&&(t.showDetail=!1),void 0===t.index&&(t.index=-1),void 0===t.visibleIndex&&(t.visibleIndex=-1),void 0===t.freeze&&(t.freeze=!1),void 0===t.height&&(t.height=null),void 0===t.minHeight&&(t.minHeight=25,t.grid&&(t.minHeight=t.grid.layout.rowMinHeight)),void 0===t.checked&&(t.checked=!1),void 0===t.selected?(t.selected=!1,(t.grid&&t.grid._selection.rows[t.id]||t.grid&&t.grid._selection.indexes[t.index])&&(t.selected=!0)):t.selected&&t.grid&&(t.grid._selection.rows[t.id]=!0,t.grid._selection.indexes[t.index]=t.index),void 0===t.enabled&&(t.enabled=!0),void 0===t.visible&&(t.visible=!0),void 0===t.allowCheck&&(t.allowCheck=!0),void 0===t.filtered&&(t.filtered=!0),void 0===t.allowResize&&(t.allowResize=!0),void 0===t.allowReorder&&(t.allowReorder=!0),void 0===t.allowToggle&&(t.allowToggle=!0),void 0===t.allowSelect&&(t.allowSelect=!0),void 0===t.starred&&(t.starred=!1),void 0===t.expanded&&(e.data&&void 0!==e.data.expanded?t.expanded=e.data.expanded:t.expanded=!1),t._addStyle(),t.headerCell=null,t._cells=[],t.name="",t.comments=[],!t.autoGenerated&&999999!==t.index){if(t.data){if(t.data.comments)if("string"==typeof t.data.comments&&t.data.comments.indexOf("[{")>=0&&t.data.comments.indexOf("}]")>=0)try{t.data.comments=JSON.parse(t.data.comments.replaceAll("\t"," ").replaceAll("\\"," ")).replace(/\p{Emoji}/gu,(e=>"&#"+e.codePointAt(0)+";"))}catch(e){t.data.comments=[]}else"string"==typeof t.data.comments&&t.data.comments.indexOf("[{")>=0&&-1===t.data.comments.indexOf("}]")||"string"==typeof t.data.comments&&"[]"===t.data.comments?t.data.comments=[]:t.comments=JSON.parse(JSON.stringify(t.data.comments));if(t.data.rowStyle&&(t.style=t._style=e.rowStyle),t.data.history&&(t.history=t.data.history),t.data.style&&(t.style=t._style=t.data.style,t.grid&&(t.grid._cellStyles||(t.grid._cellStyles=[]),t.grid._cellStyles["row"+t.id]=!0,t.grid._cellStyles.length++)),t.data.settings){const e=JSON.parse(t.data.settings);void 0!==e.starred&&(t.starred=e.starred),void 0!==e.height&&(t.height=t.cellHeight=e.height)}const e=t.data.$?t.data.$:t.data;if(e.history&&(t.history=e.history),"string"==typeof t.history&&t.history.indexOf("[{")>=0&&t.history.indexOf("}]")>=0)try{t.history=JSON.parse(t.history.replaceAll("\t"," ").replaceAll("\\"," ")).replace(/\p{Emoji}/gu,(e=>"&#"+e.codePointAt(0)+";"))}catch(e){t.history=[]}t.history&&t.history.length&&(e.createdDate||(e.createdDate=t.history[0].date),e.createdBy||(e.createdBy=t.history[0].user),e.updatedDate||(e.updatedDate=t.history[t.history.length-1].date),e.updatedBy||(e.updatedBy=t.history[t.history.length-1].user)),e.style&&(t.style=t._style=e.style),e.height&&(t.height=t.cellHeight=e.height),e.comments&&(t.comments=e.comments),e.starred&&(t.starred=e.starred),e.createdDate&&(t.createdDate=e.createdDate),e.createdBy&&(t.createdBy=e.createdBy),e.updatedDate&&(t.updatedDate=e.updatedDate),e.updatedBy&&(t.updatedBy=e.updatedBy)}t.grid&&t.grid._currentUser&&t.grid._currentUser.info&&(void 0===t.createdBy?(t.createdBy=t.grid._currentUser.info.id,t.createdDate||(t.createdDate=new Date)):t.createdDate||(t.createdDate=new Date),t.history||(t.history=[],t.addHistory({action:"created",user:t.grid._currentUser.info.id,details:{value:t.name},date:t.createdDate})))}}}_addStyle(){this.style=this._style={background:"",color:"",status:"",fontSize:"",fontFamily:"",fontWeight:"",textDecoration:"",fontStyle:""}}setStyle(e){const t=this;t._style||t._addStyle(),["background","color","fontSize","status","fontFamily","fontWeight","textDecoration","fontStyle"].forEach((i=>{e[i]&&(t._style[i]=e[i])})),t.grid&&(t._style._changed=!0,t.grid._recycle(!1))}get properties(){return["allowToggle","allowResize","allowSelect","allowReorder","allowCheck","createdDate","updatedDate","createdBy","updatedBy","canNotify","children","starred","checked","cells","detailHeight","detailTemplate","cellHeight","expandHeight","data","enabled","expanded","filtered","freeze","grid","headerCell","height","index","id","minHeight","unbound","name","selected","showDetail","visible","parent","leaf","visibleIndex","history","comments","style"]}createElement(){const e=document.createElement("smart-grid-row");return this.element=e,e.setAttribute("role","row"),e._initialize(this),e}_autoSize(e){const t=this,i=t.grid;if(!i)return;let l=i.layout.rowMinHeight;void 0!==t.minHeight&&(l=t.minHeight);const a=t.element;if(e||(e=t),e&&(t.data=e.data),!a)return t.height;i.__autoHeightRows||(i.__autoHeightRows=[]);const r=(e,t,a)=>{if(!a||!t||t.autoGenerated)return 0;i.__autoHeightRows[t.dataField]||(i.__autoHeightRows[t.dataField]=[]);let r=""+e.data[t.dataField];"date"===t.dataType&&e.data[t.dataField]&&(r=""+e.data[t.dataField].toLocaleString());let n=r.length;e._templatesHeight&&e._templatesHeight[t.dataField]&&(n=e._templatesHeight[t.dataField]);const o=i.__autoHeightRows[t.dataField][n],d=o||function(e){a.style.height="auto",t.cellsWrap?a.content.classList.add("wrap"):a.content.classList.add("nowrap");let i=0;if(e&&t)if(t.template){const l=e.canNotify;if(e.canNotify=!1,a.cell.row=e,"function"==typeof t.template)if(a.content.textContent=e.data[t.dataField],e._templatesHeight&&e._templatesHeight[t.dataField])i=e._templatesHeight[t.dataField];else{const i={row:e,column:t,cell:a.cell,oldValue:a.cell.oldValue,value:a.cell.value,template:null,isMeasuring:!0},l=a.innerHTML,r=a.cell.canNotify;a.cell.canNotify=!1,a.cell.template(i),a.cell.canNotify=r,i.template?(a.content.textContent="",a.innerHTML=l):a.content.textContent=e.data[t.dataField]}else a._setTemplate(e.data[t.dataField]||"",t.template,a.content);e.canNotify=l}else if("date"===t.dataType){const i=a.cell.getFormattedValue(e.data[t.dataField],t.cellsFormat);a.content.textContent=i}else a.content.textContent=e.data[t.dataField];let l=a.offsetHeight;return"function"==typeof t.template&&i>0&&(l=i),a.style.height="",a.content.classList.remove("wrap"),a.content.classList.remove("nowrap"),l}(e);l=Math.max(l,d),i.__autoHeightRows[t.dataField][n]=d};for(let t=0;t<i._frozenNearColumns.length;t++)r(e,i._frozenNearColumns[t],a.children[0].children[t]);for(let t=0;t<i._frozenFarColumns.length;t++)r(e,i._frozenFarColumns[t],a.children[2].children[t]);for(let t=0;t<a.children[1].children.length;t++)r(e,i._columnElements[t].column,a.children[1].children[t]);return l}addHistory(e){const t=this;e&&(t.grid.storeHistory?(void 0===t.history&&(t.history=[]),t.history.length===t.grid.storeHistoryItems&&t.history.splice(0,1),Array.isArray(t.history)||(t.history=[]),t.history.push(e)):t.history=[])}clearHistory(){this.history=[]}autoSize(){const e=this,t=e.grid._measureRowElement(e.data),i=e.data?t.row._autoSize(e):e.grid.layout.rowMinHeight;e.height=i,t.remove()}getCell(e){const t=this,i=t.grid;if(!i)return null;if("string"!=typeof e&&"number"!=typeof e||(e=i.columnByDataField[e]),!e)return null;if(t["column_"+e.dataField]){const i=t["column_"+e.dataField];return i.column=e,i}{const l=new Smart.Grid.Cell(t,e,i);return t["column_"+e.dataField]=l,l}}get cells(){const e=this;return e._cells&&e.grid&&e._cells.length===e.grid.columns.length||e.createCells(),e._cells}get viewCells(){const e=this,t=[];for(let i=0;i<e.grid.viewColumns.length;i++){const l=e.grid.viewColumns[i];if(e["column_"+l.dataField]){const i=e["column_"+l.dataField];t.push(i)}else{const i=new Smart.Grid.Cell(e,l,e.grid);e["column_"+l.dataField]=i,t.push(i)}}return e._viewCells=t,t}createCells(){const e=this,t=e.grid;e._cells=[];for(let i=0;i<t.viewColumns.length;i++){const l=t.viewColumns[i];if(!l.autoGenerated)if(e["column_"+l.dataField]){const t=e["column_"+l.dataField];e._cells.push(t)}else{const i=new Smart.Grid.Cell(e,l,t);e["column_"+l.dataField]=i,e._cells.push(i)}}}toggle(e){this.element._handleExpandCollapse(!this.expanded,e)}select(){this.setProperty("selected",!0)}unselect(){this.setProperty("selected",!1)}expand(){this.element&&this.element._handleExpandCollapse(!0)}collapse(){this.element&&this.element._handleExpandCollapse(!1)}render(){const e=this;e.element.row=e,e.element._render()}setProperty(e,t){const i=this,l=i.getProperty(e);i[e]=t,l!==t&&(i.canNotify=!1,i.propertyChanged(e,l,t),i.canNotify=!0)}getProperty(e){const t=this;if("selected"===e&&t.grid){let i=!1;t.grid._selection.cells["row"+t.id]&&(i=null),t.grid&&t.grid._selection.rows[t.id]&&(i=!0),t.grid&&t.grid._selection.indexes[t.index]&&(i=!0),t.grid&&t.grid.dataSource.virtualDataSource&&!t.grid.dataSource.id&&(i=void 0!==t.grid._selection.indexes[t.index]);const l=t.grid.rows.canNotify;return t.grid.rows.canNotify=!1,t[e]=i,t.grid.rows.canNotify=l,i}return t[e]}_updateData(){const e=this;e.data&&e.data.$&&["updatedBy","updatedDate","createdDate","createdBy","starred","comments","history","style"].forEach((t=>{void 0!==e.data.$[t]?(e[t]=e.data.$[t],"style"===t&&(e._style=e[t],e._style._changed=!0)):"starred"===t?e[t]=!1:"comments"===t||"history"===t?e[t]=[]:"updatedBy"===t?e[t]=-1:"updatedDate"===t?e[t]=null:"style"===t&&(e._addStyle(),e._style._changed=!0)}))}propertyChanged(e,t,i){const l=this;if("updatedBy"!==e&&"createdBy"!==e&&"userData"!==e&&"starred"!==e&&"style"!==e&&"history"!==e&&"updatedDate"!==e&&"createdDate"!==e&&"comments"!==e){if("showDetail"===e){if(l.grid.rowDetail.enabled&&!l.grid.rowDetail.dialog.enabled&&(l.height=0),l.showDetail)if(l.element){if(l.grid._openRowSettingsDialog&&!l.grid.onRowDetailInit)return void(l.grid.editing.dialog.visible||(l._settingsDialogRowId=l.id,l.grid._openRowSettingsDialog(l.id)))}else if(l.createElement(),l.grid._openRowSettingsDialog&&!l.grid.onRowDetailInit)return void(l.grid.editing.dialog.visible||(l._settingsDialogRowId=l.id,l.grid._openRowSettingsDialog(l.id)));const e=l.element.rowDetail;if(l.grid.appearance.allowRowDetailToggleAnimation&&!l.grid.rowDetail.dialog.enabled){l.grid._resizeHandling=!1;const t=function(e){const t=l.grid._toggledRow;!t||"transform"!==e.propertyName&&"height"!==e.propertyName||a(t)},a=function(e){e.grid.$.content.style.transition="",e.element.rowDetail.removeEventListener("transitionend",t),e.element.rowDetail.removeEventListener("transitioncancel",t),e.grid._toggledRow=null,e.element.removeAttribute("has-detail"),l.grid._refresh(),setTimeout((()=>{l.grid._resizeHandling=!0}),50)};l.grid._toggledRow=l,e.addEventListener("transitionend",t),e.addEventListener("transitioncancel",t),i?(l.element.setAttribute("has-detail",""),l.element.toggleDetailButton.removeAttribute("toggled"),l.element.toggleDetailButton.classList.remove("smart-animate"),setTimeout((()=>{l.element.toggleDetailButton.classList.add("smart-animate"),l.element.toggleDetailButton.setAttribute("toggled",""),l.element.setAttribute("show-detail","")})),l.element.style.height=l.cellHeight+l.detailHeight+"px",l.grid._autoHeight&&(l.grid.$.content.style.transition="0.25s height ease-in-out",l.grid.$.content.style.height=parseInt(l.grid.$.content.style.height)+l.detailHeight+"px",l.grid.$.scrollView.style.height="auto"),e.classList.remove("smart-hidden"),e.style.height!==l.detailHeight+"px"&&(e.style.height=l.detailHeight+"px"),e.style.lineHeight!==l.detailHeight+"px"&&(e.style.lineHeight=l.detailHeight+"px"),e.style.top!==l.cellHeight+"px"&&(e.style.top=l.cellHeight+"px")):(l.element.setAttribute("has-detail",""),l.element.toggleDetailButton.removeAttribute("toggled"),l.grid._autoHeight&&(l.grid.$.content.style.transition="0.25s height ease-in-out",l.grid.$.content.style.height=parseInt(l.grid.$.content.style.height)-l.detailHeight+"px",l.grid.$.scrollView.style.height="auto"),setTimeout((()=>{l.element.style.height=l.cellHeight+"px",l.element.removeAttribute("show-detail")})))}else l.grid.rowDetail.enabled&&!l.grid.rowDetail.dialog.enabled?l.grid._refresh():l.grid._recycle()}if("allowCheck"!==e&&"allowSelect"!==e||l.grid._recycle(),"checked"===e&&(l.grid.checkBoxes.hasThreeStates&&l.grid._hasThreeStates(l,l),l.grid._recycle()),"selected"===e){if(!1===l.allowSelect)return;if(i?(l.grid._selection.rows[l.id]=!0,l.grid._selection.indexes[l.index]=l.index):!1===i&&(void 0!==l.grid._selection.rows[l.id]&&delete l.grid._selection.rows[l.id],void 0!==l.grid._selection.indexes[l.index]&&delete l.grid._selection.indexes[l.index]),!l.element)return;i?l.element.setAttribute("aria-selected",!0):l.element.removeAttribute("aria-selected"),l.grid._recycle()}"visible"===e&&l.grid.refresh(),"expanded"===e&&(l.expandHeight||l.grid.refresh()),"height"===e&&(l.expandHeight||l.cellHeight!==i&&(l.cellHeight=i,l.grid.refresh())),"minHeight"===e&&(l.height=null,l.grid.refresh()),"freeze"===e&&(!0===i||"near"===i?l.grid._frozenNearRows.push(l):"far"===i?l.grid._frozenFarRows.push(l):(l.grid._frozenNearRows.splice(l.grid._frozenNearRows.indexOf(l),1),l.grid._frozenFarRows.splice(l.grid._frozenFarRows.indexOf(l),1)),l.grid.refresh())}else l.data&&l.data.$&&(l.data.$[e]=i,"style"===e&&(l._style=i,l._style._changed=!0))}}),Smart("smart-grid-row",class extends Smart.BaseElement{static get properties(){return{}}get isUtilityElement(){return!0}get hasStyleObserver(){return!1}addThemeClass(){}addDefaultClass(){}_initialize(e){const t=this,i=e.grid,l=i._columnElements,a=i._frozenNearColumns,r=i._frozenFarColumns,n=document.createElement("div"),o=document.createElement("div"),d=document.createElement("div"),s=document.createDocumentFragment(),c=document.createDocumentFragment(),h=document.createDocumentFragment();i.rightToLeft?(o.classList.add("far","smart-grid-cell-container"),n.classList.add("center","smart-grid-cell-container"),d.classList.add("near","smart-grid-cell-container")):(o.classList.add("near","smart-grid-cell-container"),n.classList.add("center","smart-grid-cell-container"),d.classList.add("far","smart-grid-cell-container")),t._properties=[],t.row=e,e.createCells(),t._mouseEnter=function(){if(!i.isScrolling&&!i.editing.isEditing&&(t.commandBar&&(t.commandBar.parentNode.removeChild(t.commandBar),t.commandBar=null),i.editing.enabled&&i.editing.commandColumn.visible&&i.editing.commandColumn.inline&&!t.commandBar)){const e=document.createElement("div"),l=i._getCommandColumnCommandsTemplate();e.classList.add("smart-grid-command-bar"),e.innerHTML=l,n.appendChild(e),requestAnimationFrame((()=>{e.classList.add("show")})),i._updateCommandColumnCommandsVisibility(e,t.row),e.onmousedown=function(e){const l=e.composedPath();let a=null;for(let e=0;e<l.length;e++)if(l[e].classList.contains("smart-grid-command-item")){a=l[e];break}if(a){const l=a.getAttribute("command");i._applyCommand(l,[t.row]),t.commandBar&&(t.commandBar.parentNode.removeChild(t.commandBar),t.commandBar=null),t.removeAttribute("hover"),e.stopPropagation(),e.preventDefault()}},t.commandBar=e}},t._mouseLeave=function(){i.isScrolling||i.editing.isEditing||t.commandBar&&(t.commandBar.classList.remove("show"),t.commandBar.addEventListener("transitionend",(function(){t.commandBar&&(t.commandBar.parentNode.removeChild(t.commandBar),t.commandBar=null)})),t.commandBar.addEventListener("transitioncancel",(function(){t.commandBar&&(t.commandBar.parentNode.removeChild(t.commandBar),t.commandBar=null)})))},t.addEventListener("mouseenter",t._mouseEnter),t.addEventListener("mouseleave",t._mouseLeave);for(let t=0;t<a.length;t++){const i=a[t],l=e.getCell(i).createElement();c.appendChild(l)}for(let t=0;t<r.length;t++){const i=r[t],l=e.getCell(i).createElement();h.appendChild(l)}for(let i=0;i<l.length;i++){const a=l[i],r=a.column;if(!a.parentNode||!r)break;const n=e.getCell(r).createElement();r&&r._treeColumn&&(t.toggleButton=n.toggleButton),s.appendChild(n)}o.appendChild(c),n.appendChild(s),d.appendChild(h);const g=document.createElement("div");g.classList.add("smart-grid-row-detail","smart-hidden","smart-animate");const m=document.createElement("div");m.classList.add("smart-grid-row-sub-container","smart-hidden");const u=document.createElement("div");u.classList.add("smart-grid-row-card-container","smart-hidden"),t._rowFragment=document.createDocumentFragment(),t._rowFragment.appendChild(o),t._rowFragment.appendChild(n),t._rowFragment.appendChild(d),t._rowFragment.appendChild(g),t._rowFragment.appendChild(m),t._rowFragment.appendChild(u),t.appendChild(t._rowFragment),t.cellsNearContainerElement=t.children[0],t.cellsContainerElement=t.children[1],t.cellsFarContainerElement=t.children[2],t.rowDetail=t.children[3],t.rowContainer=t.children[4],t.rowCardContainer=t.children[5],i.layout.rowHeight&&"auto"!==i.layout.rowHeight&&(e.filterRow?t.style.height=i.layout.rowMinHeight+"px":t.style.height=i.layout.rowHeight+"px"),delete t._rowFragment}get enableShadowDOM(){return!1}_handleExpandCollapse(e,t){const i=this,l=i.row,a=l.grid;if(!l.allowToggle)return null;a._toggledRow=l;let r={row:l,id:l.id};t&&(r.originalEvent=t.originalEvent),a.$.fireEvent(e?"rowExpand":"rowCollapse",r);const n=a.dataSource.virtualDataSourceOnExpand&&e&&!0!==l.data._loaded;if(e?a.dataSource._expandedRowIds[l.data.$.id]=!0:delete a.dataSource._expandedRowIds[l.data.$.id],a.stateSettings.autoSave&&a.saveState(null,["expandedRows"]),!a.appearance.allowRowToggleAnimation||n)a.rows.canNotify=!1,l.expanded=e,a.rows.canNotify=!0,l.data.expanded=e,n?(l.data._loaded=!0,l.element.querySelector("button").setAttribute("load",""),a._virtualDataRequest("expand")):(a._toggledRow=null,a._refresh()),n&&a.appearance.allowRowToggleAnimation&&(i.toggleButton.removeAttribute("toggled"),i.toggleButton.classList.remove("smart-animate"),setTimeout((()=>{i.toggleButton.classList.add("smart-animate"),i.toggleButton.setAttribute("toggled","")}),50));else{const t=function(e){e.height=e.cellHeight,a.$.content.style.transition="",e.element.rowContainer.innerHTML="",e.element.rowContainer.classList.add("smart-hidden"),e.element.rowContainer.removeEventListener("transitionend",r),e.element.rowContainer.removeEventListener("transitioncancel",r),e.element.rowContainer.style.height="",e.element.rowContainer.style.transform="",e.element.rowContainer.style.transition="",e.element.rowContainer.classList.remove("smart-animate"),e.element.toggleButton&&e.element.toggleButton.classList.remove("smart-animate"),a._refresh()},r=function(e){const l=a._toggledRow;i._toggleTimer=null,a._toggledRow=null,!l||"transform"!==e.propertyName&&"height"!==e.propertyName||setTimeout((()=>{t(l)}),50)};if(i._toggleTimer){clearTimeout(i._toggleTimer);const e=a._toggledRow;a._toggledRow=null,t(e)}i._toggleTimer=setTimeout((()=>{const t=function(){!function(){const e=a._toggledRow;a._refresh(),a._refreshRowHierarchy();let t=0;for(let e=0;e<a.rowHierarchy.length;e++){const i=a.rowHierarchy[e];let l=i.parent;for(;l;)l.id===a._toggledRow.id&&(t+=i.height),l=l.parent}const i=a._scrollView.scrollTop,l=a._contentHeight-(e.cellHeight+e.top-i);e.expandHeight=Math.min(l,t),e.height=e.cellHeight+e.expandHeight}(),a._recycle(!1),i.style.overflow="hidden",i.style.height="auto",i.style.lineHeight=l.cellHeight+"px"};e?(l.expanded=!0,t(),i.rowContainer.style.transform="scaleY(0)",i.rowContainer.style.height="0px",i.toggleButton&&i.toggleButton.removeAttribute("toggled"),a._autoHeight&&(a.$.content.style.height=parseInt(a.$.content.style.height)-l.expandHeight+"px"),setTimeout((function(){i.toggleButton&&(i.toggleButton.classList.add("smart-animate"),i.toggleButton.setAttribute("toggled","")),i.rowContainer.addEventListener("transitionend",r),i.rowContainer.addEventListener("transitioncancel",r),a._autoHeight&&(a.$.content.style.transition="0.25s height ease-in-out",a.$.content.style.height=parseInt(a.$.content.style.height)+l.expandHeight+"px"),i.rowContainer.classList.add("smart-animate"),i.rowContainer.style.height=l.expandHeight+"px",i.rowContainer.style.transform="scaleY(1)"}))):(t(),l.expanded=!1,i.rowContainer.style.transform="scaleY(0)",i.rowContainer.style.height="0px",a._autoHeight&&(a.$.content.style.height=parseInt(a.$.content.style.height)-l.expandHeight+"px",a.$.content.style.transition="",a.$.content.style.height=parseInt(a.$.content.style.height)+l.expandHeight+"px"),i.rowContainer.style.height=l.expandHeight+"px",i.rowContainer.style.transform="scaleY(1)",i.toggleButton&&(i.toggleButton.setAttribute("toggled",""),i.toggleButton.classList.add("smart-animate")),setTimeout((function(){i.toggleButton&&i.toggleButton.removeAttribute("toggled",""),a._autoHeight&&(a.$.content.style.transition="0.25s height ease-in-out",a.$.content.style.height=parseInt(a.$.content.style.height)-l.expandHeight+"px"),i.rowContainer.addEventListener("transitionend",r),i.rowContainer.addEventListener("transitioncancel",r),i.rowContainer.classList.add("smart-animate"),i.rowContainer.style.transform="scaleY(0)",i.rowContainer.style.height="0px"}),0))}),50)}}_renderAddNewRow(){const e=this,t=e.row,i=t.grid,l=t.element,a=new Smart.Grid.Cell(t,i.columns[0],i);t.visible?l.classList.remove("smart-hidden"):l.classList.add("smart-hidden");let r=i.editing.addNewRow.label;r.indexOf("{{")>=0&&(r=i.localize("addNewRow")),l.innerHTML="<smart-grid-cell><div>"+r+"</div></smart-grid-cell>",l.firstChild.firstChild.classList.add("align-center"),l.firstChild.classList.add("smart-grid-column-border-collapse"),l.firstChild.setAttribute("freeze",""),l.firstChild.setAttribute("addNewRow",""),l.firstChild.style.width="100%",i._scrollView.vScrollBar.offsetWidth>0&&(l.firstChild.style.width="calc(100% - "+(-1+i._scrollView.vScrollBar.offsetWidth)+"px)"),l.firstChild.cell=a,i._rowGap>0&&t!==i.rows[i.rows.length-1]?(e.style.marginBottom=i._rowGap+"px",parseInt(e.style.height)-i._rowGap!==t.height&&(e.style.height=t.height-i._rowGap+"px"),parseInt(e.style.lineHeight)-i._rowGap!==t.height&&(e.style.lineHeight=t.height-i._rowGap+"px")):(e.style.marginBottom="",parseInt(e.style.height)!==t.height&&(e.style.height=t.height+"px"),parseInt(e.style.lineHeight)!==t.height&&(e.style.lineHeight=t.height+"px"))}_renderFilterRow(){const e=this,t=e.row,i=t.grid,l=t.element;t.visible?l.classList.remove("smart-hidden"):l.classList.add("smart-hidden"),l.innerHTML="<smart-grid-cell><div>"+i.localize("addNewRow")+"</div></smart-grid-cell>",l.firstChild.firstChild.classList.add("align-center"),l.firstChild.classList.add("smart-grid-column-border-collapse"),l.firstChild.setAttribute("freeze",""),l.firstChild.setAttribute("addNewRow",""),l.firstChild.style.width="100%",i._scrollView.vScrollBar.offsetWidth>0&&(l.firstChild.style.width="calc(100% - "+(-1+i._scrollView.vScrollBar.offsetWidth)+"px)"),e.style.marginBottom="",parseInt(e.style.height)!==t.height&&(e.style.height=t.height+"px"),parseInt(e.style.lineHeight)!==t.height&&(e.style.lineHeight=t.height+"px")}_renderEmpty(){this.classList.add("smart-hidden")}_renderCell(e,t,i){if(!t)return void i.classList.add("smart-hidden");let l=e.getCell(t);if(l.element!==i&&(l._styleChanged=!0),e._style&&!t.autoGenerated){const t=l._updating;l._updating=!0,e._style._changed&&(l.color=e._style.color,l.background=e._style.background,l.fontFamily=e._style.fontFamily,l.fontSize=e._style.fontSize,l.fontStyle=e._style.fontStyle,l.textDecoration=e._style.textDecoration,l.fontWeight=e._style.fontWeight);const a=i.firstElementChild,r=e=>a._style&&a._style[e]?a._style[e]:"backgroundColor"===e&&null===l.background&&""===a.style[e]||null===l[e]&&""===a.style[e]?null:a.style[e];r("backgroundColor")===l.background&&r("fontFamily")===l.fontFamily&&r("fontSize")===l.fontSize&&r("fontStyle")===l.fontStyle&&r("textDecoration")===l.textDecoration&&r("fontWeight")===l.fontWeight&&r("color")===l.color||(l._styleChanged=!0),l._updating=t}i.cell!==l&&(i.cell.background===l.background&&i.cell.borderColor===l.borderColor&&i.cell.color===l.color&&i.cell.fontSize===l.fontSize&&i.cell.fontFamily===l.fontFamily&&i.cell.textDecoration===l.textDecoration&&i.cell.fontWeight===l.fontWeight&&i.cell.fontStyle===l.fontStyle||(l._styleChanged=!0)),l.element=i,i.cell=l,t._treeColumn&&l.element.isRendered&&!e.filterRow&&l.element._refresh(),l.render(),t&&t.rowHeaderColumn&&(e.header=i,i.setAttribute("data-id",e.id))}_alternate(){const e=this,t=e.row,i=t.grid;if("card"===i.view)return void e.removeAttribute("alternation-index");const l=i.appearance.alternationStart,a=i.appearance.alternationEnd>0?i.appearance.alternationEnd:1/0;if(!(i.appearance.alternationCount<=0)&&(e.removeAttribute("alternation-index"),t.visibleIndex>=l&&t.visibleIndex<=a)){const a=(t.visibleIndex-l)%i.appearance.alternationCount;e.setAttribute("alternation-index",a)}}_openRowDetailDialog(e){const t=this,i=t.row.grid,l=t.row;if(!i.rowDetail.dialog.enabled||!l.showDetail)return!1;const a=i._dialogRowDetail||i._createDialog(i.rowDetail.dialog);if(!l.detailTemplate&&!i.rowDetail.template&&i._openRowSettingsDialog&&!i.onRowDetailInit)return void(i.editing.dialog.visible||(t._settingsDialogRowId=l.id,i._openRowSettingsDialog(l.id)));if(i.rowDetail.dialog.visible&&a.row!==l)return void(l.showDetail=!1);const r="{{message}}"===i.rowDetail.dialog.header?i.localize("dialogRowDetailHeader",{value:l.visibleIndex+1}):i.rowDetail.dialog.header;!i.rowDetail.dialog.visible||i.rowDetail.dialog.row!==l||l.showDetail?(a.header.innerHTML=r,a.content.innerHTML="",a.content.style.width="100%",a.content.style.height="100%",a.row=l,a.querySelector(".smart-footer").classList.add("smart-hidden"),i._dialogRowDetail||(a.setAttribute("tabindex",0),a.modal=!0,a.btnConfirm.innerHTML=i.localize("dialogRowDetailButtonConfirm"),a.btnCancel.innerHTML=i.localize("dialogRowDetailButtonCancel"),a.btnCancel.classList.add("smart-hidden"),a.onOpen=function(){i.rowDetail.dialog.visible=!0,i.layout.isDirty=!1},a.onClose=function(){i.rowDetail.dialog.visible=!1,a.row.showDetail=!1},a.btnCancel.onclick=function(){i.layout.isDirty=!1,a.close()},a.btnClose.onclick=function(){i.layout.isDirty=!1,a.close()},a.btnConfirm.onclick=function(){i.layout.isDirty=!1,a.close()},a.onkeydown=function(e){"Escape"===e.key&&(i.layout.isDirty=!1,a.close())},i._dialogRowDetail=a),a.open(),setTimeout((function(){a.focus()}),100),a.content.appendChild(e)):a.close()}_renderDetail(e){const t=this,i=t.row.grid,l=t.row;let a=l.id,r=l.detailTemplate||i.rowDetail.template;if(r.startsWith("#")&&(r=document.querySelector(r)),l._detail&&void 0!==l._detail.rowid&&l._detail.rowid===l.id)return e.firstChild===l._detail||(e.firstChild&&e.removeChild(e.firstChild),e.appendChild(l._detail)),void(i.onRowDetailUpdated&&i.onRowDetailUpdated(l.index,l,e.firstChild));if(r instanceof HTMLTemplateElement){const t=r.content.cloneNode(!0).firstElementChild;a=a.toString(),a=a.replace(/'/gi,"\\'"),a=a.replace(/"/gi,'\\"');let i=t.outerHTML.replace(/{{value}}/gi,a).replace(/{{id}}/gi,l.id);i.indexOf("{{value=")>=0&&(a?(i=i.substring(0,i.indexOf("{{value="))+a+i.substring(i.indexOf("}")),i=i.replace(/}/gi,""),i=i.replace(/{/gi,"")):(i=i.replace(/{{value=/gi,""),i=i.replace(/}}/gi,""))),i="<div>"+i+"</div>";for(let e in l.data)i=i.replace("{{"+e+"}}",l.data[e]);e.innerHTML!==i&&(e.innerHTML=i)}else{let t="<div>"+r.replace(/{{value}}/gi,a).replace(/{{id}}/gi,l.id)+"</div>";for(let e in l.data)t=t.replace("{{"+e+"}}",l.data[e]);e.innerHTML!==t&&(e.innerHTML=t)}i.onRowDetailInit&&i.onRowDetailInit(l.index,l,e.firstChild),i.rowDetail.dialog.enabled?i.rowDetail.dialog.visible?t._openRowDetailDialog(e.firstChild):t._openRowDetailDialog(e.firstChild.firstElementChild):(l._detail=e.firstChild,l._detail.rowid=l.id)}_renderCards(){const e=this,t=e.row,i=t.grid,l=e.children[1],a=e.children[0],r=e.children[2];e.classList.remove("smart-hidden"),e.removeAttribute("alternation-index"),a.classList.add("smart-hidden"),r.classList.add("smart-hidden"),l.classList.add("smart-hidden");const n=e.children[5];e.style.height=t.height+"px",e.style.width="100%",e.style.lineHeight="";let o=t.visibleIndex;if(i._cardsPerRow||(i._cardsPerRow=1),-1===o&&!1===i.grouping.enabled)return;if(i.grouping.enabled&&t.data&&t.data.$){let e=i.getViewRows();for(let i=0;i<e.length;i++){const l=e[i];if(t.data===l.data){o=i;break}}}if(-1===o||void 0===o)return;let d=i.getViewRows(),s=o*i._cardsPerRow;if(i.paging.enabled){let e=i.paging.pageSize*i.paging.pageIndex;s=e+(o-e)*i._cardsPerRow,i.dataSource&&i.dataSource.virtualDataSource&&!i.dataSource.virtualDataSourceOnExpand&&"infinite"!==i.scrolling&&(s=(o-e)*i._cardsPerRow)}if(n.classList.remove("smart-hidden"),n.hasAttribute("row-index")&&i.isScrolling){const e=n.getAttribute("row-index");if(parseInt(e)===o)return}n.setAttribute("row-index",o),n.innerHTML='<div class="smart-card-layout-view">\n <div class="smart-card-container">\n </div>\n </div>\n ';const c=n.querySelector(".smart-card-container");let h="";const g=[];if(d.length)for(let e=0;e<i._cardsPerRow;e++){let t=d[s+e];const l=i.editing.enabled?" editable ":"";if(t){let e=t.label?" smart-card-header":"";t.children&&t.children.length&&(e+=" smart-card-tree-header"),h+="<div"+l+' row-id="'+t.id+'" class="smart-card'+e+'"><div class="smart-card-data-container">'}else h+="<div"+l+' class="smart-visibility-hidden smart-card"><div class="smart-card-data-container">';if(t){t.label&&(h+=`<div style="height: 100%;" class="smart-card-view-cell" role="row"><div class="smart-hidden smart-card-view-label icon" role="rowheader"></div>\n <div class="smart-card-view-value smart-flex" role="gridcell"><span class="smart-grid-icon show ${t.expanded?"smart-icon-ungroup":"smart-icon-group"}"></span><span>${t.label}</span></div></div>`);let e=!1;for(let l=0;l<i.columns.length;l++){const a=i.columns[l];if(!0!==a.visible)continue;const r=new Smart.Grid.Cell(t,a,i);let n=r.value;a.template&&"function"==typeof a.template||a.formatFunction||"image"===a.template?g.push(r):(r.createElement(),r.render(),r.element.style.width="",r.element.style.left="",r.element.setAttribute("data-field",a.dataField),r.element.setAttribute("row-id",t.id),n=r.element.outerHTML);const o=1===i._cardsPerRow||i.layout.cardVertical||!a.label?"vertical":"";let d=a.showIcon?'<div class="smart-flex"><span class="smart-grid-icon show '+a.icon+'"></span><span>'+a.label+"</span></div>":a.label;a.showCardLabel||(d="");const s=a.cardSpan?"span":"",c=a.cardHeight?"min-height: "+i.layout.cardRowMinHeight*a.cardHeight+"px; height: "+i.layout.cardRowMinHeight*a.cardHeight+"px;":"min-height: "+i.layout.cardRowMinHeight+"px; height: "+i.layout.cardRowMinHeight*a.cardHeight+"px;",m=c?"row-span":"",u=t.data.label?"smart-hidden":"";let w="";if(t.children&&t.children.length&&0===l&&(w=`<span class="smart-grid-icon show ${t.expanded?"smart-icon-group":"smart-icon-ungroup"}"></span>`),(e||w||a.template||i.appearance.cardTitleField)&&a.dataField!==i.appearance.cardTitleField)h+=`<div style="${c}" class="smart-card-view-cell ${m} ${o} ${u} ${s}" row-index="${t.index}" data-field="${a.dataField}" role="row"><div class="smart-card-view-label icon ${a.dataField}" role="rowheader">${d}</div>\n<div class="smart-card-view-value" role="gridcell">${w}${n}</div></div>`;else{e=!0,d="";let l=r.value?"":"smart-quiet";r.value||(n=i.localize("blankSummary")),h+=`<div style="${c}" class="smart-card-view-title smart-card-view-cell ${l} ${m} ${o} ${u} 2" row-index="${t.index}" data-field="${a.dataField}" role="row">\n <div class="smart-card-view-value" role="gridcell">${w}${n}</div></div>`}}}h+="</div></div>"}if(c.innerHTML=h,g.length)for(let e=0;e<g.length;e++){const t=g[e],i=c.querySelector(`[data-field="${t.column.dataField}"][row-index="${t.row.index}"]`);i&&(i.lastElementChild.innerHTML="",t.createElement(),t.render(),t.element.style.width="",t.element.style.left="",i.lastElementChild.appendChild(t.element))}}_render(){let e=this;const t=e.row,i=t.grid;if(!i)return;if("card"===i.view)return void e._renderCards();{e.rowCardContainer&&e.rowCardContainer.classList.add("smart-hidden");const t=e.children[1],i=e.children[0],l=e.children[2];i&&i.classList.remove("smart-hidden"),l&&l.classList.remove("smart-hidden"),t&&t.classList.remove("smart-hidden")}const l=t.getProperty("selected");if(!1===l&&e.hasAttribute("selected")?e.removeAttribute("selected"):!0===l?e.setAttribute("selected",""):null===l&&e.setAttribute("selected","indeterminate"),t.allowSelect||e.setAttribute("selected","none"),e.hasAttribute("unbound")&&e.removeAttribute("unbound"),t.unbound&&e.setAttribute("unbound",""),e.removeAttribute("focus"),i._selection.focusedCell&&i._selection.focusedCell.row&&i._selection.focusedCell.row.id===t.id&&e.setAttribute("focus",""),!i._toggledRow&&e.classList.contains("smart-animate"))return e.classList.remove("smart-animate"),e.rowContainer.innerHTML="",e.rowContainer.classList.add("smart-hidden"),i._refreshLayout(),void i._recycle();if(0===i.columns.length)return void e._renderEmpty();if(t.addNewRow&&!t.inline)return void e._renderAddNewRow();let a=!1;if(t.addNewRow&&t.inline&&(a=!0),i._toggledRow&&(t.id===i._toggledRow.id?e.setAttribute("toggle",""):e.hasAttribute("toggle")&&e.removeAttribute("toggle")),i._toggledRow&&i.appearance.allowRowToggleAnimation){let l=t.parent;if(!i._toggledRow.expanded&&i._toggledRow.id===t.id){const t=e.rowContainer;for(let e=0;e<t.children.length;e++){const l=t.children[e],a=l.getAttribute("data-id"),r=i.rowById[a];l.getAttribute("data-rendered")||(l.setAttribute("data-rendered",!0),r.element=l,r.render())}}for(;l;){if(l.id===i._toggledRow.id){const a=l.element.rowContainer;if(i._toggledRow.expanded){e.classList.add("smart-hidden");let l=t.createElement(i);for(let e=0;e<a.children.length;e++){const i=a.children[e];if(i.getAttribute("data-id")===t.id.toString())return void(l=i)}t.element=l,a.appendChild(l),a.classList.remove("smart-hidden"),l.row=t,e=l}break}l=l.parent}}e._alternate();const r=parseFloat(i.$.columnNearContainer.style.width),n=parseFloat(i.$.columnContainer.style.width),o=parseFloat(i.$.columnFarContainer.style.width),d=e.children[1],s=e.children[0],c=e.children[2];if(i.rightToLeft?(s.classList.remove("vscroll"),i.computedVerticalScrollBarVisibility&&s.classList.add("vscroll")):(c.classList.remove("vscroll"),i.computedVerticalScrollBarVisibility&&c.classList.add("vscroll")),e.hasAttribute("group")&&e.removeAttribute("group"),e.hasAttribute("tree")&&e.removeAttribute("tree"),e.hasAttribute("level")&&(e.removeAttribute("level"),e.removeAttribute("aria-level")),e.hasAttribute("leaf")&&e.removeAttribute("leaf"),e.hasAttribute("expanded")&&e.removeAttribute("expanded"),e.hasAttribute("summary")&&e.removeAttribute("summary"),e.hasAttribute("filter")&&e.removeAttribute("filter"),null===t.filtered&&e.setAttribute("filter","indeterminate"),i.dataSource.groupBy&&i.dataSource.groupBy.length>0&&"advanced"===i.grouping.renderMode&&!t.filterRow?(e.setAttribute("level",t.level),e.setAttribute("aria-level",t.level),t.expanded&&e.setAttribute("expanded",""),void 0!==t.label&&t.level===i.dataSource.groupBy.length-1&&e.setAttribute("leaf",""),void 0!==t.label?e.setAttribute("group",""):e.setAttribute("leaf",""),t.summaryRow&&e.setAttribute("summary",""),e.toggleButton&&e.toggleButton.classList.remove("smart-hidden")):i.dataSource.boundHierarchy?(e.setAttribute("level",t.level),e.setAttribute("aria-level",t.level),t.expanded&&e.setAttribute("expanded",""),t.leaf&&e.setAttribute("leaf",""),t.summaryRow&&e.setAttribute("summary",""),e.toggleButton&&e.toggleButton.classList.remove("smart-hidden")):(t.canNotify=!1,t.leaf=!0,t.expanded=!1,t.summaryRow=!1,t.data||(t.data={}),t.data.summaryRow&&(t.summaryRow=!0),t.level=0,e.toggleButton&&e.toggleButton.classList.add("smart-hidden"),t.canNotify=!0),e.setAttribute("data-id",t.id),e.visible=t.visible,e.cellsNearContainerElement.classList.remove("smart-visibility-hidden"),e.cellsContainerElement.classList.remove("smart-visibility-hidden"),e.cellsFarContainerElement.classList.remove("smart-visibility-hidden"),e.removeAttribute("rowspan"),t.filterRow&&e.setAttribute("filter-row",""),t.summaryRow&&e.setAttribute("summary-row",""),t.addNewRow&&(t.cellHeight=t.height=i.layout.rowMinHeight),i._rowGap>0&&t!==i.rows[i.rows.length-1]?(e.style.marginBottom=i._rowGap+"px",parseInt(e.style.height)-i._rowGap!==t.height&&(e.style.height=t.height-i._rowGap+"px"),parseInt(e.style.lineHeight)-i._rowGap!==t.height&&(e.style.lineHeight=t.height-i._rowGap+"px")):(e.style.marginBottom="",parseInt(e.style.height)!==t.height&&(e.style.height=t.height+"px"),parseInt(e.style.lineHeight)!==t.height&&(e.style.lineHeight=t.height+"px")),i.rightToLeft?(d.style.right!==i._scrollView.scrollWidth-i._scrollView.scrollLeft-i._scrollView.vScrollBar.offsetWidth+"px"&&(d.style.right=i._scrollView.scrollWidth-i._scrollView.scrollLeft-i._scrollView.vScrollBar.offsetWidth+"px"),i._scrollView.scrollWidth-i._scrollView.scrollLeft-i._scrollView.vScrollBar.offsetWidth<=0&&!i._scrollView.scrollWidth&&(d.style.right=-i.offsetWidth+i._computedColumnsWidth+"px")):d.style.left!==-i._scrollView.scrollLeft+"px"&&(d.style.left=-i._scrollView.scrollLeft+"px"),i.rowDetail.enabled){const l=e.rowDetail;e.removeAttribute("show-detail"),t.showDetail?(l.classList.remove("smart-hidden"),e.setAttribute("show-detail",""),i.rowDetail.dialog.enabled?l.classList.add("smart-hidden"):(l.style.height!==t.detailHeight+"px"&&(l.style.height=t.detailHeight+"px"),l.style.lineHeight!==t.detailHeight+"px"&&(l.style.lineHeight=t.detailHeight+"px"),l.style.top!==t.cellHeight+"px"&&(l.style.top=t.cellHeight+"px")),e._renderDetail(l)):l.classList.add("smart-hidden")}else e.rowDetail&&e.rowDetail.classList.add("smart-hidden");if(s.classList.remove("smart-hidden"),c.classList.remove("smart-hidden"),s.style.width!==r+"px"&&(s.style.width=r+"px"),d.style.width!==n+"px"&&(d.style.width=n+"px"),c.style.width!==o+"px"&&(c.style.width=o+"px"),s.style.height=t.cellHeight+"px",d.style.height=t.cellHeight+"px",c.style.height=t.cellHeight+"px",0===o&&c.classList.add("smart-hidden"),0===r&&s.classList.add("smart-hidden"),r>0&&(parseInt(r),parseInt(i._autoGeneratedColumnsNearWidth)),o>0&&parseInt(o)===parseInt(i._autoGeneratedColumnsFarWidth)&&c.classList.add("border-collapse"),t._classNames="",i.onRowClass){const e=i.onRowClass(t.visibleIndex,t.data,t);if(e){const i=e.trim().split(" ");t._classNames=i}}if(i.rowCSSRules){const e=Object.keys(i.rowCSSRules);let l=[];for(let a=0;a<e.length;a++){let r=e[a];const n={index:t.visibleIndex,data:t.data,row:t,api:i};i.rowCSSRules[r](n)&&l.push(r)}t._classNames=l}for(let l=0;l<i._frozenNearColumns.length;l++){const a=i._frozenNearColumns[l];let r=e.children[0].children[l];if(r||(r=t.getCell(a).createElement(),e.children[0].appendChild(r)),0===l&&e.children[0].children.length>i._frozenNearColumns.length)for(let t=i._frozenNearColumns.length;t<e.children[0].children.length;t++){let i=e.children[0].children[t];i&&i.classList.add("smart-hidden")}!1!==a.visbile&&e._renderCell(t,a,r)}for(let l=0;l<i._frozenFarColumns.length;l++){const a=i._frozenFarColumns[l];let r=e.children[2].children[l];r||(r=t.getCell(a).createElement(),e.children[2].appendChild(r)),!1!==a.visbile&&e._renderCell(t,a,r)}for(let l=0;l<d.children.length;l++)if(!i._columnElements[l+i._frozenNearColumns.length]){let i=e.children[1].children[l];e._renderCell(t,null,i)}for(let l=0;l<i._columnElements.length;l++){const a=i._columnElements[l],r=a.column;if(!a.parentNode||!r){if(a&&!r){let t=e.children[1].children[l];t&&t.classList.add("smart-visibility-hidden")}else if(r&&a&&a.classList.contains("smart-visibility-hidden")){let t=e.children[1].children[l];t&&t.classList.add("smart-visibility-hidden")}continue}let n=e.children[1].children[l];n||(a.column||(a.column=r),n=t.getCell(r).createElement(),e.children[1].appendChild(n)),a.classList.contains("smart-visibility-hidden")?n.classList.add("smart-visibility-hidden"):(n.classList.remove("smart-visibility-hidden"),e._renderCell(t,r,n))}if(a){let t=e.children[1].children[0];i.isScrolling||(e._cachedCenterRect=null,e._cachedNearReact=null);const l=e._cachedCenterRect||d.getBoundingClientRect(),a=e._cachedNearReact||s.getBoundingClientRect();e._cachedCenterRect=l,e._cachedNearReact=a;for(let e=0;e<s.children.length;e++)s.children[e].classList.add("smart-add-new-row");const r='<div style="width: 100%;" class="smart-grid-icon smart-icon-plus show"></div>';s.children[0].innerHTML!==r&&(s.children[0].innerHTML=r),s.children[0].style.width="50px",s.children[0].style.zIndex=9;const n=i.editing.addNewColumn.visible?i._addNewColumn.width:0;let o=l.width-a.width-n+6,c=0;if((i.appearance.showRowHeaderNumber||i.appearance.showRowHeader)&&(c+=30),i.rowDetail.enabled&&(c+=20),i._frozenColumnsNearWidth&&(o+=i._frozenColumnsNearWidth),t.style.width=o+"px",t.style.left=i._scrollView.scrollLeft+c+"px",i.selection.enabled){const e=o>=250?i.localize("addNewRowAlt"):i.localize("addNewRowAltSmall");e!==t.content.innerHTML&&(t.content.innerHTML=e),s.children[1]&&(t.content.title=s.children[1].title=i.localize("addNewRow")),i.rightToLeft&&(t.style.left="initial",t.style.right=a.width+"px"),!1===i.appearance.showRowHeader&&(i.rightToLeft?t.content.innerHTML='<span style="margin-right: 35px;"></span>'+i.localize("addNewRowAlt"):t.content.innerHTML='<span style="margin-left: 35px;"></span>'+i.localize("addNewRowAlt"))}else t.content.innerHTML=i.localize("addNewRow");t.classList.add("smart-add-new-row"),t.firstElementChild.classList.add("align-left"),t.firstElementChild.classList.remove("align-right"),i.grouping.enabled&&i.dataSource&&(e.visible=!(i.dataSource.groupBy.length>0))}t&&t._style&&(t._style._changed=!1),e.visible?e.classList.remove("smart-hidden"):e.classList.add("smart-hidden")}template(){return""}_detach(){const e=this;e.row.headerCell=null,e.row._cells=[],e.row=null,delete e.row,e.element=null,e.removeEventListener("mouseenter",e._mouseEnter),e.removeEventListener("mouseleave",e._mouseLeave),delete e.element,delete e.grid,delete e._mouseEnter,delete e._mouseLeave,delete e.cellsNearContainerElement,delete e.cellsContainerElement,delete e.cellsFarContainerElement,delete e.rowDetail,delete e.rowContainer}onDetached(){this._detach()}});
1512
+ Smart.Utilities.Assign("Grid.Row",class{constructor(e){const t=this;if(e||(e={}),Object.assign(t,e),e){if(void 0===t.data){const i={$:{}};if(e.grid&&e.grid.dataSource){const t=e.grid.dataSource;for(let e=0;e<t.dataFields.length;e++)i[(t.dataFields?t.dataFields[e]:{}).name]=""}else Object.assign(i,e);e.id&&(i.$.id=e.id),t.data=i}if((void 0===e.$||e.$&&void 0===e.$.id)&&(e.data?(e.data.$&&e.data.$.id&&(t.id=e.data.$.id),t.id||(t.id=e.index)):void 0===t.id&&(t.id=e.index),void 0===t.id&&(t.id=Smart.Utilities.Core.createGUID())),void 0===t.detailHeight&&(t.grid?t.detailHeight=t.grid.rowDetail.height:t.detailHeight=200),void 0===t.height&&t.grid&&(t.height=t.grid.layout.rowMinHeight,t.grid.__autoRowHeight&&(t.height=t.grid.__autoRowHeight),t.grid.layout.rowHeight&&(t.height=t.grid.layout.rowHeight)),void 0===t.cellHeight&&(t.cellHeight=t.height),void 0===t.showDetail&&(t.showDetail=!1),void 0===t.index&&(t.index=-1),void 0===t.visibleIndex&&(t.visibleIndex=-1),void 0===t.freeze&&(t.freeze=!1),void 0===t.height&&(t.height=null),void 0===t.minHeight&&(t.minHeight=25,t.grid&&(t.minHeight=t.grid.layout.rowMinHeight)),void 0===t.checked&&(t.checked=!1),void 0===t.selected?(t.selected=!1,(t.grid&&t.grid._selection.rows[t.id]||t.grid&&t.grid._selection.indexes[t.index])&&(t.selected=!0)):t.selected&&t.grid&&(t.grid._selection.rows[t.id]=!0,t.grid._selection.indexes[t.index]=t.index),void 0===t.enabled&&(t.enabled=!0),void 0===t.visible&&(t.visible=!0),void 0===t.allowCheck&&(t.allowCheck=!0),void 0===t.filtered&&(t.filtered=!0),void 0===t.allowResize&&(t.allowResize=!0),void 0===t.allowReorder&&(t.allowReorder=!0),void 0===t.allowToggle&&(t.allowToggle=!0),void 0===t.allowSelect&&(t.allowSelect=!0),void 0===t.starred&&(t.starred=!1),void 0===t.expanded&&(e.data&&void 0!==e.data.expanded?t.expanded=e.data.expanded:t.expanded=!1),t._addStyle(),t.headerCell=null,t._cells=[],t.name="",t.comments=[],!t.autoGenerated&&999999!==t.index){if(t.data){if(t.data.comments)if("string"==typeof t.data.comments&&t.data.comments.indexOf("[{")>=0&&t.data.comments.indexOf("}]")>=0)try{t.data.comments=JSON.parse(t.data.comments.replaceAll("\t"," ").replaceAll("\\"," ")).replace(/\p{Emoji}/gu,(e=>"&#"+e.codePointAt(0)+";"))}catch(e){t.data.comments=[]}else"string"==typeof t.data.comments&&t.data.comments.indexOf("[{")>=0&&-1===t.data.comments.indexOf("}]")||"string"==typeof t.data.comments&&"[]"===t.data.comments?t.data.comments=[]:t.comments=JSON.parse(JSON.stringify(t.data.comments));if(t.data.rowStyle&&(t.style=t._style=e.rowStyle),t.data.history&&(t.history=t.data.history),t.data.style&&(t.style=t._style=t.data.style,t.grid&&(t.grid._cellStyles||(t.grid._cellStyles=[]),t.grid._cellStyles["row"+t.id]=!0,t.grid._cellStyles.length++)),t.data.settings){const e=JSON.parse(t.data.settings);void 0!==e.starred&&(t.starred=e.starred),void 0!==e.height&&(t.height=t.cellHeight=e.height)}const e=t.data.$?t.data.$:t.data;if(e.history&&(t.history=e.history),"string"==typeof t.history&&t.history.indexOf("[{")>=0&&t.history.indexOf("}]")>=0)try{t.history=JSON.parse(t.history.replaceAll("\t"," ").replaceAll("\\"," ")).replace(/\p{Emoji}/gu,(e=>"&#"+e.codePointAt(0)+";"))}catch(e){t.history=[]}t.history&&t.history.length&&(e.createdDate||(e.createdDate=t.history[0].date),e.createdBy||(e.createdBy=t.history[0].user),e.updatedDate||(e.updatedDate=t.history[t.history.length-1].date),e.updatedBy||(e.updatedBy=t.history[t.history.length-1].user)),e.style&&(t.style=t._style=e.style),e.height&&(t.height=t.cellHeight=e.height),e.comments&&(t.comments=e.comments),e.starred&&(t.starred=e.starred),e.createdDate&&(t.createdDate=e.createdDate),e.createdBy&&(t.createdBy=e.createdBy),e.updatedDate&&(t.updatedDate=e.updatedDate),e.updatedBy&&(t.updatedBy=e.updatedBy)}t.grid&&t.grid._currentUser&&t.grid._currentUser.info&&(void 0===t.createdBy?(t.createdBy=t.grid._currentUser.info.id,t.createdDate||(t.createdDate=new Date)):t.createdDate||(t.createdDate=new Date),t.history||(t.history=[],t.addHistory({action:"created",user:t.grid._currentUser.info.id,details:{value:t.name},date:t.createdDate})))}}}_addStyle(){this.style=this._style={background:"",color:"",status:"",fontSize:"",fontFamily:"",fontWeight:"",textDecoration:"",fontStyle:""}}setStyle(e){const t=this;t._style||t._addStyle(),["background","color","fontSize","status","fontFamily","fontWeight","textDecoration","fontStyle"].forEach((i=>{e[i]&&(t._style[i]=e[i])})),t.grid&&(t._style._changed=!0,t.grid._recycle(!1))}get properties(){return["allowToggle","allowResize","allowSelect","allowReorder","allowCheck","createdDate","updatedDate","createdBy","updatedBy","canNotify","children","starred","checked","cells","detailHeight","detailTemplate","cellHeight","expandHeight","data","enabled","expanded","filtered","freeze","grid","headerCell","height","index","id","minHeight","unbound","name","selected","showDetail","visible","parent","leaf","visibleIndex","history","comments","style"]}createElement(){const e=document.createElement("smart-grid-row");return this.element=e,e.setAttribute("role","row"),e._initialize(this),e}_autoSize(e){const t=this,i=t.grid;if(!i)return;let l=i.layout.rowMinHeight;void 0!==t.minHeight&&(l=t.minHeight);const a=t.element;if(e||(e=t),e&&(t.data=e.data),!a)return t.height;i.__autoHeightRows||(i.__autoHeightRows=[]);const r=(e,t,a)=>{if(!a||!t||t.autoGenerated)return 0;i.__autoHeightRows[t.dataField]||(i.__autoHeightRows[t.dataField]=[]);let r=""+e.data[t.dataField];"date"===t.dataType&&e.data[t.dataField]&&(r=""+e.data[t.dataField].toLocaleString());let n=r.length;e._templatesHeight&&e._templatesHeight[t.dataField]&&(n=e._templatesHeight[t.dataField]);const o=i.__autoHeightRows[t.dataField][n],d=o||function(e){a.style.height="auto",t.cellsWrap?a.content.classList.add("wrap"):a.content.classList.add("nowrap");let i=0;if(e&&t)if(t.template){const l=e.canNotify;if(e.canNotify=!1,a.cell.row=e,"function"==typeof t.template)if(a.content.textContent=e.data[t.dataField],e._templatesHeight&&e._templatesHeight[t.dataField])i=e._templatesHeight[t.dataField];else{const i={row:e,column:t,cell:a.cell,oldValue:a.cell.oldValue,value:a.cell.value,template:null,isMeasuring:!0},l=a.innerHTML,r=a.cell.canNotify;a.cell.canNotify=!1,a.cell.template(i),a.cell.canNotify=r,i.template?(a.content.textContent="",a.innerHTML=l):a.content.textContent=e.data[t.dataField]}else a._setTemplate(e.data[t.dataField]||"",t.template,a.content);e.canNotify=l}else if("date"===t.dataType){const i=a.cell.getFormattedValue(e.data[t.dataField],t.cellsFormat);a.content.textContent=i}else a.content.textContent=e.data[t.dataField];let l=a.offsetHeight;return"function"==typeof t.template&&i>0&&(l=i),a.style.height="",a.content.classList.remove("wrap"),a.content.classList.remove("nowrap"),l}(e);l=Math.max(l,d),i.__autoHeightRows[t.dataField][n]=d};for(let t=0;t<i._frozenNearColumns.length;t++)r(e,i._frozenNearColumns[t],a.children[0].children[t]);for(let t=0;t<i._frozenFarColumns.length;t++)r(e,i._frozenFarColumns[t],a.children[2].children[t]);for(let t=0;t<a.children[1].children.length;t++)r(e,i._columnElements[t].column,a.children[1].children[t]);return l}addHistory(e){const t=this;e&&(t.grid.storeHistory?(void 0===t.history&&(t.history=[]),t.history.length===t.grid.storeHistoryItems&&t.history.splice(0,1),Array.isArray(t.history)||(t.history=[]),t.history.push(e)):t.history=[])}clearHistory(){this.history=[]}autoSize(){const e=this,t=e.grid._measureRowElement(e.data),i=e.data?t.row._autoSize(e):e.grid.layout.rowMinHeight;e.height=i,t.remove()}getCell(e){const t=this,i=t.grid;if(!i)return null;if("string"!=typeof e&&"number"!=typeof e||(e=i.columnByDataField[e]),!e)return null;if(t["column_"+e.dataField]){const i=t["column_"+e.dataField];return i.column=e,i}{const l=new Smart.Grid.Cell(t,e,i);return t["column_"+e.dataField]=l,l}}get cells(){const e=this;return e._cells&&e.grid&&e._cells.length===e.grid.columns.length||e.createCells(),e._cells}get viewCells(){const e=this,t=[];for(let i=0;i<e.grid.viewColumns.length;i++){const l=e.grid.viewColumns[i];if(e["column_"+l.dataField]){const i=e["column_"+l.dataField];t.push(i)}else{const i=new Smart.Grid.Cell(e,l,e.grid);e["column_"+l.dataField]=i,t.push(i)}}return e._viewCells=t,t}createCells(){const e=this,t=e.grid;e._cells=[];for(let i=0;i<t.viewColumns.length;i++){const l=t.viewColumns[i];if(!l.autoGenerated)if(e["column_"+l.dataField]){const t=e["column_"+l.dataField];e._cells.push(t)}else{const i=new Smart.Grid.Cell(e,l,t);e["column_"+l.dataField]=i,e._cells.push(i)}}}toggle(e){this.element._handleExpandCollapse(!this.expanded,e)}select(){this.setProperty("selected",!0)}unselect(){this.setProperty("selected",!1)}expand(){this.element&&this.element._handleExpandCollapse(!0)}collapse(){this.element&&this.element._handleExpandCollapse(!1)}render(){const e=this;e.element.row=e,e.element._render()}setProperty(e,t){const i=this,l=i.getProperty(e);i[e]=t,l!==t&&(i.canNotify=!1,i.propertyChanged(e,l,t),i.canNotify=!0)}getProperty(e){const t=this;if("selected"===e&&t.grid){let i=!1;t.grid._selection.cells["row"+t.id]&&(i=null),t.grid&&t.grid._selection.rows[t.id]&&(i=!0),t.grid&&t.grid._selection.indexes[t.index]&&(i=!0),t.grid&&t.grid.dataSource.virtualDataSource&&!t.grid.dataSource.id&&(i=void 0!==t.grid._selection.indexes[t.index]);const l=t.grid.rows.canNotify;return t.grid.rows.canNotify=!1,t[e]=i,t.grid.rows.canNotify=l,i}return t[e]}_updateData(){const e=this;e.data&&e.data.$&&["updatedBy","updatedDate","createdDate","createdBy","starred","comments","history","style"].forEach((t=>{void 0!==e.data.$[t]?(e[t]=e.data.$[t],"style"===t&&(e._style=e[t],e._style._changed=!0)):"starred"===t?e[t]=!1:"comments"===t||"history"===t?e[t]=[]:"updatedBy"===t?e[t]=-1:"updatedDate"===t?e[t]=null:"style"===t&&(e._addStyle(),e._style._changed=!0)}))}propertyChanged(e,t,i){const l=this;if("updatedBy"!==e&&"createdBy"!==e&&"userData"!==e&&"starred"!==e&&"style"!==e&&"history"!==e&&"updatedDate"!==e&&"createdDate"!==e&&"comments"!==e){if("showDetail"===e){if(l.grid.rowDetail.enabled&&!l.grid.rowDetail.dialog.enabled&&(l.height=0),l.showDetail)if(l.element){if(l.grid._openRowSettingsDialog&&!l.grid.onRowDetailInit)return void(l.grid.editing.dialog.visible||(l._settingsDialogRowId=l.id,l.grid._openRowSettingsDialog(l.id)))}else if(l.createElement(),l.grid._openRowSettingsDialog&&!l.grid.onRowDetailInit)return void(l.grid.editing.dialog.visible||(l._settingsDialogRowId=l.id,l.grid._openRowSettingsDialog(l.id)));const e=l.element.rowDetail;if(l.grid.appearance.allowRowDetailToggleAnimation&&!l.grid.rowDetail.dialog.enabled){l.grid._resizeHandling=!1;const t=function(e){const t=l.grid._toggledRow;!t||"transform"!==e.propertyName&&"height"!==e.propertyName||a(t)},a=function(e){e.grid.$.content.style.transition="",e.element.rowDetail.removeEventListener("transitionend",t),e.element.rowDetail.removeEventListener("transitioncancel",t),e.grid._toggledRow=null,e.element.removeAttribute("has-detail"),l.grid._refresh(),setTimeout((()=>{l.grid._resizeHandling=!0}),50)};l.grid._toggledRow=l,e.addEventListener("transitionend",t),e.addEventListener("transitioncancel",t),i?(l.element.setAttribute("has-detail",""),l.element.toggleDetailButton.removeAttribute("toggled"),l.element.toggleDetailButton.classList.remove("smart-animate"),setTimeout((()=>{l.element.toggleDetailButton.classList.add("smart-animate"),l.element.toggleDetailButton.setAttribute("toggled",""),l.element.setAttribute("show-detail","")})),l.element.style.height=l.cellHeight+l.detailHeight+"px",l.grid._autoHeight&&(l.grid.$.content.style.transition="0.25s height ease-in-out",l.grid.$.content.style.height=parseInt(l.grid.$.content.style.height)+l.detailHeight+"px",l.grid.$.scrollView.style.height="auto"),e.classList.remove("smart-hidden"),e.style.height!==l.detailHeight+"px"&&(e.style.height=l.detailHeight+"px"),e.style.lineHeight!==l.detailHeight+"px"&&(e.style.lineHeight=l.detailHeight+"px"),e.style.top!==l.cellHeight+"px"&&(e.style.top=l.cellHeight+"px")):(l.element.setAttribute("has-detail",""),l.element.toggleDetailButton.removeAttribute("toggled"),l.grid._autoHeight&&(l.grid.$.content.style.transition="0.25s height ease-in-out",l.grid.$.content.style.height=parseInt(l.grid.$.content.style.height)-l.detailHeight+"px",l.grid.$.scrollView.style.height="auto"),setTimeout((()=>{l.element.style.height=l.cellHeight+"px",l.element.removeAttribute("show-detail")})))}else l.grid.rowDetail.enabled&&!l.grid.rowDetail.dialog.enabled?l.grid._refresh():l.grid._recycle()}if("allowCheck"!==e&&"allowSelect"!==e||l.grid._recycle(),"checked"===e&&(l.grid.checkBoxes.hasThreeStates&&l.grid._hasThreeStates(l,l),l.grid._recycle()),"selected"===e){if(!1===l.allowSelect)return;if(i?(l.grid._selection.rows[l.id]=!0,l.grid._selection.indexes[l.index]=l.index):!1===i&&(void 0!==l.grid._selection.rows[l.id]&&delete l.grid._selection.rows[l.id],void 0!==l.grid._selection.indexes[l.index]&&delete l.grid._selection.indexes[l.index]),!l.element)return;i?l.element.setAttribute("aria-selected",!0):l.element.removeAttribute("aria-selected"),l.grid._recycle()}"visible"===e&&l.grid.refresh(),"expanded"===e&&(l.expandHeight||l.grid.refresh()),"height"===e&&(l.expandHeight||l.cellHeight!==i&&(l.cellHeight=i,l.grid.refresh())),"minHeight"===e&&(l.height=null,l.grid.refresh()),"freeze"===e&&(!0===i||"near"===i?l.grid._frozenNearRows.push(l):"far"===i?l.grid._frozenFarRows.push(l):(l.grid._frozenNearRows.splice(l.grid._frozenNearRows.indexOf(l),1),l.grid._frozenFarRows.splice(l.grid._frozenFarRows.indexOf(l),1)),l.grid.refresh())}else l.data&&l.data.$&&(l.data.$[e]=i,"style"===e&&(l._style=i,l._style._changed=!0))}}),Smart("smart-grid-row",class extends Smart.BaseElement{static get properties(){return{}}get isUtilityElement(){return!0}get hasStyleObserver(){return!1}addThemeClass(){}addDefaultClass(){}_initialize(e){const t=this,i=e.grid,l=i._columnElements,a=i._frozenNearColumns,r=i._frozenFarColumns,n=document.createElement("div"),o=document.createElement("div"),d=document.createElement("div"),s=document.createDocumentFragment(),c=document.createDocumentFragment(),h=document.createDocumentFragment();i.rightToLeft?(o.classList.add("far","smart-grid-cell-container"),n.classList.add("center","smart-grid-cell-container"),d.classList.add("near","smart-grid-cell-container")):(o.classList.add("near","smart-grid-cell-container"),n.classList.add("center","smart-grid-cell-container"),d.classList.add("far","smart-grid-cell-container")),t._properties=[],t.row=e,e.createCells(),t._mouseEnter=function(){if(!i.isScrolling&&!i.editing.isEditing&&(t.commandBar&&(t.commandBar.parentNode.removeChild(t.commandBar),t.commandBar=null),i.editing.enabled&&i.editing.commandColumn.visible&&i.editing.commandColumn.inline&&!t.commandBar)){const e=document.createElement("div"),l=i._getCommandColumnCommandsTemplate();e.classList.add("smart-grid-command-bar"),e.innerHTML=l,n.appendChild(e),requestAnimationFrame((()=>{e.classList.add("show")})),i._updateCommandColumnCommandsVisibility(e,t.row),e.onmousedown=function(e){const l=e.composedPath();let a=null;for(let e=0;e<l.length;e++)if(l[e].classList.contains("smart-grid-command-item")){a=l[e];break}if(a){const l=a.getAttribute("command");i._applyCommand(l,[t.row]),t.commandBar&&(t.commandBar.parentNode.removeChild(t.commandBar),t.commandBar=null),t.removeAttribute("hover"),e.stopPropagation(),e.preventDefault()}},t.commandBar=e}},t._mouseLeave=function(){i.isScrolling||i.editing.isEditing||t.commandBar&&(t.commandBar.classList.remove("show"),t.commandBar.addEventListener("transitionend",(function(){t.commandBar&&(t.commandBar.parentNode.removeChild(t.commandBar),t.commandBar=null)})),t.commandBar.addEventListener("transitioncancel",(function(){t.commandBar&&(t.commandBar.parentNode.removeChild(t.commandBar),t.commandBar=null)})))},t.addEventListener("mouseenter",t._mouseEnter),t.addEventListener("mouseleave",t._mouseLeave);for(let t=0;t<a.length;t++){const i=a[t],l=e.getCell(i).createElement();c.appendChild(l)}for(let t=0;t<r.length;t++){const i=r[t],l=e.getCell(i).createElement();h.appendChild(l)}for(let i=0;i<l.length;i++){const a=l[i],r=a.column;if(!a.parentNode||!r)break;const n=e.getCell(r).createElement();r&&r._treeColumn&&(t.toggleButton=n.toggleButton),s.appendChild(n)}o.appendChild(c),n.appendChild(s),d.appendChild(h);const g=document.createElement("div");g.classList.add("smart-grid-row-detail","smart-hidden","smart-animate");const m=document.createElement("div");m.classList.add("smart-grid-row-sub-container","smart-hidden");const u=document.createElement("div");u.classList.add("smart-grid-row-card-container","smart-hidden"),t._rowFragment=document.createDocumentFragment(),t._rowFragment.appendChild(o),t._rowFragment.appendChild(n),t._rowFragment.appendChild(d),t._rowFragment.appendChild(g),t._rowFragment.appendChild(m),t._rowFragment.appendChild(u),t.appendChild(t._rowFragment),t.cellsNearContainerElement=t.children[0],t.cellsContainerElement=t.children[1],t.cellsFarContainerElement=t.children[2],t.rowDetail=t.children[3],t.rowContainer=t.children[4],t.rowCardContainer=t.children[5],i.layout.rowHeight&&"auto"!==i.layout.rowHeight&&(e.filterRow?t.style.height=i.layout.rowMinHeight+"px":t.style.height=i.layout.rowHeight+"px"),delete t._rowFragment}get enableShadowDOM(){return!1}_handleExpandCollapse(e,t){const i=this,l=i.row,a=l.grid;if(!l.allowToggle)return null;a._toggledRow=l;let r={row:l,id:l.id};t&&(r.originalEvent=t.originalEvent),a.$.fireEvent(e?"rowExpand":"rowCollapse",r);const n=a.dataSource.virtualDataSourceOnExpand&&e&&!0!==l.data._loaded;if(e?a.dataSource._expandedRowIds[l.data.$.id]=!0:delete a.dataSource._expandedRowIds[l.data.$.id],a.stateSettings.autoSave&&a.saveState(null,["expandedRows"]),!a.appearance.allowRowToggleAnimation||n)a.rows.canNotify=!1,l.expanded=e,a.rows.canNotify=!0,l.data.expanded=e,n?(l.data._loaded=!0,l.element.querySelector("button").setAttribute("load",""),a._virtualDataRequest("expand")):(a._toggledRow=null,a._refresh()),n&&a.appearance.allowRowToggleAnimation&&(i.toggleButton.removeAttribute("toggled"),i.toggleButton.classList.remove("smart-animate"),setTimeout((()=>{i.toggleButton.classList.add("smart-animate"),i.toggleButton.setAttribute("toggled","")}),50));else{const t=function(e){e.height=e.cellHeight,a.$.content.style.transition="",e.element.rowContainer.innerHTML="",e.element.rowContainer.classList.add("smart-hidden"),e.element.rowContainer.removeEventListener("transitionend",r),e.element.rowContainer.removeEventListener("transitioncancel",r),e.element.rowContainer.style.height="",e.element.rowContainer.style.transform="",e.element.rowContainer.style.transition="",e.element.rowContainer.classList.remove("smart-animate"),e.element.toggleButton&&e.element.toggleButton.classList.remove("smart-animate"),a._refresh()},r=function(e){const l=a._toggledRow;i._toggleTimer=null,a._toggledRow=null,!l||"transform"!==e.propertyName&&"height"!==e.propertyName||setTimeout((()=>{t(l)}),50)};if(i._toggleTimer){clearTimeout(i._toggleTimer);const e=a._toggledRow;a._toggledRow=null,t(e)}i._toggleTimer=setTimeout((()=>{const t=function(){!function(){const e=a._toggledRow;a._refresh(),a._refreshRowHierarchy();let t=0;for(let e=0;e<a.rowHierarchy.length;e++){const i=a.rowHierarchy[e];let l=i.parent;for(;l;)l.id===a._toggledRow.id&&(t+=i.height),l=l.parent}const i=a._scrollView.scrollTop,l=a._contentHeight-(e.cellHeight+e.top-i);e.expandHeight=Math.min(l,t),e.height=e.cellHeight+e.expandHeight}(),a._recycle(!1),i.style.overflow="hidden",i.style.height="auto",i.style.lineHeight=l.cellHeight+"px"};e?(l.expanded=!0,t(),i.rowContainer.style.transform="scaleY(0)",i.rowContainer.style.height="0px",i.toggleButton&&i.toggleButton.removeAttribute("toggled"),a._autoHeight&&(a.$.content.style.height=parseInt(a.$.content.style.height)-l.expandHeight+"px"),setTimeout((function(){i.toggleButton&&(i.toggleButton.classList.add("smart-animate"),i.toggleButton.setAttribute("toggled","")),i.rowContainer.addEventListener("transitionend",r),i.rowContainer.addEventListener("transitioncancel",r),a._autoHeight&&(a.$.content.style.transition="0.25s height ease-in-out",a.$.content.style.height=parseInt(a.$.content.style.height)+l.expandHeight+"px"),i.rowContainer.classList.add("smart-animate"),i.rowContainer.style.height=l.expandHeight+"px",i.rowContainer.style.transform="scaleY(1)"}))):(t(),l.expanded=!1,i.rowContainer.style.transform="scaleY(0)",i.rowContainer.style.height="0px",a._autoHeight&&(a.$.content.style.height=parseInt(a.$.content.style.height)-l.expandHeight+"px",a.$.content.style.transition="",a.$.content.style.height=parseInt(a.$.content.style.height)+l.expandHeight+"px"),i.rowContainer.style.height=l.expandHeight+"px",i.rowContainer.style.transform="scaleY(1)",i.toggleButton&&(i.toggleButton.setAttribute("toggled",""),i.toggleButton.classList.add("smart-animate")),setTimeout((function(){i.toggleButton&&i.toggleButton.removeAttribute("toggled",""),a._autoHeight&&(a.$.content.style.transition="0.25s height ease-in-out",a.$.content.style.height=parseInt(a.$.content.style.height)-l.expandHeight+"px"),i.rowContainer.addEventListener("transitionend",r),i.rowContainer.addEventListener("transitioncancel",r),i.rowContainer.classList.add("smart-animate"),i.rowContainer.style.transform="scaleY(0)",i.rowContainer.style.height="0px"}),0))}),50)}}_renderAddNewRow(){const e=this,t=e.row,i=t.grid,l=t.element,a=new Smart.Grid.Cell(t,i.columns[0],i);t.visible?l.classList.remove("smart-hidden"):l.classList.add("smart-hidden");let r=i.editing.addNewRow.label;r.indexOf("{{")>=0&&(r=i.localize("addNewRow")),l.innerHTML="<smart-grid-cell><div>"+r+"</div></smart-grid-cell>",l.firstChild.firstChild.classList.add("align-center"),l.firstChild.classList.add("smart-grid-column-border-collapse"),l.firstChild.setAttribute("freeze",""),l.firstChild.setAttribute("addNewRow",""),l.firstChild.style.width="100%",i._scrollView.vScrollBar.offsetWidth>0&&(l.firstChild.style.width="calc(100% - "+(-1+i._scrollView.vScrollBar.offsetWidth)+"px)"),l.firstChild.cell=a,i._rowGap>0&&t!==i.rows[i.rows.length-1]?(e.style.marginBottom=i._rowGap+"px",parseInt(e.style.height)-i._rowGap!==t.height&&(e.style.height=t.height-i._rowGap+"px"),parseInt(e.style.lineHeight)-i._rowGap!==t.height&&(e.style.lineHeight=t.height-i._rowGap+"px")):(e.style.marginBottom="",parseInt(e.style.height)!==t.height&&(e.style.height=t.height+"px"),parseInt(e.style.lineHeight)!==t.height&&(e.style.lineHeight=t.height+"px"))}_renderFilterRow(){const e=this,t=e.row,i=t.grid,l=t.element;t.visible?l.classList.remove("smart-hidden"):l.classList.add("smart-hidden"),l.innerHTML="<smart-grid-cell><div>"+i.localize("addNewRow")+"</div></smart-grid-cell>",l.firstChild.firstChild.classList.add("align-center"),l.firstChild.classList.add("smart-grid-column-border-collapse"),l.firstChild.setAttribute("freeze",""),l.firstChild.setAttribute("addNewRow",""),l.firstChild.style.width="100%",i._scrollView.vScrollBar.offsetWidth>0&&(l.firstChild.style.width="calc(100% - "+(-1+i._scrollView.vScrollBar.offsetWidth)+"px)"),e.style.marginBottom="",parseInt(e.style.height)!==t.height&&(e.style.height=t.height+"px"),parseInt(e.style.lineHeight)!==t.height&&(e.style.lineHeight=t.height+"px")}_renderEmpty(){this.classList.add("smart-hidden")}_renderCell(e,t,i){if(!t)return void i.classList.add("smart-hidden");let l=e.getCell(t);if(l.element!==i&&(l._styleChanged=!0),e._style&&!t.autoGenerated){const t=l._updating;l._updating=!0,e._style._changed&&(l.color=e._style.color,l.background=e._style.background,l.fontFamily=e._style.fontFamily,l.fontSize=e._style.fontSize,l.fontStyle=e._style.fontStyle,l.textDecoration=e._style.textDecoration,l.fontWeight=e._style.fontWeight);const a=i.firstElementChild,r=e=>a._style&&a._style[e]?a._style[e]:"backgroundColor"===e&&null===l.background&&""===a.style[e]||null===l[e]&&""===a.style[e]?null:a.style[e];r("backgroundColor")===l.background&&r("fontFamily")===l.fontFamily&&r("fontSize")===l.fontSize&&r("fontStyle")===l.fontStyle&&r("textDecoration")===l.textDecoration&&r("fontWeight")===l.fontWeight&&r("color")===l.color||(l._styleChanged=!0),l._updating=t}i.cell!==l&&(i.cell.background===l.background&&i.cell.borderColor===l.borderColor&&i.cell.color===l.color&&i.cell.fontSize===l.fontSize&&i.cell.fontFamily===l.fontFamily&&i.cell.textDecoration===l.textDecoration&&i.cell.fontWeight===l.fontWeight&&i.cell.fontStyle===l.fontStyle||(l._styleChanged=!0)),l.element=i,i.cell=l,t._treeColumn&&l.element.isRendered&&!e.filterRow&&l.element._refresh(),l.render(),t&&t.rowHeaderColumn&&(e.header=i,i.setAttribute("data-id",e.id))}_alternate(){const e=this,t=e.row,i=t.grid;if("card"===i.view)return void e.removeAttribute("alternation-index");const l=i.appearance.alternationStart,a=i.appearance.alternationEnd>0?i.appearance.alternationEnd:1/0;if(!(i.appearance.alternationCount<=0)&&(e.removeAttribute("alternation-index"),t.visibleIndex>=l&&t.visibleIndex<=a)){const a=(t.visibleIndex-l)%i.appearance.alternationCount;e.setAttribute("alternation-index",a)}}_openRowDetailDialog(e){const t=this,i=t.row.grid,l=t.row;if(!i.rowDetail.dialog.enabled||!l.showDetail)return!1;const a=i._dialogRowDetail||i._createDialog(i.rowDetail.dialog);if(!l.detailTemplate&&!i.rowDetail.template&&i._openRowSettingsDialog&&!i.onRowDetailInit)return void(i.editing.dialog.visible||(t._settingsDialogRowId=l.id,i._openRowSettingsDialog(l.id)));if(i.rowDetail.dialog.visible&&a.row!==l)return void(l.showDetail=!1);const r="{{message}}"===i.rowDetail.dialog.header?i.localize("dialogRowDetailHeader",{value:l.visibleIndex+1}):i.rowDetail.dialog.header;!i.rowDetail.dialog.visible||i.rowDetail.dialog.row!==l||l.showDetail?(a.header.innerHTML=r,a.content.innerHTML="",a.content.style.width="100%",a.content.style.height="100%",a.row=l,a.querySelector(".smart-footer").classList.add("smart-hidden"),i._dialogRowDetail||(a.setAttribute("tabindex",0),a.modal=!0,a.btnConfirm.innerHTML=i.localize("dialogRowDetailButtonConfirm"),a.btnCancel.innerHTML=i.localize("dialogRowDetailButtonCancel"),a.btnCancel.classList.add("smart-hidden"),a.onOpen=function(){i.rowDetail.dialog.visible=!0,i.layout.isDirty=!1},a.onClose=function(){i.rowDetail.dialog.visible=!1,a.row.showDetail=!1},a.btnCancel.onclick=function(){i.layout.isDirty=!1,a.close()},a.btnClose.onclick=function(){i.layout.isDirty=!1,a.close()},a.btnConfirm.onclick=function(){i.layout.isDirty=!1,a.close()},a.onkeydown=function(e){"Escape"===e.key&&(i.layout.isDirty=!1,a.close())},i._dialogRowDetail=a),a.open(),setTimeout((function(){a.focus()}),100),a.content.appendChild(e)):a.close()}_renderDetail(e){const t=this,i=t.row.grid,l=t.row;let a=l.id,r=l.detailTemplate||i.rowDetail.template;if(r.startsWith("#")&&(r=document.querySelector(r)),l._detail&&void 0!==l._detail.rowid&&l._detail.rowid===l.id)return e.firstChild===l._detail||(e.firstChild&&e.removeChild(e.firstChild),e.appendChild(l._detail)),void(i.onRowDetailUpdated&&i.onRowDetailUpdated(l.index,l,e.firstChild));if(r instanceof HTMLTemplateElement){const t=r.content.cloneNode(!0).firstElementChild;a=a.toString(),a=a.replace(/'/gi,"\\'"),a=a.replace(/"/gi,'\\"');let i=t.outerHTML.replace(/{{value}}/gi,a).replace(/{{id}}/gi,l.id);i.indexOf("{{value=")>=0&&(a?(i=i.substring(0,i.indexOf("{{value="))+a+i.substring(i.indexOf("}")),i=i.replace(/}/gi,""),i=i.replace(/{/gi,"")):(i=i.replace(/{{value=/gi,""),i=i.replace(/}}/gi,""))),i="<div>"+i+"</div>";for(let e in l.data)i=i.replace("{{"+e+"}}",l.data[e]);e.innerHTML!==i&&(e.innerHTML=i)}else{let t="<div>"+r.replace(/{{value}}/gi,a).replace(/{{id}}/gi,l.id)+"</div>";for(let e in l.data)t=t.replace("{{"+e+"}}",l.data[e]);e.innerHTML!==t&&(e.innerHTML=t)}i.onRowDetailInit&&i.onRowDetailInit(l.index,l,e.firstChild),i.rowDetail.dialog.enabled?i.rowDetail.dialog.visible?t._openRowDetailDialog(e.firstChild):t._openRowDetailDialog(e.firstChild.firstElementChild):(l._detail=e.firstChild,l._detail.rowid=l.id)}_renderCards(){const e=this,t=e.row,i=t.grid,l=e.children[1],a=e.children[0],r=e.children[2];e.classList.remove("smart-hidden"),e.removeAttribute("alternation-index"),a.classList.add("smart-hidden"),r.classList.add("smart-hidden"),l.classList.add("smart-hidden");const n=e.children[5];e.style.height=t.height+"px",e.style.width="100%",e.style.lineHeight="";let o=t.visibleIndex;if(i._cardsPerRow||(i._cardsPerRow=1),-1===o&&!1===i.grouping.enabled)return;if(i.grouping.enabled&&t.data&&t.data.$){let e=i.getViewRows();for(let i=0;i<e.length;i++){const l=e[i];if(t.data===l.data){o=i;break}}}if(-1===o||void 0===o)return;let d=i.getViewRows(),s=o*i._cardsPerRow;if(i.paging.enabled){let e=i.paging.pageSize*i.paging.pageIndex;s=e+(o-e)*i._cardsPerRow,i.dataSource&&i.dataSource.virtualDataSource&&!i.dataSource.virtualDataSourceOnExpand&&"infinite"!==i.scrolling&&(s=(o-e)*i._cardsPerRow)}if(n.classList.remove("smart-hidden"),n.hasAttribute("row-index")&&i.isScrolling){const e=n.getAttribute("row-index");if(parseInt(e)===o)return}n.setAttribute("row-index",o),n.innerHTML='<div class="smart-card-layout-view">\n <div class="smart-card-container">\n </div>\n </div>\n ';const c=n.querySelector(".smart-card-container");let h="";const g=[];if(d.length)for(let e=0;e<i._cardsPerRow;e++){let t=d[s+e];const l=i.editing.enabled?" editable ":"";if(t){let e=t.label?" smart-card-header":"";t.children&&t.children.length&&(e+=" smart-card-tree-header"),h+="<div"+l+' row-id="'+t.id+'" class="smart-card'+e+'"><div class="smart-card-data-container">'}else h+="<div"+l+' class="smart-visibility-hidden smart-card"><div class="smart-card-data-container">';if(t){t.label&&(h+=`<div style="height: 100%;" class="smart-card-view-cell" role="row"><div class="smart-hidden smart-card-view-label icon" role="rowheader"></div>\n <div class="smart-card-view-value smart-flex" role="gridcell"><span class="smart-grid-icon show ${t.expanded?"smart-icon-ungroup":"smart-icon-group"}"></span><span>${t.label}</span></div></div>`);let e=!1;for(let l=0;l<i.columns.length;l++){const a=i.columns[l];if(!0!==a.visible)continue;const r=new Smart.Grid.Cell(t,a,i);let n=r.value;a.template&&"function"==typeof a.template||a.formatFunction||"image"===a.template?g.push(r):(r.createElement(),r.render(),r.element.style.width="",r.element.style.left="",r.element.setAttribute("data-field",a.dataField),r.element.setAttribute("row-id",t.id),n=r.element.outerHTML);const o=1===i._cardsPerRow||i.layout.cardVertical||!a.label?"vertical":"";let d=a.showIcon?'<div class="smart-flex"><span class="smart-grid-icon show '+a.icon+'"></span><span>'+a.label+"</span></div>":a.label;a.showCardLabel||(d="");const s=a.cardSpan?"span":"",c=a.cardHeight?"min-height: "+i.layout.cardRowMinHeight*a.cardHeight+"px; height: "+i.layout.cardRowMinHeight*a.cardHeight+"px;":"min-height: "+i.layout.cardRowMinHeight+"px; height: "+i.layout.cardRowMinHeight*a.cardHeight+"px;",m=c?"row-span":"",u=t.data.label?"smart-hidden":"";let w="";if(t.children&&t.children.length&&0===l&&(w=`<span class="smart-grid-icon show ${t.expanded?"smart-icon-group":"smart-icon-ungroup"}"></span>`),(e||w||a.template||i.appearance.cardTitleField)&&a.dataField!==i.appearance.cardTitleField)h+=`<div style="${c}" class="smart-card-view-cell ${m} ${o} ${u} ${s}" row-index="${t.index}" data-field="${a.dataField}" role="row"><div class="smart-card-view-label icon ${a.dataField}" role="rowheader">${d}</div>\n<div class="smart-card-view-value" role="gridcell">${w}${n}</div></div>`;else{e=!0,d="";let l=r.value?"":"smart-quiet";r.value||(n=i.localize("blankSummary")),h+=`<div style="${c}" class="smart-card-view-title smart-card-view-cell ${l} ${m} ${o} ${u} 2" row-index="${t.index}" data-field="${a.dataField}" role="row">\n <div class="smart-card-view-value" role="gridcell">${w}${n}</div></div>`}}}h+="</div></div>"}if(c.innerHTML=h,g.length)for(let e=0;e<g.length;e++){const t=g[e],i=c.querySelector(`[data-field="${t.column.dataField}"][row-index="${t.row.index}"]`);i&&(i.lastElementChild.innerHTML="",t.createElement(),t.render(),t.element.style.width="",t.element.style.left="",i.lastElementChild.appendChild(t.element))}}_render(){let e=this;const t=e.row,i=t.grid;if(!i)return;if("card"===i.view)return void e._renderCards();{e.rowCardContainer&&e.rowCardContainer.classList.add("smart-hidden");const t=e.children[1],i=e.children[0],l=e.children[2];i&&i.classList.remove("smart-hidden"),l&&l.classList.remove("smart-hidden"),t&&t.classList.remove("smart-hidden")}const l=t.getProperty("selected");if(!1===l&&e.hasAttribute("selected")?e.removeAttribute("selected"):!0===l?e.setAttribute("selected",""):null===l&&e.setAttribute("selected","indeterminate"),t.allowSelect||e.setAttribute("selected","none"),e.hasAttribute("unbound")&&e.removeAttribute("unbound"),t.unbound&&e.setAttribute("unbound",""),e.removeAttribute("focus"),i._selection.focusedCell&&i._selection.focusedCell.row&&i._selection.focusedCell.row.id===t.id&&e.setAttribute("focus",""),!i._toggledRow&&e.classList.contains("smart-animate"))return e.classList.remove("smart-animate"),e.rowContainer.innerHTML="",e.rowContainer.classList.add("smart-hidden"),i._refreshLayout(),void i._recycle();if(0===i.columns.length)return void e._renderEmpty();if(t.addNewRow&&!t.inline)return void e._renderAddNewRow();let a=!1;if(t.addNewRow&&t.inline&&(a=!0),i._toggledRow&&(t.id===i._toggledRow.id?e.setAttribute("toggle",""):e.hasAttribute("toggle")&&e.removeAttribute("toggle")),i._toggledRow&&i.appearance.allowRowToggleAnimation){let l=t.parent;if(!i._toggledRow.expanded&&i._toggledRow.id===t.id){const t=e.rowContainer;for(let e=0;e<t.children.length;e++){const l=t.children[e],a=l.getAttribute("data-id"),r=i.rowById[a];l.getAttribute("data-rendered")||(l.setAttribute("data-rendered",!0),r.element=l,r.render())}}for(;l;){if(l.id===i._toggledRow.id){const a=l.element.rowContainer;if(i._toggledRow.expanded){e.classList.add("smart-hidden");let l=t.createElement(i);for(let e=0;e<a.children.length;e++){const i=a.children[e];if(i.getAttribute("data-id")===t.id.toString())return void(l=i)}t.element=l,a.appendChild(l),a.classList.remove("smart-hidden"),l.row=t,e=l}break}l=l.parent}}e._alternate();const r=parseFloat(i.$.columnNearContainer.style.width),n=parseFloat(i.$.columnContainer.style.width),o=parseFloat(i.$.columnFarContainer.style.width),d=e.children[1],s=e.children[0],c=e.children[2];if(i.rightToLeft?(s.classList.remove("vscroll"),i.computedVerticalScrollBarVisibility&&s.classList.add("vscroll")):(c.classList.remove("vscroll"),i.computedVerticalScrollBarVisibility&&c.classList.add("vscroll")),e.hasAttribute("group")&&e.removeAttribute("group"),e.hasAttribute("tree")&&e.removeAttribute("tree"),e.hasAttribute("level")&&(e.removeAttribute("level"),e.removeAttribute("aria-level")),e.hasAttribute("leaf")&&e.removeAttribute("leaf"),e.hasAttribute("expanded")&&e.removeAttribute("expanded"),e.hasAttribute("summary")&&e.removeAttribute("summary"),e.hasAttribute("filter")&&e.removeAttribute("filter"),null===t.filtered&&e.setAttribute("filter","indeterminate"),i.dataSource.groupBy&&i.dataSource.groupBy.length>0&&"advanced"===i.grouping.renderMode&&!t.filterRow?(e.setAttribute("level",t.level),e.setAttribute("aria-level",t.level),t.expanded&&e.setAttribute("expanded",""),void 0!==t.label&&t.level===i.dataSource.groupBy.length-1&&e.setAttribute("leaf",""),void 0!==t.label?e.setAttribute("group",""):e.setAttribute("leaf",""),t.summaryRow&&e.setAttribute("summary",""),e.toggleButton&&e.toggleButton.classList.remove("smart-hidden")):i.dataSource.boundHierarchy?(e.setAttribute("level",t.level),e.setAttribute("aria-level",t.level),t.expanded&&e.setAttribute("expanded",""),t.leaf&&e.setAttribute("leaf",""),t.summaryRow&&e.setAttribute("summary",""),e.toggleButton&&e.toggleButton.classList.remove("smart-hidden")):(t.canNotify=!1,t.leaf=!0,t.expanded=!1,t.summaryRow=!1,t.data||(t.data={}),t.data.summaryRow&&(t.summaryRow=!0),t.level=0,e.toggleButton&&e.toggleButton.classList.add("smart-hidden"),t.canNotify=!0),e.setAttribute("data-id",t.id),e.visible=t.visible,e.cellsNearContainerElement.classList.remove("smart-visibility-hidden"),e.cellsContainerElement.classList.remove("smart-visibility-hidden"),e.cellsFarContainerElement.classList.remove("smart-visibility-hidden"),e.removeAttribute("rowspan"),t.filterRow&&e.setAttribute("filter-row",""),t.summaryRow&&e.setAttribute("summary-row",""),t.addNewRow&&(t.cellHeight=t.height=i.layout.rowMinHeight),i._rowGap>0&&t!==i.rows[i.rows.length-1]?(e.style.marginBottom=i._rowGap+"px",parseInt(e.style.height)-i._rowGap!==t.height&&(e.style.height=t.height-i._rowGap+"px"),parseInt(e.style.lineHeight)-i._rowGap!==t.height&&(e.style.lineHeight=t.height-i._rowGap+"px")):(e.style.marginBottom="",parseInt(e.style.height)!==t.height&&(e.style.height=t.height+"px"),parseInt(e.style.lineHeight)!==t.height&&(e.style.lineHeight=t.height+"px")),i.rightToLeft?(d.style.right!==i._scrollView.scrollWidth-i._scrollView.scrollLeft-i._scrollView.vScrollBar.offsetWidth+"px"&&(d.style.right=i._scrollView.scrollWidth-i._scrollView.scrollLeft-i._scrollView.vScrollBar.offsetWidth+"px"),i._scrollView.scrollWidth-i._scrollView.scrollLeft-i._scrollView.vScrollBar.offsetWidth<=0&&!i._scrollView.scrollWidth&&(d.style.right=-i.offsetWidth+i._computedColumnsWidth+"px")):d.style.left!==-i._scrollView.scrollLeft+"px"&&(d.style.left=-i._scrollView.scrollLeft+"px"),i.rowDetail.enabled){const l=e.rowDetail;e.removeAttribute("show-detail"),t.showDetail?(l.classList.remove("smart-hidden"),e.setAttribute("show-detail",""),i.rowDetail.dialog.enabled?l.classList.add("smart-hidden"):(l.style.height!==t.detailHeight+"px"&&(l.style.height=t.detailHeight+"px"),l.style.lineHeight!==t.detailHeight+"px"&&(l.style.lineHeight=t.detailHeight+"px"),l.style.top!==t.cellHeight+"px"&&(l.style.top=t.cellHeight+"px")),e._renderDetail(l)):l.classList.add("smart-hidden")}else e.rowDetail&&e.rowDetail.classList.add("smart-hidden");if(s.classList.remove("smart-hidden"),c.classList.remove("smart-hidden"),s.style.width!==r+"px"&&(s.style.width=r+"px"),d.style.width!==n+"px"&&(d.style.width=n+"px"),c.style.width!==o+"px"&&(c.style.width=o+"px"),s.style.height=t.cellHeight+"px",d.style.height=t.cellHeight+"px",c.style.height=t.cellHeight+"px",0===o&&c.classList.add("smart-hidden"),0===r&&s.classList.add("smart-hidden"),r>0&&(parseInt(r),parseInt(i._autoGeneratedColumnsNearWidth)),o>0&&parseInt(o)===parseInt(i._autoGeneratedColumnsFarWidth)&&c.classList.add("border-collapse"),t._classNames="",i.onRowClass){const e=i.onRowClass(t.visibleIndex,t.data,t);if(e){const i=e.trim().split(" ");t._classNames=i}}if(i.rowCSSRules){const e=Object.keys(i.rowCSSRules);let l=[];for(let a=0;a<e.length;a++){let r=e[a];const n={index:t.visibleIndex,data:t.data,row:t,api:i};i.rowCSSRules[r](n)&&l.push(r)}t._classNames=l}for(let l=0;l<i._frozenNearColumns.length;l++){const a=i._frozenNearColumns[l];let r=e.children[0].children[l];if(r||(r=t.getCell(a).createElement(),e.children[0].appendChild(r)),0===l&&e.children[0].children.length>i._frozenNearColumns.length)for(let t=i._frozenNearColumns.length;t<e.children[0].children.length;t++){let i=e.children[0].children[t];i&&i.classList.add("smart-hidden")}!1!==a.visbile&&e._renderCell(t,a,r)}for(let l=0;l<i._frozenFarColumns.length;l++){const a=i._frozenFarColumns[l];let r=e.children[2].children[l];r||(r=t.getCell(a).createElement(),e.children[2].appendChild(r)),!1!==a.visbile&&e._renderCell(t,a,r)}for(let l=0;l<d.children.length;l++)if(!i._columnElements[l+i._frozenNearColumns.length]){let i=e.children[1].children[l];e._renderCell(t,null,i)}for(let l=0;l<i._columnElements.length;l++){const a=i._columnElements[l],r=a.column;if(!a.parentNode||!r){if(a&&!r){let t=e.children[1].children[l];t&&t.classList.add("smart-visibility-hidden")}else if(r&&a&&a.classList.contains("smart-visibility-hidden")){let t=e.children[1].children[l];t&&t.classList.add("smart-visibility-hidden")}continue}let n=e.children[1].children[l];n||(a.column||(a.column=r),n=t.getCell(r).createElement(),e.children[1].appendChild(n)),a.classList.contains("smart-visibility-hidden")?n.classList.add("smart-visibility-hidden"):(n.classList.remove("smart-visibility-hidden"),e._renderCell(t,r,n))}if(a){let t=e.children[1].children[0];i.isScrolling||(e._cachedCenterRect=null,e._cachedNearReact=null);const l=e._cachedCenterRect||d.getBoundingClientRect(),a=e._cachedNearReact||s.getBoundingClientRect();e._cachedCenterRect=l,e._cachedNearReact=a;for(let e=0;e<s.children.length;e++)s.children[e].classList.add("smart-add-new-row");const r='<div style="width: 100%;" class="smart-grid-icon smart-icon-plus show"></div>';s.children.length>0&&(s.children[0].innerHTML!==r&&(s.children[0].innerHTML=r),s.children[0].style.width="50px",s.children[0].style.zIndex=9);const n=i.editing.addNewColumn.visible?i._addNewColumn.width:0;let o=l.width-a.width-n+6,c=0;if((i.appearance.showRowHeaderNumber||i.appearance.showRowHeader)&&(c+=30),i.rowDetail.enabled&&(c+=20),i._frozenColumnsNearWidth&&(o+=i._frozenColumnsNearWidth),t.style.width=o+"px",t.style.left=i._scrollView.scrollLeft+c+"px",i.selection.enabled){const e=o>=250?i.localize("addNewRowAlt"):i.localize("addNewRowAltSmall");e!==t.content.innerHTML&&(t.content.innerHTML=e),s.children[1]&&(t.content.title=s.children[1].title=i.localize("addNewRow")),i.rightToLeft&&(t.style.left="initial",t.style.right=a.width+"px"),!1===i.appearance.showRowHeader&&(i.rightToLeft?t.content.innerHTML='<span style="margin-right: 35px;"></span>'+i.localize("addNewRowAlt"):t.content.innerHTML='<span style="margin-left: 35px;"></span>'+i.localize("addNewRowAlt"))}else t.content.innerHTML=i.localize("addNewRow");t.classList.add("smart-add-new-row"),t.firstElementChild.classList.add("align-left"),t.firstElementChild.classList.remove("align-right"),i.grouping.enabled&&i.dataSource&&(e.visible=!(i.dataSource.groupBy.length>0))}t&&t._style&&(t._style._changed=!1),e.visible?e.classList.remove("smart-hidden"):e.classList.add("smart-hidden")}template(){return""}_detach(){const e=this;e.row.headerCell=null,e.row._cells=[],e.row=null,delete e.row,e.element=null,e.removeEventListener("mouseenter",e._mouseEnter),e.removeEventListener("mouseleave",e._mouseLeave),delete e.element,delete e.grid,delete e._mouseEnter,delete e._mouseLeave,delete e.cellsNearContainerElement,delete e.cellsContainerElement,delete e.cellsFarContainerElement,delete e.rowDetail,delete e.rowContainer}onDetached(){this._detach()}});
1513
1513
 
1514
1514
  /***/ }),
1515
1515
 
@@ -1523,7 +1523,7 @@ Smart.Utilities.Assign("Grid.Select",class{_refreshSelection(){const e=this;if(e
1523
1523
  /***/ 3637:
1524
1524
  /***/ (() => {
1525
1525
 
1526
- Smart.Utilities.Assign("Grid.Sort",class{clearSort(){const t=this;if(!t._isSorting&&t.dataSource&&t._sortedColumns){t._isSorting=!0,t.dataSource.clearSort(),t._sortedColumns||(t._sortedColumns=[]);for(let e=0;e<t._sortedColumns.length;e++){const r=t._sortedColumns[e],o=t.columnByDataField[r.dataField];o&&(o.setProperty("sortOrder",null),o.setProperty("sortIndex",null))}t._sortedColumns=[],t.rowById=[];for(let e=0;e<t.dataSource.length;e++){const r=t.rows[e],o=t.dataSource[e];r&&(r.data=o,o&&o.$&&(r.id=o.$.id,r._updateData()),t.rowById[r.id]=r)}t._recycle(),t._refreshHeaderBar(),t._isSorting=!1}}getSortedColumns(){const t=this,e=[];if(t._sortedColumns)for(let r=0;r<t._sortedColumns.length;r++){const o=t._sortedColumns[r];e[o.dataField]={sortOrder:o.sortOrder,sortIndex:o.sortIndex},e.length++}return e}addSort(t,e){this.sortBy(t,e)}removeSort(t){this.sortBy(t,null)}refreshSort(){this._refreshSort(this._sortedColumns)}_refreshSort(t){const e=this;if(e._isSorting||!t)return;if(e._suppressSort)return;if(!1===e.sorting.maintainSort)return;const r=[],o=[],s=[];e._isSorting=!0;let a=[];for(let n=0;n<t.length;n++){const d=t[n],i=e.columnByDataField[d.dataField];i&&(i.setProperty("sortOrder",d.sortOrder),i.setProperty("sortIndex",n),i.sortComparator&&(a[i.dataField]=i.sortComparator),r.push(d.dataField),o.push(d.sortOrder),s.push(d.dataType||"string"))}!function(){if(e.dataSource&&(e.dataSource.sortComparators=a),e.dataSource&&e.dataSource.virtualDataSource)e._virtualDataRequest("sort");else{if(e.dataSource.sortBy(r,s,o),e.dataSource.boundHierarchy)e._refreshRowHierarchy(),e.dataSource.groupBy.length>0&&(e._refreshRowHierarchy(!0,!0),e.refresh());else{e.rowById=[];for(let t=0;t<e.dataSource.length;t++){const r=e.rows[t],o=e.dataSource[t];r.data=o,r.id=o.$.id,r._updateData(),e.rowById[r.id]=r}}e._recycle()}}(),e._refreshHeaderBar(),e._isSorting=!1,e._sortedColumns=t}sortBy(t,e){const r=this,o=r.columnByDataField[t],s=[],a=[],n=[],d=void 0===e;if(r._isSorting||!o)return;r._isSorting=!0,"descending"===e&&(e="desc"),void 0!==e&&"ascending"!==e||(e="asc");const i=function(t){t&&(t.setProperty("sortOrder",null),t.setProperty("sortIndex",null))},l=function(){if(r._sortedColumns.length>0)for(let t=0;t<r._sortedColumns.length;t++){const e=r._sortedColumns[t],o=r.columnByDataField[e.dataField];i(o)}r._sortedColumns=[]};if(null===o)return l(),void(r._isSorting=!1);if(!r.sorting.enabled||!r.dataSource||!o.allowSort||r._sortAnimation)return void(r._isSorting=!1);i(o),r._sortedColumns||(r._sortedColumns=[]);let u="string";const c=r.dataSource&&r.dataSource.dataFields?r.dataSource.dataFields:r.dataSourceSettings.dataFields;if(c)for(let e=0;e<c.length;e++){const r=c[e];if(r.name===t){u=r.dataType;break}}let m=!0;for(let s=0;s<r._sortedColumns.length;s++){const a=r._sortedColumns[s];if(a.dataField===t)if(m=!1,a.sortIndex=o.sortIndex,d){if("asc"===a.sortOrder)a.sortOrder="desc",e="desc";else if("desc"===a.sortOrder){r.sorting.sortToggleThreeStates?(r._sortedColumns.splice(s,1),i(o),e=null):(a.sortOrder="asc",e="asc");break}}else a.sortOrder=e,null===e&&(r._sortedColumns.splice(s,1),i(o))}m&&("one"===r.sorting.mode&&l(),"many"===r.sorting.mode&&!1===r._canSort&&l(),null!==e&&r._sortedColumns.push({dataField:t,sortOrder:e,sortIndex:o.sortIndex,dataType:u})),o.setProperty("sortOrder",e),r._sortedColumns.sort(((t,e)=>"string"==typeof t.sortIndex&&"string"==typeof e.sortIndex?0:"number"==typeof t.sortIndex&&"string"==typeof e.sortIndex?-1:"string"==typeof t.sortIndex&&"number"==typeof e.sortIndex?1:"number"==typeof t.sortIndex&&"number"==typeof e.sortIndex?t.sortIndex-e.sortIndex:void 0));const f=[];for(let t=0;t<r._sortedColumns.length;t++){const e=r._sortedColumns[t];s.push(e.dataField),a.push(e.sortOrder),n.push(e.dataType||"string");const o=r.columnByDataField[e.dataField];o.sortComparator&&(f[o.dataField]=o.sortComparator)}const _=function(){if(r.dataSource.sortComparators=f,r.dataSource&&r.dataSource.virtualDataSource)r._virtualDataRequest("sort");else{if(r.dataSource.sortBy(s,n,a),r.dataSource.boundHierarchy)r._refreshRowHierarchy(),r.dataSource.groupBy.length>0&&r._refreshRowHierarchy(!0,!0),r.refresh();else{r.rowById=[];const t=r.rows.canNotify;r.rows.canNotify=!1;for(let t=0;t<r.dataSource.length;t++){const e=r.rows[t],o=r.dataSource[t];e&&(e.data=o,o&&o.$&&(e.id=o.$.id,e._updateData()),r._filters&&r._filters.length>0&&(e.filtered=void 0===e.data.$.filtered||e.data.$.filtered),r.rowById[e.id]=e)}if(r.rows.canNotify=t,r._filters&&r._filters.length>0&&r.refresh(),r.selection&&r.selection.enabled&&r._selection){r._selection.indexes=[];const t=r._selection.selectionRect;t&&(delete r._selection.selectionRect,t.parentNode.removeChild(t)),r._refreshCellSelectionRect()}}r._recycle()}const t=[],e=[];for(let o=0;o<r._sortedColumns.length;o++){const s=r.columnByDataField[r._sortedColumns[o].dataField];s&&(s.setProperty("sortIndex",o),t.push(s),e.push(s.sortIndex),r._sortedColumns[o].sortIndex=o)}r._refreshHeaderBar(),r.$.fireEvent("sort",{sortDataFields:s,sortOrders:a,sortDataTypes:n,sortIndexes:e,columns:t,data:r._sortedColumns}),r._onSort&&r._onSort()};if(r.appearance.allowSortAnimation){let t=[],e=[];r.rows.canNotify=!1,r._sortAnimation=!0;const o=function(){for(let e=0;e<r._rowElements.length;e++){const o=r._rowElements[e];o.classList.remove("smart-grid-sort-animation"),r.removeTransformMoveStyle(o),o.offsetHeight>0&&t.push(o.offsetTop)}};o(),r._sortTimer=setTimeout((function(){o(),r._sortAnimation=!1,r.rows.canNotify=!0}),r.appearance.sortAnimationDuration),r._sortTimer2=setTimeout((function(){_()}),r.appearance.sortAnimationDuration/2);for(let o=0;o<t.length;o++){const s=r._rowElements[o];s.classList.remove("smart-grid-sort-animation"),r.removeTransformMoveStyle(s);let a=Math.floor(Math.random()*t.length-1+1);for(;e[a];)a=Math.floor(Math.random()*t.length-1+1);e[a]=!0,r.addTransformMoveStyle(s,"0ms",0,-s.offsetTop+t[a],0,.5),s.classList.add("smart-grid-sort-animation"),setTimeout((function(){r.addTransformMoveStyle(s,r.appearance.sortAnimationDuration+"ms",0,0,0,1)})),setTimeout((function(){s.classList.remove("smart-grid-sort-animation")}),r.appearance.sortAnimationDuration)}}else _();r._isSorting=!1}});
1526
+ Smart.Utilities.Assign("Grid.Sort",class{clearSort(){const t=this;if(!t._isSorting&&t.dataSource&&t._sortedColumns){t._isSorting=!0,t.dataSource.clearSort(),t._sortedColumns||(t._sortedColumns=[]);for(let e=0;e<t._sortedColumns.length;e++){const r=t._sortedColumns[e],o=t.columnByDataField[r.dataField];o&&(o.setProperty("sortOrder",null),o.setProperty("sortIndex",null))}t._sortedColumns=[],t.rowById=[];for(let e=0;e<t.dataSource.length;e++){const r=t.rows[e],o=t.dataSource[e];r&&(r.data=o,o&&o.$&&(r.id=o.$.id,r._updateData()),t.rowById[r.id]=r)}t._recycle(),t._refreshHeaderBar(),t._isSorting=!1}}getSortedColumns(){const t=this,e=[];if(t._sortedColumns)for(let r=0;r<t._sortedColumns.length;r++){const o=t._sortedColumns[r];e[o.dataField]={sortOrder:o.sortOrder,sortIndex:o.sortIndex},e.length++}return e}addSort(t,e){this.sortBy(t,e)}removeSort(t){this.sortBy(t,null)}refreshSort(){this._refreshSort(this._sortedColumns)}_refreshSort(t){const e=this;if(e._isSorting||!t)return;if(e._suppressSort)return;if(!1===e.sorting.maintainSort)return;const r=[],o=[],s=[];e._isSorting=!0;let n=[];for(let a=0;a<t.length;a++){const d=t[a],i=e.columnByDataField[d.dataField];i&&(i.setProperty("sortOrder",d.sortOrder),i.setProperty("sortIndex",a),i.sortComparator&&(n[i.dataField]=i.sortComparator),r.push(d.dataField),o.push(d.sortOrder),s.push(d.dataType||"string"))}!function(){if(e.dataSource&&(e.dataSource.sortComparators=n),e.dataSource&&e.dataSource.virtualDataSource)e._virtualDataRequest("sort");else{if(e.dataSource.sortBy(r,s,o),e.dataSource.boundHierarchy)e._refreshRowHierarchy(),e.dataSource.groupBy.length>0&&(e._refreshRowHierarchy(!0,!0),e.refresh());else{e.rowById=[];for(let t=0;t<e.dataSource.length;t++){const r=e.rows[t],o=e.dataSource[t];r.data=o,r.id=o.$.id,r._updateData(),e.rowById[r.id]=r}}e._recycle()}e._renderConditionalFormatting(!0)}(),e._refreshHeaderBar(),e._isSorting=!1,e._sortedColumns=t}sortBy(t,e){const r=this,o=r.columnByDataField[t],s=[],n=[],a=[],d=void 0===e;if(r._isSorting||!o)return;r._isSorting=!0,"descending"===e&&(e="desc"),void 0!==e&&"ascending"!==e||(e="asc");const i=function(t){t&&(t.setProperty("sortOrder",null),t.setProperty("sortIndex",null))},l=function(){if(r._sortedColumns.length>0)for(let t=0;t<r._sortedColumns.length;t++){const e=r._sortedColumns[t],o=r.columnByDataField[e.dataField];i(o)}r._sortedColumns=[]};if(null===o)return l(),void(r._isSorting=!1);if(!r.sorting.enabled||!r.dataSource||!o.allowSort||r._sortAnimation)return void(r._isSorting=!1);i(o),r._sortedColumns||(r._sortedColumns=[]);let u="string";const c=r.dataSource&&r.dataSource.dataFields?r.dataSource.dataFields:r.dataSourceSettings.dataFields;if(c)for(let e=0;e<c.length;e++){const r=c[e];if(r.name===t){u=r.dataType;break}}let m=!0;for(let s=0;s<r._sortedColumns.length;s++){const n=r._sortedColumns[s];if(n.dataField===t)if(m=!1,n.sortIndex=o.sortIndex,d){if("asc"===n.sortOrder)n.sortOrder="desc",e="desc";else if("desc"===n.sortOrder){r.sorting.sortToggleThreeStates?(r._sortedColumns.splice(s,1),i(o),e=null):(n.sortOrder="asc",e="asc");break}}else n.sortOrder=e,null===e&&(r._sortedColumns.splice(s,1),i(o))}m&&("one"===r.sorting.mode&&l(),"many"===r.sorting.mode&&!1===r._canSort&&l(),null!==e&&r._sortedColumns.push({dataField:t,sortOrder:e,sortIndex:o.sortIndex,dataType:u})),o.setProperty("sortOrder",e),r._sortedColumns.sort(((t,e)=>"string"==typeof t.sortIndex&&"string"==typeof e.sortIndex?0:"number"==typeof t.sortIndex&&"string"==typeof e.sortIndex?-1:"string"==typeof t.sortIndex&&"number"==typeof e.sortIndex?1:"number"==typeof t.sortIndex&&"number"==typeof e.sortIndex?t.sortIndex-e.sortIndex:void 0));const f=[];for(let t=0;t<r._sortedColumns.length;t++){const e=r._sortedColumns[t];s.push(e.dataField),n.push(e.sortOrder),a.push(e.dataType||"string");const o=r.columnByDataField[e.dataField];o.sortComparator&&(f[o.dataField]=o.sortComparator)}const _=function(){if(r.dataSource.sortComparators=f,r.dataSource&&r.dataSource.virtualDataSource)r._virtualDataRequest("sort");else{if(r.dataSource.sortBy(s,a,n),r.dataSource.boundHierarchy)r._refreshRowHierarchy(),r.dataSource.groupBy.length>0&&r._refreshRowHierarchy(!0,!0),r.refresh();else{r.rowById=[];const t=r.rows.canNotify;r.rows.canNotify=!1;for(let t=0;t<r.dataSource.length;t++){const e=r.rows[t],o=r.dataSource[t];e&&(e.data=o,o&&o.$&&(e.id=o.$.id,e._updateData()),r._filters&&r._filters.length>0&&(e.filtered=void 0===e.data.$.filtered||e.data.$.filtered),r.rowById[e.id]=e)}if(r.rows.canNotify=t,r._filters&&r._filters.length>0&&r.refresh(),r.selection&&r.selection.enabled&&r._selection){r._selection.indexes=[];const t=r._selection.selectionRect;t&&(delete r._selection.selectionRect,t.parentNode.removeChild(t)),r._refreshCellSelectionRect()}}r._recycle()}const t=[],e=[];for(let o=0;o<r._sortedColumns.length;o++){const s=r.columnByDataField[r._sortedColumns[o].dataField];s&&(s.setProperty("sortIndex",o),t.push(s),e.push(s.sortIndex),r._sortedColumns[o].sortIndex=o)}r._refreshHeaderBar(),r._renderConditionalFormatting(!0),r.$.fireEvent("sort",{sortDataFields:s,sortOrders:n,sortDataTypes:a,sortIndexes:e,columns:t,data:r._sortedColumns}),r._onSort&&r._onSort()};if(r.appearance.allowSortAnimation){let t=[],e=[];r.rows.canNotify=!1,r._sortAnimation=!0;const o=function(){for(let e=0;e<r._rowElements.length;e++){const o=r._rowElements[e];o.classList.remove("smart-grid-sort-animation"),r.removeTransformMoveStyle(o),o.offsetHeight>0&&t.push(o.offsetTop)}};o(),r._sortTimer=setTimeout((function(){o(),r._sortAnimation=!1,r.rows.canNotify=!0}),r.appearance.sortAnimationDuration),r._sortTimer2=setTimeout((function(){_()}),r.appearance.sortAnimationDuration/2);for(let o=0;o<t.length;o++){const s=r._rowElements[o];s.classList.remove("smart-grid-sort-animation"),r.removeTransformMoveStyle(s);let n=Math.floor(Math.random()*t.length-1+1);for(;e[n];)n=Math.floor(Math.random()*t.length-1+1);e[n]=!0,r.addTransformMoveStyle(s,"0ms",0,-s.offsetTop+t[n],0,.5),s.classList.add("smart-grid-sort-animation"),setTimeout((function(){r.addTransformMoveStyle(s,r.appearance.sortAnimationDuration+"ms",0,0,0,1)})),setTimeout((function(){s.classList.remove("smart-grid-sort-animation")}),r.appearance.sortAnimationDuration)}}else _();r._isSorting=!1}});
1527
1527
 
1528
1528
  /***/ }),
1529
1529
 
@@ -1551,7 +1551,7 @@ Smart.Utilities.Assign("Grid.View",class{createBasicKanban(){this._initKanbanVie
1551
1551
  /***/ 3176:
1552
1552
  /***/ (() => {
1553
1553
 
1554
- Smart("smart-grid-panel",class extends Smart.BaseElement{static get properties(){return{closeButtonPosition:{value:"left",allowedValues:["left","right"],type:"string"},dataSource:{value:[],type:"array",reflectToAttribute:!1},messages:{value:{en:{apply:"Ok",booleanFirst:"☐",booleanLast:"☑",cancel:"Cancel",dateFirst:"1",dateLast:"9",from:"from",numberFirst:"1",numberLast:"9",stringFirst:"A",stringLast:"Z",thenBy:"then by"}},type:"object",extend:!0}}}static get listeners(){return{change:"_changeHandler",click:"_clickHandler",keydown:"_keydownHandler","sortable.dragEnd":"_sortableDragEndHandler"}}static get requires(){return{"Smart.Input":"smart.input.js","Smart.Sortable":"smart.sortable.js"}}static get styleUrls(){return["smart.gridpanel.css"]}template(){return'<div id="container" role="presentation">\n <smart-sortable id="sortable" disable-mode="manual" animation="[[animation]]" disabled="[[readonly]]" right-to-left="[[rightToLeft]]"\n drag-mode="handle" handle-position="right" handle-visibility="visible" theme="[[theme]]">\n </smart-sortable>\n <div id="footer" class="smart-grid-panel-container-footer" role="presentation">\n <smart-input id="inputNotSorted" right-to-left="[[rightToLeft]]" animation="[[animation]]" readonly theme="[[theme]]"></smart-input>\n <div id="buttonsContainer" class="smart-grid-panel-buttons-container smart-unselectable" role="presentation">\n <span class="smart-grid-panel-cancel-button" role="button"></span>\n <span class="smart-grid-panel-apply-button primary" role="button"></span>\n </div>\n </div>\n </div>'}ready(){super.ready()}render(){const e=this;e.setAttribute("role","dialog"),"right"===e.closeButtonPosition&&(e.$.sortable.handlePosition="left"),e._localize(),e._createSources(),super.render()}propertyChangedHandler(e,t,a){super.propertyChangedHandler(e,t,a);const l=this;switch(e){case"animation":case"theme":Array.from(l.$.sortable.getElementsByTagName("smart-input")).forEach((t=>t[e]=a));break;case"disabled":case"unfocusable":l._setFocusable();break;case"closeButtonPosition":"right"===l.closeButtonPosition?l.$.sortable.handlePosition="left":l.$.sortable.handlePosition="right";break;case"dataSource":l.$.sortable.$.container.innerHTML="",l._createSources();break;case"locale":case"messages":{const e=l.$.sortable._items;l._localize(),e.length&&(e[0].children[1].innerHTML=l.localize("firstBy"),e.forEach((function(e,t){0!==t&&(e.children[1].innerHTML=l.localize("thenBy"));const a=l._HTMLToSourceMap.get(e),n=l._ascDescTemplates[a.dataType]||l._ascDescTemplates.string;e.children[3].innerHTML=l.localize("from"),e.children[4].firstElementChild.innerHTML=n[0],e.children[4].children[1].innerHTML=n[1]})));break}case"maxLevel":if(null!=a)for(;l.$.sortable._items.length>0&&l.$.sortable._items.length>a;)l._interactionHandler(l.$.sortable._items[l.$.sortable._items.length-1].firstElementChild);l._disableItemAddition();break;case"rightToLeft":l.$.inputNotSorted.rightToLeft=a,l.$.inputNotSorted.dropDownButtonPosition=a?"left":"right",l.$.sortable._items.forEach((e=>{const t=e.querySelector("smart-input");t.rightToLeft=a,t.dropDownButtonPosition=a?"left":"right"}))}}_changeHandler(e){const t=this,a=t.shadowRoot||t.isInShadowDOM?e.composedPath()[0]:e.target;if(t.$.inputNotSorted.contains(a)){const e=t.$.inputNotSorted.value,a=t._labelToSourceMap.get(e);return t._createSortItem(a,t.$.sortable._items.length),t.$.sortable.updateItems(),t._visibleLabels.push(e),t._updateHiddenSource(),t._disableItemAddition(),void(t.$.inputNotSorted.value="")}const l=a.closest("smart-input");if(!l)return;const n=l.parentElement.parentElement,i=n.children[4].firstElementChild,o=n.children[4].children[1],r=l.value,s=t._HTMLToSourceMap.get(n).label,d=t._labelToSourceMap.get(r),c=t._ascDescTemplates[d.dataType]||t._ascDescTemplates.string;t._HTMLToSourceMap.set(n,d),t._visibleLabels.splice(t._visibleLabels.indexOf(s),1,r),t._updateHiddenSource(),i.innerHTML=c[0],o.innerHTML=c[1],d.sortDirection&&-1===d.sortDirection.indexOf("asc")?(o.classList.add("selected"),i.classList.remove("selected")):(i.classList.add("selected"),o.classList.remove("selected"))}_updateHiddenSource(){const e=this;e._hiddenSource=e.dataSource.map((e=>({label:e.label,value:e.dataField,icon:e.icon}))).filter((t=>-1===e._visibleLabels.indexOf(t.label)));const t=e.$.inputNotSorted.context;e.$.inputNotSorted.context=e.$.inputNotSorted,e.$.inputNotSorted.dataSource=e._hiddenSource,e.$.sortable._items.forEach((t=>{const a=t.getElementsByTagName("smart-input")[0],l=a.context;a.context=a,a.dataSource=e._hiddenSource,a.context=l})),e.$.inputNotSorted.context=t,e._disableItemAddition(),e.$.fireEvent("dataSourceChange")}_clickHandler(e){const t=this;t._interactionHandler(t.shadowRoot||t.isInShadowDOM?e.composedPath()[0]:e.target,e)}_interactionHandler(e,t){const a=this;if(a.disabled||a.readonly)return!0;const l=e.closest(".smart-grid-panel-item");if(l){if(e===l.firstElementChild){const e=a._HTMLToSourceMap.get(l).label;a.$.sortable.$.container.removeChild(l),a.$.sortable.updateItems(),a._visibleLabels.splice(a._visibleLabels.indexOf(e),1),a._updateHiddenSource(),a._disableItemAddition(),a.$.sortable._items.length&&(a.$.sortable._items[0].children[1].innerHTML=a.localize("firstBy")),a.$.fireEvent("remove")}else if(l.children[4].contains(e)){const n=l.children[4].firstElementChild,i=l.children[4].children[1];"click"===t.type?e.classList.contains("selected")||(e===n?(i.classList.remove("selected"),n.classList.add("selected"),a._HTMLToSourceMap.get(l).sortDirection="ascending"):e===i&&(n.classList.remove("selected"),i.classList.add("selected"),a._HTMLToSourceMap.get(l).sortDirection="descending")):(n.classList.toggle("selected"),i.classList.toggle("selected"),a._HTMLToSourceMap.get(l).sortDirection=n.classList.contains("selected")?"ascending":"descending")}return!0}if(e===a.$.buttonsContainer.firstElementChild)return a.$.fireEvent("cancel"),!0;if(e===a.$.buttonsContainer.children[1]){const e=[],t={dataFields:[],dataTypes:[],orderBy:[]},l={value:e};return a.$.sortable._items.forEach((l=>{const n=a._HTMLToSourceMap.get(l);e.push({dataField:n.dataField,sortDirection:n.sortDirection}),t.dataFields.push(n.dataField),t.dataTypes.push(n.dataType),t.orderBy.push(n.sortDirection)})),a instanceof Smart.SortPanel&&a.$.maintainSortContainer&&(t.maintainSort=a.$.maintainSortContainer.firstElementChild.hasAttribute("active")),(a instanceof Smart.SortPanel||a instanceof Smart.GroupPanel)&&(l.sortByInfo=t),a.$.fireEvent("apply",l),!0}}_keydownHandler(e){const t=this,a=e.key;" "!==a&&"Enter"!==a||(e.preventDefault(),t._interactionHandler((t.shadowRoot||t.getRootNode()).activeElement,e))}_sortableDragEndHandler(e){const t=this,a=e.detail.oldIndex,l=e.detail.newIndex,n=Math.max(a,l),i=t.$.sortable._items;0===(a&&l)&&(i[0].children[1].innerHTML=t.localize("firstBy"),i[1].children[1].innerHTML=t.localize("thenBy"),n>1&&(i[n].children[1].innerHTML=t.localize("thenBy")))}_localize(){const e=this;e.$.inputNotSorted.placeholder=e.localize("pickAnother"),e.$.buttonsContainer.firstElementChild.innerHTML=e.localize("cancel"),e.$.buttonsContainer.children[1].innerHTML=e.localize("apply"),e._ascDescTemplates={boolean:[e.localize("booleanFirst")+" → "+e.localize("booleanLast"),e.localize("booleanLast")+" → "+e.localize("booleanFirst")],date:[e.localize("dateFirst")+" → "+e.localize("dateLast"),e.localize("dateLast")+" → "+e.localize("dateFirst")],number:[e.localize("numberFirst")+" → "+e.localize("numberLast"),e.localize("numberLast")+" → "+e.localize("numberFirst")],string:[e.localize("stringFirst")+" → "+e.localize("stringLast"),e.localize("stringLast")+" → "+e.localize("stringFirst")]}}_createSources(){const e=this,t=(e instanceof Smart.SortPanel?"sort":"group")+"Index",a=[],l=[];if(e._HTMLToSourceMap=new Map,e._labelToSourceMap=new Map,e.dataSource.forEach((l=>{e._labelToSourceMap.set(l.label,l),-1!==l[t]&&void 0!==l[t]&&a.push(l)})),a.sort(((e,a)=>e[t]-a[t])),void 0!==e.maxLevel&&null!==e.maxLevel)for(;a.length>0&&a.length>e.maxLevel;)a.pop();e.$.inputNotSorted.dropDownButtonPosition=e.rightToLeft?"left":"right",e.$.inputNotSorted.dataSource&&e.$.inputNotSorted.dataSource.length<10&&e.$.inputNotSorted.dataSource.length>0?e.$.inputNotSorted.dropDownHeight="auto":e.$.inputNotSorted.dropDownHeight=250,a.forEach((e=>l.push(e.label))),e._visibleLabels=l,e._updateHiddenSource(),a.forEach(((t,a)=>{e._createSortItem(t,a)})),e.$.sortable.updateItems(),e._disableItemAddition(),e._setFocusable()}_createSortItem(e,t){const a=this,l=a.disabled||a.unfocusable?-1:0,n=document.createElement("div"),i=a._ascDescTemplates[e.dataType]||a._ascDescTemplates.string;n.className="smart-grid-panel-item",n.innerHTML=`<div class="smart-grid-panel-item-close-button" tabindex="${l}" role="button" aria-label="Close"></div>\n<div class="smart-grid-panel-label-by smart-unselectable" role="presentation">${a.localize(t>0?"thenBy":"firstBy")}</div>\n<div class="smart-grid-panel-field-container" role="presentation"><smart-input class="smart-grid-panel-field-selection" value="${e.label}" animation="${a.animation}" readonly theme="${a.theme}" aria-label="Field name"></smart-input></div>\n<div class="smart-grid-panel-from smart-unselectable" role="presentation">${a.localize("from")}</div >\n<div class="smart-grid-panel-direction smart-unselectable" tabindex="${l}" role="presentation">\n <div class="smart-grid-panel-asc" role="button" aria-label="Ascending">${i[0]}</div >\n <div class="smart-grid-panel-desc" role="button" aria-label="Descending">${i[1]}</div>\n</div>\n`;const o=n.querySelector("smart-input");o.dataSource=a._hiddenSource,o.rightToLeft=a.rightToLeft,o.dropDownButtonPosition=a.rightToLeft?"left":"right",o.dataSource&&o.dataSource.length<10?o.dropDownHeight="auto":o.dropDownHeight=250,a.$.sortable.$.container.appendChild(n),o.tabIndex=l,e.sortDirection&&-1===e.sortDirection.indexOf("asc")?n.children[4].children[1].classList.add("selected"):(e.sortDirection="ascending",n.children[4].firstElementChild.classList.add("selected")),a._HTMLToSourceMap.set(n,e)}_disableItemAddition(){const e=this,t=e.maxLevel,a=0===e._hiddenSource.length||null!=t&&Math.max(0,t)===e.$.sortable._items.length;e.$.inputNotSorted.disabled=a,a&&e.$.inputNotSorted.removeAttribute("focus")}_setFocusable(){const e=this,t=e.disabled||e.unfocusable?-1:0,a=Array.from(e.getElementsByClassName("smart-grid-panel-item-close-button")),l=Array.from(e.getElementsByClassName("smart-grid-panel-direction")),n=Array.from(e.getElementsByTagName("input")),i=a.concat(l).concat(n);e.$.buttonsContainer.firstElementChild.tabIndex=t,e.$.buttonsContainer.children[1].tabIndex=t,i.forEach((e=>e.tabIndex=t))}}),Smart("smart-sort-panel",class extends Smart.GridPanel{static get properties(){return{messages:{value:{en:{firstBy:"Sort by",noSorting:"No sorting applied",pickAnother:"Pick another field to sort by",maintainSort:"Maintain Sort",applyOnce:"Apply once"}},type:"object",extend:!0}}}template(){return'<div id="container" role="presentation">\n <smart-sortable disable-mode="manual" right-to-left="[[rightToLeft]]" id="sortable" animation="[[animation]]" disabled="[[readonly]]" drag-mode="handle" handle-position="right" handle-visibility="visible" theme="[[theme]]"></smart-sortable>\n <div id="footer" class="smart-grid-panel-container-footer" role="presentation">\n <div>\n <smart-input right-to-left="[[rightToLeft]]" id="inputNotSorted" animation="[[animation]]" readonly theme="[[theme]]"></smart-input>\n <div id="maintainSortContainer" class="smart-hidden smart-grid-panel-buttons-container smart-grid-panel-maintain-sort smart-unselectable" role="presentation">\n <span class="smart-grid-panel-maintain-sort-button" role="button"></span>\n </div>\n \n </div>\n <div id="buttonsContainer" class="smart-grid-panel-buttons-container smart-unselectable" role="presentation">\n <span class="smart-grid-panel-cancel-button" role="button"></span>\n <span class="smart-grid-panel-apply-button primary" role="button"></span>\n </div>\n </div>\n </div>'}_changeApplyButtonText(e){const t=this,a=t.$.maintainSortContainer.firstElementChild,l=t.querySelector(".smart-grid-panel-apply-button");e?a.hasAttribute("active")?(a.removeAttribute("active"),l&&(l.innerHTML=t.localize("applyOnce"))):(a.setAttribute("active",""),l&&(l.innerHTML=t.localize("apply"))):a.hasAttribute("active")?l.innerHTML=t.localize("apply"):l.innerHTML=t.localize("applyOnce")}_interactionHandler(e,t){const a=this;super._interactionHandler(e,t)||e===a.$.maintainSortContainer.firstElementChild&&a._changeApplyButtonText(!0)}static get styleUrls(){return["smart.textbox.css"]}_localize(){super._localize();const e=this;e.$.sortable.$.container.setAttribute("no-sorting",e.localize("noSorting")),e.$.maintainSortContainer.firstElementChild.innerHTML=e.localize("maintainSort"),e._changeApplyButtonText()}}),Smart("smart-group-panel",class extends Smart.GridPanel{static get properties(){return{maxLevel:{value:8,type:"number?"},messages:{value:{en:{collapseAll:"Collapse all",expandAll:"Expand all",firstBy:"Group by",noGrouping:"No grouping",pickAnother:"Pick another field to group by"}},type:"object",extend:!0}}}template(){return'<div id="container" role="presentation">\n <smart-sortable disable-mode="manual" right-to-left="[[rightToLeft]]" id="sortable" animation="[[animation]]" disabled="[[readonly]]" drag-mode="handle" handle-position="right" handle-visibility="visible" theme="[[theme]]"></smart-sortable>\n <div id="expandCollapseContainer" class="smart-grid-panel-buttons-container smart-grid-panel-expand-collapse smart-unselectable" role="presentation">\n <span class="smart-group-panel-collapse-button" role="button"></span>\n <span class="smart-group-panel-expand-button" role="button"></span>\n </div>\n <div id="footer" class="smart-grid-panel-container-footer" role="presentation">\n <smart-input right-to-left="[[rightToLeft]]" id="inputNotSorted" animation="[[animation]]" readonly theme="[[theme]]"></smart-input>\n <div id="buttonsContainer" class="smart-grid-panel-buttons-container smart-unselectable" role="presentation">\n <span class="smart-grid-panel-cancel-button" role="button"></span>\n <span class="smart-grid-panel-apply-button primary" role="button"></span>\n </div>\n </div>\n </div>'}_interactionHandler(e,t){const a=this;super._interactionHandler(e,t)||(e===a.$.expandCollapseContainer.firstElementChild?a.$.fireEvent("collapseAll"):e===a.$.expandCollapseContainer.children[1]&&a.$.fireEvent("expandAll"))}_localize(){super._localize();const e=this;e.$.expandCollapseContainer.firstElementChild.innerHTML=e.localize("collapseAll"),e.$.expandCollapseContainer.children[1].innerHTML=e.localize("expandAll"),e.$.sortable.$.container.setAttribute("no-grouping",e.localize("noGrouping"))}_setFocusable(){super._setFocusable();const e=this,t=e.disabled||e.unfocusable?-1:0;e.$.expandCollapseContainer.firstElementChild.tabIndex=t,e.$.expandCollapseContainer.children[1].tabIndex=t}}),Smart("smart-multi-column-filter-panel",class extends Smart.BaseElement{static get properties(){return{closeButtonPosition:{value:"left",allowedValues:["left","right"],type:"string"},dataSource:{value:[],type:"array",reflectToAttribute:!1},editorCallback:{value:null,type:"function?",reflectToAttribute:!1},editorPlaceholder:{value:"Value",type:"string"},messages:{value:{en:{addFilter:"+ Add filter",and:"And",apply:"Ok",cancel:"Cancel",CONTAINS:"contains",CONTAINS_CASE_SENSITIVE:"contains (case sensitive)",DOES_NOT_CONTAIN:"does not contain",DOES_NOT_CONTAIN_CASE_SENSITIVE:"does not contain (case sensitive)",EMPTY:"empty",ENDS_WITH:"ends with",ENDS_WITH_CASE_SENSITIVE:"ends with (case sensitive)",EQUAL:"equal",EQUAL_CASE_SENSITIVE:"equal (case sensitive)",GREATER_THAN:"greater than",GREATER_THAN_OR_EQUAL:"greater than or equal",LESS_THAN:"less than",LESS_THAN_OR_EQUAL:"less than or equal",noFilters:"No filters applied",NOT_EMPTY:"not empty",NOT_EQUAL:"not equal",NOT_NULL:"not null",NULL:"null",or:"Or",STARTS_WITH:"starts with",STARTS_WITH_CASE_SENSITIVE:"starts with (case sensitive)",where:"Where",TOMORROW:"Tomorrow",TODAY:"Today",YESTERDAY:"Yesterday",NEXT_WEEK:"Next week",THIS_WEEK:"This week",LAST_WEEK:"Last week",NEXT_MONTH:"Next month",THIS_MONTH:"This month",LAST_MONTH:"Last month"}},type:"object",extend:!0},operator:{value:"and",allowedValues:["and","or"],type:"string"},value:{value:[],type:"array"}}}static get listeners(){return{change:"_changeHandler",click:"_interactionHandler",keydown:"_interactionHandler"}}static get requires(){return{"Smart.Button":"smart.button.js","Smart.CheckBox":"smart.checkbox.js","Smart.DateTimePicker":"smart.datetimepicker.js","Smart.FilterGroup":"smart.filter.js","Smart.Input":"smart.input.js","Smart.NumericTextBox":"smart.numerictextbox.js"}}static get styleUrls(){return["smart.gridpanel.css"]}template(){return'<div id="container" role="presentation">\n <div id="itemsContainer" class="smart-filter-panel-items-container smart-unselectable"></div>\n <div id="footer" class="smart-grid-panel-container-footer" role="presentation">\n <div id="addFilterButton" class="smart-filter-panel-add-filter-button smart-unselectable" role="button"></div>\n <div id="buttonsContainer" class="smart-grid-panel-buttons-container smart-unselectable" role="presentation">\n <span class="smart-grid-panel-cancel-button" role="button"></span>\n <span class="smart-grid-panel-apply-button primary" role="button"></span>\n </div>\n </div>\n </div>'}ready(){super.ready()}render(){const e=this;e.setAttribute("role","dialog"),e._setFocusable(),e._localize(),e._applyValue(),super.render()}propertyChangedHandler(e,t,a){super.propertyChangedHandler(e,t,a);const l=this;switch(e){case"animation":case"theme":case"rightToLeft":Array.from(l.$.itemsContainer.querySelectorAll("smart-date-time-picker, smart-numeric-text-box, smart-check-box, smart-input")).forEach((t=>{t[e]=a,"smart-input"===t.tagName.toLowerCase()&&"rightToLeft"===e&&"none"!==t.dropDownButtonPosition&&(t.dropDownButtonPosition=a?"left":"right")}));break;case"disabled":case"unfocusable":l._setFocusable(!0);break;case"dataSource":case"value":l._applyValue();break;case"editorPlaceholder":Array.from(l.$.itemsContainer.getElementsByClassName("editor")).forEach((e=>e.placeholder=a));break;case"locale":case"messages":l._localize(!0);break;case"operator":l._setOperator()}}_setOperator(){const e=this,t=e.localize(e.operator);for(let a=2;a<e._items.length;a++)e._items[a].children[1].innerHTML=t}_changeHandler(e){const t=this,a=t.shadowRoot||t.isInShadowDOM?e.composedPath()[0]:e.target;if(a instanceof Smart.Input==0)return;const l=a.parentElement,n=l.children;if(a===n[1])t.operator=a.$.input.dataValue,t._setOperator();else if(a===n[2]){let a,i,o=t.dataSource.find((t=>t.dataField===e.detail.oldValue)).dataType,r=t.dataSource.find((t=>t.dataField===e.detail.oldValue)),s=t.dataSource.find((t=>t.dataField===e.detail.value)),d=s.dataType,c=[];if(s.options&&(d="enum",c=s.options.map((e=>{const t=e.color||"var(--smart-primary)";return e.prefix='<span style="background: '+t+'; width: 14px; height: 14px; display: inline-block; border-radius: 50%; margin-left:-4px; margin-right: 8px; top: 2px; position: relative;"></span>',""===e.label&&(e.label=" "),e}))),r&&r.options&&(o="enum"),"enum"!==d&&d===o)return void(t.editorCallback&&t.editorCallback(n[4],s));let p=n[3].value;switch(d){case"date":a=t._dateConditions,i=document.createElement("smart-date-time-picker"),i.calendarButton=!0,i.dropDownAppendTo="body",i.dropDownDisplayMode="auto",i.formatString="M/d/yy H:mm",p="";break;case"number":a=t._numberAndDateConditions,i=document.createElement("smart-numeric-text-box"),p="";break;case"boolean":a=t._booleanConditions,i=document.createElement("smart-check-box"),p="";break;case"enum":a=t._enumConditions,i=document.createElement("smart-input"),i.dataSource=c.length?c:s.options,i.readonly=!0,i.dropDownButtonPosition="right",p=a[0];break;default:a=t._stringConditions,p=t._stringConditions.find((e=>"CONTAINS"===e.value)),i=document.createElement("smart-input")}a.forEach((e=>{delete e.selected})),i.rightToLeft=t.rightToLeft,i.animation=t.animation,i.theme=t.theme,i.unfocusable=t.disabled||t.unfocusable,i.classList.add("underlined"),i.dataSource&&i.dataSource.length<10?i.dropDownHeight="auto":i.dropDownHeight=250,"boolean"!==d&&(i.placeholder=t.editorPlaceholder),t.editorCallback&&t.editorCallback(i,s),n[4]&&n[4].remove(),l.appendChild(i),""===p||a.find((e=>e.label===p))||(p.value?(n[3].value=p.label,n[3].selectedValue=p.value):(n[3].value="",n[3].selectedValue="")),n[3].dataSource=a,""===p&&(n[3].value=a[0].label,n[3].selectedValue=a[0].value),a.length>=10?n[3].dropDownHeight=250:n[3].dropDownHeight="auto",l.dataType=d}else if(a===n[3]){const e=n[4],t=a.$.input.dataValue;-1!==t.indexOf("NULL")||-1!==t.indexOf("EMPTY")||-1!==t.indexOf("THIS_WEEK")||-1!==t.indexOf("LAST_WEEK")||-1!==t.indexOf("NEXT_WEEK")||-1!==t.indexOf("THIS_MONTH")||-1!==t.indexOf("LAST_MONTH")||-1!==t.indexOf("NEXT_MONTH")||-1!==t.indexOf("THIS_YEAR")||-1!==t.indexOf("LAST_YEAR")||-1!==t.indexOf("NEXT_YEAR")||-1!==t.indexOf("TODAY")||-1!==t.indexOf("TOMORROW")||-1!==t.indexOf("YESTERDAY")?(e.value="",e.checked=!1,e.classList.add("smart-visibility-hidden")):e.classList.remove("smart-visibility-hidden"),a.condition=t}}_interactionHandler(e){const t=this;if(t.disabled||t.readonly)return;if("keydown"===e.type){if("Enter"!==e.key)return;e.preventDefault()}const a=t.shadowRoot||t.isInShadowDOM?e.composedPath()[0]:e.target,l=a.closest(".smart-grid-panel-item");if(l){if(a===l.firstElementChild){const e=t._items.indexOf(l);let a;t._items.splice(e,1),l.remove(),t._items.length>0&&e<2&&(0===e&&(t._items[0].children[1].remove(),a=document.createElement("div"),a.innerHTML=t.localize("where"),t._items[0].insertBefore(a,t._items[0].children[1])),t._items.length>1&&(t._items[1].children[1].remove(),a=document.createElement("smart-input"),a.className="underlined",a.dataSource=[{value:"and",label:t.localize("and")},{value:"or",label:t.localize("or")}],a.dropDownButtonPosition=t.rightToLeft?"left":"right",a.readonly=!0,a.value=t.localize(t.operator),a.animation=t.animation,a.theme=t.theme,a.rightToLeft=t.rightToLeft,a.unfocusable=t.disabled||t.unfocusable,t._items[1].insertBefore(a,t._items[1].children[1])))}}else if(a===t.$.addFilterButton&&t.dataSource.length>0)t.$.itemsContainer.appendChild(t._createItem(t.dataSource[0],"","",t._items.length));else if(a!==t.$.buttonsContainer.firstElementChild){if(a===t.$.buttonsContainer.children[1]){let e=t._stringConditions.concat(t._dateConditions),a=t.operator,l=[],n={},i=[];t._customConditions&&(e=e.concat(t._customConditions)),t._items.forEach((i=>{const o=t.dataSource.find((e=>e.label===i.children[2].value)),r=[];let s=i.children[3].value;if(""===s)return;let d=o.dataType;if(s=e.find((e=>e.label===s)).value,r.push(o.dataField,s),-1===s.indexOf("NULL")&&-1===s.indexOf("EMPTY"))if("boolean"===d)r.push(i.children[4].checked);else if("date"===d)r.push(i.children[4].value.toDate());else if("enum"===d||o.options){let e=i.children[4].$.input.dataValue;if(void 0===e){const t=o.options.find((e=>e.label===i.children[4].value));if(!t)return;e=t.value}d="string",r.push(e)}else r.push(i.children[4].value);let c=n[r[0]];void 0===c&&(c=new Smart.Utilities.FilterGroup,n[r[0]]=c);const p=c.createFilter(d,r[2],r[1]);c.addFilter(a,p),l.push(r)}));for(let e in n)i.push([e,n[e]]);t.value=l,t.$.fireEvent("apply",{filters:i,operator:a,value:l})}}else t.$.fireEvent("cancel")}_applyValue(){const e=this,t=document.createDocumentFragment();let a=0;for(e._items=[];e.$.itemsContainer.firstElementChild;)e.$.itemsContainer.firstElementChild.remove();0!==e.dataSource.length&&(e.value.forEach((l=>{if(!Array.isArray(l))return;const n=l[0],i=e.dataSource.find((e=>e.dataField===n));if(!i)return;const o=e._createItem(i,l[1],l[2],a);t.appendChild(o),a++})),e.$.itemsContainer.appendChild(t))}_createItem(e,t,a,l){const n=this,i=n.disabled||n.unfocusable?-1:0,o=document.createElement("div"),r=document.createDocumentFragment(),s=document.createElement("div"),d=document.createElement("smart-input"),c=document.createElement("smart-input");let p,u;if(s.className="smart-grid-panel-item-close-button",s.tabIndex=i,s.setAttribute("role","button"),s.setAttribute("aria-label","button"),r.appendChild(s),0===l?(p=document.createElement("div"),p.innerHTML=n.localize("where"),p.setAttribute("role","presentation")):1===l?(p=document.createElement("smart-input"),p.className="underlined",p.dataSource=[{value:"and",label:n.localize("and")},{value:"or",label:n.localize("or")}],p.dropDownButtonPosition=n.rightToLeft?"left":"right",p.readonly=!0,p.value=n.localize(n.operator),p.animation=n.animation,p.theme=n.theme,p.rightToLeft=n.rightToLeft,p.unfocusable=n.disabled||n.unfocusable,p.setAttribute("aria-label","Operator")):(p=document.createElement("div"),p.innerHTML=n.localize(n.operator),p.setAttribute("role","presentation")),r.appendChild(p),d.className="underlined",d.dataSource=n.dataSource.map((e=>({value:e.dataField,label:e.label,icon:e.icon}))),d.dropDownButtonPosition=n.rightToLeft?"left":"right",d.readonly=!0,d.value=e.label,d.animation=n.animation,d.theme=n.theme,d.rightToLeft=n.rightToLeft,d.unfocusable=n.disabled||n.unfocusable,d.setAttribute("aria-label","Field"),d.dataSource&&d.dataSource.length<10?d.dropDownHeight="auto":d.dropDownHeight=250,r.appendChild(d),"boolean"===e.dataType)c.dataSource=JSON.parse(JSON.stringify(n._booleanConditions)),u=document.createElement("smart-check-box"),u.checked="boolean"==typeof a&&a;else if("date"===e.dataType)c.dataSource=n._dateConditions,u=document.createElement("smart-date-time-picker"),u.dropDownDisplayMode="auto",u.calendarButton=!0,u.dropDownAppendTo="body",u.formatString="M/d/yy H:mm",u.value=a;else if("number"===e.dataType)c.dataSource=JSON.parse(JSON.stringify(n._numberAndDateConditions)),u=document.createElement("smart-numeric-text-box"),u.value="number"==typeof a||"string"==typeof a?a:0;else if("enum"===e.dataType||e.options){c.dataSource=JSON.parse(JSON.stringify(n._enumConditions)),u=document.createElement("smart-input");let t=[];e.options&&(t=e.options.map((e=>{const t=e.color||"var(--smart-primary)";return e.prefix='<span style="background: '+t+'; width: 14px; height: 14px; display: inline-block; border-radius: 50%; margin-left:-4px; margin-right: 8px; top: 2px; position: relative;"></span>',""===e.label&&(e.label=" "),e}))),u.dataSource=t.length?t:e.options,u.readonly=!0,u.dropDownButtonPosition="right";const l=a?e.options.find((e=>e.value===a)):null;u.value=l&&a?l.label:""}else c.dataSource=JSON.parse(JSON.stringify(n._stringConditions)),u=document.createElement("smart-input"),u.value=null!=a?a.toString():"",t||(t="CONTAINS");return c.className="underlined",c.dropDownButtonPosition=n.rightToLeft?"left":"right",c.readonly=!0,c.animation=n.animation,c.theme=n.theme,c.rightToLeft=n.rightToLeft,c.unfocusable=n.disabled||n.unfocusable,c.setAttribute("aria-label","Condition"),c.classList.add("smart-filter-panel-list"),c.dataSource.forEach((e=>{delete e.selected})),c.dataSource.find((e=>e.value===t))?(c.value=n.localize(t),c.selectedValue=t,c.condition=t):(u.value="",u.checked=!1),(void 0===t||-1===t.indexOf("NULL")&&-1===t.indexOf("EMPTY"))&&-1===t.indexOf("THIS_WEEK")&&-1===t.indexOf("LAST_WEEK")&&-1===t.indexOf("NEXT_WEEK")&&-1===t.indexOf("THIS_MONTH")&&-1===t.indexOf("LAST_MONTH")&&-1===t.indexOf("NEXT_MONTH")&&-1===t.indexOf("THIS_YEAR")&&-1===t.indexOf("LAST_YEAR")&&-1===t.indexOf("NEXT_YEAR")&&-1===t.indexOf("TODAY")&&-1===t.indexOf("TOMORROW")&&-1===t.indexOf("YESTERDAY")||(u.value="",u.checked=!1,u.classList.add("smart-visibility-hidden")),c.dataSource&&c.dataSource.length<10?c.dropDownHeight="auto":c.dropDownHeight=250,u.animation=n.animation,u.classList.add("editor"),u.rightToLeft=n.rightToLeft,u.theme=n.theme,u.unfocusable=n.disabled||n.unfocusable,u.classList.add("underlined"),"boolean"!==e.dataType&&(u.placeholder=n.editorPlaceholder),n.editorCallback&&n.editorCallback(u,e),r.appendChild(c),r.appendChild(u),o.appendChild(r),o.className="smart-grid-panel-item",n._items.push(o),o.dataType=e.dataType,o}_localize(e){const t=this;t.$.addFilterButton.innerHTML=t.localize("addFilter"),t.$.buttonsContainer.firstElementChild.innerHTML=t.localize("cancel"),t.$.buttonsContainer.children[1].innerHTML=t.localize("apply"),t.$.itemsContainer.setAttribute("no-filters",t.localize("noFilters")),t._stringConditions=[{prefix:'<span class="smart-icon smart-icon-empty"></span>',value:"EMPTY",label:t.localize("EMPTY")},{prefix:'<span class="smart-icon smart-icon-not-empty"></span>',value:"NOT_EMPTY",label:t.localize("NOT_EMPTY")},{prefix:'<span class="smart-icon smart-icon-contains"></span>',value:"CONTAINS",label:t.localize("CONTAINS")},{prefix:'<span class="smart-icon smart-icon-does-not-contain"></span>',value:"DOES_NOT_CONTAIN",label:t.localize("DOES_NOT_CONTAIN")},{prefix:'<span class="smart-icon smart-icon-starts-with"></span>',value:"STARTS_WITH",label:t.localize("STARTS_WITH")},{prefix:'<span class="smart-icon smart-icon-ends-with"></span>',value:"ENDS_WITH",label:t.localize("ENDS_WITH")},{prefix:'<span class="smart-icon smart-icon-equal"></span>',value:"EQUAL",label:t.localize("EQUAL")},{prefix:'<span class="smart-icon smart-icon-not-equal"></span>',value:"NOT_EQUAL",label:t.localize("NOT_EQUAL")},{prefix:'<span class="smart-icon smart-icon-null"></span>',value:"NULL",label:t.localize("NULL")},{prefix:'<span class="smart-icon smart-icon-not-null"></span>',value:"NOT_NULL",label:t.localize("NOT_NULL")}],t._enumConditions=[{prefix:'<span class="smart-icon smart-icon-equal"></span>',value:"EQUAL",label:t.localize("EQUAL")},{prefix:'<span class="smart-icon smart-icon-not-equal"></span>',value:"NOT_EQUAL",label:t.localize("NOT_EQUAL")}],t._dateConditions=[{prefix:'<span class="smart-icon smart-icon-equal"></span>',value:"EQUAL",label:t.localize("EQUAL")},{prefix:'<span class="smart-icon smart-icon-not-equal"></span>',value:"NOT_EQUAL",label:t.localize("NOT_EQUAL")},{prefix:'<span class="smart-icon smart-icon-less-than"></span>',value:"LESS_THAN",label:t.localize("LESS_THAN")},{prefix:'<span class="smart-icon smart-icon-less-than-equal"></span>',value:"LESS_THAN_OR_EQUAL",label:t.localize("LESS_THAN_OR_EQUAL")},{prefix:'<span class="smart-icon smart-icon-greater-than"></span>',value:"GREATER_THAN",label:t.localize("GREATER_THAN")},{prefix:'<span class="smart-icon smart-icon-greater-than-equal"></span>',value:"GREATER_THAN_OR_EQUAL",label:t.localize("GREATER_THAN_OR_EQUAL")},{prefix:'<span class="smart-icon smart-icon-null"></span>',value:"NULL",label:t.localize("NULL")},{prefix:'<span class="smart-icon smart-icon-not-null"></span>',value:"NOT_NULL",label:t.localize("NOT_NULL")},{prefix:'<span class="smart-icon smart-icon-calendar"></span>',value:"TOMORROW",label:t.localize("TOMORROW")},{prefix:'<span class="smart-icon smart-icon-calendar"></span>',value:"TODAY",label:t.localize("TODAY")},{prefix:'<span class="smart-icon smart-icon-calendar"></span>',value:"YESTERDAY",label:t.localize("YESTERDAY")},{prefix:'<span class="smart-icon smart-icon-calendar"></span>',value:"NEXT_WEEK",label:t.localize("NEXT_WEEK")},{prefix:'<span class="smart-icon smart-icon-calendar"></span>',value:"THIS_WEEK",label:t.localize("THIS_WEEK")},{prefix:'<span class="smart-icon smart-icon-calendar"></span>',value:"LAST_WEEK",label:t.localize("LAST_WEEK")},{prefix:'<span class="smart-icon smart-icon-calendar"></span>',value:"NEXT_MONTH",label:t.localize("NEXT_MONTH")},{prefix:'<span class="smart-icon smart-icon-calendar"></span>',value:"THIS_MONTH",label:t.localize("THIS_MONTH")},{prefix:'<span class="smart-icon smart-icon-calendar"></span>',value:"LAST_MONTH",label:t.localize("LAST_MONTH")}],t._numberAndDateConditions=[{prefix:'<span class="smart-icon smart-icon-equal"></span>',value:"EQUAL",label:t.localize("EQUAL")},{prefix:'<span class="smart-icon smart-icon-not-equal"></span>',value:"NOT_EQUAL",label:t.localize("NOT_EQUAL")},{prefix:'<span class="smart-icon smart-icon-less-than"></span>',value:"LESS_THAN",label:t.localize("LESS_THAN")},{prefix:'<span class="smart-icon smart-icon-less-than-equal"></span>',value:"LESS_THAN_OR_EQUAL",label:t.localize("LESS_THAN_OR_EQUAL")},{prefix:'<span class="smart-icon smart-icon-greater-than"></span>',value:"GREATER_THAN",label:t.localize("GREATER_THAN")},{prefix:'<span class="smart-icon smart-icon-greater-than-equal"></span>',value:"GREATER_THAN_OR_EQUAL",label:t.localize("GREATER_THAN_OR_EQUAL")},{prefix:'<span class="smart-icon smart-icon-null"></span>',value:"NULL",label:t.localize("NULL")},{prefix:'<span class="smart-icon smart-icon-not-null"></span>',value:"NOT_NULL",label:t.localize("NOT_NULL")}],t._booleanConditions=[{prefix:'<span class="smart-icon smart-icon-equal"></span>',value:"EQUAL",label:t.localize("EQUAL")},{prefix:'<span class="smart-icon smart-icon-not-equal"></span>',value:"NOT_EQUAL",label:t.localize("NOT_EQUAL")},{prefix:'<span class="smart-icon smart-icon-null"></span>',value:"NULL",label:t.localize("NULL")},{prefix:'<span class="smart-icon smart-icon-not-null"></span>',value:"NOT_NULL",label:t.localize("NOT_NULL")}],e&&t._items.forEach(((e,a)=>{const l=e.children[1],n=e.children[3];0===a?l.innerHTML=t.localize("where"):1===a?(l.dataSource=[{value:"and",label:t.localize("and")},{value:"or",label:t.localize("or")}],l.value=t.localize(t.operator)):l.innerHTML=t.localize(t.operator),"string"!==e.dataType||e.options?"enum"===e.dataType||e.options?n.dataSource=t._enumConditions:"boolean"===e.dataType?n.dataSource=t._booleanConditions:"date"===e.dataType?n.dataSource=t._dateConditions:n.dataSource=t._numberAndDateConditions:n.dataSource=t._stringConditions,n.value=n.condition?t.localize(n.condition):""}))}_setFocusable(e){const t=this,a=t.disabled||t.unfocusable?-1:0;if(t.$.addFilterButton.tabIndex=a,t.$.buttonsContainer.firstElementChild.tabIndex=a,t.$.buttonsContainer.children[1].tabIndex=a,e){const e=Array.from(t.$.itemsContainer.getElementsByClassName("smart-grid-panel-item-close-button")),l=Array.from(t.$.itemsContainer.querySelectorAll("smart-date-time-picker, smart-numeric-text-box, smart-check-box, smart-input"));e.forEach((e=>e.tabIndex=a)),l.forEach((e=>e.unfocusable=t.disabled||t.unfocusable))}}}),Smart("smart-column-panel",class extends Smart.BaseElement{static get properties(){return{dataSource:{value:[],type:"array",reflectToAttribute:!1},messages:{value:{en:{apply:"Ok",cancel:"Cancel",find:"Find a field",reset:"Reset",noResults:"No results"}},type:"object",extend:!0}}}static get listeners(){return{click:"_interactionHandler",keydown:"_interactionHandler","find.keyup":"_findKeyupHandler","sortable.dragEnd":"_sortableDragEndHandler"}}static get requires(){return{"Smart.Sortable":"smart.sortable.js"}}static get styleUrls(){return["smart.gridpanel.css"]}template(){return'<div id="container" role="presentation">\n <div class="smart-column-panel-find-container" role="search">\n <input id="find" readonly="[[readonly]]" role="searchbox" aria-label="Find a field"></input>\n <span id="clearButton" class="clear-button smart-hidden" role="button" aria-label="Clear"></span>\n </div>\n <smart-sortable id="sortable" disable-mode="manual" right-to-left="[[rightToLeft]]" animation="[[animation]]" disabled="[[readonly]]" drag-mode="handle" handle-position="right" handle-visibility="visible" theme="[[theme]]"></smart-sortable>\n <div id="footer" class="smart-grid-panel-container-footer" role="presentation">\n <span id="reset" class="smart-grid-panel-reset-button" role="button"></span>\n <div id="buttonsContainer" class="smart-grid-panel-buttons-container smart-unselectable" role="presentation">\n <span class="smart-grid-panel-cancel-button" role="button"></span>\n <span class="smart-grid-panel-apply-button primary" role="button"></span>\n </div>\n </div>\n </div>'}ready(){super.ready()}render(){const e=this;e.setAttribute("role","dialog"),e._positionChanged=!1,e._localize(),e._moves=[],e._createSortItems(),super.render()}propertyChangedHandler(e,t,a){super.propertyChangedHandler(e,t,a);const l=this;switch(e){case"disabled":case"unfocusable":l._setFocusable();break;case"dataSource":{const e=l.$.sortable.$.container;for(;e.firstChild;)e.removeChild(e.firstChild);l._createSortItems(),l._positionChanged=!1,l.$.find.value="",l._findKeyupHandler(),l.$.clearButton.classList.add("smart-hidden");break}case"locale":case"messages":l._localize()}}_createSortItems(){const e=this,t=document.createDocumentFragment();e._HTMLToSourceMap=new Map,e.dataSource.forEach((a=>t.appendChild(e._createSortItem(a)))),e.$.sortable.$.container.appendChild(t),e.$.sortable.updateItems(),e._setFocusable()}_createSortItem(e){const t=document.createElement("div"),a=this.id+"Label"+e.dataField;return this._HTMLToSourceMap.set(t,e),t.className="smart-grid-panel-item",t.innerHTML=`<div class="toggle-visibility${!1!==e.visible?"":" hidden"}${e.disableToggle?" disable-toggle":""}" role="button" aria-controls="${a}" aria-label="Toggle visibility"></div>\n<span id="${a}" class="smart-column-panel-label smart-unselectable${e.icon?" icon "+e.icon:""}">${e.label}</span>`,1===e.level?t.classList.add("indent"):0===e.level&&t.classList.add("group"),e.disableDrag&&t.setAttribute("disable-drag",""),e.dataField&&t.setAttribute("data-field",e.dataField),e.parentDataField&&t.setAttribute("parent-data-field",e.parentDataField),!1!==e.allowHide&&!0!==e.disableToggle||(t.style.pointerEvents="none",t.setAttribute("disabled",""),t.style.opacity=.8),t}_interactionHandler(e){const t=this;if(t.disabled||t.readonly||"keydown"===e.type&&-1===[" ","Enter"].indexOf(e.key))return;const a=t.shadowRoot||t.isInShadowDOM?e.composedPath()[0]:e.target;if(a.classList.contains("toggle-visibility")){a.classList.toggle("hidden");const e=a.closest(".smart-grid-panel-item");if(e.hasAttribute("data-field")){const l=e.getAttribute("data-field");if(e.hasAttribute("parent-data-field")||e.hasAttribute("disabled")){const a=e.getAttribute("parent-data-field"),l=t.$.sortable.querySelectorAll(".smart-grid-panel-item");let n=null;if(l.forEach((e=>{e.getAttribute("data-field")===a&&(n=e)})),n){let e=0,t=0;l.forEach((l=>{l.getAttribute("parent-data-field")===a&&(e++,l.firstElementChild.classList.contains("hidden")&&t++)})),t===e?n.firstElementChild.classList.add("hidden"):t<e&&n.firstElementChild.classList.remove("hidden")}}else t.$.sortable._items.forEach((e=>{if(e.hasAttribute("parent-data-field")&&!e.hasAttribute("disabled")){const t=e.getAttribute("parent-data-field"),n=e.firstElementChild;t===l&&(a.classList.contains("hidden")?n.classList.add("hidden"):n.classList.remove("hidden"))}}))}}else if(a.parentElement===t.$.buttonsContainer){if(a===t.$.buttonsContainer.firstElementChild)return t.$.fireEvent("cancel"),void(t._moves=[]);if(a===t.$.buttonsContainer.children[1]){const e=[];Array.from(t.$.sortable.$.container.children).forEach((a=>{const l=Object.assign({},t._HTMLToSourceMap.get(a));l.visible=!a.firstElementChild.classList.contains("hidden"),e.push(l)})),t.$.fireEvent("apply",{value:e,positionChanged:t._positionChanged,moves:t._moves}),t._positionChanged=!1,t._moves=[]}}else if(a===t.$.reset){const e=[];Array.from(t.$.sortable.$.container.children).forEach((a=>{const l=Object.assign({},t._HTMLToSourceMap.get(a));l.visible=!0,e.push(l)})),t.$.fireEvent("apply",{value:e,positionChanged:t._positionChanged,moves:t._moves}),t._positionChanged=!1,t._moves=[]}else a.classList.contains("clear-button")&&(t.$.find.value="",t._findKeyupHandler())}_findKeyupHandler(){const e=this;if(e.disabled||e.readonly)return;const t=e.$.find,a=t.value,l=[...e.$.sortable.$.container.children];if(void 0===e._disabledSortable&&(e._disabledSortable=e.$.sortable.disabled),""===a)return t.parentElement.classList.remove("no-results"),e.$.clearButton.classList.add("smart-hidden"),l.forEach((e=>e.classList.remove("smart-hidden"))),e.$.sortable.disabled=e._disabledSortable||e.readonly,void delete e._disabledSortable;let n=!0;e.$.clearButton.classList.remove("smart-hidden"),l.forEach((t=>{-1===e._HTMLToSourceMap.get(t).label.toLowerCase().indexOf(a.toLowerCase())?t.classList.add("smart-hidden"):(t.classList.remove("smart-hidden"),n=!1)})),e.$.sortable.disabled=n,n?t.parentElement.classList.add("no-results"):t.parentElement.classList.remove("no-results")}_sortableDragEndHandler(e){const t=e.detail;this._positionChanged=!0,this._moves.push({oldIndex:t.oldIndex,newIndex:t.newIndex})}_localize(){const e=this;e.$.find.placeholder=e.localize("find"),e.$.reset.innerHTML=e.localize("reset"),e.$.buttonsContainer.firstElementChild.innerHTML=e.localize("cancel"),e.$.buttonsContainer.children[1].innerHTML=e.localize("apply"),e.$.container.firstElementChild.setAttribute("no-results",e.localize("noResults"))}_setFocusable(){const e=this,t=e.disabled||e.unfocusable?-1:0,a=Array.from(e.$.sortable.getElementsByClassName("toggle-visibility"));e.$.find.tabIndex=t,e.$.clearButton.tabIndex=t,e.$.buttonsContainer.firstElementChild.tabIndex=t,e.$.buttonsContainer.children[1].tabIndex=t,a.forEach((e=>e.tabIndex=e.classList.contains("disable-toggle")?-1:t))}}),Smart("smart-formatting-panel",class extends Smart.BaseElement{static get properties(){return{columns:{value:[],type:"array",reflectToAttribute:!1},dataSource:{value:[],type:"any",reflectToAttribute:!1},items:{value:null,type:"array?",reflectToAttribute:!1},dropDownAppendTo:{value:null,type:"any",reflectToAttribute:!1},messages:{value:{en:{add:"Add condition",all:"All columns",apply:"Ok",between:"Between",cancel:"Cancel",close:"Close",column:"Column:",condition:"Condition:",equal:"Equal To",fontFamily:"Font family:",fontSize:"Font size:",format:"Format:",greaterThan:"Greater Than",highlight:"Highlight",lessThan:"Less Than",notEqual:"Not Equal To",remove:"Remove condition",secondValue:"Second value:",text:"Text",value:"Value:"}},type:"object",extend:!0}}}static get listeners(){return{click:"_interactionHandler",keydown:"_interactionHandler",change:"_changeHandler","popup.change":"_changeHandler","popup.click":"_interactionHandler","popup.keydown":"_interactionHandler","document.down":"_documentDownHandler"}}template(){return'<div id="container" role="presentation">\n <div id="itemsContainer" class="smart-formatting-panel-items-container" role="presentation"></div>\n <div id="addNewButton" class="smart-add-new-button" role="button" aria-label="Add new condition"></div>\n <div id="popup" class="smart-formatting-panel-popup smart-hidden smart-visibility-hidden" role="dialog">\n <div id="popupHeader" class="header" role="presentation">\n <div id="text" class="selected" role="button" aria-label="Text color"></div>\n <div id="highlight" role="button" aria-label="Highlight color"></div>\n </div>\n <div id="colorCode" class="color-code"></div>\n <input id="colorInput" type="color" />\n <div id="colorsContainer" class="colors-container"></div>\n <smart-button id="apply" class="ok primary" animation="[[animation]]" right-to-left="[[rightToLeft]]" theme="[[theme]]" unfocusable="[[unfocusable]]"></smart-button>\n <smart-button id="cancel" class="cancel" animation="[[animation]]" right-to-left="[[rightToLeft]]" theme="[[theme]]" unfocusable="[[unfocusable]]"></smart-button>\n </div>\n </div>'}render(){const e=this,t=getComputedStyle(e);e.setAttribute("role","dialog"),e.$.popup.id=e.id+"Popup",e._basicColors=[[0,0,0],[68,68,68],[102,102,102],[153,153,153],[204,204,204],[238,238,238],[243,243,243],[255,255,255],[255,0,0],[255,153,0],[255,255,0],[0,255,0],[0,255,255],[0,0,255],[153,0,255],[255,0,255],[244,204,204],[252,229,205],[255,242,204],[217,234,211],[208,224,227],[207,226,243],[217,210,233],[234,209,220],[234,153,153],[249,203,156],[255,229,153],[182,215,168],[162,196,201],[159,197,232],[180,167,214],[213,166,189],[224,102,102],[246,178,107],[255,217,102],[147,196,125],[118,165,175],[111,168,220],[142,124,195],[194,123,160],[204,0,0],[230,145,56],[241,194,50],[106,168,79],[69,129,142],[61,133,198],[103,78,167],[166,77,121],[153,0,0],[180,95,6],[191,144,0],[56,118,29],[19,79,92],[11,83,148],[53,28,117],[116,27,71],[102,0,0],[120,63,4],[127,96,0],[39,78,19],[12,52,61],[7,55,99],[32,18,77],[76,17,48]],e._defaults={fontFamily:t.fontFamily,fontSize:t.fontSize,text:e._toHex(t.color),highlight:e._toHex(t.backgroundColor)},t.fontFamily.indexOf("-apple")>=0&&(e._defaults.fontFamily="Segoe UI"),e._localize(),e._setFocusable(),e._populatePopupWithColors(),e._processColumnsAndDataSource(),e._addDefaultItems(),super.render()}attached(){const e=this;super.attached(),e.isCompleted&&e._addDefaultItemsOnAttach&&e._addDefaultItems()}add(e,t){const a=this;if(e&&e.column&&"all"!==e.column&&!a.columns.find((t=>t.dataField===e.column)))return void a.items.splice(t,1);const l=document.createElement("div"),n=a._defaults,i=` animation="${a.animation}"${a.rightToLeft?" right-to-left":""} theme="${a.theme}"${a.unfocusable?" unfocusable":""}`,o=a.disabled||a.unfocusable?"":' tabindex="0"';e=Object.assign({column:"all",condition:"lessThan",firstValue:0,secondValue:1,fontFamily:n.fontFamily,fontSize:n.fontSize,text:n.text,highlight:n.highlight},e);const r=`\n<div class="value-label">${a.localize("value")}</div>\n<smart-input class="columns-input underlined" data-source='${JSON.stringify(a._columnsInputDataSource)}' placeholder="${a.localize("column")}" readonly value="${a._columnsInputDataSource.find((t=>t.value===e.column)).label}"${i}></smart-input>\n<smart-input class="condition-input underlined" data-source='${a._conditionsDataSource}' placeholder="${a.localize("condition")}" readonly value="${a.localize(e.condition)}"${i}></smart-input>\n<smart-input class="first-value underlined" type="number" placeholder="${a.localize("value")}" value="${e.firstValue}"${i}></smart-input>\n<div class="ampersand">&</div>\n<smart-input class="second-value underlined" type="number" placeholder="${a.localize("secondValue")}" value="${e.secondValue}"${i}></smart-input>\n<div class="close-button" title="${a.localize("close")}"${o} role="button" aria-label="Close"></div>\n<div class="format-label">${a.localize("format")}</div>\n<smart-input class="font-family-input underlined" drop-down-height="auto" placeholder="${a.localize("fontFamily")}" readonly${i}></smart-input>\n<smart-input class="font-size-input underlined" data-source='["8px", "9px", "10px", "11px", "12px", "13px", "14px", "15px", "16px"]' drop-down-height="auto" placeholder="${a.localize("fontSize")}" readonly value="${e.fontSize}"${i}></smart-input>\n<div class="popup-button smart-unselectable"${o} role="button" aria-haspopup="dialog" aria-label="Toggle pop-up">A</div>\n<div class="preview smart-unselectable">2.71828</div>`;l.classList.add("smart-formatting-panel-item"),l.classList.toggle("between","between"===e.condition),l.innerHTML=r,l.columnsInput=l.querySelector(".columns-input"),l.conditionInput=l.querySelector(".condition-input"),l.firstValue=l.querySelector(".first-value"),l.secondValue=l.querySelector(".second-value"),l.closeButton=l.querySelector(".close-button"),l.fontFamilyInput=l.querySelector(".font-family-input"),l.fontFamilyInput.dataSource=[n.fontFamily,"Arial","Verdana","Courier New","Georgia","Times New Roman"],l.fontFamilyInput.value=e.fontFamily,l.fontSizeInput=l.querySelector(".font-size-input"),l.popupButton=l.querySelector(".popup-button"),l.fontFamilyInput=l.querySelector(".font-family-input"),l.preview=l.querySelector(".preview"),l.popupButton.style.color=e.text,l.popupButton.style.backgroundColor=e.highlight,l.preview.style.fontFamily=e.fontFamily,l.preview.style.fontSize=e.fontSize,l.preview.style.color=e.text,l.preview.style.backgroundColor=e.highlight,l.data=e,a.$.itemsContainer.appendChild(l),l.columnsInput.$.input.value||(l.columnsInput.$.input.dataValue="all"),l.conditionInput.$.input.dataValue=e.condition,a._checkScrollBar()}apply(){const e=this,t=new Smart.Utilities.ConditionalFormatter(e.dataSource),a=Array.from(e.$.itemsContainer.children),l=[];let n;if(0===a.length)return;if(e.ownerElement&&"smart-pivot-table"===e.ownerElement.nodeName.toLowerCase()){const t=e.ownerElement._dynamicColumns;n=function(e){return"all"===e?t.map((e=>e.id)):t.filter((t=>t.dataFields[t.dataFields.length-1].dataField===e)).map((e=>e.id))}}else n=function(t){return"all"===t?e._columns.map((e=>e.value)):[t]};for(let e=0;e<a.length;e++){const i=a[e].data,o=n(i.column),r=i.condition;t.color=i.highlight,t.comparator=i.firstValue,t.min=i.firstValue,t.max=i.secondValue;const s=t.format(r,o);for(let e in s){const t=s[e];for(let e in t){const a=t[e];a.color=i.text,a.fontFamily=i.fontFamily,a.fontSize=i.fontSize}}l.push(s)}if(0===l.length)return l[0];const i={};for(let e=0;e<l.length;e++){const t=l[e];for(let e in t){const a=t[e];i[e]||(i[e]={});for(let t in a)i[e][t]=Object.assign({},i[e][t],a[t])}}return i}getItems(){return Array.from(this.$.itemsContainer.children).map((e=>e.data))}propertyChangedHandler(e,t,a){super.propertyChangedHandler(e,t,a);const l=this;switch(e){case"animation":case"theme":case"rightToLeft":if(Array.from(l.$.itemsContainer.querySelectorAll(".smart-element")).forEach((t=>t[e]=a)),null!==l.dropDownAppendTo&&(l.$.apply[e]=a,l.$.cancel[e]=a),"theme"===e){const e=getComputedStyle(l);l._defaults.text=l._toHex(e.color),l._defaults.highlight=l._toHex(e.backgroundColor)}break;case"columns":case"items":"columns"===e&&(l._processColumnsAndDataSource(),l.items=null),l.$.itemsContainer.innerHTML="",l._addDefaultItems();break;case"disabled":case"unfocusable":{const t=l.disabled||l.unfocusable,n=Array.from(l.$.itemsContainer.querySelectorAll(".close-button, .popup-button"));"disabled"===e?l._closePopup():null!==l.dropDownAppendTo&&(l.$.apply.unfocusable=a,l.$.cancel.unfocusable=a),l._setFocusable(),Array.from(l.$.itemsContainer.querySelectorAll(".smart-element")).forEach((e=>e.unfocusable=t)),t?n.forEach((e=>e.removeAttribute("tabindex"))):n.forEach((e=>e.setAttribute("tabindex",0)));break}case"dataSource":Smart.DataAdapter&&a instanceof Smart.DataAdapter&&(l.dataSource=a.toArray());break;case"locale":case"messages":l.items=l.getItems(),l.$.itemsContainer.innerHTML="",l._localize(),l._columnsInputDataSource=JSON.parse(JSON.stringify(l._columns.concat([{label:l.localize("all"),value:"all"}]))),l._addDefaultItems()}}_populatePopupWithColors(){const e=this,t=e._basicColors,a=document.createDocumentFragment();for(let l=0;l<t.length;l++){const n=document.createElement("div"),i=t[l],o=`rgb(${i[0]}, ${i[1]}, ${i[2]})`,r=e._toHex(o);n.setAttribute("role","button"),n.setAttribute("aria-label","Select color "+r),n.index=l,n.value=r,n.style.backgroundColor=o,a.appendChild(n)}e.$.colorsContainer.appendChild(a)}_processColumnsAndDataSource(){const e=this,t=e.columns,a=e.dataSource,l=[];Smart.DataAdapter&&a instanceof Smart.DataAdapter&&(e.dataSource=a.toArray());for(let e=0;e<t.length;e++){const a=t[e];"number"===a.dataType&&l.push({label:a.label,value:a.dataField})}e._columns=l,e._columnsInputDataSource=JSON.parse(JSON.stringify(l.concat([{label:e.localize("all"),value:"all"}])))}_addDefaultItems(){const e=this,t=e.items,a=e.getRootNode();a===document||document.body.contains(a)?(t&&t.length>0?t.forEach(((t,a)=>e.add(t,a))):(e.add({condition:"greaterThan",firstValue:100}),e.add({condition:"lessThan",firstValue:0})),delete e._addDefaultItemsOnAttach):e._addDefaultItemsOnAttach=!0}_changeHandler(e){const t=this,a=t.isInShadowDOM?e.composedPath()[0]:e.target,l=a.closest(".smart-formatting-panel-item");if(l)if(a!==l.columnsInput){if(a===l.conditionInput)return l.data.condition=a.$.input.dataValue,void l.classList.toggle("between","between"===a.$.input.dataValue);if(l.firstValue.contains(a))l.data.firstValue=parseFloat(a.value);else{if(!l.secondValue.contains(a))return a===l.fontFamilyInput?(l.data.fontFamily=a.value,void(l.preview.style.fontFamily=a.value)):void(a===l.fontSizeInput&&(l.data.fontSize=a.value,l.preview.style.fontSize=a.value));l.data.secondValue=parseFloat(a.value)}}else l.data.column=a.$.input.dataValue;else t.$.popup.contains(a)&&t._updateUI(a.value.toUpperCase())}_checkScrollBar(){this.classList.toggle("scroll",this.$.itemsContainer.offsetHeight<this.$.itemsContainer.scrollHeight)}_interactionHandler(e){const t=this;if(!t.dropDownAppendTo&&e.currentTarget===t.$.popup)return;if("keydown"===e.type){if(-1===[" ","Enter"].indexOf(e.key))return void(t.disabled||t.readonly||t._keydownHandler(e));e.preventDefault()}const a=t.isInShadowDOM?e.composedPath()[0]:e.target;if(a===t.$.addNewButton)return void t.add();const l=a.closest(".smart-formatting-panel-item");if(l)return void(a===l.closeButton?(l.remove(),this._checkScrollBar()):a===l.popupButton&&(t._togglePopup(l),t._activePopupButton=a));const n=t.$.popup;if(n.contains(a)){if(a.parentElement===t.$.colorsContainer)return void t._updateUI(a.value);if(a.parentElement===t.$.popupHeader)a.classList.add("selected"),a===t.$.text?(n.selection="currentText",t.$.highlight.classList.remove("selected")):(n.selection="currentHighlight",t.$.text.classList.remove("selected")),t._updateUI(n[n.selection]);else if(a.classList.contains("smart-button")){if(t.$.apply.contains(a)||a&&a.ownerElement&&a.ownerElement.classList.contains("ok")){const e=n.item;e.data.text=n.currentText,e.data.highlight=n.currentHighlight,e.popupButton.style.color=n.currentText,e.popupButton.style.backgroundColor=n.currentHighlight,e.preview.style.color=n.currentText,e.preview.style.backgroundColor=n.currentHighlight}t._closePopup()}}}_keydownHandler(e){const t=this,a=e.key;if(-1===["ArrowDown","ArrowLeft","ArrowRight","ArrowUp","End","Escape","Home","PageDown","PageUp"].indexOf(a))return;if(e.preventDefault(),"Escape"===a&&!t.$.popup.classList.contains("smart-hidden"))return void t._closePopup();if(t.getRootNode().activeElement!==t.$.colorsContainer)return;const l=Array.from(this.$.colorsContainer.children),n=this.$.colorsContainer.querySelector(".selected");let i,o="ArrowRight",r="ArrowLeft";if(t.rightToLeft&&(o="ArrowLeft",r="ArrowRight"),n){let e=n.index;switch(a){case r:e=Math.max(e-1,e-e%8);break;case o:e=Math.min(e+1,e+8-e%8-1);break;case"ArrowUp":e=Math.max(e-8,e%8);break;case"ArrowDown":e=Math.min(e+8,56+e%8);break;case"Home":e-=e%8;break;case"End":e=e+8-e%8-1;break;case"PageUp":e%=8;break;case"PageDown":e=56+e%8}i=l[e]}else i=l[0];t._updateUI(i.value,i)}_togglePopup(e){const t=this,a=t.$.popup;if(e===a.item)return void t._closePopup();if(a.setAttribute("animation",t.animation),a.setAttribute("theme",t.theme),t.rightToLeft&&a.setAttribute("right-to-left",""),a.classList.contains("smart-hidden")&&a.classList.remove("smart-hidden"),t.dropDownAppendTo)if("body"===t.dropDownAppendTo)document.body.appendChild(a);else{const e=document.querySelector(t.dropDownAppendTo);e&&e.appendChild(a)}const l=e.popupButton,n=l.getBoundingClientRect(),i=l.offsetLeft,o=l.offsetTop,r=a.offsetWidth,s=a.offsetHeight,d=t.$.itemsContainer.scrollTop,c=t._toHex(e.data.text),p=t._toHex(e.data.highlight);n.top>=s+5?a.style.top=o-(s+d+5)+"px":a.style.top=o+n.height-d+5+"px",a.style.left=i+n.width/2-r/2+"px",t.dropDownAppendTo&&(a.style.top=n.bottom+5+"px",a.style.left=n.left+n.width/2-r/2+"px"),t.$.text.classList.add("selected"),t.$.highlight.classList.remove("selected"),t.$.text.focus(),a.item=e,a.selection="currentText",a.currentText=c,a.currentHighlight=p,t._updateUI(c),a.controlledBy&&(a.controlledBy.removeAttribute("aria-controls"),a.controlledBy.removeAttribute("aria-expanded")),l.setAttribute("aria-controls",a.id),l.setAttribute("aria-expanded",!0),a.controlledBy=l,a.classList.remove("smart-visibility-hidden")}_closePopup(){const e=this,t=e.$.popup;"none"!==e.animation?(t.addEventListener("transitionend",(function e(){t.classList.add("smart-hidden"),t.removeEventListener("transitionend",e)})),t.classList.add("smart-visibility-hidden")):(t.classList.add("smart-visibility-hidden"),t.classList.add("smart-hidden")),delete t.item,e._activePopupButton&&e._activePopupButton.focus(),t.controlledBy&&(t.controlledBy.removeAttribute("aria-controls"),t.controlledBy.removeAttribute("aria-expanded"))}_toHex(e){if(-1!==e.indexOf("#"))return e;const t=/rgb\((\d+), (\d+), (\d+)\)/g.exec(e);return t?"#"+(parseFloat(t[1]).toString(16).padStart(2,"0")+parseFloat(t[2]).toString(16).padStart(2,"0")+parseFloat(t[3]).toString(16).padStart(2,"0")).toUpperCase():"#FFFFFF"}_updateUI(e,t){const a=this;a.$.colorInput.value=e,a.$.colorCode.innerHTML=e,a._selectColor(e,t)}_selectColor(e,t){const a=this.$.popup,l=Array.from(this.$.colorsContainer.children);l.forEach((e=>e.classList.remove("selected"))),(t=t||l.find((t=>t.value===e)))&&t.classList.add("selected"),a[a.selection]=e}_localize(){const e=this;e._conditionsDataSource=JSON.stringify([{label:e.localize("lessThan"),value:"lessThan"},{label:e.localize("greaterThan"),value:"greaterThan"},{label:e.localize("equal"),value:"equal"},{label:e.localize("notEqual"),value:"notEqual"},{label:e.localize("between"),value:"between"}]),e.$.text.innerHTML=e.localize("text"),e.$.highlight.innerHTML=e.localize("highlight"),e.$.apply.innerHTML=e.localize("apply"),e.$.cancel.innerHTML=e.localize("cancel"),e.$.addNewButton.title=e.localize("add")}_setFocusable(){const e=this,t=!e.disabled&&!e.unfocusable,a=[e.$.addNewButton,e.$.text,e.$.highlight,e.$.colorsContainer];t?(a.forEach((e=>e.setAttribute("tabindex",0))),e.$.colorInput.removeAttribute("tabindex")):(a.forEach((e=>e.removeAttribute("tabindex"))),e.$.colorInput.setAttribute("tabindex",-1))}_documentDownHandler(e){const t=this,a=t.isInShadowDOM?e.originalEvent.composedPath()[0]:e.originalEvent.target,l=t.$.popup;l.classList.contains("smart-hidden")||l.contains(a)||a.classList.contains("popup-button")||(delete t._activePopupButton,t._closePopup())}}),Smart("smart-data-view",class extends Smart.BaseElement{static get properties(){return{addNewButton:{value:!1,type:"boolean"},allowDrag:{value:!1,type:"boolean"},collapsible:{value:!1,type:"boolean"},columns:{value:[],type:"object",reflectToAttribute:!1},dataSource:{value:null,type:"object?",reflectToAttribute:!1},dataSourceSettings:{value:{autoGenerateColumns:{value:!1,type:"boolean"},sanitizeHTML:{value:"blackList",allowedValues:["all","blackList","none"],type:"string"},root:{value:"",type:"string"},record:{value:"",type:"string"},keyDataField:{value:"",type:"string"},parentDataField:{value:"",type:"string"},childrenDataField:{value:"",type:"string"},groupBy:{value:[],type:"array"},dataFields:{value:[],type:"array"},mapChar:{value:".",type:"string"},id:{value:"",type:"string"},virtualDataSource:{value:null,type:"any"},virtualDataSourceOnExpand:{value:null,type:"any"}},type:"object"},editable:{value:!1,type:"boolean"},headerPosition:{value:"none",allowedValues:["none","top","bottom"],type:"string"},messages:{value:{en:{addFilter:"+ Add filter",and:"And",apply:"Ok",booleanFirst:"☐",booleanLast:"☑",cancel:"Cancel",CONTAINS:"contains",CONTAINS_CASE_SENSITIVE:"contains (case sensitive)",dateFirst:"1",dateLast:"9",DOES_NOT_CONTAIN:"does not contain",DOES_NOT_CONTAIN_CASE_SENSITIVE:"does not contain (case sensitive)",EMPTY:"empty",ENDS_WITH:"ends with",ENDS_WITH_CASE_SENSITIVE:"ends with (case sensitive)",EQUAL:"equal",EQUAL_CASE_SENSITIVE:"equal (case sensitive)",filter:"Filter",customize:"Customize Columns",filteredByMultiple:"{{n}} filters",filteredByOne:"1 filter",filterValuePlaceholder:"Value",find:"Find a field",findInView:"Find in view",firstBy:"Sort by",found:"{{nth}} of {{n}}",from:"from",GREATER_THAN:"greater than",GREATER_THAN_OR_EQUAL:"greater than or equal",LESS_THAN:"less than",LESS_THAN_OR_EQUAL:"less than or equal",noFilters:"No filters applied",noResults:"No results",noSorting:"No sorting applied",NOT_EMPTY:"not empty",NOT_EQUAL:"not equal",NOT_NULL:"not null",NULL:"null",numberFirst:"1",numberLast:"9",ok:"OK",or:"Or",pickAnother:"Pick another field to sort by",sort:"Sort",group:"Group",fontFamily:"Font family:",fontSize:"Font size:",format:"Format:",formatColumn:"Format Column",formating:"Conditional Formating",sortedByMultiple:"Sorted by {{n}} fields",sortedByOne:"Sorted by 1 field",STARTS_WITH:"starts with",STARTS_WITH_CASE_SENSITIVE:"starts with (case sensitive)",stringFirst:"A",stringLast:"Z",thenBy:"then by",where:"Where",collapseAll:"Collapse all",expandAll:"Expand all",noGrouping:"No grouping",groupedByMultiple:"{{n}} groups",groupedByOne:"1 group",firstByGroup:"Group by",pickAnotherGroupBy:"Pick another field to group by",add:"Add condition",all:"All columns",between:"Between",close:"Close",column:"Column:",condition:"Condition:",equal:"Equal To",greaterThan:"Greater Than",highlight:"Highlight",lessThan:"Less Than",notEqual:"Not Equal To",remove:"Remove condition",secondValue:"Second value:",text:"Text",value:"Value:",reset:"Reset"}}}}}static get listeners(){return{"header.apply":"_applyHandler","header.cancel":"closePanel","headerDropDown.transitionend":"_headerDropDownTransitionendHandler","searchInput.keyup":"_searchInputKeyupHandler",resize:"_resizeHandler","document.move":"_documentMoveHandler","document.up":"_documentUpHandler"}}render(){const e=this;e.$.headerDropDown.id||(e.$.headerDropDown.id=e.id+"HeaderDropDown"),e.setAttribute("role","group"),e._isMobile=Smart.Utilities.Core.isMobile,super.render()}addFilter(e,t="and"){const a=this;if(!Array.isArray(e)||e.length>0&&!Array.isArray(e[0]))return;let l;a.closePanel(),arguments[2]?l={filters:arguments[2],operator:t}:(l={filters:[],operator:t},e.forEach((e=>{e[1].filters.forEach((t=>{l.filters.push([e[0],t.condition,t.value])}))}))),JSON.stringify(l)!==JSON.stringify(a._appliedFiltering)&&(l.filterGroups=e,a._appliedFiltering=l,a._applyFilter(e,t),a.$.fireEvent("filter"),a._refreshFilterButton())}_refreshFilterButton(){const e=this,t=e._appliedFiltering.filters?e._appliedFiltering.filters.length:0;if(0===t)return e.$.filterButton.firstElementChild.innerHTML=e.localize("filter"),void e.$.filterButton.classList.remove("filtered");e.$.filterButton.firstElementChild.innerHTML=1===t?e.localize("filteredByOne"):e.localize("filteredByMultiple",{n:t}),e.$.filterButton.classList.add("filtered")}addSort(e,t){const a=this,l=a.dataSource,n=JSON.stringify(a._appliedSorting);let i;function o(e,n){if(a.columns.find((t=>t.dataField===e))){let a=Array.isArray(t)?t[n]:"string"==typeof t?t:"ascending";i.dataFields.push(e),i.dataTypes.push(l.dataFields.find((t=>t.name===e)).dataType),a=a&&-1!==a.indexOf("desc")?"descending":"ascending",i.orderBy.push(a)}}if(0!==arguments.length&&l&&0!==l.length){if(a.closePanel(),1===arguments.length&&"object"==typeof e)i=e;else if(i={dataFields:[],dataTypes:[],orderBy:[]},Array.isArray(e))e.forEach(o);else{if("string"!=typeof e)return;o(e,0)}a.closePanel(),a._appliedSorting=i,n!==JSON.stringify(a._appliedSorting)&&(a._applySort(),a.$.fireEvent("sort"),a._refreshSortButton())}}_refreshSortButton(){const e=this,t=e._appliedSorting.dataFields.length;return 0===t||e.grid&&!1===e.grid.sorting.maintainSort?(e.$.sortButton.firstElementChild.innerHTML=e.localize("sort"),void e.$.sortButton.classList.remove("sorted")):(e.$.sortButton.firstElementChild.innerHTML=1===t?e.localize("sortedByOne"):e.localize("sortedByMultiple",{n:t}),void e.$.sortButton.classList.add("sorted"))}closePanel(){const e=this.$.headerDropDown;e.classList.remove("open"),setTimeout((()=>{e.classList.add("smart-visibility-hidden")}),150),this._closeSearchPanel(),e.controlledBy&&(e.controlledBy.removeAttribute("aria-controls"),e.controlledBy.setAttribute("aria-expanded",!1),delete e.controlledBy)}_closeSearchPanel(){const e=this;e._searchInfo&&delete e._searchInfo}_closeDialog(){const e=this;e._editInfo&&e._editInfo.window.close()}openFormatPanel(){}openFilterPanel(e,t){const a=this,l=a.dataSource;if(!l||0===l.length&&!l.virtualDataSource||a.disabled||"none"===a.headerPosition)return;let n;a._editInfo&&a._editInfo.window.close(),a.$.headerDropDown.classList.add("filter-panel"),a.$.headerDropDown.classList.remove("customize-panel","colors-panel","sort-panel","search-panel","format-panel"),a.$.filter.classList.remove("smart-hidden"),a.$.customize.classList.add("smart-hidden"),a.$.sort.classList.add("smart-hidden"),a.$.colors.classList.add("smart-hidden"),a.$.format&&a.$.format.classList.add("smart-hidden"),a.$.group&&a.$.group.classList.add("smart-hidden"),a.$.search.classList.add("smart-hidden"),a._closeSearchPanel(),a._filterPartCreated?(n=a.$.filter.firstElementChild,n.set("dataSource",e),n.set("locale",a.locale),n.messages=a._innerElementMessages.multiColumnFilterPanel,n.operator=a._appliedFiltering.operator,n.editorPlaceholder=a.localize("filterValuePlaceholder"),n.set("operator",a._appliedFiltering.operator),n.set("value",a._appliedFiltering.filters),n._applyValue(),n.rightToLeft=a.rightToLeft):(n=document.createElement("smart-multi-column-filter-panel"),n.rightToLeft=a.rightToLeft,n.animation=a.animation,n.dataSource=e,n.locale=a.locale,n.messages=a._innerElementMessages.multiColumnFilterPanel,n.operator=a._appliedFiltering.operator,n.editorPlaceholder=a.localize("filterValuePlaceholder"),n.theme=a.theme,n.value=a._appliedFiltering.filters,n.editorCallback=t,a.$.filter.appendChild(n),a._filterPartCreated=!0),a._openHeaderDropDown(a.$.filterButton)}openColorsPanel(e,t,a){const l=this,n=l.dataSource;if(!n||0===n.length&&!n.virtualDataSource||l.disabled||"none"===l.headerPosition)return;let i;l._editInfo&&l._editInfo.window.close(),l.$.headerDropDown.classList.add("colors-panel"),l.$.headerDropDown.classList.remove("filter-panel","group-panel","customize-panel","sort-panel","search-panel","format-panel"),l.$.colors.classList.remove("smart-hidden"),l.$.customize.classList.add("smart-hidden"),l.$.filter.classList.add("smart-hidden"),l.$.sort.classList.add("smart-hidden"),l.$.filter&&l.$.filter.classList.add("smart-hidden"),l.$.group&&l.$.group.classList.add("smart-hidden"),l.$.search.classList.add("smart-hidden"),l._closeSearchPanel(),l._colorsPartCreated?(i=l.$.colors.firstElementChild,i.set("dataSource",e),i.set("locale",l.locale),i.messages=l._innerElementMessages.multiColumnFilterPanel,i.operator="or",i.editorPlaceholder=l.localize("filterValuePlaceholder"),i.set("operator","or"),l._appliedColors||(l._appliedColors=[]),i.set("value",l._appliedColors),i._applyValue(),i.rightToLeft=l.rightToLeft):(i=document.createElement("smart-colors-panel"),i.rightToLeft=l.rightToLeft,i.animation=l.animation,i.dataSource=e,i.locale=l.locale,i.messages=l._innerElementMessages.multiColumnFilterPanel,i.operator="or",i.editorPlaceholder=l.localize("filterValuePlaceholder"),i.theme=l.theme,i.editorCallback=t,i.ownerElement=a,l.$.colors.appendChild(i),l._colorsPartCreated=!0),l._openHeaderDropDown(l.$.colorsButton)}openSortPanel(e){const t=this,a=t.dataSource;if(!a||0===a.length&&!a.virtualDataSource||t.disabled||"none"===t.headerPosition)return;let l;t._closeDialog(),t.$.headerDropDown.classList.add("sort-panel"),t.$.headerDropDown.classList.remove("customize-panel","filter-panel","format-panel","search-panel"),t.$.sort.classList.remove("smart-hidden"),t.$.customize.classList.add("smart-hidden"),t.$.filter.classList.add("smart-hidden"),t.$.colors.classList.add("smart-hidden"),t.$.format&&t.$.format.classList.add("smart-hidden"),t.$.group&&t.$.group.classList.add("smart-hidden"),t.$.search.classList.add("smart-hidden"),t._closeSearchPanel(),t._sortPartCreated?(l=t.$.sort.firstElementChild,l.rightToLeft=t.rightToLeft,l.dataSource=e,l.locale=t.locale,l.messages=t._innerElementMessages.sortPanel,l.set("dataSource",e),l.propertyChangedHandler("dataSource",void 0,e)):(l=document.createElement("smart-sort-panel"),l.rightToLeft=t.rightToLeft,l.animation=t.animation,l.dataSource=e,l.locale=t.locale,l.messages=t._innerElementMessages.sortPanel,l.theme=t.theme,t.$.sort.appendChild(l),t._sortPartCreated=!0),t._openHeaderDropDown(t.$.sortButton)}removeFilter(){this.addFilter([])}removeSort(){this.addSort({dataFields:[],dataTypes:[],orderBy:[]})}_clearFilterAndSortUI(){const e=this;e._appliedFiltering={filterGroups:[],filters:[],operator:"and"},e._appliedSorting={dataFields:[],dataTypes:[],orderBy:[]},e._appliedGrouping={dataFields:[]},e._appliedColors=[[],{type:"conditions",decorate:"border",singleSelect:""}],e.$.filterButton.classList.remove("filtered"),e.$.sortButton.classList.remove("sorted"),e.$.filterButton.firstElementChild.innerHTML=e.localize("filter"),e.$.sortButton.firstElementChild.innerHTML=e.localize("sort")}_getInnerElementMessages(){const e=this,t=e.locale,a={columnPanel:{},groupPanel:{},multiColumnFilterPanel:{},sortPanel:{},formattingPanel:{},dateTimePicker:{}};a.formattingPanel[t]={add:e.localize("add"),all:e.localize("all"),apply:e.localize("apply"),between:e.localize("between"),cancel:e.localize("cancel"),close:e.localize("close"),column:e.localize("column"),condition:e.localize("condition"),equal:e.localize("equal"),fontFamily:e.localize("fontFamily"),fontSize:e.localize("fontSize"),format:e.localize("format"),greaterThan:e.localize("greaterThan"),highlight:e.localize("highlight"),lessThan:e.localize("lessThan"),notEqual:e.localize("notEqual"),remove:e.localize("remove"),secondValue:e.localize("secondValue"),text:e.localize("text"),value:e.localize("value")},a.columnPanel[t]={apply:e.localize("apply"),cancel:e.localize("cancel"),reset:e.localize("reset"),find:e.localize("find"),noResults:e.localize("noResults")},a.groupPanel[t]={apply:e.localize("apply"),cancel:e.localize("cancel"),collapseAll:e.localize("collapseAll"),expandAll:e.localize("expandAll"),firstBy:e.localize("firstByGroup"),noGrouping:e.localize("noGrouping"),pickAnother:e.localize("pickAnotherGroupBy"),stringFirst:e.localize("stringFirst"),stringLast:e.localize("stringLast"),thenBy:e.localize("thenBy"),from:e.localize("from"),booleanFirst:e.localize("booleanFirst"),booleanLast:e.localize("booleanLast"),dateFirst:e.localize("dateFirst"),dateLast:e.localize("dateLast"),numberFirst:e.localize("numberFirst"),numberLast:e.localize("numberLast")},a.multiColumnFilterPanel[t]={addFilter:e.localize("addFilter"),noResults:e.localize("noResults"),add:"+ "+e.localize("add"),select:e.localize("dialogAddColumnTypeSelect"),condition:e.localize("conditions"),and:e.localize("and"),apply:e.localize("apply"),cancel:e.localize("cancel"),CONTAINS:e.localize("CONTAINS"),CONTAINS_CASE_SENSITIVE:e.localize("CONTAINS_CASE_SENSITIVE"),DOES_NOT_CONTAIN:e.localize("DOES_NOT_CONTAIN"),DOES_NOT_CONTAIN_CASE_SENSITIVE:e.localize("DOES_NOT_CONTAIN_CASE_SENSITIVE"),EMPTY:e.localize("EMPTY"),ENDS_WITH:e.localize("ENDS_WITH"),ENDS_WITH_CASE_SENSITIVE:e.localize("ENDS_WITH_CASE_SENSITIVE"),EQUAL:e.localize("EQUAL"),EQUAL_CASE_SENSITIVE:e.localize("EQUAL_CASE_SENSITIVE"),GREATER_THAN:e.localize("GREATER_THAN"),GREATER_THAN_OR_EQUAL:e.localize("GREATER_THAN_OR_EQUAL"),LESS_THAN:e.localize("LESS_THAN"),LESS_THAN_OR_EQUAL:e.localize("LESS_THAN_OR_EQUAL"),noFilters:e.localize("noFilters"),NOT_EMPTY:e.localize("NOT_EMPTY"),NOT_EQUAL:e.localize("NOT_EQUAL"),NOT_NULL:e.localize("NOT_NULL"),NULL:e.localize("NULL"),or:e.localize("or"),STARTS_WITH:e.localize("STARTS_WITH"),STARTS_WITH_CASE_SENSITIVE:e.localize("STARTS_WITH_CASE_SENSITIVE"),where:e.localize("where"),TOMORROW:e.localize("TOMORROW"),TODAY:e.localize("TODAY"),YESTERDAY:e.localize("YESTERDAY"),THIS_WEEK:e.localize("THIS_WEEK"),LAST_WEEK:e.localize("LAST_WEEK"),NEXT_WEEK:e.localize("NEXT_WEEK"),THIS_MONTH:e.localize("THIS_MONTH"),LAST_MONTH:e.localize("LAST_MONTH"),NEXT_MONTH:e.localize("NEXT_MONTH"),conditions:e.localize("conditions"),colorsSingleSelect:e.localize("colorsSingleSelect"),colorRows:e.localize("colorRows"),colorSelect:e.localize("colorSelect"),colorLeftBorderLabel:e.localize("colorLeftBorderLabel"),colorRowLabel:e.localize("colorRowLabel"),colorCellLabel:e.localize("colorCellLabel"),colorLeftBorder:e.localize("colorLeftBorder"),colorRow:e.localize("colorRow"),colorCell:e.localize("colorCell"),noOptions:e.localize("noOptions")},a.sortPanel[t]={apply:e.localize("apply"),applyOnce:e.localize("applyOnce"),booleanFirst:e.localize("booleanFirst"),booleanLast:e.localize("booleanLast"),cancel:e.localize("cancel"),dateFirst:e.localize("dateFirst"),dateLast:e.localize("dateLast"),firstBy:e.localize("firstBy"),from:e.localize("from"),numberFirst:e.localize("numberFirst"),numberLast:e.localize("numberLast"),noSorting:e.localize("noSorting"),pickAnother:e.localize("pickAnother"),maintainSort:e.localize("maintainSort"),stringFirst:e.localize("stringFirst"),stringLast:e.localize("stringLast"),thenBy:e.localize("thenBy")},a.dateTimePicker[t]={now:e.localize("now"),dateTabLabel:e.localize("dateTabLabel"),timeTabLabel:e.localize("timeTabLabel")},e._innerElementMessages=a}_handleHeaderPosition(e){const t=this,a=t.headerPosition,l=t.$.header;"none"!==a?(l.classList.remove("smart-hidden"),"top"===a&&l.nextElementSibling!==e?t.$.container.insertBefore(l,e):"bottom"===a&&l.previousElementSibling!==e&&t.$.container.insertBefore(l,t.$.loadingIndicatorContainer)):l.classList.add("smart-hidden")}_headerClickHandler(e){const t=this,a=t.$.headerDropDown;function l(e,l){a.classList.contains("smart-visibility-hidden")||e.classList.contains("smart-hidden")?t[l]():t.closePanel()}if(t.$.customizeButton.contains(e))l(t.$.customize,"openCustomizePanel");else if(t.$.filterButton.contains(e))l(t.$.filter,"openFilterPanel");else if(t.$.sortButton.contains(e))l(t.$.sort,"openSortPanel");else if(t.$.formatButton&&t.$.formatButton.contains(e))l(t.$.format,"openFormatPanel");else if(t.$.colorsButton&&t.$.colorsButton.contains(e))l(t.$.colors,"openColorsPanel");else if(e===t.$.searchButton)l(t.$.search,"_openSearchPanel");else if(t.$.groupButton&&t.$.groupButton.contains(e))l(t.$.group,"openGroupPanel");else if(t.$.viewStatesButton&&t.$.viewStatesButton.contains(e))l(t.$.view,"openViewPanel");else if(e===t.$.searchClose)t.$.searchInput.value="",t._search("",!1),t.closePanel();else if(e===t.$.searchPrev||e===t.$.searchNext){const a=t._searchInfo,l=a.foundIdsArray,n=e===t.$.searchNext,i=l.length;let o;if(void 0===a.highlighted)o=n?0:i-1;else{if(1===l.length)return;{const e=l.indexOf(a.highlighted);o=n?(e+1)%i:e-1>=0?e-1:i-1}}a.highlighted=l[o],t.grid?(t.grid.highlighted=a.highlighted,t.grid.ensureVisible(a.highlighted),t.grid._recycle(!1)):t.ensureVisible&&t.ensureVisible(a.highlighted),t.$.searchLabel.innerHTML=t.localize("found",{nth:o+1,n:l.length})}}_headerDropDownTransitionendHandler(e){const t=this,a=t.$.headerDropDown;t._openTimer=setTimeout((()=>{e&&("visibility"!==e.propertyName||a.classList.contains("smart-visibility-hidden"))||(a.classList.contains("search-panel")?t.$.searchInput.focus():!1===t.unfocusable&&(!t._isMobile&&a.classList.contains("customize-panel")?a.querySelector("smart-column-panel").$.find.focus():a.classList.contains("filter-panel")?a.querySelector("smart-multi-column-filter-panel").$.addFilterButton.focus():a.classList.contains("sort-panel")&&a.querySelector("smart-sort-panel").$.inputNotSorted.focus()))}),100)}_localizeHeader(){const e=this;e.$.customizeButton.firstElementChild.innerHTML=e.localize("customize"),e.$.groupButton&&(e.$.groupButton.firstElementChild.innerHTML=e.localize("group")),0===e._appliedFiltering.filters.length?e.$.filterButton.firstElementChild.innerHTML=e.localize("filter"):1===e._appliedFiltering.filters.length?e.$.filterButton.firstElementChild.innerHTML=e.localize("filteredByOne"):e.$.filterButton.firstElementChild.innerHTML=e.localize("filteredByMultiple",{n:e._appliedFiltering.filters.length}),0===e._appliedSorting.dataFields.length?e.$.sortButton.firstElementChild.innerHTML=e.localize("sort"):1===e._appliedSorting.dataFields.length?e.$.sortButton.firstElementChild.innerHTML=e.localize("sortedByOne"):e.$.sortButton.firstElementChild.innerHTML=e.localize("sortedByMultiple",{n:e._appliedSorting.dataFields.length}),e.$.formatButton&&(e.$.formatButton.firstElementChild.innerHTML=e.localize("formating")),e.$.searchInput.placeholder=e.localize("findInView")}_openHeaderDropDown(e){const t=this,a=t.$.headerDropDown;"top"===t.headerPosition?(a.style.bottom=null,a.style.top="100%"):(a.style.top=null,a.style.bottom="100%"),e!==t.$.searchButton||e===t.$.searchButton&&t.rightToLeft?a.style.left=e.offsetLeft-(t.rightToLeft?a.offsetWidth-e.offsetWidth:0)+"px":a.style.left=(t.rightToLeft?e.offsetLeft:e.offsetLeft+Math.max(25,e.offsetWidth)-a.offsetWidth)+"px",a.classList.remove("smart-visibility-hidden"),a.classList.add("open"),a.controlledBy&&(a.controlledBy.removeAttribute("aria-controls"),a.controlledBy.setAttribute("aria-expanded",!1)),a.controlledBy=e,e.setAttribute("aria-controls",a.id),e.setAttribute("aria-expanded",!0),t._headerDropDownTransitionendHandler()}_searchInputKeyupHandler(e){const t=this;function a(){t._searchInfo&&t.$.searchInput.value!==t._searchInfo.query&&t._search(t.$.searchInput.value)}return clearTimeout(t._searchInputTimeout),"Escape"===e.key?(t.$.searchInput.value="",a(),void t.closePanel()):"Enter"===e.key&&t._searchInfo.foundIdsArray&&t._searchInfo.foundIdsArray.length>1?(a(),void t._headerClickHandler(t.$.searchNext,t.$.cardContainer||t.$.body)):void(t._searchInputTimeout=setTimeout(a,500))}}),Smart("smart-colors-panel",class extends Smart.BaseElement{static get properties(){return{closeButtonPosition:{value:"left",allowedValues:["left","right"],type:"string"},dataSource:{value:[],type:"array",reflectToAttribute:!1},editorCallback:{value:null,type:"function?",reflectToAttribute:!1},editorPlaceholder:{value:"Value",type:"string"},messages:{value:{en:{addFilter:"+ Add decorator",and:"And",apply:"Ok",cancel:"Cancel",CONTAINS:"contains",CONTAINS_CASE_SENSITIVE:"contains (case sensitive)",DOES_NOT_CONTAIN:"does not contain",DOES_NOT_CONTAIN_CASE_SENSITIVE:"does not contain (case sensitive)",EMPTY:"empty",ENDS_WITH:"ends with",ENDS_WITH_CASE_SENSITIVE:"ends with (case sensitive)",EQUAL:"equal",EQUAL_CASE_SENSITIVE:"equal (case sensitive)",GREATER_THAN:"greater than",GREATER_THAN_OR_EQUAL:"greater than or equal",LESS_THAN:"less than",LESS_THAN_OR_EQUAL:"less than or equal",noFilters:"No filters applied",NOT_EMPTY:"not empty",NOT_EQUAL:"not equal",NOT_NULL:"not null",NULL:"null",or:"Or",STARTS_WITH:"starts with",STARTS_WITH_CASE_SENSITIVE:"starts with (case sensitive)",where:"Where",TOMORROW:"Tomorrow",TODAY:"Today",YESTERDAY:"Yesterday",NEXT_WEEK:"Next week",THIS_WEEK:"This week",LAST_WEEK:"Last week",NEXT_MONTH:"Next month",THIS_MONTH:"This month",LAST_MONTH:"Last month"}},type:"object",extend:!0},operator:{value:"and",allowedValues:["and","or"],type:"string"},value:{value:[],type:"array"}}}static get listeners(){return{change:"_changeHandler",click:"_interactionHandler",keydown:"_interactionHandler"}}static get requires(){return{"Smart.Button":"smart.button.js","Smart.CheckBox":"smart.checkbox.js","Smart.DateTimePicker":"smart.datetimepicker.js","Smart.FilterGroup":"smart.filter.js","Smart.Input":"smart.input.js","Smart.NumericTextBox":"smart.numerictextbox.js"}}static get styleUrls(){return["smart.gridpanel.css"]}template(){return'<div id="container" role="presentation">\n <div id="gridLayout">\n <div style="border-right: 1px solid var(--smart-border)" class="tabs" id="tabs">\n <div title="Color rows when they match the conditions" class="tab active" id="condition"></div>\n <div title="Color rows the same as a single select value" class="tab" id="select"></div>\n </div>\n <div style="margin-left: 10px;" id="applyTo"></div>\n </div>\n <div>\n\n <span id="conditionLabel">Color rows when they match the conditions</span>\n <div id="singleSelectLabel" class="smart-hidden">Which single select field should the row be colored by?</div>\n <smart-input style="margin-top: 10px; margin-bottom: 10px; width: 250px; display: block;" selected-index="0" class="underlined smart-hidden" readonly id="singleSelect"></smartinput>\n </div>\n <div id="itemsContainer" style="padding-top: 0px;" class="smart-filter-panel-items-container smart-unselectable"></div>\n <div id="footer" class="smart-grid-panel-container-footer" role="presentation">\n <div id="addFilterButton" class="smart-filter-panel-add-filter-button smart-unselectable" role="button"></div>\n <div id="buttonsContainer" class="smart-grid-panel-buttons-container smart-unselectable" role="presentation">\n <span class="smart-grid-panel-cancel-button" role="button"></span>\n <span class="smart-grid-panel-apply-button primary" role="button"></span>\n </div>\n </div>'}ready(){super.ready()}updateSingleSelect(){const e=this,t=e.ownerElement.columns.filter((e=>!!e.template&&!("tags"!==e.template&&"collaborator"!==e.template&&"dropdownlist"!==e.template&&"list"!==e.template||!e.editor.singleSelect))).map((e=>({label:e.label,value:e.dataField})));e.$.singleSelect.dataSource=t,e.$.singleSelect.selectedValue=t[0]?t[0].value:""}render(){const e=this;e.setAttribute("role","dialog"),e.$.gridLayout.style.display="grid",e.$.gridLayout.style.gridTemplateColumns="400px auto",e.$.gridLayout.style.gridColumnGap="1rem",e.$.gridLayout.style.overflow="hidden",e.$.condition.onclick=()=>{e.$.select.classList.remove("active"),e.$.condition.classList.add("active"),e.$.singleSelectLabel.classList.add("smart-hidden"),e.$.singleSelect.classList.add("smart-hidden"),e.$.addFilterButton.classList.remove("smart-visibility-hidden"),e.$.itemsContainer.classList.remove("smart-hidden"),e.$.conditionLabel.classList.remove("smart-hidden"),e.$.singleSelect.classList.add("smart-hidden"),e.$.applyToInput.dataSource[2].visible=!0},e.$.select.onclick=()=>{e.$.select.classList.add("active"),e.$.condition.classList.remove("active"),e.$.singleSelectLabel.classList.remove("smart-hidden"),e.$.singleSelect.classList.remove("smart-hidden"),e.$.addFilterButton.classList.add("smart-visibility-hidden"),e.$.itemsContainer.classList.add("smart-hidden"),e.$.conditionLabel.classList.add("smart-hidden"),e.$.singleSelect.classList.remove("smart-hidden"),e.$.applyToInput.dataSource[2].visible=!1,2===e.$.applyToInput.selectedIndex&&(e.$.applyToInput.selectedIndex=0)};const t=document.createElement("smart-input");t.readonly=!0,t.dropDownButtonPosition="right",t.dropDownAppendTo="body",t.style.width="100%",e.$.singleSelect.dropDownButtonPosition="right",e.$.singleSelect.dropDownAppendTo="body",e.updateSingleSelect();const a="var(--smart-primary);";t.dataSource=[{label:"Left border",value:"border",menuLabel:'<div style="flex-direction: column; display: inline-flex"><div>Left border</div><div class="smart-quiet">Color the left border of a row</div>',prefix:'<span style="top: 8px; border-right: 3px solid '+a+'; padding: 2px; display: inline-block; margin-right: 16px; position: relative;">1</span>'},{label:"Row",value:"row",menuLabel:'<div style="flex-direction: column; display: inline-flex"><div>Row background</div><div class="smart-quiet">Color the background of a row</div>',prefix:'<span style="top: 8px; border: 1px solid var(--smart-primary); color: var(--smart-primary-color); background: '+a+'; padding: 2px; display: inline-block; margin-left:-4px; position: relative;">1</span><span style="border: 1px solid var(--smart-primary); color: var(--smart-primary-color); top: 8px; background: '+a+'; padding: 2px; display: inline-block; margin-right: 8px; position: relative;">2</span>'},{label:"Cell",value:"cell",menuLabel:'<div style="flex-direction: column; display: inline-flex"><div>Cell background</div><div class="smart-quiet">Color the background of a cell</div>',prefix:'<span style="top: 8px; border: 1px solid var(--smart-primary); color: var(--smart-primary-color); background: '+a+'; padding: 2px; display: inline-block; margin-left:-4px; position: relative;">1</span><span style="border:1px solid '+a+'; padding: 2px; display: inline-block; top: 8px; margin-right: 8px; position: relative;">2</span>'}],e.$.applyTo.appendChild(t),e.$.applyToInput=t,e._setFocusable(),e._localize(),e.$.applyToInput.selectedIndex=0,e._applyValue(),super.render()}propertyChangedHandler(e,t,a){super.propertyChangedHandler(e,t,a);const l=this;switch(e){case"animation":case"theme":case"rightToLeft":Array.from(l.$.itemsContainer.querySelectorAll("smart-date-time-picker, smart-numeric-text-box, smart-check-box, smart-input")).forEach((t=>{t[e]=a,"smart-input"===t.tagName.toLowerCase()&&"rightToLeft"===e&&"none"!==t.dropDownButtonPosition&&(t.dropDownButtonPosition=a?"left":"right")}));break;case"disabled":case"unfocusable":l._setFocusable(!0);break;case"dataSource":case"value":l._applyValue();break;case"editorPlaceholder":Array.from(l.$.itemsContainer.getElementsByClassName("editor")).forEach((e=>e.placeholder=a));break;case"locale":case"messages":l._localize(!0);break;case"operator":l._setOperator()}}_setOperator(){const e=this,t=e.localize(e.operator);for(let a=2;a<e._items.length;a++)e._items[a].children[1].innerHTML=t}_changeHandler(e){const t=this,a=t.shadowRoot||t.isInShadowDOM?e.composedPath()[0]:e.target;if(a instanceof Smart.Input==0)return;const l=a.parentElement,n=l.children;if(a===n[1])t.operator=a.$.input.dataValue,t._setOperator();else if(a===n[2]){let a,i,o=t.dataSource.find((t=>t.dataField===e.detail.oldValue)).dataType,r=t.dataSource.find((t=>t.dataField===e.detail.oldValue)),s=t.dataSource.find((t=>t.dataField===e.detail.value)),d=s.dataType,c=[];if(s.options&&(d="enum",c=s.options.map((e=>{const t=e.color||"var(--smart-primary)";return e.prefix='<span style="background: '+t+'; width: 14px; height: 14px; display: inline-block; border-radius: 50%; margin-left:-4px; margin-right: 8px; top: 2px; position: relative;"></span>',""===e.label&&(e.label=" "),e}))),r&&r.options&&(o="enum"),"enum"!==d&&d===o)return void(t.editorCallback&&t.editorCallback(n[4],s));let p=n[3]?n[3].value:"";switch(d){case"date":a=t._dateConditions,i=document.createElement("smart-date-time-picker"),i.calendarButton=!0,i.dropDownAppendTo="body",i.dropDownDisplayMode="auto",i.formatString="M/d/yy H:mm",p="";break;case"number":a=t._numberAndDateConditions,i=document.createElement("smart-numeric-text-box"),p="";break;case"boolean":a=t._booleanConditions,i=document.createElement("smart-check-box"),p="";break;case"enum":a=t._enumConditions,i=document.createElement("smart-input"),i.dataSource=c.length?c:s.options,i.readonly=!0,i.dropDownButtonPosition="right",p=a[0];break;default:a=t._stringConditions,p=t._stringConditions.find((e=>"CONTAINS"===e.value)),i=document.createElement("smart-input")}a.forEach((e=>{delete e.selected})),i.rightToLeft=t.rightToLeft,i.animation=t.animation,i.theme=t.theme,i.unfocusable=t.disabled||t.unfocusable,i.classList.add("underlined"),i.dataSource&&i.dataSource.length<10?i.dropDownHeight="auto":i.dropDownHeight=250,"boolean"!==d&&(i.placeholder=t.editorPlaceholder),t.editorCallback&&t.editorCallback(i,s),n[4]&&n[4].remove(),l.appendChild(i),""===p||a.find((e=>e.label===p))||(p.value?(n[3].value=p.label,n[3].selectedValue=p.value):(n[3].value="",n[3].selectedValue="")),n[3].dataSource=a,""===p&&(n[3].value=a[0].label,n[3].selectedValue=a[0].value),a.length>=10?n[3].dropDownHeight=250:n[3].dropDownHeight="auto",l.dataType=d}else if(a===n[3]){const e=n[4],t=a.$.input.dataValue;-1!==t.indexOf("NULL")||-1!==t.indexOf("EMPTY")||-1!==t.indexOf("THIS_WEEK")||-1!==t.indexOf("LAST_WEEK")||-1!==t.indexOf("NEXT_WEEK")||-1!==t.indexOf("THIS_MONTH")||-1!==t.indexOf("LAST_MONTH")||-1!==t.indexOf("NEXT_MONTH")||-1!==t.indexOf("THIS_YEAR")||-1!==t.indexOf("LAST_YEAR")||-1!==t.indexOf("NEXT_YEAR")||-1!==t.indexOf("TODAY")||-1!==t.indexOf("TOMORROW")||-1!==t.indexOf("YESTERDAY")?(e.value="",e.checked=!1,e.classList.add("smart-visibility-hidden")):e.classList.remove("smart-visibility-hidden"),a.condition=t}}_getColorInput(){const e=document.createElement("smart-color-input");return e.dataSource=["#D50000","#E67C73","#F4511E","#F6BF26","#0B8043","#33B679","#3F51B5","#039BE5","#7986CB","#8C47FF","#8E24AA","#FF36C2","#616161","#454545","#949494","#000000"],e.additionalColors=["#FF9EB7","#FF9EB7","#FFD66D","#FFEBB6","#93DF89","#D1F7C4","#9DC7FF","#D0F0FD","#CDAFFF","#ECE1FD","#FA9DE2","#FFDAF6","#CBCBCB","#EDEDED","#FFFFFF",""],e.valueDisplayMode="colorBox",e.classList.add("underlined","smart-grid-color-input"),e.style.width="auto",e.readonly=!0,e.onRender=()=>{const t=e.$.scrollView;e.querySelector(".smart-color-box").style.borderRadius="50%",t&&t.classList.add("smart-grid-color-input")},e}_interactionHandler(e){const t=this;if(t.disabled||t.readonly)return;if("keydown"===e.type){if("Enter"!==e.key)return;e.preventDefault()}const a=t.shadowRoot||t.isInShadowDOM?e.composedPath()[0]:e.target,l=a.closest(".smart-grid-panel-item");if(l){if(a===l.firstElementChild){const e=t._items.indexOf(l);let a;if(t._items.splice(e,1),l.remove(),t._items.length>0&&e<2){if(0===e){t._items[0].children[1].remove(),a=document.createElement("div"),a.innerHTML=t.localize("where");const e=t._getColorInput();t._items[0].insertBefore(e,t._items[0].children[1])}t._items.length>1&&(t._items[1].children[1].remove(),a=document.createElement("smart-input"),a.className="underlined",a.dataSource=[{value:"and",label:t.localize("and")},{value:"or",label:t.localize("or")}],a.dropDownButtonPosition=t.rightToLeft?"left":"right",a.readonly=!0,a.value=t.localize(t.operator),a.animation=t.animation,a.theme=t.theme,a.rightToLeft=t.rightToLeft,a.unfocusable=t.disabled||t.unfocusable,t._items[1].insertBefore(a,t._items[1].children[1]))}}}else if(a===t.$.addFilterButton&&t.dataSource.length>0)t.$.itemsContainer.appendChild(t._createItem(t.dataSource[0],"","",t._items.length));else if(a!==t.$.buttonsContainer.firstElementChild){if(a===t.$.buttonsContainer.children[1]){let e=t._stringConditions.concat(t._dateConditions),a=t.operator,l=[],n={},i=[];t._customConditions&&(e=e.concat(t._customConditions)),t._items.forEach((i=>{const o=t.dataSource.find((e=>e.label===i.children[2].value)),r=[];let s=i.children[3].value;if(""===s)return;let d=o.dataType;s=e.find((e=>e.label===s)).value;const c=i.querySelector("smart-color-input").value;if(r.push(o.dataField,s),-1===s.indexOf("NULL")&&-1===s.indexOf("EMPTY"))if("boolean"===d)r.push(i.children[4].checked);else if("date"===d)r.push(i.children[4].value.toDate());else if("enum"===d||o.options){let e=i.children[4].$.input.dataValue;if(void 0===e){const t=o.options.find((e=>e.label===i.children[4].value));if(!t)return;e=t.value}d="string",r.push(e)}else r.push(i.children[4].value);r.push(c);let p=n[r[0]];void 0===p&&(p=new Smart.Utilities.FilterGroup,n[r[0]]=p);const u=p.createFilter(d,r[2],r[1]);p.addFilter(a,u),l.push(r)}));for(let e in n)i.push([e,n[e]]);const o={};o.type=t.$.condition.classList.contains("active")?"conditions":"singleSelect",o.decorate=t.$.applyToInput.selectedValue,o.singleSelect=t.$.singleSelect.selectedValue,null===o.decorate&&(o.decorate="border"),t.value=l,t.$.fireEvent("apply",{filters:i,decorator:o,value:l})}}else t.$.fireEvent("cancel")}_applyValue(){const e=this,t=document.createDocumentFragment();let a=0;for(e._items=[];e.$.itemsContainer.firstElementChild;)e.$.itemsContainer.firstElementChild.remove();if(0===e.dataSource.length)return;const l=e.value&&e.value[0]||[],n=e.value?e.value[1]:{};n&&"singleSelect"===n.type?e.$.select.click():e.$.condition.click(),l.forEach((l=>{if(!Array.isArray(l))return;const n=l[0],i=e.dataSource.find((e=>e.dataField===n));if(!i)return;let o;o="EMPTY"===l[1]||"NULL"===l[1]||"NOT_EMPTY"===l[1]||"NOT_NULL"===l[1]?e._createItem(i,l[1],void 0,a,l[2]):e._createItem(i,l[1],l[2],a,l[3]),t.appendChild(o),a++})),e.$.itemsContainer.appendChild(t),e.updateSingleSelect(),n&&(e.$.applyToInput.selectedValue=n.decorate,e.$.singleSelect.selectedValue=n.singleSelect)}_createItem(e,t,a,l,n=""){const i=this,o=i.disabled||i.unfocusable?-1:0,r=document.createElement("div"),s=document.createDocumentFragment(),d=document.createElement("div"),c=document.createElement("smart-input"),p=document.createElement("smart-input");let u,m;d.className="smart-grid-panel-item-close-button",d.tabIndex=o,d.setAttribute("role","button"),d.setAttribute("aria-label","button"),s.appendChild(d),u=document.createElement("div");const h=i._getColorInput();if(h.value=n,u.appendChild(h),u.setAttribute("role","presentation"),s.appendChild(u),c.className="underlined",c.dataSource=i.dataSource.map((e=>({value:e.dataField,label:e.label,icon:e.icon}))),c.dropDownButtonPosition=i.rightToLeft?"left":"right",c.readonly=!0,c.value=e.label,c.animation=i.animation,c.theme=i.theme,c.rightToLeft=i.rightToLeft,c.unfocusable=i.disabled||i.unfocusable,c.setAttribute("aria-label","Field"),c.dataSource&&c.dataSource.length<10?c.dropDownHeight="auto":c.dropDownHeight=250,s.appendChild(c),"boolean"===e.dataType)p.dataSource=JSON.parse(JSON.stringify(i._booleanConditions)),m=document.createElement("smart-check-box"),m.checked="boolean"==typeof a&&a;else if("date"===e.dataType)p.dataSource=i._dateConditions,m=document.createElement("smart-date-time-picker"),m.dropDownDisplayMode="auto",m.calendarButton=!0,m.dropDownAppendTo="body",m.formatString="M/d/yy H:mm",m.value=a;else if("number"===e.dataType)p.dataSource=JSON.parse(JSON.stringify(i._numberAndDateConditions)),m=document.createElement("smart-numeric-text-box"),m.value="number"==typeof a||"string"==typeof a?a:0;else if("enum"===e.dataType||e.options){p.dataSource=JSON.parse(JSON.stringify(i._enumConditions)),m=document.createElement("smart-input");let t=[];e.options&&(t=e.options.map((e=>{const t=e.color||"var(--smart-primary)";return e.prefix='<span style="background: '+t+'; width: 14px; height: 14px; display: inline-block; border-radius: 50%; margin-left:-4px; margin-right: 8px; top: 2px; position: relative;"></span>',""===e.label&&(e.label=" "),e}))),m.dataSource=t.length?t:e.options,m.readonly=!0,m.dropDownButtonPosition="right";const l=a?e.options.find((e=>e.value===a)):null;m.value=l&&a?l.label:""}else p.dataSource=JSON.parse(JSON.stringify(i._stringConditions)),m=document.createElement("smart-input"),m.value=null!=a?a.toString():"",t||(t="CONTAINS");return p.className="underlined",p.dropDownButtonPosition=i.rightToLeft?"left":"right",p.readonly=!0,p.animation=i.animation,p.theme=i.theme,p.rightToLeft=i.rightToLeft,p.unfocusable=i.disabled||i.unfocusable,p.setAttribute("aria-label","Condition"),p.classList.add("smart-filter-panel-list"),p.dataSource.forEach((e=>{delete e.selected})),p.dataSource.find((e=>e.value===t))?(p.value=i.localize(t),p.selectedValue=t,p.condition=t):(m.value="",m.checked=!1),(void 0===t||-1===t.indexOf("NULL")&&-1===t.indexOf("EMPTY"))&&-1===t.indexOf("THIS_WEEK")&&-1===t.indexOf("LAST_WEEK")&&-1===t.indexOf("NEXT_WEEK")&&-1===t.indexOf("THIS_MONTH")&&-1===t.indexOf("LAST_MONTH")&&-1===t.indexOf("NEXT_MONTH")&&-1===t.indexOf("THIS_YEAR")&&-1===t.indexOf("LAST_YEAR")&&-1===t.indexOf("NEXT_YEAR")&&-1===t.indexOf("TODAY")&&-1===t.indexOf("TOMORROW")&&-1===t.indexOf("YESTERDAY")||(m.value="",m.checked=!1,m.classList.add("smart-visibility-hidden")),p.dataSource&&p.dataSource.length<10?p.dropDownHeight="auto":p.dropDownHeight=250,m.animation=i.animation,m.classList.add("editor"),m.rightToLeft=i.rightToLeft,m.theme=i.theme,m.unfocusable=i.disabled||i.unfocusable,m.classList.add("underlined"),"boolean"!==e.dataType&&(m.placeholder=i.editorPlaceholder),i.editorCallback&&i.editorCallback(m,e),s.appendChild(p),s.appendChild(m),r.appendChild(s),r.className="smart-grid-panel-item",i._items.push(r),r.dataType=e.dataType,r}_localize(e){const t=this;t.$.addFilterButton.innerHTML=t.localize("add"),t.$.buttonsContainer.firstElementChild.innerHTML=t.localize("cancel"),t.$.buttonsContainer.children[1].innerHTML=t.localize("apply"),t.$.itemsContainer.setAttribute("no-filters",t.localize("noResults")),t.$.select.innerHTML='<span class="smart-icon smart-grid-icon smart-icon-sort-down show"></span>'+t.localize("select"),t.$.condition.innerHTML='<span class="smart-icon smart-grid-icon smart-icon-filter show"></span>'+t.localize("conditions"),t.$.condition.title=t.localize("colorRows"),t.$.select.title=t.localize("colorSelect"),t.$.conditionLabel.innerHTML=t.localize("colorRows"),t.$.singleSelectLabel.innerHTML=t.localize("colorsSingleSelect"),t.$.singleSelect.dropDownPlaceholder=t.localize("noOptions");const a="var(--smart-primary);";t.$.applyToInput.dataSource=[{label:t.localize("colorLeftBorderLabel"),value:"border",menuLabel:`<div style="flex-direction: column; display: inline-flex"><div>${t.localize("colorLeftBorderLabel")}</div><div class="smart-quiet">${t.localize("colorLeftBorder")}</div>`,prefix:'<span style="top: 8px; border-right: 3px solid '+a+'; padding: 2px; display: inline-block; margin-right: 16px; position: relative;">1</span>'},{label:t.localize("colorRowLabel"),value:"row",menuLabel:`<div style="flex-direction: column; display: inline-flex"><div>${t.localize("colorRowLabel")}</div><div class="smart-quiet">${t.localize("colorRow")}</div>`,prefix:'<span style="top: 8px; border: 1px solid var(--smart-primary); color: var(--smart-primary-color); background: '+a+'; padding: 2px; display: inline-block; margin-left:-4px; position: relative;">1</span><span style="border: 1px solid var(--smart-primary); color: var(--smart-primary-color); top: 8px; background: '+a+'; padding: 2px; display: inline-block; margin-right: 8px; position: relative;">2</span>'},{label:t.localize("colorCellLabel"),value:"cell",menuLabel:`<div style="flex-direction: column; display: inline-flex"><div>${t.localize("colorCellLabel")}</div><div class="smart-quiet">${t.localize("colorCell")}</div>`,prefix:'<span style="top: 8px; border: 1px solid var(--smart-primary); color: var(--smart-primary-color); background: '+a+'; padding: 2px; display: inline-block; margin-left:-4px; position: relative;">1</span><span style="border:1px solid '+a+'; padding: 2px; display: inline-block; top: 8px; margin-right: 8px; position: relative;">2</span>'}],t.$.applyToInput.selectedValue="border",t._stringConditions=[{prefix:'<span class="smart-icon smart-icon-empty"></span>',value:"EMPTY",label:t.localize("EMPTY")},{prefix:'<span class="smart-icon smart-icon-not-empty"></span>',value:"NOT_EMPTY",label:t.localize("NOT_EMPTY")},{prefix:'<span class="smart-icon smart-icon-contains"></span>',value:"CONTAINS",label:t.localize("CONTAINS")},{prefix:'<span class="smart-icon smart-icon-does-not-contain"></span>',value:"DOES_NOT_CONTAIN",label:t.localize("DOES_NOT_CONTAIN")},{prefix:'<span class="smart-icon smart-icon-starts-with"></span>',value:"STARTS_WITH",label:t.localize("STARTS_WITH")},{prefix:'<span class="smart-icon smart-icon-ends-with"></span>',value:"ENDS_WITH",label:t.localize("ENDS_WITH")},{prefix:'<span class="smart-icon smart-icon-equal"></span>',value:"EQUAL",label:t.localize("EQUAL")},{prefix:'<span class="smart-icon smart-icon-not-equal"></span>',value:"NOT_EQUAL",label:t.localize("NOT_EQUAL")},{prefix:'<span class="smart-icon smart-icon-null"></span>',value:"NULL",label:t.localize("NULL")},{prefix:'<span class="smart-icon smart-icon-not-null"></span>',value:"NOT_NULL",label:t.localize("NOT_NULL")}],t._enumConditions=[{prefix:'<span class="smart-icon smart-icon-equal"></span>',value:"EQUAL",label:t.localize("EQUAL")},{prefix:'<span class="smart-icon smart-icon-not-equal"></span>',value:"NOT_EQUAL",label:t.localize("NOT_EQUAL")}],t._dateConditions=[{prefix:'<span class="smart-icon smart-icon-equal"></span>',value:"EQUAL",label:t.localize("EQUAL")},{prefix:'<span class="smart-icon smart-icon-not-equal"></span>',value:"NOT_EQUAL",label:t.localize("NOT_EQUAL")},{prefix:'<span class="smart-icon smart-icon-less-than"></span>',value:"LESS_THAN",label:t.localize("LESS_THAN")},{prefix:'<span class="smart-icon smart-icon-less-than-equal"></span>',value:"LESS_THAN_OR_EQUAL",label:t.localize("LESS_THAN_OR_EQUAL")},{prefix:'<span class="smart-icon smart-icon-greater-than"></span>',value:"GREATER_THAN",label:t.localize("GREATER_THAN")},{prefix:'<span class="smart-icon smart-icon-greater-than-equal"></span>',value:"GREATER_THAN_OR_EQUAL",label:t.localize("GREATER_THAN_OR_EQUAL")},{prefix:'<span class="smart-icon smart-icon-null"></span>',value:"NULL",label:t.localize("NULL")},{prefix:'<span class="smart-icon smart-icon-not-null"></span>',value:"NOT_NULL",label:t.localize("NOT_NULL")},{prefix:'<span class="smart-icon smart-icon-calendar"></span>',value:"TOMORROW",label:t.localize("TOMORROW")},{prefix:'<span class="smart-icon smart-icon-calendar"></span>',value:"TODAY",label:t.localize("TODAY")},{prefix:'<span class="smart-icon smart-icon-calendar"></span>',value:"YESTERDAY",label:t.localize("YESTERDAY")},{prefix:'<span class="smart-icon smart-icon-calendar"></span>',value:"NEXT_WEEK",label:t.localize("NEXT_WEEK")},{prefix:'<span class="smart-icon smart-icon-calendar"></span>',value:"THIS_WEEK",label:t.localize("THIS_WEEK")},{prefix:'<span class="smart-icon smart-icon-calendar"></span>',value:"LAST_WEEK",label:t.localize("LAST_WEEK")},{prefix:'<span class="smart-icon smart-icon-calendar"></span>',value:"NEXT_MONTH",label:t.localize("NEXT_MONTH")},{prefix:'<span class="smart-icon smart-icon-calendar"></span>',value:"THIS_MONTH",label:t.localize("THIS_MONTH")},{prefix:'<span class="smart-icon smart-icon-calendar"></span>',value:"LAST_MONTH",label:t.localize("LAST_MONTH")}],t._numberAndDateConditions=[{prefix:'<span class="smart-icon smart-icon-equal"></span>',value:"EQUAL",label:t.localize("EQUAL")},{prefix:'<span class="smart-icon smart-icon-not-equal"></span>',value:"NOT_EQUAL",label:t.localize("NOT_EQUAL")},{prefix:'<span class="smart-icon smart-icon-less-than"></span>',value:"LESS_THAN",label:t.localize("LESS_THAN")},{prefix:'<span class="smart-icon smart-icon-less-than-equal"></span>',value:"LESS_THAN_OR_EQUAL",label:t.localize("LESS_THAN_OR_EQUAL")},{prefix:'<span class="smart-icon smart-icon-greater-than"></span>',value:"GREATER_THAN",label:t.localize("GREATER_THAN")},{prefix:'<span class="smart-icon smart-icon-greater-than-equal"></span>',value:"GREATER_THAN_OR_EQUAL",label:t.localize("GREATER_THAN_OR_EQUAL")},{prefix:'<span class="smart-icon smart-icon-null"></span>',value:"NULL",label:t.localize("NULL")},{prefix:'<span class="smart-icon smart-icon-not-null"></span>',value:"NOT_NULL",label:t.localize("NOT_NULL")}],t._booleanConditions=[{prefix:'<span class="smart-icon smart-icon-equal"></span>',value:"EQUAL",label:t.localize("EQUAL")},{prefix:'<span class="smart-icon smart-icon-not-equal"></span>',value:"NOT_EQUAL",label:t.localize("NOT_EQUAL")},{prefix:'<span class="smart-icon smart-icon-null"></span>',value:"NULL",label:t.localize("NULL")},{prefix:'<span class="smart-icon smart-icon-not-null"></span>',value:"NOT_NULL",label:t.localize("NOT_NULL")}],e&&t._items.forEach(((e,a)=>{const l=e.children[1],n=e.children[3];0===a?l.innerHTML="":1===a?(l.dataSource=[{value:"and",label:t.localize("and")},{value:"or",label:t.localize("or")}],l.value=t.localize(t.operator)):l.innerHTML=t.localize(t.operator),"string"!==e.dataType||e.options?"enum"===e.dataType||e.options?n.dataSource=t._enumConditions:"boolean"===e.dataType?n.dataSource=t._booleanConditions:"date"===e.dataType?n.dataSource=t._dateConditions:n.dataSource=t._numberAndDateConditions:n.dataSource=t._stringConditions,n.value=n.condition?t.localize(n.condition):""}))}_setFocusable(e){const t=this,a=t.disabled||t.unfocusable?-1:0;if(t.$.addFilterButton.tabIndex=a,t.$.buttonsContainer.firstElementChild.tabIndex=a,t.$.buttonsContainer.children[1].tabIndex=a,e){const e=Array.from(t.$.itemsContainer.getElementsByClassName("smart-grid-panel-item-close-button")),l=Array.from(t.$.itemsContainer.querySelectorAll("smart-date-time-picker, smart-numeric-text-box, smart-check-box, smart-input"));e.forEach((e=>e.tabIndex=a)),l.forEach((e=>e.unfocusable=t.disabled||t.unfocusable))}}});
1554
+ Smart("smart-grid-panel",class extends Smart.BaseElement{static get properties(){return{closeButtonPosition:{value:"left",allowedValues:["left","right"],type:"string"},dataSource:{value:[],type:"array",reflectToAttribute:!1},messages:{value:{en:{apply:"Ok",booleanFirst:"☐",booleanLast:"☑",cancel:"Cancel",dateFirst:"1",dateLast:"9",from:"from",numberFirst:"1",numberLast:"9",stringFirst:"A",stringLast:"Z",thenBy:"then by"}},type:"object",extend:!0}}}static get listeners(){return{change:"_changeHandler",click:"_clickHandler",keydown:"_keydownHandler","sortable.dragEnd":"_sortableDragEndHandler"}}static get requires(){return{"Smart.Input":"smart.input.js","Smart.Sortable":"smart.sortable.js"}}static get styleUrls(){return["smart.gridpanel.css"]}template(){return'<div id="container" role="presentation">\n <smart-sortable id="sortable" disable-mode="manual" animation="[[animation]]" disabled="[[readonly]]" right-to-left="[[rightToLeft]]"\n drag-mode="handle" handle-position="right" handle-visibility="visible" theme="[[theme]]">\n </smart-sortable>\n <div id="footer" class="smart-grid-panel-container-footer" role="presentation">\n <smart-input id="inputNotSorted" right-to-left="[[rightToLeft]]" animation="[[animation]]" readonly theme="[[theme]]"></smart-input>\n <div id="buttonsContainer" class="smart-grid-panel-buttons-container smart-unselectable" role="presentation">\n <span class="smart-grid-panel-cancel-button" role="button"></span>\n <span class="smart-grid-panel-apply-button primary" role="button"></span>\n </div>\n </div>\n </div>'}ready(){super.ready()}render(){const e=this;e.setAttribute("role","dialog"),"right"===e.closeButtonPosition&&(e.$.sortable.handlePosition="left"),e._localize(),e._createSources(),super.render()}propertyChangedHandler(e,t,a){super.propertyChangedHandler(e,t,a);const l=this;switch(e){case"animation":case"theme":Array.from(l.$.sortable.getElementsByTagName("smart-input")).forEach((t=>t[e]=a));break;case"disabled":case"unfocusable":l._setFocusable();break;case"closeButtonPosition":"right"===l.closeButtonPosition?l.$.sortable.handlePosition="left":l.$.sortable.handlePosition="right";break;case"dataSource":l.$.sortable.$.container.innerHTML="",l._createSources();break;case"locale":case"messages":{const e=l.$.sortable._items;l._localize(),e.length&&(e[0].children[1].innerHTML=l.localize("firstBy"),e.forEach((function(e,t){0!==t&&(e.children[1].innerHTML=l.localize("thenBy"));const a=l._HTMLToSourceMap.get(e),n=l._ascDescTemplates[a.dataType]||l._ascDescTemplates.string;e.children[3].innerHTML=l.localize("from"),e.children[4].firstElementChild.innerHTML=n[0],e.children[4].children[1].innerHTML=n[1]})));break}case"maxLevel":if(null!=a)for(;l.$.sortable._items.length>0&&l.$.sortable._items.length>a;)l._interactionHandler(l.$.sortable._items[l.$.sortable._items.length-1].firstElementChild);l._disableItemAddition();break;case"rightToLeft":l.$.inputNotSorted.rightToLeft=a,l.$.inputNotSorted.dropDownButtonPosition=a?"left":"right",l.$.sortable._items.forEach((e=>{const t=e.querySelector("smart-input");t.rightToLeft=a,t.dropDownButtonPosition=a?"left":"right"}))}}_changeHandler(e){const t=this,a=t.shadowRoot||t.isInShadowDOM?e.composedPath()[0]:e.target;if(t.$.inputNotSorted.contains(a)){const e=t.$.inputNotSorted.value,a=t._labelToSourceMap.get(e);return t._createSortItem(a,t.$.sortable._items.length),t.$.sortable.updateItems(),t._visibleLabels.push(e),t._updateHiddenSource(),t._disableItemAddition(),void(t.$.inputNotSorted.value="")}const l=a.closest("smart-input");if(!l)return;const n=l.parentElement.parentElement,i=n.children[4].firstElementChild,o=n.children[4].children[1],r=l.value,s=t._HTMLToSourceMap.get(n).label,d=t._labelToSourceMap.get(r),c=t._ascDescTemplates[d.dataType]||t._ascDescTemplates.string;t._HTMLToSourceMap.set(n,d),t._visibleLabels.splice(t._visibleLabels.indexOf(s),1,r),t._updateHiddenSource(),i.innerHTML=c[0],o.innerHTML=c[1],d.sortDirection&&-1===d.sortDirection.indexOf("asc")?(o.classList.add("selected"),i.classList.remove("selected")):(i.classList.add("selected"),o.classList.remove("selected"))}_updateHiddenSource(){const e=this;e._hiddenSource=e.dataSource.map((e=>({label:e.label,value:e.dataField,icon:e.icon}))).filter((t=>-1===e._visibleLabels.indexOf(t.label)));const t=e.$.inputNotSorted.context;e.$.inputNotSorted.context=e.$.inputNotSorted,e.$.inputNotSorted.dataSource=e._hiddenSource,e.$.sortable._items.forEach((t=>{const a=t.getElementsByTagName("smart-input")[0],l=a.context;a.context=a,a.dataSource=e._hiddenSource,a.context=l})),e.$.inputNotSorted.context=t,e._disableItemAddition(),e.$.fireEvent("dataSourceChange")}_clickHandler(e){const t=this;t._interactionHandler(t.shadowRoot||t.isInShadowDOM?e.composedPath()[0]:e.target,e)}_interactionHandler(e,t){const a=this;if(a.disabled||a.readonly)return!0;const l=e.closest(".smart-grid-panel-item");if(l){if(e===l.firstElementChild){const e=a._HTMLToSourceMap.get(l).label;a.$.sortable.$.container.removeChild(l),a.$.sortable.updateItems(),a._visibleLabels.splice(a._visibleLabels.indexOf(e),1),a._updateHiddenSource(),a._disableItemAddition(),a.$.sortable._items.length&&(a.$.sortable._items[0].children[1].innerHTML=a.localize("firstBy")),a.$.fireEvent("remove")}else if(l.children[4].contains(e)){const n=l.children[4].firstElementChild,i=l.children[4].children[1];"click"===t.type?e.classList.contains("selected")||(e===n?(i.classList.remove("selected"),n.classList.add("selected"),a._HTMLToSourceMap.get(l).sortDirection="ascending"):e===i&&(n.classList.remove("selected"),i.classList.add("selected"),a._HTMLToSourceMap.get(l).sortDirection="descending")):(n.classList.toggle("selected"),i.classList.toggle("selected"),a._HTMLToSourceMap.get(l).sortDirection=n.classList.contains("selected")?"ascending":"descending")}return!0}if(e===a.$.buttonsContainer.firstElementChild)return a.$.fireEvent("cancel"),!0;if(e===a.$.buttonsContainer.children[1]){const e=[],t={dataFields:[],dataTypes:[],orderBy:[]},l={value:e};return a.$.sortable._items.forEach((l=>{const n=a._HTMLToSourceMap.get(l);e.push({dataField:n.dataField,sortDirection:n.sortDirection}),t.dataFields.push(n.dataField),t.dataTypes.push(n.dataType),t.orderBy.push(n.sortDirection)})),a instanceof Smart.SortPanel&&a.$.maintainSortContainer&&(t.maintainSort=a.$.maintainSortContainer.firstElementChild.hasAttribute("active")),(a instanceof Smart.SortPanel||a instanceof Smart.GroupPanel)&&(l.sortByInfo=t),a.$.fireEvent("apply",l),!0}}_keydownHandler(e){const t=this,a=e.key;" "!==a&&"Enter"!==a||(e.preventDefault(),t._interactionHandler((t.shadowRoot||t.getRootNode()).activeElement,e))}_sortableDragEndHandler(e){const t=this,a=e.detail.oldIndex,l=e.detail.newIndex,n=Math.max(a,l),i=t.$.sortable._items;0===(a&&l)&&(i[0].children[1].innerHTML=t.localize("firstBy"),i[1].children[1].innerHTML=t.localize("thenBy"),n>1&&(i[n].children[1].innerHTML=t.localize("thenBy")))}_localize(){const e=this;e.$.inputNotSorted.placeholder=e.localize("pickAnother"),e.$.buttonsContainer.firstElementChild.innerHTML=e.localize("cancel"),e.$.buttonsContainer.children[1].innerHTML=e.localize("apply"),e._ascDescTemplates={boolean:[e.localize("booleanFirst")+" → "+e.localize("booleanLast"),e.localize("booleanLast")+" → "+e.localize("booleanFirst")],date:[e.localize("dateFirst")+" → "+e.localize("dateLast"),e.localize("dateLast")+" → "+e.localize("dateFirst")],number:[e.localize("numberFirst")+" → "+e.localize("numberLast"),e.localize("numberLast")+" → "+e.localize("numberFirst")],string:[e.localize("stringFirst")+" → "+e.localize("stringLast"),e.localize("stringLast")+" → "+e.localize("stringFirst")]}}_createSources(){const e=this,t=(e instanceof Smart.SortPanel?"sort":"group")+"Index",a=[],l=[];if(e._HTMLToSourceMap=new Map,e._labelToSourceMap=new Map,e.dataSource.forEach((l=>{e._labelToSourceMap.set(l.label,l),-1!==l[t]&&void 0!==l[t]&&a.push(l)})),a.sort(((e,a)=>e[t]-a[t])),void 0!==e.maxLevel&&null!==e.maxLevel)for(;a.length>0&&a.length>e.maxLevel;)a.pop();e.$.inputNotSorted.dropDownButtonPosition=e.rightToLeft?"left":"right",e.$.inputNotSorted.dataSource&&e.$.inputNotSorted.dataSource.length<10&&e.$.inputNotSorted.dataSource.length>0?e.$.inputNotSorted.dropDownHeight="auto":e.$.inputNotSorted.dropDownHeight=250,a.forEach((e=>l.push(e.label))),e._visibleLabels=l,e._updateHiddenSource(),a.forEach(((t,a)=>{e._createSortItem(t,a)})),e.$.sortable.updateItems(),e._disableItemAddition(),e._setFocusable()}_createSortItem(e,t){const a=this,l=a.disabled||a.unfocusable?-1:0,n=document.createElement("div"),i=a._ascDescTemplates[e.dataType]||a._ascDescTemplates.string;n.className="smart-grid-panel-item",n.innerHTML=`<div class="smart-grid-panel-item-close-button" tabindex="${l}" role="button" aria-label="Close"></div>\n<div class="smart-grid-panel-label-by smart-unselectable" role="presentation">${a.localize(t>0?"thenBy":"firstBy")}</div>\n<div class="smart-grid-panel-field-container" role="presentation"><smart-input class="smart-grid-panel-field-selection" value="${e.label}" animation="${a.animation}" readonly theme="${a.theme}" aria-label="Field name"></smart-input></div>\n<div class="smart-grid-panel-from smart-unselectable" role="presentation">${a.localize("from")}</div >\n<div class="smart-grid-panel-direction smart-unselectable" tabindex="${l}" role="presentation">\n <div class="smart-grid-panel-asc" role="button" aria-label="Ascending">${i[0]}</div >\n <div class="smart-grid-panel-desc" role="button" aria-label="Descending">${i[1]}</div>\n</div>\n`;const o=n.querySelector("smart-input");o.dataSource=a._hiddenSource,o.rightToLeft=a.rightToLeft,o.dropDownButtonPosition=a.rightToLeft?"left":"right",o.dataSource&&o.dataSource.length<10?o.dropDownHeight="auto":o.dropDownHeight=250,a.$.sortable.$.container.appendChild(n),o.tabIndex=l,e.sortDirection&&-1===e.sortDirection.indexOf("asc")?n.children[4].children[1].classList.add("selected"):(e.sortDirection="ascending",n.children[4].firstElementChild.classList.add("selected")),a._HTMLToSourceMap.set(n,e)}_disableItemAddition(){const e=this,t=e.maxLevel,a=0===e._hiddenSource.length||null!=t&&Math.max(0,t)===e.$.sortable._items.length;e.$.inputNotSorted.disabled=a,a&&e.$.inputNotSorted.removeAttribute("focus")}_setFocusable(){const e=this,t=e.disabled||e.unfocusable?-1:0,a=Array.from(e.getElementsByClassName("smart-grid-panel-item-close-button")),l=Array.from(e.getElementsByClassName("smart-grid-panel-direction")),n=Array.from(e.getElementsByTagName("input")),i=a.concat(l).concat(n);e.$.buttonsContainer.firstElementChild.tabIndex=t,e.$.buttonsContainer.children[1].tabIndex=t,i.forEach((e=>e.tabIndex=t))}}),Smart("smart-sort-panel",class extends Smart.GridPanel{static get properties(){return{messages:{value:{en:{firstBy:"Sort by",noSorting:"No sorting applied",pickAnother:"Pick another field to sort by",maintainSort:"Maintain Sort",applyOnce:"Apply once"}},type:"object",extend:!0}}}template(){return'<div id="container" role="presentation">\n <smart-sortable disable-mode="manual" right-to-left="[[rightToLeft]]" id="sortable" animation="[[animation]]" disabled="[[readonly]]" drag-mode="handle" handle-position="right" handle-visibility="visible" theme="[[theme]]"></smart-sortable>\n <div id="footer" class="smart-grid-panel-container-footer" role="presentation">\n <div>\n <smart-input right-to-left="[[rightToLeft]]" id="inputNotSorted" animation="[[animation]]" readonly theme="[[theme]]"></smart-input>\n <div id="maintainSortContainer" class="smart-hidden smart-grid-panel-buttons-container smart-grid-panel-maintain-sort smart-unselectable" role="presentation">\n <span class="smart-grid-panel-maintain-sort-button" role="button"></span>\n </div>\n \n </div>\n <div id="buttonsContainer" class="smart-grid-panel-buttons-container smart-unselectable" role="presentation">\n <span class="smart-grid-panel-cancel-button" role="button"></span>\n <span class="smart-grid-panel-apply-button primary" role="button"></span>\n </div>\n </div>\n </div>'}_changeApplyButtonText(e){const t=this,a=t.$.maintainSortContainer.firstElementChild,l=t.querySelector(".smart-grid-panel-apply-button");e?a.hasAttribute("active")?(a.removeAttribute("active"),l&&(l.innerHTML=t.localize("applyOnce"))):(a.setAttribute("active",""),l&&(l.innerHTML=t.localize("apply"))):a.hasAttribute("active")?l.innerHTML=t.localize("apply"):l.innerHTML=t.localize("applyOnce")}_interactionHandler(e,t){const a=this;super._interactionHandler(e,t)||e===a.$.maintainSortContainer.firstElementChild&&a._changeApplyButtonText(!0)}static get styleUrls(){return["smart.textbox.css"]}_localize(){super._localize();const e=this;e.$.sortable.$.container.setAttribute("no-sorting",e.localize("noSorting")),e.$.maintainSortContainer.firstElementChild.innerHTML=e.localize("maintainSort"),e._changeApplyButtonText()}}),Smart("smart-group-panel",class extends Smart.GridPanel{static get properties(){return{maxLevel:{value:8,type:"number?"},messages:{value:{en:{collapseAll:"Collapse all",expandAll:"Expand all",firstBy:"Group by",noGrouping:"No grouping",pickAnother:"Pick another field to group by"}},type:"object",extend:!0}}}template(){return'<div id="container" role="presentation">\n <smart-sortable disable-mode="manual" right-to-left="[[rightToLeft]]" id="sortable" animation="[[animation]]" disabled="[[readonly]]" drag-mode="handle" handle-position="right" handle-visibility="visible" theme="[[theme]]"></smart-sortable>\n <div id="expandCollapseContainer" class="smart-grid-panel-buttons-container smart-grid-panel-expand-collapse smart-unselectable" role="presentation">\n <span class="smart-group-panel-collapse-button" role="button"></span>\n <span class="smart-group-panel-expand-button" role="button"></span>\n </div>\n <div id="footer" class="smart-grid-panel-container-footer" role="presentation">\n <smart-input right-to-left="[[rightToLeft]]" id="inputNotSorted" animation="[[animation]]" readonly theme="[[theme]]"></smart-input>\n <div id="buttonsContainer" class="smart-grid-panel-buttons-container smart-unselectable" role="presentation">\n <span class="smart-grid-panel-cancel-button" role="button"></span>\n <span class="smart-grid-panel-apply-button primary" role="button"></span>\n </div>\n </div>\n </div>'}_interactionHandler(e,t){const a=this;super._interactionHandler(e,t)||(e===a.$.expandCollapseContainer.firstElementChild?a.$.fireEvent("collapseAll"):e===a.$.expandCollapseContainer.children[1]&&a.$.fireEvent("expandAll"))}_localize(){super._localize();const e=this;e.$.expandCollapseContainer.firstElementChild.innerHTML=e.localize("collapseAll"),e.$.expandCollapseContainer.children[1].innerHTML=e.localize("expandAll"),e.$.sortable.$.container.setAttribute("no-grouping",e.localize("noGrouping"))}_setFocusable(){super._setFocusable();const e=this,t=e.disabled||e.unfocusable?-1:0;e.$.expandCollapseContainer.firstElementChild.tabIndex=t,e.$.expandCollapseContainer.children[1].tabIndex=t}}),Smart("smart-multi-column-filter-panel",class extends Smart.BaseElement{static get properties(){return{closeButtonPosition:{value:"left",allowedValues:["left","right"],type:"string"},dataSource:{value:[],type:"array",reflectToAttribute:!1},editorCallback:{value:null,type:"function?",reflectToAttribute:!1},editorPlaceholder:{value:"Value",type:"string"},messages:{value:{en:{addFilter:"+ Add filter",and:"And",apply:"Ok",cancel:"Cancel",CONTAINS:"contains",CONTAINS_CASE_SENSITIVE:"contains (case sensitive)",DOES_NOT_CONTAIN:"does not contain",DOES_NOT_CONTAIN_CASE_SENSITIVE:"does not contain (case sensitive)",EMPTY:"empty",ENDS_WITH:"ends with",ENDS_WITH_CASE_SENSITIVE:"ends with (case sensitive)",EQUAL:"equal",EQUAL_CASE_SENSITIVE:"equal (case sensitive)",GREATER_THAN:"greater than",GREATER_THAN_OR_EQUAL:"greater than or equal",LESS_THAN:"less than",LESS_THAN_OR_EQUAL:"less than or equal",noFilters:"No filters applied",NOT_EMPTY:"not empty",NOT_EQUAL:"not equal",NOT_NULL:"not null",NULL:"null",or:"Or",STARTS_WITH:"starts with",STARTS_WITH_CASE_SENSITIVE:"starts with (case sensitive)",where:"Where",TOMORROW:"Tomorrow",TODAY:"Today",YESTERDAY:"Yesterday",NEXT_WEEK:"Next week",THIS_WEEK:"This week",LAST_WEEK:"Last week",NEXT_MONTH:"Next month",THIS_MONTH:"This month",LAST_MONTH:"Last month"}},type:"object",extend:!0},operator:{value:"and",allowedValues:["and","or"],type:"string"},value:{value:[],type:"array"}}}static get listeners(){return{change:"_changeHandler",click:"_interactionHandler",keydown:"_interactionHandler"}}static get requires(){return{"Smart.Button":"smart.button.js","Smart.CheckBox":"smart.checkbox.js","Smart.DateTimePicker":"smart.datetimepicker.js","Smart.FilterGroup":"smart.filter.js","Smart.Input":"smart.input.js","Smart.NumericTextBox":"smart.numerictextbox.js"}}static get styleUrls(){return["smart.gridpanel.css"]}template(){return'<div id="container" role="presentation">\n <div id="itemsContainer" class="smart-filter-panel-items-container smart-unselectable"></div>\n <div id="footer" class="smart-grid-panel-container-footer" role="presentation">\n <div id="addFilterButton" class="smart-filter-panel-add-filter-button smart-unselectable" role="button"></div>\n <div id="buttonsContainer" class="smart-grid-panel-buttons-container smart-unselectable" role="presentation">\n <span class="smart-grid-panel-cancel-button" role="button"></span>\n <span class="smart-grid-panel-apply-button primary" role="button"></span>\n </div>\n </div>\n </div>'}ready(){super.ready()}render(){const e=this;e.setAttribute("role","dialog"),e._setFocusable(),e._localize(),e._applyValue(),super.render()}propertyChangedHandler(e,t,a){super.propertyChangedHandler(e,t,a);const l=this;switch(e){case"animation":case"theme":case"rightToLeft":Array.from(l.$.itemsContainer.querySelectorAll("smart-date-time-picker, smart-numeric-text-box, smart-check-box, smart-input")).forEach((t=>{t[e]=a,"smart-input"===t.tagName.toLowerCase()&&"rightToLeft"===e&&"none"!==t.dropDownButtonPosition&&(t.dropDownButtonPosition=a?"left":"right")}));break;case"disabled":case"unfocusable":l._setFocusable(!0);break;case"dataSource":case"value":l._applyValue();break;case"editorPlaceholder":Array.from(l.$.itemsContainer.getElementsByClassName("editor")).forEach((e=>e.placeholder=a));break;case"locale":case"messages":l._localize(!0);break;case"operator":l._setOperator()}}_setOperator(){const e=this,t=e.localize(e.operator);for(let a=2;a<e._items.length;a++)e._items[a].children[1].innerHTML=t}_changeHandler(e){const t=this,a=t.shadowRoot||t.isInShadowDOM?e.composedPath()[0]:e.target;if(a instanceof Smart.Input==0)return;const l=a.parentElement,n=l.children;if(a===n[1])t.operator=a.$.input.dataValue,t._setOperator();else if(a===n[2]){let a,i,o=t.dataSource.find((t=>t.dataField===e.detail.oldValue)).dataType,r=t.dataSource.find((t=>t.dataField===e.detail.oldValue)),s=t.dataSource.find((t=>t.dataField===e.detail.value)),d=s.dataType,c=[];if(s.options&&(d="enum",c=s.options.map((e=>{const t=e.color||"var(--smart-primary)";return e.prefix='<span style="background: '+t+'; width: 14px; height: 14px; display: inline-block; border-radius: 50%; margin-left:-4px; margin-right: 8px; top: 2px; position: relative;"></span>',""===e.label&&(e.label=" "),e}))),r&&r.options&&(o="enum"),"enum"!==d&&d===o)return void(t.editorCallback&&t.editorCallback(n[4],s));let p=n[3].value;switch(d){case"date":a=t._dateConditions,i=document.createElement("smart-date-time-picker"),i.calendarButton=!0,i.dropDownAppendTo="body",i.dropDownDisplayMode="auto",i.formatString="M/d/yy H:mm",p="";break;case"number":a=t._numberAndDateConditions,i=document.createElement("smart-numeric-text-box"),p="";break;case"boolean":a=t._booleanConditions,i=document.createElement("smart-check-box"),p="";break;case"enum":a=t._enumConditions,i=document.createElement("smart-input"),i.dataSource=c.length?c:s.options,i.readonly=!0,i.dropDownButtonPosition="right",p=a[0];break;default:a=t._stringConditions,p=t._stringConditions.find((e=>"CONTAINS"===e.value)),i=document.createElement("smart-input")}a.forEach((e=>{delete e.selected})),i.rightToLeft=t.rightToLeft,i.animation=t.animation,i.theme=t.theme,i.unfocusable=t.disabled||t.unfocusable,i.classList.add("underlined"),i.dataSource&&i.dataSource.length<10?i.dropDownHeight="auto":i.dropDownHeight=250,"boolean"!==d&&(i.placeholder=t.editorPlaceholder),t.editorCallback&&t.editorCallback(i,s),n[4]&&n[4].remove(),l.appendChild(i),""===p||a.find((e=>e.label===p))||(p.value?(n[3].value=p.label,n[3].selectedValue=p.value):(n[3].value="",n[3].selectedValue="")),n[3].dataSource=a,""===p&&(n[3].value=a[0].label,n[3].selectedValue=a[0].value),a.length>=10?n[3].dropDownHeight=250:n[3].dropDownHeight="auto",l.dataType=d}else if(a===n[3]){const e=n[4],t=a.$.input.dataValue;-1!==t.indexOf("NULL")||-1!==t.indexOf("EMPTY")||-1!==t.indexOf("THIS_WEEK")||-1!==t.indexOf("LAST_WEEK")||-1!==t.indexOf("NEXT_WEEK")||-1!==t.indexOf("THIS_MONTH")||-1!==t.indexOf("LAST_MONTH")||-1!==t.indexOf("NEXT_MONTH")||-1!==t.indexOf("THIS_YEAR")||-1!==t.indexOf("LAST_YEAR")||-1!==t.indexOf("NEXT_YEAR")||-1!==t.indexOf("TODAY")||-1!==t.indexOf("TOMORROW")||-1!==t.indexOf("YESTERDAY")?(e.value="",e.checked=!1,e.classList.add("smart-visibility-hidden")):e.classList.remove("smart-visibility-hidden"),a.condition=t}}_interactionHandler(e){const t=this;if(t.disabled||t.readonly)return;if("keydown"===e.type){if("Enter"!==e.key)return;e.preventDefault()}const a=t.shadowRoot||t.isInShadowDOM?e.composedPath()[0]:e.target,l=a.closest(".smart-grid-panel-item");if(l){if(a===l.firstElementChild){const e=t._items.indexOf(l);let a;t._items.splice(e,1),l.remove(),t._items.length>0&&e<2&&(0===e&&(t._items[0].children[1].remove(),a=document.createElement("div"),a.innerHTML=t.localize("where"),t._items[0].insertBefore(a,t._items[0].children[1])),t._items.length>1&&(t._items[1].children[1].remove(),a=document.createElement("smart-input"),a.className="underlined",a.dataSource=[{value:"and",label:t.localize("and")},{value:"or",label:t.localize("or")}],a.dropDownButtonPosition=t.rightToLeft?"left":"right",a.readonly=!0,a.value=t.localize(t.operator),a.animation=t.animation,a.theme=t.theme,a.rightToLeft=t.rightToLeft,a.unfocusable=t.disabled||t.unfocusable,t._items[1].insertBefore(a,t._items[1].children[1])))}}else if(a===t.$.addFilterButton&&t.dataSource.length>0)t.$.itemsContainer.appendChild(t._createItem(t.dataSource[0],"","",t._items.length));else if(a!==t.$.buttonsContainer.firstElementChild){if(a===t.$.buttonsContainer.children[1]){let e=t._stringConditions.concat(t._dateConditions),a=t.operator,l=[],n={},i=[];t._customConditions&&(e=e.concat(t._customConditions)),t._items.forEach((i=>{const o=t.dataSource.find((e=>e.label===i.children[2].value)),r=[];let s=i.children[3].value;if(""===s)return;let d=o.dataType;if(s=e.find((e=>e.label===s)).value,r.push(o.dataField,s),-1===s.indexOf("NULL")&&-1===s.indexOf("EMPTY"))if("boolean"===d)r.push(i.children[4].checked);else if("date"===d)r.push(i.children[4].value.toDate());else if("enum"===d||o.options){let e=i.children[4].$.input.dataValue;if(void 0===e){const t=o.options.find((e=>e.label===i.children[4].value));if(!t)return;e=t.value}d="string",r.push(e)}else r.push(i.children[4].value);let c=n[r[0]];void 0===c&&(c=new Smart.Utilities.FilterGroup,n[r[0]]=c);const p=c.createFilter(d,r[2],r[1]);c.addFilter(a,p),l.push(r)}));for(let e in n)i.push([e,n[e]]);t.value=l,t.$.fireEvent("apply",{filters:i,operator:a,value:l})}}else t.$.fireEvent("cancel")}_applyValue(){const e=this,t=document.createDocumentFragment();let a=0;for(e._items=[];e.$.itemsContainer.firstElementChild;)e.$.itemsContainer.firstElementChild.remove();0!==e.dataSource.length&&(e.value.forEach((l=>{if(!Array.isArray(l))return;const n=l[0],i=e.dataSource.find((e=>e.dataField===n));if(!i)return;const o=e._createItem(i,l[1],l[2],a);t.appendChild(o),a++})),e.$.itemsContainer.appendChild(t))}_createItem(e,t,a,l){const n=this,i=n.disabled||n.unfocusable?-1:0,o=document.createElement("div"),r=document.createDocumentFragment(),s=document.createElement("div"),d=document.createElement("smart-input"),c=document.createElement("smart-input");let p,u;if(s.className="smart-grid-panel-item-close-button",s.tabIndex=i,s.setAttribute("role","button"),s.setAttribute("aria-label","button"),r.appendChild(s),0===l?(p=document.createElement("div"),p.innerHTML=n.localize("where"),p.setAttribute("role","presentation")):1===l?(p=document.createElement("smart-input"),p.className="underlined",p.dataSource=[{value:"and",label:n.localize("and")},{value:"or",label:n.localize("or")}],p.dropDownButtonPosition=n.rightToLeft?"left":"right",p.readonly=!0,p.value=n.localize(n.operator),p.animation=n.animation,p.theme=n.theme,p.rightToLeft=n.rightToLeft,p.unfocusable=n.disabled||n.unfocusable,p.setAttribute("aria-label","Operator")):(p=document.createElement("div"),p.innerHTML=n.localize(n.operator),p.setAttribute("role","presentation")),r.appendChild(p),d.className="underlined",d.dataSource=n.dataSource.map((e=>({value:e.dataField,label:e.label,icon:e.icon}))),d.dropDownButtonPosition=n.rightToLeft?"left":"right",d.readonly=!0,d.value=e.label,d.animation=n.animation,d.theme=n.theme,d.rightToLeft=n.rightToLeft,d.unfocusable=n.disabled||n.unfocusable,d.setAttribute("aria-label","Field"),d.dataSource&&d.dataSource.length<10?d.dropDownHeight="auto":d.dropDownHeight=250,r.appendChild(d),"boolean"===e.dataType)c.dataSource=JSON.parse(JSON.stringify(n._booleanConditions)),u=document.createElement("smart-check-box"),u.checked="boolean"==typeof a&&a;else if("date"===e.dataType)c.dataSource=n._dateConditions,u=document.createElement("smart-date-time-picker"),u.dropDownDisplayMode="auto",u.calendarButton=!0,u.dropDownAppendTo="body",u.formatString="M/d/yy H:mm",u.value=a;else if("number"===e.dataType)c.dataSource=JSON.parse(JSON.stringify(n._numberAndDateConditions)),u=document.createElement("smart-numeric-text-box"),u.value="number"==typeof a||"string"==typeof a?a:0;else if("enum"===e.dataType||e.options){c.dataSource=JSON.parse(JSON.stringify(n._enumConditions)),u=document.createElement("smart-input");let t=[];e.options&&(t=e.options.map((e=>{const t=e.color||"var(--smart-primary)";return e.prefix='<span style="background: '+t+'; width: 14px; height: 14px; display: inline-block; border-radius: 50%; margin-left:-4px; margin-right: 8px; top: 2px; position: relative;"></span>',""===e.label&&(e.label=" "),e}))),u.dataSource=t.length?t:e.options,u.readonly=!0,u.dropDownButtonPosition="right";const l=a?e.options.find((e=>e.value===a)):null;u.value=l&&a?l.label:""}else c.dataSource=JSON.parse(JSON.stringify(n._stringConditions)),u=document.createElement("smart-input"),u.value=null!=a?a.toString():"",t||(t="CONTAINS");return c.className="underlined",c.dropDownButtonPosition=n.rightToLeft?"left":"right",c.readonly=!0,c.animation=n.animation,c.theme=n.theme,c.rightToLeft=n.rightToLeft,c.unfocusable=n.disabled||n.unfocusable,c.setAttribute("aria-label","Condition"),c.classList.add("smart-filter-panel-list"),c.dataSource.forEach((e=>{delete e.selected})),c.dataSource.find((e=>e.value===t))?(c.value=n.localize(t),c.selectedValue=t,c.condition=t):(u.value="",u.checked=!1),(void 0===t||-1===t.indexOf("NULL")&&-1===t.indexOf("EMPTY"))&&-1===t.indexOf("THIS_WEEK")&&-1===t.indexOf("LAST_WEEK")&&-1===t.indexOf("NEXT_WEEK")&&-1===t.indexOf("THIS_MONTH")&&-1===t.indexOf("LAST_MONTH")&&-1===t.indexOf("NEXT_MONTH")&&-1===t.indexOf("THIS_YEAR")&&-1===t.indexOf("LAST_YEAR")&&-1===t.indexOf("NEXT_YEAR")&&-1===t.indexOf("TODAY")&&-1===t.indexOf("TOMORROW")&&-1===t.indexOf("YESTERDAY")||(u.value="",u.checked=!1,u.classList.add("smart-visibility-hidden")),c.dataSource&&c.dataSource.length<10?c.dropDownHeight="auto":c.dropDownHeight=250,u.animation=n.animation,u.classList.add("editor"),u.rightToLeft=n.rightToLeft,u.theme=n.theme,u.unfocusable=n.disabled||n.unfocusable,u.classList.add("underlined"),"boolean"!==e.dataType&&(u.placeholder=n.editorPlaceholder),n.editorCallback&&n.editorCallback(u,e),r.appendChild(c),r.appendChild(u),o.appendChild(r),o.className="smart-grid-panel-item",n._items.push(o),o.dataType=e.dataType,o}_localize(e){const t=this;t.$.addFilterButton.innerHTML=t.localize("addFilter"),t.$.buttonsContainer.firstElementChild.innerHTML=t.localize("cancel"),t.$.buttonsContainer.children[1].innerHTML=t.localize("apply"),t.$.itemsContainer.setAttribute("no-filters",t.localize("noFilters")),t._stringConditions=[{prefix:'<span class="smart-icon smart-icon-empty"></span>',value:"EMPTY",label:t.localize("EMPTY")},{prefix:'<span class="smart-icon smart-icon-not-empty"></span>',value:"NOT_EMPTY",label:t.localize("NOT_EMPTY")},{prefix:'<span class="smart-icon smart-icon-contains"></span>',value:"CONTAINS",label:t.localize("CONTAINS")},{prefix:'<span class="smart-icon smart-icon-does-not-contain"></span>',value:"DOES_NOT_CONTAIN",label:t.localize("DOES_NOT_CONTAIN")},{prefix:'<span class="smart-icon smart-icon-starts-with"></span>',value:"STARTS_WITH",label:t.localize("STARTS_WITH")},{prefix:'<span class="smart-icon smart-icon-ends-with"></span>',value:"ENDS_WITH",label:t.localize("ENDS_WITH")},{prefix:'<span class="smart-icon smart-icon-equal"></span>',value:"EQUAL",label:t.localize("EQUAL")},{prefix:'<span class="smart-icon smart-icon-not-equal"></span>',value:"NOT_EQUAL",label:t.localize("NOT_EQUAL")},{prefix:'<span class="smart-icon smart-icon-null"></span>',value:"NULL",label:t.localize("NULL")},{prefix:'<span class="smart-icon smart-icon-not-null"></span>',value:"NOT_NULL",label:t.localize("NOT_NULL")}],t._enumConditions=[{prefix:'<span class="smart-icon smart-icon-equal"></span>',value:"EQUAL",label:t.localize("EQUAL")},{prefix:'<span class="smart-icon smart-icon-not-equal"></span>',value:"NOT_EQUAL",label:t.localize("NOT_EQUAL")}],t._dateConditions=[{prefix:'<span class="smart-icon smart-icon-equal"></span>',value:"EQUAL",label:t.localize("EQUAL")},{prefix:'<span class="smart-icon smart-icon-not-equal"></span>',value:"NOT_EQUAL",label:t.localize("NOT_EQUAL")},{prefix:'<span class="smart-icon smart-icon-less-than"></span>',value:"LESS_THAN",label:t.localize("LESS_THAN")},{prefix:'<span class="smart-icon smart-icon-less-than-equal"></span>',value:"LESS_THAN_OR_EQUAL",label:t.localize("LESS_THAN_OR_EQUAL")},{prefix:'<span class="smart-icon smart-icon-greater-than"></span>',value:"GREATER_THAN",label:t.localize("GREATER_THAN")},{prefix:'<span class="smart-icon smart-icon-greater-than-equal"></span>',value:"GREATER_THAN_OR_EQUAL",label:t.localize("GREATER_THAN_OR_EQUAL")},{prefix:'<span class="smart-icon smart-icon-null"></span>',value:"NULL",label:t.localize("NULL")},{prefix:'<span class="smart-icon smart-icon-not-null"></span>',value:"NOT_NULL",label:t.localize("NOT_NULL")},{prefix:'<span class="smart-icon smart-icon-calendar"></span>',value:"TOMORROW",label:t.localize("TOMORROW")},{prefix:'<span class="smart-icon smart-icon-calendar"></span>',value:"TODAY",label:t.localize("TODAY")},{prefix:'<span class="smart-icon smart-icon-calendar"></span>',value:"YESTERDAY",label:t.localize("YESTERDAY")},{prefix:'<span class="smart-icon smart-icon-calendar"></span>',value:"NEXT_WEEK",label:t.localize("NEXT_WEEK")},{prefix:'<span class="smart-icon smart-icon-calendar"></span>',value:"THIS_WEEK",label:t.localize("THIS_WEEK")},{prefix:'<span class="smart-icon smart-icon-calendar"></span>',value:"LAST_WEEK",label:t.localize("LAST_WEEK")},{prefix:'<span class="smart-icon smart-icon-calendar"></span>',value:"NEXT_MONTH",label:t.localize("NEXT_MONTH")},{prefix:'<span class="smart-icon smart-icon-calendar"></span>',value:"THIS_MONTH",label:t.localize("THIS_MONTH")},{prefix:'<span class="smart-icon smart-icon-calendar"></span>',value:"LAST_MONTH",label:t.localize("LAST_MONTH")}],t._numberAndDateConditions=[{prefix:'<span class="smart-icon smart-icon-equal"></span>',value:"EQUAL",label:t.localize("EQUAL")},{prefix:'<span class="smart-icon smart-icon-not-equal"></span>',value:"NOT_EQUAL",label:t.localize("NOT_EQUAL")},{prefix:'<span class="smart-icon smart-icon-less-than"></span>',value:"LESS_THAN",label:t.localize("LESS_THAN")},{prefix:'<span class="smart-icon smart-icon-less-than-equal"></span>',value:"LESS_THAN_OR_EQUAL",label:t.localize("LESS_THAN_OR_EQUAL")},{prefix:'<span class="smart-icon smart-icon-greater-than"></span>',value:"GREATER_THAN",label:t.localize("GREATER_THAN")},{prefix:'<span class="smart-icon smart-icon-greater-than-equal"></span>',value:"GREATER_THAN_OR_EQUAL",label:t.localize("GREATER_THAN_OR_EQUAL")},{prefix:'<span class="smart-icon smart-icon-null"></span>',value:"NULL",label:t.localize("NULL")},{prefix:'<span class="smart-icon smart-icon-not-null"></span>',value:"NOT_NULL",label:t.localize("NOT_NULL")}],t._booleanConditions=[{prefix:'<span class="smart-icon smart-icon-equal"></span>',value:"EQUAL",label:t.localize("EQUAL")},{prefix:'<span class="smart-icon smart-icon-not-equal"></span>',value:"NOT_EQUAL",label:t.localize("NOT_EQUAL")},{prefix:'<span class="smart-icon smart-icon-null"></span>',value:"NULL",label:t.localize("NULL")},{prefix:'<span class="smart-icon smart-icon-not-null"></span>',value:"NOT_NULL",label:t.localize("NOT_NULL")}],e&&t._items.forEach(((e,a)=>{const l=e.children[1],n=e.children[3];0===a?l.innerHTML=t.localize("where"):1===a?(l.dataSource=[{value:"and",label:t.localize("and")},{value:"or",label:t.localize("or")}],l.value=t.localize(t.operator)):l.innerHTML=t.localize(t.operator),"string"!==e.dataType||e.options?"enum"===e.dataType||e.options?n.dataSource=t._enumConditions:"boolean"===e.dataType?n.dataSource=t._booleanConditions:"date"===e.dataType?n.dataSource=t._dateConditions:n.dataSource=t._numberAndDateConditions:n.dataSource=t._stringConditions,n.value=n.condition?t.localize(n.condition):""}))}_setFocusable(e){const t=this,a=t.disabled||t.unfocusable?-1:0;if(t.$.addFilterButton.tabIndex=a,t.$.buttonsContainer.firstElementChild.tabIndex=a,t.$.buttonsContainer.children[1].tabIndex=a,e){const e=Array.from(t.$.itemsContainer.getElementsByClassName("smart-grid-panel-item-close-button")),l=Array.from(t.$.itemsContainer.querySelectorAll("smart-date-time-picker, smart-numeric-text-box, smart-check-box, smart-input"));e.forEach((e=>e.tabIndex=a)),l.forEach((e=>e.unfocusable=t.disabled||t.unfocusable))}}}),Smart("smart-column-panel",class extends Smart.BaseElement{static get properties(){return{dataSource:{value:[],type:"array",reflectToAttribute:!1},messages:{value:{en:{apply:"Ok",cancel:"Cancel",find:"Find a field",reset:"Reset",noResults:"No results"}},type:"object",extend:!0}}}static get listeners(){return{click:"_interactionHandler",keydown:"_interactionHandler","find.keyup":"_findKeyupHandler","sortable.dragEnd":"_sortableDragEndHandler"}}static get requires(){return{"Smart.Sortable":"smart.sortable.js"}}static get styleUrls(){return["smart.gridpanel.css"]}template(){return'<div id="container" role="presentation">\n <div class="smart-column-panel-find-container" role="search">\n <input id="find" readonly="[[readonly]]" role="searchbox" aria-label="Find a field"></input>\n <span id="clearButton" class="clear-button smart-hidden" role="button" aria-label="Clear"></span>\n </div>\n <smart-sortable id="sortable" disable-mode="manual" right-to-left="[[rightToLeft]]" animation="[[animation]]" disabled="[[readonly]]" drag-mode="handle" handle-position="right" handle-visibility="visible" theme="[[theme]]"></smart-sortable>\n <div id="footer" class="smart-grid-panel-container-footer" role="presentation">\n <span id="reset" class="smart-grid-panel-reset-button" role="button"></span>\n <div id="buttonsContainer" class="smart-grid-panel-buttons-container smart-unselectable" role="presentation">\n <span class="smart-grid-panel-cancel-button" role="button"></span>\n <span class="smart-grid-panel-apply-button primary" role="button"></span>\n </div>\n </div>\n </div>'}ready(){super.ready()}render(){const e=this;e.setAttribute("role","dialog"),e._positionChanged=!1,e._localize(),e._moves=[],e._createSortItems(),super.render()}propertyChangedHandler(e,t,a){super.propertyChangedHandler(e,t,a);const l=this;switch(e){case"disabled":case"unfocusable":l._setFocusable();break;case"dataSource":{const e=l.$.sortable.$.container;for(;e.firstChild;)e.removeChild(e.firstChild);l._createSortItems(),l._positionChanged=!1,l.$.find.value="",l._findKeyupHandler(),l.$.clearButton.classList.add("smart-hidden");break}case"locale":case"messages":l._localize()}}_createSortItems(){const e=this,t=document.createDocumentFragment();e._HTMLToSourceMap=new Map,e.dataSource.forEach((a=>t.appendChild(e._createSortItem(a)))),e.$.sortable.$.container.appendChild(t),e.$.sortable.updateItems(),e._setFocusable()}_createSortItem(e){const t=document.createElement("div"),a=this.id+"Label"+e.dataField;return this._HTMLToSourceMap.set(t,e),t.className="smart-grid-panel-item",t.innerHTML=`<div class="toggle-visibility${!1!==e.visible?"":" hidden"}${e.disableToggle?" disable-toggle":""}" role="button" aria-controls="${a}" aria-label="Toggle visibility"></div>\n<span id="${a}" class="smart-column-panel-label smart-unselectable${e.icon?" icon "+e.icon:""}">${e.label}</span>`,1===e.level?t.classList.add("indent"):0===e.level&&t.classList.add("group"),e.disableDrag&&t.setAttribute("disable-drag",""),e.dataField&&t.setAttribute("data-field",e.dataField),e.parentDataField&&t.setAttribute("parent-data-field",e.parentDataField),!1!==e.allowHide&&!0!==e.disableToggle||(t.style.pointerEvents="none",t.setAttribute("disabled",""),t.style.opacity=.8),t}_interactionHandler(e){const t=this;if(t.disabled||t.readonly||"keydown"===e.type&&-1===[" ","Enter"].indexOf(e.key))return;const a=t.shadowRoot||t.isInShadowDOM?e.composedPath()[0]:e.target;if(a.classList.contains("toggle-visibility")){a.classList.toggle("hidden");const e=a.closest(".smart-grid-panel-item");if(e.hasAttribute("data-field")){const l=e.getAttribute("data-field");if(e.hasAttribute("parent-data-field")||e.hasAttribute("disabled")){const a=e.getAttribute("parent-data-field"),l=t.$.sortable.querySelectorAll(".smart-grid-panel-item");let n=null;if(l.forEach((e=>{e.getAttribute("data-field")===a&&(n=e)})),n){let e=0,t=0;l.forEach((l=>{l.getAttribute("parent-data-field")===a&&(e++,l.firstElementChild.classList.contains("hidden")&&t++)})),t===e?n.firstElementChild.classList.add("hidden"):t<e&&n.firstElementChild.classList.remove("hidden")}}else t.$.sortable._items.forEach((e=>{if(e.hasAttribute("parent-data-field")&&!e.hasAttribute("disabled")){const t=e.getAttribute("parent-data-field"),n=e.firstElementChild;t===l&&(a.classList.contains("hidden")?n.classList.add("hidden"):n.classList.remove("hidden"))}}))}}else if(a.parentElement===t.$.buttonsContainer){if(a===t.$.buttonsContainer.firstElementChild)return t.$.fireEvent("cancel"),void(t._moves=[]);if(a===t.$.buttonsContainer.children[1]){const e=[];Array.from(t.$.sortable.$.container.children).forEach((a=>{const l=Object.assign({},t._HTMLToSourceMap.get(a));l.visible=!a.firstElementChild.classList.contains("hidden"),e.push(l)})),t.$.fireEvent("apply",{value:e,positionChanged:t._positionChanged,moves:t._moves}),t._positionChanged=!1,t._moves=[]}}else if(a===t.$.reset){const e=[];Array.from(t.$.sortable.$.container.children).forEach((a=>{const l=Object.assign({},t._HTMLToSourceMap.get(a));l.visible=!0,e.push(l)})),t.$.fireEvent("apply",{value:e,positionChanged:t._positionChanged,moves:t._moves}),t._positionChanged=!1,t._moves=[]}else a.classList.contains("clear-button")&&(t.$.find.value="",t._findKeyupHandler())}_findKeyupHandler(){const e=this;if(e.disabled||e.readonly)return;const t=e.$.find,a=t.value,l=[...e.$.sortable.$.container.children];if(void 0===e._disabledSortable&&(e._disabledSortable=e.$.sortable.disabled),""===a)return t.parentElement.classList.remove("no-results"),e.$.clearButton.classList.add("smart-hidden"),l.forEach((e=>e.classList.remove("smart-hidden"))),e.$.sortable.disabled=e._disabledSortable||e.readonly,void delete e._disabledSortable;let n=!0;e.$.clearButton.classList.remove("smart-hidden"),l.forEach((t=>{-1===e._HTMLToSourceMap.get(t).label.toLowerCase().indexOf(a.toLowerCase())?t.classList.add("smart-hidden"):(t.classList.remove("smart-hidden"),n=!1)})),e.$.sortable.disabled=n,n?t.parentElement.classList.add("no-results"):t.parentElement.classList.remove("no-results")}_sortableDragEndHandler(e){const t=e.detail;this._positionChanged=!0,this._moves.push({oldIndex:t.oldIndex,newIndex:t.newIndex})}_localize(){const e=this;e.$.find.placeholder=e.localize("find"),e.$.reset.innerHTML=e.localize("reset"),e.$.buttonsContainer.firstElementChild.innerHTML=e.localize("cancel"),e.$.buttonsContainer.children[1].innerHTML=e.localize("apply"),e.$.container.firstElementChild.setAttribute("no-results",e.localize("noResults"))}_setFocusable(){const e=this,t=e.disabled||e.unfocusable?-1:0,a=Array.from(e.$.sortable.getElementsByClassName("toggle-visibility"));e.$.find.tabIndex=t,e.$.clearButton.tabIndex=t,e.$.buttonsContainer.firstElementChild.tabIndex=t,e.$.buttonsContainer.children[1].tabIndex=t,a.forEach((e=>e.tabIndex=e.classList.contains("disable-toggle")?-1:t))}}),Smart("smart-formatting-panel",class extends Smart.BaseElement{static get properties(){return{columns:{value:[],type:"array",reflectToAttribute:!1},dataSource:{value:[],type:"any",reflectToAttribute:!1},items:{value:null,type:"array?",reflectToAttribute:!1},dropDownAppendTo:{value:null,type:"any",reflectToAttribute:!1},messages:{value:{en:{add:"Add condition",all:"All columns",apply:"Ok",between:"Between",cancel:"Cancel",close:"Close",column:"Column:",condition:"Condition:",equal:"Equal To",fontFamily:"Font family:",fontSize:"Font size:",format:"Format:",greaterThan:"Greater Than",highlight:"Highlight",lessThan:"Less Than",notEqual:"Not Equal To",remove:"Remove condition",secondValue:"Second value:",text:"Text",value:"Value:"}},type:"object",extend:!0}}}static get listeners(){return{click:"_interactionHandler",keydown:"_interactionHandler",change:"_changeHandler","popup.change":"_changeHandler","popup.click":"_interactionHandler","popup.keydown":"_interactionHandler","document.down":"_documentDownHandler"}}template(){return'<div id="container" role="presentation">\n <div id="itemsContainer" class="smart-formatting-panel-items-container" role="presentation"></div>\n <div id="addNewButton" class="smart-add-new-button" role="button" aria-label="Add new condition"></div>\n <div id="popup" class="smart-formatting-panel-popup smart-hidden smart-visibility-hidden" role="dialog">\n <div id="popupHeader" class="header" role="presentation">\n <div id="text" class="selected" role="button" aria-label="Text color"></div>\n <div id="highlight" role="button" aria-label="Highlight color"></div>\n </div>\n <div id="colorCode" class="color-code"></div>\n <input id="colorInput" type="color" />\n <div id="colorsContainer" class="colors-container"></div>\n <smart-button id="apply" class="ok primary" animation="[[animation]]" right-to-left="[[rightToLeft]]" theme="[[theme]]" unfocusable="[[unfocusable]]"></smart-button>\n <smart-button id="cancel" class="cancel" animation="[[animation]]" right-to-left="[[rightToLeft]]" theme="[[theme]]" unfocusable="[[unfocusable]]"></smart-button>\n </div>\n </div>'}render(){const e=this,t=getComputedStyle(e);e.setAttribute("role","dialog"),e.$.popup.id=e.id+"Popup",e._basicColors=[[0,0,0],[68,68,68],[102,102,102],[153,153,153],[204,204,204],[238,238,238],[243,243,243],[255,255,255],[255,0,0],[255,153,0],[255,255,0],[0,255,0],[0,255,255],[0,0,255],[153,0,255],[255,0,255],[244,204,204],[252,229,205],[255,242,204],[217,234,211],[208,224,227],[207,226,243],[217,210,233],[234,209,220],[234,153,153],[249,203,156],[255,229,153],[182,215,168],[162,196,201],[159,197,232],[180,167,214],[213,166,189],[224,102,102],[246,178,107],[255,217,102],[147,196,125],[118,165,175],[111,168,220],[142,124,195],[194,123,160],[204,0,0],[230,145,56],[241,194,50],[106,168,79],[69,129,142],[61,133,198],[103,78,167],[166,77,121],[153,0,0],[180,95,6],[191,144,0],[56,118,29],[19,79,92],[11,83,148],[53,28,117],[116,27,71],[102,0,0],[120,63,4],[127,96,0],[39,78,19],[12,52,61],[7,55,99],[32,18,77],[76,17,48]],e._defaults={fontFamily:t.fontFamily,fontSize:t.fontSize,text:e._toHex(t.color),highlight:e._toHex(t.backgroundColor)},t.fontFamily.indexOf("-apple")>=0&&(e._defaults.fontFamily="Segoe UI"),e._localize(),e._setFocusable(),e._populatePopupWithColors(),e._processColumnsAndDataSource(),e._addDefaultItems(),super.render()}attached(){const e=this;super.attached(),e.isCompleted&&e._addDefaultItemsOnAttach&&e._addDefaultItems()}add(e,t){const a=this;if(e&&e.column&&"all"!==e.column&&!a.columns.find((t=>t.dataField===e.column)))return void a.items.splice(t,1);const l=document.createElement("div"),n=a._defaults,i=` animation="${a.animation}"${a.rightToLeft?" right-to-left":""} theme="${a.theme}"${a.unfocusable?" unfocusable":""}`,o=a.disabled||a.unfocusable?"":' tabindex="0"';e=Object.assign({column:"all",condition:"lessThan",firstValue:0,secondValue:1,fontFamily:n.fontFamily,fontSize:n.fontSize,text:n.text,highlight:n.highlight},e);const r=`\n<div class="value-label">${a.localize("value")}</div>\n<smart-input class="columns-input underlined" data-source='${JSON.stringify(a._columnsInputDataSource)}' placeholder="${a.localize("column")}" readonly value="${a._columnsInputDataSource.find((t=>t.value===e.column)).label}"${i}></smart-input>\n<smart-input class="condition-input underlined" data-source='${a._conditionsDataSource}' placeholder="${a.localize("condition")}" readonly value="${a.localize(e.condition)}"${i}></smart-input>\n<smart-input class="first-value underlined" type="number" placeholder="${a.localize("value")}" value="${e.firstValue}"${i}></smart-input>\n<div class="ampersand">&</div>\n<smart-input class="second-value underlined" type="number" placeholder="${a.localize("secondValue")}" value="${e.secondValue}"${i}></smart-input>\n<div class="close-button" title="${a.localize("close")}"${o} role="button" aria-label="Close"></div>\n<div class="format-label">${a.localize("format")}</div>\n<smart-input class="font-family-input underlined" drop-down-height="auto" placeholder="${a.localize("fontFamily")}" readonly${i}></smart-input>\n<smart-input class="font-size-input underlined" data-source='["8px", "9px", "10px", "11px", "12px", "13px", "14px", "15px", "16px"]' drop-down-height="auto" placeholder="${a.localize("fontSize")}" readonly value="${e.fontSize}"${i}></smart-input>\n<div class="popup-button smart-unselectable"${o} role="button" aria-haspopup="dialog" aria-label="Toggle pop-up">A</div>\n<div class="preview smart-unselectable">2.71828</div>`;l.classList.add("smart-formatting-panel-item"),l.classList.toggle("between","between"===e.condition),l.innerHTML=r,l.columnsInput=l.querySelector(".columns-input"),l.conditionInput=l.querySelector(".condition-input"),l.firstValue=l.querySelector(".first-value"),l.secondValue=l.querySelector(".second-value"),l.closeButton=l.querySelector(".close-button"),l.fontFamilyInput=l.querySelector(".font-family-input"),l.fontFamilyInput.dataSource=[n.fontFamily,"Arial","Verdana","Courier New","Georgia","Times New Roman"],l.fontFamilyInput.value=e.fontFamily,l.fontSizeInput=l.querySelector(".font-size-input"),l.popupButton=l.querySelector(".popup-button"),l.fontFamilyInput=l.querySelector(".font-family-input"),l.preview=l.querySelector(".preview"),l.popupButton.style.color=e.text,l.popupButton.style.backgroundColor=e.highlight,l.preview.style.fontFamily=e.fontFamily,l.preview.style.fontSize=e.fontSize,l.preview.style.color=e.text,l.preview.style.backgroundColor=e.highlight,l.data=e,a.$.itemsContainer.appendChild(l),l.columnsInput.$.input.value||(l.columnsInput.$.input.dataValue="all"),l.conditionInput.$.input.dataValue=e.condition,a._checkScrollBar()}apply(){const e=this,t=new Smart.Utilities.ConditionalFormatter(e.dataSource),a=Array.from(e.$.itemsContainer.children),l=[];let n;if(0===a.length)return;if(e.ownerElement&&"smart-pivot-table"===e.ownerElement.nodeName.toLowerCase()){const t=e.ownerElement._dynamicColumns;n=function(e){return"all"===e?t.map((e=>e.id)):t.filter((t=>t.dataFields[t.dataFields.length-1].dataField===e)).map((e=>e.id))}}else n=function(t){return"all"===t?e._columns.map((e=>e.value)):[t]};for(let e=0;e<a.length;e++){const i=a[e].data,o=n(i.column),r=i.condition;t.color=i.highlight,t.comparator=i.firstValue,t.min=i.firstValue,t.max=i.secondValue;const s=t.format(r,o);for(let e in s){const t=s[e];for(let e in t){const a=t[e];a.color=i.text,a.fontFamily=i.fontFamily,a.fontSize=i.fontSize}}l.push(s)}if(0===l.length)return l[0];const i={};for(let e=0;e<l.length;e++){const t=l[e];for(let e in t){const a=t[e];i[e]||(i[e]={});for(let t in a)i[e][t]=Object.assign({},i[e][t],a[t])}}return i}getItems(){return Array.from(this.$.itemsContainer.children).map((e=>e.data))}propertyChangedHandler(e,t,a){super.propertyChangedHandler(e,t,a);const l=this;switch(e){case"animation":case"theme":case"rightToLeft":if(Array.from(l.$.itemsContainer.querySelectorAll(".smart-element")).forEach((t=>t[e]=a)),null!==l.dropDownAppendTo&&(l.$.apply[e]=a,l.$.cancel[e]=a),"theme"===e){const e=getComputedStyle(l);l._defaults.text=l._toHex(e.color),l._defaults.highlight=l._toHex(e.backgroundColor)}break;case"columns":case"items":"columns"===e&&(l._processColumnsAndDataSource(),l.items=null),l.$.itemsContainer.innerHTML="",l._addDefaultItems();break;case"disabled":case"unfocusable":{const t=l.disabled||l.unfocusable,n=Array.from(l.$.itemsContainer.querySelectorAll(".close-button, .popup-button"));"disabled"===e?l._closePopup():null!==l.dropDownAppendTo&&(l.$.apply.unfocusable=a,l.$.cancel.unfocusable=a),l._setFocusable(),Array.from(l.$.itemsContainer.querySelectorAll(".smart-element")).forEach((e=>e.unfocusable=t)),t?n.forEach((e=>e.removeAttribute("tabindex"))):n.forEach((e=>e.setAttribute("tabindex",0)));break}case"dataSource":Smart.DataAdapter&&a instanceof Smart.DataAdapter&&(l.dataSource=a.toArray());break;case"locale":case"messages":l.items=l.getItems(),l.$.itemsContainer.innerHTML="",l._localize(),l._columnsInputDataSource=JSON.parse(JSON.stringify(l._columns.concat([{label:l.localize("all"),value:"all"}]))),l._addDefaultItems()}}_populatePopupWithColors(){const e=this,t=e._basicColors,a=document.createDocumentFragment();for(let l=0;l<t.length;l++){const n=document.createElement("div"),i=t[l],o=`rgb(${i[0]}, ${i[1]}, ${i[2]})`,r=e._toHex(o);n.setAttribute("role","button"),n.setAttribute("aria-label","Select color "+r),n.index=l,n.value=r,n.style.backgroundColor=o,a.appendChild(n)}e.$.colorsContainer.appendChild(a)}_processColumnsAndDataSource(){const e=this,t=e.columns,a=e.dataSource,l=[];Smart.DataAdapter&&a instanceof Smart.DataAdapter&&(e.dataSource=a.toArray());for(let e=0;e<t.length;e++){const a=t[e];"number"===a.dataType&&l.push({label:a.label,value:a.dataField})}e._columns=l,e._columnsInputDataSource=JSON.parse(JSON.stringify(l.concat([{label:e.localize("all"),value:"all"}])))}_addDefaultItems(){const e=this,t=e.items,a=e.getRootNode();a===document||document.body.contains(a)?(t&&t.length>0?t.forEach(((t,a)=>e.add(t,a))):(e.add({condition:"greaterThan",firstValue:100}),e.add({condition:"lessThan",firstValue:0})),delete e._addDefaultItemsOnAttach):e._addDefaultItemsOnAttach=!0}_changeHandler(e){const t=this,a=t.isInShadowDOM?e.composedPath()[0]:e.target,l=a.closest(".smart-formatting-panel-item");if(l)if(a!==l.columnsInput){if(a===l.conditionInput)return l.data.condition=a.$.input.dataValue,void l.classList.toggle("between","between"===a.$.input.dataValue);if(l.firstValue.contains(a))l.data.firstValue=parseFloat(a.value);else{if(!l.secondValue.contains(a))return a===l.fontFamilyInput?(l.data.fontFamily=a.value,void(l.preview.style.fontFamily=a.value)):void(a===l.fontSizeInput&&(l.data.fontSize=a.value,l.preview.style.fontSize=a.value));l.data.secondValue=parseFloat(a.value)}}else l.data.column=a.$.input.dataValue;else t.$.popup.contains(a)&&t._updateUI(a.value.toUpperCase())}_checkScrollBar(){this.classList.toggle("scroll",this.$.itemsContainer.offsetHeight<this.$.itemsContainer.scrollHeight)}_interactionHandler(e){const t=this;if(!t.dropDownAppendTo&&e.currentTarget===t.$.popup)return;if("keydown"===e.type){if(-1===[" ","Enter"].indexOf(e.key))return void(t.disabled||t.readonly||t._keydownHandler(e));e.preventDefault()}const a=t.isInShadowDOM?e.composedPath()[0]:e.target;if(a===t.$.addNewButton)return void t.add();const l=a.closest(".smart-formatting-panel-item");if(l)return void(a===l.closeButton?(l.remove(),this._checkScrollBar()):a===l.popupButton&&(t._togglePopup(l),t._activePopupButton=a));const n=t.$.popup;if(n.contains(a)){if(a.parentElement===t.$.colorsContainer)return void t._updateUI(a.value);if(a.parentElement===t.$.popupHeader)a.classList.add("selected"),a===t.$.text?(n.selection="currentText",t.$.highlight.classList.remove("selected")):(n.selection="currentHighlight",t.$.text.classList.remove("selected")),t._updateUI(n[n.selection]);else if(a.classList.contains("smart-button")){if(t.$.apply.contains(a)||a&&a.ownerElement&&a.ownerElement.classList.contains("ok")){const e=n.item;e.data.text=n.currentText,e.data.highlight=n.currentHighlight,e.popupButton.style.color=n.currentText,e.popupButton.style.backgroundColor=n.currentHighlight,e.preview.style.color=n.currentText,e.preview.style.backgroundColor=n.currentHighlight}t._closePopup()}}}_keydownHandler(e){const t=this,a=e.key;if(-1===["ArrowDown","ArrowLeft","ArrowRight","ArrowUp","End","Escape","Home","PageDown","PageUp"].indexOf(a))return;if(e.preventDefault(),"Escape"===a&&!t.$.popup.classList.contains("smart-hidden"))return void t._closePopup();if(t.getRootNode().activeElement!==t.$.colorsContainer)return;const l=Array.from(this.$.colorsContainer.children),n=this.$.colorsContainer.querySelector(".selected");let i,o="ArrowRight",r="ArrowLeft";if(t.rightToLeft&&(o="ArrowLeft",r="ArrowRight"),n){let e=n.index;switch(a){case r:e=Math.max(e-1,e-e%8);break;case o:e=Math.min(e+1,e+8-e%8-1);break;case"ArrowUp":e=Math.max(e-8,e%8);break;case"ArrowDown":e=Math.min(e+8,56+e%8);break;case"Home":e-=e%8;break;case"End":e=e+8-e%8-1;break;case"PageUp":e%=8;break;case"PageDown":e=56+e%8}i=l[e]}else i=l[0];t._updateUI(i.value,i)}_togglePopup(e){const t=this,a=t.$.popup;if(e===a.item)return void t._closePopup();if(a.setAttribute("animation",t.animation),a.setAttribute("theme",t.theme),t.rightToLeft&&a.setAttribute("right-to-left",""),a.classList.contains("smart-hidden")&&a.classList.remove("smart-hidden"),t.dropDownAppendTo)if("body"===t.dropDownAppendTo)document.body.appendChild(a);else{const e=document.querySelector(t.dropDownAppendTo);e&&e.appendChild(a)}const l=e.popupButton,n=l.getBoundingClientRect(),i=l.offsetLeft,o=l.offsetTop,r=a.offsetWidth,s=a.offsetHeight,d=t.$.itemsContainer.scrollTop,c=t._toHex(e.data.text),p=t._toHex(e.data.highlight);n.top>=s+5?a.style.top=o-(s+d+5)+"px":a.style.top=o+n.height-d+5+"px",a.style.left=i+n.width/2-r/2+"px",t.dropDownAppendTo&&(a.style.top=n.bottom+5+"px",a.style.left=n.left+n.width/2-r/2+"px"),t.$.text.classList.add("selected"),t.$.highlight.classList.remove("selected"),t.$.text.focus(),a.item=e,a.selection="currentText",a.currentText=c,a.currentHighlight=p,t._updateUI(c),a.controlledBy&&(a.controlledBy.removeAttribute("aria-controls"),a.controlledBy.removeAttribute("aria-expanded")),l.setAttribute("aria-controls",a.id),l.setAttribute("aria-expanded",!0),a.controlledBy=l,a.classList.remove("smart-visibility-hidden")}_closePopup(){const e=this,t=e.$.popup;"none"!==e.animation?(t.addEventListener("transitionend",(function e(){t.classList.add("smart-hidden"),t.removeEventListener("transitionend",e)})),t.classList.add("smart-visibility-hidden")):(t.classList.add("smart-visibility-hidden"),t.classList.add("smart-hidden")),delete t.item,e._activePopupButton&&e._activePopupButton.focus(),t.controlledBy&&(t.controlledBy.removeAttribute("aria-controls"),t.controlledBy.removeAttribute("aria-expanded"))}_toHex(e){if(-1!==e.indexOf("#"))return e;const t=/rgb\((\d+), (\d+), (\d+)\)/g.exec(e);return t?"#"+(parseFloat(t[1]).toString(16).padStart(2,"0")+parseFloat(t[2]).toString(16).padStart(2,"0")+parseFloat(t[3]).toString(16).padStart(2,"0")).toUpperCase():"#FFFFFF"}_updateUI(e,t){const a=this;a.$.colorInput.value=e,a.$.colorCode.innerHTML=e,a._selectColor(e,t)}_selectColor(e,t){const a=this.$.popup,l=Array.from(this.$.colorsContainer.children);l.forEach((e=>e.classList.remove("selected"))),(t=t||l.find((t=>t.value===e)))&&t.classList.add("selected"),a[a.selection]=e}_localize(){const e=this;e._conditionsDataSource=JSON.stringify([{label:e.localize("lessThan"),value:"lessThan"},{label:e.localize("greaterThan"),value:"greaterThan"},{label:e.localize("equal"),value:"equal"},{label:e.localize("notEqual"),value:"notEqual"},{label:e.localize("between"),value:"between"}]),e.$.text.innerHTML=e.localize("text"),e.$.highlight.innerHTML=e.localize("highlight"),e.$.apply.innerHTML=e.localize("apply"),e.$.cancel.innerHTML=e.localize("cancel"),e.$.addNewButton.title=e.localize("add")}_setFocusable(){const e=this,t=!e.disabled&&!e.unfocusable,a=[e.$.addNewButton,e.$.text,e.$.highlight,e.$.colorsContainer];t?(a.forEach((e=>e.setAttribute("tabindex",0))),e.$.colorInput.removeAttribute("tabindex")):(a.forEach((e=>e.removeAttribute("tabindex"))),e.$.colorInput.setAttribute("tabindex",-1))}_documentDownHandler(e){const t=this,a=t.isInShadowDOM?e.originalEvent.composedPath()[0]:e.originalEvent.target,l=t.$.popup;l.classList.contains("smart-hidden")||l.contains(a)||a.classList.contains("popup-button")||(delete t._activePopupButton,t._closePopup())}}),Smart("smart-data-view",class extends Smart.BaseElement{static get properties(){return{addNewButton:{value:!1,type:"boolean"},allowDrag:{value:!1,type:"boolean"},collapsible:{value:!1,type:"boolean"},columns:{value:[],type:"object",reflectToAttribute:!1},dataSource:{value:null,type:"object?",reflectToAttribute:!1},dataSourceSettings:{value:{autoGenerateColumns:{value:!1,type:"boolean"},sanitizeHTML:{value:"blackList",allowedValues:["all","blackList","none"],type:"string"},root:{value:"",type:"string"},record:{value:"",type:"string"},keyDataField:{value:"",type:"string"},parentDataField:{value:"",type:"string"},childrenDataField:{value:"",type:"string"},groupBy:{value:[],type:"array"},dataFields:{value:[],type:"array"},mapChar:{value:".",type:"string"},id:{value:"",type:"string"},virtualDataSource:{value:null,type:"any"},virtualDataSourceOnExpand:{value:null,type:"any"}},type:"object"},editable:{value:!1,type:"boolean"},headerPosition:{value:"none",allowedValues:["none","top","bottom"],type:"string"},messages:{value:{en:{addFilter:"+ Add filter",and:"And",apply:"Ok",booleanFirst:"☐",booleanLast:"☑",cancel:"Cancel",CONTAINS:"contains",CONTAINS_CASE_SENSITIVE:"contains (case sensitive)",dateFirst:"1",dateLast:"9",DOES_NOT_CONTAIN:"does not contain",DOES_NOT_CONTAIN_CASE_SENSITIVE:"does not contain (case sensitive)",EMPTY:"empty",ENDS_WITH:"ends with",ENDS_WITH_CASE_SENSITIVE:"ends with (case sensitive)",EQUAL:"equal",EQUAL_CASE_SENSITIVE:"equal (case sensitive)",filter:"Filter",customize:"Customize Columns",filteredByMultiple:"{{n}} filters",filteredByOne:"1 filter",filterValuePlaceholder:"Value",find:"Find a field",findInView:"Find in view",firstBy:"Sort by",found:"{{nth}} of {{n}}",from:"from",GREATER_THAN:"greater than",GREATER_THAN_OR_EQUAL:"greater than or equal",LESS_THAN:"less than",LESS_THAN_OR_EQUAL:"less than or equal",noFilters:"No filters applied",noResults:"No results",noSorting:"No sorting applied",NOT_EMPTY:"not empty",NOT_EQUAL:"not equal",NOT_NULL:"not null",NULL:"null",numberFirst:"1",numberLast:"9",ok:"OK",or:"Or",pickAnother:"Pick another field to sort by",sort:"Sort",group:"Group",fontFamily:"Font family:",fontSize:"Font size:",format:"Format:",formatColumn:"Format Column",formating:"Conditional Formating",sortedByMultiple:"Sorted by {{n}} fields",sortedByOne:"Sorted by 1 field",STARTS_WITH:"starts with",STARTS_WITH_CASE_SENSITIVE:"starts with (case sensitive)",stringFirst:"A",stringLast:"Z",thenBy:"then by",where:"Where",collapseAll:"Collapse all",expandAll:"Expand all",noGrouping:"No grouping",groupedByMultiple:"{{n}} groups",groupedByOne:"1 group",firstByGroup:"Group by",pickAnotherGroupBy:"Pick another field to group by",add:"Add condition",all:"All columns",between:"Between",close:"Close",column:"Column:",condition:"Condition:",equal:"Equal To",greaterThan:"Greater Than",highlight:"Highlight",lessThan:"Less Than",notEqual:"Not Equal To",remove:"Remove condition",secondValue:"Second value:",text:"Text",value:"Value:",reset:"Reset"}}}}}static get listeners(){return{"header.apply":"_applyHandler","header.cancel":"closePanel","headerDropDown.transitionend":"_headerDropDownTransitionendHandler","searchInput.keyup":"_searchInputKeyupHandler",resize:"_resizeHandler","document.move":"_documentMoveHandler","document.up":"_documentUpHandler"}}render(){const e=this;e.$.headerDropDown.id||(e.$.headerDropDown.id=e.id+"HeaderDropDown"),e.setAttribute("role","group"),e._isMobile=Smart.Utilities.Core.isMobile,super.render()}addFilter(e,t="and"){const a=this;if(!Array.isArray(e)||e.length>0&&!Array.isArray(e[0]))return;let l;a.closePanel(),arguments[2]?l={filters:arguments[2],operator:t}:(l={filters:[],operator:t},e.forEach((e=>{e[1].filters.forEach((t=>{l.filters.push([e[0],t.condition,t.value])}))}))),JSON.stringify(l)!==JSON.stringify(a._appliedFiltering)&&(l.filterGroups=e,a._appliedFiltering=l,a._applyFilter(e,t),a.$.fireEvent("filter"),a._refreshFilterButton())}_refreshFilterButton(){const e=this,t=e._appliedFiltering.filters?e._appliedFiltering.filters.length:0;if(0===t)return e.$.filterButton.firstElementChild.innerHTML=e.localize("filter"),void e.$.filterButton.classList.remove("filtered");e.$.filterButton.firstElementChild.innerHTML=1===t?e.localize("filteredByOne"):e.localize("filteredByMultiple",{n:t}),e.$.filterButton.classList.add("filtered")}addSort(e,t){const a=this,l=a.dataSource,n=JSON.stringify(a._appliedSorting);let i;function o(e,n){if(a.columns.find((t=>t.dataField===e))){let a=Array.isArray(t)?t[n]:"string"==typeof t?t:"ascending";i.dataFields.push(e),i.dataTypes.push(l.dataFields.find((t=>t.name===e)).dataType),a=a&&-1!==a.indexOf("desc")?"descending":"ascending",i.orderBy.push(a)}}if(0!==arguments.length&&l&&0!==l.length){if(a.closePanel(),1===arguments.length&&"object"==typeof e)i=e;else if(i={dataFields:[],dataTypes:[],orderBy:[]},Array.isArray(e))e.forEach(o);else{if("string"!=typeof e)return;o(e,0)}a.closePanel(),a._appliedSorting=i,n!==JSON.stringify(a._appliedSorting)&&(a._applySort(),a.$.fireEvent("sort"),a._refreshSortButton())}}_refreshSortButton(){const e=this,t=e._appliedSorting.dataFields.length;return 0===t||e.grid&&!1===e.grid.sorting.maintainSort?(e.$.sortButton.firstElementChild.innerHTML=e.localize("sort"),void e.$.sortButton.classList.remove("sorted")):(e.$.sortButton.firstElementChild.innerHTML=1===t?e.localize("sortedByOne"):e.localize("sortedByMultiple",{n:t}),void e.$.sortButton.classList.add("sorted"))}closePanel(){const e=this.$.headerDropDown;e.classList.remove("open"),setTimeout((()=>{e.classList.add("smart-visibility-hidden")}),150),this._closeSearchPanel(),e.controlledBy&&(e.controlledBy.removeAttribute("aria-controls"),e.controlledBy.setAttribute("aria-expanded",!1),delete e.controlledBy)}_closeSearchPanel(){const e=this;e._searchInfo&&delete e._searchInfo}_closeDialog(){const e=this;e._editInfo&&e._editInfo.window.close()}openFormatPanel(){}openFilterPanel(e,t){const a=this,l=a.dataSource;if(!l||0===l.length&&!l.virtualDataSource||a.disabled||"none"===a.headerPosition)return;let n;a._editInfo&&a._editInfo.window.close(),a.$.headerDropDown.classList.add("filter-panel"),a.$.headerDropDown.classList.remove("customize-panel","colors-panel","sort-panel","search-panel","format-panel"),a.$.filter.classList.remove("smart-hidden"),a.$.customize.classList.add("smart-hidden"),a.$.sort.classList.add("smart-hidden"),a.$.colors.classList.add("smart-hidden"),a.$.format&&a.$.format.classList.add("smart-hidden"),a.$.group&&a.$.group.classList.add("smart-hidden"),a.$.search.classList.add("smart-hidden"),a._closeSearchPanel(),a._filterPartCreated?(n=a.$.filter.firstElementChild,n.set("dataSource",e),n.set("locale",a.locale),n.messages=a._innerElementMessages.multiColumnFilterPanel,n.operator=a._appliedFiltering.operator,n.editorPlaceholder=a.localize("filterValuePlaceholder"),n.set("operator",a._appliedFiltering.operator),n.set("value",a._appliedFiltering.filters),n._applyValue(),n.rightToLeft=a.rightToLeft):(n=document.createElement("smart-multi-column-filter-panel"),n.rightToLeft=a.rightToLeft,n.animation=a.animation,n.dataSource=e,n.locale=a.locale,n.messages=a._innerElementMessages.multiColumnFilterPanel,n.operator=a._appliedFiltering.operator,n.editorPlaceholder=a.localize("filterValuePlaceholder"),n.theme=a.theme,n.value=a._appliedFiltering.filters,n.editorCallback=t,a.$.filter.appendChild(n),a._filterPartCreated=!0),a._openHeaderDropDown(a.$.filterButton)}openColorsPanel(e,t,a){const l=this,n=l.dataSource;if(!n||0===n.length&&!n.virtualDataSource||l.disabled||"none"===l.headerPosition)return;let i;l._editInfo&&l._editInfo.window.close(),l.$.headerDropDown.classList.add("colors-panel"),l.$.headerDropDown.classList.remove("filter-panel","group-panel","customize-panel","sort-panel","search-panel","format-panel"),l.$.colors.classList.remove("smart-hidden"),l.$.customize.classList.add("smart-hidden"),l.$.filter.classList.add("smart-hidden"),l.$.sort.classList.add("smart-hidden"),l.$.filter&&l.$.filter.classList.add("smart-hidden"),l.$.group&&l.$.group.classList.add("smart-hidden"),l.$.search.classList.add("smart-hidden"),l._closeSearchPanel(),l._colorsPartCreated?(i=l.$.colors.firstElementChild,i.set("dataSource",e),i.set("locale",l.locale),i.messages=l._innerElementMessages.multiColumnFilterPanel,i.operator="or",i.editorPlaceholder=l.localize("filterValuePlaceholder"),i.set("operator","or"),l._appliedColors||(l._appliedColors=[]),i.set("value",l._appliedColors),i._applyValue(),i.rightToLeft=l.rightToLeft):(i=document.createElement("smart-colors-panel"),i.rightToLeft=l.rightToLeft,i.animation=l.animation,i.dataSource=e,i.locale=l.locale,i.messages=l._innerElementMessages.multiColumnFilterPanel,i.operator="or",i.editorPlaceholder=l.localize("filterValuePlaceholder"),i.theme=l.theme,i.editorCallback=t,i.ownerElement=a,l._appliedColors&&i.set("value",l._appliedColors),l.$.colors.appendChild(i),l._colorsPartCreated=!0),l._openHeaderDropDown(l.$.colorsButton)}openSortPanel(e){const t=this,a=t.dataSource;if(!a||0===a.length&&!a.virtualDataSource||t.disabled||"none"===t.headerPosition)return;let l;t._closeDialog(),t.$.headerDropDown.classList.add("sort-panel"),t.$.headerDropDown.classList.remove("customize-panel","filter-panel","format-panel","search-panel"),t.$.sort.classList.remove("smart-hidden"),t.$.customize.classList.add("smart-hidden"),t.$.filter.classList.add("smart-hidden"),t.$.colors.classList.add("smart-hidden"),t.$.format&&t.$.format.classList.add("smart-hidden"),t.$.group&&t.$.group.classList.add("smart-hidden"),t.$.search.classList.add("smart-hidden"),t._closeSearchPanel(),t._sortPartCreated?(l=t.$.sort.firstElementChild,l.rightToLeft=t.rightToLeft,l.dataSource=e,l.locale=t.locale,l.messages=t._innerElementMessages.sortPanel,l.set("dataSource",e),l.propertyChangedHandler("dataSource",void 0,e)):(l=document.createElement("smart-sort-panel"),l.rightToLeft=t.rightToLeft,l.animation=t.animation,l.dataSource=e,l.locale=t.locale,l.messages=t._innerElementMessages.sortPanel,l.theme=t.theme,t.$.sort.appendChild(l),t._sortPartCreated=!0),t._openHeaderDropDown(t.$.sortButton)}removeFilter(){this.addFilter([])}removeSort(){this.addSort({dataFields:[],dataTypes:[],orderBy:[]})}_clearFilterAndSortUI(){const e=this;e._appliedFiltering={filterGroups:[],filters:[],operator:"and"},e._appliedSorting={dataFields:[],dataTypes:[],orderBy:[]},e._appliedGrouping={dataFields:[]},e._appliedColors=[[],{type:"conditions",decorate:"border",singleSelect:""}],e.$.filterButton.classList.remove("filtered"),e.$.sortButton.classList.remove("sorted"),e.$.filterButton.firstElementChild.innerHTML=e.localize("filter"),e.$.sortButton.firstElementChild.innerHTML=e.localize("sort")}_getInnerElementMessages(){const e=this,t=e.locale,a={columnPanel:{},groupPanel:{},multiColumnFilterPanel:{},sortPanel:{},formattingPanel:{},dateTimePicker:{}};a.formattingPanel[t]={add:e.localize("add"),all:e.localize("all"),apply:e.localize("apply"),between:e.localize("between"),cancel:e.localize("cancel"),close:e.localize("close"),column:e.localize("column"),condition:e.localize("condition"),equal:e.localize("equal"),fontFamily:e.localize("fontFamily"),fontSize:e.localize("fontSize"),format:e.localize("format"),greaterThan:e.localize("greaterThan"),highlight:e.localize("highlight"),lessThan:e.localize("lessThan"),notEqual:e.localize("notEqual"),remove:e.localize("remove"),secondValue:e.localize("secondValue"),text:e.localize("text"),value:e.localize("value")},a.columnPanel[t]={apply:e.localize("apply"),cancel:e.localize("cancel"),reset:e.localize("reset"),find:e.localize("find"),noResults:e.localize("noResults")},a.groupPanel[t]={apply:e.localize("apply"),cancel:e.localize("cancel"),collapseAll:e.localize("collapseAll"),expandAll:e.localize("expandAll"),firstBy:e.localize("firstByGroup"),noGrouping:e.localize("noGrouping"),pickAnother:e.localize("pickAnotherGroupBy"),stringFirst:e.localize("stringFirst"),stringLast:e.localize("stringLast"),thenBy:e.localize("thenBy"),from:e.localize("from"),booleanFirst:e.localize("booleanFirst"),booleanLast:e.localize("booleanLast"),dateFirst:e.localize("dateFirst"),dateLast:e.localize("dateLast"),numberFirst:e.localize("numberFirst"),numberLast:e.localize("numberLast")},a.multiColumnFilterPanel[t]={addFilter:e.localize("addFilter"),noResults:e.localize("noResults"),add:"+ "+e.localize("add"),select:e.localize("dialogAddColumnTypeSelect"),condition:e.localize("conditions"),and:e.localize("and"),apply:e.localize("apply"),cancel:e.localize("cancel"),CONTAINS:e.localize("CONTAINS"),CONTAINS_CASE_SENSITIVE:e.localize("CONTAINS_CASE_SENSITIVE"),DOES_NOT_CONTAIN:e.localize("DOES_NOT_CONTAIN"),DOES_NOT_CONTAIN_CASE_SENSITIVE:e.localize("DOES_NOT_CONTAIN_CASE_SENSITIVE"),EMPTY:e.localize("EMPTY"),ENDS_WITH:e.localize("ENDS_WITH"),ENDS_WITH_CASE_SENSITIVE:e.localize("ENDS_WITH_CASE_SENSITIVE"),EQUAL:e.localize("EQUAL"),EQUAL_CASE_SENSITIVE:e.localize("EQUAL_CASE_SENSITIVE"),GREATER_THAN:e.localize("GREATER_THAN"),GREATER_THAN_OR_EQUAL:e.localize("GREATER_THAN_OR_EQUAL"),LESS_THAN:e.localize("LESS_THAN"),LESS_THAN_OR_EQUAL:e.localize("LESS_THAN_OR_EQUAL"),noFilters:e.localize("noFilters"),NOT_EMPTY:e.localize("NOT_EMPTY"),NOT_EQUAL:e.localize("NOT_EQUAL"),NOT_NULL:e.localize("NOT_NULL"),NULL:e.localize("NULL"),or:e.localize("or"),STARTS_WITH:e.localize("STARTS_WITH"),STARTS_WITH_CASE_SENSITIVE:e.localize("STARTS_WITH_CASE_SENSITIVE"),where:e.localize("where"),TOMORROW:e.localize("TOMORROW"),TODAY:e.localize("TODAY"),YESTERDAY:e.localize("YESTERDAY"),THIS_WEEK:e.localize("THIS_WEEK"),LAST_WEEK:e.localize("LAST_WEEK"),NEXT_WEEK:e.localize("NEXT_WEEK"),THIS_MONTH:e.localize("THIS_MONTH"),LAST_MONTH:e.localize("LAST_MONTH"),NEXT_MONTH:e.localize("NEXT_MONTH"),conditions:e.localize("conditions"),colorsSingleSelect:e.localize("colorsSingleSelect"),colorRows:e.localize("colorRows"),colorSelect:e.localize("colorSelect"),colorLeftBorderLabel:e.localize("colorLeftBorderLabel"),colorRowLabel:e.localize("colorRowLabel"),colorCellLabel:e.localize("colorCellLabel"),colorLeftBorder:e.localize("colorLeftBorder"),colorRow:e.localize("colorRow"),colorCell:e.localize("colorCell"),noOptions:e.localize("noOptions")},a.sortPanel[t]={apply:e.localize("apply"),applyOnce:e.localize("applyOnce"),booleanFirst:e.localize("booleanFirst"),booleanLast:e.localize("booleanLast"),cancel:e.localize("cancel"),dateFirst:e.localize("dateFirst"),dateLast:e.localize("dateLast"),firstBy:e.localize("firstBy"),from:e.localize("from"),numberFirst:e.localize("numberFirst"),numberLast:e.localize("numberLast"),noSorting:e.localize("noSorting"),pickAnother:e.localize("pickAnother"),maintainSort:e.localize("maintainSort"),stringFirst:e.localize("stringFirst"),stringLast:e.localize("stringLast"),thenBy:e.localize("thenBy")},a.dateTimePicker[t]={now:e.localize("now"),dateTabLabel:e.localize("dateTabLabel"),timeTabLabel:e.localize("timeTabLabel")},e._innerElementMessages=a}_handleHeaderPosition(e){const t=this,a=t.headerPosition,l=t.$.header;"none"!==a?(l.classList.remove("smart-hidden"),"top"===a&&l.nextElementSibling!==e?t.$.container.insertBefore(l,e):"bottom"===a&&l.previousElementSibling!==e&&t.$.container.insertBefore(l,t.$.loadingIndicatorContainer)):l.classList.add("smart-hidden")}_headerClickHandler(e){const t=this,a=t.$.headerDropDown;function l(e,l){a.classList.contains("smart-visibility-hidden")||e.classList.contains("smart-hidden")?t[l]():t.closePanel()}if(t.$.customizeButton.contains(e))l(t.$.customize,"openCustomizePanel");else if(t.$.filterButton.contains(e))l(t.$.filter,"openFilterPanel");else if(t.$.sortButton.contains(e))l(t.$.sort,"openSortPanel");else if(t.$.formatButton&&t.$.formatButton.contains(e))l(t.$.format,"openFormatPanel");else if(t.$.colorsButton&&t.$.colorsButton.contains(e))l(t.$.colors,"openColorsPanel");else if(e===t.$.searchButton)l(t.$.search,"_openSearchPanel");else if(t.$.groupButton&&t.$.groupButton.contains(e))l(t.$.group,"openGroupPanel");else if(t.$.viewStatesButton&&t.$.viewStatesButton.contains(e))l(t.$.view,"openViewPanel");else if(e===t.$.searchClose)t.$.searchInput.value="",t._search("",!1),t.closePanel();else if(e===t.$.searchPrev||e===t.$.searchNext){const a=t._searchInfo,l=a.foundIdsArray,n=e===t.$.searchNext,i=l.length;let o;if(void 0===a.highlighted)o=n?0:i-1;else{if(1===l.length)return;{const e=l.indexOf(a.highlighted);o=n?(e+1)%i:e-1>=0?e-1:i-1}}a.highlighted=l[o],t.grid?(t.grid.highlighted=a.highlighted,t.grid.ensureVisible(a.highlighted),t.grid._recycle(!1)):t.ensureVisible&&t.ensureVisible(a.highlighted),t.$.searchLabel.innerHTML=t.localize("found",{nth:o+1,n:l.length})}}_headerDropDownTransitionendHandler(e){const t=this,a=t.$.headerDropDown;t._openTimer=setTimeout((()=>{e&&("visibility"!==e.propertyName||a.classList.contains("smart-visibility-hidden"))||(a.classList.contains("search-panel")?t.$.searchInput.focus():!1===t.unfocusable&&(!t._isMobile&&a.classList.contains("customize-panel")?a.querySelector("smart-column-panel").$.find.focus():a.classList.contains("filter-panel")?a.querySelector("smart-multi-column-filter-panel").$.addFilterButton.focus():a.classList.contains("sort-panel")&&a.querySelector("smart-sort-panel").$.inputNotSorted.focus()))}),100)}_localizeHeader(){const e=this;e.$.customizeButton.firstElementChild.innerHTML=e.localize("customize"),e.$.groupButton&&(e.$.groupButton.firstElementChild.innerHTML=e.localize("group")),0===e._appliedFiltering.filters.length?e.$.filterButton.firstElementChild.innerHTML=e.localize("filter"):1===e._appliedFiltering.filters.length?e.$.filterButton.firstElementChild.innerHTML=e.localize("filteredByOne"):e.$.filterButton.firstElementChild.innerHTML=e.localize("filteredByMultiple",{n:e._appliedFiltering.filters.length}),0===e._appliedSorting.dataFields.length?e.$.sortButton.firstElementChild.innerHTML=e.localize("sort"):1===e._appliedSorting.dataFields.length?e.$.sortButton.firstElementChild.innerHTML=e.localize("sortedByOne"):e.$.sortButton.firstElementChild.innerHTML=e.localize("sortedByMultiple",{n:e._appliedSorting.dataFields.length}),e.$.formatButton&&(e.$.formatButton.firstElementChild.innerHTML=e.localize("formating")),e.$.searchInput.placeholder=e.localize("findInView")}_openHeaderDropDown(e){const t=this,a=t.$.headerDropDown;"top"===t.headerPosition?(a.style.bottom=null,a.style.top="100%"):(a.style.top=null,a.style.bottom="100%"),e!==t.$.searchButton||e===t.$.searchButton&&t.rightToLeft?a.style.left=e.offsetLeft-(t.rightToLeft?a.offsetWidth-e.offsetWidth:0)+"px":a.style.left=(t.rightToLeft?e.offsetLeft:e.offsetLeft+Math.max(25,e.offsetWidth)-a.offsetWidth)+"px",a.classList.remove("smart-visibility-hidden"),a.classList.add("open"),a.controlledBy&&(a.controlledBy.removeAttribute("aria-controls"),a.controlledBy.setAttribute("aria-expanded",!1)),a.controlledBy=e,e.setAttribute("aria-controls",a.id),e.setAttribute("aria-expanded",!0),t._headerDropDownTransitionendHandler()}_searchInputKeyupHandler(e){const t=this;function a(){t._searchInfo&&t.$.searchInput.value!==t._searchInfo.query&&t._search(t.$.searchInput.value)}return clearTimeout(t._searchInputTimeout),"Escape"===e.key?(t.$.searchInput.value="",a(),void t.closePanel()):"Enter"===e.key&&t._searchInfo.foundIdsArray&&t._searchInfo.foundIdsArray.length>1?(a(),void t._headerClickHandler(t.$.searchNext,t.$.cardContainer||t.$.body)):void(t._searchInputTimeout=setTimeout(a,500))}}),Smart("smart-colors-panel",class extends Smart.BaseElement{static get properties(){return{closeButtonPosition:{value:"left",allowedValues:["left","right"],type:"string"},dataSource:{value:[],type:"array",reflectToAttribute:!1},editorCallback:{value:null,type:"function?",reflectToAttribute:!1},editorPlaceholder:{value:"Value",type:"string"},messages:{value:{en:{addFilter:"+ Add decorator",and:"And",apply:"Ok",cancel:"Cancel",CONTAINS:"contains",CONTAINS_CASE_SENSITIVE:"contains (case sensitive)",DOES_NOT_CONTAIN:"does not contain",DOES_NOT_CONTAIN_CASE_SENSITIVE:"does not contain (case sensitive)",EMPTY:"empty",ENDS_WITH:"ends with",ENDS_WITH_CASE_SENSITIVE:"ends with (case sensitive)",EQUAL:"equal",EQUAL_CASE_SENSITIVE:"equal (case sensitive)",GREATER_THAN:"greater than",GREATER_THAN_OR_EQUAL:"greater than or equal",LESS_THAN:"less than",LESS_THAN_OR_EQUAL:"less than or equal",noFilters:"No filters applied",NOT_EMPTY:"not empty",NOT_EQUAL:"not equal",NOT_NULL:"not null",NULL:"null",or:"Or",STARTS_WITH:"starts with",STARTS_WITH_CASE_SENSITIVE:"starts with (case sensitive)",where:"Where",TOMORROW:"Tomorrow",TODAY:"Today",YESTERDAY:"Yesterday",NEXT_WEEK:"Next week",THIS_WEEK:"This week",LAST_WEEK:"Last week",NEXT_MONTH:"Next month",THIS_MONTH:"This month",LAST_MONTH:"Last month"}},type:"object",extend:!0},operator:{value:"and",allowedValues:["and","or"],type:"string"},value:{value:[],type:"array"}}}static get listeners(){return{change:"_changeHandler",click:"_interactionHandler",keydown:"_interactionHandler"}}static get requires(){return{"Smart.Button":"smart.button.js","Smart.CheckBox":"smart.checkbox.js","Smart.DateTimePicker":"smart.datetimepicker.js","Smart.FilterGroup":"smart.filter.js","Smart.Input":"smart.input.js","Smart.NumericTextBox":"smart.numerictextbox.js"}}static get styleUrls(){return["smart.gridpanel.css"]}template(){return'<div id="container" role="presentation">\n <div id="gridLayout">\n <div style="border-right: 1px solid var(--smart-border)" class="tabs" id="tabs">\n <div title="Color rows when they match the conditions" class="tab active" id="condition"></div>\n <div title="Color rows the same as a single select value" class="tab" id="select"></div>\n </div>\n <div style="margin-left: 10px;" id="applyTo"></div>\n </div>\n <div>\n\n <span id="conditionLabel">Color rows when they match the conditions</span>\n <div id="singleSelectLabel" class="smart-hidden">Which single select field should the row be colored by?</div>\n <smart-input style="margin-top: 10px; margin-bottom: 10px; width: 250px; display: block;" selected-index="0" class="underlined smart-hidden" readonly id="singleSelect"></smartinput>\n </div>\n <div id="itemsContainer" style="padding-top: 0px;" class="smart-filter-panel-items-container smart-unselectable"></div>\n <div id="footer" class="smart-grid-panel-container-footer" role="presentation">\n <div id="addFilterButton" class="smart-filter-panel-add-filter-button smart-unselectable" role="button"></div>\n <div id="buttonsContainer" class="smart-grid-panel-buttons-container smart-unselectable" role="presentation">\n <span class="smart-grid-panel-cancel-button" role="button"></span>\n <span class="smart-grid-panel-apply-button primary" role="button"></span>\n </div>\n </div>'}ready(){super.ready()}updateSingleSelect(){const e=this,t=e.ownerElement.columns.filter((e=>!!e.template&&!("tags"!==e.template&&"collaborator"!==e.template&&"dropdownlist"!==e.template&&"list"!==e.template||!e.editor.singleSelect))).map((e=>({label:e.label,value:e.dataField})));e.$.singleSelect.dataSource=t,e.$.singleSelect.selectedValue=t[0]?t[0].value:""}render(){const e=this;e.setAttribute("role","dialog"),e.$.gridLayout.style.display="grid",e.$.gridLayout.style.gridTemplateColumns="400px auto",e.$.gridLayout.style.gridColumnGap="1rem",e.$.gridLayout.style.overflow="hidden",e.$.condition.onclick=()=>{e.$.select.classList.remove("active"),e.$.condition.classList.add("active"),e.$.singleSelectLabel.classList.add("smart-hidden"),e.$.singleSelect.classList.add("smart-hidden"),e.$.addFilterButton.classList.remove("smart-visibility-hidden"),e.$.itemsContainer.classList.remove("smart-hidden"),e.$.conditionLabel.classList.remove("smart-hidden"),e.$.singleSelect.classList.add("smart-hidden"),e.$.applyToInput.dataSource[2].visible=!0},e.$.select.onclick=()=>{e.$.select.classList.add("active"),e.$.condition.classList.remove("active"),e.$.singleSelectLabel.classList.remove("smart-hidden"),e.$.singleSelect.classList.remove("smart-hidden"),e.$.addFilterButton.classList.add("smart-visibility-hidden"),e.$.itemsContainer.classList.add("smart-hidden"),e.$.conditionLabel.classList.add("smart-hidden"),e.$.singleSelect.classList.remove("smart-hidden"),e.$.applyToInput.dataSource[2].visible=!1,2===e.$.applyToInput.selectedIndex&&(e.$.applyToInput.selectedIndex=0)};const t=document.createElement("smart-input");t.readonly=!0,t.dropDownButtonPosition="right",t.dropDownAppendTo="body",t.style.width="100%",e.$.singleSelect.dropDownButtonPosition="right",e.$.singleSelect.dropDownAppendTo="body",e.updateSingleSelect();const a="var(--smart-primary);";t.dataSource=[{label:"Left border",value:"border",menuLabel:'<div style="flex-direction: column; display: inline-flex"><div>Left border</div><div class="smart-quiet">Color the left border of a row</div>',prefix:'<span style="top: 8px; border-right: 3px solid '+a+'; padding: 2px; display: inline-block; margin-right: 16px; position: relative;">1</span>'},{label:"Row",value:"row",menuLabel:'<div style="flex-direction: column; display: inline-flex"><div>Row background</div><div class="smart-quiet">Color the background of a row</div>',prefix:'<span style="top: 8px; border: 1px solid var(--smart-primary); color: var(--smart-primary-color); background: '+a+'; padding: 2px; display: inline-block; margin-left:-4px; position: relative;">1</span><span style="border: 1px solid var(--smart-primary); color: var(--smart-primary-color); top: 8px; background: '+a+'; padding: 2px; display: inline-block; margin-right: 8px; position: relative;">2</span>'},{label:"Cell",value:"cell",menuLabel:'<div style="flex-direction: column; display: inline-flex"><div>Cell background</div><div class="smart-quiet">Color the background of a cell</div>',prefix:'<span style="top: 8px; border: 1px solid var(--smart-primary); color: var(--smart-primary-color); background: '+a+'; padding: 2px; display: inline-block; margin-left:-4px; position: relative;">1</span><span style="border:1px solid '+a+'; padding: 2px; display: inline-block; top: 8px; margin-right: 8px; position: relative;">2</span>'}],e.$.applyTo.appendChild(t),e.$.applyToInput=t,e._setFocusable(),e._localize(),e.$.applyToInput.selectedIndex=0,e._applyValue(),super.render()}propertyChangedHandler(e,t,a){super.propertyChangedHandler(e,t,a);const l=this;switch(e){case"animation":case"theme":case"rightToLeft":Array.from(l.$.itemsContainer.querySelectorAll("smart-date-time-picker, smart-numeric-text-box, smart-check-box, smart-input")).forEach((t=>{t[e]=a,"smart-input"===t.tagName.toLowerCase()&&"rightToLeft"===e&&"none"!==t.dropDownButtonPosition&&(t.dropDownButtonPosition=a?"left":"right")}));break;case"disabled":case"unfocusable":l._setFocusable(!0);break;case"dataSource":case"value":l._applyValue();break;case"editorPlaceholder":Array.from(l.$.itemsContainer.getElementsByClassName("editor")).forEach((e=>e.placeholder=a));break;case"locale":case"messages":l._localize(!0);break;case"operator":l._setOperator()}}_setOperator(){const e=this,t=e.localize(e.operator);for(let a=2;a<e._items.length;a++)e._items[a].children[1].innerHTML=t}_changeHandler(e){const t=this,a=t.shadowRoot||t.isInShadowDOM?e.composedPath()[0]:e.target;if(a instanceof Smart.Input==0)return;const l=a.parentElement,n=l.children;if(a===n[1])t.operator=a.$.input.dataValue,t._setOperator();else if(a===n[2]){let a,i,o=t.dataSource.find((t=>t.dataField===e.detail.oldValue)).dataType,r=t.dataSource.find((t=>t.dataField===e.detail.oldValue)),s=t.dataSource.find((t=>t.dataField===e.detail.value)),d=s.dataType,c=[];if(s.options&&(d="enum",c=s.options.map((e=>{const t=e.color||"var(--smart-primary)";return e.prefix='<span style="background: '+t+'; width: 14px; height: 14px; display: inline-block; border-radius: 50%; margin-left:-4px; margin-right: 8px; top: 2px; position: relative;"></span>',""===e.label&&(e.label=" "),e}))),r&&r.options&&(o="enum"),"enum"!==d&&d===o)return void(t.editorCallback&&t.editorCallback(n[4],s));let p=n[3]?n[3].value:"";switch(d){case"date":a=t._dateConditions,i=document.createElement("smart-date-time-picker"),i.calendarButton=!0,i.dropDownAppendTo="body",i.dropDownDisplayMode="auto",i.formatString="M/d/yy H:mm",p="";break;case"number":a=t._numberAndDateConditions,i=document.createElement("smart-numeric-text-box"),p="";break;case"boolean":a=t._booleanConditions,i=document.createElement("smart-check-box"),p="";break;case"enum":a=t._enumConditions,i=document.createElement("smart-input"),i.dataSource=c.length?c:s.options,i.readonly=!0,i.dropDownButtonPosition="right",p=a[0];break;default:a=t._stringConditions,p=t._stringConditions.find((e=>"CONTAINS"===e.value)),i=document.createElement("smart-input")}a.forEach((e=>{delete e.selected})),i.rightToLeft=t.rightToLeft,i.animation=t.animation,i.theme=t.theme,i.unfocusable=t.disabled||t.unfocusable,i.classList.add("underlined"),i.dataSource&&i.dataSource.length<10?i.dropDownHeight="auto":i.dropDownHeight=250,"boolean"!==d&&(i.placeholder=t.editorPlaceholder),t.editorCallback&&t.editorCallback(i,s),n[4]&&n[4].remove(),l.appendChild(i),""===p||a.find((e=>e.label===p))||(p.value?(n[3].value=p.label,n[3].selectedValue=p.value):(n[3].value="",n[3].selectedValue="")),n[3].dataSource=a,""===p&&(n[3].value=a[0].label,n[3].selectedValue=a[0].value),a.length>=10?n[3].dropDownHeight=250:n[3].dropDownHeight="auto",l.dataType=d}else if(a===n[3]){const e=n[4],t=a.$.input.dataValue;-1!==t.indexOf("NULL")||-1!==t.indexOf("EMPTY")||-1!==t.indexOf("THIS_WEEK")||-1!==t.indexOf("LAST_WEEK")||-1!==t.indexOf("NEXT_WEEK")||-1!==t.indexOf("THIS_MONTH")||-1!==t.indexOf("LAST_MONTH")||-1!==t.indexOf("NEXT_MONTH")||-1!==t.indexOf("THIS_YEAR")||-1!==t.indexOf("LAST_YEAR")||-1!==t.indexOf("NEXT_YEAR")||-1!==t.indexOf("TODAY")||-1!==t.indexOf("TOMORROW")||-1!==t.indexOf("YESTERDAY")?(e.value="",e.checked=!1,e.classList.add("smart-visibility-hidden")):e.classList.remove("smart-visibility-hidden"),a.condition=t}}_getColorInput(){const e=document.createElement("smart-color-input");return e.dataSource=["#D50000","#E67C73","#F4511E","#F6BF26","#0B8043","#33B679","#3F51B5","#039BE5","#7986CB","#8C47FF","#8E24AA","#FF36C2","#616161","#454545","#949494","#000000"],e.additionalColors=["#FF9EB7","#FF9EB7","#FFD66D","#FFEBB6","#93DF89","#D1F7C4","#9DC7FF","#D0F0FD","#CDAFFF","#ECE1FD","#FA9DE2","#FFDAF6","#CBCBCB","#EDEDED","#FFFFFF",""],e.valueDisplayMode="colorBox",e.classList.add("underlined","smart-grid-color-input"),e.style.width="auto",e.readonly=!0,e.onRender=()=>{const t=e.$.scrollView;e.querySelector(".smart-color-box").style.borderRadius="50%",t&&t.classList.add("smart-grid-color-input")},e}_interactionHandler(e){const t=this;if(t.disabled||t.readonly)return;if("keydown"===e.type){if("Enter"!==e.key)return;e.preventDefault()}const a=t.shadowRoot||t.isInShadowDOM?e.composedPath()[0]:e.target,l=a.closest(".smart-grid-panel-item");if(l){if(a===l.firstElementChild){const e=t._items.indexOf(l);let a;if(t._items.splice(e,1),l.remove(),t._items.length>0&&e<2){if(0===e){t._items[0].children[1].remove(),a=document.createElement("div"),a.innerHTML=t.localize("where");const e=t._getColorInput();t._items[0].insertBefore(e,t._items[0].children[1])}t._items.length>1&&(t._items[1].children[1].remove(),a=document.createElement("smart-input"),a.className="underlined",a.dataSource=[{value:"and",label:t.localize("and")},{value:"or",label:t.localize("or")}],a.dropDownButtonPosition=t.rightToLeft?"left":"right",a.readonly=!0,a.value=t.localize(t.operator),a.animation=t.animation,a.theme=t.theme,a.rightToLeft=t.rightToLeft,a.unfocusable=t.disabled||t.unfocusable,t._items[1].insertBefore(a,t._items[1].children[1]))}}}else if(a===t.$.addFilterButton&&t.dataSource.length>0)t.$.itemsContainer.appendChild(t._createItem(t.dataSource[0],"","",t._items.length));else if(a!==t.$.buttonsContainer.firstElementChild){if(a===t.$.buttonsContainer.children[1]){let e=t._stringConditions.concat(t._dateConditions),a=t.operator,l=[],n={},i=[];t._customConditions&&(e=e.concat(t._customConditions)),t._items.forEach((i=>{const o=t.dataSource.find((e=>e.label===i.children[2].value)),r=[];let s=i.children[3].value;if(""===s)return;let d=o.dataType;s=e.find((e=>e.label===s)).value;const c=i.querySelector("smart-color-input").value;if(r.push(o.dataField,s),-1===s.indexOf("NULL")&&-1===s.indexOf("EMPTY"))if("boolean"===d)r.push(i.children[4].checked);else if("date"===d)r.push(i.children[4].value.toDate());else if("enum"===d||o.options){let e=i.children[4].$.input.dataValue;if(void 0===e){const t=o.options.find((e=>e.label===i.children[4].value));if(!t)return;e=t.value}d="string",r.push(e)}else r.push(i.children[4].value);r.push(c);let p=n[r[0]];void 0===p&&(p=new Smart.Utilities.FilterGroup,n[r[0]]=p);const u=p.createFilter(d,r[2],r[1]);p.addFilter(a,u),l.push(r)}));for(let e in n)i.push([e,n[e]]);const o={};o.type=t.$.condition.classList.contains("active")?"conditions":"singleSelect",o.decorate=t.$.applyToInput.selectedValue,o.singleSelect=t.$.singleSelect.selectedValue,null===o.decorate&&(o.decorate="border"),t.value=l,t.$.fireEvent("apply",{filters:i,decorator:o,value:l})}}else t.$.fireEvent("cancel")}_applyValue(){const e=this,t=document.createDocumentFragment();let a=0;for(e._items=[];e.$.itemsContainer.firstElementChild;)e.$.itemsContainer.firstElementChild.remove();if(0===e.dataSource.length)return;const l=e.value&&e.value[0]||[],n=e.value?e.value[1]:{};n&&"singleSelect"===n.type?e.$.select.click():e.$.condition.click(),l.forEach((l=>{if(!Array.isArray(l))return;const n=l[0],i=e.dataSource.find((e=>e.dataField===n));if(!i)return;let o;o="EMPTY"===l[1]||"NULL"===l[1]||"NOT_EMPTY"===l[1]||"NOT_NULL"===l[1]?e._createItem(i,l[1],void 0,a,l[2]):e._createItem(i,l[1],l[2],a,l[3]),t.appendChild(o),a++})),e.$.itemsContainer.appendChild(t),e.updateSingleSelect(),n&&(e.$.applyToInput.selectedValue=n.decorate,e.$.singleSelect.selectedValue=n.singleSelect)}_createItem(e,t,a,l,n=""){const i=this,o=i.disabled||i.unfocusable?-1:0,r=document.createElement("div"),s=document.createDocumentFragment(),d=document.createElement("div"),c=document.createElement("smart-input"),p=document.createElement("smart-input");let u,m;d.className="smart-grid-panel-item-close-button",d.tabIndex=o,d.setAttribute("role","button"),d.setAttribute("aria-label","button"),s.appendChild(d),u=document.createElement("div");const h=i._getColorInput();if(h.value=n,u.appendChild(h),u.setAttribute("role","presentation"),s.appendChild(u),c.className="underlined",c.dataSource=i.dataSource.map((e=>({value:e.dataField,label:e.label,icon:e.icon}))),c.dropDownButtonPosition=i.rightToLeft?"left":"right",c.readonly=!0,c.value=e.label,c.animation=i.animation,c.theme=i.theme,c.rightToLeft=i.rightToLeft,c.unfocusable=i.disabled||i.unfocusable,c.setAttribute("aria-label","Field"),c.dataSource&&c.dataSource.length<10?c.dropDownHeight="auto":c.dropDownHeight=250,s.appendChild(c),"boolean"===e.dataType)p.dataSource=JSON.parse(JSON.stringify(i._booleanConditions)),m=document.createElement("smart-check-box"),m.checked="boolean"==typeof a&&a;else if("date"===e.dataType)p.dataSource=i._dateConditions,m=document.createElement("smart-date-time-picker"),m.dropDownDisplayMode="auto",m.calendarButton=!0,m.dropDownAppendTo="body",m.formatString="M/d/yy H:mm",m.value=a;else if("number"===e.dataType)p.dataSource=JSON.parse(JSON.stringify(i._numberAndDateConditions)),m=document.createElement("smart-numeric-text-box"),m.value="number"==typeof a||"string"==typeof a?a:0;else if("enum"===e.dataType||e.options){p.dataSource=JSON.parse(JSON.stringify(i._enumConditions)),m=document.createElement("smart-input");let t=[];e.options&&(t=e.options.map((e=>{const t=e.color||"var(--smart-primary)";return e.prefix='<span style="background: '+t+'; width: 14px; height: 14px; display: inline-block; border-radius: 50%; margin-left:-4px; margin-right: 8px; top: 2px; position: relative;"></span>',""===e.label&&(e.label=" "),e}))),m.dataSource=t.length?t:e.options,m.readonly=!0,m.dropDownButtonPosition="right";const l=a?e.options.find((e=>e.value===a)):null;m.value=l&&a?l.label:""}else p.dataSource=JSON.parse(JSON.stringify(i._stringConditions)),m=document.createElement("smart-input"),m.value=null!=a?a.toString():"",t||(t="CONTAINS");return p.className="underlined",p.dropDownButtonPosition=i.rightToLeft?"left":"right",p.readonly=!0,p.animation=i.animation,p.theme=i.theme,p.rightToLeft=i.rightToLeft,p.unfocusable=i.disabled||i.unfocusable,p.setAttribute("aria-label","Condition"),p.classList.add("smart-filter-panel-list"),p.dataSource.forEach((e=>{delete e.selected})),p.dataSource.find((e=>e.value===t))?(p.value=i.localize(t),p.selectedValue=t,p.condition=t):(m.value="",m.checked=!1),(void 0===t||-1===t.indexOf("NULL")&&-1===t.indexOf("EMPTY"))&&-1===t.indexOf("THIS_WEEK")&&-1===t.indexOf("LAST_WEEK")&&-1===t.indexOf("NEXT_WEEK")&&-1===t.indexOf("THIS_MONTH")&&-1===t.indexOf("LAST_MONTH")&&-1===t.indexOf("NEXT_MONTH")&&-1===t.indexOf("THIS_YEAR")&&-1===t.indexOf("LAST_YEAR")&&-1===t.indexOf("NEXT_YEAR")&&-1===t.indexOf("TODAY")&&-1===t.indexOf("TOMORROW")&&-1===t.indexOf("YESTERDAY")||(m.value="",m.checked=!1,m.classList.add("smart-visibility-hidden")),p.dataSource&&p.dataSource.length<10?p.dropDownHeight="auto":p.dropDownHeight=250,m.animation=i.animation,m.classList.add("editor"),m.rightToLeft=i.rightToLeft,m.theme=i.theme,m.unfocusable=i.disabled||i.unfocusable,m.classList.add("underlined"),"boolean"!==e.dataType&&(m.placeholder=i.editorPlaceholder),i.editorCallback&&i.editorCallback(m,e),s.appendChild(p),s.appendChild(m),r.appendChild(s),r.className="smart-grid-panel-item",i._items.push(r),r.dataType=e.dataType,r}_localize(e){const t=this;t.$.addFilterButton.innerHTML=t.localize("add"),t.$.buttonsContainer.firstElementChild.innerHTML=t.localize("cancel"),t.$.buttonsContainer.children[1].innerHTML=t.localize("apply"),t.$.itemsContainer.setAttribute("no-filters",t.localize("noResults")),t.$.select.innerHTML='<span class="smart-icon smart-grid-icon smart-icon-sort-down show"></span>'+t.localize("select"),t.$.condition.innerHTML='<span class="smart-icon smart-grid-icon smart-icon-filter show"></span>'+t.localize("conditions"),t.$.condition.title=t.localize("colorRows"),t.$.select.title=t.localize("colorSelect"),t.$.conditionLabel.innerHTML=t.localize("colorRows"),t.$.singleSelectLabel.innerHTML=t.localize("colorsSingleSelect"),t.$.singleSelect.dropDownPlaceholder=t.localize("noOptions");const a="var(--smart-primary);";t.$.applyToInput.dataSource=[{label:t.localize("colorLeftBorderLabel"),value:"border",menuLabel:`<div style="flex-direction: column; display: inline-flex"><div>${t.localize("colorLeftBorderLabel")}</div><div class="smart-quiet">${t.localize("colorLeftBorder")}</div>`,prefix:'<span style="top: 8px; border-right: 3px solid '+a+'; padding: 2px; display: inline-block; margin-right: 16px; position: relative;">1</span>'},{label:t.localize("colorRowLabel"),value:"row",menuLabel:`<div style="flex-direction: column; display: inline-flex"><div>${t.localize("colorRowLabel")}</div><div class="smart-quiet">${t.localize("colorRow")}</div>`,prefix:'<span style="top: 8px; border: 1px solid var(--smart-primary); color: var(--smart-primary-color); background: '+a+'; padding: 2px; display: inline-block; margin-left:-4px; position: relative;">1</span><span style="border: 1px solid var(--smart-primary); color: var(--smart-primary-color); top: 8px; background: '+a+'; padding: 2px; display: inline-block; margin-right: 8px; position: relative;">2</span>'},{label:t.localize("colorCellLabel"),value:"cell",menuLabel:`<div style="flex-direction: column; display: inline-flex"><div>${t.localize("colorCellLabel")}</div><div class="smart-quiet">${t.localize("colorCell")}</div>`,prefix:'<span style="top: 8px; border: 1px solid var(--smart-primary); color: var(--smart-primary-color); background: '+a+'; padding: 2px; display: inline-block; margin-left:-4px; position: relative;">1</span><span style="border:1px solid '+a+'; padding: 2px; display: inline-block; top: 8px; margin-right: 8px; position: relative;">2</span>'}],t.$.applyToInput.selectedValue="border",t._stringConditions=[{prefix:'<span class="smart-icon smart-icon-empty"></span>',value:"EMPTY",label:t.localize("EMPTY")},{prefix:'<span class="smart-icon smart-icon-not-empty"></span>',value:"NOT_EMPTY",label:t.localize("NOT_EMPTY")},{prefix:'<span class="smart-icon smart-icon-contains"></span>',value:"CONTAINS",label:t.localize("CONTAINS")},{prefix:'<span class="smart-icon smart-icon-does-not-contain"></span>',value:"DOES_NOT_CONTAIN",label:t.localize("DOES_NOT_CONTAIN")},{prefix:'<span class="smart-icon smart-icon-starts-with"></span>',value:"STARTS_WITH",label:t.localize("STARTS_WITH")},{prefix:'<span class="smart-icon smart-icon-ends-with"></span>',value:"ENDS_WITH",label:t.localize("ENDS_WITH")},{prefix:'<span class="smart-icon smart-icon-equal"></span>',value:"EQUAL",label:t.localize("EQUAL")},{prefix:'<span class="smart-icon smart-icon-not-equal"></span>',value:"NOT_EQUAL",label:t.localize("NOT_EQUAL")},{prefix:'<span class="smart-icon smart-icon-null"></span>',value:"NULL",label:t.localize("NULL")},{prefix:'<span class="smart-icon smart-icon-not-null"></span>',value:"NOT_NULL",label:t.localize("NOT_NULL")}],t._enumConditions=[{prefix:'<span class="smart-icon smart-icon-equal"></span>',value:"EQUAL",label:t.localize("EQUAL")},{prefix:'<span class="smart-icon smart-icon-not-equal"></span>',value:"NOT_EQUAL",label:t.localize("NOT_EQUAL")}],t._dateConditions=[{prefix:'<span class="smart-icon smart-icon-equal"></span>',value:"EQUAL",label:t.localize("EQUAL")},{prefix:'<span class="smart-icon smart-icon-not-equal"></span>',value:"NOT_EQUAL",label:t.localize("NOT_EQUAL")},{prefix:'<span class="smart-icon smart-icon-less-than"></span>',value:"LESS_THAN",label:t.localize("LESS_THAN")},{prefix:'<span class="smart-icon smart-icon-less-than-equal"></span>',value:"LESS_THAN_OR_EQUAL",label:t.localize("LESS_THAN_OR_EQUAL")},{prefix:'<span class="smart-icon smart-icon-greater-than"></span>',value:"GREATER_THAN",label:t.localize("GREATER_THAN")},{prefix:'<span class="smart-icon smart-icon-greater-than-equal"></span>',value:"GREATER_THAN_OR_EQUAL",label:t.localize("GREATER_THAN_OR_EQUAL")},{prefix:'<span class="smart-icon smart-icon-null"></span>',value:"NULL",label:t.localize("NULL")},{prefix:'<span class="smart-icon smart-icon-not-null"></span>',value:"NOT_NULL",label:t.localize("NOT_NULL")},{prefix:'<span class="smart-icon smart-icon-calendar"></span>',value:"TOMORROW",label:t.localize("TOMORROW")},{prefix:'<span class="smart-icon smart-icon-calendar"></span>',value:"TODAY",label:t.localize("TODAY")},{prefix:'<span class="smart-icon smart-icon-calendar"></span>',value:"YESTERDAY",label:t.localize("YESTERDAY")},{prefix:'<span class="smart-icon smart-icon-calendar"></span>',value:"NEXT_WEEK",label:t.localize("NEXT_WEEK")},{prefix:'<span class="smart-icon smart-icon-calendar"></span>',value:"THIS_WEEK",label:t.localize("THIS_WEEK")},{prefix:'<span class="smart-icon smart-icon-calendar"></span>',value:"LAST_WEEK",label:t.localize("LAST_WEEK")},{prefix:'<span class="smart-icon smart-icon-calendar"></span>',value:"NEXT_MONTH",label:t.localize("NEXT_MONTH")},{prefix:'<span class="smart-icon smart-icon-calendar"></span>',value:"THIS_MONTH",label:t.localize("THIS_MONTH")},{prefix:'<span class="smart-icon smart-icon-calendar"></span>',value:"LAST_MONTH",label:t.localize("LAST_MONTH")}],t._numberAndDateConditions=[{prefix:'<span class="smart-icon smart-icon-equal"></span>',value:"EQUAL",label:t.localize("EQUAL")},{prefix:'<span class="smart-icon smart-icon-not-equal"></span>',value:"NOT_EQUAL",label:t.localize("NOT_EQUAL")},{prefix:'<span class="smart-icon smart-icon-less-than"></span>',value:"LESS_THAN",label:t.localize("LESS_THAN")},{prefix:'<span class="smart-icon smart-icon-less-than-equal"></span>',value:"LESS_THAN_OR_EQUAL",label:t.localize("LESS_THAN_OR_EQUAL")},{prefix:'<span class="smart-icon smart-icon-greater-than"></span>',value:"GREATER_THAN",label:t.localize("GREATER_THAN")},{prefix:'<span class="smart-icon smart-icon-greater-than-equal"></span>',value:"GREATER_THAN_OR_EQUAL",label:t.localize("GREATER_THAN_OR_EQUAL")},{prefix:'<span class="smart-icon smart-icon-null"></span>',value:"NULL",label:t.localize("NULL")},{prefix:'<span class="smart-icon smart-icon-not-null"></span>',value:"NOT_NULL",label:t.localize("NOT_NULL")}],t._booleanConditions=[{prefix:'<span class="smart-icon smart-icon-equal"></span>',value:"EQUAL",label:t.localize("EQUAL")},{prefix:'<span class="smart-icon smart-icon-not-equal"></span>',value:"NOT_EQUAL",label:t.localize("NOT_EQUAL")},{prefix:'<span class="smart-icon smart-icon-null"></span>',value:"NULL",label:t.localize("NULL")},{prefix:'<span class="smart-icon smart-icon-not-null"></span>',value:"NOT_NULL",label:t.localize("NOT_NULL")}],e&&t._items.forEach(((e,a)=>{const l=e.children[1],n=e.children[3];0===a?l.innerHTML="":1===a?(l.dataSource=[{value:"and",label:t.localize("and")},{value:"or",label:t.localize("or")}],l.value=t.localize(t.operator)):l.innerHTML=t.localize(t.operator),"string"!==e.dataType||e.options?"enum"===e.dataType||e.options?n.dataSource=t._enumConditions:"boolean"===e.dataType?n.dataSource=t._booleanConditions:"date"===e.dataType?n.dataSource=t._dateConditions:n.dataSource=t._numberAndDateConditions:n.dataSource=t._stringConditions,n.value=n.condition?t.localize(n.condition):""}))}_setFocusable(e){const t=this,a=t.disabled||t.unfocusable?-1:0;if(t.$.addFilterButton.tabIndex=a,t.$.buttonsContainer.firstElementChild.tabIndex=a,t.$.buttonsContainer.children[1].tabIndex=a,e){const e=Array.from(t.$.itemsContainer.getElementsByClassName("smart-grid-panel-item-close-button")),l=Array.from(t.$.itemsContainer.querySelectorAll("smart-date-time-picker, smart-numeric-text-box, smart-check-box, smart-input"));e.forEach((e=>e.tabIndex=a)),l.forEach((e=>e.unfocusable=t.disabled||t.unfocusable))}}});
1555
1555
 
1556
1556
  /***/ }),
1557
1557
 
@@ -1882,7 +1882,7 @@ var __webpack_exports__ = {};
1882
1882
  /* harmony import */ var _smart_grid_core_js__WEBPACK_IMPORTED_MODULE_61__ = __webpack_require__(5306);
1883
1883
  /* harmony import */ var _smart_grid_core_js__WEBPACK_IMPORTED_MODULE_61___default = /*#__PURE__*/__webpack_require__.n(_smart_grid_core_js__WEBPACK_IMPORTED_MODULE_61__);
1884
1884
 
1885
- /* Smart UI v19.0.2 (2024-04-22)
1885
+ /* Smart UI v19.0.5 (2024-04-23)
1886
1886
  Copyright (c) 2011-2024 jQWidgets.
1887
1887
  License: https://htmlelements.com/license/ */ //
1888
1888