smart-webcomponents-react 23.0.0 → 23.1.1

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 (221) hide show
  1. package/editor/editor.d.ts +5 -5
  2. package/editor/editor.esm.js +1 -1
  3. package/editor/editor.umd.js +1 -1
  4. package/grid/grid.d.ts +5 -5
  5. package/grid/grid.esm.js +1 -1
  6. package/grid/grid.umd.js +1 -1
  7. package/index.d.ts +4 -4
  8. package/package.json +1 -1
  9. package/source/modules/smart.3dchart.js +2 -2
  10. package/source/modules/smart.accordion.js +2 -2
  11. package/source/modules/smart.array.js +2 -2
  12. package/source/modules/smart.barcode.js +2 -2
  13. package/source/modules/smart.breadcrumb.js +2 -2
  14. package/source/modules/smart.button.js +2 -2
  15. package/source/modules/smart.buttongroup.js +2 -2
  16. package/source/modules/smart.calendar.js +2 -2
  17. package/source/modules/smart.card.js +2 -2
  18. package/source/modules/smart.cardview.js +2 -2
  19. package/source/modules/smart.carousel.js +2 -2
  20. package/source/modules/smart.chart.js +2 -2
  21. package/source/modules/smart.checkbox.js +2 -2
  22. package/source/modules/smart.checkinput.js +2 -2
  23. package/source/modules/smart.chip.js +2 -2
  24. package/source/modules/smart.colorinput.js +2 -2
  25. package/source/modules/smart.colorpanel.js +2 -2
  26. package/source/modules/smart.colorpicker.js +2 -2
  27. package/source/modules/smart.combobox.js +2 -2
  28. package/source/modules/smart.common.js +2 -2
  29. package/source/modules/smart.countryinput.js +2 -2
  30. package/source/modules/smart.dateinput.js +2 -2
  31. package/source/modules/smart.daterangeinput.js +2 -2
  32. package/source/modules/smart.datetimepicker.js +2 -2
  33. package/source/modules/smart.dockinglayout.js +2 -2
  34. package/source/modules/smart.dropdownbutton.js +2 -2
  35. package/source/modules/smart.dropdownlist.js +2 -2
  36. package/source/modules/smart.editor.js +3 -3
  37. package/source/modules/smart.element.js +2 -2
  38. package/source/modules/smart.fileupload.js +2 -2
  39. package/source/modules/smart.form.js +2 -2
  40. package/source/modules/smart.formulaparser.js +2 -2
  41. package/source/modules/smart.ganttchart.js +4 -4
  42. package/source/modules/smart.gauge.js +2 -2
  43. package/source/modules/smart.grid.js +4 -4
  44. package/source/modules/smart.gridpanel.js +3 -3
  45. package/source/modules/smart.gridview.js +5 -5
  46. package/source/modules/smart.input.js +2 -2
  47. package/source/modules/smart.kanban.js +3 -3
  48. package/source/modules/smart.layout.js +2 -2
  49. package/source/modules/smart.led.js +2 -2
  50. package/source/modules/smart.listbox.js +2 -2
  51. package/source/modules/smart.listmenu.js +2 -2
  52. package/source/modules/smart.map.js +2 -2
  53. package/source/modules/smart.maskedtextbox.js +2 -2
  54. package/source/modules/smart.menu.js +2 -2
  55. package/source/modules/smart.multicomboinput.js +2 -2
  56. package/source/modules/smart.multiinput.js +2 -2
  57. package/source/modules/smart.multilinetextbox.js +2 -2
  58. package/source/modules/smart.multisplitbutton.js +2 -2
  59. package/source/modules/smart.numberinput.js +2 -2
  60. package/source/modules/smart.numerictextbox.js +2 -2
  61. package/source/modules/smart.pager.js +2 -2
  62. package/source/modules/smart.passwordinput.js +2 -2
  63. package/source/modules/smart.passwordtextbox.js +2 -2
  64. package/source/modules/smart.path.js +2 -2
  65. package/source/modules/smart.phoneinput.js +2 -2
  66. package/source/modules/smart.pivottable.js +3 -3
  67. package/source/modules/smart.progressbar.js +2 -2
  68. package/source/modules/smart.qrcode.js +2 -2
  69. package/source/modules/smart.querybuilder.js +2 -2
  70. package/source/modules/smart.radiobutton.js +2 -2
  71. package/source/modules/smart.rating.js +2 -2
  72. package/source/modules/smart.ribbon.js +2 -2
  73. package/source/modules/smart.router.js +2 -2
  74. package/source/modules/smart.scheduler.js +2 -2
  75. package/source/modules/smart.scrollbar.js +2 -2
  76. package/source/modules/smart.slider.js +2 -2
  77. package/source/modules/smart.sortable.js +2 -2
  78. package/source/modules/smart.splitter.js +2 -2
  79. package/source/modules/smart.switchbutton.js +2 -2
  80. package/source/modules/smart.table.js +3 -3
  81. package/source/modules/smart.tabs.js +2 -2
  82. package/source/modules/smart.tank.js +2 -2
  83. package/source/modules/smart.textarea.js +2 -2
  84. package/source/modules/smart.textbox.js +2 -2
  85. package/source/modules/smart.timeinput.js +2 -2
  86. package/source/modules/smart.timeline.js +2 -2
  87. package/source/modules/smart.timepicker.js +2 -2
  88. package/source/modules/smart.toast.js +2 -2
  89. package/source/modules/smart.tooltip.js +2 -2
  90. package/source/modules/smart.tree.js +2 -2
  91. package/source/modules/smart.validator.js +2 -2
  92. package/source/modules/smart.window.js +2 -2
  93. package/source/smart.3dchart.js +1 -1
  94. package/source/smart.accordion.js +1 -1
  95. package/source/smart.ajax.js +1 -1
  96. package/source/smart.array.js +1 -1
  97. package/source/smart.barcode.js +1 -1
  98. package/source/smart.bootstrap.js +1 -1
  99. package/source/smart.breadcrumb.js +1 -1
  100. package/source/smart.button.js +1 -1
  101. package/source/smart.buttongroup.js +1 -1
  102. package/source/smart.calendar.js +1 -1
  103. package/source/smart.card.js +1 -1
  104. package/source/smart.cardview.js +1 -1
  105. package/source/smart.carousel.js +1 -1
  106. package/source/smart.chart.annotations.js +1 -1
  107. package/source/smart.chart.api.js +1 -1
  108. package/source/smart.chart.core.js +1 -1
  109. package/source/smart.chart.js +1 -1
  110. package/source/smart.chart.rangeselector.js +1 -1
  111. package/source/smart.chart.waterfall.js +1 -1
  112. package/source/smart.checkbox.js +1 -1
  113. package/source/smart.checkinput.js +1 -1
  114. package/source/smart.chip.js +1 -1
  115. package/source/smart.colorinput.js +1 -1
  116. package/source/smart.colorpanel.js +1 -1
  117. package/source/smart.colorpicker.js +1 -1
  118. package/source/smart.combobox.js +1 -1
  119. package/source/smart.complex.js +1 -1
  120. package/source/smart.core.js +1 -1
  121. package/source/smart.countryinput.js +1 -1
  122. package/source/smart.data.js +1 -1
  123. package/source/smart.date.js +1 -1
  124. package/source/smart.dateformatpanel.js +1 -1
  125. package/source/smart.dateinput.js +1 -1
  126. package/source/smart.daterangeinput.js +1 -1
  127. package/source/smart.datetimepicker.js +1 -1
  128. package/source/smart.dockinglayout.js +1 -1
  129. package/source/smart.draw.js +1 -1
  130. package/source/smart.dropdownbutton.js +1 -1
  131. package/source/smart.dropdownlist.js +1 -1
  132. package/source/smart.editor.js +2 -2
  133. package/source/smart.element.js +1 -1
  134. package/source/smart.elements.js +7 -7
  135. package/source/smart.export.js +1 -1
  136. package/source/smart.fileupload.js +1 -1
  137. package/source/smart.filter.js +1 -1
  138. package/source/smart.filterbuilder.js +1 -1
  139. package/source/smart.filterpanel.js +1 -1
  140. package/source/smart.form.js +1 -1
  141. package/source/smart.format.js +1 -1
  142. package/source/smart.formulaparser.js +1 -1
  143. package/source/smart.ganttchart.js +2 -2
  144. package/source/smart.gauge.js +1 -1
  145. package/source/smart.grid.cell.js +1 -1
  146. package/source/smart.grid.chart.js +1 -1
  147. package/source/smart.grid.column.js +1 -1
  148. package/source/smart.grid.core.js +2 -2
  149. package/source/smart.grid.dialog.js +1 -1
  150. package/source/smart.grid.edit.js +1 -1
  151. package/source/smart.grid.export.js +2 -2
  152. package/source/smart.grid.filter.js +1 -1
  153. package/source/smart.grid.group.js +1 -1
  154. package/source/smart.grid.js +1 -1
  155. package/source/smart.grid.menu.js +1 -1
  156. package/source/smart.grid.pager.js +1 -1
  157. package/source/smart.grid.reorder.js +1 -1
  158. package/source/smart.grid.resize.js +1 -1
  159. package/source/smart.grid.row.js +1 -1
  160. package/source/smart.grid.select.js +1 -1
  161. package/source/smart.grid.sort.js +1 -1
  162. package/source/smart.grid.toolbar.js +1 -1
  163. package/source/smart.grid.tree.js +1 -1
  164. package/source/smart.grid.view.js +1 -1
  165. package/source/smart.gridpanel.js +1 -1
  166. package/source/smart.input.js +1 -1
  167. package/source/smart.kanban.js +2 -2
  168. package/source/smart.layout.js +1 -1
  169. package/source/smart.led.js +1 -1
  170. package/source/smart.listbox.js +1 -1
  171. package/source/smart.listmenu.js +1 -1
  172. package/source/smart.map.js +1 -1
  173. package/source/smart.maskedtextbox.js +1 -1
  174. package/source/smart.math.js +1 -1
  175. package/source/smart.menu.js +1 -1
  176. package/source/smart.multicomboinput.js +1 -1
  177. package/source/smart.multiinput.js +1 -1
  178. package/source/smart.multilinetextbox.js +1 -1
  179. package/source/smart.multisplitbutton.js +1 -1
  180. package/source/smart.numberformatpanel.js +1 -1
  181. package/source/smart.numberinput.js +1 -1
  182. package/source/smart.numeric.js +1 -1
  183. package/source/smart.numerictextbox.js +1 -1
  184. package/source/smart.pager.js +1 -1
  185. package/source/smart.passwordinput.js +1 -1
  186. package/source/smart.passwordtextbox.js +1 -1
  187. package/source/smart.path.js +1 -1
  188. package/source/smart.phoneinput.js +1 -1
  189. package/source/smart.pivottable.js +1 -1
  190. package/source/smart.powerbutton.js +1 -1
  191. package/source/smart.progressbar.js +1 -1
  192. package/source/smart.qrcode.js +1 -1
  193. package/source/smart.radiobutton.js +1 -1
  194. package/source/smart.rating.js +1 -1
  195. package/source/smart.ribbon.js +1 -1
  196. package/source/smart.router.js +1 -1
  197. package/source/smart.scheduler.js +1 -1
  198. package/source/smart.scrollbar.js +1 -1
  199. package/source/smart.slider.js +1 -1
  200. package/source/smart.sortable.js +1 -1
  201. package/source/smart.sparkline.js +1 -1
  202. package/source/smart.splitter.js +1 -1
  203. package/source/smart.switchbutton.js +1 -1
  204. package/source/smart.table.js +2 -2
  205. package/source/smart.tabs.js +1 -1
  206. package/source/smart.tank.js +1 -1
  207. package/source/smart.textarea.js +1 -1
  208. package/source/smart.textbox.js +1 -1
  209. package/source/smart.tickintervalhandler.js +1 -1
  210. package/source/smart.timeinput.js +1 -1
  211. package/source/smart.timeline.js +1 -1
  212. package/source/smart.timepicker.js +1 -1
  213. package/source/smart.toast.js +1 -1
  214. package/source/smart.tooltip.js +1 -1
  215. package/source/smart.tree.js +1 -1
  216. package/source/smart.validationpanel.js +1 -1
  217. package/source/smart.validator.js +1 -1
  218. package/source/smart.window.js +1 -1
  219. package/source/typescript/smart.editor.d.ts +2 -2
  220. package/source/typescript/smart.elements.d.ts +4 -4
  221. package/source/typescript/smart.grid.d.ts +2 -2
@@ -1,5 +1,5 @@
1
1
 
2
- /* Smart UI v23.0.8 (2025-05-13)
2
+ /* Smart UI v23.1.1 (2025-05-29)
3
3
  Copyright (c) 2011-2024 jQWidgets.
4
4
  License: https://htmlelements.com/license/ */ //
5
5
 
@@ -1492,7 +1492,7 @@ Smart.Utilities.Assign("Grid.Column",class{constructor(t){const e=this;"string"!
1492
1492
  /***/ 5306:
1493
1493
  /***/ (() => {
1494
1494
 
1495
- Smart("smart-grid",class extends Smart.ScrollViewer{static get properties(){return{ai:{type:"any",reflectToAttribute:!1,value:{model:{value:"gpt-3.5-turbo",type:"string"},maxTokens:{value:200,type:"number"},temperature:{value:.7,type:"number"},url:{value:"",type:"string"},key:{value:"",type:"string"}}},appearance:{value:{alternationStart:{value:0,type:"int"},alternationEnd:{value:0,type:"int"},alternationCount:{value:0,type:"int"},allowHover:{value:!1,type:"boolean",defaultReflectToAttribute:!0},allowHeaderHover:{value:!0,type:"boolean",defaultReflectToAttribute:!0},allowRowToggleAnimation:{value:!1,type:"boolean"},allowRowDetailToggleAnimation:{value:!1,type:"boolean"},allowSortAnimation:{value:!1,type:"boolean"},allowColumnLabelAnimation:{value:!0,type:"boolean"},allowCheckBoxesSelectionAnimation:{value:!0,type:"boolean"},allowColumnMenuAnimation:{value:!0,type:"boolean"},allowColumnSortButtonAnimation:{value:!0,type:"boolean"},allowColumnActionButtonAnimation:{value:!0,type:"boolean"},allowColumnFilterButtonAnimation:{value:!0,type:"boolean"},allowColumnStickyPosition:{value:!1,type:"boolean"},autoShowColumnSortButton:{value:!0,type:"boolean"},autoShowColumnActionButton:{value:!0,type:"boolean"},autoGenerateRowLabelMode:{value:"number",type:"string"},autoGenerateColumnLabelMode:{value:"letter",type:"string"},autoShowColumnFilterButton:{value:!0,type:"boolean"},cardTitleField:{value:"",type:"string"},displayLoadingIndicator:{value:!1,type:"boolean"},loadingIndicatorPlaceholder:{value:"Loading...",type:"string"},placeholder:{value:"No Rows",type:"string"},sortAnimationDuration:{value:500,type:"number"},showRowHeader:{value:!1,type:"boolean"},showRowStatus:{value:!1,type:"boolean"},showRowEditDialogDetails:{value:!1,type:"boolean"},showRowComments:{value:!1,type:"boolean"},showRowHeaderNumber:{value:!1,type:"boolean"},showRowHeaderEditIcon:{value:!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"},allowRenderCache:{value:!0,type:"boolean"},doubleClickTimingDelay:{value:300,type:"number"},columnResizeMode:{value:"none",type:"string",allowedValues:["none","split","growAndShrink"]},rowResizeMode:{value:"none",type:"string",allowedValues:["none","split","growAndShrink"]}},type:"object"},layout:{value:{autoWrap:{value:!0,type:"boolean"},autoWidth:{value:!1,type:"boolean"},autoHeight:{value:!1,type:"boolean"},allowCellsWrap:{value:!1,type:"boolean"},allowCellsWrapShortcut:{value:!0,type:"boolean"},autoGenerateColumnWidth:{value:null,type:"number?"},autoSizeNewColumn:{value:!1,type:"boolean",reflectToAttribute:!1},autoSizeNewColumnMinWidth:{value:180,type:"number",reflectToAttribute:!1},cardMinWidth:{value:250,type:"any",reflectToAttribute:!1},cardRowMinHeight:{value:45,type:"any",reflectToAttribute:!1},cardsPerRow:{value:"auto",type:"any",reflectToAttribute:!1},cardVertical:{value:!0,type:"boolean",reflectToAttribute:!1},columnWidth:{value:null,type:"any",reflectToAttribute:!1},columnHeight:{value:null,type:"any",reflectToAttribute:!1},columnMinHeight:{value:30,type:"any",reflectToAttribute:!1},dropDownWidth:{value:700,type:"any",reflectToAttribute:!1},dropDownHeight:{value:500,type:"any",reflectToAttribute:!1},isDirty:{value:!1,type:"boolean"},loadingIndicatorPosition:{value:"center",allowedValues:["bottom","center","top"],type:"string"},rowMinHeight:{value:30,type:"number"},rowHeight:{value:null,type:"any",reflectToAttribute:!1},viewBarWidth:{value:200,type:"number"}},type:"object"},dataExport:{value:{header:{value:!0,type:"boolean"},filterBy:{value:null,type:"object"},groupBy:{value:null,type:"object"},style:{value:null,type:"any"},fileName:{value:"SmartGrid",type:"string?"},pageOrientation:{value:"portrait",type:"string"},expandChar:{value:"+",type:"string"},collapseChar:{value:"-",type:"string"},view:{value:!1,type:"boolean"},viewStart:{value:null,type:"number?"},viewEnd:{value:null,type:"number?"},rowIds:{value:null,type:"array?"},headerContent:{value:null,type:"any",reflectToAttribute:!1},footerContent:{value:null,type:"any",reflectToAttribute:!1},addImageToCell:{value:null,type:"any",reflectToAttribute:!1},setRowHeight:{value:null,type:"any",reflectToAttribute:!1},cellFormatFunction:{value:null,type:"any",reflectToAttribute:!1},autoConvertFormulas:{value:!0,type:"boolean"},freezeHeader:{value:!1,type:"boolean"},onlySelected:{value:!1,type:"boolean"},exportAsTable:{value:!1,type:"boolean"},exportStyles:{value:!0,type:"boolean"},formatData:{value:null,type:"any",reflectToAttribute:!1},getSpreadsheets:{value:null,type:"any",reflectToAttribute:!1}},type:"object"},clipboard:{value:{enabled:{value:!0,type:"boolean"},copyHeadersToClipboard:{value:!1,type:"boolean"},autoFillMode:{value:"copy",allowedValues:["none","copy","fillSeries"],type:"string"},onPasteValue:{value:null,type:"any"}},type:"object"},conditionalFormatting:{value:null,type:"array?",reflectToAttribute:!1},columns:{value:[],type:"any",reflectToAttribute:!1},contextMenu:{value:{selector:{value:"",type:"string"},enabled:{value:!1,type:"boolean"},width:{value:"auto",type:"any"},height:{value:null,type:"any"},customContextMenuItems:{value:null,type:"any"},dataSource:{value:{contextMenuItemSelectRow:{value:{command:{value:"contextMenuItemSelectRowCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:!0,type:"boolean"},icon:{value:"smart-icon-check-squared",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},contextMenuItemExpand:{value:{command:{value:"contextMenuItemExpandCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:!1,type:"boolean"},icon:{value:"smart-icon-resize-full",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},contextMenuItemInsertRow:{value:{command:{value:"contextMenuItemInsertRowCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:!1,type:"boolean"},icon:{value:"smart-icon-plus",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},contextMenuItemCloneRow:{value:{command:{value:"contextMenuItemCloneRowCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:!1,type:"boolean"},icon:{value:"smart-icon-duplicate",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},contextMenuItemDelete:{value:{command:{value:"contextMenuItemDeleteCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:!1,type:"boolean"},icon:{value:"smart-icon-delete",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},contextMenuItemEdit:{value:{command:{value:"contextMenuItemEditCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:!1,type:"boolean"},icon:{value:"smart-icon-mode-edit",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},contextMenuItemCut:{value:{command:{value:"contextMenuItemCutCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:!1,type:"boolean"},icon:{value:"smart-icon-cut",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},contextMenuItemCopy:{value:{command:{value:"contextMenuItemCopyCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:!1,type:"boolean"},icon:{value:"smart-icon-copy-record",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},contextMenuItemPaste:{value:{command:{value:"contextMenuItemPasteCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:!1,type:"boolean"},icon:{value:"smart-icon-paste",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},contextMenuItemClear:{value:{command:{value:"contextMenuItemClearCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:!1,type:"boolean"},icon:{value:"smart-icon-close",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},contextMenuItemComment:{value:{command:{value:"contextMenuItemAddCommentCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:!1,type:"boolean"},icon:{value:"smart-icon-comment",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},contextMenuItemCustom:{value:{command:{value:null,type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:!1,type:"boolean"},icon:{value:"smart-icon-settings",type:"string"},label:{value:"",type:"string"}},type:"object",reflectToAttribute:!1}},type:"object",reflectToAttribute:!1}},type:"object",reflectToAttribute:!1},columnMenu:{value:{autoClose:{value:!0,type:"boolean"},dataSource:{value:{columnMenuCustomizeType:{value:{command:{value:"customizeTypeCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:!1,type:"any"},icon:{value:"smart-icon-settings",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},columnMenuItemClone:{value:{command:{value:"duplicateCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:!1,type:"any"},icon:{value:"smart-icon-duplicate",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},columnMenuItemInsert:{value:{command:{value:"insertRightCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:!1,type:"any"},icon:{value:"smart-icon-plus",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},columnMenuItemSortAsc:{value:{command:{value:"sortAscCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:"auto",type:"any"},icon:{value:"smart-icon-sort-name-up",type:"string"},iconAlt:{value:"smart-icon-sort-number-up",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},columnMenuItemSortDesc:{value:{command:{value:"sortDescCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:"auto",type:"any"},icon:{value:"smart-icon-sort-name-down",type:"string"},iconAlt:{value:"smart-icon-sort-number-down",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},columnMenuItemRemoveSort:{value:{command:{value:"removeSortCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:"auto",type:"any"},icon:{value:"smart-icon-cancel-circled",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},columnMenuItemSort:{value:{command:{value:"addSortCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:"auto",type:"any"},icon:{value:"smart-icon-sort",type:"string"},iconAlt:{value:"smart-icon-sort",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},columnMenuItemFilter:{value:{command:{value:"addFilterCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:"auto",type:"any"},icon:{value:"smart-icon-add-filter",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},columnMenuItemRemoveFilter:{value:{command:{value:"removeFilterCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:"auto",type:"any"},icon:{value:"smart-icon-cancel-circled",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},columnMenuItemGroupBy:{value:{command:{value:"groupByCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:"auto",type:"any"},icon:{value:"smart-icon-group",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},columnMenuItemRemoveGroupBy:{value:{command:{value:"removeGroupByCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:"auto",type:"any"},icon:{value:"smart-icon-ungroup",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},columnMenuItemHide:{value:{command:{value:"hideColumnCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:!1,type:"any"},icon:{value:"smart-icon-visibility-off",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},columnMenuItemDelete:{value:{command:{value:"deleteColumnCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:!1,type:"any"},icon:{value:"smart-icon-delete",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1}},type:"object",reflectToAttribute:!1},visible:{value:!1,type:"boolean"},enabled:{value:!0,type:"boolean"},width:{value:250,type:"number"},height:{value:null,type:"number?"}},type:"object",reflectToAttribute:!1},columnGroups:{value:[],type:"array",reflectToAttribute:!1},charting:{value:{appendTo:{value:null,type:"any"},enabled:{value:!1,type:"boolean"},colorScheme:{value:"scheme01",type:"string"},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","scheduler","timeline"],type:"string"},currentUser:{value:null,type:"any",reflectToAttribute:!1},dropDownMode:{value:!1,type:"boolean",reflectToAttribute:!1},dropDownModeDataField:{value:"",type:"string",reflectToAttribute:!1},dataSource:{value:null,type:"any",reflectToAttribute:!1},dataSourceMap:{value:{checklist:"checklist",color:"color",comments:"comments",dueDate:"dueDate",id:"id",priority:"priority",progress:"progress",startDate:"startDate",status:"status",swimlane:"swimlane",tags:"tags",text:"text",description:"description",userId:"userId",history:"history",createdUserId:"createdUserId",createdDate:"createdDate",updatedUserId:"updatedUserId",updatedDate:"updatedDate"},type:"any",reflectToAttribute:!1},dataSourceSettings:{value:{autoGenerateColumns:{value:!1,type:"boolean"},sanitizeHTML:{value:"blackList",allowedValues:["all","blackList","none"],type:"string"},root:{value:"",type:"string"},record:{value:"",type:"string"},keyDataField:{value:"",type:"string"},parentDataField:{value:"",type:"string"},childrenDataField:{value:"",type:"string"},groupBy:{value:[],type:"array"},dataFields:{value:[],type:"array"},mapChar:{value:".",type:"string"},id:{value:"",type:"string"},relations:{value:[],type:"any",reflectToAttribute:!1},virtualDataSource:{value:null,type:"any"},virtualDataSourceOnExpand:{value:null,type:"any"}},type:"object"},formulas:{value:!1,type:"boolean"},highlighted:{value:-1,type:"any"},uploadSettings:{value:{url:{value:"",type:"string",reflectToAttribute:!1},removeUrl:{value:"",type:"string",reflectToAttribute:!1},existsUrl:{value:"",type:"string",reflectToAttribute:!1},name:{value:"userfile[]",type:"string",reflectToAttribute:!1},uploadMaxCount:{value:5,type:"number",reflectToAttribute:!1},uploadMaxSize:{value:2097152,type:"number",reflectToAttribute:!1},data:{value:null,type:"object",reflectToAttribute:!1},onUploadStarted:{value:null,type:"any",reflectToAttribute:!1},onUploadCompleted:{value:null,type:"any",reflectToAttribute:!1},onUploadRemove:{value:null,type:"any",reflectToAttribute:!1},onUploadError:{value:null,type:"any",reflectToAttribute:!1},onChange:{value:null,type:"any",reflectToAttribute:!1},onProgress:{value:null,type:"any",reflectToAttribute:!1},onAbort:{value:null,type:"any",reflectToAttribute:!1},onError:{value:null,type:"any",reflectToAttribute:!1},onSetHeaders:{value:null,type:"any",reflectToAttribute:!1},singleFilePost:{value:!0,type:"boolean",reflectToAttribute:!1},userFiles:{value:[],type:"array",reflectToAttribute:!1}},reflectToAttribute:!1,type:"object"},grouping:{value:{enabled:{value:!1,type:"boolean",reflectToAttribute:!1},allowCollapse:{value:!1,type:"boolean",reflectToAttribute:!1},autoHideGroupColumn:{value:!1,type:"boolean",reflectToAttribute:!1},autoExpandAll:{value:!1,type:"boolean",reflectToAttribute:!1},autoExpandToLevel:{value:0,type:"number",reflectToAttribute:!1},onGroupDefaultExpanded:{value:null,type:"any",reflectToAttribute:!1},expandMode:{value:"buttonClick",type:"string",allowedValues:["buttonClick","rowClick"],reflectToAttribute:!1},renderMode:{type:"string",value:"advanced",allowedValues:["basic","compact","advanced","multipleColumns"]},groupBy:{value:[],type:"array",reflectToAttribute:!1},groupRowHeight:{value:50,type:"any",reflectToAttribute:!1},toggleButtonIndent:{value:27,type:"number",reflectToAttribute:!1},groupIndent:{value:27,type:"number",reflectToAttribute:!1},groupBar:{value:{visible:{value:!1,type:"boolean",reflectToAttribute:!1},allowColumnDragDrop:{value:!0,type:"boolean",reflectToAttribute:!0},allowColumnCloseButtons:{value:!0,type:"boolean",reflectToAttribute:!0}},type:"object"},formatFunction:{value:null,type:"any",reflectToAttribute:!1},summaryRow:{value:{inline:{value:!0,type:"boolean"},visible:{value:!0,type:"boolean"}},type:"object"}},type:"object"},keys:{value:null,reflectToAttribute:!1,type:"any"},messages:{extend:!0,value:{en:{invalidColumnProperty:'{{elementType}}: Invalid property name "{{propertyName}}" set for Column: "{{type}}"',invalidRowProperty:'{{elementType}}: Invalid property name "{{propertyName}}" set for Row"',invalidCellValue:'Invalid cell value "{{value}}", Validation rule: "{{validationRule}}"',invalidValue:"Invalid value",invalidMinValue:"{{value}} above {{min}} must be filled out",invalidMaxValue:"{{value}} below {{max}} must be filled out",invalidMinLengthValue:"{{value}} is shorter than the minimum length of {{min}} characters",invalidMaxLengthValue:"{{value}} is longer than the maximum length of {{max}} characters",requiredValue:"{{value}} must be filled out",frozenColumns:"{{elementType}}: To Pin/Freeze a column group, all columns within it should be frozen.",frozenRows:"{{elementType}}: To Pin/Freeze a special cell, all rows within it should be frozen.",columnGroups:"{{elementType}}: Please, check the initialization of the SmartGrid's columns array. The columns in a column group are expected to be siblings in the columns array.",viewGrid:"Grid",viewKanban:"Kanban",viewCard:"Cards",viewScheduler:"Calendar",viewTimeline:"Timeline",kanbanNone:"Blank",schedulerDescription:"Which date column would you like to use for this view? Your data would be placed based on the dates in this column.",schedulerDescriptionInfo:"A range of data would be displayed when a start date field has an associated due date field.",kanbanDescription:'Start from a project board with columns generated by the "{{column}}" column options.',kanbanNoneDescription:"Create a new column and start from scratch with a completely blank project board. You can add columns and configure settings yourself.",kanbanBasic:"Template",kanbanBasicDescription:'Create a new column and start from a project board with columns for "To do", "in progress" and "Done".',schedulerDateColumn:"Create a new date column",schedulerPromptLabel:"Using date column(s)",schedulerDateRangeColumn:"Create a new date range",schedulerToolLabel:"Using '{{column}}'",toolLabel:"Labeled by '{{column}}'",uncategorized:"Uncategorized",toDo:"To do",inProgress:"In progress",done:"Done",min:"Min: {{value}}",max:"Max: {{value}} ",sum:"Sum: {{value}} ",avg:"Avg: {{value}} ",cells:"{{value}} cells selected",rows:"{{value}} rows",oneRow:"1 row",unique:"Unique: {{value}}",blank:"Empty: {{value}}",filled:"Filled: {{value}}",summary:"Summary",countSummary:"Count",minSummary:"Min",maxSummary:"Max",avgSummary:"Avg",blankSummary:"Empty",uniqueSummary:"Unique",filledSummary:"Filled",statusSummary:"Status",sumSummary:"Sum",completed:"Tasks Completed: {{value}}",count:"Count: {{value}} ",pagerFirstButton:"First",pagerLastButton:"Last",pagerPreviousButton:"Previous",pagerNextButton:"Next",pagerNavigateToLabel:"Go to:",pagerPageSizeLabel:"Show:",pagerNavigateToInputPlaceholder:"",pagerEllipsis:"...",pagerSummaryString:"of",pagerSummaryPrefix:"of",pagerSummarySuffix:"",columnMenuCustomizeType:"Column settings",columnMenuItemClone:"Clone column",columnMenuItemInsert:"Insert column",columnMenuItemSortAsc:"Sort {{mode}}",columnMenuItemSortDesc:"Sort {{mode}}",columnMenuItemRemoveSort:"Remove Sort",columnMenuItemFilter:"Filter column",columnMenuItemSort:"Sort column",columnMenuItemRemoveFilter:"Remove Filter",columnMenuItemGroupBy:"Group column",columnMenuItemRemoveGroupBy:"Remove Group",columnMenuItemHide:"Hide column",columnMenuItemShow:"Show column",columnMenuItemDelete:"Delete column",columnResizeTooltip:"width: {{value}}px",rowResizeTooltip:"height: {{value}}px",commandBarAddRow:"Add",commandBarDeleteRow:"Delete row",commandBarBatchRevert:"Revert",commandBarBatchSave:"Save",commandBarFilter:"Filter",commandBarSort:"Sort",commandBarSearch:"Search",commandBarCustomize:"Customize",commandBarGroup:"Group",commandColumnEdit:"Edit",commandColumnDelete:"Delete",commandColumnCancel:"Cancel",commandColumnUpdate:"Update",contextMenuItemDelete:"Delete row",contextMenuItemEditCell:"Edit cell",contextMenuItemEditRow:"Edit row",contextMenuItemSelectRow:"Select row",contextMenuItemCloneRow:"Clone row",contextMenuItemInsertRow:"Insert row",contextMenuItemAddRow:"Add {{value}} rows",commandColumnMenu:"",expandRow:"Expand row (Shift + Enter)",expandRowComments:"Expand row and see {{value}} comments",collapseRow:"Collapse row",addNewRow:"Click here to add a new row",addNewRowAlt:"<span>Add new empty row</span> <code>Ctrl</code> + <code>Space</code>",addNewRowAltSmall:"Add new empty row",addNewColumn:"Click here to add a new column",dialogChartHeader:"{{value}} Chart",dialogRowDetailHeader:"Row Id: {{value}}",dialogDescriptionHeader:"Column: {{value}}",dialogRowDetailButtonConfirm:"OK",dialogRowDetailButtonCancel:"CANCEL",dialogEditHeaderDisabled:"Row: {{value}}",dialogEditHeader:"Row: {{value}}",dialogEditHeaderMenu:"Toggle Sidebar",dialogExpandRowHeader:"Edit Record",dialogAddButtonConfirm:"ADD",dialogAddButtonCancel:"CANCEL",dialogEditButtonConfirm:"OK",dialogEditButtonSave:"Save",dialogEditButtonAutoSave:"Auto Save",dialogEditButtonCancel:"Cancel",dialogFilterButtonConfirm:"FILTER",dialogFilterButtonCancel:"CLEAR",dialogDeleteButtonConfirm:"DELETE",dialogDeleteButtonCancel:"CANCEL",dialogEditColumn:"Column: {{value}}",dialogNewColumn:"New column",dialogAddColumn:"Add Column",dialogAddColumnDate:"Choose a date column",dialogAddColumnStatus:"Choose a grouping column",dialogAddColumnStatusDescription:"Represent the status of each record",dialogAddColumnStatusNotes:"Your records will be grouped based on this column",dialogAddHeader:"Add Row",dialogDeleteHeader:"Delete Row",dialogFilterHeader:"Filter by",dialogFilterMinLabel:"Min",dialogFilterMaxLabel:"Max",dialogFileHeader:"File",dialogImageFileHeader:"Image",dialogFileDrop:"or drag and drop file(s) to upload",dialogFileUpload:"Select Files(s) to Upload",dialogFileURL:"You can also provide the URL to a file",dialogFileURLUpload:"Upload",dialogFileLink:"Link (URL)",dialogFileDevice:"My Device",dialogMyFiles:"My Files",dialogMyFilesTitle:"Select files from your already uploaded files.",dialogFileSize:'No file currently added. The "{{value}}" file cannot be uploaded. Maximum file size is {{fileSize}}.',dialogFileCount:'The following files cannot be added "{{files}}". Maximum files allowed is {{fileCount}}.',dialogFileFileUpload:"No files currently selected",dialogAddColumnName:"Name",dialogAddColumnNameInfo:"Name of the column. The name of the column will be displayed in the column header.",dialogAddColumnDescription:"Description",dialogAddColumnDescriptionInfo:"Description of the column. When the description is set, an icon will be displayed in the column header. A tooltip with the description will be displayed when you point at the icon.",dialogAddColumnNamePlaceholder:"Column name (optional)",dialogAddColumnDescriptionPlaceholder:"Describe this column (optional)",dialogAddColumnType:"Type",dialogAddColumnTypeInfo:'Type of the data in the column. Unlike a spreadsheet, Columns have specific "types" that allow you to store rich content in each record. For example, a table can contain records (rows) with images, long texts, checkboxes.',dialogAddColumnTypeText:"Text",dialogAddColumnTypeMultilineText:"Multiline text",dialogAddColumnTypeAIQuery:"AI Button",dialogAddColumnTypeSparklines:"Sparklines",dialogAddColumnAIQuery:"AI Query",dialogAddColumnTypeAIQueryInfo:"Example: Write a short description for an article or choose a column to query by it",dialogAddColumnTypeUUID:"UUID",dialogAddColumnTypeImage:"Image",dialogAddColumnTypeNumber:"Number",dialogAddColumnTypeSelect:"Select",dialogAddColumnTypeMultipleSelect:"Multiple select",dialogAddColumnTypeDate:"Date",dialogAddColumnTypeTime:"Time",dialogAddColumnTypeRating:"Rating",dialogAddColumnTypeDuration:"Duration",dialogAddColumnTypeCheckBox:"CheckBox",dialogAddColumnTypeCreatedTime:"Created time",dialogAddColumnTypeLastUpdatedTime:"Last modified time",dialogAddColumnTypeCreatedBy:"Created by",dialogAddColumnTypeLastUpdatedBy:"Last modified by",dialogAddColumnTypeCollaborator:"User",dialogAddColumnTypeFormula:"Formula",dialogAddColumnTypeFormulaInfo:'Example: COL(Name) & "-" & COL(Price) or IF(COL(Price) * COL(Quantity) > 5, "Yes", "No")',dialogAddColumnTypeSlider:"Slider",dialogAddColumnTypeStatus:"Choose a status column",dialogAddColumnTypeStatusInfo:"Connect with the relevant status column",dialogAddColumnTypeAutoNumber:"Auto number",dialogAddColumnTypeRowLink:"Link to table",dialogAddColumnTypeURL:"URL",dialogAddColumnTypeEmail:"Email",dialogAddColumnTypePassword:"Password",dialogAddColumnTypePhone:"Phone",dialogAddColumnTypeNone:"None",dialogAddColumnTypeStartDate:"Start Date",dialogAddColumnTypeDueDate:"Due Date",dialogAddColumnTypeDueDateSettings:"Set as a deadline",dialogAddColumnTypeDueDateSettingsInfo:"Set a deadline with start date or due date templates.",dialogAddColumnTypeProgress:"Progress",dialogAddColumnTypePriority:"Priority",dialogAddColumnTypeDescription:"Description",dialogAddColumnTypeTags:"Tags",dialogAddColumnTypeName:"Name",dialogAddColumnTypeColor:"Color",dialogAddColumnTypeChecklist:"Checklist",dialogAddColumnTypeAssigned:"Assignee",dialogAddColumnTypeAttachment:"Attachment",dialogAddColumnTypeVote:"Vote",dialogAddColumnDateFormat:"Date format",dialogAddColumnDateFormatInfo:"Choose the dates display format",dialogAddColumnDateFormatShort:"Short",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",dialogAddColumnDotItems:"Show Dots",dialogAddColumnCustomItems:"Custom Items",dialogAddColumnListItems:"List items",dialogAddColumnLinkListItems:"Choose a table to link to",dialogAddColumnLinkField:"Choose a lookup field",dialogAddColumnLinkFieldMore:"Cascading readonly fields",dialogAddColumnLinkSelect:"Allow linking to multiple rows",dialogAddColumnFormula:"Please enter a formula",dialogAddColumnListItemsError:"You cannot delete an item while in use.",dialogAddColumnListItemsEditError:"You cannot edit an item while in use.",dialogAddColumnDefault:"Default value",dialogAddColumnDefaultDateCurrent:"Current Date",dialogAddColumnDefaultDateSpecific:"Specific Date",dialogAddColumnAlign:"Align",dialogAddColumnAlignLeft:"Left",dialogAddColumnAlignRight:"Right",dialogAddColumnAlignCenter:"Center",dialogAddColumnAlignInfo:"Table cells text alignment",dialogAddColumnResizable:"Resizable",dialogAddColumnResizableInfo:"Select if you want to make the column resizable",dialogAddColumnRequired:"Required",dialogAddColumnRequiredInfo:"Select if you want to make the column required",dialogAddColumnSortable:"Sortable",dialogAddColumnSortableInfo:"Select if you want to sort by this column",dialogAddColumnFilterable:"Filterable",dialogAddColumnFilterableInfo:"Select if you want to filter by this column",dialogAddColumnEditable:"Editable",dialogAddColumnEditableInfo:"Select if you want to edit by this column",dialogAddColumnMultipleCollaborators:"Multiple Collaborators",dialogAddColumnMultipleCollaboratorsInfo:"Select if you want to allow multiple collaborators",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:"Color",formatingByMultiple:"{{n}} Colors",formatingOne:"1 color",formatingBy:"Colored by '{{value}}'",reset:"Reset",filteredRecords:"All rows are filtered",duplicateCells:"Clone column cells and settings",duplicateSettings:"Clone column settings",views:"Views",createView:"New View",newGrid:"Grid",newKanban:"Kanban",newCard:"Cards",newScheduler:"Calendar",newTimeline:"Timeline",layout:"Layout",settings:"Create view",viewNamePlaceholder:"View name",view:"View",noViews:"Found no views",kanbanView:"View your records as cards on a Kanban board",gridView:"View your records in a Table",cardView:"View your records in a Card view",schedulerView:"View your records in a Calendar view",timelineView:"View your records in a Timeline view",days:"{{value}}d",daysOverdue:"{{value}} days overdue",daysLeft:"{{value}} days left",true:"true",false:"false",TOMORROW:"Tomorrow",TODAY:"Today",YESTERDAY:"Yesterday",NEXT_WEEK:"Next week",THIS_WEEK:"This week",LAST_WEEK:"Last week",NEXT_MONTH:"Next month",THIS_MONTH:"This month",LAST_MONTH:"Last month",hideHiddenColumns:"Hide {{value}} hidden columns",showHiddenColumns:"Show {{value}} hidden columns",less:"Less",more:"More",conditions:"Conditions",colorsSingleSelect:"Which single select field should the row be colored by?",colorRows:"Color rows when they match the conditions",colorSelect:"Color rows the same as a single select value",colorLeftBorderLabel:"Left border",colorRowLabel:"Row",colorCellLabel:"Cell",colorLeftBorder:"Color the left border of a row",colorRow:"Color the background of a row",colorCell:"Color the background of a cell",loadingIndicatorPlaceholder:"Loading...",dropDownPlaceholder:"Please select...",placeholder:"No Rows",pieChart:"Pie",columnChart:"Column",barChart:"Bar",stackedChart:"Stacked",lineChart:"Line",projectStatus:"Project Status",reviewStatus:"Review Status",taskStatus:"Task Status",priority:"Priority",size:"Size",yesNo:"Yes/No",notStarted:"Not Started",underReview:"Under review",approved:"Approved",blocked:"Blocked",completedStatus:"Completed",generate:"Generate",aiPrompt:"Enter your prompt for the AI:",agenda:"Agenda",checkStyle:"Style",noVotes:"No votes yet",votes:"Voted by {{value}}",clearContents:"Clear contents",paste:"Paste",minPromptChars:"Enter AI prompt. Min 20 chars."}},type:"object"},onCellValue:{value:null,type:"any",reflectToAttribute:!1},onCellEditRequest:{value:null,type:"any",reflectToAttribute:!1},onCellUpdate:{value:null,type:"any",reflectToAttribute:!1},onCellRender:{value:null,type:"any",reflectToAttribute:!1},onCellValueChanged:{value:null,type:"any",reflectToAttribute:!1},onBeforeInit:{value:null,type:"any",reflectToAttribute:!1},onInit:{value:null,type:"any",reflectToAttribute:!1},onAfterInit:{value:null,type:"any",reflectToAttribute:!1},onKey:{value:null,type:"any",reflectToAttribute:!1},onKeyUp:{value:null,type:"any",reflectToAttribute:!1},onRender:{value:null,type:"any",reflectToAttribute:!1},onLoad:{value:null,type:"any",reflectToAttribute:!1},onChartInit:{value:null,type:"any",reflectToAttribute:!1},onComment:{value:null,type:"any",reflectToAttribute:!1},onRowInit:{value:null,type:"any",reflectToAttribute:!1},onRowClass:{value:null,type:"any",reflectToAttribute:!1},onRowChange:{value:null,type:"any",reflectToAttribute:!1},onRowDetailInit:{value:null,type:"any",reflectToAttribute:!1},onRowDetailUpdated:{value:null,type:"any",reflectToAttribute:!1},onRowInserted:{value:null,type:"any",reflectToAttribute:!1},onRowRemoved:{value:null,type:"any",reflectToAttribute:!1},onRowUpdate:{value:null,type:"any",reflectToAttribute:!1},onRowUpdated:{value:null,type:"any",reflectToAttribute:!1},onRowStarred:{value:null,type:"any",reflectToAttribute:!1},onRowHistory:{value:null,type:"any",reflectToAttribute:!1},onRowStyle:{value:null,type:"any",reflectToAttribute:!1},onRowResize:{value:null,type:"any",reflectToAttribute:!1},onColumnInit:{value:null,type:"any",reflectToAttribute:!1},onColumnInserted:{value:null,type:"any",reflectToAttribute:!1},onColumnRemoved:{value:null,type:"any",reflectToAttribute:!1},onColumnResize:{value:null,type:"any",reflectToAttribute:!1},onColumnReorder:{value:null,type:"any",reflectToAttribute:!1},onColumnSummaryChange:{value:null,type:"any",reflectToAttribute:!1},onColumnUpdated:{value:null,type:"any",reflectToAttribute:!1},onColumnClone:{value:null,type:"any",reflectToAttribute:!1},onColumnChange:{value:null,type:"any",reflectToAttribute:!1},onCommand:{value:null,reflectToAttribute:!1,type:"any"},onViewInit:{value:null,type:"any",reflectToAttribute:!1},filtering:{value:{enabled:{value:!1,type:"boolean"},operator:{value:"and",type:"string"},filter:{value:[],type:"array",reflectToAttribute:!1},filterRow:{value:{visible:{value:!1,type:"boolean"},menuVisible:{value:!1,type:"boolean"},applyMode:{value:"auto",type:"string",allowedValues:["auto","click"]},autoApplyModeDelay:{value:800,type:"number"}},type:"object"},filterMenu:{value:{visible:{value:!0,type:"boolean"},buttons:{value:["cancel","clear","filter"],type:"array"},dataSource:{value:null,type:"any"},width:{value:250,type:"number"},height:{value:200,type:"number"},mode:{value:"default",allowedValues:["default","excel"],type:"string"},messages:{value:null,type:"object"}},type:"object"}},type:"object"},editing:{value:{allowRowHeaderEdit:{value:!1,type:"boolean"},allowColumnHeaderEdit:{value:!1,type:"boolean"},autoUpdateFilterAndSort:{value:!0,type:"boolean"},allowListOpenOnContentClick:{value:!0,type:"boolean"},active:{value:!1,readonly:!0,type:"boolean"},enabled:{value:!1,type:"boolean"},batch:{value:!1,type:"boolean"},readOnlyEdit:{value:!1,type:"boolean"},action:{value:"click",type:"string",allowedValues:["none","click","doubleClick"]},commandKeys:{value:{commandKeyCancel:{value:{command:"commandKeyCancelCommand",key:"Escape"},type:"object"},commandKeyUpdate:{value:{command:"commandKeyUpdateCommand",key:"Enter | Tab"},type:"object"}},type:"object"},commandBar:{value:{visible:{value:!1,type:"boolean"},position:{value:"near",allowedValues:["near","far","both"],type:"string"},displayMode:{value:"labelAndIcon",allowedValues:["label","icon","labelAndIcon"],type:"string"},dataSource:{value:{commandBarAddRow:{value:{command:{value:"commandBarAddRowCommand",type:"any"},icon:{value:"smart-icon-plus",type:"string"},label:{value:"{{messages}}",type:"string"},visible:{value:!1,type:"any"}},type:"object"},commandBarDeleteRow:{value:{command:{value:"commandBarDeleteRowCommand",type:"any"},icon:{value:"smart-icon-delete",type:"string"},label:{value:"{{messages}}",type:"string"},visible:{value:!1,type:"any"}},type:"object"},commandBarBatchSave:{value:{command:{value:"commandBarBatchSaveCommand",type:"any"},icon:{value:"smart-icon-ok-squared",type:"string"},label:{value:"{{messages}}",type:"string"},visible:{value:!0,type:"any"}},type:"object"},commandBarBatchRevert:{value:{command:{value:"commandBarBatchRevertCommand",type:"any"},icon:{value:"smart-icon-reload",type:"string"},label:{value:"{{messages}}",type:"string"},visible:{value:!0,type:"any"}},type:"object"},commandBarCustom:{value:{command:{value:"",type:"any"},icon:{value:"smart-icon-ellipsis-vert",type:"string"},label:{value:"",type:"string"},visible:{value:!1,type:"any"}},type:"object"}},type:"object"}},type:"object"},commandColumn:{value:{visible:{value:!1,type:"boolean"},inline:{value:!1,type:"boolean"},position:{value:"far",allowedValues:["near","far"],type:"string"},displayMode:{value:"icon",allowedValues:["label","icon","labelAndIcon"],type:"string"},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"},sidePanel:{value:!1,type:"booelan"},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' style=\"opacity: 0.99\" role=\"presentation\" class='center smart-grid-row-container'>\n </div>\n <div id='rowFarContainer' role=\"presentation\" class='far smart-hidden smart-grid-row-container'>\n </div>\n <div id='placeholder' class ='smart-hidden smart-placeholder smart-grid-placeholder'></div>\n <smart-scroll-bar right-to-left=\"[[rightToLeft]]\" theme=\"[[theme]]\" id='verticalScrollBar' class='smart-grid-scroll-bar' wait disabled='[[disabled]]' orientation='vertical'></smart-scroll-bar>\n <smart-scroll-bar right-to-left=\"[[rightToLeft]]\" theme=\"[[theme]]\" id='horizontalScrollBar' class='smart-grid-scroll-bar' wait disabled='[[disabled]]'></smart-scroll-bar>\n </div>\n <div id='filterFooter' class='smart-grid-filter-footer smart-hidden'></div>\n </div>\n <div class=\"smart-grid-view-content smart-hidden\" id=\"viewContent\"></div>\n <div viewbar class=\"smart-grid-view-bar smart-hidden\" id=\"viewBar\"></div>\n <div id='loadingIndicatorContainer' class='smart-loader-container'>\n <span id='loadingIndicator' class='smart-grid-loader smart-loader'></span>\n <span id='loadingIndicatorPlaceholder' class ='smart-loader-label smart-hidden'></span>\n </div>\n <div id='footerCommandBar' footer class='smart-grid-footer smart-grid-command-bar smart-hidden'></div>\n <div id='footerPager' class='smart-grid-pager smart-hidden'></div>\n <div id='footer' class='smart-grid-footer smart-hidden'></div>\n </div>"}static get listeners(){return{focus:"_focusHandler",blur:"_blurHandler",wheel:"_mouseWheelHandler","document.up":"_upHandler","document.down":"_downHandler","document.move":"_moveHandler","document.scroll":"_scrollHandler",keydown:"_keyDownHandler",keyup:"_keyUpHandler",resize:"_resizeHandler","header.click":"_headerClickHandler","columnHeader.down":"_columnDownHandler","columnHeader.click":"_columnClickHandler","columnHeader.move":"_columnMoveHandler","columnHeader.mouseleave":"_columnMouseLeaveHandler","rowNearContainer.down":"_rowDownHandler","rowContainer.down":"_rowDownHandler","rowFarContainer.down":"_rowDownHandler","container.selectstart":"_selectStartHandler",styleChanged:"_styleChangedHandler",swipeleft:"_swipeLeftHandler",swiperight:"_swipeRightHandler",contextmenu:"_contextMenuHandler","document.paste":"_clipboardPasteHandler"}}_clipboardPasteHandler(e){if("paste"===e.type){const t=this;if(document.activeElement!==t)return;if(t._selection&&t._selection.focusedCell){const o=t._selection.focusedCell.id,l=t._selection.focusedCell.dataField,a=t.columnByDataField[l];if(!a)return;if(a&&("image"===a.template||"attachment"===a.template||"richText"===a.template)){e.preventDefault();let n=(e.clipboardData||e.originalEvent.clipboardData).items,i=null,r=0,s=0,d=[];for(let e=0;e<n.length;e++)if(0===n[e].type.indexOf("image")&&(i=n[e].getAsFile(),r++,null!==i)){let e={label:i.name,size:i.size},n=new FileReader;n.onload=function(n){s++;const i=n.target.result;e.value=i;let u=!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){u=!0;break}}if(u||t.uploadSettings.userFiles.push(e),d.push(e),s===r){let e=t.getCellValue(o,l);if(e||(e=[]),"string"==typeof e&&(e=JSON.parse(e)),e=[...e,...d],"richText"===a.template){const a=document.createElement("span");for(let t=0;t<e.length;t++){const o=document.createElement("img");o.src=e[t].value,o.title=o.name=e[t].label,a.appendChild(o)}t.setCellValue(o,l,a.outerHTML)}else t.setCellValue(o,l,e)}},n.readAsDataURL(i)}}}}}_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=()=>{if(t.editing.isEditing&&!t.editing.dialog.enabled){if(t._hasRichTextEditor)return;setTimeout((()=>{if(!e.defaultPrevented){if(t.editing.editCell&&t.editing.editCell.editor.instance){const o=t.editing.editCell.editor.instance;if(o.element&&o.element.hasAttribute("aria-owns")){const t=o.element.getAttribute("aria-owns"),l=document.getElementById(t);if(l&&l.contains(e.originalEvent.target))return}if(o.element&&o.element&&o.element.firstElementChild&&o.element.firstElementChild.hasAttribute("aria-owns")){const t=o.element.firstElementChild.getAttribute("aria-owns"),l=document.getElementById(t);if(l&&l.contains(e.originalEvent.target))return}if(e.originalEvent.target&&e.originalEvent.target.classList.contains("smart-editor-toolbar-item"))return;if(t.editing.editCell.editor.instance.blur(e),e.defaultPrevented)return}t.isAttached&&t.endEdit()}}),50)}};if(e.originalEvent&&(e.originalEvent.target===t.$.scrollView&&t._downTarget===e.originalEvent.target&&l(),e.originalEvent.target.closest(".smart-grid-dialog")))t._dialogDragDetails&&(t._dialogDragDetails.started=!1);else{if(e.pageX<o.left||e.pageX>o.right||e.pageY<o.top||e.pageY>o.bottom){let o=!1,a=e.originalEvent.target;for(;a;){if(a=a.parentNode,a===t){o=!0;break}if(t.dropDownMode&&t.$.dropDownElement===a){o=!0;break}}if(o)return t._dragSelectionEnd(e),t._endResize(e),void t._endDrag(e);if(t._summaryRowDialog&&t._summaryRowDialog.classList.contains("open")&&t._summaryRowDialog.confirm(),t._inputOverlay&&(t._inputOverlay.classList.remove("smart-input-overlay-on"),setTimeout((()=>{t._inputOverlay&&(t._inputOverlay.parentNode&&t._inputOverlay.parentNode.removeChild(t._inputOverlay),t._inputOverlay=null)}),t.behavior.doubleClickTimingDelay)),l(),t.closeDropDown(),t.menu){let o,l,a,n;if(t.enableShadowDOM||t.isInShadowDOM?(o=e.originalEvent.composedPath()[0],l=function(){let e=o.getRootNode().host;for(;e;){if(e===t)return e;e=e.getRootNode().host}}(),a=t.menu.contains(o)||t.menu.firstElementChild.shadowRoot.contains(o),n=t.menu.firstElementChild.shadowRoot):(o=e.originalEvent.target,l=t.contains(o),a=t.menu.contains(o),n=t.menu),!l&&!a){const l=n.querySelectorAll("smart-drop-down-list"),a=n.querySelectorAll("smart-date-time-picker"),i=n.querySelectorAll("smart-date-input"),r=n.querySelectorAll("smart-input");for(let e=0;e<l.length;e++)if(l[e].$.dropDownContainer.contains(o))return;for(let e=0;e<a.length;e++)if(a[e].$.dropDownContainer.contains(o))return;for(let e=0;e<i.length;e++)if(i[e].$.scrollView.contains(o))return;for(let e=0;e<r.length;e++)if(r[e].$.scrollView.contains(o))return;return t.closeMenu(),t._dragSelectionEnd(e),t._endResize(e),void t._endDrag(e)}}}t._summaryRowDialog&&t._summaryRowDialog.classList.contains("open")&&t._summaryRowDialog.confirm(),t._dragSelectionEnd(e),t._endResize(e),t._endDrag(e)}}_nextColumn(e){const t=this;for(let o=0;o<t.viewColumns.length;o++){const l=t.viewColumns[o];if(l.visibleIndex===e.visibleIndex+1)return l}return null}_nextRow(e){const t=this._recyclingRows,o=t.indexOf(e);return o>=0?t[o+1]:null}_moveHandler(e){const t=this;if(t.isInitialized&&t._selection){if(t.selection.enabled&&t.selection.allowDragSelection&&!t.editing.isEditing&&(!t._selection.selectionRect||t._selection.selectionRect&&!t._selection.selectionRect.captured)&&(!0!==t._mobile&&t._dragSelection(e),e.originalEvent)){const o=e.originalEvent.target.closest?e.originalEvent.target:void 0;Smart.Utilities.Core.isMobile&&o&&o.closest("smart-grid")===t&&e.originalEvent.preventDefault()}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,s=i?i.scrollLeft:0;if(n.left-s<=e.pageX&&n.left-s+a.width-10>=e.pageX)if(n.top-r<=e.pageY&&n.top-r+a.height>=e.pageY){if(!t.hasColumnMenu(o))return;l._showActionButton()}else l._hideActionButton();else l._hideActionButton()}};for(let e=0;e<t._columnElements.length;e++){const l=t._columnElements[e];o(l.column,l)}for(let e=0;e<t._frozenNearColumns.length;e++){const l=t._frozenNearColumns[e];o(l,l.element)}}_headerClickHandler(e){const t=this;if(t.$.headerBar){const o=t.isInShadowDOM||t.shadowRoot?e.composedPath()[0]:e.target;t.$.headerBar._headerClickHandler(o,t)}}_columnClickHandler(e){const t=this;if(t._overlay)return;if(void 0===e.clientX)return;const o=(t.enableShadowDOM?t.shadowRoot:t.getRootNode()).elementsFromPoint(e.clientX,e.clientY);let l=null,a=null;const n=new Date-t._columnClickTime<t.behavior.doubleClickTimingDelay;t._columnClickTime=new Date;for(let e=0;e<o.length;e++){const t=o[e];if(t.classList.contains("smart-action-button"))return;if(t.getAttribute("data-field")){l=t.getAttribute("data-field"),a=t;break}}if(l){const o=a.column;if(!o)return;if(e.srcElement.classList.contains("smart-filter-button"))return;if("_addNewColumn"===o.dataField)return void t._openAddColumnDialog();if(Smart.Utilities.Core.isMobile)n&&t.sorting.sortToggleOnClick&&o.allowSortToggleOnClick&&t.sorting.enabled&&(t.sortBy(l),t.autoSaveState()),t._columnMoveHandler(e),e.originalEvent&&e.originalEvent.preventDefault();else if(!n&&t.sorting.sortToggleOnClick&&o.allowSortToggleOnClick&&t.sorting.enabled){if("none"!==t.behavior.columnResizeMode&&"col-resize"===o.element.style.cursor)return;if(t._canSort=!0,""!==t.sorting.commandKey){if("Alt"===t.sorting.commandKey&&!1===e.altKey&&(t._canSort=!1),"Shift"===t.sorting.commandKey&&!1===e.shiftKey&&(t._canSort=!1),"Control"===t.sorting.commandKey&&!1===e.metaKey&&!1===e.ctrlKey&&(t._canSort=!1),"Control"!==t.sorting.commandKey&&e.ctrlKey)return;if(!0===t.sorting.sortToggleOnClickAndCommandKey&&!t._canSort)return}t.sortBy(l),t.autoSaveState()}}}_columnDownHandler(e){const t=this,o=(t.enableShadowDOM?t.shadowRoot:t.getRootNode()).elementsFromPoint(e.clientX,e.clientY);let l=null,a=null;const n=new Date-t._clickTime<t.behavior.doubleClickTimingDelay;t.$.headerBar&&t.$.headerBar.closePanel(),t._doubleClickHandler(e);for(let e=0;e<o.length;e++){const t=o[e];if(t.classList.contains("smart-action-button"))return;if(t.getAttribute("data-field")){l=t.getAttribute("data-field"),a=t;break}}if(l){const o=a.column;if(!o)return;if("_commandColumn"===l)return void(t.editing.commandColumn.dataSource.commandColumnMenu.visible&&t._applyCommand(t.editing.commandColumn.dataSource.commandColumnMenu.command));const i=function(a){const n=o.selectionColumn?t.selection.checkBoxes.action===a&&t.selection.enabled:t.selection.action===a&&t.selection.enabled;if("col-resize"!==o.element.style.cursor&&(!t.appearance.showColumnHeaderDragIcon||!e.originalEvent.target.classList.contains("smart-drag-handle"))&&n){if(t.editing.enabled&&t.editing.editColumn===o)return;if(e.shiftKey||e.ctrlKey||e.metaKey?t._dragSelectionStartDataField=null:t._dragSelectionStartDataField=l,"_checkBoxColumn"===l)return void t._toggleColumnSelection(o);"_rowHeaderColumn"===l&&t.selection.enabled&&t.selection.allowRowHeaderSelection&&t.appearance.showRowHeaderSelectIcon&&(delete t._areAllRowsSelected,t.areAllRowsSelected()?t.clearSelection():t.selectAllRows(),o.refresh()),t.selection.allowColumnHeaderSelection&&o.allowSelect&&t._setSelection(null,o.dataField,e)}};if(t.editing.isEditing&&t.endEdit(),i("click"),t._mobile){t._hideActionButtons();const o=(o,l)=>{if(o&&o.autoShowActionButton){const a=l.getBoundingClientRect(),n=t.offset(l);if(n.left<=e.pageX&&n.left+a.width-6>=e.pageX){if(!t.hasColumnMenu(o))return;l._showActionButton()}else l._hideActionButton()}};for(let e=0;e<t._columnElements.length;e++){const l=t._columnElements[e];o(l.column,l)}}if(t.$.fireEvent("columnClick",{column:o,dataField:o.dataField}),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,m=null;t._lastPointerDownTime=new Date;for(let t=0;t<a.length;t++){const o=a[t];if(o.hasAttribute("toggle-button")&&(i=o),o.hasAttribute("add-row")&&(d=o),o.hasAttribute("checkbox")&&(r=o),"A"===o.nodeName&&e.ctrlKey&&o.click(),o.hasAttribute("rating-value")&&(u=o),o.hasAttribute("vote-value")&&(c=o),s||"smart-grid-cell"!==o.nodeName.toLowerCase()||(s=o),!m&&o.classList.contains("smart-card")&&(m=o),!n&&"smart-grid-row"===o.nodeName.toLowerCase()){n=o;break}}if("card"===t.view){if(m){const o=m.getAttribute("row-id"),l=t.rowById[o];if(l){const a=e.originalEvent?e.originalEvent:e,n=3===a.which;if(l.element||l.createElement(),t.$.fireEvent("rowClick",{row:l,id:l.id,data:t.getRowData(l.id),isRightClick:n,originalEvent:a,pageX:parseInt(a.pageX),pageY:parseInt(a.pageY)}),s){const e=s.getAttribute("data-field");if(e){const o=t.columnByDataField[e],i=new Smart.Grid.Cell(l,o,this);s.cell=i,i.element=s,i&&t.$.fireEvent("cellClick",{cell:i,id:l.id,dataField:i.column.dataField,value:i.value,isRightClick:n,originalEvent:a,pageX:parseInt(a.pageX),pageY:parseInt(a.pageY)})}}const i=e.originalEvent.target;if(m.classList.contains("smart-card-header"))l.element&&l.element.row!==l&&(l.element.row=l),l.toggle();else if(l.children&&l.children.length>0&&(i.classList.contains("smart-icon-ungroup")||i.classList.contains("smart-icon-group")))l.element&&l.element.row!==l&&(l.element.row=l),l.toggle();else if(t.editing.enabled){const l=t.editing.dialog.enabled,a=t.editing.mode;if(i.scrollHeight>i.offsetHeight){const o=t.offset(i);if(e.originalEvent.pageX>=o.left+i.offsetWidth-15)return}const n=t.context;t.context=t,t.editing.dialog.enabled=!0,t.editing.mode="row",t._settingsDialogRowId=o;let r=t._isUpdating;m.setAttribute("edit",""),t.beginEdit(o),t._isUpdating=r,t._endCardRowEdit?(t.removeEventListener("endEdit",t._endCardRowEdit,null),t.removeEventListener("cancelEdit",t._endCardRowEdit,null)):t._endCardRowEdit=()=>{t.context=t,t.editing.dialog.enabled=l,t.editing.mode=a,t.editing.isEditing=!1,t.context=n,delete t._settingsDialogRowId,delete t._dialogEdit},t.addEventListener("endEdit",t._endCardRowEdit),t.addEventListener("cancelEdit",t._endCardRowEdit)}}}return}u&&(t._ratingElement=u),c&&(t._voteElement=c);const g=!!e.originalEvent&&3===e.originalEvent.which;if(n&&s){const o=s?s.cell:null;if(o.row.filterRow||t._closeMenu(t.filterRowMenu),i&&o&&!o.column.rowDetailColumn&&i!==o.row.toggleDetailButton&&!i.classList.contains("row-detail"))n.row.toggle(e);else if(t.rowDetail.enabled&&t.rowDetail.visible&&i&&o&&o.column.rowDetailColumn&&!g){const e=n.row;if(t._overlay||e.header&&"row-resize"===e.header.style.cursor||e.header&&"row-resize"===e.header.parentElement.style.cursor)return;t.editing.isEditing&&t.cancelEdit(),e.showDetail?t.hideDetail(e.id):t.showDetail(e.id)}else if(d){const e=n.row,o=e.data;let l=o.parent;const a={};for(a[o.groupDataField]=null!==e.label?e.label:null,void 0!==e.labelValue&&(a[o.groupDataField]=e.labelValue);l;){let e=null!==l.label?l.label:null;l.labelValue&&void 0!==e&&(e=l.labelValue),a[l.groupDataField]=e,l=l.parent}t.addRow(a),setTimeout((()=>{t._conditionalColors&&t._conditionalColors.update&&t._conditionalColors.update()}),100)}else{const o=n.row,l=s?s.cell:null;if(l.column._treeColumn&&r)return void(o.checked=!o.checked);l.element===o.header&&t.behavior.allowRowReorder&&t._beginDrag(e,o),t._tapTimer&&clearTimeout(t._tapTimer),t._tapTimer=setTimeout((function(){t._clickedRow===n&&t.$.fireEvent("rowTap",{row:o,id:o.id,originalEvent:e.originalEvent}),t._clickedCell===s&&t.$.fireEvent("cellTap",{cell:l,id:o.id,dataField:l.column.dataField,originalEvent:e.originalEvent})}),t.behavior.doubleClickTimingDelay);const a=function(a){if(!t.selection.enabled||o.autoGenerated||!0!==o.allowSelect)return void delete t.__selectionStarted;if(t._overlay||o.header&&"row-resize"===o.header.style.cursor||o.header&&"row-resize"===o.header.parentElement.style.cursor)return;if(o.header&&"row-resize"===o.header.style.cursor){const a=t.offset(o.header);if(t._rowToResize&&a.left<=e.originalEvent.pageX&&e.originalEvent.pageX<=a.left+o.header.offsetWidth)return o.header.style.cursor="",void(t._rowToResize.onpointerup=()=>{const a=t.editing.isEditing;t._rowToResize&&(t._rowToResize.onpointerup=null),t._clickedRow===n&&!a&&!t._rowResizeLine&&l.column.rowHeaderColumn&&t.selection.allowRowHeaderSelection&&t._setSelection(o.id,l.column.dataField,e)});o.header.style.cursor=""}const i=t.editing.isEditing;if(i&&t.editing.editCell&&t.editing.editCell.row.id===o.id&&t.editing.editCell.column.dataField===l.column.dataField)return;if(i&&t.editing.editRow&&t.editing.editRow.id===o.id)return;const r=()=>{t.focus(),setTimeout((function(){t.focus()}),50)};if(t.selection.action===a){if(e.shiftKey||e.ctrlKey||e.metaKey||!t.selection.allowRowHeaderSelection&&l.column.autoGenerated?t._dragSelectionStartRow=null:t._dragSelectionStartRow=n.row,e.shiftKey||e.ctrlKey||e.metaKey?t._dragSelectionStartDataField=null:t._dragSelectionStartDataField=l.column.dataField,l.column.rowHeaderColumn&&!t.selection.allowRowHeaderSelection)return t._dragSelectionStartRow=null,void r();t._setSelection(o.id,l.column.dataField,e),r()}else(l.column.selectionColumn&&t.selection.checkBoxes.enabled&&t.selection.checkBoxes.action===a||l.column.rowHeaderColumn&&t.selection.allowRowHeaderSelection)&&(t._setSelection(o.id,l.column.dataField,e),r())},i=l.selected;t._clickTime||(t._clickTime=new Date);const d=t._clickedCell===s&&new Date-t._clickTime<t.behavior.doubleClickTimingDelay,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){t.contextMenu.id=o.id,t.contextMenu.dataField=l.column.dataField;const e=t.getSelectedCells();let a=!0;if(t.contextMenu.dataField&&!t.contextMenu.dataField.startsWith("_"))if(e.length){for(let t=0;t<e.length;t++){const n=e[t],i=n[0],r=n[1];if(""+i==""+o.id&&l.column.dataField===r){a=!1;break}}t._focusCell(o.id,l.column.dataField,a),a&&t._selectCellsRange(o,o,l.column.dataField,l.column.dataField)}else{const e=t.getSelectedRowIds();(0===e.length||e.length>1)&&(t._focusCell(o.id,l.column.dataField),t._selectCellsRange(o,o,l.column.dataField,l.column.dataField))}else t._copyRects&&t._copyRects.length&&t.clearSelection(),t.selectRow(o.id);return t.openContextMenu(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())}}}showDetail(e){const t=this.rowById[e];t&&(t.showDetail=!0)}hideDetail(e){const t=this.rowById[e];t&&(t.showDetail=!1)}_focusHandler(){this._focused=!0,this.setAttribute("focus","")}_blurHandler(){this._focused=!1,this.removeAttribute("focus")}_notify(e,t,o){const l=this;if(l.notifyFn)for(let a=0;a<l.notifyFn.length;a++)l.notifyFn[a](e,t,o)}notify(e){const t=this;e&&(t.notifyFn||(t.notifyFn=[]),t.notifyFn.push(e))}_applyTemplate(e,t){let o=null;if(null!==e&&""!==e)if(e&&"function"==typeof e)e(t);else if((e.startsWith("#")||e.startsWith("."))&&(o=document.querySelector(e)),o)t.innerHTML="",o instanceof HTMLElement&&!(o instanceof HTMLTemplateElement)?t.appendChild(o):t.appendChild(o.content.cloneNode(!0).firstElementChild);else{const o=function(e){const t=document.createElement("template");return e=e.trim(),t.innerHTML=e,t.content.firstChild}(e);o&&(t.innerHTML="",t.appendChild(o))}else t.innerHTML=""}refreshRelations(){const e=this;if(e.dataSourceSettings&&e.dataSourceSettings.relations&&e.dataSourceSettings.relations.length){for(let t=0;t<e.columns.length;t++){const o=e.columns[t];"dropdownGrid"===o.template&&(o._isDirty=!0)}e._recycle(!1);for(let t=0;t<e.columns.length;t++){const o=e.columns[t];"dropdownGrid"===o.template&&delete o._isDirty}}}propertyChangedHandler(e,t,o){const l=this;if(l.isInitialized)if("object"!=typeof e){switch(l._notify(e,t,o),e){case"dataSourceSettings_relations":return void l.refreshRelations();case"onRowHistory":case"onRowInserted":case"stateSettings_current":return;case"highlighted":"kanban"===l.view&&l._kanban?(l._kanban.selectTask(o),l._kanban.ensureVisible(o)):"scheduler"===l.view&&l._scheduler&&l._scheduler.focusEvent(o);break;case"view":return void(l.$.headerBar&&l.$.headerBar._setView&&l.$.headerBar._setView(o,!0));case"users":case"currentUser":l._refreshCurrentUser(),l._recycle();break;case"summaryRow_visible":{for(let e=0;e<l.columns.length;e++)l._summaryRowCount=Math.max(l._summaryRowCount,l.columns[e].summary.length);const e=l.onRowInserted;l.onRowInserted=null,l._renderRows(!0),l.onRowInserted=e;break}case"conditionalFormatting":return l._renderConditionalFormatting(),void l.refresh();case"appearance_displayLoadingIndicator":return 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&&(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,l._isUpdating&&l.endUpdate(),"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}l.beginUpdate();const a=l._sortedColumns;l._sortedColumns&&l._sortedColumns.length>0&&void 0===l._getId()&&l.clearSort();for(let e=0;e<o.length;e++){const t=o[e],a=l.dataSource[e]?l.dataSource[e].$.id:e;l._updateRow(a,t,!0)}delete l.__autoRowHeight,l._virtualOnExpandCache=[],l._cellsMerge=[],l._cellStyles=[];const n=l._filters;if(l.clearSort(),l.filtering.filterRow)for(let e=0;e<l.columns.length;e++)l.columns[e]._filterEditorInitialized=!1;for(let e=0;e<l.columns.length;e++)delete l.columns[e]._cellsCachedValues;if(a&&l._refreshSort(a),n&&n.length>0&&(l._filters=null,l.refreshFilters()),l.grouping.enabled)for(let t in e)l._expandCollapseGroup(t,!0);l.endUpdate()})),l._cachedDataSource=o,void(l.header.visible&&""===l.header.template&&l.$.headerBar._init(l))}}return l.dataSource&&l.dataSource.length>1e4?(l.appearance.displayLoadingIndicator=!0,l._setLoadingIndicatorVisibility(),setTimeout((()=>{l.dataBind()}),100),setTimeout((()=>{l.appearance.displayLoadingIndicator=!1,l._setLoadingIndicatorVisibility(),l._recycle(!1)}),200)):(l.dataSource&&l.dataSource instanceof Smart.DataAdapter&&l.columns&&l.dataSource.dataFields&&l.dataSource.dataFields.forEach((e=>{const t=l.columnByDataField[e.name];t&&(t.dataType=e.dataType)})),l.dataBind()),void(l.header.visible&&""===l.header.template&&l.$.headerBar._init(l));case"rowDetail_dialog_width":case"rowDetail_dialog_height":case"rowDetail_dialog_enabled":case"rowDetail_dialog_visible":return;case"rowDetail_height":case"rowDetail_enabled":{l.beginUpdate(),l.rows.canNotify=!1;const e=l.appearance.allowRowDetailToggleAnimation;l.appearance.allowRowDetailToggleAnimation=!1;for(let e=0;e<l._recyclingRows.length;e++){const t=l._recyclingRows[e];t.height=null,t.setProperty("showDetail",!1),t.detailHeight=l.rowDetail.height}if(l.rows.canNotify=!0,l.rowDetail.enabled){let t=!1;for(let e=0;e<l.viewColumns.length;e++)if(l.viewColumns[e].rowDetailColumn){t=!0;break}if(!t)return l.appearance.allowRowDetailToggleAnimation=e,l.endUpdate(),void l._renderColumns(!0)}else for(let e=0;e<l.viewColumns.length;e++){const t=l.viewColumns[e];if(t.rowDetailColumn){t.visible=!1;break}}return l.appearance.allowRowDetailToggleAnimation=e,void l.endUpdate()}case"rowDetail_visible":for(let e=0;e<l.viewColumns.length;e++){const t=l.viewColumns[e];if(t.rowDetailColumn){t.visible=o;break}}return;case"displayLoadingIndicator":return void l._setLoadingIndicatorVisibility();case"filterable":return void l._refreshLayout();case"layout_allowCellsWrap":{const e=l.columns.canNotify;l.columns.canNotify=!1;for(let e=0;e<l.columns.length;e++)l.columns[e].cellsWrap=o;return l.layout.isDirty=!0,l._resetCachedLayout(),l._refreshLayout(),l.refresh(),void(l.columns.canNotify=e)}case"showViewBar":return l.layout.isDirty=!0,l._resetCachedLayout(),l._refreshLayout(),void l.refresh();case"layout_autoHeight":case"layout_autoWidth":case"layout_columnMinHeight":case"layout_rowMinHeight":case"layout_columnHeight":case"layout_rowHeight":return l.layout.isDirty=!0,l._resetCachedLayout(),l._refreshLayout(),void l.refresh();case"rightToLeft":return void l.refresh();case"selectionMode":return;case"editing_addNewColumn_visible":l._addNewColumn?(l._addNewColumn.visible=o,l.refresh()):l._renderColumns();break;case"editing_addNewRow_displayMode":{"row"===l.editing.addNewRow.displayMode&&l.editing.addNewRow._addButton&&(l.editing.addNewRow._addButton.remove(),delete l.editing.addNewRow._addButton);const e=l._scrollView.vScrollBar;return e.style.height="",e.style.top="",e.style.setProperty("--smart-scroll-bar-near-size","0px"),l._renderAddNewRow(),void l.refresh(!0)}case"editing_addNewRow_label":case"editing_addNewRow_visible":case"editing_addNewRow_position":return!1===l.editing.addNewRow.visible&&"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()}else l.render()}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._details=[],e.checkLicense()}_createFilterPanels(){const e=this;if(e._filterPanels){if(e._filterPanels.length>0)return}else e._filterPanels=[];if(e.filtering.enabled&&0===e._filterPanels.length){if(e.header.visible&&e.header.buttons.indexOf("filter")>=0)return;requestAnimationFrame((()=>{const t=document.createElement("smart-filter-panel"),o=document.createElement("smart-filter-panel"),l=document.createElement("smart-filter-panel"),a=document.createElement("smart-filter-panel");o.filterType="boolean",l.filterType="numeric",a.filterType="date",e._filterPanels.bool=o,e._filterPanels.date=a,e._filterPanels.numeric=l,e._filterPanels.string=t;for(let t in e._filterPanels){const o=e._filterPanels[t];o.rightToLeft=e.rightToLeft,o.classList.add("smart-hidden"),e.$.content.appendChild(o),o.parentNode.removeChild(o)}}))}}_applyScrolling(){const e=this,t=e._scrollView.vScrollBar;requestAnimationFrame((()=>{switch(t.largeStep=e.$.scrollView.offsetHeight,e.scrolling){case"physical":case"infinite":case"virtual":t.step=e.layout.rowMinHeight,t.mechanicalAction="switchWhileDragging";break;case"deferred":t.step=10,t.mechanicalAction="switchWhenReleased";break;case"logical":t.step=e.layout.rowMinHeight,t.mechanicalAction="switchWhileDragging"}}))}_measureRowElement(e){const t=new Smart.Grid.Row({data:e,index:999999,grid:this});if(!t)return null;const o=t.createElement();return o.classList.add("smart-grid-measure-row"),this.$.scrollView.appendChild(o),o.style.height="",o.style.lineHeight="",o.style.height="",o.style.lineHeight="",t._isMeasureRow=!0,t.render(),o}get _autoRowHeight(){const e=this;if(e.__autoRowHeight)return e.__autoRowHeight;let t=e.layout.rowMinHeight;if(!e.dataSource||e.dataSource&&0===e.dataSource.length)return t;const o=new Smart.Grid.Row({index:0,grid:e}),l=o.createElement();e.$.scrollView.appendChild(l),e.removeAttribute("grouped"),e.removeAttribute("tree"),e.grouping.enabled&&e.dataSource.groupBy&&e.dataSource.groupBy.length>0?e.setAttribute("grouped",""):e.dataSource.boundHierarchy&&e.setAttribute("tree","");const a={};if(e.dataSource.dataFields)for(let t=0;t<e.dataSource.dataFields.length;t++)a[e.dataSource.dataFields[t].name]="ABCDEFHIJLMNOPQRSTUVWXYZ1234567910|";o.data=a,o._isMeasureRow=!0,o.render(),l.style.height="",l.style.lineHeight="",t=Math.max(l.offsetHeight,t);for(let e=0;e<l.children.length;e++)l.children[e].style.height="";for(let a=0;a<l.children[1].children.length;a++){if(l.children[1].children[a].style.height="auto",e.columns[0]){const t=o.getCell(e.columns[0].dataField);t&&t.render()}t=Math.max(t,8+l.children[1].children[a].offsetHeight);break}return e.$.scrollView.removeChild(l),e.__autoRowHeight=t,e.layout.rowMinHeight&&t<e.layout.rowMinHeight&&(e.__autoRowHeight=e.layout.rowMinHeight),t}get _scrollHeight(){const e=this,t="card"===e.view;let o=e._recyclingRows,l=0,a=e._autoRowHeight,n=0,i=0;if(e.__scrollHeight)return e.__scrollHeight;if(0===o.length||0===e.columns.length||!e.hasVisibleColumn())return 0;let r=40,s=1,d=0;if(t){for(let t=0;t<e.viewColumns.length;t++){const o=e.viewColumns[t];o.visible&&!o.autoGenerated&&(r+=e.layout.cardRowMinHeight,d++,o.cardHeight&&(r-=e.layout.cardRowMinHeight,r+=o.cardHeight*e.layout.cardRowMinHeight))}let t=e.offsetWidth;!e.appearance.showViewBar||e.appearance.viewBarAppendTo||e.appearance.showViewBarAsDropdown||(t-=e.layout.viewBarWidth+5),s=t<e.layout.cardMinWidth?1:"auto"===e.layout.cardsPerRow?Math.floor(t/e.layout.cardMinWidth):e.layout.cardsPerRow,1===s&&(r+=5*d),e._cardHeight=r}e._cardsPerRow=s,e.rows.canNotify=!1;const 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._autoHeight&&e.paging.enabled&&(e._overflowOffset=Math.max(o,e.paging.pageSize*e.layout.rowMinHeight)),e.rightToLeft?(e.$.rowNearContainer.classList.remove("near"),e.$.rowNearContainer.classList.add("far"),e.$.rowFarContainer.classList.remove("far"),e.$.rowFarContainer.classList.add("near")):(e.$.rowFarContainer.classList.remove("near"),e.$.rowFarContainer.classList.add("far"),e.$.rowNearContainer.classList.remove("far"),e.$.rowNearContainer.classList.add("near"));const l=e.offsetHeight;e.$.container.classList.add("smart-hidden");const a=e.offsetHeight;e.$.container.classList.remove("smart-hidden"),"hidden"!==e.verticalScrollBarVisibility&&l===a||(o=e._scrollHeight);const n=function(){const l=document.createDocumentFragment();if(e.rows&&0===e.rows.length)return;for(let a=0;a<e.rows.length;a++){const n=e.rows[a];if(n.freeze&&n.visible)continue;const i=n.createElement();if(l.appendChild(i),t+=e.layout.rowMinHeight,t>e._overflowOffset+o)break}e.$.rowContainer.appendChild(l);const a=e.$.rowContainer.children;for(let t=0;t<a.length;t++){const o=a[t];e.rows[t]&&(e.rows[t].element=o),e._rowElements[t]=o}};for(let t=0;t<e._frozenNearRows.length;t++){const o=e._frozenNearRows[t];o.grid=e;const l=o.createElement();o.element=l,e.$.rowNearContainer.appendChild(l)}for(let t=0;t<e._frozenFarRows.length;t++){const o=e._frozenFarRows[t];o.grid=e;const l=o.createElement();o.element=l,e.$.rowFarContainer.appendChild(l)}n();let i=0;for(;t<1.5*o&&++i<50;)n();e.rows.canNotify=!0}_refreshSummary(e){const t=this;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&&a.summary&&a.summary.length>0&&(o=!0,n[a.dataField]=a.summary,t.push(n))}if(!o)return void(e._summaryItems=[]);const l=e.getSelectedRowIds();if(l.length>=1){const o=[];for(let t=0;t<l.length;t++){const a=e.dataSource.dataItemById[l[t]];a&&o.push(a)}e._summaryItems=e.dataSource.summarize(t,o)}else if(e._selection&&e._selection.cells&&Object.keys(e._selection.cells).length>2){const o=e.getSelectedCells(!1),l=[],a=[];for(let t=0;t<o.length;t++){const n=o[t],i=n[0],r=e.dataSource.dataItemById[i];-1===l.indexOf(r)&&l.push(r),-1===a.indexOf(n[1])&&a.push(n[1])}e._summaryItems=e.dataSource.summarize(t,l);const n=Object.keys(e._summaryItems);for(let t=0;t<n.length;t++){const o=n[t];-1===a.indexOf(o)&&delete e._summaryItems[o]}}else e._summaryItems=e.dataSource.summarize(t)};e._calculateSummary=a;const n=e.columns?e.columns.filter((e=>void 0!==e.getCellValue)):[],i=function(a,i,r){let s=null;if(e.isInitialized&&(o=new Date),s=a?a.grid?a:new Smart.Grid.Row({data:a,index:i,grid:e,createdBy:l,createdDate:o}):new Smart.Grid.Row({data:{},index:i,grid:e,createdBy:l,createdDate:o}),n)for(let e=0;e<n.length;e++){const t=n[e],o=t.getCellValue(s.id,t.dataField,a);void 0!==o&&(s.data[t.dataField]=o)}if(e.rowById[s.id]&&(s.id=e.rows.length,e.rowById[s.id])){const e=function(){return(65536*(1+Math.random())|0).toString(16).substring(1)};s.id=e()}if(e.onRowInit){e.onRowInit(i,s,e),30!==s.height&&(s.cellHeight=s.height);for(let t in s)-1!==s.properties.indexOf(t)||t.startsWith("_")||e.error(e.localize("invalidRowProperty",{elementType:"Grid",propertyName:t}));e._details[i]=s.showDetail}if(s.selected&&(e._selection.rows[s.id]=!0,e._selection.indexes[s.index]=s.index),s.freeze&&s.visible){if(!0===s.freeze||"near"===s.freeze){e.rows.splice(t++,0,s);const o=e.rows[t-1];-1===e._frozenNearRows.indexOf(o)&&e._frozenNearRows.push(o)}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[i].index=e.rows.length):e.rows.push(s),s.data&&s.data.$&&(s.data.$.history=s.history,s.data.$.starred=s.starred,s.data.$.comments=s.comments,s.data.$.style=s.style);if(!("virtual"===e.scrolling||e.paging.enabled&&e.dataSource&&e.dataSource.virtualDataSource))if(e.onRowInserted){const t=void 0===i?e.rows[e.rows.length-1]:e.rows[i],o=o=>{const l=t;if(void 0!==o&&Array.isArray(o)&&(o=o[0]),void 0===o){if(e.rowById[l.id]){const t=e.dataSource.dataItemById[l.id],o=function(){return(65536*(1+Math.random())|0).toString(16).substring(1)};l.id=o(),l.data&&l.data.$?l.data.$.id=l.id:l.data.id=l.id,e._getId()&&(l.data[e._getId()]=l.id),t&&(e.dataSource.dataItemById[l.id]=l.data)}e.rowById[l.id]=l}else{const t=e.dataSource.dataItemById[l.id];l.id=o,l.data&&l.data.$?l.data.$.id=l.id:l.data.id=l.id;const a=e._getId();a&&(l.data[e._getId()]=l.id),t&&(t[a]=o,e.dataSource.dataItemById[l.id]=t,l.data=t),e.rowById[l.id]=l}-1!==l.index&&void 0!==l.index||(l.index=e.rows.length),e._setAddUndoRedo(l),!e.editing.isEditing&&e.isInitialized&&(e._recycle(!1,!0),e.grouping.groupBy.length&&e.refresh()),e._onRowInserted&&e._onRowInserted(l),r&&r(l)};if(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),t.$&&o.$.pageSizeSelector&&(t.$.pageSizeSelector.disabled=e.dataSource.length<e.pager.pageSizeSelector.dataSource[0])),o&&(o.pagesCount=Math.ceil(e.dataSource.length/e._pageSize),o.$&&o.$.pageSizeSelector&&(o.$.pageSizeSelector.disabled=e.dataSource.length<e.pager.pageSizeSelector.dataSource[0]))}if(0===d&&0===e.columns.length&&e.dataSource.dataFields.length>0){const t=e.context;e.context=e,e.columns.canNotify=!1,e.columns=[],e._renderColumns(),e._resetCachedLayout(),e.columns.canNotify=!0,e.context=t}e._initializeRows(),e._initializeRowElements(),e.refresh()}e._recycle(),e.onLoad&&(e.onLoad(),delete e.onLoad)}}a(),("update"!==t.action||l)&&e._refreshLayout(),e._recycle(),e.rows.canNotify=!0})),e._observeRows(),e.summaryRow.visible){const t=new Smart.Grid.Row({height:e.layout.rowMinHeight,freeze:"near",visible:"near"===e.summaryRow.position,summaryRowIndex:0,summaryRow:!0}),o=new Smart.Grid.Row({height:e.layout.rowMinHeight,freeze:"far",visible:"far"===e.summaryRow.position,summaryRowIndex:0,summaryRow:!0});"near"===e.summaryRow.position&&e._frozenNearRows.splice(0,0,t),"far"===e.summaryRow.position&&e._frozenFarRows.push(o)}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.dataSource.id&&o===e.dataSource.id||e.dataSource.keyDataField&&o===e.dataSource.keyDataField||e.dataSource.parentDataField&&o===e.dataSource.parentDataField||e.columnByDataField[o]||delete l.data[o]}void 0!==e.dataSource[o].$.id&&(l.id=e.dataSource[o].$.id,e.rowById[l.id]=l),l.data.$&&l.history&&(l.data.$.history=l.history)}-1!==l.index&&void 0!==l.index||(l.index=o),l.selected&&(e._selection.rows[l.id]=!0,e._selection.indexes[l.index]=l.index),l.freeze&&(!0===l.freeze||"near"===l.freeze?e._frozenNearRows.push(l):"far"===l.freeze&&e._frozenFarRows.push(l)),e._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();if(o.allowDrag=!1,o.classList.add("smart-grid-drop-down-popup"),e.$.dropDownElement=t,e.$.dropDownPopup=o,t.onmouseenter=()=>{t.hasAttribute("active")||t.setAttribute("hover","")},t.onmouseleave=()=>{t.removeAttribute("hover")},t.classList.add("smart-grid-drop-down-button","smart-drop-down-box"),e.parentNode.insertBefore(t,e),t.innerHTML=`<div class="smart-container" role="presentation">\n <div class="smart-content" role="presentation">\n <div class="smart-buttons-container" role="presentation">\n <span class="smart-action-button">${e.localize("dropDownPlaceholder")}</span>\n <span class="smart-drop-down-button">\n <span class="smart-drop-down-button-icon" id="arrow" aria-hidden="true"></span>\n </span>\n </div>\n </div>\n </div>`,t.onclick=()=>{o.classList.contains("open")?e.closeDropDown():e.openDropDown()},e.style.height="100%",e.style.width="100%",o.content.appendChild(e),e._cellsMerge=[],e._cellStyles=[],!e._popupDropDown){e._popupDropDown=o,o._refreshPosition=()=>{const l=e.offset(t),a=t.offsetHeight,n=e.offset(e);if(o.style.maxHeight="",o.style.minHeight="",l.top+a+o.offsetHeight>window.innerHeight-n.top){const e=a+l.top+o.offsetHeight-window.innerHeight+n.top;o.style.maxHeight=Math.max(250,o.offsetHeight-e)+"px",o.style.minHeight="250px"}else o.style.maxHeight="",o.style.minHeight=""};const l=()=>{if(e.selection.enabled){const o=e._selection.focusedCell;if(o){const l=e.getCellValue(o.id,o.dataField);if(t.querySelector(".smart-action-button").innerHTML=l,e.selection.enabled&&e.selection.allowCellSelection){const l=e.getCellValue(o.id,e.dropDownModeDataField);t.querySelector(".smart-action-button").innerHTML=l}}}};o.onOpen=function(){e._popupDropDown._refreshPosition(),e.$.fireEvent("dropDownGridOpen"),e.$.listen("cellClick",l)},o.onClose=function(){if(e.$.unlisten("cellClick"),e.selection.enabled){const o=e._selection.focusedCell;if(o){const l=e.getCellValue(o.id,o.dataField);if(t.querySelector(".smart-action-button").innerHTML=l,e.selection.enabled&&e.selection.allowCellSelection){const l=e.getCellValue(o.id,e.dropDownModeDataField);t.querySelector(".smart-action-button").innerHTML=l}}}e.$.fireEvent("dropDownGridClose")},o.onkeydown=function(e){"Escape"===e.key&&(o.result=!1,o.close())}}}}render(){const e=this,t=()=>0===e.offsetWidth||0===e.offsetHeight;if(t())return requestAnimationFrame((()=>{e.isInitialized||t()||(e._undoRedo=[],e._refreshCurrentUser(),e._render())})),e.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._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="SmartGrid"+e.id,o=e.stateSettings.current);let l=null;e.stateSettings.storage&&(l=e.stateSettings.storage[o]),l&&(t=!0),!l&&e.stateSettings.allowLocalStorage&&(l=window.localStorage.getItem(o),l&&(t=!0))}if(!t){const t=[];for(let o=0;o<e.viewColumns.length;o++){const l=e.viewColumns[o];l.allowSort&&l.sortOrder&&t.push(l)}if(0===t.length&&e.sorting.sort)for(let o=0;o<e.sorting.sort.length;o++){const l=e.sorting.sort[o],a=Object.keys(l)[0],n=l[a],i=e.columnByDataField[a];i&&(t.push(i),i.sortOrder=n||"asc")}t.sort(((e,t)=>e.sortIndex-t.sortIndex));for(let o=0;o<t.length;o++){const l=t[o],a=e.appearance.allowSortAnimation;e.appearance.allowSortAnimation=!1,e.sortBy(l.dataField,l.sortOrder),e.appearance.allowSortAnimation=a}if(e.filtering.filter.length>0){for(let t=0;t<e.filtering.filter.length;t++){const o=e.filtering.filter[t];if(o){if("string"==typeof o){const t=e.filtering.filter[0],o=e.columnByDataField[t],l=e.filtering.filter[1];let a=null;if(o&&(a=e.dataSource._createFilter(o.dataType,l)),a){if(e.filtering.filterRow.visible&&!o._filterInfo){let e=[];for(let t=0;t<a.filters.length;t++)e.push(a.filters[t].value),t<a.filters.length-1&&e.push(a.logicalOperators[t]);o._filterInfo={condition:a.filters[0].condition,value:e.join(" ")}}e.addFilter(t,a,!1)}break}const t=o[0],l=o.splice(1);let a=null;if(l instanceof Smart.FilterGroup)a=l;else{const o=e.columnByDataField[t];o&&(a=e.dataSource._createFilter(o.dataType,l))}if(a){if(e.filtering.filterRow.visible){const o=e.columnByDataField[t];if(!o._filterInfo){let e=[];for(let t=0;t<a.filters.length;t++)e.push(a.filters[t].value),t<a.filters.length-1&&e.push(a.logicalOperators[t]);o._filterInfo={condition:a.filters[0].condition,value:e.join(" ")}}}e.addFilter(t,a,!1)}}}e.refreshFilters()}else{for(let t=0;t<e.columns.length;t++){const o=e.columns[t];if(o.filter){let t=null,l=o.filter;if(t=l instanceof Smart.FilterGroup?l:e.dataSource._createFilter(o.dataType,l),t){if(e.filtering.filterRow.visible&&!o._filterInfo){let e=[];for(let o=0;o<t.filters.length;o++)e.push(t.filters[o].value),o<t.filters.length-1&&e.push(t.logicalOperators[o]);o._filterInfo={condition:t.filters[0].condition,value:e.join(" ")}}e.addFilter(o.dataField,t,!1)}}}e.refreshFilters()}}}if(e.viewColumns.canNotify=!0,e.isInitialized=!0,("virtual"===e.scrolling||e.paging.enabled&&e.dataSource&&e.dataSource.virtualDataSource||e.dataSource&&e.dataSource.virtualDataSource)&&e._virtualDataRequest("dataBind"),""!==e.header.template&&e._applyTemplate(e.header.template,e.$.header),""!==e.footer.template&&e._applyTemplate(e.footer.template,e.$.footer),e._createFilterPanels(),e._refresh(),e._applyScrolling(),e.grouping.enabled&&e.grouping.autoExpandAll&&e.rowHierarchy?e.expandAllRows():e.grouping.enabled&&e.grouping.autoExpandToLevel&&e.rowHierarchy&&e.expandRowsToGroupLevel(e.grouping.autoExpandToLevel),e.onRender&&(e.onRender(t),e.onRender=null),e.isRendered=!0,"auto"===e.layout.rowHeight&&(e._refreshLayout(),e._recycle()),t){if(e.stateSettings.autoLoad){let t=e.stateSettings.current,o=null;e.stateSettings.storage&&(o=e.stateSettings.storage[t]),!t&&e.stateSettings.allowLocalStorage&&(e.stateSettings.current="SmartGrid"+e.id,t=e.stateSettings.current),!o&&e.stateSettings.allowLocalStorage&&(o=window.localStorage.getItem(t)),o&&("string"==typeof o&&(o=JSON.parse(o)),e._loadState(o))}if(e.onAfterInit&&(e.onAfterInit(e),e.onAfterInit=null),e.$.fireEvent("afterInit",{grid:e}),e.isRendering=!1,e.whenRenderedCallbacks){for(let t=0;t<e.whenRenderedCallbacks.length;t++)e.whenRenderedCallbacks[t]();e.whenRenderedCallbacks=[]}!e.dataSource||e.dataSource.url||e.dataSource.virtualDataSource||e.onLoad&&e.onLoad(e)}"kanban"===e.view?e._initKanbanView():"scheduler"===e.view&&e._initSchedulerView()}_initFormulaParser(){const e=this;if(e.formulas){class t{constructor(e){const t=this;let o;try{o=new formulaParser.Parser}catch(e){throw new Error("Smart.FormulaParser: Missing reference to 'formula-parser.min.js'.")}o.on("callCellValue",t._callCellValue.bind(t)),o.on("callRangeValue",t._callRangeValue.bind(t)),t.dataTable=e,t.parser=o}_getFormula(e){const t=this,o="A".charCodeAt(0);let l=0,a="";const n=e;if(t.dataTable._formulas||(t.dataTable._formulas=[]),t.dataTable._formulas[e])return t.dataTable._formulas[e];for(let n=0;n<t.dataTable.columns.length;n++){const i=t.dataTable.columns[n],r=String.fromCharCode(o+l);l++,l>=26&&(l=0,a+="A"),e.indexOf(i.label)>=0?e=e.replaceAll(i.label,a+r):e.indexOf(i.dataField)>=0&&(e=e.replaceAll(i.dataField,a+r))}return t.dataTable._formulas[n]=e,e}_callCellValue(e,t){const o=this,l=o.dataTable,a=e.column.index,n=e.row.index,i=l.columns[a].dataField;let r=l.dataSource[n][i];const s=l.rows[n];if(s){const e=s.getCell(i);e&&e.formula&&(r=o._getFormula(e.formula))}"string"==typeof r&&/=.+/.test(r)?r=o.parse(r.slice(1)):"string"==typeof r&&"number"===l.columns[a].dataType&&(r=parseFloat(r)),t(r)}_callRangeValue(e,t,o){const l=this.dataTable,a=l.dataSource,n=[];for(let o=e.row.index;o<=t.row.index;o++){const i=a[o],r=[];for(let o=e.column.index;o<=t.column.index;o++){let e=i[l.columns[o].dataField];e=isNaN(e)?0:parseFloat(e),isNaN(e)&&(e=0),r.push(e)}n.push(r)}n&&o(n)}parse(e){const t=this.parser.parse(this._getFormula(e));return null!==t.result?t.result:t.error}}e._formulaParser=new t(e)}}get _viewRows(){const e=this;if(e.__viewRows)return e.__viewRows;e._nearRowsAdded||(e._nearRowsAdded=[],e._farRowsAdded=[]);const t=e.rows.toArray?e.rows.toArray():[],o=e.rowHierarchy?e.rowHierarchy:t,l=[].concat(e._frozenNearDefaultRows,e._nearRowsAdded,o,e._farRowsAdded,e._frozenFarDefaultRows);return e.__viewRows=l,l}_toHex(e){if(-1!==e.indexOf("#"))return e;const t=/rgb\((\d+), (\d+), (\d+)\)/g.exec(e);return t?"#"+(parseFloat(t[1]).toString(16).padStart(2,"0")+parseFloat(t[2]).toString(16).padStart(2,"0")+parseFloat(t[3]).toString(16).padStart(2,"0")).toUpperCase():"#FFFFFF"}_renderConditionalFormatting(e){const t=this,o=t.conditionalFormatting;if(!o||0===o.length)return;if(!t._defaults){const e=getComputedStyle(t);t._defaults={fontFamily:e.fontFamily,fontSize:e.fontSize,text:t._toHex(e.color),highlight:t._toHex(e.backgroundColor)}}t._formatter||(t._formatter=new Smart.Utilities.ConditionalFormatter(t.dataSource)),e&&(t._formatter=new Smart.Utilities.ConditionalFormatter(t.dataSource),delete t._conditionalFormatting);const l=t._defaults,a=t._formatter,n=[],i=function(e){if("all"===e){if(t.columns&&t.columns.map){const e=[];for(let o=0;o<t.columns.length;o++){const l=t.columns[o];l.dataField.startsWith("task")||l.autoGenerated||"number"!==l.dataType&&"date"!==l.dataType||e.push(l.dataField)}return e}return[]}return[e]};for(let e=0;e<o.length;e++){o[e]=Object.assign({column:"all",condition:"lessThan",firstValue:0,secondValue:1,fontFamily:l.fontFamily,fontSize:l.fontSize,text:l.text,highlight:l.highlight},o[e]);const t=o[e],r=i(t.column),s=t.condition;a.color=t.highlight,a.comparator=t.firstValue,a.min=t.firstValue,a.max=t.secondValue;const d=a.format(s,r);for(let e in d){const o=d[e];for(let e in o){const l=o[e];l.color=t.text,l.fontFamily=t.fontFamily,l.fontSize=t.fontSize}}n.push(d)}if(t._formattingPanel&&(t._formattingPanel.items=o),0===n.length)return n[0];const r={};for(let e=0;e<n.length;e++){const t=n[e];for(let e in t){const o=t[e];if(0!==Object.keys(o).length){r[e]||(r[e]={});for(let t in o)r[e][t]=Object.assign({},r[e][t],o[t])}}}t._conditionalFormatting=r,e&&t._recycle(!1)}_stickHeader(){const e=this;e._stickyHeaderHandler=function(){e._handleStickyHeader()},e.$.columnHeader.style.top="",e.$.columnHeader.classList.remove("smart-columns-sticky");let t=e.parentNode;for(e.isInShadowDOM&&t===e.getRootNode()&&(t=e.getRootNode().host);t!==document&&t;)t.addEventListener("scroll",e._stickyHeaderHandler),t=t.parentNode,e.isInShadowDOM&&t===e.getRootNode()&&(t=e.getRootNode().host);try{null!==window.top&&window.top!==window.self&&window.top.document.addEventListener("scroll",e._stickyHeaderHandler)}catch(e){}e._handleStickyHeader()}_unstickHeader(){const e=this;e.$.columnHeader.style.top="",e.$.columnHeader.classList.remove("smart-columns-sticky");let t=e.parentNode;for(;t!==document.body;)t.removeEventListener("scroll",e._stickyHeaderHandler),t=t.parentNode,e.isInShadowDOM&&t===e.getRootNode()&&(t=e.getRootNode().host);try{(""!==document.referrer||window.frameElement)&&null!==window.top&&window.top!==window.self&&window.top.document.removeEventListener("scroll",e._stickyHeaderHandler)}catch(e){}}_handleStickyHeader(){const e=this;if(e.appearance.allowColumnStickyPosition)if(e.$.columnHeader.classList.add("smart-columns-sticky"),0===document.scrollTop&&0===e.parentElement.scrollTop)e.$.columnHeader.style.top="";else{let t=e.parentNode,o=0;for(;t!==document.body;)o+=parseInt(t.scrollTop),t=t.parentNode,e.isInShadowDOM&&t===e.getRootNode()&&(t=e.getRootNode().host);const l=parseInt(e.clientTop+o);e.$.columnHeader.style.top=l+"px";let a=0;window.top!==window.self&&parseInt(window.top.scrollY)>parseInt(e._offsetTop(window.frameElement))&&(a=parseInt(window.top.scrollY)-parseInt(e._offsetTop(window.frameElement))),window.scrollY+a>e.offsetTop&&(e.$.columnHeader.style.top=parseInt(window.scrollY)-parseInt(e.offsetTop)+l+a+"px")}}_scrollHandler(){this._handleStickyHeader()}_initializeRowNumberColumn(){const e=this;if(e._frozenNearColumns&&e._frozenNearColumns.length>0&&e._frozenNearColumns[0].rowHeaderColumn)return void(e._frozenNearColumns[0].visible=e.appearance.showRowHeaderNumber||e.appearance.showRowHeader);const t=new Smart.Grid.Column({dataField:"_rowHeaderColumn",label:"",allowSelect:!1,freeze:!0,visible:!0,grid:e,autoGenerated:!0,rowHeaderColumn:!0,cellsAlign:"center"}),o=e.rows?e.rows.length:e.dataSource?e.dataSource.length:0;let l=e.appearance.showRowHeaderNumber?t._measureSize(o):30;e.layout.autoGenerateColumnWidth&&(l=e.layout.autoGenerateColumnWidth),e.appearance.showRowComments&&(l=25,t.minWidth=25),t.width=l,t.createElement();const a=new Smart.Observable(t,t.observables);e.viewColumns.splice(0,0,a),e._frozenNearColumns.splice(0,0,a)}_initializeColumns(){const e=this;if("number"==typeof e.columns){const t=[],o="A".charCodeAt(0);let l="",a=0;for(let n=0;n<e.columns;n++){let i=n+1;const r=String.fromCharCode(o+a);a++;const s=l+r;"number"!==e.appearance.autoGenerateColumnLabelMode&&(i=l+r),t.push({align:"center",label:i,dataField:s,width:100}),a>=26&&(a=0,l+="A")}e._boundColumns=t}else e._boundColumns=Array.isArray(e.columns)?[...e.columns]:[...e.columns.toArray()];e._initColumns=e.columns,e.columnByDataField=[],e.viewColumns=[],e.columns=new Smart.ObservableArray,e._frozenFarColumns=[],e._frozenNearColumns=[],e._summaryRowCount=1;let t=0;const o=function(t){if(e.dataSource.dataFields){const o=e.dataSource.dataFields.find((e=>{if(e.name===t.dataField)return e})),l=o&&o.dataType||"string";t.dataType||(t.dataType=l)}};if(0===e._boundColumns.length&&e.dataSource&&e.dataSource[0]&&!1!==e.dataSource.autoGenerateColumns){const t=e.dataSource[0];if(t.$&&t.$.isEmpty&&e.dataSource.dataFields)for(let t=0;t<e.dataSource.dataFields.length;t++){const o=e.dataSource.dataFields[t],l=e._boundColumns.length,a={index:l,visibleIndex:l,label:o.name,dataField:o.name,dataType:o.dataType};e._boundColumns.push(a)}else for(let l in t){if(l.startsWith("_")||"$"===l)continue;const t=e._boundColumns.length,a={index:t,visibleIndex:t,label:l,dataField:l};o(a),e._boundColumns.push(a)}}for(let l=0;l<e._boundColumns.length;l++){let a=e._boundColumns[l];if("string"==typeof a){if(e.dataSource.dataFields){const t=e.dataSource.dataFields.find((e=>{if(e.name===a)return e}));a={label:a,dataField:a,dataType:t&&t.dataType||"string"}}}else o(a);a.visibleIndex=l,a.index=l,a.grid=e,a.label&&/<.+?>/.test(a.label)&&a.label.replace&&("all"===e.dataSourceSettings.sanitizeHTML?a.label=a.label.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/'/g,"&#39;").replace(/"/g,"&quot;"):"blackList"===e.dataSourceSettings.sanitizeHTML&&(a.label=window.Smart.Utilities.Core.escapeHTML(a.label)));const n=new Smart.Grid.Column(a);e.onColumnInit&&e.onColumnInit(l,n);for(let t in n)-1!==n.properties.indexOf(t)||t.startsWith("_")||e.error(e.localize("invalidColumnProperty",{elementType:"Grid",propertyName:t,type:n.dataField||"Column"}));delete a.grid,delete a.dataType,delete a.index,delete a.visibleIndex,n.grid=e,e.columns.push(n),n._dataField&&(e.columnByDataField[n._dataField]=n);const i=e.columns[e.columns.length-1];e._summaryRowCount=Math.max(e._summaryRowCount,n.summary.length),n.freeze?!0===n.freeze||"near"===n.freeze?(e.viewColumns.splice(t++,0,i),e._frozenNearColumns.push(i)):"far"===n.freeze&&e._frozenFarColumns.push(i):e.viewColumns.push(i),e.columnByDataField[n.dataField]?(i.parent=e.columnByDataField[n.dataField],e.columnByDataField[n.dataField].children||(e.columnByDataField[n.dataField].children=[]),e.columnByDataField[n.dataField].children.push(i),n.valueField=n.dataField,n.dataField+="_"+e.columnByDataField[n.dataField].children.length,n.displayField=n.valueField,e.columnByDataField[n.dataField]=i):e.columnByDataField[n.dataField]=i,e.onColumnInserted&&!e.isInitialized&&e.onColumnInserted(l,n.getState())}e.viewColumns=e.viewColumns.concat(e._frozenFarColumns),e.setAttribute("aria-colcount",e._boundColumns.length);let l=0;if((e.appearance.showRowHeaderNumber||e.appearance.showRowHeader)&&(e._initializeRowNumberColumn(),l++),e.rowDetail.enabled){const t=20,o=new Smart.Grid.Column({dataField:"_rowDetailColumn",allowSelect:!1,visible:e.rowDetail.visible,label:"",grid:e,freeze:!0,rowDetailColumn:!0,autoGenerated:!0,cellsAlign:"center",width:t,minWidth:t}),a=new Smart.Observable(o,o.observables);e.rowDetailColumn=a,"near"===e.rowDetail.position?(e.viewColumns.splice(l,0,a),o.freeze="near",a.freeze="near",e._frozenNearColumns.splice(l,0,a)):(e.viewColumns.push(a),e._frozenFarColumns.splice(0,0,a)),l++}const a=new Smart.Grid.Column({dataField:"_adaptiveColumn",allowSelect:!1,visible:!1,label:"",grid:e,freeze:"far",adaptiveColumn:!0,autoGenerated:!0,cellsAlign:"center",width:30});new Smart.Observable(a,a.observables).canNotify=!1;const n=new Smart.Grid.Column({dataField:"_commandColumn",allowSelect:!1,visible:e.editing.enabled&&e.editing.commandColumn.visible&&!e.editing.commandColumn.inline,label:"",grid:e,freeze:"far",commandColumn:!0,autoGenerated:!0,align:"center",cellsAlign:"center",width:""}),i=new Smart.Observable(n,n.observables);i.canNotify=!1,e.editing.commandColumn.visible&&("near"===e.editing.commandColumn.position?(n.freeze="near",i.freeze="near",e.viewColumns.splice(l,0,i),e._frozenNearColumns.splice(l,0,i)):(e.viewColumns.push(i),e._frozenFarColumns.splice(0,0,i))),e._commandColumn=i;const r=new Smart.Grid.Column({allowSelect:!1,visible:e.selection.enabled&&e.selection.checkBoxes.enabled,dataField:"_checkBoxColumn",label:"",freeze:e.selection.checkBoxes.position,grid:e,selectionColumn:!0,autoGenerated:!0,cellsAlign:"center",width:32}),s=new Smart.Observable(r,r.observables);if(e.selection.checkBoxes.enabled&&("near"===r.freeze?(e.viewColumns.splice(l,0,s),e._frozenNearColumns.splice(l,0,s)):(e.viewColumns.push(s),e._frozenFarColumns.splice(0,0,s))),e._selectionColumn=s,e._selectionColumn.canNotify=!1,e.editing.addNewColumn.visible){const t=new Smart.Grid.Column({dataField:"_addNewColumn",allowSelect:!1,visible:!0,title:e.localize("addNewColumn"),label:"",cellsClassName:"smart-add-new-column",className:"smart-add-new-column smart-icon smart-grid-icon show smart-icon-plus",grid:e,adaptiveColumn:!1,autoGenerated:!0,cellsAlign:"center",width:90}),o=new Smart.Observable(t,t.observables);e.viewColumns.push(o),e._addNewColumn=o,e._addNewColumn.canNotify=!1}e._observeColumns(),e._templateColumns()}get styleProperties(){return["grid-template-columns","--smart-grid-row-height","--smart-grid-column-header-height","--smart-grid-group-header-height","--smart-grid-filter-footer-height","--smart-grid-group-row-vertical","--smart-grid-group-row-horizontal-offset","--smart-grid-freeze-splitter-size","--smart-grid-resize-line-size","--smart-grid-footer-height","--smart-grid-header-height"]}_templateColumns(){const e=this,t=getComputedStyle(e),o=t.getPropertyValue("--smart-grid-template-columns").trim();if(e._rowGap=0,e._columnGap=0,e._maxHeight=parseInt(t.maxHeight),e._minHeight=parseInt(t.minHeight),"none"!==o){let t=0;for(let o=0;o<e.viewColumns.length;o++)e.viewColumns[o].autoGenerated&&(t+=e.viewColumns[o].visible?e.viewColumns[o].width:0);let l=[];const a=document.createElement("div");a.style.display="grid",a.style.gridTemplateColumns=o;for(let t=0;t<e.columns.length;t++)a.innerHTML+="<div></div>";a.style.width=e.clientWidth-t+"px",e.$.root.appendChild(a);const n=o.split(" ");for(let t=0;t<e.columns.length;t++)l[t]=a.children[t].offsetWidth,"auto"===n[t]&&(l[t]=null);a.parentNode.removeChild(a);let i=0;for(let t=0;t<e.viewColumns.length;t++){const o=e.viewColumns[t];o.autoGenerated||l[i]&&(o.width=o.templateWidth=l[i++])}}else for(let t=0;t<e.viewColumns.length;t++){const o=e.viewColumns[t];o.autoGenerated||o.templateWidth&&(o.width=o.templateWidth=null)}}setColumns(e){const t=this;if(null===e)return void(t.columns=[]);t.beginUpdate(),t.columns.canNotify=!1;let o=[],l=[];for(let l=0;l<e.length;l++){const a=e[l];let n=!0;for(let e=0;e<t.columns.length;e++)if(t.columns[e].dataField===a.dataField){n=!1;break}n&&o.push(a)}const a=e.map((e=>e.dataField));for(let e=0;e<t.columns.length;e++){const o=t.columns[e];-1===a.indexOf(o.dataField)&&l.push(o)}l.forEach((e=>{const o=t.columns.indexOf(e);o>=0&&t.columns.splice(o,1)}));for(let e=0;e<o.length;e++)t.columns.push(o[e]);if(t.columns.canNotify=!0,t.endUpdate(),t._columnGroups=[],t._columnHeights=0,t.viewColumns)for(let e=0;e<t.viewColumns.length;e++){const o=t.viewColumns[e],l=o.element;o.top=0,o.level=0,l&&(l.style.top="",l.style.height="",l.style.lineHeight="")}if(t._renderColumns(),t.__columnHeaderHeight=null,e){t.beginUpdate();const o=t.context;t.context=document;for(let o=0;o<e.length;o++){const l=e[o],a=t.columnByDataField[l.dataField];["allowExport","allowFreeze","allowNull","allowGroup","allowSelect","verticalAlign","columnGroup","cellsVerticalAlign","autoCloseMenu","autoShowActionButton","autoShowSortButton","autoShowFilterButton","allowLabelAnimation","allowActionButtonAnimation","allowSortButtonAnimation","allowHide","allowDelete","allowEdit","allowSummary","allowHeaderEdit","allowFilter","allowSort","allowSortToggleOnClick","allowResize","allowReorder","description","icon","menuItems","summary","cellsFormat","className","rowSpan","cellsClassName","cellsCSSRules","formatSettings","formatFunction","sortIndex","sortOrder","sortComparator","groups","group","filtered","filterEditor","filter","filterMenuMode","defaultValue","dataField","displayField","label","labelTemplate","dataType","align","cellsWrap","cellsAlign","minWidth","width","visible","_visible","freeze","showActionButton","selected","showIcon","highlight","showDescriptionButton","treeColumn","statusColumn","value","valueField","onAction","title","showCustomButton","showFilterButton","showSortButton","editor","template","visibleIndex","validationRules"].forEach((e=>{void 0!==l[e]&&(a[e]=l[e])}))}t.context=o,t.endUpdate(!1)}t.refresh()}onAttached(){const e=this;if(!e._scrollView){e._scrollView=new Smart.Utilities.Scroll(e,e.$.horizontalScrollBar,e.$.verticalScrollBar);const t=e._scrollView.hScrollBar;e._scrollView.vScrollBar.onChange=e._verticalScrollbarHandler.bind(e),t.onChange=e._horizontalScrollbarHandler.bind(e)}if(e.isRendered&&e.isCompleted&&(e._isDestroyed||e.behavior.autoDestroy)){if(e.header.visible&&""===e.header.template){let t=e.$.header;e.header.appendTo&&(t=document.querySelector(e.header.appendTo),t?t.onclick=t=>{e._headerClickHandler(t)}:t=e.$.header),t.innerHTML='<smart-grid-toolbar header-position="top"></smart-grid-toolbar>',e.$.headerBar=t.firstElementChild;const o=e.$.headerBar;o.messages=e.messages,o.locale=e.locale,e.$.headerBar._init(e),o.render(),e.header.onInit&&e.header.onInit(e.$.headerBar)}e._render()}}destroy(){const e=this;if(!e.isRendered)return;e._isDestroyed=!0,["_dialogChart","_dialogAddRow","_dialogEdit","_dialogDelete","_dialogRowDetail","_dialogAddColumn"].forEach((t=>{e[t]&&(e[t].close(),e[t]=null)})),e.menu&&(e.menu.ownerElement=null,e.menu.remove(),e.menu=null);const t=e.$.headerBar;if(t){const e=t.$.headerDropDown;e&&e.remove()}e._resetCachedLayout();const o=e._scrollView.hScrollBar,l=e._scrollView.vScrollBar;if(l.ownerElement=null,o.ownerElement=null,l.onChange=null,o.onChange=null,e._scrollView&&(e._scrollView.unlisten(),delete e._scrollView),e._columnElements)for(let t=0;t<e._columnElements.length;t++)e._columnElements[t]._detach();if(e._columnElements=null,e._rowElements)for(let t=0;t<e._rowElements.length;t++)e._rowElements[t]._detach();e._rowElements=null,e.rows=[],e.rowById=[],e._initColumns=[],e.columnByDataField=[],e.viewColumns=[],e._columnToResizeElement=null;let a=Array.isArray(e.columns)?[...e.columns]:[...e.columns.toArray()];a=a.map((e=>e.data?(void 0!==e.data.visibleIndex&&delete e.data.visibleIndex,void 0!==e.data.index&&delete e.data.index,void 0!==e.data.grid&&delete e.data.grid,e.data):e)),e.rows.notifyFn=null,e.columns.notifyFn=null,e.columns.notify=null,e.columns._array=[],e.columns=a,e._boundColumns=[],e._filterPanels=[],e._frozenFarColumns=[],e._frozenNearColumns=[],e._frozenNearDefaultRows=[],e._frozenFarDefaultRows=[],e._frozenFarRows=[],e._frozenNearRows=[],e._selection&&e._selection.selectionRect&&(e._selection.selectionRect.parentNode&&e._selection.selectionRect.parentNode.removeChild(e._selection.selectionRect),e._selection.selectionRect=null),e._selection={rows:[],indexes:[],columns:[],cells:[]},e.__autoHeightRows=null,e._visibleRows=null,e.__viewRows=null,e.__clientSize=null,e.__scrollHeight=null,e.__scrollWidth=null,e.__parentCells=null,e._selectionColumn=null,e._adaptiveColumn=null,e._commandColumn=null,delete e._columnFarContainerComputedStyle,delete e._columnContainerComputedStyle,delete e._columnNearContainerComputedStyle,e._inputOverlay&&(e._inputOverlay.parentNode&&e._inputOverlay.parentNode.removeChild(e._inputOverlay),e._inputOverlay=null),e._firstVisibleColumn=null,e._lastVisibleColumn=null,e._toggledRow=null,Smart(e._selector)&&(delete Smart(e._selector)._properties,Smart(e._selector)),delete e._selector,delete e._initProperties}onDetached(){const e=this;e.behavior.autoDestroy&&e.destroy()}_observeColumns(){const e=this,t=function(t,o,l,a){if(l!==a||"selected"===o){if(null==l&&null==a)return;if(l&&"object"==typeof l&&Array.isArray(l)&&a&&"object"==typeof a&&Array.isArray(a)&&JSON.stringify(l)===JSON.stringify(a))return;t.propertyChanged(o,l,a),e.onColumnChange?t.stateProps.indexOf(o)>=0&&e.onColumnChange(t,o,l,a):e.$.fireEvent("columnChange",{column:t,propertyName:o,oldValue:l,value:a})}};for(let o=0;o<e.viewColumns.length;o++){const l=e.viewColumns[o];l.rowHeaderColumn||(l.onAction=function(){e._openMenu(this)}),l.autoGenerated&&l.notify((function(e){l.canNotify=!1,t(l,e.propertyName,e.oldValue,e.newValue),l.canNotify=!0}))}e.columns.notify((function(o){let l=null;if(o.path)return e.columns.canNotify=!1,t(o.target,o.propertyName,o.oldValue,o.newValue),void(e.columns.canNotify=!0);e.columns.canNotify=!1;let a=0;switch(o.action){case"length":return void(e.columns.canNotify=!0);case"add":{const t=function(t){if(l=o.object[t],l instanceof Smart.Grid.Column==0){l.grid=e,l=new Smart.Grid.Column(l);const a=e.columns.canNotify;e.columns.canNotify=!1,o.object[t]=l,l=o.object[t],e.columns.canNotify=a}l.grid=e,l.onAction=function(){e._openMenu(this)},l.freeze?e._frozenNearColumns.push(l):"far"===l.freeze&&e._frozenFarColumns.push(l);let a=e.viewColumns.length-e._frozenFarColumns.length,n=0;if(e._frozenNearColumns.forEach((e=>{e.autoGenerated&&n++})),t<e.columns.length?e.viewColumns.splice(t+n,0,l):e.viewColumns.splice(a,0,l),e.columnByDataField[l.dataField]){e.columnByDataField[l.dataField].children.push(l),l.parent=e.columnByDataField[l.dataField],l.valueField=l.dataField;const t=l.dataField+"_"+l.parent.children.length;e.columnByDataField[t]=l,l.dataField=t}else e.columnByDataField[l.dataField]=l;if(e.dataSource&&e.dataSource.dataFields){let t=!1;for(let o=0;o<e.dataSource.dataFields.length;o++)e.dataSource.dataFields[o].name===l.dataField&&(t=!0);t||e.dataSource.dataFields.push({name:l.dataField,dataType:l.dataType||"string"})}if(!e._dragDrop&&e.onColumnInserted){e._onColumnInsertData||(e._onColumnInsertData=[],e._onColumnInsertIndexes=[]);const o=l.getState();o.dataField=l.dataField,e._onColumnInsertData.push(o),e._onColumnInsertIndexes.push(t),e._onColumnInsertTimer&&clearTimeout(e._onColumnInsertTimer),e._onColumnInsertTimer=setTimeout((()=>{e.onColumnInserted(e._onColumnInsertIndexes,e._onColumnInsertData),delete e._onColumnInsertIndexes,delete e._onColumnInsertData}),50)}};delete e.__measuredColumnHeight;for(let e=0;e<o.addedCount;e++)t(o.index+e);break}case"update":l=o.object[o.index],l instanceof Smart.Grid.Column==0&&(l=new Smart.Grid.Column(l)),l.grid=e;for(let t=0;t<o.index;t++)e.viewColumns[t].autoGenerated&&a++;e.viewColumns[a+o.index]=l,e.columnByDataField[l.dataField]=l,e.onColumnUpdated&&e.onColumnUpdated(o.index,l);break;case"remove":{l=o.removed[0];let t=o.index,n=e.viewColumns.indexOf(l);if(-1===n){for(let o=0;o<=t;o++)e.viewColumns[o].autoGenerated&&a++;e.viewColumns.splice(a+t,1)}else e.viewColumns.splice(n,1);if(l){if(l.filter&&e.removeFilter(l.dataField),l.sortOrder&&e.removeSort(l.dataField),e.removeGroup(l.dataField),l._dataField){const t=e.columnByDataField[l._dataField];t&&t.dataField===l.dataField&&delete e.columnByDataField[l._dataField]}delete e.columnByDataField[l.dataField]}if(e._dragDrop||e.onColumnRemoved&&e.onColumnRemoved(o.index,l),e.columnGroups&&(e._columnGroups=[],e._columnHeights=0,e.viewColumns))for(let t=0;t<e.viewColumns.length;t++){const o=e.viewColumns[t],l=o.element;o.top=0,o.level=0,l&&(l.style.top="",l.style.height="",l.style.lineHeight="")}break}}e._initializeColumnGroupsHierarchy(),e._refreshColumnsResponsiveVisibility(),e._createColumnHeaderCellElements(),e._templateColumns(),e.refresh(),e.columnGroups&&e._columnGroups.length>0&&e._renderColumnGroupHeaders(),e.columns.canNotify=!0}))}get _scrollWidth(){const e=this;if(e.__scrollWidth)return e.__scrollWidth;let t=0;for(let o=0;o<e.viewColumns.length;o++){const l=e.viewColumns[o];l.visible&&(t+=l.computedWidth)}return t=parseInt(t),"card"===e.view&&(t=0),e.__scrollWidth=t,e._scrollView.scrollWidth=t-e._clientSize.width,e.__scrollWidth}_horizontalScrollbarHandler(){const e=this;e.closeMenu(),e.isScrolling=!0,e.isHScrolling=!0,e._hScrollTimer&&clearTimeout(e._hScrollTimer),e._hScrollTimer=setTimeout((()=>{e._summaryRowDialog&&e._summaryRowDialog.classList.contains("open")&&e._summaryRowDialog.close(),e._recycle(),e.isScrolling=!1,e.isHScrolling=!1}))}_mouseWheelNative(e,t){const o=this;void 0===o._scrollWheelContent&&(o._scrollWheelContent=document.createElement("div"),o._scrollWheelContent.style.width="100%",o._scrollWheelContent.style.height="100%",o._scrollWheelContent.style.position="absolute",o._scrollWheelContent.style.left="0px",o._scrollWheelContent.style.top="0px",o._scrollWheelContent.style.background="white",o._scrollWheelContent.style.zIndex=9999,o._scrollWheelContent.style.opacity=0,o._scrollWheelContent.style.overflow="auto",o._scrollWheelContent.style.visibility="hidden");let l=0;const a=()=>{if(t){const t=o._scrollWheelContent.scrollLeft;o._scrollView.hScrollBar.value=t,t===e&&o._scrollWheelContent.remove()}else{const t=o._scrollWheelContent.scrollTop;o._scrollView.vScrollBar.value=t,t===e&&o._scrollWheelContent.remove()}};o._scrollWheelContent.onscroll=()=>{cancelAnimationFrame(l),l=0,l=requestAnimationFrame(a)},o._scrollWheelContentView||(o._scrollWheelContentView=document.createElement("div"),o._scrollWheelContent.appendChild(o._scrollWheelContentView)),o._scrollWheelContentView.style.width=o.offsetWidth+o._scrollView.scrollWidth+"px",o._scrollWheelContentView.style.height=o.offsetHeight+o._scrollView.scrollHeight+"px",o.$.scrollView.appendChild(o._scrollWheelContent),o._scrollWheelContent.scrollTop=o._scrollView.vScrollBar.value,o._scrollWheelContent.scrollLeft=o._scrollView.hScrollBar.value,!0===t?o._scrollWheelContent.scrollTo({top:o._scrollView.vScrollBar.value,left:e,behavior:"smooth"}):o._scrollWheelContent.scrollTo({top:e,left:o._scrollView.hScrollBar.value,behavior:"smooth"})}_mouseWheelHandler(e){const t=this;if(t._scrollView.hScrollBar.$.hasClass("smart-hidden")&&t._scrollView.vScrollBar.$.hasClass("smart-hidden"))return;if(42===e.pointerId)return;if(t._isUpdating)return;if(t.editing.isEditing)return;if(!t.behavior.allowMouseWheel)return;const o=t.querySelector("smart-grid-toolbar");if(o&&o.$.headerDropDown.classList.contains("open"))return;let l=!1;if(e.wheelDeltaY?120!==Math.abs(e.wheelDeltaY)&&240!==Math.abs(e.wheelDeltaY)&&360!==Math.abs(e.wheelDeltaY)&&(l=!0):0===e.deltaMode&&(l=!0),t.disabled||t._scrollView.vScrollBar.$.hasClass("smart-hidden")||e.shiftKey||!e.deltaY){if(!t.disabled&&(!t._scrollView.hScrollBar.$.hasClass("smart-hidden")||e.shiftKey)){e.stopPropagation(),e.preventDefault();let o=160;const a=0===e.deltaX?e.wheelDelta:e.deltaX;a<0&&(o=-160),Math.abs(a)>=100&&!l&&!Smart.Utilities.Core.Browser.Firefox?t._mouseWheelNative(t._scrollView.scrollLeft+o,!0):t._scrollView.scrollLeft+=a}}else{const o=t.scrollTop;if(0===o&&e.deltaY<0||o===t.scrollHeight&&e.deltaY>0)return;e.stopPropagation(),e.preventDefault();let a=15*t.layout.rowMinHeight;if(e.deltaY<=0&&(a=-15*t.layout.rowMinHeight),Math.abs(e.deltaY)>=100&&!l&&!Smart.Utilities.Core.Browser.Firefox)t._mouseWheelNative(t._scrollView.scrollTop+a);else{t._wheelrafId=0;const o=()=>{t._scrollView.scrollTop+=e.deltaY};cancelAnimationFrame(t._wheelrafId),t._wheelrafId=0,t._wheelrafId=requestAnimationFrame(o)}}}_refresh(e){const t=this;if(t._isUpdating)return;const o=t.$.verticalScrollBar.offsetWidth;t.removeAttribute("grouped"),t.removeAttribute("tree");let l=!0;t.__autoHeightRows&&(t.__autoHeightRows=null,t._refreshColumnsResponsiveVisibility(),t._recycle(),l=!1),t._groups||(t._groups=[]),t._cellCachedValues=[],t.grouping.enabled&&t.dataSource.groupBy&&t.dataSource.groupBy.length>=0&&("advanced"===t.grouping.renderMode?t.setAttribute("grouped",""):t.setAttribute("tree",""),t._groups||(t._groups=[].concat(t.dataSource.groupBy.toArray())||[]),t._renderGroupBar()),t.grouping.enabled&&t.dataSource.groupBy&&0===t.dataSource.groupBy.length?t.$.breadcrumb&&(t.$.breadcrumb.dataSource=[]):t.dataSource.boundHierarchy&&(t.setAttribute("tree",""),t.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._deleteCopyRects(),t._conditionalColors&&t._conditionalColors.update&&t._conditionalColors.update(),"add"===e||"remove"===e||"update"===e?(t._rowChangeTimeout&&clearTimeout(t._rowChangeTimeout),"remove"===e?(t._recycle(!1),t._refreshHeaderBar()):t._rowChangeTimeout=setTimeout((()=>{t._recycle(!1),t._refreshHeaderBar()}),100)):(t._recycle(),t._refreshHeaderBar()),t._recyclingRows&&0===t._recyclingRows.length&&(t.$.placeholder.classList.remove("smart-hidden"),t.scrollHeight=0,t.$.placeholder.innerHTML=t.messages[t.locale]&&t.messages[t.locale].placeholder?t.localize("placeholder"):t.appearance.placeholder,t.filtering.filterRow.visible&&(t.$.placeholder.style.top="0px",t.$.placeholder.style.position="relative",t._filters&&t._filters.length&&(t.$.placeholder.style.top="12px")),t._filters&&t._filters.length&&(t.$.placeholder.innerHTML=`<span class="smart-grid-icon show smart-icon-filter" style="\n font-size: calc(2 * var(--smart-font-size));\n cursor: default;\n margin-right: 10px;\n "></span>${t.localize("filteredRecords")}`)),t.dataSource&&t.dataSource.boundHierarchy&&t.conditionalFormatting&&t._renderConditionalFormatting(!1),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,o.hasAttribute("tree")&&o.dataSource&&o.dataSource.childrenDataField&&(m.index=s),!m.groupDataField&&o.appearance.showTreeRowHeader&&(m.groupDataField=o.columns[m.level].dataField),m.label=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();let e=0,t=o.rows.canNotify;o.rows.canNotify=!1;for(let t=0;t<o.rowHierarchy.length;t++){const l=o.rowHierarchy[t],a=o.layout.rowHeight||o.layout.rowMinHeight;void 0===l.top&&(l.top=e,l.height=l.cellHeight=a),l.height?e+=l.height:e+=a}o.rows.canNotify=t,o._recycle(!1,!0)}if(o.grouping.summaryRow.visible&&!o.grouping.summaryRow.inline){const e=function(t,o,l,a){if(0!==t&&o.length>0&&o[o.length-1]&&!o[o.length-1].summaryRow){let e={label:" ",boundSource:[],groupDataField:l.data.groupDataField,$:{},summaryRow:!0,leaf:!0,level:t,expandHeight:0,siblings:o};e.$.id="SubRow"+a+"_"+l.data.$.id,l&&(e.parent=l.data,e.parentId=l.data.$.id),e.data=Object.assign(e),o.push(e)}for(let t=0;t<o.length;t++)o[t]&&o[t].data&&o[t].data.children&&e(o[t].level+1,o[t].data.children,o[t],t)};e(0,o.rowHierarchy,null,0)}}}applyContent(){}_refreshContentHeight(){const e=this;let t=e._clientSize.height;const o=window.scrollY;let l,a,n=!1;if((!e._contentHeight||e._maxHeight||e._autoHeight||e.__autoHeight||"hidden"===e.verticalScrollBarVisibility)&&(n=!0),n&&(l=e.offsetHeight,e.$.container.classList.add("smart-hidden"),a=e.offsetHeight,e.$.container.classList.remove("smart-hidden")),window.scrollY!==o&&window.scrollTo(window.scrollX,o),"hidden"===e.verticalScrollBarVisibility||e.layout.autoHeight||l!==a||e._minHeight&&e._minHeight===l)return t=e._scrollHeight+e.$.columnHeader.offsetHeight+e.$.filterFooter.offsetHeight,e.header.visible&&!e.header.appendTo&&(t+=e.$.header.offsetHeight),e.summaryRow.visible&&(t+=e.layout.rowMinHeight),0===e._recyclingRows.length&&0===e._scrollHeight&&(t+=e.$.scrollView.offsetTop),e._minHeight>t&&(t=e._minHeight),e.$.content.style.height=t+"px",e._contentHeight=t,void(e._maxHeight<t?(e._autoHeight=!1,e.$.content.classList.remove("auto-height"),e.$.content.style.height=e._maxHeight+"px",e.header.visible&&!e.header.appendTo?(e.$.content.style.height=e._maxHeight-e.$.header.offsetHeight+"px",e._contentHeight=e._maxHeight-e.$.header.offsetHeight):e._contentHeight=e._maxHeight):(e._autoHeight=!0,e.__autoHeight=!0,e.$.content.classList.add("auto-height"),e.filtering.filterRow.visible&&(e.filtering.filterRow.visible,e._contentHeight=t,e.$.content.style.height=e._contentHeight+"px"),e.header.visible&&!e.header.appendTo?(e._contentHeight=t-e.$.header.offsetHeight,e.$.content.style.height=e._contentHeight+"px"):e.summaryRow.visible&&(e.$.content.style.height=e._contentHeight+"px")));if(e.header.visible&&!e.header.appendTo&&(t-=e.$.header.offsetHeight),(e.groupHeader.visible||e.grouping.groupBar.visible)&&(t-=e.$.groupHeader.offsetHeight),e.footer.visible&&(t-=e.$.footer.offsetHeight),e.pager.visible&&(t-=e.$.headerPager.offsetHeight,t-=e.$.footerPager.offsetHeight),e.editing.enabled&&e.editing.commandBar.visible&&(t-=e.$.headerCommandBar.offsetHeight,t-=e.$.footerCommandBar.offsetHeight),e.$.content.style.height!==t+"px"&&(e.$.content.style.height=t+"px"),e.$.viewContent.style.height!==t+"px"&&(e.$.viewContent.style.height=t+"px"),e._contentHeight=t,!e.appearance.showViewBar||e.appearance.viewBarAppendTo||e.appearance.showViewBarAsDropdown)e.$.viewBar.classList.add("smart-hidden"),e.$.content.style.width="",e.$.viewContent.style.width="",e.$.content.style.marginLeft="",e.$.viewContent.style.marginLeft="";else{const o=e.layout.viewBarWidth+5;e.$.viewBar.classList.remove("smart-hidden"),e._mobile||(e.$.content.style.width="calc(100% - "+o+"px)",e.$.viewContent.style.width="calc(100% - "+o+"px)",e.$.content.style.marginLeft=o+"px",e.$.viewContent.style.marginLeft=o+"px"),e.$.viewBar.style.width=o+"px";let l=0;e.header.visible&&!e.header.appendTo&&(l+=e.$.header.offsetHeight),(e.groupHeader.visible||e.grouping.groupBar.visible)&&(l+=e.$.groupHeader.offsetHeight),e.pager.visible&&(l+=e.$.headerPager.offsetHeight),e.$.viewBar.style.top=l+"px",e.$.viewBar.style.height=t+"px"}}appendChild(){const e=Array.prototype.slice.call(arguments,2);return HTMLElement.prototype.appendChild.apply(this,e.concat(Array.prototype.slice.call(arguments)))}removeChild(){const e=Array.prototype.slice.call(arguments,2);return HTMLElement.prototype.removeChild.apply(this,e.concat(Array.prototype.slice.call(arguments)))}get _contentBorder(){const e=this;if(e.__contentBorder)return e.__contentBorder;const t=getComputedStyle(e.$.content),o={left:parseFloat(t.borderLeftWidth)+parseFloat(t.borderRightWidth),top:parseFloat(t.borderTopWidth)+parseFloat(t.borderBottomWidth)};return e.__contentBorder=o,o}_refreshAutoSize(){const e=this;if(e.layout.autoWidth){const t=e._isUpdatingScrollBars;e._isUpdatingScrollBars=!0;let o=2;for(let t=0;t<e.viewColumns.length;t++){const l=e.viewColumns[t];l.visible&&(o+=l.computedWidth)}o+=e.$.verticalScrollBar.offsetWidth>0?e.$.verticalScrollBar.offsetWidth:0,e.style.width=o+"px",requestAnimationFrame((()=>{e._isUpdatingScrollBars=t}))}e.layout.autoHeight&&(e.style.height="auto")}_refreshLayout(){const e=this,t=e.rows;if(e._layoutSuspended)return;e._visibleRows=null,e.__viewRows=null,e.__clientSize=null,e.__scrollHeight=null,e.__scrollWidth=null,e.__parentCells=null,e.$.columnFarContainer.classList.remove("vscroll"),e.$.columnNearContainer.classList.remove("vscroll"),e.$.scrollView.classList.remove("hscroll"),e.$.scrollView.classList.remove("vscroll"),e._refreshAutoSize(),e._refreshElementsVisibility(),e._refreshRowHierarchy(),e._refreshColumnHeights(),e._refreshContentHeight();const o=()=>{e.$.placeholder.classList.remove("smart-hidden"),e.$.placeholder.innerHTML=e.messages[e.locale]&&e.messages[e.locale].placeholder?e.localize("placeholder"):e.appearance.placeholder,e._filters&&e._filters.length&&(e.$.placeholder.innerHTML=e.localize("filteredRecords")),e.__filterFooterOffsetHeight||(e.__filterFooterOffsetHeight=e.$.filterFooter.classList.contains("smart-hidden")?0:e.$.filterFooter.offsetHeight),!e.__columnHeaderHeight&&e.$.columnHeader.offsetHeight&&(e.__columnHeaderHeight=e.$.columnHeader.offsetHeight);let t=e._contentHeight-e.__filterFooterOffsetHeight-e.__columnHeaderHeight;e.$.scrollView.style.height=t+"px",e.scrollWidth=0,e.scrollHeight=0,e.clearSelection(),e._showAddNewRowButton("float"),e.$.content.classList.contains("auto-height")&&(e.$.placeholder.style.height=t+"px")};if(t&&t.url)e._showAddNewRowButton("float");else{if(!t||null===t||0===t.length||0===e.columns.length)return o(),0!==e.columns.length&&e.hasVisibleColumn()?e.editing.addNewColumn._addButton&&e.editing.addNewColumn._addButton.classList.remove("show"):(e._showAddNewColumnButton(),e.$.columnHeader.classList.add("smart-hidden"),e.__columnHeaderHeight=0),void e._refreshScrollBars();e._showAddNewRowButton("float"),e.editing.addNewColumn._addButton&&e.editing.addNewColumn._addButton.classList.remove("show")}0!==e.columns.length&&e.hasVisibleColumn()?e.editing.addNewColumn._addButton&&e.editing.addNewColumn._addButton.classList.remove("show"):(o(),0!==e.columns.length&&e.hasVisibleColumn()||(e._showAddNewColumnButton(),e.$.columnHeader.classList.add("smart-hidden"),e.__columnHeaderHeight=0),e._showAddNewColumnButton()),"card"===e.view&&(e.__columnHeaderHeight=0),!e.__columnHeaderHeight&&e.$.columnHeader.offsetHeight&&(e.__columnHeaderHeight=e.$.columnHeader.offsetHeight),e.__filterFooterOffsetHeight||(e.__filterFooterOffsetHeight=e.$.filterFooter.classList.contains("smart-hidden")?0:e.$.filterFooter.offsetHeight);let l=e._contentHeight-e.__filterFooterOffsetHeight-e.__columnHeaderHeight;if(e.$.scrollView.style.height=l+"px",e.htmlColumnLastChild.style.height=e.__columnHeaderHeight+"px",e.paging.spinner.enabled&&e.paging.enabled){if(!e.pageScroll){const t=document.createElement("smart-scroll-bar");t.orientation="vertical",t.style.height="100%",t.style.width="100%",t.max=Math.ceil(e.dataSource.length/e._pageSize),t.step=e.paging.spinner.step,t.largeStep=e.paging.spinner.step,t.setAttribute("spinner",""),t.setAttribute("smart-id","spinner"),t.ownerElement=e,e.addPropertyBinding("[[paging_spinner_step]]","step",t,e.$.columnHeader),t.addEventListener("change",(function(t){e.paging.pageIndex=t.detail.value,e._refreshLayout(),e._refreshSelection(),e.dataSource&&e.dataSource.virtualDataSource?e._virtualDataRequest("pageIndexChange"):(e._recycle(),e._scrollUpdate&&clearTimeout(e._scrollUpdate),e._scrollUpdate=setTimeout((function(){e.isScrolling||(e.$.rowContainer.style.top=parseInt(e.$.rowContainer.style.top)+.01+"px")}),50))})),e.pageScroll=t}e.htmlColumnLastChild.appendChild(e.pageScroll)}else e.htmlColumnLastChild.innerHTML="";e._refreshScrollBars()}_refreshScrollBars(){const e=this;if(!e._scrollView)return;const t=e._scrollView.vScrollBar,o=e._scrollView.hScrollBar,l=e._contentHeight-e.__filterFooterOffsetHeight-e.__columnHeaderHeight,a=e.$.scrollView.offsetWidth,n=e._scrollWidth-a-e._contentBorder.left,i=e._scrollHeight-l-e._contentBorder.top,r=e._columnNearContainerComputedStyle?e._columnNearContainerComputedStyle:getComputedStyle(e.$.columnNearContainer),s=e._columnFarContainerComputedStyle?e._columnFarContainerComputedStyle:getComputedStyle(e.$.columnFarContainer),d=parseInt(e.$.columnNearContainer.style.width)+parseInt(r.borderRightWidth),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(e=!0){const t=this;t._isUpdating=0,t.beginUpdate(),t.clearSort(),t.clearFilter(),t.clearGroups(),t.clearSelection(),t._conditionalColors&&(t._conditionalColors.colors=[],t._conditionalColors.conditions=[],t._conditionalColors.type="conditions",t._conditionalColors.singleSelect="",t._conditionalColors.decorate="border",t._conditionalColors.update=()=>{}),t.$.headerBar&&delete t.$.headerBar._appliedColors,delete t._labeledBy,delete t._dateStackedBySelect,t.highlighted=null,t.columns.canNotify=!1;let o=[],l=!1;for(let e=0;e<t.columns.length;e++){const a=t.columns[e];a.visible=!0,a.width=180,a.freeze=!1,a.index>=0?o[a.index]=a:o.push(a),a.index!==e&&(l=!0)}l&&(t.columns=o),"grid"!==t.view&&e&&(t.view="grid",t._hideKanbanView(),t._hideSchedulerView()),t.columns.canNotify=!0,t._scrollView.scrollLeft=t._scrollView.scrollTop=0,t.paging.enabled&&(t.paging.pageIndex=0),t.$.headerBar&&t.$.headerBar._setView&&"grid"===t.view&&t.$.headerBar._setView("grid"),t._kanban&&t._kanban._reset(),t.layout.isDirty=!0,t.endUpdate(),l&&(t._renderColumns(),t._refreshHeaderBar())}_loadState(e){const t=this;let o=!1;t.stateSettings.loading=!0;let l=!1,a=!1,n=!1;if("grid"===e.view||"card"===e.view||void 0===e.view){if(e.expandedRows&&Object.keys(e.expandedRows).length>0){o=!0,t.beginUpdate();const l=[];if(e.groups){t.dataSource.groupBy=e.groups,t._groups=[].concat(t.dataSource.groupBy.toArray())||[],t._refreshRowHierarchy();for(let o in e.expandedRows)l["Item"+o.replaceAll(".","_")]=!0,t._expandCollapseGroup(o,!0)}else if(t.grouping.enabled&&t.dataSource.groupBy.length)for(let o in e.expandedRows)l["Item"+o.replaceAll(".","_")]=!0,t._expandCollapseGroup(o,!0);t.dataSource&&(t.dataSource._expandedRowIds=l)}else if(e.groups&&e.groups.length){o=!0,t.beginUpdate();const l=[];t.dataSource&&(t.dataSource._expandedRowIds=l),e.groups&&(t.dataSource.groupBy=e.groups,t._refreshRowHierarchy())}else if(e.groups&&0===e.groups.length&&t.dataSource.groupBy.length>0){o=!0,t.beginUpdate();const e=[];t.dataSource&&(t.dataSource._expandedRowIds=e),t.dataSource.groupBy=[],t._refreshRowHierarchy(),a=!0}if(e.paging&&t.paging.enabled&&(t.paging.index=e.paging.index,t.paging.size=e.paging.size),e.columns&&e.columns.length>0){o||(o=!0,t.beginUpdate());let a=[];for(let o=0;o<e.columns.length;o++){const i=e.columns[o];if(i.dataField){const e=t.columnByDataField[i.dataField];if(e){const r=e.canNotify;e.canNotify=!1,i.width?e.width=i.width:e.width=180,e.sortOrder="",e.sorted="",a.push(e),e.index!==o&&(n=!0),e.visible=void 0===i.visible||i.visible,e._state&&(e._state.visible=void 0===i.visible||i.visible,e._state.freeze=void 0!==i.freeze&&i.freeze,e._state.width=i.width?i.width:180);const s=e.freeze;e.freeze=void 0!==i.freeze&&i.freeze,s!==e.freeze&&(l=!0,e.freeze||t._frozenNearColumns.indexOf(e)),e.canNotify=r}}}n&&(t.columns=a)}}if(e.colors&&(t._conditionalColors=JSON.parse(JSON.stringify(e.colors)),t.$.headerBar)){let l=[];if(e.colors.conditions)for(let t=0;t<e.colors.conditions.length;t++){let o=e.colors.conditions[t],a=[];for(let e in o)a.push(o[e]);l.push(a)}o||(o=!0,t.beginUpdate());const a={type:e.colors.type,singleSelect:e.colors.singleSelect,decorate:e.colors.decorate};t.$.headerBar._appliedColors=[l,a],t._conditionalColors.update=e=>{t.$.headerBar._updateConditionalColors(e,t,a)}}if(e.sort&&Object.keys(e.sort).length>0){o||(o=!0,t.beginUpdate());const l=t.appearance.allowSortAnimation;t.appearance.allowSortAnimation=!1;let a=t.columns.canNotify;t.columns.canNotify=!1;for(let e=0;e<t.columns.length;e++)t.columns[e].sortOrder="";t.columns.canNotify=a;for(let o in e.sort){const l=e.sort[o];if(l){const e=l.sortOrder,a=l.dataField?l.dataField:o,n=t.columnByDataField[a];n&&t.sortBy(n.dataField,e)}}t.appearance.allowSortAnimation=l}if(e.filter&&Object.keys(e.filter).length>0){o||(o=!0,t.beginUpdate());for(let o in e.filter){let l=o,a=e.filter[l];if(e.filter[0]&&(l=e.filter[o].dataField,a=e.filter[o].filter),a){t.addFilter(l,a,!1);const e=t.columnByDataField[l];e&&e._filterInfo&&e.filter&&e.filter.filters&&e.filter.filters[0]&&(e._filterInfo.value=e.filter.filters[0].value,e._filterInfo.condition=e.filter.filters[0].condition)}}if(t.filtering.filterRow)for(let e=0;e<t.columns.length;e++)t.columns[e]._filterEditorInitialized&&(t.columns[e]._filterEditorInitialized=!1)}if(e.selectedCells&&(o||(o=!0,t.beginUpdate()),t.selectCellsById(e.selectedCells)),e.selectedRows&&t.selectRows(e.selectedRows),e.labeledBy&&(t._labeledBy=e.labeledBy),o){t.endUpdate(!1,!1);let o=!1;e.view&&"kanban"===e.view&&(o=!0),(l||n)&&(o=!1,a=!0,t._renderColumns()),o||(a?t.refresh(!0):t._refresh())}let i=!1;if(e.kanban&&e.kanban.stackedBy&&(void 0===t._stackedBy&&(t._stackedBy=e.kanban.stackedBy),t._stackedBy!==e.kanban.stackedBy&&(i=!0),t._stackedBy=e.kanban.stackedBy),e.scheduler&&e.scheduler.stackedBy&&(void 0===t._dateStackedBy&&(t._dateStackedBy=e.scheduler.stackedBy),t._dateStackedBy!==e.scheduler.stackedBy&&(i=!0),e.scheduler.labeledBy&&(t._labeledBy=e.scheduler.labeledBy),e.scheduler.viewType&&(t._schedulerViewType=e.scheduler.viewType),void 0===t._dateStackedBySelect&&(t._dateStackedBySelect=e.scheduler.groupBy),t._dateStackedBySelect!==e.scheduler.groupBy&&(i=!0),t._dateStackedBy&&Array.isArray(t._dateStackedBy)&&e.scheduler.stackedBy&&Array.isArray(e.scheduler.stackedBy)&&JSON.stringify(t._dateStackedBy)===JSON.stringify(e.scheduler.stackedBy)&&(i=!1),t._dateStackedBy=e.scheduler.stackedBy),(i||e.view&&t.view!==e.view)&&t.$.headerBar&&t.$.headerBar._setView&&(e.name&&(t.stateSettings.current=e.name),t.$.headerBar._setView(e.view,!0)),e.filter&&Object.keys(e.filter).length>0&&t.refreshFilters(),e.selectedCells){const o=[];let l=99999999,a=null,n=99999999,i=null,r=99999999,s=null;for(let l=0;l<e.selectedCells.length;l++){const a=e.selectedCells[l],d=a[0],u=a[1],c=t.columnByDataField[u];if(c&&(n=Math.min(n,c.index),i=Math.max(i,c.index)),!t.rowById[d])continue;const m=t.rowById[d].visibleIndex;m>=0&&(r=Math.min(r,m),s=Math.max(s,m)),o[d]||(o[d]=[]),o[d].push(u)}let d=0,u=!0;for(let e in o){const t=o[e];if(d&&t.length!==d){u=!1;break}d=t.length}if(u){const e=t.getRows(),o=e[r],d=e[s];if(l=o?o.id:-1,a=d?d.id:-1,o){const e=t.columns[n];if(e){const o=t.rowById[l].getCell(e.dataField);t._selection.focusedCell={id:o.row.id,value:o.value,dataField:o.column.dataField,index:o.row.index},setTimeout((()=>{t._selectCellsRange(t.rowById[l],t.rowById[a],t.columns[n].dataField,t.columns[i].dataField)}),50)}}}}e.name&&(t.stateSettings.current=e.name),t._refreshHeaderBar(),t.stateSettings.loading=!1}loadState(e){const t=this;if(e){if(t.stateSettings.loading=!0,t._isUpdating=0,t.beginUpdate(),t.clearSort(),t.clearFilter(),t.clearGroups(),t.clearSelection(),t._conditionalColors&&(t._conditionalColors.colors=[],t._conditionalColors.conditions=[],t._conditionalColors.type="conditions",t._conditionalColors.singleSelect="",t._conditionalColors.decorate="border"),delete t._labeledBy,delete t._dateStackedBySelect,t.$.headerBar&&delete t.$.headerBar._appliedColors,t._scrollView.scrollLeft=t._scrollView.scrollTop=0,t.paging.enabled&&(t.paging.pageIndex=0),t.endUpdate(!1,!1),"string"==typeof e){const o=t.stateSettings.storage[e];o&&t._loadState(o)}else t._loadState(e);t.stateSettings.loading=!1}else if(!t.stateSettings.autoSave){let e=t.getCurrentState();e&&t.loadState(e)}}saveState(e,t){const o=this;let l=o.getCurrentState(),a=t;!t&&o.stateSettings.options.length&&(t=o.stateSettings.options);const n=o.getState(t);let i;if(e?(i=e,o.stateSettings.current||(o.stateSettings.current=e)):i=o.stateSettings.current?o.stateSettings.current:o.stateSettings.current="View 1",l&&a)for(let e in a)l[a[e]]=n[a[e]];else l=n;function r(e,t=0,o=10){if(t>o)return"Object";const l={};if(e&&e instanceof Smart.FilterGroup)return e=e.toString();for(let a in e){let n=e[a];if(n instanceof Node)n={id:n.id};else if(n instanceof Window)n="Window";else if(n instanceof Date)n=n.toJSON();else{if(n&&Array.isArray(n)&&void 0!==n[0]&&("string"==typeof n[0]||"number"==typeof n[0]||n[0]instanceof Date||"boolean"==typeof n[0])){l[a]=n;continue}if(n&&Array.isArray(n)&&0===n.length){l[a]=n;continue}if(n&&n&&Array.isArray(n)&&void 0!==n[0]&&"object"==typeof n[0]&&"path"!==a&&!(n[0]instanceof HTMLElement))for(let e=0;e<n.length;e++)n[e]=r(n[e],t+1,o);else n instanceof Object&&(n=r(n,t+1,o))}l[a]=n}return t?l:JSON.stringify(l)}l.name=i,o.stringify_object=r;const s=r(l);return o.stateSettings.allowLocalStorage&&window.localStorage.setItem(i,s),o.stateSettings.storage||(o.stateSettings.storage={}),o.stateSettings.storage[o.stateSettings.current]&&!l.date&&o.stateSettings.storage[o.stateSettings.current].date?l.date=o.stateSettings.storage[o.stateSettings.current].date:l.date=(new Date).toJSON(),o.stateSettings.storage[o.stateSettings.current]=l,o.stateSettings.onStateChange&&(o._isUpdating<=0||void 0===this._isUpdating)||o.stateSettings.onStateChange&&o._forceStateChange?o.isCompleted&&o.stateSettings.onStateChange(l,i,o.stateSettings.storage,r):o.stateSettings.onStateChange&&"grid"!==o.view&&o.isCompleted&&o.stateSettings.onStateChange(l,i,o.stateSettings.storage,r),l}autoSaveState(){const e=this;e._savingState&&clearTimeout(e._savingState),e._savingState=setTimeout((()=>{if(!e.stateSettings.current&&e.stateSettings.autoSave&&!e.stateSettings.loading){const t=e.stateSettings.storage;if(t&&0===Object.keys(t).length||!t){let t=e.localize("newGrid")+" "+e.localize("view");"kanban"===e.view?t=e.localize("newKanban")+" "+e.localize("view"):"card"===e.view?t=e.localize("newCard")+" "+e.localize("view"):"scheduler"===e.view&&(t=e.localize("newScheduler")+" "+e.localize("view")),e.stateSettings.current=t}}e.stateSettings.autoSave&&e.stateSettings.current&&!e.stateSettings.loading&&e.saveState()}),50)}getCurrentState(){const e=this,t=e.stateSettings.current;return e.stateSettings.storage||(e.stateSettings.storage={}),e.stateSettings.storage[t]?e.stateSettings.storage[t]:null}setColors(e,t){const o=this;o._conditionalColors={type:t.type,decorate:t.decorate,conditions:e,singleSelect:t.singleSelect},o.$.headerBar.addColors(JSON.parse(JSON.stringify(e)),{type:t.type,singleSelect:t.singleSelect,decorate:t.decorate},[]),o._recycle(!1)}getColors(){const e=this;if(e._conditionalColors){const t=JSON.parse(JSON.stringify(e._conditionalColors));return{type:t.type,conditions:t.conditions,filters:t.filters,colors:t.colors,decorate:t.decorate,singleSelect:t.singleSelect}}return null}getState(e){const t=this;if(e&&!e.includes)return;const o=!e||e&&e.includes("sort")?t.getSortedColumns():null,l=!e||e&&e.includes("filter")?t.getFilteredColumns():null,a=!e||e&&e.includes("groups")?t.getGroups():null,n=!e||e&&e.includes("selection")?t.getSelectedCells(!1):null,i=!e||e&&e.includes("selection")?t.getSelectedRowIds():null,r=!e||e&&e.includes("pager")?t.$.headerPager.querySelector("smart-pager"):null,s=!e||e&&e.includes("colors")?t.getColors():null;let d=0;r&&(d=r.pagesCount);const u={count:d,index:t.paging.pageIndex,size:t._pageSize},c={};o&&o.length&&(c.sort=o),l&&l.length&&(c.filter=l),a&&a.length&&(c.groups=a),u&&t.paging.enabled&&(c.paging=u),n&&n.length&&(c.selectedCells=n),i&&i.length&&(c.selectedRows=i),s&&(delete s.colors,c.colors=s),t._labeledBy&&(c.labeledBy=t._labeledBy),(t.header.visible&&t.header.buttons.indexOf("views")>=0||t.header.buttons.indexOf("states")>=0)&&("kanban"===t.view&&(c.kanban=t.getKanbanState()),"scheduler"===t.view&&(c.scheduler=t.getSchedulerState()),c.view=t.view);const m=[];if(!e||e&&e.includes("columns")){for(let e=0;e<t.columns.length;e++){const o=t.columns[e];m.push({dataField:o.dataField,width:o.computedWidth,visible:o.visible,freeze:o.freeze})}c.columns=m}if((!e||e&&e.includes("expandedRows"))&&t.dataSource&&t.dataSource._expandedRowIds){let e={};for(let o in t.dataSource._expandedRowIds){let t=""+o;t=t.replace("Item","").replace(/_/gi,"."),e[t]=!0}Object.values(e).length&&(c.expandedRows=e)}if((t.header.visible&&t.header.buttons.indexOf("views")>=0||t.header.buttons.indexOf("states")>=0)&&("kanban"!==t.view&&"scheduler"!==t.view||(delete c.expandedRows,delete c.columns,delete c.paging,delete c.selectedCells,delete c.selectedRows)),e){const t={};for(let o in e){const l=e[o];c[l]&&(t[l]=c[l])}return t}return c}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.editing.dialog.visible||a.endEdit(),a._isUpdating))return;a._recycleValues=void 0===o||o,a._removeCellContentPopup(),a._inputOverlay&&(a._inputOverlay.parentNode&&a._inputOverlay.parentNode.removeChild(a._inputOverlay),a._inputOverlay=null),a._selection.selectionRect&&a._refreshCellSelectionRect(),a._copyRects&&a._copyRects.length&&a._refreshCopyRects();const n=a._scrollView.scrollTop;let i,r=l||a._getRowIndexByPosition(n),s=a._recyclingRows,d=s[r],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;let y=0;const w=a.behavior.allowRenderCache&&!f&&"grid"===a.view&&!a.dataSource.virtualDataSourceOnExpand&&!a.rowDetail.template&&!a.rowDetail.enabled&&!a._autoHeight&&!a.pager.visible&&!a._frozenFarColumns.length;if("grid"!==a.view)for(let e=0;e<a._rowElements.length;e++){const t=a._rowElements[e];t.style.transform="",t.style.top="",t.style.position=""}if(r>=0){m=0;let e=Math.max(a._clientSize.height,a._overflowOffset),t=0;if(f&&(a.rowById=[],a.rows&&a.rows.length>0&&void 0===a.rows[a.rows.length-1].top&&(a.rows[a.rows.length-1].top=(a.rows.length-1)*a.rows[0].height),a.rows&&a.rows.length>0&&(t=a._getVirtualRowIndexByPosition(n),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),w)for(let e=0;e<a._rowElements.length;e++){const t=a._rowElements[e];delete t.isRendered,t.classList.remove("smart-hidden"),t.classList.remove("aria-rowindex"),t.style.transform="",t.style.top="",t.style.position=""}if(w){let e=Math.max(a._clientSize.height,a._overflowOffset),o=[],l=u;for(let t=r;t<s.length;t++){const i=s[t];if(0===i.height||!i.visible||!1===i.filtered||i.freeze&&i.visible)continue;const r=i.height;if(i.expandHeight&&(e+=a.offsetHeight+i.expandHeight),l+r>=n-g&&l<=n+e||a._autoHeight){for(let e=0;e<a._rowElements.length;e++){const t=a._rowElements[e];if(t.hasAttribute("data-id")&&t.getAttribute("data-id")===""+i.id){o[i.id]=t,t.isRendered=!0;break}}l+=r}}e=Math.max(a._clientSize.height,a._overflowOffset);for(let l=r;l<s.length;l++){const i=s[l];if(0===i.height||!i.visible||!1===i.filtered||i.freeze&&i.visible)continue;const r=i.height;if(i.expandHeight&&(e+=a.offsetHeight+i.expandHeight),u+r>=n-g&&u<=n+e||a._autoHeight){let e;if(e=a._rowElements[m++],!e)break;for(;e&&e.isRendered;)e=a._rowElements[m++];if(!e){console.log("Did not found a row element during the rendering.");continue}e.setAttribute("aria-rowindex",t+l+1);let n=!1;if(i.element=e,i.grid=a,o[i.id]){const a=o[i.id];a.hasAttribute("data-id")&&a.getAttribute("data-id")===""+i.id&&(a===e&&(a.isRendered=!0,n=!0,m=0),n=!0,m=0,i.element=a,e.style.top="999999px",e.setAttribute("data-id",999999),e.setAttribute("aria-rowindex",t+l+1),e=a,a.isRendered=!0)}e.style.top=y+"px",e.style.position="absolute",i.render(n),e.isRendered=!0,u+=r,y+=r}}}else{a.rowDetail.enabled&&(e+=a.offsetHeight);for(let o=r;o<s.length;o++){const l=s[o];if(0===l.height||!l.visible||!1===l.filtered||l.freeze&&l.visible)continue;const i=l.height;if(l.expandHeight&&(e+=a.offsetHeight+l.expandHeight),!(u+i>=n-g&&u<=n+e||a._autoHeight))break;{let e;if(e=a._rowElements[m++],!e)break;if(e.isRendered&&(e.classList.remove("smart-hidden"),e.classList.remove("aria-rowindex"),e.style.transform="",e.style.top="",e.style.position=""),e.setAttribute("aria-rowindex",t+o+1),l.element=e,l.grid=a,f){if(l.index=o+t,l.visibleIndex=o+t,a.selection.enabled&&a._selection){const e=a._selection.indexes,t=l.canNotify;l.canNotify=!1,l.selected=e.indexOf(l.index)>=0,l.canNotify=t}a.paging.enabled?(l.data=a.dataSource[r+m-1],l.data&&(l.id=l.data.$.id,a.rowById[l.id]=l)):(l.data=a.dataSource[m-1],l.data&&(l.id=l.data.$.id,a.rowById[l.id]=l))}l.render(),e.isRendered=!0}u+=i,y+=i}}}a._renderFrozenRows();let v=m;if(m<a._rowElements.length&&!w)for(let e=m;e<a._rowElements.length;e++){const e=a._rowElements[m++];e.classList.add("smart-hidden"),e.removeAttribute("aria-rowindex")}if(w)for(let e=0;e<a._rowElements.length;e++)if(!a._rowElements[e].isRendered){const t=a._rowElements[e];t.classList.add("smart-hidden"),t.removeAttribute("aria-rowindex")}if(a.editing.addNewRow&&a.editing.addNewRow.visible&&"button"===a.editing.addNewRow.displayMode&&a._rowElements[v]){a._newRow||(a._newRow=new Smart.Grid.Row({data:{},index:9999999,grid:a,addNewRow:!0,inline:!0,autoGenerated:!0}));for(let e=a._rowElements.length-1;e>=0;e--)if(!a._rowElements[e].isRendered){a._newRow.element=a._rowElements[e],a._newRow.element.classList.remove("smart-hidden"),a._newRow.element.style.top=y+"px",a._newRow.element.style.position="absolute",a._newRow.render();break}}f&&(a._selection.selectionRect&&a._refreshCellSelectionRect(),a._copyRects&&a._copyRects.length&&a._refreshCopyRects())}_renderFrozenRows(){const e=this;let t=!1,o=!1;if("card"===e.view)return e.$.rowNearContainer.classList.add("smart-hidden"),void e.$.rowFarContainer.classList.add("smart-hidden");0===e._frozenNearRows.length?e.$.rowNearContainer.classList.add("smart-hidden"):e.$.rowNearContainer.classList.remove("smart-hidden");for(let o=0;o<e._frozenNearRows.length;o++){const l=e._frozenNearRows[o];l.visible||(l.element=e.$.rowNearContainer.children[o],l.element||(l.element=l.createElement(),e.$.rowNearContainer.appendChild(l.element)),l.element.classList.add("smart-hidden")),l.visible&&l.filtered&&(t=!0,l.element=e.$.rowNearContainer.children[o],l.element||(l.element=l.createElement(),e.$.rowNearContainer.appendChild(l.element)),l.render())}t||e.$.rowNearContainer.classList.add("smart-hidden"),0===e._frozenFarRows.length?e.$.rowFarContainer.classList.add("smart-hidden"):e.$.rowFarContainer.classList.remove("smart-hidden");for(let t=0;t<e._frozenFarRows.length;t++){const l=e._frozenFarRows[t];l.visible&&(o=!0),l.element=e.$.rowFarContainer.children[t],l.element||(l.element=l.createElement(),e.$.rowFarContainer.appendChild(l.element)),l.render()}o||e.$.rowFarContainer.classList.add("smart-hidden"),0!==e.columns.length&&e.hasVisibleColumn()||(e.$.rowNearContainer.classList.add("smart-hidden"),e.$.rowFarContainer.classList.add("smart-hidden"));const l=e.rows;l&&null!==l&&0!==l.length||(e.$.rowNearContainer.classList.add("smart-hidden"),e.$.rowFarContainer.classList.add("smart-hidden"),e._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.getSortedColumnsByDataField(),filtering:o.getFilteredColumnsByDataField(),filterOperator:o.filtering.operator,grouping:o._groups,row:o._toggledRow?o._toggledRow.data:null,action:e},i=o.dataSource.length,r=o.dataSource.boundSource.length;void 0===o._isFirstVirtualDataSourceRequest&&(o._isFirstVirtualDataSourceRequest=!0),o.dataSource.onVirtualDataSourceRequested((function(e){if(o.appearance.displayLoadingIndicator=!1,o._setLoadingIndicatorVisibility(),o._toggledRow=null,!e)return o._initializeRows(),o._initializeRowElements(),o.refresh(),o._refreshPagesCount(),void(o._autoHeight&&o._initializeRowElements());if("add"===e.action){if(t&&t(e.result),o._autoHeight&&o.rows.length>=o._rowElements.length-1&&(o._initializeRows(),o._initializeRowElements(),o.refresh(),o.filtering.filterRow)){for(let e=0;e<o.columns.length;e++)o.columns[e]._filterEditorInitialized&&(o.columns[e]._filterEditorInitialized=!1);const e=o.filtering.filterRow&&o.filtering.filterRow.visible&&o.filtering.filterRow.cell?o.filtering.filterRow.cell.column.dataField:null;e&&setTimeout((()=>{const t=o.columnByDataField[e];t&&t._filterInfo&&t._filterInfo.input&&t._filterInfo.input.focus()}),100)}return}if("update"===e.action)return void(t&&t(e.result));if("remove"===e.action)return void(t&&t(e.result));const l=o.context;if(o.context=o,o._isFirstVirtualDataSourceRequest&&0===o._initColumns.length&&(o.columns.canNotify=!1,o.columns=[],o._renderColumns(),o.columns.canNotify=!0),"scroll"===e.action)if("infinite"===o.scrolling){const e=o._viewRows;for(let t=0;t<e.length;t++){const l=e[t];l.data&&!l.addNewRow&&l.data.$&&(o.rowById[l.data.$.id]||(o.rowById[l.data.$.id]=l))}o._recycle(!1,!1)}else{const t=e.first>=0?e.first:0,l=e.last!==1/0?e.last:0;let a=0;for(let e=t;e<l;e++)o.rows[e]&&(o.rows[e].data=o.dataSource[a++]);o._recycle(!1,!1)}else if(o.dataSource.length!==i||o.dataSource.boundSource.length!==r||o._isFirstVirtualDataSourceRequest||"expand"===e.action||"filter"===e.action||"sort"===e.action||"pageIndexChange"===e.action||"pageSizeChange"===e.action||"sort"===e.action||"group"===e.action){o.paging.enabled&&o.$.headerPager.querySelector("smart-pager")&&(o.$.headerPager.querySelector("smart-pager").pagesCount=Math.ceil(o.dataSource.length/o._pageSize),o.$.footerPager.querySelector("smart-pager").pagesCount=Math.ceil(o.dataSource.length/o._pageSize));const e=o.filtering.filterRow&&o.filtering.filterRow.visible&&o.filtering.filterRow.cell?o.filtering.filterRow.cell.column.dataField:null;if(o._initializeRows(),o._initializeRowElements(),o.refresh(),o._refreshPagesCount(),o._autoHeight&&o._initializeRowElements(),o.filtering.filterRow){for(let e=0;e<o.columns.length;e++)o.columns[e]._filterEditorInitialized&&(o.columns[e]._filterEditorInitialized=!1);e&&setTimeout((()=>{const t=o.columnByDataField[e];t&&t._filterInfo&&t._filterInfo.input&&t._filterInfo.input.focus()}),100)}}else o.dataSource.virtualDataSourceOnExpand&&o.refresh();o._isFirstVirtualDataSourceRequest&&o.onLoad&&(o.onLoad(o),delete o.onLoad),o._isFirstVirtualDataSourceRequest=!1,o._recycle(),o.context=l,o._onDataUpdated&&o._onDataUpdated()}),n)}localizeString(e,t,o="en"){const l=this;o&&l.messages[o][e]&&(l.messages[o][e]=t,l.refresh())}localizeStrings(e,t="en"){const o=this;t&&(Object.assign(o.messages[t],e),o.refresh())}_createAddNewRowButton(){const e=this,t=document.createElement("div");return t.className="smart-grid-add-row-button smart-grid-icon smart-icon-plus",t.title=e.localize("addNewRow"),t.style.left=!e.appearance.showViewBar||e.appearance.viewBarAppendTo||e.appearance.showViewBarAsDropdown||e._mobile?"":10+e.layout.viewBarWidth+"px",e._addNewGridRow=t.onclick=()=>{e._addRowTimer&&clearTimeout(e._addRowTimer),e._addRowTimer=setTimeout((()=>{if(e.dataSource&&e.dataSource.virtualDataSource)return void e._insertNewRowAfter();const t={};for(let o=0;o<e.columns.length;o++){const l=e.columns[o];void 0!==l.defaultValue&&null!==l.defaultValue&&("today"===l.defaultValue&&"date"===l.dataType?(e._today||(e._today=new Date,e._todayYear=e._today.getFullYear(),e._todayMonth=e._today.getMonth(),e._todayDate=e._today.getDate()),t[l.dataField]=new Date(e._todayYear,e._todayMonth,e._todayDate)):t[l.dataField]=l.defaultValue)}e._addingNewRow=!0,e._add(t),e._mobile||(e._scrollView.vScrollBar.value=e._scrollView.vScrollBar.max),e._recycle(!1),e.closeMenu(),e._addingNewRow=!1,e.editing.addNewRow.visible&&e.$.placeholder.classList.contains("smart-hidden")&&"button"!==e.editing.addNewRow.displayMode&&e.editing.addNewRow._addButton.classList.remove("show")}),0)},t}removeColumn(e){const t=this;let o=-1;if(e)for(let l=0;l<t.columns.length;l++)if(t.columns[l].dataField===e){o=l;break}o>=0&&t.columns.splice(o,1)}addColumn(e,t,o=!0){const l=this;if(e){let a=-1;if(t)for(let e=0;e<l.columns.length;e++)if(l.columns[e].dataField===t){a=e,!1===o&&(a=e+1);break}if("string"==typeof e){const t=l._getKanbanTaskField(e);if(t){if(a>=0)return void l.columns.splice(a,0,t);l.columns.push(t)}return}if(a>=0&&a<l.columns.length)return void l.columns.splice(a,0,e);l.columns.push(e)}}insertColumnAfter(e,t){e&&this.addColumn(e,t,!1)}insertColumnBefore(e,t){e&&this.addColumn(e,t,!0)}addNewColumn(e){e&&this.addColumn(e)}_createAddNewColumnButton(){const e=this,t=document.createElement("div");return t.className="smart-grid-add-column-button smart-grid-icon smart-icon-plus",t.title=e.localize("addNewColumn"),t.onclick=()=>{e._openAddColumnDialog(),e.addEventListener("closeColumnDialog",(()=>{e.layout.isDirty=!0,e._resetCachedLayout(),e._refreshLayout()}))},t}_showAddNewRowButton(e){const t=this;if(!t.columns.length)return;if("grid"!==t.view&&t.editing.addNewRow._addButton)return t.editing.addNewRow._addButton.classList.add("smart-hidden"),void t.editing.addNewRow._addButton.classList.remove("show");if("grid"===t.view&&t.editing.addNewRow._addButton&&t.editing.addNewRow._addButton.classList.remove("smart-hidden"),"float"===e&&t.computedVerticalScrollBarVisibility&&t.editing.addNewRow._addButton&&!t.editing.addNewRow._addButton.classList.contains("show"))return;if("float"===e&&t._addingNewRow)return;const o=()=>{t.editing.addNewRow._addButton&&t.editing.addNewRow._addButton&&("float"!==e&&(t.appearance.showRowHeader||t.appearance.showRowHeaderNumber)&&"card"!==t.view?t.editing.addNewRow._addButton.classList.remove("float"):(!t.computedVerticalScrollBarVisibility&&t.dataSource&&0===t.dataSource.length||t.computedVerticalScrollBarVisibility&&"float"===e||"card"===t.view)&&t.editing.addNewRow._addButton.classList.add("float"),t.computedHorizontalScrollBarVisibility?t.pager.visible?t.editing.addNewRow._addButton.style.bottom="68px":t.editing.addNewRow._addButton.style.bottom="20px":t.pager.visible?t.editing.addNewRow._addButton.style.bottom="48px":t.editing.addNewRow._addButton.style.bottom="",t.grouping.enabled&&t.dataSource)&&(!(t.dataSource.groupBy.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._newRow&&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(),o._copyRects&&o._copyRects.length&&o._refreshCopyRects();const l=o._recyclingRows;let a=l[t],n=a.top,i=!1;for(let r=0;r<o._cellsMerge.length;r++){const s=o._cellsMerge[r],d=l.indexOf(s.row);t>d&&t<=d+s.rowSpan&&(t=d,a=s.row,n=a.top,o.$.rowContainer.style.top=o.__frozenNearHeight-e+n+"px",i=!0)}i||(o.$.rowContainer.style.top=o.__frozenNearHeight-e+n+"px")}_verticalScrollbarHandler(e){const t=this;t.menu&&t.menu.column&&t.closeMenu(),t.isScrolling=!0,t._scrollTimer&&clearTimeout(t._scrollTimer),t._layoutSuspended||(t._scrollTimer=setTimeout((()=>{if("virtual"===t.scrolling)t._recycle(!1);else{const e=t._scrollView.scrollTop;let o=t._getRowIndexByPosition(e);o!==t._scrollRowIndex?(t._recycle(!1,!0,!0,o),t._scrollRowIndex=o):t._verticalScrollRecycle(e,o)}if(t.isScrolling=!1,e.max===e.value&&e.max>0){if(t.$.fireEvent("scrollBottomReached"),"infinite"===t.scrolling)return t.appearance.displayLoadingIndicator=!0,t._setLoadingIndicatorVisibility(),t._virtualScrollTimer&&clearTimeout(t._virtualScrollTimer),void(t._virtualScrollTimer=setTimeout((()=>{t._virtualDataRequest("scroll"),t.appearance.displayLoadingIndicator=!1,t._setLoadingIndicatorVisibility()}),50));t.editing.addNewRow._addButton&&"card"!==t.view&&t.editing.addNewRow._addButton.classList.remove("show")}else t.editing.addNewRow.visible&&"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()}_generateUUID(){const e=window.crypto,t=new Uint8Array(16);e.getRandomValues(t),t[6]=15&t[6]|64,t[8]=63&t[8]|128;const o=Array.from(t,(e=>e.toString(16).padStart(2,"0"))).join("");return`${o.substring(0,8)}-${o.substring(8,12)}-${o.substring(12,16)}-${o.substring(16,20)}-${o.substring(20)}`}}),Smart.Grid.Extend=function(e){if(!e)return;const t=Object.getOwnPropertyNames(e.prototype);for(let o in t){const l=t[o];"constructor"!==l&&(Smart.Grid.prototype[l]=e.prototype[l])}},Smart.Grid.Extend(Smart.Utilities.Grid.Resize),Smart.Grid.Extend(Smart.Utilities.Grid.Reorder),Smart.Grid.Extend(Smart.Utilities.Grid.Pager),Smart.Grid.Extend(Smart.Utilities.Grid.Filter),Smart.Grid.Extend(Smart.Utilities.Grid.Sort),Smart.Grid.Extend(Smart.Utilities.Grid.Menu),Smart.Grid.Extend(Smart.Utilities.Grid.Select),Smart.Grid.Extend(Smart.Utilities.Grid.Edit),Smart.Grid.Extend(Smart.Utilities.Grid.Dialog),Smart.Grid.Extend(Smart.Utilities.Grid.Group),Smart.Grid.Extend(Smart.Utilities.Grid.Tree),Smart.Grid.Extend(Smart.Utilities.Grid.Export),Smart.Grid.Extend(Smart.Utilities.Grid.Chart),Smart.Grid.Extend(Smart.Utilities.Grid.View),Smart.Grid.Cell=Smart.Utilities.Grid.Cell,Smart.Grid.Row=Smart.Utilities.Grid.Row,Smart.Grid.Column=Smart.Utilities.Grid.Column;
1495
+ Smart("smart-grid",class extends Smart.ScrollViewer{static get properties(){return{ai:{type:"any",reflectToAttribute:!1,value:{model:{value:"gpt-3.5-turbo",type:"string"},maxTokens:{value:200,type:"number"},temperature:{value:.7,type:"number"},url:{value:"",type:"string"},key:{value:"",type:"string"}}},appearance:{value:{alternationStart:{value:0,type:"int"},alternationEnd:{value:0,type:"int"},alternationCount:{value:0,type:"int"},allowHover:{value:!1,type:"boolean",defaultReflectToAttribute:!0},allowHeaderHover:{value:!0,type:"boolean",defaultReflectToAttribute:!0},allowRowToggleAnimation:{value:!1,type:"boolean"},allowRowDetailToggleAnimation:{value:!1,type:"boolean"},allowSortAnimation:{value:!1,type:"boolean"},allowColumnLabelAnimation:{value:!0,type:"boolean"},allowCheckBoxesSelectionAnimation:{value:!0,type:"boolean"},allowColumnMenuAnimation:{value:!0,type:"boolean"},allowColumnSortButtonAnimation:{value:!0,type:"boolean"},allowColumnActionButtonAnimation:{value:!0,type:"boolean"},allowColumnFilterButtonAnimation:{value:!0,type:"boolean"},allowColumnStickyPosition:{value:!1,type:"boolean"},autoShowColumnSortButton:{value:!0,type:"boolean"},autoShowColumnActionButton:{value:!0,type:"boolean"},autoGenerateRowLabelMode:{value:"number",type:"string"},autoGenerateColumnLabelMode:{value:"letter",type:"string"},autoShowColumnFilterButton:{value:!0,type:"boolean"},cardTitleField:{value:"",type:"string"},displayLoadingIndicator:{value:!1,type:"boolean"},loadingIndicatorPlaceholder:{value:"Loading...",type:"string"},placeholder:{value:"No Rows",type:"string"},sortAnimationDuration:{value:500,type:"number"},showRowHeader:{value:!1,type:"boolean"},showRowStatus:{value:!1,type:"boolean"},showRowEditDialogDetails:{value:!1,type:"boolean"},showRowComments:{value:!1,type:"boolean"},showRowHeaderNumber:{value:!1,type:"boolean"},showRowHeaderEditIcon:{value:!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"},allowRenderCache:{value:!0,type:"boolean"},doubleClickTimingDelay:{value:300,type:"number"},columnResizeMode:{value:"none",type:"string",allowedValues:["none","split","growAndShrink"]},rowResizeMode:{value:"none",type:"string",allowedValues:["none","split","growAndShrink"]}},type:"object"},layout:{value:{autoWrap:{value:!0,type:"boolean"},autoWidth:{value:!1,type:"boolean"},autoHeight:{value:!1,type:"boolean"},allowCellsWrap:{value:!1,type:"boolean"},allowCellsWrapShortcut:{value:!0,type:"boolean"},autoGenerateColumnWidth:{value:null,type:"number?"},autoSizeNewColumn:{value:!1,type:"boolean",reflectToAttribute:!1},autoSizeNewColumnMinWidth:{value:180,type:"number",reflectToAttribute:!1},cardMinWidth:{value:250,type:"any",reflectToAttribute:!1},cardRowMinHeight:{value:45,type:"any",reflectToAttribute:!1},cardsPerRow:{value:"auto",type:"any",reflectToAttribute:!1},cardVertical:{value:!0,type:"boolean",reflectToAttribute:!1},columnWidth:{value:null,type:"any",reflectToAttribute:!1},columnHeight:{value:null,type:"any",reflectToAttribute:!1},columnMinHeight:{value:30,type:"any",reflectToAttribute:!1},dropDownWidth:{value:700,type:"any",reflectToAttribute:!1},dropDownHeight:{value:500,type:"any",reflectToAttribute:!1},isDirty:{value:!1,type:"boolean"},loadingIndicatorPosition:{value:"center",allowedValues:["bottom","center","top"],type:"string"},rowMinHeight:{value:30,type:"number"},rowMobileHeight:{value:25,type:"number"},rowHeight:{value:null,type:"any",reflectToAttribute:!1},viewBarWidth:{value:200,type:"number"}},type:"object"},dataExport:{value:{header:{value:!0,type:"boolean"},filterBy:{value:null,type:"object"},groupBy:{value:null,type:"object"},style:{value:null,type:"any"},fileName:{value:"SmartGrid",type:"string?"},pageOrientation:{value:"portrait",type:"string"},expandChar:{value:"+",type:"string"},collapseChar:{value:"-",type:"string"},view:{value:!1,type:"boolean"},viewStart:{value:null,type:"number?"},viewEnd:{value:null,type:"number?"},rowIds:{value:null,type:"array?"},headerContent:{value:null,type:"any",reflectToAttribute:!1},footerContent:{value:null,type:"any",reflectToAttribute:!1},addImageToCell:{value:null,type:"any",reflectToAttribute:!1},setRowHeight:{value:null,type:"any",reflectToAttribute:!1},cellFormatFunction:{value:null,type:"any",reflectToAttribute:!1},autoConvertFormulas:{value:!0,type:"boolean"},freezeHeader:{value:!1,type:"boolean"},onlySelected:{value:!1,type:"boolean"},exportAsTable:{value:!1,type:"boolean"},exportStyles:{value:!0,type:"boolean"},formatData:{value:null,type:"any",reflectToAttribute:!1},getSpreadsheets:{value:null,type:"any",reflectToAttribute:!1}},type:"object"},clipboard:{value:{enabled:{value:!0,type:"boolean"},copyHeadersToClipboard:{value:!1,type:"boolean"},autoFillMode:{value:"copy",allowedValues:["none","copy","fillSeries"],type:"string"},onPasteValue:{value:null,type:"any"}},type:"object"},conditionalFormatting:{value:null,type:"array?",reflectToAttribute:!1},columns:{value:[],type:"any",reflectToAttribute:!1},contextMenu:{value:{selector:{value:"",type:"string"},enabled:{value:!1,type:"boolean"},width:{value:"auto",type:"any"},height:{value:null,type:"any"},customContextMenuItems:{value:null,type:"any"},dataSource:{value:{contextMenuItemSelectRow:{value:{command:{value:"contextMenuItemSelectRowCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:!0,type:"boolean"},icon:{value:"smart-icon-check-squared",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},contextMenuItemExpand:{value:{command:{value:"contextMenuItemExpandCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:!1,type:"boolean"},icon:{value:"smart-icon-resize-full",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},contextMenuItemInsertRow:{value:{command:{value:"contextMenuItemInsertRowCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:!1,type:"boolean"},icon:{value:"smart-icon-plus",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},contextMenuItemCloneRow:{value:{command:{value:"contextMenuItemCloneRowCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:!1,type:"boolean"},icon:{value:"smart-icon-duplicate",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},contextMenuItemDelete:{value:{command:{value:"contextMenuItemDeleteCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:!1,type:"boolean"},icon:{value:"smart-icon-delete",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},contextMenuItemEdit:{value:{command:{value:"contextMenuItemEditCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:!1,type:"boolean"},icon:{value:"smart-icon-mode-edit",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},contextMenuItemCut:{value:{command:{value:"contextMenuItemCutCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:!1,type:"boolean"},icon:{value:"smart-icon-cut",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},contextMenuItemCopy:{value:{command:{value:"contextMenuItemCopyCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:!1,type:"boolean"},icon:{value:"smart-icon-copy-record",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},contextMenuItemPaste:{value:{command:{value:"contextMenuItemPasteCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:!1,type:"boolean"},icon:{value:"smart-icon-paste",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},contextMenuItemClear:{value:{command:{value:"contextMenuItemClearCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:!1,type:"boolean"},icon:{value:"smart-icon-close",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},contextMenuItemComment:{value:{command:{value:"contextMenuItemAddCommentCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:!1,type:"boolean"},icon:{value:"smart-icon-comment",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},contextMenuItemCustom:{value:{command:{value:null,type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:!1,type:"boolean"},icon:{value:"smart-icon-settings",type:"string"},label:{value:"",type:"string"}},type:"object",reflectToAttribute:!1}},type:"object",reflectToAttribute:!1}},type:"object",reflectToAttribute:!1},columnMenu:{value:{autoClose:{value:!0,type:"boolean"},dataSource:{value:{columnMenuCustomizeType:{value:{command:{value:"customizeTypeCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:!1,type:"any"},icon:{value:"smart-icon-settings",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},columnMenuItemClone:{value:{command:{value:"duplicateCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:!1,type:"any"},icon:{value:"smart-icon-duplicate",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},columnMenuItemInsert:{value:{command:{value:"insertRightCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:!1,type:"any"},icon:{value:"smart-icon-plus",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},columnMenuItemSortAsc:{value:{command:{value:"sortAscCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:"auto",type:"any"},icon:{value:"smart-icon-sort-name-up",type:"string"},iconAlt:{value:"smart-icon-sort-number-up",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},columnMenuItemSortDesc:{value:{command:{value:"sortDescCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:"auto",type:"any"},icon:{value:"smart-icon-sort-name-down",type:"string"},iconAlt:{value:"smart-icon-sort-number-down",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},columnMenuItemRemoveSort:{value:{command:{value:"removeSortCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:"auto",type:"any"},icon:{value:"smart-icon-cancel-circled",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},columnMenuItemSort:{value:{command:{value:"addSortCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:"auto",type:"any"},icon:{value:"smart-icon-sort",type:"string"},iconAlt:{value:"smart-icon-sort",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},columnMenuItemFilter:{value:{command:{value:"addFilterCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:"auto",type:"any"},icon:{value:"smart-icon-add-filter",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},columnMenuItemRemoveFilter:{value:{command:{value:"removeFilterCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:"auto",type:"any"},icon:{value:"smart-icon-cancel-circled",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},columnMenuItemGroupBy:{value:{command:{value:"groupByCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:"auto",type:"any"},icon:{value:"smart-icon-group",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},columnMenuItemRemoveGroupBy:{value:{command:{value:"removeGroupByCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:"auto",type:"any"},icon:{value:"smart-icon-ungroup",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},columnMenuItemHide:{value:{command:{value:"hideColumnCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:!1,type:"any"},icon:{value:"smart-icon-visibility-off",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},columnMenuItemDelete:{value:{command:{value:"deleteColumnCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:!1,type:"any"},icon:{value:"smart-icon-delete",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1}},type:"object",reflectToAttribute:!1},visible:{value:!1,type:"boolean"},enabled:{value:!0,type:"boolean"},width:{value:250,type:"number"},height:{value:null,type:"number?"}},type:"object",reflectToAttribute:!1},columnGroups:{value:[],type:"array",reflectToAttribute:!1},charting:{value:{appendTo:{value:null,type:"any"},enabled:{value:!1,type:"boolean"},colorScheme:{value:"scheme01",type:"string"},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","scheduler","timeline"],type:"string"},currentUser:{value:null,type:"any",reflectToAttribute:!1},dropDownMode:{value:!1,type:"boolean",reflectToAttribute:!1},dropDownModeDataField:{value:"",type:"string",reflectToAttribute:!1},dataSource:{value:null,type:"any",reflectToAttribute:!1},dataSourceMap:{value:{checklist:"checklist",color:"color",comments:"comments",dueDate:"dueDate",id:"id",priority:"priority",progress:"progress",startDate:"startDate",status:"status",swimlane:"swimlane",tags:"tags",text:"text",description:"description",userId:"userId",history:"history",createdUserId:"createdUserId",createdDate:"createdDate",updatedUserId:"updatedUserId",updatedDate:"updatedDate"},type:"any",reflectToAttribute:!1},dataSourceSettings:{value:{autoGenerateColumns:{value:!1,type:"boolean"},sanitizeHTML:{value:"blackList",allowedValues:["all","blackList","none"],type:"string"},root:{value:"",type:"string"},record:{value:"",type:"string"},keyDataField:{value:"",type:"string"},parentDataField:{value:"",type:"string"},childrenDataField:{value:"",type:"string"},groupBy:{value:[],type:"array"},dataFields:{value:[],type:"array"},mapChar:{value:".",type:"string"},id:{value:"",type:"string"},relations:{value:[],type:"any",reflectToAttribute:!1},virtualDataSource:{value:null,type:"any"},virtualDataSourceOnExpand:{value:null,type:"any"}},type:"object"},formulas:{value:!1,type:"boolean"},highlighted:{value:-1,type:"any"},uploadSettings:{value:{url:{value:"",type:"string",reflectToAttribute:!1},removeUrl:{value:"",type:"string",reflectToAttribute:!1},existsUrl:{value:"",type:"string",reflectToAttribute:!1},name:{value:"userfile[]",type:"string",reflectToAttribute:!1},uploadMaxCount:{value:5,type:"number",reflectToAttribute:!1},uploadMaxSize:{value:2097152,type:"number",reflectToAttribute:!1},data:{value:null,type:"object",reflectToAttribute:!1},onUploadStarted:{value:null,type:"any",reflectToAttribute:!1},onUploadCompleted:{value:null,type:"any",reflectToAttribute:!1},onUploadRemove:{value:null,type:"any",reflectToAttribute:!1},onUploadError:{value:null,type:"any",reflectToAttribute:!1},onChange:{value:null,type:"any",reflectToAttribute:!1},onProgress:{value:null,type:"any",reflectToAttribute:!1},onAbort:{value:null,type:"any",reflectToAttribute:!1},onError:{value:null,type:"any",reflectToAttribute:!1},onSetHeaders:{value:null,type:"any",reflectToAttribute:!1},singleFilePost:{value:!0,type:"boolean",reflectToAttribute:!1},userFiles:{value:[],type:"array",reflectToAttribute:!1}},reflectToAttribute:!1,type:"object"},grouping:{value:{enabled:{value:!1,type:"boolean",reflectToAttribute:!1},allowCollapse:{value:!1,type:"boolean",reflectToAttribute:!1},autoHideGroupColumn:{value:!1,type:"boolean",reflectToAttribute:!1},autoExpandAll:{value:!1,type:"boolean",reflectToAttribute:!1},autoExpandToLevel:{value:0,type:"number",reflectToAttribute:!1},onGroupDefaultExpanded:{value:null,type:"any",reflectToAttribute:!1},expandMode:{value:"buttonClick",type:"string",allowedValues:["buttonClick","rowClick"],reflectToAttribute:!1},renderMode:{type:"string",value:"advanced",allowedValues:["basic","compact","advanced","multipleColumns"]},groupBy:{value:[],type:"array",reflectToAttribute:!1},groupRowHeight:{value:50,type:"any",reflectToAttribute:!1},toggleButtonIndent:{value:27,type:"number",reflectToAttribute:!1},groupIndent:{value:27,type:"number",reflectToAttribute:!1},groupBar:{value:{visible:{value:!1,type:"boolean",reflectToAttribute:!1},allowColumnDragDrop:{value:!0,type:"boolean",reflectToAttribute:!0},allowColumnCloseButtons:{value:!0,type:"boolean",reflectToAttribute:!0}},type:"object"},formatFunction:{value:null,type:"any",reflectToAttribute:!1},summaryRow:{value:{inline:{value:!0,type:"boolean"},visible:{value:!0,type:"boolean"}},type:"object"}},type:"object"},keys:{value:null,reflectToAttribute:!1,type:"any"},messages:{extend:!0,value:{en:{invalidColumnProperty:'{{elementType}}: Invalid property name "{{propertyName}}" set for Column: "{{type}}"',invalidRowProperty:'{{elementType}}: Invalid property name "{{propertyName}}" set for Row"',invalidCellValue:'Invalid cell value "{{value}}", Validation rule: "{{validationRule}}"',invalidValue:"Invalid value",invalidMinValue:"{{value}} above {{min}} must be filled out",invalidMaxValue:"{{value}} below {{max}} must be filled out",invalidMinLengthValue:"{{value}} is shorter than the minimum length of {{min}} characters",invalidMaxLengthValue:"{{value}} is longer than the maximum length of {{max}} characters",requiredValue:"{{value}} must be filled out",frozenColumns:"{{elementType}}: To Pin/Freeze a column group, all columns within it should be frozen.",frozenRows:"{{elementType}}: To Pin/Freeze a special cell, all rows within it should be frozen.",columnGroups:"{{elementType}}: Please, check the initialization of the SmartGrid's columns array. The columns in a column group are expected to be siblings in the columns array.",viewGrid:"Grid",viewKanban:"Kanban",viewCard:"Cards",viewScheduler:"Calendar",viewTimeline:"Timeline",kanbanNone:"Blank",schedulerDescription:"Which date column would you like to use for this view? Your data would be placed based on the dates in this column.",schedulerDescriptionInfo:"A range of data would be displayed when a start date field has an associated due date field.",kanbanDescription:'Start from a project board with columns generated by the "{{column}}" column options.',kanbanNoneDescription:"Create a new column and start from scratch with a completely blank project board. You can add columns and configure settings yourself.",kanbanBasic:"Template",kanbanBasicDescription:'Create a new column and start from a project board with columns for "To do", "in progress" and "Done".',schedulerDateColumn:"Create a new date column",schedulerPromptLabel:"Using date column(s)",schedulerDateRangeColumn:"Create a new date range",schedulerToolLabel:"Using '{{column}}'",toolLabel:"Labeled by '{{column}}'",uncategorized:"Uncategorized",toDo:"To do",inProgress:"In progress",done:"Done",min:"Min: {{value}}",max:"Max: {{value}} ",sum:"Sum: {{value}} ",avg:"Avg: {{value}} ",cells:"{{value}} cells selected",rows:"{{value}} rows",oneRow:"1 row",unique:"Unique: {{value}}",blank:"Empty: {{value}}",filled:"Filled: {{value}}",summary:"Summary",countSummary:"Count",minSummary:"Min",maxSummary:"Max",avgSummary:"Avg",blankSummary:"Empty",uniqueSummary:"Unique",filledSummary:"Filled",statusSummary:"Status",sumSummary:"Sum",completed:"Tasks Completed: {{value}}",count:"Count: {{value}} ",pagerFirstButton:"First",pagerLastButton:"Last",pagerPreviousButton:"Previous",pagerNextButton:"Next",pagerNavigateToLabel:"Go to:",pagerPageSizeLabel:"Show:",pagerNavigateToInputPlaceholder:"",pagerEllipsis:"...",pagerSummaryString:"of",pagerSummaryPrefix:"of",pagerSummarySuffix:"",columnMenuCustomizeType:"Column settings",columnMenuItemClone:"Clone column",columnMenuItemInsert:"Insert column",columnMenuItemSortAsc:"Sort {{mode}}",columnMenuItemSortDesc:"Sort {{mode}}",columnMenuItemRemoveSort:"Remove Sort",columnMenuItemFilter:"Filter column",columnMenuItemSort:"Sort column",columnMenuItemRemoveFilter:"Remove Filter",columnMenuItemGroupBy:"Group column",columnMenuItemRemoveGroupBy:"Remove Group",columnMenuItemHide:"Hide column",columnMenuItemShow:"Show column",columnMenuItemDelete:"Delete column",columnResizeTooltip:"width: {{value}}px",rowResizeTooltip:"height: {{value}}px",commandBarAddRow:"Add",commandBarDeleteRow:"Delete row",commandBarBatchRevert:"Revert",commandBarBatchSave:"Save",commandBarFilter:"Filter",commandBarSort:"Sort",commandBarSearch:"Search",commandBarCustomize:"Customize",commandBarGroup:"Group",commandColumnEdit:"Edit",commandColumnDelete:"Delete",commandColumnCancel:"Cancel",commandColumnUpdate:"Update",contextMenuItemDelete:"Delete row",contextMenuItemEditCell:"Edit cell",contextMenuItemEditRow:"Edit row",contextMenuItemSelectRow:"Select row",contextMenuItemCloneRow:"Clone row",contextMenuItemInsertRow:"Insert row",contextMenuItemAddRow:"Add {{value}} rows",commandColumnMenu:"",expandRow:"Expand row (Shift + Enter)",expandRowComments:"Expand row and see {{value}} comments",collapseRow:"Collapse row",addNewRow:"Click here to add a new row",addNewRowAlt:"<span>Add new empty row</span> <code>Ctrl</code> + <code>Space</code>",addNewRowAltSmall:"Add new empty row",addNewColumn:"Click here to add a new column",dialogChartHeader:"{{value}} Chart",dialogRowDetailHeader:"Row Id: {{value}}",dialogDescriptionHeader:"Column: {{value}}",dialogRowDetailButtonConfirm:"OK",dialogRowDetailButtonCancel:"CANCEL",dialogEditHeaderDisabled:"Row: {{value}}",dialogEditHeader:"Row: {{value}}",dialogEditHeaderMenu:"Toggle Sidebar",dialogExpandRowHeader:"Edit Record",dialogAddButtonConfirm:"ADD",dialogAddButtonCancel:"CANCEL",dialogEditButtonConfirm:"OK",dialogEditButtonSave:"Save",dialogEditButtonAutoSave:"Auto Save",dialogEditButtonCancel:"Cancel",dialogFilterButtonConfirm:"FILTER",dialogFilterButtonCancel:"CLEAR",dialogDeleteButtonConfirm:"DELETE",dialogDeleteButtonCancel:"CANCEL",dialogEditColumn:"Column: {{value}}",dialogNewColumn:"New column",dialogAddColumn:"Add Column",dialogAddColumnDate:"Choose a date column",dialogAddColumnStatus:"Choose a grouping column",dialogAddColumnStatusDescription:"Represent the status of each record",dialogAddColumnStatusNotes:"Your records will be grouped based on this column",dialogAddHeader:"Add Row",dialogDeleteHeader:"Delete Row",dialogFilterHeader:"Filter by",dialogFilterMinLabel:"Min",dialogFilterMaxLabel:"Max",dialogFileHeader:"File",dialogImageFileHeader:"Image",dialogFileDrop:"or drag and drop file(s) to upload",dialogFileUpload:"Select Files(s) to Upload",dialogFileURL:"You can also provide the URL to a file",dialogFileURLUpload:"Upload",dialogFileLink:"Link (URL)",dialogFileDevice:"My Device",dialogMyFiles:"My Files",dialogMyFilesTitle:"Select files from your already uploaded files.",dialogFileSize:'No file currently added. The "{{value}}" file cannot be uploaded. Maximum file size is {{fileSize}}.',dialogFileCount:'The following files cannot be added "{{files}}". Maximum files allowed is {{fileCount}}.',dialogFileFileUpload:"No files currently selected",dialogAddColumnName:"Name",dialogAddColumnNameInfo:"Name of the column. The name of the column will be displayed in the column header.",dialogAddColumnDescription:"Description",dialogAddColumnDescriptionInfo:"Description of the column. When the description is set, an icon will be displayed in the column header. A tooltip with the description will be displayed when you point at the icon.",dialogAddColumnNamePlaceholder:"Column name (optional)",dialogAddColumnDescriptionPlaceholder:"Describe this column (optional)",dialogAddColumnType:"Type",dialogAddColumnTypeInfo:'Type of the data in the column. Unlike a spreadsheet, Columns have specific "types" that allow you to store rich content in each record. For example, a table can contain records (rows) with images, long texts, checkboxes.',dialogAddColumnTypeText:"Text",dialogAddColumnTypeMultilineText:"Multiline text",dialogAddColumnTypeAIQuery:"AI Button",dialogAddColumnTypeSparklines:"Sparklines",dialogAddColumnAIQuery:"AI Query",dialogAddColumnTypeAIQueryInfo:"Example: Write a short description for an article or choose a column to query by it",dialogAddColumnTypeUUID:"UUID",dialogAddColumnTypeImage:"Image",dialogAddColumnTypeNumber:"Number",dialogAddColumnTypeSelect:"Select",dialogAddColumnTypeMultipleSelect:"Multiple select",dialogAddColumnTypeDate:"Date",dialogAddColumnTypeTime:"Time",dialogAddColumnTypeRating:"Rating",dialogAddColumnTypeDuration:"Duration",dialogAddColumnTypeCheckBox:"CheckBox",dialogAddColumnTypeCreatedTime:"Created time",dialogAddColumnTypeLastUpdatedTime:"Last modified time",dialogAddColumnTypeCreatedBy:"Created by",dialogAddColumnTypeLastUpdatedBy:"Last modified by",dialogAddColumnTypeCollaborator:"User",dialogAddColumnTypeFormula:"Formula",dialogAddColumnTypeFormulaInfo:'Example: COL(Name) & "-" & COL(Price) or IF(COL(Price) * COL(Quantity) > 5, "Yes", "No")',dialogAddColumnTypeSlider:"Slider",dialogAddColumnTypeStatus:"Choose a status column",dialogAddColumnTypeStatusInfo:"Connect with the relevant status column",dialogAddColumnTypeAutoNumber:"Auto number",dialogAddColumnTypeRowLink:"Link to table",dialogAddColumnTypeURL:"URL",dialogAddColumnTypeEmail:"Email",dialogAddColumnTypePassword:"Password",dialogAddColumnTypePhone:"Phone",dialogAddColumnTypeNone:"None",dialogAddColumnTypeStartDate:"Start Date",dialogAddColumnTypeDueDate:"Due Date",dialogAddColumnTypeDueDateSettings:"Set as a deadline",dialogAddColumnTypeDueDateSettingsInfo:"Set a deadline with start date or due date templates.",dialogAddColumnTypeProgress:"Progress",dialogAddColumnTypePriority:"Priority",dialogAddColumnTypeDescription:"Description",dialogAddColumnTypeTags:"Tags",dialogAddColumnTypeName:"Name",dialogAddColumnTypeColor:"Color",dialogAddColumnTypeChecklist:"Checklist",dialogAddColumnTypeAssigned:"Assignee",dialogAddColumnTypeAttachment:"Attachment",dialogAddColumnTypeVote:"Vote",dialogAddColumnDateFormat:"Date format",dialogAddColumnDateFormatInfo:"Choose the dates display format",dialogAddColumnDateFormatShort:"Short",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",dialogAddColumnDotItems:"Show Dots",dialogAddColumnCustomItems:"Custom Items",dialogAddColumnListItems:"List items",dialogAddColumnLinkListItems:"Choose a table to link to",dialogAddColumnLinkField:"Choose a lookup field",dialogAddColumnLinkFieldMore:"Cascading readonly fields",dialogAddColumnLinkSelect:"Allow linking to multiple rows",dialogAddColumnFormula:"Please enter a formula",dialogAddColumnListItemsError:"You cannot delete an item while in use.",dialogAddColumnListItemsEditError:"You cannot edit an item while in use.",dialogAddColumnDefault:"Default value",dialogAddColumnDefaultDateCurrent:"Current Date",dialogAddColumnDefaultDateSpecific:"Specific Date",dialogAddColumnAlign:"Align",dialogAddColumnAlignLeft:"Left",dialogAddColumnAlignRight:"Right",dialogAddColumnAlignCenter:"Center",dialogAddColumnAlignInfo:"Table cells text alignment",dialogAddColumnResizable:"Resizable",dialogAddColumnResizableInfo:"Select if you want to make the column resizable",dialogAddColumnRequired:"Required",dialogAddColumnRequiredInfo:"Select if you want to make the column required",dialogAddColumnSortable:"Sortable",dialogAddColumnSortableInfo:"Select if you want to sort by this column",dialogAddColumnFilterable:"Filterable",dialogAddColumnFilterableInfo:"Select if you want to filter by this column",dialogAddColumnEditable:"Editable",dialogAddColumnEditableInfo:"Select if you want to edit by this column",dialogAddColumnMultipleCollaborators:"Multiple Collaborators",dialogAddColumnMultipleCollaboratorsInfo:"Select if you want to allow multiple collaborators",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:"Color",formatingByMultiple:"{{n}} Colors",formatingOne:"1 color",formatingBy:"Colored by '{{value}}'",reset:"Reset",filteredRecords:"All rows are filtered",duplicateCells:"Clone column cells and settings",duplicateSettings:"Clone column settings",views:"Views",createView:"New View",newGrid:"Grid",newKanban:"Kanban",newCard:"Cards",newScheduler:"Calendar",newTimeline:"Timeline",layout:"Layout",settings:"Create view",viewNamePlaceholder:"View name",view:"View",noViews:"Found no views",kanbanView:"View your records as cards on a Kanban board",gridView:"View your records in a Table",cardView:"View your records in a Card view",schedulerView:"View your records in a Calendar view",timelineView:"View your records in a Timeline view",days:"{{value}}d",daysOverdue:"{{value}} days overdue",daysLeft:"{{value}} days left",true:"true",false:"false",TOMORROW:"Tomorrow",TODAY:"Today",YESTERDAY:"Yesterday",NEXT_WEEK:"Next week",THIS_WEEK:"This week",LAST_WEEK:"Last week",NEXT_MONTH:"Next month",THIS_MONTH:"This month",LAST_MONTH:"Last month",hideHiddenColumns:"Hide {{value}} hidden columns",showHiddenColumns:"Show {{value}} hidden columns",less:"Less",more:"More",conditions:"Conditions",colorsSingleSelect:"Which single select field should the row be colored by?",colorRows:"Color rows when they match the conditions",colorSelect:"Color rows the same as a single select value",colorLeftBorderLabel:"Left border",colorRowLabel:"Row",colorCellLabel:"Cell",colorLeftBorder:"Color the left border of a row",colorRow:"Color the background of a row",colorCell:"Color the background of a cell",loadingIndicatorPlaceholder:"Loading...",dropDownPlaceholder:"Please select...",placeholder:"No Rows",pieChart:"Pie",columnChart:"Column",barChart:"Bar",stackedChart:"Stacked",lineChart:"Line",projectStatus:"Project Status",reviewStatus:"Review Status",taskStatus:"Task Status",priority:"Priority",size:"Size",yesNo:"Yes/No",notStarted:"Not Started",underReview:"Under review",approved:"Approved",blocked:"Blocked",completedStatus:"Completed",generate:"Generate",aiPrompt:"Enter your prompt for the AI:",agenda:"Agenda",checkStyle:"Style",noVotes:"No votes yet",votes:"Voted by {{value}}",clearContents:"Clear contents",paste:"Paste",minPromptChars:"Enter AI prompt. Min 20 chars."}},type:"object"},onCellValue:{value:null,type:"any",reflectToAttribute:!1},onCellEditRequest:{value:null,type:"any",reflectToAttribute:!1},onCellUpdate:{value:null,type:"any",reflectToAttribute:!1},onCellRender:{value:null,type:"any",reflectToAttribute:!1},onCellValueChanged:{value:null,type:"any",reflectToAttribute:!1},onBeforeInit:{value:null,type:"any",reflectToAttribute:!1},onInit:{value:null,type:"any",reflectToAttribute:!1},onAfterInit:{value:null,type:"any",reflectToAttribute:!1},onKey:{value:null,type:"any",reflectToAttribute:!1},onKeyUp:{value:null,type:"any",reflectToAttribute:!1},onRender:{value:null,type:"any",reflectToAttribute:!1},onLoad:{value:null,type:"any",reflectToAttribute:!1},onChartInit:{value:null,type:"any",reflectToAttribute:!1},onComment:{value:null,type:"any",reflectToAttribute:!1},onRowInit:{value:null,type:"any",reflectToAttribute:!1},onRowClass:{value:null,type:"any",reflectToAttribute:!1},onRowChange:{value:null,type:"any",reflectToAttribute:!1},onRowDetailInit:{value:null,type:"any",reflectToAttribute:!1},onRowDetailUpdated:{value:null,type:"any",reflectToAttribute:!1},onRowInserted:{value:null,type:"any",reflectToAttribute:!1},onRowRemoved:{value:null,type:"any",reflectToAttribute:!1},onRowUpdate:{value:null,type:"any",reflectToAttribute:!1},onRowUpdated:{value:null,type:"any",reflectToAttribute:!1},onRowStarred:{value:null,type:"any",reflectToAttribute:!1},onRowHistory:{value:null,type:"any",reflectToAttribute:!1},onRowStyle:{value:null,type:"any",reflectToAttribute:!1},onRowResize:{value:null,type:"any",reflectToAttribute:!1},onColumnInit:{value:null,type:"any",reflectToAttribute:!1},onColumnInserted:{value:null,type:"any",reflectToAttribute:!1},onColumnRemoved:{value:null,type:"any",reflectToAttribute:!1},onColumnResize:{value:null,type:"any",reflectToAttribute:!1},onColumnReorder:{value:null,type:"any",reflectToAttribute:!1},onColumnSummaryChange:{value:null,type:"any",reflectToAttribute:!1},onColumnUpdated:{value:null,type:"any",reflectToAttribute:!1},onColumnClone:{value:null,type:"any",reflectToAttribute:!1},onColumnChange:{value:null,type:"any",reflectToAttribute:!1},onCommand:{value:null,reflectToAttribute:!1,type:"any"},onViewInit:{value:null,type:"any",reflectToAttribute:!1},filtering:{value:{enabled:{value:!1,type:"boolean"},operator:{value:"and",type:"string"},filter:{value:[],type:"array",reflectToAttribute:!1},filterRow:{value:{visible:{value:!1,type:"boolean"},menuVisible:{value:!1,type:"boolean"},applyMode:{value:"auto",type:"string",allowedValues:["auto","click"]},autoApplyModeDelay:{value:800,type:"number"}},type:"object"},filterMenu:{value:{visible:{value:!0,type:"boolean"},buttons:{value:["cancel","clear","filter"],type:"array"},dataSource:{value:null,type:"any"},width:{value:250,type:"number"},height:{value:200,type:"number"},mode:{value:"default",allowedValues:["default","excel"],type:"string"},messages:{value:null,type:"object"}},type:"object"}},type:"object"},editing:{value:{allowRowHeaderEdit:{value:!1,type:"boolean"},allowColumnHeaderEdit:{value:!1,type:"boolean"},autoUpdateFilterAndSort:{value:!0,type:"boolean"},allowListOpenOnContentClick:{value:!0,type:"boolean"},active:{value:!1,readonly:!0,type:"boolean"},enabled:{value:!1,type:"boolean"},batch:{value:!1,type:"boolean"},readOnlyEdit:{value:!1,type:"boolean"},action:{value:"click",type:"string",allowedValues:["none","click","doubleClick"]},commandKeys:{value:{commandKeyCancel:{value:{command:"commandKeyCancelCommand",key:"Escape"},type:"object"},commandKeyUpdate:{value:{command:"commandKeyUpdateCommand",key:"Enter | Tab"},type:"object"}},type:"object"},commandBar:{value:{visible:{value:!1,type:"boolean"},position:{value:"near",allowedValues:["near","far","both"],type:"string"},displayMode:{value:"labelAndIcon",allowedValues:["label","icon","labelAndIcon"],type:"string"},dataSource:{value:{commandBarAddRow:{value:{command:{value:"commandBarAddRowCommand",type:"any"},icon:{value:"smart-icon-plus",type:"string"},label:{value:"{{messages}}",type:"string"},visible:{value:!1,type:"any"}},type:"object"},commandBarDeleteRow:{value:{command:{value:"commandBarDeleteRowCommand",type:"any"},icon:{value:"smart-icon-delete",type:"string"},label:{value:"{{messages}}",type:"string"},visible:{value:!1,type:"any"}},type:"object"},commandBarBatchSave:{value:{command:{value:"commandBarBatchSaveCommand",type:"any"},icon:{value:"smart-icon-ok-squared",type:"string"},label:{value:"{{messages}}",type:"string"},visible:{value:!0,type:"any"}},type:"object"},commandBarBatchRevert:{value:{command:{value:"commandBarBatchRevertCommand",type:"any"},icon:{value:"smart-icon-reload",type:"string"},label:{value:"{{messages}}",type:"string"},visible:{value:!0,type:"any"}},type:"object"},commandBarCustom:{value:{command:{value:"",type:"any"},icon:{value:"smart-icon-ellipsis-vert",type:"string"},label:{value:"",type:"string"},visible:{value:!1,type:"any"}},type:"object"}},type:"object"}},type:"object"},commandColumn:{value:{visible:{value:!1,type:"boolean"},inline:{value:!1,type:"boolean"},position:{value:"far",allowedValues:["near","far"],type:"string"},displayMode:{value:"icon",allowedValues:["label","icon","labelAndIcon"],type:"string"},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"},sidePanel:{value:!1,type:"booelan"},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' style=\"opacity: 0.99\" role=\"presentation\" class='center smart-grid-row-container'>\n </div>\n <div id='rowFarContainer' role=\"presentation\" class='far smart-hidden smart-grid-row-container'>\n </div>\n <div id='placeholder' class ='smart-hidden smart-placeholder smart-grid-placeholder'></div>\n <smart-scroll-bar right-to-left=\"[[rightToLeft]]\" theme=\"[[theme]]\" id='verticalScrollBar' class='smart-grid-scroll-bar' wait disabled='[[disabled]]' orientation='vertical'></smart-scroll-bar>\n <smart-scroll-bar right-to-left=\"[[rightToLeft]]\" theme=\"[[theme]]\" id='horizontalScrollBar' class='smart-grid-scroll-bar' wait disabled='[[disabled]]'></smart-scroll-bar>\n </div>\n <div id='filterFooter' class='smart-grid-filter-footer smart-hidden'></div>\n </div>\n <div class=\"smart-grid-view-content smart-hidden\" id=\"viewContent\"></div>\n <div viewbar class=\"smart-grid-view-bar smart-hidden\" id=\"viewBar\"></div>\n <div id='loadingIndicatorContainer' class='smart-loader-container'>\n <span id='loadingIndicator' class='smart-grid-loader smart-loader'></span>\n <span id='loadingIndicatorPlaceholder' class ='smart-loader-label smart-hidden'></span>\n </div>\n <div id='footerCommandBar' footer class='smart-grid-footer smart-grid-command-bar smart-hidden'></div>\n <div id='footerPager' class='smart-grid-pager smart-hidden'></div>\n <div id='footer' class='smart-grid-footer smart-hidden'></div>\n </div>"}static get listeners(){return{focus:"_focusHandler",blur:"_blurHandler",wheel:"_mouseWheelHandler","document.up":"_upHandler","document.down":"_downHandler","document.move":"_moveHandler","document.scroll":"_scrollHandler",keydown:"_keyDownHandler",keyup:"_keyUpHandler",resize:"_resizeHandler","header.click":"_headerClickHandler","columnHeader.down":"_columnDownHandler","columnHeader.click":"_columnClickHandler","columnHeader.move":"_columnMoveHandler","columnHeader.mouseleave":"_columnMouseLeaveHandler","rowNearContainer.down":"_rowDownHandler","rowContainer.down":"_rowDownHandler","rowFarContainer.down":"_rowDownHandler","container.selectstart":"_selectStartHandler",styleChanged:"_styleChangedHandler",swipeleft:"_swipeLeftHandler",swiperight:"_swipeRightHandler",contextmenu:"_contextMenuHandler","document.paste":"_clipboardPasteHandler"}}_clipboardPasteHandler(e){if("paste"===e.type){const t=this;if(document.activeElement!==t)return;if(t._selection&&t._selection.focusedCell){const o=t._selection.focusedCell.id,l=t._selection.focusedCell.dataField,a=t.columnByDataField[l];if(!a)return;if(a&&("image"===a.template||"attachment"===a.template||"richText"===a.template)){e.preventDefault();let n=(e.clipboardData||e.originalEvent.clipboardData).items,i=null,r=0,s=0,d=[];for(let e=0;e<n.length;e++)if(0===n[e].type.indexOf("image")&&(i=n[e].getAsFile(),r++,null!==i)){let e={label:i.name,size:i.size},n=new FileReader;n.onload=function(n){s++;const i=n.target.result;e.value=i;let u=!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){u=!0;break}}if(u||t.uploadSettings.userFiles.push(e),d.push(e),s===r){let e=t.getCellValue(o,l);if(e||(e=[]),"string"==typeof e&&(e=JSON.parse(e)),e=[...e,...d],"richText"===a.template){const a=document.createElement("span");for(let t=0;t<e.length;t++){const o=document.createElement("img");o.src=e[t].value,o.title=o.name=e[t].label,a.appendChild(o)}t.setCellValue(o,l,a.outerHTML)}else t.setCellValue(o,l,e)}},n.readAsDataURL(i)}}}}}_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=()=>{if(t.editing.isEditing&&!t.editing.dialog.enabled){if(t._hasRichTextEditor)return;setTimeout((()=>{if(!e.defaultPrevented){if(t.editing.editCell&&t.editing.editCell.editor.instance){const o=t.editing.editCell.editor.instance;if(o.element&&o.element.hasAttribute("aria-owns")){const t=o.element.getAttribute("aria-owns"),l=document.getElementById(t);if(l&&l.contains(e.originalEvent.target))return}if(o.element&&o.element&&o.element.firstElementChild&&o.element.firstElementChild.hasAttribute("aria-owns")){const t=o.element.firstElementChild.getAttribute("aria-owns"),l=document.getElementById(t);if(l&&l.contains(e.originalEvent.target))return}if(e.originalEvent.target&&e.originalEvent.target.classList.contains("smart-editor-toolbar-item"))return;if(t.editing.editCell.editor.instance.blur(e),e.defaultPrevented)return}t.isAttached&&t.endEdit()}}),50)}};if(e.originalEvent&&(e.originalEvent.target===t.$.scrollView&&t._downTarget===e.originalEvent.target&&l(),e.originalEvent.target.closest(".smart-grid-dialog")))t._dialogDragDetails&&(t._dialogDragDetails.started=!1);else{if(e.pageX<o.left||e.pageX>o.right||e.pageY<o.top||e.pageY>o.bottom){let o=!1,a=e.originalEvent.target;for(;a;){if(a=a.parentNode,a===t){o=!0;break}if(t.dropDownMode&&t.$.dropDownElement===a){o=!0;break}}if(o)return t._dragSelectionEnd(e),t._endResize(e),void t._endDrag(e);if(t._summaryRowDialog&&t._summaryRowDialog.classList.contains("open")&&t._summaryRowDialog.confirm(),t._inputOverlay&&(t._inputOverlay.classList.remove("smart-input-overlay-on"),setTimeout((()=>{t._inputOverlay&&(t._inputOverlay.parentNode&&t._inputOverlay.parentNode.removeChild(t._inputOverlay),t._inputOverlay=null)}),t.behavior.doubleClickTimingDelay)),l(),t.closeDropDown(),t.menu){let o,l,a,n;if(t.enableShadowDOM||t.isInShadowDOM?(o=e.originalEvent.composedPath()[0],l=function(){let e=o.getRootNode().host;for(;e;){if(e===t)return e;e=e.getRootNode().host}}(),a=t.menu.contains(o)||t.menu.firstElementChild.shadowRoot.contains(o),n=t.menu.firstElementChild.shadowRoot):(o=e.originalEvent.target,l=t.contains(o),a=t.menu.contains(o),n=t.menu),!l&&!a){const l=n.querySelectorAll("smart-drop-down-list"),a=n.querySelectorAll("smart-date-time-picker"),i=n.querySelectorAll("smart-date-input"),r=n.querySelectorAll("smart-input");for(let e=0;e<l.length;e++)if(l[e].$.dropDownContainer.contains(o))return;for(let e=0;e<a.length;e++)if(a[e].$.dropDownContainer.contains(o))return;for(let e=0;e<i.length;e++)if(i[e].$.scrollView.contains(o))return;for(let e=0;e<r.length;e++)if(r[e].$.scrollView.contains(o))return;return t.closeMenu(),t._dragSelectionEnd(e),t._endResize(e),void t._endDrag(e)}}}t._summaryRowDialog&&t._summaryRowDialog.classList.contains("open")&&t._summaryRowDialog.confirm(),t._dragSelectionEnd(e),t._endResize(e),t._endDrag(e)}}_nextColumn(e){const t=this;for(let o=0;o<t.viewColumns.length;o++){const l=t.viewColumns[o];if(l.visibleIndex===e.visibleIndex+1)return l}return null}_nextRow(e){const t=this._recyclingRows,o=t.indexOf(e);return o>=0?t[o+1]:null}_moveHandler(e){const t=this;if(t.isInitialized&&t._selection){if(t.selection.enabled&&t.selection.allowDragSelection&&!t.editing.isEditing&&(!t._selection.selectionRect||t._selection.selectionRect&&!t._selection.selectionRect.captured)&&(!0!==t._mobile&&t._dragSelection(e),e.originalEvent)){const o=e.originalEvent.target.closest?e.originalEvent.target:void 0;Smart.Utilities.Core.isMobile&&o&&o.closest("smart-grid")===t&&e.originalEvent.preventDefault()}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,s=i?i.scrollLeft:0;if(n.left-s<=e.pageX&&n.left-s+a.width-10>=e.pageX)if(n.top-r<=e.pageY&&n.top-r+a.height>=e.pageY){if(!t.hasColumnMenu(o))return;l._showActionButton()}else l._hideActionButton();else l._hideActionButton()}};for(let e=0;e<t._columnElements.length;e++){const l=t._columnElements[e];o(l.column,l)}for(let e=0;e<t._frozenNearColumns.length;e++){const l=t._frozenNearColumns[e];o(l,l.element)}}_headerClickHandler(e){const t=this;if(t.$.headerBar){const o=t.isInShadowDOM||t.shadowRoot?e.composedPath()[0]:e.target;t.$.headerBar._headerClickHandler(o,t)}}_columnClickHandler(e){const t=this;if(t._overlay)return;if(void 0===e.clientX)return;const o=(t.enableShadowDOM?t.shadowRoot:t.getRootNode()).elementsFromPoint(e.clientX,e.clientY);let l=null,a=null;const n=new Date-t._columnClickTime<t.behavior.doubleClickTimingDelay;t._columnClickTime=new Date;for(let e=0;e<o.length;e++){const t=o[e];if(t.classList.contains("smart-action-button"))return;if(t.getAttribute("data-field")){l=t.getAttribute("data-field"),a=t;break}}if(l){const o=a.column;if(!o)return;if(e.srcElement.classList.contains("smart-filter-button"))return;if("_addNewColumn"===o.dataField)return void t._openAddColumnDialog();if(Smart.Utilities.Core.isMobile)n&&t.sorting.sortToggleOnClick&&o.allowSortToggleOnClick&&t.sorting.enabled&&(t.sortBy(l),t.autoSaveState()),t._columnMoveHandler(e),e.originalEvent&&e.originalEvent.preventDefault();else if(!n&&t.sorting.sortToggleOnClick&&o.allowSortToggleOnClick&&t.sorting.enabled){if("none"!==t.behavior.columnResizeMode&&"col-resize"===o.element.style.cursor)return;if(t._canSort=!0,""!==t.sorting.commandKey){if("Alt"===t.sorting.commandKey&&!1===e.altKey&&(t._canSort=!1),"Shift"===t.sorting.commandKey&&!1===e.shiftKey&&(t._canSort=!1),"Control"===t.sorting.commandKey&&!1===e.metaKey&&!1===e.ctrlKey&&(t._canSort=!1),"Control"!==t.sorting.commandKey&&e.ctrlKey)return;if(!0===t.sorting.sortToggleOnClickAndCommandKey&&!t._canSort)return}t.sortBy(l),t.autoSaveState()}}}_columnDownHandler(e){const t=this,o=(t.enableShadowDOM?t.shadowRoot:t.getRootNode()).elementsFromPoint(e.clientX,e.clientY);let l=null,a=null;const n=new Date-t._clickTime<t.behavior.doubleClickTimingDelay;t.$.headerBar&&t.$.headerBar.closePanel(),t._doubleClickHandler(e);for(let e=0;e<o.length;e++){const t=o[e];if(t.classList.contains("smart-action-button"))return;if(t.getAttribute("data-field")){l=t.getAttribute("data-field"),a=t;break}}if(l){const o=a.column;if(!o)return;if("_commandColumn"===l)return void(t.editing.commandColumn.dataSource.commandColumnMenu.visible&&t._applyCommand(t.editing.commandColumn.dataSource.commandColumnMenu.command));const i=function(a){const n=o.selectionColumn?t.selection.checkBoxes.action===a&&t.selection.enabled:t.selection.action===a&&t.selection.enabled;if("col-resize"!==o.element.style.cursor&&(!t.appearance.showColumnHeaderDragIcon||!e.originalEvent.target.classList.contains("smart-drag-handle"))&&n){if(t.editing.enabled&&t.editing.editColumn===o)return;if(e.shiftKey||e.ctrlKey||e.metaKey?t._dragSelectionStartDataField=null:t._dragSelectionStartDataField=l,"_checkBoxColumn"===l)return void t._toggleColumnSelection(o);"_rowHeaderColumn"===l&&t.selection.enabled&&t.selection.allowRowHeaderSelection&&t.appearance.showRowHeaderSelectIcon&&(delete t._areAllRowsSelected,t.areAllRowsSelected()?t.clearSelection():t.selectAllRows(),o.refresh()),t.selection.allowColumnHeaderSelection&&o.allowSelect&&t._setSelection(null,o.dataField,e)}};if(t.editing.isEditing&&t.endEdit(),i("click"),t._mobile){t._hideActionButtons();const o=(o,l)=>{if(o&&o.autoShowActionButton){const a=l.getBoundingClientRect(),n=t.offset(l);if(n.left<=e.pageX&&n.left+a.width-6>=e.pageX){if(!t.hasColumnMenu(o))return;l._showActionButton()}else l._hideActionButton()}};for(let e=0;e<t._columnElements.length;e++){const l=t._columnElements[e];o(l.column,l)}}if(t.$.fireEvent("columnClick",{column:o,dataField:o.dataField}),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,m=null;t._lastPointerDownTime=new Date;for(let t=0;t<a.length;t++){const o=a[t];if(o.hasAttribute("toggle-button")&&(i=o),o.hasAttribute("add-row")&&(d=o),o.hasAttribute("checkbox")&&(r=o),"A"===o.nodeName&&e.ctrlKey&&o.click(),o.hasAttribute("rating-value")&&(u=o),o.hasAttribute("vote-value")&&(c=o),s||"smart-grid-cell"!==o.nodeName.toLowerCase()||(s=o),!m&&o.classList.contains("smart-card")&&(m=o),!n&&"smart-grid-row"===o.nodeName.toLowerCase()){n=o;break}}if("card"===t.view){if(m){const o=m.getAttribute("row-id"),l=t.rowById[o];if(l){const a=e.originalEvent?e.originalEvent:e,n=3===a.which;if(l.element||l.createElement(),t.$.fireEvent("rowClick",{row:l,id:l.id,data:t.getRowData(l.id),isRightClick:n,originalEvent:a,pageX:parseInt(a.pageX),pageY:parseInt(a.pageY)}),s){const e=s.getAttribute("data-field");if(e){const o=t.columnByDataField[e],i=new Smart.Grid.Cell(l,o,this);s.cell=i,i.element=s,i&&t.$.fireEvent("cellClick",{cell:i,id:l.id,dataField:i.column.dataField,value:i.value,isRightClick:n,originalEvent:a,pageX:parseInt(a.pageX),pageY:parseInt(a.pageY)})}}const i=e.originalEvent.target;if(m.classList.contains("smart-card-header"))l.element&&l.element.row!==l&&(l.element.row=l),l.toggle();else if(l.children&&l.children.length>0&&(i.classList.contains("smart-icon-ungroup")||i.classList.contains("smart-icon-group")))l.element&&l.element.row!==l&&(l.element.row=l),l.toggle();else if(t.editing.enabled){const l=t.editing.dialog.enabled,a=t.editing.mode;if(i.scrollHeight>i.offsetHeight){const o=t.offset(i);if(e.originalEvent.pageX>=o.left+i.offsetWidth-15)return}const n=t.context;t.context=t,t.editing.dialog.enabled=!0,t.editing.mode="row",t._settingsDialogRowId=o;let r=t._isUpdating;m.setAttribute("edit",""),t.beginEdit(o),t._isUpdating=r,t._endCardRowEdit?(t.removeEventListener("endEdit",t._endCardRowEdit,null),t.removeEventListener("cancelEdit",t._endCardRowEdit,null)):t._endCardRowEdit=()=>{t.context=t,t.editing.dialog.enabled=l,t.editing.mode=a,t.editing.isEditing=!1,t.context=n,delete t._settingsDialogRowId,delete t._dialogEdit},t.addEventListener("endEdit",t._endCardRowEdit),t.addEventListener("cancelEdit",t._endCardRowEdit)}}}return}u&&(t._ratingElement=u),c&&(t._voteElement=c);const g=!!e.originalEvent&&3===e.originalEvent.which;if(n&&s){const o=s?s.cell:null;if(o.row.filterRow||t._closeMenu(t.filterRowMenu),i&&o&&!o.column.rowDetailColumn&&i!==o.row.toggleDetailButton&&!i.classList.contains("row-detail"))n.row.toggle(e);else if(t.rowDetail.enabled&&t.rowDetail.visible&&i&&o&&o.column.rowDetailColumn&&!g){const e=n.row;if(t._overlay||e.header&&"row-resize"===e.header.style.cursor||e.header&&"row-resize"===e.header.parentElement.style.cursor)return;t.editing.isEditing&&t.cancelEdit(),e.showDetail?t.hideDetail(e.id):t.showDetail(e.id)}else if(d){const e=n.row,o=e.data;let l=o.parent;const a={};for(a[o.groupDataField]=null!==e.label?e.label:null,void 0!==e.labelValue&&(a[o.groupDataField]=e.labelValue);l;){let e=null!==l.label?l.label:null;l.labelValue&&void 0!==e&&(e=l.labelValue),a[l.groupDataField]=e,l=l.parent}t.addRow(a),setTimeout((()=>{t._conditionalColors&&t._conditionalColors.update&&t._conditionalColors.update()}),100)}else{const o=n.row,l=s?s.cell:null;if(l.column._treeColumn&&r)return void(o.checked=!o.checked);l.element===o.header&&t.behavior.allowRowReorder&&t._beginDrag(e,o),t._tapTimer&&clearTimeout(t._tapTimer),t._tapTimer=setTimeout((function(){t._clickedRow===n&&t.$.fireEvent("rowTap",{row:o,id:o.id,originalEvent:e.originalEvent}),t._clickedCell===s&&t.$.fireEvent("cellTap",{cell:l,id:o.id,dataField:l.column.dataField,originalEvent:e.originalEvent})}),t.behavior.doubleClickTimingDelay);const a=function(a){if(!t.selection.enabled||o.autoGenerated||!0!==o.allowSelect)return void delete t.__selectionStarted;if(t._overlay||o.header&&"row-resize"===o.header.style.cursor||o.header&&"row-resize"===o.header.parentElement.style.cursor)return;if(o.header&&"row-resize"===o.header.style.cursor){const a=t.offset(o.header);if(t._rowToResize&&a.left<=e.originalEvent.pageX&&e.originalEvent.pageX<=a.left+o.header.offsetWidth)return o.header.style.cursor="",void(t._rowToResize.onpointerup=()=>{const a=t.editing.isEditing;t._rowToResize&&(t._rowToResize.onpointerup=null),t._clickedRow===n&&!a&&!t._rowResizeLine&&l.column.rowHeaderColumn&&t.selection.allowRowHeaderSelection&&t._setSelection(o.id,l.column.dataField,e)});o.header.style.cursor=""}const i=t.editing.isEditing;if(i&&t.editing.editCell&&t.editing.editCell.row.id===o.id&&t.editing.editCell.column.dataField===l.column.dataField)return;if(i&&t.editing.editRow&&t.editing.editRow.id===o.id)return;const r=()=>{t.focus(),setTimeout((function(){t.focus()}),50)};if(t.selection.action===a){if(e.shiftKey||e.ctrlKey||e.metaKey||!t.selection.allowRowHeaderSelection&&l.column.autoGenerated?t._dragSelectionStartRow=null:t._dragSelectionStartRow=n.row,e.shiftKey||e.ctrlKey||e.metaKey?t._dragSelectionStartDataField=null:t._dragSelectionStartDataField=l.column.dataField,l.column.rowHeaderColumn&&!t.selection.allowRowHeaderSelection)return t._dragSelectionStartRow=null,void r();t._setSelection(o.id,l.column.dataField,e),r()}else(l.column.selectionColumn&&t.selection.checkBoxes.enabled&&t.selection.checkBoxes.action===a||l.column.rowHeaderColumn&&t.selection.allowRowHeaderSelection)&&(t._setSelection(o.id,l.column.dataField,e),r())},i=l.selected;t._clickTime||(t._clickTime=new Date);const d=t._clickedCell===s&&new Date-t._clickTime<t.behavior.doubleClickTimingDelay,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){t.contextMenu.id=o.id,t.contextMenu.dataField=l.column.dataField;const e=t.getSelectedCells();let a=!0;if(t.contextMenu.dataField&&!t.contextMenu.dataField.startsWith("_"))if(e.length){for(let t=0;t<e.length;t++){const n=e[t],i=n[0],r=n[1];if(""+i==""+o.id&&l.column.dataField===r){a=!1;break}}t._focusCell(o.id,l.column.dataField,a),a&&t._selectCellsRange(o,o,l.column.dataField,l.column.dataField)}else{const e=t.getSelectedRowIds();(0===e.length||e.length>1)&&(t._focusCell(o.id,l.column.dataField),t._selectCellsRange(o,o,l.column.dataField,l.column.dataField))}else t._copyRects&&t._copyRects.length&&t.clearSelection(),t.selectRow(o.id);return t.openContextMenu(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())}}}showDetail(e){const t=this.rowById[e];t&&(t.showDetail=!0)}hideDetail(e){const t=this.rowById[e];t&&(t.showDetail=!1)}_focusHandler(){this._focused=!0,this.setAttribute("focus","")}_blurHandler(){this._focused=!1,this.removeAttribute("focus")}_notify(e,t,o){const l=this;if(l.notifyFn)for(let a=0;a<l.notifyFn.length;a++)l.notifyFn[a](e,t,o)}notify(e){const t=this;e&&(t.notifyFn||(t.notifyFn=[]),t.notifyFn.push(e))}_applyTemplate(e,t){let o=null;if(null!==e&&""!==e)if(e&&"function"==typeof e)e(t);else if((e.startsWith("#")||e.startsWith("."))&&(o=document.querySelector(e)),o)t.innerHTML="",o instanceof HTMLElement&&!(o instanceof HTMLTemplateElement)?t.appendChild(o):t.appendChild(o.content.cloneNode(!0).firstElementChild);else{const o=function(e){const t=document.createElement("template");return e=e.trim(),t.innerHTML=e,t.content.firstChild}(e);o&&(t.innerHTML="",t.appendChild(o))}else t.innerHTML=""}refreshRelations(){const e=this;if(e.dataSourceSettings&&e.dataSourceSettings.relations&&e.dataSourceSettings.relations.length){for(let t=0;t<e.columns.length;t++){const o=e.columns[t];"dropdownGrid"===o.template&&(o._isDirty=!0)}e._recycle(!1);for(let t=0;t<e.columns.length;t++){const o=e.columns[t];"dropdownGrid"===o.template&&delete o._isDirty}}}propertyChangedHandler(e,t,o){const l=this;if(l.isInitialized)if("object"!=typeof e){switch(l._notify(e,t,o),e){case"dataSourceSettings_relations":return void l.refreshRelations();case"onRowHistory":case"onRowInserted":case"stateSettings_current":return;case"highlighted":"kanban"===l.view&&l._kanban?(l._kanban.selectTask(o),l._kanban.ensureVisible(o)):"scheduler"===l.view&&l._scheduler&&l._scheduler.focusEvent(o);break;case"view":return void(l.$.headerBar&&l.$.headerBar._setView&&l.$.headerBar._setView(o,!0));case"users":case"currentUser":l._refreshCurrentUser(),l._recycle();break;case"summaryRow_visible":{for(let e=0;e<l.columns.length;e++)l._summaryRowCount=Math.max(l._summaryRowCount,l.columns[e].summary.length);const e=l.onRowInserted;l.onRowInserted=null,l._renderRows(!0),l.onRowInserted=e;break}case"conditionalFormatting":return l._renderConditionalFormatting(),void l.refresh();case"appearance_displayLoadingIndicator":return 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&&(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,l._isUpdating&&l.endUpdate(),"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}l.beginUpdate();const a=l._sortedColumns;l._sortedColumns&&l._sortedColumns.length>0&&void 0===l._getId()&&l.clearSort();for(let e=0;e<o.length;e++){const t=o[e],a=l.dataSource[e]?l.dataSource[e].$.id:e;l._updateRow(a,t,!0)}delete l.__autoRowHeight,l._virtualOnExpandCache=[],l._cellsMerge=[],l._cellStyles=[];const n=l._filters;if(l.clearSort(),l.filtering.filterRow)for(let e=0;e<l.columns.length;e++)l.columns[e]._filterEditorInitialized=!1;for(let e=0;e<l.columns.length;e++)delete l.columns[e]._cellsCachedValues;if(a&&l._refreshSort(a),n&&n.length>0&&(l._filters=null,l.refreshFilters()),l.grouping.enabled)for(let t in e)l._expandCollapseGroup(t,!0);l.endUpdate()})),l._cachedDataSource=o,void(l.header.visible&&""===l.header.template&&l.$.headerBar._init(l))}}return l.dataSource&&l.dataSource.length>1e4?(l.appearance.displayLoadingIndicator=!0,l._setLoadingIndicatorVisibility(),setTimeout((()=>{l.dataBind()}),100),setTimeout((()=>{l.appearance.displayLoadingIndicator=!1,l._setLoadingIndicatorVisibility(),l._recycle(!1)}),200)):(l.dataSource&&l.dataSource instanceof Smart.DataAdapter&&l.columns&&l.dataSource.dataFields&&l.dataSource.dataFields.forEach((e=>{const t=l.columnByDataField[e.name];t&&(t.dataType=e.dataType)})),l.dataBind()),void(l.header.visible&&""===l.header.template&&l.$.headerBar._init(l));case"rowDetail_dialog_width":case"rowDetail_dialog_height":case"rowDetail_dialog_enabled":case"rowDetail_dialog_visible":return;case"rowDetail_height":case"rowDetail_enabled":{l.beginUpdate(),l.rows.canNotify=!1;const e=l.appearance.allowRowDetailToggleAnimation;l.appearance.allowRowDetailToggleAnimation=!1;for(let e=0;e<l._recyclingRows.length;e++){const t=l._recyclingRows[e];t.height=null,t.setProperty("showDetail",!1),t.detailHeight=l.rowDetail.height}if(l.rows.canNotify=!0,l.rowDetail.enabled){let t=!1;for(let e=0;e<l.viewColumns.length;e++)if(l.viewColumns[e].rowDetailColumn){t=!0;break}if(!t)return l.appearance.allowRowDetailToggleAnimation=e,l.endUpdate(),void l._renderColumns(!0)}else for(let e=0;e<l.viewColumns.length;e++){const t=l.viewColumns[e];if(t.rowDetailColumn){t.visible=!1;break}}return l.appearance.allowRowDetailToggleAnimation=e,void l.endUpdate()}case"rowDetail_visible":for(let e=0;e<l.viewColumns.length;e++){const t=l.viewColumns[e];if(t.rowDetailColumn){t.visible=o;break}}return;case"displayLoadingIndicator":return void l._setLoadingIndicatorVisibility();case"filterable":return void l._refreshLayout();case"layout_allowCellsWrap":{const e=l.columns.canNotify;l.columns.canNotify=!1;for(let e=0;e<l.columns.length;e++)l.columns[e].cellsWrap=o;return l.layout.isDirty=!0,l._resetCachedLayout(),l._refreshLayout(),l.refresh(),void(l.columns.canNotify=e)}case"showViewBar":return l.layout.isDirty=!0,l._resetCachedLayout(),l._refreshLayout(),void l.refresh();case"layout_autoHeight":case"layout_autoWidth":case"layout_columnMinHeight":case"layout_rowMinHeight":case"layout_columnHeight":case"layout_rowHeight":return l.layout.isDirty=!0,l._resetCachedLayout(),l._refreshLayout(),void l.refresh();case"rightToLeft":return void l.refresh();case"selectionMode":return;case"editing_addNewColumn_visible":l._addNewColumn?(l._addNewColumn.visible=o,l.refresh()):l._renderColumns();break;case"editing_addNewRow_displayMode":{"row"===l.editing.addNewRow.displayMode&&l.editing.addNewRow._addButton&&(l.editing.addNewRow._addButton.remove(),delete l.editing.addNewRow._addButton);const e=l._scrollView.vScrollBar;return e.style.height="",e.style.top="",e.style.setProperty("--smart-scroll-bar-near-size","0px"),l._renderAddNewRow(),void l.refresh(!0)}case"editing_addNewRow_label":case"editing_addNewRow_visible":case"editing_addNewRow_position":return!1===l.editing.addNewRow.visible&&"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()}else l.render()}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._details=[],e.checkLicense()}_createFilterPanels(){const e=this;if(e._filterPanels){if(e._filterPanels.length>0)return}else e._filterPanels=[];if(e.filtering.enabled&&0===e._filterPanels.length){if(e.header.visible&&e.header.buttons.indexOf("filter")>=0)return;requestAnimationFrame((()=>{const t=document.createElement("smart-filter-panel"),o=document.createElement("smart-filter-panel"),l=document.createElement("smart-filter-panel"),a=document.createElement("smart-filter-panel");o.filterType="boolean",l.filterType="numeric",a.filterType="date",e._filterPanels.bool=o,e._filterPanels.date=a,e._filterPanels.numeric=l,e._filterPanels.string=t;for(let t in e._filterPanels){const o=e._filterPanels[t];o.rightToLeft=e.rightToLeft,o.classList.add("smart-hidden"),e.$.content.appendChild(o),o.parentNode.removeChild(o)}}))}}_applyScrolling(){const e=this,t=e._scrollView.vScrollBar;requestAnimationFrame((()=>{switch(t.largeStep=e.$.scrollView.offsetHeight,e.scrolling){case"physical":case"infinite":case"virtual":t.step=e.layout.rowMinHeight,t.mechanicalAction="switchWhileDragging";break;case"deferred":t.step=10,t.mechanicalAction="switchWhenReleased";break;case"logical":t.step=e.layout.rowMinHeight,t.mechanicalAction="switchWhileDragging"}}))}_measureRowElement(e){const t=new Smart.Grid.Row({data:e,index:999999,grid:this});if(!t)return null;const o=t.createElement();return o.classList.add("smart-grid-measure-row"),this.$.scrollView.appendChild(o),o.style.height="",o.style.lineHeight="",o.style.height="",o.style.lineHeight="",t._isMeasureRow=!0,t.render(),o}get _autoRowHeight(){const e=this;if(e.__autoRowHeight)return e.__autoRowHeight;let t=e.layout.rowMinHeight;if(!e.dataSource||e.dataSource&&0===e.dataSource.length)return t;const o=new Smart.Grid.Row({index:0,grid:e}),l=o.createElement();e.$.scrollView.appendChild(l),e.removeAttribute("grouped"),e.removeAttribute("tree"),e.grouping.enabled&&e.dataSource.groupBy&&e.dataSource.groupBy.length>0?e.setAttribute("grouped",""):e.dataSource.boundHierarchy&&e.setAttribute("tree","");const a={};if(e.dataSource.dataFields)for(let t=0;t<e.dataSource.dataFields.length;t++)a[e.dataSource.dataFields[t].name]="ABCDEFHIJLMNOPQRSTUVWXYZ1234567910|";o.data=a,o._isMeasureRow=!0,o.render(),l.style.height="",l.style.lineHeight="",t=Math.max(l.offsetHeight,t);for(let e=0;e<l.children.length;e++)l.children[e].style.height="";for(let a=0;a<l.children[1].children.length;a++){if(l.children[1].children[a].style.height="auto",e.columns[0]){const t=o.getCell(e.columns[0].dataField);t&&t.render()}t=Math.max(t,8+l.children[1].children[a].offsetHeight);break}return e.$.scrollView.removeChild(l),e.__autoRowHeight=t,e.layout.rowMinHeight&&t<e.layout.rowMinHeight&&(e.__autoRowHeight=e.layout.rowMinHeight),t}get _scrollHeight(){const e=this,t="card"===e.view;let o=e._recyclingRows,l=0,a=e._autoRowHeight,n=0,i=0;if(e.__scrollHeight)return e.__scrollHeight;if(0===o.length||0===e.columns.length||!e.hasVisibleColumn())return 0;let r=40,s=1,d=0;if(t){for(let t=0;t<e.viewColumns.length;t++){const o=e.viewColumns[t];o.visible&&!o.autoGenerated&&(r+=e.layout.cardRowMinHeight,d++,o.cardHeight&&(r-=e.layout.cardRowMinHeight,r+=o.cardHeight*e.layout.cardRowMinHeight))}let t=e.offsetWidth;!e.appearance.showViewBar||e.appearance.viewBarAppendTo||e.appearance.showViewBarAsDropdown||(t-=e.layout.viewBarWidth+5),s=t<e.layout.cardMinWidth?1:"auto"===e.layout.cardsPerRow?Math.floor(t/e.layout.cardMinWidth):e.layout.cardsPerRow,1===s&&(r+=5*d),e._cardHeight=r}e._cardsPerRow=s,e.rows.canNotify=!1;const 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._autoHeight&&e.paging.enabled&&(e._overflowOffset=Math.max(o,e.paging.pageSize*e.layout.rowMinHeight)),e.rightToLeft?(e.$.rowNearContainer.classList.remove("near"),e.$.rowNearContainer.classList.add("far"),e.$.rowFarContainer.classList.remove("far"),e.$.rowFarContainer.classList.add("near")):(e.$.rowFarContainer.classList.remove("near"),e.$.rowFarContainer.classList.add("far"),e.$.rowNearContainer.classList.remove("far"),e.$.rowNearContainer.classList.add("near"));const l=e.offsetHeight;e.$.container.classList.add("smart-hidden");const a=e.offsetHeight;e.$.container.classList.remove("smart-hidden"),"hidden"!==e.verticalScrollBarVisibility&&l===a||(o=e._scrollHeight);const n=function(){const l=document.createDocumentFragment();if(e.rows&&0===e.rows.length)return;for(let a=0;a<e.rows.length;a++){const n=e.rows[a];if(n.freeze&&n.visible)continue;const i=n.createElement();if(l.appendChild(i),t+=e.layout.rowMinHeight,t>e._overflowOffset+o)break}e.$.rowContainer.appendChild(l);const a=e.$.rowContainer.children;for(let t=0;t<a.length;t++){const o=a[t];e.rows[t]&&(e.rows[t].element=o),e._rowElements[t]=o}};for(let t=0;t<e._frozenNearRows.length;t++){const o=e._frozenNearRows[t];o.grid=e;const l=o.createElement();o.element=l,e.$.rowNearContainer.appendChild(l)}for(let t=0;t<e._frozenFarRows.length;t++){const o=e._frozenFarRows[t];o.grid=e;const l=o.createElement();o.element=l,e.$.rowFarContainer.appendChild(l)}n();let i=0;for(;t<1.5*o&&++i<50;)n();e.rows.canNotify=!0}_refreshSummary(e){const t=this;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&&a.summary&&a.summary.length>0&&(o=!0,n[a.dataField]=a.summary,t.push(n))}if(!o)return void(e._summaryItems=[]);const l=e.getSelectedRowIds();if(l.length>=1){const o=[];for(let t=0;t<l.length;t++){const a=e.dataSource.dataItemById[l[t]];a&&o.push(a)}e._summaryItems=e.dataSource.summarize(t,o)}else if(e._selection&&e._selection.cells&&Object.keys(e._selection.cells).length>2){const o=e.getSelectedCells(!1),l=[],a=[];for(let t=0;t<o.length;t++){const n=o[t],i=n[0],r=e.dataSource.dataItemById[i];-1===l.indexOf(r)&&l.push(r),-1===a.indexOf(n[1])&&a.push(n[1])}e._summaryItems=e.dataSource.summarize(t,l);const n=Object.keys(e._summaryItems);for(let t=0;t<n.length;t++){const o=n[t];-1===a.indexOf(o)&&delete e._summaryItems[o]}}else e._summaryItems=e.dataSource.summarize(t)};e._calculateSummary=a;const n=e.columns?e.columns.filter((e=>void 0!==e.getCellValue)):[],i=function(a,i,r){let s=null;if(e.isInitialized&&(o=new Date),s=a?a.grid?a:new Smart.Grid.Row({data:a,index:i,grid:e,createdBy:l,createdDate:o}):new Smart.Grid.Row({data:{},index:i,grid:e,createdBy:l,createdDate:o}),n)for(let e=0;e<n.length;e++){const t=n[e],o=t.getCellValue(s.id,t.dataField,a);void 0!==o&&(s.data[t.dataField]=o)}if(e.rowById[s.id]&&(s.id=e.rows.length,e.rowById[s.id])){const e=function(){return(65536*(1+Math.random())|0).toString(16).substring(1)};s.id=e()}if(e.onRowInit){e.onRowInit(i,s,e),30!==s.height&&(s.cellHeight=s.height);for(let t in s)-1!==s.properties.indexOf(t)||t.startsWith("_")||e.error(e.localize("invalidRowProperty",{elementType:"Grid",propertyName:t}));e._details[i]=s.showDetail}if(s.selected&&(e._selection.rows[s.id]=!0,e._selection.indexes[s.index]=s.index),s.freeze&&s.visible){if(!0===s.freeze||"near"===s.freeze){e.rows.splice(t++,0,s);const o=e.rows[t-1];-1===e._frozenNearRows.indexOf(o)&&e._frozenNearRows.push(o)}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[i].index=e.rows.length):e.rows.push(s),s.data&&s.data.$&&(s.data.$.history=s.history,s.data.$.starred=s.starred,s.data.$.comments=s.comments,s.data.$.style=s.style);if(!("virtual"===e.scrolling||e.paging.enabled&&e.dataSource&&e.dataSource.virtualDataSource))if(e.onRowInserted){const t=void 0===i?e.rows[e.rows.length-1]:e.rows[i],o=o=>{const l=t;if(void 0!==o&&Array.isArray(o)&&(o=o[0]),void 0===o){if(e.rowById[l.id]){const t=e.dataSource.dataItemById[l.id],o=function(){return(65536*(1+Math.random())|0).toString(16).substring(1)};l.id=o(),l.data&&l.data.$?l.data.$.id=l.id:l.data.id=l.id,e._getId()&&(l.data[e._getId()]=l.id),t&&(e.dataSource.dataItemById[l.id]=l.data)}e.rowById[l.id]=l}else{const t=e.dataSource.dataItemById[l.id];l.id=o,l.data&&l.data.$?l.data.$.id=l.id:l.data.id=l.id;const a=e._getId();a&&(l.data[e._getId()]=l.id),t&&(t[a]=o,e.dataSource.dataItemById[l.id]=t,l.data=t),e.rowById[l.id]=l}-1!==l.index&&void 0!==l.index||(l.index=e.rows.length),e._setAddUndoRedo(l),!e.editing.isEditing&&e.isInitialized&&(e._recycle(!1,!0),e.grouping.groupBy.length&&e.refresh()),e._onRowInserted&&e._onRowInserted(l),r&&r(l)};if(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),t.$&&o.$.pageSizeSelector&&(t.$.pageSizeSelector.disabled=e.dataSource.length<e.pager.pageSizeSelector.dataSource[0])),o&&(o.pagesCount=Math.ceil(e.dataSource.length/e._pageSize),o.$&&o.$.pageSizeSelector&&(o.$.pageSizeSelector.disabled=e.dataSource.length<e.pager.pageSizeSelector.dataSource[0]))}if(0===d&&0===e.columns.length&&e.dataSource.dataFields.length>0){const t=e.context;e.context=e,e.columns.canNotify=!1,e.columns=[],e._renderColumns(),e._resetCachedLayout(),e.columns.canNotify=!0,e.context=t}e._initializeRows(),e._initializeRowElements(),e.refresh()}e._recycle(),e.onLoad&&(e.onLoad(),delete e.onLoad)}}a(),("update"!==t.action||l)&&e._refreshLayout(),e._recycle(),e.rows.canNotify=!0})),e._observeRows(),e.summaryRow.visible){const t=new Smart.Grid.Row({height:e.layout.rowMinHeight,freeze:"near",visible:"near"===e.summaryRow.position,summaryRowIndex:0,summaryRow:!0}),o=new Smart.Grid.Row({height:e.layout.rowMinHeight,freeze:"far",visible:"far"===e.summaryRow.position,summaryRowIndex:0,summaryRow:!0});"near"===e.summaryRow.position&&e._frozenNearRows.splice(0,0,t),"far"===e.summaryRow.position&&e._frozenFarRows.push(o)}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.dataSource.id&&o===e.dataSource.id||e.dataSource.keyDataField&&o===e.dataSource.keyDataField||e.dataSource.parentDataField&&o===e.dataSource.parentDataField||e.columnByDataField[o]||delete l.data[o]}void 0!==e.dataSource[o].$.id&&(l.id=e.dataSource[o].$.id,e.rowById[l.id]=l),l.data.$&&l.history&&(l.data.$.history=l.history)}-1!==l.index&&void 0!==l.index||(l.index=o),l.selected&&(e._selection.rows[l.id]=!0,e._selection.indexes[l.index]=l.index),l.freeze&&(!0===l.freeze||"near"===l.freeze?e._frozenNearRows.push(l):"far"===l.freeze&&e._frozenFarRows.push(l)),e._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();if(o.allowDrag=!1,o.classList.add("smart-grid-drop-down-popup"),e.$.dropDownElement=t,e.$.dropDownPopup=o,t.onmouseenter=()=>{t.hasAttribute("active")||t.setAttribute("hover","")},t.onmouseleave=()=>{t.removeAttribute("hover")},t.classList.add("smart-grid-drop-down-button","smart-drop-down-box"),e.parentNode.insertBefore(t,e),t.innerHTML=`<div class="smart-container" role="presentation">\n <div class="smart-content" role="presentation">\n <div class="smart-buttons-container" role="presentation">\n <span class="smart-action-button">${e.localize("dropDownPlaceholder")}</span>\n <span class="smart-drop-down-button">\n <span class="smart-drop-down-button-icon" id="arrow" aria-hidden="true"></span>\n </span>\n </div>\n </div>\n </div>`,t.onclick=()=>{o.classList.contains("open")?e.closeDropDown():e.openDropDown()},e.style.height="100%",e.style.width="100%",o.content.appendChild(e),e._cellsMerge=[],e._cellStyles=[],!e._popupDropDown){e._popupDropDown=o,o._refreshPosition=()=>{const l=e.offset(t),a=t.offsetHeight,n=e.offset(e);if(o.style.maxHeight="",o.style.minHeight="",l.top+a+o.offsetHeight>window.innerHeight-n.top){const e=a+l.top+o.offsetHeight-window.innerHeight+n.top;o.style.maxHeight=Math.max(250,o.offsetHeight-e)+"px",o.style.minHeight="250px"}else o.style.maxHeight="",o.style.minHeight=""};const l=()=>{if(e.selection.enabled){const o=e._selection.focusedCell;if(o){const l=e.getCellValue(o.id,o.dataField);if(t.querySelector(".smart-action-button").innerHTML=l,e.selection.enabled&&e.selection.allowCellSelection){const l=e.getCellValue(o.id,e.dropDownModeDataField);t.querySelector(".smart-action-button").innerHTML=l}}}};o.onOpen=function(){e._popupDropDown._refreshPosition(),e.$.fireEvent("dropDownGridOpen"),e.$.listen("cellClick",l)},o.onClose=function(){if(e.$.unlisten("cellClick"),e.selection.enabled){const o=e._selection.focusedCell;if(o){const l=e.getCellValue(o.id,o.dataField);if(t.querySelector(".smart-action-button").innerHTML=l,e.selection.enabled&&e.selection.allowCellSelection){const l=e.getCellValue(o.id,e.dropDownModeDataField);t.querySelector(".smart-action-button").innerHTML=l}}}e.$.fireEvent("dropDownGridClose")},o.onkeydown=function(e){"Escape"===e.key&&(o.result=!1,o.close())}}}}render(){const e=this,t=()=>0===e.offsetWidth||0===e.offsetHeight;if(t())return requestAnimationFrame((()=>{e.isInitialized||t()||(e._undoRedo=[],e._refreshCurrentUser(),e._render())})),e.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.rowMobileHeight&&(e.layout.rowMinHeight=e.layout.rowHeight=e.layout.columnMinHeight=e.layout.columnHeight=e.layout.rowMobileHeight),e.behavior.rowResizeMode="none",e.behavior.allowRowReorder=!1,e._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="SmartGrid"+e.id,o=e.stateSettings.current);let l=null;e.stateSettings.storage&&(l=e.stateSettings.storage[o]),l&&(t=!0),!l&&e.stateSettings.allowLocalStorage&&(l=window.localStorage.getItem(o),l&&(t=!0))}if(!t){const t=[];for(let o=0;o<e.viewColumns.length;o++){const l=e.viewColumns[o];l.allowSort&&l.sortOrder&&t.push(l)}if(0===t.length&&e.sorting.sort)for(let o=0;o<e.sorting.sort.length;o++){const l=e.sorting.sort[o],a=Object.keys(l)[0],n=l[a],i=e.columnByDataField[a];i&&(t.push(i),i.sortOrder=n||"asc")}t.sort(((e,t)=>e.sortIndex-t.sortIndex));for(let o=0;o<t.length;o++){const l=t[o],a=e.appearance.allowSortAnimation;e.appearance.allowSortAnimation=!1,e.sortBy(l.dataField,l.sortOrder),e.appearance.allowSortAnimation=a}if(e.filtering.filter.length>0){for(let t=0;t<e.filtering.filter.length;t++){const o=e.filtering.filter[t];if(o){if("string"==typeof o){const t=e.filtering.filter[0],o=e.columnByDataField[t],l=e.filtering.filter[1];let a=null;if(o&&(a=e.dataSource._createFilter(o.dataType,l)),a){if(e.filtering.filterRow.visible&&!o._filterInfo){let e=[];for(let t=0;t<a.filters.length;t++)e.push(a.filters[t].value),t<a.filters.length-1&&e.push(a.logicalOperators[t]);o._filterInfo={condition:a.filters[0].condition,value:e.join(" ")}}e.addFilter(t,a,!1)}break}const t=o[0],l=o.splice(1);let a=null;if(l instanceof Smart.FilterGroup)a=l;else{const o=e.columnByDataField[t];o&&(a=e.dataSource._createFilter(o.dataType,l))}if(a){if(e.filtering.filterRow.visible){const o=e.columnByDataField[t];if(!o._filterInfo){let e=[];for(let t=0;t<a.filters.length;t++)e.push(a.filters[t].value),t<a.filters.length-1&&e.push(a.logicalOperators[t]);o._filterInfo={condition:a.filters[0].condition,value:e.join(" ")}}}e.addFilter(t,a,!1)}}}e.refreshFilters()}else{for(let t=0;t<e.columns.length;t++){const o=e.columns[t];if(o.filter){let t=null,l=o.filter;if(t=l instanceof Smart.FilterGroup?l:e.dataSource._createFilter(o.dataType,l),t){if(e.filtering.filterRow.visible&&!o._filterInfo){let e=[];for(let o=0;o<t.filters.length;o++)e.push(t.filters[o].value),o<t.filters.length-1&&e.push(t.logicalOperators[o]);o._filterInfo={condition:t.filters[0].condition,value:e.join(" ")}}e.addFilter(o.dataField,t,!1)}}}e.refreshFilters()}}}if(e.viewColumns.canNotify=!0,e.isInitialized=!0,("virtual"===e.scrolling||e.paging.enabled&&e.dataSource&&e.dataSource.virtualDataSource||e.dataSource&&e.dataSource.virtualDataSource)&&e._virtualDataRequest("dataBind"),""!==e.header.template&&e._applyTemplate(e.header.template,e.$.header),""!==e.footer.template&&e._applyTemplate(e.footer.template,e.$.footer),e._createFilterPanels(),e._refresh(),e._applyScrolling(),e.grouping.enabled&&e.grouping.autoExpandAll&&e.rowHierarchy?e.expandAllRows():e.grouping.enabled&&e.grouping.autoExpandToLevel&&e.rowHierarchy&&e.expandRowsToGroupLevel(e.grouping.autoExpandToLevel),e.onRender&&(e.onRender(t),e.onRender=null),e.isRendered=!0,"auto"===e.layout.rowHeight&&(e._refreshLayout(),e._recycle()),t){if(e.stateSettings.autoLoad){let t=e.stateSettings.current,o=null;e.stateSettings.storage&&(o=e.stateSettings.storage[t]),!t&&e.stateSettings.allowLocalStorage&&(e.stateSettings.current="SmartGrid"+e.id,t=e.stateSettings.current),!o&&e.stateSettings.allowLocalStorage&&(o=window.localStorage.getItem(t)),o&&("string"==typeof o&&(o=JSON.parse(o)),e._loadState(o))}if(e.onAfterInit&&(e.onAfterInit(e),e.onAfterInit=null),e.$.fireEvent("afterInit",{grid:e}),e.isRendering=!1,e.whenRenderedCallbacks){for(let t=0;t<e.whenRenderedCallbacks.length;t++)e.whenRenderedCallbacks[t]();e.whenRenderedCallbacks=[]}!e.dataSource||e.dataSource.url||e.dataSource.virtualDataSource||e.onLoad&&e.onLoad(e)}"kanban"===e.view?e._initKanbanView():"scheduler"===e.view&&e._initSchedulerView()}_initFormulaParser(){const e=this;if(e.formulas){class t{constructor(e){const t=this;let o;try{o=new formulaParser.Parser}catch(e){throw new Error("Smart.FormulaParser: Missing reference to 'formula-parser.min.js'.")}o.on("callCellValue",t._callCellValue.bind(t)),o.on("callRangeValue",t._callRangeValue.bind(t)),t.dataTable=e,t.parser=o}_getFormula(e){const t=this,o="A".charCodeAt(0);let l=0,a="";const n=e;if(t.dataTable._formulas||(t.dataTable._formulas=[]),t.dataTable._formulas[e])return t.dataTable._formulas[e];for(let n=0;n<t.dataTable.columns.length;n++){const i=t.dataTable.columns[n],r=String.fromCharCode(o+l);l++,l>=26&&(l=0,a+="A"),e.indexOf(i.label)>=0?e=e.replaceAll(i.label,a+r):e.indexOf(i.dataField)>=0&&(e=e.replaceAll(i.dataField,a+r))}return t.dataTable._formulas[n]=e,e}_callCellValue(e,t){const o=this,l=o.dataTable,a=e.column.index,n=e.row.index,i=l.columns[a].dataField;let r=l.dataSource[n][i];const s=l.rows[n];if(s){const e=s.getCell(i);e&&e.formula&&(r=o._getFormula(e.formula))}"string"==typeof r&&/=.+/.test(r)?r=o.parse(r.slice(1)):"string"==typeof r&&"number"===l.columns[a].dataType&&(r=parseFloat(r)),t(r)}_callRangeValue(e,t,o){const l=this.dataTable,a=l.dataSource,n=[];for(let o=e.row.index;o<=t.row.index;o++){const i=a[o],r=[];for(let o=e.column.index;o<=t.column.index;o++){let e=i[l.columns[o].dataField];e=isNaN(e)?0:parseFloat(e),isNaN(e)&&(e=0),r.push(e)}n.push(r)}n&&o(n)}parse(e){const t=this.parser.parse(this._getFormula(e));return null!==t.result?t.result:t.error}}e._formulaParser=new t(e)}}get _viewRows(){const e=this;if(e.__viewRows)return e.__viewRows;e._nearRowsAdded||(e._nearRowsAdded=[],e._farRowsAdded=[]);const t=e.rows.toArray?e.rows.toArray():[],o=e.rowHierarchy?e.rowHierarchy:t,l=[].concat(e._frozenNearDefaultRows,e._nearRowsAdded,o,e._farRowsAdded,e._frozenFarDefaultRows);return e.__viewRows=l,l}_toHex(e){if(-1!==e.indexOf("#"))return e;const t=/rgb\((\d+), (\d+), (\d+)\)/g.exec(e);return t?"#"+(parseFloat(t[1]).toString(16).padStart(2,"0")+parseFloat(t[2]).toString(16).padStart(2,"0")+parseFloat(t[3]).toString(16).padStart(2,"0")).toUpperCase():"#FFFFFF"}_renderConditionalFormatting(e){const t=this,o=t.conditionalFormatting;if(!o||0===o.length)return;if(!t._defaults){const e=getComputedStyle(t);t._defaults={fontFamily:e.fontFamily,fontSize:e.fontSize,text:t._toHex(e.color),highlight:t._toHex(e.backgroundColor)}}t._formatter||(t._formatter=new Smart.Utilities.ConditionalFormatter(t.dataSource)),e&&(t._formatter=new Smart.Utilities.ConditionalFormatter(t.dataSource),delete t._conditionalFormatting);const l=t._defaults,a=t._formatter,n=[],i=function(e){if("all"===e){if(t.columns&&t.columns.map){const e=[];for(let o=0;o<t.columns.length;o++){const l=t.columns[o];l.dataField.startsWith("task")||l.autoGenerated||"number"!==l.dataType&&"date"!==l.dataType||e.push(l.dataField)}return e}return[]}return[e]};for(let e=0;e<o.length;e++){o[e]=Object.assign({column:"all",condition:"lessThan",firstValue:0,secondValue:1,fontFamily:l.fontFamily,fontSize:l.fontSize,text:l.text,highlight:l.highlight},o[e]);const t=o[e],r=i(t.column),s=t.condition;a.color=t.highlight,a.comparator=t.firstValue,a.min=t.firstValue,a.max=t.secondValue;const d=a.format(s,r);for(let e in d){const o=d[e];for(let e in o){const l=o[e];l.color=t.text,l.fontFamily=t.fontFamily,l.fontSize=t.fontSize}}n.push(d)}if(t._formattingPanel&&(t._formattingPanel.items=o),0===n.length)return n[0];const r={};for(let e=0;e<n.length;e++){const t=n[e];for(let e in t){const o=t[e];if(0!==Object.keys(o).length){r[e]||(r[e]={});for(let t in o)r[e][t]=Object.assign({},r[e][t],o[t])}}}t._conditionalFormatting=r,e&&t._recycle(!1)}_stickHeader(){const e=this;e._stickyHeaderHandler=function(){e._handleStickyHeader()},e.$.columnHeader.style.top="",e.$.columnHeader.classList.remove("smart-columns-sticky");let t=e.parentNode;for(e.isInShadowDOM&&t===e.getRootNode()&&(t=e.getRootNode().host);t!==document&&t;)t.addEventListener("scroll",e._stickyHeaderHandler),t=t.parentNode,e.isInShadowDOM&&t===e.getRootNode()&&(t=e.getRootNode().host);try{null!==window.top&&window.top!==window.self&&window.top.document.addEventListener("scroll",e._stickyHeaderHandler)}catch(e){}e._handleStickyHeader()}_unstickHeader(){const e=this;e.$.columnHeader.style.top="",e.$.columnHeader.classList.remove("smart-columns-sticky");let t=e.parentNode;for(;t!==document.body;)t.removeEventListener("scroll",e._stickyHeaderHandler),t=t.parentNode,e.isInShadowDOM&&t===e.getRootNode()&&(t=e.getRootNode().host);try{(""!==document.referrer||window.frameElement)&&null!==window.top&&window.top!==window.self&&window.top.document.removeEventListener("scroll",e._stickyHeaderHandler)}catch(e){}}_handleStickyHeader(){const e=this;if(e.appearance.allowColumnStickyPosition)if(e.$.columnHeader.classList.add("smart-columns-sticky"),0===document.scrollTop&&0===e.parentElement.scrollTop)e.$.columnHeader.style.top="";else{let t=e.parentNode,o=0;for(;t!==document.body;)o+=parseInt(t.scrollTop),t=t.parentNode,e.isInShadowDOM&&t===e.getRootNode()&&(t=e.getRootNode().host);const l=parseInt(e.clientTop+o);e.$.columnHeader.style.top=l+"px";let a=0;window.top!==window.self&&parseInt(window.top.scrollY)>parseInt(e._offsetTop(window.frameElement))&&(a=parseInt(window.top.scrollY)-parseInt(e._offsetTop(window.frameElement))),window.scrollY+a>e.offsetTop&&(e.$.columnHeader.style.top=parseInt(window.scrollY)-parseInt(e.offsetTop)+l+a+"px")}}_scrollHandler(){this._handleStickyHeader()}_initializeRowNumberColumn(){const e=this;if(e._frozenNearColumns&&e._frozenNearColumns.length>0&&e._frozenNearColumns[0].rowHeaderColumn)return void(e._frozenNearColumns[0].visible=e.appearance.showRowHeaderNumber||e.appearance.showRowHeader);const t=new Smart.Grid.Column({dataField:"_rowHeaderColumn",label:"",allowSelect:!1,freeze:!0,visible:!0,grid:e,autoGenerated:!0,rowHeaderColumn:!0,cellsAlign:"center"}),o=e.rows?e.rows.length:e.dataSource?e.dataSource.length:0;let l=e.appearance.showRowHeaderNumber?t._measureSize(o):30;e.layout.autoGenerateColumnWidth&&(l=e.layout.autoGenerateColumnWidth),e.appearance.showRowComments&&(l=25,t.minWidth=25),t.width=l,t.createElement();const a=new Smart.Observable(t,t.observables);e.viewColumns.splice(0,0,a),e._frozenNearColumns.splice(0,0,a)}_initializeColumns(){const e=this;if("number"==typeof e.columns){const t=[],o="A".charCodeAt(0);let l="",a=0;for(let n=0;n<e.columns;n++){let i=n+1;const r=String.fromCharCode(o+a);a++;const s=l+r;"number"!==e.appearance.autoGenerateColumnLabelMode&&(i=l+r),t.push({align:"center",label:i,dataField:s,width:100}),a>=26&&(a=0,l+="A")}e._boundColumns=t}else e._boundColumns=Array.isArray(e.columns)?[...e.columns]:[...e.columns.toArray()];e._initColumns=e.columns,e.columnByDataField=[],e.viewColumns=[],e.columns=new Smart.ObservableArray,e._frozenFarColumns=[],e._frozenNearColumns=[],e._summaryRowCount=1;let t=0;const o=function(t){if(e.dataSource.dataFields){const o=e.dataSource.dataFields.find((e=>{if(e.name===t.dataField)return e})),l=o&&o.dataType||"string";t.dataType||(t.dataType=l)}};if(0===e._boundColumns.length&&e.dataSource&&e.dataSource[0]&&!1!==e.dataSource.autoGenerateColumns){const t=e.dataSource[0];if(t.$&&t.$.isEmpty&&e.dataSource.dataFields)for(let t=0;t<e.dataSource.dataFields.length;t++){const o=e.dataSource.dataFields[t],l=e._boundColumns.length,a={index:l,visibleIndex:l,label:o.name,dataField:o.name,dataType:o.dataType};e._boundColumns.push(a)}else for(let l in t){if(l.startsWith("_")||"$"===l)continue;const t=e._boundColumns.length,a={index:t,visibleIndex:t,label:l,dataField:l};o(a),e._boundColumns.push(a)}}for(let l=0;l<e._boundColumns.length;l++){let a=e._boundColumns[l];if("string"==typeof a){if(e.dataSource.dataFields){const t=e.dataSource.dataFields.find((e=>{if(e.name===a)return e}));a={label:a,dataField:a,dataType:t&&t.dataType||"string"}}}else o(a);a.visibleIndex=l,a.index=l,a.grid=e,a.label&&/<.+?>/.test(a.label)&&a.label.replace&&("all"===e.dataSourceSettings.sanitizeHTML?a.label=a.label.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/'/g,"&#39;").replace(/"/g,"&quot;"):"blackList"===e.dataSourceSettings.sanitizeHTML&&(a.label=window.Smart.Utilities.Core.escapeHTML(a.label)));const n=new Smart.Grid.Column(a);e.onColumnInit&&e.onColumnInit(l,n);for(let t in n)-1!==n.properties.indexOf(t)||t.startsWith("_")||e.error(e.localize("invalidColumnProperty",{elementType:"Grid",propertyName:t,type:n.dataField||"Column"}));delete a.grid,delete a.dataType,delete a.index,delete a.visibleIndex,n.grid=e,e.columns.push(n),n._dataField&&(e.columnByDataField[n._dataField]=n);const i=e.columns[e.columns.length-1];e._summaryRowCount=Math.max(e._summaryRowCount,n.summary.length),n.freeze?!0===n.freeze||"near"===n.freeze?(e.viewColumns.splice(t++,0,i),e._frozenNearColumns.push(i)):"far"===n.freeze&&e._frozenFarColumns.push(i):e.viewColumns.push(i),e.columnByDataField[n.dataField]?(i.parent=e.columnByDataField[n.dataField],e.columnByDataField[n.dataField].children||(e.columnByDataField[n.dataField].children=[]),e.columnByDataField[n.dataField].children.push(i),n.valueField=n.dataField,n.dataField+="_"+e.columnByDataField[n.dataField].children.length,n.displayField=n.valueField,e.columnByDataField[n.dataField]=i):e.columnByDataField[n.dataField]=i,e.onColumnInserted&&!e.isInitialized&&e.onColumnInserted(l,n.getState())}e.viewColumns=e.viewColumns.concat(e._frozenFarColumns),e.setAttribute("aria-colcount",e._boundColumns.length);let l=0;if((e.appearance.showRowHeaderNumber||e.appearance.showRowHeader)&&(e._initializeRowNumberColumn(),l++),e.rowDetail.enabled){const t=20,o=new Smart.Grid.Column({dataField:"_rowDetailColumn",allowSelect:!1,visible:e.rowDetail.visible,label:"",grid:e,freeze:!0,rowDetailColumn:!0,autoGenerated:!0,cellsAlign:"center",width:t,minWidth:t}),a=new Smart.Observable(o,o.observables);e.rowDetailColumn=a,"near"===e.rowDetail.position?(e.viewColumns.splice(l,0,a),o.freeze="near",a.freeze="near",e._frozenNearColumns.splice(l,0,a)):(e.viewColumns.push(a),e._frozenFarColumns.splice(0,0,a)),l++}const a=new Smart.Grid.Column({dataField:"_adaptiveColumn",allowSelect:!1,visible:!1,label:"",grid:e,freeze:"far",adaptiveColumn:!0,autoGenerated:!0,cellsAlign:"center",width:30});new Smart.Observable(a,a.observables).canNotify=!1;const n=new Smart.Grid.Column({dataField:"_commandColumn",allowSelect:!1,visible:e.editing.enabled&&e.editing.commandColumn.visible&&!e.editing.commandColumn.inline,label:"",grid:e,freeze:"far",commandColumn:!0,autoGenerated:!0,align:"center",cellsAlign:"center",width:""}),i=new Smart.Observable(n,n.observables);i.canNotify=!1,e.editing.commandColumn.visible&&("near"===e.editing.commandColumn.position?(n.freeze="near",i.freeze="near",e.viewColumns.splice(l,0,i),e._frozenNearColumns.splice(l,0,i)):(e.viewColumns.push(i),e._frozenFarColumns.splice(0,0,i))),e._commandColumn=i;const r=new Smart.Grid.Column({allowSelect:!1,visible:e.selection.enabled&&e.selection.checkBoxes.enabled,dataField:"_checkBoxColumn",label:"",freeze:e.selection.checkBoxes.position,grid:e,selectionColumn:!0,autoGenerated:!0,cellsAlign:"center",width:32}),s=new Smart.Observable(r,r.observables);if(e.selection.checkBoxes.enabled&&("near"===r.freeze?(e.viewColumns.splice(l,0,s),e._frozenNearColumns.splice(l,0,s)):(e.viewColumns.push(s),e._frozenFarColumns.splice(0,0,s))),e._selectionColumn=s,e._selectionColumn.canNotify=!1,e.editing.addNewColumn.visible){const t=new Smart.Grid.Column({dataField:"_addNewColumn",allowSelect:!1,visible:!0,title:e.localize("addNewColumn"),label:"",cellsClassName:"smart-add-new-column",className:"smart-add-new-column smart-icon smart-grid-icon show smart-icon-plus",grid:e,adaptiveColumn:!1,autoGenerated:!0,cellsAlign:"center",width:90}),o=new Smart.Observable(t,t.observables);e.viewColumns.push(o),e._addNewColumn=o,e._addNewColumn.canNotify=!1}e._observeColumns(),e._templateColumns()}get styleProperties(){return["grid-template-columns","--smart-grid-row-height","--smart-grid-column-header-height","--smart-grid-group-header-height","--smart-grid-filter-footer-height","--smart-grid-group-row-vertical","--smart-grid-group-row-horizontal-offset","--smart-grid-freeze-splitter-size","--smart-grid-resize-line-size","--smart-grid-footer-height","--smart-grid-header-height"]}_templateColumns(){const e=this,t=getComputedStyle(e),o=t.getPropertyValue("--smart-grid-template-columns").trim();if(e._rowGap=0,e._columnGap=0,e._maxHeight=parseInt(t.maxHeight),e._minHeight=parseInt(t.minHeight),"none"!==o){let t=0;for(let o=0;o<e.viewColumns.length;o++)e.viewColumns[o].autoGenerated&&(t+=e.viewColumns[o].visible?e.viewColumns[o].width:0);let l=[];const a=document.createElement("div");a.style.display="grid",a.style.gridTemplateColumns=o;for(let t=0;t<e.columns.length;t++)a.innerHTML+="<div></div>";a.style.width=e.clientWidth-t+"px",e.$.root.appendChild(a);const n=o.split(" ");for(let t=0;t<e.columns.length;t++)l[t]=a.children[t].offsetWidth,"auto"===n[t]&&(l[t]=null);a.parentNode.removeChild(a);let i=0;for(let t=0;t<e.viewColumns.length;t++){const o=e.viewColumns[t];o.autoGenerated||l[i]&&(o.width=o.templateWidth=l[i++])}}else for(let t=0;t<e.viewColumns.length;t++){const o=e.viewColumns[t];o.autoGenerated||o.templateWidth&&(o.width=o.templateWidth=null)}}setColumns(e){const t=this;if(null===e)return void(t.columns=[]);t.beginUpdate(),t.columns.canNotify=!1;let o=[],l=[];for(let l=0;l<e.length;l++){const a=e[l];let n=!0;for(let e=0;e<t.columns.length;e++)if(t.columns[e].dataField===a.dataField){n=!1;break}n&&o.push(a)}const a=e.map((e=>e.dataField));for(let e=0;e<t.columns.length;e++){const o=t.columns[e];-1===a.indexOf(o.dataField)&&l.push(o)}l.forEach((e=>{const o=t.columns.indexOf(e);o>=0&&t.columns.splice(o,1)}));for(let e=0;e<o.length;e++)t.columns.push(o[e]);if(t.columns.canNotify=!0,t.endUpdate(),t._columnGroups=[],t._columnHeights=0,t.viewColumns)for(let e=0;e<t.viewColumns.length;e++){const o=t.viewColumns[e],l=o.element;o.top=0,o.level=0,l&&(l.style.top="",l.style.height="",l.style.lineHeight="")}if(t._renderColumns(),t.__columnHeaderHeight=null,e){t.beginUpdate();const o=t.context;t.context=document;for(let o=0;o<e.length;o++){const l=e[o],a=t.columnByDataField[l.dataField];["allowExport","allowFreeze","allowNull","allowGroup","allowSelect","verticalAlign","columnGroup","cellsVerticalAlign","autoCloseMenu","autoShowActionButton","autoShowSortButton","autoShowFilterButton","allowLabelAnimation","allowActionButtonAnimation","allowSortButtonAnimation","allowHide","allowDelete","allowEdit","allowSummary","allowHeaderEdit","allowFilter","allowSort","allowSortToggleOnClick","allowResize","allowReorder","description","icon","menuItems","summary","cellsFormat","className","rowSpan","cellsClassName","cellsCSSRules","formatSettings","formatFunction","sortIndex","sortOrder","sortComparator","groups","group","filtered","filterEditor","filter","filterMenuMode","defaultValue","dataField","displayField","label","labelTemplate","dataType","align","cellsWrap","cellsAlign","minWidth","width","visible","_visible","freeze","showActionButton","selected","showIcon","highlight","showDescriptionButton","treeColumn","statusColumn","value","valueField","onAction","title","showCustomButton","showFilterButton","showSortButton","editor","template","visibleIndex","validationRules"].forEach((e=>{void 0!==l[e]&&(a[e]=l[e])}))}t.context=o,t.endUpdate(!1)}t.refresh()}onAttached(){const e=this;if(!e._scrollView){e._scrollView=new Smart.Utilities.Scroll(e,e.$.horizontalScrollBar,e.$.verticalScrollBar);const t=e._scrollView.hScrollBar;e._scrollView.vScrollBar.onChange=e._verticalScrollbarHandler.bind(e),t.onChange=e._horizontalScrollbarHandler.bind(e)}if(e.isRendered&&e.isCompleted&&(e._isDestroyed||e.behavior.autoDestroy)){if(e.header.visible&&""===e.header.template){let t=e.$.header;e.header.appendTo&&(t=document.querySelector(e.header.appendTo),t?t.onclick=t=>{e._headerClickHandler(t)}:t=e.$.header),t.innerHTML='<smart-grid-toolbar header-position="top"></smart-grid-toolbar>',e.$.headerBar=t.firstElementChild;const o=e.$.headerBar;o.messages=e.messages,o.locale=e.locale,e.$.headerBar._init(e),o.render(),e.header.onInit&&e.header.onInit(e.$.headerBar)}e._render()}}destroy(){const e=this;if(!e.isRendered)return;e._isDestroyed=!0,["_dialogChart","_dialogAddRow","_dialogEdit","_dialogDelete","_dialogRowDetail","_dialogAddColumn"].forEach((t=>{e[t]&&(e[t].close(),e[t]=null)})),e.menu&&(e.menu.ownerElement=null,e.menu.remove(),e.menu=null);const t=e.$.headerBar;if(t){const e=t.$.headerDropDown;e&&e.remove()}e._resetCachedLayout();const o=e._scrollView.hScrollBar,l=e._scrollView.vScrollBar;if(l.ownerElement=null,o.ownerElement=null,l.onChange=null,o.onChange=null,e._scrollView&&(e._scrollView.unlisten(),delete e._scrollView),e._columnElements)for(let t=0;t<e._columnElements.length;t++)e._columnElements[t]._detach();if(e._columnElements=null,e._rowElements)for(let t=0;t<e._rowElements.length;t++)e._rowElements[t]._detach();e._rowElements=null,e.rows=[],e.rowById=[],e._initColumns=[],e.columnByDataField=[],e.viewColumns=[],e._columnToResizeElement=null;let a=Array.isArray(e.columns)?[...e.columns]:[...e.columns.toArray()];a=a.map((e=>e.data?(void 0!==e.data.visibleIndex&&delete e.data.visibleIndex,void 0!==e.data.index&&delete e.data.index,void 0!==e.data.grid&&delete e.data.grid,e.data):e)),e.rows.notifyFn=null,e.columns.notifyFn=null,e.columns.notify=null,e.columns._array=[],e.columns=a,e._boundColumns=[],e._filterPanels=[],e._frozenFarColumns=[],e._frozenNearColumns=[],e._frozenNearDefaultRows=[],e._frozenFarDefaultRows=[],e._frozenFarRows=[],e._frozenNearRows=[],e._selection&&e._selection.selectionRect&&(e._selection.selectionRect.parentNode&&e._selection.selectionRect.parentNode.removeChild(e._selection.selectionRect),e._selection.selectionRect=null),e._selection={rows:[],indexes:[],columns:[],cells:[]},e.__autoHeightRows=null,e._visibleRows=null,e.__viewRows=null,e.__clientSize=null,e.__scrollHeight=null,e.__scrollWidth=null,e.__parentCells=null,e._selectionColumn=null,e._adaptiveColumn=null,e._commandColumn=null,delete e._columnFarContainerComputedStyle,delete e._columnContainerComputedStyle,delete e._columnNearContainerComputedStyle,e._inputOverlay&&(e._inputOverlay.parentNode&&e._inputOverlay.parentNode.removeChild(e._inputOverlay),e._inputOverlay=null),e._firstVisibleColumn=null,e._lastVisibleColumn=null,e._toggledRow=null,Smart(e._selector)&&(delete Smart(e._selector)._properties,Smart(e._selector)),delete e._selector,delete e._initProperties}onDetached(){const e=this;e.behavior.autoDestroy&&e.destroy()}_observeColumns(){const e=this,t=function(t,o,l,a){if(l!==a||"selected"===o){if(null==l&&null==a)return;if(l&&"object"==typeof l&&Array.isArray(l)&&a&&"object"==typeof a&&Array.isArray(a)&&JSON.stringify(l)===JSON.stringify(a))return;t.propertyChanged(o,l,a),e.onColumnChange?t.stateProps.indexOf(o)>=0&&e.onColumnChange(t,o,l,a):e.$.fireEvent("columnChange",{column:t,propertyName:o,oldValue:l,value:a})}};for(let o=0;o<e.viewColumns.length;o++){const l=e.viewColumns[o];l.rowHeaderColumn||(l.onAction=function(){e._openMenu(this)}),l.autoGenerated&&l.notify((function(e){l.canNotify=!1,t(l,e.propertyName,e.oldValue,e.newValue),l.canNotify=!0}))}e.columns.notify((function(o){let l=null;if(o.path)return e.columns.canNotify=!1,t(o.target,o.propertyName,o.oldValue,o.newValue),void(e.columns.canNotify=!0);e.columns.canNotify=!1;let a=0;switch(o.action){case"length":return void(e.columns.canNotify=!0);case"add":{const t=function(t){if(l=o.object[t],l instanceof Smart.Grid.Column==0){l.grid=e,l=new Smart.Grid.Column(l);const a=e.columns.canNotify;e.columns.canNotify=!1,o.object[t]=l,l=o.object[t],e.columns.canNotify=a}l.grid=e,l.onAction=function(){e._openMenu(this)},l.freeze?e._frozenNearColumns.push(l):"far"===l.freeze&&e._frozenFarColumns.push(l);let a=e.viewColumns.length-e._frozenFarColumns.length,n=0;if(e._frozenNearColumns.forEach((e=>{e.autoGenerated&&n++})),t<e.columns.length?e.viewColumns.splice(t+n,0,l):e.viewColumns.splice(a,0,l),e.columnByDataField[l.dataField]){e.columnByDataField[l.dataField].children.push(l),l.parent=e.columnByDataField[l.dataField],l.valueField=l.dataField;const t=l.dataField+"_"+l.parent.children.length;e.columnByDataField[t]=l,l.dataField=t}else e.columnByDataField[l.dataField]=l;if(e.dataSource&&e.dataSource.dataFields){let t=!1;for(let o=0;o<e.dataSource.dataFields.length;o++)e.dataSource.dataFields[o].name===l.dataField&&(t=!0);t||e.dataSource.dataFields.push({name:l.dataField,dataType:l.dataType||"string"})}if(!e._dragDrop&&e.onColumnInserted){e._onColumnInsertData||(e._onColumnInsertData=[],e._onColumnInsertIndexes=[]);const o=l.getState();o.dataField=l.dataField,e._onColumnInsertData.push(o),e._onColumnInsertIndexes.push(t),e._onColumnInsertTimer&&clearTimeout(e._onColumnInsertTimer),e._onColumnInsertTimer=setTimeout((()=>{e.onColumnInserted(e._onColumnInsertIndexes,e._onColumnInsertData),delete e._onColumnInsertIndexes,delete e._onColumnInsertData}),50)}};delete e.__measuredColumnHeight;for(let e=0;e<o.addedCount;e++)t(o.index+e);break}case"update":l=o.object[o.index],l instanceof Smart.Grid.Column==0&&(l=new Smart.Grid.Column(l)),l.grid=e;for(let t=0;t<o.index;t++)e.viewColumns[t].autoGenerated&&a++;e.viewColumns[a+o.index]=l,e.columnByDataField[l.dataField]=l,e.onColumnUpdated&&e.onColumnUpdated(o.index,l);break;case"remove":{l=o.removed[0];let t=o.index,n=e.viewColumns.indexOf(l);if(-1===n){for(let o=0;o<=t;o++)e.viewColumns[o].autoGenerated&&a++;e.viewColumns.splice(a+t,1)}else e.viewColumns.splice(n,1);if(l){if(l.filter&&e.removeFilter(l.dataField),l.sortOrder&&e.removeSort(l.dataField),e.removeGroup(l.dataField),l._dataField){const t=e.columnByDataField[l._dataField];t&&t.dataField===l.dataField&&delete e.columnByDataField[l._dataField]}delete e.columnByDataField[l.dataField]}if(e._dragDrop||e.onColumnRemoved&&e.onColumnRemoved(o.index,l),e.columnGroups&&(e._columnGroups=[],e._columnHeights=0,e.viewColumns))for(let t=0;t<e.viewColumns.length;t++){const o=e.viewColumns[t],l=o.element;o.top=0,o.level=0,l&&(l.style.top="",l.style.height="",l.style.lineHeight="")}break}}e._initializeColumnGroupsHierarchy(),e._refreshColumnsResponsiveVisibility(),e._createColumnHeaderCellElements(),e._templateColumns(),e.refresh(),e.columnGroups&&e._columnGroups.length>0&&e._renderColumnGroupHeaders(),e.columns.canNotify=!0}))}get _scrollWidth(){const e=this;if(e.__scrollWidth)return e.__scrollWidth;let t=0;for(let o=0;o<e.viewColumns.length;o++){const l=e.viewColumns[o];l.visible&&(t+=l.computedWidth)}return t=parseInt(t),"card"===e.view&&(t=0),e.__scrollWidth=t,e._scrollView.scrollWidth=t-e._clientSize.width,e.__scrollWidth}_horizontalScrollbarHandler(){const e=this;e.closeMenu(),e.isScrolling=!0,e.isHScrolling=!0,e._hScrollTimer&&clearTimeout(e._hScrollTimer),e._hScrollTimer=setTimeout((()=>{e._summaryRowDialog&&e._summaryRowDialog.classList.contains("open")&&e._summaryRowDialog.close(),e._recycle(),e.isScrolling=!1,e.isHScrolling=!1}))}_mouseWheelNative(e,t){const o=this;void 0===o._scrollWheelContent&&(o._scrollWheelContent=document.createElement("div"),o._scrollWheelContent.style.width="100%",o._scrollWheelContent.style.height="100%",o._scrollWheelContent.style.position="absolute",o._scrollWheelContent.style.left="0px",o._scrollWheelContent.style.top="0px",o._scrollWheelContent.style.background="white",o._scrollWheelContent.style.zIndex=9999,o._scrollWheelContent.style.opacity=0,o._scrollWheelContent.style.overflow="auto",o._scrollWheelContent.style.visibility="hidden");let l=0;const a=()=>{if(t){const t=o._scrollWheelContent.scrollLeft;o._scrollView.hScrollBar.value=t,t===e&&o._scrollWheelContent.remove()}else{const t=o._scrollWheelContent.scrollTop;o._scrollView.vScrollBar.value=t,t===e&&o._scrollWheelContent.remove()}};o._scrollWheelContent.onscroll=()=>{cancelAnimationFrame(l),l=0,l=requestAnimationFrame(a)},o._scrollWheelContentView||(o._scrollWheelContentView=document.createElement("div"),o._scrollWheelContent.appendChild(o._scrollWheelContentView)),o._scrollWheelContentView.style.width=o.offsetWidth+o._scrollView.scrollWidth+"px",o._scrollWheelContentView.style.height=o.offsetHeight+o._scrollView.scrollHeight+"px",o.$.scrollView.appendChild(o._scrollWheelContent),o._scrollWheelContent.scrollTop=o._scrollView.vScrollBar.value,o._scrollWheelContent.scrollLeft=o._scrollView.hScrollBar.value,!0===t?o._scrollWheelContent.scrollTo({top:o._scrollView.vScrollBar.value,left:e,behavior:"smooth"}):o._scrollWheelContent.scrollTo({top:e,left:o._scrollView.hScrollBar.value,behavior:"smooth"})}_mouseWheelHandler(e){const t=this;if(t._scrollView.hScrollBar.$.hasClass("smart-hidden")&&t._scrollView.vScrollBar.$.hasClass("smart-hidden"))return;if(42===e.pointerId)return;if(t._isUpdating)return;if(t.editing.isEditing)return;if(!t.behavior.allowMouseWheel)return;const o=t.querySelector("smart-grid-toolbar");if(o&&o.$.headerDropDown.classList.contains("open"))return;let l=!1;if(e.wheelDeltaY?120!==Math.abs(e.wheelDeltaY)&&240!==Math.abs(e.wheelDeltaY)&&360!==Math.abs(e.wheelDeltaY)&&(l=!0):0===e.deltaMode&&(l=!0),t.disabled||t._scrollView.vScrollBar.$.hasClass("smart-hidden")||e.shiftKey||!e.deltaY){if(!t.disabled&&(!t._scrollView.hScrollBar.$.hasClass("smart-hidden")||e.shiftKey)){e.stopPropagation(),e.preventDefault();let o=160;const a=0===e.deltaX?e.wheelDelta:e.deltaX;a<0&&(o=-160),Math.abs(a)>=100&&!l&&!Smart.Utilities.Core.Browser.Firefox?t._mouseWheelNative(t._scrollView.scrollLeft+o,!0):t._scrollView.scrollLeft+=a}}else{const o=t.scrollTop;if(0===o&&e.deltaY<0||o===t.scrollHeight&&e.deltaY>0)return;e.stopPropagation(),e.preventDefault();let a=15*t.layout.rowMinHeight;if(e.deltaY<=0&&(a=-15*t.layout.rowMinHeight),Math.abs(e.deltaY)>=100&&!l&&!Smart.Utilities.Core.Browser.Firefox)t._mouseWheelNative(t._scrollView.scrollTop+a);else{t._wheelrafId=0;const o=()=>{t._scrollView.scrollTop+=e.deltaY};cancelAnimationFrame(t._wheelrafId),t._wheelrafId=0,t._wheelrafId=requestAnimationFrame(o)}}}_refresh(e){const t=this;if(t._isUpdating)return;const o=t.$.verticalScrollBar.offsetWidth;t.removeAttribute("grouped"),t.removeAttribute("tree");let l=!0;t.__autoHeightRows&&(t.__autoHeightRows=null,t._refreshColumnsResponsiveVisibility(),t._recycle(),l=!1),t._groups||(t._groups=[]),t._cellCachedValues=[],t.grouping.enabled&&t.dataSource.groupBy&&t.dataSource.groupBy.length>=0&&("advanced"===t.grouping.renderMode?t.setAttribute("grouped",""):t.setAttribute("tree",""),t._groups||(t._groups=[].concat(t.dataSource.groupBy.toArray())||[]),t._renderGroupBar()),t.grouping.enabled&&t.dataSource.groupBy&&0===t.dataSource.groupBy.length?t.$.breadcrumb&&(t.$.breadcrumb.dataSource=[]):t.dataSource.boundHierarchy&&(t.setAttribute("tree",""),t.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._deleteCopyRects(),t._conditionalColors&&t._conditionalColors.update&&t._conditionalColors.update(),"add"===e||"remove"===e||"update"===e?(t._rowChangeTimeout&&clearTimeout(t._rowChangeTimeout),"remove"===e?(t._recycle(!1),t._refreshHeaderBar()):t._rowChangeTimeout=setTimeout((()=>{t._recycle(!1),t._refreshHeaderBar()}),100)):(t._recycle(),t._refreshHeaderBar()),t._recyclingRows&&0===t._recyclingRows.length&&(t.$.placeholder.classList.remove("smart-hidden"),t.scrollHeight=0,t.$.placeholder.innerHTML=t.messages[t.locale]&&t.messages[t.locale].placeholder?t.localize("placeholder"):t.appearance.placeholder,t.filtering.filterRow.visible&&(t.$.placeholder.style.top="0px",t.$.placeholder.style.position="relative",t._filters&&t._filters.length&&(t.$.placeholder.style.top="12px")),t._filters&&t._filters.length&&(t.$.placeholder.innerHTML=`<span class="smart-grid-icon show smart-icon-filter" style="\n font-size: calc(2 * var(--smart-font-size));\n cursor: default;\n margin-right: 10px;\n "></span>${t.localize("filteredRecords")}`)),t.dataSource&&t.dataSource.boundHierarchy&&t.conditionalFormatting&&t._renderConditionalFormatting(!1),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,o.hasAttribute("tree")&&o.dataSource&&o.dataSource.childrenDataField&&(m.index=s),!m.groupDataField&&o.appearance.showTreeRowHeader&&(m.groupDataField=o.columns[m.level].dataField),m.label=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();let e=0,t=o.rows.canNotify;o.rows.canNotify=!1;for(let t=0;t<o.rowHierarchy.length;t++){const l=o.rowHierarchy[t],a=o.layout.rowHeight||o.layout.rowMinHeight;void 0===l.top&&(l.top=e,l.height=l.cellHeight=a),l.height?e+=l.height:e+=a}o.rows.canNotify=t,o._recycle(!1,!0)}if(o.grouping.summaryRow.visible&&!o.grouping.summaryRow.inline){const e=function(t,o,l,a){if(0!==t&&o.length>0&&o[o.length-1]&&!o[o.length-1].summaryRow){let e={label:" ",boundSource:[],groupDataField:l.data.groupDataField,$:{},summaryRow:!0,leaf:!0,level:t,expandHeight:0,siblings:o};e.$.id="SubRow"+a+"_"+l.data.$.id,l&&(e.parent=l.data,e.parentId=l.data.$.id),e.data=Object.assign(e),o.push(e)}for(let t=0;t<o.length;t++)o[t]&&o[t].data&&o[t].data.children&&e(o[t].level+1,o[t].data.children,o[t],t)};e(0,o.rowHierarchy,null,0)}}}applyContent(){}_refreshContentHeight(){const e=this;let t=e._clientSize.height;const o=window.scrollY;let l,a,n=!1;if((!e._contentHeight||e._maxHeight||e._autoHeight||e.__autoHeight||"hidden"===e.verticalScrollBarVisibility)&&(n=!0),n&&(l=e.offsetHeight,e.$.container.classList.add("smart-hidden"),a=e.offsetHeight,e.$.container.classList.remove("smart-hidden")),window.scrollY!==o&&window.scrollTo(window.scrollX,o),"hidden"===e.verticalScrollBarVisibility||e.layout.autoHeight||l!==a||e._minHeight&&e._minHeight===l)return t=e._scrollHeight+e.$.columnHeader.offsetHeight+e.$.filterFooter.offsetHeight,e.header.visible&&!e.header.appendTo&&(t+=e.$.header.offsetHeight),e.summaryRow.visible&&(t+=e.layout.rowMinHeight),0===e._recyclingRows.length&&0===e._scrollHeight&&(t+=e.$.scrollView.offsetTop),e._minHeight>t&&(t=e._minHeight),e.$.content.style.height=t+"px",e._contentHeight=t,void(e._maxHeight<t?(e._autoHeight=!1,e.$.content.classList.remove("auto-height"),e.$.content.style.height=e._maxHeight+"px",e.header.visible&&!e.header.appendTo?(e.$.content.style.height=e._maxHeight-e.$.header.offsetHeight+"px",e._contentHeight=e._maxHeight-e.$.header.offsetHeight):e._contentHeight=e._maxHeight):(e._autoHeight=!0,e.__autoHeight=!0,e.$.content.classList.add("auto-height"),e.filtering.filterRow.visible&&(e.filtering.filterRow.visible,e._contentHeight=t,e.$.content.style.height=e._contentHeight+"px"),e.header.visible&&!e.header.appendTo?(e._contentHeight=t-e.$.header.offsetHeight,e.$.content.style.height=e._contentHeight+"px"):e.summaryRow.visible&&(e.$.content.style.height=e._contentHeight+"px")));if(e.header.visible&&!e.header.appendTo&&(t-=e.$.header.offsetHeight),(e.groupHeader.visible||e.grouping.groupBar.visible)&&(t-=e.$.groupHeader.offsetHeight),e.footer.visible&&(t-=e.$.footer.offsetHeight),e.pager.visible&&(t-=e.$.headerPager.offsetHeight,t-=e.$.footerPager.offsetHeight),e.editing.enabled&&e.editing.commandBar.visible&&(t-=e.$.headerCommandBar.offsetHeight,t-=e.$.footerCommandBar.offsetHeight),e.$.content.style.height!==t+"px"&&(e.$.content.style.height=t+"px"),e.$.viewContent.style.height!==t+"px"&&(e.$.viewContent.style.height=t+"px"),e._contentHeight=t,!e.appearance.showViewBar||e.appearance.viewBarAppendTo||e.appearance.showViewBarAsDropdown)e.$.viewBar.classList.add("smart-hidden"),e.$.content.style.width="",e.$.viewContent.style.width="",e.$.content.style.marginLeft="",e.$.viewContent.style.marginLeft="";else{const o=e.layout.viewBarWidth+5;e.$.viewBar.classList.remove("smart-hidden"),e._mobile||(e.$.content.style.width="calc(100% - "+o+"px)",e.$.viewContent.style.width="calc(100% - "+o+"px)",e.$.content.style.marginLeft=o+"px",e.$.viewContent.style.marginLeft=o+"px"),e.$.viewBar.style.width=o+"px";let l=0;e.header.visible&&!e.header.appendTo&&(l+=e.$.header.offsetHeight),(e.groupHeader.visible||e.grouping.groupBar.visible)&&(l+=e.$.groupHeader.offsetHeight),e.pager.visible&&(l+=e.$.headerPager.offsetHeight),e.$.viewBar.style.top=l+"px",e.$.viewBar.style.height=t+"px"}}appendChild(){const e=Array.prototype.slice.call(arguments,2);return HTMLElement.prototype.appendChild.apply(this,e.concat(Array.prototype.slice.call(arguments)))}removeChild(){const e=Array.prototype.slice.call(arguments,2);return HTMLElement.prototype.removeChild.apply(this,e.concat(Array.prototype.slice.call(arguments)))}get _contentBorder(){const e=this;if(e.__contentBorder)return e.__contentBorder;const t=getComputedStyle(e.$.content),o={left:parseFloat(t.borderLeftWidth)+parseFloat(t.borderRightWidth),top:parseFloat(t.borderTopWidth)+parseFloat(t.borderBottomWidth)};return e.__contentBorder=o,o}_refreshAutoSize(){const e=this;if(e.layout.autoWidth){const t=e._isUpdatingScrollBars;e._isUpdatingScrollBars=!0;let o=2;for(let t=0;t<e.viewColumns.length;t++){const l=e.viewColumns[t];l.visible&&(o+=l.computedWidth)}o+=e.$.verticalScrollBar.offsetWidth>0?e.$.verticalScrollBar.offsetWidth:0,e.style.width=o+"px",requestAnimationFrame((()=>{e._isUpdatingScrollBars=t}))}e.layout.autoHeight&&(e.style.height="auto")}_refreshLayout(){const e=this,t=e.rows;if(e._layoutSuspended)return;e._visibleRows=null,e.__viewRows=null,e.__clientSize=null,e.__scrollHeight=null,e.__scrollWidth=null,e.__parentCells=null,e.$.columnFarContainer.classList.remove("vscroll"),e.$.columnNearContainer.classList.remove("vscroll"),e.$.scrollView.classList.remove("hscroll"),e.$.scrollView.classList.remove("vscroll"),e._refreshAutoSize(),e._refreshElementsVisibility(),e._refreshRowHierarchy(),e._refreshColumnHeights(),e._refreshContentHeight();const o=()=>{e.$.placeholder.classList.remove("smart-hidden"),e.$.placeholder.innerHTML=e.messages[e.locale]&&e.messages[e.locale].placeholder?e.localize("placeholder"):e.appearance.placeholder,e._filters&&e._filters.length&&(e.$.placeholder.innerHTML=e.localize("filteredRecords")),e.__filterFooterOffsetHeight||(e.__filterFooterOffsetHeight=e.$.filterFooter.classList.contains("smart-hidden")?0:e.$.filterFooter.offsetHeight),!e.__columnHeaderHeight&&e.$.columnHeader.offsetHeight&&(e.__columnHeaderHeight=e.$.columnHeader.offsetHeight);let t=e._contentHeight-e.__filterFooterOffsetHeight-e.__columnHeaderHeight;e.$.scrollView.style.height=t+"px",e.scrollWidth=0,e.scrollHeight=0,e.clearSelection(),e._showAddNewRowButton("float"),e.$.content.classList.contains("auto-height")&&(e.$.placeholder.style.height=t+"px")};if(t&&t.url)e._showAddNewRowButton("float");else{if(!t||null===t||0===t.length||0===e.columns.length)return o(),0!==e.columns.length&&e.hasVisibleColumn()?e.editing.addNewColumn._addButton&&e.editing.addNewColumn._addButton.classList.remove("show"):(e._showAddNewColumnButton(),e.$.columnHeader.classList.add("smart-hidden"),e.__columnHeaderHeight=0),void e._refreshScrollBars();e._showAddNewRowButton("float"),e.editing.addNewColumn._addButton&&e.editing.addNewColumn._addButton.classList.remove("show")}0!==e.columns.length&&e.hasVisibleColumn()?e.editing.addNewColumn._addButton&&e.editing.addNewColumn._addButton.classList.remove("show"):(o(),0!==e.columns.length&&e.hasVisibleColumn()||(e._showAddNewColumnButton(),e.$.columnHeader.classList.add("smart-hidden"),e.__columnHeaderHeight=0),e._showAddNewColumnButton()),"card"===e.view&&(e.__columnHeaderHeight=0),!e.__columnHeaderHeight&&e.$.columnHeader.offsetHeight&&(e.__columnHeaderHeight=e.$.columnHeader.offsetHeight),e.__filterFooterOffsetHeight||(e.__filterFooterOffsetHeight=e.$.filterFooter.classList.contains("smart-hidden")?0:e.$.filterFooter.offsetHeight);let l=e._contentHeight-e.__filterFooterOffsetHeight-e.__columnHeaderHeight;if(e.$.scrollView.style.height=l+"px",e.htmlColumnLastChild.style.height=e.__columnHeaderHeight+"px",e.paging.spinner.enabled&&e.paging.enabled){if(!e.pageScroll){const t=document.createElement("smart-scroll-bar");t.orientation="vertical",t.style.height="100%",t.style.width="100%",t.max=Math.ceil(e.dataSource.length/e._pageSize),t.step=e.paging.spinner.step,t.largeStep=e.paging.spinner.step,t.setAttribute("spinner",""),t.setAttribute("smart-id","spinner"),t.ownerElement=e,e.addPropertyBinding("[[paging_spinner_step]]","step",t,e.$.columnHeader),t.addEventListener("change",(function(t){e.paging.pageIndex=t.detail.value,e._refreshLayout(),e._refreshSelection(),e.dataSource&&e.dataSource.virtualDataSource?e._virtualDataRequest("pageIndexChange"):(e._recycle(),e._scrollUpdate&&clearTimeout(e._scrollUpdate),e._scrollUpdate=setTimeout((function(){e.isScrolling||(e.$.rowContainer.style.top=parseInt(e.$.rowContainer.style.top)+.01+"px")}),50))})),e.pageScroll=t}e.htmlColumnLastChild.appendChild(e.pageScroll)}else e.htmlColumnLastChild.innerHTML="";e._refreshScrollBars()}_refreshScrollBars(){const e=this;if(!e._scrollView)return;const t=e._scrollView.vScrollBar,o=e._scrollView.hScrollBar,l=e._contentHeight-e.__filterFooterOffsetHeight-e.__columnHeaderHeight,a=e.$.scrollView.offsetWidth,n=e._scrollWidth-a-e._contentBorder.left,i=e._scrollHeight-l-e._contentBorder.top,r=e._columnNearContainerComputedStyle?e._columnNearContainerComputedStyle:getComputedStyle(e.$.columnNearContainer),s=e._columnFarContainerComputedStyle?e._columnFarContainerComputedStyle:getComputedStyle(e.$.columnFarContainer),d=parseInt(e.$.columnNearContainer.style.width)+parseInt(r.borderRightWidth),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(e=!0){const t=this;t._isUpdating=0,t.beginUpdate(),t.clearSort(),t.clearFilter(),t.clearGroups(),t.clearSelection(),t._conditionalColors&&(t._conditionalColors.colors=[],t._conditionalColors.conditions=[],t._conditionalColors.type="conditions",t._conditionalColors.singleSelect="",t._conditionalColors.decorate="border",t._conditionalColors.update=()=>{}),t.$.headerBar&&delete t.$.headerBar._appliedColors,delete t._labeledBy,delete t._dateStackedBySelect,t.highlighted=null,t.columns.canNotify=!1;let o=[],l=!1;for(let e=0;e<t.columns.length;e++){const a=t.columns[e];a.visible=!0,a.width=180,a.freeze=!1,a.index>=0?o[a.index]=a:o.push(a),a.index!==e&&(l=!0)}l&&(t.columns=o),"grid"!==t.view&&e&&(t.view="grid",t._hideKanbanView(),t._hideSchedulerView()),t.columns.canNotify=!0,t._scrollView.scrollLeft=t._scrollView.scrollTop=0,t.paging.enabled&&(t.paging.pageIndex=0),t.$.headerBar&&t.$.headerBar._setView&&"grid"===t.view&&t.$.headerBar._setView("grid"),t._kanban&&t._kanban._reset(),t.layout.isDirty=!0,t.endUpdate(),l&&(t._renderColumns(),t._refreshHeaderBar())}_loadState(e){const t=this;let o=!1;t.stateSettings.loading=!0;let l=!1,a=!1,n=!1;if("grid"===e.view||"card"===e.view||void 0===e.view){if(e.expandedRows&&Object.keys(e.expandedRows).length>0){o=!0,t.beginUpdate();const l=[];if(e.groups){t.dataSource.groupBy=e.groups,t._groups=[].concat(t.dataSource.groupBy.toArray())||[],t._refreshRowHierarchy();for(let o in e.expandedRows)l["Item"+o.replaceAll(".","_")]=!0,t._expandCollapseGroup(o,!0)}else if(t.grouping.enabled&&t.dataSource.groupBy.length)for(let o in e.expandedRows)l["Item"+o.replaceAll(".","_")]=!0,t._expandCollapseGroup(o,!0);t.dataSource&&(t.dataSource._expandedRowIds=l)}else if(e.groups&&e.groups.length){o=!0,t.beginUpdate();const l=[];t.dataSource&&(t.dataSource._expandedRowIds=l),e.groups&&(t.dataSource.groupBy=e.groups,t._refreshRowHierarchy())}else if(e.groups&&0===e.groups.length&&t.dataSource.groupBy.length>0){o=!0,t.beginUpdate();const e=[];t.dataSource&&(t.dataSource._expandedRowIds=e),t.dataSource.groupBy=[],t._refreshRowHierarchy(),a=!0}if(e.paging&&t.paging.enabled&&(t.paging.index=e.paging.index,t.paging.size=e.paging.size),e.columns&&e.columns.length>0){o||(o=!0,t.beginUpdate());let a=[];for(let o=0;o<e.columns.length;o++){const i=e.columns[o];if(i.dataField){const e=t.columnByDataField[i.dataField];if(e){const r=e.canNotify;e.canNotify=!1,i.width?e.width=i.width:e.width=180,e.sortOrder="",e.sorted="",a.push(e),e.index!==o&&(n=!0),e.visible=void 0===i.visible||i.visible,e._state&&(e._state.visible=void 0===i.visible||i.visible,e._state.freeze=void 0!==i.freeze&&i.freeze,e._state.width=i.width?i.width:180);const s=e.freeze;e.freeze=void 0!==i.freeze&&i.freeze,s!==e.freeze&&(l=!0,e.freeze||t._frozenNearColumns.indexOf(e)),e.canNotify=r}}}n&&(t.columns=a)}}if(e.colors&&(t._conditionalColors=JSON.parse(JSON.stringify(e.colors)),t.$.headerBar)){let l=[];if(e.colors.conditions)for(let t=0;t<e.colors.conditions.length;t++){let o=e.colors.conditions[t],a=[];for(let e in o)a.push(o[e]);l.push(a)}o||(o=!0,t.beginUpdate());const a={type:e.colors.type,singleSelect:e.colors.singleSelect,decorate:e.colors.decorate};t.$.headerBar._appliedColors=[l,a],t._conditionalColors.update=e=>{t.$.headerBar._updateConditionalColors(e,t,a)}}if(e.sort&&Object.keys(e.sort).length>0){o||(o=!0,t.beginUpdate());const l=t.appearance.allowSortAnimation;t.appearance.allowSortAnimation=!1;let a=t.columns.canNotify;t.columns.canNotify=!1;for(let e=0;e<t.columns.length;e++)t.columns[e].sortOrder="";t.columns.canNotify=a;for(let o in e.sort){const l=e.sort[o];if(l){const e=l.sortOrder,a=l.dataField?l.dataField:o,n=t.columnByDataField[a];n&&t.sortBy(n.dataField,e)}}t.appearance.allowSortAnimation=l}if(e.filter&&Object.keys(e.filter).length>0){o||(o=!0,t.beginUpdate());for(let o in e.filter){let l=o,a=e.filter[l];if(e.filter[0]&&(l=e.filter[o].dataField,a=e.filter[o].filter),a){t.addFilter(l,a,!1);const e=t.columnByDataField[l];e&&e._filterInfo&&e.filter&&e.filter.filters&&e.filter.filters[0]&&(e._filterInfo.value=e.filter.filters[0].value,e._filterInfo.condition=e.filter.filters[0].condition)}}if(t.filtering.filterRow)for(let e=0;e<t.columns.length;e++)t.columns[e]._filterEditorInitialized&&(t.columns[e]._filterEditorInitialized=!1)}if(e.selectedCells&&(o||(o=!0,t.beginUpdate()),t.selectCellsById(e.selectedCells)),e.selectedRows&&t.selectRows(e.selectedRows),e.labeledBy&&(t._labeledBy=e.labeledBy),o){t.endUpdate(!1,!1);let o=!1;e.view&&"kanban"===e.view&&(o=!0),(l||n)&&(o=!1,a=!0,t._renderColumns()),o||(a?t.refresh(!0):t._refresh())}let i=!1;if(e.kanban&&e.kanban.stackedBy&&(void 0===t._stackedBy&&(t._stackedBy=e.kanban.stackedBy),t._stackedBy!==e.kanban.stackedBy&&(i=!0),t._stackedBy=e.kanban.stackedBy),e.scheduler&&e.scheduler.stackedBy&&(void 0===t._dateStackedBy&&(t._dateStackedBy=e.scheduler.stackedBy),t._dateStackedBy!==e.scheduler.stackedBy&&(i=!0),e.scheduler.labeledBy&&(t._labeledBy=e.scheduler.labeledBy),e.scheduler.viewType&&(t._schedulerViewType=e.scheduler.viewType),void 0===t._dateStackedBySelect&&(t._dateStackedBySelect=e.scheduler.groupBy),t._dateStackedBySelect!==e.scheduler.groupBy&&(i=!0),t._dateStackedBy&&Array.isArray(t._dateStackedBy)&&e.scheduler.stackedBy&&Array.isArray(e.scheduler.stackedBy)&&JSON.stringify(t._dateStackedBy)===JSON.stringify(e.scheduler.stackedBy)&&(i=!1),t._dateStackedBy=e.scheduler.stackedBy),(i||e.view&&t.view!==e.view)&&t.$.headerBar&&t.$.headerBar._setView&&(e.name&&(t.stateSettings.current=e.name),t.$.headerBar._setView(e.view,!0)),e.filter&&Object.keys(e.filter).length>0&&t.refreshFilters(),e.selectedCells){const o=[];let l=99999999,a=null,n=99999999,i=null,r=99999999,s=null;for(let l=0;l<e.selectedCells.length;l++){const a=e.selectedCells[l],d=a[0],u=a[1],c=t.columnByDataField[u];if(c&&(n=Math.min(n,c.index),i=Math.max(i,c.index)),!t.rowById[d])continue;const m=t.rowById[d].visibleIndex;m>=0&&(r=Math.min(r,m),s=Math.max(s,m)),o[d]||(o[d]=[]),o[d].push(u)}let d=0,u=!0;for(let e in o){const t=o[e];if(d&&t.length!==d){u=!1;break}d=t.length}if(u){const e=t.getRows(),o=e[r],d=e[s];if(l=o?o.id:-1,a=d?d.id:-1,o){const e=t.columns[n];if(e){const o=t.rowById[l].getCell(e.dataField);t._selection.focusedCell={id:o.row.id,value:o.value,dataField:o.column.dataField,index:o.row.index},setTimeout((()=>{t._selectCellsRange(t.rowById[l],t.rowById[a],t.columns[n].dataField,t.columns[i].dataField)}),50)}}}}e.name&&(t.stateSettings.current=e.name),t._refreshHeaderBar(),t.stateSettings.loading=!1}loadState(e){const t=this;if(e){if(t.stateSettings.loading=!0,t._isUpdating=0,t.beginUpdate(),t.clearSort(),t.clearFilter(),t.clearGroups(),t.clearSelection(),t._conditionalColors&&(t._conditionalColors.colors=[],t._conditionalColors.conditions=[],t._conditionalColors.type="conditions",t._conditionalColors.singleSelect="",t._conditionalColors.decorate="border"),delete t._labeledBy,delete t._dateStackedBySelect,t.$.headerBar&&delete t.$.headerBar._appliedColors,t._scrollView.scrollLeft=t._scrollView.scrollTop=0,t.paging.enabled&&(t.paging.pageIndex=0),t.endUpdate(!1,!1),"string"==typeof e){const o=t.stateSettings.storage[e];o&&t._loadState(o)}else t._loadState(e);t.stateSettings.loading=!1}else if(!t.stateSettings.autoSave){let e=t.getCurrentState();e&&t.loadState(e)}}saveState(e,t){const o=this;let l=o.getCurrentState(),a=t;!t&&o.stateSettings.options.length&&(t=o.stateSettings.options);const n=o.getState(t);let i;if(e?(i=e,o.stateSettings.current||(o.stateSettings.current=e)):i=o.stateSettings.current?o.stateSettings.current:o.stateSettings.current="View 1",l&&a)for(let e in a)l[a[e]]=n[a[e]];else l=n;function r(e,t=0,o=10){if(t>o)return"Object";const l={};if(e&&e instanceof Smart.FilterGroup)return e=e.toString();for(let a in e){let n=e[a];if(n instanceof Node)n={id:n.id};else if(n instanceof Window)n="Window";else if(n instanceof Date)n=n.toJSON();else{if(n&&Array.isArray(n)&&void 0!==n[0]&&("string"==typeof n[0]||"number"==typeof n[0]||n[0]instanceof Date||"boolean"==typeof n[0])){l[a]=n;continue}if(n&&Array.isArray(n)&&0===n.length){l[a]=n;continue}if(n&&n&&Array.isArray(n)&&void 0!==n[0]&&"object"==typeof n[0]&&"path"!==a&&!(n[0]instanceof HTMLElement))for(let e=0;e<n.length;e++)n[e]=r(n[e],t+1,o);else n instanceof Object&&(n=r(n,t+1,o))}l[a]=n}return t?l:JSON.stringify(l)}l.name=i,o.stringify_object=r;const s=r(l);return o.stateSettings.allowLocalStorage&&window.localStorage.setItem(i,s),o.stateSettings.storage||(o.stateSettings.storage={}),o.stateSettings.storage[o.stateSettings.current]&&!l.date&&o.stateSettings.storage[o.stateSettings.current].date?l.date=o.stateSettings.storage[o.stateSettings.current].date:l.date=(new Date).toJSON(),o.stateSettings.storage[o.stateSettings.current]=l,o.stateSettings.onStateChange&&(o._isUpdating<=0||void 0===this._isUpdating)||o.stateSettings.onStateChange&&o._forceStateChange?o.isCompleted&&o.stateSettings.onStateChange(l,i,o.stateSettings.storage,r):o.stateSettings.onStateChange&&"grid"!==o.view&&o.isCompleted&&o.stateSettings.onStateChange(l,i,o.stateSettings.storage,r),l}autoSaveState(){const e=this;e._savingState&&clearTimeout(e._savingState),e._savingState=setTimeout((()=>{if(!e.stateSettings.current&&e.stateSettings.autoSave&&!e.stateSettings.loading){const t=e.stateSettings.storage;if(t&&0===Object.keys(t).length||!t){let t=e.localize("newGrid")+" "+e.localize("view");"kanban"===e.view?t=e.localize("newKanban")+" "+e.localize("view"):"card"===e.view?t=e.localize("newCard")+" "+e.localize("view"):"scheduler"===e.view&&(t=e.localize("newScheduler")+" "+e.localize("view")),e.stateSettings.current=t}}e.stateSettings.autoSave&&e.stateSettings.current&&!e.stateSettings.loading&&e.saveState()}),50)}getCurrentState(){const e=this,t=e.stateSettings.current;return e.stateSettings.storage||(e.stateSettings.storage={}),e.stateSettings.storage[t]?e.stateSettings.storage[t]:null}setColors(e,t){const o=this;o._conditionalColors={type:t.type,decorate:t.decorate,conditions:e,singleSelect:t.singleSelect},o.$.headerBar.addColors(JSON.parse(JSON.stringify(e)),{type:t.type,singleSelect:t.singleSelect,decorate:t.decorate},[]),o._recycle(!1)}getColors(){const e=this;if(e._conditionalColors){const t=JSON.parse(JSON.stringify(e._conditionalColors));return{type:t.type,conditions:t.conditions,filters:t.filters,colors:t.colors,decorate:t.decorate,singleSelect:t.singleSelect}}return null}getState(e){const t=this;if(e&&!e.includes)return;const o=!e||e&&e.includes("sort")?t.getSortedColumns():null,l=!e||e&&e.includes("filter")?t.getFilteredColumns():null,a=!e||e&&e.includes("groups")?t.getGroups():null,n=!e||e&&e.includes("selection")?t.getSelectedCells(!1):null,i=!e||e&&e.includes("selection")?t.getSelectedRowIds():null,r=!e||e&&e.includes("pager")?t.$.headerPager.querySelector("smart-pager"):null,s=!e||e&&e.includes("colors")?t.getColors():null;let d=0;r&&(d=r.pagesCount);const u={count:d,index:t.paging.pageIndex,size:t._pageSize},c={};o&&o.length&&(c.sort=o),l&&l.length&&(c.filter=l),a&&a.length&&(c.groups=a),u&&t.paging.enabled&&(c.paging=u),n&&n.length&&(c.selectedCells=n),i&&i.length&&(c.selectedRows=i),s&&(delete s.colors,c.colors=s),t._labeledBy&&(c.labeledBy=t._labeledBy),(t.header.visible&&t.header.buttons.indexOf("views")>=0||t.header.buttons.indexOf("states")>=0)&&("kanban"===t.view&&(c.kanban=t.getKanbanState()),"scheduler"===t.view&&(c.scheduler=t.getSchedulerState()),c.view=t.view);const m=[];if(!e||e&&e.includes("columns")){for(let e=0;e<t.columns.length;e++){const o=t.columns[e];m.push({dataField:o.dataField,width:o.computedWidth,visible:o.visible,freeze:o.freeze})}c.columns=m}if((!e||e&&e.includes("expandedRows"))&&t.dataSource&&t.dataSource._expandedRowIds){let e={};for(let o in t.dataSource._expandedRowIds){let t=""+o;t=t.replace("Item","").replace(/_/gi,"."),e[t]=!0}Object.values(e).length&&(c.expandedRows=e)}if((t.header.visible&&t.header.buttons.indexOf("views")>=0||t.header.buttons.indexOf("states")>=0)&&("kanban"!==t.view&&"scheduler"!==t.view||(delete c.expandedRows,delete c.columns,delete c.paging,delete c.selectedCells,delete c.selectedRows)),e){const t={};for(let o in e){const l=e[o];c[l]&&(t[l]=c[l])}return t}return c}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.editing.dialog.visible||a.endEdit(),a._isUpdating))return;a._recycleValues=void 0===o||o,a._removeCellContentPopup(),a._inputOverlay&&(a._inputOverlay.parentNode&&a._inputOverlay.parentNode.removeChild(a._inputOverlay),a._inputOverlay=null),a._selection.selectionRect&&a._refreshCellSelectionRect(),a._copyRects&&a._copyRects.length&&a._refreshCopyRects();const n=a._scrollView.scrollTop;let i,r=l||a._getRowIndexByPosition(n),s=a._recyclingRows,d=s[r],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;let y=0;const w=a.behavior.allowRenderCache&&!f&&"grid"===a.view&&!a.dataSource.virtualDataSourceOnExpand&&!a.rowDetail.template&&!a.rowDetail.enabled&&!a._autoHeight&&!a.pager.visible&&!a._frozenFarColumns.length;if("grid"!==a.view)for(let e=0;e<a._rowElements.length;e++){const t=a._rowElements[e];t.style.transform="",t.style.top="",t.style.position=""}if(r>=0){m=0;let e=Math.max(a._clientSize.height,a._overflowOffset),t=0;if(f&&(a.rowById=[],a.rows&&a.rows.length>0&&void 0===a.rows[a.rows.length-1].top&&(a.rows[a.rows.length-1].top=(a.rows.length-1)*a.rows[0].height),a.rows&&a.rows.length>0&&(t=a._getVirtualRowIndexByPosition(n),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),w)for(let e=0;e<a._rowElements.length;e++){const t=a._rowElements[e];delete t.isRendered,t.classList.remove("smart-hidden"),t.classList.remove("aria-rowindex"),t.style.transform="",t.style.top="",t.style.position=""}if(w){let e=Math.max(a._clientSize.height,a._overflowOffset),o=[],l=u;for(let t=r;t<s.length;t++){const i=s[t];if(0===i.height||!i.visible||!1===i.filtered||i.freeze&&i.visible)continue;const r=i.height;if(i.expandHeight&&(e+=a.offsetHeight+i.expandHeight),l+r>=n-g&&l<=n+e||a._autoHeight){for(let e=0;e<a._rowElements.length;e++){const t=a._rowElements[e];if(t.hasAttribute("data-id")&&t.getAttribute("data-id")===""+i.id){o[i.id]=t,t.isRendered=!0;break}}l+=r}}e=Math.max(a._clientSize.height,a._overflowOffset);for(let l=r;l<s.length;l++){const i=s[l];if(0===i.height||!i.visible||!1===i.filtered||i.freeze&&i.visible)continue;const r=i.height;if(i.expandHeight&&(e+=a.offsetHeight+i.expandHeight),u+r>=n-g&&u<=n+e||a._autoHeight){let e;if(e=a._rowElements[m++],!e)break;for(;e&&e.isRendered;)e=a._rowElements[m++];if(!e){console.log("Did not found a row element during the rendering.");continue}e.setAttribute("aria-rowindex",t+l+1);let n=!1;if(i.element=e,i.grid=a,o[i.id]){const a=o[i.id];a.hasAttribute("data-id")&&a.getAttribute("data-id")===""+i.id&&(a===e&&(a.isRendered=!0,n=!0,m=0),n=!0,m=0,i.element=a,e.style.top="999999px",e.setAttribute("data-id",999999),e.setAttribute("aria-rowindex",t+l+1),e=a,a.isRendered=!0)}e.style.top=y+"px",e.style.position="absolute",i.render(n),e.isRendered=!0,u+=r,y+=r}}}else{a.rowDetail.enabled&&(e+=a.offsetHeight);for(let o=r;o<s.length;o++){const l=s[o];if(0===l.height||!l.visible||!1===l.filtered||l.freeze&&l.visible)continue;const i=l.height;if(l.expandHeight&&(e+=a.offsetHeight+l.expandHeight),!(u+i>=n-g&&u<=n+e||a._autoHeight))break;{let e;if(e=a._rowElements[m++],!e)break;if(e.isRendered&&(e.classList.remove("smart-hidden"),e.classList.remove("aria-rowindex"),e.style.transform="",e.style.top="",e.style.position=""),e.setAttribute("aria-rowindex",t+o+1),l.element=e,l.grid=a,f){if(l.index=o+t,l.visibleIndex=o+t,a.selection.enabled&&a._selection){const e=a._selection.indexes,t=l.canNotify;l.canNotify=!1,l.selected=e.indexOf(l.index)>=0,l.canNotify=t}a.paging.enabled?(l.data=a.dataSource[r+m-1],l.data&&(l.id=l.data.$.id,a.rowById[l.id]=l)):(l.data=a.dataSource[m-1],l.data&&(l.id=l.data.$.id,a.rowById[l.id]=l))}l.render(),e.isRendered=!0}u+=i,y+=i}}}a._renderFrozenRows();let v=m;if(m<a._rowElements.length&&!w)for(let e=m;e<a._rowElements.length;e++){const e=a._rowElements[m++];e.classList.add("smart-hidden"),e.removeAttribute("aria-rowindex")}if(w)for(let e=0;e<a._rowElements.length;e++)if(!a._rowElements[e].isRendered){const t=a._rowElements[e];t.classList.add("smart-hidden"),t.removeAttribute("aria-rowindex")}if(a.editing.addNewRow&&a.editing.addNewRow.visible&&"button"===a.editing.addNewRow.displayMode&&a._rowElements[v]){a._newRow||(a._newRow=new Smart.Grid.Row({data:{},index:9999999,grid:a,addNewRow:!0,inline:!0,autoGenerated:!0}));for(let e=a._rowElements.length-1;e>=0;e--)if(!a._rowElements[e].isRendered){a._newRow.element=a._rowElements[e],a._newRow.element.classList.remove("smart-hidden"),a._newRow.element.style.top=y+"px",a._newRow.element.style.position="absolute",a._newRow.render();break}}f&&(a._selection.selectionRect&&a._refreshCellSelectionRect(),a._copyRects&&a._copyRects.length&&a._refreshCopyRects())}_renderFrozenRows(){const e=this;let t=!1,o=!1;if("card"===e.view)return e.$.rowNearContainer.classList.add("smart-hidden"),void e.$.rowFarContainer.classList.add("smart-hidden");0===e._frozenNearRows.length?e.$.rowNearContainer.classList.add("smart-hidden"):e.$.rowNearContainer.classList.remove("smart-hidden");for(let o=0;o<e._frozenNearRows.length;o++){const l=e._frozenNearRows[o];l.visible||(l.element=e.$.rowNearContainer.children[o],l.element||(l.element=l.createElement(),e.$.rowNearContainer.appendChild(l.element)),l.element.classList.add("smart-hidden")),l.visible&&l.filtered&&(t=!0,l.element=e.$.rowNearContainer.children[o],l.element||(l.element=l.createElement(),e.$.rowNearContainer.appendChild(l.element)),l.render())}t||e.$.rowNearContainer.classList.add("smart-hidden"),0===e._frozenFarRows.length?e.$.rowFarContainer.classList.add("smart-hidden"):e.$.rowFarContainer.classList.remove("smart-hidden");for(let t=0;t<e._frozenFarRows.length;t++){const l=e._frozenFarRows[t];l.visible&&(o=!0),l.element=e.$.rowFarContainer.children[t],l.element||(l.element=l.createElement(),e.$.rowFarContainer.appendChild(l.element)),l.render()}o||e.$.rowFarContainer.classList.add("smart-hidden"),0!==e.columns.length&&e.hasVisibleColumn()||(e.$.rowNearContainer.classList.add("smart-hidden"),e.$.rowFarContainer.classList.add("smart-hidden"));const l=e.rows;l&&null!==l&&0!==l.length||(e.$.rowNearContainer.classList.add("smart-hidden"),e.$.rowFarContainer.classList.add("smart-hidden"),e._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.getSortedColumnsByDataField(),filtering:o.getFilteredColumnsByDataField(),filterOperator:o.filtering.operator,grouping:o._groups,row:o._toggledRow?o._toggledRow.data:null,action:e},i=o.dataSource.length,r=o.dataSource.boundSource.length;void 0===o._isFirstVirtualDataSourceRequest&&(o._isFirstVirtualDataSourceRequest=!0),o.dataSource.onVirtualDataSourceRequested((function(e){if(o.appearance.displayLoadingIndicator=!1,o._setLoadingIndicatorVisibility(),o._toggledRow=null,!e)return o._initializeRows(),o._initializeRowElements(),o.refresh(),o._refreshPagesCount(),void(o._autoHeight&&o._initializeRowElements());if("add"===e.action){if(t&&t(e.result),o._autoHeight&&o.rows.length>=o._rowElements.length-1&&(o._initializeRows(),o._initializeRowElements(),o.refresh(),o.filtering.filterRow)){for(let e=0;e<o.columns.length;e++)o.columns[e]._filterEditorInitialized&&(o.columns[e]._filterEditorInitialized=!1);const e=o.filtering.filterRow&&o.filtering.filterRow.visible&&o.filtering.filterRow.cell?o.filtering.filterRow.cell.column.dataField:null;e&&setTimeout((()=>{const t=o.columnByDataField[e];t&&t._filterInfo&&t._filterInfo.input&&t._filterInfo.input.focus()}),100)}return}if("update"===e.action)return void(t&&t(e.result));if("remove"===e.action)return void(t&&t(e.result));const l=o.context;if(o.context=o,o._isFirstVirtualDataSourceRequest&&0===o._initColumns.length&&(o.columns.canNotify=!1,o.columns=[],o._renderColumns(),o.columns.canNotify=!0),"scroll"===e.action)if("infinite"===o.scrolling){const e=o._viewRows;for(let t=0;t<e.length;t++){const l=e[t];l.data&&!l.addNewRow&&l.data.$&&(o.rowById[l.data.$.id]||(o.rowById[l.data.$.id]=l))}o._recycle(!1,!1)}else{const t=e.first>=0?e.first:0,l=e.last!==1/0?e.last:0;let a=0;for(let e=t;e<l;e++)o.rows[e]&&(o.rows[e].data=o.dataSource[a++]);o._recycle(!1,!1)}else if(o.dataSource.length!==i||o.dataSource.boundSource.length!==r||o._isFirstVirtualDataSourceRequest||"expand"===e.action||"filter"===e.action||"sort"===e.action||"pageIndexChange"===e.action||"pageSizeChange"===e.action||"sort"===e.action||"group"===e.action){o.paging.enabled&&o.$.headerPager.querySelector("smart-pager")&&(o.$.headerPager.querySelector("smart-pager").pagesCount=Math.ceil(o.dataSource.length/o._pageSize),o.$.footerPager.querySelector("smart-pager").pagesCount=Math.ceil(o.dataSource.length/o._pageSize));const e=o.filtering.filterRow&&o.filtering.filterRow.visible&&o.filtering.filterRow.cell?o.filtering.filterRow.cell.column.dataField:null;if(o._initializeRows(),o._initializeRowElements(),o.refresh(),o._refreshPagesCount(),o._autoHeight&&o._initializeRowElements(),o.filtering.filterRow){for(let e=0;e<o.columns.length;e++)o.columns[e]._filterEditorInitialized&&(o.columns[e]._filterEditorInitialized=!1);e&&setTimeout((()=>{const t=o.columnByDataField[e];t&&t._filterInfo&&t._filterInfo.input&&t._filterInfo.input.focus()}),100)}}else o.dataSource.virtualDataSourceOnExpand&&o.refresh();o._isFirstVirtualDataSourceRequest&&o.onLoad&&(o.onLoad(o),delete o.onLoad),o._isFirstVirtualDataSourceRequest=!1,o._recycle(),o.context=l,o._onDataUpdated&&o._onDataUpdated()}),n)}localizeString(e,t,o="en"){const l=this;o&&l.messages[o][e]&&(l.messages[o][e]=t,l.refresh())}localizeStrings(e,t="en"){const o=this;t&&(Object.assign(o.messages[t],e),o.refresh())}_createAddNewRowButton(){const e=this,t=document.createElement("div");return t.className="smart-grid-add-row-button smart-grid-icon smart-icon-plus",t.title=e.localize("addNewRow"),t.style.left=!e.appearance.showViewBar||e.appearance.viewBarAppendTo||e.appearance.showViewBarAsDropdown||e._mobile?"":10+e.layout.viewBarWidth+"px",e._addNewGridRow=t.onclick=()=>{e._addRowTimer&&clearTimeout(e._addRowTimer),e._addRowTimer=setTimeout((()=>{if(e.dataSource&&e.dataSource.virtualDataSource)return void e._insertNewRowAfter();const t={};for(let o=0;o<e.columns.length;o++){const l=e.columns[o];void 0!==l.defaultValue&&null!==l.defaultValue&&("today"===l.defaultValue&&"date"===l.dataType?(e._today||(e._today=new Date,e._todayYear=e._today.getFullYear(),e._todayMonth=e._today.getMonth(),e._todayDate=e._today.getDate()),t[l.dataField]=new Date(e._todayYear,e._todayMonth,e._todayDate)):t[l.dataField]=l.defaultValue)}e._addingNewRow=!0,e._add(t),e._mobile||(e._scrollView.vScrollBar.value=e._scrollView.vScrollBar.max),e._recycle(!1),e.closeMenu(),e._addingNewRow=!1,e.editing.addNewRow.visible&&e.$.placeholder.classList.contains("smart-hidden")&&"button"!==e.editing.addNewRow.displayMode&&e.editing.addNewRow._addButton.classList.remove("show")}),0)},t}removeColumn(e){const t=this;let o=-1;if(e)for(let l=0;l<t.columns.length;l++)if(t.columns[l].dataField===e){o=l;break}o>=0&&t.columns.splice(o,1)}addColumn(e,t,o=!0){const l=this;if(e){let a=-1;if(t)for(let e=0;e<l.columns.length;e++)if(l.columns[e].dataField===t){a=e,!1===o&&(a=e+1);break}if("string"==typeof e){const t=l._getKanbanTaskField(e);if(t){if(a>=0)return void l.columns.splice(a,0,t);l.columns.push(t)}return}if(a>=0&&a<l.columns.length)return void l.columns.splice(a,0,e);l.columns.push(e)}}insertColumnAfter(e,t){e&&this.addColumn(e,t,!1)}insertColumnBefore(e,t){e&&this.addColumn(e,t,!0)}addNewColumn(e){e&&this.addColumn(e)}_createAddNewColumnButton(){const e=this,t=document.createElement("div");return t.className="smart-grid-add-column-button smart-grid-icon smart-icon-plus",t.title=e.localize("addNewColumn"),t.onclick=()=>{e._openAddColumnDialog(),e.addEventListener("closeColumnDialog",(()=>{e.layout.isDirty=!0,e._resetCachedLayout(),e._refreshLayout()}))},t}_showAddNewRowButton(e){const t=this;if(!t.columns.length)return;if("grid"!==t.view&&t.editing.addNewRow._addButton)return t.editing.addNewRow._addButton.classList.add("smart-hidden"),void t.editing.addNewRow._addButton.classList.remove("show");if("grid"===t.view&&t.editing.addNewRow._addButton&&t.editing.addNewRow._addButton.classList.remove("smart-hidden"),"float"===e&&t.computedVerticalScrollBarVisibility&&t.editing.addNewRow._addButton&&!t.editing.addNewRow._addButton.classList.contains("show"))return;if("float"===e&&t._addingNewRow)return;const o=()=>{t.editing.addNewRow._addButton&&t.editing.addNewRow._addButton&&("float"!==e&&(t.appearance.showRowHeader||t.appearance.showRowHeaderNumber)&&"card"!==t.view?t.editing.addNewRow._addButton.classList.remove("float"):(!t.computedVerticalScrollBarVisibility&&t.dataSource&&0===t.dataSource.length||t.computedVerticalScrollBarVisibility&&"float"===e||"card"===t.view)&&t.editing.addNewRow._addButton.classList.add("float"),t.computedHorizontalScrollBarVisibility?t.pager.visible?t.editing.addNewRow._addButton.style.bottom="68px":t.editing.addNewRow._addButton.style.bottom="20px":t.pager.visible?t.editing.addNewRow._addButton.style.bottom="48px":t.editing.addNewRow._addButton.style.bottom="",t.grouping.enabled&&t.dataSource)&&(!(t.dataSource.groupBy.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._newRow&&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(),o._copyRects&&o._copyRects.length&&o._refreshCopyRects();const l=o._recyclingRows;let a=l[t],n=a.top,i=!1;for(let r=0;r<o._cellsMerge.length;r++){const s=o._cellsMerge[r],d=l.indexOf(s.row);t>d&&t<=d+s.rowSpan&&(t=d,a=s.row,n=a.top,o.$.rowContainer.style.top=o.__frozenNearHeight-e+n+"px",i=!0)}i||(o.$.rowContainer.style.top=o.__frozenNearHeight-e+n+"px")}_verticalScrollbarHandler(e){const t=this;t.menu&&t.menu.column&&t.closeMenu(),t.isScrolling=!0,t._scrollTimer&&clearTimeout(t._scrollTimer),t._layoutSuspended||(t._scrollTimer=setTimeout((()=>{if("virtual"===t.scrolling)t._recycle(!1);else{const e=t._scrollView.scrollTop;let o=t._getRowIndexByPosition(e);o!==t._scrollRowIndex?(t._recycle(!1,!0,!0,o),t._scrollRowIndex=o):t._verticalScrollRecycle(e,o)}if(t.isScrolling=!1,e.max===e.value&&e.max>0){if(t.$.fireEvent("scrollBottomReached"),"infinite"===t.scrolling)return t.appearance.displayLoadingIndicator=!0,t._setLoadingIndicatorVisibility(),t._virtualScrollTimer&&clearTimeout(t._virtualScrollTimer),void(t._virtualScrollTimer=setTimeout((()=>{t._virtualDataRequest("scroll"),t.appearance.displayLoadingIndicator=!1,t._setLoadingIndicatorVisibility()}),50));t.editing.addNewRow._addButton&&"card"!==t.view&&t.editing.addNewRow._addButton.classList.remove("show")}else t.editing.addNewRow.visible&&"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()}_generateUUID(){const e=window.crypto,t=new Uint8Array(16);e.getRandomValues(t),t[6]=15&t[6]|64,t[8]=63&t[8]|128;const o=Array.from(t,(e=>e.toString(16).padStart(2,"0"))).join("");return`${o.substring(0,8)}-${o.substring(8,12)}-${o.substring(12,16)}-${o.substring(16,20)}-${o.substring(20)}`}}),Smart.Grid.Extend=function(e){if(!e)return;const t=Object.getOwnPropertyNames(e.prototype);for(let o in t){const l=t[o];"constructor"!==l&&(Smart.Grid.prototype[l]=e.prototype[l])}},Smart.Grid.Extend(Smart.Utilities.Grid.Resize),Smart.Grid.Extend(Smart.Utilities.Grid.Reorder),Smart.Grid.Extend(Smart.Utilities.Grid.Pager),Smart.Grid.Extend(Smart.Utilities.Grid.Filter),Smart.Grid.Extend(Smart.Utilities.Grid.Sort),Smart.Grid.Extend(Smart.Utilities.Grid.Menu),Smart.Grid.Extend(Smart.Utilities.Grid.Select),Smart.Grid.Extend(Smart.Utilities.Grid.Edit),Smart.Grid.Extend(Smart.Utilities.Grid.Dialog),Smart.Grid.Extend(Smart.Utilities.Grid.Group),Smart.Grid.Extend(Smart.Utilities.Grid.Tree),Smart.Grid.Extend(Smart.Utilities.Grid.Export),Smart.Grid.Extend(Smart.Utilities.Grid.Chart),Smart.Grid.Extend(Smart.Utilities.Grid.View),Smart.Grid.Cell=Smart.Utilities.Grid.Cell,Smart.Grid.Row=Smart.Utilities.Grid.Row,Smart.Grid.Column=Smart.Utilities.Grid.Column;
1496
1496
 
1497
1497
  /***/ }),
1498
1498
 
@@ -1513,7 +1513,7 @@ Smart.Utilities.Assign("Grid.Dialog",class{_createOverlay(){const e=document.cre
1513
1513
  /***/ 1378:
1514
1514
  /***/ (() => {
1515
1515
 
1516
- Smart.Utilities.Assign("Grid.Export",class{exportData(e,t,o){const a=this,l=new Smart.Utilities.DataExporter({exportHeader:a.dataExport.header}),r=[];l.expandChar=a.dataExport.expandChar,l.collapseChar=a.dataExport.collapseChar,l.pageOrientation=a.dataExport.pageOrientation,l.style=a.dataExport.style,l.filterBy=a.dataExport.filterBy,l.groupBy=a.dataExport.groupBy,l.addImageToCell=a.dataExport.addImageToCell,l.headerContent=a.dataExport.headerContent,l.footerContent=a.dataExport.footerContent,l.setRowHeight=a.dataExport.setRowHeight,l.cellFormatFunction=a.dataExport.cellFormatFunction,l.freezeHeader=a.dataExport.freezeHeader,l.exportAsTable=a.dataExport.exportAsTable,l.onlySelected=a.dataExport.onlySelected,l.autoConvertFormulas=a.dataExport.autoConvertFormulas;const n=a.columns.toArray().slice(0).filter((e=>!1!==e.allowExport));l.header={columns:n,columngroups:a.columnGroups.slice(0)};let i=a.dataExport.style;if(i&&(i=JSON.parse(JSON.stringify(i))),a.dataExport.style=null,!a.dataExport.style){const t=window.getComputedStyle(a),o=window.getComputedStyle(a.columns.length>0&&a.columns[0].element?a.columns[0].element:a.$.columnHeader),n=window.getComputedStyle(a.$.columnHeader),d=e=>{const t=e.fontSize,o=e.borderRightColor,a=e.backgroundColor,l=e.color,r=new Array("0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f");function n(e){return(e=e.match(/^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/))?"#"+i(e[1])+i(e[2])+i(e[3]).toUpperCase():"#ffffff"}function i(e){return isNaN(e)?"00":r[(e-e%16)/16]+r[e%16]}return{borderColor:n(o),fontSize:t,fontFamily:"Calibri",color:n(l),backgroundColor:n(a)}};if(0!==a.offsetWidth&&0!==a.offsetHeight){const c=d(t),s=d(o),p=d(n),f={height:a.$.columnHeader.offsetHeight+"px",border:"1px solid "+c.borderColor,fontFamily:p.fontFamily,fontSize:p.fontSize,color:p.color,backgroundColor:s.backgroundColor,fontWeight:"400"},u={border:"1px solid "+c.borderColor,fontFamily:c.fontFamily,fontSize:c.fontSize},m={height:a.layout.rowMinHeight+"px",verticalAlign:"center"};for(let t=0;t<a.columns.length;t++){const o=a.columns[t];if(!o.allowExport)continue;if(!o.visible)continue;f[o.dataField]={textAlign:o.align,verticalAlign:"center",width:o.computedWidth+"px",format:o.cellsFormat||""};let l=o.cellsFormat||"";l||("date"===o.dataType?l="d":"dateTime"===o.dataType?l="D":"time"===o.dataType&&(l="t")),a.locale&&l&&l.indexOf("c")>=0&&"xlsx"===e&&""!==a.locale&&"en"!==a.locale&&(l=a._getCurrencyByLocale(a.locale)+"x"+l);const n={textAlign:o.cellsAlign,format:l};if(u[o.dataField]=n,-1!==["html","jpeg","pdf","png","xlsx"].indexOf(e)&&(o.template||o.formatFunction||o.cellsClassName)&&a.dataExport.exportStyles){const e=a.behavior.allowRenderCache;a.behavior.allowRenderCache=!1,a._recycle();for(let e=0;e<a.rows.length;e++){const t=a.rows[e];let l=a.rows[e]["column_"+o.dataField];if(a.dataExport.viewStart&&e<a.dataExport.viewStart||a.dataExport.viewEnd&&e>a.dataExport.viewEnd)continue;if(!l||t&&t.element&&t.element.classList.contains("smart-hidden")){const e=a._rowElements[0];if(!e)continue;if(t.element=e,t.grid=a,t.render(),l=t["column_"+o.dataField],!l)continue}const n={};l.borderColor&&(n.border=l.borderColor),l.background&&(n.backgroundColor=l.background),l.color&&(n.color=l.color);const c=new Array("0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f"),s=e=>isNaN(e)?"00":c[(e-e%16)/16]+c[e%16],p=e=>e.startsWith("#")?e.length<6?e.toUpperCase()+e.substring(1):e.toUpperCase():(e=e.match(/^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/))?"#"+s(e[1])+s(e[2])+s(e[3]).toUpperCase():null;let f=l.value,u=l.value;if(l.className&&l.element){const e=d(window.getComputedStyle(l.element));n.backgroundColor=p(e.backgroundColor),n.color=p(e.color)}if(o.cellsClassName){let a=o.cellsClassName;if("function"==typeof o.cellsClassName&&(a=o.cellsClassName(e,o.dataField,f,t.data,t)),i&&i[a])i[a].color&&(n.color=i[a].color),i[a].backgroundColor&&(n.backgroundColor=i[a].backgroundColor),i[a].fontSize&&(n.fontSize=i[a].fontSize),i[a].fontStyle&&(n.fontStyle=i[a].fontStyle);else if(l.element){const e=d(window.getComputedStyle(l.element));n.backgroundColor=p(e.backgroundColor),n.color=p(e.color)}}else if(o.formatFunction){const e={id:t.id,row:t,column:o.dataField,value:l.value,cell:l};o.formatFunction(e),void 0!==e.value&&(u=e.value),e.cell.background&&(n.backgroundColor=p(e.cell.background)),e.cell.color&&(n.color=p(e.cell.color))}void 0!==a.dataExport.viewStart&&a.dataExport.viewStart,r[e]=Object.assign({},t.data),0!==Object.getOwnPropertyNames(n).length&&(m[e]||(m[e]={}),m[e][o.dataField]=n),l.element?r[e][o.dataField]=l.element.textContent:l.value!==u&&(r[e][o.dataField]=u)}a.behavior.allowRenderCache=e}}a.appearance.alternationCount>0&&(m.alternationCount=a.appearance.alternationCount,m.alternationStart=a.appearance.alternationStart,m.alternationEnd=a.appearance.alternationEnd,m.alternationIndex0Color=c.color,m.alternationIndex0BackgroundColor=c.backgroundColor,m.alternationIndex1Color=c.color,m.alternationIndex1BackgroundColor="#F5F5F5"),l.style={border:"1px solid "+c.borderColor,borderCollapse:"collapse",header:f,columns:u,rows:m}}}i&&(a.dataExport.style=i,l.style&&Object.assign(l.style,i));let d=!1;const c=!a.rowHierarchy||a.grouping.enabled?a.rows.toArray():a.rowHierarchy,s=a.dataExport.rowIds,p=null!==s;let f=[];if(a.dataExport.view)a._recyclingRows.forEach(((e,t)=>{if(a.dataExport.viewStart&&t<a.dataExport.viewStart||a.dataExport.viewEnd&&t>a.dataExport.viewEnd)return!0;r[t]?f.push(r[t]):f.push(e.data)}));else{for(let t=0;t<c.length;t++){const o=c[t];if(o.visible&&(!1!==o.filtered||void 0===o.filtered)){if(p&&-1===s.indexOf(o.id))continue;const t={};for(let l=0;l<a.columns.length;l++){const r=a.columns[l];if(!r.allowExport)continue;const n=r.dataField;let i=o.data[n];if("taskChecklist"===n)if(i){const e=i.map((e=>{let t=e.text;return e.completed?t="✓ "+t:t+="X "+t,t}));i=e.toString()}else i="";if("taskUserId"===n){const e=a.users.find((e=>e.id===parseInt(i)||parseInt(e.id)===parseInt(i)));e&&(i=e.name)}if("vote"===r.template){let e=[];a.users.forEach((t=>{i&&i.indexOf(t.id)>=0&&e.push(t.name)})),i=e.toString()}if(r.relationId&&!r.parentDataField){let e=r.editor.dataSource;r.relationId&&r.relationField&&r._isDirty&&(!r.editor.dataSource||r.editor.dataSource&&0===r.editor.dataSource.length)&&(e=a._getRelationData(r.relationId));const t=e[a.getCellValue(o.id,r.dataField)];if(t){const e=t[r.relationField];i=e}}if(r.parentDataField){const e=a.columnByDataField[r.parentDataField];if(e){let t=e.editor.dataSource;e.relationId&&e.relationField&&e._isDirty&&(!e.editor.dataSource||e.editor.dataSource&&0===e.editor.dataSource.length)&&(t=a._getRelationData(e.relationId));const l=t[a.getCellValue(o.id,r.parentDataField)];if(l){const e=l[r.cascadingDataField];i=e}}}if(void 0===i)if("createdBy"===r.template){const e=a.users.find((e=>e.id===o.createdBy));if(e){const o=e,a="string"==typeof o?o:o.name;t[n]=a}else t[n]=""}else if("createdTime"===r.template){const e=o.getCell(n).getFormattedValue(o.createdTime,"d")+" "+o.getCell(n).getFormattedValue(o.createdTime,"t");t[n]=e}else if("modifiedBy"===r.template){const e=a.users.find((e=>e.id===o.modifiedBy));if(e){const o=e,a="string"==typeof o?o:o.name;t[n]=a}else t[n]=""}else if("modifiedTime"===r.template){const e=o.getCell(n).getFormattedValue(o.modifiedTime,"d")+" "+o.getCell(n).getFormattedValue(o.modifiedTime,"t");t[n]=e}else t[n]="";else if(i&&i.indexOf&&(i.indexOf("{")>=0||"[]"===i)){const e=i.indexOf("{")>=0||"[]"===i?a.isJSON(i)?JSON.parse(i):[]:i.split(", "),o=[];for(let t=0;t<e.length;t++)if("string"==typeof e[t])o.push(e[t]);else{if("image"===r.template){d=!0,o.push(e[t].value);continue}o.push(e[t].label)}t[n]=o.join(",")}else if(i&&i.indexOf&&"image"===r.template){const e=i.indexOf("{")>=0||"[]"===i?a.isJSON(i)?JSON.parse(i):[]:i.split(","),o=[];d=!0;for(let t=0;t<e.length;t++)"string"==typeof e[t]?o.push(e[t]):(o.push(e[t].value),o.push(e[t].label));t[n]=o.join(",")}else if("csv"===e||"tsv"===e)if(r.cellsFormat){const e=o.getCell(n).getFormattedValue(i,r.cellsFormat);t[n]=e}else t[n]=i;else t[n]=i}f.push(t)}}c!==a.rowHierarchy||p||(f=a.dataSource.boundHierarchy,l.hierarchical=!0)}if(!a.dataExport.groupBy&&a.grouping.enabled&&a.dataSource&&a.dataSource.groupBy&&(l.groupBy=a.dataSource.groupBy&&a.dataSource.groupBy.toArray?a.dataSource.groupBy.toArray():null),a.dataExport.onlySelected&&a.selection.enabled)if(a.selection.allowCellSelection){const e=a.getSelectedCells(),t=[],o=[],r=[];for(let l=0;l<e.length;l++){const n=e[l],i=n[0],d=n[1],c=f[i][d];r[d]||o.push(a.columnByDataField[d]),r[d]=!0,t[i]||(t[i]={}),t[i][d]||(t[i][d]=c)}o.sort(((e,t)=>e<t?-1:e>t?1:0));for(let e in t){const a=t[e];for(let e=0;e<o.length;e++){const t=o[e];void 0===a[t.dataField]&&(a[t.dataField]="")}}l.header={columns:[...o]},f=Object.values(t)}else{const e=a.getSelectedRowIds(),t=[];for(let o=0;o<e.length;o++){const a=e[o];t.push(f[a])}f=t}if(a.checkLicense(!0),o){const t=o(f,l,e);t&&(f=t)}if(a.dataExport.cellFormatFunction)for(let e=0;e<f.length;e++){const t=f[e];for(let o=0;o<a.columns.length;o++){const l=a.columns[o];if(!l.allowExport)continue;const r=l.dataField;let n=t[r];const i=a.dataExport.cellFormatFunction(e,r,n);i&&(t[r]=i)}}if(!a.dataExport.addImageToCell&&d){const o=async e=>{const t=await fetch(e),o=await t.blob();return new Promise(((e,t)=>{const a=new FileReader;a.readAsDataURL(o),a.onloadend=()=>{const t=a.result;e(t)},a.onerror=t}))};let r=0,i=0;const d=()=>{l.addImageToCell=(e,t,o,l,r,n)=>{if("image"!==a.columnByDataField[t].template||!o)return;let i="jpeg";return o.indexOf("png")>=0&&(i="png"),{image:{id:"myImage"+e,base64:o,imageType:i,width:20,height:11,position:{offsetX:10+25*n,offsetY:5.5}},value:o}},l.exportData(f,e,a.dataExport.fileName,t),a.dataExport.view&&a._recycle(!1)};f.length;let c=!1;for(let e=0;e<f.length;e++){const t=f[e];for(let e=0;e<n.length;e++){const a=n[e];if("image"===a.template){let e=t[a.dataField],l=[];if(!e)continue;if(e.indexOf(",")>=0){l=e.split(",");let t=[];if(l[0].indexOf("data:image")>=0)for(let e=0;e<l.length;e+=2){const o=l[e]+","+l[e+1];t.push(o)}t.length&&(l=t)}else l=[e];t[a.dataField]=l,r+=l.length;for(let e=0;e<l.length;e++){const t=l[e];t.indexOf("data:image")>=0?i++:(c=!0,o(t).then((t=>{l[e]=t,i++,i===r&&d()})))}}}}return void(i===r&&!1===c&&d())}if(!f.length)return[];if(a.dataExport.getSpreadsheets){const t=a.dataExport.getSpreadsheets();if(t){l.spreadsheets=t;const o=l.style.header,r=l.style.columns;for(let l=0;l<t.length;l++){const n=t[l].columns;for(let t=0;t<n.length;t++){let l=n[t];if("string"==typeof l&&(l={label:l,dataField:l,allowExport:!0,visible:!0}),void 0!==l.allowExport&&!l.allowExport)continue;if(void 0!==l.visible&&!l.visible)continue;o[l.dataField]={textAlign:l.align||"left",verticalAlign:"center",width:l.computedWidth?l.computedWidth+"px":"100px",format:l.cellsFormat||""};let i=l.cellsFormat||"";i||("date"===l.dataType?i="d":"dateTime"===l.dataType?i="D":"time"===l.dataType&&(i="t")),a.locale&&i&&i.indexOf("c")>=0&&"xlsx"===e&&""!==a.locale&&"en"!==a.locale&&(i=a._getCurrencyByLocale(a.locale)+"x"+i);const d={textAlign:l.cellsAlign||"left",format:i};r[l.dataField]=d}}}}let u="";if(a.dataExport.formatData){const o=o=>{l.exportData(o,e,a.dataExport.fileName,t),a._recycle(!1)};a.dataExport.formatData([...f],n,a.getData(),o)}else u=l.exportData(f,e,a.dataExport.fileName,t);return a.dataExport.view&&a._recycle(!1),u}print(){const e=this,t=e.dataExport.fileName;e.dataExport.fileName=null;const o=e.exportData("html"),a=window.open("","","width=800,height=500"),l=a.document.open(),r='<!DOCTYPE html><html><head><meta charset="utf-8" /><title>'+t+"</title></head><body>"+o+"</body></html>";try{l.write(r),l.close(),a.onload=()=>{a.print(),a.close()}}catch(e){}e.dataExport.fileName=t}});
1516
+ Smart.Utilities.Assign("Grid.Export",class{exportData(e,t,o){const a=this,l=new Smart.Utilities.DataExporter({exportHeader:a.dataExport.header}),r=[];l.expandChar=a.dataExport.expandChar,l.collapseChar=a.dataExport.collapseChar,l.pageOrientation=a.dataExport.pageOrientation,l.style=a.dataExport.style,l.filterBy=a.dataExport.filterBy,l.groupBy=a.dataExport.groupBy,l.addImageToCell=a.dataExport.addImageToCell,l.headerContent=a.dataExport.headerContent,l.footerContent=a.dataExport.footerContent,l.setRowHeight=a.dataExport.setRowHeight,l.cellFormatFunction=a.dataExport.cellFormatFunction,l.freezeHeader=a.dataExport.freezeHeader,l.exportAsTable=a.dataExport.exportAsTable,l.onlySelected=a.dataExport.onlySelected,l.autoConvertFormulas=a.dataExport.autoConvertFormulas;const n=a.columns.toArray().slice(0).filter((e=>!1!==e.allowExport));l.header={columns:n,columngroups:a.columnGroups.slice(0)};let i=a.dataExport.style;if(i&&(i=JSON.parse(JSON.stringify(i))),a.dataExport.style=null,!a.dataExport.style){const t=window.getComputedStyle(a),o=window.getComputedStyle(a.columns.length>0&&a.columns[0].element?a.columns[0].element:a.$.columnHeader),n=window.getComputedStyle(a.$.columnHeader),d=e=>{const t=e.fontSize,o=e.borderRightColor,a=e.backgroundColor,l=e.color,r=new Array("0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f");function n(e){return(e=e.match(/^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/))?"#"+i(e[1])+i(e[2])+i(e[3]).toUpperCase():"#ffffff"}function i(e){return isNaN(e)?"00":r[(e-e%16)/16]+r[e%16]}return{borderColor:n(o),fontSize:t,fontFamily:"Calibri",color:n(l),backgroundColor:n(a)}};if(0!==a.offsetWidth&&0!==a.offsetHeight){const c=d(t),s=d(o),p=d(n),f={height:a.$.columnHeader.offsetHeight+"px",border:"1px solid "+c.borderColor,fontFamily:p.fontFamily,fontSize:p.fontSize,color:p.color,backgroundColor:s.backgroundColor,fontWeight:"400"},u={border:"1px solid "+c.borderColor,fontFamily:c.fontFamily,fontSize:c.fontSize},m={height:a.layout.rowMinHeight+"px",verticalAlign:"center"};for(let t=0;t<a.columns.length;t++){const o=a.columns[t];if(!o.allowExport)continue;if(!o.visible)continue;f[o.dataField]={textAlign:o.align,verticalAlign:"center",width:o.computedWidth+"px",format:o.cellsFormat||""};let l=o.cellsFormat||"";l||("date"===o.dataType?l="d":"dateTime"===o.dataType?l="D":"time"===o.dataType&&(l="t")),a.locale&&l&&l.indexOf("c")>=0&&"xlsx"===e&&""!==a.locale&&"en"!==a.locale&&(l=a._getCurrencyByLocale(a.locale)+"x"+l);const n={textAlign:o.cellsAlign,format:l};if(u[o.dataField]=n,-1!==["html","jpeg","pdf","png","xlsx"].indexOf(e)&&(o.template||o.formatFunction||o.cellsClassName)&&a.dataExport.exportStyles){const e=a.behavior.allowRenderCache;a.behavior.allowRenderCache=!1,a._recycle();for(let e=0;e<a.rows.length;e++){const t=a.rows[e];let l=a.rows[e]["column_"+o.dataField];if(a.dataExport.viewStart&&e<a.dataExport.viewStart||a.dataExport.viewEnd&&e>a.dataExport.viewEnd)continue;if(!l||t&&t.element&&t.element.classList.contains("smart-hidden")){const e=a._rowElements[0];if(!e)continue;if(t.element=e,t.grid=a,t.render(),l=t["column_"+o.dataField],!l)continue}const n={};l.borderColor&&(n.border=l.borderColor),l.background&&(n.backgroundColor=l.background),l.color&&(n.color=l.color);const c=new Array("0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f"),s=e=>isNaN(e)?"00":c[(e-e%16)/16]+c[e%16],p=e=>e.startsWith("#")?e.length<6?e.toUpperCase()+e.substring(1):e.toUpperCase():(e=e.match(/^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/))?"#"+s(e[1])+s(e[2])+s(e[3]).toUpperCase():null;let f=l.value,u=l.value;if(l.className&&l.element){const e=d(window.getComputedStyle(l.element));n.backgroundColor=p(e.backgroundColor),n.color=p(e.color)}if(o.cellsClassName){let a=o.cellsClassName;if("function"==typeof o.cellsClassName&&(a=o.cellsClassName(e,o.dataField,f,t.data,t)),i&&i[a])i[a].color&&(n.color=i[a].color),i[a].backgroundColor&&(n.backgroundColor=i[a].backgroundColor),i[a].fontSize&&(n.fontSize=i[a].fontSize),i[a].fontStyle&&(n.fontStyle=i[a].fontStyle);else if(l.element){const e=d(window.getComputedStyle(l.element));n.backgroundColor=p(e.backgroundColor),n.color=p(e.color)}}else if(o.formatFunction){const e={id:t.id,row:t,column:o.dataField,value:l.value,cell:l};o.formatFunction(e),void 0!==e.value&&(u=e.value),e.cell.background&&(n.backgroundColor=p(e.cell.background)),e.cell.color&&(n.color=p(e.cell.color))}void 0!==a.dataExport.viewStart&&a.dataExport.viewStart,r[e]=Object.assign({},t.data),0!==Object.getOwnPropertyNames(n).length&&(m[e]||(m[e]={}),m[e][o.dataField]=n),l.element?r[e][o.dataField]=l.element.textContent:l.value!==u&&(r[e][o.dataField]=u)}a.behavior.allowRenderCache=e}}a.appearance.alternationCount>0&&(m.alternationCount=a.appearance.alternationCount,m.alternationStart=a.appearance.alternationStart,m.alternationEnd=a.appearance.alternationEnd,m.alternationIndex0Color=c.color,m.alternationIndex0BackgroundColor=c.backgroundColor,m.alternationIndex1Color=c.color,m.alternationIndex1BackgroundColor="#F5F5F5"),l.style={border:"1px solid "+c.borderColor,borderCollapse:"collapse",header:f,columns:u,rows:m}}}i&&(a.dataExport.style=i,l.style&&Object.assign(l.style,i));let d=!1;const c=!a.rowHierarchy||a.grouping.enabled?a.rows.toArray():a.rowHierarchy,s=a.dataExport.rowIds,p=null!==s;let f=[];if(a.dataExport.view)a._recyclingRows.forEach(((e,t)=>{if(a.dataExport.viewStart&&t<a.dataExport.viewStart||a.dataExport.viewEnd&&t>a.dataExport.viewEnd)return!0;r[t]?f.push(r[t]):f.push(e.data)}));else{for(let t=0;t<c.length;t++){const o=c[t];if(o.visible&&(!1!==o.filtered||void 0===o.filtered)){if(p&&-1===s.indexOf(o.id))continue;const t={};for(let l=0;l<a.columns.length;l++){const r=a.columns[l];if(!r.allowExport)continue;const n=r.dataField;let i=o.data[n];if("taskChecklist"===n)if(i){const e=i.map((e=>{let t=e.text;return e.completed?t="✓ "+t:t+="X "+t,t}));i=e.toString()}else i="";if("taskUserId"===n){const e=a.users.find((e=>e.id===parseInt(i)||parseInt(e.id)===parseInt(i)));e&&(i=e.name)}if("vote"===r.template){let e=[];a.users.forEach((t=>{i&&i.indexOf(t.id)>=0&&e.push(t.name)})),i=e.toString()}if(r.relationId&&!r.parentDataField){let e=r.editor.dataSource;r.relationId&&r.relationField&&r._isDirty&&(!r.editor.dataSource||r.editor.dataSource&&0===r.editor.dataSource.length)&&(e=a._getRelationData(r.relationId));const t=e[a.getCellValue(o.id,r.dataField)];if(t){const e=t[r.relationField];i=e}}if(r.parentDataField){const e=a.columnByDataField[r.parentDataField];if(e){let t=e.editor.dataSource;e.relationId&&e.relationField&&e._isDirty&&(!e.editor.dataSource||e.editor.dataSource&&0===e.editor.dataSource.length)&&(t=a._getRelationData(e.relationId));const l=t[a.getCellValue(o.id,r.parentDataField)];if(l){const e=l[r.cascadingDataField];i=e}}}if(void 0===i)if("createdBy"===r.template){const e=a.users.find((e=>e.id===o.createdBy));if(e){const o=e,a="string"==typeof o?o:o.name;t[n]=a}else t[n]=""}else if("createdTime"===r.template){const e=o.getCell(n).getFormattedValue(o.createdTime,"d")+" "+o.getCell(n).getFormattedValue(o.createdTime,"t");t[n]=e}else if("modifiedBy"===r.template){const e=a.users.find((e=>e.id===o.modifiedBy));if(e){const o=e,a="string"==typeof o?o:o.name;t[n]=a}else t[n]=""}else if("modifiedTime"===r.template){const e=o.getCell(n).getFormattedValue(o.modifiedTime,"d")+" "+o.getCell(n).getFormattedValue(o.modifiedTime,"t");t[n]=e}else t[n]="";else if(i&&i.indexOf&&(i.indexOf("{")>=0||"[]"===i)){const e=i.indexOf("{")>=0||"[]"===i?a.isJSON(i)?JSON.parse(i):[]:i.split(", "),o=[];for(let t=0;t<e.length;t++)if("string"==typeof e[t])o.push(e[t]);else{if("image"===r.template){d=!0,o.push(e[t].value);continue}o.push(e[t].label)}t[n]=o.join(",")}else if(i&&i.indexOf&&"image"===r.template){const e=i.indexOf("{")>=0||"[]"===i?a.isJSON(i)?JSON.parse(i):[]:i.split(","),o=[];d=!0;for(let t=0;t<e.length;t++)"string"==typeof e[t]?o.push(e[t]):(o.push(e[t].value),o.push(e[t].label));t[n]=o.join(",")}else if("csv"===e||"tsv"===e)if(r.cellsFormat){const e=o.getCell(n).getFormattedValue(i,r.cellsFormat);t[n]=e}else t[n]=i;else t[n]=i}f.push(t)}}c!==a.rowHierarchy||p||(f=[...a.dataSource.boundHierarchy],l.hierarchical=!0)}if(!a.dataExport.groupBy&&a.grouping.enabled&&a.dataSource&&a.dataSource.groupBy&&(l.groupBy=a.dataSource.groupBy&&a.dataSource.groupBy.toArray?a.dataSource.groupBy.toArray():null),a.dataExport.onlySelected&&a.selection.enabled)if(a.selection.allowCellSelection){const e=a.getSelectedCells(),t=[],o=[],r=[];for(let l=0;l<e.length;l++){const n=e[l],i=n[0],d=n[1],c=f[i][d];r[d]||o.push(a.columnByDataField[d]),r[d]=!0,t[i]||(t[i]={}),t[i][d]||(t[i][d]=c)}o.sort(((e,t)=>e<t?-1:e>t?1:0));for(let e in t){const a=t[e];for(let e=0;e<o.length;e++){const t=o[e];void 0===a[t.dataField]&&(a[t.dataField]="")}}l.header={columns:[...o]},f=Object.values(t)}else{const e=a.getSelectedRowIds(),t=[];for(let o=0;o<e.length;o++){const a=e[o];t.push(f[a])}f=t}if(a.checkLicense(!0),o){const t=o(f,l,e);t&&(f=t)}if(a.dataExport.cellFormatFunction){const e=e=>{let t={};for(let o=0;o<a.columns.length;o++){const l=a.columns[o];t[l.dataField]=e[l.dataField]}return t=JSON.parse(JSON.stringify(t)),e.children&&(t.children=e.children),t};if(l.hierarchical){const t=(o,a,l)=>{o=e(o);for(let e=0;e<a.length;e++){const t=a[e];if(!t.allowExport)continue;const r=t.dataField,n=l(0,r,o[r]);null!=n&&(o[r]=n)}if(o.children&&Array.isArray(o.children)){let e=0;for(const r of o.children){const n=t(r,a,l);o.children[e]=n,e++}}return o};for(let e=0;e<f.length;e++){let o=f[e];const l=t(o,a.columns,a.dataExport.cellFormatFunction);f[e]=l}}else for(let t=0;t<f.length;t++){let o=f[t];o=e(o);for(let e=0;e<a.columns.length;e++){const l=a.columns[e];if(!l.allowExport)continue;const r=l.dataField;let n=o[r];const i=a.dataExport.cellFormatFunction(t,r,n);i&&(o[r]=i)}}}if(!a.dataExport.addImageToCell&&d){const o=async e=>{const t=await fetch(e),o=await t.blob();return new Promise(((e,t)=>{const a=new FileReader;a.readAsDataURL(o),a.onloadend=()=>{const t=a.result;e(t)},a.onerror=t}))};let r=0,i=0;const d=()=>{l.addImageToCell=(e,t,o,l,r,n)=>{if("image"!==a.columnByDataField[t].template||!o)return;let i="jpeg";return o.indexOf("png")>=0&&(i="png"),{image:{id:"myImage"+e,base64:o,imageType:i,width:20,height:11,position:{offsetX:10+25*n,offsetY:5.5}},value:o}},l.exportData(f,e,a.dataExport.fileName,t),a.dataExport.view&&a._recycle(!1)};f.length;let c=!1;for(let e=0;e<f.length;e++){const t=f[e];for(let e=0;e<n.length;e++){const a=n[e];if("image"===a.template){let e=t[a.dataField],l=[];if(!e)continue;if(e.indexOf(",")>=0){l=e.split(",");let t=[];if(l[0].indexOf("data:image")>=0)for(let e=0;e<l.length;e+=2){const o=l[e]+","+l[e+1];t.push(o)}t.length&&(l=t)}else l=[e];t[a.dataField]=l,r+=l.length;for(let e=0;e<l.length;e++){const t=l[e];t.indexOf("data:image")>=0?i++:(c=!0,o(t).then((t=>{l[e]=t,i++,i===r&&d()})))}}}}return void(i===r&&!1===c&&d())}if(!f.length)return[];if(a.dataExport.getSpreadsheets){const t=a.dataExport.getSpreadsheets();if(t){l.spreadsheets=t;const o=l.style.header,r=l.style.columns;for(let l=0;l<t.length;l++){const n=t[l].columns;for(let t=0;t<n.length;t++){let l=n[t];if("string"==typeof l&&(l={label:l,dataField:l,allowExport:!0,visible:!0}),void 0!==l.allowExport&&!l.allowExport)continue;if(void 0!==l.visible&&!l.visible)continue;o[l.dataField]={textAlign:l.align||"left",verticalAlign:"center",width:l.computedWidth?l.computedWidth+"px":"100px",format:l.cellsFormat||""};let i=l.cellsFormat||"";i||("date"===l.dataType?i="d":"dateTime"===l.dataType?i="D":"time"===l.dataType&&(i="t")),a.locale&&i&&i.indexOf("c")>=0&&"xlsx"===e&&""!==a.locale&&"en"!==a.locale&&(i=a._getCurrencyByLocale(a.locale)+"x"+i);const d={textAlign:l.cellsAlign||"left",format:i};r[l.dataField]=d}}}}let u="";if(a.dataExport.formatData){const o=o=>{l.exportData(o,e,a.dataExport.fileName,t),a._recycle(!1)};a.dataExport.formatData([...f],n,a.getData(),o)}else u=l.exportData(f,e,a.dataExport.fileName,t);return a.dataExport.view&&a._recycle(!1),u}print(){const e=this,t=e.dataExport.fileName;e.dataExport.fileName=null;const o=e.exportData("html"),a=window.open("","","width=800,height=500"),l=a.document.open(),r='<!DOCTYPE html><html><head><meta charset="utf-8" /><title>'+t+"</title></head><body>"+o+"</body></html>";try{l.write(r),l.close(),a.onload=()=>{a.print(),a.close()}}catch(e){}e.dataExport.fileName=t}});
1517
1517
 
1518
1518
  /***/ }),
1519
1519
 
@@ -1618,7 +1618,7 @@ Smart("smart-input",class extends Smart.BaseElement{static get properties(){retu
1618
1618
  /***/ 7498:
1619
1619
  /***/ (() => {
1620
1620
 
1621
- Smart("smart-kanban",class extends Smart.DataView{static get properties(){return{addNewButton:{value:!1,type:"boolean"},addNewButtonDisplayMode:{value:"top",allowedValues:["top","bottom","both"],type:"string"},addNewColumn:{value:!1,type:"boolean"},autoColumnHeight:{value:!1,type:"boolean"},applyColumnColorToTasks:{value:!1,type:"boolean"},addNewColumnWidth:{value:null,type:"any"},allowColumnEdit:{value:!1,type:"boolean"},allowColumnHide:{value:!0,type:"boolean"},allowColumnRemove:{value:!1,type:"boolean"},allowColumnReorder:{value:!1,type:"boolean"},allowCustomTags:{value:!0,type:"boolean"},allowDrag:{value:!0,type:"boolean",defaultReflectToAttribute:!0},allowDrop:{value:!0,type:"boolean",defaultReflectToAttribute:!0},allowDropPlaceholder:{value:!1,type:"boolean",defaultReflectToAttribute:!0},autoLoadState:{value:!1,type:"boolean"},autoSaveState:{value:!1,type:"boolean"},cardHeight:{value:null,type:"number?"},currentUser:{value:null,type:"any"},columnColorEntireSurface:{value:!1,type:"boolean"},columnFooter:{value:!1,type:"boolean"},columnActions:{value:!1,type:"boolean"},columnColors:{value:!1,type:"boolean"},columnWidth:{value:null,type:"any"},columnSummary:{value:!1,type:"boolean"},columnEditMode:{value:"headerAndMenu",allowedValues:["header","menu","headerAndMenu"],type:"string"},columnHeaderTemplate:{value:null,type:"any"},disableDialog:{value:!1,type:"boolean"},disableAddNewDialog:{value:!1,type:"boolean"},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},editable:{value:!1,type:"boolean"},editMode:{value:"doubleClick",allowedValues:["singleClick","doubleClick"],type:"string"},dragOffset:{value:"auto",type:"any"},formatStringDate:{value:"d",type:"string"},formatStringTime:{value:"MMM d, HH:mm",type:"string"},hierarchy:{value:"columns",allowedValues:["columns","tabs"],type:"string"},messages:{value:{en:{actionsIcon:"Actions icon",actionsList:"Open actions list",unassignedTask:"Unassigned task",unassigned:"unassigned",assignedTask:"Assigned to {{userName}}",addNewStatus:"New status",addNewColumn:"Add new status",addNewTask:"Add new task",addSubtask:"Add subtask",assignedTo:"Assigned to",createdBy:"Created by",updatedBy:"Updated by",createdByDate:"Created",updatedByDate:"Updated",checklist:"Sub tasks",color:"Color",commentsIcon:"Comments icon",copy:"Copy",customize:"Customize tasks",customizeColumn:"Customize column",dueDate:"Due date",days:"days",edit:"Edit",editTask:"ID: {{taskId}} {{text}}",expand:"Expand column",collapse:"Collapse column",high:"High",low:"Low",critical:"Critical",newComment:"New comment",newSubtask:"New subtask",overdue:"Overdue",average:"Average",priority:"Priority",priorityIcon:"Priority icon",progress:"Progress",promptComment:"Are you sure you want to remove this comment?",promptTask:'Are you sure you want to remove the task "{{taskText}}"?',promptColumn:"Are you sure you want to remove this column?",remove:"Remove",removeSubtask:"Remove subtask",removeColumn:"Remove column",hideColumn:"Hide column",removeComment:"Remove comment",removeTask:"Remove task",showAllColumns:"Show all columns",send:"Send",startDate:"Start date",status:"Status",swimlane:"Swimlane",tags:"Tags",text:"Name",textPlaceholder:"Write a task name",description:"Description",taskProgress:"Task progress: {{value}}%",taskDescription:"Task description: {{value}}",taskCompleted:"Tasks completed: {{value}}/{{count}}",tasksSummary:"{{summary}} tasks",tasksSummaryOne:"1 task",userId:"User ID",userIcon:"User icon",guestUser:"Guest",detailsTab:"Details",commentsTab:"Comments",fieldsTab:"Fields",historyTab:"History",subtasksTab:"Subtasks",historyEvent:"Event",historyAuthor:"Author",historyDetails:"Details",range:'From "{{oldValue}}" to "{{newValue}}"',nullRange:'Changed to "{{newValue}}"',invalidRange:'"{{start}}" should be less than "{{end}}"',historyDate:"Date",ok:"ok",cancel:"Cancel",delete:"Delete",taskDeadlineChanged:"Deadline changed",tagsChanged:"Tags changed",taskMoved:"Task moved",taskUpdated:"Task updated",taskCreated:"Task created",taskUserChanged:"Assignee changed",taskUserRemoved:"Assignee removed",taskDescriptionChanged:"Description changed",taskSubtasksChanged:"Subtasks changed",taskProgressChanged:"Progress changed",taskPriorityChanged:"Priority changed",taskSubtasksCompleted:"Completed {{value}}",taskStatusChanged:"Status changed",taskTagsChanged:"Tags changed",taskNameChanged:"Name changed",taskColorChanged:"Color changed",empty:"No tasks",emptyTags:"No tags available",emptyImage:"No image to display",emptyAttachment:"No attachment to display"}}},onColumnHeaderRender:{value:null,type:"any",reflectToAttribute:!1},onColumnFooterRender:{value:null,type:"any",reflectToAttribute:!1},onTaskRender:{value:null,type:"any",reflectToAttribute:!1},onSortPrepare:{value:null,type:"any",reflectToAttribute:!1},onFilterPrepare:{value:null,type:"any",reflectToAttribute:!1},priority:{value:[],type:"array",reflectToAttribute:!1},priorityList:{value:!0,type:"boolean"},readonly:{value:!1,type:"boolean"},selectionMode:{value:"zeroOrOne",allowedValues:["zeroOrOne","zeroOrManyExtended"],type:"string"},storeHistory:{value:!0,type:"boolean"},storeHistoryItems:{value:20,type:"number"},swimlanes:{value:[],type:"array",reflectToAttribute:!1},swimlanesFrom:{value:0,type:"number"},swimlanesTo:{value:null,type:"number?"},tags:{value:[],type:"array"},taskActions:{value:!1,type:"boolean"},taskActionsRendered:{value:null,type:"any"},taskComments:{value:!1,type:"boolean"},taskDue:{value:!1,type:"boolean"},taskPosition:{value:"all",allowedValues:["all","leaf"],type:"string"},taskPriority:{value:!0,type:"boolean",defaultReflectToAttribute:!0},taskProgress:{value:!1,type:"boolean"},taskTags:{value:!0,type:"boolean",defaultReflectToAttribute:!0},taskSubTasks:{allowedValues:["none","onePerRow","onlyUnfinished"],value:"none",type:"string"},taskSubTasksInput:{value:!0,type:"boolean"},taskUserIcon:{value:!0,type:"boolean",defaultReflectToAttribute:!0},taskCustomFields:{value:[],type:"array",reflectToAttribute:!1},taskCustomFieldsHide:{value:!1,type:"boolean"},taskColor:{value:!0,type:"boolean"},taskColorEntireSurface:{value:!1,type:"boolean"},textTemplate:{value:null,type:"any"},userList:{value:!1,type:"boolean"},users:{value:[],type:"array",reflectToAttribute:!1},dialogCustomizationFunction:{value:null,type:"any"},dialogRendered:{value:null,type:"any"},dialogEditors:{value:["checklist","color","dueDate","priority","progress","startDate","status","swimlane","tags","text","description","userId"],type:"any"}}}static get listeners(){return{"body.focusin":"_bodyFocusinHandler",keyup:"_keyupHandler","container.click":"_containerClickHandler","container.down":"_containerDownHandler","container.keydown":"_containerKeydownHandler","container.touchmove":"_scrollViewerTouchmoveHandler","container.wheel":"_mouseWheelHandler"}}template(){const e=this._tabindex;return`<div id="container" role="presentation">\n <div id="header" class="smart-data-view-header" role="toolbar">\n <div id="customizeButton" class="smart-data-view-header-button smart-data-view-customize-button smart-unselectable"${e} role="button" aria-expanded="false" aria-haspopup="dialog" aria-label="Customize tasks"><div role="presentation"></div></div>\n <div id="filterButton" class="smart-data-view-header-button smart-data-view-filter-button smart-unselectable"${e} role="button" aria-expanded="false" aria-haspopup="dialog" aria-label="Filter"><div role="presentation"></div></div>\n <div id="sortButton" class="smart-data-view-header-button smart-data-view-sort-button smart-unselectable"${e} role="button" aria-expanded="false" aria-haspopup="dialog" aria-label="Sort"><div role="presentation"></div></div>\n <div id="searchButton" class="smart-data-view-header-button smart-data-view-search-button smart-unselectable"${e} role="button" aria-expanded="false" aria-haspopup="dialog" aria-label="Search"></div>\n <div id="headerDropDown" class="smart-data-view-header-drop-down smart-visibility-hidden" role="dialog">\n <div id="customize" class="smart-hidden" role="presentation"></div>\n <div id="filter" class="smart-hidden" role="presentation"></div>\n <div id="sort" class="smart-hidden" role="presentation"></div>\n <div id="search" class="smart-data-view-search-box smart-hidden" role="presentation">\n <input type="text" id="searchInput" spellcheck="false" aria-label="Search" />\n <div id="searchLabel" class="smart-data-view-search-label smart-unselectable"></div>\n <div id="searchPrev" class="smart-data-view-search-prev"${e} role="button" aria-label="Previous"></div>\n <div id="searchNext" class="smart-data-view-search-next"${e} role="button" aria-label="Next"></div>\n <div id="searchClose" class="smart-data-view-search-close"${e} role="button" aria-label="Close search box"></div>\n </div>\n </div>\n </div>\n <smart-scroll-viewer auto-refresh vertical-scroll-bar-visibility="hidden" class="smart-kanban-scroll-viewer" id="scrollViewer">\n <div id="body" class="smart-kanban-body" role="presentation"></div>\n </smart-scroll-viewer>\n </div>`}_mouseWheelNative(e,t){const a=this;void 0===a._scrollWheelContent&&(a._scrollWheelContent=document.createElement("div"),a._scrollWheelContent.style.width="100%",a._scrollWheelContent.style.height="100%",a._scrollWheelContent.style.position="absolute",a._scrollWheelContent.style.left="0px",a._scrollWheelContent.style.top="0px",a._scrollWheelContent.style.background="white",a._scrollWheelContent.style.zIndex=9999,a._scrollWheelContent.style.opacity=0,a._scrollWheelContent.style.overflow="auto",a._scrollWheelContent.style.visibility="hidden");let s=0;const l=()=>{if(t){const t=a._scrollWheelContent.scrollLeft;a._scrollView.hScrollBar.value=t,t===e&&a._scrollWheelContent.remove()}else{const t=a._scrollWheelContent.scrollTop;a._scrollView.vScrollBar.value=t,t===e&&a._scrollWheelContent.remove()}};a._scrollWheelContent.onscroll=()=>{cancelAnimationFrame(s),s=0,s=requestAnimationFrame(l)},a._scrollWheelContentView||(a._scrollWheelContentView=document.createElement("div"),a._scrollWheelContent.appendChild(a._scrollWheelContentView)),a._scrollWheelContentView.style.width=a.offsetWidth+a._scrollView.scrollWidth+"px",a._scrollWheelContentView.style.height=a.offsetHeight+a._scrollView.scrollHeight+"px",a.$.container.appendChild(a._scrollWheelContent),a._scrollWheelContent.scrollTop=a._scrollView.vScrollBar.value,a._scrollWheelContent.scrollLeft=a._scrollView.hScrollBar.value,!0===t?a._scrollWheelContent.scrollTo({top:a._scrollView.vScrollBar.value,left:e,behavior:"smooth"}):a._scrollWheelContent.scrollTo({top:e,left:a._scrollView.hScrollBar.value,behavior:"smooth"})}_mouseWheelHandler(e){const t=this,a=e.target;if(t.disabled||a.closest(".smart-scheduler-window-modal"))return;if(t._scrollView||(t._scrollView=new Smart.Utilities.Scroll(t.$.scrollViewer,t.$.scrollViewer.$.horizontalScrollBar,t.$.scrollViewer.$.verticalScrollBar)),t._scrollView.hScrollBar.$.hasClass("smart-hidden")&&t._scrollView.vScrollBar.$.hasClass("smart-hidden"))return;if(42===e.pointerId)return;let s=!1;if(e.wheelDeltaY?120!==Math.abs(e.wheelDeltaY)&&240!==Math.abs(e.wheelDeltaY)&&360!==Math.abs(e.wheelDeltaY)&&(s=!0):0===e.deltaMode&&(s=!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 a=160;const l=0===e.deltaX?e.wheelDelta:e.deltaX;l<0&&(a=-160),Math.abs(l)>=100&&!s&&!Smart.Utilities.Core.Browser.Firefox?t._mouseWheelNative(t._scrollView.scrollLeft+a,!0):t._scrollView.scrollLeft+=l}}else{const a=t.scrollTop;if(0===a&&e.deltaY<0||a===t.scrollHeight&&e.deltaY>0)return;e.stopPropagation(),e.preventDefault();let l=450;if(e.deltaY<=0&&(l=-450),Math.abs(e.deltaY)>=100&&!s&&!Smart.Utilities.Core.Browser.Firefox)t._mouseWheelNative(t._scrollView.scrollTop+l);else{t._wheelrafId=0;const a=()=>{t._scrollView.scrollTop+=e.deltaY};cancelAnimationFrame(t._wheelrafId),t._wheelrafId=0,t._wheelrafId=requestAnimationFrame(a)}}}_keyupHandler(e){const t=this;if("Escape"===e.key&&t._dragDetails){const e=t._dragDetails,a=Smart.Kanban.hoveredKanban,s=Smart.Kanban.hoveredItem;delete t._dragDetails,delete Smart.Kanban.kanbanTaskDragged,delete Smart.Kanban.hoveredKanban,delete Smart.Kanban.hoveredItem,e.ScrollViewer&&e.ScrollViewer._scrollView&&(e.ScrollViewer._scrollView.disableSwipeScroll=!1);let l=!1;if(document.querySelectorAll(".smart-kanban-task-placeholder").forEach((e=>{e.classList.remove("smart-kanban-task-placeholder"),e.style.marginTop=e.style.marginBottom="0px",l=!0})),l&&t._refreshButtonsAndSummaries(),!e.FeedbackShown)return;a&&clearInterval(a._dragInterval),t._preventSelection=!0;const r=t.isInShadowDOM?t.getRootNode().host:document.body;return r.classList.remove("smart-dragging"),r.style.overflow=t._originalBodyOverflow.overflow,r.style.eoverflowX=t._originalBodyOverflow.overflowX,r.style.overflowY=t._originalBodyOverflow.overflowY,delete t._originalBodyOverflow,e.Feedback.remove(),e.Items.forEach((e=>e.classList.remove("dragged"))),s.classList.remove("drop-target"),void(s.classList.contains("before")?s.classList.remove("before"):s.classList.contains("after")&&s.classList.remove("after"))}}render(){const e=this;Object.defineProperty(e,"dataSource",{get:function(){return e.context===e?e.properties.dataSource.value:e._getCurrentDataSource()},set(t){e.updateProperty(e,e._properties.dataSource,t)}}),e.isInitialized=!1,e._render(),super.render(),e.isInitialized=!0}_getPriority(){const e=this;if(!e.priority||e.priority&&0===e.priority.length)e.priority=[{menuIcon:'<span style="margin-left: 0px; margin-right: 5px;" class="priority"></span>',label:"",value:""},{menuIcon:'<span style="margin-left: 0px; margin-right: 5px;" class="priority low"></span>',label:e.localize("low"),value:"low"},{menuIcon:'<span style="margin-left: 0px; margin-right: 5px;" class="priority average"></span>',label:e.localize("average"),value:"average"},{menuIcon:'<span style="margin-left: 0px; margin-right: 5px;" class="priority high"></span>',label:e.localize("high"),value:"high"},{menuIcon:'<span style="margin-left: 0px; margin-right: 5px;" class="priority critical"></span>',label:e.localize("critical"),value:"critical"}];else if(e.priority){const t=e=>{switch(e.value){case"":return'<span style="margin-left: 0px; margin-right: 5px;" class="priority"></span>';case"low":case"Low":return'<span style="margin-left: 0px; margin-right: 5px;" class="priority low"></span>';case"average":case"Average":return'<span style="margin-left: 0px; margin-right: 5px;" class="priority average"></span>';case"high":case"High":return'<span style="margin-left: 0px; margin-right: 5px;" class="priority high"></span>';case"critical":case"Critical":return'<span style="margin-left: 0px; margin-right: 5px;" class="priority critical"></span>'}let t="margin-left: 1px; margin-right: 5px;";return t+="height: 0px;",t+="width: 0px;",t+="border-left-color: transparent;",t+="border-left-style: solid;",t+="border-left-width: 7px;",t+="border-right-color: transparent;",t+="border-right-style: solid;",t+="border-right-width: 7px;","low"!==e.value?(t+="border-bottom-color: "+e.color+";"||0,t+="border-bottom-style: solid;",t+="border-bottom-width: 12px;"):(t+="border-top-color: "+e.color+";"||0,t+="border-top-style: solid;",t+="border-top-width: 12px;"),t+="border-radius: 3px;",`<span class="${e.value} priority" style="${t}"></span>`};for(let a=0;a<e.priority.length;a++){const s=e.priority[a];s.menuIcon=t(s)}}for(let t=0;t<e.priority.length;t++){const a=e.priority[t];a.menuLabel=`<div priority="${a.value}" class="smart-kanban-task-text">${a.menuIcon}${a.label}</div>`}return e.priority}_getTags(){const e=this,t=[];if(e.tags){for(let a=0;a<e.tags.length;a++){const s=e.tags[a];if("[]"!==s)if(s&&"string"==typeof s)t.push({label:s.trim(),value:s.trim()});else{const e={};if(s.label){if("[]"===s.label)continue;e.label=s.label}s.value?e.value=s.value:e.value=s.label,s.color&&(e.color=s.color),t.push(e)}}e.tags=t}}_render(){const e=this,t=getComputedStyle(e);if(e.columnColorEntireSurface?e.classList.add("smart-kanban-column-color"):e.classList.remove("smart-kanban-column-color"),e.$.body.innerHTML="",e._autoScrollCoefficient=Smart.Utilities.Core.Browser.Firefox?4:Smart.Utilities.Core.Browser.Edge?8:2,e._kanbanTaskMinWidth=parseFloat(t.getPropertyValue("--smart-kanban-task-min-width")),e._dataViewPadding=parseFloat(t.getPropertyValue("--smart-data-view-padding")),e.uiTasksByDataField=[],e.tasksByDataField=[],e.taskById=[],e._allColumns=[],e._customTags=[],e._selectedTasks=[],e._dblclickObject={numberOfClicks:0},e._appliedFiltering={filterGroups:[],filters:[],operator:"and"},e._appliedSorting={dataFields:[],dataTypes:[],orderBy:[]},e._sortPanelDataSource=[{label:e.localize("text"),dataField:"text",dataType:"string",allowFilter:!0,allowSort:!0},{label:e.localize("userId"),dataField:"userId",dataType:"string",allowFilter:!0,allowSort:!0},{label:e.localize("tags"),dataField:"tags",dataType:"string",allowFilter:!0,allowSort:!0},{label:e.localize("priority"),dataField:"priority",dataType:"string",allowFilter:!0,allowSort:!0},{label:e.localize("progress"),dataField:"progress",dataType:"number",allowFilter:!0,allowSort:!0},{label:e.localize("startDate"),dataField:"startDate",dataType:"date",allowFilter:!0,allowSort:!0},{label:e.localize("dueDate"),dataField:"dueDate",dataType:"date",allowFilter:!0,allowSort:!0}],e.taskCustomFields){const t=e.dataSource&&e.dataSource.length>0?e.dataSource[0]:null;for(let a=0;a<e.taskCustomFields.length;a++){const s=e.taskCustomFields[a].label;if(t){const l=typeof t[e.taskCustomFields[a].dataField];"number"===l?e._sortPanelDataSource.push({dataField:e.taskCustomFields[a].dataField,allowFilter:!0,allowSort:!0,label:s,dataType:"number"}):"date"===l?e._sortPanelDataSource.push({dataField:e.taskCustomFields[a].dataField,allowFilter:!0,allowSort:!0,label:s,dataType:"date"}):e._sortPanelDataSource.push({dataField:e.taskCustomFields[a].dataField,allowFilter:!0,allowSort:!0,label:s,dataType:"string"})}else e._sortPanelDataSource.push({dataField:e.taskCustomFields[a].dataField,allowFilter:!0,allowSort:!0,label:s,dataType:"string"})}}const a={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"};for(let t in a)e.dataSourceMap[t]||(e.dataSourceMap[t]=a[t]);e._getPriority(),e._getTags(),e._validateDataSourceMap(),e._getInnerElementMessages(),e._localizeHeader(),e._handleHeaderPosition(e.$.scrollViewer),e._validateSwimlanes(),e._renderColumns(),e._handleSwimlanes();let s=!1;e.autoLoadState&&(s=e.loadState()),e._getCurrentUser(),s||e._processDataSource(),e._setPriorityList(),e._setUserList(),e._setActionsList(),e._setColumnActionsList(),e._setCommentsList(),e._autoSaveState(),e._createAddNewButton(),e.$.scrollViewer.refresh()}attached(){const e=this;super.attached(),e.isCompleted&&e._dialog&&(e._addDialogHandlers(),e.getShadowRootOrBody().appendChild(e._dialog))}detached(){const e=this;if(super.detached(),!e._dialog)return;const t=e._dialog;t.removeEventListener("open",e._dialogEventHandler),t.removeEventListener("closing",e._dialogEventHandler),t.removeEventListener("close",e._dialogEventHandler),t.removeEventListener("click",e._dialogClickHandler),t.remove()}addTask(e={},t){const a=this,s=a.columns;if("object"!=typeof e||0===s.length||!a._currentUser.allowAdd)return;const l=a.dataSourceMap;void 0===e[l.status]&&(e[l.status]=s[0].dataField),a._currentUser.info&&(void 0===e[l.createdUserId]?(e[l.createdUserId]=a._currentUser.info.id,e[l.createdDate]=new Date):e[l.createdDate]||(e[l.createdDate]=new Date));const r={value:e,id:e.id};a.$.fireEvent("taskBeforeAdd",r);let o=null;return a.dataSource&&a.dataSource.virtualDataSource?a._requestVirtualDataSource("add",e,(function(e){return e})):(a.dataSource||(a.dataSource=[]),t>=0?a.dataSource.splice(t,0,e):a.dataSource.push(e),o=a._createTask(e,!0,t),a._autoSaveState("dataSource")),a.$.fireEvent("taskAdd",r),a._refreshButtonsAndSummaries(),a.virtualization&&(a._refreshColumns(),a._refreshButtonsAndSummaries()),o}addSort(e,t){const a=this,s=a.dataSource;let l;function r(e,s){const r=a._sortPanelDataSource.find((t=>t.dataField===e));if(r){let a=Array.isArray(t)?t[s]:"string"==typeof t?t:"ascending";l.dataFields.push(e),l.dataTypes.push(r.dataType),a=a&&-1!==a.indexOf("desc")?"descending":"ascending",l.orderBy.push(a)}}if(0!==arguments.length&&s&&0!==s.length){if(a.closePanel(),1===arguments.length&&"object"==typeof e)l=e;else if(l={dataFields:[],dataTypes:[],orderBy:[]},Array.isArray(e))e.forEach(r);else{if("string"!=typeof e)return;r(e,0)}super.addSort(l)}}beginEdit(e){const t=this;t.disabled||(e=t._validateTaskArgument(e))&&(t.editable||t.readonly)&&t._openDialog(e,"edit")}cancelEdit(){const e=this._dialog;e&&e.opened&&e.classList.contains("edit")&&e.close()}hide(e){const t=this;void 0!==e&&"number"==typeof e&&(e=t.columns[e]),e&&!1!==e.visible&&(e.visible=!1,t.$.fireEvent("columnHide",{column:e}),t.refresh())}show(e){const t=this;void 0!==e&&"number"==typeof e&&(e=t.columns[e]),e&&!0!==e.visible&&(e.visible=!0,t.$.fireEvent("columnShow",{column:e}),t.refresh())}showAllColumns(){const e=this;for(let t=0;t<e.columns.length;t++)e.columns[t].visible=!0;e.refresh()}collapse(e){const t=this;if(!t.collapsible)return;if(!(e=t._validateColumnArgument(e))||e.collapsed||!e.collapsible)return;const a=t._columnToElement.get(e),s=a.siblingColumns;let l=0;e.collapsed=!0,a.classList.add("collapsed");const r=e.collapsed?t.localize("expand"):t.localize("collapse"),o=a.querySelector(".smart-kanban-column-header-toggle-button");if(o&&o.setAttribute("title",r),s.forEach((e=>e.collapsed&&l++)),l===s.length){const a=0!==s.indexOf(e)?0:1,l=s[a],r=t._columnToElement.get(l);l&&(l.collapsed=!1),r&&(r.classList.remove("collapsed"),t._updateColumnWidths(s,r.parentElement))}else t._updateColumnWidths(s,a.parentElement);t._allColumns.forEach((e=>t._refreshScrollViewer(e))),t._autoSaveState("collapsed"),t._handleSwimlanes(!0),t._createAddNewButton(),t._doNotFireEvents||t.$.fireEvent("columnCollapse",{column:e})}copyTask(e){const t=this;if(!t._currentUser.allowAdd)return;if(!(e=t._validateTaskArgument(e)))return;const a=JSON.parse(JSON.stringify(e.data));a.history=[],t.dataSource&&t.dataSource.virtualDataSource?t._requestVirtualDataSource("add",a,(function(e){return t.$.fireEvent("taskAdd",{value:a}),e})):(a[t.dataSourceMap.id]=Math.floor(9e4*Math.random()+1e4),t._createTask(a,!0),t._autoSaveState("dataSource"),t.$.fireEvent("taskAdd",{value:a})),t.dataSource||(t.dataSource=[]),t.dataSource.push(a),t._refreshButtonsAndSummaries()}endEdit(){const e=this._dialog;e&&e.opened&&e.classList.contains("edit")&&(e.ok=!0,e.close())}ensureVisible(e){const t=this;if(e&&"number"==typeof e){const a=t.getTask(e);if(!a)return;const s=a[t.dataSourceMap.status],l=t.querySelector('.smart-kanban-column[data-field="'+s+'"]');if(l){const r=l.querySelector("smart-scroll-viewer");if(r){if(void 0===a.top){if(!(e=t._validateTaskArgument(e))||e.filteredOut)return;const a=e.closest("smart-scroll-viewer");if(0===a.scrollHeight)return e;const s=a.scrollTop,l=e.offsetTop;return s<=l&&s+a.offsetHeight>=l+e.offsetHeight||(a.scrollTop=l),e}a.top<r.scrollTop||a.top>r.scrollTop+r.offsetHeight?r.scrollTop=a.top:t._refreshScrollHeight(r,s)}}return}if(!(e=t._validateTaskArgument(e))||e.filteredOut)return;const a=e.closest("smart-scroll-viewer");if(0===a.scrollHeight)return e;const s=a.scrollTop,l=e.offsetTop;return s<=l&&s+a.offsetHeight>=l+e.offsetHeight||(a.scrollTop=l),e}expand(e){const t=this;if(!(e=t._validateColumnArgument(e))||!e.collapsed)return;const a=t._columnToElement.get(e);e.collapsed=!1,a.classList.remove("collapsed");const s=e.collapsed?t.localize("expand"):t.localize("collapse"),l=a.querySelector(".smart-kanban-column-header-toggle-button");l&&l.setAttribute("title",s),t._updateColumnWidths(a.siblingColumns,a.parentElement),t._allColumns.forEach((e=>t._refreshScrollViewer(e))),t._autoSaveState("collapsed"),t._handleSwimlanes(!0),t._createAddNewButton(),t.$.fireEvent("columnExpand",{column:e})}expandAll(){const e=this;e._allColumns.forEach((t=>{t.collapsed=!1,e._columnToElement.get(t).classList.remove("collapsed")})),e._allColumns.forEach((t=>e._refreshScrollViewer(t))),e._columnContainers.forEach((t=>e._updateColumnWidths(t.children,t))),e._autoSaveState("collapsed"),e._handleSwimlanes(!0)}exportData(e,t,a){const s=this,l=getComputedStyle(s),r=l.borderRightColor,o=s.swimlanes,i=new Smart.Utilities.DataExporter,n=s._getCurrentDataSource(),d=s.dataSourceMap,c=[{id:"Task ID",text:"Text",status:"Status",swimlane:"Swimlane",asignee:"Asignee",priority:"Priority",progress:"Progress",startDate:"Start date",dueDate:"Due date",subTasks:"Completed sub-tasks",tags:"Tags"}],u={},m={},p={};if(s.taskCustomFields)for(let e=0;e<s.taskCustomFields.length;e++)c[0][s.taskCustomFields[e].dataField]=s.taskCustomFields[e].label;i.style={border:"1px solid "+r,borderCollapse:"collapse",backgroundColor:l.backgroundColor,color:l.color,fontFamily:"Helvetica",header:{border:"1px solid "+r,fontWeight:"bold"},columns:{border:"1px solid "+r,progress:{format:"p0"},startDate:{format:s.formatStringDate},dueDate:{format:s.formatStringDate}},rows:{}},0===o.length&&delete c[0].swimlane;for(let e=0;e<n.length;e++){const t=n[e];let a=t[d.status],l=t[d.swimlane],r=t[d.userId],h=t[d.progress];u[a]?a=u[a]:(a=s._allColumns.find((e=>e.dataField===a)).label,u[t[d.status]]=a),null===r?r="":p[r]?r=p[r]:(r=s.users.find((e=>e.id===r)).name,p[t[d.userId]]=r),null===h?h="":h/=100;let g=t[d.tags];g&&"string"!=typeof g&&(g=g.map((e=>"string"==typeof e?e:e.label)));const f={id:t[d.id],text:t[d.text],description:t[d.description]||"",status:a,asignee:r,priority:t[d.priority]||"",progress:h,startDate:t[d.startDate]||"",dueDate:t[d.dueDate]||"",subTasks:s._getCompletedSubTasks(t[d.checklist]),tags:g};if(s.taskCustomFields)for(let e=0;e<s.taskCustomFields.length;e++)f[s.taskCustomFields[e].dataField]=`"${t[s.taskCustomFields[e].dataField]}"`.replaceAll(","," ");o.length&&(l?m[l]?l=m[l]:(l=o.find((e=>e.dataField===l)).label,m[t[d.swimlane]]=l):l="",f.swimlane=l),c.push(f),t[d.color]&&(i.style.rows[e]={backgroundColor:t[d.color]})}return i.exportData(c,e,t,a)}getState(e){const t=this,a={},s={collapsed:a,dataSource:t._getCurrentDataSource(),filtering:t._appliedFiltering,selection:{selected:t._selectedTasks,selectionStart:t._selectionStart?t._selectionStart:null},sorting:t._appliedSorting,tabs:t._selectedTabs,visibility:{taskActions:t.taskActions,taskComments:t.taskComments,taskDue:t.taskDue,taskPriority:t.taskPriority,taskProgress:t.taskProgress,taskTags:t.taskTags,taskUserIcon:t.taskUserIcon}};let l=null,r=null;t._selectionInView&&(l=t._selectionInView.closest(".smart-kanban-column").column.dataField,r=t._selectionInView.getAttribute("swimlane")),s.selection.selectionInColumn=l,s.selection.swimlane=r;const o={};for(let e in t.tasksByDataField){o[e]=[];const a=t.tasksByDataField[e];for(let t=0;t<a.length;t++)o[e].push(a[t].id)}if(s.order=o,s.columnOrder=[],t._allColumns.forEach((e=>a[e.dataField]=e.collapsed)),t.columns.forEach((e=>s.columnOrder.push(e.dataField))),e){const t={};for(let a in e){const l=e[a];s[l]&&(t[l]=s[l])}return t}return s}loadState(e,t){const a=this;if(!e&&!(e=window.localStorage.getItem("smartKanban"+a.id)))return!1;let s=!0;"string"==typeof e&&(e=JSON.parse(e,((e,t)=>t&&-1!==["startDate","dueDate","time"].indexOf(e)?new Date(t):t))),e.dataSource||(t=!1),a._doNotFireEvents=!0,a._selectedTasks=[],delete a._selectionStart,delete a._selectionInView,a.expandAll(),!1!==t&&Array.from(a.$.container.querySelectorAll("smart-scroll-viewer.smart-kanban-column-content-tasks")).forEach((e=>{e&&e.clearContent&&e.isReady&&e.clearContent()}));let l=!1;a._allColumns.forEach((t=>{e.collapsed&&e.collapsed[t.dataField]&&(a.collapse(t),l=!0)}));for(let t in e.visibility)a[t]=e.visibility[t];if(!1!==t&&(a.dataSource=e.dataSource,a.uiTasksByDataField=[],a.tasksByDataField=[],a._processDataSource()),e.filtering&&a.addFilter(a._constructFilterGroups(e.filtering),e.filtering.operator),e.sorting&&a.addSort(e.sorting),!1!==t&&a._autoSaveState(e),e.selection&&(e.selection.selected.forEach((e=>{const t=a.$.container.querySelector(`.smart-kanban-task[data-id="${e}"]`);t&&(t.setAttribute("selected",""),a._selectedTasks.push(t.data.id))})),e.selection.selectionStart&&(a._selectionStart=a.$.container.querySelector(`.smart-kanban-task[data-id="${e.selection.selectionStart}"]`)),e.selection.selectionInColumn)){const t=a._columnToElement.get(a._allColumns.find((t=>t.dataField===e.selection.selectionInColumn)));e.selection.swimlane?a._selectionInView=t.querySelector(`smart-scroll-viewer[swimlane=${e.selection.swimlane}]`):a._selectionInView=t.querySelector("smart-scroll-viewer")}if(e.tabs){const t="tabs"===a.hierarchy;a._allColumns.forEach((s=>{if(void 0!==s.selected){const l=a._columnToElement.get(s),r=-1!==e.tabs.indexOf(s.dataField);s.selected=r,t&&(l.classList.toggle("smart-hidden",!r),l.tab.classList.toggle("selected",r),l.tab.setAttribute("aria-selected",r))}}))}const r=[],o={};if(e.columnOrder){a._allColumns.forEach((e=>{o[e.dataField]=e}));for(let t=0;t<e.columnOrder.length;t++){const a=e.columnOrder[t],s=o[a];s&&r.push(s)}r&&r.length===a.columns.length&&JSON.stringify(r.map((e=>e.value)))!==JSON.stringify(a.columns.map((e=>e.value)))&&(a.columns=r,a.refresh(),s=!1)}if(e.order){let t=!1,l=[];for(let s in e.order){const l=e.order[s];let r=a._getTasksByDataField(s);if(0!==r.length)for(let e=0;e<l.length;e++){const s=l[e],o=a.taskById[s];if(o){const s=r.indexOf(o);s!==e&&s>=0?(r.splice(e,0,r.splice(s,1)[0]),t=!0):-1===s&&a._getTasksByDataField(o[a.dataSourceMap.status]).indexOf(o)}}}if(t){const e=Object.keys(a.tasksByDataField);for(let t in e)l=l.concat(a.tasksByDataField[e[t]]);Array.from(a.$.container.querySelectorAll("smart-scroll-viewer.smart-kanban-column-content-tasks")).forEach((e=>e.clearContent())),a.dataSource=l,a.uiTasksByDataField=[],a.tasksByDataField=[],a._processDataSource(),s=!1}}return a._doNotFireEvents=!1,s}moveTask(e,t){const a=this;if(a.disabled||""!==t&&!t)return;const s=a.dataSourceMap;if(!(e=a._validateTaskArgument(e))||!a._updateTaskInProgress&&e.data[s.status]===t)return;const l=a._allColumns.find((e=>e.dataField===t));function r(){const r=e.closest("smart-scroll-viewer"),o=a._columnToElement.get(l),i=e.data,n=a.getTaskScrollViewer(o,i);if(a.virtualization){const l=i,o=e.column.dataField,d=a._getTasksByDataField(o),c=d.findIndex((e=>e.id===l.id));return c>=0&&(d.splice(c,1),a._getTasksByDataField(t).push(l)),i[s.status]=t,a._refreshScrollViewer(r,!0),a._refreshScrollViewer(n,!0),e.hasAttribute("selected")&&(e.removeAttribute("selected"),a._selectedTasks=a._selectedTasks.filter((t=>t!==e.data.id)),a._autoSaveState("selection")),e.removeAttribute("focus"),void((a.shadowRoot||a.getRootNode()).activeElement===r&&a._focusTask(a._getFirstItem(r.$.content)))}i[s.status]=t,n.appendChild(e),a._dialog&&a._dialog.ok||(a.textTemplate&&a._renderTask(e),a._autoSaveState("dataSource")),a._refreshScrollViewer(r,!0),a._refreshScrollViewer(n,!0),e.hasAttribute("selected")&&(e.removeAttribute("selected"),a._selectedTasks=a._selectedTasks.filter((t=>t!==e.data.id)),a._autoSaveState("selection")),e.removeAttribute("focus"),(a.shadowRoot||a.getRootNode()).activeElement===r&&a._focusTask(a._getFirstItem(r.$.content))}l&&(a.dataSource&&a.dataSource.virtualDataSource&&!a._ignoreVirtualDataSource?a._requestVirtualDataSource("update",Object.assign({},e.data,{status:t}),(function(e){return e&&r(),e})):r())}_getCustomizeColumnPanelDataSource(){const e=this;return e._customizeColumns=[{label:e.localize("actionsIcon"),dataField:"taskActions",allowHide:!0,disableDrag:!0,visible:e.taskActions},{label:e.localize("commentsIcon"),dataField:"taskComments",allowHide:!0,disableDrag:!0,visible:e.taskComments},{label:e.localize("dueDate"),dataField:"taskDue",allowHide:!0,disableDrag:!0,visible:e.taskDue},{label:e.localize("priorityIcon"),dataField:"taskPriority",allowHide:!0,disableDrag:!0,visible:e.taskPriority},{label:e.localize("progress"),dataField:"taskProgress",allowHide:!0,disableDrag:!0,visible:e.taskProgress},{label:e.localize("tags"),dataField:"taskTags",allowHide:!0,disableDrag:!0,visible:e.taskTags},{label:e.localize("userIcon"),dataField:"taskUserIcon",allowHide:!0,disableDrag:!0,visible:e.taskUserIcon}],e._customizeColumns}openCustomizePanel(){const e=this,t=e.dataSource;if(!t||0===t.length||e.disabled||"none"===e.headerPosition)return;const a=e.$.customize,s=[{label:e.localize("actionsIcon"),dataField:"taskActions",visible:e.taskActions},{label:e.localize("commentsIcon"),dataField:"taskComments",visible:e.taskComments},{label:e.localize("dueDate"),dataField:"taskDue",visible:e.taskDue},{label:e.localize("priorityIcon"),dataField:"taskPriority",visible:e.taskPriority},{label:e.localize("progress"),dataField:"taskProgress",visible:e.taskProgress},{label:e.localize("tags"),dataField:"taskTags",visible:e.taskTags},{label:e.localize("userIcon"),dataField:"taskUserIcon",visible:e.taskUserIcon}];let l;e._closeDialog(),e.$.headerDropDown.classList.add("customize-panel"),e.$.headerDropDown.classList.remove("filter-panel","sort-panel","search-panel"),a.classList.remove("smart-hidden"),e.$.filter.classList.add("smart-hidden"),e.$.sort.classList.add("smart-hidden"),e.$.search.classList.add("smart-hidden"),e._closeSearchPanel(),e._customizePartCreated?(l=a.firstElementChild,l.set("dataSource",s),l.propertyChangedHandler("dataSource",void 0,s),l.rightToLeft=e.rightToLeft):(l=document.createElement("smart-column-panel"),l.animation=e.animation,l.dataSource=s,l.locale=e.locale,l.messages=e._innerElementMessages.columnPanel,l.rightToLeft=e.rightToLeft,l.theme=e.theme,e.$.customize.appendChild(l),l.classList.add("smart-kanban-column-panel"),e._customizePartCreated=!0),e._openHeaderDropDown(e.$.customizeButton)}_getFilterPanelDataSource(){const e=this,t=[{label:e.localize("text"),dataField:"text",dataType:"string",allowSort:!0,allowFilter:!0},{label:e.localize("userId"),dataField:"userId",dataType:"string",allowSort:!0,allowFilter:!0},{label:e.localize("tags"),dataField:"tags",dataType:"string",allowSort:!0,allowFilter:!0},{label:e.localize("priority"),dataField:"priority",dataType:"enum",allowSort:!0,allowFilter:!0,options:e._getPriority()},{label:e.localize("progress"),dataField:"progress",dataType:"number",allowSort:!0,allowFilter:!0},{label:e.localize("startDate"),dataField:"startDate",dataType:"date",allowSort:!0,allowFilter:!0},{label:e.localize("dueDate"),dataField:"dueDate",dataType:"date",allowSort:!0,allowFilter:!0}];if(e.taskCustomFields){const a=e.dataSource&&e.dataSource.length>0?e.dataSource[0]:null;for(let s=0;s<e.taskCustomFields.length;s++){const l=e.taskCustomFields[s].label;if(a){const r=typeof a[e.taskCustomFields[s].dataField];"number"===r?t.push({dataField:e.taskCustomFields[s].dataField,allowFilter:!0,allowSort:!0,label:l,dataType:"number"}):"date"===r?t.push({dataField:e.taskCustomFields[s].dataField,allowFilter:!0,allowSort:!0,label:l,dataType:"date"}):t.push({dataField:e.taskCustomFields[s].dataField,allowFilter:!0,allowSort:!0,label:l,dataType:"string"})}else t.push({dataField:e.taskCustomFields[s].dataField,allowFilter:!0,allowSort:!0,label:l,dataType:"string"})}}return e.onFilterPrepare&&e.onFilterPrepare(t),t}openFilterPanel(){const e=this,t=e._getFilterPanelDataSource();super.openFilterPanel(t,(function(t,a){"progress"===a.dataField?(t.min=0,t.max=100,t.showUnit=!0,t.unit="%"):"date"===a.dataType&&(t.formatString=e.formatStringDate)}))}_getSortPanelDataSource(){const e=this;return e.onSortPrepare&&e.onSortPrepare(this._sortPanelDataSource),this._sortPanelDataSource}openSortPanel(){const e=this,t=e._getSortPanelDataSource().map((t=>{const a=e._appliedSorting.dataFields.indexOf(t.dataField);return Object.assign({},t,{sortIndex:a,sortDirection:-1===a?"ascending":e._appliedSorting.orderBy[a]})}));super.openSortPanel(t)}removeTask(e,t){const a=this;function s(){const t=e.closest("smart-scroll-viewer"),s=e.data;if(a.virtualization||(e.remove(),a._refreshScrollViewer(t,!0)),a._autoSaveState("dataSource"),a.$.fireEvent("taskRemove",{value:s,id:e.data.id}),a.dataSource){const e=a.dataSource.findIndex?a.dataSource.findIndex((e=>e.id===s.id)):-1;if(e>-1){const t=s[a.dataSourceMap.status],l=a.tasksByDataField[t].findIndex((e=>e.id===s.id));l>=0&&a.tasksByDataField[t].splice(l,1),a.dataSource.splice(e,1)}}if(a._selectedTasks&&a._selectedTasks.indexOf(s.id)>=0){const e=a._selectedTasks.indexOf(s.id);a._selectedTasks.splice(e,1)}a._refreshSummaries(),a._refreshColumns()}a._currentUser.allowRemove&&(e=a._validateTaskArgument(e))&&(t?a._openDialog(e,"prompt"):a.dataSource&&a.dataSource.virtualDataSource?a._requestVirtualDataSource("remove",e.data,(function(e){return e&&s(),e})):s())}saveState(e){const t=this.getState(e);return window.localStorage.setItem("smartKanban"+this.id,JSON.stringify(t)),t}addHistory(e,t){const a=this;if(!e||!t)return;const s=a.dataSourceMap;a.storeHistory?(void 0!==e[s.history]&&null!==e[s.history]||(e[s.history]=[]),e[s.history].length===a.storeHistoryItems&&e[s.history].splice(0,1),Array.isArray(e[s.history])||(e[s.history]=[]),e[s.history].push(t)):e[s.history]=[]}clearHistory(e){e&&(e.history=[])}updateTask(e,t){const a=this;if(!a._currentUser.allowEdit||!t)return;if(!(e=a._validateTaskArgument(e)))return;const s=a.dataSourceMap,l=e.data;function r(){if(e.data=t,t[s.status]!==l[s.status]&&(a._updateTaskInProgress=!0,a.moveTask(e,t[s.status]),delete a._updateTaskInProgress),t[s.swimlane]!==l[s.swimlane]){const r=e.closest(".smart-kanban-column");a._hasSwimlane(r.index)?(r.querySelector(`smart-scroll-viewer[swimlane=${t[s.swimlane]}]`).appendChild(e),l[s.swimlane]&&a._refreshScrollViewer(r.querySelector(`smart-scroll-viewer[swimlane=${l[s.swimlane]}]`))):delete t[s.swimlane]}const r=()=>{if(!a._currentUser||a._currentUser&&!a._currentUser.info)return;const e=()=>({user:a._currentUser.info.id,date:t[s.updatedDate]});if(t[s.userId]!==l[s.userId]){const r=e();r.action="user";let o=!0;l[s.userId]||t[s.userId]||(o=!1),o&&(r.details={oldValue:l[s.userId],value:t[s.userId]},a.addHistory(t,r))}if(""+t[s.dueDate]!=""+l[s.dueDate]){const r=e();r.action="deadline",r.details={oldValue:l[s.dueDate]?l[s.dueDate].toLocaleDateString():"",value:t[s.dueDate]?t[s.dueDate].toLocaleDateString():""},a.addHistory(t,r)}if(""+t[s.startDate]!=""+l[s.startDate]){const r=e();r.action="deadline",r.details={oldValue:l[s.startDate]?l[s.startDate].toLocaleDateString():"",value:t[s.startDate]?t[s.startDate].toLocaleDateString():""},a.addHistory(t,r)}if(t[s.color]!==l[s.color]){const r=e();r.action="color",r.details={oldValue:l[s.color],value:t[s.color]},a.addHistory(t,r)}if(t[s.status]!==l[s.status]){const r=e();r.action="status",r.details={oldValue:l[s.status],value:t[s.status]},a.addHistory(t,r)}if(JSON.stringify(t[s.checklist])!==JSON.stringify(l[s.checklist])){const r=e();r.action="subtasks",r.details={oldValue:l[s.checklist],value:t[s.checklist]},a.addHistory(t,r)}if(parseFloat(t[s.progress])!==parseFloat(l[s.progress])){let r=!0;if(null===l[s.progress]&&0===parseFloat(t[s.progress])&&(r=!1),r){const r=e();r.action="progress";const o=l[s.progress]?l[s.progress]+"%":"0%",i=t[s.progress]?t[s.progress]+"%":"0%";o!==i&&(r.details={oldValue:o,value:i},a.addHistory(t,r))}}if(t[s.description]!==l[s.description]){const r=e();r.action="description",r.details={oldValue:l[s.description],value:t[s.description]},a.addHistory(t,r)}if(t[s.priority]!==l[s.priority]){const r=e();r.action="priority",r.details={oldValue:l[s.priority],value:t[s.priority]},a.addHistory(t,r)}if(t[s.tags]!==l[s.tags]){const r=e();r.action="tags",r.details={oldValue:l[s.tags],value:t[s.tags]},a.addHistory(t,r)}if(t[s.text]!==l[s.text]){const r=e();r.action="text",r.details={oldValue:l[s.text],value:t[s.text]},a.addHistory(t,r)}for(let s=0;s<a.taskCustomFields.length;s++){const r=a.taskCustomFields[s];let o=l[r.dataField],i=t[r.dataField];if(o!==i&&""+o!=""+i){const s=e();if(s.action=r.name?r.name:r.dataField,r.dataSource){const e=e=>{const t=r.dataSource.find((t=>t.value===e||t===e?t:void 0));return void 0!==t?t.label:""},t=t=>{if(null===t)return"";if(void 0===t||t.length){if(void 0!==t&&t.length&&"string"!=typeof t){let a=[];return t.forEach((t=>{a.push(e(t))})),a.toString()}if(t&&t.indexOf(",")>0){t=t.split(",");let a=[];return t.forEach((t=>{a.push(e(t))})),a.toString()}return t}return e(t)};i=t(i),o=t(o)}s.details={oldValue:o,value:i},a.addHistory(t,s)}}};a.textTemplate||t[s.text]!==l[s.text]||t[s.tags]!==l[s.tags]||t[s.priority]!==l[s.priority]||t[s.description]!==l[s.description]?(a._renderTask(e),r()):(r(),t[s.userId]!==l[s.userId]&&a._updateUserIcon(e),t[s.dueDate]!==l[s.dueDate]&&a._updateTaskDueDate(e),t[s.color]!==l[s.color]&&a._updateTaskColor(e),JSON.stringify(t[s.checklist])!==JSON.stringify(l[s.checklist])?(a._updateTaskChecked(e),a._updateTaskProgress(e)):parseFloat(t[s.progress])!==parseFloat(l[s.progress])&&a._updateTaskProgress(e),a._updateTaskSubtasks(e),a._updateTaskCustomFields(e));const o=a.getColumn(t.status);o&&(t.statusLabel=o.label);const i=a.getColumn(l.status);i&&(l.statusLabel=i.label);const n=JSON.parse(JSON.stringify(t)),d=JSON.parse(JSON.stringify(l));if(n.history=t.history,d.history=l.history,a.$.fireEvent("change",{task:e,id:n.id,value:n,oldValue:d}),a.virtualization){const t=e.data[s.status],l=a.tasksByDataField[t].findIndex((t=>t.id===e.data.id));if(l>=0){a.tasksByDataField[t][l]=e.data;const s=a._getTasksByDataField(t),r=s.findIndex((t=>t.id===e.data.id));r>=0&&(s[r]=e.data)}}if(a._refreshScrollViewer(e.closest("smart-scroll-viewer")),a.dataSource&&a.dataSource.findIndex){const t=a.dataSource.findIndex((t=>e.data.id===t.id));t>=0&&(a.dataSource[t]=e.data)}a._refreshSummaries(),a._updateTaskComments(e),a._autoSaveState("dataSource"),a.$.fireEvent("taskUpdate",{id:n.id,value:n,oldValue:d})}(t=Object.assign({},l,t))[s.checklist]&&0===t[s.checklist].length&&(t[s.checklist]=null),JSON.stringify(t)!==JSON.stringify(l)&&(a.dataSource&&a.dataSource.virtualDataSource?a._requestVirtualDataSource("update",t,(function(e){return e&&(a._ignoreVirtualDataSource=!0,r(),delete a._ignoreVirtualDataSource),e})):r())}_refreshSelection(){const e=this;if("zeroOrOne"===e.selectionMode){const t=e._selectionStart;e._selectedTasks.forEach((a=>{if(a!==t){const t=e.getTask(a);t&&(t.selected=!1);const s=e.querySelector('[data-id="'+a+'"]');s&&s.removeAttribute("selected")}})),e._selectedTasks=[t]}e._selectedTasks.forEach((t=>{const a=e.querySelector('[data-id="'+t+'"]');a&&a.setAttribute("selected","")})),e._refreshColumns()}propertyChangedHandler(e,t,a){const s=this,l=s._dialog;function r(){if(s.cancelEdit(),l&&l.close(),s._closeList(s._commentsList,"_commentSelectionFor"),s._getCurrentUser(),s.taskSubTasks){const e=s.querySelectorAll(".smart-kanban-task-input");s._currentUser&&!s._currentUser.allowEdit||s.disabled||!s.taskSubTasksInput?e.forEach((e=>{e.classList.add("smart-hidden")})):e.forEach((e=>{e.classList.remove("smart-hidden")}))}}switch(super.propertyChangedHandler(e,t,a),e){case"columnColorEntireSurface":a?s.classList.add("smart-kanban-column-color"):s.classList.remove("smart-kanban-column-color");break;case"columnFooter":case"addNewButton":case"addNewButtonDisplayMode":s._reset(),s._createAddNewButton();break;case"taskTags":s._reset();break;case"taskCustomFields":s._resetFields=!0,s._reset();break;case"autoColumnHeight":case"applyColumnColorToTasks":case"columnWidth":case"addNewColumn":s._reset();break;case"allowDrag":s._getCurrentUser();break;case"animation":case"theme":{let t=Array.from(s.$.container.querySelectorAll("smart-column-panel, smart-multi-column-filter-panel, smart-sort-panel"));l&&(t.push(l),t=t.concat(Array.from(l.$.footer.children)),l.editPanelPopulated&&(t=t.concat(Array.from(l.$.container.querySelectorAll(".smart-element.editor"))))),t.forEach((t=>t[e]=a)),Array.from(s.$.container.getElementsByClassName("smart-kanban-task")).forEach((e=>s._updateTaskColor(e)));break}case"autoSaveState":s._autoSaveState();break;case"collapsible":a||s.expandAll();break;case"columnSummary":s._refreshSummaries();break;case"columns":s._render(),l&&l.editPanelPopulated&&(l.editors.status.dataSource=s._allColumns.map((e=>({color:e.color,label:e.label,value:e.dataField}))));break;case"currentUser":r();break;case"dataSource":case"dataSourceMap":if("dataSourceMap"===e&&s._validateDataSourceMap(),s._customTags=[],s._selectedTasks=[],s.cancelEdit(),s.closePanel(),s._closeList(s._actionsList,"_actionSelectionFor"),s._closeList(s._columnActionsList,"_columnActionSelectionFor"),s._closeList(s._commentsList,"_commentSelectionFor"),s._closeList(s._userList,"_userSelectionFor"),s._closeList(s._priorityList,"_prioritySelectionFor"),0===s.columns.length)return s._renderColumns(),s._handleSwimlanes(),void s._processDataSource();Array.from(s.$.container.querySelectorAll("smart-scroll-viewer.smart-kanban-column-content-tasks")).forEach((e=>{e.clearContent(),e.refresh(),s._refreshScrollViewer(e,!0)})),s._processDataSource(),s.dataSource||s._refresh(),s.columnSummary&&s._refreshSummaries();break;case"disabled":s.cancelEdit(),s.closePanel(),s._closeList(s._actionsList,"_actionSelectionFor"),s._closeList(s._columnActionsList,"_columnActionSelectionFor"),s._closeList(s._commentsList,"_commentSelectionFor"),s._closeList(s._userList,"_userSelectionFor"),s._closeList(s._priorityList,"_prioritySelectionFor"),s._setFocusable();break;case"formatStringDate":Array.from(s.$.container.getElementsByClassName("smart-kanban-task")).forEach((e=>s._updateTaskDueDate(e))),l&&(l.editors.startDate.formatString=a,l.editors.dueDate.formatString=a);break;case"formatStringTime":s._closeList(s._commentsList,"_commentSelectionFor");break;case"editable":s.cancelEdit(),s._actionsList.classList.contains("edit-comment")||s._closeList(s._actionsList,"_actionSelectionFor"),s._getCurrentUser();break;case"headerPosition":s._handleHeaderPosition(s.$.body),s._allColumns.forEach((e=>s._refreshScrollViewer(e)));break;case"hierarchy":0===s.swimlanes.length&&s.columns.length!==s._allColumns.length&&s._reset();break;case"locale":case"messages":s.closePanel(),s._localizeHeader(),s._getInnerElementMessages(),s._closeList(s._actionsList,"_actionSelectionFor"),s._closeList(s._columnActionsList,"_columnActionSelectionFor"),s._closeList(s._commentsList,"_commentSelectionFor"),s._setActionsList(),s._setColumnActionsList(),s._setCommentsList(),l&&(s.cancelEdit(),l.close(),l.$.footer.firstElementChild.innerHTML=s.localize("ok"),l.$.footer.children[1].innerHTML=s.localize("cancel"),l.$.footer.children[2].innerHTML=s.localize("delete"),l.editPanelPopulated&&(l.editors.priority.dataSource=s._getPriority(),l.$.container.querySelector(".new-subtask").placeholder=s.localize("newSubtask"),l.$.container.querySelector("smart-button.add").title=s.localize("addSubtask"),Array.from(l.$.container.getElementsByClassName("editor-label")).forEach((e=>{let t=e.id.slice(s.id.length+5);t=t.slice(0,1).toLowerCase()+t.slice(1),e.innerHTML=s.localize(t)})))),s._customizePartCreated&&(s.$.customize.firstElementChild.messages=s._innerElementMessages.columnPanel,s.$.customize.firstElementChild.locale=s.locale),s._filterPartCreated&&(s.$.filter.firstElementChild.messages=s._innerElementMessages.multiColumnFilterPanel,s.$.filter.firstElementChild.locale=s.locale,s.$.filter.firstElementChild.editorPlaceholder=s.localize("filterValuePlaceholder")),s._sortPartCreated&&(s.$.sort.firstElementChild.messages=s._innerElementMessages.sortPanel,s.$.sort.firstElementChild.locale=s.locale);break;case"rightToLeft":s._reset(!0);break;case"selectionMode":"zeroOrOne"===a&&s._selectedTasks.length>1&&s._refreshSelection();break;case"swimlanes":if(s._validateSwimlanes(),JSON.stringify(s.swimlanes)===JSON.stringify(t))return;s._reset(),l&&l.editPanelPopulated&&(l.editors.swimlane.dataSource=s.swimlanes.map((e=>({label:e.label,value:e.dataField}))));break;case"swimlanesFrom":case"swimlanesTo":{const e=s.swimlanesFrom,t=s.swimlanesTo;e<0&&(s.swimlanesFrom=0),null!==t&&e>t&&(s.swimlanesFrom=t),s.swimlanes.length>0&&s._reset();break}case"taskCustomFieldsHide":case"taskProgress":case"taskSubTasksInput":case"taskSubTasks":case"taskUserIcon":case"taskComments":case"taskDue":case"taskPriority":case"tags":case"taskColor":case"taskColorEntireSurface":case"textTemplate":Array.from(s.$.container.getElementsByClassName("smart-kanban-task")).forEach((e=>s._renderTask(e))),s._allColumns.forEach((e=>s._refreshScrollViewer(e)));break;case"unfocusable":s._setFocusable();break;case"priority":s._closeList(s._priorityList,"_prioritySelectionFor"),s._setPriorityList();break;case"users":s._closeList(s._userList,"_userSelectionFor"),s._setUserList(),Array.from(s.$.container.getElementsByClassName("smart-kanban-task")).forEach((e=>s._updateUserIcon(e))),l&&l.editPanelPopulated&&(l.editors.userId.dataSource=s.users.map((e=>({label:e.name,value:e.id})))),r()}}_reset(e){const t=this,a=t.getState();t._allColumns=[],t._customTags=[],t._selectedTasks=[],t._dialog&&(t.cancelEdit(),e&&(t._dialog.remove(),delete t._dialog)),t.closePanel(),t._closeList(t._actionsList,"_actionSelectionFor"),t._closeList(t._columnActionsList,"_columnActionSelectionFor"),t._closeList(t._commentsList,"_commentSelectionFor"),t._closeList(t._userList,"_userSelectionFor"),t.$.body.innerHTML="",Array.from(t.$.container.getElementsByClassName("swimlane")).forEach((e=>e.remove())),t._renderColumns(),t._handleSwimlanes(),t._createAddNewButton(),t.loadState(a),t.$.scrollViewer.refresh()}_refresh(){const e=this;e._allColumns=[],e._customTags=[],e._selectedTasks=[],e.closePanel(),e._closeList(e._actionsList,"_actionSelectionFor"),e._closeList(e._columnActionsList,"_columnActionSelectionFor"),e._closeList(e._commentsList,"_commentSelectionFor"),e._closeList(e._userList,"_userSelectionFor"),e.$.body.innerHTML="",Array.from(e.$.container.getElementsByClassName("swimlane")).forEach((e=>e.remove())),e._renderColumns(),e._handleSwimlanes(),e._createAddNewButton(),e.$.scrollViewer.refresh()}_closeAllLists(){const e=this;e.cancelEdit(),e.closePanel(),e._closeList(e._actionsList,"_actionSelectionFor"),e._closeList(e._columnActionsList,"_columnActionSelectionFor"),e._closeList(e._commentsList,"_commentSelectionFor"),e._closeList(e._userList,"_userSelectionFor"),e._closeList(e._priorityList,"_prioritySelectionFor")}_inlineTaskAdd(e,t){const a=this;if(a._inlineEditDetails&&a._inlineEditDetails.popup.parentNode){const e=a._addToBottom;a._inlineEditDetails.addTask(),a._addToBottom=e}const s=document.createElement("div"),l={},r=a.dataSourceMap;l[r.status]=e.dataField,a._currentUser.info&&(void 0===l[r.createdUserId]?(l[r.createdUserId]=a._currentUser.info.id,l[r.createdDate]=new Date):l[r.createdDate]||(l[r.createdDate]=new Date));const o=document.createElement("div");o.style.position="relative",o.classList.add("smart-kanban-task"),s.appendChild(o);const i=t.parentElement.querySelector(".smart-kanban-column-content-tasks");if(a._addToBottom)i.appendChild(s);else{const e=i.querySelector(".smart-kanban-task");e?e.parentElement.insertBefore(s,e):i.appendChild(s)}a._refreshButtonsAndSummaries();const n=document.createElement("textarea");n.placeholder=a.localize("textPlaceholder"),n.style.position="absolute",n.style.backgroundColor="transparent",n.style.borderLeftWidth=n.style.borderTopWidth=n.style.borderRightWidth=n.style.borderBottomWidth="0px",n.style.outline="0px",n.style.left="0px",n.style.bottom="0px",n.style.width="100%",n.style.height="100%",n.style.resize="none",o.style.height="70px",o.style.marginBottom="10px";const d=()=>{a._addToBottom?i.scrollTop=i.scrollHeight:i.scrollTop=0};o.appendChild(n),d();const c=()=>{const e=a._inlineEditDetails.input,t=a._inlineEditDetails.popup;e.onchange=e.onblur=null,t.remove(),l[a.dataSourceMap.text]=e.value,a.addTask(l,a._addToBottom?-1:0)&&d(),delete a._addToBottom};n.onchange=n.onblur=e=>{c(),e.preventDefault()},n.onkeydown=e=>{"Enter"===e.key?(c(),e.preventDefault()):"Escape"===e.key&&(n.onchange=n.onblur=null,s.remove(),a._refreshButtonsAndSummaries(),d(),e.preventDefault())," "===e.key&&e.stopPropagation()},a._inlineEditDetails={popup:s,input:n,addTask:c},setTimeout((()=>{n.focus()}),50)}_containerClickHandler(e){const t=this,a=t.isInShadowDOM||t.shadowRoot?e.composedPath()[0]:e.target;if(t.$.header.contains(a))return void t._headerClickHandler(a,t.$.body);const s=a.closest(".smart-kanban-column-header");if(s){const l=s.parentElement.column;if(a instanceof HTMLInputElement)return;if(t.columnActions&&a.classList.contains("smart-kanban-column-actions")){if(!t._columnActionsList.parentElement||t._columnActionsList.classList.contains("smart-visibility-hidden")){if(t._columnActionsListDate&&new Date-t._columnActionsListDate<300)return;t._openColumnActionsList(a,l)}return}if(a.closest(".smart-kanban-column-header-add")&&l)return void(t.disableAddNewDialog?t._inlineTaskAdd(l,s,e):t._openDialog(l,"add","column"));if(t.collapsible&&l&&l.collapsible&&a.closest(".smart-kanban-column-header-toggle-button"))return void t[l.collapsed?"expand":"collapse"](l)}const l=a.closest(".smart-kanban-tab");if(l){if(l.classList.contains("selected"))return;const e=l.parentElement.querySelector(".selected");return e.classList.remove("selected"),e.setAttribute("aria-selected",!1),e.columnElement.classList.add("smart-hidden"),e.columnElement.column.selected=!1,l.classList.add("selected"),l.setAttribute("aria-selected",!0),l.columnElement.classList.remove("smart-hidden"),l.columnElement.column.selected=!0,t._selectedTabs=t._allColumns.filter((e=>e.selected)).map((e=>e.dataField)),t._autoSaveState("tabs"),void t._allColumns.forEach((e=>t._refreshScrollViewer(e)))}if(t.addNewColumn){const e=a.closest(".smart-kanban-add-new-column"),s=a.closest(".smart-color-input"),l=a.closest(".smart-kanban-column-header");if(!s&&e&&!e.querySelector(".pending")&&l)return void t._addNewColumnDynamically()}const r=a.closest(".smart-kanban-list .item");if(r){const e=r.getAttribute("data-id"),a=t._userSelectionFor,s=t._prioritySelectionFor;if(a){const s=t.dataSourceMap,l=a.data[s.userId],r=JSON.parse(JSON.stringify(a.data));if(parseInt(a.data[s.userId])===parseInt(e)?a.data[s.userId]=null:a.data[s.userId]=e,t._updateUserIcon(a),t._closeList(t._userList,"_userSelectionFor"),a.data[s.userId]!==l){t.dataSource&&t.dataSource.virtualDataSource&&t._requestVirtualDataSource("update",a.data,(function(e){return e||(a.data[s.userId]=l,t._updateUserIcon(a)),e}));const e=a.data;if(t._currentUser.info){a.data[s.updatedUserId]=t._currentUser.info.id,a.data[s.updatedDate]=new Date;const l={user:t._currentUser.info.id,label:e[s.text],date:e[s.updatedDate]};e[s.userId]!==r[s.userId]&&(l.action="user",l.details={oldValue:r[s.userId],value:e[s.userId]},t.addHistory(e,l))}const o=JSON.parse(JSON.stringify(e));t.$.fireEvent("change",{task:a,id:o.id,value:o,oldValue:r}),t.$.fireEvent("taskUpdate",{id:o.id,value:o,oldValue:r}),t._autoSaveState("dataSource")}return}if(s){const e=t.dataSourceMap,a=s.data[e.priority],l=JSON.parse(JSON.stringify(s.data));if(s.data[e.priority]=r.getAttribute("priority"),t._closeList(t._priorityList,"_prioritySelectionFor"),s.data[e.priority]!==a){t._currentUser.info&&(s.data[e.updatedUserId]=t._currentUser.info.id,s.data[e.updatedDate]=new Date);const a=s.data,r=JSON.parse(JSON.stringify(a));if(t._currentUser.info){s.data[e.updatedUserId]=t._currentUser.info.id,s.data[e.updatedDate]=new Date;const r={user:t._currentUser.info.id,date:a[e.updatedDate]};a[e.priority]!==l[e.priority]&&(r.action="priority",r.details={oldValue:l[e.priority],value:a[e.priority]},t.addHistory(a,r))}t.$.fireEvent("change",{task:s,id:r.id,value:r,oldValue:l}),t.$.fireEvent("taskUpdate",{id:r.id,value:r,oldValue:l}),t._updateTaskPriority(s),t._autoSaveState("dataSource")}}const l=t._actionSelectionFor,o=t._columnActionSelectionFor;if(l){switch(parseFloat(e)){case 0:r.hasAttribute("edit")&&(t._actionsList.classList.contains("edit-comment")?(t._commentsList.textarea.value=l.comment.text,t._commentsList.textarea.focus(),t._commentsList.editing=l,l.parentElement.scrollTop=l.offsetTop):t.beginEdit(l));break;case 1:r.hasAttribute("copy")&&t.copyTask(l);break;case 2:r.hasAttribute("remove")&&(t._actionsList.classList.contains("edit-comment")?t._openDialog(l,"prompt","comment"):t.removeTask(l,!0))}return void t._closeList(t._actionsList,"_actionSelectionFor")}if(o){switch(parseFloat(e)){case 0:t._handleColumnEditing(o.dataField);break;case 1:{const e=t._columnToElement.get(o).querySelector(".smart-kanban-column-header-add");e?e.click():t._openDialog(o,"add","column");break}case 2:t.collapse(o);break;case 3:t._openDialog(o,"prompt","column");break;case 4:t.hide(o);break;case 5:t.showAllColumns()}return void t._closeList(t._columnActionsList,"columnActionSelectionFor")}}if(a.closest(".smart-kanban-list.comments")){const e=a.closest(".send");if(e){if(e.disabled)return;const a=JSON.parse(JSON.stringify(t._commentSelectionFor.data)),s=t._createComment();t._commentsList.textarea.value="",e.disabled=!0;const l=JSON.parse(JSON.stringify(t._commentSelectionFor.data));t.$.fireEvent("change",{task:t._commentSelectionFor,id:l.id,value:l,oldValue:a}),t.$.fireEvent("taskUpdate",{id:l.id,value:l,oldValue:a}),t.$.fireEvent("commentAdd",{id:l.id,value:s})}else if(a.classList.contains("remove-button")&&a.classList.contains("enabled")){const e=a.closest(".smart-comment");t._actionSelectionFor&&(t._actionSelectionFor===e||t._actionSelectionFor.classList.contains("smart-kanban-task")||t._actionsList.parentElement&&!t._actionsList.classList.contains("smart-visibility-hidden"))||t._openActionsList(a,void 0,e)}return}const o=a.closest(".smart-kanban-task");if(o)if(a.classList.contains("smart-kanban-task-user"))!t.userList||!t._currentUser.allowEdit||t._userSelectionFor&&(t._userSelectionFor===o||t._userList.parentElement&&!t._userList.classList.contains("smart-visibility-hidden"))||t._openUserList(a,o);else if(a.classList.contains("priority")&&t.priorityList)!t._priorityList||!t._currentUser.allowEdit||t._prioritySelectionFor&&(t._prioritySelectionFor===o||t._priorityList.parentElement&&!t._priorityList.classList.contains("smart-visibility-hidden"))||t._openPriorityList(a,o);else if(t.taskActions&&a.classList.contains("smart-kanban-task-actions"))t._actionSelectionFor&&(t._actionSelectionFor===o||t._actionSelectionFor.classList.contains("comment")||t._actionsList.parentElement&&!t._actionsList.classList.contains("smart-visibility-hidden"))||t._openActionsList(a,o);else if(t.taskComments&&a.classList.contains("smart-kanban-task-comments"))t.users.length>0&&(!t._commentSelectionFor||t._commentSelectionFor!==o&&(!t._commentsList.parentElement||t._commentsList.classList.contains("smart-visibility-hidden")))&&t._openCommentsList(a,o);else if((!t.taskSubTasksInput||!a.classList.contains("smart-kanban-task-input"))&&(!t.taskSubTasksInput||!a.classList.contains("smart-kanban-task-subtasks")||"singleClick"!==t.editMode)&&(!o||o.data)&&(t.$.fireEvent("taskClick",{id:o.data.id,value:o.data,element:o}),t._preventSelection||t._selectTask(e,o),"singleClick"!==t.editMode||t._dragDetails||"INPUT"===a.nodeName||"TEXTAREA"===a.nodeName||a.classList.contains("smart-kanban-task-subtasks-container")||"IMG"===a.nodeName||t.beginEdit(o),e.type))if(clearTimeout(t._dblclickObject.timeout),t._dblclickObject.numberOfClicks++,2===t._dblclickObject.numberOfClicks){if(t._dblclickObject.numberOfClicks=0,o.hasAttribute("selected")||t._selectTask(e,o),t.$.fireEvent("taskDoubleClick",{id:o.data.id,value:o.data,element:o}).defaultPrevented)return;"doubleClick"===t.editMode&&t.beginEdit(o)}else t._dblclickObject.timeout=setTimeout((function(){t._dblclickObject.numberOfClicks=0}),300)}_selectTask(e,t){const a=this,s=a.selectionMode,l=()=>{a._selectedTasks.forEach((e=>{if(e!==t.data.id){const t=a.querySelector('[data-id="'+e+'"]');t&&t.removeAttribute("selected")}}))};function r(){l(),t.hasAttribute("selected")||(t.setAttribute("selected",""),a._selectedTasks=[t.data.id]),a._selectionStart=t.data.id,a._selectionInView=t.closest("smart-scroll-viewer"),a._autoSaveState("selection"),a._focusTask(t)}if("zeroOrOne"===s)l(),t.hasAttribute("selected")?(a._focusTask(t),t.removeAttribute("selected"),a._selectedTasks=[],delete a._selectionInView):(t.setAttribute("selected",""),a._selectedTasks=[t.data.id],a._selectionStart=t.data.id,a._selectionInView=t.closest("smart-scroll-viewer"),a._focusTask(t)),a.virtualization&&a._refreshColumns();else{if(!e.ctrlKey&&!e.shiftKey&&!e.metaKey||0===a._selectedTasks.length||t.closest("smart-scroll-viewer")!==a._selectionInView)return void r();if(e.ctrlKey||e.metaKey)t.hasAttribute("selected")?(t.removeAttribute("selected"),a._selectedTasks=a._selectedTasks.filter((e=>e!==t.data.id))):(t.setAttribute("selected",""),a._selectedTasks.push(t.data.id),a._selectionStart=t.data.id);else if(e.shiftKey){if(t&&t.id===a._selectionStart)return a._selectedTasks.length>1&&r(),void(a.virtualization&&a._refreshColumns());const e=t[a.dataSourceMap.status],s=a._getTasksByDataField(e),l=a.getTask(a._selectionStart);let o=s.indexOf(l),i=s.indexOf(t.id);const n=o;o=Math.min(o,i),i=Math.max(n,i),a._selectedTasks=[],s.forEach(((e,t)=>{const s=a.querySelector('[data-id="'+e.id+'"]');t>=o&&t<=i&&!e.filteredOut?(s&&s.setAttribute("selected",""),a._selectedTasks.push(e.id)):s&&s.removeAttribute("selected")}))}a._focusTask(t)}a.virtualization&&a._refreshColumns(),a._autoSaveState("selection")}_processDataSource(){const e=this;let t=e.dataSource;if(0!==e.columns.length&&null!=t){if(t instanceof Smart.DataAdapter){if(t.virtualDataSource)return void e._requestVirtualDataSource("dataBind");t=t.dataSource}t.length>500&&(e.virtualization=!0),t.forEach((t=>{e._createTask(t)})),e.virtualization&&(e._measureCardHeight(),e._refreshColumns()),e.whenRendered((()=>e._allColumns.forEach((t=>e._refreshScrollViewer(t)))))}}_requestVirtualDataSource(e,t,a){const s=this,l=s.dataSourceMap,r=[],o=[],i={},n=s._appliedFiltering;let d=null;if(n&&n.filterGroups.length>0&&(n.filterGroups.forEach((e=>o[e[0]]=e[1])),o.length=n.filterGroups.length,d=n.operator),s._appliedSorting&&s._appliedSorting.dataFields.length>0&&(s._appliedSorting.dataFields.forEach(((e,t)=>{let a=s._appliedSorting.orderBy[t].replace("ending","");r[e]={sortOrder:a,sortIndex:t}})),r.length=s._appliedSorting.dataFields.length),void 0!==t){const e=Object.assign({},t);e[l.checklist]=JSON.stringify(e[l.checklist]),e[l.history]=JSON.stringify(e[l.history],(function(e,t){return"date"===e?new Date(t).toISOString().slice(0,19).replace("T"," "):t})),e[l.comments]=JSON.stringify(e[l.comments],(function(e,t){return"time"===e?new Date(t).toISOString().slice(0,19).replace("T"," "):t})),e[l.updatedDate]&&(e[l.updatedDate]=e[l.updatedDate].toISOString().slice(0,10)),e[l.createdDate]&&(e[l.createdDate]=e[l.createdDate].toISOString().slice(0,10)),e[l.dueDate]&&(e[l.dueDate]=e[l.dueDate].toISOString().slice(0,10)),e[l.startDate]&&(e[l.startDate]=e[l.startDate].toISOString().slice(0,10)),i.row=e}s.dataSource.onVirtualDataSourceRequested((function(t){let l=!0;-1!==["add","update","remove"].indexOf(e)&&a&&(l=a(t.result),"add"!==e)||l&&(Array.from(s.$.container.querySelectorAll("smart-scroll-viewer.smart-kanban-column-content-tasks")).forEach((e=>e.clearContent())),s.dataSource.dataSource.forEach((e=>{s._createTask(e)})),s._allColumns.forEach((e=>s._refreshScrollViewer(e))),s._autoSaveState("dataSource"))}),{first:0,last:0,sorting:r,filtering:o,filterOperator:d,grouping:[],edit:i,action:e})}_setUserList(){const e=this,t=document.createElement("div");t.id=e.id+"UserList",t.className="smart-kanban-list users smart-visibility-hidden",t.setAttribute("role","listbox"),e.disabled||e.unfocusable||(t.tabIndex=0),e.users.forEach((e=>{const a=document.createElement("div"),s=e?e.image:null,l=s?`background-image: url('${s}');`:"";a.className="item",a.innerHTML=`<div class="icon" style="${l}"></div><div class="name">${e.name}</div>`,a.setAttribute("data-id",e.id),a.setAttribute("role","option"),t.appendChild(a)})),e._userList=t}_setPriorityList(){const e=this,t=document.createElement("div");t.id=e.id+"PriorityList",t.className="smart-kanban-list priority smart-visibility-hidden",t.setAttribute("role","listbox"),e.disabled||e.unfocusable||(t.tabIndex=0),e._getPriority().forEach((e=>{const a=document.createElement("div");a.className="item",e.menuLabel?a.innerHTML=e.menuLabel:a.innerHTML=`<div priority="${e.value}" class="smart-kanban-task-text">${e.menuIcon}${e.label}</div>`,a.setAttribute("priority",e.value),a.setAttribute("role","option"),t.appendChild(a)})),e._priorityList=t;const a=e._dialog;a&&a.editPanelPopulated&&(a.editors.priority.dataSource=e._getPriority())}_openList(e,t,a){const s=this,l=e.getBoundingClientRect();let r,o,i=l.left,n=l.top+e.offsetHeight;a=s.rightToLeft?!a:a,1===window.devicePixelRatio?(r=document.documentElement.clientWidth,o=document.documentElement.clientHeight):(r=window.innerWidth,o=window.innerHeight),t.classList.add("dialog"),document.body.appendChild(t),a&&(i=l.right-t.offsetWidth),i+t.offsetWidth>r&&(i=r-t.offsetWidth),n+t.offsetHeight>o&&(n=o-t.offsetHeight),t.style.left=Math.max(0,i)+"px",t.style.top=n+"px",t.classList.remove("smart-visibility-hidden"),e.setAttribute("aria-expanded",!0),e.setAttribute("aria-controls",t.id),s.unfocusable||requestAnimationFrame((function e(){0===t.getBoundingClientRect().height?requestAnimationFrame(e):t.focus()})),t.openedFrom=e,t.onclick=e=>{s._containerClickHandler(e)}}_openUserList(e,t){const a=this;if(0===a.users.length)return;const s=t.data[a.dataSourceMap.userId],l=a._userList,r=l.querySelector(".selected");if(r&&(r.classList.remove("selected"),r.removeAttribute("aria-selected")),a._openList(e,l),null!==s){const e=Array.from(l.children).find((e=>e.getAttribute("data-id")===s.toString()));e&&(e.classList.add("selected"),e.setAttribute("aria-selected",!0),l.scrollTop=e.offsetTop)}a._userSelectionFor=t}_openPriorityList(e,t){const a=this,s=t.data[a.dataSourceMap.priority],l=a._priorityList,r=l.querySelector(".selected");if(r&&(r.classList.remove("selected"),r.removeAttribute("aria-selected")),a._openList(e,l),null!=s){const e=Array.from(l.children).find((e=>e.getAttribute("priority")===s.toString()));e&&(e.classList.add("selected"),e.setAttribute("aria-selected",!0),l.scrollTop=e.offsetTop)}a._prioritySelectionFor=t}_closeList(e,t){const a=this;if(!e||!e.parentElement)return;const s=a.$.container.querySelector(`[aria-expanded="true"][aria-controls="${e.id}"]`);e.classList.add("smart-visibility-hidden"),requestAnimationFrame((function s(){e.classList.contains("smart-visibility-hidden")&&(e.getBoundingClientRect().height>0?requestAnimationFrame(s):(e.remove(),delete e.openedFrom,delete a[t]))})),s&&(s.removeAttribute("aria-expanded"),s.removeAttribute("aria-controls"))}_setActionsList(){const e=this,t=document.createElement("div");if(t.id=e.id+"ActionsList",t.className="smart-kanban-list actions smart-visibility-hidden",t.setAttribute("role","menu"),e.disabled||e.unfocusable||(t.tabIndex=0),t.innerHTML=`<div class="item" edit data-id="0" role="menuitem"><div class="name">${e.localize("edit")}</div></div>\n<div class="item" copy data-id="1" role="menuitem"><div class="name">${e.localize("copy")}</div></div>\n<div class="item" remove data-id="2" role="menuitem"><div class="name">${e.localize("remove")}</div></div>`,e.taskActionsRendered){e.taskActionsRendered(t);const a=Array.from(t.children);for(let e=0;e<a.length;e++){const t=a[e];t.classList.add("item"),t.setAttribute("data-id",e),t.setAttribute("role","menuitem"),t.firstElementChild&&t.firstElementChild.classList.add("name")}}e._actionsList=t}_setColumnActionsList(){const e=this,t=document.createElement("div");t.id=e.id+"ColumnActionsList",t.className="smart-kanban-list actions smart-visibility-hidden",t.setAttribute("role","menu"),e.disabled||e.unfocusable||(t.tabIndex=0),t.innerHTML=`<div class="item" data-id="0" role="menuitem"><div class="name">${e.localize("edit")}</div></div>\n <div class="item" data-id="1" role="menuitem"><div class="name">${e.localize("addNewTask")}</div></div>\n <div class="item" data-id="2" role="menuitem"><div class="name">${e.localize("collapse")}</div></div>\n <div class="item" data-id="3" role="menuitem"><div class="name">${e.localize("removeColumn")}</div></div>\n <div class="item" data-id="4" role="menuitem"><div class="name">${e.localize("hideColumn")}</div></div>\n <div class="item" data-id="5" role="menuitem"><div class="name">${e.localize("showAllColumns")}</div></div>`,e._columnActionsList=t}_openActionsList(e,t,a){const s=this,l=s._currentUser,r=s._actionsList;s._openList(e,r,a),r.classList.toggle("edit-comment",!!a),s._actionSelectionFor=t||a,r.children[0]&&r.children[0].hasAttribute("edit")&&(t&&!l.allowEdit?r.children[0].classList.add("smart-hidden"):r.children[0].classList.remove("smart-hidden")),r.children[1]&&r.children[1].hasAttribute("add")&&(t&&!l.allowAdd?r.children[1].classList.add("smart-hidden"):r.children[1].classList.remove("smart-hidden")),r.children[2]&&r.children[0].hasAttribute("remove")&&(t&&!l.allowRemove?r.children[2].classList.add("smart-hidden"):r.children[2].classList.remove("smart-hidden")),Array.from(r.children).forEach((e=>e.classList.remove("selected")))}_openColumnActionsList(e,t){const a=this,s=a._columnActionsList,l=s.children;a.allowColumnEdit&&t.editable&&"header"!==a.columnEditMode?l[0].classList.remove("smart-hidden"):l[0].classList.add("smart-hidden"),a.addNewButton&&t.addNewButton?l[1].classList.remove("smart-hidden"):l[1].classList.add("smart-hidden"),a.allowColumnRemove&&t.allowRemove&&a._allColumns.length>1?l[3].classList.remove("smart-hidden"):l[3].classList.add("smart-hidden"),a.collapsible&&t.collapsible?l[2].classList.remove("smart-hidden"):l[2].classList.add("smart-hidden"),a.allowColumnHide&&t.allowHide&&a._allColumns.length>1?(l[4].classList.remove("smart-hidden"),l[5].classList.remove("smart-hidden")):(l[4].classList.add("smart-hidden"),l[5].classList.add("smart-hidden")),a._openList(e,s),a._columnActionSelectionFor=t,Array.from(s.children).forEach((e=>e.classList.remove("selected")))}_setCommentsList(){const e=this,t=document.createElement("div");t.id=e.id+"CommentsList",t.className="smart-kanban-list comments smart-visibility-hidden",t.setAttribute("role","dialog"),e.disabled||e.unfocusable||(t.tabIndex=0),t.innerHTML=`<div class="smart-kanban-comments" role="list"></div>\n<div class="smart-kanban-new-comment" role="presentation">\n <textarea placeholder="${e.localize("newComment")}"></textarea>\n <smart-button class="send primary" disabled${e._rtlAttr}>${e.localize("send")}</smart-button>\n</div>`;const a=t.querySelector("textarea"),s=t.querySelector("smart-button");s.tabIndex=0,a.onfocus=()=>{t.classList.add("expanded"),s.disabled=""===a.value},a.onblur=e=>{s.contains(e.relatedTarget)||t.classList.remove("expanded")},a.onkeyup=()=>{s.disabled=""===a.value},a.oncut=()=>{s.disabled=""===a.value},a.onpaste=()=>{s.disabled=""===a.value},t.textarea=a,t.button=s,e._commentsList=t}_openCommentsList(e,t){const a=this,s=a._commentsList;s.classList.remove("expanded"),s.firstElementChild.innerHTML="",s.textarea.value="",s.textarea.disabled=!a._currentUser.allowComment,a.unfocusable?s.textarea.tabIndex=-1:s.textarea.removeAttribute("tabindex"),delete s.editing,t.data[a.dataSourceMap.comments].forEach((e=>a._createComment(e))),a._openList(e,s),a._commentSelectionFor=t}_getCommentsList(e){const t=this,a=t._commentsList;return a.classList.remove("expanded"),a.firstElementChild.innerHTML="",a.textarea.value="",a.textarea.disabled=!t._currentUser.allowComment,t.unfocusable?a.textarea.tabIndex=-1:a.textarea.removeAttribute("tabindex"),delete a.editing,e.data[t.dataSourceMap.comments].forEach((e=>t._createComment(e))),t._commentSelectionFor=e,a.classList.remove("smart-visibility-hidden"),a}_createComment(e){const t=this,a=document.createElement("div");let s,l;function r(){const r=t._commentsList.firstElementChild,o=l?l.image:null,i=l?l.name||l.id:t.localize("guestUser"),n=l?l.name:t.localize("guestUser");a.classList="smart-comment",a.setAttribute("role","listitem");const d=o?`background-image: url('${o}');`:"";a.innerHTML=`<div class="comment-indent" role="presentation">\n <div class="user-icon" style="${d}" 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">${n}</div>\n <div class="time" aria-label="Comment time">${e.time?new Smart.Utilities.DateTime(e.time).toString(t.formatStringTime):""}</div>\n <div class="remove-button${t._currentUser&&t._currentUser.info&&l.id===t._currentUser.info.id&&t._currentUser.allowComment?" enabled":""}"${t._tabindex} role="button" aria-haspopup="menu" aria-label="Comment settings"></div>\n </div>\n <div class="comment-body" aria-label="Comment text">${e.text||""}</div >\n</div>`,a.comment=e,o||a.querySelector(".user-icon").classList.add("empty"),r.appendChild(a),s&&(r.scrollTop=r.scrollHeight-r.offsetHeight)}if(e)l=t.users.find((t=>t.id===e.userId));else{const a=t.dataSourceMap,o=t.dataSource&&t.dataSource.virtualDataSource,i=t._commentsList.textarea.value.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/'/g,"&#39;").replace(/"/g,"&quot;").replace(/\\/g,""),n=t._commentsList.editing,d=t._commentSelectionFor.data,c=JSON.parse(JSON.stringify(d));if(n){if(o){const e=Object.assign({},d);e[a.comments]=e[a.comments].slice(0),e[a.comments][e[a.comments].indexOf(n.comment)]=Object.assign({},n.comment,{text:i}),t._requestVirtualDataSource("update",e,(function(a){return a&&(t._commentSelectionFor.data=e,n.querySelector(".comment-body").innerHTML=i),delete t._commentsList.editing,a}))}else n.querySelector(".comment-body").innerHTML=i,n.comment.text=i,delete t._commentsList.editing;return t.$.fireEvent("commentUpdate",{id:d.id,value:n.comment}),t.$.fireEvent("taskUpdate",{id:d.id,value:d,oldValue:c}),void t.$.fireEvent("change",{task:t._commentSelectionFor,id:d.id,value:d,oldValue:c})}if(s=!0,e={text:i,id:function(){const e=function(){return(65536*(1+Math.random())|0).toString(16).substring(1)};return e()+e()}(),userId:t._currentUser&&t._currentUser.info?t._currentUser.info.id:-1,time:new Date},l=t._currentUser?t._currentUser.info:null,o){const s=Object.assign({},d);s[a.comments]=s[a.comments].slice(0),s[a.comments].push(e),t._requestVirtualDataSource("update",s,(function(e){return e&&(t._commentSelectionFor.data=s,t._commentSelectionFor.querySelector(".smart-kanban-task-comments").setAttribute("num",s[a.comments].length||""),r()),e}))}else d[a.comments].push(e),t._commentSelectionFor.querySelector(".smart-kanban-task-comments").setAttribute("num",d[a.comments].length||"")}return e.time instanceof Date==0&&(e.time=new Date(e.time),e.time.setTime(e.time.getTime()-1*e.time.getTimezoneOffset()*60*1e3)),r(),e}_getTaskIndexByPosition(e,t){const a=(e,t)=>{const a=e.top,s=e.top+e.height,l=a<=t&&s>t;return 0!==e.height&&l};return(t=>{let s=0,l=t.length-1;if(e<=0)return 0;const r=t[t.length-1];if(-1!==r.top&&r.top<=e)return t.length-1;for(;;){const r=Math.floor((s+l)/2),o=t[r];if(a(o,e))return r;o.top<e?s=r+1:o.top>e?l=r-1:s=r+1}})(t)}_refreshColumns(){const e=this;e.virtualization&&e._allColumns.forEach((t=>{e._refreshColumn(t.dataField)}))}_refreshColumn(e){const t=this.getColumn(e),a=this._columnToElement.get(t);if(!a)return;const s=a.querySelector("smart-scroll-viewer");this._refreshScrollHeight(s,e)}_getTasksByDataField(e){const t=this;let a=t.tasksByDataField[e];return a?a._filtered?a._filtered:a._sorted?a._sorted:a:(t.tasksByDataField[e]=[],t.tasksByDataField[e])}_refreshEmptyColumnState(e,t){const a=this;e&&(e.querySelector(".smart-kanban-task")||e.querySelector(".smart-kanban-task")&&!t?(e.removeAttribute("empty",a.localize("empty")),e.classList.remove("empty")):(e.setAttribute("empty",a.localize("empty")),e.classList.add("empty")))}_refreshScrollHeight(e,t){const a=this;if(a._refreshEmptyColumnState(e,t),!a.virtualization)return;const s=a._getTasksByDataField(t);if(!s)return;const l=a._autoCardHeight?a._autoCardHeight:a.cardHeight;e.scrollHeight=e.virtualScrollHeight=s.length*l-e.offsetHeight;for(let e=0;e<s.length;e++){const t=s[e];t.top=e*l,t.height=l}const r=e.querySelector(".smart-scroll-viewer-content-container"),o=e=>{const l=a._getTaskIndexByPosition(e,s),o=a.uiTasksByDataField[t].length;for(let e=0;e<o;e++){const o=s[l+e],i=a.uiTasksByDataField[t][e];i&&(a._dragDetails&&(i.classList.remove("dragged"),o&&a._dragDetails.ItemsData.forEach((e=>{e.id===o.id&&i.classList.add("dragged")}))),o?i.classList.remove("smart-hidden"):i.classList.add("smart-hidden"),0===e&&(r.style.marginTop=o?o.top+"px":"0px"),o)&&(i.hasAttribute("selected")&&i.removeAttribute("selected"),i.hasAttribute("focus")&&i.removeAttribute("focus"),JSON.stringify(o)!==JSON.stringify(i.data)&&(i.data=o,a._renderTask(i)),a._selectedTasks&&a._selectedTasks.indexOf(o.id)>=0&&i.setAttribute("selected",""),a._focusedTask===o.id&&i.setAttribute("focus",""))}};e.onVerticalChange=e=>{const t=e.detail.value;o(t)},a.uiTasksByDataField[t]||(a.uiTasksByDataField[t]=[]);const i=Math.round(e.offsetHeight/l)+2,n=a.uiTasksByDataField[t].length;if(0===n||n<i){const r=Math.round(e.offsetHeight/l)+2;for(let e=0;e<r;e++){const l=s[e];if(!l)continue;const r=a._createVirtualTask(l);a.uiTasksByDataField[t].push(r)}e.refresh(),e.scrollHeight=e.virtualScrollHeight=s.length*l-e.offsetHeight,o(e.scrollTop)}else o(e.scrollTop)}_createVirtualTask(e,t){const a=this,s=a.dataSourceMap,l=a._allColumns.find((t=>t.dataField===e[s.status]));if(!l)return;const r=document.createElement("div"),o=a._columnToElement.get(l),i=a.getTaskScrollViewer(o,e);return void 0===e[s.id]&&(e[s.id]=Math.floor(9e4*Math.random()+1e4)),r.className="smart-kanban-task smart-unselectable",r.setAttribute("role","listitem"),r.setAttribute("data-id",e[s.id]),a._currentUser.info&&(void 0===e[s.createdUserId]?(e[s.createdUserId]=a._currentUser.info.id,e[s.createdDate]=new Date):e[s.createdDate]||(e[s.createdDate]=new Date),e[s.history]=[],a.addHistory(e,{action:"created",user:a._currentUser.info.id,details:{value:e[s.text]},date:e[s.createdDate]})),r.data=e,r.column=l,a._renderTask(r),e.class&&"string"==typeof e.class&&r.classList.add(e.class),i.appendChild(r),a._updateTaskColor(r),t&&(l.collapsed?i.toRefresh=!0:i.refresh()),r}_measureCardHeight(){const e=this,t=Object.keys(e.tasksByDataField);if(0===t.length||0===e.columns.length)return null;if(null===e.cardHeight&&!e._autoCardHeight){const a=e.tasksByDataField[t[0]],s=e._createVirtualTask(a[0]);e._renderTask(s),a.class&&"string"==typeof a.class&&s.classList.add(a.class);const l=e.columns[0],r=e._columnToElement.get(l),o=e.getTaskScrollViewer(r,a);o.appendChild(s);const i=o.querySelector(".smart-scroll-viewer-content-container"),n=getComputedStyle(i).rowGap;e._autoCardHeight=s.offsetHeight+parseInt(n),s.remove()}}_createTask(e,t,a){const s=this,l=s.dataSourceMap,r=s._allColumns.find((t=>t.dataField===e[l.status]));if(!r)return;const o=document.createElement("div"),i=s._columnToElement.get(r),n=s.getTaskScrollViewer(i,e);if(void 0===e[l.id]&&(e[l.id]=Math.floor(9e4*Math.random()+1e4)),o.className="smart-kanban-task smart-unselectable",o.setAttribute("role","listitem"),o.setAttribute("data-id",e[l.id]),s._currentUser&&s._currentUser.info&&(void 0===e[l.createdUserId]?(e[l.createdUserId]=s._currentUser.info.id,e[l.createdDate]=new Date):e[l.createdDate]||(e[l.createdDate]=new Date),e[l.history]||(e[l.history]=[],s.addHistory(e,{action:"created",user:s._currentUser.info.id,details:{value:e[l.text]},date:e[l.createdDate]}))),o.data=e,o.column=r,s.tasksByDataField[r.dataField]||(s.tasksByDataField[r.dataField]=[]),a>=0?s.tasksByDataField[r.dataField].splice(a,0,e):s.tasksByDataField[r.dataField].push(e),s.taskById[e.id]=e,!s.virtualization){if(s._renderTask(o),e.class&&"string"==typeof e.class&&o.classList.add(e.class),a>=0){const e=n.querySelector(".smart-kanban-task");e?e.parentElement.insertBefore(o,e):n.appendChild(o)}else n.appendChild(o);return s._updateTaskColor(o),t&&(r.collapsed?n.toRefresh=!0:n.refresh()),o}}getTaskScrollViewer(e,t){const a=this,s=a.dataSourceMap;let l;return a._hasSwimlane(e.index)?void 0!==t[s.swimlane]&&a.swimlanes.find((e=>e.dataField===t[s.swimlane]))?l=e.querySelector(`smart-scroll-viewer[swimlane="${t[s.swimlane]}"]`):(l=e.querySelector("smart-scroll-viewer"),t[s.swimlane]=l.getAttribute("swimlane")):(l=e.querySelector("smart-scroll-viewer"),delete t[s.swimlane]),l}_renderTask(e){const t=this;t._applyTaskTemplate(e),t._updateUserIcon(e),t._updateTaskChecked(e),t._updateTaskProgress(e),t._updateTaskDueDate(e),e.parentElement&&t._updateTaskColor(e),t._updateTaskPriority(e),e.column&&t.columnSummary&&t._updateColumnSummary(e.column),t.onTaskRender&&t.onTaskRender(e,e.data)}_refreshSummaries(){const e=this,t=e.querySelectorAll(".smart-kanban-column");for(let a=0;a<t.length;a++){const s=t[a].column;e._updateColumnSummary(s)}}_updateColumnSummary(e){const t=this,a=t._columnToElement.get(e);if(!a||!t.columnSummary)return;const s=t._getColumnSummary(e),l=a.querySelector(".summary");if(l&&(l.innerHTML=s),t.columnFooter){const l=a.querySelector(".smart-kanban-column-footer");if(s.length){let e=parseInt(s.replace("(","").replace(")","").trim());l.innerHTML=1===e?t.localize("tasksSummaryOne"):t.localize("tasksSummary",{summary:e})}else l.innerHTML="";t.onColumnFooterRender&&t.onColumnFooterRender(l,e,e.dataField)}a.removeAttribute("wip-min-error"),a.removeAttribute("wip-max-error"),void 0!==e.min&&(a.setAttribute("min",e.min),s.length?parseInt(s.replace("(","").replace(")","").trim())<e.min&&a.setAttribute("wip-min-error",""):0<e.min&&a.setAttribute("wip-min-error","")),void 0!==e.max&&(a.setAttribute("max",e.max),s.length)&&parseInt(s.replace("(","").replace(")","").trim())>e.max&&a.setAttribute("wip-max-error","")}_createAttachment(e){const t=e.target.classList.contains("attachments")?e.target:e.target.closest(".attachments"),a=t.getAttribute("data-field"),s=t.closest("smart-kanban"),l=s._fieldAttachmentValue[a],r=l&&"string"==typeof l?JSON.parse(l):l,o=e.target.closest(".item");if(!o)return;const i=o.getAttribute("value"),n=l.findIndex((e=>e.value===i));if(r[n]){const e=document.createElement("a");if(r[n].value.indexOf(window.location.host)>=0)fetch(r[n].value).then((e=>e.blob())).then((t=>{const a=URL.createObjectURL(t);e.download=r[n].label,e.href=a,e.click()}));else{if(r[n].value.indexOf("base64")>=0){const t=s._getFileFromBase64(r[n].value);e.href=URL.createObjectURL(t)}else e.href=r[n].value;e.target="_blank",e.click()}}e.stopPropagation(),e.preventDefault()}_createImageModal(e,t){const a=this,s=document.createElement("smart-window");s.animation=a.animation,s.headerButtons=["close"],s.rightToLeft=a.rightToLeft,s.resizeMode="none",s.theme=a.theme,s.style.height="auto",s.style.width="auto",s.style.maxWidth="1000px",s.style.maxHeight="1000px",document.body.appendChild(s),s.onclose=()=>{document.body.removeChild(s)},s.innerHTML="",s.label=e.title;const l=e.cloneNode(!0);e.hasAttribute("value")&&(l.src=e.getAttribute("value")),l.removeAttribute("onpointerdown"),l.removeAttribute("width"),l.removeAttribute("height"),l.style.maxWidth="800px",l.style.maxHeight="800px",s.appendChild(l),s.open(),t.stopPropagation(),t.preventDefault()}_applyTagsContent(e,t,a){const s=this;let l=s.tags;const r=s.dataSourceMap;l||(l=[]);let o="";if(e&&e.indexOf&&e.indexOf("{")>=0&&(e=JSON.parse(e)),e&&"string"==typeof e){if("[]"===e)return t[r.tags]="",o;e=e.split(",");for(let t=0;t<e.length;t++)e[t]=e[t].trim();l&&l.length>0?(e=e.filter((e=>{if(-1!==l.indexOf(e))return!0})),t[r.tags]=e.join(", ")):s.allowCustomTags?e.forEach((e=>{-1===s._customTags.indexOf(e)&&"[objectObject]"!==e&&s._customTags.push(e)})):e=[],o=e.map((e=>`<span class="smart-kanban-task-tag" role="listitem">${e}</span>`)).join("")}else e&&"object"==typeof e?(Array.isArray(e)||(e=[e],t[r.tags]=e),l.length>0?(s.allowCustomTags?e.forEach((e=>{if(-1===s._customTags.indexOf(e)&&"[objectObject]"!==e){let t=!0;if(s.tags)for(let a in s.tags){const l=s.tags[a];(e===l||JSON.stringify(e)===JSON.stringify(l))&&(t=!1)}t&&s._customTags.push(e)}})):e=e.filter((e=>{if(-1!==l.indexOf(e))return!0;if(e.value){let t=!1;if(l.find((a=>{a===e.value&&(t=!0),a.value===e.value&&(t=!0)})),t)return!0}})),t[r.tags]=e):s.allowCustomTags?e.forEach((e=>{-1===s._customTags.indexOf(e)&&"[objectObject]"!==e&&s._customTags.push(e)})):(e=[],t[r.tags]=[]),o=e.map((e=>{if(e.color){const t=e.color||"rgba(var(--smart-primary-rgb), 0.15)",a=document.createElement("div");document.body.appendChild(a),a.style.backgroundColor=t;const s=getComputedStyle(a).backgroundColor;return a.remove(),`<span style="color: ${new Smart.Color(s).getInvertedColor()}; background: ${t} " class="smart-kanban-task-tag" role="listitem">${e.label}</span>`}return`<span class="smart-kanban-task-tag" role="listitem">${"string"==typeof e?e:e.label}</span>`})).join("")):t[r.tags]="";return o}_applyTaskTemplate(e){const t=this,a=t.dataSourceMap,s=(t.tags,e.data),l=t._tabindex;let r=s[a.text],o=s[a.description],i=s[a.tags],n="",d=r;void 0===r&&(r="",s[a.text]="",d=r),void 0===o&&(o="",s[a.description]=""),r=t._applyTextTemplate(r,s,e),n=t._applyTagsContent(i,s,e),"string"==typeof s[a.priority]&&(s[a.priority]=s[a.priority].toLowerCase());const c=t._getPriority();let u=c.findIndex((e=>e.value===s[a.priority]));const m=c.length>0&&u>=0?c[u]:null;s[a.comments]&&Array.isArray(s[a.comments])||(s[a.comments]=[]);const p=t.localize(s[a.priority])+" "+t.localize("priority");let h=d?`${d}: ${p}`:`${p}`;t.taskPriority||(h=d);let g=`<div class="smart-kanban-task-cover"></div><div title="${h}" class="smart-kanban-task-content" role="presentation">\n <div class="smart-kanban-task-text">${r}`;g+=m?`${m.menuIcon}`:'<span style="margin-left: 0px; margin-right: 5px;" class="priority"></span>';let f=s[a.description].replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/'/g,"&#39;").replace(/"/g,"&quot;");g+=`</div>\n <div class="smart-kanban-task-user"${l} role="button" aria-haspopup="listbox"></div>\n</div>\n<div class="smart-kanban-task-info" role="presentation">\n <div class="smart-kanban-task-progress-container">\n <div class="smart-kanban-task-progress" role="progressbar" aria-label="Task progress" aria-valuemin="0" aria-valuemax="100"></div>\n <div class="smart-kanban-task-checked" aria-label="Completed sub-tasks"></div>\n </div>\n <div class="smart-kanban-task-due" aria-label="Task due date"></div>\n</div>\n<div class="smart-kanban-task-fields"></div>\n<div class="smart-hidden smart-kanban-task-subtasks">\n <div class="smart-kanban-task-subtasks-container"></div>\n <div><input class="smart-kanban-task-input smart-input" placeholder="${t.localize("newSubtask")}"/></div>\n</div>\n<div class="smart-hidden smart-kanban-task-custom-fields"></div>\n<div class="smart-kanban-task-footer" role="toolbar" aria-label="Task footer">\n <div class="smart-kanban-task-tags" role="list" aria-label="Tags list">${n}</div>\n <div class="smart-kanban-task-edit smart-hidden"${l} title="${t.localize("edit")}" role="button" aria-label="Edit"></div>\n <div title="${t.localize("actionsList")}" class="smart-kanban-task-actions"${l} role="button" aria-haspopup="menu" aria-label="Open actions list"></div>\n <div class="smart-kanban-task-comments"${l} num="${s[a.comments].length||""}" role="button" aria-haspopup="dialog" aria-label="Open comments list"></div>\n <div class="smart-kanban-task-description smart-hidden"${l} title="${t.localize("taskDescription",{value:f})}" num="${s[a.description]?s[a.description].length:""}" role="button" aria-label="Show description"></div>\n</div>`,e.innerHTML=g,e.setAttribute("aria-label",s[a.text]);const b=e.querySelector(".smart-kanban-task-description");s[a.description]?b.classList.remove("smart-hidden"):b.classList.add("smart-hidden");const v=e.querySelector(".smart-kanban-task-edit");t.editable?v.classList.remove("smart-hidden"):v.classList.add("smart-hidden"),v.onpointerdown=a=>{t.beginEdit(e),a.preventDefault(),a.stopPropagation()},e.onmousemove=()=>{Smart.Kanban.kanbanTaskDragged&&t.allowDropPlaceholder&&setTimeout((()=>{const a=e.classList.contains("before"),s=e.classList.contains("after");(a||s)&&(Smart.Kanban.dropOverTask&&Smart.Kanban.dropOverTask!==e&&delete Smart.Kanban.isBefore,Smart.Kanban.isBefore!==a&&(Smart.Kanban.isBefore=a,Smart.Kanban.dropOverTask=e,(a=>{e.classList.add("smart-kanban-task-placeholder"),t._dropAreaTimer&&clearTimeout(t._dropAreaTimer),t._dropAreaTimer=setTimeout((()=>{setTimeout((()=>{document.querySelectorAll(".smart-kanban-task-placeholder").forEach((e=>{e.style.marginTop=e.style.marginBottom="0px"}));const s=e.closest(".smart-kanban-column");if(s&&s.hasAttribute("orientation")&&"horizontal"!==s.getAttribute("orientation")){const s=t._dragDetails?t._dragDetails.Item:null;e!==s&&(a?e.previousElementSibling!==s&&(e.style.marginTop="100px"):e.nextElementSibling!==s&&(e.style.marginBottom="100px"))}t._refreshButtonsAndSummaries()}),20)}),20)})(a)))}))},t._updateTaskCustomFields(e),t._updateTaskSubtasks(e)}_updateTaskCustomFields(e){const t=this,a=e.data;if(t.taskCustomFieldsHide){const t=e.querySelector(".smart-kanban-task-custom-fields");t&&t.classList.remove("smart-hidden")}else if(t.taskCustomFields.length>0&&!t.taskCustomFieldsHide){const s=e.querySelector(".smart-kanban-task-custom-fields");s.classList.remove("smart-hidden");for(let l=0;l<t.taskCustomFields.length;l++){const r=t.taskCustomFields[l];let o=a[r.dataField],i="";if(!t.dataSourceMap[r.dataField]&&"password"!==r.editor)if(null!=o&&!1!==r.visible){if(void 0===r.visible&&(r.visible=!0),void 0===r.allowHide&&(r.allowHide=!0),!r.dataSource||r.dataSource&&0===r.dataSource.length){if("string"==typeof o&&o.length>50&&o.indexOf("base64")>=0&&"image"===r.editor){o=JSON.parse(o),window.Smart._createSmartImageModal=t._createImageModal;let a="";for(let e=0;e<o.length;e++){const t=o[e];a+=`<img style="margin-left: 5px;" onpointerdown="Smart._createSmartImageModal(this, event)" src="${t.value}" title="${t.label}"/>`}if(o=a,r.cover){const t=e.querySelector(".smart-kanban-task-cover");t.classList.add("smart-kanban-task-cover-content"),t.innerHTML=o}}else if("string"==typeof o&&r.image&&o.indexOf("http")>=0){if(window.Smart._createSmartImageModal=t._createImageModal,o.indexOf(",")>=0){let e="";o=o.split(",");for(let t=0;t<o.length;t++)e+=`<img style="margin-left: 5px;" onpointerdown="Smart._createSmartImageModal(this, event)" src="${o[t]}"/>`;o=e}else o=`<img style="margin-left: 5px;" onpointerdown="Smart._createSmartImageModal(this, event)" src="${o}"/>`;if(r.cover){const t=e.querySelector(".smart-kanban-task-cover");t.classList.add("smart-kanban-task-cover-content"),t.innerHTML=o}}else if("string"==typeof o&&r.image&&o.indexOf("http")>=0||r.editor&&"image"===r.editor&&"string"==typeof o&&o.indexOf("[{")>=0)if(window.Smart._createSmartImageModal=t._createImageModal,o.indexOf("[{")>=0){o=JSON.parse(o);let t="";for(let e=0;e<o.length;e++){const a=o[e];a.label||(a.label=""),t+=`<img title="${a.label}" style="margin-left: 5px;" value="${a.value}" onpointerdown="Smart._createSmartImageModal(this, event)" src="${a.small||a.value}"/>`}if(o=t,r.cover){const t=e.querySelector(".smart-kanban-task-cover");t.classList.add("smart-kanban-task-cover-content"),t.innerHTML=o}}else i=o,o=o.substring(0,50)+"...";else if(r.image){if(o=`<img style="margin-left: 5px;" onpointerdown="Smart._createSmartImageModal(this, event)" src="${o}"/>`,r.cover){const t=e.querySelector(".smart-kanban-task-cover");t.classList.add("smart-kanban-task-cover-content"),t.innerHTML=o}}else if("attachment"===r.editor)if(o.length>50){if("string"==typeof o&&(o.indexOf("[{")>=0||o.indexOf("}]")>=0)){let e="";if(o)try{e=JSON.parse(o)}catch(e){console.log(e)}o=e}const e=document.createElement("div");Array.isArray(o)&&(o.forEach((t=>{const a=document.createElement("div");a.title=t.label,a.classList.add("item"),a.innerHTML="<div></div>",a.firstElementChild.classList.add("smart-grid-icon","show","attachment"),t.label.indexOf("png")>=0||t.label.indexOf("jpg")>=0||t.label.indexOf("jpeg")>=0||t.label.indexOf("gif")>=0?a.firstElementChild.classList.add("smart-icon-image"):t.label.indexOf(".pdf")>=0?a.firstElementChild.classList.add("smart-icon-pdf"):t.label.indexOf(".tsv")>=0||t.label.indexOf(".txt")>=0||t.label.indexOf(".csv")>=0?a.firstElementChild.classList.add("smart-icon-text"):t.label.indexOf(".xls")>=0||t.label.indexOf(".xlsx")>=0?a.firstElementChild.classList.add("smart-icon-excel"):t.label.indexOf(".ppt")>=0?a.firstElementChild.classList.add("smart-icon-powerpoint"):t.label.indexOf(".zip")>=0||t.label.indexOf(".rar")>=0||t.label.indexOf(".7z")>=0?a.firstElementChild.classList.add("smart-icon-archive"):t.label.indexOf(".doc")>=0||t.label.indexOf(".docx")>=0?a.firstElementChild.classList.add("smart-icon-word"):a.firstElementChild.classList.add("smart-icon-file"),a.setAttribute("value",t.value),e.appendChild(a)})),t._fieldAttachmentValue||(t._fieldAttachmentValue=[]),t._fieldAttachmentValue[r.dataField]=o),window.Smart._createSmartAttachment=t._createAttachment,o='<div data-field="'+r.dataField+'" onpointerdown="Smart._createSmartAttachment(event)" class="attachments">'+e.innerHTML+"</div>"}else input=document.createElement("div"),o||(o=t.localize("emptyAttachment"));else if("dateInput"===r.editor)o=new Smart.Utilities.DateTime(o).toString(this.formatStringDate);else if("dateRangeInput"===r.editor)o&&o.length&&(o[0]=new Smart.Utilities.DateTime(o[0]).toString(this.formatStringDate),o[1]=new Smart.Utilities.DateTime(o[1]).toString(this.formatStringDate),o=o[0]+"-"+o[1]);else if(r.dataSource)if(o&&o.indexOf(",")>0&&(o=o.split(",")),void 0!==o&&Array.isArray(o)){let e=[];for(let t=0;t<o.length;t++){const a=r.dataSource.find((e=>{if(e.value===o[t])return e}));a&&e.push(a.label)}o=e.toString()}else{const e=r.dataSource.find((e=>{if(e.value===o)return e}));e&&e.label&&(o=e.label)}const a=e.querySelector("[data-field="+r.dataField+"]");if(a)a.innerHTML=`<div class="smart-kanban-task-field-label">${r.label}</div><div title="${i}" class="smart-kanban-task-field-value">${o}</div>`,a.classList.remove("smart-hidden");else{const e=document.createElement("div");e.classList.add("smart-kanban-task-field"),e.setAttribute("data-field",r.dataField),e.innerHTML=`<div class="smart-kanban-task-field-label">${r.label}</div><div title="${i}" class="smart-kanban-task-field-value">${o}</div>`,s.appendChild(e)}}}else{const t=e.querySelector("[data-field="+r.dataField+"]");t&&t.classList.add("smart-hidden")}}}}_updateTaskSubtasks(e){const t=this;if("none"===t.taskSubTasks)return void e.querySelector(".smart-kanban-task-subtasks").classList.add("smart-hidden");const a=e.data,s=t.dataSourceMap,l=[],r=[];(a[s.checklist]||[]).forEach(((e,t)=>{e.completed&&l.push(t),r.push({label:e.text,selected:!0===e.completed})}));const o=e.querySelector(".smart-kanban-task-subtasks"),i=e.querySelector(".smart-kanban-task-subtasks-container");i.innerHTML="",o.classList.remove("smart-hidden");const n=e.querySelector(".smart-kanban-task-input");t._currentUser&&!t._currentUser.allowEdit||t.disabled||!t.taskSubTasksInput?n.classList.add("smart-hidden"):n.classList.remove("smart-hidden"),n.onfocus=function(e){e.preventDefault(),e.stopPropagation()},n.onkeydown=e=>{"Escape"===e.key&&(n.value="",n.blur())," "===e.key&&e.stopPropagation()},n.onchange=function(l){a[s.checklist]||(a[s.checklist]=[]);const r=JSON.parse(JSON.stringify(a));a[s.checklist].push({text:n.value.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/'/g,"&#39;").replace(/"/g,"&quot;").replace(/\\/g,""),completed:!1}),n.value="",t._updateTaskSubtasks(e);const o=JSON.parse(JSON.stringify(a));t.$.fireEvent("change",{task:e,id:o.id,value:o,oldValue:r}),t.$.fireEvent("taskUpdate",{id:o.id,value:o,oldValue:r}),t._refreshColumnHeights(),l.preventDefault(),l.stopPropagation(),n.closest(".smart-scroll-viewer-container").scrollTop=0},r.length&&r.forEach(((l,o)=>{const n=document.createElement("div"),d=l.label;n.innerHTML=`<div data-index="${o}" class="smart-kanban-sub-task"><span title="${d}" class="label">${d}</span><span class="edit-subtask" aria-label="Edit subtask" title="${t.localize("edit")}"></span><span class="remove-subtask" aria-label="Remove subtask" title="${t.localize("removeSubtask")}"></span></div>`,l.selected&&n.firstChild.classList.add("selected"),"onlyUnfinished"===t.taskSubTasks&&l.selected&&n.classList.add("smart-hidden");let c=!0;(t._currentUser&&!t._currentUser.allowEdit||t.disabled)&&(c=!1),c?(n.querySelector(".edit-subtask").style.opacity=1,n.querySelector(".remove-subtask").style.opacity=1):(n.querySelector(".remove-subtask").style.opacity=0,n.querySelector(".edit-subtask").style.opacity=0),n.onpointerup=n.onclick=e=>{t._dragDetails||(e.preventDefault(),e.stopPropagation())},n.onpointerdown=l=>{let o=!0;if((t._currentUser&&!t._currentUser.allowEdit||t.disabled)&&(o=!1),!o)return;t._subTaskInput&&t._subTaskInput.parentNode&&(t._subTaskInput.remove(),delete t._subTaskInput);const i=JSON.parse(JSON.stringify(a)),d=parseInt(n.firstChild.getAttribute("data-index")),c=r[d];if(l.target.classList.contains("remove-subtask"))r.splice(d,1),n.classList.add("smart-hidden"),a[s.checklist].splice(d,1);else if(l.target.classList.contains("edit-subtask")){t._subTaskClickTimer&&clearTimeout(t._subTaskClickTimer);const l=document.createElement("input"),r=n.firstElementChild,o=n.querySelector(".label");l.classList.add("smart-input"),l.style.position="absolute";const i=t.offset(r),d=t.offset(t);l.style.height=r.offsetHeight+"px",l.style.background="var(--smart-background)",l.style.width=n.offsetWidth-20+"px",l.value=o.textContent,t.appendChild(l),t.style.position="relative",l.select(),l.style.top=i.top-d.top+"px",l.style.left=i.left-d.left+20+"px",t._subTaskInput=l,l.onchange=()=>{const r=JSON.parse(JSON.stringify(a)),i=parseInt(n.firstChild.getAttribute("data-index"));a[s.checklist][i].text=l.value,o.innerHTML=l.value;const d=JSON.parse(JSON.stringify(a));t.$.fireEvent("change",{task:e,id:d.id,value:d,oldValue:r}),t.$.fireEvent("taskUpdate",{id:d.id,value:d,oldValue:r}),l.remove()}}else n.firstChild.classList.toggle("selected"),c.selected=!c.selected,a[s.checklist][d].completed=c.selected,"onlyUnfinished"===t.taskSubTasks&&c.selected&&n.classList.add("smart-hidden");t._updateTaskChecked(e);const u=JSON.parse(JSON.stringify(a));t.$.fireEvent("change",{task:e,id:u.id,value:u,oldValue:i}),t.$.fireEvent("taskUpdate",{id:u.id,value:u,oldValue:i}),l.preventDefault(),l.stopPropagation()},i.appendChild(n)}))}_applyTextTemplate(e,t,a){const s=this;let l=this.textTemplate;if(!l)return e;let r="";if("function"==typeof l){const s={data:t,task:a,text:e,template:null};if(l(s),e=s.text,null===s.template)return e;l=s.template}if(l.startsWith("#")){const a=document.querySelector(l);if(a&&a instanceof HTMLTemplateElement){const l=a.content.cloneNode(!0),o=document.createElement("div");return o.appendChild(l),e=(e=(e=e.toString()).replace(/'/gi,"\\'")).replace(/"/gi,'\\"'),r=o.innerHTML.replace(/{{text}}/gi,e).replace(/{{id}}/gi,t[s.dataSourceMap.id]),r.indexOf("{{text=")>=0&&(e?(r=r.substring(0,r.indexOf("{{text="))+e+r.substring(r.indexOf("}")),r=r.replace(/}/gi,""),r=r.replace(/{/gi,"")):(r=r.replace(/{{text=/gi,""),r=r.replace(/}}/gi,""))),r}}return r=l.replace(/{{text}}/gi,e).replace(/{{id}}/gi,t[s.dataSourceMap.id]),r}_updateUserIcon(e){const t=this,a=this.dataSourceMap,s=e.data,l=e.getElementsByClassName("smart-kanban-task-user")[0];if(void 0!==s[a.userId]&&null!==s[a.userId]){const e=this.users.find((e=>e.id.toString()===s[a.userId].toString()));if(e)return s[a.userId]!==e.id&&(s[a.userId]=e.id),l.classList.remove("empty"),l.style.backgroundImage='url("'+e.image+'")',l.setAttribute("title",t.localize("assignedTask",{userName:e.name||e.id})),void l.setAttribute("aria-label","Icon of user "+(e.name||e.id))}s[a.userId]=null,l.classList.add("empty"),l.style.backgroundImage=null,l.setAttribute("aria-label","Empty user icon"),l.setAttribute("title",t.localize("unassignedTask"))}_updateTaskComments(e){const t=this.dataSourceMap,a=e.data;e.querySelector(".smart-kanban-task-comments").setAttribute("num",a[t.comments].length||"")}_updateTaskProgress(e){const t=this.dataSourceMap,a=e.data,s=e.querySelector(".smart-kanban-task-progress");let l=a[t.progress];if(void 0===l){a[t.progress]=null,s.setAttribute("aria-valuenow",0);const e=this.localize("taskProgress",{value:0});return void s.parentElement.setAttribute("title",e)}if(l=parseFloat(l),isNaN(l)){a[t.progress]=null,s.setAttribute("aria-valuenow",0);const e=this.localize("taskProgress",{value:0});return void s.parentElement.setAttribute("title",e)}l=Math.max(0,Math.min(parseFloat(l),100)),a[t.progress]=l,s.style.width=l+"%",s.classList.toggle("bottom",null!==a[t.checklist]),s.setAttribute("aria-valuenow",l);const r=this.localize("taskProgress",{value:l});s.parentElement.setAttribute("title",r)}_updateTaskChecked(e){const t=this.dataSourceMap,a=e.data,s=a[t.checklist],l=e.querySelector(".smart-kanban-task-checked");if(s&&Array.isArray(s)&&s.length>0?l.innerHTML=this._getCompletedSubTasks(s):(a[t.checklist]=null,l.innerHTML=""),l.innerHTML.length>0){let e=0;s.forEach((t=>t.completed&&e++));const t=e,a=s.length,r=this.localize("taskCompleted",{value:t,count:a});l.setAttribute("title",r)}else l.removeAttribute("title")}_getCompletedSubTasks(e){if(null===e)return"";let t=0;return e.forEach((e=>e.completed&&t++)),t+"/"+e.length}_updateTaskDueDate(e){const t=this.dataSourceMap;let a=e.data,s=a[t.dueDate],l=e.querySelector(".smart-kanban-task-due");if(s&&"string"==typeof s&&(s=new Date(s),s.setTime(s.getTime()-1*s.getTimezoneOffset()*60*1e3),a[t.dueDate]=s),s)if(l.innerHTML=new Smart.Utilities.DateTime(s).toString(this.formatStringDate),l.classList.toggle("overdue",s.getTime()<(new Date).getTime()&&100!==a[t.progress]),l.classList.contains("overdue")){const e=Math.abs(new Date-s),t=Math.ceil(e/864e5);l.setAttribute("title",this.localize("overdue")+" "+t+" "+this.localize("days"))}else l.removeAttribute("title");else a[t.dueDate]=null,l.innerHTML="",l.classList.remove("overdue"),l.removeAttribute("title");a[t.startDate]?"string"==typeof a[t.startDate]&&(a[t.startDate]=new Date(a[t.startDate]),a[t.startDate].setTime(a[t.startDate].getTime()-1*a[t.startDate].getTimezoneOffset()*60*1e3)):a[t.startDate]=null}_updateTaskColor(e){const t=this,a=t.dataSourceMap,s=e.data,l=e.querySelector(".smart-kanban-task-progress-container"),r=e.querySelector(".smart-kanban-task-progress"),o=t.rightToLeft?"borderRightColor":"borderLeftColor";function i(e){let t=parseFloat(e).toString(16);return t="0".repeat(2-t.length)+t,t.toUpperCase()}if(e.style.borderLeftColor=null,e.style.borderRightColor=null,e.style.borderLeftWidth="",e.style.borderRightWidth="",s[a.color]){e.style[o]=s[a.color];const d=getComputedStyle(e)[o],c="dark"===t.theme?.4:.1;t.taskColor?e.style[o]=s[a.color]:(e.style[o]="var(--smart-border)",e.style[t.rightToLeft?"borderRightWidth":"borderLeftWidth"]="1px"),s[a.color]=(n=(n=d).match(/^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/))?"#"+i(n[1])+i(n[2])+i(n[3]):null,l&&(l.style.backgroundColor=`rgba(${d.slice(4,d.length-1)}, ${c})`,r.style.backgroundColor=d),t.taskColorEntireSurface&&(e.style.backgroundColor=`rgba(${d.slice(4,d.length-1)}, ${c})`)}else{if(s[a.color]=null,l&&(l.style.backgroundColor=null,r.style.backgroundColor=null),t.taskColorEntireSurface){const a=getComputedStyle(e)[o],s="dark"===t.theme?.4:.1;e.style.backgroundColor=`rgba(${a.slice(4,a.length-1)}, ${s})`}t.taskColor||(e.style[o]="var(--smart-border)",e.style[t.rightToLeft?"borderRightWidth":"borderLeftWidth"]="1px")}var n}_updateTaskPriority(e){const t=this,a=t.dataSourceMap,s=e.data,l=e.querySelector(".priority");l.className="priority";let r="";s[a.priority]&&(l.className+=" "+s[a.priority],r=t.localize(s[a.priority])+" "+t.localize("priority"));const o=s[a.text],i=e.querySelector(".smart-kanban-task-content");t.taskPriority?l.classList.remove("smart-hidden"):l.classList.add("smart-hidden"),i&&(o&&t.taskPriority&&r?i.setAttribute("title",`${o}: ${r}`):i.removeAttribute("title"))}_validateSwimlanes(){const e=this,t=e.swimlanesFrom,a=e.swimlanesTo,s=[];t<0&&(e.swimlanesFrom=0),null!==a&&t>a&&(e.swimlanesFrom=a),e.swimlanes.forEach((e=>{"string"==typeof e&&(e={dataField:e,label:e}),(e.dataField||e.label)&&(e.label||(e.label=e.dataField),e.dataField||(e.dataField=e.label),s.push(e))})),e.swimlanes=s}_handleSwimlanes(e){const t=this,a=t.swimlanes;if(0===a.length||0===t.columns.length)return;const s=t.columns,l=parseFloat(getComputedStyle(t).getPropertyValue("--smart-kanban-header-size")),r=t.$.container,o=t.$.container.getBoundingClientRect(),i=t.$.container.querySelectorAll(".smart-kanban-column.has-swimlane");let n=i[0],d=i[i.length-1];if(t.rightToLeft){let e=n;n=d,d=e}const c=n.getBoundingClientRect(),u=i.length>1?d.getBoundingClientRect():c,m=Array.from(n.getElementsByTagName("smart-scroll-viewer"));let p,h,g,f,b=!1,v=!0,y=t.swimlanesTo;null===y&&(y=s.length-1),e&&(p=r.getElementsByClassName("swimlane")),n.column.collapsed&&(n.classList.remove("collapsed"),b=!0);for(let e=t.swimlanesFrom;e<=y;e++)v=v&&s[e].collapsed;v||(h=u.right-c.left+"px",g=c.left-o.left+"px",f=m.map((e=>e.getBoundingClientRect().top-o.top-l-t._dataViewPadding+"px"))),a.forEach(((t,a)=>{let s;e?s=p[a]:(s=document.createElement("div"),s.innerHTML=`<div class="swimlane-label">${t.label}</div>`,s.className="swimlane",s.setAttribute("role","heading"),s.setAttribute("aria-level",2),t.color&&(s.style.backgroundColor=t.color)),s.classList.toggle("smart-visibility-hidden",v),v||(s.style.width=h,s.style.left=g,s.style.top=f[a]),e||r.appendChild(s)})),b&&n.classList.add("collapsed")}_renderColumns(){const e=this,t=e.collapsible,a=[],s=e.$.body,l=document.createDocumentFragment();let r=e.columns;const o=e.context;if(e.context=e,e._columnToElement=new Map,e._columnContainers=[],0===r.length){const t=e.dataSource;t&&0!==t.length&&(r=[],t.forEach((t=>{const a=t[e.dataSourceMap.status];a&&-1===r.indexOf(a)&&r.push(a)})))}!function e(a,s,l){const r=[];let o=0;if(a.forEach((a=>{"string"==typeof a&&(a={dataField:a,label:a}),void 0!==a.dataField&&(void 0===a.label&&(a.label=a.dataField),void 0===a.dataField&&(a.dataField=a.label),"horizontal"!==a.orientation&&(a.orientation="vertical"),!1!==a.collapsible&&(a.collapsible=!0),a.collapsed&&t&&a.collapsible?o++:a.collapsed=!1,!1!==a.addNewButton&&(a.addNewButton=!0),!1!==a.allowRemove&&(a.allowRemove=!0),!1!==a.allowHide&&(a.allowHide=!0),!1!==a.editable&&(a.editable=!0),!1!==a.reorder&&(a.reorder=!0),0===l?delete a.selected:!0===a.selected?r.push(a):a.selected=!1,a.columns&&(a.validColumns=[],e(a.columns,a.validColumns,l+1),a.columns=a.validColumns,delete a.validColumns),s.push(a))})),o&&o===s.length&&(s[0].collapsed=!1),r.length>1)for(let e=r.length-2;e>=0;e--)r[e].selected=!1;else l>0&&0===r.length&&s.length>0&&(s[0].selected=!0)}(r,a,0),0===e.swimlanes.length?"columns"===e.hierarchy?e._createColumnElements(a,l,s,1):e._createColumnElementsTabs(a,l,s):e._createColumnElementsSwimlanes(a,l,s),s.appendChild(l),e._selectedTabs=e._allColumns.filter((e=>e.selected)).map((e=>e.dataField)),e._autoSaveState("tabs"),e.context=o}_createAddNewButton(){const e=this,t=e.querySelectorAll(".smart-kanban-add-new-button");t.length&&t.forEach((e=>{e.remove()})),e.addNewButton&&"top"!==e.addNewButtonDisplayMode&&(e.addNewButtons=[],e.querySelectorAll(".smart-kanban-column").forEach((t=>{const a=t.querySelector(".smart-scroll-viewer");if(a){const s=(()=>{const t=document.createElement("div");return t.setAttribute("add-new-button",""),t.classList.add("smart-kanban-add-new-button"),t.title=e.localize("addNewTask"),t.onpointerdown=()=>{if(t.column){const a=t.column.querySelector(".smart-kanban-column-header-add");a&&(e._addToBottom=!0,a.click())}},t})(),l=t.column;if(!l||l&&l.collapsed||l&&!l.addNewButton)return;t.appendChild(s);const r=()=>{const l=a.getBoundingClientRect(),r=t.querySelectorAll(".smart-kanban-task"),o=e.offset(e);if(0===r.length){const a=t.querySelector(".smart-kanban-column-header"),l=e.offset(a).top-o.top,r=e.autoColumnHeight?60:0;s.style.top=l+r+a.offsetHeight+"px"}else{const i=r[r.length-1],n=e.offset(i);let d=parseInt(i.style.marginBottom);const c=e.offsetHeight-2*s.offsetHeight;isNaN(d)&&(d=0);const u=n.top-o.top+i.offsetHeight+d;if(a.computedVerticalScrollBarVisibility){const t=e.getBoundingClientRect();s.style.top=Math.min(l.top-t.top+a.offsetHeight,c)+"px"}else{const a=t.querySelector(".smart-kanban-column-footer");if(a){const t=e.offset(a).top-o.top-s.offsetHeight/2;s.style.top=Math.min(t,c)+"px"}else s.style.top=Math.min(u,c)+"px"}}const i=t.offsetWidth-a.offsetWidth;s.style.left=l.left+a.offsetWidth/2-i-s.offsetWidth/2-o.left+e.$.scrollViewer.scrollLeft+"px"};s.refresh=r,s.column=t,t.addNewButton=s,s.refresh(),e.addNewButtons.push(s),requestAnimationFrame((()=>{s.classList.add("show")}))}})),e._refreshSummaries())}_refreshColumnHeights(e=!0,t,a=0){const s=this;s.autoColumnHeight&&(s.virtualization?s.querySelectorAll(".smart-kanban-column").forEach((e=>{if(e.querySelector(".smart-scroll-viewer")){const t=e.column,a=s._getTasksByDataField(t.dataField),l=e.querySelector(".smart-kanban-column-header"),r=e.querySelector(".smart-kanban-column-footer"),o=r?r.offsetHeight:0;if(0===a.length)e.style.height=100+o+l.offsetHeight+"px";else{const t=s.offsetHeight,r=a[a.length-1],i=l.offsetHeight+o+r.top+r.height;isNaN(i)||(e.style.height=t<i?"":i-o+"px")}}})):s.querySelectorAll(".smart-kanban-column").forEach((l=>{const r=l.querySelector(".smart-scroll-viewer");if(r){const o=l.column;if(t&&o.dataField!==t)return;if(!o||o&&o.collapsed)return void(l.style.height="");const i=l.querySelectorAll(".smart-kanban-task"),n=l.querySelector(".smart-kanban-column-header"),d=l.querySelector(".smart-kanban-column-footer"),c=d?d.offsetHeight:0;if(0===i.length)l.style.height=100+c+n.offsetHeight+"px";else{const e=i[i.length-1];if(r.style.top="0px",!s._rowGap){const t=parseInt(getComputedStyle(e.parentElement).gridRowGap);s._rowGap=t,isNaN(s._rowGap)&&(s._rowGap=0)}let t=0;for(let e=0;e<i.length;e++)if(t+=i[e].offsetHeight+s._rowGap,i[e].classList.contains("smart-kanban-task-placeholder")){const a=parseInt(i[e].style.marginTop),s=parseInt(i[e].style.marginBottom);isNaN(a)||(t+=a),isNaN(s)||(t+=s)}const o=s.offsetHeight,d=n.offsetHeight+c+t+s._rowGap+s._rowGap+a;l.style.height=o<d?"":d+"px"}e&&r.refresh(),s._refreshEmptyColumnState(r)}})))}_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)}}_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","#FFCFC9","#FFD66D","#FFEBB6","#93DF89","#D1F7C4","#9DC7FF","#D0F0FD","#CDAFFF","#ECE1FD","#FA9DE2","#FFDAF6","#CBCBCB","#EDEDED","#FFFFFF",""],e.valueDisplayMode="colorBox",e.classList.add("smart-kanban-color-input"),e.style.width="auto",e.style.height="auto",e.readonly=!0,e.onRender=()=>{const t=e.$.scrollView;t&&t.classList.add("smart-kanban-color-input")},e}_createColumnElements(e,t,a,s){const l=this,r=l.id,o=[],i=[];let n=0;const d=e=>"number"==typeof e?e+"px":"string"==typeof e?e:void 0;if(e.forEach(((a,c)=>{const u=document.createElement("div");let m=`${l._getColumnHeader(a,c<e.length-1,s)}\n <div class="smart-kanban-column-contentAAA" role="presentation">\n <smart-scroll-viewer class="smart-kanban-column-content-tasks"${l._rtlAttr}${l._tabindex} role="list"></smart-scroll-viewer>BBB\n </div>`,p=0;if(l.columnFooter&&(m+='<div class="smart-kanban-column-footer"></div>'),a.columns?(m=m.replace("AAA",""),m=m.replace("BBB",'<div class="smart-kanban-column-content-columns" role="presentation"></div>')):(m=m.replace("AAA"," no-sub-columns"),m=m.replace("BBB","")),u.className="smart-kanban-column",u.setAttribute("data-field",a.dataField),u.setAttribute("role","group"),u.setAttribute("aria-labelledby",`${r}ColumnHeaderLabel${a.dataField}`),u.setAttribute("orientation",a.orientation),a.color&&l.applyColumnColorToTasks&&u.style.setProperty("--smart-primary",a.color),a.collapsible&&u.setAttribute("collapsible",""),a.addNewButton&&u.setAttribute("add-new-button",""),u.innerHTML=m,u.siblingColumns=e,t.appendChild(u),u.column=a,u.index=c,u.onmouseleave=()=>{let e=!1;u.querySelectorAll(".smart-kanban-task-placeholder").forEach((t=>{t.style.marginTop=t.style.marginBottom="0px",e=!0})),e&&l._refreshButtonsAndSummaries()},l.onColumnHeaderRender&&l.onColumnHeaderRender(u.querySelector(".smart-kanban-column-header"),a,a.dataField),l._columnToElement.set(a,u),a.columns){const e=u.querySelector(".smart-kanban-column-content-columns");p=l._createColumnElements(a.columns,e,e,s+1),n+=p}else n+=1;let h=(p||1)+"fr";l.columnWidth?h=d(l.columnWidth):a.width&&(h=d(a.width)),!1!==a.visible?(a.collapsed?(u.classList.add("collapsed"),o.push("auto")):o.push(h),i.push(h)):u.classList.add("smart-hidden"),l._allColumns.push(a)})),1===s&&l.addNewColumn)if(l._appendAddNewColumn(t),l.columnWidth){let e="1fr";const t=l.addNewColumnWidth?l.addNewColumnWidth:l.columnWidth;e=d(t),o.push(e)}else o.push("var(--smart-kanban-add-new-column-width)");return a.style.gridTemplateColumns=o.join(" "),a.fractions=i,l._columnContainers.push(a),n}_createColumnElementsTabs(e,t,a,s){const l=this,r=l.id,o=[],i=[];if(e.forEach(((a,n)=>{const d=document.createElement("div");let c=`<div class="smart-kanban-column-contentAAA" role="presentation">\n <smart-scroll-viewer class="smart-kanban-column-content-tasks"${l._rtlAttr}${l._tabindex} role="list"></smart-scroll-viewer>BBB\n </div>`;if(a.columns?(c=c.replace("AAA",""),c=c.replace("BBB",'<div class="smart-kanban-column-content-columns has-tabs" role="presentation"></div>')):(c=c.replace("AAA"," no-sub-columns"),c=c.replace("BBB","")),d.className="smart-kanban-column",d.setAttribute("orientation",a.orientation),a.collapsible&&d.setAttribute("collapsible",""),a.addNewButton&&d.setAttribute("add-new-button",""),s){const e=document.createElement("div"),t=`${r}Tab${a.dataField}`,o=`${r}Column${a.dataField}`;e.id=t,e.className="smart-kanban-tab smart-unselectable",l.disabled||l.unfocusable||(e.tabIndex=0),e.setAttribute("role","tab"),e.setAttribute("aria-controls",o),e.innerHTML=`<div class="smart-kanban-tab-label">${a.label}</div>`,e.columnElement=d,d.id=o,d.setAttribute("role","tabpanel"),d.setAttribute("aria-labelledby",t),d.tab=e,s.appendChild(e),a.selected?e.classList.add("selected"):d.classList.add("smart-hidden"),e.setAttribute("aria-selected",a.selected)}else c=l._getColumnHeader(a,n<e.length-1)+c,d.setAttribute("role","group"),d.setAttribute("aria-labelledby",`${r}ColumnHeaderLabel${a.dataField}`);if(d.innerHTML=c,d.siblingColumns=e,t.appendChild(d),d.column=a,d.index=n,l._columnToElement.set(a,d),a.columns){const e=d.querySelector(".smart-kanban-column-content-columns"),t=document.createElement("div");t.className="smart-kanban-tab-strip",t.setAttribute("role","tablist"),e.appendChild(t),l._createColumnElementsTabs(a.columns,e,e,t)}s||(a.collapsed?(d.classList.add("collapsed"),o.push("auto")):o.push("1fr"),i.push("1fr")),l._allColumns.push(a)})),!s){if(l.addNewColumn)if(l._appendAddNewColumn(t),l.columnWidth){let e="1fr";const t=e=>"number"==typeof e?e+"px":"string"==typeof e?e:void 0;e=t(l.addNewColumnWidth?l.addNewColumnWidth:l.columnWidth),o.push(e)}else o.push("var(--smart-kanban-add-new-column-width)");a.style.gridTemplateColumns=o.join(" "),a.fractions=i,l._columnContainers.push(a)}}_createColumnElementsSwimlanes(e,t,a){const s=this,l=s.id,r=s.swimlanes,o=[],i=[];if(e&&(e=e.filter((e=>{if(!1!==e.visible)return!0}))),e.forEach(((a,n)=>{const d=document.createElement("div");let c=`${s._getColumnHeader(a,n<e.length-1)}\n <div class="smart-kanban-column-content no-sub-columns" role="presentation"></div>`;d.className="smart-kanban-column",d.setAttribute("role","group"),d.setAttribute("aria-labelledby",`${l}ColumnHeaderLabel${a.dataField}`),d.setAttribute("orientation",a.orientation),a.collapsible&&d.setAttribute("collapsible",""),a.addNewButton&&d.setAttribute("add-new-button",""),d.innerHTML=c,d.siblingColumns=e;const u=d.children[1];let m="";if(s._hasSwimlane(n)){let e=[];for(let t=0;t<r.length;t++)m+=`<smart-scroll-viewer class="smart-kanban-column-content-tasks" swimlane="${r[t].dataField}"${s._rtlAttr}${s._tabindex} role="list"></smart-scroll-viewer>`,e.push("1fr");d.classList.add("has-swimlane"),u.classList.add("has-swimlane"),u.style.gridTemplateRows=e.join(" ")}else m=`<smart-scroll-viewer class="smart-kanban-column-content-tasks"${s._rtlAttr}${s._tabindex} role="list"></smart-scroll-viewer>`;u.innerHTML=m,t.appendChild(d),d.column=a,d.index=n,s._columnToElement.set(a,d),a.collapsed?(d.classList.add("collapsed"),o.push("auto")):o.push("1fr"),i.push("1fr"),s._allColumns.push(a)})),s.addNewColumn)if(s._appendAddNewColumn(t),s.columnWidth){let e="1fr";const t=e=>"number"==typeof e?e+"px":"string"==typeof e?e:void 0;e=t(s.addNewColumnWidth?s.addNewColumnWidth:s.columnWidth),o.push(e)}else o.push("var(--smart-kanban-add-new-column-width)");a.style.gridTemplateColumns=o.join(" "),a.fractions=i,s._columnContainers.push(a)}_getColumnSummary(e){const t=this.getColumnDataItems(e.dataField);return this.columnSummary&&t.length?" ("+t.length+")":""}_getColumnHeaderTemplate(e,t){const a=e.headerTemplate||this.columnHeaderTemplate;if(a){const s=document.createElement("div");let l;if("string"==typeof a&&a.startsWith("#")?l=document.querySelector(a):"string"==typeof a&&(l=a),"function"==typeof a){const s=a(e,t);return s||t}if(l instanceof HTMLTemplateElement){s.appendChild(l.content.cloneNode(!0));const t=/{{\w+}}/g;let a=s.innerHTML;const r=t.exec(a);for(let t=0;t<r.length;t++){const t=e[r[0].replace("{{","").replace("}}","")];a=a.replace(r[0],t)}return a}return l instanceof HTMLElement?s.appendChild(l):s.innerHTML=l,s.innerHTML}return null}_getColumnHeader(e,t,a=1){const s=this,l=s._tabindex,r=e.collapsed?s.localize("expand"):s.localize("collapse"),o=s.localize("addNewTask"),i=s.allowColumnEdit||s.allowColumnRemove||s.allowColumnHide?"settings":"",n=s.localize("customizeColumn");let d=e.label;""===d&&(d="&nbsp;");const c=s._getColumnSummary(e);let u=`<span class="smart-kanban-title">${d}</span><span class='summary'>${c}</span>`,m="smart-kanban-column-header-label";if(void 0!==e.color&&s.columnColors){if(e.color){const t=new Smart.Color(e.color).getInvertedColor();u=`<div class="heading" style="background: ${e.color}; color: ${t};"><span class="smart-kanban-title">${d}</span><span class='summary'>${c}</span></div>`}else u=`<div class="heading"><span class="smart-kanban-title">${d}</span><span class='summary'>${c}</span></div>`;m+=" pill"}const p=null!==s.columnHeaderTemplate||e.headerTemplate?s._getColumnHeaderTemplate(e,u):u,h="bottom"===s.addNewButtonDisplayMode?"":"add-new-button";return`<div status="${e.dataField}" ${i} ${h} class="smart-kanban-column-header smart-unselectable"${l} role="heading" aria-level=${a}>\n <div title="${o}" class="smart-kanban-column-header-add ${h}"${l} role="button" aria-label="Add new task"></div>\n <div id="${s.id}ColumnHeaderLabel${e.dataField}" class="${m}">${p}</div>\n <div title="${r}" class="smart-kanban-column-header-toggle-button smart-arrow smart-arrow-${t?"left":"right"}" role="button" aria-hidden="true"></div>\n <div title="${n}" class="smart-kanban-column-actions smart-kanban-column-header-settings-button" role="button" aria-haspopup="menu" aria-label="Open actions list" aria-hidden="true"></div>\n </div>`}_hasSwimlane(e){const t=this;if(0===t.swimlanes.length)return!1;const a=t.swimlanesFrom;let s=t.swimlanesTo;return null===s&&(s=t.columns.length-1),e>=a&&e<=s}_updateColumnWidths(e,t){const a=this;if(!e&&!t)return void a._columnContainers.forEach((e=>a._updateColumnWidths(e.children[0].siblingColumns,e)));const s=t.fractions,l=[];let r=0,o=0;for(let t=0;t<e.length;t++){const i=e[t];!1!==i.visible&&(l.push(e[t].collapsed?"auto":s[r++]),!i.collapsed&&a.columnWidth&&(o+=i.width?i.width:a.columnWidth))}if(t===a.$.body&&a.addNewColumn)if(a.columnWidth){let e="1fr";const t=e=>"number"==typeof e?e+"px":"string"==typeof e?e:void 0;e=t(a.addNewColumnWidth?a.addNewColumnWidth:a.columnWidth),l.push(e)}else l.push("var(--smart-kanban-add-new-column-width)");o<a.offsetWidth&&a.columnWidth&&l.push("1fr"),t.style.gridTemplateColumns=l.join(" "),a.columnWidth&&a.$.scrollViewer.refresh()}_validateColumnArgument(e){if(!isNaN(e))return this.columns[e];const t=this._allColumns;return"string"==typeof e?t.find((t=>t.dataField===e)):"object"==typeof e?t.find((t=>t===e)):null}_resizeHandler(){this.$.scrollViewer&&(this.$.scrollViewer.scrollLeft=0),this.refresh("resize")}refresh(e){const t=this;"resize"===e?(clearTimeout(t._resizeTimeout),t._resizeTimeout=setTimeout((function(){t._allColumns.forEach((e=>t._refreshScrollViewer(e)))}),50),t._handleSwimlanes(!0)):(t.closePanel(),t._closeList(t._actionsList,"_actionSelectionFor"),t._closeList(t._columnActionsList,"_columnActionSelectionFor"),t._closeList(t._commentsList,"_commentSelectionFor"),t._closeList(t._userList,"_userSelectionFor"),t._closeList(t._priorityList,"_prioritySelectionFor"),t._resetFields=!0,t._render()),t.$.scrollViewer.refresh()}_refreshScrollViewer(e,t){const a=this,s=e instanceof HTMLElement?e:this._columnToElement.get(e);function l(l,r){if(!t&&l&&l.$.scrollViewerContentContainer&&""===l.$.scrollViewerContentContainer.innerHTML.trim())return a.virtualization&&a._refreshScrollHeight(l,e.dataField),void a._refreshEmptyColumnState(l);if(e.collapsed?l.toRefresh=!0:(delete l.toRefresh,requestAnimationFrame((()=>{if(l.isReady&&l.refresh(),void 0===e.dataField){const t=e.closest(".smart-kanban-column");if(t){const e=t.getAttribute("data-field");a._refreshScrollHeight(l,e)}}else a._refreshScrollHeight(l,e.dataField);0===r&&"horizontal"===e.orientation&&(a.columnWidth||(l.$.content.offsetWidth<=2*a._kanbanTaskMinWidth+a._dataViewPadding?s.setAttribute("orientation","vertical"):"vertical"===s.getAttribute("orientation")&&s.setAttribute("orientation","horizontal")))}))),a._refreshButtonsAndSummaries(),void 0===e.dataField){const t=e.closest(".smart-kanban-column");if(t){const e=t.getAttribute("data-field");a._refreshScrollHeight(l,e)}}else a._refreshScrollHeight(l,e.dataField)}e instanceof Smart.ScrollViewer?l(e):this.swimlanes.length>0?Array.from(s.querySelectorAll("smart-scroll-viewer")).forEach(((e,t)=>l(e,t))):l(s.querySelector("smart-scroll-viewer"),0)}_containerDownHandler(e){const t=this,a=t.isInShadowDOM||t.shadowRoot?e.originalEvent.composedPath()[0]:e.originalEvent.target,s=a.closest(".smart-kanban-task");if(delete t._preventSelection,t.allowColumnReorder){const l=a.closest(".smart-kanban-column-header")&&!a.classList.contains("smart-kanban-column-header-add")&&!a.classList.contains("smart-kanban-column-header-toggle-button");if(!s&&l&&!t._columnEditing){const s=a.closest(".smart-kanban-column");if(s){const a=e.originalEvent.composedPath();let l=0;for(let e=0;e<a.length;e++)a[e].classList&&a[e].classList.contains("smart-kanban-column")&&l++;s.column.reorder&&l<=1&&(t._columnDragDetails={x:e.pageX,y:e.pageY,event:e,kanbanColumn:s})}}}const l=a.closest(".smart-kanban-column"),r=a.closest(".smart-kanban-column-header")&&!a.classList.contains("smart-kanban-column-header-add")&&!a.classList.contains("smart-kanban-column-header-toggle-button"),o=l?l.column:null;if(o){if(r&&t.$.fireEvent("columnClick",{column:o}),new Date-t._clickTime<=300)return!s&&r&&!t._columnEditing&&t.allowColumnEdit&&(t._columnDragDetails=null,!1===o.collapsed&&o.editable&&"menu"!==t.columnEditMode&&t._handleColumnEditing(o.dataField)),void(r&&(o.collapsed?t.expand(o):(!t.allowColumnEdit||t.allowColumnEdit&&"menu"===t.columnEditMode)&&t.collapse(o),t.$.fireEvent("columnDoubleClick",{column:o})));t._clickTime=new Date}if(s&&3!==e.which){if(!s.data)return;if(t.taskSubTasksInput&&a.classList.contains("smart-kanban-task-input"))return;t.virtualization?(t.focusTask(s.data.id),t._refreshColumns()):t._focusTask(s),t._startDragging(s,e)}}_containerKeydownHandler(e){const t=this;if(t._dragDetails)return;const a=e.key,s=t.isInShadowDOM||t.shadowRoot?e.composedPath()[0]:e.target;function l(a=s){delete t._preventSelection,t._documentUpHandler({originalEvent:{target:a}}),t._containerClickHandler({target:a,ctrlKey:e.ctrlKey||e.metaKey,shiftKey:e.shiftKey}),e.preventDefault()}if(s.closest(".smart-kanban-column, .smart-kanban-add-new-column"))return s.classList.contains("smart-kanban-column-content-tasks")?void t._selectViaKeyboard(s.$.content,e,l):void("Enter"!==a&&" "!==a||s instanceof HTMLInputElement!=0||l());if(t.$.headerDropDown.contains(s))"Escape"===a&&(t.closePanel(),t.$[/\s?([a-z]+)-panel/g.exec(t.$.headerDropDown.className)[1]+"Button"].focus());else if(!(s.classList.contains("smart-data-view-header-button")||s.closest(".smart-data-view-search-box")||s.classList.contains("remove-button"))||"Enter"!==a&&" "!==a||l(),s.classList.contains("smart-kanban-list")){const r=s;switch(a){case"ArrowDown":t._selectListItem(t._getNextItem(r));break;case"ArrowUp":t._selectListItem(t._getPrevItem(r));break;case"Home":t._selectListItem(t._getFirstItem(r));break;case"End":t._selectListItem(t._getLastItem(r));break;case"Escape":r.openedFrom.focus(),t._closeList(r,r===t._actionsList?"_actionSelectionFor":r===t._commentsList?"_commentSelectionFor":"_userSelectionFor"),r===t._columnActionsList&&t._closeList(t._columnActionsList,"_columnActionSelectionFor");break;case"Enter":case" ":{const e=t._getSelectedItem(r);e&&l(e);break}default:return}e.preventDefault()}}getTaskIndex(e){const t=this,a=t.getTask(e);if(!a)return-1;const s=a[t.dataSourceMap.status];return t._getTasksByDataField(s).findIndex((t=>{if(t.id===e)return!0}))}_getNextPrevColumn(e,t){const a=this;let s=null;return a._allColumns.forEach(((l,r)=>{if(l.dataField===e)if(t){if(r<a._allColumns.length-1)return s=a._allColumns[r+1],!0}else if(r>0)return s=a._allColumns[r-1],!0})),s}focusTask(e){const t=this;t._focusedTask=e,t.ensureVisible(e),t._refreshColumns()}_selectViaKeyboard(e,t,a){const s=this;let l=t.key;s.rightToLeft&&("ArrowRight"===l?l="ArrowLeft":"ArrowLeft"===l&&(l="ArrowRight"));const r=s._focusedTask,o=s.getTask(r);if(!o)return;const i=o[s.dataSourceMap.status],n=s._getTasksByDataField(i),d=s.getTaskIndex(r);switch(l){case"ArrowRight":{const e=s._getNextPrevColumn(i,!0);if(e)if(s.virtualization){const t=s._getTasksByDataField(e.dataField);t.length>0&&s.focusTask(t[0].id)}else{const t=s._columnToElement.get(e),a=t.querySelector(".smart-kanban-task");s._focusTask(a),t.focus()}break}case"ArrowLeft":{const e=s._getNextPrevColumn(i,!1);if(e)if(s.virtualization){const t=s._getTasksByDataField(e.dataField);t.length>0&&s.focusTask(t[0].id)}else{const t=s._columnToElement.get(e).querySelector(".smart-kanban-task");s._focusTask(t)}break}case"ArrowDown":if(s.virtualization)d<n.length-1&&s.focusTask(n[d+1].id);else{const e=s.getColumn(i),t=s._columnToElement.get(e);s._focusTask(s._getNextItem(t,!0))}break;case"ArrowUp":if(s.virtualization)d>0&&s.focusTask(n[d-1].id);else{const e=s.getColumn(i),t=s._columnToElement.get(e);s._focusTask(s._getPrevItem(t,!0))}break;case"Home":s.virtualization?s.focusTask(n[0].id):s._focusTask(s._getFirstItem(e));break;case"End":s.virtualization?s.focusTask(n[n.length-1].id):s._focusTask(s._getLastItem(e));break;case"Enter":case" ":case"F2":case"Delete":{const e=s.querySelector("[focus]");e&&("F2"===l||"Enter"===l?s.beginEdit(e):"Delete"===l?s.removeTask(e,!0):a(e));break}default:return}t.preventDefault()}_getFirstItem(e){const t=e.children;for(let e=0;e<t.length;e++){const a=t[e];if(!a.hasAttribute("disabled")&&"none"!==getComputedStyle(a).display)return a}}_getLastItem(e){const t=e.children;for(let e=t.length-1;e>=0;e--){const a=t[e];if(!a.hasAttribute("disabled")&&"none"!==getComputedStyle(a).display)return a}}_getPrevItem(e,t){const a=this._getSelectedItem(e,t);let s=a?a.previousElementSibling:this._getLastItem(e);for(;s;){if(!s.hasAttribute("disabled")&&"none"!==getComputedStyle(s).display)return s;s=s.previousElementSibling}}_getNextItem(e,t){const a=this._getSelectedItem(e,t);let s=a?a.nextElementSibling:this._getFirstItem(e);for(;s;){if(!s.hasAttribute("disabled")&&"none"!==getComputedStyle(s).display)return s;s=s.nextElementSibling}}_getSelectedItem(e,t){return e?t?e.querySelector("[focus]"):e.querySelector(".selected"):null}_selectListItem(e){if(!e)return;const t=e.parentElement,a=t.querySelector(".selected");a&&(a.classList.remove("selected"),a.removeAttribute("aria-selected")),e.classList.add("selected"),e.setAttribute("aria-selected",!0),t.scrollTop=e.offsetTop}_focusTask(e){if(!e)return;const t=this;t._isMobile||(Array.from(t.querySelectorAll("[focus]")).forEach((e=>e.removeAttribute("focus"))),e.setAttribute("focus",""),this._focusedTask=e.data.id,t.virtualization?t.ensureVisible(t._focusedTask):this.ensureVisible(e))}_setFocusable(){const e=this,t=e.$.container,a=e.disabled||e.unfocusable;let s=[e.$.customizeButton,e.$.filterButton,e.$.sortButton,e.$.searchButton,e.$.searchPrev,e.$.searchNext,e.$.searchClose,e._actionsList,e._userList];if(s=s.concat(Array.from(t.querySelectorAll(".smart-kanban-column-header, .smart-kanban-column-header-add, .smart-kanban-tab, .smart-kanban-column-content-tasks, .smart-kanban-task-user, .smart-kanban-task-actions, .smart-kanban-task-comments, .smart-kanban-add-new-column"))),s.forEach((e=>{a?e.removeAttribute("tabindex"):(null===e.getAttribute("tabindex")||e.getAttribute("tabindex")<0)&&e.setAttribute("tabindex",0)})),e._dialog&&e._dialog.editPanelPopulated){const t=Array.from(e._dialog.$.container.querySelectorAll(".text-editor, .new-subtask"));a?t.forEach((e=>e.tabIndex=-1)):t.forEach((e=>e.removeAttribute("tabindex"))),Array.from(e._dialog.$.container.querySelectorAll(".smart-element.editor, smart-button.add, smart-button.ok, smart-button.cancel")).forEach((e=>e.unfocusable=a)),e._dialog.unfocusable=a}}_startDragging(e,t){const a=this;if(!a._currentUser.allowDrag)return;if(a._isMobile)return;const s=e.closest("smart-scroll-viewer"),l=e.getBoundingClientRect();let r=e.hasAttribute("selected")?Array.from(e.parentElement.querySelectorAll("[selected]")):[e],o=r.map((e=>e.data));a._dragDetails={StartPosition:{left:t.pageX,top:t.pageY},Items:r,ItemsData:o,ItemData:e.data,Item:e,FeedbackShown:!1,OriginalEvent:t,Column:e.classList.contains("smart-kanban-column")?e:null,PointerOffset:[l.x-t.clientX,l.y-t.clientY],ScrollViewer:s,StartTime:new Date,Dragging:!0},Smart.Kanban.kanbanTaskDragged=!0,s&&s._scrollView&&(s._scrollView.disableSwipeScroll=!0),a.allowDrop&&(Smart.Kanban.hoveredKanban=a,Smart.Kanban.hoveredItem=e)}_documentMoveHandler(e){const t=this,a=t._dragDetails;function s(){delete t._dragDetails,delete Smart.Kanban.kanbanTaskDragged,delete Smart.Kanban.hoveredKanban,delete Smart.Kanban.hoveredItem,a.ScrollViewer._scrollView.disableSwipeScroll=!1}if(t.allowColumnReorder&&t._columnDragDetails&&(Math.abs(e.pageX-t._columnDragDetails.x)>=3||Math.abs(e.pageY-t._columnDragDetails.y)>=3)&&(t._startDragging(t._columnDragDetails.kanbanColumn,t._columnDragDetails.event),t._columnDragDetails=null),!a)return;if(!a.FeedbackShown){const l=(new Date).getTime()-a.StartTime.getTime()>500,r=Math.abs(a.StartPosition.left-e.pageX)>5||Math.abs(a.StartPosition.top-e.pageY)>5;if(!r||!(!t._isMobile||t._isMobile&&l))return void(t._isMobile&&r&&!l&&s());if(t.$.fireEvent("dragStart",{item:a.Item,items:a.Items,data:a,container:t,previousContainer:t,originalEvent:a.OriginalEvent}).defaultPrevented)return void s();t.closePanel(),t._hideBodyOverflow(),a.Feedback=t._addDragFeedback(),a.FeedbackShown=!0,a.Items.forEach((e=>e.classList.add("dragged")))}const l=a=>{a.scrollWidth&&(t._autoScrollDragInterval&&clearInterval(t._autoScrollDragInterval),t._autoScrollDragInterval=setInterval((function(){const t=a.getBoundingClientRect();e.clientX<=t.left+20?a.scrollLeft-=15:e.clientX>=t.left+t.width-20&&(a.scrollLeft+=15)}),25))};Smart.Kanban.hoveredKanban?l(Smart.Kanban.hoveredKanban.$.scrollViewer):l(t.$.scrollViewer);let r,o=t.dragOffset;if(o="auto"!==o&&Array.isArray(o)?o:a.PointerOffset,t.$.fireEvent("dragging",{item:a.Item,items:a.Items,data:a,originalEvent:e}),a.Feedback.style.left=e.pageX+(o[0]||0)+"px",a.Feedback.style.top=e.pageY+(o[1]||0)+"px",Smart.Kanban.hoveredKanban&&(clearInterval(Smart.Kanban.hoveredKanban._dragInterval),delete Smart.Kanban.hoveredKanban),Smart.Kanban.hoveredItem&&(Smart.Kanban.hoveredItem.classList.remove("drop-target"),Smart.Kanban.hoveredItem.classList.remove("before","after"),delete Smart.Kanban.hoveredItem),r=t._isMobile?(t.shadowRoot||t.getRootNode()).elementFromPoint(e.clientX,e.clientY):t.isInShadowDOM||t.shadowRoot?e.originalEvent.composedPath()[0]:e.originalEvent.target,!r)return;const i=(t.shadowRoot?r.getRootNode().host:r).closest("smart-kanban");if(!i||!i.allowDrop)return;const n=r.closest(".smart-kanban-column-content-tasks");if(Smart.Kanban.hoveredKanban=i,a.Column)return void t._handleColumnDragging(e);if(!n)return;const d=n.parentElement.parentElement.getAttribute("orientation"),c=Array.from(n.$.content.children);let u=0;if(c.forEach((e=>e.filteredOut&&u++)),0===c.length||c.length===u)return Smart.Kanban.hoveredItem=n.$.scrollViewerContainer,void Smart.Kanban.hoveredItem.classList.add("drop-target");n.scrollHeight>0&&(i._dragInterval=setInterval((function(){const a=n.getBoundingClientRect();a.left<=e.clientX&&a.left+a.width>=e.clientX?e.clientY>=a.top&&e.clientY<=a.top+20?n.scrollTop-=t._autoScrollCoefficient:e.clientY>=a.top+a.height-20&&e.clientY<=a.top+a.height?n.scrollTop+=t._autoScrollCoefficient:clearInterval(i._dragInterval):clearInterval(i._dragInterval)}),2));let m=r.closest(".smart-kanban-task");if(m&&-1===a.Items.indexOf(m)){const t=m.getBoundingClientRect();"vertical"===d&&e.clientY-t.top<=t.height/2||"horizontal"===d&&e.clientX-t.left<=t.width/2?m.classList.add("before"):m.classList.add("after")}else{if(m&&1===c.length)return;m=m&&1===a.Items.length?t[`_${d}ClosestTaskToHover`]([m.previousElementSibling,m.nextElementSibling],e,!0):t[`_${d}ClosestTaskToHover`](c,e,m||r===n.$.content)}m&&(m.classList.add("drop-target"),Smart.Kanban.hoveredItem=m)}_handleColumnDragging(e){const t=this.querySelectorAll(".smart-kanban-column");let a;for(let s=0;s<t.length;s++){const l=t[s],r=l.getBoundingClientRect();e.clientX>=r.left&&e.clientX<=r.right&&e.clientY>=r.top&&e.clientY<=r.bottom&&(a=l)}if(a){const s=a.getBoundingClientRect();e.clientX-s.left<=s.width&&(a.classList.add("before"),a.classList.add("drop-target")),e.clientX-s.left>=s.width/2&&a===t[t.length-1]&&(a.classList.remove("before"),a.classList.add("after"),a.classList.add("drop-target")),Smart.Kanban.hoveredItem=a}}_hideBodyOverflow(){const e=this,t=(document.scrollingElement||document.documentElement).scrollHeight>document.documentElement.clientHeight,a=(document.scrollingElement||document.documentElement).scrollWidth>document.documentElement.clientWidth,s=e.isInShadowDOM?e.getRootNode().host:document.body;e._originalBodyOverflow={overflowX:s.style.overflowX,overflowY:s.style.overflowY,overflow:s.style.overflow},s.classList.add("smart-dragging"),s.style.overflow=s.style.overflowX=s.style.overflowY="",t&&!a?s.style.overflowX="hidden":a&&!t?s.style.overflowY="hidden":a||t||(s.style.overflow="hidden")}_verticalClosestTaskToHover(e,t,a){const s=this._dragDetails.Items,l=t.clientY;let r,o,i=1/0,n=0,d=e.length-1,c=1;for(a||(n=d,d=0,c=-1);n!==d+c;){const t=e[n];if(n+=c,!t||t.filteredOut||-1!==s.indexOf(t))continue;if(!a){r=t,o="after";break}const d=t.getBoundingClientRect(),u=d.top+d.height/2,m=Math.abs(l-u);if(!(m<i))break;i=m,r=t,o=l<=u?"before":"after"}return r&&r.classList.add(o),r}_horizontalClosestTaskToHover(e,t){const a=this._dragDetails.Items,s=t.clientY,l=t.clientX;let r,o,i;return e.forEach((e=>{if(!e||e.filteredOut||-1!==a.indexOf(e))return;const t=e.getBoundingClientRect(),n=Math.abs(s-t.top),d=Math.abs(s-t.bottom),c=Math.min(n,d),u=Math.abs(l-t.left),m=Math.abs(l-t.right),p=Math.min(u,m),h=Math.sqrt(Math.pow(p,2)+Math.pow(c,2));(void 0===o||h<o)&&(r=e,o=h,i=u<m?"before":"after")})),r&&r.classList.add(i),r}_scrollViewerTouchmoveHandler(e){const t=this;t._dragDetails&&(t.isInShadowDOM||t.shadowRoot?e.composedPath()[0]:e.target).closest("smart-scroll-viewer")&&e.cancelable&&(e.preventDefault(),e.stopPropagation())}_documentUpHandler(e){const t=this,a=t._dragDetails;if(t._columnDragDetails=null,t.$.container.hasAttribute("modal"))return;const s=t.isInShadowDOM||t.shadowRoot?e.originalEvent.composedPath()[0]:e.originalEvent.target,l=t.$.header;if(t._userSelectionFor&&!t._userList.contains(s)&&t._closeList(t._userList,"_userSelectionFor"),t._prioritySelectionFor&&!t._priorityList.contains(s)&&t._closeList(t._priorityList,"_prioritySelectionFor"),t._actionSelectionFor&&!t._actionsList.contains(s)&&t._closeList(t._actionsList,"_actionSelectionFor"),t._columnActionSelectionFor&&!t._columnActionsList.contains(s)&&(t._columnActionsList.classList.contains("smart-visibility-hidden")||(t._closeList(t._columnActionsList,"_columnActionSelectionFor"),e.originalEvent.preventDefault(),e.originalEvent.stopPropagation(),t._columnActionsListDate=new Date)),t._commentSelectionFor){const e=t._commentsList;(t.shadowRoot||t.getRootNode()).activeElement!==e.textarea&&(t._actionSelectionFor||e.contains(s)?!e.classList.contains("expanded")||s===e.textarea||e.button.contains(s)||s.classList.contains("remove-button")||e.classList.remove("expanded"):t._closeList(e,"_commentSelectionFor"))}if(!("none"===t.headerPosition||t.$.headerDropDown.classList.contains("smart-visibility-hidden")||t.$.headerDropDown.classList.contains("search-panel")||s!==l&&l.contains(s))){const e=s.closest("smart-scroll-viewer"),a=s.closest(".smart-drop-down");e&&l.contains(e.ownerElement)||a&&(!a.ownerElement||l.contains(a.ownerElement))||t.closePanel()}if(!a)return;const r=Smart.Kanban.hoveredKanban,o=Smart.Kanban.hoveredItem;t._dragDetails&&e.originalEvent.preventDefault(),delete t._dragDetails,delete Smart.Kanban.kanbanTaskDragged,delete Smart.Kanban.hoveredKanban,delete Smart.Kanban.hoveredItem,delete Smart.Kanban.dropOverTask,delete Smart.Kanban.isBefore;let i=!1;if(document.querySelectorAll(".smart-kanban-task-placeholder").forEach((e=>{e.classList.remove("smart-kanban-task-placeholder"),e.style.marginTop=e.style.marginBottom="0px",i=!0})),i&&t._refreshButtonsAndSummaries(),a.ScrollViewer&&a.ScrollViewer._scrollView&&(a.ScrollViewer._scrollView.disableSwipeScroll=!1),!a.FeedbackShown)return;const n=r||(t.shadowRoot||t.getRootNode()).elementFromPoint(e.clientX,e.clientY);t._preventSelection=!0;const d=t.isInShadowDOM?t.getRootNode().host:document.body;d.classList.remove("smart-dragging"),d.style.overflow=t._originalBodyOverflow.overflow,d.style.eoverflowX=t._originalBodyOverflow.overflowX,d.style.overflowY=t._originalBodyOverflow.overflowY,delete t._originalBodyOverflow,a.Feedback.remove(),r&&clearInterval(r._dragInterval);const c=a.Item,u=a.Items;if(u.forEach((e=>e.classList.remove("dragged"))),!n)return;if(!o)return void t.$.fireEvent("dragEnd",{item:c,items:u,target:n,data:a,previousContainer:t,container:n,originalEvent:e});if(!r||!r.allowDrop||r.disabled)return;let m=!1;if(o.classList.remove("drop-target"),o.classList.contains("before")?o.classList.remove("before"):o.classList.contains("after")&&(o.classList.remove("after"),m=!0),a.DropDetails={item:o,after:m},t.$.fireEvent("dragEnd",{item:c,items:u,target:o,data:a,previousContainer:t,container:r,originalEvent:e}).defaultPrevented)return;function p(e,s){t._requestVirtualDataSource("update",Object.assign({},e.data,{status:s}),(function(s){return s&&t._moveDraggedItems(Object.assign({},a,{Item:e,Items:[e]})),s}))}const h=o.closest(".smart-kanban-column"),g=h.column.dataField;if(a.Column){const e=()=>Array.from(h.parentElement.querySelectorAll(".smart-kanban-column")).filter((e=>e.parentElement===h.parentElement)),s=e().indexOf(a.Column);a.DropDetails.after?h.parentElement.appendChild(a.Column):h.parentElement.insertBefore(a.Column,h);const l=e().indexOf(a.Column),r=[],o=e();for(let e=0;e<o.length;e++)o[e].column&&!o[e].classList.contains("smart-kanban-add-new-column")&&r.push(o[e].column);return t.columns=r,t.$.fireEvent("columnReorder",{column:a.Column.column,oldIndex:s,index:l}),t._reset(),void t._createAddNewButton()}if(c&&c.data&&g!==c.data[t.dataSourceMap.status]){const e=Object.assign({},c.data);e[t.dataSourceMap.status]=g;const a=t.getColumn(g);a&&(e.statusLabel=a.label);const s=t.getColumn(c.data[t.dataSourceMap.status]);s&&(c.data.statusLabel=s.label);const l=JSON.parse(JSON.stringify(e)),r=JSON.parse(JSON.stringify(c.data));if(t.$.fireEvent("change",{task:c,id:l.id,value:l,oldValue:r}),t._currentUser.info){const e=t.dataSourceMap;c.data[e.updatedUserId]=t._currentUser.info.id,c.data[e.updatedDate]=new Date,t.addHistory(c.data,{action:"moved",user:t._currentUser.info.id,details:{id:c.data[e.id],oldValue:r[e.status],value:l[e.status]},label:c.data[e.text],date:c.data[e.updatedDate]}),l.history=c.data.history}t.$.fireEvent("taskUpdate",{id:l.id,value:l,oldValue:r})}if(t.dataSource&&t.dataSource.virtualDataSource&&g!==c.data[t.dataSourceMap.status])if(m)for(let e=u.length-1;e>=0;e--)p(u[e],g);else for(const e of u)p(e,g);else if(t._moveDraggedItems(a),c&&c.data){const e=Object.assign({},c.data),a=JSON.parse(JSON.stringify(e));t.$.fireEvent("taskReorder",{id:a.id,value:a})}}_refreshButtonsAndSummaries(){const e=this;e._refreshColumnHeights(),e.addNewButtons&&(e.addNewButtons.forEach((e=>{e.refresh()})),e._refreshSummaries())}_addDragFeedback(){const e=this,t=e._dragDetails.Item,a=e._dragDetails.Items.length,s=document.createElement("div"),l=t.offsetWidth+"px",r=t.offsetHeight+"px";let o=t.cloneNode(!0);if(o.style.width=l,o.style.height=r,t.classList.contains("smart-kanban-column")){o=document.createElement("smart-kanban");const a=Object.assign({},t.column);a.collapsed=!1;const r=[a];o.columns=r,o.dataSource=e.dataSource,o.users=e.users,o.taskActions=e.taskActions,o.taskDue=e.taskDue,o.taskProgress=e.taskProgress,o.style.height="100%",o.style.width=l,o.style.minWidth="250px",s.setAttribute("column-drag","")}if(s.className="smart-kanban-feedback",s.setAttribute("parent-kanban-id",e.id),e.theme&&s.setAttribute("theme",e.theme),["rightToLeft","taskActions","taskComments","taskDue","taskPriority","taskProgress","taskTags","taskUserIcon"].forEach((t=>{e[t]&&s.setAttribute(Smart.Utilities.Core.toDash(t),"")})),s.appendChild(o),a>1){const e=document.createElement("div");e.style.width=l,e.style.height=r,e.className="smart-kanban-feedback-additional",s.insertBefore(e,o),o.setAttribute("num",a),a>2&&e.classList.add("multiple")}return e.getShadowRootOrBody().appendChild(s),s}_moveDraggedItems(e){const t=this,a=t.dataSourceMap;let s,l=e.DropDetails,r=l.item,o=r.closest(".smart-kanban-column"),i=e.Item.closest("smart-scroll-viewer"),n=o.column;if(r.classList.contains("smart-kanban-task")?(s=r.parentElement,l.after&&(r=r.nextElementSibling,r&&r.classList.contains("smart-hidden")&&(r=null)),e.Items.forEach(((l,o)=>{if(t.virtualization){const s=e.ItemsData[o],i=s[a.status],d=t._getTasksByDataField(i),c=d.findIndex((e=>e.id===s.id));if(r){if(r.data!==l.data){d.splice(c,1);const e=t._getTasksByDataField(n.dataField),a=e.indexOf(r.data);e.splice(a,0,s)}}else c>=0&&(d.splice(c,1),t._getTasksByDataField(n.dataField).push(s))}else{s.insertBefore(l,r);const i=e.ItemsData[o],d=i[a.status],c=t._getTasksByDataField(d),u=c.findIndex((e=>e.id===i.id));if(r){if(r.data!==l.data){c.splice(u,1);const e=t._getTasksByDataField(n.dataField),a=e.indexOf(r.data);e.splice(a,0,i)}}else u>=0&&(c.splice(u,1),t._getTasksByDataField(n.dataField).push(i))}l.data[a.status]=n.dataField,l.data.statusLabel=n.label,l.column=n}))):(s=r.firstElementChild,e.Items.forEach((e=>{if(t.virtualization){const s=e.data[a.status],l=t._getTasksByDataField(s),r=l.findIndex((t=>t.id===e.data.id));l.splice(r,1),t._getTasksByDataField(n.dataField).push(e.data)}else{s.appendChild(e);const l=e.data[a.status],r=t._getTasksByDataField(l),o=r.findIndex((t=>t.id===e.data.id));r.splice(o,1),t._getTasksByDataField(n.dataField).push(e.data)}e.data[a.status]=n.dataField,e.data.statusLabel=n.label,e.column=n}))),s=s.closest("smart-scroll-viewer"),t.swimlanes.length>0){const t=s.getAttribute("swimlane");t?e.Items.forEach((e=>e.data[a.swimlane]=t)):e.Items.forEach((e=>delete e.data[a.swimlane]))}t.virtualization?(t._refreshColumns(),t.focusTask(e.ItemData.id)):t._focusTask(e.Item),i!==s?(s.focus(),t.textTemplate&&e.Items.forEach((e=>t._renderTask(e))),e.Item.hasAttribute("selected")&&(e.Items.forEach((e=>e.removeAttribute("selected"))),t._selectedTasks=[],t._autoSaveState("selection")),t._refreshScrollViewer(i,!0),t._refreshScrollViewer(s,!0)):t.virtualization&&t._refreshScrollViewer(i,!0),t._refreshSummaries(),t._autoSaveState("dataSource")}_getCurrentDataSource(){const e=Array.from(this.$.container.getElementsByClassName("smart-kanban-task")),t=[],a=this;if(a.virtualization){const e=Object.keys(a.tasksByDataField);let t=[];for(let s=0;s<e.length;s++){const l=e[s];let r=a._getTasksByDataField(l);t=[...t,...r]}return t}for(let a=0;a<e.length;a++)t.push(e[a].data);return t}_validateTaskArgument(e){const t=this;return e instanceof HTMLElement&&t.$.container.contains(e)&&e.classList.contains("smart-kanban-task")?e:null===e||"number"!=typeof e&&"string"!=typeof e?null!==e&&"object"==typeof e&&void 0!==e.id?t.$.container.querySelector(`.smart-kanban-task[data-id="${e.id}"]`):void 0:t.$.container.querySelector(`.smart-kanban-task[data-id="${e}"]`)}_openDialog(e,t,a="task"){const s=this,l={purpose:t};if(l[a]=e,window.smartBlazor&&(l[a]=e.data),s.$.fireEvent("opening",l).defaultPrevented)return;if(s.disableDialog)return;s._dialog||s._createDialog();const r=s._dialog,o="prompt"===t;r.refreshFieldsDirty=!0,r.openedFrom=(s.shadowRoot||s.getRootNode()).activeElement,r.classList.toggle("prompt",o),r.classList.toggle("edit",!o),r.style.top="",r.style.left="",r.style.width="",r.style.height="auto","edit"!==t||!s.readonly&&s._currentUser.allowEdit?r.removeAttribute("readonly"):r.setAttribute("readonly",""),s.offsetWidth<600&&(r.style.top="0px",r.style.left="0px",r.style.width="100%",r.style.height="100%");const i=e=>{s.applyColumnColorToTasks&&(e&&e.color?(r.style.setProperty("--smart-primary",e.color),r.style.setProperty("--smart-ui-state-active",e.color)):(r.style.setProperty("--smart-primary",""),r.style.setProperty("--smart-ui-state-active","")))};if(e&&e.column?i(e.column):"add"===t&&i(e),r.taskOrComment=e,"edit"===t?s._currentUser&&s._currentUser.allowRemove&&r.querySelector(".delete").classList.remove("smart-hidden"):r.querySelector(".delete").classList.add("smart-hidden"),r.editPanelPopulated&&(r.selectTab(0),r.editors.historyTab&&r.editors.historyTab.classList.add("smart-hidden")),o){let t="task"===a?s.localize("promptTask",{taskText:e.data[s.dataSourceMap.text]}):s.localize("promptComment"),l="task"===a?s.localize("removeTask",{taskText:e.data[s.dataSourceMap.text]}):s.localize("removeComment");"column"===a&&(t=s.localize("promptColumn"),l=s.localize("removeColumn")),r.label=l,r.setAttribute("aria-label",t),r.$.container.querySelector(".prompt").innerHTML=t}else{let a=!0;if(r.removeAttribute("aria-label"),r.headerPosition="top",r.editPanelPopulated||(s._initEditPanel(),a=!1),"edit"===t)s._beginEdit(e);else if("add"===t){r.label=s.localize("addNewTask"),delete r.taskOrComment,a&&s._clearEditors();const t=s.tags.length>0?[...s.tags,...s._customTags]:s._customTags;r.editors.tags.dataSource=t,s._showHideDialogEditors(),r.refreshTabs(!1),r.selectTab(0),r.editors.status.selectedValues=[e.dataField],0===s.swimlanes.length?(r.editors.swimlane.classList.add("smart-hidden"),r.editors.swimlaneLabel.classList.add("smart-hidden"),r.editors.swimlane.parentElement.classList.add("single-column")):(r.editors.swimlane.classList.remove("smart-hidden"),r.editors.swimlaneLabel.classList.remove("smart-hidden"),r.editors.swimlane.parentElement.classList.remove("single-column")),r.editors.created.parentElement.classList.add("smart-hidden"),r.editors.updated.parentElement.classList.add("smart-hidden")}}s.$.container.setAttribute("modal","");const n=s.offset(s);s.offsetWidth>600&&(r.offsetHeight>s.offsetHeight?r.style.top=s.getBoundingClientRect().top+"px":r.style.top=n.top+s.offsetHeight/2-r.offsetHeight/2+"px",r.offsetWidth>s.offsetWidth?r.style.left=s.getBoundingClientRect().left+"px":r.style.left=n.left+s.offsetWidth/2-r.offsetWidth/2+"px"),s.dialogCustomizationFunction&&s.dialogCustomizationFunction(r,e,r.editors,r.labels,t,a),r.open()}_createDialog(){const e=this,t=document.createElement("smart-window"),a=document.createElement("template"),s=` animation="${e.animation}"${e._rtlAttr} theme="${e.theme}"${e.unfocusable?" unfocusable":""}`;a.innerHTML=`<smart-button class="ok primary"${s}><span class="smart-icon"></span>${e.localize("ok")}</smart-button>\n<smart-button class="cancel"${s}><span class="smart-icon"></span>${e.localize("cancel")}</smart-button><smart-button class="smart-hidden delete secondary"${s}><span class="smart-icon"></span>${e.localize("delete")}</smart-button>`,t.animation=e.animation,t.footerTemplate=a,t.headerButtons=["close"],t.rightToLeft=e.rightToLeft,t.resizeMode="both",t.liveResize=!0,t.theme=e.theme,t.className="smart-kanban-window",t.innerHTML='<div class="prompt"></div>\n<div class="edit"></div>',t.ownerElement=e,e._dialog=t,e._addDialogHandlers(),e.getShadowRootOrBody().appendChild(t)}_addDialogHandlers(){const e=this,t=e._dialog;t.addEventListener("open",e._dialogEventHandler),t.addEventListener("closing",e._dialogEventHandler),t.addEventListener("close",e._dialogEventHandler),t.addEventListener("click",e._dialogClickHandler),t.addEventListener("keydown",(e=>{if("Enter"===e.key){const e=t.querySelector(".ok"),a=t.querySelector('.smart-kanban-tab[view="details"]');a&&a.classList.contains("selected")&&(e.disabled||e.click())}}))}_dialogEventHandler(e){const t=this,a=t.ownerElement,s=e.type,l=a.context;(t.isInShadowDOM||t.shadowRoot?e.composedPath()[0]:e.target)===t&&(a.context=a,"open"===s?(a.$.fireEvent("open"),t.classList.contains("edit")&&(a.hasAnimation?t.addEventListener("transitionend",(function(){setTimeout((()=>{!a.readonly&&a._currentUser.allowEdit&&t.editors.text.focus()}),100)}),{once:!0}):requestAnimationFrame((()=>t.editors.text.focus())))):"closing"===s?a.$.fireEvent("closing").defaultPrevented&&(e.preventDefault(),delete t.ok):"close"===s&&(a.$.fireEvent("close"),a._dialogCloseHandler(e)),a.context=l)}_dialogClickHandler(e){const t=this,a=t.isInShadowDOM||t.shadowRoot?e.composedPath()[0]:e.target;if(a.closest(".ok"))t.ok=!0,t.close();else if(a.closest(".cancel"))t.close();else if(a.closest(".delete"))t.ownerElement.removeTask(t.taskOrComment),t.close();else if(a.closest(".add")){const e=t.editors.newSubtask,a=e.value;if(""===a)return;const s=t.editors.checklist;s.insert(s.items.length,{label:a}),e.value="",t.$.content.scrollTop=t.$.content.scrollHeight-t.$.content.offsetHeight,t.refreshTabs()}else if(a.classList.contains("remove-subtask"))t.editors.checklist.removeChild(a.closest("smart-list-item")),t.refreshTabs();else if(a.classList.contains("remove-button")){const e=t.ownerElement,s=t.ownerElement.dataSourceMap,l=t.taskOrComment.data[s.comments],r=a.closest(".smart-comment").comment,o=JSON.parse(JSON.stringify(t.taskOrComment.data));t.taskOrComment.comment=r,t.taskOrComment.data[s.comments]=l.filter((e=>e!==t.taskOrComment.comment)),t.refreshComments();const i=JSON.parse(JSON.stringify(t.taskOrComment.data));e.$.fireEvent("change",{task:t.taskOrComment,id:i.id,value:i,oldValue:o}),e.$.fireEvent("taskUpdate",{id:i.id,value:i,oldValue:o}),e.$.fireEvent("commentRemove",{id:i.id,value:t.taskOrComment.comment})}}_dialogCloseHandler(){const e=this,t=e.dataSourceMap,a=e._dialog;function s(s){const l=JSON.parse(JSON.stringify(s.data));a.taskOrComment.remove(),s.querySelector(".smart-kanban-task-comments").setAttribute("num",s.data[t.comments].length||""),e._commentsList.editing&&(e._commentsList.textarea.value="",delete e._commentsList.editing);const r=JSON.parse(JSON.stringify(s.data));e.$.fireEvent("change",{task:s,id:r.id,value:r,oldValue:l}),e.$.fireEvent("taskUpdate",{id:r.id,value:r,oldValue:l}),e.$.fireEvent("commentRemove",{id:r.id,value:a.taskOrComment.comment})}if(e.$.container.removeAttribute("modal"),a.ok){if(a.classList.contains("prompt")){const l=e._commentSelectionFor;if(l){const r=l.data;if(e.dataSource&&e.dataSource.virtualDataSource){const o=Object.assign({},r);o[t.comments]=o[t.comments].filter((e=>e!==a.taskOrComment.comment)),e._requestVirtualDataSource("update",o,(function(e){return e&&(l.data=o,s(l)),e}))}else r[t.comments]=r[t.comments].filter((e=>e!==a.taskOrComment.comment)),s(l)}else e._columnActionSelectionFor&&a.taskOrComment.dataField?e.removeColumn(a.taskOrComment.dataField):e.removeTask(a.taskOrComment)}else e._endEdit();delete a.ok}a.openedFrom&&requestAnimationFrame((()=>{e.getRootNode().contains(a.openedFrom)&&a.openedFrom.focus&&a.openedFrom.focus(),delete a.openedFrom})),delete a.taskOrComment}_closeDialog(){const e=this;e._dialog&&e._dialog.close()}_getHistoryItemLabel(e){const t=this;let a;switch(e.action){case"created":a=t.localize("taskCreated");break;case"tags":a=t.localize("taskTagsChanged");break;case"description":a=t.localize("taskDescriptionChanged");break;case"progress":a=t.localize("taskProgressChanged");break;case"text":a=t.localize("taskNameChanged");break;case"color":a=t.localize("taskColorChanged");break;case"priority":a=t.localize("taskPriorityChanged");break;case"deadline":a=t.localize("taskDeadlineChanged");break;case"subtasks":a=t.localize("taskSubtasksChanged");break;case"user":a=e.details.value?t.localize("taskUserChanged"):t.localize("taskUserRemoved");break;case"moved":a=t.localize("taskMoved");break;case"status":a=t.localize("taskStatusChanged");break;default:a=t.localize("taskUpdated")}return a}_initEditPanel(){const e=this,t=e.id,a=e._dialog,s=a.$.container.querySelector(".edit"),l=[""].concat(e.users.map((e=>({label:e.name,value:e.id,color:e.color,image:e.image})))),r=e._allColumns.map((e=>({color:e.color,label:e.label,value:e.dataField}))),o=e._getPriority(),i=e.swimlanes.map((e=>({label:e.label,value:e.dataField}))),n=document.createElement("template"),d=` animation="${e.animation}"${e._rtlAttr} theme="${e.theme}"${e.unfocusable?" unfocusable":""}`;n.innerHTML=`<div class="smart-kanban-sub-task"><span class="label">{{label}}</span><span class="remove-subtask" aria-label="Remove subtask" title="${e.localize("removeSubtask")}"></span></div>`,n.id=e.id+"ChecklistTemplate",a.$.container.appendChild(n),s.innerHTML=`\n <div tabindex="0" class="smart-kanban-tab-strip">\n <div tabindex="0" view="details" class="selected smart-kanban-tab"><div class="smart-kanban-tab-label">${e.localize("detailsTab")}</div></div>\n <div tabindex="0" view="subtasks" class="smart-kanban-tab"><div class="smart-kanban-tab-label">${e.localize("subtasksTab")}</div></div>\n <div tabindex="0" view="comments" class="smart-kanban-tab"><div class="smart-kanban-tab-label">${e.localize("commentsTab")}</div></div>\n <div tabindex="0" view="history" class="smart-kanban-tab smart-hidden"><div class="smart-kanban-tab-label">${e.localize("historyTab")}</div></div>\n <div tabindex="0" view="fields" class="smart-kanban-tab smart-hidden"><div class="smart-kanban-tab-label">${e.localize("fieldsTab")}</div></div>\n </div>\n <div class="smart-kanban-tab-content details">\n <div class="layout">\n <div class="column">\n <div id="${t}LabelText" class="editor-label">${e.localize("text")}</div>\n <smart-input class="editor text-editor" aria-labelledby="${t}LabelText"></smart-input>\n <div id="${t}LabelDescription" class="editor-label">${e.localize("description")}</div>\n <textarea class="editor description-editor" aria-labelledby="${t}LabelDescription"></textarea> \n <div id="${t}LabelStatus" class="editor-label">${e.localize("status")}</div>\n <smart-multi-combo-input single-select pills color-items class="editor status-editor" drop-down-open-position="auto" data-source='${JSON.stringify(r)}' drop-down-button-position="right" readonly${d} aria-labelledby="${t}LabelStatus"></smart-multi-combo-input>\n <div id="${t}LabelSwimlane" class="editor-label swimlane-label">${e.localize("swimlane")}</div>\n <smart-input class="editor swimlane-editor" drop-down-open-position="auto" data-source='${JSON.stringify(i)}'${0===i.length?" disabled":""} drop-down-button-position="right" readonly${d} aria-labelledby="${t}LabelSwimlane"></smart-input>\n </div>\n <div class="column">\n <div class="editor-container">\n <div id="${t}LabelAssignedTo" class="editor-label">${e.localize("assignedTo")}</div>\n <div id="${t}LabelProgress" class="editor-label">${e.localize("progress")}</div>\n <smart-multi-combo-input readonly pills class="editor asignee-editor" single-select data-source='${JSON.stringify(l)}'${0===l.length?" disabled":""} drop-down-button-position="right"${d} aria-labelledby="${t}LabelAssignedTo"></smart-multi-combo-input>\n <smart-numeric-text-box class="editor progress-editor" input-format="floatingPoint" min="0" max="100" show-unit unit="%"${d} aria-labelledby="${t}LabelProgress"></smart-numeric-text-box>\n </div>\n <div class="editor-container">\n <div id="${t}LabelStartDate" class="editor-label">${e.localize("startDate")}</div>\n <div id="${t}LabelDueDate" class="editor-label">${e.localize("dueDate")}</div>\n <smart-date-time-picker auto-close auto-open class="editor start-date-editor" calendar-button drop-down-append-to="body" drop-down-display-mode="calendar" format-string="${e.formatStringDate}" nullable${d} value="null" aria-labelledby="${t}LabelStartDate"></smart-date-time-picker>\n <smart-date-time-picker auto-close auto-open class="editor due-date-editor" calendar-button drop-down-append-to="body" drop-down-display-mode="calendar" format-string="${e.formatStringDate}" nullable${d} value="null" aria-labelledby="${t}LabelDueDate"></smart-date-time-picker>\n </div>\n <div class="editor-error-container smart-hidden" style="color: var(--smart-error);">\n <label id="${t}LabelRange">${e.localize("invalidRange",{start:e.localize("startDate"),end:e.localize("dueDate")})}</label>\n <br/> <br/>\n </div>\n <div class="editor-container">\n <div id="${t}LabelPriority" class="editor-label">${e.localize("priority")}</div>\n <div id="${t}LabelColor" class="editor-label">${e.localize("color")}</div>\n <div style="display: flex;"><span class="priority-editor-icon"></span><smart-input class="editor priority-editor" data-source='${JSON.stringify(o)}' drop-down-height="auto" drop-down-open-position="auto" drop-down-button-position="right" readonly${d} aria-labelledby="${t}LabelPriority"></smart-input></div>\n <smart-color-input value-display-mode="colorBox" class="editor color-editor" drop-down-open-position="auto" drop-down-button-position="right"${d} aria-labelledby="${t}LabelColor"></smart-color-input>\n </div>\n <div id="${t}LabelTags" class="editor-label">${e.localize("tags")}</div>\n <div aria-labelledby="${t}LabelTags">\n <smart-multi-combo-input color-items readonly pills class="editor tags-editor" drop-down-button-position="right" drop-down-open-position="auto" ${d} aria-labelledby="${t}LabelTags"></smart-multi-combo-input>\n <div class="smart-hidden editor empty-tags-label" id="${t}LabelEmptyTags" aria-labelledby="${t}LabelTags">${e.localize("emptyTags")}</div>\n </div>\n </div>\n </div>\n </div>\n <div class="smart-kanban-tab-content smart-hidden subtasks">\n <div id="${t}LabelChecklist" class="editor-label">${e.localize("checklist")}</div>\n <div class="new-container">\n <input type="text" class="new-subtask" placeholder="${e.localize("newSubtask")}" />\n <smart-button class="add primary" title="${e.localize("addSubtask")}" aria-label="Add subtask"${d}>+</smart-button>\n </div>\n <smart-list-box class="editor checklist-editor" item-template="${n.id}" selection-mode="checkBox"${d} aria-labelledby="${t}LabelChecklist"></smart-list-box>\n <br/>\n </div>\n <div class="smart-kanban-tab-content comments">\n </div>\n <div class="smart-kanban-tab-content smart-hidden history">\n <div class="editor-container">\n <div id="${t}LabelCreatedBy" class="editor-label">${e.localize("createdBy")}</div>\n <div id="${t}LabelCreatedByDate" class="editor-label">${e.localize("createdByDate")}</div>\n <div class="editor created" aria-labelledby="${t}LabelCreatedBy"></div>\n <div class="editor created-date" aria-labelledby="${t}LabelCreatedByDate"></div>\n </div>\n <div class="editor-container">\n <div id="${t}LabelUpdatedBy" class="editor-label">${e.localize("updatedBy")}</div>\n <div id="${t}LabelUpdatedBy" class="editor-label">${e.localize("updatedByDate")}</div>\n <div class="editor updated" aria-labelledby="${t}LabelUpdatedBy"></div>\n <div class="editor updated-date" aria-labelledby="${t}LabelUpdatedByDate"></div>\n </div>\n <div class="history-table smart-hidden editor-container">\n </div>\n </div>\n <div class="smart-kanban-tab-content fields">\n </div> \n<div class="template-container">\n</div>\n`,a.layout=s.querySelector(".layout"),a.editors={text:s.querySelector(".text-editor"),description:s.querySelector(".description-editor"),tags:s.querySelector(".tags-editor"),emptyTags:s.querySelector(".empty-tags-label"),userId:s.querySelector(".asignee-editor"),status:s.querySelector(".status-editor"),swimlane:s.querySelector(".swimlane-editor"),swimlaneLabel:s.querySelector(".swimlane-label"),startDate:s.querySelector(".start-date-editor"),dueDate:s.querySelector(".due-date-editor"),progress:s.querySelector(".progress-editor"),priority:s.querySelector(".priority-editor"),priorityIcon:s.querySelector(".priority-editor-icon"),color:s.querySelector(".color-editor"),newSubtask:s.querySelector(".new-subtask"),checklist:s.querySelector(".checklist-editor"),template:s.querySelector(".template-container"),created:s.querySelector(".created"),createdDate:s.querySelector(".created-date"),updated:s.querySelector(".updated"),updatedDate:s.querySelector(".updated-date"),tabs:s.querySelector(".smart-kanban-tab-strip"),detailsTab:s.querySelector('[view="details"]'),commentsTab:s.querySelector('[view="comments"]'),subtasksTab:s.querySelector('[view="subtasks"]'),historyTab:s.querySelector('[view="history"]'),fieldsTab:s.querySelector('[view="fields"]')},a.labels={};for(let e in a.editors){const t=a.editors[e].getAttribute("aria-labelledby"),l=s.querySelector("#"+t);l&&(a.labels[e]=l)}a.tabs={all:a.editors.tabs,detail:a.editors.detailsTab,comments:a.editors.commentsTab,history:a.editors.historyTab,subtasks:a.editors.subtasksTab,fields:a.editors.fieldsTab};const c=()=>{a.editors.status.classList.contains("smart-hidden")&&a.editors.text.classList.contains("smart-hidden")&&a.editors.description.classList.contains("smart-hidden")?(a.editors.description.closest(".column").classList.add("smart-hidden"),a.editors.description.closest(".layout").classList.add("single-column")):e.dialogEditors&&3===e.dialogEditors.length&&e.dialogEditors.indexOf("text")>=0&&e.dialogEditors.indexOf("description")>=0&&e.dialogEditors.indexOf("status")>=0?a.editors.description.closest(".layout").classList.add("single-column"):(a.editors.description.closest(".column").classList.remove("smart-hidden"),a.editors.description.closest(".column").classList.remove("single-column"),a.editors.description.closest(".layout").classList.remove("single-column"))};a.showEditor=e=>{const t=e=>{if(e){const t=[...e.children];let a=0;for(let e=0;e<t.length;e++)t[e].classList.contains("smart-hidden")||a++;a===t.length&&e.classList.remove("single-column")}};a.editors[e]&&(a.editors[e].classList.remove("smart-hidden"),t(a.editors[e].closest(".editor-container"))),a.labels[e]&&(a.labels[e].classList.remove("smart-hidden"),t(a.labels[e].closest(".editor-container"))),"checklist"===e&&a.tabs.subtasks.classList.remove("smart-hidden"),c()},a.hideEditor=e=>{if(a.editors[e]){a.editors[e].classList.add("smart-hidden");const t=a.editors[e].closest(".editor-container");t&&t.classList.add("single-column")}a.labels[e]&&a.labels[e].classList.add("smart-hidden"),"checklist"===e&&a.tabs.subtasks.classList.add("smart-hidden"),c()};const u=a.editors.tabs.querySelectorAll(".smart-kanban-tab");a.selectTab=e=>{if(u[e]&&!u[e].classList.contains("smart-hidden")&&u[e].click(),0===e){const e=[...a.tabs.all.children];for(let t=0;t<e.length;t++)if(e[t]&&!e[t].classList.contains("smart-hidden")){e[t].click();break}}},a.refreshTabs=t=>{const s=a.taskOrComment?a.taskOrComment.data[e.dataSourceMap.comments]:0,l=s&&s.length?'<span class="summary"> ('+s.length+")</span>":"";let r=a.taskOrComment?a.taskOrComment.data[e.dataSourceMap.checklist]:0,o=r&&r.length?'<span class="summary"> ('+r.length+")</span>":"";t||(r=a.editors.checklist.items.length,r&&(o=r?'<span class="summary"> ('+r+")</span>":"")),a.editors.commentsTab.innerHTML=`${e.localize("commentsTab")}${l}`,a.editors.subtasksTab.innerHTML=`${e.localize("subtasksTab")}${o}`,e._currentUser.allowComment&&a.taskOrComment?a.editors.commentsTab.classList.remove("smart-hidden"):a.editors.commentsTab.classList.add("smart-hidden"),e.readonly&&!r?a.editors.subtasksTab.classList.add("smart-hidden"):a.editors.checklist.classList.contains("smart-hidden")||a.editors.subtasksTab.classList.remove("smart-hidden"),e.taskCustomFields.length>0?a.editors.fieldsTab.classList.remove("smart-hidden"):a.editors.fieldsTab.classList.add("smart-hidden"),a.taskOrComment&&(a.taskOrComment.data[e.dataSourceMap.updatedDate]||a.taskOrComment.data[e.dataSourceMap.createdDate])?a.editors.historyTab.classList.remove("smart-hidden"):a.editors.historyTab.classList.add("smart-hidden");const i=["checklist","color","dueDate","priority","progress","startDate","status","swimlane","tags","text","description","userId"];let n=0;for(let e=0;e<i.length;e++){const t=i[e];a.editors[t].classList.contains("smart-hidden")&&n++}n===i.length?a.tabs.detail.classList.add("smart-hidden"):a.tabs.detail.classList.remove("smart-hidden")},a.refreshFields=()=>{const t=a.querySelector(".fields"),s=a.taskOrComment?a.taskOrComment.data:{},l=e.taskCustomFields.length,r=a.querySelectorAll(["[container-for]"]).length;if(e._resetFields&&(delete e._resetFields,a.refreshFieldsDirty=!0,t.innerHTML=""),!0===a.refreshFieldsDirty)if(a.refreshFieldsDirty=!1,t.firstElementChild&&l<=r)for(let t=0;t<e.taskCustomFields.length;t++){const l=e.taskCustomFields[t];let r=s[l.dataField];const o=a.querySelector("[container-for="+l.dataField+"]");if(!o)continue;e.dataSourceMap[l.dataField]?o.classList.add("smart-hidden"):o.classList.remove("smart-hidden"),null==r&&(r="");const i=o.lastElementChild.firstElementChild;i.removeAttribute("dirty"),r&&r instanceof Date?"dateInput"===l.editor?i.value=r:r&&"dateRangeInput"===l.editor?Array.isArray(r)&&(i.value=r):i.value=""+r:i.value=""+r,"image"===l.editor?r||(i.innerHTML=e.localize("emptyImage")):"attachments"!==l.editor&&"attachment"!==l.editor||r||(i.innerHTML=e.localize("emptyAttachment"))}else{const a=document.createDocumentFragment(),l=(t,a,s)=>{null==a&&(a="");const l=document.createElement("div"),r=document.createElement("div"),o=document.createElement("div");void 0===s.visible&&(s.visible=!0),void 0===s.allowHide&&(s.allowHide=!0),s.allowHide?r.innerHTML=t+'<span class="icon"></span>':r.innerHTML=t,r.classList.add("editor-label"),s.allowHide&&(!1===s.visible&&r.lastElementChild.classList.add("hide"),r.lastElementChild.onpointerdown=()=>{s.visible=!s.visible,r.lastElementChild.classList.toggle("hide")}),o.classList.add("editor");let i=document.createElement("input");if(i.classList.add("smart-input"),void 0!==s.minLength&&(i.minLength=s.minLength),void 0!==s.maxLength&&(i.maxLength=s.maxLength),"textarea"===s.editor)i=document.createElement("smart-text-area"),void 0!==s.minLength&&(i.minLength=s.minLength),void 0!==s.maxLength&&(i.maxLength=s.maxLength);else if("password"===s.editor)i.type="password";else if("phone"===s.editor||"tel"===s.editor)Smart.PhoneInput?i=document.createElement("smart-phone-input"):i.type="tel";else if("url"===s.editor)i.type="url";else if("email"===s.editor)i.type="email";else if("date"===s.dataType||"dateInput"===s.editor)"dateRangeInput"===s.editor?(i=document.createElement("smart-date-range-input"),i.selectedDates=a):i=document.createElement("smart-date-input"),i.autoClose=!0,""===a&&(a=new Date),void 0!==s.minDate&&(i.min=s.minDate),void 0!==s.maxDate&&(i.max=s.maxDate);else if("boolean"===s.dataType)i=document.createElement("smart-check-box"),""===a&&(a=!1);else if("number"===s.dataType||"numberInput"===s.editor)i=document.createElement("smart-number-input"),a||(a=0),void 0!==s.min&&(i.min=s.min),void 0!==s.max&&(i.max=s.max);else if("string"===s.dataType&&s.options)i=document.createElement("smart-input"),i.readonly=!0,i.dropDownButtonPosition="right",i.dataSource=s.options;else if("string"===s.dataType&&"multiComboInput"===s.editor)i=document.createElement("smart-multi-combo-input"),i.readonly=!0,i.dropDownButtonPosition="right",i.dataSource=s.dataSource,i.pills=!0,i.selectedValues=[""+a],s.singleSelect&&(i.singleSelect=!0),s.colorItems&&(i.colorItems=!0);else if("string"!==s.dataType||"image"!==s.editor&&"images"!==s.editor){if("string"===s.dataType&&("attachment"===s.editor||"attachments"===s.editor))if(a.length>50){if("string"==typeof a&&(a.indexOf("[{")>=0||a.indexOf("}]")>=0)){let e="";if(a)try{e=JSON.parse(a)}catch(e){console.log(e)}a=e}const t=document.createElement("div");if(Array.isArray(a)){a.forEach((e=>{const a=document.createElement("div");a.title=e.label,a.classList.add("item"),a.innerHTML="<div></div>",a.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?a.firstElementChild.classList.add("smart-icon-image"):e.label.indexOf(".pdf")>=0?a.firstElementChild.classList.add("smart-icon-pdf"):e.label.indexOf(".tsv")>=0||e.label.indexOf(".txt")>=0||e.label.indexOf(".csv")>=0?a.firstElementChild.classList.add("smart-icon-text"):e.label.indexOf(".xls")>=0||e.label.indexOf(".xlsx")>=0?a.firstElementChild.classList.add("smart-icon-excel"):e.label.indexOf(".ppt")>=0?a.firstElementChild.classList.add("smart-icon-powerpoint"):e.label.indexOf(".zip")>=0||e.label.indexOf(".rar")>=0||e.label.indexOf(".7z")>=0?a.firstElementChild.classList.add("smart-icon-archive"):e.label.indexOf(".doc")>=0||e.label.indexOf(".docx")>=0?a.firstElementChild.classList.add("smart-icon-word"):a.firstElementChild.classList.add("smart-icon-file"),t.appendChild(a)}));const s=t;t._value=a,t.onpointerdown=a=>{if(a.target.classList.contains("attachment")){const l=t._value&&"string"==typeof t._value?JSON.parse(t._value):t._value,r=[...s.children[0].children].indexOf(a.target);if(l[r]){const t=document.createElement("a");if(l[r].value.indexOf(window.location.host)>=0)fetch(l[r].value).then((e=>e.blob())).then((e=>{const a=URL.createObjectURL(e);t.download=l[r].label,t.href=a,t.click()}));else{if(l[r].value.indexOf("base64")>=0){const a=e._getFileFromBase64(l[r].value);t.href=URL.createObjectURL(a)}else t.href=l[r].value;t.target="_blank",t.click()}}a.stopPropagation(),a.preventDefault()}}}i=t}else i=document.createElement("div"),a||(i.innerHTML=e.localize("emptyAttachment"))}else if(a.length>50)if(a.indexOf("base64")>=0){a=JSON.parse(a),window.Smart._createSmartImageModal=e._createImageModal;let t="";for(let e=0;e<a.length;e++){const s=a[e];t+=`<img style="margin-left: 5px;" onpointerdown="Smart._createSmartImageModal(this, event)" width="20" height="20" src="${s.value}" title="${s.label}"/>`}i=document.createElement("div"),i.innerHTML=t}else a=a.substring(0,50)+"...";else i=document.createElement("div"),a||(i.innerHTML=e.localize("emptyImage"));return i.setAttribute("data-field",s.dataField),i.classList.add("smart-kanban-task-field-editor"),s&&"dateRangeInput"===s.editor?i.value=a:i.value=""+a,i.onchange=()=>{i.setAttribute("dirty","")},o.appendChild(i),l.appendChild(r),l.appendChild(o),l.setAttribute("container-for",s.dataField),l},r=document.createElement("div");r.classList.add("editor-container"),a.appendChild(r);for(let t=0;t<e.taskCustomFields.length;t++){const a=e.taskCustomFields[t],o=l(a.label,s[a.dataField],a);r.appendChild(o),e.dataSourceMap[a.dataField]&&o.classList.add("smart-hidden")}t.innerHTML="",t.appendChild(a)}},a.refreshHistory=()=>{const t=a.querySelector(".history-table");if(!e.storeHistory)return void t.classList.add("smart-hidden");t.classList.remove("smart-hidden");const s=a.taskOrComment.data.history;let l=`<table><tr>\n <th>${e.localize("historyEvent")}</th>\n <th>${e.localize("historyAuthor")}</th>\n <th>${e.localize("historyDetails")}</th>\n <th>${e.localize("historyDate")}</th>\n </tr>\n `;for(let t=s.length-1;t>=0;t--){const a=s[t];if(l+=`<tr>\n <td>${e._getHistoryItemLabel(a)}</td>`,void 0!==a.user){const t=(t=>{const a=t?t.image:null;return{image:a?`background-image: url('${a}');`:"",label:t?t.name||t.id:e.localize("guestUser")}})(e.users.find((e=>e.id===a.user)));l+=`<td><div class="smart-kanban-task-user-history"><div class="icon smart-kanban-task-user" style="${t.image}"></div><div class="name">${t.label}</div></div></td>`}else l+="<td></td>";if("created"!==a.action){let t=a.details.oldValue,s=a.details.value;if("user"===a.action){const a=e.users.find((e=>e.id===t)),l=e.users.find((e=>e.id===s));t=a?a.name:e.localize("unassigned"),s=l?l.name:e.localize("unassigned")}if(t&&t instanceof Date&&(t=t.toLocaleString()),s&&s instanceof Date&&(s=s.toLocaleString()),"subtasks"===a.action){const t=a.details.value.filter((e=>e.completed));l+=`<td><span class="smart-truncate">${e.localize("taskSubtasksCompleted",{value:t.length+"/"+a.details.value.length})}</span></td>`}else l+=t?`<td><span class="smart-truncate">${e.localize("range",{oldValue:t,newValue:s})}</span></td>`:`<td><span class="smart-truncate">${e.localize("nullRange",{oldValue:t,newValue:s})}</span></td>`}else l+=`<td>${a.details.value}</td>`;l+=`\n <td>${a.date.toLocaleString()}</td>\n </tr>`}l+="</table>",t.innerHTML=l,a.refreshTabs()},a.refreshComments=()=>{if(!a.taskOrComment)return;const t=a.querySelector(".comments");t.classList.remove("smart-hidden");const s=e._getCommentsList(a.taskOrComment);s.classList.remove("dialog");const l=s.querySelector(".send");l&&(l.onclick=t=>{if(l.disabled)return;const s=JSON.parse(JSON.stringify(e._commentSelectionFor.data)),r=e._createComment();e._commentsList.textarea.value="",l.disabled=!0,a.refreshTabs();const o=JSON.parse(JSON.stringify(e._commentSelectionFor.data));e.$.fireEvent("change",{task:e._commentSelectionFor,id:o.id,value:o,oldValue:s}),e.$.fireEvent("taskUpdate",{id:o.id,value:o,oldValue:s}),e.$.fireEvent("commentAdd",{id:o.id,value:r}),t.stopPropagation(),t.preventDefault()}),t.innerHTML="",t.appendChild(s),a.refreshTabs()},u.forEach((e=>{e.onfocus=()=>{e.setAttribute("focus","")},e.onblur=()=>{e.removeAttribute("focus")},e.onkeydown=t=>{"Enter"===t.key&&(e.click(),t.stopPropagation())},e.onclick=e=>{const t=e.target.closest(".smart-kanban-tab"),s=t.getAttribute("view");switch(u.forEach((e=>{e.classList.remove("selected")})),t.focus(),t.classList.add("selected"),a.querySelectorAll(".smart-kanban-tab-content").forEach((e=>{e.classList.add("smart-hidden")})),s){case"details":a.querySelector(".details").classList.remove("smart-hidden");break;case"subtasks":a.querySelector(".subtasks").classList.remove("smart-hidden");break;case"comments":a.refreshComments();break;case"history":a.querySelector(".history").classList.remove("smart-hidden"),a.refreshHistory();break;case"fields":a.querySelector(".fields").classList.remove("smart-hidden"),a.refreshFields()}}})),(()=>{const e=a.editors.color;e.dataSource=["#D50000","#E67C73","#F4511E","#F6BF26","#33B679","#0B8043","#039BE5","#3F51B5","#7986CB","#8E24AA","#616161","#FFFFFF","#000000",""],e.valueDisplayMode="colorBox",e.classList.add("smart-kanban-color-input"),e.style.width="auto",e.style.height="auto",e.readonly=!0,e.dropDownWidth=50;const t=e.$.scrollView;t&&t.classList.add("smart-kanban-color-input"),e.onRender=()=>{const t=e.$.scrollView;t&&t.classList.add("smart-kanban-color-input")}})(),a.editors.newSubtask.onchange=()=>{a.editors.newSubtask.nextElementSibling.click()},a.editors.priority.onchange=()=>{e._setPriorityEditorIcon(!0)},e._setPriorityEditorIcon(),a.editPanelPopulated=!0,e.dialogRendered&&e.dialogRendered(a,a.editors,a.labels,a.tabs,a.layout,a.taskOrComment)}_setPriorityEditorIcon(e){const t=this,a=t._dialog;let s=a.editors.priority.selectedValues[0];null==s&&(s=""),e||a.taskOrComment&&a.taskOrComment.data&&void 0!==a.taskOrComment.data.priority&&(s=a.taskOrComment.data.priority);const l=e=>{switch(e.value){case"":return'<span style="margin-left: 0px; margin-right: 5px;" class="priority"></span>';case"low":return'<span style="margin-left: 0px; margin-right: 5px;" class="priority low"></span>';case"average":return'<span style="margin-left: 0px; margin-right: 5px;" class="priority average"></span>';case"high":return'<span style="margin-left: 0px; margin-right: 5px;" class="priority high"></span>';case"critical":return'<span style="margin-left: 0px; margin-right: 5px;" class="priority critical"></span>'}let t="margin-left: 1px; margin-right: 5px;";return t+="height: 0px;",t+="width: 0px;",t+="border-left-color: transparent;",t+="border-left-style: solid;",t+="border-left-width: 7px;",t+="border-right-color: transparent;",t+="border-right-style: solid;",t+="border-right-width: 7px;","low"!==e.value?(t+="border-bottom-color: "+e.color+";"||0,t+="border-bottom-style: solid;",t+="border-bottom-width: 12px;"):(t+="border-top-color: "+e.color+";"||0,t+="border-top-style: solid;",t+="border-top-width: 12px;"),t+="border-radius: 3px;",`<span class="${e.value} priority" style="${t}"></span>`};for(let e=0;e<t.priority.length;e++){const r=t.priority[e];if(s?a.editors.priorityIcon.classList.remove("smart-hidden"):a.editors.priorityIcon.classList.add("smart-hidden"),r.value===s){a.editors.priorityIcon.innerHTML='<div class="smart-kanban-task-text">'+l(r)+"</div>";break}}}_showHideDialogEditors(){const e=this,t=e._dialog,a=["checklist","color","dueDate","priority","progress","startDate","status","swimlane","tags","text","description","userId"];for(let s=0;s<a.length;s++){const l=a[s];e.dialogEditors.indexOf(l)>=0?t.showEditor(l):t.hideEditor(l)}const s=e._allColumns.map((e=>({color:e.color,label:e.label,value:e.dataField})));s.length<=1&&t.hideEditor("status"),t.editors.status.dataSource=s,0===t.editors.tags.dataSource.length?(t.editors.tags.classList.add("smart-hidden"),t.editors.emptyTags.classList.remove("smart-hidden")):(t.editors.tags.classList.remove("smart-hidden"),t.editors.emptyTags.classList.add("smart-hidden")),0===e.users.length&&t.hideEditor("userId")}_unescapeValue(e){if(null==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 a;for(let s in t)a=new RegExp(t[s].entity,"g"),e=e.replace(a,t[s].regex);return e}_escapeValue(e){return e=e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/'/g,"&#39;").replace(/"/g,"&quot;")}_beginEdit(e){const t=this;t.tags||(t.tags=[]);const a=t.dataSourceMap,s=e.data,l=t._dialog,r=l.editors,o=t.tags.length>0?[...t.tags,...t._customTags]:t._customTags,i=t._allColumns.find((e=>e.dataField===s[a.status]));if(l.label=t.localize("editTask",{taskId:s[a.id],text:s[a.text]}),r.text.value=t._unescapeValue(s[a.text]),r.description.value=t._unescapeValue(s[a.description]),r.tags.dataSource=o,t._showHideDialogEditors(),t.allowCustomTags,s[a.tags]){const e=e=>{let a=[];e.indexOf(",")>=0?a=e.split(","):Array.isArray(e)?a=a.concat(e):a.push(e);const s=[];for(let e=0;e<a.length;e++)"string"==typeof a[e]?(a[e]=t._unescapeValue(a[e].trim()),s.push(a[e])):(a[e].label=t._unescapeValue(a[e].label),s.push(a[e].value));return s};if(!t.allowCustomTags){const l=t.tags.length>0?t.tags:e(s[a.tags]);r.tags.dataSource=l}r.tags.selectedValues=e(s[a.tags])}else r.tags.selectedValues=[];0===r.tags.dataSource.length?(r.tags.classList.add("smart-hidden"),r.emptyTags.classList.remove("smart-hidden")):(r.tags.classList.remove("smart-hidden"),r.emptyTags.classList.add("smart-hidden")),l.editors.created.parentElement.classList.add("smart-hidden"),l.editors.updated.parentElement.classList.add("smart-hidden");const n=void 0!==s[a.createdUserId]?t.users.find((e=>e.id===s[a.createdUserId])):"",d=s[a.createdDate],c=void 0!==s[a.updatedUserId]?t.users.find((e=>e.id===s[a.updatedUserId])):"",u=s[a.updatedDate],m=e=>{const a=e?e.image:null;return{image:a?`background-image: url('${a}');`:"",label:e?e.name||e.id:t.localize("guestUser")}};if(n){const e=m(n);l.editors.created.parentElement.classList.remove("smart-hidden"),l.editors.created.innerHTML=`<div class="icon smart-kanban-task-user" style="${e.image}"></div><div class="name">${e.label}</div>`,d&&(l.editors.createdDate.innerHTML=d.toLocaleString())}if(c){const e=m(c);l.editors.updated.parentElement.classList.remove("smart-hidden"),l.editors.updated.innerHTML=`<div class="icon smart-kanban-task-user" style="${e.image}"></div><div class="name">${e.label}</div>`,u&&(l.editors.updatedDate.innerHTML=u.toLocaleString())}const p=null!==s[a.userId]?t.users.find((e=>e.id===s[a.userId])):"";p?r.userId.selectedItems=[{label:p.name,value:p.id,image:p.image?p.image:null}]:r.userId.value="",delete r.userId.$.input.dataValue,r.status.selectedValues=[i.dataField],t.readonly||!t._currentUser.allowEdit?(r.status.readonly=!1,r.priority.readonly=!1):(r.status.readonly=!0,r.priority.readonly=!0),delete r.status.$.input.dataValue,t._hasSwimlane(t.columns.indexOf(i))?r.swimlane.value=t.swimlanes.find((e=>e.dataField===s[a.swimlane])).label:r.swimlane.value="",delete r.swimlane.$.input.dataValue,r.startDate.value=s[a.startDate]||null,r.dueDate.value=s[a.dueDate]||null,r.progress.value=parseFloat(s[a.progress])||0;const h=t.localize(s[a.priority]);r.priority.value=null!=h?h:"",delete r.priority.$.input.dataValue,""===r.priority.value&&(r.priority.selectedValues=[]),r.color.value=s[a.color]||"";const g=[],f=[];(s[a.checklist]||[]).forEach(((e,t)=>{e.completed&&g.push(t),f.push({label:e.text,selected:!0===e.completed})})),0===t.swimlanes.length?(l.editors.swimlane.classList.add("smart-hidden"),l.editors.swimlaneLabel.classList.add("smart-hidden"),l.editors.swimlane.parentElement.classList.add("single-column")):(l.editors.swimlane.classList.remove("smart-hidden"),l.editors.swimlaneLabel.classList.remove("smart-hidden"),l.editors.swimlane.parentElement.classList.remove("single-column")),r.dueDate.onchange=r.startDate.onchange=()=>{r.startDate.value>=r.dueDate.value&&r.dueDate.value?(l.$.footer.firstElementChild.disabled=!0,l.querySelector(".editor-error-container").classList.remove("smart-hidden")):(l.$.footer.firstElementChild.disabled=!1,l.querySelector(".editor-error-container").classList.add("smart-hidden"))},r.startDate.value&&r.startDate.value>=r.dueDate.value&&r.dueDate.value&&(l.$.footer.firstElementChild.disabled=!0,l.querySelector(".editor-error-container").classList.remove("smart-hidden")),r.newSubtask.value="",r.checklist.dataSource=f,r.checklist.selectedIndexes=g,t._setPriorityEditorIcon(),l.refreshTabs(!0),l.selectTab(0)}_endEdit(){const e=this,t=e.dataSourceMap,a=e._dialog,s=a.editors,l=a.taskOrComment,r=l?l.data:void 0,o=Object.assign({},r);let i=s.startDate.value,n=s.dueDate.value;o[t.text]=e._escapeValue(s.text.value),o[t.description]=e._escapeValue(s.description.value);const d=[];for(let t=0;t<s.tags.dataSource.length;t++){const a=s.tags.dataSource[t];"string"==typeof a?s.tags.selectedValues.indexOf(a)>=0&&d.push(e._escapeValue(a)):s.tags.selectedValues.indexOf(a.value)>=0&&(a.label=e._escapeValue(a.label),d.push(a))}if(o[t.tags]=d,o[t.progress]=parseFloat(s.progress.value),o[t.color]=s.color.value,e._currentUser.info&&(o[t.updatedUserId]=e._currentUser.info.id,o[t.updatedDate]=new Date),o[t.color]||""===o[t.color]||delete o[t.color],void 0!==s.userId.$.input.dataValue&&(o[t.userId]=parseFloat(s.userId.$.input.dataValue)),void 0!==s.status.$.input.dataValue&&(o[t.status]=s.status.$.input.dataValue),s.swimlane.$.input.dataValue&&(o[t.swimlane]=s.swimlane.$.input.dataValue),i&&(i=i.toDate()),n&&(n=n.toDate()),o[t.startDate]=i,o[t.dueDate]=n,void 0!==s.priority.$.input.dataValue&&(o[t.priority]=s.priority.$.input.dataValue),o[t.checklist]=s.checklist.items.map((e=>({text:e.label.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/'/g,"&#39;").replace(/"/g,"&quot;").replace(/\\/g,""),completed:e.selected}))),e.taskCustomFields&&e.taskCustomFields.length>0)for(let t=0;t<e.taskCustomFields.length;t++){const s=e.taskCustomFields[t],l=a.querySelector("[data-field="+s.dataField+"]");if(l){let t=l.value;l.dataSource&&l.dataSource.length>0&&l.selectedValues.length>0&&(t=l.selectedValues.toString()),"smart-number-input"===l.nodeName.toLowerCase()&&(t=l.getValue()),"smart-date-input"===l.nodeName.toLowerCase()&&(t=l.getValue()),"smart-date-range-input"===l.nodeName.toLowerCase()&&(t=l.getValue()),(l.hasAttribute("dirty")||e.dialogCustomizationFunction)&&(o[s.dataField]=t)}}l?e.updateTask(l,o):e.addTask(o),s.tags.close()}_clearEditors(){const e=this,t=e._dialog.editors,a=e.tags.length>0?e.tags:e._customTags;t.text.value="",t.description.value="",t.tags.dataSource=a,t.tags.selectedValues=[],t.status.selectedValues=[],delete t.status.$.input.dataValue,t.swimlane.value="",delete t.swimlane.$.input.dataValue,t.userId.value="",delete t.userId.$.input.dataValue,t.progress.value=0,t.startDate.value=null,t.dueDate.value=null,t.priority.value="",t.priority.$.input.dataValue="",t.priority.selectedValues=[],t.color.value="",t.newSubtask.value="",t.created.innerHTML="",t.updated.innerHTML="",t.createdDate.innerHTML="",t.updatedDate.innerHTML="",t.checklist.dataSource=[],t.checklist.selectedIndexes=[]}_getCurrentUser(){const e=this,t=e.users;let a=e.currentUser,s=!0,l=!0,r=e.allowDrag,o=e.editable,i=!0;t&&null!==a&&(a=t.find((e=>e.id===a)),a&&(s=!1!==a.allowAdd,l=!1!==a.allowComment,r=r&&!1!==a.allowDrag,o=o&&!1!==a.allowEdit,i=!1!==a.allowRemove)),e._currentUser={allowAdd:s,allowComment:l,allowDrag:r,allowEdit:o,allowRemove:i,info:a}}_autoSaveState(e){const t=this;if(t.autoSaveState)if("object"!=typeof e)if(e&&t._autoSavedState){switch(e){case"collapsed":t._allColumns.forEach((e=>t._autoSavedState.collapsed[e.dataField]=e.collapsed));break;case"dataSource":t._autoSavedState.dataSource=t._getCurrentDataSource();break;case"filtering":t._autoSavedState.filtering=t._appliedFiltering;break;case"selection":{const e=t.dataSourceMap;let a=null,s=null;t._selectionInView&&(a=t._selectionInView.closest(".smart-kanban-column").column.dataField,s=t._selectionInView.getAttribute("swimlane")),t._autoSavedState.selection={selected:t._selectedTasks,selectionStart:t._selectionStart?t._selectionStart.data[e.id]:null,selectionInColumn:a,swimlane:s};break}case"sorting":t._autoSaveState.sorting=t._appliedSorting;break;case"tabs":t._autoSaveState.tabs=t._selectedTabs;break;case"visibility":t._autoSavedState.visibility={taskActions:t.taskActions,taskComments:t.taskComments,taskDue:t.taskDue,taskPriority:t.taskPriority,taskProgress:t.taskProgress,taskTags:t.taskTags,taskUserIcon:t.taskUserIcon}}window.localStorage.setItem("smartKanban"+t.id,JSON.stringify(t._autoSavedState))}else t._autoSavedState=t.saveState();else t._autoSavedState=e}_getCurrentDataFields(e){const t=this,a=[{name:"text",dataType:"string"},{name:"tags",dataType:"string"},{name:"priority",dataType:"string"},{name:"progress",dataType:"number"},{name:"startDate",dataType:"date"},{name:"dueDate",dataType:"date"},{name:"userId",dataType:"string"}],s=e&&e.length>0?e[0]:null;for(let e=0;e<t.taskCustomFields.length;e++)if(s){const l=typeof s[t.taskCustomFields[e].dataField];"number"===l?a.push({name:t.taskCustomFields[e].dataField,dataType:"number"}):"date"===l?a.push({name:t.taskCustomFields[e].dataField,dataType:"date"}):a.push({name:t.taskCustomFields[e].dataField,dataType:"string"})}else a.push({name:t.taskCustomFields[e].dataField,dataType:"string"});return a}_applyFilter(e,t){const a=this;if(a.dataSource&&a.dataSource.virtualDataSource)return a._requestVirtualDataSource("filter"),void a._autoSaveState("filtering");const s=a._getCurrentDataSource(),l=a._getCurrentDataFields(s),r=new Smart.DataAdapter({dataSource:s,dataFields:l,id:"id"});try{r._filter(e,t)}catch(e){return}if(a.virtualization){if(e&&e.length>0){const e=Object.keys(a.tasksByDataField);for(let t=0;t<e.length;t++){const s=e[t];delete a.tasksByDataField[s]._filtered;let l=a._getTasksByDataField(s),o=[];for(let e=0;e<l.length;e++){const t=l[e],a=r.dataItemById[t.id];a&&a.$.filtered&&o.push(t)}a.tasksByDataField[s]._filtered=o}}else{const e=Object.keys(a.tasksByDataField);for(let t=0;t<e.length;t++){const s=e[t];delete a.tasksByDataField[s]._filtered}}a._refreshColumns()}else{const e=Array.from(a.$.container.getElementsByClassName("smart-kanban-task"));for(let t=0;t<r.length;t++){const a=e[t],s=!r[t].$.filtered;a.classList.toggle("smart-hidden",s),a.filteredOut=s}a._allColumns.forEach((e=>a._refreshScrollViewer(e)))}a._autoSaveState("filtering")}_applyHandler(e,t){const a=this,s=a.isInShadowDOM||a.shadowRoot?e.composedPath()[0]:e.target,l=e.detail;a.$.customize.contains(s)||"customize"===t?(l.value.forEach((e=>a[e.dataField]=e.visible)),a._allColumns.forEach((e=>a._refreshScrollViewer(e))),a.virtualization&&(delete a._autoCardHeight,a._measureCardHeight(),a._refreshColumns()),a._autoSaveState("visibility")):a.$.filter.contains(s)||"filter"===t?a.addFilter(l.filters,l.operator,l.value):(a.$.sort.contains(s)||"sort"===t)&&a.addSort(l.sortByInfo),a.closePanel()}_applySort(){const e=this,t=e._appliedSorting;if(e._autoSaveState("sorting"),e.dataSource&&e.dataSource.virtualDataSource)e._requestVirtualDataSource("sort");else if(0!==t.dataFields.length)e._allColumns.forEach((a=>{const s=e._columnToElement.get(a).querySelector(".smart-scroll-viewer-content-container"),l=Array.from(s.children),r=[];if(l.length<2)return;let o;if(e.virtualization?e.tasksByDataField[a.dataField].forEach(((t,a)=>{const s=e.dataSourceMap,l=Object.assign({taskIndex:a},t);"low"===l[s.priority]&&(l[s.priority]="z"),r.push(l)})):l.forEach(((t,a)=>{const s=e.dataSourceMap,l=Object.assign({taskIndex:a},t.data);"low"===l[s.priority]&&(l[s.priority]="z"),r.push(l)})),e.taskCustomFields.length){const t=e._getCurrentDataFields(r);t.push({name:"taskIndex",dataType:"number"}),o=new Smart.DataAdapter({dataSource:r,observable:!1,dataFields:t,id:"id"})}else o=new Smart.DataAdapter({dataSource:r,observable:!1,dataFields:["taskIndex: number","text: string","tags: string","priority: string","progress: number","startDate: date","dueDate: date","userId: string"],id:"id"});if(o.sortBy(t.dataFields,t.dataTypes,t.orderBy),e.virtualization){if(e.tasksByDataField[a.dataField]._sorted=Smart.DataAdapter.Sort(e.tasksByDataField[a.dataField],t.dataFields,t.orderBy),e.tasksByDataField[a.dataField]._filtered){e.tasksByDataField[a.dataField]._originalFilteredData=JSON.parse(JSON.stringify(e.tasksByDataField[a.dataField]._filtered));const s=Smart.DataAdapter.Sort([...e.tasksByDataField[a.dataField]._filtered],t.dataFields,t.orderBy);e.tasksByDataField[a.dataField]._filtered=s||[]}e._refreshColumn(a.dataField)}else for(let e=0;e<o.length;e++)s.appendChild(l[o[e].taskIndex])}));else if(e.virtualization){const t=Object.keys(e.tasksByDataField);for(let a=0;a<t.length;a++){const s=t[a];delete e.tasksByDataField[s]._sorted,e.tasksByDataField[s]._filtered&&e.tasksByDataField[s]._originalFilteredData&&(e.tasksByDataField[s]._filtered=e.tasksByDataField[s]._originalFilteredData,delete e.tasksByDataField[s]._originalFilteredData),e._refreshColumn(s)}}}_closeSearchPanel(){const e=this;e._searchInfo&&(Array.from(e.$.container.querySelectorAll(".smart-kanban-task.smart-data-view-found, .smart-kanban-task.smart-data-view-highlighted")).forEach((e=>e.classList.remove("smart-data-view-found","smart-data-view-highlighted"))),delete e._searchInfo)}_constructFilterGroups(e){const t={text:"string",tags:"string",priority:"string",progress:"number",startDate:"date",dueDate:"date"},a={},s=[];e.filters.forEach((s=>{const l=s[0],r=t[l];let o=s[2],i=a[l];void 0===i&&(i=new Smart.Utilities.FilterGroup,a[l]=i),"date"===r&&"string"==typeof o&&(o=new Date(o));const n=i.createFilter(r,o,s[1]);i.addFilter(e.operator,n)}));for(let e in a)s.push([e,a[e]]);return s}_openSearchPanel(){const e=this;e.$.headerDropDown.classList.add("search-panel"),e.$.headerDropDown.classList.remove("customize-panel","filter-panel","sort-panel"),e.$.search.classList.remove("smart-hidden"),e.$.customize.classList.add("smart-hidden"),e.$.filter.classList.add("smart-hidden"),e.$.sort.classList.add("smart-hidden"),e._openHeaderDropDown(e.$.searchButton),e._searchInfo={source:e._getCurrentDataSource(),stringDataFields:["text","tags"]},""!==e.$.searchInput.value&&e._search(e.$.searchInput.value,!1)}_search(e,t=!0){const a=this;if(a._searchInfo.query=e,Array.from(a.$.container.querySelectorAll(".smart-kanban-task.smart-data-view-found, .smart-kanban-task.smart-data-view-highlighted")).forEach((e=>e.classList.remove("smart-data-view-found","smart-data-view-highlighted"))),""===e)return a.$.search.classList.remove("matches","no-matches"),delete a._searchInfo.foundIdsArray,delete a._searchInfo.foundIdsObject,void delete a._searchInfo.highlighted;const s=new Smart.DataAdapter({dataSource:a._searchInfo.source,dataFields:["text: string","tags: string"],id:"id"}),l=[],r=[],o={};a._searchInfo.stringDataFields.forEach((t=>{const a=new Smart.Utilities.FilterGroup,s=a.createFilter("string",e,"CONTAINS");a.addFilter("or",s),l.push([t,a])})),s._filter(l,"or");for(let e=0;e<s.length;e++){const t=s[e];!1!==t.$.filtered&&(r.push(t.$.id),o[t.$.id]=!0)}if(a._searchInfo.foundIdsArray=r,a._searchInfo.foundIdsObject=o,Array.from(a.$.container.getElementsByClassName("smart-kanban-task")).forEach((e=>{const s=e.data[a.dataSourceMap.id];if(o[s]){if(e.filteredOut)return r.splice(r.indexOf(s),1),void delete o[s];t&&r[0]===s&&e.classList.add("smart-data-view-highlighted"),e.classList.add("smart-data-view-found")}})),r.length>0){if(t){let e=r[0];a._searchInfo.highlighted=e,a.ensureVisible(e)}return a.$.search.classList.remove("no-matches"),a.$.search.classList.add("matches"),void(a.$.searchLabel.innerHTML=a.localize("found",{nth:t?1:0,n:r.length}))}a.$.search.classList.remove("matches"),a.$.search.classList.add("no-matches"),a.$.searchLabel.innerHTML=a.localize("found",{nth:0,n:0})}_bodyFocusinHandler(e){const t=this;let a=t.isInShadowDOM||t.shadowRoot?e.composedPath()[0]:e.target;if(a.classList.contains("smart-kanban-column-content-tasks")&&(a=a.$.content,!t._getSelectedItem(a,!0))){if(t.virtualization){const e=t._focusedTask;return void t.focusTask(e)}if(void 0!==t._focusedTask)return void t.focusTask(t._focusedTask);t._focusTask(t._getFirstItem(a))}}get _rtlAttr(){return this.rightToLeft?" right-to-left":""}get _tabindex(){return this.disabled||this.unfocusable?"":' tabindex="0"'}_appendAddNewColumn(e){const t=document.createElement("div");t.classList.add("smart-kanban-column","smart-kanban-add-new-column","smart-unselectable"),t.innerHTML=`<div class="smart-kanban-column-header smart-unselectable" > <div title="${this.localize("addNewColumn")}" class="smart-kanban-add-new-column-label smart-kanban-column-header-label"><span>+ ${this.localize("addNewStatus")}</span></div></div >\n <div class="smart-kanban-column-content no-sub-columns"><smart-scroll-viewer></smart-scroll-viewer></div>\n `,this.disabled||this.unfocusable||t.setAttribute("tabindex",0),t.column={dataField:"newStatus",label:"New Status"},e.appendChild(t)}selectTask(e){const t=this;t._selectedTasks.push(e),t._selectionStart=e,t._focusedTask=e;const a=t.querySelector(".smart-kanban-task[focus]");a&&a.removeAttribute("focus");const s=t.querySelector('.smart-kanban-task[data-id="'+e+'"]');s&&s.setAttribute("focus",""),t._refreshSelection(),t.ensureVisible(e)}unselectTask(e){const t=this,a=t._selectedTasks.indexOf(e);a>=0&&t._selectedTasks.splice(a,1),t._refreshSelection()}clearSelection(){const e=this;e._selectionStart=null,e._selectedTasks=[],e._refreshSelection()}getSelectedTasks(){return this._selectedTasks||(this._selectedTasks=[]),this._selectedTasks}getTask(e){return this.dataSource?this.dataSource.find((t=>{if(t.id===e)return t})):null}getColumn(e){const t=this;let a=null;for(let s=0;s<t.columns.length;s++)if(t.columns[s].dataField===e){a=t.columns[s];break}return a}getColumnDataItems(e){const t=this;let a=[];if(!t.getColumn(e)||!t.dataSource)return[];for(let s=0;s<t.dataSource.length;s++){const l=t.dataSource[s];l[t.dataSourceMap.status]===e&&a.push(l)}return a}_getFileFromBase64(e,t){let a=e.split(","),s=a[0].match(/:(.*?);/)[1],l=atob(a[1]),r=l.length,o=new Uint8Array(r);for(;r--;)o[r]=l.charCodeAt(r);return new File([o],t,{type:s})}updateColumn(e,t){const a=this;let s=null;for(let t=0;t<a.columns.length;t++)if(a.columns[t].dataField===e){s=a.columns[t];break}if(s){const e=s.label;void 0!==t.label&&(s.label=t.label),void 0!==t.collapsed&&(s.collapsed=t.collapsed),void 0!==t.collapsible&&(s.collapsible=t.collapsible),void 0!==t.orientation&&(s.orientation=t.orientation),void 0!==t.width&&(s.width=t.width),a._reset(),a.$.fireEvent("columnUpdate",{columnData:t,oldValue:e,value:s.label})}}addColumn(e){const t=this;e?(t.columns.push(e),t._reset(),t._createAddNewButton(),t.$.fireEvent("columnAdd",{columnData:e})):t._addNewColumnDynamically()}removeColumn(e){const t=this;let a=null,s=-1;for(let l=0;l<t.columns.length;l++)if(t.columns[l].dataField===e){a=t.columns[l],s=l;break}if(a&&t.columns.splice(s,1),t.dataSource)for(let a=0;a<t.dataSource.length;a++){const s=t.dataSource[a];if(s[t.dataSourceMap.status]===e){const e=JSON.parse(JSON.stringify(s));s[t.dataSourceMap.status]=t.columns[0].value;const a=JSON.parse(JSON.stringify(s));t.$.fireEvent("change",{task:s,id:a.id,value:a,oldValue:e}),t.$.fireEvent("taskUpdate",{id:a.id,value:a,oldValue:e})}}t._reset(),t._createAddNewButton(),t.$.fireEvent("columnRemove",{column:a})}_addNewColumnDynamically(){const e=this,t=e._dialog,a=Math.floor(9e4*Math.random()+1e4),s={label:e.localize("addNewStatus")+" "+a,dataField:"newStatus"+a,addNewButton:!0,collapsed:!1,collapsible:!0,orientation:"vertical"},l=e.$.body.querySelector(".smart-kanban-add-new-column").querySelector(".smart-kanban-add-new-column-label"),r=document.createElement("input");if(l.classList.add("pending"),l.appendChild(r),r.classList.add("smart-kanban-column-header-input"),e.columnColors){l.classList.add("colors");const t=e._getColorInput();l.appendChild(t)}function o(a){let o=r.value,i=l.querySelector("smart-color-input");i&&i.opened?e._columnAddTimer&&clearTimeout(e._columnAddTimer):(!1===/^\s*$/.test(o)?(o=o.trim(),s.label=o,s.dataField="dataField"+Math.floor(65536*(1+Math.random())).toString(16).substring(1)):""===o&&(o="",s.label="",s.dataField="dataField"+Math.floor(65536*(1+Math.random())).toString(16).substring(1)),l.classList.contains("pending")&&(e._columnAddTimer&&clearTimeout(e._columnAddTimer),e._columnAddTimer=setTimeout((()=>{if(l.classList.remove("pending"),r.parentNode&&r.parentNode.removeChild(r),i){s.color=i.value;const e=l.querySelector(".heading");if(e){const t=new Smart.Color(s.color).getInvertedColor();e.style.backgroundColor=s.color,e.style.color=t}i.remove()}e.columns.push(s),e._reset(),e._createAddNewButton(),t&&t.editPanelPopulated&&(t.editors.status.dataSource=e._allColumns.map((e=>({color:e.color,label:e.label,value:e.dataField})))),e.$.fireEvent("columnAdd",{newColumn:s}),delete e._columnAddTimer}),50),a.stopPropagation()))}r.focus(),r.onkeydown=e=>{"Escape"===e.key?(l.classList.remove("pending"),r&&r.parentElement&&(r.nextElementSibling&&"Smart-COLOR-INPUT"===r.nextElementSibling.nodeName&&r.nextElementSibling.remove(),r.parentElement.removeChild(r),e.stopPropagation(),e.preventDefault())):"Enter"===e.key&&o(e)},r.addEventListener("blur",o),r.addEventListener("change",o)}_handleColumnEditing(e){const t=this,a=t.columns.find((t=>t.dataField===e));if(t._columnEditing)return;const s=Array.from(t.$.body.getElementsByClassName("smart-kanban-column")).find((t=>t.column.dataField===e)).querySelector(".smart-kanban-column-header-label"),l=document.createElement("input");s.classList.add("pending"),s.appendChild(l);const r=a.label,o=a.color;if(l.value=a.label,l.classList.add("smart-kanban-column-header-input"),t.columnColors){s.classList.add("colors");const e=t._getColorInput();e.value=a.color||"transparent",s.appendChild(e)}function i(e){let i=l.value,n=s.querySelector("smart-color-input");if(!n||!n.opened){if(!1===/^\s*$/.test(i)?(i=i.trim(),a.label=i,s.querySelector(".smart-kanban-title").innerHTML=i.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/'/g,"&#39;").replace(/"/g,"&quot;").replace(/\\/g,"")):""===i&&(a.label="",s.querySelector(".smart-kanban-title").innerHTML="&nbsp;"),n){a.color=n.value;const e=s.querySelector(".heading");if(e){const s=new Smart.Color(a.color).getInvertedColor();t.columnColors?""===a.color?(e.style.backgroundColor="",e.style.color=""):(e.style.backgroundColor=a.color,e.style.color=s):(e.style.backgroundColor="",e.style.color="")}t.applyColumnColorToTasks&&s.closest(".smart-kanban-column").style.setProperty("--smart-primary",a.color),n.remove()}s.classList.remove("pending");try{l.parentNode&&l.parentNode.removeChild(l)}catch(e){t._error=e}t._columnEditTimer&&clearTimeout(t._columnEditTimer),t._columnEditing=!1,t._columnEditTimer=setTimeout((()=>{r===a.label&&o===a.color||t.$.fireEvent("columnUpdate",{column:a,oldValue:r,value:a.label}),delete t._columnEditTimer}),50),e.stopPropagation()}}t._columnEditing=!0,setTimeout((()=>{l.focus()}),50),l.onkeydown=e=>{if("Escape"===e.key){s.classList.remove("pending"),l.value=r;try{l.parentNode&&l.parentNode.removeChild(l)}catch(e){t._error=e}t._columnEditing=!1}else"Enter"===e.key&&i(e)},l.addEventListener("blur",i),l.addEventListener("change",i)}_validateDataSourceMap(){this.dataSourceMap=Object.assign({},{checklist:"checklist",color:"color",comments:"comments",dueDate:"dueDate",id:"id",priority:"priority",progress:"progress",startDate:"startDate",status:"status",swimlane:"swimlane",tags:"tags",text:"text",userId:"userId"},this.dataSourceMap)}});
1621
+ Smart("smart-kanban",class extends Smart.DataView{static get properties(){return{addNewButton:{value:!1,type:"boolean"},addNewButtonDisplayMode:{value:"top",allowedValues:["top","bottom","both"],type:"string"},addNewColumn:{value:!1,type:"boolean"},autoColumnHeight:{value:!1,type:"boolean"},applyColumnColorToTasks:{value:!1,type:"boolean"},addNewColumnWidth:{value:null,type:"any"},allowColumnEdit:{value:!1,type:"boolean"},allowColumnHide:{value:!0,type:"boolean"},allowColumnRemove:{value:!1,type:"boolean"},allowColumnReorder:{value:!1,type:"boolean"},allowCustomTags:{value:!0,type:"boolean"},allowDrag:{value:!0,type:"boolean",defaultReflectToAttribute:!0},allowDrop:{value:!0,type:"boolean",defaultReflectToAttribute:!0},allowDropPlaceholder:{value:!1,type:"boolean",defaultReflectToAttribute:!0},autoLoadState:{value:!1,type:"boolean"},autoSaveState:{value:!1,type:"boolean"},cardHeight:{value:null,type:"number?"},currentUser:{value:null,type:"any"},columnColorEntireSurface:{value:!1,type:"boolean"},columnFooter:{value:!1,type:"boolean"},columnActions:{value:!1,type:"boolean"},columnColors:{value:!1,type:"boolean"},columnWidth:{value:null,type:"any"},columnSummary:{value:!1,type:"boolean"},columnEditMode:{value:"headerAndMenu",allowedValues:["header","menu","headerAndMenu"],type:"string"},columnHeaderTemplate:{value:null,type:"any"},disableDialog:{value:!1,type:"boolean"},disableAddNewDialog:{value:!1,type:"boolean"},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},editable:{value:!1,type:"boolean"},editMode:{value:"doubleClick",allowedValues:["singleClick","doubleClick"],type:"string"},dragOffset:{value:"auto",type:"any"},formatStringDate:{value:"d",type:"string"},formatStringTime:{value:"MMM d, HH:mm",type:"string"},hierarchy:{value:"columns",allowedValues:["columns","tabs"],type:"string"},messages:{value:{en:{actionsIcon:"Actions icon",actionsList:"Open actions list",unassignedTask:"Unassigned task",unassigned:"unassigned",assignedTask:"Assigned to {{userName}}",addNewStatus:"New status",addNewColumn:"Add new status",addNewTask:"Add new task",addSubtask:"Add subtask",assignedTo:"Assigned to",createdBy:"Created by",updatedBy:"Updated by",createdByDate:"Created",updatedByDate:"Updated",checklist:"Sub tasks",color:"Color",commentsIcon:"Comments icon",copy:"Copy",customize:"Customize tasks",customizeColumn:"Customize column",dueDate:"Due date",days:"days",edit:"Edit",editTask:"ID: {{taskId}} {{text}}",expand:"Expand column",collapse:"Collapse column",high:"High",low:"Low",critical:"Critical",newComment:"New comment",newSubtask:"New subtask",overdue:"Overdue",average:"Average",priority:"Priority",priorityIcon:"Priority icon",progress:"Progress",promptComment:"Are you sure you want to remove this comment?",promptTask:'Are you sure you want to remove the task "{{taskText}}"?',promptColumn:"Are you sure you want to remove this column?",remove:"Remove",removeSubtask:"Remove subtask",removeColumn:"Remove column",hideColumn:"Hide column",removeComment:"Remove comment",removeTask:"Remove task",showAllColumns:"Show all columns",send:"Send",startDate:"Start date",status:"Status",swimlane:"Swimlane",tags:"Tags",text:"Name",textPlaceholder:"Write a task name",description:"Description",taskProgress:"Task progress: {{value}}%",taskDescription:"Task description: {{value}}",taskCompleted:"Tasks completed: {{value}}/{{count}}",tasksSummary:"{{summary}} tasks",tasksSummaryOne:"1 task",userId:"User ID",userIcon:"User icon",guestUser:"Guest",detailsTab:"Details",commentsTab:"Comments",fieldsTab:"Fields",historyTab:"History",subtasksTab:"Subtasks",historyEvent:"Event",historyAuthor:"Author",historyDetails:"Details",range:'From "{{oldValue}}" to "{{newValue}}"',nullRange:'Changed to "{{newValue}}"',invalidRange:'"{{start}}" should be less than "{{end}}"',historyDate:"Date",ok:"ok",cancel:"Cancel",delete:"Delete",taskDeadlineChanged:"Deadline changed",tagsChanged:"Tags changed",taskMoved:"Task moved",taskUpdated:"Task updated",taskCreated:"Task created",taskUserChanged:"Assignee changed",taskUserRemoved:"Assignee removed",taskDescriptionChanged:"Description changed",taskSubtasksChanged:"Subtasks changed",taskProgressChanged:"Progress changed",taskPriorityChanged:"Priority changed",taskSubtasksCompleted:"Completed {{value}}",taskStatusChanged:"Status changed",taskTagsChanged:"Tags changed",taskNameChanged:"Name changed",taskColorChanged:"Color changed",empty:"No tasks",emptyTags:"No tags available",emptyImage:"No image to display",emptyAttachment:"No attachment to display"}}},onColumnHeaderRender:{value:null,type:"any",reflectToAttribute:!1},onColumnFooterRender:{value:null,type:"any",reflectToAttribute:!1},onTaskRender:{value:null,type:"any",reflectToAttribute:!1},onSortPrepare:{value:null,type:"any",reflectToAttribute:!1},onFilterPrepare:{value:null,type:"any",reflectToAttribute:!1},priority:{value:[],type:"array",reflectToAttribute:!1},priorityList:{value:!0,type:"boolean"},readonly:{value:!1,type:"boolean"},selectionMode:{value:"zeroOrOne",allowedValues:["zeroOrOne","zeroOrManyExtended"],type:"string"},storeHistory:{value:!0,type:"boolean"},storeHistoryItems:{value:20,type:"number"},swimlanes:{value:[],type:"array",reflectToAttribute:!1},swimlanesFrom:{value:0,type:"number"},swimlanesTo:{value:null,type:"number?"},tags:{value:[],type:"array"},taskActions:{value:!1,type:"boolean"},taskActionsRendered:{value:null,type:"any"},taskComments:{value:!1,type:"boolean"},taskDue:{value:!1,type:"boolean"},taskPosition:{value:"all",allowedValues:["all","leaf"],type:"string"},taskPriority:{value:!0,type:"boolean",defaultReflectToAttribute:!0},taskProgress:{value:!1,type:"boolean"},taskTags:{value:!0,type:"boolean",defaultReflectToAttribute:!0},taskSubTasks:{allowedValues:["none","onePerRow","onlyUnfinished"],value:"none",type:"string"},taskSubTasksInput:{value:!0,type:"boolean"},taskUserIcon:{value:!0,type:"boolean",defaultReflectToAttribute:!0},taskCustomFields:{value:[],type:"array",reflectToAttribute:!1},taskCustomFieldsHide:{value:!1,type:"boolean"},taskColor:{value:!0,type:"boolean"},taskColorEntireSurface:{value:!1,type:"boolean"},textTemplate:{value:null,type:"any"},userList:{value:!1,type:"boolean"},users:{value:[],type:"array",reflectToAttribute:!1},dialogCustomizationFunction:{value:null,type:"any"},dialogRendered:{value:null,type:"any"},dialogEditors:{value:["checklist","color","dueDate","priority","progress","startDate","status","swimlane","tags","text","description","userId"],type:"any"}}}static get listeners(){return{"body.focusin":"_bodyFocusinHandler",keyup:"_keyupHandler","container.click":"_containerClickHandler","container.down":"_containerDownHandler","container.keydown":"_containerKeydownHandler","container.touchmove":"_scrollViewerTouchmoveHandler","container.wheel":"_mouseWheelHandler"}}template(){const e=this._tabindex;return`<div id="container" role="presentation">\n <div id="header" class="smart-data-view-header" role="toolbar">\n <div id="customizeButton" class="smart-data-view-header-button smart-data-view-customize-button smart-unselectable"${e} role="button" aria-expanded="false" aria-haspopup="dialog" aria-label="Customize tasks"><div role="presentation"></div></div>\n <div id="filterButton" class="smart-data-view-header-button smart-data-view-filter-button smart-unselectable"${e} role="button" aria-expanded="false" aria-haspopup="dialog" aria-label="Filter"><div role="presentation"></div></div>\n <div id="sortButton" class="smart-data-view-header-button smart-data-view-sort-button smart-unselectable"${e} role="button" aria-expanded="false" aria-haspopup="dialog" aria-label="Sort"><div role="presentation"></div></div>\n <div id="searchButton" class="smart-data-view-header-button smart-data-view-search-button smart-unselectable"${e} role="button" aria-expanded="false" aria-haspopup="dialog" aria-label="Search"></div>\n <div id="headerDropDown" class="smart-data-view-header-drop-down smart-visibility-hidden" role="dialog">\n <div id="customize" class="smart-hidden" role="presentation"></div>\n <div id="filter" class="smart-hidden" role="presentation"></div>\n <div id="sort" class="smart-hidden" role="presentation"></div>\n <div id="search" class="smart-data-view-search-box smart-hidden" role="presentation">\n <input type="text" id="searchInput" spellcheck="false" aria-label="Search" />\n <div id="searchLabel" class="smart-data-view-search-label smart-unselectable"></div>\n <div id="searchPrev" class="smart-data-view-search-prev"${e} role="button" aria-label="Previous"></div>\n <div id="searchNext" class="smart-data-view-search-next"${e} role="button" aria-label="Next"></div>\n <div id="searchClose" class="smart-data-view-search-close"${e} role="button" aria-label="Close search box"></div>\n </div>\n </div>\n </div>\n <smart-scroll-viewer auto-refresh vertical-scroll-bar-visibility="hidden" class="smart-kanban-scroll-viewer" id="scrollViewer">\n <div id="body" class="smart-kanban-body" role="presentation"></div>\n </smart-scroll-viewer>\n </div>`}_mouseWheelNative(e,t){const a=this;void 0===a._scrollWheelContent&&(a._scrollWheelContent=document.createElement("div"),a._scrollWheelContent.style.width="100%",a._scrollWheelContent.style.height="100%",a._scrollWheelContent.style.position="absolute",a._scrollWheelContent.style.left="0px",a._scrollWheelContent.style.top="0px",a._scrollWheelContent.style.background="white",a._scrollWheelContent.style.zIndex=9999,a._scrollWheelContent.style.opacity=0,a._scrollWheelContent.style.overflow="auto",a._scrollWheelContent.style.visibility="hidden");let s=0;const l=()=>{if(t){const t=a._scrollWheelContent.scrollLeft;a._scrollView.hScrollBar.value=t,t===e&&a._scrollWheelContent.remove()}else{const t=a._scrollWheelContent.scrollTop;a._scrollView.vScrollBar.value=t,t===e&&a._scrollWheelContent.remove()}};a._scrollWheelContent.onscroll=()=>{cancelAnimationFrame(s),s=0,s=requestAnimationFrame(l)},a._scrollWheelContentView||(a._scrollWheelContentView=document.createElement("div"),a._scrollWheelContent.appendChild(a._scrollWheelContentView)),a._scrollWheelContentView.style.width=a.offsetWidth+a._scrollView.scrollWidth+"px",a._scrollWheelContentView.style.height=a.offsetHeight+a._scrollView.scrollHeight+"px",a.$.container.appendChild(a._scrollWheelContent),a._scrollWheelContent.scrollTop=a._scrollView.vScrollBar.value,a._scrollWheelContent.scrollLeft=a._scrollView.hScrollBar.value,!0===t?a._scrollWheelContent.scrollTo({top:a._scrollView.vScrollBar.value,left:e,behavior:"smooth"}):a._scrollWheelContent.scrollTo({top:e,left:a._scrollView.hScrollBar.value,behavior:"smooth"})}_mouseWheelHandler(e){const t=this,a=e.target;if(t.disabled||a.closest(".smart-scheduler-window-modal"))return;if(t._scrollView||(t._scrollView=new Smart.Utilities.Scroll(t.$.scrollViewer,t.$.scrollViewer.$.horizontalScrollBar,t.$.scrollViewer.$.verticalScrollBar)),t._scrollView.hScrollBar.$.hasClass("smart-hidden")&&t._scrollView.vScrollBar.$.hasClass("smart-hidden"))return;if(42===e.pointerId)return;let s=!1;if(e.wheelDeltaY?120!==Math.abs(e.wheelDeltaY)&&240!==Math.abs(e.wheelDeltaY)&&360!==Math.abs(e.wheelDeltaY)&&(s=!0):0===e.deltaMode&&(s=!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 a=160;const l=0===e.deltaX?e.wheelDelta:e.deltaX;l<0&&(a=-160),Math.abs(l)>=100&&!s&&!Smart.Utilities.Core.Browser.Firefox?t._mouseWheelNative(t._scrollView.scrollLeft+a,!0):t._scrollView.scrollLeft+=l}}else{const a=t.scrollTop;if(0===a&&e.deltaY<0||a===t.scrollHeight&&e.deltaY>0)return;e.stopPropagation(),e.preventDefault();let l=450;if(e.deltaY<=0&&(l=-450),Math.abs(e.deltaY)>=100&&!s&&!Smart.Utilities.Core.Browser.Firefox)t._mouseWheelNative(t._scrollView.scrollTop+l);else{t._wheelrafId=0;const a=()=>{t._scrollView.scrollTop+=e.deltaY};cancelAnimationFrame(t._wheelrafId),t._wheelrafId=0,t._wheelrafId=requestAnimationFrame(a)}}}_keyupHandler(e){const t=this;if("Escape"===e.key&&t._dragDetails){const e=t._dragDetails,a=Smart.Kanban.hoveredKanban,s=Smart.Kanban.hoveredItem;delete t._dragDetails,delete Smart.Kanban.kanbanTaskDragged,delete Smart.Kanban.hoveredKanban,delete Smart.Kanban.hoveredItem,e.ScrollViewer&&e.ScrollViewer._scrollView&&(e.ScrollViewer._scrollView.disableSwipeScroll=!1);let l=!1;if(document.querySelectorAll(".smart-kanban-task-placeholder").forEach((e=>{e.classList.remove("smart-kanban-task-placeholder"),e.style.marginTop=e.style.marginBottom="0px",l=!0})),l&&t._refreshButtonsAndSummaries(),!e.FeedbackShown)return;a&&clearInterval(a._dragInterval),t._preventSelection=!0;const r=t.isInShadowDOM?t.getRootNode().host:document.body;return r.classList.remove("smart-dragging"),r.style.overflow=t._originalBodyOverflow.overflow,r.style.eoverflowX=t._originalBodyOverflow.overflowX,r.style.overflowY=t._originalBodyOverflow.overflowY,delete t._originalBodyOverflow,e.Feedback.remove(),e.Items.forEach((e=>e.classList.remove("dragged"))),s.classList.remove("drop-target"),void(s.classList.contains("before")?s.classList.remove("before"):s.classList.contains("after")&&s.classList.remove("after"))}}render(){const e=this;Object.defineProperty(e,"dataSource",{get:function(){return e.context===e?e.properties.dataSource.value:e._getCurrentDataSource()},set(t){e.updateProperty(e,e._properties.dataSource,t)}}),e.isInitialized=!1,e._render(),super.render(),e.isInitialized=!0}_getPriority(){const e=this;if(!e.priority||e.priority&&0===e.priority.length)e.priority=[{menuIcon:'<span style="margin-left: 0px; margin-right: 5px;" class="priority"></span>',label:"",value:""},{menuIcon:'<span style="margin-left: 0px; margin-right: 5px;" class="priority low"></span>',label:e.localize("low"),value:"low"},{menuIcon:'<span style="margin-left: 0px; margin-right: 5px;" class="priority average"></span>',label:e.localize("average"),value:"average"},{menuIcon:'<span style="margin-left: 0px; margin-right: 5px;" class="priority high"></span>',label:e.localize("high"),value:"high"},{menuIcon:'<span style="margin-left: 0px; margin-right: 5px;" class="priority critical"></span>',label:e.localize("critical"),value:"critical"}];else if(e.priority){const t=e=>{switch(e.value){case"":return'<span style="margin-left: 0px; margin-right: 5px;" class="priority"></span>';case"low":case"Low":return'<span style="margin-left: 0px; margin-right: 5px;" class="priority low"></span>';case"average":case"Average":return'<span style="margin-left: 0px; margin-right: 5px;" class="priority average"></span>';case"high":case"High":return'<span style="margin-left: 0px; margin-right: 5px;" class="priority high"></span>';case"critical":case"Critical":return'<span style="margin-left: 0px; margin-right: 5px;" class="priority critical"></span>'}let t="margin-left: 1px; margin-right: 5px;";return t+="height: 0px;",t+="width: 0px;",t+="border-left-color: transparent;",t+="border-left-style: solid;",t+="border-left-width: 7px;",t+="border-right-color: transparent;",t+="border-right-style: solid;",t+="border-right-width: 7px;","low"!==e.value?(t+="border-bottom-color: "+e.color+";"||0,t+="border-bottom-style: solid;",t+="border-bottom-width: 12px;"):(t+="border-top-color: "+e.color+";"||0,t+="border-top-style: solid;",t+="border-top-width: 12px;"),t+="border-radius: 3px;",`<span class="${e.value} priority" style="${t}"></span>`};for(let a=0;a<e.priority.length;a++){const s=e.priority[a];s.menuIcon=t(s)}}for(let t=0;t<e.priority.length;t++){const a=e.priority[t];a.menuLabel=`<div priority="${a.value}" class="smart-kanban-task-text">${a.menuIcon}${a.label}</div>`}return e.priority}_getTags(){const e=this,t=[];if(e.tags){for(let a=0;a<e.tags.length;a++){const s=e.tags[a];if("[]"!==s)if(s&&"string"==typeof s)t.push({label:s.trim(),value:s.trim()});else{const e={};if(s.label){if("[]"===s.label)continue;e.label=s.label}s.value?e.value=s.value:e.value=s.label,s.color&&(e.color=s.color),t.push(e)}}e.tags=t}}_render(){const e=this,t=getComputedStyle(e);if(e.columnColorEntireSurface?e.classList.add("smart-kanban-column-color"):e.classList.remove("smart-kanban-column-color"),e.$.body.innerHTML="",e._autoScrollCoefficient=Smart.Utilities.Core.Browser.Firefox?4:Smart.Utilities.Core.Browser.Edge?8:2,e._kanbanTaskMinWidth=parseFloat(t.getPropertyValue("--smart-kanban-task-min-width")),e._dataViewPadding=parseFloat(t.getPropertyValue("--smart-data-view-padding")),e.uiTasksByDataField=[],e.tasksByDataField=[],e.taskById=[],e._allColumns=[],e._customTags=[],e._selectedTasks=[],e._dblclickObject={numberOfClicks:0},e._appliedFiltering={filterGroups:[],filters:[],operator:"and"},e._appliedSorting={dataFields:[],dataTypes:[],orderBy:[]},e._sortPanelDataSource=[{label:e.localize("text"),dataField:"text",dataType:"string",allowFilter:!0,allowSort:!0},{label:e.localize("userId"),dataField:"userId",dataType:"string",allowFilter:!0,allowSort:!0},{label:e.localize("tags"),dataField:"tags",dataType:"string",allowFilter:!0,allowSort:!0},{label:e.localize("priority"),dataField:"priority",dataType:"string",allowFilter:!0,allowSort:!0},{label:e.localize("progress"),dataField:"progress",dataType:"number",allowFilter:!0,allowSort:!0},{label:e.localize("startDate"),dataField:"startDate",dataType:"date",allowFilter:!0,allowSort:!0},{label:e.localize("dueDate"),dataField:"dueDate",dataType:"date",allowFilter:!0,allowSort:!0}],e.taskCustomFields){const t=e.dataSource&&e.dataSource.length>0?e.dataSource[0]:null;for(let a=0;a<e.taskCustomFields.length;a++){const s=e.taskCustomFields[a].label;if(t){const l=typeof t[e.taskCustomFields[a].dataField];"number"===l?e._sortPanelDataSource.push({dataField:e.taskCustomFields[a].dataField,allowFilter:!0,allowSort:!0,label:s,dataType:"number"}):"date"===l?e._sortPanelDataSource.push({dataField:e.taskCustomFields[a].dataField,allowFilter:!0,allowSort:!0,label:s,dataType:"date"}):e._sortPanelDataSource.push({dataField:e.taskCustomFields[a].dataField,allowFilter:!0,allowSort:!0,label:s,dataType:"string"})}else e._sortPanelDataSource.push({dataField:e.taskCustomFields[a].dataField,allowFilter:!0,allowSort:!0,label:s,dataType:"string"})}}const a={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"};for(let t in a)e.dataSourceMap[t]||(e.dataSourceMap[t]=a[t]);e._getPriority(),e._getTags(),e._validateDataSourceMap(),e._getInnerElementMessages(),e._localizeHeader(),e._handleHeaderPosition(e.$.scrollViewer),e._validateSwimlanes(),e._renderColumns(),e._handleSwimlanes();let s=!1;e.autoLoadState&&(s=e.loadState()),e._getCurrentUser(),s||e._processDataSource(),e._setPriorityList(),e._setUserList(),e._setActionsList(),e._setColumnActionsList(),e._setCommentsList(),e._autoSaveState(),e._createAddNewButton(),e.$.scrollViewer.refresh()}attached(){const e=this;super.attached(),e.isCompleted&&e._dialog&&(e._addDialogHandlers(),e.getShadowRootOrBody().appendChild(e._dialog))}detached(){const e=this;if(super.detached(),!e._dialog)return;const t=e._dialog;t.removeEventListener("open",e._dialogEventHandler),t.removeEventListener("closing",e._dialogEventHandler),t.removeEventListener("close",e._dialogEventHandler),t.removeEventListener("click",e._dialogClickHandler),t.remove()}addTask(e={},t){const a=this,s=a.columns;if("object"!=typeof e||0===s.length||!a._currentUser.allowAdd)return;const l=a.dataSourceMap;void 0===e[l.status]&&(e[l.status]=s[0].dataField),a._currentUser.info&&(void 0===e[l.createdUserId]?(e[l.createdUserId]=a._currentUser.info.id,e[l.createdDate]=new Date):e[l.createdDate]||(e[l.createdDate]=new Date));const r={value:e,id:e.id};a.$.fireEvent("taskBeforeAdd",r);let o=null;return a.dataSource&&a.dataSource.virtualDataSource?a._requestVirtualDataSource("add",e,(function(e){return e})):(a.dataSource||(a.dataSource=[]),t>=0?a.dataSource.splice(t,0,e):a.dataSource.push(e),o=a._createTask(e,!0,t),a._autoSaveState("dataSource")),a.$.fireEvent("taskAdd",r),a._refreshButtonsAndSummaries(),a.virtualization&&(a._refreshColumns(),a._refreshButtonsAndSummaries()),o}addSort(e,t){const a=this,s=a.dataSource;let l;function r(e,s){const r=a._sortPanelDataSource.find((t=>t.dataField===e));if(r){let a=Array.isArray(t)?t[s]:"string"==typeof t?t:"ascending";l.dataFields.push(e),l.dataTypes.push(r.dataType),a=a&&-1!==a.indexOf("desc")?"descending":"ascending",l.orderBy.push(a)}}if(0!==arguments.length&&s&&0!==s.length){if(a.closePanel(),1===arguments.length&&"object"==typeof e)l=e;else if(l={dataFields:[],dataTypes:[],orderBy:[]},Array.isArray(e))e.forEach(r);else{if("string"!=typeof e)return;r(e,0)}super.addSort(l)}}beginEdit(e){const t=this;t.disabled||(e=t._validateTaskArgument(e))&&(t.editable||t.readonly)&&t._openDialog(e,"edit")}cancelEdit(){const e=this._dialog;e&&e.opened&&e.classList.contains("edit")&&e.close()}hide(e){const t=this;void 0!==e&&"number"==typeof e&&(e=t.columns[e]),e&&!1!==e.visible&&(e.visible=!1,t.$.fireEvent("columnHide",{column:e}),t.refresh())}show(e){const t=this;void 0!==e&&"number"==typeof e&&(e=t.columns[e]),e&&!0!==e.visible&&(e.visible=!0,t.$.fireEvent("columnShow",{column:e}),t.refresh())}showAllColumns(){const e=this;for(let t=0;t<e.columns.length;t++)e.columns[t].visible=!0;e.refresh()}collapse(e){const t=this;if(!t.collapsible)return;if(!(e=t._validateColumnArgument(e))||e.collapsed||!e.collapsible)return;const a=t._columnToElement.get(e),s=a.siblingColumns;let l=0;e.collapsed=!0,a.classList.add("collapsed");const r=e.collapsed?t.localize("expand"):t.localize("collapse"),o=a.querySelector(".smart-kanban-column-header-toggle-button");if(o&&o.setAttribute("title",r),s.forEach((e=>e.collapsed&&l++)),l===s.length){const a=0!==s.indexOf(e)?0:1,l=s[a],r=t._columnToElement.get(l);l&&(l.collapsed=!1),r&&(r.classList.remove("collapsed"),t._updateColumnWidths(s,r.parentElement))}else t._updateColumnWidths(s,a.parentElement);t._allColumns.forEach((e=>t._refreshScrollViewer(e))),t._autoSaveState("collapsed"),t._handleSwimlanes(!0),t._createAddNewButton(),t._doNotFireEvents||t.$.fireEvent("columnCollapse",{column:e})}copyTask(e){const t=this;if(!t._currentUser.allowAdd)return;if(!(e=t._validateTaskArgument(e)))return;const a=JSON.parse(JSON.stringify(e.data));a.history=[],t.dataSource&&t.dataSource.virtualDataSource?t._requestVirtualDataSource("add",a,(function(e){return t.$.fireEvent("taskAdd",{value:a}),e})):(a[t.dataSourceMap.id]=Math.floor(9e4*Math.random()+1e4),t._createTask(a,!0),t._autoSaveState("dataSource"),t.$.fireEvent("taskAdd",{value:a})),t.dataSource||(t.dataSource=[]),t.dataSource.push(a),t._refreshButtonsAndSummaries()}endEdit(){const e=this._dialog;e&&e.opened&&e.classList.contains("edit")&&(e.ok=!0,e.close())}ensureVisible(e){const t=this;if(e&&"number"==typeof e){const a=t.getTask(e);if(!a)return;const s=a[t.dataSourceMap.status],l=t.querySelector('.smart-kanban-column[data-field="'+s+'"]');if(l){const r=l.querySelector("smart-scroll-viewer");if(r){if(void 0===a.top){if(!(e=t._validateTaskArgument(e))||e.filteredOut)return;const a=e.closest("smart-scroll-viewer");if(0===a.scrollHeight)return e;const s=a.scrollTop,l=e.offsetTop;return s<=l&&s+a.offsetHeight>=l+e.offsetHeight||(a.scrollTop=l),e}a.top<r.scrollTop||a.top>r.scrollTop+r.offsetHeight?r.scrollTop=a.top:t._refreshScrollHeight(r,s)}}return}if(!(e=t._validateTaskArgument(e))||e.filteredOut)return;const a=e.closest("smart-scroll-viewer");if(0===a.scrollHeight)return e;const s=a.scrollTop,l=e.offsetTop;return s<=l&&s+a.offsetHeight>=l+e.offsetHeight||(a.scrollTop=l),e}expand(e){const t=this;if(!(e=t._validateColumnArgument(e))||!e.collapsed)return;const a=t._columnToElement.get(e);e.collapsed=!1,a.classList.remove("collapsed");const s=e.collapsed?t.localize("expand"):t.localize("collapse"),l=a.querySelector(".smart-kanban-column-header-toggle-button");l&&l.setAttribute("title",s),t._updateColumnWidths(a.siblingColumns,a.parentElement),t._allColumns.forEach((e=>t._refreshScrollViewer(e))),t._autoSaveState("collapsed"),t._handleSwimlanes(!0),t._createAddNewButton(),t.$.fireEvent("columnExpand",{column:e})}expandAll(){const e=this;e._allColumns.forEach((t=>{t.collapsed=!1,e._columnToElement.get(t).classList.remove("collapsed")})),e._allColumns.forEach((t=>e._refreshScrollViewer(t))),e._columnContainers.forEach((t=>e._updateColumnWidths(t.children,t))),e._autoSaveState("collapsed"),e._handleSwimlanes(!0)}exportData(e,t,a){const s=this,l=getComputedStyle(s),r=l.borderRightColor,o=s.swimlanes,i=new Smart.Utilities.DataExporter,n=s._getCurrentDataSource(),d=s.dataSourceMap,c=[{id:"Task ID",text:"Text",status:"Status",swimlane:"Swimlane",asignee:"Asignee",priority:"Priority",progress:"Progress",startDate:"Start date",dueDate:"Due date",subTasks:"Completed sub-tasks",tags:"Tags"}],u={},m={},p={};if(s.taskCustomFields)for(let e=0;e<s.taskCustomFields.length;e++)c[0][s.taskCustomFields[e].dataField]=s.taskCustomFields[e].label;i.style={border:"1px solid "+r,borderCollapse:"collapse",backgroundColor:l.backgroundColor,color:l.color,fontFamily:"Helvetica",header:{border:"1px solid "+r,fontWeight:"bold"},columns:{border:"1px solid "+r,progress:{format:"p0"},startDate:{format:s.formatStringDate},dueDate:{format:s.formatStringDate}},rows:{}},0===o.length&&delete c[0].swimlane;for(let e=0;e<n.length;e++){const t=n[e];let a=t[d.status],l=t[d.swimlane],r=t[d.userId],h=t[d.progress];u[a]?a=u[a]:(a=s._allColumns.find((e=>e.dataField===a)).label,u[t[d.status]]=a),null===r?r="":p[r]?r=p[r]:(r=s.users.find((e=>e.id===r)).name,p[t[d.userId]]=r),null===h?h="":h/=100;let g=t[d.tags];g&&"string"!=typeof g&&(g=g.map((e=>"string"==typeof e?e:e.label)));const f={id:t[d.id],text:t[d.text],description:t[d.description]||"",status:a,asignee:r,priority:t[d.priority]||"",progress:h,startDate:t[d.startDate]||"",dueDate:t[d.dueDate]||"",subTasks:s._getCompletedSubTasks(t[d.checklist]),tags:g};if(s.taskCustomFields)for(let e=0;e<s.taskCustomFields.length;e++)f[s.taskCustomFields[e].dataField]=`"${t[s.taskCustomFields[e].dataField]}"`.replaceAll(","," ");o.length&&(l?m[l]?l=m[l]:(l=o.find((e=>e.dataField===l)).label,m[t[d.swimlane]]=l):l="",f.swimlane=l),c.push(f),t[d.color]&&(i.style.rows[e]={backgroundColor:t[d.color]})}return i.exportData(c,e,t,a)}getState(e){const t=this,a={},s={collapsed:a,dataSource:t._getCurrentDataSource(),filtering:t._appliedFiltering,selection:{selected:t._selectedTasks,selectionStart:t._selectionStart?t._selectionStart:null},sorting:t._appliedSorting,tabs:t._selectedTabs,visibility:{taskActions:t.taskActions,taskComments:t.taskComments,taskDue:t.taskDue,taskPriority:t.taskPriority,taskProgress:t.taskProgress,taskTags:t.taskTags,taskUserIcon:t.taskUserIcon}};let l=null,r=null;t._selectionInView&&(l=t._selectionInView.closest(".smart-kanban-column").column.dataField,r=t._selectionInView.getAttribute("swimlane")),s.selection.selectionInColumn=l,s.selection.swimlane=r;const o={};for(let e in t.tasksByDataField){o[e]=[];const a=t.tasksByDataField[e];for(let t=0;t<a.length;t++)o[e].push(a[t].id)}if(s.order=o,s.columnOrder=[],t._allColumns.forEach((e=>a[e.dataField]=e.collapsed)),t.columns.forEach((e=>s.columnOrder.push(e.dataField))),e){const t={};for(let a in e){const l=e[a];s[l]&&(t[l]=s[l])}return t}return s}loadState(e,t){const a=this;if(!e&&!(e=window.localStorage.getItem("smartKanban"+a.id)))return!1;let s=!0;"string"==typeof e&&(e=JSON.parse(e,((e,t)=>t&&-1!==["startDate","dueDate","time"].indexOf(e)?new Date(t):t))),e.dataSource||(t=!1),a._doNotFireEvents=!0,a._selectedTasks=[],delete a._selectionStart,delete a._selectionInView,a.expandAll(),!1!==t&&Array.from(a.$.container.querySelectorAll("smart-scroll-viewer.smart-kanban-column-content-tasks")).forEach((e=>{e&&e.clearContent&&e.isReady&&e.clearContent()}));let l=!1;a._allColumns.forEach((t=>{e.collapsed&&e.collapsed[t.dataField]&&(a.collapse(t),l=!0)}));for(let t in e.visibility)a[t]=e.visibility[t];if(!1!==t&&(a.dataSource=e.dataSource,a.uiTasksByDataField=[],a.tasksByDataField=[],a._processDataSource()),e.filtering&&a.addFilter(a._constructFilterGroups(e.filtering),e.filtering.operator),e.sorting&&a.addSort(e.sorting),!1!==t&&a._autoSaveState(e),e.selection&&(e.selection.selected.forEach((e=>{const t=a.$.container.querySelector(`.smart-kanban-task[data-id="${e}"]`);t&&(t.setAttribute("selected",""),a._selectedTasks.push(t.data.id))})),e.selection.selectionStart&&(a._selectionStart=a.$.container.querySelector(`.smart-kanban-task[data-id="${e.selection.selectionStart}"]`)),e.selection.selectionInColumn)){const t=a._columnToElement.get(a._allColumns.find((t=>t.dataField===e.selection.selectionInColumn)));e.selection.swimlane?a._selectionInView=t.querySelector(`smart-scroll-viewer[swimlane=${e.selection.swimlane}]`):a._selectionInView=t.querySelector("smart-scroll-viewer")}if(e.tabs){const t="tabs"===a.hierarchy;a._allColumns.forEach((s=>{if(void 0!==s.selected){const l=a._columnToElement.get(s),r=-1!==e.tabs.indexOf(s.dataField);s.selected=r,t&&(l.classList.toggle("smart-hidden",!r),l.tab.classList.toggle("selected",r),l.tab.setAttribute("aria-selected",r))}}))}const r=[],o={};if(e.columnOrder){a._allColumns.forEach((e=>{o[e.dataField]=e}));for(let t=0;t<e.columnOrder.length;t++){const a=e.columnOrder[t],s=o[a];s&&r.push(s)}r&&r.length===a.columns.length&&JSON.stringify(r.map((e=>e.value)))!==JSON.stringify(a.columns.map((e=>e.value)))&&(a.columns=r,a.refresh(),s=!1)}if(e.order){let t=!1,l=[];for(let s in e.order){const l=e.order[s];let r=a._getTasksByDataField(s);if(0!==r.length)for(let e=0;e<l.length;e++){const s=l[e],o=a.taskById[s];if(o){const s=r.indexOf(o);s!==e&&s>=0?(r.splice(e,0,r.splice(s,1)[0]),t=!0):-1===s&&a._getTasksByDataField(o[a.dataSourceMap.status]).indexOf(o)}}}if(t){const e=Object.keys(a.tasksByDataField);for(let t in e)l=l.concat(a.tasksByDataField[e[t]]);Array.from(a.$.container.querySelectorAll("smart-scroll-viewer.smart-kanban-column-content-tasks")).forEach((e=>e.clearContent())),a.dataSource=l,a.uiTasksByDataField=[],a.tasksByDataField=[],a._processDataSource(),s=!1}}return a._doNotFireEvents=!1,s}moveTask(e,t){const a=this;if(a.disabled||""!==t&&!t)return;const s=a.dataSourceMap;if(!(e=a._validateTaskArgument(e))||!a._updateTaskInProgress&&e.data[s.status]===t)return;const l=a._allColumns.find((e=>e.dataField===t));function r(){const r=e.closest("smart-scroll-viewer"),o=a._columnToElement.get(l),i=e.data,n=a.getTaskScrollViewer(o,i);if(a.virtualization){const l=i,o=e.column.dataField,d=a._getTasksByDataField(o),c=d.findIndex((e=>e.id===l.id));return c>=0&&(d.splice(c,1),a._getTasksByDataField(t).push(l)),i[s.status]=t,a._refreshScrollViewer(r,!0),a._refreshScrollViewer(n,!0),e.hasAttribute("selected")&&(e.removeAttribute("selected"),a._selectedTasks=a._selectedTasks.filter((t=>t!==e.data.id)),a._autoSaveState("selection")),e.removeAttribute("focus"),void((a.shadowRoot||a.getRootNode()).activeElement===r&&a._focusTask(a._getFirstItem(r.$.content)))}i[s.status]=t,n.appendChild(e),a._dialog&&a._dialog.ok||(a.textTemplate&&a._renderTask(e),a._autoSaveState("dataSource")),a._refreshScrollViewer(r,!0),a._refreshScrollViewer(n,!0),e.hasAttribute("selected")&&(e.removeAttribute("selected"),a._selectedTasks=a._selectedTasks.filter((t=>t!==e.data.id)),a._autoSaveState("selection")),e.removeAttribute("focus"),(a.shadowRoot||a.getRootNode()).activeElement===r&&a._focusTask(a._getFirstItem(r.$.content))}l&&(a.dataSource&&a.dataSource.virtualDataSource&&!a._ignoreVirtualDataSource?a._requestVirtualDataSource("update",Object.assign({},e.data,{status:t}),(function(e){return e&&r(),e})):r())}_getCustomizeColumnPanelDataSource(){const e=this;return e._customizeColumns=[{label:e.localize("actionsIcon"),dataField:"taskActions",allowHide:!0,disableDrag:!0,visible:e.taskActions},{label:e.localize("commentsIcon"),dataField:"taskComments",allowHide:!0,disableDrag:!0,visible:e.taskComments},{label:e.localize("dueDate"),dataField:"taskDue",allowHide:!0,disableDrag:!0,visible:e.taskDue},{label:e.localize("priorityIcon"),dataField:"taskPriority",allowHide:!0,disableDrag:!0,visible:e.taskPriority},{label:e.localize("progress"),dataField:"taskProgress",allowHide:!0,disableDrag:!0,visible:e.taskProgress},{label:e.localize("tags"),dataField:"taskTags",allowHide:!0,disableDrag:!0,visible:e.taskTags},{label:e.localize("userIcon"),dataField:"taskUserIcon",allowHide:!0,disableDrag:!0,visible:e.taskUserIcon}],e._customizeColumns}openCustomizePanel(){const e=this,t=e.dataSource;if(!t||0===t.length||e.disabled||"none"===e.headerPosition)return;const a=e.$.customize,s=[{label:e.localize("actionsIcon"),dataField:"taskActions",visible:e.taskActions},{label:e.localize("commentsIcon"),dataField:"taskComments",visible:e.taskComments},{label:e.localize("dueDate"),dataField:"taskDue",visible:e.taskDue},{label:e.localize("priorityIcon"),dataField:"taskPriority",visible:e.taskPriority},{label:e.localize("progress"),dataField:"taskProgress",visible:e.taskProgress},{label:e.localize("tags"),dataField:"taskTags",visible:e.taskTags},{label:e.localize("userIcon"),dataField:"taskUserIcon",visible:e.taskUserIcon}];let l;e._closeDialog(),e.$.headerDropDown.classList.add("customize-panel"),e.$.headerDropDown.classList.remove("filter-panel","sort-panel","search-panel"),a.classList.remove("smart-hidden"),e.$.filter.classList.add("smart-hidden"),e.$.sort.classList.add("smart-hidden"),e.$.search.classList.add("smart-hidden"),e._closeSearchPanel(),e._customizePartCreated?(l=a.firstElementChild,l.set("dataSource",s),l.propertyChangedHandler("dataSource",void 0,s),l.rightToLeft=e.rightToLeft):(l=document.createElement("smart-column-panel"),l.animation=e.animation,l.dataSource=s,l.locale=e.locale,l.messages=e._innerElementMessages.columnPanel,l.rightToLeft=e.rightToLeft,l.theme=e.theme,e.$.customize.appendChild(l),l.classList.add("smart-kanban-column-panel"),e._customizePartCreated=!0),e._openHeaderDropDown(e.$.customizeButton)}_getFilterPanelDataSource(){const e=this,t=[{label:e.localize("text"),dataField:"text",dataType:"string",allowSort:!0,allowFilter:!0},{label:e.localize("userId"),dataField:"userId",dataType:"string",allowSort:!0,allowFilter:!0},{label:e.localize("tags"),dataField:"tags",dataType:"string",allowSort:!0,allowFilter:!0},{label:e.localize("priority"),dataField:"priority",dataType:"enum",allowSort:!0,allowFilter:!0,options:e._getPriority()},{label:e.localize("progress"),dataField:"progress",dataType:"number",allowSort:!0,allowFilter:!0},{label:e.localize("startDate"),dataField:"startDate",dataType:"date",allowSort:!0,allowFilter:!0},{label:e.localize("dueDate"),dataField:"dueDate",dataType:"date",allowSort:!0,allowFilter:!0}];if(e.taskCustomFields){const a=e.dataSource&&e.dataSource.length>0?e.dataSource[0]:null;for(let s=0;s<e.taskCustomFields.length;s++){const l=e.taskCustomFields[s].label;if(a){const r=typeof a[e.taskCustomFields[s].dataField];"number"===r?t.push({dataField:e.taskCustomFields[s].dataField,allowFilter:!0,allowSort:!0,label:l,dataType:"number"}):"date"===r?t.push({dataField:e.taskCustomFields[s].dataField,allowFilter:!0,allowSort:!0,label:l,dataType:"date"}):t.push({dataField:e.taskCustomFields[s].dataField,allowFilter:!0,allowSort:!0,label:l,dataType:"string"})}else t.push({dataField:e.taskCustomFields[s].dataField,allowFilter:!0,allowSort:!0,label:l,dataType:"string"})}}return e.onFilterPrepare&&e.onFilterPrepare(t),t}openFilterPanel(){const e=this,t=e._getFilterPanelDataSource();super.openFilterPanel(t,(function(t,a){"progress"===a.dataField?(t.min=0,t.max=100,t.showUnit=!0,t.unit="%"):"date"===a.dataType&&(t.formatString=e.formatStringDate)}))}_getSortPanelDataSource(){const e=this;return e.onSortPrepare&&e.onSortPrepare(this._sortPanelDataSource),this._sortPanelDataSource}openSortPanel(){const e=this,t=e._getSortPanelDataSource().map((t=>{const a=e._appliedSorting.dataFields.indexOf(t.dataField);return Object.assign({},t,{sortIndex:a,sortDirection:-1===a?"ascending":e._appliedSorting.orderBy[a]})}));super.openSortPanel(t)}removeTask(e,t){const a=this;function s(){const t=e.closest("smart-scroll-viewer"),s=e.data;if(a.virtualization||(e.remove(),a._refreshScrollViewer(t,!0)),a._autoSaveState("dataSource"),a.$.fireEvent("taskRemove",{value:s,id:e.data.id}),a.dataSource){const e=a.dataSource.findIndex?a.dataSource.findIndex((e=>e.id===s.id)):-1;if(e>-1){const t=s[a.dataSourceMap.status],l=a.tasksByDataField[t].findIndex((e=>e.id===s.id));l>=0&&a.tasksByDataField[t].splice(l,1),a.dataSource.splice(e,1)}}if(a._selectedTasks&&a._selectedTasks.indexOf(s.id)>=0){const e=a._selectedTasks.indexOf(s.id);a._selectedTasks.splice(e,1)}a._refreshSummaries(),a._refreshColumns()}a._currentUser.allowRemove&&(e=a._validateTaskArgument(e))&&(t?a._openDialog(e,"prompt"):a.dataSource&&a.dataSource.virtualDataSource?a._requestVirtualDataSource("remove",e.data,(function(e){return e&&s(),e})):s())}saveState(e){const t=this.getState(e);return window.localStorage.setItem("smartKanban"+this.id,JSON.stringify(t)),t}addHistory(e,t){const a=this;if(!e||!t)return;const s=a.dataSourceMap;a.storeHistory?(void 0!==e[s.history]&&null!==e[s.history]||(e[s.history]=[]),e[s.history].length===a.storeHistoryItems&&e[s.history].splice(0,1),Array.isArray(e[s.history])||(e[s.history]=[]),e[s.history].push(t)):e[s.history]=[]}clearHistory(e){e&&(e.history=[])}updateTask(e,t){const a=this;if(!a._currentUser.allowEdit||!t)return;if(!(e=a._validateTaskArgument(e)))return;const s=a.dataSourceMap,l=e.data;function r(){if(e.data=t,t[s.status]!==l[s.status]&&(a._updateTaskInProgress=!0,a.moveTask(e,t[s.status]),delete a._updateTaskInProgress),t[s.swimlane]!==l[s.swimlane]){const r=e.closest(".smart-kanban-column");a._hasSwimlane(r.index)?(r.querySelector(`smart-scroll-viewer[swimlane=${t[s.swimlane]}]`).appendChild(e),l[s.swimlane]&&a._refreshScrollViewer(r.querySelector(`smart-scroll-viewer[swimlane=${l[s.swimlane]}]`))):delete t[s.swimlane]}const r=()=>{if(!a._currentUser||a._currentUser&&!a._currentUser.info)return;const e=()=>({user:a._currentUser.info.id,date:t[s.updatedDate]});if(t[s.userId]!==l[s.userId]){const r=e();r.action="user";let o=!0;l[s.userId]||t[s.userId]||(o=!1),o&&(r.details={oldValue:l[s.userId],value:t[s.userId]},a.addHistory(t,r))}if(""+t[s.dueDate]!=""+l[s.dueDate]){const r=e();r.action="deadline",r.details={oldValue:l[s.dueDate]?l[s.dueDate].toLocaleDateString():"",value:t[s.dueDate]?t[s.dueDate].toLocaleDateString():""},a.addHistory(t,r)}if(""+t[s.startDate]!=""+l[s.startDate]){const r=e();r.action="deadline",r.details={oldValue:l[s.startDate]?l[s.startDate].toLocaleDateString():"",value:t[s.startDate]?t[s.startDate].toLocaleDateString():""},a.addHistory(t,r)}if(t[s.color]!==l[s.color]){const r=e();r.action="color",r.details={oldValue:l[s.color],value:t[s.color]},a.addHistory(t,r)}if(t[s.status]!==l[s.status]){const r=e();r.action="status",r.details={oldValue:l[s.status],value:t[s.status]},a.addHistory(t,r)}if(JSON.stringify(t[s.checklist])!==JSON.stringify(l[s.checklist])){const r=e();r.action="subtasks",r.details={oldValue:l[s.checklist],value:t[s.checklist]},a.addHistory(t,r)}if(parseFloat(t[s.progress])!==parseFloat(l[s.progress])){let r=!0;if(null===l[s.progress]&&0===parseFloat(t[s.progress])&&(r=!1),r){const r=e();r.action="progress";const o=l[s.progress]?l[s.progress]+"%":"0%",i=t[s.progress]?t[s.progress]+"%":"0%";o!==i&&(r.details={oldValue:o,value:i},a.addHistory(t,r))}}if(t[s.description]!==l[s.description]){const r=e();r.action="description",r.details={oldValue:l[s.description],value:t[s.description]},a.addHistory(t,r)}if(t[s.priority]!==l[s.priority]){const r=e();r.action="priority",r.details={oldValue:l[s.priority],value:t[s.priority]},a.addHistory(t,r)}if(t[s.tags]!==l[s.tags]){const r=e();r.action="tags",r.details={oldValue:l[s.tags],value:t[s.tags]},a.addHistory(t,r)}if(t[s.text]!==l[s.text]){const r=e();r.action="text",r.details={oldValue:l[s.text],value:t[s.text]},a.addHistory(t,r)}for(let s=0;s<a.taskCustomFields.length;s++){const r=a.taskCustomFields[s];let o=l[r.dataField],i=t[r.dataField];if(o!==i&&""+o!=""+i){const s=e();if(s.action=r.name?r.name:r.dataField,r.dataSource){const e=e=>{const t=r.dataSource.find((t=>t.value===e||t===e?t:void 0));return void 0!==t?t.label:""},t=t=>{if(null===t)return"";if(void 0===t||t.length){if(void 0!==t&&t.length&&"string"!=typeof t){let a=[];return t.forEach((t=>{a.push(e(t))})),a.toString()}if(t&&t.indexOf(",")>0){t=t.split(",");let a=[];return t.forEach((t=>{a.push(e(t))})),a.toString()}return t}return e(t)};i=t(i),o=t(o)}s.details={oldValue:o,value:i},a.addHistory(t,s)}}};a.textTemplate||t[s.text]!==l[s.text]||t[s.tags]!==l[s.tags]||t[s.priority]!==l[s.priority]||t[s.description]!==l[s.description]?(a._renderTask(e),r()):(r(),t[s.userId]!==l[s.userId]&&a._updateUserIcon(e),t[s.dueDate]!==l[s.dueDate]&&a._updateTaskDueDate(e),t[s.color]!==l[s.color]&&a._updateTaskColor(e),JSON.stringify(t[s.checklist])!==JSON.stringify(l[s.checklist])?(a._updateTaskChecked(e),a._updateTaskProgress(e)):parseFloat(t[s.progress])!==parseFloat(l[s.progress])&&a._updateTaskProgress(e),a._updateTaskSubtasks(e),a._updateTaskCustomFields(e));const o=a.getColumn(t.status);o&&(t.statusLabel=o.label);const i=a.getColumn(l.status);i&&(l.statusLabel=i.label);const n=JSON.parse(JSON.stringify(t)),d=JSON.parse(JSON.stringify(l));if(n.history=t.history,d.history=l.history,a.$.fireEvent("change",{task:e,id:n.id,value:n,oldValue:d}),a.virtualization){const t=e.data[s.status],l=a.tasksByDataField[t].findIndex((t=>t.id===e.data.id));if(l>=0){a.tasksByDataField[t][l]=e.data;const s=a._getTasksByDataField(t),r=s.findIndex((t=>t.id===e.data.id));r>=0&&(s[r]=e.data)}}if(a._refreshScrollViewer(e.closest("smart-scroll-viewer")),a.dataSource&&a.dataSource.findIndex){const t=a.dataSource.findIndex((t=>e.data.id===t.id));t>=0&&(a.dataSource[t]=e.data)}a._refreshSummaries(),a._updateTaskComments(e),a._autoSaveState("dataSource"),a.$.fireEvent("taskUpdate",{id:n.id,value:n,oldValue:d})}(t=Object.assign({},l,t))[s.checklist]&&0===t[s.checklist].length&&(t[s.checklist]=null),JSON.stringify(t)!==JSON.stringify(l)&&(a.dataSource&&a.dataSource.virtualDataSource?a._requestVirtualDataSource("update",t,(function(e){return e&&(a._ignoreVirtualDataSource=!0,r(),delete a._ignoreVirtualDataSource),e})):r())}_refreshSelection(){const e=this;if("zeroOrOne"===e.selectionMode){const t=e._selectionStart;e._selectedTasks.forEach((a=>{if(a!==t){const t=e.getTask(a);t&&(t.selected=!1);const s=e.querySelector('[data-id="'+a+'"]');s&&s.removeAttribute("selected")}})),e._selectedTasks=[t]}e._selectedTasks.forEach((t=>{const a=e.querySelector('[data-id="'+t+'"]');a&&a.setAttribute("selected","")})),e._refreshColumns()}propertyChangedHandler(e,t,a){const s=this,l=s._dialog;function r(){if(s.cancelEdit(),l&&l.close(),s._closeList(s._commentsList,"_commentSelectionFor"),s._getCurrentUser(),s.taskSubTasks){const e=s.querySelectorAll(".smart-kanban-task-input");s._currentUser&&!s._currentUser.allowEdit||s.disabled||!s.taskSubTasksInput?e.forEach((e=>{e.classList.add("smart-hidden")})):e.forEach((e=>{e.classList.remove("smart-hidden")}))}}switch(super.propertyChangedHandler(e,t,a),e){case"columnColorEntireSurface":a?s.classList.add("smart-kanban-column-color"):s.classList.remove("smart-kanban-column-color");break;case"columnFooter":case"addNewButton":case"addNewButtonDisplayMode":s._reset(),s._createAddNewButton();break;case"taskTags":s._reset();break;case"taskCustomFields":s._resetFields=!0,s._reset();break;case"autoColumnHeight":case"applyColumnColorToTasks":case"columnWidth":case"addNewColumn":s._reset();break;case"allowDrag":s._getCurrentUser();break;case"animation":case"theme":{let t=Array.from(s.$.container.querySelectorAll("smart-column-panel, smart-multi-column-filter-panel, smart-sort-panel"));l&&(t.push(l),t=t.concat(Array.from(l.$.footer.children)),l.editPanelPopulated&&(t=t.concat(Array.from(l.$.container.querySelectorAll(".smart-element.editor"))))),t.forEach((t=>t[e]=a)),Array.from(s.$.container.getElementsByClassName("smart-kanban-task")).forEach((e=>s._updateTaskColor(e)));break}case"autoSaveState":s._autoSaveState();break;case"collapsible":a||s.expandAll();break;case"columnSummary":s._refreshSummaries();break;case"columns":s._render(),l&&l.editPanelPopulated&&(l.editors.status.dataSource=s._allColumns.map((e=>({color:e.color,label:e.label,value:e.dataField}))));break;case"currentUser":r();break;case"dataSource":case"dataSourceMap":if("dataSourceMap"===e&&s._validateDataSourceMap(),s._customTags=[],s._selectedTasks=[],s.cancelEdit(),s.closePanel(),s._closeList(s._actionsList,"_actionSelectionFor"),s._closeList(s._columnActionsList,"_columnActionSelectionFor"),s._closeList(s._commentsList,"_commentSelectionFor"),s._closeList(s._userList,"_userSelectionFor"),s._closeList(s._priorityList,"_prioritySelectionFor"),0===s.columns.length)return s._renderColumns(),s._handleSwimlanes(),void s._processDataSource();Array.from(s.$.container.querySelectorAll("smart-scroll-viewer.smart-kanban-column-content-tasks")).forEach((e=>{e.clearContent(),e.refresh(),s._refreshScrollViewer(e,!0)})),s._processDataSource(),s.dataSource||s._refresh(),s.columnSummary&&s._refreshSummaries();break;case"disabled":s.cancelEdit(),s.closePanel(),s._closeList(s._actionsList,"_actionSelectionFor"),s._closeList(s._columnActionsList,"_columnActionSelectionFor"),s._closeList(s._commentsList,"_commentSelectionFor"),s._closeList(s._userList,"_userSelectionFor"),s._closeList(s._priorityList,"_prioritySelectionFor"),s._setFocusable();break;case"formatStringDate":Array.from(s.$.container.getElementsByClassName("smart-kanban-task")).forEach((e=>s._updateTaskDueDate(e))),l&&(l.editors.startDate.formatString=a,l.editors.dueDate.formatString=a);break;case"formatStringTime":s._closeList(s._commentsList,"_commentSelectionFor");break;case"editable":s.cancelEdit(),s._actionsList.classList.contains("edit-comment")||s._closeList(s._actionsList,"_actionSelectionFor"),s._getCurrentUser();break;case"headerPosition":s._handleHeaderPosition(s.$.body),s._allColumns.forEach((e=>s._refreshScrollViewer(e)));break;case"hierarchy":0===s.swimlanes.length&&s.columns.length!==s._allColumns.length&&s._reset();break;case"locale":case"messages":s.closePanel(),s._localizeHeader(),s._getInnerElementMessages(),s._closeList(s._actionsList,"_actionSelectionFor"),s._closeList(s._columnActionsList,"_columnActionSelectionFor"),s._closeList(s._commentsList,"_commentSelectionFor"),s._setActionsList(),s._setColumnActionsList(),s._setCommentsList(),l&&(s.cancelEdit(),l.close(),l.$.footer.firstElementChild.innerHTML=s.localize("ok"),l.$.footer.children[1].innerHTML=s.localize("cancel"),l.$.footer.children[2].innerHTML=s.localize("delete"),l.editPanelPopulated&&(l.editors.priority.dataSource=s._getPriority(),l.$.container.querySelector(".new-subtask").placeholder=s.localize("newSubtask"),l.$.container.querySelector("smart-button.add").title=s.localize("addSubtask"),Array.from(l.$.container.getElementsByClassName("editor-label")).forEach((e=>{let t=e.id.slice(s.id.length+5);t=t.slice(0,1).toLowerCase()+t.slice(1),e.innerHTML=s.localize(t)})))),s._customizePartCreated&&(s.$.customize.firstElementChild.messages=s._innerElementMessages.columnPanel,s.$.customize.firstElementChild.locale=s.locale),s._filterPartCreated&&(s.$.filter.firstElementChild.messages=s._innerElementMessages.multiColumnFilterPanel,s.$.filter.firstElementChild.locale=s.locale,s.$.filter.firstElementChild.editorPlaceholder=s.localize("filterValuePlaceholder")),s._sortPartCreated&&(s.$.sort.firstElementChild.messages=s._innerElementMessages.sortPanel,s.$.sort.firstElementChild.locale=s.locale);break;case"rightToLeft":s._reset(!0);break;case"selectionMode":"zeroOrOne"===a&&s._selectedTasks.length>1&&s._refreshSelection();break;case"swimlanes":if(s._validateSwimlanes(),JSON.stringify(s.swimlanes)===JSON.stringify(t))return;s._reset(),l&&l.editPanelPopulated&&(l.editors.swimlane.dataSource=s.swimlanes.map((e=>({label:e.label,value:e.dataField}))));break;case"swimlanesFrom":case"swimlanesTo":{const e=s.swimlanesFrom,t=s.swimlanesTo;e<0&&(s.swimlanesFrom=0),null!==t&&e>t&&(s.swimlanesFrom=t),s.swimlanes.length>0&&s._reset();break}case"taskCustomFieldsHide":case"taskProgress":case"taskSubTasksInput":case"taskSubTasks":case"taskUserIcon":case"taskComments":case"taskDue":case"taskPriority":case"tags":case"taskColor":case"taskColorEntireSurface":case"textTemplate":Array.from(s.$.container.getElementsByClassName("smart-kanban-task")).forEach((e=>s._renderTask(e))),s._allColumns.forEach((e=>s._refreshScrollViewer(e)));break;case"unfocusable":s._setFocusable();break;case"priority":s._closeList(s._priorityList,"_prioritySelectionFor"),s._setPriorityList();break;case"users":s._closeList(s._userList,"_userSelectionFor"),s._setUserList(),Array.from(s.$.container.getElementsByClassName("smart-kanban-task")).forEach((e=>s._updateUserIcon(e))),l&&l.editPanelPopulated&&(l.editors.userId.dataSource=s.users.map((e=>({label:e.name,value:e.id})))),r()}}_reset(e){const t=this,a=t.getState();t._allColumns=[],t._customTags=[],t._selectedTasks=[],t._dialog&&(t.cancelEdit(),e&&(t._dialog.remove(),delete t._dialog)),t.closePanel(),t._closeList(t._actionsList,"_actionSelectionFor"),t._closeList(t._columnActionsList,"_columnActionSelectionFor"),t._closeList(t._commentsList,"_commentSelectionFor"),t._closeList(t._userList,"_userSelectionFor"),t.$.body.innerHTML="",Array.from(t.$.container.getElementsByClassName("swimlane")).forEach((e=>e.remove())),t._renderColumns(),t._handleSwimlanes(),t._createAddNewButton(),t.loadState(a),t.$.scrollViewer.refresh()}_refresh(){const e=this;e._allColumns=[],e._customTags=[],e._selectedTasks=[],e.closePanel(),e._closeList(e._actionsList,"_actionSelectionFor"),e._closeList(e._columnActionsList,"_columnActionSelectionFor"),e._closeList(e._commentsList,"_commentSelectionFor"),e._closeList(e._userList,"_userSelectionFor"),e.$.body.innerHTML="",Array.from(e.$.container.getElementsByClassName("swimlane")).forEach((e=>e.remove())),e._renderColumns(),e._handleSwimlanes(),e._createAddNewButton(),e.$.scrollViewer.refresh()}_closeAllLists(){const e=this;e.cancelEdit(),e.closePanel(),e._closeList(e._actionsList,"_actionSelectionFor"),e._closeList(e._columnActionsList,"_columnActionSelectionFor"),e._closeList(e._commentsList,"_commentSelectionFor"),e._closeList(e._userList,"_userSelectionFor"),e._closeList(e._priorityList,"_prioritySelectionFor")}_inlineTaskAdd(e,t){const a=this;if(a._inlineEditDetails&&a._inlineEditDetails.popup.parentNode){const e=a._addToBottom;a._inlineEditDetails.addTask(),a._addToBottom=e}const s=document.createElement("div"),l={},r=a.dataSourceMap;l[r.status]=e.dataField,a._currentUser.info&&(void 0===l[r.createdUserId]?(l[r.createdUserId]=a._currentUser.info.id,l[r.createdDate]=new Date):l[r.createdDate]||(l[r.createdDate]=new Date));const o=document.createElement("div");o.style.position="relative",o.classList.add("smart-kanban-task"),s.appendChild(o);const i=t.parentElement.querySelector(".smart-kanban-column-content-tasks");if(a._addToBottom)i.appendChild(s);else{const e=i.querySelector(".smart-kanban-task");e?e.parentElement.insertBefore(s,e):i.appendChild(s)}a._refreshButtonsAndSummaries();const n=document.createElement("textarea");n.placeholder=a.localize("textPlaceholder"),n.style.position="absolute",n.style.backgroundColor="transparent",n.style.borderLeftWidth=n.style.borderTopWidth=n.style.borderRightWidth=n.style.borderBottomWidth="0px",n.style.outline="0px",n.style.left="0px",n.style.bottom="0px",n.style.width="100%",n.style.height="100%",n.style.resize="none",o.style.height="70px",o.style.marginBottom="10px";const d=()=>{a._addToBottom?i.scrollTop=i.scrollHeight:i.scrollTop=0};o.appendChild(n),d();const c=()=>{const e=a._inlineEditDetails.input,t=a._inlineEditDetails.popup;e.onchange=e.onblur=null,t.remove(),l[a.dataSourceMap.text]=e.value,a.addTask(l,a._addToBottom?-1:0)&&d(),delete a._addToBottom};n.onchange=n.onblur=e=>{c(),e.preventDefault()},n.onkeydown=e=>{"Enter"===e.key?(c(),e.preventDefault()):"Escape"===e.key&&(n.onchange=n.onblur=null,s.remove(),a._refreshButtonsAndSummaries(),d(),e.preventDefault())," "===e.key&&e.stopPropagation()},a._inlineEditDetails={popup:s,input:n,addTask:c},setTimeout((()=>{n.focus()}),50)}_containerClickHandler(e){const t=this,a=t.isInShadowDOM||t.shadowRoot?e.composedPath()[0]:e.target;if(t.$.header.contains(a))return void t._headerClickHandler(a,t.$.body);const s=a.closest(".smart-kanban-column-header");if(s){const l=s.parentElement.column;if(a instanceof HTMLInputElement)return;if(t.columnActions&&a.classList.contains("smart-kanban-column-actions")){if(!t._columnActionsList.parentElement||t._columnActionsList.classList.contains("smart-visibility-hidden")){if(t._columnActionsListDate&&new Date-t._columnActionsListDate<300)return;t._openColumnActionsList(a,l)}return}if(a.closest(".smart-kanban-column-header-add")&&l)return void(t.disableAddNewDialog?t._inlineTaskAdd(l,s,e):t._openDialog(l,"add","column"));if(t.collapsible&&l&&l.collapsible&&a.closest(".smart-kanban-column-header-toggle-button"))return void t[l.collapsed?"expand":"collapse"](l)}const l=a.closest(".smart-kanban-tab");if(l){if(l.classList.contains("selected"))return;const e=l.parentElement.querySelector(".selected");return e.classList.remove("selected"),e.setAttribute("aria-selected",!1),e.columnElement.classList.add("smart-hidden"),e.columnElement.column.selected=!1,l.classList.add("selected"),l.setAttribute("aria-selected",!0),l.columnElement.classList.remove("smart-hidden"),l.columnElement.column.selected=!0,t._selectedTabs=t._allColumns.filter((e=>e.selected)).map((e=>e.dataField)),t._autoSaveState("tabs"),void t._allColumns.forEach((e=>t._refreshScrollViewer(e)))}if(t.addNewColumn){const e=a.closest(".smart-kanban-add-new-column"),s=a.closest(".smart-color-input"),l=a.closest(".smart-kanban-column-header");if(!s&&e&&!e.querySelector(".pending")&&l)return void t._addNewColumnDynamically()}const r=a.closest(".smart-kanban-list .item");if(r){const e=r.getAttribute("data-id"),a=t._userSelectionFor,s=t._prioritySelectionFor;if(a){const s=t.dataSourceMap,l=a.data[s.userId],r=JSON.parse(JSON.stringify(a.data));if(parseInt(a.data[s.userId])===parseInt(e)?a.data[s.userId]=null:a.data[s.userId]=e,t._updateUserIcon(a),t._closeList(t._userList,"_userSelectionFor"),a.data[s.userId]!==l){t.dataSource&&t.dataSource.virtualDataSource&&t._requestVirtualDataSource("update",a.data,(function(e){return e||(a.data[s.userId]=l,t._updateUserIcon(a)),e}));const e=a.data;if(t._currentUser.info){a.data[s.updatedUserId]=t._currentUser.info.id,a.data[s.updatedDate]=new Date;const l={user:t._currentUser.info.id,label:e[s.text],date:e[s.updatedDate]};e[s.userId]!==r[s.userId]&&(l.action="user",l.details={oldValue:r[s.userId],value:e[s.userId]},t.addHistory(e,l))}const o=JSON.parse(JSON.stringify(e));t.$.fireEvent("change",{task:a,id:o.id,value:o,oldValue:r}),t.$.fireEvent("taskUpdate",{id:o.id,value:o,oldValue:r}),t._autoSaveState("dataSource")}return}if(s){const e=t.dataSourceMap,a=s.data[e.priority],l=JSON.parse(JSON.stringify(s.data));if(s.data[e.priority]=r.getAttribute("priority"),t._closeList(t._priorityList,"_prioritySelectionFor"),s.data[e.priority]!==a){t._currentUser.info&&(s.data[e.updatedUserId]=t._currentUser.info.id,s.data[e.updatedDate]=new Date);const a=s.data,r=JSON.parse(JSON.stringify(a));if(t._currentUser.info){s.data[e.updatedUserId]=t._currentUser.info.id,s.data[e.updatedDate]=new Date;const r={user:t._currentUser.info.id,date:a[e.updatedDate]};a[e.priority]!==l[e.priority]&&(r.action="priority",r.details={oldValue:l[e.priority],value:a[e.priority]},t.addHistory(a,r))}t.$.fireEvent("change",{task:s,id:r.id,value:r,oldValue:l}),t.$.fireEvent("taskUpdate",{id:r.id,value:r,oldValue:l}),t._updateTaskPriority(s),t._autoSaveState("dataSource")}}const l=t._actionSelectionFor,o=t._columnActionSelectionFor;if(l){switch(parseFloat(e)){case 0:r.hasAttribute("edit")&&(t._actionsList.classList.contains("edit-comment")?(t._commentsList.textarea.value=l.comment.text,t._commentsList.textarea.focus(),t._commentsList.editing=l,l.parentElement.scrollTop=l.offsetTop):t.beginEdit(l));break;case 1:r.hasAttribute("copy")&&t.copyTask(l);break;case 2:r.hasAttribute("remove")&&(t._actionsList.classList.contains("edit-comment")?t._openDialog(l,"prompt","comment"):t.removeTask(l,!0))}return void t._closeList(t._actionsList,"_actionSelectionFor")}if(o){switch(parseFloat(e)){case 0:t._handleColumnEditing(o.dataField);break;case 1:{const e=t._columnToElement.get(o).querySelector(".smart-kanban-column-header-add");e?e.click():t._openDialog(o,"add","column");break}case 2:t.collapse(o);break;case 3:t._openDialog(o,"prompt","column");break;case 4:t.hide(o);break;case 5:t.showAllColumns()}return void t._closeList(t._columnActionsList,"columnActionSelectionFor")}}if(a.closest(".smart-kanban-list.comments")){const e=a.closest(".send");if(e){if(e.disabled)return;const a=JSON.parse(JSON.stringify(t._commentSelectionFor.data)),s=t._createComment();t._commentsList.textarea.value="",e.disabled=!0;const l=JSON.parse(JSON.stringify(t._commentSelectionFor.data));t.$.fireEvent("change",{task:t._commentSelectionFor,id:l.id,value:l,oldValue:a}),t.$.fireEvent("taskUpdate",{id:l.id,value:l,oldValue:a}),t.$.fireEvent("commentAdd",{id:l.id,value:s})}else if(a.classList.contains("remove-button")&&a.classList.contains("enabled")){const e=a.closest(".smart-comment");t._actionSelectionFor&&(t._actionSelectionFor===e||t._actionSelectionFor.classList.contains("smart-kanban-task")||t._actionsList.parentElement&&!t._actionsList.classList.contains("smart-visibility-hidden"))||t._openActionsList(a,void 0,e)}return}const o=a.closest(".smart-kanban-task");if(o)if(a.classList.contains("smart-kanban-task-user"))!t.userList||!t._currentUser.allowEdit||t._userSelectionFor&&(t._userSelectionFor===o||t._userList.parentElement&&!t._userList.classList.contains("smart-visibility-hidden"))||t._openUserList(a,o);else if(a.classList.contains("priority")&&t.priorityList)!t._priorityList||!t._currentUser.allowEdit||t._prioritySelectionFor&&(t._prioritySelectionFor===o||t._priorityList.parentElement&&!t._priorityList.classList.contains("smart-visibility-hidden"))||t._openPriorityList(a,o);else if(t.taskActions&&a.classList.contains("smart-kanban-task-actions"))t._actionSelectionFor&&(t._actionSelectionFor===o||t._actionSelectionFor.classList.contains("comment")||t._actionsList.parentElement&&!t._actionsList.classList.contains("smart-visibility-hidden"))||t._openActionsList(a,o);else if(t.taskComments&&a.classList.contains("smart-kanban-task-comments"))t.users.length>0&&(!t._commentSelectionFor||t._commentSelectionFor!==o&&(!t._commentsList.parentElement||t._commentsList.classList.contains("smart-visibility-hidden")))&&t._openCommentsList(a,o);else if((!t.taskSubTasksInput||!a.classList.contains("smart-kanban-task-input"))&&(!t.taskSubTasksInput||!a.classList.contains("smart-kanban-task-subtasks")||"singleClick"!==t.editMode)&&(!o||o.data)&&(t.$.fireEvent("taskClick",{id:o.data.id,value:o.data,element:o}),t._preventSelection||t._selectTask(e,o),"singleClick"!==t.editMode||t._dragDetails||"INPUT"===a.nodeName||"TEXTAREA"===a.nodeName||a.classList.contains("smart-kanban-task-subtasks-container")||"IMG"===a.nodeName||t.beginEdit(o),e.type))if(clearTimeout(t._dblclickObject.timeout),t._dblclickObject.numberOfClicks++,2===t._dblclickObject.numberOfClicks){if(t._dblclickObject.numberOfClicks=0,o.hasAttribute("selected")||t._selectTask(e,o),t.$.fireEvent("taskDoubleClick",{id:o.data.id,value:o.data,element:o}).defaultPrevented)return;"doubleClick"===t.editMode&&t.beginEdit(o)}else t._dblclickObject.timeout=setTimeout((function(){t._dblclickObject.numberOfClicks=0}),300)}_selectTask(e,t){const a=this,s=a.selectionMode,l=()=>{a._selectedTasks.forEach((e=>{if(e!==t.data.id){const t=a.querySelector('[data-id="'+e+'"]');t&&t.removeAttribute("selected")}}))};function r(){l(),t.hasAttribute("selected")||(t.setAttribute("selected",""),a._selectedTasks=[t.data.id]),a._selectionStart=t.data.id,a._selectionInView=t.closest("smart-scroll-viewer"),a._autoSaveState("selection"),a._focusTask(t)}if("zeroOrOne"===s)l(),t.hasAttribute("selected")?(a._focusTask(t),t.removeAttribute("selected"),a._selectedTasks=[],delete a._selectionInView):(t.setAttribute("selected",""),a._selectedTasks=[t.data.id],a._selectionStart=t.data.id,a._selectionInView=t.closest("smart-scroll-viewer"),a._focusTask(t)),a.virtualization&&a._refreshColumns();else{if(!e.ctrlKey&&!e.shiftKey&&!e.metaKey||0===a._selectedTasks.length||t.closest("smart-scroll-viewer")!==a._selectionInView)return void r();if(e.ctrlKey||e.metaKey)t.hasAttribute("selected")?(t.removeAttribute("selected"),a._selectedTasks=a._selectedTasks.filter((e=>e!==t.data.id))):(t.setAttribute("selected",""),a._selectedTasks.push(t.data.id),a._selectionStart=t.data.id);else if(e.shiftKey){if(t&&t.id===a._selectionStart)return a._selectedTasks.length>1&&r(),void(a.virtualization&&a._refreshColumns());const e=t[a.dataSourceMap.status],s=a._getTasksByDataField(e),l=a.getTask(a._selectionStart);let o=s.indexOf(l),i=s.indexOf(t.id);const n=o;o=Math.min(o,i),i=Math.max(n,i),a._selectedTasks=[],s.forEach(((e,t)=>{const s=a.querySelector('[data-id="'+e.id+'"]');t>=o&&t<=i&&!e.filteredOut?(s&&s.setAttribute("selected",""),a._selectedTasks.push(e.id)):s&&s.removeAttribute("selected")}))}a._focusTask(t)}a.virtualization&&a._refreshColumns(),a._autoSaveState("selection")}_processDataSource(){const e=this;let t=e.dataSource;if(0!==e.columns.length&&null!=t){if(t instanceof Smart.DataAdapter){if(t.virtualDataSource)return void e._requestVirtualDataSource("dataBind");t=t.dataSource}t.length>500&&(e.virtualization=!0),t.forEach((t=>{e._createTask(t)})),e.virtualization&&(e._measureCardHeight(),e._refreshColumns()),e.whenRendered((()=>e._allColumns.forEach((t=>e._refreshScrollViewer(t)))))}}_requestVirtualDataSource(e,t,a){const s=this,l=s.dataSourceMap,r=[],o=[],i={},n=s._appliedFiltering;let d=null;if(n&&n.filterGroups.length>0&&(n.filterGroups.forEach((e=>o[e[0]]=e[1])),o.length=n.filterGroups.length,d=n.operator),s._appliedSorting&&s._appliedSorting.dataFields.length>0&&(s._appliedSorting.dataFields.forEach(((e,t)=>{let a=s._appliedSorting.orderBy[t].replace("ending","");r[e]={sortOrder:a,sortIndex:t}})),r.length=s._appliedSorting.dataFields.length),void 0!==t){const e=Object.assign({},t);e[l.checklist]=JSON.stringify(e[l.checklist]),e[l.history]=JSON.stringify(e[l.history],(function(e,t){return"date"===e?new Date(t).toISOString().slice(0,19).replace("T"," "):t})),e[l.comments]=JSON.stringify(e[l.comments],(function(e,t){return"time"===e?new Date(t).toISOString().slice(0,19).replace("T"," "):t})),e[l.updatedDate]&&(e[l.updatedDate]=e[l.updatedDate].toISOString().slice(0,10)),e[l.createdDate]&&(e[l.createdDate]=e[l.createdDate].toISOString().slice(0,10)),e[l.dueDate]&&(e[l.dueDate]=e[l.dueDate].toISOString().slice(0,10)),e[l.startDate]&&(e[l.startDate]=e[l.startDate].toISOString().slice(0,10)),i.row=e}s.dataSource.onVirtualDataSourceRequested((function(t){let l=!0;-1!==["add","update","remove"].indexOf(e)&&a&&(l=a(t.result),"add"!==e)||l&&(Array.from(s.$.container.querySelectorAll("smart-scroll-viewer.smart-kanban-column-content-tasks")).forEach((e=>e.clearContent())),s.dataSource.dataSource.forEach((e=>{s._createTask(e)})),s._allColumns.forEach((e=>s._refreshScrollViewer(e))),s._autoSaveState("dataSource"))}),{first:0,last:0,sorting:r,filtering:o,filterOperator:d,grouping:[],edit:i,action:e})}_setUserList(){const e=this,t=document.createElement("div");t.id=e.id+"UserList",t.className="smart-kanban-list users smart-visibility-hidden",t.setAttribute("role","listbox"),e.disabled||e.unfocusable||(t.tabIndex=0),e.users.forEach((e=>{const a=document.createElement("div"),s=e?e.image:null,l=s?`background-image: url('${s}');`:"";a.className="item",a.innerHTML=`<div class="icon" style="${l}"></div><div class="name">${e.name}</div>`,a.setAttribute("data-id",e.id),a.setAttribute("role","option"),t.appendChild(a)})),e._userList=t}_setPriorityList(){const e=this,t=document.createElement("div");t.id=e.id+"PriorityList",t.className="smart-kanban-list priority smart-visibility-hidden",t.setAttribute("role","listbox"),e.disabled||e.unfocusable||(t.tabIndex=0),e._getPriority().forEach((e=>{const a=document.createElement("div");a.className="item",e.menuLabel?a.innerHTML=e.menuLabel:a.innerHTML=`<div priority="${e.value}" class="smart-kanban-task-text">${e.menuIcon}${e.label}</div>`,a.setAttribute("priority",e.value),a.setAttribute("role","option"),t.appendChild(a)})),e._priorityList=t;const a=e._dialog;a&&a.editPanelPopulated&&(a.editors.priority.dataSource=e._getPriority())}_openList(e,t,a){const s=this,l=e.getBoundingClientRect();let r,o,i=l.left,n=l.top+e.offsetHeight;a=s.rightToLeft?!a:a,1===window.devicePixelRatio?(r=document.documentElement.clientWidth,o=document.documentElement.clientHeight):(r=window.innerWidth,o=window.innerHeight),t.classList.add("dialog"),document.body.appendChild(t),a&&(i=l.right-t.offsetWidth),i+t.offsetWidth>r&&(i=r-t.offsetWidth),n+t.offsetHeight>o&&(n=o-t.offsetHeight),t.style.left=Math.max(0,i)+"px",t.style.top=n+"px",t.classList.remove("smart-visibility-hidden"),e.setAttribute("aria-expanded",!0),e.setAttribute("aria-controls",t.id),s.unfocusable||requestAnimationFrame((function e(){0===t.getBoundingClientRect().height?requestAnimationFrame(e):t.focus()})),t.openedFrom=e,t.onclick=e=>{s._containerClickHandler(e)}}_openUserList(e,t){const a=this;if(0===a.users.length)return;const s=t.data[a.dataSourceMap.userId],l=a._userList,r=l.querySelector(".selected");if(r&&(r.classList.remove("selected"),r.removeAttribute("aria-selected")),a._openList(e,l),null!==s){const e=Array.from(l.children).find((e=>e.getAttribute("data-id")===s.toString()));e&&(e.classList.add("selected"),e.setAttribute("aria-selected",!0),l.scrollTop=e.offsetTop)}a._userSelectionFor=t}_openPriorityList(e,t){const a=this,s=t.data[a.dataSourceMap.priority],l=a._priorityList,r=l.querySelector(".selected");if(r&&(r.classList.remove("selected"),r.removeAttribute("aria-selected")),a._openList(e,l),null!=s){const e=Array.from(l.children).find((e=>e.getAttribute("priority")===s.toString()));e&&(e.classList.add("selected"),e.setAttribute("aria-selected",!0),l.scrollTop=e.offsetTop)}a._prioritySelectionFor=t}_closeList(e,t){const a=this;if(!e||!e.parentElement)return;const s=a.$.container.querySelector(`[aria-expanded="true"][aria-controls="${e.id}"]`);e.classList.add("smart-visibility-hidden"),requestAnimationFrame((function s(){e.classList.contains("smart-visibility-hidden")&&(e.getBoundingClientRect().height>0?requestAnimationFrame(s):(e.remove(),delete e.openedFrom,delete a[t]))})),s&&(s.removeAttribute("aria-expanded"),s.removeAttribute("aria-controls"))}_setActionsList(){const e=this,t=document.createElement("div");if(t.id=e.id+"ActionsList",t.className="smart-kanban-list actions smart-visibility-hidden",t.setAttribute("role","menu"),e.disabled||e.unfocusable||(t.tabIndex=0),t.innerHTML=`<div class="item" edit data-id="0" role="menuitem"><div class="name">${e.localize("edit")}</div></div>\n<div class="item" copy data-id="1" role="menuitem"><div class="name">${e.localize("copy")}</div></div>\n<div class="item" remove data-id="2" role="menuitem"><div class="name">${e.localize("remove")}</div></div>`,e.taskActionsRendered){e.taskActionsRendered(t);const a=Array.from(t.children);for(let e=0;e<a.length;e++){const t=a[e];t.classList.add("item"),t.setAttribute("data-id",e),t.setAttribute("role","menuitem"),t.firstElementChild&&t.firstElementChild.classList.add("name")}}e._actionsList=t}_setColumnActionsList(){const e=this,t=document.createElement("div");t.id=e.id+"ColumnActionsList",t.className="smart-kanban-list actions smart-visibility-hidden",t.setAttribute("role","menu"),e.disabled||e.unfocusable||(t.tabIndex=0),t.innerHTML=`<div class="item" data-id="0" role="menuitem"><div class="name">${e.localize("edit")}</div></div>\n <div class="item" data-id="1" role="menuitem"><div class="name">${e.localize("addNewTask")}</div></div>\n <div class="item" data-id="2" role="menuitem"><div class="name">${e.localize("collapse")}</div></div>\n <div class="item" data-id="3" role="menuitem"><div class="name">${e.localize("removeColumn")}</div></div>\n <div class="item" data-id="4" role="menuitem"><div class="name">${e.localize("hideColumn")}</div></div>\n <div class="item" data-id="5" role="menuitem"><div class="name">${e.localize("showAllColumns")}</div></div>`,e._columnActionsList=t}_openActionsList(e,t,a){const s=this,l=s._currentUser,r=s._actionsList;s._openList(e,r,a),r.classList.toggle("edit-comment",!!a),s._actionSelectionFor=t||a,r.children[0]&&r.children[0].hasAttribute("edit")&&(t&&!l.allowEdit?r.children[0].classList.add("smart-hidden"):r.children[0].classList.remove("smart-hidden")),r.children[1]&&r.children[1].hasAttribute("add")&&(t&&!l.allowAdd?r.children[1].classList.add("smart-hidden"):r.children[1].classList.remove("smart-hidden")),r.children[2]&&r.children[0].hasAttribute("remove")&&(t&&!l.allowRemove?r.children[2].classList.add("smart-hidden"):r.children[2].classList.remove("smart-hidden")),Array.from(r.children).forEach((e=>e.classList.remove("selected")))}_openColumnActionsList(e,t){const a=this,s=a._columnActionsList,l=s.children;a.allowColumnEdit&&t.editable&&"header"!==a.columnEditMode?l[0].classList.remove("smart-hidden"):l[0].classList.add("smart-hidden"),a.addNewButton&&t.addNewButton?l[1].classList.remove("smart-hidden"):l[1].classList.add("smart-hidden"),a.allowColumnRemove&&t.allowRemove&&a._allColumns.length>1?l[3].classList.remove("smart-hidden"):l[3].classList.add("smart-hidden"),a.collapsible&&t.collapsible?l[2].classList.remove("smart-hidden"):l[2].classList.add("smart-hidden"),a.allowColumnHide&&t.allowHide&&a._allColumns.length>1?(l[4].classList.remove("smart-hidden"),l[5].classList.remove("smart-hidden")):(l[4].classList.add("smart-hidden"),l[5].classList.add("smart-hidden")),a._openList(e,s),a._columnActionSelectionFor=t,Array.from(s.children).forEach((e=>e.classList.remove("selected")))}_setCommentsList(){const e=this,t=document.createElement("div");t.id=e.id+"CommentsList",t.className="smart-kanban-list comments smart-visibility-hidden",t.setAttribute("role","dialog"),e.disabled||e.unfocusable||(t.tabIndex=0),t.innerHTML=`<div class="smart-kanban-comments" role="list"></div>\n<div class="smart-kanban-new-comment" role="presentation">\n <textarea placeholder="${e.localize("newComment")}"></textarea>\n <smart-button class="send primary" disabled${e._rtlAttr}>${e.localize("send")}</smart-button>\n</div>`;const a=t.querySelector("textarea"),s=t.querySelector("smart-button");s.tabIndex=0,a.onfocus=()=>{t.classList.add("expanded"),s.disabled=""===a.value},a.onblur=e=>{s.contains(e.relatedTarget)||t.classList.remove("expanded")},a.onkeyup=()=>{s.disabled=""===a.value},a.oncut=()=>{s.disabled=""===a.value},a.onpaste=()=>{s.disabled=""===a.value},t.textarea=a,t.button=s,e._commentsList=t}_openCommentsList(e,t){const a=this,s=a._commentsList;s.classList.remove("expanded"),s.firstElementChild.innerHTML="",s.textarea.value="",s.textarea.disabled=!a._currentUser.allowComment,a.unfocusable?s.textarea.tabIndex=-1:s.textarea.removeAttribute("tabindex"),delete s.editing,t.data[a.dataSourceMap.comments].forEach((e=>a._createComment(e))),a._openList(e,s),a._commentSelectionFor=t}_getCommentsList(e){const t=this,a=t._commentsList;return a.classList.remove("expanded"),a.firstElementChild.innerHTML="",a.textarea.value="",a.textarea.disabled=!t._currentUser.allowComment,t.unfocusable?a.textarea.tabIndex=-1:a.textarea.removeAttribute("tabindex"),delete a.editing,e.data[t.dataSourceMap.comments].forEach((e=>t._createComment(e))),t._commentSelectionFor=e,a.classList.remove("smart-visibility-hidden"),a}_createComment(e){const t=this,a=document.createElement("div");let s,l;function r(){const r=t._commentsList.firstElementChild,o=l?l.image:null,i=l?l.name||l.id:t.localize("guestUser"),n=l?l.name:t.localize("guestUser");a.classList="smart-comment",a.setAttribute("role","listitem");const d=o?`background-image: url('${o}');`:"";a.innerHTML=`<div class="comment-indent" role="presentation">\n <div class="user-icon" style="${d}" 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">${n}</div>\n <div class="time" aria-label="Comment time">${e.time?new Smart.Utilities.DateTime(e.time).toString(t.formatStringTime):""}</div>\n <div class="remove-button${t._currentUser&&t._currentUser.info&&l.id===t._currentUser.info.id&&t._currentUser.allowComment?" enabled":""}"${t._tabindex} role="button" aria-haspopup="menu" aria-label="Comment settings"></div>\n </div>\n <div class="comment-body" aria-label="Comment text">${e.text||""}</div >\n</div>`,a.comment=e,o||a.querySelector(".user-icon").classList.add("empty"),r.appendChild(a),s&&(r.scrollTop=r.scrollHeight-r.offsetHeight)}if(e)l=t.users.find((t=>t.id===e.userId));else{const a=t.dataSourceMap,o=t.dataSource&&t.dataSource.virtualDataSource,i=t._commentsList.textarea.value.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/'/g,"&#39;").replace(/"/g,"&quot;").replace(/\\/g,""),n=t._commentsList.editing,d=t._commentSelectionFor.data,c=JSON.parse(JSON.stringify(d));if(n){if(o){const e=Object.assign({},d);e[a.comments]=e[a.comments].slice(0),e[a.comments][e[a.comments].indexOf(n.comment)]=Object.assign({},n.comment,{text:i}),t._requestVirtualDataSource("update",e,(function(a){return a&&(t._commentSelectionFor.data=e,n.querySelector(".comment-body").innerHTML=i),delete t._commentsList.editing,a}))}else n.querySelector(".comment-body").innerHTML=i,n.comment.text=i,delete t._commentsList.editing;return t.$.fireEvent("commentUpdate",{id:d.id,value:n.comment}),t.$.fireEvent("taskUpdate",{id:d.id,value:d,oldValue:c}),void t.$.fireEvent("change",{task:t._commentSelectionFor,id:d.id,value:d,oldValue:c})}if(s=!0,e={text:i,id:function(){const e=function(){return(65536*(1+Math.random())|0).toString(16).substring(1)};return e()+e()}(),userId:t._currentUser&&t._currentUser.info?t._currentUser.info.id:-1,time:new Date},l=t._currentUser?t._currentUser.info:null,o){const s=Object.assign({},d);s[a.comments]=s[a.comments].slice(0),s[a.comments].push(e),t._requestVirtualDataSource("update",s,(function(e){return e&&(t._commentSelectionFor.data=s,t._commentSelectionFor.querySelector(".smart-kanban-task-comments").setAttribute("num",s[a.comments].length||""),r()),e}))}else d[a.comments].push(e),t._commentSelectionFor.querySelector(".smart-kanban-task-comments").setAttribute("num",d[a.comments].length||"")}return e.time instanceof Date==0&&(e.time=new Date(e.time),e.time.setTime(e.time.getTime()-1*e.time.getTimezoneOffset()*60*1e3)),r(),e}_getTaskIndexByPosition(e,t){const a=(e,t)=>{const a=e.top,s=e.top+e.height,l=a<=t&&s>t;return 0!==e.height&&l};return(t=>{let s=0,l=t.length-1;if(e<=0)return 0;const r=t[t.length-1];if(-1!==r.top&&r.top<=e)return t.length-1;for(;;){const r=Math.floor((s+l)/2),o=t[r];if(a(o,e))return r;o.top<e?s=r+1:o.top>e?l=r-1:s=r+1}})(t)}_refreshColumns(){const e=this;e.virtualization&&e._allColumns.forEach((t=>{e._refreshColumn(t.dataField)}))}_refreshColumn(e){const t=this.getColumn(e),a=this._columnToElement.get(t);if(!a)return;const s=a.querySelector("smart-scroll-viewer");this._refreshScrollHeight(s,e)}_getTasksByDataField(e){const t=this;let a=t.tasksByDataField[e];return a?a._filtered?a._filtered:a._sorted?a._sorted:a:(t.tasksByDataField[e]=[],t.tasksByDataField[e])}_refreshEmptyColumnState(e,t){const a=this;e&&(e.querySelector(".smart-kanban-task")||e.querySelector(".smart-kanban-task")&&!t?(e.removeAttribute("empty",a.localize("empty")),e.classList.remove("empty")):(e.setAttribute("empty",a.localize("empty")),e.classList.add("empty")))}_refreshScrollHeight(e,t){const a=this;if(a._refreshEmptyColumnState(e,t),!a.virtualization)return;const s=a._getTasksByDataField(t);if(!s)return;const l=a._autoCardHeight?a._autoCardHeight:a.cardHeight;e.scrollHeight=e.virtualScrollHeight=s.length*l-e.offsetHeight;for(let e=0;e<s.length;e++){const t=s[e];t.top=e*l,t.height=l}const r=e.querySelector(".smart-scroll-viewer-content-container"),o=e=>{const l=a._getTaskIndexByPosition(e,s),o=a.uiTasksByDataField[t].length;for(let e=0;e<o;e++){const o=s[l+e],i=a.uiTasksByDataField[t][e];i&&(a._dragDetails&&(i.classList.remove("dragged"),o&&a._dragDetails.ItemsData.forEach((e=>{e.id===o.id&&i.classList.add("dragged")}))),o?i.classList.remove("smart-hidden"):i.classList.add("smart-hidden"),0===e&&(r.style.marginTop=o?o.top+"px":"0px"),o)&&(i.hasAttribute("selected")&&i.removeAttribute("selected"),i.hasAttribute("focus")&&i.removeAttribute("focus"),JSON.stringify(o)!==JSON.stringify(i.data)&&(i.data=o,a._renderTask(i)),a._selectedTasks&&a._selectedTasks.indexOf(o.id)>=0&&i.setAttribute("selected",""),a._focusedTask===o.id&&i.setAttribute("focus",""))}};e.onVerticalChange=e=>{const t=e.detail.value;o(t)},a.uiTasksByDataField[t]||(a.uiTasksByDataField[t]=[]);const i=Math.round(e.offsetHeight/l)+2,n=a.uiTasksByDataField[t].length;if(0===n||n<i){const r=Math.round(e.offsetHeight/l)+2;for(let e=0;e<r;e++){const l=s[e];if(!l)continue;const r=a._createVirtualTask(l);a.uiTasksByDataField[t].push(r)}e.refresh(),e.scrollHeight=e.virtualScrollHeight=s.length*l-e.offsetHeight,o(e.scrollTop)}else o(e.scrollTop)}_createVirtualTask(e,t){const a=this,s=a.dataSourceMap,l=a._allColumns.find((t=>t.dataField===e[s.status]));if(!l)return;const r=document.createElement("div"),o=a._columnToElement.get(l),i=a.getTaskScrollViewer(o,e);return void 0===e[s.id]&&(e[s.id]=Math.floor(9e4*Math.random()+1e4)),r.className="smart-kanban-task smart-unselectable",r.setAttribute("role","listitem"),r.setAttribute("data-id",e[s.id]),a._currentUser.info&&(void 0===e[s.createdUserId]?(e[s.createdUserId]=a._currentUser.info.id,e[s.createdDate]=new Date):e[s.createdDate]||(e[s.createdDate]=new Date),e[s.history]=[],a.addHistory(e,{action:"created",user:a._currentUser.info.id,details:{value:e[s.text]},date:e[s.createdDate]})),r.data=e,r.column=l,a._renderTask(r),e.class&&"string"==typeof e.class&&r.classList.add(e.class),i.appendChild(r),a._updateTaskColor(r),t&&(l.collapsed?i.toRefresh=!0:i.refresh()),r}_measureCardHeight(){const e=this,t=Object.keys(e.tasksByDataField);if(0===t.length||0===e.columns.length)return null;if(null===e.cardHeight&&!e._autoCardHeight){const a=e.tasksByDataField[t[0]],s=e._createVirtualTask(a[0]);e._renderTask(s),a.class&&"string"==typeof a.class&&s.classList.add(a.class);const l=e.columns[0],r=e._columnToElement.get(l),o=e.getTaskScrollViewer(r,a);o.appendChild(s);const i=o.querySelector(".smart-scroll-viewer-content-container"),n=getComputedStyle(i).rowGap;e._autoCardHeight=s.offsetHeight+parseInt(n),s.remove()}}_createTask(e,t,a){const s=this,l=s.dataSourceMap,r=s._allColumns.find((t=>t.dataField===e[l.status]));if(!r)return;const o=document.createElement("div"),i=s._columnToElement.get(r),n=s.getTaskScrollViewer(i,e);if(void 0===e[l.id]&&(e[l.id]=Math.floor(9e4*Math.random()+1e4)),o.className="smart-kanban-task smart-unselectable",o.setAttribute("role","listitem"),o.setAttribute("data-id",e[l.id]),s._currentUser&&s._currentUser.info&&(void 0===e[l.createdUserId]?(e[l.createdUserId]=s._currentUser.info.id,e[l.createdDate]=new Date):e[l.createdDate]||(e[l.createdDate]=new Date),e[l.history]||(e[l.history]=[],s.addHistory(e,{action:"created",user:s._currentUser.info.id,details:{value:e[l.text]},date:e[l.createdDate]}))),o.data=e,o.column=r,s.tasksByDataField[r.dataField]||(s.tasksByDataField[r.dataField]=[]),a>=0?s.tasksByDataField[r.dataField].splice(a,0,e):s.tasksByDataField[r.dataField].push(e),s.taskById[e.id]=e,!s.virtualization){if(s._renderTask(o),e.class&&"string"==typeof e.class&&o.classList.add(e.class),a>=0){const e=n.querySelector(".smart-kanban-task");e?e.parentElement.insertBefore(o,e):n.appendChild(o)}else n.appendChild(o);return s._updateTaskColor(o),t&&(r.collapsed?n.toRefresh=!0:n.refresh()),o}}getTaskScrollViewer(e,t){const a=this,s=a.dataSourceMap;let l;return a._hasSwimlane(e.index)?void 0!==t[s.swimlane]&&a.swimlanes.find((e=>e.dataField===t[s.swimlane]))?l=e.querySelector(`smart-scroll-viewer[swimlane="${t[s.swimlane]}"]`):(l=e.querySelector("smart-scroll-viewer"),t[s.swimlane]=l.getAttribute("swimlane")):(l=e.querySelector("smart-scroll-viewer"),delete t[s.swimlane]),l}_renderTask(e){const t=this;t._applyTaskTemplate(e),t._updateUserIcon(e),t._updateTaskChecked(e),t._updateTaskProgress(e),t._updateTaskDueDate(e),e.parentElement&&t._updateTaskColor(e),t._updateTaskPriority(e),e.column&&t.columnSummary&&t._updateColumnSummary(e.column),t.onTaskRender&&t.onTaskRender(e,e.data)}_refreshSummaries(){const e=this,t=e.querySelectorAll(".smart-kanban-column");for(let a=0;a<t.length;a++){const s=t[a].column;e._updateColumnSummary(s)}}_updateColumnSummary(e){const t=this,a=t._columnToElement.get(e);if(!a||!t.columnSummary)return;const s=t._getColumnSummary(e),l=a.querySelector(".summary");if(l&&(l.innerHTML=s),t.columnFooter){const l=a.querySelector(".smart-kanban-column-footer");if(s.length){let e=parseInt(s.replace("(","").replace(")","").trim());l.innerHTML=1===e?t.localize("tasksSummaryOne"):t.localize("tasksSummary",{summary:e})}else l.innerHTML="";t.onColumnFooterRender&&t.onColumnFooterRender(l,e,e.dataField)}a.removeAttribute("wip-min-error"),a.removeAttribute("wip-max-error"),void 0!==e.min&&(a.setAttribute("min",e.min),s.length?parseInt(s.replace("(","").replace(")","").trim())<e.min&&a.setAttribute("wip-min-error",""):0<e.min&&a.setAttribute("wip-min-error","")),void 0!==e.max&&(a.setAttribute("max",e.max),s.length)&&parseInt(s.replace("(","").replace(")","").trim())>e.max&&a.setAttribute("wip-max-error","")}_createAttachment(e){const t=e.target.classList.contains("attachments")?e.target:e.target.closest(".attachments"),a=t.getAttribute("data-field"),s=t.closest("smart-kanban"),l=s._fieldAttachmentValue[a],r=l&&"string"==typeof l?JSON.parse(l):l,o=e.target.closest(".item");if(!o)return;const i=o.getAttribute("value"),n=l.findIndex((e=>e.value===i));if(r[n]){const e=document.createElement("a");if(r[n].value.indexOf(window.location.host)>=0)fetch(r[n].value).then((e=>e.blob())).then((t=>{const a=URL.createObjectURL(t);e.download=r[n].label,e.href=a,e.click()}));else{if(r[n].value.indexOf("base64")>=0){const t=s._getFileFromBase64(r[n].value);e.href=URL.createObjectURL(t)}else e.href=r[n].value;e.target="_blank",e.click()}}e.stopPropagation(),e.preventDefault()}_createImageModal(e,t){const a=this,s=document.createElement("smart-window");s.animation=a.animation,s.headerButtons=["close"],s.rightToLeft=a.rightToLeft,s.resizeMode="none",s.theme=a.theme,s.style.height="auto",s.style.width="auto",s.style.maxWidth="1000px",s.style.maxHeight="1000px",document.body.appendChild(s),s.onclose=()=>{document.body.removeChild(s)},s.innerHTML="",s.label=e.title;const l=e.cloneNode(!0);e.hasAttribute("value")&&(l.src=e.getAttribute("value")),l.removeAttribute("onpointerdown"),l.removeAttribute("width"),l.removeAttribute("height"),l.style.maxWidth="800px",l.style.maxHeight="800px",s.appendChild(l),s.open(),t.stopPropagation(),t.preventDefault()}_applyTagsContent(e,t,a){const s=this;let l=s.tags;const r=s.dataSourceMap;l||(l=[]);let o="";if(e&&e.indexOf&&e.indexOf("{")>=0&&(e=JSON.parse(e)),e&&"string"==typeof e){if("[]"===e)return t[r.tags]="",o;e=e.split(",");for(let t=0;t<e.length;t++)e[t]=e[t].trim();l&&l.length>0?(e=e.filter((e=>{if(-1!==l.indexOf(e))return!0})),t[r.tags]=e.join(", ")):s.allowCustomTags?e.forEach((e=>{-1===s._customTags.indexOf(e)&&"[objectObject]"!==e&&s._customTags.push(e)})):e=[],o=e.map((e=>`<span class="smart-kanban-task-tag" role="listitem">${e}</span>`)).join("")}else e&&"object"==typeof e?(Array.isArray(e)||(e=[e],t[r.tags]=e),l.length>0?(s.allowCustomTags?e.forEach((e=>{if(-1===s._customTags.indexOf(e)&&"[objectObject]"!==e){let t=!0;if(s.tags)for(let a in s.tags){const l=s.tags[a];(e===l||JSON.stringify(e)===JSON.stringify(l))&&(t=!1)}t&&s._customTags.push(e)}})):e=e.filter((e=>{if(-1!==l.indexOf(e))return!0;if(e.value){let t=!1;if(l.find((a=>{a===e.value&&(t=!0),a.value===e.value&&(t=!0)})),t)return!0}})),t[r.tags]=e):s.allowCustomTags?e.forEach((e=>{-1===s._customTags.indexOf(e)&&"[objectObject]"!==e&&s._customTags.push(e)})):(e=[],t[r.tags]=[]),o=e.map((e=>{if(e.color){const t=e.color||"rgba(var(--smart-primary-rgb), 0.15)",a=document.createElement("div");document.body.appendChild(a),a.style.backgroundColor=t;const s=getComputedStyle(a).backgroundColor;return a.remove(),`<span style="color: ${new Smart.Color(s).getInvertedColor()}; background: ${t} " class="smart-kanban-task-tag" role="listitem">${e.label}</span>`}return`<span class="smart-kanban-task-tag" role="listitem">${"string"==typeof e?e:e.label}</span>`})).join("")):t[r.tags]="";return o}_applyTaskTemplate(e){const t=this,a=t.dataSourceMap,s=(t.tags,e.data),l=t._tabindex;let r=s[a.text],o=s[a.description],i=s[a.tags],n="",d=r;void 0===r&&(r="",s[a.text]="",d=r),void 0===o&&(o="",s[a.description]=""),r=t._applyTextTemplate(r,s,e),n=t._applyTagsContent(i,s,e),"string"==typeof s[a.priority]&&(s[a.priority]=s[a.priority].toLowerCase());const c=t._getPriority();let u=c.findIndex((e=>e.value===s[a.priority]));const m=c.length>0&&u>=0?c[u]:null;s[a.comments]&&Array.isArray(s[a.comments])||(s[a.comments]=[]);const p=t.localize(s[a.priority])+" "+t.localize("priority");let h=d?`${d}: ${p}`:`${p}`;t.taskPriority||(h=d);let g=`<div class="smart-kanban-task-cover"></div><div title="${h}" class="smart-kanban-task-content" role="presentation">\n <div class="smart-kanban-task-text">${r}`;g+=m?`${m.menuIcon}`:'<span style="margin-left: 0px; margin-right: 5px;" class="priority"></span>';let f=s[a.description].replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/'/g,"&#39;").replace(/"/g,"&quot;");g+=`</div>\n <div class="smart-kanban-task-user"${l} role="button" aria-haspopup="listbox"></div>\n</div>\n<div class="smart-kanban-task-info" role="presentation">\n <div class="smart-kanban-task-progress-container">\n <div class="smart-kanban-task-progress" role="progressbar" aria-label="Task progress" aria-valuemin="0" aria-valuemax="100"></div>\n <div class="smart-kanban-task-checked" aria-label="Completed sub-tasks"></div>\n </div>\n <div class="smart-kanban-task-due" aria-label="Task due date"></div>\n</div>\n<div class="smart-kanban-task-fields"></div>\n<div class="smart-hidden smart-kanban-task-subtasks">\n <div class="smart-kanban-task-subtasks-container"></div>\n <div><input class="smart-kanban-task-input smart-input" placeholder="${t.localize("newSubtask")}"/></div>\n</div>\n<div class="smart-hidden smart-kanban-task-custom-fields"></div>\n<div class="smart-kanban-task-footer" role="toolbar" aria-label="Task footer">\n <div class="smart-kanban-task-tags" role="list" aria-label="Tags list">${n}</div>\n <div class="smart-kanban-task-edit smart-hidden"${l} title="${t.localize("edit")}" role="button" aria-label="Edit"></div>\n <div title="${t.localize("actionsList")}" class="smart-kanban-task-actions"${l} role="button" aria-haspopup="menu" aria-label="Open actions list"></div>\n <div class="smart-kanban-task-comments"${l} num="${s[a.comments].length||""}" role="button" aria-haspopup="dialog" aria-label="Open comments list"></div>\n <div class="smart-kanban-task-description smart-hidden"${l} title="${t.localize("taskDescription",{value:f})}" num="${s[a.description]?s[a.description].length:""}" role="button" aria-label="Show description"></div>\n</div>`,e.innerHTML=g,e.setAttribute("aria-label",s[a.text]);const b=e.querySelector(".smart-kanban-task-description");s[a.description]?b.classList.remove("smart-hidden"):b.classList.add("smart-hidden");const v=e.querySelector(".smart-kanban-task-edit");t.editable?v.classList.remove("smart-hidden"):v.classList.add("smart-hidden"),v.onpointerdown=a=>{t.beginEdit(e),a.preventDefault(),a.stopPropagation()},e.onmousemove=()=>{Smart.Kanban.kanbanTaskDragged&&t.allowDropPlaceholder&&setTimeout((()=>{const a=e.classList.contains("before"),s=e.classList.contains("after");(a||s)&&(Smart.Kanban.dropOverTask&&Smart.Kanban.dropOverTask!==e&&delete Smart.Kanban.isBefore,Smart.Kanban.isBefore!==a&&(Smart.Kanban.isBefore=a,Smart.Kanban.dropOverTask=e,(a=>{e.classList.add("smart-kanban-task-placeholder"),t._dropAreaTimer&&clearTimeout(t._dropAreaTimer),t._dropAreaTimer=setTimeout((()=>{setTimeout((()=>{document.querySelectorAll(".smart-kanban-task-placeholder").forEach((e=>{e.style.marginTop=e.style.marginBottom="0px"}));const s=e.closest(".smart-kanban-column");if(s&&s.hasAttribute("orientation")&&"horizontal"!==s.getAttribute("orientation")){const s=t._dragDetails?t._dragDetails.Item:null;e!==s&&(a?e.previousElementSibling!==s&&(e.style.marginTop="100px"):e.nextElementSibling!==s&&(e.style.marginBottom="100px"))}t._refreshButtonsAndSummaries()}),20)}),20)})(a)))}))},t._updateTaskCustomFields(e),t._updateTaskSubtasks(e)}_updateTaskCustomFields(e){const t=this,a=e.data;if(t.taskCustomFieldsHide){const t=e.querySelector(".smart-kanban-task-custom-fields");t&&t.classList.remove("smart-hidden")}else if(t.taskCustomFields.length>0&&!t.taskCustomFieldsHide){const s=e.querySelector(".smart-kanban-task-custom-fields");s.classList.remove("smart-hidden");for(let l=0;l<t.taskCustomFields.length;l++){const r=t.taskCustomFields[l];let o=a[r.dataField],i="";if(!t.dataSourceMap[r.dataField]&&"password"!==r.editor)if(null!=o&&!1!==r.visible){if(void 0===r.visible&&(r.visible=!0),void 0===r.allowHide&&(r.allowHide=!0),!r.dataSource||r.dataSource&&0===r.dataSource.length){if("string"==typeof o&&o.length>50&&o.indexOf("base64")>=0&&"image"===r.editor){o=JSON.parse(o),window.Smart._createSmartImageModal=t._createImageModal;let a="";for(let e=0;e<o.length;e++){const t=o[e];a+=`<img style="margin-left: 5px;" onpointerdown="Smart._createSmartImageModal(this, event)" src="${t.value}" title="${t.label}"/>`}if(o=a,r.cover){const t=e.querySelector(".smart-kanban-task-cover");t.classList.add("smart-kanban-task-cover-content"),t.innerHTML=o}}else if("string"==typeof o&&r.image&&o.indexOf("http")>=0){if(window.Smart._createSmartImageModal=t._createImageModal,o.indexOf(",")>=0){let e="";o=o.split(",");for(let t=0;t<o.length;t++)e+=`<img style="margin-left: 5px;" onpointerdown="Smart._createSmartImageModal(this, event)" src="${o[t]}"/>`;o=e}else o=`<img style="margin-left: 5px;" onpointerdown="Smart._createSmartImageModal(this, event)" src="${o}"/>`;if(r.cover){const t=e.querySelector(".smart-kanban-task-cover");t.classList.add("smart-kanban-task-cover-content"),t.innerHTML=o}}else if("string"==typeof o&&r.image&&o.indexOf("http")>=0||r.editor&&"image"===r.editor&&"string"==typeof o&&o.indexOf("[{")>=0)if(window.Smart._createSmartImageModal=t._createImageModal,o.indexOf("[{")>=0){o=JSON.parse(o);let t="";for(let e=0;e<o.length;e++){const a=o[e];a.label||(a.label=""),t+=`<img title="${a.label}" style="margin-left: 5px;" value="${a.value}" onpointerdown="Smart._createSmartImageModal(this, event)" src="${a.small||a.value}"/>`}if(o=t,r.cover){const t=e.querySelector(".smart-kanban-task-cover");t.classList.add("smart-kanban-task-cover-content"),t.innerHTML=o}}else i=o,o=o.substring(0,50)+"...";else if(r.image){if(o=`<img style="margin-left: 5px;" onpointerdown="Smart._createSmartImageModal(this, event)" src="${o}"/>`,r.cover){const t=e.querySelector(".smart-kanban-task-cover");t.classList.add("smart-kanban-task-cover-content"),t.innerHTML=o}}else if("attachment"===r.editor)if(o.length>50){if("string"==typeof o&&(o.indexOf("[{")>=0||o.indexOf("}]")>=0)){let e="";if(o)try{e=JSON.parse(o)}catch(e){console.log(e)}o=e}const e=document.createElement("div");Array.isArray(o)&&(o.forEach((t=>{const a=document.createElement("div");a.title=t.label,a.classList.add("item"),a.innerHTML="<div></div>",a.firstElementChild.classList.add("smart-grid-icon","show","attachment"),t.label.indexOf("png")>=0||t.label.indexOf("jpg")>=0||t.label.indexOf("jpeg")>=0||t.label.indexOf("gif")>=0?a.firstElementChild.classList.add("smart-icon-image"):t.label.indexOf(".pdf")>=0?a.firstElementChild.classList.add("smart-icon-pdf"):t.label.indexOf(".tsv")>=0||t.label.indexOf(".txt")>=0||t.label.indexOf(".csv")>=0?a.firstElementChild.classList.add("smart-icon-text"):t.label.indexOf(".xls")>=0||t.label.indexOf(".xlsx")>=0?a.firstElementChild.classList.add("smart-icon-excel"):t.label.indexOf(".ppt")>=0?a.firstElementChild.classList.add("smart-icon-powerpoint"):t.label.indexOf(".zip")>=0||t.label.indexOf(".rar")>=0||t.label.indexOf(".7z")>=0?a.firstElementChild.classList.add("smart-icon-archive"):t.label.indexOf(".doc")>=0||t.label.indexOf(".docx")>=0?a.firstElementChild.classList.add("smart-icon-word"):a.firstElementChild.classList.add("smart-icon-file"),a.setAttribute("value",t.value),e.appendChild(a)})),t._fieldAttachmentValue||(t._fieldAttachmentValue=[]),t._fieldAttachmentValue[r.dataField]=o),window.Smart._createSmartAttachment=t._createAttachment,o='<div data-field="'+r.dataField+'" onpointerdown="Smart._createSmartAttachment(event)" class="attachments">'+e.innerHTML+"</div>"}else input=document.createElement("div"),o||(o=t.localize("emptyAttachment"));else if("dateInput"===r.editor)o=new Smart.Utilities.DateTime(o).toString(this.formatStringDate);else if("dateRangeInput"===r.editor)o&&o.length&&(o[0]=new Smart.Utilities.DateTime(o[0]).toString(this.formatStringDate),o[1]=new Smart.Utilities.DateTime(o[1]).toString(this.formatStringDate),o=o[0]+"-"+o[1]);else if(r.dataSource)if(o&&o.indexOf(",")>0&&(o=o.split(",")),void 0!==o&&Array.isArray(o)){let e=[];for(let t=0;t<o.length;t++){const a=r.dataSource.find((e=>{if(e.value===o[t])return e}));a&&e.push(a.label)}o=e.toString()}else{const e=r.dataSource.find((e=>{if(e.value===o)return e}));e&&e.label&&(o=e.label)}const a=e.querySelector("[data-field="+r.dataField+"]");if(a)a.innerHTML=`<div class="smart-kanban-task-field-label">${r.label}</div><div title="${i}" class="smart-kanban-task-field-value">${o}</div>`,a.classList.remove("smart-hidden");else{const e=document.createElement("div");e.classList.add("smart-kanban-task-field"),e.setAttribute("data-field",r.dataField),e.innerHTML=`<div class="smart-kanban-task-field-label">${r.label}</div><div title="${i}" class="smart-kanban-task-field-value">${o}</div>`,s.appendChild(e)}}}else{const t=e.querySelector("[data-field="+r.dataField+"]");t&&t.classList.add("smart-hidden")}}}}_updateTaskSubtasks(e){const t=this;if("none"===t.taskSubTasks)return void e.querySelector(".smart-kanban-task-subtasks").classList.add("smart-hidden");const a=e.data,s=t.dataSourceMap,l=[],r=[];(a[s.checklist]||[]).forEach(((e,t)=>{e.completed&&l.push(t),r.push({label:e.text,selected:!0===e.completed})}));const o=e.querySelector(".smart-kanban-task-subtasks"),i=e.querySelector(".smart-kanban-task-subtasks-container");i.innerHTML="",o.classList.remove("smart-hidden");const n=e.querySelector(".smart-kanban-task-input");t._currentUser&&!t._currentUser.allowEdit||t.disabled||!t.taskSubTasksInput?n.classList.add("smart-hidden"):n.classList.remove("smart-hidden"),n.onfocus=function(e){e.preventDefault(),e.stopPropagation()},n.onkeydown=e=>{"Escape"===e.key&&(n.value="",n.blur())," "===e.key&&e.stopPropagation()},n.onchange=function(l){a[s.checklist]||(a[s.checklist]=[]);const r=JSON.parse(JSON.stringify(a));a[s.checklist].push({text:n.value.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/'/g,"&#39;").replace(/"/g,"&quot;").replace(/\\/g,""),completed:!1}),n.value="",t._updateTaskSubtasks(e);const o=JSON.parse(JSON.stringify(a));t.$.fireEvent("change",{task:e,id:o.id,value:o,oldValue:r}),t.$.fireEvent("taskUpdate",{id:o.id,value:o,oldValue:r}),t._refreshColumnHeights(),l.preventDefault(),l.stopPropagation(),n.closest(".smart-scroll-viewer-container").scrollTop=0},r.length&&r.forEach(((l,o)=>{const n=document.createElement("div"),d=l.label;n.innerHTML=`<div data-index="${o}" class="smart-kanban-sub-task"><span title="${d}" class="label">${d}</span><span class="edit-subtask" aria-label="Edit subtask" title="${t.localize("edit")}"></span><span class="remove-subtask" aria-label="Remove subtask" title="${t.localize("removeSubtask")}"></span></div>`,l.selected&&n.firstChild.classList.add("selected"),"onlyUnfinished"===t.taskSubTasks&&l.selected&&n.classList.add("smart-hidden");let c=!0;(t._currentUser&&!t._currentUser.allowEdit||t.disabled)&&(c=!1),c?(n.querySelector(".edit-subtask").style.opacity=1,n.querySelector(".remove-subtask").style.opacity=1):(n.querySelector(".remove-subtask").style.opacity=0,n.querySelector(".edit-subtask").style.opacity=0),n.onpointerup=n.onclick=e=>{t._dragDetails||(e.preventDefault(),e.stopPropagation())},n.onpointerdown=l=>{let o=!0;if((t._currentUser&&!t._currentUser.allowEdit||t.disabled)&&(o=!1),!o)return;t._subTaskInput&&t._subTaskInput.parentNode&&(t._subTaskInput.remove(),delete t._subTaskInput);const i=JSON.parse(JSON.stringify(a)),d=parseInt(n.firstChild.getAttribute("data-index")),c=r[d];if(l.target.classList.contains("remove-subtask"))r.splice(d,1),n.classList.add("smart-hidden"),a[s.checklist].splice(d,1);else if(l.target.classList.contains("edit-subtask")){t._subTaskClickTimer&&clearTimeout(t._subTaskClickTimer);const l=document.createElement("input"),r=n.firstElementChild,o=n.querySelector(".label");l.classList.add("smart-input"),l.style.position="absolute";const i=t.offset(r),d=t.offset(t);l.style.height=r.offsetHeight+"px",l.style.background="var(--smart-background)",l.style.width=n.offsetWidth-20+"px",l.value=o.textContent,t.appendChild(l),t.style.position="relative",l.select(),l.style.top=i.top-d.top+"px",l.style.left=i.left-d.left+20+"px",t._subTaskInput=l,l.onchange=()=>{const r=JSON.parse(JSON.stringify(a)),i=parseInt(n.firstChild.getAttribute("data-index"));a[s.checklist][i].text=l.value,o.innerHTML=l.value;const d=JSON.parse(JSON.stringify(a));t.$.fireEvent("change",{task:e,id:d.id,value:d,oldValue:r}),t.$.fireEvent("taskUpdate",{id:d.id,value:d,oldValue:r}),l.remove()}}else n.firstChild.classList.toggle("selected"),c.selected=!c.selected,a[s.checklist][d].completed=c.selected,"onlyUnfinished"===t.taskSubTasks&&c.selected&&n.classList.add("smart-hidden");t._updateTaskChecked(e);const u=JSON.parse(JSON.stringify(a));t.$.fireEvent("change",{task:e,id:u.id,value:u,oldValue:i}),t.$.fireEvent("taskUpdate",{id:u.id,value:u,oldValue:i}),l.preventDefault(),l.stopPropagation()},i.appendChild(n)}))}_applyTextTemplate(e,t,a){const s=this;let l=this.textTemplate;if(!l)return e;let r="";if("function"==typeof l){const s={data:t,task:a,text:e,template:null};if(l(s),e=s.text,null===s.template)return e;l=s.template}if(l.startsWith("#")){const a=document.querySelector(l);if(a&&a instanceof HTMLTemplateElement){const l=a.content.cloneNode(!0),o=document.createElement("div");return o.appendChild(l),e=(e=(e=e.toString()).replace(/'/gi,"\\'")).replace(/"/gi,'\\"'),r=o.innerHTML.replace(/{{text}}/gi,e).replace(/{{id}}/gi,t[s.dataSourceMap.id]),r.indexOf("{{text=")>=0&&(e?(r=r.substring(0,r.indexOf("{{text="))+e+r.substring(r.indexOf("}")),r=r.replace(/}/gi,""),r=r.replace(/{/gi,"")):(r=r.replace(/{{text=/gi,""),r=r.replace(/}}/gi,""))),r}}return r=l.replace(/{{text}}/gi,e).replace(/{{id}}/gi,t[s.dataSourceMap.id]),r}_updateUserIcon(e){const t=this,a=this.dataSourceMap,s=e.data,l=e.getElementsByClassName("smart-kanban-task-user")[0];if(void 0!==s[a.userId]&&null!==s[a.userId]){const e=this.users.find((e=>e.id.toString()===s[a.userId].toString()));if(e)return s[a.userId]!==e.id&&(s[a.userId]=e.id),l.classList.remove("empty"),l.style.backgroundImage='url("'+e.image+'")',l.setAttribute("title",t.localize("assignedTask",{userName:e.name||e.id})),void l.setAttribute("aria-label","Icon of user "+(e.name||e.id))}s[a.userId]=null,l.classList.add("empty"),l.style.backgroundImage=null,l.setAttribute("aria-label","Empty user icon"),l.setAttribute("title",t.localize("unassignedTask"))}_updateTaskComments(e){const t=this.dataSourceMap,a=e.data;e.querySelector(".smart-kanban-task-comments").setAttribute("num",a[t.comments].length||"")}_updateTaskProgress(e){const t=this.dataSourceMap,a=e.data,s=e.querySelector(".smart-kanban-task-progress");let l=a[t.progress];if(void 0===l){a[t.progress]=null,s.setAttribute("aria-valuenow",0);const e=this.localize("taskProgress",{value:0});return void s.parentElement.setAttribute("title",e)}if(l=parseFloat(l),isNaN(l)){a[t.progress]=null,s.setAttribute("aria-valuenow",0);const e=this.localize("taskProgress",{value:0});return void s.parentElement.setAttribute("title",e)}l=Math.max(0,Math.min(parseFloat(l),100)),a[t.progress]=l,s.style.width=l+"%",s.classList.toggle("bottom",null!==a[t.checklist]),s.setAttribute("aria-valuenow",l);const r=this.localize("taskProgress",{value:l});s.parentElement.setAttribute("title",r)}_updateTaskChecked(e){const t=this.dataSourceMap,a=e.data,s=a[t.checklist],l=e.querySelector(".smart-kanban-task-checked");if(s&&Array.isArray(s)&&s.length>0?l.innerHTML=this._getCompletedSubTasks(s):(a[t.checklist]=null,l.innerHTML=""),l.innerHTML.length>0){let e=0;s.forEach((t=>t.completed&&e++));const t=e,a=s.length,r=this.localize("taskCompleted",{value:t,count:a});l.setAttribute("title",r)}else l.removeAttribute("title")}_getCompletedSubTasks(e){if(null===e)return"";let t=0;return e.forEach((e=>e.completed&&t++)),t+"/"+e.length}_updateTaskDueDate(e){const t=this.dataSourceMap;let a=e.data,s=a[t.dueDate],l=e.querySelector(".smart-kanban-task-due");if(s&&"string"==typeof s&&(s=new Date(s),s.setTime(s.getTime()-1*s.getTimezoneOffset()*60*1e3),a[t.dueDate]=s),s)if(l.innerHTML=new Smart.Utilities.DateTime(s).toString(this.formatStringDate),l.classList.toggle("overdue",s.getTime()<(new Date).getTime()&&100!==a[t.progress]),l.classList.contains("overdue")){const e=Math.abs(new Date-s),t=Math.ceil(e/864e5);l.setAttribute("title",this.localize("overdue")+" "+t+" "+this.localize("days"))}else l.removeAttribute("title");else a[t.dueDate]=null,l.innerHTML="",l.classList.remove("overdue"),l.removeAttribute("title");a[t.startDate]?"string"==typeof a[t.startDate]&&(a[t.startDate]=new Date(a[t.startDate]),a[t.startDate].setTime(a[t.startDate].getTime()-1*a[t.startDate].getTimezoneOffset()*60*1e3)):a[t.startDate]=null}_updateTaskColor(e){const t=this,a=t.dataSourceMap,s=e.data,l=e.querySelector(".smart-kanban-task-progress-container"),r=e.querySelector(".smart-kanban-task-progress"),o=t.rightToLeft?"borderRightColor":"borderLeftColor";function i(e){let t=parseFloat(e).toString(16);return t="0".repeat(2-t.length)+t,t.toUpperCase()}if(e.style.borderLeftColor=null,e.style.borderRightColor=null,e.style.borderLeftWidth="",e.style.borderRightWidth="",s[a.color]){e.style[o]=s[a.color];const d=getComputedStyle(e)[o],c="dark"===t.theme?.4:.1;t.taskColor?e.style[o]=s[a.color]:(e.style[o]="var(--smart-border)",e.style[t.rightToLeft?"borderRightWidth":"borderLeftWidth"]="1px"),s[a.color]=(n=(n=d).match(/^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/))?"#"+i(n[1])+i(n[2])+i(n[3]):null,l&&(l.style.backgroundColor=`rgba(${d.slice(4,d.length-1)}, ${c})`,r.style.backgroundColor=d),t.taskColorEntireSurface&&(e.style.backgroundColor=`rgba(${d.slice(4,d.length-1)}, ${c})`)}else{if(s[a.color]=null,l&&(l.style.backgroundColor=null,r.style.backgroundColor=null),t.taskColorEntireSurface){const a=getComputedStyle(e)[o],s="dark"===t.theme?.4:.1;e.style.backgroundColor=`rgba(${a.slice(4,a.length-1)}, ${s})`}t.taskColor||(e.style[o]="var(--smart-border)",e.style[t.rightToLeft?"borderRightWidth":"borderLeftWidth"]="1px")}var n}_updateTaskPriority(e){const t=this,a=t.dataSourceMap,s=e.data,l=e.querySelector(".priority");l.className="priority";let r="";s[a.priority]&&(l.className+=" "+s[a.priority],r=t.localize(s[a.priority])+" "+t.localize("priority"));const o=s[a.text],i=e.querySelector(".smart-kanban-task-content");t.taskPriority?l.classList.remove("smart-hidden"):l.classList.add("smart-hidden"),i&&(o&&t.taskPriority&&r?i.setAttribute("title",`${o}: ${r}`):i.removeAttribute("title"))}_validateSwimlanes(){const e=this,t=e.swimlanesFrom,a=e.swimlanesTo,s=[];t<0&&(e.swimlanesFrom=0),null!==a&&t>a&&(e.swimlanesFrom=a),e.swimlanes.forEach((e=>{"string"==typeof e&&(e={dataField:e,label:e}),(e.dataField||e.label)&&(e.label||(e.label=e.dataField),e.dataField||(e.dataField=e.label),s.push(e))})),e.swimlanes=s}_handleSwimlanes(e){const t=this,a=t.swimlanes;if(0===a.length||0===t.columns.length)return;const s=t.columns,l=parseFloat(getComputedStyle(t).getPropertyValue("--smart-kanban-header-size")),r=t.$.container,o=t.$.container.getBoundingClientRect(),i=t.$.container.querySelectorAll(".smart-kanban-column.has-swimlane");let n=i[0],d=i[i.length-1];if(t.rightToLeft){let e=n;n=d,d=e}const c=n.getBoundingClientRect(),u=i.length>1?d.getBoundingClientRect():c,m=Array.from(n.getElementsByTagName("smart-scroll-viewer"));let p,h,g,f,b=!1,v=!0,y=t.swimlanesTo;null===y&&(y=s.length-1),e&&(p=r.getElementsByClassName("swimlane")),n.column.collapsed&&(n.classList.remove("collapsed"),b=!0);for(let e=t.swimlanesFrom;e<=y;e++)v=v&&s[e].collapsed;v||(h=u.right-c.left+"px",g=c.left-o.left+"px",f=m.map((e=>e.getBoundingClientRect().top-o.top-l-t._dataViewPadding+"px"))),a.forEach(((t,a)=>{let s;e?s=p[a]:(s=document.createElement("div"),s.innerHTML=`<div class="swimlane-label">${t.label}</div>`,s.className="swimlane",s.setAttribute("role","heading"),s.setAttribute("aria-level",2),t.color&&(s.style.backgroundColor=t.color)),s.classList.toggle("smart-visibility-hidden",v),v||(s.style.width=h,s.style.left=g,s.style.top=f[a]),e||r.appendChild(s)})),b&&n.classList.add("collapsed")}_renderColumns(){const e=this,t=e.collapsible,a=[],s=e.$.body,l=document.createDocumentFragment();let r=e.columns;const o=e.context;if(e.context=e,e._columnToElement=new Map,e._columnContainers=[],0===r.length){const t=e.dataSource;t&&0!==t.length&&(r=[],t.forEach((t=>{const a=t[e.dataSourceMap.status];a&&-1===r.indexOf(a)&&r.push(a)})))}!function e(a,s,l){const r=[];let o=0;if(a.forEach((a=>{"string"==typeof a&&(a={dataField:a,label:a}),void 0!==a.dataField&&(void 0===a.label&&(a.label=a.dataField),void 0===a.dataField&&(a.dataField=a.label),"horizontal"!==a.orientation&&(a.orientation="vertical"),!1!==a.collapsible&&(a.collapsible=!0),a.collapsed&&t&&a.collapsible?o++:a.collapsed=!1,!1!==a.addNewButton&&(a.addNewButton=!0),!1!==a.allowRemove&&(a.allowRemove=!0),!1!==a.allowHide&&(a.allowHide=!0),!1!==a.editable&&(a.editable=!0),!1!==a.reorder&&(a.reorder=!0),0===l?delete a.selected:!0===a.selected?r.push(a):a.selected=!1,a.columns&&(a.validColumns=[],e(a.columns,a.validColumns,l+1),a.columns=a.validColumns,delete a.validColumns),s.push(a))})),o&&o===s.length&&(s[0].collapsed=!1),r.length>1)for(let e=r.length-2;e>=0;e--)r[e].selected=!1;else l>0&&0===r.length&&s.length>0&&(s[0].selected=!0)}(r,a,0),0===e.swimlanes.length?"columns"===e.hierarchy?e._createColumnElements(a,l,s,1):e._createColumnElementsTabs(a,l,s):e._createColumnElementsSwimlanes(a,l,s),s.appendChild(l),e._selectedTabs=e._allColumns.filter((e=>e.selected)).map((e=>e.dataField)),e._autoSaveState("tabs"),e.context=o}_createAddNewButton(){const e=this,t=e.querySelectorAll(".smart-kanban-add-new-button");t.length&&t.forEach((e=>{e.remove()})),e.addNewButton&&"top"!==e.addNewButtonDisplayMode&&(e.addNewButtons=[],e.querySelectorAll(".smart-kanban-column").forEach((t=>{const a=t.querySelector(".smart-scroll-viewer");if(a){const s=(()=>{const t=document.createElement("div");return t.setAttribute("add-new-button",""),t.classList.add("smart-kanban-add-new-button"),t.title=e.localize("addNewTask"),t.onpointerdown=()=>{if(t.column){const a=t.column.querySelector(".smart-kanban-column-header-add");a&&(e._addToBottom=!0,a.click())}},t})(),l=t.column;if(!l||l&&l.collapsed||l&&!l.addNewButton)return;t.appendChild(s);const r=()=>{const l=a.getBoundingClientRect(),r=t.querySelectorAll(".smart-kanban-task"),o=e.offset(e);if(0===r.length){const a=t.querySelector(".smart-kanban-column-header"),l=e.offset(a).top-o.top,r=e.autoColumnHeight?60:0;s.style.top=l+r+a.offsetHeight+"px"}else{const i=r[r.length-1],n=e.offset(i);let d=parseInt(i.style.marginBottom);const c=e.offsetHeight-2*s.offsetHeight;isNaN(d)&&(d=0);const u=n.top-o.top+i.offsetHeight+d;if(a.computedVerticalScrollBarVisibility){const t=e.getBoundingClientRect();s.style.top=Math.min(l.top-t.top+a.offsetHeight,c)+"px"}else{const a=t.querySelector(".smart-kanban-column-footer");if(a){const t=e.offset(a).top-o.top-s.offsetHeight/2;s.style.top=Math.min(t,c)+"px"}else s.style.top=Math.min(u,c)+"px"}}const i=t.offsetWidth-a.offsetWidth;s.style.left=l.left+a.offsetWidth/2-i-s.offsetWidth/2-o.left+e.$.scrollViewer.scrollLeft+"px"};s.refresh=r,s.column=t,t.addNewButton=s,s.refresh(),e.addNewButtons.push(s),requestAnimationFrame((()=>{s.classList.add("show")}))}})),e._refreshSummaries())}_refreshColumnHeights(e=!0,t,a=0){const s=this;s.autoColumnHeight&&(s.virtualization?s.querySelectorAll(".smart-kanban-column").forEach((e=>{if(e.querySelector(".smart-scroll-viewer")){const t=e.column,a=s._getTasksByDataField(t.dataField),l=e.querySelector(".smart-kanban-column-header"),r=e.querySelector(".smart-kanban-column-footer"),o=r?r.offsetHeight:0;if(0===a.length)e.style.height=100+o+l.offsetHeight+"px";else{const t=s.offsetHeight,r=a[a.length-1],i=l.offsetHeight+o+r.top+r.height;isNaN(i)||(e.style.height=t<i?"":i-o+"px")}}})):s.querySelectorAll(".smart-kanban-column").forEach((l=>{const r=l.querySelector(".smart-scroll-viewer");if(r){const o=l.column;if(t&&o.dataField!==t)return;if(!o||o&&o.collapsed)return void(l.style.height="");const i=l.querySelectorAll(".smart-kanban-task"),n=l.querySelector(".smart-kanban-column-header"),d=l.querySelector(".smart-kanban-column-footer"),c=d?d.offsetHeight:0;if(0===i.length)l.style.height=100+c+n.offsetHeight+"px";else{const e=i[i.length-1];if(r.style.top="0px",!s._rowGap){const t=parseInt(getComputedStyle(e.parentElement).gridRowGap);s._rowGap=t,isNaN(s._rowGap)&&(s._rowGap=0)}let t=0;for(let e=0;e<i.length;e++)if(t+=i[e].offsetHeight+s._rowGap,i[e].classList.contains("smart-kanban-task-placeholder")){const a=parseInt(i[e].style.marginTop),s=parseInt(i[e].style.marginBottom);isNaN(a)||(t+=a),isNaN(s)||(t+=s)}const o=s.offsetHeight,d=n.offsetHeight+c+t+s._rowGap+s._rowGap+a;l.style.height=o<d?"":d+"px"}e&&r.refresh(),s._refreshEmptyColumnState(r)}})))}_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)}}_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","#FFCFC9","#FFD66D","#FFEBB6","#93DF89","#D1F7C4","#9DC7FF","#D0F0FD","#CDAFFF","#ECE1FD","#FA9DE2","#FFDAF6","#CBCBCB","#EDEDED","#FFFFFF",""],e.valueDisplayMode="colorBox",e.classList.add("smart-kanban-color-input"),e.style.width="auto",e.style.height="auto",e.readonly=!0,e.onRender=()=>{const t=e.$.scrollView;t&&t.classList.add("smart-kanban-color-input")},e}_createColumnElements(e,t,a,s){const l=this,r=l.id,o=[],i=[];let n=0;const d=e=>"number"==typeof e?e+"px":"string"==typeof e?e:void 0;if(e.forEach(((a,c)=>{const u=document.createElement("div");let m=`${l._getColumnHeader(a,c<e.length-1,s)}\n <div class="smart-kanban-column-contentAAA" role="presentation">\n <smart-scroll-viewer class="smart-kanban-column-content-tasks"${l._rtlAttr}${l._tabindex} role="list"></smart-scroll-viewer>BBB\n </div>`,p=0;if(l.columnFooter&&(m+='<div class="smart-kanban-column-footer"></div>'),a.columns?(m=m.replace("AAA",""),m=m.replace("BBB",'<div class="smart-kanban-column-content-columns" role="presentation"></div>')):(m=m.replace("AAA"," no-sub-columns"),m=m.replace("BBB","")),u.className="smart-kanban-column",u.setAttribute("data-field",a.dataField),u.setAttribute("role","group"),u.setAttribute("aria-labelledby",`${r}ColumnHeaderLabel${a.dataField}`),u.setAttribute("orientation",a.orientation),a.color&&l.applyColumnColorToTasks&&u.style.setProperty("--smart-primary",a.color),a.collapsible&&u.setAttribute("collapsible",""),a.addNewButton&&u.setAttribute("add-new-button",""),u.innerHTML=m,u.siblingColumns=e,t.appendChild(u),u.column=a,u.index=c,u.onmouseleave=()=>{let e=!1;u.querySelectorAll(".smart-kanban-task-placeholder").forEach((t=>{t.style.marginTop=t.style.marginBottom="0px",e=!0})),e&&l._refreshButtonsAndSummaries()},l.onColumnHeaderRender&&l.onColumnHeaderRender(u.querySelector(".smart-kanban-column-header"),a,a.dataField),l._columnToElement.set(a,u),a.columns){const e=u.querySelector(".smart-kanban-column-content-columns");p=l._createColumnElements(a.columns,e,e,s+1),n+=p}else n+=1;let h=(p||1)+"fr";l.columnWidth?h=d(l.columnWidth):a.width&&(h=d(a.width)),!1!==a.visible?(a.collapsed?(u.classList.add("collapsed"),o.push("auto")):o.push(h),i.push(h)):u.classList.add("smart-hidden"),l._allColumns.push(a)})),1===s&&l.addNewColumn)if(l._appendAddNewColumn(t),l.columnWidth){let e="1fr";const t=l.addNewColumnWidth?l.addNewColumnWidth:l.columnWidth;e=d(t),o.push(e)}else o.push("var(--smart-kanban-add-new-column-width)");return a.style.gridTemplateColumns=o.join(" "),a.fractions=i,l._columnContainers.push(a),n}_createColumnElementsTabs(e,t,a,s){const l=this,r=l.id,o=[],i=[];if(e.forEach(((a,n)=>{const d=document.createElement("div");let c=`<div class="smart-kanban-column-contentAAA" role="presentation">\n <smart-scroll-viewer class="smart-kanban-column-content-tasks"${l._rtlAttr}${l._tabindex} role="list"></smart-scroll-viewer>BBB\n </div>`;if(a.columns?(c=c.replace("AAA",""),c=c.replace("BBB",'<div class="smart-kanban-column-content-columns has-tabs" role="presentation"></div>')):(c=c.replace("AAA"," no-sub-columns"),c=c.replace("BBB","")),d.className="smart-kanban-column",d.setAttribute("orientation",a.orientation),a.collapsible&&d.setAttribute("collapsible",""),a.addNewButton&&d.setAttribute("add-new-button",""),s){const e=document.createElement("div"),t=`${r}Tab${a.dataField}`,o=`${r}Column${a.dataField}`;e.id=t,e.className="smart-kanban-tab smart-unselectable",l.disabled||l.unfocusable||(e.tabIndex=0),e.setAttribute("role","tab"),e.setAttribute("aria-controls",o),e.innerHTML=`<div class="smart-kanban-tab-label">${a.label}</div>`,e.columnElement=d,d.id=o,d.setAttribute("role","tabpanel"),d.setAttribute("aria-labelledby",t),d.tab=e,s.appendChild(e),a.selected?e.classList.add("selected"):d.classList.add("smart-hidden"),e.setAttribute("aria-selected",a.selected)}else c=l._getColumnHeader(a,n<e.length-1)+c,d.setAttribute("role","group"),d.setAttribute("aria-labelledby",`${r}ColumnHeaderLabel${a.dataField}`);if(d.innerHTML=c,d.siblingColumns=e,t.appendChild(d),d.column=a,d.index=n,l._columnToElement.set(a,d),a.columns){const e=d.querySelector(".smart-kanban-column-content-columns"),t=document.createElement("div");t.className="smart-kanban-tab-strip",t.setAttribute("role","tablist"),e.appendChild(t),l._createColumnElementsTabs(a.columns,e,e,t)}s||(a.collapsed?(d.classList.add("collapsed"),o.push("auto")):o.push("1fr"),i.push("1fr")),l._allColumns.push(a)})),!s){if(l.addNewColumn)if(l._appendAddNewColumn(t),l.columnWidth){let e="1fr";const t=e=>"number"==typeof e?e+"px":"string"==typeof e?e:void 0;e=t(l.addNewColumnWidth?l.addNewColumnWidth:l.columnWidth),o.push(e)}else o.push("var(--smart-kanban-add-new-column-width)");a.style.gridTemplateColumns=o.join(" "),a.fractions=i,l._columnContainers.push(a)}}_createColumnElementsSwimlanes(e,t,a){const s=this,l=s.id,r=s.swimlanes,o=[],i=[];if(e&&(e=e.filter((e=>{if(!1!==e.visible)return!0}))),e.forEach(((a,n)=>{const d=document.createElement("div");let c=`${s._getColumnHeader(a,n<e.length-1)}\n <div class="smart-kanban-column-content no-sub-columns" role="presentation"></div>`;d.className="smart-kanban-column",d.setAttribute("role","group"),d.setAttribute("aria-labelledby",`${l}ColumnHeaderLabel${a.dataField}`),d.setAttribute("orientation",a.orientation),a.collapsible&&d.setAttribute("collapsible",""),a.addNewButton&&d.setAttribute("add-new-button",""),d.innerHTML=c,d.siblingColumns=e;const u=d.children[1];let m="";if(s._hasSwimlane(n)){let e=[];for(let t=0;t<r.length;t++)m+=`<smart-scroll-viewer class="smart-kanban-column-content-tasks" swimlane="${r[t].dataField}"${s._rtlAttr}${s._tabindex} role="list"></smart-scroll-viewer>`,e.push("1fr");d.classList.add("has-swimlane"),u.classList.add("has-swimlane"),u.style.gridTemplateRows=e.join(" ")}else m=`<smart-scroll-viewer class="smart-kanban-column-content-tasks"${s._rtlAttr}${s._tabindex} role="list"></smart-scroll-viewer>`;u.innerHTML=m,t.appendChild(d),d.column=a,d.index=n,s._columnToElement.set(a,d),a.collapsed?(d.classList.add("collapsed"),o.push("auto")):o.push("1fr"),i.push("1fr"),s._allColumns.push(a)})),s.addNewColumn)if(s._appendAddNewColumn(t),s.columnWidth){let e="1fr";const t=e=>"number"==typeof e?e+"px":"string"==typeof e?e:void 0;e=t(s.addNewColumnWidth?s.addNewColumnWidth:s.columnWidth),o.push(e)}else o.push("var(--smart-kanban-add-new-column-width)");a.style.gridTemplateColumns=o.join(" "),a.fractions=i,s._columnContainers.push(a)}_getColumnSummary(e){const t=this.getColumnDataItems(e.dataField);return this.columnSummary&&t.length?" ("+t.length+")":""}_getColumnHeaderTemplate(e,t){const a=e.headerTemplate||this.columnHeaderTemplate;if(a){const s=document.createElement("div");let l;if("string"==typeof a&&a.startsWith("#")?l=document.querySelector(a):"string"==typeof a&&(l=a),"function"==typeof a){const s=a(e,t);return s||t}if(l instanceof HTMLTemplateElement){s.appendChild(l.content.cloneNode(!0));const t=/{{\w+}}/g;let a=s.innerHTML;const r=t.exec(a);for(let t=0;t<r.length;t++){const t=e[r[0].replace("{{","").replace("}}","")];a=a.replace(r[0],t)}return a}return l instanceof HTMLElement?s.appendChild(l):s.innerHTML=l,s.innerHTML}return null}_getColumnHeader(e,t,a=1){const s=this,l=s._tabindex,r=e.collapsed?s.localize("expand"):s.localize("collapse"),o=s.localize("addNewTask"),i=s.allowColumnEdit||s.allowColumnRemove||s.allowColumnHide?"settings":"",n=s.localize("customizeColumn");let d=e.label;""===d&&(d="&nbsp;");const c=s._getColumnSummary(e);let u=`<span class="smart-kanban-title">${d}</span><span class='summary'>${c}</span>`,m="smart-kanban-column-header-label";if(void 0!==e.color&&s.columnColors){if(e.color){const t=new Smart.Color(e.color).getInvertedColor();u=`<div class="heading" style="background: ${e.color}; color: ${t};"><span class="smart-kanban-title">${d}</span><span class='summary'>${c}</span></div>`}else u=`<div class="heading"><span class="smart-kanban-title">${d}</span><span class='summary'>${c}</span></div>`;m+=" pill"}const p=null!==s.columnHeaderTemplate||e.headerTemplate?s._getColumnHeaderTemplate(e,u):u,h="bottom"===s.addNewButtonDisplayMode?"":"add-new-button";return`<div status="${e.dataField}" ${i} ${h} class="smart-kanban-column-header smart-unselectable"${l} role="heading" aria-level=${a}>\n <div title="${o}" class="smart-kanban-column-header-add ${h}"${l} role="button" aria-label="Add new task"></div>\n <div id="${s.id}ColumnHeaderLabel${e.dataField}" class="${m}">${p}</div>\n <div title="${r}" class="smart-kanban-column-header-toggle-button smart-arrow smart-arrow-${t?"left":"right"}" role="button" aria-hidden="true"></div>\n <div title="${n}" class="smart-kanban-column-actions smart-kanban-column-header-settings-button" role="button" aria-haspopup="menu" aria-label="Open actions list" aria-hidden="true"></div>\n </div>`}_hasSwimlane(e){const t=this;if(0===t.swimlanes.length)return!1;const a=t.swimlanesFrom;let s=t.swimlanesTo;return null===s&&(s=t.columns.length-1),e>=a&&e<=s}_updateColumnWidths(e,t){const a=this;if(!e&&!t)return void a._columnContainers.forEach((e=>a._updateColumnWidths(e.children[0].siblingColumns,e)));const s=t.fractions,l=[];let r=0,o=0;for(let t=0;t<e.length;t++){const i=e[t];!1!==i.visible&&(l.push(e[t].collapsed?"auto":s[r++]),!i.collapsed&&a.columnWidth&&(o+=i.width?i.width:a.columnWidth))}if(t===a.$.body&&a.addNewColumn)if(a.columnWidth){let e="1fr";const t=e=>"number"==typeof e?e+"px":"string"==typeof e?e:void 0;e=t(a.addNewColumnWidth?a.addNewColumnWidth:a.columnWidth),l.push(e)}else l.push("var(--smart-kanban-add-new-column-width)");o<a.offsetWidth&&a.columnWidth&&l.push("1fr"),t.style.gridTemplateColumns=l.join(" "),a.columnWidth&&a.$.scrollViewer.refresh()}_validateColumnArgument(e){if(!isNaN(e))return this.columns[e];const t=this._allColumns;return"string"==typeof e?t.find((t=>t.dataField===e)):"object"==typeof e?t.find((t=>t===e)):null}_resizeHandler(){this.$.scrollViewer&&(this.$.scrollViewer.scrollLeft=0),this.refresh("resize")}refresh(e){const t=this;"resize"===e?(clearTimeout(t._resizeTimeout),t._resizeTimeout=setTimeout((function(){t._allColumns.forEach((e=>t._refreshScrollViewer(e)))}),50),t._handleSwimlanes(!0)):(t.closePanel(),t._closeList(t._actionsList,"_actionSelectionFor"),t._closeList(t._columnActionsList,"_columnActionSelectionFor"),t._closeList(t._commentsList,"_commentSelectionFor"),t._closeList(t._userList,"_userSelectionFor"),t._closeList(t._priorityList,"_prioritySelectionFor"),t._resetFields=!0,t._render()),t.$.scrollViewer.refresh()}_refreshScrollViewer(e,t){const a=this,s=e instanceof HTMLElement?e:this._columnToElement.get(e);function l(l,r){if(!t&&l&&l.$.scrollViewerContentContainer&&""===l.$.scrollViewerContentContainer.innerHTML.trim())return a.virtualization&&a._refreshScrollHeight(l,e.dataField),void a._refreshEmptyColumnState(l);if(e.collapsed?l.toRefresh=!0:(delete l.toRefresh,requestAnimationFrame((()=>{if(l.isReady&&l.refresh(),void 0===e.dataField){const t=e.closest(".smart-kanban-column");if(t){const e=t.getAttribute("data-field");a._refreshScrollHeight(l,e)}}else a._refreshScrollHeight(l,e.dataField);0===r&&"horizontal"===e.orientation&&(a.columnWidth||(l.$.content.offsetWidth<=2*a._kanbanTaskMinWidth+a._dataViewPadding?s.setAttribute("orientation","vertical"):"vertical"===s.getAttribute("orientation")&&s.setAttribute("orientation","horizontal")))}))),a._refreshButtonsAndSummaries(),void 0===e.dataField){const t=e.closest(".smart-kanban-column");if(t){const e=t.getAttribute("data-field");a._refreshScrollHeight(l,e)}}else a._refreshScrollHeight(l,e.dataField)}e instanceof Smart.ScrollViewer?l(e):this.swimlanes.length>0?Array.from(s.querySelectorAll("smart-scroll-viewer")).forEach(((e,t)=>l(e,t))):l(s.querySelector("smart-scroll-viewer"),0)}_containerDownHandler(e){const t=this,a=t.isInShadowDOM||t.shadowRoot?e.originalEvent.composedPath()[0]:e.originalEvent.target,s=a.closest(".smart-kanban-task");if(delete t._preventSelection,t.allowColumnReorder){const l=a.closest(".smart-kanban-column-header")&&!a.classList.contains("smart-kanban-column-header-add")&&!a.classList.contains("smart-kanban-column-header-toggle-button");if(!s&&l&&!t._columnEditing){const s=a.closest(".smart-kanban-column");if(s){const a=e.originalEvent.composedPath();let l=0;for(let e=0;e<a.length;e++)a[e].classList&&a[e].classList.contains("smart-kanban-column")&&l++;s.column.reorder&&l<=1&&(t._columnDragDetails={x:e.pageX,y:e.pageY,event:e,kanbanColumn:s})}}}const l=a.closest(".smart-kanban-column"),r=a.closest(".smart-kanban-column-header")&&!a.classList.contains("smart-kanban-column-header-add")&&!a.classList.contains("smart-kanban-column-header-toggle-button"),o=l?l.column:null;if(o){if(r&&t.$.fireEvent("columnClick",{column:o}),new Date-t._clickTime<=300)return!s&&r&&!t._columnEditing&&t.allowColumnEdit&&(t._columnDragDetails=null,!1===o.collapsed&&o.editable&&"menu"!==t.columnEditMode&&t._handleColumnEditing(o.dataField)),void(r&&(o.collapsed?t.expand(o):(!t.allowColumnEdit||t.allowColumnEdit&&"menu"===t.columnEditMode)&&t.collapse(o),t.$.fireEvent("columnDoubleClick",{column:o})));t._clickTime=new Date}if(s&&3!==e.which){if(!s.data)return;if(t.taskSubTasksInput&&a.classList.contains("smart-kanban-task-input"))return;t.virtualization?(t.focusTask(s.data.id),t._refreshColumns()):t._focusTask(s),t._startDragging(s,e)}}_containerKeydownHandler(e){const t=this;if(t._dragDetails)return;const a=e.key,s=t.isInShadowDOM||t.shadowRoot?e.composedPath()[0]:e.target;function l(a=s){delete t._preventSelection,t._documentUpHandler({originalEvent:{target:a}}),t._containerClickHandler({target:a,ctrlKey:e.ctrlKey||e.metaKey,shiftKey:e.shiftKey}),e.preventDefault()}if(s.closest(".smart-kanban-column, .smart-kanban-add-new-column"))return s.classList.contains("smart-kanban-column-content-tasks")?void t._selectViaKeyboard(s.$.content,e,l):void("Enter"!==a&&" "!==a||s instanceof HTMLInputElement!=0||l());if(t.$.headerDropDown.contains(s))"Escape"===a&&(t.closePanel(),t.$[/\s?([a-z]+)-panel/g.exec(t.$.headerDropDown.className)[1]+"Button"].focus());else if(!(s.classList.contains("smart-data-view-header-button")||s.closest(".smart-data-view-search-box")||s.classList.contains("remove-button"))||"Enter"!==a&&" "!==a||l(),s.classList.contains("smart-kanban-list")){const r=s;switch(a){case"ArrowDown":t._selectListItem(t._getNextItem(r));break;case"ArrowUp":t._selectListItem(t._getPrevItem(r));break;case"Home":t._selectListItem(t._getFirstItem(r));break;case"End":t._selectListItem(t._getLastItem(r));break;case"Escape":r.openedFrom.focus(),t._closeList(r,r===t._actionsList?"_actionSelectionFor":r===t._commentsList?"_commentSelectionFor":"_userSelectionFor"),r===t._columnActionsList&&t._closeList(t._columnActionsList,"_columnActionSelectionFor");break;case"Enter":case" ":{const e=t._getSelectedItem(r);e&&l(e);break}default:return}e.preventDefault()}}getTaskIndex(e){const t=this,a=t.getTask(e);if(!a)return-1;const s=a[t.dataSourceMap.status];return t._getTasksByDataField(s).findIndex((t=>{if(t.id===e)return!0}))}_getNextPrevColumn(e,t){const a=this;let s=null;return a._allColumns.forEach(((l,r)=>{if(l.dataField===e)if(t){if(r<a._allColumns.length-1)return s=a._allColumns[r+1],!0}else if(r>0)return s=a._allColumns[r-1],!0})),s}focusTask(e){const t=this;t._focusedTask=e,t.ensureVisible(e),t._refreshColumns()}_selectViaKeyboard(e,t,a){const s=this;let l=t.key;s.rightToLeft&&("ArrowRight"===l?l="ArrowLeft":"ArrowLeft"===l&&(l="ArrowRight"));const r=s._focusedTask,o=s.getTask(r);if(!o)return;const i=o[s.dataSourceMap.status],n=s._getTasksByDataField(i),d=s.getTaskIndex(r);switch(l){case"ArrowRight":{const e=s._getNextPrevColumn(i,!0);if(e)if(s.virtualization){const t=s._getTasksByDataField(e.dataField);t.length>0&&s.focusTask(t[0].id)}else{const t=s._columnToElement.get(e),a=t.querySelector(".smart-kanban-task");s._focusTask(a),t.focus()}break}case"ArrowLeft":{const e=s._getNextPrevColumn(i,!1);if(e)if(s.virtualization){const t=s._getTasksByDataField(e.dataField);t.length>0&&s.focusTask(t[0].id)}else{const t=s._columnToElement.get(e).querySelector(".smart-kanban-task");s._focusTask(t)}break}case"ArrowDown":if(s.virtualization)d<n.length-1&&s.focusTask(n[d+1].id);else{const e=s.getColumn(i),t=s._columnToElement.get(e);s._focusTask(s._getNextItem(t,!0))}break;case"ArrowUp":if(s.virtualization)d>0&&s.focusTask(n[d-1].id);else{const e=s.getColumn(i),t=s._columnToElement.get(e);s._focusTask(s._getPrevItem(t,!0))}break;case"Home":s.virtualization?s.focusTask(n[0].id):s._focusTask(s._getFirstItem(e));break;case"End":s.virtualization?s.focusTask(n[n.length-1].id):s._focusTask(s._getLastItem(e));break;case"Enter":case" ":case"F2":case"Delete":{const e=s.querySelector("[focus]");e&&("F2"===l||"Enter"===l?s.beginEdit(e):"Delete"===l?s.removeTask(e,!0):a(e));break}default:return}t.preventDefault()}_getFirstItem(e){const t=e.children;for(let e=0;e<t.length;e++){const a=t[e];if(!a.hasAttribute("disabled")&&"none"!==getComputedStyle(a).display)return a}}_getLastItem(e){const t=e.children;for(let e=t.length-1;e>=0;e--){const a=t[e];if(!a.hasAttribute("disabled")&&"none"!==getComputedStyle(a).display)return a}}_getPrevItem(e,t){const a=this._getSelectedItem(e,t);let s=a?a.previousElementSibling:this._getLastItem(e);for(;s;){if(!s.hasAttribute("disabled")&&"none"!==getComputedStyle(s).display)return s;s=s.previousElementSibling}}_getNextItem(e,t){const a=this._getSelectedItem(e,t);let s=a?a.nextElementSibling:this._getFirstItem(e);for(;s;){if(!s.hasAttribute("disabled")&&"none"!==getComputedStyle(s).display)return s;s=s.nextElementSibling}}_getSelectedItem(e,t){return e?t?e.querySelector("[focus]"):e.querySelector(".selected"):null}_selectListItem(e){if(!e)return;const t=e.parentElement,a=t.querySelector(".selected");a&&(a.classList.remove("selected"),a.removeAttribute("aria-selected")),e.classList.add("selected"),e.setAttribute("aria-selected",!0),t.scrollTop=e.offsetTop}_focusTask(e){if(!e)return;const t=this;t._isMobile||(Array.from(t.querySelectorAll("[focus]")).forEach((e=>e.removeAttribute("focus"))),e.setAttribute("focus",""),this._focusedTask=e.data.id,t.virtualization?t.ensureVisible(t._focusedTask):this.ensureVisible(e))}_setFocusable(){const e=this,t=e.$.container,a=e.disabled||e.unfocusable;let s=[e.$.customizeButton,e.$.filterButton,e.$.sortButton,e.$.searchButton,e.$.searchPrev,e.$.searchNext,e.$.searchClose,e._actionsList,e._userList];if(s=s.concat(Array.from(t.querySelectorAll(".smart-kanban-column-header, .smart-kanban-column-header-add, .smart-kanban-tab, .smart-kanban-column-content-tasks, .smart-kanban-task-user, .smart-kanban-task-actions, .smart-kanban-task-comments, .smart-kanban-add-new-column"))),s.forEach((e=>{a?e.removeAttribute("tabindex"):(null===e.getAttribute("tabindex")||e.getAttribute("tabindex")<0)&&e.setAttribute("tabindex",0)})),e._dialog&&e._dialog.editPanelPopulated){const t=Array.from(e._dialog.$.container.querySelectorAll(".text-editor, .new-subtask"));a?t.forEach((e=>e.tabIndex=-1)):t.forEach((e=>e.removeAttribute("tabindex"))),Array.from(e._dialog.$.container.querySelectorAll(".smart-element.editor, smart-button.add, smart-button.ok, smart-button.cancel")).forEach((e=>e.unfocusable=a)),e._dialog.unfocusable=a}}_startDragging(e,t){const a=this;if(!a._currentUser.allowDrag)return;a._isMobile;const s=e.closest("smart-scroll-viewer"),l=e.getBoundingClientRect();let r=e.hasAttribute("selected")?Array.from(e.parentElement.querySelectorAll("[selected]")):[e],o=r.map((e=>e.data));a._dragDetails={StartPosition:{left:t.pageX,top:t.pageY},Items:r,ItemsData:o,ItemData:e.data,Item:e,FeedbackShown:!1,OriginalEvent:t,Column:e.classList.contains("smart-kanban-column")?e:null,PointerOffset:[l.x-t.clientX,l.y-t.clientY],ScrollViewer:s,StartTime:new Date,Dragging:!0},Smart.Kanban.kanbanTaskDragged=!0,s&&s._scrollView&&(s._scrollView.disableSwipeScroll=!0),a.allowDrop&&(Smart.Kanban.hoveredKanban=a,Smart.Kanban.hoveredItem=e)}_documentMoveHandler(e){const t=this,a=t._dragDetails;function s(){delete t._dragDetails,delete Smart.Kanban.kanbanTaskDragged,delete Smart.Kanban.hoveredKanban,delete Smart.Kanban.hoveredItem,a.ScrollViewer._scrollView.disableSwipeScroll=!1}if(t.allowColumnReorder&&t._columnDragDetails&&(Math.abs(e.pageX-t._columnDragDetails.x)>=3||Math.abs(e.pageY-t._columnDragDetails.y)>=3)&&(t._startDragging(t._columnDragDetails.kanbanColumn,t._columnDragDetails.event),t._columnDragDetails=null),!a)return;if(!a.FeedbackShown){const l=(new Date).getTime()-a.StartTime.getTime()>500,r=Math.abs(a.StartPosition.left-e.pageX)>5||Math.abs(a.StartPosition.top-e.pageY)>5;if(!r||!(!t._isMobile||t._isMobile&&l))return void(t._isMobile&&r&&!l&&s());if(t.$.fireEvent("dragStart",{item:a.Item,items:a.Items,data:a,container:t,previousContainer:t,originalEvent:a.OriginalEvent}).defaultPrevented)return void s();t.closePanel(),t._hideBodyOverflow(),a.Feedback=t._addDragFeedback(),a.FeedbackShown=!0,a.Items.forEach((e=>e.classList.add("dragged")))}const l=a=>{a.scrollWidth&&(t._autoScrollDragInterval&&clearInterval(t._autoScrollDragInterval),t._autoScrollDragInterval=setInterval((function(){const t=a.getBoundingClientRect();e.clientX<=t.left+20?a.scrollLeft-=15:e.clientX>=t.left+t.width-20&&(a.scrollLeft+=15)}),25))};Smart.Kanban.hoveredKanban?l(Smart.Kanban.hoveredKanban.$.scrollViewer):l(t.$.scrollViewer);let r,o=t.dragOffset;if(o="auto"!==o&&Array.isArray(o)?o:a.PointerOffset,t.$.fireEvent("dragging",{item:a.Item,items:a.Items,data:a,originalEvent:e}),a.Feedback.style.left=e.pageX+(o[0]||0)+"px",a.Feedback.style.top=e.pageY+(o[1]||0)+"px",Smart.Kanban.hoveredKanban&&(clearInterval(Smart.Kanban.hoveredKanban._dragInterval),delete Smart.Kanban.hoveredKanban),Smart.Kanban.hoveredItem&&(Smart.Kanban.hoveredItem.classList.remove("drop-target"),Smart.Kanban.hoveredItem.classList.remove("before","after"),delete Smart.Kanban.hoveredItem),r=t._isMobile?(t.shadowRoot||t.getRootNode()).elementFromPoint(e.clientX,e.clientY):t.isInShadowDOM||t.shadowRoot?e.originalEvent.composedPath()[0]:e.originalEvent.target,!r)return;const i=(t.shadowRoot?r.getRootNode().host:r).closest("smart-kanban");if(!i||!i.allowDrop)return;const n=r.closest(".smart-kanban-column-content-tasks");if(Smart.Kanban.hoveredKanban=i,a.Column)return void t._handleColumnDragging(e);if(!n)return;const d=n.parentElement.parentElement.getAttribute("orientation"),c=Array.from(n.$.content.children);let u=0;if(c.forEach((e=>e.filteredOut&&u++)),0===c.length||c.length===u)return Smart.Kanban.hoveredItem=n.$.scrollViewerContainer,void Smart.Kanban.hoveredItem.classList.add("drop-target");n.scrollHeight>0&&(i._dragInterval=setInterval((function(){const a=n.getBoundingClientRect();a.left<=e.clientX&&a.left+a.width>=e.clientX?e.clientY>=a.top&&e.clientY<=a.top+20?n.scrollTop-=t._autoScrollCoefficient:e.clientY>=a.top+a.height-20&&e.clientY<=a.top+a.height?n.scrollTop+=t._autoScrollCoefficient:clearInterval(i._dragInterval):clearInterval(i._dragInterval)}),2));let m=r.closest(".smart-kanban-task");if(m&&-1===a.Items.indexOf(m)){const t=m.getBoundingClientRect();"vertical"===d&&e.clientY-t.top<=t.height/2||"horizontal"===d&&e.clientX-t.left<=t.width/2?m.classList.add("before"):m.classList.add("after")}else{if(m&&1===c.length)return;m=m&&1===a.Items.length?t[`_${d}ClosestTaskToHover`]([m.previousElementSibling,m.nextElementSibling],e,!0):t[`_${d}ClosestTaskToHover`](c,e,m||r===n.$.content)}m&&(m.classList.add("drop-target"),Smart.Kanban.hoveredItem=m)}_handleColumnDragging(e){const t=this.querySelectorAll(".smart-kanban-column");let a;for(let s=0;s<t.length;s++){const l=t[s],r=l.getBoundingClientRect();e.clientX>=r.left&&e.clientX<=r.right&&e.clientY>=r.top&&e.clientY<=r.bottom&&(a=l)}if(a){const s=a.getBoundingClientRect();e.clientX-s.left<=s.width&&(a.classList.add("before"),a.classList.add("drop-target")),e.clientX-s.left>=s.width/2&&a===t[t.length-1]&&(a.classList.remove("before"),a.classList.add("after"),a.classList.add("drop-target")),Smart.Kanban.hoveredItem=a}}_hideBodyOverflow(){const e=this,t=(document.scrollingElement||document.documentElement).scrollHeight>document.documentElement.clientHeight,a=(document.scrollingElement||document.documentElement).scrollWidth>document.documentElement.clientWidth,s=e.isInShadowDOM?e.getRootNode().host:document.body;e._originalBodyOverflow={overflowX:s.style.overflowX,overflowY:s.style.overflowY,overflow:s.style.overflow},s.classList.add("smart-dragging"),s.style.overflow=s.style.overflowX=s.style.overflowY="",t&&!a?s.style.overflowX="hidden":a&&!t?s.style.overflowY="hidden":a||t||(s.style.overflow="hidden")}_verticalClosestTaskToHover(e,t,a){const s=this._dragDetails.Items,l=t.clientY;let r,o,i=1/0,n=0,d=e.length-1,c=1;for(a||(n=d,d=0,c=-1);n!==d+c;){const t=e[n];if(n+=c,!t||t.filteredOut||-1!==s.indexOf(t))continue;if(!a){r=t,o="after";break}const d=t.getBoundingClientRect(),u=d.top+d.height/2,m=Math.abs(l-u);if(!(m<i))break;i=m,r=t,o=l<=u?"before":"after"}return r&&r.classList.add(o),r}_horizontalClosestTaskToHover(e,t){const a=this._dragDetails.Items,s=t.clientY,l=t.clientX;let r,o,i;return e.forEach((e=>{if(!e||e.filteredOut||-1!==a.indexOf(e))return;const t=e.getBoundingClientRect(),n=Math.abs(s-t.top),d=Math.abs(s-t.bottom),c=Math.min(n,d),u=Math.abs(l-t.left),m=Math.abs(l-t.right),p=Math.min(u,m),h=Math.sqrt(Math.pow(p,2)+Math.pow(c,2));(void 0===o||h<o)&&(r=e,o=h,i=u<m?"before":"after")})),r&&r.classList.add(i),r}_scrollViewerTouchmoveHandler(e){const t=this;t._dragDetails&&(t.isInShadowDOM||t.shadowRoot?e.composedPath()[0]:e.target).closest("smart-scroll-viewer")&&e.cancelable&&(e.preventDefault(),e.stopPropagation())}_documentUpHandler(e){const t=this,a=t._dragDetails;if(t._columnDragDetails=null,t.$.container.hasAttribute("modal"))return;const s=t.isInShadowDOM||t.shadowRoot?e.originalEvent.composedPath()[0]:e.originalEvent.target,l=t.$.header;if(t._userSelectionFor&&!t._userList.contains(s)&&t._closeList(t._userList,"_userSelectionFor"),t._prioritySelectionFor&&!t._priorityList.contains(s)&&t._closeList(t._priorityList,"_prioritySelectionFor"),t._actionSelectionFor&&!t._actionsList.contains(s)&&t._closeList(t._actionsList,"_actionSelectionFor"),t._columnActionSelectionFor&&!t._columnActionsList.contains(s)&&(t._columnActionsList.classList.contains("smart-visibility-hidden")||(t._closeList(t._columnActionsList,"_columnActionSelectionFor"),e.originalEvent.preventDefault(),e.originalEvent.stopPropagation(),t._columnActionsListDate=new Date)),t._commentSelectionFor){const e=t._commentsList;(t.shadowRoot||t.getRootNode()).activeElement!==e.textarea&&(t._actionSelectionFor||e.contains(s)?!e.classList.contains("expanded")||s===e.textarea||e.button.contains(s)||s.classList.contains("remove-button")||e.classList.remove("expanded"):t._closeList(e,"_commentSelectionFor"))}if(!("none"===t.headerPosition||t.$.headerDropDown.classList.contains("smart-visibility-hidden")||t.$.headerDropDown.classList.contains("search-panel")||s!==l&&l.contains(s))){const e=s.closest("smart-scroll-viewer"),a=s.closest(".smart-drop-down");e&&l.contains(e.ownerElement)||a&&(!a.ownerElement||l.contains(a.ownerElement))||t.closePanel()}if(!a)return;const r=Smart.Kanban.hoveredKanban,o=Smart.Kanban.hoveredItem;t._dragDetails&&e.originalEvent.preventDefault(),delete t._dragDetails,delete Smart.Kanban.kanbanTaskDragged,delete Smart.Kanban.hoveredKanban,delete Smart.Kanban.hoveredItem,delete Smart.Kanban.dropOverTask,delete Smart.Kanban.isBefore;let i=!1;if(document.querySelectorAll(".smart-kanban-task-placeholder").forEach((e=>{e.classList.remove("smart-kanban-task-placeholder"),e.style.marginTop=e.style.marginBottom="0px",i=!0})),i&&t._refreshButtonsAndSummaries(),a.ScrollViewer&&a.ScrollViewer._scrollView&&(a.ScrollViewer._scrollView.disableSwipeScroll=!1),!a.FeedbackShown)return;const n=r||(t.shadowRoot||t.getRootNode()).elementFromPoint(e.clientX,e.clientY);t._preventSelection=!0;const d=t.isInShadowDOM?t.getRootNode().host:document.body;d.classList.remove("smart-dragging"),d.style.overflow=t._originalBodyOverflow.overflow,d.style.eoverflowX=t._originalBodyOverflow.overflowX,d.style.overflowY=t._originalBodyOverflow.overflowY,delete t._originalBodyOverflow,a.Feedback.remove(),r&&clearInterval(r._dragInterval);const c=a.Item,u=a.Items;if(u.forEach((e=>e.classList.remove("dragged"))),!n)return;if(!o)return void t.$.fireEvent("dragEnd",{item:c,items:u,target:n,data:a,previousContainer:t,container:n,originalEvent:e});if(!r||!r.allowDrop||r.disabled)return;let m=!1;if(o.classList.remove("drop-target"),o.classList.contains("before")?o.classList.remove("before"):o.classList.contains("after")&&(o.classList.remove("after"),m=!0),a.DropDetails={item:o,after:m},t.$.fireEvent("dragEnd",{item:c,items:u,target:o,data:a,previousContainer:t,container:r,originalEvent:e}).defaultPrevented)return;function p(e,s){t._requestVirtualDataSource("update",Object.assign({},e.data,{status:s}),(function(s){return s&&t._moveDraggedItems(Object.assign({},a,{Item:e,Items:[e]})),s}))}const h=o.closest(".smart-kanban-column"),g=h.column.dataField;if(a.Column){const e=()=>Array.from(h.parentElement.querySelectorAll(".smart-kanban-column")).filter((e=>e.parentElement===h.parentElement)),s=e().indexOf(a.Column);a.DropDetails.after?h.parentElement.appendChild(a.Column):h.parentElement.insertBefore(a.Column,h);const l=e().indexOf(a.Column),r=[],o=e();for(let e=0;e<o.length;e++)o[e].column&&!o[e].classList.contains("smart-kanban-add-new-column")&&r.push(o[e].column);return t.columns=r,t.$.fireEvent("columnReorder",{column:a.Column.column,oldIndex:s,index:l}),t._reset(),void t._createAddNewButton()}if(c&&c.data&&g!==c.data[t.dataSourceMap.status]){const e=Object.assign({},c.data);e[t.dataSourceMap.status]=g;const a=t.getColumn(g);a&&(e.statusLabel=a.label);const s=t.getColumn(c.data[t.dataSourceMap.status]);s&&(c.data.statusLabel=s.label);const l=JSON.parse(JSON.stringify(e)),r=JSON.parse(JSON.stringify(c.data));if(t.$.fireEvent("change",{task:c,id:l.id,value:l,oldValue:r}),t._currentUser.info){const e=t.dataSourceMap;c.data[e.updatedUserId]=t._currentUser.info.id,c.data[e.updatedDate]=new Date,t.addHistory(c.data,{action:"moved",user:t._currentUser.info.id,details:{id:c.data[e.id],oldValue:r[e.status],value:l[e.status]},label:c.data[e.text],date:c.data[e.updatedDate]}),l.history=c.data.history}t.$.fireEvent("taskUpdate",{id:l.id,value:l,oldValue:r})}if(t.dataSource&&t.dataSource.virtualDataSource&&g!==c.data[t.dataSourceMap.status])if(m)for(let e=u.length-1;e>=0;e--)p(u[e],g);else for(const e of u)p(e,g);else if(t._moveDraggedItems(a),c&&c.data){const e=Object.assign({},c.data),a=JSON.parse(JSON.stringify(e));t.$.fireEvent("taskReorder",{id:a.id,value:a})}}_refreshButtonsAndSummaries(){const e=this;e._refreshColumnHeights(),e.addNewButtons&&(e.addNewButtons.forEach((e=>{e.refresh()})),e._refreshSummaries())}_addDragFeedback(){const e=this,t=e._dragDetails.Item,a=e._dragDetails.Items.length,s=document.createElement("div"),l=t.offsetWidth+"px",r=t.offsetHeight+"px";let o=t.cloneNode(!0);if(o.style.width=l,o.style.height=r,t.classList.contains("smart-kanban-column")){o=document.createElement("smart-kanban");const a=Object.assign({},t.column);a.collapsed=!1;const r=[a];o.columns=r,o.dataSource=e.dataSource,o.users=e.users,o.taskActions=e.taskActions,o.taskDue=e.taskDue,o.taskProgress=e.taskProgress,o.style.height="100%",o.style.width=l,o.style.minWidth="250px",s.setAttribute("column-drag","")}if(s.className="smart-kanban-feedback",s.setAttribute("parent-kanban-id",e.id),e.theme&&s.setAttribute("theme",e.theme),["rightToLeft","taskActions","taskComments","taskDue","taskPriority","taskProgress","taskTags","taskUserIcon"].forEach((t=>{e[t]&&s.setAttribute(Smart.Utilities.Core.toDash(t),"")})),s.appendChild(o),a>1){const e=document.createElement("div");e.style.width=l,e.style.height=r,e.className="smart-kanban-feedback-additional",s.insertBefore(e,o),o.setAttribute("num",a),a>2&&e.classList.add("multiple")}return e.getShadowRootOrBody().appendChild(s),s}_moveDraggedItems(e){const t=this,a=t.dataSourceMap;let s,l=e.DropDetails,r=l.item,o=r.closest(".smart-kanban-column"),i=e.Item.closest("smart-scroll-viewer"),n=o.column;if(r.classList.contains("smart-kanban-task")?(s=r.parentElement,l.after&&(r=r.nextElementSibling,r&&r.classList.contains("smart-hidden")&&(r=null)),e.Items.forEach(((l,o)=>{if(t.virtualization){const s=e.ItemsData[o],i=s[a.status],d=t._getTasksByDataField(i),c=d.findIndex((e=>e.id===s.id));if(r){if(r.data!==l.data){d.splice(c,1);const e=t._getTasksByDataField(n.dataField),a=e.indexOf(r.data);e.splice(a,0,s)}}else c>=0&&(d.splice(c,1),t._getTasksByDataField(n.dataField).push(s))}else{s.insertBefore(l,r);const i=e.ItemsData[o],d=i[a.status],c=t._getTasksByDataField(d),u=c.findIndex((e=>e.id===i.id));if(r){if(r.data!==l.data){c.splice(u,1);const e=t._getTasksByDataField(n.dataField),a=e.indexOf(r.data);e.splice(a,0,i)}}else u>=0&&(c.splice(u,1),t._getTasksByDataField(n.dataField).push(i))}l.data[a.status]=n.dataField,l.data.statusLabel=n.label,l.column=n}))):(s=r.firstElementChild,e.Items.forEach((e=>{if(t.virtualization){const s=e.data[a.status],l=t._getTasksByDataField(s),r=l.findIndex((t=>t.id===e.data.id));l.splice(r,1),t._getTasksByDataField(n.dataField).push(e.data)}else{s.appendChild(e);const l=e.data[a.status],r=t._getTasksByDataField(l),o=r.findIndex((t=>t.id===e.data.id));r.splice(o,1),t._getTasksByDataField(n.dataField).push(e.data)}e.data[a.status]=n.dataField,e.data.statusLabel=n.label,e.column=n}))),s=s.closest("smart-scroll-viewer"),t.swimlanes.length>0){const t=s.getAttribute("swimlane");t?e.Items.forEach((e=>e.data[a.swimlane]=t)):e.Items.forEach((e=>delete e.data[a.swimlane]))}t.virtualization?(t._refreshColumns(),t.focusTask(e.ItemData.id)):t._focusTask(e.Item),i!==s?(s.focus(),t.textTemplate&&e.Items.forEach((e=>t._renderTask(e))),e.Item.hasAttribute("selected")&&(e.Items.forEach((e=>e.removeAttribute("selected"))),t._selectedTasks=[],t._autoSaveState("selection")),t._refreshScrollViewer(i,!0),t._refreshScrollViewer(s,!0)):t.virtualization&&t._refreshScrollViewer(i,!0),t._refreshSummaries(),t._autoSaveState("dataSource")}_getCurrentDataSource(){const e=Array.from(this.$.container.getElementsByClassName("smart-kanban-task")),t=[],a=this;if(a.virtualization){const e=Object.keys(a.tasksByDataField);let t=[];for(let s=0;s<e.length;s++){const l=e[s];let r=a._getTasksByDataField(l);t=[...t,...r]}return t}for(let a=0;a<e.length;a++)t.push(e[a].data);return t}_validateTaskArgument(e){const t=this;return e instanceof HTMLElement&&t.$.container.contains(e)&&e.classList.contains("smart-kanban-task")?e:null===e||"number"!=typeof e&&"string"!=typeof e?null!==e&&"object"==typeof e&&void 0!==e.id?t.$.container.querySelector(`.smart-kanban-task[data-id="${e.id}"]`):void 0:t.$.container.querySelector(`.smart-kanban-task[data-id="${e}"]`)}_openDialog(e,t,a="task"){const s=this,l={purpose:t};if(l[a]=e,window.smartBlazor&&(l[a]=e.data),s.$.fireEvent("opening",l).defaultPrevented)return;if(s.disableDialog)return;s._dialog||s._createDialog();const r=s._dialog,o="prompt"===t;r.refreshFieldsDirty=!0,r.openedFrom=(s.shadowRoot||s.getRootNode()).activeElement,r.classList.toggle("prompt",o),r.classList.toggle("edit",!o),r.style.top="",r.style.left="",r.style.width="",r.style.height="auto","edit"!==t||!s.readonly&&s._currentUser.allowEdit?r.removeAttribute("readonly"):r.setAttribute("readonly",""),s.offsetWidth<600&&(r.style.top="0px",r.style.left="0px",r.style.width="100%",r.style.height="100%");const i=e=>{s.applyColumnColorToTasks&&(e&&e.color?(r.style.setProperty("--smart-primary",e.color),r.style.setProperty("--smart-ui-state-active",e.color)):(r.style.setProperty("--smart-primary",""),r.style.setProperty("--smart-ui-state-active","")))};if(e&&e.column?i(e.column):"add"===t&&i(e),r.taskOrComment=e,"edit"===t?s._currentUser&&s._currentUser.allowRemove&&r.querySelector(".delete").classList.remove("smart-hidden"):r.querySelector(".delete").classList.add("smart-hidden"),r.editPanelPopulated&&(r.selectTab(0),r.editors.historyTab&&r.editors.historyTab.classList.add("smart-hidden")),o){let t="task"===a?s.localize("promptTask",{taskText:e.data[s.dataSourceMap.text]}):s.localize("promptComment"),l="task"===a?s.localize("removeTask",{taskText:e.data[s.dataSourceMap.text]}):s.localize("removeComment");"column"===a&&(t=s.localize("promptColumn"),l=s.localize("removeColumn")),r.label=l,r.setAttribute("aria-label",t),r.$.container.querySelector(".prompt").innerHTML=t}else{let a=!0;if(r.removeAttribute("aria-label"),r.headerPosition="top",r.editPanelPopulated||(s._initEditPanel(),a=!1),"edit"===t)s._beginEdit(e);else if("add"===t){r.label=s.localize("addNewTask"),delete r.taskOrComment,a&&s._clearEditors();const t=s.tags.length>0?[...s.tags,...s._customTags]:s._customTags;r.editors.tags.dataSource=t,s._showHideDialogEditors(),r.refreshTabs(!1),r.selectTab(0),r.editors.status.selectedValues=[e.dataField],0===s.swimlanes.length?(r.editors.swimlane.classList.add("smart-hidden"),r.editors.swimlaneLabel.classList.add("smart-hidden"),r.editors.swimlane.parentElement.classList.add("single-column")):(r.editors.swimlane.classList.remove("smart-hidden"),r.editors.swimlaneLabel.classList.remove("smart-hidden"),r.editors.swimlane.parentElement.classList.remove("single-column")),r.editors.created.parentElement.classList.add("smart-hidden"),r.editors.updated.parentElement.classList.add("smart-hidden")}}s.$.container.setAttribute("modal","");const n=s.offset(s);s.offsetWidth>600&&(r.offsetHeight>s.offsetHeight?r.style.top=s.getBoundingClientRect().top+"px":r.style.top=n.top+s.offsetHeight/2-r.offsetHeight/2+"px",r.offsetWidth>s.offsetWidth?r.style.left=s.getBoundingClientRect().left+"px":r.style.left=n.left+s.offsetWidth/2-r.offsetWidth/2+"px"),s.dialogCustomizationFunction&&s.dialogCustomizationFunction(r,e,r.editors,r.labels,t,a),r.open()}_createDialog(){const e=this,t=document.createElement("smart-window"),a=document.createElement("template"),s=` animation="${e.animation}"${e._rtlAttr} theme="${e.theme}"${e.unfocusable?" unfocusable":""}`;a.innerHTML=`<smart-button class="ok primary"${s}><span class="smart-icon"></span>${e.localize("ok")}</smart-button>\n<smart-button class="cancel"${s}><span class="smart-icon"></span>${e.localize("cancel")}</smart-button><smart-button class="smart-hidden delete secondary"${s}><span class="smart-icon"></span>${e.localize("delete")}</smart-button>`,t.animation=e.animation,t.footerTemplate=a,t.headerButtons=["close"],t.rightToLeft=e.rightToLeft,t.resizeMode="both",t.liveResize=!0,t.theme=e.theme,t.className="smart-kanban-window",t.innerHTML='<div class="prompt"></div>\n<div class="edit"></div>',t.ownerElement=e,e._dialog=t,e._addDialogHandlers(),e.getShadowRootOrBody().appendChild(t)}_addDialogHandlers(){const e=this,t=e._dialog;t.addEventListener("open",e._dialogEventHandler),t.addEventListener("closing",e._dialogEventHandler),t.addEventListener("close",e._dialogEventHandler),t.addEventListener("click",e._dialogClickHandler),t.addEventListener("keydown",(e=>{if("Enter"===e.key){const e=t.querySelector(".ok"),a=t.querySelector('.smart-kanban-tab[view="details"]');a&&a.classList.contains("selected")&&(e.disabled||e.click())}}))}_dialogEventHandler(e){const t=this,a=t.ownerElement,s=e.type,l=a.context;(t.isInShadowDOM||t.shadowRoot?e.composedPath()[0]:e.target)===t&&(a.context=a,"open"===s?(a.$.fireEvent("open"),t.classList.contains("edit")&&(a.hasAnimation?t.addEventListener("transitionend",(function(){setTimeout((()=>{!a.readonly&&a._currentUser.allowEdit&&t.editors.text.focus()}),100)}),{once:!0}):requestAnimationFrame((()=>t.editors.text.focus())))):"closing"===s?a.$.fireEvent("closing").defaultPrevented&&(e.preventDefault(),delete t.ok):"close"===s&&(a.$.fireEvent("close"),a._dialogCloseHandler(e)),a.context=l)}_dialogClickHandler(e){const t=this,a=t.isInShadowDOM||t.shadowRoot?e.composedPath()[0]:e.target;if(a.closest(".ok"))t.ok=!0,t.close();else if(a.closest(".cancel"))t.close();else if(a.closest(".delete"))t.ownerElement.removeTask(t.taskOrComment),t.close();else if(a.closest(".add")){const e=t.editors.newSubtask,a=e.value;if(""===a)return;const s=t.editors.checklist;s.insert(s.items.length,{label:a}),e.value="",t.$.content.scrollTop=t.$.content.scrollHeight-t.$.content.offsetHeight,t.refreshTabs()}else if(a.classList.contains("remove-subtask"))t.editors.checklist.removeChild(a.closest("smart-list-item")),t.refreshTabs();else if(a.classList.contains("remove-button")){const e=t.ownerElement,s=t.ownerElement.dataSourceMap,l=t.taskOrComment.data[s.comments],r=a.closest(".smart-comment").comment,o=JSON.parse(JSON.stringify(t.taskOrComment.data));t.taskOrComment.comment=r,t.taskOrComment.data[s.comments]=l.filter((e=>e!==t.taskOrComment.comment)),t.refreshComments();const i=JSON.parse(JSON.stringify(t.taskOrComment.data));e.$.fireEvent("change",{task:t.taskOrComment,id:i.id,value:i,oldValue:o}),e.$.fireEvent("taskUpdate",{id:i.id,value:i,oldValue:o}),e.$.fireEvent("commentRemove",{id:i.id,value:t.taskOrComment.comment})}}_dialogCloseHandler(){const e=this,t=e.dataSourceMap,a=e._dialog;function s(s){const l=JSON.parse(JSON.stringify(s.data));a.taskOrComment.remove(),s.querySelector(".smart-kanban-task-comments").setAttribute("num",s.data[t.comments].length||""),e._commentsList.editing&&(e._commentsList.textarea.value="",delete e._commentsList.editing);const r=JSON.parse(JSON.stringify(s.data));e.$.fireEvent("change",{task:s,id:r.id,value:r,oldValue:l}),e.$.fireEvent("taskUpdate",{id:r.id,value:r,oldValue:l}),e.$.fireEvent("commentRemove",{id:r.id,value:a.taskOrComment.comment})}if(e.$.container.removeAttribute("modal"),a.ok){if(a.classList.contains("prompt")){const l=e._commentSelectionFor;if(l){const r=l.data;if(e.dataSource&&e.dataSource.virtualDataSource){const o=Object.assign({},r);o[t.comments]=o[t.comments].filter((e=>e!==a.taskOrComment.comment)),e._requestVirtualDataSource("update",o,(function(e){return e&&(l.data=o,s(l)),e}))}else r[t.comments]=r[t.comments].filter((e=>e!==a.taskOrComment.comment)),s(l)}else e._columnActionSelectionFor&&a.taskOrComment.dataField?e.removeColumn(a.taskOrComment.dataField):e.removeTask(a.taskOrComment)}else e._endEdit();delete a.ok}a.openedFrom&&requestAnimationFrame((()=>{e.getRootNode().contains(a.openedFrom)&&a.openedFrom.focus&&a.openedFrom.focus(),delete a.openedFrom})),delete a.taskOrComment}_closeDialog(){const e=this;e._dialog&&e._dialog.close()}_getHistoryItemLabel(e){const t=this;let a;switch(e.action){case"created":a=t.localize("taskCreated");break;case"tags":a=t.localize("taskTagsChanged");break;case"description":a=t.localize("taskDescriptionChanged");break;case"progress":a=t.localize("taskProgressChanged");break;case"text":a=t.localize("taskNameChanged");break;case"color":a=t.localize("taskColorChanged");break;case"priority":a=t.localize("taskPriorityChanged");break;case"deadline":a=t.localize("taskDeadlineChanged");break;case"subtasks":a=t.localize("taskSubtasksChanged");break;case"user":a=e.details.value?t.localize("taskUserChanged"):t.localize("taskUserRemoved");break;case"moved":a=t.localize("taskMoved");break;case"status":a=t.localize("taskStatusChanged");break;default:a=t.localize("taskUpdated")}return a}_initEditPanel(){const e=this,t=e.id,a=e._dialog,s=a.$.container.querySelector(".edit"),l=[""].concat(e.users.map((e=>({label:e.name,value:e.id,color:e.color,image:e.image})))),r=e._allColumns.map((e=>({color:e.color,label:e.label,value:e.dataField}))),o=e._getPriority(),i=e.swimlanes.map((e=>({label:e.label,value:e.dataField}))),n=document.createElement("template"),d=` animation="${e.animation}"${e._rtlAttr} theme="${e.theme}"${e.unfocusable?" unfocusable":""}`;n.innerHTML=`<div class="smart-kanban-sub-task"><span class="label">{{label}}</span><span class="remove-subtask" aria-label="Remove subtask" title="${e.localize("removeSubtask")}"></span></div>`,n.id=e.id+"ChecklistTemplate",a.$.container.appendChild(n),s.innerHTML=`\n <div tabindex="0" class="smart-kanban-tab-strip">\n <div tabindex="0" view="details" class="selected smart-kanban-tab"><div class="smart-kanban-tab-label">${e.localize("detailsTab")}</div></div>\n <div tabindex="0" view="subtasks" class="smart-kanban-tab"><div class="smart-kanban-tab-label">${e.localize("subtasksTab")}</div></div>\n <div tabindex="0" view="comments" class="smart-kanban-tab"><div class="smart-kanban-tab-label">${e.localize("commentsTab")}</div></div>\n <div tabindex="0" view="history" class="smart-kanban-tab smart-hidden"><div class="smart-kanban-tab-label">${e.localize("historyTab")}</div></div>\n <div tabindex="0" view="fields" class="smart-kanban-tab smart-hidden"><div class="smart-kanban-tab-label">${e.localize("fieldsTab")}</div></div>\n </div>\n <div class="smart-kanban-tab-content details">\n <div class="layout">\n <div class="column">\n <div id="${t}LabelText" class="editor-label">${e.localize("text")}</div>\n <smart-input class="editor text-editor" aria-labelledby="${t}LabelText"></smart-input>\n <div id="${t}LabelDescription" class="editor-label">${e.localize("description")}</div>\n <textarea class="editor description-editor" aria-labelledby="${t}LabelDescription"></textarea> \n <div id="${t}LabelStatus" class="editor-label">${e.localize("status")}</div>\n <smart-multi-combo-input single-select pills color-items class="editor status-editor" drop-down-open-position="auto" data-source='${JSON.stringify(r)}' drop-down-button-position="right" readonly${d} aria-labelledby="${t}LabelStatus"></smart-multi-combo-input>\n <div id="${t}LabelSwimlane" class="editor-label swimlane-label">${e.localize("swimlane")}</div>\n <smart-input class="editor swimlane-editor" drop-down-open-position="auto" data-source='${JSON.stringify(i)}'${0===i.length?" disabled":""} drop-down-button-position="right" readonly${d} aria-labelledby="${t}LabelSwimlane"></smart-input>\n </div>\n <div class="column">\n <div class="editor-container">\n <div id="${t}LabelAssignedTo" class="editor-label">${e.localize("assignedTo")}</div>\n <div id="${t}LabelProgress" class="editor-label">${e.localize("progress")}</div>\n <smart-multi-combo-input readonly pills class="editor asignee-editor" single-select data-source='${JSON.stringify(l)}'${0===l.length?" disabled":""} drop-down-button-position="right"${d} aria-labelledby="${t}LabelAssignedTo"></smart-multi-combo-input>\n <smart-numeric-text-box class="editor progress-editor" input-format="floatingPoint" min="0" max="100" show-unit unit="%"${d} aria-labelledby="${t}LabelProgress"></smart-numeric-text-box>\n </div>\n <div class="editor-container">\n <div id="${t}LabelStartDate" class="editor-label">${e.localize("startDate")}</div>\n <div id="${t}LabelDueDate" class="editor-label">${e.localize("dueDate")}</div>\n <smart-date-time-picker auto-close auto-open class="editor start-date-editor" calendar-button drop-down-append-to="body" drop-down-display-mode="calendar" format-string="${e.formatStringDate}" nullable${d} value="null" aria-labelledby="${t}LabelStartDate"></smart-date-time-picker>\n <smart-date-time-picker auto-close auto-open class="editor due-date-editor" calendar-button drop-down-append-to="body" drop-down-display-mode="calendar" format-string="${e.formatStringDate}" nullable${d} value="null" aria-labelledby="${t}LabelDueDate"></smart-date-time-picker>\n </div>\n <div class="editor-error-container smart-hidden" style="color: var(--smart-error);">\n <label id="${t}LabelRange">${e.localize("invalidRange",{start:e.localize("startDate"),end:e.localize("dueDate")})}</label>\n <br/> <br/>\n </div>\n <div class="editor-container">\n <div id="${t}LabelPriority" class="editor-label">${e.localize("priority")}</div>\n <div id="${t}LabelColor" class="editor-label">${e.localize("color")}</div>\n <div style="display: flex;"><span class="priority-editor-icon"></span><smart-input class="editor priority-editor" data-source='${JSON.stringify(o)}' drop-down-height="auto" drop-down-open-position="auto" drop-down-button-position="right" readonly${d} aria-labelledby="${t}LabelPriority"></smart-input></div>\n <smart-color-input value-display-mode="colorBox" class="editor color-editor" drop-down-open-position="auto" drop-down-button-position="right"${d} aria-labelledby="${t}LabelColor"></smart-color-input>\n </div>\n <div id="${t}LabelTags" class="editor-label">${e.localize("tags")}</div>\n <div aria-labelledby="${t}LabelTags">\n <smart-multi-combo-input color-items readonly pills class="editor tags-editor" drop-down-button-position="right" drop-down-open-position="auto" ${d} aria-labelledby="${t}LabelTags"></smart-multi-combo-input>\n <div class="smart-hidden editor empty-tags-label" id="${t}LabelEmptyTags" aria-labelledby="${t}LabelTags">${e.localize("emptyTags")}</div>\n </div>\n </div>\n </div>\n </div>\n <div class="smart-kanban-tab-content smart-hidden subtasks">\n <div id="${t}LabelChecklist" class="editor-label">${e.localize("checklist")}</div>\n <div class="new-container">\n <input type="text" class="new-subtask" placeholder="${e.localize("newSubtask")}" />\n <smart-button class="add primary" title="${e.localize("addSubtask")}" aria-label="Add subtask"${d}>+</smart-button>\n </div>\n <smart-list-box class="editor checklist-editor" item-template="${n.id}" selection-mode="checkBox"${d} aria-labelledby="${t}LabelChecklist"></smart-list-box>\n <br/>\n </div>\n <div class="smart-kanban-tab-content comments">\n </div>\n <div class="smart-kanban-tab-content smart-hidden history">\n <div class="editor-container">\n <div id="${t}LabelCreatedBy" class="editor-label">${e.localize("createdBy")}</div>\n <div id="${t}LabelCreatedByDate" class="editor-label">${e.localize("createdByDate")}</div>\n <div class="editor created" aria-labelledby="${t}LabelCreatedBy"></div>\n <div class="editor created-date" aria-labelledby="${t}LabelCreatedByDate"></div>\n </div>\n <div class="editor-container">\n <div id="${t}LabelUpdatedBy" class="editor-label">${e.localize("updatedBy")}</div>\n <div id="${t}LabelUpdatedBy" class="editor-label">${e.localize("updatedByDate")}</div>\n <div class="editor updated" aria-labelledby="${t}LabelUpdatedBy"></div>\n <div class="editor updated-date" aria-labelledby="${t}LabelUpdatedByDate"></div>\n </div>\n <div class="history-table smart-hidden editor-container">\n </div>\n </div>\n <div class="smart-kanban-tab-content fields">\n </div> \n<div class="template-container">\n</div>\n`,a.layout=s.querySelector(".layout"),a.editors={text:s.querySelector(".text-editor"),description:s.querySelector(".description-editor"),tags:s.querySelector(".tags-editor"),emptyTags:s.querySelector(".empty-tags-label"),userId:s.querySelector(".asignee-editor"),status:s.querySelector(".status-editor"),swimlane:s.querySelector(".swimlane-editor"),swimlaneLabel:s.querySelector(".swimlane-label"),startDate:s.querySelector(".start-date-editor"),dueDate:s.querySelector(".due-date-editor"),progress:s.querySelector(".progress-editor"),priority:s.querySelector(".priority-editor"),priorityIcon:s.querySelector(".priority-editor-icon"),color:s.querySelector(".color-editor"),newSubtask:s.querySelector(".new-subtask"),checklist:s.querySelector(".checklist-editor"),template:s.querySelector(".template-container"),created:s.querySelector(".created"),createdDate:s.querySelector(".created-date"),updated:s.querySelector(".updated"),updatedDate:s.querySelector(".updated-date"),tabs:s.querySelector(".smart-kanban-tab-strip"),detailsTab:s.querySelector('[view="details"]'),commentsTab:s.querySelector('[view="comments"]'),subtasksTab:s.querySelector('[view="subtasks"]'),historyTab:s.querySelector('[view="history"]'),fieldsTab:s.querySelector('[view="fields"]')},a.labels={};for(let e in a.editors){const t=a.editors[e].getAttribute("aria-labelledby"),l=s.querySelector("#"+t);l&&(a.labels[e]=l)}a.tabs={all:a.editors.tabs,detail:a.editors.detailsTab,comments:a.editors.commentsTab,history:a.editors.historyTab,subtasks:a.editors.subtasksTab,fields:a.editors.fieldsTab};const c=()=>{a.editors.status.classList.contains("smart-hidden")&&a.editors.text.classList.contains("smart-hidden")&&a.editors.description.classList.contains("smart-hidden")?(a.editors.description.closest(".column").classList.add("smart-hidden"),a.editors.description.closest(".layout").classList.add("single-column")):e.dialogEditors&&3===e.dialogEditors.length&&e.dialogEditors.indexOf("text")>=0&&e.dialogEditors.indexOf("description")>=0&&e.dialogEditors.indexOf("status")>=0?a.editors.description.closest(".layout").classList.add("single-column"):(a.editors.description.closest(".column").classList.remove("smart-hidden"),a.editors.description.closest(".column").classList.remove("single-column"),a.editors.description.closest(".layout").classList.remove("single-column"))};a.showEditor=e=>{const t=e=>{if(e){const t=[...e.children];let a=0;for(let e=0;e<t.length;e++)t[e].classList.contains("smart-hidden")||a++;a===t.length&&e.classList.remove("single-column")}};a.editors[e]&&(a.editors[e].classList.remove("smart-hidden"),t(a.editors[e].closest(".editor-container"))),a.labels[e]&&(a.labels[e].classList.remove("smart-hidden"),t(a.labels[e].closest(".editor-container"))),"checklist"===e&&a.tabs.subtasks.classList.remove("smart-hidden"),c()},a.hideEditor=e=>{if(a.editors[e]){a.editors[e].classList.add("smart-hidden");const t=a.editors[e].closest(".editor-container");t&&t.classList.add("single-column")}a.labels[e]&&a.labels[e].classList.add("smart-hidden"),"checklist"===e&&a.tabs.subtasks.classList.add("smart-hidden"),c()};const u=a.editors.tabs.querySelectorAll(".smart-kanban-tab");a.selectTab=e=>{if(u[e]&&!u[e].classList.contains("smart-hidden")&&u[e].click(),0===e){const e=[...a.tabs.all.children];for(let t=0;t<e.length;t++)if(e[t]&&!e[t].classList.contains("smart-hidden")){e[t].click();break}}},a.refreshTabs=t=>{const s=a.taskOrComment?a.taskOrComment.data[e.dataSourceMap.comments]:0,l=s&&s.length?'<span class="summary"> ('+s.length+")</span>":"";let r=a.taskOrComment?a.taskOrComment.data[e.dataSourceMap.checklist]:0,o=r&&r.length?'<span class="summary"> ('+r.length+")</span>":"";t||(r=a.editors.checklist.items.length,r&&(o=r?'<span class="summary"> ('+r+")</span>":"")),a.editors.commentsTab.innerHTML=`${e.localize("commentsTab")}${l}`,a.editors.subtasksTab.innerHTML=`${e.localize("subtasksTab")}${o}`,e._currentUser.allowComment&&a.taskOrComment?a.editors.commentsTab.classList.remove("smart-hidden"):a.editors.commentsTab.classList.add("smart-hidden"),e.readonly&&!r?a.editors.subtasksTab.classList.add("smart-hidden"):a.editors.checklist.classList.contains("smart-hidden")||a.editors.subtasksTab.classList.remove("smart-hidden"),e.taskCustomFields.length>0?a.editors.fieldsTab.classList.remove("smart-hidden"):a.editors.fieldsTab.classList.add("smart-hidden"),a.taskOrComment&&(a.taskOrComment.data[e.dataSourceMap.updatedDate]||a.taskOrComment.data[e.dataSourceMap.createdDate])?a.editors.historyTab.classList.remove("smart-hidden"):a.editors.historyTab.classList.add("smart-hidden");const i=["checklist","color","dueDate","priority","progress","startDate","status","swimlane","tags","text","description","userId"];let n=0;for(let e=0;e<i.length;e++){const t=i[e];a.editors[t].classList.contains("smart-hidden")&&n++}n===i.length?a.tabs.detail.classList.add("smart-hidden"):a.tabs.detail.classList.remove("smart-hidden")},a.refreshFields=()=>{const t=a.querySelector(".fields"),s=a.taskOrComment?a.taskOrComment.data:{},l=e.taskCustomFields.length,r=a.querySelectorAll(["[container-for]"]).length;if(e._resetFields&&(delete e._resetFields,a.refreshFieldsDirty=!0,t.innerHTML=""),!0===a.refreshFieldsDirty)if(a.refreshFieldsDirty=!1,t.firstElementChild&&l<=r)for(let t=0;t<e.taskCustomFields.length;t++){const l=e.taskCustomFields[t];let r=s[l.dataField];const o=a.querySelector("[container-for="+l.dataField+"]");if(!o)continue;e.dataSourceMap[l.dataField]?o.classList.add("smart-hidden"):o.classList.remove("smart-hidden"),null==r&&(r="");const i=o.lastElementChild.firstElementChild;i.removeAttribute("dirty"),r&&r instanceof Date?"dateInput"===l.editor?i.value=r:r&&"dateRangeInput"===l.editor?Array.isArray(r)&&(i.value=r):i.value=""+r:i.value=""+r,"image"===l.editor?r||(i.innerHTML=e.localize("emptyImage")):"attachments"!==l.editor&&"attachment"!==l.editor||r||(i.innerHTML=e.localize("emptyAttachment"))}else{const a=document.createDocumentFragment(),l=(t,a,s)=>{null==a&&(a="");const l=document.createElement("div"),r=document.createElement("div"),o=document.createElement("div");void 0===s.visible&&(s.visible=!0),void 0===s.allowHide&&(s.allowHide=!0),s.allowHide?r.innerHTML=t+'<span class="icon"></span>':r.innerHTML=t,r.classList.add("editor-label"),s.allowHide&&(!1===s.visible&&r.lastElementChild.classList.add("hide"),r.lastElementChild.onpointerdown=()=>{s.visible=!s.visible,r.lastElementChild.classList.toggle("hide")}),o.classList.add("editor");let i=document.createElement("input");if(i.classList.add("smart-input"),void 0!==s.minLength&&(i.minLength=s.minLength),void 0!==s.maxLength&&(i.maxLength=s.maxLength),"textarea"===s.editor)i=document.createElement("smart-text-area"),void 0!==s.minLength&&(i.minLength=s.minLength),void 0!==s.maxLength&&(i.maxLength=s.maxLength);else if("password"===s.editor)i.type="password";else if("phone"===s.editor||"tel"===s.editor)Smart.PhoneInput?i=document.createElement("smart-phone-input"):i.type="tel";else if("url"===s.editor)i.type="url";else if("email"===s.editor)i.type="email";else if("date"===s.dataType||"dateInput"===s.editor)"dateRangeInput"===s.editor?(i=document.createElement("smart-date-range-input"),i.selectedDates=a):i=document.createElement("smart-date-input"),i.autoClose=!0,""===a&&(a=new Date),void 0!==s.minDate&&(i.min=s.minDate),void 0!==s.maxDate&&(i.max=s.maxDate);else if("boolean"===s.dataType)i=document.createElement("smart-check-box"),""===a&&(a=!1);else if("number"===s.dataType||"numberInput"===s.editor)i=document.createElement("smart-number-input"),a||(a=0),void 0!==s.min&&(i.min=s.min),void 0!==s.max&&(i.max=s.max);else if("string"===s.dataType&&s.options)i=document.createElement("smart-input"),i.readonly=!0,i.dropDownButtonPosition="right",i.dataSource=s.options;else if("string"===s.dataType&&"multiComboInput"===s.editor)i=document.createElement("smart-multi-combo-input"),i.readonly=!0,i.dropDownButtonPosition="right",i.dataSource=s.dataSource,i.pills=!0,i.selectedValues=[""+a],s.singleSelect&&(i.singleSelect=!0),s.colorItems&&(i.colorItems=!0);else if("string"!==s.dataType||"image"!==s.editor&&"images"!==s.editor){if("string"===s.dataType&&("attachment"===s.editor||"attachments"===s.editor))if(a.length>50){if("string"==typeof a&&(a.indexOf("[{")>=0||a.indexOf("}]")>=0)){let e="";if(a)try{e=JSON.parse(a)}catch(e){console.log(e)}a=e}const t=document.createElement("div");if(Array.isArray(a)){a.forEach((e=>{const a=document.createElement("div");a.title=e.label,a.classList.add("item"),a.innerHTML="<div></div>",a.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?a.firstElementChild.classList.add("smart-icon-image"):e.label.indexOf(".pdf")>=0?a.firstElementChild.classList.add("smart-icon-pdf"):e.label.indexOf(".tsv")>=0||e.label.indexOf(".txt")>=0||e.label.indexOf(".csv")>=0?a.firstElementChild.classList.add("smart-icon-text"):e.label.indexOf(".xls")>=0||e.label.indexOf(".xlsx")>=0?a.firstElementChild.classList.add("smart-icon-excel"):e.label.indexOf(".ppt")>=0?a.firstElementChild.classList.add("smart-icon-powerpoint"):e.label.indexOf(".zip")>=0||e.label.indexOf(".rar")>=0||e.label.indexOf(".7z")>=0?a.firstElementChild.classList.add("smart-icon-archive"):e.label.indexOf(".doc")>=0||e.label.indexOf(".docx")>=0?a.firstElementChild.classList.add("smart-icon-word"):a.firstElementChild.classList.add("smart-icon-file"),t.appendChild(a)}));const s=t;t._value=a,t.onpointerdown=a=>{if(a.target.classList.contains("attachment")){const l=t._value&&"string"==typeof t._value?JSON.parse(t._value):t._value,r=[...s.children[0].children].indexOf(a.target);if(l[r]){const t=document.createElement("a");if(l[r].value.indexOf(window.location.host)>=0)fetch(l[r].value).then((e=>e.blob())).then((e=>{const a=URL.createObjectURL(e);t.download=l[r].label,t.href=a,t.click()}));else{if(l[r].value.indexOf("base64")>=0){const a=e._getFileFromBase64(l[r].value);t.href=URL.createObjectURL(a)}else t.href=l[r].value;t.target="_blank",t.click()}}a.stopPropagation(),a.preventDefault()}}}i=t}else i=document.createElement("div"),a||(i.innerHTML=e.localize("emptyAttachment"))}else if(a.length>50)if(a.indexOf("base64")>=0){a=JSON.parse(a),window.Smart._createSmartImageModal=e._createImageModal;let t="";for(let e=0;e<a.length;e++){const s=a[e];t+=`<img style="margin-left: 5px;" onpointerdown="Smart._createSmartImageModal(this, event)" width="20" height="20" src="${s.value}" title="${s.label}"/>`}i=document.createElement("div"),i.innerHTML=t}else a=a.substring(0,50)+"...";else i=document.createElement("div"),a||(i.innerHTML=e.localize("emptyImage"));return i.setAttribute("data-field",s.dataField),i.classList.add("smart-kanban-task-field-editor"),s&&"dateRangeInput"===s.editor?i.value=a:i.value=""+a,i.onchange=()=>{i.setAttribute("dirty","")},o.appendChild(i),l.appendChild(r),l.appendChild(o),l.setAttribute("container-for",s.dataField),l},r=document.createElement("div");r.classList.add("editor-container"),a.appendChild(r);for(let t=0;t<e.taskCustomFields.length;t++){const a=e.taskCustomFields[t],o=l(a.label,s[a.dataField],a);r.appendChild(o),e.dataSourceMap[a.dataField]&&o.classList.add("smart-hidden")}t.innerHTML="",t.appendChild(a)}},a.refreshHistory=()=>{const t=a.querySelector(".history-table");if(!e.storeHistory)return void t.classList.add("smart-hidden");t.classList.remove("smart-hidden");const s=a.taskOrComment.data.history;let l=`<table><tr>\n <th>${e.localize("historyEvent")}</th>\n <th>${e.localize("historyAuthor")}</th>\n <th>${e.localize("historyDetails")}</th>\n <th>${e.localize("historyDate")}</th>\n </tr>\n `;for(let t=s.length-1;t>=0;t--){const a=s[t];if(l+=`<tr>\n <td>${e._getHistoryItemLabel(a)}</td>`,void 0!==a.user){const t=(t=>{const a=t?t.image:null;return{image:a?`background-image: url('${a}');`:"",label:t?t.name||t.id:e.localize("guestUser")}})(e.users.find((e=>e.id===a.user)));l+=`<td><div class="smart-kanban-task-user-history"><div class="icon smart-kanban-task-user" style="${t.image}"></div><div class="name">${t.label}</div></div></td>`}else l+="<td></td>";if("created"!==a.action){let t=a.details.oldValue,s=a.details.value;if("user"===a.action){const a=e.users.find((e=>e.id===t)),l=e.users.find((e=>e.id===s));t=a?a.name:e.localize("unassigned"),s=l?l.name:e.localize("unassigned")}if(t&&t instanceof Date&&(t=t.toLocaleString()),s&&s instanceof Date&&(s=s.toLocaleString()),"subtasks"===a.action){const t=a.details.value.filter((e=>e.completed));l+=`<td><span class="smart-truncate">${e.localize("taskSubtasksCompleted",{value:t.length+"/"+a.details.value.length})}</span></td>`}else l+=t?`<td><span class="smart-truncate">${e.localize("range",{oldValue:t,newValue:s})}</span></td>`:`<td><span class="smart-truncate">${e.localize("nullRange",{oldValue:t,newValue:s})}</span></td>`}else l+=`<td>${a.details.value}</td>`;l+=`\n <td>${a.date.toLocaleString()}</td>\n </tr>`}l+="</table>",t.innerHTML=l,a.refreshTabs()},a.refreshComments=()=>{if(!a.taskOrComment)return;const t=a.querySelector(".comments");t.classList.remove("smart-hidden");const s=e._getCommentsList(a.taskOrComment);s.classList.remove("dialog");const l=s.querySelector(".send");l&&(l.onclick=t=>{if(l.disabled)return;const s=JSON.parse(JSON.stringify(e._commentSelectionFor.data)),r=e._createComment();e._commentsList.textarea.value="",l.disabled=!0,a.refreshTabs();const o=JSON.parse(JSON.stringify(e._commentSelectionFor.data));e.$.fireEvent("change",{task:e._commentSelectionFor,id:o.id,value:o,oldValue:s}),e.$.fireEvent("taskUpdate",{id:o.id,value:o,oldValue:s}),e.$.fireEvent("commentAdd",{id:o.id,value:r}),t.stopPropagation(),t.preventDefault()}),t.innerHTML="",t.appendChild(s),a.refreshTabs()},u.forEach((e=>{e.onfocus=()=>{e.setAttribute("focus","")},e.onblur=()=>{e.removeAttribute("focus")},e.onkeydown=t=>{"Enter"===t.key&&(e.click(),t.stopPropagation())},e.onclick=e=>{const t=e.target.closest(".smart-kanban-tab"),s=t.getAttribute("view");switch(u.forEach((e=>{e.classList.remove("selected")})),t.focus(),t.classList.add("selected"),a.querySelectorAll(".smart-kanban-tab-content").forEach((e=>{e.classList.add("smart-hidden")})),s){case"details":a.querySelector(".details").classList.remove("smart-hidden");break;case"subtasks":a.querySelector(".subtasks").classList.remove("smart-hidden");break;case"comments":a.refreshComments();break;case"history":a.querySelector(".history").classList.remove("smart-hidden"),a.refreshHistory();break;case"fields":a.querySelector(".fields").classList.remove("smart-hidden"),a.refreshFields()}}})),(()=>{const e=a.editors.color;e.dataSource=["#D50000","#E67C73","#F4511E","#F6BF26","#33B679","#0B8043","#039BE5","#3F51B5","#7986CB","#8E24AA","#616161","#FFFFFF","#000000",""],e.valueDisplayMode="colorBox",e.classList.add("smart-kanban-color-input"),e.style.width="auto",e.style.height="auto",e.readonly=!0,e.dropDownWidth=50;const t=e.$.scrollView;t&&t.classList.add("smart-kanban-color-input"),e.onRender=()=>{const t=e.$.scrollView;t&&t.classList.add("smart-kanban-color-input")}})(),a.editors.newSubtask.onchange=()=>{a.editors.newSubtask.nextElementSibling.click()},a.editors.priority.onchange=()=>{e._setPriorityEditorIcon(!0)},e._setPriorityEditorIcon(),a.editPanelPopulated=!0,e.dialogRendered&&e.dialogRendered(a,a.editors,a.labels,a.tabs,a.layout,a.taskOrComment)}_setPriorityEditorIcon(e){const t=this,a=t._dialog;let s=a.editors.priority.selectedValues[0];null==s&&(s=""),e||a.taskOrComment&&a.taskOrComment.data&&void 0!==a.taskOrComment.data.priority&&(s=a.taskOrComment.data.priority);const l=e=>{switch(e.value){case"":return'<span style="margin-left: 0px; margin-right: 5px;" class="priority"></span>';case"low":return'<span style="margin-left: 0px; margin-right: 5px;" class="priority low"></span>';case"average":return'<span style="margin-left: 0px; margin-right: 5px;" class="priority average"></span>';case"high":return'<span style="margin-left: 0px; margin-right: 5px;" class="priority high"></span>';case"critical":return'<span style="margin-left: 0px; margin-right: 5px;" class="priority critical"></span>'}let t="margin-left: 1px; margin-right: 5px;";return t+="height: 0px;",t+="width: 0px;",t+="border-left-color: transparent;",t+="border-left-style: solid;",t+="border-left-width: 7px;",t+="border-right-color: transparent;",t+="border-right-style: solid;",t+="border-right-width: 7px;","low"!==e.value?(t+="border-bottom-color: "+e.color+";"||0,t+="border-bottom-style: solid;",t+="border-bottom-width: 12px;"):(t+="border-top-color: "+e.color+";"||0,t+="border-top-style: solid;",t+="border-top-width: 12px;"),t+="border-radius: 3px;",`<span class="${e.value} priority" style="${t}"></span>`};for(let e=0;e<t.priority.length;e++){const r=t.priority[e];if(s?a.editors.priorityIcon.classList.remove("smart-hidden"):a.editors.priorityIcon.classList.add("smart-hidden"),r.value===s){a.editors.priorityIcon.innerHTML='<div class="smart-kanban-task-text">'+l(r)+"</div>";break}}}_showHideDialogEditors(){const e=this,t=e._dialog,a=["checklist","color","dueDate","priority","progress","startDate","status","swimlane","tags","text","description","userId"];for(let s=0;s<a.length;s++){const l=a[s];e.dialogEditors.indexOf(l)>=0?t.showEditor(l):t.hideEditor(l)}const s=e._allColumns.map((e=>({color:e.color,label:e.label,value:e.dataField})));s.length<=1&&t.hideEditor("status"),t.editors.status.dataSource=s,0===t.editors.tags.dataSource.length?(t.editors.tags.classList.add("smart-hidden"),t.editors.emptyTags.classList.remove("smart-hidden")):(t.editors.tags.classList.remove("smart-hidden"),t.editors.emptyTags.classList.add("smart-hidden")),0===e.users.length&&t.hideEditor("userId")}_unescapeValue(e){if(null==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 a;for(let s in t)a=new RegExp(t[s].entity,"g"),e=e.replace(a,t[s].regex);return e}_escapeValue(e){return e=e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/'/g,"&#39;").replace(/"/g,"&quot;")}_beginEdit(e){const t=this;t.tags||(t.tags=[]);const a=t.dataSourceMap,s=e.data,l=t._dialog,r=l.editors,o=t.tags.length>0?[...t.tags,...t._customTags]:t._customTags,i=t._allColumns.find((e=>e.dataField===s[a.status]));if(l.label=t.localize("editTask",{taskId:s[a.id],text:s[a.text]}),r.text.value=t._unescapeValue(s[a.text]),r.description.value=t._unescapeValue(s[a.description]),r.tags.dataSource=o,t._showHideDialogEditors(),t.allowCustomTags,s[a.tags]){const e=e=>{let a=[];e.indexOf(",")>=0?a=e.split(","):Array.isArray(e)?a=a.concat(e):a.push(e);const s=[];for(let e=0;e<a.length;e++)"string"==typeof a[e]?(a[e]=t._unescapeValue(a[e].trim()),s.push(a[e])):(a[e].label=t._unescapeValue(a[e].label),s.push(a[e].value));return s};if(!t.allowCustomTags){const l=t.tags.length>0?t.tags:e(s[a.tags]);r.tags.dataSource=l}r.tags.selectedValues=e(s[a.tags])}else r.tags.selectedValues=[];0===r.tags.dataSource.length?(r.tags.classList.add("smart-hidden"),r.emptyTags.classList.remove("smart-hidden")):(r.tags.classList.remove("smart-hidden"),r.emptyTags.classList.add("smart-hidden")),l.editors.created.parentElement.classList.add("smart-hidden"),l.editors.updated.parentElement.classList.add("smart-hidden");const n=void 0!==s[a.createdUserId]?t.users.find((e=>e.id===s[a.createdUserId])):"",d=s[a.createdDate],c=void 0!==s[a.updatedUserId]?t.users.find((e=>e.id===s[a.updatedUserId])):"",u=s[a.updatedDate],m=e=>{const a=e?e.image:null;return{image:a?`background-image: url('${a}');`:"",label:e?e.name||e.id:t.localize("guestUser")}};if(n){const e=m(n);l.editors.created.parentElement.classList.remove("smart-hidden"),l.editors.created.innerHTML=`<div class="icon smart-kanban-task-user" style="${e.image}"></div><div class="name">${e.label}</div>`,d&&(l.editors.createdDate.innerHTML=d.toLocaleString())}if(c){const e=m(c);l.editors.updated.parentElement.classList.remove("smart-hidden"),l.editors.updated.innerHTML=`<div class="icon smart-kanban-task-user" style="${e.image}"></div><div class="name">${e.label}</div>`,u&&(l.editors.updatedDate.innerHTML=u.toLocaleString())}const p=null!==s[a.userId]?t.users.find((e=>e.id===s[a.userId])):"";p?r.userId.selectedItems=[{label:p.name,value:p.id,image:p.image?p.image:null}]:r.userId.value="",delete r.userId.$.input.dataValue,r.status.selectedValues=[i.dataField],t.readonly||!t._currentUser.allowEdit?(r.status.readonly=!1,r.priority.readonly=!1):(r.status.readonly=!0,r.priority.readonly=!0),delete r.status.$.input.dataValue,t._hasSwimlane(t.columns.indexOf(i))?r.swimlane.value=t.swimlanes.find((e=>e.dataField===s[a.swimlane])).label:r.swimlane.value="",delete r.swimlane.$.input.dataValue,r.startDate.value=s[a.startDate]||null,r.dueDate.value=s[a.dueDate]||null,r.progress.value=parseFloat(s[a.progress])||0;const h=t.localize(s[a.priority]);r.priority.value=null!=h?h:"",delete r.priority.$.input.dataValue,""===r.priority.value&&(r.priority.selectedValues=[]),r.color.value=s[a.color]||"";const g=[],f=[];(s[a.checklist]||[]).forEach(((e,t)=>{e.completed&&g.push(t),f.push({label:e.text,selected:!0===e.completed})})),0===t.swimlanes.length?(l.editors.swimlane.classList.add("smart-hidden"),l.editors.swimlaneLabel.classList.add("smart-hidden"),l.editors.swimlane.parentElement.classList.add("single-column")):(l.editors.swimlane.classList.remove("smart-hidden"),l.editors.swimlaneLabel.classList.remove("smart-hidden"),l.editors.swimlane.parentElement.classList.remove("single-column")),r.dueDate.onchange=r.startDate.onchange=()=>{r.startDate.value>=r.dueDate.value&&r.dueDate.value?(l.$.footer.firstElementChild.disabled=!0,l.querySelector(".editor-error-container").classList.remove("smart-hidden")):(l.$.footer.firstElementChild.disabled=!1,l.querySelector(".editor-error-container").classList.add("smart-hidden"))},r.startDate.value&&r.startDate.value>=r.dueDate.value&&r.dueDate.value&&(l.$.footer.firstElementChild.disabled=!0,l.querySelector(".editor-error-container").classList.remove("smart-hidden")),r.newSubtask.value="",r.checklist.dataSource=f,r.checklist.selectedIndexes=g,t._setPriorityEditorIcon(),l.refreshTabs(!0),l.selectTab(0)}_endEdit(){const e=this,t=e.dataSourceMap,a=e._dialog,s=a.editors,l=a.taskOrComment,r=l?l.data:void 0,o=Object.assign({},r);let i=s.startDate.value,n=s.dueDate.value;o[t.text]=e._escapeValue(s.text.value),o[t.description]=e._escapeValue(s.description.value);const d=[];for(let t=0;t<s.tags.dataSource.length;t++){const a=s.tags.dataSource[t];"string"==typeof a?s.tags.selectedValues.indexOf(a)>=0&&d.push(e._escapeValue(a)):s.tags.selectedValues.indexOf(a.value)>=0&&(a.label=e._escapeValue(a.label),d.push(a))}if(o[t.tags]=d,o[t.progress]=parseFloat(s.progress.value),o[t.color]=s.color.value,e._currentUser.info&&(o[t.updatedUserId]=e._currentUser.info.id,o[t.updatedDate]=new Date),o[t.color]||""===o[t.color]||delete o[t.color],void 0!==s.userId.$.input.dataValue&&(o[t.userId]=parseFloat(s.userId.$.input.dataValue)),void 0!==s.status.$.input.dataValue&&(o[t.status]=s.status.$.input.dataValue),s.swimlane.$.input.dataValue&&(o[t.swimlane]=s.swimlane.$.input.dataValue),i&&(i=i.toDate()),n&&(n=n.toDate()),o[t.startDate]=i,o[t.dueDate]=n,void 0!==s.priority.$.input.dataValue&&(o[t.priority]=s.priority.$.input.dataValue),o[t.checklist]=s.checklist.items.map((e=>({text:e.label.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/'/g,"&#39;").replace(/"/g,"&quot;").replace(/\\/g,""),completed:e.selected}))),e.taskCustomFields&&e.taskCustomFields.length>0)for(let t=0;t<e.taskCustomFields.length;t++){const s=e.taskCustomFields[t],l=a.querySelector("[data-field="+s.dataField+"]");if(l){let t=l.value;l.dataSource&&l.dataSource.length>0&&l.selectedValues.length>0&&(t=l.selectedValues.toString()),"smart-number-input"===l.nodeName.toLowerCase()&&(t=l.getValue()),"smart-date-input"===l.nodeName.toLowerCase()&&(t=l.getValue()),"smart-date-range-input"===l.nodeName.toLowerCase()&&(t=l.getValue()),(l.hasAttribute("dirty")||e.dialogCustomizationFunction)&&(o[s.dataField]=t)}}l?e.updateTask(l,o):e.addTask(o),s.tags.close()}_clearEditors(){const e=this,t=e._dialog.editors,a=e.tags.length>0?e.tags:e._customTags;t.text.value="",t.description.value="",t.tags.dataSource=a,t.tags.selectedValues=[],t.status.selectedValues=[],delete t.status.$.input.dataValue,t.swimlane.value="",delete t.swimlane.$.input.dataValue,t.userId.value="",delete t.userId.$.input.dataValue,t.progress.value=0,t.startDate.value=null,t.dueDate.value=null,t.priority.value="",t.priority.$.input.dataValue="",t.priority.selectedValues=[],t.color.value="",t.newSubtask.value="",t.created.innerHTML="",t.updated.innerHTML="",t.createdDate.innerHTML="",t.updatedDate.innerHTML="",t.checklist.dataSource=[],t.checklist.selectedIndexes=[]}_getCurrentUser(){const e=this,t=e.users;let a=e.currentUser,s=!0,l=!0,r=e.allowDrag,o=e.editable,i=!0;t&&null!==a&&(a=t.find((e=>e.id===a)),a&&(s=!1!==a.allowAdd,l=!1!==a.allowComment,r=r&&!1!==a.allowDrag,o=o&&!1!==a.allowEdit,i=!1!==a.allowRemove)),e._currentUser={allowAdd:s,allowComment:l,allowDrag:r,allowEdit:o,allowRemove:i,info:a}}_autoSaveState(e){const t=this;if(t.autoSaveState)if("object"!=typeof e)if(e&&t._autoSavedState){switch(e){case"collapsed":t._allColumns.forEach((e=>t._autoSavedState.collapsed[e.dataField]=e.collapsed));break;case"dataSource":t._autoSavedState.dataSource=t._getCurrentDataSource();break;case"filtering":t._autoSavedState.filtering=t._appliedFiltering;break;case"selection":{const e=t.dataSourceMap;let a=null,s=null;t._selectionInView&&(a=t._selectionInView.closest(".smart-kanban-column").column.dataField,s=t._selectionInView.getAttribute("swimlane")),t._autoSavedState.selection={selected:t._selectedTasks,selectionStart:t._selectionStart?t._selectionStart.data[e.id]:null,selectionInColumn:a,swimlane:s};break}case"sorting":t._autoSaveState.sorting=t._appliedSorting;break;case"tabs":t._autoSaveState.tabs=t._selectedTabs;break;case"visibility":t._autoSavedState.visibility={taskActions:t.taskActions,taskComments:t.taskComments,taskDue:t.taskDue,taskPriority:t.taskPriority,taskProgress:t.taskProgress,taskTags:t.taskTags,taskUserIcon:t.taskUserIcon}}window.localStorage.setItem("smartKanban"+t.id,JSON.stringify(t._autoSavedState))}else t._autoSavedState=t.saveState();else t._autoSavedState=e}_getCurrentDataFields(e){const t=this,a=[{name:"text",dataType:"string"},{name:"tags",dataType:"string"},{name:"priority",dataType:"string"},{name:"progress",dataType:"number"},{name:"startDate",dataType:"date"},{name:"dueDate",dataType:"date"},{name:"userId",dataType:"string"}],s=e&&e.length>0?e[0]:null;for(let e=0;e<t.taskCustomFields.length;e++)if(s){const l=typeof s[t.taskCustomFields[e].dataField];"number"===l?a.push({name:t.taskCustomFields[e].dataField,dataType:"number"}):"date"===l?a.push({name:t.taskCustomFields[e].dataField,dataType:"date"}):a.push({name:t.taskCustomFields[e].dataField,dataType:"string"})}else a.push({name:t.taskCustomFields[e].dataField,dataType:"string"});return a}_applyFilter(e,t){const a=this;if(a.dataSource&&a.dataSource.virtualDataSource)return a._requestVirtualDataSource("filter"),void a._autoSaveState("filtering");const s=a._getCurrentDataSource(),l=a._getCurrentDataFields(s),r=new Smart.DataAdapter({dataSource:s,dataFields:l,id:"id"});try{r._filter(e,t)}catch(e){return}if(a.virtualization){if(e&&e.length>0){const e=Object.keys(a.tasksByDataField);for(let t=0;t<e.length;t++){const s=e[t];delete a.tasksByDataField[s]._filtered;let l=a._getTasksByDataField(s),o=[];for(let e=0;e<l.length;e++){const t=l[e],a=r.dataItemById[t.id];a&&a.$.filtered&&o.push(t)}a.tasksByDataField[s]._filtered=o}}else{const e=Object.keys(a.tasksByDataField);for(let t=0;t<e.length;t++){const s=e[t];delete a.tasksByDataField[s]._filtered}}a._refreshColumns()}else{const e=Array.from(a.$.container.getElementsByClassName("smart-kanban-task"));for(let t=0;t<r.length;t++){const a=e[t],s=!r[t].$.filtered;a.classList.toggle("smart-hidden",s),a.filteredOut=s}a._allColumns.forEach((e=>a._refreshScrollViewer(e)))}a._autoSaveState("filtering")}_applyHandler(e,t){const a=this,s=a.isInShadowDOM||a.shadowRoot?e.composedPath()[0]:e.target,l=e.detail;a.$.customize.contains(s)||"customize"===t?(l.value.forEach((e=>a[e.dataField]=e.visible)),a._allColumns.forEach((e=>a._refreshScrollViewer(e))),a.virtualization&&(delete a._autoCardHeight,a._measureCardHeight(),a._refreshColumns()),a._autoSaveState("visibility")):a.$.filter.contains(s)||"filter"===t?a.addFilter(l.filters,l.operator,l.value):(a.$.sort.contains(s)||"sort"===t)&&a.addSort(l.sortByInfo),a.closePanel()}_applySort(){const e=this,t=e._appliedSorting;if(e._autoSaveState("sorting"),e.dataSource&&e.dataSource.virtualDataSource)e._requestVirtualDataSource("sort");else if(0!==t.dataFields.length)e._allColumns.forEach((a=>{const s=e._columnToElement.get(a).querySelector(".smart-scroll-viewer-content-container"),l=Array.from(s.children),r=[];if(l.length<2)return;let o;if(e.virtualization?e.tasksByDataField[a.dataField].forEach(((t,a)=>{const s=e.dataSourceMap,l=Object.assign({taskIndex:a},t);"low"===l[s.priority]&&(l[s.priority]="z"),r.push(l)})):l.forEach(((t,a)=>{const s=e.dataSourceMap,l=Object.assign({taskIndex:a},t.data);"low"===l[s.priority]&&(l[s.priority]="z"),r.push(l)})),e.taskCustomFields.length){const t=e._getCurrentDataFields(r);t.push({name:"taskIndex",dataType:"number"}),o=new Smart.DataAdapter({dataSource:r,observable:!1,dataFields:t,id:"id"})}else o=new Smart.DataAdapter({dataSource:r,observable:!1,dataFields:["taskIndex: number","text: string","tags: string","priority: string","progress: number","startDate: date","dueDate: date","userId: string"],id:"id"});if(o.sortBy(t.dataFields,t.dataTypes,t.orderBy),e.virtualization){if(e.tasksByDataField[a.dataField]._sorted=Smart.DataAdapter.Sort(e.tasksByDataField[a.dataField],t.dataFields,t.orderBy),e.tasksByDataField[a.dataField]._filtered){e.tasksByDataField[a.dataField]._originalFilteredData=JSON.parse(JSON.stringify(e.tasksByDataField[a.dataField]._filtered));const s=Smart.DataAdapter.Sort([...e.tasksByDataField[a.dataField]._filtered],t.dataFields,t.orderBy);e.tasksByDataField[a.dataField]._filtered=s||[]}e._refreshColumn(a.dataField)}else for(let e=0;e<o.length;e++)s.appendChild(l[o[e].taskIndex])}));else if(e.virtualization){const t=Object.keys(e.tasksByDataField);for(let a=0;a<t.length;a++){const s=t[a];delete e.tasksByDataField[s]._sorted,e.tasksByDataField[s]._filtered&&e.tasksByDataField[s]._originalFilteredData&&(e.tasksByDataField[s]._filtered=e.tasksByDataField[s]._originalFilteredData,delete e.tasksByDataField[s]._originalFilteredData),e._refreshColumn(s)}}}_closeSearchPanel(){const e=this;e._searchInfo&&(Array.from(e.$.container.querySelectorAll(".smart-kanban-task.smart-data-view-found, .smart-kanban-task.smart-data-view-highlighted")).forEach((e=>e.classList.remove("smart-data-view-found","smart-data-view-highlighted"))),delete e._searchInfo)}_constructFilterGroups(e){const t={text:"string",tags:"string",priority:"string",progress:"number",startDate:"date",dueDate:"date"},a={},s=[];e.filters.forEach((s=>{const l=s[0],r=t[l];let o=s[2],i=a[l];void 0===i&&(i=new Smart.Utilities.FilterGroup,a[l]=i),"date"===r&&"string"==typeof o&&(o=new Date(o));const n=i.createFilter(r,o,s[1]);i.addFilter(e.operator,n)}));for(let e in a)s.push([e,a[e]]);return s}_openSearchPanel(){const e=this;e.$.headerDropDown.classList.add("search-panel"),e.$.headerDropDown.classList.remove("customize-panel","filter-panel","sort-panel"),e.$.search.classList.remove("smart-hidden"),e.$.customize.classList.add("smart-hidden"),e.$.filter.classList.add("smart-hidden"),e.$.sort.classList.add("smart-hidden"),e._openHeaderDropDown(e.$.searchButton),e._searchInfo={source:e._getCurrentDataSource(),stringDataFields:["text","tags"]},""!==e.$.searchInput.value&&e._search(e.$.searchInput.value,!1)}_search(e,t=!0){const a=this;if(a._searchInfo.query=e,Array.from(a.$.container.querySelectorAll(".smart-kanban-task.smart-data-view-found, .smart-kanban-task.smart-data-view-highlighted")).forEach((e=>e.classList.remove("smart-data-view-found","smart-data-view-highlighted"))),""===e)return a.$.search.classList.remove("matches","no-matches"),delete a._searchInfo.foundIdsArray,delete a._searchInfo.foundIdsObject,void delete a._searchInfo.highlighted;const s=new Smart.DataAdapter({dataSource:a._searchInfo.source,dataFields:["text: string","tags: string"],id:"id"}),l=[],r=[],o={};a._searchInfo.stringDataFields.forEach((t=>{const a=new Smart.Utilities.FilterGroup,s=a.createFilter("string",e,"CONTAINS");a.addFilter("or",s),l.push([t,a])})),s._filter(l,"or");for(let e=0;e<s.length;e++){const t=s[e];!1!==t.$.filtered&&(r.push(t.$.id),o[t.$.id]=!0)}if(a._searchInfo.foundIdsArray=r,a._searchInfo.foundIdsObject=o,Array.from(a.$.container.getElementsByClassName("smart-kanban-task")).forEach((e=>{const s=e.data[a.dataSourceMap.id];if(o[s]){if(e.filteredOut)return r.splice(r.indexOf(s),1),void delete o[s];t&&r[0]===s&&e.classList.add("smart-data-view-highlighted"),e.classList.add("smart-data-view-found")}})),r.length>0){if(t){let e=r[0];a._searchInfo.highlighted=e,a.ensureVisible(e)}return a.$.search.classList.remove("no-matches"),a.$.search.classList.add("matches"),void(a.$.searchLabel.innerHTML=a.localize("found",{nth:t?1:0,n:r.length}))}a.$.search.classList.remove("matches"),a.$.search.classList.add("no-matches"),a.$.searchLabel.innerHTML=a.localize("found",{nth:0,n:0})}_bodyFocusinHandler(e){const t=this;let a=t.isInShadowDOM||t.shadowRoot?e.composedPath()[0]:e.target;if(a.classList.contains("smart-kanban-column-content-tasks")&&(a=a.$.content,!t._getSelectedItem(a,!0))){if(t.virtualization){const e=t._focusedTask;return void t.focusTask(e)}if(void 0!==t._focusedTask)return void t.focusTask(t._focusedTask);t._focusTask(t._getFirstItem(a))}}get _rtlAttr(){return this.rightToLeft?" right-to-left":""}get _tabindex(){return this.disabled||this.unfocusable?"":' tabindex="0"'}_appendAddNewColumn(e){const t=document.createElement("div");t.classList.add("smart-kanban-column","smart-kanban-add-new-column","smart-unselectable"),t.innerHTML=`<div class="smart-kanban-column-header smart-unselectable" > <div title="${this.localize("addNewColumn")}" class="smart-kanban-add-new-column-label smart-kanban-column-header-label"><span>+ ${this.localize("addNewStatus")}</span></div></div >\n <div class="smart-kanban-column-content no-sub-columns"><smart-scroll-viewer></smart-scroll-viewer></div>\n `,this.disabled||this.unfocusable||t.setAttribute("tabindex",0),t.column={dataField:"newStatus",label:"New Status"},e.appendChild(t)}selectTask(e){const t=this;t._selectedTasks.push(e),t._selectionStart=e,t._focusedTask=e;const a=t.querySelector(".smart-kanban-task[focus]");a&&a.removeAttribute("focus");const s=t.querySelector('.smart-kanban-task[data-id="'+e+'"]');s&&s.setAttribute("focus",""),t._refreshSelection(),t.ensureVisible(e)}unselectTask(e){const t=this,a=t._selectedTasks.indexOf(e);a>=0&&t._selectedTasks.splice(a,1),t._refreshSelection()}clearSelection(){const e=this;e._selectionStart=null,e._selectedTasks=[],e._refreshSelection()}getSelectedTasks(){return this._selectedTasks||(this._selectedTasks=[]),this._selectedTasks}getTask(e){return this.dataSource?this.dataSource.find((t=>{if(t.id===e)return t})):null}getColumn(e){const t=this;let a=null;for(let s=0;s<t.columns.length;s++)if(t.columns[s].dataField===e){a=t.columns[s];break}return a}getColumnDataItems(e){const t=this;let a=[];if(!t.getColumn(e)||!t.dataSource)return[];for(let s=0;s<t.dataSource.length;s++){const l=t.dataSource[s];l[t.dataSourceMap.status]===e&&a.push(l)}return a}_getFileFromBase64(e,t){let a=e.split(","),s=a[0].match(/:(.*?);/)[1],l=atob(a[1]),r=l.length,o=new Uint8Array(r);for(;r--;)o[r]=l.charCodeAt(r);return new File([o],t,{type:s})}updateColumn(e,t){const a=this;let s=null;for(let t=0;t<a.columns.length;t++)if(a.columns[t].dataField===e){s=a.columns[t];break}if(s){const e=s.label;void 0!==t.label&&(s.label=t.label),void 0!==t.collapsed&&(s.collapsed=t.collapsed),void 0!==t.collapsible&&(s.collapsible=t.collapsible),void 0!==t.orientation&&(s.orientation=t.orientation),void 0!==t.width&&(s.width=t.width),a._reset(),a.$.fireEvent("columnUpdate",{columnData:t,oldValue:e,value:s.label})}}addColumn(e){const t=this;e?(t.columns.push(e),t._reset(),t._createAddNewButton(),t.$.fireEvent("columnAdd",{columnData:e})):t._addNewColumnDynamically()}removeColumn(e){const t=this;let a=null,s=-1;for(let l=0;l<t.columns.length;l++)if(t.columns[l].dataField===e){a=t.columns[l],s=l;break}if(a&&t.columns.splice(s,1),t.dataSource)for(let a=0;a<t.dataSource.length;a++){const s=t.dataSource[a];if(s[t.dataSourceMap.status]===e){const e=JSON.parse(JSON.stringify(s));s[t.dataSourceMap.status]=t.columns[0].value;const a=JSON.parse(JSON.stringify(s));t.$.fireEvent("change",{task:s,id:a.id,value:a,oldValue:e}),t.$.fireEvent("taskUpdate",{id:a.id,value:a,oldValue:e})}}t._reset(),t._createAddNewButton(),t.$.fireEvent("columnRemove",{column:a})}_addNewColumnDynamically(){const e=this,t=e._dialog,a=Math.floor(9e4*Math.random()+1e4),s={label:e.localize("addNewStatus")+" "+a,dataField:"newStatus"+a,addNewButton:!0,collapsed:!1,collapsible:!0,orientation:"vertical"},l=e.$.body.querySelector(".smart-kanban-add-new-column").querySelector(".smart-kanban-add-new-column-label"),r=document.createElement("input");if(l.classList.add("pending"),l.appendChild(r),r.classList.add("smart-kanban-column-header-input"),e.columnColors){l.classList.add("colors");const t=e._getColorInput();l.appendChild(t)}function o(a){let o=r.value,i=l.querySelector("smart-color-input");i&&i.opened?e._columnAddTimer&&clearTimeout(e._columnAddTimer):(!1===/^\s*$/.test(o)?(o=o.trim(),s.label=o,s.dataField="dataField"+Math.floor(65536*(1+Math.random())).toString(16).substring(1)):""===o&&(o="",s.label="",s.dataField="dataField"+Math.floor(65536*(1+Math.random())).toString(16).substring(1)),l.classList.contains("pending")&&(e._columnAddTimer&&clearTimeout(e._columnAddTimer),e._columnAddTimer=setTimeout((()=>{if(l.classList.remove("pending"),r.parentNode&&r.parentNode.removeChild(r),i){s.color=i.value;const e=l.querySelector(".heading");if(e){const t=new Smart.Color(s.color).getInvertedColor();e.style.backgroundColor=s.color,e.style.color=t}i.remove()}e.columns.push(s),e._reset(),e._createAddNewButton(),t&&t.editPanelPopulated&&(t.editors.status.dataSource=e._allColumns.map((e=>({color:e.color,label:e.label,value:e.dataField})))),e.$.fireEvent("columnAdd",{newColumn:s}),delete e._columnAddTimer}),50),a.stopPropagation()))}r.focus(),r.onkeydown=e=>{"Escape"===e.key?(l.classList.remove("pending"),r&&r.parentElement&&(r.nextElementSibling&&"Smart-COLOR-INPUT"===r.nextElementSibling.nodeName&&r.nextElementSibling.remove(),r.parentElement.removeChild(r),e.stopPropagation(),e.preventDefault())):"Enter"===e.key&&o(e)},r.addEventListener("blur",o),r.addEventListener("change",o)}_handleColumnEditing(e){const t=this,a=t.columns.find((t=>t.dataField===e));if(t._columnEditing)return;const s=Array.from(t.$.body.getElementsByClassName("smart-kanban-column")).find((t=>t.column.dataField===e)).querySelector(".smart-kanban-column-header-label"),l=document.createElement("input");s.classList.add("pending"),s.appendChild(l);const r=a.label,o=a.color;if(l.value=a.label,l.classList.add("smart-kanban-column-header-input"),t.columnColors){s.classList.add("colors");const e=t._getColorInput();e.value=a.color||"transparent",s.appendChild(e)}function i(e){let i=l.value,n=s.querySelector("smart-color-input");if(!n||!n.opened){if(!1===/^\s*$/.test(i)?(i=i.trim(),a.label=i,s.querySelector(".smart-kanban-title").innerHTML=i.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/'/g,"&#39;").replace(/"/g,"&quot;").replace(/\\/g,"")):""===i&&(a.label="",s.querySelector(".smart-kanban-title").innerHTML="&nbsp;"),n){a.color=n.value;const e=s.querySelector(".heading");if(e){const s=new Smart.Color(a.color).getInvertedColor();t.columnColors?""===a.color?(e.style.backgroundColor="",e.style.color=""):(e.style.backgroundColor=a.color,e.style.color=s):(e.style.backgroundColor="",e.style.color="")}t.applyColumnColorToTasks&&s.closest(".smart-kanban-column").style.setProperty("--smart-primary",a.color),n.remove()}s.classList.remove("pending");try{l.parentNode&&l.parentNode.removeChild(l)}catch(e){t._error=e}t._columnEditTimer&&clearTimeout(t._columnEditTimer),t._columnEditing=!1,t._columnEditTimer=setTimeout((()=>{r===a.label&&o===a.color||t.$.fireEvent("columnUpdate",{column:a,oldValue:r,value:a.label}),delete t._columnEditTimer}),50),e.stopPropagation()}}t._columnEditing=!0,setTimeout((()=>{l.focus()}),50),l.onkeydown=e=>{if("Escape"===e.key){s.classList.remove("pending"),l.value=r;try{l.parentNode&&l.parentNode.removeChild(l)}catch(e){t._error=e}t._columnEditing=!1}else"Enter"===e.key&&i(e)},l.addEventListener("blur",i),l.addEventListener("change",i)}_validateDataSourceMap(){this.dataSourceMap=Object.assign({},{checklist:"checklist",color:"color",comments:"comments",dueDate:"dueDate",id:"id",priority:"priority",progress:"progress",startDate:"startDate",status:"status",swimlane:"swimlane",tags:"tags",text:"text",userId:"userId"},this.dataSourceMap)}});
1622
1622
 
1623
1623
  /***/ }),
1624
1624
 
@@ -1964,7 +1964,7 @@ var __webpack_exports__ = {};
1964
1964
  /* harmony import */ var _smart_kanban_js__WEBPACK_IMPORTED_MODULE_65__ = __webpack_require__(7498);
1965
1965
  /* harmony import */ var _smart_kanban_js__WEBPACK_IMPORTED_MODULE_65___default = /*#__PURE__*/__webpack_require__.n(_smart_kanban_js__WEBPACK_IMPORTED_MODULE_65__);
1966
1966
 
1967
- /* Smart UI v23.0.8 (2025-05-13)
1967
+ /* Smart UI v23.1.1 (2025-05-29)
1968
1968
  Copyright (c) 2011-2025 jQWidgets.
1969
1969
  License: https://htmlelements.com/license/ */ //
1970
1970